From: Andrea Cuccaro Date: Tue, 14 Jan 2020 15:19:11 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.4.3 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=953b434542b14e5764544ac2d6048b82ccce9487;p=motion2.git Built motion from commit (unavailable).|2.4.3 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9298a3d..7ed8224 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.4.3", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-01-14T15:11:56.253Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 587c7f4..2e122b4 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.4.3", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-01-14T15:11:56.253Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index ff7b7c8..c8132fb 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 _0x34e8=['STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','action'];(function(_0x1af8fe,_0x5a7373){var _0x4fc891=function(_0x1ba8c2){while(--_0x1ba8c2){_0x1af8fe['push'](_0x1af8fe['shift']());}};_0x4fc891(++_0x5a7373);}(_0x34e8,0x12c));var _0x834e=function(_0x468a87,_0x116aad){_0x468a87=_0x468a87-0x0;var _0x33d0aa=_0x34e8[_0x468a87];return _0x33d0aa;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'get':function(_0x35e6fb){return this['getDataValue'](_0x834e('0x3'));}},'action':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),'browser',_0x834e('0xa'),'script']],'msg':_0x834e('0xb')}},'comment':_0x834e('0xb')},'data1':{'type':Sequelize[_0x834e('0x4')](0x1000),'comment':_0x834e('0xc')},'data2':{'type':Sequelize[_0x834e('0x4')](0x1000),'comment':_0x834e('0xd')},'data3':{'type':Sequelize[_0x834e('0x4')](0x1000),'comment':_0x834e('0xe')},'data4':{'type':Sequelize[_0x834e('0x4')](0x1000)},'data5':{'type':Sequelize[_0x834e('0x4')](0x1000)},'data6':{'type':Sequelize[_0x834e('0x4')]},'data7':{'type':Sequelize[_0x834e('0xf')]}}; \ No newline at end of file +var _0x55ca=['sequelize','exports','action','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT'];(function(_0x44e220,_0x4874ca){var _0x5cd381=function(_0x5abff2){while(--_0x5abff2){_0x44e220['push'](_0x44e220['shift']());}};_0x5cd381(++_0x4874ca);}(_0x55ca,0x126));var _0xa55c=function(_0xbced40,_0x2fa5f0){_0xbced40=_0xbced40-0x0;var _0x230f2e=_0x55ca[_0xbced40];return _0x230f2e;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5edc58){return this['getDataValue'](_0xa55c('0x2'));}},'action':{'type':Sequelize[_0xa55c('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xa55c('0x4'),_0xa55c('0x5'),_0xa55c('0x6'),_0xa55c('0x7'),_0xa55c('0x8'),_0xa55c('0x9'),_0xa55c('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xa55c('0xb')},'data1':{'type':Sequelize[_0xa55c('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0xa55c('0x3')](0x1000),'comment':_0xa55c('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xa55c('0x3')](0x1000)},'data5':{'type':Sequelize[_0xa55c('0x3')](0x1000)},'data6':{'type':Sequelize[_0xa55c('0x3')]},'data7':{'type':Sequelize[_0xa55c('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5b47cc3..e2a4b6e 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 _0x629b=['reject','save','then','destroy','error','stack','name','send','update','body','Action','find','catch','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','set','apply'];(function(_0xb1937e,_0x330b2f){var _0x44474f=function(_0x4336e0){while(--_0x4336e0){_0xb1937e['push'](_0xb1937e['shift']());}};_0x44474f(++_0x330b2f);}(_0x629b,0x1da));var _0xb629=function(_0x4d9b29,_0x23a905){_0x4d9b29=_0x4d9b29-0x0;var _0x3e0b72=_0x629b[_0x4d9b29];return _0x3e0b72;};'use strict';var pdf=require(_0xb629('0x0'));var emlformat=require(_0xb629('0x1'));var rimraf=require(_0xb629('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb629('0x3'));var rp=require(_0xb629('0x4'));var moment=require(_0xb629('0x5'));var BPromise=require(_0xb629('0x6'));var Mustache=require(_0xb629('0x7'));var util=require(_0xb629('0x8'));var path=require(_0xb629('0x9'));var sox=require(_0xb629('0xa'));var csv=require(_0xb629('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb629('0xc'));var squel=require(_0xb629('0xd'));var crypto=require(_0xb629('0xe'));var jsforce=require(_0xb629('0xf'));var deskjs=require(_0xb629('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb629('0x11'));var Papa=require(_0xb629('0x12'));var Redis=require(_0xb629('0x13'));var authService=require(_0xb629('0x14'));var qs=require(_0xb629('0x15'));var hardwareService=require(_0xb629('0x16'));var logger=require(_0xb629('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb629('0x18'))['db'];function respondWithStatusCode(_0x39c83e,_0x4ff624){_0x4ff624=_0x4ff624||0xcc;return function(_0x42d8d6){if(_0x42d8d6){return _0x39c83e[_0xb629('0x19')](_0x4ff624);}return _0x39c83e[_0xb629('0x1a')](_0x4ff624)[_0xb629('0x1b')]();};}function respondWithResult(_0x4ee804,_0x902dbd){_0x902dbd=_0x902dbd||0xc8;return function(_0x434f59){if(_0x434f59){return _0x4ee804[_0xb629('0x1a')](_0x902dbd)[_0xb629('0x1c')](_0x434f59);}};}function respondWithFilteredResult(_0x1ddbc4,_0x8995a0){return function(_0x42b596){if(_0x42b596){var _0x26c604=_0x42b596['count'],_0x39328a=_0x8995a0[_0xb629('0x1d')],_0x7768c4=_0x8995a0[_0xb629('0x1d')]+_0x8995a0['limit'],_0x392dad;if(_0x7768c4>=_0x26c604){_0x7768c4=_0x26c604;_0x392dad=0xc8;}else{_0x392dad=0xce;}_0x1ddbc4['status'](_0x392dad);return _0x1ddbc4[_0xb629('0x1e')]('Content-Range',_0x39328a+'-'+_0x7768c4+'/'+_0x26c604)[_0xb629('0x1c')](_0x42b596);}return null;};}function patchUpdates(_0x1cceb7){return function(_0x4ff864){try{jsonpatch[_0xb629('0x1f')](_0x4ff864,_0x1cceb7,!![]);}catch(_0x1a4c49){return BPromise[_0xb629('0x20')](_0x1a4c49);}return _0x4ff864[_0xb629('0x21')]();};}function saveUpdates(_0x178c87,_0x483c5d){return function(_0x3be2af){if(_0x3be2af){return _0x3be2af['update'](_0x178c87)[_0xb629('0x22')](function(_0x3413e5){return _0x3413e5;});}return null;};}function removeEntity(_0x2b7867,_0x2fe602){return function(_0x132d6e){if(_0x132d6e){return _0x132d6e[_0xb629('0x23')]()['then'](function(){_0x2b7867['status'](0xcc)[_0xb629('0x1b')]();});}};}function handleEntityNotFound(_0x23bdce,_0x4d8465){return function(_0x44b161){if(!_0x44b161){_0x23bdce[_0xb629('0x19')](0x194);}return _0x44b161;};}function handleError(_0x5ea439,_0x343096){_0x343096=_0x343096||0x1f4;return function(_0x297718){logger[_0xb629('0x24')](_0x297718[_0xb629('0x25')]);if(_0x297718[_0xb629('0x26')]){delete _0x297718['name'];}_0x5ea439[_0xb629('0x1a')](_0x343096)[_0xb629('0x27')](_0x297718);};}exports[_0xb629('0x28')]=function(_0x3e7b7f,_0xd660c3){if(_0x3e7b7f[_0xb629('0x29')]['id']){delete _0x3e7b7f['body']['id'];}return db[_0xb629('0x2a')][_0xb629('0x2b')]({'where':{'id':_0x3e7b7f['params']['id']}})[_0xb629('0x22')](handleEntityNotFound(_0xd660c3,null))[_0xb629('0x22')](saveUpdates(_0x3e7b7f[_0xb629('0x29')],null))[_0xb629('0x22')](respondWithResult(_0xd660c3,null))[_0xb629('0x2c')](handleError(_0xd660c3,null));};exports[_0xb629('0x23')]=function(_0x49d327,_0x4ed929){return db[_0xb629('0x2a')]['find']({'where':{'id':_0x49d327[_0xb629('0x2d')]['id']}})[_0xb629('0x22')](handleEntityNotFound(_0x4ed929,null))[_0xb629('0x22')](removeEntity(_0x4ed929,null))[_0xb629('0x2c')](handleError(_0x4ed929,null));}; \ No newline at end of file +var _0x0c10=['end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x2e7c5b,_0x2e37f4){var _0x3ad5fd=function(_0x46e52f){while(--_0x46e52f){_0x2e7c5b['push'](_0x2e7c5b['shift']());}};_0x3ad5fd(++_0x2e37f4);}(_0x0c10,0x14f));var _0x00c1=function(_0x53bde7,_0xe2ca44){_0x53bde7=_0x53bde7-0x0;var _0x52d7f1=_0x0c10[_0x53bde7];return _0x52d7f1;};'use strict';var pdf=require(_0x00c1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00c1('0x1'));var zipdir=require(_0x00c1('0x2'));var jsonpatch=require(_0x00c1('0x3'));var rp=require(_0x00c1('0x4'));var moment=require(_0x00c1('0x5'));var BPromise=require(_0x00c1('0x6'));var Mustache=require(_0x00c1('0x7'));var util=require(_0x00c1('0x8'));var path=require(_0x00c1('0x9'));var sox=require(_0x00c1('0xa'));var csv=require(_0x00c1('0xb'));var ejs=require(_0x00c1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x00c1('0xd'));var crypto=require('crypto');var jsforce=require(_0x00c1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x00c1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x00c1('0xf'));var authService=require(_0x00c1('0x10'));var qs=require(_0x00c1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00c1('0x12'))(_0x00c1('0x13'));var utils=require(_0x00c1('0x14'));var config=require(_0x00c1('0x15'));var db=require(_0x00c1('0x16'))['db'];function respondWithStatusCode(_0x54648e,_0x7d4b1b){_0x7d4b1b=_0x7d4b1b||0xcc;return function(_0x4b7755){if(_0x4b7755){return _0x54648e[_0x00c1('0x17')](_0x7d4b1b);}return _0x54648e[_0x00c1('0x18')](_0x7d4b1b)[_0x00c1('0x19')]();};}function respondWithResult(_0x155115,_0x44c108){_0x44c108=_0x44c108||0xc8;return function(_0x2e6c6f){if(_0x2e6c6f){return _0x155115['status'](_0x44c108)['json'](_0x2e6c6f);}};}function respondWithFilteredResult(_0x562d0a,_0x55dd23){return function(_0x179114){if(_0x179114){var _0x5b49e3=_0x179114[_0x00c1('0x1a')],_0x58c8d4=_0x55dd23['offset'],_0x2b3258=_0x55dd23[_0x00c1('0x1b')]+_0x55dd23['limit'],_0x15a0b9;if(_0x2b3258>=_0x5b49e3){_0x2b3258=_0x5b49e3;_0x15a0b9=0xc8;}else{_0x15a0b9=0xce;}_0x562d0a[_0x00c1('0x18')](_0x15a0b9);return _0x562d0a[_0x00c1('0x1c')](_0x00c1('0x1d'),_0x58c8d4+'-'+_0x2b3258+'/'+_0x5b49e3)[_0x00c1('0x1e')](_0x179114);}return null;};}function patchUpdates(_0x35220f){return function(_0x223643){try{jsonpatch[_0x00c1('0x1f')](_0x223643,_0x35220f,!![]);}catch(_0x38da4b){return BPromise[_0x00c1('0x20')](_0x38da4b);}return _0x223643['save']();};}function saveUpdates(_0xa191f,_0x280edd){return function(_0x2e8b5a){if(_0x2e8b5a){return _0x2e8b5a[_0x00c1('0x21')](_0xa191f)[_0x00c1('0x22')](function(_0x4c8e73){return _0x4c8e73;});}return null;};}function removeEntity(_0x5f0a19,_0x508c94){return function(_0x56db28){if(_0x56db28){return _0x56db28[_0x00c1('0x23')]()['then'](function(){_0x5f0a19[_0x00c1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1487a9,_0x3316f5){return function(_0x189e68){if(!_0x189e68){_0x1487a9[_0x00c1('0x17')](0x194);}return _0x189e68;};}function handleError(_0x11bab4,_0x3541b3){_0x3541b3=_0x3541b3||0x1f4;return function(_0x55279e){logger[_0x00c1('0x24')](_0x55279e[_0x00c1('0x25')]);if(_0x55279e[_0x00c1('0x26')]){delete _0x55279e[_0x00c1('0x26')];}_0x11bab4[_0x00c1('0x18')](_0x3541b3)[_0x00c1('0x27')](_0x55279e);};}exports[_0x00c1('0x21')]=function(_0x6e00e,_0xb13a7e){if(_0x6e00e[_0x00c1('0x28')]['id']){delete _0x6e00e[_0x00c1('0x28')]['id'];}return db[_0x00c1('0x29')][_0x00c1('0x2a')]({'where':{'id':_0x6e00e[_0x00c1('0x2b')]['id']}})[_0x00c1('0x22')](handleEntityNotFound(_0xb13a7e,null))['then'](saveUpdates(_0x6e00e[_0x00c1('0x28')],null))[_0x00c1('0x22')](respondWithResult(_0xb13a7e,null))[_0x00c1('0x2c')](handleError(_0xb13a7e,null));};exports[_0x00c1('0x23')]=function(_0x206f1f,_0xf0058b){return db['Action']['find']({'where':{'id':_0x206f1f[_0x00c1('0x2b')]['id']}})[_0x00c1('0x22')](handleEntityNotFound(_0xf0058b,null))[_0x00c1('0x22')](removeEntity(_0xf0058b,null))[_0x00c1('0x2c')](handleError(_0xf0058b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ad6c010..43eb96b 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 _0xc5eb=['tools_actions','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc5eb,0x153));var _0xbc5e=function(_0x37fe48,_0x5af652){_0x37fe48=_0x37fe48-0x0;var _0x4bd1f4=_0xc5eb[_0x37fe48];return _0x4bd1f4;};'use strict';var _=require(_0xbc5e('0x0'));var util=require(_0xbc5e('0x1'));var logger=require('../../config/logger')(_0xbc5e('0x2'));var moment=require(_0xbc5e('0x3'));var BPromise=require(_0xbc5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc5e('0x5'));var rimraf=require(_0xbc5e('0x6'));var config=require(_0xbc5e('0x7'));var attributes=require(_0xbc5e('0x8'));module[_0xbc5e('0x9')]=function(_0x5d5442,_0x22fe53){return _0x5d5442[_0xbc5e('0xa')](_0xbc5e('0xb'),attributes,{'tableName':_0xbc5e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfec4=['moment','request-promise','../../config/environment','./action.attributes','exports','Action','util','../../config/logger','api'];(function(_0x5cd78c,_0x3ffe90){var _0x38b45c=function(_0x243236){while(--_0x243236){_0x5cd78c['push'](_0x5cd78c['shift']());}};_0x38b45c(++_0x3ffe90);}(_0xfec4,0x138));var _0x4fec=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xfec4[_0xd2d54];return _0x78b113;};'use strict';var _=require('lodash');var util=require(_0x4fec('0x0'));var logger=require(_0x4fec('0x1'))(_0x4fec('0x2'));var moment=require(_0x4fec('0x3'));var BPromise=require('bluebird');var rp=require(_0x4fec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fec('0x5'));var attributes=require(_0x4fec('0x6'));module[_0x4fec('0x7')]=function(_0x4a90e1,_0x4b6a3f){return _0x4a90e1['define'](_0x4fec('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 1a913f5..c5f6245 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 _0x0f9f=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x229b57,_0x576594){var _0x588c72=function(_0x5135fe){while(--_0x5135fe){_0x229b57['push'](_0x229b57['shift']());}};_0x588c72(++_0x576594);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x38a167,_0x744656){_0x38a167=_0x38a167-0x0;var _0x38f379=_0x0f9f[_0x38a167];return _0x38f379;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('Action,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('Action,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});} \ No newline at end of file +var _0xf2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1683cf,_0x20b3cb){var _0x1159ad=function(_0x241e90){while(--_0x241e90){_0x1683cf['push'](_0x1683cf['shift']());}};_0x1159ad(++_0x20b3cb);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x26cc16,_0x4c174f){_0x26cc16=_0x26cc16-0x0;var _0x345e3e=_0xf2ca[_0x26cc16];return _0x345e3e;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7c22d28..20a824f 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 _0xf81a=['isAuthenticated','update','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./action.controller','/:id'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf81a,0x16b));var _0xaf81=function(_0x356c2c,_0x38aca3){_0x356c2c=_0x356c2c-0x0;var _0x3468e5=_0xf81a[_0x356c2c];return _0x3468e5;};'use strict';var multer=require(_0xaf81('0x0'));var util=require(_0xaf81('0x1'));var path=require(_0xaf81('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf81('0x3'));var router=express[_0xaf81('0x4')]();var auth=require(_0xaf81('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf81('0x6'));var controller=require(_0xaf81('0x7'));router['put'](_0xaf81('0x8'),auth[_0xaf81('0x9')](),controller[_0xaf81('0xa')]);router['delete'](_0xaf81('0x8'),auth[_0xaf81('0x9')](),controller['destroy']);module[_0xaf81('0xb')]=router; \ No newline at end of file +var _0x8d37=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x53c07c,_0x19081a){var _0x4299d8=function(_0x4d67a8){while(--_0x4d67a8){_0x53c07c['push'](_0x53c07c['shift']());}};_0x4299d8(++_0x19081a);}(_0x8d37,0x1d5));var _0x78d3=function(_0x5501e2,_0xc10798){_0x5501e2=_0x5501e2-0x0;var _0x1c6373=_0x8d37[_0x5501e2];return _0x1c6373;};'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(_0x78d3('0x4'));var router=express['Router']();var auth=require(_0x78d3('0x5'));var interaction=require(_0x78d3('0x6'));var config=require(_0x78d3('0x7'));var controller=require(_0x78d3('0x8'));router[_0x78d3('0x9')](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xc')]);router['delete'](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xd')]);module[_0x78d3('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ac0fea0..2188a14 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 _0x7358=['exports','STRING','TEXT','sequelize'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x7358,0x67));var _0x8735=function(_0x1e86cc,_0x1fc97a){_0x1e86cc=_0x1e86cc-0x0;var _0x49f425=_0x7358[_0x1e86cc];return _0x49f425;};'use strict';var Sequelize=require(_0x8735('0x0'));module[_0x8735('0x1')]={'name':{'type':Sequelize[_0x8735('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8735('0x2')]},'parent':{'type':Sequelize[_0x8735('0x2')]},'table':{'type':Sequelize[_0x8735('0x2')]},'conditions':{'type':Sequelize[_0x8735('0x3')]},'joins':{'type':Sequelize[_0x8735('0x3')]}}; \ No newline at end of file +var _0x1348=['sequelize','exports','STRING','TEXT'];(function(_0x48cd15,_0x19e2e3){var _0x3d876d=function(_0x43dacd){while(--_0x43dacd){_0x48cd15['push'](_0x48cd15['shift']());}};_0x3d876d(++_0x19e2e3);}(_0x1348,0x198));var _0x8134=function(_0x327c89,_0x4fda79){_0x327c89=_0x327c89-0x0;var _0x2827b0=_0x1348[_0x327c89];return _0x2827b0;};'use strict';var Sequelize=require(_0x8134('0x0'));module[_0x8134('0x1')]={'name':{'type':Sequelize[_0x8134('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x8134('0x2')]},'table':{'type':Sequelize[_0x8134('0x2')]},'conditions':{'type':Sequelize[_0x8134('0x3')]},'joins':{'type':Sequelize[_0x8134('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f51d651..20b78b5 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 _0x0ca4=['html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','type','key','field','options','includeAll','findAll','catch','show','AnalyticCustomReport','include','find','create','body','user','role','Reports','UserProfileSection','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','params','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','format','replace','groupBy','orderBy','DESC','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','sequelize','toString','cross_join','SUM(%s)','SEC_TO_TIME(%s)','IS\x20NULL','Sequelize','function','foreignKey','QueryTypes','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','alias','clone','Limited\x20Query:'];(function(_0x35f3e8,_0x30663e){var _0x6144ce=function(_0x2a74dd){while(--_0x2a74dd){_0x35f3e8['push'](_0x35f3e8['shift']());}};_0x6144ce(++_0x30663e);}(_0x0ca4,0xa7));var _0x40ca=function(_0x3b00cb,_0x44cec3){_0x3b00cb=_0x3b00cb-0x0;var _0x540e08=_0x0ca4[_0x3b00cb];return _0x540e08;};'use strict';var pdf=require(_0x40ca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x40ca('0x1'));var zipdir=require(_0x40ca('0x2'));var jsonpatch=require(_0x40ca('0x3'));var rp=require('request-promise');var moment=require(_0x40ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40ca('0x5'));var util=require(_0x40ca('0x6'));var path=require(_0x40ca('0x7'));var sox=require(_0x40ca('0x8'));var csv=require(_0x40ca('0x9'));var ejs=require(_0x40ca('0xa'));var fs=require('fs');var _=require(_0x40ca('0xb'));var squel=require(_0x40ca('0xc'));var crypto=require('crypto');var jsforce=require(_0x40ca('0xd'));var deskjs=require(_0x40ca('0xe'));var toCsv=require(_0x40ca('0x9'));var querystring=require(_0x40ca('0xf'));var Papa=require(_0x40ca('0x10'));var Redis=require(_0x40ca('0x11'));var authService=require(_0x40ca('0x12'));var qs=require(_0x40ca('0x13'));var hardwareService=require(_0x40ca('0x14'));var logger=require(_0x40ca('0x15'))(_0x40ca('0x16'));var utils=require(_0x40ca('0x17'));var config=require(_0x40ca('0x18'));var db=require(_0x40ca('0x19'))['db'];function respondWithStatusCode(_0x459223,_0x14041f){_0x14041f=_0x14041f||0xcc;return function(_0x2eecb0){if(_0x2eecb0){return _0x459223[_0x40ca('0x1a')](_0x14041f);}return _0x459223[_0x40ca('0x1b')](_0x14041f)[_0x40ca('0x1c')]();};}function respondWithResult(_0x3319d8,_0x494e6f){_0x494e6f=_0x494e6f||0xc8;return function(_0x434161){if(_0x434161){return _0x3319d8[_0x40ca('0x1b')](_0x494e6f)['json'](_0x434161);}};}function respondWithFilteredResult(_0x4c184d,_0x4be491){return function(_0xe70b8d){if(_0xe70b8d){var _0x954843=_0xe70b8d[_0x40ca('0x1d')],_0xac164=_0x4be491[_0x40ca('0x1e')],_0x2802c3=_0x4be491[_0x40ca('0x1e')]+_0x4be491[_0x40ca('0x1f')],_0xa20f20;if(_0x2802c3>=_0x954843){_0x2802c3=_0x954843;_0xa20f20=0xc8;}else{_0xa20f20=0xce;}_0x4c184d['status'](_0xa20f20);return _0x4c184d[_0x40ca('0x20')](_0x40ca('0x21'),_0xac164+'-'+_0x2802c3+'/'+_0x954843)[_0x40ca('0x22')](_0xe70b8d);}return null;};}function patchUpdates(_0x5d8a89){return function(_0x20f003){try{jsonpatch[_0x40ca('0x23')](_0x20f003,_0x5d8a89,!![]);}catch(_0x508eaf){return BPromise['reject'](_0x508eaf);}return _0x20f003[_0x40ca('0x24')]();};}function saveUpdates(_0x237591,_0x102261){return function(_0x36e4ae){if(_0x36e4ae){return _0x36e4ae[_0x40ca('0x25')](_0x237591)['then'](function(_0xb0dfaa){return _0xb0dfaa;});}return null;};}function removeEntity(_0x18ed3e,_0x1f35cc){return function(_0x2c1910){if(_0x2c1910){return _0x2c1910[_0x40ca('0x26')]()[_0x40ca('0x27')](function(){var _0x3b1fd1=_0x2c1910[_0x40ca('0x28')]({'plain':!![]});var _0x14c617=_0x40ca('0x29');return db[_0x40ca('0x2a')]['destroy']({'where':{'type':_0x14c617,'resourceId':_0x3b1fd1['id']}})[_0x40ca('0x27')](function(){return _0x2c1910;});})[_0x40ca('0x27')](function(){_0x18ed3e[_0x40ca('0x1b')](0xcc)[_0x40ca('0x1c')]();});}};}function handleEntityNotFound(_0x57552d,_0x141730){return function(_0x2da54d){if(!_0x2da54d){_0x57552d[_0x40ca('0x1a')](0x194);}return _0x2da54d;};}function handleError(_0x196c25,_0x576b10){_0x576b10=_0x576b10||0x1f4;return function(_0x1d58af){logger[_0x40ca('0x2b')](_0x1d58af[_0x40ca('0x2c')]);if(_0x1d58af[_0x40ca('0x2d')]){delete _0x1d58af[_0x40ca('0x2d')];}_0x196c25[_0x40ca('0x1b')](_0x576b10)[_0x40ca('0x2e')](_0x1d58af);};}exports[_0x40ca('0x2f')]=function(_0x5dde36,_0x13f900){var _0x13748d={},_0x515cc0={},_0x89e17d={'count':0x0,'rows':[]};var _0x3e7340=db['AnalyticCustomReport'][_0x40ca('0x30')];_0x515cc0[_0x40ca('0x31')]=_[_0x40ca('0x32')](_0x3e7340);_0x515cc0[_0x40ca('0x33')]=_[_0x40ca('0x32')](_0x5dde36[_0x40ca('0x33')]);_0x515cc0[_0x40ca('0x34')]=_[_0x40ca('0x35')](_0x515cc0[_0x40ca('0x31')],_0x515cc0['query']);_0x13748d[_0x40ca('0x36')]=_[_0x40ca('0x35')](_0x515cc0['model'],qs[_0x40ca('0x37')](_0x5dde36['query'][_0x40ca('0x37')]));_0x13748d[_0x40ca('0x36')]=_0x13748d[_0x40ca('0x36')][_0x40ca('0x38')]?_0x13748d[_0x40ca('0x36')]:_0x515cc0['model'];if(!_0x5dde36[_0x40ca('0x33')][_0x40ca('0x39')](_0x40ca('0x3a'))){_0x13748d[_0x40ca('0x1f')]=qs[_0x40ca('0x1f')](_0x5dde36[_0x40ca('0x33')][_0x40ca('0x1f')]);_0x13748d[_0x40ca('0x1e')]=qs['offset'](_0x5dde36['query'][_0x40ca('0x1e')]);}_0x13748d[_0x40ca('0x3b')]=qs['sort'](_0x5dde36[_0x40ca('0x33')]['sort']);_0x13748d['where']=qs[_0x40ca('0x34')](_[_0x40ca('0x3c')](_0x5dde36[_0x40ca('0x33')],_0x515cc0[_0x40ca('0x34')]));if(_0x5dde36['query'][_0x40ca('0x3d')]){_0x13748d[_0x40ca('0x3e')]=_[_0x40ca('0x3f')](_0x13748d['where'],{'$or':_[_0x40ca('0x40')](_0x3e7340,function(_0x1b52c1){if(_0x1b52c1[_0x40ca('0x41')][_0x40ca('0x42')]!=='VIRTUAL'){var _0x214496={};_0x214496[_0x1b52c1[_0x40ca('0x43')]]={'$like':'%'+_0x5dde36[_0x40ca('0x33')]['filter']+'%'};return _0x214496;}})});}_0x13748d=_[_0x40ca('0x3f')]({},_0x13748d,_0x5dde36[_0x40ca('0x44')]);var _0x303824={'where':_0x13748d[_0x40ca('0x3e')]};return db['AnalyticCustomReport']['count'](_0x303824)[_0x40ca('0x27')](function(_0x38a99f){_0x89e17d[_0x40ca('0x1d')]=_0x38a99f;if(_0x5dde36['query'][_0x40ca('0x45')]){_0x13748d['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x40ca('0x46')](_0x13748d);})[_0x40ca('0x27')](function(_0x5d5248){_0x89e17d['rows']=_0x5d5248;return _0x89e17d;})[_0x40ca('0x27')](respondWithFilteredResult(_0x13f900,_0x13748d))[_0x40ca('0x47')](handleError(_0x13f900,null));};exports[_0x40ca('0x48')]=function(_0x2aab05,_0xd19130){var _0x37b175={'raw':![],'where':{'id':_0x2aab05['params']['id']}},_0x3ee54e={};_0x3ee54e['model']=_['keys'](db[_0x40ca('0x49')][_0x40ca('0x30')]);_0x3ee54e['query']=_[_0x40ca('0x32')](_0x2aab05[_0x40ca('0x33')]);_0x3ee54e[_0x40ca('0x34')]=_['intersection'](_0x3ee54e[_0x40ca('0x31')],_0x3ee54e[_0x40ca('0x33')]);_0x37b175[_0x40ca('0x36')]=_['intersection'](_0x3ee54e[_0x40ca('0x31')],qs[_0x40ca('0x37')](_0x2aab05[_0x40ca('0x33')][_0x40ca('0x37')]));_0x37b175[_0x40ca('0x36')]=_0x37b175[_0x40ca('0x36')]['length']?_0x37b175['attributes']:_0x3ee54e['model'];if(_0x2aab05['query'][_0x40ca('0x45')]){_0x37b175[_0x40ca('0x4a')]=[{'all':!![]}];}_0x37b175=_[_0x40ca('0x3f')]({},_0x37b175,_0x2aab05[_0x40ca('0x44')]);return db[_0x40ca('0x49')][_0x40ca('0x4b')](_0x37b175)['then'](handleEntityNotFound(_0xd19130,null))[_0x40ca('0x27')](respondWithResult(_0xd19130,null))[_0x40ca('0x47')](handleError(_0xd19130,null));};exports[_0x40ca('0x4c')]=function(_0x341317,_0x21e5c5){return db[_0x40ca('0x49')][_0x40ca('0x4c')](_0x341317[_0x40ca('0x4d')],{})[_0x40ca('0x27')](function(_0x2dae05){var _0x2dce71=_0x341317[_0x40ca('0x4e')]['get']({'plain':!![]});if(!_0x2dce71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dce71[_0x40ca('0x4f')]===_0x40ca('0x4e')){var _0x21e394=_0x2dae05[_0x40ca('0x28')]({'plain':!![]});var _0x6ff54e=_0x40ca('0x50');return db[_0x40ca('0x51')][_0x40ca('0x4b')]({'where':{'name':_0x6ff54e,'userProfileId':_0x2dce71['userProfileId']},'raw':!![]})[_0x40ca('0x27')](function(_0x27f948){if(_0x27f948&&_0x27f948['autoAssociation']===0x0){return db['UserProfileResource'][_0x40ca('0x4c')]({'name':_0x21e394[_0x40ca('0x2d')],'resourceId':_0x21e394['id'],'type':_0x40ca('0x29'),'sectionId':_0x27f948['id']},{})[_0x40ca('0x27')](function(){return _0x2dae05;});}else{return _0x2dae05;}})['catch'](function(_0x34e7a3){logger[_0x40ca('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34e7a3);throw _0x34e7a3;});}return _0x2dae05;})[_0x40ca('0x27')](respondWithResult(_0x21e5c5,0xc9))['catch'](handleError(_0x21e5c5,null));};exports[_0x40ca('0x25')]=function(_0x3e6d76,_0x28980e){if(_0x3e6d76['body']['id']){delete _0x3e6d76['body']['id'];}return db[_0x40ca('0x49')][_0x40ca('0x4b')]({'where':{'id':_0x3e6d76['params']['id']}})[_0x40ca('0x27')](handleEntityNotFound(_0x28980e,null))[_0x40ca('0x27')](saveUpdates(_0x3e6d76[_0x40ca('0x4d')],null))[_0x40ca('0x27')](respondWithResult(_0x28980e,null))[_0x40ca('0x47')](handleError(_0x28980e,null));};exports[_0x40ca('0x26')]=function(_0x4eb41f,_0x6989b0){return db[_0x40ca('0x49')]['find']({'where':{'id':_0x4eb41f['params']['id']}})['then'](handleEntityNotFound(_0x6989b0,null))[_0x40ca('0x27')](removeEntity(_0x6989b0,null))[_0x40ca('0x47')](handleError(_0x6989b0,null));};exports[_0x40ca('0x52')]=function(_0xa10af3,_0x11a20a){var _0x11e6c6=0xa;var _0x151272=[_0x40ca('0x53'),_0x40ca('0x54'),_0x40ca('0x55'),'cross_join'];var _0xa90205={'SUM':'SUM(%s)','COUNT':_0x40ca('0x56'),'COUNT DISTINCT':_0x40ca('0x57'),'MAX':_0x40ca('0x58'),'MIN':_0x40ca('0x59'),'AVG':_0x40ca('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x40ca('0x5b'),'GROUP_CONCAT DESC':_0x40ca('0x5c')};var _0x5455ad={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x40ca('0x5d'),'HOUR':_0x40ca('0x5e'),'ROUND':_0x40ca('0x5f'),'UNIX_TIMESTAMP':_0x40ca('0x60')};var _0x20acb8=function(_0x56f394){return!_[_0x40ca('0x61')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x40ca('0x62'),_0x40ca('0x63')],_0x56f394);};var _0x2bf76b=function(_0x344825){if(!_0x344825||!_0x344825[_0x40ca('0x64')]['length']){return'';}for(var _0x5b16c5='(',_0x49cc0e=0x0;_0x49cc0e<_0x344825[_0x40ca('0x64')][_0x40ca('0x38')];_0x49cc0e+=0x1){_0x49cc0e>0x0&&(_0x5b16c5+='\x20'+_0x344825[_0x40ca('0x65')]+'\x20');_0x5b16c5+=_0x344825[_0x40ca('0x64')][_0x49cc0e][_0x40ca('0x66')]?_0x2bf76b(_0x344825[_0x40ca('0x64')][_0x49cc0e]['group']):_0x344825['rules'][_0x49cc0e]['field']+'\x20'+_0x344825['rules'][_0x49cc0e][_0x40ca('0x67')]+(_0x20acb8(_0x344825['rules'][_0x49cc0e][_0x40ca('0x67')])?'\x20'+_0x344825[_0x40ca('0x64')][_0x49cc0e][_0x40ca('0x68')]:'');}return _0x5b16c5+')';};var _0x2fce82={'where':{'id':_0xa10af3[_0x40ca('0x69')]['id']}},_0x4b17b8,_0x290069,_0x26d693,_0x5ac47a,_0x258b9c;_0x2fce82=_[_0x40ca('0x3f')]({},_0x2fce82,_0xa10af3[_0x40ca('0x44')]);return db['AnalyticCustomReport']['find'](_0x2fce82)[_0x40ca('0x27')](function(_0x296cfd){if(_0x296cfd){_0x4b17b8=_0x296cfd;return _0x296cfd[_0x40ca('0x6a')]();}return null;})[_0x40ca('0x27')](function(_0x2f32d0){if(_0x2f32d0){if(!_0x2f32d0[_0x40ca('0x38')]){throw new db['Sequelize'][(_0x40ca('0x6b'))](_0x40ca('0x6c'),0x193);}_0x290069=_0x2f32d0;return db[_0x40ca('0x6d')][_0x40ca('0x46')]({'raw':!![]});}return null;})[_0x40ca('0x27')](function(_0x111e86){if(_0x111e86){_0x26d693=_[_0x40ca('0x6e')](_0x111e86,'id');var _0x188bda;var _0x58eac0=squel[_0x40ca('0x6f')]();_0x58eac0[_0x40ca('0x70')](_0x4b17b8[_0x40ca('0x71')]);for(var _0x296e55=0x0;_0x296e55<_0x290069[_0x40ca('0x38')];_0x296e55+=0x1){_0x188bda=_0x290069[_0x296e55][_0x40ca('0x72')]?_0x26d693[_0x290069[_0x296e55][_0x40ca('0x72')]][_0x40ca('0x73')]:_0x290069[_0x296e55][_0x40ca('0x43')];_0x188bda=_0x290069[_0x296e55]['function']?_['replace'](_0xa90205[_0x290069[_0x296e55]['function']],'%s',_0x188bda):_0x188bda;_0x188bda=_0x290069[_0x296e55][_0x40ca('0x74')]?_[_0x40ca('0x75')](_0x5455ad[_0x290069[_0x296e55]['format']],'%s',_0x188bda):_0x188bda;if(_0x290069[_0x296e55][_0x40ca('0x76')]){_0x58eac0[_0x40ca('0x66')](_0x188bda);}_0x290069[_0x296e55]['orderBy']&&_0x58eac0[_0x40ca('0x3b')](_0x188bda,_0x290069[_0x296e55][_0x40ca('0x77')]===_0x40ca('0x78')?![]:!![]);_0x58eac0[_0x40ca('0x43')](_0x188bda,_0x290069[_0x296e55]['alias']||_0x188bda);}if(_0x4b17b8[_0x40ca('0x79')]){_0x4b17b8['joins']=JSON[_0x40ca('0x7a')](_0x4b17b8[_0x40ca('0x79')]);for(var _0xce97d8=0x0;_0xce97d8<_0x4b17b8[_0x40ca('0x79')]['length'];_0xce97d8+=0x1){if(_0x4b17b8[_0x40ca('0x79')][_0xce97d8]['type']&&_[_0x40ca('0x61')](_0x151272,_0x4b17b8['joins'][_0xce97d8][_0x40ca('0x41')])&&_0x4b17b8[_0x40ca('0x79')][_0xce97d8]['parentKey']&&_0x4b17b8['joins'][_0xce97d8][_0x40ca('0x7b')]&&_0x4b17b8[_0x40ca('0x79')][_0xce97d8]['foreignKey']){_0x58eac0[_0x4b17b8[_0x40ca('0x79')][_0xce97d8]['type']](_0x4b17b8[_0x40ca('0x79')][_0xce97d8][_0x40ca('0x7b')],null,util[_0x40ca('0x74')](_0x40ca('0x7c'),_0x4b17b8[_0x40ca('0x71')],_0x4b17b8[_0x40ca('0x79')][_0xce97d8][_0x40ca('0x7d')],_0x4b17b8['joins'][_0xce97d8]['foreignTable'],_0x4b17b8['joins'][_0xce97d8]['foreignKey']));}}}if(_0x4b17b8[_0x40ca('0x7e')]){_0x4b17b8[_0x40ca('0x7e')]=JSON['parse'](_0x4b17b8[_0x40ca('0x7e')]);_0x58eac0['where'](_0x2bf76b(_0x4b17b8['conditions'][_0x40ca('0x66')]));}_0x258b9c=_0x58eac0['clone']();_0x58eac0[_0x40ca('0x1f')](_0x11e6c6);_0x58eac0['offset'](0x0);logger[_0x40ca('0x7f')]('Limited\x20Query:',_0x58eac0['toString']());return db[_0x40ca('0x80')][_0x40ca('0x33')](_0x58eac0[_0x40ca('0x81')](),{'type':db[_0x40ca('0x80')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x11a20a,null))[_0x40ca('0x47')](handleError(_0x11a20a,null));};function runReport(_0x2a9efd,_0x16b69a,_0x7302dc){var _0xc30de5=_0x16b69a[_0x40ca('0x2d')];var _0x2ccd6c=0xa;var _0x454a26=['join',_0x40ca('0x54'),_0x40ca('0x55'),_0x40ca('0x82')];var _0x1dbb5c={'SUM':_0x40ca('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x40ca('0x57'),'MAX':_0x40ca('0x58'),'MIN':'MIN(%s)','AVG':_0x40ca('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x40ca('0x5c')};var _0x4040c7={'SEC_TO_TIME':_0x40ca('0x84'),'DATE':'DATE(%s)','HOUR':_0x40ca('0x5e'),'ROUND':_0x40ca('0x5f'),'UNIX_TIMESTAMP':_0x40ca('0x60')};var _0xfee291=function(_0x133b86){return!_[_0x40ca('0x61')]([_0x40ca('0x85'),'IS\x20NOT\x20NULL',_0x40ca('0x62'),_0x40ca('0x63')],_0x133b86);};var _0xe969e3=function(_0x100229){if(!_0x100229||!_0x100229[_0x40ca('0x64')][_0x40ca('0x38')]){return'';}for(var _0x4596be='(',_0x21b3e3=0x0;_0x21b3e3<_0x100229[_0x40ca('0x64')][_0x40ca('0x38')];_0x21b3e3+=0x1){_0x21b3e3>0x0&&(_0x4596be+='\x20'+_0x100229[_0x40ca('0x65')]+'\x20');_0x4596be+=_0x100229[_0x40ca('0x64')][_0x21b3e3][_0x40ca('0x66')]?_0xe969e3(_0x100229[_0x40ca('0x64')][_0x21b3e3]['group']):_0x100229[_0x40ca('0x64')][_0x21b3e3][_0x40ca('0x43')]+'\x20'+_0x100229['rules'][_0x21b3e3][_0x40ca('0x67')]+(_0xfee291(_0x100229[_0x40ca('0x64')][_0x21b3e3][_0x40ca('0x67')])?'\x20'+_0x100229[_0x40ca('0x64')][_0x21b3e3]['value']:'');}return _0x4596be+')';};var _0x3b38b1={'where':{'id':_0x2a9efd['id']}},_0x3440be,_0x4ed87b,_0x3ded10,_0xe09cf7,_0x24af9e;_0x3b38b1=_[_0x40ca('0x3f')]({},_0x3b38b1,_0x7302dc);return db[_0x40ca('0x49')][_0x40ca('0x4b')](_0x3b38b1)[_0x40ca('0x27')](function(_0x3560fb){if(_0x3560fb){_0x3440be=_0x3560fb;return _0x3560fb[_0x40ca('0x6a')]();}return null;})['then'](function(_0x23c064){if(_0x23c064){if(!_0x23c064[_0x40ca('0x38')]){throw new db[(_0x40ca('0x86'))][(_0x40ca('0x6b'))](_0x40ca('0x6c'),0x193);}_0x4ed87b=_0x23c064;return db[_0x40ca('0x6d')][_0x40ca('0x46')]({'raw':!![]});}return null;})['then'](function(_0x16ce34){if(_0x16ce34){_0x3ded10=_['keyBy'](_0x16ce34,'id');var _0x96c093;var _0xac6afa=squel[_0x40ca('0x6f')]();_0xac6afa['from'](_0x3440be[_0x40ca('0x71')]);for(var _0x734db0=0x0;_0x734db0<_0x4ed87b[_0x40ca('0x38')];_0x734db0+=0x1){_0x96c093=_0x4ed87b[_0x734db0][_0x40ca('0x72')]?_0x3ded10[_0x4ed87b[_0x734db0][_0x40ca('0x72')]][_0x40ca('0x73')]:_0x4ed87b[_0x734db0][_0x40ca('0x43')];_0x96c093=_0x4ed87b[_0x734db0]['function']?_[_0x40ca('0x75')](_0x1dbb5c[_0x4ed87b[_0x734db0][_0x40ca('0x87')]],'%s',_0x96c093):_0x96c093;_0x96c093=_0x4ed87b[_0x734db0][_0x40ca('0x74')]?_[_0x40ca('0x75')](_0x4040c7[_0x4ed87b[_0x734db0][_0x40ca('0x74')]],'%s',_0x96c093):_0x96c093;if(_0x4ed87b[_0x734db0]['groupBy']){_0xac6afa[_0x40ca('0x66')](_0x96c093);}_0x4ed87b[_0x734db0][_0x40ca('0x77')]&&_0xac6afa[_0x40ca('0x3b')](_0x96c093,_0x4ed87b[_0x734db0][_0x40ca('0x77')]==='DESC'?![]:!![]);_0xac6afa[_0x40ca('0x43')](_0x96c093,_0x4ed87b[_0x734db0]['alias']||_0x96c093);}if(_0x3440be[_0x40ca('0x79')]){_0x3440be[_0x40ca('0x79')]=JSON[_0x40ca('0x7a')](_0x3440be[_0x40ca('0x79')]);for(var _0x1149ff=0x0;_0x1149ff<_0x3440be[_0x40ca('0x79')][_0x40ca('0x38')];_0x1149ff+=0x1){if(_0x3440be[_0x40ca('0x79')][_0x1149ff][_0x40ca('0x41')]&&_[_0x40ca('0x61')](_0x454a26,_0x3440be[_0x40ca('0x79')][_0x1149ff]['type'])&&_0x3440be[_0x40ca('0x79')][_0x1149ff][_0x40ca('0x7d')]&&_0x3440be[_0x40ca('0x79')][_0x1149ff][_0x40ca('0x7b')]&&_0x3440be['joins'][_0x1149ff][_0x40ca('0x88')]){_0xac6afa[_0x3440be[_0x40ca('0x79')][_0x1149ff][_0x40ca('0x41')]](_0x3440be[_0x40ca('0x79')][_0x1149ff][_0x40ca('0x7b')],null,util[_0x40ca('0x74')](_0x40ca('0x7c'),_0x3440be['table'],_0x3440be['joins'][_0x1149ff]['parentKey'],_0x3440be[_0x40ca('0x79')][_0x1149ff][_0x40ca('0x7b')],_0x3440be['joins'][_0x1149ff][_0x40ca('0x88')]));}}}if(_0x3440be[_0x40ca('0x7e')]){_0x3440be[_0x40ca('0x7e')]=JSON[_0x40ca('0x7a')](_0x3440be[_0x40ca('0x7e')]);_0xac6afa['where'](_0xe969e3(_0x3440be[_0x40ca('0x7e')][_0x40ca('0x66')]));}_0x24af9e=_0xac6afa['clone']();_0xac6afa[_0x40ca('0x1f')](_0x2ccd6c);_0xac6afa[_0x40ca('0x1e')](0x0);logger[_0x40ca('0x7f')]('Limited\x20Query:',_0xac6afa[_0x40ca('0x81')]());return db[_0x40ca('0x80')][_0x40ca('0x33')](_0xac6afa[_0x40ca('0x81')](),{'type':db[_0x40ca('0x80')][_0x40ca('0x89')][_0x40ca('0x8a')]});}})[_0x40ca('0x27')](function(_0x21886d){if(!_0x21886d[_0x40ca('0x38')]){throw new db['Sequelize'][(_0x40ca('0x6b'))](_0x40ca('0x8b'),0xcc);}if(_0x16b69a[_0x40ca('0x8c')]===_0x40ca('0x8d')){return null;}var _0x40c492=_[_0x40ca('0x3f')](_0x16b69a,{'name':_0x16b69a[_0x40ca('0x8e')]||_0x16b69a['name']||_0x3440be[_0x40ca('0x2d')],'basename':_0xc30de5,'savename':util[_0x40ca('0x74')](_0x40ca('0x8f'),_0x16b69a[_0x40ca('0x2d')]||_0x3440be['name'],require(_0x40ca('0x90'))['generate'](0x4),_0x16b69a['output']||'csv'),'reportId':_0x3440be['id'],'reportType':_0x40ca('0x91')});return db[_0x40ca('0x92')][_0x40ca('0x4c')](_0x40c492,{'raw':!![]});})['then'](function(_0xc56fb8){if(_0x3440be[_0x40ca('0x71')]===_0x40ca('0x93')){_0x24af9e[_0x40ca('0x3e')](_0x3440be[_0x40ca('0x71')]+_0x40ca('0x94'),_0x16b69a[_0x40ca('0x95')],_0x16b69a[_0x40ca('0x96')]);}else{_0x24af9e[_0x40ca('0x3e')](_0x3440be[_0x40ca('0x71')]+_0x40ca('0x97'),_0x16b69a['startDate'],_0x16b69a[_0x40ca('0x96')]);}if(_0xc56fb8){logger[_0x40ca('0x98')](_0x40ca('0x99'),_0x24af9e[_0x40ca('0x81')]());require('child_process')[_0x40ca('0x9a')](path[_0x40ca('0x53')](__dirname,_0x40ca('0x9b'),_0xc56fb8[_0x40ca('0x8c')]),[_0xc56fb8['id'],_0x24af9e[_0x40ca('0x81')](),path[_0x40ca('0x53')](__dirname,_0x40ca('0x9c'),_0xc56fb8[_0x40ca('0x9d')]),_0xc30de5]);return _0xc56fb8;}else{var _0x2c48a5=squel[_0x40ca('0x6f')]();_0x2c48a5['from']('('+_0x24af9e['toString']()+')',_0x40ca('0x9e'));_0x2c48a5[_0x40ca('0x43')](_0x40ca('0x9f'),_0x40ca('0x1d'));_0x24af9e[_0x40ca('0x1f')](_0x16b69a[_0x40ca('0x1f')]||_0x2ccd6c);_0x24af9e[_0x40ca('0x1e')](_0x16b69a[_0x40ca('0x1e')]||0x0);return db[_0x40ca('0x80')][_0x40ca('0x33')](_0x2c48a5[_0x40ca('0x81')](),{'type':db[_0x40ca('0x80')]['QueryTypes']['SELECT']})[_0x40ca('0x27')](function(_0x2c3f91){if(!_0x2c3f91[_0x40ca('0x38')]){_0xe09cf7=0x0;}else{_0xe09cf7=_0x2c3f91[0x0][_0x40ca('0x1d')]||0x0;}return db[_0x40ca('0x80')][_0x40ca('0x33')](_0x24af9e['toString'](),{'type':db[_0x40ca('0x80')]['QueryTypes'][_0x40ca('0x8a')]});})['then'](function(_0x486d05){return{'rows':_0x486d05||[],'count':_0xe09cf7};});}});}exports[_0x40ca('0xa0')]=function(_0x39289e,_0x296184){return runReport(_0x39289e[_0x40ca('0x69')],_0x39289e[_0x40ca('0x33')],_0x39289e['options'])[_0x40ca('0x27')](respondWithResult(_0x296184,null))[_0x40ca('0x47')](handleError(_0x296184,null));};exports[_0x40ca('0xa1')]=runReport;exports[_0x40ca('0x33')]=function(_0x1c9e5a,_0x46d459){var _0xeef618=0xa;var _0xde1b17=[_0x40ca('0x53'),_0x40ca('0x54'),_0x40ca('0x55'),_0x40ca('0x82')];var _0x301935={'SUM':_0x40ca('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x40ca('0x57'),'MAX':_0x40ca('0x58'),'MIN':_0x40ca('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x40ca('0xa2'),'GROUP_CONCAT ASC':_0x40ca('0x5b'),'GROUP_CONCAT DESC':_0x40ca('0x5c')};var _0x47758b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x40ca('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x40ca('0x60')};var _0x56407d=function(_0x2a91f4){return!_[_0x40ca('0x61')](['IS\x20NULL',_0x40ca('0xa3'),_0x40ca('0x62'),_0x40ca('0x63')],_0x2a91f4);};var _0x1ded5d=function(_0x4d5f2d){if(!_0x4d5f2d||!_0x4d5f2d[_0x40ca('0x64')][_0x40ca('0x38')]){return'';}for(var _0x5b7515='(',_0x13fcff=0x0;_0x13fcff<_0x4d5f2d[_0x40ca('0x64')][_0x40ca('0x38')];_0x13fcff+=0x1){_0x13fcff>0x0&&(_0x5b7515+='\x20'+_0x4d5f2d[_0x40ca('0x65')]+'\x20');_0x5b7515+=_0x4d5f2d[_0x40ca('0x64')][_0x13fcff][_0x40ca('0x66')]?_0x1ded5d(_0x4d5f2d['rules'][_0x13fcff]['group']):_0x4d5f2d[_0x40ca('0x64')][_0x13fcff][_0x40ca('0x43')]+'\x20'+_0x4d5f2d[_0x40ca('0x64')][_0x13fcff]['condition']+(_0x56407d(_0x4d5f2d[_0x40ca('0x64')][_0x13fcff][_0x40ca('0x67')])?'\x20'+_0x4d5f2d[_0x40ca('0x64')][_0x13fcff][_0x40ca('0x68')]:'');}return _0x5b7515+')';};var _0x407346={'where':{'id':_0x1c9e5a[_0x40ca('0x69')]['id']}},_0x4731ba,_0x56663b,_0x31cf46,_0x526189,_0x3774b4;_0x407346=_[_0x40ca('0x3f')]({},_0x407346,_0x1c9e5a['options']);return db[_0x40ca('0x49')][_0x40ca('0x4b')](_0x407346)['then'](function(_0x4cc0b1){if(_0x4cc0b1){_0x4731ba=_0x4cc0b1;return _0x4cc0b1[_0x40ca('0x6a')]();}return null;})['then'](function(_0x4d7f5f){if(_0x4d7f5f){if(!_0x4d7f5f[_0x40ca('0x38')]){throw new db[(_0x40ca('0x86'))][(_0x40ca('0x6b'))](_0x40ca('0x6c'),0x193);}_0x56663b=_0x4d7f5f;return db[_0x40ca('0x6d')][_0x40ca('0x46')]({'raw':!![]});}return null;})[_0x40ca('0x27')](function(_0x4410a9){if(_0x4410a9){_0x31cf46=_[_0x40ca('0x6e')](_0x4410a9,'id');var _0x16c202;var _0x42357d=squel[_0x40ca('0x6f')]();_0x42357d['from'](_0x4731ba[_0x40ca('0x71')]);for(var _0x53525e=0x0;_0x53525e<_0x56663b['length'];_0x53525e+=0x1){_0x16c202=_0x56663b[_0x53525e][_0x40ca('0x72')]?_0x31cf46[_0x56663b[_0x53525e][_0x40ca('0x72')]][_0x40ca('0x73')]:_0x56663b[_0x53525e][_0x40ca('0x43')];_0x16c202=_0x56663b[_0x53525e][_0x40ca('0x87')]?_[_0x40ca('0x75')](_0x301935[_0x56663b[_0x53525e][_0x40ca('0x87')]],'%s',_0x16c202):_0x16c202;_0x16c202=_0x56663b[_0x53525e][_0x40ca('0x74')]?_[_0x40ca('0x75')](_0x47758b[_0x56663b[_0x53525e][_0x40ca('0x74')]],'%s',_0x16c202):_0x16c202;if(_0x56663b[_0x53525e][_0x40ca('0x76')]){_0x42357d['group'](_0x16c202);}_0x56663b[_0x53525e]['orderBy']&&_0x42357d[_0x40ca('0x3b')](_0x16c202,_0x56663b[_0x53525e]['orderBy']===_0x40ca('0x78')?![]:!![]);_0x42357d['field'](_0x16c202,_0x56663b[_0x53525e][_0x40ca('0xa4')]||_0x16c202);}if(_0x4731ba[_0x40ca('0x79')]){_0x4731ba[_0x40ca('0x79')]=JSON['parse'](_0x4731ba[_0x40ca('0x79')]);for(var _0x4c7c5c=0x0;_0x4c7c5c<_0x4731ba[_0x40ca('0x79')][_0x40ca('0x38')];_0x4c7c5c+=0x1){if(_0x4731ba[_0x40ca('0x79')][_0x4c7c5c][_0x40ca('0x41')]&&_[_0x40ca('0x61')](_0xde1b17,_0x4731ba['joins'][_0x4c7c5c]['type'])&&_0x4731ba[_0x40ca('0x79')][_0x4c7c5c][_0x40ca('0x7d')]&&_0x4731ba[_0x40ca('0x79')][_0x4c7c5c][_0x40ca('0x7b')]&&_0x4731ba['joins'][_0x4c7c5c][_0x40ca('0x88')]){_0x42357d[_0x4731ba[_0x40ca('0x79')][_0x4c7c5c][_0x40ca('0x41')]](_0x4731ba[_0x40ca('0x79')][_0x4c7c5c][_0x40ca('0x7b')],null,util[_0x40ca('0x74')](_0x40ca('0x7c'),_0x4731ba[_0x40ca('0x71')],_0x4731ba['joins'][_0x4c7c5c]['parentKey'],_0x4731ba[_0x40ca('0x79')][_0x4c7c5c]['foreignTable'],_0x4731ba[_0x40ca('0x79')][_0x4c7c5c][_0x40ca('0x88')]));}}}if(_0x4731ba[_0x40ca('0x7e')]){_0x4731ba[_0x40ca('0x7e')]=JSON['parse'](_0x4731ba['conditions']);_0x42357d[_0x40ca('0x3e')](_0x1ded5d(_0x4731ba['conditions'][_0x40ca('0x66')]));}_0x3774b4=_0x42357d[_0x40ca('0xa5')]();_0x42357d[_0x40ca('0x1f')](_0xeef618);_0x42357d[_0x40ca('0x1e')](0x0);logger[_0x40ca('0x7f')](_0x40ca('0xa6'),_0x42357d[_0x40ca('0x81')]());return db[_0x40ca('0x80')][_0x40ca('0x33')](_0x42357d['toString'](),{'type':db[_0x40ca('0x80')][_0x40ca('0x89')][_0x40ca('0x8a')]});}})[_0x40ca('0x27')](function(){return{'sql':_0x3774b4['toString']()};})[_0x40ca('0x27')](respondWithResult(_0x46d459,null))[_0x40ca('0x47')](handleError(_0x46d459,null));}; \ No newline at end of file +var _0x09cc=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','toString','sequelize','cross_join','AVG(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','keyBy','%s.%s\x20=\x20%s.%s','clone','debug','QueryTypes','SELECT','ValidationErrorItem','No\x20available\x20data','fullPath','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','join','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','run','runReport','COUNT(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','include','AnalyticCustomReport','findAll','catch','show','params','rawAttributes','includeAll','find','create'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0x09cc,0x106));var _0xc09c=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x09cc[_0x318840];return _0x223da4;};'use strict';var pdf=require(_0xc09c('0x0'));var emlformat=require(_0xc09c('0x1'));var rimraf=require(_0xc09c('0x2'));var zipdir=require(_0xc09c('0x3'));var jsonpatch=require(_0xc09c('0x4'));var rp=require('request-promise');var moment=require(_0xc09c('0x5'));var BPromise=require(_0xc09c('0x6'));var Mustache=require(_0xc09c('0x7'));var util=require(_0xc09c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc09c('0x9'));var ejs=require(_0xc09c('0xa'));var fs=require('fs');var _=require(_0xc09c('0xb'));var squel=require(_0xc09c('0xc'));var crypto=require(_0xc09c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc09c('0xe'));var toCsv=require(_0xc09c('0x9'));var querystring=require(_0xc09c('0xf'));var Papa=require(_0xc09c('0x10'));var Redis=require(_0xc09c('0x11'));var authService=require(_0xc09c('0x12'));var qs=require(_0xc09c('0x13'));var hardwareService=require(_0xc09c('0x14'));var logger=require(_0xc09c('0x15'))(_0xc09c('0x16'));var utils=require(_0xc09c('0x17'));var config=require(_0xc09c('0x18'));var db=require(_0xc09c('0x19'))['db'];function respondWithStatusCode(_0x424378,_0x325834){_0x325834=_0x325834||0xcc;return function(_0x11a9e9){if(_0x11a9e9){return _0x424378[_0xc09c('0x1a')](_0x325834);}return _0x424378[_0xc09c('0x1b')](_0x325834)[_0xc09c('0x1c')]();};}function respondWithResult(_0x213695,_0x5e299c){_0x5e299c=_0x5e299c||0xc8;return function(_0x3df44d){if(_0x3df44d){return _0x213695[_0xc09c('0x1b')](_0x5e299c)[_0xc09c('0x1d')](_0x3df44d);}};}function respondWithFilteredResult(_0x21577e,_0x16a4c7){return function(_0x51b812){if(_0x51b812){var _0x4f36d8=_0x51b812[_0xc09c('0x1e')],_0x1de527=_0x16a4c7[_0xc09c('0x1f')],_0x4d3b56=_0x16a4c7[_0xc09c('0x1f')]+_0x16a4c7['limit'],_0x392ba3;if(_0x4d3b56>=_0x4f36d8){_0x4d3b56=_0x4f36d8;_0x392ba3=0xc8;}else{_0x392ba3=0xce;}_0x21577e[_0xc09c('0x1b')](_0x392ba3);return _0x21577e['set'](_0xc09c('0x20'),_0x1de527+'-'+_0x4d3b56+'/'+_0x4f36d8)[_0xc09c('0x1d')](_0x51b812);}return null;};}function patchUpdates(_0x32c655){return function(_0xb68b6d){try{jsonpatch[_0xc09c('0x21')](_0xb68b6d,_0x32c655,!![]);}catch(_0x2b8217){return BPromise['reject'](_0x2b8217);}return _0xb68b6d[_0xc09c('0x22')]();};}function saveUpdates(_0x39b8f7,_0x1f53cd){return function(_0x2d62d2){if(_0x2d62d2){return _0x2d62d2[_0xc09c('0x23')](_0x39b8f7)[_0xc09c('0x24')](function(_0x4335be){return _0x4335be;});}return null;};}function removeEntity(_0x105173,_0x210351){return function(_0x1f819c){if(_0x1f819c){return _0x1f819c[_0xc09c('0x25')]()[_0xc09c('0x24')](function(){var _0x51da29=_0x1f819c[_0xc09c('0x26')]({'plain':!![]});var _0xb7b634=_0xc09c('0x27');return db[_0xc09c('0x28')][_0xc09c('0x25')]({'where':{'type':_0xb7b634,'resourceId':_0x51da29['id']}})['then'](function(){return _0x1f819c;});})[_0xc09c('0x24')](function(){_0x105173[_0xc09c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c369,_0x567c1e){return function(_0x48f527){if(!_0x48f527){_0x54c369[_0xc09c('0x1a')](0x194);}return _0x48f527;};}function handleError(_0x2b4596,_0x32a803){_0x32a803=_0x32a803||0x1f4;return function(_0x34ab53){logger[_0xc09c('0x29')](_0x34ab53['stack']);if(_0x34ab53['name']){delete _0x34ab53[_0xc09c('0x2a')];}_0x2b4596['status'](_0x32a803)[_0xc09c('0x2b')](_0x34ab53);};}exports[_0xc09c('0x2c')]=function(_0x58a910,_0x1121e7){var _0x27af4e={},_0x9dad88={},_0x17c424={'count':0x0,'rows':[]};var _0x4e0610=db['AnalyticCustomReport']['rawAttributes'];_0x9dad88[_0xc09c('0x2d')]=_[_0xc09c('0x2e')](_0x4e0610);_0x9dad88[_0xc09c('0x2f')]=_[_0xc09c('0x2e')](_0x58a910[_0xc09c('0x2f')]);_0x9dad88[_0xc09c('0x30')]=_[_0xc09c('0x31')](_0x9dad88[_0xc09c('0x2d')],_0x9dad88[_0xc09c('0x2f')]);_0x27af4e['attributes']=_[_0xc09c('0x31')](_0x9dad88['model'],qs[_0xc09c('0x32')](_0x58a910[_0xc09c('0x2f')][_0xc09c('0x32')]));_0x27af4e[_0xc09c('0x33')]=_0x27af4e[_0xc09c('0x33')][_0xc09c('0x34')]?_0x27af4e[_0xc09c('0x33')]:_0x9dad88[_0xc09c('0x2d')];if(!_0x58a910['query'][_0xc09c('0x35')](_0xc09c('0x36'))){_0x27af4e[_0xc09c('0x37')]=qs['limit'](_0x58a910[_0xc09c('0x2f')][_0xc09c('0x37')]);_0x27af4e[_0xc09c('0x1f')]=qs[_0xc09c('0x1f')](_0x58a910[_0xc09c('0x2f')][_0xc09c('0x1f')]);}_0x27af4e['order']=qs['sort'](_0x58a910[_0xc09c('0x2f')][_0xc09c('0x38')]);_0x27af4e[_0xc09c('0x39')]=qs[_0xc09c('0x30')](_[_0xc09c('0x3a')](_0x58a910[_0xc09c('0x2f')],_0x9dad88['filters']));if(_0x58a910['query'][_0xc09c('0x3b')]){_0x27af4e[_0xc09c('0x39')]=_[_0xc09c('0x3c')](_0x27af4e['where'],{'$or':_[_0xc09c('0x3d')](_0x4e0610,function(_0x3d2bd2){if(_0x3d2bd2[_0xc09c('0x3e')]['key']!==_0xc09c('0x3f')){var _0x7de931={};_0x7de931[_0x3d2bd2[_0xc09c('0x40')]]={'$like':'%'+_0x58a910[_0xc09c('0x2f')]['filter']+'%'};return _0x7de931;}})});}_0x27af4e=_['merge']({},_0x27af4e,_0x58a910[_0xc09c('0x41')]);var _0x46c5b6={'where':_0x27af4e[_0xc09c('0x39')]};return db['AnalyticCustomReport'][_0xc09c('0x1e')](_0x46c5b6)[_0xc09c('0x24')](function(_0x19e874){_0x17c424['count']=_0x19e874;if(_0x58a910[_0xc09c('0x2f')]['includeAll']){_0x27af4e[_0xc09c('0x42')]=[{'all':!![]}];}return db[_0xc09c('0x43')][_0xc09c('0x44')](_0x27af4e);})[_0xc09c('0x24')](function(_0x49522d){_0x17c424['rows']=_0x49522d;return _0x17c424;})['then'](respondWithFilteredResult(_0x1121e7,_0x27af4e))[_0xc09c('0x45')](handleError(_0x1121e7,null));};exports[_0xc09c('0x46')]=function(_0x517c66,_0x5e2035){var _0x31d1ea={'raw':![],'where':{'id':_0x517c66[_0xc09c('0x47')]['id']}},_0x23ac74={};_0x23ac74[_0xc09c('0x2d')]=_[_0xc09c('0x2e')](db[_0xc09c('0x43')][_0xc09c('0x48')]);_0x23ac74[_0xc09c('0x2f')]=_[_0xc09c('0x2e')](_0x517c66[_0xc09c('0x2f')]);_0x23ac74[_0xc09c('0x30')]=_['intersection'](_0x23ac74['model'],_0x23ac74[_0xc09c('0x2f')]);_0x31d1ea[_0xc09c('0x33')]=_['intersection'](_0x23ac74['model'],qs[_0xc09c('0x32')](_0x517c66[_0xc09c('0x2f')][_0xc09c('0x32')]));_0x31d1ea[_0xc09c('0x33')]=_0x31d1ea[_0xc09c('0x33')]['length']?_0x31d1ea[_0xc09c('0x33')]:_0x23ac74[_0xc09c('0x2d')];if(_0x517c66[_0xc09c('0x2f')][_0xc09c('0x49')]){_0x31d1ea[_0xc09c('0x42')]=[{'all':!![]}];}_0x31d1ea=_['merge']({},_0x31d1ea,_0x517c66['options']);return db[_0xc09c('0x43')][_0xc09c('0x4a')](_0x31d1ea)['then'](handleEntityNotFound(_0x5e2035,null))[_0xc09c('0x24')](respondWithResult(_0x5e2035,null))[_0xc09c('0x45')](handleError(_0x5e2035,null));};exports[_0xc09c('0x4b')]=function(_0x2e4a65,_0x1084da){return db['AnalyticCustomReport'][_0xc09c('0x4b')](_0x2e4a65[_0xc09c('0x4c')],{})['then'](function(_0x5bce9e){var _0x4dcfd2=_0x2e4a65[_0xc09c('0x4d')]['get']({'plain':!![]});if(!_0x4dcfd2)throw new Error(_0xc09c('0x4e'));if(_0x4dcfd2[_0xc09c('0x4f')]==='user'){var _0xfdf796=_0x5bce9e['get']({'plain':!![]});var _0x959c96=_0xc09c('0x50');return db[_0xc09c('0x51')][_0xc09c('0x4a')]({'where':{'name':_0x959c96,'userProfileId':_0x4dcfd2[_0xc09c('0x52')]},'raw':!![]})[_0xc09c('0x24')](function(_0x4ca6a9){if(_0x4ca6a9&&_0x4ca6a9[_0xc09c('0x53')]===0x0){return db[_0xc09c('0x28')][_0xc09c('0x4b')]({'name':_0xfdf796[_0xc09c('0x2a')],'resourceId':_0xfdf796['id'],'type':'CustomReports','sectionId':_0x4ca6a9['id']},{})[_0xc09c('0x24')](function(){return _0x5bce9e;});}else{return _0x5bce9e;}})[_0xc09c('0x45')](function(_0x59a689){logger[_0xc09c('0x29')](_0xc09c('0x54'),_0x59a689);throw _0x59a689;});}return _0x5bce9e;})[_0xc09c('0x24')](respondWithResult(_0x1084da,0xc9))[_0xc09c('0x45')](handleError(_0x1084da,null));};exports[_0xc09c('0x23')]=function(_0x451322,_0x56924b){if(_0x451322[_0xc09c('0x4c')]['id']){delete _0x451322['body']['id'];}return db[_0xc09c('0x43')]['find']({'where':{'id':_0x451322[_0xc09c('0x47')]['id']}})[_0xc09c('0x24')](handleEntityNotFound(_0x56924b,null))[_0xc09c('0x24')](saveUpdates(_0x451322[_0xc09c('0x4c')],null))[_0xc09c('0x24')](respondWithResult(_0x56924b,null))['catch'](handleError(_0x56924b,null));};exports[_0xc09c('0x25')]=function(_0xfe62db,_0x5f5ba4){return db['AnalyticCustomReport'][_0xc09c('0x4a')]({'where':{'id':_0xfe62db[_0xc09c('0x47')]['id']}})[_0xc09c('0x24')](handleEntityNotFound(_0x5f5ba4,null))[_0xc09c('0x24')](removeEntity(_0x5f5ba4,null))[_0xc09c('0x45')](handleError(_0x5f5ba4,null));};exports[_0xc09c('0x55')]=function(_0x514626,_0x3e878){var _0x321d5b=0xa;var _0x511d9a=['join',_0xc09c('0x56'),_0xc09c('0x57'),'cross_join'];var _0x5afee6={'SUM':_0xc09c('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc09c('0x59'),'MAX':_0xc09c('0x5a'),'MIN':_0xc09c('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc09c('0x5c'),'GROUP_CONCAT ASC':_0xc09c('0x5d'),'GROUP_CONCAT DESC':_0xc09c('0x5e')};var _0x36693a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc09c('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x556960=function(_0x5514ec){return!_['includes']([_0xc09c('0x60'),_0xc09c('0x61'),_0xc09c('0x62'),_0xc09c('0x63')],_0x5514ec);};var _0x22202c=function(_0x1f93e6){if(!_0x1f93e6||!_0x1f93e6['rules'][_0xc09c('0x34')]){return'';}for(var _0x513bc9='(',_0x49d055=0x0;_0x49d055<_0x1f93e6[_0xc09c('0x64')][_0xc09c('0x34')];_0x49d055+=0x1){_0x49d055>0x0&&(_0x513bc9+='\x20'+_0x1f93e6[_0xc09c('0x65')]+'\x20');_0x513bc9+=_0x1f93e6['rules'][_0x49d055]['group']?_0x22202c(_0x1f93e6[_0xc09c('0x64')][_0x49d055]['group']):_0x1f93e6[_0xc09c('0x64')][_0x49d055][_0xc09c('0x40')]+'\x20'+_0x1f93e6[_0xc09c('0x64')][_0x49d055][_0xc09c('0x66')]+(_0x556960(_0x1f93e6[_0xc09c('0x64')][_0x49d055][_0xc09c('0x66')])?'\x20'+_0x1f93e6[_0xc09c('0x64')][_0x49d055][_0xc09c('0x67')]:'');}return _0x513bc9+')';};var _0x5b2aff={'where':{'id':_0x514626[_0xc09c('0x47')]['id']}},_0x48aac4,_0x29880e,_0x1d472b,_0x41f60c,_0x4f5e2b;_0x5b2aff=_[_0xc09c('0x3c')]({},_0x5b2aff,_0x514626[_0xc09c('0x41')]);return db[_0xc09c('0x43')]['find'](_0x5b2aff)['then'](function(_0x2600c0){if(_0x2600c0){_0x48aac4=_0x2600c0;return _0x2600c0[_0xc09c('0x68')]();}return null;})[_0xc09c('0x24')](function(_0x537689){if(_0x537689){if(!_0x537689[_0xc09c('0x34')]){throw new db[(_0xc09c('0x69'))]['ValidationErrorItem'](_0xc09c('0x6a'),0x193);}_0x29880e=_0x537689;return db[_0xc09c('0x6b')][_0xc09c('0x44')]({'raw':!![]});}return null;})[_0xc09c('0x24')](function(_0x49491e){if(_0x49491e){_0x1d472b=_['keyBy'](_0x49491e,'id');var _0x534637;var _0x183b78=squel['select']();_0x183b78[_0xc09c('0x6c')](_0x48aac4[_0xc09c('0x6d')]);for(var _0x401f1c=0x0;_0x401f1c<_0x29880e[_0xc09c('0x34')];_0x401f1c+=0x1){_0x534637=_0x29880e[_0x401f1c]['MetricId']?_0x1d472b[_0x29880e[_0x401f1c][_0xc09c('0x6e')]][_0xc09c('0x6f')]:_0x29880e[_0x401f1c][_0xc09c('0x40')];_0x534637=_0x29880e[_0x401f1c][_0xc09c('0x70')]?_[_0xc09c('0x71')](_0x5afee6[_0x29880e[_0x401f1c]['function']],'%s',_0x534637):_0x534637;_0x534637=_0x29880e[_0x401f1c][_0xc09c('0x72')]?_['replace'](_0x36693a[_0x29880e[_0x401f1c][_0xc09c('0x72')]],'%s',_0x534637):_0x534637;if(_0x29880e[_0x401f1c][_0xc09c('0x73')]){_0x183b78[_0xc09c('0x74')](_0x534637);}_0x29880e[_0x401f1c]['orderBy']&&_0x183b78['order'](_0x534637,_0x29880e[_0x401f1c][_0xc09c('0x75')]===_0xc09c('0x76')?![]:!![]);_0x183b78[_0xc09c('0x40')](_0x534637,_0x29880e[_0x401f1c][_0xc09c('0x77')]||_0x534637);}if(_0x48aac4['joins']){_0x48aac4[_0xc09c('0x78')]=JSON[_0xc09c('0x79')](_0x48aac4[_0xc09c('0x78')]);for(var _0x21800b=0x0;_0x21800b<_0x48aac4['joins'][_0xc09c('0x34')];_0x21800b+=0x1){if(_0x48aac4[_0xc09c('0x78')][_0x21800b][_0xc09c('0x3e')]&&_[_0xc09c('0x7a')](_0x511d9a,_0x48aac4[_0xc09c('0x78')][_0x21800b]['type'])&&_0x48aac4[_0xc09c('0x78')][_0x21800b][_0xc09c('0x7b')]&&_0x48aac4['joins'][_0x21800b][_0xc09c('0x7c')]&&_0x48aac4[_0xc09c('0x78')][_0x21800b]['foreignKey']){_0x183b78[_0x48aac4[_0xc09c('0x78')][_0x21800b][_0xc09c('0x3e')]](_0x48aac4['joins'][_0x21800b][_0xc09c('0x7c')],null,util[_0xc09c('0x72')]('%s.%s\x20=\x20%s.%s',_0x48aac4[_0xc09c('0x6d')],_0x48aac4[_0xc09c('0x78')][_0x21800b][_0xc09c('0x7b')],_0x48aac4[_0xc09c('0x78')][_0x21800b][_0xc09c('0x7c')],_0x48aac4[_0xc09c('0x78')][_0x21800b][_0xc09c('0x7d')]));}}}if(_0x48aac4['conditions']){_0x48aac4[_0xc09c('0x7e')]=JSON['parse'](_0x48aac4['conditions']);_0x183b78['where'](_0x22202c(_0x48aac4[_0xc09c('0x7e')][_0xc09c('0x74')]));}_0x4f5e2b=_0x183b78['clone']();_0x183b78[_0xc09c('0x37')](_0x321d5b);_0x183b78[_0xc09c('0x1f')](0x0);logger['debug'](_0xc09c('0x7f'),_0x183b78[_0xc09c('0x80')]());return db[_0xc09c('0x81')]['query'](_0x183b78[_0xc09c('0x80')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})[_0xc09c('0x24')](respondWithResult(_0x3e878,null))[_0xc09c('0x45')](handleError(_0x3e878,null));};function runReport(_0x4e0550,_0x4786a5,_0x23711e){var _0x5979ed=_0x4786a5[_0xc09c('0x2a')];var _0x1bfaf3=0xa;var _0x21ea4d=['join',_0xc09c('0x56'),'right_join',_0xc09c('0x82')];var _0x18a992={'SUM':_0xc09c('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc09c('0x59'),'MAX':'MAX(%s)','MIN':_0xc09c('0x5b'),'AVG':_0xc09c('0x83'),'GROUP_CONCAT':_0xc09c('0x5c'),'GROUP_CONCAT ASC':_0xc09c('0x5d'),'GROUP_CONCAT DESC':_0xc09c('0x5e')};var _0x3851bf={'SEC_TO_TIME':_0xc09c('0x84'),'DATE':_0xc09c('0x85'),'HOUR':_0xc09c('0x86'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc09c('0x87')};var _0x4f1d95=function(_0x3deb79){return!_[_0xc09c('0x7a')](['IS\x20NULL',_0xc09c('0x61'),_0xc09c('0x62'),_0xc09c('0x63')],_0x3deb79);};var _0x5181e8=function(_0x175828){if(!_0x175828||!_0x175828['rules'][_0xc09c('0x34')]){return'';}for(var _0x406e41='(',_0x3dc4f2=0x0;_0x3dc4f2<_0x175828[_0xc09c('0x64')][_0xc09c('0x34')];_0x3dc4f2+=0x1){_0x3dc4f2>0x0&&(_0x406e41+='\x20'+_0x175828['operator']+'\x20');_0x406e41+=_0x175828['rules'][_0x3dc4f2][_0xc09c('0x74')]?_0x5181e8(_0x175828[_0xc09c('0x64')][_0x3dc4f2]['group']):_0x175828['rules'][_0x3dc4f2][_0xc09c('0x40')]+'\x20'+_0x175828[_0xc09c('0x64')][_0x3dc4f2]['condition']+(_0x4f1d95(_0x175828['rules'][_0x3dc4f2][_0xc09c('0x66')])?'\x20'+_0x175828[_0xc09c('0x64')][_0x3dc4f2][_0xc09c('0x67')]:'');}return _0x406e41+')';};var _0x568da9={'where':{'id':_0x4e0550['id']}},_0x409fb9,_0x85ba5c,_0x4260b2,_0x136da1,_0x54546e;_0x568da9=_[_0xc09c('0x3c')]({},_0x568da9,_0x23711e);return db[_0xc09c('0x43')][_0xc09c('0x4a')](_0x568da9)[_0xc09c('0x24')](function(_0x13a406){if(_0x13a406){_0x409fb9=_0x13a406;return _0x13a406[_0xc09c('0x68')]();}return null;})[_0xc09c('0x24')](function(_0x2c6f7b){if(_0x2c6f7b){if(!_0x2c6f7b['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xc09c('0x6a'),0x193);}_0x85ba5c=_0x2c6f7b;return db['AnalyticMetric'][_0xc09c('0x44')]({'raw':!![]});}return null;})[_0xc09c('0x24')](function(_0x4c72bd){if(_0x4c72bd){_0x4260b2=_[_0xc09c('0x88')](_0x4c72bd,'id');var _0x5ec21f;var _0x15f8bc=squel['select']();_0x15f8bc[_0xc09c('0x6c')](_0x409fb9['table']);for(var _0x4f3a27=0x0;_0x4f3a27<_0x85ba5c[_0xc09c('0x34')];_0x4f3a27+=0x1){_0x5ec21f=_0x85ba5c[_0x4f3a27]['MetricId']?_0x4260b2[_0x85ba5c[_0x4f3a27]['MetricId']]['metric']:_0x85ba5c[_0x4f3a27]['field'];_0x5ec21f=_0x85ba5c[_0x4f3a27][_0xc09c('0x70')]?_[_0xc09c('0x71')](_0x18a992[_0x85ba5c[_0x4f3a27]['function']],'%s',_0x5ec21f):_0x5ec21f;_0x5ec21f=_0x85ba5c[_0x4f3a27][_0xc09c('0x72')]?_['replace'](_0x3851bf[_0x85ba5c[_0x4f3a27][_0xc09c('0x72')]],'%s',_0x5ec21f):_0x5ec21f;if(_0x85ba5c[_0x4f3a27][_0xc09c('0x73')]){_0x15f8bc[_0xc09c('0x74')](_0x5ec21f);}_0x85ba5c[_0x4f3a27][_0xc09c('0x75')]&&_0x15f8bc['order'](_0x5ec21f,_0x85ba5c[_0x4f3a27][_0xc09c('0x75')]===_0xc09c('0x76')?![]:!![]);_0x15f8bc[_0xc09c('0x40')](_0x5ec21f,_0x85ba5c[_0x4f3a27][_0xc09c('0x77')]||_0x5ec21f);}if(_0x409fb9[_0xc09c('0x78')]){_0x409fb9[_0xc09c('0x78')]=JSON['parse'](_0x409fb9[_0xc09c('0x78')]);for(var _0x29fbf3=0x0;_0x29fbf3<_0x409fb9[_0xc09c('0x78')]['length'];_0x29fbf3+=0x1){if(_0x409fb9[_0xc09c('0x78')][_0x29fbf3]['type']&&_['includes'](_0x21ea4d,_0x409fb9['joins'][_0x29fbf3][_0xc09c('0x3e')])&&_0x409fb9[_0xc09c('0x78')][_0x29fbf3][_0xc09c('0x7b')]&&_0x409fb9[_0xc09c('0x78')][_0x29fbf3][_0xc09c('0x7c')]&&_0x409fb9[_0xc09c('0x78')][_0x29fbf3][_0xc09c('0x7d')]){_0x15f8bc[_0x409fb9[_0xc09c('0x78')][_0x29fbf3][_0xc09c('0x3e')]](_0x409fb9[_0xc09c('0x78')][_0x29fbf3]['foreignTable'],null,util['format'](_0xc09c('0x89'),_0x409fb9[_0xc09c('0x6d')],_0x409fb9[_0xc09c('0x78')][_0x29fbf3][_0xc09c('0x7b')],_0x409fb9[_0xc09c('0x78')][_0x29fbf3][_0xc09c('0x7c')],_0x409fb9[_0xc09c('0x78')][_0x29fbf3]['foreignKey']));}}}if(_0x409fb9[_0xc09c('0x7e')]){_0x409fb9['conditions']=JSON[_0xc09c('0x79')](_0x409fb9[_0xc09c('0x7e')]);_0x15f8bc['where'](_0x5181e8(_0x409fb9['conditions'][_0xc09c('0x74')]));}_0x54546e=_0x15f8bc[_0xc09c('0x8a')]();_0x15f8bc['limit'](_0x1bfaf3);_0x15f8bc[_0xc09c('0x1f')](0x0);logger[_0xc09c('0x8b')](_0xc09c('0x7f'),_0x15f8bc['toString']());return db[_0xc09c('0x81')][_0xc09c('0x2f')](_0x15f8bc[_0xc09c('0x80')](),{'type':db['sequelize'][_0xc09c('0x8c')][_0xc09c('0x8d')]});}})[_0xc09c('0x24')](function(_0xaa53e7){if(!_0xaa53e7[_0xc09c('0x34')]){throw new db[(_0xc09c('0x69'))][(_0xc09c('0x8e'))](_0xc09c('0x8f'),0xcc);}if(_0x4786a5['output']==='web'){return null;}var _0x41caaf=_[_0xc09c('0x3c')](_0x4786a5,{'name':_0x4786a5[_0xc09c('0x90')]||_0x4786a5[_0xc09c('0x2a')]||_0x409fb9[_0xc09c('0x2a')],'basename':_0x5979ed,'savename':util['format']('%s-%s.%s',_0x4786a5['name']||_0x409fb9[_0xc09c('0x2a')],require(_0xc09c('0x91'))[_0xc09c('0x92')](0x4),_0x4786a5[_0xc09c('0x93')]||_0xc09c('0x94')),'reportId':_0x409fb9['id'],'reportType':_0xc09c('0x95')});return db[_0xc09c('0x96')][_0xc09c('0x4b')](_0x41caaf,{'raw':!![]});})[_0xc09c('0x24')](function(_0x4618df){if(_0x409fb9[_0xc09c('0x6d')]===_0xc09c('0x97')){_0x54546e['where'](_0x409fb9[_0xc09c('0x6d')]+_0xc09c('0x98'),_0x4786a5[_0xc09c('0x99')],_0x4786a5[_0xc09c('0x9a')]);}else{_0x54546e['where'](_0x409fb9[_0xc09c('0x6d')]+_0xc09c('0x9b'),_0x4786a5[_0xc09c('0x99')],_0x4786a5[_0xc09c('0x9a')]);}if(_0x4618df){logger[_0xc09c('0x9c')](_0xc09c('0x9d'),_0x54546e[_0xc09c('0x80')]());require(_0xc09c('0x9e'))['fork'](path[_0xc09c('0x9f')](__dirname,_0xc09c('0xa0'),_0x4618df['output']),[_0x4618df['id'],_0x54546e[_0xc09c('0x80')](),path[_0xc09c('0x9f')](__dirname,_0xc09c('0xa1'),_0x4618df[_0xc09c('0xa2')]),_0x5979ed]);return _0x4618df;}else{var _0x9f81a9=squel[_0xc09c('0xa3')]();_0x9f81a9['from']('('+_0x54546e['toString']()+')',_0xc09c('0xa4'));_0x9f81a9[_0xc09c('0x40')](_0xc09c('0xa5'),_0xc09c('0x1e'));_0x54546e[_0xc09c('0x37')](_0x4786a5[_0xc09c('0x37')]||_0x1bfaf3);_0x54546e[_0xc09c('0x1f')](_0x4786a5[_0xc09c('0x1f')]||0x0);return db['sequelize'][_0xc09c('0x2f')](_0x9f81a9[_0xc09c('0x80')](),{'type':db[_0xc09c('0x81')]['QueryTypes'][_0xc09c('0x8d')]})[_0xc09c('0x24')](function(_0x2123f0){if(!_0x2123f0['length']){_0x136da1=0x0;}else{_0x136da1=_0x2123f0[0x0][_0xc09c('0x1e')]||0x0;}return db[_0xc09c('0x81')]['query'](_0x54546e[_0xc09c('0x80')](),{'type':db[_0xc09c('0x81')][_0xc09c('0x8c')][_0xc09c('0x8d')]});})[_0xc09c('0x24')](function(_0x4e0a86){return{'rows':_0x4e0a86||[],'count':_0x136da1};});}});}exports[_0xc09c('0xa6')]=function(_0x5c3625,_0x222bca){return runReport(_0x5c3625['params'],_0x5c3625['query'],_0x5c3625[_0xc09c('0x41')])[_0xc09c('0x24')](respondWithResult(_0x222bca,null))[_0xc09c('0x45')](handleError(_0x222bca,null));};exports[_0xc09c('0xa7')]=runReport;exports[_0xc09c('0x2f')]=function(_0x3f586b,_0x3db7c6){var _0x115e44=0xa;var _0x5e432c=[_0xc09c('0x9f'),_0xc09c('0x56'),_0xc09c('0x57'),_0xc09c('0x82')];var _0x51f45a={'SUM':'SUM(%s)','COUNT':_0xc09c('0xa8'),'COUNT DISTINCT':_0xc09c('0x59'),'MAX':_0xc09c('0x5a'),'MIN':_0xc09c('0x5b'),'AVG':_0xc09c('0x83'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc09c('0x5e')};var _0x36c48a={'SEC_TO_TIME':_0xc09c('0x84'),'DATE':_0xc09c('0x85'),'HOUR':'HOUR(%s)','ROUND':_0xc09c('0x5f'),'UNIX_TIMESTAMP':_0xc09c('0x87')};var _0x277e6d=function(_0x1548ca){return!_[_0xc09c('0x7a')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xc09c('0x62'),'IS\x20NOT\x20EMPTY'],_0x1548ca);};var _0x51d346=function(_0x53275e){if(!_0x53275e||!_0x53275e[_0xc09c('0x64')][_0xc09c('0x34')]){return'';}for(var _0x436132='(',_0x2700f6=0x0;_0x2700f6<_0x53275e[_0xc09c('0x64')][_0xc09c('0x34')];_0x2700f6+=0x1){_0x2700f6>0x0&&(_0x436132+='\x20'+_0x53275e[_0xc09c('0x65')]+'\x20');_0x436132+=_0x53275e[_0xc09c('0x64')][_0x2700f6]['group']?_0x51d346(_0x53275e[_0xc09c('0x64')][_0x2700f6]['group']):_0x53275e[_0xc09c('0x64')][_0x2700f6]['field']+'\x20'+_0x53275e[_0xc09c('0x64')][_0x2700f6][_0xc09c('0x66')]+(_0x277e6d(_0x53275e[_0xc09c('0x64')][_0x2700f6][_0xc09c('0x66')])?'\x20'+_0x53275e[_0xc09c('0x64')][_0x2700f6][_0xc09c('0x67')]:'');}return _0x436132+')';};var _0x3ea8bb={'where':{'id':_0x3f586b[_0xc09c('0x47')]['id']}},_0x3fe957,_0x4ecd36,_0x21a1e0,_0x237b7d,_0x2dbb03;_0x3ea8bb=_[_0xc09c('0x3c')]({},_0x3ea8bb,_0x3f586b[_0xc09c('0x41')]);return db[_0xc09c('0x43')][_0xc09c('0x4a')](_0x3ea8bb)['then'](function(_0x5695e4){if(_0x5695e4){_0x3fe957=_0x5695e4;return _0x5695e4[_0xc09c('0x68')]();}return null;})[_0xc09c('0x24')](function(_0x40a756){if(_0x40a756){if(!_0x40a756[_0xc09c('0x34')]){throw new db[(_0xc09c('0x69'))][(_0xc09c('0x8e'))](_0xc09c('0x6a'),0x193);}_0x4ecd36=_0x40a756;return db[_0xc09c('0x6b')][_0xc09c('0x44')]({'raw':!![]});}return null;})[_0xc09c('0x24')](function(_0x369dd6){if(_0x369dd6){_0x21a1e0=_['keyBy'](_0x369dd6,'id');var _0x409118;var _0x279cbb=squel[_0xc09c('0xa3')]();_0x279cbb['from'](_0x3fe957['table']);for(var _0x393684=0x0;_0x393684<_0x4ecd36[_0xc09c('0x34')];_0x393684+=0x1){_0x409118=_0x4ecd36[_0x393684][_0xc09c('0x6e')]?_0x21a1e0[_0x4ecd36[_0x393684]['MetricId']]['metric']:_0x4ecd36[_0x393684][_0xc09c('0x40')];_0x409118=_0x4ecd36[_0x393684][_0xc09c('0x70')]?_['replace'](_0x51f45a[_0x4ecd36[_0x393684][_0xc09c('0x70')]],'%s',_0x409118):_0x409118;_0x409118=_0x4ecd36[_0x393684][_0xc09c('0x72')]?_[_0xc09c('0x71')](_0x36c48a[_0x4ecd36[_0x393684][_0xc09c('0x72')]],'%s',_0x409118):_0x409118;if(_0x4ecd36[_0x393684][_0xc09c('0x73')]){_0x279cbb[_0xc09c('0x74')](_0x409118);}_0x4ecd36[_0x393684][_0xc09c('0x75')]&&_0x279cbb['order'](_0x409118,_0x4ecd36[_0x393684][_0xc09c('0x75')]===_0xc09c('0x76')?![]:!![]);_0x279cbb[_0xc09c('0x40')](_0x409118,_0x4ecd36[_0x393684][_0xc09c('0x77')]||_0x409118);}if(_0x3fe957[_0xc09c('0x78')]){_0x3fe957[_0xc09c('0x78')]=JSON[_0xc09c('0x79')](_0x3fe957['joins']);for(var _0x5e673e=0x0;_0x5e673e<_0x3fe957[_0xc09c('0x78')]['length'];_0x5e673e+=0x1){if(_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x3e')]&&_[_0xc09c('0x7a')](_0x5e432c,_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x3e')])&&_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x7b')]&&_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x7c')]&&_0x3fe957[_0xc09c('0x78')][_0x5e673e]['foreignKey']){_0x279cbb[_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x3e')]](_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x7c')],null,util[_0xc09c('0x72')](_0xc09c('0x89'),_0x3fe957[_0xc09c('0x6d')],_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x7b')],_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x7c')],_0x3fe957[_0xc09c('0x78')][_0x5e673e][_0xc09c('0x7d')]));}}}if(_0x3fe957[_0xc09c('0x7e')]){_0x3fe957[_0xc09c('0x7e')]=JSON[_0xc09c('0x79')](_0x3fe957[_0xc09c('0x7e')]);_0x279cbb[_0xc09c('0x39')](_0x51d346(_0x3fe957[_0xc09c('0x7e')][_0xc09c('0x74')]));}_0x2dbb03=_0x279cbb[_0xc09c('0x8a')]();_0x279cbb[_0xc09c('0x37')](_0x115e44);_0x279cbb[_0xc09c('0x1f')](0x0);logger[_0xc09c('0x8b')]('Limited\x20Query:',_0x279cbb[_0xc09c('0x80')]());return db[_0xc09c('0x81')][_0xc09c('0x2f')](_0x279cbb[_0xc09c('0x80')](),{'type':db['sequelize'][_0xc09c('0x8c')][_0xc09c('0x8d')]});}})[_0xc09c('0x24')](function(){return{'sql':_0x2dbb03[_0xc09c('0x80')]()};})[_0xc09c('0x24')](respondWithResult(_0x3db7c6,null))['catch'](handleError(_0x3db7c6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2e01b6b..444728e 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 _0x107e=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x107e,0x122));var _0xe107=function(_0x2df4d7,_0x57da82){_0x2df4d7=_0x2df4d7-0x0;var _0x40787a=_0x107e[_0x2df4d7];return _0x40787a;};'use strict';var _=require(_0xe107('0x0'));var util=require(_0xe107('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe107('0x2'));var BPromise=require('bluebird');var rp=require(_0xe107('0x3'));var fs=require('fs');var path=require(_0xe107('0x4'));var rimraf=require(_0xe107('0x5'));var config=require(_0xe107('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xe107('0x7')]=function(_0x3debf6,_0x231d21){return _0x3debf6[_0xe107('0x8')](_0xe107('0x9'),attributes,{'tableName':_0xe107('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ba5=['define','AnalyticCustomReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x254081,_0x133020){var _0x15e822=function(_0x5835ea){while(--_0x5835ea){_0x254081['push'](_0x254081['shift']());}};_0x15e822(++_0x133020);}(_0x0ba5,0x1d6));var _0x50ba=function(_0xc7a0cb,_0x389964){_0xc7a0cb=_0xc7a0cb-0x0;var _0x10ce8e=_0x0ba5[_0xc7a0cb];return _0x10ce8e;};'use strict';var _=require(_0x50ba('0x0'));var util=require(_0x50ba('0x1'));var logger=require('../../config/logger')(_0x50ba('0x2'));var moment=require(_0x50ba('0x3'));var BPromise=require(_0x50ba('0x4'));var rp=require(_0x50ba('0x5'));var fs=require('fs');var path=require(_0x50ba('0x6'));var rimraf=require(_0x50ba('0x7'));var config=require(_0x50ba('0x8'));var attributes=require(_0x50ba('0x9'));module[_0x50ba('0xa')]=function(_0x568572,_0x215cc6){return _0x568572[_0x50ba('0xb')](_0x50ba('0xc'),attributes,{'tableName':'analytics_custom_reports','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 e10c049..50068fc 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x343dab,_0x134185){var _0xa7e52d=function(_0x37a2b8){while(--_0x37a2b8){_0x343dab['push'](_0x343dab['shift']());}};_0xa7e52d(++_0x134185);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xa9e0=['http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x351188,_0x55daa8){var _0x3c2ce5=function(_0x483af4){while(--_0x483af4){_0x351188['push'](_0x351188['shift']());}};_0x3c2ce5(++_0x55daa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index dd5e447..d444c0d 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 _0x056b=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','run','/:id/query','query'];(function(_0x240734,_0x52bb62){var _0x2ed089=function(_0x262299){while(--_0x262299){_0x240734['push'](_0x240734['shift']());}};_0x2ed089(++_0x52bb62);}(_0x056b,0xb6));var _0xb056=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x056b[_0x1c7377];return _0x5d03e3;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require(_0xb056('0x1'));var timeout=require(_0xb056('0x2'));var express=require(_0xb056('0x3'));var router=express[_0xb056('0x4')]();var auth=require(_0xb056('0x5'));var interaction=require(_0xb056('0x6'));var config=require(_0xb056('0x7'));var controller=require(_0xb056('0x8'));router[_0xb056('0x9')]('/',auth[_0xb056('0xa')](),controller['index']);router[_0xb056('0x9')](_0xb056('0xb'),auth[_0xb056('0xa')](),controller[_0xb056('0xc')]);router[_0xb056('0x9')](_0xb056('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0xb056('0x9')](_0xb056('0xe'),auth[_0xb056('0xa')](),controller[_0xb056('0xf')]);router['get'](_0xb056('0x10'),auth['isAuthenticated'](),controller[_0xb056('0x11')]);router[_0xb056('0x12')]('/',auth[_0xb056('0xa')](),controller[_0xb056('0x13')]);router[_0xb056('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb056('0x15')]);router[_0xb056('0x16')]('/:id',auth[_0xb056('0xa')](),controller[_0xb056('0x17')]);module[_0xb056('0x18')]=router; \ No newline at end of file +var _0x0abf=['exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','/:id/query','query','post','create','put','delete','destroy'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'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['preview']);router[_0xf0ab('0x6')](_0xf0ab('0xc'),auth[_0xf0ab('0x7')](),controller['run']);router['get'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0xf')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')](_0xf0ab('0x9'),auth[_0xf0ab('0x7')](),controller['update']);router[_0xf0ab('0x12')](_0xf0ab('0x9'),auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x13')]);module[_0xf0ab('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 6637360..f6db675 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 _0x5099=['exports','STRING','TEXT','sequelize'];(function(_0x1bc41f,_0x2e6cd7){var _0x1f7025=function(_0xbf9c8c){while(--_0xbf9c8c){_0x1bc41f['push'](_0x1bc41f['shift']());}};_0x1f7025(++_0x2e6cd7);}(_0x5099,0x107));var _0x9509=function(_0x59d414,_0x1176c2){_0x59d414=_0x59d414-0x0;var _0x3dbc45=_0x5099[_0x59d414];return _0x3dbc45;};'use strict';var Sequelize=require(_0x9509('0x0'));module[_0x9509('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9509('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9509('0x2')]},'conditions':{'type':Sequelize[_0x9509('0x3')]},'joins':{'type':Sequelize[_0x9509('0x3')]}}; \ No newline at end of file +var _0x3007=['STRING','TEXT','sequelize'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0x3007,0x18b));var _0x7300=function(_0x442e45,_0x52719d){_0x442e45=_0x442e45-0x0;var _0x26ebda=_0x3007[_0x442e45];return _0x26ebda;};'use strict';var Sequelize=require(_0x7300('0x0'));module['exports']={'name':{'type':Sequelize[_0x7300('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7300('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7300('0x2')]},'joins':{'type':Sequelize[_0x7300('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index b1ed9f3..b8a7329 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 _0x78d1=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','DefaultReports','end','sendStatus','error','stack','name','send','index','AnalyticDefaultReport','model','query','keys','filters','intersection','attributes','fields','order','sort','filter','where','map','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','Sequelize','DESC','clone','Limited\x20Query:','ValidationErrorItem','No\x20available\x20data','web','%s-%s.%s','randomstring','generate','output','csv','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','QueryTypes','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','operator','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x2b3c9d,_0x1c8c0c){var _0x4b8037=function(_0x225327){while(--_0x225327){_0x2b3c9d['push'](_0x2b3c9d['shift']());}};_0x4b8037(++_0x1c8c0c);}(_0x78d1,0x1d4));var _0x178d=function(_0x4397a2,_0x2fafb4){_0x4397a2=_0x4397a2-0x0;var _0x582918=_0x78d1[_0x4397a2];return _0x582918;};'use strict';var pdf=require(_0x178d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x178d('0x1'));var zipdir=require(_0x178d('0x2'));var jsonpatch=require(_0x178d('0x3'));var rp=require(_0x178d('0x4'));var moment=require(_0x178d('0x5'));var BPromise=require(_0x178d('0x6'));var Mustache=require(_0x178d('0x7'));var util=require(_0x178d('0x8'));var path=require(_0x178d('0x9'));var sox=require(_0x178d('0xa'));var csv=require('to-csv');var ejs=require(_0x178d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x178d('0xc'));var crypto=require(_0x178d('0xd'));var jsforce=require(_0x178d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x178d('0xf'));var querystring=require(_0x178d('0x10'));var Papa=require(_0x178d('0x11'));var Redis=require('ioredis');var authService=require(_0x178d('0x12'));var qs=require(_0x178d('0x13'));var hardwareService=require(_0x178d('0x14'));var logger=require(_0x178d('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x178d('0x16'))['db'];function respondWithStatusCode(_0x48eb76,_0x2ee3e7){_0x2ee3e7=_0x2ee3e7||0xcc;return function(_0x330e72){if(_0x330e72){return _0x48eb76['sendStatus'](_0x2ee3e7);}return _0x48eb76[_0x178d('0x17')](_0x2ee3e7)['end']();};}function respondWithResult(_0x44f86e,_0xd0c70){_0xd0c70=_0xd0c70||0xc8;return function(_0x3be263){if(_0x3be263){return _0x44f86e[_0x178d('0x17')](_0xd0c70)['json'](_0x3be263);}};}function respondWithFilteredResult(_0x530280,_0x453788){return function(_0x5d5932){if(_0x5d5932){var _0x33f3ad=_0x5d5932[_0x178d('0x18')],_0x274034=_0x453788[_0x178d('0x19')],_0xaecc70=_0x453788[_0x178d('0x19')]+_0x453788[_0x178d('0x1a')],_0x31ee6f;if(_0xaecc70>=_0x33f3ad){_0xaecc70=_0x33f3ad;_0x31ee6f=0xc8;}else{_0x31ee6f=0xce;}_0x530280[_0x178d('0x17')](_0x31ee6f);return _0x530280[_0x178d('0x1b')](_0x178d('0x1c'),_0x274034+'-'+_0xaecc70+'/'+_0x33f3ad)[_0x178d('0x1d')](_0x5d5932);}return null;};}function patchUpdates(_0x2221f2){return function(_0x419328){try{jsonpatch[_0x178d('0x1e')](_0x419328,_0x2221f2,!![]);}catch(_0x510851){return BPromise[_0x178d('0x1f')](_0x510851);}return _0x419328[_0x178d('0x20')]();};}function saveUpdates(_0x1faad8,_0x240034){return function(_0x408720){if(_0x408720){return _0x408720['update'](_0x1faad8)[_0x178d('0x21')](function(_0x25776a){return _0x25776a;});}return null;};}function removeEntity(_0x4a69cf,_0x58d40e){return function(_0x24c57f){if(_0x24c57f){return _0x24c57f[_0x178d('0x22')]()['then'](function(){var _0x382f12=_0x24c57f['get']({'plain':!![]});var _0x5b0918=_0x178d('0x23');return db['UserProfileResource'][_0x178d('0x22')]({'where':{'type':_0x5b0918,'resourceId':_0x382f12['id']}})[_0x178d('0x21')](function(){return _0x24c57f;});})[_0x178d('0x21')](function(){_0x4a69cf['status'](0xcc)[_0x178d('0x24')]();});}};}function handleEntityNotFound(_0x4a51ab,_0x37c335){return function(_0x480324){if(!_0x480324){_0x4a51ab[_0x178d('0x25')](0x194);}return _0x480324;};}function handleError(_0x4a6348,_0x103834){_0x103834=_0x103834||0x1f4;return function(_0x52b9c7){logger[_0x178d('0x26')](_0x52b9c7[_0x178d('0x27')]);if(_0x52b9c7[_0x178d('0x28')]){delete _0x52b9c7[_0x178d('0x28')];}_0x4a6348[_0x178d('0x17')](_0x103834)[_0x178d('0x29')](_0x52b9c7);};}exports[_0x178d('0x2a')]=function(_0x551b10,_0x1ea19a){var _0x3ad03={},_0x18d0eb={},_0x10db93={'count':0x0,'rows':[]};var _0x2d75ed=db[_0x178d('0x2b')]['rawAttributes'];_0x18d0eb[_0x178d('0x2c')]=_['keys'](_0x2d75ed);_0x18d0eb[_0x178d('0x2d')]=_[_0x178d('0x2e')](_0x551b10[_0x178d('0x2d')]);_0x18d0eb[_0x178d('0x2f')]=_[_0x178d('0x30')](_0x18d0eb[_0x178d('0x2c')],_0x18d0eb[_0x178d('0x2d')]);_0x3ad03[_0x178d('0x31')]=_[_0x178d('0x30')](_0x18d0eb['model'],qs[_0x178d('0x32')](_0x551b10[_0x178d('0x2d')][_0x178d('0x32')]));_0x3ad03['attributes']=_0x3ad03['attributes']['length']?_0x3ad03[_0x178d('0x31')]:_0x18d0eb['model'];if(!_0x551b10[_0x178d('0x2d')]['hasOwnProperty']('nolimit')){_0x3ad03[_0x178d('0x1a')]=qs[_0x178d('0x1a')](_0x551b10[_0x178d('0x2d')][_0x178d('0x1a')]);_0x3ad03[_0x178d('0x19')]=qs[_0x178d('0x19')](_0x551b10['query'][_0x178d('0x19')]);}_0x3ad03[_0x178d('0x33')]=qs[_0x178d('0x34')](_0x551b10[_0x178d('0x2d')]['sort']);_0x3ad03['where']=qs['filters'](_['pick'](_0x551b10[_0x178d('0x2d')],_0x18d0eb[_0x178d('0x2f')]));if(_0x551b10[_0x178d('0x2d')][_0x178d('0x35')]){_0x3ad03[_0x178d('0x36')]=_['merge'](_0x3ad03[_0x178d('0x36')],{'$or':_[_0x178d('0x37')](_0x2d75ed,function(_0x4dabe9){if(_0x4dabe9[_0x178d('0x38')]['key']!==_0x178d('0x39')){var _0x2fb4c7={};_0x2fb4c7[_0x4dabe9['field']]={'$like':'%'+_0x551b10[_0x178d('0x2d')][_0x178d('0x35')]+'%'};return _0x2fb4c7;}})});}_0x3ad03=_[_0x178d('0x3a')]({},_0x3ad03,_0x551b10[_0x178d('0x3b')]);var _0x549668={'where':_0x3ad03[_0x178d('0x36')]};return db[_0x178d('0x2b')][_0x178d('0x18')](_0x549668)[_0x178d('0x21')](function(_0x4e3c84){_0x10db93[_0x178d('0x18')]=_0x4e3c84;if(_0x551b10[_0x178d('0x2d')][_0x178d('0x3c')]){_0x3ad03[_0x178d('0x3d')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x178d('0x3e')](_0x3ad03);})[_0x178d('0x21')](function(_0x38eac2){_0x10db93['rows']=_0x38eac2;return _0x10db93;})[_0x178d('0x21')](respondWithFilteredResult(_0x1ea19a,_0x3ad03))[_0x178d('0x3f')](handleError(_0x1ea19a,null));};exports[_0x178d('0x40')]=function(_0x261c6d,_0x20fae2){var _0x54949d={'raw':!![],'where':{'id':_0x261c6d[_0x178d('0x41')]['id']}},_0x939dc={};_0x939dc['model']=_[_0x178d('0x2e')](db[_0x178d('0x2b')][_0x178d('0x42')]);_0x939dc['query']=_[_0x178d('0x2e')](_0x261c6d[_0x178d('0x2d')]);_0x939dc[_0x178d('0x2f')]=_[_0x178d('0x30')](_0x939dc['model'],_0x939dc[_0x178d('0x2d')]);_0x54949d[_0x178d('0x31')]=_[_0x178d('0x30')](_0x939dc[_0x178d('0x2c')],qs[_0x178d('0x32')](_0x261c6d['query']['fields']));_0x54949d[_0x178d('0x31')]=_0x54949d[_0x178d('0x31')][_0x178d('0x43')]?_0x54949d[_0x178d('0x31')]:_0x939dc[_0x178d('0x2c')];if(_0x261c6d[_0x178d('0x2d')][_0x178d('0x3c')]){_0x54949d['include']=[{'all':!![]}];}_0x54949d=_[_0x178d('0x3a')]({},_0x54949d,_0x261c6d[_0x178d('0x3b')]);return db[_0x178d('0x2b')]['find'](_0x54949d)[_0x178d('0x21')](handleEntityNotFound(_0x20fae2,null))[_0x178d('0x21')](respondWithResult(_0x20fae2,null))[_0x178d('0x3f')](handleError(_0x20fae2,null));};exports[_0x178d('0x44')]=function(_0x4c25ea,_0x1c1c0b){return db[_0x178d('0x2b')][_0x178d('0x44')](_0x4c25ea[_0x178d('0x45')],{})['then'](function(_0x1720f4){var _0x4a81da=_0x4c25ea[_0x178d('0x46')]['get']({'plain':!![]});if(!_0x4a81da)throw new Error(_0x178d('0x47'));if(_0x4a81da[_0x178d('0x48')]===_0x178d('0x46')){var _0xe9b58=_0x1720f4['get']({'plain':!![]});var _0x2af466=_0x178d('0x49');return db[_0x178d('0x4a')][_0x178d('0x4b')]({'where':{'name':_0x2af466,'userProfileId':_0x4a81da[_0x178d('0x4c')]},'raw':!![]})[_0x178d('0x21')](function(_0x4bfed8){if(_0x4bfed8&&_0x4bfed8['autoAssociation']===0x0){return db[_0x178d('0x4d')][_0x178d('0x44')]({'name':_0xe9b58[_0x178d('0x28')],'resourceId':_0xe9b58['id'],'type':_0x178d('0x23'),'sectionId':_0x4bfed8['id']},{})[_0x178d('0x21')](function(){return _0x1720f4;});}else{return _0x1720f4;}})[_0x178d('0x3f')](function(_0x4d2d5c){logger[_0x178d('0x26')](_0x178d('0x4e'),_0x4d2d5c);throw _0x4d2d5c;});}return _0x1720f4;})[_0x178d('0x21')](respondWithResult(_0x1c1c0b,0xc9))[_0x178d('0x3f')](handleError(_0x1c1c0b,null));};exports[_0x178d('0x4f')]=function(_0x2eb7c7,_0x1e1292){if(_0x2eb7c7['body']['id']){delete _0x2eb7c7['body']['id'];}return db[_0x178d('0x2b')][_0x178d('0x4b')]({'where':{'id':_0x2eb7c7['params']['id']}})[_0x178d('0x21')](handleEntityNotFound(_0x1e1292,null))[_0x178d('0x21')](saveUpdates(_0x2eb7c7['body'],null))['then'](respondWithResult(_0x1e1292,null))[_0x178d('0x3f')](handleError(_0x1e1292,null));};exports[_0x178d('0x22')]=function(_0x4e003c,_0x16ba18){return db['AnalyticDefaultReport'][_0x178d('0x4b')]({'where':{'id':_0x4e003c['params']['id']}})[_0x178d('0x21')](handleEntityNotFound(_0x16ba18,null))['then'](removeEntity(_0x16ba18,null))[_0x178d('0x3f')](handleError(_0x16ba18,null));};exports[_0x178d('0x50')]=function(_0x1eb136,_0x3c1629){var _0x52e32f=0xa;var _0x3758b6=[_0x178d('0x51'),_0x178d('0x52'),_0x178d('0x53'),_0x178d('0x54')];var _0x6b13f1={'SUM':'SUM(%s)','COUNT':_0x178d('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x178d('0x56'),'MIN':_0x178d('0x57'),'AVG':_0x178d('0x58'),'GROUP_CONCAT':_0x178d('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x178d('0x5a')};var _0x3d4da6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x178d('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x178d('0x5c'),'UNIX_TIMESTAMP':_0x178d('0x5d')};var _0x2d6b01=function(_0x30a908){return!_['includes']([_0x178d('0x5e'),_0x178d('0x5f'),_0x178d('0x60'),_0x178d('0x61')],_0x30a908);};var _0x1c4c9b=function(_0x6f2418){if(!_0x6f2418||!_0x6f2418['rules'][_0x178d('0x43')]){return'';}for(var _0x35632a='(',_0x4416ad=0x0;_0x4416ad<_0x6f2418[_0x178d('0x62')][_0x178d('0x43')];_0x4416ad+=0x1){_0x4416ad>0x0&&(_0x35632a+='\x20'+_0x6f2418['operator']+'\x20');_0x35632a+=_0x6f2418[_0x178d('0x62')][_0x4416ad]['group']?_0x1c4c9b(_0x6f2418['rules'][_0x4416ad][_0x178d('0x63')]):_0x6f2418[_0x178d('0x62')][_0x4416ad][_0x178d('0x64')]+'\x20'+_0x6f2418['rules'][_0x4416ad][_0x178d('0x65')]+(_0x2d6b01(_0x6f2418['rules'][_0x4416ad]['condition'])?'\x20'+_0x6f2418[_0x178d('0x62')][_0x4416ad][_0x178d('0x66')]:'');}return _0x35632a+')';};var _0x2aabbd={'where':{'id':_0x1eb136[_0x178d('0x41')]['id']}},_0x4071c1,_0x24ac91,_0x378aa1,_0xc2d4da,_0x1ba152;_0x2aabbd=_[_0x178d('0x3a')]({},_0x2aabbd,_0x1eb136[_0x178d('0x3b')]);return db['AnalyticDefaultReport']['find'](_0x2aabbd)['then'](function(_0x451186){if(_0x451186){_0x4071c1=_0x451186;return _0x451186[_0x178d('0x67')]();}return null;})['then'](function(_0x3e744c){if(_0x3e744c){if(!_0x3e744c[_0x178d('0x43')]){throw new db['Sequelize']['ValidationErrorItem'](_0x178d('0x68'),0x193);}_0x24ac91=_0x3e744c;return db[_0x178d('0x69')][_0x178d('0x3e')]({'raw':!![]});}return null;})[_0x178d('0x21')](function(_0xbfd48e){if(_0xbfd48e){_0x378aa1=_[_0x178d('0x6a')](_0xbfd48e,'id');var _0x405582;var _0x2916e8=squel[_0x178d('0x6b')]();_0x2916e8[_0x178d('0x6c')](_0x4071c1[_0x178d('0x6d')]);for(var _0x4113e0=0x0;_0x4113e0<_0x24ac91[_0x178d('0x43')];_0x4113e0+=0x1){_0x405582=_0x24ac91[_0x4113e0][_0x178d('0x6e')]?_0x378aa1[_0x24ac91[_0x4113e0][_0x178d('0x6e')]][_0x178d('0x6f')]:_0x24ac91[_0x4113e0][_0x178d('0x64')];_0x405582=_0x24ac91[_0x4113e0][_0x178d('0x70')]?_['replace'](_0x6b13f1[_0x24ac91[_0x4113e0]['function']],'%s',_0x405582):_0x405582;_0x405582=_0x24ac91[_0x4113e0][_0x178d('0x71')]?_[_0x178d('0x72')](_0x3d4da6[_0x24ac91[_0x4113e0][_0x178d('0x71')]],'%s',_0x405582):_0x405582;if(_0x24ac91[_0x4113e0][_0x178d('0x73')]){_0x2916e8[_0x178d('0x63')](_0x405582);}_0x24ac91[_0x4113e0][_0x178d('0x74')]&&_0x2916e8[_0x178d('0x33')](_0x405582,_0x24ac91[_0x4113e0][_0x178d('0x74')]==='DESC'?![]:!![]);_0x2916e8['field'](_0x405582,_0x24ac91[_0x4113e0][_0x178d('0x75')]||_0x405582);}if(_0x4071c1['joins']){_0x4071c1[_0x178d('0x76')]=JSON[_0x178d('0x77')](_0x4071c1['joins']);for(var _0x3ed88d=0x0;_0x3ed88d<_0x4071c1[_0x178d('0x76')][_0x178d('0x43')];_0x3ed88d+=0x1){if(_0x4071c1[_0x178d('0x76')][_0x3ed88d]['type']&&_[_0x178d('0x78')](_0x3758b6,_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x38')])&&_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x79')]&&_0x4071c1[_0x178d('0x76')][_0x3ed88d]['foreignTable']&&_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x7a')]){_0x2916e8[_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x38')]](_0x4071c1['joins'][_0x3ed88d][_0x178d('0x7b')],null,util[_0x178d('0x71')](_0x178d('0x7c'),_0x4071c1['table'],_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x79')],_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x7b')],_0x4071c1[_0x178d('0x76')][_0x3ed88d][_0x178d('0x7a')]));}}}if(_0x4071c1[_0x178d('0x7d')]){_0x4071c1[_0x178d('0x7d')]=JSON['parse'](_0x4071c1[_0x178d('0x7d')]);_0x2916e8['where'](_0x1c4c9b(_0x4071c1[_0x178d('0x7d')]['group']));}_0x1ba152=_0x2916e8['clone']();_0x2916e8[_0x178d('0x1a')](_0x52e32f);_0x2916e8['offset'](0x0);logger[_0x178d('0x7e')]('Limited\x20Query:',_0x2916e8[_0x178d('0x7f')]());return db['sequelize'][_0x178d('0x2d')](_0x2916e8['toString'](),{'type':db[_0x178d('0x80')]['QueryTypes'][_0x178d('0x81')]});}})[_0x178d('0x21')](respondWithResult(_0x3c1629,null))[_0x178d('0x3f')](handleError(_0x3c1629,null));};function runReport(_0x2bf483,_0x262282,_0x3e48bd){var _0x341a1d=_0x262282['name'];var _0x278fc6=0xa;var _0x45586d=[_0x178d('0x51'),_0x178d('0x52'),_0x178d('0x53'),_0x178d('0x54')];var _0x5b9d98={'SUM':_0x178d('0x82'),'COUNT':_0x178d('0x55'),'COUNT DISTINCT':_0x178d('0x83'),'MAX':_0x178d('0x56'),'MIN':'MIN(%s)','AVG':_0x178d('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x178d('0x5a')};var _0x124111={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x178d('0x5b'),'HOUR':_0x178d('0x84'),'ROUND':_0x178d('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4935eb=function(_0xf26402){return!_[_0x178d('0x78')]([_0x178d('0x5e'),'IS\x20NOT\x20NULL',_0x178d('0x60'),'IS\x20NOT\x20EMPTY'],_0xf26402);};var _0x48e462=function(_0x305d37){if(!_0x305d37||!_0x305d37[_0x178d('0x62')][_0x178d('0x43')]){return'';}for(var _0x327bdd='(',_0x515756=0x0;_0x515756<_0x305d37['rules'][_0x178d('0x43')];_0x515756+=0x1){_0x515756>0x0&&(_0x327bdd+='\x20'+_0x305d37['operator']+'\x20');_0x327bdd+=_0x305d37[_0x178d('0x62')][_0x515756][_0x178d('0x63')]?_0x48e462(_0x305d37[_0x178d('0x62')][_0x515756][_0x178d('0x63')]):_0x305d37['rules'][_0x515756][_0x178d('0x64')]+'\x20'+_0x305d37[_0x178d('0x62')][_0x515756][_0x178d('0x65')]+(_0x4935eb(_0x305d37[_0x178d('0x62')][_0x515756][_0x178d('0x65')])?'\x20'+_0x305d37[_0x178d('0x62')][_0x515756][_0x178d('0x66')]:'');}return _0x327bdd+')';};var _0x3c6f5c={'where':{'id':_0x2bf483['id']}},_0x35b54b,_0x5afcfb,_0x4ed116,_0x408e66,_0x4f6df7;_0x3c6f5c=_[_0x178d('0x3a')]({},_0x3c6f5c,_0x3e48bd);return db['AnalyticDefaultReport'][_0x178d('0x4b')](_0x3c6f5c)[_0x178d('0x21')](function(_0x12dd8d){if(_0x12dd8d){_0x35b54b=_0x12dd8d;return _0x12dd8d[_0x178d('0x67')]();}return null;})['then'](function(_0x2c6833){if(_0x2c6833){if(!_0x2c6833[_0x178d('0x43')]){throw new db[(_0x178d('0x85'))]['ValidationErrorItem'](_0x178d('0x68'),0x193);}_0x5afcfb=_0x2c6833;return db['AnalyticMetric'][_0x178d('0x3e')]({'raw':!![]});}return null;})[_0x178d('0x21')](function(_0x4cf1cb){if(_0x4cf1cb){_0x4ed116=_[_0x178d('0x6a')](_0x4cf1cb,'id');var _0x40de0b;var _0xd2b3b1=squel['select']();_0xd2b3b1[_0x178d('0x6c')](_0x35b54b[_0x178d('0x6d')]);for(var _0x34076f=0x0;_0x34076f<_0x5afcfb['length'];_0x34076f+=0x1){_0x40de0b=_0x5afcfb[_0x34076f][_0x178d('0x6e')]?_0x4ed116[_0x5afcfb[_0x34076f][_0x178d('0x6e')]]['metric']:_0x5afcfb[_0x34076f][_0x178d('0x64')];_0x40de0b=_0x5afcfb[_0x34076f]['function']?_['replace'](_0x5b9d98[_0x5afcfb[_0x34076f][_0x178d('0x70')]],'%s',_0x40de0b):_0x40de0b;_0x40de0b=_0x5afcfb[_0x34076f][_0x178d('0x71')]?_[_0x178d('0x72')](_0x124111[_0x5afcfb[_0x34076f][_0x178d('0x71')]],'%s',_0x40de0b):_0x40de0b;if(_0x5afcfb[_0x34076f]['groupBy']){_0xd2b3b1[_0x178d('0x63')](_0x40de0b);}_0x5afcfb[_0x34076f][_0x178d('0x74')]&&_0xd2b3b1[_0x178d('0x33')](_0x40de0b,_0x5afcfb[_0x34076f][_0x178d('0x74')]===_0x178d('0x86')?![]:!![]);_0xd2b3b1['field'](_0x40de0b,_0x5afcfb[_0x34076f][_0x178d('0x75')]||_0x40de0b);}if(_0x35b54b[_0x178d('0x76')]){_0x35b54b[_0x178d('0x76')]=JSON['parse'](_0x35b54b[_0x178d('0x76')]);for(var _0x3d7b8f=0x0;_0x3d7b8f<_0x35b54b[_0x178d('0x76')][_0x178d('0x43')];_0x3d7b8f+=0x1){if(_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x38')]&&_[_0x178d('0x78')](_0x45586d,_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x38')])&&_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x79')]&&_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x7b')]&&_0x35b54b[_0x178d('0x76')][_0x3d7b8f]['foreignKey']){_0xd2b3b1[_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x38')]](_0x35b54b['joins'][_0x3d7b8f][_0x178d('0x7b')],null,util[_0x178d('0x71')]('%s.%s\x20=\x20%s.%s',_0x35b54b['table'],_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x79')],_0x35b54b[_0x178d('0x76')][_0x3d7b8f][_0x178d('0x7b')],_0x35b54b['joins'][_0x3d7b8f][_0x178d('0x7a')]));}}}if(_0x35b54b[_0x178d('0x7d')]){_0x35b54b[_0x178d('0x7d')]=JSON[_0x178d('0x77')](_0x35b54b[_0x178d('0x7d')]);_0xd2b3b1['where'](_0x48e462(_0x35b54b[_0x178d('0x7d')][_0x178d('0x63')]));}_0x4f6df7=_0xd2b3b1[_0x178d('0x87')]();_0xd2b3b1[_0x178d('0x1a')](_0x278fc6);_0xd2b3b1[_0x178d('0x19')](0x0);logger[_0x178d('0x7e')](_0x178d('0x88'),_0xd2b3b1[_0x178d('0x7f')]());return db[_0x178d('0x80')][_0x178d('0x2d')](_0xd2b3b1['toString'](),{'type':db[_0x178d('0x80')]['QueryTypes']['SELECT']});}})['then'](function(_0x6f2ed7){if(!_0x6f2ed7[_0x178d('0x43')]){throw new db[(_0x178d('0x85'))][(_0x178d('0x89'))](_0x178d('0x8a'),0xcc);}if(_0x262282['output']===_0x178d('0x8b')){return null;}var _0x2a2ae5=_[_0x178d('0x3a')](_0x262282,{'name':_0x262282['fullPath']||_0x262282[_0x178d('0x28')]||_0x35b54b[_0x178d('0x28')],'basename':_0x341a1d,'savename':util[_0x178d('0x71')](_0x178d('0x8c'),_0x262282[_0x178d('0x28')]||_0x35b54b[_0x178d('0x28')],require(_0x178d('0x8d'))[_0x178d('0x8e')](0x4),_0x262282[_0x178d('0x8f')]||_0x178d('0x90')),'reportId':_0x35b54b['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x2a2ae5,{'raw':!![]});})[_0x178d('0x21')](function(_0x2d8049){if(_0x35b54b[_0x178d('0x6d')]===_0x178d('0x91')){_0x4f6df7[_0x178d('0x36')](_0x35b54b['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x262282[_0x178d('0x92')],_0x262282[_0x178d('0x93')]);}else{_0x4f6df7[_0x178d('0x36')](_0x35b54b['table']+_0x178d('0x94'),_0x262282['startDate'],_0x262282[_0x178d('0x93')]);}if(_0x2d8049){logger[_0x178d('0x95')](_0x178d('0x96'),_0x4f6df7[_0x178d('0x7f')]());require(_0x178d('0x97'))['fork'](path[_0x178d('0x51')](__dirname,_0x178d('0x98'),_0x2d8049[_0x178d('0x8f')]),[_0x2d8049['id'],_0x4f6df7[_0x178d('0x7f')](),path[_0x178d('0x51')](__dirname,'../../files/reports',_0x2d8049[_0x178d('0x99')]),_0x341a1d]);return _0x2d8049;}else{var _0x5021f4=squel[_0x178d('0x6b')]();_0x5021f4[_0x178d('0x6c')]('('+_0x4f6df7[_0x178d('0x7f')]()+')',_0x178d('0x9a'));_0x5021f4[_0x178d('0x64')](_0x178d('0x9b'),'count');_0x4f6df7['limit'](_0x262282[_0x178d('0x1a')]||_0x278fc6);_0x4f6df7[_0x178d('0x19')](_0x262282['offset']||0x0);return db[_0x178d('0x80')][_0x178d('0x2d')](_0x5021f4[_0x178d('0x7f')](),{'type':db[_0x178d('0x80')][_0x178d('0x9c')][_0x178d('0x81')]})[_0x178d('0x21')](function(_0x51269b){if(!_0x51269b[_0x178d('0x43')]){_0x408e66=0x0;}else{_0x408e66=_0x51269b[0x0]['count']||0x0;}return db[_0x178d('0x80')][_0x178d('0x2d')](_0x4f6df7[_0x178d('0x7f')](),{'type':db[_0x178d('0x80')]['QueryTypes']['SELECT']});})['then'](function(_0x1f2ad9){return{'rows':_0x1f2ad9||[],'count':_0x408e66};});}});}exports[_0x178d('0x9d')]=function(_0x3b3b31,_0x475cc1){return runReport(_0x3b3b31[_0x178d('0x41')],_0x3b3b31[_0x178d('0x2d')],_0x3b3b31[_0x178d('0x3b')])[_0x178d('0x21')](respondWithResult(_0x475cc1,null))[_0x178d('0x3f')](handleError(_0x475cc1,null));};exports[_0x178d('0x9e')]=runReport;exports[_0x178d('0x2d')]=function(_0x270018,_0x36d19e){var _0x442000=0xa;var _0x41b03d=[_0x178d('0x51'),_0x178d('0x52'),'right_join',_0x178d('0x54')];var _0x198c57={'SUM':_0x178d('0x82'),'COUNT':_0x178d('0x55'),'COUNT DISTINCT':_0x178d('0x83'),'MAX':_0x178d('0x56'),'MIN':'MIN(%s)','AVG':_0x178d('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x178d('0x9f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x46e5e4={'SEC_TO_TIME':_0x178d('0xa0'),'DATE':_0x178d('0x5b'),'HOUR':_0x178d('0x84'),'ROUND':_0x178d('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x59b964=function(_0x13fae8){return!_[_0x178d('0x78')]([_0x178d('0x5e'),_0x178d('0x5f'),_0x178d('0x60'),_0x178d('0x61')],_0x13fae8);};var _0x1c33a4=function(_0x1cd507){if(!_0x1cd507||!_0x1cd507['rules']['length']){return'';}for(var _0x18a7b9='(',_0xae709e=0x0;_0xae709e<_0x1cd507['rules']['length'];_0xae709e+=0x1){_0xae709e>0x0&&(_0x18a7b9+='\x20'+_0x1cd507[_0x178d('0xa1')]+'\x20');_0x18a7b9+=_0x1cd507['rules'][_0xae709e]['group']?_0x1c33a4(_0x1cd507[_0x178d('0x62')][_0xae709e][_0x178d('0x63')]):_0x1cd507[_0x178d('0x62')][_0xae709e][_0x178d('0x64')]+'\x20'+_0x1cd507[_0x178d('0x62')][_0xae709e]['condition']+(_0x59b964(_0x1cd507['rules'][_0xae709e]['condition'])?'\x20'+_0x1cd507[_0x178d('0x62')][_0xae709e]['value']:'');}return _0x18a7b9+')';};var _0x16de33={'where':{'id':_0x270018[_0x178d('0x41')]['id']}},_0x1e77c3,_0x5eb546,_0x3a77d1,_0x23a887,_0x4129b8;_0x16de33=_[_0x178d('0x3a')]({},_0x16de33,_0x270018[_0x178d('0x3b')]);return db[_0x178d('0x2b')]['find'](_0x16de33)[_0x178d('0x21')](function(_0x29da5c){if(_0x29da5c){_0x1e77c3=_0x29da5c;return _0x29da5c[_0x178d('0x67')]();}return null;})[_0x178d('0x21')](function(_0x301cd7){if(_0x301cd7){if(!_0x301cd7[_0x178d('0x43')]){throw new db[(_0x178d('0x85'))][(_0x178d('0x89'))](_0x178d('0x68'),0x193);}_0x5eb546=_0x301cd7;return db['AnalyticMetric'][_0x178d('0x3e')]({'raw':!![]});}return null;})[_0x178d('0x21')](function(_0x4e354e){if(_0x4e354e){_0x3a77d1=_[_0x178d('0x6a')](_0x4e354e,'id');var _0x596243;var _0x2d9bfb=squel[_0x178d('0x6b')]();_0x2d9bfb['from'](_0x1e77c3[_0x178d('0x6d')]);for(var _0x2da775=0x0;_0x2da775<_0x5eb546[_0x178d('0x43')];_0x2da775+=0x1){_0x596243=_0x5eb546[_0x2da775]['MetricId']?_0x3a77d1[_0x5eb546[_0x2da775][_0x178d('0x6e')]][_0x178d('0x6f')]:_0x5eb546[_0x2da775][_0x178d('0x64')];_0x596243=_0x5eb546[_0x2da775]['function']?_[_0x178d('0x72')](_0x198c57[_0x5eb546[_0x2da775]['function']],'%s',_0x596243):_0x596243;_0x596243=_0x5eb546[_0x2da775][_0x178d('0x71')]?_[_0x178d('0x72')](_0x46e5e4[_0x5eb546[_0x2da775][_0x178d('0x71')]],'%s',_0x596243):_0x596243;if(_0x5eb546[_0x2da775][_0x178d('0x73')]){_0x2d9bfb[_0x178d('0x63')](_0x596243);}_0x5eb546[_0x2da775][_0x178d('0x74')]&&_0x2d9bfb[_0x178d('0x33')](_0x596243,_0x5eb546[_0x2da775][_0x178d('0x74')]===_0x178d('0x86')?![]:!![]);_0x2d9bfb[_0x178d('0x64')](_0x596243,_0x5eb546[_0x2da775][_0x178d('0x75')]||_0x596243);}if(_0x1e77c3[_0x178d('0x76')]){_0x1e77c3['joins']=JSON[_0x178d('0x77')](_0x1e77c3[_0x178d('0x76')]);for(var _0x58ca9d=0x0;_0x58ca9d<_0x1e77c3['joins'][_0x178d('0x43')];_0x58ca9d+=0x1){if(_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x38')]&&_[_0x178d('0x78')](_0x41b03d,_0x1e77c3[_0x178d('0x76')][_0x58ca9d]['type'])&&_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x79')]&&_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x7b')]&&_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x7a')]){_0x2d9bfb[_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x38')]](_0x1e77c3['joins'][_0x58ca9d][_0x178d('0x7b')],null,util[_0x178d('0x71')]('%s.%s\x20=\x20%s.%s',_0x1e77c3['table'],_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x79')],_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x7b')],_0x1e77c3[_0x178d('0x76')][_0x58ca9d][_0x178d('0x7a')]));}}}if(_0x1e77c3[_0x178d('0x7d')]){_0x1e77c3[_0x178d('0x7d')]=JSON[_0x178d('0x77')](_0x1e77c3['conditions']);_0x2d9bfb[_0x178d('0x36')](_0x1c33a4(_0x1e77c3['conditions'][_0x178d('0x63')]));}_0x4129b8=_0x2d9bfb[_0x178d('0x87')]();_0x2d9bfb[_0x178d('0x1a')](_0x442000);_0x2d9bfb[_0x178d('0x19')](0x0);logger[_0x178d('0x7e')]('Limited\x20Query:',_0x2d9bfb[_0x178d('0x7f')]());return db[_0x178d('0x80')][_0x178d('0x2d')](_0x2d9bfb[_0x178d('0x7f')](),{'type':db['sequelize'][_0x178d('0x9c')][_0x178d('0x81')]});}})[_0x178d('0x21')](function(){return{'sql':_0x4129b8['toString']()};})[_0x178d('0x21')](respondWithResult(_0x36d19e,null))[_0x178d('0x3f')](handleError(_0x36d19e,null));}; \ No newline at end of file +var _0x3dd3=['rules','group','value','params','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','MetricId','function','format','groupBy','orderBy','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','right_join','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','includes','condition','getFields','select','metric','replace','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NULL','keyBy','order','alias','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','DefaultReports','error','stack','name','send','AnalyticDefaultReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%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)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x3dd3,0x18c));var _0x33dd=function(_0x35787d,_0x2d5962){_0x35787d=_0x35787d-0x0;var _0x2f5b24=_0x3dd3[_0x35787d];return _0x2f5b24;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x33dd('0x0'));var rimraf=require(_0x33dd('0x1'));var zipdir=require(_0x33dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33dd('0x3'));var moment=require(_0x33dd('0x4'));var BPromise=require(_0x33dd('0x5'));var Mustache=require(_0x33dd('0x6'));var util=require(_0x33dd('0x7'));var path=require(_0x33dd('0x8'));var sox=require(_0x33dd('0x9'));var csv=require(_0x33dd('0xa'));var ejs=require(_0x33dd('0xb'));var fs=require('fs');var _=require(_0x33dd('0xc'));var squel=require(_0x33dd('0xd'));var crypto=require('crypto');var jsforce=require(_0x33dd('0xe'));var deskjs=require(_0x33dd('0xf'));var toCsv=require(_0x33dd('0xa'));var querystring=require(_0x33dd('0x10'));var Papa=require(_0x33dd('0x11'));var Redis=require(_0x33dd('0x12'));var authService=require(_0x33dd('0x13'));var qs=require(_0x33dd('0x14'));var hardwareService=require(_0x33dd('0x15'));var logger=require(_0x33dd('0x16'))(_0x33dd('0x17'));var utils=require(_0x33dd('0x18'));var config=require(_0x33dd('0x19'));var db=require(_0x33dd('0x1a'))['db'];function respondWithStatusCode(_0x2df186,_0x380e8d){_0x380e8d=_0x380e8d||0xcc;return function(_0x3c036a){if(_0x3c036a){return _0x2df186[_0x33dd('0x1b')](_0x380e8d);}return _0x2df186[_0x33dd('0x1c')](_0x380e8d)[_0x33dd('0x1d')]();};}function respondWithResult(_0x15546b,_0x1e4f60){_0x1e4f60=_0x1e4f60||0xc8;return function(_0x4dcdcb){if(_0x4dcdcb){return _0x15546b[_0x33dd('0x1c')](_0x1e4f60)[_0x33dd('0x1e')](_0x4dcdcb);}};}function respondWithFilteredResult(_0x287b00,_0x347129){return function(_0x52caaa){if(_0x52caaa){var _0x3be05c=_0x52caaa[_0x33dd('0x1f')],_0x23ef62=_0x347129[_0x33dd('0x20')],_0x41edc9=_0x347129['offset']+_0x347129[_0x33dd('0x21')],_0x288c89;if(_0x41edc9>=_0x3be05c){_0x41edc9=_0x3be05c;_0x288c89=0xc8;}else{_0x288c89=0xce;}_0x287b00[_0x33dd('0x1c')](_0x288c89);return _0x287b00[_0x33dd('0x22')](_0x33dd('0x23'),_0x23ef62+'-'+_0x41edc9+'/'+_0x3be05c)[_0x33dd('0x1e')](_0x52caaa);}return null;};}function patchUpdates(_0x424ae5){return function(_0x495b12){try{jsonpatch[_0x33dd('0x24')](_0x495b12,_0x424ae5,!![]);}catch(_0xe81c0e){return BPromise['reject'](_0xe81c0e);}return _0x495b12[_0x33dd('0x25')]();};}function saveUpdates(_0x28b905,_0x1a15ef){return function(_0x107416){if(_0x107416){return _0x107416[_0x33dd('0x26')](_0x28b905)[_0x33dd('0x27')](function(_0x2109ad){return _0x2109ad;});}return null;};}function removeEntity(_0x146cb0,_0x12f497){return function(_0x44df52){if(_0x44df52){return _0x44df52[_0x33dd('0x28')]()[_0x33dd('0x27')](function(){var _0x44f7e9=_0x44df52[_0x33dd('0x29')]({'plain':!![]});var _0x34f3f0=_0x33dd('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x34f3f0,'resourceId':_0x44f7e9['id']}})[_0x33dd('0x27')](function(){return _0x44df52;});})['then'](function(){_0x146cb0[_0x33dd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dd926,_0x3e8e29){return function(_0x18ad7e){if(!_0x18ad7e){_0x2dd926[_0x33dd('0x1b')](0x194);}return _0x18ad7e;};}function handleError(_0x204b13,_0x4f1ac5){_0x4f1ac5=_0x4f1ac5||0x1f4;return function(_0x5f5aa1){logger[_0x33dd('0x2b')](_0x5f5aa1[_0x33dd('0x2c')]);if(_0x5f5aa1[_0x33dd('0x2d')]){delete _0x5f5aa1[_0x33dd('0x2d')];}_0x204b13[_0x33dd('0x1c')](_0x4f1ac5)[_0x33dd('0x2e')](_0x5f5aa1);};}exports['index']=function(_0x277642,_0x1187dc){var _0x200eab={},_0x2a6de3={},_0x44809b={'count':0x0,'rows':[]};var _0x2b148f=db[_0x33dd('0x2f')][_0x33dd('0x30')];_0x2a6de3[_0x33dd('0x31')]=_[_0x33dd('0x32')](_0x2b148f);_0x2a6de3[_0x33dd('0x33')]=_[_0x33dd('0x32')](_0x277642[_0x33dd('0x33')]);_0x2a6de3[_0x33dd('0x34')]=_[_0x33dd('0x35')](_0x2a6de3[_0x33dd('0x31')],_0x2a6de3[_0x33dd('0x33')]);_0x200eab[_0x33dd('0x36')]=_[_0x33dd('0x35')](_0x2a6de3[_0x33dd('0x31')],qs[_0x33dd('0x37')](_0x277642['query']['fields']));_0x200eab[_0x33dd('0x36')]=_0x200eab[_0x33dd('0x36')][_0x33dd('0x38')]?_0x200eab[_0x33dd('0x36')]:_0x2a6de3[_0x33dd('0x31')];if(!_0x277642[_0x33dd('0x33')]['hasOwnProperty'](_0x33dd('0x39'))){_0x200eab[_0x33dd('0x21')]=qs[_0x33dd('0x21')](_0x277642[_0x33dd('0x33')][_0x33dd('0x21')]);_0x200eab[_0x33dd('0x20')]=qs[_0x33dd('0x20')](_0x277642['query'][_0x33dd('0x20')]);}_0x200eab['order']=qs[_0x33dd('0x3a')](_0x277642[_0x33dd('0x33')][_0x33dd('0x3a')]);_0x200eab[_0x33dd('0x3b')]=qs['filters'](_['pick'](_0x277642[_0x33dd('0x33')],_0x2a6de3['filters']));if(_0x277642[_0x33dd('0x33')][_0x33dd('0x3c')]){_0x200eab[_0x33dd('0x3b')]=_[_0x33dd('0x3d')](_0x200eab[_0x33dd('0x3b')],{'$or':_['map'](_0x2b148f,function(_0x2f10d2){if(_0x2f10d2[_0x33dd('0x3e')][_0x33dd('0x3f')]!==_0x33dd('0x40')){var _0x472fb4={};_0x472fb4[_0x2f10d2[_0x33dd('0x41')]]={'$like':'%'+_0x277642[_0x33dd('0x33')]['filter']+'%'};return _0x472fb4;}})});}_0x200eab=_[_0x33dd('0x3d')]({},_0x200eab,_0x277642[_0x33dd('0x42')]);var _0x19b99a={'where':_0x200eab['where']};return db[_0x33dd('0x2f')][_0x33dd('0x1f')](_0x19b99a)[_0x33dd('0x27')](function(_0x2b4861){_0x44809b[_0x33dd('0x1f')]=_0x2b4861;if(_0x277642[_0x33dd('0x33')][_0x33dd('0x43')]){_0x200eab['include']=[{'all':!![]}];}return db[_0x33dd('0x2f')][_0x33dd('0x44')](_0x200eab);})[_0x33dd('0x27')](function(_0x5b4d55){_0x44809b[_0x33dd('0x45')]=_0x5b4d55;return _0x44809b;})['then'](respondWithFilteredResult(_0x1187dc,_0x200eab))[_0x33dd('0x46')](handleError(_0x1187dc,null));};exports[_0x33dd('0x47')]=function(_0x4e9517,_0x14aae4){var _0x3deb70={'raw':!![],'where':{'id':_0x4e9517['params']['id']}},_0x4f5dcc={};_0x4f5dcc[_0x33dd('0x31')]=_['keys'](db[_0x33dd('0x2f')][_0x33dd('0x30')]);_0x4f5dcc['query']=_[_0x33dd('0x32')](_0x4e9517[_0x33dd('0x33')]);_0x4f5dcc['filters']=_[_0x33dd('0x35')](_0x4f5dcc[_0x33dd('0x31')],_0x4f5dcc[_0x33dd('0x33')]);_0x3deb70[_0x33dd('0x36')]=_[_0x33dd('0x35')](_0x4f5dcc[_0x33dd('0x31')],qs['fields'](_0x4e9517[_0x33dd('0x33')][_0x33dd('0x37')]));_0x3deb70[_0x33dd('0x36')]=_0x3deb70[_0x33dd('0x36')][_0x33dd('0x38')]?_0x3deb70[_0x33dd('0x36')]:_0x4f5dcc[_0x33dd('0x31')];if(_0x4e9517[_0x33dd('0x33')][_0x33dd('0x43')]){_0x3deb70[_0x33dd('0x48')]=[{'all':!![]}];}_0x3deb70=_[_0x33dd('0x3d')]({},_0x3deb70,_0x4e9517[_0x33dd('0x42')]);return db['AnalyticDefaultReport'][_0x33dd('0x49')](_0x3deb70)[_0x33dd('0x27')](handleEntityNotFound(_0x14aae4,null))[_0x33dd('0x27')](respondWithResult(_0x14aae4,null))[_0x33dd('0x46')](handleError(_0x14aae4,null));};exports[_0x33dd('0x4a')]=function(_0x3700ca,_0x338579){return db[_0x33dd('0x2f')]['create'](_0x3700ca[_0x33dd('0x4b')],{})[_0x33dd('0x27')](function(_0x3c3bc4){var _0x3ecd16=_0x3700ca[_0x33dd('0x4c')][_0x33dd('0x29')]({'plain':!![]});if(!_0x3ecd16)throw new Error(_0x33dd('0x4d'));if(_0x3ecd16['role']===_0x33dd('0x4c')){var _0x564610=_0x3c3bc4[_0x33dd('0x29')]({'plain':!![]});var _0x2dee69=_0x33dd('0x4e');return db[_0x33dd('0x4f')][_0x33dd('0x49')]({'where':{'name':_0x2dee69,'userProfileId':_0x3ecd16['userProfileId']},'raw':!![]})[_0x33dd('0x27')](function(_0x4059ed){if(_0x4059ed&&_0x4059ed[_0x33dd('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x564610['name'],'resourceId':_0x564610['id'],'type':_0x33dd('0x2a'),'sectionId':_0x4059ed['id']},{})['then'](function(){return _0x3c3bc4;});}else{return _0x3c3bc4;}})['catch'](function(_0x27fab7){logger[_0x33dd('0x2b')](_0x33dd('0x51'),_0x27fab7);throw _0x27fab7;});}return _0x3c3bc4;})[_0x33dd('0x27')](respondWithResult(_0x338579,0xc9))[_0x33dd('0x46')](handleError(_0x338579,null));};exports['update']=function(_0x215a91,_0x28631c){if(_0x215a91[_0x33dd('0x4b')]['id']){delete _0x215a91[_0x33dd('0x4b')]['id'];}return db[_0x33dd('0x2f')]['find']({'where':{'id':_0x215a91['params']['id']}})['then'](handleEntityNotFound(_0x28631c,null))[_0x33dd('0x27')](saveUpdates(_0x215a91['body'],null))[_0x33dd('0x27')](respondWithResult(_0x28631c,null))['catch'](handleError(_0x28631c,null));};exports['destroy']=function(_0x2e4dae,_0x12ffcb){return db[_0x33dd('0x2f')][_0x33dd('0x49')]({'where':{'id':_0x2e4dae['params']['id']}})[_0x33dd('0x27')](handleEntityNotFound(_0x12ffcb,null))[_0x33dd('0x27')](removeEntity(_0x12ffcb,null))[_0x33dd('0x46')](handleError(_0x12ffcb,null));};exports[_0x33dd('0x52')]=function(_0x1c2d3a,_0x356f1a){var _0x1caee3=0xa;var _0x3685ac=['join',_0x33dd('0x53'),'right_join',_0x33dd('0x54')];var _0x18ce5f={'SUM':_0x33dd('0x55'),'COUNT':_0x33dd('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x33dd('0x57'),'MIN':'MIN(%s)','AVG':_0x33dd('0x58'),'GROUP_CONCAT':_0x33dd('0x59'),'GROUP_CONCAT ASC':_0x33dd('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5ae490={'SEC_TO_TIME':_0x33dd('0x5b'),'DATE':_0x33dd('0x5c'),'HOUR':_0x33dd('0x5d'),'ROUND':_0x33dd('0x5e'),'UNIX_TIMESTAMP':_0x33dd('0x5f')};var _0x58db56=function(_0xe9a803){return!_['includes'](['IS\x20NULL',_0x33dd('0x60'),_0x33dd('0x61'),_0x33dd('0x62')],_0xe9a803);};var _0x36ac37=function(_0x177266){if(!_0x177266||!_0x177266[_0x33dd('0x63')][_0x33dd('0x38')]){return'';}for(var _0x5beeff='(',_0xc5d808=0x0;_0xc5d808<_0x177266[_0x33dd('0x63')][_0x33dd('0x38')];_0xc5d808+=0x1){_0xc5d808>0x0&&(_0x5beeff+='\x20'+_0x177266['operator']+'\x20');_0x5beeff+=_0x177266[_0x33dd('0x63')][_0xc5d808][_0x33dd('0x64')]?_0x36ac37(_0x177266[_0x33dd('0x63')][_0xc5d808][_0x33dd('0x64')]):_0x177266[_0x33dd('0x63')][_0xc5d808]['field']+'\x20'+_0x177266[_0x33dd('0x63')][_0xc5d808]['condition']+(_0x58db56(_0x177266[_0x33dd('0x63')][_0xc5d808]['condition'])?'\x20'+_0x177266['rules'][_0xc5d808][_0x33dd('0x65')]:'');}return _0x5beeff+')';};var _0x4464f0={'where':{'id':_0x1c2d3a[_0x33dd('0x66')]['id']}},_0x18f62a,_0x1308e6,_0x2c0a08,_0x23c418,_0x149af3;_0x4464f0=_[_0x33dd('0x3d')]({},_0x4464f0,_0x1c2d3a[_0x33dd('0x42')]);return db['AnalyticDefaultReport'][_0x33dd('0x49')](_0x4464f0)[_0x33dd('0x27')](function(_0x33049d){if(_0x33049d){_0x18f62a=_0x33049d;return _0x33049d['getFields']();}return null;})[_0x33dd('0x27')](function(_0x469c40){if(_0x469c40){if(!_0x469c40[_0x33dd('0x38')]){throw new db[(_0x33dd('0x67'))][(_0x33dd('0x68'))](_0x33dd('0x69'),0x193);}_0x1308e6=_0x469c40;return db[_0x33dd('0x6a')][_0x33dd('0x44')]({'raw':!![]});}return null;})[_0x33dd('0x27')](function(_0x192cba){if(_0x192cba){_0x2c0a08=_['keyBy'](_0x192cba,'id');var _0x4a2e32;var _0x43daec=squel['select']();_0x43daec[_0x33dd('0x6b')](_0x18f62a['table']);for(var _0x1e77f1=0x0;_0x1e77f1<_0x1308e6[_0x33dd('0x38')];_0x1e77f1+=0x1){_0x4a2e32=_0x1308e6[_0x1e77f1][_0x33dd('0x6c')]?_0x2c0a08[_0x1308e6[_0x1e77f1][_0x33dd('0x6c')]]['metric']:_0x1308e6[_0x1e77f1][_0x33dd('0x41')];_0x4a2e32=_0x1308e6[_0x1e77f1][_0x33dd('0x6d')]?_['replace'](_0x18ce5f[_0x1308e6[_0x1e77f1][_0x33dd('0x6d')]],'%s',_0x4a2e32):_0x4a2e32;_0x4a2e32=_0x1308e6[_0x1e77f1]['format']?_['replace'](_0x5ae490[_0x1308e6[_0x1e77f1][_0x33dd('0x6e')]],'%s',_0x4a2e32):_0x4a2e32;if(_0x1308e6[_0x1e77f1][_0x33dd('0x6f')]){_0x43daec[_0x33dd('0x64')](_0x4a2e32);}_0x1308e6[_0x1e77f1][_0x33dd('0x70')]&&_0x43daec['order'](_0x4a2e32,_0x1308e6[_0x1e77f1][_0x33dd('0x70')]==='DESC'?![]:!![]);_0x43daec[_0x33dd('0x41')](_0x4a2e32,_0x1308e6[_0x1e77f1]['alias']||_0x4a2e32);}if(_0x18f62a[_0x33dd('0x71')]){_0x18f62a[_0x33dd('0x71')]=JSON[_0x33dd('0x72')](_0x18f62a[_0x33dd('0x71')]);for(var _0x3248ff=0x0;_0x3248ff<_0x18f62a[_0x33dd('0x71')][_0x33dd('0x38')];_0x3248ff+=0x1){if(_0x18f62a[_0x33dd('0x71')][_0x3248ff][_0x33dd('0x3e')]&&_['includes'](_0x3685ac,_0x18f62a[_0x33dd('0x71')][_0x3248ff]['type'])&&_0x18f62a[_0x33dd('0x71')][_0x3248ff][_0x33dd('0x73')]&&_0x18f62a[_0x33dd('0x71')][_0x3248ff][_0x33dd('0x74')]&&_0x18f62a[_0x33dd('0x71')][_0x3248ff][_0x33dd('0x75')]){_0x43daec[_0x18f62a[_0x33dd('0x71')][_0x3248ff]['type']](_0x18f62a[_0x33dd('0x71')][_0x3248ff]['foreignTable'],null,util[_0x33dd('0x6e')](_0x33dd('0x76'),_0x18f62a[_0x33dd('0x77')],_0x18f62a[_0x33dd('0x71')][_0x3248ff]['parentKey'],_0x18f62a[_0x33dd('0x71')][_0x3248ff]['foreignTable'],_0x18f62a['joins'][_0x3248ff][_0x33dd('0x75')]));}}}if(_0x18f62a[_0x33dd('0x78')]){_0x18f62a[_0x33dd('0x78')]=JSON[_0x33dd('0x72')](_0x18f62a[_0x33dd('0x78')]);_0x43daec['where'](_0x36ac37(_0x18f62a['conditions'][_0x33dd('0x64')]));}_0x149af3=_0x43daec[_0x33dd('0x79')]();_0x43daec['limit'](_0x1caee3);_0x43daec['offset'](0x0);logger[_0x33dd('0x7a')](_0x33dd('0x7b'),_0x43daec[_0x33dd('0x7c')]());return db[_0x33dd('0x7d')]['query'](_0x43daec['toString'](),{'type':db[_0x33dd('0x7d')][_0x33dd('0x7e')]['SELECT']});}})[_0x33dd('0x27')](respondWithResult(_0x356f1a,null))[_0x33dd('0x46')](handleError(_0x356f1a,null));};function runReport(_0x2edf76,_0x5eeffc,_0x302144){var _0x55feac=_0x5eeffc[_0x33dd('0x2d')];var _0x49791f=0xa;var _0x27d13e=[_0x33dd('0x7f'),'left_join',_0x33dd('0x80'),_0x33dd('0x54')];var _0xe9cab2={'SUM':_0x33dd('0x55'),'COUNT':_0x33dd('0x56'),'COUNT DISTINCT':_0x33dd('0x81'),'MAX':_0x33dd('0x57'),'MIN':_0x33dd('0x82'),'AVG':_0x33dd('0x58'),'GROUP_CONCAT':_0x33dd('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x33dd('0x83')};var _0x20c579={'SEC_TO_TIME':_0x33dd('0x5b'),'DATE':_0x33dd('0x5c'),'HOUR':_0x33dd('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x50452c=function(_0x1b8513){return!_[_0x33dd('0x84')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x33dd('0x62')],_0x1b8513);};var _0x2fd2df=function(_0x266a84){if(!_0x266a84||!_0x266a84[_0x33dd('0x63')]['length']){return'';}for(var _0x209e9c='(',_0x16af22=0x0;_0x16af22<_0x266a84[_0x33dd('0x63')]['length'];_0x16af22+=0x1){_0x16af22>0x0&&(_0x209e9c+='\x20'+_0x266a84['operator']+'\x20');_0x209e9c+=_0x266a84[_0x33dd('0x63')][_0x16af22][_0x33dd('0x64')]?_0x2fd2df(_0x266a84[_0x33dd('0x63')][_0x16af22][_0x33dd('0x64')]):_0x266a84[_0x33dd('0x63')][_0x16af22][_0x33dd('0x41')]+'\x20'+_0x266a84[_0x33dd('0x63')][_0x16af22][_0x33dd('0x85')]+(_0x50452c(_0x266a84[_0x33dd('0x63')][_0x16af22][_0x33dd('0x85')])?'\x20'+_0x266a84['rules'][_0x16af22]['value']:'');}return _0x209e9c+')';};var _0x313eb8={'where':{'id':_0x2edf76['id']}},_0x266379,_0x22ca40,_0x1afe99,_0x1d5c9c,_0x17ac8d;_0x313eb8=_[_0x33dd('0x3d')]({},_0x313eb8,_0x302144);return db['AnalyticDefaultReport'][_0x33dd('0x49')](_0x313eb8)[_0x33dd('0x27')](function(_0x3efbf1){if(_0x3efbf1){_0x266379=_0x3efbf1;return _0x3efbf1[_0x33dd('0x86')]();}return null;})[_0x33dd('0x27')](function(_0x16fc84){if(_0x16fc84){if(!_0x16fc84[_0x33dd('0x38')]){throw new db[(_0x33dd('0x67'))][(_0x33dd('0x68'))](_0x33dd('0x69'),0x193);}_0x22ca40=_0x16fc84;return db['AnalyticMetric'][_0x33dd('0x44')]({'raw':!![]});}return null;})[_0x33dd('0x27')](function(_0x5ec748){if(_0x5ec748){_0x1afe99=_['keyBy'](_0x5ec748,'id');var _0x51b624;var _0x380990=squel[_0x33dd('0x87')]();_0x380990['from'](_0x266379[_0x33dd('0x77')]);for(var _0x577f1a=0x0;_0x577f1a<_0x22ca40[_0x33dd('0x38')];_0x577f1a+=0x1){_0x51b624=_0x22ca40[_0x577f1a]['MetricId']?_0x1afe99[_0x22ca40[_0x577f1a][_0x33dd('0x6c')]][_0x33dd('0x88')]:_0x22ca40[_0x577f1a][_0x33dd('0x41')];_0x51b624=_0x22ca40[_0x577f1a][_0x33dd('0x6d')]?_[_0x33dd('0x89')](_0xe9cab2[_0x22ca40[_0x577f1a][_0x33dd('0x6d')]],'%s',_0x51b624):_0x51b624;_0x51b624=_0x22ca40[_0x577f1a][_0x33dd('0x6e')]?_[_0x33dd('0x89')](_0x20c579[_0x22ca40[_0x577f1a][_0x33dd('0x6e')]],'%s',_0x51b624):_0x51b624;if(_0x22ca40[_0x577f1a][_0x33dd('0x6f')]){_0x380990[_0x33dd('0x64')](_0x51b624);}_0x22ca40[_0x577f1a]['orderBy']&&_0x380990['order'](_0x51b624,_0x22ca40[_0x577f1a][_0x33dd('0x70')]==='DESC'?![]:!![]);_0x380990[_0x33dd('0x41')](_0x51b624,_0x22ca40[_0x577f1a]['alias']||_0x51b624);}if(_0x266379['joins']){_0x266379[_0x33dd('0x71')]=JSON['parse'](_0x266379[_0x33dd('0x71')]);for(var _0x1729e8=0x0;_0x1729e8<_0x266379[_0x33dd('0x71')][_0x33dd('0x38')];_0x1729e8+=0x1){if(_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x3e')]&&_[_0x33dd('0x84')](_0x27d13e,_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x3e')])&&_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x73')]&&_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x74')]&&_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x75')]){_0x380990[_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x3e')]](_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x74')],null,util['format'](_0x33dd('0x76'),_0x266379[_0x33dd('0x77')],_0x266379['joins'][_0x1729e8]['parentKey'],_0x266379[_0x33dd('0x71')][_0x1729e8][_0x33dd('0x74')],_0x266379['joins'][_0x1729e8][_0x33dd('0x75')]));}}}if(_0x266379[_0x33dd('0x78')]){_0x266379[_0x33dd('0x78')]=JSON[_0x33dd('0x72')](_0x266379['conditions']);_0x380990[_0x33dd('0x3b')](_0x2fd2df(_0x266379[_0x33dd('0x78')][_0x33dd('0x64')]));}_0x17ac8d=_0x380990[_0x33dd('0x79')]();_0x380990[_0x33dd('0x21')](_0x49791f);_0x380990[_0x33dd('0x20')](0x0);logger['debug'](_0x33dd('0x7b'),_0x380990[_0x33dd('0x7c')]());return db['sequelize'][_0x33dd('0x33')](_0x380990[_0x33dd('0x7c')](),{'type':db[_0x33dd('0x7d')]['QueryTypes']['SELECT']});}})[_0x33dd('0x27')](function(_0x4e9156){if(!_0x4e9156['length']){throw new db[(_0x33dd('0x67'))][(_0x33dd('0x68'))](_0x33dd('0x8a'),0xcc);}if(_0x5eeffc[_0x33dd('0x8b')]===_0x33dd('0x8c')){return null;}var _0x42ae44=_[_0x33dd('0x3d')](_0x5eeffc,{'name':_0x5eeffc[_0x33dd('0x8d')]||_0x5eeffc[_0x33dd('0x2d')]||_0x266379[_0x33dd('0x2d')],'basename':_0x55feac,'savename':util[_0x33dd('0x6e')](_0x33dd('0x8e'),_0x5eeffc[_0x33dd('0x2d')]||_0x266379[_0x33dd('0x2d')],require(_0x33dd('0x8f'))[_0x33dd('0x90')](0x4),_0x5eeffc[_0x33dd('0x8b')]||_0x33dd('0x91')),'reportId':_0x266379['id'],'reportType':_0x33dd('0x92')});return db['AnalyticExtractedReport'][_0x33dd('0x4a')](_0x42ae44,{'raw':!![]});})[_0x33dd('0x27')](function(_0x47a7c8){if(_0x266379[_0x33dd('0x77')]==='cdr'){_0x17ac8d[_0x33dd('0x3b')](_0x266379[_0x33dd('0x77')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5eeffc[_0x33dd('0x93')],_0x5eeffc[_0x33dd('0x94')]);}else{_0x17ac8d[_0x33dd('0x3b')](_0x266379[_0x33dd('0x77')]+_0x33dd('0x95'),_0x5eeffc['startDate'],_0x5eeffc[_0x33dd('0x94')]);}if(_0x47a7c8){logger[_0x33dd('0x96')](_0x33dd('0x97'),_0x17ac8d['toString']());require(_0x33dd('0x98'))[_0x33dd('0x99')](path[_0x33dd('0x7f')](__dirname,'../../components/export/',_0x47a7c8[_0x33dd('0x8b')]),[_0x47a7c8['id'],_0x17ac8d[_0x33dd('0x7c')](),path[_0x33dd('0x7f')](__dirname,_0x33dd('0x9a'),_0x47a7c8[_0x33dd('0x9b')]),_0x55feac]);return _0x47a7c8;}else{var _0x180f89=squel[_0x33dd('0x87')]();_0x180f89[_0x33dd('0x6b')]('('+_0x17ac8d[_0x33dd('0x7c')]()+')',_0x33dd('0x9c'));_0x180f89[_0x33dd('0x41')](_0x33dd('0x9d'),_0x33dd('0x1f'));_0x17ac8d['limit'](_0x5eeffc[_0x33dd('0x21')]||_0x49791f);_0x17ac8d['offset'](_0x5eeffc[_0x33dd('0x20')]||0x0);return db[_0x33dd('0x7d')][_0x33dd('0x33')](_0x180f89[_0x33dd('0x7c')](),{'type':db[_0x33dd('0x7d')]['QueryTypes'][_0x33dd('0x9e')]})['then'](function(_0x548204){if(!_0x548204[_0x33dd('0x38')]){_0x1d5c9c=0x0;}else{_0x1d5c9c=_0x548204[0x0][_0x33dd('0x1f')]||0x0;}return db[_0x33dd('0x7d')][_0x33dd('0x33')](_0x17ac8d[_0x33dd('0x7c')](),{'type':db[_0x33dd('0x7d')][_0x33dd('0x7e')][_0x33dd('0x9e')]});})[_0x33dd('0x27')](function(_0x4473a5){return{'rows':_0x4473a5||[],'count':_0x1d5c9c};});}});}exports[_0x33dd('0x9f')]=function(_0x21d8ee,_0x1f3668){return runReport(_0x21d8ee[_0x33dd('0x66')],_0x21d8ee[_0x33dd('0x33')],_0x21d8ee[_0x33dd('0x42')])[_0x33dd('0x27')](respondWithResult(_0x1f3668,null))[_0x33dd('0x46')](handleError(_0x1f3668,null));};exports[_0x33dd('0xa0')]=runReport;exports['query']=function(_0x3905f1,_0x51dd56){var _0x3b9c02=0xa;var _0x3c9e56=[_0x33dd('0x7f'),_0x33dd('0x53'),'right_join',_0x33dd('0x54')];var _0x1d2c94={'SUM':_0x33dd('0x55'),'COUNT':_0x33dd('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x33dd('0x82'),'AVG':_0x33dd('0x58'),'GROUP_CONCAT':_0x33dd('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x33dd('0x83')};var _0x190b8e={'SEC_TO_TIME':_0x33dd('0x5b'),'DATE':_0x33dd('0x5c'),'HOUR':_0x33dd('0x5d'),'ROUND':_0x33dd('0x5e'),'UNIX_TIMESTAMP':_0x33dd('0x5f')};var _0xd4f957=function(_0x1aa397){return!_[_0x33dd('0x84')]([_0x33dd('0xa1'),'IS\x20NOT\x20NULL',_0x33dd('0x61'),_0x33dd('0x62')],_0x1aa397);};var _0x167b06=function(_0x48a361){if(!_0x48a361||!_0x48a361['rules'][_0x33dd('0x38')]){return'';}for(var _0xd77641='(',_0x543403=0x0;_0x543403<_0x48a361[_0x33dd('0x63')][_0x33dd('0x38')];_0x543403+=0x1){_0x543403>0x0&&(_0xd77641+='\x20'+_0x48a361['operator']+'\x20');_0xd77641+=_0x48a361[_0x33dd('0x63')][_0x543403]['group']?_0x167b06(_0x48a361[_0x33dd('0x63')][_0x543403][_0x33dd('0x64')]):_0x48a361[_0x33dd('0x63')][_0x543403]['field']+'\x20'+_0x48a361[_0x33dd('0x63')][_0x543403][_0x33dd('0x85')]+(_0xd4f957(_0x48a361[_0x33dd('0x63')][_0x543403][_0x33dd('0x85')])?'\x20'+_0x48a361[_0x33dd('0x63')][_0x543403][_0x33dd('0x65')]:'');}return _0xd77641+')';};var _0x121d60={'where':{'id':_0x3905f1[_0x33dd('0x66')]['id']}},_0x25076b,_0x5d4bbf,_0x1fbb57,_0xcc15ff,_0x584402;_0x121d60=_[_0x33dd('0x3d')]({},_0x121d60,_0x3905f1[_0x33dd('0x42')]);return db['AnalyticDefaultReport'][_0x33dd('0x49')](_0x121d60)[_0x33dd('0x27')](function(_0x4d5500){if(_0x4d5500){_0x25076b=_0x4d5500;return _0x4d5500[_0x33dd('0x86')]();}return null;})[_0x33dd('0x27')](function(_0xbb3578){if(_0xbb3578){if(!_0xbb3578['length']){throw new db[(_0x33dd('0x67'))]['ValidationErrorItem'](_0x33dd('0x69'),0x193);}_0x5d4bbf=_0xbb3578;return db[_0x33dd('0x6a')][_0x33dd('0x44')]({'raw':!![]});}return null;})['then'](function(_0x2c2fdd){if(_0x2c2fdd){_0x1fbb57=_[_0x33dd('0xa2')](_0x2c2fdd,'id');var _0x13a7b1;var _0x359703=squel[_0x33dd('0x87')]();_0x359703[_0x33dd('0x6b')](_0x25076b[_0x33dd('0x77')]);for(var _0x33ae9f=0x0;_0x33ae9f<_0x5d4bbf[_0x33dd('0x38')];_0x33ae9f+=0x1){_0x13a7b1=_0x5d4bbf[_0x33ae9f][_0x33dd('0x6c')]?_0x1fbb57[_0x5d4bbf[_0x33ae9f]['MetricId']][_0x33dd('0x88')]:_0x5d4bbf[_0x33ae9f][_0x33dd('0x41')];_0x13a7b1=_0x5d4bbf[_0x33ae9f]['function']?_['replace'](_0x1d2c94[_0x5d4bbf[_0x33ae9f][_0x33dd('0x6d')]],'%s',_0x13a7b1):_0x13a7b1;_0x13a7b1=_0x5d4bbf[_0x33ae9f][_0x33dd('0x6e')]?_[_0x33dd('0x89')](_0x190b8e[_0x5d4bbf[_0x33ae9f][_0x33dd('0x6e')]],'%s',_0x13a7b1):_0x13a7b1;if(_0x5d4bbf[_0x33ae9f][_0x33dd('0x6f')]){_0x359703['group'](_0x13a7b1);}_0x5d4bbf[_0x33ae9f][_0x33dd('0x70')]&&_0x359703[_0x33dd('0xa3')](_0x13a7b1,_0x5d4bbf[_0x33ae9f]['orderBy']==='DESC'?![]:!![]);_0x359703[_0x33dd('0x41')](_0x13a7b1,_0x5d4bbf[_0x33ae9f][_0x33dd('0xa4')]||_0x13a7b1);}if(_0x25076b[_0x33dd('0x71')]){_0x25076b[_0x33dd('0x71')]=JSON['parse'](_0x25076b[_0x33dd('0x71')]);for(var _0x17959f=0x0;_0x17959f<_0x25076b[_0x33dd('0x71')][_0x33dd('0x38')];_0x17959f+=0x1){if(_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x3e')]&&_['includes'](_0x3c9e56,_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x3e')])&&_0x25076b[_0x33dd('0x71')][_0x17959f]['parentKey']&&_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x74')]&&_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x75')]){_0x359703[_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x3e')]](_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x74')],null,util[_0x33dd('0x6e')]('%s.%s\x20=\x20%s.%s',_0x25076b[_0x33dd('0x77')],_0x25076b['joins'][_0x17959f]['parentKey'],_0x25076b[_0x33dd('0x71')][_0x17959f][_0x33dd('0x74')],_0x25076b[_0x33dd('0x71')][_0x17959f]['foreignKey']));}}}if(_0x25076b[_0x33dd('0x78')]){_0x25076b[_0x33dd('0x78')]=JSON[_0x33dd('0x72')](_0x25076b[_0x33dd('0x78')]);_0x359703[_0x33dd('0x3b')](_0x167b06(_0x25076b[_0x33dd('0x78')][_0x33dd('0x64')]));}_0x584402=_0x359703[_0x33dd('0x79')]();_0x359703[_0x33dd('0x21')](_0x3b9c02);_0x359703['offset'](0x0);logger[_0x33dd('0x7a')](_0x33dd('0x7b'),_0x359703[_0x33dd('0x7c')]());return db[_0x33dd('0x7d')]['query'](_0x359703['toString'](),{'type':db['sequelize'][_0x33dd('0x7e')][_0x33dd('0x9e')]});}})[_0x33dd('0x27')](function(){return{'sql':_0x584402['toString']()};})[_0x33dd('0x27')](respondWithResult(_0x51dd56,null))[_0x33dd('0x46')](handleError(_0x51dd56,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7f00751..45435c2 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 _0x6c61=['rimraf','../../config/environment','exports','AnalyticDefaultReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x111f99,_0x563e5b){var _0xed3e46=function(_0x400d3a){while(--_0x400d3a){_0x111f99['push'](_0x111f99['shift']());}};_0xed3e46(++_0x563e5b);}(_0x6c61,0x7c));var _0x16c6=function(_0xd282c0,_0x394682){_0xd282c0=_0xd282c0-0x0;var _0x181fd8=_0x6c61[_0xd282c0];return _0x181fd8;};'use strict';var _=require(_0x16c6('0x0'));var util=require('util');var logger=require(_0x16c6('0x1'))(_0x16c6('0x2'));var moment=require(_0x16c6('0x3'));var BPromise=require(_0x16c6('0x4'));var rp=require(_0x16c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16c6('0x6'));var config=require(_0x16c6('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x16c6('0x8')]=function(_0x2d2425,_0x1212c5){return _0x2d2425['define'](_0x16c6('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae9=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x2ae9,0xf4));var _0x92ae=function(_0x1a13b1,_0x4d1d25){_0x1a13b1=_0x1a13b1-0x0;var _0x395e05=_0x2ae9[_0x1a13b1];return _0x395e05;};'use strict';var _=require(_0x92ae('0x0'));var util=require('util');var logger=require(_0x92ae('0x1'))('api');var moment=require(_0x92ae('0x2'));var BPromise=require(_0x92ae('0x3'));var rp=require(_0x92ae('0x4'));var fs=require('fs');var path=require(_0x92ae('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x92ae('0x6')]=function(_0x23ec9f,_0x314329){return _0x23ec9f[_0x92ae('0x7')](_0x92ae('0x8'),attributes,{'tableName':_0x92ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index ddbdb80..0dca685 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 _0xf4eb=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1d5daa,_0x452e80){var _0x5d14b1=function(_0x2ae76d){while(--_0x2ae76d){_0x1d5daa['push'](_0x1d5daa['shift']());}};_0x5d14b1(++_0x452e80);}(_0xf4eb,0xec));var _0xbf4e=function(_0x6662cb,_0x10ef71){_0x6662cb=_0x6662cb-0x0;var _0x4e8781=_0xf4eb[_0x6662cb];return _0x4e8781;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xf4eb=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x387bd5,_0x2b26e2){var _0x52d738=function(_0x52273d){while(--_0x52273d){_0x387bd5['push'](_0x387bd5['shift']());}};_0x52d738(++_0x2b26e2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x42652b,_0x3aa378){_0x42652b=_0x42652b-0x0;var _0x3d6577=_0xf4eb[_0x42652b];return _0x3d6577;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c9c53f2..b58bdf7 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 _0xe1b0=['query','post','create','update','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','/:id/preview','preview','get','run','/:id/query'];(function(_0xd25b59,_0x217f8a){var _0x4cab47=function(_0x26362d){while(--_0x26362d){_0xd25b59['push'](_0xd25b59['shift']());}};_0x4cab47(++_0x217f8a);}(_0xe1b0,0xf9));var _0x0e1b=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xe1b0[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x0e1b('0x0'));var util=require(_0x0e1b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e1b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0e1b('0x3'));var config=require(_0x0e1b('0x4'));var controller=require(_0x0e1b('0x5'));router['get']('/',auth[_0x0e1b('0x6')](),controller[_0x0e1b('0x7')]);router['get'](_0x0e1b('0x8'),auth[_0x0e1b('0x6')](),controller[_0x0e1b('0x9')]);router['get'](_0x0e1b('0xa'),auth[_0x0e1b('0x6')](),controller[_0x0e1b('0xb')]);router[_0x0e1b('0xc')]('/:id/run',auth[_0x0e1b('0x6')](),controller[_0x0e1b('0xd')]);router[_0x0e1b('0xc')](_0x0e1b('0xe'),auth['isAuthenticated'](),controller[_0x0e1b('0xf')]);router[_0x0e1b('0x10')]('/',auth[_0x0e1b('0x6')](),controller[_0x0e1b('0x11')]);router['put'](_0x0e1b('0x8'),auth[_0x0e1b('0x6')](),controller[_0x0e1b('0x12')]);router[_0x0e1b('0x13')]('/:id',auth[_0x0e1b('0x6')](),controller[_0x0e1b('0x14')]);module[_0x0e1b('0x15')]=router; \ No newline at end of file +var _0x0bec=['./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2ed450,_0x1bfa44){var _0x56f5b9=function(_0x16325d){while(--_0x16325d){_0x2ed450['push'](_0x2ed450['shift']());}};_0x56f5b9(++_0x1bfa44);}(_0x0bec,0x1ae));var _0xc0be=function(_0x56c8e3,_0x1e9a3a){_0x56c8e3=_0x56c8e3-0x0;var _0x439212=_0x0bec[_0x56c8e3];return _0x439212;};'use strict';var multer=require('multer');var util=require(_0xc0be('0x0'));var path=require(_0xc0be('0x1'));var timeout=require(_0xc0be('0x2'));var express=require(_0xc0be('0x3'));var router=express[_0xc0be('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0be('0x5'));var config=require(_0xc0be('0x6'));var controller=require(_0xc0be('0x7'));router[_0xc0be('0x8')]('/',auth[_0xc0be('0x9')](),controller[_0xc0be('0xa')]);router[_0xc0be('0x8')](_0xc0be('0xb'),auth[_0xc0be('0x9')](),controller[_0xc0be('0xc')]);router[_0xc0be('0x8')](_0xc0be('0xd'),auth[_0xc0be('0x9')](),controller[_0xc0be('0xe')]);router[_0xc0be('0x8')](_0xc0be('0xf'),auth[_0xc0be('0x9')](),controller['run']);router[_0xc0be('0x8')]('/:id/query',auth[_0xc0be('0x9')](),controller[_0xc0be('0x10')]);router[_0xc0be('0x11')]('/',auth[_0xc0be('0x9')](),controller[_0xc0be('0x12')]);router[_0xc0be('0x13')](_0xc0be('0xb'),auth[_0xc0be('0x9')](),controller[_0xc0be('0x14')]);router[_0xc0be('0x15')](_0xc0be('0xb'),auth['isAuthenticated'](),controller[_0xc0be('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f2dad52..047b2bb 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 _0xae0e=['pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xae0e,0x102));var _0xeae0=function(_0x353f5e,_0x311e9b){_0x353f5e=_0x353f5e-0x0;var _0xa514ec=_0xae0e[_0x353f5e];return _0xa514ec;};'use strict';var Sequelize=require(_0xeae0('0x0'));var moment=require(_0xeae0('0x1'));module[_0xeae0('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xeae0('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xeae0('0x4')](_0xeae0('0x5'),_0xeae0('0x6'),_0xeae0('0x7')),'allowNull':![],'defaultValue':_0xeae0('0x5')},'savename':{'type':Sequelize[_0xeae0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xeae0('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xeae0('0x9')},'type':{'type':Sequelize[_0xeae0('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xeae0('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xeae0('0xb')]},'reportType':{'type':Sequelize[_0xeae0('0x3')]}}; \ No newline at end of file +var _0xd844=['manual','scheduled','UNSIGNED','sequelize','exports','ENUM','csv','xlsx','STRING','DATE','Loading'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0xd844,0x9d));var _0x4d84=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd844[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4d84('0x0'));var moment=require('moment');module[_0x4d84('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x4d84('0x2')](_0x4d84('0x3'),'pdf',_0x4d84('0x4')),'allowNull':![],'defaultValue':_0x4d84('0x3')},'savename':{'type':Sequelize[_0x4d84('0x5')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x4d84('0x6')]},'status':{'type':Sequelize[_0x4d84('0x5')],'defaultValue':_0x4d84('0x7')},'type':{'type':Sequelize[_0x4d84('0x2')](_0x4d84('0x8'),_0x4d84('0x9')),'allowNull':![],'defaultValue':_0x4d84('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x4d84('0xa')]},'reportType':{'type':Sequelize[_0x4d84('0x5')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 97592e8..cc23a66 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 _0x773a=['UserProfileResource','error','name','index','AnalyticExtractedReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','field','filter','options','includeAll','include','rows','catch','params','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','download','savename','existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','basename','output','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports'];(function(_0x6ac456,_0x1ef692){var _0x41db4c=function(_0x35e597){while(--_0x35e597){_0x6ac456['push'](_0x6ac456['shift']());}};_0x41db4c(++_0x1ef692);}(_0x773a,0xf3));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa773('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa773('0x1'));var jsonpatch=require(_0xa773('0x2'));var rp=require(_0xa773('0x3'));var moment=require(_0xa773('0x4'));var BPromise=require(_0xa773('0x5'));var Mustache=require(_0xa773('0x6'));var util=require(_0xa773('0x7'));var path=require(_0xa773('0x8'));var sox=require('sox');var csv=require(_0xa773('0x9'));var ejs=require(_0xa773('0xa'));var fs=require('fs');var _=require(_0xa773('0xb'));var squel=require('squel');var crypto=require(_0xa773('0xc'));var jsforce=require(_0xa773('0xd'));var deskjs=require(_0xa773('0xe'));var toCsv=require(_0xa773('0x9'));var querystring=require(_0xa773('0xf'));var Papa=require(_0xa773('0x10'));var Redis=require(_0xa773('0x11'));var authService=require(_0xa773('0x12'));var qs=require(_0xa773('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa773('0x14'))(_0xa773('0x15'));var utils=require(_0xa773('0x16'));var config=require('../../config/environment');var db=require(_0xa773('0x17'))['db'];function respondWithStatusCode(_0x56fd84,_0x4032ad){_0x4032ad=_0x4032ad||0xcc;return function(_0x1e213a){if(_0x1e213a){return _0x56fd84[_0xa773('0x18')](_0x4032ad);}return _0x56fd84[_0xa773('0x19')](_0x4032ad)[_0xa773('0x1a')]();};}function respondWithResult(_0x1d2dc9,_0x437843){_0x437843=_0x437843||0xc8;return function(_0x51cf64){if(_0x51cf64){return _0x1d2dc9[_0xa773('0x19')](_0x437843)[_0xa773('0x1b')](_0x51cf64);}};}function respondWithFilteredResult(_0x3fe4b3,_0x5d8f42){return function(_0x5a3aa2){if(_0x5a3aa2){var _0x5315bd=_0x5a3aa2[_0xa773('0x1c')],_0x23a441=_0x5d8f42[_0xa773('0x1d')],_0xa0f002=_0x5d8f42['offset']+_0x5d8f42[_0xa773('0x1e')],_0x37a58f;if(_0xa0f002>=_0x5315bd){_0xa0f002=_0x5315bd;_0x37a58f=0xc8;}else{_0x37a58f=0xce;}_0x3fe4b3[_0xa773('0x19')](_0x37a58f);return _0x3fe4b3['set'](_0xa773('0x1f'),_0x23a441+'-'+_0xa0f002+'/'+_0x5315bd)[_0xa773('0x1b')](_0x5a3aa2);}return null;};}function patchUpdates(_0x54df52){return function(_0x2a90d1){try{jsonpatch[_0xa773('0x20')](_0x2a90d1,_0x54df52,!![]);}catch(_0xe87b34){return BPromise[_0xa773('0x21')](_0xe87b34);}return _0x2a90d1['save']();};}function saveUpdates(_0x10aec2,_0x544adb){return function(_0x204af9){if(_0x204af9){return _0x204af9[_0xa773('0x22')](_0x10aec2)[_0xa773('0x23')](function(_0x57e283){return _0x57e283;});}return null;};}function removeEntity(_0x52fab5,_0x2095a3){return function(_0x4e1300){if(_0x4e1300){return _0x4e1300[_0xa773('0x24')]()[_0xa773('0x23')](function(){var _0x63c91a=_0x4e1300[_0xa773('0x25')]({'plain':!![]});var _0x22b6a2=_0xa773('0x26');return db[_0xa773('0x27')][_0xa773('0x24')]({'where':{'type':_0x22b6a2,'resourceId':_0x63c91a['id']}})[_0xa773('0x23')](function(){return _0x4e1300;});})[_0xa773('0x23')](function(){_0x52fab5[_0xa773('0x19')](0xcc)[_0xa773('0x1a')]();});}};}function handleEntityNotFound(_0x5572f7,_0x215766){return function(_0x42c6b2){if(!_0x42c6b2){_0x5572f7[_0xa773('0x18')](0x194);}return _0x42c6b2;};}function handleError(_0x3382dd,_0x5c9eb6){_0x5c9eb6=_0x5c9eb6||0x1f4;return function(_0x5dd2c6){logger[_0xa773('0x28')](_0x5dd2c6['stack']);if(_0x5dd2c6[_0xa773('0x29')]){delete _0x5dd2c6[_0xa773('0x29')];}_0x3382dd['status'](_0x5c9eb6)['send'](_0x5dd2c6);};}exports[_0xa773('0x2a')]=function(_0xaf4bbf,_0x55f3b7){var _0x3ee0f0={},_0x4ca9f5={},_0x4a4341={'count':0x0,'rows':[]};var _0x40ab58=db[_0xa773('0x2b')][_0xa773('0x2c')];_0x4ca9f5[_0xa773('0x2d')]=_[_0xa773('0x2e')](_0x40ab58);_0x4ca9f5[_0xa773('0x2f')]=_[_0xa773('0x2e')](_0xaf4bbf['query']);_0x4ca9f5[_0xa773('0x30')]=_['intersection'](_0x4ca9f5['model'],_0x4ca9f5[_0xa773('0x2f')]);_0x3ee0f0[_0xa773('0x31')]=_[_0xa773('0x32')](_0x4ca9f5['model'],qs[_0xa773('0x33')](_0xaf4bbf[_0xa773('0x2f')][_0xa773('0x33')]));_0x3ee0f0['attributes']=_0x3ee0f0['attributes'][_0xa773('0x34')]?_0x3ee0f0[_0xa773('0x31')]:_0x4ca9f5['model'];if(!_0xaf4bbf['query'][_0xa773('0x35')](_0xa773('0x36'))){_0x3ee0f0[_0xa773('0x1e')]=qs[_0xa773('0x1e')](_0xaf4bbf[_0xa773('0x2f')]['limit']);_0x3ee0f0[_0xa773('0x1d')]=qs['offset'](_0xaf4bbf[_0xa773('0x2f')][_0xa773('0x1d')]);}_0x3ee0f0[_0xa773('0x37')]=qs[_0xa773('0x38')](_0xaf4bbf[_0xa773('0x2f')][_0xa773('0x38')]);_0x3ee0f0[_0xa773('0x39')]=qs[_0xa773('0x30')](_[_0xa773('0x3a')](_0xaf4bbf['query'],_0x4ca9f5['filters']));if(_0xaf4bbf[_0xa773('0x2f')]['filter']){_0x3ee0f0['where']=_[_0xa773('0x3b')](_0x3ee0f0[_0xa773('0x39')],{'$or':_[_0xa773('0x3c')](_0x40ab58,function(_0x36418d){if(_0x36418d[_0xa773('0x3d')][_0xa773('0x3e')]!=='VIRTUAL'){var _0x40e9db={};_0x40e9db[_0x36418d[_0xa773('0x3f')]]={'$like':'%'+_0xaf4bbf['query'][_0xa773('0x40')]+'%'};return _0x40e9db;}})});}_0x3ee0f0=_['merge']({},_0x3ee0f0,_0xaf4bbf[_0xa773('0x41')]);var _0x3d1491={'where':_0x3ee0f0[_0xa773('0x39')]};return db[_0xa773('0x2b')][_0xa773('0x1c')](_0x3d1491)[_0xa773('0x23')](function(_0x42f75f){_0x4a4341[_0xa773('0x1c')]=_0x42f75f;if(_0xaf4bbf[_0xa773('0x2f')][_0xa773('0x42')]){_0x3ee0f0[_0xa773('0x43')]=[{'all':!![]}];}return db[_0xa773('0x2b')]['findAll'](_0x3ee0f0);})[_0xa773('0x23')](function(_0x30a8e1){_0x4a4341[_0xa773('0x44')]=_0x30a8e1;return _0x4a4341;})['then'](respondWithFilteredResult(_0x55f3b7,_0x3ee0f0))[_0xa773('0x45')](handleError(_0x55f3b7,null));};exports['show']=function(_0x51682c,_0x11a675){var _0x5f00e9={'raw':!![],'where':{'id':_0x51682c[_0xa773('0x46')]['id']}},_0x4ee969={};_0x4ee969[_0xa773('0x2d')]=_['keys'](db[_0xa773('0x2b')]['rawAttributes']);_0x4ee969[_0xa773('0x2f')]=_[_0xa773('0x2e')](_0x51682c[_0xa773('0x2f')]);_0x4ee969[_0xa773('0x30')]=_[_0xa773('0x32')](_0x4ee969[_0xa773('0x2d')],_0x4ee969[_0xa773('0x2f')]);_0x5f00e9[_0xa773('0x31')]=_[_0xa773('0x32')](_0x4ee969[_0xa773('0x2d')],qs[_0xa773('0x33')](_0x51682c[_0xa773('0x2f')]['fields']));_0x5f00e9[_0xa773('0x31')]=_0x5f00e9[_0xa773('0x31')][_0xa773('0x34')]?_0x5f00e9['attributes']:_0x4ee969[_0xa773('0x2d')];if(_0x51682c[_0xa773('0x2f')]['includeAll']){_0x5f00e9[_0xa773('0x43')]=[{'all':!![]}];}_0x5f00e9=_[_0xa773('0x3b')]({},_0x5f00e9,_0x51682c[_0xa773('0x41')]);return db[_0xa773('0x2b')][_0xa773('0x47')](_0x5f00e9)['then'](handleEntityNotFound(_0x11a675,null))[_0xa773('0x23')](respondWithResult(_0x11a675,null))[_0xa773('0x45')](handleError(_0x11a675,null));};exports['create']=function(_0x5563f3,_0x6964f6){return db[_0xa773('0x2b')][_0xa773('0x48')](_0x5563f3[_0xa773('0x49')],{})['then'](function(_0x528f85){var _0x440848=_0x5563f3['user']['get']({'plain':!![]});if(!_0x440848)throw new Error(_0xa773('0x4a'));if(_0x440848[_0xa773('0x4b')]===_0xa773('0x4c')){var _0x45b233=_0x528f85[_0xa773('0x25')]({'plain':!![]});var _0x2a4cee=_0xa773('0x26');return db[_0xa773('0x4d')][_0xa773('0x47')]({'where':{'name':_0x2a4cee,'userProfileId':_0x440848[_0xa773('0x4e')]},'raw':!![]})['then'](function(_0x38ed4a){if(_0x38ed4a&&_0x38ed4a[_0xa773('0x4f')]===0x0){return db[_0xa773('0x27')][_0xa773('0x48')]({'name':_0x45b233[_0xa773('0x29')],'resourceId':_0x45b233['id'],'type':_0x38ed4a[_0xa773('0x29')],'sectionId':_0x38ed4a['id']},{})[_0xa773('0x23')](function(){return _0x528f85;});}else{return _0x528f85;}})[_0xa773('0x45')](function(_0x2a9ccf){logger[_0xa773('0x28')](_0xa773('0x50'),_0x2a9ccf);throw _0x2a9ccf;});}return _0x528f85;})['then'](respondWithResult(_0x6964f6,0xc9))[_0xa773('0x45')](handleError(_0x6964f6,null));};exports[_0xa773('0x22')]=function(_0x562853,_0x349336){if(_0x562853['body']['id']){delete _0x562853[_0xa773('0x49')]['id'];}return db['AnalyticExtractedReport'][_0xa773('0x47')]({'where':{'id':_0x562853['params']['id']}})[_0xa773('0x23')](handleEntityNotFound(_0x349336,null))[_0xa773('0x23')](saveUpdates(_0x562853[_0xa773('0x49')],null))[_0xa773('0x23')](respondWithResult(_0x349336,null))[_0xa773('0x45')](handleError(_0x349336,null));};exports[_0xa773('0x24')]=function(_0x5d2fe7,_0x448a3b){return db['AnalyticExtractedReport'][_0xa773('0x47')]({'where':{'id':_0x5d2fe7['params']['id']}})[_0xa773('0x23')](handleEntityNotFound(_0x448a3b,null))[_0xa773('0x23')](removeEntity(_0x448a3b,null))['catch'](handleError(_0x448a3b,null));};exports[_0xa773('0x51')]=function(_0x473440,_0x4ff7db,_0x197a8b){return db[_0xa773('0x2b')][_0xa773('0x47')]({'where':{'id':_0x473440[_0xa773('0x46')]['id']},'attributes':[_0xa773('0x29'),'basename',_0xa773('0x52'),'output'],'raw':!![]})[_0xa773('0x23')](handleEntityNotFound(_0x4ff7db,null))['then'](function(_0x3ec885){if(_0x3ec885){if(!fs[_0xa773('0x53')](path[_0xa773('0x54')](config[_0xa773('0x55')],'server/files/reports',_0x3ec885[_0xa773('0x52')]))){throw new db['Sequelize'][(_0xa773('0x56'))](_0xa773('0x57'));}if(_0x473440[_0xa773('0x2f')]['exists']){return _0x4ff7db[_0xa773('0x18')](0xc8);}return _0x4ff7db[_0xa773('0x51')](path[_0xa773('0x54')](config[_0xa773('0x55')],_0xa773('0x58'),_0x3ec885[_0xa773('0x52')]),util[_0xa773('0x59')](_0xa773('0x5a'),_0x3ec885[_0xa773('0x5b')]||_0x3ec885[_0xa773('0x29')],_0x3ec885[_0xa773('0x5c')][_0xa773('0x5d')]()));}})[_0xa773('0x45')](handleError(_0x4ff7db,null));}; \ No newline at end of file +var _0x9f89=['basename','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','ExtractedReports','stack','name','send','index','AnalyticExtractedReport','rawAttributes','keys','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','key','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','savename','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','download','join','format','%s.%s'];(function(_0x383064,_0x1d1f10){var _0x11b3fa=function(_0x4d614f){while(--_0x4d614f){_0x383064['push'](_0x383064['shift']());}};_0x11b3fa(++_0x1d1f10);}(_0x9f89,0xc3));var _0x99f8=function(_0x5845fa,_0x376839){_0x5845fa=_0x5845fa-0x0;var _0x3abd60=_0x9f89[_0x5845fa];return _0x3abd60;};'use strict';var pdf=require(_0x99f8('0x0'));var emlformat=require(_0x99f8('0x1'));var rimraf=require(_0x99f8('0x2'));var zipdir=require(_0x99f8('0x3'));var jsonpatch=require(_0x99f8('0x4'));var rp=require(_0x99f8('0x5'));var moment=require(_0x99f8('0x6'));var BPromise=require(_0x99f8('0x7'));var Mustache=require(_0x99f8('0x8'));var util=require(_0x99f8('0x9'));var path=require(_0x99f8('0xa'));var sox=require(_0x99f8('0xb'));var csv=require(_0x99f8('0xc'));var ejs=require(_0x99f8('0xd'));var fs=require('fs');var _=require(_0x99f8('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x99f8('0xf'));var deskjs=require(_0x99f8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x99f8('0x11'));var Papa=require(_0x99f8('0x12'));var Redis=require(_0x99f8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x99f8('0x14'));var hardwareService=require(_0x99f8('0x15'));var logger=require(_0x99f8('0x16'))(_0x99f8('0x17'));var utils=require(_0x99f8('0x18'));var config=require(_0x99f8('0x19'));var db=require(_0x99f8('0x1a'))['db'];function respondWithStatusCode(_0x253424,_0x3fc2b3){_0x3fc2b3=_0x3fc2b3||0xcc;return function(_0x3599a0){if(_0x3599a0){return _0x253424[_0x99f8('0x1b')](_0x3fc2b3);}return _0x253424[_0x99f8('0x1c')](_0x3fc2b3)[_0x99f8('0x1d')]();};}function respondWithResult(_0x2b8054,_0x3199fe){_0x3199fe=_0x3199fe||0xc8;return function(_0x2afc70){if(_0x2afc70){return _0x2b8054[_0x99f8('0x1c')](_0x3199fe)['json'](_0x2afc70);}};}function respondWithFilteredResult(_0x18a014,_0x1f9fad){return function(_0x57af49){if(_0x57af49){var _0x386f29=_0x57af49[_0x99f8('0x1e')],_0x2b1870=_0x1f9fad[_0x99f8('0x1f')],_0x18fee7=_0x1f9fad['offset']+_0x1f9fad[_0x99f8('0x20')],_0x39f2c4;if(_0x18fee7>=_0x386f29){_0x18fee7=_0x386f29;_0x39f2c4=0xc8;}else{_0x39f2c4=0xce;}_0x18a014[_0x99f8('0x1c')](_0x39f2c4);return _0x18a014[_0x99f8('0x21')](_0x99f8('0x22'),_0x2b1870+'-'+_0x18fee7+'/'+_0x386f29)[_0x99f8('0x23')](_0x57af49);}return null;};}function patchUpdates(_0x448fe3){return function(_0x5f1048){try{jsonpatch[_0x99f8('0x24')](_0x5f1048,_0x448fe3,!![]);}catch(_0x3f8384){return BPromise[_0x99f8('0x25')](_0x3f8384);}return _0x5f1048['save']();};}function saveUpdates(_0x1863a1,_0x3bf5aa){return function(_0x901cb7){if(_0x901cb7){return _0x901cb7[_0x99f8('0x26')](_0x1863a1)[_0x99f8('0x27')](function(_0x3a038a){return _0x3a038a;});}return null;};}function removeEntity(_0x54435a,_0x4c6888){return function(_0x53c021){if(_0x53c021){return _0x53c021[_0x99f8('0x28')]()[_0x99f8('0x27')](function(){var _0x4a7b31=_0x53c021['get']({'plain':!![]});var _0x25a09d=_0x99f8('0x29');return db['UserProfileResource'][_0x99f8('0x28')]({'where':{'type':_0x25a09d,'resourceId':_0x4a7b31['id']}})[_0x99f8('0x27')](function(){return _0x53c021;});})[_0x99f8('0x27')](function(){_0x54435a[_0x99f8('0x1c')](0xcc)[_0x99f8('0x1d')]();});}};}function handleEntityNotFound(_0x5ad8b0,_0x5d1598){return function(_0x3ce8f0){if(!_0x3ce8f0){_0x5ad8b0[_0x99f8('0x1b')](0x194);}return _0x3ce8f0;};}function handleError(_0x56452d,_0x3cb66e){_0x3cb66e=_0x3cb66e||0x1f4;return function(_0x52e139){logger['error'](_0x52e139[_0x99f8('0x2a')]);if(_0x52e139[_0x99f8('0x2b')]){delete _0x52e139[_0x99f8('0x2b')];}_0x56452d[_0x99f8('0x1c')](_0x3cb66e)[_0x99f8('0x2c')](_0x52e139);};}exports[_0x99f8('0x2d')]=function(_0x1a5b78,_0x53d926){var _0x5bf6a4={},_0x3457a5={},_0x371922={'count':0x0,'rows':[]};var _0x166d06=db[_0x99f8('0x2e')][_0x99f8('0x2f')];_0x3457a5['model']=_[_0x99f8('0x30')](_0x166d06);_0x3457a5['query']=_['keys'](_0x1a5b78[_0x99f8('0x31')]);_0x3457a5[_0x99f8('0x32')]=_['intersection'](_0x3457a5[_0x99f8('0x33')],_0x3457a5[_0x99f8('0x31')]);_0x5bf6a4[_0x99f8('0x34')]=_[_0x99f8('0x35')](_0x3457a5[_0x99f8('0x33')],qs[_0x99f8('0x36')](_0x1a5b78['query'][_0x99f8('0x36')]));_0x5bf6a4['attributes']=_0x5bf6a4[_0x99f8('0x34')]['length']?_0x5bf6a4['attributes']:_0x3457a5[_0x99f8('0x33')];if(!_0x1a5b78[_0x99f8('0x31')]['hasOwnProperty'](_0x99f8('0x37'))){_0x5bf6a4[_0x99f8('0x20')]=qs[_0x99f8('0x20')](_0x1a5b78[_0x99f8('0x31')][_0x99f8('0x20')]);_0x5bf6a4[_0x99f8('0x1f')]=qs[_0x99f8('0x1f')](_0x1a5b78[_0x99f8('0x31')][_0x99f8('0x1f')]);}_0x5bf6a4[_0x99f8('0x38')]=qs['sort'](_0x1a5b78[_0x99f8('0x31')][_0x99f8('0x39')]);_0x5bf6a4[_0x99f8('0x3a')]=qs[_0x99f8('0x32')](_[_0x99f8('0x3b')](_0x1a5b78[_0x99f8('0x31')],_0x3457a5[_0x99f8('0x32')]));if(_0x1a5b78[_0x99f8('0x31')][_0x99f8('0x3c')]){_0x5bf6a4[_0x99f8('0x3a')]=_[_0x99f8('0x3d')](_0x5bf6a4[_0x99f8('0x3a')],{'$or':_['map'](_0x166d06,function(_0x25ea33){if(_0x25ea33['type'][_0x99f8('0x3e')]!=='VIRTUAL'){var _0x38a037={};_0x38a037[_0x25ea33['field']]={'$like':'%'+_0x1a5b78[_0x99f8('0x31')][_0x99f8('0x3c')]+'%'};return _0x38a037;}})});}_0x5bf6a4=_['merge']({},_0x5bf6a4,_0x1a5b78[_0x99f8('0x3f')]);var _0x39dd01={'where':_0x5bf6a4[_0x99f8('0x3a')]};return db[_0x99f8('0x2e')]['count'](_0x39dd01)[_0x99f8('0x27')](function(_0x2c2428){_0x371922[_0x99f8('0x1e')]=_0x2c2428;if(_0x1a5b78[_0x99f8('0x31')]['includeAll']){_0x5bf6a4[_0x99f8('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x99f8('0x41')](_0x5bf6a4);})[_0x99f8('0x27')](function(_0x341af6){_0x371922[_0x99f8('0x42')]=_0x341af6;return _0x371922;})['then'](respondWithFilteredResult(_0x53d926,_0x5bf6a4))['catch'](handleError(_0x53d926,null));};exports[_0x99f8('0x43')]=function(_0x4c6dc0,_0x356651){var _0x5e801c={'raw':!![],'where':{'id':_0x4c6dc0[_0x99f8('0x44')]['id']}},_0x572dd5={};_0x572dd5[_0x99f8('0x33')]=_[_0x99f8('0x30')](db[_0x99f8('0x2e')][_0x99f8('0x2f')]);_0x572dd5[_0x99f8('0x31')]=_[_0x99f8('0x30')](_0x4c6dc0['query']);_0x572dd5[_0x99f8('0x32')]=_[_0x99f8('0x35')](_0x572dd5[_0x99f8('0x33')],_0x572dd5[_0x99f8('0x31')]);_0x5e801c[_0x99f8('0x34')]=_[_0x99f8('0x35')](_0x572dd5[_0x99f8('0x33')],qs['fields'](_0x4c6dc0[_0x99f8('0x31')]['fields']));_0x5e801c[_0x99f8('0x34')]=_0x5e801c[_0x99f8('0x34')][_0x99f8('0x45')]?_0x5e801c[_0x99f8('0x34')]:_0x572dd5[_0x99f8('0x33')];if(_0x4c6dc0[_0x99f8('0x31')][_0x99f8('0x46')]){_0x5e801c[_0x99f8('0x40')]=[{'all':!![]}];}_0x5e801c=_[_0x99f8('0x3d')]({},_0x5e801c,_0x4c6dc0[_0x99f8('0x3f')]);return db[_0x99f8('0x2e')][_0x99f8('0x47')](_0x5e801c)['then'](handleEntityNotFound(_0x356651,null))[_0x99f8('0x27')](respondWithResult(_0x356651,null))[_0x99f8('0x48')](handleError(_0x356651,null));};exports[_0x99f8('0x49')]=function(_0x1f837f,_0x5453ed){return db[_0x99f8('0x2e')][_0x99f8('0x49')](_0x1f837f[_0x99f8('0x4a')],{})[_0x99f8('0x27')](function(_0x422714){var _0x3b96d2=_0x1f837f[_0x99f8('0x4b')][_0x99f8('0x4c')]({'plain':!![]});if(!_0x3b96d2)throw new Error(_0x99f8('0x4d'));if(_0x3b96d2[_0x99f8('0x4e')]===_0x99f8('0x4b')){var _0x1fa3e0=_0x422714['get']({'plain':!![]});var _0x5969cb='ExtractedReports';return db[_0x99f8('0x4f')]['find']({'where':{'name':_0x5969cb,'userProfileId':_0x3b96d2[_0x99f8('0x50')]},'raw':!![]})[_0x99f8('0x27')](function(_0x59414e){if(_0x59414e&&_0x59414e['autoAssociation']===0x0){return db[_0x99f8('0x51')]['create']({'name':_0x1fa3e0[_0x99f8('0x2b')],'resourceId':_0x1fa3e0['id'],'type':_0x59414e[_0x99f8('0x2b')],'sectionId':_0x59414e['id']},{})[_0x99f8('0x27')](function(){return _0x422714;});}else{return _0x422714;}})['catch'](function(_0x1f8ef0){logger[_0x99f8('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f8ef0);throw _0x1f8ef0;});}return _0x422714;})['then'](respondWithResult(_0x5453ed,0xc9))['catch'](handleError(_0x5453ed,null));};exports['update']=function(_0x578bf5,_0x5579e4){if(_0x578bf5[_0x99f8('0x4a')]['id']){delete _0x578bf5[_0x99f8('0x4a')]['id'];}return db[_0x99f8('0x2e')][_0x99f8('0x47')]({'where':{'id':_0x578bf5['params']['id']}})[_0x99f8('0x27')](handleEntityNotFound(_0x5579e4,null))[_0x99f8('0x27')](saveUpdates(_0x578bf5['body'],null))['then'](respondWithResult(_0x5579e4,null))[_0x99f8('0x48')](handleError(_0x5579e4,null));};exports[_0x99f8('0x28')]=function(_0x14477a,_0x383fd0){return db[_0x99f8('0x2e')]['find']({'where':{'id':_0x14477a[_0x99f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x383fd0,null))['then'](removeEntity(_0x383fd0,null))[_0x99f8('0x48')](handleError(_0x383fd0,null));};exports['download']=function(_0x5bf6d1,_0x1cb6e0,_0x2e6fd9){return db[_0x99f8('0x2e')]['find']({'where':{'id':_0x5bf6d1[_0x99f8('0x44')]['id']},'attributes':[_0x99f8('0x2b'),'basename',_0x99f8('0x53'),'output'],'raw':!![]})[_0x99f8('0x27')](handleEntityNotFound(_0x1cb6e0,null))[_0x99f8('0x27')](function(_0xcd338f){if(_0xcd338f){if(!fs[_0x99f8('0x54')](path['join'](config[_0x99f8('0x55')],_0x99f8('0x56'),_0xcd338f[_0x99f8('0x53')]))){throw new db['Sequelize'][(_0x99f8('0x57'))](_0x99f8('0x58'));}if(_0x5bf6d1[_0x99f8('0x31')]['exists']){return _0x1cb6e0[_0x99f8('0x1b')](0xc8);}return _0x1cb6e0[_0x99f8('0x59')](path[_0x99f8('0x5a')](config[_0x99f8('0x55')],'server/files/reports',_0xcd338f[_0x99f8('0x53')]),util[_0x99f8('0x5b')](_0x99f8('0x5c'),_0xcd338f[_0x99f8('0x5d')]||_0xcd338f[_0x99f8('0x2b')],_0xcd338f[_0x99f8('0x5e')][_0x99f8('0x5f')]()));}})[_0x99f8('0x48')](handleError(_0x1cb6e0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8ef5654..b62c48c 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x47f680,_0x2604da){var _0xa99fc5=function(_0x3dd5ab){while(--_0x3dd5ab){_0x47f680['push'](_0x47f680['shift']());}};_0xa99fc5(++_0x2604da);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5885dd,_0x47575c){_0x5885dd=_0x5885dd-0x0;var _0x51d3a=_0x9c5a[_0x5885dd];return _0x51d3a;};'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('./analyticExtractedReport.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf006=['bluebird','path','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','../../config/logger','api'];(function(_0x4617b1,_0x2ad6fe){var _0x8c788d=function(_0x49d899){while(--_0x49d899){_0x4617b1['push'](_0x4617b1['shift']());}};_0x8c788d(++_0x2ad6fe);}(_0xf006,0x146));var _0x6f00=function(_0x3f546a,_0x352d20){_0x3f546a=_0x3f546a-0x0;var _0x4bd264=_0xf006[_0x3f546a];return _0x4bd264;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('AnalyticExtractedReport',attributes,{'tableName':_0x6f00('0x7'),'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 1dd6f3b..ee4199a 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 _0xe3ad=['error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xe3ad,0x195));var _0xde3a=function(_0x57b4c4,_0x4e23f7){_0x57b4c4=_0x57b4c4-0x0;var _0x595a3b=_0xe3ad[_0x57b4c4];return _0x595a3b;};'use strict';var _=require('lodash');var util=require(_0xde3a('0x0'));var moment=require('moment');var BPromise=require(_0xde3a('0x1'));var rs=require(_0xde3a('0x2'));var fs=require('fs');var Redis=require(_0xde3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde3a('0x4'));var logger=require('../../config/logger')(_0xde3a('0x5'));var config=require(_0xde3a('0x6'));var jayson=require(_0xde3a('0x7'));var client=jayson[_0xde3a('0x8')][_0xde3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bd515,_0x2be669,_0x4be40c){return new BPromise(function(_0x35780a,_0x41d2d9){return client[_0xde3a('0xa')](_0x1bd515,_0x4be40c)[_0xde3a('0xb')](function(_0xcf4f6){logger[_0xde3a('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2be669,'request\x20sent');logger[_0xde3a('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2be669,_0xde3a('0xe'),JSON['stringify'](_0xcf4f6));if(_0xcf4f6['error']){if(_0xcf4f6[_0xde3a('0xf')]['code']===0x1f4){logger['error'](_0xde3a('0x10'),_0x2be669,_0xcf4f6[_0xde3a('0xf')][_0xde3a('0x11')]);return _0x41d2d9(_0xcf4f6['error'][_0xde3a('0x11')]);}logger[_0xde3a('0xf')](_0xde3a('0x10'),_0x2be669,_0xcf4f6[_0xde3a('0xf')][_0xde3a('0x11')]);return _0x35780a(_0xcf4f6[_0xde3a('0xf')][_0xde3a('0x11')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2be669,_0xde3a('0xe'));_0x35780a(_0xcf4f6[_0xde3a('0x12')]['message']);}})[_0xde3a('0x13')](function(_0x1ac6e5){logger[_0xde3a('0xf')](_0xde3a('0x10'),_0x2be669,_0x1ac6e5);_0x41d2d9(_0x1ac6e5);});});} \ No newline at end of file +var _0x9062=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0xf23c02,_0x1c997e){var _0x292dd9=function(_0x1a525f){while(--_0x1a525f){_0xf23c02['push'](_0xf23c02['shift']());}};_0x292dd9(++_0x1c997e);}(_0x9062,0x1b6));var _0x2906=function(_0x231ce0,_0x185e39){_0x231ce0=_0x231ce0-0x0;var _0x3efe64=_0x9062[_0x231ce0];return _0x3efe64;};'use strict';var _=require('lodash');var util=require(_0x2906('0x0'));var moment=require(_0x2906('0x1'));var BPromise=require(_0x2906('0x2'));var rs=require(_0x2906('0x3'));var fs=require('fs');var Redis=require(_0x2906('0x4'));var db=require(_0x2906('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2906('0x6'));var config=require('../../config/environment');var jayson=require(_0x2906('0x7'));var client=jayson['client'][_0x2906('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x862205,_0xa3ba72,_0x5b4dea){return new BPromise(function(_0x156f6c,_0x224c50){return client[_0x2906('0x9')](_0x862205,_0x5b4dea)[_0x2906('0xa')](function(_0x4295c7){logger[_0x2906('0xb')](_0x2906('0xc'),_0xa3ba72,_0x2906('0xd'));logger['debug'](_0x2906('0xe'),_0xa3ba72,'request\x20sent',JSON[_0x2906('0xf')](_0x4295c7));if(_0x4295c7['error']){if(_0x4295c7[_0x2906('0x10')][_0x2906('0x11')]===0x1f4){logger['error'](_0x2906('0xc'),_0xa3ba72,_0x4295c7[_0x2906('0x10')][_0x2906('0x12')]);return _0x224c50(_0x4295c7[_0x2906('0x10')][_0x2906('0x12')]);}logger[_0x2906('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xa3ba72,_0x4295c7[_0x2906('0x10')][_0x2906('0x12')]);return _0x156f6c(_0x4295c7[_0x2906('0x10')][_0x2906('0x12')]);}else{logger[_0x2906('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xa3ba72,_0x2906('0xd'));_0x156f6c(_0x4295c7['result'][_0x2906('0x12')]);}})[_0x2906('0x13')](function(_0x37cfa1){logger[_0x2906('0x10')](_0x2906('0xc'),_0xa3ba72,_0x37cfa1);_0x224c50(_0x37cfa1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 56440cc..2aaf61b 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 _0x9141=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','put','update','exports','multer','connect-timeout','express'];(function(_0x3be055,_0x24a44a){var _0x162e2a=function(_0x524ab7){while(--_0x524ab7){_0x3be055['push'](_0x3be055['shift']());}};_0x162e2a(++_0x24a44a);}(_0x9141,0x177));var _0x1914=function(_0x36fef1,_0xe575fe){_0x36fef1=_0x36fef1-0x0;var _0x257b52=_0x9141[_0x36fef1];return _0x257b52;};'use strict';var multer=require(_0x1914('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1914('0x1'));var express=require(_0x1914('0x2'));var router=express[_0x1914('0x3')]();var auth=require(_0x1914('0x4'));var interaction=require(_0x1914('0x5'));var config=require(_0x1914('0x6'));var controller=require(_0x1914('0x7'));router['get']('/',auth[_0x1914('0x8')](),controller[_0x1914('0x9')]);router[_0x1914('0xa')](_0x1914('0xb'),auth[_0x1914('0x8')](),controller[_0x1914('0xc')]);router[_0x1914('0xa')](_0x1914('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x1914('0xe')]('/',auth[_0x1914('0x8')](),controller['create']);router[_0x1914('0xf')](_0x1914('0xb'),auth[_0x1914('0x8')](),controller[_0x1914('0x10')]);router['delete'](_0x1914('0xb'),auth[_0x1914('0x8')](),controller['destroy']);module[_0x1914('0x11')]=router; \ No newline at end of file +var _0xbe38=['../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xbe38,0x1a4));var _0x8be3=function(_0x3b10df,_0x46d3ec){_0x3b10df=_0x3b10df-0x0;var _0x50501e=_0xbe38[_0x3b10df];return _0x50501e;};'use strict';var multer=require(_0x8be3('0x0'));var util=require('util');var path=require(_0x8be3('0x1'));var timeout=require(_0x8be3('0x2'));var express=require(_0x8be3('0x3'));var router=express[_0x8be3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8be3('0x5'));var config=require('../../config/environment');var controller=require(_0x8be3('0x6'));router[_0x8be3('0x7')]('/',auth[_0x8be3('0x8')](),controller[_0x8be3('0x9')]);router[_0x8be3('0x7')](_0x8be3('0xa'),auth[_0x8be3('0x8')](),controller[_0x8be3('0xb')]);router['get'](_0x8be3('0xc'),auth[_0x8be3('0x8')](),controller[_0x8be3('0xd')]);router['post']('/',auth[_0x8be3('0x8')](),controller[_0x8be3('0xe')]);router['put'](_0x8be3('0xa'),auth[_0x8be3('0x8')](),controller['update']);router['delete']('/:id',auth[_0x8be3('0x8')](),controller[_0x8be3('0xf')]);module[_0x8be3('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e43e7d4..4258aec 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 _0x4739=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x41fdcc,_0x586927){var _0x3de759=function(_0xd5d493){while(--_0xd5d493){_0x41fdcc['push'](_0x41fdcc['shift']());}};_0x3de759(++_0x586927);}(_0x4739,0x122));var _0x9473=function(_0x104157,_0x4170cb){_0x104157=_0x104157-0x0;var _0x5629f6=_0x4739[_0x104157];return _0x5629f6;};'use strict';var Sequelize=require(_0x9473('0x0'));module[_0x9473('0x1')]={'field':{'type':Sequelize[_0x9473('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9473('0x3')]},'groupBy':{'type':Sequelize[_0x9473('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9473('0x3')]},'custom':{'type':Sequelize[_0x9473('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2fd2=['BOOLEAN','exports','STRING'];(function(_0x5f35cf,_0x2cad3d){var _0x1fa6f7=function(_0x3509dc){while(--_0x3509dc){_0x5f35cf['push'](_0x5f35cf['shift']());}};_0x1fa6f7(++_0x2cad3d);}(_0x2fd2,0xa6));var _0x22fd=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2fd2[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x22fd('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x22fd('0x1')]},'function':{'type':Sequelize[_0x22fd('0x1')]},'format':{'type':Sequelize[_0x22fd('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x22fd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5ace8d5..c0e4270 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 _0x23db=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','AnalyticFieldReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','params','options','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs'];(function(_0x102ee4,_0x33bcd9){var _0x56576d=function(_0x40b19f){while(--_0x40b19f){_0x102ee4['push'](_0x102ee4['shift']());}};_0x56576d(++_0x33bcd9);}(_0x23db,0x141));var _0xb23d=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x23db[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0xb23d('0x0'));var emlformat=require(_0xb23d('0x1'));var rimraf=require(_0xb23d('0x2'));var zipdir=require(_0xb23d('0x3'));var jsonpatch=require(_0xb23d('0x4'));var rp=require(_0xb23d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb23d('0x6'));var util=require(_0xb23d('0x7'));var path=require('path');var sox=require(_0xb23d('0x8'));var csv=require(_0xb23d('0x9'));var ejs=require(_0xb23d('0xa'));var fs=require('fs');var _=require(_0xb23d('0xb'));var squel=require(_0xb23d('0xc'));var crypto=require(_0xb23d('0xd'));var jsforce=require(_0xb23d('0xe'));var deskjs=require(_0xb23d('0xf'));var toCsv=require(_0xb23d('0x9'));var querystring=require('querystring');var Papa=require(_0xb23d('0x10'));var Redis=require(_0xb23d('0x11'));var authService=require(_0xb23d('0x12'));var qs=require(_0xb23d('0x13'));var hardwareService=require(_0xb23d('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb23d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x606e6d,_0x1ac2b0){_0x1ac2b0=_0x1ac2b0||0xcc;return function(_0x191c69){if(_0x191c69){return _0x606e6d[_0xb23d('0x16')](_0x1ac2b0);}return _0x606e6d[_0xb23d('0x17')](_0x1ac2b0)[_0xb23d('0x18')]();};}function respondWithResult(_0x1fb5c4,_0x4ae4d2){_0x4ae4d2=_0x4ae4d2||0xc8;return function(_0x627cc1){if(_0x627cc1){return _0x1fb5c4[_0xb23d('0x17')](_0x4ae4d2)[_0xb23d('0x19')](_0x627cc1);}};}function respondWithFilteredResult(_0x199560,_0x3cb244){return function(_0x2f18b2){if(_0x2f18b2){var _0x57f725=_0x2f18b2[_0xb23d('0x1a')],_0x5a8364=_0x3cb244[_0xb23d('0x1b')],_0x2fba80=_0x3cb244[_0xb23d('0x1b')]+_0x3cb244[_0xb23d('0x1c')],_0x45f0d1;if(_0x2fba80>=_0x57f725){_0x2fba80=_0x57f725;_0x45f0d1=0xc8;}else{_0x45f0d1=0xce;}_0x199560['status'](_0x45f0d1);return _0x199560[_0xb23d('0x1d')](_0xb23d('0x1e'),_0x5a8364+'-'+_0x2fba80+'/'+_0x57f725)[_0xb23d('0x19')](_0x2f18b2);}return null;};}function patchUpdates(_0x2673d3){return function(_0x4e0c06){try{jsonpatch[_0xb23d('0x1f')](_0x4e0c06,_0x2673d3,!![]);}catch(_0x5baf53){return BPromise[_0xb23d('0x20')](_0x5baf53);}return _0x4e0c06[_0xb23d('0x21')]();};}function saveUpdates(_0x31694d,_0x1287e8){return function(_0x3cb3ee){if(_0x3cb3ee){return _0x3cb3ee[_0xb23d('0x22')](_0x31694d)[_0xb23d('0x23')](function(_0x4b7fea){return _0x4b7fea;});}return null;};}function removeEntity(_0x1a395c,_0x52e94d){return function(_0x5e8ff8){if(_0x5e8ff8){return _0x5e8ff8[_0xb23d('0x24')]()[_0xb23d('0x23')](function(){_0x1a395c[_0xb23d('0x17')](0xcc)[_0xb23d('0x18')]();});}};}function handleEntityNotFound(_0x9348e1,_0x117f4c){return function(_0x921fc){if(!_0x921fc){_0x9348e1[_0xb23d('0x16')](0x194);}return _0x921fc;};}function handleError(_0x3f0142,_0x20d4b8){_0x20d4b8=_0x20d4b8||0x1f4;return function(_0x32ef83){logger['error'](_0x32ef83[_0xb23d('0x25')]);if(_0x32ef83[_0xb23d('0x26')]){delete _0x32ef83[_0xb23d('0x26')];}_0x3f0142['status'](_0x20d4b8)['send'](_0x32ef83);};}exports[_0xb23d('0x27')]=function(_0x2e758e,_0xba0e97){var _0x33e7bc={},_0x4de438={},_0x2785f5={'count':0x0,'rows':[]};var _0x28bf09=db[_0xb23d('0x28')][_0xb23d('0x29')];_0x4de438[_0xb23d('0x2a')]=_[_0xb23d('0x2b')](_0x28bf09);_0x4de438[_0xb23d('0x2c')]=_[_0xb23d('0x2b')](_0x2e758e[_0xb23d('0x2c')]);_0x4de438[_0xb23d('0x2d')]=_[_0xb23d('0x2e')](_0x4de438[_0xb23d('0x2a')],_0x4de438[_0xb23d('0x2c')]);_0x33e7bc['attributes']=_['intersection'](_0x4de438['model'],qs[_0xb23d('0x2f')](_0x2e758e['query']['fields']));_0x33e7bc[_0xb23d('0x30')]=_0x33e7bc['attributes'][_0xb23d('0x31')]?_0x33e7bc[_0xb23d('0x30')]:_0x4de438[_0xb23d('0x2a')];if(!_0x2e758e[_0xb23d('0x2c')][_0xb23d('0x32')](_0xb23d('0x33'))){_0x33e7bc[_0xb23d('0x1c')]=qs[_0xb23d('0x1c')](_0x2e758e[_0xb23d('0x2c')][_0xb23d('0x1c')]);_0x33e7bc[_0xb23d('0x1b')]=qs[_0xb23d('0x1b')](_0x2e758e[_0xb23d('0x2c')][_0xb23d('0x1b')]);}_0x33e7bc[_0xb23d('0x34')]=qs[_0xb23d('0x35')](_0x2e758e['query'][_0xb23d('0x35')]);_0x33e7bc[_0xb23d('0x36')]=qs[_0xb23d('0x2d')](_[_0xb23d('0x37')](_0x2e758e[_0xb23d('0x2c')],_0x4de438[_0xb23d('0x2d')]));if(_0x2e758e[_0xb23d('0x2c')][_0xb23d('0x38')]){_0x33e7bc['where']=_[_0xb23d('0x39')](_0x33e7bc[_0xb23d('0x36')],{'$or':_[_0xb23d('0x3a')](_0x28bf09,function(_0x1658ef){if(_0x1658ef[_0xb23d('0x3b')][_0xb23d('0x3c')]!==_0xb23d('0x3d')){var _0x43821f={};_0x43821f[_0x1658ef[_0xb23d('0x3e')]]={'$like':'%'+_0x2e758e[_0xb23d('0x2c')][_0xb23d('0x38')]+'%'};return _0x43821f;}})});}_0x33e7bc=_[_0xb23d('0x39')]({},_0x33e7bc,_0x2e758e['options']);var _0x359a8e={'where':_0x33e7bc[_0xb23d('0x36')]};return db[_0xb23d('0x28')]['count'](_0x359a8e)[_0xb23d('0x23')](function(_0x42bfcd){_0x2785f5[_0xb23d('0x1a')]=_0x42bfcd;if(_0x2e758e[_0xb23d('0x2c')][_0xb23d('0x3f')]){_0x33e7bc[_0xb23d('0x40')]=[{'all':!![]}];}return db[_0xb23d('0x28')][_0xb23d('0x41')](_0x33e7bc);})[_0xb23d('0x23')](function(_0x5c653c){_0x2785f5[_0xb23d('0x42')]=_0x5c653c;return _0x2785f5;})[_0xb23d('0x23')](respondWithFilteredResult(_0xba0e97,_0x33e7bc))[_0xb23d('0x43')](handleError(_0xba0e97,null));};exports[_0xb23d('0x44')]=function(_0x4f74e8,_0x10c4fc){var _0x55fddd={'raw':![],'where':{'id':_0x4f74e8[_0xb23d('0x45')]['id']}},_0x4cf4fc={};_0x4cf4fc['model']=_[_0xb23d('0x2b')](db[_0xb23d('0x28')][_0xb23d('0x29')]);_0x4cf4fc[_0xb23d('0x2c')]=_['keys'](_0x4f74e8[_0xb23d('0x2c')]);_0x4cf4fc['filters']=_[_0xb23d('0x2e')](_0x4cf4fc['model'],_0x4cf4fc[_0xb23d('0x2c')]);_0x55fddd['attributes']=_['intersection'](_0x4cf4fc['model'],qs['fields'](_0x4f74e8[_0xb23d('0x2c')][_0xb23d('0x2f')]));_0x55fddd['attributes']=_0x55fddd[_0xb23d('0x30')][_0xb23d('0x31')]?_0x55fddd[_0xb23d('0x30')]:_0x4cf4fc[_0xb23d('0x2a')];if(_0x4f74e8['query']['includeAll']){_0x55fddd[_0xb23d('0x40')]=[{'all':!![]}];}_0x55fddd=_[_0xb23d('0x39')]({},_0x55fddd,_0x4f74e8[_0xb23d('0x46')]);return db[_0xb23d('0x28')]['find'](_0x55fddd)[_0xb23d('0x23')](handleEntityNotFound(_0x10c4fc,null))[_0xb23d('0x23')](respondWithResult(_0x10c4fc,null))[_0xb23d('0x43')](handleError(_0x10c4fc,null));};exports[_0xb23d('0x47')]=function(_0x4fff97,_0x101eb4){return db['AnalyticFieldReport'][_0xb23d('0x47')](_0x4fff97[_0xb23d('0x48')],{})[_0xb23d('0x23')](respondWithResult(_0x101eb4,0xc9))['catch'](handleError(_0x101eb4,null));};exports[_0xb23d('0x49')]=function(_0x589557,_0x45303e){return db['AnalyticFieldReport'][_0xb23d('0x49')](_0x589557[_0xb23d('0x48')],{'raw':![],'individualHooks':!![]})[_0xb23d('0x23')](respondWithResult(_0x45303e,0xc9))[_0xb23d('0x43')](handleError(_0x45303e,null));};exports[_0xb23d('0x22')]=function(_0x2382b5,_0xca0470){if(_0x2382b5[_0xb23d('0x48')]['id']){delete _0x2382b5[_0xb23d('0x48')]['id'];}return db['AnalyticFieldReport'][_0xb23d('0x4a')]({'where':{'id':_0x2382b5[_0xb23d('0x45')]['id']}})['then'](handleEntityNotFound(_0xca0470,null))[_0xb23d('0x23')](saveUpdates(_0x2382b5['body'],null))[_0xb23d('0x23')](respondWithResult(_0xca0470,null))[_0xb23d('0x43')](handleError(_0xca0470,null));};exports[_0xb23d('0x24')]=function(_0x4f0956,_0xc78b28){return db[_0xb23d('0x28')]['find']({'where':{'id':_0x4f0956[_0xb23d('0x45')]['id']}})[_0xb23d('0x23')](handleEntityNotFound(_0xc78b28,null))[_0xb23d('0x23')](removeEntity(_0xc78b28,null))[_0xb23d('0x43')](handleError(_0xc78b28,null));};exports[_0xb23d('0x4b')]=function(_0x1ff0aa,_0x12ef37){return db[_0xb23d('0x28')]['destroy']({'where':{'id':_0x1ff0aa['query'][_0xb23d('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x12ef37,0xcc))[_0xb23d('0x43')](handleError(_0x12ef37,null));};exports[_0xb23d('0x4d')]=function(_0x39a713,_0x594faa,_0x1c8e02){return db[_0xb23d('0x4e')][_0xb23d('0x4f')]({'where':{'id':_0x39a713['params']['id']}})[_0xb23d('0x23')](handleEntityNotFound(_0x594faa,null))['then'](function(_0x2d639a){if(_0x2d639a){return db[_0xb23d('0x50')][_0xb23d('0x51')](function(_0x2fc4d5){return db[_0xb23d('0x28')]['destroy']({'where':{'CustomReportId':_0x39a713[_0xb23d('0x45')]['id']},'transaction':_0x2fc4d5})['then'](function(_0x26f4a3){var _0x357925=_[_0xb23d('0x3a')](_0x39a713[_0xb23d('0x48')],function(_0x1f18bc){delete _0x1f18bc['id'];_0x1f18bc[_0xb23d('0x52')]=_0x39a713['params']['id'];return _0x1f18bc;});return db['AnalyticFieldReport']['bulkCreate'](_0x357925,{'transaction':_0x2fc4d5});});})[_0xb23d('0x23')](function(){return db[_0xb23d('0x28')][_0xb23d('0x41')]({'where':{'CustomReportId':_0x39a713['params']['id']}});});}})[_0xb23d('0x23')](respondWithResult(_0x594faa,null))[_0xb23d('0x43')](handleError(_0x594faa,null));}; \ No newline at end of file +var _0x2015=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','AnalyticFieldReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','catch','show','params','find','create','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','bulkCreate','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x3e7b8f,_0x132ade){var _0x1d2812=function(_0x116646){while(--_0x116646){_0x3e7b8f['push'](_0x3e7b8f['shift']());}};_0x1d2812(++_0x132ade);}(_0x2015,0x193));var _0x5201=function(_0x421e16,_0x426402){_0x421e16=_0x421e16-0x0;var _0x21dd8e=_0x2015[_0x421e16];return _0x21dd8e;};'use strict';var pdf=require(_0x5201('0x0'));var emlformat=require(_0x5201('0x1'));var rimraf=require(_0x5201('0x2'));var zipdir=require(_0x5201('0x3'));var jsonpatch=require(_0x5201('0x4'));var rp=require(_0x5201('0x5'));var moment=require(_0x5201('0x6'));var BPromise=require(_0x5201('0x7'));var Mustache=require('mustache');var util=require(_0x5201('0x8'));var path=require(_0x5201('0x9'));var sox=require(_0x5201('0xa'));var csv=require(_0x5201('0xb'));var ejs=require(_0x5201('0xc'));var fs=require('fs');var _=require(_0x5201('0xd'));var squel=require(_0x5201('0xe'));var crypto=require(_0x5201('0xf'));var jsforce=require(_0x5201('0x10'));var deskjs=require(_0x5201('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5201('0x12'));var Papa=require(_0x5201('0x13'));var Redis=require('ioredis');var authService=require(_0x5201('0x14'));var qs=require(_0x5201('0x15'));var hardwareService=require(_0x5201('0x16'));var logger=require('../../config/logger')(_0x5201('0x17'));var utils=require(_0x5201('0x18'));var config=require(_0x5201('0x19'));var db=require(_0x5201('0x1a'))['db'];function respondWithStatusCode(_0x2cfa0a,_0x26677a){_0x26677a=_0x26677a||0xcc;return function(_0x2038a9){if(_0x2038a9){return _0x2cfa0a[_0x5201('0x1b')](_0x26677a);}return _0x2cfa0a[_0x5201('0x1c')](_0x26677a)[_0x5201('0x1d')]();};}function respondWithResult(_0x341ea8,_0x6629bc){_0x6629bc=_0x6629bc||0xc8;return function(_0x491252){if(_0x491252){return _0x341ea8[_0x5201('0x1c')](_0x6629bc)[_0x5201('0x1e')](_0x491252);}};}function respondWithFilteredResult(_0x578325,_0x55562c){return function(_0x395a97){if(_0x395a97){var _0x364fb7=_0x395a97[_0x5201('0x1f')],_0x224f98=_0x55562c['offset'],_0x5b3184=_0x55562c[_0x5201('0x20')]+_0x55562c['limit'],_0x4c6d67;if(_0x5b3184>=_0x364fb7){_0x5b3184=_0x364fb7;_0x4c6d67=0xc8;}else{_0x4c6d67=0xce;}_0x578325[_0x5201('0x1c')](_0x4c6d67);return _0x578325['set'](_0x5201('0x21'),_0x224f98+'-'+_0x5b3184+'/'+_0x364fb7)[_0x5201('0x1e')](_0x395a97);}return null;};}function patchUpdates(_0x2c230a){return function(_0x23d13e){try{jsonpatch['apply'](_0x23d13e,_0x2c230a,!![]);}catch(_0x510942){return BPromise[_0x5201('0x22')](_0x510942);}return _0x23d13e[_0x5201('0x23')]();};}function saveUpdates(_0x468317,_0x54a901){return function(_0xd028ab){if(_0xd028ab){return _0xd028ab[_0x5201('0x24')](_0x468317)[_0x5201('0x25')](function(_0x446bee){return _0x446bee;});}return null;};}function removeEntity(_0xb6f07d,_0x51f0f4){return function(_0x15fade){if(_0x15fade){return _0x15fade[_0x5201('0x26')]()[_0x5201('0x25')](function(){_0xb6f07d[_0x5201('0x1c')](0xcc)[_0x5201('0x1d')]();});}};}function handleEntityNotFound(_0x6d5e04,_0x10e9c2){return function(_0x4d4142){if(!_0x4d4142){_0x6d5e04[_0x5201('0x1b')](0x194);}return _0x4d4142;};}function handleError(_0x428ce9,_0x338bf1){_0x338bf1=_0x338bf1||0x1f4;return function(_0x9c8dc5){logger[_0x5201('0x27')](_0x9c8dc5[_0x5201('0x28')]);if(_0x9c8dc5[_0x5201('0x29')]){delete _0x9c8dc5[_0x5201('0x29')];}_0x428ce9[_0x5201('0x1c')](_0x338bf1)[_0x5201('0x2a')](_0x9c8dc5);};}exports['index']=function(_0xff15b7,_0x14e5fc){var _0x48404e={},_0x4c82ff={},_0x5bc174={'count':0x0,'rows':[]};var _0x4edc6a=db[_0x5201('0x2b')][_0x5201('0x2c')];_0x4c82ff[_0x5201('0x2d')]=_['keys'](_0x4edc6a);_0x4c82ff['query']=_[_0x5201('0x2e')](_0xff15b7[_0x5201('0x2f')]);_0x4c82ff[_0x5201('0x30')]=_[_0x5201('0x31')](_0x4c82ff['model'],_0x4c82ff[_0x5201('0x2f')]);_0x48404e[_0x5201('0x32')]=_[_0x5201('0x31')](_0x4c82ff[_0x5201('0x2d')],qs[_0x5201('0x33')](_0xff15b7['query']['fields']));_0x48404e[_0x5201('0x32')]=_0x48404e[_0x5201('0x32')][_0x5201('0x34')]?_0x48404e[_0x5201('0x32')]:_0x4c82ff[_0x5201('0x2d')];if(!_0xff15b7[_0x5201('0x2f')][_0x5201('0x35')]('nolimit')){_0x48404e[_0x5201('0x36')]=qs[_0x5201('0x36')](_0xff15b7[_0x5201('0x2f')]['limit']);_0x48404e[_0x5201('0x20')]=qs[_0x5201('0x20')](_0xff15b7[_0x5201('0x2f')][_0x5201('0x20')]);}_0x48404e[_0x5201('0x37')]=qs[_0x5201('0x38')](_0xff15b7[_0x5201('0x2f')][_0x5201('0x38')]);_0x48404e[_0x5201('0x39')]=qs[_0x5201('0x30')](_[_0x5201('0x3a')](_0xff15b7[_0x5201('0x2f')],_0x4c82ff['filters']));if(_0xff15b7['query'][_0x5201('0x3b')]){_0x48404e[_0x5201('0x39')]=_[_0x5201('0x3c')](_0x48404e[_0x5201('0x39')],{'$or':_[_0x5201('0x3d')](_0x4edc6a,function(_0x1528b3){if(_0x1528b3[_0x5201('0x3e')]['key']!==_0x5201('0x3f')){var _0x111501={};_0x111501[_0x1528b3[_0x5201('0x40')]]={'$like':'%'+_0xff15b7['query'][_0x5201('0x3b')]+'%'};return _0x111501;}})});}_0x48404e=_[_0x5201('0x3c')]({},_0x48404e,_0xff15b7[_0x5201('0x41')]);var _0x5aba14={'where':_0x48404e[_0x5201('0x39')]};return db[_0x5201('0x2b')]['count'](_0x5aba14)['then'](function(_0x452717){_0x5bc174[_0x5201('0x1f')]=_0x452717;if(_0xff15b7[_0x5201('0x2f')][_0x5201('0x42')]){_0x48404e[_0x5201('0x43')]=[{'all':!![]}];}return db[_0x5201('0x2b')]['findAll'](_0x48404e);})[_0x5201('0x25')](function(_0x5989bc){_0x5bc174['rows']=_0x5989bc;return _0x5bc174;})[_0x5201('0x25')](respondWithFilteredResult(_0x14e5fc,_0x48404e))[_0x5201('0x44')](handleError(_0x14e5fc,null));};exports[_0x5201('0x45')]=function(_0x3e673f,_0x78c3d9){var _0x50a4ec={'raw':![],'where':{'id':_0x3e673f[_0x5201('0x46')]['id']}},_0x21d83a={};_0x21d83a[_0x5201('0x2d')]=_[_0x5201('0x2e')](db[_0x5201('0x2b')][_0x5201('0x2c')]);_0x21d83a[_0x5201('0x2f')]=_['keys'](_0x3e673f['query']);_0x21d83a[_0x5201('0x30')]=_[_0x5201('0x31')](_0x21d83a[_0x5201('0x2d')],_0x21d83a[_0x5201('0x2f')]);_0x50a4ec[_0x5201('0x32')]=_['intersection'](_0x21d83a['model'],qs[_0x5201('0x33')](_0x3e673f[_0x5201('0x2f')][_0x5201('0x33')]));_0x50a4ec[_0x5201('0x32')]=_0x50a4ec[_0x5201('0x32')][_0x5201('0x34')]?_0x50a4ec[_0x5201('0x32')]:_0x21d83a[_0x5201('0x2d')];if(_0x3e673f[_0x5201('0x2f')][_0x5201('0x42')]){_0x50a4ec[_0x5201('0x43')]=[{'all':!![]}];}_0x50a4ec=_['merge']({},_0x50a4ec,_0x3e673f['options']);return db[_0x5201('0x2b')][_0x5201('0x47')](_0x50a4ec)[_0x5201('0x25')](handleEntityNotFound(_0x78c3d9,null))[_0x5201('0x25')](respondWithResult(_0x78c3d9,null))[_0x5201('0x44')](handleError(_0x78c3d9,null));};exports['create']=function(_0x56c1b6,_0x2d0071){return db[_0x5201('0x2b')][_0x5201('0x48')](_0x56c1b6[_0x5201('0x49')],{})[_0x5201('0x25')](respondWithResult(_0x2d0071,0xc9))[_0x5201('0x44')](handleError(_0x2d0071,null));};exports['bulkCreate']=function(_0x5669f1,_0x5a3d95){return db[_0x5201('0x2b')]['bulkCreate'](_0x5669f1[_0x5201('0x49')],{'raw':![],'individualHooks':!![]})[_0x5201('0x25')](respondWithResult(_0x5a3d95,0xc9))[_0x5201('0x44')](handleError(_0x5a3d95,null));};exports[_0x5201('0x24')]=function(_0x304ad7,_0x57286a){if(_0x304ad7[_0x5201('0x49')]['id']){delete _0x304ad7[_0x5201('0x49')]['id'];}return db[_0x5201('0x2b')][_0x5201('0x47')]({'where':{'id':_0x304ad7[_0x5201('0x46')]['id']}})[_0x5201('0x25')](handleEntityNotFound(_0x57286a,null))[_0x5201('0x25')](saveUpdates(_0x304ad7[_0x5201('0x49')],null))[_0x5201('0x25')](respondWithResult(_0x57286a,null))[_0x5201('0x44')](handleError(_0x57286a,null));};exports['destroy']=function(_0x12bc51,_0x4f79b4){return db[_0x5201('0x2b')][_0x5201('0x47')]({'where':{'id':_0x12bc51['params']['id']}})[_0x5201('0x25')](handleEntityNotFound(_0x4f79b4,null))[_0x5201('0x25')](removeEntity(_0x4f79b4,null))['catch'](handleError(_0x4f79b4,null));};exports[_0x5201('0x4a')]=function(_0x50410f,_0xb926b3){return db[_0x5201('0x2b')][_0x5201('0x26')]({'where':{'id':_0x50410f[_0x5201('0x2f')][_0x5201('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xb926b3,0xcc))[_0x5201('0x44')](handleError(_0xb926b3,null));};exports[_0x5201('0x4c')]=function(_0x2788a8,_0x40e635,_0x257467){return db[_0x5201('0x4d')][_0x5201('0x4e')]({'where':{'id':_0x2788a8[_0x5201('0x46')]['id']}})[_0x5201('0x25')](handleEntityNotFound(_0x40e635,null))[_0x5201('0x25')](function(_0x43bf92){if(_0x43bf92){return db[_0x5201('0x4f')]['transaction'](function(_0x468c0d){return db[_0x5201('0x2b')][_0x5201('0x26')]({'where':{'CustomReportId':_0x2788a8[_0x5201('0x46')]['id']},'transaction':_0x468c0d})[_0x5201('0x25')](function(_0x19e1db){var _0x532be1=_[_0x5201('0x3d')](_0x2788a8[_0x5201('0x49')],function(_0x3887ee){delete _0x3887ee['id'];_0x3887ee[_0x5201('0x50')]=_0x2788a8[_0x5201('0x46')]['id'];return _0x3887ee;});return db[_0x5201('0x2b')][_0x5201('0x51')](_0x532be1,{'transaction':_0x468c0d});});})['then'](function(){return db['AnalyticFieldReport'][_0x5201('0x52')]({'where':{'CustomReportId':_0x2788a8[_0x5201('0x46')]['id']}});});}})[_0x5201('0x25')](respondWithResult(_0x40e635,null))[_0x5201('0x44')](handleError(_0x40e635,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 476182c..cb4cda1 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 _0xd7df=['analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','AnalyticFieldReport'];(function(_0x4cbe95,_0x2e1ccf){var _0x37ff90=function(_0x413bec){while(--_0x413bec){_0x4cbe95['push'](_0x4cbe95['shift']());}};_0x37ff90(++_0x2e1ccf);}(_0xd7df,0xe8));var _0xfd7d=function(_0x4d1c29,_0x41b1d2){_0x4d1c29=_0x4d1c29-0x0;var _0x3713e1=_0xd7df[_0x4d1c29];return _0x3713e1;};'use strict';var _=require(_0xfd7d('0x0'));var util=require(_0xfd7d('0x1'));var logger=require(_0xfd7d('0x2'))(_0xfd7d('0x3'));var moment=require(_0xfd7d('0x4'));var BPromise=require(_0xfd7d('0x5'));var rp=require(_0xfd7d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd7d('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xfd7d('0x8')]=function(_0x409b3f,_0x286688){return _0x409b3f['define'](_0xfd7d('0x9'),attributes,{'tableName':_0xfd7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8039=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x240676,_0x498ab2){var _0x53586e=function(_0x11f604){while(--_0x11f604){_0x240676['push'](_0x240676['shift']());}};_0x53586e(++_0x498ab2);}(_0x8039,0x150));var _0x9803=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x8039[_0x5ee3d3];return _0x4b272f;};'use strict';var _=require(_0x9803('0x0'));var util=require('util');var logger=require(_0x9803('0x1'))(_0x9803('0x2'));var moment=require('moment');var BPromise=require(_0x9803('0x3'));var rp=require(_0x9803('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9803('0x5'));var attributes=require(_0x9803('0x6'));module[_0x9803('0x7')]=function(_0x112abf,_0x31621d){return _0x112abf[_0x9803('0x8')](_0x9803('0x9'),attributes,{'tableName':_0x9803('0xa'),'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 e80e7de..6596275 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 _0xd072=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3360f3,_0x344f01){var _0x45e856=function(_0x588d0c){while(--_0x588d0c){_0x3360f3['push'](_0x3360f3['shift']());}};_0x45e856(++_0x344f01);}(_0xd072,0x132));var _0x2d07=function(_0x269e00,_0x585217){_0x269e00=_0x269e00-0x0;var _0x267562=_0xd072[_0x269e00];return _0x267562;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var moment=require(_0x2d07('0x2'));var BPromise=require(_0x2d07('0x3'));var rs=require(_0x2d07('0x4'));var fs=require('fs');var Redis=require(_0x2d07('0x5'));var db=require(_0x2d07('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d07('0x7'))(_0x2d07('0x8'));var config=require(_0x2d07('0x9'));var jayson=require(_0x2d07('0xa'));var client=jayson[_0x2d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a992a,_0x429d2c,_0x367834){return new BPromise(function(_0x19d04c,_0x167c61){return client[_0x2d07('0xc')](_0x1a992a,_0x367834)[_0x2d07('0xd')](function(_0x4bcba8){logger[_0x2d07('0xe')](_0x2d07('0xf'),_0x429d2c,_0x2d07('0x10'));logger[_0x2d07('0x11')](_0x2d07('0x12'),_0x429d2c,_0x2d07('0x10'),JSON[_0x2d07('0x13')](_0x4bcba8));if(_0x4bcba8[_0x2d07('0x14')]){if(_0x4bcba8[_0x2d07('0x14')][_0x2d07('0x15')]===0x1f4){logger[_0x2d07('0x14')](_0x2d07('0xf'),_0x429d2c,_0x4bcba8[_0x2d07('0x14')][_0x2d07('0x16')]);return _0x167c61(_0x4bcba8[_0x2d07('0x14')][_0x2d07('0x16')]);}logger[_0x2d07('0x14')](_0x2d07('0xf'),_0x429d2c,_0x4bcba8[_0x2d07('0x14')][_0x2d07('0x16')]);return _0x19d04c(_0x4bcba8[_0x2d07('0x14')][_0x2d07('0x16')]);}else{logger[_0x2d07('0xe')](_0x2d07('0xf'),_0x429d2c,_0x2d07('0x10'));_0x19d04c(_0x4bcba8['result'][_0x2d07('0x16')]);}})[_0x2d07('0x17')](function(_0x3d47e5){logger[_0x2d07('0x14')](_0x2d07('0xf'),_0x429d2c,_0x3d47e5);_0x167c61(_0x3d47e5);});});} \ No newline at end of file +var _0x3fa4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','randomstring'];(function(_0x598408,_0x5e6f74){var _0x560720=function(_0x56a96d){while(--_0x56a96d){_0x598408['push'](_0x598408['shift']());}};_0x560720(++_0x5e6f74);}(_0x3fa4,0xf0));var _0x43fa=function(_0x5a3826,_0x14ce75){_0x5a3826=_0x5a3826-0x0;var _0x1968f3=_0x3fa4[_0x5a3826];return _0x1968f3;};'use strict';var _=require(_0x43fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43fa('0x1'));var fs=require('fs');var Redis=require(_0x43fa('0x2'));var db=require(_0x43fa('0x3'))['db'];var utils=require(_0x43fa('0x4'));var logger=require(_0x43fa('0x5'))(_0x43fa('0x6'));var config=require(_0x43fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x43fa('0x8')][_0x43fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6df71c,_0x584209,_0x3dc891){return new BPromise(function(_0x46adc7,_0x1dc401){return client['request'](_0x6df71c,_0x3dc891)[_0x43fa('0xa')](function(_0x36d40d){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x584209,_0x43fa('0xb'));logger[_0x43fa('0xc')](_0x43fa('0xd'),_0x584209,_0x43fa('0xb'),JSON[_0x43fa('0xe')](_0x36d40d));if(_0x36d40d['error']){if(_0x36d40d[_0x43fa('0xf')][_0x43fa('0x10')]===0x1f4){logger[_0x43fa('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x584209,_0x36d40d[_0x43fa('0xf')][_0x43fa('0x11')]);return _0x1dc401(_0x36d40d[_0x43fa('0xf')]['message']);}logger[_0x43fa('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x584209,_0x36d40d['error']['message']);return _0x46adc7(_0x36d40d[_0x43fa('0xf')]['message']);}else{logger[_0x43fa('0x12')](_0x43fa('0x13'),_0x584209,'request\x20sent');_0x46adc7(_0x36d40d[_0x43fa('0x14')][_0x43fa('0x11')]);}})[_0x43fa('0x15')](function(_0x2439d4){logger[_0x43fa('0xf')](_0x43fa('0x13'),_0x584209,_0x2439d4);_0x1dc401(_0x2439d4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2400870..e34a3c2 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 _0xb49a=['post','/create_many','/:id/create_many','addFields','put','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create'];(function(_0x3a544a,_0x73a217){var _0x342f1e=function(_0x519dce){while(--_0x519dce){_0x3a544a['push'](_0x3a544a['shift']());}};_0x342f1e(++_0x73a217);}(_0xb49a,0xfb));var _0xab49=function(_0x7d78f,_0x22d980){_0x7d78f=_0x7d78f-0x0;var _0x1005c3=_0xb49a[_0x7d78f];return _0x1005c3;};'use strict';var multer=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var path=require(_0xab49('0x2'));var timeout=require(_0xab49('0x3'));var express=require(_0xab49('0x4'));var router=express['Router']();var auth=require(_0xab49('0x5'));var interaction=require(_0xab49('0x6'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xab49('0x7')]('/',auth[_0xab49('0x8')](),controller[_0xab49('0x9')]);router[_0xab49('0x7')](_0xab49('0xa'),auth[_0xab49('0x8')](),controller[_0xab49('0xb')]);router['post']('/',auth[_0xab49('0x8')](),controller[_0xab49('0xc')]);router[_0xab49('0xd')](_0xab49('0xe'),auth[_0xab49('0x8')](),controller['bulkCreate']);router['post'](_0xab49('0xf'),auth[_0xab49('0x8')](),controller[_0xab49('0x10')]);router[_0xab49('0x11')](_0xab49('0xa'),auth['isAuthenticated'](),controller[_0xab49('0x12')]);router[_0xab49('0x13')](_0xab49('0x14'),auth[_0xab49('0x8')](),controller[_0xab49('0x15')]);router[_0xab49('0x13')](_0xab49('0xa'),auth[_0xab49('0x8')](),controller[_0xab49('0x16')]);module[_0xab49('0x17')]=router; \ No newline at end of file +var _0xb7e7=['/create_many','bulkCreate','/:id/create_many','addFields','put','update','delete','/destroy_many','bulkDestroy','multer','path','express','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','/:id','isAuthenticated','post','create'];(function(_0x553a87,_0x1d621f){var _0x12d1e6=function(_0x41ae48){while(--_0x41ae48){_0x553a87['push'](_0x553a87['shift']());}};_0x12d1e6(++_0x1d621f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x9')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x9')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xf')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x10')]);router[_0x7b7e('0x11')](_0x7b7e('0x12'),auth['isAuthenticated'](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x11')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3ab7187..c8da4e6 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 _0x325d=['name','TEXT','sequelize','exports','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x325d,0x1ec));var _0xd325=function(_0x1a4ff5,_0x11c981){_0x1a4ff5=_0x1a4ff5-0x0;var _0x3abcb4=_0x325d[_0x1a4ff5];return _0x3abcb4;};'use strict';var Sequelize=require(_0xd325('0x0'));module[_0xd325('0x1')]={'name':{'type':Sequelize[_0xd325('0x2')],'allowNull':![],'unique':_0xd325('0x3')},'table':{'type':Sequelize[_0xd325('0x2')]},'metric':{'type':Sequelize[_0xd325('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfdb5=['STRING','TEXT','sequelize','exports'];(function(_0x2af9fc,_0x2c80f0){var _0x4bf1f9=function(_0x14f798){while(--_0x14f798){_0x2af9fc['push'](_0x2af9fc['shift']());}};_0x4bf1f9(++_0x2c80f0);}(_0xfdb5,0x146));var _0x5fdb=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xfdb5[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0x5fdb('0x0'));module[_0x5fdb('0x1')]={'name':{'type':Sequelize[_0x5fdb('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x5fdb('0x2')]},'metric':{'type':Sequelize[_0x5fdb('0x3')]},'description':{'type':Sequelize[_0x5fdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 159651d..2707a38 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 _0xf770=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','update','then','get','Metrics','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','AnalyticMetric','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','count','includeAll','include','findAll','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','desk.js'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0xf770,0x185));var _0x0f77=function(_0x3ad56d,_0x436c63){_0x3ad56d=_0x3ad56d-0x0;var _0x5d968d=_0xf770[_0x3ad56d];return _0x5d968d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f77('0x0'));var rimraf=require(_0x0f77('0x1'));var zipdir=require(_0x0f77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f77('0x3'));var BPromise=require(_0x0f77('0x4'));var Mustache=require(_0x0f77('0x5'));var util=require(_0x0f77('0x6'));var path=require(_0x0f77('0x7'));var sox=require(_0x0f77('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f77('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f77('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0f77('0xb'));var Papa=require(_0x0f77('0xc'));var Redis=require('ioredis');var authService=require(_0x0f77('0xd'));var qs=require(_0x0f77('0xe'));var hardwareService=require(_0x0f77('0xf'));var logger=require(_0x0f77('0x10'))('api');var utils=require(_0x0f77('0x11'));var config=require(_0x0f77('0x12'));var db=require(_0x0f77('0x13'))['db'];function respondWithStatusCode(_0x2b671d,_0x41ec52){_0x41ec52=_0x41ec52||0xcc;return function(_0x4c63b4){if(_0x4c63b4){return _0x2b671d['sendStatus'](_0x41ec52);}return _0x2b671d[_0x0f77('0x14')](_0x41ec52)[_0x0f77('0x15')]();};}function respondWithResult(_0x13ac75,_0x1f90c2){_0x1f90c2=_0x1f90c2||0xc8;return function(_0x3d4802){if(_0x3d4802){return _0x13ac75[_0x0f77('0x14')](_0x1f90c2)[_0x0f77('0x16')](_0x3d4802);}};}function respondWithFilteredResult(_0x45fea8,_0x44d01e){return function(_0x394648){if(_0x394648){var _0x23f2a4=_0x394648['count'],_0x1644ad=_0x44d01e[_0x0f77('0x17')],_0x23b06e=_0x44d01e[_0x0f77('0x17')]+_0x44d01e['limit'],_0x26e1fd;if(_0x23b06e>=_0x23f2a4){_0x23b06e=_0x23f2a4;_0x26e1fd=0xc8;}else{_0x26e1fd=0xce;}_0x45fea8['status'](_0x26e1fd);return _0x45fea8[_0x0f77('0x18')](_0x0f77('0x19'),_0x1644ad+'-'+_0x23b06e+'/'+_0x23f2a4)[_0x0f77('0x16')](_0x394648);}return null;};}function patchUpdates(_0x53f480){return function(_0x26f4ef){try{jsonpatch[_0x0f77('0x1a')](_0x26f4ef,_0x53f480,!![]);}catch(_0x4b204b){return BPromise['reject'](_0x4b204b);}return _0x26f4ef['save']();};}function saveUpdates(_0x21c02b,_0x16a111){return function(_0x129429){if(_0x129429){return _0x129429[_0x0f77('0x1b')](_0x21c02b)[_0x0f77('0x1c')](function(_0x503878){return _0x503878;});}return null;};}function removeEntity(_0x21ebc6,_0x453548){return function(_0x622a89){if(_0x622a89){return _0x622a89['destroy']()[_0x0f77('0x1c')](function(){var _0x595ddf=_0x622a89[_0x0f77('0x1d')]({'plain':!![]});var _0x1d7535=_0x0f77('0x1e');return db[_0x0f77('0x1f')][_0x0f77('0x20')]({'where':{'type':_0x1d7535,'resourceId':_0x595ddf['id']}})[_0x0f77('0x1c')](function(){return _0x622a89;});})['then'](function(){_0x21ebc6['status'](0xcc)[_0x0f77('0x15')]();});}};}function handleEntityNotFound(_0x16df4b,_0xc0f39c){return function(_0x42c404){if(!_0x42c404){_0x16df4b[_0x0f77('0x21')](0x194);}return _0x42c404;};}function handleError(_0x1c78f5,_0x321a8f){_0x321a8f=_0x321a8f||0x1f4;return function(_0x2c1c52){logger[_0x0f77('0x22')](_0x2c1c52[_0x0f77('0x23')]);if(_0x2c1c52[_0x0f77('0x24')]){delete _0x2c1c52[_0x0f77('0x24')];}_0x1c78f5['status'](_0x321a8f)[_0x0f77('0x25')](_0x2c1c52);};}exports[_0x0f77('0x26')]=function(_0x18fdd0,_0x1a1175){var _0x56d8f5={},_0x13b296={},_0x2b832a={'count':0x0,'rows':[]};var _0x1a0c63=db[_0x0f77('0x27')][_0x0f77('0x28')];_0x13b296[_0x0f77('0x29')]=_[_0x0f77('0x2a')](_0x1a0c63);_0x13b296[_0x0f77('0x2b')]=_[_0x0f77('0x2a')](_0x18fdd0[_0x0f77('0x2b')]);_0x13b296[_0x0f77('0x2c')]=_[_0x0f77('0x2d')](_0x13b296[_0x0f77('0x29')],_0x13b296[_0x0f77('0x2b')]);_0x56d8f5[_0x0f77('0x2e')]=_[_0x0f77('0x2d')](_0x13b296['model'],qs[_0x0f77('0x2f')](_0x18fdd0[_0x0f77('0x2b')]['fields']));_0x56d8f5[_0x0f77('0x2e')]=_0x56d8f5[_0x0f77('0x2e')][_0x0f77('0x30')]?_0x56d8f5[_0x0f77('0x2e')]:_0x13b296[_0x0f77('0x29')];if(!_0x18fdd0[_0x0f77('0x2b')][_0x0f77('0x31')](_0x0f77('0x32'))){_0x56d8f5[_0x0f77('0x33')]=qs[_0x0f77('0x33')](_0x18fdd0[_0x0f77('0x2b')]['limit']);_0x56d8f5[_0x0f77('0x17')]=qs['offset'](_0x18fdd0[_0x0f77('0x2b')]['offset']);}_0x56d8f5[_0x0f77('0x34')]=qs[_0x0f77('0x35')](_0x18fdd0[_0x0f77('0x2b')][_0x0f77('0x35')]);_0x56d8f5[_0x0f77('0x36')]=qs['filters'](_[_0x0f77('0x37')](_0x18fdd0[_0x0f77('0x2b')],_0x13b296[_0x0f77('0x2c')]));if(_0x18fdd0['query'][_0x0f77('0x38')]){_0x56d8f5[_0x0f77('0x36')]=_['merge'](_0x56d8f5['where'],{'$or':_[_0x0f77('0x39')](_0x1a0c63,function(_0x2ababa){if(_0x2ababa[_0x0f77('0x3a')][_0x0f77('0x3b')]!==_0x0f77('0x3c')){var _0x5611c6={};_0x5611c6[_0x2ababa[_0x0f77('0x3d')]]={'$like':'%'+_0x18fdd0[_0x0f77('0x2b')]['filter']+'%'};return _0x5611c6;}})});}_0x56d8f5=_[_0x0f77('0x3e')]({},_0x56d8f5,_0x18fdd0[_0x0f77('0x3f')]);var _0x2eadc9={'where':_0x56d8f5[_0x0f77('0x36')]};return db['AnalyticMetric'][_0x0f77('0x40')](_0x2eadc9)['then'](function(_0x3b5dea){_0x2b832a['count']=_0x3b5dea;if(_0x18fdd0['query'][_0x0f77('0x41')]){_0x56d8f5[_0x0f77('0x42')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x0f77('0x43')](_0x56d8f5);})['then'](function(_0x57eaf1){_0x2b832a['rows']=_0x57eaf1;return _0x2b832a;})[_0x0f77('0x1c')](respondWithFilteredResult(_0x1a1175,_0x56d8f5))[_0x0f77('0x44')](handleError(_0x1a1175,null));};exports['show']=function(_0x4d0ab0,_0x15b9da){var _0x360d03={'raw':!![],'where':{'id':_0x4d0ab0[_0x0f77('0x45')]['id']}},_0x5a7096={};_0x5a7096[_0x0f77('0x29')]=_[_0x0f77('0x2a')](db[_0x0f77('0x27')][_0x0f77('0x28')]);_0x5a7096[_0x0f77('0x2b')]=_[_0x0f77('0x2a')](_0x4d0ab0[_0x0f77('0x2b')]);_0x5a7096[_0x0f77('0x2c')]=_[_0x0f77('0x2d')](_0x5a7096[_0x0f77('0x29')],_0x5a7096[_0x0f77('0x2b')]);_0x360d03[_0x0f77('0x2e')]=_['intersection'](_0x5a7096['model'],qs[_0x0f77('0x2f')](_0x4d0ab0[_0x0f77('0x2b')][_0x0f77('0x2f')]));_0x360d03[_0x0f77('0x2e')]=_0x360d03[_0x0f77('0x2e')][_0x0f77('0x30')]?_0x360d03['attributes']:_0x5a7096[_0x0f77('0x29')];if(_0x4d0ab0[_0x0f77('0x2b')][_0x0f77('0x41')]){_0x360d03[_0x0f77('0x42')]=[{'all':!![]}];}_0x360d03=_[_0x0f77('0x3e')]({},_0x360d03,_0x4d0ab0[_0x0f77('0x3f')]);return db['AnalyticMetric'][_0x0f77('0x46')](_0x360d03)[_0x0f77('0x1c')](handleEntityNotFound(_0x15b9da,null))[_0x0f77('0x1c')](respondWithResult(_0x15b9da,null))[_0x0f77('0x44')](handleError(_0x15b9da,null));};exports['create']=function(_0x5cbd6f,_0x5a8094){return db[_0x0f77('0x27')]['create'](_0x5cbd6f[_0x0f77('0x47')],{})[_0x0f77('0x1c')](function(_0x2a74d6){var _0x178200=_0x5cbd6f[_0x0f77('0x48')][_0x0f77('0x1d')]({'plain':!![]});if(!_0x178200)throw new Error(_0x0f77('0x49'));if(_0x178200[_0x0f77('0x4a')]==='user'){var _0xe8a3da=_0x2a74d6['get']({'plain':!![]});var _0x51f8e4=_0x0f77('0x1e');return db[_0x0f77('0x4b')][_0x0f77('0x46')]({'where':{'name':_0x51f8e4,'userProfileId':_0x178200[_0x0f77('0x4c')]},'raw':!![]})[_0x0f77('0x1c')](function(_0x1238a5){if(_0x1238a5&&_0x1238a5[_0x0f77('0x4d')]===0x0){return db[_0x0f77('0x1f')][_0x0f77('0x4e')]({'name':_0xe8a3da[_0x0f77('0x24')],'resourceId':_0xe8a3da['id'],'type':_0x1238a5['name'],'sectionId':_0x1238a5['id']},{})[_0x0f77('0x1c')](function(){return _0x2a74d6;});}else{return _0x2a74d6;}})[_0x0f77('0x44')](function(_0x343bc4){logger[_0x0f77('0x22')](_0x0f77('0x4f'),_0x343bc4);throw _0x343bc4;});}return _0x2a74d6;})[_0x0f77('0x1c')](respondWithResult(_0x5a8094,0xc9))[_0x0f77('0x44')](handleError(_0x5a8094,null));};exports['update']=function(_0x43fca5,_0x3cfe36){if(_0x43fca5['body']['id']){delete _0x43fca5[_0x0f77('0x47')]['id'];}return db[_0x0f77('0x27')]['find']({'where':{'id':_0x43fca5[_0x0f77('0x45')]['id']}})[_0x0f77('0x1c')](handleEntityNotFound(_0x3cfe36,null))[_0x0f77('0x1c')](saveUpdates(_0x43fca5[_0x0f77('0x47')],null))[_0x0f77('0x1c')](respondWithResult(_0x3cfe36,null))[_0x0f77('0x44')](handleError(_0x3cfe36,null));};exports[_0x0f77('0x20')]=function(_0x213cfc,_0x1dd886){return db[_0x0f77('0x27')]['find']({'where':{'id':_0x213cfc[_0x0f77('0x45')]['id']}})[_0x0f77('0x1c')](handleEntityNotFound(_0x1dd886,null))[_0x0f77('0x1c')](removeEntity(_0x1dd886,null))[_0x0f77('0x44')](handleError(_0x1dd886,null));}; \ No newline at end of file +var _0x25f6=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','set','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticMetric','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Metrics','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto'];(function(_0x5da230,_0x574a8e){var _0x2a4b26=function(_0x384a1f){while(--_0x384a1f){_0x5da230['push'](_0x5da230['shift']());}};_0x2a4b26(++_0x574a8e);}(_0x25f6,0x1e9));var _0x625f=function(_0x5876fc,_0x431a54){_0x5876fc=_0x5876fc-0x0;var _0x279a56=_0x25f6[_0x5876fc];return _0x279a56;};'use strict';var pdf=require(_0x625f('0x0'));var emlformat=require(_0x625f('0x1'));var rimraf=require(_0x625f('0x2'));var zipdir=require(_0x625f('0x3'));var jsonpatch=require(_0x625f('0x4'));var rp=require(_0x625f('0x5'));var moment=require(_0x625f('0x6'));var BPromise=require(_0x625f('0x7'));var Mustache=require(_0x625f('0x8'));var util=require(_0x625f('0x9'));var path=require(_0x625f('0xa'));var sox=require(_0x625f('0xb'));var csv=require(_0x625f('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x625f('0xd'));var squel=require('squel');var crypto=require(_0x625f('0xe'));var jsforce=require(_0x625f('0xf'));var deskjs=require(_0x625f('0x10'));var toCsv=require(_0x625f('0xc'));var querystring=require('querystring');var Papa=require(_0x625f('0x11'));var Redis=require(_0x625f('0x12'));var authService=require(_0x625f('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x625f('0x14'));var logger=require(_0x625f('0x15'))(_0x625f('0x16'));var utils=require('../../config/utils');var config=require(_0x625f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x130cfe,_0x454de3){_0x454de3=_0x454de3||0xcc;return function(_0x28a989){if(_0x28a989){return _0x130cfe[_0x625f('0x18')](_0x454de3);}return _0x130cfe[_0x625f('0x19')](_0x454de3)[_0x625f('0x1a')]();};}function respondWithResult(_0x49e986,_0x5e8efe){_0x5e8efe=_0x5e8efe||0xc8;return function(_0x269b10){if(_0x269b10){return _0x49e986[_0x625f('0x19')](_0x5e8efe)['json'](_0x269b10);}};}function respondWithFilteredResult(_0x25a42b,_0x43bd5b){return function(_0x147d6b){if(_0x147d6b){var _0x42654d=_0x147d6b[_0x625f('0x1b')],_0x463c19=_0x43bd5b[_0x625f('0x1c')],_0x5ea45d=_0x43bd5b['offset']+_0x43bd5b['limit'],_0x59539d;if(_0x5ea45d>=_0x42654d){_0x5ea45d=_0x42654d;_0x59539d=0xc8;}else{_0x59539d=0xce;}_0x25a42b[_0x625f('0x19')](_0x59539d);return _0x25a42b[_0x625f('0x1d')]('Content-Range',_0x463c19+'-'+_0x5ea45d+'/'+_0x42654d)[_0x625f('0x1e')](_0x147d6b);}return null;};}function patchUpdates(_0x1ecaf3){return function(_0x5c7b9f){try{jsonpatch[_0x625f('0x1f')](_0x5c7b9f,_0x1ecaf3,!![]);}catch(_0x490d1d){return BPromise[_0x625f('0x20')](_0x490d1d);}return _0x5c7b9f[_0x625f('0x21')]();};}function saveUpdates(_0x1cc344,_0x40ac04){return function(_0x4e1d4d){if(_0x4e1d4d){return _0x4e1d4d['update'](_0x1cc344)[_0x625f('0x22')](function(_0x563d1d){return _0x563d1d;});}return null;};}function removeEntity(_0xdc7a73,_0x5a00a1){return function(_0x1b5a52){if(_0x1b5a52){return _0x1b5a52[_0x625f('0x23')]()[_0x625f('0x22')](function(){var _0x1ee29b=_0x1b5a52[_0x625f('0x24')]({'plain':!![]});var _0x218e03='Metrics';return db[_0x625f('0x25')][_0x625f('0x23')]({'where':{'type':_0x218e03,'resourceId':_0x1ee29b['id']}})[_0x625f('0x22')](function(){return _0x1b5a52;});})[_0x625f('0x22')](function(){_0xdc7a73[_0x625f('0x19')](0xcc)[_0x625f('0x1a')]();});}};}function handleEntityNotFound(_0x1bc442,_0x2b6f5e){return function(_0x59352f){if(!_0x59352f){_0x1bc442['sendStatus'](0x194);}return _0x59352f;};}function handleError(_0x15b88f,_0x33287d){_0x33287d=_0x33287d||0x1f4;return function(_0x5cd33f){logger[_0x625f('0x26')](_0x5cd33f[_0x625f('0x27')]);if(_0x5cd33f[_0x625f('0x28')]){delete _0x5cd33f[_0x625f('0x28')];}_0x15b88f[_0x625f('0x19')](_0x33287d)[_0x625f('0x29')](_0x5cd33f);};}exports[_0x625f('0x2a')]=function(_0x225d0e,_0x355560){var _0xf4f21e={},_0x3ab8b6={},_0x12f5e2={'count':0x0,'rows':[]};var _0x254266=db[_0x625f('0x2b')][_0x625f('0x2c')];_0x3ab8b6[_0x625f('0x2d')]=_[_0x625f('0x2e')](_0x254266);_0x3ab8b6[_0x625f('0x2f')]=_[_0x625f('0x2e')](_0x225d0e['query']);_0x3ab8b6[_0x625f('0x30')]=_[_0x625f('0x31')](_0x3ab8b6['model'],_0x3ab8b6[_0x625f('0x2f')]);_0xf4f21e[_0x625f('0x32')]=_['intersection'](_0x3ab8b6['model'],qs[_0x625f('0x33')](_0x225d0e[_0x625f('0x2f')][_0x625f('0x33')]));_0xf4f21e[_0x625f('0x32')]=_0xf4f21e[_0x625f('0x32')][_0x625f('0x34')]?_0xf4f21e[_0x625f('0x32')]:_0x3ab8b6[_0x625f('0x2d')];if(!_0x225d0e['query'][_0x625f('0x35')](_0x625f('0x36'))){_0xf4f21e[_0x625f('0x37')]=qs[_0x625f('0x37')](_0x225d0e[_0x625f('0x2f')][_0x625f('0x37')]);_0xf4f21e['offset']=qs[_0x625f('0x1c')](_0x225d0e[_0x625f('0x2f')][_0x625f('0x1c')]);}_0xf4f21e[_0x625f('0x38')]=qs['sort'](_0x225d0e[_0x625f('0x2f')][_0x625f('0x39')]);_0xf4f21e['where']=qs[_0x625f('0x30')](_['pick'](_0x225d0e['query'],_0x3ab8b6[_0x625f('0x30')]));if(_0x225d0e[_0x625f('0x2f')]['filter']){_0xf4f21e[_0x625f('0x3a')]=_[_0x625f('0x3b')](_0xf4f21e[_0x625f('0x3a')],{'$or':_[_0x625f('0x3c')](_0x254266,function(_0x25ed1f){if(_0x25ed1f[_0x625f('0x3d')][_0x625f('0x3e')]!==_0x625f('0x3f')){var _0x121be9={};_0x121be9[_0x25ed1f[_0x625f('0x40')]]={'$like':'%'+_0x225d0e[_0x625f('0x2f')][_0x625f('0x41')]+'%'};return _0x121be9;}})});}_0xf4f21e=_[_0x625f('0x3b')]({},_0xf4f21e,_0x225d0e[_0x625f('0x42')]);var _0x2205d9={'where':_0xf4f21e[_0x625f('0x3a')]};return db[_0x625f('0x2b')][_0x625f('0x1b')](_0x2205d9)['then'](function(_0x2a9169){_0x12f5e2[_0x625f('0x1b')]=_0x2a9169;if(_0x225d0e[_0x625f('0x2f')][_0x625f('0x43')]){_0xf4f21e[_0x625f('0x44')]=[{'all':!![]}];}return db[_0x625f('0x2b')][_0x625f('0x45')](_0xf4f21e);})[_0x625f('0x22')](function(_0x465504){_0x12f5e2[_0x625f('0x46')]=_0x465504;return _0x12f5e2;})[_0x625f('0x22')](respondWithFilteredResult(_0x355560,_0xf4f21e))[_0x625f('0x47')](handleError(_0x355560,null));};exports[_0x625f('0x48')]=function(_0x40cd03,_0x15d075){var _0x139105={'raw':!![],'where':{'id':_0x40cd03[_0x625f('0x49')]['id']}},_0x212894={};_0x212894[_0x625f('0x2d')]=_[_0x625f('0x2e')](db[_0x625f('0x2b')][_0x625f('0x2c')]);_0x212894[_0x625f('0x2f')]=_[_0x625f('0x2e')](_0x40cd03[_0x625f('0x2f')]);_0x212894[_0x625f('0x30')]=_[_0x625f('0x31')](_0x212894[_0x625f('0x2d')],_0x212894[_0x625f('0x2f')]);_0x139105[_0x625f('0x32')]=_[_0x625f('0x31')](_0x212894[_0x625f('0x2d')],qs[_0x625f('0x33')](_0x40cd03[_0x625f('0x2f')][_0x625f('0x33')]));_0x139105[_0x625f('0x32')]=_0x139105[_0x625f('0x32')]['length']?_0x139105['attributes']:_0x212894[_0x625f('0x2d')];if(_0x40cd03[_0x625f('0x2f')]['includeAll']){_0x139105['include']=[{'all':!![]}];}_0x139105=_[_0x625f('0x3b')]({},_0x139105,_0x40cd03[_0x625f('0x42')]);return db[_0x625f('0x2b')][_0x625f('0x4a')](_0x139105)[_0x625f('0x22')](handleEntityNotFound(_0x15d075,null))['then'](respondWithResult(_0x15d075,null))['catch'](handleError(_0x15d075,null));};exports[_0x625f('0x4b')]=function(_0x492e94,_0x41f704){return db['AnalyticMetric']['create'](_0x492e94[_0x625f('0x4c')],{})[_0x625f('0x22')](function(_0x5ed736){var _0x5d7c30=_0x492e94['user'][_0x625f('0x24')]({'plain':!![]});if(!_0x5d7c30)throw new Error(_0x625f('0x4d'));if(_0x5d7c30['role']===_0x625f('0x4e')){var _0x3b461c=_0x5ed736[_0x625f('0x24')]({'plain':!![]});var _0x25e2df=_0x625f('0x4f');return db[_0x625f('0x50')][_0x625f('0x4a')]({'where':{'name':_0x25e2df,'userProfileId':_0x5d7c30[_0x625f('0x51')]},'raw':!![]})[_0x625f('0x22')](function(_0x208151){if(_0x208151&&_0x208151[_0x625f('0x52')]===0x0){return db[_0x625f('0x25')][_0x625f('0x4b')]({'name':_0x3b461c[_0x625f('0x28')],'resourceId':_0x3b461c['id'],'type':_0x208151[_0x625f('0x28')],'sectionId':_0x208151['id']},{})['then'](function(){return _0x5ed736;});}else{return _0x5ed736;}})[_0x625f('0x47')](function(_0x3d30d8){logger[_0x625f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d30d8);throw _0x3d30d8;});}return _0x5ed736;})[_0x625f('0x22')](respondWithResult(_0x41f704,0xc9))[_0x625f('0x47')](handleError(_0x41f704,null));};exports[_0x625f('0x53')]=function(_0x3e224f,_0x425348){if(_0x3e224f['body']['id']){delete _0x3e224f[_0x625f('0x4c')]['id'];}return db[_0x625f('0x2b')][_0x625f('0x4a')]({'where':{'id':_0x3e224f[_0x625f('0x49')]['id']}})['then'](handleEntityNotFound(_0x425348,null))[_0x625f('0x22')](saveUpdates(_0x3e224f['body'],null))[_0x625f('0x22')](respondWithResult(_0x425348,null))['catch'](handleError(_0x425348,null));};exports['destroy']=function(_0x596d37,_0x12e1a6){return db[_0x625f('0x2b')][_0x625f('0x4a')]({'where':{'id':_0x596d37[_0x625f('0x49')]['id']}})[_0x625f('0x22')](handleEntityNotFound(_0x12e1a6,null))[_0x625f('0x22')](removeEntity(_0x12e1a6,null))[_0x625f('0x47')](handleError(_0x12e1a6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d2ee0cd..dd55287 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 _0x45fc=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird'];(function(_0xec0695,_0x2e8960){var _0x5f33d1=function(_0x26f9e1){while(--_0x26f9e1){_0xec0695['push'](_0xec0695['shift']());}};_0x5f33d1(++_0x2e8960);}(_0x45fc,0x16f));var _0xc45f=function(_0x20a91e,_0x13ca94){_0x20a91e=_0x20a91e-0x0;var _0x2ec6a9=_0x45fc[_0x20a91e];return _0x2ec6a9;};'use strict';var _=require(_0xc45f('0x0'));var util=require(_0xc45f('0x1'));var logger=require(_0xc45f('0x2'))(_0xc45f('0x3'));var moment=require('moment');var BPromise=require(_0xc45f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc45f('0x5'));var config=require(_0xc45f('0x6'));var attributes=require(_0xc45f('0x7'));module[_0xc45f('0x8')]=function(_0x5e072d,_0x2bb3b4){return _0x5e072d[_0xc45f('0x9')](_0xc45f('0xa'),attributes,{'tableName':_0xc45f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8124=['analytics_metrics','lodash','util','api','moment','bluebird','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x70bb8,_0x1da278){var _0x48ba84=function(_0xb567b9){while(--_0xb567b9){_0x70bb8['push'](_0x70bb8['shift']());}};_0x48ba84(++_0x1da278);}(_0x8124,0x79));var _0x4812=function(_0x2aaba4,_0x55b81c){_0x2aaba4=_0x2aaba4-0x0;var _0x263e18=_0x8124[_0x2aaba4];return _0x263e18;};'use strict';var _=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var logger=require('../../config/logger')(_0x4812('0x2'));var moment=require(_0x4812('0x3'));var BPromise=require(_0x4812('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4812('0x5'));var rimraf=require('rimraf');var config=require(_0x4812('0x6'));var attributes=require(_0x4812('0x7'));module[_0x4812('0x8')]=function(_0x2cc296,_0x233b94){return _0x2cc296[_0x4812('0x9')](_0x4812('0xa'),attributes,{'tableName':_0x4812('0xb'),'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 ea3e485..aef6c86 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 _0x67a2=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x67a2,0xd3));var _0x267a=function(_0x16b6e8,_0x5d6d63){_0x16b6e8=_0x16b6e8-0x0;var _0x2808f9=_0x67a2[_0x16b6e8];return _0x2808f9;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var moment=require('moment');var BPromise=require(_0x267a('0x2'));var rs=require(_0x267a('0x3'));var fs=require('fs');var Redis=require(_0x267a('0x4'));var db=require(_0x267a('0x5'))['db'];var utils=require(_0x267a('0x6'));var logger=require(_0x267a('0x7'))(_0x267a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x267a('0x9')][_0x267a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39d281,_0x4aac51,_0x1ac13e){return new BPromise(function(_0x4f1728,_0xe9ea73){return client[_0x267a('0xb')](_0x39d281,_0x1ac13e)[_0x267a('0xc')](function(_0x95a54e){logger[_0x267a('0xd')](_0x267a('0xe'),_0x4aac51,_0x267a('0xf'));logger['debug'](_0x267a('0x10'),_0x4aac51,_0x267a('0xf'),JSON[_0x267a('0x11')](_0x95a54e));if(_0x95a54e[_0x267a('0x12')]){if(_0x95a54e[_0x267a('0x12')][_0x267a('0x13')]===0x1f4){logger[_0x267a('0x12')](_0x267a('0xe'),_0x4aac51,_0x95a54e[_0x267a('0x12')][_0x267a('0x14')]);return _0xe9ea73(_0x95a54e[_0x267a('0x12')]['message']);}logger[_0x267a('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x4aac51,_0x95a54e[_0x267a('0x12')][_0x267a('0x14')]);return _0x4f1728(_0x95a54e[_0x267a('0x12')]['message']);}else{logger['info'](_0x267a('0xe'),_0x4aac51,_0x267a('0xf'));_0x4f1728(_0x95a54e[_0x267a('0x15')]['message']);}})[_0x267a('0x16')](function(_0x168d29){logger[_0x267a('0x12')](_0x267a('0xe'),_0x4aac51,_0x168d29);_0xe9ea73(_0x168d29);});});} \ No newline at end of file +var _0x05b0=['client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05b0,0x188));var _0x005b=function(_0x1b81ff,_0x3f0979){_0x1b81ff=_0x1b81ff-0x0;var _0x2c3cb7=_0x05b0[_0x1b81ff];return _0x2c3cb7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x98e71c,_0x224c8d,_0x35998d){return new BPromise(function(_0x263bc9,_0x5cff7f){return client[_0x005b('0x9')](_0x98e71c,_0x35998d)[_0x005b('0xa')](function(_0x4c5552){logger['info'](_0x005b('0xb'),_0x224c8d,'request\x20sent');logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x224c8d,_0x005b('0xc'),JSON[_0x005b('0xd')](_0x4c5552));if(_0x4c5552['error']){if(_0x4c5552[_0x005b('0xe')][_0x005b('0xf')]===0x1f4){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0x4c5552[_0x005b('0xe')][_0x005b('0x10')]);return _0x5cff7f(_0x4c5552[_0x005b('0xe')]['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x224c8d,_0x4c5552[_0x005b('0xe')]['message']);return _0x263bc9(_0x4c5552[_0x005b('0xe')]['message']);}else{logger[_0x005b('0x11')](_0x005b('0xb'),_0x224c8d,_0x005b('0xc'));_0x263bc9(_0x4c5552[_0x005b('0x12')][_0x005b('0x10')]);}})['catch'](function(_0xa3c3fb){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0xa3c3fb);_0x5cff7f(_0xa3c3fb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index be14eae..bcff96c 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 _0x627e=['show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x5d93ad,_0x2d588f){var _0x3c94c2=function(_0x2c5845){while(--_0x2c5845){_0x5d93ad['push'](_0x5d93ad['shift']());}};_0x3c94c2(++_0x2d588f);}(_0x627e,0x14a));var _0xe627=function(_0x3b47d6,_0x1800ae){_0x3b47d6=_0x3b47d6-0x0;var _0x5da6d6=_0x627e[_0x3b47d6];return _0x5da6d6;};'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('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe627('0x8')]);router[_0xe627('0x9')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller[_0xe627('0xc')]);router[_0xe627('0xd')]('/',auth['isAuthenticated'](),controller[_0xe627('0xe')]);router['put']('/:id',auth[_0xe627('0xb')](),controller[_0xe627('0xf')]);router['delete']('/:id',auth[_0xe627('0xb')](),controller[_0xe627('0x10')]);module[_0xe627('0x11')]=router; \ No newline at end of file +var _0x160f=['get','index','show','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x4059cf,_0x46458e){var _0x181ef1=function(_0x10a1bc){while(--_0x10a1bc){_0x4059cf['push'](_0x4059cf['shift']());}};_0x181ef1(++_0x46458e);}(_0x160f,0x1ef));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(_0xf160('0x2'));var timeout=require(_0xf160('0x3'));var express=require('express');var router=express[_0xf160('0x4')]();var auth=require(_0xf160('0x5'));var interaction=require(_0xf160('0x6'));var config=require(_0xf160('0x7'));var controller=require(_0xf160('0x8'));router[_0xf160('0x9')]('/',auth['isAuthenticated'](),controller[_0xf160('0xa')]);router[_0xf160('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf160('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf160('0xc')](_0xf160('0xd'),auth[_0xf160('0xe')](),controller[_0xf160('0xf')]);router['delete']('/:id',auth[_0xf160('0xe')](),controller[_0xf160('0x10')]);module[_0xf160('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f7edc0e..d6b4847 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6485=['TEXT','sequelize','exports'];(function(_0x5179b3,_0xef7d76){var _0x1fc699=function(_0x44ce84){while(--_0x44ce84){_0x5179b3['push'](_0x5179b3['shift']());}};_0x1fc699(++_0xef7d76);}(_0x6485,0xc4));var _0x5648=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6485[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5648('0x0'));module[_0x5648('0x1')]={'tree':{'type':Sequelize[_0x5648('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5ab3=['sequelize'];(function(_0x37c942,_0x12f39b){var _0x17185c=function(_0x2b925a){while(--_0x2b925a){_0x37c942['push'](_0x37c942['shift']());}};_0x17185c(++_0x12f39b);}(_0x5ab3,0x16f));var _0x35ab=function(_0x26f03e,_0x2d3ae4){_0x26f03e=_0x26f03e-0x0;var _0x32394a=_0x5ab3[_0x26f03e];return _0x32394a;};'use strict';var Sequelize=require(_0x35ab('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 418ad67..a1602ad 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 _0x10f7=['desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','AnalyticTreeReport','rawAttributes','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','map','type','key','field','findAll','catch','params','options','find','create','body','html-pdf','rimraf','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','jsforce'];(function(_0x29a0fa,_0x596f76){var _0x2249e1=function(_0x1f216f){while(--_0x1f216f){_0x29a0fa['push'](_0x29a0fa['shift']());}};_0x2249e1(++_0x596f76);}(_0x10f7,0xb8));var _0x710f=function(_0x5d375e,_0x13066f){_0x5d375e=_0x5d375e-0x0;var _0x564ce4=_0x10f7[_0x5d375e];return _0x564ce4;};'use strict';var pdf=require(_0x710f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x710f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x710f('0x2'));var rp=require('request-promise');var moment=require(_0x710f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x710f('0x4'));var path=require(_0x710f('0x5'));var sox=require('sox');var csv=require(_0x710f('0x6'));var ejs=require(_0x710f('0x7'));var fs=require('fs');var _=require(_0x710f('0x8'));var squel=require(_0x710f('0x9'));var crypto=require('crypto');var jsforce=require(_0x710f('0xa'));var deskjs=require(_0x710f('0xb'));var toCsv=require(_0x710f('0x6'));var querystring=require(_0x710f('0xc'));var Papa=require('papaparse');var Redis=require(_0x710f('0xd'));var authService=require(_0x710f('0xe'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x710f('0xf'));var logger=require(_0x710f('0x10'))(_0x710f('0x11'));var utils=require(_0x710f('0x12'));var config=require(_0x710f('0x13'));var db=require(_0x710f('0x14'))['db'];function respondWithStatusCode(_0x5ac1a5,_0x38e7b2){_0x38e7b2=_0x38e7b2||0xcc;return function(_0x51199d){if(_0x51199d){return _0x5ac1a5['sendStatus'](_0x38e7b2);}return _0x5ac1a5[_0x710f('0x15')](_0x38e7b2)[_0x710f('0x16')]();};}function respondWithResult(_0x534bfa,_0x315cb2){_0x315cb2=_0x315cb2||0xc8;return function(_0x39677d){if(_0x39677d){return _0x534bfa[_0x710f('0x15')](_0x315cb2)[_0x710f('0x17')](_0x39677d);}};}function respondWithFilteredResult(_0x2c6e86,_0x22ed69){return function(_0x37d219){if(_0x37d219){var _0x17d7c3=_0x37d219[_0x710f('0x18')],_0xcade19=_0x22ed69['offset'],_0x103c2b=_0x22ed69['offset']+_0x22ed69[_0x710f('0x19')],_0xd0e86;if(_0x103c2b>=_0x17d7c3){_0x103c2b=_0x17d7c3;_0xd0e86=0xc8;}else{_0xd0e86=0xce;}_0x2c6e86['status'](_0xd0e86);return _0x2c6e86[_0x710f('0x1a')](_0x710f('0x1b'),_0xcade19+'-'+_0x103c2b+'/'+_0x17d7c3)[_0x710f('0x17')](_0x37d219);}return null;};}function patchUpdates(_0x44edcd){return function(_0x3e3bad){try{jsonpatch['apply'](_0x3e3bad,_0x44edcd,!![]);}catch(_0x176d81){return BPromise[_0x710f('0x1c')](_0x176d81);}return _0x3e3bad[_0x710f('0x1d')]();};}function saveUpdates(_0x3aa490,_0x386160){return function(_0x277915){if(_0x277915){return _0x277915[_0x710f('0x1e')](_0x3aa490)[_0x710f('0x1f')](function(_0x34a0e9){return _0x34a0e9;});}return null;};}function removeEntity(_0x42663f,_0x378556){return function(_0x5311f1){if(_0x5311f1){return _0x5311f1['destroy']()[_0x710f('0x1f')](function(){_0x42663f['status'](0xcc)[_0x710f('0x16')]();});}};}function handleEntityNotFound(_0x1552ef,_0x464e41){return function(_0xc64554){if(!_0xc64554){_0x1552ef[_0x710f('0x20')](0x194);}return _0xc64554;};}function handleError(_0x3d3ed1,_0x379908){_0x379908=_0x379908||0x1f4;return function(_0x301baf){logger['error'](_0x301baf[_0x710f('0x21')]);if(_0x301baf[_0x710f('0x22')]){delete _0x301baf['name'];}_0x3d3ed1[_0x710f('0x15')](_0x379908)[_0x710f('0x23')](_0x301baf);};}exports['index']=function(_0x5e92db,_0x196f14){var _0xcc5541={},_0x153834={},_0x22f850={'count':0x0,'rows':[]};var _0x1c12c9=db[_0x710f('0x24')][_0x710f('0x25')];_0x153834['model']=_[_0x710f('0x26')](_0x1c12c9);_0x153834[_0x710f('0x27')]=_['keys'](_0x5e92db[_0x710f('0x27')]);_0x153834['filters']=_[_0x710f('0x28')](_0x153834['model'],_0x153834[_0x710f('0x27')]);_0xcc5541['attributes']=_[_0x710f('0x28')](_0x153834[_0x710f('0x29')],qs[_0x710f('0x2a')](_0x5e92db[_0x710f('0x27')][_0x710f('0x2a')]));_0xcc5541['attributes']=_0xcc5541[_0x710f('0x2b')][_0x710f('0x2c')]?_0xcc5541['attributes']:_0x153834[_0x710f('0x29')];if(!_0x5e92db[_0x710f('0x27')][_0x710f('0x2d')](_0x710f('0x2e'))){_0xcc5541[_0x710f('0x19')]=qs['limit'](_0x5e92db[_0x710f('0x27')][_0x710f('0x19')]);_0xcc5541[_0x710f('0x2f')]=qs[_0x710f('0x2f')](_0x5e92db['query'][_0x710f('0x2f')]);}_0xcc5541[_0x710f('0x30')]=qs[_0x710f('0x31')](_0x5e92db[_0x710f('0x27')]['sort']);_0xcc5541[_0x710f('0x32')]=qs[_0x710f('0x33')](_['pick'](_0x5e92db[_0x710f('0x27')],_0x153834[_0x710f('0x33')]));if(_0x5e92db['query'][_0x710f('0x34')]){_0xcc5541[_0x710f('0x32')]=_[_0x710f('0x35')](_0xcc5541[_0x710f('0x32')],{'$or':_[_0x710f('0x36')](_0x1c12c9,function(_0x496612){if(_0x496612[_0x710f('0x37')][_0x710f('0x38')]!=='VIRTUAL'){var _0x430fef={};_0x430fef[_0x496612[_0x710f('0x39')]]={'$like':'%'+_0x5e92db[_0x710f('0x27')][_0x710f('0x34')]+'%'};return _0x430fef;}})});}_0xcc5541=_[_0x710f('0x35')]({},_0xcc5541,_0x5e92db['options']);var _0x395685={'where':_0xcc5541[_0x710f('0x32')]};return db['AnalyticTreeReport'][_0x710f('0x18')](_0x395685)[_0x710f('0x1f')](function(_0x584dce){_0x22f850['count']=_0x584dce;if(_0x5e92db[_0x710f('0x27')]['includeAll']){_0xcc5541['include']=[{'all':!![]}];}return db[_0x710f('0x24')][_0x710f('0x3a')](_0xcc5541);})[_0x710f('0x1f')](function(_0x1c779c){_0x22f850['rows']=_0x1c779c;return _0x22f850;})[_0x710f('0x1f')](respondWithFilteredResult(_0x196f14,_0xcc5541))[_0x710f('0x3b')](handleError(_0x196f14,null));};exports['show']=function(_0x18cc1f,_0x2f3c00){var _0x36571f={'raw':!![],'where':{'id':_0x18cc1f[_0x710f('0x3c')]['id']}},_0x4f1470={};_0x4f1470[_0x710f('0x29')]=_[_0x710f('0x26')](db[_0x710f('0x24')][_0x710f('0x25')]);_0x4f1470[_0x710f('0x27')]=_[_0x710f('0x26')](_0x18cc1f[_0x710f('0x27')]);_0x4f1470['filters']=_[_0x710f('0x28')](_0x4f1470['model'],_0x4f1470[_0x710f('0x27')]);_0x36571f['attributes']=_['intersection'](_0x4f1470[_0x710f('0x29')],qs['fields'](_0x18cc1f['query'][_0x710f('0x2a')]));_0x36571f[_0x710f('0x2b')]=_0x36571f['attributes'][_0x710f('0x2c')]?_0x36571f['attributes']:_0x4f1470[_0x710f('0x29')];if(_0x18cc1f[_0x710f('0x27')]['includeAll']){_0x36571f['include']=[{'all':!![]}];}_0x36571f=_['merge']({},_0x36571f,_0x18cc1f[_0x710f('0x3d')]);return db[_0x710f('0x24')][_0x710f('0x3e')](_0x36571f)[_0x710f('0x1f')](handleEntityNotFound(_0x2f3c00,null))[_0x710f('0x1f')](respondWithResult(_0x2f3c00,null))[_0x710f('0x3b')](handleError(_0x2f3c00,null));};exports[_0x710f('0x3f')]=function(_0x6ba426,_0x328584){return db[_0x710f('0x24')][_0x710f('0x3f')](_0x6ba426['body'],{})[_0x710f('0x1f')](respondWithResult(_0x328584,0xc9))[_0x710f('0x3b')](handleError(_0x328584,null));};exports[_0x710f('0x1e')]=function(_0x242403,_0x42e591){if(_0x242403['body']['id']){delete _0x242403[_0x710f('0x40')]['id'];}return db['AnalyticTreeReport'][_0x710f('0x3e')]({'where':{'id':_0x242403[_0x710f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x42e591,null))[_0x710f('0x1f')](saveUpdates(_0x242403['body'],null))[_0x710f('0x1f')](respondWithResult(_0x42e591,null))[_0x710f('0x3b')](handleError(_0x42e591,null));};exports['destroy']=function(_0x5809ca,_0x4ec959){return db[_0x710f('0x24')][_0x710f('0x3e')]({'where':{'id':_0x5809ca[_0x710f('0x3c')]['id']}})[_0x710f('0x1f')](handleEntityNotFound(_0x4ec959,null))[_0x710f('0x1f')](removeEntity(_0x4ec959,null))[_0x710f('0x3b')](handleError(_0x4ec959,null));}; \ No newline at end of file +var _0x985b=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','key','VIRTUAL','field','options','includeAll','include','AnalyticTreeReport','findAll','rows','catch','show','params','rawAttributes','length','merge','create','body','update','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x209c0b,_0x249bd9){var _0xb5b30b=function(_0x50c37b){while(--_0x50c37b){_0x209c0b['push'](_0x209c0b['shift']());}};_0xb5b30b(++_0x249bd9);}(_0x985b,0xd4));var _0xb985=function(_0x5b3afe,_0x418d4f){_0x5b3afe=_0x5b3afe-0x0;var _0x3141af=_0x985b[_0x5b3afe];return _0x3141af;};'use strict';var pdf=require(_0xb985('0x0'));var emlformat=require(_0xb985('0x1'));var rimraf=require(_0xb985('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb985('0x3'));var rp=require(_0xb985('0x4'));var moment=require(_0xb985('0x5'));var BPromise=require(_0xb985('0x6'));var Mustache=require(_0xb985('0x7'));var util=require(_0xb985('0x8'));var path=require(_0xb985('0x9'));var sox=require(_0xb985('0xa'));var csv=require(_0xb985('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb985('0xc'));var squel=require(_0xb985('0xd'));var crypto=require(_0xb985('0xe'));var jsforce=require(_0xb985('0xf'));var deskjs=require(_0xb985('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb985('0x11'));var Papa=require('papaparse');var Redis=require(_0xb985('0x12'));var authService=require(_0xb985('0x13'));var qs=require(_0xb985('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb985('0x15'))(_0xb985('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb985('0x17'))['db'];function respondWithStatusCode(_0x490b82,_0x1a9ebe){_0x1a9ebe=_0x1a9ebe||0xcc;return function(_0x5e22bd){if(_0x5e22bd){return _0x490b82[_0xb985('0x18')](_0x1a9ebe);}return _0x490b82[_0xb985('0x19')](_0x1a9ebe)[_0xb985('0x1a')]();};}function respondWithResult(_0x4d61f7,_0x31ce94){_0x31ce94=_0x31ce94||0xc8;return function(_0x85992){if(_0x85992){return _0x4d61f7[_0xb985('0x19')](_0x31ce94)[_0xb985('0x1b')](_0x85992);}};}function respondWithFilteredResult(_0x4d7920,_0x3ab029){return function(_0x454898){if(_0x454898){var _0x3e4fbb=_0x454898[_0xb985('0x1c')],_0x240706=_0x3ab029[_0xb985('0x1d')],_0x4f1936=_0x3ab029['offset']+_0x3ab029[_0xb985('0x1e')],_0x46ae24;if(_0x4f1936>=_0x3e4fbb){_0x4f1936=_0x3e4fbb;_0x46ae24=0xc8;}else{_0x46ae24=0xce;}_0x4d7920[_0xb985('0x19')](_0x46ae24);return _0x4d7920[_0xb985('0x1f')](_0xb985('0x20'),_0x240706+'-'+_0x4f1936+'/'+_0x3e4fbb)[_0xb985('0x1b')](_0x454898);}return null;};}function patchUpdates(_0x1be5bd){return function(_0x4492bb){try{jsonpatch[_0xb985('0x21')](_0x4492bb,_0x1be5bd,!![]);}catch(_0x528b85){return BPromise[_0xb985('0x22')](_0x528b85);}return _0x4492bb[_0xb985('0x23')]();};}function saveUpdates(_0x508cfd,_0x305060){return function(_0xe0210d){if(_0xe0210d){return _0xe0210d['update'](_0x508cfd)[_0xb985('0x24')](function(_0x1708aa){return _0x1708aa;});}return null;};}function removeEntity(_0x443db5,_0x4ca6a1){return function(_0x1efbb1){if(_0x1efbb1){return _0x1efbb1['destroy']()[_0xb985('0x24')](function(){_0x443db5[_0xb985('0x19')](0xcc)[_0xb985('0x1a')]();});}};}function handleEntityNotFound(_0xb3c34,_0x5a2233){return function(_0x4f237f){if(!_0x4f237f){_0xb3c34[_0xb985('0x18')](0x194);}return _0x4f237f;};}function handleError(_0x48d2eb,_0x19ca48){_0x19ca48=_0x19ca48||0x1f4;return function(_0x3d494f){logger[_0xb985('0x25')](_0x3d494f[_0xb985('0x26')]);if(_0x3d494f['name']){delete _0x3d494f[_0xb985('0x27')];}_0x48d2eb['status'](_0x19ca48)[_0xb985('0x28')](_0x3d494f);};}exports[_0xb985('0x29')]=function(_0x49a980,_0x5edb85){var _0x1d8ca5={},_0x3c139d={},_0x57b36d={'count':0x0,'rows':[]};var _0x332f85=db['AnalyticTreeReport']['rawAttributes'];_0x3c139d[_0xb985('0x2a')]=_[_0xb985('0x2b')](_0x332f85);_0x3c139d[_0xb985('0x2c')]=_[_0xb985('0x2b')](_0x49a980['query']);_0x3c139d[_0xb985('0x2d')]=_[_0xb985('0x2e')](_0x3c139d[_0xb985('0x2a')],_0x3c139d['query']);_0x1d8ca5[_0xb985('0x2f')]=_[_0xb985('0x2e')](_0x3c139d[_0xb985('0x2a')],qs['fields'](_0x49a980[_0xb985('0x2c')][_0xb985('0x30')]));_0x1d8ca5[_0xb985('0x2f')]=_0x1d8ca5[_0xb985('0x2f')]['length']?_0x1d8ca5[_0xb985('0x2f')]:_0x3c139d[_0xb985('0x2a')];if(!_0x49a980['query'][_0xb985('0x31')](_0xb985('0x32'))){_0x1d8ca5[_0xb985('0x1e')]=qs['limit'](_0x49a980['query'][_0xb985('0x1e')]);_0x1d8ca5[_0xb985('0x1d')]=qs['offset'](_0x49a980['query'][_0xb985('0x1d')]);}_0x1d8ca5[_0xb985('0x33')]=qs[_0xb985('0x34')](_0x49a980[_0xb985('0x2c')][_0xb985('0x34')]);_0x1d8ca5['where']=qs['filters'](_[_0xb985('0x35')](_0x49a980['query'],_0x3c139d['filters']));if(_0x49a980['query'][_0xb985('0x36')]){_0x1d8ca5[_0xb985('0x37')]=_['merge'](_0x1d8ca5[_0xb985('0x37')],{'$or':_['map'](_0x332f85,function(_0x33c6e5){if(_0x33c6e5['type'][_0xb985('0x38')]!==_0xb985('0x39')){var _0x1b0d83={};_0x1b0d83[_0x33c6e5[_0xb985('0x3a')]]={'$like':'%'+_0x49a980[_0xb985('0x2c')]['filter']+'%'};return _0x1b0d83;}})});}_0x1d8ca5=_['merge']({},_0x1d8ca5,_0x49a980[_0xb985('0x3b')]);var _0x3785a9={'where':_0x1d8ca5['where']};return db['AnalyticTreeReport'][_0xb985('0x1c')](_0x3785a9)['then'](function(_0x377d5a){_0x57b36d[_0xb985('0x1c')]=_0x377d5a;if(_0x49a980[_0xb985('0x2c')][_0xb985('0x3c')]){_0x1d8ca5[_0xb985('0x3d')]=[{'all':!![]}];}return db[_0xb985('0x3e')][_0xb985('0x3f')](_0x1d8ca5);})['then'](function(_0x25d793){_0x57b36d[_0xb985('0x40')]=_0x25d793;return _0x57b36d;})[_0xb985('0x24')](respondWithFilteredResult(_0x5edb85,_0x1d8ca5))[_0xb985('0x41')](handleError(_0x5edb85,null));};exports[_0xb985('0x42')]=function(_0x2ccb54,_0x1fbfd8){var _0x1497af={'raw':!![],'where':{'id':_0x2ccb54[_0xb985('0x43')]['id']}},_0x5d5e6e={};_0x5d5e6e['model']=_[_0xb985('0x2b')](db[_0xb985('0x3e')][_0xb985('0x44')]);_0x5d5e6e['query']=_[_0xb985('0x2b')](_0x2ccb54[_0xb985('0x2c')]);_0x5d5e6e['filters']=_[_0xb985('0x2e')](_0x5d5e6e[_0xb985('0x2a')],_0x5d5e6e[_0xb985('0x2c')]);_0x1497af['attributes']=_['intersection'](_0x5d5e6e[_0xb985('0x2a')],qs[_0xb985('0x30')](_0x2ccb54[_0xb985('0x2c')][_0xb985('0x30')]));_0x1497af[_0xb985('0x2f')]=_0x1497af[_0xb985('0x2f')][_0xb985('0x45')]?_0x1497af[_0xb985('0x2f')]:_0x5d5e6e[_0xb985('0x2a')];if(_0x2ccb54[_0xb985('0x2c')][_0xb985('0x3c')]){_0x1497af[_0xb985('0x3d')]=[{'all':!![]}];}_0x1497af=_[_0xb985('0x46')]({},_0x1497af,_0x2ccb54[_0xb985('0x3b')]);return db[_0xb985('0x3e')]['find'](_0x1497af)[_0xb985('0x24')](handleEntityNotFound(_0x1fbfd8,null))['then'](respondWithResult(_0x1fbfd8,null))[_0xb985('0x41')](handleError(_0x1fbfd8,null));};exports['create']=function(_0x5c92c,_0x89b6a2){return db[_0xb985('0x3e')][_0xb985('0x47')](_0x5c92c[_0xb985('0x48')],{})[_0xb985('0x24')](respondWithResult(_0x89b6a2,0xc9))['catch'](handleError(_0x89b6a2,null));};exports[_0xb985('0x49')]=function(_0x2f3385,_0x1209b4){if(_0x2f3385['body']['id']){delete _0x2f3385['body']['id'];}return db['AnalyticTreeReport'][_0xb985('0x4a')]({'where':{'id':_0x2f3385[_0xb985('0x43')]['id']}})['then'](handleEntityNotFound(_0x1209b4,null))['then'](saveUpdates(_0x2f3385[_0xb985('0x48')],null))[_0xb985('0x24')](respondWithResult(_0x1209b4,null))['catch'](handleError(_0x1209b4,null));};exports[_0xb985('0x4b')]=function(_0x424ece,_0xb01724){return db['AnalyticTreeReport']['find']({'where':{'id':_0x424ece['params']['id']}})[_0xb985('0x24')](handleEntityNotFound(_0xb01724,null))[_0xb985('0x24')](removeEntity(_0xb01724,null))['catch'](handleError(_0xb01724,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8717ab5..d0cd2f7 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 _0x42d2=['define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x151d64,_0x360f73){var _0x409cfd=function(_0x152309){while(--_0x152309){_0x151d64['push'](_0x151d64['shift']());}};_0x409cfd(++_0x360f73);}(_0x42d2,0x1f2));var _0x242d=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x42d2[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0x242d('0x0'));var util=require('util');var logger=require(_0x242d('0x1'))(_0x242d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x242d('0x3'));var fs=require('fs');var path=require(_0x242d('0x4'));var rimraf=require('rimraf');var config=require(_0x242d('0x5'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1796e9,_0x3aef7b){return _0x1796e9[_0x242d('0x6')](_0x242d('0x7'),attributes,{'tableName':_0x242d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31c7=['analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1b3c4c,_0x5c0bef){var _0x22bc2e=function(_0x16bca0){while(--_0x16bca0){_0x1b3c4c['push'](_0x1b3c4c['shift']());}};_0x22bc2e(++_0x5c0bef);}(_0x31c7,0xd2));var _0x731c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x31c7[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x731c('0x0'));var logger=require(_0x731c('0x1'))(_0x731c('0x2'));var moment=require(_0x731c('0x3'));var BPromise=require(_0x731c('0x4'));var rp=require(_0x731c('0x5'));var fs=require('fs');var path=require(_0x731c('0x6'));var rimraf=require(_0x731c('0x7'));var config=require(_0x731c('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x731c('0x9')]=function(_0x54af0f,_0xe5ac65){return _0x54af0f['define']('AnalyticTreeReport',attributes,{'tableName':_0x731c('0xa'),'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 1839fd2..fe4fd67 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 _0xa4e3=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa4e3,0x158));var _0x3a4e=function(_0x262855,_0x4b2a4e){_0x262855=_0x262855-0x0;var _0x350a2b=_0xa4e3[_0x262855];return _0x350a2b;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var moment=require(_0x3a4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a4e('0x3'));var fs=require('fs');var Redis=require(_0x3a4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a4e('0x5'));var logger=require(_0x3a4e('0x6'))('rpc');var config=require(_0x3a4e('0x7'));var jayson=require(_0x3a4e('0x8'));var client=jayson[_0x3a4e('0x9')][_0x3a4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33809c,_0x500014,_0xb610f4){return new BPromise(function(_0x15493c,_0x44d9d7){return client[_0x3a4e('0xb')](_0x33809c,_0xb610f4)[_0x3a4e('0xc')](function(_0x1b7274){logger[_0x3a4e('0xd')](_0x3a4e('0xe'),_0x500014,_0x3a4e('0xf'));logger[_0x3a4e('0x10')](_0x3a4e('0x11'),_0x500014,'request\x20sent',JSON[_0x3a4e('0x12')](_0x1b7274));if(_0x1b7274[_0x3a4e('0x13')]){if(_0x1b7274[_0x3a4e('0x13')][_0x3a4e('0x14')]===0x1f4){logger[_0x3a4e('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x500014,_0x1b7274['error'][_0x3a4e('0x15')]);return _0x44d9d7(_0x1b7274[_0x3a4e('0x13')][_0x3a4e('0x15')]);}logger[_0x3a4e('0x13')](_0x3a4e('0xe'),_0x500014,_0x1b7274['error'][_0x3a4e('0x15')]);return _0x15493c(_0x1b7274[_0x3a4e('0x13')][_0x3a4e('0x15')]);}else{logger['info'](_0x3a4e('0xe'),_0x500014,_0x3a4e('0xf'));_0x15493c(_0x1b7274[_0x3a4e('0x16')][_0x3a4e('0x15')]);}})[_0x3a4e('0x17')](function(_0x50e409){logger[_0x3a4e('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x500014,_0x50e409);_0x44d9d7(_0x50e409);});});} \ No newline at end of file +var _0xe041=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','AnalyticTreeReport,\x20%s,\x20%s'];(function(_0x34c78b,_0xf5e8f3){var _0x197a27=function(_0x2b5720){while(--_0x2b5720){_0x34c78b['push'](_0x34c78b['shift']());}};_0x197a27(++_0xf5e8f3);}(_0xe041,0xb8));var _0x1e04=function(_0x31dcbc,_0x1709ad){_0x31dcbc=_0x31dcbc-0x0;var _0x2f6427=_0xe041[_0x31dcbc];return _0x2f6427;};'use strict';var _=require(_0x1e04('0x0'));var util=require(_0x1e04('0x1'));var moment=require(_0x1e04('0x2'));var BPromise=require(_0x1e04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e04('0x4'));var db=require(_0x1e04('0x5'))['db'];var utils=require(_0x1e04('0x6'));var logger=require('../../config/logger')(_0x1e04('0x7'));var config=require('../../config/environment');var jayson=require(_0x1e04('0x8'));var client=jayson[_0x1e04('0x9')][_0x1e04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x210b41,_0x2a0835,_0x597c07){return new BPromise(function(_0x43b81f,_0x2c8e69){return client['request'](_0x210b41,_0x597c07)[_0x1e04('0xb')](function(_0x2aad9b){logger[_0x1e04('0xc')](_0x1e04('0xd'),_0x2a0835,'request\x20sent');logger[_0x1e04('0xe')](_0x1e04('0xf'),_0x2a0835,_0x1e04('0x10'),JSON[_0x1e04('0x11')](_0x2aad9b));if(_0x2aad9b[_0x1e04('0x12')]){if(_0x2aad9b[_0x1e04('0x12')][_0x1e04('0x13')]===0x1f4){logger[_0x1e04('0x12')](_0x1e04('0xd'),_0x2a0835,_0x2aad9b[_0x1e04('0x12')][_0x1e04('0x14')]);return _0x2c8e69(_0x2aad9b[_0x1e04('0x12')][_0x1e04('0x14')]);}logger[_0x1e04('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2a0835,_0x2aad9b[_0x1e04('0x12')][_0x1e04('0x14')]);return _0x43b81f(_0x2aad9b[_0x1e04('0x12')]['message']);}else{logger[_0x1e04('0xc')](_0x1e04('0xd'),_0x2a0835,_0x1e04('0x10'));_0x43b81f(_0x2aad9b[_0x1e04('0x15')]['message']);}})['catch'](function(_0x3ffa22){logger['error'](_0x1e04('0xd'),_0x2a0835,_0x3ffa22);_0x2c8e69(_0x3ffa22);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 12a0f3c..92f20d1 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 _0xfa1b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xfa1b,0x9a));var _0xbfa1=function(_0x45c9a7,_0x509194){_0x45c9a7=_0x45c9a7-0x0;var _0x59fc74=_0xfa1b[_0x45c9a7];return _0x59fc74;};'use strict';var multer=require(_0xbfa1('0x0'));var util=require(_0xbfa1('0x1'));var path=require(_0xbfa1('0x2'));var timeout=require(_0xbfa1('0x3'));var express=require(_0xbfa1('0x4'));var router=express[_0xbfa1('0x5')]();var auth=require(_0xbfa1('0x6'));var interaction=require(_0xbfa1('0x7'));var config=require(_0xbfa1('0x8'));var controller=require(_0xbfa1('0x9'));router['get']('/',auth[_0xbfa1('0xa')](),controller[_0xbfa1('0xb')]);router[_0xbfa1('0xc')]('/:id',auth[_0xbfa1('0xa')](),controller['show']);router[_0xbfa1('0xd')]('/',auth[_0xbfa1('0xa')](),controller[_0xbfa1('0xe')]);router[_0xbfa1('0xf')](_0xbfa1('0x10'),auth['isAuthenticated'](),controller[_0xbfa1('0x11')]);router[_0xbfa1('0x12')]('/:id',auth[_0xbfa1('0xa')](),controller['destroy']);module[_0xbfa1('0x13')]=router; \ No newline at end of file +var _0xb4df=['/:id','post','create','destroy','exports','multer','util','express','Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x34db07,_0x9fda7e){var _0xe20be4=function(_0x10ff62){while(--_0x10ff62){_0x34db07['push'](_0x34db07['shift']());}};_0xe20be4(++_0x9fda7e);}(_0xb4df,0xc9));var _0xfb4d=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb4df[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0xfb4d('0x0'));var util=require(_0xfb4d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfb4d('0x2'));var router=express[_0xfb4d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfb4d('0x4'));var controller=require(_0xfb4d('0x5'));router[_0xfb4d('0x6')]('/',auth[_0xfb4d('0x7')](),controller[_0xfb4d('0x8')]);router[_0xfb4d('0x6')](_0xfb4d('0x9'),auth[_0xfb4d('0x7')](),controller['show']);router[_0xfb4d('0xa')]('/',auth[_0xfb4d('0x7')](),controller[_0xfb4d('0xb')]);router['put'](_0xfb4d('0x9'),auth[_0xfb4d('0x7')](),controller['update']);router['delete'](_0xfb4d('0x9'),auth[_0xfb4d('0x7')](),controller[_0xfb4d('0xc')]);module[_0xfb4d('0xd')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ab96b18..2a643f1 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 _0x9b50=['exports','STRING','sequelize'];(function(_0x583259,_0x83a562){var _0x596d81=function(_0x3e60f4){while(--_0x3e60f4){_0x583259['push'](_0x583259['shift']());}};_0x596d81(++_0x83a562);}(_0x9b50,0x95));var _0x09b5=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9b50[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x09b5('0x0'));module[_0x09b5('0x1')]={'name':{'type':Sequelize[_0x09b5('0x2')]},'basename':{'type':Sequelize[_0x09b5('0x2')]},'type':{'type':Sequelize[_0x09b5('0x2')]}}; \ No newline at end of file +var _0xd005=['sequelize','exports','STRING'];(function(_0x18e108,_0x13a6ea){var _0x213ce3=function(_0x4bde26){while(--_0x4bde26){_0x18e108['push'](_0x18e108['shift']());}};_0x213ce3(++_0x13a6ea);}(_0xd005,0xe7));var _0x5d00=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd005[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5d00('0x0'));module[_0x5d00('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x5d00('0x2')]},'type':{'type':Sequelize[_0x5d00('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a4b1aea..6754812 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 _0x4220=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','Attachment','rawAttributes','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','map','key','VIRTUAL','field','merge','options','include','rows','catch','show','params','fields','includeAll','find','body','create','file','originalname','filename','type','download','findOne','join','server/files/attachments/','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x439fcc,_0x1ff8eb){var _0x134d78=function(_0xf4f3c9){while(--_0xf4f3c9){_0x439fcc['push'](_0x439fcc['shift']());}};_0x134d78(++_0x1ff8eb);}(_0x4220,0x1be));var _0x0422=function(_0x55c802,_0x433701){_0x55c802=_0x55c802-0x0;var _0xdec587=_0x4220[_0x55c802];return _0xdec587;};'use strict';var pdf=require(_0x0422('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0422('0x1'));var jsonpatch=require(_0x0422('0x2'));var rp=require(_0x0422('0x3'));var moment=require(_0x0422('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0422('0x5'));var util=require('util');var path=require(_0x0422('0x6'));var sox=require(_0x0422('0x7'));var csv=require(_0x0422('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0422('0x9'));var squel=require('squel');var crypto=require(_0x0422('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0422('0xb'));var toCsv=require(_0x0422('0x8'));var querystring=require(_0x0422('0xc'));var Papa=require(_0x0422('0xd'));var Redis=require(_0x0422('0xe'));var authService=require(_0x0422('0xf'));var qs=require(_0x0422('0x10'));var hardwareService=require(_0x0422('0x11'));var logger=require(_0x0422('0x12'))(_0x0422('0x13'));var utils=require(_0x0422('0x14'));var config=require(_0x0422('0x15'));var db=require(_0x0422('0x16'))['db'];function respondWithStatusCode(_0x2162b8,_0x52109f){_0x52109f=_0x52109f||0xcc;return function(_0x325cb9){if(_0x325cb9){return _0x2162b8[_0x0422('0x17')](_0x52109f);}return _0x2162b8[_0x0422('0x18')](_0x52109f)[_0x0422('0x19')]();};}function respondWithResult(_0x2283c7,_0x52276e){_0x52276e=_0x52276e||0xc8;return function(_0x20d1ce){if(_0x20d1ce){return _0x2283c7['status'](_0x52276e)[_0x0422('0x1a')](_0x20d1ce);}};}function respondWithFilteredResult(_0x5e6593,_0xcc23b0){return function(_0x6c4f74){if(_0x6c4f74){var _0x3b74a7=_0x6c4f74[_0x0422('0x1b')],_0x1c58a8=_0xcc23b0[_0x0422('0x1c')],_0x5e4fe5=_0xcc23b0[_0x0422('0x1c')]+_0xcc23b0[_0x0422('0x1d')],_0x5d17f6;if(_0x5e4fe5>=_0x3b74a7){_0x5e4fe5=_0x3b74a7;_0x5d17f6=0xc8;}else{_0x5d17f6=0xce;}_0x5e6593[_0x0422('0x18')](_0x5d17f6);return _0x5e6593[_0x0422('0x1e')](_0x0422('0x1f'),_0x1c58a8+'-'+_0x5e4fe5+'/'+_0x3b74a7)['json'](_0x6c4f74);}return null;};}function patchUpdates(_0x3b2d9b){return function(_0x113f5c){try{jsonpatch[_0x0422('0x20')](_0x113f5c,_0x3b2d9b,!![]);}catch(_0x5861c2){return BPromise[_0x0422('0x21')](_0x5861c2);}return _0x113f5c[_0x0422('0x22')]();};}function saveUpdates(_0x1bd620,_0x5bb648){return function(_0x15bbfe){if(_0x15bbfe){return _0x15bbfe[_0x0422('0x23')](_0x1bd620)[_0x0422('0x24')](function(_0x25a32b){return _0x25a32b;});}return null;};}function removeEntity(_0x558f49,_0x285853){return function(_0x4ee4a1){if(_0x4ee4a1){return _0x4ee4a1[_0x0422('0x25')]()[_0x0422('0x24')](function(){_0x558f49[_0x0422('0x18')](0xcc)[_0x0422('0x19')]();});}};}function handleEntityNotFound(_0x414b93,_0x5b1270){return function(_0x2ddd57){if(!_0x2ddd57){_0x414b93[_0x0422('0x17')](0x194);}return _0x2ddd57;};}function handleError(_0x232b85,_0x154ee1){_0x154ee1=_0x154ee1||0x1f4;return function(_0x3f7aa0){logger['error'](_0x3f7aa0[_0x0422('0x26')]);if(_0x3f7aa0[_0x0422('0x27')]){delete _0x3f7aa0['name'];}_0x232b85[_0x0422('0x18')](_0x154ee1)['send'](_0x3f7aa0);};}exports[_0x0422('0x28')]=function(_0x3b1da7,_0x458e7b){var _0x5703d7={},_0xe5e79a={},_0x408ec9={'count':0x0,'rows':[]};var _0x47327a=db[_0x0422('0x29')][_0x0422('0x2a')];_0xe5e79a[_0x0422('0x2b')]=_['keys'](_0x47327a);_0xe5e79a[_0x0422('0x2c')]=_[_0x0422('0x2d')](_0x3b1da7[_0x0422('0x2c')]);_0xe5e79a[_0x0422('0x2e')]=_[_0x0422('0x2f')](_0xe5e79a[_0x0422('0x2b')],_0xe5e79a[_0x0422('0x2c')]);_0x5703d7[_0x0422('0x30')]=_[_0x0422('0x2f')](_0xe5e79a[_0x0422('0x2b')],qs['fields'](_0x3b1da7['query']['fields']));_0x5703d7[_0x0422('0x30')]=_0x5703d7[_0x0422('0x30')][_0x0422('0x31')]?_0x5703d7[_0x0422('0x30')]:_0xe5e79a[_0x0422('0x2b')];if(!_0x3b1da7[_0x0422('0x2c')][_0x0422('0x32')]('nolimit')){_0x5703d7[_0x0422('0x1d')]=qs[_0x0422('0x1d')](_0x3b1da7['query']['limit']);_0x5703d7[_0x0422('0x1c')]=qs['offset'](_0x3b1da7['query'][_0x0422('0x1c')]);}_0x5703d7['order']=qs[_0x0422('0x33')](_0x3b1da7['query']['sort']);_0x5703d7[_0x0422('0x34')]=qs[_0x0422('0x2e')](_['pick'](_0x3b1da7[_0x0422('0x2c')],_0xe5e79a[_0x0422('0x2e')]));if(_0x3b1da7[_0x0422('0x2c')][_0x0422('0x35')]){_0x5703d7[_0x0422('0x34')]=_['merge'](_0x5703d7['where'],{'$or':_[_0x0422('0x36')](_0x47327a,function(_0x46b765){if(_0x46b765['type'][_0x0422('0x37')]!==_0x0422('0x38')){var _0x36b4f7={};_0x36b4f7[_0x46b765[_0x0422('0x39')]]={'$like':'%'+_0x3b1da7[_0x0422('0x2c')][_0x0422('0x35')]+'%'};return _0x36b4f7;}})});}_0x5703d7=_[_0x0422('0x3a')]({},_0x5703d7,_0x3b1da7[_0x0422('0x3b')]);var _0x1bf8a8={'where':_0x5703d7[_0x0422('0x34')]};return db[_0x0422('0x29')][_0x0422('0x1b')](_0x1bf8a8)['then'](function(_0x1cbc96){_0x408ec9['count']=_0x1cbc96;if(_0x3b1da7[_0x0422('0x2c')]['includeAll']){_0x5703d7[_0x0422('0x3c')]=[{'all':!![]}];}return db[_0x0422('0x29')]['findAll'](_0x5703d7);})[_0x0422('0x24')](function(_0x2e8722){_0x408ec9[_0x0422('0x3d')]=_0x2e8722;return _0x408ec9;})['then'](respondWithFilteredResult(_0x458e7b,_0x5703d7))[_0x0422('0x3e')](handleError(_0x458e7b,null));};exports[_0x0422('0x3f')]=function(_0x59e8a2,_0x359278){var _0x2d684c={'raw':!![],'where':{'id':_0x59e8a2[_0x0422('0x40')]['id']}},_0x261e49={};_0x261e49[_0x0422('0x2b')]=_[_0x0422('0x2d')](db[_0x0422('0x29')][_0x0422('0x2a')]);_0x261e49['query']=_['keys'](_0x59e8a2['query']);_0x261e49[_0x0422('0x2e')]=_[_0x0422('0x2f')](_0x261e49['model'],_0x261e49[_0x0422('0x2c')]);_0x2d684c[_0x0422('0x30')]=_['intersection'](_0x261e49[_0x0422('0x2b')],qs[_0x0422('0x41')](_0x59e8a2[_0x0422('0x2c')][_0x0422('0x41')]));_0x2d684c[_0x0422('0x30')]=_0x2d684c[_0x0422('0x30')][_0x0422('0x31')]?_0x2d684c['attributes']:_0x261e49[_0x0422('0x2b')];if(_0x59e8a2[_0x0422('0x2c')][_0x0422('0x42')]){_0x2d684c[_0x0422('0x3c')]=[{'all':!![]}];}_0x2d684c=_[_0x0422('0x3a')]({},_0x2d684c,_0x59e8a2[_0x0422('0x3b')]);return db[_0x0422('0x29')][_0x0422('0x43')](_0x2d684c)[_0x0422('0x24')](handleEntityNotFound(_0x359278,null))[_0x0422('0x24')](respondWithResult(_0x359278,null))[_0x0422('0x3e')](handleError(_0x359278,null));};exports['update']=function(_0x43e6b7,_0x11f11c){if(_0x43e6b7['body']['id']){delete _0x43e6b7[_0x0422('0x44')]['id'];}return db['Attachment'][_0x0422('0x43')]({'where':{'id':_0x43e6b7[_0x0422('0x40')]['id']}})[_0x0422('0x24')](handleEntityNotFound(_0x11f11c,null))[_0x0422('0x24')](saveUpdates(_0x43e6b7[_0x0422('0x44')],null))['then'](respondWithResult(_0x11f11c,null))[_0x0422('0x3e')](handleError(_0x11f11c,null));};exports[_0x0422('0x25')]=function(_0x57d4dc,_0x2e429d){return db[_0x0422('0x29')]['find']({'where':{'id':_0x57d4dc['params']['id']}})[_0x0422('0x24')](handleEntityNotFound(_0x2e429d,null))['then'](removeEntity(_0x2e429d,null))[_0x0422('0x3e')](handleError(_0x2e429d,null));};exports[_0x0422('0x45')]=function(_0x133da3,_0x13c250,_0x3725d2){_0x133da3['body'][_0x0422('0x27')]=_0x133da3[_0x0422('0x46')][_0x0422('0x47')];_0x133da3[_0x0422('0x44')]['basename']=_0x133da3[_0x0422('0x46')][_0x0422('0x48')];_0x133da3[_0x0422('0x44')][_0x0422('0x49')]=_0x133da3['file']['mimetype'];return db[_0x0422('0x29')][_0x0422('0x45')](_0x133da3[_0x0422('0x44')])[_0x0422('0x24')](respondWithResult(_0x13c250,0xc9))[_0x0422('0x3e')](handleError(_0x13c250,null));};exports[_0x0422('0x4a')]=function(_0x3cf5a3,_0x148e45,_0x46cb9c){return db['Attachment'][_0x0422('0x4b')]({'where':{'id':_0x3cf5a3[_0x0422('0x40')]['id']},'raw':!![]})[_0x0422('0x24')](handleEntityNotFound(_0x148e45,null))[_0x0422('0x24')](function(_0x2e902d){if(_0x2e902d){return _0x148e45[_0x0422('0x4a')](path[_0x0422('0x4c')](config['root'],_0x0422('0x4d'),_0x2e902d['basename']));}})[_0x0422('0x3e')](handleError(_0x148e45,null));}; \ No newline at end of file +var _0x7e27=['join','root','server/files/attachments/','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','set','apply','reject','save','then','destroy','end','error','stack','send','index','Attachment','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','map','type','key','VIRTUAL','field','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','update','body','create','name','originalname','basename','filename','file','mimetype','download','findOne'];(function(_0x2df8f0,_0x3c96e8){var _0x3986c2=function(_0x2b99a4){while(--_0x2b99a4){_0x2df8f0['push'](_0x2df8f0['shift']());}};_0x3986c2(++_0x3c96e8);}(_0x7e27,0x15b));var _0x77e2=function(_0x3e9515,_0x2c2679){_0x3e9515=_0x3e9515-0x0;var _0x510acf=_0x7e27[_0x3e9515];return _0x510acf;};'use strict';var pdf=require(_0x77e2('0x0'));var emlformat=require(_0x77e2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x77e2('0x2'));var rp=require(_0x77e2('0x3'));var moment=require(_0x77e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77e2('0x5'));var util=require(_0x77e2('0x6'));var path=require(_0x77e2('0x7'));var sox=require(_0x77e2('0x8'));var csv=require(_0x77e2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77e2('0xa'));var squel=require(_0x77e2('0xb'));var crypto=require(_0x77e2('0xc'));var jsforce=require(_0x77e2('0xd'));var deskjs=require(_0x77e2('0xe'));var toCsv=require(_0x77e2('0x9'));var querystring=require(_0x77e2('0xf'));var Papa=require(_0x77e2('0x10'));var Redis=require('ioredis');var authService=require(_0x77e2('0x11'));var qs=require(_0x77e2('0x12'));var hardwareService=require(_0x77e2('0x13'));var logger=require(_0x77e2('0x14'))('api');var utils=require(_0x77e2('0x15'));var config=require(_0x77e2('0x16'));var db=require(_0x77e2('0x17'))['db'];function respondWithStatusCode(_0x3a3aee,_0x5ec5b4){_0x5ec5b4=_0x5ec5b4||0xcc;return function(_0x558e4f){if(_0x558e4f){return _0x3a3aee[_0x77e2('0x18')](_0x5ec5b4);}return _0x3a3aee[_0x77e2('0x19')](_0x5ec5b4)['end']();};}function respondWithResult(_0x2669f7,_0x13e99b){_0x13e99b=_0x13e99b||0xc8;return function(_0x3154b3){if(_0x3154b3){return _0x2669f7[_0x77e2('0x19')](_0x13e99b)[_0x77e2('0x1a')](_0x3154b3);}};}function respondWithFilteredResult(_0x3fdc48,_0x29db65){return function(_0x4642c){if(_0x4642c){var _0x635bcc=_0x4642c['count'],_0x1f8915=_0x29db65['offset'],_0x29d9a9=_0x29db65['offset']+_0x29db65[_0x77e2('0x1b')],_0x525c22;if(_0x29d9a9>=_0x635bcc){_0x29d9a9=_0x635bcc;_0x525c22=0xc8;}else{_0x525c22=0xce;}_0x3fdc48[_0x77e2('0x19')](_0x525c22);return _0x3fdc48[_0x77e2('0x1c')]('Content-Range',_0x1f8915+'-'+_0x29d9a9+'/'+_0x635bcc)[_0x77e2('0x1a')](_0x4642c);}return null;};}function patchUpdates(_0x1c2fb7){return function(_0x23455c){try{jsonpatch[_0x77e2('0x1d')](_0x23455c,_0x1c2fb7,!![]);}catch(_0x1926a8){return BPromise[_0x77e2('0x1e')](_0x1926a8);}return _0x23455c[_0x77e2('0x1f')]();};}function saveUpdates(_0x3d16ee,_0x3fdd83){return function(_0x559d7c){if(_0x559d7c){return _0x559d7c['update'](_0x3d16ee)[_0x77e2('0x20')](function(_0x1173a9){return _0x1173a9;});}return null;};}function removeEntity(_0xa66483,_0xbfaba5){return function(_0x516b3f){if(_0x516b3f){return _0x516b3f[_0x77e2('0x21')]()[_0x77e2('0x20')](function(){_0xa66483[_0x77e2('0x19')](0xcc)[_0x77e2('0x22')]();});}};}function handleEntityNotFound(_0x34f812,_0x2875dd){return function(_0x43c9c3){if(!_0x43c9c3){_0x34f812[_0x77e2('0x18')](0x194);}return _0x43c9c3;};}function handleError(_0x7808ca,_0x1c40f9){_0x1c40f9=_0x1c40f9||0x1f4;return function(_0x5d2dcf){logger[_0x77e2('0x23')](_0x5d2dcf[_0x77e2('0x24')]);if(_0x5d2dcf['name']){delete _0x5d2dcf['name'];}_0x7808ca[_0x77e2('0x19')](_0x1c40f9)[_0x77e2('0x25')](_0x5d2dcf);};}exports[_0x77e2('0x26')]=function(_0x42abbf,_0x2d8cd5){var _0x280ab8={},_0x7e0b8d={},_0x54465a={'count':0x0,'rows':[]};var _0x39a985=db[_0x77e2('0x27')]['rawAttributes'];_0x7e0b8d[_0x77e2('0x28')]=_[_0x77e2('0x29')](_0x39a985);_0x7e0b8d[_0x77e2('0x2a')]=_[_0x77e2('0x29')](_0x42abbf[_0x77e2('0x2a')]);_0x7e0b8d[_0x77e2('0x2b')]=_[_0x77e2('0x2c')](_0x7e0b8d[_0x77e2('0x28')],_0x7e0b8d['query']);_0x280ab8[_0x77e2('0x2d')]=_[_0x77e2('0x2c')](_0x7e0b8d[_0x77e2('0x28')],qs[_0x77e2('0x2e')](_0x42abbf[_0x77e2('0x2a')]['fields']));_0x280ab8[_0x77e2('0x2d')]=_0x280ab8['attributes'][_0x77e2('0x2f')]?_0x280ab8[_0x77e2('0x2d')]:_0x7e0b8d[_0x77e2('0x28')];if(!_0x42abbf[_0x77e2('0x2a')][_0x77e2('0x30')](_0x77e2('0x31'))){_0x280ab8['limit']=qs['limit'](_0x42abbf['query'][_0x77e2('0x1b')]);_0x280ab8['offset']=qs[_0x77e2('0x32')](_0x42abbf[_0x77e2('0x2a')][_0x77e2('0x32')]);}_0x280ab8['order']=qs[_0x77e2('0x33')](_0x42abbf[_0x77e2('0x2a')][_0x77e2('0x33')]);_0x280ab8['where']=qs[_0x77e2('0x2b')](_[_0x77e2('0x34')](_0x42abbf[_0x77e2('0x2a')],_0x7e0b8d['filters']));if(_0x42abbf[_0x77e2('0x2a')][_0x77e2('0x35')]){_0x280ab8[_0x77e2('0x36')]=_['merge'](_0x280ab8[_0x77e2('0x36')],{'$or':_[_0x77e2('0x37')](_0x39a985,function(_0x5ea533){if(_0x5ea533[_0x77e2('0x38')][_0x77e2('0x39')]!==_0x77e2('0x3a')){var _0x4f5a22={};_0x4f5a22[_0x5ea533[_0x77e2('0x3b')]]={'$like':'%'+_0x42abbf[_0x77e2('0x2a')][_0x77e2('0x35')]+'%'};return _0x4f5a22;}})});}_0x280ab8=_[_0x77e2('0x3c')]({},_0x280ab8,_0x42abbf[_0x77e2('0x3d')]);var _0x2ef74c={'where':_0x280ab8['where']};return db['Attachment'][_0x77e2('0x3e')](_0x2ef74c)[_0x77e2('0x20')](function(_0x248508){_0x54465a[_0x77e2('0x3e')]=_0x248508;if(_0x42abbf[_0x77e2('0x2a')][_0x77e2('0x3f')]){_0x280ab8[_0x77e2('0x40')]=[{'all':!![]}];}return db[_0x77e2('0x27')][_0x77e2('0x41')](_0x280ab8);})[_0x77e2('0x20')](function(_0x52751d){_0x54465a[_0x77e2('0x42')]=_0x52751d;return _0x54465a;})['then'](respondWithFilteredResult(_0x2d8cd5,_0x280ab8))[_0x77e2('0x43')](handleError(_0x2d8cd5,null));};exports[_0x77e2('0x44')]=function(_0xb40add,_0x388d87){var _0x2d4988={'raw':!![],'where':{'id':_0xb40add[_0x77e2('0x45')]['id']}},_0x2f9d83={};_0x2f9d83['model']=_[_0x77e2('0x29')](db[_0x77e2('0x27')][_0x77e2('0x46')]);_0x2f9d83[_0x77e2('0x2a')]=_[_0x77e2('0x29')](_0xb40add['query']);_0x2f9d83[_0x77e2('0x2b')]=_[_0x77e2('0x2c')](_0x2f9d83[_0x77e2('0x28')],_0x2f9d83[_0x77e2('0x2a')]);_0x2d4988['attributes']=_[_0x77e2('0x2c')](_0x2f9d83[_0x77e2('0x28')],qs[_0x77e2('0x2e')](_0xb40add[_0x77e2('0x2a')][_0x77e2('0x2e')]));_0x2d4988[_0x77e2('0x2d')]=_0x2d4988['attributes'][_0x77e2('0x2f')]?_0x2d4988[_0x77e2('0x2d')]:_0x2f9d83[_0x77e2('0x28')];if(_0xb40add[_0x77e2('0x2a')][_0x77e2('0x3f')]){_0x2d4988[_0x77e2('0x40')]=[{'all':!![]}];}_0x2d4988=_[_0x77e2('0x3c')]({},_0x2d4988,_0xb40add[_0x77e2('0x3d')]);return db[_0x77e2('0x27')][_0x77e2('0x47')](_0x2d4988)['then'](handleEntityNotFound(_0x388d87,null))[_0x77e2('0x20')](respondWithResult(_0x388d87,null))[_0x77e2('0x43')](handleError(_0x388d87,null));};exports[_0x77e2('0x48')]=function(_0x5ab029,_0x247909){if(_0x5ab029[_0x77e2('0x49')]['id']){delete _0x5ab029[_0x77e2('0x49')]['id'];}return db[_0x77e2('0x27')]['find']({'where':{'id':_0x5ab029[_0x77e2('0x45')]['id']}})[_0x77e2('0x20')](handleEntityNotFound(_0x247909,null))[_0x77e2('0x20')](saveUpdates(_0x5ab029[_0x77e2('0x49')],null))[_0x77e2('0x20')](respondWithResult(_0x247909,null))['catch'](handleError(_0x247909,null));};exports[_0x77e2('0x21')]=function(_0x4e2102,_0x142ea3){return db[_0x77e2('0x27')][_0x77e2('0x47')]({'where':{'id':_0x4e2102['params']['id']}})[_0x77e2('0x20')](handleEntityNotFound(_0x142ea3,null))[_0x77e2('0x20')](removeEntity(_0x142ea3,null))['catch'](handleError(_0x142ea3,null));};exports[_0x77e2('0x4a')]=function(_0x3778f6,_0x323746,_0x3916b8){_0x3778f6[_0x77e2('0x49')][_0x77e2('0x4b')]=_0x3778f6['file'][_0x77e2('0x4c')];_0x3778f6[_0x77e2('0x49')][_0x77e2('0x4d')]=_0x3778f6['file'][_0x77e2('0x4e')];_0x3778f6['body'][_0x77e2('0x38')]=_0x3778f6[_0x77e2('0x4f')][_0x77e2('0x50')];return db['Attachment'][_0x77e2('0x4a')](_0x3778f6['body'])[_0x77e2('0x20')](respondWithResult(_0x323746,0xc9))[_0x77e2('0x43')](handleError(_0x323746,null));};exports[_0x77e2('0x51')]=function(_0x295841,_0x2fa62c,_0x145de0){return db[_0x77e2('0x27')][_0x77e2('0x52')]({'where':{'id':_0x295841[_0x77e2('0x45')]['id']},'raw':!![]})[_0x77e2('0x20')](handleEntityNotFound(_0x2fa62c,null))[_0x77e2('0x20')](function(_0x8eee2){if(_0x8eee2){return _0x2fa62c['download'](path[_0x77e2('0x53')](config[_0x77e2('0x54')],_0x77e2('0x55'),_0x8eee2[_0x77e2('0x4d')]));}})[_0x77e2('0x43')](handleError(_0x2fa62c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7ae966a..6c806ab 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 _0x4bc3=['./attachment.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x331367,_0x21926e){var _0x232e12=function(_0x4109f7){while(--_0x4109f7){_0x331367['push'](_0x331367['shift']());}};_0x232e12(++_0x21926e);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x4bc3[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76a3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Attachment','lodash','util','../../config/logger','api'];(function(_0x36f7d7,_0x143fee){var _0x1399f2=function(_0x525b25){while(--_0x525b25){_0x36f7d7['push'](_0x36f7d7['shift']());}};_0x1399f2(++_0x143fee);}(_0x76a3,0xf8));var _0x376a=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0x76a3[_0x35bd6c];return _0x2f421d;};'use strict';var _=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var logger=require(_0x376a('0x2'))(_0x376a('0x3'));var moment=require(_0x376a('0x4'));var BPromise=require(_0x376a('0x5'));var rp=require(_0x376a('0x6'));var fs=require('fs');var path=require(_0x376a('0x7'));var rimraf=require(_0x376a('0x8'));var config=require(_0x376a('0x9'));var attributes=require('./attachment.attributes');module['exports']=function(_0x19ea68,_0x22904c){return _0x19ea68[_0x376a('0xa')](_0x376a('0xb'),attributes,{'tableName':'attachments','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 6ccd2e0..e79d532 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 _0x98d8=['then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','request'];(function(_0x523d5b,_0x1808f0){var _0x4d5b4c=function(_0x2e80a6){while(--_0x2e80a6){_0x523d5b['push'](_0x523d5b['shift']());}};_0x4d5b4c(++_0x1808f0);}(_0x98d8,0xce));var _0x898d=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0x98d8[_0x387603];return _0x55ea9e;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var moment=require(_0x898d('0x2'));var BPromise=require(_0x898d('0x3'));var rs=require(_0x898d('0x4'));var fs=require('fs');var Redis=require(_0x898d('0x5'));var db=require(_0x898d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x898d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x898d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16b99a,_0x4e8c68,_0x1de5df){return new BPromise(function(_0x4fe1bf,_0x3e9ba6){return client[_0x898d('0x9')](_0x16b99a,_0x1de5df)[_0x898d('0xa')](function(_0x40f217){logger[_0x898d('0xb')](_0x898d('0xc'),_0x4e8c68,_0x898d('0xd'));logger[_0x898d('0xe')](_0x898d('0xf'),_0x4e8c68,_0x898d('0xd'),JSON[_0x898d('0x10')](_0x40f217));if(_0x40f217[_0x898d('0x11')]){if(_0x40f217[_0x898d('0x11')][_0x898d('0x12')]===0x1f4){logger[_0x898d('0x11')]('Attachment,\x20%s,\x20%s',_0x4e8c68,_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);return _0x3e9ba6(_0x40f217['error'][_0x898d('0x13')]);}logger[_0x898d('0x11')](_0x898d('0xc'),_0x4e8c68,_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);return _0x4fe1bf(_0x40f217[_0x898d('0x11')][_0x898d('0x13')]);}else{logger['info'](_0x898d('0xc'),_0x4e8c68,_0x898d('0xd'));_0x4fe1bf(_0x40f217['result']['message']);}})[_0x898d('0x14')](function(_0x42a098){logger[_0x898d('0x11')](_0x898d('0xc'),_0x4e8c68,_0x42a098);_0x3e9ba6(_0x42a098);});});}exports[_0x898d('0x15')]=function(_0x1c3896){var _0x514c47=this;return new Promise(function(_0x47c188,_0x26be5a){return db[_0x898d('0x16')][_0x898d('0x17')](_0x1c3896[_0x898d('0x18')],{'raw':_0x1c3896[_0x898d('0x19')]?_0x1c3896[_0x898d('0x19')][_0x898d('0x1a')]===undefined?!![]:![]:!![]})[_0x898d('0xa')](function(_0x12e72c){logger[_0x898d('0xb')](_0x898d('0x15'),_0x1c3896);logger['debug'](_0x898d('0x15'),_0x1c3896,JSON[_0x898d('0x10')](_0x12e72c));_0x47c188(_0x12e72c);})[_0x898d('0x14')](function(_0x59b515){logger['error'](_0x898d('0x15'),_0x59b515[_0x898d('0x13')],_0x1c3896);_0x26be5a(_0x514c47[_0x898d('0x11')](0x1f4,_0x59b515[_0x898d('0x13')]));});});}; \ No newline at end of file +var _0x35fc=['message','result','CreateAttachment','create','body','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x35fc,0xde));var _0xc35f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x35fc[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc35f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc35f('0x1'));var rs=require(_0xc35f('0x2'));var fs=require('fs');var Redis=require(_0xc35f('0x3'));var db=require(_0xc35f('0x4'))['db'];var utils=require(_0xc35f('0x5'));var logger=require(_0xc35f('0x6'))(_0xc35f('0x7'));var config=require(_0xc35f('0x8'));var jayson=require(_0xc35f('0x9'));var client=jayson[_0xc35f('0xa')][_0xc35f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee6ff,_0x459b4a,_0x205511){return new BPromise(function(_0x381e63,_0x403537){return client[_0xc35f('0xc')](_0x4ee6ff,_0x205511)[_0xc35f('0xd')](function(_0x3a8053){logger[_0xc35f('0xe')](_0xc35f('0xf'),_0x459b4a,_0xc35f('0x10'));logger[_0xc35f('0x11')](_0xc35f('0x12'),_0x459b4a,_0xc35f('0x10'),JSON[_0xc35f('0x13')](_0x3a8053));if(_0x3a8053[_0xc35f('0x14')]){if(_0x3a8053['error']['code']===0x1f4){logger[_0xc35f('0x14')](_0xc35f('0xf'),_0x459b4a,_0x3a8053[_0xc35f('0x14')][_0xc35f('0x15')]);return _0x403537(_0x3a8053['error'][_0xc35f('0x15')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x459b4a,_0x3a8053[_0xc35f('0x14')]['message']);return _0x381e63(_0x3a8053['error'][_0xc35f('0x15')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x459b4a,'request\x20sent');_0x381e63(_0x3a8053[_0xc35f('0x16')]['message']);}})['catch'](function(_0x58018b){logger[_0xc35f('0x14')]('Attachment,\x20%s,\x20%s',_0x459b4a,_0x58018b);_0x403537(_0x58018b);});});}exports[_0xc35f('0x17')]=function(_0x436ce4){var _0x1d51c9=this;return new Promise(function(_0x4c68d2,_0x3f5442){return db['Attachment'][_0xc35f('0x18')](_0x436ce4[_0xc35f('0x19')],{'raw':_0x436ce4[_0xc35f('0x1a')]?_0x436ce4[_0xc35f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xc35f('0xd')](function(_0x3dcc6d){logger['info'](_0xc35f('0x17'),_0x436ce4);logger[_0xc35f('0x11')]('CreateAttachment',_0x436ce4,JSON[_0xc35f('0x13')](_0x3dcc6d));_0x4c68d2(_0x3dcc6d);})['catch'](function(_0x55c152){logger[_0xc35f('0x14')](_0xc35f('0x17'),_0x55c152[_0xc35f('0x15')],_0x436ce4);_0x3f5442(_0x1d51c9[_0xc35f('0x14')](0x1f4,_0x55c152[_0xc35f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1fc59e2..0653ca0 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 _0x80c7=['replace','post','single','file','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname'];(function(_0x3a89dc,_0x54bb1e){var _0x11c5c9=function(_0x21bd68){while(--_0x21bd68){_0x3a89dc['push'](_0x3a89dc['shift']());}};_0x11c5c9(++_0x54bb1e);}(_0x80c7,0x8d));var _0x780c=function(_0x4a06ce,_0x5350d3){_0x4a06ce=_0x4a06ce-0x0;var _0x451630=_0x80c7[_0x4a06ce];return _0x451630;};'use strict';var multer=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var path=require(_0x780c('0x2'));var timeout=require(_0x780c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x780c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x780c('0x5'));var controller=require(_0x780c('0x6'));router[_0x780c('0x7')]('/',auth[_0x780c('0x8')](),controller[_0x780c('0x9')]);router[_0x780c('0x7')](_0x780c('0xa'),auth[_0x780c('0x8')](),controller[_0x780c('0xb')]);router[_0x780c('0x7')](_0x780c('0xc'),auth['isAuthenticated'](),controller[_0x780c('0xd')]);var upload=multer({'storage':multer[_0x780c('0xe')]({'destination':function(_0x5c1ec3,_0x232f41,_0x43cdde){_0x43cdde(null,path[_0x780c('0xf')](config['root'],_0x780c('0x10')));},'filename':function(_0x353b4a,_0x46631e,_0x24fe4e){_0x24fe4e(null,util[_0x780c('0x11')](_0x780c('0x12'),Date[_0x780c('0x13')](),_0x46631e[_0x780c('0x14')][_0x780c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x780c('0x16')]('/',upload[_0x780c('0x17')](_0x780c('0x18')),controller['create']);router['put'](_0x780c('0xa'),auth[_0x780c('0x8')](),controller['update']);router['delete'](_0x780c('0xa'),auth[_0x780c('0x8')](),controller[_0x780c('0x19')]);module[_0x780c('0x1a')]=router; \ No newline at end of file +var _0x85b5=['originalname','replace','single','file','create','put','update','multer','util','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','server/files/attachments/','format','now'];(function(_0x14b5dc,_0x18585e){var _0x1bec32=function(_0x46bbb8){while(--_0x46bbb8){_0x14b5dc['push'](_0x14b5dc['shift']());}};_0x1bec32(++_0x18585e);}(_0x85b5,0x7f));var _0x585b=function(_0xe4cfe8,_0x37b1f5){_0xe4cfe8=_0xe4cfe8-0x0;var _0x502759=_0x85b5[_0xe4cfe8];return _0x502759;};'use strict';var multer=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));var path=require('path');var timeout=require(_0x585b('0x2'));var express=require('express');var router=express[_0x585b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x585b('0x4'));var controller=require('./attachment.controller');router[_0x585b('0x5')]('/',auth[_0x585b('0x6')](),controller[_0x585b('0x7')]);router['get'](_0x585b('0x8'),auth['isAuthenticated'](),controller[_0x585b('0x9')]);router[_0x585b('0x5')](_0x585b('0xa'),auth[_0x585b('0x6')](),controller['download']);var upload=multer({'storage':multer[_0x585b('0xb')]({'destination':function(_0x7974e6,_0x430c16,_0x4d86cc){_0x4d86cc(null,path[_0x585b('0xc')](config[_0x585b('0xd')],_0x585b('0xe')));},'filename':function(_0x5dda1f,_0x133d83,_0x4d63c3){_0x4d63c3(null,util[_0x585b('0xf')]('%s-%s',Date[_0x585b('0x10')](),_0x133d83[_0x585b('0x11')][_0x585b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x585b('0x13')](_0x585b('0x14')),controller[_0x585b('0x15')]);router[_0x585b('0x16')](_0x585b('0x8'),auth[_0x585b('0x6')](),controller[_0x585b('0x17')]);router['delete'](_0x585b('0x8'),auth[_0x585b('0x6')](),controller['destroy']);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 1965ae5..5a2c3aa 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 _0x044a=['catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','/login','profile','callback','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map','emails','value','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','minutes','clearBlockUser','getLicense'];(function(_0x5d6270,_0x83b57a){var _0x168f26=function(_0x258a27){while(--_0x258a27){_0x5d6270['push'](_0x5d6270['shift']());}};_0x168f26(++_0x83b57a);}(_0x044a,0x173));var _0xa044=function(_0x12302d,_0xf1928e){_0x12302d=_0x12302d-0x0;var _0x2b8536=_0x044a[_0x12302d];return _0x2b8536;};'use strict';var _=require(_0xa044('0x0'));var passport=require(_0xa044('0x1'));var GoogleStrategy=require(_0xa044('0x2'))[_0xa044('0x3')];var moment=require(_0xa044('0x4'));var db=require(_0xa044('0x5'))['db'];var config=require(_0xa044('0x6'));var signToken=require(_0xa044('0x7'))[_0xa044('0x8')];var utils=require(_0xa044('0x9'));exports['login']=passport[_0xa044('0xa')](_0xa044('0xb'),{'failureRedirect':_0xa044('0xc'),'scope':[_0xa044('0xd'),'email'],'session':![]});exports[_0xa044('0xe')]=passport[_0xa044('0xa')](_0xa044('0xb'),{'failureRedirect':_0xa044('0xc'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0xa044('0xb')]?config[_0xa044('0xb')][_0xa044('0xf')]:'id','clientSecret':config['google']?config[_0xa044('0xb')][_0xa044('0x10')]:_0xa044('0x11'),'callbackURL':config[_0xa044('0xb')]?config['google'][_0xa044('0x12')]:''},function(_0x51957a,_0x4cbae2,_0x1ee43,_0x3e05cf){var _0x2b73a1,_0x344c7d;return db[_0xa044('0x13')][_0xa044('0x14')]({'where':{'id':0x1},'attributes':[_0xa044('0x15'),'blockDuration'],'raw':!![]})[_0xa044('0x16')](function(_0x56c7c2){_0x2b73a1=_0x56c7c2;return db[_0xa044('0x17')][_0xa044('0x18')]({'where':{'email':_[_0xa044('0x19')](_0x1ee43[_0xa044('0x1a')],_0xa044('0x1b')),'role':{'$or':['admin','user',_0xa044('0x1c')]}}});})['then'](function(_0x3ca144){_0x344c7d=_0x3ca144;if(_0x344c7d){if(_0x344c7d[_0xa044('0x1d')]){return _0x3e05cf(_0xa044('0x1e'));}else if(_0x2b73a1[_0xa044('0x1f')]>0x0){if(_0x344c7d[_0xa044('0x20')]){if(moment(_0x344c7d['blockedAt'])['add'](_0x2b73a1['blockDuration'],_0xa044('0x21'))>moment()){return _0x3e05cf(_0xa044('0x1e'));}else{return utils[_0xa044('0x22')](_0x344c7d,0x0,![],null)['then'](function(){return utils[_0xa044('0x23')](_0x344c7d);})[_0xa044('0x16')](function(){return _0x3e05cf(null,_0x344c7d);});}}else{return utils['getLicense'](_0x344c7d)[_0xa044('0x16')](function(){return _0x3e05cf(null,_0x344c7d);});}}else{return utils[_0xa044('0x23')](_0x344c7d)[_0xa044('0x16')](function(){return _0x3e05cf(null,_0x344c7d);});}}return _0x3e05cf('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xa044('0x24')](function(_0x966548){_0x3e05cf(_0x966548);});})); \ No newline at end of file +var _0x624c=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','../../config/utils','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','allowedLoginAttempts','then','User','find','map','emails','admin','user','agent','disabled','blockDuration','blocked','add'];(function(_0x2d3040,_0x129c56){var _0x4c85b6=function(_0x26bfae){while(--_0x26bfae){_0x2d3040['push'](_0x2d3040['shift']());}};_0x4c85b6(++_0x129c56);}(_0x624c,0x1ee));var _0xc624=function(_0x36b535,_0x2fb432){_0x36b535=_0x36b535-0x0;var _0xd347ec=_0x624c[_0x36b535];return _0xd347ec;};'use strict';var _=require('lodash');var passport=require(_0xc624('0x0'));var GoogleStrategy=require(_0xc624('0x1'))[_0xc624('0x2')];var moment=require(_0xc624('0x3'));var db=require(_0xc624('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xc624('0x5'))['signToken'];var utils=require(_0xc624('0x6'));exports['login']=passport[_0xc624('0x7')](_0xc624('0x8'),{'failureRedirect':_0xc624('0x9'),'scope':[_0xc624('0xa'),_0xc624('0xb')],'session':![]});exports[_0xc624('0xc')]=passport[_0xc624('0x7')]('google',{'failureRedirect':_0xc624('0x9'),'session':![]});passport[_0xc624('0xd')](new GoogleStrategy({'clientID':config[_0xc624('0x8')]?config['google'][_0xc624('0xe')]:'id','clientSecret':config[_0xc624('0x8')]?config['google'][_0xc624('0xf')]:_0xc624('0x10'),'callbackURL':config[_0xc624('0x8')]?config[_0xc624('0x8')][_0xc624('0x11')]:''},function(_0x558b51,_0x42760a,_0x25e874,_0xef673c){var _0x1a0f3d,_0x49c1e3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xc624('0x12'),'blockDuration'],'raw':!![]})[_0xc624('0x13')](function(_0x5c236e){_0x1a0f3d=_0x5c236e;return db[_0xc624('0x14')][_0xc624('0x15')]({'where':{'email':_[_0xc624('0x16')](_0x25e874[_0xc624('0x17')],'value'),'role':{'$or':[_0xc624('0x18'),_0xc624('0x19'),_0xc624('0x1a')]}}});})['then'](function(_0x190458){_0x49c1e3=_0x190458;if(_0x49c1e3){if(_0x49c1e3[_0xc624('0x1b')]){return _0xef673c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x1a0f3d[_0xc624('0x1c')]>0x0){if(_0x49c1e3[_0xc624('0x1d')]){if(moment(_0x49c1e3['blockedAt'])[_0xc624('0x1e')](_0x1a0f3d['blockDuration'],'minutes')>moment()){return _0xef673c(_0xc624('0x1f'));}else{return utils[_0xc624('0x20')](_0x49c1e3,0x0,![],null)[_0xc624('0x13')](function(){return utils[_0xc624('0x21')](_0x49c1e3);})[_0xc624('0x13')](function(){return _0xef673c(null,_0x49c1e3);});}}else{return utils['getLicense'](_0x49c1e3)[_0xc624('0x13')](function(){return _0xef673c(null,_0x49c1e3);});}}else{return utils[_0xc624('0x21')](_0x49c1e3)[_0xc624('0x13')](function(){return _0xef673c(null,_0x49c1e3);});}}return _0xef673c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xc624('0x22')](function(_0x5f0ac3){_0xef673c(_0x5f0ac3);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7746591..05e7b2f 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 _0x279c=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x420c7c,_0x2b7485){var _0x57f47d=function(_0x6240){while(--_0x6240){_0x420c7c['push'](_0x420c7c['shift']());}};_0x57f47d(++_0x2b7485);}(_0x279c,0x193));var _0xc279=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x279c[_0x174ef5];return _0x1cc379;};'use strict';var express=require(_0xc279('0x0'));var passport=require(_0xc279('0x1'));var router=express[_0xc279('0x2')]();var controller=require(_0xc279('0x3'));var userController=require(_0xc279('0x4'));var authService=require(_0xc279('0x5'));router[_0xc279('0x6')]('/',controller[_0xc279('0x7')]);router[_0xc279('0x6')](_0xc279('0x8'),controller[_0xc279('0x9')],authService[_0xc279('0xa')],userController[_0xc279('0x7')],authService[_0xc279('0xb')]);module['exports']=router; \ No newline at end of file +var _0x39b0=['callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router','../user/user.controller.js','get'];(function(_0x5242e0,_0x359cd5){var _0x4f3b92=function(_0xafcf53){while(--_0xafcf53){_0x5242e0['push'](_0x5242e0['shift']());}};_0x4f3b92(++_0x359cd5);}(_0x39b0,0x181));var _0x039b=function(_0x28234a,_0x281983){_0x28234a=_0x28234a-0x0;var _0x2c0398=_0x39b0[_0x28234a];return _0x2c0398;};'use strict';var express=require(_0x039b('0x0'));var passport=require(_0x039b('0x1'));var router=express[_0x039b('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x039b('0x3'));var authService=require('../../components/auth/service');router[_0x039b('0x4')]('/',controller['login']);router[_0x039b('0x4')]('/callback',controller[_0x039b('0x5')],authService[_0x039b('0x6')],userController[_0x039b('0x7')],authService[_0x039b('0x8')]);module[_0x039b('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 06043cc..8bd9b38 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 _0x8031=['/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordExpires','use','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','Setting','findOne','name','salt','role','disabled','blocked','blockedAt','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blockDuration','add','minutes','allowedLoginAttempts','clearBlockUser','getLicense','catch','email','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','pass','merge','error','format','message','stringify','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','authenticate','local','forgot','body','Email\x20parameter\x20is\x20missing','trim','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers'];(function(_0x252ee8,_0x187932){var _0x3fd5e1=function(_0x22e7ab){while(--_0x22e7ab){_0x252ee8['push'](_0x252ee8['shift']());}};_0x3fd5e1(++_0x187932);}(_0x8031,0x137));var _0x1803=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8031[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var passport=require(_0x1803('0x0'));var LocalStrategy=require('passport-local')[_0x1803('0x1')];var jayson=require(_0x1803('0x2'));var _=require(_0x1803('0x3'));var rs=require(_0x1803('0x4'));var moment=require(_0x1803('0x5'));var db=require(_0x1803('0x6'))['db'];var signToken=require(_0x1803('0x7'))[_0x1803('0x8')];var utils=require(_0x1803('0x9'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x53cfc6,_0x1e5c57,_0x555701,_0x2e03b0){var _0x2f095f,_0xf61a1a;return db[_0x1803('0xa')][_0x1803('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x5f61e2){_0x2f095f=_0x5f61e2;return _0x53cfc6['findOne']({'attributes':['id',_0x1803('0xc'),'password',_0x1803('0xd'),_0x1803('0xe'),_0x1803('0xf'),_0x1803('0x10'),_0x1803('0x11'),'loginAttempts'],'where':{'name':_0x1e5c57,'role':{'$or':[_0x1803('0x12'),_0x1803('0x13'),_0x1803('0x14')]}}});})[_0x1803('0x15')](function(_0x13097c){if(!_0x13097c||_0x13097c&&_0x13097c[_0x1803('0xc')]!==_0x1e5c57){throw new Error(_0x1803('0x16'));}else{_0xf61a1a=_0x13097c;return _0xf61a1a;}})[_0x1803('0x15')](function(){_0xf61a1a['authenticate'](_0x555701,function(_0x4515a8,_0x34285b){var _0x51482d=_0xf61a1a[_0x1803('0x17')]+0x1;if(_0x4515a8){return _0x2e03b0(_0x4515a8);}else if(!_0x34285b){if(_0xf61a1a[_0x1803('0xf')]){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});}else if(_0x2f095f['allowedLoginAttempts']>0x0){if(_0xf61a1a[_0x1803('0x10')]){if(_0x2f095f[_0x1803('0x18')]>0x0){if(moment(_0xf61a1a[_0x1803('0x11')])[_0x1803('0x19')](_0x2f095f[_0x1803('0x18')],_0x1803('0x1a'))>moment()){return _0x2e03b0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0xf61a1a,_0x51482d,![],null)[_0x1803('0x15')](function(){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});});}}else{return _0x2e03b0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x51482d>=_0x2f095f[_0x1803('0x1b')]){return utils[_0x1803('0x1c')](_0xf61a1a,0x0,!![],moment())['then'](function(){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});});}else{return utils['clearBlockUser'](_0xf61a1a,_0x51482d,![],null)['then'](function(){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});});}}}else{return _0x2e03b0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xf61a1a[_0x1803('0xf')]){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});}else if(_0x2f095f[_0x1803('0x1b')]>0x0){if(_0xf61a1a[_0x1803('0x10')]){if(_0x2f095f[_0x1803('0x18')]>0x0){if(moment(_0xf61a1a[_0x1803('0x11')])[_0x1803('0x19')](_0x2f095f[_0x1803('0x18')],'minutes')>moment()){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});}else{return utils[_0x1803('0x1c')](_0xf61a1a,0x0,![],null)[_0x1803('0x15')](function(){return utils[_0x1803('0x1d')](_0xf61a1a);})[_0x1803('0x15')](function(){return _0x2e03b0(null,_0xf61a1a);});}}else{return _0x2e03b0(null,![],{'message':_0x1803('0x16')});}}else{return utils[_0x1803('0x1c')](_0xf61a1a,0x0,![],null)[_0x1803('0x15')](function(){return utils[_0x1803('0x1d')](_0xf61a1a);})[_0x1803('0x15')](function(){return _0x2e03b0(null,_0xf61a1a);})[_0x1803('0x1e')](function(_0x5df02b){return _0x2e03b0(null,![],_0x5df02b);});}}else{if(_0xf61a1a[_0x1803('0x10')]){return _0x2e03b0(null,![],{'message':_0x1803('0x16')});}else{return utils[_0x1803('0x1d')](_0xf61a1a)['then'](function(){return _0x2e03b0(null,_0xf61a1a);});}}}});})['catch'](function(_0x54f160){return _0x2e03b0(null,![],_0x54f160);});}function sendServiceMail(_0x159ab9){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x1803('0xc'),_0x1803('0x1f')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x1803('0x15')](function(_0x41ad2a){if(!_0x41ad2a){throw new Error(_0x1803('0x20'));}var _0xa76305={'tls':{'rejectUnauthorized':![]}};if(_0x41ad2a[_0x1803('0x21')]['service']){_0xa76305['service']=_0x41ad2a['Smtp'][_0x1803('0x22')];}else{_0xa76305[_0x1803('0x23')]=_0x41ad2a[_0x1803('0x21')]['host'];_0xa76305[_0x1803('0x24')]=_0x41ad2a[_0x1803('0x21')]['port'];_0xa76305[_0x1803('0x25')]=_0x41ad2a[_0x1803('0x21')][_0x1803('0x25')];}if(_0x41ad2a['Smtp'][_0x1803('0x26')]){_0xa76305['auth']={'user':_0x41ad2a[_0x1803('0x21')][_0x1803('0x13')],'pass':_0x41ad2a['Smtp'][_0x1803('0x27')]};}var _0x3e2875={'account':_0xa76305,'message':_[_0x1803('0x28')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x41ad2a[_0x1803('0xc')],_0x41ad2a[_0x1803('0x1f')]||_0x41ad2a[_0x1803('0x21')][_0x1803('0x13')])},_0x159ab9)};return client['request']('SendMail',_0x3e2875);})[_0x1803('0x15')](function(_0x599372){if(_0x599372[_0x1803('0x29')]){throw new Error(util[_0x1803('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x599372[_0x1803('0x29')][_0x1803('0x2b')]||JSON[_0x1803('0x2c')](_0x599372[_0x1803('0x29')])));}return!![];});}function handleError(_0x225dee,_0x1ac857,_0x2319b0){return _0x225dee['status'](_0x1ac857||0x1f4)[_0x1803('0x2d')]({'message':_0x2319b0?_0x2319b0['message']||_0x2319b0:''});}function checkPasswordPattern(_0x5a946f,_0x445a97,_0x133818){if(_0x133818){var _0x512e14=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x512e14[_0x1803('0x2e')](_0x445a97)){return _0x5a946f;}else{throw new Error(_0x1803('0x2f'));}}else{return _0x5a946f;}}exports[_0x1803('0x30')]=function(_0x452346,_0x5aaf32,_0x1a4e4e){passport[_0x1803('0x31')](_0x1803('0x32'),function(_0x381854,_0x5313fd,_0x874448){var _0x5a397a=_0x381854||_0x874448;if(_0x5a397a){return handleError(_0x5aaf32,0x191,_0x5a397a);}if(!_0x5313fd){return handleError(_0x5aaf32,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x424c6a=signToken(_0x5313fd['id'],_0x5313fd[_0x1803('0xe')]);_0x5aaf32['json']({'id':_0x5313fd['id'],'token':_0x424c6a,'statusCall':'','isAlreadyLogged':_0x5313fd['online']});}})(_0x452346,_0x5aaf32,_0x1a4e4e);};exports[_0x1803('0x33')]=function(_0x2a6afa,_0x1a87ef,_0xdf11ce){if(!_0x2a6afa[_0x1803('0x34')][_0x1803('0x1f')]){return handleError(_0x1a87ef,0x1f4,{'message':_0x1803('0x35')});}var _0x19e289=rs['generate']();_0x2a6afa[_0x1803('0x34')]['email']=_0x2a6afa[_0x1803('0x34')][_0x1803('0x1f')][_0x1803('0x36')]()['toLowerCase']();var _0x36f81a;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1803('0x18')],'raw':!![]})[_0x1803('0x15')](function(_0x5654eb){_0x36f81a=_0x5654eb;return db[_0x1803('0x37')][_0x1803('0x38')]({'where':{'email':_0x2a6afa[_0x1803('0x34')][_0x1803('0x1f')]}});})['then'](function(_0x26f71f){if(!_0x26f71f){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x26f71f[_0x1803('0xf')]){throw new Error(_0x1803('0x39'));}if(_0x26f71f[_0x1803('0x10')]){if(moment(_0x26f71f[_0x1803('0x11')])['add'](_0x36f81a[_0x1803('0x18')],'minutes')>moment()){throw new Error(_0x1803('0x3a'));}else{_0x26f71f[_0x1803('0x10')]=![];_0x26f71f[_0x1803('0x11')]=null;}}_0x26f71f[_0x1803('0x3b')]=_0x19e289;_0x26f71f['resetPasswordExpires']=Date[_0x1803('0x3c')]()+0x36ee80;return _0x26f71f[_0x1803('0x3d')]();})[_0x1803('0x15')](function(){return sendServiceMail({'to':_0x2a6afa[_0x1803('0x34')][_0x1803('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x1803('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'http://'+_0x2a6afa[_0x1803('0x3f')][_0x1803('0x23')]+_0x1803('0x40')+_0x19e289+'\x0a\x0a'+_0x1803('0x41')});})['then'](function(){_0x1a87ef[_0x1803('0x42')](0xc8)[_0x1803('0x2d')]({'message':_0x1803('0x43')});})[_0x1803('0x1e')](function(_0x3a4171){return handleError(_0x1a87ef,0x1f4,_0x3a4171);});};exports[_0x1803('0x44')]=function(_0x35e592,_0x1ec62c,_0xf559c0){var _0xd76e44;return db['User'][_0x1803('0x38')]({'where':{'resetPasswordToken':_0x35e592[_0x1803('0x45')][_0x1803('0x46')],'resetPasswordExpires':{'$gt':Date[_0x1803('0x3c')]()}}})['then'](function(_0x44e05c){_0xd76e44=_0x44e05c;if(!_0xd76e44){throw new Error(_0x1803('0x47'));}return db[_0x1803('0xa')][_0x1803('0xb')]({'attributes':['id','securePassword']});})['then'](function(_0x1251ef){return checkPasswordPattern(_0x1251ef,_0x35e592[_0x1803('0x34')]['password'],_0x1251ef[_0x1803('0x48')]);})[_0x1803('0x15')](function(){_0xd76e44['password']=_0x35e592['body']['password'];_0xd76e44[_0x1803('0x3b')]=null;_0xd76e44[_0x1803('0x49')]=null;return _0xd76e44[_0x1803('0x3d')]();})[_0x1803('0x15')](function(){_0x1ec62c[_0x1803('0x42')](0xc8)[_0x1803('0x2d')]({'message':'Password\x20reset!'});})[_0x1803('0x1e')](function(_0xb0461c){return handleError(_0x1ec62c,0x1f4,_0xb0461c);});};passport[_0x1803('0x4a')](new LocalStrategy({'usernameField':_0x1803('0xc'),'passwordField':'password'},function(_0x4c3909,_0x4f3d16,_0xbb33ab){return localAuthenticate(db[_0x1803('0x37')],_0x4c3909,_0x4f3d16,_0xbb33ab);})); \ No newline at end of file +var _0xc164=['allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','service','host','port','secure','auth','merge','format','\x22%s\x22\x20<%s>','SendMail','error','message','stringify','status','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','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','headers','/reset/','send','Reset\x20Email\x20sent!','reset','params','token','securePassword','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','client','Setting','findOne'];(function(_0x4dad2f,_0x22bf99){var _0x292c4c=function(_0x36498f){while(--_0x36498f){_0x4dad2f['push'](_0x4dad2f['shift']());}};_0x292c4c(++_0x22bf99);}(_0xc164,0x1d1));var _0x4c16=function(_0x3ab425,_0x578258){_0x3ab425=_0x3ab425-0x0;var _0x192a59=_0xc164[_0x3ab425];return _0x192a59;};'use strict';var util=require(_0x4c16('0x0'));var passport=require(_0x4c16('0x1'));var LocalStrategy=require(_0x4c16('0x2'))[_0x4c16('0x3')];var jayson=require(_0x4c16('0x4'));var _=require(_0x4c16('0x5'));var rs=require(_0x4c16('0x6'));var moment=require(_0x4c16('0x7'));var db=require(_0x4c16('0x8'))['db'];var signToken=require(_0x4c16('0x9'))[_0x4c16('0xa')];var utils=require(_0x4c16('0xb'));var client=jayson[_0x4c16('0xc')]['http']({'port':0x232b});function localAuthenticate(_0x47790e,_0x5814cc,_0x1127d5,_0x1f0849){var _0x1aa291,_0x21dcb5;return db[_0x4c16('0xd')][_0x4c16('0xe')]({'where':{'id':0x1},'attributes':[_0x4c16('0xf'),'blockDuration'],'raw':!![]})[_0x4c16('0x10')](function(_0x27ab0d){_0x1aa291=_0x27ab0d;return _0x47790e[_0x4c16('0xe')]({'attributes':['id',_0x4c16('0x11'),_0x4c16('0x12'),'salt',_0x4c16('0x13'),_0x4c16('0x14'),_0x4c16('0x15'),_0x4c16('0x16'),_0x4c16('0x17')],'where':{'name':_0x5814cc,'role':{'$or':[_0x4c16('0x18'),_0x4c16('0x19'),_0x4c16('0x1a')]}}});})[_0x4c16('0x10')](function(_0x1dc471){if(!_0x1dc471||_0x1dc471&&_0x1dc471[_0x4c16('0x11')]!==_0x5814cc){throw new Error(_0x4c16('0x1b'));}else{_0x21dcb5=_0x1dc471;return _0x21dcb5;}})[_0x4c16('0x10')](function(){_0x21dcb5[_0x4c16('0x1c')](_0x1127d5,function(_0x4b9102,_0x62e751){var _0x8cd9c2=_0x21dcb5[_0x4c16('0x17')]+0x1;if(_0x4b9102){return _0x1f0849(_0x4b9102);}else if(!_0x62e751){if(_0x21dcb5[_0x4c16('0x14')]){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}else if(_0x1aa291[_0x4c16('0xf')]>0x0){if(_0x21dcb5[_0x4c16('0x15')]){if(_0x1aa291[_0x4c16('0x1d')]>0x0){if(moment(_0x21dcb5[_0x4c16('0x16')])[_0x4c16('0x1e')](_0x1aa291[_0x4c16('0x1d')],_0x4c16('0x1f'))>moment()){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}else{return utils[_0x4c16('0x20')](_0x21dcb5,_0x8cd9c2,![],null)['then'](function(){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});});}}else{return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}}else{if(_0x8cd9c2>=_0x1aa291[_0x4c16('0xf')]){return utils[_0x4c16('0x20')](_0x21dcb5,0x0,!![],moment())[_0x4c16('0x10')](function(){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});});}else{return utils['clearBlockUser'](_0x21dcb5,_0x8cd9c2,![],null)[_0x4c16('0x10')](function(){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});});}}}else{return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}}else{if(_0x21dcb5['disabled']){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}else if(_0x1aa291['allowedLoginAttempts']>0x0){if(_0x21dcb5[_0x4c16('0x15')]){if(_0x1aa291[_0x4c16('0x1d')]>0x0){if(moment(_0x21dcb5['blockedAt'])['add'](_0x1aa291[_0x4c16('0x1d')],'minutes')>moment()){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}else{return utils[_0x4c16('0x20')](_0x21dcb5,0x0,![],null)[_0x4c16('0x10')](function(){return utils[_0x4c16('0x21')](_0x21dcb5);})[_0x4c16('0x10')](function(){return _0x1f0849(null,_0x21dcb5);});}}else{return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}}else{return utils[_0x4c16('0x20')](_0x21dcb5,0x0,![],null)[_0x4c16('0x10')](function(){return utils[_0x4c16('0x21')](_0x21dcb5);})[_0x4c16('0x10')](function(){return _0x1f0849(null,_0x21dcb5);})[_0x4c16('0x22')](function(_0x30f18a){return _0x1f0849(null,![],_0x30f18a);});}}else{if(_0x21dcb5['blocked']){return _0x1f0849(null,![],{'message':_0x4c16('0x1b')});}else{return utils[_0x4c16('0x21')](_0x21dcb5)[_0x4c16('0x10')](function(){return _0x1f0849(null,_0x21dcb5);});}}}});})['catch'](function(_0x3123bf){return _0x1f0849(null,![],_0x3123bf);});}function sendServiceMail(_0x2eaced){return db['MailAccount'][_0x4c16('0x23')]({'where':{'service':!![]},'attributes':['id',_0x4c16('0x11'),_0x4c16('0x24')],'include':[{'model':db['MailServerOut'],'as':_0x4c16('0x25')}]})[_0x4c16('0x10')](function(_0x504efe){if(!_0x504efe){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x25b0dd={'tls':{'rejectUnauthorized':![]}};if(_0x504efe[_0x4c16('0x25')][_0x4c16('0x26')]){_0x25b0dd['service']=_0x504efe[_0x4c16('0x25')][_0x4c16('0x26')];}else{_0x25b0dd['host']=_0x504efe[_0x4c16('0x25')][_0x4c16('0x27')];_0x25b0dd['port']=_0x504efe[_0x4c16('0x25')][_0x4c16('0x28')];_0x25b0dd['secure']=_0x504efe[_0x4c16('0x25')][_0x4c16('0x29')];}if(_0x504efe['Smtp']['authentication']){_0x25b0dd[_0x4c16('0x2a')]={'user':_0x504efe['Smtp'][_0x4c16('0x19')],'pass':_0x504efe['Smtp']['pass']};}var _0x5b2843={'account':_0x25b0dd,'message':_[_0x4c16('0x2b')]({'from':util[_0x4c16('0x2c')](_0x4c16('0x2d'),_0x504efe[_0x4c16('0x11')],_0x504efe[_0x4c16('0x24')]||_0x504efe['Smtp']['user'])},_0x2eaced)};return client['request'](_0x4c16('0x2e'),_0x5b2843);})['then'](function(_0x59c420){if(_0x59c420[_0x4c16('0x2f')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x59c420[_0x4c16('0x2f')][_0x4c16('0x30')]||JSON[_0x4c16('0x31')](_0x59c420[_0x4c16('0x2f')])));}return!![];});}function handleError(_0x35eea5,_0x33926a,_0x1a3465){return _0x35eea5[_0x4c16('0x32')](_0x33926a||0x1f4)['send']({'message':_0x1a3465?_0x1a3465[_0x4c16('0x30')]||_0x1a3465:''});}function checkPasswordPattern(_0x14b984,_0x1feb07,_0x21d6b0){if(_0x21d6b0){var _0x3399a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3399a4[_0x4c16('0x33')](_0x1feb07)){return _0x14b984;}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 _0x14b984;}}exports[_0x4c16('0x34')]=function(_0x3c94a5,_0x49a90b,_0x39b6f2){passport[_0x4c16('0x1c')](_0x4c16('0x35'),function(_0x9ce709,_0x4f35ad,_0x54b797){var _0x54cc9f=_0x9ce709||_0x54b797;if(_0x54cc9f){return handleError(_0x49a90b,0x191,_0x54cc9f);}if(!_0x4f35ad){return handleError(_0x49a90b,0x194,{'message':_0x4c16('0x36')});}else{var _0x3d9be2=signToken(_0x4f35ad['id'],_0x4f35ad[_0x4c16('0x13')]);_0x49a90b[_0x4c16('0x37')]({'id':_0x4f35ad['id'],'token':_0x3d9be2,'statusCall':'','isAlreadyLogged':_0x4f35ad[_0x4c16('0x38')]});}})(_0x3c94a5,_0x49a90b,_0x39b6f2);};exports[_0x4c16('0x39')]=function(_0x3a90e1,_0x2ed0f3,_0x331865){if(!_0x3a90e1[_0x4c16('0x3a')]['email']){return handleError(_0x2ed0f3,0x1f4,{'message':_0x4c16('0x3b')});}var _0x2eef11=rs[_0x4c16('0x3c')]();_0x3a90e1[_0x4c16('0x3a')][_0x4c16('0x24')]=_0x3a90e1[_0x4c16('0x3a')][_0x4c16('0x24')][_0x4c16('0x3d')]()['toLowerCase']();var _0x372ace;return db[_0x4c16('0xd')][_0x4c16('0xe')]({'where':{'id':0x1},'attributes':[_0x4c16('0xf'),'blockDuration'],'raw':!![]})[_0x4c16('0x10')](function(_0x47985b){_0x372ace=_0x47985b;return db[_0x4c16('0x3e')][_0x4c16('0x23')]({'where':{'email':_0x3a90e1[_0x4c16('0x3a')]['email']}});})[_0x4c16('0x10')](function(_0x5c2620){if(!_0x5c2620){throw new Error(_0x4c16('0x3f'));}if(_0x5c2620[_0x4c16('0x14')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5c2620[_0x4c16('0x15')]){if(moment(_0x5c2620[_0x4c16('0x16')])[_0x4c16('0x1e')](_0x372ace[_0x4c16('0x1d')],_0x4c16('0x1f'))>moment()){throw new Error(_0x4c16('0x40'));}else{_0x5c2620[_0x4c16('0x15')]=![];_0x5c2620['blockedAt']=null;}}_0x5c2620[_0x4c16('0x41')]=_0x2eef11;_0x5c2620['resetPasswordExpires']=Date[_0x4c16('0x42')]()+0x36ee80;return _0x5c2620[_0x4c16('0x43')]();})['then'](function(){return sendServiceMail({'to':_0x3a90e1['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x4c16('0x44')+_0x4c16('0x45')+'http://'+_0x3a90e1[_0x4c16('0x46')][_0x4c16('0x27')]+_0x4c16('0x47')+_0x2eef11+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x4c16('0x10')](function(){_0x2ed0f3[_0x4c16('0x32')](0xc8)[_0x4c16('0x48')]({'message':_0x4c16('0x49')});})['catch'](function(_0x190ad9){return handleError(_0x2ed0f3,0x1f4,_0x190ad9);});};exports[_0x4c16('0x4a')]=function(_0x1dcfdc,_0xc03b2c,_0x390e66){var _0x1f4309;return db[_0x4c16('0x3e')]['find']({'where':{'resetPasswordToken':_0x1dcfdc[_0x4c16('0x4b')][_0x4c16('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x4c16('0x42')]()}}})[_0x4c16('0x10')](function(_0x3fb68e){_0x1f4309=_0x3fb68e;if(!_0x1f4309){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x4c16('0xe')]({'attributes':['id',_0x4c16('0x4d')]});})[_0x4c16('0x10')](function(_0xeb2683){return checkPasswordPattern(_0xeb2683,_0x1dcfdc[_0x4c16('0x3a')][_0x4c16('0x12')],_0xeb2683[_0x4c16('0x4d')]);})['then'](function(){_0x1f4309[_0x4c16('0x12')]=_0x1dcfdc[_0x4c16('0x3a')][_0x4c16('0x12')];_0x1f4309[_0x4c16('0x41')]=null;_0x1f4309['resetPasswordExpires']=null;return _0x1f4309[_0x4c16('0x43')]();})['then'](function(){_0xc03b2c[_0x4c16('0x32')](0xc8)['send']({'message':_0x4c16('0x4e')});})[_0x4c16('0x22')](function(_0x43e9fe){return handleError(_0xc03b2c,0x1f4,_0x43e9fe);});};passport[_0x4c16('0x4f')](new LocalStrategy({'usernameField':_0x4c16('0x11'),'passwordField':_0x4c16('0x12')},function(_0xe8fb5e,_0x2aaddc,_0x51e4da){return localAuthenticate(db['User'],_0xe8fb5e,_0x2aaddc,_0x51e4da);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4e6687e..f814372 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 _0x33f2=['express','Router','post','forgot','/reset/:token'];(function(_0x2e43e1,_0x2ffef1){var _0x6af74a=function(_0x4f2d2a){while(--_0x4f2d2a){_0x2e43e1['push'](_0x2e43e1['shift']());}};_0x6af74a(++_0x2ffef1);}(_0x33f2,0x96));var _0x233f=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x33f2[_0x2bda14];return _0xb5dd49;};'use strict';var express=require(_0x233f('0x0'));var router=express[_0x233f('0x1')]();var controller=require('./authLocal.controller');router[_0x233f('0x2')]('/',controller['login']);router[_0x233f('0x2')]('/forgot',controller[_0x233f('0x3')]);router[_0x233f('0x2')](_0x233f('0x4'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0xfa19=['forgot','post','reset','exports','express','Router'];(function(_0x21b054,_0xe2e144){var _0x5ae4b9=function(_0x2928ab){while(--_0x2928ab){_0x21b054['push'](_0x21b054['shift']());}};_0x5ae4b9(++_0xe2e144);}(_0xfa19,0x1d2));var _0x9fa1=function(_0x147f37,_0x3ec880){_0x147f37=_0x147f37-0x0;var _0x341007=_0xfa19[_0x147f37];return _0x341007;};'use strict';var express=require(_0x9fa1('0x0'));var router=express[_0x9fa1('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router['post']('/forgot',controller[_0x9fa1('0x2')]);router[_0x9fa1('0x3')]('/reset/:token',controller[_0x9fa1('0x4')]);module[_0x9fa1('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 8817a78..0f9c771 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 _0x4f3c=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x4f3c[_0x15cae3];return _0x20596f;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'name':{'type':Sequelize[_0xc4f3('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xc4f3('0x2')]},'description':{'type':Sequelize[_0xc4f3('0x2')]},'status':{'type':Sequelize[_0xc4f3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc4f3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xbc87=['sequelize','STRING','BOOLEAN'];(function(_0xf54084,_0x561894){var _0x5cf05b=function(_0x91ba27){while(--_0x91ba27){_0xf54084['push'](_0xf54084['shift']());}};_0x5cf05b(++_0x561894);}(_0xbc87,0x144));var _0x7bc8=function(_0x1f3dcc,_0x39e9f9){_0x1f3dcc=_0x1f3dcc-0x0;var _0xf990ba=_0xbc87[_0x1f3dcc];return _0xf990ba;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x7bc8('0x1')]},'description':{'type':Sequelize[_0x7bc8('0x1')]},'status':{'type':Sequelize[_0x7bc8('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 92121f9..a92eece 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 _0x8b2a=['fields','length','nolimit','order','where','filters','pick','merge','map','type','key','VIRTUAL','field','filter','options','Automation','includeAll','include','findAll','catch','params','create','body','find','addConditions','Condition','ids','getConditions','findOne','sort','hasOwnProperty','addActions','Action','omit','getActions','eml-format','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','rawAttributes','keys','query','model','attributes','intersection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8b2a,0x1c2));var _0xa8b2=function(_0x9d2d2,_0x1c1c2c){_0x9d2d2=_0x9d2d2-0x0;var _0x488242=_0x8b2a[_0x9d2d2];return _0x488242;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa8b2('0x0'));var rimraf=require(_0xa8b2('0x1'));var zipdir=require(_0xa8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8b2('0x3'));var moment=require('moment');var BPromise=require(_0xa8b2('0x4'));var Mustache=require(_0xa8b2('0x5'));var util=require(_0xa8b2('0x6'));var path=require('path');var sox=require(_0xa8b2('0x7'));var csv=require(_0xa8b2('0x8'));var ejs=require(_0xa8b2('0x9'));var fs=require('fs');var _=require(_0xa8b2('0xa'));var squel=require(_0xa8b2('0xb'));var crypto=require(_0xa8b2('0xc'));var jsforce=require(_0xa8b2('0xd'));var deskjs=require(_0xa8b2('0xe'));var toCsv=require(_0xa8b2('0x8'));var querystring=require(_0xa8b2('0xf'));var Papa=require(_0xa8b2('0x10'));var Redis=require(_0xa8b2('0x11'));var authService=require(_0xa8b2('0x12'));var qs=require(_0xa8b2('0x13'));var hardwareService=require(_0xa8b2('0x14'));var logger=require(_0xa8b2('0x15'))(_0xa8b2('0x16'));var utils=require(_0xa8b2('0x17'));var config=require('../../config/environment');var db=require(_0xa8b2('0x18'))['db'];function respondWithStatusCode(_0x39bdf0,_0x799b4){_0x799b4=_0x799b4||0xcc;return function(_0x3f73bc){if(_0x3f73bc){return _0x39bdf0['sendStatus'](_0x799b4);}return _0x39bdf0[_0xa8b2('0x19')](_0x799b4)['end']();};}function respondWithResult(_0x552c1b,_0x2ffd90){_0x2ffd90=_0x2ffd90||0xc8;return function(_0x868d8c){if(_0x868d8c){return _0x552c1b[_0xa8b2('0x19')](_0x2ffd90)[_0xa8b2('0x1a')](_0x868d8c);}};}function respondWithFilteredResult(_0x450699,_0x7c4422){return function(_0x35fff1){if(_0x35fff1){var _0x10b945=_0x35fff1[_0xa8b2('0x1b')],_0xc7ad10=_0x7c4422[_0xa8b2('0x1c')],_0x4dbb40=_0x7c4422[_0xa8b2('0x1c')]+_0x7c4422[_0xa8b2('0x1d')],_0x19e408;if(_0x4dbb40>=_0x10b945){_0x4dbb40=_0x10b945;_0x19e408=0xc8;}else{_0x19e408=0xce;}_0x450699[_0xa8b2('0x19')](_0x19e408);return _0x450699[_0xa8b2('0x1e')](_0xa8b2('0x1f'),_0xc7ad10+'-'+_0x4dbb40+'/'+_0x10b945)[_0xa8b2('0x1a')](_0x35fff1);}return null;};}function patchUpdates(_0x225f69){return function(_0x1f3505){try{jsonpatch[_0xa8b2('0x20')](_0x1f3505,_0x225f69,!![]);}catch(_0x586e28){return BPromise[_0xa8b2('0x21')](_0x586e28);}return _0x1f3505[_0xa8b2('0x22')]();};}function saveUpdates(_0x3f4ddc,_0x22e788){return function(_0x12ed10){if(_0x12ed10){return _0x12ed10[_0xa8b2('0x23')](_0x3f4ddc)['then'](function(_0x397ba0){return _0x397ba0;});}return null;};}function removeEntity(_0x2f951c,_0x1d5649){return function(_0x394537){if(_0x394537){return _0x394537['destroy']()[_0xa8b2('0x24')](function(){_0x2f951c['status'](0xcc)[_0xa8b2('0x25')]();});}};}function handleEntityNotFound(_0x1c4d4a,_0x4faa70){return function(_0xa866e7){if(!_0xa866e7){_0x1c4d4a['sendStatus'](0x194);}return _0xa866e7;};}function handleError(_0x1f8c7e,_0x446110){_0x446110=_0x446110||0x1f4;return function(_0x6b5582){logger[_0xa8b2('0x26')](_0x6b5582[_0xa8b2('0x27')]);if(_0x6b5582[_0xa8b2('0x28')]){delete _0x6b5582[_0xa8b2('0x28')];}_0x1f8c7e[_0xa8b2('0x19')](_0x446110)['send'](_0x6b5582);};}exports[_0xa8b2('0x29')]=function(_0x46b682,_0x218214){var _0x3f7424={},_0x58a70a={},_0x14cae4={'count':0x0,'rows':[]};var _0x5588c9=db['Automation'][_0xa8b2('0x2a')];_0x58a70a['model']=_[_0xa8b2('0x2b')](_0x5588c9);_0x58a70a[_0xa8b2('0x2c')]=_[_0xa8b2('0x2b')](_0x46b682[_0xa8b2('0x2c')]);_0x58a70a['filters']=_['intersection'](_0x58a70a[_0xa8b2('0x2d')],_0x58a70a[_0xa8b2('0x2c')]);_0x3f7424[_0xa8b2('0x2e')]=_[_0xa8b2('0x2f')](_0x58a70a[_0xa8b2('0x2d')],qs['fields'](_0x46b682[_0xa8b2('0x2c')][_0xa8b2('0x30')]));_0x3f7424[_0xa8b2('0x2e')]=_0x3f7424['attributes'][_0xa8b2('0x31')]?_0x3f7424[_0xa8b2('0x2e')]:_0x58a70a['model'];if(!_0x46b682['query']['hasOwnProperty'](_0xa8b2('0x32'))){_0x3f7424[_0xa8b2('0x1d')]=qs['limit'](_0x46b682[_0xa8b2('0x2c')]['limit']);_0x3f7424['offset']=qs[_0xa8b2('0x1c')](_0x46b682[_0xa8b2('0x2c')][_0xa8b2('0x1c')]);}_0x3f7424[_0xa8b2('0x33')]=qs['sort'](_0x46b682['query']['sort']);_0x3f7424[_0xa8b2('0x34')]=qs[_0xa8b2('0x35')](_[_0xa8b2('0x36')](_0x46b682[_0xa8b2('0x2c')],_0x58a70a[_0xa8b2('0x35')]));if(_0x46b682[_0xa8b2('0x2c')]['filter']){_0x3f7424[_0xa8b2('0x34')]=_[_0xa8b2('0x37')](_0x3f7424[_0xa8b2('0x34')],{'$or':_[_0xa8b2('0x38')](_0x5588c9,function(_0x5376a0){if(_0x5376a0[_0xa8b2('0x39')][_0xa8b2('0x3a')]!==_0xa8b2('0x3b')){var _0x231570={};_0x231570[_0x5376a0[_0xa8b2('0x3c')]]={'$like':'%'+_0x46b682[_0xa8b2('0x2c')][_0xa8b2('0x3d')]+'%'};return _0x231570;}})});}_0x3f7424=_[_0xa8b2('0x37')]({},_0x3f7424,_0x46b682[_0xa8b2('0x3e')]);var _0xa3a911={'where':_0x3f7424[_0xa8b2('0x34')]};return db[_0xa8b2('0x3f')][_0xa8b2('0x1b')](_0xa3a911)[_0xa8b2('0x24')](function(_0x28b702){_0x14cae4[_0xa8b2('0x1b')]=_0x28b702;if(_0x46b682[_0xa8b2('0x2c')][_0xa8b2('0x40')]){_0x3f7424[_0xa8b2('0x41')]=[{'all':!![]}];}return db[_0xa8b2('0x3f')][_0xa8b2('0x42')](_0x3f7424);})[_0xa8b2('0x24')](function(_0x2565ae){_0x14cae4['rows']=_0x2565ae;return _0x14cae4;})[_0xa8b2('0x24')](respondWithFilteredResult(_0x218214,_0x3f7424))[_0xa8b2('0x43')](handleError(_0x218214,null));};exports['show']=function(_0x5d98c9,_0x394f99){var _0x346b8d={'raw':![],'where':{'id':_0x5d98c9[_0xa8b2('0x44')]['id']}},_0x73eb12={};_0x73eb12[_0xa8b2('0x2d')]=_[_0xa8b2('0x2b')](db[_0xa8b2('0x3f')]['rawAttributes']);_0x73eb12[_0xa8b2('0x2c')]=_[_0xa8b2('0x2b')](_0x5d98c9['query']);_0x73eb12[_0xa8b2('0x35')]=_[_0xa8b2('0x2f')](_0x73eb12[_0xa8b2('0x2d')],_0x73eb12['query']);_0x346b8d[_0xa8b2('0x2e')]=_[_0xa8b2('0x2f')](_0x73eb12[_0xa8b2('0x2d')],qs[_0xa8b2('0x30')](_0x5d98c9[_0xa8b2('0x2c')]['fields']));_0x346b8d[_0xa8b2('0x2e')]=_0x346b8d['attributes'][_0xa8b2('0x31')]?_0x346b8d[_0xa8b2('0x2e')]:_0x73eb12[_0xa8b2('0x2d')];if(_0x5d98c9[_0xa8b2('0x2c')][_0xa8b2('0x40')]){_0x346b8d[_0xa8b2('0x41')]=[{'all':!![]}];}_0x346b8d=_[_0xa8b2('0x37')]({},_0x346b8d,_0x5d98c9[_0xa8b2('0x3e')]);return db[_0xa8b2('0x3f')]['find'](_0x346b8d)['then'](handleEntityNotFound(_0x394f99,null))['then'](respondWithResult(_0x394f99,null))[_0xa8b2('0x43')](handleError(_0x394f99,null));};exports[_0xa8b2('0x45')]=function(_0x11f73a,_0x2eb72d){return db[_0xa8b2('0x3f')][_0xa8b2('0x45')](_0x11f73a[_0xa8b2('0x46')],{})[_0xa8b2('0x24')](respondWithResult(_0x2eb72d,0xc9))['catch'](handleError(_0x2eb72d,null));};exports[_0xa8b2('0x23')]=function(_0x49dc8a,_0x397f4c){if(_0x49dc8a[_0xa8b2('0x46')]['id']){delete _0x49dc8a[_0xa8b2('0x46')]['id'];}return db[_0xa8b2('0x3f')][_0xa8b2('0x47')]({'where':{'id':_0x49dc8a['params']['id']}})[_0xa8b2('0x24')](handleEntityNotFound(_0x397f4c,null))[_0xa8b2('0x24')](saveUpdates(_0x49dc8a[_0xa8b2('0x46')],null))[_0xa8b2('0x24')](respondWithResult(_0x397f4c,null))[_0xa8b2('0x43')](handleError(_0x397f4c,null));};exports['destroy']=function(_0x329377,_0x3b248e){return db[_0xa8b2('0x3f')][_0xa8b2('0x47')]({'where':{'id':_0x329377[_0xa8b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b248e,null))[_0xa8b2('0x24')](removeEntity(_0x3b248e,null))['catch'](handleError(_0x3b248e,null));};exports[_0xa8b2('0x48')]=function(_0x179a8b,_0x2d4b8f,_0x1aea86){return db[_0xa8b2('0x49')][_0xa8b2('0x47')]({'where':{'id':_0x179a8b[_0xa8b2('0x44')]['id']}})[_0xa8b2('0x24')](handleEntityNotFound(_0x2d4b8f,null))[_0xa8b2('0x24')](function(_0x43cc0a){if(_0x43cc0a){return _0x43cc0a[_0xa8b2('0x48')](_0x179a8b['body'][_0xa8b2('0x4a')],_['omit'](_0x179a8b[_0xa8b2('0x46')],[_0xa8b2('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x2d4b8f,null))[_0xa8b2('0x43')](handleError(_0x2d4b8f,null));};exports[_0xa8b2('0x4b')]=function(_0x4cacd8,_0x2f07ad,_0x2bffe1){var _0x3592d4={};var _0x1409a3={};var _0x5ce0d7;var _0x26d148;return db[_0xa8b2('0x3f')][_0xa8b2('0x4c')]({'where':{'id':_0x4cacd8[_0xa8b2('0x44')]['id']}})[_0xa8b2('0x24')](handleEntityNotFound(_0x2f07ad,null))[_0xa8b2('0x24')](function(_0x21a93f){if(_0x21a93f){_0x5ce0d7=_0x21a93f;_0x1409a3[_0xa8b2('0x2d')]=_[_0xa8b2('0x2b')](db['Condition'][_0xa8b2('0x2a')]);_0x1409a3[_0xa8b2('0x2c')]=_['keys'](_0x4cacd8[_0xa8b2('0x2c')]);_0x1409a3[_0xa8b2('0x35')]=_[_0xa8b2('0x2f')](_0x1409a3[_0xa8b2('0x2d')],_0x1409a3['query']);_0x3592d4[_0xa8b2('0x2e')]=_[_0xa8b2('0x2f')](_0x1409a3[_0xa8b2('0x2d')],qs[_0xa8b2('0x30')](_0x4cacd8[_0xa8b2('0x2c')][_0xa8b2('0x30')]));_0x3592d4[_0xa8b2('0x2e')]=_0x3592d4[_0xa8b2('0x2e')][_0xa8b2('0x31')]?_0x3592d4[_0xa8b2('0x2e')]:_0x1409a3[_0xa8b2('0x2d')];_0x3592d4[_0xa8b2('0x33')]=qs[_0xa8b2('0x4d')](_0x4cacd8[_0xa8b2('0x2c')][_0xa8b2('0x4d')]);_0x3592d4[_0xa8b2('0x34')]=qs[_0xa8b2('0x35')](_[_0xa8b2('0x36')](_0x4cacd8[_0xa8b2('0x2c')],_0x1409a3[_0xa8b2('0x35')]));if(_0x4cacd8[_0xa8b2('0x2c')][_0xa8b2('0x3d')]){_0x3592d4[_0xa8b2('0x34')]=_[_0xa8b2('0x37')](_0x3592d4['where'],{'$or':_[_0xa8b2('0x38')](_0x3592d4[_0xa8b2('0x2e')],function(_0x420286){var _0x1b0294={};_0x1b0294[_0x420286]={'$like':'%'+_0x4cacd8[_0xa8b2('0x2c')]['filter']+'%'};return _0x1b0294;})});}_0x3592d4=_[_0xa8b2('0x37')]({},_0x3592d4,_0x4cacd8[_0xa8b2('0x3e')]);return _0x5ce0d7[_0xa8b2('0x4b')](_0x3592d4);}})[_0xa8b2('0x24')](function(_0x33897b){if(_0x33897b){_0x26d148=_0x33897b[_0xa8b2('0x31')];if(!_0x4cacd8[_0xa8b2('0x2c')][_0xa8b2('0x4e')](_0xa8b2('0x32'))){_0x3592d4['limit']=qs[_0xa8b2('0x1d')](_0x4cacd8['query'][_0xa8b2('0x1d')]);_0x3592d4[_0xa8b2('0x1c')]=qs[_0xa8b2('0x1c')](_0x4cacd8[_0xa8b2('0x2c')][_0xa8b2('0x1c')]);}return _0x5ce0d7[_0xa8b2('0x4b')](_0x3592d4);}})[_0xa8b2('0x24')](function(_0x55d207){if(_0x55d207){return _0x55d207?{'count':_0x26d148,'rows':_0x55d207}:null;}})[_0xa8b2('0x24')](respondWithResult(_0x2f07ad,null))[_0xa8b2('0x43')](handleError(_0x2f07ad,null));};exports[_0xa8b2('0x4f')]=function(_0x40e757,_0x5e06b4,_0x1248e7){return db[_0xa8b2('0x50')][_0xa8b2('0x47')]({'where':{'id':_0x40e757[_0xa8b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e06b4,null))[_0xa8b2('0x24')](function(_0x18ee22){if(_0x18ee22){return _0x18ee22[_0xa8b2('0x4f')](_0x40e757[_0xa8b2('0x46')][_0xa8b2('0x4a')],_[_0xa8b2('0x51')](_0x40e757['body'],['ids','id'])||{});}})[_0xa8b2('0x24')](respondWithResult(_0x5e06b4,null))['catch'](handleError(_0x5e06b4,null));};exports[_0xa8b2('0x52')]=function(_0x2f6670,_0x23c5ef,_0x50c2b2){var _0x33cd0a={};var _0x402781={};var _0x617a10;var _0x35ddf0;return db[_0xa8b2('0x3f')][_0xa8b2('0x4c')]({'where':{'id':_0x2f6670[_0xa8b2('0x44')]['id']}})[_0xa8b2('0x24')](handleEntityNotFound(_0x23c5ef,null))['then'](function(_0x5ccb69){if(_0x5ccb69){_0x617a10=_0x5ccb69;_0x402781['model']=_[_0xa8b2('0x2b')](db['Action'][_0xa8b2('0x2a')]);_0x402781[_0xa8b2('0x2c')]=_[_0xa8b2('0x2b')](_0x2f6670[_0xa8b2('0x2c')]);_0x402781[_0xa8b2('0x35')]=_[_0xa8b2('0x2f')](_0x402781[_0xa8b2('0x2d')],_0x402781['query']);_0x33cd0a[_0xa8b2('0x2e')]=_[_0xa8b2('0x2f')](_0x402781[_0xa8b2('0x2d')],qs['fields'](_0x2f6670[_0xa8b2('0x2c')][_0xa8b2('0x30')]));_0x33cd0a['attributes']=_0x33cd0a[_0xa8b2('0x2e')][_0xa8b2('0x31')]?_0x33cd0a['attributes']:_0x402781['model'];_0x33cd0a['order']=qs[_0xa8b2('0x4d')](_0x2f6670[_0xa8b2('0x2c')][_0xa8b2('0x4d')]);_0x33cd0a[_0xa8b2('0x34')]=qs[_0xa8b2('0x35')](_[_0xa8b2('0x36')](_0x2f6670[_0xa8b2('0x2c')],_0x402781[_0xa8b2('0x35')]));if(_0x2f6670[_0xa8b2('0x2c')][_0xa8b2('0x3d')]){_0x33cd0a[_0xa8b2('0x34')]=_[_0xa8b2('0x37')](_0x33cd0a[_0xa8b2('0x34')],{'$or':_[_0xa8b2('0x38')](_0x33cd0a[_0xa8b2('0x2e')],function(_0x552a85){var _0x2dff35={};_0x2dff35[_0x552a85]={'$like':'%'+_0x2f6670[_0xa8b2('0x2c')][_0xa8b2('0x3d')]+'%'};return _0x2dff35;})});}_0x33cd0a=_[_0xa8b2('0x37')]({},_0x33cd0a,_0x2f6670['options']);return _0x617a10['getActions'](_0x33cd0a);}})[_0xa8b2('0x24')](function(_0x1678d2){if(_0x1678d2){_0x35ddf0=_0x1678d2[_0xa8b2('0x31')];if(!_0x2f6670[_0xa8b2('0x2c')]['hasOwnProperty'](_0xa8b2('0x32'))){_0x33cd0a[_0xa8b2('0x1d')]=qs[_0xa8b2('0x1d')](_0x2f6670['query']['limit']);_0x33cd0a[_0xa8b2('0x1c')]=qs[_0xa8b2('0x1c')](_0x2f6670[_0xa8b2('0x2c')]['offset']);}return _0x617a10[_0xa8b2('0x52')](_0x33cd0a);}})[_0xa8b2('0x24')](function(_0x248de5){if(_0x248de5){return _0x248de5?{'count':_0x35ddf0,'rows':_0x248de5}:null;}})[_0xa8b2('0x24')](respondWithResult(_0x23c5ef,null))[_0xa8b2('0x43')](handleError(_0x23c5ef,null));}; \ No newline at end of file +var _0xdf71=['api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','Automation','rawAttributes','query','filters','intersection','model','attributes','length','nolimit','order','sort','pick','filter','merge','map','key','VIRTUAL','field','where','includeAll','include','findAll','catch','params','keys','fields','options','create','body','find','addConditions','Condition','ids','omit','getConditions','hasOwnProperty','addActions','Action','getActions','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x135de8,_0x45fe61){var _0x42f51c=function(_0x35e2f3){while(--_0x35e2f3){_0x135de8['push'](_0x135de8['shift']());}};_0x42f51c(++_0x45fe61);}(_0xdf71,0x1d2));var _0x1df7=function(_0x144c51,_0x9327f0){_0x144c51=_0x144c51-0x0;var _0x24653f=_0xdf71[_0x144c51];return _0x24653f;};'use strict';var pdf=require(_0x1df7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1df7('0x1'));var zipdir=require(_0x1df7('0x2'));var jsonpatch=require(_0x1df7('0x3'));var rp=require(_0x1df7('0x4'));var moment=require(_0x1df7('0x5'));var BPromise=require(_0x1df7('0x6'));var Mustache=require(_0x1df7('0x7'));var util=require('util');var path=require(_0x1df7('0x8'));var sox=require(_0x1df7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1df7('0xa'));var squel=require(_0x1df7('0xb'));var crypto=require('crypto');var jsforce=require(_0x1df7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1df7('0xd'));var querystring=require(_0x1df7('0xe'));var Papa=require(_0x1df7('0xf'));var Redis=require(_0x1df7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1df7('0x11'));var hardwareService=require(_0x1df7('0x12'));var logger=require(_0x1df7('0x13'))(_0x1df7('0x14'));var utils=require(_0x1df7('0x15'));var config=require(_0x1df7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3744d0,_0x533620){_0x533620=_0x533620||0xcc;return function(_0x91d932){if(_0x91d932){return _0x3744d0[_0x1df7('0x17')](_0x533620);}return _0x3744d0[_0x1df7('0x18')](_0x533620)[_0x1df7('0x19')]();};}function respondWithResult(_0x2b6935,_0x535756){_0x535756=_0x535756||0xc8;return function(_0x20b8cf){if(_0x20b8cf){return _0x2b6935[_0x1df7('0x18')](_0x535756)[_0x1df7('0x1a')](_0x20b8cf);}};}function respondWithFilteredResult(_0x57f931,_0x5b21f5){return function(_0x8cfd99){if(_0x8cfd99){var _0x5734dd=_0x8cfd99[_0x1df7('0x1b')],_0x10dd13=_0x5b21f5[_0x1df7('0x1c')],_0x543af6=_0x5b21f5[_0x1df7('0x1c')]+_0x5b21f5[_0x1df7('0x1d')],_0x191046;if(_0x543af6>=_0x5734dd){_0x543af6=_0x5734dd;_0x191046=0xc8;}else{_0x191046=0xce;}_0x57f931['status'](_0x191046);return _0x57f931[_0x1df7('0x1e')](_0x1df7('0x1f'),_0x10dd13+'-'+_0x543af6+'/'+_0x5734dd)[_0x1df7('0x1a')](_0x8cfd99);}return null;};}function patchUpdates(_0x15bfad){return function(_0x5af91){try{jsonpatch[_0x1df7('0x20')](_0x5af91,_0x15bfad,!![]);}catch(_0x5cc02f){return BPromise['reject'](_0x5cc02f);}return _0x5af91[_0x1df7('0x21')]();};}function saveUpdates(_0x33cb39,_0x195ec2){return function(_0x1f8851){if(_0x1f8851){return _0x1f8851[_0x1df7('0x22')](_0x33cb39)[_0x1df7('0x23')](function(_0x56c6ce){return _0x56c6ce;});}return null;};}function removeEntity(_0x1ade09,_0x2758af){return function(_0xb3c4cc){if(_0xb3c4cc){return _0xb3c4cc[_0x1df7('0x24')]()[_0x1df7('0x23')](function(){_0x1ade09[_0x1df7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c48ae,_0x387d3f){return function(_0x1d134a){if(!_0x1d134a){_0x5c48ae[_0x1df7('0x17')](0x194);}return _0x1d134a;};}function handleError(_0x104952,_0x1d3618){_0x1d3618=_0x1d3618||0x1f4;return function(_0x1f96ae){logger['error'](_0x1f96ae[_0x1df7('0x25')]);if(_0x1f96ae[_0x1df7('0x26')]){delete _0x1f96ae[_0x1df7('0x26')];}_0x104952[_0x1df7('0x18')](_0x1d3618)[_0x1df7('0x27')](_0x1f96ae);};}exports[_0x1df7('0x28')]=function(_0xce818f,_0x4fa7bf){var _0x3fda08={},_0x242575={},_0x1a6ebe={'count':0x0,'rows':[]};var _0x23d328=db[_0x1df7('0x29')][_0x1df7('0x2a')];_0x242575['model']=_['keys'](_0x23d328);_0x242575[_0x1df7('0x2b')]=_['keys'](_0xce818f[_0x1df7('0x2b')]);_0x242575[_0x1df7('0x2c')]=_[_0x1df7('0x2d')](_0x242575['model'],_0x242575[_0x1df7('0x2b')]);_0x3fda08['attributes']=_[_0x1df7('0x2d')](_0x242575[_0x1df7('0x2e')],qs['fields'](_0xce818f[_0x1df7('0x2b')]['fields']));_0x3fda08[_0x1df7('0x2f')]=_0x3fda08['attributes'][_0x1df7('0x30')]?_0x3fda08[_0x1df7('0x2f')]:_0x242575[_0x1df7('0x2e')];if(!_0xce818f[_0x1df7('0x2b')]['hasOwnProperty'](_0x1df7('0x31'))){_0x3fda08[_0x1df7('0x1d')]=qs[_0x1df7('0x1d')](_0xce818f[_0x1df7('0x2b')][_0x1df7('0x1d')]);_0x3fda08['offset']=qs[_0x1df7('0x1c')](_0xce818f['query']['offset']);}_0x3fda08[_0x1df7('0x32')]=qs[_0x1df7('0x33')](_0xce818f[_0x1df7('0x2b')][_0x1df7('0x33')]);_0x3fda08['where']=qs['filters'](_[_0x1df7('0x34')](_0xce818f[_0x1df7('0x2b')],_0x242575['filters']));if(_0xce818f['query'][_0x1df7('0x35')]){_0x3fda08['where']=_[_0x1df7('0x36')](_0x3fda08['where'],{'$or':_[_0x1df7('0x37')](_0x23d328,function(_0x2713fd){if(_0x2713fd['type'][_0x1df7('0x38')]!==_0x1df7('0x39')){var _0xd75d63={};_0xd75d63[_0x2713fd[_0x1df7('0x3a')]]={'$like':'%'+_0xce818f['query'][_0x1df7('0x35')]+'%'};return _0xd75d63;}})});}_0x3fda08=_['merge']({},_0x3fda08,_0xce818f['options']);var _0x537fbe={'where':_0x3fda08[_0x1df7('0x3b')]};return db['Automation'][_0x1df7('0x1b')](_0x537fbe)[_0x1df7('0x23')](function(_0x53e62d){_0x1a6ebe[_0x1df7('0x1b')]=_0x53e62d;if(_0xce818f['query'][_0x1df7('0x3c')]){_0x3fda08[_0x1df7('0x3d')]=[{'all':!![]}];}return db[_0x1df7('0x29')][_0x1df7('0x3e')](_0x3fda08);})[_0x1df7('0x23')](function(_0x4e6c05){_0x1a6ebe['rows']=_0x4e6c05;return _0x1a6ebe;})[_0x1df7('0x23')](respondWithFilteredResult(_0x4fa7bf,_0x3fda08))[_0x1df7('0x3f')](handleError(_0x4fa7bf,null));};exports['show']=function(_0x41aab6,_0x2c3a04){var _0x124c7a={'raw':![],'where':{'id':_0x41aab6[_0x1df7('0x40')]['id']}},_0x32f80f={};_0x32f80f[_0x1df7('0x2e')]=_[_0x1df7('0x41')](db[_0x1df7('0x29')][_0x1df7('0x2a')]);_0x32f80f[_0x1df7('0x2b')]=_[_0x1df7('0x41')](_0x41aab6[_0x1df7('0x2b')]);_0x32f80f['filters']=_['intersection'](_0x32f80f['model'],_0x32f80f[_0x1df7('0x2b')]);_0x124c7a[_0x1df7('0x2f')]=_[_0x1df7('0x2d')](_0x32f80f[_0x1df7('0x2e')],qs[_0x1df7('0x42')](_0x41aab6['query']['fields']));_0x124c7a[_0x1df7('0x2f')]=_0x124c7a[_0x1df7('0x2f')][_0x1df7('0x30')]?_0x124c7a[_0x1df7('0x2f')]:_0x32f80f['model'];if(_0x41aab6[_0x1df7('0x2b')][_0x1df7('0x3c')]){_0x124c7a[_0x1df7('0x3d')]=[{'all':!![]}];}_0x124c7a=_['merge']({},_0x124c7a,_0x41aab6[_0x1df7('0x43')]);return db[_0x1df7('0x29')]['find'](_0x124c7a)['then'](handleEntityNotFound(_0x2c3a04,null))[_0x1df7('0x23')](respondWithResult(_0x2c3a04,null))['catch'](handleError(_0x2c3a04,null));};exports[_0x1df7('0x44')]=function(_0x2c11f5,_0x48c15e){return db[_0x1df7('0x29')]['create'](_0x2c11f5[_0x1df7('0x45')],{})[_0x1df7('0x23')](respondWithResult(_0x48c15e,0xc9))['catch'](handleError(_0x48c15e,null));};exports[_0x1df7('0x22')]=function(_0x3d546f,_0xf74688){if(_0x3d546f[_0x1df7('0x45')]['id']){delete _0x3d546f[_0x1df7('0x45')]['id'];}return db[_0x1df7('0x29')][_0x1df7('0x46')]({'where':{'id':_0x3d546f[_0x1df7('0x40')]['id']}})[_0x1df7('0x23')](handleEntityNotFound(_0xf74688,null))[_0x1df7('0x23')](saveUpdates(_0x3d546f[_0x1df7('0x45')],null))[_0x1df7('0x23')](respondWithResult(_0xf74688,null))[_0x1df7('0x3f')](handleError(_0xf74688,null));};exports[_0x1df7('0x24')]=function(_0x2f1f7a,_0xb1fbf0){return db[_0x1df7('0x29')][_0x1df7('0x46')]({'where':{'id':_0x2f1f7a[_0x1df7('0x40')]['id']}})['then'](handleEntityNotFound(_0xb1fbf0,null))['then'](removeEntity(_0xb1fbf0,null))[_0x1df7('0x3f')](handleError(_0xb1fbf0,null));};exports[_0x1df7('0x47')]=function(_0x1be253,_0x9428f,_0x1fc284){return db[_0x1df7('0x48')][_0x1df7('0x46')]({'where':{'id':_0x1be253[_0x1df7('0x40')]['id']}})['then'](handleEntityNotFound(_0x9428f,null))[_0x1df7('0x23')](function(_0x4fc583){if(_0x4fc583){return _0x4fc583[_0x1df7('0x47')](_0x1be253[_0x1df7('0x45')][_0x1df7('0x49')],_[_0x1df7('0x4a')](_0x1be253['body'],['ids','id'])||{});}})[_0x1df7('0x23')](respondWithResult(_0x9428f,null))[_0x1df7('0x3f')](handleError(_0x9428f,null));};exports['getConditions']=function(_0x53e28d,_0x5e57cb,_0x1079b8){var _0x1a8984={};var _0x5017c2={};var _0x1c1c01;var _0x15c4d1;return db[_0x1df7('0x29')]['findOne']({'where':{'id':_0x53e28d[_0x1df7('0x40')]['id']}})[_0x1df7('0x23')](handleEntityNotFound(_0x5e57cb,null))[_0x1df7('0x23')](function(_0x2c7a55){if(_0x2c7a55){_0x1c1c01=_0x2c7a55;_0x5017c2[_0x1df7('0x2e')]=_[_0x1df7('0x41')](db['Condition'][_0x1df7('0x2a')]);_0x5017c2['query']=_[_0x1df7('0x41')](_0x53e28d[_0x1df7('0x2b')]);_0x5017c2[_0x1df7('0x2c')]=_[_0x1df7('0x2d')](_0x5017c2[_0x1df7('0x2e')],_0x5017c2[_0x1df7('0x2b')]);_0x1a8984[_0x1df7('0x2f')]=_[_0x1df7('0x2d')](_0x5017c2['model'],qs[_0x1df7('0x42')](_0x53e28d[_0x1df7('0x2b')][_0x1df7('0x42')]));_0x1a8984['attributes']=_0x1a8984[_0x1df7('0x2f')][_0x1df7('0x30')]?_0x1a8984[_0x1df7('0x2f')]:_0x5017c2[_0x1df7('0x2e')];_0x1a8984['order']=qs['sort'](_0x53e28d[_0x1df7('0x2b')][_0x1df7('0x33')]);_0x1a8984[_0x1df7('0x3b')]=qs[_0x1df7('0x2c')](_[_0x1df7('0x34')](_0x53e28d[_0x1df7('0x2b')],_0x5017c2[_0x1df7('0x2c')]));if(_0x53e28d[_0x1df7('0x2b')][_0x1df7('0x35')]){_0x1a8984['where']=_[_0x1df7('0x36')](_0x1a8984[_0x1df7('0x3b')],{'$or':_[_0x1df7('0x37')](_0x1a8984[_0x1df7('0x2f')],function(_0x1060a9){var _0xc86631={};_0xc86631[_0x1060a9]={'$like':'%'+_0x53e28d[_0x1df7('0x2b')][_0x1df7('0x35')]+'%'};return _0xc86631;})});}_0x1a8984=_[_0x1df7('0x36')]({},_0x1a8984,_0x53e28d[_0x1df7('0x43')]);return _0x1c1c01[_0x1df7('0x4b')](_0x1a8984);}})[_0x1df7('0x23')](function(_0x30afb4){if(_0x30afb4){_0x15c4d1=_0x30afb4[_0x1df7('0x30')];if(!_0x53e28d[_0x1df7('0x2b')][_0x1df7('0x4c')](_0x1df7('0x31'))){_0x1a8984[_0x1df7('0x1d')]=qs[_0x1df7('0x1d')](_0x53e28d['query']['limit']);_0x1a8984[_0x1df7('0x1c')]=qs[_0x1df7('0x1c')](_0x53e28d['query'][_0x1df7('0x1c')]);}return _0x1c1c01[_0x1df7('0x4b')](_0x1a8984);}})[_0x1df7('0x23')](function(_0x76c281){if(_0x76c281){return _0x76c281?{'count':_0x15c4d1,'rows':_0x76c281}:null;}})[_0x1df7('0x23')](respondWithResult(_0x5e57cb,null))[_0x1df7('0x3f')](handleError(_0x5e57cb,null));};exports[_0x1df7('0x4d')]=function(_0xb3ea87,_0x45ecc6,_0xaa38fc){return db[_0x1df7('0x4e')]['find']({'where':{'id':_0xb3ea87[_0x1df7('0x40')]['id']}})[_0x1df7('0x23')](handleEntityNotFound(_0x45ecc6,null))[_0x1df7('0x23')](function(_0xb99189){if(_0xb99189){return _0xb99189['addActions'](_0xb3ea87[_0x1df7('0x45')][_0x1df7('0x49')],_[_0x1df7('0x4a')](_0xb3ea87[_0x1df7('0x45')],['ids','id'])||{});}})[_0x1df7('0x23')](respondWithResult(_0x45ecc6,null))[_0x1df7('0x3f')](handleError(_0x45ecc6,null));};exports[_0x1df7('0x4f')]=function(_0x233445,_0xfa099c,_0x4e9fbd){var _0x22058d={};var _0x904bc6={};var _0x4254b4;var _0x150ef0;return db[_0x1df7('0x29')][_0x1df7('0x50')]({'where':{'id':_0x233445[_0x1df7('0x40')]['id']}})[_0x1df7('0x23')](handleEntityNotFound(_0xfa099c,null))['then'](function(_0xfa397d){if(_0xfa397d){_0x4254b4=_0xfa397d;_0x904bc6[_0x1df7('0x2e')]=_[_0x1df7('0x41')](db[_0x1df7('0x4e')][_0x1df7('0x2a')]);_0x904bc6[_0x1df7('0x2b')]=_[_0x1df7('0x41')](_0x233445[_0x1df7('0x2b')]);_0x904bc6['filters']=_['intersection'](_0x904bc6[_0x1df7('0x2e')],_0x904bc6[_0x1df7('0x2b')]);_0x22058d['attributes']=_[_0x1df7('0x2d')](_0x904bc6['model'],qs['fields'](_0x233445[_0x1df7('0x2b')][_0x1df7('0x42')]));_0x22058d['attributes']=_0x22058d[_0x1df7('0x2f')][_0x1df7('0x30')]?_0x22058d['attributes']:_0x904bc6[_0x1df7('0x2e')];_0x22058d['order']=qs[_0x1df7('0x33')](_0x233445[_0x1df7('0x2b')][_0x1df7('0x33')]);_0x22058d[_0x1df7('0x3b')]=qs[_0x1df7('0x2c')](_['pick'](_0x233445[_0x1df7('0x2b')],_0x904bc6[_0x1df7('0x2c')]));if(_0x233445[_0x1df7('0x2b')]['filter']){_0x22058d[_0x1df7('0x3b')]=_['merge'](_0x22058d['where'],{'$or':_[_0x1df7('0x37')](_0x22058d['attributes'],function(_0x3b4b9b){var _0x49c722={};_0x49c722[_0x3b4b9b]={'$like':'%'+_0x233445[_0x1df7('0x2b')]['filter']+'%'};return _0x49c722;})});}_0x22058d=_[_0x1df7('0x36')]({},_0x22058d,_0x233445['options']);return _0x4254b4[_0x1df7('0x4f')](_0x22058d);}})[_0x1df7('0x23')](function(_0x3a2491){if(_0x3a2491){_0x150ef0=_0x3a2491[_0x1df7('0x30')];if(!_0x233445[_0x1df7('0x2b')][_0x1df7('0x4c')](_0x1df7('0x31'))){_0x22058d[_0x1df7('0x1d')]=qs[_0x1df7('0x1d')](_0x233445[_0x1df7('0x2b')][_0x1df7('0x1d')]);_0x22058d['offset']=qs[_0x1df7('0x1c')](_0x233445['query'][_0x1df7('0x1c')]);}return _0x4254b4['getActions'](_0x22058d);}})['then'](function(_0x24b268){if(_0x24b268){return _0x24b268?{'count':_0x150ef0,'rows':_0x24b268}:null;}})[_0x1df7('0x23')](respondWithResult(_0xfa099c,null))[_0x1df7('0x3f')](handleError(_0xfa099c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dfbaf94..b63d7ee 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 _0xfbbb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api'];(function(_0x518ea6,_0x5d7886){var _0x1bd832=function(_0x2d12c1){while(--_0x2d12c1){_0x518ea6['push'](_0x518ea6['shift']());}};_0x1bd832(++_0x5d7886);}(_0xfbbb,0x1e6));var _0xbfbb=function(_0x12da7a,_0xbee425){_0x12da7a=_0x12da7a-0x0;var _0x3d35c0=_0xfbbb[_0x12da7a];return _0x3d35c0;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var logger=require(_0xbfbb('0x2'))(_0xbfbb('0x3'));var moment=require(_0xbfbb('0x4'));var BPromise=require(_0xbfbb('0x5'));var rp=require(_0xbfbb('0x6'));var fs=require('fs');var path=require(_0xbfbb('0x7'));var rimraf=require(_0xbfbb('0x8'));var config=require(_0xbfbb('0x9'));var attributes=require('./automation.attributes');module[_0xbfbb('0xa')]=function(_0x2a35ec,_0x400e40){return _0x2a35ec[_0xbfbb('0xb')](_0xbfbb('0xc'),attributes,{'tableName':_0xbfbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6647=['path','exports','define','Automation','tools_automations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fed3d,_0x3b4164){var _0x3492c4=function(_0x2edf59){while(--_0x2edf59){_0x1fed3d['push'](_0x1fed3d['shift']());}};_0x3492c4(++_0x3b4164);}(_0x6647,0x165));var _0x7664=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6647[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7664('0x0'));var logger=require(_0x7664('0x1'))(_0x7664('0x2'));var moment=require(_0x7664('0x3'));var BPromise=require(_0x7664('0x4'));var rp=require(_0x7664('0x5'));var fs=require('fs');var path=require(_0x7664('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x7664('0x7')]=function(_0x550eb7,_0x29b827){return _0x550eb7[_0x7664('0x8')](_0x7664('0x9'),attributes,{'tableName':_0x7664('0xa'),'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 a8681ff..98f9367 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 _0xfb67=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result'];(function(_0x4965b5,_0x5b77a4){var _0x42f316=function(_0x346cd7){while(--_0x346cd7){_0x4965b5['push'](_0x4965b5['shift']());}};_0x42f316(++_0x5b77a4);}(_0xfb67,0xdd));var _0x7fb6=function(_0x1feb4a,_0x27db40){_0x1feb4a=_0x1feb4a-0x0;var _0x33302f=_0xfb67[_0x1feb4a];return _0x33302f;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var moment=require(_0x7fb6('0x2'));var BPromise=require(_0x7fb6('0x3'));var rs=require(_0x7fb6('0x4'));var fs=require('fs');var Redis=require(_0x7fb6('0x5'));var db=require(_0x7fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fb6('0x7'))(_0x7fb6('0x8'));var config=require(_0x7fb6('0x9'));var jayson=require(_0x7fb6('0xa'));var client=jayson[_0x7fb6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5f19,_0x26ea4c,_0xa448b4){return new BPromise(function(_0x485f45,_0x168ebb){return client[_0x7fb6('0xc')](_0x2f5f19,_0xa448b4)['then'](function(_0x27f819){logger[_0x7fb6('0xd')](_0x7fb6('0xe'),_0x26ea4c,'request\x20sent');logger[_0x7fb6('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x26ea4c,_0x7fb6('0x10'),JSON[_0x7fb6('0x11')](_0x27f819));if(_0x27f819[_0x7fb6('0x12')]){if(_0x27f819[_0x7fb6('0x12')]['code']===0x1f4){logger[_0x7fb6('0x12')](_0x7fb6('0xe'),_0x26ea4c,_0x27f819[_0x7fb6('0x12')]['message']);return _0x168ebb(_0x27f819['error']['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x26ea4c,_0x27f819['error'][_0x7fb6('0x13')]);return _0x485f45(_0x27f819[_0x7fb6('0x12')]['message']);}else{logger[_0x7fb6('0xd')](_0x7fb6('0xe'),_0x26ea4c,_0x7fb6('0x10'));_0x485f45(_0x27f819[_0x7fb6('0x14')][_0x7fb6('0x13')]);}})[_0x7fb6('0x15')](function(_0x3e89c7){logger[_0x7fb6('0x12')](_0x7fb6('0xe'),_0x26ea4c,_0x3e89c7);_0x168ebb(_0x3e89c7);});});} \ No newline at end of file +var _0x980e=['../../config/utils','../../config/logger','jayson/promise','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','ioredis'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5825c1,_0xc47bdf,_0x27cc8c){return new BPromise(function(_0x3683df,_0x2d76d0){return client[_0xe980('0x6')](_0x5825c1,_0x27cc8c)['then'](function(_0xf9f019){logger[_0xe980('0x7')](_0xe980('0x8'),_0xc47bdf,'request\x20sent');logger[_0xe980('0x9')](_0xe980('0xa'),_0xc47bdf,_0xe980('0xb'),JSON[_0xe980('0xc')](_0xf9f019));if(_0xf9f019[_0xe980('0xd')]){if(_0xf9f019['error']['code']===0x1f4){logger['error'](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')]['message']);return _0x2d76d0(_0xf9f019['error'][_0xe980('0xe')]);}logger[_0xe980('0xd')](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);return _0x3683df(_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0xc47bdf,'request\x20sent');_0x3683df(_0xf9f019[_0xe980('0xf')][_0xe980('0xe')]);}})[_0xe980('0x10')](function(_0x406418){logger[_0xe980('0xd')]('Automation,\x20%s,\x20%s',_0xc47bdf,_0x406418);_0x2d76d0(_0x406418);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 87187d0..0b27d83 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 _0x4336=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put'];(function(_0x5f20d8,_0x500714){var _0x3065d1=function(_0x371d39){while(--_0x371d39){_0x5f20d8['push'](_0x5f20d8['shift']());}};_0x3065d1(++_0x500714);}(_0x4336,0xe8));var _0x6433=function(_0x13db3b,_0x1442cc){_0x13db3b=_0x13db3b-0x0;var _0xe5e0aa=_0x4336[_0x13db3b];return _0xe5e0aa;};'use strict';var multer=require(_0x6433('0x0'));var util=require(_0x6433('0x1'));var path=require('path');var timeout=require(_0x6433('0x2'));var express=require(_0x6433('0x3'));var router=express[_0x6433('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6433('0x5'));var config=require('../../config/environment');var controller=require(_0x6433('0x6'));router[_0x6433('0x7')]('/',auth[_0x6433('0x8')](),controller[_0x6433('0x9')]);router[_0x6433('0x7')](_0x6433('0xa'),auth['isAuthenticated'](),controller[_0x6433('0xb')]);router[_0x6433('0x7')](_0x6433('0xc'),auth[_0x6433('0x8')](),controller[_0x6433('0xd')]);router[_0x6433('0x7')]('/:id/actions',auth[_0x6433('0x8')](),controller[_0x6433('0xe')]);router[_0x6433('0xf')]('/',auth['isAuthenticated'](),controller[_0x6433('0x10')]);router[_0x6433('0xf')](_0x6433('0xc'),auth[_0x6433('0x8')](),controller[_0x6433('0x11')]);router[_0x6433('0xf')](_0x6433('0x12'),auth[_0x6433('0x8')](),controller[_0x6433('0x13')]);router[_0x6433('0x14')]('/:id',auth[_0x6433('0x8')](),controller['update']);router[_0x6433('0x15')](_0x6433('0xa'),auth[_0x6433('0x8')](),controller[_0x6433('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa8c9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','destroy','exports','multer','util'];(function(_0x1eea20,_0x3095a8){var _0x45db8e=function(_0x4c7d23){while(--_0x4c7d23){_0x1eea20['push'](_0x1eea20['shift']());}};_0x45db8e(++_0x3095a8);}(_0xa8c9,0x16a));var _0x9a8c=function(_0x790dcc,_0x580bbb){_0x790dcc=_0x790dcc-0x0;var _0x53cd99=_0xa8c9[_0x790dcc];return _0x53cd99;};'use strict';var multer=require(_0x9a8c('0x0'));var util=require(_0x9a8c('0x1'));var path=require('path');var timeout=require(_0x9a8c('0x2'));var express=require(_0x9a8c('0x3'));var router=express[_0x9a8c('0x4')]();var auth=require(_0x9a8c('0x5'));var interaction=require(_0x9a8c('0x6'));var config=require(_0x9a8c('0x7'));var controller=require(_0x9a8c('0x8'));router[_0x9a8c('0x9')]('/',auth[_0x9a8c('0xa')](),controller[_0x9a8c('0xb')]);router[_0x9a8c('0x9')](_0x9a8c('0xc'),auth[_0x9a8c('0xa')](),controller[_0x9a8c('0xd')]);router[_0x9a8c('0x9')](_0x9a8c('0xe'),auth['isAuthenticated'](),controller[_0x9a8c('0xf')]);router[_0x9a8c('0x9')](_0x9a8c('0x10'),auth[_0x9a8c('0xa')](),controller[_0x9a8c('0x11')]);router[_0x9a8c('0x12')]('/',auth[_0x9a8c('0xa')](),controller['create']);router[_0x9a8c('0x12')](_0x9a8c('0xe'),auth['isAuthenticated'](),controller[_0x9a8c('0x13')]);router[_0x9a8c('0x12')](_0x9a8c('0x10'),auth[_0x9a8c('0xa')](),controller[_0x9a8c('0x14')]);router[_0x9a8c('0x15')](_0x9a8c('0xc'),auth[_0x9a8c('0xa')](),controller[_0x9a8c('0x16')]);router[_0x9a8c('0x17')](_0x9a8c('0xc'),auth[_0x9a8c('0xa')](),controller[_0x9a8c('0x18')]);module[_0x9a8c('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 563ccc9..2af9183 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 _0x0c72=['ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC'];(function(_0x486e87,_0xc37899){var _0x2e6397=function(_0x6af1fc){while(--_0x6af1fc){_0x486e87['push'](_0x486e87['shift']());}};_0x2e6397(++_0xc37899);}(_0x0c72,0x1a3));var _0x20c7=function(_0x40e27a,_0x3daab5){_0x40e27a=_0x40e27a-0x0;var _0x15e294=_0x0c72[_0x40e27a];return _0x15e294;};'use strict';var Sequelize=require(_0x20c7('0x0'));module[_0x20c7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x20c7('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x20c7('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x20c7('0x4')],'defaultValue':0x0,'comment':_0x20c7('0x5')},'limitCalls':{'type':Sequelize[_0x20c7('0x6')](0x4)[_0x20c7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x20c7('0x8')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20c7('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x20c7('0x6')](0x3)[_0x20c7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20c7('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x20c7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20c7('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x20c7('0x6')](0x3)[_0x20c7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20c7('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x20c7('0x6')](0x5)[_0x20c7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20c7('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x20c7('0x6')](0x3)[_0x20c7('0x7')],'defaultValue':0x3,'comment':_0x20c7('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x20c7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20c7('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x20c7('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x20c7('0x10')},'dialTimezone':{'type':Sequelize[_0x20c7('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x20c7('0x8')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x20c7('0x2')](_0x20c7('0x11'),_0x20c7('0x12'),_0x20c7('0x13')),'defaultValue':_0x20c7('0x11')},'dialAMDActive':{'type':Sequelize[_0x20c7('0x4')],'defaultValue':0x0,'comment':_0x20c7('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x20c7('0x6')](0x9)[_0x20c7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x20c7('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x20c7('0x6')](0x9)[_0x20c7('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x20c7('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x20c7('0x6')](0x9)[_0x20c7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x20c7('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x20c7('0x6')](0x9)[_0x20c7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x20c7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x20c7('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x20c7('0x6')](0x9)[_0x20c7('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x20c7('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x20c7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x20c7('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x20c7('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x20c7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x20c7('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x20c7('0x1c'),_0x20c7('0x1d')),'defaultValue':_0x20c7('0x1c')},'dialPrefix':{'type':Sequelize[_0x20c7('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x20c7('0x6')](0x3)[_0x20c7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x20c7('0x1e')},'dialCutDigit':{'type':Sequelize[_0x20c7('0x6')](0x3)[_0x20c7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x20c7('0x1f')}}; \ No newline at end of file +var _0xa65f=['Cut\x20Digit\x20(min:1,\x20max:15)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x2a2dc1,_0x468f87){var _0x1c0f3d=function(_0x1a636e){while(--_0x1a636e){_0x2a2dc1['push'](_0x2a2dc1['shift']());}};_0x1c0f3d(++_0x468f87);}(_0xa65f,0x14b));var _0xfa65=function(_0x4068df,_0x1880c6){_0x4068df=_0x4068df-0x0;var _0x47a6b7=_0xa65f[_0x4068df];return _0x47a6b7;};'use strict';var Sequelize=require('sequelize');module[_0xfa65('0x0')]={'name':{'type':Sequelize[_0xfa65('0x1')],'unique':_0xfa65('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfa65('0x3')](_0xfa65('0x4')),'allowNull':![],'defaultValue':_0xfa65('0x4')},'description':{'type':Sequelize[_0xfa65('0x1')]},'active':{'type':Sequelize[_0xfa65('0x5')],'defaultValue':0x0,'comment':_0xfa65('0x6')},'limitCalls':{'type':Sequelize[_0xfa65('0x7')](0x4)[_0xfa65('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfa65('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfa65('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xfa65('0x7')](0x3)[_0xfa65('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa65('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfa65('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfa65('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xfa65('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa65('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfa65('0x7')](0x5)[_0xfa65('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfa65('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfa65('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfa65('0x7')](0x5)[_0xfa65('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xfa65('0x7')](0x3)[_0xfa65('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfa65('0xd')},'dialTimezone':{'type':Sequelize[_0xfa65('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfa65('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xfa65('0x3')](_0xfa65('0xf'),_0xfa65('0x10'),_0xfa65('0x11')),'defaultValue':_0xfa65('0xf')},'dialAMDActive':{'type':Sequelize[_0xfa65('0x5')],'defaultValue':0x0,'comment':_0xfa65('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xfa65('0x7')](0x9)[_0xfa65('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xfa65('0x7')](0x9)[_0xfa65('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfa65('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfa65('0x7')](0x9)[_0xfa65('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfa65('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xfa65('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xfa65('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfa65('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfa65('0x7')](0x9)[_0xfa65('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfa65('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfa65('0x7')](0x9)[_0xfa65('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfa65('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfa65('0x7')](0x5)[_0xfa65('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfa65('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfa65('0x7')](0x9)[_0xfa65('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfa65('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfa65('0x1a'),_0xfa65('0x1b')),'defaultValue':_0xfa65('0x1a')},'dialPrefix':{'type':Sequelize[_0xfa65('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xfa65('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfa65('0x1c')},'dialCutDigit':{'type':Sequelize[_0xfa65('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfa65('0x1d')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3167a8b..6aca6b2 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 _0xb71a=['then','end','error','stack','name','send','index','Campaign','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','where','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','update','findOne','CmHopper','nolimit','sort','pick','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','toString','NOW()','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','IvrCampaigns'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xb71a,0x1df));var _0xab71=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xb71a[_0x17c483];return _0x112bdb;};'use strict';var pdf=require(_0xab71('0x0'));var emlformat=require(_0xab71('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab71('0x2'));var jsonpatch=require(_0xab71('0x3'));var rp=require(_0xab71('0x4'));var moment=require('moment');var BPromise=require(_0xab71('0x5'));var Mustache=require(_0xab71('0x6'));var util=require(_0xab71('0x7'));var path=require(_0xab71('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab71('0x9'));var fs=require('fs');var _=require(_0xab71('0xa'));var squel=require(_0xab71('0xb'));var crypto=require(_0xab71('0xc'));var jsforce=require(_0xab71('0xd'));var deskjs=require(_0xab71('0xe'));var toCsv=require('to-csv');var querystring=require(_0xab71('0xf'));var Papa=require(_0xab71('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab71('0x11'));var hardwareService=require(_0xab71('0x12'));var logger=require(_0xab71('0x13'))('api');var utils=require(_0xab71('0x14'));var config=require(_0xab71('0x15'));var db=require(_0xab71('0x16'))['db'];function respondWithStatusCode(_0x40ba27,_0x5234ce){_0x5234ce=_0x5234ce||0xcc;return function(_0x58f202){if(_0x58f202){return _0x40ba27[_0xab71('0x17')](_0x5234ce);}return _0x40ba27[_0xab71('0x18')](_0x5234ce)['end']();};}function respondWithResult(_0x220aa8,_0x587971){_0x587971=_0x587971||0xc8;return function(_0x41ebb0){if(_0x41ebb0){return _0x220aa8[_0xab71('0x18')](_0x587971)[_0xab71('0x19')](_0x41ebb0);}};}function respondWithFilteredResult(_0x3f3eca,_0x3337f1){return function(_0x3ef449){if(_0x3ef449){var _0x2e810c=_0x3ef449[_0xab71('0x1a')],_0x5cf235=_0x3337f1['offset'],_0x2e2574=_0x3337f1[_0xab71('0x1b')]+_0x3337f1[_0xab71('0x1c')],_0x57eba6;if(_0x2e2574>=_0x2e810c){_0x2e2574=_0x2e810c;_0x57eba6=0xc8;}else{_0x57eba6=0xce;}_0x3f3eca['status'](_0x57eba6);return _0x3f3eca[_0xab71('0x1d')](_0xab71('0x1e'),_0x5cf235+'-'+_0x2e2574+'/'+_0x2e810c)[_0xab71('0x19')](_0x3ef449);}return null;};}function patchUpdates(_0x8649ad){return function(_0x499cce){try{jsonpatch[_0xab71('0x1f')](_0x499cce,_0x8649ad,!![]);}catch(_0x52ecda){return BPromise[_0xab71('0x20')](_0x52ecda);}return _0x499cce[_0xab71('0x21')]();};}function saveUpdates(_0x10854a,_0x3a1cfb){return function(_0x3cf397){if(_0x3cf397){return _0x3cf397['update'](_0x10854a)['then'](function(_0x1ed598){return _0x1ed598;});}return null;};}function removeEntity(_0x193397,_0x403c62){return function(_0x3e996a){if(_0x3e996a){return _0x3e996a[_0xab71('0x22')]()['then'](function(){var _0x51e5b=_0x3e996a[_0xab71('0x23')]({'plain':!![]});var _0x187771=_0xab71('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x187771,'resourceId':_0x51e5b['id']}})[_0xab71('0x25')](function(){return _0x3e996a;});})[_0xab71('0x25')](function(){_0x193397[_0xab71('0x18')](0xcc)[_0xab71('0x26')]();});}};}function handleEntityNotFound(_0x4d280e,_0x360fd6){return function(_0xb0d260){if(!_0xb0d260){_0x4d280e['sendStatus'](0x194);}return _0xb0d260;};}function handleError(_0xe1799a,_0x5cdd01){_0x5cdd01=_0x5cdd01||0x1f4;return function(_0x3dab6f){logger[_0xab71('0x27')](_0x3dab6f[_0xab71('0x28')]);if(_0x3dab6f[_0xab71('0x29')]){delete _0x3dab6f[_0xab71('0x29')];}_0xe1799a['status'](_0x5cdd01)[_0xab71('0x2a')](_0x3dab6f);};}exports[_0xab71('0x2b')]=function(_0x5209ef,_0x48f3a9){var _0x43d371={},_0x1dfd1e={},_0x3cafbf={'count':0x0,'rows':[]};var _0x545033=db[_0xab71('0x2c')][_0xab71('0x2d')];_0x1dfd1e[_0xab71('0x2e')]=_[_0xab71('0x2f')](_0x545033);_0x1dfd1e['query']=_[_0xab71('0x2f')](_0x5209ef[_0xab71('0x30')]);_0x1dfd1e[_0xab71('0x31')]=_['intersection'](_0x1dfd1e['model'],_0x1dfd1e[_0xab71('0x30')]);_0x43d371[_0xab71('0x32')]=_[_0xab71('0x33')](_0x1dfd1e[_0xab71('0x2e')],qs['fields'](_0x5209ef['query'][_0xab71('0x34')]));_0x43d371[_0xab71('0x32')]=_0x43d371[_0xab71('0x32')]['length']?_0x43d371[_0xab71('0x32')]:_0x1dfd1e[_0xab71('0x2e')];if(!_0x5209ef[_0xab71('0x30')][_0xab71('0x35')]('nolimit')){_0x43d371[_0xab71('0x1c')]=qs[_0xab71('0x1c')](_0x5209ef[_0xab71('0x30')][_0xab71('0x1c')]);_0x43d371[_0xab71('0x1b')]=qs[_0xab71('0x1b')](_0x5209ef[_0xab71('0x30')]['offset']);}_0x43d371[_0xab71('0x36')]=qs['sort'](_0x5209ef['query']['sort']);_0x43d371[_0xab71('0x37')]=qs[_0xab71('0x31')](_['pick'](_0x5209ef[_0xab71('0x30')],_0x1dfd1e[_0xab71('0x31')]));if(_0x5209ef['query'][_0xab71('0x38')]){_0x43d371['where']=_[_0xab71('0x39')](_0x43d371[_0xab71('0x37')],{'$or':_[_0xab71('0x3a')](_0x545033,function(_0xb01591){if(_0xb01591[_0xab71('0x3b')]['key']!==_0xab71('0x3c')){var _0x1965a5={};_0x1965a5[_0xb01591[_0xab71('0x3d')]]={'$like':'%'+_0x5209ef[_0xab71('0x30')][_0xab71('0x38')]+'%'};return _0x1965a5;}})});}_0x43d371=_[_0xab71('0x39')]({},_0x43d371,_0x5209ef[_0xab71('0x3e')]);var _0x5c4eef={'where':_0x43d371[_0xab71('0x37')]};return db[_0xab71('0x2c')][_0xab71('0x1a')](_0x5c4eef)[_0xab71('0x25')](function(_0x2bdfad){_0x3cafbf[_0xab71('0x1a')]=_0x2bdfad;if(_0x5209ef['query'][_0xab71('0x3f')]){_0x43d371[_0xab71('0x40')]=[{'all':!![]}];}return db[_0xab71('0x2c')][_0xab71('0x41')](_0x43d371);})[_0xab71('0x25')](function(_0x83ed4a){_0x3cafbf[_0xab71('0x42')]=_0x83ed4a;return _0x3cafbf;})[_0xab71('0x25')](respondWithFilteredResult(_0x48f3a9,_0x43d371))[_0xab71('0x43')](handleError(_0x48f3a9,null));};exports[_0xab71('0x44')]=function(_0x5b81f5,_0x2d1e8e){var _0x4c81c8={'raw':![],'where':{'id':_0x5b81f5[_0xab71('0x45')]['id']}},_0x40d4ac={};_0x40d4ac[_0xab71('0x2e')]=_[_0xab71('0x2f')](db[_0xab71('0x2c')]['rawAttributes']);_0x40d4ac['query']=_[_0xab71('0x2f')](_0x5b81f5[_0xab71('0x30')]);_0x40d4ac['filters']=_[_0xab71('0x33')](_0x40d4ac[_0xab71('0x2e')],_0x40d4ac[_0xab71('0x30')]);_0x4c81c8[_0xab71('0x32')]=_['intersection'](_0x40d4ac[_0xab71('0x2e')],qs['fields'](_0x5b81f5['query'][_0xab71('0x34')]));_0x4c81c8[_0xab71('0x32')]=_0x4c81c8[_0xab71('0x32')][_0xab71('0x46')]?_0x4c81c8[_0xab71('0x32')]:_0x40d4ac[_0xab71('0x2e')];if(_0x5b81f5[_0xab71('0x30')][_0xab71('0x3f')]){_0x4c81c8[_0xab71('0x40')]=[{'all':!![]}];}_0x4c81c8=_[_0xab71('0x39')]({},_0x4c81c8,_0x5b81f5['options']);return db[_0xab71('0x2c')][_0xab71('0x47')](_0x4c81c8)[_0xab71('0x25')](handleEntityNotFound(_0x2d1e8e,null))[_0xab71('0x25')](respondWithResult(_0x2d1e8e,null))['catch'](handleError(_0x2d1e8e,null));};exports[_0xab71('0x48')]=function(_0x193c5b,_0x11bdeb){return db[_0xab71('0x2c')]['create'](_0x193c5b[_0xab71('0x49')],{})['then'](function(_0x2dd101){var _0x1fd9a7=_0x193c5b[_0xab71('0x4a')][_0xab71('0x23')]({'plain':!![]});if(!_0x1fd9a7)throw new Error(_0xab71('0x4b'));if(_0x1fd9a7['role']===_0xab71('0x4a')){var _0x3836eb=_0x2dd101[_0xab71('0x23')]({'plain':!![]});var _0x5c01b6=_0xab71('0x24');return db[_0xab71('0x4c')][_0xab71('0x47')]({'where':{'name':_0x5c01b6,'userProfileId':_0x1fd9a7['userProfileId']},'raw':!![]})[_0xab71('0x25')](function(_0x4516c9){if(_0x4516c9&&_0x4516c9['autoAssociation']===0x0){return db[_0xab71('0x4d')][_0xab71('0x48')]({'name':_0x3836eb['name'],'resourceId':_0x3836eb['id'],'type':_0x4516c9[_0xab71('0x29')],'sectionId':_0x4516c9['id']},{})[_0xab71('0x25')](function(){return _0x2dd101;});}else{return _0x2dd101;}})[_0xab71('0x43')](function(_0x1465bc){logger[_0xab71('0x27')](_0xab71('0x4e'),_0x1465bc);throw _0x1465bc;});}return _0x2dd101;})['then'](respondWithResult(_0x11bdeb,0xc9))[_0xab71('0x43')](handleError(_0x11bdeb,null));};exports['clone']=function(_0x460296,_0x5079df){var _0x19fa87={'raw':![],'where':{'id':_0x460296['params']['id']}},_0x232261={};_0x232261['model']=_[_0xab71('0x2f')](db[_0xab71('0x2c')][_0xab71('0x2d')]);_0x19fa87[_0xab71('0x32')]=_[_0xab71('0x33')](_0x232261['model'],qs[_0xab71('0x34')](_0x460296['query'][_0xab71('0x34')]));_0x19fa87[_0xab71('0x32')]=_0x19fa87[_0xab71('0x32')][_0xab71('0x46')]?_0x19fa87[_0xab71('0x32')]:_0x232261[_0xab71('0x2e')];if(_0x460296[_0xab71('0x30')][_0xab71('0x3f')]){_0x19fa87['include']=[{'all':!![]}];}_0x19fa87=_['merge']({},_0x19fa87,_0x460296[_0xab71('0x3e')]);return db[_0xab71('0x2c')][_0xab71('0x47')](_0x19fa87)[_0xab71('0x25')](handleEntityNotFound(_0x5079df,null))['then'](function(_0x2fbbec){if(_0x2fbbec){var _0x13bf55=_0x2fbbec[_0xab71('0x23')]({'plain':!![]});_0x13bf55=qs[_0xab71('0x4f')](_0x13bf55,['id','createdAt',_0xab71('0x50')]);_0x460296[_0xab71('0x49')]=_[_0xab71('0x4f')](_0x460296[_0xab71('0x49')],['id',_0xab71('0x51'),_0xab71('0x50')]);return db[_0xab71('0x2c')]['create'](_[_0xab71('0x39')](_0x13bf55,_0x460296[_0xab71('0x49')]),{'include':_0x460296[_0xab71('0x30')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2ea846){var _0x203606=_0x460296[_0xab71('0x4a')][_0xab71('0x23')]({'plain':!![]});if(!_0x203606)throw new Error(_0xab71('0x4b'));if(_0x203606['role']==='user'){var _0xb5e2ba=_0x2ea846[_0xab71('0x23')]({'plain':!![]});var _0x4923bb=_0xab71('0x24');return db[_0xab71('0x4c')]['find']({'where':{'name':_0x4923bb,'userProfileId':_0x203606['userProfileId']},'raw':!![]})[_0xab71('0x25')](function(_0x608a2f){if(_0x608a2f&&_0x608a2f[_0xab71('0x52')]===0x0){return db['UserProfileResource'][_0xab71('0x48')]({'name':_0xb5e2ba[_0xab71('0x29')],'resourceId':_0xb5e2ba['id'],'type':_0x608a2f['name'],'sectionId':_0x608a2f['id']},{})[_0xab71('0x25')](function(){return _0x2ea846;});}else{return _0x2ea846;}})['catch'](function(_0x26307d){logger[_0xab71('0x27')](_0xab71('0x4e'),_0x26307d);throw _0x26307d;});}return _0x2ea846;});}})[_0xab71('0x25')](respondWithResult(_0x5079df,0xc9))[_0xab71('0x43')](handleError(_0x5079df,null));};exports[_0xab71('0x53')]=function(_0x318e39,_0x3ba6ee){if(_0x318e39['body']['id']){delete _0x318e39['body']['id'];}return db[_0xab71('0x2c')][_0xab71('0x47')]({'where':{'id':_0x318e39[_0xab71('0x45')]['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x3ba6ee,null))['then'](saveUpdates(_0x318e39[_0xab71('0x49')],null))[_0xab71('0x25')](respondWithResult(_0x3ba6ee,null))[_0xab71('0x43')](handleError(_0x3ba6ee,null));};exports[_0xab71('0x22')]=function(_0x514046,_0x503e67){return db[_0xab71('0x2c')][_0xab71('0x47')]({'where':{'id':_0x514046['params']['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x503e67,null))[_0xab71('0x25')](removeEntity(_0x503e67,null))[_0xab71('0x43')](handleError(_0x503e67,null));};exports['getHoppers']=function(_0x2a0c2f,_0x361e6b,_0x28b643){var _0x125ae3={'raw':!![],'where':{}};var _0x4a5c0b={};var _0x2053c5={'count':0x0,'rows':[]};return db[_0xab71('0x2c')][_0xab71('0x54')]({'where':{'id':_0x2a0c2f['params']['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x361e6b,null))['then'](function(_0x22c203){if(_0x22c203){_0x4a5c0b[_0xab71('0x2e')]=_[_0xab71('0x2f')](db[_0xab71('0x55')][_0xab71('0x2d')]);_0x4a5c0b[_0xab71('0x30')]=_['keys'](_0x2a0c2f[_0xab71('0x30')]);_0x4a5c0b[_0xab71('0x31')]=_[_0xab71('0x33')](_0x4a5c0b['model'],_0x4a5c0b[_0xab71('0x30')]);_0x125ae3[_0xab71('0x32')]=_[_0xab71('0x33')](_0x4a5c0b[_0xab71('0x2e')],qs[_0xab71('0x34')](_0x2a0c2f[_0xab71('0x30')]['fields']));_0x125ae3[_0xab71('0x32')]=_0x125ae3[_0xab71('0x32')][_0xab71('0x46')]?_0x125ae3[_0xab71('0x32')]:_0x4a5c0b['model'];if(!_0x2a0c2f[_0xab71('0x30')][_0xab71('0x35')](_0xab71('0x56'))){_0x125ae3[_0xab71('0x1c')]=qs['limit'](_0x2a0c2f[_0xab71('0x30')][_0xab71('0x1c')]);_0x125ae3[_0xab71('0x1b')]=qs[_0xab71('0x1b')](_0x2a0c2f[_0xab71('0x30')][_0xab71('0x1b')]);}_0x125ae3['order']=qs[_0xab71('0x57')](_0x2a0c2f[_0xab71('0x30')]['sort']);_0x125ae3[_0xab71('0x37')]=qs[_0xab71('0x31')](_[_0xab71('0x58')](_0x2a0c2f[_0xab71('0x30')],_0x4a5c0b[_0xab71('0x31')]));_0x125ae3[_0xab71('0x37')][_0xab71('0x59')]=_0x22c203['id'];if(_0x2a0c2f[_0xab71('0x30')]['filter']){_0x125ae3[_0xab71('0x37')]=_['merge'](_0x125ae3[_0xab71('0x37')],{'$or':_[_0xab71('0x3a')](_0x125ae3[_0xab71('0x32')],function(_0x4f47b9){var _0x2d7396={};_0x2d7396[_0x4f47b9]={'$like':'%'+_0x2a0c2f[_0xab71('0x30')][_0xab71('0x38')]+'%'};return _0x2d7396;})});}_0x125ae3=_['merge']({},_0x125ae3,_0x2a0c2f[_0xab71('0x3e')]);return db['CmHopper'][_0xab71('0x1a')]({'where':_0x125ae3[_0xab71('0x37')]})['then'](function(_0x4cd121){_0x2053c5[_0xab71('0x1a')]=_0x4cd121;if(_0x2a0c2f[_0xab71('0x30')][_0xab71('0x3f')]){_0x125ae3['include']=[{'all':!![]}];}return db['CmHopper'][_0xab71('0x41')](_0x125ae3);})['then'](function(_0x220337){_0x2053c5[_0xab71('0x42')]=_0x220337;return _0x2053c5;});}})[_0xab71('0x25')](respondWithFilteredResult(_0x361e6b,_0x125ae3))['catch'](handleError(_0x361e6b,null));};exports['getHopperHistories']=function(_0x4e260c,_0x19977a,_0x3c8809){var _0x4ebb0e={'raw':!![],'where':{}};var _0x557333={};var _0x22f800={'count':0x0,'rows':[]};return db[_0xab71('0x2c')][_0xab71('0x54')]({'where':{'id':_0x4e260c['params']['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x19977a,null))['then'](function(_0x4b2867){if(_0x4b2867){_0x557333[_0xab71('0x2e')]=_[_0xab71('0x2f')](db['CmHopperHistory'][_0xab71('0x2d')]);_0x557333[_0xab71('0x30')]=_[_0xab71('0x2f')](_0x4e260c[_0xab71('0x30')]);_0x557333[_0xab71('0x31')]=_[_0xab71('0x33')](_0x557333[_0xab71('0x2e')],_0x557333[_0xab71('0x30')]);_0x4ebb0e[_0xab71('0x32')]=_[_0xab71('0x33')](_0x557333['model'],qs[_0xab71('0x34')](_0x4e260c['query'][_0xab71('0x34')]));_0x4ebb0e[_0xab71('0x32')]=_0x4ebb0e['attributes'][_0xab71('0x46')]?_0x4ebb0e['attributes']:_0x557333[_0xab71('0x2e')];if(!_0x4e260c[_0xab71('0x30')][_0xab71('0x35')](_0xab71('0x56'))){_0x4ebb0e['limit']=qs['limit'](_0x4e260c[_0xab71('0x30')][_0xab71('0x1c')]);_0x4ebb0e[_0xab71('0x1b')]=qs[_0xab71('0x1b')](_0x4e260c[_0xab71('0x30')]['offset']);}_0x4ebb0e['order']=qs[_0xab71('0x57')](_0x4e260c[_0xab71('0x30')][_0xab71('0x57')]);_0x4ebb0e[_0xab71('0x37')]=qs[_0xab71('0x31')](_[_0xab71('0x58')](_0x4e260c[_0xab71('0x30')],_0x557333[_0xab71('0x31')]));_0x4ebb0e['where'][_0xab71('0x59')]=_0x4b2867['id'];if(_0x4e260c[_0xab71('0x30')]['filter']){_0x4ebb0e[_0xab71('0x37')]=_[_0xab71('0x39')](_0x4ebb0e[_0xab71('0x37')],{'$or':_[_0xab71('0x3a')](_0x4ebb0e[_0xab71('0x32')],function(_0x5edb97){var _0x2b8879={};_0x2b8879[_0x5edb97]={'$like':'%'+_0x4e260c['query'][_0xab71('0x38')]+'%'};return _0x2b8879;})});}_0x4ebb0e=_[_0xab71('0x39')]({},_0x4ebb0e,_0x4e260c['options']);return db[_0xab71('0x5a')][_0xab71('0x1a')]({'where':_0x4ebb0e[_0xab71('0x37')]})[_0xab71('0x25')](function(_0x2ba36e){_0x22f800[_0xab71('0x1a')]=_0x2ba36e;if(_0x4e260c[_0xab71('0x30')][_0xab71('0x3f')]){_0x4ebb0e[_0xab71('0x40')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x4ebb0e);})[_0xab71('0x25')](function(_0x3bd5a4){_0x22f800[_0xab71('0x42')]=_0x3bd5a4;return _0x22f800;});}})[_0xab71('0x25')](respondWithFilteredResult(_0x19977a,_0x4ebb0e))[_0xab71('0x43')](handleError(_0x19977a,null));};exports['getHopperFinals']=function(_0x5b4f71,_0x212243,_0x2ea4ec){var _0x5379ed={'raw':!![],'where':{}};var _0x182c83={};var _0x4f618b={'count':0x0,'rows':[]};return db[_0xab71('0x2c')][_0xab71('0x54')]({'where':{'id':_0x5b4f71[_0xab71('0x45')]['id']}})['then'](handleEntityNotFound(_0x212243,null))[_0xab71('0x25')](function(_0x13b32b){if(_0x13b32b){_0x182c83[_0xab71('0x2e')]=_['keys'](db[_0xab71('0x5b')][_0xab71('0x2d')]);_0x182c83[_0xab71('0x30')]=_[_0xab71('0x2f')](_0x5b4f71['query']);_0x182c83[_0xab71('0x31')]=_['intersection'](_0x182c83[_0xab71('0x2e')],_0x182c83[_0xab71('0x30')]);_0x5379ed[_0xab71('0x32')]=_[_0xab71('0x33')](_0x182c83[_0xab71('0x2e')],qs['fields'](_0x5b4f71[_0xab71('0x30')]['fields']));_0x5379ed[_0xab71('0x32')]=_0x5379ed[_0xab71('0x32')][_0xab71('0x46')]?_0x5379ed[_0xab71('0x32')]:_0x182c83[_0xab71('0x2e')];if(!_0x5b4f71[_0xab71('0x30')][_0xab71('0x35')](_0xab71('0x56'))){_0x5379ed['limit']=qs['limit'](_0x5b4f71[_0xab71('0x30')][_0xab71('0x1c')]);_0x5379ed['offset']=qs[_0xab71('0x1b')](_0x5b4f71[_0xab71('0x30')]['offset']);}_0x5379ed[_0xab71('0x36')]=qs[_0xab71('0x57')](_0x5b4f71[_0xab71('0x30')][_0xab71('0x57')]);_0x5379ed[_0xab71('0x37')]=qs[_0xab71('0x31')](_[_0xab71('0x58')](_0x5b4f71[_0xab71('0x30')],_0x182c83[_0xab71('0x31')]));_0x5379ed[_0xab71('0x37')][_0xab71('0x59')]=_0x13b32b['id'];if(_0x5b4f71[_0xab71('0x30')][_0xab71('0x38')]){_0x5379ed[_0xab71('0x37')]=_[_0xab71('0x39')](_0x5379ed[_0xab71('0x37')],{'$or':_[_0xab71('0x3a')](_0x5379ed[_0xab71('0x32')],function(_0x3520b1){var _0x3cd115={};_0x3cd115[_0x3520b1]={'$like':'%'+_0x5b4f71['query'][_0xab71('0x38')]+'%'};return _0x3cd115;})});}_0x5379ed=_['merge']({},_0x5379ed,_0x5b4f71[_0xab71('0x3e')]);return db[_0xab71('0x5b')][_0xab71('0x1a')]({'where':_0x5379ed[_0xab71('0x37')]})[_0xab71('0x25')](function(_0x44f11d){_0x4f618b['count']=_0x44f11d;if(_0x5b4f71[_0xab71('0x30')]['includeAll']){_0x5379ed[_0xab71('0x40')]=[{'all':!![]}];}return db[_0xab71('0x5b')]['findAll'](_0x5379ed);})['then'](function(_0x3b03f0){_0x4f618b[_0xab71('0x42')]=_0x3b03f0;return _0x4f618b;});}})[_0xab71('0x25')](respondWithFilteredResult(_0x212243,_0x5379ed))[_0xab71('0x43')](handleError(_0x212243,null));};exports[_0xab71('0x5c')]=function(_0x32780f,_0x166895,_0x3476d4){var _0x557027={'raw':!![],'where':{}};var _0xf2809a={};var _0x5bbcfd={'count':0x0,'rows':[]};return db[_0xab71('0x2c')][_0xab71('0x54')]({'where':{'id':_0x32780f['params']['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x166895,null))[_0xab71('0x25')](function(_0x87f84a){if(_0x87f84a){_0xf2809a[_0xab71('0x2e')]=_[_0xab71('0x2f')](db[_0xab71('0x5d')][_0xab71('0x2d')]);_0xf2809a[_0xab71('0x30')]=_[_0xab71('0x2f')](_0x32780f[_0xab71('0x30')]);_0xf2809a[_0xab71('0x31')]=_[_0xab71('0x33')](_0xf2809a[_0xab71('0x2e')],_0xf2809a['query']);_0x557027[_0xab71('0x32')]=_[_0xab71('0x33')](_0xf2809a['model'],qs[_0xab71('0x34')](_0x32780f[_0xab71('0x30')][_0xab71('0x34')]));_0x557027[_0xab71('0x32')]=_0x557027[_0xab71('0x32')][_0xab71('0x46')]?_0x557027[_0xab71('0x32')]:_0xf2809a[_0xab71('0x2e')];if(!_0x32780f[_0xab71('0x30')][_0xab71('0x35')](_0xab71('0x56'))){_0x557027[_0xab71('0x1c')]=qs[_0xab71('0x1c')](_0x32780f[_0xab71('0x30')][_0xab71('0x1c')]);_0x557027[_0xab71('0x1b')]=qs['offset'](_0x32780f[_0xab71('0x30')][_0xab71('0x1b')]);}_0x557027[_0xab71('0x36')]=qs[_0xab71('0x57')](_0x32780f[_0xab71('0x30')][_0xab71('0x57')]);_0x557027[_0xab71('0x37')]=qs[_0xab71('0x31')](_[_0xab71('0x58')](_0x32780f[_0xab71('0x30')],_0xf2809a[_0xab71('0x31')]));_0x557027[_0xab71('0x37')][_0xab71('0x59')]=_0x87f84a['id'];if(_0x32780f[_0xab71('0x30')]['filter']){_0x557027[_0xab71('0x37')]=_[_0xab71('0x39')](_0x557027[_0xab71('0x37')],{'$or':_['map'](_0x557027[_0xab71('0x32')],function(_0x3a6a2e){var _0x589002={};_0x589002[_0x3a6a2e]={'$like':'%'+_0x32780f[_0xab71('0x30')][_0xab71('0x38')]+'%'};return _0x589002;})});}_0x557027=_['merge']({},_0x557027,_0x32780f[_0xab71('0x3e')]);return db[_0xab71('0x5d')][_0xab71('0x1a')]({'where':_0x557027[_0xab71('0x37')]})[_0xab71('0x25')](function(_0x554d69){_0x5bbcfd[_0xab71('0x1a')]=_0x554d69;if(_0x32780f[_0xab71('0x30')]['includeAll']){_0x557027[_0xab71('0x40')]=[{'all':!![]}];}return db[_0xab71('0x5d')][_0xab71('0x41')](_0x557027);})[_0xab71('0x25')](function(_0x40b68c){_0x5bbcfd[_0xab71('0x42')]=_0x40b68c;return _0x5bbcfd;});}})[_0xab71('0x25')](respondWithFilteredResult(_0x166895,_0x557027))['catch'](handleError(_0x166895,null));};exports['getLists']=function(_0x2410cf,_0x3cbd1f,_0x38848e){var _0x42eb21={};var _0x25b1b4={};var _0x13524d;var _0x4076a2;return db[_0xab71('0x2c')][_0xab71('0x54')]({'where':{'id':_0x2410cf[_0xab71('0x45')]['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x3cbd1f,null))[_0xab71('0x25')](function(_0x3ee9f9){if(_0x3ee9f9){_0x13524d=_0x3ee9f9;_0x25b1b4[_0xab71('0x2e')]=_[_0xab71('0x2f')](db[_0xab71('0x5e')]['rawAttributes']);_0x25b1b4['query']=_['keys'](_0x2410cf['query']);_0x25b1b4[_0xab71('0x31')]=_['intersection'](_0x25b1b4[_0xab71('0x2e')],_0x25b1b4[_0xab71('0x30')]);_0x42eb21[_0xab71('0x32')]=_[_0xab71('0x33')](_0x25b1b4[_0xab71('0x2e')],qs[_0xab71('0x34')](_0x2410cf[_0xab71('0x30')]['fields']));_0x42eb21[_0xab71('0x32')]=_0x42eb21[_0xab71('0x32')][_0xab71('0x46')]?_0x42eb21[_0xab71('0x32')]:_0x25b1b4[_0xab71('0x2e')];_0x42eb21[_0xab71('0x36')]=qs[_0xab71('0x57')](_0x2410cf['query']['sort']);_0x42eb21[_0xab71('0x37')]=qs[_0xab71('0x31')](_[_0xab71('0x58')](_0x2410cf[_0xab71('0x30')],_0x25b1b4[_0xab71('0x31')]));if(_0x2410cf['query'][_0xab71('0x38')]){_0x42eb21[_0xab71('0x37')]=_[_0xab71('0x39')](_0x42eb21['where'],{'$or':_[_0xab71('0x3a')](_0x42eb21['attributes'],function(_0x2ebd4d){var _0xf39980={};_0xf39980[_0x2ebd4d]={'$like':'%'+_0x2410cf[_0xab71('0x30')][_0xab71('0x38')]+'%'};return _0xf39980;})});}_0x42eb21=_[_0xab71('0x39')]({},_0x42eb21,_0x2410cf['options']);return _0x13524d['getLists'](_0x42eb21);}})['then'](function(_0x367f19){if(_0x367f19){_0x4076a2=_0x367f19[_0xab71('0x46')];if(!_0x2410cf[_0xab71('0x30')]['hasOwnProperty']('nolimit')){_0x42eb21[_0xab71('0x1c')]=qs[_0xab71('0x1c')](_0x2410cf[_0xab71('0x30')][_0xab71('0x1c')]);_0x42eb21[_0xab71('0x1b')]=qs[_0xab71('0x1b')](_0x2410cf['query']['offset']);}return _0x13524d['getLists'](_0x42eb21);}})['then'](function(_0x4ea7c8){if(_0x4ea7c8){return _0x4ea7c8?{'count':_0x4076a2,'rows':_0x4ea7c8}:null;}})[_0xab71('0x25')](respondWithResult(_0x3cbd1f,null))[_0xab71('0x43')](handleError(_0x3cbd1f,null));};exports[_0xab71('0x5f')]=function(_0x5eb357,_0x59e342,_0x446496){var _0xe09018,_0x21e0b1;return db[_0xab71('0x2c')]['find']({'where':{'id':_0x5eb357[_0xab71('0x45')]['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x59e342,null))['then'](function(_0x523300){if(_0x523300){_0x21e0b1=_0x523300;return _0x523300[_0xab71('0x5f')](_0x5eb357[_0xab71('0x49')][_0xab71('0x60')],_[_0xab71('0x4f')](_0x5eb357[_0xab71('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0xbf15b5){var _0x4acf3d;_0xe09018=_0xbf15b5||[];var _0x27d39a=[];if(_0xbf15b5){for(var _0x555355=0x0;_0x555355<_0xbf15b5[_0xab71('0x46')];_0x555355+=0x1){var _0x55a576=_0xbf15b5[_0x555355]['get']({'plain':!![]});_0x21e0b1['dialCheckDuplicateType']=_0x5eb357[_0xab71('0x49')][_0xab71('0x61')]?_0x5eb357[_0xab71('0x49')][_0xab71('0x61')]:_0x21e0b1[_0xab71('0x61')];switch(_0x21e0b1['dialCheckDuplicateType']){case'always':_0x4acf3d=squel[_0xab71('0x62')]()[_0xab71('0x63')](_0xab71('0x64'))[_0xab71('0x65')]([_0xab71('0x66'),_0xab71('0x67'),_0xab71('0x68'),_0xab71('0x69'),'CampaignId',_0xab71('0x51'),_0xab71('0x50')],squel[_0xab71('0x6a')]()[_0xab71('0x3d')]('phone',_0xab71('0x66'))[_0xab71('0x3d')]('NOW()',_0xab71('0x67'))[_0xab71('0x3d')]('id','ContactId')['field'](_0x55a576[_0xab71('0x6b')][_0xab71('0x6c')](),_0xab71('0x69'))[_0xab71('0x3d')](_0x5eb357['params']['id'][_0xab71('0x6c')](),'CampaignId')['field'](_0xab71('0x6d'),_0xab71('0x51'))[_0xab71('0x3d')](_0xab71('0x6d'),_0xab71('0x50'))[_0xab71('0x6e')]('cm_contacts')[_0xab71('0x37')]('deletedAt\x20IS\x20NULL')[_0xab71('0x37')](_0xab71('0x6f'),_0x55a576[_0xab71('0x6b')][_0xab71('0x6c')]())['where'](_0xab71('0x70'))[_0xab71('0x37')](_0xab71('0x71'),squel['select']()[_0xab71('0x3d')](_0xab71('0x72'))['from'](_0xab71('0x73'))[_0xab71('0x37')](_0xab71('0x74'),_0x5eb357['params']['id']['toString']()))[_0xab71('0x37')](_0xab71('0x71'),squel[_0xab71('0x6a')]()['field'](_0xab71('0x75'))[_0xab71('0x6e')](_0xab71('0x64'))[_0xab71('0x37')]('CampaignId\x20=\x20?',_0x5eb357[_0xab71('0x45')]['id'][_0xab71('0x6c')]())))['toString']();break;case _0xab71('0x76'):_0x4acf3d=squel[_0xab71('0x62')]()['into'](_0xab71('0x64'))['fromQuery'](['phone','scheduledAt',_0xab71('0x68'),_0xab71('0x69'),_0xab71('0x59'),_0xab71('0x51'),'updatedAt'],squel['select']()[_0xab71('0x3d')](_0xab71('0x66'),_0xab71('0x66'))[_0xab71('0x3d')](_0xab71('0x6d'),'scheduledAt')[_0xab71('0x3d')]('id',_0xab71('0x68'))[_0xab71('0x3d')](_0x55a576[_0xab71('0x6b')][_0xab71('0x6c')](),'ListId')['field'](_0x5eb357['params']['id'][_0xab71('0x6c')](),_0xab71('0x59'))[_0xab71('0x3d')](_0xab71('0x6d'),_0xab71('0x51'))[_0xab71('0x3d')](_0xab71('0x6d'),_0xab71('0x50'))[_0xab71('0x6e')](_0xab71('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0xab71('0x37')](_0xab71('0x6f'),_0x55a576[_0xab71('0x6b')][_0xab71('0x6c')]())[_0xab71('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0xab71('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xab71('0x6a')]()[_0xab71('0x3d')]('COALESCE(phone,\x27\x27)')[_0xab71('0x6e')]('cm_hopper')[_0xab71('0x37')](_0xab71('0x74'),_0x5eb357[_0xab71('0x45')]['id']['toString']())))[_0xab71('0x6c')]();break;default:_0x4acf3d=squel[_0xab71('0x62')]()[_0xab71('0x63')](_0xab71('0x64'))[_0xab71('0x65')]([_0xab71('0x66'),_0xab71('0x67'),'ContactId',_0xab71('0x69'),_0xab71('0x59'),_0xab71('0x51'),_0xab71('0x50')],squel[_0xab71('0x6a')]()[_0xab71('0x3d')](_0xab71('0x66'),_0xab71('0x66'))[_0xab71('0x3d')](_0xab71('0x6d'),'scheduledAt')[_0xab71('0x3d')]('id',_0xab71('0x68'))['field'](_0x55a576['CmListId']['toString'](),'ListId')[_0xab71('0x3d')](_0x5eb357[_0xab71('0x45')]['id']['toString'](),_0xab71('0x59'))[_0xab71('0x3d')](_0xab71('0x6d'),_0xab71('0x51'))[_0xab71('0x3d')]('NOW()',_0xab71('0x50'))[_0xab71('0x6e')](_0xab71('0x77'))[_0xab71('0x37')](_0xab71('0x78'))[_0xab71('0x37')](_0xab71('0x6f'),_0x55a576[_0xab71('0x6b')][_0xab71('0x6c')]())['where'](_0xab71('0x70')))[_0xab71('0x6c')]();}_0x27d39a[_0xab71('0x79')](db[_0xab71('0x7a')][_0xab71('0x30')](_0x4acf3d));}return BPromise[_0xab71('0x7b')](_0x27d39a);}})[_0xab71('0x25')](function(){return _0xe09018;})['then'](respondWithResult(_0x59e342,null))[_0xab71('0x43')](handleError(_0x59e342,null));};exports[_0xab71('0x7c')]=function(_0x236f71,_0x2edaf0,_0x591407){return db[_0xab71('0x2c')]['find']({'where':{'id':_0x236f71['params']['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x2edaf0,null))[_0xab71('0x25')](function(_0x157289){if(_0x157289){return _0x157289[_0xab71('0x7c')](_0x236f71[_0xab71('0x30')]['ids']);}})[_0xab71('0x25')](function(_0x257aff){if(_0x257aff){return db[_0xab71('0x55')][_0xab71('0x22')]({'where':{'ListId':_0x236f71['query'][_0xab71('0x60')],'CampaignId':_0x236f71[_0xab71('0x45')]['id']}})[_0xab71('0x25')](function(){return _0x257aff;});}})[_0xab71('0x25')](respondWithStatusCode(_0x2edaf0,null))[_0xab71('0x43')](handleError(_0x2edaf0,null));};exports[_0xab71('0x7d')]=function(_0xb248cc,_0x359dda,_0x11bc77){var _0x5b2a38={'raw':!![],'where':{}};var _0x18a757={};var _0xcccf39={'count':0x0,'rows':[]};return db[_0xab71('0x2c')][_0xab71('0x54')]({'where':{'id':_0xb248cc[_0xab71('0x45')]['id']}})['then'](handleEntityNotFound(_0x359dda,null))['then'](function(_0x331a84){if(_0x331a84){_0x18a757[_0xab71('0x2e')]=_['keys'](db[_0xab71('0x5e')]['rawAttributes']);_0x18a757[_0xab71('0x30')]=_[_0xab71('0x2f')](_0xb248cc[_0xab71('0x30')]);_0x18a757[_0xab71('0x31')]=_['intersection'](_0x18a757[_0xab71('0x2e')],_0x18a757['query']);_0x5b2a38['attributes']=_['intersection'](_0x18a757[_0xab71('0x2e')],qs[_0xab71('0x34')](_0xb248cc[_0xab71('0x30')][_0xab71('0x34')]));_0x5b2a38[_0xab71('0x32')]=_0x5b2a38[_0xab71('0x32')]['length']?_0x5b2a38['attributes']:_0x18a757[_0xab71('0x2e')];if(!_0xb248cc[_0xab71('0x30')][_0xab71('0x35')](_0xab71('0x56'))){_0x5b2a38[_0xab71('0x1c')]=qs['limit'](_0xb248cc[_0xab71('0x30')][_0xab71('0x1c')]);_0x5b2a38[_0xab71('0x1b')]=qs[_0xab71('0x1b')](_0xb248cc[_0xab71('0x30')]['offset']);}_0x5b2a38[_0xab71('0x36')]=qs[_0xab71('0x57')](_0xb248cc['query'][_0xab71('0x57')]);_0x5b2a38[_0xab71('0x37')]=qs[_0xab71('0x31')](_[_0xab71('0x58')](_0xb248cc[_0xab71('0x30')],_0x18a757['filters']));_0x5b2a38[_0xab71('0x37')][_0xab71('0x59')]=_0x331a84['id'];if(_0xb248cc[_0xab71('0x30')][_0xab71('0x38')]){_0x5b2a38[_0xab71('0x37')]=_[_0xab71('0x39')](_0x5b2a38['where'],{'$or':_['map'](_0x5b2a38[_0xab71('0x32')],function(_0x5c9be3){var _0xde06b1={};_0xde06b1[_0x5c9be3]={'$like':'%'+_0xb248cc[_0xab71('0x30')][_0xab71('0x38')]+'%'};return _0xde06b1;})});}_0x5b2a38=_['merge']({},_0x5b2a38,_0xb248cc[_0xab71('0x3e')]);return db[_0xab71('0x5e')][_0xab71('0x1a')]({'where':_0x5b2a38['where']})[_0xab71('0x25')](function(_0x1d8472){_0xcccf39[_0xab71('0x1a')]=_0x1d8472;if(_0xb248cc['query'][_0xab71('0x3f')]){_0x5b2a38['include']=[{'all':!![]}];}return db[_0xab71('0x5e')][_0xab71('0x41')](_0x5b2a38);})[_0xab71('0x25')](function(_0x49fd2b){_0xcccf39[_0xab71('0x42')]=_0x49fd2b;return _0xcccf39;});}})[_0xab71('0x25')](respondWithFilteredResult(_0x359dda,_0x5b2a38))['catch'](handleError(_0x359dda,null));};exports[_0xab71('0x7e')]=function(_0x280fd6,_0x5b05e9,_0x5524af){var _0x43a1c7,_0x25a867;return db['Campaign']['find']({'where':{'id':_0x280fd6[_0xab71('0x45')]['id']}})[_0xab71('0x25')](handleEntityNotFound(_0x5b05e9,null))[_0xab71('0x25')](function(_0x2158f0){if(_0x2158f0){_0x25a867=_0x2158f0;return _0x2158f0['addBlackLists'](_0x280fd6[_0xab71('0x49')][_0xab71('0x60')],_[_0xab71('0x4f')](_0x280fd6['body'],[_0xab71('0x60'),'id'])||{});}return null;})[_0xab71('0x7f')](function(_0x5ebd75){var _0x10cf4b;_0x43a1c7=_0x5ebd75||[];var _0x4f63bd=[];if(_0x5ebd75){for(var _0x3108cc=0x0;_0x3108cc<_0x5ebd75['length'];_0x3108cc+=0x1){var _0x7466ba=_0x5ebd75[_0x3108cc]['get']({'plain':!![]});_0x10cf4b=squel['insert']()[_0xab71('0x63')](_0xab71('0x80'))[_0xab71('0x65')]([_0xab71('0x66'),_0xab71('0x68'),_0xab71('0x69'),_0xab71('0x59'),_0xab71('0x51'),_0xab71('0x50')],squel[_0xab71('0x6a')]()[_0xab71('0x3d')](_0xab71('0x66'),_0xab71('0x66'))[_0xab71('0x3d')]('id','ContactId')[_0xab71('0x3d')](_0x7466ba[_0xab71('0x6b')][_0xab71('0x6c')](),'ListId')[_0xab71('0x3d')](_0x280fd6['params']['id']['toString'](),'CampaignId')['field'](_0xab71('0x6d'),'createdAt')['field']('NOW()',_0xab71('0x50'))[_0xab71('0x6e')]('cm_contacts')['where'](_0xab71('0x78'))[_0xab71('0x37')](_0xab71('0x6f'),_0x7466ba['CmListId'][_0xab71('0x6c')]())[_0xab71('0x37')](_0xab71('0x70')))[_0xab71('0x6c')]();_0x4f63bd['push'](db[_0xab71('0x7a')][_0xab71('0x30')](_0x10cf4b));}return BPromise[_0xab71('0x7b')](_0x4f63bd);}})[_0xab71('0x25')](function(){return _0x43a1c7;})[_0xab71('0x25')](respondWithResult(_0x5b05e9,null))[_0xab71('0x43')](handleError(_0x5b05e9,null));};exports['removeBlackLists']=function(_0x3cbf3f,_0x48aebd,_0x47c34f){return db[_0xab71('0x2c')]['find']({'where':{'id':_0x3cbf3f[_0xab71('0x45')]['id']}})['then'](handleEntityNotFound(_0x48aebd,null))[_0xab71('0x25')](function(_0x434c4d){if(_0x434c4d){return _0x434c4d['removeBlackLists'](_0x3cbf3f[_0xab71('0x30')][_0xab71('0x60')]);}})[_0xab71('0x25')](function(_0x563efd){if(_0x563efd){return db[_0xab71('0x5d')][_0xab71('0x22')]({'where':{'ListId':_0x3cbf3f[_0xab71('0x30')]['ids'],'CampaignId':_0x3cbf3f['params']['id']}})[_0xab71('0x25')](function(){return _0x563efd;});}})[_0xab71('0x25')](respondWithStatusCode(_0x48aebd,null))[_0xab71('0x43')](handleError(_0x48aebd,null));}; \ No newline at end of file +var _0x9f24=['update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Campaign','rawAttributes','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','map','type','key','field','merge','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','cm_hopper','phone\x20IS\x20NOT\x20NULL','push','all','removeLists','getBlackLists','addBlackLists','spread','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9f24,0x64));var _0x49f2=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x9f24[_0x1d6a82];return _0x5834ac;};'use strict';var pdf=require(_0x49f2('0x0'));var emlformat=require(_0x49f2('0x1'));var rimraf=require(_0x49f2('0x2'));var zipdir=require(_0x49f2('0x3'));var jsonpatch=require(_0x49f2('0x4'));var rp=require('request-promise');var moment=require(_0x49f2('0x5'));var BPromise=require(_0x49f2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49f2('0x7'));var sox=require(_0x49f2('0x8'));var csv=require(_0x49f2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x49f2('0xa'));var squel=require(_0x49f2('0xb'));var crypto=require('crypto');var jsforce=require(_0x49f2('0xc'));var deskjs=require(_0x49f2('0xd'));var toCsv=require(_0x49f2('0x9'));var querystring=require(_0x49f2('0xe'));var Papa=require(_0x49f2('0xf'));var Redis=require(_0x49f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49f2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49f2('0x12'))(_0x49f2('0x13'));var utils=require(_0x49f2('0x14'));var config=require(_0x49f2('0x15'));var db=require(_0x49f2('0x16'))['db'];function respondWithStatusCode(_0x52abdc,_0x48077b){_0x48077b=_0x48077b||0xcc;return function(_0x40fb30){if(_0x40fb30){return _0x52abdc[_0x49f2('0x17')](_0x48077b);}return _0x52abdc[_0x49f2('0x18')](_0x48077b)[_0x49f2('0x19')]();};}function respondWithResult(_0x22b22c,_0x5062ca){_0x5062ca=_0x5062ca||0xc8;return function(_0xe98101){if(_0xe98101){return _0x22b22c[_0x49f2('0x18')](_0x5062ca)[_0x49f2('0x1a')](_0xe98101);}};}function respondWithFilteredResult(_0x16554c,_0x3502c9){return function(_0x2e3295){if(_0x2e3295){var _0x32a082=_0x2e3295['count'],_0x15cc50=_0x3502c9[_0x49f2('0x1b')],_0xa61048=_0x3502c9[_0x49f2('0x1b')]+_0x3502c9[_0x49f2('0x1c')],_0x32d1d5;if(_0xa61048>=_0x32a082){_0xa61048=_0x32a082;_0x32d1d5=0xc8;}else{_0x32d1d5=0xce;}_0x16554c[_0x49f2('0x18')](_0x32d1d5);return _0x16554c[_0x49f2('0x1d')](_0x49f2('0x1e'),_0x15cc50+'-'+_0xa61048+'/'+_0x32a082)['json'](_0x2e3295);}return null;};}function patchUpdates(_0x1e03dc){return function(_0x273d14){try{jsonpatch['apply'](_0x273d14,_0x1e03dc,!![]);}catch(_0x3fbb7b){return BPromise[_0x49f2('0x1f')](_0x3fbb7b);}return _0x273d14['save']();};}function saveUpdates(_0x2576d2,_0x2d03e9){return function(_0xc3ff8f){if(_0xc3ff8f){return _0xc3ff8f[_0x49f2('0x20')](_0x2576d2)[_0x49f2('0x21')](function(_0xf42af0){return _0xf42af0;});}return null;};}function removeEntity(_0x2e4c11,_0x2d4d7c){return function(_0x587019){if(_0x587019){return _0x587019['destroy']()[_0x49f2('0x21')](function(){var _0x7f94c3=_0x587019[_0x49f2('0x22')]({'plain':!![]});var _0xb1b7c2='IvrCampaigns';return db[_0x49f2('0x23')][_0x49f2('0x24')]({'where':{'type':_0xb1b7c2,'resourceId':_0x7f94c3['id']}})[_0x49f2('0x21')](function(){return _0x587019;});})[_0x49f2('0x21')](function(){_0x2e4c11[_0x49f2('0x18')](0xcc)[_0x49f2('0x19')]();});}};}function handleEntityNotFound(_0x1f2f62,_0x49504d){return function(_0x16084e){if(!_0x16084e){_0x1f2f62[_0x49f2('0x17')](0x194);}return _0x16084e;};}function handleError(_0xe23ba3,_0x418511){_0x418511=_0x418511||0x1f4;return function(_0x26557a){logger[_0x49f2('0x25')](_0x26557a[_0x49f2('0x26')]);if(_0x26557a[_0x49f2('0x27')]){delete _0x26557a[_0x49f2('0x27')];}_0xe23ba3[_0x49f2('0x18')](_0x418511)[_0x49f2('0x28')](_0x26557a);};}exports[_0x49f2('0x29')]=function(_0x3ffe2a,_0x3dcba9){var _0x5cc155={},_0x5de05a={},_0x498112={'count':0x0,'rows':[]};var _0xa6a52e=db[_0x49f2('0x2a')][_0x49f2('0x2b')];_0x5de05a[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](_0xa6a52e);_0x5de05a[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x3ffe2a[_0x49f2('0x2e')]);_0x5de05a[_0x49f2('0x2f')]=_['intersection'](_0x5de05a[_0x49f2('0x2c')],_0x5de05a['query']);_0x5cc155['attributes']=_['intersection'](_0x5de05a[_0x49f2('0x2c')],qs[_0x49f2('0x30')](_0x3ffe2a[_0x49f2('0x2e')][_0x49f2('0x30')]));_0x5cc155['attributes']=_0x5cc155[_0x49f2('0x31')][_0x49f2('0x32')]?_0x5cc155['attributes']:_0x5de05a['model'];if(!_0x3ffe2a['query'][_0x49f2('0x33')](_0x49f2('0x34'))){_0x5cc155[_0x49f2('0x1c')]=qs[_0x49f2('0x1c')](_0x3ffe2a[_0x49f2('0x2e')][_0x49f2('0x1c')]);_0x5cc155[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x3ffe2a['query'][_0x49f2('0x1b')]);}_0x5cc155[_0x49f2('0x35')]=qs['sort'](_0x3ffe2a[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x5cc155[_0x49f2('0x37')]=qs[_0x49f2('0x2f')](_['pick'](_0x3ffe2a['query'],_0x5de05a[_0x49f2('0x2f')]));if(_0x3ffe2a[_0x49f2('0x2e')][_0x49f2('0x38')]){_0x5cc155[_0x49f2('0x37')]=_['merge'](_0x5cc155[_0x49f2('0x37')],{'$or':_[_0x49f2('0x39')](_0xa6a52e,function(_0x4dbdc3){if(_0x4dbdc3[_0x49f2('0x3a')][_0x49f2('0x3b')]!=='VIRTUAL'){var _0x4ae5c4={};_0x4ae5c4[_0x4dbdc3[_0x49f2('0x3c')]]={'$like':'%'+_0x3ffe2a[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0x4ae5c4;}})});}_0x5cc155=_[_0x49f2('0x3d')]({},_0x5cc155,_0x3ffe2a[_0x49f2('0x3e')]);var _0x37f6e1={'where':_0x5cc155[_0x49f2('0x37')]};return db[_0x49f2('0x2a')][_0x49f2('0x3f')](_0x37f6e1)[_0x49f2('0x21')](function(_0x3748df){_0x498112[_0x49f2('0x3f')]=_0x3748df;if(_0x3ffe2a['query'][_0x49f2('0x40')]){_0x5cc155['include']=[{'all':!![]}];}return db[_0x49f2('0x2a')][_0x49f2('0x41')](_0x5cc155);})[_0x49f2('0x21')](function(_0x1dc3d5){_0x498112[_0x49f2('0x42')]=_0x1dc3d5;return _0x498112;})[_0x49f2('0x21')](respondWithFilteredResult(_0x3dcba9,_0x5cc155))[_0x49f2('0x43')](handleError(_0x3dcba9,null));};exports[_0x49f2('0x44')]=function(_0x3f6f87,_0x5f2cb4){var _0x5e8adc={'raw':![],'where':{'id':_0x3f6f87[_0x49f2('0x45')]['id']}},_0xfdc1fa={};_0xfdc1fa[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](db[_0x49f2('0x2a')][_0x49f2('0x2b')]);_0xfdc1fa[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x3f6f87[_0x49f2('0x2e')]);_0xfdc1fa[_0x49f2('0x2f')]=_['intersection'](_0xfdc1fa[_0x49f2('0x2c')],_0xfdc1fa['query']);_0x5e8adc['attributes']=_[_0x49f2('0x46')](_0xfdc1fa[_0x49f2('0x2c')],qs[_0x49f2('0x30')](_0x3f6f87['query'][_0x49f2('0x30')]));_0x5e8adc[_0x49f2('0x31')]=_0x5e8adc[_0x49f2('0x31')][_0x49f2('0x32')]?_0x5e8adc[_0x49f2('0x31')]:_0xfdc1fa[_0x49f2('0x2c')];if(_0x3f6f87[_0x49f2('0x2e')][_0x49f2('0x40')]){_0x5e8adc[_0x49f2('0x47')]=[{'all':!![]}];}_0x5e8adc=_[_0x49f2('0x3d')]({},_0x5e8adc,_0x3f6f87[_0x49f2('0x3e')]);return db['Campaign'][_0x49f2('0x48')](_0x5e8adc)['then'](handleEntityNotFound(_0x5f2cb4,null))[_0x49f2('0x21')](respondWithResult(_0x5f2cb4,null))[_0x49f2('0x43')](handleError(_0x5f2cb4,null));};exports[_0x49f2('0x49')]=function(_0x2e7660,_0x4ef52b){return db['Campaign'][_0x49f2('0x49')](_0x2e7660[_0x49f2('0x4a')],{})['then'](function(_0x3e4bb2){var _0x26349a=_0x2e7660[_0x49f2('0x4b')][_0x49f2('0x22')]({'plain':!![]});if(!_0x26349a)throw new Error(_0x49f2('0x4c'));if(_0x26349a[_0x49f2('0x4d')]===_0x49f2('0x4b')){var _0xc9ad46=_0x3e4bb2[_0x49f2('0x22')]({'plain':!![]});var _0x5e5f17=_0x49f2('0x4e');return db[_0x49f2('0x4f')]['find']({'where':{'name':_0x5e5f17,'userProfileId':_0x26349a[_0x49f2('0x50')]},'raw':!![]})[_0x49f2('0x21')](function(_0x3d656a){if(_0x3d656a&&_0x3d656a['autoAssociation']===0x0){return db[_0x49f2('0x23')][_0x49f2('0x49')]({'name':_0xc9ad46[_0x49f2('0x27')],'resourceId':_0xc9ad46['id'],'type':_0x3d656a['name'],'sectionId':_0x3d656a['id']},{})[_0x49f2('0x21')](function(){return _0x3e4bb2;});}else{return _0x3e4bb2;}})[_0x49f2('0x43')](function(_0x3e0e56){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e0e56);throw _0x3e0e56;});}return _0x3e4bb2;})[_0x49f2('0x21')](respondWithResult(_0x4ef52b,0xc9))[_0x49f2('0x43')](handleError(_0x4ef52b,null));};exports[_0x49f2('0x51')]=function(_0x447099,_0x423807){var _0x19602c={'raw':![],'where':{'id':_0x447099[_0x49f2('0x45')]['id']}},_0x43c5c3={};_0x43c5c3[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](db[_0x49f2('0x2a')][_0x49f2('0x2b')]);_0x19602c[_0x49f2('0x31')]=_[_0x49f2('0x46')](_0x43c5c3['model'],qs[_0x49f2('0x30')](_0x447099[_0x49f2('0x2e')][_0x49f2('0x30')]));_0x19602c[_0x49f2('0x31')]=_0x19602c['attributes'][_0x49f2('0x32')]?_0x19602c[_0x49f2('0x31')]:_0x43c5c3[_0x49f2('0x2c')];if(_0x447099[_0x49f2('0x2e')][_0x49f2('0x40')]){_0x19602c[_0x49f2('0x47')]=[{'all':!![]}];}_0x19602c=_[_0x49f2('0x3d')]({},_0x19602c,_0x447099[_0x49f2('0x3e')]);return db[_0x49f2('0x2a')][_0x49f2('0x48')](_0x19602c)[_0x49f2('0x21')](handleEntityNotFound(_0x423807,null))['then'](function(_0xcff724){if(_0xcff724){var _0x2d453c=_0xcff724['get']({'plain':!![]});_0x2d453c=qs[_0x49f2('0x52')](_0x2d453c,['id','createdAt','updatedAt']);_0x447099['body']=_[_0x49f2('0x52')](_0x447099[_0x49f2('0x4a')],['id',_0x49f2('0x53'),_0x49f2('0x54')]);return db[_0x49f2('0x2a')][_0x49f2('0x49')](_[_0x49f2('0x3d')](_0x2d453c,_0x447099[_0x49f2('0x4a')]),{'include':_0x447099[_0x49f2('0x2e')][_0x49f2('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x58d840){var _0x341aca=_0x447099[_0x49f2('0x4b')][_0x49f2('0x22')]({'plain':!![]});if(!_0x341aca)throw new Error(_0x49f2('0x4c'));if(_0x341aca['role']===_0x49f2('0x4b')){var _0x3a4c24=_0x58d840[_0x49f2('0x22')]({'plain':!![]});var _0x37304a=_0x49f2('0x4e');return db[_0x49f2('0x4f')]['find']({'where':{'name':_0x37304a,'userProfileId':_0x341aca[_0x49f2('0x50')]},'raw':!![]})['then'](function(_0xc8f80d){if(_0xc8f80d&&_0xc8f80d['autoAssociation']===0x0){return db[_0x49f2('0x23')][_0x49f2('0x49')]({'name':_0x3a4c24[_0x49f2('0x27')],'resourceId':_0x3a4c24['id'],'type':_0xc8f80d[_0x49f2('0x27')],'sectionId':_0xc8f80d['id']},{})[_0x49f2('0x21')](function(){return _0x58d840;});}else{return _0x58d840;}})['catch'](function(_0x383b3f){logger[_0x49f2('0x25')](_0x49f2('0x55'),_0x383b3f);throw _0x383b3f;});}return _0x58d840;});}})['then'](respondWithResult(_0x423807,0xc9))[_0x49f2('0x43')](handleError(_0x423807,null));};exports[_0x49f2('0x20')]=function(_0x47defc,_0x4f5520){if(_0x47defc[_0x49f2('0x4a')]['id']){delete _0x47defc['body']['id'];}return db[_0x49f2('0x2a')][_0x49f2('0x48')]({'where':{'id':_0x47defc['params']['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x4f5520,null))[_0x49f2('0x21')](saveUpdates(_0x47defc[_0x49f2('0x4a')],null))[_0x49f2('0x21')](respondWithResult(_0x4f5520,null))[_0x49f2('0x43')](handleError(_0x4f5520,null));};exports['destroy']=function(_0x13adb0,_0x5f00ad){return db['Campaign']['find']({'where':{'id':_0x13adb0[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x5f00ad,null))['then'](removeEntity(_0x5f00ad,null))[_0x49f2('0x43')](handleError(_0x5f00ad,null));};exports[_0x49f2('0x56')]=function(_0x269c3d,_0x4e076b,_0x4235ac){var _0x327ae3={'raw':!![],'where':{}};var _0x220043={};var _0x29c111={'count':0x0,'rows':[]};return db[_0x49f2('0x2a')][_0x49f2('0x57')]({'where':{'id':_0x269c3d[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x4e076b,null))[_0x49f2('0x21')](function(_0x1c2b84){if(_0x1c2b84){_0x220043[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](db[_0x49f2('0x58')][_0x49f2('0x2b')]);_0x220043[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x269c3d[_0x49f2('0x2e')]);_0x220043[_0x49f2('0x2f')]=_[_0x49f2('0x46')](_0x220043[_0x49f2('0x2c')],_0x220043['query']);_0x327ae3[_0x49f2('0x31')]=_[_0x49f2('0x46')](_0x220043[_0x49f2('0x2c')],qs[_0x49f2('0x30')](_0x269c3d['query'][_0x49f2('0x30')]));_0x327ae3[_0x49f2('0x31')]=_0x327ae3[_0x49f2('0x31')]['length']?_0x327ae3[_0x49f2('0x31')]:_0x220043[_0x49f2('0x2c')];if(!_0x269c3d[_0x49f2('0x2e')][_0x49f2('0x33')](_0x49f2('0x34'))){_0x327ae3[_0x49f2('0x1c')]=qs[_0x49f2('0x1c')](_0x269c3d[_0x49f2('0x2e')][_0x49f2('0x1c')]);_0x327ae3[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x269c3d[_0x49f2('0x2e')][_0x49f2('0x1b')]);}_0x327ae3['order']=qs['sort'](_0x269c3d[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x327ae3[_0x49f2('0x37')]=qs[_0x49f2('0x2f')](_[_0x49f2('0x59')](_0x269c3d['query'],_0x220043[_0x49f2('0x2f')]));_0x327ae3[_0x49f2('0x37')][_0x49f2('0x5a')]=_0x1c2b84['id'];if(_0x269c3d['query'][_0x49f2('0x38')]){_0x327ae3[_0x49f2('0x37')]=_[_0x49f2('0x3d')](_0x327ae3[_0x49f2('0x37')],{'$or':_[_0x49f2('0x39')](_0x327ae3[_0x49f2('0x31')],function(_0x2f2311){var _0x326b1c={};_0x326b1c[_0x2f2311]={'$like':'%'+_0x269c3d[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0x326b1c;})});}_0x327ae3=_['merge']({},_0x327ae3,_0x269c3d[_0x49f2('0x3e')]);return db['CmHopper']['count']({'where':_0x327ae3['where']})[_0x49f2('0x21')](function(_0x31ec51){_0x29c111[_0x49f2('0x3f')]=_0x31ec51;if(_0x269c3d[_0x49f2('0x2e')][_0x49f2('0x40')]){_0x327ae3[_0x49f2('0x47')]=[{'all':!![]}];}return db[_0x49f2('0x58')]['findAll'](_0x327ae3);})[_0x49f2('0x21')](function(_0x50dfc1){_0x29c111[_0x49f2('0x42')]=_0x50dfc1;return _0x29c111;});}})[_0x49f2('0x21')](respondWithFilteredResult(_0x4e076b,_0x327ae3))[_0x49f2('0x43')](handleError(_0x4e076b,null));};exports[_0x49f2('0x5b')]=function(_0x4e1a9e,_0x5bccde,_0x4776a6){var _0x46b89d={'raw':!![],'where':{}};var _0x3e57e9={};var _0x1f12dd={'count':0x0,'rows':[]};return db[_0x49f2('0x2a')]['findOne']({'where':{'id':_0x4e1a9e[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x5bccde,null))[_0x49f2('0x21')](function(_0x5e36a6){if(_0x5e36a6){_0x3e57e9[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](db['CmHopperHistory'][_0x49f2('0x2b')]);_0x3e57e9[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x4e1a9e[_0x49f2('0x2e')]);_0x3e57e9[_0x49f2('0x2f')]=_[_0x49f2('0x46')](_0x3e57e9[_0x49f2('0x2c')],_0x3e57e9['query']);_0x46b89d['attributes']=_[_0x49f2('0x46')](_0x3e57e9['model'],qs['fields'](_0x4e1a9e['query']['fields']));_0x46b89d[_0x49f2('0x31')]=_0x46b89d[_0x49f2('0x31')]['length']?_0x46b89d[_0x49f2('0x31')]:_0x3e57e9[_0x49f2('0x2c')];if(!_0x4e1a9e[_0x49f2('0x2e')][_0x49f2('0x33')](_0x49f2('0x34'))){_0x46b89d['limit']=qs['limit'](_0x4e1a9e[_0x49f2('0x2e')]['limit']);_0x46b89d[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x4e1a9e[_0x49f2('0x2e')][_0x49f2('0x1b')]);}_0x46b89d[_0x49f2('0x35')]=qs[_0x49f2('0x36')](_0x4e1a9e[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x46b89d['where']=qs[_0x49f2('0x2f')](_['pick'](_0x4e1a9e[_0x49f2('0x2e')],_0x3e57e9[_0x49f2('0x2f')]));_0x46b89d['where'][_0x49f2('0x5a')]=_0x5e36a6['id'];if(_0x4e1a9e[_0x49f2('0x2e')][_0x49f2('0x38')]){_0x46b89d['where']=_[_0x49f2('0x3d')](_0x46b89d['where'],{'$or':_[_0x49f2('0x39')](_0x46b89d[_0x49f2('0x31')],function(_0x13c15c){var _0x90fb64={};_0x90fb64[_0x13c15c]={'$like':'%'+_0x4e1a9e[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0x90fb64;})});}_0x46b89d=_[_0x49f2('0x3d')]({},_0x46b89d,_0x4e1a9e[_0x49f2('0x3e')]);return db[_0x49f2('0x5c')][_0x49f2('0x3f')]({'where':_0x46b89d[_0x49f2('0x37')]})['then'](function(_0x33b341){_0x1f12dd[_0x49f2('0x3f')]=_0x33b341;if(_0x4e1a9e['query'][_0x49f2('0x40')]){_0x46b89d['include']=[{'all':!![]}];}return db[_0x49f2('0x5c')][_0x49f2('0x41')](_0x46b89d);})[_0x49f2('0x21')](function(_0x56c422){_0x1f12dd['rows']=_0x56c422;return _0x1f12dd;});}})[_0x49f2('0x21')](respondWithFilteredResult(_0x5bccde,_0x46b89d))['catch'](handleError(_0x5bccde,null));};exports['getHopperFinals']=function(_0x334ac4,_0x15ee7c,_0x129db5){var _0x40c825={'raw':!![],'where':{}};var _0x540e5c={};var _0x40cf48={'count':0x0,'rows':[]};return db[_0x49f2('0x2a')][_0x49f2('0x57')]({'where':{'id':_0x334ac4['params']['id']}})['then'](handleEntityNotFound(_0x15ee7c,null))['then'](function(_0x155424){if(_0x155424){_0x540e5c[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](db[_0x49f2('0x5d')][_0x49f2('0x2b')]);_0x540e5c[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x334ac4[_0x49f2('0x2e')]);_0x540e5c[_0x49f2('0x2f')]=_[_0x49f2('0x46')](_0x540e5c[_0x49f2('0x2c')],_0x540e5c[_0x49f2('0x2e')]);_0x40c825[_0x49f2('0x31')]=_['intersection'](_0x540e5c[_0x49f2('0x2c')],qs['fields'](_0x334ac4['query']['fields']));_0x40c825['attributes']=_0x40c825[_0x49f2('0x31')][_0x49f2('0x32')]?_0x40c825[_0x49f2('0x31')]:_0x540e5c[_0x49f2('0x2c')];if(!_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x33')]('nolimit')){_0x40c825[_0x49f2('0x1c')]=qs['limit'](_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x1c')]);_0x40c825[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x1b')]);}_0x40c825[_0x49f2('0x35')]=qs[_0x49f2('0x36')](_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x40c825['where']=qs[_0x49f2('0x2f')](_[_0x49f2('0x59')](_0x334ac4[_0x49f2('0x2e')],_0x540e5c['filters']));_0x40c825[_0x49f2('0x37')][_0x49f2('0x5a')]=_0x155424['id'];if(_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x38')]){_0x40c825['where']=_[_0x49f2('0x3d')](_0x40c825[_0x49f2('0x37')],{'$or':_[_0x49f2('0x39')](_0x40c825[_0x49f2('0x31')],function(_0x10adde){var _0x15a304={};_0x15a304[_0x10adde]={'$like':'%'+_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0x15a304;})});}_0x40c825=_[_0x49f2('0x3d')]({},_0x40c825,_0x334ac4['options']);return db[_0x49f2('0x5d')][_0x49f2('0x3f')]({'where':_0x40c825['where']})[_0x49f2('0x21')](function(_0x27625a){_0x40cf48['count']=_0x27625a;if(_0x334ac4[_0x49f2('0x2e')][_0x49f2('0x40')]){_0x40c825['include']=[{'all':!![]}];}return db[_0x49f2('0x5d')][_0x49f2('0x41')](_0x40c825);})['then'](function(_0x43848a){_0x40cf48[_0x49f2('0x42')]=_0x43848a;return _0x40cf48;});}})['then'](respondWithFilteredResult(_0x15ee7c,_0x40c825))[_0x49f2('0x43')](handleError(_0x15ee7c,null));};exports[_0x49f2('0x5e')]=function(_0x3bfdd9,_0x412946,_0x4fadd0){var _0x5a22fe={'raw':!![],'where':{}};var _0x372053={};var _0x17940d={'count':0x0,'rows':[]};return db['Campaign'][_0x49f2('0x57')]({'where':{'id':_0x3bfdd9[_0x49f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x412946,null))[_0x49f2('0x21')](function(_0x3af587){if(_0x3af587){_0x372053[_0x49f2('0x2c')]=_[_0x49f2('0x2d')](db[_0x49f2('0x5f')][_0x49f2('0x2b')]);_0x372053[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x3bfdd9[_0x49f2('0x2e')]);_0x372053['filters']=_[_0x49f2('0x46')](_0x372053[_0x49f2('0x2c')],_0x372053[_0x49f2('0x2e')]);_0x5a22fe[_0x49f2('0x31')]=_[_0x49f2('0x46')](_0x372053[_0x49f2('0x2c')],qs[_0x49f2('0x30')](_0x3bfdd9['query'][_0x49f2('0x30')]));_0x5a22fe[_0x49f2('0x31')]=_0x5a22fe[_0x49f2('0x31')][_0x49f2('0x32')]?_0x5a22fe['attributes']:_0x372053['model'];if(!_0x3bfdd9['query']['hasOwnProperty'](_0x49f2('0x34'))){_0x5a22fe[_0x49f2('0x1c')]=qs[_0x49f2('0x1c')](_0x3bfdd9[_0x49f2('0x2e')]['limit']);_0x5a22fe[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x3bfdd9[_0x49f2('0x2e')]['offset']);}_0x5a22fe[_0x49f2('0x35')]=qs[_0x49f2('0x36')](_0x3bfdd9[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x5a22fe['where']=qs[_0x49f2('0x2f')](_[_0x49f2('0x59')](_0x3bfdd9[_0x49f2('0x2e')],_0x372053[_0x49f2('0x2f')]));_0x5a22fe[_0x49f2('0x37')][_0x49f2('0x5a')]=_0x3af587['id'];if(_0x3bfdd9[_0x49f2('0x2e')][_0x49f2('0x38')]){_0x5a22fe[_0x49f2('0x37')]=_[_0x49f2('0x3d')](_0x5a22fe[_0x49f2('0x37')],{'$or':_[_0x49f2('0x39')](_0x5a22fe[_0x49f2('0x31')],function(_0x2e6b5a){var _0x52cbb8={};_0x52cbb8[_0x2e6b5a]={'$like':'%'+_0x3bfdd9[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0x52cbb8;})});}_0x5a22fe=_[_0x49f2('0x3d')]({},_0x5a22fe,_0x3bfdd9['options']);return db[_0x49f2('0x5f')][_0x49f2('0x3f')]({'where':_0x5a22fe[_0x49f2('0x37')]})[_0x49f2('0x21')](function(_0x4261fe){_0x17940d['count']=_0x4261fe;if(_0x3bfdd9['query']['includeAll']){_0x5a22fe[_0x49f2('0x47')]=[{'all':!![]}];}return db[_0x49f2('0x5f')][_0x49f2('0x41')](_0x5a22fe);})[_0x49f2('0x21')](function(_0x13f8c9){_0x17940d[_0x49f2('0x42')]=_0x13f8c9;return _0x17940d;});}})['then'](respondWithFilteredResult(_0x412946,_0x5a22fe))[_0x49f2('0x43')](handleError(_0x412946,null));};exports[_0x49f2('0x60')]=function(_0x5c8fd4,_0x1dec39,_0x1c581f){var _0x151b71={};var _0x4d2dde={};var _0x4e4907;var _0x3822ff;return db[_0x49f2('0x2a')][_0x49f2('0x57')]({'where':{'id':_0x5c8fd4[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x1dec39,null))[_0x49f2('0x21')](function(_0x3bb5f8){if(_0x3bb5f8){_0x4e4907=_0x3bb5f8;_0x4d2dde['model']=_[_0x49f2('0x2d')](db[_0x49f2('0x61')][_0x49f2('0x2b')]);_0x4d2dde[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x5c8fd4[_0x49f2('0x2e')]);_0x4d2dde[_0x49f2('0x2f')]=_[_0x49f2('0x46')](_0x4d2dde[_0x49f2('0x2c')],_0x4d2dde['query']);_0x151b71[_0x49f2('0x31')]=_[_0x49f2('0x46')](_0x4d2dde['model'],qs[_0x49f2('0x30')](_0x5c8fd4[_0x49f2('0x2e')][_0x49f2('0x30')]));_0x151b71[_0x49f2('0x31')]=_0x151b71['attributes'][_0x49f2('0x32')]?_0x151b71[_0x49f2('0x31')]:_0x4d2dde[_0x49f2('0x2c')];_0x151b71['order']=qs[_0x49f2('0x36')](_0x5c8fd4[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x151b71[_0x49f2('0x37')]=qs[_0x49f2('0x2f')](_[_0x49f2('0x59')](_0x5c8fd4[_0x49f2('0x2e')],_0x4d2dde['filters']));if(_0x5c8fd4[_0x49f2('0x2e')][_0x49f2('0x38')]){_0x151b71[_0x49f2('0x37')]=_['merge'](_0x151b71[_0x49f2('0x37')],{'$or':_['map'](_0x151b71['attributes'],function(_0x4a7c0d){var _0x41bc5b={};_0x41bc5b[_0x4a7c0d]={'$like':'%'+_0x5c8fd4[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0x41bc5b;})});}_0x151b71=_[_0x49f2('0x3d')]({},_0x151b71,_0x5c8fd4['options']);return _0x4e4907['getLists'](_0x151b71);}})[_0x49f2('0x21')](function(_0x529105){if(_0x529105){_0x3822ff=_0x529105[_0x49f2('0x32')];if(!_0x5c8fd4[_0x49f2('0x2e')][_0x49f2('0x33')](_0x49f2('0x34'))){_0x151b71['limit']=qs[_0x49f2('0x1c')](_0x5c8fd4['query']['limit']);_0x151b71[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x5c8fd4[_0x49f2('0x2e')][_0x49f2('0x1b')]);}return _0x4e4907[_0x49f2('0x60')](_0x151b71);}})['then'](function(_0x54615a){if(_0x54615a){return _0x54615a?{'count':_0x3822ff,'rows':_0x54615a}:null;}})[_0x49f2('0x21')](respondWithResult(_0x1dec39,null))['catch'](handleError(_0x1dec39,null));};exports['addLists']=function(_0x1f3d75,_0xf2f1d8,_0x54f2ee){var _0x923020,_0x13cc1c;return db[_0x49f2('0x2a')]['find']({'where':{'id':_0x1f3d75['params']['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0xf2f1d8,null))['then'](function(_0x5c6230){if(_0x5c6230){_0x13cc1c=_0x5c6230;return _0x5c6230[_0x49f2('0x62')](_0x1f3d75[_0x49f2('0x4a')][_0x49f2('0x63')],_[_0x49f2('0x52')](_0x1f3d75[_0x49f2('0x4a')],[_0x49f2('0x63'),'id'])||{});}return null;})['spread'](function(_0x599723){var _0x20c6be;_0x923020=_0x599723||[];var _0x1ad817=[];if(_0x599723){for(var _0x170233=0x0;_0x170233<_0x599723[_0x49f2('0x32')];_0x170233+=0x1){var _0x20e78f=_0x599723[_0x170233][_0x49f2('0x22')]({'plain':!![]});_0x13cc1c[_0x49f2('0x64')]=_0x1f3d75['body']['dialCheckDuplicateType']?_0x1f3d75[_0x49f2('0x4a')][_0x49f2('0x64')]:_0x13cc1c[_0x49f2('0x64')];switch(_0x13cc1c[_0x49f2('0x64')]){case _0x49f2('0x65'):_0x20c6be=squel['insert']()[_0x49f2('0x66')]('cm_hopper')[_0x49f2('0x67')]([_0x49f2('0x68'),_0x49f2('0x69'),_0x49f2('0x6a'),_0x49f2('0x6b'),'CampaignId',_0x49f2('0x53'),'updatedAt'],squel[_0x49f2('0x6c')]()[_0x49f2('0x3c')](_0x49f2('0x68'),'phone')['field'](_0x49f2('0x6d'),'scheduledAt')[_0x49f2('0x3c')]('id','ContactId')['field'](_0x20e78f[_0x49f2('0x6e')][_0x49f2('0x6f')](),_0x49f2('0x6b'))[_0x49f2('0x3c')](_0x1f3d75[_0x49f2('0x45')]['id'][_0x49f2('0x6f')](),_0x49f2('0x5a'))['field'](_0x49f2('0x6d'),_0x49f2('0x53'))['field']('NOW()',_0x49f2('0x54'))[_0x49f2('0x70')](_0x49f2('0x71'))[_0x49f2('0x37')](_0x49f2('0x72'))['where'](_0x49f2('0x73'),_0x20e78f[_0x49f2('0x6e')][_0x49f2('0x6f')]())[_0x49f2('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0x49f2('0x37')](_0x49f2('0x74'),squel['select']()[_0x49f2('0x3c')](_0x49f2('0x75'))[_0x49f2('0x70')]('cm_hopper_final')[_0x49f2('0x37')]('CampaignId\x20=\x20?',_0x1f3d75[_0x49f2('0x45')]['id'][_0x49f2('0x6f')]()))['where'](_0x49f2('0x74'),squel[_0x49f2('0x6c')]()[_0x49f2('0x3c')](_0x49f2('0x76'))[_0x49f2('0x70')]('cm_hopper')[_0x49f2('0x37')](_0x49f2('0x77'),_0x1f3d75[_0x49f2('0x45')]['id'][_0x49f2('0x6f')]())))[_0x49f2('0x6f')]();break;case _0x49f2('0x78'):_0x20c6be=squel[_0x49f2('0x79')]()[_0x49f2('0x66')](_0x49f2('0x7a'))[_0x49f2('0x67')]([_0x49f2('0x68'),_0x49f2('0x69'),'ContactId','ListId',_0x49f2('0x5a'),_0x49f2('0x53'),'updatedAt'],squel['select']()[_0x49f2('0x3c')](_0x49f2('0x68'),'phone')[_0x49f2('0x3c')](_0x49f2('0x6d'),_0x49f2('0x69'))[_0x49f2('0x3c')]('id',_0x49f2('0x6a'))[_0x49f2('0x3c')](_0x20e78f[_0x49f2('0x6e')][_0x49f2('0x6f')](),_0x49f2('0x6b'))[_0x49f2('0x3c')](_0x1f3d75['params']['id']['toString'](),_0x49f2('0x5a'))[_0x49f2('0x3c')]('NOW()',_0x49f2('0x53'))[_0x49f2('0x3c')](_0x49f2('0x6d'),'updatedAt')[_0x49f2('0x70')]('cm_contacts')[_0x49f2('0x37')](_0x49f2('0x72'))[_0x49f2('0x37')](_0x49f2('0x73'),_0x20e78f['CmListId'][_0x49f2('0x6f')]())['where'](_0x49f2('0x7b'))[_0x49f2('0x37')](_0x49f2('0x74'),squel[_0x49f2('0x6c')]()[_0x49f2('0x3c')]('COALESCE(phone,\x27\x27)')[_0x49f2('0x70')]('cm_hopper')[_0x49f2('0x37')](_0x49f2('0x77'),_0x1f3d75['params']['id']['toString']())))[_0x49f2('0x6f')]();break;default:_0x20c6be=squel[_0x49f2('0x79')]()[_0x49f2('0x66')]('cm_hopper')[_0x49f2('0x67')](['phone',_0x49f2('0x69'),_0x49f2('0x6a'),'ListId',_0x49f2('0x5a'),_0x49f2('0x53'),_0x49f2('0x54')],squel[_0x49f2('0x6c')]()[_0x49f2('0x3c')](_0x49f2('0x68'),_0x49f2('0x68'))[_0x49f2('0x3c')](_0x49f2('0x6d'),_0x49f2('0x69'))[_0x49f2('0x3c')]('id',_0x49f2('0x6a'))[_0x49f2('0x3c')](_0x20e78f[_0x49f2('0x6e')][_0x49f2('0x6f')](),_0x49f2('0x6b'))[_0x49f2('0x3c')](_0x1f3d75['params']['id'][_0x49f2('0x6f')](),_0x49f2('0x5a'))[_0x49f2('0x3c')]('NOW()',_0x49f2('0x53'))[_0x49f2('0x3c')](_0x49f2('0x6d'),_0x49f2('0x54'))[_0x49f2('0x70')]('cm_contacts')[_0x49f2('0x37')]('deletedAt\x20IS\x20NULL')[_0x49f2('0x37')](_0x49f2('0x73'),_0x20e78f[_0x49f2('0x6e')][_0x49f2('0x6f')]())[_0x49f2('0x37')](_0x49f2('0x7b')))[_0x49f2('0x6f')]();}_0x1ad817[_0x49f2('0x7c')](db['sequelize'][_0x49f2('0x2e')](_0x20c6be));}return BPromise[_0x49f2('0x7d')](_0x1ad817);}})['then'](function(){return _0x923020;})['then'](respondWithResult(_0xf2f1d8,null))[_0x49f2('0x43')](handleError(_0xf2f1d8,null));};exports[_0x49f2('0x7e')]=function(_0x26bbd3,_0x32e42d,_0x344047){return db['Campaign'][_0x49f2('0x48')]({'where':{'id':_0x26bbd3[_0x49f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x32e42d,null))[_0x49f2('0x21')](function(_0x276372){if(_0x276372){return _0x276372[_0x49f2('0x7e')](_0x26bbd3[_0x49f2('0x2e')][_0x49f2('0x63')]);}})[_0x49f2('0x21')](function(_0x3f3eb6){if(_0x3f3eb6){return db[_0x49f2('0x58')]['destroy']({'where':{'ListId':_0x26bbd3[_0x49f2('0x2e')]['ids'],'CampaignId':_0x26bbd3[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](function(){return _0x3f3eb6;});}})['then'](respondWithStatusCode(_0x32e42d,null))['catch'](handleError(_0x32e42d,null));};exports[_0x49f2('0x7f')]=function(_0x15854d,_0x475676,_0x3cfd7c){var _0x3adb86={'raw':!![],'where':{}};var _0x344c80={};var _0x30bf2c={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x15854d[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x475676,null))[_0x49f2('0x21')](function(_0x3f2ea2){if(_0x3f2ea2){_0x344c80['model']=_[_0x49f2('0x2d')](db[_0x49f2('0x61')]['rawAttributes']);_0x344c80[_0x49f2('0x2e')]=_[_0x49f2('0x2d')](_0x15854d[_0x49f2('0x2e')]);_0x344c80['filters']=_[_0x49f2('0x46')](_0x344c80[_0x49f2('0x2c')],_0x344c80['query']);_0x3adb86[_0x49f2('0x31')]=_[_0x49f2('0x46')](_0x344c80['model'],qs[_0x49f2('0x30')](_0x15854d[_0x49f2('0x2e')][_0x49f2('0x30')]));_0x3adb86[_0x49f2('0x31')]=_0x3adb86['attributes'][_0x49f2('0x32')]?_0x3adb86[_0x49f2('0x31')]:_0x344c80['model'];if(!_0x15854d[_0x49f2('0x2e')][_0x49f2('0x33')](_0x49f2('0x34'))){_0x3adb86['limit']=qs[_0x49f2('0x1c')](_0x15854d[_0x49f2('0x2e')][_0x49f2('0x1c')]);_0x3adb86[_0x49f2('0x1b')]=qs[_0x49f2('0x1b')](_0x15854d[_0x49f2('0x2e')]['offset']);}_0x3adb86['order']=qs[_0x49f2('0x36')](_0x15854d[_0x49f2('0x2e')][_0x49f2('0x36')]);_0x3adb86[_0x49f2('0x37')]=qs['filters'](_[_0x49f2('0x59')](_0x15854d['query'],_0x344c80['filters']));_0x3adb86[_0x49f2('0x37')][_0x49f2('0x5a')]=_0x3f2ea2['id'];if(_0x15854d['query']['filter']){_0x3adb86[_0x49f2('0x37')]=_['merge'](_0x3adb86[_0x49f2('0x37')],{'$or':_['map'](_0x3adb86[_0x49f2('0x31')],function(_0x3d4a92){var _0xee4455={};_0xee4455[_0x3d4a92]={'$like':'%'+_0x15854d[_0x49f2('0x2e')][_0x49f2('0x38')]+'%'};return _0xee4455;})});}_0x3adb86=_['merge']({},_0x3adb86,_0x15854d[_0x49f2('0x3e')]);return db[_0x49f2('0x61')]['count']({'where':_0x3adb86[_0x49f2('0x37')]})[_0x49f2('0x21')](function(_0x4afc89){_0x30bf2c[_0x49f2('0x3f')]=_0x4afc89;if(_0x15854d[_0x49f2('0x2e')][_0x49f2('0x40')]){_0x3adb86['include']=[{'all':!![]}];}return db[_0x49f2('0x61')][_0x49f2('0x41')](_0x3adb86);})[_0x49f2('0x21')](function(_0x23e012){_0x30bf2c[_0x49f2('0x42')]=_0x23e012;return _0x30bf2c;});}})[_0x49f2('0x21')](respondWithFilteredResult(_0x475676,_0x3adb86))[_0x49f2('0x43')](handleError(_0x475676,null));};exports[_0x49f2('0x80')]=function(_0x13218d,_0x377314,_0x2769b1){var _0x90944d,_0x17bc0b;return db[_0x49f2('0x2a')][_0x49f2('0x48')]({'where':{'id':_0x13218d['params']['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x377314,null))['then'](function(_0x39e572){if(_0x39e572){_0x17bc0b=_0x39e572;return _0x39e572['addBlackLists'](_0x13218d[_0x49f2('0x4a')][_0x49f2('0x63')],_[_0x49f2('0x52')](_0x13218d[_0x49f2('0x4a')],['ids','id'])||{});}return null;})[_0x49f2('0x81')](function(_0x35124a){var _0x517f81;_0x90944d=_0x35124a||[];var _0x134d3e=[];if(_0x35124a){for(var _0x5aa521=0x0;_0x5aa521<_0x35124a[_0x49f2('0x32')];_0x5aa521+=0x1){var _0x49d9c4=_0x35124a[_0x5aa521][_0x49f2('0x22')]({'plain':!![]});_0x517f81=squel[_0x49f2('0x79')]()[_0x49f2('0x66')]('cm_hopper_black')[_0x49f2('0x67')]([_0x49f2('0x68'),'ContactId','ListId','CampaignId',_0x49f2('0x53'),_0x49f2('0x54')],squel[_0x49f2('0x6c')]()[_0x49f2('0x3c')]('phone',_0x49f2('0x68'))[_0x49f2('0x3c')]('id','ContactId')[_0x49f2('0x3c')](_0x49d9c4[_0x49f2('0x6e')][_0x49f2('0x6f')](),'ListId')[_0x49f2('0x3c')](_0x13218d['params']['id'][_0x49f2('0x6f')](),_0x49f2('0x5a'))['field'](_0x49f2('0x6d'),_0x49f2('0x53'))[_0x49f2('0x3c')](_0x49f2('0x6d'),_0x49f2('0x54'))[_0x49f2('0x70')](_0x49f2('0x71'))[_0x49f2('0x37')](_0x49f2('0x72'))['where'](_0x49f2('0x73'),_0x49d9c4['CmListId'][_0x49f2('0x6f')]())[_0x49f2('0x37')](_0x49f2('0x7b')))[_0x49f2('0x6f')]();_0x134d3e[_0x49f2('0x7c')](db[_0x49f2('0x82')]['query'](_0x517f81));}return BPromise['all'](_0x134d3e);}})[_0x49f2('0x21')](function(){return _0x90944d;})[_0x49f2('0x21')](respondWithResult(_0x377314,null))['catch'](handleError(_0x377314,null));};exports[_0x49f2('0x83')]=function(_0x4c6620,_0x4de9e1,_0x3af19a){return db['Campaign']['find']({'where':{'id':_0x4c6620[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](handleEntityNotFound(_0x4de9e1,null))['then'](function(_0x1ccd89){if(_0x1ccd89){return _0x1ccd89[_0x49f2('0x83')](_0x4c6620[_0x49f2('0x2e')][_0x49f2('0x63')]);}})[_0x49f2('0x21')](function(_0xaa1649){if(_0xaa1649){return db[_0x49f2('0x5f')]['destroy']({'where':{'ListId':_0x4c6620[_0x49f2('0x2e')][_0x49f2('0x63')],'CampaignId':_0x4c6620[_0x49f2('0x45')]['id']}})[_0x49f2('0x21')](function(){return _0xaa1649;});}})[_0x49f2('0x21')](respondWithStatusCode(_0x4de9e1,null))[_0x49f2('0x43')](handleError(_0x4de9e1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 62122d9..ec238dc 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 _0xcd93=['exports','Campaign','campaigns','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./campaign.attributes'];(function(_0x11e161,_0x1c5750){var _0x1dfca8=function(_0x13f29e){while(--_0x13f29e){_0x11e161['push'](_0x11e161['shift']());}};_0x1dfca8(++_0x1c5750);}(_0xcd93,0x18f));var _0x3cd9=function(_0x106b22,_0x4e1f2e){_0x106b22=_0x106b22-0x0;var _0x43adfb=_0xcd93[_0x106b22];return _0x43adfb;};'use strict';var _=require(_0x3cd9('0x0'));var util=require(_0x3cd9('0x1'));var logger=require(_0x3cd9('0x2'))(_0x3cd9('0x3'));var moment=require(_0x3cd9('0x4'));var BPromise=require('bluebird');var rp=require(_0x3cd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cd9('0x6'));var attributes=require(_0x3cd9('0x7'));module[_0x3cd9('0x8')]=function(_0x323711,_0x46f1ab){return _0x323711['define'](_0x3cd9('0x9'),attributes,{'tableName':_0x3cd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb0d=['exports','define','lodash','api','moment','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x32d48e,_0x7b3be5){var _0x55c34f=function(_0x260ce9){while(--_0x260ce9){_0x32d48e['push'](_0x32d48e['shift']());}};_0x55c34f(++_0x7b3be5);}(_0xeb0d,0x192));var _0xdeb0=function(_0x41ce8e,_0x35b433){_0x41ce8e=_0x41ce8e-0x0;var _0x2aa1d2=_0xeb0d[_0x41ce8e];return _0x2aa1d2;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdeb0('0x1'));var moment=require(_0xdeb0('0x2'));var BPromise=require(_0xdeb0('0x3'));var rp=require(_0xdeb0('0x4'));var fs=require('fs');var path=require(_0xdeb0('0x5'));var rimraf=require(_0xdeb0('0x6'));var config=require('../../config/environment');var attributes=require(_0xdeb0('0x7'));module[_0xdeb0('0x8')]=function(_0x4508e5,_0x2a381f){return _0x4508e5[_0xdeb0('0x9')]('Campaign',attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index bddb578..e507a4d 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 _0x0bb6=['GetCampaign','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Campaign','options','raw','where','attributes','limit','include','map','model'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0x0bb6,0x183));var _0x60bb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0bb6[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x60bb('0x0'));var util=require(_0x60bb('0x1'));var moment=require(_0x60bb('0x2'));var BPromise=require(_0x60bb('0x3'));var rs=require(_0x60bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60bb('0x5'))['db'];var utils=require(_0x60bb('0x6'));var logger=require(_0x60bb('0x7'))('rpc');var config=require(_0x60bb('0x8'));var jayson=require(_0x60bb('0x9'));var client=jayson[_0x60bb('0xa')][_0x60bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce636,_0xd5d834,_0x2b508d){return new BPromise(function(_0x3d2803,_0x1f99c2){return client[_0x60bb('0xc')](_0x1ce636,_0x2b508d)[_0x60bb('0xd')](function(_0x5aa632){logger[_0x60bb('0xe')](_0x60bb('0xf'),_0xd5d834,'request\x20sent');logger[_0x60bb('0x10')](_0x60bb('0x11'),_0xd5d834,_0x60bb('0x12'),JSON[_0x60bb('0x13')](_0x5aa632));if(_0x5aa632[_0x60bb('0x14')]){if(_0x5aa632['error'][_0x60bb('0x15')]===0x1f4){logger[_0x60bb('0x14')](_0x60bb('0xf'),_0xd5d834,_0x5aa632['error']['message']);return _0x1f99c2(_0x5aa632[_0x60bb('0x14')][_0x60bb('0x16')]);}logger['error'](_0x60bb('0xf'),_0xd5d834,_0x5aa632[_0x60bb('0x14')][_0x60bb('0x16')]);return _0x3d2803(_0x5aa632[_0x60bb('0x14')]['message']);}else{logger[_0x60bb('0xe')](_0x60bb('0xf'),_0xd5d834,'request\x20sent');_0x3d2803(_0x5aa632[_0x60bb('0x17')][_0x60bb('0x16')]);}})['catch'](function(_0x1a6ba4){logger[_0x60bb('0x14')](_0x60bb('0xf'),_0xd5d834,_0x1a6ba4);_0x1f99c2(_0x1a6ba4);});});}exports['GetCampaign']=function(_0x35a3bc){var _0x55926f=this;return new Promise(function(_0x46991e,_0x3b63bc){return db[_0x60bb('0x18')]['findAll']({'raw':_0x35a3bc['options']?_0x35a3bc[_0x60bb('0x19')][_0x60bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x35a3bc[_0x60bb('0x19')]?_0x35a3bc[_0x60bb('0x19')][_0x60bb('0x1b')]||null:null,'attributes':_0x35a3bc[_0x60bb('0x19')]?_0x35a3bc[_0x60bb('0x19')][_0x60bb('0x1c')]||null:null,'limit':_0x35a3bc[_0x60bb('0x19')]?_0x35a3bc[_0x60bb('0x19')][_0x60bb('0x1d')]||null:null,'include':_0x35a3bc[_0x60bb('0x19')]?_0x35a3bc['options'][_0x60bb('0x1e')]?_[_0x60bb('0x1f')](_0x35a3bc['options']['include'],function(_0x450ffc){return{'model':db[_0x450ffc[_0x60bb('0x20')]],'as':_0x450ffc['as'],'attributes':_0x450ffc['attributes'],'include':_0x450ffc['include']?_[_0x60bb('0x1f')](_0x450ffc[_0x60bb('0x1e')],function(_0x56d3d7){return{'model':db[_0x56d3d7[_0x60bb('0x20')]],'as':_0x56d3d7['as'],'attributes':_0x56d3d7[_0x60bb('0x1c')],'include':_0x56d3d7[_0x60bb('0x1e')]?_[_0x60bb('0x1f')](_0x56d3d7[_0x60bb('0x1e')],function(_0x4ee08b){return{'model':db[_0x4ee08b[_0x60bb('0x20')]],'as':_0x4ee08b['as'],'attributes':_0x4ee08b[_0x60bb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x60bb('0xd')](function(_0x3e5870){logger[_0x60bb('0xe')](_0x60bb('0x21'),_0x35a3bc);logger[_0x60bb('0x10')](_0x60bb('0x21'),_0x35a3bc,JSON['stringify'](_0x3e5870));_0x46991e(_0x3e5870);})[_0x60bb('0x22')](function(_0x31cb5a){logger[_0x60bb('0x14')](_0x60bb('0x21'),_0x31cb5a[_0x60bb('0x16')],_0x35a3bc);_0x3b63bc(_0x55926f[_0x60bb('0x14')](0x1f4,_0x31cb5a[_0x60bb('0x16')]));});});}; \ No newline at end of file +var _0xb423=['info','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x33174b,_0xfadb28){var _0x19f662=function(_0x102025){while(--_0x102025){_0x33174b['push'](_0x33174b['shift']());}};_0x19f662(++_0xfadb28);}(_0xb423,0xad));var _0x3b42=function(_0x11abc1,_0x19d0df){_0x11abc1=_0x11abc1-0x0;var _0x181cf3=_0xb423[_0x11abc1];return _0x181cf3;};'use strict';var _=require(_0x3b42('0x0'));var util=require(_0x3b42('0x1'));var moment=require(_0x3b42('0x2'));var BPromise=require(_0x3b42('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b42('0x4'));var db=require(_0x3b42('0x5'))['db'];var utils=require(_0x3b42('0x6'));var logger=require(_0x3b42('0x7'))('rpc');var config=require(_0x3b42('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3b42('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6af084,_0x2c2a41,_0x53f3fb){return new BPromise(function(_0x597d32,_0xdda222){return client[_0x3b42('0xa')](_0x6af084,_0x53f3fb)[_0x3b42('0xb')](function(_0x3be47f){logger['info'](_0x3b42('0xc'),_0x2c2a41,_0x3b42('0xd'));logger[_0x3b42('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x2c2a41,_0x3b42('0xd'),JSON[_0x3b42('0xf')](_0x3be47f));if(_0x3be47f['error']){if(_0x3be47f['error'][_0x3b42('0x10')]===0x1f4){logger[_0x3b42('0x11')]('Campaign,\x20%s,\x20%s',_0x2c2a41,_0x3be47f[_0x3b42('0x11')][_0x3b42('0x12')]);return _0xdda222(_0x3be47f[_0x3b42('0x11')][_0x3b42('0x12')]);}logger[_0x3b42('0x11')](_0x3b42('0xc'),_0x2c2a41,_0x3be47f[_0x3b42('0x11')][_0x3b42('0x12')]);return _0x597d32(_0x3be47f['error']['message']);}else{logger[_0x3b42('0x13')](_0x3b42('0xc'),_0x2c2a41,_0x3b42('0xd'));_0x597d32(_0x3be47f['result'][_0x3b42('0x12')]);}})[_0x3b42('0x14')](function(_0x247108){logger[_0x3b42('0x11')](_0x3b42('0xc'),_0x2c2a41,_0x247108);_0xdda222(_0x247108);});});}exports[_0x3b42('0x15')]=function(_0x35b2da){var _0x36c739=this;return new Promise(function(_0x4e03de,_0x4671ee){return db[_0x3b42('0x16')][_0x3b42('0x17')]({'raw':_0x35b2da[_0x3b42('0x18')]?_0x35b2da[_0x3b42('0x18')][_0x3b42('0x19')]===undefined?!![]:![]:!![],'where':_0x35b2da[_0x3b42('0x18')]?_0x35b2da[_0x3b42('0x18')][_0x3b42('0x1a')]||null:null,'attributes':_0x35b2da[_0x3b42('0x18')]?_0x35b2da['options'][_0x3b42('0x1b')]||null:null,'limit':_0x35b2da[_0x3b42('0x18')]?_0x35b2da[_0x3b42('0x18')][_0x3b42('0x1c')]||null:null,'include':_0x35b2da[_0x3b42('0x18')]?_0x35b2da[_0x3b42('0x18')][_0x3b42('0x1d')]?_[_0x3b42('0x1e')](_0x35b2da[_0x3b42('0x18')][_0x3b42('0x1d')],function(_0x2b3df3){return{'model':db[_0x2b3df3[_0x3b42('0x1f')]],'as':_0x2b3df3['as'],'attributes':_0x2b3df3[_0x3b42('0x1b')],'include':_0x2b3df3[_0x3b42('0x1d')]?_[_0x3b42('0x1e')](_0x2b3df3[_0x3b42('0x1d')],function(_0x1a6b14){return{'model':db[_0x1a6b14[_0x3b42('0x1f')]],'as':_0x1a6b14['as'],'attributes':_0x1a6b14[_0x3b42('0x1b')],'include':_0x1a6b14[_0x3b42('0x1d')]?_['map'](_0x1a6b14['include'],function(_0x510071){return{'model':db[_0x510071['model']],'as':_0x510071['as'],'attributes':_0x510071[_0x3b42('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3b42('0xb')](function(_0x16bbbe){logger[_0x3b42('0x13')](_0x3b42('0x15'),_0x35b2da);logger[_0x3b42('0xe')]('GetCampaign',_0x35b2da,JSON['stringify'](_0x16bbbe));_0x4e03de(_0x16bbbe);})[_0x3b42('0x14')](function(_0x2c61b2){logger[_0x3b42('0x11')](_0x3b42('0x15'),_0x2c61b2[_0x3b42('0x12')],_0x35b2da);_0x4671ee(_0x36c739[_0x3b42('0x11')](0x1f4,_0x2c61b2['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index dc6ca1b..f4cc70c 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 _0x4e02=['/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','create','post','/:id/clone','clone','addLists'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x4e02,0x17e));var _0x24e0=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x4e02[_0x373096];return _0x14a6d0;};'use strict';var multer=require('multer');var util=require(_0x24e0('0x0'));var path=require('path');var timeout=require(_0x24e0('0x1'));var express=require(_0x24e0('0x2'));var router=express[_0x24e0('0x3')]();var auth=require(_0x24e0('0x4'));var interaction=require(_0x24e0('0x5'));var config=require(_0x24e0('0x6'));var controller=require(_0x24e0('0x7'));router[_0x24e0('0x8')]('/',auth[_0x24e0('0x9')](),controller[_0x24e0('0xa')]);router[_0x24e0('0x8')](_0x24e0('0xb'),auth[_0x24e0('0x9')](),controller[_0x24e0('0xc')]);router[_0x24e0('0x8')](_0x24e0('0xd'),auth[_0x24e0('0x9')](),controller[_0x24e0('0xe')]);router[_0x24e0('0x8')](_0x24e0('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x24e0('0x8')]('/:id/hopper_finals',auth[_0x24e0('0x9')](),controller[_0x24e0('0x10')]);router[_0x24e0('0x8')](_0x24e0('0x11'),auth['isAuthenticated'](),controller[_0x24e0('0x12')]);router[_0x24e0('0x8')](_0x24e0('0x13'),auth[_0x24e0('0x9')](),controller[_0x24e0('0x14')]);router[_0x24e0('0x8')]('/:id/blacklists',auth[_0x24e0('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x24e0('0x9')](),controller[_0x24e0('0x15')]);router[_0x24e0('0x16')](_0x24e0('0x17'),auth[_0x24e0('0x9')](),controller[_0x24e0('0x18')]);router[_0x24e0('0x16')](_0x24e0('0x13'),auth[_0x24e0('0x9')](),controller[_0x24e0('0x19')]);router['post'](_0x24e0('0x1a'),auth[_0x24e0('0x9')](),controller[_0x24e0('0x1b')]);router[_0x24e0('0x1c')]('/:id',auth[_0x24e0('0x9')](),controller[_0x24e0('0x1d')]);router[_0x24e0('0x1e')]('/:id',auth[_0x24e0('0x9')](),controller[_0x24e0('0x1f')]);router['delete'](_0x24e0('0x13'),auth[_0x24e0('0x9')](),controller[_0x24e0('0x20')]);router[_0x24e0('0x1e')](_0x24e0('0x1a'),auth[_0x24e0('0x9')](),controller['removeBlackLists']);module[_0x24e0('0x21')]=router; \ No newline at end of file +var _0x3c9b=['/:id/blacklists','addBlackLists','update','delete','destroy','removeLists','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','post','/:id/clone','clone'];(function(_0x3073ac,_0x29dc2b){var _0x31d3bd=function(_0x163b3b){while(--_0x163b3b){_0x3073ac['push'](_0x3073ac['shift']());}};_0x31d3bd(++_0x29dc2b);}(_0x3c9b,0x163));var _0xb3c9=function(_0x2a4f87,_0x35e581){_0x2a4f87=_0x2a4f87-0x0;var _0x2f88ec=_0x3c9b[_0x2a4f87];return _0x2f88ec;};'use strict';var multer=require(_0xb3c9('0x0'));var util=require(_0xb3c9('0x1'));var path=require('path');var timeout=require(_0xb3c9('0x2'));var express=require(_0xb3c9('0x3'));var router=express['Router']();var auth=require(_0xb3c9('0x4'));var interaction=require(_0xb3c9('0x5'));var config=require('../../config/environment');var controller=require(_0xb3c9('0x6'));router[_0xb3c9('0x7')]('/',auth['isAuthenticated'](),controller[_0xb3c9('0x8')]);router['get'](_0xb3c9('0x9'),auth[_0xb3c9('0xa')](),controller[_0xb3c9('0xb')]);router[_0xb3c9('0x7')]('/:id/hoppers',auth[_0xb3c9('0xa')](),controller[_0xb3c9('0xc')]);router['get'](_0xb3c9('0xd'),auth[_0xb3c9('0xa')](),controller['getHopperHistories']);router[_0xb3c9('0x7')](_0xb3c9('0xe'),auth[_0xb3c9('0xa')](),controller[_0xb3c9('0xf')]);router[_0xb3c9('0x7')](_0xb3c9('0x10'),auth['isAuthenticated'](),controller[_0xb3c9('0x11')]);router[_0xb3c9('0x7')](_0xb3c9('0x12'),auth[_0xb3c9('0xa')](),controller['getLists']);router[_0xb3c9('0x7')]('/:id/blacklists',auth[_0xb3c9('0xa')](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb3c9('0x13')](_0xb3c9('0x14'),auth[_0xb3c9('0xa')](),controller[_0xb3c9('0x15')]);router[_0xb3c9('0x13')](_0xb3c9('0x12'),auth[_0xb3c9('0xa')](),controller['addLists']);router[_0xb3c9('0x13')](_0xb3c9('0x16'),auth[_0xb3c9('0xa')](),controller[_0xb3c9('0x17')]);router['put']('/:id',auth[_0xb3c9('0xa')](),controller[_0xb3c9('0x18')]);router[_0xb3c9('0x19')](_0xb3c9('0x9'),auth[_0xb3c9('0xa')](),controller[_0xb3c9('0x1a')]);router[_0xb3c9('0x19')](_0xb3c9('0x12'),auth['isAuthenticated'](),controller[_0xb3c9('0x1b')]);router[_0xb3c9('0x19')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xb3c9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index cca57b7..e48da55 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 _0x93a0=['STRING','getDataValue','sequelize','exports'];(function(_0x4e6c6b,_0x67d7d5){var _0x3cb646=function(_0x342315){while(--_0x342315){_0x4e6c6b['push'](_0x4e6c6b['shift']());}};_0x3cb646(++_0x67d7d5);}(_0x93a0,0x1f2));var _0x093a=function(_0x545667,_0x180b3d){_0x545667=_0x545667-0x0;var _0x274b41=_0x93a0[_0x545667];return _0x274b41;};'use strict';var Sequelize=require(_0x093a('0x0'));module[_0x093a('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x093a('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x093a('0x3')]('key');}}}; \ No newline at end of file +var _0xa633=['key','sequelize','exports','STRING','VIRTUAL'];(function(_0x48481d,_0x5ab9b3){var _0x549099=function(_0x3ca32a){while(--_0x3ca32a){_0x48481d['push'](_0x48481d['shift']());}};_0x549099(++_0x5ab9b3);}(_0xa633,0x128));var _0x3a63=function(_0x46446e,_0x429e49){_0x46446e=_0x46446e-0x0;var _0x477429=_0xa633[_0x46446e];return _0x477429;};'use strict';var Sequelize=require(_0x3a63('0x0'));module[_0x3a63('0x1')]={'key':{'type':Sequelize[_0x3a63('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x3a63('0x2')]},'name':{'type':Sequelize[_0x3a63('0x3')],'get':function(){return this['getDataValue'](_0x3a63('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e8dc217..8201f4b 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 _0xa406=['findAll','rows','show','params','options','find','catch','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','get','CannedAnswers','UserProfileResource','destroy','stack','name','index','CannedAnswer','rawAttributes','keys','query','intersection','model','fields','attributes','length','order','sort','filters','pick','where','merge','map','type','key','filter','includeAll','include'];(function(_0x316c6e,_0x3693cd){var _0xf5c6ef=function(_0x462a05){while(--_0x462a05){_0x316c6e['push'](_0x316c6e['shift']());}};_0xf5c6ef(++_0x3693cd);}(_0xa406,0xc1));var _0x6a40=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa406[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x6a40('0x0'));var emlformat=require(_0x6a40('0x1'));var rimraf=require(_0x6a40('0x2'));var zipdir=require(_0x6a40('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a40('0x4'));var moment=require(_0x6a40('0x5'));var BPromise=require(_0x6a40('0x6'));var Mustache=require(_0x6a40('0x7'));var util=require(_0x6a40('0x8'));var path=require(_0x6a40('0x9'));var sox=require(_0x6a40('0xa'));var csv=require(_0x6a40('0xb'));var ejs=require(_0x6a40('0xc'));var fs=require('fs');var _=require(_0x6a40('0xd'));var squel=require(_0x6a40('0xe'));var crypto=require(_0x6a40('0xf'));var jsforce=require(_0x6a40('0x10'));var deskjs=require(_0x6a40('0x11'));var toCsv=require(_0x6a40('0xb'));var querystring=require(_0x6a40('0x12'));var Papa=require(_0x6a40('0x13'));var Redis=require(_0x6a40('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x6a40('0x15'));var logger=require('../../config/logger')(_0x6a40('0x16'));var utils=require(_0x6a40('0x17'));var config=require('../../config/environment');var db=require(_0x6a40('0x18'))['db'];function respondWithStatusCode(_0x31d8fd,_0x1a322c){_0x1a322c=_0x1a322c||0xcc;return function(_0x2866e6){if(_0x2866e6){return _0x31d8fd[_0x6a40('0x19')](_0x1a322c);}return _0x31d8fd[_0x6a40('0x1a')](_0x1a322c)[_0x6a40('0x1b')]();};}function respondWithResult(_0x32f6f1,_0xdfb487){_0xdfb487=_0xdfb487||0xc8;return function(_0x46d0f8){if(_0x46d0f8){return _0x32f6f1[_0x6a40('0x1a')](_0xdfb487)[_0x6a40('0x1c')](_0x46d0f8);}};}function respondWithFilteredResult(_0x4c4b20,_0x11f52b){return function(_0xa60a){if(_0xa60a){var _0x977d8f=_0xa60a[_0x6a40('0x1d')],_0x3ba844=_0x11f52b['offset'],_0x5b3630=_0x11f52b[_0x6a40('0x1e')]+_0x11f52b[_0x6a40('0x1f')],_0x2378ea;if(_0x5b3630>=_0x977d8f){_0x5b3630=_0x977d8f;_0x2378ea=0xc8;}else{_0x2378ea=0xce;}_0x4c4b20['status'](_0x2378ea);return _0x4c4b20[_0x6a40('0x20')]('Content-Range',_0x3ba844+'-'+_0x5b3630+'/'+_0x977d8f)[_0x6a40('0x1c')](_0xa60a);}return null;};}function patchUpdates(_0x199254){return function(_0x1a4358){try{jsonpatch[_0x6a40('0x21')](_0x1a4358,_0x199254,!![]);}catch(_0x36a7f0){return BPromise[_0x6a40('0x22')](_0x36a7f0);}return _0x1a4358[_0x6a40('0x23')]();};}function saveUpdates(_0x145a50,_0x2b7add){return function(_0x23dd9e){if(_0x23dd9e){return _0x23dd9e['update'](_0x145a50)['then'](function(_0x4881d4){return _0x4881d4;});}return null;};}function removeEntity(_0xd4c220,_0x3634f6){return function(_0x231cd4){if(_0x231cd4){return _0x231cd4['destroy']()[_0x6a40('0x24')](function(){var _0x2bf25e=_0x231cd4[_0x6a40('0x25')]({'plain':!![]});var _0x40e31c=_0x6a40('0x26');return db[_0x6a40('0x27')][_0x6a40('0x28')]({'where':{'type':_0x40e31c,'resourceId':_0x2bf25e['id']}})[_0x6a40('0x24')](function(){return _0x231cd4;});})[_0x6a40('0x24')](function(){_0xd4c220['status'](0xcc)[_0x6a40('0x1b')]();});}};}function handleEntityNotFound(_0x39bafb,_0x48df5a){return function(_0x41ee88){if(!_0x41ee88){_0x39bafb[_0x6a40('0x19')](0x194);}return _0x41ee88;};}function handleError(_0x1c420c,_0x5096a8){_0x5096a8=_0x5096a8||0x1f4;return function(_0x2f42c8){logger['error'](_0x2f42c8[_0x6a40('0x29')]);if(_0x2f42c8[_0x6a40('0x2a')]){delete _0x2f42c8[_0x6a40('0x2a')];}_0x1c420c[_0x6a40('0x1a')](_0x5096a8)['send'](_0x2f42c8);};}exports[_0x6a40('0x2b')]=function(_0x3922cf,_0x43ef7b){var _0x4e405c={},_0x490b83={},_0x206cf1={'count':0x0,'rows':[]};var _0xfff3df=db[_0x6a40('0x2c')][_0x6a40('0x2d')];_0x490b83['model']=_[_0x6a40('0x2e')](_0xfff3df);_0x490b83[_0x6a40('0x2f')]=_[_0x6a40('0x2e')](_0x3922cf[_0x6a40('0x2f')]);_0x490b83['filters']=_[_0x6a40('0x30')](_0x490b83[_0x6a40('0x31')],_0x490b83[_0x6a40('0x2f')]);_0x4e405c['attributes']=_[_0x6a40('0x30')](_0x490b83[_0x6a40('0x31')],qs[_0x6a40('0x32')](_0x3922cf[_0x6a40('0x2f')]['fields']));_0x4e405c[_0x6a40('0x33')]=_0x4e405c['attributes'][_0x6a40('0x34')]?_0x4e405c[_0x6a40('0x33')]:_0x490b83['model'];if(!_0x3922cf[_0x6a40('0x2f')]['hasOwnProperty']('nolimit')){_0x4e405c[_0x6a40('0x1f')]=qs[_0x6a40('0x1f')](_0x3922cf[_0x6a40('0x2f')]['limit']);_0x4e405c[_0x6a40('0x1e')]=qs['offset'](_0x3922cf['query']['offset']);}_0x4e405c[_0x6a40('0x35')]=qs['sort'](_0x3922cf[_0x6a40('0x2f')][_0x6a40('0x36')]);_0x4e405c['where']=qs[_0x6a40('0x37')](_[_0x6a40('0x38')](_0x3922cf['query'],_0x490b83[_0x6a40('0x37')]));if(_0x3922cf[_0x6a40('0x2f')]['filter']){_0x4e405c[_0x6a40('0x39')]=_[_0x6a40('0x3a')](_0x4e405c[_0x6a40('0x39')],{'$or':_[_0x6a40('0x3b')](_0xfff3df,function(_0x3d90f7){if(_0x3d90f7[_0x6a40('0x3c')][_0x6a40('0x3d')]!=='VIRTUAL'){var _0x3ced38={};_0x3ced38[_0x3d90f7['field']]={'$like':'%'+_0x3922cf['query'][_0x6a40('0x3e')]+'%'};return _0x3ced38;}})});}_0x4e405c=_[_0x6a40('0x3a')]({},_0x4e405c,_0x3922cf['options']);var _0x5946db={'where':_0x4e405c[_0x6a40('0x39')]};return db[_0x6a40('0x2c')][_0x6a40('0x1d')](_0x5946db)[_0x6a40('0x24')](function(_0x276adc){_0x206cf1[_0x6a40('0x1d')]=_0x276adc;if(_0x3922cf['query'][_0x6a40('0x3f')]){_0x4e405c[_0x6a40('0x40')]=[{'all':!![]}];}return db[_0x6a40('0x2c')][_0x6a40('0x41')](_0x4e405c);})['then'](function(_0x343228){_0x206cf1[_0x6a40('0x42')]=_0x343228;return _0x206cf1;})['then'](respondWithFilteredResult(_0x43ef7b,_0x4e405c))['catch'](handleError(_0x43ef7b,null));};exports[_0x6a40('0x43')]=function(_0x50bc49,_0xefa119){var _0xf33130={'raw':!![],'where':{'id':_0x50bc49[_0x6a40('0x44')]['id']}},_0x11140a={};_0x11140a[_0x6a40('0x31')]=_['keys'](db[_0x6a40('0x2c')][_0x6a40('0x2d')]);_0x11140a[_0x6a40('0x2f')]=_[_0x6a40('0x2e')](_0x50bc49[_0x6a40('0x2f')]);_0x11140a[_0x6a40('0x37')]=_[_0x6a40('0x30')](_0x11140a[_0x6a40('0x31')],_0x11140a[_0x6a40('0x2f')]);_0xf33130[_0x6a40('0x33')]=_[_0x6a40('0x30')](_0x11140a[_0x6a40('0x31')],qs[_0x6a40('0x32')](_0x50bc49[_0x6a40('0x2f')][_0x6a40('0x32')]));_0xf33130[_0x6a40('0x33')]=_0xf33130[_0x6a40('0x33')][_0x6a40('0x34')]?_0xf33130['attributes']:_0x11140a['model'];if(_0x50bc49[_0x6a40('0x2f')][_0x6a40('0x3f')]){_0xf33130[_0x6a40('0x40')]=[{'all':!![]}];}_0xf33130=_[_0x6a40('0x3a')]({},_0xf33130,_0x50bc49[_0x6a40('0x45')]);return db[_0x6a40('0x2c')][_0x6a40('0x46')](_0xf33130)[_0x6a40('0x24')](handleEntityNotFound(_0xefa119,null))[_0x6a40('0x24')](respondWithResult(_0xefa119,null))[_0x6a40('0x47')](handleError(_0xefa119,null));};exports[_0x6a40('0x48')]=function(_0x458126,_0x239bee){if(_0x458126['body']['id']){delete _0x458126['body']['id'];}return db[_0x6a40('0x2c')][_0x6a40('0x46')]({'where':{'id':_0x458126['params']['id']}})[_0x6a40('0x24')](handleEntityNotFound(_0x239bee,null))[_0x6a40('0x24')](saveUpdates(_0x458126[_0x6a40('0x49')],null))[_0x6a40('0x24')](respondWithResult(_0x239bee,null))[_0x6a40('0x47')](handleError(_0x239bee,null));};exports[_0x6a40('0x28')]=function(_0x2e02bd,_0x5db70){return db['CannedAnswer'][_0x6a40('0x46')]({'where':{'id':_0x2e02bd[_0x6a40('0x44')]['id']}})[_0x6a40('0x24')](handleEntityNotFound(_0x5db70,null))['then'](removeEntity(_0x5db70,null))[_0x6a40('0x47')](handleError(_0x5db70,null));};exports[_0x6a40('0x4a')]=function(_0x4d0254,_0xec20b9){var _0x4f7611={'key':_0x4d0254[_0x6a40('0x49')][_0x6a40('0x3d')]};if(_0x4d0254[_0x6a40('0x49')][_0x6a40('0x4b')]){_0x4f7611[_0x6a40('0x4b')]=_0x4d0254[_0x6a40('0x49')][_0x6a40('0x4b')];}else if(_0x4d0254[_0x6a40('0x49')][_0x6a40('0x4c')]){_0x4f7611[_0x6a40('0x4c')]=_0x4d0254[_0x6a40('0x49')][_0x6a40('0x4c')];}else if(_0x4d0254[_0x6a40('0x49')]['OpenchannelAccountId']){_0x4f7611[_0x6a40('0x4d')]=_0x4d0254[_0x6a40('0x49')][_0x6a40('0x4d')];}else if(_0x4d0254[_0x6a40('0x49')]['ChatWebsiteId']){_0x4f7611[_0x6a40('0x4e')]=_0x4d0254[_0x6a40('0x49')][_0x6a40('0x4e')];}return db[_0x6a40('0x2c')][_0x6a40('0x46')]({'where':_0x4f7611})['then'](function(_0x170cc3){if(_0x170cc3){throw new db['Sequelize'][(_0x6a40('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer']['create'](_0x4d0254['body']);})[_0x6a40('0x24')](function(_0x400c8b){var _0x67aa25=_0x4d0254['user'][_0x6a40('0x25')]({'plain':!![]});if(!_0x67aa25)throw new Error(_0x6a40('0x50'));if(_0x67aa25[_0x6a40('0x51')]===_0x6a40('0x52')){var _0xca8937=_0x400c8b[_0x6a40('0x25')]({'plain':!![]});return db[_0x6a40('0x53')]['find']({'where':{'name':_0x6a40('0x26'),'userProfileId':_0x67aa25['userProfileId']},'raw':!![]})[_0x6a40('0x24')](function(_0x54152d){if(_0x54152d&&_0x54152d[_0x6a40('0x54')]===0x0){return db['UserProfileResource'][_0x6a40('0x4a')]({'name':_0xca8937[_0x6a40('0x2a')],'resourceId':_0xca8937['id'],'type':_0x54152d[_0x6a40('0x2a')],'sectionId':_0x54152d['id']},{})[_0x6a40('0x24')](function(){return _0x400c8b;});}else{return _0x400c8b;}})['catch'](function(_0x160147){logger[_0x6a40('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x160147);throw _0x160147;});}return _0x400c8b;})['then'](respondWithResult(_0xec20b9,0xc9))[_0x6a40('0x47')](handleError(_0xec20b9,null));}; \ No newline at end of file +var _0xd34f=['end','sendStatus','error','stack','name','send','index','CannedAnswer','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','key','VIRTUAL','field','options','includeAll','findAll','rows','rawAttributes','find','update','body','params','destroy','catch','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','status','json','count','offset','limit','set','Content-Range','reject','save','then','get','CannedAnswers','UserProfileResource'];(function(_0x1945a2,_0x1ba540){var _0x3124ba=function(_0x540423){while(--_0x540423){_0x1945a2['push'](_0x1945a2['shift']());}};_0x3124ba(++_0x1ba540);}(_0xd34f,0xdd));var _0xfd34=function(_0x5d80e7,_0x57d877){_0x5d80e7=_0x5d80e7-0x0;var _0x5dea17=_0xd34f[_0x5d80e7];return _0x5dea17;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfd34('0x0'));var rimraf=require(_0xfd34('0x1'));var zipdir=require(_0xfd34('0x2'));var jsonpatch=require(_0xfd34('0x3'));var rp=require(_0xfd34('0x4'));var moment=require(_0xfd34('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfd34('0x6'));var path=require(_0xfd34('0x7'));var sox=require(_0xfd34('0x8'));var csv=require('to-csv');var ejs=require(_0xfd34('0x9'));var fs=require('fs');var _=require(_0xfd34('0xa'));var squel=require(_0xfd34('0xb'));var crypto=require(_0xfd34('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd34('0xd'));var toCsv=require(_0xfd34('0xe'));var querystring=require(_0xfd34('0xf'));var Papa=require(_0xfd34('0x10'));var Redis=require(_0xfd34('0x11'));var authService=require(_0xfd34('0x12'));var qs=require(_0xfd34('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd34('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ceed0,_0x2a9e39){_0x2a9e39=_0x2a9e39||0xcc;return function(_0x25b93c){if(_0x25b93c){return _0x5ceed0['sendStatus'](_0x2a9e39);}return _0x5ceed0[_0xfd34('0x15')](_0x2a9e39)['end']();};}function respondWithResult(_0xdda8e5,_0x1f245a){_0x1f245a=_0x1f245a||0xc8;return function(_0x5dd5d4){if(_0x5dd5d4){return _0xdda8e5[_0xfd34('0x15')](_0x1f245a)[_0xfd34('0x16')](_0x5dd5d4);}};}function respondWithFilteredResult(_0x1aeb91,_0x1a2007){return function(_0x2c428b){if(_0x2c428b){var _0x442c20=_0x2c428b[_0xfd34('0x17')],_0x51c119=_0x1a2007['offset'],_0x2f3c70=_0x1a2007[_0xfd34('0x18')]+_0x1a2007[_0xfd34('0x19')],_0x51ee05;if(_0x2f3c70>=_0x442c20){_0x2f3c70=_0x442c20;_0x51ee05=0xc8;}else{_0x51ee05=0xce;}_0x1aeb91[_0xfd34('0x15')](_0x51ee05);return _0x1aeb91[_0xfd34('0x1a')](_0xfd34('0x1b'),_0x51c119+'-'+_0x2f3c70+'/'+_0x442c20)[_0xfd34('0x16')](_0x2c428b);}return null;};}function patchUpdates(_0x1f53cf){return function(_0x316357){try{jsonpatch['apply'](_0x316357,_0x1f53cf,!![]);}catch(_0x1f6498){return BPromise[_0xfd34('0x1c')](_0x1f6498);}return _0x316357[_0xfd34('0x1d')]();};}function saveUpdates(_0x120923,_0x546f97){return function(_0x256b70){if(_0x256b70){return _0x256b70['update'](_0x120923)['then'](function(_0x2ccf3f){return _0x2ccf3f;});}return null;};}function removeEntity(_0x187c52,_0xac2cce){return function(_0x27c0ff){if(_0x27c0ff){return _0x27c0ff['destroy']()[_0xfd34('0x1e')](function(){var _0x19ede1=_0x27c0ff[_0xfd34('0x1f')]({'plain':!![]});var _0x157c86=_0xfd34('0x20');return db[_0xfd34('0x21')]['destroy']({'where':{'type':_0x157c86,'resourceId':_0x19ede1['id']}})['then'](function(){return _0x27c0ff;});})[_0xfd34('0x1e')](function(){_0x187c52[_0xfd34('0x15')](0xcc)[_0xfd34('0x22')]();});}};}function handleEntityNotFound(_0xe425e4,_0x2a464a){return function(_0x1579ed){if(!_0x1579ed){_0xe425e4[_0xfd34('0x23')](0x194);}return _0x1579ed;};}function handleError(_0x176451,_0xec2b74){_0xec2b74=_0xec2b74||0x1f4;return function(_0x5459d9){logger[_0xfd34('0x24')](_0x5459d9[_0xfd34('0x25')]);if(_0x5459d9[_0xfd34('0x26')]){delete _0x5459d9[_0xfd34('0x26')];}_0x176451[_0xfd34('0x15')](_0xec2b74)[_0xfd34('0x27')](_0x5459d9);};}exports[_0xfd34('0x28')]=function(_0x34fd5d,_0x57dbbd){var _0x179b41={},_0x1229ec={},_0x11f14d={'count':0x0,'rows':[]};var _0x21bf50=db[_0xfd34('0x29')]['rawAttributes'];_0x1229ec[_0xfd34('0x2a')]=_['keys'](_0x21bf50);_0x1229ec[_0xfd34('0x2b')]=_[_0xfd34('0x2c')](_0x34fd5d[_0xfd34('0x2b')]);_0x1229ec[_0xfd34('0x2d')]=_[_0xfd34('0x2e')](_0x1229ec[_0xfd34('0x2a')],_0x1229ec['query']);_0x179b41['attributes']=_[_0xfd34('0x2e')](_0x1229ec[_0xfd34('0x2a')],qs['fields'](_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x2f')]));_0x179b41[_0xfd34('0x30')]=_0x179b41[_0xfd34('0x30')][_0xfd34('0x31')]?_0x179b41['attributes']:_0x1229ec[_0xfd34('0x2a')];if(!_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x32')](_0xfd34('0x33'))){_0x179b41[_0xfd34('0x19')]=qs[_0xfd34('0x19')](_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x19')]);_0x179b41[_0xfd34('0x18')]=qs[_0xfd34('0x18')](_0x34fd5d['query'][_0xfd34('0x18')]);}_0x179b41[_0xfd34('0x34')]=qs[_0xfd34('0x35')](_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x35')]);_0x179b41['where']=qs[_0xfd34('0x2d')](_[_0xfd34('0x36')](_0x34fd5d[_0xfd34('0x2b')],_0x1229ec[_0xfd34('0x2d')]));if(_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x37')]){_0x179b41['where']=_[_0xfd34('0x38')](_0x179b41[_0xfd34('0x39')],{'$or':_['map'](_0x21bf50,function(_0x215d5e){if(_0x215d5e['type'][_0xfd34('0x3a')]!==_0xfd34('0x3b')){var _0xed553={};_0xed553[_0x215d5e[_0xfd34('0x3c')]]={'$like':'%'+_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x37')]+'%'};return _0xed553;}})});}_0x179b41=_[_0xfd34('0x38')]({},_0x179b41,_0x34fd5d[_0xfd34('0x3d')]);var _0x1d5d3c={'where':_0x179b41[_0xfd34('0x39')]};return db[_0xfd34('0x29')]['count'](_0x1d5d3c)['then'](function(_0x251c14){_0x11f14d[_0xfd34('0x17')]=_0x251c14;if(_0x34fd5d[_0xfd34('0x2b')][_0xfd34('0x3e')]){_0x179b41['include']=[{'all':!![]}];}return db[_0xfd34('0x29')][_0xfd34('0x3f')](_0x179b41);})['then'](function(_0x3b91ac){_0x11f14d[_0xfd34('0x40')]=_0x3b91ac;return _0x11f14d;})[_0xfd34('0x1e')](respondWithFilteredResult(_0x57dbbd,_0x179b41))['catch'](handleError(_0x57dbbd,null));};exports['show']=function(_0x3fc4c9,_0x54fab6){var _0x230b07={'raw':!![],'where':{'id':_0x3fc4c9['params']['id']}},_0x1246e8={};_0x1246e8['model']=_[_0xfd34('0x2c')](db['CannedAnswer'][_0xfd34('0x41')]);_0x1246e8[_0xfd34('0x2b')]=_[_0xfd34('0x2c')](_0x3fc4c9['query']);_0x1246e8[_0xfd34('0x2d')]=_[_0xfd34('0x2e')](_0x1246e8[_0xfd34('0x2a')],_0x1246e8[_0xfd34('0x2b')]);_0x230b07['attributes']=_['intersection'](_0x1246e8['model'],qs['fields'](_0x3fc4c9[_0xfd34('0x2b')][_0xfd34('0x2f')]));_0x230b07['attributes']=_0x230b07[_0xfd34('0x30')][_0xfd34('0x31')]?_0x230b07[_0xfd34('0x30')]:_0x1246e8[_0xfd34('0x2a')];if(_0x3fc4c9[_0xfd34('0x2b')][_0xfd34('0x3e')]){_0x230b07['include']=[{'all':!![]}];}_0x230b07=_[_0xfd34('0x38')]({},_0x230b07,_0x3fc4c9['options']);return db[_0xfd34('0x29')][_0xfd34('0x42')](_0x230b07)['then'](handleEntityNotFound(_0x54fab6,null))[_0xfd34('0x1e')](respondWithResult(_0x54fab6,null))['catch'](handleError(_0x54fab6,null));};exports[_0xfd34('0x43')]=function(_0x27a25a,_0x4de0d4){if(_0x27a25a['body']['id']){delete _0x27a25a[_0xfd34('0x44')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x27a25a[_0xfd34('0x45')]['id']}})[_0xfd34('0x1e')](handleEntityNotFound(_0x4de0d4,null))[_0xfd34('0x1e')](saveUpdates(_0x27a25a[_0xfd34('0x44')],null))['then'](respondWithResult(_0x4de0d4,null))['catch'](handleError(_0x4de0d4,null));};exports[_0xfd34('0x46')]=function(_0x17f024,_0x3fb94e){return db[_0xfd34('0x29')][_0xfd34('0x42')]({'where':{'id':_0x17f024[_0xfd34('0x45')]['id']}})[_0xfd34('0x1e')](handleEntityNotFound(_0x3fb94e,null))[_0xfd34('0x1e')](removeEntity(_0x3fb94e,null))[_0xfd34('0x47')](handleError(_0x3fb94e,null));};exports['create']=function(_0x8ab53,_0x26f14f){var _0x334fd0={'key':_0x8ab53[_0xfd34('0x44')][_0xfd34('0x3a')]};if(_0x8ab53[_0xfd34('0x44')][_0xfd34('0x48')]){_0x334fd0[_0xfd34('0x48')]=_0x8ab53[_0xfd34('0x44')]['MailAccountId'];}else if(_0x8ab53[_0xfd34('0x44')][_0xfd34('0x49')]){_0x334fd0[_0xfd34('0x49')]=_0x8ab53[_0xfd34('0x44')][_0xfd34('0x49')];}else if(_0x8ab53['body']['OpenchannelAccountId']){_0x334fd0[_0xfd34('0x4a')]=_0x8ab53['body']['OpenchannelAccountId'];}else if(_0x8ab53[_0xfd34('0x44')][_0xfd34('0x4b')]){_0x334fd0['ChatWebsiteId']=_0x8ab53[_0xfd34('0x44')][_0xfd34('0x4b')];}return db[_0xfd34('0x29')][_0xfd34('0x42')]({'where':_0x334fd0})[_0xfd34('0x1e')](function(_0x4a5693){if(_0x4a5693){throw new db[(_0xfd34('0x4c'))]['ValidationError'](_0xfd34('0x4d'));}return db[_0xfd34('0x29')][_0xfd34('0x4e')](_0x8ab53[_0xfd34('0x44')]);})['then'](function(_0x5aee89){var _0x3de1f7=_0x8ab53[_0xfd34('0x4f')][_0xfd34('0x1f')]({'plain':!![]});if(!_0x3de1f7)throw new Error(_0xfd34('0x50'));if(_0x3de1f7[_0xfd34('0x51')]===_0xfd34('0x4f')){var _0x5b53fe=_0x5aee89[_0xfd34('0x1f')]({'plain':!![]});return db['UserProfileSection'][_0xfd34('0x42')]({'where':{'name':_0xfd34('0x20'),'userProfileId':_0x3de1f7[_0xfd34('0x52')]},'raw':!![]})[_0xfd34('0x1e')](function(_0x9a982d){if(_0x9a982d&&_0x9a982d[_0xfd34('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b53fe['name'],'resourceId':_0x5b53fe['id'],'type':_0x9a982d[_0xfd34('0x26')],'sectionId':_0x9a982d['id']},{})[_0xfd34('0x1e')](function(){return _0x5aee89;});}else{return _0x5aee89;}})[_0xfd34('0x47')](function(_0x481358){logger['error'](_0xfd34('0x54'),_0x481358);throw _0x481358;});}return _0x5aee89;})[_0xfd34('0x1e')](respondWithResult(_0x26f14f,0xc9))[_0xfd34('0x47')](handleError(_0x26f14f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8ccff16..ac13daa 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 _0x831d=['utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x831d,0x1a1));var _0xd831=function(_0x2aad02,_0x556ae7){_0x2aad02=_0x2aad02-0x0;var _0x546e5b=_0x831d[_0x2aad02];return _0x546e5b;};'use strict';var _=require('lodash');var util=require(_0xd831('0x0'));var logger=require(_0xd831('0x1'))(_0xd831('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd831('0x3'));var fs=require('fs');var path=require(_0xd831('0x4'));var rimraf=require(_0xd831('0x5'));var config=require(_0xd831('0x6'));var attributes=require(_0xd831('0x7'));module[_0xd831('0x8')]=function(_0x380b8f,_0xd8ca70){return _0x380b8f[_0xd831('0x9')]('CannedAnswer',attributes,{'tableName':_0xd831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd831('0xb'),'collate':_0xd831('0xc')});}; \ No newline at end of file +var _0xb7dc=['api','request-promise','path','../../config/environment','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2e368a,_0x331e64){var _0xbe1265=function(_0x3a07b0){while(--_0x3a07b0){_0x2e368a['push'](_0x2e368a['shift']());}};_0xbe1265(++_0x331e64);}(_0xb7dc,0xf9));var _0xcb7d=function(_0x3e6962,_0x42199e){_0x3e6962=_0x3e6962-0x0;var _0x37608a=_0xb7dc[_0x3e6962];return _0x37608a;};'use strict';var _=require(_0xcb7d('0x0'));var util=require(_0xcb7d('0x1'));var logger=require(_0xcb7d('0x2'))(_0xcb7d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb7d('0x4'));var fs=require('fs');var path=require(_0xcb7d('0x5'));var rimraf=require('rimraf');var config=require(_0xcb7d('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0xcb7d('0x7')]=function(_0x4807a0,_0x163cdf){return _0x4807a0[_0xcb7d('0x8')](_0xcb7d('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb7d('0xa'),'collate':_0xcb7d('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4e0f6bb..ed80790 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 _0x3302=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x835f74,_0x123452){var _0x46a4d6=function(_0x5b7adc){while(--_0x5b7adc){_0x835f74['push'](_0x835f74['shift']());}};_0x46a4d6(++_0x123452);}(_0x3302,0x18a));var _0x2330=function(_0x3023dc,_0x28d6dd){_0x3023dc=_0x3023dc-0x0;var _0x1f9b33=_0x3302[_0x3023dc];return _0x1f9b33;};'use strict';var _=require(_0x2330('0x0'));var util=require(_0x2330('0x1'));var moment=require(_0x2330('0x2'));var BPromise=require(_0x2330('0x3'));var rs=require(_0x2330('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2330('0x5'))['db'];var utils=require(_0x2330('0x6'));var logger=require(_0x2330('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2330('0x8')][_0x2330('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5da7dc,_0x46970e,_0x174f9f){return new BPromise(function(_0x87296,_0x1672c9){return client[_0x2330('0xa')](_0x5da7dc,_0x174f9f)['then'](function(_0x17b52c){logger[_0x2330('0xb')](_0x2330('0xc'),_0x46970e,'request\x20sent');logger[_0x2330('0xd')](_0x2330('0xe'),_0x46970e,_0x2330('0xf'),JSON[_0x2330('0x10')](_0x17b52c));if(_0x17b52c['error']){if(_0x17b52c[_0x2330('0x11')][_0x2330('0x12')]===0x1f4){logger[_0x2330('0x11')](_0x2330('0xc'),_0x46970e,_0x17b52c['error']['message']);return _0x1672c9(_0x17b52c[_0x2330('0x11')][_0x2330('0x13')]);}logger['error'](_0x2330('0xc'),_0x46970e,_0x17b52c[_0x2330('0x11')][_0x2330('0x13')]);return _0x87296(_0x17b52c[_0x2330('0x11')][_0x2330('0x13')]);}else{logger[_0x2330('0xb')](_0x2330('0xc'),_0x46970e,'request\x20sent');_0x87296(_0x17b52c[_0x2330('0x14')]['message']);}})[_0x2330('0x15')](function(_0x51aafc){logger[_0x2330('0x11')](_0x2330('0xc'),_0x46970e,_0x51aafc);_0x1672c9(_0x51aafc);});});} \ No newline at end of file +var _0x9ed0=['debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CannedAnswer,\x20%s,\x20%s','request\x20sent'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9ed0,0xaf));var _0x09ed=function(_0x513eca,_0x593007){_0x513eca=_0x513eca-0x0;var _0x2c4e0b=_0x9ed0[_0x513eca];return _0x2c4e0b;};'use strict';var _=require('lodash');var util=require(_0x09ed('0x0'));var moment=require('moment');var BPromise=require(_0x09ed('0x1'));var rs=require(_0x09ed('0x2'));var fs=require('fs');var Redis=require(_0x09ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09ed('0x4'));var logger=require(_0x09ed('0x5'))(_0x09ed('0x6'));var config=require(_0x09ed('0x7'));var jayson=require(_0x09ed('0x8'));var client=jayson[_0x09ed('0x9')][_0x09ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x869930,_0x37774f,_0xd17a93){return new BPromise(function(_0xf2a883,_0x377995){return client['request'](_0x869930,_0xd17a93)[_0x09ed('0xb')](function(_0x22f90f){logger['info'](_0x09ed('0xc'),_0x37774f,_0x09ed('0xd'));logger[_0x09ed('0xe')](_0x09ed('0xf'),_0x37774f,_0x09ed('0xd'),JSON[_0x09ed('0x10')](_0x22f90f));if(_0x22f90f[_0x09ed('0x11')]){if(_0x22f90f[_0x09ed('0x11')][_0x09ed('0x12')]===0x1f4){logger[_0x09ed('0x11')](_0x09ed('0xc'),_0x37774f,_0x22f90f['error'][_0x09ed('0x13')]);return _0x377995(_0x22f90f[_0x09ed('0x11')][_0x09ed('0x13')]);}logger[_0x09ed('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x37774f,_0x22f90f[_0x09ed('0x11')][_0x09ed('0x13')]);return _0xf2a883(_0x22f90f[_0x09ed('0x11')][_0x09ed('0x13')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x37774f,_0x09ed('0xd'));_0xf2a883(_0x22f90f['result'][_0x09ed('0x13')]);}})[_0x09ed('0x14')](function(_0x5e81c1){logger[_0x09ed('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x37774f,_0x5e81c1);_0x377995(_0x5e81c1);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 11b18c8..f560cc5 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 _0x72d1=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x202c72,_0x5219be){var _0x3cb1c6=function(_0x47adb0){while(--_0x47adb0){_0x202c72['push'](_0x202c72['shift']());}};_0x3cb1c6(++_0x5219be);}(_0x72d1,0xe7));var _0x172d=function(_0x1bb0b8,_0x24add2){_0x1bb0b8=_0x1bb0b8-0x0;var _0x22fc67=_0x72d1[_0x1bb0b8];return _0x22fc67;};'use strict';var multer=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var path=require(_0x172d('0x2'));var timeout=require(_0x172d('0x3'));var express=require(_0x172d('0x4'));var router=express[_0x172d('0x5')]();var auth=require(_0x172d('0x6'));var interaction=require(_0x172d('0x7'));var config=require(_0x172d('0x8'));var controller=require(_0x172d('0x9'));router[_0x172d('0xa')]('/',auth[_0x172d('0xb')](),controller[_0x172d('0xc')]);router[_0x172d('0xa')](_0x172d('0xd'),auth[_0x172d('0xb')](),controller[_0x172d('0xe')]);router[_0x172d('0xf')]('/',auth[_0x172d('0xb')](),controller[_0x172d('0x10')]);router[_0x172d('0x11')](_0x172d('0xd'),auth[_0x172d('0xb')](),controller[_0x172d('0x12')]);router[_0x172d('0x13')](_0x172d('0xd'),auth[_0x172d('0xb')](),controller[_0x172d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4fce=['show','post','create','put','/:id','update','exports','connect-timeout','express','Router','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x5145ba,_0x3c6ae0){var _0x4d3d20=function(_0x591593){while(--_0x591593){_0x5145ba['push'](_0x5145ba['shift']());}};_0x4d3d20(++_0x3c6ae0);}(_0x4fce,0x1e7));var _0xe4fc=function(_0xf394d3,_0x4271dc){_0xf394d3=_0xf394d3-0x0;var _0x51462b=_0x4fce[_0xf394d3];return _0x51462b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe4fc('0x0'));var express=require(_0xe4fc('0x1'));var router=express[_0xe4fc('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe4fc('0x3'));var controller=require(_0xe4fc('0x4'));router[_0xe4fc('0x5')]('/',auth[_0xe4fc('0x6')](),controller[_0xe4fc('0x7')]);router[_0xe4fc('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xe4fc('0x8')]);router[_0xe4fc('0x9')]('/',auth[_0xe4fc('0x6')](),controller[_0xe4fc('0xa')]);router[_0xe4fc('0xb')](_0xe4fc('0xc'),auth['isAuthenticated'](),controller[_0xe4fc('0xd')]);router['delete'](_0xe4fc('0xc'),auth[_0xe4fc('0x6')](),controller['destroy']);module[_0xe4fc('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7d6f339..5b60edb 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 _0xec94=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0xb86fbc,_0x540baf){var _0x2663e6=function(_0x344966){while(--_0x344966){_0xb86fbc['push'](_0xb86fbc['shift']());}};_0x2663e6(++_0x540baf);}(_0xec94,0x11c));var _0x4ec9=function(_0xfd5311,_0x2a4dc7){_0xfd5311=_0xfd5311-0x0;var _0x2a3652=_0xec94[_0xfd5311];return _0x2a3652;};'use strict';var Sequelize=require(_0x4ec9('0x0'));module[_0x4ec9('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4ec9('0x2')},'clid':{'type':Sequelize[_0x4ec9('0x3')]},'src':{'type':Sequelize[_0x4ec9('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4ec9('0x3')]},'dstchannel':{'type':Sequelize[_0x4ec9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4ec9('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4ec9('0x3')]},'amaflags':{'type':Sequelize[_0x4ec9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4ec9('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4ec9('0x3')]},'linkedid':{'type':Sequelize[_0x4ec9('0x3')]},'sequence':{'type':Sequelize[_0x4ec9('0x3')]},'peeraccount':{'type':Sequelize[_0x4ec9('0x3')]},'type':{'type':Sequelize[_0x4ec9('0x3')]},'tag':{'type':Sequelize[_0x4ec9('0x3')]}}; \ No newline at end of file +var _0x1855=['INTEGER','sequelize','STRING'];(function(_0x4f4aeb,_0x1bd8ec){var _0x5a2f2a=function(_0x2ff6c0){while(--_0x2ff6c0){_0x4f4aeb['push'](_0x4f4aeb['shift']());}};_0x5a2f2a(++_0x1bd8ec);}(_0x1855,0xe8));var _0x5185=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x1855[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require(_0x5185('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5185('0x1')]},'dst':{'type':Sequelize[_0x5185('0x1')]},'dcontext':{'type':Sequelize[_0x5185('0x1')]},'channel':{'type':Sequelize[_0x5185('0x1')]},'dstchannel':{'type':Sequelize[_0x5185('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x5185('0x1')]},'duration':{'type':Sequelize[_0x5185('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5185('0x1')]},'amaflags':{'type':Sequelize[_0x5185('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5185('0x1')]},'userfield':{'type':Sequelize[_0x5185('0x1')]},'uniqueid':{'type':Sequelize[_0x5185('0x1')]},'linkedid':{'type':Sequelize[_0x5185('0x1')]},'sequence':{'type':Sequelize[_0x5185('0x1')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5185('0x1')]},'tag':{'type':Sequelize[_0x5185('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 634b4ff..a8eb337 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 _0x848c=['merge','type','key','VIRTUAL','field','count','then','includeAll','include','rows','params','intersection','fields','options','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','set','apply','reject','destroy','sendStatus','error','stack','name','send','Cdr','model','keys','query','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter'];(function(_0x2f6dea,_0x47feb3){var _0x129cb1=function(_0x2db5b2){while(--_0x2db5b2){_0x2f6dea['push'](_0x2f6dea['shift']());}};_0x129cb1(++_0x47feb3);}(_0x848c,0x19e));var _0xc848=function(_0x52023c,_0x5eddbc){_0x52023c=_0x52023c-0x0;var _0x1e473f=_0x848c[_0x52023c];return _0x1e473f;};'use strict';var pdf=require(_0xc848('0x0'));var emlformat=require(_0xc848('0x1'));var rimraf=require(_0xc848('0x2'));var zipdir=require(_0xc848('0x3'));var jsonpatch=require(_0xc848('0x4'));var rp=require(_0xc848('0x5'));var moment=require(_0xc848('0x6'));var BPromise=require(_0xc848('0x7'));var Mustache=require(_0xc848('0x8'));var util=require(_0xc848('0x9'));var path=require('path');var sox=require(_0xc848('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc848('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc848('0xc'));var toCsv=require(_0xc848('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc848('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc848('0xf'));var hardwareService=require(_0xc848('0x10'));var logger=require(_0xc848('0x11'))(_0xc848('0x12'));var utils=require(_0xc848('0x13'));var config=require(_0xc848('0x14'));var db=require(_0xc848('0x15'))['db'];function respondWithStatusCode(_0x18b8fe,_0x4879b2){_0x4879b2=_0x4879b2||0xcc;return function(_0x16d22b){if(_0x16d22b){return _0x18b8fe['sendStatus'](_0x4879b2);}return _0x18b8fe[_0xc848('0x16')](_0x4879b2)[_0xc848('0x17')]();};}function respondWithResult(_0x425d3a,_0x1bdbcc){_0x1bdbcc=_0x1bdbcc||0xc8;return function(_0x55e116){if(_0x55e116){return _0x425d3a[_0xc848('0x16')](_0x1bdbcc)['json'](_0x55e116);}};}function respondWithFilteredResult(_0x2776e4,_0xea41cd){return function(_0x15f8ae){if(_0x15f8ae){var _0x4695bc=_0x15f8ae['count'],_0x4193aa=_0xea41cd[_0xc848('0x18')],_0xde4253=_0xea41cd[_0xc848('0x18')]+_0xea41cd['limit'],_0x498caa;if(_0xde4253>=_0x4695bc){_0xde4253=_0x4695bc;_0x498caa=0xc8;}else{_0x498caa=0xce;}_0x2776e4[_0xc848('0x16')](_0x498caa);return _0x2776e4[_0xc848('0x19')]('Content-Range',_0x4193aa+'-'+_0xde4253+'/'+_0x4695bc)['json'](_0x15f8ae);}return null;};}function patchUpdates(_0x39f192){return function(_0xf8771e){try{jsonpatch[_0xc848('0x1a')](_0xf8771e,_0x39f192,!![]);}catch(_0x49632b){return BPromise[_0xc848('0x1b')](_0x49632b);}return _0xf8771e['save']();};}function saveUpdates(_0x20c4a6,_0x2de9a7){return function(_0x2e6650){if(_0x2e6650){return _0x2e6650['update'](_0x20c4a6)['then'](function(_0x342b52){return _0x342b52;});}return null;};}function removeEntity(_0x402d77,_0x4f5956){return function(_0x14f220){if(_0x14f220){return _0x14f220[_0xc848('0x1c')]()['then'](function(){_0x402d77[_0xc848('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cc15,_0x571369){return function(_0xd67178){if(!_0xd67178){_0x42cc15[_0xc848('0x1d')](0x194);}return _0xd67178;};}function handleError(_0x5f58ef,_0x191d0d){_0x191d0d=_0x191d0d||0x1f4;return function(_0x4d8650){logger[_0xc848('0x1e')](_0x4d8650[_0xc848('0x1f')]);if(_0x4d8650[_0xc848('0x20')]){delete _0x4d8650[_0xc848('0x20')];}_0x5f58ef[_0xc848('0x16')](_0x191d0d)[_0xc848('0x21')](_0x4d8650);};}exports['index']=function(_0x377581,_0xb2ad41){var _0x4baa24={},_0x193d9e={},_0x3ccc91={'count':0x0,'rows':[]};var _0x2ea44b=db[_0xc848('0x22')]['rawAttributes'];_0x193d9e[_0xc848('0x23')]=_['keys'](_0x2ea44b);_0x193d9e['query']=_[_0xc848('0x24')](_0x377581[_0xc848('0x25')]);_0x193d9e['filters']=_['intersection'](_0x193d9e['model'],_0x193d9e[_0xc848('0x25')]);_0x4baa24[_0xc848('0x26')]=_['intersection'](_0x193d9e[_0xc848('0x23')],qs['fields'](_0x377581[_0xc848('0x25')]['fields']));_0x4baa24[_0xc848('0x26')]=_0x4baa24[_0xc848('0x26')][_0xc848('0x27')]?_0x4baa24[_0xc848('0x26')]:_0x193d9e[_0xc848('0x23')];if(!_0x377581[_0xc848('0x25')][_0xc848('0x28')]('nolimit')){_0x4baa24[_0xc848('0x29')]=qs[_0xc848('0x29')](_0x377581[_0xc848('0x25')][_0xc848('0x29')]);_0x4baa24[_0xc848('0x18')]=qs[_0xc848('0x18')](_0x377581[_0xc848('0x25')][_0xc848('0x18')]);}_0x4baa24[_0xc848('0x2a')]=qs[_0xc848('0x2b')](_0x377581[_0xc848('0x25')][_0xc848('0x2b')]);_0x4baa24[_0xc848('0x2c')]=qs[_0xc848('0x2d')](_[_0xc848('0x2e')](_0x377581[_0xc848('0x25')],_0x193d9e['filters']));if(_0x377581[_0xc848('0x25')][_0xc848('0x2f')]){_0x4baa24[_0xc848('0x2c')]=_[_0xc848('0x30')](_0x4baa24[_0xc848('0x2c')],{'$or':_['map'](_0x2ea44b,function(_0xd08ed8){if(_0xd08ed8[_0xc848('0x31')][_0xc848('0x32')]!==_0xc848('0x33')){var _0x4cb310={};_0x4cb310[_0xd08ed8[_0xc848('0x34')]]={'$like':'%'+_0x377581[_0xc848('0x25')]['filter']+'%'};return _0x4cb310;}})});}_0x4baa24=_[_0xc848('0x30')]({},_0x4baa24,_0x377581['options']);var _0x27520b={'where':_0x4baa24[_0xc848('0x2c')]};return db[_0xc848('0x22')][_0xc848('0x35')](_0x27520b)[_0xc848('0x36')](function(_0x520ac0){_0x3ccc91[_0xc848('0x35')]=_0x520ac0;if(_0x377581[_0xc848('0x25')][_0xc848('0x37')]){_0x4baa24[_0xc848('0x38')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x4baa24);})[_0xc848('0x36')](function(_0x23ca12){_0x3ccc91[_0xc848('0x39')]=_0x23ca12;return _0x3ccc91;})[_0xc848('0x36')](respondWithFilteredResult(_0xb2ad41,_0x4baa24))['catch'](handleError(_0xb2ad41,null));};exports['show']=function(_0x1d65b0,_0x490036){var _0x1026f8={'raw':!![],'where':{'id':_0x1d65b0[_0xc848('0x3a')]['id']}},_0x46a2df={};_0x46a2df['model']=_[_0xc848('0x24')](db['Cdr']['rawAttributes']);_0x46a2df[_0xc848('0x25')]=_[_0xc848('0x24')](_0x1d65b0['query']);_0x46a2df[_0xc848('0x2d')]=_['intersection'](_0x46a2df['model'],_0x46a2df['query']);_0x1026f8[_0xc848('0x26')]=_[_0xc848('0x3b')](_0x46a2df['model'],qs[_0xc848('0x3c')](_0x1d65b0[_0xc848('0x25')]['fields']));_0x1026f8[_0xc848('0x26')]=_0x1026f8[_0xc848('0x26')][_0xc848('0x27')]?_0x1026f8[_0xc848('0x26')]:_0x46a2df[_0xc848('0x23')];if(_0x1d65b0['query'][_0xc848('0x37')]){_0x1026f8[_0xc848('0x38')]=[{'all':!![]}];}_0x1026f8=_['merge']({},_0x1026f8,_0x1d65b0[_0xc848('0x3d')]);return db[_0xc848('0x22')]['find'](_0x1026f8)['then'](handleEntityNotFound(_0x490036,null))[_0xc848('0x36')](respondWithResult(_0x490036,null))['catch'](handleError(_0x490036,null));};exports[_0xc848('0x3e')]=function(_0xce0e31,_0x494351){return db['Cdr'][_0xc848('0x3e')](_0xce0e31[_0xc848('0x3f')],{})['then'](respondWithResult(_0x494351,0xc9))[_0xc848('0x40')](handleError(_0x494351,null));};exports['update']=function(_0x2b05b0,_0x3c96b4){if(_0x2b05b0[_0xc848('0x3f')]['id']){delete _0x2b05b0[_0xc848('0x3f')]['id'];}return db[_0xc848('0x22')]['find']({'where':{'id':_0x2b05b0[_0xc848('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3c96b4,null))['then'](saveUpdates(_0x2b05b0['body'],null))[_0xc848('0x36')](respondWithResult(_0x3c96b4,null))[_0xc848('0x40')](handleError(_0x3c96b4,null));};exports[_0xc848('0x1c')]=function(_0x2ae0b2,_0x2a738e){return db[_0xc848('0x22')]['find']({'where':{'id':_0x2ae0b2['params']['id']}})[_0xc848('0x36')](handleEntityNotFound(_0x2a738e,null))[_0xc848('0x36')](removeEntity(_0x2a738e,null))[_0xc848('0x40')](handleError(_0x2a738e,null));};exports[_0xc848('0x41')]=function(_0x3f8e42,_0x535f80){return db[_0xc848('0x22')][_0xc848('0x41')]()['then'](respondWithResult(_0x535f80,null))['catch'](handleError(_0x535f80,null));}; \ No newline at end of file +var _0x9285=['status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','Cdr','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','key','field','options','count','include','findAll','rows','catch','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','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','sendStatus'];(function(_0x55b780,_0x5d51e2){var _0x4d8e8e=function(_0x9f82b){while(--_0x9f82b){_0x55b780['push'](_0x55b780['shift']());}};_0x4d8e8e(++_0x5d51e2);}(_0x9285,0x197));var _0x5928=function(_0x24bd54,_0x40804a){_0x24bd54=_0x24bd54-0x0;var _0x5e3ae6=_0x9285[_0x24bd54];return _0x5e3ae6;};'use strict';var pdf=require(_0x5928('0x0'));var emlformat=require(_0x5928('0x1'));var rimraf=require(_0x5928('0x2'));var zipdir=require(_0x5928('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5928('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5928('0x5'));var util=require(_0x5928('0x6'));var path=require(_0x5928('0x7'));var sox=require(_0x5928('0x8'));var csv=require(_0x5928('0x9'));var ejs=require(_0x5928('0xa'));var fs=require('fs');var _=require(_0x5928('0xb'));var squel=require(_0x5928('0xc'));var crypto=require('crypto');var jsforce=require(_0x5928('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5928('0xe'));var Papa=require(_0x5928('0xf'));var Redis=require(_0x5928('0x10'));var authService=require(_0x5928('0x11'));var qs=require(_0x5928('0x12'));var hardwareService=require(_0x5928('0x13'));var logger=require(_0x5928('0x14'))(_0x5928('0x15'));var utils=require(_0x5928('0x16'));var config=require(_0x5928('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa726,_0xdcc5ad){_0xdcc5ad=_0xdcc5ad||0xcc;return function(_0x556a1e){if(_0x556a1e){return _0x4fa726[_0x5928('0x18')](_0xdcc5ad);}return _0x4fa726[_0x5928('0x19')](_0xdcc5ad)[_0x5928('0x1a')]();};}function respondWithResult(_0x5181cf,_0x48b59a){_0x48b59a=_0x48b59a||0xc8;return function(_0x5942b3){if(_0x5942b3){return _0x5181cf[_0x5928('0x19')](_0x48b59a)[_0x5928('0x1b')](_0x5942b3);}};}function respondWithFilteredResult(_0x5443a4,_0x303f41){return function(_0x156362){if(_0x156362){var _0x4164d2=_0x156362['count'],_0x15475a=_0x303f41[_0x5928('0x1c')],_0x1a2100=_0x303f41['offset']+_0x303f41[_0x5928('0x1d')],_0x2e88a8;if(_0x1a2100>=_0x4164d2){_0x1a2100=_0x4164d2;_0x2e88a8=0xc8;}else{_0x2e88a8=0xce;}_0x5443a4[_0x5928('0x19')](_0x2e88a8);return _0x5443a4[_0x5928('0x1e')](_0x5928('0x1f'),_0x15475a+'-'+_0x1a2100+'/'+_0x4164d2)[_0x5928('0x1b')](_0x156362);}return null;};}function patchUpdates(_0x16421c){return function(_0x1980a9){try{jsonpatch[_0x5928('0x20')](_0x1980a9,_0x16421c,!![]);}catch(_0x3e7287){return BPromise[_0x5928('0x21')](_0x3e7287);}return _0x1980a9['save']();};}function saveUpdates(_0x544f1b,_0x3184f9){return function(_0x1e7e96){if(_0x1e7e96){return _0x1e7e96[_0x5928('0x22')](_0x544f1b)[_0x5928('0x23')](function(_0x3251a7){return _0x3251a7;});}return null;};}function removeEntity(_0x5144f1,_0x1307bd){return function(_0x1725c1){if(_0x1725c1){return _0x1725c1['destroy']()[_0x5928('0x23')](function(){_0x5144f1[_0x5928('0x19')](0xcc)[_0x5928('0x1a')]();});}};}function handleEntityNotFound(_0x2ece3b,_0x5a7179){return function(_0x39d508){if(!_0x39d508){_0x2ece3b[_0x5928('0x18')](0x194);}return _0x39d508;};}function handleError(_0x571a9c,_0x3427c4){_0x3427c4=_0x3427c4||0x1f4;return function(_0x2267ea){logger[_0x5928('0x24')](_0x2267ea[_0x5928('0x25')]);if(_0x2267ea['name']){delete _0x2267ea[_0x5928('0x26')];}_0x571a9c[_0x5928('0x19')](_0x3427c4)[_0x5928('0x27')](_0x2267ea);};}exports['index']=function(_0x5a42cd,_0x4f6cfc){var _0x1c7a9d={},_0x496a65={},_0x5c1b3d={'count':0x0,'rows':[]};var _0x4c5dfe=db[_0x5928('0x28')][_0x5928('0x29')];_0x496a65[_0x5928('0x2a')]=_['keys'](_0x4c5dfe);_0x496a65[_0x5928('0x2b')]=_[_0x5928('0x2c')](_0x5a42cd[_0x5928('0x2b')]);_0x496a65[_0x5928('0x2d')]=_[_0x5928('0x2e')](_0x496a65[_0x5928('0x2a')],_0x496a65[_0x5928('0x2b')]);_0x1c7a9d[_0x5928('0x2f')]=_['intersection'](_0x496a65[_0x5928('0x2a')],qs[_0x5928('0x30')](_0x5a42cd['query'][_0x5928('0x30')]));_0x1c7a9d['attributes']=_0x1c7a9d[_0x5928('0x2f')][_0x5928('0x31')]?_0x1c7a9d[_0x5928('0x2f')]:_0x496a65[_0x5928('0x2a')];if(!_0x5a42cd[_0x5928('0x2b')]['hasOwnProperty'](_0x5928('0x32'))){_0x1c7a9d['limit']=qs[_0x5928('0x1d')](_0x5a42cd[_0x5928('0x2b')]['limit']);_0x1c7a9d[_0x5928('0x1c')]=qs['offset'](_0x5a42cd['query'][_0x5928('0x1c')]);}_0x1c7a9d[_0x5928('0x33')]=qs[_0x5928('0x34')](_0x5a42cd['query'][_0x5928('0x34')]);_0x1c7a9d[_0x5928('0x35')]=qs['filters'](_['pick'](_0x5a42cd[_0x5928('0x2b')],_0x496a65[_0x5928('0x2d')]));if(_0x5a42cd[_0x5928('0x2b')][_0x5928('0x36')]){_0x1c7a9d['where']=_[_0x5928('0x37')](_0x1c7a9d['where'],{'$or':_[_0x5928('0x38')](_0x4c5dfe,function(_0x405ce9){if(_0x405ce9['type'][_0x5928('0x39')]!=='VIRTUAL'){var _0x29725e={};_0x29725e[_0x405ce9[_0x5928('0x3a')]]={'$like':'%'+_0x5a42cd['query'][_0x5928('0x36')]+'%'};return _0x29725e;}})});}_0x1c7a9d=_['merge']({},_0x1c7a9d,_0x5a42cd[_0x5928('0x3b')]);var _0x19eda0={'where':_0x1c7a9d['where']};return db[_0x5928('0x28')]['count'](_0x19eda0)['then'](function(_0x3414a4){_0x5c1b3d[_0x5928('0x3c')]=_0x3414a4;if(_0x5a42cd[_0x5928('0x2b')]['includeAll']){_0x1c7a9d[_0x5928('0x3d')]=[{'all':!![]}];}return db[_0x5928('0x28')][_0x5928('0x3e')](_0x1c7a9d);})['then'](function(_0x4d87a7){_0x5c1b3d[_0x5928('0x3f')]=_0x4d87a7;return _0x5c1b3d;})[_0x5928('0x23')](respondWithFilteredResult(_0x4f6cfc,_0x1c7a9d))[_0x5928('0x40')](handleError(_0x4f6cfc,null));};exports['show']=function(_0x4abe21,_0x518ee3){var _0x3b057f={'raw':!![],'where':{'id':_0x4abe21[_0x5928('0x41')]['id']}},_0x2ac764={};_0x2ac764['model']=_[_0x5928('0x2c')](db[_0x5928('0x28')][_0x5928('0x29')]);_0x2ac764['query']=_[_0x5928('0x2c')](_0x4abe21[_0x5928('0x2b')]);_0x2ac764[_0x5928('0x2d')]=_[_0x5928('0x2e')](_0x2ac764[_0x5928('0x2a')],_0x2ac764['query']);_0x3b057f[_0x5928('0x2f')]=_[_0x5928('0x2e')](_0x2ac764[_0x5928('0x2a')],qs['fields'](_0x4abe21[_0x5928('0x2b')]['fields']));_0x3b057f[_0x5928('0x2f')]=_0x3b057f[_0x5928('0x2f')]['length']?_0x3b057f[_0x5928('0x2f')]:_0x2ac764[_0x5928('0x2a')];if(_0x4abe21['query'][_0x5928('0x42')]){_0x3b057f['include']=[{'all':!![]}];}_0x3b057f=_[_0x5928('0x37')]({},_0x3b057f,_0x4abe21['options']);return db[_0x5928('0x28')]['find'](_0x3b057f)[_0x5928('0x23')](handleEntityNotFound(_0x518ee3,null))[_0x5928('0x23')](respondWithResult(_0x518ee3,null))['catch'](handleError(_0x518ee3,null));};exports['create']=function(_0x173dd9,_0x4e2ebc){return db[_0x5928('0x28')][_0x5928('0x43')](_0x173dd9[_0x5928('0x44')],{})[_0x5928('0x23')](respondWithResult(_0x4e2ebc,0xc9))[_0x5928('0x40')](handleError(_0x4e2ebc,null));};exports[_0x5928('0x22')]=function(_0x51154e,_0x3bdc5d){if(_0x51154e[_0x5928('0x44')]['id']){delete _0x51154e[_0x5928('0x44')]['id'];}return db[_0x5928('0x28')][_0x5928('0x45')]({'where':{'id':_0x51154e[_0x5928('0x41')]['id']}})['then'](handleEntityNotFound(_0x3bdc5d,null))[_0x5928('0x23')](saveUpdates(_0x51154e[_0x5928('0x44')],null))[_0x5928('0x23')](respondWithResult(_0x3bdc5d,null))[_0x5928('0x40')](handleError(_0x3bdc5d,null));};exports[_0x5928('0x46')]=function(_0x5e6388,_0x2729f0){return db['Cdr'][_0x5928('0x45')]({'where':{'id':_0x5e6388[_0x5928('0x41')]['id']}})['then'](handleEntityNotFound(_0x2729f0,null))[_0x5928('0x23')](removeEntity(_0x2729f0,null))[_0x5928('0x40')](handleError(_0x2729f0,null));};exports[_0x5928('0x47')]=function(_0x3d36bd,_0x286c16){return db[_0x5928('0x28')]['describe']()[_0x5928('0x23')](respondWithResult(_0x286c16,null))[_0x5928('0x40')](handleError(_0x286c16,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 099b926..54baa43 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 _0x8628=['dst','src','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cdr.attributes','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x3d2198,_0x5cffc0){var _0x418d24=function(_0x1f1af5){while(--_0x1f1af5){_0x3d2198['push'](_0x3d2198['shift']());}};_0x418d24(++_0x5cffc0);}(_0x8628,0x179));var _0x8862=function(_0x4a7e21,_0x51c6fa){_0x4a7e21=_0x4a7e21-0x0;var _0x4ff2f7=_0x8628[_0x4a7e21];return _0x4ff2f7;};'use strict';var _=require('lodash');var util=require(_0x8862('0x0'));var logger=require(_0x8862('0x1'))('api');var moment=require(_0x8862('0x2'));var BPromise=require(_0x8862('0x3'));var rp=require(_0x8862('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8862('0x5'));var config=require(_0x8862('0x6'));var attributes=require(_0x8862('0x7'));module['exports']=function(_0x553537,_0x15dfe0){return _0x553537[_0x8862('0x8')](_0x8862('0x9'),attributes,{'tableName':_0x8862('0xa'),'paranoid':![],'indexes':[{'name':_0x8862('0xb'),'fields':[_0x8862('0xb')]},{'name':_0x8862('0xc'),'fields':[_0x8862('0xc')]},{'name':_0x8862('0xd'),'fields':[_0x8862('0xd')]},{'name':'dst','fields':[_0x8862('0xe')]},{'name':'src','fields':[_0x8862('0xf')]},{'name':_0x8862('0x10'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0xcabe=['accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr'];(function(_0x118477,_0x1377a2){var _0x4f9580=function(_0x715c09){while(--_0x715c09){_0x118477['push'](_0x118477['shift']());}};_0x4f9580(++_0x1377a2);}(_0xcabe,0x123));var _0xecab=function(_0x1c449a,_0x1322d3){_0x1c449a=_0x1c449a-0x0;var _0x4e53e7=_0xcabe[_0x1c449a];return _0x4e53e7;};'use strict';var _=require(_0xecab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xecab('0x1'));var moment=require(_0xecab('0x2'));var BPromise=require(_0xecab('0x3'));var rp=require(_0xecab('0x4'));var fs=require('fs');var path=require(_0xecab('0x5'));var rimraf=require(_0xecab('0x6'));var config=require(_0xecab('0x7'));var attributes=require(_0xecab('0x8'));module[_0xecab('0x9')]=function(_0x5d8af4,_0x594796){return _0x5d8af4[_0xecab('0xa')](_0xecab('0xb'),attributes,{'tableName':_0xecab('0xc'),'paranoid':![],'indexes':[{'name':_0xecab('0xd'),'fields':[_0xecab('0xd')]},{'name':_0xecab('0xe'),'fields':['calldate']},{'name':_0xecab('0xf'),'fields':[_0xecab('0xf')]},{'name':_0xecab('0x10'),'fields':['dst']},{'name':_0xecab('0x11'),'fields':[_0xecab('0x11')]},{'name':'uniqueid','fields':[_0xecab('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 7bb2164..e83c5ef 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 _0xcda6=['bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0xa20113,_0x6d49a4){var _0x59e09f=function(_0x346e90){while(--_0x346e90){_0xa20113['push'](_0xa20113['shift']());}};_0x59e09f(++_0x6d49a4);}(_0xcda6,0xcf));var _0x6cda=function(_0x58c66d,_0x495744){_0x58c66d=_0x58c66d-0x0;var _0x48ea59=_0xcda6[_0x58c66d];return _0x48ea59;};'use strict';var _=require(_0x6cda('0x0'));var util=require(_0x6cda('0x1'));var moment=require('moment');var BPromise=require(_0x6cda('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cda('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6cda('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6cda('0x5'));var client=jayson[_0x6cda('0x6')][_0x6cda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55fcbd,_0x2c65b7,_0x142dcb){return new BPromise(function(_0x4703d0,_0x56f265){return client[_0x6cda('0x8')](_0x55fcbd,_0x142dcb)[_0x6cda('0x9')](function(_0x2f8e17){logger[_0x6cda('0xa')](_0x6cda('0xb'),_0x2c65b7,_0x6cda('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x2c65b7,_0x6cda('0xc'),JSON[_0x6cda('0xd')](_0x2f8e17));if(_0x2f8e17[_0x6cda('0xe')]){if(_0x2f8e17[_0x6cda('0xe')][_0x6cda('0xf')]===0x1f4){logger[_0x6cda('0xe')](_0x6cda('0xb'),_0x2c65b7,_0x2f8e17[_0x6cda('0xe')][_0x6cda('0x10')]);return _0x56f265(_0x2f8e17[_0x6cda('0xe')]['message']);}logger[_0x6cda('0xe')](_0x6cda('0xb'),_0x2c65b7,_0x2f8e17['error'][_0x6cda('0x10')]);return _0x4703d0(_0x2f8e17[_0x6cda('0xe')][_0x6cda('0x10')]);}else{logger['info'](_0x6cda('0xb'),_0x2c65b7,'request\x20sent');_0x4703d0(_0x2f8e17[_0x6cda('0x11')][_0x6cda('0x10')]);}})[_0x6cda('0x12')](function(_0x3222f7){logger[_0x6cda('0xe')](_0x6cda('0xb'),_0x2c65b7,_0x3222f7);_0x56f265(_0x3222f7);});});} \ No newline at end of file +var _0x3176=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x3176,0x11c));var _0x6317=function(_0x5e4728,_0x412551){_0x5e4728=_0x5e4728-0x0;var _0x5d4011=_0x3176[_0x5e4728];return _0x5d4011;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var moment=require(_0x6317('0x2'));var BPromise=require(_0x6317('0x3'));var rs=require(_0x6317('0x4'));var fs=require('fs');var Redis=require(_0x6317('0x5'));var db=require(_0x6317('0x6'))['db'];var utils=require(_0x6317('0x7'));var logger=require('../../config/logger')(_0x6317('0x8'));var config=require(_0x6317('0x9'));var jayson=require(_0x6317('0xa'));var client=jayson[_0x6317('0xb')][_0x6317('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdb43e7,_0x3082a5,_0x294080){return new BPromise(function(_0x27accd,_0x10112a){return client['request'](_0xdb43e7,_0x294080)[_0x6317('0xd')](function(_0x4278ac){logger[_0x6317('0xe')](_0x6317('0xf'),_0x3082a5,_0x6317('0x10'));logger['debug'](_0x6317('0x11'),_0x3082a5,_0x6317('0x10'),JSON[_0x6317('0x12')](_0x4278ac));if(_0x4278ac[_0x6317('0x13')]){if(_0x4278ac[_0x6317('0x13')]['code']===0x1f4){logger[_0x6317('0x13')]('Cdr,\x20%s,\x20%s',_0x3082a5,_0x4278ac[_0x6317('0x13')][_0x6317('0x14')]);return _0x10112a(_0x4278ac[_0x6317('0x13')][_0x6317('0x14')]);}logger[_0x6317('0x13')](_0x6317('0xf'),_0x3082a5,_0x4278ac[_0x6317('0x13')][_0x6317('0x14')]);return _0x27accd(_0x4278ac['error'][_0x6317('0x14')]);}else{logger[_0x6317('0xe')](_0x6317('0xf'),_0x3082a5,_0x6317('0x10'));_0x27accd(_0x4278ac[_0x6317('0x15')]['message']);}})['catch'](function(_0x5b8712){logger[_0x6317('0x13')](_0x6317('0xf'),_0x3082a5,_0x5b8712);_0x10112a(_0x5b8712);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a4d37b1..3a1b164 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 _0x4d61=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x4d61,0x147));var _0x14d6=function(_0x140325,_0x53234c){_0x140325=_0x140325-0x0;var _0x318d4d=_0x4d61[_0x140325];return _0x318d4d;};'use strict';var multer=require(_0x14d6('0x0'));var util=require(_0x14d6('0x1'));var path=require(_0x14d6('0x2'));var timeout=require(_0x14d6('0x3'));var express=require(_0x14d6('0x4'));var router=express[_0x14d6('0x5')]();var auth=require(_0x14d6('0x6'));var interaction=require(_0x14d6('0x7'));var config=require(_0x14d6('0x8'));var controller=require('./cdr.controller');router[_0x14d6('0x9')]('/',auth[_0x14d6('0xa')](),controller[_0x14d6('0xb')]);router[_0x14d6('0x9')](_0x14d6('0xc'),auth[_0x14d6('0xa')](),controller[_0x14d6('0xd')]);router['get'](_0x14d6('0xe'),auth['isAuthenticated'](),controller[_0x14d6('0xf')]);router['post']('/',auth[_0x14d6('0xa')](),controller[_0x14d6('0x10')]);router['put'](_0x14d6('0xe'),auth[_0x14d6('0xa')](),controller[_0x14d6('0x11')]);router[_0x14d6('0x12')](_0x14d6('0xe'),auth[_0x14d6('0xa')](),controller[_0x14d6('0x13')]);module[_0x14d6('0x14')]=router; \ No newline at end of file +var _0xde50=['express','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','delete','util','path','connect-timeout'];(function(_0x34338e,_0x5aae07){var _0x11dc1b=function(_0x51c635){while(--_0x51c635){_0x34338e['push'](_0x34338e['shift']());}};_0x11dc1b(++_0x5aae07);}(_0xde50,0x15c));var _0x0de5=function(_0x2a764a,_0x33f35f){_0x2a764a=_0x2a764a-0x0;var _0x13cad7=_0xde50[_0x2a764a];return _0x13cad7;};'use strict';var multer=require('multer');var util=require(_0x0de5('0x0'));var path=require(_0x0de5('0x1'));var timeout=require(_0x0de5('0x2'));var express=require(_0x0de5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0de5('0x4'));var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0x0de5('0x5')]('/',auth[_0x0de5('0x6')](),controller[_0x0de5('0x7')]);router[_0x0de5('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0de5('0x5')](_0x0de5('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x0de5('0x9')]('/',auth[_0x0de5('0x6')](),controller[_0x0de5('0xa')]);router[_0x0de5('0xb')](_0x0de5('0x8'),auth[_0x0de5('0x6')](),controller['update']);router[_0x0de5('0xc')](_0x0de5('0x8'),auth['isAuthenticated'](),controller['destroy']);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 f29efef..4902eee 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 _0x8a2a=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x8a2a[_0x2ed8f3];return _0x525a55;};'use strict';var Sequelize=require('sequelize');module[_0xa8a2('0x0')]={'priority':{'type':Sequelize[_0xa8a2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa8a2('0x2')],'allowNull':![],'defaultValue':_0xa8a2('0x3')},'appdata':{'type':Sequelize[_0xa8a2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa8a2('0x2')],'defaultValue':_0xa8a2('0x5')}}; \ No newline at end of file +var _0x4137=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1c8783,_0x213d93){var _0x472cb0=function(_0x2b7904){while(--_0x2b7904){_0x1c8783['push'](_0x1c8783['shift']());}};_0x472cb0(++_0x213d93);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'priority':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7413('0x3')],'allowNull':![],'defaultValue':_0x7413('0x4')},'appdata':{'type':Sequelize[_0x7413('0x5')]()},'description':{'type':Sequelize[_0x7413('0x3')]},'interval':{'type':Sequelize[_0x7413('0x3')],'defaultValue':_0x7413('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9226e5e..96104bf 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 _0xab57=['reject','update','then','error','stack','name','send','params','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','find','catch','body','ChatApplication','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x13778d,_0x5b1851){var _0xfeb952=function(_0x436a10){while(--_0x436a10){_0x13778d['push'](_0x13778d['shift']());}};_0xfeb952(++_0x5b1851);}(_0xab57,0xeb));var _0x7ab5=function(_0x25caa2,_0x28fea6){_0x25caa2=_0x25caa2-0x0;var _0x484ab4=_0xab57[_0x25caa2];return _0x484ab4;};'use strict';var pdf=require(_0x7ab5('0x0'));var emlformat=require(_0x7ab5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7ab5('0x2'));var jsonpatch=require(_0x7ab5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ab5('0x4'));var util=require('util');var path=require(_0x7ab5('0x5'));var sox=require(_0x7ab5('0x6'));var csv=require(_0x7ab5('0x7'));var ejs=require(_0x7ab5('0x8'));var fs=require('fs');var _=require(_0x7ab5('0x9'));var squel=require(_0x7ab5('0xa'));var crypto=require(_0x7ab5('0xb'));var jsforce=require(_0x7ab5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7ab5('0x7'));var querystring=require(_0x7ab5('0xd'));var Papa=require(_0x7ab5('0xe'));var Redis=require('ioredis');var authService=require(_0x7ab5('0xf'));var qs=require(_0x7ab5('0x10'));var hardwareService=require(_0x7ab5('0x11'));var logger=require(_0x7ab5('0x12'))(_0x7ab5('0x13'));var utils=require('../../config/utils');var config=require(_0x7ab5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x180d4c,_0x586bf3){_0x586bf3=_0x586bf3||0xcc;return function(_0x5f3ca0){if(_0x5f3ca0){return _0x180d4c[_0x7ab5('0x15')](_0x586bf3);}return _0x180d4c[_0x7ab5('0x16')](_0x586bf3)[_0x7ab5('0x17')]();};}function respondWithResult(_0x5e3a78,_0x4ac4d4){_0x4ac4d4=_0x4ac4d4||0xc8;return function(_0x4e56eb){if(_0x4e56eb){return _0x5e3a78['status'](_0x4ac4d4)[_0x7ab5('0x18')](_0x4e56eb);}};}function respondWithFilteredResult(_0x1bf3eb,_0x1b2d41){return function(_0x286d18){if(_0x286d18){var _0x2551dd=_0x286d18[_0x7ab5('0x19')],_0x221491=_0x1b2d41['offset'],_0x2efb86=_0x1b2d41[_0x7ab5('0x1a')]+_0x1b2d41[_0x7ab5('0x1b')],_0x3fb199;if(_0x2efb86>=_0x2551dd){_0x2efb86=_0x2551dd;_0x3fb199=0xc8;}else{_0x3fb199=0xce;}_0x1bf3eb[_0x7ab5('0x16')](_0x3fb199);return _0x1bf3eb[_0x7ab5('0x1c')](_0x7ab5('0x1d'),_0x221491+'-'+_0x2efb86+'/'+_0x2551dd)[_0x7ab5('0x18')](_0x286d18);}return null;};}function patchUpdates(_0x4b44d6){return function(_0x1684ab){try{jsonpatch['apply'](_0x1684ab,_0x4b44d6,!![]);}catch(_0x7be819){return BPromise[_0x7ab5('0x1e')](_0x7be819);}return _0x1684ab['save']();};}function saveUpdates(_0x3d549e,_0x502795){return function(_0x1346cc){if(_0x1346cc){return _0x1346cc[_0x7ab5('0x1f')](_0x3d549e)[_0x7ab5('0x20')](function(_0x15297a){return _0x15297a;});}return null;};}function removeEntity(_0x28dea2,_0x23d013){return function(_0x6d64ae){if(_0x6d64ae){return _0x6d64ae['destroy']()[_0x7ab5('0x20')](function(){_0x28dea2[_0x7ab5('0x16')](0xcc)[_0x7ab5('0x17')]();});}};}function handleEntityNotFound(_0x535573,_0x4f7b91){return function(_0x4d8642){if(!_0x4d8642){_0x535573[_0x7ab5('0x15')](0x194);}return _0x4d8642;};}function handleError(_0x5330b3,_0x34c292){_0x34c292=_0x34c292||0x1f4;return function(_0x5bd3aa){logger[_0x7ab5('0x21')](_0x5bd3aa[_0x7ab5('0x22')]);if(_0x5bd3aa['name']){delete _0x5bd3aa[_0x7ab5('0x23')];}_0x5330b3[_0x7ab5('0x16')](_0x34c292)[_0x7ab5('0x24')](_0x5bd3aa);};}exports['show']=function(_0x2eb4bc,_0x582466){var _0x40a0c5={'raw':!![],'where':{'id':_0x2eb4bc[_0x7ab5('0x25')]['id']}},_0xc14f48={};_0xc14f48[_0x7ab5('0x26')]=_[_0x7ab5('0x27')](db['ChatApplication']['rawAttributes']);_0xc14f48[_0x7ab5('0x28')]=_['keys'](_0x2eb4bc[_0x7ab5('0x28')]);_0xc14f48['filters']=_['intersection'](_0xc14f48['model'],_0xc14f48[_0x7ab5('0x28')]);_0x40a0c5[_0x7ab5('0x29')]=_[_0x7ab5('0x2a')](_0xc14f48[_0x7ab5('0x26')],qs[_0x7ab5('0x2b')](_0x2eb4bc[_0x7ab5('0x28')][_0x7ab5('0x2b')]));_0x40a0c5[_0x7ab5('0x29')]=_0x40a0c5[_0x7ab5('0x29')][_0x7ab5('0x2c')]?_0x40a0c5['attributes']:_0xc14f48[_0x7ab5('0x26')];if(_0x2eb4bc[_0x7ab5('0x28')][_0x7ab5('0x2d')]){_0x40a0c5['include']=[{'all':!![]}];}_0x40a0c5=_[_0x7ab5('0x2e')]({},_0x40a0c5,_0x2eb4bc[_0x7ab5('0x2f')]);return db['ChatApplication'][_0x7ab5('0x30')](_0x40a0c5)['then'](handleEntityNotFound(_0x582466,null))[_0x7ab5('0x20')](respondWithResult(_0x582466,null))[_0x7ab5('0x31')](handleError(_0x582466,null));};exports[_0x7ab5('0x1f')]=function(_0x3a9c56,_0x147713){if(_0x3a9c56[_0x7ab5('0x32')]['id']){delete _0x3a9c56[_0x7ab5('0x32')]['id'];}return db[_0x7ab5('0x33')][_0x7ab5('0x30')]({'where':{'id':_0x3a9c56['params']['id']}})[_0x7ab5('0x20')](handleEntityNotFound(_0x147713,null))[_0x7ab5('0x20')](saveUpdates(_0x3a9c56['body'],null))['then'](respondWithResult(_0x147713,null))[_0x7ab5('0x31')](handleError(_0x147713,null));};exports[_0x7ab5('0x34')]=function(_0x290e74,_0x292218){return db[_0x7ab5('0x33')][_0x7ab5('0x30')]({'where':{'id':_0x290e74[_0x7ab5('0x25')]['id']}})['then'](handleEntityNotFound(_0x292218,null))['then'](removeEntity(_0x292218,null))['catch'](handleError(_0x292218,null));}; \ No newline at end of file +var _0x852e=['filters','intersection','attributes','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query'];(function(_0x25a648,_0x5c0608){var _0x3db307=function(_0x22d832){while(--_0x22d832){_0x25a648['push'](_0x25a648['shift']());}};_0x3db307(++_0x5c0608);}(_0x852e,0x1a2));var _0xe852=function(_0x113b78,_0x3f59f1){_0x113b78=_0x113b78-0x0;var _0x1e3e7d=_0x852e[_0x113b78];return _0x1e3e7d;};'use strict';var pdf=require(_0xe852('0x0'));var emlformat=require(_0xe852('0x1'));var rimraf=require(_0xe852('0x2'));var zipdir=require(_0xe852('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe852('0x4'));var moment=require(_0xe852('0x5'));var BPromise=require(_0xe852('0x6'));var Mustache=require(_0xe852('0x7'));var util=require(_0xe852('0x8'));var path=require('path');var sox=require(_0xe852('0x9'));var csv=require('to-csv');var ejs=require(_0xe852('0xa'));var fs=require('fs');var _=require(_0xe852('0xb'));var squel=require(_0xe852('0xc'));var crypto=require(_0xe852('0xd'));var jsforce=require(_0xe852('0xe'));var deskjs=require(_0xe852('0xf'));var toCsv=require(_0xe852('0x10'));var querystring=require('querystring');var Papa=require(_0xe852('0x11'));var Redis=require(_0xe852('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe852('0x13'));var hardwareService=require(_0xe852('0x14'));var logger=require('../../config/logger')(_0xe852('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0525,_0x5cd114){_0x5cd114=_0x5cd114||0xcc;return function(_0x4deab4){if(_0x4deab4){return _0x4e0525[_0xe852('0x16')](_0x5cd114);}return _0x4e0525[_0xe852('0x17')](_0x5cd114)[_0xe852('0x18')]();};}function respondWithResult(_0x4841cc,_0x18bf63){_0x18bf63=_0x18bf63||0xc8;return function(_0x4a5800){if(_0x4a5800){return _0x4841cc['status'](_0x18bf63)[_0xe852('0x19')](_0x4a5800);}};}function respondWithFilteredResult(_0x5f0f32,_0x178c28){return function(_0x2c20e7){if(_0x2c20e7){var _0x3888dc=_0x2c20e7['count'],_0x373390=_0x178c28[_0xe852('0x1a')],_0x564a4f=_0x178c28['offset']+_0x178c28[_0xe852('0x1b')],_0x6dbc0c;if(_0x564a4f>=_0x3888dc){_0x564a4f=_0x3888dc;_0x6dbc0c=0xc8;}else{_0x6dbc0c=0xce;}_0x5f0f32['status'](_0x6dbc0c);return _0x5f0f32[_0xe852('0x1c')](_0xe852('0x1d'),_0x373390+'-'+_0x564a4f+'/'+_0x3888dc)[_0xe852('0x19')](_0x2c20e7);}return null;};}function patchUpdates(_0x1e2c47){return function(_0x1b0341){try{jsonpatch[_0xe852('0x1e')](_0x1b0341,_0x1e2c47,!![]);}catch(_0x187bf4){return BPromise[_0xe852('0x1f')](_0x187bf4);}return _0x1b0341[_0xe852('0x20')]();};}function saveUpdates(_0x4ebdd2,_0x2aa15d){return function(_0x4eda62){if(_0x4eda62){return _0x4eda62[_0xe852('0x21')](_0x4ebdd2)[_0xe852('0x22')](function(_0x2a9e98){return _0x2a9e98;});}return null;};}function removeEntity(_0x527bea,_0x181de9){return function(_0x28c2ac){if(_0x28c2ac){return _0x28c2ac[_0xe852('0x23')]()[_0xe852('0x22')](function(){_0x527bea[_0xe852('0x17')](0xcc)[_0xe852('0x18')]();});}};}function handleEntityNotFound(_0x5728b7,_0x451160){return function(_0x54c935){if(!_0x54c935){_0x5728b7[_0xe852('0x16')](0x194);}return _0x54c935;};}function handleError(_0x3f7794,_0x3064fc){_0x3064fc=_0x3064fc||0x1f4;return function(_0x53541c){logger[_0xe852('0x24')](_0x53541c[_0xe852('0x25')]);if(_0x53541c[_0xe852('0x26')]){delete _0x53541c['name'];}_0x3f7794[_0xe852('0x17')](_0x3064fc)[_0xe852('0x27')](_0x53541c);};}exports[_0xe852('0x28')]=function(_0x47c15d,_0x204829){var _0x209fb4={'raw':!![],'where':{'id':_0x47c15d[_0xe852('0x29')]['id']}},_0x1d7286={};_0x1d7286[_0xe852('0x2a')]=_[_0xe852('0x2b')](db['ChatApplication'][_0xe852('0x2c')]);_0x1d7286[_0xe852('0x2d')]=_[_0xe852('0x2b')](_0x47c15d[_0xe852('0x2d')]);_0x1d7286[_0xe852('0x2e')]=_[_0xe852('0x2f')](_0x1d7286[_0xe852('0x2a')],_0x1d7286['query']);_0x209fb4[_0xe852('0x30')]=_[_0xe852('0x2f')](_0x1d7286['model'],qs[_0xe852('0x31')](_0x47c15d[_0xe852('0x2d')][_0xe852('0x31')]));_0x209fb4[_0xe852('0x30')]=_0x209fb4[_0xe852('0x30')][_0xe852('0x32')]?_0x209fb4[_0xe852('0x30')]:_0x1d7286[_0xe852('0x2a')];if(_0x47c15d[_0xe852('0x2d')][_0xe852('0x33')]){_0x209fb4['include']=[{'all':!![]}];}_0x209fb4=_[_0xe852('0x34')]({},_0x209fb4,_0x47c15d[_0xe852('0x35')]);return db[_0xe852('0x36')][_0xe852('0x37')](_0x209fb4)[_0xe852('0x22')](handleEntityNotFound(_0x204829,null))[_0xe852('0x22')](respondWithResult(_0x204829,null))[_0xe852('0x38')](handleError(_0x204829,null));};exports[_0xe852('0x21')]=function(_0xa13db1,_0x3aa910){if(_0xa13db1[_0xe852('0x39')]['id']){delete _0xa13db1[_0xe852('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0xa13db1[_0xe852('0x29')]['id']}})[_0xe852('0x22')](handleEntityNotFound(_0x3aa910,null))[_0xe852('0x22')](saveUpdates(_0xa13db1['body'],null))[_0xe852('0x22')](respondWithResult(_0x3aa910,null))['catch'](handleError(_0x3aa910,null));};exports[_0xe852('0x23')]=function(_0x248407,_0x7f983a){return db[_0xe852('0x36')][_0xe852('0x37')]({'where':{'id':_0x248407[_0xe852('0x29')]['id']}})[_0xe852('0x22')](handleEntityNotFound(_0x7f983a,null))['then'](removeEntity(_0x7f983a,null))[_0xe852('0x38')](handleError(_0x7f983a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a9fdbbc..281b074 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 _0xe582=['path','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0x353734,_0x56f9d0){var _0x55d951=function(_0x7ab49){while(--_0x7ab49){_0x353734['push'](_0x353734['shift']());}};_0x55d951(++_0x56f9d0);}(_0xe582,0x8c));var _0x2e58=function(_0x324276,_0x3748d5){_0x324276=_0x324276-0x0;var _0x14635a=_0xe582[_0x324276];return _0x14635a;};'use strict';var _=require(_0x2e58('0x0'));var util=require('util');var logger=require(_0x2e58('0x1'))('api');var moment=require(_0x2e58('0x2'));var BPromise=require(_0x2e58('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e58('0x4'));var rimraf=require('rimraf');var config=require(_0x2e58('0x5'));var attributes=require(_0x2e58('0x6'));module[_0x2e58('0x7')]=function(_0x331ceb,_0x272cee){return _0x331ceb['define'](_0x2e58('0x8'),attributes,{'tableName':_0x2e58('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e58('0xa'),'collate':_0x2e58('0xb')});}; \ No newline at end of file +var _0x3660=['path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2fba0c,_0x2cf2c0){var _0x263a96=function(_0x895beb){while(--_0x895beb){_0x2fba0c['push'](_0x2fba0c['shift']());}};_0x263a96(++_0x2cf2c0);}(_0x3660,0x91));var _0x0366=function(_0x2e879b,_0x3566a7){_0x2e879b=_0x2e879b-0x0;var _0x44c34b=_0x3660[_0x2e879b];return _0x44c34b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0366('0x0'))(_0x0366('0x1'));var moment=require(_0x0366('0x2'));var BPromise=require(_0x0366('0x3'));var rp=require(_0x0366('0x4'));var fs=require('fs');var path=require(_0x0366('0x5'));var rimraf=require(_0x0366('0x6'));var config=require(_0x0366('0x7'));var attributes=require(_0x0366('0x8'));module[_0x0366('0x9')]=function(_0x34c6c4,_0x5de9ab){return _0x34c6c4[_0x0366('0xa')](_0x0366('0xb'),attributes,{'tableName':_0x0366('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0366('0xd'),'collate':_0x0366('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e148a37..a4db9b3 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 _0xa654=['rpc','jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xa654,0x188));var _0x4a65=function(_0x53ce6c,_0x577044){_0x53ce6c=_0x53ce6c-0x0;var _0x4e66ce=_0xa654[_0x53ce6c];return _0x4e66ce;};'use strict';var _=require(_0x4a65('0x0'));var util=require(_0x4a65('0x1'));var moment=require(_0x4a65('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a65('0x4'))['db'];var utils=require(_0x4a65('0x5'));var logger=require(_0x4a65('0x6'))(_0x4a65('0x7'));var config=require('../../config/environment');var jayson=require(_0x4a65('0x8'));var client=jayson['client'][_0x4a65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c132e,_0x28a9d6,_0x3689fe){return new BPromise(function(_0x49bc2f,_0x32812c){return client['request'](_0x3c132e,_0x3689fe)[_0x4a65('0xa')](function(_0x264c4b){logger[_0x4a65('0xb')](_0x4a65('0xc'),_0x28a9d6,_0x4a65('0xd'));logger[_0x4a65('0xe')](_0x4a65('0xf'),_0x28a9d6,_0x4a65('0xd'),JSON[_0x4a65('0x10')](_0x264c4b));if(_0x264c4b[_0x4a65('0x11')]){if(_0x264c4b[_0x4a65('0x11')][_0x4a65('0x12')]===0x1f4){logger['error'](_0x4a65('0xc'),_0x28a9d6,_0x264c4b[_0x4a65('0x11')][_0x4a65('0x13')]);return _0x32812c(_0x264c4b[_0x4a65('0x11')][_0x4a65('0x13')]);}logger[_0x4a65('0x11')]('ChatApplication,\x20%s,\x20%s',_0x28a9d6,_0x264c4b[_0x4a65('0x11')][_0x4a65('0x13')]);return _0x49bc2f(_0x264c4b[_0x4a65('0x11')][_0x4a65('0x13')]);}else{logger[_0x4a65('0xb')](_0x4a65('0xc'),_0x28a9d6,_0x4a65('0xd'));_0x49bc2f(_0x264c4b['result']['message']);}})[_0x4a65('0x14')](function(_0x31ad69){logger[_0x4a65('0x11')]('ChatApplication,\x20%s,\x20%s',_0x28a9d6,_0x31ad69);_0x32812c(_0x31ad69);});});} \ No newline at end of file +var _0x0314=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3f969a,_0x3cd782){var _0x3b39b7=function(_0x484413){while(--_0x484413){_0x3f969a['push'](_0x3f969a['shift']());}};_0x3b39b7(++_0x3cd782);}(_0x0314,0x15c));var _0x4031=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4031('0x0'));var util=require(_0x4031('0x1'));var moment=require(_0x4031('0x2'));var BPromise=require('bluebird');var rs=require(_0x4031('0x3'));var fs=require('fs');var Redis=require(_0x4031('0x4'));var db=require(_0x4031('0x5'))['db'];var utils=require(_0x4031('0x6'));var logger=require(_0x4031('0x7'))(_0x4031('0x8'));var config=require(_0x4031('0x9'));var jayson=require(_0x4031('0xa'));var client=jayson[_0x4031('0xb')][_0x4031('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x529b39,_0xfbb59b,_0x5b0bfe){return new BPromise(function(_0x9824ef,_0x1d0262){return client['request'](_0x529b39,_0x5b0bfe)['then'](function(_0x49d46e){logger['info'](_0x4031('0xd'),_0xfbb59b,_0x4031('0xe'));logger[_0x4031('0xf')](_0x4031('0x10'),_0xfbb59b,'request\x20sent',JSON[_0x4031('0x11')](_0x49d46e));if(_0x49d46e[_0x4031('0x12')]){if(_0x49d46e[_0x4031('0x12')]['code']===0x1f4){logger[_0x4031('0x12')](_0x4031('0xd'),_0xfbb59b,_0x49d46e[_0x4031('0x12')][_0x4031('0x13')]);return _0x1d0262(_0x49d46e[_0x4031('0x12')][_0x4031('0x13')]);}logger[_0x4031('0x12')]('ChatApplication,\x20%s,\x20%s',_0xfbb59b,_0x49d46e['error'][_0x4031('0x13')]);return _0x9824ef(_0x49d46e['error'][_0x4031('0x13')]);}else{logger[_0x4031('0x14')](_0x4031('0xd'),_0xfbb59b,_0x4031('0xe'));_0x9824ef(_0x49d46e[_0x4031('0x15')][_0x4031('0x13')]);}})[_0x4031('0x16')](function(_0x21e9e0){logger[_0x4031('0x12')](_0x4031('0xd'),_0xfbb59b,_0x21e9e0);_0x1d0262(_0x21e9e0);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1954ab6..da5f6b2 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 _0xb88d=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','show','put'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb88d,0x6b));var _0xdb88=function(_0x3f81f2,_0x580577){_0x3f81f2=_0x3f81f2-0x0;var _0x3060d6=_0xb88d[_0x3f81f2];return _0x3060d6;};'use strict';var multer=require(_0xdb88('0x0'));var util=require(_0xdb88('0x1'));var path=require('path');var timeout=require(_0xdb88('0x2'));var express=require(_0xdb88('0x3'));var router=express[_0xdb88('0x4')]();var auth=require(_0xdb88('0x5'));var interaction=require(_0xdb88('0x6'));var config=require('../../config/environment');var controller=require(_0xdb88('0x7'));router[_0xdb88('0x8')](_0xdb88('0x9'),auth['isAuthenticated'](),controller[_0xdb88('0xa')]);router[_0xdb88('0xb')]('/:id',auth[_0xdb88('0xc')](),controller[_0xdb88('0xd')]);router[_0xdb88('0xe')](_0xdb88('0x9'),auth[_0xdb88('0xc')](),controller[_0xdb88('0xf')]);module[_0xdb88('0x10')]=router; \ No newline at end of file +var _0x9436=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','show','delete','isAuthenticated','destroy'];(function(_0x43218c,_0x2112e4){var _0x5d6a69=function(_0x13187b){while(--_0x13187b){_0x43218c['push'](_0x43218c['shift']());}};_0x5d6a69(++_0x2112e4);}(_0x9436,0x16c));var _0x6943=function(_0x5803d4,_0x54a45a){_0x5803d4=_0x5803d4-0x0;var _0x1e4d78=_0x9436[_0x5803d4];return _0x1e4d78;};'use strict';var multer=require(_0x6943('0x0'));var util=require(_0x6943('0x1'));var path=require(_0x6943('0x2'));var timeout=require(_0x6943('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6943('0x4'));var interaction=require(_0x6943('0x5'));var config=require('../../config/environment');var controller=require(_0x6943('0x6'));router[_0x6943('0x7')](_0x6943('0x8'),auth['isAuthenticated'](),controller[_0x6943('0x9')]);router['put'](_0x6943('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x6943('0xa')](_0x6943('0x8'),auth[_0x6943('0xb')](),controller[_0x6943('0xc')]);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 a26421b..9ee11b2 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 _0xc1d2=['BOOLEAN','sequelize','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc1d2,0x1e1));var _0x2c1d=function(_0x1f38df,_0x1a66e9){_0x1f38df=_0x1f38df-0x0;var _0x312cc9=_0xc1d2[_0x1f38df];return _0x312cc9;};'use strict';var Sequelize=require(_0x2c1d('0x0'));module[_0x2c1d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x2c1d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3efd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x56c880,_0x1f6dab){var _0x57f803=function(_0x2bff9a){while(--_0x2bff9a){_0x56c880['push'](_0x56c880['shift']());}};_0x57f803(++_0x1f6dab);}(_0x3efd,0x1a9));var _0xd3ef=function(_0x573c87,_0x52e7c5){_0x573c87=_0x573c87-0x0;var _0x4a4ac5=_0x3efd[_0x573c87];return _0x4a4ac5;};'use strict';var Sequelize=require(_0xd3ef('0x0'));module[_0xd3ef('0x1')]={'name':{'type':Sequelize[_0xd3ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd3ef('0x2')]},'write':{'type':Sequelize[_0xd3ef('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 698c043..7231710 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 _0xdfcc=['length','hasOwnProperty','sort','filters','pick','filter','merge','map','VIRTUAL','field','where','includeAll','findAll','show','params','include','options','find','catch','create','body','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','User','order','nolimit','getMembers','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','./chatGroup.socket','register','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','index','ChatGroup','rawAttributes','model','keys','query','intersection','attributes','fields'];(function(_0x37df92,_0x176788){var _0x2af5a6=function(_0xb8edc3){while(--_0xb8edc3){_0x37df92['push'](_0x37df92['shift']());}};_0x2af5a6(++_0x176788);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xdfcc[_0x3e8270];return _0x1ccde9;};'use strict';var pdf=require(_0xcdfc('0x0'));var emlformat=require(_0xcdfc('0x1'));var rimraf=require(_0xcdfc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdfc('0x3'));var rp=require(_0xcdfc('0x4'));var moment=require(_0xcdfc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcdfc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcdfc('0x7'));var ejs=require(_0xcdfc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcdfc('0x9'));var crypto=require(_0xcdfc('0xa'));var jsforce=require(_0xcdfc('0xb'));var deskjs=require(_0xcdfc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcdfc('0xd'));var Papa=require('papaparse');var Redis=require(_0xcdfc('0xe'));var authService=require(_0xcdfc('0xf'));var qs=require(_0xcdfc('0x10'));var hardwareService=require(_0xcdfc('0x11'));var logger=require(_0xcdfc('0x12'))(_0xcdfc('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcdfc('0x14'))['db'];config[_0xcdfc('0x15')]=_['defaults'](config[_0xcdfc('0x15')],{'host':_0xcdfc('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdfc('0x15')]));require(_0xcdfc('0x17'))[_0xcdfc('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcdfc('0x19')][_0xcdfc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x55a814,_0x422342,_0x2cbc4c){if(_0x2cbc4c){var _0x1e2282=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e2282['test'](_0x422342)){return _0x55a814;}else{throw new Error(_0xcdfc('0x1b'));}}else{return _0x55a814;}}function respondWithRpcPromise(_0x1a8095,_0x48f497,_0x375ae5,_0x19f868){return new BPromise(function(_0x51ab72,_0x16a9a3){var _0x446b6a=_0x19f868||client;return _0x446b6a[_0xcdfc('0x1c')](_0x1a8095,_0x375ae5)['then'](function(_0x2ebfae){logger[_0xcdfc('0x1d')]('ChatGroup,\x20%s,\x20%s',_0x48f497,_0xcdfc('0x1e'));logger[_0xcdfc('0x1f')](_0xcdfc('0x20'),_0x48f497,_0xcdfc('0x1e'),JSON[_0xcdfc('0x21')](_0x2ebfae));if(_0x2ebfae[_0xcdfc('0x22')]){if(_0x2ebfae['error'][_0xcdfc('0x23')]===0x1f4){logger['error'](_0xcdfc('0x24'),_0x48f497,_0x2ebfae[_0xcdfc('0x22')][_0xcdfc('0x25')]);return _0x16a9a3(_0x2ebfae[_0xcdfc('0x22')]['message']);}logger[_0xcdfc('0x22')](_0xcdfc('0x24'),_0x48f497,_0x2ebfae[_0xcdfc('0x22')][_0xcdfc('0x25')]);return _0x51ab72(_0x2ebfae[_0xcdfc('0x22')][_0xcdfc('0x25')]);}else{logger[_0xcdfc('0x1d')](_0xcdfc('0x24'),_0x48f497,_0xcdfc('0x1e'));_0x51ab72(_0x2ebfae[_0xcdfc('0x26')][_0xcdfc('0x25')]);}})['catch'](function(_0x323fd5){logger['error'](_0xcdfc('0x24'),_0x48f497,_0x323fd5);_0x16a9a3(_0x323fd5);});});}function respondWithStatusCode(_0x2e8623,_0x762f0e){_0x762f0e=_0x762f0e||0xcc;return function(_0x28d4bc){if(_0x28d4bc){return _0x2e8623[_0xcdfc('0x27')](_0x762f0e);}return _0x2e8623[_0xcdfc('0x28')](_0x762f0e)[_0xcdfc('0x29')]();};}function respondWithResult(_0x5380cd,_0x48827a){_0x48827a=_0x48827a||0xc8;return function(_0x35809e){if(_0x35809e){return _0x5380cd[_0xcdfc('0x28')](_0x48827a)[_0xcdfc('0x2a')](_0x35809e);}};}function respondWithFilteredResult(_0xaf2735,_0x5a0b09){return function(_0xc571e3){if(_0xc571e3){var _0x28e7f0=_0xc571e3[_0xcdfc('0x2b')],_0x5561bd=_0x5a0b09[_0xcdfc('0x2c')],_0x5b19e2=_0x5a0b09['offset']+_0x5a0b09[_0xcdfc('0x2d')],_0x29cc4e;if(_0x5b19e2>=_0x28e7f0){_0x5b19e2=_0x28e7f0;_0x29cc4e=0xc8;}else{_0x29cc4e=0xce;}_0xaf2735[_0xcdfc('0x28')](_0x29cc4e);return _0xaf2735[_0xcdfc('0x2e')](_0xcdfc('0x2f'),_0x5561bd+'-'+_0x5b19e2+'/'+_0x28e7f0)['json'](_0xc571e3);}return null;};}function patchUpdates(_0x36c82d){return function(_0x51c461){try{jsonpatch['apply'](_0x51c461,_0x36c82d,!![]);}catch(_0x1072b4){return BPromise[_0xcdfc('0x30')](_0x1072b4);}return _0x51c461['save']();};}function saveUpdates(_0x5818d6,_0x2e51b8){return function(_0x4cf21a){if(_0x4cf21a){return _0x4cf21a[_0xcdfc('0x31')](_0x5818d6)[_0xcdfc('0x32')](function(_0x3a3357){return _0x3a3357;});}return null;};}function removeEntity(_0x5cabd5,_0x40ab45){return function(_0x36e0b3){if(_0x36e0b3){return _0x36e0b3[_0xcdfc('0x33')]()[_0xcdfc('0x32')](function(){_0x5cabd5[_0xcdfc('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268e64,_0x80032f){return function(_0x1d99f5){if(!_0x1d99f5){_0x268e64[_0xcdfc('0x27')](0x194);}return _0x1d99f5;};}function handleError(_0x408c28,_0x44eb1a){_0x44eb1a=_0x44eb1a||0x1f4;return function(_0x22237e){logger[_0xcdfc('0x22')](_0x22237e[_0xcdfc('0x34')]);if(_0x22237e[_0xcdfc('0x35')]){delete _0x22237e[_0xcdfc('0x35')];}_0x408c28[_0xcdfc('0x28')](_0x44eb1a)['send'](_0x22237e);};}exports[_0xcdfc('0x36')]=function(_0xcb460,_0x1277fa){var _0x144754={},_0x2ad049={},_0x5b0e80={'count':0x0,'rows':[]};var _0xa70212=db[_0xcdfc('0x37')][_0xcdfc('0x38')];_0x2ad049[_0xcdfc('0x39')]=_[_0xcdfc('0x3a')](_0xa70212);_0x2ad049['query']=_[_0xcdfc('0x3a')](_0xcb460[_0xcdfc('0x3b')]);_0x2ad049['filters']=_[_0xcdfc('0x3c')](_0x2ad049[_0xcdfc('0x39')],_0x2ad049[_0xcdfc('0x3b')]);_0x144754[_0xcdfc('0x3d')]=_['intersection'](_0x2ad049['model'],qs['fields'](_0xcb460[_0xcdfc('0x3b')][_0xcdfc('0x3e')]));_0x144754['attributes']=_0x144754[_0xcdfc('0x3d')][_0xcdfc('0x3f')]?_0x144754[_0xcdfc('0x3d')]:_0x2ad049[_0xcdfc('0x39')];if(!_0xcb460['query'][_0xcdfc('0x40')]('nolimit')){_0x144754[_0xcdfc('0x2d')]=qs[_0xcdfc('0x2d')](_0xcb460[_0xcdfc('0x3b')][_0xcdfc('0x2d')]);_0x144754['offset']=qs[_0xcdfc('0x2c')](_0xcb460[_0xcdfc('0x3b')]['offset']);}_0x144754['order']=qs[_0xcdfc('0x41')](_0xcb460[_0xcdfc('0x3b')][_0xcdfc('0x41')]);_0x144754['where']=qs[_0xcdfc('0x42')](_[_0xcdfc('0x43')](_0xcb460[_0xcdfc('0x3b')],_0x2ad049[_0xcdfc('0x42')]));if(_0xcb460[_0xcdfc('0x3b')][_0xcdfc('0x44')]){_0x144754['where']=_[_0xcdfc('0x45')](_0x144754['where'],{'$or':_[_0xcdfc('0x46')](_0xa70212,function(_0x3ab33b){if(_0x3ab33b['type']['key']!==_0xcdfc('0x47')){var _0x542ec4={};_0x542ec4[_0x3ab33b[_0xcdfc('0x48')]]={'$like':'%'+_0xcb460[_0xcdfc('0x3b')][_0xcdfc('0x44')]+'%'};return _0x542ec4;}})});}_0x144754=_[_0xcdfc('0x45')]({},_0x144754,_0xcb460['options']);var _0x26b300={'where':_0x144754[_0xcdfc('0x49')]};return db[_0xcdfc('0x37')][_0xcdfc('0x2b')](_0x26b300)[_0xcdfc('0x32')](function(_0x3bf9d9){_0x5b0e80[_0xcdfc('0x2b')]=_0x3bf9d9;if(_0xcb460[_0xcdfc('0x3b')][_0xcdfc('0x4a')]){_0x144754['include']=[{'all':!![]}];}return db[_0xcdfc('0x37')][_0xcdfc('0x4b')](_0x144754);})[_0xcdfc('0x32')](function(_0x4da984){_0x5b0e80['rows']=_0x4da984;return _0x5b0e80;})[_0xcdfc('0x32')](respondWithFilteredResult(_0x1277fa,_0x144754))['catch'](handleError(_0x1277fa,null));};exports[_0xcdfc('0x4c')]=function(_0x2a4c25,_0x4f2a39){var _0x536b93={'raw':!![],'where':{'id':_0x2a4c25[_0xcdfc('0x4d')]['id']}},_0x15186c={};_0x15186c[_0xcdfc('0x39')]=_[_0xcdfc('0x3a')](db[_0xcdfc('0x37')][_0xcdfc('0x38')]);_0x15186c[_0xcdfc('0x3b')]=_['keys'](_0x2a4c25[_0xcdfc('0x3b')]);_0x15186c[_0xcdfc('0x42')]=_['intersection'](_0x15186c[_0xcdfc('0x39')],_0x15186c[_0xcdfc('0x3b')]);_0x536b93[_0xcdfc('0x3d')]=_[_0xcdfc('0x3c')](_0x15186c[_0xcdfc('0x39')],qs[_0xcdfc('0x3e')](_0x2a4c25['query']['fields']));_0x536b93['attributes']=_0x536b93[_0xcdfc('0x3d')]['length']?_0x536b93['attributes']:_0x15186c['model'];if(_0x2a4c25[_0xcdfc('0x3b')]['includeAll']){_0x536b93[_0xcdfc('0x4e')]=[{'all':!![]}];}_0x536b93=_['merge']({},_0x536b93,_0x2a4c25[_0xcdfc('0x4f')]);return db[_0xcdfc('0x37')][_0xcdfc('0x50')](_0x536b93)[_0xcdfc('0x32')](handleEntityNotFound(_0x4f2a39,null))[_0xcdfc('0x32')](respondWithResult(_0x4f2a39,null))[_0xcdfc('0x51')](handleError(_0x4f2a39,null));};exports['create']=function(_0x1b44bc,_0x5244df){return db[_0xcdfc('0x37')][_0xcdfc('0x52')](_0x1b44bc['body'],{})[_0xcdfc('0x32')](respondWithResult(_0x5244df,0xc9))[_0xcdfc('0x51')](handleError(_0x5244df,null));};exports[_0xcdfc('0x31')]=function(_0x5bcbe2,_0xf46b3f){if(_0x5bcbe2[_0xcdfc('0x53')]['id']){delete _0x5bcbe2[_0xcdfc('0x53')]['id'];}return db['ChatGroup'][_0xcdfc('0x50')]({'where':{'id':_0x5bcbe2[_0xcdfc('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf46b3f,null))[_0xcdfc('0x32')](saveUpdates(_0x5bcbe2['body'],null))[_0xcdfc('0x32')](respondWithResult(_0xf46b3f,null))[_0xcdfc('0x51')](handleError(_0xf46b3f,null));};exports['destroy']=function(_0x1a23a6,_0x2274e7){return db[_0xcdfc('0x37')][_0xcdfc('0x50')]({'where':{'id':_0x1a23a6[_0xcdfc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2274e7,null))['then'](removeEntity(_0x2274e7,null))[_0xcdfc('0x51')](handleError(_0x2274e7,null));};exports[_0xcdfc('0x54')]=function(_0x3024e1,_0x24e3f0){return db['ChatGroup'][_0xcdfc('0x54')]()[_0xcdfc('0x32')](respondWithResult(_0x24e3f0,null))[_0xcdfc('0x51')](handleError(_0x24e3f0,null));};exports['getUnread']=function(_0x1ef6c2,_0x175c76,_0x5d9702){return db[_0xcdfc('0x55')][_0xcdfc('0x2b')]({'where':{'ChatGroupId':_0x1ef6c2['params']['id'],'ToId':_0x1ef6c2['user']['id'],'read':![]}})[_0xcdfc('0x32')](function(_0x54d458){return{'id':_[_0xcdfc('0x56')](_0x1ef6c2['params']['id']),'count':_0x54d458};})['then'](respondWithResult(_0x175c76,null))[_0xcdfc('0x51')](handleError(_0x175c76,null));};exports[_0xcdfc('0x57')]=function(_0x10ba1a,_0x1ae878,_0x142690){return db[_0xcdfc('0x37')]['find']({'where':{'id':_0x10ba1a[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x32')](handleEntityNotFound(_0x1ae878,null))['then'](function(_0x45bd78){if(_0x45bd78){return _0x45bd78[_0xcdfc('0x57')](_0x10ba1a['body'][_0xcdfc('0x58')],_[_0xcdfc('0x59')](_0x10ba1a[_0xcdfc('0x53')],[_0xcdfc('0x58'),'id'])||{});}})[_0xcdfc('0x32')](respondWithResult(_0x1ae878,null))['catch'](handleError(_0x1ae878,null));};exports['getMembers']=function(_0x202887,_0xdf4827,_0x746d95){var _0x29b0c8={};var _0x25ff18={};var _0x30588b;var _0x3dba35;return db['ChatGroup'][_0xcdfc('0x5a')]({'where':{'id':_0x202887['params']['id']}})[_0xcdfc('0x32')](handleEntityNotFound(_0xdf4827,null))[_0xcdfc('0x32')](function(_0x24583f){if(_0x24583f){_0x30588b=_0x24583f;_0x25ff18['model']=_[_0xcdfc('0x3a')](db[_0xcdfc('0x5b')][_0xcdfc('0x38')]);_0x25ff18[_0xcdfc('0x3b')]=_[_0xcdfc('0x3a')](_0x202887['query']);_0x25ff18['filters']=_['intersection'](_0x25ff18['model'],_0x25ff18[_0xcdfc('0x3b')]);_0x29b0c8[_0xcdfc('0x3d')]=_[_0xcdfc('0x3c')](_0x25ff18[_0xcdfc('0x39')],qs[_0xcdfc('0x3e')](_0x202887[_0xcdfc('0x3b')][_0xcdfc('0x3e')]));_0x29b0c8[_0xcdfc('0x3d')]=_0x29b0c8[_0xcdfc('0x3d')][_0xcdfc('0x3f')]?_0x29b0c8[_0xcdfc('0x3d')]:_0x25ff18[_0xcdfc('0x39')];_0x29b0c8[_0xcdfc('0x5c')]=qs[_0xcdfc('0x41')](_0x202887[_0xcdfc('0x3b')][_0xcdfc('0x41')]);_0x29b0c8[_0xcdfc('0x49')]=qs[_0xcdfc('0x42')](_['pick'](_0x202887[_0xcdfc('0x3b')],_0x25ff18[_0xcdfc('0x42')]));if(_0x202887[_0xcdfc('0x3b')]['filter']){_0x29b0c8[_0xcdfc('0x49')]=_[_0xcdfc('0x45')](_0x29b0c8[_0xcdfc('0x49')],{'$or':_[_0xcdfc('0x46')](_0x29b0c8[_0xcdfc('0x3d')],function(_0xc6d67b){var _0x26f65d={};_0x26f65d[_0xc6d67b]={'$like':'%'+_0x202887[_0xcdfc('0x3b')][_0xcdfc('0x44')]+'%'};return _0x26f65d;})});}_0x29b0c8=_[_0xcdfc('0x45')]({},_0x29b0c8,_0x202887[_0xcdfc('0x4f')]);return _0x30588b['getMembers'](_0x29b0c8);}})[_0xcdfc('0x32')](function(_0x1b06ed){if(_0x1b06ed){_0x3dba35=_0x1b06ed[_0xcdfc('0x3f')];if(!_0x202887[_0xcdfc('0x3b')]['hasOwnProperty'](_0xcdfc('0x5d'))){_0x29b0c8[_0xcdfc('0x2d')]=qs[_0xcdfc('0x2d')](_0x202887['query'][_0xcdfc('0x2d')]);_0x29b0c8['offset']=qs[_0xcdfc('0x2c')](_0x202887[_0xcdfc('0x3b')][_0xcdfc('0x2c')]);}return _0x30588b[_0xcdfc('0x5e')](_0x29b0c8);}})[_0xcdfc('0x32')](function(_0x59395f){if(_0x59395f){return _0x59395f?{'count':_0x3dba35,'rows':_0x59395f}:null;}})[_0xcdfc('0x32')](respondWithResult(_0xdf4827,null))[_0xcdfc('0x51')](handleError(_0xdf4827,null));};exports[_0xcdfc('0x5f')]=function(_0x5d29d5,_0xd365fa,_0x260242){return db[_0xcdfc('0x37')][_0xcdfc('0x50')]({'where':{'id':_0x5d29d5['params']['id']}})[_0xcdfc('0x32')](handleEntityNotFound(_0xd365fa,null))[_0xcdfc('0x32')](function(_0x10ff82){if(_0x10ff82){return _0x10ff82[_0xcdfc('0x5f')](_0x5d29d5[_0xcdfc('0x3b')][_0xcdfc('0x58')]);}})[_0xcdfc('0x32')](respondWithStatusCode(_0xd365fa,null))['catch'](handleError(_0xd365fa,null));};exports['addMessage']=function(_0x37fe10,_0x2296e0,_0x11c629){if(_0x37fe10['body']['id']){delete _0x37fe10['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x37fe10[_0xcdfc('0x4d')]['id']}})[_0xcdfc('0x32')](handleEntityNotFound(_0x2296e0,null))[_0xcdfc('0x32')](function(_0x186cde){if(_0x186cde){_0x37fe10[_0xcdfc('0x53')][_0xcdfc('0x60')]=_0x186cde['id'];return db[_0xcdfc('0x55')][_0xcdfc('0x52')](_0x37fe10[_0xcdfc('0x53')]);}})[_0xcdfc('0x32')](respondWithResult(_0x2296e0,null))[_0xcdfc('0x51')](handleError(_0x2296e0,null));};exports[_0xcdfc('0x61')]=function(_0x320cd0,_0x2ef9b9,_0x203162){var _0x34d51c={};var _0x3ae32f={};var _0xa2c8a7;var _0x516d7c;return db['ChatGroup'][_0xcdfc('0x5a')]({'where':{'id':_0x320cd0[_0xcdfc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ef9b9,null))[_0xcdfc('0x32')](function(_0x103d8c){if(_0x103d8c){_0xa2c8a7=_0x103d8c;_0x3ae32f['model']=_[_0xcdfc('0x3a')](db[_0xcdfc('0x55')][_0xcdfc('0x38')]);_0x3ae32f[_0xcdfc('0x3b')]=_['keys'](_0x320cd0[_0xcdfc('0x3b')]);_0x3ae32f[_0xcdfc('0x42')]=_[_0xcdfc('0x3c')](_0x3ae32f[_0xcdfc('0x39')],_0x3ae32f[_0xcdfc('0x3b')]);_0x34d51c[_0xcdfc('0x3d')]=_[_0xcdfc('0x3c')](_0x3ae32f[_0xcdfc('0x39')],qs['fields'](_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x3e')]));_0x34d51c[_0xcdfc('0x3d')]=_0x34d51c[_0xcdfc('0x3d')][_0xcdfc('0x3f')]?_0x34d51c['attributes']:_0x3ae32f['model'];_0x34d51c[_0xcdfc('0x5c')]=qs[_0xcdfc('0x41')](_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x41')]);_0x34d51c[_0xcdfc('0x49')]=qs[_0xcdfc('0x42')](_[_0xcdfc('0x43')](_0x320cd0[_0xcdfc('0x3b')],_0x3ae32f[_0xcdfc('0x42')]));if(_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x44')]){_0x34d51c[_0xcdfc('0x49')]=_['merge'](_0x34d51c['where'],{'$or':_[_0xcdfc('0x46')](_0x34d51c[_0xcdfc('0x3d')],function(_0x488e56){var _0x4c84ec={};_0x4c84ec[_0x488e56]={'$like':'%'+_0x320cd0['query'][_0xcdfc('0x44')]+'%'};return _0x4c84ec;})});}if(_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x62')]){var _0x5b5411=_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x62')][_0xcdfc('0x63')](',');var _0x3b2a92={};_0x3b2a92[_0x5b5411[0x0]]={'$gte':moment(_0x5b5411[0x1])[_0xcdfc('0x64')](_0xcdfc('0x65'))};_0x34d51c['where']=_[_0xcdfc('0x45')](_0x34d51c['where'],_0x3b2a92);}_0x34d51c=_[_0xcdfc('0x45')]({},_0x34d51c,_0x320cd0[_0xcdfc('0x4f')]);return _0xa2c8a7[_0xcdfc('0x61')](_0x34d51c);}})[_0xcdfc('0x32')](function(_0x275559){if(_0x275559){_0x516d7c=_0x275559[_0xcdfc('0x3f')];if(!_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x40')](_0xcdfc('0x5d'))){_0x34d51c[_0xcdfc('0x2d')]=qs[_0xcdfc('0x2d')](_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x2d')]);_0x34d51c[_0xcdfc('0x2c')]=qs[_0xcdfc('0x2c')](_0x320cd0[_0xcdfc('0x3b')][_0xcdfc('0x2c')]);}return _0xa2c8a7[_0xcdfc('0x61')](_0x34d51c);}})[_0xcdfc('0x32')](function(_0x5dda73){if(_0x5dda73){return _0x5dda73?{'count':_0x516d7c,'rows':_0x5dda73}:null;}})[_0xcdfc('0x32')](respondWithResult(_0x2ef9b9,null))[_0xcdfc('0x51')](handleError(_0x2ef9b9,null));}; \ No newline at end of file +var _0x1ae3=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','stack','name','send','index','rawAttributes','query','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','map','type','VIRTUAL','options','ChatGroup','includeAll','findAll','rows','catch','show','keys','include','find','create','update','body','params','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','addMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1ee799,_0x835559){var _0x1df95d=function(_0x2b95d7){while(--_0x2b95d7){_0x1ee799['push'](_0x1ee799['shift']());}};_0x1df95d(++_0x835559);}(_0x1ae3,0x139));var _0x31ae=function(_0x52bff1,_0x36f48f){_0x52bff1=_0x52bff1-0x0;var _0x7d406e=_0x1ae3[_0x52bff1];return _0x7d406e;};'use strict';var pdf=require(_0x31ae('0x0'));var emlformat=require(_0x31ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31ae('0x2'));var jsonpatch=require(_0x31ae('0x3'));var rp=require(_0x31ae('0x4'));var moment=require(_0x31ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31ae('0x6'));var util=require(_0x31ae('0x7'));var path=require(_0x31ae('0x8'));var sox=require(_0x31ae('0x9'));var csv=require(_0x31ae('0xa'));var ejs=require(_0x31ae('0xb'));var fs=require('fs');var _=require(_0x31ae('0xc'));var squel=require(_0x31ae('0xd'));var crypto=require(_0x31ae('0xe'));var jsforce=require(_0x31ae('0xf'));var deskjs=require(_0x31ae('0x10'));var toCsv=require(_0x31ae('0xa'));var querystring=require(_0x31ae('0x11'));var Papa=require(_0x31ae('0x12'));var Redis=require(_0x31ae('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31ae('0x14'));var hardwareService=require(_0x31ae('0x15'));var logger=require(_0x31ae('0x16'))('api');var utils=require(_0x31ae('0x17'));var config=require(_0x31ae('0x18'));var db=require('../../mysqldb')['db'];config[_0x31ae('0x19')]=_['defaults'](config[_0x31ae('0x19')],{'host':_0x31ae('0x1a'),'port':0x18eb});var socket=require(_0x31ae('0x1b'))(new Redis(config['redis']));require(_0x31ae('0x1c'))[_0x31ae('0x1d')](socket);var jayson=require(_0x31ae('0x1e'));var client=jayson[_0x31ae('0x1f')][_0x31ae('0x20')]({'port':0x232a});function checkPasswordPattern(_0x273c94,_0x48963a,_0x331134){if(_0x331134){var _0x11abd4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11abd4[_0x31ae('0x21')](_0x48963a)){return _0x273c94;}else{throw new Error(_0x31ae('0x22'));}}else{return _0x273c94;}}function respondWithRpcPromise(_0x1fc2cf,_0x2449ea,_0x25be89,_0x379c51){return new BPromise(function(_0x5aa824,_0xcd30cc){var _0x58d574=_0x379c51||client;return _0x58d574[_0x31ae('0x23')](_0x1fc2cf,_0x25be89)[_0x31ae('0x24')](function(_0x4716f7){logger[_0x31ae('0x25')](_0x31ae('0x26'),_0x2449ea,_0x31ae('0x27'));logger[_0x31ae('0x28')](_0x31ae('0x29'),_0x2449ea,_0x31ae('0x27'),JSON[_0x31ae('0x2a')](_0x4716f7));if(_0x4716f7[_0x31ae('0x2b')]){if(_0x4716f7[_0x31ae('0x2b')]['code']===0x1f4){logger[_0x31ae('0x2b')](_0x31ae('0x26'),_0x2449ea,_0x4716f7[_0x31ae('0x2b')][_0x31ae('0x2c')]);return _0xcd30cc(_0x4716f7['error'][_0x31ae('0x2c')]);}logger[_0x31ae('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x2449ea,_0x4716f7[_0x31ae('0x2b')]['message']);return _0x5aa824(_0x4716f7[_0x31ae('0x2b')]['message']);}else{logger['info'](_0x31ae('0x26'),_0x2449ea,_0x31ae('0x27'));_0x5aa824(_0x4716f7[_0x31ae('0x2d')]['message']);}})['catch'](function(_0x4c0246){logger[_0x31ae('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x2449ea,_0x4c0246);_0xcd30cc(_0x4c0246);});});}function respondWithStatusCode(_0x43ca3d,_0x2b5230){_0x2b5230=_0x2b5230||0xcc;return function(_0xf49658){if(_0xf49658){return _0x43ca3d[_0x31ae('0x2e')](_0x2b5230);}return _0x43ca3d[_0x31ae('0x2f')](_0x2b5230)[_0x31ae('0x30')]();};}function respondWithResult(_0x225172,_0x16ea63){_0x16ea63=_0x16ea63||0xc8;return function(_0x54676f){if(_0x54676f){return _0x225172[_0x31ae('0x2f')](_0x16ea63)[_0x31ae('0x31')](_0x54676f);}};}function respondWithFilteredResult(_0x1681ab,_0x2000aa){return function(_0x5e4a09){if(_0x5e4a09){var _0x14f472=_0x5e4a09[_0x31ae('0x32')],_0x418d59=_0x2000aa[_0x31ae('0x33')],_0x28f439=_0x2000aa[_0x31ae('0x33')]+_0x2000aa['limit'],_0x2c278b;if(_0x28f439>=_0x14f472){_0x28f439=_0x14f472;_0x2c278b=0xc8;}else{_0x2c278b=0xce;}_0x1681ab['status'](_0x2c278b);return _0x1681ab[_0x31ae('0x34')]('Content-Range',_0x418d59+'-'+_0x28f439+'/'+_0x14f472)[_0x31ae('0x31')](_0x5e4a09);}return null;};}function patchUpdates(_0x3d7e2e){return function(_0x523e4e){try{jsonpatch[_0x31ae('0x35')](_0x523e4e,_0x3d7e2e,!![]);}catch(_0x207e57){return BPromise[_0x31ae('0x36')](_0x207e57);}return _0x523e4e[_0x31ae('0x37')]();};}function saveUpdates(_0x4811d9,_0x21466d){return function(_0x130ee9){if(_0x130ee9){return _0x130ee9['update'](_0x4811d9)['then'](function(_0x50b12e){return _0x50b12e;});}return null;};}function removeEntity(_0x46ffb1,_0x3553e0){return function(_0x81bb53){if(_0x81bb53){return _0x81bb53[_0x31ae('0x38')]()[_0x31ae('0x24')](function(){_0x46ffb1['status'](0xcc)[_0x31ae('0x30')]();});}};}function handleEntityNotFound(_0x15063b,_0xd52a41){return function(_0x3506e0){if(!_0x3506e0){_0x15063b[_0x31ae('0x2e')](0x194);}return _0x3506e0;};}function handleError(_0x3d6c3c,_0x358e99){_0x358e99=_0x358e99||0x1f4;return function(_0x39c3b6){logger[_0x31ae('0x2b')](_0x39c3b6[_0x31ae('0x39')]);if(_0x39c3b6[_0x31ae('0x3a')]){delete _0x39c3b6[_0x31ae('0x3a')];}_0x3d6c3c['status'](_0x358e99)[_0x31ae('0x3b')](_0x39c3b6);};}exports[_0x31ae('0x3c')]=function(_0x4edd82,_0x4403bd){var _0x457dac={},_0x4a26b7={},_0x35cf5e={'count':0x0,'rows':[]};var _0x185d16=db['ChatGroup'][_0x31ae('0x3d')];_0x4a26b7['model']=_['keys'](_0x185d16);_0x4a26b7[_0x31ae('0x3e')]=_['keys'](_0x4edd82[_0x31ae('0x3e')]);_0x4a26b7['filters']=_['intersection'](_0x4a26b7[_0x31ae('0x3f')],_0x4a26b7[_0x31ae('0x3e')]);_0x457dac[_0x31ae('0x40')]=_[_0x31ae('0x41')](_0x4a26b7['model'],qs[_0x31ae('0x42')](_0x4edd82[_0x31ae('0x3e')][_0x31ae('0x42')]));_0x457dac[_0x31ae('0x40')]=_0x457dac[_0x31ae('0x40')][_0x31ae('0x43')]?_0x457dac['attributes']:_0x4a26b7['model'];if(!_0x4edd82[_0x31ae('0x3e')][_0x31ae('0x44')]('nolimit')){_0x457dac[_0x31ae('0x45')]=qs[_0x31ae('0x45')](_0x4edd82[_0x31ae('0x3e')][_0x31ae('0x45')]);_0x457dac[_0x31ae('0x33')]=qs[_0x31ae('0x33')](_0x4edd82['query'][_0x31ae('0x33')]);}_0x457dac[_0x31ae('0x46')]=qs[_0x31ae('0x47')](_0x4edd82['query'][_0x31ae('0x47')]);_0x457dac[_0x31ae('0x48')]=qs['filters'](_[_0x31ae('0x49')](_0x4edd82[_0x31ae('0x3e')],_0x4a26b7[_0x31ae('0x4a')]));if(_0x4edd82['query'][_0x31ae('0x4b')]){_0x457dac[_0x31ae('0x48')]=_[_0x31ae('0x4c')](_0x457dac['where'],{'$or':_[_0x31ae('0x4d')](_0x185d16,function(_0x382d6c){if(_0x382d6c[_0x31ae('0x4e')]['key']!==_0x31ae('0x4f')){var _0x124359={};_0x124359[_0x382d6c['field']]={'$like':'%'+_0x4edd82[_0x31ae('0x3e')][_0x31ae('0x4b')]+'%'};return _0x124359;}})});}_0x457dac=_[_0x31ae('0x4c')]({},_0x457dac,_0x4edd82[_0x31ae('0x50')]);var _0x344e52={'where':_0x457dac[_0x31ae('0x48')]};return db[_0x31ae('0x51')][_0x31ae('0x32')](_0x344e52)[_0x31ae('0x24')](function(_0x30f7f6){_0x35cf5e[_0x31ae('0x32')]=_0x30f7f6;if(_0x4edd82['query'][_0x31ae('0x52')]){_0x457dac['include']=[{'all':!![]}];}return db[_0x31ae('0x51')][_0x31ae('0x53')](_0x457dac);})[_0x31ae('0x24')](function(_0x23ebcb){_0x35cf5e[_0x31ae('0x54')]=_0x23ebcb;return _0x35cf5e;})[_0x31ae('0x24')](respondWithFilteredResult(_0x4403bd,_0x457dac))[_0x31ae('0x55')](handleError(_0x4403bd,null));};exports[_0x31ae('0x56')]=function(_0x2094a9,_0x454a4d){var _0x27c296={'raw':!![],'where':{'id':_0x2094a9['params']['id']}},_0x11f221={};_0x11f221[_0x31ae('0x3f')]=_[_0x31ae('0x57')](db[_0x31ae('0x51')][_0x31ae('0x3d')]);_0x11f221[_0x31ae('0x3e')]=_[_0x31ae('0x57')](_0x2094a9[_0x31ae('0x3e')]);_0x11f221[_0x31ae('0x4a')]=_[_0x31ae('0x41')](_0x11f221[_0x31ae('0x3f')],_0x11f221['query']);_0x27c296[_0x31ae('0x40')]=_['intersection'](_0x11f221[_0x31ae('0x3f')],qs['fields'](_0x2094a9[_0x31ae('0x3e')]['fields']));_0x27c296[_0x31ae('0x40')]=_0x27c296[_0x31ae('0x40')][_0x31ae('0x43')]?_0x27c296[_0x31ae('0x40')]:_0x11f221[_0x31ae('0x3f')];if(_0x2094a9[_0x31ae('0x3e')][_0x31ae('0x52')]){_0x27c296[_0x31ae('0x58')]=[{'all':!![]}];}_0x27c296=_['merge']({},_0x27c296,_0x2094a9[_0x31ae('0x50')]);return db[_0x31ae('0x51')][_0x31ae('0x59')](_0x27c296)[_0x31ae('0x24')](handleEntityNotFound(_0x454a4d,null))[_0x31ae('0x24')](respondWithResult(_0x454a4d,null))[_0x31ae('0x55')](handleError(_0x454a4d,null));};exports[_0x31ae('0x5a')]=function(_0x43cf96,_0x780eae){return db[_0x31ae('0x51')]['create'](_0x43cf96['body'],{})[_0x31ae('0x24')](respondWithResult(_0x780eae,0xc9))[_0x31ae('0x55')](handleError(_0x780eae,null));};exports[_0x31ae('0x5b')]=function(_0x4c5433,_0x1d10a0){if(_0x4c5433[_0x31ae('0x5c')]['id']){delete _0x4c5433[_0x31ae('0x5c')]['id'];}return db[_0x31ae('0x51')][_0x31ae('0x59')]({'where':{'id':_0x4c5433[_0x31ae('0x5d')]['id']}})[_0x31ae('0x24')](handleEntityNotFound(_0x1d10a0,null))[_0x31ae('0x24')](saveUpdates(_0x4c5433['body'],null))['then'](respondWithResult(_0x1d10a0,null))['catch'](handleError(_0x1d10a0,null));};exports['destroy']=function(_0xb54643,_0x579f2a){return db[_0x31ae('0x51')][_0x31ae('0x59')]({'where':{'id':_0xb54643[_0x31ae('0x5d')]['id']}})['then'](handleEntityNotFound(_0x579f2a,null))[_0x31ae('0x24')](removeEntity(_0x579f2a,null))[_0x31ae('0x55')](handleError(_0x579f2a,null));};exports[_0x31ae('0x5e')]=function(_0x374a62,_0x583d3b){return db['ChatGroup'][_0x31ae('0x5e')]()['then'](respondWithResult(_0x583d3b,null))['catch'](handleError(_0x583d3b,null));};exports[_0x31ae('0x5f')]=function(_0x4cb76c,_0x2e473d,_0xbbb55a){return db[_0x31ae('0x60')][_0x31ae('0x32')]({'where':{'ChatGroupId':_0x4cb76c[_0x31ae('0x5d')]['id'],'ToId':_0x4cb76c[_0x31ae('0x61')]['id'],'read':![]}})[_0x31ae('0x24')](function(_0x41034d){return{'id':_['toInteger'](_0x4cb76c[_0x31ae('0x5d')]['id']),'count':_0x41034d};})[_0x31ae('0x24')](respondWithResult(_0x2e473d,null))[_0x31ae('0x55')](handleError(_0x2e473d,null));};exports[_0x31ae('0x62')]=function(_0x2e3027,_0x35490e,_0x4a94fd){return db[_0x31ae('0x51')][_0x31ae('0x59')]({'where':{'id':_0x2e3027[_0x31ae('0x5d')]['id']}})[_0x31ae('0x24')](handleEntityNotFound(_0x35490e,null))[_0x31ae('0x24')](function(_0x4c1f20){if(_0x4c1f20){return _0x4c1f20[_0x31ae('0x62')](_0x2e3027[_0x31ae('0x5c')][_0x31ae('0x63')],_[_0x31ae('0x64')](_0x2e3027['body'],['ids','id'])||{});}})[_0x31ae('0x24')](respondWithResult(_0x35490e,null))[_0x31ae('0x55')](handleError(_0x35490e,null));};exports[_0x31ae('0x65')]=function(_0x19e141,_0x14508c,_0x2d2d25){var _0x21f72c={};var _0x4255c6={};var _0x2295c0;var _0xb3bba1;return db['ChatGroup'][_0x31ae('0x66')]({'where':{'id':_0x19e141[_0x31ae('0x5d')]['id']}})[_0x31ae('0x24')](handleEntityNotFound(_0x14508c,null))[_0x31ae('0x24')](function(_0x92dc8a){if(_0x92dc8a){_0x2295c0=_0x92dc8a;_0x4255c6['model']=_[_0x31ae('0x57')](db[_0x31ae('0x67')]['rawAttributes']);_0x4255c6[_0x31ae('0x3e')]=_[_0x31ae('0x57')](_0x19e141['query']);_0x4255c6['filters']=_[_0x31ae('0x41')](_0x4255c6[_0x31ae('0x3f')],_0x4255c6[_0x31ae('0x3e')]);_0x21f72c['attributes']=_[_0x31ae('0x41')](_0x4255c6[_0x31ae('0x3f')],qs[_0x31ae('0x42')](_0x19e141[_0x31ae('0x3e')][_0x31ae('0x42')]));_0x21f72c[_0x31ae('0x40')]=_0x21f72c[_0x31ae('0x40')][_0x31ae('0x43')]?_0x21f72c['attributes']:_0x4255c6['model'];_0x21f72c['order']=qs[_0x31ae('0x47')](_0x19e141[_0x31ae('0x3e')][_0x31ae('0x47')]);_0x21f72c[_0x31ae('0x48')]=qs[_0x31ae('0x4a')](_['pick'](_0x19e141[_0x31ae('0x3e')],_0x4255c6[_0x31ae('0x4a')]));if(_0x19e141['query'][_0x31ae('0x4b')]){_0x21f72c['where']=_[_0x31ae('0x4c')](_0x21f72c[_0x31ae('0x48')],{'$or':_[_0x31ae('0x4d')](_0x21f72c[_0x31ae('0x40')],function(_0x7e7cb1){var _0x5e3d68={};_0x5e3d68[_0x7e7cb1]={'$like':'%'+_0x19e141[_0x31ae('0x3e')][_0x31ae('0x4b')]+'%'};return _0x5e3d68;})});}_0x21f72c=_[_0x31ae('0x4c')]({},_0x21f72c,_0x19e141[_0x31ae('0x50')]);return _0x2295c0[_0x31ae('0x65')](_0x21f72c);}})[_0x31ae('0x24')](function(_0x381b39){if(_0x381b39){_0xb3bba1=_0x381b39[_0x31ae('0x43')];if(!_0x19e141[_0x31ae('0x3e')][_0x31ae('0x44')](_0x31ae('0x68'))){_0x21f72c[_0x31ae('0x45')]=qs[_0x31ae('0x45')](_0x19e141['query'][_0x31ae('0x45')]);_0x21f72c[_0x31ae('0x33')]=qs[_0x31ae('0x33')](_0x19e141['query'][_0x31ae('0x33')]);}return _0x2295c0[_0x31ae('0x65')](_0x21f72c);}})[_0x31ae('0x24')](function(_0x53af00){if(_0x53af00){return _0x53af00?{'count':_0xb3bba1,'rows':_0x53af00}:null;}})[_0x31ae('0x24')](respondWithResult(_0x14508c,null))[_0x31ae('0x55')](handleError(_0x14508c,null));};exports['removeMembers']=function(_0x4080f9,_0x1af6a1,_0x5a97c3){return db[_0x31ae('0x51')][_0x31ae('0x59')]({'where':{'id':_0x4080f9[_0x31ae('0x5d')]['id']}})[_0x31ae('0x24')](handleEntityNotFound(_0x1af6a1,null))['then'](function(_0x637e54){if(_0x637e54){return _0x637e54[_0x31ae('0x69')](_0x4080f9[_0x31ae('0x3e')]['ids']);}})[_0x31ae('0x24')](respondWithStatusCode(_0x1af6a1,null))[_0x31ae('0x55')](handleError(_0x1af6a1,null));};exports[_0x31ae('0x6a')]=function(_0x4cd239,_0xdc98a7,_0x12b861){if(_0x4cd239[_0x31ae('0x5c')]['id']){delete _0x4cd239['body']['id'];}return db[_0x31ae('0x51')][_0x31ae('0x59')]({'where':{'id':_0x4cd239[_0x31ae('0x5d')]['id']}})[_0x31ae('0x24')](handleEntityNotFound(_0xdc98a7,null))[_0x31ae('0x24')](function(_0x14cc11){if(_0x14cc11){_0x4cd239['body']['ChatGroupId']=_0x14cc11['id'];return db[_0x31ae('0x60')][_0x31ae('0x5a')](_0x4cd239[_0x31ae('0x5c')]);}})[_0x31ae('0x24')](respondWithResult(_0xdc98a7,null))[_0x31ae('0x55')](handleError(_0xdc98a7,null));};exports['getMessages']=function(_0x22d231,_0xd3449,_0x40d9ce){var _0x17dcb1={};var _0x426121={};var _0x42c4cd;var _0x46d50f;return db[_0x31ae('0x51')][_0x31ae('0x66')]({'where':{'id':_0x22d231['params']['id']}})[_0x31ae('0x24')](handleEntityNotFound(_0xd3449,null))[_0x31ae('0x24')](function(_0x38fbfb){if(_0x38fbfb){_0x42c4cd=_0x38fbfb;_0x426121['model']=_[_0x31ae('0x57')](db[_0x31ae('0x60')][_0x31ae('0x3d')]);_0x426121[_0x31ae('0x3e')]=_[_0x31ae('0x57')](_0x22d231['query']);_0x426121[_0x31ae('0x4a')]=_['intersection'](_0x426121['model'],_0x426121['query']);_0x17dcb1[_0x31ae('0x40')]=_[_0x31ae('0x41')](_0x426121[_0x31ae('0x3f')],qs[_0x31ae('0x42')](_0x22d231[_0x31ae('0x3e')]['fields']));_0x17dcb1['attributes']=_0x17dcb1[_0x31ae('0x40')][_0x31ae('0x43')]?_0x17dcb1[_0x31ae('0x40')]:_0x426121[_0x31ae('0x3f')];_0x17dcb1[_0x31ae('0x46')]=qs[_0x31ae('0x47')](_0x22d231[_0x31ae('0x3e')][_0x31ae('0x47')]);_0x17dcb1[_0x31ae('0x48')]=qs['filters'](_[_0x31ae('0x49')](_0x22d231['query'],_0x426121[_0x31ae('0x4a')]));if(_0x22d231['query'][_0x31ae('0x4b')]){_0x17dcb1[_0x31ae('0x48')]=_[_0x31ae('0x4c')](_0x17dcb1[_0x31ae('0x48')],{'$or':_[_0x31ae('0x4d')](_0x17dcb1[_0x31ae('0x40')],function(_0x232031){var _0x45a540={};_0x45a540[_0x232031]={'$like':'%'+_0x22d231['query'][_0x31ae('0x4b')]+'%'};return _0x45a540;})});}if(_0x22d231[_0x31ae('0x3e')][_0x31ae('0x6b')]){var _0x1f3134=_0x22d231['query'][_0x31ae('0x6b')]['split'](',');var _0x232b34={};_0x232b34[_0x1f3134[0x0]]={'$gte':moment(_0x1f3134[0x1])[_0x31ae('0x6c')](_0x31ae('0x6d'))};_0x17dcb1[_0x31ae('0x48')]=_[_0x31ae('0x4c')](_0x17dcb1[_0x31ae('0x48')],_0x232b34);}_0x17dcb1=_['merge']({},_0x17dcb1,_0x22d231[_0x31ae('0x50')]);return _0x42c4cd[_0x31ae('0x6e')](_0x17dcb1);}})['then'](function(_0xaf7712){if(_0xaf7712){_0x46d50f=_0xaf7712[_0x31ae('0x43')];if(!_0x22d231[_0x31ae('0x3e')]['hasOwnProperty'](_0x31ae('0x68'))){_0x17dcb1[_0x31ae('0x45')]=qs['limit'](_0x22d231[_0x31ae('0x3e')][_0x31ae('0x45')]);_0x17dcb1['offset']=qs[_0x31ae('0x33')](_0x22d231['query'][_0x31ae('0x33')]);}return _0x42c4cd[_0x31ae('0x6e')](_0x17dcb1);}})[_0x31ae('0x24')](function(_0x46e508){if(_0x46e508){return _0x46e508?{'count':_0x46d50f,'rows':_0x46e508}:null;}})[_0x31ae('0x24')](respondWithResult(_0xd3449,null))[_0x31ae('0x55')](handleError(_0xd3449,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d3301ac..983b3cd 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 _0xf5ca=['events','../../mysqldb','save','emit','hasOwnProperty','hook','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf5ca,0xf5));var _0xaf5c=function(_0x1f5890,_0x534e45){_0x1f5890=_0x1f5890-0x0;var _0x210ceb=_0xf5ca[_0x1f5890];return _0x210ceb;};'use strict';var EventEmitter=require(_0xaf5c('0x0'));var ChatGroup=require(_0xaf5c('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf5c('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5d2bf3){return function(_0x35305f,_0x3f1dd8,_0x388596){ChatGroupEvents[_0xaf5c('0x3')](_0x5d2bf3+':'+_0x35305f['id'],_0x35305f);ChatGroupEvents[_0xaf5c('0x3')](_0x5d2bf3,_0x35305f);_0x388596(null);};}for(var e in events){if(events[_0xaf5c('0x4')](e)){var event=events[e];ChatGroup[_0xaf5c('0x5')](e,emitEvent(event));}}module[_0xaf5c('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x7662=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0x7662,0x172));var _0x2766=function(_0x28529c,_0x326fd3){_0x28529c=_0x28529c-0x0;var _0x5cebb4=_0x7662[_0x28529c];return _0x5cebb4;};'use strict';var EventEmitter=require(_0x2766('0x0'));var ChatGroup=require(_0x2766('0x1'))['db'][_0x2766('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2766('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2766('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd06f2b){return function(_0x3e5c3d,_0x3a0a69,_0x273ad2){ChatGroupEvents[_0x2766('0x5')](_0xd06f2b+':'+_0x3e5c3d['id'],_0x3e5c3d);ChatGroupEvents[_0x2766('0x5')](_0xd06f2b,_0x3e5c3d);_0x273ad2(null);};}for(var e in events){if(events[_0x2766('0x6')](e)){var event=events[e];ChatGroup[_0x2766('0x7')](e,emitEvent(event));}}module[_0x2766('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 7e84517..53b4a19 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 _0xd608=['moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','util','../../config/logger','api'];(function(_0x238002,_0x54d16b){var _0x1d7702=function(_0x594ed3){while(--_0x594ed3){_0x238002['push'](_0x238002['shift']());}};_0x1d7702(++_0x54d16b);}(_0xd608,0x194));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8d60('0x0'));var logger=require(_0x8d60('0x1'))(_0x8d60('0x2'));var moment=require(_0x8d60('0x3'));var BPromise=require(_0x8d60('0x4'));var rp=require(_0x8d60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d60('0x6'));var attributes=require(_0x8d60('0x7'));module[_0x8d60('0x8')]=function(_0xbc1dd0,_0x5304cb){return _0xbc1dd0[_0x8d60('0x9')](_0x8d60('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c62=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatGroup','lodash','api'];(function(_0x62ff29,_0x5b5d4c){var _0x63583b=function(_0x3de158){while(--_0x3de158){_0x62ff29['push'](_0x62ff29['shift']());}};_0x63583b(++_0x5b5d4c);}(_0x5c62,0x6c));var _0x25c6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5c62[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x25c6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25c6('0x1'));var moment=require(_0x25c6('0x2'));var BPromise=require(_0x25c6('0x3'));var rp=require(_0x25c6('0x4'));var fs=require('fs');var path=require(_0x25c6('0x5'));var rimraf=require(_0x25c6('0x6'));var config=require(_0x25c6('0x7'));var attributes=require('./chatGroup.attributes');module[_0x25c6('0x8')]=function(_0x184400,_0x304f3e){return _0x184400[_0x25c6('0x9')](_0x25c6('0xa'),attributes,{'tableName':'chat_groups','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 90837c9..d33fe69 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 _0xe14d=['register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket'];(function(_0xf659b9,_0x4e686f){var _0x554601=function(_0x178f05){while(--_0x178f05){_0xf659b9['push'](_0xf659b9['shift']());}};_0x554601(++_0x4e686f);}(_0xe14d,0x1ee));var _0xde14=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe14d[_0x334841];return _0x5beb4b;};'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});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});} \ No newline at end of file +var _0xc3b5=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xc3b5,0x6f));var _0x5c3b=function(_0xcab854,_0x113252){_0xcab854=_0xcab854-0x0;var _0x168f13=_0xc3b5[_0xcab854];return _0x168f13;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c3b('0x0'));var BPromise=require(_0x5c3b('0x1'));var rs=require(_0x5c3b('0x2'));var fs=require('fs');var Redis=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});config[_0x5c3b('0xa')]=_[_0x5c3b('0xb')](config[_0x5c3b('0xa')],{'host':_0x5c3b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c3b('0xa')]));require(_0x5c3b('0xd'))[_0x5c3b('0xe')](socket);function respondWithRpcPromise(_0x20e71,_0x4ddddd,_0x20dd86){return new BPromise(function(_0x22eaf0,_0x30ceca){return client[_0x5c3b('0xf')](_0x20e71,_0x20dd86)[_0x5c3b('0x10')](function(_0x5b9f7e){logger[_0x5c3b('0x11')](_0x5c3b('0x12'),_0x4ddddd,'request\x20sent');logger[_0x5c3b('0x13')](_0x5c3b('0x14'),_0x4ddddd,'request\x20sent',JSON[_0x5c3b('0x15')](_0x5b9f7e));if(_0x5b9f7e[_0x5c3b('0x16')]){if(_0x5b9f7e[_0x5c3b('0x16')][_0x5c3b('0x17')]===0x1f4){logger[_0x5c3b('0x16')](_0x5c3b('0x12'),_0x4ddddd,_0x5b9f7e[_0x5c3b('0x16')]['message']);return _0x30ceca(_0x5b9f7e[_0x5c3b('0x16')]['message']);}logger['error'](_0x5c3b('0x12'),_0x4ddddd,_0x5b9f7e[_0x5c3b('0x16')][_0x5c3b('0x18')]);return _0x22eaf0(_0x5b9f7e['error'][_0x5c3b('0x18')]);}else{logger[_0x5c3b('0x11')](_0x5c3b('0x12'),_0x4ddddd,'request\x20sent');_0x22eaf0(_0x5b9f7e[_0x5c3b('0x19')][_0x5c3b('0x18')]);}})['catch'](function(_0x3973bc){logger[_0x5c3b('0x16')](_0x5c3b('0x12'),_0x4ddddd,_0x3973bc);_0x30ceca(_0x3973bc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f17dabd..0004599 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 _0x49e9=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x163bc9,_0x4b6796){var _0xb94e42=function(_0x3529e3){while(--_0x3529e3){_0x163bc9['push'](_0x163bc9['shift']());}};_0xb94e42(++_0x4b6796);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var ChatGroupEvents=require(_0x949e('0x0'));var events=[_0x949e('0x1'),'remove',_0x949e('0x2')];function createListener(_0x1db1b8,_0x259795){return function(_0x5c303a){_0x259795['emit'](_0x1db1b8,_0x5c303a);};}function removeListener(_0x114f65,_0x4c284b){return function(){ChatGroupEvents[_0x949e('0x3')](_0x114f65,_0x4c284b);};}exports[_0x949e('0x4')]=function(_0x360308){for(var _0x56c7b2=0x0,_0x17f649=events[_0x949e('0x5')];_0x56c7b2<_0x17f649;_0x56c7b2++){var _0xfc4f8a=events[_0x56c7b2];var _0x34ee57=createListener(_0x949e('0x6')+_0xfc4f8a,_0x360308);ChatGroupEvents['on'](_0xfc4f8a,_0x34ee57);}}; \ No newline at end of file +var _0x4d9e=['removeListener','register','length','chatGroup:','./chatGroup.events','update','emit'];(function(_0x4e69f7,_0x4266f5){var _0x3f5476=function(_0x111f6e){while(--_0x111f6e){_0x4e69f7['push'](_0x4e69f7['shift']());}};_0x3f5476(++_0x4266f5);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2250cf,_0x1af8b9){_0x2250cf=_0x2250cf-0x0;var _0x1bec8c=_0x4d9e[_0x2250cf];return _0x1bec8c;};'use strict';var ChatGroupEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatGroupEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatGroupEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index aa0e0b5..2d809f0 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 _0x76dc=['./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','getUnread','/:id/members','/:id/messages','post','addMembers','addMessage','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41917a,_0xe3649e){var _0x99f6e5=function(_0x24647a){while(--_0x24647a){_0x41917a['push'](_0x41917a['shift']());}};_0x99f6e5(++_0xe3649e);}(_0x76dc,0x10a));var _0xc76d=function(_0x3abde4,_0x4076e2){_0x3abde4=_0x3abde4-0x0;var _0x96f3cc=_0x76dc[_0x3abde4];return _0x96f3cc;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require(_0xc76d('0x4'));var router=express[_0xc76d('0x5')]();var auth=require(_0xc76d('0x6'));var interaction=require(_0xc76d('0x7'));var config=require(_0xc76d('0x8'));var controller=require(_0xc76d('0x9'));router[_0xc76d('0xa')]('/',auth[_0xc76d('0xb')](),controller['index']);router[_0xc76d('0xa')](_0xc76d('0xc'),auth[_0xc76d('0xb')](),controller[_0xc76d('0xd')]);router[_0xc76d('0xa')](_0xc76d('0xe'),auth[_0xc76d('0xb')](),controller[_0xc76d('0xf')]);router[_0xc76d('0xa')]('/:id/unread',auth['isAuthenticated'](),controller[_0xc76d('0x10')]);router[_0xc76d('0xa')](_0xc76d('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0xc76d('0xa')](_0xc76d('0x12'),auth[_0xc76d('0xb')](),controller['getMessages']);router[_0xc76d('0x13')]('/',auth[_0xc76d('0xb')](),controller['create']);router['post'](_0xc76d('0x11'),auth['isAuthenticated'](),controller[_0xc76d('0x14')]);router[_0xc76d('0x13')]('/:id/messages',auth[_0xc76d('0xb')](),controller[_0xc76d('0x15')]);router['put'](_0xc76d('0xe'),auth[_0xc76d('0xb')](),controller['update']);router[_0xc76d('0x16')](_0xc76d('0xe'),auth[_0xc76d('0xb')](),controller['destroy']);router['delete'](_0xc76d('0x11'),auth['isAuthenticated'](),controller[_0xc76d('0x17')]);module[_0xc76d('0x18')]=router; \ No newline at end of file +var _0xbb98=['post','create','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','getMessages'];(function(_0x5152e6,_0x3a7f4f){var _0x4e045a=function(_0x64057a){while(--_0x64057a){_0x5152e6['push'](_0x5152e6['shift']());}};_0x4e045a(++_0x3a7f4f);}(_0xbb98,0xe3));var _0x8bb9=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xbb98[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require('multer');var util=require(_0x8bb9('0x0'));var path=require(_0x8bb9('0x1'));var timeout=require(_0x8bb9('0x2'));var express=require('express');var router=express[_0x8bb9('0x3')]();var auth=require(_0x8bb9('0x4'));var interaction=require(_0x8bb9('0x5'));var config=require(_0x8bb9('0x6'));var controller=require(_0x8bb9('0x7'));router[_0x8bb9('0x8')]('/',auth[_0x8bb9('0x9')](),controller['index']);router[_0x8bb9('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x8bb9('0xa'),auth['isAuthenticated'](),controller[_0x8bb9('0xb')]);router['get'](_0x8bb9('0xc'),auth[_0x8bb9('0x9')](),controller[_0x8bb9('0xd')]);router[_0x8bb9('0x8')](_0x8bb9('0xe'),auth[_0x8bb9('0x9')](),controller['getMembers']);router[_0x8bb9('0x8')]('/:id/messages',auth[_0x8bb9('0x9')](),controller[_0x8bb9('0xf')]);router[_0x8bb9('0x10')]('/',auth[_0x8bb9('0x9')](),controller[_0x8bb9('0x11')]);router[_0x8bb9('0x10')](_0x8bb9('0xe'),auth[_0x8bb9('0x9')](),controller[_0x8bb9('0x12')]);router[_0x8bb9('0x10')](_0x8bb9('0x13'),auth['isAuthenticated'](),controller[_0x8bb9('0x14')]);router[_0x8bb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8bb9('0x16')]);router[_0x8bb9('0x17')]('/:id',auth[_0x8bb9('0x9')](),controller[_0x8bb9('0x18')]);router['delete']('/:id/members',auth[_0x8bb9('0x9')](),controller[_0x8bb9('0x19')]);module[_0x8bb9('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 9156deb..2659fe9 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 _0xf7b4=['TEXT','STRING','DATE','long','out','sequelize','INTEGER','ENUM','star'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0xf7b4,0x152));var _0x4f7b=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0xf7b4[_0x301064];return _0x5bc841;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4f7b('0x1')]},'ratingType':{'type':Sequelize[_0x4f7b('0x2')]('star','thumb'),'defaultValue':_0x4f7b('0x3')},'ratingMessage':{'type':Sequelize[_0x4f7b('0x4')]},'pathTranscript':{'type':Sequelize[_0x4f7b('0x4')]},'mailTranscript':{'type':Sequelize[_0x4f7b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4f7b('0x6')]},'disposition':{'type':Sequelize[_0x4f7b('0x5')]},'note':{'type':Sequelize[_0x4f7b('0x5')]},'browserName':{'type':Sequelize[_0x4f7b('0x5')]},'browserVersion':{'type':Sequelize[_0x4f7b('0x5')]},'osName':{'type':Sequelize[_0x4f7b('0x5')]},'osVersion':{'type':Sequelize[_0x4f7b('0x5')]},'deviceModel':{'type':Sequelize[_0x4f7b('0x5')]},'deviceVendor':{'type':Sequelize[_0x4f7b('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x4f7b('0x5')]},'customerIp':{'type':Sequelize[_0x4f7b('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x4f7b('0x7'))},'read1stAt':{'type':Sequelize[_0x4f7b('0x6')]},'lastMsgAt':{'type':Sequelize[_0x4f7b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x4f7b('0x2')]('in',_0x4f7b('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3266=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3266,0x6a));var _0x6326=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x3266[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'closed':{'type':Sequelize[_0x6326('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6326('0x3')]},'ratingType':{'type':Sequelize[_0x6326('0x4')](_0x6326('0x5'),_0x6326('0x6')),'defaultValue':_0x6326('0x5')},'ratingMessage':{'type':Sequelize[_0x6326('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6326('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6326('0x8')]},'note':{'type':Sequelize[_0x6326('0x8')]},'browserName':{'type':Sequelize[_0x6326('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6326('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x6326('0x8')]},'deviceVendor':{'type':Sequelize[_0x6326('0x8')]},'deviceType':{'type':Sequelize[_0x6326('0x8')]},'referer':{'type':Sequelize[_0x6326('0x8')]},'customerIp':{'type':Sequelize[_0x6326('0x8')]},'formData':{'type':Sequelize['TEXT'](_0x6326('0x9'))},'read1stAt':{'type':Sequelize[_0x6326('0xa')]},'lastMsgAt':{'type':Sequelize[_0x6326('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x6326('0x4')]('in',_0x6326('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6326('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1e388fb..e381ea2 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 _0x6b23=['pick','select','field','color','from','me.ChatInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_messages','expr','advancedFilter','parse','createdAt','value','dateStart','day','utc','format','endOf','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','Messages.count','\x20IN\x20?','tableAlias','\x20=\x20?','and','LIKE','ContactId','c.firstName','\x20LIKE\x20?','c.lastName','c.email','\x20>\x20?','\x20<\x20?','TagId','filter','isNil','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','$gte','$lte','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','toString','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','QueryTypes','SELECT','clone','COUNT(*)','read','%s\x20=\x200','having','`Messages.count`\x20=\x200','%s\x20>\x200','`Messages.count`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','it.MailInteractionId\x20=\x20i.id','sequelize','keyBy','merge','a.key','Contact.firstName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','includeAll','options','find','create','body','update','params','describe','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Sequelize','ValidationError','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','type','mimetype','attachmentDownload','findOne','Attachment','download','close','join','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','ChatWebsiteId','CmContact','UserId','%s%d','agentAlias','Visitor','website_alias','System','agent_alias','User','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','sendMail','email','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','include','secret','includeAgent','findAll','addTags','setTags','spread','Tag','emit','removeTags','unix','root','server','files','tmp','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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','mkdirSync','N.A.','closedAt','browserName','osName','customerIp','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','closed','unreadMessages','ChatMessage','Users','map','Tags','TagIds','split','forEach','push','index','ChatInteraction','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5e7384,_0x4eb9aa){var _0x8c09c8=function(_0x5ea2ab){while(--_0x5ea2ab){_0x5e7384['push'](_0x5e7384['shift']());}};_0x8c09c8(++_0x4eb9aa);}(_0x6b23,0xd9));var _0x36b2=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x6b23[_0x65c50e];return _0x4573e7;};'use strict';var pdf=require(_0x36b2('0x0'));var emlformat=require(_0x36b2('0x1'));var rimraf=require(_0x36b2('0x2'));var zipdir=require(_0x36b2('0x3'));var jsonpatch=require(_0x36b2('0x4'));var rp=require(_0x36b2('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36b2('0x6'));var util=require(_0x36b2('0x7'));var path=require(_0x36b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x36b2('0x9'));var fs=require('fs');var _=require(_0x36b2('0xa'));var squel=require(_0x36b2('0xb'));var crypto=require(_0x36b2('0xc'));var jsforce=require(_0x36b2('0xd'));var deskjs=require(_0x36b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x36b2('0xf'));var Papa=require(_0x36b2('0x10'));var Redis=require('ioredis');var authService=require(_0x36b2('0x11'));var qs=require(_0x36b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36b2('0x13'));var utils=require(_0x36b2('0x14'));var config=require(_0x36b2('0x15'));var db=require(_0x36b2('0x16'))['db'];config[_0x36b2('0x17')]=_[_0x36b2('0x18')](config['redis'],{'host':_0x36b2('0x19'),'port':0x18eb});var socket=require(_0x36b2('0x1a'))(new Redis(config[_0x36b2('0x17')]));require(_0x36b2('0x1b'))[_0x36b2('0x1c')](socket);var jayson=require(_0x36b2('0x1d'));var client=jayson[_0x36b2('0x1e')][_0x36b2('0x1f')]({'port':0x232b});var client9004=jayson[_0x36b2('0x1e')][_0x36b2('0x1f')]({'port':0x232c});function checkPasswordPattern(_0x1b6fda,_0x2b345a,_0x2d8029){if(_0x2d8029){var _0x4c5071=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c5071[_0x36b2('0x20')](_0x2b345a)){return _0x1b6fda;}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 _0x1b6fda;}}function respondWithRpcPromise(_0x4b10e2,_0x3dfb3c,_0xf9cb,_0x2d17dd){return new BPromise(function(_0x450cec,_0x4ae693){var _0x582d84=_0x2d17dd||client;return _0x582d84[_0x36b2('0x21')](_0x4b10e2,_0xf9cb)['then'](function(_0x576884){logger[_0x36b2('0x22')](_0x36b2('0x23'),_0x3dfb3c,_0x36b2('0x24'));logger['debug'](_0x36b2('0x25'),_0x3dfb3c,_0x36b2('0x24'),JSON[_0x36b2('0x26')](_0x576884));if(_0x576884['error']){if(_0x576884[_0x36b2('0x27')][_0x36b2('0x28')]===0x1f4){logger[_0x36b2('0x27')](_0x36b2('0x23'),_0x3dfb3c,_0x576884[_0x36b2('0x27')]['message']);return _0x4ae693(_0x576884[_0x36b2('0x27')][_0x36b2('0x29')]);}logger[_0x36b2('0x27')](_0x36b2('0x23'),_0x3dfb3c,_0x576884['error'][_0x36b2('0x29')]);return _0x450cec(_0x576884['error'][_0x36b2('0x29')]);}else{logger[_0x36b2('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x3dfb3c,'request\x20sent');_0x450cec(_0x576884[_0x36b2('0x2a')][_0x36b2('0x29')]);}})[_0x36b2('0x2b')](function(_0x1921e9){logger[_0x36b2('0x27')](_0x36b2('0x23'),_0x3dfb3c,_0x1921e9);_0x4ae693(_0x1921e9);});});}function respondWithStatusCode(_0x40584d,_0x538eec){_0x538eec=_0x538eec||0xcc;return function(_0x368b62){if(_0x368b62){return _0x40584d['sendStatus'](_0x538eec);}return _0x40584d[_0x36b2('0x2c')](_0x538eec)[_0x36b2('0x2d')]();};}function respondWithResult(_0x4f0e4d,_0x53ab8d){_0x53ab8d=_0x53ab8d||0xc8;return function(_0x207b30){if(_0x207b30){return _0x4f0e4d[_0x36b2('0x2c')](_0x53ab8d)[_0x36b2('0x2e')](_0x207b30);}};}function respondWithFilteredResult(_0x11d77d,_0x470022){return function(_0x579112){if(_0x579112){var _0x6a680a=_0x579112[_0x36b2('0x2f')],_0x5a2702=_0x470022['offset'],_0x512975=_0x470022[_0x36b2('0x30')]+_0x470022[_0x36b2('0x31')],_0x40e55e;if(_0x512975>=_0x6a680a){_0x512975=_0x6a680a;_0x40e55e=0xc8;}else{_0x40e55e=0xce;}_0x11d77d['status'](_0x40e55e);return _0x11d77d[_0x36b2('0x32')](_0x36b2('0x33'),_0x5a2702+'-'+_0x512975+'/'+_0x6a680a)[_0x36b2('0x2e')](_0x579112);}return null;};}function patchUpdates(_0x5ee46b){return function(_0x141352){try{jsonpatch['apply'](_0x141352,_0x5ee46b,!![]);}catch(_0x891c0){return BPromise[_0x36b2('0x34')](_0x891c0);}return _0x141352[_0x36b2('0x35')]();};}function saveUpdates(_0x3ea2ea,_0x46e4c2){return function(_0x5621b6){if(_0x5621b6){return _0x5621b6['update'](_0x3ea2ea)[_0x36b2('0x36')](function(_0x12f6f8){return _0x12f6f8;});}return null;};}function removeEntity(_0x10f42d,_0x330619){return function(_0x4c42f2){if(_0x4c42f2){return _0x4c42f2[_0x36b2('0x37')]()[_0x36b2('0x36')](function(){_0x10f42d[_0x36b2('0x2c')](0xcc)[_0x36b2('0x2d')]();});}};}function handleEntityNotFound(_0x524b5e,_0x552dcb){return function(_0x183441){if(!_0x183441){_0x524b5e[_0x36b2('0x38')](0x194);}return _0x183441;};}function handleError(_0x50038c,_0x135274){_0x135274=_0x135274||0x1f4;return function(_0x107a25){logger[_0x36b2('0x27')](_0x107a25[_0x36b2('0x39')]);if(_0x107a25['name']){delete _0x107a25[_0x36b2('0x3a')];}_0x50038c[_0x36b2('0x2c')](_0x135274)[_0x36b2('0x3b')](_0x107a25);};}function getInteractionUnreadMessages(_0x3fbd8d){return new BPromise(function(_0x22f21b,_0x50441b){try{if(_0x3fbd8d[_0x36b2('0x3c')]){_0x3fbd8d[_0x36b2('0x3d')]=0x0;_0x22f21b(_0x3fbd8d);}else{return db[_0x36b2('0x3e')]['count']({'where':{'ChatInteractionId':_0x3fbd8d['id'],'direction':'in','read':![]}})[_0x36b2('0x36')](function(_0x3fb9c8){_0x3fbd8d[_0x36b2('0x3d')]=_0x3fb9c8;_0x22f21b(_0x3fbd8d);});}}catch(_0x4b5d61){_0x50441b(_0x4b5d61);}});}function getInteractionUsers(_0x2941d4,_0x2db6fb){return new BPromise(function(_0x1f3ce8,_0x28362c){try{if(_0x2db6fb[_0x2941d4['id']]){_0x2941d4[_0x36b2('0x3f')]=_[_0x36b2('0x40')](_0x2db6fb[_0x2941d4['id']],function(_0x36e154){return{'id':_0x36e154['id']};});}}catch(_0x34c845){_0x28362c(_0x34c845);}_0x1f3ce8(_0x2941d4);});}function getInteractionTags(_0x199532,_0xd63267){return new BPromise(function(_0x3bcb72,_0x47ba7a){try{if(_0x199532['TagIds']){_0x199532[_0x36b2('0x41')]=[];_0x199532[_0x36b2('0x42')][_0x36b2('0x43')](',')[_0x36b2('0x44')](function(_0xdc4042){_0x199532['Tags'][_0x36b2('0x45')](_0xd63267[_0xdc4042]);});}delete _0x199532[_0x36b2('0x42')];}catch(_0x391f39){_0x47ba7a(_0x391f39);}_0x3bcb72(_0x199532);});}function updateChatInteraction(_0x142880,_0x25c2ce,_0x1f5339){return new BPromise(function(_0x2d00d4,_0x23cf74){return getInteractionUnreadMessages(_0x142880)['then'](function(_0x4f7266){return getInteractionUsers(_0x4f7266,_0x1f5339);})['then'](function(_0x304b16){return getInteractionTags(_0x304b16,_0x25c2ce);})['then'](function(_0x2a6881){_0x2d00d4(_0x2a6881);})[_0x36b2('0x2b')](function(_0x1ccc43){_0x23cf74(_0x1ccc43);});});}exports[_0x36b2('0x46')]=function(_0x151201,_0x325889){var _0x2db7a2={},_0x3fd880={},_0x40d415={'count':0x0,'rows':[]};var _0x52e225=db[_0x36b2('0x47')][_0x36b2('0x48')];_0x3fd880[_0x36b2('0x49')]=_['keys'](_0x52e225);_0x3fd880[_0x36b2('0x4a')]=_[_0x36b2('0x4b')](_0x151201[_0x36b2('0x4a')]);_0x3fd880[_0x36b2('0x4c')]=_['intersection'](_0x3fd880[_0x36b2('0x49')],_0x3fd880[_0x36b2('0x4a')]);_0x2db7a2[_0x36b2('0x4d')]=_[_0x36b2('0x4e')](_0x3fd880['model'],qs[_0x36b2('0x4f')](_0x151201[_0x36b2('0x4a')][_0x36b2('0x4f')]));_0x2db7a2[_0x36b2('0x4d')]=_0x2db7a2[_0x36b2('0x4d')][_0x36b2('0x50')]?_0x2db7a2[_0x36b2('0x4d')]:_0x3fd880[_0x36b2('0x49')];if(!_0x151201['query'][_0x36b2('0x51')](_0x36b2('0x52'))){_0x2db7a2[_0x36b2('0x31')]=qs[_0x36b2('0x31')](_0x151201[_0x36b2('0x4a')][_0x36b2('0x31')]);_0x2db7a2['offset']=qs[_0x36b2('0x30')](_0x151201[_0x36b2('0x4a')][_0x36b2('0x30')]);}_0x2db7a2[_0x36b2('0x53')]=qs[_0x36b2('0x54')](_0x151201['query'][_0x36b2('0x54')]);_0x2db7a2[_0x36b2('0x55')]=qs[_0x36b2('0x4c')](_[_0x36b2('0x56')](_0x151201[_0x36b2('0x4a')],_0x3fd880['filters']));var _0x6806a8=[];var _0x136658=squel[_0x36b2('0x57')]()[_0x36b2('0x58')]('id')['field']('name')[_0x36b2('0x58')](_0x36b2('0x59'))[_0x36b2('0x5a')]('tools_tags');var _0x13c133=squel[_0x36b2('0x57')]()[_0x36b2('0x58')]('COUNT(*)')[_0x36b2('0x5a')]('chat_messages','me')[_0x36b2('0x55')](_0x36b2('0x5b'))['where'](_0x36b2('0x5c'))[_0x36b2('0x55')](_0x36b2('0x5d'));var _0x20d9ea=squel[_0x36b2('0x57')]()[_0x36b2('0x58')](_0x36b2('0x5e'))[_0x36b2('0x58')](_0x36b2('0x5f'))[_0x36b2('0x5a')](_0x36b2('0x60'),'ui')[_0x36b2('0x61')]('users','u',_0x36b2('0x62'));var _0x1ffa30=squel[_0x36b2('0x57')]()[_0x36b2('0x5a')](_0x36b2('0x63'),'i')[_0x36b2('0x61')](_0x36b2('0x64'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x36b2('0x61')](_0x36b2('0x65'),'o',_0x36b2('0x66'))[_0x36b2('0x61')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x36b2('0x61')](_0x36b2('0x67'),'me',_0x36b2('0x5b'));var _0x3eea48=squel[_0x36b2('0x68')]();if(_0x151201[_0x36b2('0x4a')][_0x36b2('0x69')]){var _0x247a5b=JSON[_0x36b2('0x6a')](_0x151201['query'][_0x36b2('0x69')]);_[_0x36b2('0x4b')](_0x247a5b)[_0x36b2('0x44')](function(_0x4cc024){var _0x3ea574=_0x247a5b[_0x4cc024];if(_0x4cc024===_0x36b2('0x6b')){var _0x282d39=moment(_0x3ea574[_0x36b2('0x6c')][_0x36b2('0x6d')])['startOf'](_0x36b2('0x6e'))[_0x36b2('0x6f')]()[_0x36b2('0x70')]();var _0x3c3b54=moment(_0x3c3b54)[_0x36b2('0x6f')]()[_0x36b2('0x71')](_0x36b2('0x6e'))[_0x36b2('0x70')]();_0x3eea48['and'](_0x36b2('0x72'),_0x282d39,_0x3c3b54);}else{if(_[_0x36b2('0x73')](_0x3ea574[_0x36b2('0x74')])){_0x3ea574[_0x36b2('0x74')][_0x36b2('0x44')](function(_0x4ccbe6){switch(_0x3ea574[_0x36b2('0x74')][_0x36b2('0x6c')]){case'IS':if(_0x4cc024!=='TagId'&&_0x4cc024!==_0x36b2('0x75')){if(_[_0x36b2('0x73')](_0x3ea574['value'])&&_0x3ea574[_0x36b2('0x6c')][_0x36b2('0x50')]>0x1){_0x3eea48['and'](_0x3ea574['tableAlias']+'.'+_0x4cc024+_0x36b2('0x76'),_0x3ea574[_0x36b2('0x6c')]);}else{_0x3eea48['and'](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+_0x36b2('0x78'),_0x3ea574[_0x36b2('0x6c')][0x0]);}}break;case'=':_0x3eea48[_0x36b2('0x79')](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+'\x20=\x20?',_0x3ea574['value']);break;case _0x36b2('0x7a'):if(_0x4cc024===_0x36b2('0x7b')){_0x3eea48[_0x36b2('0x79')](_0x36b2('0x7c')+_0x36b2('0x7d'),'%'+_0x3ea574['value']+'%');_0x3eea48['or'](_0x36b2('0x7e')+_0x36b2('0x7d'),'%'+_0x3ea574[_0x36b2('0x6c')]+'%');_0x3eea48['or'](_0x36b2('0x7f')+'\x20LIKE\x20?','%'+_0x3ea574['value']+'%');}else{_0x3eea48[_0x36b2('0x79')](_0x3ea574['tableAlias']+'.'+_0x4cc024+_0x36b2('0x7d'),'%'+_0x3ea574[_0x36b2('0x6c')]+'%');}break;case'>':_0x3eea48[_0x36b2('0x79')](_0x3ea574['tableAlias']+'.'+_0x4cc024+_0x36b2('0x80'),_0x3ea574[_0x36b2('0x6c')]);break;case'<':_0x3eea48['and'](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+_0x36b2('0x81'),_0x3ea574[_0x36b2('0x6c')]);break;}});}else{switch(_0x3ea574[_0x36b2('0x74')]['value']){case'IS':if(_0x4cc024!==_0x36b2('0x82')&&_0x4cc024!==_0x36b2('0x75')){if(_['isArray'](_0x3ea574['value'])&&_0x3ea574[_0x36b2('0x6c')][_0x36b2('0x50')]>0x1){_0x3eea48['and'](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+_0x36b2('0x76'),_0x3ea574[_0x36b2('0x6c')]);}else{_0x3eea48[_0x36b2('0x79')](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+'\x20=\x20?',_0x3ea574[_0x36b2('0x6c')][0x0]);}}break;case'=':_0x3eea48['and'](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+'\x20=\x20?',_0x3ea574[_0x36b2('0x6c')]);break;case _0x36b2('0x7a'):if(_0x4cc024===_0x36b2('0x7b')){_0x3eea48['and']('c.firstName'+_0x36b2('0x7d'),'%'+_0x3ea574[_0x36b2('0x6c')]+'%');_0x3eea48['or'](_0x36b2('0x7e')+_0x36b2('0x7d'),'%'+_0x3ea574[_0x36b2('0x6c')]+'%');_0x3eea48['or']('c.email'+'\x20LIKE\x20?','%'+_0x3ea574[_0x36b2('0x6c')]+'%');}else{_0x3eea48[_0x36b2('0x79')](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+'\x20LIKE\x20?','%'+_0x3ea574[_0x36b2('0x6c')]+'%');}break;case'>':_0x3eea48['and'](_0x3ea574['tableAlias']+'.'+_0x4cc024+_0x36b2('0x80'),_0x3ea574['value']);break;case'<':_0x3eea48['and'](_0x3ea574[_0x36b2('0x77')]+'.'+_0x4cc024+'\x20<\x20?',_0x3ea574[_0x36b2('0x6c')]);break;}}}});}else{var _0x20ccf5=_(Object['keys'](_0x151201[_0x36b2('0x4a')]))[_0x36b2('0x40')](function(_0x449c34){return _0x52e225[_0x36b2('0x51')](_0x449c34)?_0x449c34:undefined;})[_0x36b2('0x83')](function(_0x45bc4b){return!_[_0x36b2('0x84')](_0x45bc4b);})[_0x36b2('0x6c')]();if(!_[_0x36b2('0x85')](_0x20ccf5)){_0x20ccf5[_0x36b2('0x44')](function(_0x1a52e7){if(_0x1a52e7==='ChatWebsiteId'){_0x1ffa30['where'](_0x36b2('0x86'),[][_0x36b2('0x87')](_0x151201[_0x36b2('0x4a')][_0x1a52e7]));}else if(_0x1a52e7==='createdAt'){var _0x560c01=JSON[_0x36b2('0x6a')](_0x151201[_0x36b2('0x4a')][_0x1a52e7])[_0x36b2('0x88')];var _0x51933c=JSON[_0x36b2('0x6a')](_0x151201['query'][_0x1a52e7])[_0x36b2('0x89')];_0x1ffa30[_0x36b2('0x55')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x560c01,_0x51933c);}else{if(_0x151201[_0x36b2('0x4a')][_0x1a52e7]===_0x36b2('0x8a')){_0x1ffa30[_0x36b2('0x55')]('i.'+_0x1a52e7+_0x36b2('0x8b'));}else{_0x1ffa30[_0x36b2('0x55')]('i.'+_0x1a52e7+_0x36b2('0x78'),_0x151201['query'][_0x1a52e7]);}}});}if(_0x151201[_0x36b2('0x4a')][_0x36b2('0x83')]){var _0x5dc869=_0x151201[_0x36b2('0x4a')][_0x36b2('0x83')][_0x36b2('0x8c')]('\x5c','\x5c\x5c')[_0x36b2('0x8c')]('\x27\x27',_0x36b2('0x8d'));if(qs[_0x36b2('0x8e')](_0x5dc869)){_0x3eea48['or'](_0x36b2('0x8f'),_0x5dc869+'%');}else{var _0x3d9544=[];_0x5dc869[_0x36b2('0x43')]('\x20')[_0x36b2('0x44')](function(_0x49ba42){_0x3d9544['push']('+'+_0x49ba42[_0x36b2('0x90')]());});var _0x87bec1=_0x3d9544['join']('\x20');_0x3eea48['or'](_0x36b2('0x91'),_0x87bec1)['or'](_0x36b2('0x92'),_0x5dc869+'%');}}}_0x1ffa30['where'](_0x3eea48);if(_0x2db7a2[_0x36b2('0x53')]){_0x2db7a2[_0x36b2('0x53')]['forEach'](function(_0x2ed898){_0x1ffa30[_0x36b2('0x53')]('i.'+_0x2ed898[0x0],_0x2ed898[0x1]===_0x36b2('0x93')?![]:!![]);});}_0x1ffa30['group']('i.id');var _0x27c721={'type':db['Sequelize'][_0x36b2('0x94')][_0x36b2('0x95')],'raw':!![]};var _0x3dd137=_0x1ffa30[_0x36b2('0x96')]()[_0x36b2('0x58')](_0x36b2('0x97'));if(!_0x151201[_0x36b2('0x4a')][_0x36b2('0x69')]){if(_0x151201[_0x36b2('0x4a')][_0x36b2('0x98')]){if(_0x151201[_0x36b2('0x4a')]['read']==0x1){_0x3dd137['where'](util[_0x36b2('0x70')](_0x36b2('0x99'),_0x13c133[_0x36b2('0x90')]()));_0x1ffa30[_0x36b2('0x9a')](_0x36b2('0x9b'));}else{_0x3dd137[_0x36b2('0x55')](util[_0x36b2('0x70')](_0x36b2('0x9c'),_0x13c133[_0x36b2('0x90')]()));_0x1ffa30[_0x36b2('0x9a')](_0x36b2('0x9d'));}}if(_0x151201[_0x36b2('0x4a')][_0x36b2('0x9e')]){var _0x2b93b9=_['isArray'](_0x151201[_0x36b2('0x4a')][_0x36b2('0x9e')])?_0x151201[_0x36b2('0x4a')]['tag']:new Array(_0x151201[_0x36b2('0x4a')][_0x36b2('0x9e')]);var _0xd9cc13=squel['expr']();_0x2b93b9[_0x36b2('0x44')](function(_0x7a8894){_0xd9cc13['or'](_0x36b2('0x9f'),'%,'+_0x7a8894+',%');});_0x1ffa30[_0x36b2('0x9a')](_0xd9cc13);_0x3dd137[_0x36b2('0x61')](_0x36b2('0xa0'),'it',_0x36b2('0xa1'));_0x3dd137[_0x36b2('0x61')](_0x36b2('0xa2'),'t',_0x36b2('0xa3'));_0x3dd137[_0x36b2('0x55')](_0x36b2('0xa4'),_0x2b93b9);}}else{var _0x247a5b=JSON[_0x36b2('0x6a')](_0x151201[_0x36b2('0x4a')][_0x36b2('0x69')]);_[_0x36b2('0x4b')](_0x247a5b)[_0x36b2('0x44')](function(_0x2133d7){var _0x987a01=_0x247a5b[_0x2133d7];if(_0x2133d7===_0x36b2('0x82')){var _0x3d0c43=_0x987a01['value'];var _0x1c69bc=squel['expr']();_0x3d0c43[_0x36b2('0x44')](function(_0x24752f){_0x1c69bc['or'](_0x36b2('0x9f'),'%,'+_0x24752f+',%');});_0x1ffa30[_0x36b2('0x9a')](_0x1c69bc);_0x3dd137[_0x36b2('0x61')]('mail_interaction_has_tags','it',_0x36b2('0xa5'));_0x3dd137['left_join'](_0x36b2('0xa2'),'t',_0x36b2('0xa3'));_0x3dd137[_0x36b2('0x55')](_0x36b2('0xa4'),_0x3d0c43);}else if(_0x2133d7==='Messages.count'){if(_0x987a01['value']['length']===0x1){if(_0x987a01[_0x36b2('0x6c')][0x0]===0x1){_0x3dd137['where'](util[_0x36b2('0x70')]('%s\x20=\x200',_0x13c133[_0x36b2('0x90')]()));_0x1ffa30['having'](_0x36b2('0x9b'));}else{_0x3dd137[_0x36b2('0x55')](util['format'](_0x36b2('0x9c'),_0x13c133[_0x36b2('0x90')]()));_0x1ffa30[_0x36b2('0x9a')](_0x36b2('0x9d'));}}}});}db[_0x36b2('0xa6')][_0x36b2('0x4a')](_0x3dd137[_0x36b2('0x90')](),_0x27c721)[_0x36b2('0x36')](function(_0xa244c7){_0x40d415[_0x36b2('0x2f')]=_0xa244c7['length'];if(_0x40d415[_0x36b2('0x2f')]===0x0)return[];return db['sequelize'][_0x36b2('0x4a')](_0x136658[_0x36b2('0x90')](),_0x27c721)[_0x36b2('0x36')](function(_0x13da89){_0x6806a8=_[_0x36b2('0xa7')](_0x13da89,'id');_0x27c721=_[_0x36b2('0xa8')](_0x27c721,{'model':db[_0x36b2('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x1ffa30[_0x36b2('0x58')](_0x36b2('0xa9'),'Account.key');_0x1ffa30[_0x36b2('0x58')]('i.*');_0x1ffa30[_0x36b2('0x58')](_0x36b2('0x7c'),_0x36b2('0xaa'));_0x1ffa30[_0x36b2('0x58')]('c.lastName','Contact.lastName');_0x1ffa30[_0x36b2('0x58')](_0x36b2('0x7f'),_0x36b2('0xab'));_0x1ffa30[_0x36b2('0x58')](_0x36b2('0xac'),_0x36b2('0xad'));_0x1ffa30[_0x36b2('0x58')]('c.mobile',_0x36b2('0xae'));_0x1ffa30[_0x36b2('0x58')](_0x36b2('0xaf'),_0x36b2('0xb0'));_0x1ffa30[_0x36b2('0x58')](_0x36b2('0xb1'),_0x36b2('0x42'));_0x1ffa30[_0x36b2('0x61')](_0x36b2('0xa0'),'it','it.ChatInteractionId\x20=\x20i.id');_0x1ffa30[_0x36b2('0x61')](_0x36b2('0xa2'),'t','t.id\x20=\x20it.TagId');_0x1ffa30[_0x36b2('0x31')](_0x2db7a2[_0x36b2('0x31')]);_0x1ffa30[_0x36b2('0x30')](_0x2db7a2[_0x36b2('0x30')]);return db[_0x36b2('0xa6')][_0x36b2('0x4a')](_0x1ffa30['toString'](),_0x27c721);})['then'](function(_0x243b3f){_0x20d9ea[_0x36b2('0x55')](_0x36b2('0xb2'),_['map'](_0x243b3f,'id'));return db[_0x36b2('0xa6')][_0x36b2('0x4a')](_0x20d9ea[_0x36b2('0x90')](),_0x27c721)[_0x36b2('0x36')](function(_0x47e85d){var _0xab283a=_['groupBy'](_0x47e85d,_0x36b2('0xb3'));var _0x317148=[];_0x243b3f['forEach'](function(_0x58cb46){_0x317148[_0x36b2('0x45')](updateChatInteraction(_0x58cb46,_0x6806a8,_0xab283a));});return BPromise[_0x36b2('0xb4')](_0x317148);});});})['then'](function(_0x3d9eba){_0x40d415[_0x36b2('0xb5')]=_0x3d9eba;return _0x40d415;})[_0x36b2('0x36')](respondWithFilteredResult(_0x325889,_0x2db7a2))[_0x36b2('0x2b')](handleError(_0x325889,null));};exports[_0x36b2('0xb6')]=function(_0x5aee52,_0x5b8d6a){var _0x7247ab={'raw':![],'where':{'id':_0x5aee52['params']['id']}},_0x33e84f={};_0x33e84f[_0x36b2('0x49')]=_[_0x36b2('0x4b')](db[_0x36b2('0x47')][_0x36b2('0x48')]);_0x33e84f[_0x36b2('0x4a')]=_['keys'](_0x5aee52[_0x36b2('0x4a')]);_0x33e84f[_0x36b2('0x4c')]=_[_0x36b2('0x4e')](_0x33e84f[_0x36b2('0x49')],_0x33e84f[_0x36b2('0x4a')]);_0x7247ab[_0x36b2('0x4d')]=_['intersection'](_0x33e84f[_0x36b2('0x49')],qs[_0x36b2('0x4f')](_0x5aee52[_0x36b2('0x4a')][_0x36b2('0x4f')]));_0x7247ab[_0x36b2('0x4d')]=_0x7247ab[_0x36b2('0x4d')][_0x36b2('0x50')]?_0x7247ab[_0x36b2('0x4d')]:_0x33e84f[_0x36b2('0x49')];if(_0x5aee52[_0x36b2('0x4a')][_0x36b2('0xb7')]){_0x7247ab['include']=[{'all':!![]}];}_0x7247ab=_[_0x36b2('0xa8')]({},_0x7247ab,_0x5aee52[_0x36b2('0xb8')]);return db[_0x36b2('0x47')][_0x36b2('0xb9')](_0x7247ab)[_0x36b2('0x36')](handleEntityNotFound(_0x5b8d6a,null))[_0x36b2('0x36')](respondWithResult(_0x5b8d6a,null))[_0x36b2('0x2b')](handleError(_0x5b8d6a,null));};exports['create']=function(_0x458dcc,_0x2fee44){return db['ChatInteraction'][_0x36b2('0xba')](_0x458dcc[_0x36b2('0xbb')],{})[_0x36b2('0x36')](respondWithResult(_0x2fee44,0xc9))['catch'](handleError(_0x2fee44,null));};exports[_0x36b2('0xbc')]=function(_0x14b3f5,_0x391bb3){if(_0x14b3f5['body']['id']){delete _0x14b3f5[_0x36b2('0xbb')]['id'];}return db[_0x36b2('0x47')][_0x36b2('0xb9')]({'where':{'id':_0x14b3f5['params']['id']}})[_0x36b2('0x36')](handleEntityNotFound(_0x391bb3,null))['then'](saveUpdates(_0x14b3f5[_0x36b2('0xbb')],null))[_0x36b2('0x36')](respondWithResult(_0x391bb3,null))[_0x36b2('0x2b')](handleError(_0x391bb3,null));};exports[_0x36b2('0x37')]=function(_0x120860,_0x4a76e1){return db[_0x36b2('0x47')][_0x36b2('0xb9')]({'where':{'id':_0x120860[_0x36b2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x4a76e1,null))[_0x36b2('0x36')](removeEntity(_0x4a76e1,null))[_0x36b2('0x2b')](handleError(_0x4a76e1,null));};exports[_0x36b2('0xbe')]=function(_0xef49a8,_0x150bd0){return db['ChatInteraction'][_0x36b2('0xbe')]()[_0x36b2('0x36')](respondWithResult(_0x150bd0,null))[_0x36b2('0x2b')](handleError(_0x150bd0,null));};exports[_0x36b2('0xbf')]=function(_0x1fdbdb,_0x4b49c3){if(_0x1fdbdb['body']['id']){delete _0x1fdbdb[_0x36b2('0xbb')]['id'];}return db[_0x36b2('0x47')]['find']({'where':{'id':_0x1fdbdb['params']['id']}})['then'](handleEntityNotFound(_0x4b49c3,null))['then'](saveUpdates(_0x1fdbdb['body'],null))[_0x36b2('0x36')](respondWithResult(_0x4b49c3,null))['catch'](handleError(_0x4b49c3,null));};exports['abandon']=function(_0x2f7015,_0x1480f8,_0x53a6e1){if(_0x2f7015[_0x36b2('0xbb')]['id']){delete _0x2f7015[_0x36b2('0xbb')]['id'];}return db['ChatInteraction'][_0x36b2('0xb9')]({'where':{'id':_0x2f7015[_0x36b2('0xbd')]['id']}})[_0x36b2('0x36')](function(_0x4a20cf){if(!_0x4a20cf){logger['error'](_0x36b2('0xc0'),'abandon',0x194,_0x36b2('0xc1'));_0x1480f8['sendStatus'](0x194);}else{if(_0x4a20cf['UserId']){throw new db[(_0x36b2('0xc2'))][(_0x36b2('0xc3'))]('Interaction\x20already\x20assigned');}}return _0x4a20cf;})['then'](function(_0x30c37b){if(_0x30c37b){return _0x30c37b[_0x36b2('0xbc')]({'closed':_0x2f7015[_0x36b2('0xbb')]['closed'],'disposition':_0x2f7015[_0x36b2('0xbb')][_0x36b2('0xc4')]})[_0x36b2('0x36')](function(_0x3ba0ef){return _0x3ba0ef;});}})[_0x36b2('0x36')](function(_0x51b8ea){return respondWithRpcPromise(_0x36b2('0xc5'),_0x36b2('0xc6'),_0x2f7015[_0x36b2('0xbb')],client9004);})['then'](respondWithResult(_0x1480f8,null))[_0x36b2('0x2b')](handleError(_0x1480f8,null));};exports[_0x36b2('0xc7')]=function(_0x4dce6e,_0x46245c,_0x291d51){_0x4dce6e[_0x36b2('0xbb')][_0x36b2('0x3a')]=_0x4dce6e[_0x36b2('0xc8')][_0x36b2('0xc9')];_0x4dce6e['body'][_0x36b2('0xca')]=_0x4dce6e[_0x36b2('0xc8')][_0x36b2('0xcb')];_0x4dce6e[_0x36b2('0xbb')][_0x36b2('0xcc')]=_0x4dce6e[_0x36b2('0xc8')][_0x36b2('0xcd')];return db['Attachment'][_0x36b2('0xba')](_0x4dce6e[_0x36b2('0xbb')])['then'](respondWithResult(_0x46245c,0xc9))[_0x36b2('0x2b')](handleError(_0x46245c,null));};exports[_0x36b2('0xce')]=function(_0x121de0,_0xca6b9b,_0x2a41fb){return db['ChatInteraction'][_0x36b2('0xcf')]({'where':{'id':_0x121de0[_0x36b2('0xbd')]['id']},'raw':!![]})[_0x36b2('0x36')](handleEntityNotFound(_0xca6b9b,null))['then'](function(_0x4aa5e4){if(_0x4aa5e4){if(_0x4aa5e4[_0x36b2('0x3c')]){return _0xca6b9b[_0x36b2('0x2c')](0x193)[_0x36b2('0x2e')]({'status':0x193,'message':'Unauthorized'});}return db[_0x36b2('0xd0')][_0x36b2('0xcf')]({'where':{'id':_0x121de0[_0x36b2('0x4a')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0xca6b9b,null));}})['then'](function(_0x525f8f){if(_0x525f8f){return _0xca6b9b[_0x36b2('0xd1')](path['join'](config['root'],'server/files/attachments/',_0x525f8f[_0x36b2('0xca')]));}})[_0x36b2('0x2b')](handleError(_0xca6b9b,null));};exports[_0x36b2('0xd2')]=function(_0x5b6736,_0x646c57){var _0x4ef409=null;var _0x42b61c=null;var _0x875d93=null;var _0x1fff1c=null;if(_0x5b6736[_0x36b2('0xbb')]['id']){delete _0x5b6736[_0x36b2('0xbb')]['id'];}if(_0x5b6736[_0x36b2('0xbb')]['mailTranscript']){_0x1fff1c=path[_0x36b2('0xd3')](config['root'],_0x36b2('0xd4'),util['format'](_0x36b2('0xd5'),Date[_0x36b2('0xd6')]()));_0x5b6736[_0x36b2('0xbb')][_0x36b2('0xd7')]=_0x1fff1c;}return db['ChatInteraction']['find']({'where':{'id':_0x5b6736[_0x36b2('0xbd')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x36b2('0xd8'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x36b2('0x36')](handleEntityNotFound(_0x646c57,null))[_0x36b2('0x36')](saveUpdates(_0x5b6736['body'],null))[_0x36b2('0x36')](function(_0xccf385){if(_0xccf385){_0x4ef409=_0xccf385;return db[_0x36b2('0xd9')]['find']({'where':{'id':_0x4ef409[_0x36b2('0xda')]}});}})[_0x36b2('0x36')](function(_0x2c13e1){if(_0x2c13e1){_0x875d93=_0x2c13e1;return db[_0x36b2('0xdb')][_0x36b2('0xb9')]({'where':{'id':_0x4ef409['ContactId']}});}})['then'](function(_0x3e4753){if(_0x3e4753){_0x42b61c=_0x3e4753;if(_0x1fff1c){var _0x3e0442=null;for(var _0x4077b0=0x1;_0x4077b0<_0x4ef409['Messages'][_0x36b2('0x50')];++_0x4077b0){_0x3e0442=_0x4ef409[_0x36b2('0xd8')][_0x4077b0];var _0x33f714=_0x3e0442[_0x36b2('0xdc')]?util[_0x36b2('0x70')](_0x36b2('0xdd'),_0x875d93[_0x36b2('0xde')],_0x3e0442[_0x36b2('0xdc')]):'System';var _0x17810c=_0x5b6736[_0x36b2('0xbb')]['customer']||util[_0x36b2('0x70')](_0x36b2('0xdd'),_0x36b2('0xdf'),_0x3e0442[_0x36b2('0x7b')]);switch(_0x875d93['agentIdentifier']){case _0x36b2('0xe0'):_0x33f714=_0x3e0442[_0x36b2('0xdc')]?util[_0x36b2('0x70')](_0x36b2('0xdd'),_0x875d93[_0x36b2('0xde')],_0x3e0442[_0x36b2('0xdc')]):_0x36b2('0xe1');break;case _0x36b2('0xe2'):_0x33f714=_0x3e0442[_0x36b2('0xdc')]?_0x3e0442[_0x36b2('0xe3')][_0x36b2('0xe4')]||_0x3e0442[_0x36b2('0xe3')][_0x36b2('0xe5')]:_0x36b2('0xe1');break;case _0x36b2('0xe6'):_0x33f714=_0x3e0442[_0x36b2('0xdc')]?_0x3e0442[_0x36b2('0xe3')]['fullname']:'System';break;default:_0x33f714=_0x3e0442[_0x36b2('0xdc')]?util[_0x36b2('0x70')]('%s%d',_0x875d93['agentAlias'],_0x3e0442[_0x36b2('0xdc')]):_0x36b2('0xe1');}var _0x646a1e=util[_0x36b2('0x70')](_0x36b2('0xe7'),moment(_0x3e0442['createdAt'])['format'](_0x36b2('0xe8')),_0x3e0442[_0x36b2('0xe9')]==='in'?_0x17810c:_0x33f714,_0x3e0442[_0x36b2('0xbb')]);if(!_0x3e0442['secret']){fs[_0x36b2('0xea')](_0x1fff1c,_0x646a1e);}}return db[_0x36b2('0xeb')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x36b2('0xec')],'as':'Smtp','raw':!![]}]});}}})[_0x36b2('0x36')](function(_0x894c25){if(_0x894c25&&_0x894c25[_0x36b2('0xed')]&&_0x5b6736[_0x36b2('0xbb')]){var _0xa7b9c4={'tls':{'rejectUnauthorized':![]}};if(_0x894c25[_0x36b2('0xed')][_0x36b2('0xee')]){_0xa7b9c4[_0x36b2('0xee')]=_0x894c25[_0x36b2('0xed')][_0x36b2('0xee')];}else{_0xa7b9c4[_0x36b2('0xef')]=_0x894c25[_0x36b2('0xed')][_0x36b2('0xef')];_0xa7b9c4[_0x36b2('0xf0')]=_0x894c25['Smtp'][_0x36b2('0xf0')];_0xa7b9c4['secure']=_0x894c25[_0x36b2('0xed')][_0x36b2('0xf1')];}if(_0x894c25[_0x36b2('0xed')][_0x36b2('0xf2')]){_0xa7b9c4[_0x36b2('0xf3')]={'user':_0x894c25[_0x36b2('0xed')][_0x36b2('0xf4')],'pass':_0x894c25[_0x36b2('0xed')][_0x36b2('0xf5')]};}return respondWithRpcPromise('SendMail',_0x36b2('0xf6'),{'account':_0xa7b9c4,'message':{'from':util[_0x36b2('0x70')]('\x22%s\x22\x20<%s>',_0x894c25[_0x36b2('0x3a')],_0x894c25[_0x36b2('0xf7')]||_0x894c25[_0x36b2('0xed')][_0x36b2('0xf4')]),'to':_0x5b6736[_0x36b2('0xbb')][_0x36b2('0xf8')],'subject':_0x36b2('0xf9'),'text':util[_0x36b2('0x70')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x5b6736[_0x36b2('0xbb')][_0x36b2('0xf8')]),'attachments':[{'path':_0x1fff1c}]}})[_0x36b2('0x36')](function(){return _0x4ef409;})['catch'](function(_0x2b8770){console[_0x36b2('0x27')](_0x2b8770);});}else{return _0x4ef409;}})[_0x36b2('0x36')](respondWithStatusCode(_0x646c57,0xc8))['catch'](handleError(_0x646c57,null));};exports[_0x36b2('0xfa')]=function(_0x4ac3ef,_0xe389e0,_0x169579){return db[_0x36b2('0x3e')]['find']({'where':{'id':_0x4ac3ef[_0x36b2('0xbd')]['id']}})[_0x36b2('0x36')](handleEntityNotFound(_0xe389e0,null))[_0x36b2('0x36')](function(_0x2c3834){if(_0x2c3834){return _0x2c3834[_0x36b2('0xfa')](_0x4ac3ef[_0x36b2('0xbb')][_0x36b2('0xfb')],_[_0x36b2('0xfc')](_0x4ac3ef[_0x36b2('0xbb')],[_0x36b2('0xfb'),'id'])||{});}})[_0x36b2('0x36')](respondWithResult(_0xe389e0,null))['catch'](handleError(_0xe389e0,null));};exports[_0x36b2('0xfd')]=function(_0x202317,_0x3d3510,_0x7110a3){var _0x3eae66={'raw':![],'where':{}};var _0x2595ec={};var _0x168920={'count':0x0,'rows':[]};return db[_0x36b2('0x47')][_0x36b2('0xcf')]({'where':{'id':_0x202317[_0x36b2('0xbd')]['id']}})[_0x36b2('0x36')](handleEntityNotFound(_0x3d3510,null))[_0x36b2('0x36')](function(_0x1176e7){if(_0x1176e7){_0x2595ec[_0x36b2('0x49')]=_[_0x36b2('0x4b')](db[_0x36b2('0x3e')][_0x36b2('0x48')]);_0x2595ec[_0x36b2('0x4a')]=_[_0x36b2('0x4b')](_0x202317['query']);_0x2595ec[_0x36b2('0x4c')]=_[_0x36b2('0x4e')](_0x2595ec[_0x36b2('0x49')],_0x2595ec[_0x36b2('0x4a')]);_0x3eae66[_0x36b2('0x4d')]=_[_0x36b2('0x4e')](_0x2595ec[_0x36b2('0x49')],qs[_0x36b2('0x4f')](_0x202317[_0x36b2('0x4a')]['fields']));_0x3eae66[_0x36b2('0x4d')]=_0x3eae66['attributes'][_0x36b2('0x50')]?_0x3eae66[_0x36b2('0x4d')]:_0x2595ec[_0x36b2('0x49')];if(!_0x202317['query'][_0x36b2('0x51')]('nolimit')){_0x3eae66[_0x36b2('0x31')]=qs[_0x36b2('0x31')](_0x202317[_0x36b2('0x4a')][_0x36b2('0x31')]);_0x3eae66[_0x36b2('0x30')]=qs['offset'](_0x202317['query']['offset']);}_0x3eae66[_0x36b2('0x53')]=qs[_0x36b2('0x54')](_0x202317[_0x36b2('0x4a')][_0x36b2('0x54')]);_0x3eae66[_0x36b2('0x55')]=qs[_0x36b2('0x4c')](_[_0x36b2('0x56')](_0x202317['query'],_0x2595ec[_0x36b2('0x4c')]));_0x3eae66[_0x36b2('0x55')]['ChatInteractionId']=_0x1176e7['id'];if(_0x202317[_0x36b2('0x4a')][_0x36b2('0x83')]){_0x3eae66['where']=_[_0x36b2('0xa8')](_0x3eae66[_0x36b2('0x55')],{'$or':_[_0x36b2('0x40')](_0x3eae66[_0x36b2('0x4d')],function(_0x35efc9){var _0x42c4b9={};_0x42c4b9[_0x35efc9]={'$like':'%'+_0x202317[_0x36b2('0x4a')]['filter']+'%'};return _0x42c4b9;})});}if(_0x202317[_0x36b2('0x4a')][_0x36b2('0x88')]){var _0xd13837=_0x202317[_0x36b2('0x4a')]['$gte'][_0x36b2('0x43')](',');var _0x405ca7={};_0x405ca7[_0xd13837[0x0]]={'$gte':moment(_0xd13837[0x1])[_0x36b2('0x70')](_0x36b2('0xfe'))};_0x3eae66[_0x36b2('0x55')]=_[_0x36b2('0xa8')](_0x3eae66['where'],_0x405ca7);}_0x3eae66=_[_0x36b2('0xa8')]({},_0x3eae66,_0x202317['options']);return db[_0x36b2('0x3e')][_0x36b2('0x2f')]({'where':_0x3eae66[_0x36b2('0x55')]})['then'](function(_0xa8c958){_0x168920[_0x36b2('0x2f')]=_0xa8c958;if(_0x202317[_0x36b2('0x4a')][_0x36b2('0xb7')]){_0x3eae66[_0x36b2('0xff')]=[{'all':!![]}];}return db[_0x36b2('0x3e')]['findAll'](_0x3eae66);})[_0x36b2('0x36')](function(_0x2b1cd6){_0x168920[_0x36b2('0xb5')]=_0x2b1cd6;return _0x168920;});}})[_0x36b2('0x36')](respondWithFilteredResult(_0x3d3510,_0x3eae66))[_0x36b2('0x2b')](handleError(_0x3d3510,null));};exports['getMyMessages']=function(_0x2d0edf,_0x929519,_0x303666){var _0x3996d1={'where':{}},_0xa33c8b={},_0x7f95fa={'count':0x0,'rows':[]};return db[_0x36b2('0x47')][_0x36b2('0xcf')]({'where':{'id':_0x2d0edf['params']['id']}})['then'](handleEntityNotFound(_0x929519,null))[_0x36b2('0x36')](function(_0x551d41){if(_0x551d41){_0xa33c8b['model']=_[_0x36b2('0x4b')](db[_0x36b2('0x3e')][_0x36b2('0x48')]);_0xa33c8b['query']=_[_0x36b2('0x4b')](_0x2d0edf[_0x36b2('0x4a')]);_0xa33c8b[_0x36b2('0x4c')]=_[_0x36b2('0x4e')](_0xa33c8b['model'],_0xa33c8b[_0x36b2('0x4a')]);_0x3996d1[_0x36b2('0x4d')]=_['intersection'](_0xa33c8b['model'],qs['fields'](_0x2d0edf[_0x36b2('0x4a')][_0x36b2('0x4f')]));_0x3996d1[_0x36b2('0x4d')]=_0x3996d1[_0x36b2('0x4d')][_0x36b2('0x50')]?_0x3996d1[_0x36b2('0x4d')]:_0xa33c8b['model'];if(!_0x2d0edf[_0x36b2('0x4a')][_0x36b2('0x51')]('nolimit')){_0x3996d1['limit']=qs[_0x36b2('0x31')](_0x2d0edf['query']['limit']);_0x3996d1[_0x36b2('0x30')]=qs[_0x36b2('0x30')](_0x2d0edf['query'][_0x36b2('0x30')]);}_0x3996d1[_0x36b2('0x53')]=qs[_0x36b2('0x54')](_0x2d0edf[_0x36b2('0x4a')][_0x36b2('0x54')]);_0x3996d1[_0x36b2('0x55')]=qs[_0x36b2('0x4c')](_[_0x36b2('0x56')](_0x2d0edf['query'],_0xa33c8b[_0x36b2('0x4c')]));_0x3996d1[_0x36b2('0x55')][_0x36b2('0xb3')]=_0x551d41['id'];if(_0x2d0edf['query'][_0x36b2('0x83')]){_0x3996d1['where']=_[_0x36b2('0xa8')](_0x3996d1[_0x36b2('0x55')],{'$or':_[_0x36b2('0x40')](_0x3996d1['attributes'],function(_0x46575b){var _0x2890e8={};_0x2890e8[_0x46575b]={'$like':'%'+_0x2d0edf[_0x36b2('0x4a')][_0x36b2('0x83')]+'%'};return _0x2890e8;})});}_0x3996d1[_0x36b2('0x55')][_0x36b2('0x100')]=![];if(_0x2d0edf[_0x36b2('0x4a')]['id']){_0x3996d1[_0x36b2('0x55')]['id']={'$gt':_0x2d0edf[_0x36b2('0x4a')]['id']};}_0x3996d1=_['merge']({},_0x3996d1,_0x2d0edf[_0x36b2('0xb8')]);return db[_0x36b2('0x3e')][_0x36b2('0x2f')]({'where':_0x3996d1[_0x36b2('0x55')]})[_0x36b2('0x36')](function(_0x1c0995){_0x7f95fa[_0x36b2('0x2f')]=_0x1c0995;_0x3996d1[_0x36b2('0xff')]=[];if(_0x2d0edf[_0x36b2('0x4a')][_0x36b2('0x101')]){_0x3996d1[_0x36b2('0xff')][_0x36b2('0x45')]({'model':db['User'],'as':_0x36b2('0xe3'),'attributes':['id',_0x36b2('0xe5'),_0x36b2('0xe4')]});}if(_0x2d0edf[_0x36b2('0x4a')]['includeAll']){_0x3996d1[_0x36b2('0xff')]=[{'all':!![]}];}return db['ChatMessage'][_0x36b2('0x102')](_0x3996d1);})[_0x36b2('0x36')](function(_0x23a3f6){_0x7f95fa[_0x36b2('0xb5')]=_0x23a3f6;return _0x7f95fa;});}})[_0x36b2('0x36')](respondWithFilteredResult(_0x929519,_0x3996d1))['catch'](handleError(_0x929519,null));};exports[_0x36b2('0x103')]=function(_0x4c821d,_0xb619a2,_0x149ace){return db['ChatInteraction'][_0x36b2('0xb9')]({'where':{'id':_0x4c821d[_0x36b2('0xbd')]['id']}})[_0x36b2('0x36')](handleEntityNotFound(_0xb619a2,null))[_0x36b2('0x36')](function(_0x5ee9fa){if(_0x5ee9fa){return _0x5ee9fa[_0x36b2('0x104')](_0x4c821d['body'][_0x36b2('0xfb')],_[_0x36b2('0xfc')](_0x4c821d[_0x36b2('0xbb')],['ids','id'])||{})[_0x36b2('0x105')](function(){return db[_0x36b2('0x106')][_0x36b2('0x102')]({'attributes':['id','name',_0x36b2('0x59')],'where':{'id':_0x4c821d[_0x36b2('0xbb')][_0x36b2('0xfb')]}});})[_0x36b2('0x36')](function(_0x25b129){socket[_0x36b2('0x107')]('chatInteractionTags:save',{'id':Number(_0x4c821d['params']['id']),'tags':_0x25b129||[]});return{'id':Number(_0x4c821d[_0x36b2('0xbd')]['id']),'tags':_0x25b129||[]};});}})[_0x36b2('0x36')](respondWithResult(_0xb619a2,null))[_0x36b2('0x2b')](handleError(_0xb619a2,null));};exports[_0x36b2('0x108')]=function(_0x28be68,_0x2a3162,_0x5bc177){return db['ChatInteraction'][_0x36b2('0xb9')]({'where':{'id':_0x28be68[_0x36b2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x2a3162,null))[_0x36b2('0x36')](function(_0x1819f6){if(_0x1819f6){return _0x1819f6[_0x36b2('0x108')](_0x28be68[_0x36b2('0x4a')]['ids']);}})[_0x36b2('0x36')](respondWithStatusCode(_0x2a3162,null))[_0x36b2('0x2b')](handleError(_0x2a3162,null));};exports[_0x36b2('0xd1')]=function(_0x559597,_0x22ef41){var _0x395713=moment()[_0x36b2('0x109')]()[_0x36b2('0x90')]();var _0x3a74e4=path[_0x36b2('0xd3')](config[_0x36b2('0x10a')],_0x36b2('0x10b'),_0x36b2('0x10c'),_0x36b2('0x10d'));var _0x5dc032=path[_0x36b2('0xd3')](config['root'],_0x36b2('0x10b'),_0x36b2('0x10c'),'attachments');var _0x226f22=path[_0x36b2('0xd3')](_0x3a74e4,_0x395713);var _0x4b59b4=util[_0x36b2('0x70')](_0x36b2('0x10e'),_0x559597[_0x36b2('0xbd')]['id'],_0x395713);var _0x2141e7=path[_0x36b2('0xd3')](_0x3a74e4,_0x4b59b4);var _0x1d085d=![];return db[_0x36b2('0x47')][_0x36b2('0xb9')]({'where':{'id':_0x559597[_0x36b2('0xbd')]['id']},'include':[{'model':db[_0x36b2('0x3e')],'as':'Messages','attributes':['id',_0x36b2('0xbb'),'createdAt',_0x36b2('0xe9'),_0x36b2('0x100')],'include':[{'model':db['User'],'as':_0x36b2('0xe3'),'attributes':['id',_0x36b2('0xe5')],'raw':!![]},{'model':db[_0x36b2('0xdb')],'as':_0x36b2('0x10f'),'attributes':['id',_0x36b2('0x110'),_0x36b2('0x111')],'raw':!![]},{'model':db[_0x36b2('0xd0')],'as':_0x36b2('0xd0'),'raw':!![]}]},{'model':db['ChatWebsite'],'as':_0x36b2('0x112'),'attributes':['id',_0x36b2('0x3a')]},{'model':db[_0x36b2('0xe3')],'as':_0x36b2('0x113'),'attributes':['id',_0x36b2('0xe5')]}]})[_0x36b2('0x36')](handleEntityNotFound(_0x22ef41,null))[_0x36b2('0x36')](function(_0x404699){if(_0x404699){var _0x2e35d5=_0x404699[_0x36b2('0x114')]({'plain':!![]});_0x1d085d=!![];var _0x3b81bc={'format':'A4','border':_0x36b2('0x115'),'header':{'height':_0x36b2('0x116'),'contents':{'first':_0x36b2('0x117')}},'footer':{'height':_0x36b2('0x118'),'contents':{'default':util['format'](_0x36b2('0x119'),util[_0x36b2('0x70')]('%s\x20#%d',_0x36b2('0x11a'),_0x2e35d5['id']),moment()[_0x36b2('0x70')](_0x36b2('0x11b'))[_0x36b2('0x90')]())}}};fs[_0x36b2('0x11c')](_0x226f22);var _0x48f077={'channel':_0x36b2('0x11a'),'account':_0x2e35d5[_0x36b2('0x112')]['name'],'agent':_0x2e35d5[_0x36b2('0x113')]?_0x2e35d5['Owner']['fullname']:_0x36b2('0x11d'),'createdAt':moment(_0x2e35d5['createdAt'])[_0x36b2('0x70')]('YYYY-MM-DD\x20HH:mm:ss')[_0x36b2('0x90')](),'closedAt':_0x2e35d5['closed']?moment(_0x2e35d5[_0x36b2('0x11e')])[_0x36b2('0x70')](_0x36b2('0xfe'))[_0x36b2('0x90')]():'','disposition':_0x2e35d5[_0x36b2('0xc4')],'chatInfo':{'browser':_0x2e35d5[_0x36b2('0x11f')],'os':_0x2e35d5[_0x36b2('0x120')],'referer':_0x2e35d5['referer'],'customerIp':_0x2e35d5[_0x36b2('0x121')]},'messages':_(_0x2e35d5[_0x36b2('0xd8')])[_0x36b2('0x122')]()[_0x36b2('0x83')]({'secret':![]})[_0x36b2('0x40')](function(_0x1d472e){if(_0x1d472e[_0x36b2('0xd0')]){var _0x52843f=path[_0x36b2('0xd3')](_0x5dc032,_0x1d472e[_0x36b2('0xd0')]['basename']);if(fs[_0x36b2('0x123')](_0x52843f)){fs[_0x36b2('0x124')](_0x52843f)[_0x36b2('0x125')](fs[_0x36b2('0x126')](path[_0x36b2('0xd3')](_0x226f22,_0x1d472e['Attachment'][_0x36b2('0xca')])));}}return{'date':moment(_0x1d472e[_0x36b2('0x6b')])[_0x36b2('0x70')](_0x36b2('0xfe'))['toString'](),'sender':_0x1d472e[_0x36b2('0xe9')]===_0x36b2('0x127')?_0x1d472e['User']?_0x1d472e[_0x36b2('0xe3')][_0x36b2('0xe5')]:_0x36b2('0xe1'):_0x1d472e[_0x36b2('0x10f')][_0x36b2('0x110')]+(_0x1d472e[_0x36b2('0x10f')][_0x36b2('0x111')]?'\x20'+_0x1d472e['Contact'][_0x36b2('0x111')]:''),'body':_0x1d472e[_0x36b2('0xd0')]?_0x1d472e[_0x36b2('0xd0')][_0x36b2('0xca')]:_0x1d472e[_0x36b2('0xbb')],'direction':_0x1d472e[_0x36b2('0xe9')]===_0x36b2('0x127')?'A':'C','secret':_0x1d472e[_0x36b2('0x100')],'attachment':_0x1d472e[_0x36b2('0xd0')]};})['value']()};return ejs[_0x36b2('0x128')](path['join'](config[_0x36b2('0x10a')],'server',_0x36b2('0x129'),_0x36b2('0x12a')),{'interaction':_0x48f077})[_0x36b2('0x36')](function(_0x4af016){return new BPromise(function(_0x14be5c,_0x2d5735){pdf[_0x36b2('0xba')](_0x4af016,_0x3b81bc)[_0x36b2('0x12b')](path[_0x36b2('0xd3')](_0x226f22,_0x36b2('0x12c')+_0x2e35d5['id']+'-'+_0x395713+'.pdf'),function(_0x5c9d27,_0x3a10e2){if(_0x5c9d27)return _0x2d5735(_0x5c9d27);_0x14be5c(_0x3a10e2);});});});}})[_0x36b2('0x36')](function(){if(_0x1d085d){return new BPromise(function(_0xc72e19,_0x54402e){zipdir(_0x226f22,{'saveTo':_0x2141e7},function(_0x293b73,_0x12bfa3){if(_0x293b73)return _0x54402e(_0x293b73);return _0xc72e19(_0x12bfa3);});})[_0x36b2('0x36')](function(){return new BPromise(function(_0x599a94,_0x13b1da){rimraf(_0x226f22,function(_0x1fbcef){if(_0x1fbcef)_0x13b1da(_0x1fbcef);return _0x599a94();});});})[_0x36b2('0x36')](function(){return _0x22ef41[_0x36b2('0xd1')](_0x2141e7,_0x4b59b4,function(_0x1290df){if(_0x1290df){console[_0x36b2('0x12d')]('err',_0x1290df);}else{fs[_0x36b2('0x12e')](_0x2141e7);}});});}else{return _0x22ef41[_0x36b2('0x38')](0xc8);}})['catch'](handleError(_0x22ef41,null));}; \ No newline at end of file +var _0x5db3=['where','pick','select','field','color','from','tools_tags','COUNT(*)','chat_messages','me.direction\x20=\x20\x27in\x27','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','expr','advancedFilter','createdAt','value','dateStart','startOf','day','format','utc','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','TagId','Messages.count','tableAlias','\x20=\x20?','ContactId','c.firstName','\x20LIKE\x20?','c.email','\x20>\x20?','\x20IN\x20?','LIKE','c.lastName','\x20<\x20?','map','isNil','ChatWebsiteId','$gte','parse','filter','replace','isNumeric','i.id\x20LIKE\x20?','join','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','order','DESC','group','i.id','Sequelize','QueryTypes','SELECT','clone','read','having','`Messages.count`\x20=\x200','%s\x20>\x200','`Messages.count`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','%s\x20=\x200','toString','sequelize','keyBy','a.key','Account.key','Contact.firstName','Contact.email','c.phone','c.fax','Contact.fax','groupBy','ChatInteractionId','all','rows','params','rawAttributes','includeAll','include','merge','options','find','create','body','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','ValidationError','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','download','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','pathTranscript','Messages','User','ChatWebsite','CmContact','%s%d','agentAlias','UserId','System','customer','agentIdentifier','website_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','auth','user','pass','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','addMessage','omit','ids','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','hasOwnProperty','setTags','spread','chatInteractionTags:save','removeTags','unix','server','files','tmp','Contact','lastName','Account','Owner','get','10px','30px','%s\x20#%d','Chat','N.A.','closedAt','osName','referer','customerIp','existsSync','pipe','createWriteStream','direction','out','firstName','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','./chatInteraction.socket','register','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','error','code','ChatInteraction,\x20%s,\x20%s','message','info','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','closed','unreadMessages','ChatMessage','Users','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','keys','query','filters','intersection','attributes','model','fields','length','nolimit','sort'];(function(_0xb880b7,_0x279a54){var _0x49aa41=function(_0x31daf1){while(--_0x31daf1){_0xb880b7['push'](_0xb880b7['shift']());}};_0x49aa41(++_0x279a54);}(_0x5db3,0x1d6));var _0x35db=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x5db3[_0x2e0443];return _0x52d450;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x35db('0x0'));var rimraf=require(_0x35db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35db('0x2'));var rp=require(_0x35db('0x3'));var moment=require(_0x35db('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x35db('0x5'));var csv=require(_0x35db('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x35db('0x7'));var squel=require(_0x35db('0x8'));var crypto=require('crypto');var jsforce=require(_0x35db('0x9'));var deskjs=require(_0x35db('0xa'));var toCsv=require('to-csv');var querystring=require(_0x35db('0xb'));var Papa=require(_0x35db('0xc'));var Redis=require('ioredis');var authService=require(_0x35db('0xd'));var qs=require(_0x35db('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x35db('0xf'));var db=require('../../mysqldb')['db'];config[_0x35db('0x10')]=_[_0x35db('0x11')](config[_0x35db('0x10')],{'host':_0x35db('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35db('0x10')]));require(_0x35db('0x13'))[_0x35db('0x14')](socket);var jayson=require('jayson/promise');var client=jayson[_0x35db('0x15')][_0x35db('0x16')]({'port':0x232b});var client9004=jayson[_0x35db('0x15')][_0x35db('0x16')]({'port':0x232c});function checkPasswordPattern(_0x399629,_0x239860,_0x1f8e9f){if(_0x1f8e9f){var _0x181a7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x181a7b['test'](_0x239860)){return _0x399629;}else{throw new Error(_0x35db('0x17'));}}else{return _0x399629;}}function respondWithRpcPromise(_0x1741d3,_0x57a860,_0x3ef926,_0x1a5a08){return new BPromise(function(_0x1f7c0e,_0x104eea){var _0x12060f=_0x1a5a08||client;return _0x12060f[_0x35db('0x18')](_0x1741d3,_0x3ef926)['then'](function(_0x324303){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x57a860,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x57a860,_0x35db('0x19'),JSON['stringify'](_0x324303));if(_0x324303[_0x35db('0x1a')]){if(_0x324303[_0x35db('0x1a')][_0x35db('0x1b')]===0x1f4){logger[_0x35db('0x1a')](_0x35db('0x1c'),_0x57a860,_0x324303[_0x35db('0x1a')][_0x35db('0x1d')]);return _0x104eea(_0x324303[_0x35db('0x1a')][_0x35db('0x1d')]);}logger[_0x35db('0x1a')](_0x35db('0x1c'),_0x57a860,_0x324303[_0x35db('0x1a')][_0x35db('0x1d')]);return _0x1f7c0e(_0x324303[_0x35db('0x1a')][_0x35db('0x1d')]);}else{logger[_0x35db('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x57a860,_0x35db('0x19'));_0x1f7c0e(_0x324303['result'][_0x35db('0x1d')]);}})['catch'](function(_0x4104b0){logger[_0x35db('0x1a')](_0x35db('0x1c'),_0x57a860,_0x4104b0);_0x104eea(_0x4104b0);});});}function respondWithStatusCode(_0x152fa3,_0x343448){_0x343448=_0x343448||0xcc;return function(_0x3d30ee){if(_0x3d30ee){return _0x152fa3[_0x35db('0x1f')](_0x343448);}return _0x152fa3[_0x35db('0x20')](_0x343448)[_0x35db('0x21')]();};}function respondWithResult(_0xdaa702,_0x4b60a8){_0x4b60a8=_0x4b60a8||0xc8;return function(_0x55bbbb){if(_0x55bbbb){return _0xdaa702[_0x35db('0x20')](_0x4b60a8)[_0x35db('0x22')](_0x55bbbb);}};}function respondWithFilteredResult(_0x4c2a52,_0x452079){return function(_0x14de43){if(_0x14de43){var _0xa74cef=_0x14de43[_0x35db('0x23')],_0x4f4b0d=_0x452079[_0x35db('0x24')],_0x3d5359=_0x452079[_0x35db('0x24')]+_0x452079[_0x35db('0x25')],_0x4d46f6;if(_0x3d5359>=_0xa74cef){_0x3d5359=_0xa74cef;_0x4d46f6=0xc8;}else{_0x4d46f6=0xce;}_0x4c2a52[_0x35db('0x20')](_0x4d46f6);return _0x4c2a52[_0x35db('0x26')](_0x35db('0x27'),_0x4f4b0d+'-'+_0x3d5359+'/'+_0xa74cef)['json'](_0x14de43);}return null;};}function patchUpdates(_0x54cbc8){return function(_0x383189){try{jsonpatch[_0x35db('0x28')](_0x383189,_0x54cbc8,!![]);}catch(_0x588126){return BPromise[_0x35db('0x29')](_0x588126);}return _0x383189['save']();};}function saveUpdates(_0x171406,_0x35d866){return function(_0x5e0a1e){if(_0x5e0a1e){return _0x5e0a1e[_0x35db('0x2a')](_0x171406)[_0x35db('0x2b')](function(_0x21daa1){return _0x21daa1;});}return null;};}function removeEntity(_0x1cdd85,_0x2d3478){return function(_0x5860bd){if(_0x5860bd){return _0x5860bd[_0x35db('0x2c')]()[_0x35db('0x2b')](function(){_0x1cdd85[_0x35db('0x20')](0xcc)[_0x35db('0x21')]();});}};}function handleEntityNotFound(_0x393070,_0xbc1659){return function(_0x4a1db5){if(!_0x4a1db5){_0x393070[_0x35db('0x1f')](0x194);}return _0x4a1db5;};}function handleError(_0x344efc,_0xb3810e){_0xb3810e=_0xb3810e||0x1f4;return function(_0x44d8e7){logger['error'](_0x44d8e7[_0x35db('0x2d')]);if(_0x44d8e7['name']){delete _0x44d8e7[_0x35db('0x2e')];}_0x344efc['status'](_0xb3810e)[_0x35db('0x2f')](_0x44d8e7);};}function getInteractionUnreadMessages(_0x1a39f2){return new BPromise(function(_0x4916d4,_0x522f41){try{if(_0x1a39f2[_0x35db('0x30')]){_0x1a39f2[_0x35db('0x31')]=0x0;_0x4916d4(_0x1a39f2);}else{return db[_0x35db('0x32')][_0x35db('0x23')]({'where':{'ChatInteractionId':_0x1a39f2['id'],'direction':'in','read':![]}})['then'](function(_0x292ea1){_0x1a39f2[_0x35db('0x31')]=_0x292ea1;_0x4916d4(_0x1a39f2);});}}catch(_0x5b005a){_0x522f41(_0x5b005a);}});}function getInteractionUsers(_0x285186,_0x218b22){return new BPromise(function(_0xcd870d,_0x1e2b9b){try{if(_0x218b22[_0x285186['id']]){_0x285186[_0x35db('0x33')]=_['map'](_0x218b22[_0x285186['id']],function(_0x69fe2a){return{'id':_0x69fe2a['id']};});}}catch(_0x5ec00c){_0x1e2b9b(_0x5ec00c);}_0xcd870d(_0x285186);});}function getInteractionTags(_0x199fca,_0x37bf1d){return new BPromise(function(_0x159f76,_0x4123db){try{if(_0x199fca[_0x35db('0x34')]){_0x199fca[_0x35db('0x35')]=[];_0x199fca[_0x35db('0x34')][_0x35db('0x36')](',')[_0x35db('0x37')](function(_0x5a782){_0x199fca['Tags'][_0x35db('0x38')](_0x37bf1d[_0x5a782]);});}delete _0x199fca[_0x35db('0x34')];}catch(_0x2e379e){_0x4123db(_0x2e379e);}_0x159f76(_0x199fca);});}function updateChatInteraction(_0x2e615f,_0x4a4288,_0x3a7525){return new BPromise(function(_0x520ee8,_0x3cf119){return getInteractionUnreadMessages(_0x2e615f)['then'](function(_0x1adef4){return getInteractionUsers(_0x1adef4,_0x3a7525);})[_0x35db('0x2b')](function(_0x1f03e8){return getInteractionTags(_0x1f03e8,_0x4a4288);})[_0x35db('0x2b')](function(_0x5cdecf){_0x520ee8(_0x5cdecf);})[_0x35db('0x39')](function(_0x3e896b){_0x3cf119(_0x3e896b);});});}exports[_0x35db('0x3a')]=function(_0x4c38c1,_0x39fe56){var _0x3a75dd={},_0x56c672={},_0x15636e={'count':0x0,'rows':[]};var _0x5021cd=db[_0x35db('0x3b')]['rawAttributes'];_0x56c672['model']=_[_0x35db('0x3c')](_0x5021cd);_0x56c672[_0x35db('0x3d')]=_[_0x35db('0x3c')](_0x4c38c1[_0x35db('0x3d')]);_0x56c672[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0x56c672['model'],_0x56c672['query']);_0x3a75dd[_0x35db('0x40')]=_[_0x35db('0x3f')](_0x56c672[_0x35db('0x41')],qs[_0x35db('0x42')](_0x4c38c1[_0x35db('0x3d')][_0x35db('0x42')]));_0x3a75dd[_0x35db('0x40')]=_0x3a75dd['attributes'][_0x35db('0x43')]?_0x3a75dd[_0x35db('0x40')]:_0x56c672[_0x35db('0x41')];if(!_0x4c38c1['query']['hasOwnProperty'](_0x35db('0x44'))){_0x3a75dd[_0x35db('0x25')]=qs['limit'](_0x4c38c1['query'][_0x35db('0x25')]);_0x3a75dd[_0x35db('0x24')]=qs[_0x35db('0x24')](_0x4c38c1[_0x35db('0x3d')][_0x35db('0x24')]);}_0x3a75dd['order']=qs['sort'](_0x4c38c1[_0x35db('0x3d')][_0x35db('0x45')]);_0x3a75dd[_0x35db('0x46')]=qs['filters'](_[_0x35db('0x47')](_0x4c38c1['query'],_0x56c672[_0x35db('0x3e')]));var _0x150020=[];var _0x3ad4c7=squel[_0x35db('0x48')]()[_0x35db('0x49')]('id')['field'](_0x35db('0x2e'))[_0x35db('0x49')](_0x35db('0x4a'))[_0x35db('0x4b')](_0x35db('0x4c'));var _0x3747a4=squel['select']()[_0x35db('0x49')](_0x35db('0x4d'))[_0x35db('0x4b')](_0x35db('0x4e'),'me')[_0x35db('0x46')]('me.ChatInteractionId\x20=\x20i.id')[_0x35db('0x46')](_0x35db('0x4f'))[_0x35db('0x46')]('me.read\x20=\x20false');var _0x5adc66=squel['select']()[_0x35db('0x49')]('u.id')[_0x35db('0x49')](_0x35db('0x50'))['from'](_0x35db('0x51'),'ui')[_0x35db('0x52')](_0x35db('0x53'),'u',_0x35db('0x54'));var _0x1ae871=squel[_0x35db('0x48')]()[_0x35db('0x4b')]('chat_interactions','i')[_0x35db('0x52')](_0x35db('0x55'),'c',_0x35db('0x56'))[_0x35db('0x52')](_0x35db('0x53'),'o',_0x35db('0x57'))['left_join'](_0x35db('0x58'),'a',_0x35db('0x59'))[_0x35db('0x52')]('chat_messages','me',_0x35db('0x5a'));var _0x52daa6=squel[_0x35db('0x5b')]();if(_0x4c38c1[_0x35db('0x3d')][_0x35db('0x5c')]){var _0x3cade7=JSON['parse'](_0x4c38c1[_0x35db('0x3d')][_0x35db('0x5c')]);_[_0x35db('0x3c')](_0x3cade7)[_0x35db('0x37')](function(_0x1c5062){var _0x1cd127=_0x3cade7[_0x1c5062];if(_0x1c5062===_0x35db('0x5d')){var _0x6b134c=moment(_0x1cd127[_0x35db('0x5e')][_0x35db('0x5f')])[_0x35db('0x60')](_0x35db('0x61'))['utc']()[_0x35db('0x62')]();var _0x40dd4a=moment(_0x40dd4a)[_0x35db('0x63')]()['endOf'](_0x35db('0x61'))[_0x35db('0x62')]();_0x52daa6[_0x35db('0x64')](_0x35db('0x65'),_0x6b134c,_0x40dd4a);}else{if(_[_0x35db('0x66')](_0x1cd127['condition'])){_0x1cd127['condition'][_0x35db('0x37')](function(_0x517085){switch(_0x1cd127[_0x35db('0x67')]['value']){case'IS':if(_0x1c5062!==_0x35db('0x68')&&_0x1c5062!==_0x35db('0x69')){if(_[_0x35db('0x66')](_0x1cd127[_0x35db('0x5e')])&&_0x1cd127[_0x35db('0x5e')][_0x35db('0x43')]>0x1){_0x52daa6[_0x35db('0x64')](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+'\x20IN\x20?',_0x1cd127['value']);}else{_0x52daa6[_0x35db('0x64')](_0x1cd127['tableAlias']+'.'+_0x1c5062+_0x35db('0x6b'),_0x1cd127[_0x35db('0x5e')][0x0]);}}break;case'=':_0x52daa6['and'](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+_0x35db('0x6b'),_0x1cd127[_0x35db('0x5e')]);break;case'LIKE':if(_0x1c5062===_0x35db('0x6c')){_0x52daa6[_0x35db('0x64')](_0x35db('0x6d')+'\x20LIKE\x20?','%'+_0x1cd127[_0x35db('0x5e')]+'%');_0x52daa6['or']('c.lastName'+_0x35db('0x6e'),'%'+_0x1cd127[_0x35db('0x5e')]+'%');_0x52daa6['or'](_0x35db('0x6f')+'\x20LIKE\x20?','%'+_0x1cd127['value']+'%');}else{_0x52daa6[_0x35db('0x64')](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+_0x35db('0x6e'),'%'+_0x1cd127[_0x35db('0x5e')]+'%');}break;case'>':_0x52daa6[_0x35db('0x64')](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+_0x35db('0x70'),_0x1cd127[_0x35db('0x5e')]);break;case'<':_0x52daa6[_0x35db('0x64')](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+'\x20<\x20?',_0x1cd127[_0x35db('0x5e')]);break;}});}else{switch(_0x1cd127[_0x35db('0x67')][_0x35db('0x5e')]){case'IS':if(_0x1c5062!==_0x35db('0x68')&&_0x1c5062!=='Messages.count'){if(_['isArray'](_0x1cd127[_0x35db('0x5e')])&&_0x1cd127[_0x35db('0x5e')]['length']>0x1){_0x52daa6['and'](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+_0x35db('0x71'),_0x1cd127[_0x35db('0x5e')]);}else{_0x52daa6[_0x35db('0x64')](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+_0x35db('0x6b'),_0x1cd127[_0x35db('0x5e')][0x0]);}}break;case'=':_0x52daa6[_0x35db('0x64')](_0x1cd127['tableAlias']+'.'+_0x1c5062+'\x20=\x20?',_0x1cd127['value']);break;case _0x35db('0x72'):if(_0x1c5062===_0x35db('0x6c')){_0x52daa6[_0x35db('0x64')]('c.firstName'+_0x35db('0x6e'),'%'+_0x1cd127[_0x35db('0x5e')]+'%');_0x52daa6['or'](_0x35db('0x73')+_0x35db('0x6e'),'%'+_0x1cd127[_0x35db('0x5e')]+'%');_0x52daa6['or']('c.email'+_0x35db('0x6e'),'%'+_0x1cd127[_0x35db('0x5e')]+'%');}else{_0x52daa6['and'](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+'\x20LIKE\x20?','%'+_0x1cd127[_0x35db('0x5e')]+'%');}break;case'>':_0x52daa6['and'](_0x1cd127['tableAlias']+'.'+_0x1c5062+'\x20>\x20?',_0x1cd127[_0x35db('0x5e')]);break;case'<':_0x52daa6['and'](_0x1cd127[_0x35db('0x6a')]+'.'+_0x1c5062+_0x35db('0x74'),_0x1cd127[_0x35db('0x5e')]);break;}}}});}else{var _0xe29eeb=_(Object[_0x35db('0x3c')](_0x4c38c1['query']))[_0x35db('0x75')](function(_0x4813a4){return _0x5021cd['hasOwnProperty'](_0x4813a4)?_0x4813a4:undefined;})['filter'](function(_0x1ed138){return!_[_0x35db('0x76')](_0x1ed138);})[_0x35db('0x5e')]();if(!_['isEmpty'](_0xe29eeb)){_0xe29eeb[_0x35db('0x37')](function(_0x2d5d8b){if(_0x2d5d8b===_0x35db('0x77')){_0x1ae871[_0x35db('0x46')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x4c38c1[_0x35db('0x3d')][_0x2d5d8b]));}else if(_0x2d5d8b===_0x35db('0x5d')){var _0x1a8da6=JSON['parse'](_0x4c38c1[_0x35db('0x3d')][_0x2d5d8b])[_0x35db('0x78')];var _0x2d5ba1=JSON[_0x35db('0x79')](_0x4c38c1['query'][_0x2d5d8b])['$lte'];_0x1ae871['where'](_0x35db('0x65'),_0x1a8da6,_0x2d5ba1);}else{if(_0x4c38c1[_0x35db('0x3d')][_0x2d5d8b]==='null'){_0x1ae871['where']('i.'+_0x2d5d8b+'\x20IS\x20NULL');}else{_0x1ae871[_0x35db('0x46')]('i.'+_0x2d5d8b+_0x35db('0x6b'),_0x4c38c1['query'][_0x2d5d8b]);}}});}if(_0x4c38c1['query']['filter']){var _0x3ca4a4=_0x4c38c1[_0x35db('0x3d')][_0x35db('0x7a')][_0x35db('0x7b')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x35db('0x7c')](_0x3ca4a4)){_0x52daa6['or'](_0x35db('0x7d'),_0x3ca4a4+'%');}else{var _0x236206=[];_0x3ca4a4[_0x35db('0x36')]('\x20')['forEach'](function(_0x362663){_0x236206[_0x35db('0x38')]('+'+_0x362663['toString']());});var _0x5234ea=_0x236206[_0x35db('0x7e')]('\x20');_0x52daa6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',_0x5234ea)['or'](_0x35db('0x7f'),_0x3ca4a4+'%');}}}_0x1ae871[_0x35db('0x46')](_0x52daa6);if(_0x3a75dd[_0x35db('0x80')]){_0x3a75dd[_0x35db('0x80')][_0x35db('0x37')](function(_0x443976){_0x1ae871[_0x35db('0x80')]('i.'+_0x443976[0x0],_0x443976[0x1]===_0x35db('0x81')?![]:!![]);});}_0x1ae871[_0x35db('0x82')](_0x35db('0x83'));var _0x25dfeb={'type':db[_0x35db('0x84')][_0x35db('0x85')][_0x35db('0x86')],'raw':!![]};var _0x5b7329=_0x1ae871[_0x35db('0x87')]()[_0x35db('0x49')](_0x35db('0x4d'));if(!_0x4c38c1[_0x35db('0x3d')][_0x35db('0x5c')]){if(_0x4c38c1['query'][_0x35db('0x88')]){if(_0x4c38c1['query'][_0x35db('0x88')]==0x1){_0x5b7329[_0x35db('0x46')](util[_0x35db('0x62')]('%s\x20=\x200',_0x3747a4['toString']()));_0x1ae871[_0x35db('0x89')](_0x35db('0x8a'));}else{_0x5b7329[_0x35db('0x46')](util[_0x35db('0x62')](_0x35db('0x8b'),_0x3747a4['toString']()));_0x1ae871[_0x35db('0x89')](_0x35db('0x8c'));}}if(_0x4c38c1['query'][_0x35db('0x8d')]){var _0x1dfdaf=_[_0x35db('0x66')](_0x4c38c1['query'][_0x35db('0x8d')])?_0x4c38c1[_0x35db('0x3d')][_0x35db('0x8d')]:new Array(_0x4c38c1[_0x35db('0x3d')][_0x35db('0x8d')]);var _0x2355ec=squel[_0x35db('0x5b')]();_0x1dfdaf[_0x35db('0x37')](function(_0x23dc01){_0x2355ec['or'](_0x35db('0x8e'),'%,'+_0x23dc01+',%');});_0x1ae871['having'](_0x2355ec);_0x5b7329[_0x35db('0x52')](_0x35db('0x8f'),'it',_0x35db('0x90'));_0x5b7329[_0x35db('0x52')](_0x35db('0x4c'),'t',_0x35db('0x91'));_0x5b7329[_0x35db('0x46')]('t.id\x20IN\x20?',_0x1dfdaf);}}else{var _0x3cade7=JSON[_0x35db('0x79')](_0x4c38c1['query'][_0x35db('0x5c')]);_[_0x35db('0x3c')](_0x3cade7)[_0x35db('0x37')](function(_0x115330){var _0x3380a2=_0x3cade7[_0x115330];if(_0x115330==='TagId'){var _0x4b7e56=_0x3380a2[_0x35db('0x5e')];var _0x3e8a93=squel[_0x35db('0x5b')]();_0x4b7e56[_0x35db('0x37')](function(_0x1115c1){_0x3e8a93['or'](_0x35db('0x8e'),'%,'+_0x1115c1+',%');});_0x1ae871[_0x35db('0x89')](_0x3e8a93);_0x5b7329[_0x35db('0x52')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id');_0x5b7329[_0x35db('0x52')](_0x35db('0x4c'),'t',_0x35db('0x91'));_0x5b7329['where'](_0x35db('0x92'),_0x4b7e56);}else if(_0x115330===_0x35db('0x69')){if(_0x3380a2[_0x35db('0x5e')][_0x35db('0x43')]===0x1){if(_0x3380a2[_0x35db('0x5e')][0x0]===0x1){_0x5b7329[_0x35db('0x46')](util['format'](_0x35db('0x93'),_0x3747a4[_0x35db('0x94')]()));_0x1ae871[_0x35db('0x89')]('`Messages.count`\x20=\x200');}else{_0x5b7329[_0x35db('0x46')](util[_0x35db('0x62')]('%s\x20>\x200',_0x3747a4[_0x35db('0x94')]()));_0x1ae871[_0x35db('0x89')]('`Messages.count`\x20>\x200');}}}});}db[_0x35db('0x95')][_0x35db('0x3d')](_0x5b7329[_0x35db('0x94')](),_0x25dfeb)[_0x35db('0x2b')](function(_0x80f87){_0x15636e[_0x35db('0x23')]=_0x80f87[_0x35db('0x43')];if(_0x15636e['count']===0x0)return[];return db['sequelize'][_0x35db('0x3d')](_0x3ad4c7['toString'](),_0x25dfeb)[_0x35db('0x2b')](function(_0x2d6086){_0x150020=_[_0x35db('0x96')](_0x2d6086,'id');_0x25dfeb=_['merge'](_0x25dfeb,{'model':db[_0x35db('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x1ae871[_0x35db('0x49')](_0x35db('0x97'),_0x35db('0x98'));_0x1ae871[_0x35db('0x49')]('i.*');_0x1ae871['field'](_0x35db('0x6d'),_0x35db('0x99'));_0x1ae871[_0x35db('0x49')](_0x35db('0x73'),'Contact.lastName');_0x1ae871[_0x35db('0x49')](_0x35db('0x6f'),_0x35db('0x9a'));_0x1ae871['field'](_0x35db('0x9b'),'Contact.phone');_0x1ae871[_0x35db('0x49')]('c.mobile','Contact.mobile');_0x1ae871['field'](_0x35db('0x9c'),_0x35db('0x9d'));_0x1ae871['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x35db('0x34'));_0x1ae871[_0x35db('0x52')]('chat_interaction_has_tags','it',_0x35db('0x90'));_0x1ae871['left_join'](_0x35db('0x4c'),'t',_0x35db('0x91'));_0x1ae871[_0x35db('0x25')](_0x3a75dd[_0x35db('0x25')]);_0x1ae871['offset'](_0x3a75dd['offset']);return db[_0x35db('0x95')][_0x35db('0x3d')](_0x1ae871['toString'](),_0x25dfeb);})[_0x35db('0x2b')](function(_0x3c0304){_0x5adc66[_0x35db('0x46')]('ui.ChatInteractionId\x20IN\x20?',_[_0x35db('0x75')](_0x3c0304,'id'));return db[_0x35db('0x95')][_0x35db('0x3d')](_0x5adc66['toString'](),_0x25dfeb)[_0x35db('0x2b')](function(_0x2e19ca){var _0x5f5b01=_[_0x35db('0x9e')](_0x2e19ca,_0x35db('0x9f'));var _0x1248cf=[];_0x3c0304['forEach'](function(_0x558a4b){_0x1248cf[_0x35db('0x38')](updateChatInteraction(_0x558a4b,_0x150020,_0x5f5b01));});return BPromise[_0x35db('0xa0')](_0x1248cf);});});})[_0x35db('0x2b')](function(_0x40823d){_0x15636e[_0x35db('0xa1')]=_0x40823d;return _0x15636e;})[_0x35db('0x2b')](respondWithFilteredResult(_0x39fe56,_0x3a75dd))['catch'](handleError(_0x39fe56,null));};exports['show']=function(_0x12b378,_0x30bf00){var _0x33fe9d={'raw':![],'where':{'id':_0x12b378[_0x35db('0xa2')]['id']}},_0x530e44={};_0x530e44[_0x35db('0x41')]=_['keys'](db[_0x35db('0x3b')][_0x35db('0xa3')]);_0x530e44[_0x35db('0x3d')]=_['keys'](_0x12b378['query']);_0x530e44[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0x530e44[_0x35db('0x41')],_0x530e44[_0x35db('0x3d')]);_0x33fe9d[_0x35db('0x40')]=_[_0x35db('0x3f')](_0x530e44['model'],qs[_0x35db('0x42')](_0x12b378['query'][_0x35db('0x42')]));_0x33fe9d[_0x35db('0x40')]=_0x33fe9d[_0x35db('0x40')][_0x35db('0x43')]?_0x33fe9d[_0x35db('0x40')]:_0x530e44[_0x35db('0x41')];if(_0x12b378[_0x35db('0x3d')][_0x35db('0xa4')]){_0x33fe9d[_0x35db('0xa5')]=[{'all':!![]}];}_0x33fe9d=_[_0x35db('0xa6')]({},_0x33fe9d,_0x12b378[_0x35db('0xa7')]);return db['ChatInteraction'][_0x35db('0xa8')](_0x33fe9d)[_0x35db('0x2b')](handleEntityNotFound(_0x30bf00,null))[_0x35db('0x2b')](respondWithResult(_0x30bf00,null))['catch'](handleError(_0x30bf00,null));};exports[_0x35db('0xa9')]=function(_0x494475,_0x13d45c){return db[_0x35db('0x3b')][_0x35db('0xa9')](_0x494475['body'],{})[_0x35db('0x2b')](respondWithResult(_0x13d45c,0xc9))[_0x35db('0x39')](handleError(_0x13d45c,null));};exports[_0x35db('0x2a')]=function(_0x1dfbfa,_0x1db9a6){if(_0x1dfbfa[_0x35db('0xaa')]['id']){delete _0x1dfbfa['body']['id'];}return db[_0x35db('0x3b')][_0x35db('0xa8')]({'where':{'id':_0x1dfbfa[_0x35db('0xa2')]['id']}})[_0x35db('0x2b')](handleEntityNotFound(_0x1db9a6,null))[_0x35db('0x2b')](saveUpdates(_0x1dfbfa['body'],null))['then'](respondWithResult(_0x1db9a6,null))[_0x35db('0x39')](handleError(_0x1db9a6,null));};exports['destroy']=function(_0x303bd6,_0xb29767){return db[_0x35db('0x3b')][_0x35db('0xa8')]({'where':{'id':_0x303bd6[_0x35db('0xa2')]['id']}})['then'](handleEntityNotFound(_0xb29767,null))[_0x35db('0x2b')](removeEntity(_0xb29767,null))[_0x35db('0x39')](handleError(_0xb29767,null));};exports['describe']=function(_0x2f1f93,_0x127032){return db[_0x35db('0x3b')][_0x35db('0xab')]()[_0x35db('0x2b')](respondWithResult(_0x127032,null))[_0x35db('0x39')](handleError(_0x127032,null));};exports[_0x35db('0xac')]=function(_0x10e708,_0x34b670){if(_0x10e708[_0x35db('0xaa')]['id']){delete _0x10e708[_0x35db('0xaa')]['id'];}return db[_0x35db('0x3b')][_0x35db('0xa8')]({'where':{'id':_0x10e708[_0x35db('0xa2')]['id']}})[_0x35db('0x2b')](handleEntityNotFound(_0x34b670,null))[_0x35db('0x2b')](saveUpdates(_0x10e708['body'],null))[_0x35db('0x2b')](respondWithResult(_0x34b670,null))[_0x35db('0x39')](handleError(_0x34b670,null));};exports[_0x35db('0xad')]=function(_0x2c09cc,_0x49ce22,_0x4a65aa){if(_0x2c09cc[_0x35db('0xaa')]['id']){delete _0x2c09cc['body']['id'];}return db[_0x35db('0x3b')]['find']({'where':{'id':_0x2c09cc['params']['id']}})[_0x35db('0x2b')](function(_0x70de7b){if(!_0x70de7b){logger['error'](_0x35db('0xae'),'abandon',0x194,'entity\x20not\x20found');_0x49ce22[_0x35db('0x1f')](0x194);}else{if(_0x70de7b['UserId']){throw new db[(_0x35db('0x84'))][(_0x35db('0xaf'))](_0x35db('0xb0'));}}return _0x70de7b;})[_0x35db('0x2b')](function(_0x2e95ad){if(_0x2e95ad){return _0x2e95ad[_0x35db('0x2a')]({'closed':_0x2c09cc[_0x35db('0xaa')]['closed'],'disposition':_0x2c09cc[_0x35db('0xaa')][_0x35db('0xb1')]})['then'](function(_0x163bf8){return _0x163bf8;});}})[_0x35db('0x2b')](function(_0x50d03d){return respondWithRpcPromise(_0x35db('0xb2'),_0x35db('0xad'),_0x2c09cc[_0x35db('0xaa')],client9004);})['then'](respondWithResult(_0x49ce22,null))[_0x35db('0x39')](handleError(_0x49ce22,null));};exports[_0x35db('0xb3')]=function(_0x3aa8e4,_0x4bf814,_0x405413){_0x3aa8e4['body'][_0x35db('0x2e')]=_0x3aa8e4[_0x35db('0xb4')][_0x35db('0xb5')];_0x3aa8e4[_0x35db('0xaa')][_0x35db('0xb6')]=_0x3aa8e4[_0x35db('0xb4')][_0x35db('0xb7')];_0x3aa8e4[_0x35db('0xaa')][_0x35db('0xb8')]=_0x3aa8e4[_0x35db('0xb4')][_0x35db('0xb9')];return db[_0x35db('0xba')][_0x35db('0xa9')](_0x3aa8e4[_0x35db('0xaa')])['then'](respondWithResult(_0x4bf814,0xc9))[_0x35db('0x39')](handleError(_0x4bf814,null));};exports[_0x35db('0xbb')]=function(_0xe11523,_0x4c6d9a,_0x4fcf44){return db[_0x35db('0x3b')][_0x35db('0xbc')]({'where':{'id':_0xe11523[_0x35db('0xa2')]['id']},'raw':!![]})[_0x35db('0x2b')](handleEntityNotFound(_0x4c6d9a,null))[_0x35db('0x2b')](function(_0x4d0126){if(_0x4d0126){if(_0x4d0126[_0x35db('0x30')]){return _0x4c6d9a[_0x35db('0x20')](0x193)[_0x35db('0x22')]({'status':0x193,'message':_0x35db('0xbd')});}return db[_0x35db('0xba')][_0x35db('0xbc')]({'where':{'id':_0xe11523['query'][_0x35db('0xbe')]},'raw':!![]})['then'](handleEntityNotFound(_0x4c6d9a,null));}})['then'](function(_0x206b8a){if(_0x206b8a){return _0x4c6d9a[_0x35db('0xbf')](path[_0x35db('0x7e')](config[_0x35db('0xc0')],_0x35db('0xc1'),_0x206b8a[_0x35db('0xb6')]));}})['catch'](handleError(_0x4c6d9a,null));};exports[_0x35db('0xc2')]=function(_0x51fd3f,_0x17dc9b){var _0x57fe43=null;var _0x5e8bd1=null;var _0x47bd8f=null;var _0x294568=null;if(_0x51fd3f[_0x35db('0xaa')]['id']){delete _0x51fd3f[_0x35db('0xaa')]['id'];}if(_0x51fd3f['body'][_0x35db('0xc3')]){_0x294568=path[_0x35db('0x7e')](config['root'],_0x35db('0xc4'),util[_0x35db('0x62')]('transcript-%s.txt',Date['now']()));_0x51fd3f[_0x35db('0xaa')][_0x35db('0xc5')]=_0x294568;}return db[_0x35db('0x3b')][_0x35db('0xa8')]({'where':{'id':_0x51fd3f[_0x35db('0xa2')]['id']},'include':[{'model':db[_0x35db('0x32')],'as':_0x35db('0xc6'),'include':[{'model':db[_0x35db('0xc7')],'as':'User'}]}]})[_0x35db('0x2b')](handleEntityNotFound(_0x17dc9b,null))[_0x35db('0x2b')](saveUpdates(_0x51fd3f[_0x35db('0xaa')],null))[_0x35db('0x2b')](function(_0x4333be){if(_0x4333be){_0x57fe43=_0x4333be;return db[_0x35db('0xc8')]['find']({'where':{'id':_0x57fe43[_0x35db('0x77')]}});}})[_0x35db('0x2b')](function(_0xd9ba75){if(_0xd9ba75){_0x47bd8f=_0xd9ba75;return db[_0x35db('0xc9')]['find']({'where':{'id':_0x57fe43[_0x35db('0x6c')]}});}})[_0x35db('0x2b')](function(_0x52aed1){if(_0x52aed1){_0x5e8bd1=_0x52aed1;if(_0x294568){var _0x177a82=null;for(var _0x24b328=0x1;_0x24b328<_0x57fe43[_0x35db('0xc6')]['length'];++_0x24b328){_0x177a82=_0x57fe43[_0x35db('0xc6')][_0x24b328];var _0x56e726=_0x177a82['UserId']?util[_0x35db('0x62')](_0x35db('0xca'),_0x47bd8f[_0x35db('0xcb')],_0x177a82[_0x35db('0xcc')]):_0x35db('0xcd');var _0x5428a9=_0x51fd3f[_0x35db('0xaa')][_0x35db('0xce')]||util[_0x35db('0x62')](_0x35db('0xca'),'Visitor',_0x177a82['ContactId']);switch(_0x47bd8f[_0x35db('0xcf')]){case _0x35db('0xd0'):_0x56e726=_0x177a82[_0x35db('0xcc')]?util['format'](_0x35db('0xca'),_0x47bd8f['agentAlias'],_0x177a82['UserId']):_0x35db('0xcd');break;case'agent_alias':_0x56e726=_0x177a82[_0x35db('0xcc')]?_0x177a82[_0x35db('0xc7')][_0x35db('0xd1')]||_0x177a82['User'][_0x35db('0xd2')]:_0x35db('0xcd');break;case'agent_fullname':_0x56e726=_0x177a82[_0x35db('0xcc')]?_0x177a82[_0x35db('0xc7')][_0x35db('0xd2')]:_0x35db('0xcd');break;default:_0x56e726=_0x177a82[_0x35db('0xcc')]?util['format'](_0x35db('0xca'),_0x47bd8f['agentAlias'],_0x177a82[_0x35db('0xcc')]):_0x35db('0xcd');}var _0x1c9ec4=util[_0x35db('0x62')](_0x35db('0xd3'),moment(_0x177a82[_0x35db('0x5d')])[_0x35db('0x62')](_0x35db('0xd4')),_0x177a82['direction']==='in'?_0x5428a9:_0x56e726,_0x177a82[_0x35db('0xaa')]);if(!_0x177a82[_0x35db('0xd5')]){fs['appendFileSync'](_0x294568,_0x1c9ec4);}}return db[_0x35db('0xd6')][_0x35db('0xbc')]({'where':{'service':!![]},'include':[{'model':db[_0x35db('0xd7')],'as':'Smtp','raw':!![]}]});}}})[_0x35db('0x2b')](function(_0x3de83c){if(_0x3de83c&&_0x3de83c[_0x35db('0xd8')]&&_0x51fd3f[_0x35db('0xaa')]){var _0x30a47e={'tls':{'rejectUnauthorized':![]}};if(_0x3de83c['Smtp'][_0x35db('0xd9')]){_0x30a47e[_0x35db('0xd9')]=_0x3de83c[_0x35db('0xd8')][_0x35db('0xd9')];}else{_0x30a47e['host']=_0x3de83c[_0x35db('0xd8')][_0x35db('0xda')];_0x30a47e[_0x35db('0xdb')]=_0x3de83c[_0x35db('0xd8')]['port'];_0x30a47e['secure']=_0x3de83c[_0x35db('0xd8')]['secure'];}if(_0x3de83c['Smtp']['authentication']){_0x30a47e[_0x35db('0xdc')]={'user':_0x3de83c['Smtp'][_0x35db('0xdd')],'pass':_0x3de83c[_0x35db('0xd8')][_0x35db('0xde')]};}return respondWithRpcPromise('SendMail',_0x35db('0xdf'),{'account':_0x30a47e,'message':{'from':util[_0x35db('0x62')](_0x35db('0xe0'),_0x3de83c[_0x35db('0x2e')],_0x3de83c[_0x35db('0xe1')]||_0x3de83c['Smtp'][_0x35db('0xdd')]),'to':_0x51fd3f[_0x35db('0xaa')][_0x35db('0xc3')],'subject':_0x35db('0xe2'),'text':util[_0x35db('0x62')](_0x35db('0xe3'),_0x51fd3f[_0x35db('0xaa')][_0x35db('0xc3')]),'attachments':[{'path':_0x294568}]}})['then'](function(){return _0x57fe43;})['catch'](function(_0x14ad62){console[_0x35db('0x1a')](_0x14ad62);});}else{return _0x57fe43;}})[_0x35db('0x2b')](respondWithStatusCode(_0x17dc9b,0xc8))[_0x35db('0x39')](handleError(_0x17dc9b,null));};exports[_0x35db('0xe4')]=function(_0x2b8486,_0x5a5f32,_0x54f6c1){return db[_0x35db('0x32')][_0x35db('0xa8')]({'where':{'id':_0x2b8486['params']['id']}})['then'](handleEntityNotFound(_0x5a5f32,null))[_0x35db('0x2b')](function(_0x15fd51){if(_0x15fd51){return _0x15fd51[_0x35db('0xe4')](_0x2b8486['body']['ids'],_[_0x35db('0xe5')](_0x2b8486[_0x35db('0xaa')],[_0x35db('0xe6'),'id'])||{});}})[_0x35db('0x2b')](respondWithResult(_0x5a5f32,null))[_0x35db('0x39')](handleError(_0x5a5f32,null));};exports['getMessages']=function(_0x4438cf,_0x501c70,_0x1c6efe){var _0x4df42c={'raw':![],'where':{}};var _0xa76986={};var _0xcc8fa5={'count':0x0,'rows':[]};return db[_0x35db('0x3b')][_0x35db('0xbc')]({'where':{'id':_0x4438cf[_0x35db('0xa2')]['id']}})[_0x35db('0x2b')](handleEntityNotFound(_0x501c70,null))[_0x35db('0x2b')](function(_0x293ab8){if(_0x293ab8){_0xa76986[_0x35db('0x41')]=_['keys'](db[_0x35db('0x32')]['rawAttributes']);_0xa76986[_0x35db('0x3d')]=_['keys'](_0x4438cf[_0x35db('0x3d')]);_0xa76986[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0xa76986[_0x35db('0x41')],_0xa76986[_0x35db('0x3d')]);_0x4df42c['attributes']=_['intersection'](_0xa76986['model'],qs[_0x35db('0x42')](_0x4438cf['query'][_0x35db('0x42')]));_0x4df42c[_0x35db('0x40')]=_0x4df42c['attributes'][_0x35db('0x43')]?_0x4df42c[_0x35db('0x40')]:_0xa76986['model'];if(!_0x4438cf[_0x35db('0x3d')]['hasOwnProperty'](_0x35db('0x44'))){_0x4df42c['limit']=qs['limit'](_0x4438cf[_0x35db('0x3d')][_0x35db('0x25')]);_0x4df42c[_0x35db('0x24')]=qs[_0x35db('0x24')](_0x4438cf[_0x35db('0x3d')]['offset']);}_0x4df42c[_0x35db('0x80')]=qs[_0x35db('0x45')](_0x4438cf[_0x35db('0x3d')]['sort']);_0x4df42c[_0x35db('0x46')]=qs[_0x35db('0x3e')](_[_0x35db('0x47')](_0x4438cf[_0x35db('0x3d')],_0xa76986[_0x35db('0x3e')]));_0x4df42c['where'][_0x35db('0x9f')]=_0x293ab8['id'];if(_0x4438cf[_0x35db('0x3d')][_0x35db('0x7a')]){_0x4df42c[_0x35db('0x46')]=_['merge'](_0x4df42c[_0x35db('0x46')],{'$or':_[_0x35db('0x75')](_0x4df42c[_0x35db('0x40')],function(_0x35f83b){var _0x144279={};_0x144279[_0x35f83b]={'$like':'%'+_0x4438cf[_0x35db('0x3d')][_0x35db('0x7a')]+'%'};return _0x144279;})});}if(_0x4438cf[_0x35db('0x3d')][_0x35db('0x78')]){var _0x682e1b=_0x4438cf[_0x35db('0x3d')][_0x35db('0x78')][_0x35db('0x36')](',');var _0x277072={};_0x277072[_0x682e1b[0x0]]={'$gte':moment(_0x682e1b[0x1])[_0x35db('0x62')](_0x35db('0xe7'))};_0x4df42c[_0x35db('0x46')]=_['merge'](_0x4df42c[_0x35db('0x46')],_0x277072);}_0x4df42c=_['merge']({},_0x4df42c,_0x4438cf['options']);return db[_0x35db('0x32')][_0x35db('0x23')]({'where':_0x4df42c[_0x35db('0x46')]})['then'](function(_0x25c5f2){_0xcc8fa5[_0x35db('0x23')]=_0x25c5f2;if(_0x4438cf[_0x35db('0x3d')][_0x35db('0xa4')]){_0x4df42c['include']=[{'all':!![]}];}return db[_0x35db('0x32')][_0x35db('0xe8')](_0x4df42c);})['then'](function(_0x3572c4){_0xcc8fa5[_0x35db('0xa1')]=_0x3572c4;return _0xcc8fa5;});}})[_0x35db('0x2b')](respondWithFilteredResult(_0x501c70,_0x4df42c))[_0x35db('0x39')](handleError(_0x501c70,null));};exports[_0x35db('0xe9')]=function(_0x24cb25,_0x2b5b1c,_0x3f9e9f){var _0x5de9f5={'where':{}},_0x2fb2f5={},_0x36716e={'count':0x0,'rows':[]};return db[_0x35db('0x3b')][_0x35db('0xbc')]({'where':{'id':_0x24cb25['params']['id']}})['then'](handleEntityNotFound(_0x2b5b1c,null))[_0x35db('0x2b')](function(_0x591004){if(_0x591004){_0x2fb2f5['model']=_[_0x35db('0x3c')](db[_0x35db('0x32')]['rawAttributes']);_0x2fb2f5['query']=_[_0x35db('0x3c')](_0x24cb25[_0x35db('0x3d')]);_0x2fb2f5[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0x2fb2f5[_0x35db('0x41')],_0x2fb2f5[_0x35db('0x3d')]);_0x5de9f5[_0x35db('0x40')]=_['intersection'](_0x2fb2f5['model'],qs[_0x35db('0x42')](_0x24cb25['query']['fields']));_0x5de9f5[_0x35db('0x40')]=_0x5de9f5[_0x35db('0x40')][_0x35db('0x43')]?_0x5de9f5['attributes']:_0x2fb2f5[_0x35db('0x41')];if(!_0x24cb25['query'][_0x35db('0xea')](_0x35db('0x44'))){_0x5de9f5[_0x35db('0x25')]=qs[_0x35db('0x25')](_0x24cb25[_0x35db('0x3d')][_0x35db('0x25')]);_0x5de9f5[_0x35db('0x24')]=qs['offset'](_0x24cb25[_0x35db('0x3d')][_0x35db('0x24')]);}_0x5de9f5[_0x35db('0x80')]=qs[_0x35db('0x45')](_0x24cb25[_0x35db('0x3d')][_0x35db('0x45')]);_0x5de9f5[_0x35db('0x46')]=qs['filters'](_[_0x35db('0x47')](_0x24cb25['query'],_0x2fb2f5[_0x35db('0x3e')]));_0x5de9f5[_0x35db('0x46')][_0x35db('0x9f')]=_0x591004['id'];if(_0x24cb25['query']['filter']){_0x5de9f5[_0x35db('0x46')]=_[_0x35db('0xa6')](_0x5de9f5[_0x35db('0x46')],{'$or':_[_0x35db('0x75')](_0x5de9f5[_0x35db('0x40')],function(_0xaf9b08){var _0x1d595a={};_0x1d595a[_0xaf9b08]={'$like':'%'+_0x24cb25[_0x35db('0x3d')]['filter']+'%'};return _0x1d595a;})});}_0x5de9f5[_0x35db('0x46')]['secret']=![];if(_0x24cb25['query']['id']){_0x5de9f5[_0x35db('0x46')]['id']={'$gt':_0x24cb25[_0x35db('0x3d')]['id']};}_0x5de9f5=_['merge']({},_0x5de9f5,_0x24cb25['options']);return db['ChatMessage']['count']({'where':_0x5de9f5[_0x35db('0x46')]})['then'](function(_0x3d6091){_0x36716e[_0x35db('0x23')]=_0x3d6091;_0x5de9f5[_0x35db('0xa5')]=[];if(_0x24cb25[_0x35db('0x3d')]['includeAgent']){_0x5de9f5[_0x35db('0xa5')][_0x35db('0x38')]({'model':db[_0x35db('0xc7')],'as':_0x35db('0xc7'),'attributes':['id','fullname','alias']});}if(_0x24cb25[_0x35db('0x3d')]['includeAll']){_0x5de9f5[_0x35db('0xa5')]=[{'all':!![]}];}return db[_0x35db('0x32')]['findAll'](_0x5de9f5);})[_0x35db('0x2b')](function(_0x2094d6){_0x36716e['rows']=_0x2094d6;return _0x36716e;});}})[_0x35db('0x2b')](respondWithFilteredResult(_0x2b5b1c,_0x5de9f5))[_0x35db('0x39')](handleError(_0x2b5b1c,null));};exports['addTags']=function(_0x36f3f8,_0x2d970e,_0x111001){return db['ChatInteraction'][_0x35db('0xa8')]({'where':{'id':_0x36f3f8[_0x35db('0xa2')]['id']}})[_0x35db('0x2b')](handleEntityNotFound(_0x2d970e,null))[_0x35db('0x2b')](function(_0x3168f5){if(_0x3168f5){return _0x3168f5[_0x35db('0xeb')](_0x36f3f8[_0x35db('0xaa')][_0x35db('0xe6')],_[_0x35db('0xe5')](_0x36f3f8[_0x35db('0xaa')],[_0x35db('0xe6'),'id'])||{})[_0x35db('0xec')](function(){return db['Tag'][_0x35db('0xe8')]({'attributes':['id','name',_0x35db('0x4a')],'where':{'id':_0x36f3f8[_0x35db('0xaa')]['ids']}});})[_0x35db('0x2b')](function(_0x14fec0){socket['emit'](_0x35db('0xed'),{'id':Number(_0x36f3f8[_0x35db('0xa2')]['id']),'tags':_0x14fec0||[]});return{'id':Number(_0x36f3f8[_0x35db('0xa2')]['id']),'tags':_0x14fec0||[]};});}})[_0x35db('0x2b')](respondWithResult(_0x2d970e,null))['catch'](handleError(_0x2d970e,null));};exports[_0x35db('0xee')]=function(_0x5991fa,_0x34cdb2,_0x40960a){return db[_0x35db('0x3b')][_0x35db('0xa8')]({'where':{'id':_0x5991fa[_0x35db('0xa2')]['id']}})[_0x35db('0x2b')](handleEntityNotFound(_0x34cdb2,null))[_0x35db('0x2b')](function(_0x1afef4){if(_0x1afef4){return _0x1afef4[_0x35db('0xee')](_0x5991fa[_0x35db('0x3d')][_0x35db('0xe6')]);}})[_0x35db('0x2b')](respondWithStatusCode(_0x34cdb2,null))[_0x35db('0x39')](handleError(_0x34cdb2,null));};exports[_0x35db('0xbf')]=function(_0x5b8148,_0x7ace4){var _0x246aa6=moment()[_0x35db('0xef')]()[_0x35db('0x94')]();var _0x10e234=path['join'](config['root'],_0x35db('0xf0'),_0x35db('0xf1'),_0x35db('0xf2'));var _0x3b44a6=path[_0x35db('0x7e')](config[_0x35db('0xc0')],_0x35db('0xf0'),_0x35db('0xf1'),'attachments');var _0x5b945d=path[_0x35db('0x7e')](_0x10e234,_0x246aa6);var _0x12a389=util[_0x35db('0x62')]('transcript-%d-%s.zip',_0x5b8148['params']['id'],_0x246aa6);var _0x10f325=path['join'](_0x10e234,_0x12a389);var _0x28e408=![];return db[_0x35db('0x3b')]['find']({'where':{'id':_0x5b8148[_0x35db('0xa2')]['id']},'include':[{'model':db[_0x35db('0x32')],'as':_0x35db('0xc6'),'attributes':['id',_0x35db('0xaa'),'createdAt','direction',_0x35db('0xd5')],'include':[{'model':db[_0x35db('0xc7')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db[_0x35db('0xc9')],'as':_0x35db('0xf3'),'attributes':['id','firstName',_0x35db('0xf4')],'raw':!![]},{'model':db[_0x35db('0xba')],'as':_0x35db('0xba'),'raw':!![]}]},{'model':db['ChatWebsite'],'as':_0x35db('0xf5'),'attributes':['id',_0x35db('0x2e')]},{'model':db[_0x35db('0xc7')],'as':_0x35db('0xf6'),'attributes':['id','fullname']}]})[_0x35db('0x2b')](handleEntityNotFound(_0x7ace4,null))[_0x35db('0x2b')](function(_0x23826e){if(_0x23826e){var _0xea427=_0x23826e[_0x35db('0xf7')]({'plain':!![]});_0x28e408=!![];var _0x21d7c0={'format':'A4','border':_0x35db('0xf8'),'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\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\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x35db('0xf9'),'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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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[_0x35db('0x62')](_0x35db('0xfa'),_0x35db('0xfb'),_0xea427['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};fs['mkdirSync'](_0x5b945d);var _0x22b7f7={'channel':_0x35db('0xfb'),'account':_0xea427[_0x35db('0xf5')]['name'],'agent':_0xea427['Owner']?_0xea427[_0x35db('0xf6')][_0x35db('0xd2')]:_0x35db('0xfc'),'createdAt':moment(_0xea427[_0x35db('0x5d')])[_0x35db('0x62')]('YYYY-MM-DD\x20HH:mm:ss')[_0x35db('0x94')](),'closedAt':_0xea427[_0x35db('0x30')]?moment(_0xea427[_0x35db('0xfd')])[_0x35db('0x62')](_0x35db('0xe7'))['toString']():'','disposition':_0xea427[_0x35db('0xb1')],'chatInfo':{'browser':_0xea427['browserName'],'os':_0xea427[_0x35db('0xfe')],'referer':_0xea427[_0x35db('0xff')],'customerIp':_0xea427[_0x35db('0x100')]},'messages':_(_0xea427[_0x35db('0xc6')])['tail']()[_0x35db('0x7a')]({'secret':![]})[_0x35db('0x75')](function(_0x404297){if(_0x404297[_0x35db('0xba')]){var _0x876d3f=path[_0x35db('0x7e')](_0x3b44a6,_0x404297[_0x35db('0xba')]['basename']);if(fs[_0x35db('0x101')](_0x876d3f)){fs['createReadStream'](_0x876d3f)[_0x35db('0x102')](fs[_0x35db('0x103')](path[_0x35db('0x7e')](_0x5b945d,_0x404297[_0x35db('0xba')][_0x35db('0xb6')])));}}return{'date':moment(_0x404297[_0x35db('0x5d')])[_0x35db('0x62')](_0x35db('0xe7'))[_0x35db('0x94')](),'sender':_0x404297[_0x35db('0x104')]===_0x35db('0x105')?_0x404297[_0x35db('0xc7')]?_0x404297[_0x35db('0xc7')][_0x35db('0xd2')]:_0x35db('0xcd'):_0x404297[_0x35db('0xf3')][_0x35db('0x106')]+(_0x404297[_0x35db('0xf3')][_0x35db('0xf4')]?'\x20'+_0x404297[_0x35db('0xf3')][_0x35db('0xf4')]:''),'body':_0x404297[_0x35db('0xba')]?_0x404297[_0x35db('0xba')][_0x35db('0xb6')]:_0x404297['body'],'direction':_0x404297[_0x35db('0x104')]===_0x35db('0x105')?'A':'C','secret':_0x404297[_0x35db('0xd5')],'attachment':_0x404297[_0x35db('0xba')]};})[_0x35db('0x5e')]()};return ejs['renderFile'](path['join'](config[_0x35db('0xc0')],'server','views',_0x35db('0x107')),{'interaction':_0x22b7f7})[_0x35db('0x2b')](function(_0x1013ac){return new BPromise(function(_0x31f4a8,_0x2496df){pdf[_0x35db('0xa9')](_0x1013ac,_0x21d7c0)[_0x35db('0x108')](path['join'](_0x5b945d,_0x35db('0x109')+_0xea427['id']+'-'+_0x246aa6+_0x35db('0x10a')),function(_0x4d2b64,_0x270c02){if(_0x4d2b64)return _0x2496df(_0x4d2b64);_0x31f4a8(_0x270c02);});});});}})['then'](function(){if(_0x28e408){return new BPromise(function(_0x5d6f79,_0xbf9333){zipdir(_0x5b945d,{'saveTo':_0x10f325},function(_0x4d767f,_0x1fba7c){if(_0x4d767f)return _0xbf9333(_0x4d767f);return _0x5d6f79(_0x1fba7c);});})['then'](function(){return new BPromise(function(_0x322d91,_0x3e6d89){rimraf(_0x5b945d,function(_0xf26f05){if(_0xf26f05)_0x3e6d89(_0xf26f05);return _0x322d91();});});})[_0x35db('0x2b')](function(){return _0x7ace4[_0x35db('0xbf')](_0x10f325,_0x12a389,function(_0x431c87){if(_0x431c87){console[_0x35db('0x10b')](_0x35db('0x10c'),_0x431c87);}else{fs[_0x35db('0x10d')](_0x10f325);}});});}else{return _0x7ace4[_0x35db('0x1f')](0xc8);}})['catch'](handleError(_0x7ace4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 27d48df..f67e812 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 _0x6e7b=['catch','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x50b976,_0x490862){var _0x183cf2=function(_0x4bf00b){while(--_0x4bf00b){_0x50b976['push'](_0x50b976['shift']());}};_0x183cf2(++_0x490862);}(_0x6e7b,0x193));var _0xb6e7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6e7b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xb6e7('0x0'))['db'][_0xb6e7('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb6e7('0x2')](0x0);var events={'afterCreate':_0xb6e7('0x3'),'afterUpdate':_0xb6e7('0x4'),'afterDestroy':_0xb6e7('0x5')};function emitEvent(_0x53cdbe){return function(_0x517267,_0x5de771,_0x4b1c05){_0x517267[_0xb6e7('0x6')]({'attributes':['id'],'raw':!![]})[_0xb6e7('0x7')](function(_0x30be9d){_0x517267[_0xb6e7('0x8')](_0xb6e7('0x9'),_0x30be9d[_0xb6e7('0xa')](function(_0xdc8114){return{'id':_0xdc8114['id']};}));return ChatMessage[_0xb6e7('0xb')]({'where':{'ChatInteractionId':_0x517267['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb6e7('0x7')](function(_0x10ebb1){_0x517267['setDataValue'](_0xb6e7('0xc'),_0x10ebb1[_0xb6e7('0xd')]);ChatInteractionEvents[_0xb6e7('0xe')](_0x53cdbe+':'+_0x517267['id'],_0x517267);ChatInteractionEvents[_0xb6e7('0xe')](_0x53cdbe,_0x517267);_0x4b1c05(null);})[_0xb6e7('0xf')](_0x4b1c05(null));};}for(var e in events){if(events[_0xb6e7('0x10')](e)){var event=events[e];ChatInteraction[_0xb6e7('0x11')](e,emitEvent(event));}}module[_0xb6e7('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x30a0=['save','update','getUsers','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners'];(function(_0x2ac3dd,_0x3bc187){var _0x487a05=function(_0x40bce1){while(--_0x40bce1){_0x2ac3dd['push'](_0x2ac3dd['shift']());}};_0x487a05(++_0x3bc187);}(_0x30a0,0xb0));var _0x030a=function(_0x4a02cf,_0x5ff8b9){_0x4a02cf=_0x4a02cf-0x0;var _0xb1a83f=_0x30a0[_0x4a02cf];return _0xb1a83f;};'use strict';var EventEmitter=require(_0x030a('0x0'));var ChatInteraction=require(_0x030a('0x1'))['db'][_0x030a('0x2')];var ChatMessage=require(_0x030a('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x030a('0x3')](0x0);var events={'afterCreate':_0x030a('0x4'),'afterUpdate':_0x030a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4babca){return function(_0x561733,_0x115408,_0x56bbb8){_0x561733[_0x030a('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe26406){_0x561733[_0x030a('0x7')](_0x030a('0x8'),_0xe26406['map'](function(_0x37c920){return{'id':_0x37c920['id']};}));return ChatMessage[_0x030a('0x9')]({'where':{'ChatInteractionId':_0x561733['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2dc85b){_0x561733[_0x030a('0x7')](_0x030a('0xa'),_0x2dc85b[_0x030a('0xb')]);ChatInteractionEvents['emit'](_0x4babca+':'+_0x561733['id'],_0x561733);ChatInteractionEvents['emit'](_0x4babca,_0x561733);_0x56bbb8(null);})[_0x030a('0xc')](_0x56bbb8(null));};}for(var e in events){if(events[_0x030a('0xd')](e)){var event=events[e];ChatInteraction[_0x030a('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c52d7f6..d928d2e 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 _0x0713=['exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x1cf9b6,_0x209cc3){var _0x27ff1c=function(_0x9535f6){while(--_0x9535f6){_0x1cf9b6['push'](_0x1cf9b6['shift']());}};_0x27ff1c(++_0x209cc3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22274c,_0x3e9a5e,_0x2fce7a){if(_0x22274c[_0x3071('0xc')]('closed')){_0x22274c[_0x3071('0xd')]=moment()[_0x3071('0xe')](_0x3071('0xf'));}_0x2fce7a(null,_0x22274c);}},'charset':_0x3071('0x10'),'collate':_0x3071('0x11')});}; \ No newline at end of file +var _0xd8b0=['request-promise','path','rimraf','../../config/environment','define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInteraction',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x284169,_0x58e4e2,_0x129310){if(_0x284169[_0x0d8b('0x9')](_0x0d8b('0xa'))){_0x284169[_0x0d8b('0xb')]=moment()[_0x0d8b('0xc')](_0x0d8b('0xd'));}_0x129310(null,_0x284169);}},'charset':_0x0d8b('0xe'),'collate':_0x0d8b('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b58e10d..a23b6b9 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 _0x670b=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction','omit','spread','AddTags'];(function(_0x557709,_0x306adf){var _0xd8c6c9=function(_0x291cbe){while(--_0x291cbe){_0x557709['push'](_0x557709['shift']());}};_0xd8c6c9(++_0x306adf);}(_0x670b,0x111));var _0xb670=function(_0x108484,_0x45b224){_0x108484=_0x108484-0x0;var _0x2c77a3=_0x670b[_0x108484];return _0x2c77a3;};'use strict';var _=require(_0xb670('0x0'));var util=require(_0xb670('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb670('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb670('0x3'))['db'];var utils=require(_0xb670('0x4'));var logger=require(_0xb670('0x5'))('rpc');var config=require(_0xb670('0x6'));var jayson=require(_0xb670('0x7'));var client=jayson[_0xb670('0x8')]['http']({'port':0x232a});config['redis']=_[_0xb670('0x9')](config[_0xb670('0xa')],{'host':_0xb670('0xb'),'port':0x18eb});var socket=require(_0xb670('0xc'))(new Redis(config['redis']));require(_0xb670('0xd'))[_0xb670('0xe')](socket);function respondWithRpcPromise(_0x156510,_0x28ed2d,_0x3d7475){return new BPromise(function(_0x465186,_0x33e121){return client[_0xb670('0xf')](_0x156510,_0x3d7475)[_0xb670('0x10')](function(_0x128dad){logger['info'](_0xb670('0x11'),_0x28ed2d,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x28ed2d,_0xb670('0x12'),JSON[_0xb670('0x13')](_0x128dad));if(_0x128dad[_0xb670('0x14')]){if(_0x128dad[_0xb670('0x14')][_0xb670('0x15')]===0x1f4){logger[_0xb670('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x28ed2d,_0x128dad[_0xb670('0x14')]['message']);return _0x33e121(_0x128dad[_0xb670('0x14')][_0xb670('0x16')]);}logger[_0xb670('0x14')](_0xb670('0x11'),_0x28ed2d,_0x128dad[_0xb670('0x14')][_0xb670('0x16')]);return _0x465186(_0x128dad['error'][_0xb670('0x16')]);}else{logger[_0xb670('0x17')](_0xb670('0x11'),_0x28ed2d,'request\x20sent');_0x465186(_0x128dad[_0xb670('0x18')][_0xb670('0x16')]);}})[_0xb670('0x19')](function(_0x324eb0){logger[_0xb670('0x14')](_0xb670('0x11'),_0x28ed2d,_0x324eb0);_0x33e121(_0x324eb0);});});}exports[_0xb670('0x1a')]=function(_0x3ef4b3){var _0x73fa20=this;return new Promise(function(_0x56ed59,_0xfe431d){return db[_0xb670('0x1b')]['update'](_0x3ef4b3[_0xb670('0x1c')],{'raw':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3[_0xb670('0x1d')][_0xb670('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3[_0xb670('0x1d')][_0xb670('0x1f')]||null:null,'attributes':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3['options'][_0xb670('0x20')]||null:null,'limit':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3[_0xb670('0x1d')][_0xb670('0x21')]||null:null})['then'](function(_0x4e60a3){logger['info']('UpdateChatInteraction',_0x3ef4b3);logger[_0xb670('0x22')](_0xb670('0x1a'),_0x3ef4b3,JSON['stringify'](_0x4e60a3));_0x56ed59(_0x4e60a3);})[_0xb670('0x19')](function(_0x7277f4){logger[_0xb670('0x14')]('UpdateChatInteraction',_0x7277f4[_0xb670('0x16')],_0x3ef4b3);_0xfe431d(_0x73fa20[_0xb670('0x14')](0x1f4,_0x7277f4[_0xb670('0x16')]));});});};exports[_0xb670('0x23')]=function(_0x2f92ab){return new Promise(function(_0x4f49f9,_0x51c17c){return db['ChatInteraction']['find']({'where':_0x2f92ab[_0xb670('0x1d')]?_0x2f92ab[_0xb670('0x1d')][_0xb670('0x1f')]||null:null})[_0xb670('0x10')](function(_0x2b0a35){if(_0x2b0a35){return _0x2b0a35['addTags'](_0x2f92ab[_0xb670('0x1c')]['ids'],_[_0xb670('0x24')](_0x2f92ab['body'],['ids','id'])||{});}})[_0xb670('0x25')](function(_0x5f423d){logger[_0xb670('0x17')](_0xb670('0x26'),_0x2f92ab);logger[_0xb670('0x22')]('AddTags',_0x2f92ab,JSON['stringify'](_0x5f423d));_0x4f49f9(_0x5f423d);})[_0xb670('0x19')](function(_0x452370){logger[_0xb670('0x14')]('AddTags',_0x452370[_0xb670('0x16')],_0x2f92ab);_0x51c17c(_this[_0xb670('0x14')](0x1f4,_0x452370[_0xb670('0x16')]));});});}; \ No newline at end of file +var _0x73f0=['stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','ChatInteraction','update','options','where','attributes','limit','UpdateChatInteraction','debug','find','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./chatInteraction.socket','register','request','then','request\x20sent'];(function(_0x377c26,_0xb31a5a){var _0x581944=function(_0x209e61){while(--_0x209e61){_0x377c26['push'](_0x377c26['shift']());}};_0x581944(++_0xb31a5a);}(_0x73f0,0xe3));var _0x073f=function(_0x3d889c,_0x38b195){_0x3d889c=_0x3d889c-0x0;var _0x3e9559=_0x73f0[_0x3d889c];return _0x3e9559;};'use strict';var _=require(_0x073f('0x0'));var util=require('util');var moment=require(_0x073f('0x1'));var BPromise=require(_0x073f('0x2'));var rs=require(_0x073f('0x3'));var fs=require('fs');var Redis=require(_0x073f('0x4'));var db=require(_0x073f('0x5'))['db'];var utils=require(_0x073f('0x6'));var logger=require(_0x073f('0x7'))(_0x073f('0x8'));var config=require(_0x073f('0x9'));var jayson=require(_0x073f('0xa'));var client=jayson['client'][_0x073f('0xb')]({'port':0x232a});config[_0x073f('0xc')]=_[_0x073f('0xd')](config[_0x073f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x073f('0xc')]));require(_0x073f('0xe'))[_0x073f('0xf')](socket);function respondWithRpcPromise(_0x425b1f,_0x42dbad,_0x57e509){return new BPromise(function(_0x4a2476,_0x232d64){return client[_0x073f('0x10')](_0x425b1f,_0x57e509)[_0x073f('0x11')](function(_0xb1e813){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x42dbad,_0x073f('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x42dbad,_0x073f('0x12'),JSON[_0x073f('0x13')](_0xb1e813));if(_0xb1e813[_0x073f('0x14')]){if(_0xb1e813[_0x073f('0x14')][_0x073f('0x15')]===0x1f4){logger[_0x073f('0x14')](_0x073f('0x16'),_0x42dbad,_0xb1e813[_0x073f('0x14')][_0x073f('0x17')]);return _0x232d64(_0xb1e813[_0x073f('0x14')]['message']);}logger[_0x073f('0x14')](_0x073f('0x16'),_0x42dbad,_0xb1e813[_0x073f('0x14')][_0x073f('0x17')]);return _0x4a2476(_0xb1e813[_0x073f('0x14')][_0x073f('0x17')]);}else{logger[_0x073f('0x18')](_0x073f('0x16'),_0x42dbad,_0x073f('0x12'));_0x4a2476(_0xb1e813[_0x073f('0x19')]['message']);}})[_0x073f('0x1a')](function(_0xee598e){logger[_0x073f('0x14')](_0x073f('0x16'),_0x42dbad,_0xee598e);_0x232d64(_0xee598e);});});}exports['UpdateChatInteraction']=function(_0x4554a5){var _0x7d1315=this;return new Promise(function(_0x4ad96c,_0x44b85b){return db[_0x073f('0x1b')][_0x073f('0x1c')](_0x4554a5['body'],{'raw':_0x4554a5[_0x073f('0x1d')]?_0x4554a5[_0x073f('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4554a5['options']?_0x4554a5[_0x073f('0x1d')][_0x073f('0x1e')]||null:null,'attributes':_0x4554a5['options']?_0x4554a5[_0x073f('0x1d')][_0x073f('0x1f')]||null:null,'limit':_0x4554a5[_0x073f('0x1d')]?_0x4554a5[_0x073f('0x1d')][_0x073f('0x20')]||null:null})['then'](function(_0x5b4b81){logger['info'](_0x073f('0x21'),_0x4554a5);logger[_0x073f('0x22')](_0x073f('0x21'),_0x4554a5,JSON[_0x073f('0x13')](_0x5b4b81));_0x4ad96c(_0x5b4b81);})[_0x073f('0x1a')](function(_0x1fae3c){logger['error'](_0x073f('0x21'),_0x1fae3c[_0x073f('0x17')],_0x4554a5);_0x44b85b(_0x7d1315[_0x073f('0x14')](0x1f4,_0x1fae3c[_0x073f('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x36e070){return new Promise(function(_0x15075b,_0x5ab146){return db[_0x073f('0x1b')][_0x073f('0x23')]({'where':_0x36e070['options']?_0x36e070[_0x073f('0x1d')]['where']||null:null})['then'](function(_0x2189ae){if(_0x2189ae){return _0x2189ae['addTags'](_0x36e070[_0x073f('0x24')][_0x073f('0x25')],_[_0x073f('0x26')](_0x36e070[_0x073f('0x24')],[_0x073f('0x25'),'id'])||{});}})[_0x073f('0x27')](function(_0x41722d){logger[_0x073f('0x18')](_0x073f('0x28'),_0x36e070);logger[_0x073f('0x22')](_0x073f('0x28'),_0x36e070,JSON['stringify'](_0x41722d));_0x15075b(_0x41722d);})[_0x073f('0x1a')](function(_0x80e39f){logger['error']('AddTags',_0x80e39f[_0x073f('0x17')],_0x36e070);_0x5ab146(_this['error'](0x1f4,_0x80e39f[_0x073f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4fb6366..8c45712 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 _0x8042=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x221538,_0x194f59){var _0x4dfeb4=function(_0x1191c2){while(--_0x1191c2){_0x221538['push'](_0x221538['shift']());}};_0x4dfeb4(++_0x194f59);}(_0x8042,0x18e));var _0x2804=function(_0x1f2f61,_0x586f2f){_0x1f2f61=_0x1f2f61-0x0;var _0x10dabc=_0x8042[_0x1f2f61];return _0x10dabc;};'use strict';var ChatInteractionEvents=require(_0x2804('0x0'));var events=[_0x2804('0x1'),_0x2804('0x2'),_0x2804('0x3')];function createListener(_0x1f13ea,_0x339db2){return function(_0x38043a){_0x339db2[_0x2804('0x4')](_0x1f13ea,_0x38043a);};}function removeListener(_0x7780db,_0x17b21c){return function(){ChatInteractionEvents[_0x2804('0x5')](_0x7780db,_0x17b21c);};}exports[_0x2804('0x6')]=function(_0x204953){for(var _0x4efe0e=0x0,_0x245202=events[_0x2804('0x7')];_0x4efe0e<_0x245202;_0x4efe0e++){var _0x1c889f=events[_0x4efe0e];var _0x41a8df=createListener(_0x2804('0x8')+_0x1c889f,_0x204953);ChatInteractionEvents['on'](_0x1c889f,_0x41a8df);}}; \ No newline at end of file +var _0x3e49=['save','update','length','chatInteraction:','./chatInteraction.events'];(function(_0x1f88f0,_0x2dc0ac){var _0x3684f5=function(_0x2f5efd){while(--_0x2f5efd){_0x1f88f0['push'](_0x1f88f0['shift']());}};_0x3684f5(++_0x2dc0ac);}(_0x3e49,0x90));var _0x93e4=function(_0x3f2338,_0x49ef69){_0x3f2338=_0x3f2338-0x0;var _0x2b9a82=_0x3e49[_0x3f2338];return _0x2b9a82;};'use strict';var ChatInteractionEvents=require(_0x93e4('0x0'));var events=[_0x93e4('0x1'),'remove',_0x93e4('0x2')];function createListener(_0x34fa92,_0x3d7e7e){return function(_0x2143f4){_0x3d7e7e['emit'](_0x34fa92,_0x2143f4);};}function removeListener(_0x67b90b,_0x18e4f9){return function(){ChatInteractionEvents['removeListener'](_0x67b90b,_0x18e4f9);};}exports['register']=function(_0x47cee3){for(var _0x303c73=0x0,_0x2c620d=events[_0x93e4('0x3')];_0x303c73<_0x2c620d;_0x303c73++){var _0x3edabd=events[_0x303c73];var _0x112c54=createListener(_0x93e4('0x4')+_0x3edabd,_0x47cee3);ChatInteractionEvents['on'](_0x3edabd,_0x112c54);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4847b21..278623a 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 _0xfef3=['download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x317137,_0x471501){var _0x25858c=function(_0x5cf6cb){while(--_0x5cf6cb){_0x317137['push'](_0x317137['shift']());}};_0x25858c(++_0x471501);}(_0xfef3,0x118));var _0x3fef=function(_0x836fec,_0x291263){_0x836fec=_0x836fec-0x0;var _0x4c406c=_0xfef3[_0x836fec];return _0x4c406c;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3fef('0x4'));var config=require(_0x3fef('0x5'));var controller=require('./chatInteraction.controller');router[_0x3fef('0x6')]('/',auth[_0x3fef('0x7')](),controller['index']);router[_0x3fef('0x6')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller[_0x3fef('0x9')]);router[_0x3fef('0x6')](_0x3fef('0xa'),auth[_0x3fef('0xb')](),controller[_0x3fef('0xc')]);router[_0x3fef('0x6')](_0x3fef('0xd'),auth[_0x3fef('0xb')](),controller[_0x3fef('0xe')]);router[_0x3fef('0x6')](_0x3fef('0xf'),auth['isAuthenticated'](),controller[_0x3fef('0x10')]);router[_0x3fef('0x6')](_0x3fef('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x3fef('0x12')]);router['get'](_0x3fef('0x13'),auth[_0x3fef('0x7')](),controller[_0x3fef('0x14')]);router['post']('/',auth[_0x3fef('0x7')](),controller['create']);var upload=multer({'storage':multer[_0x3fef('0x15')]({'destination':function(_0x14c053,_0x56a65d,_0x2dec1b){_0x2dec1b(null,path[_0x3fef('0x16')](config[_0x3fef('0x17')],_0x3fef('0x18')));},'filename':function(_0x395df0,_0x2af1ba,_0x5c899f){_0x5c899f(null,util[_0x3fef('0x19')](_0x3fef('0x1a'),Date[_0x3fef('0x1b')](),_0x2af1ba[_0x3fef('0x1c')][_0x3fef('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3fef('0x1e')]('/:id/attachment_upload',upload[_0x3fef('0x1f')](_0x3fef('0x20')),controller['attachmentUpload']);router[_0x3fef('0x1e')](_0x3fef('0xf'),auth[_0x3fef('0xb')](),controller[_0x3fef('0x21')]);router[_0x3fef('0x1e')](_0x3fef('0x22'),auth[_0x3fef('0x7')](),interaction[_0x3fef('0x23')](_0x3fef('0x24'),_0x3fef('0x25')),controller[_0x3fef('0x26')]);router[_0x3fef('0x27')](_0x3fef('0xa'),auth[_0x3fef('0x7')](),interaction[_0x3fef('0x23')]('chat','chatinteraction:update'),controller['update']);router[_0x3fef('0x27')](_0x3fef('0x28'),controller[_0x3fef('0x29')]);router['put'](_0x3fef('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0x3fef('0x2b')]);router[_0x3fef('0x27')](_0x3fef('0x2c'),controller[_0x3fef('0x2d')]);router[_0x3fef('0x2e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x3fef('0x24'),_0x3fef('0x2f')),controller['destroy']);router[_0x3fef('0x2e')](_0x3fef('0x22'),auth['isAuthenticated'](),controller[_0x3fef('0x30')]);module[_0x3fef('0x31')]=router; \ No newline at end of file +var _0x1c9a=['/:id','chatinteraction:destroy','destroy','/:id/tags','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1acfb4,_0x2d1993){_0x1acfb4=_0x1acfb4-0x0;var _0x554f2f=_0x1c9a[_0x1acfb4];return _0x554f2f;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/describe',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0xa')](),controller[_0xa1c9('0xb')]);router[_0xa1c9('0x7')](_0xa1c9('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xa1c9('0xd')]);router[_0xa1c9('0x7')](_0xa1c9('0xe'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xf')]);router[_0xa1c9('0x7')](_0xa1c9('0x10'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x7')]('/:id/download',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x12')]);router[_0xa1c9('0x13')]('/',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x335dda,_0x4b2fa5,_0x2cba13){_0x2cba13(null,path[_0xa1c9('0x15')](config[_0xa1c9('0x16')],_0xa1c9('0x17')));},'filename':function(_0x44ab5b,_0x3b51f5,_0x1f6d26){_0x1f6d26(null,util[_0xa1c9('0x18')]('%s-%s',Date[_0xa1c9('0x19')](),_0x3b51f5[_0xa1c9('0x1a')][_0xa1c9('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa1c9('0x1c'),upload['single'](_0xa1c9('0x1d')),controller[_0xa1c9('0x1e')]);router[_0xa1c9('0x13')]('/:id/messages',auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x1f')]);router[_0xa1c9('0x13')]('/:id/tags',auth[_0xa1c9('0x8')](),interaction[_0xa1c9('0x20')]('chat',_0xa1c9('0x21')),controller[_0xa1c9('0x22')]);router[_0xa1c9('0x23')]('/:id',auth[_0xa1c9('0x8')](),interaction[_0xa1c9('0x20')](_0xa1c9('0x24'),_0xa1c9('0x25')),controller[_0xa1c9('0x26')]);router['put']('/:id/custom_update',controller[_0xa1c9('0x27')]);router['put'](_0xa1c9('0x28'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x29')]);router[_0xa1c9('0x23')](_0xa1c9('0x2a'),controller['close']);router[_0xa1c9('0x2b')](_0xa1c9('0x2c'),auth[_0xa1c9('0x8')](),interaction['tracked'](_0xa1c9('0x24'),_0xa1c9('0x2d')),controller[_0xa1c9('0x2e')]);router['delete'](_0xa1c9('0x2f'),auth[_0xa1c9('0x8')](),controller['removeTags']);module[_0xa1c9('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 01033d4..5d2eca1 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 _0xc9c3=['TEXT','BOOLEAN','INTEGER'];(function(_0x2e7d8,_0x74ff7c){var _0x20978a=function(_0x5d5f1e){while(--_0x5d5f1e){_0x2e7d8['push'](_0x2e7d8['shift']());}};_0x20978a(++_0x74ff7c);}(_0xc9c3,0x96));var _0x3c9c=function(_0x2b0442,_0x49a89e){_0x2b0442=_0x2b0442-0x0;var _0x5a3580=_0xc9c3[_0x2b0442];return _0x5a3580;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3c9c('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3c9c('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3c9c('0x2')]}}; \ No newline at end of file +var _0x17a7=['BOOLEAN','INTEGER','medium'];(function(_0x306dda,_0x2af0b9){var _0x31caee=function(_0x456ff2){while(--_0x456ff2){_0x306dda['push'](_0x306dda['shift']());}};_0x31caee(++_0x2af0b9);}(_0x17a7,0xc2));var _0x717a=function(_0x31ef07,_0x51bb3a){_0x31ef07=_0x31ef07-0x0;var _0x1fbb02=_0x17a7[_0x31ef07];return _0x1fbb02;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x717a('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x717a('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x717a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3ba34d4..cfc5057 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 _0x2d97=['describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','internal','online','allowmessenger','showWebBar','-online','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','html-pdf','eml-format','zip-dir','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','status','end','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','name','ChatInternalMessage','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','field','count','includeAll','include','findAll','rows','catch','params','find','create','body','update'];(function(_0x5cfa95,_0x23ef06){var _0x2e5a33=function(_0x3efaf6){while(--_0x3efaf6){_0x5cfa95['push'](_0x5cfa95['shift']());}};_0x2e5a33(++_0x23ef06);}(_0x2d97,0x88));var _0x72d9=function(_0x3c1d1f,_0x2a8ebf){_0x3c1d1f=_0x3c1d1f-0x0;var _0xc8ed55=_0x2d97[_0x3c1d1f];return _0xc8ed55;};'use strict';var pdf=require(_0x72d9('0x0'));var emlformat=require(_0x72d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x72d9('0x3'));var Mustache=require(_0x72d9('0x4'));var util=require('util');var path=require(_0x72d9('0x5'));var sox=require(_0x72d9('0x6'));var csv=require(_0x72d9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x72d9('0x8'));var squel=require(_0x72d9('0x9'));var crypto=require(_0x72d9('0xa'));var jsforce=require(_0x72d9('0xb'));var deskjs=require(_0x72d9('0xc'));var toCsv=require(_0x72d9('0x7'));var querystring=require(_0x72d9('0xd'));var Papa=require(_0x72d9('0xe'));var Redis=require(_0x72d9('0xf'));var authService=require(_0x72d9('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x72d9('0x11'))(_0x72d9('0x12'));var utils=require('../../config/utils');var config=require(_0x72d9('0x13'));var db=require(_0x72d9('0x14'))['db'];config[_0x72d9('0x15')]=_[_0x72d9('0x16')](config[_0x72d9('0x15')],{'host':_0x72d9('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72d9('0x15')]));require(_0x72d9('0x18'))[_0x72d9('0x19')](socket);function respondWithStatusCode(_0x805585,_0x22d08f){_0x22d08f=_0x22d08f||0xcc;return function(_0x6cb90c){if(_0x6cb90c){return _0x805585['sendStatus'](_0x22d08f);}return _0x805585[_0x72d9('0x1a')](_0x22d08f)[_0x72d9('0x1b')]();};}function respondWithResult(_0x100966,_0x463dfd){_0x463dfd=_0x463dfd||0xc8;return function(_0x2ffe5d){if(_0x2ffe5d){return _0x100966['status'](_0x463dfd)['json'](_0x2ffe5d);}};}function respondWithFilteredResult(_0x57bc10,_0x6c5278){return function(_0x1603a5){if(_0x1603a5){var _0x21f1e6=_0x1603a5['count'],_0x15997b=_0x6c5278[_0x72d9('0x1c')],_0x189075=_0x6c5278[_0x72d9('0x1c')]+_0x6c5278[_0x72d9('0x1d')],_0x54caa5;if(_0x189075>=_0x21f1e6){_0x189075=_0x21f1e6;_0x54caa5=0xc8;}else{_0x54caa5=0xce;}_0x57bc10[_0x72d9('0x1a')](_0x54caa5);return _0x57bc10[_0x72d9('0x1e')](_0x72d9('0x1f'),_0x15997b+'-'+_0x189075+'/'+_0x21f1e6)[_0x72d9('0x20')](_0x1603a5);}return null;};}function patchUpdates(_0x25e2cb){return function(_0x501ac2){try{jsonpatch[_0x72d9('0x21')](_0x501ac2,_0x25e2cb,!![]);}catch(_0xfe722e){return BPromise[_0x72d9('0x22')](_0xfe722e);}return _0x501ac2[_0x72d9('0x23')]();};}function saveUpdates(_0x2e5f64,_0x13fef1){return function(_0x10b3d1){if(_0x10b3d1){return _0x10b3d1['update'](_0x2e5f64)['then'](function(_0x3399f0){return _0x3399f0;});}return null;};}function removeEntity(_0x208556,_0x394e9f){return function(_0xbaaf6d){if(_0xbaaf6d){return _0xbaaf6d[_0x72d9('0x24')]()[_0x72d9('0x25')](function(){_0x208556['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cbd21,_0x3fa361){return function(_0x488adf){if(!_0x488adf){_0x5cbd21[_0x72d9('0x26')](0x194);}return _0x488adf;};}function handleError(_0x5505df,_0x3a15f7){_0x3a15f7=_0x3a15f7||0x1f4;return function(_0x454713){logger['error'](_0x454713[_0x72d9('0x27')]);if(_0x454713[_0x72d9('0x28')]){delete _0x454713[_0x72d9('0x28')];}_0x5505df[_0x72d9('0x1a')](_0x3a15f7)['send'](_0x454713);};}exports['index']=function(_0x2bb780,_0x28dbbb){var _0x390665={},_0x2bd0e9={},_0x57e3ae={'count':0x0,'rows':[]};var _0xe3aa75=db[_0x72d9('0x29')][_0x72d9('0x2a')];_0x2bd0e9[_0x72d9('0x2b')]=_[_0x72d9('0x2c')](_0xe3aa75);_0x2bd0e9[_0x72d9('0x2d')]=_[_0x72d9('0x2c')](_0x2bb780[_0x72d9('0x2d')]);_0x2bd0e9[_0x72d9('0x2e')]=_['intersection'](_0x2bd0e9[_0x72d9('0x2b')],_0x2bd0e9['query']);_0x390665[_0x72d9('0x2f')]=_[_0x72d9('0x30')](_0x2bd0e9[_0x72d9('0x2b')],qs[_0x72d9('0x31')](_0x2bb780[_0x72d9('0x2d')][_0x72d9('0x31')]));_0x390665[_0x72d9('0x2f')]=_0x390665[_0x72d9('0x2f')][_0x72d9('0x32')]?_0x390665[_0x72d9('0x2f')]:_0x2bd0e9[_0x72d9('0x2b')];if(!_0x2bb780['query'][_0x72d9('0x33')](_0x72d9('0x34'))){_0x390665[_0x72d9('0x1d')]=qs[_0x72d9('0x1d')](_0x2bb780['query'][_0x72d9('0x1d')]);_0x390665['offset']=qs['offset'](_0x2bb780[_0x72d9('0x2d')][_0x72d9('0x1c')]);}_0x390665[_0x72d9('0x35')]=qs[_0x72d9('0x36')](_0x2bb780[_0x72d9('0x2d')][_0x72d9('0x36')]);_0x390665[_0x72d9('0x37')]=qs[_0x72d9('0x2e')](_[_0x72d9('0x38')](_0x2bb780[_0x72d9('0x2d')],_0x2bd0e9[_0x72d9('0x2e')]));if(_0x2bb780[_0x72d9('0x2d')][_0x72d9('0x39')]){_0x390665[_0x72d9('0x37')]=_[_0x72d9('0x3a')](_0x390665[_0x72d9('0x37')],{'$or':_[_0x72d9('0x3b')](_0xe3aa75,function(_0x21a327){if(_0x21a327['type']['key']!=='VIRTUAL'){var _0x30ba91={};_0x30ba91[_0x21a327[_0x72d9('0x3c')]]={'$like':'%'+_0x2bb780[_0x72d9('0x2d')][_0x72d9('0x39')]+'%'};return _0x30ba91;}})});}_0x390665=_['merge']({},_0x390665,_0x2bb780['options']);var _0x22b704={'where':_0x390665['where']};return db['ChatInternalMessage'][_0x72d9('0x3d')](_0x22b704)[_0x72d9('0x25')](function(_0xbd9a63){_0x57e3ae['count']=_0xbd9a63;if(_0x2bb780[_0x72d9('0x2d')][_0x72d9('0x3e')]){_0x390665[_0x72d9('0x3f')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x72d9('0x40')](_0x390665);})['then'](function(_0x30c99b){_0x57e3ae[_0x72d9('0x41')]=_0x30c99b;return _0x57e3ae;})[_0x72d9('0x25')](respondWithFilteredResult(_0x28dbbb,_0x390665))[_0x72d9('0x42')](handleError(_0x28dbbb,null));};exports['show']=function(_0x156601,_0x5e05dc){var _0x196454={'raw':!![],'where':{'id':_0x156601[_0x72d9('0x43')]['id']}},_0x591b45={};_0x591b45['model']=_['keys'](db[_0x72d9('0x29')][_0x72d9('0x2a')]);_0x591b45[_0x72d9('0x2d')]=_['keys'](_0x156601[_0x72d9('0x2d')]);_0x591b45[_0x72d9('0x2e')]=_[_0x72d9('0x30')](_0x591b45[_0x72d9('0x2b')],_0x591b45[_0x72d9('0x2d')]);_0x196454[_0x72d9('0x2f')]=_[_0x72d9('0x30')](_0x591b45[_0x72d9('0x2b')],qs['fields'](_0x156601[_0x72d9('0x2d')][_0x72d9('0x31')]));_0x196454[_0x72d9('0x2f')]=_0x196454[_0x72d9('0x2f')][_0x72d9('0x32')]?_0x196454[_0x72d9('0x2f')]:_0x591b45[_0x72d9('0x2b')];if(_0x156601[_0x72d9('0x2d')][_0x72d9('0x3e')]){_0x196454['include']=[{'all':!![]}];}_0x196454=_[_0x72d9('0x3a')]({},_0x196454,_0x156601['options']);return db['ChatInternalMessage'][_0x72d9('0x44')](_0x196454)[_0x72d9('0x25')](handleEntityNotFound(_0x5e05dc,null))[_0x72d9('0x25')](respondWithResult(_0x5e05dc,null))[_0x72d9('0x42')](handleError(_0x5e05dc,null));};exports[_0x72d9('0x45')]=function(_0x4d27de,_0x412a50){return db[_0x72d9('0x29')]['create'](_0x4d27de[_0x72d9('0x46')],{})['then'](respondWithResult(_0x412a50,0xc9))[_0x72d9('0x42')](handleError(_0x412a50,null));};exports[_0x72d9('0x47')]=function(_0x4ba41e,_0x35f795){if(_0x4ba41e[_0x72d9('0x46')]['id']){delete _0x4ba41e['body']['id'];}return db[_0x72d9('0x29')]['find']({'where':{'id':_0x4ba41e[_0x72d9('0x43')]['id']}})[_0x72d9('0x25')](handleEntityNotFound(_0x35f795,null))[_0x72d9('0x25')](saveUpdates(_0x4ba41e[_0x72d9('0x46')],null))[_0x72d9('0x25')](respondWithResult(_0x35f795,null))[_0x72d9('0x42')](handleError(_0x35f795,null));};exports[_0x72d9('0x24')]=function(_0x4533f0,_0x4e65a1){return db[_0x72d9('0x29')]['find']({'where':{'id':_0x4533f0[_0x72d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e65a1,null))[_0x72d9('0x25')](removeEntity(_0x4e65a1,null))[_0x72d9('0x42')](handleError(_0x4e65a1,null));};exports[_0x72d9('0x48')]=function(_0x493d81,_0x58bb5f){return db[_0x72d9('0x29')][_0x72d9('0x48')]()['then'](respondWithResult(_0x58bb5f,null))['catch'](handleError(_0x58bb5f,null));};function wrapUser(_0x46ffc4){return function(_0xb8732b){var _0x5e2fa5=_0x46ffc4[_0x72d9('0x49')]({'plain':!![]});_0x5e2fa5[_0x72d9('0x4a')]=[];if(_0xb8732b){_0x5e2fa5[_0x72d9('0x4b')]=_0xb8732b[_0x72d9('0x4c')];_0x5e2fa5[_0x72d9('0x4d')]=_0xb8732b;}else{_0x5e2fa5[_0x72d9('0x4b')]=moment(0x0)[_0x72d9('0x4e')](_0x72d9('0x4f'));_0x5e2fa5[_0x72d9('0x4d')]={};}return _0x5e2fa5;};}exports[_0x72d9('0x50')]=function(_0x5a7fbb,_0x2054cf,_0x52d859){var _0x2686d6=[];return db[_0x72d9('0x51')]['findAll']({'where':{'role':[_0x72d9('0x52'),_0x72d9('0x53'),_0x72d9('0x54')]},'attributes':['id',_0x72d9('0x55'),_0x72d9('0x28'),_0x72d9('0x56'),'userpic',_0x72d9('0x57'),_0x72d9('0x58'),'lastLoginAt',_0x72d9('0x59'),_0x72d9('0x5a')],'order':qs['sort'](_0x72d9('0x5b')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x72d9('0x28'),_0x72d9('0x5c')],'through':{'attributes':[]}}]})['then'](function(_0x3ee161){if(_0x3ee161){var _0x24e02a=_0x5a7fbb['user']['get']({'plain':!![]});if(!_0x24e02a)throw new Error(_0x72d9('0x5d'));if(_0x24e02a[_0x72d9('0x56')]===_0x72d9('0x54')){return db[_0x72d9('0x5e')][_0x72d9('0x44')]({'where':{'name':_0x72d9('0x5f'),'userProfileId':_0x24e02a[_0x72d9('0x60')]},'raw':!![]})[_0x72d9('0x25')](function(_0x3e512d){if(_0x3e512d){if(_0x3e512d[_0x72d9('0x61')]===0x0){return db[_0x72d9('0x62')][_0x72d9('0x40')]({'where':{'sectionId':_0x3e512d['id']},'raw':!![]})[_0x72d9('0x25')](function(_0x1a09ec){var _0x5360f5=[];if(_[_0x72d9('0x63')](_0x1a09ec)){_0x5360f5=_[_0x72d9('0x39')](_0x3ee161,function(_0x1c809b){if(_0x1c809b['role']!==_0x72d9('0x52')){return _0x1c809b;}});return _0x5360f5;}else{for(var _0x42ac38=0x0;_0x42ac38<_0x3ee161['length'];_0x42ac38++){var _0x34dea6=_0x3ee161[_0x42ac38];if(_0x34dea6[_0x72d9('0x56')]==='agent'){var _0x1a7c9e=_[_0x72d9('0x44')](_0x1a09ec,function(_0x2e11d5){return _0x2e11d5[_0x72d9('0x64')]===_0x34dea6['id'];});if(_0x1a7c9e)_0x5360f5[_0x72d9('0x65')](_0x34dea6);}else{_0x5360f5[_0x72d9('0x65')](_0x34dea6);}}return _0x5360f5;}});}else{return _0x3ee161;}}else{var _0xb86b74=_[_0x72d9('0x39')](_0x3ee161,function(_0x431994){if(_0x431994[_0x72d9('0x56')]!==_0x72d9('0x52')){return _0x431994;}});return _0xb86b74;}});}else{return _0x3ee161;}}})[_0x72d9('0x25')](function(_0x1312be){var _0x4cf439=[];if(_0x1312be){_0x2686d6=_0x1312be;for(var _0x51aac1=0x0;_0x51aac1<_0x1312be[_0x72d9('0x32')];_0x51aac1+=0x1){_0x2686d6[_0x51aac1][_0x72d9('0x4a')]=[];_0x4cf439[_0x72d9('0x65')](db[_0x72d9('0x29')]['find']({'where':{'FromId':[_0x5a7fbb['user']['id'],_0x1312be[_0x51aac1]['id']],'ToId':[_0x5a7fbb[_0x72d9('0x54')]['id'],_0x1312be[_0x51aac1]['id']],'ChatGroupId':null},'attributes':['id',_0x72d9('0x4c'),_0x72d9('0x66'),_0x72d9('0x67'),'read',_0x72d9('0x46')],'order':qs[_0x72d9('0x36')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x72d9('0x25')](wrapUser(_0x1312be[_0x51aac1])));}return BPromise['all'](_0x4cf439);}return[];})[_0x72d9('0x25')](function(_0x5a1a78){return{'rows':_0x5a1a78,'count':_0x5a1a78[_0x72d9('0x32')]};})[_0x72d9('0x25')](respondWithResult(_0x2054cf,null))['catch'](handleError(_0x2054cf,null));}; \ No newline at end of file +var _0xd4ea=['UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','createdAt','FromId','ToId','read','all','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','key','VIRTUAL','field','options','include','ChatInternalMessage','findAll','rows','catch','params','create','body','find','describe','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xa6df52,_0x1b8584){var _0x5edd57=function(_0x543f11){while(--_0x543f11){_0xa6df52['push'](_0xa6df52['shift']());}};_0x5edd57(++_0x1b8584);}(_0xd4ea,0x1cf));var _0xad4e=function(_0x480a3a,_0x5c20e6){_0x480a3a=_0x480a3a-0x0;var _0x33966d=_0xd4ea[_0x480a3a];return _0x33966d;};'use strict';var pdf=require(_0xad4e('0x0'));var emlformat=require(_0xad4e('0x1'));var rimraf=require(_0xad4e('0x2'));var zipdir=require(_0xad4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad4e('0x4'));var Mustache=require(_0xad4e('0x5'));var util=require(_0xad4e('0x6'));var path=require(_0xad4e('0x7'));var sox=require(_0xad4e('0x8'));var csv=require(_0xad4e('0x9'));var ejs=require(_0xad4e('0xa'));var fs=require('fs');var _=require(_0xad4e('0xb'));var squel=require(_0xad4e('0xc'));var crypto=require('crypto');var jsforce=require(_0xad4e('0xd'));var deskjs=require(_0xad4e('0xe'));var toCsv=require(_0xad4e('0x9'));var querystring=require('querystring');var Papa=require(_0xad4e('0xf'));var Redis=require(_0xad4e('0x10'));var authService=require(_0xad4e('0x11'));var qs=require(_0xad4e('0x12'));var hardwareService=require(_0xad4e('0x13'));var logger=require(_0xad4e('0x14'))(_0xad4e('0x15'));var utils=require(_0xad4e('0x16'));var config=require(_0xad4e('0x17'));var db=require(_0xad4e('0x18'))['db'];config['redis']=_['defaults'](config[_0xad4e('0x19')],{'host':_0xad4e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad4e('0x19')]));require(_0xad4e('0x1b'))[_0xad4e('0x1c')](socket);function respondWithStatusCode(_0x174dce,_0x2e92e3){_0x2e92e3=_0x2e92e3||0xcc;return function(_0x56b3d4){if(_0x56b3d4){return _0x174dce[_0xad4e('0x1d')](_0x2e92e3);}return _0x174dce[_0xad4e('0x1e')](_0x2e92e3)[_0xad4e('0x1f')]();};}function respondWithResult(_0x251866,_0x3a10a0){_0x3a10a0=_0x3a10a0||0xc8;return function(_0x1770b){if(_0x1770b){return _0x251866[_0xad4e('0x1e')](_0x3a10a0)[_0xad4e('0x20')](_0x1770b);}};}function respondWithFilteredResult(_0x3a3b9d,_0x50efe0){return function(_0x23b464){if(_0x23b464){var _0x5a75bb=_0x23b464[_0xad4e('0x21')],_0x1c612b=_0x50efe0[_0xad4e('0x22')],_0x1487b4=_0x50efe0[_0xad4e('0x22')]+_0x50efe0['limit'],_0x12c000;if(_0x1487b4>=_0x5a75bb){_0x1487b4=_0x5a75bb;_0x12c000=0xc8;}else{_0x12c000=0xce;}_0x3a3b9d[_0xad4e('0x1e')](_0x12c000);return _0x3a3b9d[_0xad4e('0x23')](_0xad4e('0x24'),_0x1c612b+'-'+_0x1487b4+'/'+_0x5a75bb)['json'](_0x23b464);}return null;};}function patchUpdates(_0x6be4f4){return function(_0x44af68){try{jsonpatch[_0xad4e('0x25')](_0x44af68,_0x6be4f4,!![]);}catch(_0x1b69ee){return BPromise[_0xad4e('0x26')](_0x1b69ee);}return _0x44af68[_0xad4e('0x27')]();};}function saveUpdates(_0x4c60dd,_0x520c98){return function(_0xad8f4){if(_0xad8f4){return _0xad8f4[_0xad4e('0x28')](_0x4c60dd)[_0xad4e('0x29')](function(_0x3a72a9){return _0x3a72a9;});}return null;};}function removeEntity(_0x452ed0,_0x3d6cb6){return function(_0x300e50){if(_0x300e50){return _0x300e50[_0xad4e('0x2a')]()[_0xad4e('0x29')](function(){_0x452ed0[_0xad4e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bab4d,_0x4ff4e3){return function(_0x481fd1){if(!_0x481fd1){_0x3bab4d[_0xad4e('0x1d')](0x194);}return _0x481fd1;};}function handleError(_0x4b9726,_0x2b9ddc){_0x2b9ddc=_0x2b9ddc||0x1f4;return function(_0x589fca){logger[_0xad4e('0x2b')](_0x589fca['stack']);if(_0x589fca[_0xad4e('0x2c')]){delete _0x589fca[_0xad4e('0x2c')];}_0x4b9726['status'](_0x2b9ddc)[_0xad4e('0x2d')](_0x589fca);};}exports[_0xad4e('0x2e')]=function(_0x69f4c8,_0x35c492){var _0x775305={},_0x21c37b={},_0x2b22f8={'count':0x0,'rows':[]};var _0x578910=db['ChatInternalMessage'][_0xad4e('0x2f')];_0x21c37b[_0xad4e('0x30')]=_[_0xad4e('0x31')](_0x578910);_0x21c37b[_0xad4e('0x32')]=_[_0xad4e('0x31')](_0x69f4c8['query']);_0x21c37b['filters']=_[_0xad4e('0x33')](_0x21c37b[_0xad4e('0x30')],_0x21c37b[_0xad4e('0x32')]);_0x775305[_0xad4e('0x34')]=_[_0xad4e('0x33')](_0x21c37b[_0xad4e('0x30')],qs[_0xad4e('0x35')](_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x35')]));_0x775305[_0xad4e('0x34')]=_0x775305[_0xad4e('0x34')][_0xad4e('0x36')]?_0x775305[_0xad4e('0x34')]:_0x21c37b['model'];if(!_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x37')](_0xad4e('0x38'))){_0x775305[_0xad4e('0x39')]=qs[_0xad4e('0x39')](_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x39')]);_0x775305[_0xad4e('0x22')]=qs['offset'](_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x22')]);}_0x775305['order']=qs[_0xad4e('0x3a')](_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x3a')]);_0x775305[_0xad4e('0x3b')]=qs['filters'](_[_0xad4e('0x3c')](_0x69f4c8['query'],_0x21c37b[_0xad4e('0x3d')]));if(_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x3e')]){_0x775305[_0xad4e('0x3b')]=_[_0xad4e('0x3f')](_0x775305[_0xad4e('0x3b')],{'$or':_['map'](_0x578910,function(_0x47511f){if(_0x47511f['type'][_0xad4e('0x40')]!==_0xad4e('0x41')){var _0x69f9d5={};_0x69f9d5[_0x47511f[_0xad4e('0x42')]]={'$like':'%'+_0x69f4c8[_0xad4e('0x32')][_0xad4e('0x3e')]+'%'};return _0x69f9d5;}})});}_0x775305=_[_0xad4e('0x3f')]({},_0x775305,_0x69f4c8[_0xad4e('0x43')]);var _0x57447c={'where':_0x775305[_0xad4e('0x3b')]};return db['ChatInternalMessage'][_0xad4e('0x21')](_0x57447c)[_0xad4e('0x29')](function(_0x389749){_0x2b22f8[_0xad4e('0x21')]=_0x389749;if(_0x69f4c8[_0xad4e('0x32')]['includeAll']){_0x775305[_0xad4e('0x44')]=[{'all':!![]}];}return db[_0xad4e('0x45')][_0xad4e('0x46')](_0x775305);})['then'](function(_0x83344c){_0x2b22f8[_0xad4e('0x47')]=_0x83344c;return _0x2b22f8;})['then'](respondWithFilteredResult(_0x35c492,_0x775305))[_0xad4e('0x48')](handleError(_0x35c492,null));};exports['show']=function(_0x3cb107,_0x23c26e){var _0x3fcc95={'raw':!![],'where':{'id':_0x3cb107[_0xad4e('0x49')]['id']}},_0x357d8a={};_0x357d8a['model']=_[_0xad4e('0x31')](db[_0xad4e('0x45')]['rawAttributes']);_0x357d8a[_0xad4e('0x32')]=_['keys'](_0x3cb107['query']);_0x357d8a['filters']=_[_0xad4e('0x33')](_0x357d8a[_0xad4e('0x30')],_0x357d8a[_0xad4e('0x32')]);_0x3fcc95['attributes']=_[_0xad4e('0x33')](_0x357d8a[_0xad4e('0x30')],qs[_0xad4e('0x35')](_0x3cb107[_0xad4e('0x32')][_0xad4e('0x35')]));_0x3fcc95[_0xad4e('0x34')]=_0x3fcc95[_0xad4e('0x34')]['length']?_0x3fcc95['attributes']:_0x357d8a[_0xad4e('0x30')];if(_0x3cb107[_0xad4e('0x32')]['includeAll']){_0x3fcc95[_0xad4e('0x44')]=[{'all':!![]}];}_0x3fcc95=_[_0xad4e('0x3f')]({},_0x3fcc95,_0x3cb107['options']);return db[_0xad4e('0x45')]['find'](_0x3fcc95)[_0xad4e('0x29')](handleEntityNotFound(_0x23c26e,null))['then'](respondWithResult(_0x23c26e,null))[_0xad4e('0x48')](handleError(_0x23c26e,null));};exports['create']=function(_0x5ed8a3,_0x47fe88){return db[_0xad4e('0x45')][_0xad4e('0x4a')](_0x5ed8a3[_0xad4e('0x4b')],{})['then'](respondWithResult(_0x47fe88,0xc9))[_0xad4e('0x48')](handleError(_0x47fe88,null));};exports['update']=function(_0x47c018,_0x3c2cce){if(_0x47c018[_0xad4e('0x4b')]['id']){delete _0x47c018['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x47c018[_0xad4e('0x49')]['id']}})[_0xad4e('0x29')](handleEntityNotFound(_0x3c2cce,null))[_0xad4e('0x29')](saveUpdates(_0x47c018[_0xad4e('0x4b')],null))[_0xad4e('0x29')](respondWithResult(_0x3c2cce,null))[_0xad4e('0x48')](handleError(_0x3c2cce,null));};exports[_0xad4e('0x2a')]=function(_0x1f1788,_0x3641a0){return db[_0xad4e('0x45')][_0xad4e('0x4c')]({'where':{'id':_0x1f1788['params']['id']}})[_0xad4e('0x29')](handleEntityNotFound(_0x3641a0,null))['then'](removeEntity(_0x3641a0,null))['catch'](handleError(_0x3641a0,null));};exports[_0xad4e('0x4d')]=function(_0x4e0a0c,_0x291312){return db['ChatInternalMessage'][_0xad4e('0x4d')]()[_0xad4e('0x29')](respondWithResult(_0x291312,null))['catch'](handleError(_0x291312,null));};function wrapUser(_0x853cf4){return function(_0x28383c){var _0x24074c=_0x853cf4['get']({'plain':!![]});_0x24074c[_0xad4e('0x4e')]=[];if(_0x28383c){_0x24074c['lastMessageAt']=_0x28383c['createdAt'];_0x24074c['lastMessage']=_0x28383c;}else{_0x24074c[_0xad4e('0x4f')]=moment(0x0)[_0xad4e('0x50')](_0xad4e('0x51'));_0x24074c[_0xad4e('0x52')]={};}return _0x24074c;};}exports[_0xad4e('0x53')]=function(_0x1573f3,_0x18c441,_0xabd4a9){var _0x5dfbb3=[];return db[_0xad4e('0x54')][_0xad4e('0x46')]({'where':{'role':[_0xad4e('0x55'),_0xad4e('0x56'),_0xad4e('0x57')]},'attributes':['id',_0xad4e('0x58'),_0xad4e('0x2c'),'role',_0xad4e('0x59'),_0xad4e('0x5a'),_0xad4e('0x5b'),_0xad4e('0x5c'),_0xad4e('0x5d'),_0xad4e('0x5e')],'order':qs[_0xad4e('0x3a')](_0xad4e('0x5f')),'include':[{'model':db[_0xad4e('0x60')],'as':_0xad4e('0x61'),'attributes':['id',_0xad4e('0x2c'),_0xad4e('0x62')],'through':{'attributes':[]}}]})[_0xad4e('0x29')](function(_0x1d39e5){if(_0x1d39e5){var _0x10eddf=_0x1573f3[_0xad4e('0x57')][_0xad4e('0x63')]({'plain':!![]});if(!_0x10eddf)throw new Error(_0xad4e('0x64'));if(_0x10eddf[_0xad4e('0x65')]===_0xad4e('0x57')){return db[_0xad4e('0x66')]['find']({'where':{'name':_0xad4e('0x67'),'userProfileId':_0x10eddf['userProfileId']},'raw':!![]})[_0xad4e('0x29')](function(_0x5f26f7){if(_0x5f26f7){if(_0x5f26f7[_0xad4e('0x68')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5f26f7['id']},'raw':!![]})[_0xad4e('0x29')](function(_0x246b53){var _0x422663=[];if(_[_0xad4e('0x69')](_0x246b53)){_0x422663=_[_0xad4e('0x3e')](_0x1d39e5,function(_0x5d1b69){if(_0x5d1b69[_0xad4e('0x65')]!==_0xad4e('0x55')){return _0x5d1b69;}});return _0x422663;}else{for(var _0x111bd8=0x0;_0x111bd8<_0x1d39e5[_0xad4e('0x36')];_0x111bd8++){var _0x48b149=_0x1d39e5[_0x111bd8];if(_0x48b149['role']===_0xad4e('0x55')){var _0x4611f6=_[_0xad4e('0x4c')](_0x246b53,function(_0x61a2e4){return _0x61a2e4[_0xad4e('0x6a')]===_0x48b149['id'];});if(_0x4611f6)_0x422663[_0xad4e('0x6b')](_0x48b149);}else{_0x422663['push'](_0x48b149);}}return _0x422663;}});}else{return _0x1d39e5;}}else{var _0x2d6d82=_[_0xad4e('0x3e')](_0x1d39e5,function(_0x133a0c){if(_0x133a0c['role']!=='agent'){return _0x133a0c;}});return _0x2d6d82;}});}else{return _0x1d39e5;}}})[_0xad4e('0x29')](function(_0x536f48){var _0x2c1caf=[];if(_0x536f48){_0x5dfbb3=_0x536f48;for(var _0x12033a=0x0;_0x12033a<_0x536f48['length'];_0x12033a+=0x1){_0x5dfbb3[_0x12033a][_0xad4e('0x4e')]=[];_0x2c1caf[_0xad4e('0x6b')](db[_0xad4e('0x45')][_0xad4e('0x4c')]({'where':{'FromId':[_0x1573f3[_0xad4e('0x57')]['id'],_0x536f48[_0x12033a]['id']],'ToId':[_0x1573f3[_0xad4e('0x57')]['id'],_0x536f48[_0x12033a]['id']],'ChatGroupId':null},'attributes':['id',_0xad4e('0x6c'),_0xad4e('0x6d'),_0xad4e('0x6e'),_0xad4e('0x6f'),'body'],'order':qs[_0xad4e('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xad4e('0x29')](wrapUser(_0x536f48[_0x12033a])));}return BPromise[_0xad4e('0x70')](_0x2c1caf);}return[];})['then'](function(_0x4cf838){return{'rows':_0x4cf838,'count':_0x4cf838[_0xad4e('0x36')]};})[_0xad4e('0x29')](respondWithResult(_0x18c441,null))[_0xad4e('0x48')](handleError(_0x18c441,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a0c4217..73ad591 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 _0xbc9d=['save','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x590096,_0xa578da){_0x590096=_0x590096-0x0;var _0x53e9e=_0xbc9d[_0x590096];return _0x53e9e;};'use strict';var EventEmitter=require(_0xdbc9('0x0'));var ChatInternalMessage=require(_0xdbc9('0x1'))['db'][_0xdbc9('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdbc9('0x3')](0x0);var events={'afterCreate':_0xdbc9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fab6e){return function(_0x2aba48,_0x404513,_0x3e63f1){ChatInternalMessageEvents[_0xdbc9('0x5')](_0x4fab6e+':'+_0x2aba48['id'],_0x2aba48);ChatInternalMessageEvents[_0xdbc9('0x5')](_0x4fab6e,_0x2aba48);_0x3e63f1(null);};}for(var e in events){if(events[_0xdbc9('0x6')](e)){var event=events[e];ChatInternalMessage[_0xdbc9('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x780f=['save','emit','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x527c54,_0xaa5895){var _0x1987fa=function(_0x1f312b){while(--_0x1f312b){_0x527c54['push'](_0x527c54['shift']());}};_0x1987fa(++_0xaa5895);}(_0x780f,0x6c));var _0xf780=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x780f[_0x1d80be];return _0xf9a4f3;};'use strict';var EventEmitter=require(_0xf780('0x0'));var ChatInternalMessage=require(_0xf780('0x1'))['db'][_0xf780('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf780('0x3')](0x0);var events={'afterCreate':_0xf780('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ab244){return function(_0x26ed87,_0x1a22c0,_0x100bb2){ChatInternalMessageEvents['emit'](_0x4ab244+':'+_0x26ed87['id'],_0x26ed87);ChatInternalMessageEvents[_0xf780('0x5')](_0x4ab244,_0x26ed87);_0x100bb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xf780('0x6')](e,emitEvent(event));}}module[_0xf780('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 1a62809..38307ef 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 _0x18e3=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x169e53,_0x46be55){var _0x252bb3=function(_0x521e7a){while(--_0x521e7a){_0x169e53['push'](_0x169e53['shift']());}};_0x252bb3(++_0x46be55);}(_0x18e3,0x1a3));var _0x318e=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x18e3[_0x2fd69d];return _0x5d5ef3;};'use strict';var _=require(_0x318e('0x0'));var util=require(_0x318e('0x1'));var logger=require('../../config/logger')(_0x318e('0x2'));var moment=require(_0x318e('0x3'));var BPromise=require(_0x318e('0x4'));var rp=require(_0x318e('0x5'));var fs=require('fs');var path=require(_0x318e('0x6'));var rimraf=require(_0x318e('0x7'));var config=require(_0x318e('0x8'));var attributes=require(_0x318e('0x9'));module[_0x318e('0xa')]=function(_0x3d72c0,_0x5579da){return _0x3d72c0[_0x318e('0xb')](_0x318e('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x318e('0xd'),'collate':_0x318e('0xe')});}; \ No newline at end of file +var _0x89ce=['chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x44f81b,_0x53a13b){var _0x35cd03=function(_0x2a129e){while(--_0x2a129e){_0x44f81b['push'](_0x44f81b['shift']());}};_0x35cd03(++_0x53a13b);}(_0x89ce,0x1af));var _0xe89c=function(_0x5812e4,_0x269ed8){_0x5812e4=_0x5812e4-0x0;var _0x48714d=_0x89ce[_0x5812e4];return _0x48714d;};'use strict';var _=require(_0xe89c('0x0'));var util=require(_0xe89c('0x1'));var logger=require(_0xe89c('0x2'))(_0xe89c('0x3'));var moment=require(_0xe89c('0x4'));var BPromise=require('bluebird');var rp=require(_0xe89c('0x5'));var fs=require('fs');var path=require(_0xe89c('0x6'));var rimraf=require(_0xe89c('0x7'));var config=require(_0xe89c('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xe89c('0x9')]=function(_0x52adc1,_0x237787){return _0x52adc1[_0xe89c('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xe89c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe89c('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ac4777d..5f82bb3 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 _0x1939=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x5e9468,_0x388eeb){var _0x50143f=function(_0x3911f5){while(--_0x3911f5){_0x5e9468['push'](_0x5e9468['shift']());}};_0x50143f(++_0x388eeb);}(_0x1939,0x1d1));var _0x9193=function(_0x1e41ba,_0x455a21){_0x1e41ba=_0x1e41ba-0x0;var _0x201d61=_0x1939[_0x1e41ba];return _0x201d61;};'use strict';var _=require(_0x9193('0x0'));var util=require('util');var moment=require(_0x9193('0x1'));var BPromise=require(_0x9193('0x2'));var rs=require(_0x9193('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9193('0x4'))['db'];var utils=require(_0x9193('0x5'));var logger=require(_0x9193('0x6'))(_0x9193('0x7'));var config=require('../../config/environment');var jayson=require(_0x9193('0x8'));var client=jayson[_0x9193('0x9')]['http']({'port':0x232a});config[_0x9193('0xa')]=_[_0x9193('0xb')](config[_0x9193('0xa')],{'host':_0x9193('0xc'),'port':0x18eb});var socket=require(_0x9193('0xd'))(new Redis(config['redis']));require(_0x9193('0xe'))[_0x9193('0xf')](socket);function respondWithRpcPromise(_0x185b7a,_0xe6593e,_0x44d9f7){return new BPromise(function(_0x533e5f,_0x5934d9){return client['request'](_0x185b7a,_0x44d9f7)[_0x9193('0x10')](function(_0x4aa6c7){logger[_0x9193('0x11')](_0x9193('0x12'),_0xe6593e,'request\x20sent');logger[_0x9193('0x13')](_0x9193('0x14'),_0xe6593e,_0x9193('0x15'),JSON[_0x9193('0x16')](_0x4aa6c7));if(_0x4aa6c7[_0x9193('0x17')]){if(_0x4aa6c7[_0x9193('0x17')][_0x9193('0x18')]===0x1f4){logger[_0x9193('0x17')](_0x9193('0x12'),_0xe6593e,_0x4aa6c7['error'][_0x9193('0x19')]);return _0x5934d9(_0x4aa6c7[_0x9193('0x17')][_0x9193('0x19')]);}logger[_0x9193('0x17')](_0x9193('0x12'),_0xe6593e,_0x4aa6c7['error'][_0x9193('0x19')]);return _0x533e5f(_0x4aa6c7[_0x9193('0x17')][_0x9193('0x19')]);}else{logger[_0x9193('0x11')](_0x9193('0x12'),_0xe6593e,_0x9193('0x15'));_0x533e5f(_0x4aa6c7[_0x9193('0x1a')]['message']);}})[_0x9193('0x1b')](function(_0x430c6c){logger[_0x9193('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0xe6593e,_0x430c6c);_0x5934d9(_0x430c6c);});});} \ No newline at end of file +var _0x11d2=['../../config/logger','rpc','client','http','redis','defaults','localhost','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4fb473,_0x2e94b2){var _0xbcac62=function(_0x4a1efe){while(--_0x4a1efe){_0x4fb473['push'](_0x4fb473['shift']());}};_0xbcac62(++_0x2e94b2);}(_0x11d2,0x1c4));var _0x211d=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x11d2[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x211d('0x0'));var util=require(_0x211d('0x1'));var moment=require(_0x211d('0x2'));var BPromise=require(_0x211d('0x3'));var rs=require(_0x211d('0x4'));var fs=require('fs');var Redis=require(_0x211d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x211d('0x6'));var logger=require(_0x211d('0x7'))(_0x211d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x211d('0x9')][_0x211d('0xa')]({'port':0x232a});config[_0x211d('0xb')]=_[_0x211d('0xc')](config[_0x211d('0xb')],{'host':_0x211d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x211d('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x428218,_0x296137,_0x11a8e3){return new BPromise(function(_0x16ced8,_0x4ad503){return client[_0x211d('0xe')](_0x428218,_0x11a8e3)[_0x211d('0xf')](function(_0x2906db){logger[_0x211d('0x10')](_0x211d('0x11'),_0x296137,_0x211d('0x12'));logger[_0x211d('0x13')](_0x211d('0x14'),_0x296137,_0x211d('0x12'),JSON[_0x211d('0x15')](_0x2906db));if(_0x2906db['error']){if(_0x2906db[_0x211d('0x16')][_0x211d('0x17')]===0x1f4){logger[_0x211d('0x16')](_0x211d('0x11'),_0x296137,_0x2906db[_0x211d('0x16')][_0x211d('0x18')]);return _0x4ad503(_0x2906db['error'][_0x211d('0x18')]);}logger[_0x211d('0x16')](_0x211d('0x11'),_0x296137,_0x2906db['error'][_0x211d('0x18')]);return _0x16ced8(_0x2906db[_0x211d('0x16')][_0x211d('0x18')]);}else{logger[_0x211d('0x10')](_0x211d('0x11'),_0x296137,_0x211d('0x12'));_0x16ced8(_0x2906db[_0x211d('0x19')]['message']);}})[_0x211d('0x1a')](function(_0x40f1ef){logger[_0x211d('0x16')](_0x211d('0x11'),_0x296137,_0x40f1ef);_0x4ad503(_0x40f1ef);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index abdddd2..35b5e1c 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 _0x5c60=['length','save','remove','update','emit','removeListener','register'];(function(_0x317ed5,_0xd7d3e){var _0x4f3cd7=function(_0x55062f){while(--_0x55062f){_0x317ed5['push'](_0x317ed5['shift']());}};_0x4f3cd7(++_0xd7d3e);}(_0x5c60,0x86));var _0x05c6=function(_0x3af2c8,_0x2476e4){_0x3af2c8=_0x3af2c8-0x0;var _0x9ed5d5=_0x5c60[_0x3af2c8];return _0x9ed5d5;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x05c6('0x0'),_0x05c6('0x1'),_0x05c6('0x2')];function createListener(_0x120960,_0x5a1a78){return function(_0x2170bb){_0x5a1a78[_0x05c6('0x3')](_0x120960,_0x2170bb);};}function removeListener(_0x29087c,_0x8e2748){return function(){ChatInternalMessageEvents[_0x05c6('0x4')](_0x29087c,_0x8e2748);};}exports[_0x05c6('0x5')]=function(_0x383bfd){for(var _0x21f9be=0x0,_0x3e15bb=events[_0x05c6('0x6')];_0x21f9be<_0x3e15bb;_0x21f9be++){var _0x4fe9d7=events[_0x21f9be];var _0x357900=createListener('chatInternalMessage:'+_0x4fe9d7,_0x383bfd);ChatInternalMessageEvents['on'](_0x4fe9d7,_0x357900);}}; \ No newline at end of file +var _0x790d=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x790d,0xb7));var _0xd790=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x790d[_0x59eacf];return _0x5d74f2;};'use strict';var ChatInternalMessageEvents=require(_0xd790('0x0'));var events=[_0xd790('0x1'),_0xd790('0x2'),_0xd790('0x3')];function createListener(_0x3c973b,_0x46599c){return function(_0x79bd8f){_0x46599c[_0xd790('0x4')](_0x3c973b,_0x79bd8f);};}function removeListener(_0x400268,_0x1066c7){return function(){ChatInternalMessageEvents[_0xd790('0x5')](_0x400268,_0x1066c7);};}exports['register']=function(_0x3fa213){for(var _0x9f7a9c=0x0,_0x521c1c=events['length'];_0x9f7a9c<_0x521c1c;_0x9f7a9c++){var _0x2e1a61=events[_0x9f7a9c];var _0x583334=createListener(_0xd790('0x6')+_0x2e1a61,_0x3fa213);ChatInternalMessageEvents['on'](_0x2e1a61,_0x583334);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7b55244..b772a50 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 _0xce08=['express','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','describe','get','/users','getUsers','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1be35b,_0xa49780){var _0xd22f6=function(_0x4322a8){while(--_0x4322a8){_0x1be35b['push'](_0x1be35b['shift']());}};_0xd22f6(++_0xa49780);}(_0xce08,0xb4));var _0x8ce0=function(_0x5a71ec,_0x23ba5d){_0x5a71ec=_0x5a71ec-0x0;var _0x3cd1dd=_0xce08[_0x5a71ec];return _0x3cd1dd;};'use strict';var multer=require(_0x8ce0('0x0'));var util=require(_0x8ce0('0x1'));var path=require(_0x8ce0('0x2'));var timeout=require(_0x8ce0('0x3'));var express=require(_0x8ce0('0x4'));var router=express[_0x8ce0('0x5')]();var auth=require(_0x8ce0('0x6'));var interaction=require(_0x8ce0('0x7'));var config=require('../../config/environment');var controller=require(_0x8ce0('0x8'));router['get']('/',auth[_0x8ce0('0x9')](),controller[_0x8ce0('0xa')]);router['get']('/describe',auth[_0x8ce0('0x9')](),controller[_0x8ce0('0xb')]);router[_0x8ce0('0xc')](_0x8ce0('0xd'),auth[_0x8ce0('0x9')](),controller[_0x8ce0('0xe')]);router[_0x8ce0('0xc')](_0x8ce0('0xf'),auth[_0x8ce0('0x9')](),controller[_0x8ce0('0x10')]);router['post']('/',auth[_0x8ce0('0x9')](),controller[_0x8ce0('0x11')]);router[_0x8ce0('0x12')](_0x8ce0('0xf'),controller[_0x8ce0('0x13')]);router[_0x8ce0('0x14')]('/:id',auth[_0x8ce0('0x9')](),controller[_0x8ce0('0x15')]);module[_0x8ce0('0x16')]=router; \ No newline at end of file +var _0xb3f9=['../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x4e9343,_0x102660){_0x4e9343=_0x4e9343-0x0;var _0x12a1a1=_0xb3f9[_0x4e9343];return _0x12a1a1;};'use strict';var multer=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b3f('0x2'));var router=express['Router']();var auth=require(_0x9b3f('0x3'));var interaction=require(_0x9b3f('0x4'));var config=require(_0x9b3f('0x5'));var controller=require(_0x9b3f('0x6'));router[_0x9b3f('0x7')]('/',auth[_0x9b3f('0x8')](),controller['index']);router['get'](_0x9b3f('0x9'),auth[_0x9b3f('0x8')](),controller['describe']);router[_0x9b3f('0x7')]('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x9b3f('0x7')]('/:id',auth[_0x9b3f('0x8')](),controller[_0x9b3f('0xa')]);router[_0x9b3f('0xb')]('/',auth[_0x9b3f('0x8')](),controller[_0x9b3f('0xc')]);router['put'](_0x9b3f('0xd'),controller[_0x9b3f('0xe')]);router[_0x9b3f('0xf')](_0x9b3f('0xd'),auth[_0x9b3f('0x8')](),controller[_0x9b3f('0x10')]);module[_0x9b3f('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 945fe2c..1556997 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 _0x933a=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x933a,0x1d6));var _0xa933=function(_0x501f10,_0x567e11){_0x501f10=_0x501f10-0x0;var _0x5314c7=_0x933a[_0x501f10];return _0x5314c7;};'use strict';var Sequelize=require(_0xa933('0x0'));module[_0xa933('0x1')]={'body':{'type':Sequelize[_0xa933('0x2')](_0xa933('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa933('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa933('0x5')]('in',_0xa933('0x6')),'defaultValue':_0xa933('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa933('0x7')]}}; \ No newline at end of file +var _0x141c=['out','DATE','sequelize','BOOLEAN','ENUM'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x141c,0x10b));var _0xc141=function(_0x38b5ba,_0x4cb2ac){_0x38b5ba=_0x38b5ba-0x0;var _0x1a3829=_0x141c[_0x38b5ba];return _0x1a3829;};'use strict';var Sequelize=require(_0xc141('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc141('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc141('0x2')]('in','out'),'defaultValue':_0xc141('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc141('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 1eca0b9..0768368 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 _0x2f4f=['EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','status','end','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','ChatMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','update','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x2f4f,0x83));var _0xf2f4=function(_0x5b9b56,_0x1dd1cc){_0x5b9b56=_0x5b9b56-0x0;var _0x3360a1=_0x2f4f[_0x5b9b56];return _0x3360a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2f4('0x1'));var jsonpatch=require(_0xf2f4('0x2'));var rp=require('request-promise');var moment=require(_0xf2f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf2f4('0x4'));var util=require(_0xf2f4('0x5'));var path=require(_0xf2f4('0x6'));var sox=require('sox');var csv=require(_0xf2f4('0x7'));var ejs=require(_0xf2f4('0x8'));var fs=require('fs');var _=require(_0xf2f4('0x9'));var squel=require(_0xf2f4('0xa'));var crypto=require(_0xf2f4('0xb'));var jsforce=require(_0xf2f4('0xc'));var deskjs=require(_0xf2f4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf2f4('0xe'));var Papa=require(_0xf2f4('0xf'));var Redis=require(_0xf2f4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf2f4('0x11'));var hardwareService=require(_0xf2f4('0x12'));var logger=require(_0xf2f4('0x13'))(_0xf2f4('0x14'));var utils=require('../../config/utils');var config=require(_0xf2f4('0x15'));var db=require('../../mysqldb')['db'];config[_0xf2f4('0x16')]=_[_0xf2f4('0x17')](config['redis'],{'host':_0xf2f4('0x18'),'port':0x18eb});var socket=require(_0xf2f4('0x19'))(new Redis(config[_0xf2f4('0x16')]));require(_0xf2f4('0x1a'))[_0xf2f4('0x1b')](socket);var jayson=require(_0xf2f4('0x1c'));var client=jayson[_0xf2f4('0x1d')][_0xf2f4('0x1e')]({'port':0x232c});var client9002=jayson[_0xf2f4('0x1d')][_0xf2f4('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4de870,_0x498163,_0x3baf4d){if(_0x3baf4d){var _0x4a320d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a320d['test'](_0x498163)){return _0x4de870;}else{throw new Error(_0xf2f4('0x1f'));}}else{return _0x4de870;}}function respondWithRpcPromise(_0x5e1ee8,_0x1315b5,_0x23748b,_0x52a165){return new BPromise(function(_0x466c3c,_0x4c1f1c){var _0x553762=_0x52a165||client;return _0x553762[_0xf2f4('0x20')](_0x5e1ee8,_0x23748b)[_0xf2f4('0x21')](function(_0x472a61){logger[_0xf2f4('0x22')]('ChatMessage,\x20%s,\x20%s',_0x1315b5,_0xf2f4('0x23'));logger[_0xf2f4('0x24')](_0xf2f4('0x25'),_0x1315b5,_0xf2f4('0x23'),JSON[_0xf2f4('0x26')](_0x472a61));if(_0x472a61[_0xf2f4('0x27')]){if(_0x472a61['error']['code']===0x1f4){logger[_0xf2f4('0x27')](_0xf2f4('0x28'),_0x1315b5,_0x472a61[_0xf2f4('0x27')][_0xf2f4('0x29')]);return _0x4c1f1c(_0x472a61['error'][_0xf2f4('0x29')]);}logger[_0xf2f4('0x27')]('ChatMessage,\x20%s,\x20%s',_0x1315b5,_0x472a61['error'][_0xf2f4('0x29')]);return _0x466c3c(_0x472a61[_0xf2f4('0x27')][_0xf2f4('0x29')]);}else{logger[_0xf2f4('0x22')](_0xf2f4('0x28'),_0x1315b5,'request\x20sent');_0x466c3c(_0x472a61[_0xf2f4('0x2a')][_0xf2f4('0x29')]);}})['catch'](function(_0x1cd4d8){logger[_0xf2f4('0x27')](_0xf2f4('0x28'),_0x1315b5,_0x1cd4d8);_0x4c1f1c(_0x1cd4d8);});});}function respondWithStatusCode(_0x13225a,_0x29a099){_0x29a099=_0x29a099||0xcc;return function(_0x589186){if(_0x589186){return _0x13225a['sendStatus'](_0x29a099);}return _0x13225a[_0xf2f4('0x2b')](_0x29a099)[_0xf2f4('0x2c')]();};}function respondWithResult(_0x1a84fc,_0x6af9a9){_0x6af9a9=_0x6af9a9||0xc8;return function(_0x59e66f){if(_0x59e66f){return _0x1a84fc[_0xf2f4('0x2b')](_0x6af9a9)['json'](_0x59e66f);}};}function respondWithFilteredResult(_0x1edd21,_0x183547){return function(_0x16a551){if(_0x16a551){var _0x346c8c=_0x16a551['count'],_0x5c4a0d=_0x183547[_0xf2f4('0x2d')],_0x2aefd7=_0x183547[_0xf2f4('0x2d')]+_0x183547[_0xf2f4('0x2e')],_0x3d3f2f;if(_0x2aefd7>=_0x346c8c){_0x2aefd7=_0x346c8c;_0x3d3f2f=0xc8;}else{_0x3d3f2f=0xce;}_0x1edd21[_0xf2f4('0x2b')](_0x3d3f2f);return _0x1edd21[_0xf2f4('0x2f')](_0xf2f4('0x30'),_0x5c4a0d+'-'+_0x2aefd7+'/'+_0x346c8c)['json'](_0x16a551);}return null;};}function patchUpdates(_0x1b574c){return function(_0x4f81ee){try{jsonpatch[_0xf2f4('0x31')](_0x4f81ee,_0x1b574c,!![]);}catch(_0x274136){return BPromise[_0xf2f4('0x32')](_0x274136);}return _0x4f81ee[_0xf2f4('0x33')]();};}function saveUpdates(_0x6a3718,_0x358d75){return function(_0x5b2da6){if(_0x5b2da6){return _0x5b2da6['update'](_0x6a3718)[_0xf2f4('0x21')](function(_0x2c4242){return _0x2c4242;});}return null;};}function removeEntity(_0x394f1c,_0x3d1ac7){return function(_0xfb127f){if(_0xfb127f){return _0xfb127f[_0xf2f4('0x34')]()['then'](function(){_0x394f1c[_0xf2f4('0x2b')](0xcc)[_0xf2f4('0x2c')]();});}};}function handleEntityNotFound(_0x351b95,_0x1f8a9c){return function(_0x1f54c1){if(!_0x1f54c1){_0x351b95[_0xf2f4('0x35')](0x194);}return _0x1f54c1;};}function handleError(_0x2a9764,_0x35337a){_0x35337a=_0x35337a||0x1f4;return function(_0x2beab2){logger[_0xf2f4('0x27')](_0x2beab2[_0xf2f4('0x36')]);if(_0x2beab2[_0xf2f4('0x37')]){delete _0x2beab2[_0xf2f4('0x37')];}_0x2a9764[_0xf2f4('0x2b')](_0x35337a)[_0xf2f4('0x38')](_0x2beab2);};}exports[_0xf2f4('0x39')]=function(_0x3358eb,_0x4bd035){var _0x3cb2b3={},_0x44f703={},_0x119d1b={'count':0x0,'rows':[]};var _0x4e1a82=db[_0xf2f4('0x3a')][_0xf2f4('0x3b')];_0x44f703[_0xf2f4('0x3c')]=_['keys'](_0x4e1a82);_0x44f703[_0xf2f4('0x3d')]=_[_0xf2f4('0x3e')](_0x3358eb['query']);_0x44f703[_0xf2f4('0x3f')]=_[_0xf2f4('0x40')](_0x44f703[_0xf2f4('0x3c')],_0x44f703[_0xf2f4('0x3d')]);_0x3cb2b3[_0xf2f4('0x41')]=_['intersection'](_0x44f703[_0xf2f4('0x3c')],qs[_0xf2f4('0x42')](_0x3358eb['query'][_0xf2f4('0x42')]));_0x3cb2b3[_0xf2f4('0x41')]=_0x3cb2b3[_0xf2f4('0x41')]['length']?_0x3cb2b3[_0xf2f4('0x41')]:_0x44f703[_0xf2f4('0x3c')];if(!_0x3358eb[_0xf2f4('0x3d')][_0xf2f4('0x43')](_0xf2f4('0x44'))){_0x3cb2b3[_0xf2f4('0x2e')]=qs[_0xf2f4('0x2e')](_0x3358eb[_0xf2f4('0x3d')][_0xf2f4('0x2e')]);_0x3cb2b3[_0xf2f4('0x2d')]=qs[_0xf2f4('0x2d')](_0x3358eb['query'][_0xf2f4('0x2d')]);}_0x3cb2b3[_0xf2f4('0x45')]=qs[_0xf2f4('0x46')](_0x3358eb['query']['sort']);_0x3cb2b3[_0xf2f4('0x47')]=qs['filters'](_['pick'](_0x3358eb[_0xf2f4('0x3d')],_0x44f703[_0xf2f4('0x3f')]));if(_0x3358eb[_0xf2f4('0x3d')][_0xf2f4('0x48')]){_0x3cb2b3[_0xf2f4('0x47')]=_[_0xf2f4('0x49')](_0x3cb2b3[_0xf2f4('0x47')],{'$or':_[_0xf2f4('0x4a')](_0x4e1a82,function(_0x54503d){if(_0x54503d[_0xf2f4('0x4b')][_0xf2f4('0x4c')]!==_0xf2f4('0x4d')){var _0x4ff030={};_0x4ff030[_0x54503d['field']]={'$like':'%'+_0x3358eb[_0xf2f4('0x3d')][_0xf2f4('0x48')]+'%'};return _0x4ff030;}})});}_0x3cb2b3=_[_0xf2f4('0x49')]({},_0x3cb2b3,_0x3358eb[_0xf2f4('0x4e')]);var _0x187fbb={'where':_0x3cb2b3[_0xf2f4('0x47')]};return db[_0xf2f4('0x3a')][_0xf2f4('0x4f')](_0x187fbb)[_0xf2f4('0x21')](function(_0xc93a88){_0x119d1b[_0xf2f4('0x4f')]=_0xc93a88;if(_0x3358eb['query'][_0xf2f4('0x50')]){_0x3cb2b3['include']=[{'all':!![]}];}return db[_0xf2f4('0x3a')][_0xf2f4('0x51')](_0x3cb2b3);})[_0xf2f4('0x21')](function(_0x18c0f2){_0x119d1b[_0xf2f4('0x52')]=_0x18c0f2;return _0x119d1b;})[_0xf2f4('0x21')](respondWithFilteredResult(_0x4bd035,_0x3cb2b3))[_0xf2f4('0x53')](handleError(_0x4bd035,null));};exports[_0xf2f4('0x54')]=function(_0x5b950e,_0x131832){var _0x239a20={'raw':!![],'where':{'id':_0x5b950e[_0xf2f4('0x55')]['id']}},_0x3e6ce6={};_0x3e6ce6[_0xf2f4('0x3c')]=_[_0xf2f4('0x3e')](db['ChatMessage'][_0xf2f4('0x3b')]);_0x3e6ce6['query']=_['keys'](_0x5b950e[_0xf2f4('0x3d')]);_0x3e6ce6['filters']=_[_0xf2f4('0x40')](_0x3e6ce6[_0xf2f4('0x3c')],_0x3e6ce6[_0xf2f4('0x3d')]);_0x239a20[_0xf2f4('0x41')]=_[_0xf2f4('0x40')](_0x3e6ce6[_0xf2f4('0x3c')],qs[_0xf2f4('0x42')](_0x5b950e[_0xf2f4('0x3d')]['fields']));_0x239a20['attributes']=_0x239a20['attributes']['length']?_0x239a20[_0xf2f4('0x41')]:_0x3e6ce6[_0xf2f4('0x3c')];if(_0x5b950e[_0xf2f4('0x3d')]['includeAll']){_0x239a20[_0xf2f4('0x56')]=[{'all':!![]}];}_0x239a20=_[_0xf2f4('0x49')]({},_0x239a20,_0x5b950e[_0xf2f4('0x4e')]);return db[_0xf2f4('0x3a')]['find'](_0x239a20)['then'](handleEntityNotFound(_0x131832,null))[_0xf2f4('0x21')](respondWithResult(_0x131832,null))[_0xf2f4('0x53')](handleError(_0x131832,null));};exports[_0xf2f4('0x57')]=function(_0x46dad7,_0x8bfb8b){return db['ChatMessage'][_0xf2f4('0x57')](_0x46dad7['body'],{})['then'](respondWithResult(_0x8bfb8b,0xc9))[_0xf2f4('0x53')](handleError(_0x8bfb8b,null));};exports[_0xf2f4('0x58')]=function(_0x27fd47,_0x3bb702){if(_0x27fd47[_0xf2f4('0x59')]['id']){delete _0x27fd47['body']['id'];}return db[_0xf2f4('0x3a')][_0xf2f4('0x5a')]({'where':{'id':_0x27fd47[_0xf2f4('0x55')]['id']}})[_0xf2f4('0x21')](handleEntityNotFound(_0x3bb702,null))[_0xf2f4('0x21')](saveUpdates(_0x27fd47[_0xf2f4('0x59')],null))[_0xf2f4('0x21')](respondWithResult(_0x3bb702,null))['catch'](handleError(_0x3bb702,null));};exports[_0xf2f4('0x34')]=function(_0x1785af,_0x2492dd){return db[_0xf2f4('0x3a')][_0xf2f4('0x5a')]({'where':{'id':_0x1785af['params']['id']}})['then'](handleEntityNotFound(_0x2492dd,null))[_0xf2f4('0x21')](removeEntity(_0x2492dd,null))[_0xf2f4('0x53')](handleError(_0x2492dd,null));};exports[_0xf2f4('0x5b')]=function(_0x2dff95,_0x348fb8){return db[_0xf2f4('0x3a')][_0xf2f4('0x5b')]()[_0xf2f4('0x21')](respondWithResult(_0x348fb8,null))[_0xf2f4('0x53')](handleError(_0x348fb8,null));};var interaction_log=require(_0xf2f4('0x13'))(_0xf2f4('0x5c'));exports[_0xf2f4('0x5d')]=function(_0x570a0c,_0x10a464,_0x982dfd){var _0x41002d={'channel':_0xf2f4('0x5e')};if(_0x570a0c['body']['id']){delete _0x570a0c[_0xf2f4('0x59')]['id'];}_0x570a0c[_0xf2f4('0x59')][_0xf2f4('0x5f')]=!![];_0x570a0c[_0xf2f4('0x59')][_0xf2f4('0x60')]=moment()[_0xf2f4('0x61')](_0xf2f4('0x62'));_0x570a0c[_0xf2f4('0x59')][_0xf2f4('0x63')]=_0x570a0c[_0xf2f4('0x59')][_0xf2f4('0x63')]||_0x570a0c[_0xf2f4('0x64')]['id'];return db[_0xf2f4('0x3a')]['find']({'where':{'id':_0x570a0c[_0xf2f4('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xf2f4('0x65')],'as':_0xf2f4('0x66')}]})[_0xf2f4('0x21')](handleEntityNotFound(_0x10a464,null))['then'](saveUpdates(_0x570a0c[_0xf2f4('0x59')],null))[_0xf2f4('0x21')](function(_0xfadc91){if(_0xfadc91){_0x41002d['message']=_0xfadc91[_0xf2f4('0x67')]({'plain':!![]});return db[_0xf2f4('0x68')]['find']({'where':{'id':_0xfadc91[_0xf2f4('0x69')]}});}return null;})[_0xf2f4('0x21')](handleEntityNotFound(_0x10a464,null))['then'](function(_0x2e81b2){if(_0x2e81b2){return _0x2e81b2[_0xf2f4('0x58')]({'UserId':_0x570a0c['body'][_0xf2f4('0x63')],'read1stAt':_[_0xf2f4('0x6a')](_0x2e81b2['read1stAt'])?moment()[_0xf2f4('0x61')](_0xf2f4('0x62')):undefined});}return null;})[_0xf2f4('0x21')](function(_0x44fe70){if(_0x44fe70){_0x41002d[_0xf2f4('0x6b')]=_0x44fe70[_0xf2f4('0x67')]({'plain':!![]});interaction_log['info'](_0xf2f4('0x6c'),_0x570a0c[_0xf2f4('0x64')]['id'],_0x570a0c[_0xf2f4('0x64')][_0xf2f4('0x37')],_0x570a0c['user'][_0xf2f4('0x6d')],_0x41002d['interaction']['id'],_0x570a0c[_0xf2f4('0x59')]?JSON[_0xf2f4('0x26')](_0x570a0c[_0xf2f4('0x59')]):_0xf2f4('0x6e'));return respondWithRpcPromise(_0xf2f4('0x6f'),_0xf2f4('0x70'),_0x41002d);}return null;})['then'](function(_0x4a1ab2){if(_0x4a1ab2){if(_0x570a0c['body'][_0xf2f4('0x71')]){_0x41002d[_0xf2f4('0x29')][_0xf2f4('0x72')]=util[_0xf2f4('0x61')]('SIP/%s',_0x570a0c[_0xf2f4('0x64')]['name']);_0x41002d['message'][_0xf2f4('0x73')]=_0x41002d[_0xf2f4('0x73')];_0x41002d[_0xf2f4('0x29')][_0xf2f4('0x74')]=_0xf2f4('0x5d');return respondWithRpcPromise(_0xf2f4('0x75'),_0xf2f4('0x75'),{'event':_0xf2f4('0x76'),'message':_[_0xf2f4('0x49')](_0x41002d['message'],JSON['parse'](_0x41002d['interaction'][_0xf2f4('0x77')]))},client9002)['then'](function(){return _0x41002d;});}return _0x41002d;}return null;})[_0xf2f4('0x21')](respondWithResult(_0x10a464,null))[_0xf2f4('0x53')](handleError(_0x10a464,null));};var interaction_log=require(_0xf2f4('0x13'))(_0xf2f4('0x5c'));exports[_0xf2f4('0x32')]=function(_0xb25c29,_0x49a2d0,_0x3c2d8a){var _0x6f8d92={'agent':{},'channel':_0xf2f4('0x5e')};if(_0xb25c29[_0xf2f4('0x59')]['id']){delete _0xb25c29[_0xf2f4('0x59')]['id'];}_0xb25c29[_0xf2f4('0x59')]['UserId']=_0xb25c29[_0xf2f4('0x59')]['UserId']||_0xb25c29[_0xf2f4('0x64')]['id'];_0x6f8d92['agent']['id']=_0xb25c29['body'][_0xf2f4('0x63')];return db[_0xf2f4('0x3a')][_0xf2f4('0x5a')]({'where':{'id':_0xb25c29[_0xf2f4('0x55')]['id'],'UserId':null}})[_0xf2f4('0x21')](handleEntityNotFound(_0x49a2d0,null))[_0xf2f4('0x21')](function(_0x1d6d88){if(_0x1d6d88){_0x6f8d92['message']=_0x1d6d88[_0xf2f4('0x67')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1d6d88[_0xf2f4('0x69')]}});}return null;})[_0xf2f4('0x21')](handleEntityNotFound(_0x49a2d0,null))[_0xf2f4('0x21')](function(_0x1a489b){if(_0x1a489b){_0x6f8d92['interaction']=_0x1a489b[_0xf2f4('0x67')]({'plain':!![]});interaction_log[_0xf2f4('0x22')](_0xf2f4('0x78'),_0xb25c29['user']['id'],_0xb25c29['user'][_0xf2f4('0x37')],_0xb25c29['user'][_0xf2f4('0x6d')],_0x6f8d92[_0xf2f4('0x6b')]['id'],_0xb25c29['body']?JSON['stringify'](_0xb25c29[_0xf2f4('0x59')]):_0xf2f4('0x6e'));return respondWithRpcPromise(_0xf2f4('0x79'),_0xf2f4('0x7a'),_0x6f8d92);}return null;})[_0xf2f4('0x21')](function(_0x33d662){if(_0x33d662){_0x33d662[_0xf2f4('0x29')][_0xf2f4('0x72')]=util[_0xf2f4('0x61')]('SIP/%s',_0xb25c29[_0xf2f4('0x64')][_0xf2f4('0x37')]);_0x33d662['message'][_0xf2f4('0x73')]=_0x6f8d92[_0xf2f4('0x73')];_0x33d662['message'][_0xf2f4('0x74')]=_0xf2f4('0x32');respondWithRpcPromise(_0xf2f4('0x75'),_0xf2f4('0x75'),{'event':_0xf2f4('0x7b'),'message':_0x33d662['message']},client9002);return _0x6f8d92;}return null;})['then'](respondWithResult(_0x49a2d0,null))[_0xf2f4('0x53')](handleError(_0x49a2d0,null));}; \ No newline at end of file +var _0x3212=['SIP/%s','event','EventManager','acceptmessage','parse','formData','agent','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','count','offset','status','set','reject','save','update','destroy','stack','name','send','index','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','where','filter','merge','map','key','VIRTUAL','field','ChatMessage','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','chat-interactions','chat','read','readAt','format','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','role','acceptMessage','interface'];(function(_0x6f0460,_0x2526f4){var _0x6dcdb6=function(_0x5d5244){while(--_0x5d5244){_0x6f0460['push'](_0x6f0460['shift']());}};_0x6dcdb6(++_0x2526f4);}(_0x3212,0x1d1));var _0x2321=function(_0x8a84a1,_0x1e0920){_0x8a84a1=_0x8a84a1-0x0;var _0x4be3d6=_0x3212[_0x8a84a1];return _0x4be3d6;};'use strict';var pdf=require(_0x2321('0x0'));var emlformat=require(_0x2321('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2321('0x2'));var jsonpatch=require(_0x2321('0x3'));var rp=require(_0x2321('0x4'));var moment=require('moment');var BPromise=require(_0x2321('0x5'));var Mustache=require(_0x2321('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2321('0x7'));var csv=require(_0x2321('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2321('0x9'));var squel=require(_0x2321('0xa'));var crypto=require(_0x2321('0xb'));var jsforce=require(_0x2321('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2321('0x8'));var querystring=require(_0x2321('0xd'));var Papa=require(_0x2321('0xe'));var Redis=require(_0x2321('0xf'));var authService=require(_0x2321('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2321('0x11'))(_0x2321('0x12'));var utils=require(_0x2321('0x13'));var config=require(_0x2321('0x14'));var db=require('../../mysqldb')['db'];config[_0x2321('0x15')]=_[_0x2321('0x16')](config['redis'],{'host':_0x2321('0x17'),'port':0x18eb});var socket=require(_0x2321('0x18'))(new Redis(config[_0x2321('0x15')]));require(_0x2321('0x19'))[_0x2321('0x1a')](socket);var jayson=require(_0x2321('0x1b'));var client=jayson[_0x2321('0x1c')][_0x2321('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x2321('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x353b7c,_0x2d48ae,_0x436d7f){if(_0x436d7f){var _0x217f8b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x217f8b['test'](_0x2d48ae)){return _0x353b7c;}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 _0x353b7c;}}function respondWithRpcPromise(_0x25253e,_0x5426d5,_0x157578,_0x9a0281){return new BPromise(function(_0x23bc82,_0x32f863){var _0x552b6f=_0x9a0281||client;return _0x552b6f[_0x2321('0x1e')](_0x25253e,_0x157578)[_0x2321('0x1f')](function(_0x5b79d3){logger['info'](_0x2321('0x20'),_0x5426d5,_0x2321('0x21'));logger['debug'](_0x2321('0x22'),_0x5426d5,_0x2321('0x21'),JSON[_0x2321('0x23')](_0x5b79d3));if(_0x5b79d3[_0x2321('0x24')]){if(_0x5b79d3[_0x2321('0x24')][_0x2321('0x25')]===0x1f4){logger[_0x2321('0x24')](_0x2321('0x20'),_0x5426d5,_0x5b79d3[_0x2321('0x24')]['message']);return _0x32f863(_0x5b79d3[_0x2321('0x24')][_0x2321('0x26')]);}logger[_0x2321('0x24')](_0x2321('0x20'),_0x5426d5,_0x5b79d3[_0x2321('0x24')][_0x2321('0x26')]);return _0x23bc82(_0x5b79d3[_0x2321('0x24')][_0x2321('0x26')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5426d5,_0x2321('0x21'));_0x23bc82(_0x5b79d3['result']['message']);}})['catch'](function(_0x1b6e6f){logger[_0x2321('0x24')](_0x2321('0x20'),_0x5426d5,_0x1b6e6f);_0x32f863(_0x1b6e6f);});});}function respondWithStatusCode(_0x3dd2b0,_0x2a7dbc){_0x2a7dbc=_0x2a7dbc||0xcc;return function(_0x4ed52f){if(_0x4ed52f){return _0x3dd2b0[_0x2321('0x27')](_0x2a7dbc);}return _0x3dd2b0['status'](_0x2a7dbc)[_0x2321('0x28')]();};}function respondWithResult(_0x1ed7cb,_0x20c69c){_0x20c69c=_0x20c69c||0xc8;return function(_0x6c7624){if(_0x6c7624){return _0x1ed7cb['status'](_0x20c69c)[_0x2321('0x29')](_0x6c7624);}};}function respondWithFilteredResult(_0x4e3022,_0x434755){return function(_0x4d74a3){if(_0x4d74a3){var _0x42e294=_0x4d74a3[_0x2321('0x2a')],_0xe47ebf=_0x434755[_0x2321('0x2b')],_0xb7278=_0x434755['offset']+_0x434755['limit'],_0x4b8172;if(_0xb7278>=_0x42e294){_0xb7278=_0x42e294;_0x4b8172=0xc8;}else{_0x4b8172=0xce;}_0x4e3022[_0x2321('0x2c')](_0x4b8172);return _0x4e3022[_0x2321('0x2d')]('Content-Range',_0xe47ebf+'-'+_0xb7278+'/'+_0x42e294)[_0x2321('0x29')](_0x4d74a3);}return null;};}function patchUpdates(_0xd224dd){return function(_0x50ce87){try{jsonpatch['apply'](_0x50ce87,_0xd224dd,!![]);}catch(_0x3654a0){return BPromise[_0x2321('0x2e')](_0x3654a0);}return _0x50ce87[_0x2321('0x2f')]();};}function saveUpdates(_0x2e4fc8,_0x46817f){return function(_0x4cc275){if(_0x4cc275){return _0x4cc275[_0x2321('0x30')](_0x2e4fc8)['then'](function(_0x40140a){return _0x40140a;});}return null;};}function removeEntity(_0x2b429b,_0x40a772){return function(_0x87f17d){if(_0x87f17d){return _0x87f17d[_0x2321('0x31')]()[_0x2321('0x1f')](function(){_0x2b429b['status'](0xcc)[_0x2321('0x28')]();});}};}function handleEntityNotFound(_0x2d7009,_0x1a1b67){return function(_0x2311e6){if(!_0x2311e6){_0x2d7009[_0x2321('0x27')](0x194);}return _0x2311e6;};}function handleError(_0x3fff14,_0x4303c3){_0x4303c3=_0x4303c3||0x1f4;return function(_0x50607e){logger[_0x2321('0x24')](_0x50607e[_0x2321('0x32')]);if(_0x50607e['name']){delete _0x50607e[_0x2321('0x33')];}_0x3fff14[_0x2321('0x2c')](_0x4303c3)[_0x2321('0x34')](_0x50607e);};}exports[_0x2321('0x35')]=function(_0x8ad36c,_0x49562e){var _0x2c1f3d={},_0x18e153={},_0x368ece={'count':0x0,'rows':[]};var _0xf7e766=db['ChatMessage']['rawAttributes'];_0x18e153['model']=_[_0x2321('0x36')](_0xf7e766);_0x18e153[_0x2321('0x37')]=_[_0x2321('0x36')](_0x8ad36c[_0x2321('0x37')]);_0x18e153[_0x2321('0x38')]=_['intersection'](_0x18e153['model'],_0x18e153[_0x2321('0x37')]);_0x2c1f3d[_0x2321('0x39')]=_[_0x2321('0x3a')](_0x18e153[_0x2321('0x3b')],qs[_0x2321('0x3c')](_0x8ad36c['query']['fields']));_0x2c1f3d[_0x2321('0x39')]=_0x2c1f3d[_0x2321('0x39')][_0x2321('0x3d')]?_0x2c1f3d[_0x2321('0x39')]:_0x18e153[_0x2321('0x3b')];if(!_0x8ad36c['query'][_0x2321('0x3e')](_0x2321('0x3f'))){_0x2c1f3d[_0x2321('0x40')]=qs[_0x2321('0x40')](_0x8ad36c['query'][_0x2321('0x40')]);_0x2c1f3d[_0x2321('0x2b')]=qs[_0x2321('0x2b')](_0x8ad36c[_0x2321('0x37')]['offset']);}_0x2c1f3d['order']=qs['sort'](_0x8ad36c[_0x2321('0x37')]['sort']);_0x2c1f3d[_0x2321('0x41')]=qs[_0x2321('0x38')](_['pick'](_0x8ad36c['query'],_0x18e153['filters']));if(_0x8ad36c[_0x2321('0x37')][_0x2321('0x42')]){_0x2c1f3d[_0x2321('0x41')]=_[_0x2321('0x43')](_0x2c1f3d[_0x2321('0x41')],{'$or':_[_0x2321('0x44')](_0xf7e766,function(_0x258229){if(_0x258229['type'][_0x2321('0x45')]!==_0x2321('0x46')){var _0x2253ec={};_0x2253ec[_0x258229[_0x2321('0x47')]]={'$like':'%'+_0x8ad36c['query'][_0x2321('0x42')]+'%'};return _0x2253ec;}})});}_0x2c1f3d=_[_0x2321('0x43')]({},_0x2c1f3d,_0x8ad36c['options']);var _0x1cebad={'where':_0x2c1f3d[_0x2321('0x41')]};return db[_0x2321('0x48')]['count'](_0x1cebad)['then'](function(_0x1ddf2f){_0x368ece[_0x2321('0x2a')]=_0x1ddf2f;if(_0x8ad36c[_0x2321('0x37')][_0x2321('0x49')]){_0x2c1f3d[_0x2321('0x4a')]=[{'all':!![]}];}return db[_0x2321('0x48')][_0x2321('0x4b')](_0x2c1f3d);})[_0x2321('0x1f')](function(_0x23f307){_0x368ece[_0x2321('0x4c')]=_0x23f307;return _0x368ece;})[_0x2321('0x1f')](respondWithFilteredResult(_0x49562e,_0x2c1f3d))['catch'](handleError(_0x49562e,null));};exports['show']=function(_0x2db2d5,_0x3c2c36){var _0x5750b5={'raw':!![],'where':{'id':_0x2db2d5[_0x2321('0x4d')]['id']}},_0x127c91={};_0x127c91[_0x2321('0x3b')]=_['keys'](db['ChatMessage'][_0x2321('0x4e')]);_0x127c91['query']=_['keys'](_0x2db2d5['query']);_0x127c91['filters']=_[_0x2321('0x3a')](_0x127c91[_0x2321('0x3b')],_0x127c91[_0x2321('0x37')]);_0x5750b5['attributes']=_[_0x2321('0x3a')](_0x127c91['model'],qs[_0x2321('0x3c')](_0x2db2d5[_0x2321('0x37')][_0x2321('0x3c')]));_0x5750b5[_0x2321('0x39')]=_0x5750b5[_0x2321('0x39')][_0x2321('0x3d')]?_0x5750b5[_0x2321('0x39')]:_0x127c91[_0x2321('0x3b')];if(_0x2db2d5['query'][_0x2321('0x49')]){_0x5750b5[_0x2321('0x4a')]=[{'all':!![]}];}_0x5750b5=_[_0x2321('0x43')]({},_0x5750b5,_0x2db2d5['options']);return db[_0x2321('0x48')][_0x2321('0x4f')](_0x5750b5)[_0x2321('0x1f')](handleEntityNotFound(_0x3c2c36,null))[_0x2321('0x1f')](respondWithResult(_0x3c2c36,null))[_0x2321('0x50')](handleError(_0x3c2c36,null));};exports[_0x2321('0x51')]=function(_0x35dc5f,_0x339770){return db[_0x2321('0x48')][_0x2321('0x51')](_0x35dc5f[_0x2321('0x52')],{})[_0x2321('0x1f')](respondWithResult(_0x339770,0xc9))[_0x2321('0x50')](handleError(_0x339770,null));};exports['update']=function(_0x529ba3,_0x132ea0){if(_0x529ba3[_0x2321('0x52')]['id']){delete _0x529ba3[_0x2321('0x52')]['id'];}return db['ChatMessage'][_0x2321('0x4f')]({'where':{'id':_0x529ba3[_0x2321('0x4d')]['id']}})[_0x2321('0x1f')](handleEntityNotFound(_0x132ea0,null))[_0x2321('0x1f')](saveUpdates(_0x529ba3['body'],null))[_0x2321('0x1f')](respondWithResult(_0x132ea0,null))[_0x2321('0x50')](handleError(_0x132ea0,null));};exports['destroy']=function(_0x414c30,_0x325756){return db[_0x2321('0x48')][_0x2321('0x4f')]({'where':{'id':_0x414c30[_0x2321('0x4d')]['id']}})[_0x2321('0x1f')](handleEntityNotFound(_0x325756,null))[_0x2321('0x1f')](removeEntity(_0x325756,null))[_0x2321('0x50')](handleError(_0x325756,null));};exports['describe']=function(_0x29c7e9,_0x43ab01){return db['ChatMessage'][_0x2321('0x53')]()[_0x2321('0x1f')](respondWithResult(_0x43ab01,null))[_0x2321('0x50')](handleError(_0x43ab01,null));};var interaction_log=require(_0x2321('0x11'))(_0x2321('0x54'));exports['accept']=function(_0x38ad8a,_0x2e772a,_0x547ba8){var _0x4c5088={'channel':_0x2321('0x55')};if(_0x38ad8a[_0x2321('0x52')]['id']){delete _0x38ad8a[_0x2321('0x52')]['id'];}_0x38ad8a[_0x2321('0x52')][_0x2321('0x56')]=!![];_0x38ad8a[_0x2321('0x52')][_0x2321('0x57')]=moment()[_0x2321('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x38ad8a[_0x2321('0x52')][_0x2321('0x59')]=_0x38ad8a['body'][_0x2321('0x59')]||_0x38ad8a[_0x2321('0x5a')]['id'];return db[_0x2321('0x48')][_0x2321('0x4f')]({'where':{'id':_0x38ad8a[_0x2321('0x4d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x2321('0x5b')}]})['then'](handleEntityNotFound(_0x2e772a,null))['then'](saveUpdates(_0x38ad8a[_0x2321('0x52')],null))[_0x2321('0x1f')](function(_0x451858){if(_0x451858){_0x4c5088['message']=_0x451858[_0x2321('0x5c')]({'plain':!![]});return db[_0x2321('0x5d')][_0x2321('0x4f')]({'where':{'id':_0x451858[_0x2321('0x5e')]}});}return null;})[_0x2321('0x1f')](handleEntityNotFound(_0x2e772a,null))[_0x2321('0x1f')](function(_0x3da07e){if(_0x3da07e){return _0x3da07e['update']({'UserId':_0x38ad8a['body'][_0x2321('0x59')],'read1stAt':_['isNil'](_0x3da07e['read1stAt'])?moment()[_0x2321('0x58')](_0x2321('0x5f')):undefined});}return null;})[_0x2321('0x1f')](function(_0xbfdf70){if(_0xbfdf70){_0x4c5088[_0x2321('0x60')]=_0xbfdf70[_0x2321('0x5c')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38ad8a['user']['id'],_0x38ad8a[_0x2321('0x5a')]['name'],_0x38ad8a[_0x2321('0x5a')][_0x2321('0x61')],_0x4c5088[_0x2321('0x60')]['id'],_0x38ad8a[_0x2321('0x52')]?JSON['stringify'](_0x38ad8a[_0x2321('0x52')]):'null');return respondWithRpcPromise('AcceptMessage',_0x2321('0x62'),_0x4c5088);}return null;})['then'](function(_0x5505f0){if(_0x5505f0){if(_0x38ad8a[_0x2321('0x52')]['manual']){_0x4c5088[_0x2321('0x26')][_0x2321('0x63')]=util[_0x2321('0x58')](_0x2321('0x64'),_0x38ad8a['user'][_0x2321('0x33')]);_0x4c5088[_0x2321('0x26')]['channel']=_0x4c5088['channel'];_0x4c5088[_0x2321('0x26')][_0x2321('0x65')]='accept';return respondWithRpcPromise(_0x2321('0x66'),_0x2321('0x66'),{'event':_0x2321('0x67'),'message':_[_0x2321('0x43')](_0x4c5088[_0x2321('0x26')],JSON[_0x2321('0x68')](_0x4c5088[_0x2321('0x60')][_0x2321('0x69')]))},client9002)['then'](function(){return _0x4c5088;});}return _0x4c5088;}return null;})['then'](respondWithResult(_0x2e772a,null))['catch'](handleError(_0x2e772a,null));};var interaction_log=require('../../config/logger')(_0x2321('0x54'));exports[_0x2321('0x2e')]=function(_0x4de733,_0xff9ff9,_0xb9fc84){var _0x38f01e={'agent':{},'channel':_0x2321('0x55')};if(_0x4de733['body']['id']){delete _0x4de733['body']['id'];}_0x4de733[_0x2321('0x52')]['UserId']=_0x4de733[_0x2321('0x52')][_0x2321('0x59')]||_0x4de733[_0x2321('0x5a')]['id'];_0x38f01e[_0x2321('0x6a')]['id']=_0x4de733['body'][_0x2321('0x59')];return db[_0x2321('0x48')][_0x2321('0x4f')]({'where':{'id':_0x4de733[_0x2321('0x4d')]['id'],'UserId':null}})[_0x2321('0x1f')](handleEntityNotFound(_0xff9ff9,null))[_0x2321('0x1f')](function(_0x4f5760){if(_0x4f5760){_0x38f01e[_0x2321('0x26')]=_0x4f5760[_0x2321('0x5c')]({'plain':!![]});return db[_0x2321('0x5d')][_0x2321('0x4f')]({'where':{'id':_0x4f5760[_0x2321('0x5e')]}});}return null;})[_0x2321('0x1f')](handleEntityNotFound(_0xff9ff9,null))['then'](function(_0x367f17){if(_0x367f17){_0x38f01e[_0x2321('0x60')]=_0x367f17[_0x2321('0x5c')]({'plain':!![]});interaction_log[_0x2321('0x6b')](_0x2321('0x6c'),_0x4de733[_0x2321('0x5a')]['id'],_0x4de733[_0x2321('0x5a')][_0x2321('0x33')],_0x4de733[_0x2321('0x5a')][_0x2321('0x61')],_0x38f01e[_0x2321('0x60')]['id'],_0x4de733['body']?JSON[_0x2321('0x23')](_0x4de733[_0x2321('0x52')]):'null');return respondWithRpcPromise(_0x2321('0x6d'),_0x2321('0x6e'),_0x38f01e);}return null;})['then'](function(_0x53b91c){if(_0x53b91c){_0x53b91c[_0x2321('0x26')]['interface']=util[_0x2321('0x58')](_0x2321('0x64'),_0x4de733[_0x2321('0x5a')][_0x2321('0x33')]);_0x53b91c[_0x2321('0x26')][_0x2321('0x6f')]=_0x38f01e[_0x2321('0x6f')];_0x53b91c[_0x2321('0x26')][_0x2321('0x65')]=_0x2321('0x2e');respondWithRpcPromise(_0x2321('0x66'),_0x2321('0x66'),{'event':_0x2321('0x70'),'message':_0x53b91c[_0x2321('0x26')]},client9002);return _0x38f01e;}return null;})[_0x2321('0x1f')](respondWithResult(_0xff9ff9,null))[_0x2321('0x50')](handleError(_0xff9ff9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 85e8cc6..f53689c 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 _0x5e30=['setMaxListeners','save','emit','hasOwnProperty','events','../../mysqldb','ChatMessage'];(function(_0x1207af,_0x5c3b3b){var _0x97cd8e=function(_0x1846f2){while(--_0x1846f2){_0x1207af['push'](_0x1207af['shift']());}};_0x97cd8e(++_0x5c3b3b);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x05e3('0x0'));var ChatMessage=require(_0x05e3('0x1'))['db'][_0x05e3('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x05e3('0x3')](0x0);var events={'afterCreate':_0x05e3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5675cc){return function(_0x187527,_0x3d4361,_0xb7eafa){ChatMessageEvents[_0x05e3('0x5')](_0x5675cc+':'+_0x187527['id'],_0x187527);ChatMessageEvents[_0x05e3('0x5')](_0x5675cc,_0x187527);_0xb7eafa(null);};}for(var e in events){if(events[_0x05e3('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x4e5c=['remove','emit','hasOwnProperty','hook','exports','events','ChatMessage','save','update'];(function(_0x443c8e,_0xd13440){var _0xab483a=function(_0x3d387e){while(--_0x3d387e){_0x443c8e['push'](_0x443c8e['shift']());}};_0xab483a(++_0xd13440);}(_0x4e5c,0x149));var _0xc4e5=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x4e5c[_0x6cf19c];return _0xce14f3;};'use strict';var EventEmitter=require(_0xc4e5('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xc4e5('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc4e5('0x2'),'afterUpdate':_0xc4e5('0x3'),'afterDestroy':_0xc4e5('0x4')};function emitEvent(_0x4d3c82){return function(_0x4cd665,_0x4ecd96,_0x2897d3){ChatMessageEvents[_0xc4e5('0x5')](_0x4d3c82+':'+_0x4cd665['id'],_0x4cd665);ChatMessageEvents[_0xc4e5('0x5')](_0x4d3c82,_0x4cd665);_0x2897d3(null);};}for(var e in events){if(events[_0xc4e5('0x6')](e)){var event=events[e];ChatMessage[_0xc4e5('0x7')](e,emitEvent(event));}}module[_0xc4e5('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 7962fda..a6cb12d 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 _0x6a61=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','fti_chat_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x17f452,_0x99c067){var _0x5cc495=function(_0xaa4ae){while(--_0xaa4ae){_0x17f452['push'](_0x17f452['shift']());}};_0x5cc495(++_0x99c067);}(_0x6a61,0x1a0));var _0x16a6=function(_0x52314e,_0x188188){_0x52314e=_0x52314e-0x0;var _0x2b4b4e=_0x6a61[_0x52314e];return _0x2b4b4e;};'use strict';var _=require(_0x16a6('0x0'));var util=require('util');var logger=require(_0x16a6('0x1'))(_0x16a6('0x2'));var moment=require(_0x16a6('0x3'));var BPromise=require(_0x16a6('0x4'));var rp=require(_0x16a6('0x5'));var fs=require('fs');var path=require(_0x16a6('0x6'));var rimraf=require('rimraf');var config=require(_0x16a6('0x7'));var attributes=require(_0x16a6('0x8'));module[_0x16a6('0x9')]=function(_0x1fe432,_0x4746fb){return _0x1fe432['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x16a6('0xa'),'fields':['body'],'type':_0x16a6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a2e93,_0x1c4ae9,_0x5c9c58){var _0x51144d=_0x1fe432[_0x16a6('0xc')];var _0x4e617f=_0x2a2e93['get']({'plain':!![]});if(_0x4e617f[_0x16a6('0xd')][_0x16a6('0xe')]()==='in'||_0x4e617f['direction'][_0x16a6('0xe')]()===_0x16a6('0xf')&&!_0x4e617f[_0x16a6('0x10')]&&!_[_0x16a6('0x11')](_0x4e617f[_0x16a6('0x12')])){_0x51144d[_0x16a6('0x13')][_0x16a6('0x14')]({'where':{'id':_0x4e617f[_0x16a6('0x15')]}})[_0x16a6('0x16')](function(_0x34d667){if(_0x34d667){_0x34d667[_0x16a6('0x17')]({'lastMsgAt':_0x4e617f[_0x16a6('0x18')],'lastMsgDirection':_0x4e617f[_0x16a6('0xd')]['toLowerCase']()});}})[_0x16a6('0x19')](function(_0x873e63){console[_0x16a6('0x1a')](_0x873e63);});}_0x5c9c58();}},'charset':_0x16a6('0x1b'),'collate':_0x16a6('0x1c')});}; \ No newline at end of file +var _0x2f89=['ChatInteractionId','then','catch','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','ChatInteraction','findOne'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x2f89,0x1a6));var _0x92f8=function(_0x543f32,_0x238989){_0x543f32=_0x543f32-0x0;var _0x1f692a=_0x2f89[_0x543f32];return _0x1f692a;};'use strict';var _=require('lodash');var util=require(_0x92f8('0x0'));var logger=require(_0x92f8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x92f8('0x2'));var rp=require(_0x92f8('0x3'));var fs=require('fs');var path=require(_0x92f8('0x4'));var rimraf=require(_0x92f8('0x5'));var config=require('../../config/environment');var attributes=require(_0x92f8('0x6'));module['exports']=function(_0x38c5d4,_0x332c60){return _0x38c5d4[_0x92f8('0x7')](_0x92f8('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x92f8('0x9'),'fields':['body'],'type':_0x92f8('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32bf07,_0x11ff15,_0x5dc9d6){var _0x38f956=_0x38c5d4[_0x92f8('0xb')];var _0x5e3066=_0x32bf07[_0x92f8('0xc')]({'plain':!![]});if(_0x5e3066[_0x92f8('0xd')][_0x92f8('0xe')]()==='in'||_0x5e3066[_0x92f8('0xd')]['toLowerCase']()==='out'&&!_0x5e3066[_0x92f8('0xf')]&&!_['isNil'](_0x5e3066['UserId'])){_0x38f956[_0x92f8('0x10')][_0x92f8('0x11')]({'where':{'id':_0x5e3066[_0x92f8('0x12')]}})[_0x92f8('0x13')](function(_0x44729a){if(_0x44729a){_0x44729a['update']({'lastMsgAt':_0x5e3066['createdAt'],'lastMsgDirection':_0x5e3066['direction'][_0x92f8('0xe')]()});}})[_0x92f8('0x14')](function(_0x2fa1aa){console['error'](_0x2fa1aa);});}_0x5dc9d6();}},'charset':'utf8mb4','collate':_0x92f8('0x15')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0ee658c..5994f66 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 _0x9829=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatMessage','create','options','raw','CreateChatMessage','stringify','util'];(function(_0x25ecd4,_0x5e3ee5){var _0x484c69=function(_0x3492ed){while(--_0x3492ed){_0x25ecd4['push'](_0x25ecd4['shift']());}};_0x484c69(++_0x5e3ee5);}(_0x9829,0x149));var _0x9982=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0x9829[_0x4551f6];return _0x581dc2;};'use strict';var _=require('lodash');var util=require(_0x9982('0x0'));var moment=require('moment');var BPromise=require(_0x9982('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9982('0x2'));var db=require(_0x9982('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9982('0x4'))('rpc');var config=require(_0x9982('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9982('0x6')][_0x9982('0x7')]({'port':0x232a});config[_0x9982('0x8')]=_['defaults'](config[_0x9982('0x8')],{'host':_0x9982('0x9'),'port':0x18eb});var socket=require(_0x9982('0xa'))(new Redis(config[_0x9982('0x8')]));require(_0x9982('0xb'))[_0x9982('0xc')](socket);function respondWithRpcPromise(_0x4a790d,_0xbd0045,_0x314dab){return new BPromise(function(_0x165707,_0x2d0633){return client[_0x9982('0xd')](_0x4a790d,_0x314dab)[_0x9982('0xe')](function(_0x381301){logger['info'](_0x9982('0xf'),_0xbd0045,_0x9982('0x10'));logger[_0x9982('0x11')](_0x9982('0x12'),_0xbd0045,_0x9982('0x10'),JSON['stringify'](_0x381301));if(_0x381301[_0x9982('0x13')]){if(_0x381301[_0x9982('0x13')][_0x9982('0x14')]===0x1f4){logger[_0x9982('0x13')](_0x9982('0xf'),_0xbd0045,_0x381301[_0x9982('0x13')]['message']);return _0x2d0633(_0x381301[_0x9982('0x13')][_0x9982('0x15')]);}logger[_0x9982('0x13')](_0x9982('0xf'),_0xbd0045,_0x381301[_0x9982('0x13')][_0x9982('0x15')]);return _0x165707(_0x381301[_0x9982('0x13')][_0x9982('0x15')]);}else{logger['info'](_0x9982('0xf'),_0xbd0045,_0x9982('0x10'));_0x165707(_0x381301[_0x9982('0x16')]['message']);}})[_0x9982('0x17')](function(_0x1894f3){logger[_0x9982('0x13')]('ChatMessage,\x20%s,\x20%s',_0xbd0045,_0x1894f3);_0x2d0633(_0x1894f3);});});}exports['CreateChatMessage']=function(_0x395362){var _0x16aa17=this;return new Promise(function(_0x6b72ef,_0x379b62){return db[_0x9982('0x18')][_0x9982('0x19')](_0x395362['body'],{'raw':_0x395362[_0x9982('0x1a')]?_0x395362['options'][_0x9982('0x1b')]===undefined?!![]:![]:!![]})[_0x9982('0xe')](function(_0x4ad652){logger['info'](_0x9982('0x1c'),_0x395362);logger[_0x9982('0x11')](_0x9982('0x1c'),_0x395362,JSON[_0x9982('0x1d')](_0x4ad652));_0x6b72ef(_0x4ad652);})[_0x9982('0x17')](function(_0x5a2ff3){logger[_0x9982('0x13')](_0x9982('0x1c'),_0x5a2ff3[_0x9982('0x15')],_0x395362);_0x379b62(_0x16aa17[_0x9982('0x13')](0x1f4,_0x5a2ff3[_0x9982('0x15')]));});});}; \ No newline at end of file +var _0x0664=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','moment','randomstring'];(function(_0x3e3c3f,_0x35aa98){var _0x4e4661=function(_0x75624b){while(--_0x75624b){_0x3e3c3f['push'](_0x3e3c3f['shift']());}};_0x4e4661(++_0x35aa98);}(_0x0664,0xe4));var _0x4066=function(_0x2f9793,_0x36e0a3){_0x2f9793=_0x2f9793-0x0;var _0x1451f2=_0x0664[_0x2f9793];return _0x1451f2;};'use strict';var _=require(_0x4066('0x0'));var util=require('util');var moment=require(_0x4066('0x1'));var BPromise=require('bluebird');var rs=require(_0x4066('0x2'));var fs=require('fs');var Redis=require(_0x4066('0x3'));var db=require(_0x4066('0x4'))['db'];var utils=require(_0x4066('0x5'));var logger=require(_0x4066('0x6'))('rpc');var config=require(_0x4066('0x7'));var jayson=require(_0x4066('0x8'));var client=jayson[_0x4066('0x9')][_0x4066('0xa')]({'port':0x232a});config[_0x4066('0xb')]=_[_0x4066('0xc')](config[_0x4066('0xb')],{'host':_0x4066('0xd'),'port':0x18eb});var socket=require(_0x4066('0xe'))(new Redis(config['redis']));require(_0x4066('0xf'))['register'](socket);function respondWithRpcPromise(_0x36af7e,_0x412412,_0x54aba3){return new BPromise(function(_0x3ad879,_0x5d9739){return client[_0x4066('0x10')](_0x36af7e,_0x54aba3)[_0x4066('0x11')](function(_0x208fa3){logger[_0x4066('0x12')](_0x4066('0x13'),_0x412412,_0x4066('0x14'));logger[_0x4066('0x15')](_0x4066('0x16'),_0x412412,_0x4066('0x14'),JSON['stringify'](_0x208fa3));if(_0x208fa3[_0x4066('0x17')]){if(_0x208fa3[_0x4066('0x17')][_0x4066('0x18')]===0x1f4){logger[_0x4066('0x17')](_0x4066('0x13'),_0x412412,_0x208fa3[_0x4066('0x17')][_0x4066('0x19')]);return _0x5d9739(_0x208fa3[_0x4066('0x17')]['message']);}logger[_0x4066('0x17')]('ChatMessage,\x20%s,\x20%s',_0x412412,_0x208fa3[_0x4066('0x17')]['message']);return _0x3ad879(_0x208fa3['error'][_0x4066('0x19')]);}else{logger[_0x4066('0x12')]('ChatMessage,\x20%s,\x20%s',_0x412412,_0x4066('0x14'));_0x3ad879(_0x208fa3[_0x4066('0x1a')]['message']);}})[_0x4066('0x1b')](function(_0x9eed72){logger[_0x4066('0x17')]('ChatMessage,\x20%s,\x20%s',_0x412412,_0x9eed72);_0x5d9739(_0x9eed72);});});}exports['CreateChatMessage']=function(_0x22aef5){var _0xd82ba8=this;return new Promise(function(_0x4a29da,_0x43ca0c){return db[_0x4066('0x1c')][_0x4066('0x1d')](_0x22aef5[_0x4066('0x1e')],{'raw':_0x22aef5[_0x4066('0x1f')]?_0x22aef5[_0x4066('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x4066('0x11')](function(_0x4c094d){logger[_0x4066('0x12')](_0x4066('0x20'),_0x22aef5);logger[_0x4066('0x15')](_0x4066('0x20'),_0x22aef5,JSON['stringify'](_0x4c094d));_0x4a29da(_0x4c094d);})[_0x4066('0x1b')](function(_0x1d298d){logger[_0x4066('0x17')](_0x4066('0x20'),_0x1d298d[_0x4066('0x19')],_0x22aef5);_0x43ca0c(_0xd82ba8[_0x4066('0x17')](0x1f4,_0x1d298d[_0x4066('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e8ff380..393a519 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 _0x008c=['./chatMessage.events','save','remove','update','emit','removeListener','register','chatMessage:'];(function(_0x2e3319,_0xcf0088){var _0x4681bb=function(_0xc554d7){while(--_0xc554d7){_0x2e3319['push'](_0x2e3319['shift']());}};_0x4681bb(++_0xcf0088);}(_0x008c,0x188));var _0xc008=function(_0x13932d,_0xf930d3){_0x13932d=_0x13932d-0x0;var _0x1a7b81=_0x008c[_0x13932d];return _0x1a7b81;};'use strict';var ChatMessageEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatMessageEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatMessageEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file +var _0xedd9=['removeListener','register','length','chatMessage:','save','remove','update','emit'];(function(_0x31e0cb,_0x5097b4){var _0x9f4bd8=function(_0x469faf){while(--_0x469faf){_0x31e0cb['push'](_0x31e0cb['shift']());}};_0x9f4bd8(++_0x5097b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ecbad,_0x119365){_0x5ecbad=_0x5ecbad-0x0;var _0x45d67e=_0xedd9[_0x5ecbad];return _0x45d67e;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){ChatMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);ChatMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3b77b5e..92cd9b6 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 _0x4444=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','chat','chatmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy'];(function(_0x22ea66,_0x30123a){var _0x529757=function(_0x2340e){while(--_0x2340e){_0x22ea66['push'](_0x22ea66['shift']());}};_0x529757(++_0x30123a);}(_0x4444,0x1a9));var _0x4444=function(_0x340aa5,_0x2d5553){_0x340aa5=_0x340aa5-0x0;var _0x3a5b7f=_0x4444[_0x340aa5];return _0x3a5b7f;};'use strict';var multer=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var path=require(_0x4444('0x2'));var timeout=require(_0x4444('0x3'));var express=require(_0x4444('0x4'));var router=express[_0x4444('0x5')]();var auth=require(_0x4444('0x6'));var interaction=require(_0x4444('0x7'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x4444('0x8')]('/',auth[_0x4444('0x9')](),controller[_0x4444('0xa')]);router[_0x4444('0x8')]('/describe',auth[_0x4444('0x9')](),controller[_0x4444('0xb')]);router[_0x4444('0x8')]('/:id',auth[_0x4444('0x9')](),controller[_0x4444('0xc')]);router[_0x4444('0xd')]('/',auth[_0x4444('0x9')](),interaction['tracked'](_0x4444('0xe'),_0x4444('0xf')),controller[_0x4444('0x10')]);router[_0x4444('0x11')](_0x4444('0x12'),controller[_0x4444('0x13')]);router[_0x4444('0x11')](_0x4444('0x14'),auth[_0x4444('0x9')](),controller['accept']);router['put'](_0x4444('0x15'),auth['isAuthenticated'](),controller[_0x4444('0x16')]);router[_0x4444('0x17')](_0x4444('0x12'),auth['isAuthenticated'](),controller[_0x4444('0x18')]);module['exports']=router; \ No newline at end of file +var _0x2cc4=['show','post','tracked','chat','chatmessage:create','create','/:id/accept','accept','put','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2cc4,0xdd));var _0x42cc=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x2cc4[_0x2ae8ce];return _0x4bf686;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require(_0x42cc('0x4'));var router=express['Router']();var auth=require(_0x42cc('0x5'));var interaction=require(_0x42cc('0x6'));var config=require('../../config/environment');var controller=require(_0x42cc('0x7'));router[_0x42cc('0x8')]('/',auth[_0x42cc('0x9')](),controller[_0x42cc('0xa')]);router[_0x42cc('0x8')]('/describe',auth[_0x42cc('0x9')](),controller[_0x42cc('0xb')]);router[_0x42cc('0x8')](_0x42cc('0xc'),auth[_0x42cc('0x9')](),controller[_0x42cc('0xd')]);router[_0x42cc('0xe')]('/',auth[_0x42cc('0x9')](),interaction[_0x42cc('0xf')](_0x42cc('0x10'),_0x42cc('0x11')),controller[_0x42cc('0x12')]);router['put']('/:id',controller['update']);router['put'](_0x42cc('0x13'),auth[_0x42cc('0x9')](),controller[_0x42cc('0x14')]);router[_0x42cc('0x15')]('/:id/reject',auth[_0x42cc('0x9')](),controller[_0x42cc('0x16')]);router[_0x42cc('0x17')](_0x42cc('0xc'),auth[_0x42cc('0x9')](),controller[_0x42cc('0x18')]);module[_0x42cc('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 01eb9a1..62e3e0e 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 _0xfb64=['TEXT','medium','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb64,0x106));var _0x4fb6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfb64[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4fb6('0x0'));module[_0x4fb6('0x1')]={'body':{'type':Sequelize[_0x4fb6('0x2')](_0x4fb6('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xe163=['exports','TEXT','medium','sequelize'];(function(_0xe49860,_0x24f476){var _0xda4f9=function(_0x9ec76f){while(--_0x9ec76f){_0xe49860['push'](_0xe49860['shift']());}};_0xda4f9(++_0x24f476);}(_0xe163,0x13b));var _0x3e16=function(_0xd9c851,_0x4ebae0){_0xd9c851=_0xd9c851-0x0;var _0x1921c0=_0xe163[_0xd9c851];return _0x1921c0;};'use strict';var Sequelize=require(_0x3e16('0x0'));module[_0x3e16('0x1')]={'body':{'type':Sequelize[_0x3e16('0x2')](_0x3e16('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1ef96de..c3db20f 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 _0xcef9=['order','sort','where','filter','merge','type','key','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','ChatOfflineMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x53c5cf,_0x3ef208){var _0x3261aa=function(_0x69b1d){while(--_0x69b1d){_0x53c5cf['push'](_0x53c5cf['shift']());}};_0x3261aa(++_0x3ef208);}(_0xcef9,0x142));var _0x9cef=function(_0x510db6,_0x422a14){_0x510db6=_0x510db6-0x0;var _0x54def3=_0xcef9[_0x510db6];return _0x54def3;};'use strict';var pdf=require(_0x9cef('0x0'));var emlformat=require(_0x9cef('0x1'));var rimraf=require(_0x9cef('0x2'));var zipdir=require(_0x9cef('0x3'));var jsonpatch=require(_0x9cef('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9cef('0x5'));var Mustache=require(_0x9cef('0x6'));var util=require('util');var path=require(_0x9cef('0x7'));var sox=require(_0x9cef('0x8'));var csv=require(_0x9cef('0x9'));var ejs=require(_0x9cef('0xa'));var fs=require('fs');var _=require(_0x9cef('0xb'));var squel=require(_0x9cef('0xc'));var crypto=require('crypto');var jsforce=require(_0x9cef('0xd'));var deskjs=require(_0x9cef('0xe'));var toCsv=require(_0x9cef('0x9'));var querystring=require(_0x9cef('0xf'));var Papa=require(_0x9cef('0x10'));var Redis=require(_0x9cef('0x11'));var authService=require(_0x9cef('0x12'));var qs=require(_0x9cef('0x13'));var hardwareService=require(_0x9cef('0x14'));var logger=require('../../config/logger')(_0x9cef('0x15'));var utils=require(_0x9cef('0x16'));var config=require(_0x9cef('0x17'));var db=require(_0x9cef('0x18'))['db'];function respondWithStatusCode(_0x3cd1a6,_0x17cc76){_0x17cc76=_0x17cc76||0xcc;return function(_0x2f8c84){if(_0x2f8c84){return _0x3cd1a6[_0x9cef('0x19')](_0x17cc76);}return _0x3cd1a6[_0x9cef('0x1a')](_0x17cc76)[_0x9cef('0x1b')]();};}function respondWithResult(_0x18d3bc,_0x44ca92){_0x44ca92=_0x44ca92||0xc8;return function(_0x124586){if(_0x124586){return _0x18d3bc[_0x9cef('0x1a')](_0x44ca92)[_0x9cef('0x1c')](_0x124586);}};}function respondWithFilteredResult(_0x412d22,_0x3c4bca){return function(_0x3a615e){if(_0x3a615e){var _0x4060d3=_0x3a615e['count'],_0x35e1d0=_0x3c4bca[_0x9cef('0x1d')],_0x33421f=_0x3c4bca[_0x9cef('0x1d')]+_0x3c4bca[_0x9cef('0x1e')],_0x3447da;if(_0x33421f>=_0x4060d3){_0x33421f=_0x4060d3;_0x3447da=0xc8;}else{_0x3447da=0xce;}_0x412d22[_0x9cef('0x1a')](_0x3447da);return _0x412d22['set'](_0x9cef('0x1f'),_0x35e1d0+'-'+_0x33421f+'/'+_0x4060d3)[_0x9cef('0x1c')](_0x3a615e);}return null;};}function patchUpdates(_0x165810){return function(_0x4ac090){try{jsonpatch[_0x9cef('0x20')](_0x4ac090,_0x165810,!![]);}catch(_0x56d452){return BPromise[_0x9cef('0x21')](_0x56d452);}return _0x4ac090[_0x9cef('0x22')]();};}function saveUpdates(_0x15c739,_0x26b30b){return function(_0x5f331a){if(_0x5f331a){return _0x5f331a[_0x9cef('0x23')](_0x15c739)[_0x9cef('0x24')](function(_0x1c45b6){return _0x1c45b6;});}return null;};}function removeEntity(_0x2f01ec,_0x292cbf){return function(_0x122fb4){if(_0x122fb4){return _0x122fb4[_0x9cef('0x25')]()['then'](function(){_0x2f01ec[_0x9cef('0x1a')](0xcc)[_0x9cef('0x1b')]();});}};}function handleEntityNotFound(_0x262eb2,_0x59b384){return function(_0x1c5f5){if(!_0x1c5f5){_0x262eb2['sendStatus'](0x194);}return _0x1c5f5;};}function handleError(_0xe05c40,_0x46e0ca){_0x46e0ca=_0x46e0ca||0x1f4;return function(_0xa5f88e){logger[_0x9cef('0x26')](_0xa5f88e[_0x9cef('0x27')]);if(_0xa5f88e['name']){delete _0xa5f88e[_0x9cef('0x28')];}_0xe05c40[_0x9cef('0x1a')](_0x46e0ca)['send'](_0xa5f88e);};}exports[_0x9cef('0x29')]=function(_0x59d71e,_0xff834f){var _0x1bd048={},_0x2bdb45={},_0x2d17f7={'count':0x0,'rows':[]};var _0x257271=db[_0x9cef('0x2a')][_0x9cef('0x2b')];_0x2bdb45[_0x9cef('0x2c')]=_[_0x9cef('0x2d')](_0x257271);_0x2bdb45[_0x9cef('0x2e')]=_['keys'](_0x59d71e['query']);_0x2bdb45[_0x9cef('0x2f')]=_[_0x9cef('0x30')](_0x2bdb45[_0x9cef('0x2c')],_0x2bdb45['query']);_0x1bd048[_0x9cef('0x31')]=_[_0x9cef('0x30')](_0x2bdb45[_0x9cef('0x2c')],qs[_0x9cef('0x32')](_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x32')]));_0x1bd048[_0x9cef('0x31')]=_0x1bd048['attributes']['length']?_0x1bd048[_0x9cef('0x31')]:_0x2bdb45[_0x9cef('0x2c')];if(!_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x33')](_0x9cef('0x34'))){_0x1bd048[_0x9cef('0x1e')]=qs[_0x9cef('0x1e')](_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x1e')]);_0x1bd048[_0x9cef('0x1d')]=qs[_0x9cef('0x1d')](_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x1d')]);}_0x1bd048[_0x9cef('0x35')]=qs[_0x9cef('0x36')](_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x36')]);_0x1bd048[_0x9cef('0x37')]=qs['filters'](_['pick'](_0x59d71e[_0x9cef('0x2e')],_0x2bdb45['filters']));if(_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x38')]){_0x1bd048[_0x9cef('0x37')]=_[_0x9cef('0x39')](_0x1bd048['where'],{'$or':_['map'](_0x257271,function(_0x11038c){if(_0x11038c[_0x9cef('0x3a')][_0x9cef('0x3b')]!==_0x9cef('0x3c')){var _0x4e0c80={};_0x4e0c80[_0x11038c['field']]={'$like':'%'+_0x59d71e['query'][_0x9cef('0x38')]+'%'};return _0x4e0c80;}})});}_0x1bd048=_['merge']({},_0x1bd048,_0x59d71e[_0x9cef('0x3d')]);var _0x3c69af={'where':_0x1bd048['where']};return db[_0x9cef('0x2a')][_0x9cef('0x3e')](_0x3c69af)['then'](function(_0x548605){_0x2d17f7['count']=_0x548605;if(_0x59d71e[_0x9cef('0x2e')][_0x9cef('0x3f')]){_0x1bd048[_0x9cef('0x40')]=[{'all':!![]}];}return db[_0x9cef('0x2a')][_0x9cef('0x41')](_0x1bd048);})['then'](function(_0x238a4c){_0x2d17f7[_0x9cef('0x42')]=_0x238a4c;return _0x2d17f7;})['then'](respondWithFilteredResult(_0xff834f,_0x1bd048))[_0x9cef('0x43')](handleError(_0xff834f,null));};exports[_0x9cef('0x44')]=function(_0x4c15b4,_0x58db5c){var _0x59f23f={'raw':!![],'where':{'id':_0x4c15b4[_0x9cef('0x45')]['id']}},_0x3f56b2={};_0x3f56b2['model']=_[_0x9cef('0x2d')](db['ChatOfflineMessage'][_0x9cef('0x2b')]);_0x3f56b2['query']=_[_0x9cef('0x2d')](_0x4c15b4[_0x9cef('0x2e')]);_0x3f56b2[_0x9cef('0x2f')]=_[_0x9cef('0x30')](_0x3f56b2[_0x9cef('0x2c')],_0x3f56b2[_0x9cef('0x2e')]);_0x59f23f[_0x9cef('0x31')]=_[_0x9cef('0x30')](_0x3f56b2[_0x9cef('0x2c')],qs['fields'](_0x4c15b4[_0x9cef('0x2e')]['fields']));_0x59f23f['attributes']=_0x59f23f['attributes'][_0x9cef('0x46')]?_0x59f23f['attributes']:_0x3f56b2[_0x9cef('0x2c')];if(_0x4c15b4[_0x9cef('0x2e')][_0x9cef('0x3f')]){_0x59f23f[_0x9cef('0x40')]=[{'all':!![]}];}_0x59f23f=_[_0x9cef('0x39')]({},_0x59f23f,_0x4c15b4[_0x9cef('0x3d')]);return db[_0x9cef('0x2a')][_0x9cef('0x47')](_0x59f23f)['then'](handleEntityNotFound(_0x58db5c,null))['then'](respondWithResult(_0x58db5c,null))['catch'](handleError(_0x58db5c,null));};exports[_0x9cef('0x48')]=function(_0x4b819f,_0x30c560){return db['ChatOfflineMessage'][_0x9cef('0x48')](_0x4b819f[_0x9cef('0x49')],{})['then'](respondWithResult(_0x30c560,0xc9))[_0x9cef('0x43')](handleError(_0x30c560,null));};exports[_0x9cef('0x23')]=function(_0x5d5672,_0x5e33a6){if(_0x5d5672['body']['id']){delete _0x5d5672[_0x9cef('0x49')]['id'];}return db[_0x9cef('0x2a')][_0x9cef('0x47')]({'where':{'id':_0x5d5672[_0x9cef('0x45')]['id']}})[_0x9cef('0x24')](handleEntityNotFound(_0x5e33a6,null))[_0x9cef('0x24')](saveUpdates(_0x5d5672[_0x9cef('0x49')],null))['then'](respondWithResult(_0x5e33a6,null))[_0x9cef('0x43')](handleError(_0x5e33a6,null));};exports[_0x9cef('0x25')]=function(_0x5ad6a5,_0x580da3){return db['ChatOfflineMessage'][_0x9cef('0x47')]({'where':{'id':_0x5ad6a5[_0x9cef('0x45')]['id']}})[_0x9cef('0x24')](handleEntityNotFound(_0x580da3,null))[_0x9cef('0x24')](removeEntity(_0x580da3,null))[_0x9cef('0x43')](handleError(_0x580da3,null));};exports[_0x9cef('0x4a')]=function(_0x49b927,_0x154bf3){return db[_0x9cef('0x2a')][_0x9cef('0x4a')]()['then'](respondWithResult(_0x154bf3,null))[_0x9cef('0x43')](handleError(_0x154bf3,null));}; \ No newline at end of file +var _0x38b3=['bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','keys','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','map','key','VIRTUAL','field','options','ChatOfflineMessage','includeAll','findAll','rows','show','merge','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x47c25f,_0x819e39){var _0x477ce3=function(_0x1736b4){while(--_0x1736b4){_0x47c25f['push'](_0x47c25f['shift']());}};_0x477ce3(++_0x819e39);}(_0x38b3,0xda));var _0x338b=function(_0x4256e2,_0xedbf89){_0x4256e2=_0x4256e2-0x0;var _0x1b1915=_0x38b3[_0x4256e2];return _0x1b1915;};'use strict';var pdf=require(_0x338b('0x0'));var emlformat=require(_0x338b('0x1'));var rimraf=require(_0x338b('0x2'));var zipdir=require(_0x338b('0x3'));var jsonpatch=require(_0x338b('0x4'));var rp=require(_0x338b('0x5'));var moment=require(_0x338b('0x6'));var BPromise=require(_0x338b('0x7'));var Mustache=require(_0x338b('0x8'));var util=require(_0x338b('0x9'));var path=require(_0x338b('0xa'));var sox=require(_0x338b('0xb'));var csv=require(_0x338b('0xc'));var ejs=require(_0x338b('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x338b('0xe'));var crypto=require(_0x338b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x338b('0x10'));var toCsv=require(_0x338b('0xc'));var querystring=require('querystring');var Papa=require(_0x338b('0x11'));var Redis=require(_0x338b('0x12'));var authService=require(_0x338b('0x13'));var qs=require(_0x338b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x338b('0x15'))(_0x338b('0x16'));var utils=require('../../config/utils');var config=require(_0x338b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56383f,_0x583522){_0x583522=_0x583522||0xcc;return function(_0x5bfe66){if(_0x5bfe66){return _0x56383f[_0x338b('0x18')](_0x583522);}return _0x56383f['status'](_0x583522)['end']();};}function respondWithResult(_0x244138,_0x185e8a){_0x185e8a=_0x185e8a||0xc8;return function(_0x68d9a0){if(_0x68d9a0){return _0x244138['status'](_0x185e8a)[_0x338b('0x19')](_0x68d9a0);}};}function respondWithFilteredResult(_0xaaaa0a,_0x176cf3){return function(_0x2acd34){if(_0x2acd34){var _0x149fd4=_0x2acd34[_0x338b('0x1a')],_0x11d30f=_0x176cf3[_0x338b('0x1b')],_0x3d945f=_0x176cf3[_0x338b('0x1b')]+_0x176cf3[_0x338b('0x1c')],_0x1ab892;if(_0x3d945f>=_0x149fd4){_0x3d945f=_0x149fd4;_0x1ab892=0xc8;}else{_0x1ab892=0xce;}_0xaaaa0a[_0x338b('0x1d')](_0x1ab892);return _0xaaaa0a[_0x338b('0x1e')](_0x338b('0x1f'),_0x11d30f+'-'+_0x3d945f+'/'+_0x149fd4)[_0x338b('0x19')](_0x2acd34);}return null;};}function patchUpdates(_0x331f46){return function(_0x4a1343){try{jsonpatch['apply'](_0x4a1343,_0x331f46,!![]);}catch(_0x5212fc){return BPromise[_0x338b('0x20')](_0x5212fc);}return _0x4a1343[_0x338b('0x21')]();};}function saveUpdates(_0x155166,_0x11d730){return function(_0x44c20b){if(_0x44c20b){return _0x44c20b[_0x338b('0x22')](_0x155166)[_0x338b('0x23')](function(_0x59e0a9){return _0x59e0a9;});}return null;};}function removeEntity(_0x47b95f,_0x4fd8e2){return function(_0x3bee42){if(_0x3bee42){return _0x3bee42[_0x338b('0x24')]()[_0x338b('0x23')](function(){_0x47b95f[_0x338b('0x1d')](0xcc)[_0x338b('0x25')]();});}};}function handleEntityNotFound(_0x2d087f,_0x5d7a77){return function(_0x2ac8bc){if(!_0x2ac8bc){_0x2d087f[_0x338b('0x18')](0x194);}return _0x2ac8bc;};}function handleError(_0x26da5f,_0x20affe){_0x20affe=_0x20affe||0x1f4;return function(_0x43d660){logger[_0x338b('0x26')](_0x43d660[_0x338b('0x27')]);if(_0x43d660['name']){delete _0x43d660[_0x338b('0x28')];}_0x26da5f['status'](_0x20affe)[_0x338b('0x29')](_0x43d660);};}exports[_0x338b('0x2a')]=function(_0x582ad0,_0x380cc3){var _0x52fb51={},_0x595cf0={},_0x712883={'count':0x0,'rows':[]};var _0xe30ce3=db['ChatOfflineMessage'][_0x338b('0x2b')];_0x595cf0['model']=_[_0x338b('0x2c')](_0xe30ce3);_0x595cf0['query']=_[_0x338b('0x2c')](_0x582ad0['query']);_0x595cf0['filters']=_['intersection'](_0x595cf0[_0x338b('0x2d')],_0x595cf0[_0x338b('0x2e')]);_0x52fb51[_0x338b('0x2f')]=_[_0x338b('0x30')](_0x595cf0['model'],qs[_0x338b('0x31')](_0x582ad0[_0x338b('0x2e')][_0x338b('0x31')]));_0x52fb51[_0x338b('0x2f')]=_0x52fb51['attributes'][_0x338b('0x32')]?_0x52fb51[_0x338b('0x2f')]:_0x595cf0[_0x338b('0x2d')];if(!_0x582ad0[_0x338b('0x2e')][_0x338b('0x33')](_0x338b('0x34'))){_0x52fb51[_0x338b('0x1c')]=qs[_0x338b('0x1c')](_0x582ad0[_0x338b('0x2e')][_0x338b('0x1c')]);_0x52fb51['offset']=qs[_0x338b('0x1b')](_0x582ad0['query'][_0x338b('0x1b')]);}_0x52fb51['order']=qs[_0x338b('0x35')](_0x582ad0[_0x338b('0x2e')][_0x338b('0x35')]);_0x52fb51[_0x338b('0x36')]=qs['filters'](_[_0x338b('0x37')](_0x582ad0[_0x338b('0x2e')],_0x595cf0[_0x338b('0x38')]));if(_0x582ad0[_0x338b('0x2e')][_0x338b('0x39')]){_0x52fb51['where']=_['merge'](_0x52fb51[_0x338b('0x36')],{'$or':_[_0x338b('0x3a')](_0xe30ce3,function(_0x2f19c6){if(_0x2f19c6['type'][_0x338b('0x3b')]!==_0x338b('0x3c')){var _0x212e8d={};_0x212e8d[_0x2f19c6[_0x338b('0x3d')]]={'$like':'%'+_0x582ad0['query'][_0x338b('0x39')]+'%'};return _0x212e8d;}})});}_0x52fb51=_['merge']({},_0x52fb51,_0x582ad0[_0x338b('0x3e')]);var _0x38cbd6={'where':_0x52fb51[_0x338b('0x36')]};return db[_0x338b('0x3f')][_0x338b('0x1a')](_0x38cbd6)[_0x338b('0x23')](function(_0x27467c){_0x712883[_0x338b('0x1a')]=_0x27467c;if(_0x582ad0[_0x338b('0x2e')][_0x338b('0x40')]){_0x52fb51['include']=[{'all':!![]}];}return db[_0x338b('0x3f')][_0x338b('0x41')](_0x52fb51);})[_0x338b('0x23')](function(_0x21c5ef){_0x712883[_0x338b('0x42')]=_0x21c5ef;return _0x712883;})[_0x338b('0x23')](respondWithFilteredResult(_0x380cc3,_0x52fb51))['catch'](handleError(_0x380cc3,null));};exports[_0x338b('0x43')]=function(_0x39a988,_0x5d9751){var _0x3a8975={'raw':!![],'where':{'id':_0x39a988['params']['id']}},_0x56fcec={};_0x56fcec[_0x338b('0x2d')]=_[_0x338b('0x2c')](db[_0x338b('0x3f')][_0x338b('0x2b')]);_0x56fcec[_0x338b('0x2e')]=_[_0x338b('0x2c')](_0x39a988[_0x338b('0x2e')]);_0x56fcec['filters']=_[_0x338b('0x30')](_0x56fcec[_0x338b('0x2d')],_0x56fcec[_0x338b('0x2e')]);_0x3a8975[_0x338b('0x2f')]=_[_0x338b('0x30')](_0x56fcec[_0x338b('0x2d')],qs[_0x338b('0x31')](_0x39a988['query'][_0x338b('0x31')]));_0x3a8975[_0x338b('0x2f')]=_0x3a8975[_0x338b('0x2f')][_0x338b('0x32')]?_0x3a8975[_0x338b('0x2f')]:_0x56fcec[_0x338b('0x2d')];if(_0x39a988[_0x338b('0x2e')][_0x338b('0x40')]){_0x3a8975['include']=[{'all':!![]}];}_0x3a8975=_[_0x338b('0x44')]({},_0x3a8975,_0x39a988[_0x338b('0x3e')]);return db[_0x338b('0x3f')]['find'](_0x3a8975)[_0x338b('0x23')](handleEntityNotFound(_0x5d9751,null))[_0x338b('0x23')](respondWithResult(_0x5d9751,null))[_0x338b('0x45')](handleError(_0x5d9751,null));};exports[_0x338b('0x46')]=function(_0x37c8b7,_0x3a7eac){return db[_0x338b('0x3f')][_0x338b('0x46')](_0x37c8b7[_0x338b('0x47')],{})[_0x338b('0x23')](respondWithResult(_0x3a7eac,0xc9))[_0x338b('0x45')](handleError(_0x3a7eac,null));};exports['update']=function(_0x5230fd,_0x4d7f3e){if(_0x5230fd[_0x338b('0x47')]['id']){delete _0x5230fd[_0x338b('0x47')]['id'];}return db[_0x338b('0x3f')][_0x338b('0x48')]({'where':{'id':_0x5230fd[_0x338b('0x49')]['id']}})[_0x338b('0x23')](handleEntityNotFound(_0x4d7f3e,null))[_0x338b('0x23')](saveUpdates(_0x5230fd[_0x338b('0x47')],null))[_0x338b('0x23')](respondWithResult(_0x4d7f3e,null))['catch'](handleError(_0x4d7f3e,null));};exports['destroy']=function(_0x4f2050,_0x4bf012){return db[_0x338b('0x3f')][_0x338b('0x48')]({'where':{'id':_0x4f2050[_0x338b('0x49')]['id']}})[_0x338b('0x23')](handleEntityNotFound(_0x4bf012,null))['then'](removeEntity(_0x4bf012,null))[_0x338b('0x45')](handleError(_0x4bf012,null));};exports[_0x338b('0x4a')]=function(_0x3d4fc9,_0x34f3fa){return db[_0x338b('0x3f')]['describe']()[_0x338b('0x23')](respondWithResult(_0x34f3fa,null))[_0x338b('0x45')](handleError(_0x34f3fa,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1881bd9..97a1046 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 _0x0b98=['rimraf','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','util','api','request-promise','path'];(function(_0x38325,_0x262d3c){var _0x2994d6=function(_0x48af6e){while(--_0x48af6e){_0x38325['push'](_0x38325['shift']());}};_0x2994d6(++_0x262d3c);}(_0x0b98,0x178));var _0x80b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b98[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x80b9('0x0'));var logger=require('../../config/logger')(_0x80b9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x80b9('0x2'));var fs=require('fs');var path=require(_0x80b9('0x3'));var rimraf=require(_0x80b9('0x4'));var config=require('../../config/environment');var attributes=require(_0x80b9('0x5'));module['exports']=function(_0x12b482,_0xb8c7cc){return _0x12b482[_0x80b9('0x6')](_0x80b9('0x7'),attributes,{'tableName':_0x80b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x80b9('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbd75=['util','api','bluebird','request-promise','path','rimraf','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x441dfb,_0x94dcc3){var _0x465d59=function(_0x53cb47){while(--_0x53cb47){_0x441dfb['push'](_0x441dfb['shift']());}};_0x465d59(++_0x94dcc3);}(_0xbd75,0x190));var _0x5bd7=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xbd75[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x5bd7('0x0'));var logger=require('../../config/logger')(_0x5bd7('0x1'));var moment=require('moment');var BPromise=require(_0x5bd7('0x2'));var rp=require(_0x5bd7('0x3'));var fs=require('fs');var path=require(_0x5bd7('0x4'));var rimraf=require(_0x5bd7('0x5'));var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x3d6ea6,_0x35850b){return _0x3d6ea6[_0x5bd7('0x6')](_0x5bd7('0x7'),attributes,{'tableName':_0x5bd7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bd7('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a8edc5a..6712eb8 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 _0x0b1f=['../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xfa5e6a,_0x41438c){var _0x3134a3=function(_0x445652){while(--_0x445652){_0xfa5e6a['push'](_0xfa5e6a['shift']());}};_0x3134a3(++_0x41438c);}(_0x0b1f,0x1f1));var _0xf0b1=function(_0x2eeff0,_0x4d5c8d){_0x2eeff0=_0x2eeff0-0x0;var _0x2dd9a8=_0x0b1f[_0x2eeff0];return _0x2dd9a8;};'use strict';var _=require(_0xf0b1('0x0'));var util=require(_0xf0b1('0x1'));var moment=require(_0xf0b1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0b1('0x3'));var fs=require('fs');var Redis=require(_0xf0b1('0x4'));var db=require(_0xf0b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf0b1('0x6'));var config=require(_0xf0b1('0x7'));var jayson=require(_0xf0b1('0x8'));var client=jayson['client'][_0xf0b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b6b43,_0x543146,_0x4047b1){return new BPromise(function(_0x2083f0,_0x504ba7){return client[_0xf0b1('0xa')](_0x2b6b43,_0x4047b1)[_0xf0b1('0xb')](function(_0x1c217c){logger[_0xf0b1('0xc')](_0xf0b1('0xd'),_0x543146,_0xf0b1('0xe'));logger[_0xf0b1('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x543146,'request\x20sent',JSON[_0xf0b1('0x10')](_0x1c217c));if(_0x1c217c[_0xf0b1('0x11')]){if(_0x1c217c[_0xf0b1('0x11')][_0xf0b1('0x12')]===0x1f4){logger[_0xf0b1('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x543146,_0x1c217c[_0xf0b1('0x11')][_0xf0b1('0x13')]);return _0x504ba7(_0x1c217c[_0xf0b1('0x11')]['message']);}logger[_0xf0b1('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x543146,_0x1c217c['error'][_0xf0b1('0x13')]);return _0x2083f0(_0x1c217c[_0xf0b1('0x11')][_0xf0b1('0x13')]);}else{logger[_0xf0b1('0xc')](_0xf0b1('0xd'),_0x543146,'request\x20sent');_0x2083f0(_0x1c217c['result']['message']);}})[_0xf0b1('0x14')](function(_0x4c5f38){logger['error'](_0xf0b1('0xd'),_0x543146,_0x4c5f38);_0x504ba7(_0x4c5f38);});});} \ No newline at end of file +var _0x15e9=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x15e9,0xb3));var _0x915e=function(_0x37ba22,_0x57750a){_0x37ba22=_0x37ba22-0x0;var _0x5b78bb=_0x15e9[_0x37ba22];return _0x5b78bb;};'use strict';var _=require(_0x915e('0x0'));var util=require(_0x915e('0x1'));var moment=require(_0x915e('0x2'));var BPromise=require(_0x915e('0x3'));var rs=require(_0x915e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x915e('0x5'));var logger=require(_0x915e('0x6'))(_0x915e('0x7'));var config=require(_0x915e('0x8'));var jayson=require(_0x915e('0x9'));var client=jayson[_0x915e('0xa')][_0x915e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x256411,_0x273884,_0x43fb6f){return new BPromise(function(_0x562dcc,_0x599ef6){return client[_0x915e('0xc')](_0x256411,_0x43fb6f)['then'](function(_0xe18f65){logger['info'](_0x915e('0xd'),_0x273884,'request\x20sent');logger['debug'](_0x915e('0xe'),_0x273884,_0x915e('0xf'),JSON['stringify'](_0xe18f65));if(_0xe18f65[_0x915e('0x10')]){if(_0xe18f65['error'][_0x915e('0x11')]===0x1f4){logger[_0x915e('0x10')](_0x915e('0xd'),_0x273884,_0xe18f65[_0x915e('0x10')][_0x915e('0x12')]);return _0x599ef6(_0xe18f65['error'][_0x915e('0x12')]);}logger['error'](_0x915e('0xd'),_0x273884,_0xe18f65[_0x915e('0x10')]['message']);return _0x562dcc(_0xe18f65[_0x915e('0x10')][_0x915e('0x12')]);}else{logger[_0x915e('0x13')](_0x915e('0xd'),_0x273884,_0x915e('0xf'));_0x562dcc(_0xe18f65[_0x915e('0x14')]['message']);}})[_0x915e('0x15')](function(_0x437c00){logger[_0x915e('0x10')](_0x915e('0xd'),_0x273884,_0x437c00);_0x599ef6(_0x437c00);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c4264ef..c19278b 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 _0x8a9c=['../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x5bbcbd,_0xd9d0b4){var _0x3ad034=function(_0x45e019){while(--_0x45e019){_0x5bbcbd['push'](_0x5bbcbd['shift']());}};_0x3ad034(++_0xd9d0b4);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var path=require(_0xc8a9('0x2'));var timeout=require(_0xc8a9('0x3'));var express=require(_0xc8a9('0x4'));var router=express['Router']();var auth=require(_0xc8a9('0x5'));var interaction=require(_0xc8a9('0x6'));var config=require('../../config/environment');var controller=require(_0xc8a9('0x7'));router[_0xc8a9('0x8')]('/',auth[_0xc8a9('0x9')](),controller['index']);router[_0xc8a9('0x8')](_0xc8a9('0xa'),auth[_0xc8a9('0x9')](),controller[_0xc8a9('0xb')]);router[_0xc8a9('0x8')](_0xc8a9('0xc'),auth[_0xc8a9('0x9')](),controller[_0xc8a9('0xd')]);router[_0xc8a9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc8a9('0xf')](_0xc8a9('0xc'),auth['isAuthenticated'](),controller[_0xc8a9('0x10')]);router['delete'](_0xc8a9('0xc'),auth[_0xc8a9('0x9')](),controller['destroy']);module[_0xc8a9('0x11')]=router; \ No newline at end of file +var _0x8d53=['describe','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x8d53,0x1c2));var _0x38d5=function(_0x2d1f3d,_0x4f80d7){_0x2d1f3d=_0x2d1f3d-0x0;var _0x5bf52c=_0x8d53[_0x2d1f3d];return _0x5bf52c;};'use strict';var multer=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var path=require('path');var timeout=require(_0x38d5('0x2'));var express=require(_0x38d5('0x3'));var router=express[_0x38d5('0x4')]();var auth=require(_0x38d5('0x5'));var interaction=require(_0x38d5('0x6'));var config=require(_0x38d5('0x7'));var controller=require(_0x38d5('0x8'));router[_0x38d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x38d5('0xa')]);router[_0x38d5('0x9')](_0x38d5('0xb'),auth['isAuthenticated'](),controller[_0x38d5('0xc')]);router[_0x38d5('0x9')](_0x38d5('0xd'),auth[_0x38d5('0xe')](),controller[_0x38d5('0xf')]);router['post']('/',auth[_0x38d5('0xe')](),controller[_0x38d5('0x10')]);router['put'](_0x38d5('0xd'),auth[_0x38d5('0xe')](),controller[_0x38d5('0x11')]);router[_0x38d5('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x38d5('0x13')]);module[_0x38d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d8e2490..b59a355 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 _0x24ba=['exports','STRING','mouseOver','timeout','sequelize'];(function(_0x3c8bcc,_0x4be8ab){var _0x39d7cc=function(_0x11811b){while(--_0x11811b){_0x3c8bcc['push'](_0x3c8bcc['shift']());}};_0x39d7cc(++_0x4be8ab);}(_0x24ba,0xd6));var _0xa24b=function(_0x45b0d2,_0x15ff90){_0x45b0d2=_0x45b0d2-0x0;var _0x276385=_0x24ba[_0x45b0d2];return _0x276385;};'use strict';var Sequelize=require(_0xa24b('0x0'));module[_0xa24b('0x1')]={'name':{'type':Sequelize[_0xa24b('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa24b('0x3'),_0xa24b('0x4')),'defaultValue':_0xa24b('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd954=['exports','STRING','mouseOver','INTEGER'];(function(_0x374a23,_0x395566){var _0x3e4078=function(_0x58b1c8){while(--_0x58b1c8){_0x374a23['push'](_0x374a23['shift']());}};_0x3e4078(++_0x395566);}(_0xd954,0x7c));var _0x4d95=function(_0x263afc,_0x41913f){_0x263afc=_0x263afc-0x0;var _0x5956eb=_0xd954[_0x263afc];return _0x5956eb;};'use strict';var Sequelize=require('sequelize');module[_0x4d95('0x0')]={'name':{'type':Sequelize[_0x4d95('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4d95('0x2'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4d95('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7b17ce9..fb4f635 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 _0x4e4a=['filters','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','destroy','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','reject','save','update','then','stack','name','send','params','model','keys','ChatProactiveAction','query'];(function(_0x1c9fa6,_0x38fdb8){var _0x150866=function(_0x1bca32){while(--_0x1bca32){_0x1c9fa6['push'](_0x1c9fa6['shift']());}};_0x150866(++_0x38fdb8);}(_0x4e4a,0x78));var _0xa4e4=function(_0x4d4267,_0x479a7b){_0x4d4267=_0x4d4267-0x0;var _0x2ad2ed=_0x4e4a[_0x4d4267];return _0x2ad2ed;};'use strict';var pdf=require(_0xa4e4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa4e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4e4('0x2'));var rp=require(_0xa4e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa4e4('0x4'));var util=require(_0xa4e4('0x5'));var path=require(_0xa4e4('0x6'));var sox=require(_0xa4e4('0x7'));var csv=require('to-csv');var ejs=require(_0xa4e4('0x8'));var fs=require('fs');var _=require(_0xa4e4('0x9'));var squel=require(_0xa4e4('0xa'));var crypto=require(_0xa4e4('0xb'));var jsforce=require(_0xa4e4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4e4('0xd'));var querystring=require(_0xa4e4('0xe'));var Papa=require(_0xa4e4('0xf'));var Redis=require('ioredis');var authService=require(_0xa4e4('0x10'));var qs=require(_0xa4e4('0x11'));var hardwareService=require(_0xa4e4('0x12'));var logger=require('../../config/logger')(_0xa4e4('0x13'));var utils=require(_0xa4e4('0x14'));var config=require(_0xa4e4('0x15'));var db=require(_0xa4e4('0x16'))['db'];function respondWithStatusCode(_0x469a1d,_0x2c86ef){_0x2c86ef=_0x2c86ef||0xcc;return function(_0x14163a){if(_0x14163a){return _0x469a1d[_0xa4e4('0x17')](_0x2c86ef);}return _0x469a1d[_0xa4e4('0x18')](_0x2c86ef)[_0xa4e4('0x19')]();};}function respondWithResult(_0x3ccc79,_0x788da6){_0x788da6=_0x788da6||0xc8;return function(_0x9bcfd1){if(_0x9bcfd1){return _0x3ccc79['status'](_0x788da6)['json'](_0x9bcfd1);}};}function respondWithFilteredResult(_0x184d0b,_0x4929f4){return function(_0x44f96d){if(_0x44f96d){var _0x3746ca=_0x44f96d[_0xa4e4('0x1a')],_0x5520a1=_0x4929f4[_0xa4e4('0x1b')],_0x563d50=_0x4929f4[_0xa4e4('0x1b')]+_0x4929f4['limit'],_0x33ce97;if(_0x563d50>=_0x3746ca){_0x563d50=_0x3746ca;_0x33ce97=0xc8;}else{_0x33ce97=0xce;}_0x184d0b[_0xa4e4('0x18')](_0x33ce97);return _0x184d0b['set'](_0xa4e4('0x1c'),_0x5520a1+'-'+_0x563d50+'/'+_0x3746ca)[_0xa4e4('0x1d')](_0x44f96d);}return null;};}function patchUpdates(_0x36be88){return function(_0x988968){try{jsonpatch['apply'](_0x988968,_0x36be88,!![]);}catch(_0x4e1f42){return BPromise[_0xa4e4('0x1e')](_0x4e1f42);}return _0x988968[_0xa4e4('0x1f')]();};}function saveUpdates(_0x2e5685,_0x1825a3){return function(_0x1e5213){if(_0x1e5213){return _0x1e5213[_0xa4e4('0x20')](_0x2e5685)[_0xa4e4('0x21')](function(_0x2633ea){return _0x2633ea;});}return null;};}function removeEntity(_0x58069c,_0x3fa8ea){return function(_0x5396af){if(_0x5396af){return _0x5396af['destroy']()[_0xa4e4('0x21')](function(){_0x58069c['status'](0xcc)[_0xa4e4('0x19')]();});}};}function handleEntityNotFound(_0x79440c,_0x20d898){return function(_0x17c651){if(!_0x17c651){_0x79440c[_0xa4e4('0x17')](0x194);}return _0x17c651;};}function handleError(_0x512921,_0x593e8c){_0x593e8c=_0x593e8c||0x1f4;return function(_0x14da96){logger['error'](_0x14da96[_0xa4e4('0x22')]);if(_0x14da96[_0xa4e4('0x23')]){delete _0x14da96[_0xa4e4('0x23')];}_0x512921[_0xa4e4('0x18')](_0x593e8c)[_0xa4e4('0x24')](_0x14da96);};}exports['show']=function(_0x441f1,_0x3a3455){var _0x2e91a={'raw':!![],'where':{'id':_0x441f1[_0xa4e4('0x25')]['id']}},_0x5362e1={};_0x5362e1[_0xa4e4('0x26')]=_[_0xa4e4('0x27')](db[_0xa4e4('0x28')]['rawAttributes']);_0x5362e1['query']=_[_0xa4e4('0x27')](_0x441f1[_0xa4e4('0x29')]);_0x5362e1[_0xa4e4('0x2a')]=_[_0xa4e4('0x2b')](_0x5362e1[_0xa4e4('0x26')],_0x5362e1['query']);_0x2e91a['attributes']=_['intersection'](_0x5362e1[_0xa4e4('0x26')],qs['fields'](_0x441f1[_0xa4e4('0x29')]['fields']));_0x2e91a[_0xa4e4('0x2c')]=_0x2e91a[_0xa4e4('0x2c')][_0xa4e4('0x2d')]?_0x2e91a[_0xa4e4('0x2c')]:_0x5362e1[_0xa4e4('0x26')];if(_0x441f1[_0xa4e4('0x29')][_0xa4e4('0x2e')]){_0x2e91a['include']=[{'all':!![]}];}_0x2e91a=_[_0xa4e4('0x2f')]({},_0x2e91a,_0x441f1[_0xa4e4('0x30')]);return db['ChatProactiveAction'][_0xa4e4('0x31')](_0x2e91a)[_0xa4e4('0x21')](handleEntityNotFound(_0x3a3455,null))[_0xa4e4('0x21')](respondWithResult(_0x3a3455,null))[_0xa4e4('0x32')](handleError(_0x3a3455,null));};exports[_0xa4e4('0x33')]=function(_0x4e79cb,_0x7859){return db[_0xa4e4('0x28')][_0xa4e4('0x33')](_0x4e79cb[_0xa4e4('0x34')],{})[_0xa4e4('0x21')](respondWithResult(_0x7859,0xc9))[_0xa4e4('0x32')](handleError(_0x7859,null));};exports[_0xa4e4('0x20')]=function(_0x1893af,_0x1fcecc){if(_0x1893af[_0xa4e4('0x34')]['id']){delete _0x1893af['body']['id'];}return db['ChatProactiveAction'][_0xa4e4('0x31')]({'where':{'id':_0x1893af[_0xa4e4('0x25')]['id']}})[_0xa4e4('0x21')](handleEntityNotFound(_0x1fcecc,null))[_0xa4e4('0x21')](saveUpdates(_0x1893af[_0xa4e4('0x34')],null))[_0xa4e4('0x21')](respondWithResult(_0x1fcecc,null))[_0xa4e4('0x32')](handleError(_0x1fcecc,null));};exports[_0xa4e4('0x35')]=function(_0x213cd8,_0x1294a0){return db[_0xa4e4('0x28')][_0xa4e4('0x31')]({'where':{'id':_0x213cd8[_0xa4e4('0x25')]['id']}})['then'](handleEntityNotFound(_0x1294a0,null))[_0xa4e4('0x21')](removeEntity(_0x1294a0,null))[_0xa4e4('0x32')](handleError(_0x1294a0,null));}; \ No newline at end of file +var _0x472f=['length','merge','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','name','send','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields'];(function(_0x354a4f,_0x2558cc){var _0x14efb2=function(_0x39d8b1){while(--_0x39d8b1){_0x354a4f['push'](_0x354a4f['shift']());}};_0x14efb2(++_0x2558cc);}(_0x472f,0x16d));var _0xf472=function(_0x568628,_0x41be96){_0x568628=_0x568628-0x0;var _0x571ae7=_0x472f[_0x568628];return _0x571ae7;};'use strict';var pdf=require(_0xf472('0x0'));var emlformat=require(_0xf472('0x1'));var rimraf=require(_0xf472('0x2'));var zipdir=require(_0xf472('0x3'));var jsonpatch=require(_0xf472('0x4'));var rp=require(_0xf472('0x5'));var moment=require(_0xf472('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf472('0x7'));var csv=require(_0xf472('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf472('0x9'));var crypto=require(_0xf472('0xa'));var jsforce=require(_0xf472('0xb'));var deskjs=require(_0xf472('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf472('0xd'));var Papa=require(_0xf472('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf472('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xf472('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fe8f9,_0x23eeea){_0x23eeea=_0x23eeea||0xcc;return function(_0x3d8328){if(_0x3d8328){return _0x4fe8f9[_0xf472('0x11')](_0x23eeea);}return _0x4fe8f9[_0xf472('0x12')](_0x23eeea)['end']();};}function respondWithResult(_0x1254df,_0x13ca74){_0x13ca74=_0x13ca74||0xc8;return function(_0x151da2){if(_0x151da2){return _0x1254df[_0xf472('0x12')](_0x13ca74)[_0xf472('0x13')](_0x151da2);}};}function respondWithFilteredResult(_0x1b8093,_0x23daf7){return function(_0x5a5586){if(_0x5a5586){var _0x4fc515=_0x5a5586[_0xf472('0x14')],_0x3815e1=_0x23daf7[_0xf472('0x15')],_0x1de524=_0x23daf7[_0xf472('0x15')]+_0x23daf7[_0xf472('0x16')],_0x2522e0;if(_0x1de524>=_0x4fc515){_0x1de524=_0x4fc515;_0x2522e0=0xc8;}else{_0x2522e0=0xce;}_0x1b8093['status'](_0x2522e0);return _0x1b8093['set'](_0xf472('0x17'),_0x3815e1+'-'+_0x1de524+'/'+_0x4fc515)[_0xf472('0x13')](_0x5a5586);}return null;};}function patchUpdates(_0x5705e0){return function(_0x29e0db){try{jsonpatch[_0xf472('0x18')](_0x29e0db,_0x5705e0,!![]);}catch(_0x16020f){return BPromise[_0xf472('0x19')](_0x16020f);}return _0x29e0db[_0xf472('0x1a')]();};}function saveUpdates(_0x50c8f4,_0x40c0f7){return function(_0x3b6749){if(_0x3b6749){return _0x3b6749[_0xf472('0x1b')](_0x50c8f4)[_0xf472('0x1c')](function(_0x40f10f){return _0x40f10f;});}return null;};}function removeEntity(_0x8474dc,_0x53a3a9){return function(_0x39bf58){if(_0x39bf58){return _0x39bf58['destroy']()[_0xf472('0x1c')](function(){_0x8474dc[_0xf472('0x12')](0xcc)[_0xf472('0x1d')]();});}};}function handleEntityNotFound(_0xcd6e7d,_0x152382){return function(_0x59c2fa){if(!_0x59c2fa){_0xcd6e7d['sendStatus'](0x194);}return _0x59c2fa;};}function handleError(_0x14fbc8,_0x5e5ea6){_0x5e5ea6=_0x5e5ea6||0x1f4;return function(_0x5bab60){logger[_0xf472('0x1e')](_0x5bab60['stack']);if(_0x5bab60[_0xf472('0x1f')]){delete _0x5bab60['name'];}_0x14fbc8[_0xf472('0x12')](_0x5e5ea6)[_0xf472('0x20')](_0x5bab60);};}exports['show']=function(_0xc70517,_0x480959){var _0x3a18be={'raw':!![],'where':{'id':_0xc70517[_0xf472('0x21')]['id']}},_0x15623a={};_0x15623a[_0xf472('0x22')]=_['keys'](db[_0xf472('0x23')][_0xf472('0x24')]);_0x15623a[_0xf472('0x25')]=_[_0xf472('0x26')](_0xc70517[_0xf472('0x25')]);_0x15623a[_0xf472('0x27')]=_[_0xf472('0x28')](_0x15623a[_0xf472('0x22')],_0x15623a['query']);_0x3a18be[_0xf472('0x29')]=_[_0xf472('0x28')](_0x15623a[_0xf472('0x22')],qs[_0xf472('0x2a')](_0xc70517[_0xf472('0x25')]['fields']));_0x3a18be[_0xf472('0x29')]=_0x3a18be['attributes'][_0xf472('0x2b')]?_0x3a18be[_0xf472('0x29')]:_0x15623a[_0xf472('0x22')];if(_0xc70517[_0xf472('0x25')]['includeAll']){_0x3a18be['include']=[{'all':!![]}];}_0x3a18be=_[_0xf472('0x2c')]({},_0x3a18be,_0xc70517[_0xf472('0x2d')]);return db[_0xf472('0x23')][_0xf472('0x2e')](_0x3a18be)[_0xf472('0x1c')](handleEntityNotFound(_0x480959,null))['then'](respondWithResult(_0x480959,null))[_0xf472('0x2f')](handleError(_0x480959,null));};exports[_0xf472('0x30')]=function(_0x404e91,_0x3dd5ec){return db[_0xf472('0x23')][_0xf472('0x30')](_0x404e91[_0xf472('0x31')],{})[_0xf472('0x1c')](respondWithResult(_0x3dd5ec,0xc9))[_0xf472('0x2f')](handleError(_0x3dd5ec,null));};exports[_0xf472('0x1b')]=function(_0x3899ba,_0x283c59){if(_0x3899ba['body']['id']){delete _0x3899ba[_0xf472('0x31')]['id'];}return db[_0xf472('0x23')][_0xf472('0x2e')]({'where':{'id':_0x3899ba[_0xf472('0x21')]['id']}})[_0xf472('0x1c')](handleEntityNotFound(_0x283c59,null))['then'](saveUpdates(_0x3899ba[_0xf472('0x31')],null))['then'](respondWithResult(_0x283c59,null))[_0xf472('0x2f')](handleError(_0x283c59,null));};exports[_0xf472('0x32')]=function(_0x1a95bf,_0x5da5ad){return db[_0xf472('0x23')][_0xf472('0x2e')]({'where':{'id':_0x1a95bf[_0xf472('0x21')]['id']}})['then'](handleEntityNotFound(_0x5da5ad,null))[_0xf472('0x1c')](removeEntity(_0x5da5ad,null))['catch'](handleError(_0x5da5ad,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 5ef16e4..c8f2ad8 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 _0x6911=['bluebird','path','../../config/environment','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment'];(function(_0x312cc4,_0x440ce6){var _0x398b56=function(_0x5befad){while(--_0x5befad){_0x312cc4['push'](_0x312cc4['shift']());}};_0x398b56(++_0x440ce6);}(_0x6911,0x114));var _0x1691=function(_0x3955a1,_0x35ff6){_0x3955a1=_0x3955a1-0x0;var _0x32c2db=_0x6911[_0x3955a1];return _0x32c2db;};'use strict';var _=require(_0x1691('0x0'));var util=require(_0x1691('0x1'));var logger=require(_0x1691('0x2'))('api');var moment=require(_0x1691('0x3'));var BPromise=require(_0x1691('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1691('0x5'));var rimraf=require('rimraf');var config=require(_0x1691('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x1106b7,_0x4f558c){return _0x1106b7[_0x1691('0x7')](_0x1691('0x8'),attributes,{'tableName':_0x1691('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28f4=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util'];(function(_0x2f9be1,_0x37c18c){var _0x599b4d=function(_0x111d45){while(--_0x111d45){_0x2f9be1['push'](_0x2f9be1['shift']());}};_0x599b4d(++_0x37c18c);}(_0x28f4,0x136));var _0x428f=function(_0xe4b413,_0xc42f3e){_0xe4b413=_0xe4b413-0x0;var _0x3d1a58=_0x28f4[_0xe4b413];return _0x3d1a58;};'use strict';var _=require(_0x428f('0x0'));var util=require(_0x428f('0x1'));var logger=require(_0x428f('0x2'))('api');var moment=require(_0x428f('0x3'));var BPromise=require(_0x428f('0x4'));var rp=require(_0x428f('0x5'));var fs=require('fs');var path=require(_0x428f('0x6'));var rimraf=require(_0x428f('0x7'));var config=require(_0x428f('0x8'));var attributes=require(_0x428f('0x9'));module[_0x428f('0xa')]=function(_0x4e00ac,_0xb67027){return _0x4e00ac['define'](_0x428f('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 258fd23..884eb02 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a3f20,_0x345ecd){var _0xc238cf=function(_0x511b97){while(--_0x511b97){_0x2a3f20['push'](_0x2a3f20['shift']());}};_0xc238cf(++_0x345ecd);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('ChatProactiveAction,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x38321a,_0x20ec4e){var _0x28e6ce=function(_0x1b1a86){while(--_0x1b1a86){_0x38321a['push'](_0x38321a['shift']());}};_0x28e6ce(++_0x20ec4e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 63390a7..dea008e 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 _0x1a85=['connect-timeout','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','show','isAuthenticated','create','delete','destroy','exports','path'];(function(_0x4a3121,_0x56178a){var _0x41c18=function(_0x31851c){while(--_0x31851c){_0x4a3121['push'](_0x4a3121['shift']());}};_0x41c18(++_0x56178a);}(_0x1a85,0x178));var _0x51a8=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0x1a85[_0x16b1a5];return _0x475e25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var controller=require(_0x51a8('0x5'));router['get'](_0x51a8('0x6'),auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['post']('/',auth[_0x51a8('0x8')](),controller[_0x51a8('0x9')]);router['put'](_0x51a8('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x51a8('0xa')](_0x51a8('0x6'),auth[_0x51a8('0x8')](),controller[_0x51a8('0xb')]);module[_0x51a8('0xc')]=router; \ No newline at end of file +var _0x0b70=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','/:id','update','delete','destroy','exports'];(function(_0x5a637d,_0x122ff6){var _0x10102a=function(_0x444b6a){while(--_0x444b6a){_0x5a637d['push'](_0x5a637d['shift']());}};_0x10102a(++_0x122ff6);}(_0x0b70,0x159));var _0x00b7=function(_0x3bb96e,_0xdc7992){_0x3bb96e=_0x3bb96e-0x0;var _0x1a6739=_0x0b70[_0x3bb96e];return _0x1a6739;};'use strict';var multer=require('multer');var util=require(_0x00b7('0x0'));var path=require('path');var timeout=require(_0x00b7('0x1'));var express=require(_0x00b7('0x2'));var router=express['Router']();var auth=require(_0x00b7('0x3'));var interaction=require(_0x00b7('0x4'));var config=require(_0x00b7('0x5'));var controller=require('./chatProactiveAction.controller');router[_0x00b7('0x6')]('/:id',auth[_0x00b7('0x7')](),controller['show']);router[_0x00b7('0x8')]('/',auth['isAuthenticated'](),controller[_0x00b7('0x9')]);router['put'](_0x00b7('0xa'),auth[_0x00b7('0x7')](),controller[_0x00b7('0xb')]);router[_0x00b7('0xc')]('/:id',auth[_0x00b7('0x7')](),controller[_0x00b7('0xd')]);module[_0x00b7('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b6b7f9c..ec5efee 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 _0xf35a=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x37bfd2,_0x5496ba){var _0x16515b=function(_0x46608c){while(--_0x46608c){_0x37bfd2['push'](_0x37bfd2['shift']());}};_0x16515b(++_0x5496ba);}(_0xf35a,0xa4));var _0xaf35=function(_0x4d2111,_0x24c83d){_0x4d2111=_0x4d2111-0x0;var _0x5f00a0=_0xf35a[_0x4d2111];return _0x5f00a0;};'use strict';var Sequelize=require(_0xaf35('0x0'));module[_0xaf35('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaf35('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaf35('0x3')]},'timeout':{'type':Sequelize[_0xaf35('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaf35('0x5')](_0xaf35('0x6'),_0xaf35('0x7'),_0xaf35('0x8'))}}; \ No newline at end of file +var _0x06cf=['STRING','INTEGER','exports'];(function(_0x363dee,_0x4d1a44){var _0x31ae44=function(_0x1a3727){while(--_0x1a3727){_0x363dee['push'](_0x363dee['shift']());}};_0x31ae44(++_0x4d1a44);}(_0x06cf,0xc2));var _0xf06c=function(_0x5d60b2,_0x16df51){_0x5d60b2=_0x5d60b2-0x0;var _0x2cb7bc=_0x06cf[_0x5d60b2];return _0x2cb7bc;};'use strict';var Sequelize=require('sequelize');module[_0xf06c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf06c('0x1')]},'timeout':{'type':Sequelize[_0xf06c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e222e0a..161fb7e 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 _0x12cd=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','test','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','ChatQueue','includeAll','include','findAll','rows','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserChatQueue','sort','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','addTeams','Agents','interface','flatMap','findOrCreate','forEach','emit','userChatQueue:save','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','includes','all','compact','value','transaction','removeTeams','ids','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','lodash','crypto','jsforce','desk.js'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x12cd,0x1c0));var _0xd12c=function(_0xf3768e,_0x3d1686){_0xf3768e=_0xf3768e-0x0;var _0x4c40a2=_0x12cd[_0xf3768e];return _0x4c40a2;};'use strict';var pdf=require(_0xd12c('0x0'));var emlformat=require(_0xd12c('0x1'));var rimraf=require(_0xd12c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd12c('0x3'));var BPromise=require(_0xd12c('0x4'));var Mustache=require(_0xd12c('0x5'));var util=require('util');var path=require(_0xd12c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd12c('0x7'));var squel=require('squel');var crypto=require(_0xd12c('0x8'));var jsforce=require(_0xd12c('0x9'));var deskjs=require(_0xd12c('0xa'));var toCsv=require(_0xd12c('0xb'));var querystring=require(_0xd12c('0xc'));var Papa=require(_0xd12c('0xd'));var Redis=require(_0xd12c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd12c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd12c('0x10'))(_0xd12c('0x11'));var utils=require(_0xd12c('0x12'));var config=require('../../config/environment');var db=require(_0xd12c('0x13'))['db'];config['redis']=_[_0xd12c('0x14')](config[_0xd12c('0x15')],{'host':_0xd12c('0x16'),'port':0x18eb});var socket=require(_0xd12c('0x17'))(new Redis(config['redis']));require(_0xd12c('0x18'))[_0xd12c('0x19')](socket);var jayson=require(_0xd12c('0x1a'));var client=jayson[_0xd12c('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x4f4211,_0x2bac39,_0x2beca2){if(_0x2beca2){var _0x2ce1f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ce1f8[_0xd12c('0x1c')](_0x2bac39)){return _0x4f4211;}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 _0x4f4211;}}function respondWithRpcPromise(_0x4a78b2,_0x525359,_0x5ce4d4,_0x17324a){return new BPromise(function(_0x2afa28,_0x549787){var _0x225dd6=_0x17324a||client;return _0x225dd6[_0xd12c('0x1d')](_0x4a78b2,_0x5ce4d4)[_0xd12c('0x1e')](function(_0x75af64){logger[_0xd12c('0x1f')](_0xd12c('0x20'),_0x525359,'request\x20sent');logger[_0xd12c('0x21')](_0xd12c('0x22'),_0x525359,_0xd12c('0x23'),JSON[_0xd12c('0x24')](_0x75af64));if(_0x75af64[_0xd12c('0x25')]){if(_0x75af64['error'][_0xd12c('0x26')]===0x1f4){logger['error'](_0xd12c('0x20'),_0x525359,_0x75af64['error']['message']);return _0x549787(_0x75af64[_0xd12c('0x25')]['message']);}logger[_0xd12c('0x25')](_0xd12c('0x20'),_0x525359,_0x75af64[_0xd12c('0x25')][_0xd12c('0x27')]);return _0x2afa28(_0x75af64[_0xd12c('0x25')][_0xd12c('0x27')]);}else{logger[_0xd12c('0x1f')](_0xd12c('0x20'),_0x525359,_0xd12c('0x23'));_0x2afa28(_0x75af64[_0xd12c('0x28')][_0xd12c('0x27')]);}})[_0xd12c('0x29')](function(_0x18acad){logger[_0xd12c('0x25')]('ChatQueue,\x20%s,\x20%s',_0x525359,_0x18acad);_0x549787(_0x18acad);});});}function respondWithStatusCode(_0x47c226,_0x1d311d){_0x1d311d=_0x1d311d||0xcc;return function(_0x185062){if(_0x185062){return _0x47c226['sendStatus'](_0x1d311d);}return _0x47c226[_0xd12c('0x2a')](_0x1d311d)['end']();};}function respondWithResult(_0x5cee97,_0x47393){_0x47393=_0x47393||0xc8;return function(_0x5e8f1b){if(_0x5e8f1b){return _0x5cee97[_0xd12c('0x2a')](_0x47393)[_0xd12c('0x2b')](_0x5e8f1b);}};}function respondWithFilteredResult(_0x345748,_0x327906){return function(_0x9d3dc){if(_0x9d3dc){var _0xbbc02e=_0x9d3dc[_0xd12c('0x2c')],_0x525c38=_0x327906[_0xd12c('0x2d')],_0x3df103=_0x327906['offset']+_0x327906[_0xd12c('0x2e')],_0x187d12;if(_0x3df103>=_0xbbc02e){_0x3df103=_0xbbc02e;_0x187d12=0xc8;}else{_0x187d12=0xce;}_0x345748[_0xd12c('0x2a')](_0x187d12);return _0x345748['set'](_0xd12c('0x2f'),_0x525c38+'-'+_0x3df103+'/'+_0xbbc02e)[_0xd12c('0x2b')](_0x9d3dc);}return null;};}function patchUpdates(_0xdfaea2){return function(_0x52796e){try{jsonpatch[_0xd12c('0x30')](_0x52796e,_0xdfaea2,!![]);}catch(_0x3d5d4a){return BPromise[_0xd12c('0x31')](_0x3d5d4a);}return _0x52796e[_0xd12c('0x32')]();};}function saveUpdates(_0x54b738,_0x1cac69){return function(_0x554ece){if(_0x554ece){return _0x554ece['update'](_0x54b738)[_0xd12c('0x1e')](function(_0x14640f){return _0x14640f;});}return null;};}function removeEntity(_0x49f593,_0x117baa){return function(_0x5cf817){if(_0x5cf817){return _0x5cf817[_0xd12c('0x33')]()[_0xd12c('0x1e')](function(){var _0x23242b=_0x5cf817[_0xd12c('0x34')]({'plain':!![]});var _0x125ec3='ChatQueues';return db[_0xd12c('0x35')][_0xd12c('0x33')]({'where':{'type':_0x125ec3,'resourceId':_0x23242b['id']}})[_0xd12c('0x1e')](function(){return _0x5cf817;});})[_0xd12c('0x1e')](function(){_0x49f593[_0xd12c('0x2a')](0xcc)[_0xd12c('0x36')]();});}};}function handleEntityNotFound(_0x19e014,_0x3a1692){return function(_0x228e4b){if(!_0x228e4b){_0x19e014[_0xd12c('0x37')](0x194);}return _0x228e4b;};}function handleError(_0x42ea31,_0x5edbc7){_0x5edbc7=_0x5edbc7||0x1f4;return function(_0x239377){logger['error'](_0x239377[_0xd12c('0x38')]);if(_0x239377[_0xd12c('0x39')]){delete _0x239377[_0xd12c('0x39')];}_0x42ea31[_0xd12c('0x2a')](_0x5edbc7)[_0xd12c('0x3a')](_0x239377);};}exports[_0xd12c('0x3b')]=function(_0x3a5cc8,_0x302eb5){var _0xf54ebe={},_0x32c7cb={},_0x3ef655={'count':0x0,'rows':[]};var _0x1f77f2=db['ChatQueue'][_0xd12c('0x3c')];_0x32c7cb[_0xd12c('0x3d')]=_['keys'](_0x1f77f2);_0x32c7cb[_0xd12c('0x3e')]=_['keys'](_0x3a5cc8[_0xd12c('0x3e')]);_0x32c7cb['filters']=_[_0xd12c('0x3f')](_0x32c7cb[_0xd12c('0x3d')],_0x32c7cb[_0xd12c('0x3e')]);_0xf54ebe[_0xd12c('0x40')]=_[_0xd12c('0x3f')](_0x32c7cb[_0xd12c('0x3d')],qs[_0xd12c('0x41')](_0x3a5cc8['query'][_0xd12c('0x41')]));_0xf54ebe[_0xd12c('0x40')]=_0xf54ebe[_0xd12c('0x40')][_0xd12c('0x42')]?_0xf54ebe[_0xd12c('0x40')]:_0x32c7cb[_0xd12c('0x3d')];if(!_0x3a5cc8[_0xd12c('0x3e')][_0xd12c('0x43')](_0xd12c('0x44'))){_0xf54ebe[_0xd12c('0x2e')]=qs[_0xd12c('0x2e')](_0x3a5cc8[_0xd12c('0x3e')][_0xd12c('0x2e')]);_0xf54ebe[_0xd12c('0x2d')]=qs['offset'](_0x3a5cc8['query'][_0xd12c('0x2d')]);}_0xf54ebe['order']=qs['sort'](_0x3a5cc8[_0xd12c('0x3e')]['sort']);_0xf54ebe[_0xd12c('0x45')]=qs[_0xd12c('0x46')](_[_0xd12c('0x47')](_0x3a5cc8[_0xd12c('0x3e')],_0x32c7cb['filters']));if(_0x3a5cc8['query'][_0xd12c('0x48')]){_0xf54ebe['where']=_[_0xd12c('0x49')](_0xf54ebe['where'],{'$or':_[_0xd12c('0x4a')](_0x1f77f2,function(_0x246c5e){if(_0x246c5e[_0xd12c('0x4b')][_0xd12c('0x4c')]!==_0xd12c('0x4d')){var _0x3ff2bd={};_0x3ff2bd[_0x246c5e[_0xd12c('0x4e')]]={'$like':'%'+_0x3a5cc8[_0xd12c('0x3e')][_0xd12c('0x48')]+'%'};return _0x3ff2bd;}})});}_0xf54ebe=_[_0xd12c('0x49')]({},_0xf54ebe,_0x3a5cc8[_0xd12c('0x4f')]);var _0x45d973={'where':_0xf54ebe[_0xd12c('0x45')]};return db[_0xd12c('0x50')][_0xd12c('0x2c')](_0x45d973)[_0xd12c('0x1e')](function(_0x11a76c){_0x3ef655['count']=_0x11a76c;if(_0x3a5cc8[_0xd12c('0x3e')][_0xd12c('0x51')]){_0xf54ebe[_0xd12c('0x52')]=[{'all':!![]}];}return db[_0xd12c('0x50')][_0xd12c('0x53')](_0xf54ebe);})[_0xd12c('0x1e')](function(_0x3aee71){_0x3ef655[_0xd12c('0x54')]=_0x3aee71;return _0x3ef655;})[_0xd12c('0x1e')](respondWithFilteredResult(_0x302eb5,_0xf54ebe))[_0xd12c('0x29')](handleError(_0x302eb5,null));};exports[_0xd12c('0x55')]=function(_0x5933a1,_0x46109c){var _0x3480cf={'raw':!![],'where':{'id':_0x5933a1['params']['id']}},_0x322a9d={};_0x322a9d['model']=_[_0xd12c('0x56')](db[_0xd12c('0x50')][_0xd12c('0x3c')]);_0x322a9d[_0xd12c('0x3e')]=_[_0xd12c('0x56')](_0x5933a1['query']);_0x322a9d[_0xd12c('0x46')]=_['intersection'](_0x322a9d[_0xd12c('0x3d')],_0x322a9d[_0xd12c('0x3e')]);_0x3480cf[_0xd12c('0x40')]=_[_0xd12c('0x3f')](_0x322a9d[_0xd12c('0x3d')],qs[_0xd12c('0x41')](_0x5933a1[_0xd12c('0x3e')]['fields']));_0x3480cf['attributes']=_0x3480cf[_0xd12c('0x40')]['length']?_0x3480cf[_0xd12c('0x40')]:_0x322a9d['model'];if(_0x5933a1[_0xd12c('0x3e')][_0xd12c('0x51')]){_0x3480cf[_0xd12c('0x52')]=[{'all':!![]}];}_0x3480cf=_['merge']({},_0x3480cf,_0x5933a1[_0xd12c('0x4f')]);return db[_0xd12c('0x50')][_0xd12c('0x57')](_0x3480cf)[_0xd12c('0x1e')](handleEntityNotFound(_0x46109c,null))[_0xd12c('0x1e')](respondWithResult(_0x46109c,null))[_0xd12c('0x29')](handleError(_0x46109c,null));};exports[_0xd12c('0x58')]=function(_0x23eb67,_0x1a5acb){return db[_0xd12c('0x50')][_0xd12c('0x58')](_0x23eb67[_0xd12c('0x59')],{})[_0xd12c('0x1e')](function(_0x12f848){var _0x15cdf1=_0x23eb67[_0xd12c('0x5a')]['get']({'plain':!![]});if(!_0x15cdf1)throw new Error(_0xd12c('0x5b'));if(_0x15cdf1[_0xd12c('0x5c')]===_0xd12c('0x5a')){var _0x25a8eb=_0x12f848[_0xd12c('0x34')]({'plain':!![]});var _0x38fd67=_0xd12c('0x5d');return db[_0xd12c('0x5e')][_0xd12c('0x57')]({'where':{'name':_0x38fd67,'userProfileId':_0x15cdf1[_0xd12c('0x5f')]},'raw':!![]})['then'](function(_0x1a268b){if(_0x1a268b&&_0x1a268b['autoAssociation']===0x0){return db[_0xd12c('0x35')][_0xd12c('0x58')]({'name':_0x25a8eb[_0xd12c('0x39')],'resourceId':_0x25a8eb['id'],'type':_0x1a268b[_0xd12c('0x39')],'sectionId':_0x1a268b['id']},{})[_0xd12c('0x1e')](function(){return _0x12f848;});}else{return _0x12f848;}})[_0xd12c('0x29')](function(_0x30c7c9){logger[_0xd12c('0x25')](_0xd12c('0x60'),_0x30c7c9);throw _0x30c7c9;});}return _0x12f848;})['then'](respondWithResult(_0x1a5acb,0xc9))[_0xd12c('0x29')](handleError(_0x1a5acb,null));};exports[_0xd12c('0x61')]=function(_0x10bee6,_0x438988){if(_0x10bee6['body']['id']){delete _0x10bee6['body']['id'];}return db['ChatQueue'][_0xd12c('0x57')]({'where':{'id':_0x10bee6[_0xd12c('0x62')]['id']}})['then'](handleEntityNotFound(_0x438988,null))[_0xd12c('0x1e')](saveUpdates(_0x10bee6[_0xd12c('0x59')],null))[_0xd12c('0x1e')](respondWithResult(_0x438988,null))[_0xd12c('0x29')](handleError(_0x438988,null));};exports[_0xd12c('0x33')]=function(_0x7e0667,_0x116530){return db[_0xd12c('0x50')][_0xd12c('0x57')]({'where':{'id':_0x7e0667[_0xd12c('0x62')]['id']}})[_0xd12c('0x1e')](handleEntityNotFound(_0x116530,null))[_0xd12c('0x1e')](removeEntity(_0x116530,null))[_0xd12c('0x29')](handleError(_0x116530,null));};exports[_0xd12c('0x63')]=function(_0x280b15,_0x5f126f){return db[_0xd12c('0x50')][_0xd12c('0x63')]()[_0xd12c('0x1e')](respondWithResult(_0x5f126f,null))[_0xd12c('0x29')](handleError(_0x5f126f,null));};exports[_0xd12c('0x64')]=function(_0x4fe8be,_0x1b9600,_0x201e79){var _0x45667a={'raw':!![],'where':{}},_0x4f0bd7={},_0x3ea22f;return db[_0xd12c('0x50')]['findOne']({'where':{'id':_0x4fe8be[_0xd12c('0x62')]['id']}})[_0xd12c('0x1e')](handleEntityNotFound(_0x1b9600,null))['then'](function(_0x18afff){if(_0x18afff){_0x3ea22f=_0x18afff[_0xd12c('0x34')]({'plain':!![]});_0x4f0bd7['model']=_[_0xd12c('0x56')](db[_0xd12c('0x65')][_0xd12c('0x3c')]);_0x4f0bd7[_0xd12c('0x3e')]=_[_0xd12c('0x56')](_0x4fe8be[_0xd12c('0x3e')]);_0x4f0bd7[_0xd12c('0x46')]=_[_0xd12c('0x3f')](_0x4f0bd7[_0xd12c('0x3d')],_0x4f0bd7[_0xd12c('0x3e')]);_0x45667a[_0xd12c('0x40')]=_[_0xd12c('0x3f')](_0x4f0bd7[_0xd12c('0x3d')],qs[_0xd12c('0x41')](_0x4fe8be[_0xd12c('0x3e')][_0xd12c('0x41')]));_0x45667a[_0xd12c('0x40')]=_0x45667a[_0xd12c('0x40')]['length']?_0x45667a[_0xd12c('0x40')]:_0x4f0bd7['model'];if(!_0x4fe8be[_0xd12c('0x3e')][_0xd12c('0x43')](_0xd12c('0x44'))){_0x45667a[_0xd12c('0x2e')]=qs[_0xd12c('0x2e')](_0x4fe8be['query'][_0xd12c('0x2e')]);_0x45667a['offset']=qs['offset'](_0x4fe8be[_0xd12c('0x3e')][_0xd12c('0x2d')]);}_0x45667a['order']=qs[_0xd12c('0x66')](_0x4fe8be[_0xd12c('0x3e')][_0xd12c('0x66')]);_0x45667a['where']=qs['filters'](_[_0xd12c('0x47')](_0x4fe8be['query'],_0x4f0bd7[_0xd12c('0x46')]));_0x45667a[_0xd12c('0x45')][_0xd12c('0x67')]=_0x18afff['id'];if(_0x4fe8be['query'][_0xd12c('0x48')]){_0x45667a[_0xd12c('0x45')]=_['merge'](_0x45667a[_0xd12c('0x45')],{'$or':_[_0xd12c('0x4a')](_0x45667a['attributes'],function(_0x292b06){var _0x5d8842={};_0x5d8842[_0x292b06]={'$like':'%'+_0x4fe8be['query'][_0xd12c('0x48')]+'%'};return _0x5d8842;})});}_0x45667a=_[_0xd12c('0x49')]({},_0x45667a,_0x4fe8be[_0xd12c('0x4f')]);return db['UserChatQueue'][_0xd12c('0x53')](_0x45667a);}})[_0xd12c('0x1e')](function(_0x4377c6){if(_0x4377c6){return db[_0xd12c('0x68')][_0xd12c('0x69')]({'where':{'id':_[_0xd12c('0x4a')](_0x4377c6,'UserId'),'role':_0xd12c('0x6a')},'attributes':['id',_0xd12c('0x39'),_0xd12c('0x6b'),_0xd12c('0x6c'),_0xd12c('0x6d')]});}})[_0xd12c('0x1e')](function(_0x1a201e){if(_0x1a201e){return{'count':_0x1a201e[_0xd12c('0x2c')],'rows':_[_0xd12c('0x4a')](_0x1a201e[_0xd12c('0x54')],function(_0x37c804){return{'membername':_0x37c804[_0xd12c('0x39')],'UserId':_0x37c804['id'],'queue_name':_0x3ea22f[_0xd12c('0x39')],'ChatQueueId':_0x3ea22f['id'],'interface':util[_0xd12c('0x6e')](_0xd12c('0x6f'),_0xd12c('0x70'),_0x37c804[_0xd12c('0x39')]),'penalty':0x0,'paused':_0x37c804[_0xd12c('0x6b')],'createdAt':_0x37c804['createdAt'],'updatedAt':_0x37c804[_0xd12c('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1b9600,_0x45667a))[_0xd12c('0x29')](handleError(_0x1b9600,null));};exports[_0xd12c('0x71')]=function(_0x165247,_0x1c2b7a,_0x6afba3){var _0x218bd6={};var _0x4a3fe2={};var _0x21b794;var _0x4552bf;return db[_0xd12c('0x50')]['findOne']({'where':{'id':_0x165247['params']['id']}})[_0xd12c('0x1e')](handleEntityNotFound(_0x1c2b7a,null))[_0xd12c('0x1e')](function(_0x1f9be5){if(_0x1f9be5){_0x21b794=_0x1f9be5;_0x4a3fe2['model']=_[_0xd12c('0x56')](db[_0xd12c('0x72')][_0xd12c('0x3c')]);_0x4a3fe2[_0xd12c('0x3e')]=_[_0xd12c('0x56')](_0x165247[_0xd12c('0x3e')]);_0x4a3fe2[_0xd12c('0x46')]=_[_0xd12c('0x3f')](_0x4a3fe2[_0xd12c('0x3d')],_0x4a3fe2[_0xd12c('0x3e')]);_0x218bd6[_0xd12c('0x40')]=_['intersection'](_0x4a3fe2[_0xd12c('0x3d')],qs[_0xd12c('0x41')](_0x165247[_0xd12c('0x3e')][_0xd12c('0x41')]));_0x218bd6[_0xd12c('0x40')]=_0x218bd6[_0xd12c('0x40')]['length']?_0x218bd6[_0xd12c('0x40')]:_0x4a3fe2[_0xd12c('0x3d')];_0x218bd6[_0xd12c('0x73')]=qs[_0xd12c('0x66')](_0x165247[_0xd12c('0x3e')][_0xd12c('0x66')]);_0x218bd6[_0xd12c('0x45')]=qs['filters'](_['pick'](_0x165247[_0xd12c('0x3e')],_0x4a3fe2[_0xd12c('0x46')]));if(_0x165247[_0xd12c('0x3e')][_0xd12c('0x48')]){_0x218bd6['where']=_[_0xd12c('0x49')](_0x218bd6[_0xd12c('0x45')],{'$or':_['map'](_0x218bd6[_0xd12c('0x40')],function(_0x29f3d1){var _0x3727c0={};_0x3727c0[_0x29f3d1]={'$like':'%'+_0x165247['query']['filter']+'%'};return _0x3727c0;})});}_0x218bd6=_[_0xd12c('0x49')]({},_0x218bd6,_0x165247[_0xd12c('0x4f')]);return _0x21b794[_0xd12c('0x71')](_0x218bd6);}})['then'](function(_0x22670b){if(_0x22670b){_0x4552bf=_0x22670b[_0xd12c('0x42')];if(!_0x165247[_0xd12c('0x3e')][_0xd12c('0x43')](_0xd12c('0x44'))){_0x218bd6[_0xd12c('0x2e')]=qs[_0xd12c('0x2e')](_0x165247['query'][_0xd12c('0x2e')]);_0x218bd6[_0xd12c('0x2d')]=qs['offset'](_0x165247[_0xd12c('0x3e')][_0xd12c('0x2d')]);}return _0x21b794['getTeams'](_0x218bd6);}})[_0xd12c('0x1e')](function(_0x50b0d4){if(_0x50b0d4){return _0x50b0d4?{'count':_0x4552bf,'rows':_0x50b0d4}:null;}})[_0xd12c('0x1e')](respondWithResult(_0x1c2b7a,null))[_0xd12c('0x29')](handleError(_0x1c2b7a,null));};exports[_0xd12c('0x74')]=function(_0x447240,_0x448c5c,_0x167d3d){var _0x19d634=_0x447240[_0xd12c('0x59')]['teams'];return db['Team'][_0xd12c('0x53')]({'where':{'id':_[_0xd12c('0x4a')](_0x19d634,'id')},'attributes':['id'],'include':[{'model':db[_0xd12c('0x68')],'as':_0xd12c('0x75'),'attributes':['id',_0xd12c('0x39'),'online','voicePause',_0xd12c('0x76')],'raw':!![]}]})[_0xd12c('0x1e')](function(_0x118c9){if(_0x118c9){var _0x12eb9f=_[_0xd12c('0x77')](_0x118c9,function(_0x513d1a){var _0x3a7539=_0x513d1a[_0xd12c('0x34')]({'plain':!![]});return _0x3a7539[_0xd12c('0x75')];});return db[_0xd12c('0x50')][_0xd12c('0x57')]({'where':{'id':_0x447240['params']['id']}})[_0xd12c('0x1e')](function(_0x3a25b0){return db['sequelize']['transaction'](function(_0x30b99d){return _0x3a25b0[_0xd12c('0x74')](_[_0xd12c('0x4a')](_0x19d634,'id'),{'transaction':_0x30b99d})[_0xd12c('0x1e')](function(){return BPromise['each'](_0x12eb9f,function(_0x5e59cd){return db[_0xd12c('0x65')][_0xd12c('0x78')]({'where':{'UserId':_0x5e59cd['id'],'ChatQueueId':_0x447240[_0xd12c('0x62')]['id']},'transaction':_0x30b99d});});})[_0xd12c('0x1e')](function(){_0x12eb9f[_0xd12c('0x79')](function(_0x342ef2){socket[_0xd12c('0x7a')](_0xd12c('0x7b'),{'UserId':_0x342ef2['id'],'ChatQueueId':_0x3a25b0['id']});});});});});}})[_0xd12c('0x1e')](respondWithStatusCode(_0x448c5c,null))[_0xd12c('0x29')](handleError(_0x448c5c,null));};exports['removeTeams']=function(_0x5b9150,_0x494049,_0x15e5c9){return db[_0xd12c('0x72')][_0xd12c('0x53')]({'where':{'id':_0x5b9150[_0xd12c('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd12c('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x494049,null))[_0xd12c('0x1e')](function(_0x4f225b){var _0x48217f=_[_0xd12c('0x4a')](_0x4f225b,'id');var _0x2c722b=[];var _0x3dcdce=[];var _0x3b8900=squel[_0xd12c('0x7c')]();_0x3b8900[_0xd12c('0x4e')](_0xd12c('0x7d'))[_0xd12c('0x7e')]('team_has_chat_queues','tq')[_0xd12c('0x7f')](_0xd12c('0x80'),'ut',_0xd12c('0x81'))[_0xd12c('0x45')](_0xd12c('0x82'),_0x5b9150['params']['id']);for(var _0x2effe9=0x0;_0x2effe9<_0x4f225b[_0xd12c('0x42')];_0x2effe9+=0x1){let _0x2f9e2d=_0x4f225b[_0x2effe9];for(var _0x2575c3=0x0;_0x2575c3<_0x2f9e2d[_0xd12c('0x75')][_0xd12c('0x42')];_0x2575c3+=0x1){let _0x55b0ec=_0x2f9e2d['Agents'][_0x2575c3];var _0x3de517=_0x3b8900[_0xd12c('0x83')]();_0x3de517['where'](_0xd12c('0x84'),_0x55b0ec['id']);_0x3dcdce[_0xd12c('0x85')](db[_0xd12c('0x86')][_0xd12c('0x3e')](_0x3de517[_0xd12c('0x87')](),{'type':db[_0xd12c('0x86')][_0xd12c('0x88')]['SELECT']})[_0xd12c('0x1e')](function(_0x2eaed5){if(_0x2eaed5[_0xd12c('0x42')]===0x1){return _0x55b0ec['id'];}else{var _0x5aa61d=_['every'](_[_0xd12c('0x4a')](_0x2eaed5,_0xd12c('0x89')),function(_0x18725e){return _[_0xd12c('0x8a')](_0x48217f,_0x18725e);});if(_0x5aa61d){return _0x55b0ec['id'];}}}));}}return BPromise[_0xd12c('0x8b')](_0x3dcdce)['then'](function(_0xd0aa7){_0x2c722b=_(_0x2c722b)['union'](_0xd0aa7)[_0xd12c('0x8c')]()[_0xd12c('0x8d')]();return db[_0xd12c('0x50')][_0xd12c('0x57')]({'where':{'id':_0x5b9150[_0xd12c('0x62')]['id']}})['then'](function(_0x12acda){return db['sequelize'][_0xd12c('0x8e')](function(_0x2c2211){return _0x12acda[_0xd12c('0x8f')](_0x5b9150[_0xd12c('0x3e')][_0xd12c('0x90')],{'transaction':_0x2c2211})[_0xd12c('0x1e')](function(){if(!_[_0xd12c('0x91')](_0x2c722b)){return _0x12acda[_0xd12c('0x92')](_0x2c722b,{'transaction':_0x2c2211});}})[_0xd12c('0x1e')](function(){_0x2c722b[_0xd12c('0x79')](function(_0x5850f3){socket['emit']('userChatQueue:remove',{'UserId':_0x5850f3,'ChatQueueId':_0x12acda['id']});});});});});});})[_0xd12c('0x1e')](respondWithStatusCode(_0x494049,null))[_0xd12c('0x29')](handleError(_0x494049,null));};exports['addAgents']=function(_0x32f1dd,_0x414503,_0x342808){return db[_0xd12c('0x50')]['find']({'where':{'id':_0x32f1dd[_0xd12c('0x62')]['id']}})[_0xd12c('0x1e')](handleEntityNotFound(_0x414503,null))[_0xd12c('0x1e')](function(_0x250d15){if(_0x250d15){return _0x250d15[_0xd12c('0x93')](_0x32f1dd[_0xd12c('0x59')][_0xd12c('0x90')],_[_0xd12c('0x94')](_0x32f1dd[_0xd12c('0x59')],[_0xd12c('0x90'),'id'])||{})[_0xd12c('0x95')](function(_0x3171e6){for(var _0x5cd4a3=0x0;_0x5cd4a3<_0x32f1dd[_0xd12c('0x59')][_0xd12c('0x90')][_0xd12c('0x42')];_0x5cd4a3+=0x1){socket['emit'](_0xd12c('0x7b'),{'UserId':_0x32f1dd[_0xd12c('0x59')][_0xd12c('0x90')][_0x5cd4a3],'ChatQueueId':_0x32f1dd[_0xd12c('0x62')]['id']});}return _0x3171e6;});}})[_0xd12c('0x1e')](respondWithResult(_0x414503,null))[_0xd12c('0x29')](handleError(_0x414503,null));};exports[_0xd12c('0x92')]=function(_0x330b31,_0x2de390,_0x282e7a){return db[_0xd12c('0x50')][_0xd12c('0x57')]({'where':{'id':_0x330b31['params']['id']}})[_0xd12c('0x1e')](handleEntityNotFound(_0x2de390,null))[_0xd12c('0x1e')](function(_0x3f426f){if(_0x3f426f){return _0x3f426f[_0xd12c('0x92')](_0x330b31[_0xd12c('0x3e')]['ids'])[_0xd12c('0x1e')](function(){if(_[_0xd12c('0x96')](_0x330b31[_0xd12c('0x3e')][_0xd12c('0x90')])){for(var _0x1ff264=0x0;_0x1ff264<_0x330b31[_0xd12c('0x3e')][_0xd12c('0x90')][_0xd12c('0x42')];_0x1ff264+=0x1){socket[_0xd12c('0x7a')](_0xd12c('0x97'),{'UserId':Number(_0x330b31[_0xd12c('0x3e')]['ids'][_0x1ff264]),'ChatQueueId':Number(_0x330b31['params']['id'])});}}else{socket[_0xd12c('0x7a')]('userChatQueue:remove',{'UserId':Number(_0x330b31[_0xd12c('0x3e')][_0xd12c('0x90')]),'ChatQueueId':Number(_0x330b31[_0xd12c('0x62')]['id'])});}});}})[_0xd12c('0x1e')](respondWithStatusCode(_0x2de390,null))[_0xd12c('0x29')](handleError(_0x2de390,null));};exports[_0xd12c('0x98')]=function(_0x36e52c,_0x4d4ce0,_0x1442f7){var _0x2b8cb7={};var _0x12210e={};var _0x4c628f;var _0x3c1ea4;return db[_0xd12c('0x50')]['findOne']({'where':{'id':_0x36e52c['params']['id']}})[_0xd12c('0x1e')](handleEntityNotFound(_0x4d4ce0,null))[_0xd12c('0x1e')](function(_0x2bc201){if(_0x2bc201){_0x4c628f=_0x2bc201;_0x12210e[_0xd12c('0x3d')]=_[_0xd12c('0x56')](db[_0xd12c('0x68')][_0xd12c('0x3c')]);_0x12210e[_0xd12c('0x3e')]=_[_0xd12c('0x56')](_0x36e52c[_0xd12c('0x3e')]);_0x12210e['filters']=_['intersection'](_0x12210e['model'],_0x12210e[_0xd12c('0x3e')]);_0x2b8cb7[_0xd12c('0x40')]=_[_0xd12c('0x3f')](_0x12210e[_0xd12c('0x3d')],qs[_0xd12c('0x41')](_0x36e52c['query'][_0xd12c('0x41')]));_0x2b8cb7[_0xd12c('0x40')]=_0x2b8cb7[_0xd12c('0x40')][_0xd12c('0x42')]?_0x2b8cb7['attributes']:_0x12210e['model'];_0x2b8cb7[_0xd12c('0x73')]=qs[_0xd12c('0x66')](_0x36e52c[_0xd12c('0x3e')]['sort']);_0x2b8cb7['where']=qs[_0xd12c('0x46')](_[_0xd12c('0x47')](_0x36e52c[_0xd12c('0x3e')],_0x12210e[_0xd12c('0x46')]));if(_0x36e52c[_0xd12c('0x3e')]['filter']){_0x2b8cb7[_0xd12c('0x45')]=_[_0xd12c('0x49')](_0x2b8cb7[_0xd12c('0x45')],{'$or':_[_0xd12c('0x4a')](_0x2b8cb7[_0xd12c('0x40')],function(_0x39dd60){var _0x55fb90={};_0x55fb90[_0x39dd60]={'$like':'%'+_0x36e52c[_0xd12c('0x3e')][_0xd12c('0x48')]+'%'};return _0x55fb90;})});}_0x2b8cb7=_['merge']({},_0x2b8cb7,_0x36e52c['options']);return _0x4c628f['getAgents'](_0x2b8cb7);}})[_0xd12c('0x1e')](function(_0x4fb7c8){if(_0x4fb7c8){_0x3c1ea4=_0x4fb7c8[_0xd12c('0x42')];if(!_0x36e52c[_0xd12c('0x3e')]['hasOwnProperty']('nolimit')){_0x2b8cb7[_0xd12c('0x2e')]=qs[_0xd12c('0x2e')](_0x36e52c[_0xd12c('0x3e')]['limit']);_0x2b8cb7[_0xd12c('0x2d')]=qs[_0xd12c('0x2d')](_0x36e52c[_0xd12c('0x3e')][_0xd12c('0x2d')]);}return _0x4c628f[_0xd12c('0x98')](_0x2b8cb7);}})['then'](function(_0x3f0869){if(_0x3f0869){return _0x3f0869?{'count':_0x3c1ea4,'rows':_0x3f0869}:null;}})[_0xd12c('0x1e')](respondWithResult(_0x4d4ce0,null))[_0xd12c('0x29')](handleError(_0x4d4ce0,null));}; \ No newline at end of file +var _0x10dd=['findAll','rows','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','chatPause','createdAt','getTeams','Team','order','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','ids','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','all','compact','value','removeTeams','addAgents','spread','removeAgents','userChatQueue:remove','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filters','map','type','key','VIRTUAL','field','filter','merge','ChatQueue','count','includeAll','include'];(function(_0x44786e,_0x5370f4){var _0x2aacd5=function(_0xe5bfdf){while(--_0xe5bfdf){_0x44786e['push'](_0x44786e['shift']());}};_0x2aacd5(++_0x5370f4);}(_0x10dd,0xda));var _0xd10d=function(_0x578334,_0x24462f){_0x578334=_0x578334-0x0;var _0x3dd454=_0x10dd[_0x578334];return _0x3dd454;};'use strict';var pdf=require(_0xd10d('0x0'));var emlformat=require(_0xd10d('0x1'));var rimraf=require(_0xd10d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd10d('0x3'));var rp=require(_0xd10d('0x4'));var moment=require(_0xd10d('0x5'));var BPromise=require(_0xd10d('0x6'));var Mustache=require(_0xd10d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd10d('0x8'));var csv=require(_0xd10d('0x9'));var ejs=require(_0xd10d('0xa'));var fs=require('fs');var _=require(_0xd10d('0xb'));var squel=require(_0xd10d('0xc'));var crypto=require('crypto');var jsforce=require(_0xd10d('0xd'));var deskjs=require(_0xd10d('0xe'));var toCsv=require(_0xd10d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd10d('0xf'));var authService=require(_0xd10d('0x10'));var qs=require(_0xd10d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd10d('0x12'))(_0xd10d('0x13'));var utils=require(_0xd10d('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd10d('0x15')]=_[_0xd10d('0x16')](config[_0xd10d('0x15')],{'host':_0xd10d('0x17'),'port':0x18eb});var socket=require(_0xd10d('0x18'))(new Redis(config[_0xd10d('0x15')]));require(_0xd10d('0x19'))[_0xd10d('0x1a')](socket);var jayson=require(_0xd10d('0x1b'));var client=jayson[_0xd10d('0x1c')][_0xd10d('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1691d5,_0x4769dc,_0x4c83a0){if(_0x4c83a0){var _0x3fbfbc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fbfbc[_0xd10d('0x1e')](_0x4769dc)){return _0x1691d5;}else{throw new Error(_0xd10d('0x1f'));}}else{return _0x1691d5;}}function respondWithRpcPromise(_0x5afedd,_0x33ae48,_0x2e90c9,_0x45cb48){return new BPromise(function(_0x194a5e,_0x16bbb0){var _0x1d4fd6=_0x45cb48||client;return _0x1d4fd6[_0xd10d('0x20')](_0x5afedd,_0x2e90c9)[_0xd10d('0x21')](function(_0x37d2d5){logger[_0xd10d('0x22')](_0xd10d('0x23'),_0x33ae48,_0xd10d('0x24'));logger[_0xd10d('0x25')](_0xd10d('0x26'),_0x33ae48,_0xd10d('0x24'),JSON['stringify'](_0x37d2d5));if(_0x37d2d5[_0xd10d('0x27')]){if(_0x37d2d5[_0xd10d('0x27')][_0xd10d('0x28')]===0x1f4){logger[_0xd10d('0x27')](_0xd10d('0x23'),_0x33ae48,_0x37d2d5[_0xd10d('0x27')][_0xd10d('0x29')]);return _0x16bbb0(_0x37d2d5[_0xd10d('0x27')][_0xd10d('0x29')]);}logger[_0xd10d('0x27')](_0xd10d('0x23'),_0x33ae48,_0x37d2d5[_0xd10d('0x27')][_0xd10d('0x29')]);return _0x194a5e(_0x37d2d5[_0xd10d('0x27')]['message']);}else{logger[_0xd10d('0x22')](_0xd10d('0x23'),_0x33ae48,'request\x20sent');_0x194a5e(_0x37d2d5[_0xd10d('0x2a')]['message']);}})[_0xd10d('0x2b')](function(_0x2f9c8b){logger[_0xd10d('0x27')]('ChatQueue,\x20%s,\x20%s',_0x33ae48,_0x2f9c8b);_0x16bbb0(_0x2f9c8b);});});}function respondWithStatusCode(_0x505d56,_0x515d8e){_0x515d8e=_0x515d8e||0xcc;return function(_0x31c752){if(_0x31c752){return _0x505d56['sendStatus'](_0x515d8e);}return _0x505d56[_0xd10d('0x2c')](_0x515d8e)[_0xd10d('0x2d')]();};}function respondWithResult(_0x1d4ed1,_0x457fb5){_0x457fb5=_0x457fb5||0xc8;return function(_0x2cfc72){if(_0x2cfc72){return _0x1d4ed1[_0xd10d('0x2c')](_0x457fb5)[_0xd10d('0x2e')](_0x2cfc72);}};}function respondWithFilteredResult(_0x8e3eb0,_0x3f2604){return function(_0x4f21ed){if(_0x4f21ed){var _0x15d78f=_0x4f21ed['count'],_0x437e11=_0x3f2604[_0xd10d('0x2f')],_0x3f8fdf=_0x3f2604[_0xd10d('0x2f')]+_0x3f2604['limit'],_0x43a9c8;if(_0x3f8fdf>=_0x15d78f){_0x3f8fdf=_0x15d78f;_0x43a9c8=0xc8;}else{_0x43a9c8=0xce;}_0x8e3eb0[_0xd10d('0x2c')](_0x43a9c8);return _0x8e3eb0[_0xd10d('0x30')](_0xd10d('0x31'),_0x437e11+'-'+_0x3f8fdf+'/'+_0x15d78f)['json'](_0x4f21ed);}return null;};}function patchUpdates(_0x1d7393){return function(_0x144d1a){try{jsonpatch[_0xd10d('0x32')](_0x144d1a,_0x1d7393,!![]);}catch(_0x18dcb7){return BPromise[_0xd10d('0x33')](_0x18dcb7);}return _0x144d1a[_0xd10d('0x34')]();};}function saveUpdates(_0x18631f,_0x4aff11){return function(_0x459388){if(_0x459388){return _0x459388[_0xd10d('0x35')](_0x18631f)[_0xd10d('0x21')](function(_0x50fbb3){return _0x50fbb3;});}return null;};}function removeEntity(_0x29e155,_0x2f2dc9){return function(_0x26f02c){if(_0x26f02c){return _0x26f02c[_0xd10d('0x36')]()[_0xd10d('0x21')](function(){var _0x33168d=_0x26f02c[_0xd10d('0x37')]({'plain':!![]});var _0x27cc63=_0xd10d('0x38');return db[_0xd10d('0x39')][_0xd10d('0x36')]({'where':{'type':_0x27cc63,'resourceId':_0x33168d['id']}})[_0xd10d('0x21')](function(){return _0x26f02c;});})[_0xd10d('0x21')](function(){_0x29e155[_0xd10d('0x2c')](0xcc)[_0xd10d('0x2d')]();});}};}function handleEntityNotFound(_0x3e0146,_0x3b142b){return function(_0x260f7c){if(!_0x260f7c){_0x3e0146[_0xd10d('0x3a')](0x194);}return _0x260f7c;};}function handleError(_0xfd8ec5,_0x4b87eb){_0x4b87eb=_0x4b87eb||0x1f4;return function(_0x1017bd){logger[_0xd10d('0x27')](_0x1017bd[_0xd10d('0x3b')]);if(_0x1017bd[_0xd10d('0x3c')]){delete _0x1017bd[_0xd10d('0x3c')];}_0xfd8ec5[_0xd10d('0x2c')](_0x4b87eb)[_0xd10d('0x3d')](_0x1017bd);};}exports['index']=function(_0x1061fd,_0x99088f){var _0x2dbcca={},_0x58ac4b={},_0x31ad9d={'count':0x0,'rows':[]};var _0x42f11a=db['ChatQueue']['rawAttributes'];_0x58ac4b['model']=_[_0xd10d('0x3e')](_0x42f11a);_0x58ac4b[_0xd10d('0x3f')]=_[_0xd10d('0x3e')](_0x1061fd[_0xd10d('0x3f')]);_0x58ac4b['filters']=_['intersection'](_0x58ac4b[_0xd10d('0x40')],_0x58ac4b[_0xd10d('0x3f')]);_0x2dbcca[_0xd10d('0x41')]=_[_0xd10d('0x42')](_0x58ac4b['model'],qs[_0xd10d('0x43')](_0x1061fd['query'][_0xd10d('0x43')]));_0x2dbcca[_0xd10d('0x41')]=_0x2dbcca[_0xd10d('0x41')][_0xd10d('0x44')]?_0x2dbcca[_0xd10d('0x41')]:_0x58ac4b[_0xd10d('0x40')];if(!_0x1061fd[_0xd10d('0x3f')][_0xd10d('0x45')]('nolimit')){_0x2dbcca[_0xd10d('0x46')]=qs[_0xd10d('0x46')](_0x1061fd[_0xd10d('0x3f')]['limit']);_0x2dbcca[_0xd10d('0x2f')]=qs['offset'](_0x1061fd[_0xd10d('0x3f')][_0xd10d('0x2f')]);}_0x2dbcca['order']=qs[_0xd10d('0x47')](_0x1061fd[_0xd10d('0x3f')][_0xd10d('0x47')]);_0x2dbcca[_0xd10d('0x48')]=qs['filters'](_[_0xd10d('0x49')](_0x1061fd[_0xd10d('0x3f')],_0x58ac4b[_0xd10d('0x4a')]));if(_0x1061fd[_0xd10d('0x3f')]['filter']){_0x2dbcca[_0xd10d('0x48')]=_['merge'](_0x2dbcca[_0xd10d('0x48')],{'$or':_[_0xd10d('0x4b')](_0x42f11a,function(_0x1c41dd){if(_0x1c41dd[_0xd10d('0x4c')][_0xd10d('0x4d')]!==_0xd10d('0x4e')){var _0x2a8e42={};_0x2a8e42[_0x1c41dd[_0xd10d('0x4f')]]={'$like':'%'+_0x1061fd[_0xd10d('0x3f')][_0xd10d('0x50')]+'%'};return _0x2a8e42;}})});}_0x2dbcca=_[_0xd10d('0x51')]({},_0x2dbcca,_0x1061fd['options']);var _0x5c37c2={'where':_0x2dbcca[_0xd10d('0x48')]};return db[_0xd10d('0x52')][_0xd10d('0x53')](_0x5c37c2)[_0xd10d('0x21')](function(_0x47a803){_0x31ad9d[_0xd10d('0x53')]=_0x47a803;if(_0x1061fd['query'][_0xd10d('0x54')]){_0x2dbcca[_0xd10d('0x55')]=[{'all':!![]}];}return db[_0xd10d('0x52')][_0xd10d('0x56')](_0x2dbcca);})['then'](function(_0x1781cb){_0x31ad9d[_0xd10d('0x57')]=_0x1781cb;return _0x31ad9d;})[_0xd10d('0x21')](respondWithFilteredResult(_0x99088f,_0x2dbcca))['catch'](handleError(_0x99088f,null));};exports[_0xd10d('0x58')]=function(_0x85bbe6,_0x31b647){var _0x346fd9={'raw':!![],'where':{'id':_0x85bbe6[_0xd10d('0x59')]['id']}},_0x1f7c98={};_0x1f7c98[_0xd10d('0x40')]=_[_0xd10d('0x3e')](db[_0xd10d('0x52')][_0xd10d('0x5a')]);_0x1f7c98[_0xd10d('0x3f')]=_[_0xd10d('0x3e')](_0x85bbe6['query']);_0x1f7c98[_0xd10d('0x4a')]=_[_0xd10d('0x42')](_0x1f7c98['model'],_0x1f7c98['query']);_0x346fd9[_0xd10d('0x41')]=_[_0xd10d('0x42')](_0x1f7c98[_0xd10d('0x40')],qs[_0xd10d('0x43')](_0x85bbe6['query']['fields']));_0x346fd9[_0xd10d('0x41')]=_0x346fd9[_0xd10d('0x41')][_0xd10d('0x44')]?_0x346fd9[_0xd10d('0x41')]:_0x1f7c98['model'];if(_0x85bbe6[_0xd10d('0x3f')][_0xd10d('0x54')]){_0x346fd9[_0xd10d('0x55')]=[{'all':!![]}];}_0x346fd9=_['merge']({},_0x346fd9,_0x85bbe6[_0xd10d('0x5b')]);return db[_0xd10d('0x52')]['find'](_0x346fd9)['then'](handleEntityNotFound(_0x31b647,null))['then'](respondWithResult(_0x31b647,null))[_0xd10d('0x2b')](handleError(_0x31b647,null));};exports[_0xd10d('0x5c')]=function(_0x3a19ba,_0x1952f4){return db[_0xd10d('0x52')][_0xd10d('0x5c')](_0x3a19ba[_0xd10d('0x5d')],{})[_0xd10d('0x21')](function(_0x4355ec){var _0x304234=_0x3a19ba[_0xd10d('0x5e')]['get']({'plain':!![]});if(!_0x304234)throw new Error(_0xd10d('0x5f'));if(_0x304234[_0xd10d('0x60')]===_0xd10d('0x5e')){var _0x4adb3a=_0x4355ec[_0xd10d('0x37')]({'plain':!![]});var _0x1b7720=_0xd10d('0x38');return db[_0xd10d('0x61')][_0xd10d('0x62')]({'where':{'name':_0x1b7720,'userProfileId':_0x304234[_0xd10d('0x63')]},'raw':!![]})[_0xd10d('0x21')](function(_0x4e2e3e){if(_0x4e2e3e&&_0x4e2e3e[_0xd10d('0x64')]===0x0){return db[_0xd10d('0x39')][_0xd10d('0x5c')]({'name':_0x4adb3a[_0xd10d('0x3c')],'resourceId':_0x4adb3a['id'],'type':_0x4e2e3e[_0xd10d('0x3c')],'sectionId':_0x4e2e3e['id']},{})['then'](function(){return _0x4355ec;});}else{return _0x4355ec;}})[_0xd10d('0x2b')](function(_0x525ec8){logger[_0xd10d('0x27')](_0xd10d('0x65'),_0x525ec8);throw _0x525ec8;});}return _0x4355ec;})[_0xd10d('0x21')](respondWithResult(_0x1952f4,0xc9))['catch'](handleError(_0x1952f4,null));};exports['update']=function(_0x79a1bc,_0x5b6b63){if(_0x79a1bc[_0xd10d('0x5d')]['id']){delete _0x79a1bc[_0xd10d('0x5d')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x79a1bc[_0xd10d('0x59')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x5b6b63,null))[_0xd10d('0x21')](saveUpdates(_0x79a1bc['body'],null))['then'](respondWithResult(_0x5b6b63,null))[_0xd10d('0x2b')](handleError(_0x5b6b63,null));};exports[_0xd10d('0x36')]=function(_0x9fbc6d,_0x356ac3){return db[_0xd10d('0x52')]['find']({'where':{'id':_0x9fbc6d[_0xd10d('0x59')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x356ac3,null))['then'](removeEntity(_0x356ac3,null))[_0xd10d('0x2b')](handleError(_0x356ac3,null));};exports[_0xd10d('0x66')]=function(_0x3dc65f,_0x53312f){return db[_0xd10d('0x52')][_0xd10d('0x66')]()[_0xd10d('0x21')](respondWithResult(_0x53312f,null))[_0xd10d('0x2b')](handleError(_0x53312f,null));};exports[_0xd10d('0x67')]=function(_0x20137d,_0x4e4f22,_0x9f17fb){var _0x1ece84={'raw':!![],'where':{}},_0x20e1c6={},_0x2a07f7;return db[_0xd10d('0x52')][_0xd10d('0x68')]({'where':{'id':_0x20137d['params']['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x4e4f22,null))['then'](function(_0x4a073d){if(_0x4a073d){_0x2a07f7=_0x4a073d[_0xd10d('0x37')]({'plain':!![]});_0x20e1c6[_0xd10d('0x40')]=_['keys'](db[_0xd10d('0x69')]['rawAttributes']);_0x20e1c6[_0xd10d('0x3f')]=_[_0xd10d('0x3e')](_0x20137d[_0xd10d('0x3f')]);_0x20e1c6[_0xd10d('0x4a')]=_[_0xd10d('0x42')](_0x20e1c6['model'],_0x20e1c6[_0xd10d('0x3f')]);_0x1ece84[_0xd10d('0x41')]=_[_0xd10d('0x42')](_0x20e1c6[_0xd10d('0x40')],qs[_0xd10d('0x43')](_0x20137d['query'][_0xd10d('0x43')]));_0x1ece84[_0xd10d('0x41')]=_0x1ece84[_0xd10d('0x41')]['length']?_0x1ece84[_0xd10d('0x41')]:_0x20e1c6[_0xd10d('0x40')];if(!_0x20137d[_0xd10d('0x3f')]['hasOwnProperty'](_0xd10d('0x6a'))){_0x1ece84[_0xd10d('0x46')]=qs[_0xd10d('0x46')](_0x20137d[_0xd10d('0x3f')]['limit']);_0x1ece84['offset']=qs['offset'](_0x20137d[_0xd10d('0x3f')]['offset']);}_0x1ece84['order']=qs[_0xd10d('0x47')](_0x20137d[_0xd10d('0x3f')][_0xd10d('0x47')]);_0x1ece84['where']=qs[_0xd10d('0x4a')](_[_0xd10d('0x49')](_0x20137d[_0xd10d('0x3f')],_0x20e1c6[_0xd10d('0x4a')]));_0x1ece84[_0xd10d('0x48')]['ChatQueueId']=_0x4a073d['id'];if(_0x20137d[_0xd10d('0x3f')][_0xd10d('0x50')]){_0x1ece84['where']=_[_0xd10d('0x51')](_0x1ece84[_0xd10d('0x48')],{'$or':_[_0xd10d('0x4b')](_0x1ece84[_0xd10d('0x41')],function(_0x44ac49){var _0x8217f9={};_0x8217f9[_0x44ac49]={'$like':'%'+_0x20137d[_0xd10d('0x3f')][_0xd10d('0x50')]+'%'};return _0x8217f9;})});}_0x1ece84=_['merge']({},_0x1ece84,_0x20137d['options']);return db[_0xd10d('0x69')][_0xd10d('0x56')](_0x1ece84);}})[_0xd10d('0x21')](function(_0x349ec1){if(_0x349ec1){return db[_0xd10d('0x6b')][_0xd10d('0x6c')]({'where':{'id':_[_0xd10d('0x4b')](_0x349ec1,_0xd10d('0x6d')),'role':_0xd10d('0x6e')},'attributes':['id','name','chatPause',_0xd10d('0x6f'),'createdAt']});}})[_0xd10d('0x21')](function(_0x2046b0){if(_0x2046b0){return{'count':_0x2046b0['count'],'rows':_[_0xd10d('0x4b')](_0x2046b0[_0xd10d('0x57')],function(_0x4dec1c){return{'membername':_0x4dec1c[_0xd10d('0x3c')],'UserId':_0x4dec1c['id'],'queue_name':_0x2a07f7['name'],'ChatQueueId':_0x2a07f7['id'],'interface':util[_0xd10d('0x70')](_0xd10d('0x71'),'SIP',_0x4dec1c[_0xd10d('0x3c')]),'penalty':0x0,'paused':_0x4dec1c[_0xd10d('0x72')],'createdAt':_0x4dec1c[_0xd10d('0x73')],'updatedAt':_0x4dec1c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd10d('0x21')](respondWithFilteredResult(_0x4e4f22,_0x1ece84))['catch'](handleError(_0x4e4f22,null));};exports[_0xd10d('0x74')]=function(_0x1bf1a3,_0x1bb756,_0x1b25dc){var _0x1c06ba={};var _0x570292={};var _0xf502f4;var _0x121d7c;return db[_0xd10d('0x52')][_0xd10d('0x68')]({'where':{'id':_0x1bf1a3[_0xd10d('0x59')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x1bb756,null))['then'](function(_0x26b194){if(_0x26b194){_0xf502f4=_0x26b194;_0x570292['model']=_[_0xd10d('0x3e')](db[_0xd10d('0x75')][_0xd10d('0x5a')]);_0x570292[_0xd10d('0x3f')]=_[_0xd10d('0x3e')](_0x1bf1a3[_0xd10d('0x3f')]);_0x570292[_0xd10d('0x4a')]=_[_0xd10d('0x42')](_0x570292['model'],_0x570292[_0xd10d('0x3f')]);_0x1c06ba[_0xd10d('0x41')]=_[_0xd10d('0x42')](_0x570292['model'],qs['fields'](_0x1bf1a3[_0xd10d('0x3f')]['fields']));_0x1c06ba[_0xd10d('0x41')]=_0x1c06ba[_0xd10d('0x41')][_0xd10d('0x44')]?_0x1c06ba[_0xd10d('0x41')]:_0x570292['model'];_0x1c06ba[_0xd10d('0x76')]=qs[_0xd10d('0x47')](_0x1bf1a3[_0xd10d('0x3f')][_0xd10d('0x47')]);_0x1c06ba['where']=qs['filters'](_[_0xd10d('0x49')](_0x1bf1a3[_0xd10d('0x3f')],_0x570292[_0xd10d('0x4a')]));if(_0x1bf1a3[_0xd10d('0x3f')][_0xd10d('0x50')]){_0x1c06ba[_0xd10d('0x48')]=_[_0xd10d('0x51')](_0x1c06ba[_0xd10d('0x48')],{'$or':_[_0xd10d('0x4b')](_0x1c06ba[_0xd10d('0x41')],function(_0x339a0e){var _0x926212={};_0x926212[_0x339a0e]={'$like':'%'+_0x1bf1a3['query'][_0xd10d('0x50')]+'%'};return _0x926212;})});}_0x1c06ba=_[_0xd10d('0x51')]({},_0x1c06ba,_0x1bf1a3[_0xd10d('0x5b')]);return _0xf502f4[_0xd10d('0x74')](_0x1c06ba);}})[_0xd10d('0x21')](function(_0x2548ce){if(_0x2548ce){_0x121d7c=_0x2548ce[_0xd10d('0x44')];if(!_0x1bf1a3['query'][_0xd10d('0x45')](_0xd10d('0x6a'))){_0x1c06ba[_0xd10d('0x46')]=qs[_0xd10d('0x46')](_0x1bf1a3[_0xd10d('0x3f')]['limit']);_0x1c06ba['offset']=qs[_0xd10d('0x2f')](_0x1bf1a3[_0xd10d('0x3f')]['offset']);}return _0xf502f4['getTeams'](_0x1c06ba);}})['then'](function(_0xbfbd9){if(_0xbfbd9){return _0xbfbd9?{'count':_0x121d7c,'rows':_0xbfbd9}:null;}})[_0xd10d('0x21')](respondWithResult(_0x1bb756,null))[_0xd10d('0x2b')](handleError(_0x1bb756,null));};exports[_0xd10d('0x77')]=function(_0x572efd,_0x55e1e2,_0x559268){var _0x2c10f9=_0x572efd['body']['teams'];return db[_0xd10d('0x75')]['findAll']({'where':{'id':_['map'](_0x2c10f9,'id')},'attributes':['id'],'include':[{'model':db[_0xd10d('0x6b')],'as':'Agents','attributes':['id',_0xd10d('0x3c'),_0xd10d('0x78'),_0xd10d('0x79'),_0xd10d('0x7a')],'raw':!![]}]})[_0xd10d('0x21')](function(_0x4030a4){if(_0x4030a4){var _0x2ac8b4=_[_0xd10d('0x7b')](_0x4030a4,function(_0x2b4ee7){var _0x133383=_0x2b4ee7[_0xd10d('0x37')]({'plain':!![]});return _0x133383[_0xd10d('0x7c')];});return db[_0xd10d('0x52')][_0xd10d('0x62')]({'where':{'id':_0x572efd[_0xd10d('0x59')]['id']}})[_0xd10d('0x21')](function(_0x815f09){return db[_0xd10d('0x7d')][_0xd10d('0x7e')](function(_0x5b7d0c){return _0x815f09[_0xd10d('0x77')](_[_0xd10d('0x4b')](_0x2c10f9,'id'),{'transaction':_0x5b7d0c})[_0xd10d('0x21')](function(){return BPromise[_0xd10d('0x7f')](_0x2ac8b4,function(_0x24c77c){return db[_0xd10d('0x69')][_0xd10d('0x80')]({'where':{'UserId':_0x24c77c['id'],'ChatQueueId':_0x572efd['params']['id']},'transaction':_0x5b7d0c});});})[_0xd10d('0x21')](function(){_0x2ac8b4[_0xd10d('0x81')](function(_0x51dc78){socket[_0xd10d('0x82')](_0xd10d('0x83'),{'UserId':_0x51dc78['id'],'ChatQueueId':_0x815f09['id']});});});});});}})[_0xd10d('0x21')](respondWithStatusCode(_0x55e1e2,null))[_0xd10d('0x2b')](handleError(_0x55e1e2,null));};exports['removeTeams']=function(_0x4c5f1c,_0x2fe58e,_0x2af9cb){return db[_0xd10d('0x75')][_0xd10d('0x56')]({'where':{'id':_0x4c5f1c[_0xd10d('0x3f')][_0xd10d('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd10d('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2fe58e,null))[_0xd10d('0x21')](function(_0x5e6c69){var _0x199671=_[_0xd10d('0x4b')](_0x5e6c69,'id');var _0x52b6f7=[];var _0xbfe2fe=[];var _0xc7413d=squel[_0xd10d('0x85')]();_0xc7413d[_0xd10d('0x4f')](_0xd10d('0x86'))['from'](_0xd10d('0x87'),'tq')[_0xd10d('0x88')](_0xd10d('0x89'),'ut',_0xd10d('0x8a'))[_0xd10d('0x48')]('ChatQueueId\x20=\x20?',_0x4c5f1c[_0xd10d('0x59')]['id']);for(var _0x40c777=0x0;_0x40c777<_0x5e6c69['length'];_0x40c777+=0x1){let _0xf8becb=_0x5e6c69[_0x40c777];for(var _0x11a15b=0x0;_0x11a15b<_0xf8becb[_0xd10d('0x7c')][_0xd10d('0x44')];_0x11a15b+=0x1){let _0x19cf42=_0xf8becb[_0xd10d('0x7c')][_0x11a15b];var _0xf48701=_0xc7413d[_0xd10d('0x8b')]();_0xf48701['where'](_0xd10d('0x8c'),_0x19cf42['id']);_0xbfe2fe[_0xd10d('0x8d')](db[_0xd10d('0x7d')][_0xd10d('0x3f')](_0xf48701['toString'](),{'type':db[_0xd10d('0x7d')][_0xd10d('0x8e')]['SELECT']})[_0xd10d('0x21')](function(_0x3e97a3){if(_0x3e97a3[_0xd10d('0x44')]===0x1){return _0x19cf42['id'];}else{var _0x589ec9=_['every'](_[_0xd10d('0x4b')](_0x3e97a3,_0xd10d('0x8f')),function(_0xcbfe6){return _['includes'](_0x199671,_0xcbfe6);});if(_0x589ec9){return _0x19cf42['id'];}}}));}}return BPromise[_0xd10d('0x90')](_0xbfe2fe)[_0xd10d('0x21')](function(_0x1503dc){_0x52b6f7=_(_0x52b6f7)['union'](_0x1503dc)[_0xd10d('0x91')]()[_0xd10d('0x92')]();return db[_0xd10d('0x52')][_0xd10d('0x62')]({'where':{'id':_0x4c5f1c[_0xd10d('0x59')]['id']}})[_0xd10d('0x21')](function(_0xe220a6){return db[_0xd10d('0x7d')]['transaction'](function(_0x1d1b71){return _0xe220a6[_0xd10d('0x93')](_0x4c5f1c[_0xd10d('0x3f')][_0xd10d('0x84')],{'transaction':_0x1d1b71})[_0xd10d('0x21')](function(){if(!_['isEmpty'](_0x52b6f7)){return _0xe220a6['removeAgents'](_0x52b6f7,{'transaction':_0x1d1b71});}})[_0xd10d('0x21')](function(){_0x52b6f7[_0xd10d('0x81')](function(_0x161f1a){socket[_0xd10d('0x82')]('userChatQueue:remove',{'UserId':_0x161f1a,'ChatQueueId':_0xe220a6['id']});});});});});});})[_0xd10d('0x21')](respondWithStatusCode(_0x2fe58e,null))[_0xd10d('0x2b')](handleError(_0x2fe58e,null));};exports['addAgents']=function(_0x212eca,_0x3f3a9a,_0x51d00f){return db['ChatQueue'][_0xd10d('0x62')]({'where':{'id':_0x212eca[_0xd10d('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f3a9a,null))[_0xd10d('0x21')](function(_0x164a5f){if(_0x164a5f){return _0x164a5f[_0xd10d('0x94')](_0x212eca[_0xd10d('0x5d')][_0xd10d('0x84')],_['omit'](_0x212eca[_0xd10d('0x5d')],[_0xd10d('0x84'),'id'])||{})[_0xd10d('0x95')](function(_0xd57308){for(var _0x385167=0x0;_0x385167<_0x212eca[_0xd10d('0x5d')]['ids']['length'];_0x385167+=0x1){socket[_0xd10d('0x82')](_0xd10d('0x83'),{'UserId':_0x212eca['body'][_0xd10d('0x84')][_0x385167],'ChatQueueId':_0x212eca[_0xd10d('0x59')]['id']});}return _0xd57308;});}})[_0xd10d('0x21')](respondWithResult(_0x3f3a9a,null))[_0xd10d('0x2b')](handleError(_0x3f3a9a,null));};exports[_0xd10d('0x96')]=function(_0x31f8d0,_0x2496ce,_0x29a466){return db[_0xd10d('0x52')]['find']({'where':{'id':_0x31f8d0['params']['id']}})['then'](handleEntityNotFound(_0x2496ce,null))[_0xd10d('0x21')](function(_0x401191){if(_0x401191){return _0x401191[_0xd10d('0x96')](_0x31f8d0['query'][_0xd10d('0x84')])[_0xd10d('0x21')](function(){if(_['isArray'](_0x31f8d0[_0xd10d('0x3f')]['ids'])){for(var _0x48b44f=0x0;_0x48b44f<_0x31f8d0[_0xd10d('0x3f')][_0xd10d('0x84')][_0xd10d('0x44')];_0x48b44f+=0x1){socket[_0xd10d('0x82')](_0xd10d('0x97'),{'UserId':Number(_0x31f8d0[_0xd10d('0x3f')][_0xd10d('0x84')][_0x48b44f]),'ChatQueueId':Number(_0x31f8d0[_0xd10d('0x59')]['id'])});}}else{socket['emit'](_0xd10d('0x97'),{'UserId':Number(_0x31f8d0['query'][_0xd10d('0x84')]),'ChatQueueId':Number(_0x31f8d0[_0xd10d('0x59')]['id'])});}});}})[_0xd10d('0x21')](respondWithStatusCode(_0x2496ce,null))['catch'](handleError(_0x2496ce,null));};exports['getAgents']=function(_0x1c8188,_0x718dd6,_0x559f45){var _0x5806d2={};var _0x2d9042={};var _0x4eed82;var _0x531b5a;return db[_0xd10d('0x52')][_0xd10d('0x68')]({'where':{'id':_0x1c8188[_0xd10d('0x59')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x718dd6,null))[_0xd10d('0x21')](function(_0x4f335a){if(_0x4f335a){_0x4eed82=_0x4f335a;_0x2d9042[_0xd10d('0x40')]=_[_0xd10d('0x3e')](db[_0xd10d('0x6b')][_0xd10d('0x5a')]);_0x2d9042['query']=_['keys'](_0x1c8188[_0xd10d('0x3f')]);_0x2d9042['filters']=_[_0xd10d('0x42')](_0x2d9042['model'],_0x2d9042['query']);_0x5806d2[_0xd10d('0x41')]=_[_0xd10d('0x42')](_0x2d9042['model'],qs['fields'](_0x1c8188[_0xd10d('0x3f')]['fields']));_0x5806d2[_0xd10d('0x41')]=_0x5806d2[_0xd10d('0x41')]['length']?_0x5806d2[_0xd10d('0x41')]:_0x2d9042['model'];_0x5806d2[_0xd10d('0x76')]=qs[_0xd10d('0x47')](_0x1c8188['query']['sort']);_0x5806d2[_0xd10d('0x48')]=qs[_0xd10d('0x4a')](_[_0xd10d('0x49')](_0x1c8188[_0xd10d('0x3f')],_0x2d9042[_0xd10d('0x4a')]));if(_0x1c8188[_0xd10d('0x3f')][_0xd10d('0x50')]){_0x5806d2[_0xd10d('0x48')]=_[_0xd10d('0x51')](_0x5806d2[_0xd10d('0x48')],{'$or':_[_0xd10d('0x4b')](_0x5806d2['attributes'],function(_0x4e015d){var _0x1d648a={};_0x1d648a[_0x4e015d]={'$like':'%'+_0x1c8188['query']['filter']+'%'};return _0x1d648a;})});}_0x5806d2=_['merge']({},_0x5806d2,_0x1c8188[_0xd10d('0x5b')]);return _0x4eed82['getAgents'](_0x5806d2);}})[_0xd10d('0x21')](function(_0x39b03c){if(_0x39b03c){_0x531b5a=_0x39b03c[_0xd10d('0x44')];if(!_0x1c8188[_0xd10d('0x3f')][_0xd10d('0x45')]('nolimit')){_0x5806d2[_0xd10d('0x46')]=qs[_0xd10d('0x46')](_0x1c8188[_0xd10d('0x3f')][_0xd10d('0x46')]);_0x5806d2[_0xd10d('0x2f')]=qs['offset'](_0x1c8188[_0xd10d('0x3f')][_0xd10d('0x2f')]);}return _0x4eed82['getAgents'](_0x5806d2);}})['then'](function(_0x358937){if(_0x358937){return _0x358937?{'count':_0x531b5a,'rows':_0x358937}:null;}})[_0xd10d('0x21')](respondWithResult(_0x718dd6,null))[_0xd10d('0x2b')](handleError(_0x718dd6,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1096206..592742e 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 _0x2f68=['../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','exports'];(function(_0x3224aa,_0x2d9d90){var _0x432285=function(_0x2206f3){while(--_0x2206f3){_0x3224aa['push'](_0x3224aa['shift']());}};_0x432285(++_0x2d9d90);}(_0x2f68,0x9a));var _0x82f6=function(_0x48f641,_0x1b41b2){_0x48f641=_0x48f641-0x0;var _0x1173d4=_0x2f68[_0x48f641];return _0x1173d4;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x82f6('0x0'))['db'][_0x82f6('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x82f6('0x2')](0x0);var events={'afterCreate':_0x82f6('0x3'),'afterUpdate':'update','afterDestroy':_0x82f6('0x4')};function emitEvent(_0x488d61){return function(_0x2a06dc,_0x2ab73d,_0x5dad09){ChatQueueEvents[_0x82f6('0x5')](_0x488d61+':'+_0x2a06dc['id'],_0x2a06dc);ChatQueueEvents[_0x82f6('0x5')](_0x488d61,_0x2a06dc);_0x5dad09(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x82f6('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0xd547=['hook','ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0xd547,0x1c1));var _0x7d54=function(_0x3df1e9,_0x3cd30e){_0x3df1e9=_0x3df1e9-0x0;var _0xd6b371=_0xd547[_0x3df1e9];return _0xd6b371;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x7d54('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7d54('0x1')](0x0);var events={'afterCreate':_0x7d54('0x2'),'afterUpdate':_0x7d54('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab00b){return function(_0x21c23f,_0x5d21c1,_0x22ea09){ChatQueueEvents['emit'](_0x4ab00b+':'+_0x21c23f['id'],_0x21c23f);ChatQueueEvents[_0x7d54('0x4')](_0x4ab00b,_0x21c23f);_0x22ea09(null);};}for(var e in events){if(events[_0x7d54('0x5')](e)){var event=events[e];ChatQueue[_0x7d54('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index db65f8a..1d53cdf 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 _0x30fc=['./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x48f440,_0x205b56){var _0xcc60f=function(_0x320c20){while(--_0x320c20){_0x48f440['push'](_0x48f440['shift']());}};_0xcc60f(++_0x205b56);}(_0x30fc,0x64));var _0xc30f=function(_0x5f0b3f,_0xe874c4){_0x5f0b3f=_0x5f0b3f-0x0;var _0x176bd0=_0x30fc[_0x5f0b3f];return _0x176bd0;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var logger=require('../../config/logger')(_0xc30f('0x2'));var moment=require(_0xc30f('0x3'));var BPromise=require(_0xc30f('0x4'));var rp=require(_0xc30f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var attributes=require(_0xc30f('0x8'));module[_0xc30f('0x9')]=function(_0x2948cb,_0x293391){return _0x2948cb['define'](_0xc30f('0xa'),attributes,{'tableName':_0xc30f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33d2=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x444ca7,_0x34ce00){var _0x24a6ae=function(_0x67b5d6){while(--_0x67b5d6){_0x444ca7['push'](_0x444ca7['shift']());}};_0x24a6ae(++_0x34ce00);}(_0x33d2,0x7f));var _0x233d=function(_0x3e9b06,_0x417393){_0x3e9b06=_0x3e9b06-0x0;var _0x442af8=_0x33d2[_0x3e9b06];return _0x442af8;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var logger=require(_0x233d('0x2'))('api');var moment=require(_0x233d('0x3'));var BPromise=require(_0x233d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x233d('0x5'));var rimraf=require(_0x233d('0x6'));var config=require(_0x233d('0x7'));var attributes=require(_0x233d('0x8'));module[_0x233d('0x9')]=function(_0x3f311b,_0x15ba43){return _0x3f311b[_0x233d('0xa')]('ChatQueue',attributes,{'tableName':_0x233d('0xb'),'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 388ae3f..86393b2 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 _0x33bc=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','debug','ShowChatQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x33bc,0x1b2));var _0xc33b=function(_0x328cab,_0x3a44ac){_0x328cab=_0x328cab-0x0;var _0x3d3fe5=_0x33bc[_0x328cab];return _0x3d3fe5;};'use strict';var _=require(_0xc33b('0x0'));var util=require('util');var moment=require(_0xc33b('0x1'));var BPromise=require(_0xc33b('0x2'));var rs=require(_0xc33b('0x3'));var fs=require('fs');var Redis=require(_0xc33b('0x4'));var db=require(_0xc33b('0x5'))['db'];var utils=require(_0xc33b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc33b('0x7'));var jayson=require(_0xc33b('0x8'));var client=jayson[_0xc33b('0x9')][_0xc33b('0xa')]({'port':0x232a});config[_0xc33b('0xb')]=_[_0xc33b('0xc')](config['redis'],{'host':_0xc33b('0xd'),'port':0x18eb});var socket=require(_0xc33b('0xe'))(new Redis(config[_0xc33b('0xb')]));require('./chatQueue.socket')[_0xc33b('0xf')](socket);function respondWithRpcPromise(_0x34b5cd,_0x161e99,_0x3882a1){return new BPromise(function(_0x21e7bc,_0x569ef7){return client['request'](_0x34b5cd,_0x3882a1)[_0xc33b('0x10')](function(_0x487b06){logger['info'](_0xc33b('0x11'),_0x161e99,_0xc33b('0x12'));logger['debug'](_0xc33b('0x13'),_0x161e99,'request\x20sent',JSON[_0xc33b('0x14')](_0x487b06));if(_0x487b06[_0xc33b('0x15')]){if(_0x487b06[_0xc33b('0x15')]['code']===0x1f4){logger['error'](_0xc33b('0x11'),_0x161e99,_0x487b06[_0xc33b('0x15')][_0xc33b('0x16')]);return _0x569ef7(_0x487b06[_0xc33b('0x15')][_0xc33b('0x16')]);}logger[_0xc33b('0x15')](_0xc33b('0x11'),_0x161e99,_0x487b06[_0xc33b('0x15')][_0xc33b('0x16')]);return _0x21e7bc(_0x487b06[_0xc33b('0x15')][_0xc33b('0x16')]);}else{logger[_0xc33b('0x17')]('ChatQueue,\x20%s,\x20%s',_0x161e99,'request\x20sent');_0x21e7bc(_0x487b06[_0xc33b('0x18')][_0xc33b('0x16')]);}})[_0xc33b('0x19')](function(_0x2907a4){logger[_0xc33b('0x15')](_0xc33b('0x11'),_0x161e99,_0x2907a4);_0x569ef7(_0x2907a4);});});}exports[_0xc33b('0x1a')]=function(_0x1ca777){var _0x362d4a=this;return new Promise(function(_0x3ed78f,_0x368fd6){return db[_0xc33b('0x1b')][_0xc33b('0x1c')]({'raw':_0x1ca777[_0xc33b('0x1d')]?_0x1ca777[_0xc33b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ca777[_0xc33b('0x1d')]?_0x1ca777['options'][_0xc33b('0x1e')]||null:null,'attributes':_0x1ca777[_0xc33b('0x1d')]?_0x1ca777[_0xc33b('0x1d')][_0xc33b('0x1f')]||null:null,'limit':_0x1ca777[_0xc33b('0x1d')]?_0x1ca777[_0xc33b('0x1d')][_0xc33b('0x20')]||null:null,'include':_0x1ca777[_0xc33b('0x1d')]?_0x1ca777[_0xc33b('0x1d')][_0xc33b('0x21')]?_[_0xc33b('0x22')](_0x1ca777[_0xc33b('0x1d')][_0xc33b('0x21')],function(_0x5c7c3d){return{'model':db[_0x5c7c3d['model']],'as':_0x5c7c3d['as'],'attributes':_0x5c7c3d[_0xc33b('0x1f')],'include':_0x5c7c3d[_0xc33b('0x21')]?_['map'](_0x5c7c3d[_0xc33b('0x21')],function(_0x399a74){return{'model':db[_0x399a74['model']],'as':_0x399a74['as'],'attributes':_0x399a74['attributes'],'include':_0x399a74[_0xc33b('0x21')]?_[_0xc33b('0x22')](_0x399a74['include'],function(_0x5582ec){return{'model':db[_0x5582ec[_0xc33b('0x23')]],'as':_0x5582ec['as'],'attributes':_0x5582ec[_0xc33b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc33b('0x10')](function(_0x7dbd03){logger[_0xc33b('0x17')](_0xc33b('0x1a'),_0x1ca777);logger[_0xc33b('0x24')](_0xc33b('0x1a'),_0x1ca777,JSON[_0xc33b('0x14')](_0x7dbd03));_0x3ed78f(_0x7dbd03);})[_0xc33b('0x19')](function(_0x1154d5){logger[_0xc33b('0x15')](_0xc33b('0x1a'),_0x1154d5[_0xc33b('0x16')],_0x1ca777);_0x368fd6(_0x362d4a[_0xc33b('0x15')](0x1f4,_0x1154d5[_0xc33b('0x16')]));});});};exports[_0xc33b('0x25')]=function(_0x592855){var _0x43babf=this;return new Promise(function(_0x4447d2,_0x10c9c5){return db[_0xc33b('0x1b')][_0xc33b('0x26')]({'raw':_0x592855[_0xc33b('0x1d')]?_0x592855['options'][_0xc33b('0x27')]===undefined?!![]:![]:!![],'where':_0x592855[_0xc33b('0x1d')]?_0x592855[_0xc33b('0x1d')][_0xc33b('0x1e')]||null:null,'attributes':_0x592855[_0xc33b('0x1d')]?_0x592855['options']['attributes']||null:null,'include':_0x592855['options']?_0x592855[_0xc33b('0x1d')][_0xc33b('0x21')]?_[_0xc33b('0x22')](_0x592855[_0xc33b('0x1d')]['include'],function(_0xb9c6be){return{'model':db[_0xb9c6be['model']],'as':_0xb9c6be['as'],'attributes':_0xb9c6be[_0xc33b('0x1f')],'include':_0xb9c6be['include']?_['map'](_0xb9c6be[_0xc33b('0x21')],function(_0x449cb4){return{'model':db[_0x449cb4[_0xc33b('0x23')]],'as':_0x449cb4['as'],'attributes':_0x449cb4['attributes'],'include':_0x449cb4[_0xc33b('0x21')]?_[_0xc33b('0x22')](_0x449cb4[_0xc33b('0x21')],function(_0x506ddc){return{'model':db[_0x506ddc['model']],'as':_0x506ddc['as'],'attributes':_0x506ddc[_0xc33b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc33b('0x10')](function(_0xc8eb46){logger[_0xc33b('0x17')]('ShowChatQueue',_0x592855);logger[_0xc33b('0x24')](_0xc33b('0x25'),_0x592855,JSON[_0xc33b('0x14')](_0xc8eb46));_0x4447d2(_0xc8eb46);})[_0xc33b('0x19')](function(_0x361507){logger['error'](_0xc33b('0x25'),_0x361507['message'],_0x592855);_0x10c9c5(_0x43babf[_0xc33b('0x15')](0x1f4,_0x361507[_0xc33b('0x16')]));});});}; \ No newline at end of file +var _0xda78=['request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','ChatQueue','findAll','raw','options','where','attributes','limit','map','include','model','then','GetChatQueue','ShowChatQueue','find','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatQueue.socket','register'];(function(_0x23a48b,_0x5a0d95){var _0x500de4=function(_0x292961){while(--_0x292961){_0x23a48b['push'](_0x23a48b['shift']());}};_0x500de4(++_0x5a0d95);}(_0xda78,0x178));var _0x8da7=function(_0x2836ef,_0x27d12d){_0x2836ef=_0x2836ef-0x0;var _0x40b686=_0xda78[_0x2836ef];return _0x40b686;};'use strict';var _=require(_0x8da7('0x0'));var util=require('util');var moment=require(_0x8da7('0x1'));var BPromise=require('bluebird');var rs=require(_0x8da7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8da7('0x3'));var logger=require(_0x8da7('0x4'))(_0x8da7('0x5'));var config=require(_0x8da7('0x6'));var jayson=require(_0x8da7('0x7'));var client=jayson[_0x8da7('0x8')][_0x8da7('0x9')]({'port':0x232a});config[_0x8da7('0xa')]=_[_0x8da7('0xb')](config[_0x8da7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8da7('0xc'))[_0x8da7('0xd')](socket);function respondWithRpcPromise(_0x11aad6,_0x2d37a7,_0x212df5){return new BPromise(function(_0x5b2126,_0x2899c4){return client[_0x8da7('0xe')](_0x11aad6,_0x212df5)['then'](function(_0x5e1a1b){logger[_0x8da7('0xf')]('ChatQueue,\x20%s,\x20%s',_0x2d37a7,_0x8da7('0x10'));logger[_0x8da7('0x11')](_0x8da7('0x12'),_0x2d37a7,_0x8da7('0x10'),JSON[_0x8da7('0x13')](_0x5e1a1b));if(_0x5e1a1b['error']){if(_0x5e1a1b[_0x8da7('0x14')][_0x8da7('0x15')]===0x1f4){logger['error'](_0x8da7('0x16'),_0x2d37a7,_0x5e1a1b['error'][_0x8da7('0x17')]);return _0x2899c4(_0x5e1a1b[_0x8da7('0x14')][_0x8da7('0x17')]);}logger[_0x8da7('0x14')]('ChatQueue,\x20%s,\x20%s',_0x2d37a7,_0x5e1a1b['error']['message']);return _0x5b2126(_0x5e1a1b[_0x8da7('0x14')][_0x8da7('0x17')]);}else{logger['info'](_0x8da7('0x16'),_0x2d37a7,_0x8da7('0x10'));_0x5b2126(_0x5e1a1b['result'][_0x8da7('0x17')]);}})[_0x8da7('0x18')](function(_0x2505d1){logger['error'](_0x8da7('0x16'),_0x2d37a7,_0x2505d1);_0x2899c4(_0x2505d1);});});}exports['GetChatQueue']=function(_0x1591a6){var _0x125bb9=this;return new Promise(function(_0x24e788,_0x1ed906){return db[_0x8da7('0x19')][_0x8da7('0x1a')]({'raw':_0x1591a6['options']?_0x1591a6['options'][_0x8da7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1591a6[_0x8da7('0x1c')]?_0x1591a6[_0x8da7('0x1c')][_0x8da7('0x1d')]||null:null,'attributes':_0x1591a6['options']?_0x1591a6[_0x8da7('0x1c')][_0x8da7('0x1e')]||null:null,'limit':_0x1591a6['options']?_0x1591a6['options'][_0x8da7('0x1f')]||null:null,'include':_0x1591a6['options']?_0x1591a6[_0x8da7('0x1c')]['include']?_[_0x8da7('0x20')](_0x1591a6[_0x8da7('0x1c')][_0x8da7('0x21')],function(_0x249864){return{'model':db[_0x249864[_0x8da7('0x22')]],'as':_0x249864['as'],'attributes':_0x249864[_0x8da7('0x1e')],'include':_0x249864[_0x8da7('0x21')]?_[_0x8da7('0x20')](_0x249864['include'],function(_0x3b9467){return{'model':db[_0x3b9467['model']],'as':_0x3b9467['as'],'attributes':_0x3b9467['attributes'],'include':_0x3b9467[_0x8da7('0x21')]?_[_0x8da7('0x20')](_0x3b9467[_0x8da7('0x21')],function(_0x290d99){return{'model':db[_0x290d99[_0x8da7('0x22')]],'as':_0x290d99['as'],'attributes':_0x290d99[_0x8da7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8da7('0x23')](function(_0x480a4d){logger[_0x8da7('0xf')](_0x8da7('0x24'),_0x1591a6);logger[_0x8da7('0x11')]('GetChatQueue',_0x1591a6,JSON[_0x8da7('0x13')](_0x480a4d));_0x24e788(_0x480a4d);})['catch'](function(_0x11c259){logger[_0x8da7('0x14')](_0x8da7('0x24'),_0x11c259['message'],_0x1591a6);_0x1ed906(_0x125bb9[_0x8da7('0x14')](0x1f4,_0x11c259[_0x8da7('0x17')]));});});};exports[_0x8da7('0x25')]=function(_0x1101a9){var _0x5463ab=this;return new Promise(function(_0x1e2bd1,_0x428668){return db['ChatQueue'][_0x8da7('0x26')]({'raw':_0x1101a9['options']?_0x1101a9[_0x8da7('0x1c')][_0x8da7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1101a9[_0x8da7('0x1c')]?_0x1101a9['options'][_0x8da7('0x1d')]||null:null,'attributes':_0x1101a9[_0x8da7('0x1c')]?_0x1101a9[_0x8da7('0x1c')][_0x8da7('0x1e')]||null:null,'include':_0x1101a9[_0x8da7('0x1c')]?_0x1101a9[_0x8da7('0x1c')]['include']?_['map'](_0x1101a9[_0x8da7('0x1c')][_0x8da7('0x21')],function(_0x51a58c){return{'model':db[_0x51a58c[_0x8da7('0x22')]],'as':_0x51a58c['as'],'attributes':_0x51a58c[_0x8da7('0x1e')],'include':_0x51a58c[_0x8da7('0x21')]?_[_0x8da7('0x20')](_0x51a58c['include'],function(_0x13bbae){return{'model':db[_0x13bbae[_0x8da7('0x22')]],'as':_0x13bbae['as'],'attributes':_0x13bbae[_0x8da7('0x1e')],'include':_0x13bbae[_0x8da7('0x21')]?_[_0x8da7('0x20')](_0x13bbae[_0x8da7('0x21')],function(_0x2eacb1){return{'model':db[_0x2eacb1[_0x8da7('0x22')]],'as':_0x2eacb1['as'],'attributes':_0x2eacb1[_0x8da7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8da7('0x23')](function(_0x24ca64){logger[_0x8da7('0xf')](_0x8da7('0x25'),_0x1101a9);logger[_0x8da7('0x11')]('ShowChatQueue',_0x1101a9,JSON[_0x8da7('0x13')](_0x24ca64));_0x1e2bd1(_0x24ca64);})[_0x8da7('0x18')](function(_0x54871d){logger['error'](_0x8da7('0x25'),_0x54871d[_0x8da7('0x17')],_0x1101a9);_0x428668(_0x5463ab[_0x8da7('0x14')](0x1f4,_0x54871d[_0x8da7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b3530c0..420794c 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 _0xa9e0=['register','length','chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','chatQueue:','./chatQueue.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(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index b3bd611..a572701 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 _0x5eb9=['exports','multer','util','express','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x4027b1,_0xe62949){var _0x239375=function(_0x52e8ce){while(--_0x52e8ce){_0x4027b1['push'](_0x4027b1['shift']());}};_0x239375(++_0xe62949);}(_0x5eb9,0x119));var _0x95eb=function(_0x5db59c,_0x11cc79){_0x5db59c=_0x5db59c-0x0;var _0x2a1f41=_0x5eb9[_0x5db59c];return _0x2a1f41;};'use strict';var multer=require(_0x95eb('0x0'));var util=require(_0x95eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x95eb('0x2'));var router=express['Router']();var auth=require(_0x95eb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x95eb('0x4'));var controller=require(_0x95eb('0x5'));router[_0x95eb('0x6')]('/',auth[_0x95eb('0x7')](),controller['index']);router[_0x95eb('0x6')](_0x95eb('0x8'),auth[_0x95eb('0x7')](),controller[_0x95eb('0x9')]);router['get'](_0x95eb('0xa'),auth[_0x95eb('0x7')](),controller[_0x95eb('0xb')]);router['get'](_0x95eb('0xc'),auth[_0x95eb('0x7')](),controller[_0x95eb('0xd')]);router[_0x95eb('0x6')](_0x95eb('0xe'),auth[_0x95eb('0x7')](),controller[_0x95eb('0xf')]);router['get']('/:id/users',auth[_0x95eb('0x7')](),controller[_0x95eb('0x10')]);router[_0x95eb('0x11')]('/',auth[_0x95eb('0x7')](),controller[_0x95eb('0x12')]);router[_0x95eb('0x11')]('/:id/teams',auth[_0x95eb('0x7')](),controller[_0x95eb('0x13')]);router['post'](_0x95eb('0x14'),auth[_0x95eb('0x7')](),controller[_0x95eb('0x15')]);router['put']('/:id',auth[_0x95eb('0x7')](),controller[_0x95eb('0x16')]);router[_0x95eb('0x17')](_0x95eb('0xa'),auth[_0x95eb('0x7')](),controller[_0x95eb('0x18')]);router['delete'](_0x95eb('0xe'),auth[_0x95eb('0x7')](),controller[_0x95eb('0x19')]);router[_0x95eb('0x17')](_0x95eb('0x14'),auth[_0x95eb('0x7')](),controller[_0x95eb('0x1a')]);module[_0x95eb('0x1b')]=router; \ No newline at end of file +var _0xf6e5=['getTeams','/:id/users','getAgents','post','addTeams','update','delete','removeTeams','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','getMembers','/:id/teams'];(function(_0x4aefc9,_0x27bfdc){var _0x1537a4=function(_0x3836a6){while(--_0x3836a6){_0x4aefc9['push'](_0x4aefc9['shift']());}};_0x1537a4(++_0x27bfdc);}(_0xf6e5,0xaa));var _0x5f6e=function(_0x373edb,_0x5a0d92){_0x373edb=_0x373edb-0x0;var _0x140151=_0xf6e5[_0x373edb];return _0x140151;};'use strict';var multer=require(_0x5f6e('0x0'));var util=require(_0x5f6e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5f6e('0x2'));var router=express[_0x5f6e('0x3')]();var auth=require(_0x5f6e('0x4'));var interaction=require(_0x5f6e('0x5'));var config=require(_0x5f6e('0x6'));var controller=require('./chatQueue.controller');router[_0x5f6e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5f6e('0x8'),auth[_0x5f6e('0x9')](),controller[_0x5f6e('0xa')]);router[_0x5f6e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5f6e('0xb')]);router[_0x5f6e('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x5f6e('0xc')]);router['get'](_0x5f6e('0xd'),auth[_0x5f6e('0x9')](),controller[_0x5f6e('0xe')]);router[_0x5f6e('0x7')](_0x5f6e('0xf'),auth[_0x5f6e('0x9')](),controller[_0x5f6e('0x10')]);router[_0x5f6e('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f6e('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5f6e('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x5f6e('0x9')](),controller[_0x5f6e('0x13')]);router[_0x5f6e('0x14')]('/:id',auth[_0x5f6e('0x9')](),controller['destroy']);router[_0x5f6e('0x14')](_0x5f6e('0xd'),auth[_0x5f6e('0x9')](),controller[_0x5f6e('0x15')]);router[_0x5f6e('0x14')](_0x5f6e('0xf'),auth[_0x5f6e('0x9')](),controller['removeAgents']);module[_0x5f6e('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a23c95e..b6a436b 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 _0x52da=['moment','sequelize','exports','STRING','DATE'];(function(_0x4c8ba4,_0x10e0cf){var _0x1b8264=function(_0x16d331){while(--_0x16d331){_0x4c8ba4['push'](_0x4c8ba4['shift']());}};_0x1b8264(++_0x10e0cf);}(_0x52da,0xdc));var _0xa52d=function(_0x2ad52e,_0x954699){_0x2ad52e=_0x2ad52e-0x0;var _0x3fa370=_0x52da[_0x2ad52e];return _0x3fa370;};'use strict';var moment=require(_0xa52d('0x0'));var Sequelize=require(_0xa52d('0x1'));module[_0xa52d('0x2')]={'uniqueid':{'type':Sequelize[_0xa52d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa52d('0x3')]},'joinAt':{'type':Sequelize[_0xa52d('0x4')]},'leaveAt':{'type':Sequelize[_0xa52d('0x4')]},'acceptAt':{'type':Sequelize[_0xa52d('0x4')]},'exitAt':{'type':Sequelize[_0xa52d('0x4')]},'reason':{'type':Sequelize[_0xa52d('0x3')]}}; \ No newline at end of file +var _0xebfa=['DATE','moment','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebfa,0x1c9));var _0xaebf=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xebfa[_0x125ff8];return _0x2d9ef;};'use strict';var moment=require(_0xaebf('0x0'));var Sequelize=require('sequelize');module[_0xaebf('0x1')]={'uniqueid':{'type':Sequelize[_0xaebf('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xaebf('0x3')]},'leaveAt':{'type':Sequelize[_0xaebf('0x3')]},'acceptAt':{'type':Sequelize[_0xaebf('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7aff78b..2bd2726 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 _0x6f4f=['keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','show','params','rawAttributes','find','catch','create','update','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','ChatQueueReport','model','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f4f,0xaa));var _0xf6f4=function(_0xe3eff,_0x10c920){_0xe3eff=_0xe3eff-0x0;var _0x3202f9=_0x6f4f[_0xe3eff];return _0x3202f9;};'use strict';var pdf=require(_0xf6f4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf6f4('0x1'));var zipdir=require(_0xf6f4('0x2'));var jsonpatch=require(_0xf6f4('0x3'));var rp=require(_0xf6f4('0x4'));var moment=require('moment');var BPromise=require(_0xf6f4('0x5'));var Mustache=require(_0xf6f4('0x6'));var util=require(_0xf6f4('0x7'));var path=require(_0xf6f4('0x8'));var sox=require(_0xf6f4('0x9'));var csv=require(_0xf6f4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf6f4('0xb'));var crypto=require(_0xf6f4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6f4('0xa'));var querystring=require(_0xf6f4('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6f4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf6f4('0xf'));var logger=require(_0xf6f4('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xf6f4('0x11'));var db=require(_0xf6f4('0x12'))['db'];function respondWithStatusCode(_0x36ab83,_0x50ff13){_0x50ff13=_0x50ff13||0xcc;return function(_0x2937d0){if(_0x2937d0){return _0x36ab83['sendStatus'](_0x50ff13);}return _0x36ab83['status'](_0x50ff13)[_0xf6f4('0x13')]();};}function respondWithResult(_0x4cd0ee,_0x5068af){_0x5068af=_0x5068af||0xc8;return function(_0xb44279){if(_0xb44279){return _0x4cd0ee[_0xf6f4('0x14')](_0x5068af)[_0xf6f4('0x15')](_0xb44279);}};}function respondWithFilteredResult(_0x49a518,_0x37ce2f){return function(_0x22343a){if(_0x22343a){var _0x438a9c=_0x22343a['count'],_0x4b02fa=_0x37ce2f[_0xf6f4('0x16')],_0x8a3290=_0x37ce2f[_0xf6f4('0x16')]+_0x37ce2f['limit'],_0x1464a6;if(_0x8a3290>=_0x438a9c){_0x8a3290=_0x438a9c;_0x1464a6=0xc8;}else{_0x1464a6=0xce;}_0x49a518['status'](_0x1464a6);return _0x49a518['set'](_0xf6f4('0x17'),_0x4b02fa+'-'+_0x8a3290+'/'+_0x438a9c)[_0xf6f4('0x15')](_0x22343a);}return null;};}function patchUpdates(_0x3161ca){return function(_0x4e9a82){try{jsonpatch[_0xf6f4('0x18')](_0x4e9a82,_0x3161ca,!![]);}catch(_0x269697){return BPromise['reject'](_0x269697);}return _0x4e9a82[_0xf6f4('0x19')]();};}function saveUpdates(_0xf954d9,_0x34d219){return function(_0x461888){if(_0x461888){return _0x461888['update'](_0xf954d9)[_0xf6f4('0x1a')](function(_0x5993ed){return _0x5993ed;});}return null;};}function removeEntity(_0x29ed93,_0x51b54a){return function(_0x46475b){if(_0x46475b){return _0x46475b[_0xf6f4('0x1b')]()[_0xf6f4('0x1a')](function(){_0x29ed93[_0xf6f4('0x14')](0xcc)[_0xf6f4('0x13')]();});}};}function handleEntityNotFound(_0x78f0e3,_0xb7c540){return function(_0x4ddeab){if(!_0x4ddeab){_0x78f0e3[_0xf6f4('0x1c')](0x194);}return _0x4ddeab;};}function handleError(_0x351b7a,_0x362842){_0x362842=_0x362842||0x1f4;return function(_0xe4d0f3){logger[_0xf6f4('0x1d')](_0xe4d0f3[_0xf6f4('0x1e')]);if(_0xe4d0f3[_0xf6f4('0x1f')]){delete _0xe4d0f3['name'];}_0x351b7a[_0xf6f4('0x14')](_0x362842)[_0xf6f4('0x20')](_0xe4d0f3);};}exports[_0xf6f4('0x21')]=function(_0x5a2076,_0x58f571){var _0x32ebf3={},_0x3b4dae={},_0x3669dd={'count':0x0,'rows':[]};var _0x52f10e=db[_0xf6f4('0x22')]['rawAttributes'];_0x3b4dae[_0xf6f4('0x23')]=_['keys'](_0x52f10e);_0x3b4dae[_0xf6f4('0x24')]=_[_0xf6f4('0x25')](_0x5a2076[_0xf6f4('0x24')]);_0x3b4dae['filters']=_[_0xf6f4('0x26')](_0x3b4dae[_0xf6f4('0x23')],_0x3b4dae['query']);_0x32ebf3['attributes']=_['intersection'](_0x3b4dae[_0xf6f4('0x23')],qs[_0xf6f4('0x27')](_0x5a2076[_0xf6f4('0x24')][_0xf6f4('0x27')]));_0x32ebf3[_0xf6f4('0x28')]=_0x32ebf3[_0xf6f4('0x28')][_0xf6f4('0x29')]?_0x32ebf3[_0xf6f4('0x28')]:_0x3b4dae[_0xf6f4('0x23')];if(!_0x5a2076[_0xf6f4('0x24')]['hasOwnProperty'](_0xf6f4('0x2a'))){_0x32ebf3['limit']=qs[_0xf6f4('0x2b')](_0x5a2076[_0xf6f4('0x24')][_0xf6f4('0x2b')]);_0x32ebf3['offset']=qs[_0xf6f4('0x16')](_0x5a2076['query'][_0xf6f4('0x16')]);}_0x32ebf3[_0xf6f4('0x2c')]=qs['sort'](_0x5a2076['query'][_0xf6f4('0x2d')]);_0x32ebf3[_0xf6f4('0x2e')]=qs[_0xf6f4('0x2f')](_[_0xf6f4('0x30')](_0x5a2076[_0xf6f4('0x24')],_0x3b4dae[_0xf6f4('0x2f')]));if(_0x5a2076[_0xf6f4('0x24')][_0xf6f4('0x31')]){_0x32ebf3[_0xf6f4('0x2e')]=_[_0xf6f4('0x32')](_0x32ebf3[_0xf6f4('0x2e')],{'$or':_[_0xf6f4('0x33')](_0x52f10e,function(_0x392b1f){if(_0x392b1f[_0xf6f4('0x34')][_0xf6f4('0x35')]!==_0xf6f4('0x36')){var _0x1eddac={};_0x1eddac[_0x392b1f[_0xf6f4('0x37')]]={'$like':'%'+_0x5a2076[_0xf6f4('0x24')]['filter']+'%'};return _0x1eddac;}})});}_0x32ebf3=_[_0xf6f4('0x32')]({},_0x32ebf3,_0x5a2076[_0xf6f4('0x38')]);var _0x21dd2f={'where':_0x32ebf3[_0xf6f4('0x2e')]};return db[_0xf6f4('0x22')][_0xf6f4('0x39')](_0x21dd2f)['then'](function(_0x5d61e5){_0x3669dd[_0xf6f4('0x39')]=_0x5d61e5;if(_0x5a2076[_0xf6f4('0x24')][_0xf6f4('0x3a')]){_0x32ebf3[_0xf6f4('0x3b')]=[{'all':!![]}];}return db[_0xf6f4('0x22')]['findAll'](_0x32ebf3);})[_0xf6f4('0x1a')](function(_0x5c2296){_0x3669dd['rows']=_0x5c2296;return _0x3669dd;})['then'](respondWithFilteredResult(_0x58f571,_0x32ebf3))['catch'](handleError(_0x58f571,null));};exports[_0xf6f4('0x3c')]=function(_0x1c522b,_0x54549b){var _0x49b171={'raw':!![],'where':{'id':_0x1c522b[_0xf6f4('0x3d')]['id']}},_0x4cdf66={};_0x4cdf66[_0xf6f4('0x23')]=_[_0xf6f4('0x25')](db[_0xf6f4('0x22')][_0xf6f4('0x3e')]);_0x4cdf66[_0xf6f4('0x24')]=_[_0xf6f4('0x25')](_0x1c522b[_0xf6f4('0x24')]);_0x4cdf66[_0xf6f4('0x2f')]=_[_0xf6f4('0x26')](_0x4cdf66[_0xf6f4('0x23')],_0x4cdf66[_0xf6f4('0x24')]);_0x49b171[_0xf6f4('0x28')]=_[_0xf6f4('0x26')](_0x4cdf66['model'],qs[_0xf6f4('0x27')](_0x1c522b['query']['fields']));_0x49b171[_0xf6f4('0x28')]=_0x49b171[_0xf6f4('0x28')]['length']?_0x49b171[_0xf6f4('0x28')]:_0x4cdf66[_0xf6f4('0x23')];if(_0x1c522b[_0xf6f4('0x24')][_0xf6f4('0x3a')]){_0x49b171[_0xf6f4('0x3b')]=[{'all':!![]}];}_0x49b171=_[_0xf6f4('0x32')]({},_0x49b171,_0x1c522b[_0xf6f4('0x38')]);return db['ChatQueueReport'][_0xf6f4('0x3f')](_0x49b171)[_0xf6f4('0x1a')](handleEntityNotFound(_0x54549b,null))[_0xf6f4('0x1a')](respondWithResult(_0x54549b,null))[_0xf6f4('0x40')](handleError(_0x54549b,null));};exports['create']=function(_0x79ce42,_0xff5300){return db[_0xf6f4('0x22')][_0xf6f4('0x41')](_0x79ce42['body'],{})[_0xf6f4('0x1a')](respondWithResult(_0xff5300,0xc9))['catch'](handleError(_0xff5300,null));};exports[_0xf6f4('0x42')]=function(_0x5cc3b9,_0x37b8b3){if(_0x5cc3b9[_0xf6f4('0x43')]['id']){delete _0x5cc3b9['body']['id'];}return db[_0xf6f4('0x22')][_0xf6f4('0x3f')]({'where':{'id':_0x5cc3b9[_0xf6f4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x37b8b3,null))['then'](saveUpdates(_0x5cc3b9['body'],null))['then'](respondWithResult(_0x37b8b3,null))[_0xf6f4('0x40')](handleError(_0x37b8b3,null));};exports[_0xf6f4('0x1b')]=function(_0x4e8e31,_0x39c620){return db[_0xf6f4('0x22')][_0xf6f4('0x3f')]({'where':{'id':_0x4e8e31[_0xf6f4('0x3d')]['id']}})[_0xf6f4('0x1a')](handleEntityNotFound(_0x39c620,null))['then'](removeEntity(_0x39c620,null))[_0xf6f4('0x40')](handleError(_0x39c620,null));};exports[_0xf6f4('0x44')]=function(_0x25edc9,_0x57bd50){return db[_0xf6f4('0x22')]['describe']()['then'](respondWithResult(_0x57bd50,null))['catch'](handleError(_0x57bd50,null));}; \ No newline at end of file +var _0x6df6=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','save','update','then','end','stack','name','send','index','ChatQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','key','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','options','create','body','find','destroy','describe','html-pdf','rimraf'];(function(_0x3d855e,_0x16f1d7){var _0x495b16=function(_0x30cbaf){while(--_0x30cbaf){_0x3d855e['push'](_0x3d855e['shift']());}};_0x495b16(++_0x16f1d7);}(_0x6df6,0x16b));var _0x66df=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x6df6[_0x15b399];return _0x199f2d;};'use strict';var pdf=require(_0x66df('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x66df('0x1'));var zipdir=require(_0x66df('0x2'));var jsonpatch=require(_0x66df('0x3'));var rp=require(_0x66df('0x4'));var moment=require(_0x66df('0x5'));var BPromise=require(_0x66df('0x6'));var Mustache=require(_0x66df('0x7'));var util=require(_0x66df('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x66df('0x9'));var ejs=require(_0x66df('0xa'));var fs=require('fs');var _=require(_0x66df('0xb'));var squel=require(_0x66df('0xc'));var crypto=require(_0x66df('0xd'));var jsforce=require(_0x66df('0xe'));var deskjs=require(_0x66df('0xf'));var toCsv=require(_0x66df('0x9'));var querystring=require('querystring');var Papa=require(_0x66df('0x10'));var Redis=require(_0x66df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66df('0x12'));var hardwareService=require(_0x66df('0x13'));var logger=require(_0x66df('0x14'))('api');var utils=require(_0x66df('0x15'));var config=require('../../config/environment');var db=require(_0x66df('0x16'))['db'];function respondWithStatusCode(_0x349f8f,_0x118d52){_0x118d52=_0x118d52||0xcc;return function(_0x6ceecc){if(_0x6ceecc){return _0x349f8f[_0x66df('0x17')](_0x118d52);}return _0x349f8f[_0x66df('0x18')](_0x118d52)['end']();};}function respondWithResult(_0x47509e,_0x266007){_0x266007=_0x266007||0xc8;return function(_0x491037){if(_0x491037){return _0x47509e['status'](_0x266007)['json'](_0x491037);}};}function respondWithFilteredResult(_0x1d2943,_0x5e810b){return function(_0x1f491c){if(_0x1f491c){var _0x5a5bd2=_0x1f491c[_0x66df('0x19')],_0x306423=_0x5e810b['offset'],_0x22e2e9=_0x5e810b[_0x66df('0x1a')]+_0x5e810b[_0x66df('0x1b')],_0x5d5379;if(_0x22e2e9>=_0x5a5bd2){_0x22e2e9=_0x5a5bd2;_0x5d5379=0xc8;}else{_0x5d5379=0xce;}_0x1d2943['status'](_0x5d5379);return _0x1d2943['set'](_0x66df('0x1c'),_0x306423+'-'+_0x22e2e9+'/'+_0x5a5bd2)[_0x66df('0x1d')](_0x1f491c);}return null;};}function patchUpdates(_0x50145f){return function(_0x4253c7){try{jsonpatch[_0x66df('0x1e')](_0x4253c7,_0x50145f,!![]);}catch(_0x235e59){return BPromise['reject'](_0x235e59);}return _0x4253c7[_0x66df('0x1f')]();};}function saveUpdates(_0x3e280f,_0x26525f){return function(_0x170d52){if(_0x170d52){return _0x170d52[_0x66df('0x20')](_0x3e280f)[_0x66df('0x21')](function(_0x11bc3b){return _0x11bc3b;});}return null;};}function removeEntity(_0x58c4b2,_0x2318d7){return function(_0xd4ffea){if(_0xd4ffea){return _0xd4ffea['destroy']()[_0x66df('0x21')](function(){_0x58c4b2['status'](0xcc)[_0x66df('0x22')]();});}};}function handleEntityNotFound(_0x2d7797,_0x8e0ee0){return function(_0x3b6791){if(!_0x3b6791){_0x2d7797['sendStatus'](0x194);}return _0x3b6791;};}function handleError(_0x5f0949,_0x1bd49e){_0x1bd49e=_0x1bd49e||0x1f4;return function(_0x34a027){logger['error'](_0x34a027[_0x66df('0x23')]);if(_0x34a027[_0x66df('0x24')]){delete _0x34a027[_0x66df('0x24')];}_0x5f0949[_0x66df('0x18')](_0x1bd49e)[_0x66df('0x25')](_0x34a027);};}exports[_0x66df('0x26')]=function(_0xfccce3,_0x3ba7d8){var _0x49b36a={},_0x1769f8={},_0x4dada7={'count':0x0,'rows':[]};var _0x2941d9=db[_0x66df('0x27')][_0x66df('0x28')];_0x1769f8[_0x66df('0x29')]=_[_0x66df('0x2a')](_0x2941d9);_0x1769f8[_0x66df('0x2b')]=_[_0x66df('0x2a')](_0xfccce3[_0x66df('0x2b')]);_0x1769f8[_0x66df('0x2c')]=_[_0x66df('0x2d')](_0x1769f8[_0x66df('0x29')],_0x1769f8[_0x66df('0x2b')]);_0x49b36a[_0x66df('0x2e')]=_[_0x66df('0x2d')](_0x1769f8[_0x66df('0x29')],qs[_0x66df('0x2f')](_0xfccce3['query'][_0x66df('0x2f')]));_0x49b36a[_0x66df('0x2e')]=_0x49b36a[_0x66df('0x2e')]['length']?_0x49b36a[_0x66df('0x2e')]:_0x1769f8[_0x66df('0x29')];if(!_0xfccce3[_0x66df('0x2b')][_0x66df('0x30')](_0x66df('0x31'))){_0x49b36a['limit']=qs[_0x66df('0x1b')](_0xfccce3[_0x66df('0x2b')][_0x66df('0x1b')]);_0x49b36a['offset']=qs['offset'](_0xfccce3[_0x66df('0x2b')][_0x66df('0x1a')]);}_0x49b36a[_0x66df('0x32')]=qs[_0x66df('0x33')](_0xfccce3[_0x66df('0x2b')][_0x66df('0x33')]);_0x49b36a['where']=qs['filters'](_[_0x66df('0x34')](_0xfccce3[_0x66df('0x2b')],_0x1769f8['filters']));if(_0xfccce3[_0x66df('0x2b')]['filter']){_0x49b36a[_0x66df('0x35')]=_[_0x66df('0x36')](_0x49b36a[_0x66df('0x35')],{'$or':_[_0x66df('0x37')](_0x2941d9,function(_0x5bf019){if(_0x5bf019['type'][_0x66df('0x38')]!==_0x66df('0x39')){var _0x5d41be={};_0x5d41be[_0x5bf019['field']]={'$like':'%'+_0xfccce3[_0x66df('0x2b')][_0x66df('0x3a')]+'%'};return _0x5d41be;}})});}_0x49b36a=_[_0x66df('0x36')]({},_0x49b36a,_0xfccce3['options']);var _0x1f5727={'where':_0x49b36a[_0x66df('0x35')]};return db['ChatQueueReport'][_0x66df('0x19')](_0x1f5727)['then'](function(_0x430f53){_0x4dada7[_0x66df('0x19')]=_0x430f53;if(_0xfccce3[_0x66df('0x2b')][_0x66df('0x3b')]){_0x49b36a['include']=[{'all':!![]}];}return db[_0x66df('0x27')][_0x66df('0x3c')](_0x49b36a);})[_0x66df('0x21')](function(_0x14b2da){_0x4dada7[_0x66df('0x3d')]=_0x14b2da;return _0x4dada7;})[_0x66df('0x21')](respondWithFilteredResult(_0x3ba7d8,_0x49b36a))[_0x66df('0x3e')](handleError(_0x3ba7d8,null));};exports[_0x66df('0x3f')]=function(_0xed12f4,_0x56c488){var _0x33cc5e={'raw':!![],'where':{'id':_0xed12f4[_0x66df('0x40')]['id']}},_0xab0901={};_0xab0901['model']=_['keys'](db[_0x66df('0x27')][_0x66df('0x28')]);_0xab0901[_0x66df('0x2b')]=_[_0x66df('0x2a')](_0xed12f4[_0x66df('0x2b')]);_0xab0901['filters']=_[_0x66df('0x2d')](_0xab0901[_0x66df('0x29')],_0xab0901[_0x66df('0x2b')]);_0x33cc5e[_0x66df('0x2e')]=_[_0x66df('0x2d')](_0xab0901['model'],qs[_0x66df('0x2f')](_0xed12f4[_0x66df('0x2b')][_0x66df('0x2f')]));_0x33cc5e['attributes']=_0x33cc5e[_0x66df('0x2e')][_0x66df('0x41')]?_0x33cc5e[_0x66df('0x2e')]:_0xab0901[_0x66df('0x29')];if(_0xed12f4['query'][_0x66df('0x3b')]){_0x33cc5e[_0x66df('0x42')]=[{'all':!![]}];}_0x33cc5e=_[_0x66df('0x36')]({},_0x33cc5e,_0xed12f4[_0x66df('0x43')]);return db[_0x66df('0x27')]['find'](_0x33cc5e)[_0x66df('0x21')](handleEntityNotFound(_0x56c488,null))[_0x66df('0x21')](respondWithResult(_0x56c488,null))[_0x66df('0x3e')](handleError(_0x56c488,null));};exports[_0x66df('0x44')]=function(_0x26e1e5,_0x4bf173){return db['ChatQueueReport'][_0x66df('0x44')](_0x26e1e5[_0x66df('0x45')],{})[_0x66df('0x21')](respondWithResult(_0x4bf173,0xc9))[_0x66df('0x3e')](handleError(_0x4bf173,null));};exports[_0x66df('0x20')]=function(_0x10db38,_0x4e1707){if(_0x10db38['body']['id']){delete _0x10db38[_0x66df('0x45')]['id'];}return db[_0x66df('0x27')][_0x66df('0x46')]({'where':{'id':_0x10db38['params']['id']}})[_0x66df('0x21')](handleEntityNotFound(_0x4e1707,null))[_0x66df('0x21')](saveUpdates(_0x10db38[_0x66df('0x45')],null))['then'](respondWithResult(_0x4e1707,null))[_0x66df('0x3e')](handleError(_0x4e1707,null));};exports[_0x66df('0x47')]=function(_0x2ba6c6,_0xb508d){return db[_0x66df('0x27')]['find']({'where':{'id':_0x2ba6c6[_0x66df('0x40')]['id']}})[_0x66df('0x21')](handleEntityNotFound(_0xb508d,null))[_0x66df('0x21')](removeEntity(_0xb508d,null))[_0x66df('0x3e')](handleError(_0xb508d,null));};exports['describe']=function(_0x22cd67,_0x304361){return db[_0x66df('0x27')][_0x66df('0x48')]()[_0x66df('0x21')](respondWithResult(_0x304361,null))[_0x66df('0x3e')](handleError(_0x304361,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a173895..83b3261 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 _0xb391=['path','../../config/environment','./chatQueueReport.attributes','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','api','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb391,0xa6));var _0x1b39=function(_0x460013,_0x2ebc73){_0x460013=_0x460013-0x0;var _0x55924f=_0xb391[_0x460013];return _0x55924f;};'use strict';var _=require(_0x1b39('0x0'));var util=require(_0x1b39('0x1'));var logger=require('../../config/logger')(_0x1b39('0x2'));var moment=require(_0x1b39('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b39('0x4'));var rimraf=require('rimraf');var config=require(_0x1b39('0x5'));var attributes=require(_0x1b39('0x6'));module['exports']=function(_0xc07f52,_0x373128){return _0xc07f52['define'](_0x1b39('0x7'),attributes,{'tableName':_0x1b39('0x8'),'paranoid':![],'indexes':[{'name':_0x1b39('0x9'),'fields':[_0x1b39('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb37e=['../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','api','request-promise','path','rimraf'];(function(_0x3a3434,_0x3d6cd2){var _0x39e96f=function(_0x2f3053){while(--_0x2f3053){_0x3a3434['push'](_0x3a3434['shift']());}};_0x39e96f(++_0x3d6cd2);}(_0xb37e,0x19d));var _0xeb37=function(_0x8eb139,_0x2c9156){_0x8eb139=_0x8eb139-0x0;var _0x5e4bf7=_0xb37e[_0x8eb139];return _0x5e4bf7;};'use strict';var _=require(_0xeb37('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeb37('0x2'));var fs=require('fs');var path=require(_0xeb37('0x3'));var rimraf=require(_0xeb37('0x4'));var config=require(_0xeb37('0x5'));var attributes=require('./chatQueueReport.attributes');module[_0xeb37('0x6')]=function(_0x2b5d31,_0x49e8ae){return _0x2b5d31[_0xeb37('0x7')](_0xeb37('0x8'),attributes,{'tableName':_0xeb37('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeb37('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9edc030..0b450b6 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 _0x6fc4=['ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','then','UpdateChatQueueReport','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fc4,0x7d));var _0x46fc=function(_0x2c5ec9,_0x4d69fe){_0x2c5ec9=_0x2c5ec9-0x0;var _0x460637=_0x6fc4[_0x2c5ec9];return _0x460637;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var moment=require(_0x46fc('0x2'));var BPromise=require(_0x46fc('0x3'));var rs=require(_0x46fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46fc('0x5'))['db'];var utils=require(_0x46fc('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x46fc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4742,_0x1bc5aa,_0x129c43){return new BPromise(function(_0x512046,_0x346232){return client[_0x46fc('0x8')](_0x4d4742,_0x129c43)['then'](function(_0x33080c){logger[_0x46fc('0x9')](_0x46fc('0xa'),_0x1bc5aa,'request\x20sent');logger[_0x46fc('0xb')](_0x46fc('0xc'),_0x1bc5aa,_0x46fc('0xd'),JSON[_0x46fc('0xe')](_0x33080c));if(_0x33080c['error']){if(_0x33080c[_0x46fc('0xf')][_0x46fc('0x10')]===0x1f4){logger[_0x46fc('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x1bc5aa,_0x33080c[_0x46fc('0xf')][_0x46fc('0x11')]);return _0x346232(_0x33080c[_0x46fc('0xf')]['message']);}logger[_0x46fc('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x1bc5aa,_0x33080c[_0x46fc('0xf')][_0x46fc('0x11')]);return _0x512046(_0x33080c[_0x46fc('0xf')][_0x46fc('0x11')]);}else{logger[_0x46fc('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x1bc5aa,_0x46fc('0xd'));_0x512046(_0x33080c['result'][_0x46fc('0x11')]);}})[_0x46fc('0x12')](function(_0x334b88){logger[_0x46fc('0xf')](_0x46fc('0xa'),_0x1bc5aa,_0x334b88);_0x346232(_0x334b88);});});}exports[_0x46fc('0x13')]=function(_0x136881){var _0x347915=this;return new Promise(function(_0x1ed09f,_0x58fca5){return db[_0x46fc('0x14')]['create'](_0x136881[_0x46fc('0x15')],{'raw':_0x136881[_0x46fc('0x16')]?_0x136881[_0x46fc('0x16')][_0x46fc('0x17')]===undefined?!![]:![]:!![]})[_0x46fc('0x18')](function(_0x291d7b){logger[_0x46fc('0x9')](_0x46fc('0x13'),_0x136881);logger[_0x46fc('0xb')](_0x46fc('0x13'),_0x136881,JSON[_0x46fc('0xe')](_0x291d7b));_0x1ed09f(_0x291d7b);})[_0x46fc('0x12')](function(_0x58e91b){logger['error'](_0x46fc('0x13'),_0x58e91b[_0x46fc('0x11')],_0x136881);_0x58fca5(_0x347915[_0x46fc('0xf')](0x1f4,_0x58e91b['message']));});});};exports[_0x46fc('0x19')]=function(_0x321abe){var _0xbbd8d1=this;return new Promise(function(_0x11701d,_0x20849a){return db[_0x46fc('0x14')]['update'](_0x321abe['body'],{'raw':_0x321abe[_0x46fc('0x16')]?_0x321abe[_0x46fc('0x16')][_0x46fc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321abe[_0x46fc('0x16')]?_0x321abe['options']['where']||null:null,'attributes':_0x321abe[_0x46fc('0x16')]?_0x321abe[_0x46fc('0x16')]['attributes']||null:null,'limit':_0x321abe[_0x46fc('0x16')]?_0x321abe[_0x46fc('0x16')][_0x46fc('0x1a')]||null:null})[_0x46fc('0x18')](function(_0x1b31ef){logger[_0x46fc('0x9')](_0x46fc('0x19'),_0x321abe);logger[_0x46fc('0xb')](_0x46fc('0x19'),_0x321abe,JSON['stringify'](_0x1b31ef));_0x11701d(_0x1b31ef);})['catch'](function(_0xaed42c){logger[_0x46fc('0xf')](_0x46fc('0x19'),_0xaed42c[_0x46fc('0x11')],_0x321abe);_0x20849a(_0xbbd8d1['error'](0x1f4,_0xaed42c[_0x46fc('0x11')]));});});}; \ No newline at end of file +var _0x0165=['rpc','../../config/environment','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','body','raw','then','CreateChatQueueReport','debug','options','where','attributes','UpdateChatQueueReport','moment','ioredis','../../config/logger'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x0165,0x11f));var _0x5016=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0165[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5016('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5016('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5016('0x2'))(_0x5016('0x3'));var config=require(_0x5016('0x4'));var jayson=require(_0x5016('0x5'));var client=jayson[_0x5016('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38b3a4,_0x3adc2e,_0x24bd26){return new BPromise(function(_0x53ce04,_0x3e9176){return client[_0x5016('0x7')](_0x38b3a4,_0x24bd26)['then'](function(_0xebd184){logger[_0x5016('0x8')](_0x5016('0x9'),_0x3adc2e,_0x5016('0xa'));logger['debug'](_0x5016('0xb'),_0x3adc2e,_0x5016('0xa'),JSON[_0x5016('0xc')](_0xebd184));if(_0xebd184[_0x5016('0xd')]){if(_0xebd184['error'][_0x5016('0xe')]===0x1f4){logger['error'](_0x5016('0x9'),_0x3adc2e,_0xebd184[_0x5016('0xd')][_0x5016('0xf')]);return _0x3e9176(_0xebd184['error'][_0x5016('0xf')]);}logger[_0x5016('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3adc2e,_0xebd184[_0x5016('0xd')][_0x5016('0xf')]);return _0x53ce04(_0xebd184['error'][_0x5016('0xf')]);}else{logger[_0x5016('0x8')](_0x5016('0x9'),_0x3adc2e,'request\x20sent');_0x53ce04(_0xebd184[_0x5016('0x10')]['message']);}})[_0x5016('0x11')](function(_0x1f000f){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3adc2e,_0x1f000f);_0x3e9176(_0x1f000f);});});}exports['CreateChatQueueReport']=function(_0x1365dd){var _0x5ac89d=this;return new Promise(function(_0x12a896,_0x652324){return db[_0x5016('0x12')][_0x5016('0x13')](_0x1365dd[_0x5016('0x14')],{'raw':_0x1365dd['options']?_0x1365dd['options'][_0x5016('0x15')]===undefined?!![]:![]:!![]})[_0x5016('0x16')](function(_0x3035c7){logger[_0x5016('0x8')](_0x5016('0x17'),_0x1365dd);logger[_0x5016('0x18')](_0x5016('0x17'),_0x1365dd,JSON['stringify'](_0x3035c7));_0x12a896(_0x3035c7);})[_0x5016('0x11')](function(_0x50c020){logger[_0x5016('0xd')]('CreateChatQueueReport',_0x50c020[_0x5016('0xf')],_0x1365dd);_0x652324(_0x5ac89d['error'](0x1f4,_0x50c020[_0x5016('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x5adcbc){var _0x56ff57=this;return new Promise(function(_0x1f1110,_0x265312){return db[_0x5016('0x12')]['update'](_0x5adcbc['body'],{'raw':_0x5adcbc[_0x5016('0x19')]?_0x5adcbc[_0x5016('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5adcbc[_0x5016('0x19')]?_0x5adcbc[_0x5016('0x19')][_0x5016('0x1a')]||null:null,'attributes':_0x5adcbc[_0x5016('0x19')]?_0x5adcbc[_0x5016('0x19')][_0x5016('0x1b')]||null:null,'limit':_0x5adcbc[_0x5016('0x19')]?_0x5adcbc[_0x5016('0x19')]['limit']||null:null})['then'](function(_0x34ebd1){logger[_0x5016('0x8')](_0x5016('0x1c'),_0x5adcbc);logger['debug']('UpdateChatQueueReport',_0x5adcbc,JSON[_0x5016('0xc')](_0x34ebd1));_0x1f1110(_0x34ebd1);})['catch'](function(_0x1f1f41){logger[_0x5016('0xd')]('UpdateChatQueueReport',_0x1f1f41[_0x5016('0xf')],_0x5adcbc);_0x265312(_0x56ff57[_0x5016('0xd')](0x1f4,_0x1f1f41[_0x5016('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c674a8a..067a7e3 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 _0x06eb=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x06eb,0x13f));var _0xb06e=function(_0x4c9c71,_0xc80d01){_0x4c9c71=_0x4c9c71-0x0;var _0x3d8a87=_0x06eb[_0x4c9c71];return _0x3d8a87;};'use strict';var multer=require(_0xb06e('0x0'));var util=require('util');var path=require(_0xb06e('0x1'));var timeout=require(_0xb06e('0x2'));var express=require(_0xb06e('0x3'));var router=express['Router']();var auth=require(_0xb06e('0x4'));var interaction=require(_0xb06e('0x5'));var config=require(_0xb06e('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xb06e('0x7')](),controller[_0xb06e('0x8')]);router[_0xb06e('0x9')](_0xb06e('0xa'),auth[_0xb06e('0x7')](),controller[_0xb06e('0xb')]);router[_0xb06e('0x9')](_0xb06e('0xc'),auth[_0xb06e('0x7')](),controller[_0xb06e('0xd')]);router[_0xb06e('0xe')]('/',auth[_0xb06e('0x7')](),controller[_0xb06e('0xf')]);router[_0xb06e('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb06e('0x11')](_0xb06e('0xc'),auth[_0xb06e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6802=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0xd60e4,_0x13204b){var _0x41e8e2=function(_0x3eda13){while(--_0x3eda13){_0xd60e4['push'](_0xd60e4['shift']());}};_0x41e8e2(++_0x13204b);}(_0x6802,0x161));var _0x2680=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6802[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x2680('0x0'));var util=require(_0x2680('0x1'));var path=require(_0x2680('0x2'));var timeout=require(_0x2680('0x3'));var express=require(_0x2680('0x4'));var router=express[_0x2680('0x5')]();var auth=require(_0x2680('0x6'));var interaction=require(_0x2680('0x7'));var config=require(_0x2680('0x8'));var controller=require(_0x2680('0x9'));router[_0x2680('0xa')]('/',auth[_0x2680('0xb')](),controller[_0x2680('0xc')]);router['get'](_0x2680('0xd'),auth['isAuthenticated'](),controller[_0x2680('0xe')]);router[_0x2680('0xa')](_0x2680('0xf'),auth[_0x2680('0xb')](),controller['show']);router[_0x2680('0x10')]('/',auth[_0x2680('0xb')](),controller[_0x2680('0x11')]);router[_0x2680('0x12')](_0x2680('0xf'),auth[_0x2680('0xb')](),controller[_0x2680('0x13')]);router[_0x2680('0x14')]('/:id',auth[_0x2680('0xb')](),controller[_0x2680('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 04feb8a..73128a9 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 _0xf121=['agent','queue','DATE','NOW'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf121,0x150));var _0x1f12=function(_0x507436,_0x445faa){_0x507436=_0x507436-0x0;var _0x43b784=_0xf121[_0x507436];return _0x43b784;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x1f12('0x0'),'queue'),'allowNull':![],'defaultValue':_0x1f12('0x1')},'transferredAt':{'type':Sequelize[_0x1f12('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x1f12('0x3')]}}; \ No newline at end of file +var _0x2f86=['queue','STRING','account'];(function(_0x418e85,_0x5446aa){var _0x539ed6=function(_0x444ae4){while(--_0x444ae4){_0x418e85['push'](_0x418e85['shift']());}};_0x539ed6(++_0x5446aa);}(_0x2f86,0x70));var _0x62f8=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x2f86[_0x17928f];return _0x500b63;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x62f8('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x62f8('0x1'),'agent',_0x62f8('0x2')),'allowNull':![],'defaultValue':_0x62f8('0x2')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2451cc9..d44a926 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 _0xafc4=['index','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','key','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send'];(function(_0x3c882a,_0x2ccddc){var _0x996d7e=function(_0x569cb0){while(--_0x569cb0){_0x3c882a['push'](_0x3c882a['shift']());}};_0x996d7e(++_0x2ccddc);}(_0xafc4,0x69));var _0x4afc=function(_0x51771,_0x7ca81){_0x51771=_0x51771-0x0;var _0x255c95=_0xafc4[_0x51771];return _0x255c95;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afc('0x2'));var rp=require(_0x4afc('0x3'));var moment=require(_0x4afc('0x4'));var BPromise=require(_0x4afc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4afc('0x6'));var csv=require(_0x4afc('0x7'));var ejs=require(_0x4afc('0x8'));var fs=require('fs');var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x7'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4afc('0x11'))('api');var utils=require(_0x4afc('0x12'));var config=require(_0x4afc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b322,_0x3fb54a){_0x3fb54a=_0x3fb54a||0xcc;return function(_0x2b191c){if(_0x2b191c){return _0x38b322[_0x4afc('0x14')](_0x3fb54a);}return _0x38b322[_0x4afc('0x15')](_0x3fb54a)[_0x4afc('0x16')]();};}function respondWithResult(_0x1ad8fd,_0x23b03e){_0x23b03e=_0x23b03e||0xc8;return function(_0x5effb4){if(_0x5effb4){return _0x1ad8fd[_0x4afc('0x15')](_0x23b03e)[_0x4afc('0x17')](_0x5effb4);}};}function respondWithFilteredResult(_0x2c636b,_0x1e2c31){return function(_0x5f2dc9){if(_0x5f2dc9){var _0x4e32e8=_0x5f2dc9[_0x4afc('0x18')],_0x2452ae=_0x1e2c31[_0x4afc('0x19')],_0x4f3127=_0x1e2c31[_0x4afc('0x19')]+_0x1e2c31[_0x4afc('0x1a')],_0x23ae30;if(_0x4f3127>=_0x4e32e8){_0x4f3127=_0x4e32e8;_0x23ae30=0xc8;}else{_0x23ae30=0xce;}_0x2c636b[_0x4afc('0x15')](_0x23ae30);return _0x2c636b[_0x4afc('0x1b')](_0x4afc('0x1c'),_0x2452ae+'-'+_0x4f3127+'/'+_0x4e32e8)[_0x4afc('0x17')](_0x5f2dc9);}return null;};}function patchUpdates(_0x135349){return function(_0x178229){try{jsonpatch['apply'](_0x178229,_0x135349,!![]);}catch(_0x1a8f49){return BPromise[_0x4afc('0x1d')](_0x1a8f49);}return _0x178229[_0x4afc('0x1e')]();};}function saveUpdates(_0x14558a,_0x557a7e){return function(_0x3bddc0){if(_0x3bddc0){return _0x3bddc0[_0x4afc('0x1f')](_0x14558a)[_0x4afc('0x20')](function(_0x280587){return _0x280587;});}return null;};}function removeEntity(_0x1559b8,_0x3add4c){return function(_0x3ad7a5){if(_0x3ad7a5){return _0x3ad7a5['destroy']()[_0x4afc('0x20')](function(){_0x1559b8[_0x4afc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37debf,_0x4e9a48){return function(_0x1aa676){if(!_0x1aa676){_0x37debf[_0x4afc('0x14')](0x194);}return _0x1aa676;};}function handleError(_0x1e454e,_0x2876f2){_0x2876f2=_0x2876f2||0x1f4;return function(_0x86dbd4){logger[_0x4afc('0x21')](_0x86dbd4[_0x4afc('0x22')]);if(_0x86dbd4[_0x4afc('0x23')]){delete _0x86dbd4[_0x4afc('0x23')];}_0x1e454e[_0x4afc('0x15')](_0x2876f2)[_0x4afc('0x24')](_0x86dbd4);};}exports[_0x4afc('0x25')]=function(_0x35f5b3,_0x55842c){var _0xc3952e={},_0x244f6c={},_0x2d6112={'count':0x0,'rows':[]};var _0x4e254d=db['ChatTransferReport']['rawAttributes'];_0x244f6c[_0x4afc('0x26')]=_[_0x4afc('0x27')](_0x4e254d);_0x244f6c['query']=_[_0x4afc('0x27')](_0x35f5b3[_0x4afc('0x28')]);_0x244f6c['filters']=_['intersection'](_0x244f6c['model'],_0x244f6c[_0x4afc('0x28')]);_0xc3952e[_0x4afc('0x29')]=_[_0x4afc('0x2a')](_0x244f6c[_0x4afc('0x26')],qs[_0x4afc('0x2b')](_0x35f5b3[_0x4afc('0x28')]['fields']));_0xc3952e[_0x4afc('0x29')]=_0xc3952e[_0x4afc('0x29')][_0x4afc('0x2c')]?_0xc3952e[_0x4afc('0x29')]:_0x244f6c[_0x4afc('0x26')];if(!_0x35f5b3[_0x4afc('0x28')][_0x4afc('0x2d')](_0x4afc('0x2e'))){_0xc3952e['limit']=qs[_0x4afc('0x1a')](_0x35f5b3['query']['limit']);_0xc3952e[_0x4afc('0x19')]=qs[_0x4afc('0x19')](_0x35f5b3[_0x4afc('0x28')][_0x4afc('0x19')]);}_0xc3952e[_0x4afc('0x2f')]=qs[_0x4afc('0x30')](_0x35f5b3['query'][_0x4afc('0x30')]);_0xc3952e[_0x4afc('0x31')]=qs[_0x4afc('0x32')](_[_0x4afc('0x33')](_0x35f5b3[_0x4afc('0x28')],_0x244f6c[_0x4afc('0x32')]));if(_0x35f5b3['query'][_0x4afc('0x34')]){_0xc3952e[_0x4afc('0x31')]=_[_0x4afc('0x35')](_0xc3952e[_0x4afc('0x31')],{'$or':_['map'](_0x4e254d,function(_0x4be1e6){if(_0x4be1e6[_0x4afc('0x36')][_0x4afc('0x37')]!==_0x4afc('0x38')){var _0x5edfe1={};_0x5edfe1[_0x4be1e6['field']]={'$like':'%'+_0x35f5b3[_0x4afc('0x28')]['filter']+'%'};return _0x5edfe1;}})});}_0xc3952e=_['merge']({},_0xc3952e,_0x35f5b3[_0x4afc('0x39')]);var _0x1dc853={'where':_0xc3952e[_0x4afc('0x31')]};return db[_0x4afc('0x3a')][_0x4afc('0x18')](_0x1dc853)[_0x4afc('0x20')](function(_0x453e12){_0x2d6112[_0x4afc('0x18')]=_0x453e12;if(_0x35f5b3[_0x4afc('0x28')][_0x4afc('0x3b')]){_0xc3952e[_0x4afc('0x3c')]=[{'all':!![]}];}return db[_0x4afc('0x3a')][_0x4afc('0x3d')](_0xc3952e);})[_0x4afc('0x20')](function(_0x46dd2a){_0x2d6112['rows']=_0x46dd2a;return _0x2d6112;})[_0x4afc('0x20')](respondWithFilteredResult(_0x55842c,_0xc3952e))[_0x4afc('0x3e')](handleError(_0x55842c,null));};exports[_0x4afc('0x3f')]=function(_0xe6db12,_0x12db1d){var _0x260b06={'raw':!![],'where':{'id':_0xe6db12['params']['id']}},_0x3e87f0={};_0x3e87f0['model']=_['keys'](db[_0x4afc('0x3a')][_0x4afc('0x40')]);_0x3e87f0['query']=_[_0x4afc('0x27')](_0xe6db12[_0x4afc('0x28')]);_0x3e87f0[_0x4afc('0x32')]=_[_0x4afc('0x2a')](_0x3e87f0['model'],_0x3e87f0[_0x4afc('0x28')]);_0x260b06[_0x4afc('0x29')]=_[_0x4afc('0x2a')](_0x3e87f0[_0x4afc('0x26')],qs[_0x4afc('0x2b')](_0xe6db12[_0x4afc('0x28')]['fields']));_0x260b06[_0x4afc('0x29')]=_0x260b06['attributes'][_0x4afc('0x2c')]?_0x260b06[_0x4afc('0x29')]:_0x3e87f0[_0x4afc('0x26')];if(_0xe6db12['query']['includeAll']){_0x260b06[_0x4afc('0x3c')]=[{'all':!![]}];}_0x260b06=_[_0x4afc('0x35')]({},_0x260b06,_0xe6db12[_0x4afc('0x39')]);return db[_0x4afc('0x3a')][_0x4afc('0x41')](_0x260b06)[_0x4afc('0x20')](handleEntityNotFound(_0x12db1d,null))[_0x4afc('0x20')](respondWithResult(_0x12db1d,null))[_0x4afc('0x3e')](handleError(_0x12db1d,null));};exports['create']=function(_0x658c5b,_0xb1e91e){return db['ChatTransferReport'][_0x4afc('0x42')](_0x658c5b['body'],{})[_0x4afc('0x20')](respondWithResult(_0xb1e91e,0xc9))[_0x4afc('0x3e')](handleError(_0xb1e91e,null));};exports[_0x4afc('0x1f')]=function(_0x5e0ebd,_0xd0f517){if(_0x5e0ebd[_0x4afc('0x43')]['id']){delete _0x5e0ebd[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3a')][_0x4afc('0x41')]({'where':{'id':_0x5e0ebd[_0x4afc('0x44')]['id']}})['then'](handleEntityNotFound(_0xd0f517,null))['then'](saveUpdates(_0x5e0ebd['body'],null))[_0x4afc('0x20')](respondWithResult(_0xd0f517,null))[_0x4afc('0x3e')](handleError(_0xd0f517,null));};exports[_0x4afc('0x45')]=function(_0x269c24,_0xb5cca9){return db[_0x4afc('0x3a')][_0x4afc('0x41')]({'where':{'id':_0x269c24[_0x4afc('0x44')]['id']}})[_0x4afc('0x20')](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x20')](removeEntity(_0xb5cca9,null))['catch'](handleError(_0xb5cca9,null));};exports[_0x4afc('0x46')]=function(_0x4d7e3f,_0x4861a5){return db[_0x4afc('0x3a')]['describe']()[_0x4afc('0x20')](respondWithResult(_0x4861a5,null))[_0x4afc('0x3e')](handleError(_0x4861a5,null));}; \ No newline at end of file +var _0xb4c7=['mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','map','type','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x58eaef,_0x450a57){_0x58eaef=_0x58eaef-0x0;var _0x441bb7=_0xb4c7[_0x58eaef];return _0x441bb7;};'use strict';var pdf=require(_0x7b4c('0x0'));var emlformat=require(_0x7b4c('0x1'));var rimraf=require(_0x7b4c('0x2'));var zipdir=require(_0x7b4c('0x3'));var jsonpatch=require(_0x7b4c('0x4'));var rp=require('request-promise');var moment=require(_0x7b4c('0x5'));var BPromise=require(_0x7b4c('0x6'));var Mustache=require(_0x7b4c('0x7'));var util=require(_0x7b4c('0x8'));var path=require(_0x7b4c('0x9'));var sox=require('sox');var csv=require(_0x7b4c('0xa'));var ejs=require(_0x7b4c('0xb'));var fs=require('fs');var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xa'));var querystring=require(_0x7b4c('0xf'));var Papa=require(_0x7b4c('0x10'));var Redis=require(_0x7b4c('0x11'));var authService=require(_0x7b4c('0x12'));var qs=require(_0x7b4c('0x13'));var hardwareService=require(_0x7b4c('0x14'));var logger=require(_0x7b4c('0x15'))(_0x7b4c('0x16'));var utils=require(_0x7b4c('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24dd7d,_0x18342b){_0x18342b=_0x18342b||0xcc;return function(_0x38656b){if(_0x38656b){return _0x24dd7d[_0x7b4c('0x18')](_0x18342b);}return _0x24dd7d[_0x7b4c('0x19')](_0x18342b)[_0x7b4c('0x1a')]();};}function respondWithResult(_0x3ea0da,_0x40c830){_0x40c830=_0x40c830||0xc8;return function(_0x25b90b){if(_0x25b90b){return _0x3ea0da[_0x7b4c('0x19')](_0x40c830)['json'](_0x25b90b);}};}function respondWithFilteredResult(_0x2edb77,_0x3d8362){return function(_0xdc71cd){if(_0xdc71cd){var _0x2a0e2f=_0xdc71cd[_0x7b4c('0x1b')],_0xa0a812=_0x3d8362['offset'],_0x2471b3=_0x3d8362[_0x7b4c('0x1c')]+_0x3d8362[_0x7b4c('0x1d')],_0x1642e1;if(_0x2471b3>=_0x2a0e2f){_0x2471b3=_0x2a0e2f;_0x1642e1=0xc8;}else{_0x1642e1=0xce;}_0x2edb77[_0x7b4c('0x19')](_0x1642e1);return _0x2edb77[_0x7b4c('0x1e')]('Content-Range',_0xa0a812+'-'+_0x2471b3+'/'+_0x2a0e2f)[_0x7b4c('0x1f')](_0xdc71cd);}return null;};}function patchUpdates(_0x3d314d){return function(_0x32110e){try{jsonpatch[_0x7b4c('0x20')](_0x32110e,_0x3d314d,!![]);}catch(_0x2d4c72){return BPromise[_0x7b4c('0x21')](_0x2d4c72);}return _0x32110e[_0x7b4c('0x22')]();};}function saveUpdates(_0x445281,_0x3556d8){return function(_0x55e3df){if(_0x55e3df){return _0x55e3df[_0x7b4c('0x23')](_0x445281)[_0x7b4c('0x24')](function(_0x11996d){return _0x11996d;});}return null;};}function removeEntity(_0xabeffb,_0x148a79){return function(_0x168ac9){if(_0x168ac9){return _0x168ac9[_0x7b4c('0x25')]()[_0x7b4c('0x24')](function(){_0xabeffb[_0x7b4c('0x19')](0xcc)[_0x7b4c('0x1a')]();});}};}function handleEntityNotFound(_0x5eec1e,_0x45438c){return function(_0x4350c9){if(!_0x4350c9){_0x5eec1e[_0x7b4c('0x18')](0x194);}return _0x4350c9;};}function handleError(_0x3157b8,_0x3124e7){_0x3124e7=_0x3124e7||0x1f4;return function(_0x2bdc4d){logger[_0x7b4c('0x26')](_0x2bdc4d[_0x7b4c('0x27')]);if(_0x2bdc4d[_0x7b4c('0x28')]){delete _0x2bdc4d[_0x7b4c('0x28')];}_0x3157b8[_0x7b4c('0x19')](_0x3124e7)[_0x7b4c('0x29')](_0x2bdc4d);};}exports[_0x7b4c('0x2a')]=function(_0x501f75,_0x27f361){var _0x3ab614={},_0x1fe0f5={},_0x3671c4={'count':0x0,'rows':[]};var _0x207c2f=db[_0x7b4c('0x2b')][_0x7b4c('0x2c')];_0x1fe0f5[_0x7b4c('0x2d')]=_[_0x7b4c('0x2e')](_0x207c2f);_0x1fe0f5[_0x7b4c('0x2f')]=_[_0x7b4c('0x2e')](_0x501f75[_0x7b4c('0x2f')]);_0x1fe0f5[_0x7b4c('0x30')]=_[_0x7b4c('0x31')](_0x1fe0f5[_0x7b4c('0x2d')],_0x1fe0f5[_0x7b4c('0x2f')]);_0x3ab614[_0x7b4c('0x32')]=_[_0x7b4c('0x31')](_0x1fe0f5[_0x7b4c('0x2d')],qs['fields'](_0x501f75['query']['fields']));_0x3ab614[_0x7b4c('0x32')]=_0x3ab614[_0x7b4c('0x32')][_0x7b4c('0x33')]?_0x3ab614[_0x7b4c('0x32')]:_0x1fe0f5['model'];if(!_0x501f75[_0x7b4c('0x2f')][_0x7b4c('0x34')]('nolimit')){_0x3ab614[_0x7b4c('0x1d')]=qs['limit'](_0x501f75[_0x7b4c('0x2f')][_0x7b4c('0x1d')]);_0x3ab614[_0x7b4c('0x1c')]=qs['offset'](_0x501f75[_0x7b4c('0x2f')][_0x7b4c('0x1c')]);}_0x3ab614['order']=qs[_0x7b4c('0x35')](_0x501f75[_0x7b4c('0x2f')][_0x7b4c('0x35')]);_0x3ab614[_0x7b4c('0x36')]=qs['filters'](_['pick'](_0x501f75[_0x7b4c('0x2f')],_0x1fe0f5[_0x7b4c('0x30')]));if(_0x501f75['query'][_0x7b4c('0x37')]){_0x3ab614['where']=_['merge'](_0x3ab614[_0x7b4c('0x36')],{'$or':_[_0x7b4c('0x38')](_0x207c2f,function(_0x39d69a){if(_0x39d69a[_0x7b4c('0x39')]['key']!==_0x7b4c('0x3a')){var _0x166189={};_0x166189[_0x39d69a[_0x7b4c('0x3b')]]={'$like':'%'+_0x501f75[_0x7b4c('0x2f')][_0x7b4c('0x37')]+'%'};return _0x166189;}})});}_0x3ab614=_[_0x7b4c('0x3c')]({},_0x3ab614,_0x501f75[_0x7b4c('0x3d')]);var _0x4c23cc={'where':_0x3ab614['where']};return db[_0x7b4c('0x2b')][_0x7b4c('0x1b')](_0x4c23cc)[_0x7b4c('0x24')](function(_0x123a3a){_0x3671c4[_0x7b4c('0x1b')]=_0x123a3a;if(_0x501f75['query'][_0x7b4c('0x3e')]){_0x3ab614[_0x7b4c('0x3f')]=[{'all':!![]}];}return db[_0x7b4c('0x2b')][_0x7b4c('0x40')](_0x3ab614);})[_0x7b4c('0x24')](function(_0x25659d){_0x3671c4[_0x7b4c('0x41')]=_0x25659d;return _0x3671c4;})[_0x7b4c('0x24')](respondWithFilteredResult(_0x27f361,_0x3ab614))[_0x7b4c('0x42')](handleError(_0x27f361,null));};exports['show']=function(_0x2a4085,_0x562838){var _0x2a3a74={'raw':!![],'where':{'id':_0x2a4085[_0x7b4c('0x43')]['id']}},_0x4dc71f={};_0x4dc71f[_0x7b4c('0x2d')]=_['keys'](db['ChatTransferReport'][_0x7b4c('0x2c')]);_0x4dc71f[_0x7b4c('0x2f')]=_[_0x7b4c('0x2e')](_0x2a4085[_0x7b4c('0x2f')]);_0x4dc71f['filters']=_[_0x7b4c('0x31')](_0x4dc71f[_0x7b4c('0x2d')],_0x4dc71f[_0x7b4c('0x2f')]);_0x2a3a74['attributes']=_[_0x7b4c('0x31')](_0x4dc71f['model'],qs['fields'](_0x2a4085[_0x7b4c('0x2f')]['fields']));_0x2a3a74[_0x7b4c('0x32')]=_0x2a3a74[_0x7b4c('0x32')][_0x7b4c('0x33')]?_0x2a3a74[_0x7b4c('0x32')]:_0x4dc71f[_0x7b4c('0x2d')];if(_0x2a4085[_0x7b4c('0x2f')][_0x7b4c('0x3e')]){_0x2a3a74[_0x7b4c('0x3f')]=[{'all':!![]}];}_0x2a3a74=_[_0x7b4c('0x3c')]({},_0x2a3a74,_0x2a4085['options']);return db[_0x7b4c('0x2b')]['find'](_0x2a3a74)['then'](handleEntityNotFound(_0x562838,null))[_0x7b4c('0x24')](respondWithResult(_0x562838,null))[_0x7b4c('0x42')](handleError(_0x562838,null));};exports['create']=function(_0x529fde,_0x255cca){return db[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x529fde[_0x7b4c('0x45')],{})[_0x7b4c('0x24')](respondWithResult(_0x255cca,0xc9))[_0x7b4c('0x42')](handleError(_0x255cca,null));};exports[_0x7b4c('0x23')]=function(_0x1cf7c7,_0x57ad8c){if(_0x1cf7c7[_0x7b4c('0x45')]['id']){delete _0x1cf7c7[_0x7b4c('0x45')]['id'];}return db[_0x7b4c('0x2b')][_0x7b4c('0x46')]({'where':{'id':_0x1cf7c7[_0x7b4c('0x43')]['id']}})[_0x7b4c('0x24')](handleEntityNotFound(_0x57ad8c,null))[_0x7b4c('0x24')](saveUpdates(_0x1cf7c7[_0x7b4c('0x45')],null))[_0x7b4c('0x24')](respondWithResult(_0x57ad8c,null))['catch'](handleError(_0x57ad8c,null));};exports['destroy']=function(_0x1884a4,_0x3f6aaa){return db[_0x7b4c('0x2b')]['find']({'where':{'id':_0x1884a4[_0x7b4c('0x43')]['id']}})[_0x7b4c('0x24')](handleEntityNotFound(_0x3f6aaa,null))['then'](removeEntity(_0x3f6aaa,null))[_0x7b4c('0x42')](handleError(_0x3f6aaa,null));};exports['describe']=function(_0x19d8dd,_0x528472){return db[_0x7b4c('0x2b')]['describe']()[_0x7b4c('0x24')](respondWithResult(_0x528472,null))[_0x7b4c('0x42')](handleError(_0x528472,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b1bbcf1..14961b1 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 _0xea79=['define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x52b6c3,_0xbc2e07){var _0x555e5f=function(_0x51c234){while(--_0x51c234){_0x52b6c3['push'](_0x52b6c3['shift']());}};_0x555e5f(++_0xbc2e07);}(_0xea79,0x87));var _0x9ea7=function(_0x3a331e,_0x7db48b){_0x3a331e=_0x3a331e-0x0;var _0x2684a6=_0xea79[_0x3a331e];return _0x2684a6;};'use strict';var _=require(_0x9ea7('0x0'));var util=require(_0x9ea7('0x1'));var logger=require(_0x9ea7('0x2'))('api');var moment=require(_0x9ea7('0x3'));var BPromise=require(_0x9ea7('0x4'));var rp=require(_0x9ea7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ea7('0x6'));var attributes=require(_0x9ea7('0x7'));module[_0x9ea7('0x8')]=function(_0x33a518,_0x3f918b){return _0x33a518[_0x9ea7('0x9')](_0x9ea7('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9ea7('0xb'),'fields':[_0x9ea7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56dc=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4c9526,_0x47e121){var _0x1e0e51=function(_0x2514bb){while(--_0x2514bb){_0x4c9526['push'](_0x4c9526['shift']());}};_0x1e0e51(++_0x47e121);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc56d('0x0'));var util=require('util');var logger=require(_0xc56d('0x1'))(_0xc56d('0x2'));var moment=require(_0xc56d('0x3'));var BPromise=require(_0xc56d('0x4'));var rp=require(_0xc56d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc56d('0x6'));var config=require(_0xc56d('0x7'));var attributes=require(_0xc56d('0x8'));module[_0xc56d('0x9')]=function(_0x3eb4ed,_0x3e68f4){return _0x3eb4ed['define'](_0xc56d('0xa'),attributes,{'tableName':_0xc56d('0xb'),'paranoid':![],'indexes':[{'name':_0xc56d('0xc'),'fields':[_0xc56d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7359665..cf15873 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 _0x5656=['../../config/logger','rpc','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x182c85,_0x1cef7d){var _0x5653aa=function(_0xda0cc3){while(--_0xda0cc3){_0x182c85['push'](_0x182c85['shift']());}};_0x5653aa(++_0x1cef7d);}(_0x5656,0x1d5));var _0x6565=function(_0xae11a3,_0x93a629){_0xae11a3=_0xae11a3-0x0;var _0x481f5f=_0x5656[_0xae11a3];return _0x481f5f;};'use strict';var _=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var moment=require(_0x6565('0x2'));var BPromise=require(_0x6565('0x3'));var rs=require(_0x6565('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6565('0x5'));var logger=require(_0x6565('0x6'))(_0x6565('0x7'));var config=require('../../config/environment');var jayson=require(_0x6565('0x8'));var client=jayson[_0x6565('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1318ba,_0x3bab76,_0x47c8f1){return new BPromise(function(_0x20e359,_0x59f0b2){return client['request'](_0x1318ba,_0x47c8f1)[_0x6565('0xa')](function(_0xea00a0){logger[_0x6565('0xb')](_0x6565('0xc'),_0x3bab76,_0x6565('0xd'));logger['debug'](_0x6565('0xe'),_0x3bab76,'request\x20sent',JSON[_0x6565('0xf')](_0xea00a0));if(_0xea00a0[_0x6565('0x10')]){if(_0xea00a0[_0x6565('0x10')][_0x6565('0x11')]===0x1f4){logger['error'](_0x6565('0xc'),_0x3bab76,_0xea00a0['error'][_0x6565('0x12')]);return _0x59f0b2(_0xea00a0[_0x6565('0x10')][_0x6565('0x12')]);}logger[_0x6565('0x10')](_0x6565('0xc'),_0x3bab76,_0xea00a0[_0x6565('0x10')][_0x6565('0x12')]);return _0x20e359(_0xea00a0['error'][_0x6565('0x12')]);}else{logger[_0x6565('0xb')](_0x6565('0xc'),_0x3bab76,_0x6565('0xd'));_0x20e359(_0xea00a0['result'][_0x6565('0x12')]);}})['catch'](function(_0x1b3837){logger[_0x6565('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x3bab76,_0x1b3837);_0x59f0b2(_0x1b3837);});});} \ No newline at end of file +var _0x4e34=['error','code','message','ChatTransferReport,\x20%s,\x20%s','request\x20sent','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4e34,0x19e));var _0x44e3=function(_0x22d8df,_0x2e84b9){_0x22d8df=_0x22d8df-0x0;var _0x5a6306=_0x4e34[_0x22d8df];return _0x5a6306;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44e3('0x0'));var BPromise=require(_0x44e3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44e3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x44e3('0x3'))(_0x44e3('0x4'));var config=require(_0x44e3('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x44e3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x19e7de,_0x163879,_0x1ca56e){return new BPromise(function(_0x37b7d4,_0x196941){return client[_0x44e3('0x7')](_0x19e7de,_0x1ca56e)['then'](function(_0xf7e448){logger[_0x44e3('0x8')]('ChatTransferReport,\x20%s,\x20%s',_0x163879,'request\x20sent');logger[_0x44e3('0x9')](_0x44e3('0xa'),_0x163879,'request\x20sent',JSON['stringify'](_0xf7e448));if(_0xf7e448[_0x44e3('0xb')]){if(_0xf7e448[_0x44e3('0xb')][_0x44e3('0xc')]===0x1f4){logger[_0x44e3('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x163879,_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);return _0x196941(_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);}logger[_0x44e3('0xb')](_0x44e3('0xe'),_0x163879,_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);return _0x37b7d4(_0xf7e448['error'][_0x44e3('0xd')]);}else{logger['info'](_0x44e3('0xe'),_0x163879,_0x44e3('0xf'));_0x37b7d4(_0xf7e448['result'][_0x44e3('0xd')]);}})[_0x44e3('0x10')](function(_0x103eb0){logger[_0x44e3('0xb')](_0x44e3('0xe'),_0x163879,_0x103eb0);_0x196941(_0x103eb0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1b8185f..ac42eaa 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 _0x3234=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5d4090,_0x1cbbe6){var _0x33b462=function(_0x2f85e4){while(--_0x2f85e4){_0x5d4090['push'](_0x5d4090['shift']());}};_0x33b462(++_0x1cbbe6);}(_0x3234,0x10f));var _0x4323=function(_0x34c7e8,_0x16f1a3){_0x34c7e8=_0x34c7e8-0x0;var _0x3ec838=_0x3234[_0x34c7e8];return _0x3ec838;};'use strict';var multer=require(_0x4323('0x0'));var util=require('util');var path=require(_0x4323('0x1'));var timeout=require(_0x4323('0x2'));var express=require(_0x4323('0x3'));var router=express[_0x4323('0x4')]();var auth=require(_0x4323('0x5'));var interaction=require(_0x4323('0x6'));var config=require(_0x4323('0x7'));var controller=require(_0x4323('0x8'));router[_0x4323('0x9')]('/',auth[_0x4323('0xa')](),controller[_0x4323('0xb')]);router[_0x4323('0x9')](_0x4323('0xc'),auth[_0x4323('0xa')](),controller[_0x4323('0xd')]);router['get'](_0x4323('0xe'),auth[_0x4323('0xa')](),controller[_0x4323('0xf')]);router[_0x4323('0x10')]('/',auth[_0x4323('0xa')](),controller[_0x4323('0x11')]);router[_0x4323('0x12')](_0x4323('0xe'),auth[_0x4323('0xa')](),controller['update']);router[_0x4323('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4323('0x14')]);module[_0x4323('0x15')]=router; \ No newline at end of file +var _0xefe8=['isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xefe8,0xf2));var _0x8efe=function(_0x5b8dea,_0x289a9e){_0x5b8dea=_0x5b8dea-0x0;var _0x88c89=_0xefe8[_0x5b8dea];return _0x88c89;};'use strict';var multer=require(_0x8efe('0x0'));var util=require(_0x8efe('0x1'));var path=require(_0x8efe('0x2'));var timeout=require(_0x8efe('0x3'));var express=require('express');var router=express[_0x8efe('0x4')]();var auth=require(_0x8efe('0x5'));var interaction=require(_0x8efe('0x6'));var config=require(_0x8efe('0x7'));var controller=require(_0x8efe('0x8'));router[_0x8efe('0x9')]('/',auth[_0x8efe('0xa')](),controller[_0x8efe('0xb')]);router['get'](_0x8efe('0xc'),auth[_0x8efe('0xa')](),controller[_0x8efe('0xd')]);router[_0x8efe('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8efe('0xe')]);router[_0x8efe('0xf')]('/',auth[_0x8efe('0xa')](),controller[_0x8efe('0x10')]);router[_0x8efe('0x11')]('/:id',auth[_0x8efe('0xa')](),controller[_0x8efe('0x12')]);router['delete'](_0x8efe('0x13'),auth[_0x8efe('0xa')](),controller[_0x8efe('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 04fdb68..498bde0 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 _0x9262=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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}}','bottom_right','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','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','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue'];(function(_0x5dbe27,_0x41cb88){var _0x133a0d=function(_0x4241f4){while(--_0x4241f4){_0x5dbe27['push'](_0x5dbe27['shift']());}};_0x133a0d(++_0x41cb88);}(_0x9262,0x113));var _0x2926=function(_0x4d9e56,_0x41bd40){_0x4d9e56=_0x4d9e56-0x0;var _0x3ddb01=_0x9262[_0x4d9e56];return _0x3ddb01;};'use strict';var Sequelize=require(_0x2926('0x0'));var rs=require(_0x2926('0x1'));module['exports']={'name':{'type':Sequelize[_0x2926('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2926('0x2')],'allowNull':![],'unique':_0x2926('0x3')},'description':{'type':Sequelize[_0x2926('0x2')]},'mapKey':{'type':Sequelize[_0x2926('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x4')},'key':{'type':Sequelize[_0x2926('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2926('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2926('0x2')],'allowNull':![],'defaultValue':_0x2926('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2926('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x2926('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x2926('0x9')),'defaultValue':_0x2926('0xa')},'header_online':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0xb')},'start_chat_button':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0xc')},'offline_chat_button':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2926('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2926('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x2926('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x2926('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2926('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x2926('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2926('0x12')},'noteTitle':{'type':Sequelize[_0x2926('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2926('0x13')},'closingMessage':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x14')},'closingMessageButton':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0xd')},'skipMessageButton':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x15')},'conditionAgreement':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x2926('0x16')](_0x2926('0x17'),_0x2926('0x18')),'defaultValue':_0x2926('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2926('0xf')],'defaultValue':function(){return JSON[_0x2926('0x19')]({'items':[{'type':_0x2926('0x1a'),'variable':null,'config':{'placeholder':_0x2926('0x1b'),'type':_0x2926('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x2926('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2926('0x4'),'type':_0x2926('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2926('0x1d')](_0x2926('0x1e'))?JSON[_0x2926('0x1f')](this[_0x2926('0x1d')](_0x2926('0x1e'))):{};},'set':function(_0x1cdb37){return this[_0x2926('0x20')](_0x2926('0x1e'),JSON[_0x2926('0x19')](_0x1cdb37));}},'offlineForm':{'type':Sequelize[_0x2926('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2926('0x1a'),'props':{'title':_0x2926('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x2926('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x2926('0x21')},'props':{'title':_0x2926('0x21'),'helpText':_0x2926('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x2926('0x1d')](_0x2926('0x23'))?JSON[_0x2926('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x24b6d3){return this[_0x2926('0x20')](_0x2926('0x23'),JSON['stringify'](_0x24b6d3));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2926('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2926('0x2')]},'waitingTitle':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x25')},'waitingMessage':{'type':Sequelize[_0x2926('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x2926('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x2926('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x2926('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x15')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2926('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2926('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2926('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2926('0xf')],'defaultValue':function(){return _0x2926('0x27');}},'notificationSound':{'type':Sequelize[_0x2926('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2926('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x2926('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x28')},'verticalAlignment':{'type':Sequelize[_0x2926('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x2926('0x2')]},'customerAvatar':{'type':Sequelize[_0x2926('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2926('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2926('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2926('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2926('0x2')],'defaultValue':_0x2926('0x29')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2926('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2926('0x8')],'defaultValue':![],'comment':_0x2926('0x2a'),'set':function(_0x1379db){if(!_0x1379db)this[_0x2926('0x20')](_0x2926('0x2b'),null);this['setDataValue']('mandatoryDisposition',_0x1379db);}}}; \ No newline at end of file +var _0x463b=['exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','input','name','text','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','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:','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring'];(function(_0x292f25,_0x3162ec){var _0x20edc6=function(_0xba9a13){while(--_0xba9a13){_0x292f25['push'](_0x292f25['shift']());}};_0x20edc6(++_0x3162ec);}(_0x463b,0x1c9));var _0xb463=function(_0x22c452,_0x4f0e5d){_0x22c452=_0x22c452-0x0;var _0x41cf31=_0x463b[_0x22c452];return _0x41cf31;};'use strict';var Sequelize=require(_0xb463('0x0'));var rs=require(_0xb463('0x1'));module[_0xb463('0x2')]={'name':{'type':Sequelize[_0xb463('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xb463('0x3')],'allowNull':![],'unique':_0xb463('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x5')},'mapKeyOffline':{'type':Sequelize[_0xb463('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xb463('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x6')},'customerAlias':{'type':Sequelize[_0xb463('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb463('0x3')],'allowNull':![],'defaultValue':_0xb463('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb463('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb463('0x3')],'allowNull':![],'defaultValue':_0xb463('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb463('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb463('0x3')]},'animation':{'type':Sequelize[_0xb463('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb463('0xb')](_0xb463('0xc'),_0xb463('0xd')),'defaultValue':_0xb463('0xc')},'header_online':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0xe')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb463('0xf')},'offline_chat_button':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x10')},'header_offline':{'type':Sequelize[_0xb463('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xb463('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb463('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x13')},'noteTitle':{'type':Sequelize[_0xb463('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x14')},'closingMessage':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb463('0x10')},'skipMessageButton':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0xb463('0xb')](_0xb463('0x17'),_0xb463('0x18')),'defaultValue':_0xb463('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xb463('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb463('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb463('0x1a'),'variable':null,'config':{'placeholder':_0xb463('0x1b'),'type':_0xb463('0x1c'),'required':!![]},'props':{'title':_0xb463('0x1b'),'helpText':''}},{'type':_0xb463('0x1a'),'props':{'title':_0xb463('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xb463('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb463('0x1d')](_0xb463('0x1e'))?JSON['parse'](this[_0xb463('0x1d')](_0xb463('0x1e'))):{};},'set':function(_0x317cda){return this[_0xb463('0x1f')](_0xb463('0x1e'),JSON[_0xb463('0x20')](_0x317cda));}},'offlineForm':{'type':Sequelize[_0xb463('0x19')],'defaultValue':function(){return JSON[_0xb463('0x20')]({'items':[{'type':_0xb463('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb463('0x5')},'variable':null},{'type':_0xb463('0x21'),'config':{'placeholder':_0xb463('0x22')},'props':{'title':_0xb463('0x22'),'helpText':_0xb463('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xb463('0x1d')](_0xb463('0x24'))?JSON[_0xb463('0x25')](this[_0xb463('0x1d')](_0xb463('0x24'))):{};},'set':function(_0x322a2c){return this[_0xb463('0x1f')](_0xb463('0x24'),JSON[_0xb463('0x20')](_0x322a2c));}},'token':{'type':Sequelize[_0xb463('0x3')],'defaultValue':function(){return rs[_0xb463('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb463('0x3')]},'forwardOffline':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb463('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb463('0x27')},'waitingMessage':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x28')},'offlineMessageSubject':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x29')},'offlineMessageBody':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0xb463('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x16')},'sendUnmanaged':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x10')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb463('0x19')]},'showAgentAvatar':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb463('0x19')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb463('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x2c')},'verticalAlignment':{'type':Sequelize[_0xb463('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xb463('0x2d')},'defaultTitle':{'type':Sequelize[_0xb463('0x3')]},'customerAvatar':{'type':Sequelize[_0xb463('0x19')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb463('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb463('0x3')],'allowNull':![],'defaultValue':_0xb463('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb463('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb463('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb463('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb463('0x3')],'defaultValue':_0xb463('0x2f')},'systemAvatar':{'type':Sequelize[_0xb463('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb463('0x9')],'comment':_0xb463('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb463('0x31'),'set':function(_0x1364b7){if(!_0x1364b7)this[_0xb463('0x1f')]('mandatoryDispositionPauseId',null);this[_0xb463('0x1f')](_0xb463('0x32'),_0x1364b7);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1428530..9782db2 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 _0x9d37=['vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','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','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','findOne','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','email','offlineMessageSubject','addInteraction','getInteractions','nolimit','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','info','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','getProactiveActions','virtual','License','increment','Intervals','push','all','some','server/files/chat/iframe.js','x-forwarded-for','x-real-ip','replace','render','alignment','verticalAlignment','transaction','ChatApplication','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','offlineForm','items','fromKey','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','type','VIRTUAL','merge','ChatWebsite','includeAll','include','findAll','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','describe','addDisposition','ChatWebsiteId','Disposition','pick','filter','map','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','sitepic','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','Applications','account','applications','List','orderBy','asc','ListId','firstName','lastName','customerIp','referer','browser','version','format','%s\x20%s','unknown','device'];(function(_0x56787b,_0x4a2c8b){var _0x2db61e=function(_0x4476fe){while(--_0x4476fe){_0x56787b['push'](_0x56787b['shift']());}};_0x2db61e(++_0x4a2c8b);}(_0x9d37,0x18b));var _0x79d3=function(_0x42f262,_0xaf603b){_0x42f262=_0x42f262-0x0;var _0x536f0b=_0x9d37[_0x42f262];return _0x536f0b;};'use strict';var pdf=require(_0x79d3('0x0'));var emlformat=require(_0x79d3('0x1'));var rimraf=require(_0x79d3('0x2'));var zipdir=require(_0x79d3('0x3'));var jsonpatch=require(_0x79d3('0x4'));var rp=require(_0x79d3('0x5'));var moment=require('moment');var BPromise=require(_0x79d3('0x6'));var Mustache=require(_0x79d3('0x7'));var util=require(_0x79d3('0x8'));var path=require(_0x79d3('0x9'));var sox=require(_0x79d3('0xa'));var csv=require(_0x79d3('0xb'));var ejs=require(_0x79d3('0xc'));var fs=require('fs');var _=require(_0x79d3('0xd'));var squel=require(_0x79d3('0xe'));var crypto=require(_0x79d3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x79d3('0x10'));var toCsv=require(_0x79d3('0xb'));var querystring=require(_0x79d3('0x11'));var Papa=require(_0x79d3('0x12'));var Redis=require(_0x79d3('0x13'));var authService=require(_0x79d3('0x14'));var qs=require(_0x79d3('0x15'));var hardwareService=require(_0x79d3('0x16'));var logger=require(_0x79d3('0x17'))('api');var utils=require(_0x79d3('0x18'));var config=require(_0x79d3('0x19'));var db=require(_0x79d3('0x1a'))['db'];config[_0x79d3('0x1b')]=_[_0x79d3('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79d3('0x1b')]));require(_0x79d3('0x1d'))[_0x79d3('0x1e')](socket);var jayson=require(_0x79d3('0x1f'));var client=jayson[_0x79d3('0x20')][_0x79d3('0x21')]({'port':0x232c});var client9002=jayson[_0x79d3('0x20')][_0x79d3('0x21')]({'port':0x232a});var client9003=jayson[_0x79d3('0x20')]['http']({'port':0x232b});function checkPasswordPattern(_0x40428e,_0x51ecba,_0x13f82e){if(_0x13f82e){var _0x514932=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x514932[_0x79d3('0x22')](_0x51ecba)){return _0x40428e;}else{throw new Error(_0x79d3('0x23'));}}else{return _0x40428e;}}function respondWithRpcPromise(_0x33ef50,_0x543989,_0x3f608c,_0x1aea63){return new BPromise(function(_0x519325,_0x98019d){var _0x891728=_0x1aea63||client;return _0x891728[_0x79d3('0x24')](_0x33ef50,_0x3f608c)['then'](function(_0x4abf2d){logger['info'](_0x79d3('0x25'),_0x543989,_0x79d3('0x26'));logger[_0x79d3('0x27')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x543989,'request\x20sent',JSON[_0x79d3('0x28')](_0x4abf2d));if(_0x4abf2d[_0x79d3('0x29')]){if(_0x4abf2d[_0x79d3('0x29')][_0x79d3('0x2a')]===0x1f4){logger[_0x79d3('0x29')](_0x79d3('0x25'),_0x543989,_0x4abf2d['error'][_0x79d3('0x2b')]);return _0x98019d(_0x4abf2d[_0x79d3('0x29')][_0x79d3('0x2b')]);}logger[_0x79d3('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x543989,_0x4abf2d[_0x79d3('0x29')][_0x79d3('0x2b')]);return _0x519325(_0x4abf2d[_0x79d3('0x29')][_0x79d3('0x2b')]);}else{logger['info'](_0x79d3('0x25'),_0x543989,'request\x20sent');_0x519325(_0x4abf2d[_0x79d3('0x2c')][_0x79d3('0x2b')]);}})[_0x79d3('0x2d')](function(_0x302f2c){logger['error'](_0x79d3('0x25'),_0x543989,_0x302f2c);_0x98019d(_0x302f2c);});});}function respondWithStatusCode(_0x5026b5,_0x156bd5){_0x156bd5=_0x156bd5||0xcc;return function(_0x2e96c0){if(_0x2e96c0){return _0x5026b5[_0x79d3('0x2e')](_0x156bd5);}return _0x5026b5[_0x79d3('0x2f')](_0x156bd5)[_0x79d3('0x30')]();};}function respondWithResult(_0x11be02,_0x296436){_0x296436=_0x296436||0xc8;return function(_0x2069dd){if(_0x2069dd){return _0x11be02[_0x79d3('0x2f')](_0x296436)[_0x79d3('0x31')](_0x2069dd);}};}function respondWithFilteredResult(_0x247591,_0x3b46f4){return function(_0x1d06a4){if(_0x1d06a4){var _0x8f06f6=_0x1d06a4[_0x79d3('0x32')],_0x5ca8e1=_0x3b46f4[_0x79d3('0x33')],_0x43885b=_0x3b46f4['offset']+_0x3b46f4[_0x79d3('0x34')],_0x3f72b7;if(_0x43885b>=_0x8f06f6){_0x43885b=_0x8f06f6;_0x3f72b7=0xc8;}else{_0x3f72b7=0xce;}_0x247591[_0x79d3('0x2f')](_0x3f72b7);return _0x247591[_0x79d3('0x35')]('Content-Range',_0x5ca8e1+'-'+_0x43885b+'/'+_0x8f06f6)[_0x79d3('0x31')](_0x1d06a4);}return null;};}function patchUpdates(_0x15b987){return function(_0xf1f101){try{jsonpatch[_0x79d3('0x36')](_0xf1f101,_0x15b987,!![]);}catch(_0xc260ae){return BPromise['reject'](_0xc260ae);}return _0xf1f101[_0x79d3('0x37')]();};}function saveUpdates(_0x204690,_0x4c85b2){return function(_0x37a8de){if(_0x37a8de){return _0x37a8de['update'](_0x204690)[_0x79d3('0x38')](function(_0x16f0b1){return _0x16f0b1;});}return null;};}function removeEntity(_0x52e6c3,_0x204b4f){return function(_0x4482d5){if(_0x4482d5){return _0x4482d5[_0x79d3('0x39')]()[_0x79d3('0x38')](function(){var _0x2182d5=_0x4482d5[_0x79d3('0x3a')]({'plain':!![]});var _0x571b9c=_0x79d3('0x3b');return db['UserProfileResource'][_0x79d3('0x39')]({'where':{'type':_0x571b9c,'resourceId':_0x2182d5['id']}})[_0x79d3('0x38')](function(){return _0x4482d5;});})[_0x79d3('0x38')](function(){_0x52e6c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xae929a,_0x3ca43a){return function(_0x1b34b1){if(!_0x1b34b1){_0xae929a[_0x79d3('0x2e')](0x194);}return _0x1b34b1;};}function handleError(_0x4b3c37,_0x567470){_0x567470=_0x567470||0x1f4;return function(_0x268cb6){logger[_0x79d3('0x29')](_0x268cb6[_0x79d3('0x3c')]);if(_0x268cb6[_0x79d3('0x3d')]){delete _0x268cb6[_0x79d3('0x3d')];}_0x4b3c37['status'](_0x567470)[_0x79d3('0x3e')](_0x268cb6);};}exports[_0x79d3('0x3f')]=function(_0x540193,_0x20ed4d){var _0x334a18={'include':[{'model':db[_0x79d3('0x40')],'as':_0x79d3('0x41')}]},_0x1cd1e3={},_0xac3859={'count':0x0,'rows':[]};var _0x3f79ee=db['ChatWebsite']['rawAttributes'];_0x1cd1e3[_0x79d3('0x42')]=_[_0x79d3('0x43')](_0x3f79ee);_0x1cd1e3[_0x79d3('0x44')]=_[_0x79d3('0x43')](_0x540193['query']);_0x1cd1e3[_0x79d3('0x45')]=_['intersection'](_0x1cd1e3[_0x79d3('0x42')],_0x1cd1e3[_0x79d3('0x44')]);_0x334a18['attributes']=_[_0x79d3('0x46')](_0x1cd1e3[_0x79d3('0x42')],qs[_0x79d3('0x47')](_0x540193[_0x79d3('0x44')][_0x79d3('0x47')]));_0x334a18['attributes']=_0x334a18[_0x79d3('0x48')][_0x79d3('0x49')]?_0x334a18[_0x79d3('0x48')]:_0x1cd1e3[_0x79d3('0x42')];if(!_0x540193[_0x79d3('0x44')][_0x79d3('0x4a')]('nolimit')){_0x334a18['limit']=qs['limit'](_0x540193[_0x79d3('0x44')][_0x79d3('0x34')]);_0x334a18[_0x79d3('0x33')]=qs[_0x79d3('0x33')](_0x540193[_0x79d3('0x44')][_0x79d3('0x33')]);}_0x334a18[_0x79d3('0x4b')]=qs['sort'](_0x540193[_0x79d3('0x44')][_0x79d3('0x4c')]);_0x334a18['where']=qs['filters'](_['pick'](_0x540193[_0x79d3('0x44')],_0x1cd1e3['filters']));if(_0x540193['query']['filter']){_0x334a18[_0x79d3('0x4d')]=_['merge'](_0x334a18[_0x79d3('0x4d')],{'$or':_['map'](_0x3f79ee,function(_0x50d3fe){if(_0x50d3fe[_0x79d3('0x4e')]['key']!==_0x79d3('0x4f')){var _0x7e87f6={};_0x7e87f6[_0x50d3fe['field']]={'$like':'%'+_0x540193['query']['filter']+'%'};return _0x7e87f6;}})});}_0x334a18=_[_0x79d3('0x50')]({},_0x334a18,_0x540193['options']);var _0x45732b={'where':_0x334a18[_0x79d3('0x4d')]};return db[_0x79d3('0x51')]['count'](_0x45732b)[_0x79d3('0x38')](function(_0x42ce77){_0xac3859[_0x79d3('0x32')]=_0x42ce77;if(_0x540193[_0x79d3('0x44')][_0x79d3('0x52')]){_0x334a18[_0x79d3('0x53')]=[{'all':!![]}];}return db['ChatWebsite'][_0x79d3('0x54')](_0x334a18);})['then'](function(_0x5c1217){_0xac3859['rows']=_0x5c1217;return _0xac3859;})[_0x79d3('0x38')](respondWithFilteredResult(_0x20ed4d,_0x334a18))[_0x79d3('0x2d')](handleError(_0x20ed4d,null));};exports['show']=function(_0x272e31,_0x4588b1){var _0x1ee67d={'raw':![],'where':{'id':_0x272e31[_0x79d3('0x55')]['id']},'include':[{'model':db[_0x79d3('0x40')],'as':'mandatoryDispositionPause'}]},_0x2d5a00={};_0x2d5a00['model']=_['keys'](db[_0x79d3('0x51')][_0x79d3('0x56')]);_0x2d5a00['query']=_[_0x79d3('0x43')](_0x272e31['query']);_0x2d5a00[_0x79d3('0x45')]=_[_0x79d3('0x46')](_0x2d5a00[_0x79d3('0x42')],_0x2d5a00['query']);_0x1ee67d[_0x79d3('0x48')]=_['intersection'](_0x2d5a00[_0x79d3('0x42')],qs[_0x79d3('0x47')](_0x272e31[_0x79d3('0x44')]['fields']));_0x1ee67d[_0x79d3('0x48')]=_0x1ee67d[_0x79d3('0x48')][_0x79d3('0x49')]?_0x1ee67d[_0x79d3('0x48')]:_0x2d5a00['model'];if(_0x272e31['query']['includeAll']){_0x1ee67d[_0x79d3('0x53')]=[{'all':!![]}];}_0x1ee67d=_[_0x79d3('0x50')]({},_0x1ee67d,_0x272e31[_0x79d3('0x57')]);return db[_0x79d3('0x51')][_0x79d3('0x58')](_0x1ee67d)[_0x79d3('0x38')](handleEntityNotFound(_0x4588b1,null))[_0x79d3('0x38')](respondWithResult(_0x4588b1,null))['catch'](handleError(_0x4588b1,null));};exports[_0x79d3('0x59')]=function(_0x355fbf,_0x7cfc54){return db[_0x79d3('0x51')][_0x79d3('0x59')](_0x355fbf[_0x79d3('0x5a')],{})[_0x79d3('0x38')](function(_0x17b4b3){var _0x3ddc00=_0x355fbf[_0x79d3('0x5b')][_0x79d3('0x3a')]({'plain':!![]});if(!_0x3ddc00)throw new Error(_0x79d3('0x5c'));if(_0x3ddc00[_0x79d3('0x5d')]==='user'){var _0x3d9167=_0x17b4b3[_0x79d3('0x3a')]({'plain':!![]});var _0x41d44e=_0x79d3('0x3b');return db[_0x79d3('0x5e')]['find']({'where':{'name':_0x41d44e,'userProfileId':_0x3ddc00[_0x79d3('0x5f')]},'raw':!![]})[_0x79d3('0x38')](function(_0x384bf5){if(_0x384bf5&&_0x384bf5[_0x79d3('0x60')]===0x0){return db[_0x79d3('0x61')][_0x79d3('0x59')]({'name':_0x3d9167['name'],'resourceId':_0x3d9167['id'],'type':_0x384bf5[_0x79d3('0x3d')],'sectionId':_0x384bf5['id']},{})[_0x79d3('0x38')](function(){return _0x17b4b3;});}else{return _0x17b4b3;}})[_0x79d3('0x2d')](function(_0x2d3931){logger[_0x79d3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d3931);throw _0x2d3931;});}return _0x17b4b3;})[_0x79d3('0x38')](respondWithResult(_0x7cfc54,0xc9))['catch'](handleError(_0x7cfc54,null));};exports[_0x79d3('0x62')]=function(_0x1542d1,_0x5219ef){if(_0x1542d1[_0x79d3('0x5a')]['id']){delete _0x1542d1[_0x79d3('0x5a')]['id'];}return db[_0x79d3('0x51')]['find']({'where':{'id':_0x1542d1[_0x79d3('0x55')]['id']},'include':[{'model':db[_0x79d3('0x40')],'as':_0x79d3('0x41')}]})['then'](handleEntityNotFound(_0x5219ef,null))['then'](saveUpdates(_0x1542d1[_0x79d3('0x5a')],null))[_0x79d3('0x38')](respondWithResult(_0x5219ef,null))[_0x79d3('0x2d')](handleError(_0x5219ef,null));};exports[_0x79d3('0x39')]=function(_0x33a277,_0x2af717){return db[_0x79d3('0x51')][_0x79d3('0x58')]({'where':{'id':_0x33a277['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x2af717,null))[_0x79d3('0x38')](removeEntity(_0x2af717,null))[_0x79d3('0x2d')](handleError(_0x2af717,null));};exports[_0x79d3('0x63')]=function(_0x1f9544,_0x5ef286){return db[_0x79d3('0x51')][_0x79d3('0x63')]()[_0x79d3('0x38')](respondWithResult(_0x5ef286,null))['catch'](handleError(_0x5ef286,null));};exports[_0x79d3('0x64')]=function(_0x3eb2d1,_0x16fed0,_0x5517a3){if(_0x3eb2d1[_0x79d3('0x5a')]['id']){delete _0x3eb2d1['body']['id'];}return db[_0x79d3('0x51')]['find']({'where':{'id':_0x3eb2d1['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x16fed0,null))['then'](function(_0x23aa80){if(_0x23aa80){_0x3eb2d1[_0x79d3('0x5a')][_0x79d3('0x65')]=_0x23aa80['id'];return db[_0x79d3('0x66')][_0x79d3('0x59')](_0x3eb2d1[_0x79d3('0x5a')]);}})[_0x79d3('0x38')](respondWithResult(_0x16fed0,null))[_0x79d3('0x2d')](handleError(_0x16fed0,null));};exports['getDispositions']=function(_0xa0e6a,_0x212f3b,_0x33c9c7){var _0x3ff60a={'raw':![],'where':{}};var _0x402d5d={};var _0x4c704c={'count':0x0,'rows':[]};return db[_0x79d3('0x51')]['findOne']({'where':{'id':_0xa0e6a[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x212f3b,null))[_0x79d3('0x38')](function(_0x50c4be){if(_0x50c4be){_0x402d5d['model']=_[_0x79d3('0x43')](db[_0x79d3('0x66')]['rawAttributes']);_0x402d5d[_0x79d3('0x44')]=_[_0x79d3('0x43')](_0xa0e6a['query']);_0x402d5d[_0x79d3('0x45')]=_[_0x79d3('0x46')](_0x402d5d[_0x79d3('0x42')],_0x402d5d[_0x79d3('0x44')]);_0x3ff60a[_0x79d3('0x48')]=_[_0x79d3('0x46')](_0x402d5d['model'],qs[_0x79d3('0x47')](_0xa0e6a[_0x79d3('0x44')][_0x79d3('0x47')]));_0x3ff60a[_0x79d3('0x48')]=_0x3ff60a[_0x79d3('0x48')][_0x79d3('0x49')]?_0x3ff60a[_0x79d3('0x48')]:_0x402d5d['model'];if(!_0xa0e6a['query']['hasOwnProperty']('nolimit')){_0x3ff60a[_0x79d3('0x34')]=qs[_0x79d3('0x34')](_0xa0e6a['query'][_0x79d3('0x34')]);_0x3ff60a[_0x79d3('0x33')]=qs[_0x79d3('0x33')](_0xa0e6a[_0x79d3('0x44')][_0x79d3('0x33')]);}_0x3ff60a[_0x79d3('0x4b')]=qs[_0x79d3('0x4c')](_0xa0e6a[_0x79d3('0x44')][_0x79d3('0x4c')]);_0x3ff60a['where']=qs[_0x79d3('0x45')](_[_0x79d3('0x67')](_0xa0e6a['query'],_0x402d5d[_0x79d3('0x45')]));_0x3ff60a[_0x79d3('0x4d')]['ChatWebsiteId']=_0x50c4be['id'];if(_0xa0e6a[_0x79d3('0x44')][_0x79d3('0x68')]){_0x3ff60a[_0x79d3('0x4d')]=_[_0x79d3('0x50')](_0x3ff60a[_0x79d3('0x4d')],{'$or':_[_0x79d3('0x69')](_0x3ff60a['attributes'],function(_0x322bf1){var _0x1d7f6c={};_0x1d7f6c[_0x322bf1]={'$like':'%'+_0xa0e6a[_0x79d3('0x44')][_0x79d3('0x68')]+'%'};return _0x1d7f6c;})});}_0x3ff60a=_['merge']({},_0x3ff60a,_0xa0e6a[_0x79d3('0x57')]);return db[_0x79d3('0x66')][_0x79d3('0x32')]({'where':_0x3ff60a['where']})[_0x79d3('0x38')](function(_0x58dfa2){_0x4c704c[_0x79d3('0x32')]=_0x58dfa2;if(_0xa0e6a[_0x79d3('0x44')][_0x79d3('0x52')]){_0x3ff60a[_0x79d3('0x53')]=[{'all':!![]}];}return db[_0x79d3('0x66')][_0x79d3('0x54')](_0x3ff60a);})[_0x79d3('0x38')](function(_0x34f800){_0x4c704c['rows']=_0x34f800;return _0x4c704c;});}})[_0x79d3('0x38')](respondWithFilteredResult(_0x212f3b,_0x3ff60a))[_0x79d3('0x2d')](handleError(_0x212f3b,null));};exports['removeDispositions']=function(_0x272015,_0x516abc,_0x12b3b7){return db[_0x79d3('0x51')]['find']({'where':{'id':_0x272015[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x516abc,null))[_0x79d3('0x38')](function(_0x14d49b){if(_0x14d49b){return _0x14d49b[_0x79d3('0x6a')](_0x272015[_0x79d3('0x44')][_0x79d3('0x6b')]);}})[_0x79d3('0x38')](respondWithStatusCode(_0x516abc,null))[_0x79d3('0x2d')](handleError(_0x516abc,null));};exports[_0x79d3('0x6c')]=function(_0x318865,_0x5bedab,_0x348610){if(_0x318865['body']['id']){delete _0x318865['body']['id'];}return db[_0x79d3('0x51')][_0x79d3('0x58')]({'where':{'id':_0x318865[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x5bedab,null))[_0x79d3('0x38')](function(_0x51743a){if(_0x51743a){_0x318865[_0x79d3('0x5a')][_0x79d3('0x65')]=_0x51743a['id'];return db[_0x79d3('0x6d')][_0x79d3('0x59')](_0x318865[_0x79d3('0x5a')]);}})[_0x79d3('0x38')](respondWithResult(_0x5bedab,null))[_0x79d3('0x2d')](handleError(_0x5bedab,null));};exports[_0x79d3('0x6e')]=function(_0x2eeb52,_0x7f79f6,_0x217ea0){var _0x32ab64={'raw':![],'where':{}};var _0x2e64ce={};var _0x371640={'count':0x0,'rows':[]};return db[_0x79d3('0x51')]['findOne']({'where':{'id':_0x2eeb52[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x7f79f6,null))[_0x79d3('0x38')](function(_0x56fedd){if(_0x56fedd){_0x2e64ce[_0x79d3('0x42')]=_[_0x79d3('0x43')](db[_0x79d3('0x6d')][_0x79d3('0x56')]);_0x2e64ce[_0x79d3('0x44')]=_[_0x79d3('0x43')](_0x2eeb52[_0x79d3('0x44')]);_0x2e64ce[_0x79d3('0x45')]=_[_0x79d3('0x46')](_0x2e64ce[_0x79d3('0x42')],_0x2e64ce[_0x79d3('0x44')]);_0x32ab64[_0x79d3('0x48')]=_['intersection'](_0x2e64ce[_0x79d3('0x42')],qs[_0x79d3('0x47')](_0x2eeb52[_0x79d3('0x44')]['fields']));_0x32ab64[_0x79d3('0x48')]=_0x32ab64[_0x79d3('0x48')][_0x79d3('0x49')]?_0x32ab64[_0x79d3('0x48')]:_0x2e64ce[_0x79d3('0x42')];if(!_0x2eeb52[_0x79d3('0x44')][_0x79d3('0x4a')]('nolimit')){_0x32ab64[_0x79d3('0x34')]=qs[_0x79d3('0x34')](_0x2eeb52[_0x79d3('0x44')][_0x79d3('0x34')]);_0x32ab64[_0x79d3('0x33')]=qs[_0x79d3('0x33')](_0x2eeb52[_0x79d3('0x44')][_0x79d3('0x33')]);}_0x32ab64[_0x79d3('0x4b')]=qs[_0x79d3('0x4c')](_0x2eeb52[_0x79d3('0x44')]['sort']);_0x32ab64[_0x79d3('0x4d')]=qs[_0x79d3('0x45')](_[_0x79d3('0x67')](_0x2eeb52[_0x79d3('0x44')],_0x2e64ce[_0x79d3('0x45')]));_0x32ab64[_0x79d3('0x4d')][_0x79d3('0x65')]=_0x56fedd['id'];if(_0x2eeb52['query'][_0x79d3('0x68')]){_0x32ab64[_0x79d3('0x4d')]=_[_0x79d3('0x50')](_0x32ab64[_0x79d3('0x4d')],{'$or':_[_0x79d3('0x69')](_0x32ab64[_0x79d3('0x48')],function(_0x475a24){var _0x4548d6={};_0x4548d6[_0x475a24]={'$like':'%'+_0x2eeb52[_0x79d3('0x44')][_0x79d3('0x68')]+'%'};return _0x4548d6;})});}_0x32ab64=_[_0x79d3('0x50')]({},_0x32ab64,_0x2eeb52['options']);return db[_0x79d3('0x6d')][_0x79d3('0x32')]({'where':_0x32ab64[_0x79d3('0x4d')]})[_0x79d3('0x38')](function(_0x5f51d0){_0x371640[_0x79d3('0x32')]=_0x5f51d0;if(_0x2eeb52[_0x79d3('0x44')][_0x79d3('0x52')]){_0x32ab64[_0x79d3('0x53')]=[{'all':!![]}];}return db[_0x79d3('0x6d')]['findAll'](_0x32ab64);})[_0x79d3('0x38')](function(_0xfb93ca){_0x371640[_0x79d3('0x6f')]=_0xfb93ca;return _0x371640;});}})[_0x79d3('0x38')](respondWithFilteredResult(_0x7f79f6,_0x32ab64))[_0x79d3('0x2d')](handleError(_0x7f79f6,null));};exports[_0x79d3('0x70')]=function(_0x3b5faf,_0x3bd335,_0x1a2108){return db[_0x79d3('0x51')][_0x79d3('0x58')]({'where':{'id':_0x3b5faf[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x3bd335,null))['then'](function(_0xa2682d){if(_0xa2682d){return _0xa2682d[_0x79d3('0x70')](_0x3b5faf[_0x79d3('0x44')][_0x79d3('0x6b')]);}})[_0x79d3('0x38')](respondWithStatusCode(_0x3bd335,null))[_0x79d3('0x2d')](handleError(_0x3bd335,null));};exports['addLogo']=function(_0x417c84,_0x16cec0,_0xd12939){_0x417c84[_0x79d3('0x5a')][_0x79d3('0x71')]=_0x417c84[_0x79d3('0x72')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x417c84[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x16cec0,null))[_0x79d3('0x38')](saveUpdates(_0x417c84[_0x79d3('0x5a')],null))['then'](respondWithResult(_0x16cec0,null))[_0x79d3('0x2d')](handleError(_0x16cec0,null));};exports[_0x79d3('0x73')]=function(_0x408b64,_0x3f68d5,_0x206d35){_0x408b64[_0x79d3('0x5a')][_0x79d3('0x74')]=_0x408b64['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x408b64['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x3f68d5,null))[_0x79d3('0x38')](saveUpdates(_0x408b64[_0x79d3('0x5a')],null))['then'](respondWithResult(_0x3f68d5,null))['catch'](handleError(_0x3f68d5,null));};exports[_0x79d3('0x75')]=function(_0x288b37,_0x51302c,_0x381cbd){_0x288b37[_0x79d3('0x5a')][_0x79d3('0x76')]=_0x288b37[_0x79d3('0x72')][_0x79d3('0x77')];return db[_0x79d3('0x51')][_0x79d3('0x58')]({'where':{'id':_0x288b37['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x51302c,null))[_0x79d3('0x38')](saveUpdates(_0x288b37[_0x79d3('0x5a')],null))['then'](respondWithResult(_0x51302c,null))[_0x79d3('0x2d')](handleError(_0x51302c,null));};exports[_0x79d3('0x78')]=function(_0x2c056a,_0x5c40bb,_0x540140){_0x2c056a[_0x79d3('0x5a')][_0x79d3('0x79')]=_0x2c056a[_0x79d3('0x72')][_0x79d3('0x77')];return db['ChatWebsite'][_0x79d3('0x58')]({'where':{'id':_0x2c056a['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x5c40bb,null))[_0x79d3('0x38')](saveUpdates(_0x2c056a['body'],null))[_0x79d3('0x38')](respondWithResult(_0x5c40bb,null))[_0x79d3('0x2d')](handleError(_0x5c40bb,null));};exports[_0x79d3('0x7a')]=function(_0x4006dc,_0x322739,_0x1f91aa){var _0x8aff85=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x7d'));var _0x52d07a={'where':{'id':_0x4006dc['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x48e008=![];return require(_0x79d3('0x7e'))[_0x79d3('0x7f')]()['then'](function(_0x40c9b4){if(_0x40c9b4){_0x48e008=_0x40c9b4['custom'];}})['then'](function(){return db[_0x79d3('0x51')][_0x79d3('0x58')](_0x52d07a);})[_0x79d3('0x38')](handleEntityNotFound(_0x322739,null))[_0x79d3('0x38')](function(_0x1395ba){if(_0x1395ba){if(!_[_0x79d3('0x80')](_0x1395ba[_0x79d3('0x71')])){if(fs[_0x79d3('0x81')](path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x82'),_0x1395ba[_0x79d3('0x71')]))&&_0x48e008){_0x8aff85=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x82'),_0x1395ba[_0x79d3('0x71')]);}}return _0x322739[_0x79d3('0x83')](_0x8aff85);}})[_0x79d3('0x2d')](handleError(_0x322739,null));};exports['getAvatar']=function(_0x74f47f,_0x67bba5,_0xc5810f){var _0x47d868=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],'server/files/images/avatars/default_avatar.png');var _0x3b7367={'where':{'id':_0x74f47f[_0x79d3('0x55')]['id']},'attributes':['id',_0x79d3('0x74')],'raw':!![]};return db[_0x79d3('0x51')][_0x79d3('0x58')](_0x3b7367)[_0x79d3('0x38')](handleEntityNotFound(_0x67bba5,null))[_0x79d3('0x38')](function(_0x561135){if(_0x561135){if(!_['isNil'](_0x561135['agentAvatar'])){if(fs[_0x79d3('0x81')](path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x84'),_0x561135[_0x79d3('0x74')]))){_0x47d868=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x84'),_0x561135[_0x79d3('0x74')]);}}return _0x67bba5[_0x79d3('0x83')](_0x47d868);}})[_0x79d3('0x2d')](handleError(_0x67bba5,null));};exports[_0x79d3('0x85')]=function(_0x552fe3,_0x43117a,_0xd3fc72){var _0x5b6d6c=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x86'));var _0x4a8dca={'where':{'id':_0x552fe3['params']['id']},'attributes':['id',_0x79d3('0x76'),_0x79d3('0x87')],'raw':!![]};return db[_0x79d3('0x51')][_0x79d3('0x58')](_0x4a8dca)['then'](handleEntityNotFound(_0x43117a,null))['then'](function(_0x324e3f){if(_0x324e3f){if(!_[_0x79d3('0x80')](_0x324e3f[_0x79d3('0x76')])){if(fs[_0x79d3('0x81')](path[_0x79d3('0x7b')](config['root'],_0x79d3('0x84'),_0x324e3f['customerAvatar']))&&_0x324e3f[_0x79d3('0x87')]){_0x5b6d6c=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x84'),_0x324e3f[_0x79d3('0x76')]);}}return _0x43117a['download'](_0x5b6d6c);}})[_0x79d3('0x2d')](handleError(_0x43117a,null));};exports[_0x79d3('0x88')]=function(_0x1674d2,_0x58c544,_0x3661d4){var _0x6bee0f=path[_0x79d3('0x7b')](config['root'],_0x79d3('0x89'));var _0x42169c={'where':{'id':_0x1674d2[_0x79d3('0x55')]['id']},'attributes':['id',_0x79d3('0x79')],'raw':!![]};return db['ChatWebsite'][_0x79d3('0x58')](_0x42169c)[_0x79d3('0x38')](handleEntityNotFound(_0x58c544,null))[_0x79d3('0x38')](function(_0x598397){if(_0x598397){if(!_['isNil'](_0x598397[_0x79d3('0x79')])){if(fs['existsSync'](path['join'](config['root'],_0x79d3('0x84'),_0x598397[_0x79d3('0x79')]))){_0x6bee0f=path[_0x79d3('0x7b')](config[_0x79d3('0x7c')],_0x79d3('0x84'),_0x598397[_0x79d3('0x79')]);}}return _0x58c544['download'](_0x6bee0f);}})[_0x79d3('0x2d')](handleError(_0x58c544,null));};exports[_0x79d3('0x8a')]=function(_0xf17b98,_0x53e066,_0xf29ccc){var _0x25bd45=require(_0x79d3('0x8b'));var _0xefa099=new _0x25bd45();var _0x2adec7=_0xefa099[_0x79d3('0x8c')](_0xf17b98[_0x79d3('0x8d')][_0x79d3('0x8e')])['getResult']();var _0x212f0c={'body':_0xf17b98[_0x79d3('0x5a')],'channel':_0x79d3('0x8f')};var _0x10f38a=[];var _0x47f270=[];var _0x2b7b47={};var _0x36f41a=![];return db[_0x79d3('0x90')][_0x79d3('0x63')]()[_0x79d3('0x38')](function(_0x11697e){if(!_0x11697e){throw new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0x93'));}_0x10f38a=_['difference'](_['keys'](_0x11697e),[_0x79d3('0x94'),_0x79d3('0x95')]);_0x47f270=_[_0x79d3('0x96')](_[_0x79d3('0x43')](_0x11697e),['createdAt',_0x79d3('0x95'),_0x79d3('0x97'),'ListId']);if(_0xf17b98[_0x79d3('0x5a')]['id']){delete _0xf17b98[_0x79d3('0x5a')]['id'];}if(_['isNil'](_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x98')])){throw new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0x99'));}if(_[_0x79d3('0x80')](_0xf17b98[_0x79d3('0x5a')]['body'])||_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x5a')]===''){throw new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0x9a'));}if(_['isNil'](_0xf17b98['body'][_0x79d3('0x9b')])){throw new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0x9c')+_0x47f270);}if(!_[_0x79d3('0x9d')](_0x47f270,_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x9b')])){throw new db['Sequelize'][(_0x79d3('0x92'))](_0x79d3('0x9e')+_0x47f270);}_0x2b7b47[_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x9b')]]=_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x98')];})[_0x79d3('0x38')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xf17b98[_0x79d3('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x79d3('0x9f'),'where':_0x2b7b47,'limit':0x1,'order':[[_0x79d3('0x95'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x79d3('0xa0')}]});})[_0x79d3('0x38')](handleEntityNotFound(_0x53e066,null))['then'](function(_0x573239){if(_0x573239&&_0x573239['List']){_0x212f0c[_0x79d3('0xa1')]=_0x573239;_0x212f0c[_0x79d3('0xa2')]=_0x573239[_0x79d3('0xa0')];_0x212f0c['list']=_0x573239[_0x79d3('0xa3')];_0x212f0c[_0x79d3('0xa2')]=_[_0x79d3('0xa4')](_0x212f0c['applications'],['priority'],[_0x79d3('0xa5')]);if(_0x212f0c['account'][_0x79d3('0xa0')]){delete _0x212f0c[_0x79d3('0xa1')]['Applications'];}if(_0x212f0c[_0x79d3('0xa1')]['List']&&_0x212f0c[_0x79d3('0xa1')][_0x79d3('0xa3')][_0x79d3('0x9f')][_0x79d3('0x49')]){return _0x212f0c[_0x79d3('0xa1')][_0x79d3('0xa3')][_0x79d3('0x9f')][0x0];}var _0x588608=_['defaults'](_0xf17b98[_0x79d3('0x5a')],{'firstName':_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x98')],'ListId':_0x573239[_0x79d3('0xa6')]});_0x588608[_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x9b')]]=_0xf17b98['body']['from'];return db['CmContact'][_0x79d3('0x59')](_0x588608,{'fields':_0x10f38a,'raw':!![]});}})[_0x79d3('0x38')](handleEntityNotFound(_0x53e066,null))['then'](function(_0x461126){_0x212f0c['contact']=_0x461126;if(_0x461126){var _0x81b913={'ContactId':_0x461126['id'],'ChatWebsiteId':_0xf17b98[_0x79d3('0x55')]['id'],'from':(_0x461126[_0x79d3('0xa7')]||'')+'\x20'+(_0x461126[_0x79d3('0xa8')]||''),'customerIp':_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xa9')],'referer':_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xaa')],'browserName':_0x2adec7[_0x79d3('0xab')][_0x79d3('0x3d')]&&_0x2adec7[_0x79d3('0xab')][_0x79d3('0xac')]?util[_0x79d3('0xad')](_0x79d3('0xae'),_0x2adec7[_0x79d3('0xab')][_0x79d3('0x3d')],_0x2adec7[_0x79d3('0xab')][_0x79d3('0xac')]):_0x79d3('0xaf'),'browserVersion':_0x2adec7[_0x79d3('0xab')][_0x79d3('0xac')]||_0x79d3('0xaf'),'osName':util[_0x79d3('0xad')]('%s\x20%s',_0x2adec7['os'][_0x79d3('0x3d')],_0x2adec7['os'][_0x79d3('0xac')]),'osVersion':_0x2adec7['os'][_0x79d3('0xac')],'deviceModel':_0x2adec7['device'][_0x79d3('0x42')]&&_0x2adec7[_0x79d3('0xb0')][_0x79d3('0xb1')]?util[_0x79d3('0xad')](_0x79d3('0xb2'),_0x2adec7[_0x79d3('0xb0')][_0x79d3('0x42')],_0x2adec7[_0x79d3('0xb0')]['vendor'],_0x2adec7[_0x79d3('0xb0')][_0x79d3('0x4e')]):null,'deviceVendor':_0x2adec7['device'][_0x79d3('0xb1')],'deviceType':_0x2adec7['device'][_0x79d3('0x4e')],'formData':JSON[_0x79d3('0x28')](_0xf17b98[_0x79d3('0x5a')])};var _0x36f035={'ChatWebsiteId':_0xf17b98['params']['id'],'closed':![]};if(_0xf17b98[_0x79d3('0x5a')]['threadId']){_0x36f035[_0x79d3('0xb3')]=_0xf17b98[_0x79d3('0x5a')]['threadId'];return db[_0x79d3('0xb4')][_0x79d3('0x58')]({'where':_0x36f035})['then'](function(_0x14a9a9){if(_0x14a9a9){return[_0x14a9a9,![]];}_0x81b913[_0x79d3('0xb3')]=_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xb3')];_0x81b913['externalUrl']=_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xb5')];return db['ChatInteraction'][_0x79d3('0x59')](_0x81b913)['then'](function(_0x306733){return[_0x306733,!![]];});});}_0x36f035[_0x79d3('0xb6')]=_0x461126['id'];if(_0xf17b98[_0x79d3('0x5a')]['interaction']&&_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xb7')]['id']){_0x36f035['id']=_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xb7')]['id'];return db[_0x79d3('0xb4')][_0x79d3('0x58')]({'where':_0x36f035})['then'](function(_0x18f650){if(_0x18f650){return[_0x18f650,![]];}return db['ChatInteraction'][_0x79d3('0x59')](_0x81b913)[_0x79d3('0x38')](function(_0x165214){return[_0x165214,!![]];});});}return db['ChatInteraction'][_0x79d3('0x59')](_0x81b913)[_0x79d3('0x38')](function(_0x12e130){return[_0x12e130,!![]];});}})[_0x79d3('0xb8')](function(_0x433778,_0x556e9c){if(_0x433778){_0x36f41a=_0x556e9c;if(!_0x556e9c){var _0x21519e={'from':(_0x212f0c[_0x79d3('0xb9')][_0x79d3('0xa7')]||'')+'\x20'+(_0x212f0c[_0x79d3('0xb9')][_0x79d3('0xa8')]||'')};if(_0xf17b98[_0x79d3('0x5a')]['threadId']&&_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xba')]&&_0xf17b98['body']['threadId']!=_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xba')]){_0x21519e[_0x79d3('0xb3')]=_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xba')];}return _0x433778[_0x79d3('0x62')](_0x21519e);}else{return _0x433778;}}})[_0x79d3('0x38')](function(_0x1af9f4){_0x212f0c[_0x79d3('0xb7')]=_0x1af9f4['get']({'plain':!![]});_0x212f0c['interaction'][_0x79d3('0xbb')]=_0x36f41a;if(_0x212f0c[_0x79d3('0xb7')]['created']){if(_0x212f0c[_0x79d3('0xa1')][_0x79d3('0xbc')]){_0x212f0c[_0x79d3('0xa2')]['push']({'id':0x0,'priority':_0x212f0c['applications'][_0x79d3('0x49')]+0x1,'app':_0x79d3('0xbd'),'appdata':_0x79d3('0xbe'),'interval':_0x79d3('0xbf')});}}return db[_0x79d3('0xc0')][_0x79d3('0x59')]({'body':_0xf17b98[_0x79d3('0x5a')][_0x79d3('0x5a')],'ChatWebsiteId':_0xf17b98['params']['id'],'ChatInteractionId':_0x1af9f4['id'],'direction':'in','ContactId':_0x212f0c[_0x79d3('0xb9')]['id'],'AttachmentId':_0xf17b98[_0x79d3('0x5a')][_0x79d3('0xc1')]});})[_0x79d3('0x38')](function(_0x22e9ca){_0x212f0c[_0x79d3('0x2b')]=_0x22e9ca;if(_0x212f0c[_0x79d3('0xb7')]['UserId']){return db[_0x79d3('0xc2')][_0x79d3('0x58')]({'attributes':['id',_0x79d3('0x3d')],'where':{'id':_0x212f0c[_0x79d3('0xb7')][_0x79d3('0xc3')]}})[_0x79d3('0x38')](function(_0x1d64df){if(_0x1d64df){_0x212f0c[_0x79d3('0xa2')][_0x79d3('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d64df[_0x79d3('0x3d')]+','+(_0x212f0c['account'][_0x79d3('0xc5')]||0xa),'interval':_0x79d3('0xbf')});_0x212f0c[_0x79d3('0xc6')]=!![];}return respondWithRpcPromise(_0x79d3('0xc7'),_0x79d3('0xc8'),_0x212f0c);});}return respondWithRpcPromise(_0x79d3('0xc7'),_0x79d3('0xc8'),_0x212f0c);})['then'](function(_0x2daeef){respondWithRpcPromise(_0x79d3('0xc9'),_0x79d3('0xc9'),{'event':_0x79d3('0x8a'),'message':_0x2daeef},client9002);return _0x2daeef;})[_0x79d3('0x38')](respondWithResult(_0x53e066,null))[_0x79d3('0x2d')](handleError(_0x53e066,null));};exports[_0x79d3('0xca')]=function(_0x4671b6,_0x4c9618,_0x550fbf){var _0x54da3f,_0x5dde29,_0x528db5;var _0xe3dd18=[];var _0xfc36e2=[];var _0x2e5de4={};return db[_0x79d3('0x90')][_0x79d3('0x63')]()[_0x79d3('0x38')](function(_0x458b99){if(!_0x458b99){throw new db['Sequelize']['ValidationError'](_0x79d3('0x93'));}_0xfc36e2=_[_0x79d3('0x96')](_[_0x79d3('0x43')](_0x458b99),[_0x79d3('0x94'),_0x79d3('0x95')]);_0xe3dd18=_[_0x79d3('0x96')](_[_0x79d3('0x43')](_0x458b99),[_0x79d3('0x94'),'updatedAt',_0x79d3('0x97'),_0x79d3('0xa6')]);if(_0x4671b6['body']['id']){delete _0x4671b6['body']['id'];}if(_[_0x79d3('0x80')](_0x4671b6[_0x79d3('0x5a')][_0x79d3('0x98')])){throw _0x4c9618[_0x79d3('0x2f')](0x1f4)[_0x79d3('0x3e')](new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0x99')));}if(_[_0x79d3('0x80')](_0x4671b6[_0x79d3('0x5a')][_0x79d3('0x5a')])||_0x4671b6[_0x79d3('0x5a')][_0x79d3('0x5a')]===''){throw _0x4c9618[_0x79d3('0x2f')](0x1f4)[_0x79d3('0x3e')](new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0x9a')));}if(_['isNil'](_0x4671b6[_0x79d3('0x5a')][_0x79d3('0xcb')])){throw _0x4c9618[_0x79d3('0x2f')](0x1f4)[_0x79d3('0x3e')](new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0xcc')+_0xe3dd18));}if(!_['includes'](_0xe3dd18,_0x4671b6[_0x79d3('0x5a')][_0x79d3('0xcb')])){throw _0x4c9618[_0x79d3('0x2f')](0x1f4)[_0x79d3('0x3e')](new db[(_0x79d3('0x91'))][(_0x79d3('0x92'))](_0x79d3('0xcd')+_0xe3dd18));}_0x2e5de4[_0x4671b6['body'][_0x79d3('0xcb')]]=_0x4671b6[_0x79d3('0x5a')]['from'];})['then'](function(){return db[_0x79d3('0x51')]['find']({'where':{'id':_0x4671b6[_0x79d3('0x55')]['id']},'include':[{'model':db[_0x79d3('0xce')],'as':_0x79d3('0xa3')}]});})[_0x79d3('0x38')](handleEntityNotFound(_0x4c9618,null))['then'](function(_0x272ae6){if(_0x272ae6&&_0x272ae6['List']){_0x5dde29=_0x272ae6;var _0x50862b=_[_0x79d3('0x1c')](_0x4671b6[_0x79d3('0x5a')],{'firstName':_0x4671b6[_0x79d3('0x5a')][_0x79d3('0x98')],'phone':_0x4671b6['body'][_0x79d3('0x98')],'ListId':_0x272ae6['ListId']});_0x50862b[_0x4671b6[_0x79d3('0x5a')]['mapKeyOffline']]=_0x4671b6[_0x79d3('0x5a')]['from'];return db[_0x79d3('0x90')][_0x79d3('0xcf')]({'where':_0x2e5de4,'defaults':_0x50862b});}})[_0x79d3('0xb8')](function(_0x51ba5a){if(_0x51ba5a){_0x528db5=_0x51ba5a;var _0x36f324=fs[_0x79d3('0xd0')](path[_0x79d3('0x7b')](config['root'],_0x79d3('0xd1')),_0x79d3('0xd2'));var _0x28d046=ejs['render'](_0x36f324,{'body':_[_0x79d3('0xd3')](_0x4671b6[_0x79d3('0x5a')][_0x79d3('0x5a')]),'bodyTitle':_0x5dde29[_0x79d3('0xd4')]});return db[_0x79d3('0xd5')][_0x79d3('0x59')]({'body':_0x28d046,'ContactId':_0x51ba5a['id'],'ChatWebsiteId':_0x5dde29['id']});}})[_0x79d3('0x38')](function(_0x5ab039){if(_0x5ab039){_0x54da3f=_0x5ab039;return db[_0x79d3('0xd6')][_0x79d3('0xd7')]({'where':{'service':!![]},'include':[{'model':db[_0x79d3('0xd8')],'as':_0x79d3('0xd9'),'raw':!![]}]});}})['then'](function(_0x4358c6){if(_0x4358c6&&_0x4358c6['Smtp']&&_0x5dde29[_0x79d3('0xda')]){var _0x1fb95b={'tls':{'rejectUnauthorized':![]}};if(_0x4358c6[_0x79d3('0xd9')]['service']){_0x1fb95b[_0x79d3('0xdb')]=_0x4358c6[_0x79d3('0xd9')][_0x79d3('0xdb')];}else{_0x1fb95b['host']=_0x4358c6[_0x79d3('0xd9')]['host'];_0x1fb95b['port']=_0x4358c6[_0x79d3('0xd9')][_0x79d3('0xdc')];_0x1fb95b['secure']=_0x4358c6['Smtp'][_0x79d3('0xdd')];}if(_0x4358c6[_0x79d3('0xd9')][_0x79d3('0xde')]){_0x1fb95b[_0x79d3('0xdf')]={'user':_0x4358c6[_0x79d3('0xd9')][_0x79d3('0x5b')],'pass':_0x4358c6['Smtp'][_0x79d3('0xe0')]};}return respondWithRpcPromise(_0x79d3('0xe1'),'sendMail',{'account':_0x1fb95b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4358c6[_0x79d3('0x3d')],_0x4358c6[_0x79d3('0xe2')]||_0x4358c6['Smtp'][_0x79d3('0x5b')]),'to':_0x5dde29['forwardOfflineAddress'],'subject':_0x5dde29[_0x79d3('0xe3')],'text':_0x54da3f[_0x79d3('0x5a')]}},client9003)[_0x79d3('0x38')](function(){return _0x54da3f;})[_0x79d3('0x2d')](function(_0x3b1979){console[_0x79d3('0x29')](_0x3b1979);});}})[_0x79d3('0x38')](function(){if(_0x54da3f){return _0x54da3f;}})[_0x79d3('0x38')](respondWithResult(_0x4c9618,null))[_0x79d3('0x2d')](handleError(_0x4c9618,null));};exports[_0x79d3('0xe4')]=function(_0x109981,_0x1313b6,_0x4541c8){return db[_0x79d3('0xb4')]['find']({'where':{'id':_0x109981[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x1313b6,null))['then'](function(_0x1f061b){if(_0x1f061b){return _0x1f061b[_0x79d3('0xe4')](_0x109981[_0x79d3('0x5a')][_0x79d3('0x6b')],_['omit'](_0x109981[_0x79d3('0x5a')],[_0x79d3('0x6b'),'id'])||{});}})[_0x79d3('0x38')](respondWithResult(_0x1313b6,null))[_0x79d3('0x2d')](handleError(_0x1313b6,null));};exports[_0x79d3('0xe5')]=function(_0x4a701d,_0x5b9a22,_0x28b071){var _0x3add76={'raw':![],'where':{}};var _0x5f535f={};var _0x11532f={'count':0x0,'rows':[]};return db[_0x79d3('0x51')][_0x79d3('0xd7')]({'where':{'id':_0x4a701d['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x5b9a22,null))['then'](function(_0x10c5cf){if(_0x10c5cf){_0x5f535f[_0x79d3('0x42')]=_[_0x79d3('0x43')](db['ChatInteraction']['rawAttributes']);_0x5f535f[_0x79d3('0x44')]=_['keys'](_0x4a701d['query']);_0x5f535f[_0x79d3('0x45')]=_['intersection'](_0x5f535f['model'],_0x5f535f[_0x79d3('0x44')]);_0x3add76[_0x79d3('0x48')]=_[_0x79d3('0x46')](_0x5f535f[_0x79d3('0x42')],qs['fields'](_0x4a701d[_0x79d3('0x44')][_0x79d3('0x47')]));_0x3add76[_0x79d3('0x48')]=_0x3add76['attributes'][_0x79d3('0x49')]?_0x3add76[_0x79d3('0x48')]:_0x5f535f[_0x79d3('0x42')];if(!_0x4a701d['query'][_0x79d3('0x4a')](_0x79d3('0xe6'))){_0x3add76[_0x79d3('0x34')]=qs['limit'](_0x4a701d[_0x79d3('0x44')][_0x79d3('0x34')]);_0x3add76[_0x79d3('0x33')]=qs['offset'](_0x4a701d[_0x79d3('0x44')]['offset']);}_0x3add76[_0x79d3('0x4b')]=qs['sort'](_0x4a701d[_0x79d3('0x44')][_0x79d3('0x4c')]);_0x3add76[_0x79d3('0x4d')]=qs[_0x79d3('0x45')](_[_0x79d3('0x67')](_0x4a701d[_0x79d3('0x44')],_0x5f535f[_0x79d3('0x45')]));_0x3add76['where'][_0x79d3('0x65')]=_0x10c5cf['id'];if(_0x4a701d['query']['filter']){_0x3add76[_0x79d3('0x4d')]=_[_0x79d3('0x50')](_0x3add76['where'],{'$or':_[_0x79d3('0x69')](_0x3add76['attributes'],function(_0x597f64){var _0x191670={};_0x191670[_0x597f64]={'$like':'%'+_0x4a701d[_0x79d3('0x44')][_0x79d3('0x68')]+'%'};return _0x191670;})});}_0x3add76=_[_0x79d3('0x50')]({},_0x3add76,_0x4a701d[_0x79d3('0x57')]);return db[_0x79d3('0xb4')][_0x79d3('0x32')]({'where':_0x3add76[_0x79d3('0x4d')]})['then'](function(_0xfc5dc0){_0x11532f[_0x79d3('0x32')]=_0xfc5dc0;if(_0x4a701d[_0x79d3('0x44')][_0x79d3('0x52')]){_0x3add76['include']=[{'model':db['CmContact'],'as':_0x79d3('0xe7'),'required':![]},{'model':db[_0x79d3('0xc2')],'as':_0x79d3('0xe8'),'attributes':[_0x79d3('0x3d'),_0x79d3('0xe9'),_0x79d3('0xea')],'required':![]},{'model':db[_0x79d3('0xeb')],'as':_0x79d3('0xec'),'attributes':['id',_0x79d3('0x3d'),'color'],'where':_0x4a701d['query'][_0x79d3('0xed')]?{'id':_0x4a701d[_0x79d3('0x44')][_0x79d3('0xed')]}:undefined,'required':_0x4a701d[_0x79d3('0x44')][_0x79d3('0xed')]?!![]:![]}];}return db[_0x79d3('0xb4')]['findAll'](_0x3add76);})[_0x79d3('0x38')](function(_0x1fa293){_0x11532f[_0x79d3('0x6f')]=_0x1fa293;return _0x11532f;});}})[_0x79d3('0x38')](respondWithFilteredResult(_0x5b9a22,_0x3add76))['catch'](handleError(_0x5b9a22,null));};function iftimePromise(_0x49471b,_0x1ba2ca){return respondWithRpcPromise(_0x79d3('0xee'),_0x79d3('0xef'),{'command':_0x1ba2ca[_0x79d3('0xf0')]?util[_0x79d3('0xad')](_0x79d3('0xf1'),_0x49471b[_0x79d3('0xf2')],_0x1ba2ca[_0x79d3('0xf0')]):util[_0x79d3('0xad')](_0x79d3('0xf3'),_0x49471b['interval'])},client9002)['then'](function(_0xbd0f0d){var _0x102320=_0xbd0f0d&&_0xbd0f0d[_0x79d3('0xf4')]('true')>=0x0?!![]:![];logger[_0x79d3('0xf5')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1ba2ca['id'],_0x49471b['id'],_0x49471b['interval'],_0x102320?_0x79d3('0xf6'):_0x79d3('0xf7'),_0x1ba2ca[_0x79d3('0xf0')]?_0x1ba2ca[_0x79d3('0xf0')]:_0x79d3('0xf8'));return _0x102320;})['catch'](function(_0x54d1b4){logger[_0x79d3('0x29')](_0x79d3('0xf9'),_0x1ba2ca['id'],_0x49471b['id'],_0x49471b[_0x79d3('0xf2')],util[_0x79d3('0xfa')](_0x54d1b4,{'showHidden':![],'depth':null}),_0x1ba2ca[_0x79d3('0xf0')]?_0x1ba2ca[_0x79d3('0xf0')]:_0x79d3('0xf8'));return![];});}exports['getSnippet']=function(_0xf0b90a,_0xc11cbf,_0x408772){var _0x49c1c0=0x0;var _0x53f0e0=0x0;var _0x29c1a7=![];var _0x1c8b6e;var _0x21ce59;return db[_0x79d3('0x51')]['find']({'where':{'id':_0xf0b90a[_0x79d3('0x55')]['id']},'include':[{'model':db[_0x79d3('0xfb')],'as':_0x79d3('0xfb'),'include':[{'model':db[_0x79d3('0xfb')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0xc11cbf,null))['then'](function(_0x25b709){if(_0x25b709){_0x1c8b6e=_0x25b709;return _0x25b709[_0x79d3('0xfc')]({'raw':!![]});}})['then'](function(_0x2f81a6){if(_0x1c8b6e){if(_0x2f81a6){_0x21ce59=_0x2f81a6;}}return require(_0x79d3('0x7e'))[_0x79d3('0x7f')]();})[_0x79d3('0x38')](function(_0x4a8bef){if(_0x4a8bef){_0x53f0e0=_0x4a8bef[_0x79d3('0xfd')];_0x29c1a7=_0x4a8bef['custom'];}})[_0x79d3('0x38')](function(){return db[_0x79d3('0xb4')][_0x79d3('0x32')]({'where':{'closed':![]}});})[_0x79d3('0x38')](function(_0x13473d){_0x49c1c0=_0x13473d;if(_0x53f0e0&&_0x13473d>_0x53f0e0){return db[_0x79d3('0xfe')][_0x79d3('0xd7')]({'where':{'id':0x1}})[_0x79d3('0x38')](function(_0x72b6b2){if(_0x72b6b2){_0x72b6b2[_0x79d3('0xff')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x1c8b6e[_0x79d3('0xfb')]&&_0x1c8b6e['Interval'][_0x79d3('0x100')]){var _0x5d4813=[];for(var _0x35a273=0x0;_0x35a273<_0x1c8b6e[_0x79d3('0xfb')][_0x79d3('0x100')][_0x79d3('0x49')];_0x35a273++){var _0x459078=_0x1c8b6e[_0x79d3('0xfb')][_0x79d3('0x100')][_0x35a273][_0x79d3('0x3a')]({'plain':!![]});_0x5d4813[_0x79d3('0x101')](iftimePromise(_0x459078,_0x1c8b6e));}return BPromise[_0x79d3('0x102')](_0x5d4813)[_0x79d3('0x38')](function(_0x5b29db){return _[_0x79d3('0x103')](_0x5b29db);});}else{return!![];}})['then'](function(_0x50d9b1){var _0x182bc9=fs[_0x79d3('0xd0')](path['join'](config[_0x79d3('0x7c')],_0x79d3('0x104')),_0x79d3('0xd2'));var _0x360e6c={'remote':_0x1c8b6e['remote'],'query':querystring[_0x79d3('0x28')](_[_0x79d3('0x50')](_0x1c8b6e[_0x79d3('0x3a')]({'plain':!![]}),{'customerIp':_0xf0b90a[_0x79d3('0x8d')][_0x79d3('0x105')]||_0xf0b90a['headers'][_0x79d3('0x106')]||_0xf0b90a['connection']['remoteAddress']||_0xf0b90a['ip'],'referer':_0xf0b90a[_0x79d3('0x8d')][_0x79d3('0xaa')],'openedInteractions':_0x49c1c0,'maxInteractions':_0x53f0e0,'virtual':_0x29c1a7[_0x79d3('0xfd')],'online':_0x50d9b1,'custom':_0x29c1a7}))[_0x79d3('0x107')](/'/g,'\x5c\x27')};_0xc11cbf['send'](ejs[_0x79d3('0x108')](Mustache[_0x79d3('0x108')](_0x182bc9,_0x360e6c),{'proactiveActions':_0x21ce59,'alignment':_0x1c8b6e[_0x79d3('0x109')],'verticalAlignment':_0x1c8b6e[_0x79d3('0x10a')]}));})[_0x79d3('0x2d')](handleError(_0xc11cbf,null));};exports['addApplications']=function(_0xa49c46,_0x3d5b59,_0x5aad7d){return db[_0x79d3('0x51')]['findOne']({'where':{'id':_0xa49c46[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x3d5b59,null))[_0x79d3('0x38')](function(_0x2be6f4){if(_0x2be6f4){return db['sequelize'][_0x79d3('0x10b')](function(_0x338b02){return db[_0x79d3('0x10c')][_0x79d3('0x39')]({'where':{'ChatWebsiteId':_0xa49c46[_0x79d3('0x55')]['id']},'transaction':_0x338b02})[_0x79d3('0x38')](function(_0x381fe8){var _0x37e8d8=_['map'](_0xa49c46[_0x79d3('0x5a')],function(_0x10ebd6){_0x10ebd6[_0x79d3('0x65')]=_0xa49c46[_0x79d3('0x55')]['id'];return _0x10ebd6;});return db['ChatApplication'][_0x79d3('0x10d')](_0x37e8d8,{'transaction':_0x338b02});});})[_0x79d3('0x38')](function(){return db[_0x79d3('0x10c')]['findAndCountAll']({'where':{'ChatWebsiteId':_0xa49c46[_0x79d3('0x55')]['id']},'order':'priority'});});}})[_0x79d3('0x38')](respondWithResult(_0x3d5b59,null))[_0x79d3('0x2d')](handleError(_0x3d5b59,null));};exports[_0x79d3('0x10e')]=function(_0x19e1ae,_0x3d55eb,_0x11cf16){var _0x20342d={};var _0x2004d8={};var _0x4f9b0b;var _0x4bd05c;return db[_0x79d3('0x51')][_0x79d3('0xd7')]({'where':{'id':_0x19e1ae[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x3d55eb,null))['then'](function(_0x4e4054){if(_0x4e4054){_0x4f9b0b=_0x4e4054;_0x2004d8[_0x79d3('0x42')]=_[_0x79d3('0x43')](db['ChatApplication'][_0x79d3('0x56')]);_0x2004d8[_0x79d3('0x44')]=_[_0x79d3('0x43')](_0x19e1ae[_0x79d3('0x44')]);_0x2004d8[_0x79d3('0x45')]=_['intersection'](_0x2004d8[_0x79d3('0x42')],_0x2004d8['query']);_0x20342d['attributes']=_['intersection'](_0x2004d8[_0x79d3('0x42')],qs[_0x79d3('0x47')](_0x19e1ae[_0x79d3('0x44')][_0x79d3('0x47')]));_0x20342d[_0x79d3('0x48')]=_0x20342d[_0x79d3('0x48')][_0x79d3('0x49')]?_0x20342d[_0x79d3('0x48')]:_0x2004d8[_0x79d3('0x42')];_0x20342d['order']=qs['sort'](_0x19e1ae[_0x79d3('0x44')][_0x79d3('0x4c')]);_0x20342d['where']=qs[_0x79d3('0x45')](_[_0x79d3('0x67')](_0x19e1ae[_0x79d3('0x44')],_0x2004d8[_0x79d3('0x45')]));if(_0x19e1ae[_0x79d3('0x44')][_0x79d3('0x68')]){_0x20342d[_0x79d3('0x4d')]=_[_0x79d3('0x50')](_0x20342d[_0x79d3('0x4d')],{'$or':_[_0x79d3('0x69')](_0x20342d[_0x79d3('0x48')],function(_0x2221b7){var _0x155a31={};_0x155a31[_0x2221b7]={'$like':'%'+_0x19e1ae[_0x79d3('0x44')]['filter']+'%'};return _0x155a31;})});}_0x20342d=_[_0x79d3('0x50')]({},_0x20342d,_0x19e1ae['options']);return _0x4f9b0b[_0x79d3('0x10e')](_0x20342d);}})['then'](function(_0x4ea3c6){if(_0x4ea3c6){_0x4bd05c=_0x4ea3c6[_0x79d3('0x49')];if(!_0x19e1ae[_0x79d3('0x44')][_0x79d3('0x4a')]('nolimit')){_0x20342d[_0x79d3('0x34')]=qs[_0x79d3('0x34')](_0x19e1ae['query'][_0x79d3('0x34')]);_0x20342d['offset']=qs[_0x79d3('0x33')](_0x19e1ae[_0x79d3('0x44')][_0x79d3('0x33')]);}return _0x4f9b0b['getApplications'](_0x20342d);}})[_0x79d3('0x38')](function(_0x2e8aa8){if(_0x2e8aa8){return _0x2e8aa8?{'count':_0x4bd05c,'rows':_0x2e8aa8}:null;}})[_0x79d3('0x38')](respondWithResult(_0x3d55eb,null))[_0x79d3('0x2d')](handleError(_0x3d55eb,null));};exports[_0x79d3('0x10f')]=function(_0x4088b2,_0x157006,_0x4a3b67){return db[_0x79d3('0x110')][_0x79d3('0x58')]({'where':{'id':_0x4088b2['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x157006,null))[_0x79d3('0x38')](function(_0x333458){if(_0x333458){return _0x333458['addProactiveActions'](_0x4088b2['body'][_0x79d3('0x6b')],_[_0x79d3('0x111')](_0x4088b2[_0x79d3('0x5a')],['ids','id'])||{});}})[_0x79d3('0x38')](respondWithResult(_0x157006,null))[_0x79d3('0x2d')](handleError(_0x157006,null));};exports[_0x79d3('0xfc')]=function(_0x42c0e9,_0x5a29a3,_0x16b5ca){var _0x6a0d95={};var _0x533533={};var _0x2bf36f;var _0x18e756;return db[_0x79d3('0x51')][_0x79d3('0xd7')]({'where':{'id':_0x42c0e9[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x5a29a3,null))[_0x79d3('0x38')](function(_0x5e47d3){if(_0x5e47d3){_0x2bf36f=_0x5e47d3;_0x533533[_0x79d3('0x42')]=_[_0x79d3('0x43')](db['ChatProactiveAction'][_0x79d3('0x56')]);_0x533533[_0x79d3('0x44')]=_[_0x79d3('0x43')](_0x42c0e9['query']);_0x533533['filters']=_[_0x79d3('0x46')](_0x533533['model'],_0x533533[_0x79d3('0x44')]);_0x6a0d95[_0x79d3('0x48')]=_[_0x79d3('0x46')](_0x533533[_0x79d3('0x42')],qs[_0x79d3('0x47')](_0x42c0e9[_0x79d3('0x44')][_0x79d3('0x47')]));_0x6a0d95['attributes']=_0x6a0d95[_0x79d3('0x48')][_0x79d3('0x49')]?_0x6a0d95['attributes']:_0x533533[_0x79d3('0x42')];_0x6a0d95[_0x79d3('0x4b')]=qs[_0x79d3('0x4c')](_0x42c0e9[_0x79d3('0x44')]['sort']);_0x6a0d95[_0x79d3('0x4d')]=qs[_0x79d3('0x45')](_[_0x79d3('0x67')](_0x42c0e9[_0x79d3('0x44')],_0x533533[_0x79d3('0x45')]));if(_0x42c0e9[_0x79d3('0x44')][_0x79d3('0x68')]){_0x6a0d95[_0x79d3('0x4d')]=_['merge'](_0x6a0d95[_0x79d3('0x4d')],{'$or':_['map'](_0x6a0d95[_0x79d3('0x48')],function(_0x4820a7){var _0x441c72={};_0x441c72[_0x4820a7]={'$like':'%'+_0x42c0e9[_0x79d3('0x44')]['filter']+'%'};return _0x441c72;})});}_0x6a0d95=_[_0x79d3('0x50')]({},_0x6a0d95,_0x42c0e9['options']);return _0x2bf36f[_0x79d3('0xfc')](_0x6a0d95);}})[_0x79d3('0x38')](function(_0x1c5f0b){if(_0x1c5f0b){_0x18e756=_0x1c5f0b[_0x79d3('0x49')];if(!_0x42c0e9[_0x79d3('0x44')][_0x79d3('0x4a')](_0x79d3('0xe6'))){_0x6a0d95[_0x79d3('0x34')]=qs[_0x79d3('0x34')](_0x42c0e9[_0x79d3('0x44')]['limit']);_0x6a0d95['offset']=qs[_0x79d3('0x33')](_0x42c0e9[_0x79d3('0x44')][_0x79d3('0x33')]);}return _0x2bf36f['getProactiveActions'](_0x6a0d95);}})['then'](function(_0x5c654c){if(_0x5c654c){return _0x5c654c?{'count':_0x18e756,'rows':_0x5c654c}:null;}})[_0x79d3('0x38')](respondWithResult(_0x5a29a3,null))['catch'](handleError(_0x5a29a3,null));};exports[_0x79d3('0x112')]=function(_0x1bd5cd,_0x1ee508,_0x56ffdf){var _0x413362=_0x1bd5cd[_0x79d3('0x44')][_0x79d3('0x113')]==='false'?_0x79d3('0x114'):'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x413362],'where':{'id':_0x1bd5cd['params']['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x1ee508,null))[_0x79d3('0x38')](function(_0x2d02a0){if(_0x2d02a0){var _0x258c70=_0x2d02a0[_0x413362];var _0x34c0d9=_0x258c70&&_0x258c70[_0x79d3('0x115')]?_0x258c70[_0x79d3('0x115')]:[];_0x1ee508[_0x79d3('0x3e')]({'fromKey':_[_0x79d3('0x80')](_0x258c70[_0x79d3('0x116')])?undefined:_0x258c70[_0x79d3('0x116')],'count':_0x34c0d9[_0x79d3('0x49')],'rows':_0x34c0d9});}})[_0x79d3('0x2d')](handleError(_0x1ee508,null));};exports[_0x79d3('0x117')]=function(_0x28e8a5,_0x4f58b5,_0x559457){var _0x4996b5={'raw':!![],'where':{}};var _0x29b3e1={};var _0x582abd={'count':0x0,'rows':[]};return db[_0x79d3('0x51')][_0x79d3('0xd7')]({'where':{'id':_0x28e8a5[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x4f58b5,null))[_0x79d3('0x38')](function(_0x5c2212){if(_0x5c2212){_0x29b3e1[_0x79d3('0x42')]=_[_0x79d3('0x43')](db[_0x79d3('0xd5')][_0x79d3('0x56')]);_0x29b3e1[_0x79d3('0x44')]=_['keys'](_0x28e8a5[_0x79d3('0x44')]);_0x29b3e1['filters']=_[_0x79d3('0x46')](_0x29b3e1[_0x79d3('0x42')],_0x29b3e1['query']);_0x4996b5[_0x79d3('0x48')]=_[_0x79d3('0x46')](_0x29b3e1[_0x79d3('0x42')],qs['fields'](_0x28e8a5[_0x79d3('0x44')]['fields']));_0x4996b5[_0x79d3('0x48')]=_0x4996b5[_0x79d3('0x48')]['length']?_0x4996b5['attributes']:_0x29b3e1[_0x79d3('0x42')];if(!_0x28e8a5[_0x79d3('0x44')][_0x79d3('0x4a')](_0x79d3('0xe6'))){_0x4996b5[_0x79d3('0x34')]=qs[_0x79d3('0x34')](_0x28e8a5[_0x79d3('0x44')][_0x79d3('0x34')]);_0x4996b5[_0x79d3('0x33')]=qs[_0x79d3('0x33')](_0x28e8a5['query']['offset']);}_0x4996b5[_0x79d3('0x4b')]=qs['sort'](_0x28e8a5[_0x79d3('0x44')]['sort']);_0x4996b5[_0x79d3('0x4d')]=qs[_0x79d3('0x45')](_['pick'](_0x28e8a5['query'],_0x29b3e1['filters']));_0x4996b5[_0x79d3('0x4d')][_0x79d3('0x65')]=_0x5c2212['id'];if(_0x28e8a5[_0x79d3('0x44')][_0x79d3('0x68')]){_0x4996b5[_0x79d3('0x4d')]=_['merge'](_0x4996b5[_0x79d3('0x4d')],{'$or':_[_0x79d3('0x69')](_0x4996b5[_0x79d3('0x48')],function(_0x37f2c2){var _0x4e21fb={};_0x4e21fb[_0x37f2c2]={'$like':'%'+_0x28e8a5[_0x79d3('0x44')][_0x79d3('0x68')]+'%'};return _0x4e21fb;})});}_0x4996b5=_[_0x79d3('0x50')]({},_0x4996b5,_0x28e8a5[_0x79d3('0x57')]);return db['ChatOfflineMessage'][_0x79d3('0x32')]({'where':_0x4996b5['where']})[_0x79d3('0x38')](function(_0x200e72){_0x582abd[_0x79d3('0x32')]=_0x200e72;if(_0x28e8a5[_0x79d3('0x44')][_0x79d3('0x52')]){_0x4996b5['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x79d3('0x54')](_0x4996b5);})[_0x79d3('0x38')](function(_0x550a3c){_0x582abd['rows']=_0x550a3c;return _0x582abd;});}})[_0x79d3('0x38')](respondWithFilteredResult(_0x4f58b5,_0x4996b5))['catch'](handleError(_0x4f58b5,null));};exports['addAgents']=function(_0x1cbea0,_0x504ee0,_0x5ce266){return db[_0x79d3('0x51')][_0x79d3('0x58')]({'where':{'id':_0x1cbea0[_0x79d3('0x55')]['id']}})['then'](handleEntityNotFound(_0x504ee0,null))['then'](function(_0x2ea15f){if(_0x2ea15f){return _0x2ea15f['addAgents'](_0x1cbea0['body'][_0x79d3('0x6b')],_[_0x79d3('0x111')](_0x1cbea0[_0x79d3('0x5a')],[_0x79d3('0x6b'),'id'])||{})[_0x79d3('0xb8')](function(_0x2d523c){for(var _0x41f939=0x0;_0x41f939<_0x1cbea0[_0x79d3('0x5a')][_0x79d3('0x6b')][_0x79d3('0x49')];_0x41f939+=0x1){socket[_0x79d3('0x118')](_0x79d3('0x119'),{'UserId':_0x1cbea0[_0x79d3('0x5a')]['ids'][_0x41f939],'ChatWebsiteId':_0x1cbea0[_0x79d3('0x55')]['id']});}return _0x2d523c;});}})[_0x79d3('0x38')](respondWithResult(_0x504ee0,null))[_0x79d3('0x2d')](handleError(_0x504ee0,null));};exports[_0x79d3('0x11a')]=function(_0x2a75e1,_0x1a57a3,_0x1aeadd){return db['ChatWebsite'][_0x79d3('0x58')]({'where':{'id':_0x2a75e1[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x1a57a3,null))[_0x79d3('0x38')](function(_0x542e08){if(_0x542e08){return _0x542e08['removeAgents'](_0x2a75e1[_0x79d3('0x44')][_0x79d3('0x6b')])[_0x79d3('0x38')](function(){if(_[_0x79d3('0x11b')](_0x2a75e1[_0x79d3('0x44')]['ids'])){for(var _0x5c1e9e=0x0;_0x5c1e9e<_0x2a75e1[_0x79d3('0x44')][_0x79d3('0x6b')][_0x79d3('0x49')];_0x5c1e9e+=0x1){socket[_0x79d3('0x118')]('userChatWebsite:remove',{'UserId':Number(_0x2a75e1[_0x79d3('0x44')]['ids'][_0x5c1e9e]),'ChatWebsiteId':Number(_0x2a75e1[_0x79d3('0x55')]['id'])});}}else{socket[_0x79d3('0x118')](_0x79d3('0x11c'),{'UserId':Number(_0x2a75e1[_0x79d3('0x44')]['ids']),'ChatWebsiteId':Number(_0x2a75e1['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1a57a3,null))[_0x79d3('0x2d')](handleError(_0x1a57a3,null));};exports[_0x79d3('0x11d')]=function(_0x660e42,_0x26b61a,_0x1423f){var _0x39005f={};var _0x59f9db={};var _0x492b95;var _0x1091ef;return db['ChatWebsite'][_0x79d3('0xd7')]({'where':{'id':_0x660e42[_0x79d3('0x55')]['id']}})[_0x79d3('0x38')](handleEntityNotFound(_0x26b61a,null))[_0x79d3('0x38')](function(_0x50ce18){if(_0x50ce18){_0x492b95=_0x50ce18;_0x59f9db[_0x79d3('0x42')]=_[_0x79d3('0x43')](db[_0x79d3('0xc2')]['rawAttributes']);_0x59f9db[_0x79d3('0x44')]=_[_0x79d3('0x43')](_0x660e42[_0x79d3('0x44')]);_0x59f9db['filters']=_['intersection'](_0x59f9db[_0x79d3('0x42')],_0x59f9db[_0x79d3('0x44')]);_0x39005f[_0x79d3('0x48')]=_[_0x79d3('0x46')](_0x59f9db['model'],qs[_0x79d3('0x47')](_0x660e42[_0x79d3('0x44')][_0x79d3('0x47')]));_0x39005f[_0x79d3('0x48')]=_0x39005f[_0x79d3('0x48')][_0x79d3('0x49')]?_0x39005f[_0x79d3('0x48')]:_0x59f9db[_0x79d3('0x42')];_0x39005f[_0x79d3('0x4b')]=qs[_0x79d3('0x4c')](_0x660e42['query'][_0x79d3('0x4c')]);_0x39005f[_0x79d3('0x4d')]=qs[_0x79d3('0x45')](_[_0x79d3('0x67')](_0x660e42[_0x79d3('0x44')],_0x59f9db[_0x79d3('0x45')]));if(_0x660e42['query'][_0x79d3('0x68')]){_0x39005f['where']=_[_0x79d3('0x50')](_0x39005f[_0x79d3('0x4d')],{'$or':_[_0x79d3('0x69')](_0x39005f[_0x79d3('0x48')],function(_0x32b44e){var _0x36dc72={};_0x36dc72[_0x32b44e]={'$like':'%'+_0x660e42['query'][_0x79d3('0x68')]+'%'};return _0x36dc72;})});}_0x39005f=_[_0x79d3('0x50')]({},_0x39005f,_0x660e42[_0x79d3('0x57')]);return _0x492b95['getAgents'](_0x39005f);}})[_0x79d3('0x38')](function(_0x583ca1){if(_0x583ca1){_0x1091ef=_0x583ca1[_0x79d3('0x49')];if(!_0x660e42['query'][_0x79d3('0x4a')](_0x79d3('0xe6'))){_0x39005f[_0x79d3('0x34')]=qs[_0x79d3('0x34')](_0x660e42[_0x79d3('0x44')][_0x79d3('0x34')]);_0x39005f['offset']=qs[_0x79d3('0x33')](_0x660e42[_0x79d3('0x44')]['offset']);}return _0x492b95[_0x79d3('0x11d')](_0x39005f);}})[_0x79d3('0x38')](function(_0x5569a2){if(_0x5569a2){return _0x5569a2?{'count':_0x1091ef,'rows':_0x5569a2}:null;}})[_0x79d3('0x38')](respondWithResult(_0x26b61a,null))[_0x79d3('0x2d')](handleError(_0x26b61a,null));}; \ No newline at end of file +var _0xa43b=['chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','filter','where','merge','map','type','field','options','ChatWebsite','count','includeAll','include','findAll','rows','show','rawAttributes','intersection','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','update','params','describe','addDisposition','ChatWebsiteId','Disposition','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','updatedAt','difference','createdAt','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','ChatApplication','Applications','list','List','applications','priority','asc','account','ListId','contact','lastName','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','color','tag','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','remote','x-forwarded-for','x-real-ip','connection','referer','replace','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions'];(function(_0x33b856,_0x1f5f7b){var _0x274333=function(_0x2fe01f){while(--_0x2fe01f){_0x33b856['push'](_0x33b856['shift']());}};_0x274333(++_0x1f5f7b);}(_0xa43b,0x12e));var _0xba43=function(_0xa2fd6,_0x4e5f7f){_0xa2fd6=_0xa2fd6-0x0;var _0x5fa614=_0xa43b[_0xa2fd6];return _0x5fa614;};'use strict';var pdf=require(_0xba43('0x0'));var emlformat=require(_0xba43('0x1'));var rimraf=require(_0xba43('0x2'));var zipdir=require(_0xba43('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba43('0x4'));var moment=require(_0xba43('0x5'));var BPromise=require(_0xba43('0x6'));var Mustache=require(_0xba43('0x7'));var util=require(_0xba43('0x8'));var path=require('path');var sox=require(_0xba43('0x9'));var csv=require(_0xba43('0xa'));var ejs=require(_0xba43('0xb'));var fs=require('fs');var _=require(_0xba43('0xc'));var squel=require(_0xba43('0xd'));var crypto=require('crypto');var jsforce=require(_0xba43('0xe'));var deskjs=require(_0xba43('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba43('0x10'));var Redis=require(_0xba43('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xba43('0x12'));var logger=require(_0xba43('0x13'))(_0xba43('0x14'));var utils=require(_0xba43('0x15'));var config=require(_0xba43('0x16'));var db=require(_0xba43('0x17'))['db'];config[_0xba43('0x18')]=_[_0xba43('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba43('0x1a'))(new Redis(config[_0xba43('0x18')]));require(_0xba43('0x1b'))[_0xba43('0x1c')](socket);var jayson=require(_0xba43('0x1d'));var client=jayson['client'][_0xba43('0x1e')]({'port':0x232c});var client9002=jayson[_0xba43('0x1f')][_0xba43('0x1e')]({'port':0x232a});var client9003=jayson[_0xba43('0x1f')][_0xba43('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x5584f4,_0x44bcff,_0x3f2312){if(_0x3f2312){var _0x4f3889=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f3889[_0xba43('0x20')](_0x44bcff)){return _0x5584f4;}else{throw new Error(_0xba43('0x21'));}}else{return _0x5584f4;}}function respondWithRpcPromise(_0x167716,_0x1f518e,_0x4a03e3,_0x1159ea){return new BPromise(function(_0x294052,_0x14c7a4){var _0x2b8aad=_0x1159ea||client;return _0x2b8aad[_0xba43('0x22')](_0x167716,_0x4a03e3)[_0xba43('0x23')](function(_0x5af6ec){logger[_0xba43('0x24')](_0xba43('0x25'),_0x1f518e,_0xba43('0x26'));logger[_0xba43('0x27')](_0xba43('0x28'),_0x1f518e,'request\x20sent',JSON['stringify'](_0x5af6ec));if(_0x5af6ec[_0xba43('0x29')]){if(_0x5af6ec[_0xba43('0x29')]['code']===0x1f4){logger[_0xba43('0x29')](_0xba43('0x25'),_0x1f518e,_0x5af6ec[_0xba43('0x29')][_0xba43('0x2a')]);return _0x14c7a4(_0x5af6ec['error'][_0xba43('0x2a')]);}logger[_0xba43('0x29')](_0xba43('0x25'),_0x1f518e,_0x5af6ec[_0xba43('0x29')][_0xba43('0x2a')]);return _0x294052(_0x5af6ec[_0xba43('0x29')][_0xba43('0x2a')]);}else{logger[_0xba43('0x24')](_0xba43('0x25'),_0x1f518e,_0xba43('0x26'));_0x294052(_0x5af6ec['result'][_0xba43('0x2a')]);}})[_0xba43('0x2b')](function(_0x5e40ab){logger[_0xba43('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x1f518e,_0x5e40ab);_0x14c7a4(_0x5e40ab);});});}function respondWithStatusCode(_0x3676fe,_0x24815c){_0x24815c=_0x24815c||0xcc;return function(_0x51ebec){if(_0x51ebec){return _0x3676fe[_0xba43('0x2c')](_0x24815c);}return _0x3676fe[_0xba43('0x2d')](_0x24815c)[_0xba43('0x2e')]();};}function respondWithResult(_0xd6f878,_0x17ea7d){_0x17ea7d=_0x17ea7d||0xc8;return function(_0x25072e){if(_0x25072e){return _0xd6f878[_0xba43('0x2d')](_0x17ea7d)[_0xba43('0x2f')](_0x25072e);}};}function respondWithFilteredResult(_0x376c68,_0x419afe){return function(_0x5aed45){if(_0x5aed45){var _0x5daecc=_0x5aed45['count'],_0x586d54=_0x419afe[_0xba43('0x30')],_0x23b654=_0x419afe[_0xba43('0x30')]+_0x419afe[_0xba43('0x31')],_0xa92022;if(_0x23b654>=_0x5daecc){_0x23b654=_0x5daecc;_0xa92022=0xc8;}else{_0xa92022=0xce;}_0x376c68[_0xba43('0x2d')](_0xa92022);return _0x376c68['set'](_0xba43('0x32'),_0x586d54+'-'+_0x23b654+'/'+_0x5daecc)[_0xba43('0x2f')](_0x5aed45);}return null;};}function patchUpdates(_0x3375c3){return function(_0x2f9a0e){try{jsonpatch['apply'](_0x2f9a0e,_0x3375c3,!![]);}catch(_0x5c2b75){return BPromise[_0xba43('0x33')](_0x5c2b75);}return _0x2f9a0e[_0xba43('0x34')]();};}function saveUpdates(_0x2c661a,_0x310782){return function(_0x329853){if(_0x329853){return _0x329853['update'](_0x2c661a)[_0xba43('0x23')](function(_0x46a7dc){return _0x46a7dc;});}return null;};}function removeEntity(_0x5c91a3,_0x3976e7){return function(_0x2d7036){if(_0x2d7036){return _0x2d7036[_0xba43('0x35')]()[_0xba43('0x23')](function(){var _0x56ea01=_0x2d7036[_0xba43('0x36')]({'plain':!![]});var _0x164fd5=_0xba43('0x37');return db[_0xba43('0x38')][_0xba43('0x35')]({'where':{'type':_0x164fd5,'resourceId':_0x56ea01['id']}})['then'](function(){return _0x2d7036;});})[_0xba43('0x23')](function(){_0x5c91a3[_0xba43('0x2d')](0xcc)[_0xba43('0x2e')]();});}};}function handleEntityNotFound(_0x20b172,_0x3ae042){return function(_0x135746){if(!_0x135746){_0x20b172[_0xba43('0x2c')](0x194);}return _0x135746;};}function handleError(_0x500190,_0x1d23c8){_0x1d23c8=_0x1d23c8||0x1f4;return function(_0x586d99){logger[_0xba43('0x29')](_0x586d99[_0xba43('0x39')]);if(_0x586d99[_0xba43('0x3a')]){delete _0x586d99[_0xba43('0x3a')];}_0x500190[_0xba43('0x2d')](_0x1d23c8)[_0xba43('0x3b')](_0x586d99);};}exports[_0xba43('0x3c')]=function(_0x5f4919,_0x30bec8){var _0x150aad={'include':[{'model':db[_0xba43('0x3d')],'as':_0xba43('0x3e')}]},_0x14c829={},_0x28c649={'count':0x0,'rows':[]};var _0x41feea=db['ChatWebsite']['rawAttributes'];_0x14c829[_0xba43('0x3f')]=_[_0xba43('0x40')](_0x41feea);_0x14c829[_0xba43('0x41')]=_[_0xba43('0x40')](_0x5f4919['query']);_0x14c829[_0xba43('0x42')]=_['intersection'](_0x14c829[_0xba43('0x3f')],_0x14c829[_0xba43('0x41')]);_0x150aad[_0xba43('0x43')]=_['intersection'](_0x14c829[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x5f4919[_0xba43('0x41')][_0xba43('0x44')]));_0x150aad[_0xba43('0x43')]=_0x150aad['attributes'][_0xba43('0x45')]?_0x150aad[_0xba43('0x43')]:_0x14c829['model'];if(!_0x5f4919[_0xba43('0x41')]['hasOwnProperty'](_0xba43('0x46'))){_0x150aad[_0xba43('0x31')]=qs['limit'](_0x5f4919[_0xba43('0x41')]['limit']);_0x150aad['offset']=qs[_0xba43('0x30')](_0x5f4919[_0xba43('0x41')][_0xba43('0x30')]);}_0x150aad[_0xba43('0x47')]=qs[_0xba43('0x48')](_0x5f4919['query'][_0xba43('0x48')]);_0x150aad['where']=qs['filters'](_['pick'](_0x5f4919['query'],_0x14c829[_0xba43('0x42')]));if(_0x5f4919[_0xba43('0x41')][_0xba43('0x49')]){_0x150aad[_0xba43('0x4a')]=_[_0xba43('0x4b')](_0x150aad[_0xba43('0x4a')],{'$or':_[_0xba43('0x4c')](_0x41feea,function(_0x54fcce){if(_0x54fcce[_0xba43('0x4d')]['key']!=='VIRTUAL'){var _0x6099f2={};_0x6099f2[_0x54fcce[_0xba43('0x4e')]]={'$like':'%'+_0x5f4919[_0xba43('0x41')][_0xba43('0x49')]+'%'};return _0x6099f2;}})});}_0x150aad=_[_0xba43('0x4b')]({},_0x150aad,_0x5f4919[_0xba43('0x4f')]);var _0x4fc944={'where':_0x150aad['where']};return db[_0xba43('0x50')][_0xba43('0x51')](_0x4fc944)[_0xba43('0x23')](function(_0x1c457c){_0x28c649[_0xba43('0x51')]=_0x1c457c;if(_0x5f4919[_0xba43('0x41')][_0xba43('0x52')]){_0x150aad[_0xba43('0x53')]=[{'all':!![]}];}return db[_0xba43('0x50')][_0xba43('0x54')](_0x150aad);})['then'](function(_0x103df8){_0x28c649[_0xba43('0x55')]=_0x103df8;return _0x28c649;})[_0xba43('0x23')](respondWithFilteredResult(_0x30bec8,_0x150aad))[_0xba43('0x2b')](handleError(_0x30bec8,null));};exports[_0xba43('0x56')]=function(_0x5a9ac1,_0x3ab861){var _0xc74904={'raw':![],'where':{'id':_0x5a9ac1['params']['id']},'include':[{'model':db[_0xba43('0x3d')],'as':_0xba43('0x3e')}]},_0x1f86d0={};_0x1f86d0[_0xba43('0x3f')]=_[_0xba43('0x40')](db[_0xba43('0x50')][_0xba43('0x57')]);_0x1f86d0['query']=_[_0xba43('0x40')](_0x5a9ac1['query']);_0x1f86d0[_0xba43('0x42')]=_[_0xba43('0x58')](_0x1f86d0[_0xba43('0x3f')],_0x1f86d0[_0xba43('0x41')]);_0xc74904['attributes']=_[_0xba43('0x58')](_0x1f86d0[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x5a9ac1[_0xba43('0x41')][_0xba43('0x44')]));_0xc74904['attributes']=_0xc74904[_0xba43('0x43')][_0xba43('0x45')]?_0xc74904['attributes']:_0x1f86d0[_0xba43('0x3f')];if(_0x5a9ac1[_0xba43('0x41')][_0xba43('0x52')]){_0xc74904[_0xba43('0x53')]=[{'all':!![]}];}_0xc74904=_[_0xba43('0x4b')]({},_0xc74904,_0x5a9ac1[_0xba43('0x4f')]);return db[_0xba43('0x50')][_0xba43('0x59')](_0xc74904)[_0xba43('0x23')](handleEntityNotFound(_0x3ab861,null))[_0xba43('0x23')](respondWithResult(_0x3ab861,null))['catch'](handleError(_0x3ab861,null));};exports[_0xba43('0x5a')]=function(_0x35f3fc,_0x10359a){return db['ChatWebsite'][_0xba43('0x5a')](_0x35f3fc[_0xba43('0x5b')],{})['then'](function(_0x36ce83){var _0x157ccc=_0x35f3fc[_0xba43('0x5c')][_0xba43('0x36')]({'plain':!![]});if(!_0x157ccc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x157ccc['role']===_0xba43('0x5c')){var _0x4595b8=_0x36ce83[_0xba43('0x36')]({'plain':!![]});var _0x3c8a96=_0xba43('0x37');return db[_0xba43('0x5d')][_0xba43('0x59')]({'where':{'name':_0x3c8a96,'userProfileId':_0x157ccc[_0xba43('0x5e')]},'raw':!![]})[_0xba43('0x23')](function(_0x2117e6){if(_0x2117e6&&_0x2117e6[_0xba43('0x5f')]===0x0){return db['UserProfileResource'][_0xba43('0x5a')]({'name':_0x4595b8[_0xba43('0x3a')],'resourceId':_0x4595b8['id'],'type':_0x2117e6[_0xba43('0x3a')],'sectionId':_0x2117e6['id']},{})['then'](function(){return _0x36ce83;});}else{return _0x36ce83;}})[_0xba43('0x2b')](function(_0x448993){logger[_0xba43('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x448993);throw _0x448993;});}return _0x36ce83;})[_0xba43('0x23')](respondWithResult(_0x10359a,0xc9))[_0xba43('0x2b')](handleError(_0x10359a,null));};exports[_0xba43('0x60')]=function(_0x486324,_0x47c10c){if(_0x486324[_0xba43('0x5b')]['id']){delete _0x486324['body']['id'];}return db[_0xba43('0x50')]['find']({'where':{'id':_0x486324[_0xba43('0x61')]['id']},'include':[{'model':db[_0xba43('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xba43('0x23')](handleEntityNotFound(_0x47c10c,null))[_0xba43('0x23')](saveUpdates(_0x486324[_0xba43('0x5b')],null))[_0xba43('0x23')](respondWithResult(_0x47c10c,null))['catch'](handleError(_0x47c10c,null));};exports[_0xba43('0x35')]=function(_0x14fd10,_0x603f87){return db[_0xba43('0x50')][_0xba43('0x59')]({'where':{'id':_0x14fd10['params']['id']}})['then'](handleEntityNotFound(_0x603f87,null))[_0xba43('0x23')](removeEntity(_0x603f87,null))[_0xba43('0x2b')](handleError(_0x603f87,null));};exports[_0xba43('0x62')]=function(_0x2511cd,_0x542043){return db[_0xba43('0x50')][_0xba43('0x62')]()[_0xba43('0x23')](respondWithResult(_0x542043,null))[_0xba43('0x2b')](handleError(_0x542043,null));};exports[_0xba43('0x63')]=function(_0x20d37c,_0x169fcc,_0xef0623){if(_0x20d37c[_0xba43('0x5b')]['id']){delete _0x20d37c[_0xba43('0x5b')]['id'];}return db[_0xba43('0x50')]['find']({'where':{'id':_0x20d37c[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x169fcc,null))['then'](function(_0x335a89){if(_0x335a89){_0x20d37c[_0xba43('0x5b')][_0xba43('0x64')]=_0x335a89['id'];return db[_0xba43('0x65')][_0xba43('0x5a')](_0x20d37c[_0xba43('0x5b')]);}})[_0xba43('0x23')](respondWithResult(_0x169fcc,null))['catch'](handleError(_0x169fcc,null));};exports['getDispositions']=function(_0x136970,_0x6144dc,_0x50e375){var _0x26a203={'raw':![],'where':{}};var _0x508794={};var _0x1cca0f={'count':0x0,'rows':[]};return db[_0xba43('0x50')]['findOne']({'where':{'id':_0x136970[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x6144dc,null))[_0xba43('0x23')](function(_0x54f1e4){if(_0x54f1e4){_0x508794[_0xba43('0x3f')]=_['keys'](db[_0xba43('0x65')]['rawAttributes']);_0x508794[_0xba43('0x41')]=_[_0xba43('0x40')](_0x136970[_0xba43('0x41')]);_0x508794[_0xba43('0x42')]=_[_0xba43('0x58')](_0x508794[_0xba43('0x3f')],_0x508794[_0xba43('0x41')]);_0x26a203[_0xba43('0x43')]=_[_0xba43('0x58')](_0x508794[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x136970[_0xba43('0x41')]['fields']));_0x26a203[_0xba43('0x43')]=_0x26a203[_0xba43('0x43')]['length']?_0x26a203[_0xba43('0x43')]:_0x508794[_0xba43('0x3f')];if(!_0x136970[_0xba43('0x41')][_0xba43('0x66')]('nolimit')){_0x26a203[_0xba43('0x31')]=qs[_0xba43('0x31')](_0x136970['query'][_0xba43('0x31')]);_0x26a203[_0xba43('0x30')]=qs[_0xba43('0x30')](_0x136970[_0xba43('0x41')][_0xba43('0x30')]);}_0x26a203['order']=qs['sort'](_0x136970['query'][_0xba43('0x48')]);_0x26a203['where']=qs[_0xba43('0x42')](_[_0xba43('0x67')](_0x136970[_0xba43('0x41')],_0x508794[_0xba43('0x42')]));_0x26a203[_0xba43('0x4a')][_0xba43('0x64')]=_0x54f1e4['id'];if(_0x136970['query'][_0xba43('0x49')]){_0x26a203['where']=_[_0xba43('0x4b')](_0x26a203[_0xba43('0x4a')],{'$or':_[_0xba43('0x4c')](_0x26a203[_0xba43('0x43')],function(_0x29dc36){var _0x1bd145={};_0x1bd145[_0x29dc36]={'$like':'%'+_0x136970[_0xba43('0x41')]['filter']+'%'};return _0x1bd145;})});}_0x26a203=_[_0xba43('0x4b')]({},_0x26a203,_0x136970[_0xba43('0x4f')]);return db[_0xba43('0x65')][_0xba43('0x51')]({'where':_0x26a203[_0xba43('0x4a')]})[_0xba43('0x23')](function(_0x3c3dc0){_0x1cca0f[_0xba43('0x51')]=_0x3c3dc0;if(_0x136970[_0xba43('0x41')]['includeAll']){_0x26a203[_0xba43('0x53')]=[{'all':!![]}];}return db[_0xba43('0x65')]['findAll'](_0x26a203);})[_0xba43('0x23')](function(_0x7e36eb){_0x1cca0f[_0xba43('0x55')]=_0x7e36eb;return _0x1cca0f;});}})[_0xba43('0x23')](respondWithFilteredResult(_0x6144dc,_0x26a203))[_0xba43('0x2b')](handleError(_0x6144dc,null));};exports['removeDispositions']=function(_0x31ee84,_0x1fb631,_0x16ace5){return db[_0xba43('0x50')][_0xba43('0x59')]({'where':{'id':_0x31ee84[_0xba43('0x61')]['id']}})['then'](handleEntityNotFound(_0x1fb631,null))[_0xba43('0x23')](function(_0x169407){if(_0x169407){return _0x169407[_0xba43('0x68')](_0x31ee84['query'][_0xba43('0x69')]);}})[_0xba43('0x23')](respondWithStatusCode(_0x1fb631,null))[_0xba43('0x2b')](handleError(_0x1fb631,null));};exports[_0xba43('0x6a')]=function(_0x37a3e1,_0x9857cd,_0x3dc4c5){if(_0x37a3e1[_0xba43('0x5b')]['id']){delete _0x37a3e1[_0xba43('0x5b')]['id'];}return db[_0xba43('0x50')][_0xba43('0x59')]({'where':{'id':_0x37a3e1[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x9857cd,null))['then'](function(_0x1448d0){if(_0x1448d0){_0x37a3e1[_0xba43('0x5b')][_0xba43('0x64')]=_0x1448d0['id'];return db[_0xba43('0x6b')][_0xba43('0x5a')](_0x37a3e1[_0xba43('0x5b')]);}})[_0xba43('0x23')](respondWithResult(_0x9857cd,null))[_0xba43('0x2b')](handleError(_0x9857cd,null));};exports[_0xba43('0x6c')]=function(_0x3f584f,_0x49b613,_0x2123f0){var _0x2112f4={'raw':![],'where':{}};var _0x15a47d={};var _0x3c8360={'count':0x0,'rows':[]};return db[_0xba43('0x50')][_0xba43('0x6d')]({'where':{'id':_0x3f584f[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x49b613,null))[_0xba43('0x23')](function(_0x3680e0){if(_0x3680e0){_0x15a47d[_0xba43('0x3f')]=_[_0xba43('0x40')](db[_0xba43('0x6b')]['rawAttributes']);_0x15a47d['query']=_['keys'](_0x3f584f[_0xba43('0x41')]);_0x15a47d[_0xba43('0x42')]=_[_0xba43('0x58')](_0x15a47d[_0xba43('0x3f')],_0x15a47d[_0xba43('0x41')]);_0x2112f4[_0xba43('0x43')]=_[_0xba43('0x58')](_0x15a47d[_0xba43('0x3f')],qs['fields'](_0x3f584f[_0xba43('0x41')][_0xba43('0x44')]));_0x2112f4[_0xba43('0x43')]=_0x2112f4[_0xba43('0x43')][_0xba43('0x45')]?_0x2112f4[_0xba43('0x43')]:_0x15a47d[_0xba43('0x3f')];if(!_0x3f584f['query']['hasOwnProperty'](_0xba43('0x46'))){_0x2112f4[_0xba43('0x31')]=qs[_0xba43('0x31')](_0x3f584f[_0xba43('0x41')][_0xba43('0x31')]);_0x2112f4[_0xba43('0x30')]=qs[_0xba43('0x30')](_0x3f584f[_0xba43('0x41')][_0xba43('0x30')]);}_0x2112f4['order']=qs[_0xba43('0x48')](_0x3f584f[_0xba43('0x41')][_0xba43('0x48')]);_0x2112f4['where']=qs[_0xba43('0x42')](_[_0xba43('0x67')](_0x3f584f['query'],_0x15a47d[_0xba43('0x42')]));_0x2112f4[_0xba43('0x4a')][_0xba43('0x64')]=_0x3680e0['id'];if(_0x3f584f[_0xba43('0x41')][_0xba43('0x49')]){_0x2112f4['where']=_[_0xba43('0x4b')](_0x2112f4[_0xba43('0x4a')],{'$or':_['map'](_0x2112f4[_0xba43('0x43')],function(_0x36376b){var _0x391cb4={};_0x391cb4[_0x36376b]={'$like':'%'+_0x3f584f[_0xba43('0x41')]['filter']+'%'};return _0x391cb4;})});}_0x2112f4=_['merge']({},_0x2112f4,_0x3f584f[_0xba43('0x4f')]);return db[_0xba43('0x6b')][_0xba43('0x51')]({'where':_0x2112f4[_0xba43('0x4a')]})['then'](function(_0xd26120){_0x3c8360[_0xba43('0x51')]=_0xd26120;if(_0x3f584f[_0xba43('0x41')][_0xba43('0x52')]){_0x2112f4[_0xba43('0x53')]=[{'all':!![]}];}return db[_0xba43('0x6b')][_0xba43('0x54')](_0x2112f4);})['then'](function(_0x5c4c48){_0x3c8360['rows']=_0x5c4c48;return _0x3c8360;});}})[_0xba43('0x23')](respondWithFilteredResult(_0x49b613,_0x2112f4))[_0xba43('0x2b')](handleError(_0x49b613,null));};exports[_0xba43('0x6e')]=function(_0x162051,_0x50fc9a,_0x3514e2){return db[_0xba43('0x50')]['find']({'where':{'id':_0x162051[_0xba43('0x61')]['id']}})['then'](handleEntityNotFound(_0x50fc9a,null))[_0xba43('0x23')](function(_0x161e55){if(_0x161e55){return _0x161e55[_0xba43('0x6e')](_0x162051[_0xba43('0x41')][_0xba43('0x69')]);}})[_0xba43('0x23')](respondWithStatusCode(_0x50fc9a,null))[_0xba43('0x2b')](handleError(_0x50fc9a,null));};exports[_0xba43('0x6f')]=function(_0x49cf0c,_0x29751c,_0x116a4d){_0x49cf0c[_0xba43('0x5b')][_0xba43('0x70')]=_0x49cf0c[_0xba43('0x71')][_0xba43('0x72')];return db[_0xba43('0x50')]['find']({'where':{'id':_0x49cf0c[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x29751c,null))[_0xba43('0x23')](saveUpdates(_0x49cf0c['body'],null))[_0xba43('0x23')](respondWithResult(_0x29751c,null))[_0xba43('0x2b')](handleError(_0x29751c,null));};exports[_0xba43('0x73')]=function(_0x39cd5f,_0x417960,_0x142c17){_0x39cd5f[_0xba43('0x5b')][_0xba43('0x74')]=_0x39cd5f['file'][_0xba43('0x72')];return db[_0xba43('0x50')][_0xba43('0x59')]({'where':{'id':_0x39cd5f[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x417960,null))[_0xba43('0x23')](saveUpdates(_0x39cd5f[_0xba43('0x5b')],null))[_0xba43('0x23')](respondWithResult(_0x417960,null))[_0xba43('0x2b')](handleError(_0x417960,null));};exports['addCustomerAvatar']=function(_0x5da6e0,_0x38327d,_0x1b37a3){_0x5da6e0['body'][_0xba43('0x75')]=_0x5da6e0['file'][_0xba43('0x72')];return db[_0xba43('0x50')][_0xba43('0x59')]({'where':{'id':_0x5da6e0[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x38327d,null))[_0xba43('0x23')](saveUpdates(_0x5da6e0['body'],null))['then'](respondWithResult(_0x38327d,null))['catch'](handleError(_0x38327d,null));};exports[_0xba43('0x76')]=function(_0x3afa00,_0x3796fc,_0x15bedc){_0x3afa00[_0xba43('0x5b')][_0xba43('0x77')]=_0x3afa00['file'][_0xba43('0x72')];return db[_0xba43('0x50')]['find']({'where':{'id':_0x3afa00[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x3796fc,null))[_0xba43('0x23')](saveUpdates(_0x3afa00[_0xba43('0x5b')],null))[_0xba43('0x23')](respondWithResult(_0x3796fc,null))[_0xba43('0x2b')](handleError(_0x3796fc,null));};exports[_0xba43('0x78')]=function(_0x3bc9e1,_0x3c1983,_0x2553a4){var _0x26bc81=path['join'](config['root'],_0xba43('0x79'));var _0x41ed97={'where':{'id':_0x3bc9e1['params']['id']},'attributes':['id',_0xba43('0x70')],'raw':!![]};var _0x1b2f39=![];return require(_0xba43('0x7a'))[_0xba43('0x7b')]()[_0xba43('0x23')](function(_0xd24578){if(_0xd24578){_0x1b2f39=_0xd24578[_0xba43('0x7c')];}})[_0xba43('0x23')](function(){return db['ChatWebsite'][_0xba43('0x59')](_0x41ed97);})[_0xba43('0x23')](handleEntityNotFound(_0x3c1983,null))[_0xba43('0x23')](function(_0x486e0f){if(_0x486e0f){if(!_['isNil'](_0x486e0f[_0xba43('0x70')])){if(fs[_0xba43('0x7d')](path[_0xba43('0x7e')](config[_0xba43('0x7f')],_0xba43('0x80'),_0x486e0f[_0xba43('0x70')]))&&_0x1b2f39){_0x26bc81=path[_0xba43('0x7e')](config['root'],'server/files/images/logos/',_0x486e0f[_0xba43('0x70')]);}}return _0x3c1983[_0xba43('0x81')](_0x26bc81);}})[_0xba43('0x2b')](handleError(_0x3c1983,null));};exports[_0xba43('0x82')]=function(_0x141604,_0x2079f3,_0x3b1aa1){var _0x428c56=path[_0xba43('0x7e')](config[_0xba43('0x7f')],_0xba43('0x83'));var _0x380556={'where':{'id':_0x141604[_0xba43('0x61')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xba43('0x50')]['find'](_0x380556)[_0xba43('0x23')](handleEntityNotFound(_0x2079f3,null))[_0xba43('0x23')](function(_0x56d42f){if(_0x56d42f){if(!_[_0xba43('0x84')](_0x56d42f[_0xba43('0x74')])){if(fs['existsSync'](path[_0xba43('0x7e')](config[_0xba43('0x7f')],_0xba43('0x85'),_0x56d42f[_0xba43('0x74')]))){_0x428c56=path[_0xba43('0x7e')](config[_0xba43('0x7f')],'server/files/images/avatars/',_0x56d42f[_0xba43('0x74')]);}}return _0x2079f3[_0xba43('0x81')](_0x428c56);}})[_0xba43('0x2b')](handleError(_0x2079f3,null));};exports[_0xba43('0x86')]=function(_0x1d1889,_0x1753ca,_0x3af5b8){var _0x5efee9=path[_0xba43('0x7e')](config['root'],_0xba43('0x87'));var _0x19c310={'where':{'id':_0x1d1889[_0xba43('0x61')]['id']},'attributes':['id',_0xba43('0x75'),_0xba43('0x88')],'raw':!![]};return db[_0xba43('0x50')]['find'](_0x19c310)[_0xba43('0x23')](handleEntityNotFound(_0x1753ca,null))[_0xba43('0x23')](function(_0x573d9d){if(_0x573d9d){if(!_['isNil'](_0x573d9d[_0xba43('0x75')])){if(fs[_0xba43('0x7d')](path[_0xba43('0x7e')](config['root'],_0xba43('0x85'),_0x573d9d[_0xba43('0x75')]))&&_0x573d9d[_0xba43('0x88')]){_0x5efee9=path[_0xba43('0x7e')](config['root'],'server/files/images/avatars/',_0x573d9d[_0xba43('0x75')]);}}return _0x1753ca[_0xba43('0x81')](_0x5efee9);}})[_0xba43('0x2b')](handleError(_0x1753ca,null));};exports[_0xba43('0x89')]=function(_0x4e7b35,_0x33a95a,_0x401895){var _0x42675f=path[_0xba43('0x7e')](config[_0xba43('0x7f')],_0xba43('0x8a'));var _0x3f5683={'where':{'id':_0x4e7b35[_0xba43('0x61')]['id']},'attributes':['id',_0xba43('0x77')],'raw':!![]};return db[_0xba43('0x50')][_0xba43('0x59')](_0x3f5683)['then'](handleEntityNotFound(_0x33a95a,null))[_0xba43('0x23')](function(_0x115ad8){if(_0x115ad8){if(!_[_0xba43('0x84')](_0x115ad8[_0xba43('0x77')])){if(fs[_0xba43('0x7d')](path[_0xba43('0x7e')](config[_0xba43('0x7f')],_0xba43('0x85'),_0x115ad8[_0xba43('0x77')]))){_0x42675f=path['join'](config[_0xba43('0x7f')],_0xba43('0x85'),_0x115ad8['systemAvatar']);}}return _0x33a95a['download'](_0x42675f);}})[_0xba43('0x2b')](handleError(_0x33a95a,null));};exports[_0xba43('0x8b')]=function(_0x1e78ae,_0x127bfd,_0x370466){var _0x2af66f=require(_0xba43('0x8c'));var _0x3b8d11=new _0x2af66f();var _0x5a07c4=_0x3b8d11[_0xba43('0x8d')](_0x1e78ae[_0xba43('0x8e')]['user-agent'])[_0xba43('0x8f')]();var _0x5633e9={'body':_0x1e78ae[_0xba43('0x5b')],'channel':_0xba43('0x90')};var _0x44f8e=[];var _0x17820f=[];var _0x239787={};var _0xd53b30=![];return db[_0xba43('0x91')][_0xba43('0x62')]()[_0xba43('0x23')](function(_0x412848){if(!_0x412848){throw new db[(_0xba43('0x92'))]['ValidationError'](_0xba43('0x93'));}_0x44f8e=_['difference'](_['keys'](_0x412848),['createdAt',_0xba43('0x94')]);_0x17820f=_[_0xba43('0x95')](_[_0xba43('0x40')](_0x412848),[_0xba43('0x96'),_0xba43('0x94'),'CompanyId','ListId']);if(_0x1e78ae[_0xba43('0x5b')]['id']){delete _0x1e78ae[_0xba43('0x5b')]['id'];}if(_[_0xba43('0x84')](_0x1e78ae[_0xba43('0x5b')]['from'])){throw new db[(_0xba43('0x92'))][(_0xba43('0x97'))]('from\x20is\x20mandatory');}if(_[_0xba43('0x84')](_0x1e78ae[_0xba43('0x5b')]['body'])||_0x1e78ae[_0xba43('0x5b')][_0xba43('0x5b')]===''){throw new db['Sequelize'][(_0xba43('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xba43('0x84')](_0x1e78ae['body']['mapKey'])){throw new db[(_0xba43('0x92'))]['ValidationError'](_0xba43('0x98')+_0x17820f);}if(!_[_0xba43('0x99')](_0x17820f,_0x1e78ae[_0xba43('0x5b')][_0xba43('0x9a')])){throw new db[(_0xba43('0x92'))]['ValidationError'](_0xba43('0x9b')+_0x17820f);}_0x239787[_0x1e78ae[_0xba43('0x5b')]['mapKey']]=_0x1e78ae['body'][_0xba43('0x9c')];})[_0xba43('0x23')](function(){return db[_0xba43('0x50')][_0xba43('0x59')]({'where':{'id':_0x1e78ae['params']['id']},'include':[{'model':db[_0xba43('0x9d')],'as':'List','include':[{'model':db[_0xba43('0x91')],'as':_0xba43('0x9e'),'where':_0x239787,'limit':0x1,'order':[[_0xba43('0x94'),_0xba43('0x9f')]]}]},{'model':db[_0xba43('0xa0')],'as':_0xba43('0xa1')}]});})[_0xba43('0x23')](handleEntityNotFound(_0x127bfd,null))[_0xba43('0x23')](function(_0x7b8335){if(_0x7b8335&&_0x7b8335['List']){_0x5633e9['account']=_0x7b8335;_0x5633e9['applications']=_0x7b8335['Applications'];_0x5633e9[_0xba43('0xa2')]=_0x7b8335[_0xba43('0xa3')];_0x5633e9[_0xba43('0xa4')]=_['orderBy'](_0x5633e9[_0xba43('0xa4')],[_0xba43('0xa5')],[_0xba43('0xa6')]);if(_0x5633e9['account']['Applications']){delete _0x5633e9[_0xba43('0xa7')][_0xba43('0xa1')];}if(_0x5633e9[_0xba43('0xa7')]['List']&&_0x5633e9['account'][_0xba43('0xa3')][_0xba43('0x9e')][_0xba43('0x45')]){return _0x5633e9['account'][_0xba43('0xa3')][_0xba43('0x9e')][0x0];}var _0x27fa30=_[_0xba43('0x19')](_0x1e78ae[_0xba43('0x5b')],{'firstName':_0x1e78ae['body'][_0xba43('0x9c')],'ListId':_0x7b8335[_0xba43('0xa8')]});_0x27fa30[_0x1e78ae['body'][_0xba43('0x9a')]]=_0x1e78ae['body']['from'];return db[_0xba43('0x91')][_0xba43('0x5a')](_0x27fa30,{'fields':_0x44f8e,'raw':!![]});}})[_0xba43('0x23')](handleEntityNotFound(_0x127bfd,null))[_0xba43('0x23')](function(_0x3dd658){_0x5633e9[_0xba43('0xa9')]=_0x3dd658;if(_0x3dd658){var _0x546673={'ContactId':_0x3dd658['id'],'ChatWebsiteId':_0x1e78ae[_0xba43('0x61')]['id'],'from':(_0x3dd658['firstName']||'')+'\x20'+(_0x3dd658[_0xba43('0xaa')]||''),'customerIp':_0x1e78ae[_0xba43('0x5b')]['customerIp'],'referer':_0x1e78ae[_0xba43('0x5b')]['referer'],'browserName':_0x5a07c4[_0xba43('0xab')][_0xba43('0x3a')]&&_0x5a07c4[_0xba43('0xab')][_0xba43('0xac')]?util['format'](_0xba43('0xad'),_0x5a07c4[_0xba43('0xab')][_0xba43('0x3a')],_0x5a07c4[_0xba43('0xab')][_0xba43('0xac')]):_0xba43('0xae'),'browserVersion':_0x5a07c4[_0xba43('0xab')][_0xba43('0xac')]||_0xba43('0xae'),'osName':util[_0xba43('0xaf')](_0xba43('0xad'),_0x5a07c4['os']['name'],_0x5a07c4['os']['version']),'osVersion':_0x5a07c4['os']['version'],'deviceModel':_0x5a07c4[_0xba43('0xb0')][_0xba43('0x3f')]&&_0x5a07c4[_0xba43('0xb0')][_0xba43('0xb1')]?util[_0xba43('0xaf')](_0xba43('0xb2'),_0x5a07c4[_0xba43('0xb0')]['model'],_0x5a07c4['device'][_0xba43('0xb1')],_0x5a07c4[_0xba43('0xb0')][_0xba43('0x4d')]):null,'deviceVendor':_0x5a07c4[_0xba43('0xb0')][_0xba43('0xb1')],'deviceType':_0x5a07c4[_0xba43('0xb0')]['type'],'formData':JSON[_0xba43('0xb3')](_0x1e78ae[_0xba43('0x5b')])};var _0x10b722={'ChatWebsiteId':_0x1e78ae[_0xba43('0x61')]['id'],'closed':![]};if(_0x1e78ae[_0xba43('0x5b')][_0xba43('0xb4')]){_0x10b722[_0xba43('0xb4')]=_0x1e78ae[_0xba43('0x5b')][_0xba43('0xb4')];return db[_0xba43('0xb5')][_0xba43('0x59')]({'where':_0x10b722})[_0xba43('0x23')](function(_0x4e1008){if(_0x4e1008){return[_0x4e1008,![]];}_0x546673[_0xba43('0xb4')]=_0x1e78ae['body'][_0xba43('0xb4')];_0x546673[_0xba43('0xb6')]=_0x1e78ae['body'][_0xba43('0xb6')];return db[_0xba43('0xb5')]['create'](_0x546673)['then'](function(_0x18a1ca){return[_0x18a1ca,!![]];});});}_0x10b722[_0xba43('0xb7')]=_0x3dd658['id'];if(_0x1e78ae['body'][_0xba43('0xb8')]&&_0x1e78ae[_0xba43('0x5b')][_0xba43('0xb8')]['id']){_0x10b722['id']=_0x1e78ae['body'][_0xba43('0xb8')]['id'];return db['ChatInteraction']['find']({'where':_0x10b722})[_0xba43('0x23')](function(_0x1471ad){if(_0x1471ad){return[_0x1471ad,![]];}return db[_0xba43('0xb5')][_0xba43('0x5a')](_0x546673)[_0xba43('0x23')](function(_0x2b822b){return[_0x2b822b,!![]];});});}return db[_0xba43('0xb5')][_0xba43('0x5a')](_0x546673)[_0xba43('0x23')](function(_0x38c9b4){return[_0x38c9b4,!![]];});}})[_0xba43('0xb9')](function(_0x1d3659,_0x11c4d4){if(_0x1d3659){_0xd53b30=_0x11c4d4;if(!_0x11c4d4){var _0x3f88f6={'from':(_0x5633e9[_0xba43('0xa9')]['firstName']||'')+'\x20'+(_0x5633e9['contact'][_0xba43('0xaa')]||'')};if(_0x1e78ae['body'][_0xba43('0xb4')]&&_0x1e78ae[_0xba43('0x5b')][_0xba43('0xba')]&&_0x1e78ae[_0xba43('0x5b')][_0xba43('0xb4')]!=_0x1e78ae[_0xba43('0x5b')][_0xba43('0xba')]){_0x3f88f6[_0xba43('0xb4')]=_0x1e78ae[_0xba43('0x5b')][_0xba43('0xba')];}return _0x1d3659[_0xba43('0x60')](_0x3f88f6);}else{return _0x1d3659;}}})[_0xba43('0x23')](function(_0x300643){_0x5633e9['interaction']=_0x300643[_0xba43('0x36')]({'plain':!![]});_0x5633e9['interaction'][_0xba43('0xbb')]=_0xd53b30;if(_0x5633e9['interaction'][_0xba43('0xbb')]){if(_0x5633e9['account'][_0xba43('0xbc')]){_0x5633e9['applications'][_0xba43('0xbd')]({'id':0x0,'priority':_0x5633e9['applications'][_0xba43('0x45')]+0x1,'app':_0xba43('0xbe'),'appdata':_0xba43('0xbf'),'interval':_0xba43('0xc0')});}}return db[_0xba43('0xc1')]['create']({'body':_0x1e78ae['body'][_0xba43('0x5b')],'ChatWebsiteId':_0x1e78ae[_0xba43('0x61')]['id'],'ChatInteractionId':_0x300643['id'],'direction':'in','ContactId':_0x5633e9[_0xba43('0xa9')]['id'],'AttachmentId':_0x1e78ae[_0xba43('0x5b')][_0xba43('0xc2')]});})[_0xba43('0x23')](function(_0x1f36d3){_0x5633e9['message']=_0x1f36d3;if(_0x5633e9[_0xba43('0xb8')][_0xba43('0xc3')]){return db[_0xba43('0xc4')][_0xba43('0x59')]({'attributes':['id',_0xba43('0x3a')],'where':{'id':_0x5633e9[_0xba43('0xb8')]['UserId']}})[_0xba43('0x23')](function(_0x4542da){if(_0x4542da){_0x5633e9[_0xba43('0xa4')][_0xba43('0xc5')]({'id':0x0,'priority':0x0,'app':_0xba43('0xc6'),'appdata':_0x4542da[_0xba43('0x3a')]+','+(_0x5633e9[_0xba43('0xa7')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5633e9[_0xba43('0xc7')]=!![];}return respondWithRpcPromise(_0xba43('0xc8'),_0xba43('0xc9'),_0x5633e9);});}return respondWithRpcPromise(_0xba43('0xc8'),_0xba43('0xc9'),_0x5633e9);})[_0xba43('0x23')](function(_0x3d462e){respondWithRpcPromise('EventManager',_0xba43('0xca'),{'event':_0xba43('0x8b'),'message':_0x3d462e},client9002);return _0x3d462e;})[_0xba43('0x23')](respondWithResult(_0x127bfd,null))[_0xba43('0x2b')](handleError(_0x127bfd,null));};exports[_0xba43('0xcb')]=function(_0x64c365,_0x22a8d5,_0x11d51c){var _0x2388b9,_0x5bee14,_0x554987;var _0x121c9e=[];var _0x57e38a=[];var _0x4340ea={};return db[_0xba43('0x91')][_0xba43('0x62')]()['then'](function(_0x7e93ae){if(!_0x7e93ae){throw new db['Sequelize'][(_0xba43('0x97'))]('no\x20available\x20attributes');}_0x57e38a=_[_0xba43('0x95')](_['keys'](_0x7e93ae),['createdAt',_0xba43('0x94')]);_0x121c9e=_[_0xba43('0x95')](_['keys'](_0x7e93ae),[_0xba43('0x96'),_0xba43('0x94'),'CompanyId',_0xba43('0xa8')]);if(_0x64c365['body']['id']){delete _0x64c365['body']['id'];}if(_[_0xba43('0x84')](_0x64c365[_0xba43('0x5b')][_0xba43('0x9c')])){throw _0x22a8d5[_0xba43('0x2d')](0x1f4)[_0xba43('0x3b')](new db['Sequelize'][(_0xba43('0x97'))](_0xba43('0xcc')));}if(_[_0xba43('0x84')](_0x64c365[_0xba43('0x5b')][_0xba43('0x5b')])||_0x64c365['body'][_0xba43('0x5b')]===''){throw _0x22a8d5[_0xba43('0x2d')](0x1f4)['send'](new db['Sequelize'][(_0xba43('0x97'))](_0xba43('0xcd')));}if(_[_0xba43('0x84')](_0x64c365[_0xba43('0x5b')][_0xba43('0xce')])){throw _0x22a8d5[_0xba43('0x2d')](0x1f4)[_0xba43('0x3b')](new db['Sequelize']['ValidationError'](_0xba43('0xcf')+_0x121c9e));}if(!_['includes'](_0x121c9e,_0x64c365[_0xba43('0x5b')][_0xba43('0xce')])){throw _0x22a8d5['status'](0x1f4)[_0xba43('0x3b')](new db[(_0xba43('0x92'))]['ValidationError'](_0xba43('0xd0')+_0x121c9e));}_0x4340ea[_0x64c365['body'][_0xba43('0xce')]]=_0x64c365[_0xba43('0x5b')][_0xba43('0x9c')];})[_0xba43('0x23')](function(){return db['ChatWebsite'][_0xba43('0x59')]({'where':{'id':_0x64c365[_0xba43('0x61')]['id']},'include':[{'model':db[_0xba43('0x9d')],'as':_0xba43('0xa3')}]});})[_0xba43('0x23')](handleEntityNotFound(_0x22a8d5,null))[_0xba43('0x23')](function(_0x31fa54){if(_0x31fa54&&_0x31fa54[_0xba43('0xa3')]){_0x5bee14=_0x31fa54;var _0x2561c9=_[_0xba43('0x19')](_0x64c365[_0xba43('0x5b')],{'firstName':_0x64c365[_0xba43('0x5b')]['from'],'phone':_0x64c365[_0xba43('0x5b')][_0xba43('0x9c')],'ListId':_0x31fa54['ListId']});_0x2561c9[_0x64c365[_0xba43('0x5b')][_0xba43('0xce')]]=_0x64c365[_0xba43('0x5b')][_0xba43('0x9c')];return db['CmContact']['findOrCreate']({'where':_0x4340ea,'defaults':_0x2561c9});}})['spread'](function(_0x292186){if(_0x292186){_0x554987=_0x292186;var _0x111df3=fs[_0xba43('0xd1')](path[_0xba43('0x7e')](config['root'],_0xba43('0xd2')),_0xba43('0xd3'));var _0x3ee06d=ejs[_0xba43('0xd4')](_0x111df3,{'body':_[_0xba43('0xd5')](_0x64c365['body'][_0xba43('0x5b')]),'bodyTitle':_0x5bee14[_0xba43('0xd6')]});return db[_0xba43('0xd7')][_0xba43('0x5a')]({'body':_0x3ee06d,'ContactId':_0x292186['id'],'ChatWebsiteId':_0x5bee14['id']});}})[_0xba43('0x23')](function(_0x1f7933){if(_0x1f7933){_0x2388b9=_0x1f7933;return db[_0xba43('0xd8')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xba43('0xd9')],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x2ef400){if(_0x2ef400&&_0x2ef400[_0xba43('0xda')]&&_0x5bee14[_0xba43('0xdb')]){var _0x37b071={'tls':{'rejectUnauthorized':![]}};if(_0x2ef400[_0xba43('0xda')][_0xba43('0xdc')]){_0x37b071[_0xba43('0xdc')]=_0x2ef400[_0xba43('0xda')][_0xba43('0xdc')];}else{_0x37b071[_0xba43('0xdd')]=_0x2ef400['Smtp'][_0xba43('0xdd')];_0x37b071[_0xba43('0xde')]=_0x2ef400[_0xba43('0xda')][_0xba43('0xde')];_0x37b071[_0xba43('0xdf')]=_0x2ef400[_0xba43('0xda')][_0xba43('0xdf')];}if(_0x2ef400[_0xba43('0xda')][_0xba43('0xe0')]){_0x37b071[_0xba43('0xe1')]={'user':_0x2ef400['Smtp'][_0xba43('0x5c')],'pass':_0x2ef400['Smtp'][_0xba43('0xe2')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x37b071,'message':{'from':util[_0xba43('0xaf')](_0xba43('0xe3'),_0x2ef400[_0xba43('0x3a')],_0x2ef400[_0xba43('0xe4')]||_0x2ef400[_0xba43('0xda')]['user']),'to':_0x5bee14['forwardOfflineAddress'],'subject':_0x5bee14[_0xba43('0xe5')],'text':_0x2388b9[_0xba43('0x5b')]}},client9003)[_0xba43('0x23')](function(){return _0x2388b9;})[_0xba43('0x2b')](function(_0x344471){console[_0xba43('0x29')](_0x344471);});}})[_0xba43('0x23')](function(){if(_0x2388b9){return _0x2388b9;}})[_0xba43('0x23')](respondWithResult(_0x22a8d5,null))[_0xba43('0x2b')](handleError(_0x22a8d5,null));};exports[_0xba43('0xe6')]=function(_0x3ba6c4,_0x54f61d,_0x4517c0){return db[_0xba43('0xb5')][_0xba43('0x59')]({'where':{'id':_0x3ba6c4[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x54f61d,null))['then'](function(_0x11137b){if(_0x11137b){return _0x11137b['addInteraction'](_0x3ba6c4['body'][_0xba43('0x69')],_[_0xba43('0xe7')](_0x3ba6c4[_0xba43('0x5b')],[_0xba43('0x69'),'id'])||{});}})[_0xba43('0x23')](respondWithResult(_0x54f61d,null))[_0xba43('0x2b')](handleError(_0x54f61d,null));};exports[_0xba43('0xe8')]=function(_0x374522,_0x450f36,_0x1d889){var _0x32ceed={'raw':![],'where':{}};var _0x25a597={};var _0x4aeb7f={'count':0x0,'rows':[]};return db[_0xba43('0x50')]['findOne']({'where':{'id':_0x374522[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x450f36,null))[_0xba43('0x23')](function(_0x37873e){if(_0x37873e){_0x25a597[_0xba43('0x3f')]=_['keys'](db['ChatInteraction'][_0xba43('0x57')]);_0x25a597['query']=_[_0xba43('0x40')](_0x374522[_0xba43('0x41')]);_0x25a597[_0xba43('0x42')]=_[_0xba43('0x58')](_0x25a597['model'],_0x25a597['query']);_0x32ceed[_0xba43('0x43')]=_[_0xba43('0x58')](_0x25a597['model'],qs[_0xba43('0x44')](_0x374522['query'][_0xba43('0x44')]));_0x32ceed[_0xba43('0x43')]=_0x32ceed['attributes']['length']?_0x32ceed[_0xba43('0x43')]:_0x25a597[_0xba43('0x3f')];if(!_0x374522[_0xba43('0x41')][_0xba43('0x66')]('nolimit')){_0x32ceed[_0xba43('0x31')]=qs[_0xba43('0x31')](_0x374522['query'][_0xba43('0x31')]);_0x32ceed[_0xba43('0x30')]=qs[_0xba43('0x30')](_0x374522[_0xba43('0x41')][_0xba43('0x30')]);}_0x32ceed['order']=qs[_0xba43('0x48')](_0x374522['query'][_0xba43('0x48')]);_0x32ceed['where']=qs[_0xba43('0x42')](_[_0xba43('0x67')](_0x374522['query'],_0x25a597[_0xba43('0x42')]));_0x32ceed[_0xba43('0x4a')][_0xba43('0x64')]=_0x37873e['id'];if(_0x374522[_0xba43('0x41')]['filter']){_0x32ceed[_0xba43('0x4a')]=_[_0xba43('0x4b')](_0x32ceed[_0xba43('0x4a')],{'$or':_[_0xba43('0x4c')](_0x32ceed[_0xba43('0x43')],function(_0xd75bb8){var _0x2f3637={};_0x2f3637[_0xd75bb8]={'$like':'%'+_0x374522['query'][_0xba43('0x49')]+'%'};return _0x2f3637;})});}_0x32ceed=_[_0xba43('0x4b')]({},_0x32ceed,_0x374522[_0xba43('0x4f')]);return db['ChatInteraction']['count']({'where':_0x32ceed[_0xba43('0x4a')]})[_0xba43('0x23')](function(_0x301f5c){_0x4aeb7f[_0xba43('0x51')]=_0x301f5c;if(_0x374522[_0xba43('0x41')]['includeAll']){_0x32ceed['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0xba43('0xe9'),'attributes':[_0xba43('0x3a'),_0xba43('0xea'),_0xba43('0xeb')],'required':![]},{'model':db['Tag'],'as':_0xba43('0xec'),'attributes':['id',_0xba43('0x3a'),_0xba43('0xed')],'where':_0x374522['query'][_0xba43('0xee')]?{'id':_0x374522[_0xba43('0x41')][_0xba43('0xee')]}:undefined,'required':_0x374522[_0xba43('0x41')][_0xba43('0xee')]?!![]:![]}];}return db['ChatInteraction'][_0xba43('0x54')](_0x32ceed);})[_0xba43('0x23')](function(_0x5adc71){_0x4aeb7f[_0xba43('0x55')]=_0x5adc71;return _0x4aeb7f;});}})[_0xba43('0x23')](respondWithFilteredResult(_0x450f36,_0x32ceed))[_0xba43('0x2b')](handleError(_0x450f36,null));};function iftimePromise(_0x172eeb,_0x4b4a5d){return respondWithRpcPromise('Command','getSnippet',{'command':_0x4b4a5d[_0xba43('0xef')]?util['format'](_0xba43('0xf0'),_0x172eeb[_0xba43('0xf1')],_0x4b4a5d[_0xba43('0xef')]):util[_0xba43('0xaf')](_0xba43('0xf2'),_0x172eeb[_0xba43('0xf1')])},client9002)[_0xba43('0x23')](function(_0x28d797){var _0x5b2dc3=_0x28d797&&_0x28d797[_0xba43('0xf3')](_0xba43('0xf4'))>=0x0?!![]:![];logger[_0xba43('0x24')](_0xba43('0xf5'),_0x4b4a5d['id'],_0x172eeb['id'],_0x172eeb[_0xba43('0xf1')],_0x5b2dc3?_0xba43('0xf6'):'OFFLINE',_0x4b4a5d[_0xba43('0xef')]?_0x4b4a5d[_0xba43('0xef')]:_0xba43('0xf7'));return _0x5b2dc3;})[_0xba43('0x2b')](function(_0x4ab283){logger[_0xba43('0x29')](_0xba43('0xf5'),_0x4b4a5d['id'],_0x172eeb['id'],_0x172eeb[_0xba43('0xf1')],util[_0xba43('0xf8')](_0x4ab283,{'showHidden':![],'depth':null}),_0x4b4a5d[_0xba43('0xef')]?_0x4b4a5d['timezone']:_0xba43('0xf7'));return![];});}exports['getSnippet']=function(_0x10575e,_0x2cc36c,_0x49578f){var _0x2f16ea=0x0;var _0x57d1cb=0x0;var _0x539140=![];var _0x45118f;var _0x23cddb;return db[_0xba43('0x50')]['find']({'where':{'id':_0x10575e[_0xba43('0x61')]['id']},'include':[{'model':db[_0xba43('0xf9')],'as':'Interval','include':[{'model':db[_0xba43('0xf9')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xba43('0x23')](handleEntityNotFound(_0x2cc36c,null))[_0xba43('0x23')](function(_0x38b71a){if(_0x38b71a){_0x45118f=_0x38b71a;return _0x38b71a[_0xba43('0xfa')]({'raw':!![]});}})['then'](function(_0x3de582){if(_0x45118f){if(_0x3de582){_0x23cddb=_0x3de582;}}return require('../../config/license/util')[_0xba43('0x7b')]();})['then'](function(_0x483353){if(_0x483353){_0x57d1cb=_0x483353[_0xba43('0xfb')];_0x539140=_0x483353[_0xba43('0x7c')];}})[_0xba43('0x23')](function(){return db[_0xba43('0xb5')][_0xba43('0x51')]({'where':{'closed':![]}});})['then'](function(_0x75b945){_0x2f16ea=_0x75b945;if(_0x57d1cb&&_0x75b945>_0x57d1cb){return db[_0xba43('0xfc')]['findOne']({'where':{'id':0x1}})[_0xba43('0x23')](function(_0x5c5fd8){if(_0x5c5fd8){_0x5c5fd8[_0xba43('0xfd')](_0xba43('0xfe'));}});}})[_0xba43('0x23')](function(){if(_0x45118f[_0xba43('0xf9')]&&_0x45118f[_0xba43('0xf9')][_0xba43('0xff')]){var _0x3fd987=[];for(var _0x4e1bbd=0x0;_0x4e1bbd<_0x45118f['Interval'][_0xba43('0xff')][_0xba43('0x45')];_0x4e1bbd++){var _0x9cdf9f=_0x45118f['Interval']['Intervals'][_0x4e1bbd][_0xba43('0x36')]({'plain':!![]});_0x3fd987[_0xba43('0xbd')](iftimePromise(_0x9cdf9f,_0x45118f));}return BPromise[_0xba43('0x100')](_0x3fd987)['then'](function(_0x514a7a){return _[_0xba43('0x101')](_0x514a7a);});}else{return!![];}})[_0xba43('0x23')](function(_0x20dc02){var _0x5c43f2=fs[_0xba43('0xd1')](path['join'](config[_0xba43('0x7f')],_0xba43('0x102')),_0xba43('0xd3'));var _0x410550={'remote':_0x45118f[_0xba43('0x103')],'query':querystring[_0xba43('0xb3')](_['merge'](_0x45118f[_0xba43('0x36')]({'plain':!![]}),{'customerIp':_0x10575e[_0xba43('0x8e')][_0xba43('0x104')]||_0x10575e[_0xba43('0x8e')][_0xba43('0x105')]||_0x10575e[_0xba43('0x106')]['remoteAddress']||_0x10575e['ip'],'referer':_0x10575e[_0xba43('0x8e')][_0xba43('0x107')],'openedInteractions':_0x2f16ea,'maxInteractions':_0x57d1cb,'virtual':_0x539140[_0xba43('0xfb')],'online':_0x20dc02,'custom':_0x539140}))[_0xba43('0x108')](/'/g,'\x5c\x27')};_0x2cc36c[_0xba43('0x3b')](ejs[_0xba43('0xd4')](Mustache[_0xba43('0xd4')](_0x5c43f2,_0x410550),{'proactiveActions':_0x23cddb,'alignment':_0x45118f['alignment'],'verticalAlignment':_0x45118f[_0xba43('0x109')]}));})[_0xba43('0x2b')](handleError(_0x2cc36c,null));};exports[_0xba43('0x10a')]=function(_0xe22e0d,_0x1d033f,_0x5a8b27){return db[_0xba43('0x50')][_0xba43('0x6d')]({'where':{'id':_0xe22e0d[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x1d033f,null))['then'](function(_0x57b7cc){if(_0x57b7cc){return db[_0xba43('0x10b')][_0xba43('0x10c')](function(_0x3a9d3d){return db[_0xba43('0xa0')]['destroy']({'where':{'ChatWebsiteId':_0xe22e0d[_0xba43('0x61')]['id']},'transaction':_0x3a9d3d})['then'](function(_0x137cf4){var _0x2a033a=_['map'](_0xe22e0d['body'],function(_0xfa043e){_0xfa043e['ChatWebsiteId']=_0xe22e0d[_0xba43('0x61')]['id'];return _0xfa043e;});return db[_0xba43('0xa0')][_0xba43('0x10d')](_0x2a033a,{'transaction':_0x3a9d3d});});})[_0xba43('0x23')](function(){return db[_0xba43('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0xe22e0d['params']['id']},'order':_0xba43('0xa5')});});}})['then'](respondWithResult(_0x1d033f,null))[_0xba43('0x2b')](handleError(_0x1d033f,null));};exports[_0xba43('0x10e')]=function(_0x36bce1,_0x4b687c,_0x9b37fd){var _0x3ef42a={};var _0x4421cc={};var _0x31659c;var _0x331a34;return db['ChatWebsite'][_0xba43('0x6d')]({'where':{'id':_0x36bce1['params']['id']}})['then'](handleEntityNotFound(_0x4b687c,null))[_0xba43('0x23')](function(_0x87dfe1){if(_0x87dfe1){_0x31659c=_0x87dfe1;_0x4421cc[_0xba43('0x3f')]=_[_0xba43('0x40')](db['ChatApplication'][_0xba43('0x57')]);_0x4421cc[_0xba43('0x41')]=_[_0xba43('0x40')](_0x36bce1[_0xba43('0x41')]);_0x4421cc[_0xba43('0x42')]=_[_0xba43('0x58')](_0x4421cc[_0xba43('0x3f')],_0x4421cc[_0xba43('0x41')]);_0x3ef42a[_0xba43('0x43')]=_[_0xba43('0x58')](_0x4421cc[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x36bce1[_0xba43('0x41')]['fields']));_0x3ef42a[_0xba43('0x43')]=_0x3ef42a[_0xba43('0x43')][_0xba43('0x45')]?_0x3ef42a['attributes']:_0x4421cc[_0xba43('0x3f')];_0x3ef42a['order']=qs['sort'](_0x36bce1[_0xba43('0x41')]['sort']);_0x3ef42a[_0xba43('0x4a')]=qs[_0xba43('0x42')](_[_0xba43('0x67')](_0x36bce1[_0xba43('0x41')],_0x4421cc[_0xba43('0x42')]));if(_0x36bce1[_0xba43('0x41')][_0xba43('0x49')]){_0x3ef42a['where']=_[_0xba43('0x4b')](_0x3ef42a[_0xba43('0x4a')],{'$or':_[_0xba43('0x4c')](_0x3ef42a[_0xba43('0x43')],function(_0x3c60bb){var _0x1fdf71={};_0x1fdf71[_0x3c60bb]={'$like':'%'+_0x36bce1[_0xba43('0x41')][_0xba43('0x49')]+'%'};return _0x1fdf71;})});}_0x3ef42a=_[_0xba43('0x4b')]({},_0x3ef42a,_0x36bce1['options']);return _0x31659c[_0xba43('0x10e')](_0x3ef42a);}})['then'](function(_0x5b8d14){if(_0x5b8d14){_0x331a34=_0x5b8d14[_0xba43('0x45')];if(!_0x36bce1[_0xba43('0x41')]['hasOwnProperty'](_0xba43('0x46'))){_0x3ef42a[_0xba43('0x31')]=qs[_0xba43('0x31')](_0x36bce1['query'][_0xba43('0x31')]);_0x3ef42a[_0xba43('0x30')]=qs['offset'](_0x36bce1[_0xba43('0x41')]['offset']);}return _0x31659c['getApplications'](_0x3ef42a);}})[_0xba43('0x23')](function(_0x39f948){if(_0x39f948){return _0x39f948?{'count':_0x331a34,'rows':_0x39f948}:null;}})['then'](respondWithResult(_0x4b687c,null))[_0xba43('0x2b')](handleError(_0x4b687c,null));};exports[_0xba43('0x10f')]=function(_0x293997,_0x5068b8,_0x878b2f){return db[_0xba43('0x110')][_0xba43('0x59')]({'where':{'id':_0x293997[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x5068b8,null))[_0xba43('0x23')](function(_0xefed41){if(_0xefed41){return _0xefed41['addProactiveActions'](_0x293997['body'][_0xba43('0x69')],_[_0xba43('0xe7')](_0x293997[_0xba43('0x5b')],[_0xba43('0x69'),'id'])||{});}})[_0xba43('0x23')](respondWithResult(_0x5068b8,null))[_0xba43('0x2b')](handleError(_0x5068b8,null));};exports[_0xba43('0xfa')]=function(_0x81e615,_0x5dbe80,_0x3229af){var _0x6bba4a={};var _0x59b856={};var _0x255862;var _0x387763;return db[_0xba43('0x50')][_0xba43('0x6d')]({'where':{'id':_0x81e615[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x5dbe80,null))[_0xba43('0x23')](function(_0x291a37){if(_0x291a37){_0x255862=_0x291a37;_0x59b856[_0xba43('0x3f')]=_[_0xba43('0x40')](db[_0xba43('0x111')][_0xba43('0x57')]);_0x59b856[_0xba43('0x41')]=_[_0xba43('0x40')](_0x81e615[_0xba43('0x41')]);_0x59b856[_0xba43('0x42')]=_[_0xba43('0x58')](_0x59b856[_0xba43('0x3f')],_0x59b856[_0xba43('0x41')]);_0x6bba4a[_0xba43('0x43')]=_[_0xba43('0x58')](_0x59b856[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x81e615['query'][_0xba43('0x44')]));_0x6bba4a['attributes']=_0x6bba4a[_0xba43('0x43')][_0xba43('0x45')]?_0x6bba4a[_0xba43('0x43')]:_0x59b856[_0xba43('0x3f')];_0x6bba4a[_0xba43('0x47')]=qs['sort'](_0x81e615[_0xba43('0x41')]['sort']);_0x6bba4a[_0xba43('0x4a')]=qs[_0xba43('0x42')](_['pick'](_0x81e615[_0xba43('0x41')],_0x59b856['filters']));if(_0x81e615[_0xba43('0x41')]['filter']){_0x6bba4a[_0xba43('0x4a')]=_[_0xba43('0x4b')](_0x6bba4a[_0xba43('0x4a')],{'$or':_[_0xba43('0x4c')](_0x6bba4a[_0xba43('0x43')],function(_0x19cf35){var _0x21e651={};_0x21e651[_0x19cf35]={'$like':'%'+_0x81e615[_0xba43('0x41')][_0xba43('0x49')]+'%'};return _0x21e651;})});}_0x6bba4a=_[_0xba43('0x4b')]({},_0x6bba4a,_0x81e615['options']);return _0x255862['getProactiveActions'](_0x6bba4a);}})[_0xba43('0x23')](function(_0x40068e){if(_0x40068e){_0x387763=_0x40068e[_0xba43('0x45')];if(!_0x81e615[_0xba43('0x41')][_0xba43('0x66')](_0xba43('0x46'))){_0x6bba4a[_0xba43('0x31')]=qs[_0xba43('0x31')](_0x81e615[_0xba43('0x41')]['limit']);_0x6bba4a[_0xba43('0x30')]=qs[_0xba43('0x30')](_0x81e615[_0xba43('0x41')][_0xba43('0x30')]);}return _0x255862[_0xba43('0xfa')](_0x6bba4a);}})[_0xba43('0x23')](function(_0x1f3a5b){if(_0x1f3a5b){return _0x1f3a5b?{'count':_0x387763,'rows':_0x1f3a5b}:null;}})[_0xba43('0x23')](respondWithResult(_0x5dbe80,null))[_0xba43('0x2b')](handleError(_0x5dbe80,null));};exports[_0xba43('0x112')]=function(_0x21ff96,_0x378832,_0x345117){var _0x53763b=_0x21ff96[_0xba43('0x41')]['online']===_0xba43('0x113')?_0xba43('0x114'):_0xba43('0x115');return db[_0xba43('0x50')][_0xba43('0x59')]({'attributes':['id',_0x53763b],'where':{'id':_0x21ff96[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x378832,null))['then'](function(_0x2f174d){if(_0x2f174d){var _0x2b2b30=_0x2f174d[_0x53763b];var _0x2d1543=_0x2b2b30&&_0x2b2b30[_0xba43('0x116')]?_0x2b2b30['items']:[];_0x378832[_0xba43('0x3b')]({'fromKey':_[_0xba43('0x84')](_0x2b2b30['fromKey'])?undefined:_0x2b2b30[_0xba43('0x117')],'count':_0x2d1543['length'],'rows':_0x2d1543});}})['catch'](handleError(_0x378832,null));};exports['getOfflineMessages']=function(_0x1385fe,_0x1641c2,_0x572ad6){var _0xbccb17={'raw':!![],'where':{}};var _0x4d5c8c={};var _0x576dd6={'count':0x0,'rows':[]};return db[_0xba43('0x50')][_0xba43('0x6d')]({'where':{'id':_0x1385fe['params']['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x1641c2,null))['then'](function(_0x2ae16d){if(_0x2ae16d){_0x4d5c8c[_0xba43('0x3f')]=_[_0xba43('0x40')](db['ChatOfflineMessage']['rawAttributes']);_0x4d5c8c['query']=_[_0xba43('0x40')](_0x1385fe[_0xba43('0x41')]);_0x4d5c8c[_0xba43('0x42')]=_[_0xba43('0x58')](_0x4d5c8c['model'],_0x4d5c8c[_0xba43('0x41')]);_0xbccb17[_0xba43('0x43')]=_[_0xba43('0x58')](_0x4d5c8c[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x1385fe[_0xba43('0x41')][_0xba43('0x44')]));_0xbccb17[_0xba43('0x43')]=_0xbccb17[_0xba43('0x43')][_0xba43('0x45')]?_0xbccb17[_0xba43('0x43')]:_0x4d5c8c['model'];if(!_0x1385fe[_0xba43('0x41')]['hasOwnProperty'](_0xba43('0x46'))){_0xbccb17[_0xba43('0x31')]=qs[_0xba43('0x31')](_0x1385fe[_0xba43('0x41')][_0xba43('0x31')]);_0xbccb17['offset']=qs[_0xba43('0x30')](_0x1385fe[_0xba43('0x41')]['offset']);}_0xbccb17[_0xba43('0x47')]=qs[_0xba43('0x48')](_0x1385fe['query'][_0xba43('0x48')]);_0xbccb17['where']=qs['filters'](_['pick'](_0x1385fe[_0xba43('0x41')],_0x4d5c8c[_0xba43('0x42')]));_0xbccb17[_0xba43('0x4a')][_0xba43('0x64')]=_0x2ae16d['id'];if(_0x1385fe[_0xba43('0x41')]['filter']){_0xbccb17['where']=_[_0xba43('0x4b')](_0xbccb17['where'],{'$or':_[_0xba43('0x4c')](_0xbccb17[_0xba43('0x43')],function(_0x3e919e){var _0x2c13bd={};_0x2c13bd[_0x3e919e]={'$like':'%'+_0x1385fe[_0xba43('0x41')][_0xba43('0x49')]+'%'};return _0x2c13bd;})});}_0xbccb17=_['merge']({},_0xbccb17,_0x1385fe[_0xba43('0x4f')]);return db[_0xba43('0xd7')][_0xba43('0x51')]({'where':_0xbccb17[_0xba43('0x4a')]})[_0xba43('0x23')](function(_0x35d5b2){_0x576dd6['count']=_0x35d5b2;if(_0x1385fe[_0xba43('0x41')][_0xba43('0x52')]){_0xbccb17['include']=[{'all':!![]}];}return db[_0xba43('0xd7')][_0xba43('0x54')](_0xbccb17);})['then'](function(_0x2d1516){_0x576dd6['rows']=_0x2d1516;return _0x576dd6;});}})[_0xba43('0x23')](respondWithFilteredResult(_0x1641c2,_0xbccb17))[_0xba43('0x2b')](handleError(_0x1641c2,null));};exports[_0xba43('0x118')]=function(_0x1a7da7,_0x5735e7,_0x1539a1){return db['ChatWebsite'][_0xba43('0x59')]({'where':{'id':_0x1a7da7[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x5735e7,null))['then'](function(_0x5a1c55){if(_0x5a1c55){return _0x5a1c55[_0xba43('0x118')](_0x1a7da7[_0xba43('0x5b')][_0xba43('0x69')],_[_0xba43('0xe7')](_0x1a7da7[_0xba43('0x5b')],[_0xba43('0x69'),'id'])||{})['spread'](function(_0x5e1d85){for(var _0x27b0a0=0x0;_0x27b0a0<_0x1a7da7[_0xba43('0x5b')][_0xba43('0x69')][_0xba43('0x45')];_0x27b0a0+=0x1){socket[_0xba43('0x119')](_0xba43('0x11a'),{'UserId':_0x1a7da7[_0xba43('0x5b')][_0xba43('0x69')][_0x27b0a0],'ChatWebsiteId':_0x1a7da7[_0xba43('0x61')]['id']});}return _0x5e1d85;});}})['then'](respondWithResult(_0x5735e7,null))[_0xba43('0x2b')](handleError(_0x5735e7,null));};exports[_0xba43('0x11b')]=function(_0xfdedcc,_0x1e8dd1,_0x2e7962){return db['ChatWebsite'][_0xba43('0x59')]({'where':{'id':_0xfdedcc[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0x1e8dd1,null))[_0xba43('0x23')](function(_0x4aea89){if(_0x4aea89){return _0x4aea89[_0xba43('0x11b')](_0xfdedcc[_0xba43('0x41')]['ids'])[_0xba43('0x23')](function(){if(_[_0xba43('0x11c')](_0xfdedcc[_0xba43('0x41')][_0xba43('0x69')])){for(var _0x4c21e4=0x0;_0x4c21e4<_0xfdedcc[_0xba43('0x41')][_0xba43('0x69')][_0xba43('0x45')];_0x4c21e4+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xfdedcc[_0xba43('0x41')]['ids'][_0x4c21e4]),'ChatWebsiteId':Number(_0xfdedcc[_0xba43('0x61')]['id'])});}}else{socket[_0xba43('0x119')](_0xba43('0x11d'),{'UserId':Number(_0xfdedcc['query']['ids']),'ChatWebsiteId':Number(_0xfdedcc[_0xba43('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e8dd1,null))[_0xba43('0x2b')](handleError(_0x1e8dd1,null));};exports[_0xba43('0x11e')]=function(_0x4898ef,_0xbe0f64,_0x474f19){var _0x12dd09={};var _0x115483={};var _0x1d6066;var _0x9bd030;return db[_0xba43('0x50')]['findOne']({'where':{'id':_0x4898ef[_0xba43('0x61')]['id']}})[_0xba43('0x23')](handleEntityNotFound(_0xbe0f64,null))[_0xba43('0x23')](function(_0x1b1e25){if(_0x1b1e25){_0x1d6066=_0x1b1e25;_0x115483[_0xba43('0x3f')]=_[_0xba43('0x40')](db[_0xba43('0xc4')]['rawAttributes']);_0x115483[_0xba43('0x41')]=_[_0xba43('0x40')](_0x4898ef[_0xba43('0x41')]);_0x115483[_0xba43('0x42')]=_[_0xba43('0x58')](_0x115483[_0xba43('0x3f')],_0x115483[_0xba43('0x41')]);_0x12dd09[_0xba43('0x43')]=_['intersection'](_0x115483[_0xba43('0x3f')],qs[_0xba43('0x44')](_0x4898ef['query']['fields']));_0x12dd09['attributes']=_0x12dd09[_0xba43('0x43')][_0xba43('0x45')]?_0x12dd09[_0xba43('0x43')]:_0x115483[_0xba43('0x3f')];_0x12dd09['order']=qs[_0xba43('0x48')](_0x4898ef[_0xba43('0x41')][_0xba43('0x48')]);_0x12dd09[_0xba43('0x4a')]=qs['filters'](_[_0xba43('0x67')](_0x4898ef[_0xba43('0x41')],_0x115483[_0xba43('0x42')]));if(_0x4898ef[_0xba43('0x41')][_0xba43('0x49')]){_0x12dd09[_0xba43('0x4a')]=_[_0xba43('0x4b')](_0x12dd09[_0xba43('0x4a')],{'$or':_[_0xba43('0x4c')](_0x12dd09['attributes'],function(_0xa8c88d){var _0x326897={};_0x326897[_0xa8c88d]={'$like':'%'+_0x4898ef['query']['filter']+'%'};return _0x326897;})});}_0x12dd09=_[_0xba43('0x4b')]({},_0x12dd09,_0x4898ef[_0xba43('0x4f')]);return _0x1d6066[_0xba43('0x11e')](_0x12dd09);}})[_0xba43('0x23')](function(_0x140c01){if(_0x140c01){_0x9bd030=_0x140c01[_0xba43('0x45')];if(!_0x4898ef['query']['hasOwnProperty'](_0xba43('0x46'))){_0x12dd09[_0xba43('0x31')]=qs['limit'](_0x4898ef[_0xba43('0x41')]['limit']);_0x12dd09[_0xba43('0x30')]=qs[_0xba43('0x30')](_0x4898ef[_0xba43('0x41')][_0xba43('0x30')]);}return _0x1d6066['getAgents'](_0x12dd09);}})[_0xba43('0x23')](function(_0x601ae2){if(_0x601ae2){return _0x601ae2?{'count':_0x9bd030,'rows':_0x601ae2}:null;}})[_0xba43('0x23')](respondWithResult(_0xbe0f64,null))[_0xba43('0x2b')](handleError(_0xbe0f64,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a5a6e79..84c714c 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 _0x230a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x230a,0x1aa));var _0xa230=function(_0x150e76,_0x57f241){_0x150e76=_0x150e76-0x0;var _0x4cb857=_0x230a[_0x150e76];return _0x4cb857;};'use strict';var EventEmitter=require(_0xa230('0x0'));var ChatWebsite=require(_0xa230('0x1'))['db'][_0xa230('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa230('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa230('0x4'),'afterDestroy':_0xa230('0x5')};function emitEvent(_0x117d8e){return function(_0x2268f0,_0x3c1ee5,_0x30ab5d){ChatWebsiteEvents[_0xa230('0x6')](_0x117d8e+':'+_0x2268f0['id'],_0x2268f0);ChatWebsiteEvents[_0xa230('0x6')](_0x117d8e,_0x2268f0);_0x30ab5d(null);};}for(var e in events){if(events[_0xa230('0x7')](e)){var event=events[e];ChatWebsite[_0xa230('0x8')](e,emitEvent(event));}}module[_0xa230('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5742=['hasOwnProperty','hook','exports','events','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x10649d,_0x1c5738){var _0x78f384=function(_0x145720){while(--_0x145720){_0x10649d['push'](_0x10649d['shift']());}};_0x78f384(++_0x1c5738);}(_0x5742,0x11b));var _0x2574=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5742[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0x2574('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x2574('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2574('0x2')](0x0);var events={'afterCreate':_0x2574('0x3'),'afterUpdate':_0x2574('0x4'),'afterDestroy':_0x2574('0x5')};function emitEvent(_0x453990){return function(_0x23f70e,_0x43cdef,_0x2430f1){ChatWebsiteEvents[_0x2574('0x6')](_0x453990+':'+_0x23f70e['id'],_0x23f70e);ChatWebsiteEvents['emit'](_0x453990,_0x23f70e);_0x2430f1(null);};}for(var e in events){if(events[_0x2574('0x7')](e)){var event=events[e];ChatWebsite[_0x2574('0x8')](e,emitEvent(event));}}module[_0x2574('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 16bc212..15abfb8 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 _0xfed5=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x37989f,_0x3a335c){var _0x31acb5=function(_0x80dfe9){while(--_0x80dfe9){_0x37989f['push'](_0x37989f['shift']());}};_0x31acb5(++_0x3a335c);}(_0xfed5,0xb5));var _0x5fed=function(_0x63f478,_0xd542b8){_0x63f478=_0x63f478-0x0;var _0x3a9a0f=_0xfed5[_0x63f478];return _0x3a9a0f;};'use strict';var _=require(_0x5fed('0x0'));var util=require(_0x5fed('0x1'));var logger=require(_0x5fed('0x2'))(_0x5fed('0x3'));var moment=require('moment');var BPromise=require(_0x5fed('0x4'));var rp=require(_0x5fed('0x5'));var fs=require('fs');var path=require(_0x5fed('0x6'));var rimraf=require(_0x5fed('0x7'));var config=require(_0x5fed('0x8'));var attributes=require(_0x5fed('0x9'));module[_0x5fed('0xa')]=function(_0x4fb488,_0xe7441a){return _0x4fb488[_0x5fed('0xb')](_0x5fed('0xc'),attributes,{'tableName':_0x5fed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f9=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d02db,_0x34bc34){var _0x187ad1=function(_0x222a4){while(--_0x222a4){_0x5d02db['push'](_0x5d02db['shift']());}};_0x187ad1(++_0x34bc34);}(_0x82f9,0x7d));var _0x982f=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x82f9[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0x982f('0x0'));var util=require(_0x982f('0x1'));var logger=require(_0x982f('0x2'))(_0x982f('0x3'));var moment=require(_0x982f('0x4'));var BPromise=require(_0x982f('0x5'));var rp=require(_0x982f('0x6'));var fs=require('fs');var path=require(_0x982f('0x7'));var rimraf=require(_0x982f('0x8'));var config=require(_0x982f('0x9'));var attributes=require(_0x982f('0xa'));module[_0x982f('0xb')]=function(_0x2181af,_0x4df1a3){return _0x2181af[_0x982f('0xc')](_0x982f('0xd'),attributes,{'tableName':_0x982f('0xe'),'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 508ce75..708dcea 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 _0x31f1=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash'];(function(_0x14e774,_0x20b205){var _0x1ad6ce=function(_0x2632f9){while(--_0x2632f9){_0x14e774['push'](_0x14e774['shift']());}};_0x1ad6ce(++_0x20b205);}(_0x31f1,0x6f));var _0x131f=function(_0x564588,_0x134740){_0x564588=_0x564588-0x0;var _0x3d1d7f=_0x31f1[_0x564588];return _0x3d1d7f;};'use strict';var _=require(_0x131f('0x0'));var util=require(_0x131f('0x1'));var moment=require(_0x131f('0x2'));var BPromise=require(_0x131f('0x3'));var rs=require(_0x131f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x131f('0x5'))['db'];var utils=require(_0x131f('0x6'));var logger=require(_0x131f('0x7'))(_0x131f('0x8'));var config=require(_0x131f('0x9'));var jayson=require(_0x131f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x131f('0xb')]=_[_0x131f('0xc')](config[_0x131f('0xb')],{'host':_0x131f('0xd'),'port':0x18eb});var socket=require(_0x131f('0xe'))(new Redis(config['redis']));require(_0x131f('0xf'))[_0x131f('0x10')](socket);function respondWithRpcPromise(_0x179750,_0x2a36dd,_0x3a2da8){return new BPromise(function(_0x4c8e26,_0x3265ca){return client[_0x131f('0x11')](_0x179750,_0x3a2da8)['then'](function(_0x5e491d){logger['info'](_0x131f('0x12'),_0x2a36dd,'request\x20sent');logger[_0x131f('0x13')](_0x131f('0x14'),_0x2a36dd,_0x131f('0x15'),JSON['stringify'](_0x5e491d));if(_0x5e491d[_0x131f('0x16')]){if(_0x5e491d['error'][_0x131f('0x17')]===0x1f4){logger[_0x131f('0x16')](_0x131f('0x12'),_0x2a36dd,_0x5e491d[_0x131f('0x16')][_0x131f('0x18')]);return _0x3265ca(_0x5e491d[_0x131f('0x16')][_0x131f('0x18')]);}logger[_0x131f('0x16')](_0x131f('0x12'),_0x2a36dd,_0x5e491d[_0x131f('0x16')]['message']);return _0x4c8e26(_0x5e491d[_0x131f('0x16')][_0x131f('0x18')]);}else{logger[_0x131f('0x19')](_0x131f('0x12'),_0x2a36dd,_0x131f('0x15'));_0x4c8e26(_0x5e491d[_0x131f('0x1a')][_0x131f('0x18')]);}})[_0x131f('0x1b')](function(_0x219e17){logger[_0x131f('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x2a36dd,_0x219e17);_0x3265ca(_0x219e17);});});} \ No newline at end of file +var _0xccac=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0xd6f94,_0x57f718){var _0x1c4901=function(_0x5c498d){while(--_0x5c498d){_0xd6f94['push'](_0xd6f94['shift']());}};_0x1c4901(++_0x57f718);}(_0xccac,0x1cb));var _0xccca=function(_0x251c6a,_0x3062e9){_0x251c6a=_0x251c6a-0x0;var _0x11c1f9=_0xccac[_0x251c6a];return _0x11c1f9;};'use strict';var _=require(_0xccca('0x0'));var util=require(_0xccca('0x1'));var moment=require(_0xccca('0x2'));var BPromise=require(_0xccca('0x3'));var rs=require(_0xccca('0x4'));var fs=require('fs');var Redis=require(_0xccca('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xccca('0x6'))('rpc');var config=require(_0xccca('0x7'));var jayson=require(_0xccca('0x8'));var client=jayson[_0xccca('0x9')][_0xccca('0xa')]({'port':0x232a});config[_0xccca('0xb')]=_['defaults'](config['redis'],{'host':_0xccca('0xc'),'port':0x18eb});var socket=require(_0xccca('0xd'))(new Redis(config[_0xccca('0xb')]));require(_0xccca('0xe'))['register'](socket);function respondWithRpcPromise(_0x5aea5d,_0x566e4b,_0x424234){return new BPromise(function(_0xe0b55c,_0x313665){return client[_0xccca('0xf')](_0x5aea5d,_0x424234)[_0xccca('0x10')](function(_0x223dc0){logger[_0xccca('0x11')](_0xccca('0x12'),_0x566e4b,'request\x20sent');logger[_0xccca('0x13')](_0xccca('0x14'),_0x566e4b,_0xccca('0x15'),JSON['stringify'](_0x223dc0));if(_0x223dc0[_0xccca('0x16')]){if(_0x223dc0[_0xccca('0x16')][_0xccca('0x17')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x566e4b,_0x223dc0[_0xccca('0x16')][_0xccca('0x18')]);return _0x313665(_0x223dc0['error'][_0xccca('0x18')]);}logger[_0xccca('0x16')](_0xccca('0x12'),_0x566e4b,_0x223dc0[_0xccca('0x16')][_0xccca('0x18')]);return _0xe0b55c(_0x223dc0[_0xccca('0x16')]['message']);}else{logger[_0xccca('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x566e4b,_0xccca('0x15'));_0xe0b55c(_0x223dc0[_0xccca('0x19')]['message']);}})[_0xccca('0x1a')](function(_0xe55669){logger[_0xccca('0x16')](_0xccca('0x12'),_0x566e4b,_0xe55669);_0x313665(_0xe55669);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 875e089..8b80570 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 _0x7ed2=['register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ed2,0x16b));var _0x27ed=function(_0x205261,_0x385345){_0x205261=_0x205261-0x0;var _0x387bda=_0x7ed2[_0x205261];return _0x387bda;};'use strict';var ChatWebsiteEvents=require(_0x27ed('0x0'));var events=[_0x27ed('0x1'),_0x27ed('0x2'),_0x27ed('0x3')];function createListener(_0x1b35bb,_0x3ef07b){return function(_0x2a46e4){_0x3ef07b[_0x27ed('0x4')](_0x1b35bb,_0x2a46e4);};}function removeListener(_0x10b201,_0x2eff45){return function(){ChatWebsiteEvents[_0x27ed('0x5')](_0x10b201,_0x2eff45);};}exports[_0x27ed('0x6')]=function(_0x4fb495){for(var _0x385407=0x0,_0x409170=events[_0x27ed('0x7')];_0x385407<_0x409170;_0x385407++){var _0x106537=events[_0x385407];var _0x2befc=createListener(_0x27ed('0x8')+_0x106537,_0x4fb495);ChatWebsiteEvents['on'](_0x106537,_0x2befc);}}; \ No newline at end of file +var _0x7aee=['removeListener','register','length','chatWebsite:','save','remove','update','emit'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x7aee,0x9c));var _0xe7ae=function(_0x54bf82,_0x2e146b){_0x54bf82=_0x54bf82-0x0;var _0x2f74ba=_0x7aee[_0x54bf82];return _0x2f74ba;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe7ae('0x0'),_0xe7ae('0x1'),_0xe7ae('0x2')];function createListener(_0x2d1a8b,_0x3fc893){return function(_0x5a6614){_0x3fc893[_0xe7ae('0x3')](_0x2d1a8b,_0x5a6614);};}function removeListener(_0x20438d,_0x546633){return function(){ChatWebsiteEvents[_0xe7ae('0x4')](_0x20438d,_0x546633);};}exports[_0xe7ae('0x5')]=function(_0x5a6fda){for(var _0x26badb=0x0,_0x4f1f15=events[_0xe7ae('0x6')];_0x26badb<_0x4f1f15;_0x26badb++){var _0x33c152=events[_0x26badb];var _0x384cbc=createListener(_0xe7ae('0x7')+_0x33c152,_0x5a6fda);ChatWebsiteEvents['on'](_0x33c152,_0x384cbc);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ef83a75..2e45442 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 _0x0e35=['destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','describe','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getOfflineMessages','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','file','root','server/files/images/avatars/','originalname','single','addCustomerAvatar','addSystemAvatar','/:id/notify','/:id/offline','addInteraction','/:id/users','put','/:id','update'];(function(_0x8d2259,_0x2a05a8){var _0x4b3aae=function(_0x749dba){while(--_0x749dba){_0x8d2259['push'](_0x8d2259['shift']());}};_0x4b3aae(++_0x2a05a8);}(_0x0e35,0xc2));var _0x50e3=function(_0x28de58,_0x248ddb){_0x28de58=_0x28de58-0x0;var _0x3c8bd9=_0x0e35[_0x28de58];return _0x3c8bd9;};'use strict';var multer=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var path=require(_0x50e3('0x2'));var timeout=require(_0x50e3('0x3'));var express=require(_0x50e3('0x4'));var router=express[_0x50e3('0x5')]();var auth=require(_0x50e3('0x6'));var interaction=require(_0x50e3('0x7'));var config=require(_0x50e3('0x8'));var controller=require(_0x50e3('0x9'));router['get']('/',auth[_0x50e3('0xa')](),controller[_0x50e3('0xb')]);router['get']('/describe',auth[_0x50e3('0xa')](),controller[_0x50e3('0xc')]);router['get']('/:id',auth[_0x50e3('0xa')](),controller[_0x50e3('0xd')]);router[_0x50e3('0xe')](_0x50e3('0xf'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x10')]);router[_0x50e3('0xe')](_0x50e3('0x11'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x12')]);router[_0x50e3('0xe')](_0x50e3('0x13'),controller[_0x50e3('0x14')]);router['get'](_0x50e3('0x15'),controller[_0x50e3('0x16')]);router[_0x50e3('0xe')](_0x50e3('0x17'),controller['getCustomerAvatar']);router[_0x50e3('0xe')](_0x50e3('0x18'),controller['getSystemAvatar']);router[_0x50e3('0xe')](_0x50e3('0x19'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x1a')]);router[_0x50e3('0xe')]('/:id/snippet',controller[_0x50e3('0x1b')]);router['get'](_0x50e3('0x1c'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x1d')]);router['get'](_0x50e3('0x1e'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x1f')]);router[_0x50e3('0xe')]('/:id/fields',controller['getFields']);router[_0x50e3('0xe')]('/:id/offline_messages',auth[_0x50e3('0xa')](),controller[_0x50e3('0x20')]);router['get']('/:id/users',auth[_0x50e3('0xa')](),controller[_0x50e3('0x21')]);router['post']('/',auth[_0x50e3('0xa')](),controller[_0x50e3('0x22')]);router[_0x50e3('0x23')](_0x50e3('0xf'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x24')]);router['post'](_0x50e3('0x11'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x25')]);var upload=multer({'storage':multer[_0x50e3('0x26')]({'destination':function(_0x34c68c,_0x283459,_0x3c2e05){_0x3c2e05(null,path[_0x50e3('0x27')](config['root'],_0x50e3('0x28')));},'filename':function(_0x576c7c,_0x14c06c,_0x15bf54){_0x15bf54(null,util[_0x50e3('0x29')](_0x50e3('0x2a'),Date[_0x50e3('0x2b')](),_0x14c06c['originalname']));}})});router['post'](_0x50e3('0x13'),upload['single'](_0x50e3('0x2c')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e5b36,_0x455c5e,_0x169fd7){_0x169fd7(null,path[_0x50e3('0x27')](config[_0x50e3('0x2d')],_0x50e3('0x2e')));},'filename':function(_0x23a5f4,_0x8b7e30,_0x2a028b){_0x2a028b(null,util['format'](_0x50e3('0x2a'),Date[_0x50e3('0x2b')](),_0x8b7e30[_0x50e3('0x2f')]));}})});router['post'](_0x50e3('0x15'),upload[_0x50e3('0x30')](_0x50e3('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x50e3('0x26')]({'destination':function(_0x1b34ca,_0x5c602d,_0x3ac5d0){_0x3ac5d0(null,path[_0x50e3('0x27')](config[_0x50e3('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x27a272,_0x2ab69f,_0x3bf04a){_0x3bf04a(null,util[_0x50e3('0x29')](_0x50e3('0x2a'),Date[_0x50e3('0x2b')](),_0x2ab69f['originalname']));}})});router[_0x50e3('0x23')](_0x50e3('0x17'),upload[_0x50e3('0x30')]('file'),controller[_0x50e3('0x31')]);var upload=multer({'storage':multer[_0x50e3('0x26')]({'destination':function(_0x4cddb8,_0x39aab3,_0x5ab382){_0x5ab382(null,path[_0x50e3('0x27')](config['root'],_0x50e3('0x2e')));},'filename':function(_0x5a1f77,_0x1344a9,_0x512595){_0x512595(null,util['format'](_0x50e3('0x2a'),Date['now'](),_0x1344a9[_0x50e3('0x2f')]));}})});router[_0x50e3('0x23')](_0x50e3('0x18'),upload[_0x50e3('0x30')](_0x50e3('0x2c')),controller[_0x50e3('0x32')]);router[_0x50e3('0x23')](_0x50e3('0x33'),controller['notify']);router[_0x50e3('0x23')](_0x50e3('0x34'),controller['offline']);router[_0x50e3('0x23')](_0x50e3('0x19'),auth['isAuthenticated'](),controller[_0x50e3('0x35')]);router[_0x50e3('0x23')](_0x50e3('0x1c'),auth[_0x50e3('0xa')](),controller['addApplications']);router['post'](_0x50e3('0x1e'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x50e3('0x23')](_0x50e3('0x36'),auth[_0x50e3('0xa')](),controller['addAgents']);router[_0x50e3('0x37')](_0x50e3('0x38'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x39')]);router['delete']('/:id',auth[_0x50e3('0xa')](),controller[_0x50e3('0x3a')]);router[_0x50e3('0x3b')](_0x50e3('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x50e3('0x3b')](_0x50e3('0x11'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x3c')]);router[_0x50e3('0x3b')](_0x50e3('0x36'),auth[_0x50e3('0xa')](),controller[_0x50e3('0x3d')]);module[_0x50e3('0x3e')]=router; \ No newline at end of file +var _0x261b=['diskStorage','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','addProactiveActions','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','/:id/logo','single','file','addLogo','server/files/images/avatars/','now','originalname','addAvatar','addCustomerAvatar'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x261b,0x15a));var _0xb261=function(_0x4e6cae,_0x1724b4){_0x4e6cae=_0x4e6cae-0x0;var _0x2b8468=_0x261b[_0x4e6cae];return _0x2b8468;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xb261('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb261('0x3'));var controller=require('./chatWebsite.controller');router[_0xb261('0x4')]('/',auth['isAuthenticated'](),controller[_0xb261('0x5')]);router[_0xb261('0x4')](_0xb261('0x6'),auth[_0xb261('0x7')](),controller['describe']);router[_0xb261('0x4')](_0xb261('0x8'),auth[_0xb261('0x7')](),controller[_0xb261('0x9')]);router['get'](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0xb')]);router[_0xb261('0x4')](_0xb261('0xc'),auth[_0xb261('0x7')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0xb261('0xd')]);router[_0xb261('0x4')](_0xb261('0xe'),controller[_0xb261('0xf')]);router[_0xb261('0x4')](_0xb261('0x10'),controller['getCustomerAvatar']);router['get'](_0xb261('0x11'),controller[_0xb261('0x12')]);router[_0xb261('0x4')](_0xb261('0x13'),auth[_0xb261('0x7')](),controller[_0xb261('0x14')]);router[_0xb261('0x4')](_0xb261('0x15'),controller[_0xb261('0x16')]);router[_0xb261('0x4')](_0xb261('0x17'),auth[_0xb261('0x7')](),controller['getApplications']);router[_0xb261('0x4')](_0xb261('0x18'),auth[_0xb261('0x7')](),controller[_0xb261('0x19')]);router['get'](_0xb261('0x1a'),controller[_0xb261('0x1b')]);router[_0xb261('0x4')](_0xb261('0x1c'),auth[_0xb261('0x7')](),controller[_0xb261('0x1d')]);router[_0xb261('0x4')](_0xb261('0x1e'),auth[_0xb261('0x7')](),controller[_0xb261('0x1f')]);router[_0xb261('0x20')]('/',auth[_0xb261('0x7')](),controller[_0xb261('0x21')]);router[_0xb261('0x20')](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0x22')]);router['post'](_0xb261('0xc'),auth['isAuthenticated'](),controller[_0xb261('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ddac9,_0x36a504,_0x153176){_0x153176(null,path[_0xb261('0x24')](config[_0xb261('0x25')],_0xb261('0x26')));},'filename':function(_0x1617b4,_0x4e9cbe,_0x677683){_0x677683(null,util[_0xb261('0x27')](_0xb261('0x28'),Date['now'](),_0x4e9cbe['originalname']));}})});router[_0xb261('0x20')](_0xb261('0x29'),upload[_0xb261('0x2a')](_0xb261('0x2b')),controller[_0xb261('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x181ae8,_0x3995e6,_0x5787e3){_0x5787e3(null,path[_0xb261('0x24')](config[_0xb261('0x25')],_0xb261('0x2d')));},'filename':function(_0x4bc2db,_0x1dcfb3,_0x5279de){_0x5279de(null,util[_0xb261('0x27')](_0xb261('0x28'),Date[_0xb261('0x2e')](),_0x1dcfb3[_0xb261('0x2f')]));}})});router[_0xb261('0x20')](_0xb261('0xe'),upload[_0xb261('0x2a')](_0xb261('0x2b')),controller[_0xb261('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x33d53c,_0xaab320,_0x1bb1c1){_0x1bb1c1(null,path[_0xb261('0x24')](config['root'],_0xb261('0x2d')));},'filename':function(_0x196435,_0x2f39d4,_0x1b225b){_0x1b225b(null,util['format']('%s-%s',Date[_0xb261('0x2e')](),_0x2f39d4['originalname']));}})});router[_0xb261('0x20')](_0xb261('0x10'),upload[_0xb261('0x2a')](_0xb261('0x2b')),controller[_0xb261('0x31')]);var upload=multer({'storage':multer[_0xb261('0x32')]({'destination':function(_0x266ae4,_0x39dc60,_0x59b68f){_0x59b68f(null,path[_0xb261('0x24')](config[_0xb261('0x25')],'server/files/images/avatars/'));},'filename':function(_0x400a5b,_0x56c50d,_0x336773){_0x336773(null,util[_0xb261('0x27')](_0xb261('0x28'),Date[_0xb261('0x2e')](),_0x56c50d['originalname']));}})});router[_0xb261('0x20')](_0xb261('0x11'),upload[_0xb261('0x2a')](_0xb261('0x2b')),controller[_0xb261('0x33')]);router['post'](_0xb261('0x34'),controller[_0xb261('0x35')]);router[_0xb261('0x20')](_0xb261('0x36'),controller[_0xb261('0x37')]);router[_0xb261('0x20')]('/:id/interactions',auth[_0xb261('0x7')](),controller['addInteraction']);router[_0xb261('0x20')]('/:id/applications',auth[_0xb261('0x7')](),controller[_0xb261('0x38')]);router[_0xb261('0x20')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xb261('0x39')]);router['post'](_0xb261('0x1e'),auth[_0xb261('0x7')](),controller['addAgents']);router[_0xb261('0x3a')]('/:id',auth[_0xb261('0x7')](),controller[_0xb261('0x3b')]);router['delete'](_0xb261('0x8'),auth[_0xb261('0x7')](),controller[_0xb261('0x3c')]);router[_0xb261('0x3d')](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0x3e')]);router['delete'](_0xb261('0xc'),auth['isAuthenticated'](),controller[_0xb261('0x3f')]);router['delete'](_0xb261('0x1e'),auth[_0xb261('0x7')](),controller[_0xb261('0x40')]);module[_0xb261('0x41')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cd5af1f..e3a8687 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 _0x4bc3=['saFiscalMessage','join','getDataValue','split','INTEGER','BOOLEAN','sequelize','exports','STRING','FLOAT'];(function(_0x4a3b02,_0x3f5b31){var _0x40d53c=function(_0x792cc7){while(--_0x792cc7){_0x4a3b02['push'](_0x4a3b02['shift']());}};_0x40d53c(++_0x3f5b31);}(_0x4bc3,0x16e));var _0x34bc=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x4bc3[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0x34bc('0x0'));module[_0x34bc('0x1')]={'name':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x34bc('0x2')]},'website':{'type':Sequelize[_0x34bc('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x34bc('0x2')]},'type':{'type':Sequelize[_0x34bc('0x2')]},'street':{'type':Sequelize[_0x34bc('0x2')]},'postalCode':{'type':Sequelize[_0x34bc('0x2')]},'city':{'type':Sequelize[_0x34bc('0x2')]},'country':{'type':Sequelize[_0x34bc('0x2')]},'email':{'type':Sequelize[_0x34bc('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x34bc('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x34bc('0x2')]},'description':{'type':Sequelize[_0x34bc('0x2')]},'flatDiscount':{'type':Sequelize[_0x34bc('0x3')]},'saStreet':{'type':Sequelize[_0x34bc('0x2')]},'saPostalCode':{'type':Sequelize[_0x34bc('0x2')]},'saCity':{'type':Sequelize[_0x34bc('0x2')]},'saCountry':{'type':Sequelize['STRING']},'saISOCode':{'type':Sequelize['STRING'](0x3)},'saFiscalCode':{'type':Sequelize[_0x34bc('0x2')](0x32)},'saPIVA':{'type':Sequelize[_0x34bc('0x2')](0x32)},'saSDICode':{'type':Sequelize[_0x34bc('0x2')](0x15)},'saFiscalMessage':{'type':Sequelize['STRING'],'set':function(_0x41960e){this['setDataValue'](_0x34bc('0x4'),_0x41960e?_0x41960e[_0x34bc('0x5')](','):null);},'get':function(){return this[_0x34bc('0x6')]('saFiscalMessage')?this[_0x34bc('0x6')]('saFiscalMessage')[_0x34bc('0x7')](','):[];}},'saExpiryDay':{'type':Sequelize[_0x34bc('0x8')]},'saEurope':{'type':Sequelize[_0x34bc('0x9')]},'saSocCap':{'type':Sequelize['STRING'](0xff)},'saPaymentMethod':{'type':Sequelize['INTEGER']},'defaultEntry':{'type':Sequelize[_0x34bc('0x9')],'defaultValue':![]},'vat':{'type':Sequelize['STRING'](0xff)}}; \ No newline at end of file +var _0x91a7=['setDataValue','saFiscalMessage','join','getDataValue','INTEGER','BOOLEAN','exports','STRING','FLOAT'];(function(_0x5125ba,_0x421b1f){var _0x5e9357=function(_0x22e3d5){while(--_0x22e3d5){_0x5125ba['push'](_0x5125ba['shift']());}};_0x5e9357(++_0x421b1f);}(_0x91a7,0xe7));var _0x791a=function(_0x2b157b,_0x539abc){_0x2b157b=_0x2b157b-0x0;var _0x97c977=_0x91a7[_0x2b157b];return _0x97c977;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'companyId':{'type':Sequelize[_0x791a('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x791a('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x791a('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x791a('0x1')]},'country':{'type':Sequelize[_0x791a('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x791a('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x791a('0x1')]},'sCity':{'type':Sequelize[_0x791a('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x791a('0x1')]},'flatDiscount':{'type':Sequelize[_0x791a('0x2')]},'saStreet':{'type':Sequelize[_0x791a('0x1')]},'saPostalCode':{'type':Sequelize[_0x791a('0x1')]},'saCity':{'type':Sequelize[_0x791a('0x1')]},'saCountry':{'type':Sequelize['STRING']},'saISOCode':{'type':Sequelize[_0x791a('0x1')](0x3)},'saFiscalCode':{'type':Sequelize[_0x791a('0x1')](0x32)},'saPIVA':{'type':Sequelize['STRING'](0x32)},'saSDICode':{'type':Sequelize[_0x791a('0x1')](0x15)},'saFiscalMessage':{'type':Sequelize[_0x791a('0x1')],'set':function(_0x167bc4){this[_0x791a('0x3')](_0x791a('0x4'),_0x167bc4?_0x167bc4[_0x791a('0x5')](','):null);},'get':function(){return this['getDataValue']('saFiscalMessage')?this[_0x791a('0x6')](_0x791a('0x4'))['split'](','):[];}},'saExpiryDay':{'type':Sequelize[_0x791a('0x7')]},'saEurope':{'type':Sequelize[_0x791a('0x8')]},'saSocCap':{'type':Sequelize['STRING'](0xff)},'saPaymentMethod':{'type':Sequelize[_0x791a('0x7')]},'defaultEntry':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'vat':{'type':Sequelize[_0x791a('0x1')](0xff)}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index ffd1058..9c655c4 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 _0xe190=['mustache','util','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','set','Content-Range','json','apply','reject','then','destroy','Companies','UserProfileResource','sendStatus','error','name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','key','VIRTUAL','field','options','count','findAll','rows','catch','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','update','params','addContacts','CmContact','ids','omit','getContacts','findOne','map','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x4772bd,_0x54e566){var _0x3bb9ba=function(_0x240697){while(--_0x240697){_0x4772bd['push'](_0x4772bd['shift']());}};_0x3bb9ba(++_0x54e566);}(_0xe190,0xa1));var _0x0e19=function(_0x1486bc,_0x204e1f){_0x1486bc=_0x1486bc-0x0;var _0x4009e1=_0xe190[_0x1486bc];return _0x4009e1;};'use strict';var pdf=require(_0x0e19('0x0'));var emlformat=require(_0x0e19('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0e19('0x2'));var jsonpatch=require(_0x0e19('0x3'));var rp=require('request-promise');var moment=require(_0x0e19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e19('0x5'));var util=require(_0x0e19('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0e19('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e19('0x8'));var squel=require(_0x0e19('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e19('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0e19('0xb'));var Papa=require(_0x0e19('0xc'));var Redis=require('ioredis');var authService=require(_0x0e19('0xd'));var qs=require(_0x0e19('0xe'));var hardwareService=require(_0x0e19('0xf'));var logger=require('../../config/logger')(_0x0e19('0x10'));var utils=require(_0x0e19('0x11'));var config=require(_0x0e19('0x12'));var db=require(_0x0e19('0x13'))['db'];function respondWithStatusCode(_0x976b92,_0x22bab1){_0x22bab1=_0x22bab1||0xcc;return function(_0x303b97){if(_0x303b97){return _0x976b92['sendStatus'](_0x22bab1);}return _0x976b92[_0x0e19('0x14')](_0x22bab1)[_0x0e19('0x15')]();};}function respondWithResult(_0x386e04,_0x254082){_0x254082=_0x254082||0xc8;return function(_0x493c20){if(_0x493c20){return _0x386e04[_0x0e19('0x14')](_0x254082)['json'](_0x493c20);}};}function respondWithFilteredResult(_0x5ec461,_0x419226){return function(_0x10f293){if(_0x10f293){var _0x322d03=_0x10f293['count'],_0x3c014c=_0x419226[_0x0e19('0x16')],_0xa30cbd=_0x419226[_0x0e19('0x16')]+_0x419226['limit'],_0x1beddb;if(_0xa30cbd>=_0x322d03){_0xa30cbd=_0x322d03;_0x1beddb=0xc8;}else{_0x1beddb=0xce;}_0x5ec461['status'](_0x1beddb);return _0x5ec461[_0x0e19('0x17')](_0x0e19('0x18'),_0x3c014c+'-'+_0xa30cbd+'/'+_0x322d03)[_0x0e19('0x19')](_0x10f293);}return null;};}function patchUpdates(_0xbc6c39){return function(_0x33142f){try{jsonpatch[_0x0e19('0x1a')](_0x33142f,_0xbc6c39,!![]);}catch(_0x5f24fb){return BPromise[_0x0e19('0x1b')](_0x5f24fb);}return _0x33142f['save']();};}function saveUpdates(_0x39ae13,_0x550b29){return function(_0x28fdcd){if(_0x28fdcd){return _0x28fdcd['update'](_0x39ae13)[_0x0e19('0x1c')](function(_0x2289f8){return _0x2289f8;});}return null;};}function removeEntity(_0x1b30f6,_0x41e49b){return function(_0x551b0d){if(_0x551b0d){return _0x551b0d[_0x0e19('0x1d')]()['then'](function(){var _0x5ebdee=_0x551b0d['get']({'plain':!![]});var _0x655634=_0x0e19('0x1e');return db[_0x0e19('0x1f')][_0x0e19('0x1d')]({'where':{'type':_0x655634,'resourceId':_0x5ebdee['id']}})[_0x0e19('0x1c')](function(){return _0x551b0d;});})[_0x0e19('0x1c')](function(){_0x1b30f6[_0x0e19('0x14')](0xcc)[_0x0e19('0x15')]();});}};}function handleEntityNotFound(_0x2e7ac8,_0x121a5f){return function(_0xeb68d3){if(!_0xeb68d3){_0x2e7ac8[_0x0e19('0x20')](0x194);}return _0xeb68d3;};}function handleError(_0x4f82ae,_0x1fe5fa){_0x1fe5fa=_0x1fe5fa||0x1f4;return function(_0x323a23){logger[_0x0e19('0x21')](_0x323a23['stack']);if(_0x323a23['name']){delete _0x323a23[_0x0e19('0x22')];}_0x4f82ae[_0x0e19('0x14')](_0x1fe5fa)[_0x0e19('0x23')](_0x323a23);};}exports[_0x0e19('0x24')]=function(_0x44a2c6,_0x428c49){var _0x226d5a={},_0x55f632={},_0x29737e={'count':0x0,'rows':[]};var _0x3fbc7d=db[_0x0e19('0x25')]['rawAttributes'];_0x55f632[_0x0e19('0x26')]=_[_0x0e19('0x27')](_0x3fbc7d);_0x55f632[_0x0e19('0x28')]=_['keys'](_0x44a2c6['query']);_0x55f632[_0x0e19('0x29')]=_[_0x0e19('0x2a')](_0x55f632[_0x0e19('0x26')],_0x55f632[_0x0e19('0x28')]);_0x226d5a[_0x0e19('0x2b')]=_[_0x0e19('0x2a')](_0x55f632[_0x0e19('0x26')],qs[_0x0e19('0x2c')](_0x44a2c6[_0x0e19('0x28')][_0x0e19('0x2c')]));_0x226d5a['attributes']=_0x226d5a['attributes'][_0x0e19('0x2d')]?_0x226d5a[_0x0e19('0x2b')]:_0x55f632[_0x0e19('0x26')];if(!_0x44a2c6['query']['hasOwnProperty'](_0x0e19('0x2e'))){_0x226d5a[_0x0e19('0x2f')]=qs[_0x0e19('0x2f')](_0x44a2c6[_0x0e19('0x28')]['limit']);_0x226d5a[_0x0e19('0x16')]=qs[_0x0e19('0x16')](_0x44a2c6[_0x0e19('0x28')][_0x0e19('0x16')]);}_0x226d5a[_0x0e19('0x30')]=qs['sort'](_0x44a2c6[_0x0e19('0x28')][_0x0e19('0x31')]);_0x226d5a['where']=qs[_0x0e19('0x29')](_[_0x0e19('0x32')](_0x44a2c6['query'],_0x55f632[_0x0e19('0x29')]));if(_0x44a2c6['query'][_0x0e19('0x33')]){_0x226d5a[_0x0e19('0x34')]=_[_0x0e19('0x35')](_0x226d5a[_0x0e19('0x34')],{'$or':_['map'](_0x3fbc7d,function(_0x2d519c){if(_0x2d519c[_0x0e19('0x36')][_0x0e19('0x37')]!==_0x0e19('0x38')){var _0x422355={};_0x422355[_0x2d519c[_0x0e19('0x39')]]={'$like':'%'+_0x44a2c6['query'][_0x0e19('0x33')]+'%'};return _0x422355;}})});}_0x226d5a=_[_0x0e19('0x35')]({},_0x226d5a,_0x44a2c6[_0x0e19('0x3a')]);var _0xa1a10f={'where':_0x226d5a['where']};return db[_0x0e19('0x25')][_0x0e19('0x3b')](_0xa1a10f)['then'](function(_0x5ad9e0){_0x29737e[_0x0e19('0x3b')]=_0x5ad9e0;if(_0x44a2c6[_0x0e19('0x28')]['includeAll']){_0x226d5a['include']=[{'all':!![]}];}return db[_0x0e19('0x25')][_0x0e19('0x3c')](_0x226d5a);})[_0x0e19('0x1c')](function(_0x317b88){_0x29737e[_0x0e19('0x3d')]=_0x317b88;return _0x29737e;})['then'](respondWithFilteredResult(_0x428c49,_0x226d5a))[_0x0e19('0x3e')](handleError(_0x428c49,null));};exports['show']=function(_0x334d6e,_0x3ac878){var _0x5a151d={'raw':![],'where':{'id':_0x334d6e['params']['id']}},_0x54c5be={};_0x54c5be[_0x0e19('0x26')]=_['keys'](db['CmCompany'][_0x0e19('0x3f')]);_0x54c5be[_0x0e19('0x28')]=_['keys'](_0x334d6e[_0x0e19('0x28')]);_0x54c5be['filters']=_['intersection'](_0x54c5be[_0x0e19('0x26')],_0x54c5be[_0x0e19('0x28')]);_0x5a151d[_0x0e19('0x2b')]=_[_0x0e19('0x2a')](_0x54c5be[_0x0e19('0x26')],qs[_0x0e19('0x2c')](_0x334d6e['query']['fields']));_0x5a151d['attributes']=_0x5a151d[_0x0e19('0x2b')][_0x0e19('0x2d')]?_0x5a151d['attributes']:_0x54c5be[_0x0e19('0x26')];if(_0x334d6e[_0x0e19('0x28')]['includeAll']){_0x5a151d[_0x0e19('0x40')]=[{'all':!![]}];}_0x5a151d=_[_0x0e19('0x35')]({},_0x5a151d,_0x334d6e[_0x0e19('0x3a')]);return db[_0x0e19('0x25')][_0x0e19('0x41')](_0x5a151d)[_0x0e19('0x1c')](handleEntityNotFound(_0x3ac878,null))['then'](respondWithResult(_0x3ac878,null))[_0x0e19('0x3e')](handleError(_0x3ac878,null));};exports[_0x0e19('0x42')]=function(_0x2b3c9d,_0x570586){return db[_0x0e19('0x25')][_0x0e19('0x42')](_0x2b3c9d[_0x0e19('0x43')],{})['then'](function(_0x35ee29){var _0x1096a5=_0x2b3c9d[_0x0e19('0x44')]['get']({'plain':!![]});if(!_0x1096a5)throw new Error(_0x0e19('0x45'));if(_0x1096a5['role']==='user'){var _0xbf702d=_0x35ee29[_0x0e19('0x46')]({'plain':!![]});var _0x40dad8=_0x0e19('0x1e');return db[_0x0e19('0x47')][_0x0e19('0x41')]({'where':{'name':_0x40dad8,'userProfileId':_0x1096a5['userProfileId']},'raw':!![]})['then'](function(_0x5be414){if(_0x5be414&&_0x5be414[_0x0e19('0x48')]===0x0){return db[_0x0e19('0x1f')][_0x0e19('0x42')]({'name':_0xbf702d[_0x0e19('0x22')],'resourceId':_0xbf702d['id'],'type':_0x5be414[_0x0e19('0x22')],'sectionId':_0x5be414['id']},{})[_0x0e19('0x1c')](function(){return _0x35ee29;});}else{return _0x35ee29;}})['catch'](function(_0x511040){logger[_0x0e19('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x511040);throw _0x511040;});}return _0x35ee29;})[_0x0e19('0x1c')](respondWithResult(_0x570586,0xc9))['catch'](handleError(_0x570586,null));};exports[_0x0e19('0x49')]=function(_0x32c52d,_0x2684f9){if(_0x32c52d['body']['id']){delete _0x32c52d[_0x0e19('0x43')]['id'];}return db[_0x0e19('0x25')][_0x0e19('0x41')]({'where':{'id':_0x32c52d[_0x0e19('0x4a')]['id']}})[_0x0e19('0x1c')](handleEntityNotFound(_0x2684f9,null))[_0x0e19('0x1c')](saveUpdates(_0x32c52d[_0x0e19('0x43')],null))[_0x0e19('0x1c')](respondWithResult(_0x2684f9,null))[_0x0e19('0x3e')](handleError(_0x2684f9,null));};exports[_0x0e19('0x1d')]=function(_0x4c07db,_0xe0d392){return db[_0x0e19('0x25')]['find']({'where':{'id':_0x4c07db[_0x0e19('0x4a')]['id']}})[_0x0e19('0x1c')](handleEntityNotFound(_0xe0d392,null))[_0x0e19('0x1c')](removeEntity(_0xe0d392,null))[_0x0e19('0x3e')](handleError(_0xe0d392,null));};exports[_0x0e19('0x4b')]=function(_0xacdd83,_0x78d6,_0x1a2102){return db[_0x0e19('0x4c')]['find']({'where':{'id':_0xacdd83[_0x0e19('0x4a')]['id']}})[_0x0e19('0x1c')](handleEntityNotFound(_0x78d6,null))[_0x0e19('0x1c')](function(_0x31ac47){if(_0x31ac47){return _0x31ac47[_0x0e19('0x4b')](_0xacdd83['body'][_0x0e19('0x4d')],_[_0x0e19('0x4e')](_0xacdd83[_0x0e19('0x43')],[_0x0e19('0x4d'),'id'])||{});}})[_0x0e19('0x1c')](respondWithResult(_0x78d6,null))[_0x0e19('0x3e')](handleError(_0x78d6,null));};exports[_0x0e19('0x4f')]=function(_0x29326c,_0x480168,_0x51372f){var _0x35434d={};var _0x340279={};var _0x4337cb;var _0x3957b8;return db[_0x0e19('0x25')][_0x0e19('0x50')]({'where':{'id':_0x29326c[_0x0e19('0x4a')]['id']}})['then'](handleEntityNotFound(_0x480168,null))[_0x0e19('0x1c')](function(_0x2f6ee8){if(_0x2f6ee8){_0x4337cb=_0x2f6ee8;_0x340279['model']=_[_0x0e19('0x27')](db[_0x0e19('0x4c')][_0x0e19('0x3f')]);_0x340279[_0x0e19('0x28')]=_[_0x0e19('0x27')](_0x29326c[_0x0e19('0x28')]);_0x340279['filters']=_[_0x0e19('0x2a')](_0x340279[_0x0e19('0x26')],_0x340279['query']);_0x35434d[_0x0e19('0x2b')]=_['intersection'](_0x340279[_0x0e19('0x26')],qs[_0x0e19('0x2c')](_0x29326c['query'][_0x0e19('0x2c')]));_0x35434d['attributes']=_0x35434d[_0x0e19('0x2b')][_0x0e19('0x2d')]?_0x35434d['attributes']:_0x340279['model'];_0x35434d[_0x0e19('0x30')]=qs['sort'](_0x29326c['query'][_0x0e19('0x31')]);_0x35434d[_0x0e19('0x34')]=qs[_0x0e19('0x29')](_[_0x0e19('0x32')](_0x29326c[_0x0e19('0x28')],_0x340279[_0x0e19('0x29')]));if(_0x29326c[_0x0e19('0x28')][_0x0e19('0x33')]){_0x35434d[_0x0e19('0x34')]=_[_0x0e19('0x35')](_0x35434d[_0x0e19('0x34')],{'$or':_[_0x0e19('0x51')](_0x35434d[_0x0e19('0x2b')],function(_0x5e353d){var _0x884242={};_0x884242[_0x5e353d]={'$like':'%'+_0x29326c[_0x0e19('0x28')][_0x0e19('0x33')]+'%'};return _0x884242;})});}_0x35434d=_['merge']({},_0x35434d,_0x29326c[_0x0e19('0x3a')]);return _0x4337cb[_0x0e19('0x4f')](_0x35434d);}})[_0x0e19('0x1c')](function(_0x567465){if(_0x567465){_0x3957b8=_0x567465['length'];if(!_0x29326c[_0x0e19('0x28')][_0x0e19('0x52')](_0x0e19('0x2e'))){_0x35434d[_0x0e19('0x2f')]=qs['limit'](_0x29326c[_0x0e19('0x28')]['limit']);_0x35434d[_0x0e19('0x16')]=qs[_0x0e19('0x16')](_0x29326c[_0x0e19('0x28')][_0x0e19('0x16')]);}return _0x4337cb[_0x0e19('0x4f')](_0x35434d);}})[_0x0e19('0x1c')](function(_0x36b42d){if(_0x36b42d){return _0x36b42d?{'count':_0x3957b8,'rows':_0x36b42d}:null;}})['then'](respondWithResult(_0x480168,null))['catch'](handleError(_0x480168,null));}; \ No newline at end of file +var _0xd92f=['filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','autoAssociation','addContacts','CmContact','ids','omit','getContacts','findOne','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','CmCompany','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0xd92f,0xd6));var _0xfd92=function(_0x5bab05,_0x3259a2){_0x5bab05=_0x5bab05-0x0;var _0x4d404a=_0xd92f[_0x5bab05];return _0x4d404a;};'use strict';var pdf=require(_0xfd92('0x0'));var emlformat=require(_0xfd92('0x1'));var rimraf=require(_0xfd92('0x2'));var zipdir=require(_0xfd92('0x3'));var jsonpatch=require(_0xfd92('0x4'));var rp=require(_0xfd92('0x5'));var moment=require(_0xfd92('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfd92('0x7'));var util=require(_0xfd92('0x8'));var path=require(_0xfd92('0x9'));var sox=require(_0xfd92('0xa'));var csv=require(_0xfd92('0xb'));var ejs=require(_0xfd92('0xc'));var fs=require('fs');var _=require(_0xfd92('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfd92('0xe'));var deskjs=require(_0xfd92('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfd92('0x10'));var Papa=require('papaparse');var Redis=require(_0xfd92('0x11'));var authService=require(_0xfd92('0x12'));var qs=require(_0xfd92('0x13'));var hardwareService=require(_0xfd92('0x14'));var logger=require('../../config/logger')(_0xfd92('0x15'));var utils=require(_0xfd92('0x16'));var config=require(_0xfd92('0x17'));var db=require(_0xfd92('0x18'))['db'];function respondWithStatusCode(_0x8b69cd,_0x32f199){_0x32f199=_0x32f199||0xcc;return function(_0x4a18a2){if(_0x4a18a2){return _0x8b69cd['sendStatus'](_0x32f199);}return _0x8b69cd[_0xfd92('0x19')](_0x32f199)[_0xfd92('0x1a')]();};}function respondWithResult(_0x4f3154,_0x27f33d){_0x27f33d=_0x27f33d||0xc8;return function(_0x417d94){if(_0x417d94){return _0x4f3154[_0xfd92('0x19')](_0x27f33d)[_0xfd92('0x1b')](_0x417d94);}};}function respondWithFilteredResult(_0x4567f6,_0x552291){return function(_0x5d6e84){if(_0x5d6e84){var _0x31f385=_0x5d6e84['count'],_0x2f6258=_0x552291[_0xfd92('0x1c')],_0x4fadc3=_0x552291[_0xfd92('0x1c')]+_0x552291['limit'],_0x134898;if(_0x4fadc3>=_0x31f385){_0x4fadc3=_0x31f385;_0x134898=0xc8;}else{_0x134898=0xce;}_0x4567f6[_0xfd92('0x19')](_0x134898);return _0x4567f6[_0xfd92('0x1d')](_0xfd92('0x1e'),_0x2f6258+'-'+_0x4fadc3+'/'+_0x31f385)[_0xfd92('0x1b')](_0x5d6e84);}return null;};}function patchUpdates(_0x4a55f8){return function(_0x3b0a13){try{jsonpatch[_0xfd92('0x1f')](_0x3b0a13,_0x4a55f8,!![]);}catch(_0x33bf92){return BPromise['reject'](_0x33bf92);}return _0x3b0a13[_0xfd92('0x20')]();};}function saveUpdates(_0xf2266c,_0x3acdd1){return function(_0x9a3e93){if(_0x9a3e93){return _0x9a3e93[_0xfd92('0x21')](_0xf2266c)[_0xfd92('0x22')](function(_0x21872f){return _0x21872f;});}return null;};}function removeEntity(_0x57339f,_0x4a05e1){return function(_0x324533){if(_0x324533){return _0x324533['destroy']()[_0xfd92('0x22')](function(){var _0x30503d=_0x324533[_0xfd92('0x23')]({'plain':!![]});var _0x4aa238='Companies';return db[_0xfd92('0x24')][_0xfd92('0x25')]({'where':{'type':_0x4aa238,'resourceId':_0x30503d['id']}})[_0xfd92('0x22')](function(){return _0x324533;});})[_0xfd92('0x22')](function(){_0x57339f[_0xfd92('0x19')](0xcc)[_0xfd92('0x1a')]();});}};}function handleEntityNotFound(_0x4fe71b,_0x5829a5){return function(_0x33ff6b){if(!_0x33ff6b){_0x4fe71b[_0xfd92('0x26')](0x194);}return _0x33ff6b;};}function handleError(_0x141307,_0x5492f2){_0x5492f2=_0x5492f2||0x1f4;return function(_0x211b53){logger[_0xfd92('0x27')](_0x211b53[_0xfd92('0x28')]);if(_0x211b53[_0xfd92('0x29')]){delete _0x211b53[_0xfd92('0x29')];}_0x141307[_0xfd92('0x19')](_0x5492f2)[_0xfd92('0x2a')](_0x211b53);};}exports['index']=function(_0x1d3bde,_0x5e3ad9){var _0x26aa6e={},_0x5ca01a={},_0x523408={'count':0x0,'rows':[]};var _0x2997ed=db[_0xfd92('0x2b')][_0xfd92('0x2c')];_0x5ca01a[_0xfd92('0x2d')]=_['keys'](_0x2997ed);_0x5ca01a[_0xfd92('0x2e')]=_[_0xfd92('0x2f')](_0x1d3bde[_0xfd92('0x2e')]);_0x5ca01a[_0xfd92('0x30')]=_[_0xfd92('0x31')](_0x5ca01a[_0xfd92('0x2d')],_0x5ca01a[_0xfd92('0x2e')]);_0x26aa6e[_0xfd92('0x32')]=_[_0xfd92('0x31')](_0x5ca01a[_0xfd92('0x2d')],qs['fields'](_0x1d3bde['query'][_0xfd92('0x33')]));_0x26aa6e[_0xfd92('0x32')]=_0x26aa6e[_0xfd92('0x32')][_0xfd92('0x34')]?_0x26aa6e[_0xfd92('0x32')]:_0x5ca01a[_0xfd92('0x2d')];if(!_0x1d3bde[_0xfd92('0x2e')][_0xfd92('0x35')](_0xfd92('0x36'))){_0x26aa6e['limit']=qs[_0xfd92('0x37')](_0x1d3bde[_0xfd92('0x2e')]['limit']);_0x26aa6e[_0xfd92('0x1c')]=qs[_0xfd92('0x1c')](_0x1d3bde[_0xfd92('0x2e')]['offset']);}_0x26aa6e[_0xfd92('0x38')]=qs[_0xfd92('0x39')](_0x1d3bde['query'][_0xfd92('0x39')]);_0x26aa6e[_0xfd92('0x3a')]=qs[_0xfd92('0x30')](_['pick'](_0x1d3bde[_0xfd92('0x2e')],_0x5ca01a[_0xfd92('0x30')]));if(_0x1d3bde['query'][_0xfd92('0x3b')]){_0x26aa6e[_0xfd92('0x3a')]=_[_0xfd92('0x3c')](_0x26aa6e[_0xfd92('0x3a')],{'$or':_[_0xfd92('0x3d')](_0x2997ed,function(_0xf6a308){if(_0xf6a308[_0xfd92('0x3e')][_0xfd92('0x3f')]!==_0xfd92('0x40')){var _0x11d411={};_0x11d411[_0xf6a308[_0xfd92('0x41')]]={'$like':'%'+_0x1d3bde[_0xfd92('0x2e')][_0xfd92('0x3b')]+'%'};return _0x11d411;}})});}_0x26aa6e=_[_0xfd92('0x3c')]({},_0x26aa6e,_0x1d3bde[_0xfd92('0x42')]);var _0x82d787={'where':_0x26aa6e['where']};return db['CmCompany'][_0xfd92('0x43')](_0x82d787)['then'](function(_0x2fab5b){_0x523408[_0xfd92('0x43')]=_0x2fab5b;if(_0x1d3bde[_0xfd92('0x2e')][_0xfd92('0x44')]){_0x26aa6e[_0xfd92('0x45')]=[{'all':!![]}];}return db['CmCompany'][_0xfd92('0x46')](_0x26aa6e);})[_0xfd92('0x22')](function(_0x391da5){_0x523408[_0xfd92('0x47')]=_0x391da5;return _0x523408;})[_0xfd92('0x22')](respondWithFilteredResult(_0x5e3ad9,_0x26aa6e))[_0xfd92('0x48')](handleError(_0x5e3ad9,null));};exports[_0xfd92('0x49')]=function(_0x2caf2c,_0x455394){var _0x1be34a={'raw':![],'where':{'id':_0x2caf2c[_0xfd92('0x4a')]['id']}},_0x511bf8={};_0x511bf8['model']=_[_0xfd92('0x2f')](db[_0xfd92('0x2b')][_0xfd92('0x2c')]);_0x511bf8[_0xfd92('0x2e')]=_[_0xfd92('0x2f')](_0x2caf2c[_0xfd92('0x2e')]);_0x511bf8[_0xfd92('0x30')]=_[_0xfd92('0x31')](_0x511bf8['model'],_0x511bf8[_0xfd92('0x2e')]);_0x1be34a[_0xfd92('0x32')]=_[_0xfd92('0x31')](_0x511bf8[_0xfd92('0x2d')],qs[_0xfd92('0x33')](_0x2caf2c[_0xfd92('0x2e')][_0xfd92('0x33')]));_0x1be34a[_0xfd92('0x32')]=_0x1be34a[_0xfd92('0x32')][_0xfd92('0x34')]?_0x1be34a[_0xfd92('0x32')]:_0x511bf8[_0xfd92('0x2d')];if(_0x2caf2c[_0xfd92('0x2e')][_0xfd92('0x44')]){_0x1be34a['include']=[{'all':!![]}];}_0x1be34a=_[_0xfd92('0x3c')]({},_0x1be34a,_0x2caf2c[_0xfd92('0x42')]);return db[_0xfd92('0x2b')][_0xfd92('0x4b')](_0x1be34a)[_0xfd92('0x22')](handleEntityNotFound(_0x455394,null))['then'](respondWithResult(_0x455394,null))[_0xfd92('0x48')](handleError(_0x455394,null));};exports[_0xfd92('0x4c')]=function(_0x1c4a23,_0x153ef0){return db[_0xfd92('0x2b')][_0xfd92('0x4c')](_0x1c4a23[_0xfd92('0x4d')],{})['then'](function(_0x49c181){var _0x4952=_0x1c4a23[_0xfd92('0x4e')][_0xfd92('0x23')]({'plain':!![]});if(!_0x4952)throw new Error(_0xfd92('0x4f'));if(_0x4952[_0xfd92('0x50')]===_0xfd92('0x4e')){var _0x3573c6=_0x49c181['get']({'plain':!![]});var _0x5cac4a=_0xfd92('0x51');return db['UserProfileSection'][_0xfd92('0x4b')]({'where':{'name':_0x5cac4a,'userProfileId':_0x4952[_0xfd92('0x52')]},'raw':!![]})[_0xfd92('0x22')](function(_0x579fdb){if(_0x579fdb&&_0x579fdb[_0xfd92('0x53')]===0x0){return db[_0xfd92('0x24')]['create']({'name':_0x3573c6['name'],'resourceId':_0x3573c6['id'],'type':_0x579fdb[_0xfd92('0x29')],'sectionId':_0x579fdb['id']},{})[_0xfd92('0x22')](function(){return _0x49c181;});}else{return _0x49c181;}})[_0xfd92('0x48')](function(_0x5000c8){logger[_0xfd92('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5000c8);throw _0x5000c8;});}return _0x49c181;})[_0xfd92('0x22')](respondWithResult(_0x153ef0,0xc9))['catch'](handleError(_0x153ef0,null));};exports[_0xfd92('0x21')]=function(_0x2ca6b1,_0x26efb7){if(_0x2ca6b1[_0xfd92('0x4d')]['id']){delete _0x2ca6b1['body']['id'];}return db[_0xfd92('0x2b')][_0xfd92('0x4b')]({'where':{'id':_0x2ca6b1[_0xfd92('0x4a')]['id']}})[_0xfd92('0x22')](handleEntityNotFound(_0x26efb7,null))['then'](saveUpdates(_0x2ca6b1['body'],null))[_0xfd92('0x22')](respondWithResult(_0x26efb7,null))[_0xfd92('0x48')](handleError(_0x26efb7,null));};exports[_0xfd92('0x25')]=function(_0x7be37c,_0x5bc5f6){return db[_0xfd92('0x2b')][_0xfd92('0x4b')]({'where':{'id':_0x7be37c['params']['id']}})[_0xfd92('0x22')](handleEntityNotFound(_0x5bc5f6,null))['then'](removeEntity(_0x5bc5f6,null))['catch'](handleError(_0x5bc5f6,null));};exports[_0xfd92('0x54')]=function(_0x49b7b3,_0x52caf7,_0x3b40d1){return db[_0xfd92('0x55')]['find']({'where':{'id':_0x49b7b3[_0xfd92('0x4a')]['id']}})[_0xfd92('0x22')](handleEntityNotFound(_0x52caf7,null))[_0xfd92('0x22')](function(_0x3db9e0){if(_0x3db9e0){return _0x3db9e0['addContacts'](_0x49b7b3[_0xfd92('0x4d')][_0xfd92('0x56')],_[_0xfd92('0x57')](_0x49b7b3[_0xfd92('0x4d')],[_0xfd92('0x56'),'id'])||{});}})[_0xfd92('0x22')](respondWithResult(_0x52caf7,null))[_0xfd92('0x48')](handleError(_0x52caf7,null));};exports[_0xfd92('0x58')]=function(_0x226b0b,_0x4576d0,_0x34ede6){var _0x5ac6c4={};var _0x122cba={};var _0x5d48cb;var _0x527e7f;return db[_0xfd92('0x2b')][_0xfd92('0x59')]({'where':{'id':_0x226b0b['params']['id']}})[_0xfd92('0x22')](handleEntityNotFound(_0x4576d0,null))[_0xfd92('0x22')](function(_0x4d888c){if(_0x4d888c){_0x5d48cb=_0x4d888c;_0x122cba[_0xfd92('0x2d')]=_[_0xfd92('0x2f')](db[_0xfd92('0x55')][_0xfd92('0x2c')]);_0x122cba[_0xfd92('0x2e')]=_['keys'](_0x226b0b[_0xfd92('0x2e')]);_0x122cba[_0xfd92('0x30')]=_['intersection'](_0x122cba[_0xfd92('0x2d')],_0x122cba['query']);_0x5ac6c4['attributes']=_[_0xfd92('0x31')](_0x122cba[_0xfd92('0x2d')],qs[_0xfd92('0x33')](_0x226b0b['query'][_0xfd92('0x33')]));_0x5ac6c4[_0xfd92('0x32')]=_0x5ac6c4[_0xfd92('0x32')][_0xfd92('0x34')]?_0x5ac6c4[_0xfd92('0x32')]:_0x122cba[_0xfd92('0x2d')];_0x5ac6c4[_0xfd92('0x38')]=qs['sort'](_0x226b0b['query'][_0xfd92('0x39')]);_0x5ac6c4['where']=qs['filters'](_[_0xfd92('0x5a')](_0x226b0b[_0xfd92('0x2e')],_0x122cba[_0xfd92('0x30')]));if(_0x226b0b[_0xfd92('0x2e')]['filter']){_0x5ac6c4[_0xfd92('0x3a')]=_['merge'](_0x5ac6c4[_0xfd92('0x3a')],{'$or':_[_0xfd92('0x3d')](_0x5ac6c4[_0xfd92('0x32')],function(_0x2d6e49){var _0x8528ff={};_0x8528ff[_0x2d6e49]={'$like':'%'+_0x226b0b['query']['filter']+'%'};return _0x8528ff;})});}_0x5ac6c4=_['merge']({},_0x5ac6c4,_0x226b0b[_0xfd92('0x42')]);return _0x5d48cb[_0xfd92('0x58')](_0x5ac6c4);}})[_0xfd92('0x22')](function(_0x2bd42e){if(_0x2bd42e){_0x527e7f=_0x2bd42e['length'];if(!_0x226b0b[_0xfd92('0x2e')][_0xfd92('0x35')](_0xfd92('0x36'))){_0x5ac6c4[_0xfd92('0x37')]=qs[_0xfd92('0x37')](_0x226b0b['query'][_0xfd92('0x37')]);_0x5ac6c4[_0xfd92('0x1c')]=qs[_0xfd92('0x1c')](_0x226b0b[_0xfd92('0x2e')][_0xfd92('0x1c')]);}return _0x5d48cb[_0xfd92('0x58')](_0x5ac6c4);}})[_0xfd92('0x22')](function(_0x297249){if(_0x297249){return _0x297249?{'count':_0x527e7f,'rows':_0x297249}:null;}})['then'](respondWithResult(_0x4576d0,null))[_0xfd92('0x48')](handleError(_0x4576d0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 16ca5ce..9dbee3e 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 _0x47c5=['rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5321b8,_0x325ce4){var _0x4efd0d=function(_0xe97c53){while(--_0xe97c53){_0x5321b8['push'](_0x5321b8['shift']());}};_0x4efd0d(++_0x325ce4);}(_0x47c5,0x165));var _0x547c=function(_0x45e7e7,_0x10e163){_0x45e7e7=_0x45e7e7-0x0;var _0x5ed7e6=_0x47c5[_0x45e7e7];return _0x5ed7e6;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));module[_0x547c('0x9')]=function(_0x51ab7f,_0x2e5b57){return _0x51ab7f[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2274d4,_0x2f98b6){_0x2274d4=_0x2274d4-0x0;var _0x553dfb=_0xd7d1[_0x2274d4];return _0x553dfb;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 5112b9a..dde2859 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 _0xb157=['client','http','request','then','debug','request\x20sent','stringify','error','CmCompany,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x27f36c,_0x48de51){var _0x3cdebe=function(_0x218f5a){while(--_0x218f5a){_0x27f36c['push'](_0x27f36c['shift']());}};_0x3cdebe(++_0x48de51);}(_0xb157,0x147));var _0x7b15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb157[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7b15('0x0'));var moment=require(_0x7b15('0x1'));var BPromise=require(_0x7b15('0x2'));var rs=require(_0x7b15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b15('0x4'))['db'];var utils=require(_0x7b15('0x5'));var logger=require(_0x7b15('0x6'))(_0x7b15('0x7'));var config=require(_0x7b15('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7b15('0x9')][_0x7b15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19b31a,_0x3d4ab3,_0x52285c){return new BPromise(function(_0x395ed8,_0x3217b8){return client[_0x7b15('0xb')](_0x19b31a,_0x52285c)[_0x7b15('0xc')](function(_0x2617cf){logger['info']('CmCompany,\x20%s,\x20%s',_0x3d4ab3,'request\x20sent');logger[_0x7b15('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3d4ab3,_0x7b15('0xe'),JSON[_0x7b15('0xf')](_0x2617cf));if(_0x2617cf[_0x7b15('0x10')]){if(_0x2617cf[_0x7b15('0x10')]['code']===0x1f4){logger[_0x7b15('0x10')](_0x7b15('0x11'),_0x3d4ab3,_0x2617cf[_0x7b15('0x10')][_0x7b15('0x12')]);return _0x3217b8(_0x2617cf[_0x7b15('0x10')]['message']);}logger[_0x7b15('0x10')]('CmCompany,\x20%s,\x20%s',_0x3d4ab3,_0x2617cf[_0x7b15('0x10')][_0x7b15('0x12')]);return _0x395ed8(_0x2617cf['error'][_0x7b15('0x12')]);}else{logger[_0x7b15('0x13')](_0x7b15('0x11'),_0x3d4ab3,'request\x20sent');_0x395ed8(_0x2617cf['result'][_0x7b15('0x12')]);}})[_0x7b15('0x14')](function(_0x35a648){logger[_0x7b15('0x10')](_0x7b15('0x11'),_0x3d4ab3,_0x35a648);_0x3217b8(_0x35a648);});});} \ No newline at end of file +var _0x1c1b=['catch','util','moment','randomstring','ioredis','rpc','client','http','request','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x1042ad,_0x1e1abc){var _0x4aa96a=function(_0x135b11){while(--_0x135b11){_0x1042ad['push'](_0x1042ad['shift']());}};_0x4aa96a(++_0x1e1abc);}(_0x1c1b,0x1dd));var _0xb1c1=function(_0x5c01d7,_0x5a16a4){_0x5c01d7=_0x5c01d7-0x0;var _0x4dd896=_0x1c1b[_0x5c01d7];return _0x4dd896;};'use strict';var _=require('lodash');var util=require(_0xb1c1('0x0'));var moment=require(_0xb1c1('0x1'));var BPromise=require('bluebird');var rs=require(_0xb1c1('0x2'));var fs=require('fs');var Redis=require(_0xb1c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1c1('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1c1('0x5')][_0xb1c1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd5363,_0x468f44,_0x554cef){return new BPromise(function(_0x14d7a7,_0x128917){return client[_0xb1c1('0x7')](_0xd5363,_0x554cef)['then'](function(_0xfed7d4){logger['info'](_0xb1c1('0x8'),_0x468f44,'request\x20sent');logger['debug'](_0xb1c1('0x9'),_0x468f44,_0xb1c1('0xa'),JSON[_0xb1c1('0xb')](_0xfed7d4));if(_0xfed7d4[_0xb1c1('0xc')]){if(_0xfed7d4[_0xb1c1('0xc')]['code']===0x1f4){logger[_0xb1c1('0xc')]('CmCompany,\x20%s,\x20%s',_0x468f44,_0xfed7d4['error'][_0xb1c1('0xd')]);return _0x128917(_0xfed7d4[_0xb1c1('0xc')][_0xb1c1('0xd')]);}logger[_0xb1c1('0xc')](_0xb1c1('0x8'),_0x468f44,_0xfed7d4[_0xb1c1('0xc')]['message']);return _0x14d7a7(_0xfed7d4['error'][_0xb1c1('0xd')]);}else{logger[_0xb1c1('0xe')](_0xb1c1('0x8'),_0x468f44,_0xb1c1('0xa'));_0x14d7a7(_0xfed7d4[_0xb1c1('0xf')][_0xb1c1('0xd')]);}})[_0xb1c1('0x10')](function(_0x364819){logger['error'](_0xb1c1('0x8'),_0x468f44,_0x364819);_0x128917(_0x364819);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f6f197b..0440483 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 _0x2133=['update','delete','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2133,0x1d1));var _0x3213=function(_0x247240,_0x1fd90f){_0x247240=_0x247240-0x0;var _0xdb6c93=_0x2133[_0x247240];return _0xdb6c93;};'use strict';var multer=require('multer');var util=require(_0x3213('0x0'));var path=require(_0x3213('0x1'));var timeout=require(_0x3213('0x2'));var express=require(_0x3213('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3213('0x4'));var config=require(_0x3213('0x5'));var controller=require(_0x3213('0x6'));router[_0x3213('0x7')]('/',auth[_0x3213('0x8')](),controller[_0x3213('0x9')]);router['get'](_0x3213('0xa'),auth[_0x3213('0x8')](),controller[_0x3213('0xb')]);router[_0x3213('0x7')](_0x3213('0xc'),auth[_0x3213('0x8')](),controller[_0x3213('0xd')]);router[_0x3213('0xe')]('/',auth[_0x3213('0x8')](),controller[_0x3213('0xf')]);router[_0x3213('0xe')](_0x3213('0xc'),auth[_0x3213('0x8')](),controller[_0x3213('0x10')]);router[_0x3213('0x11')](_0x3213('0xa'),auth[_0x3213('0x8')](),controller[_0x3213('0x12')]);router[_0x3213('0x13')](_0x3213('0xa'),auth[_0x3213('0x8')](),controller['destroy']);module[_0x3213('0x14')]=router; \ No newline at end of file +var _0x3e31=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','addContacts','update','delete','destroy','exports'];(function(_0x31345c,_0x528033){var _0x1c6dc9=function(_0x35e840){while(--_0x35e840){_0x31345c['push'](_0x31345c['shift']());}};_0x1c6dc9(++_0x528033);}(_0x3e31,0x156));var _0x13e3=function(_0xc7da5f,_0x5915d6){_0xc7da5f=_0xc7da5f-0x0;var _0x35efaf=_0x3e31[_0xc7da5f];return _0x35efaf;};'use strict';var multer=require(_0x13e3('0x0'));var util=require(_0x13e3('0x1'));var path=require(_0x13e3('0x2'));var timeout=require(_0x13e3('0x3'));var express=require('express');var router=express[_0x13e3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x13e3('0x5'));var config=require(_0x13e3('0x6'));var controller=require('./cmCompany.controller');router[_0x13e3('0x7')]('/',auth[_0x13e3('0x8')](),controller['index']);router[_0x13e3('0x7')](_0x13e3('0x9'),auth[_0x13e3('0x8')](),controller[_0x13e3('0xa')]);router[_0x13e3('0x7')]('/:id/contacts',auth[_0x13e3('0x8')](),controller['getContacts']);router[_0x13e3('0xb')]('/',auth[_0x13e3('0x8')](),controller[_0x13e3('0xc')]);router[_0x13e3('0xb')]('/:id/contacts',auth[_0x13e3('0x8')](),controller[_0x13e3('0xd')]);router['put'](_0x13e3('0x9'),auth[_0x13e3('0x8')](),controller[_0x13e3('0xe')]);router[_0x13e3('0xf')]('/:id',auth[_0x13e3('0x8')](),controller[_0x13e3('0x10')]);module[_0x13e3('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 65c7253..ca55e1b 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 _0x497f=['UNSIGNED','DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x497f,0xc3));var _0xf497=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x497f[_0x3f00ee];return _0x18a07e;};'use strict';var _=require('lodash');var Sequelize=require(_0xf497('0x0'));module[_0xf497('0x1')]={'firstName':{'type':Sequelize[_0xf497('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf497('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf497('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf497('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf497('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xf497('0x2')]},'fb_data':{'type':Sequelize[_0xf497('0x2')]},'twitter':{'type':Sequelize[_0xf497('0x2')]},'skype':{'type':Sequelize[_0xf497('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf497('0x2')]},'line':{'type':Sequelize[_0xf497('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xf497('0x2')]},'UserId':{'type':Sequelize[_0xf497('0x4')]},'priority':{'type':Sequelize[_0xf497('0x4')](0x2)[_0xf497('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf497('0x6')],'defaultValue':Sequelize[_0xf497('0x7')]}}; \ No newline at end of file +var _0x7e07=['TEXT','INTEGER','DATE','NOW','lodash','sequelize','exports','STRING'];(function(_0x2d16ff,_0x4edbc2){var _0x319eed=function(_0x24defe){while(--_0x24defe){_0x2d16ff['push'](_0x2d16ff['shift']());}};_0x319eed(++_0x4edbc2);}(_0x7e07,0xa4));var _0x77e0=function(_0xf456b1,_0x49d83a){_0xf456b1=_0xf456b1-0x0;var _0x1ae7f=_0x7e07[_0xf456b1];return _0x1ae7f;};'use strict';var _=require(_0x77e0('0x0'));var Sequelize=require(_0x77e0('0x1'));module[_0x77e0('0x2')]={'firstName':{'type':Sequelize[_0x77e0('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x77e0('0x3')]},'street':{'type':Sequelize[_0x77e0('0x3')]},'postalCode':{'type':Sequelize[_0x77e0('0x3')]},'city':{'type':Sequelize[_0x77e0('0x3')]},'country':{'type':Sequelize[_0x77e0('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x77e0('0x4')]},'phone':{'type':Sequelize[_0x77e0('0x3')]},'mobile':{'type':Sequelize[_0x77e0('0x3')]},'fax':{'type':Sequelize[_0x77e0('0x3')]},'email':{'type':Sequelize[_0x77e0('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x77e0('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x77e0('0x3')]},'skype':{'type':Sequelize[_0x77e0('0x3')]},'teams':{'type':Sequelize[_0x77e0('0x3')]},'viber':{'type':Sequelize[_0x77e0('0x3')]},'line':{'type':Sequelize[_0x77e0('0x3')]},'wechat':{'type':Sequelize[_0x77e0('0x3')]},'telegram':{'type':Sequelize[_0x77e0('0x3')]},'UserId':{'type':Sequelize[_0x77e0('0x5')]},'priority':{'type':Sequelize[_0x77e0('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x77e0('0x6')],'defaultValue':Sequelize[_0x77e0('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c7c8b61..97f924a 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 _0xa3a1=['t.id\x20IN\x20?','sequelize','toString','keyBy','c.*','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','left_join','tools_tags','Tags','split','push','catch','destroy','find','params','startsWith','cf_','columnName','CmCustomField','displayName','alias','custom','type','values','body','findAll','get','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','ListId','findOrCreate','spread','show','Tag','omit','format','cf_%d','$and','pickBy','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','merge','options','setTags','getHoppers','nolimit','ContactId','CmHopper','includeAll','include','getHopperFinals','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','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','child_process','../../components/import/cm/csv','CompanyId','pid','createReadStream','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./cmContact.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','CmContact','describe','keys','query','model','attributes','intersection','fields','order','sort','where','pick','filters','field','color','from','select','cm_contacts','c.deletedAt\x20IS\x20NULL','expr','advancedFilter','parse','forEach','condition','isArray','length','and','tableAlias','value','\x20=\x20?','LIKE','\x20LIKE\x20?','\x20>\x20?','map','hasOwnProperty','isNil','isEmpty','concat','filter','replace','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','DESC','c.id','Sequelize','QueryTypes','COUNT(*)','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','having','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId'];(function(_0x2bc51a,_0x51dc0e){var _0x2b7d87=function(_0x3fd06f){while(--_0x3fd06f){_0x2bc51a['push'](_0x2bc51a['shift']());}};_0x2b7d87(++_0x51dc0e);}(_0xa3a1,0x70));var _0x1a3a=function(_0x4795d6,_0x69edbb){_0x4795d6=_0x4795d6-0x0;var _0x11af67=_0xa3a1[_0x4795d6];return _0x11af67;};'use strict';var pdf=require(_0x1a3a('0x0'));var emlformat=require(_0x1a3a('0x1'));var rimraf=require(_0x1a3a('0x2'));var zipdir=require(_0x1a3a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1a3a('0x4'));var BPromise=require(_0x1a3a('0x5'));var Mustache=require(_0x1a3a('0x6'));var util=require(_0x1a3a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1a3a('0x8'));var ejs=require(_0x1a3a('0x9'));var fs=require('fs');var _=require(_0x1a3a('0xa'));var squel=require(_0x1a3a('0xb'));var crypto=require('crypto');var jsforce=require(_0x1a3a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1a3a('0x8'));var querystring=require(_0x1a3a('0xd'));var Papa=require(_0x1a3a('0xe'));var Redis=require('ioredis');var authService=require(_0x1a3a('0xf'));var qs=require(_0x1a3a('0x10'));var hardwareService=require(_0x1a3a('0x11'));var logger=require(_0x1a3a('0x12'))(_0x1a3a('0x13'));var utils=require(_0x1a3a('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1a3a('0x15')]=_[_0x1a3a('0x16')](config[_0x1a3a('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a3a('0x17'))(new Redis(config[_0x1a3a('0x15')]));require(_0x1a3a('0x18'))['register'](socket);function respondWithStatusCode(_0x45a617,_0x4446d1){_0x4446d1=_0x4446d1||0xcc;return function(_0x28d5ad){if(_0x28d5ad){return _0x45a617[_0x1a3a('0x19')](_0x4446d1);}return _0x45a617[_0x1a3a('0x1a')](_0x4446d1)[_0x1a3a('0x1b')]();};}function respondWithResult(_0x3d6e1f,_0x53499d){_0x53499d=_0x53499d||0xc8;return function(_0x229bbc){if(_0x229bbc){return _0x3d6e1f[_0x1a3a('0x1a')](_0x53499d)[_0x1a3a('0x1c')](_0x229bbc);}};}function respondWithFilteredResult(_0x59d7b2,_0x4d0061){return function(_0x3d448b){if(_0x3d448b){var _0x343ead=_0x3d448b[_0x1a3a('0x1d')],_0x286399=_0x4d0061[_0x1a3a('0x1e')],_0x3d4392=_0x4d0061[_0x1a3a('0x1e')]+_0x4d0061[_0x1a3a('0x1f')],_0x1f7dc0;if(_0x3d4392>=_0x343ead){_0x3d4392=_0x343ead;_0x1f7dc0=0xc8;}else{_0x1f7dc0=0xce;}_0x59d7b2[_0x1a3a('0x1a')](_0x1f7dc0);return _0x59d7b2[_0x1a3a('0x20')](_0x1a3a('0x21'),_0x286399+'-'+_0x3d4392+'/'+_0x343ead)['json'](_0x3d448b);}return null;};}function patchUpdates(_0x19b6ba){return function(_0x1ea4a5){try{jsonpatch[_0x1a3a('0x22')](_0x1ea4a5,_0x19b6ba,!![]);}catch(_0x59fc5a){return BPromise[_0x1a3a('0x23')](_0x59fc5a);}return _0x1ea4a5[_0x1a3a('0x24')]();};}function saveUpdates(_0xef0c91,_0xd2e045){return function(_0xed5f4d){if(_0xed5f4d){return _0xed5f4d[_0x1a3a('0x25')](_0xef0c91)['then'](function(_0x5b8b43){return _0x5b8b43;});}return null;};}function removeEntity(_0x3a1089,_0x16b2ed){return function(_0xdc8701){if(_0xdc8701){return _0xdc8701['destroy']()[_0x1a3a('0x26')](function(){_0x3a1089[_0x1a3a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6d8c,_0x33c523){return function(_0x48b535){if(!_0x48b535){_0x5d6d8c[_0x1a3a('0x19')](0x194);}return _0x48b535;};}function handleError(_0x4addc8,_0x44bcb7){_0x44bcb7=_0x44bcb7||0x1f4;return function(_0x1029b8){logger[_0x1a3a('0x27')](_0x1029b8['stack']);if(_0x1029b8['name']){delete _0x1029b8[_0x1a3a('0x28')];}_0x4addc8[_0x1a3a('0x1a')](_0x44bcb7)[_0x1a3a('0x29')](_0x1029b8);};}exports['index']=function(_0x4b7fb1,_0xf335e){var _0x300e8d={},_0x75ab5d={},_0x1828a8={'count':0x0,'rows':[]};return db[_0x1a3a('0x2a')][_0x1a3a('0x2b')]()[_0x1a3a('0x26')](function(_0x1ddece){_0x75ab5d['model']=_[_0x1a3a('0x2c')](_0x1ddece);_0x75ab5d[_0x1a3a('0x2d')]=_[_0x1a3a('0x2c')](_0x4b7fb1[_0x1a3a('0x2d')]);_0x75ab5d['filters']=_['intersection'](_0x75ab5d[_0x1a3a('0x2e')],_0x75ab5d[_0x1a3a('0x2d')]);_0x300e8d[_0x1a3a('0x2f')]=_[_0x1a3a('0x30')](_0x75ab5d['model'],qs[_0x1a3a('0x31')](_0x4b7fb1['query'][_0x1a3a('0x31')]));_0x300e8d[_0x1a3a('0x2f')]=_0x300e8d[_0x1a3a('0x2f')]['length']?_0x300e8d['attributes']:_0x75ab5d[_0x1a3a('0x2e')];if(!_0x4b7fb1[_0x1a3a('0x2d')]['hasOwnProperty']('nolimit')){_0x300e8d[_0x1a3a('0x1f')]=qs[_0x1a3a('0x1f')](_0x4b7fb1[_0x1a3a('0x2d')][_0x1a3a('0x1f')]);_0x300e8d['offset']=qs['offset'](_0x4b7fb1['query'][_0x1a3a('0x1e')]);}_0x300e8d[_0x1a3a('0x32')]=qs[_0x1a3a('0x33')](_0x4b7fb1[_0x1a3a('0x2d')]['sort']);_0x300e8d[_0x1a3a('0x34')]=qs['filters'](_[_0x1a3a('0x35')](_0x4b7fb1[_0x1a3a('0x2d')],_0x75ab5d[_0x1a3a('0x36')]));var _0x35f8cb=[];var _0x16fd03=squel['select']()[_0x1a3a('0x37')]('id')[_0x1a3a('0x37')]('name')[_0x1a3a('0x37')](_0x1a3a('0x38'))[_0x1a3a('0x39')]('tools_tags');var _0x4313bc=squel[_0x1a3a('0x3a')]()[_0x1a3a('0x39')](_0x1a3a('0x3b'),'c')[_0x1a3a('0x34')](_0x1a3a('0x3c'));var _0x520e31=squel[_0x1a3a('0x3d')]();if(_0x4b7fb1[_0x1a3a('0x2d')][_0x1a3a('0x3e')]){var _0x22557d=JSON[_0x1a3a('0x3f')](_0x4b7fb1[_0x1a3a('0x2d')][_0x1a3a('0x3e')]);_[_0x1a3a('0x2c')](_0x22557d)[_0x1a3a('0x40')](function(_0x4424a5){var _0x78054d=_0x22557d[_0x4424a5];switch(_0x78054d[_0x1a3a('0x41')]){case'IS':if(_[_0x1a3a('0x42')](_0x78054d['value'])&&_0x78054d['value'][_0x1a3a('0x43')]>0x1){_0x520e31[_0x1a3a('0x44')](_0x78054d[_0x1a3a('0x45')]+'.'+_0x4424a5+'\x20IN\x20?',_0x78054d[_0x1a3a('0x46')]);}else{_0x520e31[_0x1a3a('0x44')](_0x78054d[_0x1a3a('0x45')]+'.'+_0x4424a5+_0x1a3a('0x47'),_0x78054d[_0x1a3a('0x46')][0x0]);}break;case'=':_0x520e31[_0x1a3a('0x44')](_0x78054d[_0x1a3a('0x45')]+'.'+_0x4424a5+_0x1a3a('0x47'),_0x78054d[_0x1a3a('0x46')]);break;case _0x1a3a('0x48'):_0x520e31[_0x1a3a('0x44')](_0x78054d[_0x1a3a('0x45')]+'.'+_0x4424a5+_0x1a3a('0x49'),'%'+_0x78054d['value']+'%');break;case'>':_0x520e31[_0x1a3a('0x44')](_0x78054d[_0x1a3a('0x45')]+'.'+_0x4424a5+_0x1a3a('0x4a'),_0x78054d[_0x1a3a('0x46')]);break;case'<':_0x520e31[_0x1a3a('0x44')](_0x78054d[_0x1a3a('0x45')]+'.'+_0x4424a5+'\x20<\x20?',_0x78054d['value']);break;}});}else{var _0x1daf80=_(Object['keys'](_0x4b7fb1[_0x1a3a('0x2d')]))[_0x1a3a('0x4b')](function(_0x818a7c){return _0x1ddece[_0x1a3a('0x4c')](_0x818a7c)?_0x818a7c:undefined;})['filter'](function(_0x4b9378){return!_[_0x1a3a('0x4d')](_0x4b9378);})[_0x1a3a('0x46')]();if(!_[_0x1a3a('0x4e')](_0x1daf80)){_0x1daf80[_0x1a3a('0x40')](function(_0x18a3fc){if(_0x18a3fc==='ListId'){_0x4313bc['where']('c.ListId\x20IN\x20?',[][_0x1a3a('0x4f')](_0x4b7fb1[_0x1a3a('0x2d')][_0x18a3fc]));}else{_0x4313bc['where']('c.'+_0x18a3fc+'\x20=\x20?',_0x4b7fb1[_0x1a3a('0x2d')][_0x18a3fc]);}});}if(_0x4b7fb1[_0x1a3a('0x2d')]['filter']){var _0x1c32f1=_0x4b7fb1['query'][_0x1a3a('0x50')][_0x1a3a('0x51')]('\x5c','\x5c\x5c')[_0x1a3a('0x51')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x1a3a('0x52')](_0x1c32f1)){_0x520e31['or'](_0x1a3a('0x53'),_0x1c32f1+'%');_0x520e31['or']('c.phone\x20LIKE\x20?',_0x1c32f1+'%');_0x520e31['or'](_0x1a3a('0x54'),_0x1c32f1+'%');_0x520e31['or'](_0x1a3a('0x55'),_0x1c32f1+'%');}else if(qs[_0x1a3a('0x56')](_0x1c32f1)){_0x520e31['or'](_0x1a3a('0x57'),_0x1c32f1+'%');}else{_0x520e31['or'](_0x1a3a('0x57'),_0x1c32f1+'%');_0x520e31['or'](_0x1a3a('0x58'),_0x1c32f1+'%');_0x520e31['or'](_0x1a3a('0x59'),_0x1c32f1+'%');}}}_0x4313bc[_0x1a3a('0x34')](_0x520e31);if(_0x300e8d[_0x1a3a('0x32')]){_0x300e8d[_0x1a3a('0x32')][_0x1a3a('0x40')](function(_0x3312a8){_0x4313bc[_0x1a3a('0x32')]('c.'+_0x3312a8[0x0],_0x3312a8[0x1]===_0x1a3a('0x5a')?![]:!![]);});}_0x4313bc['group'](_0x1a3a('0x5b'));var _0x2a91c7={'type':db[_0x1a3a('0x5c')][_0x1a3a('0x5d')]['SELECT'],'raw':!![]};var _0x3857ae=_0x4313bc['clone']()[_0x1a3a('0x37')](_0x1a3a('0x5e'));if(!_0x4b7fb1[_0x1a3a('0x2d')][_0x1a3a('0x3e')]){if(_0x4b7fb1[_0x1a3a('0x2d')][_0x1a3a('0x5f')]){var _0x2c7363=_['isArray'](_0x4b7fb1[_0x1a3a('0x2d')]['tag'])?_0x4b7fb1['query']['tag']:new Array(_0x4b7fb1['query'][_0x1a3a('0x5f')]);var _0x212f92=squel['expr']();_0x2c7363['forEach'](function(_0xb9e04){_0x212f92['or'](_0x1a3a('0x60'),'%,'+_0xb9e04+',%');});_0x4313bc[_0x1a3a('0x61')](_0x212f92);_0x3857ae['left_join'](_0x1a3a('0x62'),'ct',_0x1a3a('0x63'));_0x3857ae['left_join']('tools_tags','t',_0x1a3a('0x64'));_0x3857ae[_0x1a3a('0x34')](_0x1a3a('0x65'),_0x2c7363);}}db[_0x1a3a('0x66')]['query'](_0x16fd03[_0x1a3a('0x67')](),_0x2a91c7)[_0x1a3a('0x26')](function(_0xc19d80){_0x35f8cb=_[_0x1a3a('0x68')](_0xc19d80,'id');return db['sequelize']['query'](_0x3857ae[_0x1a3a('0x67')](),_0x2a91c7);})[_0x1a3a('0x26')](function(_0x47264b){_0x1828a8['count']=_0x47264b[_0x1a3a('0x43')];_0x2a91c7=_['merge'](_0x2a91c7,{'model':db[_0x1a3a('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x4313bc[_0x1a3a('0x37')](_0x1a3a('0x69'));_0x4313bc['field'](_0x1a3a('0x6a'),_0x1a3a('0x6b'));_0x4313bc[_0x1a3a('0x6c')]('cm_contact_has_tags','ct',_0x1a3a('0x63'));_0x4313bc[_0x1a3a('0x6c')](_0x1a3a('0x6d'),'t',_0x1a3a('0x64'));if(_0x300e8d[_0x1a3a('0x1f')]){_0x4313bc[_0x1a3a('0x1f')](_0x300e8d[_0x1a3a('0x1f')]);}if(_0x300e8d[_0x1a3a('0x1e')]){_0x4313bc['offset'](_0x300e8d[_0x1a3a('0x1e')]);}db[_0x1a3a('0x66')][_0x1a3a('0x2d')](_0x4313bc[_0x1a3a('0x67')](),_0x2a91c7)[_0x1a3a('0x26')](function(_0x386a0b){_0x386a0b['forEach'](function(_0x495ce4){if(_0x495ce4[_0x1a3a('0x6b')]){_0x495ce4[_0x1a3a('0x6e')]=[];_0x495ce4[_0x1a3a('0x6b')][_0x1a3a('0x6f')](',')['forEach'](function(_0x4dda53){_0x495ce4['Tags'][_0x1a3a('0x70')](_0x35f8cb[_0x4dda53]);});}delete _0x495ce4[_0x1a3a('0x6b')];});_0x1828a8['rows']=_0x386a0b;return _0x1828a8;})[_0x1a3a('0x26')](respondWithFilteredResult(_0xf335e,_0x300e8d))[_0x1a3a('0x71')](handleError(_0xf335e,null));});});};exports[_0x1a3a('0x72')]=function(_0x5d5e83,_0x5473bb){return db['CmContact'][_0x1a3a('0x73')]({'where':{'id':_0x5d5e83[_0x1a3a('0x74')]['id']}})['then'](handleEntityNotFound(_0x5473bb,null))[_0x1a3a('0x26')](removeEntity(_0x5473bb,null))['catch'](handleError(_0x5473bb,null));};exports[_0x1a3a('0x2b')]=function(_0x3ee6fa,_0x197c1e){return db[_0x1a3a('0x2a')][_0x1a3a('0x2b')]()[_0x1a3a('0x26')](function(_0x5bf32b){for(var _0x4f4a9d=0x0;_0x4f4a9d\x20?','\x20<\x20?','map','isNil','isEmpty','ListId','concat','filter','replace','\x27\x27\x27\x27','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','order','c.id','Sequelize','QueryTypes','clone','COUNT(*)','tag','having','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','left_join','t.id\x20IN\x20?','sequelize','toString','keyBy','merge','c.*','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','t.id\x20=\x20ct.TagId','Tags','split','push','rows','catch','find','params','describe','startsWith','columnName','CmCustomField','cf_','values','body','get','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','each','duplicates','$or','findOrCreate','spread','error','show','$and','omit','format','findAll','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','Tag','options','setTags','findOne','ids','getHoppers','ContactId','includeAll','include','CmHopperHistory','rawAttributes','getJscriptySessions','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','User','agent','binding','No\x20phone\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','child_process','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','CmContact','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','select','field','color'];(function(_0x213aa3,_0x322e42){var _0x533ec6=function(_0x371841){while(--_0x371841){_0x213aa3['push'](_0x213aa3['shift']());}};_0x533ec6(++_0x322e42);}(_0xad35,0x169));var _0x5ad3=function(_0x3b2686,_0x53a22e){_0x3b2686=_0x3b2686-0x0;var _0x32c4b6=_0xad35[_0x3b2686];return _0x32c4b6;};'use strict';var pdf=require(_0x5ad3('0x0'));var emlformat=require(_0x5ad3('0x1'));var rimraf=require(_0x5ad3('0x2'));var zipdir=require(_0x5ad3('0x3'));var jsonpatch=require(_0x5ad3('0x4'));var rp=require(_0x5ad3('0x5'));var moment=require(_0x5ad3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5ad3('0x7'));var util=require('util');var path=require(_0x5ad3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ad3('0x9'));var squel=require(_0x5ad3('0xa'));var crypto=require(_0x5ad3('0xb'));var jsforce=require(_0x5ad3('0xc'));var deskjs=require(_0x5ad3('0xd'));var toCsv=require(_0x5ad3('0xe'));var querystring=require(_0x5ad3('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ad3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ad3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad3('0x12'))(_0x5ad3('0x13'));var utils=require(_0x5ad3('0x14'));var config=require(_0x5ad3('0x15'));var db=require(_0x5ad3('0x16'))['db'];config[_0x5ad3('0x17')]=_[_0x5ad3('0x18')](config['redis'],{'host':_0x5ad3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0xb508db,_0x1dd872){_0x1dd872=_0x1dd872||0xcc;return function(_0x1d6e7e){if(_0x1d6e7e){return _0xb508db['sendStatus'](_0x1dd872);}return _0xb508db[_0x5ad3('0x1a')](_0x1dd872)[_0x5ad3('0x1b')]();};}function respondWithResult(_0x15bc67,_0x372961){_0x372961=_0x372961||0xc8;return function(_0x4eed2d){if(_0x4eed2d){return _0x15bc67[_0x5ad3('0x1a')](_0x372961)[_0x5ad3('0x1c')](_0x4eed2d);}};}function respondWithFilteredResult(_0x395f3f,_0x4d5ced){return function(_0x316ae4){if(_0x316ae4){var _0x129a7a=_0x316ae4[_0x5ad3('0x1d')],_0x1b3860=_0x4d5ced[_0x5ad3('0x1e')],_0x4ff453=_0x4d5ced[_0x5ad3('0x1e')]+_0x4d5ced['limit'],_0x15f59e;if(_0x4ff453>=_0x129a7a){_0x4ff453=_0x129a7a;_0x15f59e=0xc8;}else{_0x15f59e=0xce;}_0x395f3f[_0x5ad3('0x1a')](_0x15f59e);return _0x395f3f[_0x5ad3('0x1f')](_0x5ad3('0x20'),_0x1b3860+'-'+_0x4ff453+'/'+_0x129a7a)[_0x5ad3('0x1c')](_0x316ae4);}return null;};}function patchUpdates(_0x221c1f){return function(_0x1142fa){try{jsonpatch[_0x5ad3('0x21')](_0x1142fa,_0x221c1f,!![]);}catch(_0x336211){return BPromise['reject'](_0x336211);}return _0x1142fa[_0x5ad3('0x22')]();};}function saveUpdates(_0x5c8943,_0x4e539d){return function(_0xa09954){if(_0xa09954){return _0xa09954[_0x5ad3('0x23')](_0x5c8943)[_0x5ad3('0x24')](function(_0x3dbdd7){return _0x3dbdd7;});}return null;};}function removeEntity(_0x3ecfe1,_0x15b972){return function(_0x533ac2){if(_0x533ac2){return _0x533ac2[_0x5ad3('0x25')]()[_0x5ad3('0x24')](function(){_0x3ecfe1[_0x5ad3('0x1a')](0xcc)[_0x5ad3('0x1b')]();});}};}function handleEntityNotFound(_0x3c5294,_0x5124c8){return function(_0x410b5d){if(!_0x410b5d){_0x3c5294[_0x5ad3('0x26')](0x194);}return _0x410b5d;};}function handleError(_0x2a511d,_0x58b9e5){_0x58b9e5=_0x58b9e5||0x1f4;return function(_0x328232){logger['error'](_0x328232[_0x5ad3('0x27')]);if(_0x328232[_0x5ad3('0x28')]){delete _0x328232[_0x5ad3('0x28')];}_0x2a511d[_0x5ad3('0x1a')](_0x58b9e5)[_0x5ad3('0x29')](_0x328232);};}exports['index']=function(_0x209a4e,_0xb12efe){var _0x400680={},_0x34a7ac={},_0x132947={'count':0x0,'rows':[]};return db[_0x5ad3('0x2a')]['describe']()[_0x5ad3('0x24')](function(_0x447fcb){_0x34a7ac['model']=_[_0x5ad3('0x2b')](_0x447fcb);_0x34a7ac[_0x5ad3('0x2c')]=_[_0x5ad3('0x2b')](_0x209a4e[_0x5ad3('0x2c')]);_0x34a7ac[_0x5ad3('0x2d')]=_[_0x5ad3('0x2e')](_0x34a7ac[_0x5ad3('0x2f')],_0x34a7ac[_0x5ad3('0x2c')]);_0x400680[_0x5ad3('0x30')]=_[_0x5ad3('0x2e')](_0x34a7ac['model'],qs[_0x5ad3('0x31')](_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x31')]));_0x400680[_0x5ad3('0x30')]=_0x400680[_0x5ad3('0x30')][_0x5ad3('0x32')]?_0x400680[_0x5ad3('0x30')]:_0x34a7ac[_0x5ad3('0x2f')];if(!_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x33')](_0x5ad3('0x34'))){_0x400680[_0x5ad3('0x35')]=qs[_0x5ad3('0x35')](_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x35')]);_0x400680['offset']=qs[_0x5ad3('0x1e')](_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x1e')]);}_0x400680['order']=qs['sort'](_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x36')]);_0x400680['where']=qs[_0x5ad3('0x2d')](_[_0x5ad3('0x37')](_0x209a4e[_0x5ad3('0x2c')],_0x34a7ac[_0x5ad3('0x2d')]));var _0x371194=[];var _0xc19e00=squel[_0x5ad3('0x38')]()[_0x5ad3('0x39')]('id')[_0x5ad3('0x39')]('name')[_0x5ad3('0x39')](_0x5ad3('0x3a'))[_0x5ad3('0x3b')](_0x5ad3('0x3c'));var _0x508e5d=squel[_0x5ad3('0x38')]()[_0x5ad3('0x3b')]('cm_contacts','c')[_0x5ad3('0x3d')](_0x5ad3('0x3e'));var _0x2a0a63=squel[_0x5ad3('0x3f')]();if(_0x209a4e['query']['advancedFilter']){var _0x2a2c9f=JSON[_0x5ad3('0x40')](_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x41')]);_[_0x5ad3('0x2b')](_0x2a2c9f)[_0x5ad3('0x42')](function(_0x33effd){var _0x5a5890=_0x2a2c9f[_0x33effd];switch(_0x5a5890[_0x5ad3('0x43')]){case'IS':if(_[_0x5ad3('0x44')](_0x5a5890[_0x5ad3('0x45')])&&_0x5a5890[_0x5ad3('0x45')][_0x5ad3('0x32')]>0x1){_0x2a0a63[_0x5ad3('0x46')](_0x5a5890['tableAlias']+'.'+_0x33effd+_0x5ad3('0x47'),_0x5a5890['value']);}else{_0x2a0a63[_0x5ad3('0x46')](_0x5a5890[_0x5ad3('0x48')]+'.'+_0x33effd+'\x20=\x20?',_0x5a5890[_0x5ad3('0x45')][0x0]);}break;case'=':_0x2a0a63[_0x5ad3('0x46')](_0x5a5890[_0x5ad3('0x48')]+'.'+_0x33effd+'\x20=\x20?',_0x5a5890[_0x5ad3('0x45')]);break;case _0x5ad3('0x49'):_0x2a0a63[_0x5ad3('0x46')](_0x5a5890['tableAlias']+'.'+_0x33effd+_0x5ad3('0x4a'),'%'+_0x5a5890['value']+'%');break;case'>':_0x2a0a63['and'](_0x5a5890[_0x5ad3('0x48')]+'.'+_0x33effd+_0x5ad3('0x4b'),_0x5a5890[_0x5ad3('0x45')]);break;case'<':_0x2a0a63[_0x5ad3('0x46')](_0x5a5890[_0x5ad3('0x48')]+'.'+_0x33effd+_0x5ad3('0x4c'),_0x5a5890[_0x5ad3('0x45')]);break;}});}else{var _0x1cfe08=_(Object[_0x5ad3('0x2b')](_0x209a4e[_0x5ad3('0x2c')]))[_0x5ad3('0x4d')](function(_0x399e2f){return _0x447fcb[_0x5ad3('0x33')](_0x399e2f)?_0x399e2f:undefined;})['filter'](function(_0xfaf6d2){return!_[_0x5ad3('0x4e')](_0xfaf6d2);})[_0x5ad3('0x45')]();if(!_[_0x5ad3('0x4f')](_0x1cfe08)){_0x1cfe08[_0x5ad3('0x42')](function(_0x4ef0ef){if(_0x4ef0ef===_0x5ad3('0x50')){_0x508e5d['where']('c.ListId\x20IN\x20?',[][_0x5ad3('0x51')](_0x209a4e[_0x5ad3('0x2c')][_0x4ef0ef]));}else{_0x508e5d['where']('c.'+_0x4ef0ef+'\x20=\x20?',_0x209a4e[_0x5ad3('0x2c')][_0x4ef0ef]);}});}if(_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x52')]){var _0xe71efa=_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x52')][_0x5ad3('0x53')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x5ad3('0x54'));if(qs[_0x5ad3('0x55')](_0xe71efa)){_0x2a0a63['or']('c.id\x20LIKE\x20?',_0xe71efa+'%');_0x2a0a63['or']('c.phone\x20LIKE\x20?',_0xe71efa+'%');_0x2a0a63['or'](_0x5ad3('0x56'),_0xe71efa+'%');_0x2a0a63['or'](_0x5ad3('0x57'),_0xe71efa+'%');}else if(qs['isEmail'](_0xe71efa)){_0x2a0a63['or'](_0x5ad3('0x58'),_0xe71efa+'%');}else{_0x2a0a63['or'](_0x5ad3('0x58'),_0xe71efa+'%');_0x2a0a63['or'](_0x5ad3('0x59'),_0xe71efa+'%');_0x2a0a63['or'](_0x5ad3('0x5a'),_0xe71efa+'%');}}}_0x508e5d[_0x5ad3('0x3d')](_0x2a0a63);if(_0x400680[_0x5ad3('0x5b')]){_0x400680[_0x5ad3('0x5b')][_0x5ad3('0x42')](function(_0x294269){_0x508e5d[_0x5ad3('0x5b')]('c.'+_0x294269[0x0],_0x294269[0x1]==='DESC'?![]:!![]);});}_0x508e5d['group'](_0x5ad3('0x5c'));var _0x51925d={'type':db[_0x5ad3('0x5d')][_0x5ad3('0x5e')]['SELECT'],'raw':!![]};var _0x1751a0=_0x508e5d[_0x5ad3('0x5f')]()['field'](_0x5ad3('0x60'));if(!_0x209a4e[_0x5ad3('0x2c')]['advancedFilter']){if(_0x209a4e['query'][_0x5ad3('0x61')]){var _0x4ac1a4=_[_0x5ad3('0x44')](_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x61')])?_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x61')]:new Array(_0x209a4e[_0x5ad3('0x2c')][_0x5ad3('0x61')]);var _0x2e27ab=squel['expr']();_0x4ac1a4['forEach'](function(_0x114301){_0x2e27ab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x114301+',%');});_0x508e5d[_0x5ad3('0x62')](_0x2e27ab);_0x1751a0['left_join'](_0x5ad3('0x63'),'ct',_0x5ad3('0x64'));_0x1751a0[_0x5ad3('0x65')](_0x5ad3('0x3c'),'t','t.id\x20=\x20ct.TagId');_0x1751a0[_0x5ad3('0x3d')](_0x5ad3('0x66'),_0x4ac1a4);}}db[_0x5ad3('0x67')][_0x5ad3('0x2c')](_0xc19e00[_0x5ad3('0x68')](),_0x51925d)[_0x5ad3('0x24')](function(_0x12050e){_0x371194=_[_0x5ad3('0x69')](_0x12050e,'id');return db[_0x5ad3('0x67')][_0x5ad3('0x2c')](_0x1751a0[_0x5ad3('0x68')](),_0x51925d);})[_0x5ad3('0x24')](function(_0x2dede0){_0x132947[_0x5ad3('0x1d')]=_0x2dede0[_0x5ad3('0x32')];_0x51925d=_[_0x5ad3('0x6a')](_0x51925d,{'model':db[_0x5ad3('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x508e5d[_0x5ad3('0x39')](_0x5ad3('0x6b'));_0x508e5d[_0x5ad3('0x39')](_0x5ad3('0x6c'),_0x5ad3('0x6d'));_0x508e5d[_0x5ad3('0x65')](_0x5ad3('0x63'),'ct',_0x5ad3('0x64'));_0x508e5d[_0x5ad3('0x65')](_0x5ad3('0x3c'),'t',_0x5ad3('0x6e'));if(_0x400680['limit']){_0x508e5d[_0x5ad3('0x35')](_0x400680[_0x5ad3('0x35')]);}if(_0x400680[_0x5ad3('0x1e')]){_0x508e5d[_0x5ad3('0x1e')](_0x400680['offset']);}db[_0x5ad3('0x67')][_0x5ad3('0x2c')](_0x508e5d[_0x5ad3('0x68')](),_0x51925d)[_0x5ad3('0x24')](function(_0x6ecfa5){_0x6ecfa5[_0x5ad3('0x42')](function(_0xe06df1){if(_0xe06df1[_0x5ad3('0x6d')]){_0xe06df1[_0x5ad3('0x6f')]=[];_0xe06df1[_0x5ad3('0x6d')][_0x5ad3('0x70')](',')['forEach'](function(_0x3b7349){_0xe06df1[_0x5ad3('0x6f')][_0x5ad3('0x71')](_0x371194[_0x3b7349]);});}delete _0xe06df1[_0x5ad3('0x6d')];});_0x132947[_0x5ad3('0x72')]=_0x6ecfa5;return _0x132947;})['then'](respondWithFilteredResult(_0xb12efe,_0x400680))[_0x5ad3('0x73')](handleError(_0xb12efe,null));});});};exports['destroy']=function(_0x4853e8,_0x356698){return db[_0x5ad3('0x2a')][_0x5ad3('0x74')]({'where':{'id':_0x4853e8[_0x5ad3('0x75')]['id']}})[_0x5ad3('0x24')](handleEntityNotFound(_0x356698,null))[_0x5ad3('0x24')](removeEntity(_0x356698,null))[_0x5ad3('0x73')](handleError(_0x356698,null));};exports[_0x5ad3('0x76')]=function(_0x100d1a,_0xa9b4d1){return db[_0x5ad3('0x2a')][_0x5ad3('0x76')]()[_0x5ad3('0x24')](function(_0x5ea23f){for(var _0x3b0d71=0x0;_0x3b0d71{}\s\\|]/g,'-');_0x206083(null,util[_0xe3fc('0x1d')](_0xe3fc('0x1e'),path['basename'](_0x234142['originalname'],path[_0xe3fc('0x1f')](_0x234142[_0xe3fc('0x1b')])),Date[_0xe3fc('0x20')](),path[_0xe3fc('0x1f')](_0x234142[_0xe3fc('0x1b')])));}})});router[_0xe3fc('0x12')](_0xe3fc('0x21'),upload[_0xe3fc('0x22')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0xe3fc('0x18')]({'destination':function(_0x435062,_0x28dfbc,_0x184557){_0x184557(null,path[_0xe3fc('0x23')](config[_0xe3fc('0x19')],_0xe3fc('0x1a')));},'filename':function(_0x44f8e4,_0x1ab6bf,_0x2c58dd){_0x1ab6bf[_0xe3fc('0x1b')]=_0x1ab6bf[_0xe3fc('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c58dd(null,util['format'](_0xe3fc('0x1e'),path[_0xe3fc('0x24')](_0x1ab6bf[_0xe3fc('0x1b')],path[_0xe3fc('0x1f')](_0x1ab6bf[_0xe3fc('0x1b')])),Date[_0xe3fc('0x20')](),path[_0xe3fc('0x1f')](_0x1ab6bf[_0xe3fc('0x1b')])));}})});router[_0xe3fc('0x12')](_0xe3fc('0x25'),upload[_0xe3fc('0x22')]('file'),controller[_0xe3fc('0x26')]);router[_0xe3fc('0x12')](_0xe3fc('0x27'),auth[_0xe3fc('0x6')](),controller['import']);router[_0xe3fc('0x28')](_0xe3fc('0xa'),auth[_0xe3fc('0x6')](),controller['update']);router['delete'](_0xe3fc('0xa'),auth[_0xe3fc('0x6')](),controller['destroy']);module[_0xe3fc('0x29')]=router; \ No newline at end of file +var _0x9fbc=['basename','extname','/csv','single','file','uploadCsv','diskStorage','format','now','/upload/:id','import','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','merge','post','create','/create_many','bulkCreate','setTags','join','root','originalname','replace','%s-%s%s'];(function(_0x46540f,_0x526976){var _0x21f6f5=function(_0x48b5d6){while(--_0x48b5d6){_0x46540f['push'](_0x46540f['shift']());}};_0x21f6f5(++_0x526976);}(_0x9fbc,0x71));var _0xc9fb=function(_0x3a2a33,_0x29372a){_0x3a2a33=_0x3a2a33-0x0;var _0x10d6d2=_0x9fbc[_0x3a2a33];return _0x10d6d2;};'use strict';var multer=require(_0xc9fb('0x0'));var util=require(_0xc9fb('0x1'));var path=require(_0xc9fb('0x2'));var timeout=require(_0xc9fb('0x3'));var express=require(_0xc9fb('0x4'));var router=express[_0xc9fb('0x5')]();var auth=require(_0xc9fb('0x6'));var interaction=require(_0xc9fb('0x7'));var config=require(_0xc9fb('0x8'));var controller=require('./cmContact.controller');router[_0xc9fb('0x9')]('/',auth[_0xc9fb('0xa')](),controller[_0xc9fb('0xb')]);router[_0xc9fb('0x9')](_0xc9fb('0xc'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0xd')]);router[_0xc9fb('0x9')](_0xc9fb('0xe'),auth[_0xc9fb('0xa')](),controller['show']);router[_0xc9fb('0x9')](_0xc9fb('0xf'),auth[_0xc9fb('0xa')](),controller['getTags']);router[_0xc9fb('0x9')](_0xc9fb('0x10'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x11')]);router[_0xc9fb('0x9')](_0xc9fb('0x12'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x13')]);router[_0xc9fb('0x9')](_0xc9fb('0x14'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xc9fb('0x9')](_0xc9fb('0x15'),auth['isAuthenticated'](),controller[_0xc9fb('0x16')]);router['post']('/merge',auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x17')]);router[_0xc9fb('0x18')]('/',auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x19')]);router[_0xc9fb('0x18')](_0xc9fb('0x1a'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x1b')]);router[_0xc9fb('0x18')](_0xc9fb('0xf'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25dcdc,_0x535e68,_0x424f56){_0x424f56(null,path[_0xc9fb('0x1d')](config[_0xc9fb('0x1e')],'server/files/tmp'));},'filename':function(_0x31834d,_0x10adb6,_0x364096){_0x10adb6[_0xc9fb('0x1f')]=_0x10adb6[_0xc9fb('0x1f')][_0xc9fb('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x364096(null,util['format'](_0xc9fb('0x21'),path[_0xc9fb('0x22')](_0x10adb6['originalname'],path[_0xc9fb('0x23')](_0x10adb6[_0xc9fb('0x1f')])),Date['now'](),path[_0xc9fb('0x23')](_0x10adb6[_0xc9fb('0x1f')])));}})});router['post'](_0xc9fb('0x24'),upload[_0xc9fb('0x25')](_0xc9fb('0x26')),controller[_0xc9fb('0x27')]);var upload=multer({'storage':multer[_0xc9fb('0x28')]({'destination':function(_0x4eddca,_0x4c0b40,_0x66b940){_0x66b940(null,path[_0xc9fb('0x1d')](config['root'],'server/files/tmp'));},'filename':function(_0x374a58,_0x56b9f4,_0x8654b9){_0x56b9f4[_0xc9fb('0x1f')]=_0x56b9f4['originalname'][_0xc9fb('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8654b9(null,util[_0xc9fb('0x29')](_0xc9fb('0x21'),path[_0xc9fb('0x22')](_0x56b9f4[_0xc9fb('0x1f')],path[_0xc9fb('0x23')](_0x56b9f4[_0xc9fb('0x1f')])),Date[_0xc9fb('0x2a')](),path['extname'](_0x56b9f4['originalname'])));}})});router[_0xc9fb('0x18')]('/upload',upload[_0xc9fb('0x25')](_0xc9fb('0x26')),controller['upload']);router['post'](_0xc9fb('0x2b'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x2c')]);router[_0xc9fb('0x2d')](_0xc9fb('0xe'),auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x2e')]);router[_0xc9fb('0x2f')]('/:id',auth[_0xc9fb('0xa')](),controller[_0xc9fb('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8aeb035..59de6b2 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 _0xd1f5=['long','type','select','parse','values','setDataValue','stringify','BOOLEAN','lodash','exports','VIRTUAL','getDataValue','alias','name','TEXT'];(function(_0x1fcd24,_0x2bc0f1){var _0x34f30f=function(_0x308b29){while(--_0x308b29){_0x1fcd24['push'](_0x1fcd24['shift']());}};_0x34f30f(++_0x2bc0f1);}(_0xd1f5,0x116));var _0x5d1f=function(_0x29be98,_0x1113f6){_0x29be98=_0x29be98-0x0;var _0xac31c4=_0xd1f5[_0x29be98];return _0xac31c4;};'use strict';var Sequelize=require('sequelize');var _=require(_0x5d1f('0x0'));module[_0x5d1f('0x1')]={'name':{'type':Sequelize[_0x5d1f('0x2')],'get':function(_0x5cc99d){return this[_0x5d1f('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x55c123){this['setDataValue'](_0x5d1f('0x4'),_0x55c123?_0x55c123:this[_0x5d1f('0x3')](_0x5d1f('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x5d1f('0x6')](_0x5d1f('0x7')),'get':function(){if(this['getDataValue'](_0x5d1f('0x8'))===_0x5d1f('0x9')){return JSON[_0x5d1f('0xa')](this[_0x5d1f('0x3')](_0x5d1f('0xb')));}else{return this[_0x5d1f('0x3')]('values');}},'set':function(_0x280729){if(Array['isArray'](_0x280729)){this[_0x5d1f('0xc')]('values',JSON[_0x5d1f('0xd')](_0x280729));}else{this['setDataValue']('values',_0x280729);}}},'required':{'type':Sequelize[_0x5d1f('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x8335=['name','STRING','TEXT','long','type','select','parse','isArray','values','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x8335,0x119));var _0x5833=function(_0x39790d,_0x47bfc8){_0x39790d=_0x39790d-0x0;var _0x4ed685=_0x8335[_0x39790d];return _0x4ed685;};'use strict';var Sequelize=require(_0x5833('0x0'));var _=require(_0x5833('0x1'));module[_0x5833('0x2')]={'name':{'type':Sequelize[_0x5833('0x3')],'get':function(_0x4ba546){return this[_0x5833('0x4')](_0x5833('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3ef3a1){this[_0x5833('0x6')](_0x5833('0x5'),_0x3ef3a1?_0x3ef3a1:this[_0x5833('0x4')](_0x5833('0x7')));}},'type':{'type':Sequelize[_0x5833('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x5833('0x9')](_0x5833('0xa')),'get':function(){if(this[_0x5833('0x4')](_0x5833('0xb'))===_0x5833('0xc')){return JSON[_0x5833('0xd')](this[_0x5833('0x4')]('values'));}else{return this[_0x5833('0x4')]('values');}},'set':function(_0x2a5792){if(Array[_0x5833('0xe')](_0x2a5792)){this[_0x5833('0x6')](_0x5833('0xf'),JSON[_0x5833('0x10')](_0x2a5792));}else{this[_0x5833('0x6')]('values',_0x2a5792);}}},'required':{'type':Sequelize[_0x5833('0x11')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 242515d..355caaf 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 _0xb10b=['ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','CmCustomField','rawAttributes','differenceBy','keys','name','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','type','key','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','show','length','merge','options','find','create','transaction','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x44b346,_0xeb097d){var _0x1c2f2b=function(_0x4e1f23){while(--_0x4e1f23){_0x44b346['push'](_0x44b346['shift']());}};_0x1c2f2b(++_0xeb097d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xb10b[_0x1ab0e6];return _0x248815;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_[_0xbb10('0x2c')](_0x1acce9),[_0xbb10('0x2d')]);_0x6ed43b[_0xbb10('0x2e')]=_[_0xbb10('0x2c')](_0x4e25ff[_0xbb10('0x2e')]);_0x6ed43b['filters']=_[_0xbb10('0x2f')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2e')]);_0x24d586['attributes']=_[_0xbb10('0x2f')](_0x6ed43b[_0xbb10('0x30')],qs[_0xbb10('0x31')](_0x4e25ff['query']['fields']));_0x24d586[_0xbb10('0x32')]=_0x24d586[_0xbb10('0x32')]['length']?_0x24d586[_0xbb10('0x32')]:_0x6ed43b[_0xbb10('0x30')];if(!_0x4e25ff[_0xbb10('0x2e')][_0xbb10('0x33')](_0xbb10('0x34'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff['query'][_0xbb10('0x1d')]);_0x24d586[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2e')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x35')]=qs[_0xbb10('0x36')](_0x4e25ff[_0xbb10('0x2e')][_0xbb10('0x36')]);_0x24d586['where']=qs[_0xbb10('0x37')](_[_0xbb10('0x38')](_0x4e25ff[_0xbb10('0x2e')],_0x6ed43b[_0xbb10('0x37')]));if(_0x4e25ff['query'][_0xbb10('0x39')]){_0x24d586['where']=_['merge'](_0x24d586[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3b')](_0x1acce9,function(_0x26e76a){if(_0x26e76a[_0xbb10('0x3c')][_0xbb10('0x3d')]!==_0xbb10('0x3e')){var _0x547062={};_0x547062[_0x26e76a[_0xbb10('0x3f')]]={'$like':'%'+_0x4e25ff[_0xbb10('0x2e')]['filter']+'%'};return _0x547062;}})});}_0x24d586=_['merge']({},_0x24d586,_0x4e25ff['options']);var _0x31bee3={'where':_0x24d586[_0xbb10('0x3a')]};return db[_0xbb10('0x29')]['count'](_0x31bee3)[_0xbb10('0x25')](function(_0x3e8538){_0x1d5e95[_0xbb10('0x40')]=_0x3e8538;if(_0x4e25ff['query'][_0xbb10('0x41')]){_0x24d586[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x43')](_0x24d586);})['then'](function(_0xd238e9){_0x1d5e95[_0xbb10('0x44')]=_0xd238e9;return _0x1d5e95;})['then'](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x45')](handleError(_0x2fdde9,null));};exports[_0xbb10('0x46')]=function(_0x44d6ae,_0x3a9934){var _0x2dd35a={'raw':!![],'where':{'id':_0x44d6ae['params']['id']}},_0x185a52={};_0x185a52[_0xbb10('0x30')]=_[_0xbb10('0x2c')](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x185a52['query']=_[_0xbb10('0x2c')](_0x44d6ae[_0xbb10('0x2e')]);_0x185a52[_0xbb10('0x37')]=_[_0xbb10('0x2f')](_0x185a52['model'],_0x185a52[_0xbb10('0x2e')]);_0x2dd35a[_0xbb10('0x32')]=_['intersection'](_0x185a52['model'],qs[_0xbb10('0x31')](_0x44d6ae['query'][_0xbb10('0x31')]));_0x2dd35a[_0xbb10('0x32')]=_0x2dd35a['attributes'][_0xbb10('0x47')]?_0x2dd35a[_0xbb10('0x32')]:_0x185a52[_0xbb10('0x30')];if(_0x44d6ae['query'][_0xbb10('0x41')]){_0x2dd35a[_0xbb10('0x42')]=[{'all':!![]}];}_0x2dd35a=_[_0xbb10('0x48')]({},_0x2dd35a,_0x44d6ae[_0xbb10('0x49')]);return db[_0xbb10('0x29')][_0xbb10('0x4a')](_0x2dd35a)[_0xbb10('0x25')](handleEntityNotFound(_0x3a9934,null))[_0xbb10('0x25')](respondWithResult(_0x3a9934,null))[_0xbb10('0x45')](handleError(_0x3a9934,null));};exports[_0xbb10('0x4b')]=function(_0x197871,_0x1eadd2){return db['sequelize'][_0xbb10('0x4c')](function(_0x41bbf8){return db['CmCustomField'][_0xbb10('0x4b')](_0x197871[_0xbb10('0x4d')],{'transaction':_0x41bbf8});})[_0xbb10('0x25')](respondWithResult(_0x1eadd2,0xc9))[_0xbb10('0x45')](handleError(_0x1eadd2,null));};exports[_0xbb10('0x23')]=function(_0x39f0de,_0x3e06b0){if(_0x39f0de['body']['id']){delete _0x39f0de['body']['id'];}return db[_0xbb10('0x29')][_0xbb10('0x4a')]({'where':{'id':_0x39f0de[_0xbb10('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e06b0,null))['then'](saveUpdates(_0x39f0de[_0xbb10('0x4d')],null))[_0xbb10('0x25')](respondWithResult(_0x3e06b0,null))[_0xbb10('0x45')](handleError(_0x3e06b0,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x29')][_0xbb10('0x4a')]({'where':{'id':_0x10159b[_0xbb10('0x4e')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));}; \ No newline at end of file +var _0xb10b=['ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','CmCustomField','rawAttributes','differenceBy','keys','name','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','type','key','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','show','length','merge','options','find','create','transaction','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d8b1d,_0x1c0f88){_0x3d8b1d=_0x3d8b1d-0x0;var _0x2bb57a=_0xb10b[_0x3d8b1d];return _0x2bb57a;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_[_0xbb10('0x2c')](_0x1acce9),[_0xbb10('0x2d')]);_0x6ed43b[_0xbb10('0x2e')]=_[_0xbb10('0x2c')](_0x4e25ff[_0xbb10('0x2e')]);_0x6ed43b['filters']=_[_0xbb10('0x2f')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2e')]);_0x24d586['attributes']=_[_0xbb10('0x2f')](_0x6ed43b[_0xbb10('0x30')],qs[_0xbb10('0x31')](_0x4e25ff['query']['fields']));_0x24d586[_0xbb10('0x32')]=_0x24d586[_0xbb10('0x32')]['length']?_0x24d586[_0xbb10('0x32')]:_0x6ed43b[_0xbb10('0x30')];if(!_0x4e25ff[_0xbb10('0x2e')][_0xbb10('0x33')](_0xbb10('0x34'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff['query'][_0xbb10('0x1d')]);_0x24d586[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2e')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x35')]=qs[_0xbb10('0x36')](_0x4e25ff[_0xbb10('0x2e')][_0xbb10('0x36')]);_0x24d586['where']=qs[_0xbb10('0x37')](_[_0xbb10('0x38')](_0x4e25ff[_0xbb10('0x2e')],_0x6ed43b[_0xbb10('0x37')]));if(_0x4e25ff['query'][_0xbb10('0x39')]){_0x24d586['where']=_['merge'](_0x24d586[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3b')](_0x1acce9,function(_0x26e76a){if(_0x26e76a[_0xbb10('0x3c')][_0xbb10('0x3d')]!==_0xbb10('0x3e')){var _0x547062={};_0x547062[_0x26e76a[_0xbb10('0x3f')]]={'$like':'%'+_0x4e25ff[_0xbb10('0x2e')]['filter']+'%'};return _0x547062;}})});}_0x24d586=_['merge']({},_0x24d586,_0x4e25ff['options']);var _0x31bee3={'where':_0x24d586[_0xbb10('0x3a')]};return db[_0xbb10('0x29')]['count'](_0x31bee3)[_0xbb10('0x25')](function(_0x3e8538){_0x1d5e95[_0xbb10('0x40')]=_0x3e8538;if(_0x4e25ff['query'][_0xbb10('0x41')]){_0x24d586[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x43')](_0x24d586);})['then'](function(_0xd238e9){_0x1d5e95[_0xbb10('0x44')]=_0xd238e9;return _0x1d5e95;})['then'](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x45')](handleError(_0x2fdde9,null));};exports[_0xbb10('0x46')]=function(_0x44d6ae,_0x3a9934){var _0x2dd35a={'raw':!![],'where':{'id':_0x44d6ae['params']['id']}},_0x185a52={};_0x185a52[_0xbb10('0x30')]=_[_0xbb10('0x2c')](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x185a52['query']=_[_0xbb10('0x2c')](_0x44d6ae[_0xbb10('0x2e')]);_0x185a52[_0xbb10('0x37')]=_[_0xbb10('0x2f')](_0x185a52['model'],_0x185a52[_0xbb10('0x2e')]);_0x2dd35a[_0xbb10('0x32')]=_['intersection'](_0x185a52['model'],qs[_0xbb10('0x31')](_0x44d6ae['query'][_0xbb10('0x31')]));_0x2dd35a[_0xbb10('0x32')]=_0x2dd35a['attributes'][_0xbb10('0x47')]?_0x2dd35a[_0xbb10('0x32')]:_0x185a52[_0xbb10('0x30')];if(_0x44d6ae['query'][_0xbb10('0x41')]){_0x2dd35a[_0xbb10('0x42')]=[{'all':!![]}];}_0x2dd35a=_[_0xbb10('0x48')]({},_0x2dd35a,_0x44d6ae[_0xbb10('0x49')]);return db[_0xbb10('0x29')][_0xbb10('0x4a')](_0x2dd35a)[_0xbb10('0x25')](handleEntityNotFound(_0x3a9934,null))[_0xbb10('0x25')](respondWithResult(_0x3a9934,null))[_0xbb10('0x45')](handleError(_0x3a9934,null));};exports[_0xbb10('0x4b')]=function(_0x197871,_0x1eadd2){return db['sequelize'][_0xbb10('0x4c')](function(_0x41bbf8){return db['CmCustomField'][_0xbb10('0x4b')](_0x197871[_0xbb10('0x4d')],{'transaction':_0x41bbf8});})[_0xbb10('0x25')](respondWithResult(_0x1eadd2,0xc9))[_0xbb10('0x45')](handleError(_0x1eadd2,null));};exports[_0xbb10('0x23')]=function(_0x39f0de,_0x3e06b0){if(_0x39f0de['body']['id']){delete _0x39f0de['body']['id'];}return db[_0xbb10('0x29')][_0xbb10('0x4a')]({'where':{'id':_0x39f0de[_0xbb10('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e06b0,null))['then'](saveUpdates(_0x39f0de[_0xbb10('0x4d')],null))[_0xbb10('0x25')](respondWithResult(_0x3e06b0,null))[_0xbb10('0x45')](handleError(_0x3e06b0,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x29')][_0xbb10('0x4a')]({'where':{'id':_0x10159b[_0xbb10('0x4e')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7ffbeb3..a943a96 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 _0x529b=['cm_contacts','format','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','TEXT','type','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn'];(function(_0x591339,_0x238d40){var _0x37d8e8=function(_0x57c2fd){while(--_0x57c2fd){_0x591339['push'](_0x591339['shift']());}};_0x37d8e8(++_0x238d40);}(_0x529b,0x1d0));var _0xb529=function(_0x4f76cf,_0x30b006){_0x4f76cf=_0x4f76cf-0x0;var _0x98d120=_0x529b[_0x4f76cf];return _0x98d120;};'use strict';var _=require(_0xb529('0x0'));var util=require(_0xb529('0x1'));var logger=require('../../config/logger')(_0xb529('0x2'));var moment=require('moment');var BPromise=require(_0xb529('0x3'));var rp=require(_0xb529('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb529('0x5'));var config=require(_0xb529('0x6'));var attributes=require('./cmCustomField.attributes');module[_0xb529('0x7')]=function(_0x11680c,_0x25e7c0){return _0x11680c[_0xb529('0x8')](_0xb529('0x9'),attributes,{'tableName':_0xb529('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30acfe,_0x4c2b46,_0x36333f){var _0x2f9f4b=_0x30acfe['get']({'plain':!![]});var _0xcfb691={'type':_0x25e7c0[_0xb529('0xb')],'transaction':_0x4c2b46['transaction']};switch(_0x2f9f4b[_0xb529('0xc')]){case _0xb529('0xd'):_0xcfb691['type']=_0x25e7c0['TEXT'];break;case _0xb529('0xe'):_0xcfb691[_0xb529('0xc')]=_0x25e7c0[_0xb529('0xf')];break;case'switch':_0xcfb691[_0xb529('0xc')]=_0x25e7c0[_0xb529('0x10')];_0xcfb691[_0xb529('0x11')]=![];break;}_0x11680c[_0xb529('0x12')][_0xb529('0x13')](_0xb529('0x14'),util[_0xb529('0x15')]('cf_%d',_0x2f9f4b['id']),_0xcfb691);_0x36333f();}}});}; \ No newline at end of file +var _0x8b66=['type','text','BOOLEAN','defaultValue','addColumn','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','get','TEXT','transaction'];(function(_0x46702d,_0x465dd6){var _0x6d2f37=function(_0x10fc08){while(--_0x10fc08){_0x46702d['push'](_0x46702d['shift']());}};_0x6d2f37(++_0x465dd6);}(_0x8b66,0xae));var _0x68b6=function(_0x697a85,_0x238db2){_0x697a85=_0x697a85-0x0;var _0x4a6ba9=_0x8b66[_0x697a85];return _0x4a6ba9;};'use strict';var _=require('lodash');var util=require(_0x68b6('0x0'));var logger=require(_0x68b6('0x1'))(_0x68b6('0x2'));var moment=require('moment');var BPromise=require(_0x68b6('0x3'));var rp=require(_0x68b6('0x4'));var fs=require('fs');var path=require(_0x68b6('0x5'));var rimraf=require(_0x68b6('0x6'));var config=require('../../config/environment');var attributes=require(_0x68b6('0x7'));module[_0x68b6('0x8')]=function(_0x302f72,_0x76fd48){return _0x302f72[_0x68b6('0x9')](_0x68b6('0xa'),attributes,{'tableName':_0x68b6('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44b5e4,_0x1f0dd2,_0x2d4c39){var _0x27ed09=_0x44b5e4[_0x68b6('0xc')]({'plain':!![]});var _0x3265a0={'type':_0x76fd48[_0x68b6('0xd')],'transaction':_0x1f0dd2[_0x68b6('0xe')]};switch(_0x27ed09[_0x68b6('0xf')]){case _0x68b6('0x10'):_0x3265a0['type']=_0x76fd48[_0x68b6('0xd')];break;case'number':_0x3265a0['type']=_0x76fd48['INTEGER'];break;case'switch':_0x3265a0[_0x68b6('0xf')]=_0x76fd48[_0x68b6('0x11')];_0x3265a0[_0x68b6('0x12')]=![];break;}_0x302f72['queryInterface'][_0x68b6('0x13')]('cm_contacts',util[_0x68b6('0x14')]('cf_%d',_0x27ed09['id']),_0x3265a0);_0x2d4c39();}}});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 4df2add..a130345 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 _0x0306=['message','request\x20sent','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x52a8da,_0x5d9213){var _0x5e9460=function(_0x191193){while(--_0x191193){_0x52a8da['push'](_0x52a8da['shift']());}};_0x5e9460(++_0x5d9213);}(_0x0306,0x13e));var _0x6030=function(_0x234295,_0x7ce241){_0x234295=_0x234295-0x0;var _0x20b7b7=_0x0306[_0x234295];return _0x20b7b7;};'use strict';var _=require(_0x6030('0x0'));var util=require(_0x6030('0x1'));var moment=require(_0x6030('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6030('0x3'))['db'];var utils=require(_0x6030('0x4'));var logger=require(_0x6030('0x5'))(_0x6030('0x6'));var config=require(_0x6030('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6030('0x8')][_0x6030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5596c8,_0x57ff02,_0x43a46c){return new BPromise(function(_0x20df28,_0x266ebe){return client[_0x6030('0xa')](_0x5596c8,_0x43a46c)['then'](function(_0x149f97){logger[_0x6030('0xb')](_0x6030('0xc'),_0x57ff02,'request\x20sent');logger[_0x6030('0xd')](_0x6030('0xe'),_0x57ff02,'request\x20sent',JSON[_0x6030('0xf')](_0x149f97));if(_0x149f97['error']){if(_0x149f97['error'][_0x6030('0x10')]===0x1f4){logger[_0x6030('0x11')](_0x6030('0xc'),_0x57ff02,_0x149f97[_0x6030('0x11')]['message']);return _0x266ebe(_0x149f97[_0x6030('0x11')][_0x6030('0x12')]);}logger[_0x6030('0x11')](_0x6030('0xc'),_0x57ff02,_0x149f97['error'][_0x6030('0x12')]);return _0x20df28(_0x149f97[_0x6030('0x11')][_0x6030('0x12')]);}else{logger[_0x6030('0xb')](_0x6030('0xc'),_0x57ff02,_0x6030('0x13'));_0x20df28(_0x149f97['result'][_0x6030('0x12')]);}})[_0x6030('0x14')](function(_0x5e9db6){logger['error'](_0x6030('0xc'),_0x57ff02,_0x5e9db6);_0x266ebe(_0x5e9db6);});});} \ No newline at end of file +var _0xc868=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message'];(function(_0x508d2c,_0x59d989){var _0x10ec40=function(_0x475c3e){while(--_0x475c3e){_0x508d2c['push'](_0x508d2c['shift']());}};_0x10ec40(++_0x59d989);}(_0xc868,0x172));var _0x8c86=function(_0x29f94d,_0x463245){_0x29f94d=_0x29f94d-0x0;var _0x2d4fca=_0xc868[_0x29f94d];return _0x2d4fca;};'use strict';var _=require(_0x8c86('0x0'));var util=require(_0x8c86('0x1'));var moment=require(_0x8c86('0x2'));var BPromise=require(_0x8c86('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c86('0x4'))['db'];var utils=require(_0x8c86('0x5'));var logger=require(_0x8c86('0x6'))(_0x8c86('0x7'));var config=require(_0x8c86('0x8'));var jayson=require(_0x8c86('0x9'));var client=jayson[_0x8c86('0xa')][_0x8c86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6ad8b0,_0x5e4569,_0x458f2e){return new BPromise(function(_0x2dc68b,_0x12b253){return client['request'](_0x6ad8b0,_0x458f2e)['then'](function(_0x305e9f){logger[_0x8c86('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5e4569,'request\x20sent');logger[_0x8c86('0xd')](_0x8c86('0xe'),_0x5e4569,_0x8c86('0xf'),JSON[_0x8c86('0x10')](_0x305e9f));if(_0x305e9f[_0x8c86('0x11')]){if(_0x305e9f[_0x8c86('0x11')][_0x8c86('0x12')]===0x1f4){logger[_0x8c86('0x11')](_0x8c86('0x13'),_0x5e4569,_0x305e9f[_0x8c86('0x11')][_0x8c86('0x14')]);return _0x12b253(_0x305e9f[_0x8c86('0x11')][_0x8c86('0x14')]);}logger[_0x8c86('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5e4569,_0x305e9f['error']['message']);return _0x2dc68b(_0x305e9f[_0x8c86('0x11')][_0x8c86('0x14')]);}else{logger[_0x8c86('0xc')](_0x8c86('0x13'),_0x5e4569,'request\x20sent');_0x2dc68b(_0x305e9f[_0x8c86('0x15')]['message']);}})[_0x8c86('0x16')](function(_0x4cc808){logger[_0x8c86('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5e4569,_0x4cc808);_0x12b253(_0x4cc808);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 76aff7a..32a0d97 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 _0x0893=['create','put','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post'];(function(_0x440ab8,_0x5ce7eb){var _0x5d5598=function(_0x17990b){while(--_0x17990b){_0x440ab8['push'](_0x440ab8['shift']());}};_0x5d5598(++_0x5ce7eb);}(_0x0893,0x164));var _0x3089=function(_0x450bc4,_0x4554c4){_0x450bc4=_0x450bc4-0x0;var _0x861da2=_0x0893[_0x450bc4];return _0x861da2;};'use strict';var multer=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var path=require('path');var timeout=require(_0x3089('0x2'));var express=require('express');var router=express[_0x3089('0x3')]();var auth=require(_0x3089('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3089('0x5'));var controller=require(_0x3089('0x6'));router[_0x3089('0x7')]('/',auth[_0x3089('0x8')](),controller['index']);router[_0x3089('0x7')](_0x3089('0x9'),auth[_0x3089('0x8')](),controller[_0x3089('0xa')]);router[_0x3089('0xb')]('/',auth['isAuthenticated'](),controller[_0x3089('0xc')]);router[_0x3089('0xd')](_0x3089('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3089('0x8')](),controller[_0x3089('0xe')]);module[_0x3089('0xf')]=router; \ No newline at end of file +var _0xd140=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xd140,0x76));var _0x0d14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd140[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0d14('0x0'));var util=require(_0x0d14('0x1'));var path=require(_0x0d14('0x2'));var timeout=require(_0x0d14('0x3'));var express=require(_0x0d14('0x4'));var router=express[_0x0d14('0x5')]();var auth=require(_0x0d14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0d14('0x7'));var controller=require(_0x0d14('0x8'));router[_0x0d14('0x9')]('/',auth[_0x0d14('0xa')](),controller[_0x0d14('0xb')]);router[_0x0d14('0x9')]('/:id',auth[_0x0d14('0xa')](),controller[_0x0d14('0xc')]);router[_0x0d14('0xd')]('/',auth[_0x0d14('0xa')](),controller[_0x0d14('0xe')]);router[_0x0d14('0xf')](_0x0d14('0x10'),auth[_0x0d14('0xa')](),controller[_0x0d14('0x11')]);router[_0x0d14('0x12')]('/:id',auth[_0x0d14('0xa')](),controller[_0x0d14('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 1a8f690..e20ad45 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 _0xdfaf=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfaf,0xec));var _0xfdfa=function(_0x29f29a,_0x16338b){_0x29f29a=_0x29f29a-0x0;var _0x2fb966=_0xdfaf[_0x29f29a];return _0x2fb966;};'use strict';var moment=require(_0xfdfa('0x0'));var Sequelize=require(_0xfdfa('0x1'));module[_0xfdfa('0x2')]={'phone':{'type':Sequelize[_0xfdfa('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xfdfa('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xfdfa('0x5')],'defaultValue':moment()[_0xfdfa('0x6')](_0xfdfa('0x7'))},'countbusyretry':{'type':Sequelize[_0xfdfa('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfdfa('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfdfa('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfdfa('0x5')]},'priority':{'type':Sequelize[_0xfdfa('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xfdfa('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfdfa('0x8')],'unique':_0xfdfa('0x9')},'ListId':{'type':Sequelize[_0xfdfa('0x8')],'unique':_0xfdfa('0x9')},'UserId':{'type':Sequelize[_0xfdfa('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xfdfa('0x8')],'unique':_0xfdfa('0x9')},'CampaignId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe1e8=['exports','STRING','DATE','format','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x2847d0,_0x10a787){var _0x1cc209=function(_0x3863ff){while(--_0x3863ff){_0x2847d0['push'](_0x2847d0['shift']());}};_0x1cc209(++_0x10a787);}(_0xe1e8,0x120));var _0x8e1e=function(_0x1156ca,_0x504015){_0x1156ca=_0x1156ca-0x0;var _0x4992a4=_0xe1e8[_0x1156ca];return _0x4992a4;};'use strict';var moment=require(_0x8e1e('0x0'));var Sequelize=require(_0x8e1e('0x1'));module[_0x8e1e('0x2')]={'phone':{'type':Sequelize[_0x8e1e('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8e1e('0x4')],'defaultValue':moment()[_0x8e1e('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8e1e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8e1e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8e1e('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8e1e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8e1e('0x4')]},'priority':{'type':Sequelize[_0x8e1e('0x6')](0x2)[_0x8e1e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8e1e('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8e1e('0x6')],'unique':_0x8e1e('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8e1e('0x9')},'UserId':{'type':Sequelize[_0x8e1e('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x8e1e('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 21ab77e..08cca63 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 _0x2dae=['UserId','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','ContactId','isNil','firstName','lastName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','CmHopper','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','model','fields','length','nolimit','order','sort','pick','where','map','type','key','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user'];(function(_0x5173ce,_0x550f95){var _0x32895c=function(_0x117502){while(--_0x117502){_0x5173ce['push'](_0x5173ce['shift']());}};_0x32895c(++_0x550f95);}(_0x2dae,0xc3));var _0xe2da=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x2dae[_0x4de1b1];return _0x639f27;};'use strict';var pdf=require(_0xe2da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe2da('0x1'));var zipdir=require(_0xe2da('0x2'));var jsonpatch=require(_0xe2da('0x3'));var rp=require(_0xe2da('0x4'));var moment=require(_0xe2da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2da('0x6'));var util=require(_0xe2da('0x7'));var path=require(_0xe2da('0x8'));var sox=require(_0xe2da('0x9'));var csv=require('to-csv');var ejs=require(_0xe2da('0xa'));var fs=require('fs');var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x10'));var querystring=require(_0xe2da('0x11'));var Papa=require(_0xe2da('0x12'));var Redis=require('ioredis');var authService=require(_0xe2da('0x13'));var qs=require(_0xe2da('0x14'));var hardwareService=require(_0xe2da('0x15'));var logger=require(_0xe2da('0x16'))(_0xe2da('0x17'));var utils=require(_0xe2da('0x18'));var config=require(_0xe2da('0x19'));var db=require(_0xe2da('0x1a'))['db'];function respondWithStatusCode(_0x5aab71,_0xb98909){_0xb98909=_0xb98909||0xcc;return function(_0x5200b1){if(_0x5200b1){return _0x5aab71[_0xe2da('0x1b')](_0xb98909);}return _0x5aab71[_0xe2da('0x1c')](_0xb98909)[_0xe2da('0x1d')]();};}function respondWithResult(_0x411b9f,_0xfab73e){_0xfab73e=_0xfab73e||0xc8;return function(_0x5660b5){if(_0x5660b5){return _0x411b9f[_0xe2da('0x1c')](_0xfab73e)['json'](_0x5660b5);}};}function respondWithFilteredResult(_0x236e7a,_0x5e1702){return function(_0x586b27){if(_0x586b27){var _0x403d1c=_0x586b27[_0xe2da('0x1e')],_0x3dfc52=_0x5e1702[_0xe2da('0x1f')],_0x33f919=_0x5e1702[_0xe2da('0x1f')]+_0x5e1702[_0xe2da('0x20')],_0x4dc58b;if(_0x33f919>=_0x403d1c){_0x33f919=_0x403d1c;_0x4dc58b=0xc8;}else{_0x4dc58b=0xce;}_0x236e7a['status'](_0x4dc58b);return _0x236e7a[_0xe2da('0x21')](_0xe2da('0x22'),_0x3dfc52+'-'+_0x33f919+'/'+_0x403d1c)[_0xe2da('0x23')](_0x586b27);}return null;};}function patchUpdates(_0x2e5730){return function(_0x329ffe){try{jsonpatch['apply'](_0x329ffe,_0x2e5730,!![]);}catch(_0x56eeb1){return BPromise[_0xe2da('0x24')](_0x56eeb1);}return _0x329ffe['save']();};}function saveUpdates(_0x1a9324,_0x254b37){return function(_0x332193){if(_0x332193){return _0x332193[_0xe2da('0x25')](_0x1a9324)[_0xe2da('0x26')](function(_0x3e22de){return _0x3e22de;});}return null;};}function removeEntity(_0x5a9ffe,_0x467cd6){return function(_0x53cc4e){if(_0x53cc4e){return _0x53cc4e[_0xe2da('0x27')]()[_0xe2da('0x26')](function(){_0x5a9ffe[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();});}};}function handleEntityNotFound(_0x30dea4,_0x1e45e9){return function(_0x38f2c4){if(!_0x38f2c4){_0x30dea4[_0xe2da('0x1b')](0x194);}return _0x38f2c4;};}function handleError(_0x5a08d6,_0x1c901e){_0x1c901e=_0x1c901e||0x1f4;return function(_0x357bff){logger[_0xe2da('0x28')](_0x357bff[_0xe2da('0x29')]);if(_0x357bff[_0xe2da('0x2a')]){delete _0x357bff[_0xe2da('0x2a')];}_0x5a08d6[_0xe2da('0x1c')](_0x1c901e)['send'](_0x357bff);};}exports[_0xe2da('0x2b')]=function(_0x3e23d7,_0x1dc228){var _0x38ee5e={},_0x36ca43={},_0x2b6c9e={'count':0x0,'rows':[]};var _0x1b4aff=db[_0xe2da('0x2c')]['rawAttributes'];_0x36ca43['model']=_['keys'](_0x1b4aff);_0x36ca43[_0xe2da('0x2d')]=_[_0xe2da('0x2e')](_0x3e23d7[_0xe2da('0x2d')]);_0x36ca43[_0xe2da('0x2f')]=_['intersection'](_0x36ca43['model'],_0x36ca43[_0xe2da('0x2d')]);_0x36ca43[_0xe2da('0x2f')]=_[_0xe2da('0x30')](_0x36ca43[_0xe2da('0x2f')],[_0xe2da('0x31'),_0xe2da('0x32'),_0xe2da('0x33'),_0xe2da('0x34'),_0xe2da('0x35'),'$lte','$ne',_0xe2da('0x36'),_0xe2da('0x37'),_0xe2da('0x38'),_0xe2da('0x39'),_0xe2da('0x3a'),_0xe2da('0x3b'),_0xe2da('0x3c'),_0xe2da('0x3d'),_0xe2da('0x3e'),_0xe2da('0x3f'),_0xe2da('0x3c'),_0xe2da('0x40'),_0xe2da('0x41'),_0xe2da('0x42'),_0xe2da('0x43')]);_0x38ee5e[_0xe2da('0x44')]=_[_0xe2da('0x45')](_0x36ca43[_0xe2da('0x46')],qs['fields'](_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x47')]));_0x38ee5e[_0xe2da('0x44')]=_0x38ee5e['attributes'][_0xe2da('0x48')]?_0x38ee5e[_0xe2da('0x44')]:_0x36ca43[_0xe2da('0x46')];if(!_0x3e23d7['query']['hasOwnProperty'](_0xe2da('0x49'))){_0x38ee5e[_0xe2da('0x20')]=qs['limit'](_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x20')]);_0x38ee5e[_0xe2da('0x1f')]=qs[_0xe2da('0x1f')](_0x3e23d7[_0xe2da('0x2d')]['offset']);}_0x38ee5e[_0xe2da('0x4a')]=qs['sort'](_0x3e23d7['query'][_0xe2da('0x4b')]);_0x38ee5e['where']=qs[_0xe2da('0x2f')](_[_0xe2da('0x4c')](_0x3e23d7['query'],_0x36ca43[_0xe2da('0x2f')]));if(_0x3e23d7[_0xe2da('0x2d')]['filter']){_0x38ee5e['where']=_['merge'](_0x38ee5e[_0xe2da('0x4d')],{'$or':_[_0xe2da('0x4e')](_0x1b4aff,function(_0x26ba99){if(_0x26ba99[_0xe2da('0x4f')][_0xe2da('0x50')]!==_0xe2da('0x51')){var _0x14c30f={};_0x14c30f[_0x26ba99['field']]={'$like':'%'+_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x52')]+'%'};return _0x14c30f;}})});}_0x38ee5e=_[_0xe2da('0x53')]({},_0x38ee5e,_0x3e23d7[_0xe2da('0x54')]);var _0x44b12f={'where':_0x38ee5e['where']};return db[_0xe2da('0x2c')][_0xe2da('0x1e')](_0x44b12f)[_0xe2da('0x26')](function(_0x56d93c){_0x2b6c9e[_0xe2da('0x1e')]=_0x56d93c;if(_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x55')]){_0x38ee5e[_0xe2da('0x56')]=[{'all':!![]}];}return db[_0xe2da('0x2c')][_0xe2da('0x57')](_0x38ee5e);})[_0xe2da('0x26')](function(_0x29ec1a){_0x2b6c9e['rows']=_0x29ec1a;return _0x2b6c9e;})[_0xe2da('0x26')](respondWithFilteredResult(_0x1dc228,_0x38ee5e))[_0xe2da('0x58')](handleError(_0x1dc228,null));};exports[_0xe2da('0x59')]=function(_0x3f970c,_0x3457d0){var _0x4c9a54={'raw':!![],'where':{'id':_0x3f970c[_0xe2da('0x5a')]['id']}},_0x46b7fc={};_0x46b7fc[_0xe2da('0x46')]=_[_0xe2da('0x2e')](db[_0xe2da('0x2c')][_0xe2da('0x5b')]);_0x46b7fc[_0xe2da('0x2d')]=_['keys'](_0x3f970c[_0xe2da('0x2d')]);_0x46b7fc['filters']=_[_0xe2da('0x45')](_0x46b7fc[_0xe2da('0x46')],_0x46b7fc[_0xe2da('0x2d')]);_0x4c9a54['attributes']=_[_0xe2da('0x45')](_0x46b7fc[_0xe2da('0x46')],qs['fields'](_0x3f970c[_0xe2da('0x2d')][_0xe2da('0x47')]));_0x4c9a54[_0xe2da('0x44')]=_0x4c9a54['attributes'][_0xe2da('0x48')]?_0x4c9a54['attributes']:_0x46b7fc['model'];if(_0x3f970c[_0xe2da('0x2d')]['includeAll']){_0x4c9a54[_0xe2da('0x56')]=[{'all':!![]}];}_0x4c9a54=_[_0xe2da('0x53')]({},_0x4c9a54,_0x3f970c['options']);return db[_0xe2da('0x2c')][_0xe2da('0x5c')](_0x4c9a54)['then'](handleEntityNotFound(_0x3457d0,null))['then'](respondWithResult(_0x3457d0,null))[_0xe2da('0x58')](handleError(_0x3457d0,null));};exports['create']=function(_0x115a00,_0x448e06){return db[_0xe2da('0x2c')][_0xe2da('0x5d')](_0x115a00[_0xe2da('0x5e')],{})[_0xe2da('0x26')](respondWithResult(_0x448e06,0xc9))[_0xe2da('0x58')](handleError(_0x448e06,null));};exports[_0xe2da('0x25')]=function(_0x1d86a6,_0x515f9b){if(_0x1d86a6[_0xe2da('0x5e')]['id']){delete _0x1d86a6[_0xe2da('0x5e')]['id'];}return db[_0xe2da('0x2c')]['find']({'where':{'id':_0x1d86a6[_0xe2da('0x5a')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x515f9b,null))[_0xe2da('0x26')](saveUpdates(_0x1d86a6[_0xe2da('0x5e')],null))[_0xe2da('0x26')](respondWithResult(_0x515f9b,null))[_0xe2da('0x58')](handleError(_0x515f9b,null));};exports[_0xe2da('0x5f')]=function(_0x563d1f,_0x55170d){return db[_0xe2da('0x2c')][_0xe2da('0x5f')]()[_0xe2da('0x26')](respondWithResult(_0x55170d,null))['catch'](handleError(_0x55170d,null));};exports['destroy']=function(_0x41d2ca,_0x4a8dc9){var _0x46475d;return db[_0xe2da('0x2c')][_0xe2da('0x5c')]({'where':{'id':_0x41d2ca[_0xe2da('0x5a')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x4a8dc9,null))[_0xe2da('0x26')](function(_0x17be28){if(_0x17be28){return _0x17be28[_0xe2da('0x27')]()[_0xe2da('0x26')](function(_0x4aa686){return _0x4aa686;});}})[_0xe2da('0x26')](function(_0x2f763b){_0x46475d=_0x2f763b;if(_0x2f763b){if(_0x2f763b[_0xe2da('0x60')]||_0x2f763b[_0xe2da('0x61')]){return db[_0x2f763b['VoiceQueueId']?_0xe2da('0x62'):_0xe2da('0x63')][_0xe2da('0x5c')]({'where':{'id':_0x2f763b['VoiceQueueId']?_0x2f763b[_0xe2da('0x60')]:_0x2f763b[_0xe2da('0x61')]},'attributes':['id',_0xe2da('0x2a')],'raw':!![]});}}})[_0xe2da('0x26')](function(_0x188bb0){var _0x22a571={};if(_0x188bb0){_[_0xe2da('0x53')](_0x22a571,_[_0xe2da('0x64')](_0x46475d[_0xe2da('0x65')],[_0xe2da('0x66'),_0xe2da('0x67'),'id']));_0x22a571[_0xe2da('0x68')]=0x15;_0x22a571['statedesc']=_0xe2da('0x69');_0x22a571[_0xe2da('0x6a')]=_0x188bb0[_0xe2da('0x2a')];_0x22a571[_0xe2da('0x6b')]=_0x41d2ca[_0xe2da('0x6c')][_0xe2da('0x2a')];_0x22a571[_0xe2da('0x6d')]=_0x41d2ca['user']['id'];_0x22a571[_0xe2da('0x69')]=!![];_0x22a571['deletedat']=moment()[_0xe2da('0x6e')](_0xe2da('0x6f'));_0x22a571['calleridnum']=_0x46475d['phone'];_0x22a571[_0xe2da('0x70')]=_0x46475d['VoiceQueueId']?_0xe2da('0x71'):'ivr';return db[_0xe2da('0x72')][_0xe2da('0x5c')]({'where':{'id':_0x22a571[_0xe2da('0x73')]},'attributes':['firstName','lastName']})['then'](function(_0x3ef7c7){if(!_[_0xe2da('0x74')](_0x4a8dc9)&&!_[_0xe2da('0x74')](_0x3ef7c7[_0xe2da('0x75')])){_0x22a571['calleridname']=_0x3ef7c7[_0xe2da('0x75')];if(!_[_0xe2da('0x74')](_0x3ef7c7[_0xe2da('0x76')])){_0x22a571[_0xe2da('0x77')]+='\x20'+_0x3ef7c7[_0xe2da('0x76')];}}})[_0xe2da('0x78')](function(){return db[_0xe2da('0x79')]['create'](_0x22a571);});}})[_0xe2da('0x26')](function(){return _0x4a8dc9[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();})[_0xe2da('0x58')](handleError(_0x4a8dc9,null));};exports[_0xe2da('0x7a')]=function(_0x4cf58d,_0x841de3,_0x56c488){var _0x14f8e6=[];return db['CmContact'][_0xe2da('0x5f')]()['then'](function(_0x58f9db){_0x14f8e6=_[_0xe2da('0x2e')](_0x58f9db);return _0x4cf58d[_0xe2da('0x6c')][_0xe2da('0x7b')]({'where':{'type':_0xe2da('0x7c'),'dialActive':!![],'dialMethod':_0xe2da('0x7d')},'attributes':['id',_0xe2da('0x7e')],'raw':!![]});})[_0xe2da('0x26')](function(_0xa1a51d){if(_0xa1a51d&&_0xa1a51d[_0xe2da('0x48')]){return db[_0xe2da('0x7f')]['transaction'](function(_0x430a65){var _0x1474b7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe2da('0x6e')](_0xe2da('0x6f'))},'VoiceQueueId':{'$in':_['map'](_0xa1a51d,'id')},'$or':[{'UserId':null},{'UserId':_0x4cf58d[_0xe2da('0x6c')]['id']}]};var _0x9877c2=[];if(_0x4cf58d[_0xe2da('0x5e')][_0xe2da('0x80')]&&_0x4cf58d['body'][_0xe2da('0x80')]==='prev'){if(!_[_0xe2da('0x81')](_0x4cf58d[_0xe2da('0x5e')]['hopperIds'])){_0x1474b7['id']={'$in':_0x4cf58d[_0xe2da('0x5e')][_0xe2da('0x82')]};}_0x9877c2=[[_0xe2da('0x83'),_0xe2da('0x84')],[_0xe2da('0x85'),_0xa1a51d[0x0]['dialOrderByScheduledAt']===_0xe2da('0x84')?'DESC':'ASC'],db['sequelize']['literal'](_0xe2da('0x86')),['id',_0xe2da('0x87')]];}else{if(!_[_0xe2da('0x81')](_0x4cf58d[_0xe2da('0x5e')][_0xe2da('0x82')])){_0x1474b7['id']={'$notIn':_0x4cf58d[_0xe2da('0x5e')][_0xe2da('0x82')]};}_0x9877c2=[[_0xe2da('0x83'),_0xe2da('0x87')],['scheduledAt',_0xa1a51d[0x0][_0xe2da('0x7e')]],db[_0xe2da('0x7f')][_0xe2da('0x88')](_0xe2da('0x89')),['id',_0xe2da('0x84')]];}return db[_0xe2da('0x2c')][_0xe2da('0x8a')]({'attributes':['id',_0xe2da('0x8b')],'where':_0x1474b7,'order':_0x9877c2,'transaction':_0x430a65,'lock':_0x430a65[_0xe2da('0x8c')][_0xe2da('0x8d')],'include':[{'model':db['CmContact'],'as':_0xe2da('0x8e'),'attributes':_0x14f8e6,'include':[{'model':db[_0xe2da('0x8f')],'as':_0xe2da('0x90'),'attributes':['id',_0xe2da('0x2a')]}]},{'model':db[_0xe2da('0x91')],'as':_0xe2da('0x92'),'attributes':['id',_0xe2da('0x2a')]},{'model':db[_0xe2da('0x62')],'as':_0xe2da('0x93'),'attributes':['id',_0xe2da('0x2a'),_0xe2da('0x94')]}]})[_0xe2da('0x26')](function(_0x4c3e20){if(_0x4c3e20){return _0x4c3e20[_0xe2da('0x25')]({'UserId':_0x4cf58d['user']['id']},{'transaction':_0x430a65});}});});}})[_0xe2da('0x26')](handleEntityNotFound(_0x841de3,null))[_0xe2da('0x26')](respondWithResult(_0x841de3,null))[_0xe2da('0x58')](handleError(_0x841de3,null));};exports[_0xe2da('0x95')]=function(_0x44984b,_0x27cf4e,_0x252578){return _0x44984b['user'][_0xe2da('0x7b')]({'where':{'type':_0xe2da('0x7c'),'dialActive':!![],'dialMethod':_0xe2da('0x7d')},'attributes':['id'],'raw':!![]})[_0xe2da('0x26')](function(_0x273520){if(_0x273520&&_0x273520[_0xe2da('0x48')]){return db['CmHopper'][_0xe2da('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe2da('0x6e')](_0xe2da('0x6f'))},'VoiceQueueId':{'$in':_[_0xe2da('0x4e')](_0x273520,'id')},'$or':[{'UserId':null},{'UserId':_0x44984b[_0xe2da('0x6c')]['id']}]}});}return 0x0;})[_0xe2da('0x26')](function(_0x43e447){if(!_['isNil'](_0x43e447)&&_[_0xe2da('0x96')](_0x43e447)){return _0x27cf4e[_0xe2da('0x1c')](0xc8)[_0xe2da('0x23')]({'contacts':_0x43e447});}else{logger[_0xe2da('0x28')](_0xe2da('0x97'),_0xe2da('0x95'),0x194,'entity\x20not\x20found');_0x27cf4e[_0xe2da('0x1b')](0x194);}})['catch'](handleError(_0x27cf4e,null));}; \ No newline at end of file +var _0xbd50=['end','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','CmHopper','rawAttributes','model','keys','query','filters','intersection','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','count','include','show','length','includeAll','find','catch','create','body','describe','params','CampaignId','VoiceQueueId','VoiceQueue','omit','createdAt','updatedAt','state','statedesc','campaign','membername','user','deletedat','calleridnum','campaigntype','queue','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','update','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1b25ad,_0x2d1244){var _0x391784=function(_0x23c830){while(--_0x23c830){_0x1b25ad['push'](_0x1b25ad['shift']());}};_0x391784(++_0x2d1244);}(_0xbd50,0x196));var _0x0bd5=function(_0x3cb786,_0x10e575){_0x3cb786=_0x3cb786-0x0;var _0x197d49=_0xbd50[_0x3cb786];return _0x197d49;};'use strict';var pdf=require(_0x0bd5('0x0'));var emlformat=require(_0x0bd5('0x1'));var rimraf=require(_0x0bd5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bd5('0x3'));var rp=require(_0x0bd5('0x4'));var moment=require(_0x0bd5('0x5'));var BPromise=require(_0x0bd5('0x6'));var Mustache=require(_0x0bd5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bd5('0x8'));var ejs=require(_0x0bd5('0x9'));var fs=require('fs');var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0x8'));var querystring=require(_0x0bd5('0xd'));var Papa=require(_0x0bd5('0xe'));var Redis=require('ioredis');var authService=require(_0x0bd5('0xf'));var qs=require(_0x0bd5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bd5('0x11'))(_0x0bd5('0x12'));var utils=require('../../config/utils');var config=require(_0x0bd5('0x13'));var db=require(_0x0bd5('0x14'))['db'];function respondWithStatusCode(_0x1aa818,_0x5f49ee){_0x5f49ee=_0x5f49ee||0xcc;return function(_0x2f7a0c){if(_0x2f7a0c){return _0x1aa818[_0x0bd5('0x15')](_0x5f49ee);}return _0x1aa818[_0x0bd5('0x16')](_0x5f49ee)[_0x0bd5('0x17')]();};}function respondWithResult(_0xfa1eed,_0x557be0){_0x557be0=_0x557be0||0xc8;return function(_0x30765e){if(_0x30765e){return _0xfa1eed[_0x0bd5('0x16')](_0x557be0)['json'](_0x30765e);}};}function respondWithFilteredResult(_0x78f9b8,_0x325e43){return function(_0x574315){if(_0x574315){var _0x31349f=_0x574315['count'],_0x23ef4e=_0x325e43[_0x0bd5('0x18')],_0x3a34e4=_0x325e43[_0x0bd5('0x18')]+_0x325e43[_0x0bd5('0x19')],_0xc22553;if(_0x3a34e4>=_0x31349f){_0x3a34e4=_0x31349f;_0xc22553=0xc8;}else{_0xc22553=0xce;}_0x78f9b8[_0x0bd5('0x16')](_0xc22553);return _0x78f9b8[_0x0bd5('0x1a')](_0x0bd5('0x1b'),_0x23ef4e+'-'+_0x3a34e4+'/'+_0x31349f)[_0x0bd5('0x1c')](_0x574315);}return null;};}function patchUpdates(_0x19fe20){return function(_0x29fa4c){try{jsonpatch[_0x0bd5('0x1d')](_0x29fa4c,_0x19fe20,!![]);}catch(_0x27bc1e){return BPromise[_0x0bd5('0x1e')](_0x27bc1e);}return _0x29fa4c[_0x0bd5('0x1f')]();};}function saveUpdates(_0x2dc1e5,_0x527c37){return function(_0x5ba943){if(_0x5ba943){return _0x5ba943['update'](_0x2dc1e5)['then'](function(_0x47d74a){return _0x47d74a;});}return null;};}function removeEntity(_0x6c06bd,_0x86381d){return function(_0x13ce46){if(_0x13ce46){return _0x13ce46[_0x0bd5('0x20')]()[_0x0bd5('0x21')](function(){_0x6c06bd['status'](0xcc)[_0x0bd5('0x17')]();});}};}function handleEntityNotFound(_0x3b235b,_0x38c21d){return function(_0x5a8139){if(!_0x5a8139){_0x3b235b[_0x0bd5('0x15')](0x194);}return _0x5a8139;};}function handleError(_0x4a8787,_0x4969e6){_0x4969e6=_0x4969e6||0x1f4;return function(_0x14c319){logger[_0x0bd5('0x22')](_0x14c319[_0x0bd5('0x23')]);if(_0x14c319['name']){delete _0x14c319[_0x0bd5('0x24')];}_0x4a8787['status'](_0x4969e6)[_0x0bd5('0x25')](_0x14c319);};}exports[_0x0bd5('0x26')]=function(_0x18cec3,_0x2b6b53){var _0x3ff237={},_0x2023d5={},_0x19bb5e={'count':0x0,'rows':[]};var _0x2f01ff=db[_0x0bd5('0x27')][_0x0bd5('0x28')];_0x2023d5[_0x0bd5('0x29')]=_[_0x0bd5('0x2a')](_0x2f01ff);_0x2023d5[_0x0bd5('0x2b')]=_[_0x0bd5('0x2a')](_0x18cec3['query']);_0x2023d5[_0x0bd5('0x2c')]=_[_0x0bd5('0x2d')](_0x2023d5['model'],_0x2023d5[_0x0bd5('0x2b')]);_0x2023d5[_0x0bd5('0x2c')]=_['concat'](_0x2023d5[_0x0bd5('0x2c')],[_0x0bd5('0x2e'),_0x0bd5('0x2f'),_0x0bd5('0x30'),'$gte',_0x0bd5('0x31'),_0x0bd5('0x32'),_0x0bd5('0x33'),_0x0bd5('0x34'),_0x0bd5('0x35'),_0x0bd5('0x36'),'$notBetween',_0x0bd5('0x37'),'$notIn',_0x0bd5('0x38'),_0x0bd5('0x39'),_0x0bd5('0x3a'),_0x0bd5('0x3b'),_0x0bd5('0x38'),_0x0bd5('0x3c'),_0x0bd5('0x3d'),_0x0bd5('0x3e'),_0x0bd5('0x3f')]);_0x3ff237[_0x0bd5('0x40')]=_[_0x0bd5('0x2d')](_0x2023d5[_0x0bd5('0x29')],qs[_0x0bd5('0x41')](_0x18cec3['query'][_0x0bd5('0x41')]));_0x3ff237[_0x0bd5('0x40')]=_0x3ff237['attributes']['length']?_0x3ff237[_0x0bd5('0x40')]:_0x2023d5[_0x0bd5('0x29')];if(!_0x18cec3[_0x0bd5('0x2b')][_0x0bd5('0x42')](_0x0bd5('0x43'))){_0x3ff237[_0x0bd5('0x19')]=qs[_0x0bd5('0x19')](_0x18cec3[_0x0bd5('0x2b')][_0x0bd5('0x19')]);_0x3ff237[_0x0bd5('0x18')]=qs[_0x0bd5('0x18')](_0x18cec3[_0x0bd5('0x2b')][_0x0bd5('0x18')]);}_0x3ff237['order']=qs[_0x0bd5('0x44')](_0x18cec3['query'][_0x0bd5('0x44')]);_0x3ff237[_0x0bd5('0x45')]=qs[_0x0bd5('0x2c')](_[_0x0bd5('0x46')](_0x18cec3[_0x0bd5('0x2b')],_0x2023d5[_0x0bd5('0x2c')]));if(_0x18cec3['query'][_0x0bd5('0x47')]){_0x3ff237[_0x0bd5('0x45')]=_[_0x0bd5('0x48')](_0x3ff237[_0x0bd5('0x45')],{'$or':_[_0x0bd5('0x49')](_0x2f01ff,function(_0x493089){if(_0x493089[_0x0bd5('0x4a')][_0x0bd5('0x4b')]!==_0x0bd5('0x4c')){var _0x56ea34={};_0x56ea34[_0x493089[_0x0bd5('0x4d')]]={'$like':'%'+_0x18cec3['query'][_0x0bd5('0x47')]+'%'};return _0x56ea34;}})});}_0x3ff237=_[_0x0bd5('0x48')]({},_0x3ff237,_0x18cec3['options']);var _0x32eb58={'where':_0x3ff237[_0x0bd5('0x45')]};return db[_0x0bd5('0x27')][_0x0bd5('0x4e')](_0x32eb58)[_0x0bd5('0x21')](function(_0x1a8d55){_0x19bb5e[_0x0bd5('0x4e')]=_0x1a8d55;if(_0x18cec3['query']['includeAll']){_0x3ff237[_0x0bd5('0x4f')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3ff237);})[_0x0bd5('0x21')](function(_0x3c6f2b){_0x19bb5e['rows']=_0x3c6f2b;return _0x19bb5e;})['then'](respondWithFilteredResult(_0x2b6b53,_0x3ff237))['catch'](handleError(_0x2b6b53,null));};exports[_0x0bd5('0x50')]=function(_0x561a38,_0x4cb57a){var _0x28d252={'raw':!![],'where':{'id':_0x561a38['params']['id']}},_0x110210={};_0x110210['model']=_[_0x0bd5('0x2a')](db[_0x0bd5('0x27')][_0x0bd5('0x28')]);_0x110210[_0x0bd5('0x2b')]=_['keys'](_0x561a38[_0x0bd5('0x2b')]);_0x110210[_0x0bd5('0x2c')]=_[_0x0bd5('0x2d')](_0x110210[_0x0bd5('0x29')],_0x110210[_0x0bd5('0x2b')]);_0x28d252[_0x0bd5('0x40')]=_['intersection'](_0x110210[_0x0bd5('0x29')],qs[_0x0bd5('0x41')](_0x561a38[_0x0bd5('0x2b')]['fields']));_0x28d252[_0x0bd5('0x40')]=_0x28d252[_0x0bd5('0x40')][_0x0bd5('0x51')]?_0x28d252['attributes']:_0x110210[_0x0bd5('0x29')];if(_0x561a38[_0x0bd5('0x2b')][_0x0bd5('0x52')]){_0x28d252[_0x0bd5('0x4f')]=[{'all':!![]}];}_0x28d252=_[_0x0bd5('0x48')]({},_0x28d252,_0x561a38['options']);return db[_0x0bd5('0x27')][_0x0bd5('0x53')](_0x28d252)['then'](handleEntityNotFound(_0x4cb57a,null))[_0x0bd5('0x21')](respondWithResult(_0x4cb57a,null))[_0x0bd5('0x54')](handleError(_0x4cb57a,null));};exports[_0x0bd5('0x55')]=function(_0x19c35e,_0x2dbfe4){return db['CmHopper'][_0x0bd5('0x55')](_0x19c35e[_0x0bd5('0x56')],{})['then'](respondWithResult(_0x2dbfe4,0xc9))[_0x0bd5('0x54')](handleError(_0x2dbfe4,null));};exports['update']=function(_0x3c3e9b,_0x14b74b){if(_0x3c3e9b[_0x0bd5('0x56')]['id']){delete _0x3c3e9b[_0x0bd5('0x56')]['id'];}return db['CmHopper'][_0x0bd5('0x53')]({'where':{'id':_0x3c3e9b['params']['id']}})['then'](handleEntityNotFound(_0x14b74b,null))[_0x0bd5('0x21')](saveUpdates(_0x3c3e9b[_0x0bd5('0x56')],null))[_0x0bd5('0x21')](respondWithResult(_0x14b74b,null))['catch'](handleError(_0x14b74b,null));};exports[_0x0bd5('0x57')]=function(_0x5945cb,_0x9a4fdb){return db[_0x0bd5('0x27')][_0x0bd5('0x57')]()['then'](respondWithResult(_0x9a4fdb,null))['catch'](handleError(_0x9a4fdb,null));};exports['destroy']=function(_0x122f84,_0x21db5d){var _0x2aff3b;return db['CmHopper'][_0x0bd5('0x53')]({'where':{'id':_0x122f84[_0x0bd5('0x58')]['id']}})['then'](handleEntityNotFound(_0x21db5d,null))[_0x0bd5('0x21')](function(_0x5ba473){if(_0x5ba473){return _0x5ba473['destroy']()[_0x0bd5('0x21')](function(_0x1e5b5e){return _0x1e5b5e;});}})[_0x0bd5('0x21')](function(_0xb09083){_0x2aff3b=_0xb09083;if(_0xb09083){if(_0xb09083['VoiceQueueId']||_0xb09083[_0x0bd5('0x59')]){return db[_0xb09083[_0x0bd5('0x5a')]?_0x0bd5('0x5b'):'Campaign'][_0x0bd5('0x53')]({'where':{'id':_0xb09083[_0x0bd5('0x5a')]?_0xb09083[_0x0bd5('0x5a')]:_0xb09083['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x0bd5('0x21')](function(_0x5dd498){var _0x3e20e9={};if(_0x5dd498){_[_0x0bd5('0x48')](_0x3e20e9,_[_0x0bd5('0x5c')](_0x2aff3b['dataValues'],[_0x0bd5('0x5d'),_0x0bd5('0x5e'),'id']));_0x3e20e9[_0x0bd5('0x5f')]=0x15;_0x3e20e9[_0x0bd5('0x60')]='deleted';_0x3e20e9[_0x0bd5('0x61')]=_0x5dd498[_0x0bd5('0x24')];_0x3e20e9[_0x0bd5('0x62')]=_0x122f84[_0x0bd5('0x63')][_0x0bd5('0x24')];_0x3e20e9['UserId']=_0x122f84[_0x0bd5('0x63')]['id'];_0x3e20e9['deleted']=!![];_0x3e20e9[_0x0bd5('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3e20e9[_0x0bd5('0x65')]=_0x2aff3b['phone'];_0x3e20e9[_0x0bd5('0x66')]=_0x2aff3b[_0x0bd5('0x5a')]?_0x0bd5('0x67'):'ivr';return db[_0x0bd5('0x68')][_0x0bd5('0x53')]({'where':{'id':_0x3e20e9['ContactId']},'attributes':[_0x0bd5('0x69'),_0x0bd5('0x6a')]})['then'](function(_0x460ebb){if(!_['isNil'](_0x21db5d)&&!_[_0x0bd5('0x6b')](_0x460ebb[_0x0bd5('0x69')])){_0x3e20e9[_0x0bd5('0x6c')]=_0x460ebb[_0x0bd5('0x69')];if(!_[_0x0bd5('0x6b')](_0x460ebb[_0x0bd5('0x6a')])){_0x3e20e9[_0x0bd5('0x6c')]+='\x20'+_0x460ebb['lastName'];}}})[_0x0bd5('0x6d')](function(){return db[_0x0bd5('0x6e')][_0x0bd5('0x55')](_0x3e20e9);});}})['then'](function(){return _0x21db5d['status'](0xcc)[_0x0bd5('0x17')]();})[_0x0bd5('0x54')](handleError(_0x21db5d,null));};exports[_0x0bd5('0x6f')]=function(_0x42dc72,_0x340f9a,_0x43b330){var _0x1db7f2=[];return db[_0x0bd5('0x68')][_0x0bd5('0x57')]()[_0x0bd5('0x21')](function(_0x11c266){_0x1db7f2=_[_0x0bd5('0x2a')](_0x11c266);return _0x42dc72[_0x0bd5('0x63')][_0x0bd5('0x70')]({'where':{'type':_0x0bd5('0x71'),'dialActive':!![],'dialMethod':_0x0bd5('0x72')},'attributes':['id',_0x0bd5('0x73')],'raw':!![]});})[_0x0bd5('0x21')](function(_0x56aa05){if(_0x56aa05&&_0x56aa05[_0x0bd5('0x51')]){return db[_0x0bd5('0x74')]['transaction'](function(_0x7cc5b0){var _0x51b486={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0bd5('0x75')](_0x0bd5('0x76'))},'VoiceQueueId':{'$in':_['map'](_0x56aa05,'id')},'$or':[{'UserId':null},{'UserId':_0x42dc72[_0x0bd5('0x63')]['id']}]};var _0x309aeb=[];if(_0x42dc72[_0x0bd5('0x56')][_0x0bd5('0x77')]&&_0x42dc72[_0x0bd5('0x56')][_0x0bd5('0x77')]===_0x0bd5('0x78')){if(!_[_0x0bd5('0x79')](_0x42dc72[_0x0bd5('0x56')]['hopperIds'])){_0x51b486['id']={'$in':_0x42dc72[_0x0bd5('0x56')][_0x0bd5('0x7a')]};}_0x309aeb=[['priority',_0x0bd5('0x7b')],[_0x0bd5('0x7c'),_0x56aa05[0x0]['dialOrderByScheduledAt']===_0x0bd5('0x7b')?_0x0bd5('0x7d'):'ASC'],db[_0x0bd5('0x74')]['literal'](_0x0bd5('0x7e')),['id',_0x0bd5('0x7d')]];}else{if(!_[_0x0bd5('0x79')](_0x42dc72[_0x0bd5('0x56')][_0x0bd5('0x7a')])){_0x51b486['id']={'$notIn':_0x42dc72[_0x0bd5('0x56')][_0x0bd5('0x7a')]};}_0x309aeb=[[_0x0bd5('0x7f'),_0x0bd5('0x7d')],[_0x0bd5('0x7c'),_0x56aa05[0x0][_0x0bd5('0x73')]],db[_0x0bd5('0x74')][_0x0bd5('0x80')](_0x0bd5('0x81')),['id','ASC']];}return db[_0x0bd5('0x27')][_0x0bd5('0x82')]({'attributes':['id',_0x0bd5('0x83')],'where':_0x51b486,'order':_0x309aeb,'transaction':_0x7cc5b0,'lock':_0x7cc5b0[_0x0bd5('0x84')][_0x0bd5('0x85')],'include':[{'model':db[_0x0bd5('0x68')],'as':'Contact','attributes':_0x1db7f2,'include':[{'model':db[_0x0bd5('0x86')],'as':_0x0bd5('0x87'),'attributes':['id',_0x0bd5('0x24')]}]},{'model':db[_0x0bd5('0x88')],'as':_0x0bd5('0x89'),'attributes':['id',_0x0bd5('0x24')]},{'model':db[_0x0bd5('0x5b')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x0bd5('0x21')](function(_0x343658){if(_0x343658){return _0x343658[_0x0bd5('0x8a')]({'UserId':_0x42dc72[_0x0bd5('0x63')]['id']},{'transaction':_0x7cc5b0});}});});}})[_0x0bd5('0x21')](handleEntityNotFound(_0x340f9a,null))['then'](respondWithResult(_0x340f9a,null))[_0x0bd5('0x54')](handleError(_0x340f9a,null));};exports[_0x0bd5('0x8b')]=function(_0x592438,_0x46edf6,_0x935f1c){return _0x592438[_0x0bd5('0x63')][_0x0bd5('0x70')]({'where':{'type':_0x0bd5('0x71'),'dialActive':!![],'dialMethod':_0x0bd5('0x72')},'attributes':['id'],'raw':!![]})[_0x0bd5('0x21')](function(_0x2d5a19){if(_0x2d5a19&&_0x2d5a19[_0x0bd5('0x51')]){return db[_0x0bd5('0x27')][_0x0bd5('0x4e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x0bd5('0x76'))},'VoiceQueueId':{'$in':_[_0x0bd5('0x49')](_0x2d5a19,'id')},'$or':[{'UserId':null},{'UserId':_0x592438[_0x0bd5('0x63')]['id']}]}});}return 0x0;})[_0x0bd5('0x21')](function(_0x29c164){if(!_['isNil'](_0x29c164)&&_[_0x0bd5('0x8c')](_0x29c164)){return _0x46edf6[_0x0bd5('0x16')](0xc8)[_0x0bd5('0x1c')]({'contacts':_0x29c164});}else{logger[_0x0bd5('0x22')](_0x0bd5('0x8d'),_0x0bd5('0x8b'),0x194,_0x0bd5('0x8e'));_0x46edf6[_0x0bd5('0x15')](0x194);}})[_0x0bd5('0x54')](handleError(_0x46edf6,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a209609..8d7f943 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 _0x0565=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','scheduledat'];(function(_0x567b58,_0x26dce7){var _0x517454=function(_0x3c8cd5){while(--_0x3c8cd5){_0x567b58['push'](_0x567b58['shift']());}};_0x517454(++_0x26dce7);}(_0x0565,0xf2));var _0x5056=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x0565[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var moment=require(_0x5056('0x4'));var BPromise=require(_0x5056('0x5'));var rp=require(_0x5056('0x6'));var fs=require('fs');var path=require(_0x5056('0x7'));var rimraf=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var attributes=require('./cmHopper.attributes');module[_0x5056('0xa')]=function(_0x105ea8,_0x1143df){return _0x105ea8[_0x5056('0xb')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x5056('0xc'),'fields':[_0x5056('0xc')]},{'name':_0x5056('0xd'),'fields':[_0x5056('0xd')]},{'name':_0x5056('0xe'),'fields':[_0x5056('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['request-promise','path','rimraf','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','bluebird'];(function(_0x4cd763,_0x968afa){var _0x17ea83=function(_0x4f7219){while(--_0x4f7219){_0x4cd763['push'](_0x4cd763['shift']());}};_0x17ea83(++_0x968afa);}(_0xa74f,0x9a));var _0xfa74=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xa74f[_0x4695ba];return _0x524b7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[{'name':_0xfa74('0x9'),'fields':[_0xfa74('0x9')]},{'name':'phone','fields':[_0xfa74('0xa')]},{'name':_0xfa74('0xb'),'fields':[_0xfa74('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f5a6bba..f7e3373 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 _0x2e2e=['debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CmHopper','findAll','options','where','attributes','limit','include','map','model','GetCmHopper','catch','raw','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','length','push','all','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','UserId','UPDATE','GetContactRecallMe','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s'];(function(_0x216afe,_0x2b4df0){var _0x17c01b=function(_0x6b4f31){while(--_0x6b4f31){_0x216afe['push'](_0x216afe['shift']());}};_0x17c01b(++_0x2b4df0);}(_0x2e2e,0x1b8));var _0xe2e2=function(_0x11f9fd,_0x144a30){_0x11f9fd=_0x11f9fd-0x0;var _0x1eb37b=_0x2e2e[_0x11f9fd];return _0x1eb37b;};'use strict';var _=require(_0xe2e2('0x0'));var util=require(_0xe2e2('0x1'));var moment=require(_0xe2e2('0x2'));var BPromise=require(_0xe2e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2e2('0x4'));var db=require(_0xe2e2('0x5'))['db'];var utils=require(_0xe2e2('0x6'));var logger=require(_0xe2e2('0x7'))('rpc');var config=require(_0xe2e2('0x8'));var jayson=require(_0xe2e2('0x9'));var client=jayson[_0xe2e2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e1bf3,_0x26cdd8,_0x4ad584){return new BPromise(function(_0xde2a2a,_0x1927d0){return client[_0xe2e2('0xb')](_0x5e1bf3,_0x4ad584)[_0xe2e2('0xc')](function(_0xd4680c){logger[_0xe2e2('0xd')](_0xe2e2('0xe'),_0x26cdd8,'request\x20sent');logger[_0xe2e2('0xf')](_0xe2e2('0x10'),_0x26cdd8,_0xe2e2('0x11'),JSON[_0xe2e2('0x12')](_0xd4680c));if(_0xd4680c['error']){if(_0xd4680c['error']['code']===0x1f4){logger[_0xe2e2('0x13')]('CmHopper,\x20%s,\x20%s',_0x26cdd8,_0xd4680c[_0xe2e2('0x13')][_0xe2e2('0x14')]);return _0x1927d0(_0xd4680c[_0xe2e2('0x13')][_0xe2e2('0x14')]);}logger[_0xe2e2('0x13')](_0xe2e2('0xe'),_0x26cdd8,_0xd4680c['error'][_0xe2e2('0x14')]);return _0xde2a2a(_0xd4680c['error'][_0xe2e2('0x14')]);}else{logger[_0xe2e2('0xd')]('CmHopper,\x20%s,\x20%s',_0x26cdd8,'request\x20sent');_0xde2a2a(_0xd4680c[_0xe2e2('0x15')][_0xe2e2('0x14')]);}})['catch'](function(_0x45cf0a){logger[_0xe2e2('0x13')](_0xe2e2('0xe'),_0x26cdd8,_0x45cf0a);_0x1927d0(_0x45cf0a);});});}exports['GetCmHopper']=function(_0x38687){var _0x3ff94b=this;return new Promise(function(_0x43e4d5,_0x28934e){return db[_0xe2e2('0x16')][_0xe2e2('0x17')]({'raw':_0x38687[_0xe2e2('0x18')]?_0x38687[_0xe2e2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38687[_0xe2e2('0x18')]?_0x38687['options'][_0xe2e2('0x19')]||null:null,'attributes':_0x38687[_0xe2e2('0x18')]?_0x38687[_0xe2e2('0x18')][_0xe2e2('0x1a')]||null:null,'limit':_0x38687['options']?_0x38687[_0xe2e2('0x18')][_0xe2e2('0x1b')]||null:null,'include':_0x38687[_0xe2e2('0x18')]?_0x38687['options'][_0xe2e2('0x1c')]?_[_0xe2e2('0x1d')](_0x38687[_0xe2e2('0x18')][_0xe2e2('0x1c')],function(_0x197f01){return{'model':db[_0x197f01[_0xe2e2('0x1e')]],'as':_0x197f01['as'],'attributes':_0x197f01[_0xe2e2('0x1a')],'include':_0x197f01['include']?_[_0xe2e2('0x1d')](_0x197f01[_0xe2e2('0x1c')],function(_0x5aaf6b){return{'model':db[_0x5aaf6b['model']],'as':_0x5aaf6b['as'],'attributes':_0x5aaf6b[_0xe2e2('0x1a')],'include':_0x5aaf6b[_0xe2e2('0x1c')]?_['map'](_0x5aaf6b[_0xe2e2('0x1c')],function(_0x25ccd2){return{'model':db[_0x25ccd2[_0xe2e2('0x1e')]],'as':_0x25ccd2['as'],'attributes':_0x25ccd2[_0xe2e2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe2e2('0xc')](function(_0xd29f90){logger[_0xe2e2('0xd')](_0xe2e2('0x1f'),_0x38687);logger[_0xe2e2('0xf')](_0xe2e2('0x1f'),_0x38687,JSON[_0xe2e2('0x12')](_0xd29f90));_0x43e4d5(_0xd29f90);})[_0xe2e2('0x20')](function(_0xb0282d){logger[_0xe2e2('0x13')]('GetCmHopper',_0xb0282d[_0xe2e2('0x14')],_0x38687);_0x28934e(_0x3ff94b[_0xe2e2('0x13')](0x1f4,_0xb0282d['message']));});});};exports['ShowCmHopper']=function(_0x2f54d6){var _0x241fb7=this;return new Promise(function(_0xa9903a,_0x474fdf){return db[_0xe2e2('0x16')]['find']({'raw':_0x2f54d6[_0xe2e2('0x18')]?_0x2f54d6[_0xe2e2('0x18')][_0xe2e2('0x21')]===undefined?!![]:![]:!![],'where':_0x2f54d6['options']?_0x2f54d6['options']['where']||null:null,'attributes':_0x2f54d6['options']?_0x2f54d6['options']['attributes']||null:null,'include':_0x2f54d6[_0xe2e2('0x18')]?_0x2f54d6[_0xe2e2('0x18')]['include']?_[_0xe2e2('0x1d')](_0x2f54d6[_0xe2e2('0x18')][_0xe2e2('0x1c')],function(_0x3bfd12){return{'model':db[_0x3bfd12[_0xe2e2('0x1e')]],'as':_0x3bfd12['as'],'attributes':_0x3bfd12[_0xe2e2('0x1a')],'include':_0x3bfd12['include']?_[_0xe2e2('0x1d')](_0x3bfd12[_0xe2e2('0x1c')],function(_0x43e414){return{'model':db[_0x43e414['model']],'as':_0x43e414['as'],'attributes':_0x43e414[_0xe2e2('0x1a')],'include':_0x43e414[_0xe2e2('0x1c')]?_[_0xe2e2('0x1d')](_0x43e414[_0xe2e2('0x1c')],function(_0x1d9681){return{'model':db[_0x1d9681[_0xe2e2('0x1e')]],'as':_0x1d9681['as'],'attributes':_0x1d9681['attributes']};}):[]};}):[]};}):[]:[]})[_0xe2e2('0xc')](function(_0x2661ac){logger[_0xe2e2('0xd')]('ShowCmHopper',_0x2f54d6);logger[_0xe2e2('0xf')](_0xe2e2('0x22'),_0x2f54d6,JSON[_0xe2e2('0x12')](_0x2661ac));_0xa9903a(_0x2661ac);})[_0xe2e2('0x20')](function(_0x40f993){logger[_0xe2e2('0x13')](_0xe2e2('0x22'),_0x40f993[_0xe2e2('0x14')],_0x2f54d6);_0x474fdf(_0x241fb7['error'](0x1f4,_0x40f993['message']));});});};exports[_0xe2e2('0x23')]=function(_0x4d9093){var _0x1b8d56=this;return new Promise(function(_0x37c798,_0x4b671c){return db['CmHopper'][_0xe2e2('0x24')](_0x4d9093[_0xe2e2('0x25')],{'raw':_0x4d9093[_0xe2e2('0x18')]?_0x4d9093[_0xe2e2('0x18')][_0xe2e2('0x21')]===undefined?!![]:![]:!![]})[_0xe2e2('0xc')](function(_0x3d207b){logger[_0xe2e2('0xd')](_0xe2e2('0x23'),_0x4d9093);logger['debug'](_0xe2e2('0x23'),_0x4d9093,JSON[_0xe2e2('0x12')](_0x3d207b));_0x37c798(_0x3d207b);})[_0xe2e2('0x20')](function(_0x280604){logger[_0xe2e2('0x13')](_0xe2e2('0x23'),_0x280604[_0xe2e2('0x14')],_0x4d9093);_0x4b671c(_0x1b8d56[_0xe2e2('0x13')](0x1f4,_0x280604[_0xe2e2('0x14')]));});});};exports[_0xe2e2('0x26')]=function(_0x55f4fa){var _0x6a8c81=this;return new Promise(function(_0x29bafc,_0x598b82){return db[_0xe2e2('0x16')][_0xe2e2('0x27')](_0x55f4fa[_0xe2e2('0x25')],{'raw':_0x55f4fa[_0xe2e2('0x18')]?_0x55f4fa[_0xe2e2('0x18')][_0xe2e2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55f4fa[_0xe2e2('0x18')]?_0x55f4fa['options'][_0xe2e2('0x19')]||null:null,'attributes':_0x55f4fa[_0xe2e2('0x18')]?_0x55f4fa[_0xe2e2('0x18')]['attributes']||null:null,'limit':_0x55f4fa[_0xe2e2('0x18')]?_0x55f4fa[_0xe2e2('0x18')][_0xe2e2('0x1b')]||null:null})[_0xe2e2('0xc')](function(_0x4f0bf1){logger[_0xe2e2('0xd')](_0xe2e2('0x26'),_0x55f4fa);logger[_0xe2e2('0xf')](_0xe2e2('0x26'),_0x55f4fa,JSON['stringify'](_0x4f0bf1));_0x29bafc(_0x4f0bf1);})[_0xe2e2('0x20')](function(_0x38ac55){logger['error']('UpdateCmHopper',_0x38ac55[_0xe2e2('0x14')],_0x55f4fa);_0x598b82(_0x6a8c81['error'](0x1f4,_0x38ac55[_0xe2e2('0x14')]));});});};exports[_0xe2e2('0x28')]=function(_0x1501aa){var _0x4de6db=this;return new Promise(function(_0x45b8b4,_0x43dee8){return db[_0xe2e2('0x16')][_0xe2e2('0x29')]({'where':_0x1501aa[_0xe2e2('0x18')]?_0x1501aa[_0xe2e2('0x18')][_0xe2e2('0x19')]||null:null})[_0xe2e2('0xc')](function(_0x5d5b31){logger[_0xe2e2('0xd')](_0xe2e2('0x28'),_0x1501aa);logger[_0xe2e2('0xf')](_0xe2e2('0x28'),_0x1501aa,JSON[_0xe2e2('0x12')](_0x5d5b31));_0x45b8b4(_0x5d5b31);})[_0xe2e2('0x20')](function(_0x243cd5){logger[_0xe2e2('0x13')](_0xe2e2('0x28'),_0x243cd5[_0xe2e2('0x14')],_0x1501aa);_0x43dee8(_0x4de6db[_0xe2e2('0x13')](0x1f4,_0x243cd5[_0xe2e2('0x14')]));});});};exports[_0xe2e2('0x2a')]=function(_0x14100f){var _0x56a734=this;return new Promise(function(_0x5167af,_0x43ec39){return db[_0xe2e2('0x2b')][_0xe2e2('0x2c')]()['then'](function(_0x262ec8){return db[_0xe2e2('0x2d')][_0xe2e2('0x2e')](function(_0x1af938){return db[_0xe2e2('0x16')][_0xe2e2('0x17')]({'where':_0x14100f[_0xe2e2('0x18')]?_0x14100f['options'][_0xe2e2('0x19')]||null:null,'attributes':_0x14100f[_0xe2e2('0x18')]?_0x14100f[_0xe2e2('0x18')]['attributes']||null:null,'limit':_0x14100f[_0xe2e2('0x18')]?_0x14100f[_0xe2e2('0x18')][_0xe2e2('0x1b')]||null:null,'order':_0x14100f[_0xe2e2('0x18')]?_0x14100f[_0xe2e2('0x18')][_0xe2e2('0x2f')]||null:null,'transaction':_0x1af938,'lock':_0x1af938[_0xe2e2('0x30')]['UPDATE'],'include':[{'model':db[_0xe2e2('0x2b')],'as':_0xe2e2('0x31'),'attributes':_[_0xe2e2('0x32')](_0x262ec8)}]})['then'](function(_0x52b74c){var _0x185d6f=[];for(var _0x41693f=0x0;_0x41693f<_0x52b74c[_0xe2e2('0x33')];_0x41693f+=0x1){_0x185d6f[_0xe2e2('0x34')](_0x52b74c[_0x41693f][_0xe2e2('0x27')](_0x14100f[_0xe2e2('0x25')],{'transaction':_0x1af938}));}return BPromise[_0xe2e2('0x35')](_0x185d6f);});})[_0xe2e2('0xc')](function(_0x333bd7){logger[_0xe2e2('0xd')](_0xe2e2('0x2a'),_0x14100f);logger[_0xe2e2('0xf')](_0xe2e2('0x2a'),_0x14100f,JSON[_0xe2e2('0x12')](_0x333bd7));_0x5167af(_0x333bd7);})[_0xe2e2('0x20')](function(_0x587900){logger[_0xe2e2('0x13')](_0xe2e2('0x2a'),_0x587900[_0xe2e2('0x14')],_0x14100f);_0x43ec39(_0x56a734[_0xe2e2('0x13')](0x1f4,_0x587900['message']));});});});};exports['MoveContactManagedDialer']=function(_0x350624){var _0x4ad72a=this;return new Promise(function(_0x19fec2,_0x6eba7){return db[_0xe2e2('0x2d')]['transaction'](function(_0x31cb66){return db[_0xe2e2('0x36')]['create'](_0x350624['body'],{'raw':_0x350624[_0xe2e2('0x18')]?_0x350624[_0xe2e2('0x18')][_0xe2e2('0x21')]===undefined?!![]:![]:!![],'transaction':_0x31cb66})['then'](function(){return db['CmHopper']['destroy']({'where':_0x350624[_0xe2e2('0x18')]?_0x350624['options'][_0xe2e2('0x19')]||null:null,'transaction':_0x31cb66});});})[_0xe2e2('0xc')](function(_0x288542){logger[_0xe2e2('0xd')]('MoveContactManagedDialer',_0x350624);logger['debug'](_0xe2e2('0x37'),_0x350624,JSON['stringify'](_0x288542));_0x19fec2(_0x288542);})['catch'](function(_0x1be1c1){logger[_0xe2e2('0x13')](_0xe2e2('0x37'),_0x1be1c1[_0xe2e2('0x14')],_0x350624);_0x6eba7(_0x4ad72a[_0xe2e2('0x13')](0x1f4,_0x1be1c1[_0xe2e2('0x14')]));});});};exports[_0xe2e2('0x38')]=function(_0x3e9591){var _0x902dbf=this;return new Promise(function(_0x380412,_0x31f9d8){return db[_0xe2e2('0x16')]['findAll']({'raw':_0x3e9591[_0xe2e2('0x18')]?_0x3e9591[_0xe2e2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3e9591[_0xe2e2('0x18')]?_0x3e9591[_0xe2e2('0x18')][_0xe2e2('0x19')]||null:null,'attributes':[[db[_0xe2e2('0x2d')]['fn']('COUNT',db[_0xe2e2('0x2d')]['fn']('IF',db['sequelize']['literal'](_0xe2e2('0x39')+util['format'](_0xe2e2('0x3a'),moment()[_0xe2e2('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xe2e2('0x3c')))),_0xe2e2('0x3d')]]})[_0xe2e2('0xc')](function(_0x944723){logger[_0xe2e2('0xd')]('CountReScheduled',_0x3e9591);logger['debug'](_0xe2e2('0x38'),_0x3e9591,JSON['stringify'](_0x944723));_0x380412(_0x944723);})[_0xe2e2('0x20')](function(_0x495bb6){logger[_0xe2e2('0x13')]('CountReScheduled',_0x495bb6[_0xe2e2('0x14')],_0x3e9591);_0x31f9d8(_0x902dbf['error'](0x1f4,_0x495bb6['message']));});});};exports['GetContactRecallMe']=function(_0x38c5a4){var _0x13b3e1=this;return new Promise(function(_0x3dde8f,_0x2b3991){return db[_0xe2e2('0x2b')][_0xe2e2('0x2c')]()[_0xe2e2('0xc')](function(_0x1afdd0){return db[_0xe2e2('0x2d')][_0xe2e2('0x2e')](function(_0x409d08){return db[_0xe2e2('0x16')][_0xe2e2('0x17')]({'where':_0x38c5a4['options']?_0x38c5a4['options'][_0xe2e2('0x19')]||null:null,'attributes':_0x38c5a4[_0xe2e2('0x18')]?_0x38c5a4['options'][_0xe2e2('0x1a')]||null:null,'limit':0x1,'order':_0x38c5a4[_0xe2e2('0x18')]?_0x38c5a4['options'][_0xe2e2('0x2f')]||null:null,'group':db[_0xe2e2('0x16')][_0xe2e2('0x3e')],'transaction':_0x409d08,'lock':_0x409d08[_0xe2e2('0x30')][_0xe2e2('0x3f')],'include':_0x38c5a4[_0xe2e2('0x18')]?_0x38c5a4['options']['include']?_[_0xe2e2('0x1d')](_0x38c5a4['options'][_0xe2e2('0x1c')],function(_0x4ac684){return{'model':db[_0x4ac684[_0xe2e2('0x1e')]],'as':_0x4ac684['as'],'attributes':_0x4ac684[_0xe2e2('0x1a')],'include':_0x4ac684['include']?_[_0xe2e2('0x1d')](_0x4ac684[_0xe2e2('0x1c')],function(_0x4d9478){return{'model':db[_0x4d9478[_0xe2e2('0x1e')]],'as':_0x4d9478['as'],'attributes':_0x4d9478[_0xe2e2('0x1a')],'include':_0x4d9478[_0xe2e2('0x1c')]?_['map'](_0x4d9478['include'],function(_0x2f4f48){return{'model':db[_0x2f4f48[_0xe2e2('0x1e')]],'as':_0x2f4f48['as'],'attributes':_0x2f4f48[_0xe2e2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xacce97){var _0x520ae5=[];for(var _0x149882=0x0;_0x149882<_0xacce97[_0xe2e2('0x33')];_0x149882+=0x1){_0x520ae5['push'](_0xacce97[_0x149882][_0xe2e2('0x27')](_0x38c5a4[_0xe2e2('0x25')],{'transaction':_0x409d08}));}return BPromise[_0xe2e2('0x35')](_0x520ae5);});})[_0xe2e2('0xc')](function(_0x1d0e59){logger[_0xe2e2('0xd')](_0xe2e2('0x40'),_0x38c5a4);logger[_0xe2e2('0xf')](_0xe2e2('0x40'),_0x38c5a4,JSON[_0xe2e2('0x12')](_0x1d0e59));_0x3dde8f(_0x1d0e59);})[_0xe2e2('0x20')](function(_0x4635d8){logger[_0xe2e2('0x13')](_0xe2e2('0x40'),_0x4635d8[_0xe2e2('0x14')],_0x38c5a4);_0x2b3991(_0x13b3e1[_0xe2e2('0x13')](0x1f4,_0x4635d8['message']));});});});}; \ No newline at end of file +var _0x3184=['find','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','length','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','order','UserId','push','all','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','GetCmHopper','catch'];(function(_0xdf666c,_0x5bded4){var _0x5e59c7=function(_0x2a4806){while(--_0x2a4806){_0xdf666c['push'](_0xdf666c['shift']());}};_0x5e59c7(++_0x5bded4);}(_0x3184,0x1ac));var _0x4318=function(_0x113dd1,_0x15aaa1){_0x113dd1=_0x113dd1-0x0;var _0x1605e0=_0x3184[_0x113dd1];return _0x1605e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4318('0x0'));var BPromise=require(_0x4318('0x1'));var rs=require(_0x4318('0x2'));var fs=require('fs');var Redis=require(_0x4318('0x3'));var db=require(_0x4318('0x4'))['db'];var utils=require(_0x4318('0x5'));var logger=require(_0x4318('0x6'))(_0x4318('0x7'));var config=require(_0x4318('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4318('0x9')][_0x4318('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27d7b0,_0x244bf8,_0x18b733){return new BPromise(function(_0x3d1d10,_0x4dea14){return client[_0x4318('0xb')](_0x27d7b0,_0x18b733)['then'](function(_0x4f9611){logger[_0x4318('0xc')](_0x4318('0xd'),_0x244bf8,_0x4318('0xe'));logger[_0x4318('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x244bf8,_0x4318('0xe'),JSON[_0x4318('0x10')](_0x4f9611));if(_0x4f9611[_0x4318('0x11')]){if(_0x4f9611[_0x4318('0x11')][_0x4318('0x12')]===0x1f4){logger[_0x4318('0x11')](_0x4318('0xd'),_0x244bf8,_0x4f9611[_0x4318('0x11')][_0x4318('0x13')]);return _0x4dea14(_0x4f9611['error'][_0x4318('0x13')]);}logger['error'](_0x4318('0xd'),_0x244bf8,_0x4f9611['error'][_0x4318('0x13')]);return _0x3d1d10(_0x4f9611[_0x4318('0x11')]['message']);}else{logger[_0x4318('0xc')]('CmHopper,\x20%s,\x20%s',_0x244bf8,_0x4318('0xe'));_0x3d1d10(_0x4f9611[_0x4318('0x14')][_0x4318('0x13')]);}})['catch'](function(_0x59ace4){logger[_0x4318('0x11')](_0x4318('0xd'),_0x244bf8,_0x59ace4);_0x4dea14(_0x59ace4);});});}exports['GetCmHopper']=function(_0x5112cc){var _0x2ea17b=this;return new Promise(function(_0x2cc50b,_0x1a1ce6){return db[_0x4318('0x15')][_0x4318('0x16')]({'raw':_0x5112cc['options']?_0x5112cc[_0x4318('0x17')][_0x4318('0x18')]===undefined?!![]:![]:!![],'where':_0x5112cc['options']?_0x5112cc['options'][_0x4318('0x19')]||null:null,'attributes':_0x5112cc[_0x4318('0x17')]?_0x5112cc[_0x4318('0x17')]['attributes']||null:null,'limit':_0x5112cc['options']?_0x5112cc[_0x4318('0x17')][_0x4318('0x1a')]||null:null,'include':_0x5112cc[_0x4318('0x17')]?_0x5112cc['options'][_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x5112cc[_0x4318('0x17')][_0x4318('0x1b')],function(_0x567cc1){return{'model':db[_0x567cc1[_0x4318('0x1d')]],'as':_0x567cc1['as'],'attributes':_0x567cc1[_0x4318('0x1e')],'include':_0x567cc1[_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x567cc1['include'],function(_0x38239e){return{'model':db[_0x38239e[_0x4318('0x1d')]],'as':_0x38239e['as'],'attributes':_0x38239e['attributes'],'include':_0x38239e[_0x4318('0x1b')]?_['map'](_0x38239e[_0x4318('0x1b')],function(_0x3e6bd2){return{'model':db[_0x3e6bd2[_0x4318('0x1d')]],'as':_0x3e6bd2['as'],'attributes':_0x3e6bd2[_0x4318('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4318('0x1f')](function(_0x5a6184){logger[_0x4318('0xc')](_0x4318('0x20'),_0x5112cc);logger[_0x4318('0xf')](_0x4318('0x20'),_0x5112cc,JSON['stringify'](_0x5a6184));_0x2cc50b(_0x5a6184);})[_0x4318('0x21')](function(_0x560d36){logger[_0x4318('0x11')](_0x4318('0x20'),_0x560d36[_0x4318('0x13')],_0x5112cc);_0x1a1ce6(_0x2ea17b[_0x4318('0x11')](0x1f4,_0x560d36['message']));});});};exports['ShowCmHopper']=function(_0xfb4fdd){var _0x49f363=this;return new Promise(function(_0x32ccfa,_0x5bb0db){return db[_0x4318('0x15')][_0x4318('0x22')]({'raw':_0xfb4fdd[_0x4318('0x17')]?_0xfb4fdd[_0x4318('0x17')][_0x4318('0x18')]===undefined?!![]:![]:!![],'where':_0xfb4fdd[_0x4318('0x17')]?_0xfb4fdd[_0x4318('0x17')][_0x4318('0x19')]||null:null,'attributes':_0xfb4fdd[_0x4318('0x17')]?_0xfb4fdd[_0x4318('0x17')][_0x4318('0x1e')]||null:null,'include':_0xfb4fdd[_0x4318('0x17')]?_0xfb4fdd[_0x4318('0x17')][_0x4318('0x1b')]?_[_0x4318('0x1c')](_0xfb4fdd[_0x4318('0x17')][_0x4318('0x1b')],function(_0x1903fd){return{'model':db[_0x1903fd[_0x4318('0x1d')]],'as':_0x1903fd['as'],'attributes':_0x1903fd[_0x4318('0x1e')],'include':_0x1903fd[_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x1903fd[_0x4318('0x1b')],function(_0x1faf94){return{'model':db[_0x1faf94[_0x4318('0x1d')]],'as':_0x1faf94['as'],'attributes':_0x1faf94['attributes'],'include':_0x1faf94[_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x1faf94[_0x4318('0x1b')],function(_0x59c2f4){return{'model':db[_0x59c2f4[_0x4318('0x1d')]],'as':_0x59c2f4['as'],'attributes':_0x59c2f4[_0x4318('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c1cdc){logger['info'](_0x4318('0x23'),_0xfb4fdd);logger[_0x4318('0xf')](_0x4318('0x23'),_0xfb4fdd,JSON[_0x4318('0x10')](_0x5c1cdc));_0x32ccfa(_0x5c1cdc);})[_0x4318('0x21')](function(_0x46987){logger[_0x4318('0x11')](_0x4318('0x23'),_0x46987['message'],_0xfb4fdd);_0x5bb0db(_0x49f363['error'](0x1f4,_0x46987[_0x4318('0x13')]));});});};exports[_0x4318('0x24')]=function(_0x592851){var _0x4be030=this;return new Promise(function(_0xc97587,_0x32b775){return db[_0x4318('0x15')][_0x4318('0x25')](_0x592851['body'],{'raw':_0x592851[_0x4318('0x17')]?_0x592851[_0x4318('0x17')][_0x4318('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x107c7c){logger[_0x4318('0xc')](_0x4318('0x24'),_0x592851);logger['debug'](_0x4318('0x24'),_0x592851,JSON[_0x4318('0x10')](_0x107c7c));_0xc97587(_0x107c7c);})[_0x4318('0x21')](function(_0x56e55c){logger[_0x4318('0x11')](_0x4318('0x24'),_0x56e55c[_0x4318('0x13')],_0x592851);_0x32b775(_0x4be030['error'](0x1f4,_0x56e55c[_0x4318('0x13')]));});});};exports[_0x4318('0x26')]=function(_0x417863){var _0x3f0906=this;return new Promise(function(_0x88440e,_0xc6aec4){return db['CmHopper'][_0x4318('0x27')](_0x417863[_0x4318('0x28')],{'raw':_0x417863[_0x4318('0x17')]?_0x417863[_0x4318('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417863[_0x4318('0x17')]?_0x417863[_0x4318('0x17')]['where']||null:null,'attributes':_0x417863[_0x4318('0x17')]?_0x417863[_0x4318('0x17')][_0x4318('0x1e')]||null:null,'limit':_0x417863[_0x4318('0x17')]?_0x417863[_0x4318('0x17')][_0x4318('0x1a')]||null:null})[_0x4318('0x1f')](function(_0x4242ac){logger[_0x4318('0xc')]('UpdateCmHopper',_0x417863);logger[_0x4318('0xf')](_0x4318('0x26'),_0x417863,JSON[_0x4318('0x10')](_0x4242ac));_0x88440e(_0x4242ac);})[_0x4318('0x21')](function(_0x595c05){logger[_0x4318('0x11')]('UpdateCmHopper',_0x595c05[_0x4318('0x13')],_0x417863);_0xc6aec4(_0x3f0906[_0x4318('0x11')](0x1f4,_0x595c05[_0x4318('0x13')]));});});};exports['DestroyCmHopper']=function(_0x15c4a3){var _0x2c68f0=this;return new Promise(function(_0x2b3137,_0x2830d6){return db['CmHopper'][_0x4318('0x29')]({'where':_0x15c4a3[_0x4318('0x17')]?_0x15c4a3[_0x4318('0x17')][_0x4318('0x19')]||null:null})[_0x4318('0x1f')](function(_0x416ef7){logger[_0x4318('0xc')](_0x4318('0x2a'),_0x15c4a3);logger[_0x4318('0xf')](_0x4318('0x2a'),_0x15c4a3,JSON['stringify'](_0x416ef7));_0x2b3137(_0x416ef7);})[_0x4318('0x21')](function(_0x27bcbe){logger[_0x4318('0x11')](_0x4318('0x2a'),_0x27bcbe[_0x4318('0x13')],_0x15c4a3);_0x2830d6(_0x2c68f0[_0x4318('0x11')](0x1f4,_0x27bcbe[_0x4318('0x13')]));});});};exports[_0x4318('0x2b')]=function(_0x2b9e26){var _0x48c606=this;return new Promise(function(_0x5277cd,_0x10df84){return db[_0x4318('0x2c')][_0x4318('0x2d')]()[_0x4318('0x1f')](function(_0x1f533c){return db[_0x4318('0x2e')]['transaction'](function(_0xd59202){return db[_0x4318('0x15')]['findAll']({'where':_0x2b9e26[_0x4318('0x17')]?_0x2b9e26[_0x4318('0x17')]['where']||null:null,'attributes':_0x2b9e26[_0x4318('0x17')]?_0x2b9e26[_0x4318('0x17')][_0x4318('0x1e')]||null:null,'limit':_0x2b9e26[_0x4318('0x17')]?_0x2b9e26[_0x4318('0x17')]['limit']||null:null,'order':_0x2b9e26[_0x4318('0x17')]?_0x2b9e26[_0x4318('0x17')]['order']||null:null,'transaction':_0xd59202,'lock':_0xd59202[_0x4318('0x2f')][_0x4318('0x30')],'include':[{'model':db[_0x4318('0x2c')],'as':_0x4318('0x31'),'attributes':_[_0x4318('0x32')](_0x1f533c)}]})[_0x4318('0x1f')](function(_0x3b17ab){var _0x27384b=[];for(var _0x11071b=0x0;_0x11071b<_0x3b17ab[_0x4318('0x33')];_0x11071b+=0x1){_0x27384b['push'](_0x3b17ab[_0x11071b][_0x4318('0x27')](_0x2b9e26[_0x4318('0x28')],{'transaction':_0xd59202}));}return BPromise['all'](_0x27384b);});})['then'](function(_0x542d68){logger['info']('GetContactDialer',_0x2b9e26);logger['debug'](_0x4318('0x2b'),_0x2b9e26,JSON[_0x4318('0x10')](_0x542d68));_0x5277cd(_0x542d68);})[_0x4318('0x21')](function(_0xe03e17){logger[_0x4318('0x11')](_0x4318('0x2b'),_0xe03e17[_0x4318('0x13')],_0x2b9e26);_0x10df84(_0x48c606[_0x4318('0x11')](0x1f4,_0xe03e17[_0x4318('0x13')]));});});});};exports[_0x4318('0x34')]=function(_0xb9eb8b){var _0x292236=this;return new Promise(function(_0x5d8522,_0x2bd54e){return db[_0x4318('0x2e')]['transaction'](function(_0x2f0996){return db[_0x4318('0x35')][_0x4318('0x25')](_0xb9eb8b[_0x4318('0x28')],{'raw':_0xb9eb8b[_0x4318('0x17')]?_0xb9eb8b['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x2f0996})[_0x4318('0x1f')](function(){return db['CmHopper'][_0x4318('0x29')]({'where':_0xb9eb8b[_0x4318('0x17')]?_0xb9eb8b['options'][_0x4318('0x19')]||null:null,'transaction':_0x2f0996});});})[_0x4318('0x1f')](function(_0x185369){logger['info'](_0x4318('0x34'),_0xb9eb8b);logger[_0x4318('0xf')](_0x4318('0x34'),_0xb9eb8b,JSON['stringify'](_0x185369));_0x5d8522(_0x185369);})[_0x4318('0x21')](function(_0x551706){logger[_0x4318('0x11')](_0x4318('0x34'),_0x551706[_0x4318('0x13')],_0xb9eb8b);_0x2bd54e(_0x292236[_0x4318('0x11')](0x1f4,_0x551706['message']));});});};exports['CountReScheduled']=function(_0x949651){var _0x224029=this;return new Promise(function(_0x1ee495,_0x167566){return db[_0x4318('0x15')][_0x4318('0x16')]({'raw':_0x949651['options']?_0x949651['options']['raw']===undefined?!![]:![]:!![],'where':_0x949651[_0x4318('0x17')]?_0x949651['options']['where']||null:null,'attributes':[[db[_0x4318('0x2e')]['fn'](_0x4318('0x36'),db['sequelize']['fn']('IF',db[_0x4318('0x2e')][_0x4318('0x37')](_0x4318('0x38')+util['format'](_0x4318('0x39'),moment()[_0x4318('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x4318('0x3b')))),'contactsRescheduled']]})['then'](function(_0x32959f){logger['info'](_0x4318('0x3c'),_0x949651);logger[_0x4318('0xf')](_0x4318('0x3c'),_0x949651,JSON[_0x4318('0x10')](_0x32959f));_0x1ee495(_0x32959f);})[_0x4318('0x21')](function(_0x44b15e){logger['error']('CountReScheduled',_0x44b15e[_0x4318('0x13')],_0x949651);_0x167566(_0x224029[_0x4318('0x11')](0x1f4,_0x44b15e[_0x4318('0x13')]));});});};exports[_0x4318('0x3d')]=function(_0x3e32e3){var _0x240c72=this;return new Promise(function(_0xb84519,_0x750a50){return db[_0x4318('0x2c')]['describe']()[_0x4318('0x1f')](function(_0x2a08a9){return db['sequelize']['transaction'](function(_0x52b3eb){return db[_0x4318('0x15')]['findAll']({'where':_0x3e32e3[_0x4318('0x17')]?_0x3e32e3['options'][_0x4318('0x19')]||null:null,'attributes':_0x3e32e3['options']?_0x3e32e3[_0x4318('0x17')][_0x4318('0x1e')]||null:null,'limit':0x1,'order':_0x3e32e3[_0x4318('0x17')]?_0x3e32e3[_0x4318('0x17')][_0x4318('0x3e')]||null:null,'group':db[_0x4318('0x15')][_0x4318('0x3f')],'transaction':_0x52b3eb,'lock':_0x52b3eb[_0x4318('0x2f')]['UPDATE'],'include':_0x3e32e3[_0x4318('0x17')]?_0x3e32e3[_0x4318('0x17')][_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x3e32e3[_0x4318('0x17')][_0x4318('0x1b')],function(_0x33f846){return{'model':db[_0x33f846[_0x4318('0x1d')]],'as':_0x33f846['as'],'attributes':_0x33f846[_0x4318('0x1e')],'include':_0x33f846[_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x33f846[_0x4318('0x1b')],function(_0x282244){return{'model':db[_0x282244[_0x4318('0x1d')]],'as':_0x282244['as'],'attributes':_0x282244[_0x4318('0x1e')],'include':_0x282244[_0x4318('0x1b')]?_[_0x4318('0x1c')](_0x282244[_0x4318('0x1b')],function(_0x4d7521){return{'model':db[_0x4d7521[_0x4318('0x1d')]],'as':_0x4d7521['as'],'attributes':_0x4d7521['attributes']};}):[]};}):[]};}):[]:[]})[_0x4318('0x1f')](function(_0x27553b){var _0x11f6ce=[];for(var _0x159191=0x0;_0x159191<_0x27553b[_0x4318('0x33')];_0x159191+=0x1){_0x11f6ce[_0x4318('0x40')](_0x27553b[_0x159191][_0x4318('0x27')](_0x3e32e3['body'],{'transaction':_0x52b3eb}));}return BPromise[_0x4318('0x41')](_0x11f6ce);});})[_0x4318('0x1f')](function(_0x271d81){logger[_0x4318('0xc')](_0x4318('0x3d'),_0x3e32e3);logger[_0x4318('0xf')](_0x4318('0x3d'),_0x3e32e3,JSON['stringify'](_0x271d81));_0xb84519(_0x271d81);})[_0x4318('0x21')](function(_0x10ea8d){logger[_0x4318('0x11')](_0x4318('0x3d'),_0x10ea8d['message'],_0x3e32e3);_0x750a50(_0x240c72[_0x4318('0x11')](0x1f4,_0x10ea8d[_0x4318('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3699e78..d87a50e 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 _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router; \ No newline at end of file +var _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ffc10aa..48a217f 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 _0x831d=['sequelize','INTEGER','contactListQueue','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x831d,0x153));var _0xd831=function(_0x2c4f3f,_0x266947){_0x2c4f3f=_0x2c4f3f-0x0;var _0x3d0234=_0x831d[_0x2c4f3f];return _0x3d0234;};'use strict';var moment=require(_0xd831('0x0'));var Sequelize=require(_0xd831('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd831('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd831('0x2')],'unique':_0xd831('0x3')},'VoiceQueueId':{'type':Sequelize[_0xd831('0x2')],'unique':_0xd831('0x3')}}; \ No newline at end of file +var _0xcde9=['moment','sequelize','INTEGER','contactListQueue'];(function(_0x1d792c,_0x5473a7){var _0x4584e5=function(_0x32122e){while(--_0x32122e){_0x1d792c['push'](_0x1d792c['shift']());}};_0x4584e5(++_0x5473a7);}(_0xcde9,0x16c));var _0x9cde=function(_0x200453,_0x295906){_0x200453=_0x200453-0x0;var _0x59c4f8=_0xcde9[_0x200453];return _0x59c4f8;};'use strict';var moment=require(_0x9cde('0x0'));var Sequelize=require(_0x9cde('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9cde('0x2')],'unique':_0x9cde('0x3')},'ListId':{'type':Sequelize[_0x9cde('0x2')],'unique':_0x9cde('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9cde('0x2')],'unique':_0x9cde('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index bda6f64..6e91b8d 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 _0x002c=['end','status','json','count','set','Content-Range','apply','update','then','stack','name','send','index','CmHopperBlack','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','map','type','key','field','filter','includeAll','include','rows','catch','show','params','length','find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x46b021,_0x2cbb81){var _0x38b04e=function(_0x4ff0c1){while(--_0x4ff0c1){_0x46b021['push'](_0x46b021['shift']());}};_0x38b04e(++_0x2cbb81);}(_0x002c,0x1d8));var _0xc002=function(_0x592ae5,_0x20524b){_0x592ae5=_0x592ae5-0x0;var _0x20b7be=_0x002c[_0x592ae5];return _0x20b7be;};'use strict';var pdf=require(_0xc002('0x0'));var emlformat=require(_0xc002('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc002('0x2'));var jsonpatch=require(_0xc002('0x3'));var rp=require(_0xc002('0x4'));var moment=require(_0xc002('0x5'));var BPromise=require(_0xc002('0x6'));var Mustache=require(_0xc002('0x7'));var util=require(_0xc002('0x8'));var path=require(_0xc002('0x9'));var sox=require(_0xc002('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc002('0xb'));var squel=require(_0xc002('0xc'));var crypto=require(_0xc002('0xd'));var jsforce=require(_0xc002('0xe'));var deskjs=require(_0xc002('0xf'));var toCsv=require(_0xc002('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc002('0x11'));var authService=require(_0xc002('0x12'));var qs=require(_0xc002('0x13'));var hardwareService=require(_0xc002('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc002('0x15'));var config=require(_0xc002('0x16'));var db=require(_0xc002('0x17'))['db'];function respondWithStatusCode(_0x57f509,_0x37527b){_0x37527b=_0x37527b||0xcc;return function(_0x362fe3){if(_0x362fe3){return _0x57f509[_0xc002('0x18')](_0x37527b);}return _0x57f509['status'](_0x37527b)[_0xc002('0x19')]();};}function respondWithResult(_0x16185d,_0x15cfb1){_0x15cfb1=_0x15cfb1||0xc8;return function(_0x57017c){if(_0x57017c){return _0x16185d[_0xc002('0x1a')](_0x15cfb1)[_0xc002('0x1b')](_0x57017c);}};}function respondWithFilteredResult(_0x12ffe5,_0x55742f){return function(_0x2d41ac){if(_0x2d41ac){var _0x3303b2=_0x2d41ac[_0xc002('0x1c')],_0x152016=_0x55742f['offset'],_0x5408de=_0x55742f['offset']+_0x55742f['limit'],_0x19b1ce;if(_0x5408de>=_0x3303b2){_0x5408de=_0x3303b2;_0x19b1ce=0xc8;}else{_0x19b1ce=0xce;}_0x12ffe5[_0xc002('0x1a')](_0x19b1ce);return _0x12ffe5[_0xc002('0x1d')](_0xc002('0x1e'),_0x152016+'-'+_0x5408de+'/'+_0x3303b2)[_0xc002('0x1b')](_0x2d41ac);}return null;};}function patchUpdates(_0x1b9816){return function(_0x78253){try{jsonpatch[_0xc002('0x1f')](_0x78253,_0x1b9816,!![]);}catch(_0x182cdb){return BPromise['reject'](_0x182cdb);}return _0x78253['save']();};}function saveUpdates(_0x149279,_0x88b3d4){return function(_0x566e8a){if(_0x566e8a){return _0x566e8a[_0xc002('0x20')](_0x149279)[_0xc002('0x21')](function(_0x24f528){return _0x24f528;});}return null;};}function removeEntity(_0x1bd5a5,_0x16695f){return function(_0x1ca9fd){if(_0x1ca9fd){return _0x1ca9fd['destroy']()[_0xc002('0x21')](function(){_0x1bd5a5[_0xc002('0x1a')](0xcc)[_0xc002('0x19')]();});}};}function handleEntityNotFound(_0x595954,_0x1b7d48){return function(_0x533ca6){if(!_0x533ca6){_0x595954[_0xc002('0x18')](0x194);}return _0x533ca6;};}function handleError(_0x217a35,_0x4b51f5){_0x4b51f5=_0x4b51f5||0x1f4;return function(_0x273cf5){logger['error'](_0x273cf5[_0xc002('0x22')]);if(_0x273cf5[_0xc002('0x23')]){delete _0x273cf5[_0xc002('0x23')];}_0x217a35['status'](_0x4b51f5)[_0xc002('0x24')](_0x273cf5);};}exports[_0xc002('0x25')]=function(_0x17ab39,_0x19b214){var _0x43c047={},_0x369e77={},_0x2436e1={'count':0x0,'rows':[]};var _0x1154f8=db[_0xc002('0x26')][_0xc002('0x27')];_0x369e77[_0xc002('0x28')]=_[_0xc002('0x29')](_0x1154f8);_0x369e77[_0xc002('0x2a')]=_[_0xc002('0x29')](_0x17ab39[_0xc002('0x2a')]);_0x369e77[_0xc002('0x2b')]=_[_0xc002('0x2c')](_0x369e77[_0xc002('0x28')],_0x369e77['query']);_0x43c047[_0xc002('0x2d')]=_[_0xc002('0x2c')](_0x369e77[_0xc002('0x28')],qs['fields'](_0x17ab39['query'][_0xc002('0x2e')]));_0x43c047[_0xc002('0x2d')]=_0x43c047['attributes']['length']?_0x43c047[_0xc002('0x2d')]:_0x369e77['model'];if(!_0x17ab39[_0xc002('0x2a')][_0xc002('0x2f')](_0xc002('0x30'))){_0x43c047[_0xc002('0x31')]=qs['limit'](_0x17ab39[_0xc002('0x2a')][_0xc002('0x31')]);_0x43c047[_0xc002('0x32')]=qs[_0xc002('0x32')](_0x17ab39[_0xc002('0x2a')]['offset']);}_0x43c047[_0xc002('0x33')]=qs[_0xc002('0x34')](_0x17ab39['query'][_0xc002('0x34')]);_0x43c047['where']=qs[_0xc002('0x2b')](_[_0xc002('0x35')](_0x17ab39[_0xc002('0x2a')],_0x369e77['filters']));if(_0x17ab39[_0xc002('0x2a')]['filter']){_0x43c047[_0xc002('0x36')]=_[_0xc002('0x37')](_0x43c047[_0xc002('0x36')],{'$or':_[_0xc002('0x38')](_0x1154f8,function(_0x1db3a5){if(_0x1db3a5[_0xc002('0x39')][_0xc002('0x3a')]!=='VIRTUAL'){var _0x56012d={};_0x56012d[_0x1db3a5[_0xc002('0x3b')]]={'$like':'%'+_0x17ab39[_0xc002('0x2a')][_0xc002('0x3c')]+'%'};return _0x56012d;}})});}_0x43c047=_['merge']({},_0x43c047,_0x17ab39['options']);var _0x15239b={'where':_0x43c047[_0xc002('0x36')]};return db[_0xc002('0x26')][_0xc002('0x1c')](_0x15239b)[_0xc002('0x21')](function(_0x2a2dc9){_0x2436e1[_0xc002('0x1c')]=_0x2a2dc9;if(_0x17ab39[_0xc002('0x2a')][_0xc002('0x3d')]){_0x43c047[_0xc002('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x43c047);})['then'](function(_0x5a0b95){_0x2436e1[_0xc002('0x3f')]=_0x5a0b95;return _0x2436e1;})[_0xc002('0x21')](respondWithFilteredResult(_0x19b214,_0x43c047))[_0xc002('0x40')](handleError(_0x19b214,null));};exports[_0xc002('0x41')]=function(_0x1b4168,_0x10f29f){var _0x254169={'raw':!![],'where':{'id':_0x1b4168[_0xc002('0x42')]['id']}},_0x14f1a9={};_0x14f1a9[_0xc002('0x28')]=_[_0xc002('0x29')](db[_0xc002('0x26')]['rawAttributes']);_0x14f1a9['query']=_[_0xc002('0x29')](_0x1b4168[_0xc002('0x2a')]);_0x14f1a9[_0xc002('0x2b')]=_[_0xc002('0x2c')](_0x14f1a9[_0xc002('0x28')],_0x14f1a9['query']);_0x254169[_0xc002('0x2d')]=_[_0xc002('0x2c')](_0x14f1a9['model'],qs[_0xc002('0x2e')](_0x1b4168[_0xc002('0x2a')][_0xc002('0x2e')]));_0x254169[_0xc002('0x2d')]=_0x254169[_0xc002('0x2d')][_0xc002('0x43')]?_0x254169[_0xc002('0x2d')]:_0x14f1a9[_0xc002('0x28')];if(_0x1b4168['query'][_0xc002('0x3d')]){_0x254169[_0xc002('0x3e')]=[{'all':!![]}];}_0x254169=_[_0xc002('0x37')]({},_0x254169,_0x1b4168['options']);return db[_0xc002('0x26')][_0xc002('0x44')](_0x254169)[_0xc002('0x21')](handleEntityNotFound(_0x10f29f,null))[_0xc002('0x21')](respondWithResult(_0x10f29f,null))[_0xc002('0x40')](handleError(_0x10f29f,null));};exports['update']=function(_0x280e79,_0x1a62ba){if(_0x280e79[_0xc002('0x45')]['id']){delete _0x280e79[_0xc002('0x45')]['id'];}return db[_0xc002('0x26')][_0xc002('0x44')]({'where':{'id':_0x280e79[_0xc002('0x42')]['id']}})[_0xc002('0x21')](handleEntityNotFound(_0x1a62ba,null))['then'](saveUpdates(_0x280e79[_0xc002('0x45')],null))[_0xc002('0x21')](respondWithResult(_0x1a62ba,null))[_0xc002('0x40')](handleError(_0x1a62ba,null));};exports['destroy']=function(_0xa6ac4a,_0x1be0e4){return db[_0xc002('0x26')]['find']({'where':{'id':_0xa6ac4a[_0xc002('0x42')]['id']}})['then'](handleEntityNotFound(_0x1be0e4,null))[_0xc002('0x21')](removeEntity(_0x1be0e4,null))['catch'](handleError(_0x1be0e4,null));};exports[_0xc002('0x46')]=function(_0x4e4083,_0x3205e9){return db['CmHopperBlack'][_0xc002('0x46')]()[_0xc002('0x21')](respondWithResult(_0x3205e9,null))[_0xc002('0x40')](handleError(_0x3205e9,null));}; \ No newline at end of file +var _0xef3e=['index','CmHopperBlack','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','key','field','options','includeAll','include','findAll','rows','catch','params','length','find','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0xef3e,0x17c));var _0xeef3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xef3e[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require(_0xeef3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeef3('0x1'));var jsonpatch=require(_0xeef3('0x2'));var rp=require(_0xeef3('0x3'));var moment=require(_0xeef3('0x4'));var BPromise=require(_0xeef3('0x5'));var Mustache=require(_0xeef3('0x6'));var util=require('util');var path=require(_0xeef3('0x7'));var sox=require(_0xeef3('0x8'));var csv=require(_0xeef3('0x9'));var ejs=require(_0xeef3('0xa'));var fs=require('fs');var _=require(_0xeef3('0xb'));var squel=require(_0xeef3('0xc'));var crypto=require(_0xeef3('0xd'));var jsforce=require(_0xeef3('0xe'));var deskjs=require(_0xeef3('0xf'));var toCsv=require(_0xeef3('0x9'));var querystring=require(_0xeef3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeef3('0x11'));var qs=require(_0xeef3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeef3('0x13'))(_0xeef3('0x14'));var utils=require('../../config/utils');var config=require(_0xeef3('0x15'));var db=require(_0xeef3('0x16'))['db'];function respondWithStatusCode(_0x24ab43,_0x599c6b){_0x599c6b=_0x599c6b||0xcc;return function(_0x3c0d28){if(_0x3c0d28){return _0x24ab43['sendStatus'](_0x599c6b);}return _0x24ab43[_0xeef3('0x17')](_0x599c6b)[_0xeef3('0x18')]();};}function respondWithResult(_0x35f181,_0x14374c){_0x14374c=_0x14374c||0xc8;return function(_0xc9cdf8){if(_0xc9cdf8){return _0x35f181['status'](_0x14374c)[_0xeef3('0x19')](_0xc9cdf8);}};}function respondWithFilteredResult(_0x32fc5f,_0x2f9aca){return function(_0x5d0b9e){if(_0x5d0b9e){var _0x3435f4=_0x5d0b9e[_0xeef3('0x1a')],_0xfa4b38=_0x2f9aca[_0xeef3('0x1b')],_0x41ec2c=_0x2f9aca[_0xeef3('0x1b')]+_0x2f9aca[_0xeef3('0x1c')],_0x4da274;if(_0x41ec2c>=_0x3435f4){_0x41ec2c=_0x3435f4;_0x4da274=0xc8;}else{_0x4da274=0xce;}_0x32fc5f[_0xeef3('0x17')](_0x4da274);return _0x32fc5f[_0xeef3('0x1d')](_0xeef3('0x1e'),_0xfa4b38+'-'+_0x41ec2c+'/'+_0x3435f4)[_0xeef3('0x19')](_0x5d0b9e);}return null;};}function patchUpdates(_0x66c1dd){return function(_0x28454e){try{jsonpatch['apply'](_0x28454e,_0x66c1dd,!![]);}catch(_0x32a3cc){return BPromise[_0xeef3('0x1f')](_0x32a3cc);}return _0x28454e[_0xeef3('0x20')]();};}function saveUpdates(_0x45b536,_0x514d5f){return function(_0x571504){if(_0x571504){return _0x571504[_0xeef3('0x21')](_0x45b536)['then'](function(_0x46d22b){return _0x46d22b;});}return null;};}function removeEntity(_0x5a279a,_0x23140d){return function(_0x281ee6){if(_0x281ee6){return _0x281ee6[_0xeef3('0x22')]()[_0xeef3('0x23')](function(){_0x5a279a[_0xeef3('0x17')](0xcc)[_0xeef3('0x18')]();});}};}function handleEntityNotFound(_0x4b61d5,_0x3daf54){return function(_0x1dedbc){if(!_0x1dedbc){_0x4b61d5[_0xeef3('0x24')](0x194);}return _0x1dedbc;};}function handleError(_0x85bbdc,_0x16add4){_0x16add4=_0x16add4||0x1f4;return function(_0x2e1ebc){logger['error'](_0x2e1ebc[_0xeef3('0x25')]);if(_0x2e1ebc[_0xeef3('0x26')]){delete _0x2e1ebc['name'];}_0x85bbdc['status'](_0x16add4)[_0xeef3('0x27')](_0x2e1ebc);};}exports[_0xeef3('0x28')]=function(_0x3855d8,_0xc98d32){var _0x587a84={},_0x13fd00={},_0xa06da5={'count':0x0,'rows':[]};var _0x2f8277=db[_0xeef3('0x29')][_0xeef3('0x2a')];_0x13fd00[_0xeef3('0x2b')]=_[_0xeef3('0x2c')](_0x2f8277);_0x13fd00['query']=_[_0xeef3('0x2c')](_0x3855d8[_0xeef3('0x2d')]);_0x13fd00[_0xeef3('0x2e')]=_[_0xeef3('0x2f')](_0x13fd00[_0xeef3('0x2b')],_0x13fd00[_0xeef3('0x2d')]);_0x587a84[_0xeef3('0x30')]=_['intersection'](_0x13fd00[_0xeef3('0x2b')],qs[_0xeef3('0x31')](_0x3855d8[_0xeef3('0x2d')]['fields']));_0x587a84[_0xeef3('0x30')]=_0x587a84['attributes']['length']?_0x587a84[_0xeef3('0x30')]:_0x13fd00['model'];if(!_0x3855d8[_0xeef3('0x2d')][_0xeef3('0x32')]('nolimit')){_0x587a84[_0xeef3('0x1c')]=qs[_0xeef3('0x1c')](_0x3855d8[_0xeef3('0x2d')][_0xeef3('0x1c')]);_0x587a84['offset']=qs[_0xeef3('0x1b')](_0x3855d8[_0xeef3('0x2d')][_0xeef3('0x1b')]);}_0x587a84[_0xeef3('0x33')]=qs[_0xeef3('0x34')](_0x3855d8[_0xeef3('0x2d')]['sort']);_0x587a84[_0xeef3('0x35')]=qs[_0xeef3('0x2e')](_[_0xeef3('0x36')](_0x3855d8[_0xeef3('0x2d')],_0x13fd00[_0xeef3('0x2e')]));if(_0x3855d8[_0xeef3('0x2d')][_0xeef3('0x37')]){_0x587a84[_0xeef3('0x35')]=_[_0xeef3('0x38')](_0x587a84['where'],{'$or':_['map'](_0x2f8277,function(_0x4acd07){if(_0x4acd07['type'][_0xeef3('0x39')]!=='VIRTUAL'){var _0x442156={};_0x442156[_0x4acd07[_0xeef3('0x3a')]]={'$like':'%'+_0x3855d8['query'][_0xeef3('0x37')]+'%'};return _0x442156;}})});}_0x587a84=_[_0xeef3('0x38')]({},_0x587a84,_0x3855d8[_0xeef3('0x3b')]);var _0x77f2f0={'where':_0x587a84['where']};return db[_0xeef3('0x29')]['count'](_0x77f2f0)['then'](function(_0x2d8bbb){_0xa06da5['count']=_0x2d8bbb;if(_0x3855d8[_0xeef3('0x2d')][_0xeef3('0x3c')]){_0x587a84[_0xeef3('0x3d')]=[{'all':!![]}];}return db[_0xeef3('0x29')][_0xeef3('0x3e')](_0x587a84);})[_0xeef3('0x23')](function(_0x443565){_0xa06da5[_0xeef3('0x3f')]=_0x443565;return _0xa06da5;})[_0xeef3('0x23')](respondWithFilteredResult(_0xc98d32,_0x587a84))[_0xeef3('0x40')](handleError(_0xc98d32,null));};exports['show']=function(_0x2bd518,_0x345592){var _0x46b556={'raw':!![],'where':{'id':_0x2bd518[_0xeef3('0x41')]['id']}},_0x5ebdef={};_0x5ebdef[_0xeef3('0x2b')]=_[_0xeef3('0x2c')](db[_0xeef3('0x29')][_0xeef3('0x2a')]);_0x5ebdef[_0xeef3('0x2d')]=_['keys'](_0x2bd518[_0xeef3('0x2d')]);_0x5ebdef[_0xeef3('0x2e')]=_['intersection'](_0x5ebdef[_0xeef3('0x2b')],_0x5ebdef[_0xeef3('0x2d')]);_0x46b556[_0xeef3('0x30')]=_[_0xeef3('0x2f')](_0x5ebdef[_0xeef3('0x2b')],qs['fields'](_0x2bd518[_0xeef3('0x2d')][_0xeef3('0x31')]));_0x46b556[_0xeef3('0x30')]=_0x46b556[_0xeef3('0x30')][_0xeef3('0x42')]?_0x46b556[_0xeef3('0x30')]:_0x5ebdef[_0xeef3('0x2b')];if(_0x2bd518[_0xeef3('0x2d')]['includeAll']){_0x46b556[_0xeef3('0x3d')]=[{'all':!![]}];}_0x46b556=_[_0xeef3('0x38')]({},_0x46b556,_0x2bd518['options']);return db[_0xeef3('0x29')][_0xeef3('0x43')](_0x46b556)['then'](handleEntityNotFound(_0x345592,null))[_0xeef3('0x23')](respondWithResult(_0x345592,null))['catch'](handleError(_0x345592,null));};exports['update']=function(_0x2f9519,_0x29ccfb){if(_0x2f9519[_0xeef3('0x44')]['id']){delete _0x2f9519[_0xeef3('0x44')]['id'];}return db[_0xeef3('0x29')][_0xeef3('0x43')]({'where':{'id':_0x2f9519['params']['id']}})[_0xeef3('0x23')](handleEntityNotFound(_0x29ccfb,null))[_0xeef3('0x23')](saveUpdates(_0x2f9519[_0xeef3('0x44')],null))[_0xeef3('0x23')](respondWithResult(_0x29ccfb,null))[_0xeef3('0x40')](handleError(_0x29ccfb,null));};exports['destroy']=function(_0x50e61e,_0x48535d){return db[_0xeef3('0x29')][_0xeef3('0x43')]({'where':{'id':_0x50e61e[_0xeef3('0x41')]['id']}})[_0xeef3('0x23')](handleEntityNotFound(_0x48535d,null))['then'](removeEntity(_0x48535d,null))[_0xeef3('0x40')](handleError(_0x48535d,null));};exports[_0xeef3('0x45')]=function(_0x48e6a7,_0x569be6){return db[_0xeef3('0x29')][_0xeef3('0x45')]()[_0xeef3('0x23')](respondWithResult(_0x569be6,null))[_0xeef3('0x40')](handleError(_0x569be6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 074ff59..77e4854 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 _0x3e74=['exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x5484f4,_0x4f2c3a){var _0x7f7dc9=function(_0x491bcd){while(--_0x491bcd){_0x5484f4['push'](_0x5484f4['shift']());}};_0x7f7dc9(++_0x4f2c3a);}(_0x3e74,0x175));var _0x43e7=function(_0x47e4a9,_0x1f8d1b){_0x47e4a9=_0x47e4a9-0x0;var _0x2c088a=_0x3e74[_0x47e4a9];return _0x2c088a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x458656,_0x5928de){var _0x1ab671=function(_0x4df933){while(--_0x4df933){_0x458656['push'](_0x458656['shift']());}};_0x1ab671(++_0x5928de);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 880ba76..6c75fc1 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 _0x69de=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','catch','destroy','DestroyCmHopperBlack','lodash'];(function(_0xf1b134,_0xb399dd){var _0x139dbb=function(_0xe7a88d){while(--_0xe7a88d){_0xf1b134['push'](_0xf1b134['shift']());}};_0x139dbb(++_0xb399dd);}(_0x69de,0x12f));var _0xe69d=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x69de[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0xe69d('0x0'));var util=require(_0xe69d('0x1'));var moment=require(_0xe69d('0x2'));var BPromise=require(_0xe69d('0x3'));var rs=require(_0xe69d('0x4'));var fs=require('fs');var Redis=require(_0xe69d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe69d('0x6'));var logger=require(_0xe69d('0x7'))(_0xe69d('0x8'));var config=require(_0xe69d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe69d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe732,_0xe7debf,_0x1089da){return new BPromise(function(_0x560d49,_0x457d60){return client[_0xe69d('0xb')](_0x2fe732,_0x1089da)[_0xe69d('0xc')](function(_0x370b1d){logger[_0xe69d('0xd')](_0xe69d('0xe'),_0xe7debf,'request\x20sent');logger[_0xe69d('0xf')](_0xe69d('0x10'),_0xe7debf,_0xe69d('0x11'),JSON[_0xe69d('0x12')](_0x370b1d));if(_0x370b1d[_0xe69d('0x13')]){if(_0x370b1d[_0xe69d('0x13')][_0xe69d('0x14')]===0x1f4){logger[_0xe69d('0x13')](_0xe69d('0xe'),_0xe7debf,_0x370b1d['error'][_0xe69d('0x15')]);return _0x457d60(_0x370b1d['error']['message']);}logger['error'](_0xe69d('0xe'),_0xe7debf,_0x370b1d[_0xe69d('0x13')][_0xe69d('0x15')]);return _0x560d49(_0x370b1d[_0xe69d('0x13')][_0xe69d('0x15')]);}else{logger['info'](_0xe69d('0xe'),_0xe7debf,'request\x20sent');_0x560d49(_0x370b1d['result']['message']);}})['catch'](function(_0x6f6f43){logger[_0xe69d('0x13')](_0xe69d('0xe'),_0xe7debf,_0x6f6f43);_0x457d60(_0x6f6f43);});});}exports[_0xe69d('0x16')]=function(_0x13fc3d){var _0x3e0db1=this;return new Promise(function(_0x3243b8,_0x56b5db){return db[_0xe69d('0x17')]['findAll']({'raw':_0x13fc3d['options']?_0x13fc3d[_0xe69d('0x18')][_0xe69d('0x19')]===undefined?!![]:![]:!![],'where':_0x13fc3d['options']?_0x13fc3d[_0xe69d('0x18')][_0xe69d('0x1a')]||null:null,'attributes':_0x13fc3d[_0xe69d('0x18')]?_0x13fc3d['options'][_0xe69d('0x1b')]||null:null,'limit':_0x13fc3d[_0xe69d('0x18')]?_0x13fc3d[_0xe69d('0x18')][_0xe69d('0x1c')]||null:null,'include':_0x13fc3d[_0xe69d('0x18')]?_0x13fc3d[_0xe69d('0x18')][_0xe69d('0x1d')]?_[_0xe69d('0x1e')](_0x13fc3d['options'][_0xe69d('0x1d')],function(_0xbbe382){return{'model':db[_0xbbe382[_0xe69d('0x1f')]],'as':_0xbbe382['as'],'attributes':_0xbbe382[_0xe69d('0x1b')],'include':_0xbbe382[_0xe69d('0x1d')]?_[_0xe69d('0x1e')](_0xbbe382[_0xe69d('0x1d')],function(_0x42832d){return{'model':db[_0x42832d[_0xe69d('0x1f')]],'as':_0x42832d['as'],'attributes':_0x42832d[_0xe69d('0x1b')],'include':_0x42832d['include']?_[_0xe69d('0x1e')](_0x42832d[_0xe69d('0x1d')],function(_0x1721ce){return{'model':db[_0x1721ce[_0xe69d('0x1f')]],'as':_0x1721ce['as'],'attributes':_0x1721ce[_0xe69d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29a74d){logger['info'](_0xe69d('0x16'),_0x13fc3d);logger[_0xe69d('0xf')](_0xe69d('0x16'),_0x13fc3d,JSON[_0xe69d('0x12')](_0x29a74d));_0x3243b8(_0x29a74d);})['catch'](function(_0x3abebe){logger['error'](_0xe69d('0x16'),_0x3abebe[_0xe69d('0x15')],_0x13fc3d);_0x56b5db(_0x3e0db1[_0xe69d('0x13')](0x1f4,_0x3abebe['message']));});});};exports[_0xe69d('0x20')]=function(_0x272a67){var _0xad14b3=this;return new Promise(function(_0x3685c6,_0x2c88ae){return db['CmHopperBlack'][_0xe69d('0x21')](_0x272a67[_0xe69d('0x22')],{'raw':_0x272a67[_0xe69d('0x18')]?_0x272a67[_0xe69d('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272a67[_0xe69d('0x18')]?_0x272a67['options']['where']||null:null,'attributes':_0x272a67[_0xe69d('0x18')]?_0x272a67[_0xe69d('0x18')][_0xe69d('0x1b')]||null:null,'limit':_0x272a67['options']?_0x272a67[_0xe69d('0x18')][_0xe69d('0x1c')]||null:null})[_0xe69d('0xc')](function(_0x20d016){logger[_0xe69d('0xd')](_0xe69d('0x20'),_0x272a67);logger[_0xe69d('0xf')]('UpdateCmHopperBlack',_0x272a67,JSON['stringify'](_0x20d016));_0x3685c6(_0x20d016);})[_0xe69d('0x23')](function(_0x281376){logger['error'](_0xe69d('0x20'),_0x281376['message'],_0x272a67);_0x2c88ae(_0xad14b3[_0xe69d('0x13')](0x1f4,_0x281376[_0xe69d('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x3ee31d){var _0xbda7c5=this;return new Promise(function(_0x5543b5,_0x41a39e){return db[_0xe69d('0x17')][_0xe69d('0x24')]({'where':_0x3ee31d[_0xe69d('0x18')]?_0x3ee31d[_0xe69d('0x18')][_0xe69d('0x1a')]||null:null})[_0xe69d('0xc')](function(_0x4e75ec){logger['info']('DestroyCmHopperBlack',_0x3ee31d);logger[_0xe69d('0xf')](_0xe69d('0x25'),_0x3ee31d,JSON[_0xe69d('0x12')](_0x4e75ec));_0x5543b5(_0x4e75ec);})[_0xe69d('0x23')](function(_0x31b75c){logger[_0xe69d('0x13')](_0xe69d('0x25'),_0x31b75c[_0xe69d('0x15')],_0x3ee31d);_0x41a39e(_0xbda7c5[_0xe69d('0x13')](0x1f4,_0x31b75c[_0xe69d('0x15')]));});});}; \ No newline at end of file +var _0xe676=['CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','raw','options','where','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f5480,_0x18a141){var _0x52cb63=function(_0x549c06){while(--_0x549c06){_0x1f5480['push'](_0x1f5480['shift']());}};_0x52cb63(++_0x18a141);}(_0xe676,0xdc));var _0x6e67=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xe676[_0x367e5b];return _0x4b909e;};'use strict';var _=require('lodash');var util=require(_0x6e67('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e67('0x1'));var fs=require('fs');var Redis=require(_0x6e67('0x2'));var db=require(_0x6e67('0x3'))['db'];var utils=require(_0x6e67('0x4'));var logger=require(_0x6e67('0x5'))(_0x6e67('0x6'));var config=require(_0x6e67('0x7'));var jayson=require(_0x6e67('0x8'));var client=jayson[_0x6e67('0x9')][_0x6e67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x524fc4,_0x48ae69,_0x7618e7){return new BPromise(function(_0x380315,_0xae7869){return client[_0x6e67('0xb')](_0x524fc4,_0x7618e7)[_0x6e67('0xc')](function(_0x100361){logger[_0x6e67('0xd')](_0x6e67('0xe'),_0x48ae69,'request\x20sent');logger[_0x6e67('0xf')](_0x6e67('0x10'),_0x48ae69,'request\x20sent',JSON[_0x6e67('0x11')](_0x100361));if(_0x100361['error']){if(_0x100361[_0x6e67('0x12')][_0x6e67('0x13')]===0x1f4){logger['error'](_0x6e67('0xe'),_0x48ae69,_0x100361[_0x6e67('0x12')][_0x6e67('0x14')]);return _0xae7869(_0x100361[_0x6e67('0x12')]['message']);}logger[_0x6e67('0x12')](_0x6e67('0xe'),_0x48ae69,_0x100361[_0x6e67('0x12')]['message']);return _0x380315(_0x100361[_0x6e67('0x12')][_0x6e67('0x14')]);}else{logger['info'](_0x6e67('0xe'),_0x48ae69,'request\x20sent');_0x380315(_0x100361[_0x6e67('0x15')][_0x6e67('0x14')]);}})[_0x6e67('0x16')](function(_0x99f5bc){logger[_0x6e67('0x12')](_0x6e67('0xe'),_0x48ae69,_0x99f5bc);_0xae7869(_0x99f5bc);});});}exports['GetCmHopperBlack']=function(_0x5f3c0f){var _0x3fb379=this;return new Promise(function(_0x121c15,_0x210d23){return db[_0x6e67('0x17')][_0x6e67('0x18')]({'raw':_0x5f3c0f['options']?_0x5f3c0f['options'][_0x6e67('0x19')]===undefined?!![]:![]:!![],'where':_0x5f3c0f['options']?_0x5f3c0f[_0x6e67('0x1a')][_0x6e67('0x1b')]||null:null,'attributes':_0x5f3c0f['options']?_0x5f3c0f[_0x6e67('0x1a')][_0x6e67('0x1c')]||null:null,'limit':_0x5f3c0f['options']?_0x5f3c0f[_0x6e67('0x1a')]['limit']||null:null,'include':_0x5f3c0f[_0x6e67('0x1a')]?_0x5f3c0f[_0x6e67('0x1a')][_0x6e67('0x1d')]?_[_0x6e67('0x1e')](_0x5f3c0f[_0x6e67('0x1a')][_0x6e67('0x1d')],function(_0x27fa2c){return{'model':db[_0x27fa2c[_0x6e67('0x1f')]],'as':_0x27fa2c['as'],'attributes':_0x27fa2c[_0x6e67('0x1c')],'include':_0x27fa2c[_0x6e67('0x1d')]?_[_0x6e67('0x1e')](_0x27fa2c[_0x6e67('0x1d')],function(_0x5be3a3){return{'model':db[_0x5be3a3[_0x6e67('0x1f')]],'as':_0x5be3a3['as'],'attributes':_0x5be3a3[_0x6e67('0x1c')],'include':_0x5be3a3[_0x6e67('0x1d')]?_[_0x6e67('0x1e')](_0x5be3a3[_0x6e67('0x1d')],function(_0x288dc5){return{'model':db[_0x288dc5[_0x6e67('0x1f')]],'as':_0x288dc5['as'],'attributes':_0x288dc5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f382){logger[_0x6e67('0xd')](_0x6e67('0x20'),_0x5f3c0f);logger['debug'](_0x6e67('0x20'),_0x5f3c0f,JSON[_0x6e67('0x11')](_0x21f382));_0x121c15(_0x21f382);})[_0x6e67('0x16')](function(_0x230eee){logger[_0x6e67('0x12')]('GetCmHopperBlack',_0x230eee[_0x6e67('0x14')],_0x5f3c0f);_0x210d23(_0x3fb379[_0x6e67('0x12')](0x1f4,_0x230eee[_0x6e67('0x14')]));});});};exports[_0x6e67('0x21')]=function(_0x547aea){var _0x515139=this;return new Promise(function(_0x3d8adc,_0x4df859){return db[_0x6e67('0x17')][_0x6e67('0x22')](_0x547aea[_0x6e67('0x23')],{'raw':_0x547aea[_0x6e67('0x1a')]?_0x547aea[_0x6e67('0x1a')][_0x6e67('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547aea[_0x6e67('0x1a')]?_0x547aea[_0x6e67('0x1a')][_0x6e67('0x1b')]||null:null,'attributes':_0x547aea[_0x6e67('0x1a')]?_0x547aea['options'][_0x6e67('0x1c')]||null:null,'limit':_0x547aea[_0x6e67('0x1a')]?_0x547aea[_0x6e67('0x1a')][_0x6e67('0x24')]||null:null})[_0x6e67('0xc')](function(_0xa35524){logger[_0x6e67('0xd')](_0x6e67('0x21'),_0x547aea);logger[_0x6e67('0xf')](_0x6e67('0x21'),_0x547aea,JSON[_0x6e67('0x11')](_0xa35524));_0x3d8adc(_0xa35524);})[_0x6e67('0x16')](function(_0x212a55){logger[_0x6e67('0x12')](_0x6e67('0x21'),_0x212a55[_0x6e67('0x14')],_0x547aea);_0x4df859(_0x515139[_0x6e67('0x12')](0x1f4,_0x212a55[_0x6e67('0x14')]));});});};exports[_0x6e67('0x25')]=function(_0x5de44b){var _0x2c0004=this;return new Promise(function(_0xf2f290,_0x2d7fc3){return db['CmHopperBlack'][_0x6e67('0x26')]({'where':_0x5de44b['options']?_0x5de44b['options'][_0x6e67('0x1b')]||null:null})[_0x6e67('0xc')](function(_0x5688ac){logger['info'](_0x6e67('0x25'),_0x5de44b);logger[_0x6e67('0xf')]('DestroyCmHopperBlack',_0x5de44b,JSON[_0x6e67('0x11')](_0x5688ac));_0xf2f290(_0x5688ac);})[_0x6e67('0x16')](function(_0x3aa84c){logger[_0x6e67('0x12')]('DestroyCmHopperBlack',_0x3aa84c[_0x6e67('0x14')],_0x5de44b);_0x2d7fc3(_0x2c0004[_0x6e67('0x12')](0x1f4,_0x3aa84c[_0x6e67('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d5260de..1349dcf 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 _0x8ebc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','put','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x8ebc,0x18c));var _0xc8eb=function(_0x36439f,_0x1c40ca){_0x36439f=_0x36439f-0x0;var _0x38942e=_0x8ebc[_0x36439f];return _0x38942e;};'use strict';var multer=require(_0xc8eb('0x0'));var util=require('util');var path=require(_0xc8eb('0x1'));var timeout=require(_0xc8eb('0x2'));var express=require('express');var router=express[_0xc8eb('0x3')]();var auth=require(_0xc8eb('0x4'));var interaction=require(_0xc8eb('0x5'));var config=require(_0xc8eb('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xc8eb('0x7')]('/',auth['isAuthenticated'](),controller[_0xc8eb('0x8')]);router[_0xc8eb('0x7')]('/describe',auth[_0xc8eb('0x9')](),controller[_0xc8eb('0xa')]);router[_0xc8eb('0x7')](_0xc8eb('0xb'),auth[_0xc8eb('0x9')](),controller['show']);router[_0xc8eb('0xc')](_0xc8eb('0xb'),auth[_0xc8eb('0x9')](),controller[_0xc8eb('0xd')]);router[_0xc8eb('0xe')]('/:id',auth[_0xc8eb('0x9')](),controller['destroy']);module[_0xc8eb('0xf')]=router; \ No newline at end of file +var _0x95f7=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x5c24e2,_0x14aa2e){var _0x3be752=function(_0x3b060e){while(--_0x3b060e){_0x5c24e2['push'](_0x5c24e2['shift']());}};_0x3be752(++_0x14aa2e);}(_0x95f7,0x68));var _0x795f=function(_0x2b2c4b,_0x2ad103){_0x2b2c4b=_0x2b2c4b-0x0;var _0x143ab0=_0x95f7[_0x2b2c4b];return _0x143ab0;};'use strict';var multer=require(_0x795f('0x0'));var util=require(_0x795f('0x1'));var path=require(_0x795f('0x2'));var timeout=require(_0x795f('0x3'));var express=require(_0x795f('0x4'));var router=express[_0x795f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x795f('0x6'));var config=require(_0x795f('0x7'));var controller=require(_0x795f('0x8'));router[_0x795f('0x9')]('/',auth[_0x795f('0xa')](),controller[_0x795f('0xb')]);router[_0x795f('0x9')](_0x795f('0xc'),auth[_0x795f('0xa')](),controller[_0x795f('0xd')]);router['get'](_0x795f('0xe'),auth[_0x795f('0xa')](),controller[_0x795f('0xf')]);router[_0x795f('0x10')](_0x795f('0xe'),auth[_0x795f('0xa')](),controller[_0x795f('0x11')]);router[_0x795f('0x12')](_0x795f('0xe'),auth[_0x795f('0xa')](),controller[_0x795f('0x13')]);module[_0x795f('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a868bbb..77e0791 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 _0x659a=['seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x659a,0x115));var _0xa659=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x659a[_0x1e17eb];return _0x4de4c7;};'use strict';var Sequelize=require(_0xa659('0x0'));var moment=require(_0xa659('0x1'));module['exports']={'state':{'type':Sequelize[_0xa659('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa659('0x3')]},'scheduledat':{'type':Sequelize[_0xa659('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa659('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa659('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa659('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa659('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa659('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa659('0x3')]},'calleridnum':{'type':Sequelize[_0xa659('0x3')]},'calleridname':{'type':Sequelize[_0xa659('0x3')]},'starttime':{'type':Sequelize[_0xa659('0x4')]},'responsetime':{'type':Sequelize[_0xa659('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa659('0x4')]},'endtime':{'type':Sequelize[_0xa659('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa659('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa659('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa659('0x3')]},'campaign':{'type':Sequelize[_0xa659('0x3')]},'campaigntype':{'type':Sequelize[_0xa659('0x3')]},'membername':{'type':Sequelize[_0xa659('0x3')]},'reason':{'type':Sequelize[_0xa659('0x3')]},'disposition':{'type':Sequelize[_0xa659('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x36d0ea){var _0x1d2ae6=this[_0xa659('0x5')](_0xa659('0x6'));if(_0x1d2ae6&&_0x36d0ea){this['setDataValue'](_0xa659('0x7'),moment(_0x36d0ea)[_0xa659('0x8')](moment(_0x1d2ae6),_0xa659('0x9')));}return this[_0xa659('0xa')](_0xa659('0xb'),_0x36d0ea);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa659('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa659('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa659('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa659('0x4')]},'callback':{'type':Sequelize[_0xa659('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa659('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa659('0x4')]},'recallme':{'type':Sequelize[_0xa659('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa659('0x4')]}}; \ No newline at end of file +var _0x639e=['sequelize','moment','INTEGER','DATE','STRING','getDataValue','setDataValue','followuptime','seconds','dispositionat','BOOLEAN'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x639e,0x113));var _0xe639=function(_0x1f0398,_0x37a6dd){_0x1f0398=_0x1f0398-0x0;var _0x3f0ad5=_0x639e[_0x1f0398];return _0x3f0ad5;};'use strict';var Sequelize=require(_0xe639('0x0'));var moment=require(_0xe639('0x1'));module['exports']={'state':{'type':Sequelize[_0xe639('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe639('0x3')]},'countbusyretry':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe639('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe639('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe639('0x4')]},'calleridnum':{'type':Sequelize[_0xe639('0x4')]},'calleridname':{'type':Sequelize[_0xe639('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe639('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe639('0x3')]},'ringtime':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe639('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe639('0x4')]},'campaigntype':{'type':Sequelize[_0xe639('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe639('0x4')]},'disposition':{'type':Sequelize[_0xe639('0x4')]},'dispositionat':{'type':Sequelize[_0xe639('0x3')],'set':function(_0x12070d){var _0x1cbc4d=this[_0xe639('0x5')]('endtime');if(_0x1cbc4d&&_0x12070d){this[_0xe639('0x6')](_0xe639('0x7'),moment(_0x12070d)['diff'](moment(_0x1cbc4d),_0xe639('0x8')));}return this['setDataValue'](_0xe639('0x9'),_0x12070d);}},'amd':{'type':Sequelize[_0xe639('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe639('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe639('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe639('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe639('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe639('0x3')]},'deleted':{'type':Sequelize[_0xe639('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe639('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe639('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 8f4cf78..a8aa1ed 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 _0xa740=['from','cm_hopper_final','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','CmHopper','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','name','send','CmHopperFinal','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`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','`state`\x20=\x205,\x201,\x20null','busyContacts','insert','cm_hopper','phone','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId'];(function(_0x15a6fc,_0xbaa4ea){var _0x4ec20b=function(_0x19ce93){while(--_0x19ce93){_0x15a6fc['push'](_0x15a6fc['shift']());}};_0x4ec20b(++_0xbaa4ea);}(_0xa740,0x10b));var _0x0a74=function(_0x48a8db,_0x495a7b){_0x48a8db=_0x48a8db-0x0;var _0x4ec17d=_0xa740[_0x48a8db];return _0x4ec17d;};'use strict';var pdf=require(_0x0a74('0x0'));var emlformat=require(_0x0a74('0x1'));var rimraf=require(_0x0a74('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a74('0x3'));var rp=require('request-promise');var moment=require(_0x0a74('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a74('0x5'));var util=require(_0x0a74('0x6'));var path=require(_0x0a74('0x7'));var sox=require(_0x0a74('0x8'));var csv=require(_0x0a74('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a74('0xa'));var squel=require(_0x0a74('0xb'));var crypto=require('crypto');var jsforce=require(_0x0a74('0xc'));var deskjs=require(_0x0a74('0xd'));var toCsv=require(_0x0a74('0x9'));var querystring=require(_0x0a74('0xe'));var Papa=require(_0x0a74('0xf'));var Redis=require('ioredis');var authService=require(_0x0a74('0x10'));var qs=require(_0x0a74('0x11'));var hardwareService=require(_0x0a74('0x12'));var logger=require(_0x0a74('0x13'))(_0x0a74('0x14'));var utils=require(_0x0a74('0x15'));var config=require(_0x0a74('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a8864,_0x11470b){_0x11470b=_0x11470b||0xcc;return function(_0x3a6193){if(_0x3a6193){return _0x1a8864[_0x0a74('0x17')](_0x11470b);}return _0x1a8864[_0x0a74('0x18')](_0x11470b)['end']();};}function respondWithResult(_0x214b4e,_0x41c3e8){_0x41c3e8=_0x41c3e8||0xc8;return function(_0x4a440f){if(_0x4a440f){return _0x214b4e[_0x0a74('0x18')](_0x41c3e8)[_0x0a74('0x19')](_0x4a440f);}};}function respondWithFilteredResult(_0x3c5a42,_0x1ae540){return function(_0x105eb8){if(_0x105eb8){var _0x49e7ae=_0x105eb8[_0x0a74('0x1a')],_0x4be6c3=_0x1ae540[_0x0a74('0x1b')],_0x52ba5c=_0x1ae540[_0x0a74('0x1b')]+_0x1ae540[_0x0a74('0x1c')],_0x54edcb;if(_0x52ba5c>=_0x49e7ae){_0x52ba5c=_0x49e7ae;_0x54edcb=0xc8;}else{_0x54edcb=0xce;}_0x3c5a42[_0x0a74('0x18')](_0x54edcb);return _0x3c5a42[_0x0a74('0x1d')](_0x0a74('0x1e'),_0x4be6c3+'-'+_0x52ba5c+'/'+_0x49e7ae)['json'](_0x105eb8);}return null;};}function patchUpdates(_0x39880e){return function(_0xbe3954){try{jsonpatch[_0x0a74('0x1f')](_0xbe3954,_0x39880e,!![]);}catch(_0x59aabb){return BPromise[_0x0a74('0x20')](_0x59aabb);}return _0xbe3954[_0x0a74('0x21')]();};}function saveUpdates(_0x6741ae,_0x4c17f3){return function(_0x1ef99b){if(_0x1ef99b){return _0x1ef99b[_0x0a74('0x22')](_0x6741ae)[_0x0a74('0x23')](function(_0x2223e1){return _0x2223e1;});}return null;};}function removeEntity(_0x4e198c,_0x2792ca){return function(_0x1fd7d7){if(_0x1fd7d7){return _0x1fd7d7['destroy']()[_0x0a74('0x23')](function(){_0x4e198c[_0x0a74('0x18')](0xcc)[_0x0a74('0x24')]();});}};}function handleEntityNotFound(_0x1337a1,_0x356fd2){return function(_0xba4f4b){if(!_0xba4f4b){_0x1337a1['sendStatus'](0x194);}return _0xba4f4b;};}function handleError(_0x449639,_0x35d649){_0x35d649=_0x35d649||0x1f4;return function(_0x3bd5b3){logger[_0x0a74('0x25')](_0x3bd5b3['stack']);if(_0x3bd5b3[_0x0a74('0x26')]){delete _0x3bd5b3[_0x0a74('0x26')];}_0x449639[_0x0a74('0x18')](_0x35d649)[_0x0a74('0x27')](_0x3bd5b3);};}exports['index']=function(_0x5bb4e9,_0x20e867){var _0x28677d={},_0x28fbaa={},_0x3fc864={'count':0x0,'rows':[]};var _0x102730=db[_0x0a74('0x28')][_0x0a74('0x29')];_0x28fbaa[_0x0a74('0x2a')]=_[_0x0a74('0x2b')](_0x102730);_0x28fbaa[_0x0a74('0x2c')]=_[_0x0a74('0x2b')](_0x5bb4e9[_0x0a74('0x2c')]);_0x28fbaa[_0x0a74('0x2d')]=_[_0x0a74('0x2e')](_0x28fbaa[_0x0a74('0x2a')],_0x28fbaa['query']);_0x28677d[_0x0a74('0x2f')]=_[_0x0a74('0x2e')](_0x28fbaa[_0x0a74('0x2a')],qs[_0x0a74('0x30')](_0x5bb4e9[_0x0a74('0x2c')][_0x0a74('0x30')]));_0x28677d[_0x0a74('0x2f')]=_0x28677d[_0x0a74('0x2f')][_0x0a74('0x31')]?_0x28677d[_0x0a74('0x2f')]:_0x28fbaa[_0x0a74('0x2a')];if(!_0x5bb4e9[_0x0a74('0x2c')][_0x0a74('0x32')](_0x0a74('0x33'))){_0x28677d[_0x0a74('0x1c')]=qs[_0x0a74('0x1c')](_0x5bb4e9['query'][_0x0a74('0x1c')]);_0x28677d[_0x0a74('0x1b')]=qs['offset'](_0x5bb4e9[_0x0a74('0x2c')][_0x0a74('0x1b')]);}_0x28677d[_0x0a74('0x34')]=qs[_0x0a74('0x35')](_0x5bb4e9[_0x0a74('0x2c')]['sort']);_0x28677d[_0x0a74('0x36')]=qs[_0x0a74('0x2d')](_[_0x0a74('0x37')](_0x5bb4e9[_0x0a74('0x2c')],_0x28fbaa[_0x0a74('0x2d')]));if(_0x5bb4e9[_0x0a74('0x2c')]['filter']){_0x28677d[_0x0a74('0x36')]=_[_0x0a74('0x38')](_0x28677d[_0x0a74('0x36')],{'$or':_[_0x0a74('0x39')](_0x102730,function(_0x2fb585){if(_0x2fb585['type']['key']!==_0x0a74('0x3a')){var _0x15b912={};_0x15b912[_0x2fb585['field']]={'$like':'%'+_0x5bb4e9[_0x0a74('0x2c')][_0x0a74('0x3b')]+'%'};return _0x15b912;}})});}_0x28677d=_[_0x0a74('0x38')]({},_0x28677d,_0x5bb4e9[_0x0a74('0x3c')]);var _0x3eca0b={'where':_0x28677d[_0x0a74('0x36')]};return db['CmHopperFinal'][_0x0a74('0x1a')](_0x3eca0b)['then'](function(_0x5c7bb3){_0x3fc864['count']=_0x5c7bb3;if(_0x5bb4e9[_0x0a74('0x2c')][_0x0a74('0x3d')]){_0x28677d[_0x0a74('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0a74('0x3f')](_0x28677d);})['then'](function(_0x281b3b){_0x3fc864[_0x0a74('0x40')]=_0x281b3b;return _0x3fc864;})[_0x0a74('0x23')](respondWithFilteredResult(_0x20e867,_0x28677d))[_0x0a74('0x41')](handleError(_0x20e867,null));};exports[_0x0a74('0x42')]=function(_0xdbc992,_0x5de20f){var _0x4a9f93={'raw':!![],'where':{'id':_0xdbc992[_0x0a74('0x43')]['id']}},_0x17ef8f={};_0x17ef8f[_0x0a74('0x2a')]=_['keys'](db['CmHopperFinal'][_0x0a74('0x29')]);_0x17ef8f['query']=_[_0x0a74('0x2b')](_0xdbc992[_0x0a74('0x2c')]);_0x17ef8f[_0x0a74('0x2d')]=_[_0x0a74('0x2e')](_0x17ef8f[_0x0a74('0x2a')],_0x17ef8f[_0x0a74('0x2c')]);_0x4a9f93[_0x0a74('0x2f')]=_[_0x0a74('0x2e')](_0x17ef8f[_0x0a74('0x2a')],qs[_0x0a74('0x30')](_0xdbc992[_0x0a74('0x2c')][_0x0a74('0x30')]));_0x4a9f93[_0x0a74('0x2f')]=_0x4a9f93['attributes'][_0x0a74('0x31')]?_0x4a9f93[_0x0a74('0x2f')]:_0x17ef8f[_0x0a74('0x2a')];if(_0xdbc992['query']['includeAll']){_0x4a9f93[_0x0a74('0x3e')]=[{'all':!![]}];}_0x4a9f93=_[_0x0a74('0x38')]({},_0x4a9f93,_0xdbc992[_0x0a74('0x3c')]);return db[_0x0a74('0x28')]['find'](_0x4a9f93)[_0x0a74('0x23')](handleEntityNotFound(_0x5de20f,null))[_0x0a74('0x23')](respondWithResult(_0x5de20f,null))['catch'](handleError(_0x5de20f,null));};exports[_0x0a74('0x44')]=function(_0x22c8de,_0x5d21bb){return db[_0x0a74('0x28')][_0x0a74('0x44')]()[_0x0a74('0x23')](respondWithResult(_0x5d21bb,null))['catch'](handleError(_0x5d21bb,null));};exports[_0x0a74('0x22')]=function(_0x4e8242,_0x3593c3){if(_0x4e8242[_0x0a74('0x45')][_0x0a74('0x46')]){delete _0x4e8242[_0x0a74('0x45')]['uniqueid'];}return db['CmHopperFinal'][_0x0a74('0x47')]({'where':{'uniqueid':_0x4e8242[_0x0a74('0x43')]['id']}})[_0x0a74('0x23')](handleEntityNotFound(_0x3593c3,null))['then'](saveUpdates(_0x4e8242[_0x0a74('0x45')],null))['then'](respondWithResult(_0x3593c3,null))['catch'](handleError(_0x3593c3,null));};exports[_0x0a74('0x48')]=function(_0x57082e,_0x543f8b,_0x1c4a53){return db[_0x0a74('0x28')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x57082e['params']['id']},'attributes':[[db['sequelize']['fn'](_0x0a74('0x49'),db['sequelize']['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x4c')))),_0x0a74('0x4d')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x4e')))),_0x0a74('0x4f')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db['sequelize']['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x50')))),_0x0a74('0x51')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db['sequelize']['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x52')))),_0x0a74('0x53')],[db['sequelize']['fn'](_0x0a74('0x49'),db['sequelize']['fn']('IF',db[_0x0a74('0x4a')]['literal'](_0x0a74('0x54')))),_0x0a74('0x55')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db['sequelize']['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x56')))),_0x0a74('0x57')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db['sequelize'][_0x0a74('0x4b')](_0x0a74('0x58')))),_0x0a74('0x59')]]})[_0x0a74('0x23')](handleEntityNotFound(_0x543f8b,null))[_0x0a74('0x23')](respondWithResult(_0x543f8b,null))[_0x0a74('0x41')](handleError(_0x543f8b,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x2e2c61,_0x2b112d,_0x2cb9fc){return db[_0x0a74('0x28')][_0x0a74('0x3f')]({'raw':![],'where':{'CampaignId':_0x2e2c61[_0x0a74('0x43')]['id']},'attributes':[[db[_0x0a74('0x4a')]['fn']('COUNT',db[_0x0a74('0x4a')]['fn']('IF',db['sequelize'][_0x0a74('0x4b')](_0x0a74('0x4c')))),_0x0a74('0x4d')],[db[_0x0a74('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x0a74('0x4b')](_0x0a74('0x4e')))),_0x0a74('0x4f')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x0a74('0x5a')))),_0x0a74('0x5b')],[db['sequelize']['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db['sequelize'][_0x0a74('0x4b')](_0x0a74('0x50')))),_0x0a74('0x51')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x0a74('0x52')))),_0x0a74('0x53')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db[_0x0a74('0x4a')]['literal'](_0x0a74('0x54')))),_0x0a74('0x55')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x56')))),_0x0a74('0x57')],[db[_0x0a74('0x4a')]['fn'](_0x0a74('0x49'),db[_0x0a74('0x4a')]['fn']('IF',db[_0x0a74('0x4a')][_0x0a74('0x4b')](_0x0a74('0x58')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x2b112d,null))[_0x0a74('0x23')](respondWithResult(_0x2b112d,null))['catch'](handleError(_0x2b112d,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x16c789,_0x4a1c52,_0x1934b1){return db['VoiceQueue'][_0x0a74('0x47')]({'where':{'id':_0x16c789[_0x0a74('0x43')]['id']}})[_0x0a74('0x23')](handleEntityNotFound(_0x4a1c52,null))[_0x0a74('0x23')](function(_0x57f5ee){var _0x55e51e;if(_0x57f5ee){_0x55e51e=squel[_0x0a74('0x5c')]()['into'](_0x0a74('0x5d'))['fromQuery']([_0x0a74('0x5e'),_0x0a74('0x5f'),_0x0a74('0x60'),'ListId','VoiceQueueId',_0x0a74('0x61'),_0x0a74('0x62')],squel[_0x0a74('0x63')]()['field'](_0x0a74('0x64'),_0x0a74('0x5e'))[_0x0a74('0x65')](_0x0a74('0x66'),_0x0a74('0x5f'))[_0x0a74('0x65')](_0x0a74('0x67'),_0x0a74('0x60'))[_0x0a74('0x65')](_0x0a74('0x68'),_0x0a74('0x69'))['field'](_0x0a74('0x6a'),_0x0a74('0x6b'))[_0x0a74('0x65')](_0x0a74('0x66'),_0x0a74('0x61'))[_0x0a74('0x65')]('NOW()',_0x0a74('0x62'))[_0x0a74('0x6c')](_0x0a74('0x6d'))[_0x0a74('0x36')]('VoiceQueueId\x20=\x20?',_0x16c789[_0x0a74('0x43')]['id']['toString']())[_0x0a74('0x36')](_0x0a74('0x6e'),_0x16c789['body'][_0x0a74('0x6f')][_0x0a74('0x70')]())[_0x0a74('0x36')](_0x0a74('0x71'))[_0x0a74('0x36')](_0x0a74('0x72'),squel['select']()[_0x0a74('0x65')](_0x0a74('0x5e'))['from'](_0x0a74('0x5d'))[_0x0a74('0x36')]('VoiceQueueId\x20=\x20?',_0x16c789[_0x0a74('0x43')]['id'][_0x0a74('0x70')]()))['where'](_0x0a74('0x72'),squel[_0x0a74('0x63')]()[_0x0a74('0x65')](_0x0a74('0x73'))[_0x0a74('0x6c')](_0x0a74('0x6d'))['where'](_0x0a74('0x74'),_0x16c789[_0x0a74('0x43')]['id'][_0x0a74('0x70')]())[_0x0a74('0x36')]('state\x20=\x204'))['group']('ContactId'))[_0x0a74('0x70')]();return db['sequelize'][_0x0a74('0x2c')](_0x55e51e);}return[];})[_0x0a74('0x23')](respondWithResult(_0x4a1c52,null))[_0x0a74('0x41')](handleError(_0x4a1c52,null));};exports[_0x0a74('0x75')]=function(_0x754f87,_0x2afc3b,_0x43ec94){return db[_0x0a74('0x76')]['find']({'where':{'id':_0x754f87['params']['id']}})[_0x0a74('0x23')](handleEntityNotFound(_0x2afc3b,null))[_0x0a74('0x23')](function(_0x32134c){var _0x21455d;if(_0x32134c){_0x21455d=squel[_0x0a74('0x5c')]()[_0x0a74('0x77')](_0x0a74('0x5d'))['fromQuery']([_0x0a74('0x5e'),_0x0a74('0x5f'),'ContactId',_0x0a74('0x69'),_0x0a74('0x78'),_0x0a74('0x61'),_0x0a74('0x62')],squel['select']()[_0x0a74('0x65')](_0x0a74('0x64'),_0x0a74('0x5e'))[_0x0a74('0x65')](_0x0a74('0x66'),_0x0a74('0x5f'))[_0x0a74('0x65')](_0x0a74('0x67'),_0x0a74('0x60'))[_0x0a74('0x65')](_0x0a74('0x68'),_0x0a74('0x69'))[_0x0a74('0x65')](_0x0a74('0x79'),_0x0a74('0x78'))[_0x0a74('0x65')](_0x0a74('0x66'),_0x0a74('0x61'))[_0x0a74('0x65')](_0x0a74('0x66'),_0x0a74('0x62'))[_0x0a74('0x6c')](_0x0a74('0x6d'))[_0x0a74('0x36')](_0x0a74('0x7a'),_0x754f87[_0x0a74('0x43')]['id']['toString']())[_0x0a74('0x36')](_0x0a74('0x6e'),_0x754f87['body'][_0x0a74('0x6f')][_0x0a74('0x70')]())[_0x0a74('0x36')](_0x0a74('0x71'))[_0x0a74('0x36')](_0x0a74('0x72'),squel[_0x0a74('0x63')]()['field'](_0x0a74('0x5e'))[_0x0a74('0x6c')](_0x0a74('0x5d'))[_0x0a74('0x36')](_0x0a74('0x7a'),_0x754f87[_0x0a74('0x43')]['id'][_0x0a74('0x70')]()))[_0x0a74('0x36')](_0x0a74('0x72'),squel['select']()[_0x0a74('0x65')](_0x0a74('0x73'))[_0x0a74('0x6c')]('cm_hopper_final')[_0x0a74('0x36')](_0x0a74('0x7a'),_0x754f87[_0x0a74('0x43')]['id']['toString']())[_0x0a74('0x36')](_0x0a74('0x7b')))['group'](_0x0a74('0x60')))[_0x0a74('0x70')]();return db[_0x0a74('0x4a')][_0x0a74('0x2c')](_0x21455d);}return[];})['then'](respondWithResult(_0x2afc3b,null))[_0x0a74('0x41')](handleError(_0x2afc3b,null));};exports['checkContactHopper']=function(_0x1d7ec4,_0x16e774,_0x1b8e0a){return db[_0x0a74('0x7c')]['findOne']({'where':{'VoiceQueueId':_0x1d7ec4['body'][_0x0a74('0x6b')],'CampaignId':_0x1d7ec4[_0x0a74('0x45')][_0x0a74('0x78')],'ContactId':_0x1d7ec4[_0x0a74('0x45')][_0x0a74('0x60')]}})['then'](handleEntityNotFound(_0x16e774,null))[_0x0a74('0x23')](function(_0x55ec3c){if(_0x55ec3c){return _0x55ec3c;}return null;})['then'](respondWithResult(_0x16e774,null))[_0x0a74('0x41')](handleError(_0x16e774,null));}; \ No newline at end of file +var _0x17ce=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','catch','show','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','params','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ContactId','field','ANY_VALUE(ListId)','ListId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','createdAt','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','fast-json-patch','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','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','model','keys'];(function(_0x2a1fcf,_0x48809f){var _0x4ec411=function(_0x361f83){while(--_0x361f83){_0x2a1fcf['push'](_0x2a1fcf['shift']());}};_0x4ec411(++_0x48809f);}(_0x17ce,0x1cd));var _0xe17c=function(_0x2a56a1,_0x1f553a){_0x2a56a1=_0x2a56a1-0x0;var _0xc92e24=_0x17ce[_0x2a56a1];return _0xc92e24;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe17c('0x0'));var rimraf=require(_0xe17c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe17c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe17c('0x3'));var Mustache=require(_0xe17c('0x4'));var util=require(_0xe17c('0x5'));var path=require(_0xe17c('0x6'));var sox=require(_0xe17c('0x7'));var csv=require(_0xe17c('0x8'));var ejs=require(_0xe17c('0x9'));var fs=require('fs');var _=require(_0xe17c('0xa'));var squel=require(_0xe17c('0xb'));var crypto=require(_0xe17c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe17c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe17c('0xe'));var Papa=require(_0xe17c('0xf'));var Redis=require('ioredis');var authService=require(_0xe17c('0x10'));var qs=require(_0xe17c('0x11'));var hardwareService=require(_0xe17c('0x12'));var logger=require(_0xe17c('0x13'))(_0xe17c('0x14'));var utils=require('../../config/utils');var config=require(_0xe17c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dee77,_0x969a7c){_0x969a7c=_0x969a7c||0xcc;return function(_0x45e2ce){if(_0x45e2ce){return _0x4dee77[_0xe17c('0x16')](_0x969a7c);}return _0x4dee77[_0xe17c('0x17')](_0x969a7c)[_0xe17c('0x18')]();};}function respondWithResult(_0x31041d,_0x179f06){_0x179f06=_0x179f06||0xc8;return function(_0x4f2b01){if(_0x4f2b01){return _0x31041d['status'](_0x179f06)[_0xe17c('0x19')](_0x4f2b01);}};}function respondWithFilteredResult(_0x12343c,_0x4e8991){return function(_0x18ed3a){if(_0x18ed3a){var _0x44548d=_0x18ed3a[_0xe17c('0x1a')],_0x209c60=_0x4e8991['offset'],_0xc081ef=_0x4e8991[_0xe17c('0x1b')]+_0x4e8991[_0xe17c('0x1c')],_0x62bb3c;if(_0xc081ef>=_0x44548d){_0xc081ef=_0x44548d;_0x62bb3c=0xc8;}else{_0x62bb3c=0xce;}_0x12343c['status'](_0x62bb3c);return _0x12343c['set']('Content-Range',_0x209c60+'-'+_0xc081ef+'/'+_0x44548d)[_0xe17c('0x19')](_0x18ed3a);}return null;};}function patchUpdates(_0x39c53f){return function(_0x854cc0){try{jsonpatch[_0xe17c('0x1d')](_0x854cc0,_0x39c53f,!![]);}catch(_0x5b3f58){return BPromise['reject'](_0x5b3f58);}return _0x854cc0[_0xe17c('0x1e')]();};}function saveUpdates(_0x53ab98,_0x38d117){return function(_0x3f9537){if(_0x3f9537){return _0x3f9537[_0xe17c('0x1f')](_0x53ab98)[_0xe17c('0x20')](function(_0x316dcd){return _0x316dcd;});}return null;};}function removeEntity(_0x534b48,_0x151bb5){return function(_0x5a63c2){if(_0x5a63c2){return _0x5a63c2[_0xe17c('0x21')]()['then'](function(){_0x534b48['status'](0xcc)[_0xe17c('0x18')]();});}};}function handleEntityNotFound(_0x16cc72,_0x20ab68){return function(_0x209955){if(!_0x209955){_0x16cc72[_0xe17c('0x16')](0x194);}return _0x209955;};}function handleError(_0x48ebf3,_0x1e37f3){_0x1e37f3=_0x1e37f3||0x1f4;return function(_0x561788){logger[_0xe17c('0x22')](_0x561788[_0xe17c('0x23')]);if(_0x561788[_0xe17c('0x24')]){delete _0x561788['name'];}_0x48ebf3[_0xe17c('0x17')](_0x1e37f3)[_0xe17c('0x25')](_0x561788);};}exports[_0xe17c('0x26')]=function(_0x2a0d0f,_0x3216ab){var _0x3964c2={},_0x2bd447={},_0x3e6c38={'count':0x0,'rows':[]};var _0x588561=db[_0xe17c('0x27')][_0xe17c('0x28')];_0x2bd447[_0xe17c('0x29')]=_[_0xe17c('0x2a')](_0x588561);_0x2bd447[_0xe17c('0x2b')]=_['keys'](_0x2a0d0f[_0xe17c('0x2b')]);_0x2bd447[_0xe17c('0x2c')]=_[_0xe17c('0x2d')](_0x2bd447[_0xe17c('0x29')],_0x2bd447[_0xe17c('0x2b')]);_0x3964c2[_0xe17c('0x2e')]=_[_0xe17c('0x2d')](_0x2bd447[_0xe17c('0x29')],qs['fields'](_0x2a0d0f[_0xe17c('0x2b')][_0xe17c('0x2f')]));_0x3964c2[_0xe17c('0x2e')]=_0x3964c2[_0xe17c('0x2e')][_0xe17c('0x30')]?_0x3964c2[_0xe17c('0x2e')]:_0x2bd447['model'];if(!_0x2a0d0f[_0xe17c('0x2b')][_0xe17c('0x31')](_0xe17c('0x32'))){_0x3964c2[_0xe17c('0x1c')]=qs[_0xe17c('0x1c')](_0x2a0d0f[_0xe17c('0x2b')][_0xe17c('0x1c')]);_0x3964c2['offset']=qs[_0xe17c('0x1b')](_0x2a0d0f[_0xe17c('0x2b')]['offset']);}_0x3964c2[_0xe17c('0x33')]=qs[_0xe17c('0x34')](_0x2a0d0f[_0xe17c('0x2b')][_0xe17c('0x34')]);_0x3964c2[_0xe17c('0x35')]=qs[_0xe17c('0x2c')](_[_0xe17c('0x36')](_0x2a0d0f[_0xe17c('0x2b')],_0x2bd447[_0xe17c('0x2c')]));if(_0x2a0d0f[_0xe17c('0x2b')][_0xe17c('0x37')]){_0x3964c2[_0xe17c('0x35')]=_[_0xe17c('0x38')](_0x3964c2[_0xe17c('0x35')],{'$or':_[_0xe17c('0x39')](_0x588561,function(_0x307b3f){if(_0x307b3f[_0xe17c('0x3a')][_0xe17c('0x3b')]!==_0xe17c('0x3c')){var _0x22d308={};_0x22d308[_0x307b3f['field']]={'$like':'%'+_0x2a0d0f[_0xe17c('0x2b')][_0xe17c('0x37')]+'%'};return _0x22d308;}})});}_0x3964c2=_[_0xe17c('0x38')]({},_0x3964c2,_0x2a0d0f[_0xe17c('0x3d')]);var _0x568185={'where':_0x3964c2[_0xe17c('0x35')]};return db['CmHopperFinal'][_0xe17c('0x1a')](_0x568185)[_0xe17c('0x20')](function(_0x3083d4){_0x3e6c38[_0xe17c('0x1a')]=_0x3083d4;if(_0x2a0d0f['query'][_0xe17c('0x3e')]){_0x3964c2[_0xe17c('0x3f')]=[{'all':!![]}];}return db[_0xe17c('0x27')][_0xe17c('0x40')](_0x3964c2);})['then'](function(_0x122978){_0x3e6c38['rows']=_0x122978;return _0x3e6c38;})[_0xe17c('0x20')](respondWithFilteredResult(_0x3216ab,_0x3964c2))[_0xe17c('0x41')](handleError(_0x3216ab,null));};exports[_0xe17c('0x42')]=function(_0x3e9cb6,_0x49cb2d){var _0x4cef5a={'raw':!![],'where':{'id':_0x3e9cb6['params']['id']}},_0x6297f0={};_0x6297f0[_0xe17c('0x29')]=_[_0xe17c('0x2a')](db[_0xe17c('0x27')][_0xe17c('0x28')]);_0x6297f0[_0xe17c('0x2b')]=_[_0xe17c('0x2a')](_0x3e9cb6[_0xe17c('0x2b')]);_0x6297f0[_0xe17c('0x2c')]=_['intersection'](_0x6297f0['model'],_0x6297f0['query']);_0x4cef5a['attributes']=_['intersection'](_0x6297f0[_0xe17c('0x29')],qs[_0xe17c('0x2f')](_0x3e9cb6['query'][_0xe17c('0x2f')]));_0x4cef5a['attributes']=_0x4cef5a[_0xe17c('0x2e')][_0xe17c('0x30')]?_0x4cef5a[_0xe17c('0x2e')]:_0x6297f0[_0xe17c('0x29')];if(_0x3e9cb6['query'][_0xe17c('0x3e')]){_0x4cef5a['include']=[{'all':!![]}];}_0x4cef5a=_['merge']({},_0x4cef5a,_0x3e9cb6['options']);return db[_0xe17c('0x27')][_0xe17c('0x43')](_0x4cef5a)[_0xe17c('0x20')](handleEntityNotFound(_0x49cb2d,null))[_0xe17c('0x20')](respondWithResult(_0x49cb2d,null))[_0xe17c('0x41')](handleError(_0x49cb2d,null));};exports[_0xe17c('0x44')]=function(_0x58b465,_0x52f36a){return db[_0xe17c('0x27')][_0xe17c('0x44')]()[_0xe17c('0x20')](respondWithResult(_0x52f36a,null))[_0xe17c('0x41')](handleError(_0x52f36a,null));};exports['update']=function(_0x3617cd,_0x403245){if(_0x3617cd['body'][_0xe17c('0x45')]){delete _0x3617cd['body'][_0xe17c('0x45')];}return db[_0xe17c('0x27')][_0xe17c('0x43')]({'where':{'uniqueid':_0x3617cd['params']['id']}})[_0xe17c('0x20')](handleEntityNotFound(_0x403245,null))[_0xe17c('0x20')](saveUpdates(_0x3617cd[_0xe17c('0x46')],null))[_0xe17c('0x20')](respondWithResult(_0x403245,null))[_0xe17c('0x41')](handleError(_0x403245,null));};exports[_0xe17c('0x47')]=function(_0x58ce1e,_0xf081ef,_0x274c4a){return db[_0xe17c('0x27')][_0xe17c('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x58ce1e[_0xe17c('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0xe17c('0x49'),db['sequelize']['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')](_0xe17c('0x4c')))),_0xe17c('0x4d')],[db[_0xe17c('0x4a')]['fn']('COUNT',db[_0xe17c('0x4a')]['fn']('IF',db['sequelize'][_0xe17c('0x4b')](_0xe17c('0x4e')))),_0xe17c('0x4f')],[db[_0xe17c('0x4a')]['fn'](_0xe17c('0x49'),db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')](_0xe17c('0x50')))),_0xe17c('0x51')],[db[_0xe17c('0x4a')]['fn'](_0xe17c('0x49'),db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xe17c('0x52')],[db[_0xe17c('0x4a')]['fn'](_0xe17c('0x49'),db[_0xe17c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0xe17c('0x53')))),_0xe17c('0x54')],[db[_0xe17c('0x4a')]['fn'](_0xe17c('0x49'),db['sequelize']['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xe17c('0x49'),db['sequelize']['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')](_0xe17c('0x55')))),_0xe17c('0x56')],[db['sequelize']['fn'](_0xe17c('0x49'),db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')]['literal'](_0xe17c('0x57')))),'answeringMachine']]})[_0xe17c('0x20')](handleEntityNotFound(_0xf081ef,null))[_0xe17c('0x20')](respondWithResult(_0xf081ef,null))[_0xe17c('0x41')](handleError(_0xf081ef,null));};exports[_0xe17c('0x58')]=function(_0x27670f,_0x3952d4,_0x1856fd){return db[_0xe17c('0x27')][_0xe17c('0x40')]({'raw':![],'where':{'CampaignId':_0x27670f[_0xe17c('0x48')]['id']},'attributes':[[db[_0xe17c('0x4a')]['fn'](_0xe17c('0x49'),db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')](_0xe17c('0x4c')))),_0xe17c('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe17c('0x4a')]['literal'](_0xe17c('0x4e')))),'noAnswerContacts'],[db[_0xe17c('0x4a')]['fn'](_0xe17c('0x49'),db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')]['literal'](_0xe17c('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0xe17c('0x49'),db['sequelize']['fn']('IF',db[_0xe17c('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0xe17c('0x4a')]['fn']('COUNT',db[_0xe17c('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xe17c('0x54')],[db['sequelize']['fn']('COUNT',db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')](_0xe17c('0x59')))),_0xe17c('0x5a')],[db[_0xe17c('0x4a')]['fn']('COUNT',db[_0xe17c('0x4a')]['fn']('IF',db[_0xe17c('0x4a')]['literal'](_0xe17c('0x55')))),_0xe17c('0x56')],[db['sequelize']['fn'](_0xe17c('0x49'),db['sequelize']['fn']('IF',db[_0xe17c('0x4a')][_0xe17c('0x4b')](_0xe17c('0x57')))),'answeringMachine']]})[_0xe17c('0x20')](handleEntityNotFound(_0x3952d4,null))['then'](respondWithResult(_0x3952d4,null))[_0xe17c('0x41')](handleError(_0x3952d4,null));};exports[_0xe17c('0x5b')]=function(_0x47ed79,_0x49877d,_0x47b647){return db[_0xe17c('0x5c')][_0xe17c('0x43')]({'where':{'id':_0x47ed79[_0xe17c('0x48')]['id']}})[_0xe17c('0x20')](handleEntityNotFound(_0x49877d,null))['then'](function(_0x26a1f1){var _0x12e19a;if(_0x26a1f1){_0x12e19a=squel[_0xe17c('0x5d')]()[_0xe17c('0x5e')](_0xe17c('0x5f'))[_0xe17c('0x60')]([_0xe17c('0x61'),_0xe17c('0x62'),'ContactId','ListId',_0xe17c('0x63'),'createdAt',_0xe17c('0x64')],squel[_0xe17c('0x65')]()['field'](_0xe17c('0x66'),_0xe17c('0x61'))['field'](_0xe17c('0x67'),_0xe17c('0x62'))['field'](_0xe17c('0x68'),_0xe17c('0x69'))[_0xe17c('0x6a')](_0xe17c('0x6b'),_0xe17c('0x6c'))['field']('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0xe17c('0x6a')]('NOW()','createdAt')[_0xe17c('0x6a')](_0xe17c('0x67'),_0xe17c('0x64'))[_0xe17c('0x6d')]('cm_hopper_final')[_0xe17c('0x35')](_0xe17c('0x6e'),_0x47ed79[_0xe17c('0x48')]['id'][_0xe17c('0x6f')]())[_0xe17c('0x35')](_0xe17c('0x70'),_0x47ed79[_0xe17c('0x46')][_0xe17c('0x71')]['toString']())['where'](_0xe17c('0x72'))[_0xe17c('0x35')](_0xe17c('0x73'),squel[_0xe17c('0x65')]()[_0xe17c('0x6a')](_0xe17c('0x61'))['from'](_0xe17c('0x5f'))[_0xe17c('0x35')](_0xe17c('0x6e'),_0x47ed79[_0xe17c('0x48')]['id'][_0xe17c('0x6f')]()))[_0xe17c('0x35')](_0xe17c('0x73'),squel[_0xe17c('0x65')]()[_0xe17c('0x6a')]('calleridnum')['from'](_0xe17c('0x74'))[_0xe17c('0x35')]('VoiceQueueId\x20=\x20?',_0x47ed79['params']['id'][_0xe17c('0x6f')]())['where'](_0xe17c('0x75')))['group'](_0xe17c('0x69')))[_0xe17c('0x6f')]();return db[_0xe17c('0x4a')]['query'](_0x12e19a);}return[];})[_0xe17c('0x20')](respondWithResult(_0x49877d,null))['catch'](handleError(_0x49877d,null));};exports[_0xe17c('0x76')]=function(_0x1fbb9a,_0x323eac,_0x2715ec){return db['Campaign']['find']({'where':{'id':_0x1fbb9a[_0xe17c('0x48')]['id']}})[_0xe17c('0x20')](handleEntityNotFound(_0x323eac,null))[_0xe17c('0x20')](function(_0x199fd0){var _0x1e60da;if(_0x199fd0){_0x1e60da=squel['insert']()[_0xe17c('0x5e')](_0xe17c('0x5f'))[_0xe17c('0x60')]([_0xe17c('0x61'),_0xe17c('0x62'),'ContactId','ListId',_0xe17c('0x77'),_0xe17c('0x78'),'updatedAt'],squel[_0xe17c('0x65')]()[_0xe17c('0x6a')](_0xe17c('0x66'),_0xe17c('0x61'))[_0xe17c('0x6a')](_0xe17c('0x67'),_0xe17c('0x62'))[_0xe17c('0x6a')](_0xe17c('0x68'),_0xe17c('0x69'))[_0xe17c('0x6a')](_0xe17c('0x6b'),_0xe17c('0x6c'))[_0xe17c('0x6a')]('ANY_VALUE(CampaignId)','CampaignId')[_0xe17c('0x6a')](_0xe17c('0x67'),'createdAt')[_0xe17c('0x6a')](_0xe17c('0x67'),'updatedAt')['from'](_0xe17c('0x74'))[_0xe17c('0x35')](_0xe17c('0x79'),_0x1fbb9a[_0xe17c('0x48')]['id'][_0xe17c('0x6f')]())['where'](_0xe17c('0x70'),_0x1fbb9a[_0xe17c('0x46')]['state']['toString']())[_0xe17c('0x35')](_0xe17c('0x72'))[_0xe17c('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xe17c('0x65')]()['field']('phone')['from']('cm_hopper')[_0xe17c('0x35')](_0xe17c('0x79'),_0x1fbb9a['params']['id'][_0xe17c('0x6f')]()))[_0xe17c('0x35')](_0xe17c('0x73'),squel[_0xe17c('0x65')]()[_0xe17c('0x6a')](_0xe17c('0x7a'))[_0xe17c('0x6d')](_0xe17c('0x74'))[_0xe17c('0x35')](_0xe17c('0x79'),_0x1fbb9a[_0xe17c('0x48')]['id'][_0xe17c('0x6f')]())[_0xe17c('0x35')](_0xe17c('0x75')))['group'](_0xe17c('0x69')))[_0xe17c('0x6f')]();return db['sequelize'][_0xe17c('0x2b')](_0x1e60da);}return[];})[_0xe17c('0x20')](respondWithResult(_0x323eac,null))[_0xe17c('0x41')](handleError(_0x323eac,null));};exports[_0xe17c('0x7b')]=function(_0x273e10,_0x318533,_0x465ad3){return db[_0xe17c('0x7c')][_0xe17c('0x7d')]({'where':{'VoiceQueueId':_0x273e10[_0xe17c('0x46')]['VoiceQueueId'],'CampaignId':_0x273e10['body'][_0xe17c('0x77')],'ContactId':_0x273e10[_0xe17c('0x46')]['ContactId']}})[_0xe17c('0x20')](handleEntityNotFound(_0x318533,null))[_0xe17c('0x20')](function(_0xd95500){if(_0xd95500){return _0xd95500;}return null;})[_0xe17c('0x20')](respondWithResult(_0x318533,null))['catch'](handleError(_0x318533,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 74a817b..333b660 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 _0x1312=['cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x1d72c4,_0x28b82){var _0x522637=function(_0x42fad0){while(--_0x42fad0){_0x1d72c4['push'](_0x1d72c4['shift']());}};_0x522637(++_0x28b82);}(_0x1312,0x153));var _0x2131=function(_0x57b4ff,_0x3f3be0){_0x57b4ff=_0x57b4ff-0x0;var _0x28642e=_0x1312[_0x57b4ff];return _0x28642e;};'use strict';var _=require('lodash');var util=require(_0x2131('0x0'));var logger=require(_0x2131('0x1'))(_0x2131('0x2'));var moment=require(_0x2131('0x3'));var BPromise=require(_0x2131('0x4'));var rp=require(_0x2131('0x5'));var fs=require('fs');var path=require(_0x2131('0x6'));var rimraf=require(_0x2131('0x7'));var config=require(_0x2131('0x8'));var attributes=require(_0x2131('0x9'));module['exports']=function(_0x5542cb,_0x3df784){return _0x5542cb[_0x2131('0xa')]('CmHopperFinal',attributes,{'tableName':_0x2131('0xb'),'paranoid':![],'indexes':[{'name':_0x2131('0xc'),'fields':['calleridnum']},{'name':_0x2131('0xd'),'fields':[_0x2131('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf789=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','api','moment','request-promise'];(function(_0x4ef747,_0x540897){var _0x477551=function(_0x1e86cf){while(--_0x1e86cf){_0x4ef747['push'](_0x4ef747['shift']());}};_0x477551(++_0x540897);}(_0xf789,0xb2));var _0x9f78=function(_0x25ef2b,_0x49717f){_0x25ef2b=_0x25ef2b-0x0;var _0x23f023=_0xf789[_0x25ef2b];return _0x23f023;};'use strict';var _=require(_0x9f78('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f78('0x1'));var moment=require(_0x9f78('0x2'));var BPromise=require('bluebird');var rp=require(_0x9f78('0x3'));var fs=require('fs');var path=require(_0x9f78('0x4'));var rimraf=require(_0x9f78('0x5'));var config=require(_0x9f78('0x6'));var attributes=require(_0x9f78('0x7'));module[_0x9f78('0x8')]=function(_0x4b7396,_0x1ab24f){return _0x4b7396[_0x9f78('0x9')](_0x9f78('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x9f78('0xb'),'fields':[_0x9f78('0xb')]},{'name':_0x9f78('0xc'),'fields':[_0x9f78('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index da32346..2e8900d 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 _0xb58b=['jayson/promise','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2faeed,_0x1ca128){var _0x2bdf21=function(_0x2faf30){while(--_0x2faf30){_0x2faeed['push'](_0x2faeed['shift']());}};_0x2bdf21(++_0x1ca128);}(_0xb58b,0x1f1));var _0xbb58=function(_0xdb7af,_0x324719){_0xdb7af=_0xdb7af-0x0;var _0x2527b0=_0xb58b[_0xdb7af];return _0x2527b0;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')](_0x3134ea[_0xbb58('0x17')],{'raw':_0x3134ea[_0xbb58('0x18')]?_0x3134ea[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![]})[_0xbb58('0xa')](function(_0x497fd0){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1a')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x497fd0));_0xbee66(_0x497fd0);})[_0xbb58('0x1b')](function(_0x49453a){logger[_0xbb58('0x10')](_0xbb58('0x14'),_0x49453a['message'],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x49453a['message']));});});}; \ No newline at end of file +var _0x70e0=['options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body'];(function(_0x56448a,_0x2f4103){var _0x443eb7=function(_0x58b0c5){while(--_0x58b0c5){_0x56448a['push'](_0x56448a['shift']());}};_0x443eb7(++_0x2f4103);}(_0x70e0,0x17b));var _0x070e=function(_0x15cdac,_0x567bed){_0x15cdac=_0x15cdac-0x0;var _0x1d7d30=_0x70e0[_0x15cdac];return _0x1d7d30;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}exports[_0x070e('0x16')]=function(_0x38f6e6){var _0x2060cc=this;return new Promise(function(_0x364b3f,_0x5037eb){return db[_0x070e('0x17')][_0x070e('0x18')](_0x38f6e6[_0x070e('0x19')],{'raw':_0x38f6e6[_0x070e('0x1a')]?_0x38f6e6[_0x070e('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4e958f){logger[_0x070e('0xb')](_0x070e('0x16'),_0x38f6e6);logger[_0x070e('0xc')]('CreateCmHopperFinal',_0x38f6e6,JSON[_0x070e('0xf')](_0x4e958f));_0x364b3f(_0x4e958f);})['catch'](function(_0xf8dd5d){logger[_0x070e('0x10')](_0x070e('0x16'),_0xf8dd5d[_0x070e('0x13')],_0x38f6e6);_0x5037eb(_0x2060cc[_0x070e('0x10')](0x1f4,_0xf8dd5d[_0x070e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index db88e21..19c81fd 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 _0xa9e0=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x14')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update'];(function(_0x4d0603,_0x17f20c){var _0x1d3469=function(_0x547a31){while(--_0x547a31){_0x4d0603['push'](_0x4d0603['shift']());}};_0x1d3469(++_0x17f20c);}(_0x34e8,0x12c));var _0x834e=function(_0x9c93b2,_0x2278ed){_0x9c93b2=_0x9c93b2-0x0;var _0xb2b7a=_0x34e8[_0x9c93b2];return _0xb2b7a;};'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')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x9')](_0x834e('0x10'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x834e('0x12')](_0x834e('0x14'),auth['isAuthenticated'](),controller[_0x834e('0x15')]);router[_0x834e('0x12')](_0x834e('0x16'),auth[_0x834e('0xa')](),controller['checkContactHopper']);router[_0x834e('0x17')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x18')]);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 77dd6ce..f2b46ec 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 _0x394e=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0x394e,0x88));var _0xe394=function(_0x472ee7,_0x302242){_0x472ee7=_0x472ee7-0x0;var _0x6aa3f3=_0x394e[_0x472ee7];return _0x6aa3f3;};'use strict';var Sequelize=require(_0xe394('0x0'));module[_0xe394('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe394('0x2')]},'scheduledat':{'type':Sequelize[_0xe394('0x3')]},'countbusyretry':{'type':Sequelize[_0xe394('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe394('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe394('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe394('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xe394('0x2')]},'originatecalleridname':{'type':Sequelize[_0xe394('0x2')]},'calleridnum':{'type':Sequelize[_0xe394('0x2')]},'calleridname':{'type':Sequelize[_0xe394('0x2')]},'starttime':{'type':Sequelize[_0xe394('0x3')]},'responsetime':{'type':Sequelize[_0xe394('0x3')]},'answertime':{'type':Sequelize[_0xe394('0x3')]},'droptime':{'type':Sequelize[_0xe394('0x3')]},'endtime':{'type':Sequelize[_0xe394('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe394('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe394('0x2')]},'campaign':{'type':Sequelize[_0xe394('0x2')]},'campaigntype':{'type':Sequelize[_0xe394('0x2')]},'membername':{'type':Sequelize[_0xe394('0x2')]},'reason':{'type':Sequelize[_0xe394('0x2')]},'amd':{'type':Sequelize[_0xe394('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe394('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe394('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe394('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe394('0x3')]},'recallme':{'type':Sequelize[_0xe394('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5292=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x1bb2b1,_0x41efa7){var _0x3e7424=function(_0x22678d){while(--_0x22678d){_0x1bb2b1['push'](_0x1bb2b1['shift']());}};_0x3e7424(++_0x41efa7);}(_0x5292,0xf7));var _0x2529=function(_0x2a83af,_0x4fa9ed){_0x2a83af=_0x2a83af-0x0;var _0x2e1648=_0x5292[_0x2a83af];return _0x2e1648;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2529('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2529('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2529('0x4')]},'responsetime':{'type':Sequelize[_0x2529('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2529('0x4')]},'ringtime':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2529('0x2')]},'campaign':{'type':Sequelize[_0x2529('0x2')]},'campaigntype':{'type':Sequelize[_0x2529('0x2')]},'membername':{'type':Sequelize[_0x2529('0x2')]},'reason':{'type':Sequelize[_0x2529('0x2')]},'amd':{'type':Sequelize[_0x2529('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x2529('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2529('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x2529('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2529('0x4')]},'edited':{'type':Sequelize[_0x2529('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 94086df..dc4b782 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 _0xc4aa=['order','sort','where','merge','map','type','key','field','options','findAll','rows','catch','show','params','includeAll','find','create','describe','body','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','../../config/license/hardware','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmHopperHistory','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x5b6a1e,_0xf2a83c){var _0x7da33f=function(_0x32934c){while(--_0x32934c){_0x5b6a1e['push'](_0x5b6a1e['shift']());}};_0x7da33f(++_0xf2a83c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'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 hardwareService=require(_0xac4a('0x12'));var logger=require('../../config/logger')(_0xac4a('0x13'));var utils=require('../../config/utils');var config=require(_0xac4a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333ca5,_0x2a0776){_0x2a0776=_0x2a0776||0xcc;return function(_0x24291d){if(_0x24291d){return _0x333ca5['sendStatus'](_0x2a0776);}return _0x333ca5[_0xac4a('0x15')](_0x2a0776)[_0xac4a('0x16')]();};}function respondWithResult(_0x247b78,_0x6e00d4){_0x6e00d4=_0x6e00d4||0xc8;return function(_0x1b4313){if(_0x1b4313){return _0x247b78[_0xac4a('0x15')](_0x6e00d4)[_0xac4a('0x17')](_0x1b4313);}};}function respondWithFilteredResult(_0x33c287,_0x190418){return function(_0x42c7fc){if(_0x42c7fc){var _0x11e101=_0x42c7fc[_0xac4a('0x18')],_0x26dbb8=_0x190418[_0xac4a('0x19')],_0x4a2119=_0x190418[_0xac4a('0x19')]+_0x190418[_0xac4a('0x1a')],_0x402fff;if(_0x4a2119>=_0x11e101){_0x4a2119=_0x11e101;_0x402fff=0xc8;}else{_0x402fff=0xce;}_0x33c287[_0xac4a('0x15')](_0x402fff);return _0x33c287[_0xac4a('0x1b')](_0xac4a('0x1c'),_0x26dbb8+'-'+_0x4a2119+'/'+_0x11e101)['json'](_0x42c7fc);}return null;};}function patchUpdates(_0x5ac21e){return function(_0x21a729){try{jsonpatch[_0xac4a('0x1d')](_0x21a729,_0x5ac21e,!![]);}catch(_0x39b691){return BPromise['reject'](_0x39b691);}return _0x21a729[_0xac4a('0x1e')]();};}function saveUpdates(_0x15c223,_0x3752e4){return function(_0x3a3cdb){if(_0x3a3cdb){return _0x3a3cdb[_0xac4a('0x1f')](_0x15c223)[_0xac4a('0x20')](function(_0xe38996){return _0xe38996;});}return null;};}function removeEntity(_0x3ca790,_0x534092){return function(_0x3d8f0a){if(_0x3d8f0a){return _0x3d8f0a[_0xac4a('0x21')]()['then'](function(){_0x3ca790[_0xac4a('0x15')](0xcc)[_0xac4a('0x16')]();});}};}function handleEntityNotFound(_0x3eacd3,_0x947d8e){return function(_0x4d2d6c){if(!_0x4d2d6c){_0x3eacd3[_0xac4a('0x22')](0x194);}return _0x4d2d6c;};}function handleError(_0x2503d8,_0x15435c){_0x15435c=_0x15435c||0x1f4;return function(_0x412494){logger[_0xac4a('0x23')](_0x412494[_0xac4a('0x24')]);if(_0x412494[_0xac4a('0x25')]){delete _0x412494[_0xac4a('0x25')];}_0x2503d8[_0xac4a('0x15')](_0x15435c)[_0xac4a('0x26')](_0x412494);};}exports[_0xac4a('0x27')]=function(_0x215a31,_0x14832b){var _0x472c57={},_0x1c13dc={},_0x20202c={'count':0x0,'rows':[]};var _0x4e17ce=db[_0xac4a('0x28')][_0xac4a('0x29')];_0x1c13dc[_0xac4a('0x2a')]=_[_0xac4a('0x2b')](_0x4e17ce);_0x1c13dc[_0xac4a('0x2c')]=_['keys'](_0x215a31['query']);_0x1c13dc[_0xac4a('0x2d')]=_[_0xac4a('0x2e')](_0x1c13dc[_0xac4a('0x2a')],_0x1c13dc['query']);_0x472c57['attributes']=_[_0xac4a('0x2e')](_0x1c13dc[_0xac4a('0x2a')],qs[_0xac4a('0x2f')](_0x215a31[_0xac4a('0x2c')][_0xac4a('0x2f')]));_0x472c57['attributes']=_0x472c57[_0xac4a('0x30')]['length']?_0x472c57[_0xac4a('0x30')]:_0x1c13dc['model'];if(!_0x215a31[_0xac4a('0x2c')][_0xac4a('0x31')](_0xac4a('0x32'))){_0x472c57[_0xac4a('0x1a')]=qs[_0xac4a('0x1a')](_0x215a31[_0xac4a('0x2c')][_0xac4a('0x1a')]);_0x472c57[_0xac4a('0x19')]=qs[_0xac4a('0x19')](_0x215a31[_0xac4a('0x2c')][_0xac4a('0x19')]);}_0x472c57[_0xac4a('0x33')]=qs[_0xac4a('0x34')](_0x215a31[_0xac4a('0x2c')]['sort']);_0x472c57[_0xac4a('0x35')]=qs[_0xac4a('0x2d')](_['pick'](_0x215a31[_0xac4a('0x2c')],_0x1c13dc[_0xac4a('0x2d')]));if(_0x215a31['query']['filter']){_0x472c57[_0xac4a('0x35')]=_[_0xac4a('0x36')](_0x472c57[_0xac4a('0x35')],{'$or':_[_0xac4a('0x37')](_0x4e17ce,function(_0x4f5986){if(_0x4f5986[_0xac4a('0x38')][_0xac4a('0x39')]!=='VIRTUAL'){var _0x37f2ee={};_0x37f2ee[_0x4f5986[_0xac4a('0x3a')]]={'$like':'%'+_0x215a31[_0xac4a('0x2c')]['filter']+'%'};return _0x37f2ee;}})});}_0x472c57=_[_0xac4a('0x36')]({},_0x472c57,_0x215a31[_0xac4a('0x3b')]);var _0x1b5427={'where':_0x472c57['where']};return db[_0xac4a('0x28')][_0xac4a('0x18')](_0x1b5427)['then'](function(_0x59bebf){_0x20202c[_0xac4a('0x18')]=_0x59bebf;if(_0x215a31['query']['includeAll']){_0x472c57['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xac4a('0x3c')](_0x472c57);})[_0xac4a('0x20')](function(_0x37834b){_0x20202c[_0xac4a('0x3d')]=_0x37834b;return _0x20202c;})[_0xac4a('0x20')](respondWithFilteredResult(_0x14832b,_0x472c57))[_0xac4a('0x3e')](handleError(_0x14832b,null));};exports[_0xac4a('0x3f')]=function(_0x2b16f0,_0x28292c){var _0x1f7721={'raw':!![],'where':{'id':_0x2b16f0[_0xac4a('0x40')]['id']}},_0x14f7d5={};_0x14f7d5['model']=_['keys'](db['CmHopperHistory'][_0xac4a('0x29')]);_0x14f7d5[_0xac4a('0x2c')]=_[_0xac4a('0x2b')](_0x2b16f0[_0xac4a('0x2c')]);_0x14f7d5[_0xac4a('0x2d')]=_[_0xac4a('0x2e')](_0x14f7d5[_0xac4a('0x2a')],_0x14f7d5[_0xac4a('0x2c')]);_0x1f7721[_0xac4a('0x30')]=_[_0xac4a('0x2e')](_0x14f7d5['model'],qs[_0xac4a('0x2f')](_0x2b16f0[_0xac4a('0x2c')][_0xac4a('0x2f')]));_0x1f7721[_0xac4a('0x30')]=_0x1f7721[_0xac4a('0x30')]['length']?_0x1f7721[_0xac4a('0x30')]:_0x14f7d5[_0xac4a('0x2a')];if(_0x2b16f0['query'][_0xac4a('0x41')]){_0x1f7721['include']=[{'all':!![]}];}_0x1f7721=_[_0xac4a('0x36')]({},_0x1f7721,_0x2b16f0[_0xac4a('0x3b')]);return db[_0xac4a('0x28')][_0xac4a('0x42')](_0x1f7721)[_0xac4a('0x20')](handleEntityNotFound(_0x28292c,null))[_0xac4a('0x20')](respondWithResult(_0x28292c,null))[_0xac4a('0x3e')](handleError(_0x28292c,null));};exports[_0xac4a('0x43')]=function(_0x98e0c4,_0xcb002b){return db[_0xac4a('0x28')][_0xac4a('0x43')](_0x98e0c4['body'],{})[_0xac4a('0x20')](respondWithResult(_0xcb002b,0xc9))[_0xac4a('0x3e')](handleError(_0xcb002b,null));};exports[_0xac4a('0x44')]=function(_0x58759a,_0x1764bf){return db[_0xac4a('0x28')]['describe']()[_0xac4a('0x20')](respondWithResult(_0x1764bf,null))['catch'](handleError(_0x1764bf,null));};exports[_0xac4a('0x1f')]=function(_0xe620f6,_0x136a65){if(_0xe620f6['body']['uniqueid']){delete _0xe620f6[_0xac4a('0x45')]['uniqueid'];}return db[_0xac4a('0x28')]['find']({'where':{'uniqueid':_0xe620f6[_0xac4a('0x40')]['id']}})['then'](handleEntityNotFound(_0x136a65,null))[_0xac4a('0x20')](saveUpdates(_0xe620f6[_0xac4a('0x45')],null))[_0xac4a('0x20')](respondWithResult(_0x136a65,null))[_0xac4a('0x3e')](handleError(_0x136a65,null));}; \ No newline at end of file +var _0x7a54=['mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','index','CmHopperHistory','rawAttributes','model','keys','query','filters','attributes','intersection','fields','offset','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','length','includeAll','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x309251,_0x5a6279){var _0x21426a=function(_0x400625){while(--_0x400625){_0x309251['push'](_0x309251['shift']());}};_0x21426a(++_0x5a6279);}(_0x7a54,0x106));var _0x47a5=function(_0x5c1ea7,_0x3033ff){_0x5c1ea7=_0x5c1ea7-0x0;var _0x16953e=_0x7a54[_0x5c1ea7];return _0x16953e;};'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 hardwareService=require(_0x47a5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x47a5('0x11'));var config=require(_0x47a5('0x12'));var db=require(_0x47a5('0x13'))['db'];function respondWithStatusCode(_0x250fad,_0xd612dd){_0xd612dd=_0xd612dd||0xcc;return function(_0xd308b8){if(_0xd308b8){return _0x250fad[_0x47a5('0x14')](_0xd612dd);}return _0x250fad['status'](_0xd612dd)[_0x47a5('0x15')]();};}function respondWithResult(_0x221b54,_0x1cf309){_0x1cf309=_0x1cf309||0xc8;return function(_0x711793){if(_0x711793){return _0x221b54[_0x47a5('0x16')](_0x1cf309)[_0x47a5('0x17')](_0x711793);}};}function respondWithFilteredResult(_0x3c6c46,_0x190faa){return function(_0x4e99a8){if(_0x4e99a8){var _0x362359=_0x4e99a8[_0x47a5('0x18')],_0x11faf5=_0x190faa['offset'],_0x3b001e=_0x190faa['offset']+_0x190faa[_0x47a5('0x19')],_0x2a2cbb;if(_0x3b001e>=_0x362359){_0x3b001e=_0x362359;_0x2a2cbb=0xc8;}else{_0x2a2cbb=0xce;}_0x3c6c46['status'](_0x2a2cbb);return _0x3c6c46['set'](_0x47a5('0x1a'),_0x11faf5+'-'+_0x3b001e+'/'+_0x362359)[_0x47a5('0x17')](_0x4e99a8);}return null;};}function patchUpdates(_0x2ce454){return function(_0x1ef371){try{jsonpatch[_0x47a5('0x1b')](_0x1ef371,_0x2ce454,!![]);}catch(_0x12b98e){return BPromise[_0x47a5('0x1c')](_0x12b98e);}return _0x1ef371[_0x47a5('0x1d')]();};}function saveUpdates(_0x3aed38,_0x4a9fcb){return function(_0x1570bc){if(_0x1570bc){return _0x1570bc[_0x47a5('0x1e')](_0x3aed38)['then'](function(_0x2b0360){return _0x2b0360;});}return null;};}function removeEntity(_0x1f03f7,_0x36874d){return function(_0x4c5910){if(_0x4c5910){return _0x4c5910[_0x47a5('0x1f')]()[_0x47a5('0x20')](function(){_0x1f03f7[_0x47a5('0x16')](0xcc)[_0x47a5('0x15')]();});}};}function handleEntityNotFound(_0x5ef1b1,_0xe2dea9){return function(_0x385687){if(!_0x385687){_0x5ef1b1['sendStatus'](0x194);}return _0x385687;};}function handleError(_0x28747d,_0xc4cd63){_0xc4cd63=_0xc4cd63||0x1f4;return function(_0x4437f1){logger[_0x47a5('0x21')](_0x4437f1[_0x47a5('0x22')]);if(_0x4437f1['name']){delete _0x4437f1['name'];}_0x28747d[_0x47a5('0x16')](_0xc4cd63)['send'](_0x4437f1);};}exports[_0x47a5('0x23')]=function(_0x5b6c4e,_0x23cb77){var _0x378208={},_0x36ad34={},_0x1dac65={'count':0x0,'rows':[]};var _0x21f296=db[_0x47a5('0x24')][_0x47a5('0x25')];_0x36ad34[_0x47a5('0x26')]=_[_0x47a5('0x27')](_0x21f296);_0x36ad34[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x5b6c4e[_0x47a5('0x28')]);_0x36ad34[_0x47a5('0x29')]=_['intersection'](_0x36ad34[_0x47a5('0x26')],_0x36ad34['query']);_0x378208[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x26')],qs['fields'](_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x2c')]));_0x378208[_0x47a5('0x2a')]=_0x378208[_0x47a5('0x2a')]['length']?_0x378208['attributes']:_0x36ad34[_0x47a5('0x26')];if(!_0x5b6c4e[_0x47a5('0x28')]['hasOwnProperty']('nolimit')){_0x378208[_0x47a5('0x19')]=qs[_0x47a5('0x19')](_0x5b6c4e['query'][_0x47a5('0x19')]);_0x378208['offset']=qs[_0x47a5('0x2d')](_0x5b6c4e[_0x47a5('0x28')]['offset']);}_0x378208['order']=qs[_0x47a5('0x2e')](_0x5b6c4e['query'][_0x47a5('0x2e')]);_0x378208[_0x47a5('0x2f')]=qs[_0x47a5('0x29')](_['pick'](_0x5b6c4e[_0x47a5('0x28')],_0x36ad34['filters']));if(_0x5b6c4e['query'][_0x47a5('0x30')]){_0x378208['where']=_[_0x47a5('0x31')](_0x378208['where'],{'$or':_[_0x47a5('0x32')](_0x21f296,function(_0x3534cb){if(_0x3534cb[_0x47a5('0x33')][_0x47a5('0x34')]!==_0x47a5('0x35')){var _0xed6320={};_0xed6320[_0x3534cb[_0x47a5('0x36')]]={'$like':'%'+_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x30')]+'%'};return _0xed6320;}})});}_0x378208=_['merge']({},_0x378208,_0x5b6c4e[_0x47a5('0x37')]);var _0x10f136={'where':_0x378208['where']};return db[_0x47a5('0x24')][_0x47a5('0x18')](_0x10f136)[_0x47a5('0x20')](function(_0x49c4b5){_0x1dac65[_0x47a5('0x18')]=_0x49c4b5;if(_0x5b6c4e[_0x47a5('0x28')]['includeAll']){_0x378208[_0x47a5('0x38')]=[{'all':!![]}];}return db[_0x47a5('0x24')]['findAll'](_0x378208);})['then'](function(_0x5ebd8c){_0x1dac65[_0x47a5('0x39')]=_0x5ebd8c;return _0x1dac65;})['then'](respondWithFilteredResult(_0x23cb77,_0x378208))[_0x47a5('0x3a')](handleError(_0x23cb77,null));};exports[_0x47a5('0x3b')]=function(_0x301a85,_0x111f0d){var _0x1b2c80={'raw':!![],'where':{'id':_0x301a85[_0x47a5('0x3c')]['id']}},_0xcb5243={};_0xcb5243[_0x47a5('0x26')]=_[_0x47a5('0x27')](db[_0x47a5('0x24')][_0x47a5('0x25')]);_0xcb5243[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x301a85['query']);_0xcb5243[_0x47a5('0x29')]=_[_0x47a5('0x2b')](_0xcb5243[_0x47a5('0x26')],_0xcb5243[_0x47a5('0x28')]);_0x1b2c80['attributes']=_[_0x47a5('0x2b')](_0xcb5243['model'],qs['fields'](_0x301a85['query']['fields']));_0x1b2c80[_0x47a5('0x2a')]=_0x1b2c80['attributes'][_0x47a5('0x3d')]?_0x1b2c80[_0x47a5('0x2a')]:_0xcb5243[_0x47a5('0x26')];if(_0x301a85['query'][_0x47a5('0x3e')]){_0x1b2c80[_0x47a5('0x38')]=[{'all':!![]}];}_0x1b2c80=_['merge']({},_0x1b2c80,_0x301a85['options']);return db[_0x47a5('0x24')]['find'](_0x1b2c80)[_0x47a5('0x20')](handleEntityNotFound(_0x111f0d,null))[_0x47a5('0x20')](respondWithResult(_0x111f0d,null))[_0x47a5('0x3a')](handleError(_0x111f0d,null));};exports[_0x47a5('0x3f')]=function(_0x34a9ae,_0xf0edbb){return db[_0x47a5('0x24')][_0x47a5('0x3f')](_0x34a9ae[_0x47a5('0x40')],{})[_0x47a5('0x20')](respondWithResult(_0xf0edbb,0xc9))[_0x47a5('0x3a')](handleError(_0xf0edbb,null));};exports[_0x47a5('0x41')]=function(_0xe28d76,_0x3574d4){return db[_0x47a5('0x24')][_0x47a5('0x41')]()['then'](respondWithResult(_0x3574d4,null))[_0x47a5('0x3a')](handleError(_0x3574d4,null));};exports[_0x47a5('0x1e')]=function(_0x49eab1,_0x52b3a8){if(_0x49eab1[_0x47a5('0x40')]['uniqueid']){delete _0x49eab1[_0x47a5('0x40')][_0x47a5('0x42')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x49eab1[_0x47a5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x52b3a8,null))[_0x47a5('0x20')](saveUpdates(_0x49eab1[_0x47a5('0x40')],null))[_0x47a5('0x20')](respondWithResult(_0x52b3a8,null))[_0x47a5('0x3a')](handleError(_0x52b3a8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 96d6a36..000ff2f 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 _0xe706=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x9cc420,_0x1eeda9){var _0x2fd049=function(_0x3bafb7){while(--_0x3bafb7){_0x9cc420['push'](_0x9cc420['shift']());}};_0x2fd049(++_0x1eeda9);}(_0xe706,0xa3));var _0x6e70=function(_0x3d905,_0x7b688d){_0x3d905=_0x3d905-0x0;var _0x3a990b=_0xe706[_0x3d905];return _0x3a990b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]},{'name':_0x6e70('0xf'),'fields':[_0x6e70('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x3d2944,_0x34989e){var _0x1c6648=function(_0x4ec33){while(--_0x4ec33){_0x3d2944['push'](_0x3d2944['shift']());}};_0x1c6648(++_0x34989e);}(_0xe706,0xa3));var _0x6e70=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe706[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]},{'name':_0x6e70('0xf'),'fields':[_0x6e70('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3b3ffde..5938dc7 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 _0x976a=['name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','create','options','raw','debug','CreateCmHopperHistory','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory'];(function(_0x16af3c,_0x5e3ff4){var _0x358a59=function(_0x4970ee){while(--_0x4970ee){_0x16af3c['push'](_0x16af3c['shift']());}};_0x358a59(++_0x5e3ff4);}(_0x976a,0xf4));var _0xa976=function(_0x4dca38,_0x5dfae1){_0x4dca38=_0x4dca38-0x0;var _0x44656c=_0x976a[_0x4dca38];return _0x44656c;};'use strict';var _=require(_0xa976('0x0'));var util=require(_0xa976('0x1'));var moment=require(_0xa976('0x2'));var BPromise=require('bluebird');var rs=require(_0xa976('0x3'));var fs=require('fs');var Redis=require(_0xa976('0x4'));var db=require(_0xa976('0x5'))['db'];var utils=require(_0xa976('0x6'));var logger=require(_0xa976('0x7'))(_0xa976('0x8'));var config=require(_0xa976('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5caa7a,_0x3a4a2,_0x12a073){return new BPromise(function(_0x1a9983,_0xc3661d){return client[_0xa976('0xa')](_0x5caa7a,_0x12a073)[_0xa976('0xb')](function(_0x197ebf){logger[_0xa976('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x3a4a2,'request\x20sent');logger['debug'](_0xa976('0xd'),_0x3a4a2,_0xa976('0xe'),JSON[_0xa976('0xf')](_0x197ebf));if(_0x197ebf[_0xa976('0x10')]){if(_0x197ebf['error'][_0xa976('0x11')]===0x1f4){logger[_0xa976('0x10')](_0xa976('0x12'),_0x3a4a2,_0x197ebf[_0xa976('0x10')][_0xa976('0x13')]);return _0xc3661d(_0x197ebf[_0xa976('0x10')]['message']);}logger[_0xa976('0x10')](_0xa976('0x12'),_0x3a4a2,_0x197ebf[_0xa976('0x10')][_0xa976('0x13')]);return _0x1a9983(_0x197ebf[_0xa976('0x10')][_0xa976('0x13')]);}else{logger[_0xa976('0xc')](_0xa976('0x12'),_0x3a4a2,_0xa976('0xe'));_0x1a9983(_0x197ebf[_0xa976('0x14')][_0xa976('0x13')]);}})['catch'](function(_0xf5f9b){logger[_0xa976('0x10')](_0xa976('0x12'),_0x3a4a2,_0xf5f9b);_0xc3661d(_0xf5f9b);});});}exports['CreateCmHopperHistory']=function(_0x4848d8){var _0x3f2cd5=this;return new Promise(function(_0x36b47a,_0x3ca2dd){return db[_0xa976('0x15')][_0xa976('0x16')](_0x4848d8['body'],{'raw':_0x4848d8[_0xa976('0x17')]?_0x4848d8[_0xa976('0x17')][_0xa976('0x18')]===undefined?!![]:![]:!![]})[_0xa976('0xb')](function(_0x44f7d4){logger['info']('CreateCmHopperHistory',_0x4848d8);logger[_0xa976('0x19')](_0xa976('0x1a'),_0x4848d8,JSON['stringify'](_0x44f7d4));_0x36b47a(_0x44f7d4);})[_0xa976('0x1b')](function(_0x4f60ff){logger['error'](_0xa976('0x1a'),_0x4f60ff[_0xa976('0x13')],_0x4848d8);_0x3ca2dd(_0x3f2cd5[_0xa976('0x10')](0x1f4,_0x4f60ff[_0xa976('0x13')]));});});};exports[_0xa976('0x1c')]=function(_0xe572fe){var _0x31231f=this;return new Promise(function(_0x54b5ba,_0x5a2f6f){return db['CmHopperHistory'][_0xa976('0x1d')]({'raw':_0xe572fe[_0xa976('0x17')]?_0xe572fe[_0xa976('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xe572fe['options']?_0xe572fe[_0xa976('0x17')][_0xa976('0x1e')]||null:null,'attributes':[[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')][_0xa976('0x21')]('id')),_0xa976('0x22')],[db[_0xa976('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xa976('0x1f')]['fn']('COUNT',db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x25')))),_0xa976('0x26')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x27'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x28')))),_0xa976('0x29')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x27'),db[_0xa976('0x1f')]['fn']('IF',db['sequelize'][_0xa976('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xa976('0x2a')]]})[_0xa976('0xb')](function(_0x1f8e7e){logger[_0xa976('0xc')](_0xa976('0x1c'),_0xe572fe);logger[_0xa976('0x19')](_0xa976('0x1c'),_0xe572fe,JSON[_0xa976('0xf')](_0x1f8e7e));_0x54b5ba(_0x1f8e7e);})[_0xa976('0x1b')](function(_0x3e9baa){logger[_0xa976('0x10')](_0xa976('0x1c'),_0x3e9baa[_0xa976('0x13')],_0xe572fe);_0x5a2f6f(_0x31231f['error'](0x1f4,_0x3e9baa[_0xa976('0x13')]));});});};exports[_0xa976('0x2b')]=function(_0x16c6b4){var _0x545320=this;return new Promise(function(_0x1c6728,_0x37eeb7){return db[_0xa976('0x15')][_0xa976('0x1d')]({'raw':_0x16c6b4[_0xa976('0x17')]?_0x16c6b4['options'][_0xa976('0x18')]===undefined?!![]:![]:!![],'where':_0x16c6b4['options']?_0x16c6b4[_0xa976('0x17')][_0xa976('0x1e')]||null:null,'attributes':[['campaign',_0xa976('0x2c')],[db[_0xa976('0x1f')]['fn']('COUNT',db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')]['literal'](_0xa976('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa976('0x23')](_0xa976('0x2e')))),_0xa976('0x2f')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x30')))),_0xa976('0x31')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x32')))),_0xa976('0x33')],[db[_0xa976('0x1f')]['fn']('COUNT',db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x34')))),_0xa976('0x35')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa976('0x36')))),_0xa976('0x37')],[db['sequelize']['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x38')))),_0xa976('0x39')],[db[_0xa976('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x3a')))),'outboundUnknownCallsDay'],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')]['literal'](_0xa976('0x3b')))),_0xa976('0x3c')],[db['sequelize']['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x3d')))),_0xa976('0x3e')],[db['sequelize']['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa976('0x3f')],[db['sequelize']['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x40')))),_0xa976('0x41')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x42')))),_0xa976('0x3f')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xa976('0x43')]],'group':[_0xa976('0x44')]})[_0xa976('0xb')](function(_0x9b72a){logger['info']('GetVoiceQueueHopperHistory',_0x16c6b4);logger['debug']('GetVoiceQueueHopperHistory',_0x16c6b4,JSON[_0xa976('0xf')](_0x9b72a));_0x1c6728(_0x9b72a);})[_0xa976('0x1b')](function(_0x1fdf63){logger['error'](_0xa976('0x2b'),_0x1fdf63['message'],_0x16c6b4);_0x37eeb7(_0x545320[_0xa976('0x10')](0x1f4,_0x1fdf63[_0xa976('0x13')]));});});};exports[_0xa976('0x45')]=function(_0x3e6893){var _0x50b875=this;return new Promise(function(_0x89b850,_0x830789){return db[_0xa976('0x15')][_0xa976('0x1d')]({'raw':_0x3e6893[_0xa976('0x17')]?_0x3e6893[_0xa976('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6893[_0xa976('0x17')]?_0x3e6893[_0xa976('0x17')][_0xa976('0x1e')]||null:null,'attributes':[['campaign',_0xa976('0x2c')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')][_0xa976('0x21')]('id')),_0xa976('0x46')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')]['literal'](_0xa976('0x30')))),_0xa976('0x47')]],'group':['campaign']})[_0xa976('0xb')](function(_0x4f7178){logger['info']('GetCampaignHopperHistory',_0x3e6893);logger[_0xa976('0x19')]('GetCampaignHopperHistory',_0x3e6893,JSON[_0xa976('0xf')](_0x4f7178));_0x89b850(_0x4f7178);})[_0xa976('0x1b')](function(_0x40da22){logger['error'](_0xa976('0x45'),_0x40da22['message'],_0x3e6893);_0x830789(_0x50b875[_0xa976('0x10')](0x1f4,_0x40da22[_0xa976('0x13')]));});});}; \ No newline at end of file +var _0x8840=['`state`\x20=\x204,\x20`talktime`,\x20null','findAll','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','raw','where','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x2c9a9f,_0x4a1ea0){var _0x2b00cd=function(_0x342368){while(--_0x342368){_0x2c9a9f['push'](_0x2c9a9f['shift']());}};_0x2b00cd(++_0x4a1ea0);}(_0x8840,0x1ac));var _0x0884=function(_0x1d5ccb,_0x136776){_0x1d5ccb=_0x1d5ccb-0x0;var _0x49fc07=_0x8840[_0x1d5ccb];return _0x49fc07;};'use strict';var _=require(_0x0884('0x0'));var util=require('util');var moment=require(_0x0884('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0884('0x2'));var db=require(_0x0884('0x3'))['db'];var utils=require(_0x0884('0x4'));var logger=require(_0x0884('0x5'))(_0x0884('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0884('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f25ca,_0x9cbb26,_0x5aff5b){return new BPromise(function(_0x19f0d3,_0x26e915){return client[_0x0884('0x8')](_0x1f25ca,_0x5aff5b)[_0x0884('0x9')](function(_0x302342){logger[_0x0884('0xa')](_0x0884('0xb'),_0x9cbb26,_0x0884('0xc'));logger[_0x0884('0xd')](_0x0884('0xe'),_0x9cbb26,'request\x20sent',JSON[_0x0884('0xf')](_0x302342));if(_0x302342[_0x0884('0x10')]){if(_0x302342['error']['code']===0x1f4){logger['error'](_0x0884('0xb'),_0x9cbb26,_0x302342[_0x0884('0x10')][_0x0884('0x11')]);return _0x26e915(_0x302342[_0x0884('0x10')][_0x0884('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x9cbb26,_0x302342['error']['message']);return _0x19f0d3(_0x302342[_0x0884('0x10')]['message']);}else{logger['info'](_0x0884('0xb'),_0x9cbb26,_0x0884('0xc'));_0x19f0d3(_0x302342[_0x0884('0x12')]['message']);}})[_0x0884('0x13')](function(_0xf3c35){logger[_0x0884('0x10')](_0x0884('0xb'),_0x9cbb26,_0xf3c35);_0x26e915(_0xf3c35);});});}exports[_0x0884('0x14')]=function(_0x497cf9){var _0x21e7a0=this;return new Promise(function(_0x343df7,_0x45bed6){return db[_0x0884('0x15')][_0x0884('0x16')](_0x497cf9[_0x0884('0x17')],{'raw':_0x497cf9[_0x0884('0x18')]?_0x497cf9[_0x0884('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23949d){logger['info'](_0x0884('0x14'),_0x497cf9);logger[_0x0884('0xd')](_0x0884('0x14'),_0x497cf9,JSON[_0x0884('0xf')](_0x23949d));_0x343df7(_0x23949d);})[_0x0884('0x13')](function(_0x2556f4){logger[_0x0884('0x10')](_0x0884('0x14'),_0x2556f4['message'],_0x497cf9);_0x45bed6(_0x21e7a0[_0x0884('0x10')](0x1f4,_0x2556f4['message']));});});};exports[_0x0884('0x19')]=function(_0x3e4238){var _0x330124=this;return new Promise(function(_0x59d0dd,_0x479eb4){return db['CmHopperHistory']['findAll']({'raw':_0x3e4238[_0x0884('0x18')]?_0x3e4238[_0x0884('0x18')][_0x0884('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e4238['options']?_0x3e4238[_0x0884('0x18')][_0x0884('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')][_0x0884('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x20')))),_0x0884('0x21')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')]['literal'](_0x0884('0x22')))),_0x0884('0x23')],[db[_0x0884('0x1d')]['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db['sequelize'][_0x0884('0x1f')](_0x0884('0x24')))),_0x0884('0x25')],[db['sequelize']['fn'](_0x0884('0x26'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')]['literal'](_0x0884('0x27')))),_0x0884('0x28')],[db['sequelize']['fn'](_0x0884('0x26'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x0884('0x9')](function(_0x4d2dbf){logger['info']('AvgHandleTime',_0x3e4238);logger['debug'](_0x0884('0x19'),_0x3e4238,JSON[_0x0884('0xf')](_0x4d2dbf));_0x59d0dd(_0x4d2dbf);})[_0x0884('0x13')](function(_0x5736e0){logger[_0x0884('0x10')](_0x0884('0x19'),_0x5736e0[_0x0884('0x11')],_0x3e4238);_0x479eb4(_0x330124['error'](0x1f4,_0x5736e0[_0x0884('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3ba7a3){var _0x478256=this;return new Promise(function(_0x762228,_0x1bb243){return db['CmHopperHistory'][_0x0884('0x2a')]({'raw':_0x3ba7a3[_0x0884('0x18')]?_0x3ba7a3[_0x0884('0x18')][_0x0884('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ba7a3[_0x0884('0x18')]?_0x3ba7a3[_0x0884('0x18')][_0x0884('0x1b')]||null:null,'attributes':[[_0x0884('0x2b'),_0x0884('0x2c')],[db[_0x0884('0x1d')]['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0x0884('0x2d')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x0884('0x2e')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x20')))),_0x0884('0x2f')],[db[_0x0884('0x1d')]['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),_0x0884('0x30')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x31')))),_0x0884('0x32')],[db['sequelize']['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x33')))),_0x0884('0x34')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0884('0x35')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x36')))),_0x0884('0x37')],[db['sequelize']['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x38')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x0884('0x1d')]['fn']('IF',db['sequelize'][_0x0884('0x1f')](_0x0884('0x39')))),_0x0884('0x3a')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')](_0x0884('0x3b')))),_0x0884('0x3c')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0884('0x1f')](_0x0884('0x3d')))),_0x0884('0x3e')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')][_0x0884('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0884('0x1f')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x0884('0x2b')]})['then'](function(_0x4fb8ad){logger['info'](_0x0884('0x3f'),_0x3ba7a3);logger[_0x0884('0xd')]('GetVoiceQueueHopperHistory',_0x3ba7a3,JSON[_0x0884('0xf')](_0x4fb8ad));_0x762228(_0x4fb8ad);})[_0x0884('0x13')](function(_0x30982e){logger[_0x0884('0x10')](_0x0884('0x3f'),_0x30982e[_0x0884('0x11')],_0x3ba7a3);_0x1bb243(_0x478256[_0x0884('0x10')](0x1f4,_0x30982e[_0x0884('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x361824){var _0xc50f96=this;return new Promise(function(_0x3471d7,_0x530451){return db[_0x0884('0x15')]['findAll']({'raw':_0x361824[_0x0884('0x18')]?_0x361824[_0x0884('0x18')][_0x0884('0x1a')]===undefined?!![]:![]:!![],'where':_0x361824[_0x0884('0x18')]?_0x361824[_0x0884('0x18')][_0x0884('0x1b')]||null:null,'attributes':[[_0x0884('0x2b'),_0x0884('0x2c')],[db[_0x0884('0x1d')]['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')][_0x0884('0x1e')]('id')),_0x0884('0x40')],[db['sequelize']['fn'](_0x0884('0x1c'),db[_0x0884('0x1d')]['fn']('IF',db[_0x0884('0x1d')]['literal'](_0x0884('0x20')))),_0x0884('0x41')]],'group':[_0x0884('0x2b')]})['then'](function(_0x449363){logger[_0x0884('0xa')]('GetCampaignHopperHistory',_0x361824);logger[_0x0884('0xd')](_0x0884('0x42'),_0x361824,JSON[_0x0884('0xf')](_0x449363));_0x3471d7(_0x449363);})[_0x0884('0x13')](function(_0x1ed143){logger[_0x0884('0x10')](_0x0884('0x42'),_0x1ed143[_0x0884('0x11')],_0x361824);_0x530451(_0xc50f96['error'](0x1f4,_0x1ed143[_0x0884('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e0fd629..84dd750 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 _0xf3fe=['./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xd40100,_0x3ea399){var _0x27db21=function(_0x17064d){while(--_0x17064d){_0xd40100['push'](_0xd40100['shift']());}};_0x27db21(++_0x3ea399);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x126123,_0xb6db8c){_0x126123=_0x126123-0x0;var _0x249ef6=_0xf3fe[_0x126123];return _0x249ef6;};'use strict';var multer=require('multer');var util=require(_0xef3f('0x0'));var path=require(_0xef3f('0x1'));var timeout=require(_0xef3f('0x2'));var express=require(_0xef3f('0x3'));var router=express[_0xef3f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xef3f('0x5'));var config=require(_0xef3f('0x6'));var controller=require(_0xef3f('0x7'));router[_0xef3f('0x8')]('/',auth[_0xef3f('0x9')](),controller['index']);router['get'](_0xef3f('0xa'),auth[_0xef3f('0x9')](),controller[_0xef3f('0xb')]);router[_0xef3f('0x8')](_0xef3f('0xc'),auth[_0xef3f('0x9')](),controller[_0xef3f('0xd')]);router[_0xef3f('0xe')]('/',auth[_0xef3f('0x9')](),controller['create']);router[_0xef3f('0xf')]('/:id',auth[_0xef3f('0x9')](),controller[_0xef3f('0x10')]);module[_0xef3f('0x11')]=router; \ No newline at end of file +var _0x106f=['express','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x106f,0x162));var _0xf106=function(_0x517589,_0x209a53){_0x517589=_0x517589-0x0;var _0x5d1b9d=_0x106f[_0x517589];return _0x5d1b9d;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var auth=require(_0xf106('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf106('0x5'));var controller=require(_0xf106('0x6'));router[_0xf106('0x7')]('/',auth[_0xf106('0x8')](),controller[_0xf106('0x9')]);router[_0xf106('0x7')](_0xf106('0xa'),auth['isAuthenticated'](),controller[_0xf106('0xb')]);router[_0xf106('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf106('0xc')]);router[_0xf106('0xd')](_0xf106('0xe'),auth[_0xf106('0x8')](),controller[_0xf106('0xf')]);module[_0xf106('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cbb4a73..42270f6 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 _0xabce=['exports','STRING','name','sequelize'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0xabce,0x103));var _0xeabc=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xabce[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'unique':_0xeabc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeabc('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','name'];(function(_0x5cd7fd,_0x4de617){var _0x5213ae=function(_0x49b2aa){while(--_0x49b2aa){_0x5cd7fd['push'](_0x5cd7fd['shift']());}};_0x5213ae(++_0x4de617);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x24ca[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'unique':_0xa24c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa24c('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 308b6c2..cc559aa 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 _0x16d2=['addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','spread','removeAgents','emit','User','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/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','status','json','offset','set','apply','reject','save','then','get','end','error','stack','name','send','index','CmList','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','map','type','key','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','find','create','body','user','autoAssociation','UserProfileResource','update','destroy','describe','ListId','Disposition','findOne','nolimit','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','ids','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','now','setHeader','Content-disposition','attachment;\x20filename=','text/csv','/tmp/list_%d_%s.csv','sendStatus'];(function(_0x429dd4,_0x2202e8){var _0x51581c=function(_0x5ad98f){while(--_0x5ad98f){_0x429dd4['push'](_0x429dd4['shift']());}};_0x51581c(++_0x2202e8);}(_0x16d2,0x123));var _0x216d=function(_0x594670,_0x4b9fdd){_0x594670=_0x594670-0x0;var _0x36a5b7=_0x16d2[_0x594670];return _0x36a5b7;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0x216d('0x16'))('api');var utils=require(_0x216d('0x17'));var config=require(_0x216d('0x18'));var db=require(_0x216d('0x19'))['db'];config[_0x216d('0x1a')]=_[_0x216d('0x1b')](config[_0x216d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x216d('0x1c'))(new Redis(config['redis']));require(_0x216d('0x1d'))[_0x216d('0x1e')](socket);function respondWithStatusCode(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xcc;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['sendStatus'](_0x165c19);}return _0x4dc2a2[_0x216d('0x1f')](_0x165c19)['end']();};}function respondWithResult(_0x448c0d,_0xf571a4){_0xf571a4=_0xf571a4||0xc8;return function(_0x4631b0){if(_0x4631b0){return _0x448c0d[_0x216d('0x1f')](_0xf571a4)[_0x216d('0x20')](_0x4631b0);}};}function respondWithFilteredResult(_0x304dfa,_0x467cd5){return function(_0x1496fe){if(_0x1496fe){var _0x19fdac=_0x1496fe['count'],_0x53d464=_0x467cd5[_0x216d('0x21')],_0x3b60dd=_0x467cd5[_0x216d('0x21')]+_0x467cd5['limit'],_0x5124ab;if(_0x3b60dd>=_0x19fdac){_0x3b60dd=_0x19fdac;_0x5124ab=0xc8;}else{_0x5124ab=0xce;}_0x304dfa[_0x216d('0x1f')](_0x5124ab);return _0x304dfa[_0x216d('0x22')]('Content-Range',_0x53d464+'-'+_0x3b60dd+'/'+_0x19fdac)[_0x216d('0x20')](_0x1496fe);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x23')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x24')](_0x5c3e03);}return _0x430e81[_0x216d('0x25')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x26')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x26')](function(){var _0xab672=_0x6fa4b3[_0x216d('0x27')]({'plain':!![]});var _0x5998a1='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x5998a1,'resourceId':_0xab672['id']}})['then'](function(){return _0x6fa4b3;});})[_0x216d('0x26')](function(){_0x188494[_0x216d('0x1f')](0xcc)[_0x216d('0x28')]();});}};}function handleEntityNotFound(_0x73b509,_0x46d0ef){return function(_0x47fa6d){if(!_0x47fa6d){_0x73b509['sendStatus'](0x194);}return _0x47fa6d;};}function handleError(_0xa7624a,_0x51b2bd){_0x51b2bd=_0x51b2bd||0x1f4;return function(_0x23d1c3){logger[_0x216d('0x29')](_0x23d1c3[_0x216d('0x2a')]);if(_0x23d1c3[_0x216d('0x2b')]){delete _0x23d1c3[_0x216d('0x2b')];}_0xa7624a[_0x216d('0x1f')](_0x51b2bd)[_0x216d('0x2c')](_0x23d1c3);};}exports[_0x216d('0x2d')]=function(_0x169cfa,_0x28f56a){var _0x11be90={},_0x260134={},_0x4537fd={'count':0x0,'rows':[]};var _0x483324=db[_0x216d('0x2e')][_0x216d('0x2f')];_0x260134[_0x216d('0x30')]=_['keys'](_0x483324);_0x260134[_0x216d('0x31')]=_[_0x216d('0x32')](_0x169cfa[_0x216d('0x31')]);_0x260134[_0x216d('0x33')]=_['intersection'](_0x260134[_0x216d('0x30')],_0x260134[_0x216d('0x31')]);_0x11be90[_0x216d('0x34')]=_[_0x216d('0x35')](_0x260134[_0x216d('0x30')],qs[_0x216d('0x36')](_0x169cfa[_0x216d('0x31')][_0x216d('0x36')]));_0x11be90[_0x216d('0x34')]=_0x11be90[_0x216d('0x34')][_0x216d('0x37')]?_0x11be90['attributes']:_0x260134[_0x216d('0x30')];if(!_0x169cfa[_0x216d('0x31')][_0x216d('0x38')]('nolimit')){_0x11be90[_0x216d('0x39')]=qs[_0x216d('0x39')](_0x169cfa['query'][_0x216d('0x39')]);_0x11be90['offset']=qs['offset'](_0x169cfa[_0x216d('0x31')][_0x216d('0x21')]);}_0x11be90[_0x216d('0x3a')]=qs[_0x216d('0x3b')](_0x169cfa['query']['sort']);_0x11be90['where']=qs[_0x216d('0x33')](_[_0x216d('0x3c')](_0x169cfa['query'],_0x260134[_0x216d('0x33')]));if(_0x169cfa[_0x216d('0x31')]['filter']){_0x11be90[_0x216d('0x3d')]=_[_0x216d('0x3e')](_0x11be90[_0x216d('0x3d')],{'$or':_[_0x216d('0x3f')](_0x483324,function(_0x56ce8a){if(_0x56ce8a[_0x216d('0x40')][_0x216d('0x41')]!==_0x216d('0x42')){var _0x54937b={};_0x54937b[_0x56ce8a['field']]={'$like':'%'+_0x169cfa[_0x216d('0x31')][_0x216d('0x43')]+'%'};return _0x54937b;}})});}_0x11be90=_['merge']({},_0x11be90,_0x169cfa[_0x216d('0x44')]);var _0x377c4a={'where':_0x11be90[_0x216d('0x3d')]};return db['CmList'][_0x216d('0x45')](_0x377c4a)[_0x216d('0x26')](function(_0x13d787){_0x4537fd[_0x216d('0x45')]=_0x13d787;if(_0x169cfa['query'][_0x216d('0x46')]){_0x11be90[_0x216d('0x47')]=[{'all':!![]}];}return db['CmList'][_0x216d('0x48')](_0x11be90);})[_0x216d('0x26')](function(_0x590eb6){_0x4537fd['rows']=_0x590eb6;return _0x4537fd;})[_0x216d('0x26')](respondWithFilteredResult(_0x28f56a,_0x11be90))[_0x216d('0x49')](handleError(_0x28f56a,null));};exports[_0x216d('0x4a')]=function(_0x498efe,_0x3e361a){var _0x4f19a1={'raw':![],'where':{'id':_0x498efe[_0x216d('0x4b')]['id']}},_0x57ca1f={};_0x57ca1f[_0x216d('0x30')]=_[_0x216d('0x32')](db['CmList'][_0x216d('0x2f')]);_0x57ca1f['query']=_[_0x216d('0x32')](_0x498efe[_0x216d('0x31')]);_0x57ca1f[_0x216d('0x33')]=_['intersection'](_0x57ca1f[_0x216d('0x30')],_0x57ca1f[_0x216d('0x31')]);_0x4f19a1[_0x216d('0x34')]=_[_0x216d('0x35')](_0x57ca1f['model'],qs['fields'](_0x498efe['query'][_0x216d('0x36')]));_0x4f19a1[_0x216d('0x34')]=_0x4f19a1[_0x216d('0x34')][_0x216d('0x37')]?_0x4f19a1[_0x216d('0x34')]:_0x57ca1f[_0x216d('0x30')];if(_0x498efe[_0x216d('0x31')][_0x216d('0x46')]){_0x4f19a1['include']=[{'all':!![]}];}_0x4f19a1=_[_0x216d('0x3e')]({},_0x4f19a1,_0x498efe[_0x216d('0x44')]);return db[_0x216d('0x2e')][_0x216d('0x4c')](_0x4f19a1)['then'](handleEntityNotFound(_0x3e361a,null))[_0x216d('0x26')](respondWithResult(_0x3e361a,null))['catch'](handleError(_0x3e361a,null));};exports[_0x216d('0x4d')]=function(_0x36179,_0xceb993){return db['CmList']['create'](_0x36179[_0x216d('0x4e')],{})[_0x216d('0x26')](function(_0x3932a3){var _0x1340fe=_0x36179[_0x216d('0x4f')][_0x216d('0x27')]({'plain':!![]});if(!_0x1340fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1340fe['role']===_0x216d('0x4f')){var _0x542630=_0x3932a3[_0x216d('0x27')]({'plain':!![]});var _0x2610d0='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x2610d0,'userProfileId':_0x1340fe['userProfileId']},'raw':!![]})[_0x216d('0x26')](function(_0x318f70){if(_0x318f70&&_0x318f70[_0x216d('0x50')]===0x0){return db[_0x216d('0x51')][_0x216d('0x4d')]({'name':_0x542630[_0x216d('0x2b')],'resourceId':_0x542630['id'],'type':_0x318f70[_0x216d('0x2b')],'sectionId':_0x318f70['id']},{})['then'](function(){return _0x3932a3;});}else{return _0x3932a3;}})[_0x216d('0x49')](function(_0x34cdb9){logger[_0x216d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34cdb9);throw _0x34cdb9;});}return _0x3932a3;})[_0x216d('0x26')](respondWithResult(_0xceb993,0xc9))[_0x216d('0x49')](handleError(_0xceb993,null));};exports[_0x216d('0x52')]=function(_0x3ae305,_0x481754){if(_0x3ae305[_0x216d('0x4e')]['id']){delete _0x3ae305[_0x216d('0x4e')]['id'];}return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x3ae305['params']['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x481754,null))[_0x216d('0x26')](saveUpdates(_0x3ae305['body'],null))[_0x216d('0x26')](respondWithResult(_0x481754,null))['catch'](handleError(_0x481754,null));};exports[_0x216d('0x53')]=function(_0x40d07b,_0x22e025){return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x40d07b[_0x216d('0x4b')]['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x22e025,null))[_0x216d('0x26')](removeEntity(_0x22e025,null))[_0x216d('0x49')](handleError(_0x22e025,null));};exports['describe']=function(_0x3d6c8a,_0x2757b8){return db['CmList'][_0x216d('0x54')]()[_0x216d('0x26')](respondWithResult(_0x2757b8,null))['catch'](handleError(_0x2757b8,null));};exports['addDisposition']=function(_0x3a0ee7,_0x5e4b3d,_0x1d30ea){if(_0x3a0ee7[_0x216d('0x4e')]['id']){delete _0x3a0ee7[_0x216d('0x4e')]['id'];}return db['CmList'][_0x216d('0x4c')]({'where':{'id':_0x3a0ee7['params']['id']}})['then'](handleEntityNotFound(_0x5e4b3d,null))[_0x216d('0x26')](function(_0x38ee94){if(_0x38ee94){_0x3a0ee7['body'][_0x216d('0x55')]=_0x38ee94['id'];return db[_0x216d('0x56')][_0x216d('0x4d')](_0x3a0ee7[_0x216d('0x4e')]);}})[_0x216d('0x26')](respondWithResult(_0x5e4b3d,null))[_0x216d('0x49')](handleError(_0x5e4b3d,null));};exports['getDispositions']=function(_0x5d324e,_0x24ab83,_0xe86ff8){var _0x1ce36c={'raw':![],'where':{}};var _0x1551b6={};var _0x16742c={'count':0x0,'rows':[]};return db[_0x216d('0x2e')][_0x216d('0x57')]({'where':{'id':_0x5d324e[_0x216d('0x4b')]['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x24ab83,null))[_0x216d('0x26')](function(_0x832ad1){if(_0x832ad1){_0x1551b6[_0x216d('0x30')]=_['keys'](db['Disposition'][_0x216d('0x2f')]);_0x1551b6[_0x216d('0x31')]=_['keys'](_0x5d324e[_0x216d('0x31')]);_0x1551b6['filters']=_['intersection'](_0x1551b6[_0x216d('0x30')],_0x1551b6[_0x216d('0x31')]);_0x1ce36c[_0x216d('0x34')]=_[_0x216d('0x35')](_0x1551b6[_0x216d('0x30')],qs[_0x216d('0x36')](_0x5d324e[_0x216d('0x31')][_0x216d('0x36')]));_0x1ce36c[_0x216d('0x34')]=_0x1ce36c[_0x216d('0x34')][_0x216d('0x37')]?_0x1ce36c[_0x216d('0x34')]:_0x1551b6[_0x216d('0x30')];if(!_0x5d324e[_0x216d('0x31')][_0x216d('0x38')](_0x216d('0x58'))){_0x1ce36c[_0x216d('0x39')]=qs[_0x216d('0x39')](_0x5d324e[_0x216d('0x31')][_0x216d('0x39')]);_0x1ce36c[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x5d324e['query'][_0x216d('0x21')]);}_0x1ce36c['order']=qs[_0x216d('0x3b')](_0x5d324e['query'][_0x216d('0x3b')]);_0x1ce36c[_0x216d('0x3d')]=qs['filters'](_[_0x216d('0x3c')](_0x5d324e[_0x216d('0x31')],_0x1551b6[_0x216d('0x33')]));_0x1ce36c[_0x216d('0x3d')][_0x216d('0x55')]=_0x832ad1['id'];if(_0x5d324e[_0x216d('0x31')][_0x216d('0x43')]){_0x1ce36c[_0x216d('0x3d')]=_[_0x216d('0x3e')](_0x1ce36c['where'],{'$or':_[_0x216d('0x3f')](_0x1ce36c[_0x216d('0x34')],function(_0x16cf09){var _0x5c1f30={};_0x5c1f30[_0x16cf09]={'$like':'%'+_0x5d324e['query']['filter']+'%'};return _0x5c1f30;})});}_0x1ce36c=_['merge']({},_0x1ce36c,_0x5d324e[_0x216d('0x44')]);return db['Disposition'][_0x216d('0x45')]({'where':_0x1ce36c[_0x216d('0x3d')]})[_0x216d('0x26')](function(_0x27ce4d){_0x16742c[_0x216d('0x45')]=_0x27ce4d;if(_0x5d324e[_0x216d('0x31')][_0x216d('0x46')]){_0x1ce36c[_0x216d('0x47')]=[{'all':!![]}];}return db[_0x216d('0x56')]['findAll'](_0x1ce36c);})[_0x216d('0x26')](function(_0x34f9b9){_0x16742c['rows']=_0x34f9b9;return _0x16742c;});}})[_0x216d('0x26')](respondWithFilteredResult(_0x24ab83,_0x1ce36c))[_0x216d('0x49')](handleError(_0x24ab83,null));};exports[_0x216d('0x59')]=function(_0x1650fd,_0x12ca0a,_0x428cc4){return db['CmList']['find']({'where':{'id':_0x1650fd[_0x216d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x12ca0a,null))[_0x216d('0x26')](function(_0x2717f9){if(_0x2717f9){return _0x2717f9[_0x216d('0x59')](_0x1650fd['query']['ids']);}})['then'](respondWithStatusCode(_0x12ca0a,null))[_0x216d('0x49')](handleError(_0x12ca0a,null));};exports[_0x216d('0x5a')]=function(_0x133a8e,_0xfabcc0,_0x55f251){return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x133a8e[_0x216d('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfabcc0,null))['then'](function(_0x112fae){if(_0x112fae){var _0x87511b=[];var _0x273d11={'success':[],'errors':[]};return db[_0x216d('0x5b')][_0x216d('0x54')]()['then'](function(_0x1f4d8a){if(_0x133a8e[_0x216d('0x4e')][_0x216d('0x5c')]&&_[_0x216d('0x5d')](_0x133a8e['body'][_0x216d('0x5c')])){if(_0x133a8e['body'][_0x216d('0x5c')]['length']){_0x133a8e[_0x216d('0x4e')][_0x216d('0x5c')]=_0x133a8e[_0x216d('0x4e')][_0x216d('0x5c')][_0x216d('0x5e')](';')+';';}else{_0x133a8e['body'][_0x216d('0x5c')]=null;}}else{_0x133a8e['body']['tags']=null;}if(_0x133a8e['body']&&_['isArray'](_0x133a8e[_0x216d('0x4e')])){for(var _0x38e7d7=0x0;_0x38e7d7<_0x133a8e[_0x216d('0x4e')]['length'];_0x38e7d7+=0x1){_0x133a8e['body'][_0x38e7d7][_0x216d('0x55')]=_0x133a8e[_0x216d('0x4b')]['id'];_0x87511b[_0x216d('0x5f')](_0x133a8e[_0x216d('0x4e')][_0x38e7d7]);}return BPromise[_0x216d('0x60')](_0x87511b,function(_0x5b3c78){return db['CmContact'][_0x216d('0x4d')](_['omit'](_0x5b3c78,[_0x216d('0x61'),'id'])||{},{'fields':_['keys'](_0x1f4d8a),'raw':!![]})[_0x216d('0x26')](function(_0x38b4fa){_0x273d11[_0x216d('0x62')][_0x216d('0x5f')](_0x38b4fa['dataValues']);})['catch'](function(_0x8a7cc8){_0x273d11[_0x216d('0x63')][_0x216d('0x5f')]({'data':_0x5b3c78,'error':_0x8a7cc8[_0x216d('0x64')]});});})['then'](function(_0x1c8690){return _0x273d11;})[_0x216d('0x49')](function(_0xd83874){return _0xd83874;});}else{_0xfabcc0['status'](0x190)['json']({'message':_0x216d('0x65')});}});}})['then'](respondWithResult(_0xfabcc0,null))[_0x216d('0x49')](handleError(_0xfabcc0,null));};exports[_0x216d('0x66')]=function(_0x4bee99,_0x582e7f,_0x3000c4){var _0xc61b2;return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x4bee99[_0x216d('0x4b')]['id']},'include':[{'model':db[_0x216d('0x67')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x582e7f,null))[_0x216d('0x26')](function(_0x16d9fa){if(_0x16d9fa){_0xc61b2=_0x16d9fa;return db[_0x216d('0x5b')][_0x216d('0x2f')];}})[_0x216d('0x26')](function(_0x18beca){if(_0x18beca){var _0x46bda3={};var _0xc64a7f={};_0xc64a7f[_0x216d('0x30')]=_[_0x216d('0x68')](_['keys'](_0x18beca),_[_0x216d('0x3f')](_0xc61b2[_0x216d('0x69')],function(_0xf53ec6){return util[_0x216d('0x6a')](_0x216d('0x6b'),_0xf53ec6['id']);}));_0xc64a7f['query']=_[_0x216d('0x32')](_0x4bee99['query']);_0xc64a7f[_0x216d('0x33')]=_['intersection'](_0xc64a7f[_0x216d('0x30')],_0xc64a7f['query']);_0x46bda3['attributes']=_[_0x216d('0x35')](_0xc64a7f['model'],qs['fields'](_0x4bee99['query'][_0x216d('0x36')]));_0x46bda3['attributes']=_0x46bda3[_0x216d('0x34')]['length']?_0x46bda3['attributes']:_0xc64a7f['model'];if(!_0x4bee99[_0x216d('0x31')][_0x216d('0x38')](_0x216d('0x58'))){_0x46bda3['limit']=qs[_0x216d('0x39')](_0x4bee99[_0x216d('0x31')][_0x216d('0x39')]);_0x46bda3[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x4bee99[_0x216d('0x31')]['offset']);}_0x46bda3[_0x216d('0x3a')]=qs['sort'](_0x4bee99[_0x216d('0x31')][_0x216d('0x3b')]);_0x46bda3[_0x216d('0x3d')]=qs[_0x216d('0x33')](_[_0x216d('0x3c')](_0x4bee99[_0x216d('0x31')],_0xc64a7f[_0x216d('0x33')]));_0x46bda3[_0x216d('0x6c')]=!![];if(_0x4bee99[_0x216d('0x31')][_0x216d('0x43')]){_0x46bda3[_0x216d('0x3d')]=_[_0x216d('0x3e')](_0x46bda3[_0x216d('0x3d')],{'$or':_[_0x216d('0x3f')](_0x46bda3[_0x216d('0x34')],function(_0x34637a){var _0x575d24={};_0x575d24[_0x34637a]={'$like':'%'+_0x4bee99[_0x216d('0x31')][_0x216d('0x43')]+'%'};return _0x575d24;})});}_0x46bda3=_['merge']({},_0x46bda3,_0x4bee99[_0x216d('0x44')]);return _0xc61b2['getContacts'](_0x46bda3);}})[_0x216d('0x26')](respondWithResult(_0x582e7f,null))[_0x216d('0x49')](handleError(_0x582e7f,null));};exports[_0x216d('0x6d')]=function(_0x54036c,_0x2f98df,_0x49b7e4){var _0x3f6e78;return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x54036c[_0x216d('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x216d('0x69')}]})[_0x216d('0x26')](handleEntityNotFound(_0x2f98df,null))[_0x216d('0x26')](function(_0x2b5263){if(_0x2b5263){_0x3f6e78=_0x2b5263;return db[_0x216d('0x5b')][_0x216d('0x2f')];}})[_0x216d('0x26')](function(_0x133155){if(_0x133155){var _0x2ba45d={};var _0x4a8bde={};_0x4a8bde[_0x216d('0x30')]=_['concat'](_[_0x216d('0x32')](_0x133155),_[_0x216d('0x3f')](_0x3f6e78[_0x216d('0x69')],function(_0x4dc265){return util['format'](_0x216d('0x6b'),_0x4dc265['id']);}));_0x4a8bde['query']=_[_0x216d('0x32')](_0x54036c[_0x216d('0x31')]);_0x4a8bde['filters']=_[_0x216d('0x35')](_0x4a8bde[_0x216d('0x30')],_0x4a8bde[_0x216d('0x31')]);_0x2ba45d[_0x216d('0x34')]=_['intersection'](_0x4a8bde[_0x216d('0x30')],qs['fields'](_0x54036c[_0x216d('0x31')][_0x216d('0x36')]));_0x2ba45d[_0x216d('0x34')]=_0x2ba45d[_0x216d('0x34')][_0x216d('0x37')]?_0x2ba45d[_0x216d('0x34')]:_0x4a8bde[_0x216d('0x30')];if(!_0x54036c[_0x216d('0x31')][_0x216d('0x38')](_0x216d('0x58'))){_0x2ba45d['limit']=qs[_0x216d('0x39')](_0x54036c[_0x216d('0x31')][_0x216d('0x39')]);_0x2ba45d[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x54036c[_0x216d('0x31')][_0x216d('0x21')]);}_0x2ba45d[_0x216d('0x3a')]=qs['sort'](_0x54036c[_0x216d('0x31')][_0x216d('0x3b')]);_0x2ba45d[_0x216d('0x3d')]=qs[_0x216d('0x33')](_[_0x216d('0x3c')](_0x54036c['query'],_0x4a8bde[_0x216d('0x33')]));_0x2ba45d[_0x216d('0x6c')]=!![];if(_0x54036c[_0x216d('0x31')]['filter']){_0x2ba45d['where']=_[_0x216d('0x3e')](_0x2ba45d[_0x216d('0x3d')],{'$or':_[_0x216d('0x3f')](_0x2ba45d[_0x216d('0x34')],function(_0x432328){var _0x1eaebd={};_0x1eaebd[_0x432328]={'$like':'%'+_0x54036c[_0x216d('0x31')]['filter']+'%'};return _0x1eaebd;})});}_0x2ba45d=_[_0x216d('0x3e')]({},_0x2ba45d,_0x54036c[_0x216d('0x44')]);return _0x3f6e78[_0x216d('0x66')](_0x2ba45d);}})[_0x216d('0x26')](function(_0x5db2b1){if(!_['isEmpty'](_0x5db2b1)){var _0x4f453e=toCsv(_0x5db2b1);var _0x464596=Date[_0x216d('0x6e')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x3f6e78['id'],_0x464596),_0x4f453e);_0x2f98df[_0x216d('0x6f')](_0x216d('0x70'),_0x216d('0x71')+util[_0x216d('0x6a')]('list_%d_%s.csv',_0x3f6e78['id'],_0x464596));_0x2f98df[_0x216d('0x6f')]('Content-type',_0x216d('0x72'));return _0x2f98df['download'](util[_0x216d('0x6a')](_0x216d('0x73'),_0x3f6e78['id'],_0x464596));}else{return _0x2f98df[_0x216d('0x74')](0xcc);}})[_0x216d('0x49')](handleError(_0x2f98df,null));};exports[_0x216d('0x75')]=function(_0x11aede,_0x48fd75,_0x295f17){var _0x4b6b9e;delete _0x11aede[_0x216d('0x4e')]['id'];return db[_0x216d('0x2e')][_0x216d('0x57')]({'where':{'id':_0x11aede[_0x216d('0x4b')]['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x48fd75,null))['then'](function(_0x19ca82){if(_0x19ca82){return db[_0x216d('0x76')][_0x216d('0x77')](function(_0x300dfa){return db[_0x216d('0x67')]['create'](_0x11aede['body'],{'transaction':_0x300dfa})[_0x216d('0x26')](function(_0xf7e6c){_0x4b6b9e=_0xf7e6c;return _0x19ca82['addCustomFields'](_0xf7e6c,{'transaction':_0x300dfa});})[_0x216d('0x26')](function(){var _0xa6a15b={'type':db[_0x216d('0x78')][_0x216d('0x79')],'transaction':_0x300dfa};switch(_0x11aede['body'][_0x216d('0x40')]){case'text':_0xa6a15b[_0x216d('0x40')]=db['Sequelize']['TEXT'];break;case _0x216d('0x7a'):_0xa6a15b['type']=db[_0x216d('0x78')][_0x216d('0x7b')];break;case _0x216d('0x7c'):_0xa6a15b[_0x216d('0x40')]=db[_0x216d('0x78')][_0x216d('0x7d')];_0xa6a15b[_0x216d('0x7e')]=![];break;default:}return db['sequelize'][_0x216d('0x7f')][_0x216d('0x80')]('cm_contacts',util[_0x216d('0x6a')](_0x216d('0x81'),_0x4b6b9e['id']),_0xa6a15b);})[_0x216d('0x26')](function(){return _0x4b6b9e;});});}})[_0x216d('0x26')](respondWithResult(_0x48fd75,null))[_0x216d('0x49')](handleError(_0x48fd75,null));};exports[_0x216d('0x82')]=function(_0x3d183b,_0x7d7617,_0x3becc9){var _0x2d6d62={};var _0x28818e={};var _0x391f1c;var _0x4e2afa;return db[_0x216d('0x2e')][_0x216d('0x57')]({'where':{'id':_0x3d183b['params']['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x7d7617,null))[_0x216d('0x26')](function(_0x4156ff){if(_0x4156ff){_0x391f1c=_0x4156ff;_0x28818e[_0x216d('0x30')]=_[_0x216d('0x32')](db[_0x216d('0x67')][_0x216d('0x2f')]);_0x28818e[_0x216d('0x31')]=_[_0x216d('0x32')](_0x3d183b[_0x216d('0x31')]);_0x28818e[_0x216d('0x33')]=_[_0x216d('0x35')](_0x28818e['model'],_0x28818e[_0x216d('0x31')]);_0x2d6d62[_0x216d('0x34')]=_[_0x216d('0x35')](_0x28818e[_0x216d('0x30')],qs[_0x216d('0x36')](_0x3d183b[_0x216d('0x31')][_0x216d('0x36')]));_0x2d6d62[_0x216d('0x34')]=_0x2d6d62[_0x216d('0x34')]['length']?_0x2d6d62[_0x216d('0x34')]:_0x28818e[_0x216d('0x30')];_0x2d6d62[_0x216d('0x3a')]=qs[_0x216d('0x3b')](_0x3d183b[_0x216d('0x31')]['sort']);_0x2d6d62[_0x216d('0x3d')]=qs[_0x216d('0x33')](_[_0x216d('0x3c')](_0x3d183b[_0x216d('0x31')],_0x28818e['filters']));_0x2d6d62[_0x216d('0x3d')]=_[_0x216d('0x3e')](_0x2d6d62['where'],{'$or':[{'ListId':_0x4156ff['id']},{'ListId':null}]});if(_0x3d183b[_0x216d('0x31')][_0x216d('0x43')]){_0x2d6d62[_0x216d('0x3d')]=_[_0x216d('0x3e')](_0x2d6d62['where'],{'$or':_[_0x216d('0x3f')](_0x2d6d62[_0x216d('0x34')],function(_0x34dc94){var _0x58dd0d={};_0x58dd0d[_0x34dc94]={'$like':'%'+_0x3d183b[_0x216d('0x31')][_0x216d('0x43')]+'%'};return _0x58dd0d;})});}_0x2d6d62=_['merge']({},_0x2d6d62,_0x3d183b['options']);return db[_0x216d('0x67')][_0x216d('0x83')](_0x2d6d62);}})['then'](respondWithResult(_0x7d7617,null))[_0x216d('0x49')](handleError(_0x7d7617,null));};exports['addAgents']=function(_0x3b386b,_0x3c4288,_0x4ad70f){return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x3b386b[_0x216d('0x4b')]['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x3c4288,null))[_0x216d('0x26')](function(_0x384a7e){if(_0x384a7e){return _0x384a7e['addAgents'](_0x3b386b[_0x216d('0x4e')][_0x216d('0x61')],_['omit'](_0x3b386b['body'],['ids','id'])||{})[_0x216d('0x84')](function(_0x364247){for(var _0x460bb9=0x0;_0x460bb9<_0x3b386b[_0x216d('0x4e')]['ids'][_0x216d('0x37')];_0x460bb9+=0x1){socket['emit']('userCmList:save',{'UserId':_0x3b386b[_0x216d('0x4e')]['ids'][_0x460bb9],'CmListId':_0x3b386b[_0x216d('0x4b')]['id']});}return _0x364247;});}})[_0x216d('0x26')](respondWithResult(_0x3c4288,null))['catch'](handleError(_0x3c4288,null));};exports[_0x216d('0x85')]=function(_0x5250b7,_0x70bd2,_0x3ee6fa){return db[_0x216d('0x2e')][_0x216d('0x4c')]({'where':{'id':_0x5250b7[_0x216d('0x4b')]['id']}})[_0x216d('0x26')](handleEntityNotFound(_0x70bd2,null))[_0x216d('0x26')](function(_0x3a2eb3){if(_0x3a2eb3){return _0x3a2eb3[_0x216d('0x85')](_0x5250b7['query'][_0x216d('0x61')])[_0x216d('0x26')](function(){if(_['isArray'](_0x5250b7[_0x216d('0x31')]['ids'])){for(var _0x208b09=0x0;_0x208b09<_0x5250b7[_0x216d('0x31')][_0x216d('0x61')][_0x216d('0x37')];_0x208b09+=0x1){socket[_0x216d('0x86')]('userCmList:remove',{'UserId':Number(_0x5250b7[_0x216d('0x31')]['ids'][_0x208b09]),'CmListId':Number(_0x5250b7[_0x216d('0x4b')]['id'])});}}else{socket[_0x216d('0x86')]('userCmList:remove',{'UserId':Number(_0x5250b7['query'][_0x216d('0x61')]),'CmListId':Number(_0x5250b7[_0x216d('0x4b')]['id'])});}});}})[_0x216d('0x26')](respondWithStatusCode(_0x70bd2,null))['catch'](handleError(_0x70bd2,null));};exports['getAgents']=function(_0x4c8d6e,_0x295930,_0x5acfa7){var _0x30e1b3={};var _0x40290b={};var _0x212f85;var _0x579543;return db[_0x216d('0x2e')][_0x216d('0x57')]({'where':{'id':_0x4c8d6e[_0x216d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x295930,null))[_0x216d('0x26')](function(_0x8e31be){if(_0x8e31be){_0x212f85=_0x8e31be;_0x40290b[_0x216d('0x30')]=_['keys'](db[_0x216d('0x87')][_0x216d('0x2f')]);_0x40290b['query']=_[_0x216d('0x32')](_0x4c8d6e[_0x216d('0x31')]);_0x40290b[_0x216d('0x33')]=_[_0x216d('0x35')](_0x40290b[_0x216d('0x30')],_0x40290b[_0x216d('0x31')]);_0x30e1b3[_0x216d('0x34')]=_[_0x216d('0x35')](_0x40290b[_0x216d('0x30')],qs['fields'](_0x4c8d6e['query'][_0x216d('0x36')]));_0x30e1b3[_0x216d('0x34')]=_0x30e1b3[_0x216d('0x34')][_0x216d('0x37')]?_0x30e1b3[_0x216d('0x34')]:_0x40290b['model'];_0x30e1b3[_0x216d('0x3a')]=qs[_0x216d('0x3b')](_0x4c8d6e[_0x216d('0x31')]['sort']);_0x30e1b3[_0x216d('0x3d')]=qs[_0x216d('0x33')](_['pick'](_0x4c8d6e['query'],_0x40290b[_0x216d('0x33')]));if(_0x4c8d6e['query'][_0x216d('0x43')]){_0x30e1b3[_0x216d('0x3d')]=_['merge'](_0x30e1b3['where'],{'$or':_['map'](_0x30e1b3[_0x216d('0x34')],function(_0x2642c3){var _0x241b3d={};_0x241b3d[_0x2642c3]={'$like':'%'+_0x4c8d6e[_0x216d('0x31')][_0x216d('0x43')]+'%'};return _0x241b3d;})});}_0x30e1b3=_[_0x216d('0x3e')]({},_0x30e1b3,_0x4c8d6e[_0x216d('0x44')]);return _0x212f85['getAgents'](_0x30e1b3);}})[_0x216d('0x26')](function(_0xd57985){if(_0xd57985){_0x579543=_0xd57985[_0x216d('0x37')];if(!_0x4c8d6e[_0x216d('0x31')][_0x216d('0x38')](_0x216d('0x58'))){_0x30e1b3[_0x216d('0x39')]=qs[_0x216d('0x39')](_0x4c8d6e['query'][_0x216d('0x39')]);_0x30e1b3[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x4c8d6e[_0x216d('0x31')][_0x216d('0x21')]);}return _0x212f85['getAgents'](_0x30e1b3);}})[_0x216d('0x26')](function(_0x4b2ee6){if(_0x4b2ee6){return _0x4b2ee6?{'count':_0x579543,'rows':_0x4b2ee6}:null;}})[_0x216d('0x26')](respondWithResult(_0x295930,null))[_0x216d('0x49')](handleError(_0x295930,null));}; \ No newline at end of file +var _0x4522=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','Lists','end','error','stack','name','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','map','type','key','field','filter','merge','options','includeAll','include','CmList','findAll','rows','show','params','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addDisposition','ListId','Disposition','findOne','removeDispositions','addContacts','CmContact','describe','tags','join','isArray','push','each','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','raw','getContactsCsv','cf_%d','getContacts','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4522,0x1a0));var _0x2452=function(_0x5c6968,_0x35f27a){_0x5c6968=_0x5c6968-0x0;var _0x243611=_0x4522[_0x5c6968];return _0x243611;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2452('0x0'));var zipdir=require(_0x2452('0x1'));var jsonpatch=require(_0x2452('0x2'));var rp=require('request-promise');var moment=require(_0x2452('0x3'));var BPromise=require(_0x2452('0x4'));var Mustache=require(_0x2452('0x5'));var util=require(_0x2452('0x6'));var path=require(_0x2452('0x7'));var sox=require(_0x2452('0x8'));var csv=require(_0x2452('0x9'));var ejs=require(_0x2452('0xa'));var fs=require('fs');var _=require(_0x2452('0xb'));var squel=require(_0x2452('0xc'));var crypto=require(_0x2452('0xd'));var jsforce=require(_0x2452('0xe'));var deskjs=require(_0x2452('0xf'));var toCsv=require(_0x2452('0x9'));var querystring=require(_0x2452('0x10'));var Papa=require(_0x2452('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2452('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2452('0x13'));var utils=require(_0x2452('0x14'));var config=require(_0x2452('0x15'));var db=require(_0x2452('0x16'))['db'];config[_0x2452('0x17')]=_[_0x2452('0x18')](config[_0x2452('0x17')],{'host':_0x2452('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x2452('0x1a')](socket);function respondWithStatusCode(_0x4fafa0,_0x33e592){_0x33e592=_0x33e592||0xcc;return function(_0x506cd4){if(_0x506cd4){return _0x4fafa0[_0x2452('0x1b')](_0x33e592);}return _0x4fafa0[_0x2452('0x1c')](_0x33e592)['end']();};}function respondWithResult(_0x1dbadf,_0x47930c){_0x47930c=_0x47930c||0xc8;return function(_0x3dd8cc){if(_0x3dd8cc){return _0x1dbadf[_0x2452('0x1c')](_0x47930c)[_0x2452('0x1d')](_0x3dd8cc);}};}function respondWithFilteredResult(_0xdede20,_0x4e1d20){return function(_0x2108e4){if(_0x2108e4){var _0x16e33a=_0x2108e4[_0x2452('0x1e')],_0x59d89a=_0x4e1d20[_0x2452('0x1f')],_0x4802ad=_0x4e1d20['offset']+_0x4e1d20[_0x2452('0x20')],_0x1bfb44;if(_0x4802ad>=_0x16e33a){_0x4802ad=_0x16e33a;_0x1bfb44=0xc8;}else{_0x1bfb44=0xce;}_0xdede20[_0x2452('0x1c')](_0x1bfb44);return _0xdede20[_0x2452('0x21')](_0x2452('0x22'),_0x59d89a+'-'+_0x4802ad+'/'+_0x16e33a)[_0x2452('0x1d')](_0x2108e4);}return null;};}function patchUpdates(_0x1c70cb){return function(_0x3f48c2){try{jsonpatch[_0x2452('0x23')](_0x3f48c2,_0x1c70cb,!![]);}catch(_0x5e921d){return BPromise['reject'](_0x5e921d);}return _0x3f48c2[_0x2452('0x24')]();};}function saveUpdates(_0x32dfe7,_0x4bb3ff){return function(_0x17d0a0){if(_0x17d0a0){return _0x17d0a0[_0x2452('0x25')](_0x32dfe7)[_0x2452('0x26')](function(_0x617ba7){return _0x617ba7;});}return null;};}function removeEntity(_0x285281,_0x397f21){return function(_0x155caa){if(_0x155caa){return _0x155caa['destroy']()[_0x2452('0x26')](function(){var _0x27d049=_0x155caa[_0x2452('0x27')]({'plain':!![]});var _0x231410=_0x2452('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x231410,'resourceId':_0x27d049['id']}})[_0x2452('0x26')](function(){return _0x155caa;});})[_0x2452('0x26')](function(){_0x285281[_0x2452('0x1c')](0xcc)[_0x2452('0x29')]();});}};}function handleEntityNotFound(_0x1aac19,_0x48b313){return function(_0x3fba00){if(!_0x3fba00){_0x1aac19[_0x2452('0x1b')](0x194);}return _0x3fba00;};}function handleError(_0x5e9184,_0x4a25aa){_0x4a25aa=_0x4a25aa||0x1f4;return function(_0x332878){logger[_0x2452('0x2a')](_0x332878[_0x2452('0x2b')]);if(_0x332878[_0x2452('0x2c')]){delete _0x332878[_0x2452('0x2c')];}_0x5e9184[_0x2452('0x1c')](_0x4a25aa)['send'](_0x332878);};}exports['index']=function(_0x46b611,_0x454e0a){var _0x130565={},_0x5c36aa={},_0x2fb2ae={'count':0x0,'rows':[]};var _0x586a20=db['CmList'][_0x2452('0x2d')];_0x5c36aa[_0x2452('0x2e')]=_[_0x2452('0x2f')](_0x586a20);_0x5c36aa[_0x2452('0x30')]=_[_0x2452('0x2f')](_0x46b611[_0x2452('0x30')]);_0x5c36aa[_0x2452('0x31')]=_[_0x2452('0x32')](_0x5c36aa[_0x2452('0x2e')],_0x5c36aa[_0x2452('0x30')]);_0x130565[_0x2452('0x33')]=_[_0x2452('0x32')](_0x5c36aa[_0x2452('0x2e')],qs['fields'](_0x46b611[_0x2452('0x30')][_0x2452('0x34')]));_0x130565['attributes']=_0x130565[_0x2452('0x33')]['length']?_0x130565[_0x2452('0x33')]:_0x5c36aa[_0x2452('0x2e')];if(!_0x46b611['query'][_0x2452('0x35')](_0x2452('0x36'))){_0x130565[_0x2452('0x20')]=qs['limit'](_0x46b611[_0x2452('0x30')][_0x2452('0x20')]);_0x130565['offset']=qs[_0x2452('0x1f')](_0x46b611[_0x2452('0x30')][_0x2452('0x1f')]);}_0x130565[_0x2452('0x37')]=qs[_0x2452('0x38')](_0x46b611['query']['sort']);_0x130565['where']=qs[_0x2452('0x31')](_[_0x2452('0x39')](_0x46b611[_0x2452('0x30')],_0x5c36aa[_0x2452('0x31')]));if(_0x46b611[_0x2452('0x30')]['filter']){_0x130565[_0x2452('0x3a')]=_['merge'](_0x130565['where'],{'$or':_[_0x2452('0x3b')](_0x586a20,function(_0x515e7b){if(_0x515e7b[_0x2452('0x3c')][_0x2452('0x3d')]!=='VIRTUAL'){var _0x30b49f={};_0x30b49f[_0x515e7b[_0x2452('0x3e')]]={'$like':'%'+_0x46b611[_0x2452('0x30')][_0x2452('0x3f')]+'%'};return _0x30b49f;}})});}_0x130565=_[_0x2452('0x40')]({},_0x130565,_0x46b611[_0x2452('0x41')]);var _0x1a1af5={'where':_0x130565[_0x2452('0x3a')]};return db['CmList'][_0x2452('0x1e')](_0x1a1af5)['then'](function(_0xaea800){_0x2fb2ae[_0x2452('0x1e')]=_0xaea800;if(_0x46b611['query'][_0x2452('0x42')]){_0x130565[_0x2452('0x43')]=[{'all':!![]}];}return db[_0x2452('0x44')][_0x2452('0x45')](_0x130565);})[_0x2452('0x26')](function(_0x5af887){_0x2fb2ae[_0x2452('0x46')]=_0x5af887;return _0x2fb2ae;})[_0x2452('0x26')](respondWithFilteredResult(_0x454e0a,_0x130565))['catch'](handleError(_0x454e0a,null));};exports[_0x2452('0x47')]=function(_0x449b89,_0xf21655){var _0x249c2e={'raw':![],'where':{'id':_0x449b89[_0x2452('0x48')]['id']}},_0x4f2dfa={};_0x4f2dfa[_0x2452('0x2e')]=_[_0x2452('0x2f')](db[_0x2452('0x44')][_0x2452('0x2d')]);_0x4f2dfa[_0x2452('0x30')]=_['keys'](_0x449b89[_0x2452('0x30')]);_0x4f2dfa['filters']=_[_0x2452('0x32')](_0x4f2dfa[_0x2452('0x2e')],_0x4f2dfa['query']);_0x249c2e['attributes']=_['intersection'](_0x4f2dfa['model'],qs[_0x2452('0x34')](_0x449b89['query'][_0x2452('0x34')]));_0x249c2e['attributes']=_0x249c2e[_0x2452('0x33')][_0x2452('0x49')]?_0x249c2e['attributes']:_0x4f2dfa['model'];if(_0x449b89[_0x2452('0x30')]['includeAll']){_0x249c2e[_0x2452('0x43')]=[{'all':!![]}];}_0x249c2e=_[_0x2452('0x40')]({},_0x249c2e,_0x449b89[_0x2452('0x41')]);return db[_0x2452('0x44')]['find'](_0x249c2e)['then'](handleEntityNotFound(_0xf21655,null))[_0x2452('0x26')](respondWithResult(_0xf21655,null))[_0x2452('0x4a')](handleError(_0xf21655,null));};exports[_0x2452('0x4b')]=function(_0x2d06f2,_0x453373){return db['CmList'][_0x2452('0x4b')](_0x2d06f2['body'],{})[_0x2452('0x26')](function(_0x53fd05){var _0x454666=_0x2d06f2[_0x2452('0x4c')]['get']({'plain':!![]});if(!_0x454666)throw new Error(_0x2452('0x4d'));if(_0x454666['role']===_0x2452('0x4c')){var _0x4ae614=_0x53fd05['get']({'plain':!![]});var _0x53a4cd=_0x2452('0x28');return db[_0x2452('0x4e')][_0x2452('0x4f')]({'where':{'name':_0x53a4cd,'userProfileId':_0x454666['userProfileId']},'raw':!![]})[_0x2452('0x26')](function(_0x39ceba){if(_0x39ceba&&_0x39ceba[_0x2452('0x50')]===0x0){return db[_0x2452('0x51')][_0x2452('0x4b')]({'name':_0x4ae614['name'],'resourceId':_0x4ae614['id'],'type':_0x39ceba[_0x2452('0x2c')],'sectionId':_0x39ceba['id']},{})['then'](function(){return _0x53fd05;});}else{return _0x53fd05;}})[_0x2452('0x4a')](function(_0x44a6f){logger[_0x2452('0x2a')](_0x2452('0x52'),_0x44a6f);throw _0x44a6f;});}return _0x53fd05;})[_0x2452('0x26')](respondWithResult(_0x453373,0xc9))[_0x2452('0x4a')](handleError(_0x453373,null));};exports[_0x2452('0x25')]=function(_0x24b552,_0x3629d3){if(_0x24b552['body']['id']){delete _0x24b552[_0x2452('0x53')]['id'];}return db['CmList'][_0x2452('0x4f')]({'where':{'id':_0x24b552['params']['id']}})[_0x2452('0x26')](handleEntityNotFound(_0x3629d3,null))[_0x2452('0x26')](saveUpdates(_0x24b552['body'],null))[_0x2452('0x26')](respondWithResult(_0x3629d3,null))[_0x2452('0x4a')](handleError(_0x3629d3,null));};exports[_0x2452('0x54')]=function(_0x2fd391,_0x258510){return db[_0x2452('0x44')][_0x2452('0x4f')]({'where':{'id':_0x2fd391[_0x2452('0x48')]['id']}})[_0x2452('0x26')](handleEntityNotFound(_0x258510,null))[_0x2452('0x26')](removeEntity(_0x258510,null))[_0x2452('0x4a')](handleError(_0x258510,null));};exports['describe']=function(_0x6ed5fa,_0x4aef77){return db[_0x2452('0x44')]['describe']()[_0x2452('0x26')](respondWithResult(_0x4aef77,null))[_0x2452('0x4a')](handleError(_0x4aef77,null));};exports[_0x2452('0x55')]=function(_0x1cc61,_0x321092,_0x3b3a5a){if(_0x1cc61[_0x2452('0x53')]['id']){delete _0x1cc61[_0x2452('0x53')]['id'];}return db[_0x2452('0x44')][_0x2452('0x4f')]({'where':{'id':_0x1cc61[_0x2452('0x48')]['id']}})['then'](handleEntityNotFound(_0x321092,null))[_0x2452('0x26')](function(_0x101106){if(_0x101106){_0x1cc61[_0x2452('0x53')][_0x2452('0x56')]=_0x101106['id'];return db[_0x2452('0x57')][_0x2452('0x4b')](_0x1cc61['body']);}})[_0x2452('0x26')](respondWithResult(_0x321092,null))[_0x2452('0x4a')](handleError(_0x321092,null));};exports['getDispositions']=function(_0x2c8480,_0x3a64fc,_0x1b8e8b){var _0x234468={'raw':![],'where':{}};var _0x2f1b16={};var _0xa01d01={'count':0x0,'rows':[]};return db[_0x2452('0x44')][_0x2452('0x58')]({'where':{'id':_0x2c8480[_0x2452('0x48')]['id']}})[_0x2452('0x26')](handleEntityNotFound(_0x3a64fc,null))[_0x2452('0x26')](function(_0x58d25b){if(_0x58d25b){_0x2f1b16['model']=_[_0x2452('0x2f')](db['Disposition'][_0x2452('0x2d')]);_0x2f1b16[_0x2452('0x30')]=_[_0x2452('0x2f')](_0x2c8480[_0x2452('0x30')]);_0x2f1b16[_0x2452('0x31')]=_[_0x2452('0x32')](_0x2f1b16['model'],_0x2f1b16['query']);_0x234468[_0x2452('0x33')]=_['intersection'](_0x2f1b16[_0x2452('0x2e')],qs['fields'](_0x2c8480[_0x2452('0x30')][_0x2452('0x34')]));_0x234468[_0x2452('0x33')]=_0x234468[_0x2452('0x33')]['length']?_0x234468['attributes']:_0x2f1b16['model'];if(!_0x2c8480[_0x2452('0x30')][_0x2452('0x35')]('nolimit')){_0x234468['limit']=qs['limit'](_0x2c8480['query']['limit']);_0x234468[_0x2452('0x1f')]=qs['offset'](_0x2c8480['query'][_0x2452('0x1f')]);}_0x234468[_0x2452('0x37')]=qs[_0x2452('0x38')](_0x2c8480[_0x2452('0x30')][_0x2452('0x38')]);_0x234468[_0x2452('0x3a')]=qs['filters'](_[_0x2452('0x39')](_0x2c8480[_0x2452('0x30')],_0x2f1b16[_0x2452('0x31')]));_0x234468['where']['ListId']=_0x58d25b['id'];if(_0x2c8480[_0x2452('0x30')][_0x2452('0x3f')]){_0x234468[_0x2452('0x3a')]=_[_0x2452('0x40')](_0x234468[_0x2452('0x3a')],{'$or':_[_0x2452('0x3b')](_0x234468[_0x2452('0x33')],function(_0x2b2033){var _0x585648={};_0x585648[_0x2b2033]={'$like':'%'+_0x2c8480[_0x2452('0x30')][_0x2452('0x3f')]+'%'};return _0x585648;})});}_0x234468=_[_0x2452('0x40')]({},_0x234468,_0x2c8480[_0x2452('0x41')]);return db['Disposition'][_0x2452('0x1e')]({'where':_0x234468[_0x2452('0x3a')]})['then'](function(_0x20f796){_0xa01d01[_0x2452('0x1e')]=_0x20f796;if(_0x2c8480[_0x2452('0x30')][_0x2452('0x42')]){_0x234468[_0x2452('0x43')]=[{'all':!![]}];}return db[_0x2452('0x57')][_0x2452('0x45')](_0x234468);})[_0x2452('0x26')](function(_0x521640){_0xa01d01['rows']=_0x521640;return _0xa01d01;});}})[_0x2452('0x26')](respondWithFilteredResult(_0x3a64fc,_0x234468))[_0x2452('0x4a')](handleError(_0x3a64fc,null));};exports[_0x2452('0x59')]=function(_0x1530fe,_0x53c85e,_0x19d376){return db[_0x2452('0x44')][_0x2452('0x4f')]({'where':{'id':_0x1530fe[_0x2452('0x48')]['id']}})['then'](handleEntityNotFound(_0x53c85e,null))[_0x2452('0x26')](function(_0x1c632f){if(_0x1c632f){return _0x1c632f[_0x2452('0x59')](_0x1530fe[_0x2452('0x30')]['ids']);}})['then'](respondWithStatusCode(_0x53c85e,null))[_0x2452('0x4a')](handleError(_0x53c85e,null));};exports[_0x2452('0x5a')]=function(_0x4c5192,_0x388fb8,_0xe02ef1){return db[_0x2452('0x44')][_0x2452('0x4f')]({'where':{'id':_0x4c5192[_0x2452('0x48')]['id']}})[_0x2452('0x26')](handleEntityNotFound(_0x388fb8,null))[_0x2452('0x26')](function(_0x240e94){if(_0x240e94){var _0x3a6a67=[];var _0x378224={'success':[],'errors':[]};return db[_0x2452('0x5b')][_0x2452('0x5c')]()[_0x2452('0x26')](function(_0x326570){if(_0x4c5192[_0x2452('0x53')][_0x2452('0x5d')]&&_['isArray'](_0x4c5192[_0x2452('0x53')][_0x2452('0x5d')])){if(_0x4c5192[_0x2452('0x53')]['tags']['length']){_0x4c5192['body'][_0x2452('0x5d')]=_0x4c5192[_0x2452('0x53')][_0x2452('0x5d')][_0x2452('0x5e')](';')+';';}else{_0x4c5192['body']['tags']=null;}}else{_0x4c5192['body'][_0x2452('0x5d')]=null;}if(_0x4c5192['body']&&_[_0x2452('0x5f')](_0x4c5192['body'])){for(var _0x1aa7e4=0x0;_0x1aa7e4<_0x4c5192['body'][_0x2452('0x49')];_0x1aa7e4+=0x1){_0x4c5192['body'][_0x1aa7e4][_0x2452('0x56')]=_0x4c5192[_0x2452('0x48')]['id'];_0x3a6a67[_0x2452('0x60')](_0x4c5192[_0x2452('0x53')][_0x1aa7e4]);}return BPromise[_0x2452('0x61')](_0x3a6a67,function(_0x5b364f){return db[_0x2452('0x5b')][_0x2452('0x4b')](_[_0x2452('0x62')](_0x5b364f,[_0x2452('0x63'),'id'])||{},{'fields':_[_0x2452('0x2f')](_0x326570),'raw':!![]})[_0x2452('0x26')](function(_0x322a58){_0x378224[_0x2452('0x64')][_0x2452('0x60')](_0x322a58[_0x2452('0x65')]);})[_0x2452('0x4a')](function(_0x5bc43c){_0x378224[_0x2452('0x66')]['push']({'data':_0x5b364f,'error':_0x5bc43c[_0x2452('0x67')]});});})['then'](function(_0x57bc06){return _0x378224;})['catch'](function(_0x59119f){return _0x59119f;});}else{_0x388fb8['status'](0x190)['json']({'message':_0x2452('0x68')});}});}})[_0x2452('0x26')](respondWithResult(_0x388fb8,null))[_0x2452('0x4a')](handleError(_0x388fb8,null));};exports['getContacts']=function(_0x4ef9ed,_0x5448e5,_0x352a66){var _0x2167dc;return db[_0x2452('0x44')][_0x2452('0x4f')]({'where':{'id':_0x4ef9ed[_0x2452('0x48')]['id']},'include':[{'model':db[_0x2452('0x69')],'as':_0x2452('0x6a')}]})['then'](handleEntityNotFound(_0x5448e5,null))[_0x2452('0x26')](function(_0x218103){if(_0x218103){_0x2167dc=_0x218103;return db['CmContact'][_0x2452('0x2d')];}})[_0x2452('0x26')](function(_0x17d026){if(_0x17d026){var _0x1960e1={};var _0x4fc46f={};_0x4fc46f[_0x2452('0x2e')]=_['concat'](_[_0x2452('0x2f')](_0x17d026),_[_0x2452('0x3b')](_0x2167dc[_0x2452('0x6a')],function(_0x45ce05){return util[_0x2452('0x6b')]('cf_%d',_0x45ce05['id']);}));_0x4fc46f[_0x2452('0x30')]=_[_0x2452('0x2f')](_0x4ef9ed[_0x2452('0x30')]);_0x4fc46f[_0x2452('0x31')]=_['intersection'](_0x4fc46f[_0x2452('0x2e')],_0x4fc46f[_0x2452('0x30')]);_0x1960e1[_0x2452('0x33')]=_[_0x2452('0x32')](_0x4fc46f[_0x2452('0x2e')],qs[_0x2452('0x34')](_0x4ef9ed[_0x2452('0x30')]['fields']));_0x1960e1[_0x2452('0x33')]=_0x1960e1['attributes']['length']?_0x1960e1['attributes']:_0x4fc46f[_0x2452('0x2e')];if(!_0x4ef9ed[_0x2452('0x30')][_0x2452('0x35')](_0x2452('0x36'))){_0x1960e1[_0x2452('0x20')]=qs[_0x2452('0x20')](_0x4ef9ed[_0x2452('0x30')][_0x2452('0x20')]);_0x1960e1[_0x2452('0x1f')]=qs['offset'](_0x4ef9ed['query']['offset']);}_0x1960e1[_0x2452('0x37')]=qs['sort'](_0x4ef9ed['query'][_0x2452('0x38')]);_0x1960e1[_0x2452('0x3a')]=qs[_0x2452('0x31')](_[_0x2452('0x39')](_0x4ef9ed[_0x2452('0x30')],_0x4fc46f['filters']));_0x1960e1[_0x2452('0x6c')]=!![];if(_0x4ef9ed[_0x2452('0x30')][_0x2452('0x3f')]){_0x1960e1[_0x2452('0x3a')]=_[_0x2452('0x40')](_0x1960e1['where'],{'$or':_[_0x2452('0x3b')](_0x1960e1['attributes'],function(_0x45f40c){var _0x51b6ef={};_0x51b6ef[_0x45f40c]={'$like':'%'+_0x4ef9ed[_0x2452('0x30')][_0x2452('0x3f')]+'%'};return _0x51b6ef;})});}_0x1960e1=_[_0x2452('0x40')]({},_0x1960e1,_0x4ef9ed[_0x2452('0x41')]);return _0x2167dc['getContacts'](_0x1960e1);}})['then'](respondWithResult(_0x5448e5,null))[_0x2452('0x4a')](handleError(_0x5448e5,null));};exports[_0x2452('0x6d')]=function(_0x323a85,_0x44f633,_0x3acc94){var _0x2e32f7;return db['CmList'][_0x2452('0x4f')]({'where':{'id':_0x323a85[_0x2452('0x48')]['id']},'include':[{'model':db[_0x2452('0x69')],'as':_0x2452('0x6a')}]})['then'](handleEntityNotFound(_0x44f633,null))[_0x2452('0x26')](function(_0x1a16c5){if(_0x1a16c5){_0x2e32f7=_0x1a16c5;return db[_0x2452('0x5b')][_0x2452('0x2d')];}})['then'](function(_0x4aa370){if(_0x4aa370){var _0x12dc88={};var _0x25c7e4={};_0x25c7e4[_0x2452('0x2e')]=_['concat'](_[_0x2452('0x2f')](_0x4aa370),_[_0x2452('0x3b')](_0x2e32f7['CustomFields'],function(_0x4c7ad9){return util['format'](_0x2452('0x6e'),_0x4c7ad9['id']);}));_0x25c7e4[_0x2452('0x30')]=_[_0x2452('0x2f')](_0x323a85['query']);_0x25c7e4[_0x2452('0x31')]=_[_0x2452('0x32')](_0x25c7e4[_0x2452('0x2e')],_0x25c7e4['query']);_0x12dc88['attributes']=_[_0x2452('0x32')](_0x25c7e4['model'],qs[_0x2452('0x34')](_0x323a85[_0x2452('0x30')]['fields']));_0x12dc88[_0x2452('0x33')]=_0x12dc88[_0x2452('0x33')][_0x2452('0x49')]?_0x12dc88['attributes']:_0x25c7e4[_0x2452('0x2e')];if(!_0x323a85[_0x2452('0x30')]['hasOwnProperty'](_0x2452('0x36'))){_0x12dc88[_0x2452('0x20')]=qs[_0x2452('0x20')](_0x323a85[_0x2452('0x30')][_0x2452('0x20')]);_0x12dc88[_0x2452('0x1f')]=qs[_0x2452('0x1f')](_0x323a85['query'][_0x2452('0x1f')]);}_0x12dc88[_0x2452('0x37')]=qs[_0x2452('0x38')](_0x323a85[_0x2452('0x30')][_0x2452('0x38')]);_0x12dc88[_0x2452('0x3a')]=qs[_0x2452('0x31')](_[_0x2452('0x39')](_0x323a85[_0x2452('0x30')],_0x25c7e4['filters']));_0x12dc88[_0x2452('0x6c')]=!![];if(_0x323a85[_0x2452('0x30')][_0x2452('0x3f')]){_0x12dc88[_0x2452('0x3a')]=_[_0x2452('0x40')](_0x12dc88[_0x2452('0x3a')],{'$or':_[_0x2452('0x3b')](_0x12dc88[_0x2452('0x33')],function(_0x3b1ffc){var _0x299cc2={};_0x299cc2[_0x3b1ffc]={'$like':'%'+_0x323a85[_0x2452('0x30')]['filter']+'%'};return _0x299cc2;})});}_0x12dc88=_[_0x2452('0x40')]({},_0x12dc88,_0x323a85[_0x2452('0x41')]);return _0x2e32f7[_0x2452('0x6f')](_0x12dc88);}})['then'](function(_0x4d8ed8){if(!_[_0x2452('0x70')](_0x4d8ed8)){var _0x5dafc1=toCsv(_0x4d8ed8);var _0x1afcce=Date[_0x2452('0x71')]();fs[_0x2452('0x72')](util[_0x2452('0x6b')]('/tmp/list_%d_%s.csv',_0x2e32f7['id'],_0x1afcce),_0x5dafc1);_0x44f633[_0x2452('0x73')](_0x2452('0x74'),_0x2452('0x75')+util[_0x2452('0x6b')](_0x2452('0x76'),_0x2e32f7['id'],_0x1afcce));_0x44f633[_0x2452('0x73')](_0x2452('0x77'),_0x2452('0x78'));return _0x44f633[_0x2452('0x79')](util[_0x2452('0x6b')](_0x2452('0x7a'),_0x2e32f7['id'],_0x1afcce));}else{return _0x44f633['sendStatus'](0xcc);}})['catch'](handleError(_0x44f633,null));};exports['addCustomField']=function(_0x303d0d,_0x364fc0,_0x430133){var _0x2d12f1;delete _0x303d0d[_0x2452('0x53')]['id'];return db[_0x2452('0x44')]['findOne']({'where':{'id':_0x303d0d['params']['id']}})[_0x2452('0x26')](handleEntityNotFound(_0x364fc0,null))[_0x2452('0x26')](function(_0x3ccc5c){if(_0x3ccc5c){return db[_0x2452('0x7b')][_0x2452('0x7c')](function(_0x103302){return db[_0x2452('0x69')][_0x2452('0x4b')](_0x303d0d[_0x2452('0x53')],{'transaction':_0x103302})[_0x2452('0x26')](function(_0x54f965){_0x2d12f1=_0x54f965;return _0x3ccc5c[_0x2452('0x7d')](_0x54f965,{'transaction':_0x103302});})[_0x2452('0x26')](function(){var _0x1c4896={'type':db[_0x2452('0x7e')][_0x2452('0x7f')],'transaction':_0x103302};switch(_0x303d0d[_0x2452('0x53')][_0x2452('0x3c')]){case _0x2452('0x80'):_0x1c4896[_0x2452('0x3c')]=db[_0x2452('0x7e')][_0x2452('0x7f')];break;case _0x2452('0x81'):_0x1c4896[_0x2452('0x3c')]=db[_0x2452('0x7e')][_0x2452('0x82')];break;case _0x2452('0x83'):_0x1c4896[_0x2452('0x3c')]=db[_0x2452('0x7e')][_0x2452('0x84')];_0x1c4896['defaultValue']=![];break;default:}return db[_0x2452('0x7b')][_0x2452('0x85')][_0x2452('0x86')](_0x2452('0x87'),util[_0x2452('0x6b')](_0x2452('0x88'),_0x2d12f1['id']),_0x1c4896);})[_0x2452('0x26')](function(){return _0x2d12f1;});});}})[_0x2452('0x26')](respondWithResult(_0x364fc0,null))['catch'](handleError(_0x364fc0,null));};exports[_0x2452('0x89')]=function(_0x327495,_0x23ee70,_0xb6b3f6){var _0x11d110={};var _0x6d2924={};var _0x51a26f;var _0x5b20cc;return db['CmList'][_0x2452('0x58')]({'where':{'id':_0x327495[_0x2452('0x48')]['id']}})[_0x2452('0x26')](handleEntityNotFound(_0x23ee70,null))[_0x2452('0x26')](function(_0x12e9f6){if(_0x12e9f6){_0x51a26f=_0x12e9f6;_0x6d2924['model']=_[_0x2452('0x2f')](db['CmCustomField'][_0x2452('0x2d')]);_0x6d2924[_0x2452('0x30')]=_[_0x2452('0x2f')](_0x327495['query']);_0x6d2924['filters']=_[_0x2452('0x32')](_0x6d2924['model'],_0x6d2924[_0x2452('0x30')]);_0x11d110[_0x2452('0x33')]=_[_0x2452('0x32')](_0x6d2924[_0x2452('0x2e')],qs[_0x2452('0x34')](_0x327495[_0x2452('0x30')]['fields']));_0x11d110['attributes']=_0x11d110['attributes']['length']?_0x11d110[_0x2452('0x33')]:_0x6d2924[_0x2452('0x2e')];_0x11d110['order']=qs['sort'](_0x327495[_0x2452('0x30')][_0x2452('0x38')]);_0x11d110['where']=qs[_0x2452('0x31')](_[_0x2452('0x39')](_0x327495[_0x2452('0x30')],_0x6d2924[_0x2452('0x31')]));_0x11d110[_0x2452('0x3a')]=_[_0x2452('0x40')](_0x11d110['where'],{'$or':[{'ListId':_0x12e9f6['id']},{'ListId':null}]});if(_0x327495[_0x2452('0x30')][_0x2452('0x3f')]){_0x11d110[_0x2452('0x3a')]=_[_0x2452('0x40')](_0x11d110[_0x2452('0x3a')],{'$or':_['map'](_0x11d110[_0x2452('0x33')],function(_0x1e426a){var _0x50e076={};_0x50e076[_0x1e426a]={'$like':'%'+_0x327495['query'][_0x2452('0x3f')]+'%'};return _0x50e076;})});}_0x11d110=_[_0x2452('0x40')]({},_0x11d110,_0x327495[_0x2452('0x41')]);return db[_0x2452('0x69')]['findAndCountAll'](_0x11d110);}})[_0x2452('0x26')](respondWithResult(_0x23ee70,null))[_0x2452('0x4a')](handleError(_0x23ee70,null));};exports[_0x2452('0x8a')]=function(_0x280261,_0x36ab85,_0x27ac75){return db[_0x2452('0x44')][_0x2452('0x4f')]({'where':{'id':_0x280261[_0x2452('0x48')]['id']}})['then'](handleEntityNotFound(_0x36ab85,null))[_0x2452('0x26')](function(_0x54daf6){if(_0x54daf6){return _0x54daf6['addAgents'](_0x280261[_0x2452('0x53')][_0x2452('0x63')],_[_0x2452('0x62')](_0x280261[_0x2452('0x53')],[_0x2452('0x63'),'id'])||{})['spread'](function(_0x37d9b6){for(var _0x5c1308=0x0;_0x5c1308<_0x280261['body']['ids'][_0x2452('0x49')];_0x5c1308+=0x1){socket[_0x2452('0x8b')](_0x2452('0x8c'),{'UserId':_0x280261[_0x2452('0x53')][_0x2452('0x63')][_0x5c1308],'CmListId':_0x280261[_0x2452('0x48')]['id']});}return _0x37d9b6;});}})[_0x2452('0x26')](respondWithResult(_0x36ab85,null))[_0x2452('0x4a')](handleError(_0x36ab85,null));};exports[_0x2452('0x8d')]=function(_0x2c9ee1,_0x5f071f,_0x17d306){return db['CmList']['find']({'where':{'id':_0x2c9ee1[_0x2452('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f071f,null))[_0x2452('0x26')](function(_0x455cc7){if(_0x455cc7){return _0x455cc7[_0x2452('0x8d')](_0x2c9ee1[_0x2452('0x30')]['ids'])[_0x2452('0x26')](function(){if(_[_0x2452('0x5f')](_0x2c9ee1[_0x2452('0x30')][_0x2452('0x63')])){for(var _0x2c1613=0x0;_0x2c1613<_0x2c9ee1[_0x2452('0x30')][_0x2452('0x63')][_0x2452('0x49')];_0x2c1613+=0x1){socket[_0x2452('0x8b')]('userCmList:remove',{'UserId':Number(_0x2c9ee1[_0x2452('0x30')][_0x2452('0x63')][_0x2c1613]),'CmListId':Number(_0x2c9ee1[_0x2452('0x48')]['id'])});}}else{socket['emit'](_0x2452('0x8e'),{'UserId':Number(_0x2c9ee1['query'][_0x2452('0x63')]),'CmListId':Number(_0x2c9ee1[_0x2452('0x48')]['id'])});}});}})[_0x2452('0x26')](respondWithStatusCode(_0x5f071f,null))[_0x2452('0x4a')](handleError(_0x5f071f,null));};exports[_0x2452('0x8f')]=function(_0x50cd5a,_0xe58a0a,_0x56f5b2){var _0x5bbe02={};var _0x5a6eaa={};var _0x3e3635;var _0x47bfb8;return db[_0x2452('0x44')]['findOne']({'where':{'id':_0x50cd5a[_0x2452('0x48')]['id']}})['then'](handleEntityNotFound(_0xe58a0a,null))[_0x2452('0x26')](function(_0x27d78f){if(_0x27d78f){_0x3e3635=_0x27d78f;_0x5a6eaa[_0x2452('0x2e')]=_[_0x2452('0x2f')](db[_0x2452('0x90')][_0x2452('0x2d')]);_0x5a6eaa['query']=_[_0x2452('0x2f')](_0x50cd5a['query']);_0x5a6eaa[_0x2452('0x31')]=_[_0x2452('0x32')](_0x5a6eaa[_0x2452('0x2e')],_0x5a6eaa[_0x2452('0x30')]);_0x5bbe02['attributes']=_['intersection'](_0x5a6eaa[_0x2452('0x2e')],qs[_0x2452('0x34')](_0x50cd5a[_0x2452('0x30')][_0x2452('0x34')]));_0x5bbe02['attributes']=_0x5bbe02[_0x2452('0x33')][_0x2452('0x49')]?_0x5bbe02['attributes']:_0x5a6eaa[_0x2452('0x2e')];_0x5bbe02[_0x2452('0x37')]=qs[_0x2452('0x38')](_0x50cd5a[_0x2452('0x30')]['sort']);_0x5bbe02[_0x2452('0x3a')]=qs[_0x2452('0x31')](_['pick'](_0x50cd5a['query'],_0x5a6eaa['filters']));if(_0x50cd5a[_0x2452('0x30')][_0x2452('0x3f')]){_0x5bbe02['where']=_['merge'](_0x5bbe02[_0x2452('0x3a')],{'$or':_[_0x2452('0x3b')](_0x5bbe02[_0x2452('0x33')],function(_0x166918){var _0xe0c3ae={};_0xe0c3ae[_0x166918]={'$like':'%'+_0x50cd5a[_0x2452('0x30')][_0x2452('0x3f')]+'%'};return _0xe0c3ae;})});}_0x5bbe02=_[_0x2452('0x40')]({},_0x5bbe02,_0x50cd5a[_0x2452('0x41')]);return _0x3e3635[_0x2452('0x8f')](_0x5bbe02);}})[_0x2452('0x26')](function(_0x4b81e6){if(_0x4b81e6){_0x47bfb8=_0x4b81e6[_0x2452('0x49')];if(!_0x50cd5a['query'][_0x2452('0x35')](_0x2452('0x36'))){_0x5bbe02[_0x2452('0x20')]=qs[_0x2452('0x20')](_0x50cd5a['query'][_0x2452('0x20')]);_0x5bbe02[_0x2452('0x1f')]=qs[_0x2452('0x1f')](_0x50cd5a[_0x2452('0x30')][_0x2452('0x1f')]);}return _0x3e3635[_0x2452('0x8f')](_0x5bbe02);}})[_0x2452('0x26')](function(_0x321abf){if(_0x321abf){return _0x321abf?{'count':_0x47bfb8,'rows':_0x321abf}:null;}})[_0x2452('0x26')](respondWithResult(_0xe58a0a,null))[_0x2452('0x4a')](handleError(_0xe58a0a,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b74d15d..5b918c7 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 _0xce62=['events','../../mysqldb','CmList','update','remove','emit','hook'];(function(_0x1fb959,_0x1e3266){var _0x350744=function(_0x2ebb29){while(--_0x2ebb29){_0x1fb959['push'](_0x1fb959['shift']());}};_0x350744(++_0x1e3266);}(_0xce62,0xd2));var _0x2ce6=function(_0x1bf9b8,_0x8afd72){_0x1bf9b8=_0x1bf9b8-0x0;var _0x35ea0d=_0xce62[_0x1bf9b8];return _0x35ea0d;};'use strict';var EventEmitter=require(_0x2ce6('0x0'));var CmList=require(_0x2ce6('0x1'))['db'][_0x2ce6('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ce6('0x3'),'afterDestroy':_0x2ce6('0x4')};function emitEvent(_0x586722){return function(_0x5f6744,_0x32949f,_0x37e936){CmListEvents[_0x2ce6('0x5')](_0x586722+':'+_0x5f6744['id'],_0x5f6744);CmListEvents[_0x2ce6('0x5')](_0x586722,_0x5f6744);_0x37e936(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x2ce6('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x6c40=['exports','../../mysqldb','CmList','setMaxListeners','update','remove','emit','hook'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x6c40,0x1a1));var _0x06c4=function(_0x571874,_0x7cc1a){_0x571874=_0x571874-0x0;var _0x4d6c5e=_0x6c40[_0x571874];return _0x4d6c5e;};'use strict';var EventEmitter=require('events');var CmList=require(_0x06c4('0x0'))['db'][_0x06c4('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x06c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x06c4('0x3'),'afterDestroy':_0x06c4('0x4')};function emitEvent(_0x43b14b){return function(_0x4f2754,_0x39e53a,_0x3a7a30){CmListEvents[_0x06c4('0x5')](_0x43b14b+':'+_0x4f2754['id'],_0x4f2754);CmListEvents['emit'](_0x43b14b,_0x4f2754);_0x3a7a30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x06c4('0x6')](e,emitEvent(event));}}module[_0x06c4('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cde9881..4ec8de1 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 _0x710e=['path','../../config/environment','./cmList.attributes','define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise'];(function(_0x93be41,_0x46c7f2){var _0x5cf92a=function(_0x38096a){while(--_0x38096a){_0x93be41['push'](_0x93be41['shift']());}};_0x5cf92a(++_0x46c7f2);}(_0x710e,0xb6));var _0xe710=function(_0x12964f,_0x4f2cce){_0x12964f=_0x12964f-0x0;var _0x20eacf=_0x710e[_0x12964f];return _0x20eacf;};'use strict';var _=require(_0xe710('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe710('0x1'));var moment=require(_0xe710('0x2'));var BPromise=require(_0xe710('0x3'));var rp=require(_0xe710('0x4'));var fs=require('fs');var path=require(_0xe710('0x5'));var rimraf=require('rimraf');var config=require(_0xe710('0x6'));var attributes=require(_0xe710('0x7'));module['exports']=function(_0x5a9e4c,_0xd8271b){return _0x5a9e4c[_0xe710('0x8')](_0xe710('0x9'),attributes,{'tableName':_0xe710('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9181=['CmList','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x2dd22e,_0xec41fe){var _0x257b01=function(_0x26de99){while(--_0x26de99){_0x2dd22e['push'](_0x2dd22e['shift']());}};_0x257b01(++_0xec41fe);}(_0x9181,0x182));var _0x1918=function(_0x56aa6f,_0x5bebee){_0x56aa6f=_0x56aa6f-0x0;var _0x4f9c35=_0x9181[_0x56aa6f];return _0x4f9c35;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var logger=require(_0x1918('0x2'))(_0x1918('0x3'));var moment=require(_0x1918('0x4'));var BPromise=require('bluebird');var rp=require(_0x1918('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var attributes=require(_0x1918('0x8'));module[_0x1918('0x9')]=function(_0x424951,_0x4106d7){return _0x424951['define'](_0x1918('0xa'),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 0870a1b..ebb5e90 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 _0x93f4=['error','code','message','CmList,\x20%s,\x20%s','info','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93f4,0x69));var _0x493f=function(_0x23ad70,_0x279a80){_0x23ad70=_0x23ad70-0x0;var _0x39e32b=_0x93f4[_0x23ad70];return _0x39e32b;};'use strict';var _=require(_0x493f('0x0'));var util=require(_0x493f('0x1'));var moment=require('moment');var BPromise=require(_0x493f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x493f('0x3'))['db'];var utils=require(_0x493f('0x4'));var logger=require(_0x493f('0x5'))(_0x493f('0x6'));var config=require(_0x493f('0x7'));var jayson=require(_0x493f('0x8'));var client=jayson[_0x493f('0x9')][_0x493f('0xa')]({'port':0x232a});config[_0x493f('0xb')]=_['defaults'](config[_0x493f('0xb')],{'host':_0x493f('0xc'),'port':0x18eb});var socket=require(_0x493f('0xd'))(new Redis(config['redis']));require(_0x493f('0xe'))[_0x493f('0xf')](socket);function respondWithRpcPromise(_0x18ebf7,_0x491458,_0x5eb525){return new BPromise(function(_0x4ec72f,_0x58c004){return client['request'](_0x18ebf7,_0x5eb525)['then'](function(_0x1f043d){logger['info']('CmList,\x20%s,\x20%s',_0x491458,_0x493f('0x10'));logger[_0x493f('0x11')](_0x493f('0x12'),_0x491458,'request\x20sent',JSON[_0x493f('0x13')](_0x1f043d));if(_0x1f043d[_0x493f('0x14')]){if(_0x1f043d['error'][_0x493f('0x15')]===0x1f4){logger[_0x493f('0x14')]('CmList,\x20%s,\x20%s',_0x491458,_0x1f043d[_0x493f('0x14')][_0x493f('0x16')]);return _0x58c004(_0x1f043d[_0x493f('0x14')][_0x493f('0x16')]);}logger[_0x493f('0x14')](_0x493f('0x17'),_0x491458,_0x1f043d[_0x493f('0x14')][_0x493f('0x16')]);return _0x4ec72f(_0x1f043d[_0x493f('0x14')][_0x493f('0x16')]);}else{logger[_0x493f('0x18')](_0x493f('0x17'),_0x491458,_0x493f('0x10'));_0x4ec72f(_0x1f043d['result'][_0x493f('0x16')]);}})['catch'](function(_0xa5578a){logger[_0x493f('0x14')]('CmList,\x20%s,\x20%s',_0x491458,_0xa5578a);_0x58c004(_0xa5578a);});});} \ No newline at end of file +var _0xebd3=['../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xebd3,0x90));var _0x3ebd=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0xebd3[_0x12e3e3];return _0x26602e;};'use strict';var _=require(_0x3ebd('0x0'));var util=require(_0x3ebd('0x1'));var moment=require(_0x3ebd('0x2'));var BPromise=require(_0x3ebd('0x3'));var rs=require(_0x3ebd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ebd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ebd('0x6'))(_0x3ebd('0x7'));var config=require('../../config/environment');var jayson=require(_0x3ebd('0x8'));var client=jayson[_0x3ebd('0x9')][_0x3ebd('0xa')]({'port':0x232a});config[_0x3ebd('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ebd('0xc'))(new Redis(config[_0x3ebd('0xb')]));require(_0x3ebd('0xd'))['register'](socket);function respondWithRpcPromise(_0x47e3de,_0x310cd3,_0x3051ca){return new BPromise(function(_0x1863d,_0x48d6ae){return client[_0x3ebd('0xe')](_0x47e3de,_0x3051ca)[_0x3ebd('0xf')](function(_0x27f104){logger[_0x3ebd('0x10')](_0x3ebd('0x11'),_0x310cd3,_0x3ebd('0x12'));logger['debug'](_0x3ebd('0x13'),_0x310cd3,_0x3ebd('0x12'),JSON[_0x3ebd('0x14')](_0x27f104));if(_0x27f104[_0x3ebd('0x15')]){if(_0x27f104[_0x3ebd('0x15')][_0x3ebd('0x16')]===0x1f4){logger['error'](_0x3ebd('0x11'),_0x310cd3,_0x27f104[_0x3ebd('0x15')][_0x3ebd('0x17')]);return _0x48d6ae(_0x27f104[_0x3ebd('0x15')][_0x3ebd('0x17')]);}logger[_0x3ebd('0x15')](_0x3ebd('0x11'),_0x310cd3,_0x27f104[_0x3ebd('0x15')][_0x3ebd('0x17')]);return _0x1863d(_0x27f104[_0x3ebd('0x15')][_0x3ebd('0x17')]);}else{logger[_0x3ebd('0x10')]('CmList,\x20%s,\x20%s',_0x310cd3,_0x3ebd('0x12'));_0x1863d(_0x27f104[_0x3ebd('0x18')][_0x3ebd('0x17')]);}})['catch'](function(_0x137c5d){logger[_0x3ebd('0x15')]('CmList,\x20%s,\x20%s',_0x310cd3,_0x137c5d);_0x48d6ae(_0x137c5d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d4020df..4ce8105 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 _0x7f98=['register','length','cmList:','./cmList.events','remove','emit','removeListener'];(function(_0x51aae3,_0x34b15e){var _0xb5b887=function(_0x11d792){while(--_0x11d792){_0x51aae3['push'](_0x51aae3['shift']());}};_0xb5b887(++_0x34b15e);}(_0x7f98,0xc0));var _0x87f9=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x7f98[_0x36eaaa];return _0x461349;};'use strict';var CmListEvents=require(_0x87f9('0x0'));var events=['save',_0x87f9('0x1'),'update'];function createListener(_0x103aaa,_0x233330){return function(_0x7a0e02){_0x233330[_0x87f9('0x2')](_0x103aaa,_0x7a0e02);};}function removeListener(_0x38df31,_0x1ef1a4){return function(){CmListEvents[_0x87f9('0x3')](_0x38df31,_0x1ef1a4);};}exports[_0x87f9('0x4')]=function(_0xce2cb1){for(var _0x123da2=0x0,_0x2fffbc=events[_0x87f9('0x5')];_0x123da2<_0x2fffbc;_0x123da2++){var _0x5c3e20=events[_0x123da2];var _0x18b2a1=createListener(_0x87f9('0x6')+_0x5c3e20,_0xce2cb1);CmListEvents['on'](_0x5c3e20,_0x18b2a1);}}; \ No newline at end of file +var _0x4309=['save','remove','update','register','length','cmList:','./cmList.events'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0x4309,0x133));var _0x9430=function(_0x1437e8,_0x556363){_0x1437e8=_0x1437e8-0x0;var _0x4b3e74=_0x4309[_0x1437e8];return _0x4b3e74;};'use strict';var CmListEvents=require(_0x9430('0x0'));var events=[_0x9430('0x1'),_0x9430('0x2'),_0x9430('0x3')];function createListener(_0x51a13b,_0x103619){return function(_0x3a7c05){_0x103619['emit'](_0x51a13b,_0x3a7c05);};}function removeListener(_0x4cd4c7,_0x159061){return function(){CmListEvents['removeListener'](_0x4cd4c7,_0x159061);};}exports[_0x9430('0x4')]=function(_0x28d9c3){for(var _0x42cffa=0x0,_0x1f9ec3=events[_0x9430('0x5')];_0x42cffa<_0x1f9ec3;_0x42cffa++){var _0x80d7fb=events[_0x42cffa];var _0x3906af=createListener(_0x9430('0x6')+_0x80d7fb,_0x28d9c3);CmListEvents['on'](_0x80d7fb,_0x3906af);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a45951b..4df742f 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 _0x2864=['addContacts','addAgents','put','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2864,0xda));var _0x4286=function(_0x52fa77,_0x2b381b){_0x52fa77=_0x52fa77-0x0;var _0x477535=_0x2864[_0x52fa77];return _0x477535;};'use strict';var multer=require(_0x4286('0x0'));var util=require('util');var path=require(_0x4286('0x1'));var timeout=require(_0x4286('0x2'));var express=require(_0x4286('0x3'));var router=express[_0x4286('0x4')]();var auth=require(_0x4286('0x5'));var interaction=require(_0x4286('0x6'));var config=require(_0x4286('0x7'));var controller=require(_0x4286('0x8'));router['get']('/',auth[_0x4286('0x9')](),controller[_0x4286('0xa')]);router['get']('/describe',auth[_0x4286('0x9')](),controller[_0x4286('0xb')]);router[_0x4286('0xc')](_0x4286('0xd'),auth[_0x4286('0x9')](),controller[_0x4286('0xe')]);router['get'](_0x4286('0xf'),auth['isAuthenticated'](),controller[_0x4286('0x10')]);router[_0x4286('0xc')](_0x4286('0x11'),auth['isAuthenticated'](),controller[_0x4286('0x12')]);router[_0x4286('0xc')](_0x4286('0x13'),auth['isAuthenticated'](),controller[_0x4286('0x14')]);router[_0x4286('0xc')](_0x4286('0x15'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x4286('0xc')](_0x4286('0x16'),auth[_0x4286('0x9')](),controller[_0x4286('0x17')]);router[_0x4286('0x18')]('/',auth['isAuthenticated'](),controller[_0x4286('0x19')]);router[_0x4286('0x18')](_0x4286('0xf'),auth['isAuthenticated'](),controller[_0x4286('0x1a')]);router['post'](_0x4286('0x11'),auth[_0x4286('0x9')](),controller[_0x4286('0x1b')]);router[_0x4286('0x18')]('/:id/fields',auth[_0x4286('0x9')](),controller['addCustomField']);router[_0x4286('0x18')](_0x4286('0x16'),auth['isAuthenticated'](),controller[_0x4286('0x1c')]);router[_0x4286('0x1d')](_0x4286('0xd'),auth[_0x4286('0x9')](),controller['update']);router['delete'](_0x4286('0xd'),auth[_0x4286('0x9')](),controller[_0x4286('0x1e')]);router[_0x4286('0x1f')](_0x4286('0xf'),auth[_0x4286('0x9')](),controller[_0x4286('0x20')]);router[_0x4286('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x4286('0x21')]);module[_0x4286('0x22')]=router; \ No newline at end of file +var _0x3bd5=['addDisposition','addContacts','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post'];(function(_0x3b8392,_0x417827){var _0x1bf877=function(_0x322ab3){while(--_0x322ab3){_0x3b8392['push'](_0x3b8392['shift']());}};_0x1bf877(++_0x417827);}(_0x3bd5,0x169));var _0x53bd=function(_0x46bbc9,_0x5cf6d2){_0x46bbc9=_0x46bbc9-0x0;var _0x3fd869=_0x3bd5[_0x46bbc9];return _0x3fd869;};'use strict';var multer=require(_0x53bd('0x0'));var util=require(_0x53bd('0x1'));var path=require(_0x53bd('0x2'));var timeout=require('connect-timeout');var express=require(_0x53bd('0x3'));var router=express[_0x53bd('0x4')]();var auth=require(_0x53bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x53bd('0x6'));var controller=require('./cmList.controller');router[_0x53bd('0x7')]('/',auth[_0x53bd('0x8')](),controller[_0x53bd('0x9')]);router[_0x53bd('0x7')](_0x53bd('0xa'),auth[_0x53bd('0x8')](),controller[_0x53bd('0xb')]);router[_0x53bd('0x7')](_0x53bd('0xc'),auth[_0x53bd('0x8')](),controller['show']);router[_0x53bd('0x7')](_0x53bd('0xd'),auth['isAuthenticated'](),controller[_0x53bd('0xe')]);router[_0x53bd('0x7')](_0x53bd('0xf'),auth[_0x53bd('0x8')](),controller['getContacts']);router[_0x53bd('0x7')](_0x53bd('0x10'),auth[_0x53bd('0x8')](),controller[_0x53bd('0x11')]);router['get'](_0x53bd('0x12'),auth[_0x53bd('0x8')](),controller[_0x53bd('0x13')]);router['get'](_0x53bd('0x14'),auth['isAuthenticated'](),controller[_0x53bd('0x15')]);router['post']('/',auth[_0x53bd('0x8')](),controller['create']);router[_0x53bd('0x16')](_0x53bd('0xd'),auth[_0x53bd('0x8')](),controller[_0x53bd('0x17')]);router[_0x53bd('0x16')](_0x53bd('0xf'),auth[_0x53bd('0x8')](),controller[_0x53bd('0x18')]);router[_0x53bd('0x16')]('/:id/fields',auth[_0x53bd('0x8')](),controller['addCustomField']);router['post']('/:id/users',auth[_0x53bd('0x8')](),controller[_0x53bd('0x19')]);router[_0x53bd('0x1a')]('/:id',auth[_0x53bd('0x8')](),controller[_0x53bd('0x1b')]);router[_0x53bd('0x1c')](_0x53bd('0xc'),auth[_0x53bd('0x8')](),controller[_0x53bd('0x1d')]);router['delete'](_0x53bd('0xd'),auth[_0x53bd('0x8')](),controller[_0x53bd('0x1e')]);router['delete']('/:id/users',auth[_0x53bd('0x8')](),controller['removeAgents']);module[_0x53bd('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a28f318..028c7b1 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 _0x4300=['STRING','sequelize','exports','getDataValue'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4300,0x155));var _0x0430=function(_0x503461,_0x508033){_0x503461=_0x503461-0x0;var _0x3a440a=_0x4300[_0x503461];return _0x3a440a;};'use strict';var Sequelize=require(_0x0430('0x0'));module[_0x0430('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x584209){return this[_0x0430('0x2')]('field');}},'field':{'type':Sequelize[_0x0430('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x0430('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x0430('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x4033=['sequelize','exports','getDataValue','STRING'];(function(_0x53c271,_0x30d5f9){var _0x3574bb=function(_0x4dc85a){while(--_0x4dc85a){_0x53c271['push'](_0x53c271['shift']());}};_0x3574bb(++_0x30d5f9);}(_0x4033,0x1b4));var _0x3403=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x4033[_0x4f3b2d];return _0x3dddfa;};'use strict';var Sequelize=require(_0x3403('0x0'));module[_0x3403('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2b6164){return this[_0x3403('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x3403('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x3403('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b189ae0..41a9810 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 _0x15cc=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','update','find','catch','Condition','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15cc,0x9b));var _0xc15c=function(_0x3c5bf1,_0x30bb33){_0x3c5bf1=_0x3c5bf1-0x0;var _0x2dc4d3=_0x15cc[_0x3c5bf1];return _0x2dc4d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc15c('0x0'));var rimraf=require(_0xc15c('0x1'));var zipdir=require(_0xc15c('0x2'));var jsonpatch=require(_0xc15c('0x3'));var rp=require('request-promise');var moment=require(_0xc15c('0x4'));var BPromise=require(_0xc15c('0x5'));var Mustache=require(_0xc15c('0x6'));var util=require('util');var path=require(_0xc15c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc15c('0x8'));var crypto=require(_0xc15c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc15c('0xa'));var toCsv=require(_0xc15c('0xb'));var querystring=require(_0xc15c('0xc'));var Papa=require(_0xc15c('0xd'));var Redis=require(_0xc15c('0xe'));var authService=require(_0xc15c('0xf'));var qs=require(_0xc15c('0x10'));var hardwareService=require(_0xc15c('0x11'));var logger=require(_0xc15c('0x12'))('api');var utils=require(_0xc15c('0x13'));var config=require(_0xc15c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x431a62,_0x4e5baf){_0x4e5baf=_0x4e5baf||0xcc;return function(_0x3efd3f){if(_0x3efd3f){return _0x431a62[_0xc15c('0x15')](_0x4e5baf);}return _0x431a62[_0xc15c('0x16')](_0x4e5baf)['end']();};}function respondWithResult(_0x3836ec,_0x5f5d95){_0x5f5d95=_0x5f5d95||0xc8;return function(_0x229d09){if(_0x229d09){return _0x3836ec[_0xc15c('0x16')](_0x5f5d95)[_0xc15c('0x17')](_0x229d09);}};}function respondWithFilteredResult(_0x3c64dc,_0x2812db){return function(_0x7bd9cc){if(_0x7bd9cc){var _0xdfa276=_0x7bd9cc[_0xc15c('0x18')],_0x34c8f5=_0x2812db[_0xc15c('0x19')],_0x40bcfa=_0x2812db[_0xc15c('0x19')]+_0x2812db[_0xc15c('0x1a')],_0x7aa397;if(_0x40bcfa>=_0xdfa276){_0x40bcfa=_0xdfa276;_0x7aa397=0xc8;}else{_0x7aa397=0xce;}_0x3c64dc['status'](_0x7aa397);return _0x3c64dc[_0xc15c('0x1b')](_0xc15c('0x1c'),_0x34c8f5+'-'+_0x40bcfa+'/'+_0xdfa276)[_0xc15c('0x17')](_0x7bd9cc);}return null;};}function patchUpdates(_0x556e8c){return function(_0x195d8f){try{jsonpatch[_0xc15c('0x1d')](_0x195d8f,_0x556e8c,!![]);}catch(_0x6c639e){return BPromise[_0xc15c('0x1e')](_0x6c639e);}return _0x195d8f[_0xc15c('0x1f')]();};}function saveUpdates(_0x3c4737,_0x28d785){return function(_0x3bf3f4){if(_0x3bf3f4){return _0x3bf3f4['update'](_0x3c4737)[_0xc15c('0x20')](function(_0x4e64f2){return _0x4e64f2;});}return null;};}function removeEntity(_0x137c9,_0x333eed){return function(_0x13b85b){if(_0x13b85b){return _0x13b85b['destroy']()[_0xc15c('0x20')](function(){_0x137c9[_0xc15c('0x16')](0xcc)[_0xc15c('0x21')]();});}};}function handleEntityNotFound(_0x391fe2,_0x31d9cd){return function(_0x5ba56e){if(!_0x5ba56e){_0x391fe2[_0xc15c('0x15')](0x194);}return _0x5ba56e;};}function handleError(_0x438297,_0x30ac99){_0x30ac99=_0x30ac99||0x1f4;return function(_0x3aa95a){logger[_0xc15c('0x22')](_0x3aa95a[_0xc15c('0x23')]);if(_0x3aa95a[_0xc15c('0x24')]){delete _0x3aa95a[_0xc15c('0x24')];}_0x438297[_0xc15c('0x16')](_0x30ac99)[_0xc15c('0x25')](_0x3aa95a);};}exports[_0xc15c('0x26')]=function(_0x43dfa0,_0x41a547){if(_0x43dfa0['body']['id']){delete _0x43dfa0['body']['id'];}return db['Condition'][_0xc15c('0x27')]({'where':{'id':_0x43dfa0['params']['id']}})[_0xc15c('0x20')](handleEntityNotFound(_0x41a547,null))['then'](saveUpdates(_0x43dfa0['body'],null))[_0xc15c('0x20')](respondWithResult(_0x41a547,null))[_0xc15c('0x28')](handleError(_0x41a547,null));};exports['destroy']=function(_0x505556,_0x5b609e){return db[_0xc15c('0x29')][_0xc15c('0x27')]({'where':{'id':_0x505556[_0xc15c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b609e,null))['then'](removeEntity(_0x5b609e,null))[_0xc15c('0x28')](handleError(_0x5b609e,null));}; \ No newline at end of file +var _0x4afe=['apply','reject','update','error','name','send','body','Condition','find','params','then','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4afe,0x1ba));var _0xe4af=function(_0x48ae79,_0x354a85){_0x48ae79=_0x48ae79-0x0;var _0xf42422=_0x4afe[_0x48ae79];return _0xf42422;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe4af('0x0'));var zipdir=require(_0xe4af('0x1'));var jsonpatch=require(_0xe4af('0x2'));var rp=require(_0xe4af('0x3'));var moment=require(_0xe4af('0x4'));var BPromise=require(_0xe4af('0x5'));var Mustache=require('mustache');var util=require(_0xe4af('0x6'));var path=require(_0xe4af('0x7'));var sox=require(_0xe4af('0x8'));var csv=require(_0xe4af('0x9'));var ejs=require(_0xe4af('0xa'));var fs=require('fs');var _=require(_0xe4af('0xb'));var squel=require(_0xe4af('0xc'));var crypto=require('crypto');var jsforce=require(_0xe4af('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe4af('0xe'));var Papa=require(_0xe4af('0xf'));var Redis=require('ioredis');var authService=require(_0xe4af('0x10'));var qs=require(_0xe4af('0x11'));var hardwareService=require(_0xe4af('0x12'));var logger=require('../../config/logger')(_0xe4af('0x13'));var utils=require('../../config/utils');var config=require(_0xe4af('0x14'));var db=require(_0xe4af('0x15'))['db'];function respondWithStatusCode(_0x3b2fe6,_0x37136d){_0x37136d=_0x37136d||0xcc;return function(_0xbf7e70){if(_0xbf7e70){return _0x3b2fe6[_0xe4af('0x16')](_0x37136d);}return _0x3b2fe6['status'](_0x37136d)[_0xe4af('0x17')]();};}function respondWithResult(_0x504dd8,_0x2e8d1d){_0x2e8d1d=_0x2e8d1d||0xc8;return function(_0x4d3b78){if(_0x4d3b78){return _0x504dd8[_0xe4af('0x18')](_0x2e8d1d)[_0xe4af('0x19')](_0x4d3b78);}};}function respondWithFilteredResult(_0x5e55e7,_0x20ea92){return function(_0x3e21d5){if(_0x3e21d5){var _0x12e53a=_0x3e21d5[_0xe4af('0x1a')],_0x52a0f8=_0x20ea92[_0xe4af('0x1b')],_0x208007=_0x20ea92[_0xe4af('0x1b')]+_0x20ea92[_0xe4af('0x1c')],_0x1044ba;if(_0x208007>=_0x12e53a){_0x208007=_0x12e53a;_0x1044ba=0xc8;}else{_0x1044ba=0xce;}_0x5e55e7[_0xe4af('0x18')](_0x1044ba);return _0x5e55e7[_0xe4af('0x1d')](_0xe4af('0x1e'),_0x52a0f8+'-'+_0x208007+'/'+_0x12e53a)[_0xe4af('0x19')](_0x3e21d5);}return null;};}function patchUpdates(_0x2ca78d){return function(_0x3ed4fd){try{jsonpatch[_0xe4af('0x1f')](_0x3ed4fd,_0x2ca78d,!![]);}catch(_0x4a963d){return BPromise[_0xe4af('0x20')](_0x4a963d);}return _0x3ed4fd['save']();};}function saveUpdates(_0x364b61,_0x1b5e2b){return function(_0x365239){if(_0x365239){return _0x365239[_0xe4af('0x21')](_0x364b61)['then'](function(_0x4eb392){return _0x4eb392;});}return null;};}function removeEntity(_0x17eff4,_0x4236af){return function(_0xb4e1cf){if(_0xb4e1cf){return _0xb4e1cf['destroy']()['then'](function(){_0x17eff4[_0xe4af('0x18')](0xcc)[_0xe4af('0x17')]();});}};}function handleEntityNotFound(_0x19115b,_0x2142e9){return function(_0x516873){if(!_0x516873){_0x19115b[_0xe4af('0x16')](0x194);}return _0x516873;};}function handleError(_0x4e1332,_0x4b1ec3){_0x4b1ec3=_0x4b1ec3||0x1f4;return function(_0x50e479){logger[_0xe4af('0x22')](_0x50e479['stack']);if(_0x50e479[_0xe4af('0x23')]){delete _0x50e479[_0xe4af('0x23')];}_0x4e1332[_0xe4af('0x18')](_0x4b1ec3)[_0xe4af('0x24')](_0x50e479);};}exports['update']=function(_0xa9a218,_0x5cebfe){if(_0xa9a218[_0xe4af('0x25')]['id']){delete _0xa9a218['body']['id'];}return db[_0xe4af('0x26')][_0xe4af('0x27')]({'where':{'id':_0xa9a218[_0xe4af('0x28')]['id']}})[_0xe4af('0x29')](handleEntityNotFound(_0x5cebfe,null))[_0xe4af('0x29')](saveUpdates(_0xa9a218[_0xe4af('0x25')],null))[_0xe4af('0x29')](respondWithResult(_0x5cebfe,null))[_0xe4af('0x2a')](handleError(_0x5cebfe,null));};exports['destroy']=function(_0x527cc2,_0x2e0c11){return db[_0xe4af('0x26')]['find']({'where':{'id':_0x527cc2[_0xe4af('0x28')]['id']}})[_0xe4af('0x29')](handleEntityNotFound(_0x2e0c11,null))['then'](removeEntity(_0x2e0c11,null))[_0xe4af('0x2a')](handleError(_0x2e0c11,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f41c0ee..4eefd13 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 _0xbf98=['bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','api','moment'];(function(_0x58a614,_0xf99e7e){var _0x5b69ea=function(_0x12d40b){while(--_0x12d40b){_0x58a614['push'](_0x58a614['shift']());}};_0x5b69ea(++_0xf99e7e);}(_0xbf98,0xae));var _0x8bf9=function(_0x1aede4,_0x56b3e0){_0x1aede4=_0x1aede4-0x0;var _0xf9b07f=_0xbf98[_0x1aede4];return _0xf9b07f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8bf9('0x0'));var moment=require(_0x8bf9('0x1'));var BPromise=require(_0x8bf9('0x2'));var rp=require(_0x8bf9('0x3'));var fs=require('fs');var path=require(_0x8bf9('0x4'));var rimraf=require(_0x8bf9('0x5'));var config=require('../../config/environment');var attributes=require(_0x8bf9('0x6'));module[_0x8bf9('0x7')]=function(_0x347477,_0x1ec7a9){return _0x347477[_0x8bf9('0x8')](_0x8bf9('0x9'),attributes,{'tableName':_0x8bf9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30f8=['Condition','util','api','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x443a1e,_0x29a802){var _0x5753e0=function(_0x2c752a){while(--_0x2c752a){_0x443a1e['push'](_0x443a1e['shift']());}};_0x5753e0(++_0x29a802);}(_0x30f8,0x139));var _0x830f=function(_0x322af8,_0x161b9c){_0x322af8=_0x322af8-0x0;var _0xeb3c38=_0x30f8[_0x322af8];return _0xeb3c38;};'use strict';var _=require('lodash');var util=require(_0x830f('0x0'));var logger=require('../../config/logger')(_0x830f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x830f('0x2'));var rimraf=require(_0x830f('0x3'));var config=require(_0x830f('0x4'));var attributes=require(_0x830f('0x5'));module[_0x830f('0x6')]=function(_0x14c2ce,_0x2b09a2){return _0x14c2ce['define'](_0x830f('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index bb24ff4..4c87a46 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 _0x94f7=['info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x94f7,0x1ed));var _0x794f=function(_0x4ee158,_0x22d4fd){_0x4ee158=_0x4ee158-0x0;var _0x5c7a86=_0x94f7[_0x4ee158];return _0x5c7a86;};'use strict';var _=require(_0x794f('0x0'));var util=require('util');var moment=require(_0x794f('0x1'));var BPromise=require(_0x794f('0x2'));var rs=require(_0x794f('0x3'));var fs=require('fs');var Redis=require(_0x794f('0x4'));var db=require(_0x794f('0x5'))['db'];var utils=require(_0x794f('0x6'));var logger=require(_0x794f('0x7'))('rpc');var config=require(_0x794f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x794f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59fd64,_0x4d489a,_0x856314){return new BPromise(function(_0xcb44df,_0x416a49){return client['request'](_0x59fd64,_0x856314)[_0x794f('0xa')](function(_0xe3bcdf){logger[_0x794f('0xb')]('Condition,\x20%s,\x20%s',_0x4d489a,_0x794f('0xc'));logger[_0x794f('0xd')](_0x794f('0xe'),_0x4d489a,_0x794f('0xc'),JSON[_0x794f('0xf')](_0xe3bcdf));if(_0xe3bcdf['error']){if(_0xe3bcdf[_0x794f('0x10')][_0x794f('0x11')]===0x1f4){logger[_0x794f('0x10')](_0x794f('0x12'),_0x4d489a,_0xe3bcdf[_0x794f('0x10')]['message']);return _0x416a49(_0xe3bcdf[_0x794f('0x10')]['message']);}logger[_0x794f('0x10')]('Condition,\x20%s,\x20%s',_0x4d489a,_0xe3bcdf[_0x794f('0x10')][_0x794f('0x13')]);return _0xcb44df(_0xe3bcdf[_0x794f('0x10')][_0x794f('0x13')]);}else{logger[_0x794f('0xb')]('Condition,\x20%s,\x20%s',_0x4d489a,_0x794f('0xc'));_0xcb44df(_0xe3bcdf['result']['message']);}})[_0x794f('0x14')](function(_0xbf0616){logger[_0x794f('0x10')]('Condition,\x20%s,\x20%s',_0x4d489a,_0xbf0616);_0x416a49(_0xbf0616);});});} \ No newline at end of file +var _0x00cf=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x520c00,_0x486155){var _0x3eccd0=function(_0x342e2d){while(--_0x342e2d){_0x520c00['push'](_0x520c00['shift']());}};_0x3eccd0(++_0x486155);}(_0x00cf,0xfb));var _0xf00c=function(_0x269175,_0x14b8bb){_0x269175=_0x269175-0x0;var _0x44f717=_0x00cf[_0x269175];return _0x44f717;};'use strict';var _=require('lodash');var util=require(_0xf00c('0x0'));var moment=require(_0xf00c('0x1'));var BPromise=require(_0xf00c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf00c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf00c('0x4'));var logger=require(_0xf00c('0x5'))(_0xf00c('0x6'));var config=require(_0xf00c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf00c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12a107,_0xc379a9,_0x567e69){return new BPromise(function(_0x4e1b7a,_0x55aa10){return client[_0xf00c('0x9')](_0x12a107,_0x567e69)['then'](function(_0x4fdde5){logger[_0xf00c('0xa')](_0xf00c('0xb'),_0xc379a9,_0xf00c('0xc'));logger[_0xf00c('0xd')](_0xf00c('0xe'),_0xc379a9,_0xf00c('0xc'),JSON[_0xf00c('0xf')](_0x4fdde5));if(_0x4fdde5[_0xf00c('0x10')]){if(_0x4fdde5[_0xf00c('0x10')][_0xf00c('0x11')]===0x1f4){logger['error'](_0xf00c('0xb'),_0xc379a9,_0x4fdde5[_0xf00c('0x10')][_0xf00c('0x12')]);return _0x55aa10(_0x4fdde5[_0xf00c('0x10')]['message']);}logger[_0xf00c('0x10')](_0xf00c('0xb'),_0xc379a9,_0x4fdde5[_0xf00c('0x10')][_0xf00c('0x12')]);return _0x4e1b7a(_0x4fdde5[_0xf00c('0x10')]['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0xc379a9,_0xf00c('0xc'));_0x4e1b7a(_0x4fdde5[_0xf00c('0x13')][_0xf00c('0x12')]);}})[_0xf00c('0x14')](function(_0x262c18){logger[_0xf00c('0x10')](_0xf00c('0xb'),_0xc379a9,_0x262c18);_0x55aa10(_0x262c18);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cae44b2..6d735bd 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 _0xd586=['put','/:id','update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./condition.controller'];(function(_0x124d97,_0x12482b){var _0xfd66b5=function(_0x18e048){while(--_0x18e048){_0x124d97['push'](_0x124d97['shift']());}};_0xfd66b5(++_0x12482b);}(_0xd586,0xf4));var _0x6d58=function(_0x4cf7df,_0x5f4f4d){_0x4cf7df=_0x4cf7df-0x0;var _0x16eb51=_0xd586[_0x4cf7df];return _0x16eb51;};'use strict';var multer=require(_0x6d58('0x0'));var util=require(_0x6d58('0x1'));var path=require(_0x6d58('0x2'));var timeout=require(_0x6d58('0x3'));var express=require('express');var router=express[_0x6d58('0x4')]();var auth=require(_0x6d58('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6d58('0x6'));var controller=require(_0x6d58('0x7'));router[_0x6d58('0x8')](_0x6d58('0x9'),auth['isAuthenticated'](),controller[_0x6d58('0xa')]);router[_0x6d58('0xb')]('/:id',auth[_0x6d58('0xc')](),controller['destroy']);module[_0x6d58('0xd')]=router; \ No newline at end of file +var _0x461e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','update','delete','isAuthenticated','destroy','exports','multer','util','path'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x461e,0x18d));var _0xe461=function(_0x3f7fdf,_0x5e37d9){_0x3f7fdf=_0x3f7fdf-0x0;var _0x5a75dd=_0x461e[_0x3f7fdf];return _0x5a75dd;};'use strict';var multer=require(_0xe461('0x0'));var util=require(_0xe461('0x1'));var path=require(_0xe461('0x2'));var timeout=require(_0xe461('0x3'));var express=require(_0xe461('0x4'));var router=express[_0xe461('0x5')]();var auth=require(_0xe461('0x6'));var interaction=require(_0xe461('0x7'));var config=require(_0xe461('0x8'));var controller=require(_0xe461('0x9'));router[_0xe461('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe461('0xb')]);router[_0xe461('0xc')]('/:id',auth[_0xe461('0xd')](),controller[_0xe461('0xe')]);module[_0xe461('0xf')]=router; \ No newline at end of file diff --git a/server/api/crmActionsList/crmActionsList.attributes.js b/server/api/crmActionsList/crmActionsList.attributes.js index d97853c..26595e6 100644 --- a/server/api/crmActionsList/crmActionsList.attributes.js +++ b/server/api/crmActionsList/crmActionsList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69d9=['sequelize','exports','STRING','TEXT','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','INTEGER'];(function(_0x24c1a3,_0x32a97f){var _0x5d0594=function(_0x711c62){while(--_0x711c62){_0x24c1a3['push'](_0x24c1a3['shift']());}};_0x5d0594(++_0x32a97f);}(_0x69d9,0xe7));var _0x969d=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x69d9[_0x51ab83];return _0x14b6de;};'use strict';var Sequelize=require(_0x969d('0x0'));module[_0x969d('0x1')]={'name':{'type':Sequelize[_0x969d('0x2')],'allowNull':![],'unique':'name'},'note':{'type':Sequelize[_0x969d('0x3')](_0x969d('0x4'))+_0x969d('0x5')},'ordersequence':{'type':Sequelize[_0x969d('0x6')],'allowNull':!![]},'action':{'type':Sequelize[_0x969d('0x2')]},'parameters':{'type':Sequelize[_0x969d('0x2')]}}; \ No newline at end of file +var _0x1dd0=['TEXT','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','INTEGER','sequelize','exports','STRING'];(function(_0x4b040a,_0x31f24d){var _0x286a31=function(_0x588f47){while(--_0x588f47){_0x4b040a['push'](_0x4b040a['shift']());}};_0x286a31(++_0x31f24d);}(_0x1dd0,0x123));var _0x01dd=function(_0x6542f1,_0x37f42a){_0x6542f1=_0x6542f1-0x0;var _0x503e30=_0x1dd0[_0x6542f1];return _0x503e30;};'use strict';var Sequelize=require(_0x01dd('0x0'));module[_0x01dd('0x1')]={'name':{'type':Sequelize[_0x01dd('0x2')],'allowNull':![],'unique':'name'},'note':{'type':Sequelize[_0x01dd('0x3')]('long')+_0x01dd('0x4')},'ordersequence':{'type':Sequelize[_0x01dd('0x5')],'allowNull':!![]},'action':{'type':Sequelize[_0x01dd('0x2')]},'parameters':{'type':Sequelize[_0x01dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/crmActionsList/crmActionsList.controller.js b/server/api/crmActionsList/crmActionsList.controller.js index 899f5e8..01580fb 100644 --- a/server/api/crmActionsList/crmActionsList.controller.js +++ b/server/api/crmActionsList/crmActionsList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['end','error','stack','name','send','rawAttributes','model','query','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','keys','CrmActionsList','find','create','body','describe','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x264d57,_0x46ac34){var _0x21d3ad=function(_0x3c700f){while(--_0x3c700f){_0x264d57['push'](_0x264d57['shift']());}};_0x21d3ad(++_0x46ac34);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x4b84[_0x1030ce];return _0x3367fd;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var hardwareService=require(_0x44b8('0xd'));var logger=require(_0x44b8('0xe'))(_0x44b8('0xf'));var utils=require(_0x44b8('0x10'));var config=require(_0x44b8('0x11'));var db=require(_0x44b8('0x12'))['db'];function respondWithStatusCode(_0x4ae8a1,_0x147529){_0x147529=_0x147529||0xcc;return function(_0x4301a6){if(_0x4301a6){return _0x4ae8a1['sendStatus'](_0x147529);}return _0x4ae8a1[_0x44b8('0x13')](_0x147529)['end']();};}function respondWithResult(_0x833ea3,_0x18d642){_0x18d642=_0x18d642||0xc8;return function(_0x4df670){if(_0x4df670){return _0x833ea3[_0x44b8('0x13')](_0x18d642)['json'](_0x4df670);}};}function respondWithFilteredResult(_0x54fa95,_0x2a3e4c){return function(_0x2af0ad){if(_0x2af0ad){var _0x1722da=_0x2af0ad['count'],_0x41ab46=_0x2a3e4c[_0x44b8('0x14')],_0x5e52f2=_0x2a3e4c['offset']+_0x2a3e4c[_0x44b8('0x15')],_0x495c74;if(_0x5e52f2>=_0x1722da){_0x5e52f2=_0x1722da;_0x495c74=0xc8;}else{_0x495c74=0xce;}_0x54fa95[_0x44b8('0x13')](_0x495c74);return _0x54fa95['set'](_0x44b8('0x16'),_0x41ab46+'-'+_0x5e52f2+'/'+_0x1722da)[_0x44b8('0x17')](_0x2af0ad);}return null;};}function patchUpdates(_0x5103f5){return function(_0x89bc30){try{jsonpatch[_0x44b8('0x18')](_0x89bc30,_0x5103f5,!![]);}catch(_0x4b600f){return BPromise[_0x44b8('0x19')](_0x4b600f);}return _0x89bc30[_0x44b8('0x1a')]();};}function saveUpdates(_0xebfe79,_0x235bdc){return function(_0x102ef9){if(_0x102ef9){return _0x102ef9[_0x44b8('0x1b')](_0xebfe79)[_0x44b8('0x1c')](function(_0x9b0536){return _0x9b0536;});}return null;};}function removeEntity(_0x429461,_0x1e0f2d){return function(_0x1d642b){if(_0x1d642b){return _0x1d642b[_0x44b8('0x1d')]()['then'](function(){_0x429461[_0x44b8('0x13')](0xcc)[_0x44b8('0x1e')]();});}};}function handleEntityNotFound(_0x416b34,_0x1418db){return function(_0x305a5c){if(!_0x305a5c){_0x416b34['sendStatus'](0x194);}return _0x305a5c;};}function handleError(_0x402497,_0x54677c){_0x54677c=_0x54677c||0x1f4;return function(_0x41a922){logger[_0x44b8('0x1f')](_0x41a922[_0x44b8('0x20')]);if(_0x41a922[_0x44b8('0x21')]){delete _0x41a922[_0x44b8('0x21')];}_0x402497['status'](_0x54677c)[_0x44b8('0x22')](_0x41a922);};}exports['index']=function(_0x41d673,_0x350482){var _0x549a26={},_0x17ac44={},_0x470f49={'count':0x0,'rows':[]};var _0x2656d7=db['CrmActionsList'][_0x44b8('0x23')];_0x17ac44[_0x44b8('0x24')]=_['keys'](_0x2656d7);_0x17ac44[_0x44b8('0x25')]=_['keys'](_0x41d673[_0x44b8('0x25')]);_0x17ac44['filters']=_['intersection'](_0x17ac44['model'],_0x17ac44[_0x44b8('0x25')]);_0x549a26[_0x44b8('0x26')]=_[_0x44b8('0x27')](_0x17ac44[_0x44b8('0x24')],qs[_0x44b8('0x28')](_0x41d673[_0x44b8('0x25')][_0x44b8('0x28')]));_0x549a26[_0x44b8('0x26')]=_0x549a26[_0x44b8('0x26')][_0x44b8('0x29')]?_0x549a26[_0x44b8('0x26')]:_0x17ac44[_0x44b8('0x24')];if(!_0x41d673[_0x44b8('0x25')]['hasOwnProperty'](_0x44b8('0x2a'))){_0x549a26['limit']=qs[_0x44b8('0x15')](_0x41d673[_0x44b8('0x25')][_0x44b8('0x15')]);_0x549a26[_0x44b8('0x14')]=qs[_0x44b8('0x14')](_0x41d673['query'][_0x44b8('0x14')]);}_0x549a26[_0x44b8('0x2b')]=qs[_0x44b8('0x2c')](_0x41d673[_0x44b8('0x25')][_0x44b8('0x2c')]);_0x549a26['where']=qs[_0x44b8('0x2d')](_[_0x44b8('0x2e')](_0x41d673[_0x44b8('0x25')],_0x17ac44[_0x44b8('0x2d')]));if(_0x41d673[_0x44b8('0x25')][_0x44b8('0x2f')]){_0x549a26[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x549a26[_0x44b8('0x30')],{'$or':_[_0x44b8('0x32')](_0x2656d7,function(_0x13994c){if(_0x13994c[_0x44b8('0x33')][_0x44b8('0x34')]!==_0x44b8('0x35')){var _0x1e1a8a={};_0x1e1a8a[_0x13994c[_0x44b8('0x36')]]={'$like':'%'+_0x41d673[_0x44b8('0x25')][_0x44b8('0x2f')]+'%'};return _0x1e1a8a;}})});}_0x549a26=_[_0x44b8('0x31')]({},_0x549a26,_0x41d673[_0x44b8('0x37')]);var _0x2c02d6={'where':_0x549a26[_0x44b8('0x30')]};return db['CrmActionsList'][_0x44b8('0x38')](_0x2c02d6)[_0x44b8('0x1c')](function(_0x4fcfa0){_0x470f49[_0x44b8('0x38')]=_0x4fcfa0;if(_0x41d673[_0x44b8('0x25')][_0x44b8('0x39')]){_0x549a26[_0x44b8('0x3a')]=[{'all':!![]}];}return db['CrmActionsList'][_0x44b8('0x3b')](_0x549a26);})[_0x44b8('0x1c')](function(_0x3611b4){_0x470f49[_0x44b8('0x3c')]=_0x3611b4;return _0x470f49;})[_0x44b8('0x1c')](respondWithFilteredResult(_0x350482,_0x549a26))[_0x44b8('0x3d')](handleError(_0x350482,null));};exports[_0x44b8('0x3e')]=function(_0x3581b8,_0x209039){var _0x3d1be1={'raw':![],'where':{'id':_0x3581b8[_0x44b8('0x3f')]['id']}},_0x1c9983={};_0x1c9983[_0x44b8('0x24')]=_[_0x44b8('0x40')](db[_0x44b8('0x41')][_0x44b8('0x23')]);_0x1c9983['query']=_[_0x44b8('0x40')](_0x3581b8[_0x44b8('0x25')]);_0x1c9983[_0x44b8('0x2d')]=_['intersection'](_0x1c9983[_0x44b8('0x24')],_0x1c9983[_0x44b8('0x25')]);_0x3d1be1[_0x44b8('0x26')]=_['intersection'](_0x1c9983[_0x44b8('0x24')],qs[_0x44b8('0x28')](_0x3581b8[_0x44b8('0x25')][_0x44b8('0x28')]));_0x3d1be1[_0x44b8('0x26')]=_0x3d1be1['attributes']['length']?_0x3d1be1[_0x44b8('0x26')]:_0x1c9983[_0x44b8('0x24')];if(_0x3581b8[_0x44b8('0x25')][_0x44b8('0x39')]){_0x3d1be1[_0x44b8('0x3a')]=[{'all':!![]}];}_0x3d1be1=_[_0x44b8('0x31')]({},_0x3d1be1,_0x3581b8[_0x44b8('0x37')]);return db[_0x44b8('0x41')][_0x44b8('0x42')](_0x3d1be1)[_0x44b8('0x1c')](handleEntityNotFound(_0x209039,null))[_0x44b8('0x1c')](respondWithResult(_0x209039,null))[_0x44b8('0x3d')](handleError(_0x209039,null));};exports[_0x44b8('0x43')]=function(_0x1236c7,_0x149731){return db[_0x44b8('0x41')][_0x44b8('0x43')](_0x1236c7[_0x44b8('0x44')],{})[_0x44b8('0x1c')](respondWithResult(_0x149731,0xc9))['catch'](handleError(_0x149731,null));};exports['update']=function(_0x3b1b12,_0x1df74b){if(_0x3b1b12[_0x44b8('0x44')]['id']){delete _0x3b1b12[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x41')][_0x44b8('0x42')]({'where':{'id':_0x3b1b12[_0x44b8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1df74b,null))[_0x44b8('0x1c')](saveUpdates(_0x3b1b12['body'],null))[_0x44b8('0x1c')](respondWithResult(_0x1df74b,null))[_0x44b8('0x3d')](handleError(_0x1df74b,null));};exports[_0x44b8('0x1d')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x41')]['find']({'where':{'id':_0x9207bf[_0x44b8('0x3f')]['id']}})[_0x44b8('0x1c')](handleEntityNotFound(_0x103d57,null))[_0x44b8('0x1c')](removeEntity(_0x103d57,null))[_0x44b8('0x3d')](handleError(_0x103d57,null));};exports['describe']=function(_0x4e4ed1,_0x2f549d){return db[_0x44b8('0x41')][_0x44b8('0x45')]()[_0x44b8('0x1c')](respondWithResult(_0x2f549d,null))[_0x44b8('0x3d')](handleError(_0x2f549d,null));}; \ No newline at end of file +var _0x54ef=['../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','map','type','key','field','filter','options','CrmActionsList','count','includeAll','include','findAll','rows','catch','show','create','body','params','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x54ef,0x112));var _0xf54e=function(_0x527be5,_0x41b763){_0x527be5=_0x527be5-0x0;var _0x191cc6=_0x54ef[_0x527be5];return _0x191cc6;};'use strict';var pdf=require(_0xf54e('0x0'));var emlformat=require(_0xf54e('0x1'));var rimraf=require(_0xf54e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf54e('0x3'));var rp=require(_0xf54e('0x4'));var moment=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var Mustache=require(_0xf54e('0x7'));var util=require(_0xf54e('0x8'));var path=require(_0xf54e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf54e('0xa'));var fs=require('fs');var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var hardwareService=require(_0xf54e('0x13'));var logger=require('../../config/logger')(_0xf54e('0x14'));var utils=require(_0xf54e('0x15'));var config=require(_0xf54e('0x16'));var db=require(_0xf54e('0x17'))['db'];function respondWithStatusCode(_0x553759,_0x358c88){_0x358c88=_0x358c88||0xcc;return function(_0x4b0ee1){if(_0x4b0ee1){return _0x553759['sendStatus'](_0x358c88);}return _0x553759[_0xf54e('0x18')](_0x358c88)[_0xf54e('0x19')]();};}function respondWithResult(_0x28f776,_0x380f26){_0x380f26=_0x380f26||0xc8;return function(_0x5644aa){if(_0x5644aa){return _0x28f776[_0xf54e('0x18')](_0x380f26)[_0xf54e('0x1a')](_0x5644aa);}};}function respondWithFilteredResult(_0x1855fe,_0x15f639){return function(_0x56828e){if(_0x56828e){var _0x2366ee=_0x56828e['count'],_0x389abc=_0x15f639[_0xf54e('0x1b')],_0x3eb415=_0x15f639[_0xf54e('0x1b')]+_0x15f639[_0xf54e('0x1c')],_0x5c5d00;if(_0x3eb415>=_0x2366ee){_0x3eb415=_0x2366ee;_0x5c5d00=0xc8;}else{_0x5c5d00=0xce;}_0x1855fe[_0xf54e('0x18')](_0x5c5d00);return _0x1855fe[_0xf54e('0x1d')](_0xf54e('0x1e'),_0x389abc+'-'+_0x3eb415+'/'+_0x2366ee)[_0xf54e('0x1a')](_0x56828e);}return null;};}function patchUpdates(_0x1ef06e){return function(_0x1dcc04){try{jsonpatch[_0xf54e('0x1f')](_0x1dcc04,_0x1ef06e,!![]);}catch(_0x226c96){return BPromise['reject'](_0x226c96);}return _0x1dcc04['save']();};}function saveUpdates(_0x23e14,_0x59f338){return function(_0x3e1556){if(_0x3e1556){return _0x3e1556[_0xf54e('0x20')](_0x23e14)[_0xf54e('0x21')](function(_0x9903fc){return _0x9903fc;});}return null;};}function removeEntity(_0xf64f12,_0x3887b0){return function(_0x388aa0){if(_0x388aa0){return _0x388aa0[_0xf54e('0x22')]()[_0xf54e('0x21')](function(){_0xf64f12[_0xf54e('0x18')](0xcc)[_0xf54e('0x19')]();});}};}function handleEntityNotFound(_0x5b83df,_0x6f6d29){return function(_0x54f914){if(!_0x54f914){_0x5b83df[_0xf54e('0x23')](0x194);}return _0x54f914;};}function handleError(_0x272df6,_0x335492){_0x335492=_0x335492||0x1f4;return function(_0x474b61){logger[_0xf54e('0x24')](_0x474b61[_0xf54e('0x25')]);if(_0x474b61[_0xf54e('0x26')]){delete _0x474b61[_0xf54e('0x26')];}_0x272df6[_0xf54e('0x18')](_0x335492)[_0xf54e('0x27')](_0x474b61);};}exports[_0xf54e('0x28')]=function(_0x39c0ae,_0x2ea001){var _0x5390b8={},_0xb3706e={},_0x4cbf7c={'count':0x0,'rows':[]};var _0x282c63=db['CrmActionsList'][_0xf54e('0x29')];_0xb3706e[_0xf54e('0x2a')]=_[_0xf54e('0x2b')](_0x282c63);_0xb3706e[_0xf54e('0x2c')]=_[_0xf54e('0x2b')](_0x39c0ae[_0xf54e('0x2c')]);_0xb3706e[_0xf54e('0x2d')]=_['intersection'](_0xb3706e['model'],_0xb3706e[_0xf54e('0x2c')]);_0x5390b8[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0xb3706e[_0xf54e('0x2a')],qs[_0xf54e('0x30')](_0x39c0ae[_0xf54e('0x2c')][_0xf54e('0x30')]));_0x5390b8[_0xf54e('0x2e')]=_0x5390b8[_0xf54e('0x2e')][_0xf54e('0x31')]?_0x5390b8['attributes']:_0xb3706e['model'];if(!_0x39c0ae[_0xf54e('0x2c')][_0xf54e('0x32')]('nolimit')){_0x5390b8[_0xf54e('0x1c')]=qs[_0xf54e('0x1c')](_0x39c0ae[_0xf54e('0x2c')][_0xf54e('0x1c')]);_0x5390b8['offset']=qs['offset'](_0x39c0ae['query'][_0xf54e('0x1b')]);}_0x5390b8[_0xf54e('0x33')]=qs[_0xf54e('0x34')](_0x39c0ae[_0xf54e('0x2c')][_0xf54e('0x34')]);_0x5390b8[_0xf54e('0x35')]=qs['filters'](_['pick'](_0x39c0ae['query'],_0xb3706e[_0xf54e('0x2d')]));if(_0x39c0ae[_0xf54e('0x2c')]['filter']){_0x5390b8['where']=_[_0xf54e('0x36')](_0x5390b8[_0xf54e('0x35')],{'$or':_[_0xf54e('0x37')](_0x282c63,function(_0x4a347a){if(_0x4a347a[_0xf54e('0x38')][_0xf54e('0x39')]!=='VIRTUAL'){var _0x38d7a0={};_0x38d7a0[_0x4a347a[_0xf54e('0x3a')]]={'$like':'%'+_0x39c0ae[_0xf54e('0x2c')][_0xf54e('0x3b')]+'%'};return _0x38d7a0;}})});}_0x5390b8=_[_0xf54e('0x36')]({},_0x5390b8,_0x39c0ae[_0xf54e('0x3c')]);var _0x4e00b7={'where':_0x5390b8['where']};return db[_0xf54e('0x3d')][_0xf54e('0x3e')](_0x4e00b7)[_0xf54e('0x21')](function(_0x4b1f84){_0x4cbf7c[_0xf54e('0x3e')]=_0x4b1f84;if(_0x39c0ae[_0xf54e('0x2c')][_0xf54e('0x3f')]){_0x5390b8[_0xf54e('0x40')]=[{'all':!![]}];}return db[_0xf54e('0x3d')][_0xf54e('0x41')](_0x5390b8);})[_0xf54e('0x21')](function(_0x1345b0){_0x4cbf7c[_0xf54e('0x42')]=_0x1345b0;return _0x4cbf7c;})[_0xf54e('0x21')](respondWithFilteredResult(_0x2ea001,_0x5390b8))[_0xf54e('0x43')](handleError(_0x2ea001,null));};exports[_0xf54e('0x44')]=function(_0x3dfd4e,_0x2625fd){var _0x2043a8={'raw':![],'where':{'id':_0x3dfd4e['params']['id']}},_0x5085c1={};_0x5085c1['model']=_[_0xf54e('0x2b')](db[_0xf54e('0x3d')]['rawAttributes']);_0x5085c1[_0xf54e('0x2c')]=_[_0xf54e('0x2b')](_0x3dfd4e[_0xf54e('0x2c')]);_0x5085c1['filters']=_[_0xf54e('0x2f')](_0x5085c1[_0xf54e('0x2a')],_0x5085c1[_0xf54e('0x2c')]);_0x2043a8[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x5085c1[_0xf54e('0x2a')],qs[_0xf54e('0x30')](_0x3dfd4e[_0xf54e('0x2c')][_0xf54e('0x30')]));_0x2043a8['attributes']=_0x2043a8[_0xf54e('0x2e')][_0xf54e('0x31')]?_0x2043a8[_0xf54e('0x2e')]:_0x5085c1[_0xf54e('0x2a')];if(_0x3dfd4e[_0xf54e('0x2c')][_0xf54e('0x3f')]){_0x2043a8['include']=[{'all':!![]}];}_0x2043a8=_[_0xf54e('0x36')]({},_0x2043a8,_0x3dfd4e['options']);return db[_0xf54e('0x3d')]['find'](_0x2043a8)[_0xf54e('0x21')](handleEntityNotFound(_0x2625fd,null))[_0xf54e('0x21')](respondWithResult(_0x2625fd,null))[_0xf54e('0x43')](handleError(_0x2625fd,null));};exports['create']=function(_0x1af35d,_0x40b21c){return db[_0xf54e('0x3d')][_0xf54e('0x45')](_0x1af35d[_0xf54e('0x46')],{})['then'](respondWithResult(_0x40b21c,0xc9))[_0xf54e('0x43')](handleError(_0x40b21c,null));};exports[_0xf54e('0x20')]=function(_0x346bb4,_0x45592b){if(_0x346bb4['body']['id']){delete _0x346bb4[_0xf54e('0x46')]['id'];}return db[_0xf54e('0x3d')]['find']({'where':{'id':_0x346bb4[_0xf54e('0x47')]['id']}})[_0xf54e('0x21')](handleEntityNotFound(_0x45592b,null))[_0xf54e('0x21')](saveUpdates(_0x346bb4[_0xf54e('0x46')],null))['then'](respondWithResult(_0x45592b,null))[_0xf54e('0x43')](handleError(_0x45592b,null));};exports[_0xf54e('0x22')]=function(_0x2527f6,_0xb4654f){return db[_0xf54e('0x3d')][_0xf54e('0x48')]({'where':{'id':_0x2527f6[_0xf54e('0x47')]['id']}})[_0xf54e('0x21')](handleEntityNotFound(_0xb4654f,null))[_0xf54e('0x21')](removeEntity(_0xb4654f,null))[_0xf54e('0x43')](handleError(_0xb4654f,null));};exports[_0xf54e('0x49')]=function(_0x1f4cf8,_0x2deb0c){return db[_0xf54e('0x3d')][_0xf54e('0x49')]()[_0xf54e('0x21')](respondWithResult(_0x2deb0c,null))[_0xf54e('0x43')](handleError(_0x2deb0c,null));}; \ No newline at end of file diff --git a/server/api/crmActionsList/crmActionsList.model.js b/server/api/crmActionsList/crmActionsList.model.js index aac5f09..2c2427c 100644 --- a/server/api/crmActionsList/crmActionsList.model.js +++ b/server/api/crmActionsList/crmActionsList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbb0=['./crmActionsList.attributes','exports','CrmActionsList','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x416fcd,_0x3da674){var _0x545265=function(_0x1562d5){while(--_0x1562d5){_0x416fcd['push'](_0x416fcd['shift']());}};_0x545265(++_0x3da674);}(_0xfbb0,0x162));var _0x0fbb=function(_0xfb4095,_0x3c296e){_0xfb4095=_0xfb4095-0x0;var _0x56c8fc=_0xfbb0[_0xfb4095];return _0x56c8fc;};'use strict';var _=require(_0x0fbb('0x0'));var util=require('util');var logger=require(_0x0fbb('0x1'))(_0x0fbb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fbb('0x3'));var rimraf=require(_0x0fbb('0x4'));var config=require(_0x0fbb('0x5'));var attributes=require(_0x0fbb('0x6'));module[_0x0fbb('0x7')]=function(_0x4a7292,_0x193a86){return _0x4a7292['define'](_0x0fbb('0x8'),attributes,{'tableName':'crm_actions_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab20=['exports','define','crm_actions_lists','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x28fdee,_0x3e8c43){var _0x36b9b1=function(_0xce67e4){while(--_0xce67e4){_0x28fdee['push'](_0x28fdee['shift']());}};_0x36b9b1(++_0x3e8c43);}(_0xab20,0x150));var _0x0ab2=function(_0x577a8f,_0x1d0c82){_0x577a8f=_0x577a8f-0x0;var _0x27db0c=_0xab20[_0x577a8f];return _0x27db0c;};'use strict';var _=require('lodash');var util=require(_0x0ab2('0x0'));var logger=require('../../config/logger')(_0x0ab2('0x1'));var moment=require(_0x0ab2('0x2'));var BPromise=require(_0x0ab2('0x3'));var rp=require(_0x0ab2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ab2('0x5'));var config=require('../../config/environment');var attributes=require('./crmActionsList.attributes');module[_0x0ab2('0x6')]=function(_0x5134dd,_0x51735a){return _0x5134dd[_0x0ab2('0x7')]('CrmActionsList',attributes,{'tableName':_0x0ab2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/crmActionsList/crmActionsList.rpc.js b/server/api/crmActionsList/crmActionsList.rpc.js index ab11e71..0de617a 100644 --- a/server/api/crmActionsList/crmActionsList.rpc.js +++ b/server/api/crmActionsList/crmActionsList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x584f=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','CrmActionsList,\x20%s,\x20%s','request\x20sent','CrmActionsList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x5e7176,_0x460668){var _0x3064ff=function(_0x525aea){while(--_0x525aea){_0x5e7176['push'](_0x5e7176['shift']());}};_0x3064ff(++_0x460668);}(_0x584f,0xd2));var _0xf584=function(_0x381ec0,_0x374714){_0x381ec0=_0x381ec0-0x0;var _0x25604c=_0x584f[_0x381ec0];return _0x25604c;};'use strict';var _=require(_0xf584('0x0'));var util=require(_0xf584('0x1'));var moment=require(_0xf584('0x2'));var BPromise=require(_0xf584('0x3'));var rs=require(_0xf584('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf584('0x5'))['db'];var utils=require(_0xf584('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf584('0x7'));var jayson=require(_0xf584('0x8'));var client=jayson[_0xf584('0x9')][_0xf584('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b4a16,_0x209111,_0x400444){return new BPromise(function(_0x1a6495,_0x3cff83){return client['request'](_0x5b4a16,_0x400444)[_0xf584('0xb')](function(_0x39fcf2){logger[_0xf584('0xc')](_0xf584('0xd'),_0x209111,_0xf584('0xe'));logger['debug'](_0xf584('0xf'),_0x209111,'request\x20sent',JSON[_0xf584('0x10')](_0x39fcf2));if(_0x39fcf2[_0xf584('0x11')]){if(_0x39fcf2[_0xf584('0x11')]['code']===0x1f4){logger[_0xf584('0x11')](_0xf584('0xd'),_0x209111,_0x39fcf2['error'][_0xf584('0x12')]);return _0x3cff83(_0x39fcf2[_0xf584('0x11')]['message']);}logger[_0xf584('0x11')]('CrmActionsList,\x20%s,\x20%s',_0x209111,_0x39fcf2[_0xf584('0x11')][_0xf584('0x12')]);return _0x1a6495(_0x39fcf2['error'][_0xf584('0x12')]);}else{logger[_0xf584('0xc')](_0xf584('0xd'),_0x209111,_0xf584('0xe'));_0x1a6495(_0x39fcf2[_0xf584('0x13')][_0xf584('0x12')]);}})[_0xf584('0x14')](function(_0x530a05){logger[_0xf584('0x11')](_0xf584('0xd'),_0x209111,_0x530a05);_0x3cff83(_0x530a05);});});} \ No newline at end of file +var _0x8e54=['stringify','error','code','CrmActionsList,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent'];(function(_0xeb6468,_0x4d14dc){var _0x2ad0fe=function(_0x731422){while(--_0x731422){_0xeb6468['push'](_0xeb6468['shift']());}};_0x2ad0fe(++_0x4d14dc);}(_0x8e54,0x110));var _0x48e5=function(_0x18646b,_0x54eced){_0x18646b=_0x18646b-0x0;var _0x595eaa=_0x8e54[_0x18646b];return _0x595eaa;};'use strict';var _=require('lodash');var util=require(_0x48e5('0x0'));var moment=require(_0x48e5('0x1'));var BPromise=require('bluebird');var rs=require(_0x48e5('0x2'));var fs=require('fs');var Redis=require(_0x48e5('0x3'));var db=require(_0x48e5('0x4'))['db'];var utils=require(_0x48e5('0x5'));var logger=require(_0x48e5('0x6'))('rpc');var config=require(_0x48e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x48e5('0x8')][_0x48e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49ad0c,_0x5be489,_0x25f673){return new BPromise(function(_0x5a9cf7,_0x5372a3){return client[_0x48e5('0xa')](_0x49ad0c,_0x25f673)['then'](function(_0x27bfa0){logger[_0x48e5('0xb')]('CrmActionsList,\x20%s,\x20%s',_0x5be489,_0x48e5('0xc'));logger['debug']('CrmActionsList,\x20%s,\x20%s,\x20%s',_0x5be489,_0x48e5('0xc'),JSON[_0x48e5('0xd')](_0x27bfa0));if(_0x27bfa0[_0x48e5('0xe')]){if(_0x27bfa0[_0x48e5('0xe')][_0x48e5('0xf')]===0x1f4){logger['error'](_0x48e5('0x10'),_0x5be489,_0x27bfa0['error'][_0x48e5('0x11')]);return _0x5372a3(_0x27bfa0[_0x48e5('0xe')][_0x48e5('0x11')]);}logger[_0x48e5('0xe')](_0x48e5('0x10'),_0x5be489,_0x27bfa0['error']['message']);return _0x5a9cf7(_0x27bfa0[_0x48e5('0xe')][_0x48e5('0x11')]);}else{logger[_0x48e5('0xb')](_0x48e5('0x10'),_0x5be489,'request\x20sent');_0x5a9cf7(_0x27bfa0[_0x48e5('0x12')][_0x48e5('0x11')]);}})['catch'](function(_0x44c2be){logger[_0x48e5('0xe')](_0x48e5('0x10'),_0x5be489,_0x44c2be);_0x5372a3(_0x44c2be);});});} \ No newline at end of file diff --git a/server/api/crmActionsList/index.js b/server/api/crmActionsList/index.js index 36af089..b037b5b 100644 --- a/server/api/crmActionsList/index.js +++ b/server/api/crmActionsList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc02a=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./crmActionsList.controller','get','isAuthenticated','/describe','show','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc02a,0x1a4));var _0xac02=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xc02a[_0x1c06f4];return _0x1a727e;};'use strict';var multer=require('multer');var util=require(_0xac02('0x0'));var path=require(_0xac02('0x1'));var timeout=require(_0xac02('0x2'));var express=require('express');var router=express[_0xac02('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xac02('0x4'));var config=require(_0xac02('0x5'));var controller=require(_0xac02('0x6'));router[_0xac02('0x7')]('/',auth[_0xac02('0x8')](),controller['index']);router[_0xac02('0x7')](_0xac02('0x9'),auth[_0xac02('0x8')](),controller['describe']);router[_0xac02('0x7')]('/:id',auth[_0xac02('0x8')](),controller[_0xac02('0xa')]);router['post']('/',auth[_0xac02('0x8')](),controller['create']);router['put']('/:id',auth[_0xac02('0x8')](),controller[_0xac02('0xb')]);router['delete']('/:id',auth[_0xac02('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb6dc=['put','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','create'];(function(_0x16bdf3,_0x3551c3){var _0x4d1a1f=function(_0x5a1182){while(--_0x5a1182){_0x16bdf3['push'](_0x16bdf3['shift']());}};_0x4d1a1f(++_0x3551c3);}(_0xb6dc,0xbe));var _0xcb6d=function(_0xf2b8fd,_0x307507){_0xf2b8fd=_0xf2b8fd-0x0;var _0x2831d5=_0xb6dc[_0xf2b8fd];return _0x2831d5;};'use strict';var multer=require('multer');var util=require(_0xcb6d('0x0'));var path=require(_0xcb6d('0x1'));var timeout=require(_0xcb6d('0x2'));var express=require('express');var router=express[_0xcb6d('0x3')]();var auth=require(_0xcb6d('0x4'));var interaction=require(_0xcb6d('0x5'));var config=require(_0xcb6d('0x6'));var controller=require('./crmActionsList.controller');router['get']('/',auth[_0xcb6d('0x7')](),controller[_0xcb6d('0x8')]);router[_0xcb6d('0x9')](_0xcb6d('0xa'),auth[_0xcb6d('0x7')](),controller[_0xcb6d('0xb')]);router[_0xcb6d('0x9')](_0xcb6d('0xc'),auth[_0xcb6d('0x7')](),controller['show']);router['post']('/',auth[_0xcb6d('0x7')](),controller[_0xcb6d('0xd')]);router[_0xcb6d('0xe')](_0xcb6d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcb6d('0xf')](_0xcb6d('0xc'),auth['isAuthenticated'](),controller[_0xcb6d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/crmMyCompanies/crmMyCompanies.attributes.js b/server/api/crmMyCompanies/crmMyCompanies.attributes.js index 6febec9..f4195eb 100644 --- a/server/api/crmMyCompanies/crmMyCompanies.attributes.js +++ b/server/api/crmMyCompanies/crmMyCompanies.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd98=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0x51a3a9,_0x282180){var _0x5d1cfd=function(_0x292a6){while(--_0x292a6){_0x51a3a9['push'](_0x51a3a9['shift']());}};_0x5d1cfd(++_0x282180);}(_0xcd98,0x138));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8cd9('0x0'));module[_0x8cd9('0x1')]={'saName':{'type':Sequelize['STRING'],'unique':_0x8cd9('0x2'),'allowNull':![]},'saWebsite':{'type':Sequelize[_0x8cd9('0x3')]},'saPhone':{'type':Sequelize[_0x8cd9('0x3')]},'saFax':{'type':Sequelize[_0x8cd9('0x3')]},'saEmail':{'type':Sequelize[_0x8cd9('0x3')],'validate':{'isEmail':!![]}},'saStreet':{'type':Sequelize[_0x8cd9('0x3')]},'saPostalCode':{'type':Sequelize[_0x8cd9('0x3')]},'saCity':{'type':Sequelize[_0x8cd9('0x3')]},'saCountry':{'type':Sequelize['STRING']},'saISOCode':{'type':Sequelize[_0x8cd9('0x3')](0x3)},'saFiscalCode':{'type':Sequelize[_0x8cd9('0x3')](0x10)},'saPIVA':{'type':Sequelize[_0x8cd9('0x3')](0xb)},'saSDICode':{'type':Sequelize[_0x8cd9('0x3')](0x6)},'saFiscalMessage':{'type':Sequelize[_0x8cd9('0x3')]},'saEurope':{'type':Sequelize[_0x8cd9('0x4')]}}; \ No newline at end of file +var _0xb803=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb803,0x163));var _0x3b80=function(_0x1599dd,_0x4dcd06){_0x1599dd=_0x1599dd-0x0;var _0xb42fe7=_0xb803[_0x1599dd];return _0xb42fe7;};'use strict';var Sequelize=require(_0x3b80('0x0'));module[_0x3b80('0x1')]={'saName':{'type':Sequelize[_0x3b80('0x2')],'unique':_0x3b80('0x3'),'allowNull':![]},'saWebsite':{'type':Sequelize[_0x3b80('0x2')]},'saPhone':{'type':Sequelize[_0x3b80('0x2')]},'saFax':{'type':Sequelize[_0x3b80('0x2')]},'saEmail':{'type':Sequelize[_0x3b80('0x2')],'validate':{'isEmail':!![]}},'saStreet':{'type':Sequelize['STRING']},'saPostalCode':{'type':Sequelize['STRING']},'saCity':{'type':Sequelize[_0x3b80('0x2')]},'saCountry':{'type':Sequelize['STRING']},'saISOCode':{'type':Sequelize[_0x3b80('0x2')](0x3)},'saFiscalCode':{'type':Sequelize['STRING'](0x10)},'saPIVA':{'type':Sequelize[_0x3b80('0x2')](0xb)},'saSDICode':{'type':Sequelize['STRING'](0x6)},'saFiscalMessage':{'type':Sequelize[_0x3b80('0x2')]},'saEurope':{'type':Sequelize[_0x3b80('0x4')]}}; \ No newline at end of file diff --git a/server/api/crmMyCompanies/crmMyCompanies.controller.js b/server/api/crmMyCompanies/crmMyCompanies.controller.js index 33e87f4..da1367a 100644 --- a/server/api/crmMyCompanies/crmMyCompanies.controller.js +++ b/server/api/crmMyCompanies/crmMyCompanies.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f59=['create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','send','crmMyCompany','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','add','day','where','filter','merge','map','options','include','findAll','catch','show','includeAll','find'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x8f59,0x11d));var _0x98f5=function(_0x2dd843,_0x2cb2be){_0x2dd843=_0x2dd843-0x0;var _0x3148b7=_0x8f59[_0x2dd843];return _0x3148b7;};'use strict';var pdf=require(_0x98f5('0x0'));var emlformat=require(_0x98f5('0x1'));var rimraf=require(_0x98f5('0x2'));var zipdir=require(_0x98f5('0x3'));var jsonpatch=require(_0x98f5('0x4'));var rp=require(_0x98f5('0x5'));var moment=require('moment');var BPromise=require(_0x98f5('0x6'));var Mustache=require(_0x98f5('0x7'));var util=require(_0x98f5('0x8'));var path=require(_0x98f5('0x9'));var sox=require('sox');var csv=require(_0x98f5('0xa'));var ejs=require(_0x98f5('0xb'));var fs=require('fs');var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xa'));var querystring=require('querystring');var Papa=require(_0x98f5('0xf'));var qs=require(_0x98f5('0x10'));var logger=require(_0x98f5('0x11'))(_0x98f5('0x12'));var utils=require('../../config/utils');var config=require(_0x98f5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d83f6,_0x3cf4b2){_0x3cf4b2=_0x3cf4b2||0xcc;return function(_0x34f59a){if(_0x34f59a){return _0x5d83f6['sendStatus'](_0x3cf4b2);}return _0x5d83f6[_0x98f5('0x14')](_0x3cf4b2)[_0x98f5('0x15')]();};}function respondWithResult(_0x1f00e8,_0x160626){_0x160626=_0x160626||0xc8;return function(_0x3286f7){if(_0x3286f7){return _0x1f00e8[_0x98f5('0x14')](_0x160626)['json'](_0x3286f7);}};}function respondWithFilteredResult(_0x24a7a9,_0xbade31){return function(_0x5b8bab){if(_0x5b8bab){var _0x9df84=_0x5b8bab[_0x98f5('0x16')],_0x3d6b5c=_0xbade31[_0x98f5('0x17')],_0xaa951a=_0xbade31[_0x98f5('0x17')]+_0xbade31['limit'],_0x4ae70d;if(_0xaa951a>=_0x9df84){_0xaa951a=_0x9df84;_0x4ae70d=0xc8;}else{_0x4ae70d=0xce;}_0x24a7a9[_0x98f5('0x14')](_0x4ae70d);return _0x24a7a9[_0x98f5('0x18')]('Content-Range',_0x3d6b5c+'-'+_0xaa951a+'/'+_0x9df84)[_0x98f5('0x19')](_0x5b8bab);}return null;};}function patchUpdates(_0x51a567){return function(_0x10c57c){try{jsonpatch[_0x98f5('0x1a')](_0x10c57c,_0x51a567,!![]);}catch(_0x2291d5){return BPromise[_0x98f5('0x1b')](_0x2291d5);}return _0x10c57c[_0x98f5('0x1c')]();};}function saveUpdates(_0xa4477c,_0x484e1d){return function(_0xf88f34){if(_0xf88f34){return _0xf88f34['update'](_0xa4477c)[_0x98f5('0x1d')](function(_0x191f23){return _0x191f23;});}return null;};}function removeEntity(_0x5deca0,_0x146db1){return function(_0x2933d1){if(_0x2933d1){return _0x2933d1[_0x98f5('0x1e')]()[_0x98f5('0x1d')](function(){_0x5deca0[_0x98f5('0x14')](0xcc)[_0x98f5('0x15')]();});}};}function handleEntityNotFound(_0x38b46d,_0x5ac2b7){return function(_0xb687c7){if(!_0xb687c7){_0x38b46d['sendStatus'](0x194);}return _0xb687c7;};}function handleError(_0xcb10d6,_0x495889){_0x495889=_0x495889||0x1f4;return function(_0x44bfbb){logger[_0x98f5('0x1f')](_0x44bfbb[_0x98f5('0x20')]);if(_0x44bfbb[_0x98f5('0x21')]){delete _0x44bfbb[_0x98f5('0x21')];}_0xcb10d6[_0x98f5('0x14')](_0x495889)[_0x98f5('0x22')](_0x44bfbb);};}exports['index']=function(_0x27a533,_0x2b80a1){var _0x5d7423={},_0x1a1c55={},_0x18b0af={'count':0x0,'rows':[]};var _0x5b08c2=db[_0x98f5('0x23')][_0x98f5('0x24')];_0x1a1c55[_0x98f5('0x25')]=_[_0x98f5('0x26')](_0x5b08c2);var _0x2b6993={'dateStart':_0x27a533['query']['dateStart'],'dateEnd':_0x27a533[_0x98f5('0x27')][_0x98f5('0x28')]};delete _0x27a533[_0x98f5('0x27')][_0x98f5('0x29')];delete _0x27a533[_0x98f5('0x27')][_0x98f5('0x28')];_0x1a1c55['query']=_[_0x98f5('0x26')](_0x27a533[_0x98f5('0x27')]);_0x1a1c55[_0x98f5('0x2a')]=_[_0x98f5('0x2b')](_0x1a1c55[_0x98f5('0x25')],_0x1a1c55[_0x98f5('0x27')]);_0x5d7423['attributes']=_[_0x98f5('0x2b')](_0x1a1c55[_0x98f5('0x25')],qs[_0x98f5('0x2c')](_0x27a533[_0x98f5('0x27')]['fields']));_0x5d7423[_0x98f5('0x2d')]=_0x5d7423[_0x98f5('0x2d')][_0x98f5('0x2e')]?_0x5d7423[_0x98f5('0x2d')]:_0x1a1c55[_0x98f5('0x25')];if(!_0x27a533[_0x98f5('0x27')][_0x98f5('0x2f')](_0x98f5('0x30'))){_0x5d7423[_0x98f5('0x31')]=qs[_0x98f5('0x31')](_0x27a533[_0x98f5('0x27')][_0x98f5('0x31')]);_0x5d7423[_0x98f5('0x17')]=qs[_0x98f5('0x17')](_0x27a533[_0x98f5('0x27')][_0x98f5('0x17')]);}_0x5d7423[_0x98f5('0x32')]=qs[_0x98f5('0x33')](_0x27a533[_0x98f5('0x27')][_0x98f5('0x33')]);_0x5d7423['where']=qs[_0x98f5('0x2a')](_['pick'](_0x27a533['query'],_0x1a1c55[_0x98f5('0x2a')]));if(_0x2b6993[_0x98f5('0x29')]){if(_0x2b6993[_0x98f5('0x28')]){_0x2b6993[_0x98f5('0x28')]=moment(_0x2b6993['dateEnd'])[_0x98f5('0x34')](0x1,_0x98f5('0x35'));}else{_0x2b6993[_0x98f5('0x28')]=moment(_0x2b6993['dateStart'])[_0x98f5('0x34')](0x1,_0x98f5('0x35'));}_['merge'](_0x5d7423[_0x98f5('0x36')],{'createdAt':{'$gte':_0x2b6993[_0x98f5('0x29')],'$lte':_0x2b6993[_0x98f5('0x28')]}});}if(_0x27a533['query'][_0x98f5('0x37')]){_0x5d7423[_0x98f5('0x36')]=_[_0x98f5('0x38')](_0x5d7423[_0x98f5('0x36')],{'$or':_[_0x98f5('0x39')](_0x5d7423['attributes'],function(_0x5476e8){var _0x46cb30={};_0x46cb30[_0x5476e8]={'$like':'%'+_0x27a533[_0x98f5('0x27')][_0x98f5('0x37')]+'%'};return _0x46cb30;})});}_0x5d7423=_[_0x98f5('0x38')]({},_0x5d7423,_0x27a533[_0x98f5('0x3a')]);var _0x16ef53={'where':_0x5d7423['where']};return db['crmMyCompany'][_0x98f5('0x16')](_0x16ef53)[_0x98f5('0x1d')](function(_0xd74ff3){_0x18b0af[_0x98f5('0x16')]=_0xd74ff3;if(_0x27a533['query']['includeAll']){_0x5d7423[_0x98f5('0x3b')]=[{'all':!![]}];}return db[_0x98f5('0x23')][_0x98f5('0x3c')](_0x5d7423);})[_0x98f5('0x1d')](function(_0x570fcd){_0x18b0af['rows']=_0x570fcd;return _0x18b0af;})[_0x98f5('0x1d')](respondWithFilteredResult(_0x2b80a1,_0x5d7423))[_0x98f5('0x3d')](handleError(_0x2b80a1,null));};exports[_0x98f5('0x3e')]=function(_0x4a9b53,_0x26020d){var _0x54abb5={'raw':![],'where':{'id':_0x4a9b53['params']['id']}},_0xd1bea4={};_0xd1bea4[_0x98f5('0x25')]=_[_0x98f5('0x26')](db[_0x98f5('0x23')]['rawAttributes']);_0xd1bea4[_0x98f5('0x27')]=_[_0x98f5('0x26')](_0x4a9b53['query']);_0xd1bea4[_0x98f5('0x2a')]=_[_0x98f5('0x2b')](_0xd1bea4['model'],_0xd1bea4[_0x98f5('0x27')]);_0x54abb5['attributes']=_[_0x98f5('0x2b')](_0xd1bea4[_0x98f5('0x25')],qs['fields'](_0x4a9b53['query']['fields']));_0x54abb5['attributes']=_0x54abb5[_0x98f5('0x2d')]['length']?_0x54abb5[_0x98f5('0x2d')]:_0xd1bea4[_0x98f5('0x25')];if(_0x4a9b53[_0x98f5('0x27')][_0x98f5('0x3f')]){_0x54abb5[_0x98f5('0x3b')]=[{'all':!![]}];}_0x54abb5=_[_0x98f5('0x38')]({},_0x54abb5,_0x4a9b53['options']);return db[_0x98f5('0x23')][_0x98f5('0x40')](_0x54abb5)[_0x98f5('0x1d')](handleEntityNotFound(_0x26020d,null))[_0x98f5('0x1d')](respondWithResult(_0x26020d,null))[_0x98f5('0x3d')](handleError(_0x26020d,null));};exports[_0x98f5('0x41')]=function(_0x48c8ab,_0x3a4cc5){return db[_0x98f5('0x23')][_0x98f5('0x41')](_0x48c8ab[_0x98f5('0x42')],{})['then'](respondWithResult(_0x3a4cc5,0xc9))[_0x98f5('0x3d')](handleError(_0x3a4cc5,null));};exports[_0x98f5('0x43')]=function(_0x151617,_0x331ab0){if(_0x151617[_0x98f5('0x42')]['id']){delete _0x151617['body']['id'];}return db[_0x98f5('0x23')][_0x98f5('0x40')]({'where':{'id':_0x151617['params']['id']}})[_0x98f5('0x1d')](handleEntityNotFound(_0x331ab0,null))['then'](saveUpdates(_0x151617[_0x98f5('0x42')],null))['then'](respondWithResult(_0x331ab0,null))[_0x98f5('0x3d')](handleError(_0x331ab0,null));};exports[_0x98f5('0x1e')]=function(_0x3114a4,_0x5b495e){return db[_0x98f5('0x23')][_0x98f5('0x40')]({'where':{'id':_0x3114a4[_0x98f5('0x44')]['id']}})[_0x98f5('0x1d')](handleEntityNotFound(_0x5b495e,null))[_0x98f5('0x1d')](removeEntity(_0x5b495e,null))[_0x98f5('0x3d')](handleError(_0x5b495e,null));};exports[_0x98f5('0x45')]=function(_0x1891ac,_0x2c3a23){return db[_0x98f5('0x23')][_0x98f5('0x45')]()[_0x98f5('0x1d')](respondWithResult(_0x2c3a23,null))[_0x98f5('0x3d')](handleError(_0x2c3a23,null));}; \ No newline at end of file +var _0x896e=['mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','send','index','crmMyCompany','rawAttributes','keys','query','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','dateEnd','add','merge','map','filter','count','includeAll','include','findAll','rows','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5afaa5,_0x286dc9){var _0x19e4fb=function(_0xd87cfa){while(--_0xd87cfa){_0x5afaa5['push'](_0x5afaa5['shift']());}};_0x19e4fb(++_0x286dc9);}(_0x896e,0x1e9));var _0xe896=function(_0x416926,_0x2691fa){_0x416926=_0x416926-0x0;var _0x132221=_0x896e[_0x416926];return _0x132221;};'use strict';var pdf=require(_0xe896('0x0'));var emlformat=require(_0xe896('0x1'));var rimraf=require(_0xe896('0x2'));var zipdir=require(_0xe896('0x3'));var jsonpatch=require(_0xe896('0x4'));var rp=require(_0xe896('0x5'));var moment=require(_0xe896('0x6'));var BPromise=require(_0xe896('0x7'));var Mustache=require(_0xe896('0x8'));var util=require(_0xe896('0x9'));var path=require(_0xe896('0xa'));var sox=require(_0xe896('0xb'));var csv=require('to-csv');var ejs=require(_0xe896('0xc'));var fs=require('fs');var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0x11'));var querystring=require(_0xe896('0x12'));var Papa=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xe896('0x14'))('api');var utils=require(_0xe896('0x15'));var config=require('../../config/environment');var db=require(_0xe896('0x16'))['db'];function respondWithStatusCode(_0x146b12,_0xa00ae9){_0xa00ae9=_0xa00ae9||0xcc;return function(_0x47a310){if(_0x47a310){return _0x146b12[_0xe896('0x17')](_0xa00ae9);}return _0x146b12[_0xe896('0x18')](_0xa00ae9)[_0xe896('0x19')]();};}function respondWithResult(_0x580aac,_0x2aa522){_0x2aa522=_0x2aa522||0xc8;return function(_0x2f1c3e){if(_0x2f1c3e){return _0x580aac[_0xe896('0x18')](_0x2aa522)['json'](_0x2f1c3e);}};}function respondWithFilteredResult(_0x2d0e46,_0x7dcf8a){return function(_0x1e7ef8){if(_0x1e7ef8){var _0x564758=_0x1e7ef8['count'],_0x5a7957=_0x7dcf8a['offset'],_0x446ce2=_0x7dcf8a[_0xe896('0x1a')]+_0x7dcf8a[_0xe896('0x1b')],_0x25606b;if(_0x446ce2>=_0x564758){_0x446ce2=_0x564758;_0x25606b=0xc8;}else{_0x25606b=0xce;}_0x2d0e46['status'](_0x25606b);return _0x2d0e46[_0xe896('0x1c')]('Content-Range',_0x5a7957+'-'+_0x446ce2+'/'+_0x564758)[_0xe896('0x1d')](_0x1e7ef8);}return null;};}function patchUpdates(_0x32f86d){return function(_0x2d4cf0){try{jsonpatch['apply'](_0x2d4cf0,_0x32f86d,!![]);}catch(_0x782813){return BPromise[_0xe896('0x1e')](_0x782813);}return _0x2d4cf0[_0xe896('0x1f')]();};}function saveUpdates(_0xbebbe1,_0x2693d6){return function(_0x3ac8b8){if(_0x3ac8b8){return _0x3ac8b8[_0xe896('0x20')](_0xbebbe1)[_0xe896('0x21')](function(_0x49547b){return _0x49547b;});}return null;};}function removeEntity(_0x180d46,_0x5e1f29){return function(_0x5d2c8d){if(_0x5d2c8d){return _0x5d2c8d[_0xe896('0x22')]()[_0xe896('0x21')](function(){_0x180d46[_0xe896('0x18')](0xcc)[_0xe896('0x19')]();});}};}function handleEntityNotFound(_0x498469,_0x468479){return function(_0x4ad156){if(!_0x4ad156){_0x498469['sendStatus'](0x194);}return _0x4ad156;};}function handleError(_0x45dd49,_0x41e689){_0x41e689=_0x41e689||0x1f4;return function(_0x1e952a){logger[_0xe896('0x23')](_0x1e952a[_0xe896('0x24')]);if(_0x1e952a[_0xe896('0x25')]){delete _0x1e952a[_0xe896('0x25')];}_0x45dd49['status'](_0x41e689)[_0xe896('0x26')](_0x1e952a);};}exports[_0xe896('0x27')]=function(_0xc3cd05,_0x569d5f){var _0x26635e={},_0xd50fe2={},_0x2bc11d={'count':0x0,'rows':[]};var _0xe93aa0=db[_0xe896('0x28')][_0xe896('0x29')];_0xd50fe2['model']=_[_0xe896('0x2a')](_0xe93aa0);var _0x34ccfd={'dateStart':_0xc3cd05[_0xe896('0x2b')][_0xe896('0x2c')],'dateEnd':_0xc3cd05[_0xe896('0x2b')]['dateEnd']};delete _0xc3cd05['query']['dateStart'];delete _0xc3cd05['query']['dateEnd'];_0xd50fe2[_0xe896('0x2b')]=_[_0xe896('0x2a')](_0xc3cd05[_0xe896('0x2b')]);_0xd50fe2[_0xe896('0x2d')]=_[_0xe896('0x2e')](_0xd50fe2[_0xe896('0x2f')],_0xd50fe2[_0xe896('0x2b')]);_0x26635e[_0xe896('0x30')]=_['intersection'](_0xd50fe2['model'],qs[_0xe896('0x31')](_0xc3cd05[_0xe896('0x2b')][_0xe896('0x31')]));_0x26635e[_0xe896('0x30')]=_0x26635e['attributes'][_0xe896('0x32')]?_0x26635e['attributes']:_0xd50fe2['model'];if(!_0xc3cd05[_0xe896('0x2b')][_0xe896('0x33')](_0xe896('0x34'))){_0x26635e['limit']=qs['limit'](_0xc3cd05['query'][_0xe896('0x1b')]);_0x26635e[_0xe896('0x1a')]=qs[_0xe896('0x1a')](_0xc3cd05[_0xe896('0x2b')][_0xe896('0x1a')]);}_0x26635e['order']=qs[_0xe896('0x35')](_0xc3cd05[_0xe896('0x2b')][_0xe896('0x35')]);_0x26635e[_0xe896('0x36')]=qs[_0xe896('0x2d')](_[_0xe896('0x37')](_0xc3cd05[_0xe896('0x2b')],_0xd50fe2[_0xe896('0x2d')]));if(_0x34ccfd['dateStart']){if(_0x34ccfd[_0xe896('0x38')]){_0x34ccfd[_0xe896('0x38')]=moment(_0x34ccfd['dateEnd'])[_0xe896('0x39')](0x1,'day');}else{_0x34ccfd[_0xe896('0x38')]=moment(_0x34ccfd['dateStart'])[_0xe896('0x39')](0x1,'day');}_[_0xe896('0x3a')](_0x26635e[_0xe896('0x36')],{'createdAt':{'$gte':_0x34ccfd[_0xe896('0x2c')],'$lte':_0x34ccfd[_0xe896('0x38')]}});}if(_0xc3cd05[_0xe896('0x2b')]['filter']){_0x26635e['where']=_[_0xe896('0x3a')](_0x26635e[_0xe896('0x36')],{'$or':_[_0xe896('0x3b')](_0x26635e[_0xe896('0x30')],function(_0x2ff489){var _0x4c0ef0={};_0x4c0ef0[_0x2ff489]={'$like':'%'+_0xc3cd05['query'][_0xe896('0x3c')]+'%'};return _0x4c0ef0;})});}_0x26635e=_[_0xe896('0x3a')]({},_0x26635e,_0xc3cd05['options']);var _0x57e194={'where':_0x26635e[_0xe896('0x36')]};return db[_0xe896('0x28')][_0xe896('0x3d')](_0x57e194)[_0xe896('0x21')](function(_0x359bfb){_0x2bc11d[_0xe896('0x3d')]=_0x359bfb;if(_0xc3cd05[_0xe896('0x2b')][_0xe896('0x3e')]){_0x26635e[_0xe896('0x3f')]=[{'all':!![]}];}return db[_0xe896('0x28')][_0xe896('0x40')](_0x26635e);})[_0xe896('0x21')](function(_0x5c00c6){_0x2bc11d[_0xe896('0x41')]=_0x5c00c6;return _0x2bc11d;})[_0xe896('0x21')](respondWithFilteredResult(_0x569d5f,_0x26635e))['catch'](handleError(_0x569d5f,null));};exports['show']=function(_0x5cd5a3,_0x36449e){var _0x2a354f={'raw':![],'where':{'id':_0x5cd5a3['params']['id']}},_0x1ab77c={};_0x1ab77c[_0xe896('0x2f')]=_[_0xe896('0x2a')](db['crmMyCompany']['rawAttributes']);_0x1ab77c['query']=_[_0xe896('0x2a')](_0x5cd5a3[_0xe896('0x2b')]);_0x1ab77c[_0xe896('0x2d')]=_[_0xe896('0x2e')](_0x1ab77c[_0xe896('0x2f')],_0x1ab77c[_0xe896('0x2b')]);_0x2a354f['attributes']=_[_0xe896('0x2e')](_0x1ab77c[_0xe896('0x2f')],qs['fields'](_0x5cd5a3[_0xe896('0x2b')][_0xe896('0x31')]));_0x2a354f[_0xe896('0x30')]=_0x2a354f[_0xe896('0x30')]['length']?_0x2a354f[_0xe896('0x30')]:_0x1ab77c[_0xe896('0x2f')];if(_0x5cd5a3[_0xe896('0x2b')][_0xe896('0x3e')]){_0x2a354f[_0xe896('0x3f')]=[{'all':!![]}];}_0x2a354f=_[_0xe896('0x3a')]({},_0x2a354f,_0x5cd5a3['options']);return db[_0xe896('0x28')]['find'](_0x2a354f)[_0xe896('0x21')](handleEntityNotFound(_0x36449e,null))[_0xe896('0x21')](respondWithResult(_0x36449e,null))[_0xe896('0x42')](handleError(_0x36449e,null));};exports[_0xe896('0x43')]=function(_0x252c27,_0x8523d7){return db['crmMyCompany'][_0xe896('0x43')](_0x252c27[_0xe896('0x44')],{})['then'](respondWithResult(_0x8523d7,0xc9))[_0xe896('0x42')](handleError(_0x8523d7,null));};exports[_0xe896('0x20')]=function(_0x4d0047,_0x3ef032){if(_0x4d0047['body']['id']){delete _0x4d0047[_0xe896('0x44')]['id'];}return db[_0xe896('0x28')][_0xe896('0x45')]({'where':{'id':_0x4d0047[_0xe896('0x46')]['id']}})[_0xe896('0x21')](handleEntityNotFound(_0x3ef032,null))['then'](saveUpdates(_0x4d0047[_0xe896('0x44')],null))[_0xe896('0x21')](respondWithResult(_0x3ef032,null))[_0xe896('0x42')](handleError(_0x3ef032,null));};exports['destroy']=function(_0x2ceae5,_0x5d205b){return db['crmMyCompany'][_0xe896('0x45')]({'where':{'id':_0x2ceae5[_0xe896('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d205b,null))[_0xe896('0x21')](removeEntity(_0x5d205b,null))[_0xe896('0x42')](handleError(_0x5d205b,null));};exports['describe']=function(_0x58497a,_0x2e8fac){return db[_0xe896('0x28')]['describe']()[_0xe896('0x21')](respondWithResult(_0x2e8fac,null))[_0xe896('0x42')](handleError(_0x2e8fac,null));}; \ No newline at end of file diff --git a/server/api/crmMyCompanies/crmMyCompanies.model.js b/server/api/crmMyCompanies/crmMyCompanies.model.js index 065461e..5ac928f 100644 --- a/server/api/crmMyCompanies/crmMyCompanies.model.js +++ b/server/api/crmMyCompanies/crmMyCompanies.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dfc=['crm_maycompanies','lodash','util','api','moment','bluebird','request-promise','./crmMyCompanies.attributes','exports','crmMyCompany'];(function(_0xaaaeec,_0x5e257c){var _0x335c69=function(_0x27d92f){while(--_0x27d92f){_0xaaaeec['push'](_0xaaaeec['shift']());}};_0x335c69(++_0x5e257c);}(_0x7dfc,0x19b));var _0xc7df=function(_0x498211,_0xdfed9d){_0x498211=_0x498211-0x0;var _0x2d019c=_0x7dfc[_0x498211];return _0x2d019c;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var logger=require('../../config/logger')(_0xc7df('0x2'));var moment=require(_0xc7df('0x3'));var BPromise=require(_0xc7df('0x4'));var rp=require(_0xc7df('0x5'));var attributes=require(_0xc7df('0x6'));module[_0xc7df('0x7')]=function(_0x17e6bc,_0x2b833e){return _0x17e6bc['define'](_0xc7df('0x8'),attributes,{'tableName':_0xc7df('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6113=['bluebird','request-promise','./crmMyCompanies.attributes','exports','crmMyCompany','crm_maycompanies','lodash','util','../../config/logger','moment'];(function(_0x5d170e,_0x360717){var _0x21c0de=function(_0x57665f){while(--_0x57665f){_0x5d170e['push'](_0x5d170e['shift']());}};_0x21c0de(++_0x360717);}(_0x6113,0x1c8));var _0x3611=function(_0x4114ed,_0xd5a4f8){_0x4114ed=_0x4114ed-0x0;var _0x2f9388=_0x6113[_0x4114ed];return _0x2f9388;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var attributes=require(_0x3611('0x6'));module[_0x3611('0x7')]=function(_0x1661c9,_0x33586a){return _0x1661c9['define'](_0x3611('0x8'),attributes,{'tableName':_0x3611('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/crmMyCompanies/crmMyCompanies.rpc.js b/server/api/crmMyCompanies/crmMyCompanies.rpc.js index c464b97..b0e04de 100644 --- a/server/api/crmMyCompanies/crmMyCompanies.rpc.js +++ b/server/api/crmMyCompanies/crmMyCompanies.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75e4=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','crmMyCompany,\x20%s,\x20%s','request\x20sent','debug','crmMyCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x75e4,0x6b));var _0x475e=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x75e4[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require('lodash');var util=require(_0x475e('0x0'));var moment=require(_0x475e('0x1'));var BPromise=require(_0x475e('0x2'));var rs=require(_0x475e('0x3'));var fs=require('fs');var db=require(_0x475e('0x4'))['db'];var utils=require(_0x475e('0x5'));var logger=require(_0x475e('0x6'))(_0x475e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x475e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3b8a,_0x4ee84e,_0x4bf021){return new BPromise(function(_0x190491,_0x4b1c34){return client[_0x475e('0x9')](_0x3c3b8a,_0x4bf021)[_0x475e('0xa')](function(_0x53b48a){logger[_0x475e('0xb')](_0x475e('0xc'),_0x4ee84e,_0x475e('0xd'));logger[_0x475e('0xe')](_0x475e('0xf'),_0x4ee84e,'request\x20sent',JSON[_0x475e('0x10')](_0x53b48a));if(_0x53b48a[_0x475e('0x11')]){if(_0x53b48a[_0x475e('0x11')]['code']===0x1f4){logger[_0x475e('0x11')](_0x475e('0xc'),_0x4ee84e,_0x53b48a[_0x475e('0x11')][_0x475e('0x12')]);return _0x4b1c34(_0x53b48a[_0x475e('0x11')][_0x475e('0x12')]);}logger['error']('crmMyCompany,\x20%s,\x20%s',_0x4ee84e,_0x53b48a[_0x475e('0x11')][_0x475e('0x12')]);return _0x190491(_0x53b48a['error'][_0x475e('0x12')]);}else{logger[_0x475e('0xb')]('crmMyCompany,\x20%s,\x20%s',_0x4ee84e,'request\x20sent');_0x190491(_0x53b48a[_0x475e('0x13')][_0x475e('0x12')]);}})[_0x475e('0x14')](function(_0x2b13ed){logger[_0x475e('0x11')](_0x475e('0xc'),_0x4ee84e,_0x2b13ed);_0x4b1c34(_0x2b13ed);});});} \ No newline at end of file +var _0x7c3b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','crmMyCompany,\x20%s,\x20%s','request\x20sent','crmMyCompany,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','randomstring','../../mysqldb'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x7c3b,0x19e));var _0xb7c3=function(_0x2429a0,_0x5d69ff){_0x2429a0=_0x2429a0-0x0;var _0x1fe7b7=_0x7c3b[_0x2429a0];return _0x1fe7b7;};'use strict';var _=require(_0xb7c3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb7c3('0x1'));var rs=require(_0xb7c3('0x2'));var fs=require('fs');var db=require(_0xb7c3('0x3'))['db'];var utils=require(_0xb7c3('0x4'));var logger=require(_0xb7c3('0x5'))(_0xb7c3('0x6'));var config=require(_0xb7c3('0x7'));var jayson=require(_0xb7c3('0x8'));var client=jayson[_0xb7c3('0x9')][_0xb7c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10e8ce,_0x51710a,_0x42eca7){return new BPromise(function(_0x3d01a6,_0x46d485){return client['request'](_0x10e8ce,_0x42eca7)[_0xb7c3('0xb')](function(_0x1ee1e5){logger[_0xb7c3('0xc')](_0xb7c3('0xd'),_0x51710a,_0xb7c3('0xe'));logger['debug'](_0xb7c3('0xf'),_0x51710a,_0xb7c3('0xe'),JSON['stringify'](_0x1ee1e5));if(_0x1ee1e5[_0xb7c3('0x10')]){if(_0x1ee1e5[_0xb7c3('0x10')][_0xb7c3('0x11')]===0x1f4){logger[_0xb7c3('0x10')](_0xb7c3('0xd'),_0x51710a,_0x1ee1e5[_0xb7c3('0x10')][_0xb7c3('0x12')]);return _0x46d485(_0x1ee1e5[_0xb7c3('0x10')][_0xb7c3('0x12')]);}logger[_0xb7c3('0x10')](_0xb7c3('0xd'),_0x51710a,_0x1ee1e5[_0xb7c3('0x10')][_0xb7c3('0x12')]);return _0x3d01a6(_0x1ee1e5[_0xb7c3('0x10')][_0xb7c3('0x12')]);}else{logger['info'](_0xb7c3('0xd'),_0x51710a,'request\x20sent');_0x3d01a6(_0x1ee1e5['result'][_0xb7c3('0x12')]);}})['catch'](function(_0x334985){logger[_0xb7c3('0x10')]('crmMyCompany,\x20%s,\x20%s',_0x51710a,_0x334985);_0x46d485(_0x334985);});});} \ No newline at end of file diff --git a/server/api/crmMyCompanies/index.js b/server/api/crmMyCompanies/index.js index 36176a2..2065442 100644 --- a/server/api/crmMyCompanies/index.js +++ b/server/api/crmMyCompanies/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1147=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./crmMyCompanies.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x1443d1,_0xc5908b){var _0x1b4449=function(_0x4019c6){while(--_0x4019c6){_0x1443d1['push'](_0x1443d1['shift']());}};_0x1b4449(++_0xc5908b);}(_0x1147,0xf5));var _0x7114=function(_0x2026b4,_0x54bd14){_0x2026b4=_0x2026b4-0x0;var _0x58dbf8=_0x1147[_0x2026b4];return _0x58dbf8;};'use strict';var multer=require(_0x7114('0x0'));var util=require('util');var path=require(_0x7114('0x1'));var timeout=require(_0x7114('0x2'));var express=require(_0x7114('0x3'));var router=express[_0x7114('0x4')]();var auth=require(_0x7114('0x5'));var interaction=require(_0x7114('0x6'));var config=require(_0x7114('0x7'));var controller=require(_0x7114('0x8'));router[_0x7114('0x9')]('/',auth[_0x7114('0xa')](),controller['index']);router[_0x7114('0x9')]('/describe',auth[_0x7114('0xa')](),controller['describe']);router[_0x7114('0x9')](_0x7114('0xb'),auth[_0x7114('0xa')](),controller[_0x7114('0xc')]);router[_0x7114('0xd')]('/',auth[_0x7114('0xa')](),controller[_0x7114('0xe')]);router[_0x7114('0xf')](_0x7114('0xb'),auth[_0x7114('0xa')](),controller[_0x7114('0x10')]);router[_0x7114('0x11')](_0x7114('0xb'),auth[_0x7114('0xa')](),controller[_0x7114('0x12')]);module[_0x7114('0x13')]=router; \ No newline at end of file +var _0x2d2c=['index','/describe','show','post','create','/:id','update','delete','destroy','exports','util','Router','./crmMyCompanies.controller','get','isAuthenticated'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x2d2c,0xaf));var _0xc2d2=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x2d2c[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require(_0xc2d2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc2d2('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc2d2('0x2'));router[_0xc2d2('0x3')]('/',auth[_0xc2d2('0x4')](),controller[_0xc2d2('0x5')]);router[_0xc2d2('0x3')](_0xc2d2('0x6'),auth[_0xc2d2('0x4')](),controller['describe']);router[_0xc2d2('0x3')]('/:id',auth[_0xc2d2('0x4')](),controller[_0xc2d2('0x7')]);router[_0xc2d2('0x8')]('/',auth['isAuthenticated'](),controller[_0xc2d2('0x9')]);router['put'](_0xc2d2('0xa'),auth[_0xc2d2('0x4')](),controller[_0xc2d2('0xb')]);router[_0xc2d2('0xc')](_0xc2d2('0xa'),auth[_0xc2d2('0x4')](),controller[_0xc2d2('0xd')]);module[_0xc2d2('0xe')]=router; \ No newline at end of file diff --git a/server/api/crmNation/crmNation.attributes.js b/server/api/crmNation/crmNation.attributes.js index ba3c357..a308591 100644 --- a/server/api/crmNation/crmNation.attributes.js +++ b/server/api/crmNation/crmNation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74ae=['sequelize','exports','STRING','name','isoCode2'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x74ae,0x1d6));var _0xe74a=function(_0x428310,_0x16977c){_0x428310=_0x428310-0x0;var _0x4eae4f=_0x74ae[_0x428310];return _0x4eae4f;};'use strict';var Sequelize=require(_0xe74a('0x0'));module[_0xe74a('0x1')]={'name':{'type':Sequelize[_0xe74a('0x2')],'allowNull':![],'unique':_0xe74a('0x3')},'europe':{'type':Sequelize['BOOLEAN'],'allowNull':![]},'isoCode3':{'type':Sequelize[_0xe74a('0x2')](0x3),'allowNull':![],'unique':'isoCode3'},'isoCode2':{'type':Sequelize['STRING'](0x2),'allowNull':![],'unique':_0xe74a('0x4')}}; \ No newline at end of file +var _0x83b3=['STRING','name','BOOLEAN','isoCode3','isoCode2','sequelize','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x83b3,0x147));var _0x383b=function(_0x9953ab,_0x4ca17c){_0x9953ab=_0x9953ab-0x0;var _0x205899=_0x83b3[_0x9953ab];return _0x205899;};'use strict';var Sequelize=require(_0x383b('0x0'));module[_0x383b('0x1')]={'name':{'type':Sequelize[_0x383b('0x2')],'allowNull':![],'unique':_0x383b('0x3')},'europe':{'type':Sequelize[_0x383b('0x4')],'allowNull':![]},'isoCode3':{'type':Sequelize[_0x383b('0x2')](0x3),'allowNull':![],'unique':_0x383b('0x5')},'isoCode2':{'type':Sequelize[_0x383b('0x2')](0x2),'allowNull':![],'unique':_0x383b('0x6')}}; \ No newline at end of file diff --git a/server/api/crmNation/crmNation.controller.js b/server/api/crmNation/crmNation.controller.js index 2c24751..d0b175e 100644 --- a/server/api/crmNation/crmNation.controller.js +++ b/server/api/crmNation/crmNation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d76=['../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','name','send','index','CrmNation','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','field','options','includeAll','include','findAll','rows','catch','show','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x340fb7,_0x4eb35e){var _0x3e0321=function(_0x17952e){while(--_0x17952e){_0x340fb7['push'](_0x340fb7['shift']());}};_0x3e0321(++_0x4eb35e);}(_0x9d76,0x76));var _0x69d7=function(_0x5c8795,_0x34a102){_0x5c8795=_0x5c8795-0x0;var _0x43ae0a=_0x9d76[_0x5c8795];return _0x43ae0a;};'use strict';var pdf=require(_0x69d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69d7('0x1'));var zipdir=require(_0x69d7('0x2'));var jsonpatch=require(_0x69d7('0x3'));var rp=require(_0x69d7('0x4'));var moment=require(_0x69d7('0x5'));var BPromise=require(_0x69d7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x69d7('0x7'));var sox=require(_0x69d7('0x8'));var csv=require(_0x69d7('0x9'));var ejs=require(_0x69d7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x69d7('0xb'));var crypto=require(_0x69d7('0xc'));var jsforce=require(_0x69d7('0xd'));var deskjs=require(_0x69d7('0xe'));var toCsv=require(_0x69d7('0x9'));var querystring=require(_0x69d7('0xf'));var Papa=require(_0x69d7('0x10'));var Redis=require(_0x69d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69d7('0x12'));var hardwareService=require(_0x69d7('0x13'));var logger=require(_0x69d7('0x14'))(_0x69d7('0x15'));var utils=require(_0x69d7('0x16'));var config=require(_0x69d7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58cf33,_0x23265c){_0x23265c=_0x23265c||0xcc;return function(_0xaf1703){if(_0xaf1703){return _0x58cf33['sendStatus'](_0x23265c);}return _0x58cf33[_0x69d7('0x18')](_0x23265c)[_0x69d7('0x19')]();};}function respondWithResult(_0x8539fd,_0x780f44){_0x780f44=_0x780f44||0xc8;return function(_0xd9e46a){if(_0xd9e46a){return _0x8539fd[_0x69d7('0x18')](_0x780f44)['json'](_0xd9e46a);}};}function respondWithFilteredResult(_0xa49c1e,_0x1269b7){return function(_0x274e9e){if(_0x274e9e){var _0x9376b=_0x274e9e[_0x69d7('0x1a')],_0x54a95c=_0x1269b7[_0x69d7('0x1b')],_0x545c85=_0x1269b7[_0x69d7('0x1b')]+_0x1269b7[_0x69d7('0x1c')],_0x3f2937;if(_0x545c85>=_0x9376b){_0x545c85=_0x9376b;_0x3f2937=0xc8;}else{_0x3f2937=0xce;}_0xa49c1e[_0x69d7('0x18')](_0x3f2937);return _0xa49c1e[_0x69d7('0x1d')](_0x69d7('0x1e'),_0x54a95c+'-'+_0x545c85+'/'+_0x9376b)[_0x69d7('0x1f')](_0x274e9e);}return null;};}function patchUpdates(_0x4885b6){return function(_0x208b66){try{jsonpatch[_0x69d7('0x20')](_0x208b66,_0x4885b6,!![]);}catch(_0x1edfd2){return BPromise['reject'](_0x1edfd2);}return _0x208b66[_0x69d7('0x21')]();};}function saveUpdates(_0x2f8f5a,_0x5832d6){return function(_0x5ad0e4){if(_0x5ad0e4){return _0x5ad0e4[_0x69d7('0x22')](_0x2f8f5a)[_0x69d7('0x23')](function(_0x1c9c1f){return _0x1c9c1f;});}return null;};}function removeEntity(_0x879e3a,_0x518370){return function(_0x259034){if(_0x259034){return _0x259034[_0x69d7('0x24')]()[_0x69d7('0x23')](function(){_0x879e3a[_0x69d7('0x18')](0xcc)[_0x69d7('0x19')]();});}};}function handleEntityNotFound(_0x1218d8,_0x1a6189){return function(_0x1eecab){if(!_0x1eecab){_0x1218d8[_0x69d7('0x25')](0x194);}return _0x1eecab;};}function handleError(_0x4da434,_0x1a7cf9){_0x1a7cf9=_0x1a7cf9||0x1f4;return function(_0x38a836){logger[_0x69d7('0x26')](_0x38a836['stack']);if(_0x38a836[_0x69d7('0x27')]){delete _0x38a836['name'];}_0x4da434[_0x69d7('0x18')](_0x1a7cf9)[_0x69d7('0x28')](_0x38a836);};}exports[_0x69d7('0x29')]=function(_0x5e551e,_0x45921b){var _0x2b44d9={'raw':!![]},_0x3c261e={},_0x182153={'count':0x0,'rows':[]};var _0x23f911=db[_0x69d7('0x2a')][_0x69d7('0x2b')];_0x3c261e[_0x69d7('0x2c')]=_[_0x69d7('0x2d')](_0x23f911);_0x3c261e[_0x69d7('0x2e')]=_[_0x69d7('0x2d')](_0x5e551e['query']);_0x3c261e['filters']=_['intersection'](_0x3c261e[_0x69d7('0x2c')],_0x3c261e['query']);_0x2b44d9[_0x69d7('0x2f')]=_[_0x69d7('0x30')](_0x3c261e['model'],qs[_0x69d7('0x31')](_0x5e551e[_0x69d7('0x2e')]['fields']));_0x2b44d9[_0x69d7('0x2f')]=_0x2b44d9[_0x69d7('0x2f')]['length']?_0x2b44d9[_0x69d7('0x2f')]:_0x3c261e[_0x69d7('0x2c')];if(!_0x5e551e[_0x69d7('0x2e')][_0x69d7('0x32')](_0x69d7('0x33'))){_0x2b44d9['limit']=qs['limit'](_0x5e551e[_0x69d7('0x2e')][_0x69d7('0x1c')]);_0x2b44d9[_0x69d7('0x1b')]=qs[_0x69d7('0x1b')](_0x5e551e['query']['offset']);}_0x2b44d9[_0x69d7('0x34')]=qs[_0x69d7('0x35')](_0x5e551e[_0x69d7('0x2e')][_0x69d7('0x35')]);_0x2b44d9[_0x69d7('0x36')]=qs[_0x69d7('0x37')](_['pick'](_0x5e551e[_0x69d7('0x2e')],_0x3c261e[_0x69d7('0x37')]));if(_0x5e551e[_0x69d7('0x2e')][_0x69d7('0x38')]){_0x2b44d9[_0x69d7('0x36')]=_[_0x69d7('0x39')](_0x2b44d9[_0x69d7('0x36')],{'$or':_['map'](_0x23f911,function(_0x51823e){if(_0x51823e[_0x69d7('0x3a')]['key']!=='VIRTUAL'){var _0x559b0e={};_0x559b0e[_0x51823e[_0x69d7('0x3b')]]={'$like':'%'+_0x5e551e[_0x69d7('0x2e')][_0x69d7('0x38')]+'%'};return _0x559b0e;}})});}_0x2b44d9=_[_0x69d7('0x39')]({},_0x2b44d9,_0x5e551e[_0x69d7('0x3c')]);var _0x1a5057={'where':_0x2b44d9[_0x69d7('0x36')]};return db[_0x69d7('0x2a')][_0x69d7('0x1a')](_0x1a5057)[_0x69d7('0x23')](function(_0xdf9ae){_0x182153[_0x69d7('0x1a')]=_0xdf9ae;if(_0x5e551e['query'][_0x69d7('0x3d')]){_0x2b44d9[_0x69d7('0x3e')]=[{'all':!![]}];}return db[_0x69d7('0x2a')][_0x69d7('0x3f')](_0x2b44d9);})['then'](function(_0x17a780){_0x182153[_0x69d7('0x40')]=_0x17a780;return _0x182153;})['then'](respondWithFilteredResult(_0x45921b,_0x2b44d9))[_0x69d7('0x41')](handleError(_0x45921b,null));};exports[_0x69d7('0x42')]=function(_0x1bced8,_0x1852d1){var _0xca01fb={'raw':!![],'where':{'id':_0x1bced8['params']['id']}},_0x129b3a={};_0x129b3a[_0x69d7('0x2c')]=_['keys'](db[_0x69d7('0x2a')][_0x69d7('0x2b')]);_0x129b3a[_0x69d7('0x2e')]=_[_0x69d7('0x2d')](_0x1bced8[_0x69d7('0x2e')]);_0x129b3a[_0x69d7('0x37')]=_[_0x69d7('0x30')](_0x129b3a[_0x69d7('0x2c')],_0x129b3a['query']);_0xca01fb['attributes']=_[_0x69d7('0x30')](_0x129b3a[_0x69d7('0x2c')],qs[_0x69d7('0x31')](_0x1bced8[_0x69d7('0x2e')][_0x69d7('0x31')]));_0xca01fb['attributes']=_0xca01fb['attributes']['length']?_0xca01fb[_0x69d7('0x2f')]:_0x129b3a['model'];if(_0x1bced8[_0x69d7('0x2e')][_0x69d7('0x3d')]){_0xca01fb[_0x69d7('0x3e')]=[{'all':!![]}];}_0xca01fb=_[_0x69d7('0x39')]({},_0xca01fb,_0x1bced8[_0x69d7('0x3c')]);return db[_0x69d7('0x2a')]['find'](_0xca01fb)[_0x69d7('0x23')](handleEntityNotFound(_0x1852d1,null))[_0x69d7('0x23')](respondWithResult(_0x1852d1,null))[_0x69d7('0x41')](handleError(_0x1852d1,null));};exports[_0x69d7('0x43')]=function(_0x2a1f88,_0x1857e9){return db[_0x69d7('0x2a')][_0x69d7('0x43')](_0x2a1f88[_0x69d7('0x44')],{})[_0x69d7('0x23')](respondWithResult(_0x1857e9,0xc9))['catch'](handleError(_0x1857e9,null));}; \ No newline at end of file +var _0x2d07=['end','json','count','offset','limit','set','apply','reject','then','error','name','send','index','CrmNation','rawAttributes','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','params','filters','fields','options','find','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','status'];(function(_0x547402,_0x55f166){var _0xed911c=function(_0x4c8761){while(--_0x4c8761){_0x547402['push'](_0x547402['shift']());}};_0xed911c(++_0x55f166);}(_0x2d07,0x13a));var _0x72d0=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0x2d07[_0x4b64a4];return _0xd19b0e;};'use strict';var pdf=require(_0x72d0('0x0'));var emlformat=require(_0x72d0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72d0('0x2'));var jsonpatch=require(_0x72d0('0x3'));var rp=require('request-promise');var moment=require(_0x72d0('0x4'));var BPromise=require(_0x72d0('0x5'));var Mustache=require(_0x72d0('0x6'));var util=require(_0x72d0('0x7'));var path=require(_0x72d0('0x8'));var sox=require(_0x72d0('0x9'));var csv=require('to-csv');var ejs=require(_0x72d0('0xa'));var fs=require('fs');var _=require(_0x72d0('0xb'));var squel=require(_0x72d0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x72d0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72d0('0xe'));var authService=require(_0x72d0('0xf'));var qs=require(_0x72d0('0x10'));var hardwareService=require(_0x72d0('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x72d0('0x12'));var db=require(_0x72d0('0x13'))['db'];function respondWithStatusCode(_0xc8661a,_0x110012){_0x110012=_0x110012||0xcc;return function(_0x262274){if(_0x262274){return _0xc8661a['sendStatus'](_0x110012);}return _0xc8661a[_0x72d0('0x14')](_0x110012)[_0x72d0('0x15')]();};}function respondWithResult(_0x2721eb,_0x4f2343){_0x4f2343=_0x4f2343||0xc8;return function(_0x183dc7){if(_0x183dc7){return _0x2721eb[_0x72d0('0x14')](_0x4f2343)[_0x72d0('0x16')](_0x183dc7);}};}function respondWithFilteredResult(_0x167cb5,_0x19b3e7){return function(_0xea1112){if(_0xea1112){var _0x50c274=_0xea1112[_0x72d0('0x17')],_0x1e2089=_0x19b3e7[_0x72d0('0x18')],_0x197179=_0x19b3e7[_0x72d0('0x18')]+_0x19b3e7[_0x72d0('0x19')],_0x1ea03f;if(_0x197179>=_0x50c274){_0x197179=_0x50c274;_0x1ea03f=0xc8;}else{_0x1ea03f=0xce;}_0x167cb5[_0x72d0('0x14')](_0x1ea03f);return _0x167cb5[_0x72d0('0x1a')]('Content-Range',_0x1e2089+'-'+_0x197179+'/'+_0x50c274)[_0x72d0('0x16')](_0xea1112);}return null;};}function patchUpdates(_0x357553){return function(_0x2cd4aa){try{jsonpatch[_0x72d0('0x1b')](_0x2cd4aa,_0x357553,!![]);}catch(_0xf9d806){return BPromise[_0x72d0('0x1c')](_0xf9d806);}return _0x2cd4aa['save']();};}function saveUpdates(_0x4d65f3,_0x5c905a){return function(_0x4cbdf1){if(_0x4cbdf1){return _0x4cbdf1['update'](_0x4d65f3)[_0x72d0('0x1d')](function(_0x3c2441){return _0x3c2441;});}return null;};}function removeEntity(_0x55764b,_0xf8c7){return function(_0x30cb19){if(_0x30cb19){return _0x30cb19['destroy']()[_0x72d0('0x1d')](function(){_0x55764b[_0x72d0('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb4be9d,_0x1c39e3){return function(_0x350184){if(!_0x350184){_0xb4be9d['sendStatus'](0x194);}return _0x350184;};}function handleError(_0x31f6de,_0x50f263){_0x50f263=_0x50f263||0x1f4;return function(_0x37634e){logger[_0x72d0('0x1e')](_0x37634e['stack']);if(_0x37634e[_0x72d0('0x1f')]){delete _0x37634e[_0x72d0('0x1f')];}_0x31f6de[_0x72d0('0x14')](_0x50f263)[_0x72d0('0x20')](_0x37634e);};}exports[_0x72d0('0x21')]=function(_0x7f45,_0x10d27e){var _0x4e6093={'raw':!![]},_0x2ff68a={},_0x4d8340={'count':0x0,'rows':[]};var _0x20b9d=db[_0x72d0('0x22')][_0x72d0('0x23')];_0x2ff68a[_0x72d0('0x24')]=_[_0x72d0('0x25')](_0x20b9d);_0x2ff68a['query']=_[_0x72d0('0x25')](_0x7f45[_0x72d0('0x26')]);_0x2ff68a['filters']=_[_0x72d0('0x27')](_0x2ff68a[_0x72d0('0x24')],_0x2ff68a[_0x72d0('0x26')]);_0x4e6093['attributes']=_[_0x72d0('0x27')](_0x2ff68a[_0x72d0('0x24')],qs['fields'](_0x7f45[_0x72d0('0x26')]['fields']));_0x4e6093[_0x72d0('0x28')]=_0x4e6093[_0x72d0('0x28')][_0x72d0('0x29')]?_0x4e6093[_0x72d0('0x28')]:_0x2ff68a[_0x72d0('0x24')];if(!_0x7f45[_0x72d0('0x26')][_0x72d0('0x2a')](_0x72d0('0x2b'))){_0x4e6093[_0x72d0('0x19')]=qs[_0x72d0('0x19')](_0x7f45[_0x72d0('0x26')][_0x72d0('0x19')]);_0x4e6093['offset']=qs[_0x72d0('0x18')](_0x7f45[_0x72d0('0x26')][_0x72d0('0x18')]);}_0x4e6093[_0x72d0('0x2c')]=qs[_0x72d0('0x2d')](_0x7f45[_0x72d0('0x26')][_0x72d0('0x2d')]);_0x4e6093[_0x72d0('0x2e')]=qs['filters'](_[_0x72d0('0x2f')](_0x7f45[_0x72d0('0x26')],_0x2ff68a['filters']));if(_0x7f45['query'][_0x72d0('0x30')]){_0x4e6093[_0x72d0('0x2e')]=_[_0x72d0('0x31')](_0x4e6093[_0x72d0('0x2e')],{'$or':_[_0x72d0('0x32')](_0x20b9d,function(_0xe79457){if(_0xe79457[_0x72d0('0x33')][_0x72d0('0x34')]!==_0x72d0('0x35')){var _0x26b2d2={};_0x26b2d2[_0xe79457[_0x72d0('0x36')]]={'$like':'%'+_0x7f45[_0x72d0('0x26')][_0x72d0('0x30')]+'%'};return _0x26b2d2;}})});}_0x4e6093=_[_0x72d0('0x31')]({},_0x4e6093,_0x7f45['options']);var _0x5266d2={'where':_0x4e6093[_0x72d0('0x2e')]};return db[_0x72d0('0x22')]['count'](_0x5266d2)[_0x72d0('0x1d')](function(_0x3d1adc){_0x4d8340['count']=_0x3d1adc;if(_0x7f45[_0x72d0('0x26')][_0x72d0('0x37')]){_0x4e6093[_0x72d0('0x38')]=[{'all':!![]}];}return db['CrmNation'][_0x72d0('0x39')](_0x4e6093);})['then'](function(_0x5d1d78){_0x4d8340[_0x72d0('0x3a')]=_0x5d1d78;return _0x4d8340;})['then'](respondWithFilteredResult(_0x10d27e,_0x4e6093))[_0x72d0('0x3b')](handleError(_0x10d27e,null));};exports[_0x72d0('0x3c')]=function(_0x45690b,_0x3700d2){var _0xd2e05={'raw':!![],'where':{'id':_0x45690b[_0x72d0('0x3d')]['id']}},_0x572c56={};_0x572c56['model']=_[_0x72d0('0x25')](db[_0x72d0('0x22')][_0x72d0('0x23')]);_0x572c56[_0x72d0('0x26')]=_['keys'](_0x45690b[_0x72d0('0x26')]);_0x572c56[_0x72d0('0x3e')]=_[_0x72d0('0x27')](_0x572c56[_0x72d0('0x24')],_0x572c56[_0x72d0('0x26')]);_0xd2e05['attributes']=_['intersection'](_0x572c56[_0x72d0('0x24')],qs[_0x72d0('0x3f')](_0x45690b['query'][_0x72d0('0x3f')]));_0xd2e05[_0x72d0('0x28')]=_0xd2e05['attributes'][_0x72d0('0x29')]?_0xd2e05[_0x72d0('0x28')]:_0x572c56[_0x72d0('0x24')];if(_0x45690b[_0x72d0('0x26')][_0x72d0('0x37')]){_0xd2e05[_0x72d0('0x38')]=[{'all':!![]}];}_0xd2e05=_[_0x72d0('0x31')]({},_0xd2e05,_0x45690b[_0x72d0('0x40')]);return db[_0x72d0('0x22')][_0x72d0('0x41')](_0xd2e05)['then'](handleEntityNotFound(_0x3700d2,null))['then'](respondWithResult(_0x3700d2,null))[_0x72d0('0x3b')](handleError(_0x3700d2,null));};exports['create']=function(_0x4ba9c8,_0x1763f4){return db[_0x72d0('0x22')]['create'](_0x4ba9c8[_0x72d0('0x42')],{})[_0x72d0('0x1d')](respondWithResult(_0x1763f4,0xc9))[_0x72d0('0x3b')](handleError(_0x1763f4,null));}; \ No newline at end of file diff --git a/server/api/crmNation/crmNation.model.js b/server/api/crmNation/crmNation.model.js index 63f9551..5bc9986 100644 --- a/server/api/crmNation/crmNation.model.js +++ b/server/api/crmNation/crmNation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe45=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','CrmNation','crm_nations'];(function(_0x174dd2,_0x5e7ae3){var _0x3b757e=function(_0x41a427){while(--_0x41a427){_0x174dd2['push'](_0x174dd2['shift']());}};_0x3b757e(++_0x5e7ae3);}(_0xbe45,0xa8));var _0x5be4=function(_0x3dbeb9,_0x188cc3){_0x3dbeb9=_0x3dbeb9-0x0;var _0x11a2a1=_0xbe45[_0x3dbeb9];return _0x11a2a1;};'use strict';var _=require(_0x5be4('0x0'));var util=require(_0x5be4('0x1'));var logger=require(_0x5be4('0x2'))(_0x5be4('0x3'));var moment=require('moment');var BPromise=require(_0x5be4('0x4'));var rp=require(_0x5be4('0x5'));var fs=require('fs');var path=require(_0x5be4('0x6'));var rimraf=require(_0x5be4('0x7'));var config=require(_0x5be4('0x8'));var attributes=require('./crmNation.attributes');module['exports']=function(_0x5d47a1,_0x2f5bbb){return _0x5d47a1[_0x5be4('0x9')](_0x5be4('0xa'),attributes,{'tableName':_0x5be4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1860=['bluebird','path','rimraf','../../config/environment','./crmNation.attributes','exports','define','CrmNation','crm_nations','lodash','util','../../config/logger','moment'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x1860,0x1ea));var _0x0186=function(_0x5b52d9,_0xa4cd15){_0x5b52d9=_0x5b52d9-0x0;var _0x2c5c50=_0x1860[_0x5b52d9];return _0x2c5c50;};'use strict';var _=require(_0x0186('0x0'));var util=require(_0x0186('0x1'));var logger=require(_0x0186('0x2'))('api');var moment=require(_0x0186('0x3'));var BPromise=require(_0x0186('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0186('0x5'));var rimraf=require(_0x0186('0x6'));var config=require(_0x0186('0x7'));var attributes=require(_0x0186('0x8'));module[_0x0186('0x9')]=function(_0x31b73e,_0x4b789b){return _0x31b73e[_0x0186('0xa')](_0x0186('0xb'),attributes,{'tableName':_0x0186('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/crmNation/crmNation.rpc.js b/server/api/crmNation/crmNation.rpc.js index 7a5e33f..f856f58 100644 --- a/server/api/crmNation/crmNation.rpc.js +++ b/server/api/crmNation/crmNation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bf7=['CrmNation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x15ca59,_0x11378c){var _0x1293d6=function(_0x5e14b0){while(--_0x5e14b0){_0x15ca59['push'](_0x15ca59['shift']());}};_0x1293d6(++_0x11378c);}(_0x2bf7,0x147));var _0x72bf=function(_0xbf7f2,_0x42f7dc){_0xbf7f2=_0xbf7f2-0x0;var _0x2b1b76=_0x2bf7[_0xbf7f2];return _0x2b1b76;};'use strict';var _=require(_0x72bf('0x0'));var util=require(_0x72bf('0x1'));var moment=require('moment');var BPromise=require(_0x72bf('0x2'));var rs=require(_0x72bf('0x3'));var fs=require('fs');var Redis=require(_0x72bf('0x4'));var db=require(_0x72bf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x72bf('0x6'))(_0x72bf('0x7'));var config=require('../../config/environment');var jayson=require(_0x72bf('0x8'));var client=jayson['client'][_0x72bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x375dc5,_0x64be30,_0x191c00){return new BPromise(function(_0x2be742,_0x1fde93){return client[_0x72bf('0xa')](_0x375dc5,_0x191c00)[_0x72bf('0xb')](function(_0x27a726){logger[_0x72bf('0xc')](_0x72bf('0xd'),_0x64be30,_0x72bf('0xe'));logger[_0x72bf('0xf')]('CrmNation,\x20%s,\x20%s,\x20%s',_0x64be30,'request\x20sent',JSON['stringify'](_0x27a726));if(_0x27a726[_0x72bf('0x10')]){if(_0x27a726[_0x72bf('0x10')][_0x72bf('0x11')]===0x1f4){logger[_0x72bf('0x10')](_0x72bf('0xd'),_0x64be30,_0x27a726[_0x72bf('0x10')][_0x72bf('0x12')]);return _0x1fde93(_0x27a726[_0x72bf('0x10')][_0x72bf('0x12')]);}logger[_0x72bf('0x10')](_0x72bf('0xd'),_0x64be30,_0x27a726[_0x72bf('0x10')][_0x72bf('0x12')]);return _0x2be742(_0x27a726['error'][_0x72bf('0x12')]);}else{logger[_0x72bf('0xc')](_0x72bf('0xd'),_0x64be30,_0x72bf('0xe'));_0x2be742(_0x27a726[_0x72bf('0x13')][_0x72bf('0x12')]);}})['catch'](function(_0x278e6f){logger[_0x72bf('0x10')](_0x72bf('0xd'),_0x64be30,_0x278e6f);_0x1fde93(_0x278e6f);});});} \ No newline at end of file +var _0x4eb2=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','CrmNation,\x20%s,\x20%s','request\x20sent','debug','CrmNation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x4eb2,0x104));var _0x24eb=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4eb2[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x24eb('0x0'));var util=require('util');var moment=require(_0x24eb('0x1'));var BPromise=require(_0x24eb('0x2'));var rs=require(_0x24eb('0x3'));var fs=require('fs');var Redis=require(_0x24eb('0x4'));var db=require(_0x24eb('0x5'))['db'];var utils=require(_0x24eb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x24eb('0x7'));var jayson=require(_0x24eb('0x8'));var client=jayson[_0x24eb('0x9')][_0x24eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14df23,_0x2c4b32,_0x536f50){return new BPromise(function(_0x43cad0,_0x275827){return client[_0x24eb('0xb')](_0x14df23,_0x536f50)[_0x24eb('0xc')](function(_0x567325){logger['info'](_0x24eb('0xd'),_0x2c4b32,_0x24eb('0xe'));logger[_0x24eb('0xf')](_0x24eb('0x10'),_0x2c4b32,'request\x20sent',JSON[_0x24eb('0x11')](_0x567325));if(_0x567325[_0x24eb('0x12')]){if(_0x567325[_0x24eb('0x12')][_0x24eb('0x13')]===0x1f4){logger[_0x24eb('0x12')]('CrmNation,\x20%s,\x20%s',_0x2c4b32,_0x567325[_0x24eb('0x12')][_0x24eb('0x14')]);return _0x275827(_0x567325[_0x24eb('0x12')]['message']);}logger['error']('CrmNation,\x20%s,\x20%s',_0x2c4b32,_0x567325['error'][_0x24eb('0x14')]);return _0x43cad0(_0x567325[_0x24eb('0x12')][_0x24eb('0x14')]);}else{logger[_0x24eb('0x15')](_0x24eb('0xd'),_0x2c4b32,_0x24eb('0xe'));_0x43cad0(_0x567325[_0x24eb('0x16')][_0x24eb('0x14')]);}})[_0x24eb('0x17')](function(_0x41d1b5){logger[_0x24eb('0x12')](_0x24eb('0xd'),_0x2c4b32,_0x41d1b5);_0x275827(_0x41d1b5);});});} \ No newline at end of file diff --git a/server/api/crmNation/index.js b/server/api/crmNation/index.js index 849ace6..f6106c0 100644 --- a/server/api/crmNation/index.js +++ b/server/api/crmNation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x951f=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','multer','util','path','connect-timeout','express','Router'];(function(_0x3b557f,_0x30ae6c){var _0x29c073=function(_0x41cb39){while(--_0x41cb39){_0x3b557f['push'](_0x3b557f['shift']());}};_0x29c073(++_0x30ae6c);}(_0x951f,0x104));var _0xf951=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x951f[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xf951('0x0'));var util=require(_0xf951('0x1'));var path=require(_0xf951('0x2'));var timeout=require(_0xf951('0x3'));var express=require(_0xf951('0x4'));var router=express[_0xf951('0x5')]();var auth=require(_0xf951('0x6'));var interaction=require(_0xf951('0x7'));var config=require('../../config/environment');var controller=require('./crmNation.controller');router['get']('/',auth[_0xf951('0x8')](),controller[_0xf951('0x9')]);router[_0xf951('0xa')](_0xf951('0xb'),auth[_0xf951('0x8')](),controller[_0xf951('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf951('0xd')]);module['exports']=router; \ No newline at end of file +var _0x79fb=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','post','isAuthenticated','create','multer','util'];(function(_0x1a4748,_0x4a52db){var _0x3d92bc=function(_0x3dcbb9){while(--_0x3dcbb9){_0x1a4748['push'](_0x1a4748['shift']());}};_0x3d92bc(++_0x4a52db);}(_0x79fb,0xb2));var _0xb79f=function(_0x4e7d09,_0x1e3b82){_0x4e7d09=_0x4e7d09-0x0;var _0x167daf=_0x79fb[_0x4e7d09];return _0x167daf;};'use strict';var multer=require(_0xb79f('0x0'));var util=require(_0xb79f('0x1'));var path=require(_0xb79f('0x2'));var timeout=require(_0xb79f('0x3'));var express=require(_0xb79f('0x4'));var router=express[_0xb79f('0x5')]();var auth=require(_0xb79f('0x6'));var interaction=require(_0xb79f('0x7'));var config=require(_0xb79f('0x8'));var controller=require('./crmNation.controller');router[_0xb79f('0x9')]('/',auth['isAuthenticated'](),controller[_0xb79f('0xa')]);router[_0xb79f('0x9')](_0xb79f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb79f('0xc')]('/',auth[_0xb79f('0xd')](),controller[_0xb79f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/crmTask/crmTask.attributes.js b/server/api/crmTask/crmTask.attributes.js index 9bb8483..d339a63 100644 --- a/server/api/crmTask/crmTask.attributes.js +++ b/server/api/crmTask/crmTask.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33ed=['exports','STRING','name','sequelize'];(function(_0x5f4980,_0x4b65a6){var _0x5616b4=function(_0x2abb57){while(--_0x2abb57){_0x5f4980['push'](_0x5f4980['shift']());}};_0x5616b4(++_0x4b65a6);}(_0x33ed,0xa7));var _0xd33e=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0x33ed[_0x3c4e4c];return _0x144a87;};'use strict';var Sequelize=require(_0xd33e('0x0'));module[_0xd33e('0x1')]={'name':{'type':Sequelize[_0xd33e('0x2')],'allowNull':![],'unique':_0xd33e('0x3')}}; \ No newline at end of file +var _0xe811=['name','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe811,0x1a8));var _0x1e81=function(_0x175e61,_0x3f505b){_0x175e61=_0x175e61-0x0;var _0x54c24c=_0xe811[_0x175e61];return _0x54c24c;};'use strict';var Sequelize=require(_0x1e81('0x0'));module[_0x1e81('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1e81('0x2')}}; \ No newline at end of file diff --git a/server/api/crmTask/crmTask.controller.js b/server/api/crmTask/crmTask.controller.js index bced4bf..95d1f68 100644 --- a/server/api/crmTask/crmTask.controller.js +++ b/server/api/crmTask/crmTask.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0163=['rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','stack','name','send','CrmTask','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','then','includeAll','include'];(function(_0x2d2721,_0x169d84){var _0x45b80c=function(_0x3fcb4e){while(--_0x3fcb4e){_0x2d2721['push'](_0x2d2721['shift']());}};_0x45b80c(++_0x169d84);}(_0x0163,0x189));var _0x3016=function(_0x118b47,_0x5f3036){_0x118b47=_0x118b47-0x0;var _0x5ed8fc=_0x0163[_0x118b47];return _0x5ed8fc;};'use strict';var pdf=require(_0x3016('0x0'));var emlformat=require(_0x3016('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3016('0x2'));var jsonpatch=require(_0x3016('0x3'));var rp=require(_0x3016('0x4'));var moment=require(_0x3016('0x5'));var BPromise=require(_0x3016('0x6'));var Mustache=require('mustache');var util=require(_0x3016('0x7'));var path=require(_0x3016('0x8'));var sox=require(_0x3016('0x9'));var csv=require(_0x3016('0xa'));var ejs=require(_0x3016('0xb'));var fs=require('fs');var _=require(_0x3016('0xc'));var squel=require(_0x3016('0xd'));var crypto=require(_0x3016('0xe'));var jsforce=require(_0x3016('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3016('0xa'));var querystring=require(_0x3016('0x10'));var Papa=require(_0x3016('0x11'));var Redis=require(_0x3016('0x12'));var authService=require(_0x3016('0x13'));var qs=require(_0x3016('0x14'));var hardwareService=require(_0x3016('0x15'));var logger=require(_0x3016('0x16'))(_0x3016('0x17'));var utils=require(_0x3016('0x18'));var config=require(_0x3016('0x19'));var db=require(_0x3016('0x1a'))['db'];function respondWithStatusCode(_0x4ddf46,_0x31fa2a){_0x31fa2a=_0x31fa2a||0xcc;return function(_0x29cfc2){if(_0x29cfc2){return _0x4ddf46[_0x3016('0x1b')](_0x31fa2a);}return _0x4ddf46[_0x3016('0x1c')](_0x31fa2a)[_0x3016('0x1d')]();};}function respondWithResult(_0xac228e,_0x422cc8){_0x422cc8=_0x422cc8||0xc8;return function(_0x5ea6f9){if(_0x5ea6f9){return _0xac228e[_0x3016('0x1c')](_0x422cc8)[_0x3016('0x1e')](_0x5ea6f9);}};}function respondWithFilteredResult(_0x5036cd,_0x576255){return function(_0x169758){if(_0x169758){var _0x227714=_0x169758['count'],_0x4ba048=_0x576255['offset'],_0x2e44f8=_0x576255[_0x3016('0x1f')]+_0x576255[_0x3016('0x20')],_0x43d99e;if(_0x2e44f8>=_0x227714){_0x2e44f8=_0x227714;_0x43d99e=0xc8;}else{_0x43d99e=0xce;}_0x5036cd[_0x3016('0x1c')](_0x43d99e);return _0x5036cd[_0x3016('0x21')]('Content-Range',_0x4ba048+'-'+_0x2e44f8+'/'+_0x227714)[_0x3016('0x1e')](_0x169758);}return null;};}function patchUpdates(_0x442706){return function(_0x4d456d){try{jsonpatch[_0x3016('0x22')](_0x4d456d,_0x442706,!![]);}catch(_0x46b040){return BPromise[_0x3016('0x23')](_0x46b040);}return _0x4d456d['save']();};}function saveUpdates(_0x1bf0f5,_0x54ccc8){return function(_0x368fe9){if(_0x368fe9){return _0x368fe9[_0x3016('0x24')](_0x1bf0f5)['then'](function(_0x256fb3){return _0x256fb3;});}return null;};}function removeEntity(_0x184f5d,_0x1538c2){return function(_0x208aa2){if(_0x208aa2){return _0x208aa2[_0x3016('0x25')]()['then'](function(){_0x184f5d['status'](0xcc)[_0x3016('0x1d')]();});}};}function handleEntityNotFound(_0x4918f5,_0x33c7d6){return function(_0x121170){if(!_0x121170){_0x4918f5[_0x3016('0x1b')](0x194);}return _0x121170;};}function handleError(_0x259442,_0x4239a6){_0x4239a6=_0x4239a6||0x1f4;return function(_0x42ac31){logger['error'](_0x42ac31[_0x3016('0x26')]);if(_0x42ac31[_0x3016('0x27')]){delete _0x42ac31[_0x3016('0x27')];}_0x259442['status'](_0x4239a6)[_0x3016('0x28')](_0x42ac31);};}exports['index']=function(_0x297aa3,_0x2b6cb7){var _0x3249f2={},_0x57bdec={},_0x58393={'count':0x0,'rows':[]};var _0x345a6f=db[_0x3016('0x29')][_0x3016('0x2a')];_0x57bdec['model']=_[_0x3016('0x2b')](_0x345a6f);_0x57bdec[_0x3016('0x2c')]=_['keys'](_0x297aa3[_0x3016('0x2c')]);_0x57bdec[_0x3016('0x2d')]=_['intersection'](_0x57bdec[_0x3016('0x2e')],_0x57bdec[_0x3016('0x2c')]);_0x3249f2[_0x3016('0x2f')]=_[_0x3016('0x30')](_0x57bdec[_0x3016('0x2e')],qs[_0x3016('0x31')](_0x297aa3['query']['fields']));_0x3249f2[_0x3016('0x2f')]=_0x3249f2['attributes'][_0x3016('0x32')]?_0x3249f2['attributes']:_0x57bdec[_0x3016('0x2e')];if(!_0x297aa3[_0x3016('0x2c')][_0x3016('0x33')](_0x3016('0x34'))){_0x3249f2[_0x3016('0x20')]=qs['limit'](_0x297aa3[_0x3016('0x2c')][_0x3016('0x20')]);_0x3249f2[_0x3016('0x1f')]=qs[_0x3016('0x1f')](_0x297aa3[_0x3016('0x2c')][_0x3016('0x1f')]);}_0x3249f2[_0x3016('0x35')]=qs[_0x3016('0x36')](_0x297aa3[_0x3016('0x2c')][_0x3016('0x36')]);_0x3249f2[_0x3016('0x37')]=qs[_0x3016('0x2d')](_[_0x3016('0x38')](_0x297aa3[_0x3016('0x2c')],_0x57bdec[_0x3016('0x2d')]));if(_0x297aa3[_0x3016('0x2c')][_0x3016('0x39')]){_0x3249f2[_0x3016('0x37')]=_[_0x3016('0x3a')](_0x3249f2['where'],{'$or':_[_0x3016('0x3b')](_0x345a6f,function(_0x1c5e5e){if(_0x1c5e5e[_0x3016('0x3c')][_0x3016('0x3d')]!==_0x3016('0x3e')){var _0x2fde59={};_0x2fde59[_0x1c5e5e[_0x3016('0x3f')]]={'$like':'%'+_0x297aa3[_0x3016('0x2c')]['filter']+'%'};return _0x2fde59;}})});}_0x3249f2=_['merge']({},_0x3249f2,_0x297aa3[_0x3016('0x40')]);var _0x3c01be={'where':_0x3249f2['where']};return db[_0x3016('0x29')][_0x3016('0x41')](_0x3c01be)[_0x3016('0x42')](function(_0xa0633c){_0x58393[_0x3016('0x41')]=_0xa0633c;if(_0x297aa3[_0x3016('0x2c')][_0x3016('0x43')]){_0x3249f2[_0x3016('0x44')]=[{'all':!![]}];}return db[_0x3016('0x29')]['findAll'](_0x3249f2);})[_0x3016('0x42')](function(_0x4486c0){_0x58393[_0x3016('0x45')]=_0x4486c0;return _0x58393;})[_0x3016('0x42')](respondWithFilteredResult(_0x2b6cb7,_0x3249f2))[_0x3016('0x46')](handleError(_0x2b6cb7,null));};exports[_0x3016('0x47')]=function(_0x3b9739,_0x180766){var _0x2f049e={'raw':![],'where':{'id':_0x3b9739[_0x3016('0x48')]['id']}},_0x1dab20={};_0x1dab20[_0x3016('0x2e')]=_[_0x3016('0x2b')](db[_0x3016('0x29')]['rawAttributes']);_0x1dab20['query']=_[_0x3016('0x2b')](_0x3b9739['query']);_0x1dab20[_0x3016('0x2d')]=_['intersection'](_0x1dab20[_0x3016('0x2e')],_0x1dab20[_0x3016('0x2c')]);_0x2f049e[_0x3016('0x2f')]=_['intersection'](_0x1dab20[_0x3016('0x2e')],qs[_0x3016('0x31')](_0x3b9739[_0x3016('0x2c')][_0x3016('0x31')]));_0x2f049e[_0x3016('0x2f')]=_0x2f049e['attributes']['length']?_0x2f049e[_0x3016('0x2f')]:_0x1dab20[_0x3016('0x2e')];if(_0x3b9739['query']['includeAll']){_0x2f049e[_0x3016('0x44')]=[{'all':!![]}];}_0x2f049e=_['merge']({},_0x2f049e,_0x3b9739[_0x3016('0x40')]);return db['CrmTask']['find'](_0x2f049e)[_0x3016('0x42')](handleEntityNotFound(_0x180766,null))[_0x3016('0x42')](respondWithResult(_0x180766,null))[_0x3016('0x46')](handleError(_0x180766,null));};exports[_0x3016('0x49')]=function(_0x3ca47d,_0x2ee6b7){return db[_0x3016('0x29')][_0x3016('0x49')](_0x3ca47d['body'],{})[_0x3016('0x42')](respondWithResult(_0x2ee6b7,0xc9))['catch'](handleError(_0x2ee6b7,null));};exports[_0x3016('0x24')]=function(_0x4b548a,_0x17fc43){if(_0x4b548a[_0x3016('0x4a')]['id']){delete _0x4b548a[_0x3016('0x4a')]['id'];}return db[_0x3016('0x29')]['find']({'where':{'id':_0x4b548a['params']['id']}})[_0x3016('0x42')](handleEntityNotFound(_0x17fc43,null))[_0x3016('0x42')](saveUpdates(_0x4b548a[_0x3016('0x4a')],null))['then'](respondWithResult(_0x17fc43,null))[_0x3016('0x46')](handleError(_0x17fc43,null));};exports[_0x3016('0x25')]=function(_0x345e4d,_0x4601f5){return db[_0x3016('0x29')][_0x3016('0x4b')]({'where':{'id':_0x345e4d[_0x3016('0x48')]['id']}})[_0x3016('0x42')](handleEntityNotFound(_0x4601f5,null))[_0x3016('0x42')](removeEntity(_0x4601f5,null))[_0x3016('0x46')](handleError(_0x4601f5,null));};exports[_0x3016('0x4c')]=function(_0xfdbcae,_0x5e16b5){return db[_0x3016('0x29')]['describe']()[_0x3016('0x42')](respondWithResult(_0x5e16b5,null))[_0x3016('0x46')](handleError(_0x5e16b5,null));}; \ No newline at end of file +var _0x7c6d=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','key','VIRTUAL','field','options','CrmTask','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','model','query'];(function(_0x299d36,_0x29a243){var _0x3ea12a=function(_0x2968c2){while(--_0x2968c2){_0x299d36['push'](_0x299d36['shift']());}};_0x3ea12a(++_0x29a243);}(_0x7c6d,0x1c8));var _0xd7c6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7c6d[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7c6('0x0'));var rimraf=require(_0xd7c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7c6('0x2'));var rp=require(_0xd7c6('0x3'));var moment=require(_0xd7c6('0x4'));var BPromise=require(_0xd7c6('0x5'));var Mustache=require(_0xd7c6('0x6'));var util=require(_0xd7c6('0x7'));var path=require(_0xd7c6('0x8'));var sox=require(_0xd7c6('0x9'));var csv=require(_0xd7c6('0xa'));var ejs=require(_0xd7c6('0xb'));var fs=require('fs');var _=require(_0xd7c6('0xc'));var squel=require(_0xd7c6('0xd'));var crypto=require(_0xd7c6('0xe'));var jsforce=require(_0xd7c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd7c6('0xa'));var querystring=require('querystring');var Papa=require(_0xd7c6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd7c6('0x11'));var logger=require(_0xd7c6('0x12'))(_0xd7c6('0x13'));var utils=require(_0xd7c6('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x584a1e,_0x47477d){_0x47477d=_0x47477d||0xcc;return function(_0x5dcafa){if(_0x5dcafa){return _0x584a1e[_0xd7c6('0x15')](_0x47477d);}return _0x584a1e[_0xd7c6('0x16')](_0x47477d)[_0xd7c6('0x17')]();};}function respondWithResult(_0x6d0ff8,_0x5b34db){_0x5b34db=_0x5b34db||0xc8;return function(_0x435a9d){if(_0x435a9d){return _0x6d0ff8['status'](_0x5b34db)[_0xd7c6('0x18')](_0x435a9d);}};}function respondWithFilteredResult(_0x24fa68,_0x42f27c){return function(_0x48cbef){if(_0x48cbef){var _0x1fa0bc=_0x48cbef[_0xd7c6('0x19')],_0x306933=_0x42f27c[_0xd7c6('0x1a')],_0x31f6f0=_0x42f27c[_0xd7c6('0x1a')]+_0x42f27c[_0xd7c6('0x1b')],_0x2abffb;if(_0x31f6f0>=_0x1fa0bc){_0x31f6f0=_0x1fa0bc;_0x2abffb=0xc8;}else{_0x2abffb=0xce;}_0x24fa68['status'](_0x2abffb);return _0x24fa68[_0xd7c6('0x1c')]('Content-Range',_0x306933+'-'+_0x31f6f0+'/'+_0x1fa0bc)[_0xd7c6('0x18')](_0x48cbef);}return null;};}function patchUpdates(_0x531dc4){return function(_0x1c3d57){try{jsonpatch[_0xd7c6('0x1d')](_0x1c3d57,_0x531dc4,!![]);}catch(_0x410253){return BPromise[_0xd7c6('0x1e')](_0x410253);}return _0x1c3d57[_0xd7c6('0x1f')]();};}function saveUpdates(_0x14aa1b,_0x1868b0){return function(_0x5d3438){if(_0x5d3438){return _0x5d3438[_0xd7c6('0x20')](_0x14aa1b)[_0xd7c6('0x21')](function(_0x1244dc){return _0x1244dc;});}return null;};}function removeEntity(_0x3615c0,_0x1d1ba2){return function(_0x5a91d0){if(_0x5a91d0){return _0x5a91d0[_0xd7c6('0x22')]()[_0xd7c6('0x21')](function(){_0x3615c0[_0xd7c6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df69c,_0x4f7740){return function(_0x163674){if(!_0x163674){_0x3df69c[_0xd7c6('0x15')](0x194);}return _0x163674;};}function handleError(_0x40ab5e,_0x2cf3a4){_0x2cf3a4=_0x2cf3a4||0x1f4;return function(_0x32dca5){logger['error'](_0x32dca5[_0xd7c6('0x23')]);if(_0x32dca5['name']){delete _0x32dca5[_0xd7c6('0x24')];}_0x40ab5e[_0xd7c6('0x16')](_0x2cf3a4)[_0xd7c6('0x25')](_0x32dca5);};}exports['index']=function(_0x56bb8e,_0x552c19){var _0x54740b={},_0x1bdd81={},_0x1e895e={'count':0x0,'rows':[]};var _0x526697=db['CrmTask'][_0xd7c6('0x26')];_0x1bdd81[_0xd7c6('0x27')]=_['keys'](_0x526697);_0x1bdd81[_0xd7c6('0x28')]=_[_0xd7c6('0x29')](_0x56bb8e[_0xd7c6('0x28')]);_0x1bdd81['filters']=_[_0xd7c6('0x2a')](_0x1bdd81[_0xd7c6('0x27')],_0x1bdd81[_0xd7c6('0x28')]);_0x54740b[_0xd7c6('0x2b')]=_[_0xd7c6('0x2a')](_0x1bdd81[_0xd7c6('0x27')],qs[_0xd7c6('0x2c')](_0x56bb8e[_0xd7c6('0x28')][_0xd7c6('0x2c')]));_0x54740b[_0xd7c6('0x2b')]=_0x54740b[_0xd7c6('0x2b')][_0xd7c6('0x2d')]?_0x54740b[_0xd7c6('0x2b')]:_0x1bdd81[_0xd7c6('0x27')];if(!_0x56bb8e[_0xd7c6('0x28')][_0xd7c6('0x2e')](_0xd7c6('0x2f'))){_0x54740b[_0xd7c6('0x1b')]=qs['limit'](_0x56bb8e[_0xd7c6('0x28')][_0xd7c6('0x1b')]);_0x54740b[_0xd7c6('0x1a')]=qs[_0xd7c6('0x1a')](_0x56bb8e['query'][_0xd7c6('0x1a')]);}_0x54740b[_0xd7c6('0x30')]=qs[_0xd7c6('0x31')](_0x56bb8e[_0xd7c6('0x28')][_0xd7c6('0x31')]);_0x54740b['where']=qs[_0xd7c6('0x32')](_[_0xd7c6('0x33')](_0x56bb8e[_0xd7c6('0x28')],_0x1bdd81[_0xd7c6('0x32')]));if(_0x56bb8e['query'][_0xd7c6('0x34')]){_0x54740b[_0xd7c6('0x35')]=_[_0xd7c6('0x36')](_0x54740b[_0xd7c6('0x35')],{'$or':_[_0xd7c6('0x37')](_0x526697,function(_0x38468c){if(_0x38468c['type'][_0xd7c6('0x38')]!==_0xd7c6('0x39')){var _0x4fd7d5={};_0x4fd7d5[_0x38468c[_0xd7c6('0x3a')]]={'$like':'%'+_0x56bb8e['query'][_0xd7c6('0x34')]+'%'};return _0x4fd7d5;}})});}_0x54740b=_[_0xd7c6('0x36')]({},_0x54740b,_0x56bb8e[_0xd7c6('0x3b')]);var _0x23e0f7={'where':_0x54740b['where']};return db[_0xd7c6('0x3c')][_0xd7c6('0x19')](_0x23e0f7)[_0xd7c6('0x21')](function(_0x1beee6){_0x1e895e[_0xd7c6('0x19')]=_0x1beee6;if(_0x56bb8e[_0xd7c6('0x28')][_0xd7c6('0x3d')]){_0x54740b[_0xd7c6('0x3e')]=[{'all':!![]}];}return db[_0xd7c6('0x3c')][_0xd7c6('0x3f')](_0x54740b);})[_0xd7c6('0x21')](function(_0x15ef95){_0x1e895e[_0xd7c6('0x40')]=_0x15ef95;return _0x1e895e;})[_0xd7c6('0x21')](respondWithFilteredResult(_0x552c19,_0x54740b))['catch'](handleError(_0x552c19,null));};exports['show']=function(_0x1a4c18,_0x408142){var _0x288ea4={'raw':![],'where':{'id':_0x1a4c18[_0xd7c6('0x41')]['id']}},_0x12b741={};_0x12b741[_0xd7c6('0x27')]=_['keys'](db['CrmTask'][_0xd7c6('0x26')]);_0x12b741['query']=_[_0xd7c6('0x29')](_0x1a4c18[_0xd7c6('0x28')]);_0x12b741[_0xd7c6('0x32')]=_[_0xd7c6('0x2a')](_0x12b741[_0xd7c6('0x27')],_0x12b741[_0xd7c6('0x28')]);_0x288ea4[_0xd7c6('0x2b')]=_[_0xd7c6('0x2a')](_0x12b741[_0xd7c6('0x27')],qs['fields'](_0x1a4c18[_0xd7c6('0x28')][_0xd7c6('0x2c')]));_0x288ea4[_0xd7c6('0x2b')]=_0x288ea4[_0xd7c6('0x2b')][_0xd7c6('0x2d')]?_0x288ea4[_0xd7c6('0x2b')]:_0x12b741['model'];if(_0x1a4c18[_0xd7c6('0x28')][_0xd7c6('0x3d')]){_0x288ea4[_0xd7c6('0x3e')]=[{'all':!![]}];}_0x288ea4=_[_0xd7c6('0x36')]({},_0x288ea4,_0x1a4c18[_0xd7c6('0x3b')]);return db['CrmTask'][_0xd7c6('0x42')](_0x288ea4)['then'](handleEntityNotFound(_0x408142,null))[_0xd7c6('0x21')](respondWithResult(_0x408142,null))[_0xd7c6('0x43')](handleError(_0x408142,null));};exports[_0xd7c6('0x44')]=function(_0x5bd7a9,_0x3d1ebd){return db[_0xd7c6('0x3c')]['create'](_0x5bd7a9[_0xd7c6('0x45')],{})[_0xd7c6('0x21')](respondWithResult(_0x3d1ebd,0xc9))[_0xd7c6('0x43')](handleError(_0x3d1ebd,null));};exports[_0xd7c6('0x20')]=function(_0x5117b1,_0x4d3583){if(_0x5117b1[_0xd7c6('0x45')]['id']){delete _0x5117b1[_0xd7c6('0x45')]['id'];}return db['CrmTask'][_0xd7c6('0x42')]({'where':{'id':_0x5117b1[_0xd7c6('0x41')]['id']}})[_0xd7c6('0x21')](handleEntityNotFound(_0x4d3583,null))['then'](saveUpdates(_0x5117b1['body'],null))[_0xd7c6('0x21')](respondWithResult(_0x4d3583,null))[_0xd7c6('0x43')](handleError(_0x4d3583,null));};exports[_0xd7c6('0x22')]=function(_0x2c7d82,_0x2f54ba){return db[_0xd7c6('0x3c')][_0xd7c6('0x42')]({'where':{'id':_0x2c7d82[_0xd7c6('0x41')]['id']}})[_0xd7c6('0x21')](handleEntityNotFound(_0x2f54ba,null))[_0xd7c6('0x21')](removeEntity(_0x2f54ba,null))['catch'](handleError(_0x2f54ba,null));};exports[_0xd7c6('0x46')]=function(_0x162f48,_0x16d889){return db['CrmTask'][_0xd7c6('0x46')]()[_0xd7c6('0x21')](respondWithResult(_0x16d889,null))[_0xd7c6('0x43')](handleError(_0x16d889,null));}; \ No newline at end of file diff --git a/server/api/crmTask/crmTask.model.js b/server/api/crmTask/crmTask.model.js index 931e734..a385dc9 100644 --- a/server/api/crmTask/crmTask.model.js +++ b/server/api/crmTask/crmTask.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['bluebird','path','./crmTask.attributes','exports','CrmTask','crm_tasks','util','../../config/logger','api'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x91a7,0xe7));var _0x791a=function(_0x222dc1,_0x492f36){_0x222dc1=_0x222dc1-0x0;var _0x541d30=_0x91a7[_0x222dc1];return _0x541d30;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./crmTask.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf339,_0x15d06f){var _0xabc1d1=function(_0x4489c0){while(--_0x4489c0){_0xf339['push'](_0xf339['shift']());}};_0xabc1d1(++_0x15d06f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0xb4e6[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('CrmTask',attributes,{'tableName':'crm_tasks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/crmTask/crmTask.rpc.js b/server/api/crmTask/crmTask.rpc.js index 2b2d743..8c923fe 100644 --- a/server/api/crmTask/crmTask.rpc.js +++ b/server/api/crmTask/crmTask.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02b9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CrmTask,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x44d9c2,_0x3912c3){var _0x4ce380=function(_0x1c2013){while(--_0x1c2013){_0x44d9c2['push'](_0x44d9c2['shift']());}};_0x4ce380(++_0x3912c3);}(_0x02b9,0xa4));var _0x902b=function(_0x3bcd56,_0x1dcd62){_0x3bcd56=_0x3bcd56-0x0;var _0x3097e1=_0x02b9[_0x3bcd56];return _0x3097e1;};'use strict';var _=require(_0x902b('0x0'));var util=require(_0x902b('0x1'));var moment=require(_0x902b('0x2'));var BPromise=require(_0x902b('0x3'));var rs=require(_0x902b('0x4'));var fs=require('fs');var Redis=require(_0x902b('0x5'));var db=require(_0x902b('0x6'))['db'];var utils=require(_0x902b('0x7'));var logger=require(_0x902b('0x8'))('rpc');var config=require(_0x902b('0x9'));var jayson=require(_0x902b('0xa'));var client=jayson[_0x902b('0xb')][_0x902b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x506d87,_0x2bcbe6,_0xedca7d){return new BPromise(function(_0x4ea42a,_0x4d523b){return client[_0x902b('0xd')](_0x506d87,_0xedca7d)[_0x902b('0xe')](function(_0x1389d9){logger[_0x902b('0xf')](_0x902b('0x10'),_0x2bcbe6,_0x902b('0x11'));logger[_0x902b('0x12')]('CrmTask,\x20%s,\x20%s,\x20%s',_0x2bcbe6,'request\x20sent',JSON['stringify'](_0x1389d9));if(_0x1389d9[_0x902b('0x13')]){if(_0x1389d9[_0x902b('0x13')][_0x902b('0x14')]===0x1f4){logger['error'](_0x902b('0x10'),_0x2bcbe6,_0x1389d9[_0x902b('0x13')][_0x902b('0x15')]);return _0x4d523b(_0x1389d9[_0x902b('0x13')][_0x902b('0x15')]);}logger[_0x902b('0x13')](_0x902b('0x10'),_0x2bcbe6,_0x1389d9['error'][_0x902b('0x15')]);return _0x4ea42a(_0x1389d9[_0x902b('0x13')][_0x902b('0x15')]);}else{logger[_0x902b('0xf')](_0x902b('0x10'),_0x2bcbe6,'request\x20sent');_0x4ea42a(_0x1389d9[_0x902b('0x16')][_0x902b('0x15')]);}})[_0x902b('0x17')](function(_0x922348){logger[_0x902b('0x13')](_0x902b('0x10'),_0x2bcbe6,_0x922348);_0x4d523b(_0x922348);});});} \ No newline at end of file +var _0xa8b6=['message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CrmTask,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x385603,_0x1cf762){var _0x2e10ca=function(_0x1824c0){while(--_0x1824c0){_0x385603['push'](_0x385603['shift']());}};_0x2e10ca(++_0x1cf762);}(_0xa8b6,0x167));var _0x6a8b=function(_0x5e5873,_0x4af95b){_0x5e5873=_0x5e5873-0x0;var _0x296bba=_0xa8b6[_0x5e5873];return _0x296bba;};'use strict';var _=require(_0x6a8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a8b('0x1'));var rs=require(_0x6a8b('0x2'));var fs=require('fs');var Redis=require(_0x6a8b('0x3'));var db=require(_0x6a8b('0x4'))['db'];var utils=require(_0x6a8b('0x5'));var logger=require(_0x6a8b('0x6'))(_0x6a8b('0x7'));var config=require(_0x6a8b('0x8'));var jayson=require(_0x6a8b('0x9'));var client=jayson[_0x6a8b('0xa')][_0x6a8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc874fa,_0x1f0e82,_0x3b0d34){return new BPromise(function(_0x4c469e,_0x39493d){return client[_0x6a8b('0xc')](_0xc874fa,_0x3b0d34)[_0x6a8b('0xd')](function(_0x4c6513){logger[_0x6a8b('0xe')](_0x6a8b('0xf'),_0x1f0e82,_0x6a8b('0x10'));logger['debug']('CrmTask,\x20%s,\x20%s,\x20%s',_0x1f0e82,'request\x20sent',JSON[_0x6a8b('0x11')](_0x4c6513));if(_0x4c6513[_0x6a8b('0x12')]){if(_0x4c6513[_0x6a8b('0x12')]['code']===0x1f4){logger['error'](_0x6a8b('0xf'),_0x1f0e82,_0x4c6513[_0x6a8b('0x12')][_0x6a8b('0x13')]);return _0x39493d(_0x4c6513[_0x6a8b('0x12')][_0x6a8b('0x13')]);}logger[_0x6a8b('0x12')](_0x6a8b('0xf'),_0x1f0e82,_0x4c6513[_0x6a8b('0x12')][_0x6a8b('0x13')]);return _0x4c469e(_0x4c6513[_0x6a8b('0x12')][_0x6a8b('0x13')]);}else{logger[_0x6a8b('0xe')](_0x6a8b('0xf'),_0x1f0e82,_0x6a8b('0x10'));_0x4c469e(_0x4c6513['result']['message']);}})[_0x6a8b('0x14')](function(_0x36e081){logger[_0x6a8b('0x12')](_0x6a8b('0xf'),_0x1f0e82,_0x36e081);_0x39493d(_0x36e081);});});} \ No newline at end of file diff --git a/server/api/crmTask/index.js b/server/api/crmTask/index.js index bc08f34..9d3dfbf 100644 --- a/server/api/crmTask/index.js +++ b/server/api/crmTask/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4264=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./crmTask.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','exports','multer'];(function(_0x4d91c5,_0x3eb4cd){var _0x12020e=function(_0x73a373){while(--_0x73a373){_0x4d91c5['push'](_0x4d91c5['shift']());}};_0x12020e(++_0x3eb4cd);}(_0x4264,0x10d));var _0x4426=function(_0x4af8cc,_0x278fcb){_0x4af8cc=_0x4af8cc-0x0;var _0xd5eda3=_0x4264[_0x4af8cc];return _0xd5eda3;};'use strict';var multer=require(_0x4426('0x0'));var util=require(_0x4426('0x1'));var path=require(_0x4426('0x2'));var timeout=require(_0x4426('0x3'));var express=require('express');var router=express[_0x4426('0x4')]();var auth=require(_0x4426('0x5'));var interaction=require(_0x4426('0x6'));var config=require('../../config/environment');var controller=require(_0x4426('0x7'));router[_0x4426('0x8')]('/',auth[_0x4426('0x9')](),controller[_0x4426('0xa')]);router[_0x4426('0x8')](_0x4426('0xb'),auth[_0x4426('0x9')](),controller['describe']);router[_0x4426('0x8')]('/:id',auth[_0x4426('0x9')](),controller[_0x4426('0xc')]);router[_0x4426('0xd')]('/',auth['isAuthenticated'](),controller[_0x4426('0xe')]);router[_0x4426('0xf')]('/:id',auth[_0x4426('0x9')](),controller['update']);router['delete'](_0x4426('0x10'),auth[_0x4426('0x9')](),controller['destroy']);module[_0x4426('0x11')]=router; \ No newline at end of file +var _0x9d94=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./crmTask.controller','isAuthenticated','get','/describe','post','create','put','/:id','update','delete'];(function(_0x4f0a90,_0x482c40){var _0x4bafa6=function(_0xf9cc43){while(--_0xf9cc43){_0x4f0a90['push'](_0x4f0a90['shift']());}};_0x4bafa6(++_0x482c40);}(_0x9d94,0x1d4));var _0x49d9=function(_0x56748d,_0x596ca7){_0x56748d=_0x56748d-0x0;var _0x1b8b66=_0x9d94[_0x56748d];return _0x1b8b66;};'use strict';var multer=require(_0x49d9('0x0'));var util=require(_0x49d9('0x1'));var path=require(_0x49d9('0x2'));var timeout=require(_0x49d9('0x3'));var express=require(_0x49d9('0x4'));var router=express[_0x49d9('0x5')]();var auth=require(_0x49d9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x49d9('0x7'));var controller=require(_0x49d9('0x8'));router['get']('/',auth[_0x49d9('0x9')](),controller['index']);router[_0x49d9('0xa')](_0x49d9('0xb'),auth[_0x49d9('0x9')](),controller['describe']);router['get']('/:id',auth[_0x49d9('0x9')](),controller['show']);router[_0x49d9('0xc')]('/',auth[_0x49d9('0x9')](),controller[_0x49d9('0xd')]);router[_0x49d9('0xe')](_0x49d9('0xf'),auth['isAuthenticated'](),controller[_0x49d9('0x10')]);router[_0x49d9('0x11')](_0x49d9('0xf'),auth[_0x49d9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/crmWorkflow/crmWorkflow.attributes.js b/server/api/crmWorkflow/crmWorkflow.attributes.js index d2e38b8..5a05e5c 100644 --- a/server/api/crmWorkflow/crmWorkflow.attributes.js +++ b/server/api/crmWorkflow/crmWorkflow.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b5c=['Free','exports','STRING','name','CRM','SalesAid'];(function(_0x516b06,_0x471ab8){var _0xd64a90=function(_0x59bbbc){while(--_0x59bbbc){_0x516b06['push'](_0x516b06['shift']());}};_0xd64a90(++_0x471ab8);}(_0x3b5c,0x127));var _0xc3b5=function(_0x11ff41,_0x17d6ea){_0x11ff41=_0x11ff41-0x0;var _0xa82252=_0x3b5c[_0x11ff41];return _0xa82252;};'use strict';var Sequelize=require('sequelize');module[_0xc3b5('0x0')]={'name':{'type':Sequelize[_0xc3b5('0x1')],'allowNull':![],'unique':_0xc3b5('0x2')},'type':{'type':Sequelize['ENUM'](_0xc3b5('0x3'),_0xc3b5('0x4'),_0xc3b5('0x5')),'allowNull':![]}}; \ No newline at end of file +var _0xe5e1=['CRM','SalesAid','Free','sequelize','exports','STRING','name','ENUM'];(function(_0x358bf3,_0x40ec1f){var _0x248106=function(_0x2eb1f3){while(--_0x2eb1f3){_0x358bf3['push'](_0x358bf3['shift']());}};_0x248106(++_0x40ec1f);}(_0xe5e1,0x163));var _0x1e5e=function(_0x3044d5,_0x1ab3dd){_0x3044d5=_0x3044d5-0x0;var _0x1a8b07=_0xe5e1[_0x3044d5];return _0x1a8b07;};'use strict';var Sequelize=require(_0x1e5e('0x0'));module[_0x1e5e('0x1')]={'name':{'type':Sequelize[_0x1e5e('0x2')],'allowNull':![],'unique':_0x1e5e('0x3')},'type':{'type':Sequelize[_0x1e5e('0x4')](_0x1e5e('0x5'),_0x1e5e('0x6'),_0x1e5e('0x7')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/crmWorkflow/crmWorkflow.controller.js b/server/api/crmWorkflow/crmWorkflow.controller.js index 164ceff..533caeb 100644 --- a/server/api/crmWorkflow/crmWorkflow.controller.js +++ b/server/api/crmWorkflow/crmWorkflow.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81a5=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','update','then','error','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','key','VIRTUAL','field','options','CrmWorkflow','count','includeAll','include','CrmWorkflowStep','CrmActionsList','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x3e1bb0,_0x2d7583){var _0x5d7abe=function(_0x2315ec){while(--_0x2315ec){_0x3e1bb0['push'](_0x3e1bb0['shift']());}};_0x5d7abe(++_0x2d7583);}(_0x81a5,0x160));var _0x581a=function(_0x4804cd,_0x439c62){_0x4804cd=_0x4804cd-0x0;var _0x207ab9=_0x81a5[_0x4804cd];return _0x207ab9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x581a('0x0'));var rimraf=require(_0x581a('0x1'));var zipdir=require(_0x581a('0x2'));var jsonpatch=require(_0x581a('0x3'));var rp=require(_0x581a('0x4'));var moment=require('moment');var BPromise=require(_0x581a('0x5'));var Mustache=require(_0x581a('0x6'));var util=require(_0x581a('0x7'));var path=require(_0x581a('0x8'));var sox=require(_0x581a('0x9'));var csv=require(_0x581a('0xa'));var ejs=require(_0x581a('0xb'));var fs=require('fs');var _=require(_0x581a('0xc'));var squel=require(_0x581a('0xd'));var crypto=require(_0x581a('0xe'));var jsforce=require(_0x581a('0xf'));var deskjs=require(_0x581a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x581a('0x11'));var Papa=require(_0x581a('0x12'));var Redis=require(_0x581a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x581a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x581a('0x15'));var utils=require('../../config/utils');var config=require(_0x581a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40b4fe,_0x81c690){_0x81c690=_0x81c690||0xcc;return function(_0x54512f){if(_0x54512f){return _0x40b4fe[_0x581a('0x17')](_0x81c690);}return _0x40b4fe[_0x581a('0x18')](_0x81c690)[_0x581a('0x19')]();};}function respondWithResult(_0x40a209,_0xbf21b5){_0xbf21b5=_0xbf21b5||0xc8;return function(_0x24c806){if(_0x24c806){return _0x40a209[_0x581a('0x18')](_0xbf21b5)['json'](_0x24c806);}};}function respondWithFilteredResult(_0x25875f,_0x2ea684){return function(_0x775471){if(_0x775471){var _0x42e69b=_0x775471['count'],_0xd00130=_0x2ea684['offset'],_0x5cc953=_0x2ea684[_0x581a('0x1a')]+_0x2ea684[_0x581a('0x1b')],_0x2d97c5;if(_0x5cc953>=_0x42e69b){_0x5cc953=_0x42e69b;_0x2d97c5=0xc8;}else{_0x2d97c5=0xce;}_0x25875f[_0x581a('0x18')](_0x2d97c5);return _0x25875f[_0x581a('0x1c')](_0x581a('0x1d'),_0xd00130+'-'+_0x5cc953+'/'+_0x42e69b)[_0x581a('0x1e')](_0x775471);}return null;};}function patchUpdates(_0x3279b5){return function(_0x106ddd){try{jsonpatch['apply'](_0x106ddd,_0x3279b5,!![]);}catch(_0xf5a8e5){return BPromise[_0x581a('0x1f')](_0xf5a8e5);}return _0x106ddd['save']();};}function saveUpdates(_0x5cf62b,_0x35e5b8){return function(_0x280155){if(_0x280155){return _0x280155[_0x581a('0x20')](_0x5cf62b)[_0x581a('0x21')](function(_0x239a9a){return _0x239a9a;});}return null;};}function removeEntity(_0x57b32a,_0x153c6a){return function(_0x4dc156){if(_0x4dc156){return _0x4dc156['destroy']()['then'](function(){_0x57b32a[_0x581a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dabf0,_0x5e6648){return function(_0x45b9ba){if(!_0x45b9ba){_0x2dabf0['sendStatus'](0x194);}return _0x45b9ba;};}function handleError(_0x4c69c1,_0x40c406){_0x40c406=_0x40c406||0x1f4;return function(_0x52b1c2){logger[_0x581a('0x22')](_0x52b1c2['stack']);if(_0x52b1c2[_0x581a('0x23')]){delete _0x52b1c2[_0x581a('0x23')];}_0x4c69c1[_0x581a('0x18')](_0x40c406)[_0x581a('0x24')](_0x52b1c2);};}exports['index']=function(_0x210981,_0x22c572){var _0x5b7124={},_0x5b2a15={},_0x385a7d={'count':0x0,'rows':[]};var _0x54a400=db['CrmWorkflow'][_0x581a('0x25')];_0x5b2a15[_0x581a('0x26')]=_[_0x581a('0x27')](_0x54a400);_0x5b2a15['query']=_[_0x581a('0x27')](_0x210981[_0x581a('0x28')]);_0x5b2a15[_0x581a('0x29')]=_[_0x581a('0x2a')](_0x5b2a15['model'],_0x5b2a15['query']);_0x5b7124[_0x581a('0x2b')]=_[_0x581a('0x2a')](_0x5b2a15[_0x581a('0x26')],qs[_0x581a('0x2c')](_0x210981[_0x581a('0x28')][_0x581a('0x2c')]));_0x5b7124[_0x581a('0x2b')]=_0x5b7124[_0x581a('0x2b')][_0x581a('0x2d')]?_0x5b7124[_0x581a('0x2b')]:_0x5b2a15[_0x581a('0x26')];if(!_0x210981[_0x581a('0x28')]['hasOwnProperty'](_0x581a('0x2e'))){_0x5b7124['limit']=qs['limit'](_0x210981[_0x581a('0x28')]['limit']);_0x5b7124['offset']=qs[_0x581a('0x1a')](_0x210981['query'][_0x581a('0x1a')]);}_0x5b7124[_0x581a('0x2f')]=qs[_0x581a('0x30')](_0x210981[_0x581a('0x28')]['sort']);_0x5b7124[_0x581a('0x31')]=qs['filters'](_[_0x581a('0x32')](_0x210981[_0x581a('0x28')],_0x5b2a15['filters']));if(_0x210981[_0x581a('0x28')]['filter']){_0x5b7124[_0x581a('0x31')]=_[_0x581a('0x33')](_0x5b7124[_0x581a('0x31')],{'$or':_['map'](_0x54a400,function(_0x4e6767){if(_0x4e6767['type'][_0x581a('0x34')]!==_0x581a('0x35')){var _0x365589={};_0x365589[_0x4e6767[_0x581a('0x36')]]={'$like':'%'+_0x210981['query']['filter']+'%'};return _0x365589;}})});}_0x5b7124=_[_0x581a('0x33')]({},_0x5b7124,_0x210981[_0x581a('0x37')]);var _0x4333fd={'where':_0x5b7124[_0x581a('0x31')]};return db[_0x581a('0x38')][_0x581a('0x39')](_0x4333fd)['then'](function(_0x19b650){_0x385a7d[_0x581a('0x39')]=_0x19b650;if(_0x210981[_0x581a('0x28')][_0x581a('0x3a')]){_0x5b7124[_0x581a('0x3b')]=[{'model':db[_0x581a('0x3c')],'include':[{'model':db['CrmTask'],'include':[{'model':db[_0x581a('0x3d')]}]},{'model':db[_0x581a('0x3c')],'as':'CrmWorkflowNextStep','through':{'attributes':[]}}]}];}return db[_0x581a('0x38')][_0x581a('0x3e')](_0x5b7124);})[_0x581a('0x21')](function(_0x7517db){_0x385a7d[_0x581a('0x3f')]=_0x7517db;return _0x385a7d;})[_0x581a('0x21')](respondWithFilteredResult(_0x22c572,_0x5b7124))[_0x581a('0x40')](handleError(_0x22c572,null));};exports['show']=function(_0x118f31,_0x3490bf){var _0x5abda3={'raw':![],'where':{'id':_0x118f31[_0x581a('0x41')]['id']}},_0x41b2ea={};_0x41b2ea[_0x581a('0x26')]=_['keys'](db['CrmWorkflow']['rawAttributes']);_0x41b2ea[_0x581a('0x28')]=_['keys'](_0x118f31['query']);_0x41b2ea[_0x581a('0x29')]=_[_0x581a('0x2a')](_0x41b2ea['model'],_0x41b2ea['query']);_0x5abda3[_0x581a('0x2b')]=_['intersection'](_0x41b2ea[_0x581a('0x26')],qs[_0x581a('0x2c')](_0x118f31[_0x581a('0x28')][_0x581a('0x2c')]));_0x5abda3['attributes']=_0x5abda3['attributes'][_0x581a('0x2d')]?_0x5abda3[_0x581a('0x2b')]:_0x41b2ea[_0x581a('0x26')];if(_0x118f31[_0x581a('0x28')][_0x581a('0x3a')]){_0x5abda3[_0x581a('0x3b')]=[{'all':!![]}];}_0x5abda3=_[_0x581a('0x33')]({},_0x5abda3,_0x118f31[_0x581a('0x37')]);return db[_0x581a('0x38')][_0x581a('0x42')](_0x5abda3)[_0x581a('0x21')](handleEntityNotFound(_0x3490bf,null))[_0x581a('0x21')](respondWithResult(_0x3490bf,null))[_0x581a('0x40')](handleError(_0x3490bf,null));};exports[_0x581a('0x43')]=function(_0x4b1366,_0x3ba5d8){return db['CrmWorkflow'][_0x581a('0x43')](_0x4b1366['body'],{})[_0x581a('0x21')](respondWithResult(_0x3ba5d8,0xc9))[_0x581a('0x40')](handleError(_0x3ba5d8,null));};exports['update']=function(_0x3a24d2,_0x32bec1){if(_0x3a24d2['body']['id']){delete _0x3a24d2[_0x581a('0x44')]['id'];}return db[_0x581a('0x38')][_0x581a('0x42')]({'where':{'id':_0x3a24d2[_0x581a('0x41')]['id']}})[_0x581a('0x21')](handleEntityNotFound(_0x32bec1,null))[_0x581a('0x21')](saveUpdates(_0x3a24d2[_0x581a('0x44')],null))['then'](respondWithResult(_0x32bec1,null))['catch'](handleError(_0x32bec1,null));};exports[_0x581a('0x45')]=function(_0x211b24,_0xb62b8c){return db[_0x581a('0x38')][_0x581a('0x42')]({'where':{'id':_0x211b24[_0x581a('0x41')]['id']}})[_0x581a('0x21')](handleEntityNotFound(_0xb62b8c,null))[_0x581a('0x21')](removeEntity(_0xb62b8c,null))[_0x581a('0x40')](handleError(_0xb62b8c,null));};exports[_0x581a('0x46')]=function(_0x530ce8,_0x1c41a2){return db[_0x581a('0x38')]['describe']()[_0x581a('0x21')](respondWithResult(_0x1c41a2,null))[_0x581a('0x40')](handleError(_0x1c41a2,null));}; \ No newline at end of file +var _0x490c=['create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','CrmWorkflowStep','CrmActionsList','CrmWorkflowNextStep','CrmWorkflow','rows','catch','show','params','keys'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x490c,0x138));var _0xc490=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x490c[_0x1fafa5];return _0xcf08c9;};'use strict';var pdf=require(_0xc490('0x0'));var emlformat=require(_0xc490('0x1'));var rimraf=require(_0xc490('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc490('0x3'));var rp=require(_0xc490('0x4'));var moment=require(_0xc490('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc490('0x6'));var util=require('util');var path=require(_0xc490('0x7'));var sox=require('sox');var csv=require(_0xc490('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc490('0x9'));var squel=require(_0xc490('0xa'));var crypto=require('crypto');var jsforce=require(_0xc490('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc490('0x8'));var querystring=require(_0xc490('0xc'));var Papa=require(_0xc490('0xd'));var Redis=require(_0xc490('0xe'));var authService=require(_0xc490('0xf'));var qs=require(_0xc490('0x10'));var hardwareService=require(_0xc490('0x11'));var logger=require(_0xc490('0x12'))(_0xc490('0x13'));var utils=require('../../config/utils');var config=require(_0xc490('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22053a,_0x772b33){_0x772b33=_0x772b33||0xcc;return function(_0x1b7a5a){if(_0x1b7a5a){return _0x22053a['sendStatus'](_0x772b33);}return _0x22053a[_0xc490('0x15')](_0x772b33)[_0xc490('0x16')]();};}function respondWithResult(_0x84f2c0,_0x1f4056){_0x1f4056=_0x1f4056||0xc8;return function(_0x380286){if(_0x380286){return _0x84f2c0[_0xc490('0x15')](_0x1f4056)['json'](_0x380286);}};}function respondWithFilteredResult(_0xc3af1f,_0x183b8a){return function(_0x410cb9){if(_0x410cb9){var _0x5da06e=_0x410cb9[_0xc490('0x17')],_0x28d498=_0x183b8a[_0xc490('0x18')],_0x4e561c=_0x183b8a[_0xc490('0x18')]+_0x183b8a['limit'],_0x2c210d;if(_0x4e561c>=_0x5da06e){_0x4e561c=_0x5da06e;_0x2c210d=0xc8;}else{_0x2c210d=0xce;}_0xc3af1f[_0xc490('0x15')](_0x2c210d);return _0xc3af1f[_0xc490('0x19')](_0xc490('0x1a'),_0x28d498+'-'+_0x4e561c+'/'+_0x5da06e)[_0xc490('0x1b')](_0x410cb9);}return null;};}function patchUpdates(_0x46d8e9){return function(_0x3aa915){try{jsonpatch[_0xc490('0x1c')](_0x3aa915,_0x46d8e9,!![]);}catch(_0x52ce76){return BPromise[_0xc490('0x1d')](_0x52ce76);}return _0x3aa915[_0xc490('0x1e')]();};}function saveUpdates(_0x1632ad,_0x685bde){return function(_0x560c83){if(_0x560c83){return _0x560c83[_0xc490('0x1f')](_0x1632ad)[_0xc490('0x20')](function(_0x734c76){return _0x734c76;});}return null;};}function removeEntity(_0xf2ef5f,_0x13aade){return function(_0x27b4a0){if(_0x27b4a0){return _0x27b4a0[_0xc490('0x21')]()['then'](function(){_0xf2ef5f['status'](0xcc)[_0xc490('0x16')]();});}};}function handleEntityNotFound(_0x3d1827,_0x1716f6){return function(_0x23d31d){if(!_0x23d31d){_0x3d1827[_0xc490('0x22')](0x194);}return _0x23d31d;};}function handleError(_0x3103e7,_0x891a8a){_0x891a8a=_0x891a8a||0x1f4;return function(_0x387b82){logger[_0xc490('0x23')](_0x387b82[_0xc490('0x24')]);if(_0x387b82[_0xc490('0x25')]){delete _0x387b82['name'];}_0x3103e7[_0xc490('0x15')](_0x891a8a)[_0xc490('0x26')](_0x387b82);};}exports[_0xc490('0x27')]=function(_0x2332a0,_0x2bbd6a){var _0x5e4292={},_0x22b0a4={},_0x3a5306={'count':0x0,'rows':[]};var _0x4ec44d=db['CrmWorkflow'][_0xc490('0x28')];_0x22b0a4[_0xc490('0x29')]=_['keys'](_0x4ec44d);_0x22b0a4[_0xc490('0x2a')]=_['keys'](_0x2332a0[_0xc490('0x2a')]);_0x22b0a4['filters']=_[_0xc490('0x2b')](_0x22b0a4['model'],_0x22b0a4[_0xc490('0x2a')]);_0x5e4292[_0xc490('0x2c')]=_[_0xc490('0x2b')](_0x22b0a4[_0xc490('0x29')],qs[_0xc490('0x2d')](_0x2332a0['query']['fields']));_0x5e4292['attributes']=_0x5e4292[_0xc490('0x2c')][_0xc490('0x2e')]?_0x5e4292[_0xc490('0x2c')]:_0x22b0a4['model'];if(!_0x2332a0[_0xc490('0x2a')][_0xc490('0x2f')](_0xc490('0x30'))){_0x5e4292[_0xc490('0x31')]=qs[_0xc490('0x31')](_0x2332a0['query']['limit']);_0x5e4292[_0xc490('0x18')]=qs[_0xc490('0x18')](_0x2332a0[_0xc490('0x2a')][_0xc490('0x18')]);}_0x5e4292[_0xc490('0x32')]=qs[_0xc490('0x33')](_0x2332a0['query'][_0xc490('0x33')]);_0x5e4292[_0xc490('0x34')]=qs[_0xc490('0x35')](_[_0xc490('0x36')](_0x2332a0['query'],_0x22b0a4[_0xc490('0x35')]));if(_0x2332a0[_0xc490('0x2a')][_0xc490('0x37')]){_0x5e4292[_0xc490('0x34')]=_[_0xc490('0x38')](_0x5e4292[_0xc490('0x34')],{'$or':_['map'](_0x4ec44d,function(_0x4a10d8){if(_0x4a10d8[_0xc490('0x39')][_0xc490('0x3a')]!==_0xc490('0x3b')){var _0x297618={};_0x297618[_0x4a10d8[_0xc490('0x3c')]]={'$like':'%'+_0x2332a0[_0xc490('0x2a')][_0xc490('0x37')]+'%'};return _0x297618;}})});}_0x5e4292=_[_0xc490('0x38')]({},_0x5e4292,_0x2332a0[_0xc490('0x3d')]);var _0x255eeb={'where':_0x5e4292[_0xc490('0x34')]};return db['CrmWorkflow'][_0xc490('0x17')](_0x255eeb)[_0xc490('0x20')](function(_0xaff897){_0x3a5306[_0xc490('0x17')]=_0xaff897;if(_0x2332a0['query'][_0xc490('0x3e')]){_0x5e4292[_0xc490('0x3f')]=[{'model':db[_0xc490('0x40')],'include':[{'model':db['CrmTask'],'include':[{'model':db[_0xc490('0x41')]}]},{'model':db[_0xc490('0x40')],'as':_0xc490('0x42'),'through':{'attributes':[]}}]}];}return db[_0xc490('0x43')]['findAll'](_0x5e4292);})['then'](function(_0x9b5a1a){_0x3a5306[_0xc490('0x44')]=_0x9b5a1a;return _0x3a5306;})[_0xc490('0x20')](respondWithFilteredResult(_0x2bbd6a,_0x5e4292))[_0xc490('0x45')](handleError(_0x2bbd6a,null));};exports[_0xc490('0x46')]=function(_0x4f4d36,_0x5cfe60){var _0x33562b={'raw':![],'where':{'id':_0x4f4d36[_0xc490('0x47')]['id']}},_0x1acbd8={};_0x1acbd8[_0xc490('0x29')]=_[_0xc490('0x48')](db[_0xc490('0x43')]['rawAttributes']);_0x1acbd8[_0xc490('0x2a')]=_[_0xc490('0x48')](_0x4f4d36[_0xc490('0x2a')]);_0x1acbd8[_0xc490('0x35')]=_[_0xc490('0x2b')](_0x1acbd8[_0xc490('0x29')],_0x1acbd8[_0xc490('0x2a')]);_0x33562b[_0xc490('0x2c')]=_[_0xc490('0x2b')](_0x1acbd8[_0xc490('0x29')],qs[_0xc490('0x2d')](_0x4f4d36[_0xc490('0x2a')][_0xc490('0x2d')]));_0x33562b[_0xc490('0x2c')]=_0x33562b['attributes'][_0xc490('0x2e')]?_0x33562b['attributes']:_0x1acbd8[_0xc490('0x29')];if(_0x4f4d36[_0xc490('0x2a')][_0xc490('0x3e')]){_0x33562b[_0xc490('0x3f')]=[{'all':!![]}];}_0x33562b=_[_0xc490('0x38')]({},_0x33562b,_0x4f4d36[_0xc490('0x3d')]);return db[_0xc490('0x43')]['find'](_0x33562b)[_0xc490('0x20')](handleEntityNotFound(_0x5cfe60,null))[_0xc490('0x20')](respondWithResult(_0x5cfe60,null))['catch'](handleError(_0x5cfe60,null));};exports[_0xc490('0x49')]=function(_0x156f44,_0x53d83a){return db[_0xc490('0x43')]['create'](_0x156f44['body'],{})[_0xc490('0x20')](respondWithResult(_0x53d83a,0xc9))[_0xc490('0x45')](handleError(_0x53d83a,null));};exports['update']=function(_0x226214,_0x58706d){if(_0x226214['body']['id']){delete _0x226214[_0xc490('0x4a')]['id'];}return db[_0xc490('0x43')][_0xc490('0x4b')]({'where':{'id':_0x226214[_0xc490('0x47')]['id']}})['then'](handleEntityNotFound(_0x58706d,null))[_0xc490('0x20')](saveUpdates(_0x226214[_0xc490('0x4a')],null))[_0xc490('0x20')](respondWithResult(_0x58706d,null))[_0xc490('0x45')](handleError(_0x58706d,null));};exports[_0xc490('0x21')]=function(_0x4ff8b8,_0x125a71){return db[_0xc490('0x43')][_0xc490('0x4b')]({'where':{'id':_0x4ff8b8['params']['id']}})['then'](handleEntityNotFound(_0x125a71,null))[_0xc490('0x20')](removeEntity(_0x125a71,null))[_0xc490('0x45')](handleError(_0x125a71,null));};exports[_0xc490('0x4c')]=function(_0x54bb31,_0x46966f){return db[_0xc490('0x43')]['describe']()[_0xc490('0x20')](respondWithResult(_0x46966f,null))[_0xc490('0x45')](handleError(_0x46966f,null));}; \ No newline at end of file diff --git a/server/api/crmWorkflow/crmWorkflow.model.js b/server/api/crmWorkflow/crmWorkflow.model.js index 5607ae1..e79ce9e 100644 --- a/server/api/crmWorkflow/crmWorkflow.model.js +++ b/server/api/crmWorkflow/crmWorkflow.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94fb=['CrmWorkflow','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./crmWorkflow.attributes','exports'];(function(_0x4c1a89,_0x275b1c){var _0x5eccd0=function(_0x445cf6){while(--_0x445cf6){_0x4c1a89['push'](_0x4c1a89['shift']());}};_0x5eccd0(++_0x275b1c);}(_0x94fb,0xdd));var _0xb94f=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x94fb[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0xb94f('0x0'));var util=require(_0xb94f('0x1'));var logger=require(_0xb94f('0x2'))(_0xb94f('0x3'));var moment=require(_0xb94f('0x4'));var BPromise=require(_0xb94f('0x5'));var rp=require(_0xb94f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb94f('0x7'));var attributes=require(_0xb94f('0x8'));module[_0xb94f('0x9')]=function(_0x198180,_0xf7a9a7){return _0x198180['define'](_0xb94f('0xa'),attributes,{'tableName':'crm_workflows','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a22=['api','moment','bluebird','path','rimraf','../../config/environment','./crmWorkflow.attributes','define','CrmWorkflow','crm_workflows','lodash','util','../../config/logger'];(function(_0x20a590,_0x1e8a6d){var _0x2e1b41=function(_0x48359f){while(--_0x48359f){_0x20a590['push'](_0x20a590['shift']());}};_0x2e1b41(++_0x1e8a6d);}(_0x0a22,0x1eb));var _0x20a2=function(_0x437f53,_0x185bd5){_0x437f53=_0x437f53-0x0;var _0x30c188=_0x0a22[_0x437f53];return _0x30c188;};'use strict';var _=require(_0x20a2('0x0'));var util=require(_0x20a2('0x1'));var logger=require(_0x20a2('0x2'))(_0x20a2('0x3'));var moment=require(_0x20a2('0x4'));var BPromise=require(_0x20a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a2('0x6'));var rimraf=require(_0x20a2('0x7'));var config=require(_0x20a2('0x8'));var attributes=require(_0x20a2('0x9'));module['exports']=function(_0x4804f5,_0x3eeda2){return _0x4804f5[_0x20a2('0xa')](_0x20a2('0xb'),attributes,{'tableName':_0x20a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/crmWorkflow/crmWorkflow.rpc.js b/server/api/crmWorkflow/crmWorkflow.rpc.js index a434ee8..3bcb3e6 100644 --- a/server/api/crmWorkflow/crmWorkflow.rpc.js +++ b/server/api/crmWorkflow/crmWorkflow.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bb4=['../../config/environment','client','http','request','then','CrmWorkflow,\x20%s,\x20%s','request\x20sent','debug','CrmWorkflow,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x50ae4f,_0xad32ed){var _0xf610aa=function(_0x47c089){while(--_0x47c089){_0x50ae4f['push'](_0x50ae4f['shift']());}};_0xf610aa(++_0xad32ed);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x137473,_0x30650b){_0x137473=_0x137473-0x0;var _0x2680a6=_0x1bb4[_0x137473];return _0x2680a6;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var moment=require(_0x41bb('0x2'));var BPromise=require(_0x41bb('0x3'));var rs=require(_0x41bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41bb('0x6'))('rpc');var config=require(_0x41bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41bb('0x8')][_0x41bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a2bfc,_0x492edd,_0xbaf7dc){return new BPromise(function(_0x3dc644,_0x4af8b1){return client[_0x41bb('0xa')](_0x1a2bfc,_0xbaf7dc)[_0x41bb('0xb')](function(_0x2ee5b8){logger['info'](_0x41bb('0xc'),_0x492edd,_0x41bb('0xd'));logger[_0x41bb('0xe')](_0x41bb('0xf'),_0x492edd,_0x41bb('0xd'),JSON['stringify'](_0x2ee5b8));if(_0x2ee5b8[_0x41bb('0x10')]){if(_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x11')]===0x1f4){logger[_0x41bb('0x10')](_0x41bb('0xc'),_0x492edd,_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x12')]);return _0x4af8b1(_0x2ee5b8[_0x41bb('0x10')]['message']);}logger['error']('CrmWorkflow,\x20%s,\x20%s',_0x492edd,_0x2ee5b8[_0x41bb('0x10')][_0x41bb('0x12')]);return _0x3dc644(_0x2ee5b8[_0x41bb('0x10')]['message']);}else{logger['info'](_0x41bb('0xc'),_0x492edd,_0x41bb('0xd'));_0x3dc644(_0x2ee5b8[_0x41bb('0x13')][_0x41bb('0x12')]);}})[_0x41bb('0x14')](function(_0x4a1687){logger[_0x41bb('0x10')]('CrmWorkflow,\x20%s,\x20%s',_0x492edd,_0x4a1687);_0x4af8b1(_0x4a1687);});});} \ No newline at end of file +var _0xa93a=['rpc','../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','message','CrmWorkflow,\x20%s,\x20%s','info','catch','moment','ioredis','../../config/utils'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xa93a,0xb8));var _0xaa93=function(_0x323255,_0x1bb4bd){_0x323255=_0x323255-0x0;var _0x48664f=_0xa93a[_0x323255];return _0x48664f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa93('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa93('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa93('0x2'));var logger=require('../../config/logger')(_0xaa93('0x3'));var config=require(_0xaa93('0x4'));var jayson=require(_0xaa93('0x5'));var client=jayson[_0xaa93('0x6')][_0xaa93('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f3572,_0x353544,_0x28e972){return new BPromise(function(_0x5aa7f5,_0x2bb7a8){return client['request'](_0x4f3572,_0x28e972)[_0xaa93('0x8')](function(_0x53897){logger['info']('CrmWorkflow,\x20%s,\x20%s',_0x353544,'request\x20sent');logger[_0xaa93('0x9')]('CrmWorkflow,\x20%s,\x20%s,\x20%s',_0x353544,_0xaa93('0xa'),JSON[_0xaa93('0xb')](_0x53897));if(_0x53897[_0xaa93('0xc')]){if(_0x53897['error']['code']===0x1f4){logger[_0xaa93('0xc')]('CrmWorkflow,\x20%s,\x20%s',_0x353544,_0x53897[_0xaa93('0xc')]['message']);return _0x2bb7a8(_0x53897[_0xaa93('0xc')][_0xaa93('0xd')]);}logger[_0xaa93('0xc')](_0xaa93('0xe'),_0x353544,_0x53897[_0xaa93('0xc')]['message']);return _0x5aa7f5(_0x53897[_0xaa93('0xc')]['message']);}else{logger[_0xaa93('0xf')](_0xaa93('0xe'),_0x353544,'request\x20sent');_0x5aa7f5(_0x53897['result'][_0xaa93('0xd')]);}})[_0xaa93('0x10')](function(_0x1cc0bc){logger[_0xaa93('0xc')](_0xaa93('0xe'),_0x353544,_0x1cc0bc);_0x2bb7a8(_0x1cc0bc);});});} \ No newline at end of file diff --git a/server/api/crmWorkflow/index.js b/server/api/crmWorkflow/index.js index 18866f5..fe2d4f6 100644 --- a/server/api/crmWorkflow/index.js +++ b/server/api/crmWorkflow/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13b6=['show','post','create','put','update','/:id','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./crmWorkflow.controller','isAuthenticated','index','get'];(function(_0x24b29e,_0xaf0994){var _0xc8fc2=function(_0x4cca21){while(--_0x4cca21){_0x24b29e['push'](_0x24b29e['shift']());}};_0xc8fc2(++_0xaf0994);}(_0x13b6,0x97));var _0x613b=function(_0x5e9618,_0x20f279){_0x5e9618=_0x5e9618-0x0;var _0x17cfd7=_0x13b6[_0x5e9618];return _0x17cfd7;};'use strict';var multer=require(_0x613b('0x0'));var util=require('util');var path=require(_0x613b('0x1'));var timeout=require(_0x613b('0x2'));var express=require(_0x613b('0x3'));var router=express[_0x613b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x613b('0x5'));var config=require(_0x613b('0x6'));var controller=require(_0x613b('0x7'));router['get']('/',auth[_0x613b('0x8')](),controller[_0x613b('0x9')]);router[_0x613b('0xa')]('/describe',auth[_0x613b('0x8')](),controller['describe']);router[_0x613b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x613b('0xb')]);router[_0x613b('0xc')]('/',auth[_0x613b('0x8')](),controller[_0x613b('0xd')]);router[_0x613b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x613b('0xf')]);router['delete'](_0x613b('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x613b('0x11')]=router; \ No newline at end of file +var _0x0120=['./crmWorkflow.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x0120,0x6f));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};'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']('/describe',auth[_0x0012('0xb')](),controller[_0x0012('0xc')]);router[_0x0012('0xa')](_0x0012('0xd'),auth[_0x0012('0xb')](),controller['show']);router[_0x0012('0xe')]('/',auth[_0x0012('0xb')](),controller[_0x0012('0xf')]);router[_0x0012('0x10')]('/:id',auth[_0x0012('0xb')](),controller['update']);router[_0x0012('0x11')](_0x0012('0xd'),auth[_0x0012('0xb')](),controller[_0x0012('0x12')]);module[_0x0012('0x13')]=router; \ No newline at end of file diff --git a/server/api/crmWorkflowstep/crmWorkflowstep.attributes.js b/server/api/crmWorkflowstep/crmWorkflowstep.attributes.js index 40cf918..77565b9 100644 --- a/server/api/crmWorkflowstep/crmWorkflowstep.attributes.js +++ b/server/api/crmWorkflowstep/crmWorkflowstep.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d83=['sequelize','STRING','name'];(function(_0x142cf8,_0x5e2ef1){var _0x575ff3=function(_0x295ed5){while(--_0x295ed5){_0x142cf8['push'](_0x142cf8['shift']());}};_0x575ff3(++_0x5e2ef1);}(_0x0d83,0x15f));var _0x30d8=function(_0x38799f,_0x58a8f4){_0x38799f=_0x38799f-0x0;var _0x3b21c1=_0x0d83[_0x38799f];return _0x3b21c1;};'use strict';var Sequelize=require(_0x30d8('0x0'));module['exports']={'name':{'type':Sequelize[_0x30d8('0x1')],'allowNull':![],'unique':_0x30d8('0x2')}}; \ No newline at end of file +var _0xda5c=['STRING','exports'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xda5c,0xb7));var _0xcda5=function(_0x52a40e,_0x591c17){_0x52a40e=_0x52a40e-0x0;var _0x1c0b00=_0xda5c[_0x52a40e];return _0x1c0b00;};'use strict';var Sequelize=require('sequelize');module[_0xcda5('0x0')]={'name':{'type':Sequelize[_0xcda5('0x1')],'allowNull':![],'unique':'name'}}; \ No newline at end of file diff --git a/server/api/crmWorkflowstep/crmWorkflowstep.controller.js b/server/api/crmWorkflowstep/crmWorkflowstep.controller.js index 53ee9dc..94a37e6 100644 --- a/server/api/crmWorkflowstep/crmWorkflowstep.controller.js +++ b/server/api/crmWorkflowstep/crmWorkflowstep.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e95=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','CrmWorkflowStep','includeAll','include','rows','catch','show','params','create','body','find','addCrmWorkflowNextStep','ids','removeCrmWorkflowNextStep','getCrmWorkflowNextStep','findOne','length','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x109fee,_0x242405){var _0x416d7f=function(_0x547cb5){while(--_0x547cb5){_0x109fee['push'](_0x109fee['shift']());}};_0x416d7f(++_0x242405);}(_0x8e95,0xda));var _0x58e9=function(_0x5a0043,_0x1ba516){_0x5a0043=_0x5a0043-0x0;var _0x10f659=_0x8e95[_0x5a0043];return _0x10f659;};'use strict';var pdf=require(_0x58e9('0x0'));var emlformat=require(_0x58e9('0x1'));var rimraf=require(_0x58e9('0x2'));var zipdir=require(_0x58e9('0x3'));var jsonpatch=require(_0x58e9('0x4'));var rp=require(_0x58e9('0x5'));var moment=require(_0x58e9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x58e9('0x7'));var path=require(_0x58e9('0x8'));var sox=require(_0x58e9('0x9'));var csv=require(_0x58e9('0xa'));var ejs=require(_0x58e9('0xb'));var fs=require('fs');var _=require(_0x58e9('0xc'));var squel=require(_0x58e9('0xd'));var crypto=require(_0x58e9('0xe'));var jsforce=require(_0x58e9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x58e9('0xa'));var querystring=require(_0x58e9('0x10'));var Papa=require(_0x58e9('0x11'));var Redis=require('ioredis');var authService=require(_0x58e9('0x12'));var qs=require(_0x58e9('0x13'));var hardwareService=require(_0x58e9('0x14'));var logger=require('../../config/logger')(_0x58e9('0x15'));var utils=require(_0x58e9('0x16'));var config=require('../../config/environment');var db=require(_0x58e9('0x17'))['db'];function respondWithStatusCode(_0x4b5e8a,_0x9f06bb){_0x9f06bb=_0x9f06bb||0xcc;return function(_0x1fc4e2){if(_0x1fc4e2){return _0x4b5e8a[_0x58e9('0x18')](_0x9f06bb);}return _0x4b5e8a[_0x58e9('0x19')](_0x9f06bb)['end']();};}function respondWithResult(_0x5490b3,_0x87ec51){_0x87ec51=_0x87ec51||0xc8;return function(_0x5b7d47){if(_0x5b7d47){return _0x5490b3[_0x58e9('0x19')](_0x87ec51)[_0x58e9('0x1a')](_0x5b7d47);}};}function respondWithFilteredResult(_0x39abad,_0x2163de){return function(_0x1b7fe9){if(_0x1b7fe9){var _0x420eb2=_0x1b7fe9[_0x58e9('0x1b')],_0xe06064=_0x2163de[_0x58e9('0x1c')],_0x540cf5=_0x2163de[_0x58e9('0x1c')]+_0x2163de[_0x58e9('0x1d')],_0x1cf60c;if(_0x540cf5>=_0x420eb2){_0x540cf5=_0x420eb2;_0x1cf60c=0xc8;}else{_0x1cf60c=0xce;}_0x39abad[_0x58e9('0x19')](_0x1cf60c);return _0x39abad[_0x58e9('0x1e')](_0x58e9('0x1f'),_0xe06064+'-'+_0x540cf5+'/'+_0x420eb2)[_0x58e9('0x1a')](_0x1b7fe9);}return null;};}function patchUpdates(_0x404bc2){return function(_0x4b85d1){try{jsonpatch[_0x58e9('0x20')](_0x4b85d1,_0x404bc2,!![]);}catch(_0x52d9cf){return BPromise['reject'](_0x52d9cf);}return _0x4b85d1['save']();};}function saveUpdates(_0x5ebb1f,_0x12bbce){return function(_0x1b0537){if(_0x1b0537){return _0x1b0537[_0x58e9('0x21')](_0x5ebb1f)[_0x58e9('0x22')](function(_0x22527b){return _0x22527b;});}return null;};}function removeEntity(_0x7911ba,_0x2ea2f8){return function(_0x19a027){if(_0x19a027){return _0x19a027[_0x58e9('0x23')]()['then'](function(){_0x7911ba[_0x58e9('0x19')](0xcc)[_0x58e9('0x24')]();});}};}function handleEntityNotFound(_0x36d814,_0x55fd53){return function(_0x4f751d){if(!_0x4f751d){_0x36d814[_0x58e9('0x18')](0x194);}return _0x4f751d;};}function handleError(_0x1d1aa9,_0x135ad3){_0x135ad3=_0x135ad3||0x1f4;return function(_0x1aa8b7){logger[_0x58e9('0x25')](_0x1aa8b7[_0x58e9('0x26')]);if(_0x1aa8b7[_0x58e9('0x27')]){delete _0x1aa8b7[_0x58e9('0x27')];}_0x1d1aa9['status'](_0x135ad3)['send'](_0x1aa8b7);};}exports[_0x58e9('0x28')]=function(_0x4f523d,_0x42373d){var _0x1d0a31={},_0x239f41={},_0xb25ad0={'count':0x0,'rows':[]};var _0x4e017a=db['CrmWorkflowStep'][_0x58e9('0x29')];_0x239f41[_0x58e9('0x2a')]=_['keys'](_0x4e017a);_0x239f41['query']=_[_0x58e9('0x2b')](_0x4f523d[_0x58e9('0x2c')]);_0x239f41[_0x58e9('0x2d')]=_[_0x58e9('0x2e')](_0x239f41[_0x58e9('0x2a')],_0x239f41[_0x58e9('0x2c')]);_0x1d0a31[_0x58e9('0x2f')]=_[_0x58e9('0x2e')](_0x239f41[_0x58e9('0x2a')],qs[_0x58e9('0x30')](_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x30')]));_0x1d0a31[_0x58e9('0x2f')]=_0x1d0a31[_0x58e9('0x2f')]['length']?_0x1d0a31[_0x58e9('0x2f')]:_0x239f41['model'];if(!_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x31')]('nolimit')){_0x1d0a31['limit']=qs[_0x58e9('0x1d')](_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x1d')]);_0x1d0a31[_0x58e9('0x1c')]=qs[_0x58e9('0x1c')](_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x1c')]);}_0x1d0a31[_0x58e9('0x32')]=qs[_0x58e9('0x33')](_0x4f523d['query'][_0x58e9('0x33')]);_0x1d0a31[_0x58e9('0x34')]=qs[_0x58e9('0x2d')](_[_0x58e9('0x35')](_0x4f523d[_0x58e9('0x2c')],_0x239f41['filters']));if(_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x36')]){_0x1d0a31[_0x58e9('0x34')]=_['merge'](_0x1d0a31[_0x58e9('0x34')],{'$or':_[_0x58e9('0x37')](_0x4e017a,function(_0x103dd6){if(_0x103dd6[_0x58e9('0x38')]['key']!==_0x58e9('0x39')){var _0x23f9f1={};_0x23f9f1[_0x103dd6[_0x58e9('0x3a')]]={'$like':'%'+_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x36')]+'%'};return _0x23f9f1;}})});}_0x1d0a31=_[_0x58e9('0x3b')]({},_0x1d0a31,_0x4f523d[_0x58e9('0x3c')]);var _0x336129={'where':_0x1d0a31[_0x58e9('0x34')]};return db[_0x58e9('0x3d')][_0x58e9('0x1b')](_0x336129)[_0x58e9('0x22')](function(_0x3411e6){_0xb25ad0[_0x58e9('0x1b')]=_0x3411e6;if(_0x4f523d[_0x58e9('0x2c')][_0x58e9('0x3e')]){_0x1d0a31[_0x58e9('0x3f')]=[{'all':!![]}];}return db[_0x58e9('0x3d')]['findAll'](_0x1d0a31);})[_0x58e9('0x22')](function(_0x15e8d3){_0xb25ad0[_0x58e9('0x40')]=_0x15e8d3;return _0xb25ad0;})[_0x58e9('0x22')](respondWithFilteredResult(_0x42373d,_0x1d0a31))[_0x58e9('0x41')](handleError(_0x42373d,null));};exports[_0x58e9('0x42')]=function(_0x39bc48,_0x45a32d){var _0x5e6f65={'raw':![],'where':{'id':_0x39bc48[_0x58e9('0x43')]['id']}},_0x157d47={};_0x157d47[_0x58e9('0x2a')]=_['keys'](db[_0x58e9('0x3d')][_0x58e9('0x29')]);_0x157d47[_0x58e9('0x2c')]=_[_0x58e9('0x2b')](_0x39bc48[_0x58e9('0x2c')]);_0x157d47['filters']=_[_0x58e9('0x2e')](_0x157d47['model'],_0x157d47[_0x58e9('0x2c')]);_0x5e6f65[_0x58e9('0x2f')]=_[_0x58e9('0x2e')](_0x157d47[_0x58e9('0x2a')],qs[_0x58e9('0x30')](_0x39bc48['query']['fields']));_0x5e6f65['attributes']=_0x5e6f65[_0x58e9('0x2f')]['length']?_0x5e6f65['attributes']:_0x157d47[_0x58e9('0x2a')];if(_0x39bc48[_0x58e9('0x2c')][_0x58e9('0x3e')]){_0x5e6f65[_0x58e9('0x3f')]=[{'all':!![]}];}_0x5e6f65=_[_0x58e9('0x3b')]({},_0x5e6f65,_0x39bc48[_0x58e9('0x3c')]);return db[_0x58e9('0x3d')]['find'](_0x5e6f65)[_0x58e9('0x22')](handleEntityNotFound(_0x45a32d,null))[_0x58e9('0x22')](respondWithResult(_0x45a32d,null))[_0x58e9('0x41')](handleError(_0x45a32d,null));};exports[_0x58e9('0x44')]=function(_0x403763,_0x522ed9){return db[_0x58e9('0x3d')][_0x58e9('0x44')](_0x403763['body'],{})[_0x58e9('0x22')](respondWithResult(_0x522ed9,0xc9))[_0x58e9('0x41')](handleError(_0x522ed9,null));};exports[_0x58e9('0x21')]=function(_0x21731e,_0x11ffca){if(_0x21731e[_0x58e9('0x45')]['id']){delete _0x21731e['body']['id'];}return db[_0x58e9('0x3d')][_0x58e9('0x46')]({'where':{'id':_0x21731e['params']['id']}})[_0x58e9('0x22')](handleEntityNotFound(_0x11ffca,null))[_0x58e9('0x22')](saveUpdates(_0x21731e[_0x58e9('0x45')],null))[_0x58e9('0x22')](respondWithResult(_0x11ffca,null))[_0x58e9('0x41')](handleError(_0x11ffca,null));};exports['destroy']=function(_0xa57553,_0xe98661){return db[_0x58e9('0x3d')]['find']({'where':{'id':_0xa57553[_0x58e9('0x43')]['id']}})['then'](handleEntityNotFound(_0xe98661,null))[_0x58e9('0x22')](removeEntity(_0xe98661,null))[_0x58e9('0x41')](handleError(_0xe98661,null));};exports['describe']=function(_0x2d39b0,_0x4eb286){return db[_0x58e9('0x3d')]['describe']()[_0x58e9('0x22')](respondWithResult(_0x4eb286,null))[_0x58e9('0x41')](handleError(_0x4eb286,null));};exports[_0x58e9('0x47')]=function(_0x30b3b7,_0x299a9b,_0x188692){return db[_0x58e9('0x3d')][_0x58e9('0x46')]({'where':{'id':_0x30b3b7['params']['id']}})[_0x58e9('0x22')](handleEntityNotFound(_0x299a9b,null))[_0x58e9('0x22')](function(_0x4783ac){if(_0x4783ac){return _0x4783ac[_0x58e9('0x47')](_0x30b3b7[_0x58e9('0x45')][_0x58e9('0x48')],_['omit'](_0x30b3b7[_0x58e9('0x45')],['ids','id'])||{});}})[_0x58e9('0x22')](respondWithResult(_0x299a9b,null))[_0x58e9('0x41')](handleError(_0x299a9b,null));};exports[_0x58e9('0x49')]=function(_0x142039,_0x32936c,_0x52af28){return db[_0x58e9('0x3d')][_0x58e9('0x46')]({'where':{'id':_0x142039[_0x58e9('0x43')]['id']}})[_0x58e9('0x22')](handleEntityNotFound(_0x32936c,null))['then'](function(_0xd550bd){if(_0xd550bd){return _0xd550bd[_0x58e9('0x49')](_0x142039[_0x58e9('0x2c')][_0x58e9('0x48')]);}})[_0x58e9('0x22')](respondWithStatusCode(_0x32936c,null))[_0x58e9('0x41')](handleError(_0x32936c,null));};exports[_0x58e9('0x4a')]=function(_0x27ceda,_0x201de0,_0x2c42d3){var _0x209f85={};var _0x4310ee={};var _0x1f1257;var _0x540726;return db[_0x58e9('0x3d')][_0x58e9('0x4b')]({'where':{'id':_0x27ceda[_0x58e9('0x43')]['id']}})[_0x58e9('0x22')](handleEntityNotFound(_0x201de0,null))[_0x58e9('0x22')](function(_0x331966){if(_0x331966){_0x1f1257=_0x331966;_0x4310ee[_0x58e9('0x2a')]=_[_0x58e9('0x2b')](db[_0x58e9('0x3d')][_0x58e9('0x29')]);_0x4310ee[_0x58e9('0x2c')]=_[_0x58e9('0x2b')](_0x27ceda[_0x58e9('0x2c')]);_0x4310ee[_0x58e9('0x2d')]=_['intersection'](_0x4310ee[_0x58e9('0x2a')],_0x4310ee['query']);_0x209f85[_0x58e9('0x2f')]=_[_0x58e9('0x2e')](_0x4310ee[_0x58e9('0x2a')],qs['fields'](_0x27ceda[_0x58e9('0x2c')][_0x58e9('0x30')]));_0x209f85[_0x58e9('0x2f')]=_0x209f85[_0x58e9('0x2f')][_0x58e9('0x4c')]?_0x209f85[_0x58e9('0x2f')]:_0x4310ee[_0x58e9('0x2a')];_0x209f85[_0x58e9('0x32')]=qs[_0x58e9('0x33')](_0x27ceda[_0x58e9('0x2c')][_0x58e9('0x33')]);_0x209f85[_0x58e9('0x34')]=qs[_0x58e9('0x2d')](_[_0x58e9('0x35')](_0x27ceda['query'],_0x4310ee[_0x58e9('0x2d')]));if(_0x27ceda[_0x58e9('0x2c')]['filter']){_0x209f85['where']=_[_0x58e9('0x3b')](_0x209f85[_0x58e9('0x34')],{'$or':_['map'](_0x209f85['attributes'],function(_0x14d123){var _0x5316bb={};_0x5316bb[_0x14d123]={'$like':'%'+_0x27ceda[_0x58e9('0x2c')]['filter']+'%'};return _0x5316bb;})});}_0x209f85=_['merge']({},_0x209f85,_0x27ceda['options']);return _0x1f1257[_0x58e9('0x4a')](_0x209f85);}})['then'](function(_0x88a522){if(_0x88a522){_0x540726=_0x88a522[_0x58e9('0x4c')];if(!_0x27ceda['query'][_0x58e9('0x31')](_0x58e9('0x4d'))){_0x209f85[_0x58e9('0x1d')]=qs[_0x58e9('0x1d')](_0x27ceda[_0x58e9('0x2c')][_0x58e9('0x1d')]);_0x209f85[_0x58e9('0x1c')]=qs[_0x58e9('0x1c')](_0x27ceda[_0x58e9('0x2c')][_0x58e9('0x1c')]);}return _0x1f1257[_0x58e9('0x4a')](_0x209f85);}})[_0x58e9('0x22')](function(_0x222a7b){if(_0x222a7b){return _0x222a7b?{'count':_0x540726,'rows':_0x222a7b}:null;}})[_0x58e9('0x22')](respondWithResult(_0x201de0,null))[_0x58e9('0x41')](handleError(_0x201de0,null));}; \ No newline at end of file +var _0xc6a7=['send','index','CrmWorkflowStep','keys','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','findAll','show','include','catch','create','body','params','describe','addCrmWorkflowNextStep','find','ids','omit','removeCrmWorkflowNextStep','getCrmWorkflowNextStep','findOne','rawAttributes','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xc6a7,0x161));var _0x7c6a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc6a7[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c6a('0x0'));var rimraf=require(_0x7c6a('0x1'));var zipdir=require(_0x7c6a('0x2'));var jsonpatch=require(_0x7c6a('0x3'));var rp=require(_0x7c6a('0x4'));var moment=require(_0x7c6a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c6a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7c6a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c6a('0x8'));var squel=require(_0x7c6a('0x9'));var crypto=require(_0x7c6a('0xa'));var jsforce=require(_0x7c6a('0xb'));var deskjs=require(_0x7c6a('0xc'));var toCsv=require(_0x7c6a('0xd'));var querystring=require(_0x7c6a('0xe'));var Papa=require(_0x7c6a('0xf'));var Redis=require(_0x7c6a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7c6a('0x11'));var hardwareService=require(_0x7c6a('0x12'));var logger=require('../../config/logger')(_0x7c6a('0x13'));var utils=require(_0x7c6a('0x14'));var config=require('../../config/environment');var db=require(_0x7c6a('0x15'))['db'];function respondWithStatusCode(_0x1585cf,_0x1da90b){_0x1da90b=_0x1da90b||0xcc;return function(_0x23ae7b){if(_0x23ae7b){return _0x1585cf[_0x7c6a('0x16')](_0x1da90b);}return _0x1585cf['status'](_0x1da90b)[_0x7c6a('0x17')]();};}function respondWithResult(_0x397c4d,_0x580752){_0x580752=_0x580752||0xc8;return function(_0x47dc60){if(_0x47dc60){return _0x397c4d[_0x7c6a('0x18')](_0x580752)[_0x7c6a('0x19')](_0x47dc60);}};}function respondWithFilteredResult(_0x1dd25a,_0x223c57){return function(_0x2c552e){if(_0x2c552e){var _0x1a33cb=_0x2c552e[_0x7c6a('0x1a')],_0x4f8552=_0x223c57[_0x7c6a('0x1b')],_0x5530ae=_0x223c57[_0x7c6a('0x1b')]+_0x223c57[_0x7c6a('0x1c')],_0x2af4af;if(_0x5530ae>=_0x1a33cb){_0x5530ae=_0x1a33cb;_0x2af4af=0xc8;}else{_0x2af4af=0xce;}_0x1dd25a[_0x7c6a('0x18')](_0x2af4af);return _0x1dd25a['set'](_0x7c6a('0x1d'),_0x4f8552+'-'+_0x5530ae+'/'+_0x1a33cb)[_0x7c6a('0x19')](_0x2c552e);}return null;};}function patchUpdates(_0xee2eb4){return function(_0x145a9e){try{jsonpatch['apply'](_0x145a9e,_0xee2eb4,!![]);}catch(_0x22f3c6){return BPromise[_0x7c6a('0x1e')](_0x22f3c6);}return _0x145a9e['save']();};}function saveUpdates(_0x9f0889,_0x3e135e){return function(_0x43c3ac){if(_0x43c3ac){return _0x43c3ac[_0x7c6a('0x1f')](_0x9f0889)[_0x7c6a('0x20')](function(_0x559e98){return _0x559e98;});}return null;};}function removeEntity(_0x1f6122,_0x47d277){return function(_0x4d290d){if(_0x4d290d){return _0x4d290d[_0x7c6a('0x21')]()[_0x7c6a('0x20')](function(){_0x1f6122[_0x7c6a('0x18')](0xcc)[_0x7c6a('0x17')]();});}};}function handleEntityNotFound(_0x294c14,_0x526e7a){return function(_0xeacbbd){if(!_0xeacbbd){_0x294c14[_0x7c6a('0x16')](0x194);}return _0xeacbbd;};}function handleError(_0x115a1f,_0x2c412e){_0x2c412e=_0x2c412e||0x1f4;return function(_0x50e6f8){logger[_0x7c6a('0x22')](_0x50e6f8[_0x7c6a('0x23')]);if(_0x50e6f8[_0x7c6a('0x24')]){delete _0x50e6f8[_0x7c6a('0x24')];}_0x115a1f[_0x7c6a('0x18')](_0x2c412e)[_0x7c6a('0x25')](_0x50e6f8);};}exports[_0x7c6a('0x26')]=function(_0x44d96b,_0x2ed1a1){var _0x781511={},_0xaed70e={},_0x10d0aa={'count':0x0,'rows':[]};var _0x5bc87d=db[_0x7c6a('0x27')]['rawAttributes'];_0xaed70e['model']=_[_0x7c6a('0x28')](_0x5bc87d);_0xaed70e[_0x7c6a('0x29')]=_['keys'](_0x44d96b[_0x7c6a('0x29')]);_0xaed70e['filters']=_[_0x7c6a('0x2a')](_0xaed70e['model'],_0xaed70e['query']);_0x781511[_0x7c6a('0x2b')]=_[_0x7c6a('0x2a')](_0xaed70e['model'],qs[_0x7c6a('0x2c')](_0x44d96b[_0x7c6a('0x29')]['fields']));_0x781511[_0x7c6a('0x2b')]=_0x781511['attributes'][_0x7c6a('0x2d')]?_0x781511[_0x7c6a('0x2b')]:_0xaed70e[_0x7c6a('0x2e')];if(!_0x44d96b['query'][_0x7c6a('0x2f')](_0x7c6a('0x30'))){_0x781511[_0x7c6a('0x1c')]=qs[_0x7c6a('0x1c')](_0x44d96b[_0x7c6a('0x29')][_0x7c6a('0x1c')]);_0x781511['offset']=qs[_0x7c6a('0x1b')](_0x44d96b[_0x7c6a('0x29')]['offset']);}_0x781511['order']=qs[_0x7c6a('0x31')](_0x44d96b['query'][_0x7c6a('0x31')]);_0x781511[_0x7c6a('0x32')]=qs[_0x7c6a('0x33')](_[_0x7c6a('0x34')](_0x44d96b[_0x7c6a('0x29')],_0xaed70e[_0x7c6a('0x33')]));if(_0x44d96b['query'][_0x7c6a('0x35')]){_0x781511[_0x7c6a('0x32')]=_[_0x7c6a('0x36')](_0x781511['where'],{'$or':_[_0x7c6a('0x37')](_0x5bc87d,function(_0x443119){if(_0x443119['type'][_0x7c6a('0x38')]!==_0x7c6a('0x39')){var _0x52790e={};_0x52790e[_0x443119[_0x7c6a('0x3a')]]={'$like':'%'+_0x44d96b[_0x7c6a('0x29')][_0x7c6a('0x35')]+'%'};return _0x52790e;}})});}_0x781511=_[_0x7c6a('0x36')]({},_0x781511,_0x44d96b[_0x7c6a('0x3b')]);var _0x4dcca4={'where':_0x781511['where']};return db[_0x7c6a('0x27')][_0x7c6a('0x1a')](_0x4dcca4)[_0x7c6a('0x20')](function(_0x43e1f2){_0x10d0aa[_0x7c6a('0x1a')]=_0x43e1f2;if(_0x44d96b[_0x7c6a('0x29')][_0x7c6a('0x3c')]){_0x781511['include']=[{'all':!![]}];}return db[_0x7c6a('0x27')][_0x7c6a('0x3d')](_0x781511);})[_0x7c6a('0x20')](function(_0x489c46){_0x10d0aa['rows']=_0x489c46;return _0x10d0aa;})[_0x7c6a('0x20')](respondWithFilteredResult(_0x2ed1a1,_0x781511))['catch'](handleError(_0x2ed1a1,null));};exports[_0x7c6a('0x3e')]=function(_0x5e1e3d,_0x1c5b84){var _0x303df0={'raw':![],'where':{'id':_0x5e1e3d['params']['id']}},_0x5922cb={};_0x5922cb[_0x7c6a('0x2e')]=_[_0x7c6a('0x28')](db['CrmWorkflowStep']['rawAttributes']);_0x5922cb[_0x7c6a('0x29')]=_['keys'](_0x5e1e3d[_0x7c6a('0x29')]);_0x5922cb[_0x7c6a('0x33')]=_[_0x7c6a('0x2a')](_0x5922cb['model'],_0x5922cb[_0x7c6a('0x29')]);_0x303df0[_0x7c6a('0x2b')]=_[_0x7c6a('0x2a')](_0x5922cb[_0x7c6a('0x2e')],qs[_0x7c6a('0x2c')](_0x5e1e3d['query']['fields']));_0x303df0[_0x7c6a('0x2b')]=_0x303df0['attributes'][_0x7c6a('0x2d')]?_0x303df0[_0x7c6a('0x2b')]:_0x5922cb['model'];if(_0x5e1e3d['query']['includeAll']){_0x303df0[_0x7c6a('0x3f')]=[{'all':!![]}];}_0x303df0=_[_0x7c6a('0x36')]({},_0x303df0,_0x5e1e3d['options']);return db[_0x7c6a('0x27')]['find'](_0x303df0)[_0x7c6a('0x20')](handleEntityNotFound(_0x1c5b84,null))[_0x7c6a('0x20')](respondWithResult(_0x1c5b84,null))[_0x7c6a('0x40')](handleError(_0x1c5b84,null));};exports['create']=function(_0x174d46,_0x338d2b){return db[_0x7c6a('0x27')][_0x7c6a('0x41')](_0x174d46[_0x7c6a('0x42')],{})[_0x7c6a('0x20')](respondWithResult(_0x338d2b,0xc9))[_0x7c6a('0x40')](handleError(_0x338d2b,null));};exports[_0x7c6a('0x1f')]=function(_0x7e55b0,_0x1eb075){if(_0x7e55b0[_0x7c6a('0x42')]['id']){delete _0x7e55b0[_0x7c6a('0x42')]['id'];}return db['CrmWorkflowStep']['find']({'where':{'id':_0x7e55b0[_0x7c6a('0x43')]['id']}})[_0x7c6a('0x20')](handleEntityNotFound(_0x1eb075,null))[_0x7c6a('0x20')](saveUpdates(_0x7e55b0[_0x7c6a('0x42')],null))[_0x7c6a('0x20')](respondWithResult(_0x1eb075,null))[_0x7c6a('0x40')](handleError(_0x1eb075,null));};exports[_0x7c6a('0x21')]=function(_0x4cf48e,_0x5c350c){return db[_0x7c6a('0x27')]['find']({'where':{'id':_0x4cf48e[_0x7c6a('0x43')]['id']}})[_0x7c6a('0x20')](handleEntityNotFound(_0x5c350c,null))[_0x7c6a('0x20')](removeEntity(_0x5c350c,null))[_0x7c6a('0x40')](handleError(_0x5c350c,null));};exports['describe']=function(_0x27d3c4,_0x3d6889){return db[_0x7c6a('0x27')][_0x7c6a('0x44')]()['then'](respondWithResult(_0x3d6889,null))[_0x7c6a('0x40')](handleError(_0x3d6889,null));};exports[_0x7c6a('0x45')]=function(_0x1d8f9f,_0x43bc83,_0x2c56ea){return db[_0x7c6a('0x27')][_0x7c6a('0x46')]({'where':{'id':_0x1d8f9f[_0x7c6a('0x43')]['id']}})[_0x7c6a('0x20')](handleEntityNotFound(_0x43bc83,null))[_0x7c6a('0x20')](function(_0x399904){if(_0x399904){return _0x399904[_0x7c6a('0x45')](_0x1d8f9f[_0x7c6a('0x42')][_0x7c6a('0x47')],_[_0x7c6a('0x48')](_0x1d8f9f['body'],[_0x7c6a('0x47'),'id'])||{});}})[_0x7c6a('0x20')](respondWithResult(_0x43bc83,null))[_0x7c6a('0x40')](handleError(_0x43bc83,null));};exports[_0x7c6a('0x49')]=function(_0x13dda8,_0x5d8aa1,_0x42068c){return db[_0x7c6a('0x27')]['find']({'where':{'id':_0x13dda8[_0x7c6a('0x43')]['id']}})[_0x7c6a('0x20')](handleEntityNotFound(_0x5d8aa1,null))[_0x7c6a('0x20')](function(_0x403fda){if(_0x403fda){return _0x403fda[_0x7c6a('0x49')](_0x13dda8['query'][_0x7c6a('0x47')]);}})[_0x7c6a('0x20')](respondWithStatusCode(_0x5d8aa1,null))[_0x7c6a('0x40')](handleError(_0x5d8aa1,null));};exports[_0x7c6a('0x4a')]=function(_0x263f37,_0x51543b,_0x3b2f69){var _0x370bc5={};var _0x64479b={};var _0x4a0cda;var _0x26f118;return db[_0x7c6a('0x27')][_0x7c6a('0x4b')]({'where':{'id':_0x263f37[_0x7c6a('0x43')]['id']}})[_0x7c6a('0x20')](handleEntityNotFound(_0x51543b,null))[_0x7c6a('0x20')](function(_0x1afbdd){if(_0x1afbdd){_0x4a0cda=_0x1afbdd;_0x64479b[_0x7c6a('0x2e')]=_['keys'](db[_0x7c6a('0x27')][_0x7c6a('0x4c')]);_0x64479b[_0x7c6a('0x29')]=_[_0x7c6a('0x28')](_0x263f37[_0x7c6a('0x29')]);_0x64479b[_0x7c6a('0x33')]=_[_0x7c6a('0x2a')](_0x64479b[_0x7c6a('0x2e')],_0x64479b['query']);_0x370bc5[_0x7c6a('0x2b')]=_[_0x7c6a('0x2a')](_0x64479b[_0x7c6a('0x2e')],qs[_0x7c6a('0x2c')](_0x263f37[_0x7c6a('0x29')][_0x7c6a('0x2c')]));_0x370bc5[_0x7c6a('0x2b')]=_0x370bc5[_0x7c6a('0x2b')][_0x7c6a('0x2d')]?_0x370bc5[_0x7c6a('0x2b')]:_0x64479b[_0x7c6a('0x2e')];_0x370bc5[_0x7c6a('0x4d')]=qs[_0x7c6a('0x31')](_0x263f37[_0x7c6a('0x29')]['sort']);_0x370bc5[_0x7c6a('0x32')]=qs[_0x7c6a('0x33')](_[_0x7c6a('0x34')](_0x263f37['query'],_0x64479b['filters']));if(_0x263f37[_0x7c6a('0x29')][_0x7c6a('0x35')]){_0x370bc5[_0x7c6a('0x32')]=_[_0x7c6a('0x36')](_0x370bc5['where'],{'$or':_[_0x7c6a('0x37')](_0x370bc5[_0x7c6a('0x2b')],function(_0x34e71b){var _0x144a37={};_0x144a37[_0x34e71b]={'$like':'%'+_0x263f37[_0x7c6a('0x29')][_0x7c6a('0x35')]+'%'};return _0x144a37;})});}_0x370bc5=_[_0x7c6a('0x36')]({},_0x370bc5,_0x263f37[_0x7c6a('0x3b')]);return _0x4a0cda[_0x7c6a('0x4a')](_0x370bc5);}})[_0x7c6a('0x20')](function(_0xc4cd7d){if(_0xc4cd7d){_0x26f118=_0xc4cd7d[_0x7c6a('0x2d')];if(!_0x263f37[_0x7c6a('0x29')][_0x7c6a('0x2f')]('nolimit')){_0x370bc5[_0x7c6a('0x1c')]=qs['limit'](_0x263f37[_0x7c6a('0x29')][_0x7c6a('0x1c')]);_0x370bc5[_0x7c6a('0x1b')]=qs[_0x7c6a('0x1b')](_0x263f37['query'][_0x7c6a('0x1b')]);}return _0x4a0cda['getCrmWorkflowNextStep'](_0x370bc5);}})[_0x7c6a('0x20')](function(_0x32738a){if(_0x32738a){return _0x32738a?{'count':_0x26f118,'rows':_0x32738a}:null;}})[_0x7c6a('0x20')](respondWithResult(_0x51543b,null))[_0x7c6a('0x40')](handleError(_0x51543b,null));}; \ No newline at end of file diff --git a/server/api/crmWorkflowstep/crmWorkflowstep.model.js b/server/api/crmWorkflowstep/crmWorkflowstep.model.js index 172e211..b22358b 100644 --- a/server/api/crmWorkflowstep/crmWorkflowstep.model.js +++ b/server/api/crmWorkflowstep/crmWorkflowstep.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ebb=['exports','define','CrmWorkflowStep','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./crmWorkflowstep.attributes'];(function(_0x53f07f,_0x2667c5){var _0x349648=function(_0x299c0a){while(--_0x299c0a){_0x53f07f['push'](_0x53f07f['shift']());}};_0x349648(++_0x2667c5);}(_0x6ebb,0x85));var _0xb6eb=function(_0x5e7e61,_0x3bc2b7){_0x5e7e61=_0x5e7e61-0x0;var _0x2e4a53=_0x6ebb[_0x5e7e61];return _0x2e4a53;};'use strict';var _=require(_0xb6eb('0x0'));var util=require('util');var logger=require(_0xb6eb('0x1'))(_0xb6eb('0x2'));var moment=require(_0xb6eb('0x3'));var BPromise=require(_0xb6eb('0x4'));var rp=require(_0xb6eb('0x5'));var fs=require('fs');var path=require(_0xb6eb('0x6'));var rimraf=require(_0xb6eb('0x7'));var config=require(_0xb6eb('0x8'));var attributes=require(_0xb6eb('0x9'));module[_0xb6eb('0xa')]=function(_0x2c0d33,_0x4e06d2){return _0x2c0d33[_0xb6eb('0xb')](_0xb6eb('0xc'),attributes,{'tableName':'crm_workflow_steps','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa660=['exports','crm_workflow_steps','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./crmWorkflowstep.attributes'];(function(_0x478708,_0x816b6c){var _0x5c4bf0=function(_0x296658){while(--_0x296658){_0x478708['push'](_0x478708['shift']());}};_0x5c4bf0(++_0x816b6c);}(_0xa660,0x6e));var _0x0a66=function(_0x40ad5d,_0x2b757d){_0x40ad5d=_0x40ad5d-0x0;var _0xcae14e=_0xa660[_0x40ad5d];return _0xcae14e;};'use strict';var _=require(_0x0a66('0x0'));var util=require(_0x0a66('0x1'));var logger=require(_0x0a66('0x2'))('api');var moment=require(_0x0a66('0x3'));var BPromise=require(_0x0a66('0x4'));var rp=require(_0x0a66('0x5'));var fs=require('fs');var path=require(_0x0a66('0x6'));var rimraf=require(_0x0a66('0x7'));var config=require(_0x0a66('0x8'));var attributes=require(_0x0a66('0x9'));module[_0x0a66('0xa')]=function(_0x5b43cd,_0x22b5bc){return _0x5b43cd['define']('CrmWorkflowStep',attributes,{'tableName':_0x0a66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/crmWorkflowstep/crmWorkflowstep.rpc.js b/server/api/crmWorkflowstep/crmWorkflowstep.rpc.js index b76b255..1f0aaff 100644 --- a/server/api/crmWorkflowstep/crmWorkflowstep.rpc.js +++ b/server/api/crmWorkflowstep/crmWorkflowstep.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97da=['../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','debug','CrmWorkflowStep,\x20%s,\x20%s,\x20%s','stringify','error','code','CrmWorkflowStep,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x152341,_0x8f0c56){var _0x440e1b=function(_0x33918f){while(--_0x33918f){_0x152341['push'](_0x152341['shift']());}};_0x440e1b(++_0x8f0c56);}(_0x97da,0x164));var _0xa97d=function(_0x385894,_0x51c58c){_0x385894=_0x385894-0x0;var _0x360ed5=_0x97da[_0x385894];return _0x360ed5;};'use strict';var _=require(_0xa97d('0x0'));var util=require('util');var moment=require(_0xa97d('0x1'));var BPromise=require(_0xa97d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa97d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa97d('0x4'));var logger=require(_0xa97d('0x5'))(_0xa97d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa97d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cff27,_0x34446c,_0x3ecd45){return new BPromise(function(_0x36a463,_0x352267){return client[_0xa97d('0x8')](_0x3cff27,_0x3ecd45)['then'](function(_0x178e3b){logger[_0xa97d('0x9')]('CrmWorkflowStep,\x20%s,\x20%s',_0x34446c,_0xa97d('0xa'));logger[_0xa97d('0xb')](_0xa97d('0xc'),_0x34446c,_0xa97d('0xa'),JSON[_0xa97d('0xd')](_0x178e3b));if(_0x178e3b['error']){if(_0x178e3b[_0xa97d('0xe')][_0xa97d('0xf')]===0x1f4){logger[_0xa97d('0xe')](_0xa97d('0x10'),_0x34446c,_0x178e3b['error'][_0xa97d('0x11')]);return _0x352267(_0x178e3b[_0xa97d('0xe')]['message']);}logger['error'](_0xa97d('0x10'),_0x34446c,_0x178e3b['error'][_0xa97d('0x11')]);return _0x36a463(_0x178e3b[_0xa97d('0xe')][_0xa97d('0x11')]);}else{logger[_0xa97d('0x9')](_0xa97d('0x10'),_0x34446c,_0xa97d('0xa'));_0x36a463(_0x178e3b[_0xa97d('0x12')][_0xa97d('0x11')]);}})[_0xa97d('0x13')](function(_0x4f73f3){logger[_0xa97d('0xe')](_0xa97d('0x10'),_0x34446c,_0x4f73f3);_0x352267(_0x4f73f3);});});} \ No newline at end of file +var _0x613c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CrmWorkflowStep,\x20%s,\x20%s','request\x20sent','CrmWorkflowStep,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x9f16d3,_0x26ce6a){var _0x14d37c=function(_0x1c37e6){while(--_0x1c37e6){_0x9f16d3['push'](_0x9f16d3['shift']());}};_0x14d37c(++_0x26ce6a);}(_0x613c,0xd9));var _0xc613=function(_0x36c5d5,_0x45eb64){_0x36c5d5=_0x36c5d5-0x0;var _0x365848=_0x613c[_0x36c5d5];return _0x365848;};'use strict';var _=require(_0xc613('0x0'));var util=require(_0xc613('0x1'));var moment=require('moment');var BPromise=require(_0xc613('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc613('0x3'))['db'];var utils=require(_0xc613('0x4'));var logger=require(_0xc613('0x5'))(_0xc613('0x6'));var config=require('../../config/environment');var jayson=require(_0xc613('0x7'));var client=jayson[_0xc613('0x8')][_0xc613('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1addff,_0x4e0c62,_0x2a01e9){return new BPromise(function(_0x37f461,_0x521605){return client[_0xc613('0xa')](_0x1addff,_0x2a01e9)[_0xc613('0xb')](function(_0x16faab){logger['info'](_0xc613('0xc'),_0x4e0c62,_0xc613('0xd'));logger['debug'](_0xc613('0xe'),_0x4e0c62,'request\x20sent',JSON[_0xc613('0xf')](_0x16faab));if(_0x16faab[_0xc613('0x10')]){if(_0x16faab[_0xc613('0x10')][_0xc613('0x11')]===0x1f4){logger[_0xc613('0x10')]('CrmWorkflowStep,\x20%s,\x20%s',_0x4e0c62,_0x16faab[_0xc613('0x10')][_0xc613('0x12')]);return _0x521605(_0x16faab[_0xc613('0x10')][_0xc613('0x12')]);}logger[_0xc613('0x10')]('CrmWorkflowStep,\x20%s,\x20%s',_0x4e0c62,_0x16faab['error'][_0xc613('0x12')]);return _0x37f461(_0x16faab[_0xc613('0x10')][_0xc613('0x12')]);}else{logger[_0xc613('0x13')](_0xc613('0xc'),_0x4e0c62,_0xc613('0xd'));_0x37f461(_0x16faab[_0xc613('0x14')][_0xc613('0x12')]);}})[_0xc613('0x15')](function(_0x5445fc){logger[_0xc613('0x10')](_0xc613('0xc'),_0x4e0c62,_0x5445fc);_0x521605(_0x5445fc);});});} \ No newline at end of file diff --git a/server/api/crmWorkflowstep/index.js b/server/api/crmWorkflowstep/index.js index 1ca9ecf..2b8fce9 100644 --- a/server/api/crmWorkflowstep/index.js +++ b/server/api/crmWorkflowstep/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','../../components/auth/service','../../components/interaction/service','./crmWorkflowstep.controller','isAuthenticated','index','describe','get','/:id','show','getCrmWorkflowNextStep','post','addCrmWorkflowNextStep','update','delete','destroy','/:id/steps','removeCrmWorkflowNextStep','exports','util','connect-timeout'];(function(_0x53b9be,_0x5816dc){var _0x559306=function(_0x28b8f9){while(--_0x28b8f9){_0x53b9be['push'](_0x53b9be['shift']());}};_0x559306(++_0x5816dc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['get']('/:id/steps',auth[_0x65f6('0x7')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')]('/',auth[_0x65f6('0x7')](),controller['create']);router[_0x65f6('0xe')]('/:id/steps',auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['put'](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0x10')]);router[_0x65f6('0x11')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x12')]);router[_0x65f6('0x11')](_0x65f6('0x13'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x14')]);module[_0x65f6('0x15')]=router; \ No newline at end of file +var _0xadb5=['describe','/:id','show','/:id/steps','getCrmWorkflowNextStep','create','post','addCrmWorkflowNextStep','update','delete','destroy','removeCrmWorkflowNextStep','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./crmWorkflowstep.controller','isAuthenticated','index','get','/describe'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xadb5,0xad));var _0x5adb=function(_0xae01c1,_0x289825){_0xae01c1=_0xae01c1-0x0;var _0x20e67f=_0xadb5[_0xae01c1];return _0x20e67f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x9')](_0x5adb('0xc'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x9')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')](_0x5adb('0xe'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['put'](_0x5adb('0xc'),auth['isAuthenticated'](),controller[_0x5adb('0x13')]);router[_0x5adb('0x14')](_0x5adb('0xc'),auth['isAuthenticated'](),controller[_0x5adb('0x15')]);router[_0x5adb('0x14')](_0x5adb('0xe'),auth['isAuthenticated'](),controller[_0x5adb('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c498d71..431450f 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 _0x4fc7=['sequelize','exports','STRING','name'];(function(_0x36ca98,_0x180d65){var _0x1c3186=function(_0x547565){while(--_0x547565){_0x36ca98['push'](_0x36ca98['shift']());}};_0x1c3186(++_0x180d65);}(_0x4fc7,0x84));var _0x74fc=function(_0x1411ab,_0x1ff258){_0x1411ab=_0x1411ab-0x0;var _0x36b4ff=_0x4fc7[_0x1411ab];return _0x36b4ff;};'use strict';var Sequelize=require(_0x74fc('0x0'));module[_0x74fc('0x1')]={'name':{'type':Sequelize[_0x74fc('0x2')],'allowNull':![],'unique':_0x74fc('0x3')},'description':{'type':Sequelize[_0x74fc('0x2')]}}; \ No newline at end of file +var _0xfa9d=['sequelize','STRING','name'];(function(_0x18fc8b,_0x122a7d){var _0x19da15=function(_0x53334e){while(--_0x53334e){_0x18fc8b['push'](_0x18fc8b['shift']());}};_0x19da15(++_0x122a7d);}(_0xfa9d,0x156));var _0xdfa9=function(_0x4c20b4,_0x365825){_0x4c20b4=_0x4c20b4-0x0;var _0x87980a=_0xfa9d[_0x4c20b4];return _0x87980a;};'use strict';var Sequelize=require(_0xdfa9('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfa9('0x1')],'allowNull':![],'unique':_0xdfa9('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5741611..22d2661 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 _0xb9f7=['error','stack','name','send','Dashboard','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','field','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','map','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/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','register','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','get','CustomDashboards'];(function(_0xdb5423,_0x10b500){var _0x3beb17=function(_0x3cc42d){while(--_0x3cc42d){_0xdb5423['push'](_0xdb5423['shift']());}};_0x3beb17(++_0x10b500);}(_0xb9f7,0xca));var _0x7b9f=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xb9f7[_0x22f8ab];return _0x2a70e5;};'use strict';var pdf=require(_0x7b9f('0x0'));var emlformat=require(_0x7b9f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7b9f('0x2'));var jsonpatch=require(_0x7b9f('0x3'));var rp=require(_0x7b9f('0x4'));var moment=require(_0x7b9f('0x5'));var BPromise=require(_0x7b9f('0x6'));var Mustache=require(_0x7b9f('0x7'));var util=require(_0x7b9f('0x8'));var path=require(_0x7b9f('0x9'));var sox=require(_0x7b9f('0xa'));var csv=require(_0x7b9f('0xb'));var ejs=require(_0x7b9f('0xc'));var fs=require('fs');var _=require(_0x7b9f('0xd'));var squel=require(_0x7b9f('0xe'));var crypto=require('crypto');var jsforce=require(_0x7b9f('0xf'));var deskjs=require(_0x7b9f('0x10'));var toCsv=require(_0x7b9f('0xb'));var querystring=require(_0x7b9f('0x11'));var Papa=require(_0x7b9f('0x12'));var Redis=require(_0x7b9f('0x13'));var authService=require(_0x7b9f('0x14'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x7b9f('0x15'));var logger=require(_0x7b9f('0x16'))(_0x7b9f('0x17'));var utils=require(_0x7b9f('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7b9f('0x19')]=_[_0x7b9f('0x1a')](config[_0x7b9f('0x19')],{'host':_0x7b9f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b9f('0x19')]));require('./dashboard.socket')[_0x7b9f('0x1c')](socket);function respondWithStatusCode(_0x2689c7,_0x289b39){_0x289b39=_0x289b39||0xcc;return function(_0x14cecb){if(_0x14cecb){return _0x2689c7['sendStatus'](_0x289b39);}return _0x2689c7[_0x7b9f('0x1d')](_0x289b39)[_0x7b9f('0x1e')]();};}function respondWithResult(_0x5673b5,_0x5f2820){_0x5f2820=_0x5f2820||0xc8;return function(_0x24185c){if(_0x24185c){return _0x5673b5['status'](_0x5f2820)[_0x7b9f('0x1f')](_0x24185c);}};}function respondWithFilteredResult(_0x3b8085,_0x45cf93){return function(_0x50ee9f){if(_0x50ee9f){var _0x56e2a4=_0x50ee9f[_0x7b9f('0x20')],_0x551968=_0x45cf93['offset'],_0x6c84aa=_0x45cf93[_0x7b9f('0x21')]+_0x45cf93['limit'],_0x3ded63;if(_0x6c84aa>=_0x56e2a4){_0x6c84aa=_0x56e2a4;_0x3ded63=0xc8;}else{_0x3ded63=0xce;}_0x3b8085[_0x7b9f('0x1d')](_0x3ded63);return _0x3b8085[_0x7b9f('0x22')](_0x7b9f('0x23'),_0x551968+'-'+_0x6c84aa+'/'+_0x56e2a4)[_0x7b9f('0x1f')](_0x50ee9f);}return null;};}function patchUpdates(_0x2f8e79){return function(_0x350c75){try{jsonpatch[_0x7b9f('0x24')](_0x350c75,_0x2f8e79,!![]);}catch(_0x378f4a){return BPromise['reject'](_0x378f4a);}return _0x350c75[_0x7b9f('0x25')]();};}function saveUpdates(_0xc26daa,_0x5e90af){return function(_0xbf6c47){if(_0xbf6c47){return _0xbf6c47['update'](_0xc26daa)[_0x7b9f('0x26')](function(_0x2163a0){return _0x2163a0;});}return null;};}function removeEntity(_0x1470d1,_0xaec2fd){return function(_0x4d767b){if(_0x4d767b){return _0x4d767b[_0x7b9f('0x27')]()[_0x7b9f('0x26')](function(){var _0x2f0900=_0x4d767b[_0x7b9f('0x28')]({'plain':!![]});var _0x1d1f72=_0x7b9f('0x29');return db['UserProfileResource'][_0x7b9f('0x27')]({'where':{'type':_0x1d1f72,'resourceId':_0x2f0900['id']}})['then'](function(){return _0x4d767b;});})[_0x7b9f('0x26')](function(){_0x1470d1[_0x7b9f('0x1d')](0xcc)[_0x7b9f('0x1e')]();});}};}function handleEntityNotFound(_0x246e8b,_0x543d55){return function(_0x2392ee){if(!_0x2392ee){_0x246e8b['sendStatus'](0x194);}return _0x2392ee;};}function handleError(_0x2e0db2,_0x3ece4b){_0x3ece4b=_0x3ece4b||0x1f4;return function(_0x1812e2){logger[_0x7b9f('0x2a')](_0x1812e2[_0x7b9f('0x2b')]);if(_0x1812e2[_0x7b9f('0x2c')]){delete _0x1812e2[_0x7b9f('0x2c')];}_0x2e0db2['status'](_0x3ece4b)[_0x7b9f('0x2d')](_0x1812e2);};}exports['index']=function(_0x11ae8c,_0x404e23){var _0xa0d7b={},_0x34a0dd={},_0x189b8d={'count':0x0,'rows':[]};var _0x210dca=db[_0x7b9f('0x2e')][_0x7b9f('0x2f')];_0x34a0dd[_0x7b9f('0x30')]=_['keys'](_0x210dca);_0x34a0dd[_0x7b9f('0x31')]=_[_0x7b9f('0x32')](_0x11ae8c[_0x7b9f('0x31')]);_0x34a0dd[_0x7b9f('0x33')]=_['intersection'](_0x34a0dd[_0x7b9f('0x30')],_0x34a0dd['query']);_0xa0d7b[_0x7b9f('0x34')]=_[_0x7b9f('0x35')](_0x34a0dd[_0x7b9f('0x30')],qs[_0x7b9f('0x36')](_0x11ae8c[_0x7b9f('0x31')][_0x7b9f('0x36')]));_0xa0d7b[_0x7b9f('0x34')]=_0xa0d7b[_0x7b9f('0x34')][_0x7b9f('0x37')]?_0xa0d7b[_0x7b9f('0x34')]:_0x34a0dd[_0x7b9f('0x30')];if(!_0x11ae8c[_0x7b9f('0x31')][_0x7b9f('0x38')](_0x7b9f('0x39'))){_0xa0d7b[_0x7b9f('0x3a')]=qs['limit'](_0x11ae8c[_0x7b9f('0x31')][_0x7b9f('0x3a')]);_0xa0d7b[_0x7b9f('0x21')]=qs['offset'](_0x11ae8c['query'][_0x7b9f('0x21')]);}_0xa0d7b[_0x7b9f('0x3b')]=qs['sort'](_0x11ae8c[_0x7b9f('0x31')][_0x7b9f('0x3c')]);_0xa0d7b[_0x7b9f('0x3d')]=qs[_0x7b9f('0x33')](_[_0x7b9f('0x3e')](_0x11ae8c[_0x7b9f('0x31')],_0x34a0dd[_0x7b9f('0x33')]));if(_0x11ae8c[_0x7b9f('0x31')][_0x7b9f('0x3f')]){_0xa0d7b['where']=_[_0x7b9f('0x40')](_0xa0d7b[_0x7b9f('0x3d')],{'$or':_['map'](_0x210dca,function(_0x423697){if(_0x423697[_0x7b9f('0x41')]['key']!=='VIRTUAL'){var _0x505ed4={};_0x505ed4[_0x423697[_0x7b9f('0x42')]]={'$like':'%'+_0x11ae8c[_0x7b9f('0x31')][_0x7b9f('0x3f')]+'%'};return _0x505ed4;}})});}_0xa0d7b=_[_0x7b9f('0x40')]({},_0xa0d7b,_0x11ae8c[_0x7b9f('0x43')]);var _0x310eba={'where':_0xa0d7b[_0x7b9f('0x3d')]};return db[_0x7b9f('0x2e')]['count'](_0x310eba)[_0x7b9f('0x26')](function(_0x2eec03){_0x189b8d['count']=_0x2eec03;if(_0x11ae8c[_0x7b9f('0x31')]['includeAll']){_0xa0d7b[_0x7b9f('0x44')]=[{'all':!![]}];}return db[_0x7b9f('0x2e')][_0x7b9f('0x45')](_0xa0d7b);})['then'](function(_0x1db8a6){_0x189b8d[_0x7b9f('0x46')]=_0x1db8a6;return _0x189b8d;})[_0x7b9f('0x26')](respondWithFilteredResult(_0x404e23,_0xa0d7b))[_0x7b9f('0x47')](handleError(_0x404e23,null));};exports[_0x7b9f('0x48')]=function(_0xf4341f,_0x51f67a){var _0xd96de2={'raw':![],'where':{'id':_0xf4341f[_0x7b9f('0x49')]['id']}},_0xfe756b={};_0xfe756b[_0x7b9f('0x30')]=_[_0x7b9f('0x32')](db[_0x7b9f('0x2e')][_0x7b9f('0x2f')]);_0xfe756b[_0x7b9f('0x31')]=_[_0x7b9f('0x32')](_0xf4341f[_0x7b9f('0x31')]);_0xfe756b[_0x7b9f('0x33')]=_['intersection'](_0xfe756b[_0x7b9f('0x30')],_0xfe756b['query']);_0xd96de2[_0x7b9f('0x34')]=_[_0x7b9f('0x35')](_0xfe756b[_0x7b9f('0x30')],qs[_0x7b9f('0x36')](_0xf4341f[_0x7b9f('0x31')]['fields']));_0xd96de2[_0x7b9f('0x34')]=_0xd96de2[_0x7b9f('0x34')][_0x7b9f('0x37')]?_0xd96de2['attributes']:_0xfe756b[_0x7b9f('0x30')];if(_0xf4341f[_0x7b9f('0x31')][_0x7b9f('0x4a')]){_0xd96de2[_0x7b9f('0x44')]=[{'all':!![]}];}_0xd96de2=_['merge']({},_0xd96de2,_0xf4341f[_0x7b9f('0x43')]);return db[_0x7b9f('0x2e')][_0x7b9f('0x4b')](_0xd96de2)[_0x7b9f('0x26')](handleEntityNotFound(_0x51f67a,null))[_0x7b9f('0x26')](respondWithResult(_0x51f67a,null))[_0x7b9f('0x47')](handleError(_0x51f67a,null));};exports[_0x7b9f('0x4c')]=function(_0x5e7d68,_0x471211){return db['Dashboard']['create'](_0x5e7d68[_0x7b9f('0x4d')],{})[_0x7b9f('0x26')](function(_0x21a16b){var _0x31ba2c=_0x5e7d68[_0x7b9f('0x4e')][_0x7b9f('0x28')]({'plain':!![]});if(!_0x31ba2c)throw new Error(_0x7b9f('0x4f'));if(_0x31ba2c['role']===_0x7b9f('0x4e')){var _0x13f93d=_0x21a16b['get']({'plain':!![]});var _0x3083f3=_0x7b9f('0x29');return db[_0x7b9f('0x50')]['find']({'where':{'name':_0x3083f3,'userProfileId':_0x31ba2c[_0x7b9f('0x51')]},'raw':!![]})[_0x7b9f('0x26')](function(_0x426457){if(_0x426457&&_0x426457[_0x7b9f('0x52')]===0x0){return db[_0x7b9f('0x53')][_0x7b9f('0x4c')]({'name':_0x13f93d['name'],'resourceId':_0x13f93d['id'],'type':_0x426457[_0x7b9f('0x2c')],'sectionId':_0x426457['id']},{})[_0x7b9f('0x26')](function(){return _0x21a16b;});}else{return _0x21a16b;}})[_0x7b9f('0x47')](function(_0x26f022){logger[_0x7b9f('0x2a')](_0x7b9f('0x54'),_0x26f022);throw _0x26f022;});}return _0x21a16b;})[_0x7b9f('0x26')](respondWithResult(_0x471211,0xc9))['catch'](handleError(_0x471211,null));};exports[_0x7b9f('0x55')]=function(_0x8861e6,_0x538834){var _0x80b789={'raw':![],'where':{'id':_0x8861e6[_0x7b9f('0x49')]['id']}},_0x1520d8={};_0x1520d8[_0x7b9f('0x30')]=_[_0x7b9f('0x32')](db[_0x7b9f('0x2e')][_0x7b9f('0x2f')]);_0x80b789[_0x7b9f('0x34')]=_[_0x7b9f('0x35')](_0x1520d8[_0x7b9f('0x30')],qs[_0x7b9f('0x36')](_0x8861e6['query']['fields']));_0x80b789[_0x7b9f('0x34')]=_0x80b789[_0x7b9f('0x34')]['length']?_0x80b789[_0x7b9f('0x34')]:_0x1520d8[_0x7b9f('0x30')];if(_0x8861e6[_0x7b9f('0x31')][_0x7b9f('0x4a')]){_0x80b789[_0x7b9f('0x44')]=[{'all':!![]}];}_0x80b789=_['merge']({},_0x80b789,_0x8861e6[_0x7b9f('0x43')]);return db[_0x7b9f('0x2e')][_0x7b9f('0x4b')](_0x80b789)[_0x7b9f('0x26')](handleEntityNotFound(_0x538834,null))[_0x7b9f('0x26')](function(_0x46a03b){if(_0x46a03b){var _0x123811=_0x46a03b[_0x7b9f('0x28')]({'plain':!![]});_0x123811=qs[_0x7b9f('0x56')](_0x123811,['id',_0x7b9f('0x57'),_0x7b9f('0x58')]);_0x8861e6[_0x7b9f('0x4d')]=_[_0x7b9f('0x56')](_0x8861e6[_0x7b9f('0x4d')],['id',_0x7b9f('0x57'),'updatedAt']);return db[_0x7b9f('0x2e')][_0x7b9f('0x4c')](_[_0x7b9f('0x40')](_0x123811,_0x8861e6[_0x7b9f('0x4d')]),{'include':_0x8861e6['query'][_0x7b9f('0x4a')]?[{'all':!![]}]:undefined})[_0x7b9f('0x26')](function(_0x2a644c){var _0x16bc68=_0x8861e6[_0x7b9f('0x4e')]['get']({'plain':!![]});if(!_0x16bc68)throw new Error(_0x7b9f('0x4f'));if(_0x16bc68[_0x7b9f('0x59')]===_0x7b9f('0x4e')){var _0x5bddee=_0x2a644c[_0x7b9f('0x28')]({'plain':!![]});var _0x40377d=_0x7b9f('0x29');return db[_0x7b9f('0x50')][_0x7b9f('0x4b')]({'where':{'name':_0x40377d,'userProfileId':_0x16bc68[_0x7b9f('0x51')]},'raw':!![]})[_0x7b9f('0x26')](function(_0x4fbb00){if(_0x4fbb00&&_0x4fbb00[_0x7b9f('0x52')]===0x0){return db[_0x7b9f('0x53')][_0x7b9f('0x4c')]({'name':_0x5bddee[_0x7b9f('0x2c')],'resourceId':_0x5bddee['id'],'type':_0x4fbb00[_0x7b9f('0x2c')],'sectionId':_0x4fbb00['id']},{})[_0x7b9f('0x26')](function(){return _0x2a644c;});}else{return _0x2a644c;}})[_0x7b9f('0x47')](function(_0x3a58cc){logger[_0x7b9f('0x2a')](_0x7b9f('0x54'),_0x3a58cc);throw _0x3a58cc;});}return _0x2a644c;});}})[_0x7b9f('0x26')](respondWithResult(_0x538834,0xc9))[_0x7b9f('0x47')](handleError(_0x538834,null));};exports[_0x7b9f('0x5a')]=function(_0x23f3df,_0x285e53){if(_0x23f3df[_0x7b9f('0x4d')]['id']){delete _0x23f3df[_0x7b9f('0x4d')]['id'];}return db[_0x7b9f('0x2e')][_0x7b9f('0x4b')]({'where':{'id':_0x23f3df[_0x7b9f('0x49')]['id']}})[_0x7b9f('0x26')](handleEntityNotFound(_0x285e53,null))[_0x7b9f('0x26')](saveUpdates(_0x23f3df[_0x7b9f('0x4d')],null))[_0x7b9f('0x26')](respondWithResult(_0x285e53,null))['catch'](handleError(_0x285e53,null));};exports[_0x7b9f('0x27')]=function(_0x23aeef,_0x715b85){return db[_0x7b9f('0x2e')][_0x7b9f('0x4b')]({'where':{'id':_0x23aeef[_0x7b9f('0x49')]['id']}})[_0x7b9f('0x26')](handleEntityNotFound(_0x715b85,null))[_0x7b9f('0x26')](removeEntity(_0x715b85,null))['catch'](handleError(_0x715b85,null));};function widgetAttributes(_0x164381){try{switch(_0x164381[_0x7b9f('0x41')]){case _0x7b9f('0x5b'):return[{'name':'attrUrl','value':_0x164381[_0x7b9f('0x5c')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x0]?_0x164381['attrs'][0x0][_0x7b9f('0x5e')]:undefined)||_0x7b9f('0x5f')}];case _0x7b9f('0x60'):return[{'name':_0x7b9f('0x61'),'value':_0x164381[_0x7b9f('0x61')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x0]?_0x164381[_0x7b9f('0x5d')][0x0][_0x7b9f('0x5e')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x164381[_0x7b9f('0x62')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x0]?_0x164381[_0x7b9f('0x5d')][0x0]['value']:undefined)||_0x7b9f('0x63')},{'name':_0x7b9f('0x64'),'value':_0x164381[_0x7b9f('0x64')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x1]?_0x164381['attrs'][0x1][_0x7b9f('0x5e')]:undefined)||_0x7b9f('0x65')},{'name':_0x7b9f('0x66'),'value':_0x164381[_0x7b9f('0x66')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x2]?_0x164381[_0x7b9f('0x5d')][0x2][_0x7b9f('0x5e')]:undefined)||0xc}];case _0x7b9f('0x67'):return[{'name':'attrMetric','value':_0x164381[_0x7b9f('0x68')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x0]?_0x164381['attrs'][0x0][_0x7b9f('0x5e')]:undefined)||_0x7b9f('0x69')},{'name':_0x7b9f('0x6a'),'value':_0x164381[_0x7b9f('0x6a')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x1]?_0x164381[_0x7b9f('0x5d')][0x1][_0x7b9f('0x5e')]:undefined)||[]},{'name':_0x7b9f('0x66'),'value':_0x164381['attrFontSize']||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x2]?_0x164381[_0x7b9f('0x5d')][0x2][_0x7b9f('0x5e')]:undefined)||0x14}];case _0x7b9f('0x6b'):case _0x7b9f('0x6c'):return[{'name':_0x7b9f('0x6d'),'value':_0x164381['attrSerie1']||(_0x164381[_0x7b9f('0x5d')]&&_0x164381['attrs'][0x0]?_0x164381[_0x7b9f('0x5d')][0x0][_0x7b9f('0x5e')]:undefined)||_0x7b9f('0x69')},{'name':'attrSerie2','value':_0x164381[_0x7b9f('0x6e')]||(_0x164381['attrs']&&_0x164381[_0x7b9f('0x5d')][0x1]?_0x164381[_0x7b9f('0x5d')][0x1]['value']:undefined)||null},{'name':_0x7b9f('0x6f'),'value':_0x164381['attrSerie3']||(_0x164381['attrs']&&_0x164381[_0x7b9f('0x5d')][0x2]?_0x164381[_0x7b9f('0x5d')][0x2]['value']:undefined)||null},{'name':_0x7b9f('0x6a'),'value':_0x164381[_0x7b9f('0x6a')]||(_0x164381['attrs']&&_0x164381[_0x7b9f('0x5d')][0x3]?_0x164381[_0x7b9f('0x5d')][0x3][_0x7b9f('0x5e')]:undefined)||[]}];case'web-report':return[{'name':_0x7b9f('0x70'),'type':_0x164381['reportType']||(_0x164381['attrs']&&_0x164381[_0x7b9f('0x5d')][0x0]?_0x164381[_0x7b9f('0x5d')][0x0][_0x7b9f('0x41')]:undefined)||null,'value':_0x164381[_0x7b9f('0x70')]||(_0x164381[_0x7b9f('0x5d')]&&_0x164381[_0x7b9f('0x5d')][0x0]?_0x164381[_0x7b9f('0x5d')][0x0]['value']:undefined)||null},{'name':_0x7b9f('0x71'),'value':_0x164381['attrRefresh']||(_0x164381[_0x7b9f('0x5d')]&&_0x164381['attrs'][0x1]?_0x164381[_0x7b9f('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x439509){logger['error'](_0x7b9f('0x72'),JSON[_0x7b9f('0x73')](_0x439509));return[];}}exports[_0x7b9f('0x74')]=function(_0xc175fa,_0x2cdbbf,_0x480250){if(_0xc175fa['body']['id']){delete _0xc175fa[_0x7b9f('0x4d')]['id'];}return db[_0x7b9f('0x2e')][_0x7b9f('0x4b')]({'where':{'id':_0xc175fa[_0x7b9f('0x49')]['id']}})[_0x7b9f('0x26')](handleEntityNotFound(_0x2cdbbf,null))[_0x7b9f('0x26')](function(_0x125c4c){if(_0x125c4c){_0xc175fa[_0x7b9f('0x4d')][_0x7b9f('0x75')]=_0x125c4c['id'];_0xc175fa[_0x7b9f('0x4d')]['attrs']=widgetAttributes(_0xc175fa[_0x7b9f('0x4d')]);return db[_0x7b9f('0x76')][_0x7b9f('0x4c')](_0xc175fa['body']);}})[_0x7b9f('0x26')](respondWithResult(_0x2cdbbf,null))['catch'](handleError(_0x2cdbbf,null));};exports[_0x7b9f('0x77')]=function(_0x491426,_0x478a42,_0x1e19f3){var _0x185d0a={};var _0x4aba7a={};var _0x29860d;var _0x3d3957;return db[_0x7b9f('0x2e')][_0x7b9f('0x78')]({'where':{'id':_0x491426['params']['id']}})['then'](handleEntityNotFound(_0x478a42,null))[_0x7b9f('0x26')](function(_0x36bd7c){if(_0x36bd7c){_0x29860d=_0x36bd7c;_0x4aba7a[_0x7b9f('0x30')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x4aba7a['query']=_['keys'](_0x491426[_0x7b9f('0x31')]);_0x4aba7a[_0x7b9f('0x33')]=_['intersection'](_0x4aba7a['model'],_0x4aba7a[_0x7b9f('0x31')]);_0x185d0a['attributes']=_[_0x7b9f('0x35')](_0x4aba7a[_0x7b9f('0x30')],qs[_0x7b9f('0x36')](_0x491426[_0x7b9f('0x31')][_0x7b9f('0x36')]));_0x185d0a[_0x7b9f('0x34')]=_0x185d0a['attributes'][_0x7b9f('0x37')]?_0x185d0a[_0x7b9f('0x34')]:_0x4aba7a[_0x7b9f('0x30')];_0x185d0a[_0x7b9f('0x3b')]=qs['sort'](_0x491426[_0x7b9f('0x31')]['sort']);_0x185d0a[_0x7b9f('0x3d')]=qs[_0x7b9f('0x33')](_[_0x7b9f('0x3e')](_0x491426[_0x7b9f('0x31')],_0x4aba7a['filters']));if(_0x491426[_0x7b9f('0x31')][_0x7b9f('0x3f')]){_0x185d0a[_0x7b9f('0x3d')]=_['merge'](_0x185d0a[_0x7b9f('0x3d')],{'$or':_[_0x7b9f('0x79')](_0x185d0a['attributes'],function(_0x3ebaff){var _0x28a845={};_0x28a845[_0x3ebaff]={'$like':'%'+_0x491426['query'][_0x7b9f('0x3f')]+'%'};return _0x28a845;})});}_0x185d0a=_[_0x7b9f('0x40')]({},_0x185d0a,_0x491426[_0x7b9f('0x43')]);return _0x29860d[_0x7b9f('0x77')](_0x185d0a);}})['then'](function(_0x9fc61a){if(_0x9fc61a){_0x3d3957=_0x9fc61a['length'];if(!_0x491426[_0x7b9f('0x31')][_0x7b9f('0x38')](_0x7b9f('0x39'))){_0x185d0a['limit']=qs[_0x7b9f('0x3a')](_0x491426[_0x7b9f('0x31')][_0x7b9f('0x3a')]);_0x185d0a[_0x7b9f('0x21')]=qs[_0x7b9f('0x21')](_0x491426['query'][_0x7b9f('0x21')]);}return _0x29860d['getItems'](_0x185d0a);}})[_0x7b9f('0x26')](function(_0x171998){if(_0x171998){return _0x171998?{'count':_0x3d3957,'rows':_0x171998}:null;}})[_0x7b9f('0x26')](respondWithResult(_0x478a42,null))['catch'](handleError(_0x478a42,null));}; \ No newline at end of file +var _0x2dd6=['createdAt','updatedAt','user','autoAssociation','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','end','json','count','offset','limit','status','set','reject','update','destroy','then','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','Dashboard','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','field','options','findAll','catch','show','includeAll','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit'];(function(_0x21c006,_0x3331eb){var _0x2cd053=function(_0x43d77b){while(--_0x43d77b){_0x21c006['push'](_0x21c006['shift']());}};_0x2cd053(++_0x3331eb);}(_0x2dd6,0x8f));var _0x62dd=function(_0x2782b1,_0x1f93f4){_0x2782b1=_0x2782b1-0x0;var _0x98e50a=_0x2dd6[_0x2782b1];return _0x98e50a;};'use strict';var pdf=require(_0x62dd('0x0'));var emlformat=require(_0x62dd('0x1'));var rimraf=require(_0x62dd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62dd('0x3'));var rp=require(_0x62dd('0x4'));var moment=require(_0x62dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62dd('0x6'));var util=require(_0x62dd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x62dd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62dd('0x9'));var squel=require(_0x62dd('0xa'));var crypto=require('crypto');var jsforce=require(_0x62dd('0xb'));var deskjs=require(_0x62dd('0xc'));var toCsv=require(_0x62dd('0x8'));var querystring=require(_0x62dd('0xd'));var Papa=require('papaparse');var Redis=require(_0x62dd('0xe'));var authService=require(_0x62dd('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x62dd('0x10'));var logger=require(_0x62dd('0x11'))('api');var utils=require(_0x62dd('0x12'));var config=require('../../config/environment');var db=require(_0x62dd('0x13'))['db'];config[_0x62dd('0x14')]=_[_0x62dd('0x15')](config[_0x62dd('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x62dd('0x16'))(new Redis(config['redis']));require(_0x62dd('0x17'))[_0x62dd('0x18')](socket);function respondWithStatusCode(_0x5de327,_0x3fdb1a){_0x3fdb1a=_0x3fdb1a||0xcc;return function(_0x25eaed){if(_0x25eaed){return _0x5de327['sendStatus'](_0x3fdb1a);}return _0x5de327['status'](_0x3fdb1a)[_0x62dd('0x19')]();};}function respondWithResult(_0x51b849,_0x906db2){_0x906db2=_0x906db2||0xc8;return function(_0x4c5f70){if(_0x4c5f70){return _0x51b849['status'](_0x906db2)[_0x62dd('0x1a')](_0x4c5f70);}};}function respondWithFilteredResult(_0x2d2793,_0x202d67){return function(_0xdef581){if(_0xdef581){var _0xe2794b=_0xdef581[_0x62dd('0x1b')],_0x53c0e8=_0x202d67[_0x62dd('0x1c')],_0x2ff7fb=_0x202d67[_0x62dd('0x1c')]+_0x202d67[_0x62dd('0x1d')],_0x16098c;if(_0x2ff7fb>=_0xe2794b){_0x2ff7fb=_0xe2794b;_0x16098c=0xc8;}else{_0x16098c=0xce;}_0x2d2793[_0x62dd('0x1e')](_0x16098c);return _0x2d2793[_0x62dd('0x1f')]('Content-Range',_0x53c0e8+'-'+_0x2ff7fb+'/'+_0xe2794b)[_0x62dd('0x1a')](_0xdef581);}return null;};}function patchUpdates(_0xad08e7){return function(_0x15fe02){try{jsonpatch['apply'](_0x15fe02,_0xad08e7,!![]);}catch(_0x247363){return BPromise[_0x62dd('0x20')](_0x247363);}return _0x15fe02['save']();};}function saveUpdates(_0xd13211,_0x53f851){return function(_0x6045ac){if(_0x6045ac){return _0x6045ac[_0x62dd('0x21')](_0xd13211)['then'](function(_0x4bc59a){return _0x4bc59a;});}return null;};}function removeEntity(_0xa09c32,_0x56955e){return function(_0x3ab4ce){if(_0x3ab4ce){return _0x3ab4ce[_0x62dd('0x22')]()[_0x62dd('0x23')](function(){var _0x81ea49=_0x3ab4ce['get']({'plain':!![]});var _0x1bd521=_0x62dd('0x24');return db[_0x62dd('0x25')][_0x62dd('0x22')]({'where':{'type':_0x1bd521,'resourceId':_0x81ea49['id']}})[_0x62dd('0x23')](function(){return _0x3ab4ce;});})[_0x62dd('0x23')](function(){_0xa09c32[_0x62dd('0x1e')](0xcc)[_0x62dd('0x19')]();});}};}function handleEntityNotFound(_0x9f224b,_0x527481){return function(_0x1e4ce7){if(!_0x1e4ce7){_0x9f224b[_0x62dd('0x26')](0x194);}return _0x1e4ce7;};}function handleError(_0x5c3e86,_0x52fbef){_0x52fbef=_0x52fbef||0x1f4;return function(_0x365fd6){logger[_0x62dd('0x27')](_0x365fd6[_0x62dd('0x28')]);if(_0x365fd6[_0x62dd('0x29')]){delete _0x365fd6[_0x62dd('0x29')];}_0x5c3e86[_0x62dd('0x1e')](_0x52fbef)[_0x62dd('0x2a')](_0x365fd6);};}exports['index']=function(_0x5d5658,_0x150e60){var _0x272fab={},_0x3e1cd3={},_0x4a0910={'count':0x0,'rows':[]};var _0x4a9465=db[_0x62dd('0x2b')][_0x62dd('0x2c')];_0x3e1cd3[_0x62dd('0x2d')]=_[_0x62dd('0x2e')](_0x4a9465);_0x3e1cd3['query']=_[_0x62dd('0x2e')](_0x5d5658[_0x62dd('0x2f')]);_0x3e1cd3[_0x62dd('0x30')]=_[_0x62dd('0x31')](_0x3e1cd3['model'],_0x3e1cd3[_0x62dd('0x2f')]);_0x272fab[_0x62dd('0x32')]=_[_0x62dd('0x31')](_0x3e1cd3['model'],qs[_0x62dd('0x33')](_0x5d5658[_0x62dd('0x2f')][_0x62dd('0x33')]));_0x272fab[_0x62dd('0x32')]=_0x272fab[_0x62dd('0x32')][_0x62dd('0x34')]?_0x272fab['attributes']:_0x3e1cd3[_0x62dd('0x2d')];if(!_0x5d5658['query'][_0x62dd('0x35')](_0x62dd('0x36'))){_0x272fab['limit']=qs[_0x62dd('0x1d')](_0x5d5658[_0x62dd('0x2f')]['limit']);_0x272fab['offset']=qs[_0x62dd('0x1c')](_0x5d5658[_0x62dd('0x2f')][_0x62dd('0x1c')]);}_0x272fab['order']=qs['sort'](_0x5d5658[_0x62dd('0x2f')][_0x62dd('0x37')]);_0x272fab[_0x62dd('0x38')]=qs['filters'](_[_0x62dd('0x39')](_0x5d5658[_0x62dd('0x2f')],_0x3e1cd3[_0x62dd('0x30')]));if(_0x5d5658[_0x62dd('0x2f')][_0x62dd('0x3a')]){_0x272fab[_0x62dd('0x38')]=_[_0x62dd('0x3b')](_0x272fab[_0x62dd('0x38')],{'$or':_[_0x62dd('0x3c')](_0x4a9465,function(_0x5e64e7){if(_0x5e64e7[_0x62dd('0x3d')]['key']!=='VIRTUAL'){var _0x4e5815={};_0x4e5815[_0x5e64e7[_0x62dd('0x3e')]]={'$like':'%'+_0x5d5658['query']['filter']+'%'};return _0x4e5815;}})});}_0x272fab=_['merge']({},_0x272fab,_0x5d5658[_0x62dd('0x3f')]);var _0x23662d={'where':_0x272fab[_0x62dd('0x38')]};return db['Dashboard'][_0x62dd('0x1b')](_0x23662d)[_0x62dd('0x23')](function(_0x32bda8){_0x4a0910['count']=_0x32bda8;if(_0x5d5658[_0x62dd('0x2f')]['includeAll']){_0x272fab['include']=[{'all':!![]}];}return db[_0x62dd('0x2b')][_0x62dd('0x40')](_0x272fab);})[_0x62dd('0x23')](function(_0x4940a2){_0x4a0910['rows']=_0x4940a2;return _0x4a0910;})[_0x62dd('0x23')](respondWithFilteredResult(_0x150e60,_0x272fab))[_0x62dd('0x41')](handleError(_0x150e60,null));};exports[_0x62dd('0x42')]=function(_0x435d1d,_0x12d40a){var _0x2a8f41={'raw':![],'where':{'id':_0x435d1d['params']['id']}},_0x46ca21={};_0x46ca21[_0x62dd('0x2d')]=_[_0x62dd('0x2e')](db[_0x62dd('0x2b')][_0x62dd('0x2c')]);_0x46ca21['query']=_[_0x62dd('0x2e')](_0x435d1d['query']);_0x46ca21[_0x62dd('0x30')]=_[_0x62dd('0x31')](_0x46ca21[_0x62dd('0x2d')],_0x46ca21[_0x62dd('0x2f')]);_0x2a8f41['attributes']=_['intersection'](_0x46ca21['model'],qs['fields'](_0x435d1d['query'][_0x62dd('0x33')]));_0x2a8f41[_0x62dd('0x32')]=_0x2a8f41[_0x62dd('0x32')]['length']?_0x2a8f41[_0x62dd('0x32')]:_0x46ca21['model'];if(_0x435d1d['query'][_0x62dd('0x43')]){_0x2a8f41[_0x62dd('0x44')]=[{'all':!![]}];}_0x2a8f41=_['merge']({},_0x2a8f41,_0x435d1d[_0x62dd('0x3f')]);return db[_0x62dd('0x2b')][_0x62dd('0x45')](_0x2a8f41)[_0x62dd('0x23')](handleEntityNotFound(_0x12d40a,null))['then'](respondWithResult(_0x12d40a,null))[_0x62dd('0x41')](handleError(_0x12d40a,null));};exports['create']=function(_0x364aaa,_0xbb11d9){return db[_0x62dd('0x2b')][_0x62dd('0x46')](_0x364aaa[_0x62dd('0x47')],{})[_0x62dd('0x23')](function(_0x3fee16){var _0x4ff864=_0x364aaa['user'][_0x62dd('0x48')]({'plain':!![]});if(!_0x4ff864)throw new Error(_0x62dd('0x49'));if(_0x4ff864[_0x62dd('0x4a')]==='user'){var _0x424562=_0x3fee16['get']({'plain':!![]});var _0x35d9ea='CustomDashboards';return db[_0x62dd('0x4b')][_0x62dd('0x45')]({'where':{'name':_0x35d9ea,'userProfileId':_0x4ff864[_0x62dd('0x4c')]},'raw':!![]})[_0x62dd('0x23')](function(_0x2152ff){if(_0x2152ff&&_0x2152ff['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x424562[_0x62dd('0x29')],'resourceId':_0x424562['id'],'type':_0x2152ff[_0x62dd('0x29')],'sectionId':_0x2152ff['id']},{})[_0x62dd('0x23')](function(){return _0x3fee16;});}else{return _0x3fee16;}})[_0x62dd('0x41')](function(_0x190a8d){logger[_0x62dd('0x27')](_0x62dd('0x4d'),_0x190a8d);throw _0x190a8d;});}return _0x3fee16;})[_0x62dd('0x23')](respondWithResult(_0xbb11d9,0xc9))[_0x62dd('0x41')](handleError(_0xbb11d9,null));};exports[_0x62dd('0x4e')]=function(_0x522410,_0xef0de9){var _0x1c03d2={'raw':![],'where':{'id':_0x522410[_0x62dd('0x4f')]['id']}},_0x27e2a8={};_0x27e2a8['model']=_[_0x62dd('0x2e')](db[_0x62dd('0x2b')][_0x62dd('0x2c')]);_0x1c03d2[_0x62dd('0x32')]=_[_0x62dd('0x31')](_0x27e2a8['model'],qs[_0x62dd('0x33')](_0x522410[_0x62dd('0x2f')][_0x62dd('0x33')]));_0x1c03d2[_0x62dd('0x32')]=_0x1c03d2['attributes']['length']?_0x1c03d2['attributes']:_0x27e2a8[_0x62dd('0x2d')];if(_0x522410[_0x62dd('0x2f')][_0x62dd('0x43')]){_0x1c03d2[_0x62dd('0x44')]=[{'all':!![]}];}_0x1c03d2=_['merge']({},_0x1c03d2,_0x522410[_0x62dd('0x3f')]);return db[_0x62dd('0x2b')][_0x62dd('0x45')](_0x1c03d2)[_0x62dd('0x23')](handleEntityNotFound(_0xef0de9,null))[_0x62dd('0x23')](function(_0x16b2b4){if(_0x16b2b4){var _0x1488ae=_0x16b2b4['get']({'plain':!![]});_0x1488ae=qs[_0x62dd('0x50')](_0x1488ae,['id',_0x62dd('0x51'),_0x62dd('0x52')]);_0x522410[_0x62dd('0x47')]=_[_0x62dd('0x50')](_0x522410['body'],['id',_0x62dd('0x51'),_0x62dd('0x52')]);return db[_0x62dd('0x2b')][_0x62dd('0x46')](_[_0x62dd('0x3b')](_0x1488ae,_0x522410[_0x62dd('0x47')]),{'include':_0x522410['query'][_0x62dd('0x43')]?[{'all':!![]}]:undefined})[_0x62dd('0x23')](function(_0x67cf9a){var _0x319ddb=_0x522410[_0x62dd('0x53')][_0x62dd('0x48')]({'plain':!![]});if(!_0x319ddb)throw new Error(_0x62dd('0x49'));if(_0x319ddb[_0x62dd('0x4a')]===_0x62dd('0x53')){var _0x1589e0=_0x67cf9a[_0x62dd('0x48')]({'plain':!![]});var _0x2a9e5e='CustomDashboards';return db[_0x62dd('0x4b')]['find']({'where':{'name':_0x2a9e5e,'userProfileId':_0x319ddb[_0x62dd('0x4c')]},'raw':!![]})['then'](function(_0x35ef31){if(_0x35ef31&&_0x35ef31[_0x62dd('0x54')]===0x0){return db[_0x62dd('0x25')][_0x62dd('0x46')]({'name':_0x1589e0[_0x62dd('0x29')],'resourceId':_0x1589e0['id'],'type':_0x35ef31[_0x62dd('0x29')],'sectionId':_0x35ef31['id']},{})['then'](function(){return _0x67cf9a;});}else{return _0x67cf9a;}})[_0x62dd('0x41')](function(_0x1a2003){logger[_0x62dd('0x27')](_0x62dd('0x4d'),_0x1a2003);throw _0x1a2003;});}return _0x67cf9a;});}})['then'](respondWithResult(_0xef0de9,0xc9))[_0x62dd('0x41')](handleError(_0xef0de9,null));};exports[_0x62dd('0x21')]=function(_0x43cfc9,_0x336221){if(_0x43cfc9[_0x62dd('0x47')]['id']){delete _0x43cfc9[_0x62dd('0x47')]['id'];}return db['Dashboard'][_0x62dd('0x45')]({'where':{'id':_0x43cfc9[_0x62dd('0x4f')]['id']}})[_0x62dd('0x23')](handleEntityNotFound(_0x336221,null))[_0x62dd('0x23')](saveUpdates(_0x43cfc9[_0x62dd('0x47')],null))[_0x62dd('0x23')](respondWithResult(_0x336221,null))[_0x62dd('0x41')](handleError(_0x336221,null));};exports['destroy']=function(_0x371a37,_0x5a0f6d){return db[_0x62dd('0x2b')][_0x62dd('0x45')]({'where':{'id':_0x371a37[_0x62dd('0x4f')]['id']}})[_0x62dd('0x23')](handleEntityNotFound(_0x5a0f6d,null))[_0x62dd('0x23')](removeEntity(_0x5a0f6d,null))[_0x62dd('0x41')](handleError(_0x5a0f6d,null));};function widgetAttributes(_0x1391cc){try{switch(_0x1391cc[_0x62dd('0x3d')]){case'iframe':return[{'name':_0x62dd('0x55'),'value':_0x1391cc['attrUrl']||(_0x1391cc['attrs']&&_0x1391cc[_0x62dd('0x56')][0x0]?_0x1391cc[_0x62dd('0x56')][0x0][_0x62dd('0x57')]:undefined)||'https://'}];case'custom':return[{'name':_0x62dd('0x58'),'value':_0x1391cc[_0x62dd('0x58')]||(_0x1391cc['attrs']&&_0x1391cc[_0x62dd('0x56')][0x0]?_0x1391cc[_0x62dd('0x56')][0x0][_0x62dd('0x57')]:undefined)||''}];case _0x62dd('0x59'):return[{'name':_0x62dd('0x5a'),'value':_0x1391cc[_0x62dd('0x5a')]||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc['attrs'][0x0]?_0x1391cc[_0x62dd('0x56')][0x0]['value']:undefined)||_0x62dd('0x5b')},{'name':_0x62dd('0x5c'),'value':_0x1391cc[_0x62dd('0x5c')]||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x1]?_0x1391cc['attrs'][0x1][_0x62dd('0x57')]:undefined)||_0x62dd('0x5d')},{'name':_0x62dd('0x5e'),'value':_0x1391cc[_0x62dd('0x5e')]||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x2]?_0x1391cc[_0x62dd('0x56')][0x2][_0x62dd('0x57')]:undefined)||0xc}];case _0x62dd('0x5f'):return[{'name':'attrMetric','value':_0x1391cc['attrMetric']||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x0]?_0x1391cc[_0x62dd('0x56')][0x0][_0x62dd('0x57')]:undefined)||_0x62dd('0x60')},{'name':_0x62dd('0x61'),'value':_0x1391cc['attrVoiceQueues']||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x1]?_0x1391cc[_0x62dd('0x56')][0x1]['value']:undefined)||[]},{'name':_0x62dd('0x5e'),'value':_0x1391cc[_0x62dd('0x5e')]||(_0x1391cc['attrs']&&_0x1391cc[_0x62dd('0x56')][0x2]?_0x1391cc[_0x62dd('0x56')][0x2][_0x62dd('0x57')]:undefined)||0x14}];case _0x62dd('0x62'):case _0x62dd('0x63'):return[{'name':'attrSerie1','value':_0x1391cc[_0x62dd('0x64')]||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x0]?_0x1391cc['attrs'][0x0][_0x62dd('0x57')]:undefined)||'total'},{'name':'attrSerie2','value':_0x1391cc[_0x62dd('0x65')]||(_0x1391cc['attrs']&&_0x1391cc[_0x62dd('0x56')][0x1]?_0x1391cc[_0x62dd('0x56')][0x1]['value']:undefined)||null},{'name':_0x62dd('0x66'),'value':_0x1391cc['attrSerie3']||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x2]?_0x1391cc[_0x62dd('0x56')][0x2][_0x62dd('0x57')]:undefined)||null},{'name':_0x62dd('0x61'),'value':_0x1391cc[_0x62dd('0x61')]||(_0x1391cc['attrs']&&_0x1391cc[_0x62dd('0x56')][0x3]?_0x1391cc[_0x62dd('0x56')][0x3][_0x62dd('0x57')]:undefined)||[]}];case _0x62dd('0x67'):return[{'name':_0x62dd('0x68'),'type':_0x1391cc['reportType']||(_0x1391cc['attrs']&&_0x1391cc[_0x62dd('0x56')][0x0]?_0x1391cc['attrs'][0x0][_0x62dd('0x3d')]:undefined)||null,'value':_0x1391cc[_0x62dd('0x68')]||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc[_0x62dd('0x56')][0x0]?_0x1391cc[_0x62dd('0x56')][0x0][_0x62dd('0x57')]:undefined)||null},{'name':_0x62dd('0x69'),'value':_0x1391cc[_0x62dd('0x69')]||(_0x1391cc[_0x62dd('0x56')]&&_0x1391cc['attrs'][0x1]?_0x1391cc[_0x62dd('0x56')][0x1][_0x62dd('0x57')]:undefined)||0x0}];default:return[];}}catch(_0x4578f2){logger['error'](_0x62dd('0x6a'),JSON[_0x62dd('0x6b')](_0x4578f2));return[];}}exports['addItem']=function(_0x23cca3,_0x2ba552,_0x1ec779){if(_0x23cca3['body']['id']){delete _0x23cca3[_0x62dd('0x47')]['id'];}return db[_0x62dd('0x2b')]['find']({'where':{'id':_0x23cca3['params']['id']}})[_0x62dd('0x23')](handleEntityNotFound(_0x2ba552,null))[_0x62dd('0x23')](function(_0x1a48d0){if(_0x1a48d0){_0x23cca3['body'][_0x62dd('0x6c')]=_0x1a48d0['id'];_0x23cca3[_0x62dd('0x47')]['attrs']=widgetAttributes(_0x23cca3[_0x62dd('0x47')]);return db[_0x62dd('0x6d')]['create'](_0x23cca3[_0x62dd('0x47')]);}})[_0x62dd('0x23')](respondWithResult(_0x2ba552,null))['catch'](handleError(_0x2ba552,null));};exports[_0x62dd('0x6e')]=function(_0x4e1f8f,_0x5ca450,_0x3448d0){var _0x3a4783={};var _0x4312ce={};var _0x4157b4;var _0x5b1877;return db[_0x62dd('0x2b')][_0x62dd('0x6f')]({'where':{'id':_0x4e1f8f['params']['id']}})[_0x62dd('0x23')](handleEntityNotFound(_0x5ca450,null))['then'](function(_0x2737a2){if(_0x2737a2){_0x4157b4=_0x2737a2;_0x4312ce[_0x62dd('0x2d')]=_['keys'](db[_0x62dd('0x6d')][_0x62dd('0x2c')]);_0x4312ce[_0x62dd('0x2f')]=_[_0x62dd('0x2e')](_0x4e1f8f['query']);_0x4312ce[_0x62dd('0x30')]=_[_0x62dd('0x31')](_0x4312ce[_0x62dd('0x2d')],_0x4312ce[_0x62dd('0x2f')]);_0x3a4783['attributes']=_[_0x62dd('0x31')](_0x4312ce[_0x62dd('0x2d')],qs[_0x62dd('0x33')](_0x4e1f8f[_0x62dd('0x2f')][_0x62dd('0x33')]));_0x3a4783[_0x62dd('0x32')]=_0x3a4783[_0x62dd('0x32')][_0x62dd('0x34')]?_0x3a4783['attributes']:_0x4312ce[_0x62dd('0x2d')];_0x3a4783['order']=qs['sort'](_0x4e1f8f['query'][_0x62dd('0x37')]);_0x3a4783[_0x62dd('0x38')]=qs[_0x62dd('0x30')](_['pick'](_0x4e1f8f[_0x62dd('0x2f')],_0x4312ce[_0x62dd('0x30')]));if(_0x4e1f8f[_0x62dd('0x2f')]['filter']){_0x3a4783[_0x62dd('0x38')]=_[_0x62dd('0x3b')](_0x3a4783[_0x62dd('0x38')],{'$or':_[_0x62dd('0x3c')](_0x3a4783[_0x62dd('0x32')],function(_0xe0b1a8){var _0x6d41d9={};_0x6d41d9[_0xe0b1a8]={'$like':'%'+_0x4e1f8f[_0x62dd('0x2f')][_0x62dd('0x3a')]+'%'};return _0x6d41d9;})});}_0x3a4783=_[_0x62dd('0x3b')]({},_0x3a4783,_0x4e1f8f[_0x62dd('0x3f')]);return _0x4157b4[_0x62dd('0x6e')](_0x3a4783);}})['then'](function(_0xb65b5c){if(_0xb65b5c){_0x5b1877=_0xb65b5c[_0x62dd('0x34')];if(!_0x4e1f8f[_0x62dd('0x2f')]['hasOwnProperty']('nolimit')){_0x3a4783['limit']=qs[_0x62dd('0x1d')](_0x4e1f8f[_0x62dd('0x2f')]['limit']);_0x3a4783[_0x62dd('0x1c')]=qs[_0x62dd('0x1c')](_0x4e1f8f[_0x62dd('0x2f')][_0x62dd('0x1c')]);}return _0x4157b4['getItems'](_0x3a4783);}})[_0x62dd('0x23')](function(_0x25c584){if(_0x25c584){return _0x25c584?{'count':_0x5b1877,'rows':_0x25c584}:null;}})[_0x62dd('0x23')](respondWithResult(_0x5ca450,null))[_0x62dd('0x41')](handleError(_0x5ca450,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 61e7a30..2af75eb 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 _0x0d91=['Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x56cca2,_0x4834fd){var _0xe7df26=function(_0x56ceb4){while(--_0x56ceb4){_0x56cca2['push'](_0x56cca2['shift']());}};_0xe7df26(++_0x4834fd);}(_0x0d91,0x76));var _0x10d9=function(_0x42f62c,_0x3f5a42){_0x42f62c=_0x42f62c-0x0;var _0x58b6e9=_0x0d91[_0x42f62c];return _0x58b6e9;};'use strict';var EventEmitter=require(_0x10d9('0x0'));var Dashboard=require(_0x10d9('0x1'))['db'][_0x10d9('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x10d9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x10d9('0x4'),'afterDestroy':_0x10d9('0x5')};function emitEvent(_0x132a71){return function(_0x56ab5d,_0x2f6e57,_0x305c20){DashboardEvents[_0x10d9('0x6')](_0x132a71+':'+_0x56ab5d['id'],_0x56ab5d);DashboardEvents['emit'](_0x132a71,_0x56ab5d);_0x305c20(null);};}for(var e in events){if(events[_0x10d9('0x7')](e)){var event=events[e];Dashboard[_0x10d9('0x8')](e,emitEvent(event));}}module[_0x10d9('0x9')]=DashboardEvents; \ No newline at end of file +var _0x9b97=['setMaxListeners','save','update','remove','emit','hook','exports','events','Dashboard'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x9b97,0x11e));var _0x79b9=function(_0x32820f,_0x90bceb){_0x32820f=_0x32820f-0x0;var _0x412131=_0x9b97[_0x32820f];return _0x412131;};'use strict';var EventEmitter=require(_0x79b9('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x79b9('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x79b9('0x2')](0x0);var events={'afterCreate':_0x79b9('0x3'),'afterUpdate':_0x79b9('0x4'),'afterDestroy':_0x79b9('0x5')};function emitEvent(_0x10c823){return function(_0x4edfcf,_0x5194ab,_0x1e0ed2){DashboardEvents[_0x79b9('0x6')](_0x10c823+':'+_0x4edfcf['id'],_0x4edfcf);DashboardEvents[_0x79b9('0x6')](_0x10c823,_0x4edfcf);_0x1e0ed2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x79b9('0x7')](e,emitEvent(event));}}module[_0x79b9('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 74fe760..150c4d6 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 _0x27c7=['bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment'];(function(_0x1717bf,_0x31e465){var _0xfac6b5=function(_0x2f3140){while(--_0x2f3140){_0x1717bf['push'](_0x1717bf['shift']());}};_0xfac6b5(++_0x31e465);}(_0x27c7,0x10d));var _0x727c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x27c7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x727c('0x0'));var util=require(_0x727c('0x1'));var logger=require(_0x727c('0x2'))('api');var moment=require(_0x727c('0x3'));var BPromise=require(_0x727c('0x4'));var rp=require(_0x727c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x727c('0x6'));var config=require(_0x727c('0x7'));var attributes=require(_0x727c('0x8'));module[_0x727c('0x9')]=function(_0x4db2fe,_0x1d6c6f){return _0x4db2fe[_0x727c('0xa')](_0x727c('0xb'),attributes,{'tableName':_0x727c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f29=['dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x6dd381,_0x8da5f9){var _0x8c11fb=function(_0x1a090b){while(--_0x1a090b){_0x6dd381['push'](_0x6dd381['shift']());}};_0x8c11fb(++_0x8da5f9);}(_0x4f29,0xfd));var _0x94f2=function(_0x1dc1b3,_0x47ef78){_0x1dc1b3=_0x1dc1b3-0x0;var _0x18a08f=_0x4f29[_0x1dc1b3];return _0x18a08f;};'use strict';var _=require('lodash');var util=require(_0x94f2('0x0'));var logger=require(_0x94f2('0x1'))(_0x94f2('0x2'));var moment=require(_0x94f2('0x3'));var BPromise=require(_0x94f2('0x4'));var rp=require(_0x94f2('0x5'));var fs=require('fs');var path=require(_0x94f2('0x6'));var rimraf=require(_0x94f2('0x7'));var config=require(_0x94f2('0x8'));var attributes=require(_0x94f2('0x9'));module[_0x94f2('0xa')]=function(_0x493302,_0x5e9216){return _0x493302[_0x94f2('0xb')](_0x94f2('0xc'),attributes,{'tableName':_0x94f2('0xd'),'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 1f7c847..c1d1c69 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 _0xbd26=['register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket'];(function(_0x243dcc,_0x191627){var _0x5bb0ce=function(_0x1d81fa){while(--_0x1d81fa){_0x243dcc['push'](_0x243dcc['shift']());}};_0x5bb0ce(++_0x191627);}(_0xbd26,0x1ab));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bd2('0x0'));var util=require(_0x6bd2('0x1'));var moment=require(_0x6bd2('0x2'));var BPromise=require(_0x6bd2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6bd2('0x5'));var logger=require('../../config/logger')(_0x6bd2('0x6'));var config=require('../../config/environment');var jayson=require(_0x6bd2('0x7'));var client=jayson[_0x6bd2('0x8')][_0x6bd2('0x9')]({'port':0x232a});config[_0x6bd2('0xa')]=_[_0x6bd2('0xb')](config['redis'],{'host':_0x6bd2('0xc'),'port':0x18eb});var socket=require(_0x6bd2('0xd'))(new Redis(config['redis']));require(_0x6bd2('0xe'))[_0x6bd2('0xf')](socket);function respondWithRpcPromise(_0x3b23a2,_0x397842,_0x3b85cd){return new BPromise(function(_0x9eb58c,_0x31e6c6){return client['request'](_0x3b23a2,_0x3b85cd)[_0x6bd2('0x10')](function(_0x4f3d5d){logger[_0x6bd2('0x11')](_0x6bd2('0x12'),_0x397842,_0x6bd2('0x13'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x397842,_0x6bd2('0x13'),JSON[_0x6bd2('0x14')](_0x4f3d5d));if(_0x4f3d5d[_0x6bd2('0x15')]){if(_0x4f3d5d[_0x6bd2('0x15')][_0x6bd2('0x16')]===0x1f4){logger[_0x6bd2('0x15')](_0x6bd2('0x12'),_0x397842,_0x4f3d5d[_0x6bd2('0x15')][_0x6bd2('0x17')]);return _0x31e6c6(_0x4f3d5d[_0x6bd2('0x15')]['message']);}logger[_0x6bd2('0x15')](_0x6bd2('0x12'),_0x397842,_0x4f3d5d[_0x6bd2('0x15')][_0x6bd2('0x17')]);return _0x9eb58c(_0x4f3d5d['error'][_0x6bd2('0x17')]);}else{logger[_0x6bd2('0x11')](_0x6bd2('0x12'),_0x397842,_0x6bd2('0x13'));_0x9eb58c(_0x4f3d5d[_0x6bd2('0x18')][_0x6bd2('0x17')]);}})[_0x6bd2('0x19')](function(_0x21fc9c){logger[_0x6bd2('0x15')](_0x6bd2('0x12'),_0x397842,_0x21fc9c);_0x31e6c6(_0x21fc9c);});});} \ No newline at end of file +var _0x6f2b=['request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','register'];(function(_0x17a329,_0x5d2f43){var _0x761387=function(_0x2e1ad3){while(--_0x2e1ad3){_0x17a329['push'](_0x17a329['shift']());}};_0x761387(++_0x5d2f43);}(_0x6f2b,0x152));var _0xb6f2=function(_0xfc7f52,_0x9f3213){_0xfc7f52=_0xfc7f52-0x0;var _0x5952ed=_0x6f2b[_0xfc7f52];return _0x5952ed;};'use strict';var _=require('lodash');var util=require(_0xb6f2('0x0'));var moment=require(_0xb6f2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6f2('0x2'));var db=require(_0xb6f2('0x3'))['db'];var utils=require(_0xb6f2('0x4'));var logger=require(_0xb6f2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb6f2('0x6'));var client=jayson[_0xb6f2('0x7')]['http']({'port':0x232a});config[_0xb6f2('0x8')]=_['defaults'](config[_0xb6f2('0x8')],{'host':_0xb6f2('0x9'),'port':0x18eb});var socket=require(_0xb6f2('0xa'))(new Redis(config[_0xb6f2('0x8')]));require('./dashboard.socket')[_0xb6f2('0xb')](socket);function respondWithRpcPromise(_0x206d92,_0x1a35b8,_0x50f014){return new BPromise(function(_0x1c5c00,_0x552c94){return client[_0xb6f2('0xc')](_0x206d92,_0x50f014)[_0xb6f2('0xd')](function(_0x4850f){logger[_0xb6f2('0xe')](_0xb6f2('0xf'),_0x1a35b8,_0xb6f2('0x10'));logger[_0xb6f2('0x11')](_0xb6f2('0x12'),_0x1a35b8,'request\x20sent',JSON[_0xb6f2('0x13')](_0x4850f));if(_0x4850f[_0xb6f2('0x14')]){if(_0x4850f[_0xb6f2('0x14')][_0xb6f2('0x15')]===0x1f4){logger[_0xb6f2('0x14')](_0xb6f2('0xf'),_0x1a35b8,_0x4850f[_0xb6f2('0x14')][_0xb6f2('0x16')]);return _0x552c94(_0x4850f[_0xb6f2('0x14')][_0xb6f2('0x16')]);}logger[_0xb6f2('0x14')](_0xb6f2('0xf'),_0x1a35b8,_0x4850f[_0xb6f2('0x14')][_0xb6f2('0x16')]);return _0x1c5c00(_0x4850f[_0xb6f2('0x14')][_0xb6f2('0x16')]);}else{logger[_0xb6f2('0xe')](_0xb6f2('0xf'),_0x1a35b8,_0xb6f2('0x10'));_0x1c5c00(_0x4850f[_0xb6f2('0x17')][_0xb6f2('0x16')]);}})[_0xb6f2('0x18')](function(_0x1455ce){logger[_0xb6f2('0x14')](_0xb6f2('0xf'),_0x1a35b8,_0x1455ce);_0x552c94(_0x1455ce);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5c695c2..c4ebee5 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 _0x973d=['update','removeListener','register','dashboard:','./dashboard.events','save','remove'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x973d,0xf9));var _0xd973=function(_0x18381f,_0x1497e1){_0x18381f=_0x18381f-0x0;var _0x517079=_0x973d[_0x18381f];return _0x517079;};'use strict';var DashboardEvents=require(_0xd973('0x0'));var events=[_0xd973('0x1'),_0xd973('0x2'),_0xd973('0x3')];function createListener(_0x4f78bc,_0x45e7b7){return function(_0x4a8c78){_0x45e7b7['emit'](_0x4f78bc,_0x4a8c78);};}function removeListener(_0x550d27,_0x1f5180){return function(){DashboardEvents[_0xd973('0x4')](_0x550d27,_0x1f5180);};}exports[_0xd973('0x5')]=function(_0x18d89b){for(var _0x50f512=0x0,_0x23b569=events['length'];_0x50f512<_0x23b569;_0x50f512++){var _0x406afd=events[_0x50f512];var _0x4411f9=createListener(_0xd973('0x6')+_0x406afd,_0x18d89b);DashboardEvents['on'](_0x406afd,_0x4411f9);}}; \ No newline at end of file +var _0x65ae=['register','length','save','emit','removeListener'];(function(_0x5b4737,_0xf1380b){var _0x244d3a=function(_0x116f42){while(--_0x116f42){_0x5b4737['push'](_0x5b4737['shift']());}};_0x244d3a(++_0xf1380b);}(_0x65ae,0x1c9));var _0xe65a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65ae[_0x14add3];return _0x4a174f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xe65a('0x0'),'remove','update'];function createListener(_0x57bf26,_0x5114cc){return function(_0x1644c5){_0x5114cc[_0xe65a('0x1')](_0x57bf26,_0x1644c5);};}function removeListener(_0x253ad1,_0x1e88ca){return function(){DashboardEvents[_0xe65a('0x2')](_0x253ad1,_0x1e88ca);};}exports[_0xe65a('0x3')]=function(_0x1de52e){for(var _0x3d619d=0x0,_0x2fd447=events[_0xe65a('0x4')];_0x3d619d<_0x2fd447;_0x3d619d++){var _0x303812=events[_0x3d619d];var _0x97d9ce=createListener('dashboard:'+_0x303812,_0x1de52e);DashboardEvents['on'](_0x303812,_0x97d9ce);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 32b82fa..9b603ad 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 _0x304d=['clone','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/items','getItems','post','/:id/clone'];(function(_0x455c1b,_0x21b689){var _0x101805=function(_0x371c23){while(--_0x371c23){_0x455c1b['push'](_0x455c1b['shift']());}};_0x101805(++_0x21b689);}(_0x304d,0x99));var _0xd304=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x304d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var path=require(_0xd304('0x2'));var timeout=require('connect-timeout');var express=require(_0xd304('0x3'));var router=express[_0xd304('0x4')]();var auth=require(_0xd304('0x5'));var interaction=require(_0xd304('0x6'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0xd304('0x7')]('/',auth[_0xd304('0x8')](),controller[_0xd304('0x9')]);router['get'](_0xd304('0xa'),auth[_0xd304('0x8')](),controller['show']);router[_0xd304('0x7')](_0xd304('0xb'),auth[_0xd304('0x8')](),controller[_0xd304('0xc')]);router[_0xd304('0xd')]('/',auth[_0xd304('0x8')](),controller['create']);router['post'](_0xd304('0xe'),auth[_0xd304('0x8')](),controller[_0xd304('0xf')]);router[_0xd304('0xd')](_0xd304('0xb'),auth[_0xd304('0x8')](),controller['addItem']);router[_0xd304('0x10')](_0xd304('0xa'),auth[_0xd304('0x8')](),controller[_0xd304('0x11')]);router[_0xd304('0x12')](_0xd304('0xa'),auth['isAuthenticated'](),controller[_0xd304('0x13')]);module[_0xd304('0x14')]=router; \ No newline at end of file +var _0x2701=['get','/:id','show','getItems','post','create','/:id/clone','clone','/:id/items','addItem','update','delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./dashboard.controller','isAuthenticated','index'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x2701,0x1f2));var _0x1270=function(_0x32800a,_0x3002c3){_0x32800a=_0x32800a-0x0;var _0x1cffd7=_0x2701[_0x32800a];return _0x1cffd7;};'use strict';var multer=require(_0x1270('0x0'));var util=require(_0x1270('0x1'));var path=require('path');var timeout=require(_0x1270('0x2'));var express=require(_0x1270('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1270('0x4'));var controller=require(_0x1270('0x5'));router['get']('/',auth[_0x1270('0x6')](),controller[_0x1270('0x7')]);router[_0x1270('0x8')](_0x1270('0x9'),auth['isAuthenticated'](),controller[_0x1270('0xa')]);router[_0x1270('0x8')]('/:id/items',auth[_0x1270('0x6')](),controller[_0x1270('0xb')]);router[_0x1270('0xc')]('/',auth[_0x1270('0x6')](),controller[_0x1270('0xd')]);router['post'](_0x1270('0xe'),auth['isAuthenticated'](),controller[_0x1270('0xf')]);router[_0x1270('0xc')](_0x1270('0x10'),auth[_0x1270('0x6')](),controller[_0x1270('0x11')]);router['put'](_0x1270('0x9'),auth[_0x1270('0x6')](),controller[_0x1270('0x12')]);router[_0x1270('0x13')]('/:id',auth[_0x1270('0x6')](),controller[_0x1270('0x14')]);module[_0x1270('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8da61c9..a17af46 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 _0xa9d7=['stringify','INTEGER','sequelize','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue'];(function(_0x4d782f,_0x339b1d){var _0x5b5f20=function(_0x364ced){while(--_0x364ced){_0x4d782f['push'](_0x4d782f['shift']());}};_0x5b5f20(++_0x339b1d);}(_0xa9d7,0xf2));var _0x7a9d=function(_0x15259e,_0x42a516){_0x15259e=_0x15259e-0x0;var _0x463a53=_0xa9d7[_0x15259e];return _0x463a53;};'use strict';var Sequelize=require(_0x7a9d('0x0'));var squel=require('squel');var _=require('lodash');module[_0x7a9d('0x1')]={'title':{'type':Sequelize[_0x7a9d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7a9d('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7a9d('0x3')](_0x7a9d('0x4')),'get':function(){try{return JSON['parse'](this[_0x7a9d('0x5')](_0x7a9d('0x6')));}catch(_0x157a9e){return[];}},'set':function(_0x4adc02){try{this[_0x7a9d('0x7')](_0x7a9d('0x6'),JSON[_0x7a9d('0x8')](_0x4adc02));}catch(_0x22c570){this[_0x7a9d('0x7')](_0x7a9d('0x6'),JSON[_0x7a9d('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x7a9d('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x7a9d('0x9')]},'background':{'type':Sequelize[_0x7a9d('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x112c=['exports','STRING','TEXT','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash'];(function(_0x2c9527,_0x3d3e1d){var _0x2fd230=function(_0x301888){while(--_0x301888){_0x2c9527['push'](_0x2c9527['shift']());}};_0x2fd230(++_0x3d3e1d);}(_0x112c,0x111));var _0xc112=function(_0x481a6f,_0x22837f){_0x481a6f=_0x481a6f-0x0;var _0x5d1835=_0x112c[_0x481a6f];return _0x5d1835;};'use strict';var Sequelize=require(_0xc112('0x0'));var squel=require(_0xc112('0x1'));var _=require(_0xc112('0x2'));module[_0xc112('0x3')]={'title':{'type':Sequelize[_0xc112('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xc112('0x5')]('long'),'get':function(){try{return JSON['parse'](this[_0xc112('0x6')]('attrs'));}catch(_0x38ef55){return[];}},'set':function(_0x774da4){try{this['setDataValue'](_0xc112('0x7'),JSON['stringify'](_0x774da4));}catch(_0x11ab15){this[_0xc112('0x8')](_0xc112('0x7'),JSON[_0xc112('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xc112('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xc112('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xc112('0xa')]},'col':{'type':Sequelize[_0xc112('0xa')]},'background':{'type':Sequelize[_0xc112('0x4')],'allowNull':![],'defaultValue':_0xc112('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xc112('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e0ea9e9..bb7dd49 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 _0x28a6=['limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','model','DashboardItem','query','intersection','attributes','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset'];(function(_0x16ccd5,_0x205109){var _0x496121=function(_0x16fe44){while(--_0x16fe44){_0x16ccd5['push'](_0x16ccd5['shift']());}};_0x496121(++_0x205109);}(_0x28a6,0x86));var _0x628a=function(_0x5adb18,_0x222326){_0x5adb18=_0x5adb18-0x0;var _0x420c98=_0x28a6[_0x5adb18];return _0x420c98;};'use strict';var pdf=require(_0x628a('0x0'));var emlformat=require(_0x628a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x628a('0x2'));var jsonpatch=require(_0x628a('0x3'));var rp=require(_0x628a('0x4'));var moment=require(_0x628a('0x5'));var BPromise=require(_0x628a('0x6'));var Mustache=require(_0x628a('0x7'));var util=require('util');var path=require(_0x628a('0x8'));var sox=require(_0x628a('0x9'));var csv=require(_0x628a('0xa'));var ejs=require(_0x628a('0xb'));var fs=require('fs');var _=require(_0x628a('0xc'));var squel=require('squel');var crypto=require(_0x628a('0xd'));var jsforce=require(_0x628a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x628a('0xa'));var querystring=require('querystring');var Papa=require(_0x628a('0xf'));var Redis=require('ioredis');var authService=require(_0x628a('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x628a('0x11'));var utils=require('../../config/utils');var config=require(_0x628a('0x12'));var db=require(_0x628a('0x13'))['db'];config[_0x628a('0x14')]=_['defaults'](config[_0x628a('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x628a('0x15'))(new Redis(config[_0x628a('0x14')]));require(_0x628a('0x16'))[_0x628a('0x17')](socket);function respondWithStatusCode(_0x2dff60,_0x17856b){_0x17856b=_0x17856b||0xcc;return function(_0x11068f){if(_0x11068f){return _0x2dff60[_0x628a('0x18')](_0x17856b);}return _0x2dff60[_0x628a('0x19')](_0x17856b)[_0x628a('0x1a')]();};}function respondWithResult(_0x2ae107,_0x29b93c){_0x29b93c=_0x29b93c||0xc8;return function(_0x4dc42a){if(_0x4dc42a){return _0x2ae107[_0x628a('0x19')](_0x29b93c)[_0x628a('0x1b')](_0x4dc42a);}};}function respondWithFilteredResult(_0x839222,_0x1b6ec9){return function(_0x14baf9){if(_0x14baf9){var _0x41a387=_0x14baf9[_0x628a('0x1c')],_0x1c29d7=_0x1b6ec9[_0x628a('0x1d')],_0xe81b6d=_0x1b6ec9['offset']+_0x1b6ec9[_0x628a('0x1e')],_0x4f1256;if(_0xe81b6d>=_0x41a387){_0xe81b6d=_0x41a387;_0x4f1256=0xc8;}else{_0x4f1256=0xce;}_0x839222[_0x628a('0x19')](_0x4f1256);return _0x839222['set'](_0x628a('0x1f'),_0x1c29d7+'-'+_0xe81b6d+'/'+_0x41a387)[_0x628a('0x1b')](_0x14baf9);}return null;};}function patchUpdates(_0x4ddacb){return function(_0x7f4acd){try{jsonpatch[_0x628a('0x20')](_0x7f4acd,_0x4ddacb,!![]);}catch(_0x103600){return BPromise['reject'](_0x103600);}return _0x7f4acd[_0x628a('0x21')]();};}function saveUpdates(_0x164c95,_0x3c4148){return function(_0xdcedbe){if(_0xdcedbe){return _0xdcedbe[_0x628a('0x22')](_0x164c95)[_0x628a('0x23')](function(_0xe11678){return _0xe11678;});}return null;};}function removeEntity(_0x58bbe6,_0x18c9f6){return function(_0x2cddb2){if(_0x2cddb2){return _0x2cddb2[_0x628a('0x24')]()['then'](function(){_0x58bbe6[_0x628a('0x19')](0xcc)[_0x628a('0x1a')]();});}};}function handleEntityNotFound(_0x242fa2,_0x2ffd63){return function(_0x4df9cd){if(!_0x4df9cd){_0x242fa2['sendStatus'](0x194);}return _0x4df9cd;};}function handleError(_0x352ff1,_0x40c949){_0x40c949=_0x40c949||0x1f4;return function(_0x46cb0d){logger[_0x628a('0x25')](_0x46cb0d[_0x628a('0x26')]);if(_0x46cb0d[_0x628a('0x27')]){delete _0x46cb0d[_0x628a('0x27')];}_0x352ff1['status'](_0x40c949)[_0x628a('0x28')](_0x46cb0d);};}exports[_0x628a('0x29')]=function(_0x1eb514,_0x166412){var _0x1e730c={'raw':![],'where':{'id':_0x1eb514['params']['id']}},_0xb1b2d0={};_0xb1b2d0[_0x628a('0x2a')]=_['keys'](db[_0x628a('0x2b')]['rawAttributes']);_0xb1b2d0[_0x628a('0x2c')]=_['keys'](_0x1eb514['query']);_0xb1b2d0['filters']=_[_0x628a('0x2d')](_0xb1b2d0[_0x628a('0x2a')],_0xb1b2d0[_0x628a('0x2c')]);_0x1e730c[_0x628a('0x2e')]=_[_0x628a('0x2d')](_0xb1b2d0[_0x628a('0x2a')],qs[_0x628a('0x2f')](_0x1eb514[_0x628a('0x2c')]['fields']));_0x1e730c['attributes']=_0x1e730c[_0x628a('0x2e')][_0x628a('0x30')]?_0x1e730c[_0x628a('0x2e')]:_0xb1b2d0[_0x628a('0x2a')];if(_0x1eb514[_0x628a('0x2c')]['includeAll']){_0x1e730c[_0x628a('0x31')]=[{'all':!![]}];}_0x1e730c=_[_0x628a('0x32')]({},_0x1e730c,_0x1eb514[_0x628a('0x33')]);return db[_0x628a('0x2b')][_0x628a('0x34')](_0x1e730c)[_0x628a('0x23')](handleEntityNotFound(_0x166412,null))[_0x628a('0x23')](respondWithResult(_0x166412,null))[_0x628a('0x35')](handleError(_0x166412,null));};exports[_0x628a('0x24')]=function(_0x4d884d,_0x11adcf){return db[_0x628a('0x2b')]['find']({'where':{'id':_0x4d884d['params']['id']}})['then'](handleEntityNotFound(_0x11adcf,null))[_0x628a('0x23')](removeEntity(_0x11adcf,null))['catch'](handleError(_0x11adcf,null));};function widgetAttributes(_0x344d35){try{switch(_0x344d35[_0x628a('0x36')]){case _0x628a('0x37'):return[{'name':_0x628a('0x38'),'value':_0x344d35[_0x628a('0x38')]||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x0]?_0x344d35['attrs'][0x0][_0x628a('0x3a')]:undefined)||_0x628a('0x3b')}];case _0x628a('0x3c'):return[{'name':'attrPath','value':_0x344d35[_0x628a('0x3d')]||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x0]?_0x344d35[_0x628a('0x39')][0x0]['value']:undefined)||''}];case _0x628a('0x3e'):return[{'name':_0x628a('0x3f'),'value':_0x344d35['attrHourFormat']||(_0x344d35[_0x628a('0x39')]&&_0x344d35['attrs'][0x0]?_0x344d35[_0x628a('0x39')][0x0]['value']:undefined)||_0x628a('0x40')},{'name':_0x628a('0x41'),'value':_0x344d35[_0x628a('0x41')]||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x1]?_0x344d35[_0x628a('0x39')][0x1][_0x628a('0x3a')]:undefined)||_0x628a('0x42')},{'name':_0x628a('0x43'),'value':_0x344d35[_0x628a('0x43')]||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x2]?_0x344d35[_0x628a('0x39')][0x2][_0x628a('0x3a')]:undefined)||0xc}];case _0x628a('0x44'):return[{'name':_0x628a('0x45'),'value':_0x344d35[_0x628a('0x45')]||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x0]?_0x344d35[_0x628a('0x39')][0x0][_0x628a('0x3a')]:undefined)||'total'},{'name':_0x628a('0x46'),'value':_0x344d35['attrVoiceQueues']||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x1]?_0x344d35['attrs'][0x1][_0x628a('0x3a')]:undefined)||[]},{'name':_0x628a('0x43'),'value':_0x344d35['attrFontSize']||(_0x344d35['attrs']&&_0x344d35[_0x628a('0x39')][0x2]?_0x344d35[_0x628a('0x39')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x628a('0x47'),'value':_0x344d35[_0x628a('0x47')]||(_0x344d35['attrs']&&_0x344d35['attrs'][0x0]?_0x344d35['attrs'][0x0]['value']:undefined)||_0x628a('0x48')},{'name':'attrSerie2','value':_0x344d35[_0x628a('0x49')]||(_0x344d35['attrs']&&_0x344d35[_0x628a('0x39')][0x1]?_0x344d35['attrs'][0x1][_0x628a('0x3a')]:undefined)||null},{'name':_0x628a('0x4a'),'value':_0x344d35['attrSerie3']||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x2]?_0x344d35[_0x628a('0x39')][0x2]['value']:undefined)||null},{'name':_0x628a('0x46'),'value':_0x344d35[_0x628a('0x46')]||(_0x344d35['attrs']&&_0x344d35[_0x628a('0x39')][0x3]?_0x344d35['attrs'][0x3]['value']:undefined)||[]}];case _0x628a('0x4b'):return[{'name':_0x628a('0x4c'),'type':_0x344d35['reportType']||(_0x344d35[_0x628a('0x39')]&&_0x344d35['attrs'][0x0]?_0x344d35['attrs'][0x0][_0x628a('0x36')]:undefined)||null,'value':_0x344d35[_0x628a('0x4c')]||(_0x344d35[_0x628a('0x39')]&&_0x344d35[_0x628a('0x39')][0x0]?_0x344d35[_0x628a('0x39')][0x0][_0x628a('0x3a')]:undefined)||null},{'name':'attrRefresh','value':_0x344d35['attrRefresh']||(_0x344d35[_0x628a('0x39')]&&_0x344d35['attrs'][0x1]?_0x344d35['attrs'][0x1][_0x628a('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x5cfb36){logger['error'](_0x628a('0x4d'),JSON[_0x628a('0x4e')](_0x5cfb36));return[];}}exports[_0x628a('0x4f')]=function(_0x3e65d3,_0x2ad56d){if(_0x3e65d3[_0x628a('0x50')]){_0x3e65d3[_0x628a('0x50')][_0x628a('0x39')]=widgetAttributes(_0x3e65d3[_0x628a('0x50')]);}return db[_0x628a('0x2b')][_0x628a('0x4f')](_0x3e65d3[_0x628a('0x50')],{})['then'](respondWithResult(_0x2ad56d,0xc9))[_0x628a('0x35')](handleError(_0x2ad56d,null));};exports[_0x628a('0x22')]=function(_0x5ef89d,_0x4cbe55){if(_0x5ef89d[_0x628a('0x50')]['id']){delete _0x5ef89d[_0x628a('0x50')]['id'];}_0x5ef89d['body'][_0x628a('0x39')]=widgetAttributes(_0x5ef89d[_0x628a('0x50')]);return db[_0x628a('0x2b')][_0x628a('0x34')]({'where':{'id':_0x5ef89d[_0x628a('0x51')]['id']}})['then'](handleEntityNotFound(_0x4cbe55,null))[_0x628a('0x23')](saveUpdates(_0x5ef89d[_0x628a('0x50')],null))[_0x628a('0x23')](respondWithResult(_0x4cbe55,null))[_0x628a('0x35')](handleError(_0x4cbe55,null));}; \ No newline at end of file +var _0x1c47=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','status','send','show','params','model','DashboardItem','keys','query','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','counter','attrMetric','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','total','attrSerie2','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','body','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x1c47,0x138));var _0x71c4=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x1c47[_0x26b5ff];return _0x58603e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x71c4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71c4('0x1'));var moment=require(_0x71c4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x71c4('0x3'));var util=require('util');var path=require(_0x71c4('0x4'));var sox=require(_0x71c4('0x5'));var csv=require(_0x71c4('0x6'));var ejs=require(_0x71c4('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x71c4('0x8'));var crypto=require(_0x71c4('0x9'));var jsforce=require(_0x71c4('0xa'));var deskjs=require(_0x71c4('0xb'));var toCsv=require(_0x71c4('0x6'));var querystring=require(_0x71c4('0xc'));var Papa=require(_0x71c4('0xd'));var Redis=require(_0x71c4('0xe'));var authService=require(_0x71c4('0xf'));var qs=require(_0x71c4('0x10'));var hardwareService=require(_0x71c4('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x71c4('0x12'));var config=require('../../config/environment');var db=require(_0x71c4('0x13'))['db'];config[_0x71c4('0x14')]=_['defaults'](config[_0x71c4('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x71c4('0x15'))(new Redis(config[_0x71c4('0x14')]));require(_0x71c4('0x16'))[_0x71c4('0x17')](socket);function respondWithStatusCode(_0x290ea7,_0x15674c){_0x15674c=_0x15674c||0xcc;return function(_0x1ad7c0){if(_0x1ad7c0){return _0x290ea7['sendStatus'](_0x15674c);}return _0x290ea7['status'](_0x15674c)[_0x71c4('0x18')]();};}function respondWithResult(_0x19e2e6,_0x4c55a2){_0x4c55a2=_0x4c55a2||0xc8;return function(_0x817148){if(_0x817148){return _0x19e2e6['status'](_0x4c55a2)[_0x71c4('0x19')](_0x817148);}};}function respondWithFilteredResult(_0x23494d,_0x2136ec){return function(_0x5be852){if(_0x5be852){var _0x28af67=_0x5be852[_0x71c4('0x1a')],_0x3c76e6=_0x2136ec[_0x71c4('0x1b')],_0x1ef7cb=_0x2136ec['offset']+_0x2136ec[_0x71c4('0x1c')],_0x24aefe;if(_0x1ef7cb>=_0x28af67){_0x1ef7cb=_0x28af67;_0x24aefe=0xc8;}else{_0x24aefe=0xce;}_0x23494d['status'](_0x24aefe);return _0x23494d['set'](_0x71c4('0x1d'),_0x3c76e6+'-'+_0x1ef7cb+'/'+_0x28af67)['json'](_0x5be852);}return null;};}function patchUpdates(_0x44e4a8){return function(_0x175781){try{jsonpatch[_0x71c4('0x1e')](_0x175781,_0x44e4a8,!![]);}catch(_0xbbad46){return BPromise[_0x71c4('0x1f')](_0xbbad46);}return _0x175781[_0x71c4('0x20')]();};}function saveUpdates(_0x52bee1,_0x325fc1){return function(_0x1cb3ef){if(_0x1cb3ef){return _0x1cb3ef[_0x71c4('0x21')](_0x52bee1)['then'](function(_0x1df921){return _0x1df921;});}return null;};}function removeEntity(_0x35566a,_0x50fed1){return function(_0x1f4901){if(_0x1f4901){return _0x1f4901[_0x71c4('0x22')]()[_0x71c4('0x23')](function(){_0x35566a['status'](0xcc)[_0x71c4('0x18')]();});}};}function handleEntityNotFound(_0x50dd2d,_0x7e69fb){return function(_0x27857b){if(!_0x27857b){_0x50dd2d[_0x71c4('0x24')](0x194);}return _0x27857b;};}function handleError(_0x53bb28,_0x43f111){_0x43f111=_0x43f111||0x1f4;return function(_0x26770b){logger[_0x71c4('0x25')](_0x26770b[_0x71c4('0x26')]);if(_0x26770b[_0x71c4('0x27')]){delete _0x26770b[_0x71c4('0x27')];}_0x53bb28[_0x71c4('0x28')](_0x43f111)[_0x71c4('0x29')](_0x26770b);};}exports[_0x71c4('0x2a')]=function(_0x35aa07,_0x326e61){var _0x283cde={'raw':![],'where':{'id':_0x35aa07[_0x71c4('0x2b')]['id']}},_0x5b3758={};_0x5b3758[_0x71c4('0x2c')]=_['keys'](db[_0x71c4('0x2d')]['rawAttributes']);_0x5b3758['query']=_[_0x71c4('0x2e')](_0x35aa07[_0x71c4('0x2f')]);_0x5b3758[_0x71c4('0x30')]=_[_0x71c4('0x31')](_0x5b3758['model'],_0x5b3758[_0x71c4('0x2f')]);_0x283cde['attributes']=_[_0x71c4('0x31')](_0x5b3758[_0x71c4('0x2c')],qs['fields'](_0x35aa07['query']['fields']));_0x283cde[_0x71c4('0x32')]=_0x283cde[_0x71c4('0x32')][_0x71c4('0x33')]?_0x283cde[_0x71c4('0x32')]:_0x5b3758['model'];if(_0x35aa07[_0x71c4('0x2f')][_0x71c4('0x34')]){_0x283cde[_0x71c4('0x35')]=[{'all':!![]}];}_0x283cde=_[_0x71c4('0x36')]({},_0x283cde,_0x35aa07[_0x71c4('0x37')]);return db[_0x71c4('0x2d')][_0x71c4('0x38')](_0x283cde)[_0x71c4('0x23')](handleEntityNotFound(_0x326e61,null))[_0x71c4('0x23')](respondWithResult(_0x326e61,null))[_0x71c4('0x39')](handleError(_0x326e61,null));};exports[_0x71c4('0x22')]=function(_0x303d37,_0x4c2051){return db['DashboardItem']['find']({'where':{'id':_0x303d37['params']['id']}})[_0x71c4('0x23')](handleEntityNotFound(_0x4c2051,null))['then'](removeEntity(_0x4c2051,null))[_0x71c4('0x39')](handleError(_0x4c2051,null));};function widgetAttributes(_0x57ea9f){try{switch(_0x57ea9f[_0x71c4('0x3a')]){case _0x71c4('0x3b'):return[{'name':'attrUrl','value':_0x57ea9f[_0x71c4('0x3c')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f['attrs'][0x0]?_0x57ea9f[_0x71c4('0x3d')][0x0][_0x71c4('0x3e')]:undefined)||_0x71c4('0x3f')}];case _0x71c4('0x40'):return[{'name':_0x71c4('0x41'),'value':_0x57ea9f['attrPath']||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f['attrs'][0x0]?_0x57ea9f[_0x71c4('0x3d')][0x0][_0x71c4('0x3e')]:undefined)||''}];case _0x71c4('0x42'):return[{'name':_0x71c4('0x43'),'value':_0x57ea9f[_0x71c4('0x43')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x0]?_0x57ea9f['attrs'][0x0][_0x71c4('0x3e')]:undefined)||'HH:mm:ss'},{'name':_0x71c4('0x44'),'value':_0x57ea9f[_0x71c4('0x44')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x1]?_0x57ea9f['attrs'][0x1][_0x71c4('0x3e')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x57ea9f['attrFontSize']||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x2]?_0x57ea9f['attrs'][0x2]['value']:undefined)||0xc}];case _0x71c4('0x45'):return[{'name':_0x71c4('0x46'),'value':_0x57ea9f[_0x71c4('0x46')]||(_0x57ea9f['attrs']&&_0x57ea9f['attrs'][0x0]?_0x57ea9f[_0x71c4('0x3d')][0x0]['value']:undefined)||'total'},{'name':_0x71c4('0x47'),'value':_0x57ea9f[_0x71c4('0x47')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f['attrs'][0x1]?_0x57ea9f[_0x71c4('0x3d')][0x1]['value']:undefined)||[]},{'name':_0x71c4('0x48'),'value':_0x57ea9f['attrFontSize']||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f['attrs'][0x2]?_0x57ea9f['attrs'][0x2][_0x71c4('0x3e')]:undefined)||0x14}];case _0x71c4('0x49'):case'pie-chart':return[{'name':_0x71c4('0x4a'),'value':_0x57ea9f[_0x71c4('0x4a')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x0]?_0x57ea9f[_0x71c4('0x3d')][0x0]['value']:undefined)||_0x71c4('0x4b')},{'name':_0x71c4('0x4c'),'value':_0x57ea9f[_0x71c4('0x4c')]||(_0x57ea9f['attrs']&&_0x57ea9f[_0x71c4('0x3d')][0x1]?_0x57ea9f['attrs'][0x1][_0x71c4('0x3e')]:undefined)||null},{'name':'attrSerie3','value':_0x57ea9f['attrSerie3']||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f['attrs'][0x2]?_0x57ea9f[_0x71c4('0x3d')][0x2][_0x71c4('0x3e')]:undefined)||null},{'name':_0x71c4('0x47'),'value':_0x57ea9f[_0x71c4('0x47')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x3]?_0x57ea9f['attrs'][0x3][_0x71c4('0x3e')]:undefined)||[]}];case _0x71c4('0x4d'):return[{'name':_0x71c4('0x4e'),'type':_0x57ea9f['reportType']||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x0]?_0x57ea9f[_0x71c4('0x3d')][0x0][_0x71c4('0x3a')]:undefined)||null,'value':_0x57ea9f[_0x71c4('0x4e')]||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f['attrs'][0x0]?_0x57ea9f[_0x71c4('0x3d')][0x0][_0x71c4('0x3e')]:undefined)||null},{'name':_0x71c4('0x4f'),'value':_0x57ea9f['attrRefresh']||(_0x57ea9f[_0x71c4('0x3d')]&&_0x57ea9f[_0x71c4('0x3d')][0x1]?_0x57ea9f['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x33dc5c){logger['error'](_0x71c4('0x50'),JSON['stringify'](_0x33dc5c));return[];}}exports['create']=function(_0x11321c,_0x377326){if(_0x11321c['body']){_0x11321c['body'][_0x71c4('0x3d')]=widgetAttributes(_0x11321c[_0x71c4('0x51')]);}return db[_0x71c4('0x2d')]['create'](_0x11321c[_0x71c4('0x51')],{})['then'](respondWithResult(_0x377326,0xc9))[_0x71c4('0x39')](handleError(_0x377326,null));};exports['update']=function(_0x462348,_0xa1b9d4){if(_0x462348[_0x71c4('0x51')]['id']){delete _0x462348[_0x71c4('0x51')]['id'];}_0x462348['body'][_0x71c4('0x3d')]=widgetAttributes(_0x462348[_0x71c4('0x51')]);return db[_0x71c4('0x2d')][_0x71c4('0x38')]({'where':{'id':_0x462348[_0x71c4('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa1b9d4,null))[_0x71c4('0x23')](saveUpdates(_0x462348['body'],null))[_0x71c4('0x23')](respondWithResult(_0xa1b9d4,null))['catch'](handleError(_0xa1b9d4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 1a9bc90..90e0697 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 _0xba6f=['update','remove','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save'];(function(_0x54cefb,_0x192225){var _0x5e4fbb=function(_0x5ac5dc){while(--_0x5ac5dc){_0x54cefb['push'](_0x54cefb['shift']());}};_0x5e4fbb(++_0x192225);}(_0xba6f,0x1d0));var _0xfba6=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0xba6f[_0x326e79];return _0x37eb89;};'use strict';var EventEmitter=require(_0xfba6('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xfba6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfba6('0x2')](0x0);var events={'afterCreate':_0xfba6('0x3'),'afterUpdate':_0xfba6('0x4'),'afterDestroy':_0xfba6('0x5')};function emitEvent(_0x2c6e98){return function(_0x3b4dda,_0x3d2803,_0x1bbeb5){DashboardItemEvents[_0xfba6('0x6')](_0x2c6e98+':'+_0x3b4dda['id'],_0x3b4dda);DashboardItemEvents[_0xfba6('0x6')](_0x2c6e98,_0x3b4dda);_0x1bbeb5(null);};}for(var e in events){if(events[_0xfba6('0x7')](e)){var event=events[e];DashboardItem[_0xfba6('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x6901=['remove','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6901,0x100));var _0x1690=function(_0xf22f74,_0x2dba42){_0xf22f74=_0xf22f74-0x0;var _0x322938=_0x6901[_0xf22f74];return _0x322938;};'use strict';var EventEmitter=require(_0x1690('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1690('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1690('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1690('0x3')};function emitEvent(_0x198e19){return function(_0x540bb3,_0x53771c,_0xdf59d3){DashboardItemEvents['emit'](_0x198e19+':'+_0x540bb3['id'],_0x540bb3);DashboardItemEvents['emit'](_0x198e19,_0x540bb3);_0xdf59d3(null);};}for(var e in events){if(events[_0x1690('0x4')](e)){var event=events[e];DashboardItem[_0x1690('0x5')](e,emitEvent(event));}}module[_0x1690('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e61d65b..d1b3902 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 _0x42ff=['define','DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x42ff,0x153));var _0xf42f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x42ff[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xf42f('0x0'));var logger=require(_0xf42f('0x1'))(_0xf42f('0x2'));var moment=require(_0xf42f('0x3'));var BPromise=require(_0xf42f('0x4'));var rp=require(_0xf42f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf42f('0x6'));var config=require(_0xf42f('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xf42f('0x8')]=function(_0x22ea94,_0x77873f){return _0x22ea94[_0xf42f('0x9')](_0xf42f('0xa'),attributes,{'tableName':_0xf42f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcd7=['DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x187dbd,_0x2ecf58){var _0x45d1e9=function(_0x2364c0){while(--_0x2364c0){_0x187dbd['push'](_0x187dbd['shift']());}};_0x45d1e9(++_0x2ecf58);}(_0xdcd7,0x161));var _0x7dcd=function(_0xa8bdc4,_0x39e00c){_0xa8bdc4=_0xa8bdc4-0x0;var _0x1e679c=_0xdcd7[_0xa8bdc4];return _0x1e679c;};'use strict';var _=require('lodash');var util=require(_0x7dcd('0x0'));var logger=require(_0x7dcd('0x1'))(_0x7dcd('0x2'));var moment=require(_0x7dcd('0x3'));var BPromise=require(_0x7dcd('0x4'));var rp=require(_0x7dcd('0x5'));var fs=require('fs');var path=require(_0x7dcd('0x6'));var rimraf=require(_0x7dcd('0x7'));var config=require('../../config/environment');var attributes=require(_0x7dcd('0x8'));module[_0x7dcd('0x9')]=function(_0x18dd87,_0x37d751){return _0x18dd87[_0x7dcd('0xa')](_0x7dcd('0xb'),attributes,{'tableName':_0x7dcd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index f44c7a9..4cf3d12 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 _0xac10=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request'];(function(_0x4689a7,_0x2dd368){var _0x685b0=function(_0x52e1af){while(--_0x52e1af){_0x4689a7['push'](_0x4689a7['shift']());}};_0x685b0(++_0x2dd368);}(_0xac10,0x169));var _0x0ac1=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xac10[_0x1428d9];return _0x438019;};'use strict';var _=require(_0x0ac1('0x0'));var util=require(_0x0ac1('0x1'));var moment=require('moment');var BPromise=require(_0x0ac1('0x2'));var rs=require(_0x0ac1('0x3'));var fs=require('fs');var Redis=require(_0x0ac1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ac1('0x5'))(_0x0ac1('0x6'));var config=require(_0x0ac1('0x7'));var jayson=require(_0x0ac1('0x8'));var client=jayson[_0x0ac1('0x9')][_0x0ac1('0xa')]({'port':0x232a});config[_0x0ac1('0xb')]=_[_0x0ac1('0xc')](config['redis'],{'host':_0x0ac1('0xd'),'port':0x18eb});var socket=require(_0x0ac1('0xe'))(new Redis(config[_0x0ac1('0xb')]));require(_0x0ac1('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d72e3,_0x20990b,_0x96e647){return new BPromise(function(_0x60a503,_0x1ec147){return client[_0x0ac1('0x10')](_0x4d72e3,_0x96e647)[_0x0ac1('0x11')](function(_0x2aba1d){logger[_0x0ac1('0x12')](_0x0ac1('0x13'),_0x20990b,_0x0ac1('0x14'));logger[_0x0ac1('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x20990b,_0x0ac1('0x14'),JSON[_0x0ac1('0x16')](_0x2aba1d));if(_0x2aba1d[_0x0ac1('0x17')]){if(_0x2aba1d['error'][_0x0ac1('0x18')]===0x1f4){logger[_0x0ac1('0x17')](_0x0ac1('0x13'),_0x20990b,_0x2aba1d[_0x0ac1('0x17')][_0x0ac1('0x19')]);return _0x1ec147(_0x2aba1d[_0x0ac1('0x17')][_0x0ac1('0x19')]);}logger['error'](_0x0ac1('0x13'),_0x20990b,_0x2aba1d['error'][_0x0ac1('0x19')]);return _0x60a503(_0x2aba1d[_0x0ac1('0x17')][_0x0ac1('0x19')]);}else{logger[_0x0ac1('0x12')](_0x0ac1('0x13'),_0x20990b,_0x0ac1('0x14'));_0x60a503(_0x2aba1d[_0x0ac1('0x1a')][_0x0ac1('0x19')]);}})['catch'](function(_0x19f954){logger[_0x0ac1('0x17')]('DashboardItem,\x20%s,\x20%s',_0x20990b,_0x19f954);_0x1ec147(_0x19f954);});});} \ No newline at end of file +var _0xc06c=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x3fa39f,_0xcf8e89){var _0x28e7a2=function(_0x1f0a4f){while(--_0x1f0a4f){_0x3fa39f['push'](_0x3fa39f['shift']());}};_0x28e7a2(++_0xcf8e89);}(_0xc06c,0x15d));var _0xcc06=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc06c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcc06('0x0'));var util=require(_0xcc06('0x1'));var moment=require('moment');var BPromise=require(_0xcc06('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc06('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcc06('0x4'))(_0xcc06('0x5'));var config=require(_0xcc06('0x6'));var jayson=require(_0xcc06('0x7'));var client=jayson[_0xcc06('0x8')][_0xcc06('0x9')]({'port':0x232a});config[_0xcc06('0xa')]=_[_0xcc06('0xb')](config['redis'],{'host':_0xcc06('0xc'),'port':0x18eb});var socket=require(_0xcc06('0xd'))(new Redis(config[_0xcc06('0xa')]));require(_0xcc06('0xe'))['register'](socket);function respondWithRpcPromise(_0x35695c,_0x1c558f,_0x3db39c){return new BPromise(function(_0xeb58d8,_0xae41a7){return client['request'](_0x35695c,_0x3db39c)['then'](function(_0x9df40e){logger[_0xcc06('0xf')](_0xcc06('0x10'),_0x1c558f,_0xcc06('0x11'));logger[_0xcc06('0x12')](_0xcc06('0x13'),_0x1c558f,'request\x20sent',JSON[_0xcc06('0x14')](_0x9df40e));if(_0x9df40e[_0xcc06('0x15')]){if(_0x9df40e[_0xcc06('0x15')][_0xcc06('0x16')]===0x1f4){logger[_0xcc06('0x15')](_0xcc06('0x10'),_0x1c558f,_0x9df40e[_0xcc06('0x15')][_0xcc06('0x17')]);return _0xae41a7(_0x9df40e[_0xcc06('0x15')][_0xcc06('0x17')]);}logger[_0xcc06('0x15')](_0xcc06('0x10'),_0x1c558f,_0x9df40e[_0xcc06('0x15')]['message']);return _0xeb58d8(_0x9df40e['error'][_0xcc06('0x17')]);}else{logger[_0xcc06('0xf')]('DashboardItem,\x20%s,\x20%s',_0x1c558f,_0xcc06('0x11'));_0xeb58d8(_0x9df40e['result'][_0xcc06('0x17')]);}})[_0xcc06('0x18')](function(_0x3bcd0d){logger[_0xcc06('0x15')](_0xcc06('0x10'),_0x1c558f,_0x3bcd0d);_0xae41a7(_0x3bcd0d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index eb83cf3..4bc2d62 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 _0x3e74=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x3e74,0x175));var _0x43e7=function(_0x2f4845,_0x5bb349){_0x2f4845=_0x2f4845-0x0;var _0x310564=_0x3e74[_0x2f4845];return _0x310564;};'use strict';var DashboardItemEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){DashboardItemEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);DashboardItemEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file +var _0x9957=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var DashboardItemEvents=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(){DashboardItemEvents[_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);DashboardItemEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index f3ac879..f274eb1 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 _0x28f6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post','isAuthenticated','create','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28f6,0x176));var _0x628f=function(_0x44e720,_0x48d46b){_0x44e720=_0x44e720-0x0;var _0x11d542=_0x28f6[_0x44e720];return _0x11d542;};'use strict';var multer=require('multer');var util=require(_0x628f('0x0'));var path=require(_0x628f('0x1'));var timeout=require(_0x628f('0x2'));var express=require(_0x628f('0x3'));var router=express[_0x628f('0x4')]();var auth=require(_0x628f('0x5'));var interaction=require(_0x628f('0x6'));var config=require(_0x628f('0x7'));var controller=require(_0x628f('0x8'));router['get'](_0x628f('0x9'),auth['isAuthenticated'](),controller[_0x628f('0xa')]);router[_0x628f('0xb')]('/',auth[_0x628f('0xc')](),controller[_0x628f('0xd')]);router['put'](_0x628f('0x9'),auth[_0x628f('0xc')](),controller['update']);router['delete'](_0x628f('0x9'),auth[_0x628f('0xc')](),controller['destroy']);module[_0x628f('0xe')]=router; \ No newline at end of file +var _0xedd1=['show','post','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./dashboardItem.controller','/:id','isAuthenticated'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xedd1,0x1a9));var _0x1edd=function(_0x5a7d7c,_0x9ae68a){_0x5a7d7c=_0x5a7d7c-0x0;var _0x239238=_0xedd1[_0x5a7d7c];return _0x239238;};'use strict';var multer=require(_0x1edd('0x0'));var util=require(_0x1edd('0x1'));var path=require(_0x1edd('0x2'));var timeout=require(_0x1edd('0x3'));var express=require(_0x1edd('0x4'));var router=express[_0x1edd('0x5')]();var auth=require(_0x1edd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1edd('0x7'));router['get'](_0x1edd('0x8'),auth[_0x1edd('0x9')](),controller[_0x1edd('0xa')]);router[_0x1edd('0xb')]('/',auth['isAuthenticated'](),controller[_0x1edd('0xc')]);router[_0x1edd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1edd('0xe')]);router['delete']('/:id',auth[_0x1edd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index cfde2b3..3f1eae2 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 _0xf08f=['exports','STRING','sequelize'];(function(_0x137aec,_0x31789f){var _0x5a502a=function(_0x44896e){while(--_0x44896e){_0x137aec['push'](_0x137aec['shift']());}};_0x5a502a(++_0x31789f);}(_0xf08f,0x7d));var _0xff08=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0xf08f[_0x3f6c29];return _0x4af959;};'use strict';var Sequelize=require(_0xff08('0x0'));module[_0xff08('0x1')]={'name':{'type':Sequelize[_0xff08('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2306=['exports','STRING'];(function(_0x199cdd,_0x2068b8){var _0x58e49b=function(_0x511702){while(--_0x511702){_0x199cdd['push'](_0x199cdd['shift']());}};_0x58e49b(++_0x2068b8);}(_0x2306,0x10a));var _0x6230=function(_0x2ca00d,_0x3dca15){_0x2ca00d=_0x2ca00d-0x0;var _0x562d3e=_0x2306[_0x2ca00d];return _0x562d3e;};'use strict';var Sequelize=require('sequelize');module[_0x6230('0x0')]={'name':{'type':Sequelize[_0x6230('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 06c0573..ddaff18 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 _0x2c1c=['order','sort','where','pick','map','type','key','VIRTUAL','field','filter','merge','rows','catch','params','includeAll','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','UserProfileResource','end','error','stack','name','send','index','Disposition','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3eb450,_0x592b0a){var _0x2c4cfd=function(_0x34f5dc){while(--_0x34f5dc){_0x3eb450['push'](_0x3eb450['shift']());}};_0x2c4cfd(++_0x592b0a);}(_0x2c1c,0x119));var _0xc2c1=function(_0x496b11,_0x576cb0){_0x496b11=_0x496b11-0x0;var _0x3030ac=_0x2c1c[_0x496b11];return _0x3030ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2c1('0x0'));var rimraf=require(_0xc2c1('0x1'));var zipdir=require(_0xc2c1('0x2'));var jsonpatch=require(_0xc2c1('0x3'));var rp=require('request-promise');var moment=require(_0xc2c1('0x4'));var BPromise=require(_0xc2c1('0x5'));var Mustache=require(_0xc2c1('0x6'));var util=require(_0xc2c1('0x7'));var path=require(_0xc2c1('0x8'));var sox=require(_0xc2c1('0x9'));var csv=require(_0xc2c1('0xa'));var ejs=require(_0xc2c1('0xb'));var fs=require('fs');var _=require(_0xc2c1('0xc'));var squel=require(_0xc2c1('0xd'));var crypto=require(_0xc2c1('0xe'));var jsforce=require(_0xc2c1('0xf'));var deskjs=require(_0xc2c1('0x10'));var toCsv=require(_0xc2c1('0xa'));var querystring=require('querystring');var Papa=require(_0xc2c1('0x11'));var Redis=require('ioredis');var authService=require(_0xc2c1('0x12'));var qs=require(_0xc2c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2c1('0x14'))(_0xc2c1('0x15'));var utils=require(_0xc2c1('0x16'));var config=require(_0xc2c1('0x17'));var db=require(_0xc2c1('0x18'))['db'];function respondWithStatusCode(_0x17898e,_0x442b40){_0x442b40=_0x442b40||0xcc;return function(_0x1f8fc4){if(_0x1f8fc4){return _0x17898e[_0xc2c1('0x19')](_0x442b40);}return _0x17898e[_0xc2c1('0x1a')](_0x442b40)['end']();};}function respondWithResult(_0x52b46e,_0x467891){_0x467891=_0x467891||0xc8;return function(_0x1e0965){if(_0x1e0965){return _0x52b46e['status'](_0x467891)['json'](_0x1e0965);}};}function respondWithFilteredResult(_0x149b8d,_0x16901d){return function(_0x2c3827){if(_0x2c3827){var _0x1cdc6a=_0x2c3827[_0xc2c1('0x1b')],_0x4091e3=_0x16901d[_0xc2c1('0x1c')],_0x36d6b4=_0x16901d[_0xc2c1('0x1c')]+_0x16901d[_0xc2c1('0x1d')],_0x45595b;if(_0x36d6b4>=_0x1cdc6a){_0x36d6b4=_0x1cdc6a;_0x45595b=0xc8;}else{_0x45595b=0xce;}_0x149b8d[_0xc2c1('0x1a')](_0x45595b);return _0x149b8d[_0xc2c1('0x1e')]('Content-Range',_0x4091e3+'-'+_0x36d6b4+'/'+_0x1cdc6a)[_0xc2c1('0x1f')](_0x2c3827);}return null;};}function patchUpdates(_0x19bb8c){return function(_0x405695){try{jsonpatch[_0xc2c1('0x20')](_0x405695,_0x19bb8c,!![]);}catch(_0x76cd62){return BPromise[_0xc2c1('0x21')](_0x76cd62);}return _0x405695[_0xc2c1('0x22')]();};}function saveUpdates(_0x4ca5ef,_0x2ddcd){return function(_0x473f8b){if(_0x473f8b){return _0x473f8b[_0xc2c1('0x23')](_0x4ca5ef)[_0xc2c1('0x24')](function(_0x4cd670){return _0x4cd670;});}return null;};}function removeEntity(_0x15858c,_0x5cbbe4){return function(_0x41bb79){if(_0x41bb79){return _0x41bb79['destroy']()[_0xc2c1('0x24')](function(){var _0x5d3127=_0x41bb79['get']({'plain':!![]});var _0x29549b='Dispositions';return db[_0xc2c1('0x25')]['destroy']({'where':{'type':_0x29549b,'resourceId':_0x5d3127['id']}})[_0xc2c1('0x24')](function(){return _0x41bb79;});})[_0xc2c1('0x24')](function(){_0x15858c[_0xc2c1('0x1a')](0xcc)[_0xc2c1('0x26')]();});}};}function handleEntityNotFound(_0x72bc16,_0x87ad43){return function(_0x5a1437){if(!_0x5a1437){_0x72bc16[_0xc2c1('0x19')](0x194);}return _0x5a1437;};}function handleError(_0x223d88,_0x1d32ca){_0x1d32ca=_0x1d32ca||0x1f4;return function(_0x12e2ce){logger[_0xc2c1('0x27')](_0x12e2ce[_0xc2c1('0x28')]);if(_0x12e2ce[_0xc2c1('0x29')]){delete _0x12e2ce['name'];}_0x223d88[_0xc2c1('0x1a')](_0x1d32ca)[_0xc2c1('0x2a')](_0x12e2ce);};}exports[_0xc2c1('0x2b')]=function(_0x3efd0c,_0x5efcec){var _0x20eb37={},_0x1e3d70={},_0x4254f5={'count':0x0,'rows':[]};var _0x5ed0d8=db[_0xc2c1('0x2c')][_0xc2c1('0x2d')];_0x1e3d70[_0xc2c1('0x2e')]=_['keys'](_0x5ed0d8);_0x1e3d70[_0xc2c1('0x2f')]=_[_0xc2c1('0x30')](_0x3efd0c[_0xc2c1('0x2f')]);_0x1e3d70[_0xc2c1('0x31')]=_[_0xc2c1('0x32')](_0x1e3d70[_0xc2c1('0x2e')],_0x1e3d70[_0xc2c1('0x2f')]);_0x20eb37[_0xc2c1('0x33')]=_['intersection'](_0x1e3d70[_0xc2c1('0x2e')],qs[_0xc2c1('0x34')](_0x3efd0c[_0xc2c1('0x2f')][_0xc2c1('0x34')]));_0x20eb37[_0xc2c1('0x33')]=_0x20eb37['attributes'][_0xc2c1('0x35')]?_0x20eb37[_0xc2c1('0x33')]:_0x1e3d70[_0xc2c1('0x2e')];if(!_0x3efd0c['query'][_0xc2c1('0x36')]('nolimit')){_0x20eb37[_0xc2c1('0x1d')]=qs[_0xc2c1('0x1d')](_0x3efd0c['query'][_0xc2c1('0x1d')]);_0x20eb37[_0xc2c1('0x1c')]=qs[_0xc2c1('0x1c')](_0x3efd0c[_0xc2c1('0x2f')][_0xc2c1('0x1c')]);}_0x20eb37[_0xc2c1('0x37')]=qs[_0xc2c1('0x38')](_0x3efd0c[_0xc2c1('0x2f')][_0xc2c1('0x38')]);_0x20eb37[_0xc2c1('0x39')]=qs['filters'](_[_0xc2c1('0x3a')](_0x3efd0c[_0xc2c1('0x2f')],_0x1e3d70[_0xc2c1('0x31')]));if(_0x3efd0c[_0xc2c1('0x2f')]['filter']){_0x20eb37[_0xc2c1('0x39')]=_['merge'](_0x20eb37[_0xc2c1('0x39')],{'$or':_[_0xc2c1('0x3b')](_0x5ed0d8,function(_0x2d6af7){if(_0x2d6af7[_0xc2c1('0x3c')][_0xc2c1('0x3d')]!==_0xc2c1('0x3e')){var _0x2bf1b3={};_0x2bf1b3[_0x2d6af7[_0xc2c1('0x3f')]]={'$like':'%'+_0x3efd0c['query'][_0xc2c1('0x40')]+'%'};return _0x2bf1b3;}})});}_0x20eb37=_[_0xc2c1('0x41')]({},_0x20eb37,_0x3efd0c['options']);var _0x43ca21={'where':_0x20eb37[_0xc2c1('0x39')]};return db[_0xc2c1('0x2c')]['count'](_0x43ca21)[_0xc2c1('0x24')](function(_0x5b7ae6){_0x4254f5[_0xc2c1('0x1b')]=_0x5b7ae6;if(_0x3efd0c[_0xc2c1('0x2f')]['includeAll']){_0x20eb37['include']=[{'all':!![]}];}return db[_0xc2c1('0x2c')]['findAll'](_0x20eb37);})[_0xc2c1('0x24')](function(_0x182897){_0x4254f5[_0xc2c1('0x42')]=_0x182897;return _0x4254f5;})[_0xc2c1('0x24')](respondWithFilteredResult(_0x5efcec,_0x20eb37))[_0xc2c1('0x43')](handleError(_0x5efcec,null));};exports['show']=function(_0xa2cead,_0x37ffc8){var _0x279364={'raw':!![],'where':{'id':_0xa2cead[_0xc2c1('0x44')]['id']}},_0x2ff9d0={};_0x2ff9d0[_0xc2c1('0x2e')]=_['keys'](db[_0xc2c1('0x2c')][_0xc2c1('0x2d')]);_0x2ff9d0['query']=_[_0xc2c1('0x30')](_0xa2cead[_0xc2c1('0x2f')]);_0x2ff9d0[_0xc2c1('0x31')]=_[_0xc2c1('0x32')](_0x2ff9d0[_0xc2c1('0x2e')],_0x2ff9d0['query']);_0x279364[_0xc2c1('0x33')]=_[_0xc2c1('0x32')](_0x2ff9d0[_0xc2c1('0x2e')],qs[_0xc2c1('0x34')](_0xa2cead[_0xc2c1('0x2f')][_0xc2c1('0x34')]));_0x279364[_0xc2c1('0x33')]=_0x279364[_0xc2c1('0x33')][_0xc2c1('0x35')]?_0x279364[_0xc2c1('0x33')]:_0x2ff9d0['model'];if(_0xa2cead[_0xc2c1('0x2f')][_0xc2c1('0x45')]){_0x279364[_0xc2c1('0x46')]=[{'all':!![]}];}_0x279364=_['merge']({},_0x279364,_0xa2cead[_0xc2c1('0x47')]);return db[_0xc2c1('0x2c')]['find'](_0x279364)['then'](handleEntityNotFound(_0x37ffc8,null))['then'](respondWithResult(_0x37ffc8,null))[_0xc2c1('0x43')](handleError(_0x37ffc8,null));};exports['create']=function(_0x3645e7,_0x47ed6a){return db['Disposition'][_0xc2c1('0x48')](_0x3645e7[_0xc2c1('0x49')],{})['then'](function(_0x2528f1){var _0x1b92d1=_0x3645e7[_0xc2c1('0x4a')][_0xc2c1('0x4b')]({'plain':!![]});if(!_0x1b92d1)throw new Error(_0xc2c1('0x4c'));if(_0x1b92d1['role']===_0xc2c1('0x4a')){var _0x1a3f01=_0x2528f1[_0xc2c1('0x4b')]({'plain':!![]});var _0x3efbbd=_0xc2c1('0x4d');return db[_0xc2c1('0x4e')]['find']({'where':{'name':_0x3efbbd,'userProfileId':_0x1b92d1[_0xc2c1('0x4f')]},'raw':!![]})[_0xc2c1('0x24')](function(_0x5412d2){if(_0x5412d2&&_0x5412d2[_0xc2c1('0x50')]===0x0){return db['UserProfileResource'][_0xc2c1('0x48')]({'name':_0x1a3f01[_0xc2c1('0x29')],'resourceId':_0x1a3f01['id'],'type':_0x5412d2['name'],'sectionId':_0x5412d2['id']},{})[_0xc2c1('0x24')](function(){return _0x2528f1;});}else{return _0x2528f1;}})[_0xc2c1('0x43')](function(_0x2056ae){logger[_0xc2c1('0x27')](_0xc2c1('0x51'),_0x2056ae);throw _0x2056ae;});}return _0x2528f1;})[_0xc2c1('0x24')](respondWithResult(_0x47ed6a,0xc9))['catch'](handleError(_0x47ed6a,null));};exports[_0xc2c1('0x23')]=function(_0x5c8715,_0x18edbd){if(_0x5c8715[_0xc2c1('0x49')]['id']){delete _0x5c8715[_0xc2c1('0x49')]['id'];}return db[_0xc2c1('0x2c')][_0xc2c1('0x52')]({'where':{'id':_0x5c8715[_0xc2c1('0x44')]['id']}})[_0xc2c1('0x24')](handleEntityNotFound(_0x18edbd,null))[_0xc2c1('0x24')](saveUpdates(_0x5c8715[_0xc2c1('0x49')],null))['then'](respondWithResult(_0x18edbd,null))[_0xc2c1('0x43')](handleError(_0x18edbd,null));};exports[_0xc2c1('0x53')]=function(_0x4ce4b9,_0x42ca1b){return db[_0xc2c1('0x2c')]['find']({'where':{'id':_0x4ce4b9[_0xc2c1('0x44')]['id']}})['then'](handleEntityNotFound(_0x42ca1b,null))[_0xc2c1('0x24')](removeEntity(_0x42ca1b,null))[_0xc2c1('0x43')](handleError(_0x42ca1b,null));}; \ No newline at end of file +var _0x2dec=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','destroy','then','get','error','stack','name','index','Disposition','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','field','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation'];(function(_0x4ea134,_0x50e5fa){var _0x31f2ab=function(_0xf4c2e1){while(--_0xf4c2e1){_0x4ea134['push'](_0x4ea134['shift']());}};_0x31f2ab(++_0x50e5fa);}(_0x2dec,0xe2));var _0xc2de=function(_0x581e1d,_0x1ed7d4){_0x581e1d=_0x581e1d-0x0;var _0x39965b=_0x2dec[_0x581e1d];return _0x39965b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2de('0x0'));var rimraf=require(_0xc2de('0x1'));var zipdir=require(_0xc2de('0x2'));var jsonpatch=require(_0xc2de('0x3'));var rp=require('request-promise');var moment=require(_0xc2de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc2de('0x5'));var util=require('util');var path=require(_0xc2de('0x6'));var sox=require(_0xc2de('0x7'));var csv=require(_0xc2de('0x8'));var ejs=require(_0xc2de('0x9'));var fs=require('fs');var _=require(_0xc2de('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc2de('0xb'));var deskjs=require(_0xc2de('0xc'));var toCsv=require(_0xc2de('0x8'));var querystring=require(_0xc2de('0xd'));var Papa=require(_0xc2de('0xe'));var Redis=require(_0xc2de('0xf'));var authService=require(_0xc2de('0x10'));var qs=require(_0xc2de('0x11'));var hardwareService=require(_0xc2de('0x12'));var logger=require(_0xc2de('0x13'))('api');var utils=require(_0xc2de('0x14'));var config=require('../../config/environment');var db=require(_0xc2de('0x15'))['db'];function respondWithStatusCode(_0x41ede0,_0x18c135){_0x18c135=_0x18c135||0xcc;return function(_0x1b7609){if(_0x1b7609){return _0x41ede0[_0xc2de('0x16')](_0x18c135);}return _0x41ede0[_0xc2de('0x17')](_0x18c135)[_0xc2de('0x18')]();};}function respondWithResult(_0x3f8ce1,_0x12609c){_0x12609c=_0x12609c||0xc8;return function(_0x2146f3){if(_0x2146f3){return _0x3f8ce1[_0xc2de('0x17')](_0x12609c)['json'](_0x2146f3);}};}function respondWithFilteredResult(_0x252cf3,_0x3c3831){return function(_0xf85f42){if(_0xf85f42){var _0x3aebe6=_0xf85f42[_0xc2de('0x19')],_0x399d8d=_0x3c3831[_0xc2de('0x1a')],_0x3051a7=_0x3c3831[_0xc2de('0x1a')]+_0x3c3831[_0xc2de('0x1b')],_0x2c0cee;if(_0x3051a7>=_0x3aebe6){_0x3051a7=_0x3aebe6;_0x2c0cee=0xc8;}else{_0x2c0cee=0xce;}_0x252cf3[_0xc2de('0x17')](_0x2c0cee);return _0x252cf3['set'](_0xc2de('0x1c'),_0x399d8d+'-'+_0x3051a7+'/'+_0x3aebe6)['json'](_0xf85f42);}return null;};}function patchUpdates(_0x384f99){return function(_0x43dcd5){try{jsonpatch[_0xc2de('0x1d')](_0x43dcd5,_0x384f99,!![]);}catch(_0x9daed0){return BPromise[_0xc2de('0x1e')](_0x9daed0);}return _0x43dcd5[_0xc2de('0x1f')]();};}function saveUpdates(_0x331ed4,_0xab2400){return function(_0x1152a1){if(_0x1152a1){return _0x1152a1['update'](_0x331ed4)['then'](function(_0x27c1b8){return _0x27c1b8;});}return null;};}function removeEntity(_0x3a6328,_0x5be863){return function(_0xc2866c){if(_0xc2866c){return _0xc2866c[_0xc2de('0x20')]()[_0xc2de('0x21')](function(){var _0xbdeff9=_0xc2866c[_0xc2de('0x22')]({'plain':!![]});var _0x3dff6e='Dispositions';return db['UserProfileResource']['destroy']({'where':{'type':_0x3dff6e,'resourceId':_0xbdeff9['id']}})['then'](function(){return _0xc2866c;});})[_0xc2de('0x21')](function(){_0x3a6328[_0xc2de('0x17')](0xcc)[_0xc2de('0x18')]();});}};}function handleEntityNotFound(_0x25899e,_0x4acdf3){return function(_0x5b91a2){if(!_0x5b91a2){_0x25899e['sendStatus'](0x194);}return _0x5b91a2;};}function handleError(_0x289072,_0x18d15e){_0x18d15e=_0x18d15e||0x1f4;return function(_0x58e681){logger[_0xc2de('0x23')](_0x58e681[_0xc2de('0x24')]);if(_0x58e681[_0xc2de('0x25')]){delete _0x58e681['name'];}_0x289072['status'](_0x18d15e)['send'](_0x58e681);};}exports[_0xc2de('0x26')]=function(_0x1e306e,_0x1f5c78){var _0x4e07e5={},_0x4718c4={},_0x32b5d3={'count':0x0,'rows':[]};var _0x2f91d8=db[_0xc2de('0x27')]['rawAttributes'];_0x4718c4[_0xc2de('0x28')]=_[_0xc2de('0x29')](_0x2f91d8);_0x4718c4[_0xc2de('0x2a')]=_[_0xc2de('0x29')](_0x1e306e[_0xc2de('0x2a')]);_0x4718c4[_0xc2de('0x2b')]=_[_0xc2de('0x2c')](_0x4718c4[_0xc2de('0x28')],_0x4718c4['query']);_0x4e07e5[_0xc2de('0x2d')]=_[_0xc2de('0x2c')](_0x4718c4['model'],qs[_0xc2de('0x2e')](_0x1e306e['query'][_0xc2de('0x2e')]));_0x4e07e5[_0xc2de('0x2d')]=_0x4e07e5[_0xc2de('0x2d')]['length']?_0x4e07e5[_0xc2de('0x2d')]:_0x4718c4[_0xc2de('0x28')];if(!_0x1e306e[_0xc2de('0x2a')][_0xc2de('0x2f')]('nolimit')){_0x4e07e5[_0xc2de('0x1b')]=qs[_0xc2de('0x1b')](_0x1e306e['query'][_0xc2de('0x1b')]);_0x4e07e5[_0xc2de('0x1a')]=qs[_0xc2de('0x1a')](_0x1e306e[_0xc2de('0x2a')][_0xc2de('0x1a')]);}_0x4e07e5[_0xc2de('0x30')]=qs[_0xc2de('0x31')](_0x1e306e[_0xc2de('0x2a')]['sort']);_0x4e07e5[_0xc2de('0x32')]=qs['filters'](_[_0xc2de('0x33')](_0x1e306e['query'],_0x4718c4[_0xc2de('0x2b')]));if(_0x1e306e[_0xc2de('0x2a')][_0xc2de('0x34')]){_0x4e07e5[_0xc2de('0x32')]=_[_0xc2de('0x35')](_0x4e07e5[_0xc2de('0x32')],{'$or':_[_0xc2de('0x36')](_0x2f91d8,function(_0x37e16e){if(_0x37e16e['type']['key']!==_0xc2de('0x37')){var _0x4b98e6={};_0x4b98e6[_0x37e16e[_0xc2de('0x38')]]={'$like':'%'+_0x1e306e['query']['filter']+'%'};return _0x4b98e6;}})});}_0x4e07e5=_[_0xc2de('0x35')]({},_0x4e07e5,_0x1e306e[_0xc2de('0x39')]);var _0x396aa4={'where':_0x4e07e5['where']};return db[_0xc2de('0x27')][_0xc2de('0x19')](_0x396aa4)['then'](function(_0x46004a){_0x32b5d3[_0xc2de('0x19')]=_0x46004a;if(_0x1e306e[_0xc2de('0x2a')][_0xc2de('0x3a')]){_0x4e07e5['include']=[{'all':!![]}];}return db[_0xc2de('0x27')][_0xc2de('0x3b')](_0x4e07e5);})[_0xc2de('0x21')](function(_0x1140c3){_0x32b5d3['rows']=_0x1140c3;return _0x32b5d3;})[_0xc2de('0x21')](respondWithFilteredResult(_0x1f5c78,_0x4e07e5))[_0xc2de('0x3c')](handleError(_0x1f5c78,null));};exports[_0xc2de('0x3d')]=function(_0x442290,_0x4a3174){var _0x2739b8={'raw':!![],'where':{'id':_0x442290['params']['id']}},_0x82743e={};_0x82743e[_0xc2de('0x28')]=_['keys'](db[_0xc2de('0x27')]['rawAttributes']);_0x82743e['query']=_[_0xc2de('0x29')](_0x442290[_0xc2de('0x2a')]);_0x82743e['filters']=_[_0xc2de('0x2c')](_0x82743e[_0xc2de('0x28')],_0x82743e[_0xc2de('0x2a')]);_0x2739b8[_0xc2de('0x2d')]=_[_0xc2de('0x2c')](_0x82743e['model'],qs[_0xc2de('0x2e')](_0x442290['query'][_0xc2de('0x2e')]));_0x2739b8['attributes']=_0x2739b8['attributes']['length']?_0x2739b8[_0xc2de('0x2d')]:_0x82743e[_0xc2de('0x28')];if(_0x442290[_0xc2de('0x2a')][_0xc2de('0x3a')]){_0x2739b8[_0xc2de('0x3e')]=[{'all':!![]}];}_0x2739b8=_['merge']({},_0x2739b8,_0x442290[_0xc2de('0x39')]);return db['Disposition'][_0xc2de('0x3f')](_0x2739b8)[_0xc2de('0x21')](handleEntityNotFound(_0x4a3174,null))[_0xc2de('0x21')](respondWithResult(_0x4a3174,null))['catch'](handleError(_0x4a3174,null));};exports[_0xc2de('0x40')]=function(_0x114073,_0x3003e7){return db[_0xc2de('0x27')][_0xc2de('0x40')](_0x114073[_0xc2de('0x41')],{})[_0xc2de('0x21')](function(_0x4b5eca){var _0x55276c=_0x114073[_0xc2de('0x42')][_0xc2de('0x22')]({'plain':!![]});if(!_0x55276c)throw new Error(_0xc2de('0x43'));if(_0x55276c[_0xc2de('0x44')]===_0xc2de('0x42')){var _0x4dee33=_0x4b5eca['get']({'plain':!![]});var _0x221170='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x221170,'userProfileId':_0x55276c['userProfileId']},'raw':!![]})[_0xc2de('0x21')](function(_0x31d6ef){if(_0x31d6ef&&_0x31d6ef[_0xc2de('0x45')]===0x0){return db[_0xc2de('0x46')]['create']({'name':_0x4dee33[_0xc2de('0x25')],'resourceId':_0x4dee33['id'],'type':_0x31d6ef[_0xc2de('0x25')],'sectionId':_0x31d6ef['id']},{})[_0xc2de('0x21')](function(){return _0x4b5eca;});}else{return _0x4b5eca;}})[_0xc2de('0x3c')](function(_0x18a026){logger['error'](_0xc2de('0x47'),_0x18a026);throw _0x18a026;});}return _0x4b5eca;})['then'](respondWithResult(_0x3003e7,0xc9))[_0xc2de('0x3c')](handleError(_0x3003e7,null));};exports[_0xc2de('0x48')]=function(_0x341c96,_0x59d3df){if(_0x341c96[_0xc2de('0x41')]['id']){delete _0x341c96[_0xc2de('0x41')]['id'];}return db[_0xc2de('0x27')][_0xc2de('0x3f')]({'where':{'id':_0x341c96['params']['id']}})[_0xc2de('0x21')](handleEntityNotFound(_0x59d3df,null))['then'](saveUpdates(_0x341c96[_0xc2de('0x41')],null))[_0xc2de('0x21')](respondWithResult(_0x59d3df,null))[_0xc2de('0x3c')](handleError(_0x59d3df,null));};exports[_0xc2de('0x20')]=function(_0x5c14a6,_0x1f5de5){return db['Disposition']['find']({'where':{'id':_0x5c14a6[_0xc2de('0x49')]['id']}})[_0xc2de('0x21')](handleEntityNotFound(_0x1f5de5,null))['then'](removeEntity(_0x1f5de5,null))[_0xc2de('0x3c')](handleError(_0x1f5de5,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 525a20e..a9bfa26 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 _0x60e8=['path','rimraf','../../config/environment','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','lodash','../../config/logger','api','moment','bluebird'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0x60e8,0x1df));var _0x860e=function(_0x104ca7,_0x266d32){_0x104ca7=_0x104ca7-0x0;var _0x17081f=_0x60e8[_0x104ca7];return _0x17081f;};'use strict';var _=require(_0x860e('0x0'));var util=require('util');var logger=require(_0x860e('0x1'))(_0x860e('0x2'));var moment=require(_0x860e('0x3'));var BPromise=require(_0x860e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x860e('0x5'));var rimraf=require(_0x860e('0x6'));var config=require(_0x860e('0x7'));var attributes=require('./disposition.attributes');module[_0x860e('0x8')]=function(_0x5d2606,_0x56b07a){return _0x5d2606[_0x860e('0x9')](_0x860e('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x860e('0xb'),'fields':[_0x860e('0xc'),_0x860e('0xd')]},{'unique':!![],'name':_0x860e('0xe'),'fields':[_0x860e('0xc'),_0x860e('0xf')]},{'unique':!![],'name':_0x860e('0x10'),'fields':['name',_0x860e('0x11')]},{'unique':!![],'name':_0x860e('0x12'),'fields':[_0x860e('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x860e('0x13'),'fields':[_0x860e('0xc'),_0x860e('0x14')]},{'unique':!![],'name':_0x860e('0x15'),'fields':[_0x860e('0xc'),'OpenchannelAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d50=['tools_dispositions','name','name_chat','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','Disposition'];(function(_0x3db450,_0x49d2b3){var _0x6e1517=function(_0x568e07){while(--_0x568e07){_0x3db450['push'](_0x3db450['shift']());}};_0x6e1517(++_0x49d2b3);}(_0x0d50,0x130));var _0x00d5=function(_0x5e4931,_0x5768dc){_0x5e4931=_0x5e4931-0x0;var _0x1eb815=_0x0d50[_0x5e4931];return _0x1eb815;};'use strict';var _=require(_0x00d5('0x0'));var util=require(_0x00d5('0x1'));var logger=require(_0x00d5('0x2'))(_0x00d5('0x3'));var moment=require(_0x00d5('0x4'));var BPromise=require(_0x00d5('0x5'));var rp=require(_0x00d5('0x6'));var fs=require('fs');var path=require(_0x00d5('0x7'));var rimraf=require(_0x00d5('0x8'));var config=require('../../config/environment');var attributes=require(_0x00d5('0x9'));module['exports']=function(_0x595a3e,_0x2b9c2c){return _0x595a3e['define'](_0x00d5('0xa'),attributes,{'tableName':_0x00d5('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x00d5('0xc'),'ListId']},{'unique':!![],'name':_0x00d5('0xd'),'fields':[_0x00d5('0xc'),_0x00d5('0xe')]},{'unique':!![],'name':_0x00d5('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x00d5('0x10'),'fields':[_0x00d5('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x00d5('0x11'),'fields':[_0x00d5('0xc'),_0x00d5('0x12')]},{'unique':!![],'name':_0x00d5('0x13'),'fields':[_0x00d5('0xc'),_0x00d5('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f96a8d1..06eb55c 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 _0xaf1b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x15f476,_0x390e43){_0x15f476=_0x15f476-0x0;var _0x348766=_0xaf1b[_0x15f476];return _0x348766;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var moment=require(_0xbaf1('0x2'));var BPromise=require(_0xbaf1('0x3'));var rs=require(_0xbaf1('0x4'));var fs=require('fs');var Redis=require(_0xbaf1('0x5'));var db=require(_0xbaf1('0x6'))['db'];var utils=require(_0xbaf1('0x7'));var logger=require(_0xbaf1('0x8'))(_0xbaf1('0x9'));var config=require(_0xbaf1('0xa'));var jayson=require(_0xbaf1('0xb'));var client=jayson[_0xbaf1('0xc')][_0xbaf1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x548a29,_0x2e05b5,_0x5f337d){return new BPromise(function(_0x16a74d,_0x4eeec4){return client[_0xbaf1('0xe')](_0x548a29,_0x5f337d)[_0xbaf1('0xf')](function(_0x41a0ba){logger['info'](_0xbaf1('0x10'),_0x2e05b5,_0xbaf1('0x11'));logger['debug'](_0xbaf1('0x12'),_0x2e05b5,'request\x20sent',JSON[_0xbaf1('0x13')](_0x41a0ba));if(_0x41a0ba[_0xbaf1('0x14')]){if(_0x41a0ba[_0xbaf1('0x14')][_0xbaf1('0x15')]===0x1f4){logger[_0xbaf1('0x14')](_0xbaf1('0x10'),_0x2e05b5,_0x41a0ba['error']['message']);return _0x4eeec4(_0x41a0ba[_0xbaf1('0x14')][_0xbaf1('0x16')]);}logger[_0xbaf1('0x14')](_0xbaf1('0x10'),_0x2e05b5,_0x41a0ba[_0xbaf1('0x14')][_0xbaf1('0x16')]);return _0x16a74d(_0x41a0ba[_0xbaf1('0x14')]['message']);}else{logger[_0xbaf1('0x17')](_0xbaf1('0x10'),_0x2e05b5,_0xbaf1('0x11'));_0x16a74d(_0x41a0ba[_0xbaf1('0x18')][_0xbaf1('0x16')]);}})[_0xbaf1('0x19')](function(_0x199252){logger[_0xbaf1('0x14')]('Disposition,\x20%s,\x20%s',_0x2e05b5,_0x199252);_0x4eeec4(_0x199252);});});} \ No newline at end of file +var _0xb66c=['../../config/environment','jayson/promise','then','info','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xf988e1,_0x157803){var _0x3d3525=function(_0x50101a){while(--_0x50101a){_0xf988e1['push'](_0xf988e1['shift']());}};_0x3d3525(++_0x157803);}(_0xb66c,0x175));var _0xcb66=function(_0x2f3bdd,_0x183ac2){_0x2f3bdd=_0x2f3bdd-0x0;var _0x5374d8=_0xb66c[_0x2f3bdd];return _0x5374d8;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var moment=require(_0xcb66('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb66('0x2'));var fs=require('fs');var Redis=require(_0xcb66('0x3'));var db=require(_0xcb66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var config=require(_0xcb66('0x7'));var jayson=require(_0xcb66('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19adf5,_0x1b6852,_0xa3993){return new BPromise(function(_0x439f3d,_0xf7bc39){return client['request'](_0x19adf5,_0xa3993)[_0xcb66('0x9')](function(_0x3047f7){logger[_0xcb66('0xa')](_0xcb66('0xb'),_0x1b6852,_0xcb66('0xc'));logger['debug'](_0xcb66('0xd'),_0x1b6852,_0xcb66('0xc'),JSON[_0xcb66('0xe')](_0x3047f7));if(_0x3047f7[_0xcb66('0xf')]){if(_0x3047f7['error'][_0xcb66('0x10')]===0x1f4){logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7[_0xcb66('0xf')]['message']);return _0xf7bc39(_0x3047f7[_0xcb66('0xf')][_0xcb66('0x11')]);}logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7['error'][_0xcb66('0x11')]);return _0x439f3d(_0x3047f7['error'][_0xcb66('0x11')]);}else{logger['info'](_0xcb66('0xb'),_0x1b6852,'request\x20sent');_0x439f3d(_0x3047f7['result'][_0xcb66('0x11')]);}})[_0xcb66('0x12')](function(_0x681ce3){logger[_0xcb66('0xf')]('Disposition,\x20%s,\x20%s',_0x1b6852,_0x681ce3);_0xf7bc39(_0x681ce3);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 7a474c0..832b23f 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 _0x7230=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','create','put','/:id','update'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x7230,0x81));var _0x0723=function(_0x4c372f,_0x31cfc0){_0x4c372f=_0x4c372f-0x0;var _0x4ad7fe=_0x7230[_0x4c372f];return _0x4ad7fe;};'use strict';var multer=require(_0x0723('0x0'));var util=require(_0x0723('0x1'));var path=require('path');var timeout=require(_0x0723('0x2'));var express=require(_0x0723('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0723('0x4'));var config=require(_0x0723('0x5'));var controller=require(_0x0723('0x6'));router[_0x0723('0x7')]('/',auth[_0x0723('0x8')](),controller[_0x0723('0x9')]);router[_0x0723('0x7')]('/:id',auth[_0x0723('0x8')](),controller[_0x0723('0xa')]);router['post']('/',auth[_0x0723('0x8')](),controller[_0x0723('0xb')]);router[_0x0723('0xc')](_0x0723('0xd'),auth[_0x0723('0x8')](),controller[_0x0723('0xe')]);router[_0x0723('0xf')](_0x0723('0xd'),auth[_0x0723('0x8')](),controller[_0x0723('0x10')]);module[_0x0723('0x11')]=router; \ No newline at end of file +var _0x6b32=['isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','path','connect-timeout','express','Router','./disposition.controller','get'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6b32,0x1ac));var _0x26b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6b32[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x26b3('0x0'));var util=require('util');var path=require(_0x26b3('0x1'));var timeout=require(_0x26b3('0x2'));var express=require(_0x26b3('0x3'));var router=express[_0x26b3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x26b3('0x5'));router[_0x26b3('0x6')]('/',auth[_0x26b3('0x7')](),controller[_0x26b3('0x8')]);router[_0x26b3('0x6')](_0x26b3('0x9'),auth[_0x26b3('0x7')](),controller[_0x26b3('0xa')]);router[_0x26b3('0xb')]('/',auth[_0x26b3('0x7')](),controller['create']);router['put'](_0x26b3('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x26b3('0xc')](_0x26b3('0x9'),auth[_0x26b3('0x7')](),controller[_0x26b3('0xd')]);module[_0x26b3('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d99304b..9024e83 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 _0x9cdf=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x9cdf,0x157));var _0xf9cd=function(_0x35cf7c,_0x4f6507){_0x35cf7c=_0x35cf7c-0x0;var _0x2d5f27=_0x9cdf[_0x35cf7c];return _0x2d5f27;};'use strict';var Sequelize=require(_0xf9cd('0x0'));module['exports']={'name':{'type':Sequelize[_0xf9cd('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf9cd('0x2')](_0xf9cd('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xf9cd('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf9cd('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xf9cd('0x6'),_0xf9cd('0x7'),_0xf9cd('0x8'),'9600','12000',_0xf9cd('0x9')),'defaultValue':_0xf9cd('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xf9cd('0x7'),_0xf9cd('0x8'),'9600',_0xf9cd('0xa'),'14400'),'defaultValue':_0xf9cd('0x9')},'modem':{'type':Sequelize[_0xf9cd('0x1')],'defaultValue':_0xf9cd('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf9cd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf9cd('0x2')](_0xf9cd('0xd'),_0xf9cd('0xe'),_0xf9cd('0xf'),'KHOMP'),'defaultValue':_0xf9cd('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf9cd('0x10')],'defaultValue':function(){return _0xf9cd('0x11');}},'notificationSound':{'type':Sequelize[_0xf9cd('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf9cd('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf9cd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf9cd('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf9cd('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf9cd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf9cd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf9cd('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf9cd('0x12')],'defaultValue':![],'comment':_0xf9cd('0x14'),'set':function(_0x18a317){if(!_0x18a317)this[_0xf9cd('0x15')]('mandatoryDispositionPauseId',null);this[_0xf9cd('0x15')](_0xf9cd('0x16'),_0x18a317);}}}; \ No newline at end of file +var _0xb5ca=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2acd64,_0x4e8ce8){var _0x3d3fce=function(_0x5570df){while(--_0x5570df){_0x2acd64['push'](_0x2acd64['shift']());}};_0x3d3fce(++_0x4e8ce8);}(_0xb5ca,0x1e9));var _0xab5c=function(_0x7ae9f0,_0x384e37){_0x7ae9f0=_0x7ae9f0-0x0;var _0x2d5816=_0xb5ca[_0x7ae9f0];return _0x2d5816;};'use strict';var Sequelize=require(_0xab5c('0x0'));module[_0xab5c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xab5c('0x2')]},'ecm':{'type':Sequelize[_0xab5c('0x3')](_0xab5c('0x4'),'no'),'defaultValue':_0xab5c('0x4')},'headerinfo':{'type':Sequelize[_0xab5c('0x2')],'defaultValue':_0xab5c('0x5')},'localstationid':{'type':Sequelize[_0xab5c('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xab5c('0x3')](_0xab5c('0x6'),_0xab5c('0x7'),'7200','9600',_0xab5c('0x8'),_0xab5c('0x9')),'defaultValue':_0xab5c('0x7')},'maxrate':{'type':Sequelize[_0xab5c('0x3')](_0xab5c('0x6'),_0xab5c('0x7'),'7200','9600',_0xab5c('0x8'),_0xab5c('0x9')),'defaultValue':_0xab5c('0x9')},'modem':{'type':Sequelize[_0xab5c('0x2')],'defaultValue':_0xab5c('0xa')},'gateway':{'type':Sequelize[_0xab5c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xab5c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xab5c('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xab5c('0x3')](_0xab5c('0xc'),_0xab5c('0xd'),'DADHI',_0xab5c('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xab5c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xab5c('0xf')],'defaultValue':function(){return _0xab5c('0x10');}},'notificationSound':{'type':Sequelize[_0xab5c('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xab5c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xab5c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xab5c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xab5c('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xab5c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xab5c('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xab5c('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xab5c('0x11')],'defaultValue':![],'comment':_0xab5c('0x13'),'set':function(_0x372b8b){if(!_0x372b8b)this[_0xab5c('0x14')]('mandatoryDispositionPauseId',null);this[_0xab5c('0x14')](_0xab5c('0x15'),_0x372b8b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d223032..9d7db32 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 _0x0b68=['FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','map','type','key','field','options','where','count','include','FaxAccount','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','describe','addDisposition','Disposition','getDispositions','length','FaxAccountId','findAll','removeDispositions','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addInteraction','omit','FaxInteraction','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','send','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x0b68,0xa2));var _0x80b6=function(_0x478155,_0x32f080){_0x478155=_0x478155-0x0;var _0x4e46f0=_0x0b68[_0x478155];return _0x4e46f0;};'use strict';var pdf=require(_0x80b6('0x0'));var emlformat=require(_0x80b6('0x1'));var rimraf=require(_0x80b6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x80b6('0x3'));var BPromise=require(_0x80b6('0x4'));var Mustache=require('mustache');var util=require(_0x80b6('0x5'));var path=require(_0x80b6('0x6'));var sox=require(_0x80b6('0x7'));var csv=require('to-csv');var ejs=require(_0x80b6('0x8'));var fs=require('fs');var _=require(_0x80b6('0x9'));var squel=require('squel');var crypto=require(_0x80b6('0xa'));var jsforce=require(_0x80b6('0xb'));var deskjs=require(_0x80b6('0xc'));var toCsv=require(_0x80b6('0xd'));var querystring=require(_0x80b6('0xe'));var Papa=require(_0x80b6('0xf'));var Redis=require(_0x80b6('0x10'));var authService=require(_0x80b6('0x11'));var qs=require(_0x80b6('0x12'));var hardwareService=require(_0x80b6('0x13'));var logger=require('../../config/logger')(_0x80b6('0x14'));var utils=require(_0x80b6('0x15'));var config=require(_0x80b6('0x16'));var db=require(_0x80b6('0x17'))['db'];config['redis']=_[_0x80b6('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x80b6('0x19'))[_0x80b6('0x1a')](socket);var jayson=require(_0x80b6('0x1b'));var client=jayson[_0x80b6('0x1c')][_0x80b6('0x1d')]({'port':0x232c});var client9002=jayson[_0x80b6('0x1c')][_0x80b6('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5c1448,_0x34c587,_0x4e4a09){if(_0x4e4a09){var _0x506ff6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x506ff6['test'](_0x34c587)){return _0x5c1448;}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 _0x5c1448;}}function respondWithRpcPromise(_0x2d6d52,_0x401549,_0x21a0bc,_0x577c73){return new BPromise(function(_0x10c38f,_0x552f76){var _0x564a28=_0x577c73||client;return _0x564a28[_0x80b6('0x1e')](_0x2d6d52,_0x21a0bc)[_0x80b6('0x1f')](function(_0x1a686f){logger[_0x80b6('0x20')](_0x80b6('0x21'),_0x401549,'request\x20sent');logger['debug'](_0x80b6('0x22'),_0x401549,_0x80b6('0x23'),JSON[_0x80b6('0x24')](_0x1a686f));if(_0x1a686f[_0x80b6('0x25')]){if(_0x1a686f[_0x80b6('0x25')][_0x80b6('0x26')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x401549,_0x1a686f[_0x80b6('0x25')][_0x80b6('0x27')]);return _0x552f76(_0x1a686f['error']['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x401549,_0x1a686f[_0x80b6('0x25')][_0x80b6('0x27')]);return _0x10c38f(_0x1a686f[_0x80b6('0x25')][_0x80b6('0x27')]);}else{logger[_0x80b6('0x20')]('FaxAccount,\x20%s,\x20%s',_0x401549,_0x80b6('0x23'));_0x10c38f(_0x1a686f[_0x80b6('0x28')][_0x80b6('0x27')]);}})['catch'](function(_0x3501ca){logger['error']('FaxAccount,\x20%s,\x20%s',_0x401549,_0x3501ca);_0x552f76(_0x3501ca);});});}function respondWithStatusCode(_0x58bc34,_0x3d29d7){_0x3d29d7=_0x3d29d7||0xcc;return function(_0xacdfd3){if(_0xacdfd3){return _0x58bc34['sendStatus'](_0x3d29d7);}return _0x58bc34[_0x80b6('0x29')](_0x3d29d7)[_0x80b6('0x2a')]();};}function respondWithResult(_0x3f6bf4,_0xb348c4){_0xb348c4=_0xb348c4||0xc8;return function(_0x5e8029){if(_0x5e8029){return _0x3f6bf4[_0x80b6('0x29')](_0xb348c4)[_0x80b6('0x2b')](_0x5e8029);}};}function respondWithFilteredResult(_0x418ed6,_0x2b99bb){return function(_0x9421b){if(_0x9421b){var _0x2bbb26=_0x9421b['count'],_0x241a77=_0x2b99bb[_0x80b6('0x2c')],_0x22f4c3=_0x2b99bb[_0x80b6('0x2c')]+_0x2b99bb['limit'],_0x456994;if(_0x22f4c3>=_0x2bbb26){_0x22f4c3=_0x2bbb26;_0x456994=0xc8;}else{_0x456994=0xce;}_0x418ed6[_0x80b6('0x29')](_0x456994);return _0x418ed6['set'](_0x80b6('0x2d'),_0x241a77+'-'+_0x22f4c3+'/'+_0x2bbb26)['json'](_0x9421b);}return null;};}function patchUpdates(_0x321617){return function(_0x27f8ae){try{jsonpatch[_0x80b6('0x2e')](_0x27f8ae,_0x321617,!![]);}catch(_0x5ec9cc){return BPromise[_0x80b6('0x2f')](_0x5ec9cc);}return _0x27f8ae[_0x80b6('0x30')]();};}function saveUpdates(_0x32c662,_0x308d60){return function(_0x598f33){if(_0x598f33){return _0x598f33['update'](_0x32c662)[_0x80b6('0x1f')](function(_0x5203c1){return _0x5203c1;});}return null;};}function removeEntity(_0x52aaab,_0x312f16){return function(_0xe35d82){if(_0xe35d82){return _0xe35d82[_0x80b6('0x31')]()[_0x80b6('0x1f')](function(){var _0x184d94=_0xe35d82[_0x80b6('0x32')]({'plain':!![]});var _0x5319a0=_0x80b6('0x33');return db[_0x80b6('0x34')][_0x80b6('0x31')]({'where':{'type':_0x5319a0,'resourceId':_0x184d94['id']}})[_0x80b6('0x1f')](function(){return _0xe35d82;});})[_0x80b6('0x1f')](function(){_0x52aaab[_0x80b6('0x29')](0xcc)[_0x80b6('0x2a')]();});}};}function handleEntityNotFound(_0x411554,_0x45acfb){return function(_0x3e9e84){if(!_0x3e9e84){_0x411554[_0x80b6('0x35')](0x194);}return _0x3e9e84;};}function handleError(_0x398e54,_0x26fa9f){_0x26fa9f=_0x26fa9f||0x1f4;return function(_0x2fab27){logger[_0x80b6('0x25')](_0x2fab27[_0x80b6('0x36')]);if(_0x2fab27[_0x80b6('0x37')]){delete _0x2fab27[_0x80b6('0x37')];}_0x398e54[_0x80b6('0x29')](_0x26fa9f)['send'](_0x2fab27);};}exports[_0x80b6('0x38')]=function(_0x1ac106,_0x54180c){var _0x2515e9={'include':[{'model':db[_0x80b6('0x39')],'as':_0x80b6('0x3a')}]},_0xd6bbd6={},_0x3fc0de={'count':0x0,'rows':[]};var _0x1d21c3=db['FaxAccount'][_0x80b6('0x3b')];_0xd6bbd6[_0x80b6('0x3c')]=_[_0x80b6('0x3d')](_0x1d21c3);_0xd6bbd6[_0x80b6('0x3e')]=_[_0x80b6('0x3d')](_0x1ac106['query']);_0xd6bbd6[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0xd6bbd6[_0x80b6('0x3c')],_0xd6bbd6['query']);_0x2515e9['attributes']=_[_0x80b6('0x40')](_0xd6bbd6[_0x80b6('0x3c')],qs[_0x80b6('0x41')](_0x1ac106[_0x80b6('0x3e')]['fields']));_0x2515e9[_0x80b6('0x42')]=_0x2515e9[_0x80b6('0x42')]['length']?_0x2515e9['attributes']:_0xd6bbd6[_0x80b6('0x3c')];if(!_0x1ac106[_0x80b6('0x3e')][_0x80b6('0x43')](_0x80b6('0x44'))){_0x2515e9[_0x80b6('0x45')]=qs['limit'](_0x1ac106[_0x80b6('0x3e')][_0x80b6('0x45')]);_0x2515e9[_0x80b6('0x2c')]=qs[_0x80b6('0x2c')](_0x1ac106['query'][_0x80b6('0x2c')]);}_0x2515e9[_0x80b6('0x46')]=qs[_0x80b6('0x47')](_0x1ac106[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x2515e9['where']=qs[_0x80b6('0x3f')](_[_0x80b6('0x48')](_0x1ac106[_0x80b6('0x3e')],_0xd6bbd6[_0x80b6('0x3f')]));if(_0x1ac106['query'][_0x80b6('0x49')]){_0x2515e9['where']=_[_0x80b6('0x4a')](_0x2515e9['where'],{'$or':_[_0x80b6('0x4b')](_0x1d21c3,function(_0x51f1ce){if(_0x51f1ce[_0x80b6('0x4c')][_0x80b6('0x4d')]!=='VIRTUAL'){var _0x1ce7e8={};_0x1ce7e8[_0x51f1ce[_0x80b6('0x4e')]]={'$like':'%'+_0x1ac106[_0x80b6('0x3e')][_0x80b6('0x49')]+'%'};return _0x1ce7e8;}})});}_0x2515e9=_[_0x80b6('0x4a')]({},_0x2515e9,_0x1ac106[_0x80b6('0x4f')]);var _0x2a73d5={'where':_0x2515e9[_0x80b6('0x50')]};return db['FaxAccount'][_0x80b6('0x51')](_0x2a73d5)['then'](function(_0xa36184){_0x3fc0de[_0x80b6('0x51')]=_0xa36184;if(_0x1ac106[_0x80b6('0x3e')]['includeAll']){_0x2515e9[_0x80b6('0x52')]=[{'all':!![]}];}return db[_0x80b6('0x53')]['findAll'](_0x2515e9);})[_0x80b6('0x1f')](function(_0x12af5c){_0x3fc0de[_0x80b6('0x54')]=_0x12af5c;return _0x3fc0de;})['then'](respondWithFilteredResult(_0x54180c,_0x2515e9))['catch'](handleError(_0x54180c,null));};exports[_0x80b6('0x55')]=function(_0x4a6151,_0x462333){var _0x2485bb={'raw':![],'where':{'id':_0x4a6151[_0x80b6('0x56')]['id']},'include':[{'model':db[_0x80b6('0x39')],'as':_0x80b6('0x3a')}]},_0x24b4c8={};_0x24b4c8[_0x80b6('0x3c')]=_[_0x80b6('0x3d')](db[_0x80b6('0x53')]['rawAttributes']);_0x24b4c8['query']=_['keys'](_0x4a6151['query']);_0x24b4c8[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0x24b4c8[_0x80b6('0x3c')],_0x24b4c8[_0x80b6('0x3e')]);_0x2485bb[_0x80b6('0x42')]=_[_0x80b6('0x40')](_0x24b4c8['model'],qs[_0x80b6('0x41')](_0x4a6151[_0x80b6('0x3e')][_0x80b6('0x41')]));_0x2485bb[_0x80b6('0x42')]=_0x2485bb['attributes']['length']?_0x2485bb[_0x80b6('0x42')]:_0x24b4c8[_0x80b6('0x3c')];if(_0x4a6151[_0x80b6('0x3e')][_0x80b6('0x57')]){_0x2485bb[_0x80b6('0x52')]=[{'all':!![]}];}_0x2485bb=_[_0x80b6('0x4a')]({},_0x2485bb,_0x4a6151[_0x80b6('0x4f')]);return db['FaxAccount'][_0x80b6('0x58')](_0x2485bb)['then'](handleEntityNotFound(_0x462333,null))[_0x80b6('0x1f')](respondWithResult(_0x462333,null))[_0x80b6('0x59')](handleError(_0x462333,null));};exports[_0x80b6('0x5a')]=function(_0xbadeac,_0x2e2796){return db[_0x80b6('0x53')][_0x80b6('0x5a')](_0xbadeac[_0x80b6('0x5b')],{})[_0x80b6('0x1f')](function(_0x2617c4){var _0x123704=_0xbadeac['user'][_0x80b6('0x32')]({'plain':!![]});if(!_0x123704)throw new Error(_0x80b6('0x5c'));if(_0x123704[_0x80b6('0x5d')]===_0x80b6('0x5e')){var _0x3943ce=_0x2617c4[_0x80b6('0x32')]({'plain':!![]});var _0x16ef60=_0x80b6('0x33');return db[_0x80b6('0x5f')][_0x80b6('0x58')]({'where':{'name':_0x16ef60,'userProfileId':_0x123704[_0x80b6('0x60')]},'raw':!![]})[_0x80b6('0x1f')](function(_0x13a016){if(_0x13a016&&_0x13a016['autoAssociation']===0x0){return db[_0x80b6('0x34')][_0x80b6('0x5a')]({'name':_0x3943ce['name'],'resourceId':_0x3943ce['id'],'type':_0x13a016[_0x80b6('0x37')],'sectionId':_0x13a016['id']},{})[_0x80b6('0x1f')](function(){return _0x2617c4;});}else{return _0x2617c4;}})[_0x80b6('0x59')](function(_0x49232e){logger[_0x80b6('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49232e);throw _0x49232e;});}return _0x2617c4;})[_0x80b6('0x1f')](respondWithResult(_0x2e2796,0xc9))[_0x80b6('0x59')](handleError(_0x2e2796,null));};exports[_0x80b6('0x61')]=function(_0x47d7a3,_0x51fc0f){if(_0x47d7a3[_0x80b6('0x5b')]['id']){delete _0x47d7a3[_0x80b6('0x5b')]['id'];}return db[_0x80b6('0x53')][_0x80b6('0x58')]({'where':{'id':_0x47d7a3[_0x80b6('0x56')]['id']},'include':[{'model':db[_0x80b6('0x39')],'as':_0x80b6('0x3a')}]})[_0x80b6('0x1f')](handleEntityNotFound(_0x51fc0f,null))['then'](saveUpdates(_0x47d7a3[_0x80b6('0x5b')],null))[_0x80b6('0x1f')](respondWithResult(_0x51fc0f,null))[_0x80b6('0x59')](handleError(_0x51fc0f,null));};exports[_0x80b6('0x31')]=function(_0x1dcbc9,_0x10746e){return db[_0x80b6('0x53')][_0x80b6('0x58')]({'where':{'id':_0x1dcbc9['params']['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x10746e,null))[_0x80b6('0x1f')](removeEntity(_0x10746e,null))[_0x80b6('0x59')](handleError(_0x10746e,null));};exports[_0x80b6('0x62')]=function(_0x31e072,_0x4651b5){return db['FaxAccount'][_0x80b6('0x62')]()['then'](respondWithResult(_0x4651b5,null))[_0x80b6('0x59')](handleError(_0x4651b5,null));};exports[_0x80b6('0x63')]=function(_0x390be7,_0x1a201d,_0x1541dc){if(_0x390be7[_0x80b6('0x5b')]['id']){delete _0x390be7['body']['id'];}return db[_0x80b6('0x53')]['find']({'where':{'id':_0x390be7[_0x80b6('0x56')]['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x1a201d,null))[_0x80b6('0x1f')](function(_0x4bd931){if(_0x4bd931){_0x390be7[_0x80b6('0x5b')]['FaxAccountId']=_0x4bd931['id'];return db[_0x80b6('0x64')]['create'](_0x390be7[_0x80b6('0x5b')]);}})[_0x80b6('0x1f')](respondWithResult(_0x1a201d,null))[_0x80b6('0x59')](handleError(_0x1a201d,null));};exports[_0x80b6('0x65')]=function(_0x2fe0cc,_0x6ab90,_0x3c10cf){var _0x360ed6={'raw':![],'where':{}};var _0x4bb8c0={};var _0x2f1461={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2fe0cc[_0x80b6('0x56')]['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x6ab90,null))[_0x80b6('0x1f')](function(_0x4db3f0){if(_0x4db3f0){_0x4bb8c0[_0x80b6('0x3c')]=_[_0x80b6('0x3d')](db[_0x80b6('0x64')]['rawAttributes']);_0x4bb8c0[_0x80b6('0x3e')]=_[_0x80b6('0x3d')](_0x2fe0cc[_0x80b6('0x3e')]);_0x4bb8c0[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0x4bb8c0[_0x80b6('0x3c')],_0x4bb8c0[_0x80b6('0x3e')]);_0x360ed6[_0x80b6('0x42')]=_[_0x80b6('0x40')](_0x4bb8c0[_0x80b6('0x3c')],qs[_0x80b6('0x41')](_0x2fe0cc[_0x80b6('0x3e')]['fields']));_0x360ed6['attributes']=_0x360ed6[_0x80b6('0x42')][_0x80b6('0x66')]?_0x360ed6[_0x80b6('0x42')]:_0x4bb8c0[_0x80b6('0x3c')];if(!_0x2fe0cc[_0x80b6('0x3e')]['hasOwnProperty'](_0x80b6('0x44'))){_0x360ed6[_0x80b6('0x45')]=qs[_0x80b6('0x45')](_0x2fe0cc[_0x80b6('0x3e')][_0x80b6('0x45')]);_0x360ed6['offset']=qs[_0x80b6('0x2c')](_0x2fe0cc[_0x80b6('0x3e')][_0x80b6('0x2c')]);}_0x360ed6[_0x80b6('0x46')]=qs[_0x80b6('0x47')](_0x2fe0cc[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x360ed6['where']=qs['filters'](_[_0x80b6('0x48')](_0x2fe0cc[_0x80b6('0x3e')],_0x4bb8c0[_0x80b6('0x3f')]));_0x360ed6[_0x80b6('0x50')][_0x80b6('0x67')]=_0x4db3f0['id'];if(_0x2fe0cc[_0x80b6('0x3e')]['filter']){_0x360ed6[_0x80b6('0x50')]=_[_0x80b6('0x4a')](_0x360ed6[_0x80b6('0x50')],{'$or':_[_0x80b6('0x4b')](_0x360ed6[_0x80b6('0x42')],function(_0x5cc5ae){var _0x213c7b={};_0x213c7b[_0x5cc5ae]={'$like':'%'+_0x2fe0cc[_0x80b6('0x3e')][_0x80b6('0x49')]+'%'};return _0x213c7b;})});}_0x360ed6=_['merge']({},_0x360ed6,_0x2fe0cc['options']);return db[_0x80b6('0x64')][_0x80b6('0x51')]({'where':_0x360ed6[_0x80b6('0x50')]})[_0x80b6('0x1f')](function(_0x12f066){_0x2f1461[_0x80b6('0x51')]=_0x12f066;if(_0x2fe0cc[_0x80b6('0x3e')]['includeAll']){_0x360ed6['include']=[{'all':!![]}];}return db[_0x80b6('0x64')][_0x80b6('0x68')](_0x360ed6);})['then'](function(_0x7b4fee){_0x2f1461[_0x80b6('0x54')]=_0x7b4fee;return _0x2f1461;});}})['then'](respondWithFilteredResult(_0x6ab90,_0x360ed6))[_0x80b6('0x59')](handleError(_0x6ab90,null));};exports[_0x80b6('0x69')]=function(_0x257ca7,_0x390918,_0x3fceaa){return db[_0x80b6('0x53')]['find']({'where':{'id':_0x257ca7['params']['id']}})['then'](handleEntityNotFound(_0x390918,null))[_0x80b6('0x1f')](function(_0x2d72c9){if(_0x2d72c9){return _0x2d72c9['removeDispositions'](_0x257ca7['query']['ids']);}})[_0x80b6('0x1f')](respondWithStatusCode(_0x390918,null))[_0x80b6('0x59')](handleError(_0x390918,null));};exports['addAnswer']=function(_0x7e66ae,_0x5f3235,_0x4086d5){if(_0x7e66ae[_0x80b6('0x5b')]['id']){delete _0x7e66ae[_0x80b6('0x5b')]['id'];}return db['FaxAccount'][_0x80b6('0x58')]({'where':{'id':_0x7e66ae[_0x80b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3235,null))['then'](function(_0x5c988c){if(_0x5c988c){_0x7e66ae[_0x80b6('0x5b')][_0x80b6('0x67')]=_0x5c988c['id'];return db['CannedAnswer'][_0x80b6('0x5a')](_0x7e66ae[_0x80b6('0x5b')]);}})[_0x80b6('0x1f')](respondWithResult(_0x5f3235,null))[_0x80b6('0x59')](handleError(_0x5f3235,null));};exports[_0x80b6('0x6a')]=function(_0x3dd3e2,_0x39105c,_0xddb9b4){var _0x39e82e={'raw':![],'where':{}};var _0x2ed71e={};var _0x2ca419={'count':0x0,'rows':[]};return db[_0x80b6('0x53')][_0x80b6('0x6b')]({'where':{'id':_0x3dd3e2[_0x80b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x39105c,null))[_0x80b6('0x1f')](function(_0x3916ea){if(_0x3916ea){_0x2ed71e['model']=_[_0x80b6('0x3d')](db[_0x80b6('0x6c')][_0x80b6('0x3b')]);_0x2ed71e[_0x80b6('0x3e')]=_['keys'](_0x3dd3e2['query']);_0x2ed71e['filters']=_[_0x80b6('0x40')](_0x2ed71e[_0x80b6('0x3c')],_0x2ed71e[_0x80b6('0x3e')]);_0x39e82e[_0x80b6('0x42')]=_[_0x80b6('0x40')](_0x2ed71e[_0x80b6('0x3c')],qs[_0x80b6('0x41')](_0x3dd3e2[_0x80b6('0x3e')]['fields']));_0x39e82e['attributes']=_0x39e82e[_0x80b6('0x42')][_0x80b6('0x66')]?_0x39e82e['attributes']:_0x2ed71e[_0x80b6('0x3c')];if(!_0x3dd3e2[_0x80b6('0x3e')]['hasOwnProperty'](_0x80b6('0x44'))){_0x39e82e[_0x80b6('0x45')]=qs[_0x80b6('0x45')](_0x3dd3e2[_0x80b6('0x3e')]['limit']);_0x39e82e[_0x80b6('0x2c')]=qs[_0x80b6('0x2c')](_0x3dd3e2['query'][_0x80b6('0x2c')]);}_0x39e82e[_0x80b6('0x46')]=qs[_0x80b6('0x47')](_0x3dd3e2[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x39e82e['where']=qs[_0x80b6('0x3f')](_[_0x80b6('0x48')](_0x3dd3e2[_0x80b6('0x3e')],_0x2ed71e[_0x80b6('0x3f')]));_0x39e82e[_0x80b6('0x50')][_0x80b6('0x67')]=_0x3916ea['id'];if(_0x3dd3e2[_0x80b6('0x3e')]['filter']){_0x39e82e[_0x80b6('0x50')]=_['merge'](_0x39e82e[_0x80b6('0x50')],{'$or':_[_0x80b6('0x4b')](_0x39e82e[_0x80b6('0x42')],function(_0x54517c){var _0x4a3175={};_0x4a3175[_0x54517c]={'$like':'%'+_0x3dd3e2['query'][_0x80b6('0x49')]+'%'};return _0x4a3175;})});}_0x39e82e=_[_0x80b6('0x4a')]({},_0x39e82e,_0x3dd3e2['options']);return db[_0x80b6('0x6c')][_0x80b6('0x51')]({'where':_0x39e82e[_0x80b6('0x50')]})[_0x80b6('0x1f')](function(_0x55a7a1){_0x2ca419[_0x80b6('0x51')]=_0x55a7a1;if(_0x3dd3e2[_0x80b6('0x3e')][_0x80b6('0x57')]){_0x39e82e['include']=[{'all':!![]}];}return db[_0x80b6('0x6c')][_0x80b6('0x68')](_0x39e82e);})[_0x80b6('0x1f')](function(_0x935826){_0x2ca419['rows']=_0x935826;return _0x2ca419;});}})[_0x80b6('0x1f')](respondWithFilteredResult(_0x39105c,_0x39e82e))[_0x80b6('0x59')](handleError(_0x39105c,null));};exports[_0x80b6('0x6d')]=function(_0x35e0c1,_0x48de37,_0x12bab7){return db['FaxAccount']['find']({'where':{'id':_0x35e0c1['params']['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x48de37,null))[_0x80b6('0x1f')](function(_0x14db3c){if(_0x14db3c){return _0x14db3c[_0x80b6('0x6d')](_0x35e0c1['query'][_0x80b6('0x6e')]);}})[_0x80b6('0x1f')](respondWithStatusCode(_0x48de37,null))[_0x80b6('0x59')](handleError(_0x48de37,null));};exports[_0x80b6('0x6f')]=function(_0x3c2857,_0x50c704,_0x353d21){return db['FaxInteraction'][_0x80b6('0x58')]({'where':{'id':_0x3c2857[_0x80b6('0x56')]['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x50c704,null))['then'](function(_0x38cb5f){if(_0x38cb5f){return _0x38cb5f[_0x80b6('0x6f')](_0x3c2857[_0x80b6('0x5b')][_0x80b6('0x6e')],_[_0x80b6('0x70')](_0x3c2857['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x50c704,null))[_0x80b6('0x59')](handleError(_0x50c704,null));};exports['getInteractions']=function(_0x4636af,_0x34e479,_0x3cb41c){var _0x40716f={'raw':![],'where':{}};var _0x27d502={};var _0x31ab93={'count':0x0,'rows':[]};return db[_0x80b6('0x53')][_0x80b6('0x6b')]({'where':{'id':_0x4636af[_0x80b6('0x56')]['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x34e479,null))[_0x80b6('0x1f')](function(_0x3e110d){if(_0x3e110d){_0x27d502[_0x80b6('0x3c')]=_['keys'](db[_0x80b6('0x71')]['rawAttributes']);_0x27d502['query']=_['keys'](_0x4636af[_0x80b6('0x3e')]);_0x27d502['filters']=_[_0x80b6('0x40')](_0x27d502['model'],_0x27d502[_0x80b6('0x3e')]);_0x40716f[_0x80b6('0x42')]=_['intersection'](_0x27d502[_0x80b6('0x3c')],qs['fields'](_0x4636af[_0x80b6('0x3e')][_0x80b6('0x41')]));_0x40716f[_0x80b6('0x42')]=_0x40716f['attributes'][_0x80b6('0x66')]?_0x40716f[_0x80b6('0x42')]:_0x27d502['model'];if(!_0x4636af[_0x80b6('0x3e')][_0x80b6('0x43')](_0x80b6('0x44'))){_0x40716f[_0x80b6('0x45')]=qs[_0x80b6('0x45')](_0x4636af['query'][_0x80b6('0x45')]);_0x40716f[_0x80b6('0x2c')]=qs['offset'](_0x4636af[_0x80b6('0x3e')][_0x80b6('0x2c')]);}_0x40716f['order']=qs[_0x80b6('0x47')](_0x4636af[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x40716f[_0x80b6('0x50')]=qs[_0x80b6('0x3f')](_[_0x80b6('0x48')](_0x4636af[_0x80b6('0x3e')],_0x27d502[_0x80b6('0x3f')]));_0x40716f[_0x80b6('0x50')]['FaxAccountId']=_0x3e110d['id'];if(_0x4636af['query'][_0x80b6('0x49')]){_0x40716f['where']=_[_0x80b6('0x4a')](_0x40716f[_0x80b6('0x50')],{'$or':_[_0x80b6('0x4b')](_0x40716f[_0x80b6('0x42')],function(_0x20fb47){var _0x1b9e76={};_0x1b9e76[_0x20fb47]={'$like':'%'+_0x4636af[_0x80b6('0x3e')][_0x80b6('0x49')]+'%'};return _0x1b9e76;})});}_0x40716f=_[_0x80b6('0x4a')]({},_0x40716f,_0x4636af[_0x80b6('0x4f')]);return db[_0x80b6('0x71')][_0x80b6('0x51')]({'where':_0x40716f[_0x80b6('0x50')]})[_0x80b6('0x1f')](function(_0x559a27){_0x31ab93[_0x80b6('0x51')]=_0x559a27;if(_0x4636af[_0x80b6('0x3e')][_0x80b6('0x57')]){_0x40716f[_0x80b6('0x52')]=[{'model':db['CmContact'],'as':_0x80b6('0x72'),'required':![]},{'model':db[_0x80b6('0x73')],'as':'Owner','attributes':[_0x80b6('0x37'),_0x80b6('0x74'),_0x80b6('0x75')],'required':![]},{'model':db[_0x80b6('0x76')],'as':_0x80b6('0x77'),'attributes':['id','name',_0x80b6('0x78')],'where':_0x4636af[_0x80b6('0x3e')][_0x80b6('0x79')]?{'id':_0x4636af['query'][_0x80b6('0x79')]}:undefined,'required':_0x4636af[_0x80b6('0x3e')]['tag']?!![]:![]}];}return db[_0x80b6('0x71')]['findAll'](_0x40716f);})['then'](function(_0x90fe05){_0x31ab93[_0x80b6('0x54')]=_0x90fe05;return _0x31ab93;});}})[_0x80b6('0x1f')](respondWithFilteredResult(_0x34e479,_0x40716f))[_0x80b6('0x59')](handleError(_0x34e479,null));};exports['addApplications']=function(_0x8ac3d5,_0x65e9e4,_0xad7de9){return db['FaxAccount'][_0x80b6('0x6b')]({'where':{'id':_0x8ac3d5['params']['id']}})['then'](handleEntityNotFound(_0x65e9e4,null))[_0x80b6('0x1f')](function(_0x50acae){if(_0x50acae){return db[_0x80b6('0x7a')]['transaction'](function(_0x342ac4){return db[_0x80b6('0x7b')]['destroy']({'where':{'FaxAccountId':_0x8ac3d5[_0x80b6('0x56')]['id']},'transaction':_0x342ac4})['then'](function(_0x645cc5){var _0x1106e9=_['map'](_0x8ac3d5[_0x80b6('0x5b')],function(_0x405912){_0x405912['FaxAccountId']=_0x8ac3d5[_0x80b6('0x56')]['id'];return _0x405912;});return db[_0x80b6('0x7b')][_0x80b6('0x7c')](_0x1106e9,{'transaction':_0x342ac4});});})[_0x80b6('0x1f')](function(){return db['FaxApplication'][_0x80b6('0x7d')]({'where':{'FaxAccountId':_0x8ac3d5['params']['id']},'order':_0x80b6('0x7e')});});}})[_0x80b6('0x1f')](respondWithResult(_0x65e9e4,null))['catch'](handleError(_0x65e9e4,null));};exports[_0x80b6('0x7f')]=function(_0x5286bd,_0x5d4d5c,_0x1626d5){var _0x234130={};var _0x9380ad={};var _0x5a910c;var _0x10f20a;return db[_0x80b6('0x53')][_0x80b6('0x6b')]({'where':{'id':_0x5286bd[_0x80b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d4d5c,null))['then'](function(_0x112892){if(_0x112892){_0x5a910c=_0x112892;_0x9380ad[_0x80b6('0x3c')]=_[_0x80b6('0x3d')](db['FaxApplication'][_0x80b6('0x3b')]);_0x9380ad[_0x80b6('0x3e')]=_[_0x80b6('0x3d')](_0x5286bd[_0x80b6('0x3e')]);_0x9380ad[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0x9380ad[_0x80b6('0x3c')],_0x9380ad['query']);_0x234130[_0x80b6('0x42')]=_[_0x80b6('0x40')](_0x9380ad[_0x80b6('0x3c')],qs[_0x80b6('0x41')](_0x5286bd[_0x80b6('0x3e')][_0x80b6('0x41')]));_0x234130[_0x80b6('0x42')]=_0x234130[_0x80b6('0x42')]['length']?_0x234130['attributes']:_0x9380ad[_0x80b6('0x3c')];_0x234130[_0x80b6('0x46')]=qs[_0x80b6('0x47')](_0x5286bd[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x234130['where']=qs[_0x80b6('0x3f')](_[_0x80b6('0x48')](_0x5286bd[_0x80b6('0x3e')],_0x9380ad[_0x80b6('0x3f')]));if(_0x5286bd[_0x80b6('0x3e')][_0x80b6('0x49')]){_0x234130['where']=_['merge'](_0x234130[_0x80b6('0x50')],{'$or':_[_0x80b6('0x4b')](_0x234130[_0x80b6('0x42')],function(_0x1ac1ad){var _0x3f710d={};_0x3f710d[_0x1ac1ad]={'$like':'%'+_0x5286bd['query']['filter']+'%'};return _0x3f710d;})});}_0x234130=_[_0x80b6('0x4a')]({},_0x234130,_0x5286bd[_0x80b6('0x4f')]);return _0x5a910c['getApplications'](_0x234130);}})[_0x80b6('0x1f')](function(_0x4c2bfd){if(_0x4c2bfd){_0x10f20a=_0x4c2bfd[_0x80b6('0x66')];if(!_0x5286bd[_0x80b6('0x3e')]['hasOwnProperty'](_0x80b6('0x44'))){_0x234130['limit']=qs[_0x80b6('0x45')](_0x5286bd[_0x80b6('0x3e')][_0x80b6('0x45')]);_0x234130[_0x80b6('0x2c')]=qs[_0x80b6('0x2c')](_0x5286bd['query'][_0x80b6('0x2c')]);}return _0x5a910c[_0x80b6('0x7f')](_0x234130);}})[_0x80b6('0x1f')](function(_0x4d84cd){if(_0x4d84cd){return _0x4d84cd?{'count':_0x10f20a,'rows':_0x4d84cd}:null;}})[_0x80b6('0x1f')](respondWithResult(_0x5d4d5c,null))[_0x80b6('0x59')](handleError(_0x5d4d5c,null));};function Extension(_0x731c17,_0x5f3377,_0x3eedc9,_0x1db17c){this[_0x80b6('0x80')]=_0x80b6('0x81');this[_0x80b6('0x82')]=_0x731c17['localstationid'];this['app']=_0x1db17c;this[_0x80b6('0x4c')]=_0x80b6('0x83');this[_0x80b6('0x84')]=_0x80b6('0x85');this['FaxAccountId']=_0x731c17['id'];this['priority']=_0x5f3377;this[_0x80b6('0x86')]=_0x3eedc9;}function createExtensionsReciveFax(_0x157c0f){var _0x333a33=0x1;var _0x570efa=[];_0x570efa[_0x80b6('0x87')](new Extension(_0x157c0f,_0x333a33,'',_0x80b6('0x88')));_0x333a33+=0x1;_0x570efa[_0x80b6('0x87')](new Extension(_0x157c0f,_0x333a33,_0x80b6('0x89'),_0x80b6('0x8a')));_0x333a33+=0x1;for(var _0x53e83f in _0x157c0f){if(_0x157c0f[_0x80b6('0x43')](_0x53e83f)&&(_0x53e83f===_0x80b6('0x8b')||_0x53e83f===_0x80b6('0x8c')||_0x53e83f===_0x80b6('0x8d')||_0x53e83f==='faxdetect'||_0x53e83f===_0x80b6('0x8e')||_0x53e83f===_0x80b6('0x8f')||_0x53e83f===_0x80b6('0x90')||_0x53e83f===_0x80b6('0x91')||_0x53e83f===_0x80b6('0x92'))){_0x570efa[_0x80b6('0x87')](new Extension(_0x157c0f,_0x333a33,'FAXOPT('+_0x53e83f+')='+_0x157c0f[_0x53e83f],'Set'));_0x333a33+=0x1;}}_0x570efa[_0x80b6('0x87')](new Extension(_0x157c0f,_0x333a33,'6',_0x80b6('0x93')));_0x333a33+=0x1;_0x570efa[_0x80b6('0x87')](new Extension(_0x157c0f,_0x333a33,_0x80b6('0x94'),_0x80b6('0x95')));_0x333a33=0x0;return _0x570efa;}exports[_0x80b6('0x96')]=function(_0x55c06e,_0xd47ab3,_0x578376){var _0x27282b;return db[_0x80b6('0x7a')][_0x80b6('0x97')](function(_0x4b4bb6){return db['FaxAccount'][_0x80b6('0x5a')](_0x55c06e[_0x80b6('0x5b')],{'transaction':_0x4b4bb6})[_0x80b6('0x1f')](function(_0x595b6d){_0x27282b=_0x595b6d['get']({'plain':!![]});return db[_0x80b6('0x98')][_0x80b6('0x7c')](createExtensionsReciveFax(_0x27282b),{'transaction':_0x4b4bb6});});})[_0x80b6('0x1f')](function(){return _0x27282b;})['then'](respondWithResult(_0xd47ab3,null))[_0x80b6('0x59')](handleError(_0xd47ab3,null));};exports[_0x80b6('0x99')]=function(_0x358ecd,_0x350922,_0x479e9e){var _0x1ab28e;return db[_0x80b6('0x7a')][_0x80b6('0x97')](function(_0x1f1fba){return db['FaxAccount']['update'](_0x358ecd[_0x80b6('0x5b')],{'where':{'id':_0x358ecd[_0x80b6('0x5b')]['id']},'transaction':_0x1f1fba})[_0x80b6('0x1f')](function(_0x1ba61f){return db[_0x80b6('0x98')][_0x80b6('0x31')]({'where':{'FaxAccountId':_0x358ecd[_0x80b6('0x5b')]['id']},'transaction':_0x1f1fba})['then'](function(_0x323a29){return db[_0x80b6('0x98')]['bulkCreate'](createExtensionsReciveFax(_[_0x80b6('0x70')](_0x358ecd[_0x80b6('0x5b')],[_0x80b6('0x9a'),_0x80b6('0x4d'),_0x80b6('0x9b'),_0x80b6('0x9c'),_0x80b6('0x9d'),_0x80b6('0x9e')])),{'transaction':_0x1f1fba});});});})[_0x80b6('0x1f')](function(){return db[_0x80b6('0x53')][_0x80b6('0x9f')](_0x358ecd[_0x80b6('0x5b')]['id']);})[_0x80b6('0x1f')](respondWithResult(_0x350922,null))[_0x80b6('0x59')](handleError(_0x350922,null));};exports['getMessages']=function(_0x20b51c,_0x10f1a5,_0xe97007){var _0x16a2bf={'raw':!![],'where':{}};var _0xbd3707={};var _0x5f26bd={'count':0x0,'rows':[]};return db[_0x80b6('0x53')][_0x80b6('0x6b')]({'where':{'id':_0x20b51c[_0x80b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x10f1a5,null))[_0x80b6('0x1f')](function(_0x35634a){if(_0x35634a){_0xbd3707[_0x80b6('0x3c')]=_[_0x80b6('0x3d')](db[_0x80b6('0xa0')][_0x80b6('0x3b')]);_0xbd3707[_0x80b6('0x3e')]=_['keys'](_0x20b51c[_0x80b6('0x3e')]);_0xbd3707[_0x80b6('0x3f')]=_[_0x80b6('0x40')](_0xbd3707[_0x80b6('0x3c')],_0xbd3707[_0x80b6('0x3e')]);_0x16a2bf[_0x80b6('0x42')]=_[_0x80b6('0x40')](_0xbd3707['model'],qs[_0x80b6('0x41')](_0x20b51c[_0x80b6('0x3e')][_0x80b6('0x41')]));_0x16a2bf[_0x80b6('0x42')]=_0x16a2bf[_0x80b6('0x42')][_0x80b6('0x66')]?_0x16a2bf['attributes']:_0xbd3707[_0x80b6('0x3c')];if(!_0x20b51c['query'][_0x80b6('0x43')]('nolimit')){_0x16a2bf[_0x80b6('0x45')]=qs[_0x80b6('0x45')](_0x20b51c['query'][_0x80b6('0x45')]);_0x16a2bf['offset']=qs[_0x80b6('0x2c')](_0x20b51c[_0x80b6('0x3e')][_0x80b6('0x2c')]);}_0x16a2bf[_0x80b6('0x46')]=qs[_0x80b6('0x47')](_0x20b51c[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x16a2bf[_0x80b6('0x50')]=qs['filters'](_[_0x80b6('0x48')](_0x20b51c[_0x80b6('0x3e')],_0xbd3707[_0x80b6('0x3f')]));_0x16a2bf[_0x80b6('0x50')]['FaxAccountId']=_0x35634a['id'];if(_0x20b51c[_0x80b6('0x3e')][_0x80b6('0x49')]){_0x16a2bf[_0x80b6('0x50')]=_['merge'](_0x16a2bf['where'],{'$or':_[_0x80b6('0x4b')](_0x16a2bf[_0x80b6('0x42')],function(_0x518bd4){var _0x5444fe={};_0x5444fe[_0x518bd4]={'$like':'%'+_0x20b51c[_0x80b6('0x3e')][_0x80b6('0x49')]+'%'};return _0x5444fe;})});}if(_0x20b51c[_0x80b6('0x3e')]['$gte']){var _0x124b6c=_0x20b51c[_0x80b6('0x3e')][_0x80b6('0xa1')][_0x80b6('0xa2')](',');var _0x4c1d6a={};_0x4c1d6a[_0x124b6c[0x0]]={'$gte':moment(_0x124b6c[0x1])[_0x80b6('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x16a2bf[_0x80b6('0x50')]=_['merge'](_0x16a2bf[_0x80b6('0x50')],_0x4c1d6a);}_0x16a2bf=_[_0x80b6('0x4a')]({},_0x16a2bf,_0x20b51c[_0x80b6('0x4f')]);return db['FaxMessage']['count']({'where':_0x16a2bf[_0x80b6('0x50')]})[_0x80b6('0x1f')](function(_0x59fd55){_0x5f26bd['count']=_0x59fd55;if(_0x20b51c['query'][_0x80b6('0x57')]){_0x16a2bf[_0x80b6('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x16a2bf);})[_0x80b6('0x1f')](function(_0x258a26){_0x5f26bd[_0x80b6('0x54')]=_0x258a26;return _0x5f26bd;});}})[_0x80b6('0x1f')](respondWithFilteredResult(_0x10f1a5,_0x16a2bf))[_0x80b6('0x59')](handleError(_0x10f1a5,null));};exports[_0x80b6('0xa4')]=function(_0x394705,_0x5a8ccf,_0x51aa6f){var _0x4e8f9c,_0x3a219b={},_0x16ec49;if(_0x394705['body']['to']){_0x16ec49=_0x394705[_0x80b6('0x5b')]['to'][0x0];}return db[_0x80b6('0x53')][_0x80b6('0x58')]({'where':{'id':_0x394705[_0x80b6('0x56')]['id']},'include':[{'model':db[_0x80b6('0xa5')],'as':_0x80b6('0xa6'),'include':[{'model':db[_0x80b6('0xa7')],'as':_0x80b6('0xa8'),'where':{'fax':_0x16ec49},'limit':0x1,'order':[[_0x80b6('0x9c'),_0x80b6('0xa9')]]}]}]})[_0x80b6('0x1f')](handleEntityNotFound(_0x5a8ccf,null))[_0x80b6('0x1f')](function(_0x4894e8){_0x4e8f9c=_0x4894e8;if(_0x394705[_0x80b6('0x5b')]['attachments']&&_0x394705['body'][_0x80b6('0xaa')][_0x80b6('0x66')]){for(var _0x1a84e2=0x0;_0x1a84e2<_0x394705[_0x80b6('0x5b')]['attachments'][_0x80b6('0x66')];_0x1a84e2+=0x1){_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][_0x1a84e2]={'filename':_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][_0x1a84e2][_0x80b6('0x37')],'id':_0x394705[_0x80b6('0x5b')]['attachments'][_0x1a84e2]['id'],'path':path[_0x80b6('0xab')](config[_0x80b6('0xac')],_0x80b6('0xad'),_0x394705[_0x80b6('0x5b')]['attachments'][_0x1a84e2][_0x80b6('0xae')])};}}return respondWithRpcPromise(_0x80b6('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0x80b6('0xb0')](_0x394705[_0x80b6('0x56')]['id'])?undefined:_0x394705[_0x80b6('0x56')]['id'],'path':_[_0x80b6('0xb0')](_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][0x0][_0x80b6('0x6')])?undefined:_0x394705[_0x80b6('0x5b')]['attachments'][0x0][_0x80b6('0x6')],'fax':_[_0x80b6('0xb0')](_0x394705[_0x80b6('0x5b')]['to'][0x0])?undefined:_0x394705[_0x80b6('0x5b')]['to'][0x0]},client9002);})[_0x80b6('0x1f')](function(){if(_0x4e8f9c){if(_[_0x80b6('0xb0')](_0x394705[_0x80b6('0x5b')][_0x80b6('0xb1')])){_0x394705[_0x80b6('0x5b')][_0x80b6('0xb1')]=util[_0x80b6('0xa3')]('\x22%s\x22\x20<%s>',_0x4e8f9c[_0x80b6('0x37')],_0x4e8f9c[_0x80b6('0xb2')]);}if(_0x4e8f9c['List']){if(_0x4e8f9c[_0x80b6('0xa6')][_0x80b6('0xa8')][_0x80b6('0x66')]){return _0x4e8f9c['List'][_0x80b6('0xa8')][0x0];}else{return db[_0x80b6('0xa7')][_0x80b6('0x5a')](_[_0x80b6('0x18')](_0x394705[_0x80b6('0x5b')],{'firstName':_0x394705['body']['to'][0x0],'phone':_0x394705['body']['to'][0x0],'fax':_0x394705[_0x80b6('0x5b')]['to'][0x0],'ListId':_0x4e8f9c[_0x80b6('0x9e')]}));}}else{throw new Error(_0x80b6('0xb3'));}}else{throw new Error(_0x80b6('0xb4'));}})['then'](function(_0x2e6f7a){if(_0x2e6f7a){return db[_0x80b6('0x71')][_0x80b6('0x58')]({'where':{'ContactId':_0x2e6f7a['id'],'closed':![],'FaxAccountId':_0x4e8f9c['id']}})[_0x80b6('0x1f')](function(_0x40d6c0){if(_0x40d6c0){return[_0x40d6c0,![]];}return db[_0x80b6('0x71')]['create']({'UserId':_0x394705[_0x80b6('0x5e')]['id'],'ContactId':_0x2e6f7a['id'],'FaxAccountId':_0x4e8f9c['id'],'fax':_0x394705[_0x80b6('0x5b')]['to'][0x0],'firstMsgDirection':_0x80b6('0xb5'),'Messages':[_[_0x80b6('0x4a')](_0x394705[_0x80b6('0x5b')],{'read':![],'body':_0x394705[_0x80b6('0x5b')]['attachments'][0x0]['filename'],'FaxAccountId':_0x4e8f9c['id'],'UserId':_0x394705[_0x80b6('0x5e')]['id'],'ContactId':_0x2e6f7a['id'],'AttachmentId':_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x80b6('0xa0')],'as':_0x80b6('0xb6')}]})[_0x80b6('0x1f')](function(_0x5b56d8){return[_0x5b56d8,!![]];});});}else{throw new Error(_0x80b6('0xb7'));}})['spread'](function(_0x11e63b,_0x4d79ea){if(_0x4d79ea){return _0x11e63b;}return db[_0x80b6('0xa0')]['create']({'direction':_0x80b6('0xb5'),'read':![],'body':_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][0x0][_0x80b6('0xb8')],'FaxAccountId':_0x4e8f9c['id'],'FaxInteractionId':_0x11e63b['id'],'UserId':_0x394705[_0x80b6('0x5e')]['id'],'ContactId':_0x11e63b[_0x80b6('0xb9')],'AttachmentId':_0x394705[_0x80b6('0x5b')]['attachments'][0x0]['id']})[_0x80b6('0x1f')](function(_0x7b2f99){_0x11e63b[_0x80b6('0xba')][_0x80b6('0xb6')]=[];_0x11e63b['dataValues']['Messages'][_0x80b6('0x87')](_0x7b2f99[_0x80b6('0xba')]);return _0x11e63b;});})[_0x80b6('0x1f')](function(_0x4a8baa){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x394705['params']['id'])?undefined:_0x394705['params']['id'],'path':_[_0x80b6('0xb0')](_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][0x0]['path'])?undefined:_0x394705['body'][_0x80b6('0xaa')][0x0]['path'],'fax':_[_0x80b6('0xb0')](_0x394705[_0x80b6('0x5b')]['to'][0x0])?undefined:_0x394705['body']['to'][0x0],'AttachmentId':_0x394705[_0x80b6('0x5b')][_0x80b6('0xaa')][0x0]['id']},client9002)['then'](function(_0x1d1877){logger['info'](_0x80b6('0xbb'),_0x1d1877);})[_0x80b6('0x59')](function(_0x388410){logger['info'](_0x80b6('0xbb'),_0x388410);});return _0x4a8baa;})[_0x80b6('0x1f')](respondWithResult(_0x5a8ccf,null))[_0x80b6('0x59')](handleError(_0x5a8ccf,null));};exports[_0x80b6('0xbc')]=function(_0x3b2180,_0x65263f,_0x3f2b3e){return db[_0x80b6('0x53')][_0x80b6('0x58')]({'where':{'id':_0x3b2180['params']['id']}})[_0x80b6('0x1f')](handleEntityNotFound(_0x65263f,null))[_0x80b6('0x1f')](function(_0x35ce81){if(_0x35ce81){return _0x35ce81['addAgents'](_0x3b2180[_0x80b6('0x5b')][_0x80b6('0x6e')],_[_0x80b6('0x70')](_0x3b2180['body'],['ids','id'])||{})[_0x80b6('0xbd')](function(_0x50a589){for(var _0x3d08f5=0x0;_0x3d08f5<_0x3b2180['body'][_0x80b6('0x6e')][_0x80b6('0x66')];_0x3d08f5+=0x1){socket[_0x80b6('0xbe')](_0x80b6('0xbf'),{'UserId':_0x3b2180[_0x80b6('0x5b')]['ids'][_0x3d08f5],'FaxAccountId':_0x3b2180[_0x80b6('0x56')]['id']});}return _0x50a589;});}})[_0x80b6('0x1f')](respondWithResult(_0x65263f,null))[_0x80b6('0x59')](handleError(_0x65263f,null));};exports[_0x80b6('0xc0')]=function(_0x586601,_0x32b76d,_0x11b3fa){return db[_0x80b6('0x53')][_0x80b6('0x58')]({'where':{'id':_0x586601[_0x80b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x32b76d,null))[_0x80b6('0x1f')](function(_0x43ff58){if(_0x43ff58){return _0x43ff58[_0x80b6('0xc0')](_0x586601[_0x80b6('0x3e')]['ids'])[_0x80b6('0x1f')](function(){if(_[_0x80b6('0xc1')](_0x586601[_0x80b6('0x3e')][_0x80b6('0x6e')])){for(var _0x2f98e7=0x0;_0x2f98e7<_0x586601['query'][_0x80b6('0x6e')][_0x80b6('0x66')];_0x2f98e7+=0x1){socket[_0x80b6('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x586601[_0x80b6('0x3e')]['ids'][_0x2f98e7]),'FaxAccountId':Number(_0x586601['params']['id'])});}}else{socket[_0x80b6('0xbe')](_0x80b6('0xc2'),{'UserId':Number(_0x586601[_0x80b6('0x3e')][_0x80b6('0x6e')]),'FaxAccountId':Number(_0x586601[_0x80b6('0x56')]['id'])});}});}})[_0x80b6('0x1f')](respondWithStatusCode(_0x32b76d,null))[_0x80b6('0x59')](handleError(_0x32b76d,null));};exports['getAgents']=function(_0x403248,_0x32feed,_0x557242){var _0x1fdbcb={};var _0x3c28d2={};var _0x461ce1;var _0x1c95bb;return db[_0x80b6('0x53')]['findOne']({'where':{'id':_0x403248['params']['id']}})['then'](handleEntityNotFound(_0x32feed,null))['then'](function(_0x3e60c5){if(_0x3e60c5){_0x461ce1=_0x3e60c5;_0x3c28d2[_0x80b6('0x3c')]=_[_0x80b6('0x3d')](db['User'][_0x80b6('0x3b')]);_0x3c28d2[_0x80b6('0x3e')]=_[_0x80b6('0x3d')](_0x403248[_0x80b6('0x3e')]);_0x3c28d2['filters']=_[_0x80b6('0x40')](_0x3c28d2[_0x80b6('0x3c')],_0x3c28d2[_0x80b6('0x3e')]);_0x1fdbcb['attributes']=_[_0x80b6('0x40')](_0x3c28d2[_0x80b6('0x3c')],qs[_0x80b6('0x41')](_0x403248[_0x80b6('0x3e')][_0x80b6('0x41')]));_0x1fdbcb[_0x80b6('0x42')]=_0x1fdbcb[_0x80b6('0x42')][_0x80b6('0x66')]?_0x1fdbcb['attributes']:_0x3c28d2[_0x80b6('0x3c')];_0x1fdbcb['order']=qs[_0x80b6('0x47')](_0x403248[_0x80b6('0x3e')][_0x80b6('0x47')]);_0x1fdbcb['where']=qs['filters'](_[_0x80b6('0x48')](_0x403248[_0x80b6('0x3e')],_0x3c28d2['filters']));if(_0x403248[_0x80b6('0x3e')][_0x80b6('0x49')]){_0x1fdbcb[_0x80b6('0x50')]=_[_0x80b6('0x4a')](_0x1fdbcb[_0x80b6('0x50')],{'$or':_[_0x80b6('0x4b')](_0x1fdbcb[_0x80b6('0x42')],function(_0x3537b5){var _0x5f3737={};_0x5f3737[_0x3537b5]={'$like':'%'+_0x403248['query'][_0x80b6('0x49')]+'%'};return _0x5f3737;})});}_0x1fdbcb=_[_0x80b6('0x4a')]({},_0x1fdbcb,_0x403248['options']);return _0x461ce1[_0x80b6('0xc3')](_0x1fdbcb);}})['then'](function(_0x5662c8){if(_0x5662c8){_0x1c95bb=_0x5662c8[_0x80b6('0x66')];if(!_0x403248['query'][_0x80b6('0x43')]('nolimit')){_0x1fdbcb[_0x80b6('0x45')]=qs['limit'](_0x403248[_0x80b6('0x3e')][_0x80b6('0x45')]);_0x1fdbcb[_0x80b6('0x2c')]=qs[_0x80b6('0x2c')](_0x403248[_0x80b6('0x3e')][_0x80b6('0x2c')]);}return _0x461ce1[_0x80b6('0xc3')](_0x1fdbcb);}})[_0x80b6('0x1f')](function(_0x34e35d){if(_0x34e35d){return _0x34e35d?{'count':_0x1c95bb,'rows':_0x34e35d}:null;}})[_0x80b6('0x1f')](respondWithResult(_0x32feed,null))[_0x80b6('0x59')](handleError(_0x32feed,null));}; \ No newline at end of file +var _0x5a68=['order','sort','pick','filter','where','type','key','field','merge','includeAll','findAll','rows','show','params','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','findOne','nolimit','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','map','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','exten','localstationid','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','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','bulkCreate','tech','createdAt','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','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/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','test','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x5a68,0x139));var _0x85a6=function(_0x432c1d,_0x11aebb){_0x432c1d=_0x432c1d-0x0;var _0x1d5a11=_0x5a68[_0x432c1d];return _0x1d5a11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85a6('0x0'));var rimraf=require(_0x85a6('0x1'));var zipdir=require(_0x85a6('0x2'));var jsonpatch=require(_0x85a6('0x3'));var rp=require(_0x85a6('0x4'));var moment=require(_0x85a6('0x5'));var BPromise=require(_0x85a6('0x6'));var Mustache=require(_0x85a6('0x7'));var util=require('util');var path=require(_0x85a6('0x8'));var sox=require(_0x85a6('0x9'));var csv=require(_0x85a6('0xa'));var ejs=require(_0x85a6('0xb'));var fs=require('fs');var _=require(_0x85a6('0xc'));var squel=require(_0x85a6('0xd'));var crypto=require(_0x85a6('0xe'));var jsforce=require(_0x85a6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x85a6('0xa'));var querystring=require(_0x85a6('0x10'));var Papa=require(_0x85a6('0x11'));var Redis=require(_0x85a6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x85a6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x85a6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x85a6('0x15'))['db'];config[_0x85a6('0x16')]=_['defaults'](config[_0x85a6('0x16')],{'host':_0x85a6('0x17'),'port':0x18eb});var socket=require(_0x85a6('0x18'))(new Redis(config[_0x85a6('0x16')]));require(_0x85a6('0x19'))[_0x85a6('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x85a6('0x1b')][_0x85a6('0x1c')]({'port':0x232c});var client9002=jayson[_0x85a6('0x1b')][_0x85a6('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x436414,_0x4d050a,_0x54ff8e){if(_0x54ff8e){var _0x5a775d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a775d[_0x85a6('0x1d')](_0x4d050a)){return _0x436414;}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 _0x436414;}}function respondWithRpcPromise(_0x2db0c9,_0x3945ea,_0x13788c,_0x59b2fb){return new BPromise(function(_0x1fc4b2,_0x938911){var _0x4a6eb9=_0x59b2fb||client;return _0x4a6eb9[_0x85a6('0x1e')](_0x2db0c9,_0x13788c)[_0x85a6('0x1f')](function(_0x2bd285){logger[_0x85a6('0x20')](_0x85a6('0x21'),_0x3945ea,_0x85a6('0x22'));logger[_0x85a6('0x23')](_0x85a6('0x24'),_0x3945ea,_0x85a6('0x22'),JSON[_0x85a6('0x25')](_0x2bd285));if(_0x2bd285['error']){if(_0x2bd285[_0x85a6('0x26')][_0x85a6('0x27')]===0x1f4){logger[_0x85a6('0x26')](_0x85a6('0x21'),_0x3945ea,_0x2bd285[_0x85a6('0x26')][_0x85a6('0x28')]);return _0x938911(_0x2bd285['error']['message']);}logger[_0x85a6('0x26')](_0x85a6('0x21'),_0x3945ea,_0x2bd285[_0x85a6('0x26')][_0x85a6('0x28')]);return _0x1fc4b2(_0x2bd285[_0x85a6('0x26')][_0x85a6('0x28')]);}else{logger[_0x85a6('0x20')](_0x85a6('0x21'),_0x3945ea,_0x85a6('0x22'));_0x1fc4b2(_0x2bd285[_0x85a6('0x29')][_0x85a6('0x28')]);}})[_0x85a6('0x2a')](function(_0x295906){logger[_0x85a6('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3945ea,_0x295906);_0x938911(_0x295906);});});}function respondWithStatusCode(_0x4697f8,_0x1a0870){_0x1a0870=_0x1a0870||0xcc;return function(_0x275c5e){if(_0x275c5e){return _0x4697f8[_0x85a6('0x2b')](_0x1a0870);}return _0x4697f8[_0x85a6('0x2c')](_0x1a0870)[_0x85a6('0x2d')]();};}function respondWithResult(_0x47aae0,_0xb97411){_0xb97411=_0xb97411||0xc8;return function(_0x10a7c8){if(_0x10a7c8){return _0x47aae0[_0x85a6('0x2c')](_0xb97411)[_0x85a6('0x2e')](_0x10a7c8);}};}function respondWithFilteredResult(_0x9ebf72,_0x9f1a78){return function(_0x4b4991){if(_0x4b4991){var _0x2a7004=_0x4b4991[_0x85a6('0x2f')],_0x5aa8a9=_0x9f1a78[_0x85a6('0x30')],_0x22c91a=_0x9f1a78[_0x85a6('0x30')]+_0x9f1a78[_0x85a6('0x31')],_0x5a7048;if(_0x22c91a>=_0x2a7004){_0x22c91a=_0x2a7004;_0x5a7048=0xc8;}else{_0x5a7048=0xce;}_0x9ebf72[_0x85a6('0x2c')](_0x5a7048);return _0x9ebf72['set'](_0x85a6('0x32'),_0x5aa8a9+'-'+_0x22c91a+'/'+_0x2a7004)['json'](_0x4b4991);}return null;};}function patchUpdates(_0x4fdef6){return function(_0x8216a9){try{jsonpatch['apply'](_0x8216a9,_0x4fdef6,!![]);}catch(_0x626f6f){return BPromise[_0x85a6('0x33')](_0x626f6f);}return _0x8216a9['save']();};}function saveUpdates(_0x360394,_0x16b48b){return function(_0x433a8e){if(_0x433a8e){return _0x433a8e[_0x85a6('0x34')](_0x360394)[_0x85a6('0x1f')](function(_0x5739d5){return _0x5739d5;});}return null;};}function removeEntity(_0x4489f2,_0x34c2f6){return function(_0x2c46aa){if(_0x2c46aa){return _0x2c46aa[_0x85a6('0x35')]()[_0x85a6('0x1f')](function(){var _0x3cc62f=_0x2c46aa[_0x85a6('0x36')]({'plain':!![]});var _0x367c03=_0x85a6('0x37');return db[_0x85a6('0x38')][_0x85a6('0x35')]({'where':{'type':_0x367c03,'resourceId':_0x3cc62f['id']}})[_0x85a6('0x1f')](function(){return _0x2c46aa;});})[_0x85a6('0x1f')](function(){_0x4489f2[_0x85a6('0x2c')](0xcc)[_0x85a6('0x2d')]();});}};}function handleEntityNotFound(_0xc68e4f,_0x179b32){return function(_0x35eb29){if(!_0x35eb29){_0xc68e4f[_0x85a6('0x2b')](0x194);}return _0x35eb29;};}function handleError(_0x2a1d47,_0xa1d3d0){_0xa1d3d0=_0xa1d3d0||0x1f4;return function(_0x2d7990){logger[_0x85a6('0x26')](_0x2d7990[_0x85a6('0x39')]);if(_0x2d7990['name']){delete _0x2d7990[_0x85a6('0x3a')];}_0x2a1d47[_0x85a6('0x2c')](_0xa1d3d0)[_0x85a6('0x3b')](_0x2d7990);};}exports[_0x85a6('0x3c')]=function(_0x218da5,_0x4dfa7a){var _0x6df572={'include':[{'model':db['Pause'],'as':_0x85a6('0x3d')}]},_0x5a8299={},_0x2d1b3e={'count':0x0,'rows':[]};var _0x33c340=db[_0x85a6('0x3e')][_0x85a6('0x3f')];_0x5a8299['model']=_[_0x85a6('0x40')](_0x33c340);_0x5a8299[_0x85a6('0x41')]=_[_0x85a6('0x40')](_0x218da5['query']);_0x5a8299[_0x85a6('0x42')]=_[_0x85a6('0x43')](_0x5a8299[_0x85a6('0x44')],_0x5a8299[_0x85a6('0x41')]);_0x6df572[_0x85a6('0x45')]=_['intersection'](_0x5a8299[_0x85a6('0x44')],qs[_0x85a6('0x46')](_0x218da5[_0x85a6('0x41')][_0x85a6('0x46')]));_0x6df572[_0x85a6('0x45')]=_0x6df572[_0x85a6('0x45')][_0x85a6('0x47')]?_0x6df572[_0x85a6('0x45')]:_0x5a8299[_0x85a6('0x44')];if(!_0x218da5[_0x85a6('0x41')][_0x85a6('0x48')]('nolimit')){_0x6df572['limit']=qs[_0x85a6('0x31')](_0x218da5[_0x85a6('0x41')]['limit']);_0x6df572[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0x218da5['query'][_0x85a6('0x30')]);}_0x6df572[_0x85a6('0x49')]=qs[_0x85a6('0x4a')](_0x218da5[_0x85a6('0x41')][_0x85a6('0x4a')]);_0x6df572['where']=qs[_0x85a6('0x42')](_[_0x85a6('0x4b')](_0x218da5[_0x85a6('0x41')],_0x5a8299[_0x85a6('0x42')]));if(_0x218da5[_0x85a6('0x41')][_0x85a6('0x4c')]){_0x6df572[_0x85a6('0x4d')]=_['merge'](_0x6df572[_0x85a6('0x4d')],{'$or':_['map'](_0x33c340,function(_0x3f984c){if(_0x3f984c[_0x85a6('0x4e')][_0x85a6('0x4f')]!=='VIRTUAL'){var _0x34824b={};_0x34824b[_0x3f984c[_0x85a6('0x50')]]={'$like':'%'+_0x218da5[_0x85a6('0x41')][_0x85a6('0x4c')]+'%'};return _0x34824b;}})});}_0x6df572=_[_0x85a6('0x51')]({},_0x6df572,_0x218da5['options']);var _0x214e27={'where':_0x6df572[_0x85a6('0x4d')]};return db['FaxAccount'][_0x85a6('0x2f')](_0x214e27)['then'](function(_0x365264){_0x2d1b3e[_0x85a6('0x2f')]=_0x365264;if(_0x218da5[_0x85a6('0x41')][_0x85a6('0x52')]){_0x6df572['include']=[{'all':!![]}];}return db[_0x85a6('0x3e')][_0x85a6('0x53')](_0x6df572);})[_0x85a6('0x1f')](function(_0xedc7ee){_0x2d1b3e[_0x85a6('0x54')]=_0xedc7ee;return _0x2d1b3e;})[_0x85a6('0x1f')](respondWithFilteredResult(_0x4dfa7a,_0x6df572))[_0x85a6('0x2a')](handleError(_0x4dfa7a,null));};exports[_0x85a6('0x55')]=function(_0x57d229,_0x386dce){var _0x36c1a1={'raw':![],'where':{'id':_0x57d229[_0x85a6('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x85a6('0x3d')}]},_0x5ae8a9={};_0x5ae8a9[_0x85a6('0x44')]=_[_0x85a6('0x40')](db[_0x85a6('0x3e')][_0x85a6('0x3f')]);_0x5ae8a9['query']=_[_0x85a6('0x40')](_0x57d229[_0x85a6('0x41')]);_0x5ae8a9[_0x85a6('0x42')]=_[_0x85a6('0x43')](_0x5ae8a9[_0x85a6('0x44')],_0x5ae8a9[_0x85a6('0x41')]);_0x36c1a1[_0x85a6('0x45')]=_[_0x85a6('0x43')](_0x5ae8a9[_0x85a6('0x44')],qs[_0x85a6('0x46')](_0x57d229[_0x85a6('0x41')][_0x85a6('0x46')]));_0x36c1a1[_0x85a6('0x45')]=_0x36c1a1['attributes'][_0x85a6('0x47')]?_0x36c1a1[_0x85a6('0x45')]:_0x5ae8a9['model'];if(_0x57d229[_0x85a6('0x41')]['includeAll']){_0x36c1a1[_0x85a6('0x57')]=[{'all':!![]}];}_0x36c1a1=_['merge']({},_0x36c1a1,_0x57d229[_0x85a6('0x58')]);return db[_0x85a6('0x3e')][_0x85a6('0x59')](_0x36c1a1)[_0x85a6('0x1f')](handleEntityNotFound(_0x386dce,null))[_0x85a6('0x1f')](respondWithResult(_0x386dce,null))[_0x85a6('0x2a')](handleError(_0x386dce,null));};exports[_0x85a6('0x5a')]=function(_0x143a79,_0x54fc5b){return db['FaxAccount']['create'](_0x143a79[_0x85a6('0x5b')],{})[_0x85a6('0x1f')](function(_0x3bb25d){var _0x2f70fc=_0x143a79['user'][_0x85a6('0x36')]({'plain':!![]});if(!_0x2f70fc)throw new Error(_0x85a6('0x5c'));if(_0x2f70fc[_0x85a6('0x5d')]===_0x85a6('0x5e')){var _0x528718=_0x3bb25d[_0x85a6('0x36')]({'plain':!![]});var _0x2b0254='FaxAccounts';return db[_0x85a6('0x5f')][_0x85a6('0x59')]({'where':{'name':_0x2b0254,'userProfileId':_0x2f70fc[_0x85a6('0x60')]},'raw':!![]})[_0x85a6('0x1f')](function(_0x21d83e){if(_0x21d83e&&_0x21d83e[_0x85a6('0x61')]===0x0){return db[_0x85a6('0x38')][_0x85a6('0x5a')]({'name':_0x528718[_0x85a6('0x3a')],'resourceId':_0x528718['id'],'type':_0x21d83e[_0x85a6('0x3a')],'sectionId':_0x21d83e['id']},{})[_0x85a6('0x1f')](function(){return _0x3bb25d;});}else{return _0x3bb25d;}})[_0x85a6('0x2a')](function(_0x38e4c3){logger[_0x85a6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38e4c3);throw _0x38e4c3;});}return _0x3bb25d;})[_0x85a6('0x1f')](respondWithResult(_0x54fc5b,0xc9))['catch'](handleError(_0x54fc5b,null));};exports['update']=function(_0xb4702,_0x15e5a5){if(_0xb4702[_0x85a6('0x5b')]['id']){delete _0xb4702[_0x85a6('0x5b')]['id'];}return db[_0x85a6('0x3e')][_0x85a6('0x59')]({'where':{'id':_0xb4702[_0x85a6('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x85a6('0x3d')}]})[_0x85a6('0x1f')](handleEntityNotFound(_0x15e5a5,null))[_0x85a6('0x1f')](saveUpdates(_0xb4702['body'],null))['then'](respondWithResult(_0x15e5a5,null))['catch'](handleError(_0x15e5a5,null));};exports[_0x85a6('0x35')]=function(_0x2fe27a,_0x32ff47){return db[_0x85a6('0x3e')]['find']({'where':{'id':_0x2fe27a[_0x85a6('0x56')]['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x32ff47,null))[_0x85a6('0x1f')](removeEntity(_0x32ff47,null))['catch'](handleError(_0x32ff47,null));};exports[_0x85a6('0x62')]=function(_0x381dd2,_0x4cc8a6){return db[_0x85a6('0x3e')][_0x85a6('0x62')]()[_0x85a6('0x1f')](respondWithResult(_0x4cc8a6,null))[_0x85a6('0x2a')](handleError(_0x4cc8a6,null));};exports[_0x85a6('0x63')]=function(_0x405502,_0x470a01,_0x2d09e0){if(_0x405502['body']['id']){delete _0x405502[_0x85a6('0x5b')]['id'];}return db[_0x85a6('0x3e')][_0x85a6('0x59')]({'where':{'id':_0x405502[_0x85a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x470a01,null))[_0x85a6('0x1f')](function(_0x1f60ef){if(_0x1f60ef){_0x405502['body']['FaxAccountId']=_0x1f60ef['id'];return db[_0x85a6('0x64')]['create'](_0x405502[_0x85a6('0x5b')]);}})[_0x85a6('0x1f')](respondWithResult(_0x470a01,null))[_0x85a6('0x2a')](handleError(_0x470a01,null));};exports['getDispositions']=function(_0x49573c,_0x4382b2,_0x3cba1d){var _0x9974e2={'raw':![],'where':{}};var _0x4714df={};var _0x21b9e8={'count':0x0,'rows':[]};return db[_0x85a6('0x3e')][_0x85a6('0x65')]({'where':{'id':_0x49573c[_0x85a6('0x56')]['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x4382b2,null))[_0x85a6('0x1f')](function(_0xa61871){if(_0xa61871){_0x4714df['model']=_['keys'](db[_0x85a6('0x64')][_0x85a6('0x3f')]);_0x4714df['query']=_[_0x85a6('0x40')](_0x49573c[_0x85a6('0x41')]);_0x4714df[_0x85a6('0x42')]=_[_0x85a6('0x43')](_0x4714df['model'],_0x4714df[_0x85a6('0x41')]);_0x9974e2[_0x85a6('0x45')]=_['intersection'](_0x4714df[_0x85a6('0x44')],qs[_0x85a6('0x46')](_0x49573c['query'][_0x85a6('0x46')]));_0x9974e2[_0x85a6('0x45')]=_0x9974e2[_0x85a6('0x45')][_0x85a6('0x47')]?_0x9974e2['attributes']:_0x4714df['model'];if(!_0x49573c[_0x85a6('0x41')][_0x85a6('0x48')](_0x85a6('0x66'))){_0x9974e2[_0x85a6('0x31')]=qs[_0x85a6('0x31')](_0x49573c['query'][_0x85a6('0x31')]);_0x9974e2[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0x49573c['query'][_0x85a6('0x30')]);}_0x9974e2[_0x85a6('0x49')]=qs['sort'](_0x49573c[_0x85a6('0x41')][_0x85a6('0x4a')]);_0x9974e2[_0x85a6('0x4d')]=qs[_0x85a6('0x42')](_[_0x85a6('0x4b')](_0x49573c[_0x85a6('0x41')],_0x4714df[_0x85a6('0x42')]));_0x9974e2[_0x85a6('0x4d')][_0x85a6('0x67')]=_0xa61871['id'];if(_0x49573c[_0x85a6('0x41')][_0x85a6('0x4c')]){_0x9974e2[_0x85a6('0x4d')]=_[_0x85a6('0x51')](_0x9974e2[_0x85a6('0x4d')],{'$or':_['map'](_0x9974e2[_0x85a6('0x45')],function(_0x34ab4d){var _0x313300={};_0x313300[_0x34ab4d]={'$like':'%'+_0x49573c['query'][_0x85a6('0x4c')]+'%'};return _0x313300;})});}_0x9974e2=_[_0x85a6('0x51')]({},_0x9974e2,_0x49573c[_0x85a6('0x58')]);return db[_0x85a6('0x64')][_0x85a6('0x2f')]({'where':_0x9974e2[_0x85a6('0x4d')]})[_0x85a6('0x1f')](function(_0x40aa64){_0x21b9e8[_0x85a6('0x2f')]=_0x40aa64;if(_0x49573c['query'][_0x85a6('0x52')]){_0x9974e2[_0x85a6('0x57')]=[{'all':!![]}];}return db[_0x85a6('0x64')]['findAll'](_0x9974e2);})[_0x85a6('0x1f')](function(_0x4b894b){_0x21b9e8[_0x85a6('0x54')]=_0x4b894b;return _0x21b9e8;});}})['then'](respondWithFilteredResult(_0x4382b2,_0x9974e2))[_0x85a6('0x2a')](handleError(_0x4382b2,null));};exports[_0x85a6('0x68')]=function(_0x5de312,_0x12518c,_0x25b6a8){return db[_0x85a6('0x3e')]['find']({'where':{'id':_0x5de312['params']['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x12518c,null))[_0x85a6('0x1f')](function(_0x5637d0){if(_0x5637d0){return _0x5637d0['removeDispositions'](_0x5de312[_0x85a6('0x41')][_0x85a6('0x69')]);}})[_0x85a6('0x1f')](respondWithStatusCode(_0x12518c,null))[_0x85a6('0x2a')](handleError(_0x12518c,null));};exports[_0x85a6('0x6a')]=function(_0x532849,_0x5a36ee,_0x44f53f){if(_0x532849[_0x85a6('0x5b')]['id']){delete _0x532849[_0x85a6('0x5b')]['id'];}return db['FaxAccount'][_0x85a6('0x59')]({'where':{'id':_0x532849[_0x85a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a36ee,null))[_0x85a6('0x1f')](function(_0x13cfcf){if(_0x13cfcf){_0x532849[_0x85a6('0x5b')][_0x85a6('0x67')]=_0x13cfcf['id'];return db[_0x85a6('0x6b')][_0x85a6('0x5a')](_0x532849[_0x85a6('0x5b')]);}})['then'](respondWithResult(_0x5a36ee,null))[_0x85a6('0x2a')](handleError(_0x5a36ee,null));};exports[_0x85a6('0x6c')]=function(_0x1687cb,_0x39cc2a,_0x482de5){var _0x6461cd={'raw':![],'where':{}};var _0x44900b={};var _0xfaa442={'count':0x0,'rows':[]};return db[_0x85a6('0x3e')]['findOne']({'where':{'id':_0x1687cb['params']['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x39cc2a,null))[_0x85a6('0x1f')](function(_0x11d16e){if(_0x11d16e){_0x44900b[_0x85a6('0x44')]=_[_0x85a6('0x40')](db['CannedAnswer'][_0x85a6('0x3f')]);_0x44900b[_0x85a6('0x41')]=_[_0x85a6('0x40')](_0x1687cb['query']);_0x44900b[_0x85a6('0x42')]=_[_0x85a6('0x43')](_0x44900b[_0x85a6('0x44')],_0x44900b[_0x85a6('0x41')]);_0x6461cd[_0x85a6('0x45')]=_[_0x85a6('0x43')](_0x44900b[_0x85a6('0x44')],qs['fields'](_0x1687cb[_0x85a6('0x41')]['fields']));_0x6461cd[_0x85a6('0x45')]=_0x6461cd['attributes'][_0x85a6('0x47')]?_0x6461cd['attributes']:_0x44900b['model'];if(!_0x1687cb[_0x85a6('0x41')][_0x85a6('0x48')](_0x85a6('0x66'))){_0x6461cd[_0x85a6('0x31')]=qs[_0x85a6('0x31')](_0x1687cb[_0x85a6('0x41')]['limit']);_0x6461cd[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0x1687cb[_0x85a6('0x41')][_0x85a6('0x30')]);}_0x6461cd['order']=qs[_0x85a6('0x4a')](_0x1687cb['query'][_0x85a6('0x4a')]);_0x6461cd[_0x85a6('0x4d')]=qs['filters'](_['pick'](_0x1687cb[_0x85a6('0x41')],_0x44900b[_0x85a6('0x42')]));_0x6461cd[_0x85a6('0x4d')][_0x85a6('0x67')]=_0x11d16e['id'];if(_0x1687cb[_0x85a6('0x41')][_0x85a6('0x4c')]){_0x6461cd[_0x85a6('0x4d')]=_[_0x85a6('0x51')](_0x6461cd['where'],{'$or':_['map'](_0x6461cd[_0x85a6('0x45')],function(_0x57067f){var _0x5d69ae={};_0x5d69ae[_0x57067f]={'$like':'%'+_0x1687cb['query'][_0x85a6('0x4c')]+'%'};return _0x5d69ae;})});}_0x6461cd=_['merge']({},_0x6461cd,_0x1687cb[_0x85a6('0x58')]);return db[_0x85a6('0x6b')][_0x85a6('0x2f')]({'where':_0x6461cd['where']})[_0x85a6('0x1f')](function(_0x5266da){_0xfaa442[_0x85a6('0x2f')]=_0x5266da;if(_0x1687cb['query'][_0x85a6('0x52')]){_0x6461cd[_0x85a6('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x85a6('0x53')](_0x6461cd);})[_0x85a6('0x1f')](function(_0x3664fb){_0xfaa442[_0x85a6('0x54')]=_0x3664fb;return _0xfaa442;});}})[_0x85a6('0x1f')](respondWithFilteredResult(_0x39cc2a,_0x6461cd))[_0x85a6('0x2a')](handleError(_0x39cc2a,null));};exports[_0x85a6('0x6d')]=function(_0x2e403b,_0x34cfbe,_0x121258){return db[_0x85a6('0x3e')][_0x85a6('0x59')]({'where':{'id':_0x2e403b[_0x85a6('0x56')]['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x34cfbe,null))[_0x85a6('0x1f')](function(_0xa914ef){if(_0xa914ef){return _0xa914ef[_0x85a6('0x6d')](_0x2e403b[_0x85a6('0x41')]['ids']);}})[_0x85a6('0x1f')](respondWithStatusCode(_0x34cfbe,null))[_0x85a6('0x2a')](handleError(_0x34cfbe,null));};exports[_0x85a6('0x6e')]=function(_0x53655a,_0x35f4f4,_0x5ed190){return db[_0x85a6('0x6f')][_0x85a6('0x59')]({'where':{'id':_0x53655a['params']['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x35f4f4,null))[_0x85a6('0x1f')](function(_0x38d377){if(_0x38d377){return _0x38d377[_0x85a6('0x6e')](_0x53655a['body']['ids'],_[_0x85a6('0x70')](_0x53655a[_0x85a6('0x5b')],[_0x85a6('0x69'),'id'])||{});}})[_0x85a6('0x1f')](respondWithResult(_0x35f4f4,null))['catch'](handleError(_0x35f4f4,null));};exports[_0x85a6('0x71')]=function(_0x562162,_0x6a9007,_0xea7f7c){var _0x41df54={'raw':![],'where':{}};var _0x313d67={};var _0x311082={'count':0x0,'rows':[]};return db[_0x85a6('0x3e')][_0x85a6('0x65')]({'where':{'id':_0x562162['params']['id']}})['then'](handleEntityNotFound(_0x6a9007,null))[_0x85a6('0x1f')](function(_0x243cce){if(_0x243cce){_0x313d67[_0x85a6('0x44')]=_[_0x85a6('0x40')](db[_0x85a6('0x6f')]['rawAttributes']);_0x313d67[_0x85a6('0x41')]=_[_0x85a6('0x40')](_0x562162['query']);_0x313d67['filters']=_[_0x85a6('0x43')](_0x313d67[_0x85a6('0x44')],_0x313d67[_0x85a6('0x41')]);_0x41df54[_0x85a6('0x45')]=_[_0x85a6('0x43')](_0x313d67[_0x85a6('0x44')],qs[_0x85a6('0x46')](_0x562162[_0x85a6('0x41')][_0x85a6('0x46')]));_0x41df54[_0x85a6('0x45')]=_0x41df54['attributes'][_0x85a6('0x47')]?_0x41df54[_0x85a6('0x45')]:_0x313d67[_0x85a6('0x44')];if(!_0x562162[_0x85a6('0x41')][_0x85a6('0x48')](_0x85a6('0x66'))){_0x41df54[_0x85a6('0x31')]=qs['limit'](_0x562162[_0x85a6('0x41')]['limit']);_0x41df54[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0x562162['query'][_0x85a6('0x30')]);}_0x41df54[_0x85a6('0x49')]=qs[_0x85a6('0x4a')](_0x562162[_0x85a6('0x41')][_0x85a6('0x4a')]);_0x41df54[_0x85a6('0x4d')]=qs['filters'](_['pick'](_0x562162[_0x85a6('0x41')],_0x313d67[_0x85a6('0x42')]));_0x41df54[_0x85a6('0x4d')]['FaxAccountId']=_0x243cce['id'];if(_0x562162[_0x85a6('0x41')][_0x85a6('0x4c')]){_0x41df54[_0x85a6('0x4d')]=_[_0x85a6('0x51')](_0x41df54[_0x85a6('0x4d')],{'$or':_[_0x85a6('0x72')](_0x41df54['attributes'],function(_0x54aefb){var _0x5094c4={};_0x5094c4[_0x54aefb]={'$like':'%'+_0x562162[_0x85a6('0x41')]['filter']+'%'};return _0x5094c4;})});}_0x41df54=_['merge']({},_0x41df54,_0x562162[_0x85a6('0x58')]);return db[_0x85a6('0x6f')][_0x85a6('0x2f')]({'where':_0x41df54[_0x85a6('0x4d')]})['then'](function(_0x5548b0){_0x311082[_0x85a6('0x2f')]=_0x5548b0;if(_0x562162[_0x85a6('0x41')][_0x85a6('0x52')]){_0x41df54['include']=[{'model':db['CmContact'],'as':_0x85a6('0x73'),'required':![]},{'model':db[_0x85a6('0x74')],'as':_0x85a6('0x75'),'attributes':[_0x85a6('0x3a'),_0x85a6('0x76'),_0x85a6('0x77')],'required':![]},{'model':db[_0x85a6('0x78')],'as':_0x85a6('0x79'),'attributes':['id',_0x85a6('0x3a'),_0x85a6('0x7a')],'where':_0x562162[_0x85a6('0x41')][_0x85a6('0x7b')]?{'id':_0x562162['query'][_0x85a6('0x7b')]}:undefined,'required':_0x562162['query'][_0x85a6('0x7b')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x41df54);})['then'](function(_0x53d8ff){_0x311082[_0x85a6('0x54')]=_0x53d8ff;return _0x311082;});}})[_0x85a6('0x1f')](respondWithFilteredResult(_0x6a9007,_0x41df54))[_0x85a6('0x2a')](handleError(_0x6a9007,null));};exports['addApplications']=function(_0x52983c,_0x2607be,_0x3c2800){return db['FaxAccount'][_0x85a6('0x65')]({'where':{'id':_0x52983c[_0x85a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x2607be,null))[_0x85a6('0x1f')](function(_0x477ba8){if(_0x477ba8){return db[_0x85a6('0x7c')][_0x85a6('0x7d')](function(_0x4fdf33){return db[_0x85a6('0x7e')][_0x85a6('0x35')]({'where':{'FaxAccountId':_0x52983c[_0x85a6('0x56')]['id']},'transaction':_0x4fdf33})['then'](function(_0x382ef4){var _0x387f08=_[_0x85a6('0x72')](_0x52983c[_0x85a6('0x5b')],function(_0x4133f7){_0x4133f7[_0x85a6('0x67')]=_0x52983c[_0x85a6('0x56')]['id'];return _0x4133f7;});return db[_0x85a6('0x7e')]['bulkCreate'](_0x387f08,{'transaction':_0x4fdf33});});})[_0x85a6('0x1f')](function(){return db[_0x85a6('0x7e')][_0x85a6('0x7f')]({'where':{'FaxAccountId':_0x52983c['params']['id']},'order':_0x85a6('0x80')});});}})['then'](respondWithResult(_0x2607be,null))[_0x85a6('0x2a')](handleError(_0x2607be,null));};exports[_0x85a6('0x81')]=function(_0x174294,_0xff92c7,_0x45ccaa){var _0x469bed={};var _0xcf40b6={};var _0x558598;var _0x105186;return db[_0x85a6('0x3e')][_0x85a6('0x65')]({'where':{'id':_0x174294['params']['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0xff92c7,null))[_0x85a6('0x1f')](function(_0x323f01){if(_0x323f01){_0x558598=_0x323f01;_0xcf40b6[_0x85a6('0x44')]=_['keys'](db[_0x85a6('0x7e')]['rawAttributes']);_0xcf40b6[_0x85a6('0x41')]=_[_0x85a6('0x40')](_0x174294[_0x85a6('0x41')]);_0xcf40b6[_0x85a6('0x42')]=_[_0x85a6('0x43')](_0xcf40b6[_0x85a6('0x44')],_0xcf40b6[_0x85a6('0x41')]);_0x469bed[_0x85a6('0x45')]=_[_0x85a6('0x43')](_0xcf40b6[_0x85a6('0x44')],qs[_0x85a6('0x46')](_0x174294[_0x85a6('0x41')][_0x85a6('0x46')]));_0x469bed[_0x85a6('0x45')]=_0x469bed[_0x85a6('0x45')][_0x85a6('0x47')]?_0x469bed[_0x85a6('0x45')]:_0xcf40b6[_0x85a6('0x44')];_0x469bed[_0x85a6('0x49')]=qs[_0x85a6('0x4a')](_0x174294[_0x85a6('0x41')]['sort']);_0x469bed[_0x85a6('0x4d')]=qs['filters'](_[_0x85a6('0x4b')](_0x174294[_0x85a6('0x41')],_0xcf40b6['filters']));if(_0x174294[_0x85a6('0x41')]['filter']){_0x469bed[_0x85a6('0x4d')]=_[_0x85a6('0x51')](_0x469bed[_0x85a6('0x4d')],{'$or':_['map'](_0x469bed[_0x85a6('0x45')],function(_0x2cba69){var _0x2933d3={};_0x2933d3[_0x2cba69]={'$like':'%'+_0x174294[_0x85a6('0x41')][_0x85a6('0x4c')]+'%'};return _0x2933d3;})});}_0x469bed=_[_0x85a6('0x51')]({},_0x469bed,_0x174294[_0x85a6('0x58')]);return _0x558598[_0x85a6('0x81')](_0x469bed);}})[_0x85a6('0x1f')](function(_0x12b0a6){if(_0x12b0a6){_0x105186=_0x12b0a6['length'];if(!_0x174294[_0x85a6('0x41')][_0x85a6('0x48')](_0x85a6('0x66'))){_0x469bed['limit']=qs[_0x85a6('0x31')](_0x174294[_0x85a6('0x41')][_0x85a6('0x31')]);_0x469bed[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0x174294[_0x85a6('0x41')][_0x85a6('0x30')]);}return _0x558598['getApplications'](_0x469bed);}})[_0x85a6('0x1f')](function(_0x2b6b85){if(_0x2b6b85){return _0x2b6b85?{'count':_0x105186,'rows':_0x2b6b85}:null;}})[_0x85a6('0x1f')](respondWithResult(_0xff92c7,null))['catch'](handleError(_0xff92c7,null));};function Extension(_0x84d1c2,_0x1614bf,_0x784034,_0xcd7d20){this[_0x85a6('0x82')]='from-voip-provider';this[_0x85a6('0x83')]=_0x84d1c2[_0x85a6('0x84')];this['app']=_0xcd7d20;this['type']=_0x85a6('0x85');this['description']=_0x85a6('0x86');this['FaxAccountId']=_0x84d1c2['id'];this[_0x85a6('0x80')]=_0x1614bf;this[_0x85a6('0x87')]=_0x784034;}function createExtensionsReciveFax(_0x41700f){var _0x3dfc44=0x1;var _0x581395=[];_0x581395[_0x85a6('0x88')](new Extension(_0x41700f,_0x3dfc44,'',_0x85a6('0x89')));_0x3dfc44+=0x1;_0x581395['push'](new Extension(_0x41700f,_0x3dfc44,_0x85a6('0x8a'),_0x85a6('0x8b')));_0x3dfc44+=0x1;for(var _0x4bede6 in _0x41700f){if(_0x41700f[_0x85a6('0x48')](_0x4bede6)&&(_0x4bede6===_0x85a6('0x8c')||_0x4bede6===_0x85a6('0x84')||_0x4bede6===_0x85a6('0x8d')||_0x4bede6==='faxdetect'||_0x4bede6===_0x85a6('0x8e')||_0x4bede6===_0x85a6('0x8f')||_0x4bede6===_0x85a6('0x90')||_0x4bede6===_0x85a6('0x91')||_0x4bede6===_0x85a6('0x92'))){_0x581395[_0x85a6('0x88')](new Extension(_0x41700f,_0x3dfc44,_0x85a6('0x93')+_0x4bede6+')='+_0x41700f[_0x4bede6],_0x85a6('0x8b')));_0x3dfc44+=0x1;}}_0x581395[_0x85a6('0x88')](new Extension(_0x41700f,_0x3dfc44,'6',_0x85a6('0x94')));_0x3dfc44+=0x1;_0x581395[_0x85a6('0x88')](new Extension(_0x41700f,_0x3dfc44,_0x85a6('0x95'),'ReceiveFax'));_0x3dfc44=0x0;return _0x581395;}exports[_0x85a6('0x96')]=function(_0x2452ab,_0x27d8cb,_0x3c3f97){var _0x3661e6;return db[_0x85a6('0x7c')][_0x85a6('0x7d')](function(_0x36a432){return db[_0x85a6('0x3e')][_0x85a6('0x5a')](_0x2452ab[_0x85a6('0x5b')],{'transaction':_0x36a432})['then'](function(_0x269e91){_0x3661e6=_0x269e91[_0x85a6('0x36')]({'plain':!![]});return db[_0x85a6('0x97')][_0x85a6('0x98')](createExtensionsReciveFax(_0x3661e6),{'transaction':_0x36a432});});})[_0x85a6('0x1f')](function(){return _0x3661e6;})[_0x85a6('0x1f')](respondWithResult(_0x27d8cb,null))['catch'](handleError(_0x27d8cb,null));};exports['updateAccountApplications']=function(_0x129eb8,_0x40870c,_0x483308){var _0x3bcc80;return db[_0x85a6('0x7c')]['transaction'](function(_0x4e1166){return db[_0x85a6('0x3e')]['update'](_0x129eb8['body'],{'where':{'id':_0x129eb8['body']['id']},'transaction':_0x4e1166})[_0x85a6('0x1f')](function(_0x2c3b02){return db[_0x85a6('0x97')]['destroy']({'where':{'FaxAccountId':_0x129eb8['body']['id']},'transaction':_0x4e1166})[_0x85a6('0x1f')](function(_0x2fe76b){return db[_0x85a6('0x97')][_0x85a6('0x98')](createExtensionsReciveFax(_[_0x85a6('0x70')](_0x129eb8[_0x85a6('0x5b')],[_0x85a6('0x99'),_0x85a6('0x4f'),_0x85a6('0x9a'),'updatedAt','TrunkId',_0x85a6('0x9b')])),{'transaction':_0x4e1166});});});})['then'](function(){return db[_0x85a6('0x3e')][_0x85a6('0x9c')](_0x129eb8[_0x85a6('0x5b')]['id']);})['then'](respondWithResult(_0x40870c,null))['catch'](handleError(_0x40870c,null));};exports['getMessages']=function(_0xa6133f,_0x1bb62d,_0x37b132){var _0x26594a={'raw':!![],'where':{}};var _0x201401={};var _0x2b4f70={'count':0x0,'rows':[]};return db[_0x85a6('0x3e')]['findOne']({'where':{'id':_0xa6133f['params']['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x1bb62d,null))[_0x85a6('0x1f')](function(_0x4b0b68){if(_0x4b0b68){_0x201401[_0x85a6('0x44')]=_[_0x85a6('0x40')](db[_0x85a6('0x9d')]['rawAttributes']);_0x201401[_0x85a6('0x41')]=_[_0x85a6('0x40')](_0xa6133f[_0x85a6('0x41')]);_0x201401[_0x85a6('0x42')]=_['intersection'](_0x201401[_0x85a6('0x44')],_0x201401[_0x85a6('0x41')]);_0x26594a[_0x85a6('0x45')]=_[_0x85a6('0x43')](_0x201401[_0x85a6('0x44')],qs['fields'](_0xa6133f[_0x85a6('0x41')][_0x85a6('0x46')]));_0x26594a[_0x85a6('0x45')]=_0x26594a['attributes'][_0x85a6('0x47')]?_0x26594a['attributes']:_0x201401[_0x85a6('0x44')];if(!_0xa6133f['query'][_0x85a6('0x48')](_0x85a6('0x66'))){_0x26594a[_0x85a6('0x31')]=qs['limit'](_0xa6133f['query'][_0x85a6('0x31')]);_0x26594a[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0xa6133f[_0x85a6('0x41')][_0x85a6('0x30')]);}_0x26594a[_0x85a6('0x49')]=qs[_0x85a6('0x4a')](_0xa6133f[_0x85a6('0x41')]['sort']);_0x26594a['where']=qs[_0x85a6('0x42')](_[_0x85a6('0x4b')](_0xa6133f[_0x85a6('0x41')],_0x201401[_0x85a6('0x42')]));_0x26594a['where'][_0x85a6('0x67')]=_0x4b0b68['id'];if(_0xa6133f[_0x85a6('0x41')]['filter']){_0x26594a['where']=_[_0x85a6('0x51')](_0x26594a[_0x85a6('0x4d')],{'$or':_[_0x85a6('0x72')](_0x26594a[_0x85a6('0x45')],function(_0x26041d){var _0x5a40c7={};_0x5a40c7[_0x26041d]={'$like':'%'+_0xa6133f[_0x85a6('0x41')][_0x85a6('0x4c')]+'%'};return _0x5a40c7;})});}if(_0xa6133f[_0x85a6('0x41')][_0x85a6('0x9e')]){var _0x70d380=_0xa6133f[_0x85a6('0x41')][_0x85a6('0x9e')][_0x85a6('0x9f')](',');var _0x28e00a={};_0x28e00a[_0x70d380[0x0]]={'$gte':moment(_0x70d380[0x1])[_0x85a6('0xa0')](_0x85a6('0xa1'))};_0x26594a[_0x85a6('0x4d')]=_[_0x85a6('0x51')](_0x26594a['where'],_0x28e00a);}_0x26594a=_[_0x85a6('0x51')]({},_0x26594a,_0xa6133f[_0x85a6('0x58')]);return db[_0x85a6('0x9d')][_0x85a6('0x2f')]({'where':_0x26594a['where']})['then'](function(_0x556c42){_0x2b4f70[_0x85a6('0x2f')]=_0x556c42;if(_0xa6133f[_0x85a6('0x41')][_0x85a6('0x52')]){_0x26594a[_0x85a6('0x57')]=[{'all':!![]}];}return db[_0x85a6('0x9d')][_0x85a6('0x53')](_0x26594a);})[_0x85a6('0x1f')](function(_0x16f4c9){_0x2b4f70[_0x85a6('0x54')]=_0x16f4c9;return _0x2b4f70;});}})[_0x85a6('0x1f')](respondWithFilteredResult(_0x1bb62d,_0x26594a))['catch'](handleError(_0x1bb62d,null));};exports[_0x85a6('0x3b')]=function(_0x890215,_0x5ad41d,_0x510d34){var _0x4a930f,_0x1dd87e={},_0x50d365;if(_0x890215['body']['to']){_0x50d365=_0x890215[_0x85a6('0x5b')]['to'][0x0];}return db[_0x85a6('0x3e')][_0x85a6('0x59')]({'where':{'id':_0x890215['params']['id']},'include':[{'model':db[_0x85a6('0xa2')],'as':_0x85a6('0xa3'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x50d365},'limit':0x1,'order':[['updatedAt',_0x85a6('0xa4')]]}]}]})[_0x85a6('0x1f')](handleEntityNotFound(_0x5ad41d,null))[_0x85a6('0x1f')](function(_0x58c1fb){_0x4a930f=_0x58c1fb;if(_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')]&&_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][_0x85a6('0x47')]){for(var _0x4cb963=0x0;_0x4cb963<_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][_0x85a6('0x47')];_0x4cb963+=0x1){_0x890215['body'][_0x85a6('0xa5')][_0x4cb963]={'filename':_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][_0x4cb963][_0x85a6('0x3a')],'id':_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][_0x4cb963]['id'],'path':path['join'](config[_0x85a6('0xa6')],_0x85a6('0xa7'),_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][_0x4cb963][_0x85a6('0xa8')])};}}return respondWithRpcPromise(_0x85a6('0xa9'),_0x85a6('0xa9'),{'FaxAccountId':_[_0x85a6('0xaa')](_0x890215[_0x85a6('0x56')]['id'])?undefined:_0x890215['params']['id'],'path':_[_0x85a6('0xaa')](_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][0x0][_0x85a6('0x8')])?undefined:_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][0x0]['path'],'fax':_['isNil'](_0x890215[_0x85a6('0x5b')]['to'][0x0])?undefined:_0x890215[_0x85a6('0x5b')]['to'][0x0]},client9002);})[_0x85a6('0x1f')](function(){if(_0x4a930f){if(_[_0x85a6('0xaa')](_0x890215['body'][_0x85a6('0xab')])){_0x890215[_0x85a6('0x5b')][_0x85a6('0xab')]=util[_0x85a6('0xa0')](_0x85a6('0xac'),_0x4a930f[_0x85a6('0x3a')],_0x4a930f[_0x85a6('0xad')]);}if(_0x4a930f[_0x85a6('0xa3')]){if(_0x4a930f['List']['Contacts']['length']){return _0x4a930f[_0x85a6('0xa3')]['Contacts'][0x0];}else{return db['CmContact'][_0x85a6('0x5a')](_[_0x85a6('0xae')](_0x890215['body'],{'firstName':_0x890215['body']['to'][0x0],'phone':_0x890215[_0x85a6('0x5b')]['to'][0x0],'fax':_0x890215[_0x85a6('0x5b')]['to'][0x0],'ListId':_0x4a930f['ListId']}));}}else{throw new Error(_0x85a6('0xaf'));}}else{throw new Error(_0x85a6('0xb0'));}})[_0x85a6('0x1f')](function(_0x15ceff){if(_0x15ceff){return db[_0x85a6('0x6f')]['find']({'where':{'ContactId':_0x15ceff['id'],'closed':![],'FaxAccountId':_0x4a930f['id']}})[_0x85a6('0x1f')](function(_0x4a0c9e){if(_0x4a0c9e){return[_0x4a0c9e,![]];}return db[_0x85a6('0x6f')][_0x85a6('0x5a')]({'UserId':_0x890215[_0x85a6('0x5e')]['id'],'ContactId':_0x15ceff['id'],'FaxAccountId':_0x4a930f['id'],'fax':_0x890215[_0x85a6('0x5b')]['to'][0x0],'firstMsgDirection':_0x85a6('0xb1'),'Messages':[_[_0x85a6('0x51')](_0x890215[_0x85a6('0x5b')],{'read':![],'body':_0x890215[_0x85a6('0x5b')]['attachments'][0x0][_0x85a6('0xb2')],'FaxAccountId':_0x4a930f['id'],'UserId':_0x890215[_0x85a6('0x5e')]['id'],'ContactId':_0x15ceff['id'],'AttachmentId':_0x890215['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x85a6('0x9d')],'as':_0x85a6('0xb3')}]})[_0x85a6('0x1f')](function(_0x36c6f6){return[_0x36c6f6,!![]];});});}else{throw new Error(_0x85a6('0xb4'));}})[_0x85a6('0xb5')](function(_0x36f51a,_0x3d6f9b){if(_0x3d6f9b){return _0x36f51a;}return db['FaxMessage'][_0x85a6('0x5a')]({'direction':_0x85a6('0xb1'),'read':![],'body':_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][0x0][_0x85a6('0xb2')],'FaxAccountId':_0x4a930f['id'],'FaxInteractionId':_0x36f51a['id'],'UserId':_0x890215[_0x85a6('0x5e')]['id'],'ContactId':_0x36f51a[_0x85a6('0xb6')],'AttachmentId':_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][0x0]['id']})[_0x85a6('0x1f')](function(_0xcd6235){_0x36f51a[_0x85a6('0xb7')][_0x85a6('0xb3')]=[];_0x36f51a['dataValues'][_0x85a6('0xb3')][_0x85a6('0x88')](_0xcd6235[_0x85a6('0xb7')]);return _0x36f51a;});})['then'](function(_0x167b3e){respondWithRpcPromise(_0x85a6('0xb8'),'SendFax',{'FaxAccountId':_['isNil'](_0x890215[_0x85a6('0x56')]['id'])?undefined:_0x890215[_0x85a6('0x56')]['id'],'path':_['isNil'](_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][0x0]['path'])?undefined:_0x890215[_0x85a6('0x5b')][_0x85a6('0xa5')][0x0][_0x85a6('0x8')],'fax':_['isNil'](_0x890215['body']['to'][0x0])?undefined:_0x890215[_0x85a6('0x5b')]['to'][0x0],'AttachmentId':_0x890215['body'][_0x85a6('0xa5')][0x0]['id']},client9002)[_0x85a6('0x1f')](function(_0xb9eba7){logger['info']('SendFaxRpc,\x20%s',_0xb9eba7);})[_0x85a6('0x2a')](function(_0x2d3790){logger['info'](_0x85a6('0xb9'),_0x2d3790);});return _0x167b3e;})[_0x85a6('0x1f')](respondWithResult(_0x5ad41d,null))['catch'](handleError(_0x5ad41d,null));};exports[_0x85a6('0xba')]=function(_0xf71177,_0x384c78,_0x55be13){return db[_0x85a6('0x3e')][_0x85a6('0x59')]({'where':{'id':_0xf71177[_0x85a6('0x56')]['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x384c78,null))['then'](function(_0xf4a60b){if(_0xf4a60b){return _0xf4a60b['addAgents'](_0xf71177[_0x85a6('0x5b')][_0x85a6('0x69')],_[_0x85a6('0x70')](_0xf71177['body'],[_0x85a6('0x69'),'id'])||{})[_0x85a6('0xb5')](function(_0x5971d5){for(var _0x4675f3=0x0;_0x4675f3<_0xf71177['body'][_0x85a6('0x69')][_0x85a6('0x47')];_0x4675f3+=0x1){socket[_0x85a6('0xbb')](_0x85a6('0xbc'),{'UserId':_0xf71177[_0x85a6('0x5b')]['ids'][_0x4675f3],'FaxAccountId':_0xf71177[_0x85a6('0x56')]['id']});}return _0x5971d5;});}})['then'](respondWithResult(_0x384c78,null))[_0x85a6('0x2a')](handleError(_0x384c78,null));};exports[_0x85a6('0xbd')]=function(_0x3067c3,_0x40a36d,_0x5b4fa4){return db[_0x85a6('0x3e')][_0x85a6('0x59')]({'where':{'id':_0x3067c3[_0x85a6('0x56')]['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x40a36d,null))[_0x85a6('0x1f')](function(_0x119cef){if(_0x119cef){return _0x119cef[_0x85a6('0xbd')](_0x3067c3[_0x85a6('0x41')]['ids'])['then'](function(){if(_[_0x85a6('0xbe')](_0x3067c3[_0x85a6('0x41')][_0x85a6('0x69')])){for(var _0x260e49=0x0;_0x260e49<_0x3067c3['query'][_0x85a6('0x69')][_0x85a6('0x47')];_0x260e49+=0x1){socket[_0x85a6('0xbb')](_0x85a6('0xbf'),{'UserId':Number(_0x3067c3['query'][_0x85a6('0x69')][_0x260e49]),'FaxAccountId':Number(_0x3067c3[_0x85a6('0x56')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3067c3[_0x85a6('0x41')]['ids']),'FaxAccountId':Number(_0x3067c3[_0x85a6('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x40a36d,null))[_0x85a6('0x2a')](handleError(_0x40a36d,null));};exports[_0x85a6('0xc0')]=function(_0x10aa6d,_0x2e9aff,_0x4e9d80){var _0x415f5c={};var _0x252cf8={};var _0x414da8;var _0x155eae;return db[_0x85a6('0x3e')][_0x85a6('0x65')]({'where':{'id':_0x10aa6d[_0x85a6('0x56')]['id']}})[_0x85a6('0x1f')](handleEntityNotFound(_0x2e9aff,null))[_0x85a6('0x1f')](function(_0x53e18d){if(_0x53e18d){_0x414da8=_0x53e18d;_0x252cf8[_0x85a6('0x44')]=_[_0x85a6('0x40')](db[_0x85a6('0x74')]['rawAttributes']);_0x252cf8[_0x85a6('0x41')]=_['keys'](_0x10aa6d[_0x85a6('0x41')]);_0x252cf8['filters']=_[_0x85a6('0x43')](_0x252cf8[_0x85a6('0x44')],_0x252cf8['query']);_0x415f5c[_0x85a6('0x45')]=_['intersection'](_0x252cf8[_0x85a6('0x44')],qs[_0x85a6('0x46')](_0x10aa6d['query']['fields']));_0x415f5c[_0x85a6('0x45')]=_0x415f5c['attributes'][_0x85a6('0x47')]?_0x415f5c['attributes']:_0x252cf8[_0x85a6('0x44')];_0x415f5c['order']=qs['sort'](_0x10aa6d['query'][_0x85a6('0x4a')]);_0x415f5c[_0x85a6('0x4d')]=qs[_0x85a6('0x42')](_[_0x85a6('0x4b')](_0x10aa6d[_0x85a6('0x41')],_0x252cf8[_0x85a6('0x42')]));if(_0x10aa6d['query'][_0x85a6('0x4c')]){_0x415f5c[_0x85a6('0x4d')]=_['merge'](_0x415f5c[_0x85a6('0x4d')],{'$or':_[_0x85a6('0x72')](_0x415f5c[_0x85a6('0x45')],function(_0x40b991){var _0x366274={};_0x366274[_0x40b991]={'$like':'%'+_0x10aa6d[_0x85a6('0x41')][_0x85a6('0x4c')]+'%'};return _0x366274;})});}_0x415f5c=_[_0x85a6('0x51')]({},_0x415f5c,_0x10aa6d[_0x85a6('0x58')]);return _0x414da8[_0x85a6('0xc0')](_0x415f5c);}})[_0x85a6('0x1f')](function(_0x2df589){if(_0x2df589){_0x155eae=_0x2df589[_0x85a6('0x47')];if(!_0x10aa6d[_0x85a6('0x41')]['hasOwnProperty'](_0x85a6('0x66'))){_0x415f5c['limit']=qs[_0x85a6('0x31')](_0x10aa6d[_0x85a6('0x41')][_0x85a6('0x31')]);_0x415f5c[_0x85a6('0x30')]=qs[_0x85a6('0x30')](_0x10aa6d[_0x85a6('0x41')][_0x85a6('0x30')]);}return _0x414da8['getAgents'](_0x415f5c);}})[_0x85a6('0x1f')](function(_0x4bee40){if(_0x4bee40){return _0x4bee40?{'count':_0x155eae,'rows':_0x4bee40}:null;}})[_0x85a6('0x1f')](respondWithResult(_0x2e9aff,null))[_0x85a6('0x2a')](handleError(_0x2e9aff,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f88e5d3..f534783 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 _0x7c46=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c46,0x139));var _0x67c4=function(_0x4f8dd8,_0x2c6ef6){_0x4f8dd8=_0x4f8dd8-0x0;var _0x558147=_0x7c46[_0x4f8dd8];return _0x558147;};'use strict';var EventEmitter=require(_0x67c4('0x0'));var FaxAccount=require(_0x67c4('0x1'))['db'][_0x67c4('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x67c4('0x3')](0x0);var events={'afterCreate':_0x67c4('0x4'),'afterUpdate':_0x67c4('0x5'),'afterDestroy':_0x67c4('0x6')};function emitEvent(_0x564414){return function(_0x1b9ec3,_0x5d64ff,_0x29e22b){FaxAccountEvents[_0x67c4('0x7')](_0x564414+':'+_0x1b9ec3['id'],_0x1b9ec3);FaxAccountEvents[_0x67c4('0x7')](_0x564414,_0x1b9ec3);_0x29e22b(null);};}for(var e in events){if(events[_0x67c4('0x8')](e)){var event=events[e];FaxAccount[_0x67c4('0x9')](e,emitEvent(event));}}module[_0x67c4('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0x76e2=['update','remove','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x76e2,0x105));var _0x276e=function(_0x2e4ee7,_0x4bdc11){_0x2e4ee7=_0x2e4ee7-0x0;var _0x49e2e8=_0x76e2[_0x2e4ee7];return _0x49e2e8;};'use strict';var EventEmitter=require(_0x276e('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x276e('0x1')](0x0);var events={'afterCreate':_0x276e('0x2'),'afterUpdate':_0x276e('0x3'),'afterDestroy':_0x276e('0x4')};function emitEvent(_0x44ba1b){return function(_0x522868,_0x3eb354,_0x912349){FaxAccountEvents['emit'](_0x44ba1b+':'+_0x522868['id'],_0x522868);FaxAccountEvents[_0x276e('0x5')](_0x44ba1b,_0x522868);_0x912349(null);};}for(var e in events){if(events[_0x276e('0x6')](e)){var event=events[e];FaxAccount[_0x276e('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0ae7af5..db2acce 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 _0x769c=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','FaxAccount','fax_accounts'];(function(_0x4668a6,_0x4e8a1f){var _0x23215d=function(_0x4f4cfc){while(--_0x4f4cfc){_0x4668a6['push'](_0x4668a6['shift']());}};_0x23215d(++_0x4e8a1f);}(_0x769c,0x96));var _0xc769=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x769c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xc769('0x0'));var util=require('util');var logger=require(_0xc769('0x1'))(_0xc769('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc769('0x3'));var fs=require('fs');var path=require(_0xc769('0x4'));var rimraf=require(_0xc769('0x5'));var config=require(_0xc769('0x6'));var attributes=require('./faxAccount.attributes');module[_0xc769('0x7')]=function(_0x39a639,_0x4d9c51){return _0x39a639['define'](_0xc769('0x8'),attributes,{'tableName':_0xc769('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x133b=['path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x133b,0x7c));var _0xb133=function(_0x22253c,_0xff5f0b){_0x22253c=_0x22253c-0x0;var _0x40b47a=_0x133b[_0x22253c];return _0x40b47a;};'use strict';var _=require('lodash');var util=require(_0xb133('0x0'));var logger=require(_0xb133('0x1'))(_0xb133('0x2'));var moment=require(_0xb133('0x3'));var BPromise=require(_0xb133('0x4'));var rp=require(_0xb133('0x5'));var fs=require('fs');var path=require(_0xb133('0x6'));var rimraf=require('rimraf');var config=require(_0xb133('0x7'));var attributes=require(_0xb133('0x8'));module[_0xb133('0x9')]=function(_0x57a98d,_0x1417a6){return _0x57a98d[_0xb133('0xa')](_0xb133('0xb'),attributes,{'tableName':_0xb133('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 7b87cc6..b4caaa4 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 _0x3c58=['client','http','redis','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','CmList','List','Contacts','FaxApplication','Applications','get','applications','orderBy','priority','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','find','name','unshift','agent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x465f4d,_0x3e22eb){var _0x1700a1=function(_0x4f5bed){while(--_0x4f5bed){_0x465f4d['push'](_0x465f4d['shift']());}};_0x1700a1(++_0x3e22eb);}(_0x3c58,0xaa));var _0x83c5=function(_0x5cab7b,_0x5b7dd7){_0x5cab7b=_0x5cab7b-0x0;var _0x21c856=_0x3c58[_0x5cab7b];return _0x21c856;};'use strict';var _=require(_0x83c5('0x0'));var util=require(_0x83c5('0x1'));var moment=require('moment');var BPromise=require(_0x83c5('0x2'));var rs=require(_0x83c5('0x3'));var fs=require('fs');var Redis=require(_0x83c5('0x4'));var db=require(_0x83c5('0x5'))['db'];var utils=require(_0x83c5('0x6'));var logger=require(_0x83c5('0x7'))('rpc');var config=require(_0x83c5('0x8'));var jayson=require(_0x83c5('0x9'));var client=jayson[_0x83c5('0xa')][_0x83c5('0xb')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83c5('0xc')]));require('./faxAccount.socket')[_0x83c5('0xd')](socket);function respondWithRpcPromise(_0x166196,_0x2662f3,_0x5e460d){return new BPromise(function(_0x561226,_0x325710){return client[_0x83c5('0xe')](_0x166196,_0x5e460d)[_0x83c5('0xf')](function(_0x3e1eb2){logger[_0x83c5('0x10')](_0x83c5('0x11'),_0x2662f3,_0x83c5('0x12'));logger[_0x83c5('0x13')](_0x83c5('0x14'),_0x2662f3,'request\x20sent',JSON['stringify'](_0x3e1eb2));if(_0x3e1eb2['error']){if(_0x3e1eb2[_0x83c5('0x15')]['code']===0x1f4){logger[_0x83c5('0x15')](_0x83c5('0x11'),_0x2662f3,_0x3e1eb2[_0x83c5('0x15')][_0x83c5('0x16')]);return _0x325710(_0x3e1eb2['error'][_0x83c5('0x16')]);}logger[_0x83c5('0x15')](_0x83c5('0x11'),_0x2662f3,_0x3e1eb2[_0x83c5('0x15')][_0x83c5('0x16')]);return _0x561226(_0x3e1eb2[_0x83c5('0x15')][_0x83c5('0x16')]);}else{logger[_0x83c5('0x10')](_0x83c5('0x11'),_0x2662f3,_0x83c5('0x12'));_0x561226(_0x3e1eb2[_0x83c5('0x17')][_0x83c5('0x16')]);}})['catch'](function(_0x1bf4ed){logger['error'](_0x83c5('0x11'),_0x2662f3,_0x1bf4ed);_0x325710(_0x1bf4ed);});});}exports[_0x83c5('0x18')]=function(_0x24323f){var _0x1c825d=this;return new Promise(function(_0x5d8c2e,_0x20e245){return db[_0x83c5('0x19')]['findAll']({'raw':_0x24323f[_0x83c5('0x1a')]?_0x24323f[_0x83c5('0x1a')][_0x83c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x24323f[_0x83c5('0x1a')]?_0x24323f['options'][_0x83c5('0x1c')]||null:null,'attributes':_0x24323f['options']?_0x24323f[_0x83c5('0x1a')][_0x83c5('0x1d')]||null:null,'limit':_0x24323f[_0x83c5('0x1a')]?_0x24323f[_0x83c5('0x1a')][_0x83c5('0x1e')]||null:null,'include':_0x24323f[_0x83c5('0x1a')]?_0x24323f[_0x83c5('0x1a')][_0x83c5('0x1f')]?_[_0x83c5('0x20')](_0x24323f[_0x83c5('0x1a')]['include'],function(_0x1e9135){return{'model':db[_0x1e9135[_0x83c5('0x21')]],'as':_0x1e9135['as'],'attributes':_0x1e9135[_0x83c5('0x1d')],'include':_0x1e9135[_0x83c5('0x1f')]?_[_0x83c5('0x20')](_0x1e9135[_0x83c5('0x1f')],function(_0x3566b6){return{'model':db[_0x3566b6[_0x83c5('0x21')]],'as':_0x3566b6['as'],'attributes':_0x3566b6[_0x83c5('0x1d')],'include':_0x3566b6[_0x83c5('0x1f')]?_['map'](_0x3566b6[_0x83c5('0x1f')],function(_0x3fff41){return{'model':db[_0x3fff41[_0x83c5('0x21')]],'as':_0x3fff41['as'],'attributes':_0x3fff41[_0x83c5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a693f){logger[_0x83c5('0x10')](_0x83c5('0x18'),_0x24323f);logger[_0x83c5('0x13')](_0x83c5('0x18'),_0x24323f,JSON[_0x83c5('0x22')](_0x5a693f));_0x5d8c2e(_0x5a693f);})[_0x83c5('0x23')](function(_0x313d89){logger[_0x83c5('0x15')](_0x83c5('0x18'),_0x313d89[_0x83c5('0x16')],_0x24323f);_0x20e245(_0x1c825d[_0x83c5('0x15')](0x1f4,_0x313d89[_0x83c5('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x21945f,_0x380e53,_0x44c853){var _0x5a721a=this;return new Promise(function(_0x2f8ab8,_0xae48b6){var _0x126fca={'body':_0x21945f['body'],'channel':_0x83c5('0x24')};var _0x32c416=[];var _0xa357aa=[];var _0x1a692c={};return db[_0x83c5('0x25')][_0x83c5('0x26')]()[_0x83c5('0xf')](function(_0x4f447e){if(!_0x4f447e){throw new db[(_0x83c5('0x27'))][(_0x83c5('0x28'))]('no\x20available\x20attributes');}_0x32c416=_[_0x83c5('0x29')](_[_0x83c5('0x2a')](_0x4f447e),[_0x83c5('0x2b'),_0x83c5('0x2c')]);_0xa357aa=_[_0x83c5('0x29')](_[_0x83c5('0x2a')](_0x4f447e),[_0x83c5('0x2b'),_0x83c5('0x2c'),_0x83c5('0x2d'),_0x83c5('0x2e')]);if(_0x21945f[_0x83c5('0x2f')]['id']){delete _0x21945f[_0x83c5('0x2f')]['id'];}if(_[_0x83c5('0x30')](_0x21945f[_0x83c5('0x2f')][_0x83c5('0x31')])){throw new db[(_0x83c5('0x27'))]['ValidationError'](_0x83c5('0x32'));}if(_[_0x83c5('0x30')](_0x21945f[_0x83c5('0x2f')]['body'])||_0x21945f[_0x83c5('0x2f')][_0x83c5('0x2f')]===''){throw new db[(_0x83c5('0x27'))][(_0x83c5('0x28'))](_0x83c5('0x33'));}if(_[_0x83c5('0x30')](_0x21945f[_0x83c5('0x2f')]['mapKey'])){throw new db[(_0x83c5('0x27'))][(_0x83c5('0x28'))](_0x83c5('0x34')+_0xa357aa);}if(!_[_0x83c5('0x35')](_0xa357aa,_0x21945f[_0x83c5('0x2f')][_0x83c5('0x36')])){throw new db['Sequelize'][(_0x83c5('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa357aa);}_0x1a692c[_0x21945f[_0x83c5('0x2f')][_0x83c5('0x36')]]=_0x21945f[_0x83c5('0x2f')][_0x83c5('0x31')];})[_0x83c5('0xf')](function(){return db['FaxAccount']['find']({'where':{'id':_0x21945f[_0x83c5('0x37')]['id']},'include':[{'model':db[_0x83c5('0x38')],'as':_0x83c5('0x39'),'include':[{'model':db[_0x83c5('0x25')],'as':_0x83c5('0x3a'),'where':_0x1a692c,'limit':0x1,'order':[[_0x83c5('0x2c'),'DESC']]}]},{'model':db[_0x83c5('0x3b')],'as':_0x83c5('0x3c')}]});})[_0x83c5('0xf')](function(_0x1880de){if(_0x1880de&&_0x1880de[_0x83c5('0x39')]){var _0x14f1f3=_0x1880de[_0x83c5('0x3d')]({'plain':!![]});_0x126fca[_0x83c5('0x37')]=_0x14f1f3;_0x126fca[_0x83c5('0x3e')]=_0x14f1f3[_0x83c5('0x3c')];_0x126fca['list']=_0x14f1f3[_0x83c5('0x39')];_0x126fca['applications']=_[_0x83c5('0x3f')](_0x126fca[_0x83c5('0x3e')],[_0x83c5('0x40')],[_0x83c5('0x41')]);if(_0x126fca[_0x83c5('0x37')][_0x83c5('0x3c')]){delete _0x126fca['account']['Applications'];}if(_0x126fca[_0x83c5('0x37')][_0x83c5('0x39')]&&_0x126fca[_0x83c5('0x37')][_0x83c5('0x39')][_0x83c5('0x3a')][_0x83c5('0x42')]){return _0x126fca[_0x83c5('0x37')]['List'][_0x83c5('0x3a')][0x0];}var _0x27a6f9=_[_0x83c5('0x43')](_0x21945f['body'],{'firstName':_0x21945f[_0x83c5('0x2f')][_0x83c5('0x31')],'ListId':_0x14f1f3[_0x83c5('0x2e')]});_0x27a6f9[_0x21945f[_0x83c5('0x2f')][_0x83c5('0x36')]]=_0x21945f[_0x83c5('0x2f')]['from'];return db['CmContact'][_0x83c5('0x44')](_0x27a6f9,{'fields':_0x32c416,'raw':!![]});}})[_0x83c5('0xf')](function(_0x4782ec){_0x126fca[_0x83c5('0x45')]=_0x4782ec;if(_0x4782ec){var _0x3881ee={'ContactId':_0x4782ec['id'],'FaxAccountId':_0x21945f[_0x83c5('0x37')]['id'],'fax':_0x4782ec[_0x83c5('0x24')]};return db[_0x83c5('0x46')]['find']({'where':{'ContactId':_0x4782ec['id'],'closed':![],'FaxAccountId':_0x21945f[_0x83c5('0x37')]['id']}})[_0x83c5('0xf')](function(_0x471bfa){if(_0x471bfa){return[_0x471bfa,![]];}return db[_0x83c5('0x46')][_0x83c5('0x44')](_0x3881ee)[_0x83c5('0xf')](function(_0x55ff9b){return[_0x55ff9b,!![]];});});}else{throw new Error(_0x83c5('0x47'));}})[_0x83c5('0x48')](function(_0x91cd1a,_0x53fa2c){var _0x5b4f0e=_0x91cd1a[_0x83c5('0x3d')]({'plain':!![]});if(_0x53fa2c){if(_0x126fca[_0x83c5('0x37')][_0x83c5('0x49')]){_0x126fca[_0x83c5('0x3e')][_0x83c5('0x4a')]({'id':0x0,'priority':_0x126fca[_0x83c5('0x3e')][_0x83c5('0x42')]+0x1,'app':_0x83c5('0x4b'),'appdata':_0x83c5('0x4c'),'interval':_0x83c5('0x4d')});}_0x5b4f0e[_0x83c5('0x4e')]=!![];}else{_0x5b4f0e[_0x83c5('0x4e')]=![];}_0x126fca['interaction']=_0x5b4f0e;return db[_0x83c5('0x4f')][_0x83c5('0x44')]({'body':_0x21945f[_0x83c5('0x2f')][_0x83c5('0x2f')],'FaxAccountId':_0x21945f[_0x83c5('0x37')]['id'],'FaxInteractionId':_0x91cd1a['id'],'direction':'in','ContactId':_0x91cd1a[_0x83c5('0x50')],'AttachmentId':_0x21945f[_0x83c5('0x2f')]['AttachmentId']});})[_0x83c5('0xf')](function(_0x376dce){_0x126fca[_0x83c5('0x16')]=_0x376dce;if(_0x126fca[_0x83c5('0x51')][_0x83c5('0x52')]){return db[_0x83c5('0x53')][_0x83c5('0x54')]({'attributes':['id',_0x83c5('0x55')],'where':{'id':_0x126fca[_0x83c5('0x51')]['UserId']}})[_0x83c5('0xf')](function(_0x2881c8){if(_0x2881c8){_0x126fca[_0x83c5('0x3e')][_0x83c5('0x56')]({'id':0x0,'priority':0x0,'app':_0x83c5('0x57'),'appdata':_0x2881c8[_0x83c5('0x55')]+','+(_0x126fca[_0x83c5('0x37')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x83c5('0x58'),_0x83c5('0x59'),_0x126fca);});}return respondWithRpcPromise('Start',_0x83c5('0x59'),_0x126fca);})['then'](function(_0x2a7448){_0x2f8ab8(_0x2a7448);})['catch'](function(_0x599f64){_0xae48b6(_0x5a721a[_0x83c5('0x15')](0x1f4,_0x599f64[_0x83c5('0x16')]));});});}; \ No newline at end of file +var _0x9333=['DESC','List','list','applications','orderBy','asc','Applications','length','defaults','create','contact','FaxInteraction','find','Contact\x20not\x20found','get','autoclose','push','close','created','interaction','FaxMessage','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','model','map','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x9333,0x122));var _0x3933=function(_0x5486e9,_0x25d7e7){_0x5486e9=_0x5486e9-0x0;var _0x99a416=_0x9333[_0x5486e9];return _0x99a416;};'use strict';var _=require(_0x3933('0x0'));var util=require(_0x3933('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3933('0x2'));var fs=require('fs');var Redis=require(_0x3933('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3933('0x4'))(_0x3933('0x5'));var config=require(_0x3933('0x6'));var jayson=require(_0x3933('0x7'));var client=jayson[_0x3933('0x8')]['http']({'port':0x232c});config[_0x3933('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3933('0xa'))(new Redis(config[_0x3933('0x9')]));require(_0x3933('0xb'))[_0x3933('0xc')](socket);function respondWithRpcPromise(_0x4467a7,_0x5c5e7d,_0x1b66ce){return new BPromise(function(_0x592dae,_0x2a6608){return client[_0x3933('0xd')](_0x4467a7,_0x1b66ce)[_0x3933('0xe')](function(_0x3f81f8){logger[_0x3933('0xf')](_0x3933('0x10'),_0x5c5e7d,_0x3933('0x11'));logger[_0x3933('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5c5e7d,'request\x20sent',JSON['stringify'](_0x3f81f8));if(_0x3f81f8['error']){if(_0x3f81f8[_0x3933('0x13')][_0x3933('0x14')]===0x1f4){logger[_0x3933('0x13')]('FaxAccount,\x20%s,\x20%s',_0x5c5e7d,_0x3f81f8[_0x3933('0x13')][_0x3933('0x15')]);return _0x2a6608(_0x3f81f8[_0x3933('0x13')][_0x3933('0x15')]);}logger[_0x3933('0x13')](_0x3933('0x10'),_0x5c5e7d,_0x3f81f8[_0x3933('0x13')]['message']);return _0x592dae(_0x3f81f8[_0x3933('0x13')][_0x3933('0x15')]);}else{logger[_0x3933('0xf')]('FaxAccount,\x20%s,\x20%s',_0x5c5e7d,_0x3933('0x11'));_0x592dae(_0x3f81f8[_0x3933('0x16')][_0x3933('0x15')]);}})['catch'](function(_0x1d0763){logger['error'](_0x3933('0x10'),_0x5c5e7d,_0x1d0763);_0x2a6608(_0x1d0763);});});}exports[_0x3933('0x17')]=function(_0x4a7761){var _0x196710=this;return new Promise(function(_0x57ee90,_0x371ab6){return db[_0x3933('0x18')][_0x3933('0x19')]({'raw':_0x4a7761[_0x3933('0x1a')]?_0x4a7761['options'][_0x3933('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a7761['options']?_0x4a7761[_0x3933('0x1a')][_0x3933('0x1c')]||null:null,'attributes':_0x4a7761[_0x3933('0x1a')]?_0x4a7761[_0x3933('0x1a')][_0x3933('0x1d')]||null:null,'limit':_0x4a7761[_0x3933('0x1a')]?_0x4a7761[_0x3933('0x1a')]['limit']||null:null,'include':_0x4a7761[_0x3933('0x1a')]?_0x4a7761[_0x3933('0x1a')][_0x3933('0x1e')]?_['map'](_0x4a7761[_0x3933('0x1a')][_0x3933('0x1e')],function(_0x42ee82){return{'model':db[_0x42ee82[_0x3933('0x1f')]],'as':_0x42ee82['as'],'attributes':_0x42ee82[_0x3933('0x1d')],'include':_0x42ee82['include']?_[_0x3933('0x20')](_0x42ee82['include'],function(_0x3940e9){return{'model':db[_0x3940e9[_0x3933('0x1f')]],'as':_0x3940e9['as'],'attributes':_0x3940e9[_0x3933('0x1d')],'include':_0x3940e9[_0x3933('0x1e')]?_[_0x3933('0x20')](_0x3940e9[_0x3933('0x1e')],function(_0x296521){return{'model':db[_0x296521[_0x3933('0x1f')]],'as':_0x296521['as'],'attributes':_0x296521[_0x3933('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3933('0xe')](function(_0x4598bb){logger[_0x3933('0xf')](_0x3933('0x17'),_0x4a7761);logger[_0x3933('0x12')](_0x3933('0x17'),_0x4a7761,JSON['stringify'](_0x4598bb));_0x57ee90(_0x4598bb);})[_0x3933('0x21')](function(_0x365c9c){logger[_0x3933('0x13')](_0x3933('0x17'),_0x365c9c['message'],_0x4a7761);_0x371ab6(_0x196710[_0x3933('0x13')](0x1f4,_0x365c9c[_0x3933('0x15')]));});});};exports[_0x3933('0x22')]=function(_0x4db8aa,_0x11963d,_0x584d29){var _0x6a780c=this;return new Promise(function(_0x1ad9a5,_0x3ff333){var _0x21b69f={'body':_0x4db8aa['body'],'channel':_0x3933('0x23')};var _0x5b05a6=[];var _0x516d38=[];var _0x37999a={};return db[_0x3933('0x24')][_0x3933('0x25')]()['then'](function(_0x3a86f9){if(!_0x3a86f9){throw new db[(_0x3933('0x26'))][(_0x3933('0x27'))](_0x3933('0x28'));}_0x5b05a6=_['difference'](_[_0x3933('0x29')](_0x3a86f9),[_0x3933('0x2a'),_0x3933('0x2b')]);_0x516d38=_[_0x3933('0x2c')](_[_0x3933('0x29')](_0x3a86f9),[_0x3933('0x2a'),_0x3933('0x2b'),_0x3933('0x2d'),_0x3933('0x2e')]);if(_0x4db8aa['body']['id']){delete _0x4db8aa[_0x3933('0x2f')]['id'];}if(_[_0x3933('0x30')](_0x4db8aa[_0x3933('0x2f')][_0x3933('0x31')])){throw new db[(_0x3933('0x26'))][(_0x3933('0x27'))](_0x3933('0x32'));}if(_[_0x3933('0x30')](_0x4db8aa[_0x3933('0x2f')]['body'])||_0x4db8aa['body']['body']===''){throw new db[(_0x3933('0x26'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4db8aa['body']['mapKey'])){throw new db['Sequelize'][(_0x3933('0x27'))](_0x3933('0x33')+_0x516d38);}if(!_[_0x3933('0x34')](_0x516d38,_0x4db8aa[_0x3933('0x2f')][_0x3933('0x35')])){throw new db['Sequelize'][(_0x3933('0x27'))](_0x3933('0x36')+_0x516d38);}_0x37999a[_0x4db8aa[_0x3933('0x2f')][_0x3933('0x35')]]=_0x4db8aa[_0x3933('0x2f')][_0x3933('0x31')];})[_0x3933('0xe')](function(){return db[_0x3933('0x18')]['find']({'where':{'id':_0x4db8aa[_0x3933('0x37')]['id']},'include':[{'model':db[_0x3933('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3933('0x39'),'where':_0x37999a,'limit':0x1,'order':[[_0x3933('0x2b'),_0x3933('0x3a')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x3933('0xe')](function(_0x59d86b){if(_0x59d86b&&_0x59d86b[_0x3933('0x3b')]){var _0x476d34=_0x59d86b['get']({'plain':!![]});_0x21b69f[_0x3933('0x37')]=_0x476d34;_0x21b69f['applications']=_0x476d34['Applications'];_0x21b69f[_0x3933('0x3c')]=_0x476d34[_0x3933('0x3b')];_0x21b69f[_0x3933('0x3d')]=_[_0x3933('0x3e')](_0x21b69f[_0x3933('0x3d')],['priority'],[_0x3933('0x3f')]);if(_0x21b69f[_0x3933('0x37')][_0x3933('0x40')]){delete _0x21b69f[_0x3933('0x37')][_0x3933('0x40')];}if(_0x21b69f[_0x3933('0x37')][_0x3933('0x3b')]&&_0x21b69f['account']['List']['Contacts'][_0x3933('0x41')]){return _0x21b69f[_0x3933('0x37')][_0x3933('0x3b')][_0x3933('0x39')][0x0];}var _0x42c15c=_[_0x3933('0x42')](_0x4db8aa['body'],{'firstName':_0x4db8aa['body'][_0x3933('0x31')],'ListId':_0x476d34[_0x3933('0x2e')]});_0x42c15c[_0x4db8aa[_0x3933('0x2f')]['mapKey']]=_0x4db8aa[_0x3933('0x2f')][_0x3933('0x31')];return db[_0x3933('0x24')][_0x3933('0x43')](_0x42c15c,{'fields':_0x5b05a6,'raw':!![]});}})['then'](function(_0x213a83){_0x21b69f[_0x3933('0x44')]=_0x213a83;if(_0x213a83){var _0x234dde={'ContactId':_0x213a83['id'],'FaxAccountId':_0x4db8aa[_0x3933('0x37')]['id'],'fax':_0x213a83[_0x3933('0x23')]};return db[_0x3933('0x45')][_0x3933('0x46')]({'where':{'ContactId':_0x213a83['id'],'closed':![],'FaxAccountId':_0x4db8aa[_0x3933('0x37')]['id']}})[_0x3933('0xe')](function(_0x50ef60){if(_0x50ef60){return[_0x50ef60,![]];}return db[_0x3933('0x45')][_0x3933('0x43')](_0x234dde)['then'](function(_0x2e6e18){return[_0x2e6e18,!![]];});});}else{throw new Error(_0x3933('0x47'));}})['spread'](function(_0x4cb1c9,_0x438ffe){var _0x4804f3=_0x4cb1c9[_0x3933('0x48')]({'plain':!![]});if(_0x438ffe){if(_0x21b69f['account'][_0x3933('0x49')]){_0x21b69f[_0x3933('0x3d')][_0x3933('0x4a')]({'id':0x0,'priority':_0x21b69f['applications']['length']+0x1,'app':_0x3933('0x4b'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x4804f3[_0x3933('0x4c')]=!![];}else{_0x4804f3[_0x3933('0x4c')]=![];}_0x21b69f[_0x3933('0x4d')]=_0x4804f3;return db[_0x3933('0x4e')]['create']({'body':_0x4db8aa[_0x3933('0x2f')][_0x3933('0x2f')],'FaxAccountId':_0x4db8aa[_0x3933('0x37')]['id'],'FaxInteractionId':_0x4cb1c9['id'],'direction':'in','ContactId':_0x4cb1c9['ContactId'],'AttachmentId':_0x4db8aa[_0x3933('0x2f')]['AttachmentId']});})[_0x3933('0xe')](function(_0x277b3c){_0x21b69f['message']=_0x277b3c;if(_0x21b69f[_0x3933('0x4d')][_0x3933('0x4f')]){return db[_0x3933('0x50')][_0x3933('0x46')]({'attributes':['id',_0x3933('0x51')],'where':{'id':_0x21b69f[_0x3933('0x4d')]['UserId']}})[_0x3933('0xe')](function(_0x4d8c42){if(_0x4d8c42){_0x21b69f[_0x3933('0x3d')][_0x3933('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4d8c42[_0x3933('0x51')]+','+(_0x21b69f[_0x3933('0x37')][_0x3933('0x53')]||0xa),'interval':_0x3933('0x54')});}return respondWithRpcPromise(_0x3933('0x55'),_0x3933('0x56'),_0x21b69f);});}return respondWithRpcPromise('Start',_0x3933('0x56'),_0x21b69f);})[_0x3933('0xe')](function(_0x14758d){_0x1ad9a5(_0x14758d);})['catch'](function(_0x4c4cfb){_0x3ff333(_0x6a780c[_0x3933('0x13')](0x1f4,_0x4c4cfb[_0x3933('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 58de1c4..9fecae7 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 _0x81de=['save','remove','update','emit','removeListener','length','faxAccount:'];(function(_0x34ebb5,_0x148be9){var _0x491755=function(_0x264d78){while(--_0x264d78){_0x34ebb5['push'](_0x34ebb5['shift']());}};_0x491755(++_0x148be9);}(_0x81de,0xd9));var _0xe81d=function(_0x21c077,_0x3741f0){_0x21c077=_0x21c077-0x0;var _0x20e860=_0x81de[_0x21c077];return _0x20e860;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe81d('0x0'),_0xe81d('0x1'),_0xe81d('0x2')];function createListener(_0x21da1f,_0x462e66){return function(_0x2243f3){_0x462e66[_0xe81d('0x3')](_0x21da1f,_0x2243f3);};}function removeListener(_0x5c260e,_0x2cd89f){return function(){FaxAccountEvents[_0xe81d('0x4')](_0x5c260e,_0x2cd89f);};}exports['register']=function(_0x4e4a12){for(var _0x426d30=0x0,_0x32bb26=events[_0xe81d('0x5')];_0x426d30<_0x32bb26;_0x426d30++){var _0x3d0217=events[_0x426d30];var _0x3b93dc=createListener(_0xe81d('0x6')+_0x3d0217,_0x4e4a12);FaxAccountEvents['on'](_0x3d0217,_0x3b93dc);}}; \ No newline at end of file +var _0x945d=['faxAccount:','./faxAccount.events','save','remove','emit','removeListener','length'];(function(_0x6e0aad,_0x3c0d9f){var _0x6e6ef0=function(_0x13ef8b){while(--_0x13ef8b){_0x6e0aad['push'](_0x6e0aad['shift']());}};_0x6e6ef0(++_0x3c0d9f);}(_0x945d,0xa2));var _0xd945=function(_0x2b6225,_0x1d0680){_0x2b6225=_0x2b6225-0x0;var _0x1906d5=_0x945d[_0x2b6225];return _0x1906d5;};'use strict';var FaxAccountEvents=require(_0xd945('0x0'));var events=[_0xd945('0x1'),_0xd945('0x2'),'update'];function createListener(_0x4412d7,_0x5ccca5){return function(_0x565a5a){_0x5ccca5[_0xd945('0x3')](_0x4412d7,_0x565a5a);};}function removeListener(_0x796eed,_0xc721b4){return function(){FaxAccountEvents[_0xd945('0x4')](_0x796eed,_0xc721b4);};}exports['register']=function(_0x41caeb){for(var _0x4ca6f8=0x0,_0x2b4651=events[_0xd945('0x5')];_0x4ca6f8<_0x2b4651;_0x4ca6f8++){var _0x53eb06=events[_0x4ca6f8];var _0xc98299=createListener(_0xd945('0x6')+_0x53eb06,_0x41caeb);FaxAccountEvents['on'](_0x53eb06,_0xc98299);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 94a15f9..583efca 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 _0x09c9=['/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x09c9,0x1ef));var _0x909c=function(_0x59c4a4,_0x2759e9){_0x59c4a4=_0x59c4a4-0x0;var _0x45b0a5=_0x09c9[_0x59c4a4];return _0x45b0a5;};'use strict';var multer=require(_0x909c('0x0'));var util=require(_0x909c('0x1'));var path=require(_0x909c('0x2'));var timeout=require(_0x909c('0x3'));var express=require(_0x909c('0x4'));var router=express[_0x909c('0x5')]();var auth=require(_0x909c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x909c('0x7'));var controller=require(_0x909c('0x8'));router[_0x909c('0x9')]('/',auth[_0x909c('0xa')](),controller[_0x909c('0xb')]);router['get'](_0x909c('0xc'),auth[_0x909c('0xa')](),controller[_0x909c('0xd')]);router[_0x909c('0x9')](_0x909c('0xe'),auth[_0x909c('0xa')](),controller[_0x909c('0xf')]);router[_0x909c('0x9')](_0x909c('0x10'),auth[_0x909c('0xa')](),controller[_0x909c('0x11')]);router[_0x909c('0x9')](_0x909c('0x12'),auth[_0x909c('0xa')](),controller[_0x909c('0x13')]);router[_0x909c('0x9')](_0x909c('0x14'),auth[_0x909c('0xa')](),controller[_0x909c('0x15')]);router[_0x909c('0x9')](_0x909c('0x16'),auth[_0x909c('0xa')](),controller[_0x909c('0x17')]);router[_0x909c('0x9')](_0x909c('0x18'),auth[_0x909c('0xa')](),controller[_0x909c('0x19')]);router[_0x909c('0x9')](_0x909c('0x1a'),auth[_0x909c('0xa')](),controller[_0x909c('0x1b')]);router[_0x909c('0x1c')]('/',auth[_0x909c('0xa')](),controller[_0x909c('0x1d')]);router[_0x909c('0x1c')](_0x909c('0x10'),auth[_0x909c('0xa')](),controller[_0x909c('0x1e')]);router[_0x909c('0x1c')]('/:id/canned_answers',auth[_0x909c('0xa')](),controller[_0x909c('0x1f')]);router[_0x909c('0x1c')]('/:id/interactions',auth[_0x909c('0xa')](),controller[_0x909c('0x20')]);router[_0x909c('0x1c')](_0x909c('0x16'),auth[_0x909c('0xa')](),controller['addApplications']);router['post'](_0x909c('0x21'),auth[_0x909c('0xa')](),controller[_0x909c('0x22')]);router[_0x909c('0x1c')](_0x909c('0x23'),auth[_0x909c('0xa')](),controller[_0x909c('0x24')]);router['post'](_0x909c('0x25'),auth['isAuthenticated'](),controller[_0x909c('0x26')]);router['post'](_0x909c('0x1a'),auth[_0x909c('0xa')](),controller[_0x909c('0x27')]);router[_0x909c('0x28')](_0x909c('0xe'),auth[_0x909c('0xa')](),controller[_0x909c('0x29')]);router['delete'](_0x909c('0xe'),auth['isAuthenticated'](),controller[_0x909c('0x2a')]);router[_0x909c('0x2b')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x909c('0x2b')](_0x909c('0x12'),auth[_0x909c('0xa')](),controller[_0x909c('0x2c')]);router['delete'](_0x909c('0x1a'),auth[_0x909c('0xa')](),controller[_0x909c('0x2d')]);module[_0x909c('0x2e')]=router; \ No newline at end of file +var _0xca34=['/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','get','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xca34,0x134));var _0x4ca3=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xca34[_0x47b58b];return _0x46bebe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4ca3('0x0'));var express=require(_0x4ca3('0x1'));var router=express[_0x4ca3('0x2')]();var auth=require(_0x4ca3('0x3'));var interaction=require(_0x4ca3('0x4'));var config=require(_0x4ca3('0x5'));var controller=require(_0x4ca3('0x6'));router['get']('/',auth[_0x4ca3('0x7')](),controller['index']);router['get'](_0x4ca3('0x8'),auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x9')]);router['get'](_0x4ca3('0xa'),auth[_0x4ca3('0x7')](),controller[_0x4ca3('0xb')]);router['get'](_0x4ca3('0xc'),auth['isAuthenticated'](),controller[_0x4ca3('0xd')]);router[_0x4ca3('0xe')](_0x4ca3('0xf'),auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x10')]);router[_0x4ca3('0xe')](_0x4ca3('0x11'),auth['isAuthenticated'](),controller[_0x4ca3('0x12')]);router[_0x4ca3('0xe')](_0x4ca3('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x4ca3('0xe')](_0x4ca3('0x14'),auth['isAuthenticated'](),controller[_0x4ca3('0x15')]);router[_0x4ca3('0xe')](_0x4ca3('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4ca3('0x17')]('/',auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x18')]);router[_0x4ca3('0x17')](_0x4ca3('0xc'),auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x19')]);router['post'](_0x4ca3('0xf'),auth['isAuthenticated'](),controller[_0x4ca3('0x1a')]);router[_0x4ca3('0x17')]('/:id/interactions',auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x1b')]);router[_0x4ca3('0x17')]('/:id/applications',auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x1c')]);router['post'](_0x4ca3('0x1d'),auth['isAuthenticated'](),controller[_0x4ca3('0x1e')]);router[_0x4ca3('0x17')](_0x4ca3('0x1f'),auth['isAuthenticated'](),controller[_0x4ca3('0x20')]);router['post']('/:id/send',auth[_0x4ca3('0x7')](),controller['send']);router['post'](_0x4ca3('0x16'),auth[_0x4ca3('0x7')](),controller['addAgents']);router[_0x4ca3('0x21')]('/:id',auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x22')]);router[_0x4ca3('0x23')](_0x4ca3('0xa'),auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x24')]);router['delete'](_0x4ca3('0xc'),auth['isAuthenticated'](),controller[_0x4ca3('0x25')]);router[_0x4ca3('0x23')](_0x4ca3('0xf'),auth['isAuthenticated'](),controller[_0x4ca3('0x26')]);router[_0x4ca3('0x23')](_0x4ca3('0x16'),auth[_0x4ca3('0x7')](),controller[_0x4ca3('0x27')]);module[_0x4ca3('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 153b9fd..387b3d1 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 _0x3ef7=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x20a822,_0x5dc295){var _0x3775d1=function(_0x5c53dd){while(--_0x5c53dd){_0x20a822['push'](_0x20a822['shift']());}};_0x3775d1(++_0x5dc295);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x73ef('0x0'));module['exports']={'priority':{'type':Sequelize[_0x73ef('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x73ef('0x2')],'allowNull':![],'defaultValue':_0x73ef('0x3')},'appdata':{'type':Sequelize[_0x73ef('0x4')]()},'description':{'type':Sequelize[_0x73ef('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x73ef('0x5')}}; \ No newline at end of file +var _0x8a2a=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x8a2a[_0x54edc9];return _0x2ae7a9;};'use strict';var Sequelize=require('sequelize');module[_0xa8a2('0x0')]={'priority':{'type':Sequelize[_0xa8a2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa8a2('0x2')],'allowNull':![],'defaultValue':_0xa8a2('0x3')},'appdata':{'type':Sequelize[_0xa8a2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa8a2('0x2')],'defaultValue':_0xa8a2('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 30daf3f..58f6dc9 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 _0x8d0e=['../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','where','pick','filters','merge','type','key','VIRTUAL','filter','options','includeAll','include','rows','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5e86bd,_0x1bfd65){_0x5e86bd=_0x5e86bd-0x0;var _0x2b4d59=_0x8d0e[_0x5e86bd];return _0x2b4d59;};'use strict';var pdf=require(_0xe8d0('0x0'));var emlformat=require(_0xe8d0('0x1'));var rimraf=require(_0xe8d0('0x2'));var zipdir=require(_0xe8d0('0x3'));var jsonpatch=require(_0xe8d0('0x4'));var rp=require(_0xe8d0('0x5'));var moment=require(_0xe8d0('0x6'));var BPromise=require(_0xe8d0('0x7'));var Mustache=require(_0xe8d0('0x8'));var util=require('util');var path=require(_0xe8d0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe8d0('0xa'));var fs=require('fs');var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe8d0('0x15'));var utils=require(_0xe8d0('0x16'));var config=require(_0xe8d0('0x17'));var db=require(_0xe8d0('0x18'))['db'];function respondWithStatusCode(_0x314657,_0x41de69){_0x41de69=_0x41de69||0xcc;return function(_0x5934b2){if(_0x5934b2){return _0x314657[_0xe8d0('0x19')](_0x41de69);}return _0x314657[_0xe8d0('0x1a')](_0x41de69)['end']();};}function respondWithResult(_0x2b640d,_0x4cbd26){_0x4cbd26=_0x4cbd26||0xc8;return function(_0x59b4b7){if(_0x59b4b7){return _0x2b640d[_0xe8d0('0x1a')](_0x4cbd26)[_0xe8d0('0x1b')](_0x59b4b7);}};}function respondWithFilteredResult(_0x1aa725,_0x291b49){return function(_0x15d3a1){if(_0x15d3a1){var _0x7151c6=_0x15d3a1[_0xe8d0('0x1c')],_0x52818a=_0x291b49[_0xe8d0('0x1d')],_0x6ccffa=_0x291b49[_0xe8d0('0x1d')]+_0x291b49['limit'],_0x49554d;if(_0x6ccffa>=_0x7151c6){_0x6ccffa=_0x7151c6;_0x49554d=0xc8;}else{_0x49554d=0xce;}_0x1aa725['status'](_0x49554d);return _0x1aa725['set'](_0xe8d0('0x1e'),_0x52818a+'-'+_0x6ccffa+'/'+_0x7151c6)[_0xe8d0('0x1b')](_0x15d3a1);}return null;};}function patchUpdates(_0x27b910){return function(_0x44bbe4){try{jsonpatch[_0xe8d0('0x1f')](_0x44bbe4,_0x27b910,!![]);}catch(_0x588133){return BPromise[_0xe8d0('0x20')](_0x588133);}return _0x44bbe4[_0xe8d0('0x21')]();};}function saveUpdates(_0x524b00,_0x5ce284){return function(_0x554402){if(_0x554402){return _0x554402[_0xe8d0('0x22')](_0x524b00)[_0xe8d0('0x23')](function(_0x25363b){return _0x25363b;});}return null;};}function removeEntity(_0x1fbfe8,_0x25f764){return function(_0x23a945){if(_0x23a945){return _0x23a945[_0xe8d0('0x24')]()[_0xe8d0('0x23')](function(){_0x1fbfe8[_0xe8d0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed8f2e,_0x9f747){return function(_0x572c25){if(!_0x572c25){_0xed8f2e[_0xe8d0('0x19')](0x194);}return _0x572c25;};}function handleError(_0x2e69d1,_0x274cac){_0x274cac=_0x274cac||0x1f4;return function(_0xd86c76){logger[_0xe8d0('0x25')](_0xd86c76[_0xe8d0('0x26')]);if(_0xd86c76[_0xe8d0('0x27')]){delete _0xd86c76[_0xe8d0('0x27')];}_0x2e69d1[_0xe8d0('0x1a')](_0x274cac)[_0xe8d0('0x28')](_0xd86c76);};}exports[_0xe8d0('0x29')]=function(_0x539548,_0x24982c){var _0x26dd52={},_0x10dec2={},_0x486f49={'count':0x0,'rows':[]};var _0x10a30b=db[_0xe8d0('0x2a')]['rawAttributes'];_0x10dec2[_0xe8d0('0x2b')]=_[_0xe8d0('0x2c')](_0x10a30b);_0x10dec2[_0xe8d0('0x2d')]=_[_0xe8d0('0x2c')](_0x539548[_0xe8d0('0x2d')]);_0x10dec2['filters']=_[_0xe8d0('0x2e')](_0x10dec2['model'],_0x10dec2['query']);_0x26dd52['attributes']=_[_0xe8d0('0x2e')](_0x10dec2[_0xe8d0('0x2b')],qs[_0xe8d0('0x2f')](_0x539548['query']['fields']));_0x26dd52[_0xe8d0('0x30')]=_0x26dd52['attributes'][_0xe8d0('0x31')]?_0x26dd52[_0xe8d0('0x30')]:_0x10dec2[_0xe8d0('0x2b')];if(!_0x539548[_0xe8d0('0x2d')][_0xe8d0('0x32')]('nolimit')){_0x26dd52[_0xe8d0('0x33')]=qs[_0xe8d0('0x33')](_0x539548[_0xe8d0('0x2d')][_0xe8d0('0x33')]);_0x26dd52['offset']=qs[_0xe8d0('0x1d')](_0x539548[_0xe8d0('0x2d')]['offset']);}_0x26dd52[_0xe8d0('0x34')]=qs['sort'](_0x539548[_0xe8d0('0x2d')]['sort']);_0x26dd52[_0xe8d0('0x35')]=qs['filters'](_[_0xe8d0('0x36')](_0x539548[_0xe8d0('0x2d')],_0x10dec2[_0xe8d0('0x37')]));if(_0x539548[_0xe8d0('0x2d')]['filter']){_0x26dd52[_0xe8d0('0x35')]=_[_0xe8d0('0x38')](_0x26dd52[_0xe8d0('0x35')],{'$or':_['map'](_0x10a30b,function(_0x2a66f8){if(_0x2a66f8[_0xe8d0('0x39')][_0xe8d0('0x3a')]!==_0xe8d0('0x3b')){var _0x1ecd41={};_0x1ecd41[_0x2a66f8['field']]={'$like':'%'+_0x539548[_0xe8d0('0x2d')][_0xe8d0('0x3c')]+'%'};return _0x1ecd41;}})});}_0x26dd52=_[_0xe8d0('0x38')]({},_0x26dd52,_0x539548[_0xe8d0('0x3d')]);var _0x318106={'where':_0x26dd52[_0xe8d0('0x35')]};return db[_0xe8d0('0x2a')][_0xe8d0('0x1c')](_0x318106)['then'](function(_0x5dff14){_0x486f49[_0xe8d0('0x1c')]=_0x5dff14;if(_0x539548[_0xe8d0('0x2d')][_0xe8d0('0x3e')]){_0x26dd52[_0xe8d0('0x3f')]=[{'all':!![]}];}return db[_0xe8d0('0x2a')]['findAll'](_0x26dd52);})[_0xe8d0('0x23')](function(_0x4bd7a2){_0x486f49[_0xe8d0('0x40')]=_0x4bd7a2;return _0x486f49;})[_0xe8d0('0x23')](respondWithFilteredResult(_0x24982c,_0x26dd52))[_0xe8d0('0x41')](handleError(_0x24982c,null));};exports['show']=function(_0x84ec80,_0x3551a0){var _0x731382={'raw':!![],'where':{'id':_0x84ec80[_0xe8d0('0x42')]['id']}},_0x230a90={};_0x230a90['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x230a90[_0xe8d0('0x2d')]=_['keys'](_0x84ec80[_0xe8d0('0x2d')]);_0x230a90[_0xe8d0('0x37')]=_[_0xe8d0('0x2e')](_0x230a90[_0xe8d0('0x2b')],_0x230a90[_0xe8d0('0x2d')]);_0x731382[_0xe8d0('0x30')]=_[_0xe8d0('0x2e')](_0x230a90[_0xe8d0('0x2b')],qs['fields'](_0x84ec80[_0xe8d0('0x2d')][_0xe8d0('0x2f')]));_0x731382['attributes']=_0x731382['attributes'][_0xe8d0('0x31')]?_0x731382[_0xe8d0('0x30')]:_0x230a90[_0xe8d0('0x2b')];if(_0x84ec80['query'][_0xe8d0('0x3e')]){_0x731382[_0xe8d0('0x3f')]=[{'all':!![]}];}_0x731382=_['merge']({},_0x731382,_0x84ec80[_0xe8d0('0x3d')]);return db[_0xe8d0('0x2a')]['find'](_0x731382)[_0xe8d0('0x23')](handleEntityNotFound(_0x3551a0,null))[_0xe8d0('0x23')](respondWithResult(_0x3551a0,null))[_0xe8d0('0x41')](handleError(_0x3551a0,null));};exports[_0xe8d0('0x43')]=function(_0x1d5815,_0x2a6760){return db[_0xe8d0('0x2a')][_0xe8d0('0x43')](_0x1d5815['body'],{})[_0xe8d0('0x23')](respondWithResult(_0x2a6760,0xc9))[_0xe8d0('0x41')](handleError(_0x2a6760,null));};exports[_0xe8d0('0x22')]=function(_0x2278ef,_0x28d38b){if(_0x2278ef[_0xe8d0('0x44')]['id']){delete _0x2278ef[_0xe8d0('0x44')]['id'];}return db[_0xe8d0('0x2a')][_0xe8d0('0x45')]({'where':{'id':_0x2278ef[_0xe8d0('0x42')]['id']}})[_0xe8d0('0x23')](handleEntityNotFound(_0x28d38b,null))[_0xe8d0('0x23')](saveUpdates(_0x2278ef['body'],null))[_0xe8d0('0x23')](respondWithResult(_0x28d38b,null))[_0xe8d0('0x41')](handleError(_0x28d38b,null));};exports[_0xe8d0('0x24')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x2a')][_0xe8d0('0x45')]({'where':{'id':_0xad7d94['params']['id']}})[_0xe8d0('0x23')](handleEntityNotFound(_0x34047c,null))[_0xe8d0('0x23')](removeEntity(_0x34047c,null))[_0xe8d0('0x41')](handleError(_0x34047c,null));}; \ No newline at end of file +var _0x55ca=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','key','filter','merge','include','catch','show','params','includeAll','options','create','body','find','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','name','send','index','FaxApplication','rawAttributes'];(function(_0x4de651,_0x427474){var _0x2db258=function(_0x4f0c22){while(--_0x4f0c22){_0x4de651['push'](_0x4de651['shift']());}};_0x2db258(++_0x427474);}(_0x55ca,0x126));var _0xa55c=function(_0x294726,_0x5db9e9){_0x294726=_0x294726-0x0;var _0x39e2e3=_0x55ca[_0x294726];return _0x39e2e3;};'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 hardwareService=require(_0xa55c('0x10'));var logger=require(_0xa55c('0x11'))(_0xa55c('0x12'));var utils=require(_0xa55c('0x13'));var config=require(_0xa55c('0x14'));var db=require(_0xa55c('0x15'))['db'];function respondWithStatusCode(_0x3998f7,_0x15eec8){_0x15eec8=_0x15eec8||0xcc;return function(_0x5d47ff){if(_0x5d47ff){return _0x3998f7['sendStatus'](_0x15eec8);}return _0x3998f7[_0xa55c('0x16')](_0x15eec8)['end']();};}function respondWithResult(_0x5a3672,_0x59ea8d){_0x59ea8d=_0x59ea8d||0xc8;return function(_0x18ee85){if(_0x18ee85){return _0x5a3672[_0xa55c('0x16')](_0x59ea8d)[_0xa55c('0x17')](_0x18ee85);}};}function respondWithFilteredResult(_0x938bd6,_0x458480){return function(_0x247e77){if(_0x247e77){var _0x4e0b2f=_0x247e77[_0xa55c('0x18')],_0x3ccf65=_0x458480[_0xa55c('0x19')],_0x3dcf4f=_0x458480[_0xa55c('0x19')]+_0x458480[_0xa55c('0x1a')],_0x25934f;if(_0x3dcf4f>=_0x4e0b2f){_0x3dcf4f=_0x4e0b2f;_0x25934f=0xc8;}else{_0x25934f=0xce;}_0x938bd6[_0xa55c('0x16')](_0x25934f);return _0x938bd6[_0xa55c('0x1b')]('Content-Range',_0x3ccf65+'-'+_0x3dcf4f+'/'+_0x4e0b2f)[_0xa55c('0x17')](_0x247e77);}return null;};}function patchUpdates(_0x104a99){return function(_0x461284){try{jsonpatch[_0xa55c('0x1c')](_0x461284,_0x104a99,!![]);}catch(_0x23a1ae){return BPromise[_0xa55c('0x1d')](_0x23a1ae);}return _0x461284['save']();};}function saveUpdates(_0x5f5158,_0xd643cc){return function(_0x3776ac){if(_0x3776ac){return _0x3776ac[_0xa55c('0x1e')](_0x5f5158)['then'](function(_0x383d92){return _0x383d92;});}return null;};}function removeEntity(_0x2fcb90,_0x54945a){return function(_0x187a87){if(_0x187a87){return _0x187a87[_0xa55c('0x1f')]()[_0xa55c('0x20')](function(){_0x2fcb90[_0xa55c('0x16')](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x49ed04,_0x1fc828){return function(_0x504c24){if(!_0x504c24){_0x49ed04['sendStatus'](0x194);}return _0x504c24;};}function handleError(_0x59d89a,_0x19ae88){_0x19ae88=_0x19ae88||0x1f4;return function(_0x54b038){logger[_0xa55c('0x22')](_0x54b038[_0xa55c('0x23')]);if(_0x54b038[_0xa55c('0x24')]){delete _0x54b038[_0xa55c('0x24')];}_0x59d89a[_0xa55c('0x16')](_0x19ae88)[_0xa55c('0x25')](_0x54b038);};}exports[_0xa55c('0x26')]=function(_0x11e7f7,_0x192df2){var _0x3cd152={},_0x1273d7={},_0x57f271={'count':0x0,'rows':[]};var _0x430d55=db[_0xa55c('0x27')][_0xa55c('0x28')];_0x1273d7[_0xa55c('0x29')]=_['keys'](_0x430d55);_0x1273d7[_0xa55c('0x2a')]=_[_0xa55c('0x2b')](_0x11e7f7[_0xa55c('0x2a')]);_0x1273d7[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_0x1273d7[_0xa55c('0x29')],_0x1273d7['query']);_0x3cd152[_0xa55c('0x2e')]=_['intersection'](_0x1273d7[_0xa55c('0x29')],qs[_0xa55c('0x2f')](_0x11e7f7[_0xa55c('0x2a')][_0xa55c('0x2f')]));_0x3cd152['attributes']=_0x3cd152[_0xa55c('0x2e')][_0xa55c('0x30')]?_0x3cd152[_0xa55c('0x2e')]:_0x1273d7[_0xa55c('0x29')];if(!_0x11e7f7[_0xa55c('0x2a')][_0xa55c('0x31')](_0xa55c('0x32'))){_0x3cd152[_0xa55c('0x1a')]=qs[_0xa55c('0x1a')](_0x11e7f7[_0xa55c('0x2a')][_0xa55c('0x1a')]);_0x3cd152['offset']=qs['offset'](_0x11e7f7[_0xa55c('0x2a')][_0xa55c('0x19')]);}_0x3cd152['order']=qs[_0xa55c('0x33')](_0x11e7f7[_0xa55c('0x2a')][_0xa55c('0x33')]);_0x3cd152[_0xa55c('0x34')]=qs[_0xa55c('0x2c')](_[_0xa55c('0x35')](_0x11e7f7[_0xa55c('0x2a')],_0x1273d7[_0xa55c('0x2c')]));if(_0x11e7f7[_0xa55c('0x2a')]['filter']){_0x3cd152['where']=_['merge'](_0x3cd152[_0xa55c('0x34')],{'$or':_[_0xa55c('0x36')](_0x430d55,function(_0x2bb4f0){if(_0x2bb4f0['type'][_0xa55c('0x37')]!=='VIRTUAL'){var _0x119220={};_0x119220[_0x2bb4f0['field']]={'$like':'%'+_0x11e7f7[_0xa55c('0x2a')][_0xa55c('0x38')]+'%'};return _0x119220;}})});}_0x3cd152=_[_0xa55c('0x39')]({},_0x3cd152,_0x11e7f7['options']);var _0x7c4a47={'where':_0x3cd152[_0xa55c('0x34')]};return db['FaxApplication'][_0xa55c('0x18')](_0x7c4a47)[_0xa55c('0x20')](function(_0x4d9083){_0x57f271['count']=_0x4d9083;if(_0x11e7f7[_0xa55c('0x2a')]['includeAll']){_0x3cd152[_0xa55c('0x3a')]=[{'all':!![]}];}return db[_0xa55c('0x27')]['findAll'](_0x3cd152);})['then'](function(_0x5e50b6){_0x57f271['rows']=_0x5e50b6;return _0x57f271;})[_0xa55c('0x20')](respondWithFilteredResult(_0x192df2,_0x3cd152))[_0xa55c('0x3b')](handleError(_0x192df2,null));};exports[_0xa55c('0x3c')]=function(_0x99c4f8,_0x2d8cbf){var _0x56d17c={'raw':!![],'where':{'id':_0x99c4f8[_0xa55c('0x3d')]['id']}},_0x3d52d8={};_0x3d52d8[_0xa55c('0x29')]=_[_0xa55c('0x2b')](db[_0xa55c('0x27')][_0xa55c('0x28')]);_0x3d52d8['query']=_[_0xa55c('0x2b')](_0x99c4f8['query']);_0x3d52d8['filters']=_[_0xa55c('0x2d')](_0x3d52d8[_0xa55c('0x29')],_0x3d52d8['query']);_0x56d17c[_0xa55c('0x2e')]=_['intersection'](_0x3d52d8['model'],qs[_0xa55c('0x2f')](_0x99c4f8[_0xa55c('0x2a')][_0xa55c('0x2f')]));_0x56d17c['attributes']=_0x56d17c[_0xa55c('0x2e')][_0xa55c('0x30')]?_0x56d17c['attributes']:_0x3d52d8[_0xa55c('0x29')];if(_0x99c4f8['query'][_0xa55c('0x3e')]){_0x56d17c[_0xa55c('0x3a')]=[{'all':!![]}];}_0x56d17c=_['merge']({},_0x56d17c,_0x99c4f8[_0xa55c('0x3f')]);return db[_0xa55c('0x27')]['find'](_0x56d17c)[_0xa55c('0x20')](handleEntityNotFound(_0x2d8cbf,null))[_0xa55c('0x20')](respondWithResult(_0x2d8cbf,null))[_0xa55c('0x3b')](handleError(_0x2d8cbf,null));};exports['create']=function(_0x334f52,_0x582901){return db[_0xa55c('0x27')][_0xa55c('0x40')](_0x334f52[_0xa55c('0x41')],{})['then'](respondWithResult(_0x582901,0xc9))[_0xa55c('0x3b')](handleError(_0x582901,null));};exports[_0xa55c('0x1e')]=function(_0x592429,_0x3d19f5){if(_0x592429[_0xa55c('0x41')]['id']){delete _0x592429['body']['id'];}return db[_0xa55c('0x27')][_0xa55c('0x42')]({'where':{'id':_0x592429['params']['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x3d19f5,null))[_0xa55c('0x20')](saveUpdates(_0x592429[_0xa55c('0x41')],null))[_0xa55c('0x20')](respondWithResult(_0x3d19f5,null))['catch'](handleError(_0x3d19f5,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x27')][_0xa55c('0x42')]({'where':{'id':_0x58a7ea['params']['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](removeEntity(_0x2157d6,null))['catch'](handleError(_0x2157d6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b59f0b2..f272c7e 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 _0xaba6=['utf8mb4','lodash','util','request-promise','path','../../config/environment','./faxApplication.attributes','define','fax_applications'];(function(_0x2a03fb,_0x392cf0){var _0xe23717=function(_0x580af7){while(--_0x580af7){_0x2a03fb['push'](_0x2a03fb['shift']());}};_0xe23717(++_0x392cf0);}(_0xaba6,0xe2));var _0x6aba=function(_0x2ab276,_0x2fc401){_0x2ab276=_0x2ab276-0x0;var _0x46dfb1=_0xaba6[_0x2ab276];return _0x46dfb1;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6aba('0x2'));var fs=require('fs');var path=require(_0x6aba('0x3'));var rimraf=require('rimraf');var config=require(_0x6aba('0x4'));var attributes=require(_0x6aba('0x5'));module['exports']=function(_0x4e929a,_0x5ae14c){return _0x4e929a[_0x6aba('0x6')]('FaxApplication',attributes,{'tableName':_0x6aba('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6aba('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5292=['rimraf','./faxApplication.attributes','define','FaxApplication','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path'];(function(_0x451dc8,_0x9d6a94){var _0x104d6f=function(_0x225b8f){while(--_0x225b8f){_0x451dc8['push'](_0x451dc8['shift']());}};_0x104d6f(++_0x9d6a94);}(_0x5292,0xf7));var _0x2529=function(_0x241de8,_0x24c165){_0x241de8=_0x241de8-0x0;var _0x19fb75=_0x5292[_0x241de8];return _0x19fb75;};'use strict';var _=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var logger=require('../../config/logger')(_0x2529('0x2'));var moment=require('moment');var BPromise=require(_0x2529('0x3'));var rp=require(_0x2529('0x4'));var fs=require('fs');var path=require(_0x2529('0x5'));var rimraf=require(_0x2529('0x6'));var config=require('../../config/environment');var attributes=require(_0x2529('0x7'));module['exports']=function(_0x4c9b4c,_0x4e7a9e){return _0x4c9b4c[_0x2529('0x8')](_0x2529('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2529('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e04e322..d7a8bdb 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 _0xb1f4=['error','code','message','catch','UpdateFaxApplication','body','options','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x13ebfc,_0x4313a6){var _0x3f069e=function(_0x41f472){while(--_0x41f472){_0x13ebfc['push'](_0x13ebfc['shift']());}};_0x3f069e(++_0x4313a6);}(_0xb1f4,0x159));var _0x4b1f=function(_0xeaac87,_0x3c8c32){_0xeaac87=_0xeaac87-0x0;var _0x4f8794=_0xb1f4[_0xeaac87];return _0x4f8794;};'use strict';var _=require(_0x4b1f('0x0'));var util=require(_0x4b1f('0x1'));var moment=require(_0x4b1f('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b1f('0x4'))['db'];var utils=require(_0x4b1f('0x5'));var logger=require(_0x4b1f('0x6'))(_0x4b1f('0x7'));var config=require(_0x4b1f('0x8'));var jayson=require(_0x4b1f('0x9'));var client=jayson[_0x4b1f('0xa')][_0x4b1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ad720,_0x48f2fb,_0x24bbfc){return new BPromise(function(_0x6360b8,_0x719dcc){return client[_0x4b1f('0xc')](_0x4ad720,_0x24bbfc)[_0x4b1f('0xd')](function(_0x2f471d){logger[_0x4b1f('0xe')](_0x4b1f('0xf'),_0x48f2fb,'request\x20sent');logger[_0x4b1f('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x48f2fb,_0x4b1f('0x11'),JSON[_0x4b1f('0x12')](_0x2f471d));if(_0x2f471d[_0x4b1f('0x13')]){if(_0x2f471d['error'][_0x4b1f('0x14')]===0x1f4){logger[_0x4b1f('0x13')](_0x4b1f('0xf'),_0x48f2fb,_0x2f471d[_0x4b1f('0x13')][_0x4b1f('0x15')]);return _0x719dcc(_0x2f471d['error'][_0x4b1f('0x15')]);}logger[_0x4b1f('0x13')](_0x4b1f('0xf'),_0x48f2fb,_0x2f471d[_0x4b1f('0x13')][_0x4b1f('0x15')]);return _0x6360b8(_0x2f471d[_0x4b1f('0x13')][_0x4b1f('0x15')]);}else{logger[_0x4b1f('0xe')](_0x4b1f('0xf'),_0x48f2fb,_0x4b1f('0x11'));_0x6360b8(_0x2f471d['result'][_0x4b1f('0x15')]);}})[_0x4b1f('0x16')](function(_0x87dd61){logger['error'](_0x4b1f('0xf'),_0x48f2fb,_0x87dd61);_0x719dcc(_0x87dd61);});});}exports[_0x4b1f('0x17')]=function(_0x5e5ae5){var _0x5d5109=this;return new Promise(function(_0x2837c5,_0xa51311){return db['FaxApplication']['update'](_0x5e5ae5[_0x4b1f('0x18')],{'raw':_0x5e5ae5[_0x4b1f('0x19')]?_0x5e5ae5[_0x4b1f('0x19')][_0x4b1f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e5ae5[_0x4b1f('0x19')]?_0x5e5ae5[_0x4b1f('0x19')][_0x4b1f('0x1b')]||null:null,'attributes':_0x5e5ae5['options']?_0x5e5ae5[_0x4b1f('0x19')]['attributes']||null:null,'limit':_0x5e5ae5[_0x4b1f('0x19')]?_0x5e5ae5[_0x4b1f('0x19')]['limit']||null:null})[_0x4b1f('0xd')](function(_0x7bd994){logger['info'](_0x4b1f('0x17'),_0x5e5ae5);logger[_0x4b1f('0x10')](_0x4b1f('0x17'),_0x5e5ae5,JSON[_0x4b1f('0x12')](_0x7bd994));_0x2837c5(_0x7bd994);})[_0x4b1f('0x16')](function(_0x3202a9){logger['error']('UpdateFaxApplication',_0x3202a9[_0x4b1f('0x15')],_0x5e5ae5);_0xa51311(_0x5d5109['error'](0x1f4,_0x3202a9[_0x4b1f('0x15')]));});});}; \ No newline at end of file +var _0x831e=['then','info','FaxApplication,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','UpdateFaxApplication','FaxApplication','body','options','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3c33f1,_0x2060d8){var _0x258376=function(_0x1c7160){while(--_0x1c7160){_0x3c33f1['push'](_0x3c33f1['shift']());}};_0x258376(++_0x2060d8);}(_0x831e,0x80));var _0xe831=function(_0x403bcf,_0x47bcd5){_0x403bcf=_0x403bcf-0x0;var _0x53436c=_0x831e[_0x403bcf];return _0x53436c;};'use strict';var _=require(_0xe831('0x0'));var util=require(_0xe831('0x1'));var moment=require('moment');var BPromise=require(_0xe831('0x2'));var rs=require(_0xe831('0x3'));var fs=require('fs');var Redis=require(_0xe831('0x4'));var db=require(_0xe831('0x5'))['db'];var utils=require(_0xe831('0x6'));var logger=require(_0xe831('0x7'))(_0xe831('0x8'));var config=require(_0xe831('0x9'));var jayson=require(_0xe831('0xa'));var client=jayson['client'][_0xe831('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x479add,_0x2b1496,_0x42ca64){return new BPromise(function(_0x1e32d2,_0x4515fa){return client['request'](_0x479add,_0x42ca64)[_0xe831('0xc')](function(_0x50608b){logger[_0xe831('0xd')](_0xe831('0xe'),_0x2b1496,'request\x20sent');logger[_0xe831('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2b1496,'request\x20sent',JSON[_0xe831('0x10')](_0x50608b));if(_0x50608b['error']){if(_0x50608b[_0xe831('0x11')][_0xe831('0x12')]===0x1f4){logger[_0xe831('0x11')](_0xe831('0xe'),_0x2b1496,_0x50608b[_0xe831('0x11')][_0xe831('0x13')]);return _0x4515fa(_0x50608b[_0xe831('0x11')][_0xe831('0x13')]);}logger[_0xe831('0x11')](_0xe831('0xe'),_0x2b1496,_0x50608b[_0xe831('0x11')][_0xe831('0x13')]);return _0x1e32d2(_0x50608b['error'][_0xe831('0x13')]);}else{logger[_0xe831('0xd')](_0xe831('0xe'),_0x2b1496,_0xe831('0x14'));_0x1e32d2(_0x50608b[_0xe831('0x15')][_0xe831('0x13')]);}})['catch'](function(_0x2c079c){logger[_0xe831('0x11')](_0xe831('0xe'),_0x2b1496,_0x2c079c);_0x4515fa(_0x2c079c);});});}exports[_0xe831('0x16')]=function(_0x389e7e){var _0x42fd51=this;return new Promise(function(_0x4bc285,_0x157902){return db[_0xe831('0x17')]['update'](_0x389e7e[_0xe831('0x18')],{'raw':_0x389e7e[_0xe831('0x19')]?_0x389e7e[_0xe831('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389e7e[_0xe831('0x19')]?_0x389e7e[_0xe831('0x19')]['where']||null:null,'attributes':_0x389e7e[_0xe831('0x19')]?_0x389e7e[_0xe831('0x19')][_0xe831('0x1a')]||null:null,'limit':_0x389e7e[_0xe831('0x19')]?_0x389e7e[_0xe831('0x19')][_0xe831('0x1b')]||null:null})[_0xe831('0xc')](function(_0x27ae04){logger[_0xe831('0xd')]('UpdateFaxApplication',_0x389e7e);logger[_0xe831('0xf')]('UpdateFaxApplication',_0x389e7e,JSON[_0xe831('0x10')](_0x27ae04));_0x4bc285(_0x27ae04);})['catch'](function(_0x42f1cb){logger[_0xe831('0x11')](_0xe831('0x16'),_0x42f1cb[_0xe831('0x13')],_0x389e7e);_0x157902(_0x42fd51['error'](0x1f4,_0x42f1cb[_0xe831('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1da9a98..dd678a0 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 _0x28f2=['put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x431d00,_0x3b06b2){var _0x27db08=function(_0x360085){while(--_0x360085){_0x431d00['push'](_0x431d00['shift']());}};_0x27db08(++_0x3b06b2);}(_0x28f2,0x193));var _0x228f=function(_0x2d5788,_0x1f0c2e){_0x2d5788=_0x2d5788-0x0;var _0x3966ba=_0x28f2[_0x2d5788];return _0x3966ba;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var auth=require(_0x228f('0x5'));var interaction=require(_0x228f('0x6'));var config=require(_0x228f('0x7'));var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router['get'](_0x228f('0xc'),auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0xe')]('/',auth[_0x228f('0xa')](),controller['create']);router[_0x228f('0xf')]('/:id',auth[_0x228f('0xa')](),controller[_0x228f('0x10')]);router['delete'](_0x228f('0xc'),auth[_0x228f('0xa')](),controller[_0x228f('0x11')]);module[_0x228f('0x12')]=router; \ No newline at end of file +var _0x955f=['path','connect-timeout','express','../../components/auth/service','./faxApplication.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x955f,0x1eb));var _0xf955=function(_0x3d2cec,_0x48b255){_0x3d2cec=_0x3d2cec-0x0;var _0x310e9a=_0x955f[_0x3d2cec];return _0x310e9a;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var auth=require(_0xf955('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf955('0x6'));router['get']('/',auth[_0xf955('0x7')](),controller[_0xf955('0x8')]);router[_0xf955('0x9')]('/:id',auth[_0xf955('0x7')](),controller[_0xf955('0xa')]);router['post']('/',auth[_0xf955('0x7')](),controller[_0xf955('0xb')]);router[_0xf955('0xc')](_0xf955('0xd'),auth[_0xf955('0x7')](),controller[_0xf955('0xe')]);router[_0xf955('0xf')]('/:id',auth[_0xf955('0x7')](),controller['destroy']);module[_0xf955('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b323895..422e131 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 _0x8453=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x8453,0xa4));var _0x3845=function(_0x1f4950,_0x4ce163){_0x1f4950=_0x1f4950-0x0;var _0x12659a=_0x8453[_0x1f4950];return _0x12659a;};'use strict';var Sequelize=require(_0x3845('0x0'));module[_0x3845('0x1')]={'closed':{'type':Sequelize[_0x3845('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3845('0x3')]},'disposition':{'type':Sequelize[_0x3845('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3845('0x3')]},'fax':{'type':Sequelize[_0x3845('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3845('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3845('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3845('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x732f=['ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x2b9c45,_0x1213ea){var _0x5d1c83=function(_0x51db2a){while(--_0x51db2a){_0x2b9c45['push'](_0x2b9c45['shift']());}};_0x5d1c83(++_0x1213ea);}(_0x732f,0xb0));var _0xf732=function(_0x55b087,_0x2e94fa){_0x55b087=_0x55b087-0x0;var _0x583d66=_0x732f[_0x55b087];return _0x583d66;};'use strict';var Sequelize=require(_0xf732('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf732('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf732('0x2')]},'disposition':{'type':Sequelize[_0xf732('0x3')]},'note':{'type':Sequelize[_0xf732('0x3')]},'read1stAt':{'type':Sequelize[_0xf732('0x2')]},'fax':{'type':Sequelize[_0xf732('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf732('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf732('0x4')]('in',_0xf732('0x5')),'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 7a6b64a..212470a 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 _0x6601=['having','`Messages.count`\x20=\x200','%s\x20>\x200','toString','`Messages.count`\x20>\x200','tag','tools_tags','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','sequelize','keyBy','a.key','Account.key','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','it.FaxInteractionId\x20=\x20i.id','groupBy','FaxInteractionId','rows','show','params','intersection','includeAll','include','merge','find','create','body','describe','FaxMessage','omit','ids','filters','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','Tag','findAll','removeTags','download','unix','join','root','files','attachments','server','interaction-%s.zip','getMessages','Attachment','basename','createReadStream','pipe','createWriteStream','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','closed','unreadMessages','map','TagIds','split','forEach','Tags','push','catch','index','FaxInteraction','rawAttributes','keys','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','select','color','from','field','COUNT(*)','fax_messages','me.FaxInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','expr','advancedFilter','value','dateStart','startOf','day','format','utc','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','TagId','Messages.count','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','c.firstName','\x20LIKE\x20?','c.email','\x20>\x20?','\x20<\x20?','c.lastName','filter','isNil','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','replace','\x27\x27\x27\x27','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','read','%s\x20=\x200'];(function(_0x481ef5,_0x570d11){var _0x3f1dd7=function(_0x29d082){while(--_0x29d082){_0x481ef5['push'](_0x481ef5['shift']());}};_0x3f1dd7(++_0x570d11);}(_0x6601,0x100));var _0x1660=function(_0x357eb2,_0x142dbd){_0x357eb2=_0x357eb2-0x0;var _0x4a6cb0=_0x6601[_0x357eb2];return _0x4a6cb0;};'use strict';var pdf=require(_0x1660('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1660('0x1'));var moment=require(_0x1660('0x2'));var BPromise=require(_0x1660('0x3'));var Mustache=require(_0x1660('0x4'));var util=require(_0x1660('0x5'));var path=require(_0x1660('0x6'));var sox=require(_0x1660('0x7'));var csv=require(_0x1660('0x8'));var ejs=require(_0x1660('0x9'));var fs=require('fs');var _=require(_0x1660('0xa'));var squel=require('squel');var crypto=require(_0x1660('0xb'));var jsforce=require(_0x1660('0xc'));var deskjs=require(_0x1660('0xd'));var toCsv=require(_0x1660('0x8'));var querystring=require(_0x1660('0xe'));var Papa=require('papaparse');var Redis=require(_0x1660('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1660('0x10'))(_0x1660('0x11'));var utils=require(_0x1660('0x12'));var config=require(_0x1660('0x13'));var db=require(_0x1660('0x14'))['db'];config['redis']=_[_0x1660('0x15')](config[_0x1660('0x16')],{'host':_0x1660('0x17'),'port':0x18eb});var socket=require(_0x1660('0x18'))(new Redis(config['redis']));require(_0x1660('0x19'))['register'](socket);function respondWithStatusCode(_0x1fc044,_0xabeed2){_0xabeed2=_0xabeed2||0xcc;return function(_0x455af2){if(_0x455af2){return _0x1fc044[_0x1660('0x1a')](_0xabeed2);}return _0x1fc044['status'](_0xabeed2)['end']();};}function respondWithResult(_0x523da4,_0x2f25b9){_0x2f25b9=_0x2f25b9||0xc8;return function(_0x2436bb){if(_0x2436bb){return _0x523da4[_0x1660('0x1b')](_0x2f25b9)[_0x1660('0x1c')](_0x2436bb);}};}function respondWithFilteredResult(_0x2b89b8,_0x144f26){return function(_0x3d5a7f){if(_0x3d5a7f){var _0x3d6db9=_0x3d5a7f[_0x1660('0x1d')],_0x190fbd=_0x144f26[_0x1660('0x1e')],_0x2504de=_0x144f26['offset']+_0x144f26[_0x1660('0x1f')],_0x33c035;if(_0x2504de>=_0x3d6db9){_0x2504de=_0x3d6db9;_0x33c035=0xc8;}else{_0x33c035=0xce;}_0x2b89b8[_0x1660('0x1b')](_0x33c035);return _0x2b89b8['set'](_0x1660('0x20'),_0x190fbd+'-'+_0x2504de+'/'+_0x3d6db9)[_0x1660('0x1c')](_0x3d5a7f);}return null;};}function patchUpdates(_0x462308){return function(_0x2c53ed){try{jsonpatch[_0x1660('0x21')](_0x2c53ed,_0x462308,!![]);}catch(_0x3ed9ce){return BPromise[_0x1660('0x22')](_0x3ed9ce);}return _0x2c53ed['save']();};}function saveUpdates(_0x484218,_0x1a7575){return function(_0xec9236){if(_0xec9236){return _0xec9236[_0x1660('0x23')](_0x484218)[_0x1660('0x24')](function(_0x944e2b){return _0x944e2b;});}return null;};}function removeEntity(_0x2b3a39,_0x3cdb72){return function(_0x10db0e){if(_0x10db0e){return _0x10db0e[_0x1660('0x25')]()[_0x1660('0x24')](function(){_0x2b3a39[_0x1660('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14eeeb,_0x17eeaf){return function(_0x417c4e){if(!_0x417c4e){_0x14eeeb['sendStatus'](0x194);}return _0x417c4e;};}function handleError(_0x546630,_0x322ee9){_0x322ee9=_0x322ee9||0x1f4;return function(_0x351843){logger[_0x1660('0x26')](_0x351843[_0x1660('0x27')]);if(_0x351843[_0x1660('0x28')]){delete _0x351843['name'];}_0x546630[_0x1660('0x1b')](_0x322ee9)[_0x1660('0x29')](_0x351843);};}function getInteractionUnreadMessages(_0x410be6){return new BPromise(function(_0x129272,_0x458452){try{if(_0x410be6[_0x1660('0x2a')]){_0x410be6['unreadMessages']=0x0;_0x129272(_0x410be6);}else{return db['FaxMessage'][_0x1660('0x1d')]({'where':{'FaxInteractionId':_0x410be6['id'],'direction':'in','read':![]}})[_0x1660('0x24')](function(_0x1b023a){_0x410be6[_0x1660('0x2b')]=_0x1b023a;_0x129272(_0x410be6);});}}catch(_0x40f6f7){_0x458452(_0x40f6f7);}});}function getInteractionUsers(_0x778625,_0x52c7ef){return new BPromise(function(_0x125411,_0x4bc0e5){try{if(_0x52c7ef[_0x778625['id']]){_0x778625['Users']=_[_0x1660('0x2c')](_0x52c7ef[_0x778625['id']],function(_0x5d151f){return{'id':_0x5d151f['id']};});}}catch(_0xd6df40){_0x4bc0e5(_0xd6df40);}_0x125411(_0x778625);});}function getInteractionTags(_0x548b23,_0x4cef36){return new BPromise(function(_0x3f19cc,_0x4a3d3c){try{if(_0x548b23[_0x1660('0x2d')]){_0x548b23['Tags']=[];_0x548b23[_0x1660('0x2d')][_0x1660('0x2e')](',')[_0x1660('0x2f')](function(_0xe35141){_0x548b23[_0x1660('0x30')][_0x1660('0x31')](_0x4cef36[_0xe35141]);});}delete _0x548b23[_0x1660('0x2d')];}catch(_0x5f3e40){_0x4a3d3c(_0x5f3e40);}_0x3f19cc(_0x548b23);});}function updateFaxInteraction(_0x477a86,_0x20d6b2,_0xed384f){return new BPromise(function(_0x4ed909,_0x5e3c4b){return getInteractionUnreadMessages(_0x477a86)[_0x1660('0x24')](function(_0x4d2222){return getInteractionUsers(_0x4d2222,_0xed384f);})[_0x1660('0x24')](function(_0x348d7e){return getInteractionTags(_0x348d7e,_0x20d6b2);})[_0x1660('0x24')](function(_0x166471){_0x4ed909(_0x166471);})[_0x1660('0x32')](function(_0x21883d){_0x5e3c4b(_0x21883d);});});}exports[_0x1660('0x33')]=function(_0x358dbd,_0x1b3f7c){var _0x5d6622={},_0x5604d4={},_0x5639e7={'count':0x0,'rows':[]};var _0x9a5f03=db[_0x1660('0x34')][_0x1660('0x35')];_0x5604d4['model']=_[_0x1660('0x36')](_0x9a5f03);_0x5604d4[_0x1660('0x37')]=_[_0x1660('0x36')](_0x358dbd[_0x1660('0x37')]);_0x5604d4['filters']=_['intersection'](_0x5604d4['model'],_0x5604d4[_0x1660('0x37')]);_0x5d6622[_0x1660('0x38')]=_['intersection'](_0x5604d4[_0x1660('0x39')],qs['fields'](_0x358dbd['query'][_0x1660('0x3a')]));_0x5d6622[_0x1660('0x38')]=_0x5d6622[_0x1660('0x38')][_0x1660('0x3b')]?_0x5d6622[_0x1660('0x38')]:_0x5604d4[_0x1660('0x39')];if(!_0x358dbd[_0x1660('0x37')][_0x1660('0x3c')]('nolimit')){_0x5d6622[_0x1660('0x1f')]=qs[_0x1660('0x1f')](_0x358dbd['query'][_0x1660('0x1f')]);_0x5d6622[_0x1660('0x1e')]=qs['offset'](_0x358dbd[_0x1660('0x37')]['offset']);}_0x5d6622[_0x1660('0x3d')]=qs[_0x1660('0x3e')](_0x358dbd['query'][_0x1660('0x3e')]);_0x5d6622[_0x1660('0x3f')]=qs['filters'](_[_0x1660('0x40')](_0x358dbd[_0x1660('0x37')],_0x5604d4['filters']));var _0xeb5495=[];var _0x4b12bc=squel[_0x1660('0x41')]()['field']('id')['field'](_0x1660('0x28'))['field'](_0x1660('0x42'))[_0x1660('0x43')]('tools_tags');var _0x3a99f9=squel['select']()[_0x1660('0x44')](_0x1660('0x45'))['from'](_0x1660('0x46'),'me')['where'](_0x1660('0x47'))[_0x1660('0x3f')](_0x1660('0x48'))['where'](_0x1660('0x49'));var _0x5b31cd=squel['select']()[_0x1660('0x44')](_0x1660('0x4a'))[_0x1660('0x44')](_0x1660('0x4b'))[_0x1660('0x43')]('user_has_fax_interactions','ui')[_0x1660('0x4c')]('users','u',_0x1660('0x4d'));var _0x2906e7=squel['select']()[_0x1660('0x43')](_0x1660('0x4e'),'i')[_0x1660('0x4c')]('cm_contacts','c',_0x1660('0x4f'))['left_join'](_0x1660('0x50'),'o',_0x1660('0x51'))[_0x1660('0x4c')](_0x1660('0x52'),'a',_0x1660('0x53'))['left_join'](_0x1660('0x46'),'me',_0x1660('0x47'));var _0x3a8351=squel[_0x1660('0x54')]();if(_0x358dbd[_0x1660('0x37')][_0x1660('0x55')]){var _0x37513b=JSON['parse'](_0x358dbd['query'][_0x1660('0x55')]);_[_0x1660('0x36')](_0x37513b)[_0x1660('0x2f')](function(_0x3cc3f7){var _0x5313c4=_0x37513b[_0x3cc3f7];if(_0x3cc3f7==='createdAt'){var _0x23343e=moment(_0x5313c4[_0x1660('0x56')][_0x1660('0x57')])[_0x1660('0x58')](_0x1660('0x59'))['utc']()[_0x1660('0x5a')]();var _0x4a44a3=moment(_0x4a44a3)[_0x1660('0x5b')]()['endOf'](_0x1660('0x59'))[_0x1660('0x5a')]();_0x3a8351[_0x1660('0x5c')](_0x1660('0x5d'),_0x23343e,_0x4a44a3);}else{if(_[_0x1660('0x5e')](_0x5313c4[_0x1660('0x5f')])){_0x5313c4[_0x1660('0x5f')][_0x1660('0x2f')](function(_0x137aa3){switch(_0x5313c4[_0x1660('0x5f')][_0x1660('0x56')]){case'IS':if(_0x3cc3f7!==_0x1660('0x60')&&_0x3cc3f7!==_0x1660('0x61')){if(_[_0x1660('0x5e')](_0x5313c4[_0x1660('0x56')])&&_0x5313c4[_0x1660('0x56')]['length']>0x1){_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x63'),_0x5313c4['value']);}else{_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x64'),_0x5313c4[_0x1660('0x56')][0x0]);}}break;case'=':_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x64'),_0x5313c4[_0x1660('0x56')]);break;case _0x1660('0x65'):if(_0x3cc3f7==='ContactId'){_0x3a8351[_0x1660('0x5c')](_0x1660('0x66')+_0x1660('0x67'),'%'+_0x5313c4[_0x1660('0x56')]+'%');_0x3a8351['or']('c.lastName'+_0x1660('0x67'),'%'+_0x5313c4[_0x1660('0x56')]+'%');_0x3a8351['or'](_0x1660('0x68')+_0x1660('0x67'),'%'+_0x5313c4[_0x1660('0x56')]+'%');}else{_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x67'),'%'+_0x5313c4[_0x1660('0x56')]+'%');}break;case'>':_0x3a8351['and'](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x69'),_0x5313c4[_0x1660('0x56')]);break;case'<':_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x6a'),_0x5313c4['value']);break;}});}else{switch(_0x5313c4[_0x1660('0x5f')]['value']){case'IS':if(_0x3cc3f7!=='TagId'&&_0x3cc3f7!==_0x1660('0x61')){if(_[_0x1660('0x5e')](_0x5313c4[_0x1660('0x56')])&&_0x5313c4['value'][_0x1660('0x3b')]>0x1){_0x3a8351[_0x1660('0x5c')](_0x5313c4['tableAlias']+'.'+_0x3cc3f7+'\x20IN\x20?',_0x5313c4['value']);}else{_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+'\x20=\x20?',_0x5313c4[_0x1660('0x56')][0x0]);}}break;case'=':_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x64'),_0x5313c4[_0x1660('0x56')]);break;case'LIKE':if(_0x3cc3f7==='ContactId'){_0x3a8351[_0x1660('0x5c')]('c.firstName'+'\x20LIKE\x20?','%'+_0x5313c4[_0x1660('0x56')]+'%');_0x3a8351['or'](_0x1660('0x6b')+_0x1660('0x67'),'%'+_0x5313c4[_0x1660('0x56')]+'%');_0x3a8351['or']('c.email'+'\x20LIKE\x20?','%'+_0x5313c4[_0x1660('0x56')]+'%');}else{_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+'\x20LIKE\x20?','%'+_0x5313c4[_0x1660('0x56')]+'%');}break;case'>':_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+'\x20>\x20?',_0x5313c4['value']);break;case'<':_0x3a8351[_0x1660('0x5c')](_0x5313c4[_0x1660('0x62')]+'.'+_0x3cc3f7+_0x1660('0x6a'),_0x5313c4[_0x1660('0x56')]);break;}}}});}else{var _0x2b29df=_(Object['keys'](_0x358dbd[_0x1660('0x37')]))[_0x1660('0x2c')](function(_0x5b1c04){return _0x9a5f03[_0x1660('0x3c')](_0x5b1c04)?_0x5b1c04:undefined;})[_0x1660('0x6c')](function(_0x567b8f){return!_[_0x1660('0x6d')](_0x567b8f);})[_0x1660('0x56')]();if(!_['isEmpty'](_0x2b29df)){_0x2b29df['forEach'](function(_0x505dfc){if(_0x505dfc===_0x1660('0x6e')){_0x2906e7[_0x1660('0x3f')](_0x1660('0x6f'),[][_0x1660('0x70')](_0x358dbd[_0x1660('0x37')][_0x505dfc]));}else if(_0x505dfc===_0x1660('0x71')){var _0x412304=JSON['parse'](_0x358dbd['query'][_0x505dfc])[_0x1660('0x72')];var _0x7de7f3=JSON[_0x1660('0x73')](_0x358dbd[_0x1660('0x37')][_0x505dfc])[_0x1660('0x74')];_0x2906e7['where'](_0x1660('0x5d'),_0x412304,_0x7de7f3);}else{if(_0x358dbd[_0x1660('0x37')][_0x505dfc]===_0x1660('0x75')){_0x2906e7['where']('i.'+_0x505dfc+_0x1660('0x76'));}else{_0x2906e7[_0x1660('0x3f')]('i.'+_0x505dfc+_0x1660('0x64'),_0x358dbd[_0x1660('0x37')][_0x505dfc]);}}});}if(_0x358dbd['query']['filter']){var _0x1fe03e=_0x358dbd[_0x1660('0x37')]['filter'][_0x1660('0x77')]('\x5c','\x5c\x5c')[_0x1660('0x77')]('\x27\x27',_0x1660('0x78'));if(qs['isNumeric'](_0x1fe03e)){_0x3a8351['or']('i.id\x20LIKE\x20?',_0x1fe03e+'%')['or'](_0x1660('0x79'),_0x1fe03e+'%');}_0x3a8351['or'](_0x1660('0x7a'),_0x1fe03e+'%');}}_0x2906e7[_0x1660('0x3f')](_0x3a8351);if(_0x5d6622[_0x1660('0x3d')]){_0x5d6622[_0x1660('0x3d')][_0x1660('0x2f')](function(_0x46a937){_0x2906e7[_0x1660('0x3d')]('i.'+_0x46a937[0x0],_0x46a937[0x1]==='DESC'?![]:!![]);});}_0x2906e7[_0x1660('0x7b')]('i.id');var _0x1b0490={'type':db[_0x1660('0x7c')]['QueryTypes'][_0x1660('0x7d')],'raw':!![]};var _0x2cbc76=_0x2906e7['clone']()[_0x1660('0x44')]('COUNT(*)');if(!_0x358dbd['query'][_0x1660('0x55')]){if(_0x358dbd['query'][_0x1660('0x7e')]){if(_0x358dbd['query'][_0x1660('0x7e')]==0x1){_0x2cbc76[_0x1660('0x3f')](util['format'](_0x1660('0x7f'),_0x3a99f9['toString']()));_0x2906e7[_0x1660('0x80')](_0x1660('0x81'));}else{_0x2cbc76['where'](util[_0x1660('0x5a')](_0x1660('0x82'),_0x3a99f9[_0x1660('0x83')]()));_0x2906e7['having'](_0x1660('0x84'));}}if(_0x358dbd[_0x1660('0x37')]['tag']){var _0x280a77=_['isArray'](_0x358dbd[_0x1660('0x37')][_0x1660('0x85')])?_0x358dbd[_0x1660('0x37')][_0x1660('0x85')]:new Array(_0x358dbd['query'][_0x1660('0x85')]);var _0x5c06df=squel[_0x1660('0x54')]();_0x280a77['forEach'](function(_0x39cb22){_0x5c06df['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x39cb22+',%');});_0x2906e7[_0x1660('0x80')](_0x5c06df);_0x2cbc76[_0x1660('0x4c')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id');_0x2cbc76[_0x1660('0x4c')](_0x1660('0x86'),'t',_0x1660('0x87'));_0x2cbc76['where'](_0x1660('0x88'),_0x280a77);}}else{var _0x37513b=JSON[_0x1660('0x73')](_0x358dbd['query'][_0x1660('0x55')]);_['keys'](_0x37513b)['forEach'](function(_0x1f605e){var _0x3d3722=_0x37513b[_0x1f605e];if(_0x1f605e===_0x1660('0x60')){var _0x340ba3=_0x3d3722[_0x1660('0x56')];var _0x165cc9=squel[_0x1660('0x54')]();_0x340ba3['forEach'](function(_0x13da80){_0x165cc9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13da80+',%');});_0x2906e7[_0x1660('0x80')](_0x165cc9);_0x2cbc76[_0x1660('0x4c')](_0x1660('0x89'),'it',_0x1660('0x8a'));_0x2cbc76[_0x1660('0x4c')](_0x1660('0x86'),'t',_0x1660('0x87'));_0x2cbc76[_0x1660('0x3f')](_0x1660('0x88'),_0x340ba3);}else if(_0x1f605e===_0x1660('0x61')){if(_0x3d3722[_0x1660('0x56')]['length']===0x1){if(_0x3d3722[_0x1660('0x56')][0x0]===0x1){_0x2cbc76[_0x1660('0x3f')](util[_0x1660('0x5a')](_0x1660('0x7f'),_0x3a99f9[_0x1660('0x83')]()));_0x2906e7[_0x1660('0x80')](_0x1660('0x81'));}else{_0x2cbc76['where'](util[_0x1660('0x5a')](_0x1660('0x82'),_0x3a99f9[_0x1660('0x83')]()));_0x2906e7['having'](_0x1660('0x84'));}}}});}db['sequelize']['query'](_0x2cbc76['toString'](),_0x1b0490)[_0x1660('0x24')](function(_0x1a1a50){_0x5639e7['count']=_0x1a1a50[_0x1660('0x3b')];if(_0x5639e7['count']===0x0)return[];return db[_0x1660('0x8b')][_0x1660('0x37')](_0x4b12bc['toString'](),_0x1b0490)['then'](function(_0x5bd551){_0xeb5495=_[_0x1660('0x8c')](_0x5bd551,'id');_0x1b0490=_['merge'](_0x1b0490,{'model':db[_0x1660('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x2906e7[_0x1660('0x44')](_0x1660('0x8d'),_0x1660('0x8e'));_0x2906e7[_0x1660('0x44')](_0x1660('0x8f'));_0x2906e7[_0x1660('0x44')](_0x1660('0x66'),_0x1660('0x90'));_0x2906e7[_0x1660('0x44')](_0x1660('0x6b'),_0x1660('0x91'));_0x2906e7[_0x1660('0x44')](_0x1660('0x68'),_0x1660('0x92'));_0x2906e7['field']('c.phone',_0x1660('0x93'));_0x2906e7[_0x1660('0x44')](_0x1660('0x94'),'Contact.mobile');_0x2906e7[_0x1660('0x44')](_0x1660('0x95'),_0x1660('0x96'));_0x2906e7[_0x1660('0x44')](_0x1660('0x97'),_0x1660('0x2d'));_0x2906e7['left_join']('fax_interaction_has_tags','it',_0x1660('0x98'));_0x2906e7[_0x1660('0x4c')](_0x1660('0x86'),'t',_0x1660('0x87'));_0x2906e7['limit'](_0x5d6622['limit']);_0x2906e7[_0x1660('0x1e')](_0x5d6622[_0x1660('0x1e')]);return db[_0x1660('0x8b')][_0x1660('0x37')](_0x2906e7[_0x1660('0x83')](),_0x1b0490);})[_0x1660('0x24')](function(_0x49313e){_0x5b31cd[_0x1660('0x3f')]('ui.FaxInteractionId\x20IN\x20?',_[_0x1660('0x2c')](_0x49313e,'id'));return db[_0x1660('0x8b')][_0x1660('0x37')](_0x5b31cd['toString'](),_0x1b0490)[_0x1660('0x24')](function(_0x588486){var _0x4b62a2=_[_0x1660('0x99')](_0x588486,_0x1660('0x9a'));var _0x45a322=[];_0x49313e[_0x1660('0x2f')](function(_0x235730){_0x45a322[_0x1660('0x31')](updateFaxInteraction(_0x235730,_0xeb5495,_0x4b62a2));});return BPromise['all'](_0x45a322);});});})[_0x1660('0x24')](function(_0x5bbf86){_0x5639e7[_0x1660('0x9b')]=_0x5bbf86;return _0x5639e7;})[_0x1660('0x24')](respondWithFilteredResult(_0x1b3f7c,_0x5d6622))['catch'](handleError(_0x1b3f7c,null));};exports[_0x1660('0x9c')]=function(_0x2ba90c,_0x366f70){var _0xb6aa3f={'raw':![],'where':{'id':_0x2ba90c[_0x1660('0x9d')]['id']}},_0x4e82ea={};_0x4e82ea[_0x1660('0x39')]=_['keys'](db[_0x1660('0x34')]['rawAttributes']);_0x4e82ea['query']=_[_0x1660('0x36')](_0x2ba90c['query']);_0x4e82ea['filters']=_['intersection'](_0x4e82ea[_0x1660('0x39')],_0x4e82ea[_0x1660('0x37')]);_0xb6aa3f[_0x1660('0x38')]=_[_0x1660('0x9e')](_0x4e82ea[_0x1660('0x39')],qs[_0x1660('0x3a')](_0x2ba90c['query'][_0x1660('0x3a')]));_0xb6aa3f[_0x1660('0x38')]=_0xb6aa3f[_0x1660('0x38')]['length']?_0xb6aa3f[_0x1660('0x38')]:_0x4e82ea[_0x1660('0x39')];if(_0x2ba90c[_0x1660('0x37')][_0x1660('0x9f')]){_0xb6aa3f[_0x1660('0xa0')]=[{'all':!![]}];}_0xb6aa3f=_[_0x1660('0xa1')]({},_0xb6aa3f,_0x2ba90c['options']);return db[_0x1660('0x34')][_0x1660('0xa2')](_0xb6aa3f)[_0x1660('0x24')](handleEntityNotFound(_0x366f70,null))[_0x1660('0x24')](respondWithResult(_0x366f70,null))[_0x1660('0x32')](handleError(_0x366f70,null));};exports['create']=function(_0x2a5f6b,_0x109748){return db[_0x1660('0x34')][_0x1660('0xa3')](_0x2a5f6b['body'],{})[_0x1660('0x24')](respondWithResult(_0x109748,0xc9))[_0x1660('0x32')](handleError(_0x109748,null));};exports[_0x1660('0x23')]=function(_0x571478,_0x9b92ca){if(_0x571478[_0x1660('0xa4')]['id']){delete _0x571478[_0x1660('0xa4')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x571478[_0x1660('0x9d')]['id']}})['then'](handleEntityNotFound(_0x9b92ca,null))[_0x1660('0x24')](saveUpdates(_0x571478['body'],null))[_0x1660('0x24')](respondWithResult(_0x9b92ca,null))[_0x1660('0x32')](handleError(_0x9b92ca,null));};exports[_0x1660('0x25')]=function(_0x4e18ae,_0x3a99c7){return db[_0x1660('0x34')]['find']({'where':{'id':_0x4e18ae[_0x1660('0x9d')]['id']}})[_0x1660('0x24')](handleEntityNotFound(_0x3a99c7,null))[_0x1660('0x24')](removeEntity(_0x3a99c7,null))[_0x1660('0x32')](handleError(_0x3a99c7,null));};exports['describe']=function(_0x5c9252,_0xd3e508){return db[_0x1660('0x34')][_0x1660('0xa5')]()[_0x1660('0x24')](respondWithResult(_0xd3e508,null))[_0x1660('0x32')](handleError(_0xd3e508,null));};exports['addMessage']=function(_0x473f00,_0x19cf0e,_0x5926ec){return db[_0x1660('0xa6')][_0x1660('0xa2')]({'where':{'id':_0x473f00[_0x1660('0x9d')]['id']}})['then'](handleEntityNotFound(_0x19cf0e,null))[_0x1660('0x24')](function(_0x3ec50e){if(_0x3ec50e){return _0x3ec50e['addMessage'](_0x473f00['body']['ids'],_[_0x1660('0xa7')](_0x473f00[_0x1660('0xa4')],[_0x1660('0xa8'),'id'])||{});}})[_0x1660('0x24')](respondWithResult(_0x19cf0e,null))[_0x1660('0x32')](handleError(_0x19cf0e,null));};exports['getMessages']=function(_0x55c0f1,_0x5335eb,_0x48cb0c){var _0x12425a={'raw':![],'where':{}};var _0x92baa2={};var _0x1a2ab3={'count':0x0,'rows':[]};return db[_0x1660('0x34')]['findOne']({'where':{'id':_0x55c0f1['params']['id']}})['then'](handleEntityNotFound(_0x5335eb,null))[_0x1660('0x24')](function(_0x360150){if(_0x360150){_0x92baa2[_0x1660('0x39')]=_[_0x1660('0x36')](db[_0x1660('0xa6')][_0x1660('0x35')]);_0x92baa2['query']=_[_0x1660('0x36')](_0x55c0f1[_0x1660('0x37')]);_0x92baa2[_0x1660('0xa9')]=_[_0x1660('0x9e')](_0x92baa2[_0x1660('0x39')],_0x92baa2[_0x1660('0x37')]);_0x12425a[_0x1660('0x38')]=_[_0x1660('0x9e')](_0x92baa2[_0x1660('0x39')],qs['fields'](_0x55c0f1[_0x1660('0x37')][_0x1660('0x3a')]));_0x12425a[_0x1660('0x38')]=_0x12425a[_0x1660('0x38')][_0x1660('0x3b')]?_0x12425a['attributes']:_0x92baa2[_0x1660('0x39')];if(!_0x55c0f1['query'][_0x1660('0x3c')](_0x1660('0xaa'))){_0x12425a[_0x1660('0x1f')]=qs['limit'](_0x55c0f1[_0x1660('0x37')][_0x1660('0x1f')]);_0x12425a['offset']=qs[_0x1660('0x1e')](_0x55c0f1[_0x1660('0x37')][_0x1660('0x1e')]);}_0x12425a[_0x1660('0x3d')]=qs['sort'](_0x55c0f1[_0x1660('0x37')][_0x1660('0x3e')]);_0x12425a[_0x1660('0x3f')]=qs[_0x1660('0xa9')](_[_0x1660('0x40')](_0x55c0f1[_0x1660('0x37')],_0x92baa2['filters']));_0x12425a[_0x1660('0x3f')][_0x1660('0x9a')]=_0x360150['id'];if(_0x55c0f1[_0x1660('0x37')][_0x1660('0x6c')]){_0x12425a[_0x1660('0x3f')]=_[_0x1660('0xa1')](_0x12425a[_0x1660('0x3f')],{'$or':_[_0x1660('0x2c')](_0x12425a[_0x1660('0x38')],function(_0x1239f3){var _0x2916d9={};_0x2916d9[_0x1239f3]={'$like':'%'+_0x55c0f1[_0x1660('0x37')][_0x1660('0x6c')]+'%'};return _0x2916d9;})});}if(_0x55c0f1[_0x1660('0x37')]['$gte']){var _0x4fd95b=_0x55c0f1[_0x1660('0x37')]['$gte'][_0x1660('0x2e')](',');var _0x3d4394={};_0x3d4394[_0x4fd95b[0x0]]={'$gte':moment(_0x4fd95b[0x1])[_0x1660('0x5a')](_0x1660('0xab'))};_0x12425a[_0x1660('0x3f')]=_['merge'](_0x12425a[_0x1660('0x3f')],_0x3d4394);}_0x12425a=_[_0x1660('0xa1')]({},_0x12425a,_0x55c0f1[_0x1660('0xac')]);return db[_0x1660('0xa6')][_0x1660('0x1d')]({'where':_0x12425a[_0x1660('0x3f')]})[_0x1660('0x24')](function(_0x4ff274){_0x1a2ab3['count']=_0x4ff274;if(_0x55c0f1['query']['includeAll']){_0x12425a['include']=[{'all':!![]}];}return db[_0x1660('0xa6')]['findAll'](_0x12425a);})['then'](function(_0x1892ca){_0x1a2ab3[_0x1660('0x9b')]=_0x1892ca;return _0x1a2ab3;});}})['then'](respondWithFilteredResult(_0x5335eb,_0x12425a))[_0x1660('0x32')](handleError(_0x5335eb,null));};exports[_0x1660('0xad')]=function(_0x3a5761,_0x451c81,_0x49b701){return db['FaxInteraction'][_0x1660('0xa2')]({'where':{'id':_0x3a5761[_0x1660('0x9d')]['id']}})[_0x1660('0x24')](handleEntityNotFound(_0x451c81,null))['then'](function(_0x80c9fb){if(_0x80c9fb){return _0x80c9fb['setTags'](_0x3a5761[_0x1660('0xa4')]['ids'],_[_0x1660('0xa7')](_0x3a5761[_0x1660('0xa4')],[_0x1660('0xa8'),'id'])||{})[_0x1660('0xae')](function(){return db[_0x1660('0xaf')][_0x1660('0xb0')]({'attributes':['id',_0x1660('0x28'),_0x1660('0x42')],'where':{'id':_0x3a5761[_0x1660('0xa4')]['ids']}});})['then'](function(_0x2839c1){socket['emit']('faxInteractionTags:save',{'id':Number(_0x3a5761[_0x1660('0x9d')]['id']),'tags':_0x2839c1||[]});return{'id':Number(_0x3a5761[_0x1660('0x9d')]['id']),'tags':_0x2839c1||[]};});}})[_0x1660('0x24')](respondWithResult(_0x451c81,null))[_0x1660('0x32')](handleError(_0x451c81,null));};exports[_0x1660('0xb1')]=function(_0x2df0fa,_0x4ec149,_0x161df3){return db[_0x1660('0x34')][_0x1660('0xa2')]({'where':{'id':_0x2df0fa[_0x1660('0x9d')]['id']}})[_0x1660('0x24')](handleEntityNotFound(_0x4ec149,null))[_0x1660('0x24')](function(_0x7467b0){if(_0x7467b0){return _0x7467b0['removeTags'](_0x2df0fa[_0x1660('0x37')][_0x1660('0xa8')]);}})[_0x1660('0x24')](respondWithStatusCode(_0x4ec149,null))[_0x1660('0x32')](handleError(_0x4ec149,null));};exports[_0x1660('0xb2')]=function(_0x128f44,_0x38e6ee){var _0x1bea30=moment()[_0x1660('0xb3')]()[_0x1660('0x83')]();var _0x4a47e4=path[_0x1660('0xb4')](config[_0x1660('0xb5')],'server',_0x1660('0xb6'),_0x1660('0xb7'));var _0x386a2d=path[_0x1660('0xb4')](config[_0x1660('0xb5')],_0x1660('0xb8'),_0x1660('0xb6'),'tmp');var _0x20db17=path[_0x1660('0xb4')](_0x386a2d,_0x1bea30);var _0x2020a3=util['format'](_0x1660('0xb9'),_0x1bea30);var _0x3aaf0e=path[_0x1660('0xb4')](_0x386a2d,_0x2020a3);var _0x4a3fbb=![];return db[_0x1660('0x34')][_0x1660('0xa2')]({'where':{'id':_0x128f44[_0x1660('0x9d')]['id']}})[_0x1660('0x24')](handleEntityNotFound(_0x38e6ee,null))[_0x1660('0x24')](function(_0x5e6bd4){if(_0x5e6bd4){return _0x5e6bd4[_0x1660('0xba')]({'attributes':['id','body',_0x1660('0x71')],'include':[{'model':db[_0x1660('0xbb')],'as':_0x1660('0xbb')}]});}return[];})[_0x1660('0x24')](function(_0x53d06d){_0x4a3fbb=_0x53d06d[_0x1660('0x3b')];if(_0x53d06d[_0x1660('0x3b')]){fs['mkdirSync'](_0x20db17);for(var _0xce64d8=0x0;_0xce64d8<_0x53d06d[_0x1660('0x3b')];_0xce64d8++){var _0x29cf38=_0x53d06d[_0xce64d8];var _0x337059=_0x29cf38[_0x1660('0xbb')];if(_0x337059){var _0x28da5b=path['join'](_0x4a47e4,_0x337059[_0x1660('0xbc')]);if(fs['existsSync'](_0x28da5b)){fs[_0x1660('0xbd')](_0x28da5b)[_0x1660('0xbe')](fs[_0x1660('0xbf')](path['join'](_0x20db17,_0x337059[_0x1660('0xbc')])));}}}}})[_0x1660('0x24')](function(){if(_0x4a3fbb){return new BPromise(function(_0x3985d3,_0x10e240){zipdir(_0x20db17,{'saveTo':_0x3aaf0e},function(_0x59bf0a,_0x3e2ae1){if(_0x59bf0a)return _0x10e240(_0x59bf0a);return _0x3985d3(_0x3e2ae1);});});}})[_0x1660('0x24')](function(){if(_0x4a3fbb){return new BPromise(function(_0x33985a,_0x265e7b){rimraf(_0x20db17,function(_0x3c39fb){if(_0x3c39fb)_0x265e7b(_0x3c39fb);return _0x33985a();});});}})[_0x1660('0x24')](function(){if(_0x4a3fbb){return _0x38e6ee[_0x1660('0xb2')](_0x3aaf0e,_0x2020a3,function(_0x44b321){if(_0x44b321){console['log']('err',_0x44b321);}else{fs['unlinkSync'](_0x3aaf0e);}});}else{return _0x38e6ee[_0x1660('0x1a')](0xc8);}})[_0x1660('0x32')](handleError(_0x38e6ee,null));}; \ No newline at end of file +var _0x6186=['getMessages','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','attachments','root','files','interaction-%s.zip','Attachment','mkdirSync','basename','existsSync','createWriteStream','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','closed','FaxMessage','unreadMessages','Users','TagIds','forEach','Tags','FaxInteraction','rawAttributes','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','from','tools_tags','select','fax_messages','me.FaxInteractionId\x20=\x20i.id','field','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','expr','advancedFilter','parse','keys','createdAt','value','dateStart','startOf','day','format','utc','endOf','and','isArray','condition','TagId','length','tableAlias','\x20IN\x20?','LIKE','ContactId','\x20LIKE\x20?','c.email','\x20>\x20?','\x20<\x20?','Messages.count','\x20=\x20?','c.firstName','c.lastName','map','filter','isNil','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','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?','DESC','i.id','Sequelize','QueryTypes','clone','COUNT(*)','read','%s\x20=\x200','toString','having','`Messages.count`\x20=\x200','%s\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','fax_interaction_has_tags','t.id\x20=\x20it.TagId','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20IN\x20?','`Messages.count`\x20>\x200','sequelize','keyBy','merge','a.key','Account.key','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','push','all','show','params','includeAll','find','catch','update','body','describe','addMessage','ids'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6186,0x1b0));var _0x6618=function(_0x576e92,_0x165314){_0x576e92=_0x576e92-0x0;var _0x24c32e=_0x6186[_0x576e92];return _0x24c32e;};'use strict';var pdf=require(_0x6618('0x0'));var emlformat=require(_0x6618('0x1'));var rimraf=require(_0x6618('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6618('0x3'));var rp=require('request-promise');var moment=require(_0x6618('0x4'));var BPromise=require(_0x6618('0x5'));var Mustache=require(_0x6618('0x6'));var util=require(_0x6618('0x7'));var path=require(_0x6618('0x8'));var sox=require(_0x6618('0x9'));var csv=require(_0x6618('0xa'));var ejs=require(_0x6618('0xb'));var fs=require('fs');var _=require(_0x6618('0xc'));var squel=require(_0x6618('0xd'));var crypto=require(_0x6618('0xe'));var jsforce=require(_0x6618('0xf'));var deskjs=require(_0x6618('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6618('0x11'));var authService=require(_0x6618('0x12'));var qs=require(_0x6618('0x13'));var hardwareService=require(_0x6618('0x14'));var logger=require(_0x6618('0x15'))('api');var utils=require(_0x6618('0x16'));var config=require(_0x6618('0x17'));var db=require('../../mysqldb')['db'];config[_0x6618('0x18')]=_['defaults'](config[_0x6618('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6618('0x19'))(new Redis(config[_0x6618('0x18')]));require('./faxInteraction.socket')[_0x6618('0x1a')](socket);function respondWithStatusCode(_0x784f01,_0x57148b){_0x57148b=_0x57148b||0xcc;return function(_0x501110){if(_0x501110){return _0x784f01[_0x6618('0x1b')](_0x57148b);}return _0x784f01[_0x6618('0x1c')](_0x57148b)[_0x6618('0x1d')]();};}function respondWithResult(_0x5c868d,_0x3e4c66){_0x3e4c66=_0x3e4c66||0xc8;return function(_0x3faa47){if(_0x3faa47){return _0x5c868d[_0x6618('0x1c')](_0x3e4c66)[_0x6618('0x1e')](_0x3faa47);}};}function respondWithFilteredResult(_0x2b5dd6,_0xce4164){return function(_0x3c9fe8){if(_0x3c9fe8){var _0x361700=_0x3c9fe8[_0x6618('0x1f')],_0x4c8434=_0xce4164['offset'],_0x2329b4=_0xce4164[_0x6618('0x20')]+_0xce4164[_0x6618('0x21')],_0x443356;if(_0x2329b4>=_0x361700){_0x2329b4=_0x361700;_0x443356=0xc8;}else{_0x443356=0xce;}_0x2b5dd6[_0x6618('0x1c')](_0x443356);return _0x2b5dd6[_0x6618('0x22')](_0x6618('0x23'),_0x4c8434+'-'+_0x2329b4+'/'+_0x361700)[_0x6618('0x1e')](_0x3c9fe8);}return null;};}function patchUpdates(_0x3330f9){return function(_0x50b112){try{jsonpatch[_0x6618('0x24')](_0x50b112,_0x3330f9,!![]);}catch(_0x25d580){return BPromise[_0x6618('0x25')](_0x25d580);}return _0x50b112[_0x6618('0x26')]();};}function saveUpdates(_0x42e719,_0x10c240){return function(_0x293289){if(_0x293289){return _0x293289['update'](_0x42e719)[_0x6618('0x27')](function(_0x2911af){return _0x2911af;});}return null;};}function removeEntity(_0x191aa6,_0x3f0ab2){return function(_0x37b214){if(_0x37b214){return _0x37b214[_0x6618('0x28')]()[_0x6618('0x27')](function(){_0x191aa6[_0x6618('0x1c')](0xcc)[_0x6618('0x1d')]();});}};}function handleEntityNotFound(_0x353c9e,_0x4f0003){return function(_0x24549f){if(!_0x24549f){_0x353c9e[_0x6618('0x1b')](0x194);}return _0x24549f;};}function handleError(_0x3076b8,_0x21f086){_0x21f086=_0x21f086||0x1f4;return function(_0x180606){logger[_0x6618('0x29')](_0x180606[_0x6618('0x2a')]);if(_0x180606['name']){delete _0x180606[_0x6618('0x2b')];}_0x3076b8['status'](_0x21f086)[_0x6618('0x2c')](_0x180606);};}function getInteractionUnreadMessages(_0x4ee9c6){return new BPromise(function(_0x775ea3,_0x1118ce){try{if(_0x4ee9c6[_0x6618('0x2d')]){_0x4ee9c6['unreadMessages']=0x0;_0x775ea3(_0x4ee9c6);}else{return db[_0x6618('0x2e')]['count']({'where':{'FaxInteractionId':_0x4ee9c6['id'],'direction':'in','read':![]}})['then'](function(_0x410353){_0x4ee9c6[_0x6618('0x2f')]=_0x410353;_0x775ea3(_0x4ee9c6);});}}catch(_0x265156){_0x1118ce(_0x265156);}});}function getInteractionUsers(_0x5b2fb3,_0x264538){return new BPromise(function(_0x75ea5,_0x2aea63){try{if(_0x264538[_0x5b2fb3['id']]){_0x5b2fb3[_0x6618('0x30')]=_['map'](_0x264538[_0x5b2fb3['id']],function(_0x32cd4c){return{'id':_0x32cd4c['id']};});}}catch(_0x37ac2d){_0x2aea63(_0x37ac2d);}_0x75ea5(_0x5b2fb3);});}function getInteractionTags(_0x49aaf6,_0x356269){return new BPromise(function(_0x3260b6,_0x162e63){try{if(_0x49aaf6[_0x6618('0x31')]){_0x49aaf6['Tags']=[];_0x49aaf6[_0x6618('0x31')]['split'](',')[_0x6618('0x32')](function(_0x17f060){_0x49aaf6[_0x6618('0x33')]['push'](_0x356269[_0x17f060]);});}delete _0x49aaf6[_0x6618('0x31')];}catch(_0x4e4f19){_0x162e63(_0x4e4f19);}_0x3260b6(_0x49aaf6);});}function updateFaxInteraction(_0x451118,_0x58b25d,_0x431ece){return new BPromise(function(_0x112530,_0x345aeb){return getInteractionUnreadMessages(_0x451118)['then'](function(_0x1937db){return getInteractionUsers(_0x1937db,_0x431ece);})[_0x6618('0x27')](function(_0x27ae08){return getInteractionTags(_0x27ae08,_0x58b25d);})['then'](function(_0x35c0ab){_0x112530(_0x35c0ab);})['catch'](function(_0x275a0a){_0x345aeb(_0x275a0a);});});}exports['index']=function(_0xbddb49,_0x188e66){var _0x25da6a={},_0x1fff99={},_0x4b4c9d={'count':0x0,'rows':[]};var _0x2d659d=db[_0x6618('0x34')][_0x6618('0x35')];_0x1fff99['model']=_['keys'](_0x2d659d);_0x1fff99[_0x6618('0x36')]=_['keys'](_0xbddb49[_0x6618('0x36')]);_0x1fff99['filters']=_[_0x6618('0x37')](_0x1fff99[_0x6618('0x38')],_0x1fff99['query']);_0x25da6a[_0x6618('0x39')]=_['intersection'](_0x1fff99[_0x6618('0x38')],qs[_0x6618('0x3a')](_0xbddb49['query']['fields']));_0x25da6a[_0x6618('0x39')]=_0x25da6a['attributes']['length']?_0x25da6a['attributes']:_0x1fff99[_0x6618('0x38')];if(!_0xbddb49['query'][_0x6618('0x3b')](_0x6618('0x3c'))){_0x25da6a[_0x6618('0x21')]=qs['limit'](_0xbddb49[_0x6618('0x36')][_0x6618('0x21')]);_0x25da6a[_0x6618('0x20')]=qs[_0x6618('0x20')](_0xbddb49[_0x6618('0x36')]['offset']);}_0x25da6a[_0x6618('0x3d')]=qs[_0x6618('0x3e')](_0xbddb49[_0x6618('0x36')]['sort']);_0x25da6a[_0x6618('0x3f')]=qs['filters'](_[_0x6618('0x40')](_0xbddb49[_0x6618('0x36')],_0x1fff99[_0x6618('0x41')]));var _0x18dbb0=[];var _0xb38a17=squel['select']()['field']('id')['field'](_0x6618('0x2b'))['field']('color')[_0x6618('0x42')](_0x6618('0x43'));var _0x43cad5=squel[_0x6618('0x44')]()['field']('COUNT(*)')[_0x6618('0x42')](_0x6618('0x45'),'me')[_0x6618('0x3f')](_0x6618('0x46'))[_0x6618('0x3f')]('me.direction\x20=\x20\x27in\x27')[_0x6618('0x3f')]('me.read\x20=\x20false');var _0x4ea998=squel['select']()[_0x6618('0x47')](_0x6618('0x48'))[_0x6618('0x47')](_0x6618('0x49'))[_0x6618('0x42')](_0x6618('0x4a'),'ui')[_0x6618('0x4b')](_0x6618('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x45ee57=squel[_0x6618('0x44')]()[_0x6618('0x42')](_0x6618('0x4d'),'i')[_0x6618('0x4b')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x6618('0x4e'))[_0x6618('0x4b')](_0x6618('0x4f'),'a',_0x6618('0x50'))[_0x6618('0x4b')](_0x6618('0x45'),'me','me.FaxInteractionId\x20=\x20i.id');var _0x12c8eb=squel[_0x6618('0x51')]();if(_0xbddb49[_0x6618('0x36')][_0x6618('0x52')]){var _0x2cebd2=JSON[_0x6618('0x53')](_0xbddb49[_0x6618('0x36')][_0x6618('0x52')]);_[_0x6618('0x54')](_0x2cebd2)[_0x6618('0x32')](function(_0x206e6e){var _0x4951ec=_0x2cebd2[_0x206e6e];if(_0x206e6e===_0x6618('0x55')){var _0x107e17=moment(_0x4951ec[_0x6618('0x56')][_0x6618('0x57')])[_0x6618('0x58')](_0x6618('0x59'))['utc']()[_0x6618('0x5a')]();var _0x16ace8=moment(_0x16ace8)[_0x6618('0x5b')]()[_0x6618('0x5c')]('day')[_0x6618('0x5a')]();_0x12c8eb[_0x6618('0x5d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x107e17,_0x16ace8);}else{if(_[_0x6618('0x5e')](_0x4951ec[_0x6618('0x5f')])){_0x4951ec['condition'][_0x6618('0x32')](function(_0x44e123){switch(_0x4951ec['condition'][_0x6618('0x56')]){case'IS':if(_0x206e6e!==_0x6618('0x60')&&_0x206e6e!=='Messages.count'){if(_[_0x6618('0x5e')](_0x4951ec[_0x6618('0x56')])&&_0x4951ec[_0x6618('0x56')][_0x6618('0x61')]>0x1){_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x63'),_0x4951ec[_0x6618('0x56')]);}else{_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+'\x20=\x20?',_0x4951ec['value'][0x0]);}}break;case'=':_0x12c8eb[_0x6618('0x5d')](_0x4951ec['tableAlias']+'.'+_0x206e6e+'\x20=\x20?',_0x4951ec[_0x6618('0x56')]);break;case _0x6618('0x64'):if(_0x206e6e===_0x6618('0x65')){_0x12c8eb['and']('c.firstName'+_0x6618('0x66'),'%'+_0x4951ec[_0x6618('0x56')]+'%');_0x12c8eb['or']('c.lastName'+_0x6618('0x66'),'%'+_0x4951ec['value']+'%');_0x12c8eb['or'](_0x6618('0x67')+_0x6618('0x66'),'%'+_0x4951ec['value']+'%');}else{_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x66'),'%'+_0x4951ec['value']+'%');}break;case'>':_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x68'),_0x4951ec[_0x6618('0x56')]);break;case'<':_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x69'),_0x4951ec[_0x6618('0x56')]);break;}});}else{switch(_0x4951ec['condition'][_0x6618('0x56')]){case'IS':if(_0x206e6e!==_0x6618('0x60')&&_0x206e6e!==_0x6618('0x6a')){if(_['isArray'](_0x4951ec[_0x6618('0x56')])&&_0x4951ec['value'][_0x6618('0x61')]>0x1){_0x12c8eb['and'](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+'\x20IN\x20?',_0x4951ec['value']);}else{_0x12c8eb[_0x6618('0x5d')](_0x4951ec['tableAlias']+'.'+_0x206e6e+'\x20=\x20?',_0x4951ec[_0x6618('0x56')][0x0]);}}break;case'=':_0x12c8eb['and'](_0x4951ec['tableAlias']+'.'+_0x206e6e+_0x6618('0x6b'),_0x4951ec[_0x6618('0x56')]);break;case'LIKE':if(_0x206e6e===_0x6618('0x65')){_0x12c8eb[_0x6618('0x5d')](_0x6618('0x6c')+_0x6618('0x66'),'%'+_0x4951ec[_0x6618('0x56')]+'%');_0x12c8eb['or'](_0x6618('0x6d')+'\x20LIKE\x20?','%'+_0x4951ec[_0x6618('0x56')]+'%');_0x12c8eb['or'](_0x6618('0x67')+'\x20LIKE\x20?','%'+_0x4951ec[_0x6618('0x56')]+'%');}else{_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x66'),'%'+_0x4951ec[_0x6618('0x56')]+'%');}break;case'>':_0x12c8eb[_0x6618('0x5d')](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x68'),_0x4951ec[_0x6618('0x56')]);break;case'<':_0x12c8eb['and'](_0x4951ec[_0x6618('0x62')]+'.'+_0x206e6e+_0x6618('0x69'),_0x4951ec['value']);break;}}}});}else{var _0x5224df=_(Object[_0x6618('0x54')](_0xbddb49[_0x6618('0x36')]))[_0x6618('0x6e')](function(_0x2bac29){return _0x2d659d[_0x6618('0x3b')](_0x2bac29)?_0x2bac29:undefined;})[_0x6618('0x6f')](function(_0x553b6d){return!_[_0x6618('0x70')](_0x553b6d);})[_0x6618('0x56')]();if(!_[_0x6618('0x71')](_0x5224df)){_0x5224df[_0x6618('0x32')](function(_0x28ce74){if(_0x28ce74===_0x6618('0x72')){_0x45ee57[_0x6618('0x3f')](_0x6618('0x73'),[][_0x6618('0x74')](_0xbddb49[_0x6618('0x36')][_0x28ce74]));}else if(_0x28ce74===_0x6618('0x55')){var _0x3877eb=JSON[_0x6618('0x53')](_0xbddb49[_0x6618('0x36')][_0x28ce74])[_0x6618('0x75')];var _0x517948=JSON['parse'](_0xbddb49['query'][_0x28ce74])[_0x6618('0x76')];_0x45ee57[_0x6618('0x3f')](_0x6618('0x77'),_0x3877eb,_0x517948);}else{if(_0xbddb49['query'][_0x28ce74]===_0x6618('0x78')){_0x45ee57[_0x6618('0x3f')]('i.'+_0x28ce74+'\x20IS\x20NULL');}else{_0x45ee57[_0x6618('0x3f')]('i.'+_0x28ce74+'\x20=\x20?',_0xbddb49[_0x6618('0x36')][_0x28ce74]);}}});}if(_0xbddb49[_0x6618('0x36')][_0x6618('0x6f')]){var _0x12b856=_0xbddb49[_0x6618('0x36')][_0x6618('0x6f')][_0x6618('0x79')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x6618('0x7a'));if(qs[_0x6618('0x7b')](_0x12b856)){_0x12c8eb['or'](_0x6618('0x7c'),_0x12b856+'%')['or'](_0x6618('0x7d'),_0x12b856+'%');}_0x12c8eb['or'](_0x6618('0x7e'),_0x12b856+'%');}}_0x45ee57[_0x6618('0x3f')](_0x12c8eb);if(_0x25da6a[_0x6618('0x3d')]){_0x25da6a['order'][_0x6618('0x32')](function(_0x3b1881){_0x45ee57[_0x6618('0x3d')]('i.'+_0x3b1881[0x0],_0x3b1881[0x1]===_0x6618('0x7f')?![]:!![]);});}_0x45ee57['group'](_0x6618('0x80'));var _0xd40ee8={'type':db[_0x6618('0x81')][_0x6618('0x82')]['SELECT'],'raw':!![]};var _0x42b49a=_0x45ee57[_0x6618('0x83')]()['field'](_0x6618('0x84'));if(!_0xbddb49[_0x6618('0x36')][_0x6618('0x52')]){if(_0xbddb49['query'][_0x6618('0x85')]){if(_0xbddb49[_0x6618('0x36')][_0x6618('0x85')]==0x1){_0x42b49a[_0x6618('0x3f')](util[_0x6618('0x5a')](_0x6618('0x86'),_0x43cad5[_0x6618('0x87')]()));_0x45ee57[_0x6618('0x88')](_0x6618('0x89'));}else{_0x42b49a[_0x6618('0x3f')](util[_0x6618('0x5a')](_0x6618('0x8a'),_0x43cad5[_0x6618('0x87')]()));_0x45ee57[_0x6618('0x88')]('`Messages.count`\x20>\x200');}}if(_0xbddb49[_0x6618('0x36')]['tag']){var _0x5b7305=_[_0x6618('0x5e')](_0xbddb49[_0x6618('0x36')][_0x6618('0x8b')])?_0xbddb49[_0x6618('0x36')]['tag']:new Array(_0xbddb49[_0x6618('0x36')]['tag']);var _0x42a184=squel['expr']();_0x5b7305[_0x6618('0x32')](function(_0x2246ab){_0x42a184['or'](_0x6618('0x8c'),'%,'+_0x2246ab+',%');});_0x45ee57['having'](_0x42a184);_0x42b49a[_0x6618('0x4b')](_0x6618('0x8d'),'it','it.FaxInteractionId\x20=\x20i.id');_0x42b49a['left_join']('tools_tags','t',_0x6618('0x8e'));_0x42b49a['where']('t.id\x20IN\x20?',_0x5b7305);}}else{var _0x2cebd2=JSON['parse'](_0xbddb49['query'][_0x6618('0x52')]);_['keys'](_0x2cebd2)[_0x6618('0x32')](function(_0x4c2877){var _0x447a75=_0x2cebd2[_0x4c2877];if(_0x4c2877===_0x6618('0x60')){var _0x16152e=_0x447a75[_0x6618('0x56')];var _0x411617=squel['expr']();_0x16152e[_0x6618('0x32')](function(_0x13f4ea){_0x411617['or'](_0x6618('0x8c'),'%,'+_0x13f4ea+',%');});_0x45ee57[_0x6618('0x88')](_0x411617);_0x42b49a[_0x6618('0x4b')](_0x6618('0x8f'),'it',_0x6618('0x90'));_0x42b49a[_0x6618('0x4b')]('tools_tags','t',_0x6618('0x8e'));_0x42b49a[_0x6618('0x3f')](_0x6618('0x91'),_0x16152e);}else if(_0x4c2877===_0x6618('0x6a')){if(_0x447a75[_0x6618('0x56')]['length']===0x1){if(_0x447a75[_0x6618('0x56')][0x0]===0x1){_0x42b49a[_0x6618('0x3f')](util['format'](_0x6618('0x86'),_0x43cad5['toString']()));_0x45ee57['having']('`Messages.count`\x20=\x200');}else{_0x42b49a[_0x6618('0x3f')](util[_0x6618('0x5a')](_0x6618('0x8a'),_0x43cad5['toString']()));_0x45ee57[_0x6618('0x88')](_0x6618('0x92'));}}}});}db[_0x6618('0x93')][_0x6618('0x36')](_0x42b49a['toString'](),_0xd40ee8)[_0x6618('0x27')](function(_0x524cb7){_0x4b4c9d[_0x6618('0x1f')]=_0x524cb7[_0x6618('0x61')];if(_0x4b4c9d[_0x6618('0x1f')]===0x0)return[];return db[_0x6618('0x93')]['query'](_0xb38a17[_0x6618('0x87')](),_0xd40ee8)[_0x6618('0x27')](function(_0x4ed077){_0x18dbb0=_[_0x6618('0x94')](_0x4ed077,'id');_0xd40ee8=_[_0x6618('0x95')](_0xd40ee8,{'model':db[_0x6618('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x45ee57[_0x6618('0x47')](_0x6618('0x96'),_0x6618('0x97'));_0x45ee57[_0x6618('0x47')]('i.*');_0x45ee57[_0x6618('0x47')](_0x6618('0x6c'),_0x6618('0x98'));_0x45ee57[_0x6618('0x47')](_0x6618('0x6d'),_0x6618('0x99'));_0x45ee57[_0x6618('0x47')]('c.email',_0x6618('0x9a'));_0x45ee57[_0x6618('0x47')](_0x6618('0x9b'),_0x6618('0x9c'));_0x45ee57[_0x6618('0x47')](_0x6618('0x9d'),'Contact.mobile');_0x45ee57[_0x6618('0x47')](_0x6618('0x9e'),_0x6618('0x9f'));_0x45ee57[_0x6618('0x47')](_0x6618('0xa0'),_0x6618('0x31'));_0x45ee57[_0x6618('0x4b')](_0x6618('0x8d'),'it','it.FaxInteractionId\x20=\x20i.id');_0x45ee57[_0x6618('0x4b')]('tools_tags','t','t.id\x20=\x20it.TagId');_0x45ee57[_0x6618('0x21')](_0x25da6a[_0x6618('0x21')]);_0x45ee57[_0x6618('0x20')](_0x25da6a[_0x6618('0x20')]);return db[_0x6618('0x93')][_0x6618('0x36')](_0x45ee57['toString'](),_0xd40ee8);})[_0x6618('0x27')](function(_0x29ff79){_0x4ea998[_0x6618('0x3f')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x29ff79,'id'));return db['sequelize'][_0x6618('0x36')](_0x4ea998['toString'](),_0xd40ee8)[_0x6618('0x27')](function(_0x5239d2){var _0x4bc3b1=_['groupBy'](_0x5239d2,_0x6618('0xa1'));var _0x9d89fa=[];_0x29ff79[_0x6618('0x32')](function(_0x21b32c){_0x9d89fa[_0x6618('0xa2')](updateFaxInteraction(_0x21b32c,_0x18dbb0,_0x4bc3b1));});return BPromise[_0x6618('0xa3')](_0x9d89fa);});});})[_0x6618('0x27')](function(_0xbb2857){_0x4b4c9d['rows']=_0xbb2857;return _0x4b4c9d;})[_0x6618('0x27')](respondWithFilteredResult(_0x188e66,_0x25da6a))['catch'](handleError(_0x188e66,null));};exports[_0x6618('0xa4')]=function(_0x54db90,_0x3a3d4b){var _0x26caf4={'raw':![],'where':{'id':_0x54db90[_0x6618('0xa5')]['id']}},_0x367d92={};_0x367d92[_0x6618('0x38')]=_['keys'](db['FaxInteraction'][_0x6618('0x35')]);_0x367d92[_0x6618('0x36')]=_[_0x6618('0x54')](_0x54db90[_0x6618('0x36')]);_0x367d92[_0x6618('0x41')]=_[_0x6618('0x37')](_0x367d92[_0x6618('0x38')],_0x367d92[_0x6618('0x36')]);_0x26caf4[_0x6618('0x39')]=_['intersection'](_0x367d92[_0x6618('0x38')],qs[_0x6618('0x3a')](_0x54db90[_0x6618('0x36')]['fields']));_0x26caf4[_0x6618('0x39')]=_0x26caf4[_0x6618('0x39')][_0x6618('0x61')]?_0x26caf4[_0x6618('0x39')]:_0x367d92[_0x6618('0x38')];if(_0x54db90[_0x6618('0x36')][_0x6618('0xa6')]){_0x26caf4['include']=[{'all':!![]}];}_0x26caf4=_['merge']({},_0x26caf4,_0x54db90['options']);return db[_0x6618('0x34')][_0x6618('0xa7')](_0x26caf4)[_0x6618('0x27')](handleEntityNotFound(_0x3a3d4b,null))[_0x6618('0x27')](respondWithResult(_0x3a3d4b,null))[_0x6618('0xa8')](handleError(_0x3a3d4b,null));};exports['create']=function(_0x5d6dab,_0x21785a){return db['FaxInteraction']['create'](_0x5d6dab['body'],{})[_0x6618('0x27')](respondWithResult(_0x21785a,0xc9))[_0x6618('0xa8')](handleError(_0x21785a,null));};exports[_0x6618('0xa9')]=function(_0x238bca,_0x42ce88){if(_0x238bca[_0x6618('0xaa')]['id']){delete _0x238bca[_0x6618('0xaa')]['id'];}return db[_0x6618('0x34')]['find']({'where':{'id':_0x238bca[_0x6618('0xa5')]['id']}})[_0x6618('0x27')](handleEntityNotFound(_0x42ce88,null))['then'](saveUpdates(_0x238bca['body'],null))[_0x6618('0x27')](respondWithResult(_0x42ce88,null))[_0x6618('0xa8')](handleError(_0x42ce88,null));};exports['destroy']=function(_0x947e80,_0x3bd8a4){return db[_0x6618('0x34')][_0x6618('0xa7')]({'where':{'id':_0x947e80[_0x6618('0xa5')]['id']}})['then'](handleEntityNotFound(_0x3bd8a4,null))[_0x6618('0x27')](removeEntity(_0x3bd8a4,null))[_0x6618('0xa8')](handleError(_0x3bd8a4,null));};exports['describe']=function(_0x5da40e,_0x36387e){return db['FaxInteraction'][_0x6618('0xab')]()[_0x6618('0x27')](respondWithResult(_0x36387e,null))[_0x6618('0xa8')](handleError(_0x36387e,null));};exports[_0x6618('0xac')]=function(_0x36968c,_0x436a54,_0x28db39){return db[_0x6618('0x2e')][_0x6618('0xa7')]({'where':{'id':_0x36968c['params']['id']}})[_0x6618('0x27')](handleEntityNotFound(_0x436a54,null))[_0x6618('0x27')](function(_0x54a6da){if(_0x54a6da){return _0x54a6da[_0x6618('0xac')](_0x36968c[_0x6618('0xaa')][_0x6618('0xad')],_['omit'](_0x36968c[_0x6618('0xaa')],[_0x6618('0xad'),'id'])||{});}})[_0x6618('0x27')](respondWithResult(_0x436a54,null))[_0x6618('0xa8')](handleError(_0x436a54,null));};exports[_0x6618('0xae')]=function(_0xb9e96b,_0x4719cf,_0x581dbb){var _0x319954={'raw':![],'where':{}};var _0x1234e0={};var _0x4e741f={'count':0x0,'rows':[]};return db[_0x6618('0x34')]['findOne']({'where':{'id':_0xb9e96b[_0x6618('0xa5')]['id']}})['then'](handleEntityNotFound(_0x4719cf,null))[_0x6618('0x27')](function(_0x4eedbd){if(_0x4eedbd){_0x1234e0[_0x6618('0x38')]=_[_0x6618('0x54')](db['FaxMessage'][_0x6618('0x35')]);_0x1234e0['query']=_[_0x6618('0x54')](_0xb9e96b[_0x6618('0x36')]);_0x1234e0['filters']=_['intersection'](_0x1234e0[_0x6618('0x38')],_0x1234e0[_0x6618('0x36')]);_0x319954['attributes']=_['intersection'](_0x1234e0[_0x6618('0x38')],qs['fields'](_0xb9e96b[_0x6618('0x36')][_0x6618('0x3a')]));_0x319954[_0x6618('0x39')]=_0x319954[_0x6618('0x39')]['length']?_0x319954[_0x6618('0x39')]:_0x1234e0[_0x6618('0x38')];if(!_0xb9e96b[_0x6618('0x36')][_0x6618('0x3b')](_0x6618('0x3c'))){_0x319954[_0x6618('0x21')]=qs[_0x6618('0x21')](_0xb9e96b['query'][_0x6618('0x21')]);_0x319954[_0x6618('0x20')]=qs[_0x6618('0x20')](_0xb9e96b[_0x6618('0x36')][_0x6618('0x20')]);}_0x319954[_0x6618('0x3d')]=qs[_0x6618('0x3e')](_0xb9e96b[_0x6618('0x36')][_0x6618('0x3e')]);_0x319954[_0x6618('0x3f')]=qs['filters'](_[_0x6618('0x40')](_0xb9e96b[_0x6618('0x36')],_0x1234e0['filters']));_0x319954[_0x6618('0x3f')][_0x6618('0xa1')]=_0x4eedbd['id'];if(_0xb9e96b[_0x6618('0x36')][_0x6618('0x6f')]){_0x319954[_0x6618('0x3f')]=_[_0x6618('0x95')](_0x319954[_0x6618('0x3f')],{'$or':_['map'](_0x319954['attributes'],function(_0x378d3d){var _0x1e4231={};_0x1e4231[_0x378d3d]={'$like':'%'+_0xb9e96b[_0x6618('0x36')][_0x6618('0x6f')]+'%'};return _0x1e4231;})});}if(_0xb9e96b[_0x6618('0x36')]['$gte']){var _0x1de244=_0xb9e96b[_0x6618('0x36')]['$gte'][_0x6618('0xaf')](',');var _0x1f8828={};_0x1f8828[_0x1de244[0x0]]={'$gte':moment(_0x1de244[0x1])[_0x6618('0x5a')](_0x6618('0xb0'))};_0x319954[_0x6618('0x3f')]=_[_0x6618('0x95')](_0x319954[_0x6618('0x3f')],_0x1f8828);}_0x319954=_['merge']({},_0x319954,_0xb9e96b[_0x6618('0xb1')]);return db[_0x6618('0x2e')][_0x6618('0x1f')]({'where':_0x319954[_0x6618('0x3f')]})[_0x6618('0x27')](function(_0x43f974){_0x4e741f[_0x6618('0x1f')]=_0x43f974;if(_0xb9e96b[_0x6618('0x36')][_0x6618('0xa6')]){_0x319954['include']=[{'all':!![]}];}return db[_0x6618('0x2e')][_0x6618('0xb2')](_0x319954);})[_0x6618('0x27')](function(_0x5d4bdb){_0x4e741f[_0x6618('0xb3')]=_0x5d4bdb;return _0x4e741f;});}})[_0x6618('0x27')](respondWithFilteredResult(_0x4719cf,_0x319954))[_0x6618('0xa8')](handleError(_0x4719cf,null));};exports[_0x6618('0xb4')]=function(_0x22d7a8,_0xab9009,_0x520edd){return db['FaxInteraction'][_0x6618('0xa7')]({'where':{'id':_0x22d7a8['params']['id']}})[_0x6618('0x27')](handleEntityNotFound(_0xab9009,null))[_0x6618('0x27')](function(_0x37b0be){if(_0x37b0be){return _0x37b0be[_0x6618('0xb5')](_0x22d7a8[_0x6618('0xaa')][_0x6618('0xad')],_[_0x6618('0xb6')](_0x22d7a8[_0x6618('0xaa')],[_0x6618('0xad'),'id'])||{})[_0x6618('0xb7')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x22d7a8[_0x6618('0xaa')][_0x6618('0xad')]}});})[_0x6618('0x27')](function(_0x13a9c8){socket[_0x6618('0xb8')](_0x6618('0xb9'),{'id':Number(_0x22d7a8[_0x6618('0xa5')]['id']),'tags':_0x13a9c8||[]});return{'id':Number(_0x22d7a8[_0x6618('0xa5')]['id']),'tags':_0x13a9c8||[]};});}})['then'](respondWithResult(_0xab9009,null))[_0x6618('0xa8')](handleError(_0xab9009,null));};exports[_0x6618('0xba')]=function(_0x20259d,_0x47b8db,_0x9c918d){return db[_0x6618('0x34')][_0x6618('0xa7')]({'where':{'id':_0x20259d[_0x6618('0xa5')]['id']}})[_0x6618('0x27')](handleEntityNotFound(_0x47b8db,null))[_0x6618('0x27')](function(_0x58faaf){if(_0x58faaf){return _0x58faaf[_0x6618('0xba')](_0x20259d[_0x6618('0x36')][_0x6618('0xad')]);}})[_0x6618('0x27')](respondWithStatusCode(_0x47b8db,null))['catch'](handleError(_0x47b8db,null));};exports[_0x6618('0xbb')]=function(_0x449e5d,_0xfb20d6){var _0x16c3c3=moment()[_0x6618('0xbc')]()[_0x6618('0x87')]();var _0xd7efa=path[_0x6618('0xbd')](config['root'],_0x6618('0xbe'),'files',_0x6618('0xbf'));var _0x575066=path['join'](config[_0x6618('0xc0')],_0x6618('0xbe'),_0x6618('0xc1'),'tmp');var _0x2e7b7f=path['join'](_0x575066,_0x16c3c3);var _0x5debe5=util['format'](_0x6618('0xc2'),_0x16c3c3);var _0xdb0ff3=path[_0x6618('0xbd')](_0x575066,_0x5debe5);var _0x255c4f=![];return db[_0x6618('0x34')][_0x6618('0xa7')]({'where':{'id':_0x449e5d[_0x6618('0xa5')]['id']}})['then'](handleEntityNotFound(_0xfb20d6,null))['then'](function(_0x5779cd){if(_0x5779cd){return _0x5779cd[_0x6618('0xae')]({'attributes':['id','body',_0x6618('0x55')],'include':[{'model':db[_0x6618('0xc3')],'as':_0x6618('0xc3')}]});}return[];})[_0x6618('0x27')](function(_0x1e1e0d){_0x255c4f=_0x1e1e0d['length'];if(_0x1e1e0d[_0x6618('0x61')]){fs[_0x6618('0xc4')](_0x2e7b7f);for(var _0x3960f5=0x0;_0x3960f5<_0x1e1e0d['length'];_0x3960f5++){var _0x536467=_0x1e1e0d[_0x3960f5];var _0x5d6654=_0x536467[_0x6618('0xc3')];if(_0x5d6654){var _0x4cced7=path[_0x6618('0xbd')](_0xd7efa,_0x5d6654[_0x6618('0xc5')]);if(fs[_0x6618('0xc6')](_0x4cced7)){fs['createReadStream'](_0x4cced7)['pipe'](fs[_0x6618('0xc7')](path['join'](_0x2e7b7f,_0x5d6654[_0x6618('0xc5')])));}}}}})[_0x6618('0x27')](function(){if(_0x255c4f){return new BPromise(function(_0x5a549d,_0x20de45){zipdir(_0x2e7b7f,{'saveTo':_0xdb0ff3},function(_0x35dfb4,_0x45f6f1){if(_0x35dfb4)return _0x20de45(_0x35dfb4);return _0x5a549d(_0x45f6f1);});});}})['then'](function(){if(_0x255c4f){return new BPromise(function(_0xe79bb0,_0x1ab902){rimraf(_0x2e7b7f,function(_0x291cd9){if(_0x291cd9)_0x1ab902(_0x291cd9);return _0xe79bb0();});});}})[_0x6618('0x27')](function(){if(_0x255c4f){return _0xfb20d6[_0x6618('0xbb')](_0xdb0ff3,_0x5debe5,function(_0x531724){if(_0x531724){console['log'](_0x6618('0xc8'),_0x531724);}else{fs[_0x6618('0xc9')](_0xdb0ff3);}});}else{return _0xfb20d6[_0x6618('0x1b')](0xc8);}})[_0x6618('0xa8')](handleError(_0xfb20d6,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2a7cc0b..8a97d9f 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 _0x8caf=['unreadMessages','length','emit','catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x30ebcb,_0x1ea3ec){var _0x608417=function(_0x33b10b){while(--_0x33b10b){_0x30ebcb['push'](_0x30ebcb['shift']());}};_0x608417(++_0x1ea3ec);}(_0x8caf,0x110));var _0xf8ca=function(_0x5d10c2,_0x4b0a49){_0x5d10c2=_0x5d10c2-0x0;var _0x57c7c4=_0x8caf[_0x5d10c2];return _0x57c7c4;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xf8ca('0x0'))['db'][_0xf8ca('0x1')];var FaxMessage=require(_0xf8ca('0x0'))['db'][_0xf8ca('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf8ca('0x3')](0x0);var events={'afterCreate':_0xf8ca('0x4'),'afterUpdate':_0xf8ca('0x5'),'afterDestroy':_0xf8ca('0x6')};function emitEvent(_0x131b20){return function(_0x3212c8,_0x31ab1c,_0x4af48d){_0x3212c8[_0xf8ca('0x7')]({'attributes':['id'],'raw':!![]})[_0xf8ca('0x8')](function(_0x3e247c){_0x3212c8[_0xf8ca('0x9')](_0xf8ca('0xa'),_0x3e247c[_0xf8ca('0xb')](function(_0x1c5917){return{'id':_0x1c5917['id']};}));return FaxMessage[_0xf8ca('0xc')]({'where':{'FaxInteractionId':_0x3212c8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf8ca('0x8')](function(_0x1acff9){_0x3212c8[_0xf8ca('0x9')](_0xf8ca('0xd'),_0x1acff9[_0xf8ca('0xe')]);FaxInteractionEvents[_0xf8ca('0xf')](_0x131b20+':'+_0x3212c8['id'],_0x3212c8);FaxInteractionEvents[_0xf8ca('0xf')](_0x131b20,_0x3212c8);_0x4af48d(null);})[_0xf8ca('0x10')](_0x4af48d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xf8ca('0x11')](e,emitEvent(event));}}module[_0xf8ca('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x2024=['then','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x4f06fa,_0x31c38b){var _0x25c1a1=function(_0x273e76){while(--_0x273e76){_0x4f06fa['push'](_0x4f06fa['shift']());}};_0x25c1a1(++_0x31c38b);}(_0x2024,0xf7));var _0x4202=function(_0x16ccaf,_0x25941a){_0x16ccaf=_0x16ccaf-0x0;var _0x56958a=_0x2024[_0x16ccaf];return _0x56958a;};'use strict';var EventEmitter=require(_0x4202('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x4202('0x1')];var FaxMessage=require(_0x4202('0x2'))['db'][_0x4202('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4202('0x4')](0x0);var events={'afterCreate':_0x4202('0x5'),'afterUpdate':_0x4202('0x6'),'afterDestroy':_0x4202('0x7')};function emitEvent(_0x3d21ee){return function(_0x650a7e,_0x2b36c1,_0x1c7be3){_0x650a7e['getUsers']({'attributes':['id'],'raw':!![]})[_0x4202('0x8')](function(_0x127345){_0x650a7e['setDataValue']('Users',_0x127345['map'](function(_0x359e25){return{'id':_0x359e25['id']};}));return FaxMessage[_0x4202('0x9')]({'where':{'FaxInteractionId':_0x650a7e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4832fe){_0x650a7e[_0x4202('0xa')](_0x4202('0xb'),_0x4832fe['length']);FaxInteractionEvents['emit'](_0x3d21ee+':'+_0x650a7e['id'],_0x650a7e);FaxInteractionEvents[_0x4202('0xc')](_0x3d21ee,_0x650a7e);_0x1c7be3(null);})[_0x4202('0xd')](_0x1c7be3(null));};}for(var e in events){if(events[_0x4202('0xe')](e)){var event=events[e];FaxInteraction[_0x4202('0xf')](e,emitEvent(event));}}module[_0x4202('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a5a85f2..394ea06 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 _0x2617=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2617,0x1be));var _0x7261=function(_0x2230a4,_0x499a58){_0x2230a4=_0x2230a4-0x0;var _0x542232=_0x2617[_0x2230a4];return _0x542232;};'use strict';var _=require(_0x7261('0x0'));var util=require(_0x7261('0x1'));var logger=require('../../config/logger')(_0x7261('0x2'));var moment=require(_0x7261('0x3'));var BPromise=require(_0x7261('0x4'));var rp=require(_0x7261('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7261('0x6'));var config=require(_0x7261('0x7'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x494f07,_0x505100){return _0x494f07[_0x7261('0x8')]('FaxInteraction',attributes,{'tableName':_0x7261('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xafafc0,_0x1eb02c,_0x1b22dc){if(_0xafafc0[_0x7261('0xa')](_0x7261('0xb'))){_0xafafc0[_0x7261('0xc')]=moment()['format'](_0x7261('0xd'));}_0x1b22dc(null,_0xafafc0);}}});}; \ No newline at end of file +var _0xff3d=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5b2fe0,_0x4a0c76){var _0x3a3091=function(_0x337b74){while(--_0x337b74){_0x5b2fe0['push'](_0x5b2fe0['shift']());}};_0x3a3091(++_0x4a0c76);}(_0xff3d,0x1c9));var _0xdff3=function(_0x46b157,_0x2e75b1){_0x46b157=_0x46b157-0x0;var _0x2d16e7=_0xff3d[_0x46b157];return _0x2d16e7;};'use strict';var _=require(_0xdff3('0x0'));var util=require(_0xdff3('0x1'));var logger=require(_0xdff3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdff3('0x3'));var rp=require(_0xdff3('0x4'));var fs=require('fs');var path=require(_0xdff3('0x5'));var rimraf=require(_0xdff3('0x6'));var config=require(_0xdff3('0x7'));var attributes=require(_0xdff3('0x8'));module[_0xdff3('0x9')]=function(_0x5d5865,_0x5efc38){return _0x5d5865[_0xdff3('0xa')](_0xdff3('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ec069,_0x3a3b46,_0x531485){if(_0x1ec069[_0xdff3('0xc')]('closed')){_0x1ec069[_0xdff3('0xd')]=moment()[_0xdff3('0xe')](_0xdff3('0xf'));}_0x531485(null,_0x1ec069);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4296733..028f3da 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 _0x966a=['debug','error','code','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','stringify','AddTagsToFaxInteraction','addTags','body','ids','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x966a,0x17c));var _0xa966=function(_0xe7bf5a,_0x8dfa9e){_0xe7bf5a=_0xe7bf5a-0x0;var _0x5f516d=_0x966a[_0xe7bf5a];return _0x5f516d;};'use strict';var _=require('lodash');var util=require(_0xa966('0x0'));var moment=require(_0xa966('0x1'));var BPromise=require(_0xa966('0x2'));var rs=require(_0xa966('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa966('0x4'))['db'];var utils=require(_0xa966('0x5'));var logger=require(_0xa966('0x6'))(_0xa966('0x7'));var config=require(_0xa966('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa966('0x9')][_0xa966('0xa')]({'port':0x232a});config[_0xa966('0xb')]=_['defaults'](config['redis'],{'host':_0xa966('0xc'),'port':0x18eb});var socket=require(_0xa966('0xd'))(new Redis(config[_0xa966('0xb')]));require(_0xa966('0xe'))[_0xa966('0xf')](socket);function respondWithRpcPromise(_0x5a4071,_0x27dde1,_0x3a3d89){return new BPromise(function(_0x3b876b,_0x5b90da){return client[_0xa966('0x10')](_0x5a4071,_0x3a3d89)[_0xa966('0x11')](function(_0x425418){logger[_0xa966('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x27dde1,_0xa966('0x13'));logger[_0xa966('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x27dde1,'request\x20sent',JSON['stringify'](_0x425418));if(_0x425418[_0xa966('0x15')]){if(_0x425418[_0xa966('0x15')][_0xa966('0x16')]===0x1f4){logger[_0xa966('0x15')](_0xa966('0x17'),_0x27dde1,_0x425418[_0xa966('0x15')][_0xa966('0x18')]);return _0x5b90da(_0x425418['error'][_0xa966('0x18')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x27dde1,_0x425418['error'][_0xa966('0x18')]);return _0x3b876b(_0x425418[_0xa966('0x15')][_0xa966('0x18')]);}else{logger[_0xa966('0x12')](_0xa966('0x17'),_0x27dde1,'request\x20sent');_0x3b876b(_0x425418['result']['message']);}})[_0xa966('0x19')](function(_0xf4b02b){logger[_0xa966('0x15')](_0xa966('0x17'),_0x27dde1,_0xf4b02b);_0x5b90da(_0xf4b02b);});});}exports[_0xa966('0x1a')]=function(_0x36f1a0){var _0x35501a=this;return new Promise(function(_0x1fc292,_0x5e40d3){return db[_0xa966('0x1b')][_0xa966('0x1c')](_0x36f1a0['body'],{'raw':_0x36f1a0['options']?_0x36f1a0[_0xa966('0x1d')][_0xa966('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f1a0[_0xa966('0x1d')]?_0x36f1a0[_0xa966('0x1d')][_0xa966('0x1f')]||null:null,'attributes':_0x36f1a0[_0xa966('0x1d')]?_0x36f1a0[_0xa966('0x1d')][_0xa966('0x20')]||null:null,'limit':_0x36f1a0[_0xa966('0x1d')]?_0x36f1a0['options']['limit']||null:null})[_0xa966('0x11')](function(_0x55af15){logger[_0xa966('0x12')](_0xa966('0x1a'),_0x36f1a0);logger[_0xa966('0x14')](_0xa966('0x1a'),_0x36f1a0,JSON[_0xa966('0x21')](_0x55af15));_0x1fc292(_0x55af15);})[_0xa966('0x19')](function(_0x17d0e7){logger['error']('UpdateFaxInteraction',_0x17d0e7['message'],_0x36f1a0);_0x5e40d3(_0x35501a[_0xa966('0x15')](0x1f4,_0x17d0e7['message']));});});};exports[_0xa966('0x22')]=function(_0xe4408a){return new Promise(function(_0x47b9ec,_0xd9dd0b){return db[_0xa966('0x1b')]['find']({'where':_0xe4408a[_0xa966('0x1d')]?_0xe4408a['options']['where']||null:null})[_0xa966('0x11')](function(_0x375330){if(_0x375330){return _0x375330[_0xa966('0x23')](_0xe4408a[_0xa966('0x24')][_0xa966('0x25')],_['omit'](_0xe4408a[_0xa966('0x24')],[_0xa966('0x25'),'id'])||{});}})[_0xa966('0x26')](function(_0x10662f){logger['info']('AddTags',_0xe4408a);logger[_0xa966('0x14')](_0xa966('0x27'),_0xe4408a,JSON['stringify'](_0x10662f));_0x47b9ec(_0x10662f);})[_0xa966('0x19')](function(_0x5ec8ac){logger['error'](_0xa966('0x27'),_0x5ec8ac['message'],_0xe4408a);_0xd9dd0b(_this[_0xa966('0x15')](0x1f4,_0x5ec8ac['message']));});});}; \ No newline at end of file +var _0xce39=['FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','body','options','raw','limit','then','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug'];(function(_0xadd0d2,_0x3bf5b9){var _0x2d564c=function(_0x36df23){while(--_0x36df23){_0xadd0d2['push'](_0xadd0d2['shift']());}};_0x2d564c(++_0x3bf5b9);}(_0xce39,0xa9));var _0x9ce3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xce39[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9ce3('0x0'));var util=require('util');var moment=require(_0x9ce3('0x1'));var BPromise=require('bluebird');var rs=require(_0x9ce3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ce3('0x3'))['db'];var utils=require(_0x9ce3('0x4'));var logger=require('../../config/logger')(_0x9ce3('0x5'));var config=require('../../config/environment');var jayson=require(_0x9ce3('0x6'));var client=jayson[_0x9ce3('0x7')][_0x9ce3('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9ce3('0x9')],{'host':_0x9ce3('0xa'),'port':0x18eb});var socket=require(_0x9ce3('0xb'))(new Redis(config[_0x9ce3('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4b1405,_0x1242c3,_0xe7c58){return new BPromise(function(_0x430e2a,_0x363b49){return client[_0x9ce3('0xc')](_0x4b1405,_0xe7c58)['then'](function(_0x34ef87){logger[_0x9ce3('0xd')]('FaxInteraction,\x20%s,\x20%s',_0x1242c3,_0x9ce3('0xe'));logger[_0x9ce3('0xf')](_0x9ce3('0x10'),_0x1242c3,'request\x20sent',JSON['stringify'](_0x34ef87));if(_0x34ef87[_0x9ce3('0x11')]){if(_0x34ef87['error'][_0x9ce3('0x12')]===0x1f4){logger[_0x9ce3('0x11')](_0x9ce3('0x13'),_0x1242c3,_0x34ef87[_0x9ce3('0x11')]['message']);return _0x363b49(_0x34ef87['error'][_0x9ce3('0x14')]);}logger['error'](_0x9ce3('0x13'),_0x1242c3,_0x34ef87['error'][_0x9ce3('0x14')]);return _0x430e2a(_0x34ef87[_0x9ce3('0x11')]['message']);}else{logger['info'](_0x9ce3('0x13'),_0x1242c3,_0x9ce3('0xe'));_0x430e2a(_0x34ef87[_0x9ce3('0x15')][_0x9ce3('0x14')]);}})[_0x9ce3('0x16')](function(_0x49a9b9){logger['error'](_0x9ce3('0x13'),_0x1242c3,_0x49a9b9);_0x363b49(_0x49a9b9);});});}exports['UpdateFaxInteraction']=function(_0x1d43ea){var _0x340bd7=this;return new Promise(function(_0x37719c,_0x4e261e){return db['FaxInteraction']['update'](_0x1d43ea[_0x9ce3('0x17')],{'raw':_0x1d43ea[_0x9ce3('0x18')]?_0x1d43ea[_0x9ce3('0x18')][_0x9ce3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d43ea[_0x9ce3('0x18')]?_0x1d43ea[_0x9ce3('0x18')]['where']||null:null,'attributes':_0x1d43ea[_0x9ce3('0x18')]?_0x1d43ea[_0x9ce3('0x18')]['attributes']||null:null,'limit':_0x1d43ea[_0x9ce3('0x18')]?_0x1d43ea['options'][_0x9ce3('0x1a')]||null:null})[_0x9ce3('0x1b')](function(_0x41d49e){logger[_0x9ce3('0xd')](_0x9ce3('0x1c'),_0x1d43ea);logger[_0x9ce3('0xf')]('UpdateFaxInteraction',_0x1d43ea,JSON[_0x9ce3('0x1d')](_0x41d49e));_0x37719c(_0x41d49e);})[_0x9ce3('0x16')](function(_0x2b9f38){logger[_0x9ce3('0x11')](_0x9ce3('0x1c'),_0x2b9f38[_0x9ce3('0x14')],_0x1d43ea);_0x4e261e(_0x340bd7[_0x9ce3('0x11')](0x1f4,_0x2b9f38[_0x9ce3('0x14')]));});});};exports[_0x9ce3('0x1e')]=function(_0x19c17b){return new Promise(function(_0x15ea99,_0xc62d60){return db[_0x9ce3('0x1f')]['find']({'where':_0x19c17b[_0x9ce3('0x18')]?_0x19c17b[_0x9ce3('0x18')]['where']||null:null})['then'](function(_0x2afd4e){if(_0x2afd4e){return _0x2afd4e[_0x9ce3('0x20')](_0x19c17b[_0x9ce3('0x17')][_0x9ce3('0x21')],_[_0x9ce3('0x22')](_0x19c17b[_0x9ce3('0x17')],[_0x9ce3('0x21'),'id'])||{});}})[_0x9ce3('0x23')](function(_0x5bc84a){logger[_0x9ce3('0xd')](_0x9ce3('0x24'),_0x19c17b);logger[_0x9ce3('0xf')](_0x9ce3('0x24'),_0x19c17b,JSON['stringify'](_0x5bc84a));_0x15ea99(_0x5bc84a);})['catch'](function(_0x56c6ed){logger['error'](_0x9ce3('0x24'),_0x56c6ed[_0x9ce3('0x14')],_0x19c17b);_0xc62d60(_this['error'](0x1f4,_0x56c6ed['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2b4f3a5..a956aa1 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 _0xf546=['save','update','emit','removeListener','register','faxInteraction:','./faxInteraction.events'];(function(_0x539608,_0x301ef3){var _0x462bd5=function(_0x322fd2){while(--_0x322fd2){_0x539608['push'](_0x539608['shift']());}};_0x462bd5(++_0x301ef3);}(_0xf546,0x180));var _0x6f54=function(_0x7d2a6a,_0x532ced){_0x7d2a6a=_0x7d2a6a-0x0;var _0x57a116=_0xf546[_0x7d2a6a];return _0x57a116;};'use strict';var FaxInteractionEvents=require(_0x6f54('0x0'));var events=[_0x6f54('0x1'),'remove',_0x6f54('0x2')];function createListener(_0x54499e,_0x20dd3e){return function(_0x308ef0){_0x20dd3e[_0x6f54('0x3')](_0x54499e,_0x308ef0);};}function removeListener(_0x1dec94,_0x4e6b87){return function(){FaxInteractionEvents[_0x6f54('0x4')](_0x1dec94,_0x4e6b87);};}exports[_0x6f54('0x5')]=function(_0x17b63c){for(var _0x57bcf5=0x0,_0x47272c=events['length'];_0x57bcf5<_0x47272c;_0x57bcf5++){var _0x412c03=events[_0x57bcf5];var _0x1839db=createListener(_0x6f54('0x6')+_0x412c03,_0x17b63c);FaxInteractionEvents['on'](_0x412c03,_0x1839db);}}; \ No newline at end of file +var _0x687b=['removeListener','length','faxInteraction:','./faxInteraction.events','remove','update','emit'];(function(_0x1f25ac,_0x4b7ee7){var _0x208c31=function(_0x52e1c0){while(--_0x52e1c0){_0x1f25ac['push'](_0x1f25ac['shift']());}};_0x208c31(++_0x4b7ee7);}(_0x687b,0x1ae));var _0xb687=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x687b[_0x29631f];return _0x486d87;};'use strict';var FaxInteractionEvents=require(_0xb687('0x0'));var events=['save',_0xb687('0x1'),_0xb687('0x2')];function createListener(_0x48176d,_0x578dfc){return function(_0x3affc1){_0x578dfc[_0xb687('0x3')](_0x48176d,_0x3affc1);};}function removeListener(_0x410d86,_0x8df328){return function(){FaxInteractionEvents[_0xb687('0x4')](_0x410d86,_0x8df328);};}exports['register']=function(_0x2cf26f){for(var _0x1f2378=0x0,_0x316c3d=events[_0xb687('0x5')];_0x1f2378<_0x316c3d;_0x1f2378++){var _0x3a224a=events[_0x1f2378];var _0xe19742=createListener(_0xb687('0x6')+_0x3a224a,_0x2cf26f);FaxInteractionEvents['on'](_0x3a224a,_0xe19742);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2212e40..734258a 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 _0x100d=['multer','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','addTags','put','/:id','tracked','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x100d,0x1c0));var _0xd100=function(_0x57b9ff,_0x5b5877){_0x57b9ff=_0x57b9ff-0x0;var _0x178972=_0x100d[_0x57b9ff];return _0x178972;};'use strict';var multer=require(_0xd100('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd100('0x1'));var express=require(_0xd100('0x2'));var router=express[_0xd100('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd100('0x4'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xd100('0x5')](),controller[_0xd100('0x6')]);router[_0xd100('0x7')](_0xd100('0x8'),auth[_0xd100('0x5')](),controller['describe']);router[_0xd100('0x7')]('/:id',auth[_0xd100('0x5')](),controller[_0xd100('0x9')]);router['get'](_0xd100('0xa'),auth[_0xd100('0x5')](),controller[_0xd100('0xb')]);router[_0xd100('0x7')](_0xd100('0xc'),auth[_0xd100('0x5')](),controller[_0xd100('0xd')]);router[_0xd100('0xe')]('/',auth[_0xd100('0x5')](),controller[_0xd100('0xf')]);router[_0xd100('0xe')]('/:id/messages',auth[_0xd100('0x5')](),controller[_0xd100('0x10')]);router['post']('/:id/tags',auth[_0xd100('0x5')](),interaction['tracked'](_0xd100('0x11'),'faxinteraction:addtags'),controller[_0xd100('0x12')]);router[_0xd100('0x13')](_0xd100('0x14'),auth[_0xd100('0x5')](),interaction[_0xd100('0x15')](_0xd100('0x11'),'faxinteraction:update'),controller[_0xd100('0x16')]);router[_0xd100('0x17')](_0xd100('0x14'),auth[_0xd100('0x5')](),interaction[_0xd100('0x15')]('fax',_0xd100('0x18')),controller[_0xd100('0x19')]);router['delete'](_0xd100('0x1a'),auth[_0xd100('0x5')](),controller[_0xd100('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5827=['tracked','fax','faxinteraction:addtags','put','/:id','update','delete','faxinteraction:destroy','destroy','/:id/tags','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','/:id/messages','post'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5827,0x12d));var _0x7582=function(_0x4aefb6,_0x2f462f){_0x4aefb6=_0x4aefb6-0x0;var _0x1ff1ab=_0x5827[_0x4aefb6];return _0x1ff1ab;};'use strict';var multer=require(_0x7582('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7582('0x1'));var express=require(_0x7582('0x2'));var router=express[_0x7582('0x3')]();var auth=require(_0x7582('0x4'));var interaction=require(_0x7582('0x5'));var config=require(_0x7582('0x6'));var controller=require(_0x7582('0x7'));router[_0x7582('0x8')]('/',auth[_0x7582('0x9')](),controller[_0x7582('0xa')]);router[_0x7582('0x8')](_0x7582('0xb'),auth[_0x7582('0x9')](),controller[_0x7582('0xc')]);router[_0x7582('0x8')]('/:id',auth[_0x7582('0x9')](),controller[_0x7582('0xd')]);router[_0x7582('0x8')]('/:id/messages',auth[_0x7582('0x9')](),controller[_0x7582('0xe')]);router[_0x7582('0x8')](_0x7582('0xf'),auth[_0x7582('0x9')](),controller['download']);router['post']('/',auth[_0x7582('0x9')](),controller['create']);router['post'](_0x7582('0x10'),auth[_0x7582('0x9')](),controller['addMessage']);router[_0x7582('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x7582('0x12')](_0x7582('0x13'),_0x7582('0x14')),controller['addTags']);router[_0x7582('0x15')](_0x7582('0x16'),auth[_0x7582('0x9')](),interaction[_0x7582('0x12')]('fax','faxinteraction:update'),controller[_0x7582('0x17')]);router[_0x7582('0x18')]('/:id',auth[_0x7582('0x9')](),interaction[_0x7582('0x12')](_0x7582('0x13'),_0x7582('0x19')),controller[_0x7582('0x1a')]);router['delete'](_0x7582('0x1b'),auth[_0x7582('0x9')](),controller['removeTags']);module[_0x7582('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3cb35d2..26384d9 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 _0x0553=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x30b355,_0x11fc94){var _0x3bdff2=function(_0x3dec3a){while(--_0x3dec3a){_0x30b355['push'](_0x30b355['shift']());}};_0x3bdff2(++_0x11fc94);}(_0x0553,0x88));var _0x3055=function(_0x31bd8b,_0x56fa02){_0x31bd8b=_0x31bd8b-0x0;var _0x1506e4=_0x0553[_0x31bd8b];return _0x1506e4;};'use strict';var Sequelize=require(_0x3055('0x0'));module[_0x3055('0x1')]={'body':{'type':Sequelize[_0x3055('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3055('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3055('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x3055('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3055('0x5')]}}; \ No newline at end of file +var _0xab93=['medium','BOOLEAN','ENUM','TEXT','DATE','sequelize'];(function(_0x2a279a,_0x585709){var _0x418f09=function(_0x2ad904){while(--_0x2ad904){_0x2a279a['push'](_0x2a279a['shift']());}};_0x418f09(++_0x585709);}(_0xab93,0x1a3));var _0x3ab9=function(_0x3a5a36,_0x14a97e){_0x3a5a36=_0x3a5a36-0x0;var _0x38761a=_0xab93[_0x3a5a36];return _0x38761a;};'use strict';var Sequelize=require(_0x3ab9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x3ab9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3ab9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3ab9('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3ab9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index fea1eaf..9ca5d62 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 _0x21c8=['json','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','stack','name','index','FaxMessage','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','findAll','rows','show','params','body','find','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','Contact','FaxInteractionId','UserId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','attachments','html-pdf','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end'];(function(_0x53dcc2,_0x13c7fa){var _0x13288c=function(_0x316d46){while(--_0x316d46){_0x53dcc2['push'](_0x53dcc2['shift']());}};_0x13288c(++_0x13c7fa);}(_0x21c8,0x1e0));var _0x821c=function(_0x58d8d7,_0x108377){_0x58d8d7=_0x58d8d7-0x0;var _0x339d20=_0x21c8[_0x58d8d7];return _0x339d20;};'use strict';var pdf=require(_0x821c('0x0'));var emlformat=require(_0x821c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x821c('0x2'));var rp=require('request-promise');var moment=require(_0x821c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x821c('0x4'));var util=require('util');var path=require(_0x821c('0x5'));var sox=require(_0x821c('0x6'));var csv=require(_0x821c('0x7'));var ejs=require(_0x821c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x821c('0x9'));var crypto=require('crypto');var jsforce=require(_0x821c('0xa'));var deskjs=require(_0x821c('0xb'));var toCsv=require(_0x821c('0x7'));var querystring=require('querystring');var Papa=require(_0x821c('0xc'));var Redis=require(_0x821c('0xd'));var authService=require(_0x821c('0xe'));var qs=require(_0x821c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x821c('0x10'))('api');var utils=require(_0x821c('0x11'));var config=require('../../config/environment');var db=require(_0x821c('0x12'))['db'];config['redis']=_['defaults'](config[_0x821c('0x13')],{'host':_0x821c('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x821c('0x13')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x821c('0x15'));var client=jayson[_0x821c('0x16')][_0x821c('0x17')]({'port':0x232c});var client9002=jayson[_0x821c('0x16')][_0x821c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x146f61,_0x5afe38,_0x16f59c){if(_0x16f59c){var _0x50357a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50357a['test'](_0x5afe38)){return _0x146f61;}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 _0x146f61;}}function respondWithRpcPromise(_0x3e81ca,_0x3fd72f,_0x2eba40,_0x1add58){return new BPromise(function(_0x52ea82,_0x2f2bf9){var _0x1958cf=_0x1add58||client;return _0x1958cf['request'](_0x3e81ca,_0x2eba40)[_0x821c('0x18')](function(_0x2e277b){logger[_0x821c('0x19')](_0x821c('0x1a'),_0x3fd72f,_0x821c('0x1b'));logger[_0x821c('0x1c')](_0x821c('0x1d'),_0x3fd72f,_0x821c('0x1b'),JSON[_0x821c('0x1e')](_0x2e277b));if(_0x2e277b[_0x821c('0x1f')]){if(_0x2e277b[_0x821c('0x1f')]['code']===0x1f4){logger[_0x821c('0x1f')](_0x821c('0x1a'),_0x3fd72f,_0x2e277b['error'][_0x821c('0x20')]);return _0x2f2bf9(_0x2e277b[_0x821c('0x1f')][_0x821c('0x20')]);}logger['error'](_0x821c('0x1a'),_0x3fd72f,_0x2e277b[_0x821c('0x1f')][_0x821c('0x20')]);return _0x52ea82(_0x2e277b[_0x821c('0x1f')][_0x821c('0x20')]);}else{logger[_0x821c('0x19')](_0x821c('0x1a'),_0x3fd72f,_0x821c('0x1b'));_0x52ea82(_0x2e277b['result']['message']);}})[_0x821c('0x21')](function(_0x2c997f){logger[_0x821c('0x1f')](_0x821c('0x1a'),_0x3fd72f,_0x2c997f);_0x2f2bf9(_0x2c997f);});});}function respondWithStatusCode(_0x1c08c0,_0x2ff48c){_0x2ff48c=_0x2ff48c||0xcc;return function(_0x540077){if(_0x540077){return _0x1c08c0[_0x821c('0x22')](_0x2ff48c);}return _0x1c08c0['status'](_0x2ff48c)[_0x821c('0x23')]();};}function respondWithResult(_0x1a3b6b,_0x19b27b){_0x19b27b=_0x19b27b||0xc8;return function(_0x4775c6){if(_0x4775c6){return _0x1a3b6b['status'](_0x19b27b)[_0x821c('0x24')](_0x4775c6);}};}function respondWithFilteredResult(_0xab345f,_0x522b92){return function(_0x5385dc){if(_0x5385dc){var _0x56da9e=_0x5385dc[_0x821c('0x25')],_0x59794f=_0x522b92[_0x821c('0x26')],_0x503f11=_0x522b92['offset']+_0x522b92[_0x821c('0x27')],_0x575f64;if(_0x503f11>=_0x56da9e){_0x503f11=_0x56da9e;_0x575f64=0xc8;}else{_0x575f64=0xce;}_0xab345f[_0x821c('0x28')](_0x575f64);return _0xab345f[_0x821c('0x29')](_0x821c('0x2a'),_0x59794f+'-'+_0x503f11+'/'+_0x56da9e)['json'](_0x5385dc);}return null;};}function patchUpdates(_0x366f77){return function(_0x5c132e){try{jsonpatch[_0x821c('0x2b')](_0x5c132e,_0x366f77,!![]);}catch(_0x220484){return BPromise[_0x821c('0x2c')](_0x220484);}return _0x5c132e['save']();};}function saveUpdates(_0x4be819,_0x405dcc){return function(_0x22332e){if(_0x22332e){return _0x22332e[_0x821c('0x2d')](_0x4be819)[_0x821c('0x18')](function(_0x188b29){return _0x188b29;});}return null;};}function removeEntity(_0xbb0c19,_0x5775b4){return function(_0x110810){if(_0x110810){return _0x110810[_0x821c('0x2e')]()[_0x821c('0x18')](function(){_0xbb0c19[_0x821c('0x28')](0xcc)[_0x821c('0x23')]();});}};}function handleEntityNotFound(_0x4e173a,_0x56e568){return function(_0xd4af36){if(!_0xd4af36){_0x4e173a['sendStatus'](0x194);}return _0xd4af36;};}function handleError(_0x427e96,_0x5e1b45){_0x5e1b45=_0x5e1b45||0x1f4;return function(_0x67fefd){logger[_0x821c('0x1f')](_0x67fefd[_0x821c('0x2f')]);if(_0x67fefd['name']){delete _0x67fefd[_0x821c('0x30')];}_0x427e96['status'](_0x5e1b45)['send'](_0x67fefd);};}exports[_0x821c('0x31')]=function(_0x3e2532,_0x5bdbbd){var _0x1abd3d={},_0x283112={},_0x5d20c0={'count':0x0,'rows':[]};var _0x48b806=db[_0x821c('0x32')][_0x821c('0x33')];_0x283112[_0x821c('0x34')]=_[_0x821c('0x35')](_0x48b806);_0x283112[_0x821c('0x36')]=_['keys'](_0x3e2532['query']);_0x283112[_0x821c('0x37')]=_[_0x821c('0x38')](_0x283112['model'],_0x283112[_0x821c('0x36')]);_0x1abd3d['attributes']=_['intersection'](_0x283112['model'],qs['fields'](_0x3e2532[_0x821c('0x36')][_0x821c('0x39')]));_0x1abd3d[_0x821c('0x3a')]=_0x1abd3d['attributes'][_0x821c('0x3b')]?_0x1abd3d[_0x821c('0x3a')]:_0x283112[_0x821c('0x34')];if(!_0x3e2532[_0x821c('0x36')][_0x821c('0x3c')](_0x821c('0x3d'))){_0x1abd3d[_0x821c('0x27')]=qs[_0x821c('0x27')](_0x3e2532[_0x821c('0x36')][_0x821c('0x27')]);_0x1abd3d[_0x821c('0x26')]=qs[_0x821c('0x26')](_0x3e2532[_0x821c('0x36')]['offset']);}_0x1abd3d[_0x821c('0x3e')]=qs[_0x821c('0x3f')](_0x3e2532[_0x821c('0x36')][_0x821c('0x3f')]);_0x1abd3d[_0x821c('0x40')]=qs[_0x821c('0x37')](_[_0x821c('0x41')](_0x3e2532['query'],_0x283112[_0x821c('0x37')]));if(_0x3e2532[_0x821c('0x36')][_0x821c('0x42')]){_0x1abd3d[_0x821c('0x40')]=_[_0x821c('0x43')](_0x1abd3d[_0x821c('0x40')],{'$or':_[_0x821c('0x44')](_0x48b806,function(_0x258516){if(_0x258516[_0x821c('0x45')][_0x821c('0x46')]!==_0x821c('0x47')){var _0x48d97d={};_0x48d97d[_0x258516[_0x821c('0x48')]]={'$like':'%'+_0x3e2532[_0x821c('0x36')][_0x821c('0x42')]+'%'};return _0x48d97d;}})});}_0x1abd3d=_[_0x821c('0x43')]({},_0x1abd3d,_0x3e2532[_0x821c('0x49')]);var _0x28da34={'where':_0x1abd3d[_0x821c('0x40')]};return db['FaxMessage'][_0x821c('0x25')](_0x28da34)[_0x821c('0x18')](function(_0x48a59a){_0x5d20c0[_0x821c('0x25')]=_0x48a59a;if(_0x3e2532['query']['includeAll']){_0x1abd3d[_0x821c('0x4a')]=[{'all':!![]}];}return db[_0x821c('0x32')][_0x821c('0x4b')](_0x1abd3d);})['then'](function(_0x1f63b9){_0x5d20c0[_0x821c('0x4c')]=_0x1f63b9;return _0x5d20c0;})[_0x821c('0x18')](respondWithFilteredResult(_0x5bdbbd,_0x1abd3d))[_0x821c('0x21')](handleError(_0x5bdbbd,null));};exports[_0x821c('0x4d')]=function(_0x5a25f6,_0x1904bc){var _0x10be57={'raw':!![],'where':{'id':_0x5a25f6[_0x821c('0x4e')]['id']}},_0x5881d8={};_0x5881d8[_0x821c('0x34')]=_[_0x821c('0x35')](db[_0x821c('0x32')][_0x821c('0x33')]);_0x5881d8[_0x821c('0x36')]=_[_0x821c('0x35')](_0x5a25f6[_0x821c('0x36')]);_0x5881d8['filters']=_[_0x821c('0x38')](_0x5881d8[_0x821c('0x34')],_0x5881d8[_0x821c('0x36')]);_0x10be57[_0x821c('0x3a')]=_[_0x821c('0x38')](_0x5881d8['model'],qs[_0x821c('0x39')](_0x5a25f6['query'][_0x821c('0x39')]));_0x10be57[_0x821c('0x3a')]=_0x10be57['attributes']['length']?_0x10be57[_0x821c('0x3a')]:_0x5881d8[_0x821c('0x34')];if(_0x5a25f6[_0x821c('0x36')]['includeAll']){_0x10be57[_0x821c('0x4a')]=[{'all':!![]}];}_0x10be57=_[_0x821c('0x43')]({},_0x10be57,_0x5a25f6[_0x821c('0x49')]);return db['FaxMessage']['find'](_0x10be57)[_0x821c('0x18')](handleEntityNotFound(_0x1904bc,null))['then'](respondWithResult(_0x1904bc,null))['catch'](handleError(_0x1904bc,null));};exports[_0x821c('0x2d')]=function(_0x1cfe91,_0xdb4332){if(_0x1cfe91[_0x821c('0x4f')]['id']){delete _0x1cfe91[_0x821c('0x4f')]['id'];}return db[_0x821c('0x32')][_0x821c('0x50')]({'where':{'id':_0x1cfe91[_0x821c('0x4e')]['id']}})[_0x821c('0x18')](handleEntityNotFound(_0xdb4332,null))[_0x821c('0x18')](saveUpdates(_0x1cfe91[_0x821c('0x4f')],null))['then'](respondWithResult(_0xdb4332,null))[_0x821c('0x21')](handleError(_0xdb4332,null));};exports['destroy']=function(_0x3a72d9,_0x1bddc3){return db[_0x821c('0x32')]['find']({'where':{'id':_0x3a72d9[_0x821c('0x4e')]['id']}})[_0x821c('0x18')](handleEntityNotFound(_0x1bddc3,null))[_0x821c('0x18')](removeEntity(_0x1bddc3,null))['catch'](handleError(_0x1bddc3,null));};exports[_0x821c('0x51')]=function(_0x5d791a,_0x47a193){return db[_0x821c('0x32')][_0x821c('0x51')]()[_0x821c('0x18')](respondWithResult(_0x47a193,null))['catch'](handleError(_0x47a193,null));};var interaction_log=require(_0x821c('0x10'))('fax-interactions');exports[_0x821c('0x52')]=function(_0x323d0a,_0x483a5b,_0x2b16f8){var _0x489028={'channel':_0x821c('0x53')};if(_0x323d0a[_0x821c('0x4f')]['id']){delete _0x323d0a[_0x821c('0x4f')]['id'];}_0x323d0a[_0x821c('0x4f')][_0x821c('0x54')]=!![];_0x323d0a[_0x821c('0x4f')][_0x821c('0x55')]=moment()[_0x821c('0x56')](_0x821c('0x57'));_0x323d0a[_0x821c('0x4f')]['UserId']=_0x323d0a[_0x821c('0x4f')]['UserId']||_0x323d0a[_0x821c('0x58')]['id'];return db[_0x821c('0x32')][_0x821c('0x50')]({'where':{'id':_0x323d0a[_0x821c('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0x821c('0x59')],'as':_0x821c('0x5a')}]})[_0x821c('0x18')](handleEntityNotFound(_0x483a5b,null))['then'](saveUpdates(_0x323d0a[_0x821c('0x4f')],null))[_0x821c('0x18')](function(_0x30b58a){if(_0x30b58a){_0x489028[_0x821c('0x20')]=_0x30b58a['get']({'plain':!![]});return db['FaxInteraction'][_0x821c('0x50')]({'where':{'id':_0x30b58a[_0x821c('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x483a5b,null))[_0x821c('0x18')](function(_0x272589){if(_0x272589){return _0x272589[_0x821c('0x2d')]({'UserId':_0x323d0a[_0x821c('0x4f')][_0x821c('0x5c')],'read1stAt':_[_0x821c('0x5d')](_0x272589[_0x821c('0x5e')])?moment()['format'](_0x821c('0x57')):undefined});}return null;})[_0x821c('0x18')](function(_0x445059){if(_0x445059){_0x489028[_0x821c('0x5f')]=_0x445059[_0x821c('0x60')]({'plain':!![]});interaction_log[_0x821c('0x19')](_0x821c('0x61'),_0x323d0a[_0x821c('0x58')]['id'],_0x323d0a[_0x821c('0x58')][_0x821c('0x30')],_0x323d0a[_0x821c('0x58')][_0x821c('0x62')],_0x489028['interaction']['id'],_0x323d0a[_0x821c('0x4f')]?JSON[_0x821c('0x1e')](_0x323d0a[_0x821c('0x4f')]):_0x821c('0x63'));return respondWithRpcPromise(_0x821c('0x64'),_0x821c('0x65'),_0x489028);}return null;})[_0x821c('0x18')](function(_0x54e3de){if(_0x54e3de){if(_0x323d0a[_0x821c('0x4f')][_0x821c('0x66')]){_0x489028[_0x821c('0x20')][_0x821c('0x67')]=util[_0x821c('0x56')](_0x821c('0x68'),_0x323d0a[_0x821c('0x58')][_0x821c('0x30')]);_0x489028['message'][_0x821c('0x69')]=_0x489028['channel'];_0x489028[_0x821c('0x20')][_0x821c('0x6a')]=_0x821c('0x52');return respondWithRpcPromise(_0x821c('0x6b'),_0x821c('0x6b'),{'event':_0x821c('0x6c'),'message':_0x489028[_0x821c('0x20')]},client9002)[_0x821c('0x18')](function(){return _0x489028;});}return _0x489028;}return null;})[_0x821c('0x18')](respondWithResult(_0x483a5b,null))[_0x821c('0x21')](handleError(_0x483a5b,null));};var interaction_log=require(_0x821c('0x10'))('fax-interactions');exports[_0x821c('0x2c')]=function(_0x2e1bd4,_0x2481c5,_0x318e46){var _0x2b8b01={'agent':{},'channel':_0x821c('0x53')};if(_0x2e1bd4[_0x821c('0x4f')]['id']){delete _0x2e1bd4[_0x821c('0x4f')]['id'];}_0x2e1bd4['body'][_0x821c('0x5c')]=_0x2e1bd4[_0x821c('0x4f')][_0x821c('0x5c')]||_0x2e1bd4['user']['id'];_0x2b8b01[_0x821c('0x6d')]['id']=_0x2e1bd4[_0x821c('0x4f')][_0x821c('0x5c')];return db['FaxMessage'][_0x821c('0x50')]({'where':{'id':_0x2e1bd4[_0x821c('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2481c5,null))['then'](function(_0x597b71){if(_0x597b71){_0x2b8b01['message']=_0x597b71[_0x821c('0x60')]({'plain':!![]});return db[_0x821c('0x6e')]['find']({'where':{'id':_0x597b71['FaxInteractionId']}});}return null;})[_0x821c('0x18')](handleEntityNotFound(_0x2481c5,null))['then'](function(_0xb8e39c){if(_0xb8e39c){_0x2b8b01['interaction']=_0xb8e39c[_0x821c('0x60')]({'plain':!![]});interaction_log[_0x821c('0x19')](_0x821c('0x6f'),_0x2e1bd4['user']['id'],_0x2e1bd4[_0x821c('0x58')][_0x821c('0x30')],_0x2e1bd4[_0x821c('0x58')][_0x821c('0x62')],_0x2b8b01[_0x821c('0x5f')]['id'],_0x2e1bd4[_0x821c('0x4f')]?JSON[_0x821c('0x1e')](_0x2e1bd4[_0x821c('0x4f')]):_0x821c('0x63'));return respondWithRpcPromise(_0x821c('0x70'),_0x821c('0x71'),_0x2b8b01);}return null;})['then'](function(_0x3c89b7){if(_0x3c89b7){_0x3c89b7[_0x821c('0x20')]['interface']=util['format'](_0x821c('0x68'),_0x2e1bd4[_0x821c('0x58')]['name']);_0x3c89b7['message'][_0x821c('0x69')]=_0x2b8b01[_0x821c('0x69')];_0x3c89b7[_0x821c('0x20')][_0x821c('0x6a')]=_0x821c('0x2c');respondWithRpcPromise(_0x821c('0x6b'),_0x821c('0x6b'),{'event':_0x821c('0x72'),'message':_0x3c89b7[_0x821c('0x20')]},client9002);return _0x2b8b01;}return null;})[_0x821c('0x18')](respondWithResult(_0x2481c5,null))[_0x821c('0x21')](handleError(_0x2481c5,null));};exports[_0x821c('0x73')]=function(_0x4a7124,_0x3fffd2){var _0x3b2b71;return db[_0x821c('0x32')]['create'](_0x4a7124['body'],{})[_0x821c('0x18')](function(_0x44b705){_0x3b2b71=_0x44b705;return db[_0x821c('0x59')][_0x821c('0x74')]({'where':{'id':_0x3b2b71[_0x821c('0x75')]}});})[_0x821c('0x18')](function(_0x546ddc){if(_['isNil'](_0x546ddc)){return;}else{_0x3b2b71['fax']=_0x546ddc[_0x821c('0x53')];return db[_0x821c('0x76')][_0x821c('0x74')]({'where':{'id':_0x3b2b71[_0x821c('0x77')]}});}})[_0x821c('0x18')](function(_0x398176){return respondWithRpcPromise(_0x821c('0x78'),'SendFax',{'FaxAccountId':_['isNil'](_0x4a7124[_0x821c('0x4f')])?undefined:_0x4a7124['body'][_0x821c('0x79')],'path':_[_0x821c('0x5d')](_0x398176)?undefined:util['format'](_0x821c('0x7a'),_0x398176[_0x821c('0x7b')]),'fax':_[_0x821c('0x5d')](_0x3b2b71['fax'])?undefined:_0x3b2b71['fax'],'AttachmentId':_0x3b2b71[_0x821c('0x77')]},client9002);})[_0x821c('0x18')](respondWithResult(_0x3fffd2,0xc9))[_0x821c('0x21')](handleError(_0x3fffd2,null));};exports[_0x821c('0x7c')]=function(_0x2b2f3c,_0x42e0fb){var _0x19ae33=path[_0x821c('0x7d')](config[_0x821c('0x7e')],'server',_0x821c('0x7f'),_0x821c('0x80'));return db[_0x821c('0x32')][_0x821c('0x50')]({'where':{'id':_0x2b2f3c[_0x821c('0x4e')]['id']},'include':[{'model':db[_0x821c('0x76')],'as':_0x821c('0x76')}]})[_0x821c('0x18')](handleEntityNotFound(_0x42e0fb,null))['then'](function(_0x56ad0b){if(_0x56ad0b){return _0x42e0fb[_0x821c('0x7c')](path[_0x821c('0x7d')](_0x19ae33,_0x56ad0b['Attachment'][_0x821c('0x7b')]));}})[_0x821c('0x21')](handleError(_0x42e0fb,null));}; \ No newline at end of file +var _0xc79c=['pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','destroy','describe','accept','fax','read','format','UserId','CmContact','FaxInteraction','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','manual','channel','event','EventManager','acceptmessage','fax-interactions','agent','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','basename','download','join','root','files','attachments','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xc79c,0x13c));var _0xcc79=function(_0x469350,_0x17c356){_0x469350=_0x469350-0x0;var _0x22d28e=_0xc79c[_0x469350];return _0x22d28e;};'use strict';var pdf=require(_0xcc79('0x0'));var emlformat=require(_0xcc79('0x1'));var rimraf=require(_0xcc79('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc79('0x3'));var rp=require(_0xcc79('0x4'));var moment=require(_0xcc79('0x5'));var BPromise=require(_0xcc79('0x6'));var Mustache=require(_0xcc79('0x7'));var util=require(_0xcc79('0x8'));var path=require('path');var sox=require(_0xcc79('0x9'));var csv=require(_0xcc79('0xa'));var ejs=require(_0xcc79('0xb'));var fs=require('fs');var _=require(_0xcc79('0xc'));var squel=require(_0xcc79('0xd'));var crypto=require(_0xcc79('0xe'));var jsforce=require(_0xcc79('0xf'));var deskjs=require(_0xcc79('0x10'));var toCsv=require(_0xcc79('0xa'));var querystring=require('querystring');var Papa=require(_0xcc79('0x11'));var Redis=require(_0xcc79('0x12'));var authService=require(_0xcc79('0x13'));var qs=require(_0xcc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcc79('0x15'));var config=require('../../config/environment');var db=require(_0xcc79('0x16'))['db'];config[_0xcc79('0x17')]=_['defaults'](config[_0xcc79('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc79('0x18'))(new Redis(config['redis']));require(_0xcc79('0x19'))[_0xcc79('0x1a')](socket);var jayson=require(_0xcc79('0x1b'));var client=jayson[_0xcc79('0x1c')][_0xcc79('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xcc79('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x494dfd,_0x5d6f9a,_0x25a8aa){if(_0x25a8aa){var _0x5cd22b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5cd22b[_0xcc79('0x1e')](_0x5d6f9a)){return _0x494dfd;}else{throw new Error(_0xcc79('0x1f'));}}else{return _0x494dfd;}}function respondWithRpcPromise(_0x3051de,_0x267a85,_0x4d43b0,_0x4d4915){return new BPromise(function(_0x7bb1ba,_0x42666b){var _0x3aba4b=_0x4d4915||client;return _0x3aba4b[_0xcc79('0x20')](_0x3051de,_0x4d43b0)['then'](function(_0x4b6ad9){logger['info'](_0xcc79('0x21'),_0x267a85,_0xcc79('0x22'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x267a85,_0xcc79('0x22'),JSON[_0xcc79('0x23')](_0x4b6ad9));if(_0x4b6ad9[_0xcc79('0x24')]){if(_0x4b6ad9[_0xcc79('0x24')]['code']===0x1f4){logger[_0xcc79('0x24')](_0xcc79('0x21'),_0x267a85,_0x4b6ad9[_0xcc79('0x24')][_0xcc79('0x25')]);return _0x42666b(_0x4b6ad9[_0xcc79('0x24')][_0xcc79('0x25')]);}logger[_0xcc79('0x24')](_0xcc79('0x21'),_0x267a85,_0x4b6ad9[_0xcc79('0x24')][_0xcc79('0x25')]);return _0x7bb1ba(_0x4b6ad9[_0xcc79('0x24')][_0xcc79('0x25')]);}else{logger[_0xcc79('0x26')]('FaxMessage,\x20%s,\x20%s',_0x267a85,'request\x20sent');_0x7bb1ba(_0x4b6ad9[_0xcc79('0x27')][_0xcc79('0x25')]);}})['catch'](function(_0x41fb76){logger[_0xcc79('0x24')](_0xcc79('0x21'),_0x267a85,_0x41fb76);_0x42666b(_0x41fb76);});});}function respondWithStatusCode(_0x23def3,_0x3838dc){_0x3838dc=_0x3838dc||0xcc;return function(_0x211cd6){if(_0x211cd6){return _0x23def3[_0xcc79('0x28')](_0x3838dc);}return _0x23def3[_0xcc79('0x29')](_0x3838dc)['end']();};}function respondWithResult(_0x421fce,_0x444407){_0x444407=_0x444407||0xc8;return function(_0x140af8){if(_0x140af8){return _0x421fce[_0xcc79('0x29')](_0x444407)[_0xcc79('0x2a')](_0x140af8);}};}function respondWithFilteredResult(_0x414783,_0x318a78){return function(_0x324d07){if(_0x324d07){var _0x1b0f16=_0x324d07[_0xcc79('0x2b')],_0x42cf00=_0x318a78[_0xcc79('0x2c')],_0x3eb863=_0x318a78[_0xcc79('0x2c')]+_0x318a78[_0xcc79('0x2d')],_0x468f9b;if(_0x3eb863>=_0x1b0f16){_0x3eb863=_0x1b0f16;_0x468f9b=0xc8;}else{_0x468f9b=0xce;}_0x414783['status'](_0x468f9b);return _0x414783['set'](_0xcc79('0x2e'),_0x42cf00+'-'+_0x3eb863+'/'+_0x1b0f16)[_0xcc79('0x2a')](_0x324d07);}return null;};}function patchUpdates(_0x2149df){return function(_0x4a110b){try{jsonpatch[_0xcc79('0x2f')](_0x4a110b,_0x2149df,!![]);}catch(_0x2be24b){return BPromise[_0xcc79('0x30')](_0x2be24b);}return _0x4a110b[_0xcc79('0x31')]();};}function saveUpdates(_0xd5172e,_0x2cbc73){return function(_0x46df75){if(_0x46df75){return _0x46df75[_0xcc79('0x32')](_0xd5172e)[_0xcc79('0x33')](function(_0x408f4a){return _0x408f4a;});}return null;};}function removeEntity(_0x436aa0,_0x10bb2f){return function(_0x139b69){if(_0x139b69){return _0x139b69['destroy']()['then'](function(){_0x436aa0[_0xcc79('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4ec4,_0xabf986){return function(_0x4c51de){if(!_0x4c51de){_0x5a4ec4['sendStatus'](0x194);}return _0x4c51de;};}function handleError(_0x491906,_0x547478){_0x547478=_0x547478||0x1f4;return function(_0x3320eb){logger[_0xcc79('0x24')](_0x3320eb[_0xcc79('0x34')]);if(_0x3320eb[_0xcc79('0x35')]){delete _0x3320eb[_0xcc79('0x35')];}_0x491906['status'](_0x547478)[_0xcc79('0x36')](_0x3320eb);};}exports[_0xcc79('0x37')]=function(_0x3d67e3,_0x541480){var _0x7ed62c={},_0x4380f3={},_0x1da1c6={'count':0x0,'rows':[]};var _0x111ffc=db[_0xcc79('0x38')][_0xcc79('0x39')];_0x4380f3[_0xcc79('0x3a')]=_[_0xcc79('0x3b')](_0x111ffc);_0x4380f3['query']=_[_0xcc79('0x3b')](_0x3d67e3[_0xcc79('0x3c')]);_0x4380f3['filters']=_[_0xcc79('0x3d')](_0x4380f3['model'],_0x4380f3[_0xcc79('0x3c')]);_0x7ed62c[_0xcc79('0x3e')]=_[_0xcc79('0x3d')](_0x4380f3['model'],qs[_0xcc79('0x3f')](_0x3d67e3[_0xcc79('0x3c')]['fields']));_0x7ed62c[_0xcc79('0x3e')]=_0x7ed62c[_0xcc79('0x3e')][_0xcc79('0x40')]?_0x7ed62c[_0xcc79('0x3e')]:_0x4380f3[_0xcc79('0x3a')];if(!_0x3d67e3[_0xcc79('0x3c')][_0xcc79('0x41')](_0xcc79('0x42'))){_0x7ed62c[_0xcc79('0x2d')]=qs[_0xcc79('0x2d')](_0x3d67e3[_0xcc79('0x3c')][_0xcc79('0x2d')]);_0x7ed62c['offset']=qs[_0xcc79('0x2c')](_0x3d67e3[_0xcc79('0x3c')][_0xcc79('0x2c')]);}_0x7ed62c[_0xcc79('0x43')]=qs['sort'](_0x3d67e3['query'][_0xcc79('0x44')]);_0x7ed62c[_0xcc79('0x45')]=qs[_0xcc79('0x46')](_[_0xcc79('0x47')](_0x3d67e3[_0xcc79('0x3c')],_0x4380f3[_0xcc79('0x46')]));if(_0x3d67e3['query'][_0xcc79('0x48')]){_0x7ed62c[_0xcc79('0x45')]=_[_0xcc79('0x49')](_0x7ed62c[_0xcc79('0x45')],{'$or':_[_0xcc79('0x4a')](_0x111ffc,function(_0x1e3beb){if(_0x1e3beb[_0xcc79('0x4b')][_0xcc79('0x4c')]!==_0xcc79('0x4d')){var _0x5c4349={};_0x5c4349[_0x1e3beb['field']]={'$like':'%'+_0x3d67e3[_0xcc79('0x3c')][_0xcc79('0x48')]+'%'};return _0x5c4349;}})});}_0x7ed62c=_[_0xcc79('0x49')]({},_0x7ed62c,_0x3d67e3[_0xcc79('0x4e')]);var _0x39d702={'where':_0x7ed62c[_0xcc79('0x45')]};return db['FaxMessage'][_0xcc79('0x2b')](_0x39d702)['then'](function(_0x425e80){_0x1da1c6[_0xcc79('0x2b')]=_0x425e80;if(_0x3d67e3[_0xcc79('0x3c')][_0xcc79('0x4f')]){_0x7ed62c[_0xcc79('0x50')]=[{'all':!![]}];}return db[_0xcc79('0x38')][_0xcc79('0x51')](_0x7ed62c);})[_0xcc79('0x33')](function(_0xc23fd6){_0x1da1c6['rows']=_0xc23fd6;return _0x1da1c6;})[_0xcc79('0x33')](respondWithFilteredResult(_0x541480,_0x7ed62c))[_0xcc79('0x52')](handleError(_0x541480,null));};exports[_0xcc79('0x53')]=function(_0x3e6e2a,_0x2cb6da){var _0xdda035={'raw':!![],'where':{'id':_0x3e6e2a[_0xcc79('0x54')]['id']}},_0x428fa0={};_0x428fa0[_0xcc79('0x3a')]=_[_0xcc79('0x3b')](db['FaxMessage'][_0xcc79('0x39')]);_0x428fa0['query']=_[_0xcc79('0x3b')](_0x3e6e2a[_0xcc79('0x3c')]);_0x428fa0['filters']=_['intersection'](_0x428fa0[_0xcc79('0x3a')],_0x428fa0['query']);_0xdda035[_0xcc79('0x3e')]=_[_0xcc79('0x3d')](_0x428fa0[_0xcc79('0x3a')],qs[_0xcc79('0x3f')](_0x3e6e2a['query'][_0xcc79('0x3f')]));_0xdda035[_0xcc79('0x3e')]=_0xdda035[_0xcc79('0x3e')][_0xcc79('0x40')]?_0xdda035[_0xcc79('0x3e')]:_0x428fa0['model'];if(_0x3e6e2a[_0xcc79('0x3c')][_0xcc79('0x4f')]){_0xdda035['include']=[{'all':!![]}];}_0xdda035=_[_0xcc79('0x49')]({},_0xdda035,_0x3e6e2a[_0xcc79('0x4e')]);return db[_0xcc79('0x38')][_0xcc79('0x55')](_0xdda035)[_0xcc79('0x33')](handleEntityNotFound(_0x2cb6da,null))[_0xcc79('0x33')](respondWithResult(_0x2cb6da,null))['catch'](handleError(_0x2cb6da,null));};exports[_0xcc79('0x32')]=function(_0x6a5c4a,_0x1f6044){if(_0x6a5c4a[_0xcc79('0x56')]['id']){delete _0x6a5c4a[_0xcc79('0x56')]['id'];}return db['FaxMessage'][_0xcc79('0x55')]({'where':{'id':_0x6a5c4a['params']['id']}})['then'](handleEntityNotFound(_0x1f6044,null))[_0xcc79('0x33')](saveUpdates(_0x6a5c4a[_0xcc79('0x56')],null))['then'](respondWithResult(_0x1f6044,null))[_0xcc79('0x52')](handleError(_0x1f6044,null));};exports[_0xcc79('0x57')]=function(_0x3d15f1,_0x85862d){return db[_0xcc79('0x38')][_0xcc79('0x55')]({'where':{'id':_0x3d15f1[_0xcc79('0x54')]['id']}})[_0xcc79('0x33')](handleEntityNotFound(_0x85862d,null))[_0xcc79('0x33')](removeEntity(_0x85862d,null))[_0xcc79('0x52')](handleError(_0x85862d,null));};exports[_0xcc79('0x58')]=function(_0x3be836,_0x383d25){return db['FaxMessage'][_0xcc79('0x58')]()[_0xcc79('0x33')](respondWithResult(_0x383d25,null))['catch'](handleError(_0x383d25,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xcc79('0x59')]=function(_0x3e1d03,_0x3ed98f,_0x37a263){var _0x15bf22={'channel':_0xcc79('0x5a')};if(_0x3e1d03[_0xcc79('0x56')]['id']){delete _0x3e1d03['body']['id'];}_0x3e1d03[_0xcc79('0x56')][_0xcc79('0x5b')]=!![];_0x3e1d03['body']['readAt']=moment()[_0xcc79('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1d03[_0xcc79('0x56')][_0xcc79('0x5d')]=_0x3e1d03[_0xcc79('0x56')]['UserId']||_0x3e1d03['user']['id'];return db[_0xcc79('0x38')][_0xcc79('0x55')]({'where':{'id':_0x3e1d03['params']['id'],'UserId':null},'include':[{'model':db[_0xcc79('0x5e')],'as':'Contact'}]})[_0xcc79('0x33')](handleEntityNotFound(_0x3ed98f,null))[_0xcc79('0x33')](saveUpdates(_0x3e1d03[_0xcc79('0x56')],null))[_0xcc79('0x33')](function(_0x2de94f){if(_0x2de94f){_0x15bf22[_0xcc79('0x25')]=_0x2de94f['get']({'plain':!![]});return db[_0xcc79('0x5f')][_0xcc79('0x55')]({'where':{'id':_0x2de94f[_0xcc79('0x60')]}});}return null;})[_0xcc79('0x33')](handleEntityNotFound(_0x3ed98f,null))[_0xcc79('0x33')](function(_0x29056a){if(_0x29056a){return _0x29056a[_0xcc79('0x32')]({'UserId':_0x3e1d03[_0xcc79('0x56')][_0xcc79('0x5d')],'read1stAt':_['isNil'](_0x29056a['read1stAt'])?moment()[_0xcc79('0x5c')](_0xcc79('0x61')):undefined});}return null;})[_0xcc79('0x33')](function(_0x5a7ebd){if(_0x5a7ebd){_0x15bf22['interaction']=_0x5a7ebd['get']({'plain':!![]});interaction_log['info'](_0xcc79('0x62'),_0x3e1d03[_0xcc79('0x63')]['id'],_0x3e1d03['user'][_0xcc79('0x35')],_0x3e1d03[_0xcc79('0x63')][_0xcc79('0x64')],_0x15bf22[_0xcc79('0x65')]['id'],_0x3e1d03['body']?JSON[_0xcc79('0x23')](_0x3e1d03[_0xcc79('0x56')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x15bf22);}return null;})[_0xcc79('0x33')](function(_0x5e40d0){if(_0x5e40d0){if(_0x3e1d03[_0xcc79('0x56')][_0xcc79('0x66')]){_0x15bf22[_0xcc79('0x25')]['interface']=util[_0xcc79('0x5c')]('SIP/%s',_0x3e1d03[_0xcc79('0x63')][_0xcc79('0x35')]);_0x15bf22[_0xcc79('0x25')][_0xcc79('0x67')]=_0x15bf22[_0xcc79('0x67')];_0x15bf22['message'][_0xcc79('0x68')]=_0xcc79('0x59');return respondWithRpcPromise(_0xcc79('0x69'),_0xcc79('0x69'),{'event':_0xcc79('0x6a'),'message':_0x15bf22['message']},client9002)[_0xcc79('0x33')](function(){return _0x15bf22;});}return _0x15bf22;}return null;})[_0xcc79('0x33')](respondWithResult(_0x3ed98f,null))[_0xcc79('0x52')](handleError(_0x3ed98f,null));};var interaction_log=require('../../config/logger')(_0xcc79('0x6b'));exports[_0xcc79('0x30')]=function(_0x81a229,_0x34bff0,_0x2045d7){var _0xbf82b5={'agent':{},'channel':_0xcc79('0x5a')};if(_0x81a229[_0xcc79('0x56')]['id']){delete _0x81a229[_0xcc79('0x56')]['id'];}_0x81a229[_0xcc79('0x56')][_0xcc79('0x5d')]=_0x81a229['body'][_0xcc79('0x5d')]||_0x81a229['user']['id'];_0xbf82b5[_0xcc79('0x6c')]['id']=_0x81a229[_0xcc79('0x56')][_0xcc79('0x5d')];return db['FaxMessage']['find']({'where':{'id':_0x81a229[_0xcc79('0x54')]['id'],'UserId':null}})[_0xcc79('0x33')](handleEntityNotFound(_0x34bff0,null))[_0xcc79('0x33')](function(_0x555c72){if(_0x555c72){_0xbf82b5[_0xcc79('0x25')]=_0x555c72[_0xcc79('0x6d')]({'plain':!![]});return db[_0xcc79('0x5f')][_0xcc79('0x55')]({'where':{'id':_0x555c72[_0xcc79('0x60')]}});}return null;})[_0xcc79('0x33')](handleEntityNotFound(_0x34bff0,null))['then'](function(_0x3df418){if(_0x3df418){_0xbf82b5[_0xcc79('0x65')]=_0x3df418['get']({'plain':!![]});interaction_log['info'](_0xcc79('0x6e'),_0x81a229[_0xcc79('0x63')]['id'],_0x81a229[_0xcc79('0x63')][_0xcc79('0x35')],_0x81a229[_0xcc79('0x63')][_0xcc79('0x64')],_0xbf82b5['interaction']['id'],_0x81a229[_0xcc79('0x56')]?JSON['stringify'](_0x81a229[_0xcc79('0x56')]):_0xcc79('0x6f'));return respondWithRpcPromise(_0xcc79('0x70'),_0xcc79('0x71'),_0xbf82b5);}return null;})[_0xcc79('0x33')](function(_0x54bf47){if(_0x54bf47){_0x54bf47[_0xcc79('0x25')][_0xcc79('0x72')]=util[_0xcc79('0x5c')](_0xcc79('0x73'),_0x81a229[_0xcc79('0x63')][_0xcc79('0x35')]);_0x54bf47['message']['channel']=_0xbf82b5[_0xcc79('0x67')];_0x54bf47[_0xcc79('0x25')][_0xcc79('0x68')]=_0xcc79('0x30');respondWithRpcPromise(_0xcc79('0x69'),_0xcc79('0x69'),{'event':_0xcc79('0x74'),'message':_0x54bf47[_0xcc79('0x25')]},client9002);return _0xbf82b5;}return null;})['then'](respondWithResult(_0x34bff0,null))[_0xcc79('0x52')](handleError(_0x34bff0,null));};exports[_0xcc79('0x75')]=function(_0x5d024d,_0x2ee4fd){var _0x4fc8aa;return db[_0xcc79('0x38')][_0xcc79('0x75')](_0x5d024d[_0xcc79('0x56')],{})[_0xcc79('0x33')](function(_0x332e08){_0x4fc8aa=_0x332e08;return db['CmContact'][_0xcc79('0x76')]({'where':{'id':_0x4fc8aa['ContactId']}});})['then'](function(_0x14fea4){if(_[_0xcc79('0x77')](_0x14fea4)){return;}else{_0x4fc8aa['fax']=_0x14fea4[_0xcc79('0x5a')];return db[_0xcc79('0x78')][_0xcc79('0x76')]({'where':{'id':_0x4fc8aa[_0xcc79('0x79')]}});}})['then'](function(_0xe4afc5){return respondWithRpcPromise(_0xcc79('0x7a'),_0xcc79('0x7a'),{'FaxAccountId':_['isNil'](_0x5d024d[_0xcc79('0x56')])?undefined:_0x5d024d[_0xcc79('0x56')]['FaxAccountId'],'path':_['isNil'](_0xe4afc5)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0xe4afc5[_0xcc79('0x7b')]),'fax':_[_0xcc79('0x77')](_0x4fc8aa['fax'])?undefined:_0x4fc8aa[_0xcc79('0x5a')],'AttachmentId':_0x4fc8aa[_0xcc79('0x79')]},client9002);})[_0xcc79('0x33')](respondWithResult(_0x2ee4fd,0xc9))[_0xcc79('0x52')](handleError(_0x2ee4fd,null));};exports[_0xcc79('0x7c')]=function(_0x1fb561,_0x513881){var _0x37426e=path[_0xcc79('0x7d')](config[_0xcc79('0x7e')],'server',_0xcc79('0x7f'),_0xcc79('0x80'));return db['FaxMessage']['find']({'where':{'id':_0x1fb561[_0xcc79('0x54')]['id']},'include':[{'model':db[_0xcc79('0x78')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x513881,null))['then'](function(_0x11a424){if(_0x11a424){return _0x513881[_0xcc79('0x7c')](path[_0xcc79('0x7d')](_0x37426e,_0x11a424['Attachment'][_0xcc79('0x7b')]));}})['catch'](handleError(_0x513881,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index dca0c6f..d31b601 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 _0xd9aa=['hook','exports','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd9aa,0x7a));var _0xad9a=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xd9aa[_0x20a558];return _0x53d3f7;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xad9a('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xad9a('0x1'),'afterUpdate':_0xad9a('0x2'),'afterDestroy':_0xad9a('0x3')};function emitEvent(_0x308bad){return function(_0x25f645,_0x4fd9aa,_0x4f2fa9){FaxMessageEvents[_0xad9a('0x4')](_0x308bad+':'+_0x25f645['id'],_0x25f645);FaxMessageEvents['emit'](_0x308bad,_0x25f645);_0x4f2fa9(null);};}for(var e in events){if(events[_0xad9a('0x5')](e)){var event=events[e];FaxMessage[_0xad9a('0x6')](e,emitEvent(event));}}module[_0xad9a('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x2231=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x197683,_0x21df72){var _0x137639=function(_0x46b902){while(--_0x46b902){_0x197683['push'](_0x197683['shift']());}};_0x137639(++_0x21df72);}(_0x2231,0x94));var _0x1223=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x2231[_0x380307];return _0x9ea14b;};'use strict';var EventEmitter=require(_0x1223('0x0'));var FaxMessage=require(_0x1223('0x1'))['db'][_0x1223('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1223('0x3')](0x0);var events={'afterCreate':_0x1223('0x4'),'afterUpdate':_0x1223('0x5'),'afterDestroy':_0x1223('0x6')};function emitEvent(_0x22fa9c){return function(_0x23439c,_0x122e1e,_0x450fdb){FaxMessageEvents['emit'](_0x22fa9c+':'+_0x23439c['id'],_0x23439c);FaxMessageEvents[_0x1223('0x7')](_0x22fa9c,_0x23439c);_0x450fdb(null);};}for(var e in events){if(events[_0x1223('0x8')](e)){var event=events[e];FaxMessage[_0x1223('0x9')](e,emitEvent(event));}}module[_0x1223('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f233827..1d326f9 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 _0x9f80=['FaxInteraction','findOne','FaxInteractionId','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId'];(function(_0x5c090a,_0x18ef75){var _0x5833b2=function(_0x345ea3){while(--_0x345ea3){_0x5c090a['push'](_0x5c090a['shift']());}};_0x5833b2(++_0x18ef75);}(_0x9f80,0xe6));var _0x09f8=function(_0x21a96a,_0x1a6e15){_0x21a96a=_0x21a96a-0x0;var _0x5df7f9=_0x9f80[_0x21a96a];return _0x5df7f9;};'use strict';var _=require(_0x09f8('0x0'));var util=require(_0x09f8('0x1'));var logger=require(_0x09f8('0x2'))('api');var moment=require(_0x09f8('0x3'));var BPromise=require('bluebird');var rp=require(_0x09f8('0x4'));var fs=require('fs');var path=require(_0x09f8('0x5'));var rimraf=require(_0x09f8('0x6'));var config=require(_0x09f8('0x7'));var attributes=require(_0x09f8('0x8'));module[_0x09f8('0x9')]=function(_0x31cd9e,_0x1c8fb9){return _0x31cd9e[_0x09f8('0xa')](_0x09f8('0xb'),attributes,{'tableName':_0x09f8('0xc'),'paranoid':![],'indexes':[{'name':_0x09f8('0xd'),'fields':[_0x09f8('0xe')],'type':_0x09f8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x243bcc,_0x2622ea,_0x1dc3b5){var _0x23a794=_0x31cd9e['models'];var _0x5975ee=_0x243bcc[_0x09f8('0x10')]({'plain':!![]});if(_0x5975ee['direction']['toLowerCase']()==='in'||_0x5975ee[_0x09f8('0x11')][_0x09f8('0x12')]()===_0x09f8('0x13')&&!_0x5975ee['secret']&&!_[_0x09f8('0x14')](_0x5975ee[_0x09f8('0x15')])){_0x23a794[_0x09f8('0x16')][_0x09f8('0x17')]({'where':{'id':_0x5975ee[_0x09f8('0x18')]}})['then'](function(_0x4f6a3d){if(_0x4f6a3d){_0x4f6a3d['update']({'lastMsgAt':_0x5975ee['createdAt'],'lastMsgDirection':_0x5975ee[_0x09f8('0x11')][_0x09f8('0x12')]()});}})[_0x09f8('0x19')](function(_0x2e6368){console[_0x09f8('0x1a')](_0x2e6368);});}_0x1dc3b5();}},'charset':'utf8mb4','collate':_0x09f8('0x1b')});}; \ No newline at end of file +var _0x9ca2=['FaxMessage','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0x5cf48c,_0x52b774){var _0xe1c839=function(_0x434b95){while(--_0x434b95){_0x5cf48c['push'](_0x5cf48c['shift']());}};_0xe1c839(++_0x52b774);}(_0x9ca2,0x188));var _0x29ca=function(_0x135020,_0x1e8540){_0x135020=_0x135020-0x0;var _0x37ef96=_0x9ca2[_0x135020];return _0x37ef96;};'use strict';var _=require(_0x29ca('0x0'));var util=require(_0x29ca('0x1'));var logger=require('../../config/logger')(_0x29ca('0x2'));var moment=require(_0x29ca('0x3'));var BPromise=require(_0x29ca('0x4'));var rp=require(_0x29ca('0x5'));var fs=require('fs');var path=require(_0x29ca('0x6'));var rimraf=require('rimraf');var config=require(_0x29ca('0x7'));var attributes=require(_0x29ca('0x8'));module[_0x29ca('0x9')]=function(_0x5f5558,_0x1e2c17){return _0x5f5558[_0x29ca('0xa')](_0x29ca('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x29ca('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xea7b5c,_0x228e29,_0x3f97cb){var _0x4511ac=_0x5f5558[_0x29ca('0xd')];var _0x5ef403=_0xea7b5c[_0x29ca('0xe')]({'plain':!![]});if(_0x5ef403[_0x29ca('0xf')][_0x29ca('0x10')]()==='in'||_0x5ef403['direction']['toLowerCase']()===_0x29ca('0x11')&&!_0x5ef403[_0x29ca('0x12')]&&!_[_0x29ca('0x13')](_0x5ef403[_0x29ca('0x14')])){_0x4511ac[_0x29ca('0x15')][_0x29ca('0x16')]({'where':{'id':_0x5ef403[_0x29ca('0x17')]}})[_0x29ca('0x18')](function(_0x599ff7){if(_0x599ff7){_0x599ff7[_0x29ca('0x19')]({'lastMsgAt':_0x5ef403[_0x29ca('0x1a')],'lastMsgDirection':_0x5ef403[_0x29ca('0xf')][_0x29ca('0x10')]()});}})[_0x29ca('0x1b')](function(_0x3a0cd7){console[_0x29ca('0x1c')](_0x3a0cd7);});}_0x3f97cb();}},'charset':_0x29ca('0x1d'),'collate':_0x29ca('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b5af3e7..c1d5e8b 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 _0xa9b1=['request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','create','body','options','then','UpdateFaxMessage','raw','limit','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s'];(function(_0x498b9e,_0x46ae26){var _0x29dd57=function(_0x56f191){while(--_0x56f191){_0x498b9e['push'](_0x498b9e['shift']());}};_0x29dd57(++_0x46ae26);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a9b('0x0'));var BPromise=require(_0x1a9b('0x1'));var rs=require(_0x1a9b('0x2'));var fs=require('fs');var Redis=require(_0x1a9b('0x3'));var db=require(_0x1a9b('0x4'))['db'];var utils=require(_0x1a9b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1a9b('0x6'));var client=jayson[_0x1a9b('0x7')][_0x1a9b('0x8')]({'port':0x232a});config[_0x1a9b('0x9')]=_[_0x1a9b('0xa')](config[_0x1a9b('0x9')],{'host':_0x1a9b('0xb'),'port':0x18eb});var socket=require(_0x1a9b('0xc'))(new Redis(config[_0x1a9b('0x9')]));require(_0x1a9b('0xd'))[_0x1a9b('0xe')](socket);function respondWithRpcPromise(_0x57659a,_0x55f1aa,_0x4e1aef){return new BPromise(function(_0x3f0e5f,_0x3de4ed){return client[_0x1a9b('0xf')](_0x57659a,_0x4e1aef)['then'](function(_0x5e48cd){logger['info'](_0x1a9b('0x10'),_0x55f1aa,_0x1a9b('0x11'));logger[_0x1a9b('0x12')](_0x1a9b('0x13'),_0x55f1aa,_0x1a9b('0x11'),JSON[_0x1a9b('0x14')](_0x5e48cd));if(_0x5e48cd['error']){if(_0x5e48cd[_0x1a9b('0x15')][_0x1a9b('0x16')]===0x1f4){logger[_0x1a9b('0x15')]('FaxMessage,\x20%s,\x20%s',_0x55f1aa,_0x5e48cd[_0x1a9b('0x15')][_0x1a9b('0x17')]);return _0x3de4ed(_0x5e48cd['error'][_0x1a9b('0x17')]);}logger['error'](_0x1a9b('0x10'),_0x55f1aa,_0x5e48cd[_0x1a9b('0x15')][_0x1a9b('0x17')]);return _0x3f0e5f(_0x5e48cd[_0x1a9b('0x15')][_0x1a9b('0x17')]);}else{logger[_0x1a9b('0x18')](_0x1a9b('0x10'),_0x55f1aa,_0x1a9b('0x11'));_0x3f0e5f(_0x5e48cd[_0x1a9b('0x19')][_0x1a9b('0x17')]);}})['catch'](function(_0x13be9a){logger[_0x1a9b('0x15')](_0x1a9b('0x10'),_0x55f1aa,_0x13be9a);_0x3de4ed(_0x13be9a);});});}exports[_0x1a9b('0x1a')]=function(_0x5687fc){var _0x208e1f=this;return new Promise(function(_0x427d6c,_0x4b3cd3){return db[_0x1a9b('0x1b')][_0x1a9b('0x1c')](_0x5687fc[_0x1a9b('0x1d')],{'raw':_0x5687fc[_0x1a9b('0x1e')]?_0x5687fc[_0x1a9b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x1a9b('0x1f')](function(_0x17b1dd){logger[_0x1a9b('0x18')](_0x1a9b('0x1a'),_0x5687fc);logger[_0x1a9b('0x12')](_0x1a9b('0x1a'),_0x5687fc,JSON[_0x1a9b('0x14')](_0x17b1dd));_0x427d6c(_0x17b1dd);})['catch'](function(_0xabfc95){logger['error'](_0x1a9b('0x1a'),_0xabfc95[_0x1a9b('0x17')],_0x5687fc);_0x4b3cd3(_0x208e1f[_0x1a9b('0x15')](0x1f4,_0xabfc95['message']));});});};exports[_0x1a9b('0x20')]=function(_0x3db708){var _0x1521f4=this;return new Promise(function(_0x181331,_0x18c9dd){return db[_0x1a9b('0x1b')]['update'](_0x3db708[_0x1a9b('0x1d')],{'raw':_0x3db708[_0x1a9b('0x1e')]?_0x3db708['options'][_0x1a9b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3db708[_0x1a9b('0x1e')]?_0x3db708['options']['where']||null:null,'attributes':_0x3db708[_0x1a9b('0x1e')]?_0x3db708[_0x1a9b('0x1e')]['attributes']||null:null,'limit':_0x3db708[_0x1a9b('0x1e')]?_0x3db708[_0x1a9b('0x1e')][_0x1a9b('0x22')]||null:null})[_0x1a9b('0x1f')](function(_0x1a5085){logger[_0x1a9b('0x18')](_0x1a9b('0x20'),_0x3db708);logger['debug'](_0x1a9b('0x20'),_0x3db708,JSON[_0x1a9b('0x14')](_0x1a5085));_0x181331(_0x1a5085);})[_0x1a9b('0x23')](function(_0x4185ad){logger[_0x1a9b('0x15')](_0x1a9b('0x20'),_0x4185ad[_0x1a9b('0x17')],_0x3db708);_0x18c9dd(_0x1521f4[_0x1a9b('0x15')](0x1f4,_0x4185ad[_0x1a9b('0x17')]));});});}; \ No newline at end of file +var _0x9d92=['debug','UpdateFaxMessage','update','body','where','attributes','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxMessage.socket','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','then'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x9d92,0xdf));var _0x29d9=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x9d92[_0x285824];return _0x311d7e;};'use strict';var _=require(_0x29d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x29d9('0x1'));var rs=require(_0x29d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d9('0x3'))['db'];var utils=require(_0x29d9('0x4'));var logger=require(_0x29d9('0x5'))(_0x29d9('0x6'));var config=require(_0x29d9('0x7'));var jayson=require(_0x29d9('0x8'));var client=jayson[_0x29d9('0x9')]['http']({'port':0x232a});config[_0x29d9('0xa')]=_[_0x29d9('0xb')](config[_0x29d9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x29d9('0xc'))(new Redis(config[_0x29d9('0xa')]));require(_0x29d9('0xd'))['register'](socket);function respondWithRpcPromise(_0x49399f,_0x4d997b,_0x4fc9a9){return new BPromise(function(_0x26123d,_0xfd7bac){return client[_0x29d9('0xe')](_0x49399f,_0x4fc9a9)['then'](function(_0x22a01c){logger[_0x29d9('0xf')](_0x29d9('0x10'),_0x4d997b,_0x29d9('0x11'));logger['debug'](_0x29d9('0x12'),_0x4d997b,'request\x20sent',JSON['stringify'](_0x22a01c));if(_0x22a01c['error']){if(_0x22a01c[_0x29d9('0x13')][_0x29d9('0x14')]===0x1f4){logger[_0x29d9('0x13')](_0x29d9('0x10'),_0x4d997b,_0x22a01c['error'][_0x29d9('0x15')]);return _0xfd7bac(_0x22a01c[_0x29d9('0x13')][_0x29d9('0x15')]);}logger[_0x29d9('0x13')](_0x29d9('0x10'),_0x4d997b,_0x22a01c[_0x29d9('0x13')][_0x29d9('0x15')]);return _0x26123d(_0x22a01c[_0x29d9('0x13')][_0x29d9('0x15')]);}else{logger[_0x29d9('0xf')](_0x29d9('0x10'),_0x4d997b,'request\x20sent');_0x26123d(_0x22a01c[_0x29d9('0x16')]['message']);}})['catch'](function(_0x3b07e6){logger[_0x29d9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x4d997b,_0x3b07e6);_0xfd7bac(_0x3b07e6);});});}exports[_0x29d9('0x17')]=function(_0x3392d6){var _0x2725f7=this;return new Promise(function(_0x9b0337,_0x2a2742){return db[_0x29d9('0x18')][_0x29d9('0x19')](_0x3392d6['body'],{'raw':_0x3392d6[_0x29d9('0x1a')]?_0x3392d6[_0x29d9('0x1a')][_0x29d9('0x1b')]===undefined?!![]:![]:!![]})[_0x29d9('0x1c')](function(_0x4aecaa){logger['info'](_0x29d9('0x17'),_0x3392d6);logger[_0x29d9('0x1d')]('CreateFaxMessage',_0x3392d6,JSON['stringify'](_0x4aecaa));_0x9b0337(_0x4aecaa);})['catch'](function(_0x460d3){logger[_0x29d9('0x13')](_0x29d9('0x17'),_0x460d3['message'],_0x3392d6);_0x2a2742(_0x2725f7[_0x29d9('0x13')](0x1f4,_0x460d3[_0x29d9('0x15')]));});});};exports[_0x29d9('0x1e')]=function(_0x1d8903){var _0x47d353=this;return new Promise(function(_0xea5b4b,_0x596b69){return db['FaxMessage'][_0x29d9('0x1f')](_0x1d8903[_0x29d9('0x20')],{'raw':_0x1d8903['options']?_0x1d8903[_0x29d9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d8903[_0x29d9('0x1a')]?_0x1d8903[_0x29d9('0x1a')][_0x29d9('0x21')]||null:null,'attributes':_0x1d8903[_0x29d9('0x1a')]?_0x1d8903[_0x29d9('0x1a')][_0x29d9('0x22')]||null:null,'limit':_0x1d8903[_0x29d9('0x1a')]?_0x1d8903['options']['limit']||null:null})['then'](function(_0x297d14){logger[_0x29d9('0xf')](_0x29d9('0x1e'),_0x1d8903);logger[_0x29d9('0x1d')](_0x29d9('0x1e'),_0x1d8903,JSON[_0x29d9('0x23')](_0x297d14));_0xea5b4b(_0x297d14);})['catch'](function(_0x2c0b5d){logger['error'](_0x29d9('0x1e'),_0x2c0b5d[_0x29d9('0x15')],_0x1d8903);_0x596b69(_0x47d353[_0x29d9('0x13')](0x1f4,_0x2c0b5d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 740f6be..69c80b2 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 _0x207d=['save','remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x3a194f,_0x4964bf){var _0x43c8de=function(_0x216230){while(--_0x216230){_0x3a194f['push'](_0x3a194f['shift']());}};_0x43c8de(++_0x4964bf);}(_0x207d,0x10d));var _0xd207=function(_0x3f1912,_0x4a4309){_0x3f1912=_0x3f1912-0x0;var _0x43142a=_0x207d[_0x3f1912];return _0x43142a;};'use strict';var FaxMessageEvents=require(_0xd207('0x0'));var events=[_0xd207('0x1'),_0xd207('0x2'),_0xd207('0x3')];function createListener(_0x562f74,_0xbc74a3){return function(_0x5f1be4){_0xbc74a3[_0xd207('0x4')](_0x562f74,_0x5f1be4);};}function removeListener(_0x422501,_0x5351ed){return function(){FaxMessageEvents[_0xd207('0x5')](_0x422501,_0x5351ed);};}exports[_0xd207('0x6')]=function(_0x18102b){for(var _0x2a8138=0x0,_0x2e0cfe=events[_0xd207('0x7')];_0x2a8138<_0x2e0cfe;_0x2a8138++){var _0x3e09c7=events[_0x2a8138];var _0x7def24=createListener(_0xd207('0x8')+_0x3e09c7,_0x18102b);FaxMessageEvents['on'](_0x3e09c7,_0x7def24);}}; \ No newline at end of file +var _0x1e19=['faxMessage:','./faxMessage.events','save','remove','update','removeListener','register','length'];(function(_0x510277,_0x14a889){var _0x2ee7f7=function(_0xfdc5e2){while(--_0xfdc5e2){_0x510277['push'](_0x510277['shift']());}};_0x2ee7f7(++_0x14a889);}(_0x1e19,0x1c9));var _0x91e1=function(_0x4c69c7,_0x2f4850){_0x4c69c7=_0x4c69c7-0x0;var _0x20d218=_0x1e19[_0x4c69c7];return _0x20d218;};'use strict';var FaxMessageEvents=require(_0x91e1('0x0'));var events=[_0x91e1('0x1'),_0x91e1('0x2'),_0x91e1('0x3')];function createListener(_0x3ebfdb,_0x569e03){return function(_0x5e25dd){_0x569e03['emit'](_0x3ebfdb,_0x5e25dd);};}function removeListener(_0x5e4bdc,_0x169cdf){return function(){FaxMessageEvents[_0x91e1('0x4')](_0x5e4bdc,_0x169cdf);};}exports[_0x91e1('0x5')]=function(_0x45d13a){for(var _0x38c2c0=0x0,_0x54c3ce=events[_0x91e1('0x6')];_0x38c2c0<_0x54c3ce;_0x38c2c0++){var _0x5b3df7=events[_0x38c2c0];var _0x15f4c8=createListener(_0x91e1('0x7')+_0x5b3df7,_0x45d13a);FaxMessageEvents['on'](_0x5b3df7,_0x15f4c8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ec94077..4965d7c 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 _0xb091=['show','/:id/download','download','post','fax','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./faxMessage.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb091,0x16e));var _0x1b09=function(_0xca22fe,_0x1cc5b1){_0xca22fe=_0xca22fe-0x0;var _0x95df6=_0xb091[_0xca22fe];return _0x95df6;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var auth=require(_0x1b09('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b09('0x5'));router[_0x1b09('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b09('0x7')]);router[_0x1b09('0x6')](_0x1b09('0x8'),auth['isAuthenticated'](),controller[_0x1b09('0x9')]);router[_0x1b09('0x6')](_0x1b09('0xa'),auth[_0x1b09('0xb')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x6')](_0x1b09('0xd'),auth[_0x1b09('0xb')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')]('/',auth[_0x1b09('0xb')](),interaction['tracked'](_0x1b09('0x10'),_0x1b09('0x11')),controller['create']);router['put'](_0x1b09('0xa'),auth[_0x1b09('0xb')](),controller[_0x1b09('0x12')]);router[_0x1b09('0x13')](_0x1b09('0x14'),auth[_0x1b09('0xb')](),controller[_0x1b09('0x15')]);router['put'](_0x1b09('0x16'),auth['isAuthenticated'](),controller[_0x1b09('0x17')]);router[_0x1b09('0x18')](_0x1b09('0xa'),auth[_0x1b09('0xb')](),controller[_0x1b09('0x19')]);module[_0x1b09('0x1a')]=router; \ No newline at end of file +var _0xfb11=['show','/:id/download','download','fax','create','put','update','accept','/:id/reject','reject','delete','multer','path','connect-timeout','Router','../../components/interaction/service','./faxMessage.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x7cc38e,_0x5494){var _0x2b0ca0=function(_0xbfa003){while(--_0xbfa003){_0x7cc38e['push'](_0x7cc38e['shift']());}};_0x2b0ca0(++_0x5494);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xfb11[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1fb1('0x4'));var config=require('../../config/environment');var controller=require(_0x1fb1('0x5'));router[_0x1fb1('0x6')]('/',auth['isAuthenticated'](),controller[_0x1fb1('0x7')]);router[_0x1fb1('0x6')]('/describe',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x9')]);router[_0x1fb1('0x6')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xb')]);router[_0x1fb1('0x6')](_0x1fb1('0xc'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xd')]);router['post']('/',auth[_0x1fb1('0x8')](),interaction['tracked'](_0x1fb1('0xe'),'faxmessage:create'),controller[_0x1fb1('0xf')]);router[_0x1fb1('0x10')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x11')]);router[_0x1fb1('0x10')]('/:id/accept',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x12')]);router[_0x1fb1('0x10')](_0x1fb1('0x13'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x14')]);router[_0x1fb1('0x15')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 57cf74f..b8337db 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 _0x4613=['exports','name','STRING','INTEGER','rrmemory','sequelize'];(function(_0x576f07,_0x18112f){var _0x35ed19=function(_0x124fbc){while(--_0x124fbc){_0x576f07['push'](_0x576f07['shift']());}};_0x35ed19(++_0x18112f);}(_0x4613,0xe9));var _0x3461=function(_0x7c389b,_0x4e2efc){_0x7c389b=_0x7c389b-0x0;var _0x41beac=_0x4613[_0x7c389b];return _0x41beac;};'use strict';var Sequelize=require(_0x3461('0x0'));module[_0x3461('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3461('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3461('0x3')]},'timeout':{'type':Sequelize[_0x3461('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3461('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3461('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd607=['STRING','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x7c645f,_0x4177ab){var _0x1ae9c0=function(_0xb6be2c){while(--_0xb6be2c){_0x7c645f['push'](_0x7c645f['shift']());}};_0x1ae9c0(++_0x4177ab);}(_0xd607,0xe2));var _0x7d60=function(_0x249d00,_0x77f08d){_0x249d00=_0x249d00-0x0;var _0x392f6c=_0xd607[_0x249d00];return _0x392f6c;};'use strict';var Sequelize=require(_0x7d60('0x0'));module[_0x7d60('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d60('0x2')]},'timeout':{'type':Sequelize[_0x7d60('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d60('0x4')]('rrmemory','beepall',_0x7d60('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7d60('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 1de1613..7ee2591 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 _0x7dc1=['update','then','destroy','FaxQueues','error','stack','name','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','FaxQueue','includeAll','include','findAll','rows','rawAttributes','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','FaxQueueId','UserId','agent','createdAt','format','%s/%s','SIP','faxPause','updatedAt','Team','getTeams','teams','User','Agents','online','voicePause','interface','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','join','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','ids','isEmpty','removeAgents','addAgents','omit','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x2753e6,_0x5b01dd){var _0x4724b6=function(_0x53f691){while(--_0x53f691){_0x2753e6['push'](_0x2753e6['shift']());}};_0x4724b6(++_0x5b01dd);}(_0x7dc1,0xe7));var _0x17dc=function(_0x5e29cd,_0x20ba4d){_0x5e29cd=_0x5e29cd-0x0;var _0x1be121=_0x7dc1[_0x5e29cd];return _0x1be121;};'use strict';var pdf=require(_0x17dc('0x0'));var emlformat=require(_0x17dc('0x1'));var rimraf=require(_0x17dc('0x2'));var zipdir=require(_0x17dc('0x3'));var jsonpatch=require(_0x17dc('0x4'));var rp=require(_0x17dc('0x5'));var moment=require(_0x17dc('0x6'));var BPromise=require(_0x17dc('0x7'));var Mustache=require(_0x17dc('0x8'));var util=require(_0x17dc('0x9'));var path=require('path');var sox=require(_0x17dc('0xa'));var csv=require(_0x17dc('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x17dc('0xc'));var crypto=require(_0x17dc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x17dc('0xe'));var toCsv=require(_0x17dc('0xb'));var querystring=require(_0x17dc('0xf'));var Papa=require(_0x17dc('0x10'));var Redis=require('ioredis');var authService=require(_0x17dc('0x11'));var qs=require(_0x17dc('0x12'));var hardwareService=require(_0x17dc('0x13'));var logger=require(_0x17dc('0x14'))(_0x17dc('0x15'));var utils=require(_0x17dc('0x16'));var config=require(_0x17dc('0x17'));var db=require('../../mysqldb')['db'];config[_0x17dc('0x18')]=_[_0x17dc('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x17dc('0x1a'))(new Redis(config['redis']));require(_0x17dc('0x1b'))[_0x17dc('0x1c')](socket);function respondWithStatusCode(_0x333cc5,_0x37f718){_0x37f718=_0x37f718||0xcc;return function(_0x15faaa){if(_0x15faaa){return _0x333cc5[_0x17dc('0x1d')](_0x37f718);}return _0x333cc5[_0x17dc('0x1e')](_0x37f718)[_0x17dc('0x1f')]();};}function respondWithResult(_0x424931,_0x49aa8a){_0x49aa8a=_0x49aa8a||0xc8;return function(_0x24567d){if(_0x24567d){return _0x424931[_0x17dc('0x1e')](_0x49aa8a)[_0x17dc('0x20')](_0x24567d);}};}function respondWithFilteredResult(_0x288c8e,_0x11ff12){return function(_0x1b2d1f){if(_0x1b2d1f){var _0x3b60a9=_0x1b2d1f[_0x17dc('0x21')],_0x5d9ac3=_0x11ff12['offset'],_0x55d282=_0x11ff12[_0x17dc('0x22')]+_0x11ff12[_0x17dc('0x23')],_0x38ec3b;if(_0x55d282>=_0x3b60a9){_0x55d282=_0x3b60a9;_0x38ec3b=0xc8;}else{_0x38ec3b=0xce;}_0x288c8e[_0x17dc('0x1e')](_0x38ec3b);return _0x288c8e[_0x17dc('0x24')](_0x17dc('0x25'),_0x5d9ac3+'-'+_0x55d282+'/'+_0x3b60a9)[_0x17dc('0x20')](_0x1b2d1f);}return null;};}function patchUpdates(_0x36fc42){return function(_0xdf18f9){try{jsonpatch[_0x17dc('0x26')](_0xdf18f9,_0x36fc42,!![]);}catch(_0x1ec791){return BPromise['reject'](_0x1ec791);}return _0xdf18f9['save']();};}function saveUpdates(_0x271704,_0x1ad5ae){return function(_0x2c2528){if(_0x2c2528){return _0x2c2528[_0x17dc('0x27')](_0x271704)[_0x17dc('0x28')](function(_0x5aacd5){return _0x5aacd5;});}return null;};}function removeEntity(_0x302a1c,_0x455e71){return function(_0x449afa){if(_0x449afa){return _0x449afa[_0x17dc('0x29')]()[_0x17dc('0x28')](function(){var _0x4d5111=_0x449afa['get']({'plain':!![]});var _0x174550=_0x17dc('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x174550,'resourceId':_0x4d5111['id']}})[_0x17dc('0x28')](function(){return _0x449afa;});})[_0x17dc('0x28')](function(){_0x302a1c[_0x17dc('0x1e')](0xcc)[_0x17dc('0x1f')]();});}};}function handleEntityNotFound(_0x1cc8d8,_0x1fb1b1){return function(_0x8e70d2){if(!_0x8e70d2){_0x1cc8d8[_0x17dc('0x1d')](0x194);}return _0x8e70d2;};}function handleError(_0x1ce429,_0x51983d){_0x51983d=_0x51983d||0x1f4;return function(_0x5e05df){logger[_0x17dc('0x2b')](_0x5e05df[_0x17dc('0x2c')]);if(_0x5e05df['name']){delete _0x5e05df[_0x17dc('0x2d')];}_0x1ce429[_0x17dc('0x1e')](_0x51983d)['send'](_0x5e05df);};}exports['index']=function(_0x18f5ac,_0x3e9f3b){var _0x52c6dd={},_0x387aef={},_0x5707fe={'count':0x0,'rows':[]};var _0x4ccf0b=db['FaxQueue']['rawAttributes'];_0x387aef[_0x17dc('0x2e')]=_[_0x17dc('0x2f')](_0x4ccf0b);_0x387aef[_0x17dc('0x30')]=_['keys'](_0x18f5ac['query']);_0x387aef[_0x17dc('0x31')]=_[_0x17dc('0x32')](_0x387aef[_0x17dc('0x2e')],_0x387aef[_0x17dc('0x30')]);_0x52c6dd[_0x17dc('0x33')]=_[_0x17dc('0x32')](_0x387aef[_0x17dc('0x2e')],qs['fields'](_0x18f5ac[_0x17dc('0x30')][_0x17dc('0x34')]));_0x52c6dd[_0x17dc('0x33')]=_0x52c6dd[_0x17dc('0x33')]['length']?_0x52c6dd[_0x17dc('0x33')]:_0x387aef['model'];if(!_0x18f5ac['query'][_0x17dc('0x35')](_0x17dc('0x36'))){_0x52c6dd[_0x17dc('0x23')]=qs[_0x17dc('0x23')](_0x18f5ac[_0x17dc('0x30')][_0x17dc('0x23')]);_0x52c6dd['offset']=qs[_0x17dc('0x22')](_0x18f5ac['query']['offset']);}_0x52c6dd[_0x17dc('0x37')]=qs['sort'](_0x18f5ac[_0x17dc('0x30')][_0x17dc('0x38')]);_0x52c6dd[_0x17dc('0x39')]=qs[_0x17dc('0x31')](_[_0x17dc('0x3a')](_0x18f5ac[_0x17dc('0x30')],_0x387aef[_0x17dc('0x31')]));if(_0x18f5ac['query'][_0x17dc('0x3b')]){_0x52c6dd[_0x17dc('0x39')]=_[_0x17dc('0x3c')](_0x52c6dd[_0x17dc('0x39')],{'$or':_[_0x17dc('0x3d')](_0x4ccf0b,function(_0x2c4aec){if(_0x2c4aec[_0x17dc('0x3e')]['key']!==_0x17dc('0x3f')){var _0x41d140={};_0x41d140[_0x2c4aec[_0x17dc('0x40')]]={'$like':'%'+_0x18f5ac[_0x17dc('0x30')]['filter']+'%'};return _0x41d140;}})});}_0x52c6dd=_[_0x17dc('0x3c')]({},_0x52c6dd,_0x18f5ac[_0x17dc('0x41')]);var _0x10bccf={'where':_0x52c6dd[_0x17dc('0x39')]};return db[_0x17dc('0x42')][_0x17dc('0x21')](_0x10bccf)['then'](function(_0x333376){_0x5707fe[_0x17dc('0x21')]=_0x333376;if(_0x18f5ac[_0x17dc('0x30')][_0x17dc('0x43')]){_0x52c6dd[_0x17dc('0x44')]=[{'all':!![]}];}return db[_0x17dc('0x42')][_0x17dc('0x45')](_0x52c6dd);})[_0x17dc('0x28')](function(_0x4cd313){_0x5707fe[_0x17dc('0x46')]=_0x4cd313;return _0x5707fe;})[_0x17dc('0x28')](respondWithFilteredResult(_0x3e9f3b,_0x52c6dd))['catch'](handleError(_0x3e9f3b,null));};exports['show']=function(_0x3d888e,_0x33643b){var _0x258814={'raw':!![],'where':{'id':_0x3d888e['params']['id']}},_0x19d411={};_0x19d411['model']=_['keys'](db[_0x17dc('0x42')][_0x17dc('0x47')]);_0x19d411[_0x17dc('0x30')]=_['keys'](_0x3d888e[_0x17dc('0x30')]);_0x19d411[_0x17dc('0x31')]=_[_0x17dc('0x32')](_0x19d411['model'],_0x19d411[_0x17dc('0x30')]);_0x258814[_0x17dc('0x33')]=_[_0x17dc('0x32')](_0x19d411['model'],qs[_0x17dc('0x34')](_0x3d888e[_0x17dc('0x30')][_0x17dc('0x34')]));_0x258814[_0x17dc('0x33')]=_0x258814['attributes'][_0x17dc('0x48')]?_0x258814['attributes']:_0x19d411[_0x17dc('0x2e')];if(_0x3d888e[_0x17dc('0x30')][_0x17dc('0x43')]){_0x258814[_0x17dc('0x44')]=[{'all':!![]}];}_0x258814=_[_0x17dc('0x3c')]({},_0x258814,_0x3d888e['options']);return db[_0x17dc('0x42')][_0x17dc('0x49')](_0x258814)['then'](handleEntityNotFound(_0x33643b,null))['then'](respondWithResult(_0x33643b,null))[_0x17dc('0x4a')](handleError(_0x33643b,null));};exports[_0x17dc('0x4b')]=function(_0x912618,_0x2e47b3){return db[_0x17dc('0x42')][_0x17dc('0x4b')](_0x912618[_0x17dc('0x4c')],{})[_0x17dc('0x28')](function(_0xe106c7){var _0x30870c=_0x912618['user'][_0x17dc('0x4d')]({'plain':!![]});if(!_0x30870c)throw new Error(_0x17dc('0x4e'));if(_0x30870c[_0x17dc('0x4f')]==='user'){var _0xd107cf=_0xe106c7[_0x17dc('0x4d')]({'plain':!![]});var _0x3edf42=_0x17dc('0x2a');return db[_0x17dc('0x50')][_0x17dc('0x49')]({'where':{'name':_0x3edf42,'userProfileId':_0x30870c[_0x17dc('0x51')]},'raw':!![]})[_0x17dc('0x28')](function(_0x1eb2e3){if(_0x1eb2e3&&_0x1eb2e3[_0x17dc('0x52')]===0x0){return db[_0x17dc('0x53')][_0x17dc('0x4b')]({'name':_0xd107cf[_0x17dc('0x2d')],'resourceId':_0xd107cf['id'],'type':_0x1eb2e3['name'],'sectionId':_0x1eb2e3['id']},{})['then'](function(){return _0xe106c7;});}else{return _0xe106c7;}})['catch'](function(_0x2cffc6){logger[_0x17dc('0x2b')](_0x17dc('0x54'),_0x2cffc6);throw _0x2cffc6;});}return _0xe106c7;})[_0x17dc('0x28')](respondWithResult(_0x2e47b3,0xc9))[_0x17dc('0x4a')](handleError(_0x2e47b3,null));};exports[_0x17dc('0x27')]=function(_0x193336,_0x458fc5){if(_0x193336[_0x17dc('0x4c')]['id']){delete _0x193336[_0x17dc('0x4c')]['id'];}return db[_0x17dc('0x42')][_0x17dc('0x49')]({'where':{'id':_0x193336[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](handleEntityNotFound(_0x458fc5,null))['then'](saveUpdates(_0x193336[_0x17dc('0x4c')],null))[_0x17dc('0x28')](respondWithResult(_0x458fc5,null))['catch'](handleError(_0x458fc5,null));};exports[_0x17dc('0x29')]=function(_0x2bd5f6,_0x50c4e4){return db['FaxQueue'][_0x17dc('0x49')]({'where':{'id':_0x2bd5f6[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](handleEntityNotFound(_0x50c4e4,null))[_0x17dc('0x28')](removeEntity(_0x50c4e4,null))[_0x17dc('0x4a')](handleError(_0x50c4e4,null));};exports[_0x17dc('0x56')]=function(_0xd84229,_0x170209){return db[_0x17dc('0x42')]['describe']()[_0x17dc('0x28')](respondWithResult(_0x170209,null))[_0x17dc('0x4a')](handleError(_0x170209,null));};exports['getMembers']=function(_0x368bf0,_0x2774b8,_0x4256f4){var _0x348d73={'raw':!![],'where':{}},_0x1b4168={},_0x34fcbf;return db[_0x17dc('0x42')][_0x17dc('0x57')]({'where':{'id':_0x368bf0[_0x17dc('0x55')]['id']}})['then'](handleEntityNotFound(_0x2774b8,null))['then'](function(_0x2b7ca3){if(_0x2b7ca3){_0x34fcbf=_0x2b7ca3['get']({'plain':!![]});_0x1b4168[_0x17dc('0x2e')]=_[_0x17dc('0x2f')](db[_0x17dc('0x58')]['rawAttributes']);_0x1b4168[_0x17dc('0x30')]=_[_0x17dc('0x2f')](_0x368bf0[_0x17dc('0x30')]);_0x1b4168[_0x17dc('0x31')]=_[_0x17dc('0x32')](_0x1b4168[_0x17dc('0x2e')],_0x1b4168[_0x17dc('0x30')]);_0x348d73[_0x17dc('0x33')]=_[_0x17dc('0x32')](_0x1b4168[_0x17dc('0x2e')],qs[_0x17dc('0x34')](_0x368bf0[_0x17dc('0x30')][_0x17dc('0x34')]));_0x348d73[_0x17dc('0x33')]=_0x348d73[_0x17dc('0x33')][_0x17dc('0x48')]?_0x348d73['attributes']:_0x1b4168[_0x17dc('0x2e')];if(!_0x368bf0[_0x17dc('0x30')]['hasOwnProperty'](_0x17dc('0x36'))){_0x348d73['limit']=qs['limit'](_0x368bf0['query'][_0x17dc('0x23')]);_0x348d73[_0x17dc('0x22')]=qs[_0x17dc('0x22')](_0x368bf0['query'][_0x17dc('0x22')]);}_0x348d73[_0x17dc('0x37')]=qs['sort'](_0x368bf0[_0x17dc('0x30')]['sort']);_0x348d73['where']=qs[_0x17dc('0x31')](_[_0x17dc('0x3a')](_0x368bf0[_0x17dc('0x30')],_0x1b4168[_0x17dc('0x31')]));_0x348d73[_0x17dc('0x39')][_0x17dc('0x59')]=_0x2b7ca3['id'];if(_0x368bf0[_0x17dc('0x30')][_0x17dc('0x3b')]){_0x348d73['where']=_[_0x17dc('0x3c')](_0x348d73[_0x17dc('0x39')],{'$or':_[_0x17dc('0x3d')](_0x348d73[_0x17dc('0x33')],function(_0x4d366a){var _0x4190e4={};_0x4190e4[_0x4d366a]={'$like':'%'+_0x368bf0[_0x17dc('0x30')]['filter']+'%'};return _0x4190e4;})});}_0x348d73=_[_0x17dc('0x3c')]({},_0x348d73,_0x368bf0[_0x17dc('0x41')]);return db['UserFaxQueue'][_0x17dc('0x45')](_0x348d73);}})[_0x17dc('0x28')](function(_0x1b0d5f){if(_0x1b0d5f){return db['User']['findAndCountAll']({'where':{'id':_[_0x17dc('0x3d')](_0x1b0d5f,_0x17dc('0x5a')),'role':_0x17dc('0x5b')},'attributes':['id','name','faxPause','updatedAt',_0x17dc('0x5c')]});}})[_0x17dc('0x28')](function(_0x16d73a){if(_0x16d73a){return{'count':_0x16d73a['count'],'rows':_[_0x17dc('0x3d')](_0x16d73a['rows'],function(_0x19f080){return{'membername':_0x19f080['name'],'UserId':_0x19f080['id'],'queue_name':_0x34fcbf['name'],'FaxQueueId':_0x34fcbf['id'],'interface':util[_0x17dc('0x5d')](_0x17dc('0x5e'),_0x17dc('0x5f'),_0x19f080[_0x17dc('0x2d')]),'penalty':0x0,'paused':_0x19f080[_0x17dc('0x60')],'createdAt':_0x19f080[_0x17dc('0x5c')],'updatedAt':_0x19f080[_0x17dc('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x17dc('0x28')](respondWithFilteredResult(_0x2774b8,_0x348d73))[_0x17dc('0x4a')](handleError(_0x2774b8,null));};exports['getTeams']=function(_0x451f2f,_0x216be9,_0x2ca696){var _0x528983={};var _0x54bd4a={};var _0x3f70e2;var _0x5b0cbe;return db[_0x17dc('0x42')][_0x17dc('0x57')]({'where':{'id':_0x451f2f[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](handleEntityNotFound(_0x216be9,null))[_0x17dc('0x28')](function(_0x30f731){if(_0x30f731){_0x3f70e2=_0x30f731;_0x54bd4a[_0x17dc('0x2e')]=_[_0x17dc('0x2f')](db[_0x17dc('0x62')][_0x17dc('0x47')]);_0x54bd4a[_0x17dc('0x30')]=_[_0x17dc('0x2f')](_0x451f2f['query']);_0x54bd4a[_0x17dc('0x31')]=_[_0x17dc('0x32')](_0x54bd4a[_0x17dc('0x2e')],_0x54bd4a[_0x17dc('0x30')]);_0x528983[_0x17dc('0x33')]=_[_0x17dc('0x32')](_0x54bd4a[_0x17dc('0x2e')],qs['fields'](_0x451f2f[_0x17dc('0x30')][_0x17dc('0x34')]));_0x528983[_0x17dc('0x33')]=_0x528983[_0x17dc('0x33')][_0x17dc('0x48')]?_0x528983[_0x17dc('0x33')]:_0x54bd4a[_0x17dc('0x2e')];_0x528983[_0x17dc('0x37')]=qs[_0x17dc('0x38')](_0x451f2f[_0x17dc('0x30')]['sort']);_0x528983['where']=qs[_0x17dc('0x31')](_[_0x17dc('0x3a')](_0x451f2f[_0x17dc('0x30')],_0x54bd4a[_0x17dc('0x31')]));if(_0x451f2f[_0x17dc('0x30')][_0x17dc('0x3b')]){_0x528983['where']=_[_0x17dc('0x3c')](_0x528983[_0x17dc('0x39')],{'$or':_[_0x17dc('0x3d')](_0x528983[_0x17dc('0x33')],function(_0x807add){var _0x4bd57a={};_0x4bd57a[_0x807add]={'$like':'%'+_0x451f2f[_0x17dc('0x30')][_0x17dc('0x3b')]+'%'};return _0x4bd57a;})});}_0x528983=_[_0x17dc('0x3c')]({},_0x528983,_0x451f2f['options']);return _0x3f70e2[_0x17dc('0x63')](_0x528983);}})[_0x17dc('0x28')](function(_0x92e4d2){if(_0x92e4d2){_0x5b0cbe=_0x92e4d2[_0x17dc('0x48')];if(!_0x451f2f[_0x17dc('0x30')]['hasOwnProperty'](_0x17dc('0x36'))){_0x528983['limit']=qs[_0x17dc('0x23')](_0x451f2f[_0x17dc('0x30')][_0x17dc('0x23')]);_0x528983[_0x17dc('0x22')]=qs['offset'](_0x451f2f['query'][_0x17dc('0x22')]);}return _0x3f70e2[_0x17dc('0x63')](_0x528983);}})[_0x17dc('0x28')](function(_0x592719){if(_0x592719){return _0x592719?{'count':_0x5b0cbe,'rows':_0x592719}:null;}})[_0x17dc('0x28')](respondWithResult(_0x216be9,null))[_0x17dc('0x4a')](handleError(_0x216be9,null));};exports['addTeams']=function(_0x573000,_0x425cbb,_0x2481e2){var _0x579e47=_0x573000['body'][_0x17dc('0x64')];return db['Team'][_0x17dc('0x45')]({'where':{'id':_[_0x17dc('0x3d')](_0x579e47,'id')},'attributes':['id'],'include':[{'model':db[_0x17dc('0x65')],'as':_0x17dc('0x66'),'attributes':['id',_0x17dc('0x2d'),_0x17dc('0x67'),_0x17dc('0x68'),_0x17dc('0x69')],'raw':!![]}]})[_0x17dc('0x28')](function(_0x1c2f66){if(_0x1c2f66){var _0x362a43=_['flatMap'](_0x1c2f66,function(_0x2aa679){var _0xbf9d9a=_0x2aa679[_0x17dc('0x4d')]({'plain':!![]});return _0xbf9d9a[_0x17dc('0x66')];});return db['FaxQueue'][_0x17dc('0x49')]({'where':{'id':_0x573000['params']['id']}})[_0x17dc('0x28')](function(_0x35d336){return db[_0x17dc('0x6a')]['transaction'](function(_0x172be8){return _0x35d336['addTeams'](_['map'](_0x579e47,'id'),{'transaction':_0x172be8})[_0x17dc('0x28')](function(){return BPromise[_0x17dc('0x6b')](_0x362a43,function(_0x1a8fd5){return db[_0x17dc('0x58')]['findOrCreate']({'where':{'UserId':_0x1a8fd5['id'],'FaxQueueId':_0x573000[_0x17dc('0x55')]['id']},'transaction':_0x172be8});});})['then'](function(){_0x362a43[_0x17dc('0x6c')](function(_0x303468){socket[_0x17dc('0x6d')](_0x17dc('0x6e'),{'UserId':_0x303468['id'],'FaxQueueId':_0x35d336['id']});});});});});}})[_0x17dc('0x28')](respondWithStatusCode(_0x425cbb,null))[_0x17dc('0x4a')](handleError(_0x425cbb,null));};exports[_0x17dc('0x6f')]=function(_0x539b30,_0x2e3fa0,_0x41a792){return db[_0x17dc('0x62')][_0x17dc('0x45')]({'where':{'id':_0x539b30[_0x17dc('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0x17dc('0x65')],'as':_0x17dc('0x66'),'attributes':['id'],'raw':!![]}]})[_0x17dc('0x28')](handleEntityNotFound(_0x2e3fa0,null))['then'](function(_0x5d234d){var _0x326949=_['map'](_0x5d234d,'id');var _0x169517=[];var _0x332164=[];var _0x4175b5=squel[_0x17dc('0x70')]();_0x4175b5[_0x17dc('0x40')](_0x17dc('0x71'))[_0x17dc('0x72')]('team_has_fax_queues','tq')[_0x17dc('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x17dc('0x39')]('FaxQueueId\x20=\x20?',_0x539b30['params']['id']);for(var _0x54cb45=0x0;_0x54cb45<_0x5d234d[_0x17dc('0x48')];_0x54cb45+=0x1){let _0x2bc1c5=_0x5d234d[_0x54cb45];for(var _0x1149fa=0x0;_0x1149fa<_0x2bc1c5[_0x17dc('0x66')][_0x17dc('0x48')];_0x1149fa+=0x1){let _0x53f38e=_0x2bc1c5[_0x17dc('0x66')][_0x1149fa];var _0x310e20=_0x4175b5[_0x17dc('0x74')]();_0x310e20[_0x17dc('0x39')](_0x17dc('0x75'),_0x53f38e['id']);_0x332164['push'](db[_0x17dc('0x6a')]['query'](_0x310e20[_0x17dc('0x76')](),{'type':db['sequelize'][_0x17dc('0x77')][_0x17dc('0x78')]})['then'](function(_0x59d7f7){if(_0x59d7f7[_0x17dc('0x48')]===0x1){return _0x53f38e['id'];}else{var _0x12412c=_[_0x17dc('0x79')](_[_0x17dc('0x3d')](_0x59d7f7,_0x17dc('0x7a')),function(_0x46f1cf){return _['includes'](_0x326949,_0x46f1cf);});if(_0x12412c){return _0x53f38e['id'];}}}));}}return BPromise[_0x17dc('0x7b')](_0x332164)[_0x17dc('0x28')](function(_0x2e7b80){_0x169517=_(_0x169517)[_0x17dc('0x7c')](_0x2e7b80)[_0x17dc('0x7d')]()[_0x17dc('0x7e')]();return db[_0x17dc('0x42')][_0x17dc('0x49')]({'where':{'id':_0x539b30[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](function(_0xe53c27){return db[_0x17dc('0x6a')]['transaction'](function(_0x3ce424){return _0xe53c27[_0x17dc('0x6f')](_0x539b30[_0x17dc('0x30')][_0x17dc('0x7f')],{'transaction':_0x3ce424})[_0x17dc('0x28')](function(){if(!_[_0x17dc('0x80')](_0x169517)){return _0xe53c27[_0x17dc('0x81')](_0x169517,{'transaction':_0x3ce424});}})[_0x17dc('0x28')](function(){_0x169517[_0x17dc('0x6c')](function(_0x200b08){socket[_0x17dc('0x6d')]('userFaxQueue:remove',{'UserId':_0x200b08,'FaxQueueId':_0xe53c27['id']});});});});});});})[_0x17dc('0x28')](respondWithStatusCode(_0x2e3fa0,null))[_0x17dc('0x4a')](handleError(_0x2e3fa0,null));};exports[_0x17dc('0x82')]=function(_0x5cab5e,_0x27d8cf,_0x31a7f1){return db[_0x17dc('0x42')][_0x17dc('0x49')]({'where':{'id':_0x5cab5e[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](handleEntityNotFound(_0x27d8cf,null))[_0x17dc('0x28')](function(_0x1bcf50){if(_0x1bcf50){return _0x1bcf50[_0x17dc('0x82')](_0x5cab5e[_0x17dc('0x4c')]['ids'],_[_0x17dc('0x83')](_0x5cab5e[_0x17dc('0x4c')],[_0x17dc('0x7f'),'id'])||{})['spread'](function(_0x43efcb){for(var _0x339512=0x0;_0x339512<_0x5cab5e[_0x17dc('0x4c')]['ids']['length'];_0x339512+=0x1){socket[_0x17dc('0x6d')]('userFaxQueue:save',{'UserId':_0x5cab5e[_0x17dc('0x4c')]['ids'][_0x339512],'FaxQueueId':_0x5cab5e[_0x17dc('0x55')]['id']});}return _0x43efcb;});}})['then'](respondWithResult(_0x27d8cf,null))[_0x17dc('0x4a')](handleError(_0x27d8cf,null));};exports[_0x17dc('0x81')]=function(_0x484b68,_0x339f9d,_0x46f263){return db[_0x17dc('0x42')][_0x17dc('0x49')]({'where':{'id':_0x484b68[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](handleEntityNotFound(_0x339f9d,null))['then'](function(_0x107fbf){if(_0x107fbf){return _0x107fbf['removeAgents'](_0x484b68[_0x17dc('0x30')]['ids'])[_0x17dc('0x28')](function(){if(_[_0x17dc('0x84')](_0x484b68['query'][_0x17dc('0x7f')])){for(var _0x44346d=0x0;_0x44346d<_0x484b68[_0x17dc('0x30')][_0x17dc('0x7f')][_0x17dc('0x48')];_0x44346d+=0x1){socket[_0x17dc('0x6d')](_0x17dc('0x85'),{'UserId':Number(_0x484b68[_0x17dc('0x30')][_0x17dc('0x7f')][_0x44346d]),'FaxQueueId':Number(_0x484b68['params']['id'])});}}else{socket[_0x17dc('0x6d')](_0x17dc('0x85'),{'UserId':Number(_0x484b68[_0x17dc('0x30')][_0x17dc('0x7f')]),'FaxQueueId':Number(_0x484b68[_0x17dc('0x55')]['id'])});}});}})[_0x17dc('0x28')](respondWithStatusCode(_0x339f9d,null))['catch'](handleError(_0x339f9d,null));};exports[_0x17dc('0x86')]=function(_0x57a01e,_0x44ebac,_0x10325a){var _0x518621={};var _0x2a181e={};var _0x689d39;var _0x4865db;return db[_0x17dc('0x42')]['findOne']({'where':{'id':_0x57a01e[_0x17dc('0x55')]['id']}})[_0x17dc('0x28')](handleEntityNotFound(_0x44ebac,null))['then'](function(_0x50ba9e){if(_0x50ba9e){_0x689d39=_0x50ba9e;_0x2a181e['model']=_[_0x17dc('0x2f')](db[_0x17dc('0x65')][_0x17dc('0x47')]);_0x2a181e[_0x17dc('0x30')]=_[_0x17dc('0x2f')](_0x57a01e['query']);_0x2a181e[_0x17dc('0x31')]=_['intersection'](_0x2a181e[_0x17dc('0x2e')],_0x2a181e['query']);_0x518621[_0x17dc('0x33')]=_[_0x17dc('0x32')](_0x2a181e[_0x17dc('0x2e')],qs[_0x17dc('0x34')](_0x57a01e[_0x17dc('0x30')][_0x17dc('0x34')]));_0x518621[_0x17dc('0x33')]=_0x518621[_0x17dc('0x33')][_0x17dc('0x48')]?_0x518621[_0x17dc('0x33')]:_0x2a181e['model'];_0x518621[_0x17dc('0x37')]=qs[_0x17dc('0x38')](_0x57a01e[_0x17dc('0x30')][_0x17dc('0x38')]);_0x518621[_0x17dc('0x39')]=qs['filters'](_[_0x17dc('0x3a')](_0x57a01e['query'],_0x2a181e[_0x17dc('0x31')]));if(_0x57a01e[_0x17dc('0x30')]['filter']){_0x518621[_0x17dc('0x39')]=_[_0x17dc('0x3c')](_0x518621[_0x17dc('0x39')],{'$or':_[_0x17dc('0x3d')](_0x518621[_0x17dc('0x33')],function(_0x17f929){var _0x5e0ec6={};_0x5e0ec6[_0x17f929]={'$like':'%'+_0x57a01e[_0x17dc('0x30')][_0x17dc('0x3b')]+'%'};return _0x5e0ec6;})});}_0x518621=_[_0x17dc('0x3c')]({},_0x518621,_0x57a01e[_0x17dc('0x41')]);return _0x689d39['getAgents'](_0x518621);}})[_0x17dc('0x28')](function(_0x5dcd7f){if(_0x5dcd7f){_0x4865db=_0x5dcd7f[_0x17dc('0x48')];if(!_0x57a01e['query'][_0x17dc('0x35')](_0x17dc('0x36'))){_0x518621[_0x17dc('0x23')]=qs[_0x17dc('0x23')](_0x57a01e[_0x17dc('0x30')][_0x17dc('0x23')]);_0x518621[_0x17dc('0x22')]=qs['offset'](_0x57a01e[_0x17dc('0x30')][_0x17dc('0x22')]);}return _0x689d39['getAgents'](_0x518621);}})[_0x17dc('0x28')](function(_0x3938aa){if(_0x3938aa){return _0x3938aa?{'count':_0x4865db,'rows':_0x3938aa}:null;}})['then'](respondWithResult(_0x44ebac,null))[_0x17dc('0x4a')](handleError(_0x44ebac,null));}; \ No newline at end of file +var _0x310a=['ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','html-pdf','zip-dir','request-promise','moment','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','json','count','offset','status','reject','save','update','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','FaxQueue','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','map','type','VIRTUAL','field','filter','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','addTeams','teams','Agents','online','voicePause','flatMap','sequelize','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams'];(function(_0x3f9d8e,_0x65d6a3){var _0x301b2f=function(_0x12075b){while(--_0x12075b){_0x3f9d8e['push'](_0x3f9d8e['shift']());}};_0x301b2f(++_0x65d6a3);}(_0x310a,0x124));var _0xa310=function(_0xcb78b,_0x4b7292){_0xcb78b=_0xcb78b-0x0;var _0x10ab0c=_0x310a[_0xcb78b];return _0x10ab0c;};'use strict';var pdf=require(_0xa310('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa310('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa310('0x2'));var moment=require(_0xa310('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa310('0x4'));var csv=require(_0xa310('0x5'));var ejs=require(_0xa310('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa310('0x7'));var crypto=require(_0xa310('0x8'));var jsforce=require(_0xa310('0x9'));var deskjs=require(_0xa310('0xa'));var toCsv=require(_0xa310('0x5'));var querystring=require(_0xa310('0xb'));var Papa=require('papaparse');var Redis=require(_0xa310('0xc'));var authService=require(_0xa310('0xd'));var qs=require(_0xa310('0xe'));var hardwareService=require(_0xa310('0xf'));var logger=require(_0xa310('0x10'))('api');var utils=require(_0xa310('0x11'));var config=require('../../config/environment');var db=require(_0xa310('0x12'))['db'];config[_0xa310('0x13')]=_[_0xa310('0x14')](config[_0xa310('0x13')],{'host':_0xa310('0x15'),'port':0x18eb});var socket=require(_0xa310('0x16'))(new Redis(config[_0xa310('0x13')]));require(_0xa310('0x17'))[_0xa310('0x18')](socket);function respondWithStatusCode(_0x66653e,_0x19e35c){_0x19e35c=_0x19e35c||0xcc;return function(_0x3110ee){if(_0x3110ee){return _0x66653e[_0xa310('0x19')](_0x19e35c);}return _0x66653e['status'](_0x19e35c)[_0xa310('0x1a')]();};}function respondWithResult(_0x2f4320,_0x2d6df8){_0x2d6df8=_0x2d6df8||0xc8;return function(_0x2006de){if(_0x2006de){return _0x2f4320['status'](_0x2d6df8)[_0xa310('0x1b')](_0x2006de);}};}function respondWithFilteredResult(_0x3f10b2,_0x551274){return function(_0x15a956){if(_0x15a956){var _0x5ea84c=_0x15a956[_0xa310('0x1c')],_0x2925e7=_0x551274[_0xa310('0x1d')],_0x17f4ec=_0x551274[_0xa310('0x1d')]+_0x551274['limit'],_0x1b8898;if(_0x17f4ec>=_0x5ea84c){_0x17f4ec=_0x5ea84c;_0x1b8898=0xc8;}else{_0x1b8898=0xce;}_0x3f10b2[_0xa310('0x1e')](_0x1b8898);return _0x3f10b2['set']('Content-Range',_0x2925e7+'-'+_0x17f4ec+'/'+_0x5ea84c)['json'](_0x15a956);}return null;};}function patchUpdates(_0x46fbe8){return function(_0x216fa1){try{jsonpatch['apply'](_0x216fa1,_0x46fbe8,!![]);}catch(_0xc38279){return BPromise[_0xa310('0x1f')](_0xc38279);}return _0x216fa1[_0xa310('0x20')]();};}function saveUpdates(_0x4da826,_0x854987){return function(_0x5acf4e){if(_0x5acf4e){return _0x5acf4e[_0xa310('0x21')](_0x4da826)['then'](function(_0x5c8db8){return _0x5c8db8;});}return null;};}function removeEntity(_0x14df4a,_0x10d0a2){return function(_0x295eae){if(_0x295eae){return _0x295eae['destroy']()[_0xa310('0x22')](function(){var _0xed30bd=_0x295eae['get']({'plain':!![]});var _0x4c1566=_0xa310('0x23');return db[_0xa310('0x24')][_0xa310('0x25')]({'where':{'type':_0x4c1566,'resourceId':_0xed30bd['id']}})[_0xa310('0x22')](function(){return _0x295eae;});})[_0xa310('0x22')](function(){_0x14df4a['status'](0xcc)[_0xa310('0x1a')]();});}};}function handleEntityNotFound(_0x1e78aa,_0x943f64){return function(_0x1c8152){if(!_0x1c8152){_0x1e78aa[_0xa310('0x19')](0x194);}return _0x1c8152;};}function handleError(_0x43a20f,_0x294b53){_0x294b53=_0x294b53||0x1f4;return function(_0x4af88b){logger[_0xa310('0x26')](_0x4af88b[_0xa310('0x27')]);if(_0x4af88b[_0xa310('0x28')]){delete _0x4af88b[_0xa310('0x28')];}_0x43a20f[_0xa310('0x1e')](_0x294b53)[_0xa310('0x29')](_0x4af88b);};}exports[_0xa310('0x2a')]=function(_0x50b542,_0x51e24d){var _0x7c3879={},_0x179948={},_0x11e9ab={'count':0x0,'rows':[]};var _0x422007=db[_0xa310('0x2b')]['rawAttributes'];_0x179948['model']=_[_0xa310('0x2c')](_0x422007);_0x179948[_0xa310('0x2d')]=_[_0xa310('0x2c')](_0x50b542[_0xa310('0x2d')]);_0x179948[_0xa310('0x2e')]=_[_0xa310('0x2f')](_0x179948[_0xa310('0x30')],_0x179948['query']);_0x7c3879[_0xa310('0x31')]=_[_0xa310('0x2f')](_0x179948[_0xa310('0x30')],qs[_0xa310('0x32')](_0x50b542[_0xa310('0x2d')][_0xa310('0x32')]));_0x7c3879[_0xa310('0x31')]=_0x7c3879[_0xa310('0x31')][_0xa310('0x33')]?_0x7c3879[_0xa310('0x31')]:_0x179948[_0xa310('0x30')];if(!_0x50b542['query'][_0xa310('0x34')](_0xa310('0x35'))){_0x7c3879['limit']=qs[_0xa310('0x36')](_0x50b542[_0xa310('0x2d')]['limit']);_0x7c3879[_0xa310('0x1d')]=qs[_0xa310('0x1d')](_0x50b542[_0xa310('0x2d')][_0xa310('0x1d')]);}_0x7c3879['order']=qs[_0xa310('0x37')](_0x50b542[_0xa310('0x2d')]['sort']);_0x7c3879[_0xa310('0x38')]=qs[_0xa310('0x2e')](_[_0xa310('0x39')](_0x50b542[_0xa310('0x2d')],_0x179948['filters']));if(_0x50b542[_0xa310('0x2d')]['filter']){_0x7c3879[_0xa310('0x38')]=_[_0xa310('0x3a')](_0x7c3879[_0xa310('0x38')],{'$or':_[_0xa310('0x3b')](_0x422007,function(_0x5cefb9){if(_0x5cefb9[_0xa310('0x3c')]['key']!==_0xa310('0x3d')){var _0x3ac7cb={};_0x3ac7cb[_0x5cefb9[_0xa310('0x3e')]]={'$like':'%'+_0x50b542['query'][_0xa310('0x3f')]+'%'};return _0x3ac7cb;}})});}_0x7c3879=_[_0xa310('0x3a')]({},_0x7c3879,_0x50b542['options']);var _0x3d6e4a={'where':_0x7c3879[_0xa310('0x38')]};return db[_0xa310('0x2b')]['count'](_0x3d6e4a)['then'](function(_0x394dc6){_0x11e9ab['count']=_0x394dc6;if(_0x50b542[_0xa310('0x2d')][_0xa310('0x40')]){_0x7c3879[_0xa310('0x41')]=[{'all':!![]}];}return db['FaxQueue'][_0xa310('0x42')](_0x7c3879);})[_0xa310('0x22')](function(_0x520a9d){_0x11e9ab[_0xa310('0x43')]=_0x520a9d;return _0x11e9ab;})['then'](respondWithFilteredResult(_0x51e24d,_0x7c3879))[_0xa310('0x44')](handleError(_0x51e24d,null));};exports['show']=function(_0x277cb5,_0x1e1927){var _0x1d1893={'raw':!![],'where':{'id':_0x277cb5[_0xa310('0x45')]['id']}},_0x40a41f={};_0x40a41f[_0xa310('0x30')]=_[_0xa310('0x2c')](db['FaxQueue'][_0xa310('0x46')]);_0x40a41f[_0xa310('0x2d')]=_[_0xa310('0x2c')](_0x277cb5[_0xa310('0x2d')]);_0x40a41f['filters']=_[_0xa310('0x2f')](_0x40a41f[_0xa310('0x30')],_0x40a41f[_0xa310('0x2d')]);_0x1d1893['attributes']=_[_0xa310('0x2f')](_0x40a41f['model'],qs['fields'](_0x277cb5[_0xa310('0x2d')]['fields']));_0x1d1893[_0xa310('0x31')]=_0x1d1893[_0xa310('0x31')][_0xa310('0x33')]?_0x1d1893[_0xa310('0x31')]:_0x40a41f['model'];if(_0x277cb5[_0xa310('0x2d')][_0xa310('0x40')]){_0x1d1893['include']=[{'all':!![]}];}_0x1d1893=_[_0xa310('0x3a')]({},_0x1d1893,_0x277cb5[_0xa310('0x47')]);return db[_0xa310('0x2b')][_0xa310('0x48')](_0x1d1893)['then'](handleEntityNotFound(_0x1e1927,null))[_0xa310('0x22')](respondWithResult(_0x1e1927,null))[_0xa310('0x44')](handleError(_0x1e1927,null));};exports[_0xa310('0x49')]=function(_0x39ec70,_0x19758d){return db[_0xa310('0x2b')][_0xa310('0x49')](_0x39ec70[_0xa310('0x4a')],{})[_0xa310('0x22')](function(_0x212cdd){var _0x4a917c=_0x39ec70[_0xa310('0x4b')][_0xa310('0x4c')]({'plain':!![]});if(!_0x4a917c)throw new Error(_0xa310('0x4d'));if(_0x4a917c[_0xa310('0x4e')]==='user'){var _0x1db894=_0x212cdd[_0xa310('0x4c')]({'plain':!![]});var _0x5aa5fd=_0xa310('0x23');return db['UserProfileSection'][_0xa310('0x48')]({'where':{'name':_0x5aa5fd,'userProfileId':_0x4a917c['userProfileId']},'raw':!![]})[_0xa310('0x22')](function(_0x22c990){if(_0x22c990&&_0x22c990['autoAssociation']===0x0){return db[_0xa310('0x24')]['create']({'name':_0x1db894[_0xa310('0x28')],'resourceId':_0x1db894['id'],'type':_0x22c990[_0xa310('0x28')],'sectionId':_0x22c990['id']},{})['then'](function(){return _0x212cdd;});}else{return _0x212cdd;}})['catch'](function(_0x5c025d){logger[_0xa310('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c025d);throw _0x5c025d;});}return _0x212cdd;})[_0xa310('0x22')](respondWithResult(_0x19758d,0xc9))[_0xa310('0x44')](handleError(_0x19758d,null));};exports[_0xa310('0x21')]=function(_0x285379,_0xbfcaa7){if(_0x285379[_0xa310('0x4a')]['id']){delete _0x285379[_0xa310('0x4a')]['id'];}return db[_0xa310('0x2b')]['find']({'where':{'id':_0x285379['params']['id']}})[_0xa310('0x22')](handleEntityNotFound(_0xbfcaa7,null))[_0xa310('0x22')](saveUpdates(_0x285379['body'],null))[_0xa310('0x22')](respondWithResult(_0xbfcaa7,null))[_0xa310('0x44')](handleError(_0xbfcaa7,null));};exports[_0xa310('0x25')]=function(_0xacd21a,_0x658b0d){return db[_0xa310('0x2b')]['find']({'where':{'id':_0xacd21a[_0xa310('0x45')]['id']}})[_0xa310('0x22')](handleEntityNotFound(_0x658b0d,null))['then'](removeEntity(_0x658b0d,null))[_0xa310('0x44')](handleError(_0x658b0d,null));};exports[_0xa310('0x4f')]=function(_0xb46615,_0xb6c266){return db[_0xa310('0x2b')][_0xa310('0x4f')]()[_0xa310('0x22')](respondWithResult(_0xb6c266,null))['catch'](handleError(_0xb6c266,null));};exports[_0xa310('0x50')]=function(_0x2ebaf4,_0x48128a,_0x57c103){var _0x18623e={'raw':!![],'where':{}},_0x21b7a4={},_0x195a22;return db['FaxQueue'][_0xa310('0x51')]({'where':{'id':_0x2ebaf4[_0xa310('0x45')]['id']}})[_0xa310('0x22')](handleEntityNotFound(_0x48128a,null))['then'](function(_0x1a6b42){if(_0x1a6b42){_0x195a22=_0x1a6b42['get']({'plain':!![]});_0x21b7a4[_0xa310('0x30')]=_['keys'](db[_0xa310('0x52')][_0xa310('0x46')]);_0x21b7a4[_0xa310('0x2d')]=_[_0xa310('0x2c')](_0x2ebaf4['query']);_0x21b7a4[_0xa310('0x2e')]=_[_0xa310('0x2f')](_0x21b7a4[_0xa310('0x30')],_0x21b7a4['query']);_0x18623e[_0xa310('0x31')]=_[_0xa310('0x2f')](_0x21b7a4[_0xa310('0x30')],qs[_0xa310('0x32')](_0x2ebaf4[_0xa310('0x2d')]['fields']));_0x18623e[_0xa310('0x31')]=_0x18623e[_0xa310('0x31')][_0xa310('0x33')]?_0x18623e[_0xa310('0x31')]:_0x21b7a4[_0xa310('0x30')];if(!_0x2ebaf4[_0xa310('0x2d')]['hasOwnProperty']('nolimit')){_0x18623e[_0xa310('0x36')]=qs[_0xa310('0x36')](_0x2ebaf4[_0xa310('0x2d')][_0xa310('0x36')]);_0x18623e[_0xa310('0x1d')]=qs[_0xa310('0x1d')](_0x2ebaf4[_0xa310('0x2d')][_0xa310('0x1d')]);}_0x18623e['order']=qs[_0xa310('0x37')](_0x2ebaf4['query'][_0xa310('0x37')]);_0x18623e['where']=qs[_0xa310('0x2e')](_[_0xa310('0x39')](_0x2ebaf4[_0xa310('0x2d')],_0x21b7a4[_0xa310('0x2e')]));_0x18623e[_0xa310('0x38')][_0xa310('0x53')]=_0x1a6b42['id'];if(_0x2ebaf4[_0xa310('0x2d')][_0xa310('0x3f')]){_0x18623e['where']=_[_0xa310('0x3a')](_0x18623e[_0xa310('0x38')],{'$or':_['map'](_0x18623e[_0xa310('0x31')],function(_0xc753ca){var _0x7d173f={};_0x7d173f[_0xc753ca]={'$like':'%'+_0x2ebaf4[_0xa310('0x2d')][_0xa310('0x3f')]+'%'};return _0x7d173f;})});}_0x18623e=_['merge']({},_0x18623e,_0x2ebaf4[_0xa310('0x47')]);return db[_0xa310('0x52')][_0xa310('0x42')](_0x18623e);}})['then'](function(_0x5a4e60){if(_0x5a4e60){return db[_0xa310('0x54')][_0xa310('0x55')]({'where':{'id':_['map'](_0x5a4e60,_0xa310('0x56')),'role':_0xa310('0x57')},'attributes':['id',_0xa310('0x28'),_0xa310('0x58'),_0xa310('0x59'),_0xa310('0x5a')]});}})[_0xa310('0x22')](function(_0x17ff69){if(_0x17ff69){return{'count':_0x17ff69[_0xa310('0x1c')],'rows':_[_0xa310('0x3b')](_0x17ff69[_0xa310('0x43')],function(_0x3239ff){return{'membername':_0x3239ff[_0xa310('0x28')],'UserId':_0x3239ff['id'],'queue_name':_0x195a22[_0xa310('0x28')],'FaxQueueId':_0x195a22['id'],'interface':util[_0xa310('0x5b')]('%s/%s',_0xa310('0x5c'),_0x3239ff['name']),'penalty':0x0,'paused':_0x3239ff[_0xa310('0x58')],'createdAt':_0x3239ff[_0xa310('0x5a')],'updatedAt':_0x3239ff['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa310('0x22')](respondWithFilteredResult(_0x48128a,_0x18623e))['catch'](handleError(_0x48128a,null));};exports[_0xa310('0x5d')]=function(_0x3f1541,_0x464d74,_0x2fae46){var _0x2f15be={};var _0x37a2b7={};var _0x119bd7;var _0x2fa9cf;return db[_0xa310('0x2b')][_0xa310('0x51')]({'where':{'id':_0x3f1541[_0xa310('0x45')]['id']}})[_0xa310('0x22')](handleEntityNotFound(_0x464d74,null))[_0xa310('0x22')](function(_0x4714df){if(_0x4714df){_0x119bd7=_0x4714df;_0x37a2b7['model']=_[_0xa310('0x2c')](db[_0xa310('0x5e')][_0xa310('0x46')]);_0x37a2b7[_0xa310('0x2d')]=_['keys'](_0x3f1541[_0xa310('0x2d')]);_0x37a2b7['filters']=_['intersection'](_0x37a2b7[_0xa310('0x30')],_0x37a2b7[_0xa310('0x2d')]);_0x2f15be[_0xa310('0x31')]=_[_0xa310('0x2f')](_0x37a2b7['model'],qs[_0xa310('0x32')](_0x3f1541['query']['fields']));_0x2f15be[_0xa310('0x31')]=_0x2f15be[_0xa310('0x31')][_0xa310('0x33')]?_0x2f15be['attributes']:_0x37a2b7['model'];_0x2f15be[_0xa310('0x5f')]=qs[_0xa310('0x37')](_0x3f1541[_0xa310('0x2d')][_0xa310('0x37')]);_0x2f15be[_0xa310('0x38')]=qs[_0xa310('0x2e')](_[_0xa310('0x39')](_0x3f1541['query'],_0x37a2b7['filters']));if(_0x3f1541['query'][_0xa310('0x3f')]){_0x2f15be[_0xa310('0x38')]=_[_0xa310('0x3a')](_0x2f15be['where'],{'$or':_[_0xa310('0x3b')](_0x2f15be[_0xa310('0x31')],function(_0x538815){var _0x19816e={};_0x19816e[_0x538815]={'$like':'%'+_0x3f1541[_0xa310('0x2d')]['filter']+'%'};return _0x19816e;})});}_0x2f15be=_['merge']({},_0x2f15be,_0x3f1541[_0xa310('0x47')]);return _0x119bd7[_0xa310('0x5d')](_0x2f15be);}})[_0xa310('0x22')](function(_0x329443){if(_0x329443){_0x2fa9cf=_0x329443[_0xa310('0x33')];if(!_0x3f1541[_0xa310('0x2d')][_0xa310('0x34')](_0xa310('0x35'))){_0x2f15be[_0xa310('0x36')]=qs[_0xa310('0x36')](_0x3f1541[_0xa310('0x2d')]['limit']);_0x2f15be[_0xa310('0x1d')]=qs[_0xa310('0x1d')](_0x3f1541[_0xa310('0x2d')][_0xa310('0x1d')]);}return _0x119bd7[_0xa310('0x5d')](_0x2f15be);}})[_0xa310('0x22')](function(_0x47cbbb){if(_0x47cbbb){return _0x47cbbb?{'count':_0x2fa9cf,'rows':_0x47cbbb}:null;}})[_0xa310('0x22')](respondWithResult(_0x464d74,null))[_0xa310('0x44')](handleError(_0x464d74,null));};exports[_0xa310('0x60')]=function(_0x136afd,_0x3ef45b,_0x434968){var _0x37e6e4=_0x136afd[_0xa310('0x4a')][_0xa310('0x61')];return db[_0xa310('0x5e')]['findAll']({'where':{'id':_[_0xa310('0x3b')](_0x37e6e4,'id')},'attributes':['id'],'include':[{'model':db[_0xa310('0x54')],'as':_0xa310('0x62'),'attributes':['id',_0xa310('0x28'),_0xa310('0x63'),_0xa310('0x64'),'interface'],'raw':!![]}]})['then'](function(_0x48bf17){if(_0x48bf17){var _0x4bf3ea=_[_0xa310('0x65')](_0x48bf17,function(_0x480ae8){var _0x29a569=_0x480ae8[_0xa310('0x4c')]({'plain':!![]});return _0x29a569[_0xa310('0x62')];});return db[_0xa310('0x2b')]['find']({'where':{'id':_0x136afd[_0xa310('0x45')]['id']}})['then'](function(_0x21b35c){return db[_0xa310('0x66')]['transaction'](function(_0x4d9edb){return _0x21b35c['addTeams'](_[_0xa310('0x3b')](_0x37e6e4,'id'),{'transaction':_0x4d9edb})[_0xa310('0x22')](function(){return BPromise['each'](_0x4bf3ea,function(_0x4fb086){return db['UserFaxQueue'][_0xa310('0x67')]({'where':{'UserId':_0x4fb086['id'],'FaxQueueId':_0x136afd['params']['id']},'transaction':_0x4d9edb});});})[_0xa310('0x22')](function(){_0x4bf3ea['forEach'](function(_0x291d05){socket[_0xa310('0x68')](_0xa310('0x69'),{'UserId':_0x291d05['id'],'FaxQueueId':_0x21b35c['id']});});});});});}})[_0xa310('0x22')](respondWithStatusCode(_0x3ef45b,null))[_0xa310('0x44')](handleError(_0x3ef45b,null));};exports[_0xa310('0x6a')]=function(_0xd214d8,_0x54d90c,_0x2d493e){return db['Team'][_0xa310('0x42')]({'where':{'id':_0xd214d8[_0xa310('0x2d')][_0xa310('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa310('0x62'),'attributes':['id'],'raw':!![]}]})[_0xa310('0x22')](handleEntityNotFound(_0x54d90c,null))[_0xa310('0x22')](function(_0x314a5d){var _0x3c023a=_['map'](_0x314a5d,'id');var _0xd4e9fb=[];var _0x222cd7=[];var _0x554354=squel[_0xa310('0x6c')]();_0x554354[_0xa310('0x3e')](_0xa310('0x6d'))[_0xa310('0x6e')]('team_has_fax_queues','tq')[_0xa310('0x6f')](_0xa310('0x70'),'ut',_0xa310('0x71'))[_0xa310('0x38')](_0xa310('0x72'),_0xd214d8[_0xa310('0x45')]['id']);for(var _0x28d069=0x0;_0x28d069<_0x314a5d[_0xa310('0x33')];_0x28d069+=0x1){let _0x1411f3=_0x314a5d[_0x28d069];for(var _0x436bae=0x0;_0x436bae<_0x1411f3[_0xa310('0x62')]['length'];_0x436bae+=0x1){let _0x5b6185=_0x1411f3[_0xa310('0x62')][_0x436bae];var _0x1e3703=_0x554354[_0xa310('0x73')]();_0x1e3703[_0xa310('0x38')](_0xa310('0x74'),_0x5b6185['id']);_0x222cd7[_0xa310('0x75')](db[_0xa310('0x66')][_0xa310('0x2d')](_0x1e3703[_0xa310('0x76')](),{'type':db[_0xa310('0x66')][_0xa310('0x77')]['SELECT']})[_0xa310('0x22')](function(_0x1db5c4){if(_0x1db5c4[_0xa310('0x33')]===0x1){return _0x5b6185['id'];}else{var _0x529af8=_['every'](_[_0xa310('0x3b')](_0x1db5c4,'TeamId'),function(_0x7571f6){return _[_0xa310('0x78')](_0x3c023a,_0x7571f6);});if(_0x529af8){return _0x5b6185['id'];}}}));}}return BPromise[_0xa310('0x79')](_0x222cd7)[_0xa310('0x22')](function(_0x1c1351){_0xd4e9fb=_(_0xd4e9fb)[_0xa310('0x7a')](_0x1c1351)[_0xa310('0x7b')]()[_0xa310('0x7c')]();return db[_0xa310('0x2b')][_0xa310('0x48')]({'where':{'id':_0xd214d8[_0xa310('0x45')]['id']}})[_0xa310('0x22')](function(_0x2ad0f4){return db[_0xa310('0x66')][_0xa310('0x7d')](function(_0x8108f2){return _0x2ad0f4[_0xa310('0x6a')](_0xd214d8[_0xa310('0x2d')][_0xa310('0x6b')],{'transaction':_0x8108f2})[_0xa310('0x22')](function(){if(!_[_0xa310('0x7e')](_0xd4e9fb)){return _0x2ad0f4[_0xa310('0x7f')](_0xd4e9fb,{'transaction':_0x8108f2});}})[_0xa310('0x22')](function(){_0xd4e9fb[_0xa310('0x80')](function(_0x22b9ed){socket[_0xa310('0x68')]('userFaxQueue:remove',{'UserId':_0x22b9ed,'FaxQueueId':_0x2ad0f4['id']});});});});});});})[_0xa310('0x22')](respondWithStatusCode(_0x54d90c,null))[_0xa310('0x44')](handleError(_0x54d90c,null));};exports[_0xa310('0x81')]=function(_0x3bc267,_0x1c8f23,_0x4e9d99){return db[_0xa310('0x2b')]['find']({'where':{'id':_0x3bc267['params']['id']}})[_0xa310('0x22')](handleEntityNotFound(_0x1c8f23,null))[_0xa310('0x22')](function(_0x359dd3){if(_0x359dd3){return _0x359dd3[_0xa310('0x81')](_0x3bc267[_0xa310('0x4a')][_0xa310('0x6b')],_[_0xa310('0x82')](_0x3bc267[_0xa310('0x4a')],[_0xa310('0x6b'),'id'])||{})[_0xa310('0x83')](function(_0x47ca07){for(var _0x24ec1e=0x0;_0x24ec1e<_0x3bc267[_0xa310('0x4a')][_0xa310('0x6b')][_0xa310('0x33')];_0x24ec1e+=0x1){socket[_0xa310('0x68')](_0xa310('0x69'),{'UserId':_0x3bc267[_0xa310('0x4a')][_0xa310('0x6b')][_0x24ec1e],'FaxQueueId':_0x3bc267[_0xa310('0x45')]['id']});}return _0x47ca07;});}})[_0xa310('0x22')](respondWithResult(_0x1c8f23,null))[_0xa310('0x44')](handleError(_0x1c8f23,null));};exports['removeAgents']=function(_0x4d1e7d,_0x30d9b6,_0x5e7dfb){return db[_0xa310('0x2b')][_0xa310('0x48')]({'where':{'id':_0x4d1e7d[_0xa310('0x45')]['id']}})[_0xa310('0x22')](handleEntityNotFound(_0x30d9b6,null))[_0xa310('0x22')](function(_0x3ada6e){if(_0x3ada6e){return _0x3ada6e[_0xa310('0x7f')](_0x4d1e7d[_0xa310('0x2d')][_0xa310('0x6b')])['then'](function(){if(_[_0xa310('0x84')](_0x4d1e7d[_0xa310('0x2d')][_0xa310('0x6b')])){for(var _0x5746a6=0x0;_0x5746a6<_0x4d1e7d[_0xa310('0x2d')][_0xa310('0x6b')][_0xa310('0x33')];_0x5746a6+=0x1){socket[_0xa310('0x68')](_0xa310('0x85'),{'UserId':Number(_0x4d1e7d[_0xa310('0x2d')]['ids'][_0x5746a6]),'FaxQueueId':Number(_0x4d1e7d['params']['id'])});}}else{socket['emit'](_0xa310('0x85'),{'UserId':Number(_0x4d1e7d[_0xa310('0x2d')][_0xa310('0x6b')]),'FaxQueueId':Number(_0x4d1e7d['params']['id'])});}});}})[_0xa310('0x22')](respondWithStatusCode(_0x30d9b6,null))[_0xa310('0x44')](handleError(_0x30d9b6,null));};exports[_0xa310('0x86')]=function(_0x42581e,_0xca72ac,_0x51de89){var _0x537ec0={};var _0x246104={};var _0x3d01f5;var _0x47fc2e;return db[_0xa310('0x2b')][_0xa310('0x51')]({'where':{'id':_0x42581e[_0xa310('0x45')]['id']}})['then'](handleEntityNotFound(_0xca72ac,null))['then'](function(_0xdf6cad){if(_0xdf6cad){_0x3d01f5=_0xdf6cad;_0x246104[_0xa310('0x30')]=_['keys'](db['User'][_0xa310('0x46')]);_0x246104['query']=_[_0xa310('0x2c')](_0x42581e['query']);_0x246104[_0xa310('0x2e')]=_[_0xa310('0x2f')](_0x246104['model'],_0x246104[_0xa310('0x2d')]);_0x537ec0[_0xa310('0x31')]=_[_0xa310('0x2f')](_0x246104[_0xa310('0x30')],qs[_0xa310('0x32')](_0x42581e[_0xa310('0x2d')][_0xa310('0x32')]));_0x537ec0['attributes']=_0x537ec0['attributes'][_0xa310('0x33')]?_0x537ec0[_0xa310('0x31')]:_0x246104[_0xa310('0x30')];_0x537ec0['order']=qs[_0xa310('0x37')](_0x42581e[_0xa310('0x2d')][_0xa310('0x37')]);_0x537ec0[_0xa310('0x38')]=qs[_0xa310('0x2e')](_['pick'](_0x42581e[_0xa310('0x2d')],_0x246104['filters']));if(_0x42581e[_0xa310('0x2d')][_0xa310('0x3f')]){_0x537ec0[_0xa310('0x38')]=_['merge'](_0x537ec0[_0xa310('0x38')],{'$or':_[_0xa310('0x3b')](_0x537ec0[_0xa310('0x31')],function(_0x30b230){var _0x324d80={};_0x324d80[_0x30b230]={'$like':'%'+_0x42581e[_0xa310('0x2d')][_0xa310('0x3f')]+'%'};return _0x324d80;})});}_0x537ec0=_[_0xa310('0x3a')]({},_0x537ec0,_0x42581e[_0xa310('0x47')]);return _0x3d01f5['getAgents'](_0x537ec0);}})[_0xa310('0x22')](function(_0x41f1c5){if(_0x41f1c5){_0x47fc2e=_0x41f1c5[_0xa310('0x33')];if(!_0x42581e['query'][_0xa310('0x34')](_0xa310('0x35'))){_0x537ec0[_0xa310('0x36')]=qs[_0xa310('0x36')](_0x42581e[_0xa310('0x2d')][_0xa310('0x36')]);_0x537ec0[_0xa310('0x1d')]=qs[_0xa310('0x1d')](_0x42581e[_0xa310('0x2d')][_0xa310('0x1d')]);}return _0x3d01f5[_0xa310('0x86')](_0x537ec0);}})[_0xa310('0x22')](function(_0x5883a2){if(_0x5883a2){return _0x5883a2?{'count':_0x47fc2e,'rows':_0x5883a2}:null;}})[_0xa310('0x22')](respondWithResult(_0xca72ac,null))['catch'](handleError(_0xca72ac,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e8514fa..2d56bb8 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 _0x0713=['exports','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x3071('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3071('0x1')](0x0);var events={'afterCreate':_0x3071('0x2'),'afterUpdate':_0x3071('0x3'),'afterDestroy':_0x3071('0x4')};function emitEvent(_0x52b5fb){return function(_0x2c547f,_0x7b18a4,_0x33a70c){FaxQueueEvents[_0x3071('0x5')](_0x52b5fb+':'+_0x2c547f['id'],_0x2c547f);FaxQueueEvents[_0x3071('0x5')](_0x52b5fb,_0x2c547f);_0x33a70c(null);};}for(var e in events){if(events[_0x3071('0x6')](e)){var event=events[e];FaxQueue[_0x3071('0x7')](e,emitEvent(event));}}module[_0x3071('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xac4a=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook','events'];(function(_0x3e5595,_0x1f1b04){var _0x5a64c0=function(_0x2b1cc4){while(--_0x2b1cc4){_0x3e5595['push'](_0x3e5595['shift']());}};_0x5a64c0(++_0x1f1b04);}(_0xac4a,0x13f));var _0xaac4=function(_0x3c8c91,_0x4fcb8b){_0x3c8c91=_0x3c8c91-0x0;var _0x3748b9=_0xac4a[_0x3c8c91];return _0x3748b9;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var FaxQueue=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){FaxQueueEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);FaxQueueEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0f38e84..85ca37e 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 _0x5f2f=['bluebird','request-promise','path','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x5323e5,_0x135a96){var _0x4f3daf=function(_0x1686f3){while(--_0x1686f3){_0x5323e5['push'](_0x5323e5['shift']());}};_0x4f3daf(++_0x135a96);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24a9eb,_0x3849df){_0x24a9eb=_0x24a9eb-0x0;var _0x37a2c7=_0x5f2f[_0x24a9eb];return _0x37a2c7;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x430cd5,_0x2f935b){var _0x59fb5=function(_0x728d6){while(--_0x728d6){_0x430cd5['push'](_0x430cd5['shift']());}};_0x59fb5(++_0x2f935b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0x0b0e[_0x51cc1d];return _0x2eb9f2;};'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')]('FaxQueue',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 313885c..f6619ca 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 _0x1aee=['GetFaxQueue','stringify','find','ShowFaxQueue','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','FaxQueue,\x20%s,\x20%s','result','catch','FaxQueue','findAll','options','where','limit','map','model','attributes','include'];(function(_0x1f2393,_0x1a2b8f){var _0x4ccfc9=function(_0x557bda){while(--_0x557bda){_0x1f2393['push'](_0x1f2393['shift']());}};_0x4ccfc9(++_0x1a2b8f);}(_0x1aee,0x176));var _0xe1ae=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0x1aee[_0x509273];return _0x38ef40;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1ae('0x0'));var BPromise=require('bluebird');var rs=require(_0xe1ae('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe1ae('0x2'))['db'];var utils=require(_0xe1ae('0x3'));var logger=require(_0xe1ae('0x4'))(_0xe1ae('0x5'));var config=require(_0xe1ae('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe1ae('0x7')]({'port':0x232a});config[_0xe1ae('0x8')]=_['defaults'](config[_0xe1ae('0x8')],{'host':_0xe1ae('0x9'),'port':0x18eb});var socket=require(_0xe1ae('0xa'))(new Redis(config[_0xe1ae('0x8')]));require(_0xe1ae('0xb'))[_0xe1ae('0xc')](socket);function respondWithRpcPromise(_0x44f0ab,_0x51a702,_0x1f683c){return new BPromise(function(_0xd89138,_0x4c0ac0){return client[_0xe1ae('0xd')](_0x44f0ab,_0x1f683c)[_0xe1ae('0xe')](function(_0x514ced){logger[_0xe1ae('0xf')]('FaxQueue,\x20%s,\x20%s',_0x51a702,_0xe1ae('0x10'));logger[_0xe1ae('0x11')](_0xe1ae('0x12'),_0x51a702,_0xe1ae('0x10'),JSON['stringify'](_0x514ced));if(_0x514ced[_0xe1ae('0x13')]){if(_0x514ced['error']['code']===0x1f4){logger[_0xe1ae('0x13')]('FaxQueue,\x20%s,\x20%s',_0x51a702,_0x514ced['error'][_0xe1ae('0x14')]);return _0x4c0ac0(_0x514ced[_0xe1ae('0x13')][_0xe1ae('0x14')]);}logger[_0xe1ae('0x13')](_0xe1ae('0x15'),_0x51a702,_0x514ced[_0xe1ae('0x13')][_0xe1ae('0x14')]);return _0xd89138(_0x514ced[_0xe1ae('0x13')][_0xe1ae('0x14')]);}else{logger[_0xe1ae('0xf')](_0xe1ae('0x15'),_0x51a702,_0xe1ae('0x10'));_0xd89138(_0x514ced[_0xe1ae('0x16')][_0xe1ae('0x14')]);}})[_0xe1ae('0x17')](function(_0x31476d){logger['error'](_0xe1ae('0x15'),_0x51a702,_0x31476d);_0x4c0ac0(_0x31476d);});});}exports['GetFaxQueue']=function(_0x2d6f5c){var _0x2c0703=this;return new Promise(function(_0xa628ae,_0x568491){return db[_0xe1ae('0x18')][_0xe1ae('0x19')]({'raw':_0x2d6f5c[_0xe1ae('0x1a')]?_0x2d6f5c['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d6f5c['options']?_0x2d6f5c[_0xe1ae('0x1a')][_0xe1ae('0x1b')]||null:null,'attributes':_0x2d6f5c[_0xe1ae('0x1a')]?_0x2d6f5c[_0xe1ae('0x1a')]['attributes']||null:null,'limit':_0x2d6f5c[_0xe1ae('0x1a')]?_0x2d6f5c[_0xe1ae('0x1a')][_0xe1ae('0x1c')]||null:null,'include':_0x2d6f5c[_0xe1ae('0x1a')]?_0x2d6f5c[_0xe1ae('0x1a')]['include']?_[_0xe1ae('0x1d')](_0x2d6f5c[_0xe1ae('0x1a')]['include'],function(_0x24aeb1){return{'model':db[_0x24aeb1[_0xe1ae('0x1e')]],'as':_0x24aeb1['as'],'attributes':_0x24aeb1[_0xe1ae('0x1f')],'include':_0x24aeb1[_0xe1ae('0x20')]?_[_0xe1ae('0x1d')](_0x24aeb1[_0xe1ae('0x20')],function(_0x388ba6){return{'model':db[_0x388ba6[_0xe1ae('0x1e')]],'as':_0x388ba6['as'],'attributes':_0x388ba6[_0xe1ae('0x1f')],'include':_0x388ba6['include']?_[_0xe1ae('0x1d')](_0x388ba6[_0xe1ae('0x20')],function(_0x3b0633){return{'model':db[_0x3b0633['model']],'as':_0x3b0633['as'],'attributes':_0x3b0633[_0xe1ae('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe1ae('0xe')](function(_0x326119){logger[_0xe1ae('0xf')](_0xe1ae('0x21'),_0x2d6f5c);logger[_0xe1ae('0x11')](_0xe1ae('0x21'),_0x2d6f5c,JSON[_0xe1ae('0x22')](_0x326119));_0xa628ae(_0x326119);})[_0xe1ae('0x17')](function(_0x40ae5b){logger[_0xe1ae('0x13')](_0xe1ae('0x21'),_0x40ae5b[_0xe1ae('0x14')],_0x2d6f5c);_0x568491(_0x2c0703[_0xe1ae('0x13')](0x1f4,_0x40ae5b[_0xe1ae('0x14')]));});});};exports['ShowFaxQueue']=function(_0x24b914){var _0x3e44da=this;return new Promise(function(_0xabb993,_0x4e29dc){return db['FaxQueue'][_0xe1ae('0x23')]({'raw':_0x24b914['options']?_0x24b914[_0xe1ae('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24b914['options']?_0x24b914[_0xe1ae('0x1a')][_0xe1ae('0x1b')]||null:null,'attributes':_0x24b914[_0xe1ae('0x1a')]?_0x24b914[_0xe1ae('0x1a')][_0xe1ae('0x1f')]||null:null,'include':_0x24b914[_0xe1ae('0x1a')]?_0x24b914[_0xe1ae('0x1a')][_0xe1ae('0x20')]?_['map'](_0x24b914['options']['include'],function(_0x53f779){return{'model':db[_0x53f779['model']],'as':_0x53f779['as'],'attributes':_0x53f779[_0xe1ae('0x1f')],'include':_0x53f779['include']?_[_0xe1ae('0x1d')](_0x53f779[_0xe1ae('0x20')],function(_0x22132e){return{'model':db[_0x22132e[_0xe1ae('0x1e')]],'as':_0x22132e['as'],'attributes':_0x22132e[_0xe1ae('0x1f')],'include':_0x22132e[_0xe1ae('0x20')]?_[_0xe1ae('0x1d')](_0x22132e[_0xe1ae('0x20')],function(_0x42587e){return{'model':db[_0x42587e[_0xe1ae('0x1e')]],'as':_0x42587e['as'],'attributes':_0x42587e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ae('0xe')](function(_0xfa8132){logger[_0xe1ae('0xf')](_0xe1ae('0x24'),_0x24b914);logger['debug']('ShowFaxQueue',_0x24b914,JSON[_0xe1ae('0x22')](_0xfa8132));_0xabb993(_0xfa8132);})['catch'](function(_0x564748){logger[_0xe1ae('0x13')](_0xe1ae('0x24'),_0x564748[_0xe1ae('0x14')],_0x24b914);_0x4e29dc(_0x3e44da[_0xe1ae('0x13')](0x1f4,_0x564748[_0xe1ae('0x14')]));});});}; \ No newline at end of file +var _0x1905=['find','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxQueue','ShowFaxQueue'];(function(_0x5e215e,_0xc82305){var _0x5e2d25=function(_0x29c276){while(--_0x29c276){_0x5e215e['push'](_0x5e215e['shift']());}};_0x5e2d25(++_0xc82305);}(_0x1905,0x74));var _0x5190=function(_0x1a7d97,_0x236956){_0x1a7d97=_0x1a7d97-0x0;var _0x21ef71=_0x1905[_0x1a7d97];return _0x21ef71;};'use strict';var _=require(_0x5190('0x0'));var util=require(_0x5190('0x1'));var moment=require('moment');var BPromise=require(_0x5190('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5190('0x3'));var db=require(_0x5190('0x4'))['db'];var utils=require(_0x5190('0x5'));var logger=require(_0x5190('0x6'))(_0x5190('0x7'));var config=require(_0x5190('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5190('0x9')]['http']({'port':0x232a});config[_0x5190('0xa')]=_[_0x5190('0xb')](config[_0x5190('0xa')],{'host':_0x5190('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5190('0xd'))[_0x5190('0xe')](socket);function respondWithRpcPromise(_0x17249a,_0x34c522,_0x3e1c4f){return new BPromise(function(_0x35e5fc,_0x4714c7){return client['request'](_0x17249a,_0x3e1c4f)[_0x5190('0xf')](function(_0x361ffd){logger['info'](_0x5190('0x10'),_0x34c522,_0x5190('0x11'));logger['debug'](_0x5190('0x12'),_0x34c522,_0x5190('0x11'),JSON[_0x5190('0x13')](_0x361ffd));if(_0x361ffd[_0x5190('0x14')]){if(_0x361ffd[_0x5190('0x14')]['code']===0x1f4){logger['error'](_0x5190('0x10'),_0x34c522,_0x361ffd[_0x5190('0x14')][_0x5190('0x15')]);return _0x4714c7(_0x361ffd[_0x5190('0x14')][_0x5190('0x15')]);}logger[_0x5190('0x14')](_0x5190('0x10'),_0x34c522,_0x361ffd[_0x5190('0x14')]['message']);return _0x35e5fc(_0x361ffd[_0x5190('0x14')][_0x5190('0x15')]);}else{logger[_0x5190('0x16')]('FaxQueue,\x20%s,\x20%s',_0x34c522,'request\x20sent');_0x35e5fc(_0x361ffd['result']['message']);}})[_0x5190('0x17')](function(_0xe809db){logger[_0x5190('0x14')](_0x5190('0x10'),_0x34c522,_0xe809db);_0x4714c7(_0xe809db);});});}exports['GetFaxQueue']=function(_0x10e53b){var _0x460c69=this;return new Promise(function(_0x52eee1,_0x2fd3b7){return db[_0x5190('0x18')][_0x5190('0x19')]({'raw':_0x10e53b[_0x5190('0x1a')]?_0x10e53b[_0x5190('0x1a')][_0x5190('0x1b')]===undefined?!![]:![]:!![],'where':_0x10e53b['options']?_0x10e53b['options'][_0x5190('0x1c')]||null:null,'attributes':_0x10e53b['options']?_0x10e53b['options'][_0x5190('0x1d')]||null:null,'limit':_0x10e53b[_0x5190('0x1a')]?_0x10e53b['options'][_0x5190('0x1e')]||null:null,'include':_0x10e53b['options']?_0x10e53b[_0x5190('0x1a')][_0x5190('0x1f')]?_['map'](_0x10e53b['options'][_0x5190('0x1f')],function(_0x22bf45){return{'model':db[_0x22bf45[_0x5190('0x20')]],'as':_0x22bf45['as'],'attributes':_0x22bf45[_0x5190('0x1d')],'include':_0x22bf45['include']?_[_0x5190('0x21')](_0x22bf45[_0x5190('0x1f')],function(_0x28db4f){return{'model':db[_0x28db4f[_0x5190('0x20')]],'as':_0x28db4f['as'],'attributes':_0x28db4f['attributes'],'include':_0x28db4f['include']?_[_0x5190('0x21')](_0x28db4f['include'],function(_0x4ec401){return{'model':db[_0x4ec401[_0x5190('0x20')]],'as':_0x4ec401['as'],'attributes':_0x4ec401[_0x5190('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2134fe){logger['info'](_0x5190('0x22'),_0x10e53b);logger['debug'](_0x5190('0x22'),_0x10e53b,JSON[_0x5190('0x13')](_0x2134fe));_0x52eee1(_0x2134fe);})['catch'](function(_0x32fa04){logger[_0x5190('0x14')](_0x5190('0x22'),_0x32fa04[_0x5190('0x15')],_0x10e53b);_0x2fd3b7(_0x460c69[_0x5190('0x14')](0x1f4,_0x32fa04[_0x5190('0x15')]));});});};exports[_0x5190('0x23')]=function(_0x3f3857){var _0xb49d49=this;return new Promise(function(_0x48afb1,_0x5c0b67){return db[_0x5190('0x18')][_0x5190('0x24')]({'raw':_0x3f3857[_0x5190('0x1a')]?_0x3f3857[_0x5190('0x1a')][_0x5190('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f3857['options']?_0x3f3857[_0x5190('0x1a')][_0x5190('0x1c')]||null:null,'attributes':_0x3f3857[_0x5190('0x1a')]?_0x3f3857[_0x5190('0x1a')][_0x5190('0x1d')]||null:null,'include':_0x3f3857[_0x5190('0x1a')]?_0x3f3857[_0x5190('0x1a')][_0x5190('0x1f')]?_[_0x5190('0x21')](_0x3f3857['options'][_0x5190('0x1f')],function(_0x279a71){return{'model':db[_0x279a71[_0x5190('0x20')]],'as':_0x279a71['as'],'attributes':_0x279a71[_0x5190('0x1d')],'include':_0x279a71[_0x5190('0x1f')]?_[_0x5190('0x21')](_0x279a71[_0x5190('0x1f')],function(_0x5d3fc5){return{'model':db[_0x5d3fc5[_0x5190('0x20')]],'as':_0x5d3fc5['as'],'attributes':_0x5d3fc5[_0x5190('0x1d')],'include':_0x5d3fc5[_0x5190('0x1f')]?_[_0x5190('0x21')](_0x5d3fc5[_0x5190('0x1f')],function(_0x1fe76f){return{'model':db[_0x1fe76f[_0x5190('0x20')]],'as':_0x1fe76f['as'],'attributes':_0x1fe76f[_0x5190('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5190('0xf')](function(_0x38e650){logger[_0x5190('0x16')](_0x5190('0x23'),_0x3f3857);logger[_0x5190('0x25')](_0x5190('0x23'),_0x3f3857,JSON[_0x5190('0x13')](_0x38e650));_0x48afb1(_0x38e650);})['catch'](function(_0x10a403){logger[_0x5190('0x14')](_0x5190('0x23'),_0x10a403[_0x5190('0x15')],_0x3f3857);_0x5c0b67(_0xb49d49['error'](0x1f4,_0x10a403[_0x5190('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d363206..9ac13d0 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 _0x2222=['removeListener','register','length','faxQueue:','save','remove','update','emit'];(function(_0x1cd585,_0x54276b){var _0x3ca87f=function(_0x224de8){while(--_0x224de8){_0x1cd585['push'](_0x1cd585['shift']());}};_0x3ca87f(++_0x54276b);}(_0x2222,0x8c));var _0x2222=function(_0x356d22,_0x50e7b4){_0x356d22=_0x356d22-0x0;var _0x1e29d0=_0x2222[_0x356d22];return _0x1e29d0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x2222('0x0'),_0x2222('0x1'),_0x2222('0x2')];function createListener(_0x38f2e8,_0x2ba6d2){return function(_0xa696ee){_0x2ba6d2[_0x2222('0x3')](_0x38f2e8,_0xa696ee);};}function removeListener(_0x3c71bf,_0x31de68){return function(){FaxQueueEvents[_0x2222('0x4')](_0x3c71bf,_0x31de68);};}exports[_0x2222('0x5')]=function(_0x26dc03){for(var _0x4f477a=0x0,_0x38b66b=events[_0x2222('0x6')];_0x4f477a<_0x38b66b;_0x4f477a++){var _0x23e464=events[_0x4f477a];var _0x60c3ae=createListener(_0x2222('0x7')+_0x23e464,_0x26dc03);FaxQueueEvents['on'](_0x23e464,_0x60c3ae);}}; \ No newline at end of file +var _0x7086=['length','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x70a7bc,_0x8cccc0){var _0x379a84=function(_0x217cdb){while(--_0x217cdb){_0x70a7bc['push'](_0x70a7bc['shift']());}};_0x379a84(++_0x8cccc0);}(_0x7086,0x91));var _0x6708=function(_0x109ca9,_0x153588){_0x109ca9=_0x109ca9-0x0;var _0x5e1383=_0x7086[_0x109ca9];return _0x5e1383;};'use strict';var FaxQueueEvents=require(_0x6708('0x0'));var events=[_0x6708('0x1'),_0x6708('0x2'),_0x6708('0x3')];function createListener(_0x227e4f,_0x2f4ee0){return function(_0x4023c8){_0x2f4ee0[_0x6708('0x4')](_0x227e4f,_0x4023c8);};}function removeListener(_0x1e2f53,_0x3db0a1){return function(){FaxQueueEvents[_0x6708('0x5')](_0x1e2f53,_0x3db0a1);};}exports[_0x6708('0x6')]=function(_0x190f95){for(var _0x5ade8d=0x0,_0x2e518d=events[_0x6708('0x7')];_0x5ade8d<_0x2e518d;_0x5ade8d++){var _0x2af9cc=events[_0x5ade8d];var _0x1a21fe=createListener('faxQueue:'+_0x2af9cc,_0x190f95);FaxQueueEvents['on'](_0x2af9cc,_0x1a21fe);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 202d145..32c0bd1 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 _0xa39e=['/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xa39e,0xdd));var _0xea39=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0xa39e[_0x5c4585];return _0x21dede;};'use strict';var multer=require(_0xea39('0x0'));var util=require(_0xea39('0x1'));var path=require(_0xea39('0x2'));var timeout=require(_0xea39('0x3'));var express=require(_0xea39('0x4'));var router=express['Router']();var auth=require(_0xea39('0x5'));var interaction=require(_0xea39('0x6'));var config=require('../../config/environment');var controller=require(_0xea39('0x7'));router[_0xea39('0x8')]('/',auth[_0xea39('0x9')](),controller[_0xea39('0xa')]);router[_0xea39('0x8')](_0xea39('0xb'),auth[_0xea39('0x9')](),controller[_0xea39('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xea39('0xd'),auth[_0xea39('0x9')](),controller[_0xea39('0xe')]);router[_0xea39('0x8')](_0xea39('0xf'),auth['isAuthenticated'](),controller[_0xea39('0x10')]);router[_0xea39('0x8')](_0xea39('0x11'),auth[_0xea39('0x9')](),controller[_0xea39('0x12')]);router[_0xea39('0x13')]('/',auth[_0xea39('0x9')](),controller[_0xea39('0x14')]);router[_0xea39('0x13')](_0xea39('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xea39('0x9')](),controller[_0xea39('0x15')]);router[_0xea39('0x16')](_0xea39('0x17'),auth[_0xea39('0x9')](),controller['update']);router[_0xea39('0x18')]('/:id',auth[_0xea39('0x9')](),controller[_0xea39('0x19')]);router['delete'](_0xea39('0xf'),auth['isAuthenticated'](),controller[_0xea39('0x1a')]);router[_0xea39('0x18')]('/:id/users',auth[_0xea39('0x9')](),controller[_0xea39('0x1b')]);module[_0xea39('0x1c')]=router; \ No newline at end of file +var _0xb043=['express','Router','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout'];(function(_0x260dcb,_0x400ca4){var _0x1ca938=function(_0x460910){while(--_0x460910){_0x260dcb['push'](_0x260dcb['shift']());}};_0x1ca938(++_0x400ca4);}(_0xb043,0x159));var _0x3b04=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb043[_0x52e68e];return _0x3211a4;};'use strict';var multer=require('multer');var util=require(_0x3b04('0x0'));var path=require(_0x3b04('0x1'));var timeout=require(_0x3b04('0x2'));var express=require(_0x3b04('0x3'));var router=express[_0x3b04('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3b04('0x5'));var config=require(_0x3b04('0x6'));var controller=require(_0x3b04('0x7'));router[_0x3b04('0x8')]('/',auth[_0x3b04('0x9')](),controller[_0x3b04('0xa')]);router[_0x3b04('0x8')](_0x3b04('0xb'),auth['isAuthenticated'](),controller[_0x3b04('0xc')]);router[_0x3b04('0x8')](_0x3b04('0xd'),auth['isAuthenticated'](),controller[_0x3b04('0xe')]);router['get'](_0x3b04('0xf'),auth[_0x3b04('0x9')](),controller[_0x3b04('0x10')]);router[_0x3b04('0x8')](_0x3b04('0x11'),auth[_0x3b04('0x9')](),controller['getTeams']);router[_0x3b04('0x8')](_0x3b04('0x12'),auth['isAuthenticated'](),controller[_0x3b04('0x13')]);router[_0x3b04('0x14')]('/',auth[_0x3b04('0x9')](),controller[_0x3b04('0x15')]);router['post'](_0x3b04('0x11'),auth[_0x3b04('0x9')](),controller[_0x3b04('0x16')]);router['post'](_0x3b04('0x12'),auth[_0x3b04('0x9')](),controller[_0x3b04('0x17')]);router[_0x3b04('0x18')](_0x3b04('0xd'),auth[_0x3b04('0x9')](),controller['update']);router[_0x3b04('0x19')](_0x3b04('0xd'),auth['isAuthenticated'](),controller[_0x3b04('0x1a')]);router[_0x3b04('0x19')](_0x3b04('0x11'),auth['isAuthenticated'](),controller[_0x3b04('0x1b')]);router['delete'](_0x3b04('0x12'),auth['isAuthenticated'](),controller[_0x3b04('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 2f9b522..cd2a128 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 _0x17f7=['DATE','STRING','moment','exports'];(function(_0x40b2ce,_0x97223c){var _0x3ed488=function(_0x2c83cc){while(--_0x2c83cc){_0x40b2ce['push'](_0x40b2ce['shift']());}};_0x3ed488(++_0x97223c);}(_0x17f7,0x16a));var _0x717f=function(_0x481a3e,_0x11b5ab){_0x481a3e=_0x481a3e-0x0;var _0x4f90c7=_0x17f7[_0x481a3e];return _0x4f90c7;};'use strict';var moment=require(_0x717f('0x0'));var Sequelize=require('sequelize');module[_0x717f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x717f('0x2')]},'leaveAt':{'type':Sequelize[_0x717f('0x2')]},'acceptAt':{'type':Sequelize[_0x717f('0x2')]},'exitAt':{'type':Sequelize[_0x717f('0x2')]},'reason':{'type':Sequelize[_0x717f('0x3')]}}; \ No newline at end of file +var _0xf26b=['DATE','sequelize','STRING'];(function(_0x3f9471,_0x4f2092){var _0x24709d=function(_0x50cecd){while(--_0x50cecd){_0x3f9471['push'](_0x3f9471['shift']());}};_0x24709d(++_0x4f2092);}(_0xf26b,0x163));var _0xbf26=function(_0x3e0971,_0x1eb602){_0x3e0971=_0x3e0971-0x0;var _0x14af9c=_0xf26b[_0x3e0971];return _0x14af9c;};'use strict';var moment=require('moment');var Sequelize=require(_0xbf26('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbf26('0x1')]},'joinAt':{'type':Sequelize[_0xbf26('0x2')]},'leaveAt':{'type':Sequelize[_0xbf26('0x2')]},'acceptAt':{'type':Sequelize[_0xbf26('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbf26('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2d5be79..63e95e2 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 _0xfcbe=['key','VIRTUAL','field','options','includeAll','include','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../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','FaxQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map'];(function(_0x3eee1f,_0x3b0b3b){var _0xa21088=function(_0x381b16){while(--_0x381b16){_0x3eee1f['push'](_0x3eee1f['shift']());}};_0xa21088(++_0x3b0b3b);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x2ff9dc,_0xa5c79b){_0x2ff9dc=_0x2ff9dc-0x0;var _0x3f18b7=_0xfcbe[_0x2ff9dc];return _0x3f18b7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xefcb('0x0'));var rimraf=require(_0xefcb('0x1'));var zipdir=require(_0xefcb('0x2'));var jsonpatch=require(_0xefcb('0x3'));var rp=require(_0xefcb('0x4'));var moment=require(_0xefcb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xefcb('0x6'));var util=require(_0xefcb('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefcb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xefcb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefcb('0xa'));var toCsv=require(_0xefcb('0xb'));var querystring=require(_0xefcb('0xc'));var Papa=require('papaparse');var Redis=require(_0xefcb('0xd'));var authService=require(_0xefcb('0xe'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xefcb('0xf'))(_0xefcb('0x10'));var utils=require(_0xefcb('0x11'));var config=require(_0xefcb('0x12'));var db=require(_0xefcb('0x13'))['db'];function respondWithStatusCode(_0x247dcd,_0x47d4e1){_0x47d4e1=_0x47d4e1||0xcc;return function(_0x92bb0c){if(_0x92bb0c){return _0x247dcd[_0xefcb('0x14')](_0x47d4e1);}return _0x247dcd[_0xefcb('0x15')](_0x47d4e1)[_0xefcb('0x16')]();};}function respondWithResult(_0x3bfbb3,_0x5c1ed6){_0x5c1ed6=_0x5c1ed6||0xc8;return function(_0x585355){if(_0x585355){return _0x3bfbb3[_0xefcb('0x15')](_0x5c1ed6)[_0xefcb('0x17')](_0x585355);}};}function respondWithFilteredResult(_0x586dce,_0x26f660){return function(_0x565c13){if(_0x565c13){var _0x3946ef=_0x565c13[_0xefcb('0x18')],_0x565fae=_0x26f660[_0xefcb('0x19')],_0x172816=_0x26f660[_0xefcb('0x19')]+_0x26f660[_0xefcb('0x1a')],_0x46a22a;if(_0x172816>=_0x3946ef){_0x172816=_0x3946ef;_0x46a22a=0xc8;}else{_0x46a22a=0xce;}_0x586dce['status'](_0x46a22a);return _0x586dce[_0xefcb('0x1b')](_0xefcb('0x1c'),_0x565fae+'-'+_0x172816+'/'+_0x3946ef)[_0xefcb('0x17')](_0x565c13);}return null;};}function patchUpdates(_0x4884be){return function(_0x1bd57c){try{jsonpatch[_0xefcb('0x1d')](_0x1bd57c,_0x4884be,!![]);}catch(_0x3a3ffe){return BPromise['reject'](_0x3a3ffe);}return _0x1bd57c[_0xefcb('0x1e')]();};}function saveUpdates(_0x3b7509,_0x5695b4){return function(_0x12a93f){if(_0x12a93f){return _0x12a93f[_0xefcb('0x1f')](_0x3b7509)[_0xefcb('0x20')](function(_0x2b0be0){return _0x2b0be0;});}return null;};}function removeEntity(_0x45f49b,_0x4e13c0){return function(_0x10c662){if(_0x10c662){return _0x10c662[_0xefcb('0x21')]()[_0xefcb('0x20')](function(){_0x45f49b[_0xefcb('0x15')](0xcc)[_0xefcb('0x16')]();});}};}function handleEntityNotFound(_0x345629,_0x129817){return function(_0x2a74f6){if(!_0x2a74f6){_0x345629['sendStatus'](0x194);}return _0x2a74f6;};}function handleError(_0x5844e2,_0x5991c6){_0x5991c6=_0x5991c6||0x1f4;return function(_0x104212){logger[_0xefcb('0x22')](_0x104212[_0xefcb('0x23')]);if(_0x104212[_0xefcb('0x24')]){delete _0x104212[_0xefcb('0x24')];}_0x5844e2[_0xefcb('0x15')](_0x5991c6)[_0xefcb('0x25')](_0x104212);};}exports['index']=function(_0x3029d1,_0x16f800){var _0xa42610={},_0x11286f={},_0x18f4ef={'count':0x0,'rows':[]};var _0x18f3be=db[_0xefcb('0x26')][_0xefcb('0x27')];_0x11286f[_0xefcb('0x28')]=_[_0xefcb('0x29')](_0x18f3be);_0x11286f[_0xefcb('0x2a')]=_[_0xefcb('0x29')](_0x3029d1[_0xefcb('0x2a')]);_0x11286f[_0xefcb('0x2b')]=_[_0xefcb('0x2c')](_0x11286f['model'],_0x11286f[_0xefcb('0x2a')]);_0xa42610[_0xefcb('0x2d')]=_[_0xefcb('0x2c')](_0x11286f[_0xefcb('0x28')],qs[_0xefcb('0x2e')](_0x3029d1[_0xefcb('0x2a')][_0xefcb('0x2e')]));_0xa42610['attributes']=_0xa42610['attributes'][_0xefcb('0x2f')]?_0xa42610[_0xefcb('0x2d')]:_0x11286f['model'];if(!_0x3029d1[_0xefcb('0x2a')][_0xefcb('0x30')](_0xefcb('0x31'))){_0xa42610['limit']=qs[_0xefcb('0x1a')](_0x3029d1[_0xefcb('0x2a')][_0xefcb('0x1a')]);_0xa42610['offset']=qs['offset'](_0x3029d1['query']['offset']);}_0xa42610[_0xefcb('0x32')]=qs[_0xefcb('0x33')](_0x3029d1[_0xefcb('0x2a')][_0xefcb('0x33')]);_0xa42610[_0xefcb('0x34')]=qs[_0xefcb('0x2b')](_[_0xefcb('0x35')](_0x3029d1[_0xefcb('0x2a')],_0x11286f[_0xefcb('0x2b')]));if(_0x3029d1[_0xefcb('0x2a')][_0xefcb('0x36')]){_0xa42610[_0xefcb('0x34')]=_[_0xefcb('0x37')](_0xa42610[_0xefcb('0x34')],{'$or':_[_0xefcb('0x38')](_0x18f3be,function(_0x102933){if(_0x102933['type'][_0xefcb('0x39')]!==_0xefcb('0x3a')){var _0x31418b={};_0x31418b[_0x102933[_0xefcb('0x3b')]]={'$like':'%'+_0x3029d1['query'][_0xefcb('0x36')]+'%'};return _0x31418b;}})});}_0xa42610=_['merge']({},_0xa42610,_0x3029d1[_0xefcb('0x3c')]);var _0x3b994b={'where':_0xa42610[_0xefcb('0x34')]};return db[_0xefcb('0x26')]['count'](_0x3b994b)[_0xefcb('0x20')](function(_0x1a7cf4){_0x18f4ef[_0xefcb('0x18')]=_0x1a7cf4;if(_0x3029d1['query'][_0xefcb('0x3d')]){_0xa42610[_0xefcb('0x3e')]=[{'all':!![]}];}return db[_0xefcb('0x26')]['findAll'](_0xa42610);})['then'](function(_0x183bbd){_0x18f4ef['rows']=_0x183bbd;return _0x18f4ef;})['then'](respondWithFilteredResult(_0x16f800,_0xa42610))[_0xefcb('0x3f')](handleError(_0x16f800,null));};exports[_0xefcb('0x40')]=function(_0x2b354a,_0x59eca6){var _0x4d4f06={'raw':!![],'where':{'id':_0x2b354a[_0xefcb('0x41')]['id']}},_0x4a1276={};_0x4a1276[_0xefcb('0x28')]=_['keys'](db[_0xefcb('0x26')]['rawAttributes']);_0x4a1276[_0xefcb('0x2a')]=_[_0xefcb('0x29')](_0x2b354a[_0xefcb('0x2a')]);_0x4a1276[_0xefcb('0x2b')]=_[_0xefcb('0x2c')](_0x4a1276['model'],_0x4a1276['query']);_0x4d4f06[_0xefcb('0x2d')]=_[_0xefcb('0x2c')](_0x4a1276['model'],qs['fields'](_0x2b354a['query'][_0xefcb('0x2e')]));_0x4d4f06[_0xefcb('0x2d')]=_0x4d4f06['attributes'][_0xefcb('0x2f')]?_0x4d4f06['attributes']:_0x4a1276[_0xefcb('0x28')];if(_0x2b354a[_0xefcb('0x2a')][_0xefcb('0x3d')]){_0x4d4f06[_0xefcb('0x3e')]=[{'all':!![]}];}_0x4d4f06=_[_0xefcb('0x37')]({},_0x4d4f06,_0x2b354a['options']);return db[_0xefcb('0x26')]['find'](_0x4d4f06)[_0xefcb('0x20')](handleEntityNotFound(_0x59eca6,null))['then'](respondWithResult(_0x59eca6,null))[_0xefcb('0x3f')](handleError(_0x59eca6,null));};exports['create']=function(_0xd280bc,_0x5aca1f){return db[_0xefcb('0x26')][_0xefcb('0x42')](_0xd280bc[_0xefcb('0x43')],{})[_0xefcb('0x20')](respondWithResult(_0x5aca1f,0xc9))[_0xefcb('0x3f')](handleError(_0x5aca1f,null));};exports[_0xefcb('0x1f')]=function(_0x4b0735,_0x2ead1){if(_0x4b0735['body']['id']){delete _0x4b0735[_0xefcb('0x43')]['id'];}return db[_0xefcb('0x26')][_0xefcb('0x44')]({'where':{'id':_0x4b0735[_0xefcb('0x41')]['id']}})[_0xefcb('0x20')](handleEntityNotFound(_0x2ead1,null))[_0xefcb('0x20')](saveUpdates(_0x4b0735['body'],null))[_0xefcb('0x20')](respondWithResult(_0x2ead1,null))[_0xefcb('0x3f')](handleError(_0x2ead1,null));};exports[_0xefcb('0x21')]=function(_0x53c7d6,_0x4bdcc0){return db[_0xefcb('0x26')][_0xefcb('0x44')]({'where':{'id':_0x53c7d6['params']['id']}})[_0xefcb('0x20')](handleEntityNotFound(_0x4bdcc0,null))[_0xefcb('0x20')](removeEntity(_0x4bdcc0,null))[_0xefcb('0x3f')](handleError(_0x4bdcc0,null));};exports[_0xefcb('0x45')]=function(_0x1530cc,_0x355ebe){return db['FaxQueueReport'][_0xefcb('0x45')]()[_0xefcb('0x20')](respondWithResult(_0x355ebe,null))[_0xefcb('0x3f')](handleError(_0x355ebe,null));}; \ No newline at end of file +var _0x471a=['describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','reject','save','update','then','stack','name','send','index','FaxQueueReport','rawAttributes','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','include','find','create','body','params'];(function(_0x169e1d,_0xe9bc52){var _0xa22977=function(_0x9b03da){while(--_0x9b03da){_0x169e1d['push'](_0x169e1d['shift']());}};_0xa22977(++_0xe9bc52);}(_0x471a,0x18d));var _0xa471=function(_0x337c63,_0x359439){_0x337c63=_0x337c63-0x0;var _0x1f1af2=_0x471a[_0x337c63];return _0x1f1af2;};'use strict';var pdf=require(_0xa471('0x0'));var emlformat=require(_0xa471('0x1'));var rimraf=require(_0xa471('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa471('0x3'));var rp=require(_0xa471('0x4'));var moment=require(_0xa471('0x5'));var BPromise=require(_0xa471('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa471('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa471('0x8'));var crypto=require(_0xa471('0x9'));var jsforce=require(_0xa471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa471('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa471('0xc'));var authService=require(_0xa471('0xd'));var qs=require(_0xa471('0xe'));var hardwareService=require(_0xa471('0xf'));var logger=require('../../config/logger')(_0xa471('0x10'));var utils=require(_0xa471('0x11'));var config=require(_0xa471('0x12'));var db=require(_0xa471('0x13'))['db'];function respondWithStatusCode(_0x3640a0,_0x211a0b){_0x211a0b=_0x211a0b||0xcc;return function(_0x5703c9){if(_0x5703c9){return _0x3640a0[_0xa471('0x14')](_0x211a0b);}return _0x3640a0['status'](_0x211a0b)[_0xa471('0x15')]();};}function respondWithResult(_0x514134,_0x3f5db0){_0x3f5db0=_0x3f5db0||0xc8;return function(_0x115541){if(_0x115541){return _0x514134[_0xa471('0x16')](_0x3f5db0)[_0xa471('0x17')](_0x115541);}};}function respondWithFilteredResult(_0x45ef67,_0x25f5f5){return function(_0x531451){if(_0x531451){var _0x31bcb7=_0x531451[_0xa471('0x18')],_0x1ed20c=_0x25f5f5['offset'],_0x16e5bf=_0x25f5f5[_0xa471('0x19')]+_0x25f5f5[_0xa471('0x1a')],_0x4297a7;if(_0x16e5bf>=_0x31bcb7){_0x16e5bf=_0x31bcb7;_0x4297a7=0xc8;}else{_0x4297a7=0xce;}_0x45ef67[_0xa471('0x16')](_0x4297a7);return _0x45ef67['set']('Content-Range',_0x1ed20c+'-'+_0x16e5bf+'/'+_0x31bcb7)[_0xa471('0x17')](_0x531451);}return null;};}function patchUpdates(_0x4bde36){return function(_0x3ef862){try{jsonpatch['apply'](_0x3ef862,_0x4bde36,!![]);}catch(_0x5e56dc){return BPromise[_0xa471('0x1b')](_0x5e56dc);}return _0x3ef862[_0xa471('0x1c')]();};}function saveUpdates(_0x36f980,_0x1952a0){return function(_0x45ff30){if(_0x45ff30){return _0x45ff30[_0xa471('0x1d')](_0x36f980)[_0xa471('0x1e')](function(_0x554610){return _0x554610;});}return null;};}function removeEntity(_0x3376c6,_0x275144){return function(_0x398f23){if(_0x398f23){return _0x398f23['destroy']()[_0xa471('0x1e')](function(){_0x3376c6['status'](0xcc)[_0xa471('0x15')]();});}};}function handleEntityNotFound(_0x2b7755,_0x56a34e){return function(_0x21b9e5){if(!_0x21b9e5){_0x2b7755[_0xa471('0x14')](0x194);}return _0x21b9e5;};}function handleError(_0x4debbe,_0x109135){_0x109135=_0x109135||0x1f4;return function(_0x54f8d1){logger['error'](_0x54f8d1[_0xa471('0x1f')]);if(_0x54f8d1[_0xa471('0x20')]){delete _0x54f8d1['name'];}_0x4debbe['status'](_0x109135)[_0xa471('0x21')](_0x54f8d1);};}exports[_0xa471('0x22')]=function(_0x5009cf,_0x3fd3bc){var _0x1c6d6e={},_0x114799={},_0x7404f4={'count':0x0,'rows':[]};var _0x5c95b0=db[_0xa471('0x23')][_0xa471('0x24')];_0x114799['model']=_[_0xa471('0x25')](_0x5c95b0);_0x114799[_0xa471('0x26')]=_[_0xa471('0x25')](_0x5009cf[_0xa471('0x26')]);_0x114799['filters']=_[_0xa471('0x27')](_0x114799[_0xa471('0x28')],_0x114799['query']);_0x1c6d6e['attributes']=_[_0xa471('0x27')](_0x114799[_0xa471('0x28')],qs[_0xa471('0x29')](_0x5009cf[_0xa471('0x26')][_0xa471('0x29')]));_0x1c6d6e['attributes']=_0x1c6d6e[_0xa471('0x2a')][_0xa471('0x2b')]?_0x1c6d6e[_0xa471('0x2a')]:_0x114799[_0xa471('0x28')];if(!_0x5009cf[_0xa471('0x26')][_0xa471('0x2c')](_0xa471('0x2d'))){_0x1c6d6e[_0xa471('0x1a')]=qs[_0xa471('0x1a')](_0x5009cf['query'][_0xa471('0x1a')]);_0x1c6d6e[_0xa471('0x19')]=qs[_0xa471('0x19')](_0x5009cf[_0xa471('0x26')][_0xa471('0x19')]);}_0x1c6d6e['order']=qs[_0xa471('0x2e')](_0x5009cf[_0xa471('0x26')][_0xa471('0x2e')]);_0x1c6d6e[_0xa471('0x2f')]=qs[_0xa471('0x30')](_[_0xa471('0x31')](_0x5009cf['query'],_0x114799[_0xa471('0x30')]));if(_0x5009cf[_0xa471('0x26')][_0xa471('0x32')]){_0x1c6d6e[_0xa471('0x2f')]=_[_0xa471('0x33')](_0x1c6d6e[_0xa471('0x2f')],{'$or':_['map'](_0x5c95b0,function(_0x16e515){if(_0x16e515['type']['key']!==_0xa471('0x34')){var _0x7d7b16={};_0x7d7b16[_0x16e515[_0xa471('0x35')]]={'$like':'%'+_0x5009cf[_0xa471('0x26')][_0xa471('0x32')]+'%'};return _0x7d7b16;}})});}_0x1c6d6e=_['merge']({},_0x1c6d6e,_0x5009cf[_0xa471('0x36')]);var _0x34ce8d={'where':_0x1c6d6e[_0xa471('0x2f')]};return db[_0xa471('0x23')][_0xa471('0x18')](_0x34ce8d)[_0xa471('0x1e')](function(_0x32466d){_0x7404f4['count']=_0x32466d;if(_0x5009cf[_0xa471('0x26')][_0xa471('0x37')]){_0x1c6d6e['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xa471('0x38')](_0x1c6d6e);})[_0xa471('0x1e')](function(_0x2d98f0){_0x7404f4[_0xa471('0x39')]=_0x2d98f0;return _0x7404f4;})[_0xa471('0x1e')](respondWithFilteredResult(_0x3fd3bc,_0x1c6d6e))[_0xa471('0x3a')](handleError(_0x3fd3bc,null));};exports[_0xa471('0x3b')]=function(_0xcc3f85,_0x1fb06b){var _0x5230a7={'raw':!![],'where':{'id':_0xcc3f85['params']['id']}},_0x1eb7c8={};_0x1eb7c8[_0xa471('0x28')]=_[_0xa471('0x25')](db[_0xa471('0x23')][_0xa471('0x24')]);_0x1eb7c8[_0xa471('0x26')]=_[_0xa471('0x25')](_0xcc3f85[_0xa471('0x26')]);_0x1eb7c8['filters']=_[_0xa471('0x27')](_0x1eb7c8[_0xa471('0x28')],_0x1eb7c8['query']);_0x5230a7[_0xa471('0x2a')]=_[_0xa471('0x27')](_0x1eb7c8['model'],qs['fields'](_0xcc3f85[_0xa471('0x26')][_0xa471('0x29')]));_0x5230a7[_0xa471('0x2a')]=_0x5230a7[_0xa471('0x2a')][_0xa471('0x2b')]?_0x5230a7[_0xa471('0x2a')]:_0x1eb7c8[_0xa471('0x28')];if(_0xcc3f85[_0xa471('0x26')][_0xa471('0x37')]){_0x5230a7[_0xa471('0x3c')]=[{'all':!![]}];}_0x5230a7=_[_0xa471('0x33')]({},_0x5230a7,_0xcc3f85[_0xa471('0x36')]);return db['FaxQueueReport'][_0xa471('0x3d')](_0x5230a7)[_0xa471('0x1e')](handleEntityNotFound(_0x1fb06b,null))[_0xa471('0x1e')](respondWithResult(_0x1fb06b,null))[_0xa471('0x3a')](handleError(_0x1fb06b,null));};exports[_0xa471('0x3e')]=function(_0x4cfdd5,_0x321724){return db['FaxQueueReport'][_0xa471('0x3e')](_0x4cfdd5['body'],{})[_0xa471('0x1e')](respondWithResult(_0x321724,0xc9))[_0xa471('0x3a')](handleError(_0x321724,null));};exports[_0xa471('0x1d')]=function(_0xbfd724,_0x2024d0){if(_0xbfd724['body']['id']){delete _0xbfd724[_0xa471('0x3f')]['id'];}return db['FaxQueueReport'][_0xa471('0x3d')]({'where':{'id':_0xbfd724[_0xa471('0x40')]['id']}})[_0xa471('0x1e')](handleEntityNotFound(_0x2024d0,null))[_0xa471('0x1e')](saveUpdates(_0xbfd724[_0xa471('0x3f')],null))['then'](respondWithResult(_0x2024d0,null))[_0xa471('0x3a')](handleError(_0x2024d0,null));};exports['destroy']=function(_0x5c0efe,_0x2cf4a9){return db['FaxQueueReport']['find']({'where':{'id':_0x5c0efe[_0xa471('0x40')]['id']}})['then'](handleEntityNotFound(_0x2cf4a9,null))[_0xa471('0x1e')](removeEntity(_0x2cf4a9,null))[_0xa471('0x3a')](handleError(_0x2cf4a9,null));};exports['describe']=function(_0x44a15c,_0x41c029){return db[_0xa471('0x23')][_0xa471('0x41')]()[_0xa471('0x1e')](respondWithResult(_0x41c029,null))[_0xa471('0x3a')](handleError(_0x41c029,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e17e644..b676bd7 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 _0xc853=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util'];(function(_0x11e872,_0x3b82fa){var _0x73f1a=function(_0x4dd4ef){while(--_0x4dd4ef){_0x11e872['push'](_0x11e872['shift']());}};_0x73f1a(++_0x3b82fa);}(_0xc853,0x1a2));var _0x3c85=function(_0x4a4da3,_0x103abb){_0x4a4da3=_0x4a4da3-0x0;var _0x5d391e=_0xc853[_0x4a4da3];return _0x5d391e;};'use strict';var _=require(_0x3c85('0x0'));var util=require(_0x3c85('0x1'));var logger=require(_0x3c85('0x2'))('api');var moment=require(_0x3c85('0x3'));var BPromise=require(_0x3c85('0x4'));var rp=require(_0x3c85('0x5'));var fs=require('fs');var path=require(_0x3c85('0x6'));var rimraf=require(_0x3c85('0x7'));var config=require(_0x3c85('0x8'));var attributes=require(_0x3c85('0x9'));module[_0x3c85('0xa')]=function(_0x20bc64,_0x36a3be){return _0x20bc64[_0x3c85('0xb')](_0x3c85('0xc'),attributes,{'tableName':_0x3c85('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3c85('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79f2=['request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x220ef1,_0x504719){var _0x3bb019=function(_0x53c4cc){while(--_0x53c4cc){_0x220ef1['push'](_0x220ef1['shift']());}};_0x3bb019(++_0x504719);}(_0x79f2,0x158));var _0x279f=function(_0x3f9252,_0x578065){_0x3f9252=_0x3f9252-0x0;var _0x293415=_0x79f2[_0x3f9252];return _0x293415;};'use strict';var _=require('lodash');var util=require(_0x279f('0x0'));var logger=require(_0x279f('0x1'))(_0x279f('0x2'));var moment=require(_0x279f('0x3'));var BPromise=require('bluebird');var rp=require(_0x279f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x279f('0x5'));var config=require(_0x279f('0x6'));var attributes=require(_0x279f('0x7'));module[_0x279f('0x8')]=function(_0xc0fc77,_0x12344a){return _0xc0fc77['define'](_0x279f('0x9'),attributes,{'tableName':_0x279f('0xa'),'paranoid':![],'indexes':[{'name':_0x279f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 4cb6089..e6d0315 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 _0x6257=['catch','UpdateFaxQueueReport','options','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','code','message','error','FaxQueueReport,\x20%s,\x20%s','result','CreateFaxQueueReport','FaxQueueReport','body','raw','stringify'];(function(_0x13d878,_0x3ac33){var _0x4f9280=function(_0x3e59e4){while(--_0x3e59e4){_0x13d878['push'](_0x13d878['shift']());}};_0x4f9280(++_0x3ac33);}(_0x6257,0x1d4));var _0x7625=function(_0x294925,_0x173add){_0x294925=_0x294925-0x0;var _0x2e1fc1=_0x6257[_0x294925];return _0x2e1fc1;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});}exports[_0x7625('0x14')]=function(_0x6ca44e){var _0x2c8013=this;return new Promise(function(_0x34e594,_0x57ab0c){return db[_0x7625('0x15')]['create'](_0x6ca44e[_0x7625('0x16')],{'raw':_0x6ca44e['options']?_0x6ca44e['options'][_0x7625('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4e2377){logger[_0x7625('0xc')](_0x7625('0x14'),_0x6ca44e);logger['debug'](_0x7625('0x14'),_0x6ca44e,JSON[_0x7625('0x18')](_0x4e2377));_0x34e594(_0x4e2377);})[_0x7625('0x19')](function(_0x5b5269){logger[_0x7625('0x11')](_0x7625('0x14'),_0x5b5269[_0x7625('0x10')],_0x6ca44e);_0x57ab0c(_0x2c8013[_0x7625('0x11')](0x1f4,_0x5b5269[_0x7625('0x10')]));});});};exports[_0x7625('0x1a')]=function(_0x1514f7){var _0x1832e3=this;return new Promise(function(_0x26c976,_0x57c8ab){return db['FaxQueueReport']['update'](_0x1514f7['body'],{'raw':_0x1514f7['options']?_0x1514f7[_0x7625('0x1b')][_0x7625('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1514f7['options']?_0x1514f7[_0x7625('0x1b')]['where']||null:null,'attributes':_0x1514f7[_0x7625('0x1b')]?_0x1514f7[_0x7625('0x1b')]['attributes']||null:null,'limit':_0x1514f7[_0x7625('0x1b')]?_0x1514f7['options'][_0x7625('0x1c')]||null:null})['then'](function(_0x334d46){logger[_0x7625('0xc')](_0x7625('0x1a'),_0x1514f7);logger[_0x7625('0xe')](_0x7625('0x1a'),_0x1514f7,JSON[_0x7625('0x18')](_0x334d46));_0x26c976(_0x334d46);})[_0x7625('0x19')](function(_0x3736fb){logger['error']('UpdateFaxQueueReport',_0x3736fb[_0x7625('0x10')],_0x1514f7);_0x57c8ab(_0x1832e3[_0x7625('0x11')](0x1f4,_0x3736fb['message']));});});}; \ No newline at end of file +var _0x34bd=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','body','options','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x855db5,_0x536b00){var _0x50c1da=function(_0x52a3ba){while(--_0x52a3ba){_0x855db5['push'](_0x855db5['shift']());}};_0x50c1da(++_0x536b00);}(_0x34bd,0x1d2));var _0xd34b=function(_0x5b25af,_0x121dd7){_0x5b25af=_0x5b25af-0x0;var _0x181a07=_0x34bd[_0x5b25af];return _0x181a07;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd34b('0x1'));var rs=require(_0xd34b('0x2'));var fs=require('fs');var Redis=require(_0xd34b('0x3'));var db=require(_0xd34b('0x4'))['db'];var utils=require(_0xd34b('0x5'));var logger=require(_0xd34b('0x6'))(_0xd34b('0x7'));var config=require('../../config/environment');var jayson=require(_0xd34b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56e3eb,_0x30d93b,_0x3654a5){return new BPromise(function(_0xf51a08,_0x25bce7){return client[_0xd34b('0x9')](_0x56e3eb,_0x3654a5)[_0xd34b('0xa')](function(_0x738328){logger[_0xd34b('0xb')](_0xd34b('0xc'),_0x30d93b,_0xd34b('0xd'));logger[_0xd34b('0xe')](_0xd34b('0xf'),_0x30d93b,'request\x20sent',JSON[_0xd34b('0x10')](_0x738328));if(_0x738328['error']){if(_0x738328[_0xd34b('0x11')][_0xd34b('0x12')]===0x1f4){logger[_0xd34b('0x11')](_0xd34b('0xc'),_0x30d93b,_0x738328[_0xd34b('0x11')][_0xd34b('0x13')]);return _0x25bce7(_0x738328['error'][_0xd34b('0x13')]);}logger[_0xd34b('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x30d93b,_0x738328[_0xd34b('0x11')][_0xd34b('0x13')]);return _0xf51a08(_0x738328[_0xd34b('0x11')]['message']);}else{logger[_0xd34b('0xb')](_0xd34b('0xc'),_0x30d93b,'request\x20sent');_0xf51a08(_0x738328[_0xd34b('0x14')]['message']);}})[_0xd34b('0x15')](function(_0x438b61){logger[_0xd34b('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x30d93b,_0x438b61);_0x25bce7(_0x438b61);});});}exports[_0xd34b('0x16')]=function(_0x193965){var _0x1bbbb1=this;return new Promise(function(_0x105f67,_0x206f16){return db['FaxQueueReport']['create'](_0x193965[_0xd34b('0x17')],{'raw':_0x193965[_0xd34b('0x18')]?_0x193965[_0xd34b('0x18')][_0xd34b('0x19')]===undefined?!![]:![]:!![]})[_0xd34b('0xa')](function(_0x3152a9){logger['info'](_0xd34b('0x16'),_0x193965);logger[_0xd34b('0xe')](_0xd34b('0x16'),_0x193965,JSON[_0xd34b('0x10')](_0x3152a9));_0x105f67(_0x3152a9);})['catch'](function(_0x45c569){logger[_0xd34b('0x11')](_0xd34b('0x16'),_0x45c569[_0xd34b('0x13')],_0x193965);_0x206f16(_0x1bbbb1[_0xd34b('0x11')](0x1f4,_0x45c569[_0xd34b('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x50da22){var _0x49c485=this;return new Promise(function(_0x2187c0,_0x2ae0e1){return db['FaxQueueReport']['update'](_0x50da22['body'],{'raw':_0x50da22[_0xd34b('0x18')]?_0x50da22[_0xd34b('0x18')][_0xd34b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50da22['options']?_0x50da22[_0xd34b('0x18')][_0xd34b('0x1a')]||null:null,'attributes':_0x50da22['options']?_0x50da22[_0xd34b('0x18')][_0xd34b('0x1b')]||null:null,'limit':_0x50da22[_0xd34b('0x18')]?_0x50da22['options'][_0xd34b('0x1c')]||null:null})['then'](function(_0x182266){logger[_0xd34b('0xb')](_0xd34b('0x1d'),_0x50da22);logger['debug'](_0xd34b('0x1d'),_0x50da22,JSON['stringify'](_0x182266));_0x2187c0(_0x182266);})[_0xd34b('0x15')](function(_0x47c0b3){logger[_0xd34b('0x11')]('UpdateFaxQueueReport',_0x47c0b3[_0xd34b('0x13')],_0x50da22);_0x2ae0e1(_0x49c485[_0xd34b('0x11')](0x1f4,_0x47c0b3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 52f2bae..a070aae 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 _0x12cd=['../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x12cd,0x163));var _0xd12c=function(_0x2e1762,_0x245f87){_0x2e1762=_0x2e1762-0x0;var _0x261c0e=_0x12cd[_0x2e1762];return _0x261c0e;};'use strict';var multer=require(_0xd12c('0x0'));var util=require(_0xd12c('0x1'));var path=require(_0xd12c('0x2'));var timeout=require(_0xd12c('0x3'));var express=require(_0xd12c('0x4'));var router=express['Router']();var auth=require(_0xd12c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd12c('0x6'));var controller=require(_0xd12c('0x7'));router[_0xd12c('0x8')]('/',auth[_0xd12c('0x9')](),controller[_0xd12c('0xa')]);router[_0xd12c('0x8')](_0xd12c('0xb'),auth[_0xd12c('0x9')](),controller[_0xd12c('0xc')]);router[_0xd12c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd12c('0xd')]);router['post']('/',auth[_0xd12c('0x9')](),controller[_0xd12c('0xe')]);router[_0xd12c('0xf')]('/:id',auth[_0xd12c('0x9')](),controller[_0xd12c('0x10')]);router[_0xd12c('0x11')](_0xd12c('0x12'),auth[_0xd12c('0x9')](),controller[_0xd12c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf543=['../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','delete','destroy','exports','util','express'];(function(_0x95d5,_0x286dfd){var _0x2bc20a=function(_0xf64ef3){while(--_0xf64ef3){_0x95d5['push'](_0x95d5['shift']());}};_0x2bc20a(++_0x286dfd);}(_0xf543,0xee));var _0x3f54=function(_0x3aa3e4,_0x5f0a89){_0x3aa3e4=_0x3aa3e4-0x0;var _0x3dba0c=_0xf543[_0x3aa3e4];return _0x3dba0c;};'use strict';var multer=require('multer');var util=require(_0x3f54('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f54('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f54('0x2'));var controller=require(_0x3f54('0x3'));router[_0x3f54('0x4')]('/',auth[_0x3f54('0x5')](),controller[_0x3f54('0x6')]);router[_0x3f54('0x4')]('/describe',auth[_0x3f54('0x5')](),controller[_0x3f54('0x7')]);router[_0x3f54('0x4')]('/:id',auth[_0x3f54('0x5')](),controller[_0x3f54('0x8')]);router[_0x3f54('0x9')]('/',auth[_0x3f54('0x5')](),controller[_0x3f54('0xa')]);router[_0x3f54('0xb')](_0x3f54('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3f54('0xd')](_0x3f54('0xc'),auth[_0x3f54('0x5')](),controller[_0x3f54('0xe')]);module[_0x3f54('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 97c8f02..c112f95 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 _0x901f=['queue','DATE','NOW','moment','exports','STRING','ENUM'];(function(_0x5876ff,_0x157614){var _0x388273=function(_0x2dff46){while(--_0x2dff46){_0x5876ff['push'](_0x5876ff['shift']());}};_0x388273(++_0x157614);}(_0x901f,0x81));var _0xf901=function(_0x633dad,_0x2cf36d){_0x633dad=_0x633dad-0x0;var _0x1e469e=_0x901f[_0x633dad];return _0x1e469e;};'use strict';var moment=require(_0xf901('0x0'));var Sequelize=require('sequelize');module[_0xf901('0x1')]={'uniqueid':{'type':Sequelize[_0xf901('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf901('0x3')]('account','agent',_0xf901('0x4')),'allowNull':![],'defaultValue':_0xf901('0x4')},'transferredAt':{'type':Sequelize[_0xf901('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xf901('0x6')]}}; \ No newline at end of file +var _0xe2e1=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x36dd16,_0x61e190){var _0x31b57b=function(_0x1a8a10){while(--_0x1a8a10){_0x36dd16['push'](_0x36dd16['shift']());}};_0x31b57b(++_0x61e190);}(_0xe2e1,0x9b));var _0x1e2e=function(_0x534c5c,_0x2b4684){_0x534c5c=_0x534c5c-0x0;var _0x267caf=_0xe2e1[_0x534c5c];return _0x267caf;};'use strict';var moment=require(_0x1e2e('0x0'));var Sequelize=require(_0x1e2e('0x1'));module[_0x1e2e('0x2')]={'uniqueid':{'type':Sequelize[_0x1e2e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1e2e('0x4')](_0x1e2e('0x5'),_0x1e2e('0x6'),'queue'),'allowNull':![],'defaultValue':_0x1e2e('0x7')},'transferredAt':{'type':Sequelize[_0x1e2e('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x1e2e('0x9')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8dfb4a0..73169be 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 _0xf2cb=['Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','FaxTransferReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','limit','order','sort','where','pick','merge','type','key','field','includeAll','include','findAll','rows','catch','params','create','update','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set'];(function(_0x76fe56,_0x5b5954){var _0x6174e7=function(_0x4caaec){while(--_0x4caaec){_0x76fe56['push'](_0x76fe56['shift']());}};_0x6174e7(++_0x5b5954);}(_0xf2cb,0x130));var _0xbf2c=function(_0x4e831f,_0x448194){_0x4e831f=_0x4e831f-0x0;var _0x4e9417=_0xf2cb[_0x4e831f];return _0x4e9417;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf2c('0x2'));var moment=require('moment');var BPromise=require(_0xbf2c('0x3'));var Mustache=require(_0xbf2c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbf2c('0x5'));var csv=require(_0xbf2c('0x6'));var ejs=require(_0xbf2c('0x7'));var fs=require('fs');var _=require(_0xbf2c('0x8'));var squel=require('squel');var crypto=require(_0xbf2c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbf2c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf2c('0xb'));var Redis=require(_0xbf2c('0xc'));var authService=require(_0xbf2c('0xd'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xbf2c('0xe'));var logger=require(_0xbf2c('0xf'))(_0xbf2c('0x10'));var utils=require(_0xbf2c('0x11'));var config=require(_0xbf2c('0x12'));var db=require(_0xbf2c('0x13'))['db'];function respondWithStatusCode(_0x20b260,_0x3a5268){_0x3a5268=_0x3a5268||0xcc;return function(_0x52983d){if(_0x52983d){return _0x20b260[_0xbf2c('0x14')](_0x3a5268);}return _0x20b260[_0xbf2c('0x15')](_0x3a5268)[_0xbf2c('0x16')]();};}function respondWithResult(_0x2879de,_0x5220e2){_0x5220e2=_0x5220e2||0xc8;return function(_0x7665b1){if(_0x7665b1){return _0x2879de['status'](_0x5220e2)['json'](_0x7665b1);}};}function respondWithFilteredResult(_0x160fff,_0x4f58c7){return function(_0x47df49){if(_0x47df49){var _0x3ed1c3=_0x47df49[_0xbf2c('0x17')],_0x45412=_0x4f58c7['offset'],_0x2dc80e=_0x4f58c7[_0xbf2c('0x18')]+_0x4f58c7['limit'],_0x334900;if(_0x2dc80e>=_0x3ed1c3){_0x2dc80e=_0x3ed1c3;_0x334900=0xc8;}else{_0x334900=0xce;}_0x160fff[_0xbf2c('0x15')](_0x334900);return _0x160fff[_0xbf2c('0x19')](_0xbf2c('0x1a'),_0x45412+'-'+_0x2dc80e+'/'+_0x3ed1c3)[_0xbf2c('0x1b')](_0x47df49);}return null;};}function patchUpdates(_0x266035){return function(_0x57e01a){try{jsonpatch[_0xbf2c('0x1c')](_0x57e01a,_0x266035,!![]);}catch(_0x1fbfe8){return BPromise[_0xbf2c('0x1d')](_0x1fbfe8);}return _0x57e01a[_0xbf2c('0x1e')]();};}function saveUpdates(_0x11930f,_0x102cef){return function(_0x426724){if(_0x426724){return _0x426724['update'](_0x11930f)[_0xbf2c('0x1f')](function(_0x2a3adf){return _0x2a3adf;});}return null;};}function removeEntity(_0x96a759,_0xe6dad9){return function(_0x57873c){if(_0x57873c){return _0x57873c[_0xbf2c('0x20')]()[_0xbf2c('0x1f')](function(){_0x96a759['status'](0xcc)[_0xbf2c('0x16')]();});}};}function handleEntityNotFound(_0x356f26,_0x3f1cdb){return function(_0x52ecb4){if(!_0x52ecb4){_0x356f26['sendStatus'](0x194);}return _0x52ecb4;};}function handleError(_0x31b070,_0x3c546d){_0x3c546d=_0x3c546d||0x1f4;return function(_0xae9c7){logger[_0xbf2c('0x21')](_0xae9c7[_0xbf2c('0x22')]);if(_0xae9c7[_0xbf2c('0x23')]){delete _0xae9c7[_0xbf2c('0x23')];}_0x31b070['status'](_0x3c546d)['send'](_0xae9c7);};}exports[_0xbf2c('0x24')]=function(_0xcbd882,_0x24c478){var _0x4314d6={},_0x3ed68d={},_0x4a0257={'count':0x0,'rows':[]};var _0x30ca=db[_0xbf2c('0x25')][_0xbf2c('0x26')];_0x3ed68d['model']=_[_0xbf2c('0x27')](_0x30ca);_0x3ed68d['query']=_[_0xbf2c('0x27')](_0xcbd882[_0xbf2c('0x28')]);_0x3ed68d[_0xbf2c('0x29')]=_[_0xbf2c('0x2a')](_0x3ed68d[_0xbf2c('0x2b')],_0x3ed68d['query']);_0x4314d6[_0xbf2c('0x2c')]=_[_0xbf2c('0x2a')](_0x3ed68d[_0xbf2c('0x2b')],qs[_0xbf2c('0x2d')](_0xcbd882[_0xbf2c('0x28')][_0xbf2c('0x2d')]));_0x4314d6[_0xbf2c('0x2c')]=_0x4314d6[_0xbf2c('0x2c')]['length']?_0x4314d6[_0xbf2c('0x2c')]:_0x3ed68d[_0xbf2c('0x2b')];if(!_0xcbd882[_0xbf2c('0x28')]['hasOwnProperty']('nolimit')){_0x4314d6[_0xbf2c('0x2e')]=qs[_0xbf2c('0x2e')](_0xcbd882[_0xbf2c('0x28')][_0xbf2c('0x2e')]);_0x4314d6[_0xbf2c('0x18')]=qs[_0xbf2c('0x18')](_0xcbd882[_0xbf2c('0x28')][_0xbf2c('0x18')]);}_0x4314d6[_0xbf2c('0x2f')]=qs['sort'](_0xcbd882[_0xbf2c('0x28')][_0xbf2c('0x30')]);_0x4314d6[_0xbf2c('0x31')]=qs[_0xbf2c('0x29')](_[_0xbf2c('0x32')](_0xcbd882[_0xbf2c('0x28')],_0x3ed68d[_0xbf2c('0x29')]));if(_0xcbd882[_0xbf2c('0x28')]['filter']){_0x4314d6[_0xbf2c('0x31')]=_[_0xbf2c('0x33')](_0x4314d6[_0xbf2c('0x31')],{'$or':_['map'](_0x30ca,function(_0x4663db){if(_0x4663db[_0xbf2c('0x34')][_0xbf2c('0x35')]!=='VIRTUAL'){var _0x2ec0c6={};_0x2ec0c6[_0x4663db[_0xbf2c('0x36')]]={'$like':'%'+_0xcbd882['query']['filter']+'%'};return _0x2ec0c6;}})});}_0x4314d6=_['merge']({},_0x4314d6,_0xcbd882['options']);var _0x54e117={'where':_0x4314d6[_0xbf2c('0x31')]};return db[_0xbf2c('0x25')][_0xbf2c('0x17')](_0x54e117)[_0xbf2c('0x1f')](function(_0xe36622){_0x4a0257[_0xbf2c('0x17')]=_0xe36622;if(_0xcbd882[_0xbf2c('0x28')][_0xbf2c('0x37')]){_0x4314d6[_0xbf2c('0x38')]=[{'all':!![]}];}return db[_0xbf2c('0x25')][_0xbf2c('0x39')](_0x4314d6);})[_0xbf2c('0x1f')](function(_0x3fbf90){_0x4a0257[_0xbf2c('0x3a')]=_0x3fbf90;return _0x4a0257;})[_0xbf2c('0x1f')](respondWithFilteredResult(_0x24c478,_0x4314d6))[_0xbf2c('0x3b')](handleError(_0x24c478,null));};exports['show']=function(_0x294684,_0x453dcb){var _0x6bbc64={'raw':!![],'where':{'id':_0x294684[_0xbf2c('0x3c')]['id']}},_0x3379d2={};_0x3379d2[_0xbf2c('0x2b')]=_[_0xbf2c('0x27')](db[_0xbf2c('0x25')]['rawAttributes']);_0x3379d2[_0xbf2c('0x28')]=_[_0xbf2c('0x27')](_0x294684[_0xbf2c('0x28')]);_0x3379d2[_0xbf2c('0x29')]=_['intersection'](_0x3379d2[_0xbf2c('0x2b')],_0x3379d2['query']);_0x6bbc64[_0xbf2c('0x2c')]=_[_0xbf2c('0x2a')](_0x3379d2[_0xbf2c('0x2b')],qs[_0xbf2c('0x2d')](_0x294684[_0xbf2c('0x28')][_0xbf2c('0x2d')]));_0x6bbc64['attributes']=_0x6bbc64[_0xbf2c('0x2c')]['length']?_0x6bbc64['attributes']:_0x3379d2[_0xbf2c('0x2b')];if(_0x294684['query']['includeAll']){_0x6bbc64[_0xbf2c('0x38')]=[{'all':!![]}];}_0x6bbc64=_[_0xbf2c('0x33')]({},_0x6bbc64,_0x294684['options']);return db[_0xbf2c('0x25')]['find'](_0x6bbc64)[_0xbf2c('0x1f')](handleEntityNotFound(_0x453dcb,null))['then'](respondWithResult(_0x453dcb,null))[_0xbf2c('0x3b')](handleError(_0x453dcb,null));};exports[_0xbf2c('0x3d')]=function(_0x1e1dd3,_0x343255){return db[_0xbf2c('0x25')][_0xbf2c('0x3d')](_0x1e1dd3['body'],{})[_0xbf2c('0x1f')](respondWithResult(_0x343255,0xc9))[_0xbf2c('0x3b')](handleError(_0x343255,null));};exports[_0xbf2c('0x3e')]=function(_0x1b50a6,_0x2957ed){if(_0x1b50a6['body']['id']){delete _0x1b50a6['body']['id'];}return db[_0xbf2c('0x25')]['find']({'where':{'id':_0x1b50a6[_0xbf2c('0x3c')]['id']}})[_0xbf2c('0x1f')](handleEntityNotFound(_0x2957ed,null))[_0xbf2c('0x1f')](saveUpdates(_0x1b50a6[_0xbf2c('0x3f')],null))[_0xbf2c('0x1f')](respondWithResult(_0x2957ed,null))[_0xbf2c('0x3b')](handleError(_0x2957ed,null));};exports[_0xbf2c('0x20')]=function(_0x1c3b78,_0x128e97){return db[_0xbf2c('0x25')][_0xbf2c('0x40')]({'where':{'id':_0x1c3b78['params']['id']}})[_0xbf2c('0x1f')](handleEntityNotFound(_0x128e97,null))[_0xbf2c('0x1f')](removeEntity(_0x128e97,null))[_0xbf2c('0x3b')](handleError(_0x128e97,null));};exports[_0xbf2c('0x41')]=function(_0x5d02d3,_0x4edca4){return db['FaxTransferReport'][_0xbf2c('0x41')]()[_0xbf2c('0x1f')](respondWithResult(_0x4edca4,null))['catch'](handleError(_0x4edca4,null));}; \ No newline at end of file +var _0xe600=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','query','keys','intersection','attributes','fields','length','model','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','field','options','FaxTransferReport','includeAll','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0xe600,0x159));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0e60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e60('0x1'));var jsonpatch=require(_0x0e60('0x2'));var rp=require(_0x0e60('0x3'));var moment=require(_0x0e60('0x4'));var BPromise=require(_0x0e60('0x5'));var Mustache=require(_0x0e60('0x6'));var util=require(_0x0e60('0x7'));var path=require(_0x0e60('0x8'));var sox=require(_0x0e60('0x9'));var csv=require(_0x0e60('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0xa'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e60('0x14'))(_0x0e60('0x15'));var utils=require(_0x0e60('0x16'));var config=require(_0x0e60('0x17'));var db=require(_0x0e60('0x18'))['db'];function respondWithStatusCode(_0x2a4cf0,_0x1f2f3e){_0x1f2f3e=_0x1f2f3e||0xcc;return function(_0x2f5ee4){if(_0x2f5ee4){return _0x2a4cf0['sendStatus'](_0x1f2f3e);}return _0x2a4cf0[_0x0e60('0x19')](_0x1f2f3e)[_0x0e60('0x1a')]();};}function respondWithResult(_0x24c20f,_0x1202fc){_0x1202fc=_0x1202fc||0xc8;return function(_0x45328b){if(_0x45328b){return _0x24c20f[_0x0e60('0x19')](_0x1202fc)['json'](_0x45328b);}};}function respondWithFilteredResult(_0x4192dd,_0x508fd0){return function(_0x91cd1){if(_0x91cd1){var _0x128887=_0x91cd1[_0x0e60('0x1b')],_0x170890=_0x508fd0[_0x0e60('0x1c')],_0x5ab4ba=_0x508fd0[_0x0e60('0x1c')]+_0x508fd0[_0x0e60('0x1d')],_0x2a8b5a;if(_0x5ab4ba>=_0x128887){_0x5ab4ba=_0x128887;_0x2a8b5a=0xc8;}else{_0x2a8b5a=0xce;}_0x4192dd['status'](_0x2a8b5a);return _0x4192dd[_0x0e60('0x1e')](_0x0e60('0x1f'),_0x170890+'-'+_0x5ab4ba+'/'+_0x128887)['json'](_0x91cd1);}return null;};}function patchUpdates(_0x17ab47){return function(_0x43c09d){try{jsonpatch[_0x0e60('0x20')](_0x43c09d,_0x17ab47,!![]);}catch(_0x504b31){return BPromise[_0x0e60('0x21')](_0x504b31);}return _0x43c09d['save']();};}function saveUpdates(_0x13b04c,_0x30c6a5){return function(_0xb9f037){if(_0xb9f037){return _0xb9f037[_0x0e60('0x22')](_0x13b04c)[_0x0e60('0x23')](function(_0x31a63e){return _0x31a63e;});}return null;};}function removeEntity(_0x38f677,_0x2ed72f){return function(_0x352633){if(_0x352633){return _0x352633[_0x0e60('0x24')]()[_0x0e60('0x23')](function(){_0x38f677[_0x0e60('0x19')](0xcc)[_0x0e60('0x1a')]();});}};}function handleEntityNotFound(_0x16985f,_0x4702f){return function(_0x33f9f3){if(!_0x33f9f3){_0x16985f[_0x0e60('0x25')](0x194);}return _0x33f9f3;};}function handleError(_0x2e388a,_0x21206a){_0x21206a=_0x21206a||0x1f4;return function(_0x4ba1a8){logger[_0x0e60('0x26')](_0x4ba1a8[_0x0e60('0x27')]);if(_0x4ba1a8['name']){delete _0x4ba1a8[_0x0e60('0x28')];}_0x2e388a['status'](_0x21206a)[_0x0e60('0x29')](_0x4ba1a8);};}exports['index']=function(_0x48d950,_0xd82283){var _0x39dae2={},_0x526aaa={},_0x4eb9b8={'count':0x0,'rows':[]};var _0x3ca649=db['FaxTransferReport'][_0x0e60('0x2a')];_0x526aaa['model']=_['keys'](_0x3ca649);_0x526aaa[_0x0e60('0x2b')]=_[_0x0e60('0x2c')](_0x48d950[_0x0e60('0x2b')]);_0x526aaa['filters']=_[_0x0e60('0x2d')](_0x526aaa['model'],_0x526aaa[_0x0e60('0x2b')]);_0x39dae2[_0x0e60('0x2e')]=_[_0x0e60('0x2d')](_0x526aaa['model'],qs[_0x0e60('0x2f')](_0x48d950[_0x0e60('0x2b')][_0x0e60('0x2f')]));_0x39dae2['attributes']=_0x39dae2[_0x0e60('0x2e')][_0x0e60('0x30')]?_0x39dae2[_0x0e60('0x2e')]:_0x526aaa[_0x0e60('0x31')];if(!_0x48d950[_0x0e60('0x2b')]['hasOwnProperty'](_0x0e60('0x32'))){_0x39dae2['limit']=qs[_0x0e60('0x1d')](_0x48d950['query'][_0x0e60('0x1d')]);_0x39dae2[_0x0e60('0x1c')]=qs[_0x0e60('0x1c')](_0x48d950['query'][_0x0e60('0x1c')]);}_0x39dae2[_0x0e60('0x33')]=qs[_0x0e60('0x34')](_0x48d950[_0x0e60('0x2b')][_0x0e60('0x34')]);_0x39dae2[_0x0e60('0x35')]=qs[_0x0e60('0x36')](_[_0x0e60('0x37')](_0x48d950[_0x0e60('0x2b')],_0x526aaa[_0x0e60('0x36')]));if(_0x48d950[_0x0e60('0x2b')][_0x0e60('0x38')]){_0x39dae2['where']=_[_0x0e60('0x39')](_0x39dae2[_0x0e60('0x35')],{'$or':_[_0x0e60('0x3a')](_0x3ca649,function(_0x34348d){if(_0x34348d['type']['key']!==_0x0e60('0x3b')){var _0x55ea74={};_0x55ea74[_0x34348d[_0x0e60('0x3c')]]={'$like':'%'+_0x48d950['query'][_0x0e60('0x38')]+'%'};return _0x55ea74;}})});}_0x39dae2=_[_0x0e60('0x39')]({},_0x39dae2,_0x48d950[_0x0e60('0x3d')]);var _0xa9514d={'where':_0x39dae2[_0x0e60('0x35')]};return db[_0x0e60('0x3e')][_0x0e60('0x1b')](_0xa9514d)[_0x0e60('0x23')](function(_0x2427a8){_0x4eb9b8[_0x0e60('0x1b')]=_0x2427a8;if(_0x48d950[_0x0e60('0x2b')][_0x0e60('0x3f')]){_0x39dae2['include']=[{'all':!![]}];}return db[_0x0e60('0x3e')]['findAll'](_0x39dae2);})[_0x0e60('0x23')](function(_0x266cae){_0x4eb9b8['rows']=_0x266cae;return _0x4eb9b8;})['then'](respondWithFilteredResult(_0xd82283,_0x39dae2))[_0x0e60('0x40')](handleError(_0xd82283,null));};exports[_0x0e60('0x41')]=function(_0x50b793,_0x67aea2){var _0x2c6464={'raw':!![],'where':{'id':_0x50b793[_0x0e60('0x42')]['id']}},_0x50090c={};_0x50090c[_0x0e60('0x31')]=_[_0x0e60('0x2c')](db[_0x0e60('0x3e')][_0x0e60('0x2a')]);_0x50090c[_0x0e60('0x2b')]=_[_0x0e60('0x2c')](_0x50b793[_0x0e60('0x2b')]);_0x50090c[_0x0e60('0x36')]=_['intersection'](_0x50090c['model'],_0x50090c['query']);_0x2c6464[_0x0e60('0x2e')]=_['intersection'](_0x50090c[_0x0e60('0x31')],qs[_0x0e60('0x2f')](_0x50b793[_0x0e60('0x2b')]['fields']));_0x2c6464[_0x0e60('0x2e')]=_0x2c6464[_0x0e60('0x2e')]['length']?_0x2c6464['attributes']:_0x50090c[_0x0e60('0x31')];if(_0x50b793[_0x0e60('0x2b')][_0x0e60('0x3f')]){_0x2c6464[_0x0e60('0x43')]=[{'all':!![]}];}_0x2c6464=_[_0x0e60('0x39')]({},_0x2c6464,_0x50b793[_0x0e60('0x3d')]);return db['FaxTransferReport'][_0x0e60('0x44')](_0x2c6464)[_0x0e60('0x23')](handleEntityNotFound(_0x67aea2,null))[_0x0e60('0x23')](respondWithResult(_0x67aea2,null))[_0x0e60('0x40')](handleError(_0x67aea2,null));};exports[_0x0e60('0x45')]=function(_0x557431,_0x5abbb4){return db['FaxTransferReport'][_0x0e60('0x45')](_0x557431[_0x0e60('0x46')],{})[_0x0e60('0x23')](respondWithResult(_0x5abbb4,0xc9))[_0x0e60('0x40')](handleError(_0x5abbb4,null));};exports['update']=function(_0x5b9cf6,_0x5c306f){if(_0x5b9cf6[_0x0e60('0x46')]['id']){delete _0x5b9cf6[_0x0e60('0x46')]['id'];}return db[_0x0e60('0x3e')][_0x0e60('0x44')]({'where':{'id':_0x5b9cf6[_0x0e60('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c306f,null))['then'](saveUpdates(_0x5b9cf6[_0x0e60('0x46')],null))[_0x0e60('0x23')](respondWithResult(_0x5c306f,null))[_0x0e60('0x40')](handleError(_0x5c306f,null));};exports[_0x0e60('0x24')]=function(_0x4ad156,_0x36a999){return db[_0x0e60('0x3e')][_0x0e60('0x44')]({'where':{'id':_0x4ad156['params']['id']}})[_0x0e60('0x23')](handleEntityNotFound(_0x36a999,null))[_0x0e60('0x23')](removeEntity(_0x36a999,null))['catch'](handleError(_0x36a999,null));};exports[_0x0e60('0x47')]=function(_0x4bbcb4,_0x305a2f){return db[_0x0e60('0x3e')][_0x0e60('0x47')]()[_0x0e60('0x23')](respondWithResult(_0x305a2f,null))[_0x0e60('0x40')](handleError(_0x305a2f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4296175..0602ee0 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 _0x5e25=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x5e25,0x109));var _0x55e2=function(_0x1f2064,_0x21cba8){_0x1f2064=_0x1f2064-0x0;var _0x2a47c3=_0x5e25[_0x1f2064];return _0x2a47c3;};'use strict';var _=require(_0x55e2('0x0'));var util=require(_0x55e2('0x1'));var logger=require(_0x55e2('0x2'))(_0x55e2('0x3'));var moment=require(_0x55e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x55e2('0x5'));var fs=require('fs');var path=require(_0x55e2('0x6'));var rimraf=require(_0x55e2('0x7'));var config=require(_0x55e2('0x8'));var attributes=require(_0x55e2('0x9'));module[_0x55e2('0xa')]=function(_0x43dc5a,_0x37931f){return _0x43dc5a[_0x55e2('0xb')]('FaxTransferReport',attributes,{'tableName':_0x55e2('0xc'),'paranoid':![],'indexes':[{'name':_0x55e2('0xd'),'fields':[_0x55e2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2af=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api'];(function(_0x34014b,_0x37ef4b){var _0x2cf870=function(_0xaa33d3){while(--_0xaa33d3){_0x34014b['push'](_0x34014b['shift']());}};_0x2cf870(++_0x37ef4b);}(_0xb2af,0x72));var _0xfb2a=function(_0x1bf572,_0x146c8b){_0x1bf572=_0x1bf572-0x0;var _0x29f9e0=_0xb2af[_0x1bf572];return _0x29f9e0;};'use strict';var _=require('lodash');var util=require(_0xfb2a('0x0'));var logger=require(_0xfb2a('0x1'))(_0xfb2a('0x2'));var moment=require(_0xfb2a('0x3'));var BPromise=require(_0xfb2a('0x4'));var rp=require(_0xfb2a('0x5'));var fs=require('fs');var path=require(_0xfb2a('0x6'));var rimraf=require(_0xfb2a('0x7'));var config=require(_0xfb2a('0x8'));var attributes=require(_0xfb2a('0x9'));module['exports']=function(_0xf7bd02,_0x44c184){return _0xf7bd02['define'](_0xfb2a('0xa'),attributes,{'tableName':_0xfb2a('0xb'),'paranoid':![],'indexes':[{'name':_0xfb2a('0xc'),'fields':[_0xfb2a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f553c3e..eceac93 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 _0x1c53=['error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b5214,_0x414a80){var _0x3c3645=function(_0x2f7ed4){while(--_0x2f7ed4){_0x4b5214['push'](_0x4b5214['shift']());}};_0x3c3645(++_0x414a80);}(_0x1c53,0xeb));var _0x31c5=function(_0x15df7f,_0x318875){_0x15df7f=_0x15df7f-0x0;var _0x2cb715=_0x1c53[_0x15df7f];return _0x2cb715;};'use strict';var _=require(_0x31c5('0x0'));var util=require(_0x31c5('0x1'));var moment=require(_0x31c5('0x2'));var BPromise=require(_0x31c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31c5('0x4'))['db'];var utils=require(_0x31c5('0x5'));var logger=require(_0x31c5('0x6'))('rpc');var config=require(_0x31c5('0x7'));var jayson=require(_0x31c5('0x8'));var client=jayson[_0x31c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x163e44,_0x999def,_0x1aa531){return new BPromise(function(_0x28cfca,_0x18d029){return client[_0x31c5('0xa')](_0x163e44,_0x1aa531)[_0x31c5('0xb')](function(_0x3828b9){logger[_0x31c5('0xc')](_0x31c5('0xd'),_0x999def,_0x31c5('0xe'));logger[_0x31c5('0xf')](_0x31c5('0x10'),_0x999def,'request\x20sent',JSON[_0x31c5('0x11')](_0x3828b9));if(_0x3828b9[_0x31c5('0x12')]){if(_0x3828b9[_0x31c5('0x12')][_0x31c5('0x13')]===0x1f4){logger[_0x31c5('0x12')](_0x31c5('0xd'),_0x999def,_0x3828b9['error'][_0x31c5('0x14')]);return _0x18d029(_0x3828b9[_0x31c5('0x12')][_0x31c5('0x14')]);}logger[_0x31c5('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x999def,_0x3828b9['error'][_0x31c5('0x14')]);return _0x28cfca(_0x3828b9[_0x31c5('0x12')][_0x31c5('0x14')]);}else{logger[_0x31c5('0xc')](_0x31c5('0xd'),_0x999def,_0x31c5('0xe'));_0x28cfca(_0x3828b9[_0x31c5('0x15')]['message']);}})[_0x31c5('0x16')](function(_0x725859){logger[_0x31c5('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x999def,_0x725859);_0x18d029(_0x725859);});});} \ No newline at end of file +var _0x7308=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d5b69,_0x1111ab){var _0xf82413=function(_0x3a1f48){while(--_0x3a1f48){_0x5d5b69['push'](_0x5d5b69['shift']());}};_0xf82413(++_0x1111ab);}(_0x7308,0x1f0));var _0x8730=function(_0x5a0afd,_0x113988){_0x5a0afd=_0x5a0afd-0x0;var _0x4899fa=_0x7308[_0x5a0afd];return _0x4899fa;};'use strict';var _=require(_0x8730('0x0'));var util=require(_0x8730('0x1'));var moment=require(_0x8730('0x2'));var BPromise=require(_0x8730('0x3'));var rs=require(_0x8730('0x4'));var fs=require('fs');var Redis=require(_0x8730('0x5'));var db=require(_0x8730('0x6'))['db'];var utils=require(_0x8730('0x7'));var logger=require(_0x8730('0x8'))('rpc');var config=require(_0x8730('0x9'));var jayson=require(_0x8730('0xa'));var client=jayson[_0x8730('0xb')][_0x8730('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x227590,_0xeae372,_0x533a4d){return new BPromise(function(_0x508499,_0x453319){return client[_0x8730('0xd')](_0x227590,_0x533a4d)[_0x8730('0xe')](function(_0x9833f6){logger['info'](_0x8730('0xf'),_0xeae372,_0x8730('0x10'));logger[_0x8730('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xeae372,_0x8730('0x10'),JSON[_0x8730('0x12')](_0x9833f6));if(_0x9833f6[_0x8730('0x13')]){if(_0x9833f6[_0x8730('0x13')][_0x8730('0x14')]===0x1f4){logger[_0x8730('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0xeae372,_0x9833f6[_0x8730('0x13')][_0x8730('0x15')]);return _0x453319(_0x9833f6['error'][_0x8730('0x15')]);}logger[_0x8730('0x13')](_0x8730('0xf'),_0xeae372,_0x9833f6[_0x8730('0x13')][_0x8730('0x15')]);return _0x508499(_0x9833f6[_0x8730('0x13')][_0x8730('0x15')]);}else{logger[_0x8730('0x16')](_0x8730('0xf'),_0xeae372,_0x8730('0x10'));_0x508499(_0x9833f6['result']['message']);}})[_0x8730('0x17')](function(_0x1bc5b0){logger[_0x8730('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0xeae372,_0x1bc5b0);_0x453319(_0x1bc5b0);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8b26d46..a672f89 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 _0xbd50=['post','create','put','update','/:id','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show'];(function(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0xbd50,0x196));var _0x0bd5=function(_0x52ba5c,_0x579e89){_0x52ba5c=_0x52ba5c-0x0;var _0x56bb9f=_0xbd50[_0x52ba5c];return _0x56bb9f;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['get']('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bd5('0xf')]);router[_0x0bd5('0x10')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['delete'](_0x0bd5('0x12'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4b84=['./faxTransferReport.controller','get','isAuthenticated','show','post','put','/:id','update','delete','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x4b84[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x9')]('/',auth[_0x44b8('0x7')](),controller['create']);router[_0x44b8('0xa')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller['destroy']);module[_0x44b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 12d258d..8544723 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 _0x3ef6=['Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','post','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x591af5,_0x1e1b5f){var _0x2487d5=function(_0x684311){while(--_0x684311){_0x591af5['push'](_0x591af5['shift']());}};_0x2487d5(++_0x1e1b5f);}(_0x3ef6,0x1b4));var _0x63ef=function(_0x18e0d1,_0xbca4cb){_0x18e0d1=_0x18e0d1-0x0;var _0x58db41=_0x3ef6[_0x18e0d1];return _0x58db41;};'use strict';var multer=require(_0x63ef('0x0'));var util=require(_0x63ef('0x1'));var path=require(_0x63ef('0x2'));var timeout=require(_0x63ef('0x3'));var express=require(_0x63ef('0x4'));var router=express[_0x63ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x63ef('0x6'));var config=require('../../config/environment');var controller=require(_0x63ef('0x7'));router[_0x63ef('0x8')]('/',auth[_0x63ef('0x9')](),controller[_0x63ef('0xa')]);router[_0x63ef('0x8')](_0x63ef('0xb'),auth['isAuthenticated'](),controller[_0x63ef('0xc')]);router[_0x63ef('0x8')](_0x63ef('0xd'),auth[_0x63ef('0x9')](),controller['getConfigurations']);router[_0x63ef('0x8')](_0x63ef('0xe'),auth[_0x63ef('0x9')](),controller['getFields']);router['post']('/',auth[_0x63ef('0x9')](),controller[_0x63ef('0xf')]);router[_0x63ef('0x10')](_0x63ef('0xd'),auth[_0x63ef('0x9')](),controller[_0x63ef('0x11')]);router['put'](_0x63ef('0xb'),auth['isAuthenticated'](),controller[_0x63ef('0x12')]);router[_0x63ef('0x13')](_0x63ef('0xb'),auth['isAuthenticated'](),controller[_0x63ef('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4566=['destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','/:id','update','delete'];(function(_0x4e4938,_0x5199ed){var _0x2dcc9c=function(_0x1bdbd0){while(--_0x1bdbd0){_0x4e4938['push'](_0x4e4938['shift']());}};_0x2dcc9c(++_0x5199ed);}(_0x4566,0x1bb));var _0x6456=function(_0x4dbede,_0x3b5fc3){_0x4dbede=_0x4dbede-0x0;var _0x46bb0c=_0x4566[_0x4dbede];return _0x46bb0c;};'use strict';var multer=require(_0x6456('0x0'));var util=require(_0x6456('0x1'));var path=require('path');var timeout=require(_0x6456('0x2'));var express=require(_0x6456('0x3'));var router=express[_0x6456('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6456('0x5'));var controller=require(_0x6456('0x6'));router[_0x6456('0x7')]('/',auth[_0x6456('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6456('0x9')]);router[_0x6456('0x7')](_0x6456('0xa'),auth['isAuthenticated'](),controller[_0x6456('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x6456('0xc')]);router[_0x6456('0xd')]('/',auth['isAuthenticated'](),controller[_0x6456('0xe')]);router[_0x6456('0xd')](_0x6456('0xa'),auth[_0x6456('0x8')](),controller['addConfiguration']);router[_0x6456('0xf')](_0x6456('0x10'),auth[_0x6456('0x8')](),controller[_0x6456('0x11')]);router[_0x6456('0x12')]('/:id',auth[_0x6456('0x8')](),controller[_0x6456('0x13')]);module[_0x6456('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 80e1c4f..012aa4e 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 _0xf2ff=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xf2ff,0x12a));var _0xff2f=function(_0xe44f7d,_0x3aa3c2){_0xe44f7d=_0xe44f7d-0x0;var _0x45a202=_0xf2ff[_0xe44f7d];return _0x45a202;};'use strict';var Sequelize=require(_0xff2f('0x0'));module[_0xff2f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xff2f('0x2')]},'username':{'type':Sequelize[_0xff2f('0x2')]},'remoteUri':{'type':Sequelize[_0xff2f('0x2')]},'authType':{'type':Sequelize[_0xff2f('0x3')](_0xff2f('0x4')),'defaultValue':_0xff2f('0x4')},'password':{'type':Sequelize[_0xff2f('0x2')]},'consumerKey':{'type':Sequelize[_0xff2f('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xff2f('0x2')]},'serverUrl':{'type':Sequelize[_0xff2f('0x2')]},'type':{'type':Sequelize[_0xff2f('0x3')](_0xff2f('0x5'),'newTab'),'defaultValue':_0xff2f('0x5')}}; \ No newline at end of file +var _0x3cf4=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x175075,_0x503c85){var _0x453513=function(_0x538e32){while(--_0x538e32){_0x175075['push'](_0x175075['shift']());}};_0x453513(++_0x503c85);}(_0x3cf4,0x1c3));var _0x43cf=function(_0x6716ee,_0x34778c){_0x6716ee=_0x6716ee-0x0;var _0x992b74=_0x3cf4[_0x6716ee];return _0x992b74;};'use strict';var Sequelize=require(_0x43cf('0x0'));module[_0x43cf('0x1')]={'name':{'type':Sequelize[_0x43cf('0x2')]},'description':{'type':Sequelize[_0x43cf('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x43cf('0x2')]},'authType':{'type':Sequelize[_0x43cf('0x3')](_0x43cf('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x43cf('0x2')]},'consumerKey':{'type':Sequelize[_0x43cf('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x43cf('0x2')]},'tokenSecret':{'type':Sequelize[_0x43cf('0x2')]},'serverUrl':{'type':Sequelize[_0x43cf('0x2')]},'type':{'type':Sequelize[_0x43cf('0x3')](_0x43cf('0x5'),_0x43cf('0x6')),'defaultValue':_0x43cf('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1b1e04e..f976ab5 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 _0xa9e0=['includeAll','include','findAll','rows','params','model','rawAttributes','find','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerKey','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','toString','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','../../config/license/hardware','../../config/logger','../../components/integrations/configuration','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','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','status','sendStatus','stack','name','send','index','DeskAccount','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','field','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x0a9e('0x13'));var jayson=require(_0x0a9e('0x14'));var client=jayson[_0x0a9e('0x15')][_0x0a9e('0x16')]({'port':0x232a});function checkPasswordPattern(_0x32d742,_0x69aeb7,_0x5db4b0){if(_0x5db4b0){var _0x4283ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4283ce[_0x0a9e('0x17')](_0x69aeb7)){return _0x32d742;}else{throw new Error(_0x0a9e('0x18'));}}else{return _0x32d742;}}function respondWithRpcPromise(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){var _0x1985b6=_0x52a03d||client;return _0x1985b6['request'](_0x281129,_0x4d5611)[_0x0a9e('0x19')](function(_0x12066b){logger['info'](_0x0a9e('0x1a'),_0x44dcfd,'request\x20sent');logger[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x44dcfd,_0x0a9e('0x1d'),JSON[_0x0a9e('0x1e')](_0x12066b));if(_0x12066b[_0x0a9e('0x1f')]){if(_0x12066b[_0x0a9e('0x1f')][_0x0a9e('0x20')]===0x1f4){logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x44dcfd,_0x12066b[_0x0a9e('0x1f')][_0x0a9e('0x21')]);return _0x5d0880(_0x12066b[_0x0a9e('0x1f')]['message']);}logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x44dcfd,_0x12066b['error'][_0x0a9e('0x21')]);return _0x22dccb(_0x12066b['error']['message']);}else{logger[_0x0a9e('0x22')](_0x0a9e('0x1a'),_0x44dcfd,_0x0a9e('0x1d'));_0x22dccb(_0x12066b[_0x0a9e('0x23')]['message']);}})[_0x0a9e('0x24')](function(_0x2fb0e4){logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x44dcfd,_0x2fb0e4);_0x5d0880(_0x2fb0e4);});});}function respondWithStatusCode(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0xcc;return function(_0x16b1ca){if(_0x16b1ca){return _0x370d86['sendStatus'](_0x42ac8f);}return _0x370d86['status'](_0x42ac8f)[_0x0a9e('0x25')]();};}function respondWithResult(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0xc8;return function(_0x33161b){if(_0x33161b){return _0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);}};}function respondWithFilteredResult(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(_0x5bfb33){var _0x1dc186=_0x5bfb33[_0x0a9e('0x27')],_0x34dc65=_0x45a1e7[_0x0a9e('0x28')],_0x25fba9=_0x45a1e7[_0x0a9e('0x28')]+_0x45a1e7[_0x0a9e('0x29')],_0x14433c;if(_0x25fba9>=_0x1dc186){_0x25fba9=_0x1dc186;_0x14433c=0xc8;}else{_0x14433c=0xce;}_0x479bc4['status'](_0x14433c);return _0x479bc4[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x34dc65+'-'+_0x25fba9+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x5bfb33);}return null;};}function patchUpdates(_0x2ec755){return function(_0x5c877d){try{jsonpatch[_0x0a9e('0x2c')](_0x5c877d,_0x2ec755,!![]);}catch(_0x40e7a3){return BPromise[_0x0a9e('0x2d')](_0x40e7a3);}return _0x5c877d[_0x0a9e('0x2e')]();};}function saveUpdates(_0x58b06f,_0x563b45){return function(_0x296f41){if(_0x296f41){return _0x296f41[_0x0a9e('0x2f')](_0x58b06f)[_0x0a9e('0x19')](function(_0x540530){return _0x540530;});}return null;};}function removeEntity(_0x426950,_0x5d1e0e){return function(_0x2407f9){if(_0x2407f9){return _0x2407f9[_0x0a9e('0x30')]()[_0x0a9e('0x19')](function(){_0x426950[_0x0a9e('0x31')](0xcc)[_0x0a9e('0x25')]();});}};}function handleEntityNotFound(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(!_0x46f0a5){_0x5180f1[_0x0a9e('0x32')](0x194);}return _0x46f0a5;};}function handleError(_0x2da5c0,_0x2b45ea){_0x2b45ea=_0x2b45ea||0x1f4;return function(_0x409319){logger[_0x0a9e('0x1f')](_0x409319[_0x0a9e('0x33')]);if(_0x409319['name']){delete _0x409319[_0x0a9e('0x34')];}_0x2da5c0['status'](_0x2b45ea)[_0x0a9e('0x35')](_0x409319);};}exports[_0x0a9e('0x36')]=function(_0x2b7e7f,_0x3f3d41){var _0x567193={},_0x191e91={},_0xd1836d={'count':0x0,'rows':[]};var _0x1fa90d=db[_0x0a9e('0x37')]['rawAttributes'];_0x191e91['model']=_[_0x0a9e('0x38')](_0x1fa90d);_0x191e91['query']=_[_0x0a9e('0x38')](_0x2b7e7f[_0x0a9e('0x39')]);_0x191e91[_0x0a9e('0x3a')]=_[_0x0a9e('0x3b')](_0x191e91['model'],_0x191e91[_0x0a9e('0x39')]);_0x567193[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x191e91['model'],qs[_0x0a9e('0x3d')](_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x567193['attributes']=_0x567193['attributes'][_0x0a9e('0x3e')]?_0x567193[_0x0a9e('0x3c')]:_0x191e91['model'];if(!_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x567193[_0x0a9e('0x29')]=qs['limit'](_0x2b7e7f['query'][_0x0a9e('0x29')]);_0x567193[_0x0a9e('0x28')]=qs['offset'](_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x28')]);}_0x567193[_0x0a9e('0x41')]=qs['sort'](_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x567193[_0x0a9e('0x43')]=qs[_0x0a9e('0x3a')](_[_0x0a9e('0x44')](_0x2b7e7f[_0x0a9e('0x39')],_0x191e91[_0x0a9e('0x3a')]));if(_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x567193[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x567193[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x47')](_0x1fa90d,function(_0x11ca30){if(_0x11ca30[_0x0a9e('0x48')]['key']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x11ca30[_0x0a9e('0x49')]]={'$like':'%'+_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x567193=_[_0x0a9e('0x46')]({},_0x567193,_0x2b7e7f[_0x0a9e('0x4a')]);var _0x10b040={'where':_0x567193[_0x0a9e('0x43')]};return db[_0x0a9e('0x37')][_0x0a9e('0x27')](_0x10b040)[_0x0a9e('0x19')](function(_0x35ed4a){_0xd1836d['count']=_0x35ed4a;if(_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x4b')]){_0x567193[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x37')][_0x0a9e('0x4d')](_0x567193);})[_0x0a9e('0x19')](function(_0x21eb86){_0xd1836d[_0x0a9e('0x4e')]=_0x21eb86;return _0xd1836d;})['then'](respondWithFilteredResult(_0x3f3d41,_0x567193))[_0x0a9e('0x24')](handleError(_0x3f3d41,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4f')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x50')]=_[_0x0a9e('0x38')](db[_0x0a9e('0x37')][_0x0a9e('0x51')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3a')]=_[_0x0a9e('0x3b')](_0x562fb4[_0x0a9e('0x50')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x562fb4[_0x0a9e('0x50')],qs[_0x0a9e('0x3d')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3c')]=_0x8d6dd1[_0x0a9e('0x3c')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4b')]){_0x8d6dd1[_0x0a9e('0x4c')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x4a')]);return db[_0x0a9e('0x37')][_0x0a9e('0x52')](_0x8d6dd1)[_0x0a9e('0x19')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x37')]['create'](_0x39d77d[_0x0a9e('0x53')],{})[_0x0a9e('0x19')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x53')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x52')]({'where':{'id':_0x2ef381[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x19')](saveUpdates(_0x2ef381[_0x0a9e('0x53')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x19')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getConfigurations']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4f')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x50')]=_[_0x0a9e('0x38')](db[_0x0a9e('0x55')][_0x0a9e('0x51')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3a')]=_['intersection'](_0x65432[_0x0a9e('0x50')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3c')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3c')]=_0x2f7092[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x2f7092[_0x0a9e('0x3c')]:_0x65432[_0x0a9e('0x50')];_0x2f7092[_0x0a9e('0x41')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3a')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3a')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x47')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x56')](_0x2f7092);}})[_0x0a9e('0x19')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x29')]);_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);}return _0x3cfd00[_0x0a9e('0x56')](_0x2f7092);}})[_0x0a9e('0x19')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x24')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x57')]=function(_0x320898,_0x412a72,_0x2a28c0){if(_0x320898[_0x0a9e('0x53')]['id']){delete _0x320898['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x320898[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x412a72,null))[_0x0a9e('0x19')](function(_0x30944e){if(_0x30944e){_0x320898['body'][_0x0a9e('0x58')]=_0x30944e['id'];_0x320898[_0x0a9e('0x53')][_0x0a9e('0x59')]=integrations[_0x0a9e('0x5a')](_0x320898[_0x0a9e('0x53')]['channel'],_0x320898['body']['type']);_0x320898[_0x0a9e('0x53')][_0x0a9e('0x5b')]=integrations[_0x0a9e('0x5c')](_0x320898[_0x0a9e('0x53')][_0x0a9e('0x5d')],_0x320898[_0x0a9e('0x53')][_0x0a9e('0x48')]);return db[_0x0a9e('0x55')]['create'](_0x320898[_0x0a9e('0x53')],{'include':[{'model':db[_0x0a9e('0x5e')],'as':_0x0a9e('0x59')},{'model':db['DeskField'],'as':_0x0a9e('0x5b')}]});}return null;})['then'](respondWithResult(_0x412a72,null))[_0x0a9e('0x24')](handleError(_0x412a72,null));};exports[_0x0a9e('0x5f')]=function(_0x4c46c1,_0x2ed01e,_0x75912a){var _0x2cc7a7=[{'name':_0x0a9e('0x60'),'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 _0x1d442c='';return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x4c46c1[_0x0a9e('0x4f')]['id']},'attributes':['id','remoteUri',_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),'consumerSecret',_0x0a9e('0x65'),_0x0a9e('0x66')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x2ed01e,null))[_0x0a9e('0x19')](function(_0x332367){if(_0x332367){_0x1d442c=_0x332367[_0x0a9e('0x67')];var _0x40fc56=_0x1d442c[_0x0a9e('0x68')](-0x1);if(_0x40fc56==='/'){_0x1d442c=_0x1d442c[_0x0a9e('0x69')](0x0,_0x1d442c[_0x0a9e('0x6a')](_0x40fc56));}var _0xc4c230={'method':_0x0a9e('0x6b'),'uri':util[_0x0a9e('0x6c')](_0x0a9e('0x6d'),_0x1d442c),'headers':{'Content-Type':'application/json','Accept':_0x0a9e('0x6e')},'json':!![]};if(_0x332367[_0x0a9e('0x61')]===_0x0a9e('0x6f')){_0xc4c230['headers'][_0x0a9e('0x70')]=util[_0x0a9e('0x6c')](_0x0a9e('0x71'),new Buffer(util[_0x0a9e('0x6c')]('%s:%s',_0x332367['username'],_0x332367[_0x0a9e('0x63')]))[_0x0a9e('0x72')]('base64'));}return rp(_0xc4c230)[_0x0a9e('0x19')](function(_0x53a6a1){return _0x2cc7a7[_0x0a9e('0x73')](_[_0x0a9e('0x47')](_0x53a6a1['_embedded'][_0x0a9e('0x74')],function(_0x41cf12){return{'id':_0x41cf12[_0x0a9e('0x34')],'name':_0x41cf12[_0x0a9e('0x34')],'type':_0x41cf12[_0x0a9e('0x48')],'active':_0x41cf12[_0x0a9e('0x75')],'label':_0x41cf12[_0x0a9e('0x76')],'custom':!![]};}));});}})['then'](function(_0x2973d3){return{'count':_0x2973d3[_0x0a9e('0x3e')],'rows':_0x2973d3};})[_0x0a9e('0x19')](respondWithResult(_0x2ed01e,null))[_0x0a9e('0x24')](function(_0x492543){var _0xf51744=_0x4c46c1[_0x0a9e('0x39')]['test']?0x1f4:_0x492543[_0x0a9e('0x77')]||0x1f4;logger['error'](_0x0a9e('0x78'),_0x0a9e('0x5f'),_0xf51744,JSON[_0x0a9e('0x1e')](_0x492543));delete _0x492543[_0x0a9e('0x34')];if(_0xf51744===0x191){_0xf51744=0x190;}_0x2ed01e['status'](_0xf51744)['send'](_0x4c46c1[_0x0a9e('0x39')][_0x0a9e('0x17')]?{'message':_0x0a9e('0x79'),'statusCode':_0x492543['statusCode']}:_0x492543);});}; \ No newline at end of file +var _0xa9e0=['includeAll','include','findAll','rows','params','model','rawAttributes','find','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerKey','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','toString','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','../../config/license/hardware','../../config/logger','../../components/integrations/configuration','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','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','status','sendStatus','stack','name','send','index','DeskAccount','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','field','options'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x0a9e('0x13'));var jayson=require(_0x0a9e('0x14'));var client=jayson[_0x0a9e('0x15')][_0x0a9e('0x16')]({'port':0x232a});function checkPasswordPattern(_0x32d742,_0x69aeb7,_0x5db4b0){if(_0x5db4b0){var _0x4283ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4283ce[_0x0a9e('0x17')](_0x69aeb7)){return _0x32d742;}else{throw new Error(_0x0a9e('0x18'));}}else{return _0x32d742;}}function respondWithRpcPromise(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){var _0x1985b6=_0x52a03d||client;return _0x1985b6['request'](_0x281129,_0x4d5611)[_0x0a9e('0x19')](function(_0x12066b){logger['info'](_0x0a9e('0x1a'),_0x44dcfd,'request\x20sent');logger[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x44dcfd,_0x0a9e('0x1d'),JSON[_0x0a9e('0x1e')](_0x12066b));if(_0x12066b[_0x0a9e('0x1f')]){if(_0x12066b[_0x0a9e('0x1f')][_0x0a9e('0x20')]===0x1f4){logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x44dcfd,_0x12066b[_0x0a9e('0x1f')][_0x0a9e('0x21')]);return _0x5d0880(_0x12066b[_0x0a9e('0x1f')]['message']);}logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x44dcfd,_0x12066b['error'][_0x0a9e('0x21')]);return _0x22dccb(_0x12066b['error']['message']);}else{logger[_0x0a9e('0x22')](_0x0a9e('0x1a'),_0x44dcfd,_0x0a9e('0x1d'));_0x22dccb(_0x12066b[_0x0a9e('0x23')]['message']);}})[_0x0a9e('0x24')](function(_0x2fb0e4){logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x44dcfd,_0x2fb0e4);_0x5d0880(_0x2fb0e4);});});}function respondWithStatusCode(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0xcc;return function(_0x16b1ca){if(_0x16b1ca){return _0x370d86['sendStatus'](_0x42ac8f);}return _0x370d86['status'](_0x42ac8f)[_0x0a9e('0x25')]();};}function respondWithResult(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0xc8;return function(_0x33161b){if(_0x33161b){return _0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);}};}function respondWithFilteredResult(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(_0x5bfb33){var _0x1dc186=_0x5bfb33[_0x0a9e('0x27')],_0x34dc65=_0x45a1e7[_0x0a9e('0x28')],_0x25fba9=_0x45a1e7[_0x0a9e('0x28')]+_0x45a1e7[_0x0a9e('0x29')],_0x14433c;if(_0x25fba9>=_0x1dc186){_0x25fba9=_0x1dc186;_0x14433c=0xc8;}else{_0x14433c=0xce;}_0x479bc4['status'](_0x14433c);return _0x479bc4[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x34dc65+'-'+_0x25fba9+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x5bfb33);}return null;};}function patchUpdates(_0x2ec755){return function(_0x5c877d){try{jsonpatch[_0x0a9e('0x2c')](_0x5c877d,_0x2ec755,!![]);}catch(_0x40e7a3){return BPromise[_0x0a9e('0x2d')](_0x40e7a3);}return _0x5c877d[_0x0a9e('0x2e')]();};}function saveUpdates(_0x58b06f,_0x563b45){return function(_0x296f41){if(_0x296f41){return _0x296f41[_0x0a9e('0x2f')](_0x58b06f)[_0x0a9e('0x19')](function(_0x540530){return _0x540530;});}return null;};}function removeEntity(_0x426950,_0x5d1e0e){return function(_0x2407f9){if(_0x2407f9){return _0x2407f9[_0x0a9e('0x30')]()[_0x0a9e('0x19')](function(){_0x426950[_0x0a9e('0x31')](0xcc)[_0x0a9e('0x25')]();});}};}function handleEntityNotFound(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(!_0x46f0a5){_0x5180f1[_0x0a9e('0x32')](0x194);}return _0x46f0a5;};}function handleError(_0x2da5c0,_0x2b45ea){_0x2b45ea=_0x2b45ea||0x1f4;return function(_0x409319){logger[_0x0a9e('0x1f')](_0x409319[_0x0a9e('0x33')]);if(_0x409319['name']){delete _0x409319[_0x0a9e('0x34')];}_0x2da5c0['status'](_0x2b45ea)[_0x0a9e('0x35')](_0x409319);};}exports[_0x0a9e('0x36')]=function(_0x2b7e7f,_0x3f3d41){var _0x567193={},_0x191e91={},_0xd1836d={'count':0x0,'rows':[]};var _0x1fa90d=db[_0x0a9e('0x37')]['rawAttributes'];_0x191e91['model']=_[_0x0a9e('0x38')](_0x1fa90d);_0x191e91['query']=_[_0x0a9e('0x38')](_0x2b7e7f[_0x0a9e('0x39')]);_0x191e91[_0x0a9e('0x3a')]=_[_0x0a9e('0x3b')](_0x191e91['model'],_0x191e91[_0x0a9e('0x39')]);_0x567193[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x191e91['model'],qs[_0x0a9e('0x3d')](_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x567193['attributes']=_0x567193['attributes'][_0x0a9e('0x3e')]?_0x567193[_0x0a9e('0x3c')]:_0x191e91['model'];if(!_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x567193[_0x0a9e('0x29')]=qs['limit'](_0x2b7e7f['query'][_0x0a9e('0x29')]);_0x567193[_0x0a9e('0x28')]=qs['offset'](_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x28')]);}_0x567193[_0x0a9e('0x41')]=qs['sort'](_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x567193[_0x0a9e('0x43')]=qs[_0x0a9e('0x3a')](_[_0x0a9e('0x44')](_0x2b7e7f[_0x0a9e('0x39')],_0x191e91[_0x0a9e('0x3a')]));if(_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x567193[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x567193[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x47')](_0x1fa90d,function(_0x11ca30){if(_0x11ca30[_0x0a9e('0x48')]['key']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x11ca30[_0x0a9e('0x49')]]={'$like':'%'+_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x567193=_[_0x0a9e('0x46')]({},_0x567193,_0x2b7e7f[_0x0a9e('0x4a')]);var _0x10b040={'where':_0x567193[_0x0a9e('0x43')]};return db[_0x0a9e('0x37')][_0x0a9e('0x27')](_0x10b040)[_0x0a9e('0x19')](function(_0x35ed4a){_0xd1836d['count']=_0x35ed4a;if(_0x2b7e7f[_0x0a9e('0x39')][_0x0a9e('0x4b')]){_0x567193[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x37')][_0x0a9e('0x4d')](_0x567193);})[_0x0a9e('0x19')](function(_0x21eb86){_0xd1836d[_0x0a9e('0x4e')]=_0x21eb86;return _0xd1836d;})['then'](respondWithFilteredResult(_0x3f3d41,_0x567193))[_0x0a9e('0x24')](handleError(_0x3f3d41,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4f')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x50')]=_[_0x0a9e('0x38')](db[_0x0a9e('0x37')][_0x0a9e('0x51')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3a')]=_[_0x0a9e('0x3b')](_0x562fb4[_0x0a9e('0x50')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x562fb4[_0x0a9e('0x50')],qs[_0x0a9e('0x3d')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3c')]=_0x8d6dd1[_0x0a9e('0x3c')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4b')]){_0x8d6dd1[_0x0a9e('0x4c')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x4a')]);return db[_0x0a9e('0x37')][_0x0a9e('0x52')](_0x8d6dd1)[_0x0a9e('0x19')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x37')]['create'](_0x39d77d[_0x0a9e('0x53')],{})[_0x0a9e('0x19')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x53')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x52')]({'where':{'id':_0x2ef381[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x19')](saveUpdates(_0x2ef381[_0x0a9e('0x53')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x37')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x19')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getConfigurations']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4f')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x50')]=_[_0x0a9e('0x38')](db[_0x0a9e('0x55')][_0x0a9e('0x51')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3a')]=_['intersection'](_0x65432[_0x0a9e('0x50')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3c')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3c')]=_0x2f7092[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x2f7092[_0x0a9e('0x3c')]:_0x65432[_0x0a9e('0x50')];_0x2f7092[_0x0a9e('0x41')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3a')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3a')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x47')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x56')](_0x2f7092);}})[_0x0a9e('0x19')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x29')]);_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);}return _0x3cfd00[_0x0a9e('0x56')](_0x2f7092);}})[_0x0a9e('0x19')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x24')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x57')]=function(_0x320898,_0x412a72,_0x2a28c0){if(_0x320898[_0x0a9e('0x53')]['id']){delete _0x320898['body']['id'];}return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x320898[_0x0a9e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x412a72,null))[_0x0a9e('0x19')](function(_0x30944e){if(_0x30944e){_0x320898['body'][_0x0a9e('0x58')]=_0x30944e['id'];_0x320898[_0x0a9e('0x53')][_0x0a9e('0x59')]=integrations[_0x0a9e('0x5a')](_0x320898[_0x0a9e('0x53')]['channel'],_0x320898['body']['type']);_0x320898[_0x0a9e('0x53')][_0x0a9e('0x5b')]=integrations[_0x0a9e('0x5c')](_0x320898[_0x0a9e('0x53')][_0x0a9e('0x5d')],_0x320898[_0x0a9e('0x53')][_0x0a9e('0x48')]);return db[_0x0a9e('0x55')]['create'](_0x320898[_0x0a9e('0x53')],{'include':[{'model':db[_0x0a9e('0x5e')],'as':_0x0a9e('0x59')},{'model':db['DeskField'],'as':_0x0a9e('0x5b')}]});}return null;})['then'](respondWithResult(_0x412a72,null))[_0x0a9e('0x24')](handleError(_0x412a72,null));};exports[_0x0a9e('0x5f')]=function(_0x4c46c1,_0x2ed01e,_0x75912a){var _0x2cc7a7=[{'name':_0x0a9e('0x60'),'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 _0x1d442c='';return db[_0x0a9e('0x37')][_0x0a9e('0x54')]({'where':{'id':_0x4c46c1[_0x0a9e('0x4f')]['id']},'attributes':['id','remoteUri',_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),'consumerSecret',_0x0a9e('0x65'),_0x0a9e('0x66')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x2ed01e,null))[_0x0a9e('0x19')](function(_0x332367){if(_0x332367){_0x1d442c=_0x332367[_0x0a9e('0x67')];var _0x40fc56=_0x1d442c[_0x0a9e('0x68')](-0x1);if(_0x40fc56==='/'){_0x1d442c=_0x1d442c[_0x0a9e('0x69')](0x0,_0x1d442c[_0x0a9e('0x6a')](_0x40fc56));}var _0xc4c230={'method':_0x0a9e('0x6b'),'uri':util[_0x0a9e('0x6c')](_0x0a9e('0x6d'),_0x1d442c),'headers':{'Content-Type':'application/json','Accept':_0x0a9e('0x6e')},'json':!![]};if(_0x332367[_0x0a9e('0x61')]===_0x0a9e('0x6f')){_0xc4c230['headers'][_0x0a9e('0x70')]=util[_0x0a9e('0x6c')](_0x0a9e('0x71'),new Buffer(util[_0x0a9e('0x6c')]('%s:%s',_0x332367['username'],_0x332367[_0x0a9e('0x63')]))[_0x0a9e('0x72')]('base64'));}return rp(_0xc4c230)[_0x0a9e('0x19')](function(_0x53a6a1){return _0x2cc7a7[_0x0a9e('0x73')](_[_0x0a9e('0x47')](_0x53a6a1['_embedded'][_0x0a9e('0x74')],function(_0x41cf12){return{'id':_0x41cf12[_0x0a9e('0x34')],'name':_0x41cf12[_0x0a9e('0x34')],'type':_0x41cf12[_0x0a9e('0x48')],'active':_0x41cf12[_0x0a9e('0x75')],'label':_0x41cf12[_0x0a9e('0x76')],'custom':!![]};}));});}})['then'](function(_0x2973d3){return{'count':_0x2973d3[_0x0a9e('0x3e')],'rows':_0x2973d3};})[_0x0a9e('0x19')](respondWithResult(_0x2ed01e,null))[_0x0a9e('0x24')](function(_0x492543){var _0xf51744=_0x4c46c1[_0x0a9e('0x39')]['test']?0x1f4:_0x492543[_0x0a9e('0x77')]||0x1f4;logger['error'](_0x0a9e('0x78'),_0x0a9e('0x5f'),_0xf51744,JSON[_0x0a9e('0x1e')](_0x492543));delete _0x492543[_0x0a9e('0x34')];if(_0xf51744===0x191){_0xf51744=0x190;}_0x2ed01e['status'](_0xf51744)['send'](_0x4c46c1[_0x0a9e('0x39')][_0x0a9e('0x17')]?{'message':_0x0a9e('0x79'),'statusCode':_0x492543['statusCode']}:_0x492543);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 89009cd..d4a72db 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x409717,_0x143ef9){var _0x3182e6=function(_0x39bb2c){while(--_0x39bb2c){_0x409717['push'](_0x409717['shift']());}};_0x3182e6(++_0x143ef9);}(_0xaa88,0x137));var _0x8aa8=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0xaa88[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x460042,_0x5264ff){return _0x460042[_0x8aa8('0xa')](_0x8aa8('0xb'),attributes,{'tableName':_0x8aa8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0x22fb,0x192));var _0xb22f=function(_0x2bbb75,_0x4192a7){_0x2bbb75=_0x2bbb75-0x0;var _0x770644=_0x22fb[_0x2bbb75];return _0x770644;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));var integrations=require(_0xb22f('0x7'));module[_0xb22f('0x8')]=function(_0xc3ffcc,_0x412a95){return _0xc3ffcc[_0xb22f('0x9')]('DeskAccount',attributes,{'tableName':_0xb22f('0xa'),'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 d8e85b7..037b377 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 _0x8ed7=['ShowDeskAccount','DeskAccount','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetDeskAccount','options','raw','where','attributes','map','include','model','debug','stringify'];(function(_0x1545ed,_0x578045){var _0x4b8ced=function(_0x38d4fd){while(--_0x38d4fd){_0x1545ed['push'](_0x1545ed['shift']());}};_0x4b8ced(++_0x578045);}(_0x8ed7,0x8b));var _0x78ed=function(_0x1fa356,_0x3edf8b){_0x1fa356=_0x1fa356-0x0;var _0x156e8d=_0x8ed7[_0x1fa356];return _0x156e8d;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var moment=require(_0x78ed('0x1'));var BPromise=require(_0x78ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ed('0x3'))['db'];var utils=require(_0x78ed('0x4'));var logger=require(_0x78ed('0x5'))(_0x78ed('0x6'));var config=require(_0x78ed('0x7'));var jayson=require(_0x78ed('0x8'));var client=jayson[_0x78ed('0x9')][_0x78ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fc5e7,_0x54c783,_0x232d7b){return new BPromise(function(_0x5197a3,_0x1c0ec8){return client['request'](_0x1fc5e7,_0x232d7b)[_0x78ed('0xb')](function(_0x550763){logger['info'](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));logger['debug'](_0x78ed('0xe'),_0x54c783,_0x78ed('0xd'),JSON['stringify'](_0x550763));if(_0x550763[_0x78ed('0xf')]){if(_0x550763['error'][_0x78ed('0x10')]===0x1f4){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x550763[_0x78ed('0xf')][_0x78ed('0x11')]);return _0x1c0ec8(_0x550763[_0x78ed('0xf')]['message']);}logger[_0x78ed('0xf')]('DeskAccount,\x20%s,\x20%s',_0x54c783,_0x550763['error']['message']);return _0x5197a3(_0x550763['error']['message']);}else{logger[_0x78ed('0x12')](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));_0x5197a3(_0x550763[_0x78ed('0x13')][_0x78ed('0x11')]);}})[_0x78ed('0x14')](function(_0x336ae1){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x336ae1);_0x1c0ec8(_0x336ae1);});});}exports[_0x78ed('0x15')]=function(_0x2dd98c){var _0x4b9797=this;return new Promise(function(_0x2f442b,_0xb8b1f4){return db['DeskAccount']['findAll']({'raw':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')][_0x78ed('0x17')]===undefined?!![]:![]:!![],'where':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')][_0x78ed('0x18')]||null:null,'attributes':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')][_0x78ed('0x19')]||null:null,'limit':_0x2dd98c[_0x78ed('0x16')]?_0x2dd98c[_0x78ed('0x16')]['limit']||null:null,'include':_0x2dd98c['options']?_0x2dd98c[_0x78ed('0x16')]['include']?_[_0x78ed('0x1a')](_0x2dd98c['options'][_0x78ed('0x1b')],function(_0x590d90){return{'model':db[_0x590d90[_0x78ed('0x1c')]],'as':_0x590d90['as'],'attributes':_0x590d90[_0x78ed('0x19')],'include':_0x590d90[_0x78ed('0x1b')]?_['map'](_0x590d90[_0x78ed('0x1b')],function(_0x5a8b87){return{'model':db[_0x5a8b87[_0x78ed('0x1c')]],'as':_0x5a8b87['as'],'attributes':_0x5a8b87[_0x78ed('0x19')],'include':_0x5a8b87[_0x78ed('0x1b')]?_['map'](_0x5a8b87['include'],function(_0x464050){return{'model':db[_0x464050['model']],'as':_0x464050['as'],'attributes':_0x464050[_0x78ed('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12d5e1){logger[_0x78ed('0x12')](_0x78ed('0x15'),_0x2dd98c);logger[_0x78ed('0x1d')](_0x78ed('0x15'),_0x2dd98c,JSON[_0x78ed('0x1e')](_0x12d5e1));_0x2f442b(_0x12d5e1);})[_0x78ed('0x14')](function(_0x312801){logger[_0x78ed('0xf')]('GetDeskAccount',_0x312801[_0x78ed('0x11')],_0x2dd98c);_0xb8b1f4(_0x4b9797[_0x78ed('0xf')](0x1f4,_0x312801[_0x78ed('0x11')]));});});};exports[_0x78ed('0x1f')]=function(_0x4af685){var _0x4a8a5e=this;return new Promise(function(_0x5da4d0,_0x5e7234){return db[_0x78ed('0x20')][_0x78ed('0x21')]({'raw':_0x4af685[_0x78ed('0x16')]?_0x4af685[_0x78ed('0x16')][_0x78ed('0x17')]===undefined?!![]:![]:!![],'where':_0x4af685[_0x78ed('0x16')]?_0x4af685[_0x78ed('0x16')]['where']||null:null,'attributes':_0x4af685[_0x78ed('0x16')]?_0x4af685['options'][_0x78ed('0x19')]||null:null,'include':_0x4af685[_0x78ed('0x16')]?_0x4af685['options'][_0x78ed('0x1b')]?_[_0x78ed('0x1a')](_0x4af685[_0x78ed('0x16')][_0x78ed('0x1b')],function(_0x2f66e6){return{'model':db[_0x2f66e6[_0x78ed('0x1c')]],'as':_0x2f66e6['as'],'attributes':_0x2f66e6[_0x78ed('0x19')],'include':_0x2f66e6[_0x78ed('0x1b')]?_['map'](_0x2f66e6[_0x78ed('0x1b')],function(_0x4dc127){return{'model':db[_0x4dc127[_0x78ed('0x1c')]],'as':_0x4dc127['as'],'attributes':_0x4dc127[_0x78ed('0x19')],'include':_0x4dc127[_0x78ed('0x1b')]?_[_0x78ed('0x1a')](_0x4dc127[_0x78ed('0x1b')],function(_0x1aec84){return{'model':db[_0x1aec84[_0x78ed('0x1c')]],'as':_0x1aec84['as'],'attributes':_0x1aec84['attributes']};}):[]};}):[]};}):[]:[]})[_0x78ed('0xb')](function(_0x477e80){logger[_0x78ed('0x12')](_0x78ed('0x1f'),_0x4af685);logger[_0x78ed('0x1d')](_0x78ed('0x1f'),_0x4af685,JSON[_0x78ed('0x1e')](_0x477e80));_0x5da4d0(_0x477e80);})[_0x78ed('0x14')](function(_0x3ba9e8){logger[_0x78ed('0xf')](_0x78ed('0x1f'),_0x3ba9e8['message'],_0x4af685);_0x5e7234(_0x4a8a5e['error'](0x1f4,_0x3ba9e8[_0x78ed('0x11')]));});});}; \ No newline at end of file +var _0x866a=['error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','include','map','model','attributes','debug','ShowDeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x16e2c0,_0x430a4a){var _0x502b31=function(_0x2fd363){while(--_0x2fd363){_0x16e2c0['push'](_0x16e2c0['shift']());}};_0x502b31(++_0x430a4a);}(_0x866a,0x156));var _0xa866=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x866a[_0x5a184b];return _0x713964;};'use strict';var _=require('lodash');var util=require(_0xa866('0x0'));var moment=require(_0xa866('0x1'));var BPromise=require(_0xa866('0x2'));var rs=require(_0xa866('0x3'));var fs=require('fs');var Redis=require(_0xa866('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa866('0x5'));var logger=require(_0xa866('0x6'))(_0xa866('0x7'));var config=require('../../config/environment');var jayson=require(_0xa866('0x8'));var client=jayson[_0xa866('0x9')][_0xa866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288582,_0x3d1380,_0x2c7278){return new BPromise(function(_0x41a92a,_0x208625){return client[_0xa866('0xb')](_0x288582,_0x2c7278)[_0xa866('0xc')](function(_0x525ce6){logger[_0xa866('0xd')](_0xa866('0xe'),_0x3d1380,_0xa866('0xf'));logger['debug'](_0xa866('0x10'),_0x3d1380,_0xa866('0xf'),JSON[_0xa866('0x11')](_0x525ce6));if(_0x525ce6[_0xa866('0x12')]){if(_0x525ce6[_0xa866('0x12')][_0xa866('0x13')]===0x1f4){logger['error'](_0xa866('0xe'),_0x3d1380,_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);return _0x208625(_0x525ce6[_0xa866('0x12')]['message']);}logger[_0xa866('0x12')]('DeskAccount,\x20%s,\x20%s',_0x3d1380,_0x525ce6[_0xa866('0x12')]['message']);return _0x41a92a(_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);}else{logger[_0xa866('0xd')]('DeskAccount,\x20%s,\x20%s',_0x3d1380,_0xa866('0xf'));_0x41a92a(_0x525ce6[_0xa866('0x15')][_0xa866('0x14')]);}})[_0xa866('0x16')](function(_0x1e2211){logger[_0xa866('0x12')](_0xa866('0xe'),_0x3d1380,_0x1e2211);_0x208625(_0x1e2211);});});}exports[_0xa866('0x17')]=function(_0x440de5){var _0x48fd82=this;return new Promise(function(_0x2aca7b,_0x1de976){return db[_0xa866('0x18')][_0xa866('0x19')]({'raw':_0x440de5[_0xa866('0x1a')]?_0x440de5[_0xa866('0x1a')][_0xa866('0x1b')]===undefined?!![]:![]:!![],'where':_0x440de5['options']?_0x440de5[_0xa866('0x1a')]['where']||null:null,'attributes':_0x440de5['options']?_0x440de5[_0xa866('0x1a')]['attributes']||null:null,'limit':_0x440de5[_0xa866('0x1a')]?_0x440de5[_0xa866('0x1a')][_0xa866('0x1c')]||null:null,'include':_0x440de5['options']?_0x440de5['options'][_0xa866('0x1d')]?_[_0xa866('0x1e')](_0x440de5['options'][_0xa866('0x1d')],function(_0x31ed99){return{'model':db[_0x31ed99[_0xa866('0x1f')]],'as':_0x31ed99['as'],'attributes':_0x31ed99[_0xa866('0x20')],'include':_0x31ed99['include']?_[_0xa866('0x1e')](_0x31ed99[_0xa866('0x1d')],function(_0x35a83d){return{'model':db[_0x35a83d[_0xa866('0x1f')]],'as':_0x35a83d['as'],'attributes':_0x35a83d[_0xa866('0x20')],'include':_0x35a83d[_0xa866('0x1d')]?_['map'](_0x35a83d[_0xa866('0x1d')],function(_0x16c9f7){return{'model':db[_0x16c9f7['model']],'as':_0x16c9f7['as'],'attributes':_0x16c9f7['attributes']};}):[]};}):[]};}):[]:[]})[_0xa866('0xc')](function(_0x25f236){logger['info']('GetDeskAccount',_0x440de5);logger[_0xa866('0x21')](_0xa866('0x17'),_0x440de5,JSON['stringify'](_0x25f236));_0x2aca7b(_0x25f236);})[_0xa866('0x16')](function(_0x36e73b){logger[_0xa866('0x12')]('GetDeskAccount',_0x36e73b[_0xa866('0x14')],_0x440de5);_0x1de976(_0x48fd82[_0xa866('0x12')](0x1f4,_0x36e73b[_0xa866('0x14')]));});});};exports[_0xa866('0x22')]=function(_0x11ec00){var _0x4b3d81=this;return new Promise(function(_0x4eb663,_0x1ad800){return db[_0xa866('0x18')][_0xa866('0x23')]({'raw':_0x11ec00[_0xa866('0x1a')]?_0x11ec00[_0xa866('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x11ec00[_0xa866('0x1a')]?_0x11ec00[_0xa866('0x1a')]['where']||null:null,'attributes':_0x11ec00[_0xa866('0x1a')]?_0x11ec00[_0xa866('0x1a')]['attributes']||null:null,'include':_0x11ec00[_0xa866('0x1a')]?_0x11ec00[_0xa866('0x1a')][_0xa866('0x1d')]?_[_0xa866('0x1e')](_0x11ec00[_0xa866('0x1a')][_0xa866('0x1d')],function(_0x2ca6b1){return{'model':db[_0x2ca6b1[_0xa866('0x1f')]],'as':_0x2ca6b1['as'],'attributes':_0x2ca6b1[_0xa866('0x20')],'include':_0x2ca6b1[_0xa866('0x1d')]?_['map'](_0x2ca6b1['include'],function(_0x395b00){return{'model':db[_0x395b00[_0xa866('0x1f')]],'as':_0x395b00['as'],'attributes':_0x395b00[_0xa866('0x20')],'include':_0x395b00[_0xa866('0x1d')]?_[_0xa866('0x1e')](_0x395b00['include'],function(_0x34f3ba){return{'model':db[_0x34f3ba[_0xa866('0x1f')]],'as':_0x34f3ba['as'],'attributes':_0x34f3ba[_0xa866('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa866('0xc')](function(_0x5529b0){logger[_0xa866('0xd')](_0xa866('0x22'),_0x11ec00);logger[_0xa866('0x21')]('ShowDeskAccount',_0x11ec00,JSON[_0xa866('0x11')](_0x5529b0));_0x4eb663(_0x5529b0);})[_0xa866('0x16')](function(_0x69624c){logger[_0xa866('0x12')]('ShowDeskAccount',_0x69624c[_0xa866('0x14')],_0x11ec00);_0x1ad800(_0x4b3d81['error'](0x1f4,_0x69624c[_0xa866('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index cee788e..66b104c 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 _0x2624=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','multer','util','path'];(function(_0x35906a,_0xca95be){var _0x17ae74=function(_0x5f21c1){while(--_0x5f21c1){_0x35906a['push'](_0x35906a['shift']());}};_0x17ae74(++_0xca95be);}(_0x2624,0x101));var _0x4262=function(_0x4b89f6,_0x51f167){_0x4b89f6=_0x4b89f6-0x0;var _0x1fd82d=_0x2624[_0x4b89f6];return _0x1fd82d;};'use strict';var multer=require(_0x4262('0x0'));var util=require(_0x4262('0x1'));var path=require(_0x4262('0x2'));var timeout=require(_0x4262('0x3'));var express=require(_0x4262('0x4'));var router=express[_0x4262('0x5')]();var auth=require(_0x4262('0x6'));var interaction=require(_0x4262('0x7'));var config=require('../../config/environment');var controller=require(_0x4262('0x8'));router[_0x4262('0x9')]('/',auth[_0x4262('0xa')](),controller['index']);router[_0x4262('0x9')](_0x4262('0xb'),auth[_0x4262('0xa')](),controller[_0x4262('0xc')]);router[_0x4262('0x9')](_0x4262('0xd'),auth[_0x4262('0xa')](),controller[_0x4262('0xe')]);router['get'](_0x4262('0xf'),auth[_0x4262('0xa')](),controller[_0x4262('0x10')]);router[_0x4262('0x9')](_0x4262('0x11'),auth[_0x4262('0xa')](),controller[_0x4262('0x12')]);router[_0x4262('0x9')](_0x4262('0x13'),auth[_0x4262('0xa')](),controller[_0x4262('0x14')]);router[_0x4262('0x15')]('/',auth[_0x4262('0xa')](),controller[_0x4262('0x16')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x4262('0x17')]);router['put'](_0x4262('0xb'),auth[_0x4262('0xa')](),controller[_0x4262('0x18')]);router[_0x4262('0x19')]('/:id',auth[_0x4262('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x984b=['index','show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','path','express','Router','../../config/environment','get','isAuthenticated'];(function(_0x4152a9,_0x24d08d){var _0x3bb207=function(_0x59bb06){while(--_0x59bb06){_0x4152a9['push'](_0x4152a9['shift']());}};_0x3bb207(++_0x24d08d);}(_0x984b,0xd5));var _0xb984=function(_0x3467b8,_0x1711d5){_0x3467b8=_0x3467b8-0x0;var _0x2e387b=_0x984b[_0x3467b8];return _0x2e387b;};'use strict';var multer=require(_0xb984('0x0'));var util=require('util');var path=require(_0xb984('0x1'));var timeout=require('connect-timeout');var express=require(_0xb984('0x2'));var router=express[_0xb984('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb984('0x4'));var controller=require('./intDeskConfiguration.controller');router[_0xb984('0x5')]('/',auth[_0xb984('0x6')](),controller[_0xb984('0x7')]);router['get']('/:id',auth[_0xb984('0x6')](),controller[_0xb984('0x8')]);router[_0xb984('0x5')](_0xb984('0x9'),auth[_0xb984('0x6')](),controller[_0xb984('0xa')]);router[_0xb984('0x5')]('/:id/subjects',auth[_0xb984('0x6')](),controller[_0xb984('0xb')]);router[_0xb984('0x5')]('/:id/descriptions',auth[_0xb984('0x6')](),controller[_0xb984('0xc')]);router[_0xb984('0x5')](_0xb984('0xd'),auth[_0xb984('0x6')](),controller['getTags']);router[_0xb984('0xe')]('/',auth[_0xb984('0x6')](),controller[_0xb984('0xf')]);router[_0xb984('0xe')]('/:id/tags',auth[_0xb984('0x6')](),controller[_0xb984('0x10')]);router[_0xb984('0x11')](_0xb984('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xb984('0x13')](_0xb984('0x12'),auth[_0xb984('0x6')](),controller[_0xb984('0x14')]);module[_0xb984('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b452df8..a630caa 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 _0x694c=['STRING'];(function(_0x3da035,_0x2cc569){var _0x47dfe5=function(_0x597024){while(--_0x597024){_0x3da035['push'](_0x3da035['shift']());}};_0x47dfe5(++_0x2cc569);}(_0x694c,0x75));var _0xc694=function(_0x622cb7,_0x2196bf){_0x622cb7=_0x622cb7-0x0;var _0x4f9cdf=_0x694c[_0x622cb7];return _0x4f9cdf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc694('0x0')]},'description':{'type':Sequelize[_0xc694('0x0')]}}; \ No newline at end of file +var _0xcb16=['exports','STRING','sequelize'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xcb16,0x1a6));var _0x6cb1=function(_0x54b842,_0x46dc70){_0x54b842=_0x54b842-0x0;var _0xb931c6=_0xcb16[_0x54b842];return _0xb931c6;};'use strict';var Sequelize=require(_0x6cb1('0x0'));module[_0x6cb1('0x1')]={'name':{'type':Sequelize[_0x6cb1('0x2')]},'description':{'type':Sequelize[_0x6cb1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 805408e..dce175f 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 _0xff15=['findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','status','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','stack','name','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','nolimit'];(function(_0x505f50,_0x1f6978){var _0x235de6=function(_0x17d657){while(--_0x17d657){_0x505f50['push'](_0x505f50['shift']());}};_0x235de6(++_0x1f6978);}(_0xff15,0x121));var _0x5ff1=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0xff15[_0x1e06f1];return _0x34f77e;};'use strict';var pdf=require(_0x5ff1('0x0'));var emlformat=require(_0x5ff1('0x1'));var rimraf=require(_0x5ff1('0x2'));var zipdir=require(_0x5ff1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ff1('0x4'));var moment=require('moment');var BPromise=require(_0x5ff1('0x5'));var Mustache=require(_0x5ff1('0x6'));var util=require(_0x5ff1('0x7'));var path=require('path');var sox=require(_0x5ff1('0x8'));var csv=require('to-csv');var ejs=require(_0x5ff1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ff1('0xa'));var crypto=require(_0x5ff1('0xb'));var jsforce=require(_0x5ff1('0xc'));var deskjs=require(_0x5ff1('0xd'));var toCsv=require(_0x5ff1('0xe'));var querystring=require('querystring');var Papa=require(_0x5ff1('0xf'));var Redis=require(_0x5ff1('0x10'));var authService=require(_0x5ff1('0x11'));var qs=require(_0x5ff1('0x12'));var hardwareService=require(_0x5ff1('0x13'));var logger=require('../../config/logger')(_0x5ff1('0x14'));var utils=require(_0x5ff1('0x15'));var config=require(_0x5ff1('0x16'));var db=require(_0x5ff1('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5ff1('0x18')][_0x5ff1('0x19')]({'port':0x232a});function checkPasswordPattern(_0xa6db87,_0x1032ae,_0x873456){if(_0x873456){var _0x1fa951=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1fa951['test'](_0x1032ae)){return _0xa6db87;}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 _0xa6db87;}}function respondWithRpcPromise(_0x52d636,_0x4eeabb,_0x2f0fc4,_0x233320){return new BPromise(function(_0x75a1a,_0x3162c3){var _0x9166e1=_0x233320||client;return _0x9166e1[_0x5ff1('0x1a')](_0x52d636,_0x2f0fc4)['then'](function(_0x3367e5){logger[_0x5ff1('0x1b')]('DeskConfiguration,\x20%s,\x20%s',_0x4eeabb,_0x5ff1('0x1c'));logger[_0x5ff1('0x1d')](_0x5ff1('0x1e'),_0x4eeabb,'request\x20sent',JSON[_0x5ff1('0x1f')](_0x3367e5));if(_0x3367e5[_0x5ff1('0x20')]){if(_0x3367e5[_0x5ff1('0x20')][_0x5ff1('0x21')]===0x1f4){logger[_0x5ff1('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x4eeabb,_0x3367e5['error']['message']);return _0x3162c3(_0x3367e5[_0x5ff1('0x20')][_0x5ff1('0x22')]);}logger[_0x5ff1('0x20')](_0x5ff1('0x23'),_0x4eeabb,_0x3367e5['error']['message']);return _0x75a1a(_0x3367e5['error'][_0x5ff1('0x22')]);}else{logger[_0x5ff1('0x1b')](_0x5ff1('0x23'),_0x4eeabb,_0x5ff1('0x1c'));_0x75a1a(_0x3367e5[_0x5ff1('0x24')][_0x5ff1('0x22')]);}})['catch'](function(_0x214f12){logger[_0x5ff1('0x20')](_0x5ff1('0x23'),_0x4eeabb,_0x214f12);_0x3162c3(_0x214f12);});});}function respondWithStatusCode(_0x68bde0,_0xe6dc4b){_0xe6dc4b=_0xe6dc4b||0xcc;return function(_0x310285){if(_0x310285){return _0x68bde0['sendStatus'](_0xe6dc4b);}return _0x68bde0[_0x5ff1('0x25')](_0xe6dc4b)['end']();};}function respondWithResult(_0x4d66c0,_0x1d60c1){_0x1d60c1=_0x1d60c1||0xc8;return function(_0x372fbb){if(_0x372fbb){return _0x4d66c0[_0x5ff1('0x25')](_0x1d60c1)['json'](_0x372fbb);}};}function respondWithFilteredResult(_0x477163,_0x20e8c0){return function(_0x550372){if(_0x550372){var _0x1c4fb8=_0x550372[_0x5ff1('0x26')],_0x5ad0e5=_0x20e8c0[_0x5ff1('0x27')],_0x2bb3fa=_0x20e8c0[_0x5ff1('0x27')]+_0x20e8c0[_0x5ff1('0x28')],_0x425930;if(_0x2bb3fa>=_0x1c4fb8){_0x2bb3fa=_0x1c4fb8;_0x425930=0xc8;}else{_0x425930=0xce;}_0x477163[_0x5ff1('0x25')](_0x425930);return _0x477163[_0x5ff1('0x29')](_0x5ff1('0x2a'),_0x5ad0e5+'-'+_0x2bb3fa+'/'+_0x1c4fb8)['json'](_0x550372);}return null;};}function patchUpdates(_0x1c91b9){return function(_0x41205b){try{jsonpatch[_0x5ff1('0x2b')](_0x41205b,_0x1c91b9,!![]);}catch(_0x12ef8d){return BPromise[_0x5ff1('0x2c')](_0x12ef8d);}return _0x41205b['save']();};}function saveUpdates(_0x24afcd,_0x3f186b){return function(_0x2f2a88){if(_0x2f2a88){return _0x2f2a88[_0x5ff1('0x2d')](_0x24afcd)[_0x5ff1('0x2e')](function(_0x1c3fc0){return _0x1c3fc0;});}return null;};}function removeEntity(_0x1aa4da,_0x1920bc){return function(_0x46a026){if(_0x46a026){return _0x46a026[_0x5ff1('0x2f')]()[_0x5ff1('0x2e')](function(){_0x1aa4da[_0x5ff1('0x25')](0xcc)[_0x5ff1('0x30')]();});}};}function handleEntityNotFound(_0x21145f,_0x36fb65){return function(_0x3d6c4a){if(!_0x3d6c4a){_0x21145f[_0x5ff1('0x31')](0x194);}return _0x3d6c4a;};}function handleError(_0x2f609a,_0x20dc29){_0x20dc29=_0x20dc29||0x1f4;return function(_0x9d0cc5){logger['error'](_0x9d0cc5[_0x5ff1('0x32')]);if(_0x9d0cc5[_0x5ff1('0x33')]){delete _0x9d0cc5[_0x5ff1('0x33')];}_0x2f609a['status'](_0x20dc29)['send'](_0x9d0cc5);};}exports[_0x5ff1('0x34')]=function(_0x570087,_0x572808){var _0x19a7b2={},_0x2cd062={},_0x180d0d={'count':0x0,'rows':[]};var _0x5ed83a=db['DeskConfiguration'][_0x5ff1('0x35')];_0x2cd062[_0x5ff1('0x36')]=_[_0x5ff1('0x37')](_0x5ed83a);_0x2cd062[_0x5ff1('0x38')]=_[_0x5ff1('0x37')](_0x570087[_0x5ff1('0x38')]);_0x2cd062[_0x5ff1('0x39')]=_[_0x5ff1('0x3a')](_0x2cd062[_0x5ff1('0x36')],_0x2cd062[_0x5ff1('0x38')]);_0x19a7b2[_0x5ff1('0x3b')]=_[_0x5ff1('0x3a')](_0x2cd062[_0x5ff1('0x36')],qs[_0x5ff1('0x3c')](_0x570087[_0x5ff1('0x38')]['fields']));_0x19a7b2[_0x5ff1('0x3b')]=_0x19a7b2[_0x5ff1('0x3b')][_0x5ff1('0x3d')]?_0x19a7b2[_0x5ff1('0x3b')]:_0x2cd062[_0x5ff1('0x36')];if(!_0x570087[_0x5ff1('0x38')][_0x5ff1('0x3e')]('nolimit')){_0x19a7b2[_0x5ff1('0x28')]=qs['limit'](_0x570087['query']['limit']);_0x19a7b2[_0x5ff1('0x27')]=qs[_0x5ff1('0x27')](_0x570087[_0x5ff1('0x38')][_0x5ff1('0x27')]);}_0x19a7b2[_0x5ff1('0x3f')]=qs['sort'](_0x570087['query'][_0x5ff1('0x40')]);_0x19a7b2[_0x5ff1('0x41')]=qs[_0x5ff1('0x39')](_[_0x5ff1('0x42')](_0x570087[_0x5ff1('0x38')],_0x2cd062['filters']));if(_0x570087['query'][_0x5ff1('0x43')]){_0x19a7b2[_0x5ff1('0x41')]=_[_0x5ff1('0x44')](_0x19a7b2[_0x5ff1('0x41')],{'$or':_[_0x5ff1('0x45')](_0x5ed83a,function(_0x2064b3){if(_0x2064b3[_0x5ff1('0x46')]['key']!==_0x5ff1('0x47')){var _0x5f03e0={};_0x5f03e0[_0x2064b3[_0x5ff1('0x48')]]={'$like':'%'+_0x570087['query'][_0x5ff1('0x43')]+'%'};return _0x5f03e0;}})});}_0x19a7b2=_[_0x5ff1('0x44')]({},_0x19a7b2,_0x570087[_0x5ff1('0x49')]);var _0x154869={'where':_0x19a7b2['where']};return db[_0x5ff1('0x4a')][_0x5ff1('0x26')](_0x154869)['then'](function(_0x3bc3b2){_0x180d0d['count']=_0x3bc3b2;if(_0x570087['query'][_0x5ff1('0x4b')]){_0x19a7b2[_0x5ff1('0x4c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x5ff1('0x4d')](_0x19a7b2);})['then'](function(_0x5ed0e1){_0x180d0d[_0x5ff1('0x4e')]=_0x5ed0e1;return _0x180d0d;})[_0x5ff1('0x2e')](respondWithFilteredResult(_0x572808,_0x19a7b2))[_0x5ff1('0x4f')](handleError(_0x572808,null));};exports[_0x5ff1('0x50')]=function(_0x268525,_0x5156b5){var _0x3a9a7e={'raw':![],'where':{'id':_0x268525[_0x5ff1('0x51')]['id']}},_0x4bebb9={};_0x4bebb9[_0x5ff1('0x36')]=_['keys'](db[_0x5ff1('0x4a')][_0x5ff1('0x35')]);_0x4bebb9[_0x5ff1('0x38')]=_[_0x5ff1('0x37')](_0x268525[_0x5ff1('0x38')]);_0x4bebb9[_0x5ff1('0x39')]=_[_0x5ff1('0x3a')](_0x4bebb9[_0x5ff1('0x36')],_0x4bebb9[_0x5ff1('0x38')]);_0x3a9a7e['attributes']=_[_0x5ff1('0x3a')](_0x4bebb9[_0x5ff1('0x36')],qs[_0x5ff1('0x3c')](_0x268525[_0x5ff1('0x38')][_0x5ff1('0x3c')]));_0x3a9a7e['attributes']=_0x3a9a7e[_0x5ff1('0x3b')][_0x5ff1('0x3d')]?_0x3a9a7e[_0x5ff1('0x3b')]:_0x4bebb9[_0x5ff1('0x36')];if(_0x268525['query'][_0x5ff1('0x4b')]){_0x3a9a7e[_0x5ff1('0x4c')]=[{'all':!![]}];}_0x3a9a7e=_[_0x5ff1('0x44')]({},_0x3a9a7e,_0x268525[_0x5ff1('0x49')]);return db[_0x5ff1('0x4a')]['find'](_0x3a9a7e)[_0x5ff1('0x2e')](handleEntityNotFound(_0x5156b5,null))[_0x5ff1('0x2e')](respondWithResult(_0x5156b5,null))[_0x5ff1('0x4f')](handleError(_0x5156b5,null));};exports[_0x5ff1('0x52')]=function(_0x342ce7,_0x1b3282){return db[_0x5ff1('0x4a')][_0x5ff1('0x52')](_0x342ce7[_0x5ff1('0x53')],{})[_0x5ff1('0x2e')](respondWithResult(_0x1b3282,0xc9))[_0x5ff1('0x4f')](handleError(_0x1b3282,null));};exports[_0x5ff1('0x2d')]=function(_0x56d993,_0x3754a9){if(_0x56d993[_0x5ff1('0x53')]['id']){delete _0x56d993['body']['id'];}return db[_0x5ff1('0x4a')]['find']({'where':{'id':_0x56d993[_0x5ff1('0x51')]['id']}})[_0x5ff1('0x2e')](handleEntityNotFound(_0x3754a9,null))['then'](saveUpdates(_0x56d993['body'],null))[_0x5ff1('0x2e')](respondWithResult(_0x3754a9,null))[_0x5ff1('0x4f')](handleError(_0x3754a9,null));};exports[_0x5ff1('0x2f')]=function(_0x218546,_0x52c16c){return db[_0x5ff1('0x4a')][_0x5ff1('0x54')]({'where':{'id':_0x218546[_0x5ff1('0x51')]['id']}})[_0x5ff1('0x2e')](handleEntityNotFound(_0x52c16c,null))['then'](removeEntity(_0x52c16c,null))[_0x5ff1('0x4f')](handleError(_0x52c16c,null));};exports['getFields']=function(_0x532beb,_0x5b9483,_0x3c2a58){var _0x225202={};var _0x2401fc={};var _0x2570d1;var _0x334ac6;return db[_0x5ff1('0x4a')]['findOne']({'where':{'id':_0x532beb['params']['id']}})[_0x5ff1('0x2e')](handleEntityNotFound(_0x5b9483,null))['then'](function(_0x3f10cc){if(_0x3f10cc){_0x2570d1=_0x3f10cc;_0x2401fc[_0x5ff1('0x36')]=_['keys'](db['DeskField'][_0x5ff1('0x35')]);_0x2401fc[_0x5ff1('0x38')]=_[_0x5ff1('0x37')](_0x532beb[_0x5ff1('0x38')]);_0x2401fc['filters']=_['intersection'](_0x2401fc[_0x5ff1('0x36')],_0x2401fc[_0x5ff1('0x38')]);_0x225202[_0x5ff1('0x3b')]=_[_0x5ff1('0x3a')](_0x2401fc[_0x5ff1('0x36')],qs[_0x5ff1('0x3c')](_0x532beb[_0x5ff1('0x38')][_0x5ff1('0x3c')]));_0x225202[_0x5ff1('0x3b')]=_0x225202['attributes']['length']?_0x225202['attributes']:_0x2401fc[_0x5ff1('0x36')];_0x225202['order']=qs[_0x5ff1('0x40')](_0x532beb[_0x5ff1('0x38')]['sort']);_0x225202[_0x5ff1('0x41')]=qs[_0x5ff1('0x39')](_[_0x5ff1('0x42')](_0x532beb[_0x5ff1('0x38')],_0x2401fc['filters']));if(_0x532beb['query'][_0x5ff1('0x43')]){_0x225202[_0x5ff1('0x41')]=_[_0x5ff1('0x44')](_0x225202['where'],{'$or':_[_0x5ff1('0x45')](_0x225202[_0x5ff1('0x3b')],function(_0x3c1bf4){var _0x24afaf={};_0x24afaf[_0x3c1bf4]={'$like':'%'+_0x532beb['query'][_0x5ff1('0x43')]+'%'};return _0x24afaf;})});}_0x225202=_[_0x5ff1('0x44')]({},_0x225202,_0x532beb[_0x5ff1('0x49')]);return _0x2570d1[_0x5ff1('0x55')](_0x225202);}})[_0x5ff1('0x2e')](function(_0x38284a){if(_0x38284a){_0x334ac6=_0x38284a['length'];if(!_0x532beb['query'][_0x5ff1('0x3e')](_0x5ff1('0x56'))){_0x225202['limit']=qs[_0x5ff1('0x28')](_0x532beb[_0x5ff1('0x38')]['limit']);_0x225202[_0x5ff1('0x27')]=qs[_0x5ff1('0x27')](_0x532beb[_0x5ff1('0x38')][_0x5ff1('0x27')]);}return _0x2570d1[_0x5ff1('0x55')](_0x225202);}})[_0x5ff1('0x2e')](function(_0x957446){if(_0x957446){return _0x957446?{'count':_0x334ac6,'rows':_0x957446}:null;}})[_0x5ff1('0x2e')](respondWithResult(_0x5b9483,null))[_0x5ff1('0x4f')](handleError(_0x5b9483,null));};exports['getSubjects']=function(_0x2a9756,_0x44b9ba,_0x410ec9){var _0x439402={};var _0x4d0042={};var _0xb7feac;var _0x20205d;return db[_0x5ff1('0x4a')][_0x5ff1('0x57')]({'where':{'id':_0x2a9756[_0x5ff1('0x51')]['id']}})[_0x5ff1('0x2e')](handleEntityNotFound(_0x44b9ba,null))[_0x5ff1('0x2e')](function(_0x24a8ec){if(_0x24a8ec){_0xb7feac=_0x24a8ec;_0x4d0042[_0x5ff1('0x36')]=_[_0x5ff1('0x37')](db[_0x5ff1('0x58')][_0x5ff1('0x35')]);_0x4d0042[_0x5ff1('0x38')]=_[_0x5ff1('0x37')](_0x2a9756[_0x5ff1('0x38')]);_0x4d0042[_0x5ff1('0x39')]=_[_0x5ff1('0x3a')](_0x4d0042['model'],_0x4d0042[_0x5ff1('0x38')]);_0x439402[_0x5ff1('0x3b')]=_['intersection'](_0x4d0042[_0x5ff1('0x36')],qs[_0x5ff1('0x3c')](_0x2a9756[_0x5ff1('0x38')][_0x5ff1('0x3c')]));_0x439402[_0x5ff1('0x3b')]=_0x439402['attributes'][_0x5ff1('0x3d')]?_0x439402[_0x5ff1('0x3b')]:_0x4d0042[_0x5ff1('0x36')];_0x439402[_0x5ff1('0x3f')]=qs[_0x5ff1('0x40')](_0x2a9756['query'][_0x5ff1('0x40')]);_0x439402[_0x5ff1('0x41')]=qs[_0x5ff1('0x39')](_[_0x5ff1('0x42')](_0x2a9756[_0x5ff1('0x38')],_0x4d0042[_0x5ff1('0x39')]));if(_0x2a9756[_0x5ff1('0x38')][_0x5ff1('0x43')]){_0x439402[_0x5ff1('0x41')]=_[_0x5ff1('0x44')](_0x439402['where'],{'$or':_[_0x5ff1('0x45')](_0x439402[_0x5ff1('0x3b')],function(_0x2ca1ae){var _0x41767d={};_0x41767d[_0x2ca1ae]={'$like':'%'+_0x2a9756[_0x5ff1('0x38')]['filter']+'%'};return _0x41767d;})});}_0x439402=_[_0x5ff1('0x44')]({},_0x439402,_0x2a9756[_0x5ff1('0x49')]);return _0xb7feac[_0x5ff1('0x59')](_0x439402);}})[_0x5ff1('0x2e')](function(_0x280582){if(_0x280582){_0x20205d=_0x280582['length'];if(!_0x2a9756[_0x5ff1('0x38')][_0x5ff1('0x3e')](_0x5ff1('0x56'))){_0x439402[_0x5ff1('0x28')]=qs[_0x5ff1('0x28')](_0x2a9756[_0x5ff1('0x38')][_0x5ff1('0x28')]);_0x439402[_0x5ff1('0x27')]=qs['offset'](_0x2a9756[_0x5ff1('0x38')][_0x5ff1('0x27')]);}return _0xb7feac[_0x5ff1('0x59')](_0x439402);}})[_0x5ff1('0x2e')](function(_0x3ceed5){if(_0x3ceed5){return _0x3ceed5?{'count':_0x20205d,'rows':_0x3ceed5}:null;}})[_0x5ff1('0x2e')](respondWithResult(_0x44b9ba,null))[_0x5ff1('0x4f')](handleError(_0x44b9ba,null));};exports[_0x5ff1('0x5a')]=function(_0x431125,_0x86891b,_0x33d891){var _0x1a21a0={};var _0x3ee463={};var _0xfc8ac6;var _0x39f627;return db[_0x5ff1('0x4a')][_0x5ff1('0x57')]({'where':{'id':_0x431125[_0x5ff1('0x51')]['id']}})[_0x5ff1('0x2e')](handleEntityNotFound(_0x86891b,null))[_0x5ff1('0x2e')](function(_0x865446){if(_0x865446){_0xfc8ac6=_0x865446;_0x3ee463[_0x5ff1('0x36')]=_[_0x5ff1('0x37')](db[_0x5ff1('0x58')][_0x5ff1('0x35')]);_0x3ee463[_0x5ff1('0x38')]=_[_0x5ff1('0x37')](_0x431125[_0x5ff1('0x38')]);_0x3ee463[_0x5ff1('0x39')]=_[_0x5ff1('0x3a')](_0x3ee463[_0x5ff1('0x36')],_0x3ee463[_0x5ff1('0x38')]);_0x1a21a0[_0x5ff1('0x3b')]=_[_0x5ff1('0x3a')](_0x3ee463['model'],qs['fields'](_0x431125[_0x5ff1('0x38')][_0x5ff1('0x3c')]));_0x1a21a0['attributes']=_0x1a21a0[_0x5ff1('0x3b')][_0x5ff1('0x3d')]?_0x1a21a0['attributes']:_0x3ee463[_0x5ff1('0x36')];_0x1a21a0[_0x5ff1('0x3f')]=qs[_0x5ff1('0x40')](_0x431125[_0x5ff1('0x38')]['sort']);_0x1a21a0[_0x5ff1('0x41')]=qs[_0x5ff1('0x39')](_['pick'](_0x431125[_0x5ff1('0x38')],_0x3ee463[_0x5ff1('0x39')]));if(_0x431125[_0x5ff1('0x38')][_0x5ff1('0x43')]){_0x1a21a0[_0x5ff1('0x41')]=_[_0x5ff1('0x44')](_0x1a21a0[_0x5ff1('0x41')],{'$or':_['map'](_0x1a21a0[_0x5ff1('0x3b')],function(_0x452d37){var _0x1618a4={};_0x1618a4[_0x452d37]={'$like':'%'+_0x431125['query'][_0x5ff1('0x43')]+'%'};return _0x1618a4;})});}_0x1a21a0=_[_0x5ff1('0x44')]({},_0x1a21a0,_0x431125[_0x5ff1('0x49')]);return _0xfc8ac6['getDescriptions'](_0x1a21a0);}})[_0x5ff1('0x2e')](function(_0x53ae27){if(_0x53ae27){_0x39f627=_0x53ae27[_0x5ff1('0x3d')];if(!_0x431125[_0x5ff1('0x38')]['hasOwnProperty'](_0x5ff1('0x56'))){_0x1a21a0[_0x5ff1('0x28')]=qs[_0x5ff1('0x28')](_0x431125['query'][_0x5ff1('0x28')]);_0x1a21a0[_0x5ff1('0x27')]=qs['offset'](_0x431125[_0x5ff1('0x38')][_0x5ff1('0x27')]);}return _0xfc8ac6['getDescriptions'](_0x1a21a0);}})[_0x5ff1('0x2e')](function(_0x31f010){if(_0x31f010){return _0x31f010?{'count':_0x39f627,'rows':_0x31f010}:null;}})[_0x5ff1('0x2e')](respondWithResult(_0x86891b,null))['catch'](handleError(_0x86891b,null));};exports[_0x5ff1('0x5b')]=function(_0x131375,_0x3e41a8,_0x53da34){var _0x7e3446={};var _0x283cc9={};var _0x4e70fd;var _0x3ec052;return db[_0x5ff1('0x4a')][_0x5ff1('0x57')]({'where':{'id':_0x131375[_0x5ff1('0x51')]['id']}})['then'](handleEntityNotFound(_0x3e41a8,null))[_0x5ff1('0x2e')](function(_0x5acde2){if(_0x5acde2){_0x4e70fd=_0x5acde2;_0x283cc9[_0x5ff1('0x36')]=_['keys'](db[_0x5ff1('0x5c')][_0x5ff1('0x35')]);_0x283cc9[_0x5ff1('0x38')]=_[_0x5ff1('0x37')](_0x131375[_0x5ff1('0x38')]);_0x283cc9[_0x5ff1('0x39')]=_['intersection'](_0x283cc9[_0x5ff1('0x36')],_0x283cc9['query']);_0x7e3446[_0x5ff1('0x3b')]=_[_0x5ff1('0x3a')](_0x283cc9['model'],qs[_0x5ff1('0x3c')](_0x131375['query'][_0x5ff1('0x3c')]));_0x7e3446[_0x5ff1('0x3b')]=_0x7e3446['attributes']['length']?_0x7e3446[_0x5ff1('0x3b')]:_0x283cc9[_0x5ff1('0x36')];_0x7e3446[_0x5ff1('0x3f')]=qs['sort'](_0x131375['query'][_0x5ff1('0x40')]);_0x7e3446[_0x5ff1('0x41')]=qs[_0x5ff1('0x39')](_[_0x5ff1('0x42')](_0x131375[_0x5ff1('0x38')],_0x283cc9[_0x5ff1('0x39')]));if(_0x131375[_0x5ff1('0x38')][_0x5ff1('0x43')]){_0x7e3446[_0x5ff1('0x41')]=_['merge'](_0x7e3446[_0x5ff1('0x41')],{'$or':_[_0x5ff1('0x45')](_0x7e3446[_0x5ff1('0x3b')],function(_0x8867e0){var _0x12444f={};_0x12444f[_0x8867e0]={'$like':'%'+_0x131375[_0x5ff1('0x38')][_0x5ff1('0x43')]+'%'};return _0x12444f;})});}_0x7e3446=_[_0x5ff1('0x44')]({},_0x7e3446,_0x131375['options']);return _0x4e70fd['getTags'](_0x7e3446);}})[_0x5ff1('0x2e')](function(_0x42dc4d){if(_0x42dc4d){_0x3ec052=_0x42dc4d['length'];if(!_0x131375[_0x5ff1('0x38')]['hasOwnProperty'](_0x5ff1('0x56'))){_0x7e3446[_0x5ff1('0x28')]=qs[_0x5ff1('0x28')](_0x131375[_0x5ff1('0x38')][_0x5ff1('0x28')]);_0x7e3446['offset']=qs[_0x5ff1('0x27')](_0x131375[_0x5ff1('0x38')]['offset']);}return _0x4e70fd[_0x5ff1('0x5b')](_0x7e3446);}})[_0x5ff1('0x2e')](function(_0x5610cd){if(_0x5610cd){return _0x5610cd?{'count':_0x3ec052,'rows':_0x5610cd}:null;}})[_0x5ff1('0x2e')](respondWithResult(_0x3e41a8,null))['catch'](handleError(_0x3e41a8,null));};exports[_0x5ff1('0x5d')]=function(_0x3edd11,_0x2439b9,_0x3869db){if(_0x3edd11[_0x5ff1('0x53')]['id']){delete _0x3edd11[_0x5ff1('0x53')]['id'];}return db[_0x5ff1('0x4a')][_0x5ff1('0x57')]({'where':{'id':_0x3edd11[_0x5ff1('0x51')]['id']}})[_0x5ff1('0x2e')](handleEntityNotFound(_0x2439b9,null))[_0x5ff1('0x2e')](function(_0x191236){if(_0x191236){return _0x191236[_0x5ff1('0x5d')](_0x3edd11[_0x5ff1('0x53')]['ids']||[]);}return null;})[_0x5ff1('0x2e')](respondWithResult(_0x2439b9,null))[_0x5ff1('0x4f')](handleError(_0x2439b9,null));}; \ No newline at end of file +var _0x5d66=['../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','save','destroy','stack','name','send','index','DeskConfiguration','rawAttributes','keys','filters','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x5d66,0x109));var _0x65d6=function(_0x309bd3,_0xf11669){_0x309bd3=_0x309bd3-0x0;var _0x4681b5=_0x5d66[_0x309bd3];return _0x4681b5;};'use strict';var pdf=require(_0x65d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65d6('0x1'));var zipdir=require(_0x65d6('0x2'));var jsonpatch=require(_0x65d6('0x3'));var rp=require(_0x65d6('0x4'));var moment=require(_0x65d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x65d6('0x6'));var util=require(_0x65d6('0x7'));var path=require(_0x65d6('0x8'));var sox=require(_0x65d6('0x9'));var csv=require(_0x65d6('0xa'));var ejs=require(_0x65d6('0xb'));var fs=require('fs');var _=require(_0x65d6('0xc'));var squel=require(_0x65d6('0xd'));var crypto=require(_0x65d6('0xe'));var jsforce=require(_0x65d6('0xf'));var deskjs=require(_0x65d6('0x10'));var toCsv=require(_0x65d6('0xa'));var querystring=require(_0x65d6('0x11'));var Papa=require(_0x65d6('0x12'));var Redis=require(_0x65d6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x65d6('0x14'));var logger=require(_0x65d6('0x15'))(_0x65d6('0x16'));var utils=require('../../config/utils');var config=require(_0x65d6('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x65d6('0x18'));var client=jayson['client'][_0x65d6('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3fefec,_0x3a45cc,_0x2430f2){if(_0x2430f2){var _0x10ee08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10ee08[_0x65d6('0x1a')](_0x3a45cc)){return _0x3fefec;}else{throw new Error(_0x65d6('0x1b'));}}else{return _0x3fefec;}}function respondWithRpcPromise(_0x164fd8,_0x2a4dc9,_0x39a269,_0x1647c4){return new BPromise(function(_0x1ef91b,_0x30142b){var _0x2f6cc9=_0x1647c4||client;return _0x2f6cc9[_0x65d6('0x1c')](_0x164fd8,_0x39a269)[_0x65d6('0x1d')](function(_0x8bb27f){logger[_0x65d6('0x1e')](_0x65d6('0x1f'),_0x2a4dc9,_0x65d6('0x20'));logger[_0x65d6('0x21')](_0x65d6('0x22'),_0x2a4dc9,_0x65d6('0x20'),JSON[_0x65d6('0x23')](_0x8bb27f));if(_0x8bb27f[_0x65d6('0x24')]){if(_0x8bb27f[_0x65d6('0x24')]['code']===0x1f4){logger[_0x65d6('0x24')](_0x65d6('0x1f'),_0x2a4dc9,_0x8bb27f[_0x65d6('0x24')]['message']);return _0x30142b(_0x8bb27f[_0x65d6('0x24')][_0x65d6('0x25')]);}logger[_0x65d6('0x24')](_0x65d6('0x1f'),_0x2a4dc9,_0x8bb27f[_0x65d6('0x24')][_0x65d6('0x25')]);return _0x1ef91b(_0x8bb27f[_0x65d6('0x24')]['message']);}else{logger[_0x65d6('0x1e')](_0x65d6('0x1f'),_0x2a4dc9,'request\x20sent');_0x1ef91b(_0x8bb27f[_0x65d6('0x26')][_0x65d6('0x25')]);}})[_0x65d6('0x27')](function(_0xec4fd1){logger[_0x65d6('0x24')](_0x65d6('0x1f'),_0x2a4dc9,_0xec4fd1);_0x30142b(_0xec4fd1);});});}function respondWithStatusCode(_0x28d9ea,_0x36b53f){_0x36b53f=_0x36b53f||0xcc;return function(_0x265af2){if(_0x265af2){return _0x28d9ea[_0x65d6('0x28')](_0x36b53f);}return _0x28d9ea[_0x65d6('0x29')](_0x36b53f)[_0x65d6('0x2a')]();};}function respondWithResult(_0x21ca70,_0x59a334){_0x59a334=_0x59a334||0xc8;return function(_0x51d86d){if(_0x51d86d){return _0x21ca70['status'](_0x59a334)['json'](_0x51d86d);}};}function respondWithFilteredResult(_0x3e3795,_0x5c4b34){return function(_0x3263fa){if(_0x3263fa){var _0x4511ac=_0x3263fa[_0x65d6('0x2b')],_0x49f207=_0x5c4b34[_0x65d6('0x2c')],_0x56f036=_0x5c4b34[_0x65d6('0x2c')]+_0x5c4b34['limit'],_0x187dca;if(_0x56f036>=_0x4511ac){_0x56f036=_0x4511ac;_0x187dca=0xc8;}else{_0x187dca=0xce;}_0x3e3795['status'](_0x187dca);return _0x3e3795['set'](_0x65d6('0x2d'),_0x49f207+'-'+_0x56f036+'/'+_0x4511ac)[_0x65d6('0x2e')](_0x3263fa);}return null;};}function patchUpdates(_0x231b53){return function(_0x448814){try{jsonpatch['apply'](_0x448814,_0x231b53,!![]);}catch(_0x931543){return BPromise['reject'](_0x931543);}return _0x448814[_0x65d6('0x2f')]();};}function saveUpdates(_0x182c6e,_0x83e2b4){return function(_0x4b262f){if(_0x4b262f){return _0x4b262f['update'](_0x182c6e)[_0x65d6('0x1d')](function(_0x3bafde){return _0x3bafde;});}return null;};}function removeEntity(_0x1b1e26,_0x103f20){return function(_0x25f40d){if(_0x25f40d){return _0x25f40d[_0x65d6('0x30')]()[_0x65d6('0x1d')](function(){_0x1b1e26[_0x65d6('0x29')](0xcc)[_0x65d6('0x2a')]();});}};}function handleEntityNotFound(_0x3edf5f,_0x4f4d01){return function(_0x1b3fac){if(!_0x1b3fac){_0x3edf5f[_0x65d6('0x28')](0x194);}return _0x1b3fac;};}function handleError(_0x4c451f,_0x235f51){_0x235f51=_0x235f51||0x1f4;return function(_0x51443e){logger[_0x65d6('0x24')](_0x51443e[_0x65d6('0x31')]);if(_0x51443e[_0x65d6('0x32')]){delete _0x51443e['name'];}_0x4c451f[_0x65d6('0x29')](_0x235f51)[_0x65d6('0x33')](_0x51443e);};}exports[_0x65d6('0x34')]=function(_0x4ab7b0,_0xa59276){var _0x582789={},_0x29923b={},_0x5c650a={'count':0x0,'rows':[]};var _0x1739d4=db[_0x65d6('0x35')][_0x65d6('0x36')];_0x29923b['model']=_[_0x65d6('0x37')](_0x1739d4);_0x29923b['query']=_[_0x65d6('0x37')](_0x4ab7b0['query']);_0x29923b[_0x65d6('0x38')]=_[_0x65d6('0x39')](_0x29923b['model'],_0x29923b['query']);_0x582789[_0x65d6('0x3a')]=_['intersection'](_0x29923b[_0x65d6('0x3b')],qs[_0x65d6('0x3c')](_0x4ab7b0[_0x65d6('0x3d')]['fields']));_0x582789[_0x65d6('0x3a')]=_0x582789['attributes'][_0x65d6('0x3e')]?_0x582789[_0x65d6('0x3a')]:_0x29923b[_0x65d6('0x3b')];if(!_0x4ab7b0['query'][_0x65d6('0x3f')](_0x65d6('0x40'))){_0x582789[_0x65d6('0x41')]=qs[_0x65d6('0x41')](_0x4ab7b0[_0x65d6('0x3d')][_0x65d6('0x41')]);_0x582789['offset']=qs[_0x65d6('0x2c')](_0x4ab7b0[_0x65d6('0x3d')][_0x65d6('0x2c')]);}_0x582789[_0x65d6('0x42')]=qs[_0x65d6('0x43')](_0x4ab7b0[_0x65d6('0x3d')][_0x65d6('0x43')]);_0x582789[_0x65d6('0x44')]=qs['filters'](_[_0x65d6('0x45')](_0x4ab7b0[_0x65d6('0x3d')],_0x29923b[_0x65d6('0x38')]));if(_0x4ab7b0['query'][_0x65d6('0x46')]){_0x582789[_0x65d6('0x44')]=_[_0x65d6('0x47')](_0x582789[_0x65d6('0x44')],{'$or':_[_0x65d6('0x48')](_0x1739d4,function(_0x1eee45){if(_0x1eee45[_0x65d6('0x49')][_0x65d6('0x4a')]!==_0x65d6('0x4b')){var _0x5120d1={};_0x5120d1[_0x1eee45[_0x65d6('0x4c')]]={'$like':'%'+_0x4ab7b0[_0x65d6('0x3d')][_0x65d6('0x46')]+'%'};return _0x5120d1;}})});}_0x582789=_[_0x65d6('0x47')]({},_0x582789,_0x4ab7b0[_0x65d6('0x4d')]);var _0x43a12c={'where':_0x582789[_0x65d6('0x44')]};return db['DeskConfiguration'][_0x65d6('0x2b')](_0x43a12c)[_0x65d6('0x1d')](function(_0x8d4a40){_0x5c650a[_0x65d6('0x2b')]=_0x8d4a40;if(_0x4ab7b0[_0x65d6('0x3d')][_0x65d6('0x4e')]){_0x582789[_0x65d6('0x4f')]=[{'all':!![]}];}return db[_0x65d6('0x35')][_0x65d6('0x50')](_0x582789);})[_0x65d6('0x1d')](function(_0x515c14){_0x5c650a[_0x65d6('0x51')]=_0x515c14;return _0x5c650a;})[_0x65d6('0x1d')](respondWithFilteredResult(_0xa59276,_0x582789))[_0x65d6('0x27')](handleError(_0xa59276,null));};exports[_0x65d6('0x52')]=function(_0xa7c075,_0x5f15d1){var _0x5a4b1f={'raw':![],'where':{'id':_0xa7c075[_0x65d6('0x53')]['id']}},_0x1f6071={};_0x1f6071[_0x65d6('0x3b')]=_[_0x65d6('0x37')](db[_0x65d6('0x35')]['rawAttributes']);_0x1f6071[_0x65d6('0x3d')]=_[_0x65d6('0x37')](_0xa7c075[_0x65d6('0x3d')]);_0x1f6071['filters']=_[_0x65d6('0x39')](_0x1f6071[_0x65d6('0x3b')],_0x1f6071[_0x65d6('0x3d')]);_0x5a4b1f[_0x65d6('0x3a')]=_[_0x65d6('0x39')](_0x1f6071[_0x65d6('0x3b')],qs['fields'](_0xa7c075[_0x65d6('0x3d')][_0x65d6('0x3c')]));_0x5a4b1f[_0x65d6('0x3a')]=_0x5a4b1f[_0x65d6('0x3a')]['length']?_0x5a4b1f[_0x65d6('0x3a')]:_0x1f6071[_0x65d6('0x3b')];if(_0xa7c075['query'][_0x65d6('0x4e')]){_0x5a4b1f[_0x65d6('0x4f')]=[{'all':!![]}];}_0x5a4b1f=_[_0x65d6('0x47')]({},_0x5a4b1f,_0xa7c075[_0x65d6('0x4d')]);return db[_0x65d6('0x35')][_0x65d6('0x54')](_0x5a4b1f)[_0x65d6('0x1d')](handleEntityNotFound(_0x5f15d1,null))['then'](respondWithResult(_0x5f15d1,null))[_0x65d6('0x27')](handleError(_0x5f15d1,null));};exports[_0x65d6('0x55')]=function(_0x5174b4,_0x52f67c){return db['DeskConfiguration'][_0x65d6('0x55')](_0x5174b4[_0x65d6('0x56')],{})[_0x65d6('0x1d')](respondWithResult(_0x52f67c,0xc9))[_0x65d6('0x27')](handleError(_0x52f67c,null));};exports['update']=function(_0x486f14,_0x407b1d){if(_0x486f14[_0x65d6('0x56')]['id']){delete _0x486f14['body']['id'];}return db[_0x65d6('0x35')][_0x65d6('0x54')]({'where':{'id':_0x486f14['params']['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x407b1d,null))[_0x65d6('0x1d')](saveUpdates(_0x486f14[_0x65d6('0x56')],null))[_0x65d6('0x1d')](respondWithResult(_0x407b1d,null))['catch'](handleError(_0x407b1d,null));};exports[_0x65d6('0x30')]=function(_0x2a99ea,_0x4c32a4){return db['DeskConfiguration']['find']({'where':{'id':_0x2a99ea[_0x65d6('0x53')]['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x4c32a4,null))['then'](removeEntity(_0x4c32a4,null))[_0x65d6('0x27')](handleError(_0x4c32a4,null));};exports['getFields']=function(_0x4053d0,_0x11daa0,_0x1006f5){var _0x519e98={};var _0x45874a={};var _0x555e1f;var _0x425a74;return db['DeskConfiguration'][_0x65d6('0x57')]({'where':{'id':_0x4053d0['params']['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x11daa0,null))[_0x65d6('0x1d')](function(_0x42e82b){if(_0x42e82b){_0x555e1f=_0x42e82b;_0x45874a[_0x65d6('0x3b')]=_[_0x65d6('0x37')](db[_0x65d6('0x58')][_0x65d6('0x36')]);_0x45874a[_0x65d6('0x3d')]=_[_0x65d6('0x37')](_0x4053d0[_0x65d6('0x3d')]);_0x45874a[_0x65d6('0x38')]=_[_0x65d6('0x39')](_0x45874a[_0x65d6('0x3b')],_0x45874a['query']);_0x519e98['attributes']=_[_0x65d6('0x39')](_0x45874a[_0x65d6('0x3b')],qs[_0x65d6('0x3c')](_0x4053d0['query'][_0x65d6('0x3c')]));_0x519e98[_0x65d6('0x3a')]=_0x519e98[_0x65d6('0x3a')]['length']?_0x519e98[_0x65d6('0x3a')]:_0x45874a['model'];_0x519e98['order']=qs[_0x65d6('0x43')](_0x4053d0[_0x65d6('0x3d')][_0x65d6('0x43')]);_0x519e98[_0x65d6('0x44')]=qs['filters'](_[_0x65d6('0x45')](_0x4053d0[_0x65d6('0x3d')],_0x45874a[_0x65d6('0x38')]));if(_0x4053d0[_0x65d6('0x3d')][_0x65d6('0x46')]){_0x519e98[_0x65d6('0x44')]=_[_0x65d6('0x47')](_0x519e98[_0x65d6('0x44')],{'$or':_[_0x65d6('0x48')](_0x519e98[_0x65d6('0x3a')],function(_0x6d5d7){var _0x53aa74={};_0x53aa74[_0x6d5d7]={'$like':'%'+_0x4053d0[_0x65d6('0x3d')][_0x65d6('0x46')]+'%'};return _0x53aa74;})});}_0x519e98=_['merge']({},_0x519e98,_0x4053d0[_0x65d6('0x4d')]);return _0x555e1f['getFields'](_0x519e98);}})[_0x65d6('0x1d')](function(_0x1b2aae){if(_0x1b2aae){_0x425a74=_0x1b2aae['length'];if(!_0x4053d0[_0x65d6('0x3d')][_0x65d6('0x3f')]('nolimit')){_0x519e98[_0x65d6('0x41')]=qs['limit'](_0x4053d0[_0x65d6('0x3d')][_0x65d6('0x41')]);_0x519e98[_0x65d6('0x2c')]=qs['offset'](_0x4053d0[_0x65d6('0x3d')]['offset']);}return _0x555e1f[_0x65d6('0x59')](_0x519e98);}})[_0x65d6('0x1d')](function(_0x3c114e){if(_0x3c114e){return _0x3c114e?{'count':_0x425a74,'rows':_0x3c114e}:null;}})[_0x65d6('0x1d')](respondWithResult(_0x11daa0,null))[_0x65d6('0x27')](handleError(_0x11daa0,null));};exports[_0x65d6('0x5a')]=function(_0x13dd51,_0xf5f4c6,_0x3a575b){var _0x4e74b2={};var _0x3a29e9={};var _0x30a455;var _0x66e02e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x13dd51[_0x65d6('0x53')]['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0xf5f4c6,null))[_0x65d6('0x1d')](function(_0x407136){if(_0x407136){_0x30a455=_0x407136;_0x3a29e9[_0x65d6('0x3b')]=_[_0x65d6('0x37')](db[_0x65d6('0x58')][_0x65d6('0x36')]);_0x3a29e9[_0x65d6('0x3d')]=_[_0x65d6('0x37')](_0x13dd51[_0x65d6('0x3d')]);_0x3a29e9['filters']=_[_0x65d6('0x39')](_0x3a29e9[_0x65d6('0x3b')],_0x3a29e9[_0x65d6('0x3d')]);_0x4e74b2[_0x65d6('0x3a')]=_[_0x65d6('0x39')](_0x3a29e9[_0x65d6('0x3b')],qs['fields'](_0x13dd51[_0x65d6('0x3d')][_0x65d6('0x3c')]));_0x4e74b2[_0x65d6('0x3a')]=_0x4e74b2[_0x65d6('0x3a')][_0x65d6('0x3e')]?_0x4e74b2[_0x65d6('0x3a')]:_0x3a29e9[_0x65d6('0x3b')];_0x4e74b2[_0x65d6('0x42')]=qs[_0x65d6('0x43')](_0x13dd51['query'][_0x65d6('0x43')]);_0x4e74b2[_0x65d6('0x44')]=qs[_0x65d6('0x38')](_[_0x65d6('0x45')](_0x13dd51[_0x65d6('0x3d')],_0x3a29e9[_0x65d6('0x38')]));if(_0x13dd51[_0x65d6('0x3d')][_0x65d6('0x46')]){_0x4e74b2['where']=_[_0x65d6('0x47')](_0x4e74b2['where'],{'$or':_[_0x65d6('0x48')](_0x4e74b2['attributes'],function(_0x49ef29){var _0x3f87be={};_0x3f87be[_0x49ef29]={'$like':'%'+_0x13dd51[_0x65d6('0x3d')][_0x65d6('0x46')]+'%'};return _0x3f87be;})});}_0x4e74b2=_[_0x65d6('0x47')]({},_0x4e74b2,_0x13dd51[_0x65d6('0x4d')]);return _0x30a455[_0x65d6('0x5a')](_0x4e74b2);}})[_0x65d6('0x1d')](function(_0x107495){if(_0x107495){_0x66e02e=_0x107495[_0x65d6('0x3e')];if(!_0x13dd51[_0x65d6('0x3d')][_0x65d6('0x3f')](_0x65d6('0x40'))){_0x4e74b2[_0x65d6('0x41')]=qs[_0x65d6('0x41')](_0x13dd51['query'][_0x65d6('0x41')]);_0x4e74b2['offset']=qs[_0x65d6('0x2c')](_0x13dd51['query'][_0x65d6('0x2c')]);}return _0x30a455[_0x65d6('0x5a')](_0x4e74b2);}})[_0x65d6('0x1d')](function(_0x33924d){if(_0x33924d){return _0x33924d?{'count':_0x66e02e,'rows':_0x33924d}:null;}})[_0x65d6('0x1d')](respondWithResult(_0xf5f4c6,null))['catch'](handleError(_0xf5f4c6,null));};exports[_0x65d6('0x5b')]=function(_0x12aa36,_0x2ba1ee,_0xf50553){var _0x8a4ceb={};var _0x3d65db={};var _0x2272ce;var _0x225ed7;return db['DeskConfiguration'][_0x65d6('0x57')]({'where':{'id':_0x12aa36['params']['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x2ba1ee,null))['then'](function(_0x70a7fc){if(_0x70a7fc){_0x2272ce=_0x70a7fc;_0x3d65db[_0x65d6('0x3b')]=_[_0x65d6('0x37')](db['DeskField']['rawAttributes']);_0x3d65db[_0x65d6('0x3d')]=_[_0x65d6('0x37')](_0x12aa36[_0x65d6('0x3d')]);_0x3d65db[_0x65d6('0x38')]=_[_0x65d6('0x39')](_0x3d65db[_0x65d6('0x3b')],_0x3d65db[_0x65d6('0x3d')]);_0x8a4ceb[_0x65d6('0x3a')]=_[_0x65d6('0x39')](_0x3d65db[_0x65d6('0x3b')],qs[_0x65d6('0x3c')](_0x12aa36[_0x65d6('0x3d')]['fields']));_0x8a4ceb[_0x65d6('0x3a')]=_0x8a4ceb[_0x65d6('0x3a')]['length']?_0x8a4ceb[_0x65d6('0x3a')]:_0x3d65db[_0x65d6('0x3b')];_0x8a4ceb[_0x65d6('0x42')]=qs[_0x65d6('0x43')](_0x12aa36[_0x65d6('0x3d')][_0x65d6('0x43')]);_0x8a4ceb['where']=qs[_0x65d6('0x38')](_[_0x65d6('0x45')](_0x12aa36[_0x65d6('0x3d')],_0x3d65db[_0x65d6('0x38')]));if(_0x12aa36['query'][_0x65d6('0x46')]){_0x8a4ceb[_0x65d6('0x44')]=_[_0x65d6('0x47')](_0x8a4ceb[_0x65d6('0x44')],{'$or':_[_0x65d6('0x48')](_0x8a4ceb[_0x65d6('0x3a')],function(_0x510c46){var _0x44b5c7={};_0x44b5c7[_0x510c46]={'$like':'%'+_0x12aa36['query']['filter']+'%'};return _0x44b5c7;})});}_0x8a4ceb=_[_0x65d6('0x47')]({},_0x8a4ceb,_0x12aa36[_0x65d6('0x4d')]);return _0x2272ce['getDescriptions'](_0x8a4ceb);}})[_0x65d6('0x1d')](function(_0x1a4842){if(_0x1a4842){_0x225ed7=_0x1a4842[_0x65d6('0x3e')];if(!_0x12aa36['query'][_0x65d6('0x3f')](_0x65d6('0x40'))){_0x8a4ceb[_0x65d6('0x41')]=qs['limit'](_0x12aa36[_0x65d6('0x3d')]['limit']);_0x8a4ceb['offset']=qs[_0x65d6('0x2c')](_0x12aa36['query'][_0x65d6('0x2c')]);}return _0x2272ce[_0x65d6('0x5b')](_0x8a4ceb);}})[_0x65d6('0x1d')](function(_0x3222ae){if(_0x3222ae){return _0x3222ae?{'count':_0x225ed7,'rows':_0x3222ae}:null;}})['then'](respondWithResult(_0x2ba1ee,null))[_0x65d6('0x27')](handleError(_0x2ba1ee,null));};exports[_0x65d6('0x5c')]=function(_0x373756,_0x5edc39,_0x422a23){var _0x5eec52={};var _0xf786bb={};var _0x317452;var _0x1fddf7;return db[_0x65d6('0x35')]['findOne']({'where':{'id':_0x373756['params']['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x5edc39,null))[_0x65d6('0x1d')](function(_0x3985a9){if(_0x3985a9){_0x317452=_0x3985a9;_0xf786bb[_0x65d6('0x3b')]=_[_0x65d6('0x37')](db[_0x65d6('0x5d')]['rawAttributes']);_0xf786bb['query']=_[_0x65d6('0x37')](_0x373756[_0x65d6('0x3d')]);_0xf786bb['filters']=_['intersection'](_0xf786bb[_0x65d6('0x3b')],_0xf786bb['query']);_0x5eec52[_0x65d6('0x3a')]=_[_0x65d6('0x39')](_0xf786bb[_0x65d6('0x3b')],qs[_0x65d6('0x3c')](_0x373756['query']['fields']));_0x5eec52['attributes']=_0x5eec52[_0x65d6('0x3a')][_0x65d6('0x3e')]?_0x5eec52['attributes']:_0xf786bb[_0x65d6('0x3b')];_0x5eec52[_0x65d6('0x42')]=qs[_0x65d6('0x43')](_0x373756['query'][_0x65d6('0x43')]);_0x5eec52[_0x65d6('0x44')]=qs[_0x65d6('0x38')](_[_0x65d6('0x45')](_0x373756[_0x65d6('0x3d')],_0xf786bb[_0x65d6('0x38')]));if(_0x373756[_0x65d6('0x3d')][_0x65d6('0x46')]){_0x5eec52['where']=_[_0x65d6('0x47')](_0x5eec52[_0x65d6('0x44')],{'$or':_[_0x65d6('0x48')](_0x5eec52[_0x65d6('0x3a')],function(_0x52e4fe){var _0x5a1586={};_0x5a1586[_0x52e4fe]={'$like':'%'+_0x373756[_0x65d6('0x3d')][_0x65d6('0x46')]+'%'};return _0x5a1586;})});}_0x5eec52=_[_0x65d6('0x47')]({},_0x5eec52,_0x373756[_0x65d6('0x4d')]);return _0x317452[_0x65d6('0x5c')](_0x5eec52);}})[_0x65d6('0x1d')](function(_0x1fcbb4){if(_0x1fcbb4){_0x1fddf7=_0x1fcbb4[_0x65d6('0x3e')];if(!_0x373756[_0x65d6('0x3d')][_0x65d6('0x3f')](_0x65d6('0x40'))){_0x5eec52[_0x65d6('0x41')]=qs[_0x65d6('0x41')](_0x373756['query'][_0x65d6('0x41')]);_0x5eec52['offset']=qs[_0x65d6('0x2c')](_0x373756[_0x65d6('0x3d')][_0x65d6('0x2c')]);}return _0x317452[_0x65d6('0x5c')](_0x5eec52);}})[_0x65d6('0x1d')](function(_0x568b93){if(_0x568b93){return _0x568b93?{'count':_0x1fddf7,'rows':_0x568b93}:null;}})[_0x65d6('0x1d')](respondWithResult(_0x5edc39,null))['catch'](handleError(_0x5edc39,null));};exports['setTags']=function(_0x4eac3b,_0x5b1434,_0x1a3ce1){if(_0x4eac3b['body']['id']){delete _0x4eac3b[_0x65d6('0x56')]['id'];}return db[_0x65d6('0x35')][_0x65d6('0x57')]({'where':{'id':_0x4eac3b[_0x65d6('0x53')]['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x5b1434,null))[_0x65d6('0x1d')](function(_0x3d4140){if(_0x3d4140){return _0x3d4140[_0x65d6('0x5e')](_0x4eac3b[_0x65d6('0x56')]['ids']||[]);}return null;})[_0x65d6('0x1d')](respondWithResult(_0x5b1434,null))['catch'](handleError(_0x5b1434,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5832e5a..0d0f04f 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 _0x8b96=['exports','define','int_desk_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x5c106e,_0x4e3ad5){var _0x21778e=function(_0x324342){while(--_0x324342){_0x5c106e['push'](_0x5c106e['shift']());}};_0x21778e(++_0x4e3ad5);}(_0x8b96,0xad));var _0x68b9=function(_0x56b963,_0x52279f){_0x56b963=_0x56b963-0x0;var _0x144fe4=_0x8b96[_0x56b963];return _0x144fe4;};'use strict';var _=require('lodash');var util=require(_0x68b9('0x0'));var logger=require(_0x68b9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x68b9('0x2'));var rp=require(_0x68b9('0x3'));var fs=require('fs');var path=require(_0x68b9('0x4'));var rimraf=require(_0x68b9('0x5'));var config=require('../../config/environment');var attributes=require(_0x68b9('0x6'));module[_0x68b9('0x7')]=function(_0x536467,_0x5a58ad){return _0x536467[_0x68b9('0x8')]('DeskConfiguration',attributes,{'tableName':_0x68b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93cc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','../../config/logger'];(function(_0x9b163,_0x5d8c8f){var _0x824910=function(_0xe93c8){while(--_0xe93c8){_0x9b163['push'](_0x9b163['shift']());}};_0x824910(++_0x5d8c8f);}(_0x93cc,0x76));var _0xc93c=function(_0x1b7bee,_0x24caee){_0x1b7bee=_0x1b7bee-0x0;var _0x8490a1=_0x93cc[_0x1b7bee];return _0x8490a1;};'use strict';var _=require(_0xc93c('0x0'));var util=require('util');var logger=require(_0xc93c('0x1'))('api');var moment=require(_0xc93c('0x2'));var BPromise=require(_0xc93c('0x3'));var rp=require(_0xc93c('0x4'));var fs=require('fs');var path=require(_0xc93c('0x5'));var rimraf=require(_0xc93c('0x6'));var config=require(_0xc93c('0x7'));var attributes=require(_0xc93c('0x8'));module[_0xc93c('0x9')]=function(_0x3114c7,_0x20738c){return _0x3114c7['define'](_0xc93c('0xa'),attributes,{'tableName':_0xc93c('0xb'),'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 cccda44..3d602e8 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 _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x57d31c,_0x34e6fc){var _0x47e606=function(_0xf524cf){while(--_0xf524cf){_0x57d31c['push'](_0x57d31c['shift']());}};_0x47e606(++_0x34e6fc);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x239d56,_0x2277ed){_0x239d56=_0x239d56-0x0;var _0x5ec023=_0xdbf5[_0x239d56];return _0x5ec023;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0xdc97=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1508b0,_0x4cc814){var _0x158002=function(_0x1194f7){while(--_0x1194f7){_0x1508b0['push'](_0x1508b0['shift']());}};_0x158002(++_0x4cc814);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2001e3,_0x5b5401){_0x2001e3=_0x2001e3-0x0;var _0x3c43dc=_0xdc97[_0x2001e3];return _0x3c43dc;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 81d33a4..6ee7001 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 _0xdd90=['delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdd90,0xd3));var _0x0dd9=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdd90[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x0dd9('0x0'));var util=require('util');var path=require(_0x0dd9('0x1'));var timeout=require(_0x0dd9('0x2'));var express=require('express');var router=express[_0x0dd9('0x3')]();var auth=require(_0x0dd9('0x4'));var interaction=require(_0x0dd9('0x5'));var config=require(_0x0dd9('0x6'));var controller=require(_0x0dd9('0x7'));router[_0x0dd9('0x8')]('/',auth[_0x0dd9('0x9')](),controller[_0x0dd9('0xa')]);router['get']('/:id',auth[_0x0dd9('0x9')](),controller[_0x0dd9('0xb')]);router[_0x0dd9('0xc')]('/',auth['isAuthenticated'](),controller[_0x0dd9('0xd')]);router[_0x0dd9('0xe')](_0x0dd9('0xf'),auth['isAuthenticated'](),controller[_0x0dd9('0x10')]);router[_0x0dd9('0x11')](_0x0dd9('0xf'),auth[_0x0dd9('0x9')](),controller[_0x0dd9('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbc1d=['../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc1d,0x118));var _0xdbc1=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0xbc1d[_0x34f701];return _0x3e2429;};'use strict';var multer=require(_0xdbc1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdbc1('0x1'));var express=require(_0xdbc1('0x2'));var router=express[_0xdbc1('0x3')]();var auth=require(_0xdbc1('0x4'));var interaction=require(_0xdbc1('0x5'));var config=require('../../config/environment');var controller=require(_0xdbc1('0x6'));router[_0xdbc1('0x7')]('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0x9')]);router['get'](_0xdbc1('0xa'),auth['isAuthenticated'](),controller[_0xdbc1('0xb')]);router[_0xdbc1('0xc')]('/',auth['isAuthenticated'](),controller[_0xdbc1('0xd')]);router[_0xdbc1('0xe')](_0xdbc1('0xa'),auth['isAuthenticated'](),controller[_0xdbc1('0xf')]);router[_0xdbc1('0x10')](_0xdbc1('0xa'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0x11')]);module[_0xdbc1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f2aead8..ce1169c 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 _0xd64b=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x50d393,_0x55fe11){var _0x479a42=function(_0x46dfd3){while(--_0x46dfd3){_0x50d393['push'](_0x50d393['shift']());}};_0x479a42(++_0x55fe11);}(_0xd64b,0xc1));var _0xbd64=function(_0x12551a,_0x5af080){_0x12551a=_0x12551a-0x0;var _0x6f8fc0=_0xd64b[_0x12551a];return _0x6f8fc0;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'type':{'type':Sequelize[_0xbd64('0x1')]('string',_0xbd64('0x2'),_0xbd64('0x3'),_0xbd64('0x4')),'defaultValue':_0xbd64('0x5')},'content':{'type':Sequelize[_0xbd64('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xbd64('0x3'))},'keyContent':{'type':Sequelize[_0xbd64('0x6')]},'idField':{'type':Sequelize[_0xbd64('0x6')]},'nameField':{'type':Sequelize[_0xbd64('0x6')]},'customField':{'type':Sequelize[_0xbd64('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd64('0x6')]}}; \ No newline at end of file +var _0xcb91=['string','variable','customVariable','STRING','BOOLEAN','ENUM'];(function(_0x56413c,_0x2491f9){var _0x50ee63=function(_0x199e1f){while(--_0x199e1f){_0x56413c['push'](_0x56413c['shift']());}};_0x50ee63(++_0x2491f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xcb91[_0x5c72ee];return _0x231876;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue'),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize[_0x1cb9('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),'variable',_0x1cb9('0x3'))},'keyContent':{'type':Sequelize[_0x1cb9('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1cb9('0x4')]},'customField':{'type':Sequelize[_0x1cb9('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0682aaf..145f280 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 _0x0d61=['name','send','index','DeskField','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','save','update','destroy','then','error','stack'];(function(_0x445df1,_0x3b1f6c){var _0x895fc2=function(_0x231af7){while(--_0x231af7){_0x445df1['push'](_0x445df1['shift']());}};_0x895fc2(++_0x3b1f6c);}(_0x0d61,0x18d));var _0x10d6=function(_0xa54b4a,_0x4f4480){_0xa54b4a=_0xa54b4a-0x0;var _0x4f48b0=_0x0d61[_0xa54b4a];return _0x4f48b0;};'use strict';var pdf=require(_0x10d6('0x0'));var emlformat=require(_0x10d6('0x1'));var rimraf=require(_0x10d6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10d6('0x3'));var rp=require(_0x10d6('0x4'));var moment=require(_0x10d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x10d6('0x6'));var util=require(_0x10d6('0x7'));var path=require('path');var sox=require(_0x10d6('0x8'));var csv=require(_0x10d6('0x9'));var ejs=require(_0x10d6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x10d6('0xb'));var jsforce=require(_0x10d6('0xc'));var deskjs=require(_0x10d6('0xd'));var toCsv=require(_0x10d6('0x9'));var querystring=require(_0x10d6('0xe'));var Papa=require(_0x10d6('0xf'));var Redis=require(_0x10d6('0x10'));var authService=require(_0x10d6('0x11'));var qs=require(_0x10d6('0x12'));var hardwareService=require(_0x10d6('0x13'));var logger=require('../../config/logger')(_0x10d6('0x14'));var utils=require(_0x10d6('0x15'));var config=require('../../config/environment');var db=require(_0x10d6('0x16'))['db'];function respondWithStatusCode(_0x261a2c,_0x2913c4){_0x2913c4=_0x2913c4||0xcc;return function(_0x1e4df8){if(_0x1e4df8){return _0x261a2c[_0x10d6('0x17')](_0x2913c4);}return _0x261a2c[_0x10d6('0x18')](_0x2913c4)[_0x10d6('0x19')]();};}function respondWithResult(_0xbfa1ac,_0x61cbd8){_0x61cbd8=_0x61cbd8||0xc8;return function(_0x981896){if(_0x981896){return _0xbfa1ac['status'](_0x61cbd8)['json'](_0x981896);}};}function respondWithFilteredResult(_0x76d95b,_0x5c7840){return function(_0x2dfd09){if(_0x2dfd09){var _0x16e407=_0x2dfd09['count'],_0x5658da=_0x5c7840[_0x10d6('0x1a')],_0x41b8bd=_0x5c7840[_0x10d6('0x1a')]+_0x5c7840['limit'],_0x138d45;if(_0x41b8bd>=_0x16e407){_0x41b8bd=_0x16e407;_0x138d45=0xc8;}else{_0x138d45=0xce;}_0x76d95b[_0x10d6('0x18')](_0x138d45);return _0x76d95b[_0x10d6('0x1b')](_0x10d6('0x1c'),_0x5658da+'-'+_0x41b8bd+'/'+_0x16e407)['json'](_0x2dfd09);}return null;};}function patchUpdates(_0x4042f4){return function(_0x456dd2){try{jsonpatch['apply'](_0x456dd2,_0x4042f4,!![]);}catch(_0x31476c){return BPromise['reject'](_0x31476c);}return _0x456dd2[_0x10d6('0x1d')]();};}function saveUpdates(_0x38e8fd,_0x1a4425){return function(_0x4fd6fa){if(_0x4fd6fa){return _0x4fd6fa[_0x10d6('0x1e')](_0x38e8fd)['then'](function(_0x396d13){return _0x396d13;});}return null;};}function removeEntity(_0x37d837,_0x472a42){return function(_0x338c0d){if(_0x338c0d){return _0x338c0d[_0x10d6('0x1f')]()[_0x10d6('0x20')](function(){_0x37d837[_0x10d6('0x18')](0xcc)[_0x10d6('0x19')]();});}};}function handleEntityNotFound(_0x1814e1,_0x243bf9){return function(_0x4acb4e){if(!_0x4acb4e){_0x1814e1[_0x10d6('0x17')](0x194);}return _0x4acb4e;};}function handleError(_0x56a445,_0x50765b){_0x50765b=_0x50765b||0x1f4;return function(_0x250f85){logger[_0x10d6('0x21')](_0x250f85[_0x10d6('0x22')]);if(_0x250f85[_0x10d6('0x23')]){delete _0x250f85[_0x10d6('0x23')];}_0x56a445[_0x10d6('0x18')](_0x50765b)[_0x10d6('0x24')](_0x250f85);};}exports[_0x10d6('0x25')]=function(_0xfa9ef9,_0x239fbd){var _0x364a81={},_0x40dd91={},_0x5ebad8={'count':0x0,'rows':[]};var _0x133842=db[_0x10d6('0x26')][_0x10d6('0x27')];_0x40dd91['model']=_['keys'](_0x133842);_0x40dd91[_0x10d6('0x28')]=_[_0x10d6('0x29')](_0xfa9ef9[_0x10d6('0x28')]);_0x40dd91[_0x10d6('0x2a')]=_[_0x10d6('0x2b')](_0x40dd91['model'],_0x40dd91[_0x10d6('0x28')]);_0x364a81[_0x10d6('0x2c')]=_[_0x10d6('0x2b')](_0x40dd91[_0x10d6('0x2d')],qs[_0x10d6('0x2e')](_0xfa9ef9['query'][_0x10d6('0x2e')]));_0x364a81[_0x10d6('0x2c')]=_0x364a81[_0x10d6('0x2c')][_0x10d6('0x2f')]?_0x364a81[_0x10d6('0x2c')]:_0x40dd91[_0x10d6('0x2d')];if(!_0xfa9ef9[_0x10d6('0x28')][_0x10d6('0x30')](_0x10d6('0x31'))){_0x364a81[_0x10d6('0x32')]=qs[_0x10d6('0x32')](_0xfa9ef9[_0x10d6('0x28')][_0x10d6('0x32')]);_0x364a81[_0x10d6('0x1a')]=qs[_0x10d6('0x1a')](_0xfa9ef9[_0x10d6('0x28')][_0x10d6('0x1a')]);}_0x364a81[_0x10d6('0x33')]=qs[_0x10d6('0x34')](_0xfa9ef9[_0x10d6('0x28')]['sort']);_0x364a81[_0x10d6('0x35')]=qs['filters'](_[_0x10d6('0x36')](_0xfa9ef9[_0x10d6('0x28')],_0x40dd91['filters']));if(_0xfa9ef9[_0x10d6('0x28')][_0x10d6('0x37')]){_0x364a81[_0x10d6('0x35')]=_[_0x10d6('0x38')](_0x364a81[_0x10d6('0x35')],{'$or':_[_0x10d6('0x39')](_0x133842,function(_0x107925){if(_0x107925[_0x10d6('0x3a')]['key']!==_0x10d6('0x3b')){var _0x8c0e7f={};_0x8c0e7f[_0x107925[_0x10d6('0x3c')]]={'$like':'%'+_0xfa9ef9[_0x10d6('0x28')][_0x10d6('0x37')]+'%'};return _0x8c0e7f;}})});}_0x364a81=_[_0x10d6('0x38')]({},_0x364a81,_0xfa9ef9[_0x10d6('0x3d')]);var _0x57e87f={'where':_0x364a81[_0x10d6('0x35')]};return db['DeskField'][_0x10d6('0x3e')](_0x57e87f)['then'](function(_0x1f2a73){_0x5ebad8['count']=_0x1f2a73;if(_0xfa9ef9[_0x10d6('0x28')][_0x10d6('0x3f')]){_0x364a81[_0x10d6('0x40')]=[{'all':!![]}];}return db[_0x10d6('0x26')][_0x10d6('0x41')](_0x364a81);})[_0x10d6('0x20')](function(_0x313874){_0x5ebad8[_0x10d6('0x42')]=_0x313874;return _0x5ebad8;})[_0x10d6('0x20')](respondWithFilteredResult(_0x239fbd,_0x364a81))[_0x10d6('0x43')](handleError(_0x239fbd,null));};exports['show']=function(_0x41fc1c,_0x4a75f1){var _0x253f66={'raw':!![],'where':{'id':_0x41fc1c['params']['id']}},_0xb8f5bf={};_0xb8f5bf[_0x10d6('0x2d')]=_[_0x10d6('0x29')](db['DeskField'][_0x10d6('0x27')]);_0xb8f5bf[_0x10d6('0x28')]=_[_0x10d6('0x29')](_0x41fc1c[_0x10d6('0x28')]);_0xb8f5bf[_0x10d6('0x2a')]=_[_0x10d6('0x2b')](_0xb8f5bf[_0x10d6('0x2d')],_0xb8f5bf[_0x10d6('0x28')]);_0x253f66[_0x10d6('0x2c')]=_[_0x10d6('0x2b')](_0xb8f5bf[_0x10d6('0x2d')],qs[_0x10d6('0x2e')](_0x41fc1c['query'][_0x10d6('0x2e')]));_0x253f66['attributes']=_0x253f66[_0x10d6('0x2c')]['length']?_0x253f66[_0x10d6('0x2c')]:_0xb8f5bf[_0x10d6('0x2d')];if(_0x41fc1c[_0x10d6('0x28')][_0x10d6('0x3f')]){_0x253f66['include']=[{'all':!![]}];}_0x253f66=_[_0x10d6('0x38')]({},_0x253f66,_0x41fc1c[_0x10d6('0x3d')]);return db[_0x10d6('0x26')][_0x10d6('0x44')](_0x253f66)['then'](handleEntityNotFound(_0x4a75f1,null))[_0x10d6('0x20')](respondWithResult(_0x4a75f1,null))[_0x10d6('0x43')](handleError(_0x4a75f1,null));};exports['create']=function(_0x355c69,_0x2004d9){return db[_0x10d6('0x26')][_0x10d6('0x45')](_0x355c69[_0x10d6('0x46')],{})[_0x10d6('0x20')](respondWithResult(_0x2004d9,0xc9))[_0x10d6('0x43')](handleError(_0x2004d9,null));};exports[_0x10d6('0x1e')]=function(_0xac540d,_0x4daa5f){if(_0xac540d[_0x10d6('0x46')]['id']){delete _0xac540d['body']['id'];}return db[_0x10d6('0x26')][_0x10d6('0x44')]({'where':{'id':_0xac540d[_0x10d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x4daa5f,null))[_0x10d6('0x20')](saveUpdates(_0xac540d[_0x10d6('0x46')],null))[_0x10d6('0x20')](respondWithResult(_0x4daa5f,null))[_0x10d6('0x43')](handleError(_0x4daa5f,null));};exports[_0x10d6('0x1f')]=function(_0x430776,_0x3adda3){return db[_0x10d6('0x26')][_0x10d6('0x44')]({'where':{'id':_0x430776[_0x10d6('0x47')]['id']}})[_0x10d6('0x20')](handleEntityNotFound(_0x3adda3,null))[_0x10d6('0x20')](removeEntity(_0x3adda3,null))[_0x10d6('0x43')](handleError(_0x3adda3,null));}; \ No newline at end of file +var _0xd0b4=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','end','count','offset','limit','Content-Range','json','reject','save','update','then','status','sendStatus','error','stack','name','send','index','DeskField','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','field','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xd0b4,0x15b));var _0x4d0b=function(_0x172caf,_0x4d586f){_0x172caf=_0x172caf-0x0;var _0xc93db0=_0xd0b4[_0x172caf];return _0xc93db0;};'use strict';var pdf=require(_0x4d0b('0x0'));var emlformat=require(_0x4d0b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d0b('0x2'));var jsonpatch=require(_0x4d0b('0x3'));var rp=require('request-promise');var moment=require(_0x4d0b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4d0b('0x5'));var util=require(_0x4d0b('0x6'));var path=require(_0x4d0b('0x7'));var sox=require(_0x4d0b('0x8'));var csv=require(_0x4d0b('0x9'));var ejs=require(_0x4d0b('0xa'));var fs=require('fs');var _=require(_0x4d0b('0xb'));var squel=require(_0x4d0b('0xc'));var crypto=require(_0x4d0b('0xd'));var jsforce=require(_0x4d0b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4d0b('0xf'));var Papa=require('papaparse');var Redis=require(_0x4d0b('0x10'));var authService=require(_0x4d0b('0x11'));var qs=require(_0x4d0b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d0b('0x13'))(_0x4d0b('0x14'));var utils=require('../../config/utils');var config=require(_0x4d0b('0x15'));var db=require(_0x4d0b('0x16'))['db'];function respondWithStatusCode(_0x372c9a,_0x181656){_0x181656=_0x181656||0xcc;return function(_0x52c0ef){if(_0x52c0ef){return _0x372c9a['sendStatus'](_0x181656);}return _0x372c9a['status'](_0x181656)[_0x4d0b('0x17')]();};}function respondWithResult(_0x14887c,_0x21b378){_0x21b378=_0x21b378||0xc8;return function(_0x2755c5){if(_0x2755c5){return _0x14887c['status'](_0x21b378)['json'](_0x2755c5);}};}function respondWithFilteredResult(_0x2d4ebb,_0xb55067){return function(_0x566371){if(_0x566371){var _0x477a71=_0x566371[_0x4d0b('0x18')],_0x16e880=_0xb55067[_0x4d0b('0x19')],_0x1ace66=_0xb55067[_0x4d0b('0x19')]+_0xb55067[_0x4d0b('0x1a')],_0x4e4da3;if(_0x1ace66>=_0x477a71){_0x1ace66=_0x477a71;_0x4e4da3=0xc8;}else{_0x4e4da3=0xce;}_0x2d4ebb['status'](_0x4e4da3);return _0x2d4ebb['set'](_0x4d0b('0x1b'),_0x16e880+'-'+_0x1ace66+'/'+_0x477a71)[_0x4d0b('0x1c')](_0x566371);}return null;};}function patchUpdates(_0x33cb29){return function(_0x5b616b){try{jsonpatch['apply'](_0x5b616b,_0x33cb29,!![]);}catch(_0x2a8e3f){return BPromise[_0x4d0b('0x1d')](_0x2a8e3f);}return _0x5b616b[_0x4d0b('0x1e')]();};}function saveUpdates(_0x3177d3,_0x37b315){return function(_0x2facac){if(_0x2facac){return _0x2facac[_0x4d0b('0x1f')](_0x3177d3)[_0x4d0b('0x20')](function(_0x491903){return _0x491903;});}return null;};}function removeEntity(_0x44e41e,_0x488305){return function(_0x4f65e3){if(_0x4f65e3){return _0x4f65e3['destroy']()[_0x4d0b('0x20')](function(){_0x44e41e[_0x4d0b('0x21')](0xcc)[_0x4d0b('0x17')]();});}};}function handleEntityNotFound(_0x52c509,_0x1efd4f){return function(_0x520221){if(!_0x520221){_0x52c509[_0x4d0b('0x22')](0x194);}return _0x520221;};}function handleError(_0x4902fe,_0x219949){_0x219949=_0x219949||0x1f4;return function(_0x9d9888){logger[_0x4d0b('0x23')](_0x9d9888[_0x4d0b('0x24')]);if(_0x9d9888[_0x4d0b('0x25')]){delete _0x9d9888['name'];}_0x4902fe[_0x4d0b('0x21')](_0x219949)[_0x4d0b('0x26')](_0x9d9888);};}exports[_0x4d0b('0x27')]=function(_0x1d5b5c,_0x289af7){var _0x14f53d={},_0x4fb263={},_0x60a2de={'count':0x0,'rows':[]};var _0x44dc63=db[_0x4d0b('0x28')]['rawAttributes'];_0x4fb263[_0x4d0b('0x29')]=_[_0x4d0b('0x2a')](_0x44dc63);_0x4fb263['query']=_['keys'](_0x1d5b5c[_0x4d0b('0x2b')]);_0x4fb263[_0x4d0b('0x2c')]=_[_0x4d0b('0x2d')](_0x4fb263[_0x4d0b('0x29')],_0x4fb263[_0x4d0b('0x2b')]);_0x14f53d['attributes']=_[_0x4d0b('0x2d')](_0x4fb263[_0x4d0b('0x29')],qs[_0x4d0b('0x2e')](_0x1d5b5c[_0x4d0b('0x2b')][_0x4d0b('0x2e')]));_0x14f53d['attributes']=_0x14f53d[_0x4d0b('0x2f')]['length']?_0x14f53d[_0x4d0b('0x2f')]:_0x4fb263[_0x4d0b('0x29')];if(!_0x1d5b5c[_0x4d0b('0x2b')][_0x4d0b('0x30')](_0x4d0b('0x31'))){_0x14f53d[_0x4d0b('0x1a')]=qs[_0x4d0b('0x1a')](_0x1d5b5c[_0x4d0b('0x2b')][_0x4d0b('0x1a')]);_0x14f53d[_0x4d0b('0x19')]=qs['offset'](_0x1d5b5c[_0x4d0b('0x2b')]['offset']);}_0x14f53d[_0x4d0b('0x32')]=qs[_0x4d0b('0x33')](_0x1d5b5c[_0x4d0b('0x2b')]['sort']);_0x14f53d['where']=qs[_0x4d0b('0x2c')](_[_0x4d0b('0x34')](_0x1d5b5c[_0x4d0b('0x2b')],_0x4fb263[_0x4d0b('0x2c')]));if(_0x1d5b5c[_0x4d0b('0x2b')][_0x4d0b('0x35')]){_0x14f53d[_0x4d0b('0x36')]=_[_0x4d0b('0x37')](_0x14f53d[_0x4d0b('0x36')],{'$or':_['map'](_0x44dc63,function(_0x4de42a){if(_0x4de42a[_0x4d0b('0x38')]['key']!==_0x4d0b('0x39')){var _0x39dd86={};_0x39dd86[_0x4de42a[_0x4d0b('0x3a')]]={'$like':'%'+_0x1d5b5c[_0x4d0b('0x2b')][_0x4d0b('0x35')]+'%'};return _0x39dd86;}})});}_0x14f53d=_['merge']({},_0x14f53d,_0x1d5b5c[_0x4d0b('0x3b')]);var _0x4b6187={'where':_0x14f53d[_0x4d0b('0x36')]};return db['DeskField']['count'](_0x4b6187)[_0x4d0b('0x20')](function(_0x14f516){_0x60a2de[_0x4d0b('0x18')]=_0x14f516;if(_0x1d5b5c['query'][_0x4d0b('0x3c')]){_0x14f53d[_0x4d0b('0x3d')]=[{'all':!![]}];}return db['DeskField'][_0x4d0b('0x3e')](_0x14f53d);})[_0x4d0b('0x20')](function(_0x426954){_0x60a2de[_0x4d0b('0x3f')]=_0x426954;return _0x60a2de;})[_0x4d0b('0x20')](respondWithFilteredResult(_0x289af7,_0x14f53d))['catch'](handleError(_0x289af7,null));};exports['show']=function(_0x644cc4,_0x280e2e){var _0x49a742={'raw':!![],'where':{'id':_0x644cc4[_0x4d0b('0x40')]['id']}},_0x2f48c3={};_0x2f48c3[_0x4d0b('0x29')]=_[_0x4d0b('0x2a')](db['DeskField'][_0x4d0b('0x41')]);_0x2f48c3['query']=_[_0x4d0b('0x2a')](_0x644cc4[_0x4d0b('0x2b')]);_0x2f48c3[_0x4d0b('0x2c')]=_['intersection'](_0x2f48c3[_0x4d0b('0x29')],_0x2f48c3[_0x4d0b('0x2b')]);_0x49a742['attributes']=_[_0x4d0b('0x2d')](_0x2f48c3[_0x4d0b('0x29')],qs[_0x4d0b('0x2e')](_0x644cc4['query'][_0x4d0b('0x2e')]));_0x49a742[_0x4d0b('0x2f')]=_0x49a742[_0x4d0b('0x2f')][_0x4d0b('0x42')]?_0x49a742[_0x4d0b('0x2f')]:_0x2f48c3['model'];if(_0x644cc4['query'][_0x4d0b('0x3c')]){_0x49a742[_0x4d0b('0x3d')]=[{'all':!![]}];}_0x49a742=_[_0x4d0b('0x37')]({},_0x49a742,_0x644cc4['options']);return db[_0x4d0b('0x28')][_0x4d0b('0x43')](_0x49a742)[_0x4d0b('0x20')](handleEntityNotFound(_0x280e2e,null))[_0x4d0b('0x20')](respondWithResult(_0x280e2e,null))[_0x4d0b('0x44')](handleError(_0x280e2e,null));};exports[_0x4d0b('0x45')]=function(_0x280c5b,_0x4c1239){return db[_0x4d0b('0x28')][_0x4d0b('0x45')](_0x280c5b[_0x4d0b('0x46')],{})[_0x4d0b('0x20')](respondWithResult(_0x4c1239,0xc9))['catch'](handleError(_0x4c1239,null));};exports[_0x4d0b('0x1f')]=function(_0x49a614,_0x20c115){if(_0x49a614['body']['id']){delete _0x49a614['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x49a614[_0x4d0b('0x40')]['id']}})[_0x4d0b('0x20')](handleEntityNotFound(_0x20c115,null))[_0x4d0b('0x20')](saveUpdates(_0x49a614[_0x4d0b('0x46')],null))['then'](respondWithResult(_0x20c115,null))['catch'](handleError(_0x20c115,null));};exports[_0x4d0b('0x47')]=function(_0x12cdd5,_0x38c4b8){return db['DeskField'][_0x4d0b('0x43')]({'where':{'id':_0x12cdd5[_0x4d0b('0x40')]['id']}})[_0x4d0b('0x20')](handleEntityNotFound(_0x38c4b8,null))[_0x4d0b('0x20')](removeEntity(_0x38c4b8,null))[_0x4d0b('0x44')](handleError(_0x38c4b8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 347c216..24cc849 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 _0x507b=['desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields'];(function(_0x2e0d6f,_0x54e11b){var _0x52d841=function(_0x1967eb){while(--_0x1967eb){_0x2e0d6f['push'](_0x2e0d6f['shift']());}};_0x52d841(++_0x54e11b);}(_0x507b,0xd5));var _0xb507=function(_0x47fdfb,_0x273baf){_0x47fdfb=_0x47fdfb-0x0;var _0x38f3ee=_0x507b[_0x47fdfb];return _0x38f3ee;};'use strict';var _=require(_0xb507('0x0'));var util=require(_0xb507('0x1'));var logger=require(_0xb507('0x2'))(_0xb507('0x3'));var moment=require(_0xb507('0x4'));var BPromise=require(_0xb507('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb507('0x6'));var config=require(_0xb507('0x7'));var attributes=require(_0xb507('0x8'));module['exports']=function(_0x4a826a,_0x5a36b6){return _0x4a826a['define'](_0xb507('0x9'),attributes,{'tableName':_0xb507('0xa'),'paranoid':![],'indexes':[{'name':_0xb507('0xb'),'fields':[_0xb507('0xc'),_0xb507('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcddb=['DeskField','desk_unique_index','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x22dd17,_0x3afc41){var _0x56d886=function(_0x28c512){while(--_0x28c512){_0x22dd17['push'](_0x22dd17['shift']());}};_0x56d886(++_0x3afc41);}(_0xcddb,0x195));var _0xbcdd=function(_0x47c95f,_0x5c3fa3){_0x47c95f=_0x47c95f-0x0;var _0x50979b=_0xcddb[_0x47c95f];return _0x50979b;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var logger=require(_0xbcdd('0x2'))(_0xbcdd('0x3'));var moment=require(_0xbcdd('0x4'));var BPromise=require(_0xbcdd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbcdd('0x6'));var config=require(_0xbcdd('0x7'));var attributes=require(_0xbcdd('0x8'));module[_0xbcdd('0x9')]=function(_0x1d05e1,_0x192b4c){return _0x1d05e1[_0xbcdd('0xa')](_0xbcdd('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xbcdd('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index d72334b..17ea52d 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x224a67,_0xae8218){var _0x211e67=function(_0x25b77a){while(--_0x25b77a){_0x224a67['push'](_0x224a67['shift']());}};_0x211e67(++_0xae8218);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3058bb,_0x250e2f){_0x3058bb=_0x3058bb-0x0;var _0x25fb8f=_0xb43b[_0x3058bb];return _0x25fb8f;};'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')]('DeskField,\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')]('DeskField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('DeskField,\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 _0x4ea3=['DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('DeskField,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ed7c3cd..06bd210 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 _0x427f=['delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','put','/:id','update'];(function(_0x2574cd,_0x3a6b77){var _0x2eaec6=function(_0x40ec79){while(--_0x40ec79){_0x2574cd['push'](_0x2574cd['shift']());}};_0x2eaec6(++_0x3a6b77);}(_0x427f,0x152));var _0xf427=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x427f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xf427('0x0'));var util=require(_0xf427('0x1'));var path=require(_0xf427('0x2'));var timeout=require('connect-timeout');var express=require(_0xf427('0x3'));var router=express[_0xf427('0x4')]();var auth=require(_0xf427('0x5'));var interaction=require(_0xf427('0x6'));var config=require('../../config/environment');var controller=require(_0xf427('0x7'));router[_0xf427('0x8')]('/',auth['isAuthenticated'](),controller[_0xf427('0x9')]);router[_0xf427('0x8')]('/:id',auth[_0xf427('0xa')](),controller[_0xf427('0xb')]);router[_0xf427('0x8')](_0xf427('0xc'),auth[_0xf427('0xa')](),controller['getConfigurations']);router[_0xf427('0x8')](_0xf427('0xd'),auth[_0xf427('0xa')](),controller[_0xf427('0xe')]);router[_0xf427('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf427('0xf')](_0xf427('0xc'),auth[_0xf427('0xa')](),controller['addConfiguration']);router[_0xf427('0x10')](_0xf427('0x11'),auth[_0xf427('0xa')](),controller[_0xf427('0x12')]);router[_0xf427('0x13')](_0xf427('0x11'),auth[_0xf427('0xa')](),controller[_0xf427('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb7dd=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy'];(function(_0x33d277,_0x502430){var _0x14f919=function(_0x4b9288){while(--_0x4b9288){_0x33d277['push'](_0x33d277['shift']());}};_0x14f919(++_0x502430);}(_0xb7dd,0x169));var _0xdb7d=function(_0x1bd300,_0x51e0fa){_0x1bd300=_0x1bd300-0x0;var _0x53119a=_0xb7dd[_0x1bd300];return _0x53119a;};'use strict';var multer=require(_0xdb7d('0x0'));var util=require('util');var path=require(_0xdb7d('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb7d('0x2'));var router=express[_0xdb7d('0x3')]();var auth=require(_0xdb7d('0x4'));var interaction=require(_0xdb7d('0x5'));var config=require(_0xdb7d('0x6'));var controller=require(_0xdb7d('0x7'));router['get']('/',auth[_0xdb7d('0x8')](),controller[_0xdb7d('0x9')]);router[_0xdb7d('0xa')](_0xdb7d('0xb'),auth[_0xdb7d('0x8')](),controller[_0xdb7d('0xc')]);router['get'](_0xdb7d('0xd'),auth[_0xdb7d('0x8')](),controller[_0xdb7d('0xe')]);router['get'](_0xdb7d('0xf'),auth['isAuthenticated'](),controller[_0xdb7d('0x10')]);router[_0xdb7d('0x11')]('/',auth[_0xdb7d('0x8')](),controller[_0xdb7d('0x12')]);router[_0xdb7d('0x11')]('/:id/configurations',auth[_0xdb7d('0x8')](),controller['addConfiguration']);router[_0xdb7d('0x13')](_0xdb7d('0xb'),auth['isAuthenticated'](),controller[_0xdb7d('0x14')]);router[_0xdb7d('0x15')](_0xdb7d('0xb'),auth[_0xdb7d('0x8')](),controller[_0xdb7d('0x16')]);module[_0xdb7d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 42f81fd..d81075c 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 _0x283c=['sequelize','STRING'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x283c,0xba));var _0xc283=function(_0x480272,_0x5bf5bf){_0x480272=_0x480272-0x0;var _0x18ab0e=_0x283c[_0x480272];return _0x18ab0e;};'use strict';var Sequelize=require(_0xc283('0x0'));module['exports']={'name':{'type':Sequelize[_0xc283('0x1')]},'username':{'type':Sequelize[_0xc283('0x1')]},'password':{'type':Sequelize[_0xc283('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xc283('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc283('0x1')]},'serverUrl':{'type':Sequelize[_0xc283('0x1')]},'description':{'type':Sequelize[_0xc283('0x1')]}}; \ No newline at end of file +var _0x1f10=['STRING','exports'];(function(_0x2031c2,_0x130bcd){var _0x5ef1e7=function(_0x3d6dab){while(--_0x3d6dab){_0x2031c2['push'](_0x2031c2['shift']());}};_0x5ef1e7(++_0x130bcd);}(_0x1f10,0x1ef));var _0x01f1=function(_0x17099d,_0x5ea71e){_0x17099d=_0x17099d-0x0;var _0x4f67c6=_0x1f10[_0x17099d];return _0x4f67c6;};'use strict';var Sequelize=require('sequelize');module[_0x01f1('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x01f1('0x1')]},'password':{'type':Sequelize[_0x01f1('0x1')]},'remoteUri':{'type':Sequelize[_0x01f1('0x1')]},'tenantId':{'type':Sequelize[_0x01f1('0x1')]},'clientId':{'type':Sequelize[_0x01f1('0x1')]},'clientSecret':{'type':Sequelize[_0x01f1('0x1')]},'serverUrl':{'type':Sequelize[_0x01f1('0x1')]},'description':{'type':Sequelize[_0x01f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 32e917c..526847b 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 _0x8d02=['phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','clientId','username','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','concat','log','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','Dynamics365Account','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','key','VIRTUAL','includeAll','findAll','rows','show','intersection','options','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x8d02,0x13b));var _0x28d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d02[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x28d0('0x0'));var rp=require(_0x28d0('0x1'));var moment=require(_0x28d0('0x2'));var BPromise=require(_0x28d0('0x3'));var Mustache=require(_0x28d0('0x4'));var util=require('util');var path=require(_0x28d0('0x5'));var sox=require(_0x28d0('0x6'));var csv=require(_0x28d0('0x7'));var ejs=require(_0x28d0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28d0('0x9'));var crypto=require(_0x28d0('0xa'));var jsforce=require(_0x28d0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28d0('0x7'));var querystring=require(_0x28d0('0xc'));var Papa=require(_0x28d0('0xd'));var Redis=require(_0x28d0('0xe'));var authService=require(_0x28d0('0xf'));var qs=require(_0x28d0('0x10'));var hardwareService=require(_0x28d0('0x11'));var logger=require(_0x28d0('0x12'))(_0x28d0('0x13'));var utils=require(_0x28d0('0x14'));var config=require(_0x28d0('0x15'));var db=require(_0x28d0('0x16'))['db'];var integrations=require(_0x28d0('0x17'));var jayson=require(_0x28d0('0x18'));var client=jayson[_0x28d0('0x19')][_0x28d0('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x588627,_0x59cb15,_0x70083e){if(_0x70083e){var _0x16e65a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16e65a['test'](_0x59cb15)){return _0x588627;}else{throw new Error(_0x28d0('0x1b'));}}else{return _0x588627;}}function respondWithRpcPromise(_0xd43288,_0x4a2a38,_0x2f7128,_0x493e4d){return new BPromise(function(_0x112336,_0x350751){var _0x49426f=_0x493e4d||client;return _0x49426f[_0x28d0('0x1c')](_0xd43288,_0x2f7128)[_0x28d0('0x1d')](function(_0x355f88){logger['info'](_0x28d0('0x1e'),_0x4a2a38,_0x28d0('0x1f'));logger[_0x28d0('0x20')](_0x28d0('0x21'),_0x4a2a38,_0x28d0('0x1f'),JSON['stringify'](_0x355f88));if(_0x355f88['error']){if(_0x355f88[_0x28d0('0x22')][_0x28d0('0x23')]===0x1f4){logger[_0x28d0('0x22')](_0x28d0('0x1e'),_0x4a2a38,_0x355f88[_0x28d0('0x22')]['message']);return _0x350751(_0x355f88[_0x28d0('0x22')][_0x28d0('0x24')]);}logger[_0x28d0('0x22')](_0x28d0('0x1e'),_0x4a2a38,_0x355f88[_0x28d0('0x22')]['message']);return _0x112336(_0x355f88[_0x28d0('0x22')][_0x28d0('0x24')]);}else{logger['info'](_0x28d0('0x1e'),_0x4a2a38,_0x28d0('0x1f'));_0x112336(_0x355f88[_0x28d0('0x25')][_0x28d0('0x24')]);}})[_0x28d0('0x26')](function(_0x3e868b){logger['error'](_0x28d0('0x1e'),_0x4a2a38,_0x3e868b);_0x350751(_0x3e868b);});});}function respondWithStatusCode(_0x16c5ef,_0x11e870){_0x11e870=_0x11e870||0xcc;return function(_0x42c271){if(_0x42c271){return _0x16c5ef[_0x28d0('0x27')](_0x11e870);}return _0x16c5ef[_0x28d0('0x28')](_0x11e870)[_0x28d0('0x29')]();};}function respondWithResult(_0x476f63,_0x3896f8){_0x3896f8=_0x3896f8||0xc8;return function(_0x35deee){if(_0x35deee){return _0x476f63[_0x28d0('0x28')](_0x3896f8)['json'](_0x35deee);}};}function respondWithFilteredResult(_0x21a0e8,_0x3f245c){return function(_0x5ec127){if(_0x5ec127){var _0x55c8ca=_0x5ec127[_0x28d0('0x2a')],_0x57ca4a=_0x3f245c[_0x28d0('0x2b')],_0x3f5632=_0x3f245c[_0x28d0('0x2b')]+_0x3f245c[_0x28d0('0x2c')],_0x476aa4;if(_0x3f5632>=_0x55c8ca){_0x3f5632=_0x55c8ca;_0x476aa4=0xc8;}else{_0x476aa4=0xce;}_0x21a0e8[_0x28d0('0x28')](_0x476aa4);return _0x21a0e8['set'](_0x28d0('0x2d'),_0x57ca4a+'-'+_0x3f5632+'/'+_0x55c8ca)['json'](_0x5ec127);}return null;};}function patchUpdates(_0x29366c){return function(_0x522c5b){try{jsonpatch['apply'](_0x522c5b,_0x29366c,!![]);}catch(_0xd1a606){return BPromise[_0x28d0('0x2e')](_0xd1a606);}return _0x522c5b[_0x28d0('0x2f')]();};}function saveUpdates(_0x5a0743,_0x27796b){return function(_0x1046aa){if(_0x1046aa){return _0x1046aa[_0x28d0('0x30')](_0x5a0743)[_0x28d0('0x1d')](function(_0x3957d6){return _0x3957d6;});}return null;};}function removeEntity(_0x38bc3b,_0x5c963c){return function(_0x29191e){if(_0x29191e){return _0x29191e[_0x28d0('0x31')]()['then'](function(){_0x38bc3b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc244c1,_0x4c6731){return function(_0xb18498){if(!_0xb18498){_0xc244c1[_0x28d0('0x27')](0x194);}return _0xb18498;};}function handleError(_0x3b27ea,_0x33f401){_0x33f401=_0x33f401||0x1f4;return function(_0x5c8a47){logger[_0x28d0('0x22')](_0x5c8a47[_0x28d0('0x32')]);if(_0x5c8a47[_0x28d0('0x33')]){delete _0x5c8a47[_0x28d0('0x33')];}_0x3b27ea[_0x28d0('0x28')](_0x33f401)[_0x28d0('0x34')](_0x5c8a47);};}exports[_0x28d0('0x35')]=function(_0x5d6eb2,_0x2cdb6d){var _0x4597ae={},_0x400713={},_0x3fce57={'count':0x0,'rows':[]};var _0xdc531f=db[_0x28d0('0x36')][_0x28d0('0x37')];_0x400713[_0x28d0('0x38')]=_[_0x28d0('0x39')](_0xdc531f);_0x400713[_0x28d0('0x3a')]=_[_0x28d0('0x39')](_0x5d6eb2[_0x28d0('0x3a')]);_0x400713[_0x28d0('0x3b')]=_['intersection'](_0x400713['model'],_0x400713[_0x28d0('0x3a')]);_0x4597ae[_0x28d0('0x3c')]=_['intersection'](_0x400713['model'],qs[_0x28d0('0x3d')](_0x5d6eb2['query'][_0x28d0('0x3d')]));_0x4597ae['attributes']=_0x4597ae[_0x28d0('0x3c')][_0x28d0('0x3e')]?_0x4597ae[_0x28d0('0x3c')]:_0x400713['model'];if(!_0x5d6eb2[_0x28d0('0x3a')][_0x28d0('0x3f')]('nolimit')){_0x4597ae[_0x28d0('0x2c')]=qs['limit'](_0x5d6eb2[_0x28d0('0x3a')]['limit']);_0x4597ae[_0x28d0('0x2b')]=qs[_0x28d0('0x2b')](_0x5d6eb2[_0x28d0('0x3a')][_0x28d0('0x2b')]);}_0x4597ae[_0x28d0('0x40')]=qs[_0x28d0('0x41')](_0x5d6eb2[_0x28d0('0x3a')]['sort']);_0x4597ae['where']=qs[_0x28d0('0x3b')](_[_0x28d0('0x42')](_0x5d6eb2['query'],_0x400713[_0x28d0('0x3b')]));if(_0x5d6eb2[_0x28d0('0x3a')][_0x28d0('0x43')]){_0x4597ae[_0x28d0('0x44')]=_[_0x28d0('0x45')](_0x4597ae[_0x28d0('0x44')],{'$or':_[_0x28d0('0x46')](_0xdc531f,function(_0x1f3f4f){if(_0x1f3f4f['type'][_0x28d0('0x47')]!==_0x28d0('0x48')){var _0x41eb9a={};_0x41eb9a[_0x1f3f4f['field']]={'$like':'%'+_0x5d6eb2[_0x28d0('0x3a')][_0x28d0('0x43')]+'%'};return _0x41eb9a;}})});}_0x4597ae=_[_0x28d0('0x45')]({},_0x4597ae,_0x5d6eb2['options']);var _0x427687={'where':_0x4597ae[_0x28d0('0x44')]};return db[_0x28d0('0x36')][_0x28d0('0x2a')](_0x427687)[_0x28d0('0x1d')](function(_0xde4137){_0x3fce57[_0x28d0('0x2a')]=_0xde4137;if(_0x5d6eb2[_0x28d0('0x3a')][_0x28d0('0x49')]){_0x4597ae['include']=[{'all':!![]}];}return db[_0x28d0('0x36')][_0x28d0('0x4a')](_0x4597ae);})[_0x28d0('0x1d')](function(_0x2f2809){_0x3fce57[_0x28d0('0x4b')]=_0x2f2809;return _0x3fce57;})[_0x28d0('0x1d')](respondWithFilteredResult(_0x2cdb6d,_0x4597ae))[_0x28d0('0x26')](handleError(_0x2cdb6d,null));};exports[_0x28d0('0x4c')]=function(_0x120706,_0x1eccb2){var _0x1378cc={'raw':![],'where':{'id':_0x120706['params']['id']}},_0x28101b={};_0x28101b[_0x28d0('0x38')]=_[_0x28d0('0x39')](db['Dynamics365Account'][_0x28d0('0x37')]);_0x28101b[_0x28d0('0x3a')]=_['keys'](_0x120706[_0x28d0('0x3a')]);_0x28101b[_0x28d0('0x3b')]=_[_0x28d0('0x4d')](_0x28101b[_0x28d0('0x38')],_0x28101b[_0x28d0('0x3a')]);_0x1378cc[_0x28d0('0x3c')]=_[_0x28d0('0x4d')](_0x28101b[_0x28d0('0x38')],qs['fields'](_0x120706[_0x28d0('0x3a')]['fields']));_0x1378cc[_0x28d0('0x3c')]=_0x1378cc['attributes'][_0x28d0('0x3e')]?_0x1378cc['attributes']:_0x28101b[_0x28d0('0x38')];if(_0x120706[_0x28d0('0x3a')][_0x28d0('0x49')]){_0x1378cc['include']=[{'all':!![]}];}_0x1378cc=_['merge']({},_0x1378cc,_0x120706[_0x28d0('0x4e')]);return db[_0x28d0('0x36')][_0x28d0('0x4f')](_0x1378cc)['then'](handleEntityNotFound(_0x1eccb2,null))[_0x28d0('0x1d')](respondWithResult(_0x1eccb2,null))[_0x28d0('0x26')](handleError(_0x1eccb2,null));};exports['create']=function(_0x2b8e1a,_0x3e7a01){return db[_0x28d0('0x36')][_0x28d0('0x50')](_0x2b8e1a[_0x28d0('0x51')],{})[_0x28d0('0x1d')](respondWithResult(_0x3e7a01,0xc9))[_0x28d0('0x26')](handleError(_0x3e7a01,null));};exports['update']=function(_0x17384a,_0x2714e8){if(_0x17384a[_0x28d0('0x51')]['id']){delete _0x17384a[_0x28d0('0x51')]['id'];}return db[_0x28d0('0x36')]['find']({'where':{'id':_0x17384a[_0x28d0('0x52')]['id']}})[_0x28d0('0x1d')](handleEntityNotFound(_0x2714e8,null))['then'](saveUpdates(_0x17384a['body'],null))[_0x28d0('0x1d')](respondWithResult(_0x2714e8,null))[_0x28d0('0x26')](handleError(_0x2714e8,null));};exports[_0x28d0('0x31')]=function(_0x151fa4,_0x1acb18){return db[_0x28d0('0x36')][_0x28d0('0x4f')]({'where':{'id':_0x151fa4[_0x28d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x1acb18,null))['then'](removeEntity(_0x1acb18,null))[_0x28d0('0x26')](handleError(_0x1acb18,null));};exports[_0x28d0('0x53')]=function(_0x39a47f,_0x9ac229,_0x3e392d){var _0x4f927e={};var _0xf4a4ca={};var _0x6cbb0a;var _0x49b5e5;return db['Dynamics365Account'][_0x28d0('0x54')]({'where':{'id':_0x39a47f[_0x28d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x9ac229,null))[_0x28d0('0x1d')](function(_0x33a619){if(_0x33a619){_0x6cbb0a=_0x33a619;_0xf4a4ca[_0x28d0('0x38')]=_[_0x28d0('0x39')](db['Dynamics365Configuration']['rawAttributes']);_0xf4a4ca['query']=_[_0x28d0('0x39')](_0x39a47f[_0x28d0('0x3a')]);_0xf4a4ca[_0x28d0('0x3b')]=_['intersection'](_0xf4a4ca[_0x28d0('0x38')],_0xf4a4ca['query']);_0x4f927e['attributes']=_[_0x28d0('0x4d')](_0xf4a4ca[_0x28d0('0x38')],qs[_0x28d0('0x3d')](_0x39a47f[_0x28d0('0x3a')]['fields']));_0x4f927e[_0x28d0('0x3c')]=_0x4f927e['attributes']['length']?_0x4f927e[_0x28d0('0x3c')]:_0xf4a4ca[_0x28d0('0x38')];_0x4f927e[_0x28d0('0x40')]=qs[_0x28d0('0x41')](_0x39a47f[_0x28d0('0x3a')][_0x28d0('0x41')]);_0x4f927e[_0x28d0('0x44')]=qs[_0x28d0('0x3b')](_[_0x28d0('0x42')](_0x39a47f[_0x28d0('0x3a')],_0xf4a4ca['filters']));if(_0x39a47f['query'][_0x28d0('0x43')]){_0x4f927e[_0x28d0('0x44')]=_['merge'](_0x4f927e[_0x28d0('0x44')],{'$or':_['map'](_0x4f927e[_0x28d0('0x3c')],function(_0x26bf97){var _0x2f1253={};_0x2f1253[_0x26bf97]={'$like':'%'+_0x39a47f[_0x28d0('0x3a')][_0x28d0('0x43')]+'%'};return _0x2f1253;})});}_0x4f927e=_[_0x28d0('0x45')]({},_0x4f927e,_0x39a47f[_0x28d0('0x4e')]);return _0x6cbb0a['getConfigurations'](_0x4f927e);}})[_0x28d0('0x1d')](function(_0x598c36){if(_0x598c36){_0x49b5e5=_0x598c36[_0x28d0('0x3e')];if(!_0x39a47f['query'][_0x28d0('0x3f')](_0x28d0('0x55'))){_0x4f927e[_0x28d0('0x2c')]=qs[_0x28d0('0x2c')](_0x39a47f[_0x28d0('0x3a')]['limit']);_0x4f927e[_0x28d0('0x2b')]=qs[_0x28d0('0x2b')](_0x39a47f['query'][_0x28d0('0x2b')]);}return _0x6cbb0a[_0x28d0('0x53')](_0x4f927e);}})[_0x28d0('0x1d')](function(_0x3f4545){if(_0x3f4545){return _0x3f4545?{'count':_0x49b5e5,'rows':_0x3f4545}:null;}})[_0x28d0('0x1d')](respondWithResult(_0x9ac229,null))[_0x28d0('0x26')](handleError(_0x9ac229,null));};exports[_0x28d0('0x56')]=function(_0x3a1842,_0x26973a,_0x3cc355){if(_0x3a1842[_0x28d0('0x51')]['id']){delete _0x3a1842[_0x28d0('0x51')]['id'];}return db['Dynamics365Account'][_0x28d0('0x54')]({'where':{'id':_0x3a1842[_0x28d0('0x52')]['id']}})[_0x28d0('0x1d')](handleEntityNotFound(_0x26973a,null))[_0x28d0('0x1d')](function(_0x498f66){if(_0x498f66){_0x3a1842[_0x28d0('0x51')][_0x28d0('0x57')]=_0x498f66['id'];_0x3a1842['body'][_0x28d0('0x58')]=integrations[_0x28d0('0x59')](_0x3a1842['body'][_0x28d0('0x5a')],_0x3a1842['body'][_0x28d0('0x5b')]);_0x3a1842[_0x28d0('0x51')][_0x28d0('0x5c')]=integrations[_0x28d0('0x5d')](_0x3a1842['body'][_0x28d0('0x5a')],_0x3a1842['body'][_0x28d0('0x5b')]);return db[_0x28d0('0x5e')]['create'](_0x3a1842['body'],{'include':[{'model':db[_0x28d0('0x5f')],'as':'Subjects'},{'model':db[_0x28d0('0x5f')],'as':_0x28d0('0x5c')}]});}return null;})[_0x28d0('0x1d')](respondWithResult(_0x26973a,null))[_0x28d0('0x26')](handleError(_0x26973a,null));};exports[_0x28d0('0x60')]=function(_0x2d13bb,_0x5ca567,_0x531d9d){var _0x41dd46=_0x2d13bb[_0x28d0('0x3a')][_0x28d0('0x61')];var _0x577383=_0x41dd46===_0x28d0('0x62')?_0x28d0('0x63'):'PhoneCall';var _0x38058f='';var _0x12dd8b='';var _0x9cb935='';var _0x8fa4b1='';var _0x4e41ae='';var _0x28abfa='';var _0x163dba='';var _0x723196='';var _0x40a551=[_0x28d0('0x64'),_0x28d0('0x65'),_0x28d0('0x66'),_0x28d0('0x67'),_0x28d0('0x68'),_0x28d0('0x69'),'phonenumber',_0x28d0('0x6a'),'directioncode',_0x28d0('0x6b')];var _0xd849b0=[_0x28d0('0x6c'),_0x28d0('0x6d'),'actualserviceunits',_0x28d0('0x6e'),'contactidname',_0x28d0('0x6f'),'contractdetailidname',_0x28d0('0x70'),_0x28d0('0x71'),_0x28d0('0x72'),_0x28d0('0x73'),'createdbyyominame',_0x28d0('0x74'),'createdonbehalfbyname',_0x28d0('0x75'),_0x28d0('0x76'),_0x28d0('0x77'),'customeridyominame',_0x28d0('0x78'),_0x28d0('0x79'),_0x28d0('0x7a'),_0x28d0('0x7b'),'escalatedon','exchangerate',_0x28d0('0x7c'),_0x28d0('0x7d'),'importsequencenumber',_0x28d0('0x7e'),'kbarticleidname',_0x28d0('0x7f'),'masteridname','modifiedbyexternalpartyname',_0x28d0('0x80'),_0x28d0('0x81'),_0x28d0('0x82'),_0x28d0('0x83'),_0x28d0('0x84'),_0x28d0('0x85'),_0x28d0('0x86'),_0x28d0('0x87'),_0x28d0('0x88'),'onholdtime','overriddencreatedon',_0x28d0('0x89'),_0x28d0('0x8a'),_0x28d0('0x8b'),'parentcaseidname',_0x28d0('0x8c'),'primarycontactidyominame',_0x28d0('0x8d'),_0x28d0('0x8e'),_0x28d0('0x8f'),_0x28d0('0x90'),_0x28d0('0x91'),'responseby',_0x28d0('0x92'),_0x28d0('0x93'),_0x28d0('0x94'),'slainvokedidname',_0x28d0('0x95'),_0x28d0('0x96'),_0x28d0('0x97'),_0x28d0('0x98'),_0x28d0('0x99'),_0x28d0('0x9a'),'timezoneruleversionnumber',_0x28d0('0x9b'),_0x28d0('0x9c'),_0x28d0('0x9d'),'versionnumber'];var _0x13f757=_0x40a551['concat'](_0xd849b0);return db[_0x28d0('0x36')][_0x28d0('0x54')]({'where':{'id':_0x2d13bb[_0x28d0('0x52')]['id']},'attributes':['id','username','password',_0x28d0('0x9e'),_0x28d0('0x9f'),'clientId',_0x28d0('0xa0')]})[_0x28d0('0x1d')](handleEntityNotFound(_0x5ca567,null))['then'](function(_0x47ce0a){if(_0x47ce0a){_0x723196=_0x47ce0a['remoteUri'];var _0x52e1ea=_0x723196[_0x28d0('0xa1')](-0x1);if(_0x52e1ea==='/'){_0x723196=_0x723196[_0x28d0('0xa2')](0x0,_0x723196[_0x28d0('0xa3')](_0x52e1ea));}_0x163dba=util[_0x28d0('0xa4')](_0x28d0('0xa5'),_0x723196);var _0x46cf15={'method':_0x28d0('0xa6'),'uri':'https://login.microsoftonline.com/'+_0x47ce0a[_0x28d0('0x9f')]+'/oauth2/token','form':{'client_id':_0x47ce0a[_0x28d0('0xa7')],'resource':_0x723196,'username':_0x47ce0a[_0x28d0('0xa8')],'password':_0x47ce0a[_0x28d0('0xa9')],'grant_type':'password','client_secret':_0x47ce0a['clientSecret']},'json':!![]};return rp(_0x46cf15);}})[_0x28d0('0x1d')](function(_0x14d184){_0x28abfa=_0x14d184[_0x28d0('0xaa')];var _0x38641a={'method':_0x28d0('0xab'),'uri':encodeURI(_0x163dba+_0x28d0('0xac')+_0x577383+'\x27'),'headers':{'Authorization':_0x28d0('0xad')+_0x28abfa,'If-None-Match':null,'OData-Version':_0x28d0('0xae')},'json':!![]};return rp(_0x38641a);})['then'](function(_0x33b165){var _0xbd06fa=_0x33b165[_0x28d0('0xaf')][0x0];var _0x35d716=_0xbd06fa[_0x28d0('0xb0')];var _0x3e42e5={'method':'GET','uri':_0x163dba+_0x28d0('0xb1')+_0x35d716+_0x28d0('0xb2'),'headers':{'Authorization':_0x28d0('0xad')+_0x28abfa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e42e5);})[_0x28d0('0x1d')](function(_0x347d85){_0x38058f=_0x347d85;_0x12dd8b=_0x38058f['Attributes'];_0x12dd8b=_[_0x28d0('0xb3')](_0x12dd8b,function(_0x47a3e2){return!_0x13f757[_0x28d0('0xb4')](_0x47a3e2[_0x28d0('0xb5')]);});var _0x5f35e6=[];var _0x136e0b=[];_0x12dd8b['forEach'](function(_0x593c87){if(_0x593c87[_0x28d0('0xb6')]){var _0x582443=_0x593c87[_0x28d0('0xb6')]['substring'](_0x593c87[_0x28d0('0xb6')]['lastIndexOf']('.')+0x1);if(_0x582443===_0x28d0('0xb7')){_0x5f35e6[_0x28d0('0xb8')](getSelectList(_0x163dba,_0x41dd46,_0x136e0b,_0x38058f['MetadataId'],_0x593c87[_0x28d0('0xb0')],_0x28abfa));}}});return Promise[_0x28d0('0xb9')](_0x5f35e6);})[_0x28d0('0x1d')](function(_0x2ebbb0){_0x9cb935=_0x2ebbb0[0x0];var _0xe87da0=[];var _0x2c411e=[];_0x12dd8b[_0x28d0('0xba')](function(_0x552de3){if(!_[_0x28d0('0xbb')](_0x552de3[_0x28d0('0xb6')])){var _0x21a8d1=_0x552de3[_0x28d0('0xb6')][_0x28d0('0xa2')](_0x552de3['@odata.type']['lastIndexOf']('.')+0x1);if(_0x21a8d1===_0x28d0('0xbc')){_0xe87da0[_0x28d0('0xb8')](getBooleanList(_0x163dba,_0x41dd46,_0x2c411e,_0x38058f[_0x28d0('0xb0')],_0x552de3[_0x28d0('0xb0')],_0x28abfa));}}});return Promise['all'](_0xe87da0);})[_0x28d0('0x1d')](function(_0x2afab1){_0x8fa4b1=_0x2afab1[0x0];var _0x553c5c=[];var _0x1d7fef=[];_0x12dd8b[_0x28d0('0xba')](function(_0xfdf196){if(_0xfdf196['@odata.type']){var _0x407245=_0xfdf196[_0x28d0('0xb6')]['substring'](_0xfdf196['@odata.type'][_0x28d0('0xa3')]('.')+0x1);if(_0x407245===_0x28d0('0xbd')||_0x407245===_0x28d0('0xbe')||_0x407245==='BigIntAttributeMetadata'||_0x407245===_0x28d0('0xbf')||_0x407245===_0x28d0('0xc0')||_0x407245==='DateTimeAttributeMetadata'||_0x407245===_0x28d0('0xc1')||_0x407245===_0x28d0('0xc2')||_0x407245==='StateAttributeMetadata'||_0x407245==='DecimalAttributeMetadata'){_0x553c5c['push'](getInputList(_0x163dba,_0x41dd46,_0x407245,_0x1d7fef,_0x38058f[_0x28d0('0xb0')],_0xfdf196[_0x28d0('0xb0')],_0x28abfa));}}});return Promise[_0x28d0('0xb9')](_0x553c5c);})[_0x28d0('0x1d')](function(_0x3f5117){_0x4e41ae=_0x3f5117[0x0];var _0x41648a=_0x9cb935[_0x28d0('0xc3')](_0x8fa4b1)[_0x28d0('0xc3')](_0x4e41ae);var _0x4e4a58={'count':_0x41648a[_0x28d0('0x3e')],'rows':_0x41648a};return _0x4e4a58;})[_0x28d0('0x1d')](respondWithResult(_0x5ca567,null))['catch'](function(_0x5f2163){console[_0x28d0('0xc4')]('Dynamics365\x20error:\x20'+_0x5f2163);var _0x16cbcb=_0x2d13bb[_0x28d0('0x3a')][_0x28d0('0xc5')]?0x1f4:_0x5f2163['statusCode']||0x1f4;logger[_0x28d0('0x22')](_0x5f2163[_0x28d0('0x32')]);delete _0x5f2163[_0x28d0('0x33')];if(_0x16cbcb===0x191){_0x16cbcb=0x190;}_0x5ca567[_0x28d0('0x28')](_0x16cbcb)[_0x28d0('0x34')](_0x2d13bb[_0x28d0('0x3a')]['test']?{'message':_0x28d0('0xc6'),'statusCode':_0x5f2163[_0x28d0('0xc7')]}:_0x5f2163);});};function getSelectList(_0x1ca5dc,_0x39dc02,_0x330a02,_0x5a7e9e,_0x3cde14,_0x13f112){var _0x2acee7={'method':_0x28d0('0xab'),'uri':_0x1ca5dc+_0x28d0('0xb1')+_0x5a7e9e+_0x28d0('0xc8')+_0x3cde14+_0x28d0('0xc9')+_0x28d0('0xca'),'headers':{'Authorization':_0x28d0('0xad')+_0x13f112,'If-None-Match':null,'OData-Version':_0x28d0('0xae')},'json':!![]};return rp(_0x2acee7)[_0x28d0('0x1d')](function(_0x4a0916){var _0x8d3562=[];var _0x1b8a03=_0x4a0916[_0x28d0('0xcb')]['Options'];_0x1b8a03[_0x28d0('0xba')](function(_0x63e05){_0x8d3562[_0x28d0('0xb8')]({'name':_0x63e05[_0x28d0('0xcc')][_0x28d0('0xcd')][_0x28d0('0xcc')],'value':String(_0x63e05['Value'])});});var _0x1785e2={'id':_0x39dc02+'_'+_0x4a0916[_0x28d0('0xb5')],'name':_0x4a0916['DisplayName'][_0x28d0('0xcd')][_0x28d0('0xcc')],'custom':![],'options':_0x8d3562};_0x330a02['push'](_0x1785e2);return _0x330a02;});}function getBooleanList(_0xa3fff,_0x228a4c,_0x19f16b,_0x1a38f3,_0x256c83,_0x3b16ae){var _0x399c16={'method':'GET','uri':_0xa3fff+'EntityDefinitions('+_0x1a38f3+')/Attributes('+_0x256c83+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x28d0('0xad')+_0x3b16ae,'If-None-Match':null,'OData-Version':_0x28d0('0xae')},'json':!![]};return rp(_0x399c16)['then'](function(_0x534029){var _0x3e0137=[];_0x3e0137[_0x28d0('0xb8')]({'name':_0x534029[_0x28d0('0xcb')][_0x28d0('0xce')][_0x28d0('0xcc')]['UserLocalizedLabel']['Label'],'value':_0x28d0('0xcf')},{'name':_0x534029[_0x28d0('0xcb')][_0x28d0('0xd0')]['Label'][_0x28d0('0xcd')][_0x28d0('0xcc')],'value':'false'});var _0x6b33b9={'id':_0x228a4c+'_'+_0x534029[_0x28d0('0xb5')],'name':_0x534029[_0x28d0('0xd1')][_0x28d0('0xcd')][_0x28d0('0xcc')],'custom':![],'options':_0x3e0137};_0x19f16b['push'](_0x6b33b9);return _0x19f16b;});}function getInputList(_0x213c85,_0x42c690,_0x21e95c,_0x237a75,_0x1104e5,_0x4eb01a,_0x521336){var _0x30f790={'method':_0x28d0('0xab'),'uri':_0x213c85+_0x28d0('0xb1')+_0x1104e5+_0x28d0('0xc8')+_0x4eb01a+_0x28d0('0xd2')+_0x21e95c+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x28d0('0xad')+_0x521336,'If-None-Match':null,'OData-Version':_0x28d0('0xae')},'json':!![]};return rp(_0x30f790)[_0x28d0('0x1d')](function(_0x2665bf){var _0x231bcc={'id':_0x42c690+'_'+_0x2665bf[_0x28d0('0xb5')],'name':_0x2665bf[_0x28d0('0xd1')][_0x28d0('0xcd')]?_0x2665bf['DisplayName'][_0x28d0('0xcd')][_0x28d0('0xcc')]:_0x2665bf['LogicalName'],'custom':![],'options':[]};_0x237a75[_0x28d0('0xb8')](_0x231bcc);return _0x237a75;});} \ No newline at end of file +var _0x0d6a=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','sendStatus','name','index','Dynamics365Account','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','findAll','rows','show','intersection','includeAll','find','create','body','params','findOne','Dynamics365Configuration','filter','addConfiguration','Subjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','https://login.microsoftonline.com/','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','log','Dynamics365\x20error:\x20','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x28333,_0x4c1a78){var _0x4e7615=function(_0x3ed8aa){while(--_0x3ed8aa){_0x28333['push'](_0x28333['shift']());}};_0x4e7615(++_0x4c1a78);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x0d6a[_0x5d80de];return _0x1c7556;};'use strict';var pdf=require(_0xa0d6('0x0'));var emlformat=require(_0xa0d6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa0d6('0x2'));var jsonpatch=require(_0xa0d6('0x3'));var rp=require(_0xa0d6('0x4'));var moment=require(_0xa0d6('0x5'));var BPromise=require(_0xa0d6('0x6'));var Mustache=require(_0xa0d6('0x7'));var util=require(_0xa0d6('0x8'));var path=require(_0xa0d6('0x9'));var sox=require(_0xa0d6('0xa'));var csv=require(_0xa0d6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa0d6('0xc'));var squel=require(_0xa0d6('0xd'));var crypto=require(_0xa0d6('0xe'));var jsforce=require(_0xa0d6('0xf'));var deskjs=require(_0xa0d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa0d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xa0d6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa0d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0d6('0x14'))(_0xa0d6('0x15'));var utils=require(_0xa0d6('0x16'));var config=require(_0xa0d6('0x17'));var db=require(_0xa0d6('0x18'))['db'];var integrations=require(_0xa0d6('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xa0d6('0x1a')][_0xa0d6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x27aa06,_0x5db766,_0x1d395e){if(_0x1d395e){var _0x216b3b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x216b3b[_0xa0d6('0x1c')](_0x5db766)){return _0x27aa06;}else{throw new Error(_0xa0d6('0x1d'));}}else{return _0x27aa06;}}function respondWithRpcPromise(_0x3c3c15,_0x3fcfb7,_0x25ff19,_0x4a0f3a){return new BPromise(function(_0x5ddf29,_0x39e63f){var _0x3f8ed3=_0x4a0f3a||client;return _0x3f8ed3[_0xa0d6('0x1e')](_0x3c3c15,_0x25ff19)[_0xa0d6('0x1f')](function(_0x1e8b82){logger[_0xa0d6('0x20')](_0xa0d6('0x21'),_0x3fcfb7,'request\x20sent');logger[_0xa0d6('0x22')](_0xa0d6('0x23'),_0x3fcfb7,_0xa0d6('0x24'),JSON['stringify'](_0x1e8b82));if(_0x1e8b82[_0xa0d6('0x25')]){if(_0x1e8b82['error'][_0xa0d6('0x26')]===0x1f4){logger['error'](_0xa0d6('0x21'),_0x3fcfb7,_0x1e8b82[_0xa0d6('0x25')][_0xa0d6('0x27')]);return _0x39e63f(_0x1e8b82[_0xa0d6('0x25')][_0xa0d6('0x27')]);}logger[_0xa0d6('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x3fcfb7,_0x1e8b82[_0xa0d6('0x25')][_0xa0d6('0x27')]);return _0x5ddf29(_0x1e8b82['error'][_0xa0d6('0x27')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x3fcfb7,_0xa0d6('0x24'));_0x5ddf29(_0x1e8b82[_0xa0d6('0x28')][_0xa0d6('0x27')]);}})[_0xa0d6('0x29')](function(_0x469c42){logger[_0xa0d6('0x25')](_0xa0d6('0x21'),_0x3fcfb7,_0x469c42);_0x39e63f(_0x469c42);});});}function respondWithStatusCode(_0x10b37f,_0x3f15d0){_0x3f15d0=_0x3f15d0||0xcc;return function(_0x338b17){if(_0x338b17){return _0x10b37f['sendStatus'](_0x3f15d0);}return _0x10b37f[_0xa0d6('0x2a')](_0x3f15d0)[_0xa0d6('0x2b')]();};}function respondWithResult(_0x621e42,_0x2656c5){_0x2656c5=_0x2656c5||0xc8;return function(_0x173838){if(_0x173838){return _0x621e42[_0xa0d6('0x2a')](_0x2656c5)[_0xa0d6('0x2c')](_0x173838);}};}function respondWithFilteredResult(_0x437150,_0xcb7cf2){return function(_0x28abb2){if(_0x28abb2){var _0x3ba11c=_0x28abb2[_0xa0d6('0x2d')],_0x7d731f=_0xcb7cf2[_0xa0d6('0x2e')],_0x414b84=_0xcb7cf2[_0xa0d6('0x2e')]+_0xcb7cf2[_0xa0d6('0x2f')],_0x382a37;if(_0x414b84>=_0x3ba11c){_0x414b84=_0x3ba11c;_0x382a37=0xc8;}else{_0x382a37=0xce;}_0x437150[_0xa0d6('0x2a')](_0x382a37);return _0x437150[_0xa0d6('0x30')](_0xa0d6('0x31'),_0x7d731f+'-'+_0x414b84+'/'+_0x3ba11c)[_0xa0d6('0x2c')](_0x28abb2);}return null;};}function patchUpdates(_0xa62bf6){return function(_0x471984){try{jsonpatch['apply'](_0x471984,_0xa62bf6,!![]);}catch(_0x1a811f){return BPromise['reject'](_0x1a811f);}return _0x471984[_0xa0d6('0x32')]();};}function saveUpdates(_0x266675,_0x369196){return function(_0x525c40){if(_0x525c40){return _0x525c40[_0xa0d6('0x33')](_0x266675)[_0xa0d6('0x1f')](function(_0x5e7084){return _0x5e7084;});}return null;};}function removeEntity(_0x28f597,_0x4253b4){return function(_0x556746){if(_0x556746){return _0x556746[_0xa0d6('0x34')]()[_0xa0d6('0x1f')](function(){_0x28f597['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e48dc,_0x161cda){return function(_0x5e5be8){if(!_0x5e5be8){_0x2e48dc[_0xa0d6('0x35')](0x194);}return _0x5e5be8;};}function handleError(_0x2f8a3c,_0x4d5dc4){_0x4d5dc4=_0x4d5dc4||0x1f4;return function(_0xe323b1){logger[_0xa0d6('0x25')](_0xe323b1['stack']);if(_0xe323b1[_0xa0d6('0x36')]){delete _0xe323b1[_0xa0d6('0x36')];}_0x2f8a3c['status'](_0x4d5dc4)['send'](_0xe323b1);};}exports[_0xa0d6('0x37')]=function(_0x2d84c2,_0xd13f64){var _0x4369fd={},_0x5aba86={},_0x41fbe3={'count':0x0,'rows':[]};var _0x4dbdaa=db[_0xa0d6('0x38')][_0xa0d6('0x39')];_0x5aba86[_0xa0d6('0x3a')]=_[_0xa0d6('0x3b')](_0x4dbdaa);_0x5aba86[_0xa0d6('0x3c')]=_[_0xa0d6('0x3b')](_0x2d84c2[_0xa0d6('0x3c')]);_0x5aba86[_0xa0d6('0x3d')]=_['intersection'](_0x5aba86[_0xa0d6('0x3a')],_0x5aba86[_0xa0d6('0x3c')]);_0x4369fd[_0xa0d6('0x3e')]=_['intersection'](_0x5aba86['model'],qs[_0xa0d6('0x3f')](_0x2d84c2['query'][_0xa0d6('0x3f')]));_0x4369fd[_0xa0d6('0x3e')]=_0x4369fd['attributes'][_0xa0d6('0x40')]?_0x4369fd[_0xa0d6('0x3e')]:_0x5aba86[_0xa0d6('0x3a')];if(!_0x2d84c2[_0xa0d6('0x3c')][_0xa0d6('0x41')](_0xa0d6('0x42'))){_0x4369fd['limit']=qs[_0xa0d6('0x2f')](_0x2d84c2[_0xa0d6('0x3c')][_0xa0d6('0x2f')]);_0x4369fd[_0xa0d6('0x2e')]=qs[_0xa0d6('0x2e')](_0x2d84c2['query'][_0xa0d6('0x2e')]);}_0x4369fd[_0xa0d6('0x43')]=qs['sort'](_0x2d84c2[_0xa0d6('0x3c')][_0xa0d6('0x44')]);_0x4369fd[_0xa0d6('0x45')]=qs[_0xa0d6('0x3d')](_[_0xa0d6('0x46')](_0x2d84c2[_0xa0d6('0x3c')],_0x5aba86[_0xa0d6('0x3d')]));if(_0x2d84c2[_0xa0d6('0x3c')]['filter']){_0x4369fd['where']=_[_0xa0d6('0x47')](_0x4369fd[_0xa0d6('0x45')],{'$or':_[_0xa0d6('0x48')](_0x4dbdaa,function(_0x1fbc49){if(_0x1fbc49[_0xa0d6('0x49')][_0xa0d6('0x4a')]!==_0xa0d6('0x4b')){var _0x256a8b={};_0x256a8b[_0x1fbc49[_0xa0d6('0x4c')]]={'$like':'%'+_0x2d84c2[_0xa0d6('0x3c')]['filter']+'%'};return _0x256a8b;}})});}_0x4369fd=_[_0xa0d6('0x47')]({},_0x4369fd,_0x2d84c2[_0xa0d6('0x4d')]);var _0x222a5b={'where':_0x4369fd[_0xa0d6('0x45')]};return db['Dynamics365Account'][_0xa0d6('0x2d')](_0x222a5b)[_0xa0d6('0x1f')](function(_0x362199){_0x41fbe3[_0xa0d6('0x2d')]=_0x362199;if(_0x2d84c2[_0xa0d6('0x3c')]['includeAll']){_0x4369fd['include']=[{'all':!![]}];}return db[_0xa0d6('0x38')][_0xa0d6('0x4e')](_0x4369fd);})[_0xa0d6('0x1f')](function(_0x585b82){_0x41fbe3[_0xa0d6('0x4f')]=_0x585b82;return _0x41fbe3;})['then'](respondWithFilteredResult(_0xd13f64,_0x4369fd))[_0xa0d6('0x29')](handleError(_0xd13f64,null));};exports[_0xa0d6('0x50')]=function(_0x5f49ff,_0x190f30){var _0x2e29e2={'raw':![],'where':{'id':_0x5f49ff['params']['id']}},_0x3739df={};_0x3739df[_0xa0d6('0x3a')]=_[_0xa0d6('0x3b')](db[_0xa0d6('0x38')][_0xa0d6('0x39')]);_0x3739df[_0xa0d6('0x3c')]=_[_0xa0d6('0x3b')](_0x5f49ff[_0xa0d6('0x3c')]);_0x3739df[_0xa0d6('0x3d')]=_[_0xa0d6('0x51')](_0x3739df[_0xa0d6('0x3a')],_0x3739df['query']);_0x2e29e2['attributes']=_[_0xa0d6('0x51')](_0x3739df[_0xa0d6('0x3a')],qs[_0xa0d6('0x3f')](_0x5f49ff[_0xa0d6('0x3c')][_0xa0d6('0x3f')]));_0x2e29e2[_0xa0d6('0x3e')]=_0x2e29e2['attributes'][_0xa0d6('0x40')]?_0x2e29e2['attributes']:_0x3739df[_0xa0d6('0x3a')];if(_0x5f49ff[_0xa0d6('0x3c')][_0xa0d6('0x52')]){_0x2e29e2['include']=[{'all':!![]}];}_0x2e29e2=_[_0xa0d6('0x47')]({},_0x2e29e2,_0x5f49ff[_0xa0d6('0x4d')]);return db[_0xa0d6('0x38')][_0xa0d6('0x53')](_0x2e29e2)['then'](handleEntityNotFound(_0x190f30,null))[_0xa0d6('0x1f')](respondWithResult(_0x190f30,null))[_0xa0d6('0x29')](handleError(_0x190f30,null));};exports[_0xa0d6('0x54')]=function(_0x5eceb7,_0x1526d6){return db['Dynamics365Account']['create'](_0x5eceb7[_0xa0d6('0x55')],{})[_0xa0d6('0x1f')](respondWithResult(_0x1526d6,0xc9))[_0xa0d6('0x29')](handleError(_0x1526d6,null));};exports[_0xa0d6('0x33')]=function(_0xdc1751,_0x17bf7f){if(_0xdc1751[_0xa0d6('0x55')]['id']){delete _0xdc1751[_0xa0d6('0x55')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0xdc1751[_0xa0d6('0x56')]['id']}})['then'](handleEntityNotFound(_0x17bf7f,null))[_0xa0d6('0x1f')](saveUpdates(_0xdc1751[_0xa0d6('0x55')],null))[_0xa0d6('0x1f')](respondWithResult(_0x17bf7f,null))[_0xa0d6('0x29')](handleError(_0x17bf7f,null));};exports[_0xa0d6('0x34')]=function(_0x1a361c,_0x5cce68){return db[_0xa0d6('0x38')]['find']({'where':{'id':_0x1a361c['params']['id']}})[_0xa0d6('0x1f')](handleEntityNotFound(_0x5cce68,null))[_0xa0d6('0x1f')](removeEntity(_0x5cce68,null))[_0xa0d6('0x29')](handleError(_0x5cce68,null));};exports['getConfigurations']=function(_0x207aef,_0x1bd2d9,_0x11055f){var _0x256dd9={};var _0x2f87bc={};var _0x537cc4;var _0x1614aa;return db[_0xa0d6('0x38')][_0xa0d6('0x57')]({'where':{'id':_0x207aef[_0xa0d6('0x56')]['id']}})[_0xa0d6('0x1f')](handleEntityNotFound(_0x1bd2d9,null))[_0xa0d6('0x1f')](function(_0x19dc08){if(_0x19dc08){_0x537cc4=_0x19dc08;_0x2f87bc['model']=_['keys'](db[_0xa0d6('0x58')][_0xa0d6('0x39')]);_0x2f87bc[_0xa0d6('0x3c')]=_[_0xa0d6('0x3b')](_0x207aef[_0xa0d6('0x3c')]);_0x2f87bc[_0xa0d6('0x3d')]=_['intersection'](_0x2f87bc[_0xa0d6('0x3a')],_0x2f87bc['query']);_0x256dd9[_0xa0d6('0x3e')]=_[_0xa0d6('0x51')](_0x2f87bc['model'],qs[_0xa0d6('0x3f')](_0x207aef['query'][_0xa0d6('0x3f')]));_0x256dd9['attributes']=_0x256dd9[_0xa0d6('0x3e')]['length']?_0x256dd9['attributes']:_0x2f87bc[_0xa0d6('0x3a')];_0x256dd9['order']=qs[_0xa0d6('0x44')](_0x207aef[_0xa0d6('0x3c')][_0xa0d6('0x44')]);_0x256dd9['where']=qs[_0xa0d6('0x3d')](_[_0xa0d6('0x46')](_0x207aef[_0xa0d6('0x3c')],_0x2f87bc[_0xa0d6('0x3d')]));if(_0x207aef['query'][_0xa0d6('0x59')]){_0x256dd9[_0xa0d6('0x45')]=_[_0xa0d6('0x47')](_0x256dd9[_0xa0d6('0x45')],{'$or':_[_0xa0d6('0x48')](_0x256dd9[_0xa0d6('0x3e')],function(_0x39051d){var _0x2e6caf={};_0x2e6caf[_0x39051d]={'$like':'%'+_0x207aef[_0xa0d6('0x3c')][_0xa0d6('0x59')]+'%'};return _0x2e6caf;})});}_0x256dd9=_[_0xa0d6('0x47')]({},_0x256dd9,_0x207aef[_0xa0d6('0x4d')]);return _0x537cc4['getConfigurations'](_0x256dd9);}})[_0xa0d6('0x1f')](function(_0x3d3e4d){if(_0x3d3e4d){_0x1614aa=_0x3d3e4d[_0xa0d6('0x40')];if(!_0x207aef[_0xa0d6('0x3c')][_0xa0d6('0x41')](_0xa0d6('0x42'))){_0x256dd9['limit']=qs[_0xa0d6('0x2f')](_0x207aef[_0xa0d6('0x3c')][_0xa0d6('0x2f')]);_0x256dd9['offset']=qs[_0xa0d6('0x2e')](_0x207aef[_0xa0d6('0x3c')][_0xa0d6('0x2e')]);}return _0x537cc4['getConfigurations'](_0x256dd9);}})[_0xa0d6('0x1f')](function(_0xcffab2){if(_0xcffab2){return _0xcffab2?{'count':_0x1614aa,'rows':_0xcffab2}:null;}})[_0xa0d6('0x1f')](respondWithResult(_0x1bd2d9,null))[_0xa0d6('0x29')](handleError(_0x1bd2d9,null));};exports[_0xa0d6('0x5a')]=function(_0x38a6a5,_0x1169e1,_0x4d6eba){if(_0x38a6a5['body']['id']){delete _0x38a6a5['body']['id'];}return db[_0xa0d6('0x38')][_0xa0d6('0x57')]({'where':{'id':_0x38a6a5[_0xa0d6('0x56')]['id']}})['then'](handleEntityNotFound(_0x1169e1,null))[_0xa0d6('0x1f')](function(_0x5a9aa3){if(_0x5a9aa3){_0x38a6a5[_0xa0d6('0x55')]['AccountId']=_0x5a9aa3['id'];_0x38a6a5['body'][_0xa0d6('0x5b')]=integrations['getSubjects'](_0x38a6a5[_0xa0d6('0x55')]['channel'],_0x38a6a5['body']['type']);_0x38a6a5[_0xa0d6('0x55')]['Descriptions']=integrations['getDescriptions'](_0x38a6a5['body'][_0xa0d6('0x5c')],_0x38a6a5[_0xa0d6('0x55')][_0xa0d6('0x49')]);return db[_0xa0d6('0x58')][_0xa0d6('0x54')](_0x38a6a5[_0xa0d6('0x55')],{'include':[{'model':db[_0xa0d6('0x5d')],'as':_0xa0d6('0x5b')},{'model':db[_0xa0d6('0x5d')],'as':_0xa0d6('0x5e')}]});}return null;})[_0xa0d6('0x1f')](respondWithResult(_0x1169e1,null))[_0xa0d6('0x29')](handleError(_0x1169e1,null));};exports[_0xa0d6('0x5f')]=function(_0x55ee1b,_0x1cb860,_0x4e0483){var _0x246e21=_0x55ee1b['query'][_0xa0d6('0x60')];var _0x12a8f0=_0x246e21==='incident'?_0xa0d6('0x61'):_0xa0d6('0x62');var _0x401f73='';var _0x534d8c='';var _0x1fcd5e='';var _0x31a59b='';var _0x2ab3a0='';var _0x413218='';var _0x17581c='';var _0x4ce1cf='';var _0x4b3a55=[_0xa0d6('0x63'),'description',_0xa0d6('0x64'),_0xa0d6('0x65'),_0xa0d6('0x66'),'subject','phonenumber','regardingobjectid',_0xa0d6('0x67'),_0xa0d6('0x68')];var _0x482aa1=['accountidname','accountidyominame',_0xa0d6('0x69'),_0xa0d6('0x6a'),_0xa0d6('0x6b'),'contactidyominame',_0xa0d6('0x6c'),_0xa0d6('0x6d'),_0xa0d6('0x6e'),_0xa0d6('0x6f'),_0xa0d6('0x70'),_0xa0d6('0x71'),_0xa0d6('0x72'),_0xa0d6('0x73'),_0xa0d6('0x74'),_0xa0d6('0x75'),'customeridtype',_0xa0d6('0x76'),_0xa0d6('0x77'),_0xa0d6('0x78'),_0xa0d6('0x79'),_0xa0d6('0x7a'),_0xa0d6('0x7b'),'exchangerate',_0xa0d6('0x7c'),_0xa0d6('0x7d'),'importsequencenumber',_0xa0d6('0x7e'),_0xa0d6('0x7f'),'lastonholdtime','masteridname',_0xa0d6('0x80'),_0xa0d6('0x81'),_0xa0d6('0x82'),_0xa0d6('0x83'),_0xa0d6('0x84'),_0xa0d6('0x85'),_0xa0d6('0x86'),_0xa0d6('0x87'),'msdyn_iotalertname','numberofchildincidents',_0xa0d6('0x88'),'overriddencreatedon','owneridname',_0xa0d6('0x89'),'owneridyominame',_0xa0d6('0x8a'),'primarycontactidname',_0xa0d6('0x8b'),_0xa0d6('0x8c'),_0xa0d6('0x8d'),'productserialnumber',_0xa0d6('0x8e'),_0xa0d6('0x8f'),_0xa0d6('0x90'),_0xa0d6('0x91'),_0xa0d6('0x92'),_0xa0d6('0x93'),_0xa0d6('0x94'),_0xa0d6('0x95'),_0xa0d6('0x96'),_0xa0d6('0x97'),'statuscode',_0xa0d6('0x98'),_0xa0d6('0x99'),'timezoneruleversionnumber',_0xa0d6('0x9a'),_0xa0d6('0x9b'),_0xa0d6('0x9c'),_0xa0d6('0x9d')];var _0x16561e=_0x4b3a55[_0xa0d6('0x9e')](_0x482aa1);return db['Dynamics365Account'][_0xa0d6('0x57')]({'where':{'id':_0x55ee1b[_0xa0d6('0x56')]['id']},'attributes':['id',_0xa0d6('0x9f'),'password',_0xa0d6('0xa0'),_0xa0d6('0xa1'),'clientId',_0xa0d6('0xa2')]})[_0xa0d6('0x1f')](handleEntityNotFound(_0x1cb860,null))['then'](function(_0x394831){if(_0x394831){_0x4ce1cf=_0x394831[_0xa0d6('0xa0')];var _0x1bb4e8=_0x4ce1cf[_0xa0d6('0xa3')](-0x1);if(_0x1bb4e8==='/'){_0x4ce1cf=_0x4ce1cf[_0xa0d6('0xa4')](0x0,_0x4ce1cf[_0xa0d6('0xa5')](_0x1bb4e8));}_0x17581c=util['format']('%s/api/data/v9.0/',_0x4ce1cf);var _0x557a62={'method':'POST','uri':_0xa0d6('0xa6')+_0x394831[_0xa0d6('0xa1')]+'/oauth2/token','form':{'client_id':_0x394831['clientId'],'resource':_0x4ce1cf,'username':_0x394831[_0xa0d6('0x9f')],'password':_0x394831[_0xa0d6('0xa7')],'grant_type':'password','client_secret':_0x394831[_0xa0d6('0xa2')]},'json':!![]};return rp(_0x557a62);}})[_0xa0d6('0x1f')](function(_0x149b1c){_0x413218=_0x149b1c['access_token'];var _0xc817fb={'method':_0xa0d6('0xa8'),'uri':encodeURI(_0x17581c+_0xa0d6('0xa9')+_0x12a8f0+'\x27'),'headers':{'Authorization':_0xa0d6('0xaa')+_0x413218,'If-None-Match':null,'OData-Version':_0xa0d6('0xab')},'json':!![]};return rp(_0xc817fb);})[_0xa0d6('0x1f')](function(_0x33f21b){var _0x5e5750=_0x33f21b['value'][0x0];var _0x51e9ee=_0x5e5750[_0xa0d6('0xac')];var _0x3dae5b={'method':_0xa0d6('0xa8'),'uri':_0x17581c+_0xa0d6('0xad')+_0x51e9ee+_0xa0d6('0xae'),'headers':{'Authorization':_0xa0d6('0xaa')+_0x413218,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3dae5b);})[_0xa0d6('0x1f')](function(_0x403ada){_0x401f73=_0x403ada;_0x534d8c=_0x401f73[_0xa0d6('0xaf')];_0x534d8c=_['remove'](_0x534d8c,function(_0x126e1c){return!_0x16561e[_0xa0d6('0xb0')](_0x126e1c['LogicalName']);});var _0x1c94c3=[];var _0x3f1c65=[];_0x534d8c[_0xa0d6('0xb1')](function(_0x1002fe){if(_0x1002fe[_0xa0d6('0xb2')]){var _0x5437d9=_0x1002fe[_0xa0d6('0xb2')]['substring'](_0x1002fe[_0xa0d6('0xb2')][_0xa0d6('0xa5')]('.')+0x1);if(_0x5437d9==='PicklistAttributeMetadata'){_0x1c94c3['push'](getSelectList(_0x17581c,_0x246e21,_0x3f1c65,_0x401f73[_0xa0d6('0xac')],_0x1002fe[_0xa0d6('0xac')],_0x413218));}}});return Promise[_0xa0d6('0xb3')](_0x1c94c3);})[_0xa0d6('0x1f')](function(_0x572cfe){_0x1fcd5e=_0x572cfe[0x0];var _0x558b26=[];var _0x1f1b85=[];_0x534d8c[_0xa0d6('0xb1')](function(_0x4864bd){if(!_[_0xa0d6('0xb4')](_0x4864bd[_0xa0d6('0xb2')])){var _0x51abea=_0x4864bd[_0xa0d6('0xb2')][_0xa0d6('0xa4')](_0x4864bd[_0xa0d6('0xb2')][_0xa0d6('0xa5')]('.')+0x1);if(_0x51abea==='BooleanAttributeMetadata'){_0x558b26[_0xa0d6('0xb5')](getBooleanList(_0x17581c,_0x246e21,_0x1f1b85,_0x401f73[_0xa0d6('0xac')],_0x4864bd['MetadataId'],_0x413218));}}});return Promise[_0xa0d6('0xb3')](_0x558b26);})[_0xa0d6('0x1f')](function(_0x4ef7f7){_0x31a59b=_0x4ef7f7[0x0];var _0xf2c191=[];var _0x4f6b67=[];_0x534d8c['forEach'](function(_0x29d50c){if(_0x29d50c[_0xa0d6('0xb2')]){var _0xffebe=_0x29d50c['@odata.type'][_0xa0d6('0xa4')](_0x29d50c[_0xa0d6('0xb2')][_0xa0d6('0xa5')]('.')+0x1);if(_0xffebe===_0xa0d6('0xb6')||_0xffebe===_0xa0d6('0xb7')||_0xffebe===_0xa0d6('0xb8')||_0xffebe===_0xa0d6('0xb9')||_0xffebe===_0xa0d6('0xba')||_0xffebe===_0xa0d6('0xbb')||_0xffebe===_0xa0d6('0xbc')||_0xffebe===_0xa0d6('0xbd')||_0xffebe==='StateAttributeMetadata'||_0xffebe===_0xa0d6('0xbe')){_0xf2c191[_0xa0d6('0xb5')](getInputList(_0x17581c,_0x246e21,_0xffebe,_0x4f6b67,_0x401f73[_0xa0d6('0xac')],_0x29d50c[_0xa0d6('0xac')],_0x413218));}}});return Promise[_0xa0d6('0xb3')](_0xf2c191);})[_0xa0d6('0x1f')](function(_0x1f16f6){_0x2ab3a0=_0x1f16f6[0x0];var _0x2269e3=_0x1fcd5e[_0xa0d6('0x9e')](_0x31a59b)['concat'](_0x2ab3a0);var _0x21f5c0={'count':_0x2269e3[_0xa0d6('0x40')],'rows':_0x2269e3};return _0x21f5c0;})[_0xa0d6('0x1f')](respondWithResult(_0x1cb860,null))['catch'](function(_0x2f0415){console[_0xa0d6('0xbf')](_0xa0d6('0xc0')+_0x2f0415);var _0x35c28a=_0x55ee1b['query']['test']?0x1f4:_0x2f0415[_0xa0d6('0xc1')]||0x1f4;logger[_0xa0d6('0x25')](_0x2f0415['stack']);delete _0x2f0415['name'];if(_0x35c28a===0x191){_0x35c28a=0x190;}_0x1cb860['status'](_0x35c28a)[_0xa0d6('0xc2')](_0x55ee1b[_0xa0d6('0x3c')][_0xa0d6('0x1c')]?{'message':_0xa0d6('0xc3'),'statusCode':_0x2f0415[_0xa0d6('0xc1')]}:_0x2f0415);});};function getSelectList(_0x25fa20,_0x5d5de3,_0x45f11d,_0x240de5,_0x21dfd8,_0x5439f3){var _0x22eeb3={'method':_0xa0d6('0xa8'),'uri':_0x25fa20+_0xa0d6('0xad')+_0x240de5+_0xa0d6('0xc4')+_0x21dfd8+_0xa0d6('0xc5')+_0xa0d6('0xc6'),'headers':{'Authorization':'Bearer\x20'+_0x5439f3,'If-None-Match':null,'OData-Version':_0xa0d6('0xab')},'json':!![]};return rp(_0x22eeb3)[_0xa0d6('0x1f')](function(_0x275d11){var _0x24f641=[];var _0x1c01cb=_0x275d11[_0xa0d6('0xc7')]['Options'];_0x1c01cb[_0xa0d6('0xb1')](function(_0x4fc857){_0x24f641[_0xa0d6('0xb5')]({'name':_0x4fc857[_0xa0d6('0xc8')][_0xa0d6('0xc9')][_0xa0d6('0xc8')],'value':String(_0x4fc857[_0xa0d6('0xca')])});});var _0x3245f5={'id':_0x5d5de3+'_'+_0x275d11[_0xa0d6('0xcb')],'name':_0x275d11[_0xa0d6('0xcc')][_0xa0d6('0xc9')][_0xa0d6('0xc8')],'custom':![],'options':_0x24f641};_0x45f11d['push'](_0x3245f5);return _0x45f11d;});}function getBooleanList(_0x5c7c86,_0x3b502d,_0x25174d,_0x39fa83,_0x4ea461,_0x40817e){var _0x594557={'method':'GET','uri':_0x5c7c86+_0xa0d6('0xad')+_0x39fa83+_0xa0d6('0xc4')+_0x4ea461+_0xa0d6('0xcd'),'headers':{'Authorization':_0xa0d6('0xaa')+_0x40817e,'If-None-Match':null,'OData-Version':_0xa0d6('0xab')},'json':!![]};return rp(_0x594557)[_0xa0d6('0x1f')](function(_0x2978e0){var _0x19d2c0=[];_0x19d2c0[_0xa0d6('0xb5')]({'name':_0x2978e0['OptionSet'][_0xa0d6('0xce')][_0xa0d6('0xc8')]['UserLocalizedLabel']['Label'],'value':_0xa0d6('0xcf')},{'name':_0x2978e0['OptionSet'][_0xa0d6('0xd0')][_0xa0d6('0xc8')][_0xa0d6('0xc9')][_0xa0d6('0xc8')],'value':_0xa0d6('0xd1')});var _0x1558fc={'id':_0x3b502d+'_'+_0x2978e0[_0xa0d6('0xcb')],'name':_0x2978e0['DisplayName'][_0xa0d6('0xc9')][_0xa0d6('0xc8')],'custom':![],'options':_0x19d2c0};_0x25174d[_0xa0d6('0xb5')](_0x1558fc);return _0x25174d;});}function getInputList(_0x4b6dbe,_0x1fb846,_0x45d3e9,_0x23e8a8,_0x4f59bc,_0x58225a,_0x2fbe47){var _0x4e7743={'method':_0xa0d6('0xa8'),'uri':_0x4b6dbe+_0xa0d6('0xad')+_0x4f59bc+_0xa0d6('0xc4')+_0x58225a+_0xa0d6('0xd2')+_0x45d3e9+_0xa0d6('0xd3'),'headers':{'Authorization':'Bearer\x20'+_0x2fbe47,'If-None-Match':null,'OData-Version':_0xa0d6('0xab')},'json':!![]};return rp(_0x4e7743)[_0xa0d6('0x1f')](function(_0xce6850){var _0x25fd27={'id':_0x1fb846+'_'+_0xce6850['LogicalName'],'name':_0xce6850[_0xa0d6('0xcc')][_0xa0d6('0xc9')]?_0xce6850[_0xa0d6('0xcc')][_0xa0d6('0xc9')]['Label']:_0xce6850['LogicalName'],'custom':![],'options':[]};_0x23e8a8[_0xa0d6('0xb5')](_0x25fd27);return _0x23e8a8;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 58fa17d..36fa7d9 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 _0x5294=['exports','define','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1ced4b,_0x3091e1){var _0x5b4ace=function(_0x51074b){while(--_0x51074b){_0x1ced4b['push'](_0x1ced4b['shift']());}};_0x5b4ace(++_0x3091e1);}(_0x5294,0x199));var _0x4529=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x5294[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var logger=require(_0x4529('0x2'))(_0x4529('0x3'));var moment=require(_0x4529('0x4'));var BPromise=require(_0x4529('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4529('0x6'));var rimraf=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var attributes=require(_0x4529('0x9'));var integrations=require(_0x4529('0xa'));module[_0x4529('0xb')]=function(_0x4c14de,_0x3cc898){return _0x4c14de[_0x4529('0xc')]('Dynamics365Account',attributes,{'tableName':_0x4529('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b2=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1852c8,_0x2fef5b){var _0x201011=function(_0x31a830){while(--_0x31a830){_0x1852c8['push'](_0x1852c8['shift']());}};_0x201011(++_0x2fef5b);}(_0xf5b2,0x19c));var _0x2f5b=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xf5b2[_0x9729d7];return _0x3c4ac6;};'use strict';var _=require(_0x2f5b('0x0'));var util=require(_0x2f5b('0x1'));var logger=require(_0x2f5b('0x2'))(_0x2f5b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f5b('0x4'));var fs=require('fs');var path=require(_0x2f5b('0x5'));var rimraf=require(_0x2f5b('0x6'));var config=require(_0x2f5b('0x7'));var attributes=require(_0x2f5b('0x8'));var integrations=require(_0x2f5b('0x9'));module[_0x2f5b('0xa')]=function(_0x11b165,_0x1d77b9){return _0x11b165[_0x2f5b('0xb')](_0x2f5b('0xc'),attributes,{'tableName':_0x2f5b('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 0c12c89..1887d01 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 _0xc1bd=['error','code','message','info','catch','findAll','options','raw','where','attributes','map','include','model','GetDynamics365Account','debug','ShowDynamics365Account','Dynamics365Account','find','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c07af,_0x422ebd){var _0x5ce7c0=function(_0x547db3){while(--_0x547db3){_0x1c07af['push'](_0x1c07af['shift']());}};_0x5ce7c0(++_0x422ebd);}(_0xc1bd,0xc6));var _0xdc1b=function(_0x2c9b04,_0x494c1f){_0x2c9b04=_0x2c9b04-0x0;var _0x3912f4=_0xc1bd[_0x2c9b04];return _0x3912f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc1b('0x0'));var BPromise=require(_0xdc1b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc1b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc1b('0x3'));var logger=require(_0xdc1b('0x4'))(_0xdc1b('0x5'));var config=require(_0xdc1b('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33152a,_0x21599e,_0x381694){return new BPromise(function(_0x5f014b,_0x3ab7a0){return client[_0xdc1b('0x7')](_0x33152a,_0x381694)[_0xdc1b('0x8')](function(_0x43a609){logger['info'](_0xdc1b('0x9'),_0x21599e,_0xdc1b('0xa'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x21599e,_0xdc1b('0xa'),JSON[_0xdc1b('0xb')](_0x43a609));if(_0x43a609['error']){if(_0x43a609[_0xdc1b('0xc')][_0xdc1b('0xd')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x21599e,_0x43a609[_0xdc1b('0xc')][_0xdc1b('0xe')]);return _0x3ab7a0(_0x43a609[_0xdc1b('0xc')][_0xdc1b('0xe')]);}logger[_0xdc1b('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x21599e,_0x43a609['error']['message']);return _0x5f014b(_0x43a609[_0xdc1b('0xc')][_0xdc1b('0xe')]);}else{logger[_0xdc1b('0xf')](_0xdc1b('0x9'),_0x21599e,_0xdc1b('0xa'));_0x5f014b(_0x43a609['result'][_0xdc1b('0xe')]);}})[_0xdc1b('0x10')](function(_0x2f8cd7){logger[_0xdc1b('0xc')](_0xdc1b('0x9'),_0x21599e,_0x2f8cd7);_0x3ab7a0(_0x2f8cd7);});});}exports['GetDynamics365Account']=function(_0x367ee1){var _0x5eaeac=this;return new Promise(function(_0x457486,_0x3023ab){return db['Dynamics365Account'][_0xdc1b('0x11')]({'raw':_0x367ee1[_0xdc1b('0x12')]?_0x367ee1[_0xdc1b('0x12')][_0xdc1b('0x13')]===undefined?!![]:![]:!![],'where':_0x367ee1[_0xdc1b('0x12')]?_0x367ee1[_0xdc1b('0x12')][_0xdc1b('0x14')]||null:null,'attributes':_0x367ee1[_0xdc1b('0x12')]?_0x367ee1[_0xdc1b('0x12')][_0xdc1b('0x15')]||null:null,'limit':_0x367ee1['options']?_0x367ee1[_0xdc1b('0x12')]['limit']||null:null,'include':_0x367ee1['options']?_0x367ee1[_0xdc1b('0x12')]['include']?_[_0xdc1b('0x16')](_0x367ee1[_0xdc1b('0x12')][_0xdc1b('0x17')],function(_0x513fc0){return{'model':db[_0x513fc0[_0xdc1b('0x18')]],'as':_0x513fc0['as'],'attributes':_0x513fc0['attributes'],'include':_0x513fc0['include']?_[_0xdc1b('0x16')](_0x513fc0[_0xdc1b('0x17')],function(_0x2cabda){return{'model':db[_0x2cabda['model']],'as':_0x2cabda['as'],'attributes':_0x2cabda[_0xdc1b('0x15')],'include':_0x2cabda[_0xdc1b('0x17')]?_['map'](_0x2cabda['include'],function(_0x3c36a8){return{'model':db[_0x3c36a8[_0xdc1b('0x18')]],'as':_0x3c36a8['as'],'attributes':_0x3c36a8['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc1b('0x8')](function(_0x320384){logger['info'](_0xdc1b('0x19'),_0x367ee1);logger[_0xdc1b('0x1a')](_0xdc1b('0x19'),_0x367ee1,JSON[_0xdc1b('0xb')](_0x320384));_0x457486(_0x320384);})['catch'](function(_0x2f3a6d){logger[_0xdc1b('0xc')](_0xdc1b('0x19'),_0x2f3a6d[_0xdc1b('0xe')],_0x367ee1);_0x3023ab(_0x5eaeac[_0xdc1b('0xc')](0x1f4,_0x2f3a6d[_0xdc1b('0xe')]));});});};exports[_0xdc1b('0x1b')]=function(_0x208840){var _0x35f697=this;return new Promise(function(_0x423460,_0x485cc7){return db[_0xdc1b('0x1c')][_0xdc1b('0x1d')]({'raw':_0x208840[_0xdc1b('0x12')]?_0x208840[_0xdc1b('0x12')][_0xdc1b('0x13')]===undefined?!![]:![]:!![],'where':_0x208840[_0xdc1b('0x12')]?_0x208840[_0xdc1b('0x12')]['where']||null:null,'attributes':_0x208840['options']?_0x208840[_0xdc1b('0x12')][_0xdc1b('0x15')]||null:null,'include':_0x208840[_0xdc1b('0x12')]?_0x208840['options']['include']?_[_0xdc1b('0x16')](_0x208840[_0xdc1b('0x12')]['include'],function(_0x28df9c){return{'model':db[_0x28df9c['model']],'as':_0x28df9c['as'],'attributes':_0x28df9c[_0xdc1b('0x15')],'include':_0x28df9c[_0xdc1b('0x17')]?_[_0xdc1b('0x16')](_0x28df9c[_0xdc1b('0x17')],function(_0x4852cb){return{'model':db[_0x4852cb[_0xdc1b('0x18')]],'as':_0x4852cb['as'],'attributes':_0x4852cb['attributes'],'include':_0x4852cb[_0xdc1b('0x17')]?_[_0xdc1b('0x16')](_0x4852cb[_0xdc1b('0x17')],function(_0x3c81a0){return{'model':db[_0x3c81a0[_0xdc1b('0x18')]],'as':_0x3c81a0['as'],'attributes':_0x3c81a0[_0xdc1b('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdc1b('0x8')](function(_0x248ea4){logger['info'](_0xdc1b('0x1b'),_0x208840);logger[_0xdc1b('0x1a')]('ShowDynamics365Account',_0x208840,JSON['stringify'](_0x248ea4));_0x423460(_0x248ea4);})[_0xdc1b('0x10')](function(_0x26248b){logger[_0xdc1b('0xc')](_0xdc1b('0x1b'),_0x26248b[_0xdc1b('0xe')],_0x208840);_0x485cc7(_0x35f697[_0xdc1b('0xc')](0x1f4,_0x26248b[_0xdc1b('0xe')]));});});}; \ No newline at end of file +var _0x514a=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x259a5a,_0x438a30){var _0x15da29=function(_0x555b45){while(--_0x555b45){_0x259a5a['push'](_0x259a5a['shift']());}};_0x15da29(++_0x438a30);}(_0x514a,0xf1));var _0xa514=function(_0x4b96d1,_0x5c5faf){_0x4b96d1=_0x4b96d1-0x0;var _0x926452=_0x514a[_0x4b96d1];return _0x926452;};'use strict';var _=require(_0xa514('0x0'));var util=require(_0xa514('0x1'));var moment=require(_0xa514('0x2'));var BPromise=require(_0xa514('0x3'));var rs=require(_0xa514('0x4'));var fs=require('fs');var Redis=require(_0xa514('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa514('0x6'));var logger=require(_0xa514('0x7'))(_0xa514('0x8'));var config=require(_0xa514('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa514('0xa')][_0xa514('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35c14c,_0x42efda,_0x459fd4){return new BPromise(function(_0x1c289f,_0x598dd6){return client[_0xa514('0xc')](_0x35c14c,_0x459fd4)[_0xa514('0xd')](function(_0x5a3571){logger[_0xa514('0xe')](_0xa514('0xf'),_0x42efda,_0xa514('0x10'));logger[_0xa514('0x11')](_0xa514('0x12'),_0x42efda,_0xa514('0x10'),JSON[_0xa514('0x13')](_0x5a3571));if(_0x5a3571['error']){if(_0x5a3571['error'][_0xa514('0x14')]===0x1f4){logger[_0xa514('0x15')](_0xa514('0xf'),_0x42efda,_0x5a3571[_0xa514('0x15')]['message']);return _0x598dd6(_0x5a3571[_0xa514('0x15')][_0xa514('0x16')]);}logger[_0xa514('0x15')](_0xa514('0xf'),_0x42efda,_0x5a3571[_0xa514('0x15')][_0xa514('0x16')]);return _0x1c289f(_0x5a3571[_0xa514('0x15')][_0xa514('0x16')]);}else{logger[_0xa514('0xe')](_0xa514('0xf'),_0x42efda,_0xa514('0x10'));_0x1c289f(_0x5a3571[_0xa514('0x17')][_0xa514('0x16')]);}})[_0xa514('0x18')](function(_0x49c936){logger['error'](_0xa514('0xf'),_0x42efda,_0x49c936);_0x598dd6(_0x49c936);});});}exports[_0xa514('0x19')]=function(_0xcb0b80){var _0x1ec0c5=this;return new Promise(function(_0x153a9a,_0x490cb9){return db[_0xa514('0x1a')][_0xa514('0x1b')]({'raw':_0xcb0b80[_0xa514('0x1c')]?_0xcb0b80[_0xa514('0x1c')][_0xa514('0x1d')]===undefined?!![]:![]:!![],'where':_0xcb0b80[_0xa514('0x1c')]?_0xcb0b80[_0xa514('0x1c')][_0xa514('0x1e')]||null:null,'attributes':_0xcb0b80[_0xa514('0x1c')]?_0xcb0b80['options'][_0xa514('0x1f')]||null:null,'limit':_0xcb0b80[_0xa514('0x1c')]?_0xcb0b80[_0xa514('0x1c')]['limit']||null:null,'include':_0xcb0b80[_0xa514('0x1c')]?_0xcb0b80[_0xa514('0x1c')][_0xa514('0x20')]?_[_0xa514('0x21')](_0xcb0b80[_0xa514('0x1c')][_0xa514('0x20')],function(_0x3e2172){return{'model':db[_0x3e2172[_0xa514('0x22')]],'as':_0x3e2172['as'],'attributes':_0x3e2172['attributes'],'include':_0x3e2172[_0xa514('0x20')]?_[_0xa514('0x21')](_0x3e2172[_0xa514('0x20')],function(_0x5bd309){return{'model':db[_0x5bd309[_0xa514('0x22')]],'as':_0x5bd309['as'],'attributes':_0x5bd309[_0xa514('0x1f')],'include':_0x5bd309['include']?_[_0xa514('0x21')](_0x5bd309[_0xa514('0x20')],function(_0x344cfa){return{'model':db[_0x344cfa[_0xa514('0x22')]],'as':_0x344cfa['as'],'attributes':_0x344cfa[_0xa514('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c1a33){logger[_0xa514('0xe')](_0xa514('0x19'),_0xcb0b80);logger[_0xa514('0x11')](_0xa514('0x19'),_0xcb0b80,JSON[_0xa514('0x13')](_0x1c1a33));_0x153a9a(_0x1c1a33);})[_0xa514('0x18')](function(_0x8fd29a){logger['error'](_0xa514('0x19'),_0x8fd29a[_0xa514('0x16')],_0xcb0b80);_0x490cb9(_0x1ec0c5[_0xa514('0x15')](0x1f4,_0x8fd29a[_0xa514('0x16')]));});});};exports[_0xa514('0x23')]=function(_0x2e9a3c){var _0x2f80f3=this;return new Promise(function(_0x5e1feb,_0x5cef4c){return db[_0xa514('0x1a')][_0xa514('0x24')]({'raw':_0x2e9a3c[_0xa514('0x1c')]?_0x2e9a3c[_0xa514('0x1c')][_0xa514('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e9a3c['options']?_0x2e9a3c['options'][_0xa514('0x1e')]||null:null,'attributes':_0x2e9a3c[_0xa514('0x1c')]?_0x2e9a3c[_0xa514('0x1c')][_0xa514('0x1f')]||null:null,'include':_0x2e9a3c['options']?_0x2e9a3c[_0xa514('0x1c')][_0xa514('0x20')]?_[_0xa514('0x21')](_0x2e9a3c['options']['include'],function(_0x5c512d){return{'model':db[_0x5c512d[_0xa514('0x22')]],'as':_0x5c512d['as'],'attributes':_0x5c512d['attributes'],'include':_0x5c512d[_0xa514('0x20')]?_[_0xa514('0x21')](_0x5c512d['include'],function(_0x413f5a){return{'model':db[_0x413f5a[_0xa514('0x22')]],'as':_0x413f5a['as'],'attributes':_0x413f5a[_0xa514('0x1f')],'include':_0x413f5a[_0xa514('0x20')]?_[_0xa514('0x21')](_0x413f5a[_0xa514('0x20')],function(_0x34bc41){return{'model':db[_0x34bc41['model']],'as':_0x34bc41['as'],'attributes':_0x34bc41[_0xa514('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa514('0xd')](function(_0x1cb875){logger[_0xa514('0xe')](_0xa514('0x23'),_0x2e9a3c);logger['debug'](_0xa514('0x23'),_0x2e9a3c,JSON[_0xa514('0x13')](_0x1cb875));_0x5e1feb(_0x1cb875);})[_0xa514('0x18')](function(_0x53f866){logger[_0xa514('0x15')](_0xa514('0x23'),_0x53f866[_0xa514('0x16')],_0x2e9a3c);_0x5cef4c(_0x2f80f3[_0xa514('0x15')](0x1f4,_0x53f866['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a5758bb..9e354ee 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 _0x0c3e=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','isAuthenticated','get'];(function(_0x4db537,_0x53a37b){var _0x25d062=function(_0x5954b1){while(--_0x5954b1){_0x4db537['push'](_0x4db537['shift']());}};_0x25d062(++_0x53a37b);}(_0x0c3e,0xf0));var _0xe0c3=function(_0x24a136,_0x2b76c0){_0x24a136=_0x24a136-0x0;var _0x403f4f=_0x0c3e[_0x24a136];return _0x403f4f;};'use strict';var multer=require(_0xe0c3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe0c3('0x1'));var config=require(_0xe0c3('0x2'));var controller=require(_0xe0c3('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xe0c3('0x4')]);router['get']('/:id',auth[_0xe0c3('0x5')](),controller['show']);router[_0xe0c3('0x6')](_0xe0c3('0x7'),auth[_0xe0c3('0x5')](),controller[_0xe0c3('0x8')]);router['get'](_0xe0c3('0x9'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xe0c3('0x6')](_0xe0c3('0xa'),auth[_0xe0c3('0x5')](),controller[_0xe0c3('0xb')]);router[_0xe0c3('0xc')]('/',auth[_0xe0c3('0x5')](),controller['create']);router[_0xe0c3('0xd')](_0xe0c3('0xe'),auth[_0xe0c3('0x5')](),controller[_0xe0c3('0xf')]);router[_0xe0c3('0x10')]('/:id',auth[_0xe0c3('0x5')](),controller[_0xe0c3('0x11')]);module[_0xe0c3('0x12')]=router; \ No newline at end of file +var _0xee7d=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x30663e,_0x294abe){var _0x41c43f=function(_0x5be7a6){while(--_0x5be7a6){_0x30663e['push'](_0x30663e['shift']());}};_0x41c43f(++_0x294abe);}(_0xee7d,0xa7));var _0xdee7=function(_0x5508d9,_0x2a6dcc){_0x5508d9=_0x5508d9-0x0;var _0x2dada6=_0xee7d[_0x5508d9];return _0x2dada6;};'use strict';var multer=require(_0xdee7('0x0'));var util=require('util');var path=require(_0xdee7('0x1'));var timeout=require(_0xdee7('0x2'));var express=require('express');var router=express[_0xdee7('0x3')]();var auth=require(_0xdee7('0x4'));var interaction=require(_0xdee7('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xdee7('0x6')]('/',auth[_0xdee7('0x7')](),controller[_0xdee7('0x8')]);router['get'](_0xdee7('0x9'),auth[_0xdee7('0x7')](),controller['show']);router[_0xdee7('0x6')](_0xdee7('0xa'),auth[_0xdee7('0x7')](),controller['getFields']);router[_0xdee7('0x6')](_0xdee7('0xb'),auth[_0xdee7('0x7')](),controller[_0xdee7('0xc')]);router[_0xdee7('0x6')](_0xdee7('0xd'),auth[_0xdee7('0x7')](),controller[_0xdee7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdee7('0xf')](_0xdee7('0x9'),auth[_0xdee7('0x7')](),controller[_0xdee7('0x10')]);router[_0xdee7('0x11')]('/:id',auth[_0xdee7('0x7')](),controller['destroy']);module[_0xdee7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index aaff8d2..e530069 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 _0x1e35=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x1e35,0x189));var _0x51e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e35[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x51e3('0x0'));module[_0x51e3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x51e3('0x2')]},'ticketType':{'type':Sequelize[_0x51e3('0x3')](_0x51e3('0x4'),_0x51e3('0x5')),'defaultValue':_0x51e3('0x4')}}; \ No newline at end of file +var _0xe776=['incident','sequelize','exports','STRING'];(function(_0x1d8c9b,_0x3ff0e4){var _0x275871=function(_0x28f890){while(--_0x28f890){_0x1d8c9b['push'](_0x1d8c9b['shift']());}};_0x275871(++_0x3ff0e4);}(_0xe776,0x195));var _0x6e77=function(_0x4767c8,_0xb000ab){_0x4767c8=_0x4767c8-0x0;var _0x6de88b=_0xe776[_0x4767c8];return _0x6de88b;};'use strict';var Sequelize=require(_0x6e77('0x0'));module[_0x6e77('0x1')]={'name':{'type':Sequelize[_0x6e77('0x2')]},'description':{'type':Sequelize[_0x6e77('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x6e77('0x3'),'phonecall'),'defaultValue':_0x6e77('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 04f9d3c..ce6c665 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 _0xe51f=['Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','Dynamics365Configuration','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','type','key','filter','options','count','includeAll','include','rows','show','length','find','create','body','update','params','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','catch','end','status','json','offset','limit','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe51f,0xe9));var _0xfe51=function(_0x506a9b,_0x25ade2){_0x506a9b=_0x506a9b-0x0;var _0x27ae4a=_0xe51f[_0x506a9b];return _0x27ae4a;};'use strict';var pdf=require(_0xfe51('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfe51('0x1'));var zipdir=require(_0xfe51('0x2'));var jsonpatch=require(_0xfe51('0x3'));var rp=require(_0xfe51('0x4'));var moment=require(_0xfe51('0x5'));var BPromise=require(_0xfe51('0x6'));var Mustache=require(_0xfe51('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfe51('0x8'));var csv=require(_0xfe51('0x9'));var ejs=require(_0xfe51('0xa'));var fs=require('fs');var _=require(_0xfe51('0xb'));var squel=require(_0xfe51('0xc'));var crypto=require(_0xfe51('0xd'));var jsforce=require(_0xfe51('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfe51('0xf'));var Redis=require(_0xfe51('0x10'));var authService=require(_0xfe51('0x11'));var qs=require(_0xfe51('0x12'));var hardwareService=require(_0xfe51('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfe51('0x14'));var config=require(_0xfe51('0x15'));var db=require(_0xfe51('0x16'))['db'];var jayson=require(_0xfe51('0x17'));var client=jayson[_0xfe51('0x18')][_0xfe51('0x19')]({'port':0x232a});function checkPasswordPattern(_0xe553f8,_0x4360ad,_0x2d5543){if(_0x2d5543){var _0x75b36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x75b36[_0xfe51('0x1a')](_0x4360ad)){return _0xe553f8;}else{throw new Error(_0xfe51('0x1b'));}}else{return _0xe553f8;}}function respondWithRpcPromise(_0x397a07,_0xa08ac6,_0x503111,_0x479f8e){return new BPromise(function(_0x212c35,_0x46dc2f){var _0x1d7faf=_0x479f8e||client;return _0x1d7faf[_0xfe51('0x1c')](_0x397a07,_0x503111)[_0xfe51('0x1d')](function(_0x113721){logger[_0xfe51('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0xa08ac6,'request\x20sent');logger[_0xfe51('0x1f')](_0xfe51('0x20'),_0xa08ac6,'request\x20sent',JSON[_0xfe51('0x21')](_0x113721));if(_0x113721[_0xfe51('0x22')]){if(_0x113721['error'][_0xfe51('0x23')]===0x1f4){logger[_0xfe51('0x22')](_0xfe51('0x24'),_0xa08ac6,_0x113721[_0xfe51('0x22')][_0xfe51('0x25')]);return _0x46dc2f(_0x113721[_0xfe51('0x22')][_0xfe51('0x25')]);}logger[_0xfe51('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0xa08ac6,_0x113721[_0xfe51('0x22')][_0xfe51('0x25')]);return _0x212c35(_0x113721[_0xfe51('0x22')][_0xfe51('0x25')]);}else{logger[_0xfe51('0x1e')](_0xfe51('0x24'),_0xa08ac6,_0xfe51('0x26'));_0x212c35(_0x113721['result']['message']);}})[_0xfe51('0x27')](function(_0x2a9b25){logger[_0xfe51('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0xa08ac6,_0x2a9b25);_0x46dc2f(_0x2a9b25);});});}function respondWithStatusCode(_0xdc83ff,_0x1a8c13){_0x1a8c13=_0x1a8c13||0xcc;return function(_0xd51da6){if(_0xd51da6){return _0xdc83ff['sendStatus'](_0x1a8c13);}return _0xdc83ff['status'](_0x1a8c13)[_0xfe51('0x28')]();};}function respondWithResult(_0x195c5c,_0x54bd02){_0x54bd02=_0x54bd02||0xc8;return function(_0x365b64){if(_0x365b64){return _0x195c5c[_0xfe51('0x29')](_0x54bd02)[_0xfe51('0x2a')](_0x365b64);}};}function respondWithFilteredResult(_0x57f229,_0x2c306f){return function(_0x43425c){if(_0x43425c){var _0x239075=_0x43425c['count'],_0x4883d1=_0x2c306f[_0xfe51('0x2b')],_0x6367b5=_0x2c306f['offset']+_0x2c306f[_0xfe51('0x2c')],_0x3c5468;if(_0x6367b5>=_0x239075){_0x6367b5=_0x239075;_0x3c5468=0xc8;}else{_0x3c5468=0xce;}_0x57f229[_0xfe51('0x29')](_0x3c5468);return _0x57f229[_0xfe51('0x2d')](_0xfe51('0x2e'),_0x4883d1+'-'+_0x6367b5+'/'+_0x239075)[_0xfe51('0x2a')](_0x43425c);}return null;};}function patchUpdates(_0x55df6c){return function(_0x4ea41b){try{jsonpatch[_0xfe51('0x2f')](_0x4ea41b,_0x55df6c,!![]);}catch(_0x5adc24){return BPromise[_0xfe51('0x30')](_0x5adc24);}return _0x4ea41b[_0xfe51('0x31')]();};}function saveUpdates(_0x44942e,_0x1d5903){return function(_0x4d4499){if(_0x4d4499){return _0x4d4499['update'](_0x44942e)[_0xfe51('0x1d')](function(_0x648dc2){return _0x648dc2;});}return null;};}function removeEntity(_0x201418,_0x40ef25){return function(_0x3b0f20){if(_0x3b0f20){return _0x3b0f20[_0xfe51('0x32')]()[_0xfe51('0x1d')](function(){_0x201418[_0xfe51('0x29')](0xcc)[_0xfe51('0x28')]();});}};}function handleEntityNotFound(_0x1e1bef,_0x3cab66){return function(_0x3f2864){if(!_0x3f2864){_0x1e1bef[_0xfe51('0x33')](0x194);}return _0x3f2864;};}function handleError(_0x256940,_0x5280c6){_0x5280c6=_0x5280c6||0x1f4;return function(_0x267d22){logger[_0xfe51('0x22')](_0x267d22[_0xfe51('0x34')]);if(_0x267d22[_0xfe51('0x35')]){delete _0x267d22['name'];}_0x256940[_0xfe51('0x29')](_0x5280c6)[_0xfe51('0x36')](_0x267d22);};}exports[_0xfe51('0x37')]=function(_0xf1dcc1,_0x276b2e){var _0x577376={},_0x32a539={},_0x2c678a={'count':0x0,'rows':[]};var _0xb46692=db[_0xfe51('0x38')][_0xfe51('0x39')];_0x32a539['model']=_['keys'](_0xb46692);_0x32a539[_0xfe51('0x3a')]=_[_0xfe51('0x3b')](_0xf1dcc1[_0xfe51('0x3a')]);_0x32a539[_0xfe51('0x3c')]=_[_0xfe51('0x3d')](_0x32a539[_0xfe51('0x3e')],_0x32a539[_0xfe51('0x3a')]);_0x577376[_0xfe51('0x3f')]=_['intersection'](_0x32a539[_0xfe51('0x3e')],qs[_0xfe51('0x40')](_0xf1dcc1['query']['fields']));_0x577376[_0xfe51('0x3f')]=_0x577376[_0xfe51('0x3f')]['length']?_0x577376['attributes']:_0x32a539[_0xfe51('0x3e')];if(!_0xf1dcc1['query'][_0xfe51('0x41')](_0xfe51('0x42'))){_0x577376['limit']=qs[_0xfe51('0x2c')](_0xf1dcc1['query'][_0xfe51('0x2c')]);_0x577376['offset']=qs[_0xfe51('0x2b')](_0xf1dcc1[_0xfe51('0x3a')][_0xfe51('0x2b')]);}_0x577376[_0xfe51('0x43')]=qs[_0xfe51('0x44')](_0xf1dcc1['query'][_0xfe51('0x44')]);_0x577376[_0xfe51('0x45')]=qs[_0xfe51('0x3c')](_['pick'](_0xf1dcc1[_0xfe51('0x3a')],_0x32a539[_0xfe51('0x3c')]));if(_0xf1dcc1[_0xfe51('0x3a')]['filter']){_0x577376['where']=_[_0xfe51('0x46')](_0x577376[_0xfe51('0x45')],{'$or':_[_0xfe51('0x47')](_0xb46692,function(_0x35ea15){if(_0x35ea15[_0xfe51('0x48')][_0xfe51('0x49')]!=='VIRTUAL'){var _0x3af426={};_0x3af426[_0x35ea15['field']]={'$like':'%'+_0xf1dcc1[_0xfe51('0x3a')][_0xfe51('0x4a')]+'%'};return _0x3af426;}})});}_0x577376=_['merge']({},_0x577376,_0xf1dcc1[_0xfe51('0x4b')]);var _0x341671={'where':_0x577376[_0xfe51('0x45')]};return db[_0xfe51('0x38')][_0xfe51('0x4c')](_0x341671)[_0xfe51('0x1d')](function(_0x4fa551){_0x2c678a[_0xfe51('0x4c')]=_0x4fa551;if(_0xf1dcc1[_0xfe51('0x3a')][_0xfe51('0x4d')]){_0x577376[_0xfe51('0x4e')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x577376);})[_0xfe51('0x1d')](function(_0x69fa5f){_0x2c678a[_0xfe51('0x4f')]=_0x69fa5f;return _0x2c678a;})[_0xfe51('0x1d')](respondWithFilteredResult(_0x276b2e,_0x577376))['catch'](handleError(_0x276b2e,null));};exports[_0xfe51('0x50')]=function(_0x5436ab,_0x5a3f5d){var _0x4b34a0={'raw':![],'where':{'id':_0x5436ab['params']['id']}},_0xf397b6={};_0xf397b6[_0xfe51('0x3e')]=_[_0xfe51('0x3b')](db[_0xfe51('0x38')][_0xfe51('0x39')]);_0xf397b6['query']=_[_0xfe51('0x3b')](_0x5436ab[_0xfe51('0x3a')]);_0xf397b6['filters']=_['intersection'](_0xf397b6[_0xfe51('0x3e')],_0xf397b6['query']);_0x4b34a0[_0xfe51('0x3f')]=_[_0xfe51('0x3d')](_0xf397b6[_0xfe51('0x3e')],qs[_0xfe51('0x40')](_0x5436ab['query'][_0xfe51('0x40')]));_0x4b34a0[_0xfe51('0x3f')]=_0x4b34a0[_0xfe51('0x3f')][_0xfe51('0x51')]?_0x4b34a0[_0xfe51('0x3f')]:_0xf397b6['model'];if(_0x5436ab[_0xfe51('0x3a')][_0xfe51('0x4d')]){_0x4b34a0[_0xfe51('0x4e')]=[{'all':!![]}];}_0x4b34a0=_[_0xfe51('0x46')]({},_0x4b34a0,_0x5436ab['options']);return db[_0xfe51('0x38')][_0xfe51('0x52')](_0x4b34a0)['then'](handleEntityNotFound(_0x5a3f5d,null))[_0xfe51('0x1d')](respondWithResult(_0x5a3f5d,null))[_0xfe51('0x27')](handleError(_0x5a3f5d,null));};exports[_0xfe51('0x53')]=function(_0x22a3b8,_0x277423){return db[_0xfe51('0x38')][_0xfe51('0x53')](_0x22a3b8[_0xfe51('0x54')],{})[_0xfe51('0x1d')](respondWithResult(_0x277423,0xc9))['catch'](handleError(_0x277423,null));};exports[_0xfe51('0x55')]=function(_0x1c8204,_0x150e34){if(_0x1c8204[_0xfe51('0x54')]['id']){delete _0x1c8204['body']['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x1c8204[_0xfe51('0x56')]['id']}})[_0xfe51('0x1d')](handleEntityNotFound(_0x150e34,null))['then'](saveUpdates(_0x1c8204['body'],null))['then'](respondWithResult(_0x150e34,null))[_0xfe51('0x27')](handleError(_0x150e34,null));};exports[_0xfe51('0x32')]=function(_0x2cd192,_0x133aac){return db[_0xfe51('0x38')][_0xfe51('0x52')]({'where':{'id':_0x2cd192[_0xfe51('0x56')]['id']}})[_0xfe51('0x1d')](handleEntityNotFound(_0x133aac,null))['then'](removeEntity(_0x133aac,null))['catch'](handleError(_0x133aac,null));};exports[_0xfe51('0x57')]=function(_0x38326d,_0x15bb28,_0x1cc5b2){var _0x894f45={};var _0x396660={};var _0xd7c3e1;var _0x4bb685;return db[_0xfe51('0x38')][_0xfe51('0x58')]({'where':{'id':_0x38326d['params']['id']}})['then'](handleEntityNotFound(_0x15bb28,null))[_0xfe51('0x1d')](function(_0x2c924c){if(_0x2c924c){_0xd7c3e1=_0x2c924c;_0x396660[_0xfe51('0x3e')]=_['keys'](db[_0xfe51('0x59')][_0xfe51('0x39')]);_0x396660[_0xfe51('0x3a')]=_['keys'](_0x38326d['query']);_0x396660['filters']=_[_0xfe51('0x3d')](_0x396660[_0xfe51('0x3e')],_0x396660['query']);_0x894f45[_0xfe51('0x3f')]=_[_0xfe51('0x3d')](_0x396660[_0xfe51('0x3e')],qs[_0xfe51('0x40')](_0x38326d['query'][_0xfe51('0x40')]));_0x894f45[_0xfe51('0x3f')]=_0x894f45[_0xfe51('0x3f')][_0xfe51('0x51')]?_0x894f45[_0xfe51('0x3f')]:_0x396660[_0xfe51('0x3e')];_0x894f45[_0xfe51('0x43')]=qs[_0xfe51('0x44')](_0x38326d['query'][_0xfe51('0x44')]);_0x894f45[_0xfe51('0x45')]=qs[_0xfe51('0x3c')](_[_0xfe51('0x5a')](_0x38326d[_0xfe51('0x3a')],_0x396660[_0xfe51('0x3c')]));if(_0x38326d[_0xfe51('0x3a')][_0xfe51('0x4a')]){_0x894f45['where']=_[_0xfe51('0x46')](_0x894f45[_0xfe51('0x45')],{'$or':_[_0xfe51('0x47')](_0x894f45[_0xfe51('0x3f')],function(_0x1c7f94){var _0x223e1b={};_0x223e1b[_0x1c7f94]={'$like':'%'+_0x38326d[_0xfe51('0x3a')][_0xfe51('0x4a')]+'%'};return _0x223e1b;})});}_0x894f45=_[_0xfe51('0x46')]({},_0x894f45,_0x38326d['options']);return _0xd7c3e1['getFields'](_0x894f45);}})[_0xfe51('0x1d')](function(_0x34c17e){if(_0x34c17e){_0x4bb685=_0x34c17e[_0xfe51('0x51')];if(!_0x38326d[_0xfe51('0x3a')][_0xfe51('0x41')]('nolimit')){_0x894f45[_0xfe51('0x2c')]=qs['limit'](_0x38326d['query'][_0xfe51('0x2c')]);_0x894f45['offset']=qs[_0xfe51('0x2b')](_0x38326d[_0xfe51('0x3a')]['offset']);}return _0xd7c3e1[_0xfe51('0x57')](_0x894f45);}})['then'](function(_0x8bd1b1){if(_0x8bd1b1){return _0x8bd1b1?{'count':_0x4bb685,'rows':_0x8bd1b1}:null;}})[_0xfe51('0x1d')](respondWithResult(_0x15bb28,null))['catch'](handleError(_0x15bb28,null));};exports['getSubjects']=function(_0x18300f,_0x4b34b0,_0x3b6bf0){var _0x17faaa={};var _0x17c9cb={};var _0x19a791;var _0x4052ec;return db[_0xfe51('0x38')][_0xfe51('0x58')]({'where':{'id':_0x18300f[_0xfe51('0x56')]['id']}})[_0xfe51('0x1d')](handleEntityNotFound(_0x4b34b0,null))['then'](function(_0x5b0d58){if(_0x5b0d58){_0x19a791=_0x5b0d58;_0x17c9cb[_0xfe51('0x3e')]=_[_0xfe51('0x3b')](db['Dynamics365Field'][_0xfe51('0x39')]);_0x17c9cb[_0xfe51('0x3a')]=_[_0xfe51('0x3b')](_0x18300f[_0xfe51('0x3a')]);_0x17c9cb['filters']=_[_0xfe51('0x3d')](_0x17c9cb[_0xfe51('0x3e')],_0x17c9cb[_0xfe51('0x3a')]);_0x17faaa[_0xfe51('0x3f')]=_[_0xfe51('0x3d')](_0x17c9cb[_0xfe51('0x3e')],qs[_0xfe51('0x40')](_0x18300f[_0xfe51('0x3a')][_0xfe51('0x40')]));_0x17faaa[_0xfe51('0x3f')]=_0x17faaa[_0xfe51('0x3f')][_0xfe51('0x51')]?_0x17faaa[_0xfe51('0x3f')]:_0x17c9cb[_0xfe51('0x3e')];_0x17faaa[_0xfe51('0x43')]=qs[_0xfe51('0x44')](_0x18300f[_0xfe51('0x3a')][_0xfe51('0x44')]);_0x17faaa['where']=qs[_0xfe51('0x3c')](_[_0xfe51('0x5a')](_0x18300f[_0xfe51('0x3a')],_0x17c9cb[_0xfe51('0x3c')]));if(_0x18300f[_0xfe51('0x3a')][_0xfe51('0x4a')]){_0x17faaa[_0xfe51('0x45')]=_[_0xfe51('0x46')](_0x17faaa['where'],{'$or':_['map'](_0x17faaa[_0xfe51('0x3f')],function(_0xcb0f52){var _0x457f30={};_0x457f30[_0xcb0f52]={'$like':'%'+_0x18300f[_0xfe51('0x3a')][_0xfe51('0x4a')]+'%'};return _0x457f30;})});}_0x17faaa=_[_0xfe51('0x46')]({},_0x17faaa,_0x18300f[_0xfe51('0x4b')]);return _0x19a791[_0xfe51('0x5b')](_0x17faaa);}})[_0xfe51('0x1d')](function(_0x16e9b9){if(_0x16e9b9){_0x4052ec=_0x16e9b9['length'];if(!_0x18300f[_0xfe51('0x3a')]['hasOwnProperty']('nolimit')){_0x17faaa[_0xfe51('0x2c')]=qs[_0xfe51('0x2c')](_0x18300f['query'][_0xfe51('0x2c')]);_0x17faaa['offset']=qs[_0xfe51('0x2b')](_0x18300f[_0xfe51('0x3a')][_0xfe51('0x2b')]);}return _0x19a791[_0xfe51('0x5b')](_0x17faaa);}})[_0xfe51('0x1d')](function(_0x56679c){if(_0x56679c){return _0x56679c?{'count':_0x4052ec,'rows':_0x56679c}:null;}})[_0xfe51('0x1d')](respondWithResult(_0x4b34b0,null))['catch'](handleError(_0x4b34b0,null));};exports[_0xfe51('0x5c')]=function(_0x5c70c3,_0x284e2b,_0x3d4f05){var _0x555468={};var _0x49e545={};var _0x524678;var _0xdaaee3;return db[_0xfe51('0x38')]['findOne']({'where':{'id':_0x5c70c3['params']['id']}})[_0xfe51('0x1d')](handleEntityNotFound(_0x284e2b,null))[_0xfe51('0x1d')](function(_0x32a451){if(_0x32a451){_0x524678=_0x32a451;_0x49e545[_0xfe51('0x3e')]=_['keys'](db['Dynamics365Field'][_0xfe51('0x39')]);_0x49e545[_0xfe51('0x3a')]=_[_0xfe51('0x3b')](_0x5c70c3['query']);_0x49e545[_0xfe51('0x3c')]=_[_0xfe51('0x3d')](_0x49e545[_0xfe51('0x3e')],_0x49e545[_0xfe51('0x3a')]);_0x555468[_0xfe51('0x3f')]=_[_0xfe51('0x3d')](_0x49e545[_0xfe51('0x3e')],qs[_0xfe51('0x40')](_0x5c70c3[_0xfe51('0x3a')]['fields']));_0x555468[_0xfe51('0x3f')]=_0x555468[_0xfe51('0x3f')]['length']?_0x555468[_0xfe51('0x3f')]:_0x49e545[_0xfe51('0x3e')];_0x555468[_0xfe51('0x43')]=qs[_0xfe51('0x44')](_0x5c70c3[_0xfe51('0x3a')][_0xfe51('0x44')]);_0x555468[_0xfe51('0x45')]=qs[_0xfe51('0x3c')](_[_0xfe51('0x5a')](_0x5c70c3[_0xfe51('0x3a')],_0x49e545[_0xfe51('0x3c')]));if(_0x5c70c3[_0xfe51('0x3a')]['filter']){_0x555468[_0xfe51('0x45')]=_[_0xfe51('0x46')](_0x555468[_0xfe51('0x45')],{'$or':_['map'](_0x555468[_0xfe51('0x3f')],function(_0x122ba3){var _0x5437ef={};_0x5437ef[_0x122ba3]={'$like':'%'+_0x5c70c3[_0xfe51('0x3a')]['filter']+'%'};return _0x5437ef;})});}_0x555468=_[_0xfe51('0x46')]({},_0x555468,_0x5c70c3[_0xfe51('0x4b')]);return _0x524678[_0xfe51('0x5c')](_0x555468);}})[_0xfe51('0x1d')](function(_0x2ede74){if(_0x2ede74){_0xdaaee3=_0x2ede74[_0xfe51('0x51')];if(!_0x5c70c3[_0xfe51('0x3a')]['hasOwnProperty'](_0xfe51('0x42'))){_0x555468['limit']=qs['limit'](_0x5c70c3[_0xfe51('0x3a')]['limit']);_0x555468['offset']=qs[_0xfe51('0x2b')](_0x5c70c3[_0xfe51('0x3a')][_0xfe51('0x2b')]);}return _0x524678['getDescriptions'](_0x555468);}})[_0xfe51('0x1d')](function(_0xb58240){if(_0xb58240){return _0xb58240?{'count':_0xdaaee3,'rows':_0xb58240}:null;}})['then'](respondWithResult(_0x284e2b,null))[_0xfe51('0x27')](handleError(_0x284e2b,null));}; \ No newline at end of file +var _0x59c2=['where','pick','filter','merge','map','type','key','field','options','includeAll','include','rows','show','keys','create','body','find','params','order','getFields','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','update','stack','name','send','index','Dynamics365Configuration','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x5d8e11,_0x1b2574){var _0x25fa53=function(_0x5376ce){while(--_0x5376ce){_0x5d8e11['push'](_0x5d8e11['shift']());}};_0x25fa53(++_0x1b2574);}(_0x59c2,0x11d));var _0x259c=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0x59c2[_0x37ae2e];return _0x19c50f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x259c('0x0'));var rimraf=require(_0x259c('0x1'));var zipdir=require(_0x259c('0x2'));var jsonpatch=require(_0x259c('0x3'));var rp=require(_0x259c('0x4'));var moment=require(_0x259c('0x5'));var BPromise=require(_0x259c('0x6'));var Mustache=require('mustache');var util=require(_0x259c('0x7'));var path=require(_0x259c('0x8'));var sox=require(_0x259c('0x9'));var csv=require('to-csv');var ejs=require(_0x259c('0xa'));var fs=require('fs');var _=require(_0x259c('0xb'));var squel=require(_0x259c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x259c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x259c('0xe'));var Papa=require('papaparse');var Redis=require(_0x259c('0xf'));var authService=require(_0x259c('0x10'));var qs=require(_0x259c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x259c('0x12'));var utils=require(_0x259c('0x13'));var config=require('../../config/environment');var db=require(_0x259c('0x14'))['db'];var jayson=require(_0x259c('0x15'));var client=jayson[_0x259c('0x16')][_0x259c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x43e3e0,_0x54dc1b,_0x36c25b){if(_0x36c25b){var _0x5beb90=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5beb90[_0x259c('0x18')](_0x54dc1b)){return _0x43e3e0;}else{throw new Error(_0x259c('0x19'));}}else{return _0x43e3e0;}}function respondWithRpcPromise(_0x4b2d68,_0x5088a6,_0xe50d25,_0x5e5143){return new BPromise(function(_0x188347,_0x46ef70){var _0x504fcd=_0x5e5143||client;return _0x504fcd[_0x259c('0x1a')](_0x4b2d68,_0xe50d25)[_0x259c('0x1b')](function(_0x19a4d6){logger[_0x259c('0x1c')](_0x259c('0x1d'),_0x5088a6,_0x259c('0x1e'));logger[_0x259c('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5088a6,_0x259c('0x1e'),JSON[_0x259c('0x20')](_0x19a4d6));if(_0x19a4d6[_0x259c('0x21')]){if(_0x19a4d6[_0x259c('0x21')]['code']===0x1f4){logger[_0x259c('0x21')](_0x259c('0x1d'),_0x5088a6,_0x19a4d6[_0x259c('0x21')]['message']);return _0x46ef70(_0x19a4d6[_0x259c('0x21')][_0x259c('0x22')]);}logger['error'](_0x259c('0x1d'),_0x5088a6,_0x19a4d6[_0x259c('0x21')][_0x259c('0x22')]);return _0x188347(_0x19a4d6[_0x259c('0x21')][_0x259c('0x22')]);}else{logger['info'](_0x259c('0x1d'),_0x5088a6,_0x259c('0x1e'));_0x188347(_0x19a4d6[_0x259c('0x23')][_0x259c('0x22')]);}})[_0x259c('0x24')](function(_0xb0e21e){logger[_0x259c('0x21')](_0x259c('0x1d'),_0x5088a6,_0xb0e21e);_0x46ef70(_0xb0e21e);});});}function respondWithStatusCode(_0x2257cf,_0x38da2e){_0x38da2e=_0x38da2e||0xcc;return function(_0x33aa31){if(_0x33aa31){return _0x2257cf[_0x259c('0x25')](_0x38da2e);}return _0x2257cf[_0x259c('0x26')](_0x38da2e)[_0x259c('0x27')]();};}function respondWithResult(_0x4b4180,_0x1ac2cd){_0x1ac2cd=_0x1ac2cd||0xc8;return function(_0x51e5e9){if(_0x51e5e9){return _0x4b4180['status'](_0x1ac2cd)['json'](_0x51e5e9);}};}function respondWithFilteredResult(_0x90cdd8,_0x27cd81){return function(_0x4b09a3){if(_0x4b09a3){var _0x8544ed=_0x4b09a3[_0x259c('0x28')],_0x23d91a=_0x27cd81[_0x259c('0x29')],_0x45a2a0=_0x27cd81[_0x259c('0x29')]+_0x27cd81[_0x259c('0x2a')],_0xd337f0;if(_0x45a2a0>=_0x8544ed){_0x45a2a0=_0x8544ed;_0xd337f0=0xc8;}else{_0xd337f0=0xce;}_0x90cdd8[_0x259c('0x26')](_0xd337f0);return _0x90cdd8[_0x259c('0x2b')](_0x259c('0x2c'),_0x23d91a+'-'+_0x45a2a0+'/'+_0x8544ed)['json'](_0x4b09a3);}return null;};}function patchUpdates(_0x581f85){return function(_0x32888f){try{jsonpatch['apply'](_0x32888f,_0x581f85,!![]);}catch(_0x4fae63){return BPromise[_0x259c('0x2d')](_0x4fae63);}return _0x32888f['save']();};}function saveUpdates(_0x9d70ff,_0x2335e4){return function(_0x325ee3){if(_0x325ee3){return _0x325ee3[_0x259c('0x2e')](_0x9d70ff)[_0x259c('0x1b')](function(_0x3f0e3b){return _0x3f0e3b;});}return null;};}function removeEntity(_0x50d374,_0x4e8963){return function(_0x5d4038){if(_0x5d4038){return _0x5d4038['destroy']()['then'](function(){_0x50d374[_0x259c('0x26')](0xcc)[_0x259c('0x27')]();});}};}function handleEntityNotFound(_0x1f0c56,_0x2fec7e){return function(_0x3f5daa){if(!_0x3f5daa){_0x1f0c56['sendStatus'](0x194);}return _0x3f5daa;};}function handleError(_0xaf249c,_0x7bf7fe){_0x7bf7fe=_0x7bf7fe||0x1f4;return function(_0x1f1adf){logger[_0x259c('0x21')](_0x1f1adf[_0x259c('0x2f')]);if(_0x1f1adf[_0x259c('0x30')]){delete _0x1f1adf[_0x259c('0x30')];}_0xaf249c[_0x259c('0x26')](_0x7bf7fe)[_0x259c('0x31')](_0x1f1adf);};}exports[_0x259c('0x32')]=function(_0x687ab4,_0x3ca79e){var _0x372dfe={},_0x48a045={},_0xa1d580={'count':0x0,'rows':[]};var _0x12cebf=db[_0x259c('0x33')][_0x259c('0x34')];_0x48a045[_0x259c('0x35')]=_['keys'](_0x12cebf);_0x48a045[_0x259c('0x36')]=_['keys'](_0x687ab4[_0x259c('0x36')]);_0x48a045[_0x259c('0x37')]=_[_0x259c('0x38')](_0x48a045['model'],_0x48a045[_0x259c('0x36')]);_0x372dfe['attributes']=_[_0x259c('0x38')](_0x48a045[_0x259c('0x35')],qs['fields'](_0x687ab4[_0x259c('0x36')][_0x259c('0x39')]));_0x372dfe[_0x259c('0x3a')]=_0x372dfe[_0x259c('0x3a')][_0x259c('0x3b')]?_0x372dfe[_0x259c('0x3a')]:_0x48a045[_0x259c('0x35')];if(!_0x687ab4['query'][_0x259c('0x3c')](_0x259c('0x3d'))){_0x372dfe[_0x259c('0x2a')]=qs[_0x259c('0x2a')](_0x687ab4[_0x259c('0x36')][_0x259c('0x2a')]);_0x372dfe[_0x259c('0x29')]=qs['offset'](_0x687ab4['query'][_0x259c('0x29')]);}_0x372dfe['order']=qs[_0x259c('0x3e')](_0x687ab4['query']['sort']);_0x372dfe[_0x259c('0x3f')]=qs['filters'](_[_0x259c('0x40')](_0x687ab4[_0x259c('0x36')],_0x48a045[_0x259c('0x37')]));if(_0x687ab4[_0x259c('0x36')][_0x259c('0x41')]){_0x372dfe[_0x259c('0x3f')]=_[_0x259c('0x42')](_0x372dfe[_0x259c('0x3f')],{'$or':_[_0x259c('0x43')](_0x12cebf,function(_0x89b529){if(_0x89b529[_0x259c('0x44')][_0x259c('0x45')]!=='VIRTUAL'){var _0x7e77e7={};_0x7e77e7[_0x89b529[_0x259c('0x46')]]={'$like':'%'+_0x687ab4['query'][_0x259c('0x41')]+'%'};return _0x7e77e7;}})});}_0x372dfe=_['merge']({},_0x372dfe,_0x687ab4[_0x259c('0x47')]);var _0x4c70b5={'where':_0x372dfe['where']};return db['Dynamics365Configuration']['count'](_0x4c70b5)[_0x259c('0x1b')](function(_0x45f308){_0xa1d580['count']=_0x45f308;if(_0x687ab4[_0x259c('0x36')][_0x259c('0x48')]){_0x372dfe[_0x259c('0x49')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x372dfe);})['then'](function(_0x5f2549){_0xa1d580[_0x259c('0x4a')]=_0x5f2549;return _0xa1d580;})[_0x259c('0x1b')](respondWithFilteredResult(_0x3ca79e,_0x372dfe))['catch'](handleError(_0x3ca79e,null));};exports[_0x259c('0x4b')]=function(_0x4694c8,_0x9e26b3){var _0x4af6d9={'raw':![],'where':{'id':_0x4694c8['params']['id']}},_0x54652b={};_0x54652b['model']=_[_0x259c('0x4c')](db[_0x259c('0x33')][_0x259c('0x34')]);_0x54652b['query']=_[_0x259c('0x4c')](_0x4694c8[_0x259c('0x36')]);_0x54652b['filters']=_[_0x259c('0x38')](_0x54652b[_0x259c('0x35')],_0x54652b[_0x259c('0x36')]);_0x4af6d9[_0x259c('0x3a')]=_[_0x259c('0x38')](_0x54652b['model'],qs['fields'](_0x4694c8[_0x259c('0x36')][_0x259c('0x39')]));_0x4af6d9['attributes']=_0x4af6d9[_0x259c('0x3a')][_0x259c('0x3b')]?_0x4af6d9[_0x259c('0x3a')]:_0x54652b[_0x259c('0x35')];if(_0x4694c8[_0x259c('0x36')]['includeAll']){_0x4af6d9['include']=[{'all':!![]}];}_0x4af6d9=_[_0x259c('0x42')]({},_0x4af6d9,_0x4694c8[_0x259c('0x47')]);return db[_0x259c('0x33')]['find'](_0x4af6d9)[_0x259c('0x1b')](handleEntityNotFound(_0x9e26b3,null))[_0x259c('0x1b')](respondWithResult(_0x9e26b3,null))[_0x259c('0x24')](handleError(_0x9e26b3,null));};exports[_0x259c('0x4d')]=function(_0x3ffae2,_0x4870aa){return db['Dynamics365Configuration'][_0x259c('0x4d')](_0x3ffae2[_0x259c('0x4e')],{})['then'](respondWithResult(_0x4870aa,0xc9))[_0x259c('0x24')](handleError(_0x4870aa,null));};exports[_0x259c('0x2e')]=function(_0x419dd4,_0x3d3957){if(_0x419dd4[_0x259c('0x4e')]['id']){delete _0x419dd4[_0x259c('0x4e')]['id'];}return db[_0x259c('0x33')][_0x259c('0x4f')]({'where':{'id':_0x419dd4[_0x259c('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d3957,null))[_0x259c('0x1b')](saveUpdates(_0x419dd4[_0x259c('0x4e')],null))[_0x259c('0x1b')](respondWithResult(_0x3d3957,null))[_0x259c('0x24')](handleError(_0x3d3957,null));};exports['destroy']=function(_0x5697df,_0x19a719){return db[_0x259c('0x33')][_0x259c('0x4f')]({'where':{'id':_0x5697df['params']['id']}})[_0x259c('0x1b')](handleEntityNotFound(_0x19a719,null))['then'](removeEntity(_0x19a719,null))[_0x259c('0x24')](handleError(_0x19a719,null));};exports['getFields']=function(_0x11fafd,_0x526f5a,_0x2825ff){var _0x41fdb3={};var _0x5b0224={};var _0x2e3874;var _0x50e084;return db[_0x259c('0x33')]['findOne']({'where':{'id':_0x11fafd['params']['id']}})[_0x259c('0x1b')](handleEntityNotFound(_0x526f5a,null))[_0x259c('0x1b')](function(_0x3b0719){if(_0x3b0719){_0x2e3874=_0x3b0719;_0x5b0224[_0x259c('0x35')]=_[_0x259c('0x4c')](db['Dynamics365Field']['rawAttributes']);_0x5b0224[_0x259c('0x36')]=_[_0x259c('0x4c')](_0x11fafd[_0x259c('0x36')]);_0x5b0224[_0x259c('0x37')]=_[_0x259c('0x38')](_0x5b0224['model'],_0x5b0224[_0x259c('0x36')]);_0x41fdb3[_0x259c('0x3a')]=_[_0x259c('0x38')](_0x5b0224['model'],qs[_0x259c('0x39')](_0x11fafd[_0x259c('0x36')]['fields']));_0x41fdb3[_0x259c('0x3a')]=_0x41fdb3[_0x259c('0x3a')][_0x259c('0x3b')]?_0x41fdb3[_0x259c('0x3a')]:_0x5b0224['model'];_0x41fdb3[_0x259c('0x51')]=qs[_0x259c('0x3e')](_0x11fafd[_0x259c('0x36')][_0x259c('0x3e')]);_0x41fdb3[_0x259c('0x3f')]=qs[_0x259c('0x37')](_[_0x259c('0x40')](_0x11fafd[_0x259c('0x36')],_0x5b0224[_0x259c('0x37')]));if(_0x11fafd[_0x259c('0x36')]['filter']){_0x41fdb3['where']=_['merge'](_0x41fdb3[_0x259c('0x3f')],{'$or':_[_0x259c('0x43')](_0x41fdb3[_0x259c('0x3a')],function(_0xc3523f){var _0x37d4da={};_0x37d4da[_0xc3523f]={'$like':'%'+_0x11fafd[_0x259c('0x36')][_0x259c('0x41')]+'%'};return _0x37d4da;})});}_0x41fdb3=_[_0x259c('0x42')]({},_0x41fdb3,_0x11fafd[_0x259c('0x47')]);return _0x2e3874[_0x259c('0x52')](_0x41fdb3);}})[_0x259c('0x1b')](function(_0x3c938e){if(_0x3c938e){_0x50e084=_0x3c938e['length'];if(!_0x11fafd['query']['hasOwnProperty'](_0x259c('0x3d'))){_0x41fdb3[_0x259c('0x2a')]=qs[_0x259c('0x2a')](_0x11fafd[_0x259c('0x36')][_0x259c('0x2a')]);_0x41fdb3[_0x259c('0x29')]=qs[_0x259c('0x29')](_0x11fafd[_0x259c('0x36')]['offset']);}return _0x2e3874[_0x259c('0x52')](_0x41fdb3);}})[_0x259c('0x1b')](function(_0x35a955){if(_0x35a955){return _0x35a955?{'count':_0x50e084,'rows':_0x35a955}:null;}})['then'](respondWithResult(_0x526f5a,null))[_0x259c('0x24')](handleError(_0x526f5a,null));};exports[_0x259c('0x53')]=function(_0x27e998,_0x592ea3,_0x248329){var _0x2f64fb={};var _0xa944d3={};var _0x373c5a;var _0x2a9c05;return db['Dynamics365Configuration'][_0x259c('0x54')]({'where':{'id':_0x27e998[_0x259c('0x50')]['id']}})['then'](handleEntityNotFound(_0x592ea3,null))[_0x259c('0x1b')](function(_0x346fc0){if(_0x346fc0){_0x373c5a=_0x346fc0;_0xa944d3[_0x259c('0x35')]=_[_0x259c('0x4c')](db[_0x259c('0x55')][_0x259c('0x34')]);_0xa944d3['query']=_[_0x259c('0x4c')](_0x27e998[_0x259c('0x36')]);_0xa944d3[_0x259c('0x37')]=_[_0x259c('0x38')](_0xa944d3[_0x259c('0x35')],_0xa944d3[_0x259c('0x36')]);_0x2f64fb[_0x259c('0x3a')]=_['intersection'](_0xa944d3[_0x259c('0x35')],qs['fields'](_0x27e998[_0x259c('0x36')][_0x259c('0x39')]));_0x2f64fb['attributes']=_0x2f64fb[_0x259c('0x3a')][_0x259c('0x3b')]?_0x2f64fb[_0x259c('0x3a')]:_0xa944d3[_0x259c('0x35')];_0x2f64fb['order']=qs[_0x259c('0x3e')](_0x27e998[_0x259c('0x36')][_0x259c('0x3e')]);_0x2f64fb[_0x259c('0x3f')]=qs[_0x259c('0x37')](_[_0x259c('0x40')](_0x27e998[_0x259c('0x36')],_0xa944d3['filters']));if(_0x27e998[_0x259c('0x36')][_0x259c('0x41')]){_0x2f64fb['where']=_[_0x259c('0x42')](_0x2f64fb[_0x259c('0x3f')],{'$or':_['map'](_0x2f64fb[_0x259c('0x3a')],function(_0x5b6715){var _0x1afa54={};_0x1afa54[_0x5b6715]={'$like':'%'+_0x27e998[_0x259c('0x36')][_0x259c('0x41')]+'%'};return _0x1afa54;})});}_0x2f64fb=_[_0x259c('0x42')]({},_0x2f64fb,_0x27e998[_0x259c('0x47')]);return _0x373c5a['getSubjects'](_0x2f64fb);}})['then'](function(_0x178b23){if(_0x178b23){_0x2a9c05=_0x178b23[_0x259c('0x3b')];if(!_0x27e998[_0x259c('0x36')][_0x259c('0x3c')]('nolimit')){_0x2f64fb[_0x259c('0x2a')]=qs['limit'](_0x27e998[_0x259c('0x36')][_0x259c('0x2a')]);_0x2f64fb[_0x259c('0x29')]=qs[_0x259c('0x29')](_0x27e998[_0x259c('0x36')][_0x259c('0x29')]);}return _0x373c5a[_0x259c('0x53')](_0x2f64fb);}})[_0x259c('0x1b')](function(_0x5b83e7){if(_0x5b83e7){return _0x5b83e7?{'count':_0x2a9c05,'rows':_0x5b83e7}:null;}})[_0x259c('0x1b')](respondWithResult(_0x592ea3,null))[_0x259c('0x24')](handleError(_0x592ea3,null));};exports['getDescriptions']=function(_0x1d63c2,_0x11d520,_0xf4a112){var _0x100a6c={};var _0x7ca60={};var _0x4b053d;var _0xbe6087;return db[_0x259c('0x33')][_0x259c('0x54')]({'where':{'id':_0x1d63c2[_0x259c('0x50')]['id']}})['then'](handleEntityNotFound(_0x11d520,null))[_0x259c('0x1b')](function(_0x50688b){if(_0x50688b){_0x4b053d=_0x50688b;_0x7ca60[_0x259c('0x35')]=_[_0x259c('0x4c')](db[_0x259c('0x55')]['rawAttributes']);_0x7ca60[_0x259c('0x36')]=_['keys'](_0x1d63c2[_0x259c('0x36')]);_0x7ca60['filters']=_[_0x259c('0x38')](_0x7ca60[_0x259c('0x35')],_0x7ca60[_0x259c('0x36')]);_0x100a6c['attributes']=_['intersection'](_0x7ca60[_0x259c('0x35')],qs[_0x259c('0x39')](_0x1d63c2[_0x259c('0x36')][_0x259c('0x39')]));_0x100a6c['attributes']=_0x100a6c['attributes']['length']?_0x100a6c[_0x259c('0x3a')]:_0x7ca60['model'];_0x100a6c[_0x259c('0x51')]=qs[_0x259c('0x3e')](_0x1d63c2[_0x259c('0x36')][_0x259c('0x3e')]);_0x100a6c[_0x259c('0x3f')]=qs['filters'](_[_0x259c('0x40')](_0x1d63c2[_0x259c('0x36')],_0x7ca60[_0x259c('0x37')]));if(_0x1d63c2[_0x259c('0x36')][_0x259c('0x41')]){_0x100a6c[_0x259c('0x3f')]=_[_0x259c('0x42')](_0x100a6c[_0x259c('0x3f')],{'$or':_[_0x259c('0x43')](_0x100a6c[_0x259c('0x3a')],function(_0x308a5b){var _0xc076b8={};_0xc076b8[_0x308a5b]={'$like':'%'+_0x1d63c2['query'][_0x259c('0x41')]+'%'};return _0xc076b8;})});}_0x100a6c=_[_0x259c('0x42')]({},_0x100a6c,_0x1d63c2[_0x259c('0x47')]);return _0x4b053d[_0x259c('0x56')](_0x100a6c);}})[_0x259c('0x1b')](function(_0x47dc8d){if(_0x47dc8d){_0xbe6087=_0x47dc8d[_0x259c('0x3b')];if(!_0x1d63c2['query']['hasOwnProperty'](_0x259c('0x3d'))){_0x100a6c[_0x259c('0x2a')]=qs[_0x259c('0x2a')](_0x1d63c2['query'][_0x259c('0x2a')]);_0x100a6c[_0x259c('0x29')]=qs['offset'](_0x1d63c2['query']['offset']);}return _0x4b053d[_0x259c('0x56')](_0x100a6c);}})[_0x259c('0x1b')](function(_0x2515c1){if(_0x2515c1){return _0x2515c1?{'count':_0xbe6087,'rows':_0x2515c1}:null;}})[_0x259c('0x1b')](respondWithResult(_0x11d520,null))['catch'](handleError(_0x11d520,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 542c741..7268d98 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 _0xfc86=['lodash','util','../../config/logger','bluebird','request-promise','path','define','Dynamics365Configuration','int_dynamics365_configurations'];(function(_0x41ff5b,_0x2eb449){var _0x31bd5d=function(_0x39018f){while(--_0x39018f){_0x41ff5b['push'](_0x41ff5b['shift']());}};_0x31bd5d(++_0x2eb449);}(_0xfc86,0xfc));var _0x6fc8=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0xfc86[_0x307d2b];return _0xe82587;};'use strict';var _=require(_0x6fc8('0x0'));var util=require(_0x6fc8('0x1'));var logger=require(_0x6fc8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6fc8('0x3'));var rp=require(_0x6fc8('0x4'));var fs=require('fs');var path=require(_0x6fc8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x4ed378,_0x4dad2e){return _0x4ed378[_0x6fc8('0x6')](_0x6fc8('0x7'),attributes,{'tableName':_0x6fc8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70bc=['../../config/environment','define','Dynamics365Configuration','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0xbaa1b9,_0x9cde26){var _0x46b10e=function(_0x353474){while(--_0x353474){_0xbaa1b9['push'](_0xbaa1b9['shift']());}};_0x46b10e(++_0x9cde26);}(_0x70bc,0x1a1));var _0xc70b=function(_0x1a651c,_0x35a72e){_0x1a651c=_0x1a651c-0x0;var _0x5c6b97=_0x70bc[_0x1a651c];return _0x5c6b97;};'use strict';var _=require(_0xc70b('0x0'));var util=require('util');var logger=require(_0xc70b('0x1'))(_0xc70b('0x2'));var moment=require('moment');var BPromise=require(_0xc70b('0x3'));var rp=require(_0xc70b('0x4'));var fs=require('fs');var path=require(_0xc70b('0x5'));var rimraf=require('rimraf');var config=require(_0xc70b('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x34c32a,_0x5282a3){return _0x34c32a[_0xc70b('0x7')](_0xc70b('0x8'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 484e253..431bf0c 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 _0x4ae2=['result','catch','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0xcb914c,_0xffcfa8){var _0x44b87d=function(_0xdefe1e){while(--_0xdefe1e){_0xcb914c['push'](_0xcb914c['shift']());}};_0x44b87d(++_0xffcfa8);}(_0x4ae2,0x167));var _0x24ae=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0x4ae2[_0x18fd0b];return _0x3b19a3;};'use strict';var _=require(_0x24ae('0x0'));var util=require(_0x24ae('0x1'));var moment=require(_0x24ae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x24ae('0x3'));var logger=require('../../config/logger')(_0x24ae('0x4'));var config=require(_0x24ae('0x5'));var jayson=require(_0x24ae('0x6'));var client=jayson[_0x24ae('0x7')][_0x24ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc03b32,_0x5dc8e1,_0x161245){return new BPromise(function(_0x464e10,_0x2e62de){return client[_0x24ae('0x9')](_0xc03b32,_0x161245)[_0x24ae('0xa')](function(_0x35c09d){logger[_0x24ae('0xb')](_0x24ae('0xc'),_0x5dc8e1,'request\x20sent');logger[_0x24ae('0xd')](_0x24ae('0xe'),_0x5dc8e1,'request\x20sent',JSON[_0x24ae('0xf')](_0x35c09d));if(_0x35c09d[_0x24ae('0x10')]){if(_0x35c09d[_0x24ae('0x10')]['code']===0x1f4){logger[_0x24ae('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5dc8e1,_0x35c09d[_0x24ae('0x10')][_0x24ae('0x11')]);return _0x2e62de(_0x35c09d[_0x24ae('0x10')][_0x24ae('0x11')]);}logger[_0x24ae('0x10')](_0x24ae('0xc'),_0x5dc8e1,_0x35c09d[_0x24ae('0x10')]['message']);return _0x464e10(_0x35c09d[_0x24ae('0x10')][_0x24ae('0x11')]);}else{logger[_0x24ae('0xb')](_0x24ae('0xc'),_0x5dc8e1,_0x24ae('0x12'));_0x464e10(_0x35c09d[_0x24ae('0x13')][_0x24ae('0x11')]);}})[_0x24ae('0x14')](function(_0xcdcfe5){logger['error'](_0x24ae('0xc'),_0x5dc8e1,_0xcdcfe5);_0x2e62de(_0xcdcfe5);});});} \ No newline at end of file +var _0xd626=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd626,0x75));var _0x6d62=function(_0xc4d065,_0xa616b8){_0xc4d065=_0xc4d065-0x0;var _0x43f234=_0xd626[_0xc4d065];return _0x43f234;};'use strict';var _=require(_0x6d62('0x0'));var util=require(_0x6d62('0x1'));var moment=require(_0x6d62('0x2'));var BPromise=require(_0x6d62('0x3'));var rs=require(_0x6d62('0x4'));var fs=require('fs');var Redis=require(_0x6d62('0x5'));var db=require(_0x6d62('0x6'))['db'];var utils=require(_0x6d62('0x7'));var logger=require(_0x6d62('0x8'))(_0x6d62('0x9'));var config=require(_0x6d62('0xa'));var jayson=require(_0x6d62('0xb'));var client=jayson['client'][_0x6d62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x228478,_0x45d83c,_0x59ac08){return new BPromise(function(_0x4126bf,_0x4430a3){return client[_0x6d62('0xd')](_0x228478,_0x59ac08)[_0x6d62('0xe')](function(_0x25880f){logger['info'](_0x6d62('0xf'),_0x45d83c,_0x6d62('0x10'));logger[_0x6d62('0x11')](_0x6d62('0x12'),_0x45d83c,_0x6d62('0x10'),JSON['stringify'](_0x25880f));if(_0x25880f[_0x6d62('0x13')]){if(_0x25880f[_0x6d62('0x13')][_0x6d62('0x14')]===0x1f4){logger[_0x6d62('0x13')](_0x6d62('0xf'),_0x45d83c,_0x25880f['error'][_0x6d62('0x15')]);return _0x4430a3(_0x25880f['error'][_0x6d62('0x15')]);}logger[_0x6d62('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45d83c,_0x25880f[_0x6d62('0x13')]['message']);return _0x4126bf(_0x25880f[_0x6d62('0x13')][_0x6d62('0x15')]);}else{logger[_0x6d62('0x16')](_0x6d62('0xf'),_0x45d83c,'request\x20sent');_0x4126bf(_0x25880f[_0x6d62('0x17')]['message']);}})[_0x6d62('0x18')](function(_0x173d64){logger[_0x6d62('0x13')](_0x6d62('0xf'),_0x45d83c,_0x173d64);_0x4430a3(_0x173d64);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index aa8979d..497af7b 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 _0xacb7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xacb7,0x15f));var _0x7acb=function(_0x26c5f8,_0x56b76b){_0x26c5f8=_0x26c5f8-0x0;var _0x1a7d7d=_0xacb7[_0x26c5f8];return _0x1a7d7d;};'use strict';var multer=require(_0x7acb('0x0'));var util=require(_0x7acb('0x1'));var path=require(_0x7acb('0x2'));var timeout=require(_0x7acb('0x3'));var express=require(_0x7acb('0x4'));var router=express[_0x7acb('0x5')]();var auth=require(_0x7acb('0x6'));var interaction=require(_0x7acb('0x7'));var config=require(_0x7acb('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x7acb('0x9')]('/',auth[_0x7acb('0xa')](),controller[_0x7acb('0xb')]);router[_0x7acb('0x9')](_0x7acb('0xc'),auth['isAuthenticated'](),controller[_0x7acb('0xd')]);router[_0x7acb('0xe')]('/',auth[_0x7acb('0xa')](),controller[_0x7acb('0xf')]);router[_0x7acb('0x10')](_0x7acb('0xc'),auth[_0x7acb('0xa')](),controller[_0x7acb('0x11')]);router[_0x7acb('0x12')](_0x7acb('0xc'),auth[_0x7acb('0xa')](),controller[_0x7acb('0x13')]);module[_0x7acb('0x14')]=router; \ No newline at end of file +var _0x00b2=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated','create','put','update'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x00b2,0x110));var _0x200b=function(_0x5f358e,_0x56e0e0){_0x5f358e=_0x5f358e-0x0;var _0x1c9f67=_0x00b2[_0x5f358e];return _0x1c9f67;};'use strict';var multer=require(_0x200b('0x0'));var util=require(_0x200b('0x1'));var path=require(_0x200b('0x2'));var timeout=require(_0x200b('0x3'));var express=require('express');var router=express[_0x200b('0x4')]();var auth=require(_0x200b('0x5'));var interaction=require(_0x200b('0x6'));var config=require(_0x200b('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x200b('0x8')]('/',auth['isAuthenticated'](),controller[_0x200b('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x200b('0xa')]);router[_0x200b('0xb')]('/',auth[_0x200b('0xc')](),controller[_0x200b('0xd')]);router[_0x200b('0xe')]('/:id',auth[_0x200b('0xc')](),controller[_0x200b('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x200b('0x10')]);module[_0x200b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 415fedb..a39031e 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 _0x6e6c=['variable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x12ac2f,_0x52159c){var _0x364a1c=function(_0x4bff87){while(--_0x4bff87){_0x12ac2f['push'](_0x12ac2f['shift']());}};_0x364a1c(++_0x52159c);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable','keyValue'),'defaultValue':_0xc6e6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6e6('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6e6('0x4')]},'idField':{'type':Sequelize[_0xc6e6('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc6e6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6e6('0x4')]}}; \ No newline at end of file +var _0xb58b=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x15ad02,_0x56ace9){var _0x3c87da=function(_0x32ced0){while(--_0x32ced0){_0x15ad02['push'](_0x15ad02['shift']());}};_0x3c87da(++_0x56ace9);}(_0xb58b,0x1f1));var _0xbb58=function(_0x2c139b,_0x55724a){_0x2c139b=_0x2c139b-0x0;var _0x50a72b=_0xb58b[_0x2c139b];return _0x50a72b;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'type':{'type':Sequelize[_0xbb58('0x1')](_0xbb58('0x2'),'variable',_0xbb58('0x3'),_0xbb58('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbb58('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbb58('0x1')](_0xbb58('0x2'),_0xbb58('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xbb58('0x5')]},'idField':{'type':Sequelize[_0xbb58('0x5')]},'nameField':{'type':Sequelize[_0xbb58('0x5')]},'customField':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb58('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a052413..b59d145 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 _0xa5ad=['pick','filter','type','VIRTUAL','field','merge','options','includeAll','include','catch','params','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where'];(function(_0x1e5c0c,_0x313445){var _0x3c98b7=function(_0x48efcc){while(--_0x48efcc){_0x1e5c0c['push'](_0x1e5c0c['shift']());}};_0x3c98b7(++_0x313445);}(_0xa5ad,0xa3));var _0xda5a=function(_0x48b2a4,_0x259086){_0x48b2a4=_0x48b2a4-0x0;var _0x29885f=_0xa5ad[_0x48b2a4];return _0x29885f;};'use strict';var pdf=require(_0xda5a('0x0'));var emlformat=require(_0xda5a('0x1'));var rimraf=require(_0xda5a('0x2'));var zipdir=require(_0xda5a('0x3'));var jsonpatch=require(_0xda5a('0x4'));var rp=require(_0xda5a('0x5'));var moment=require(_0xda5a('0x6'));var BPromise=require(_0xda5a('0x7'));var Mustache=require(_0xda5a('0x8'));var util=require(_0xda5a('0x9'));var path=require(_0xda5a('0xa'));var sox=require(_0xda5a('0xb'));var csv=require(_0xda5a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda5a('0xd'));var squel=require(_0xda5a('0xe'));var crypto=require(_0xda5a('0xf'));var jsforce=require(_0xda5a('0x10'));var deskjs=require(_0xda5a('0x11'));var toCsv=require('to-csv');var querystring=require(_0xda5a('0x12'));var Papa=require(_0xda5a('0x13'));var Redis=require(_0xda5a('0x14'));var authService=require(_0xda5a('0x15'));var qs=require(_0xda5a('0x16'));var hardwareService=require(_0xda5a('0x17'));var logger=require(_0xda5a('0x18'))(_0xda5a('0x19'));var utils=require(_0xda5a('0x1a'));var config=require(_0xda5a('0x1b'));var db=require(_0xda5a('0x1c'))['db'];function respondWithStatusCode(_0x3b1b38,_0x43e854){_0x43e854=_0x43e854||0xcc;return function(_0x356ae4){if(_0x356ae4){return _0x3b1b38[_0xda5a('0x1d')](_0x43e854);}return _0x3b1b38[_0xda5a('0x1e')](_0x43e854)[_0xda5a('0x1f')]();};}function respondWithResult(_0x56032f,_0x4f64ab){_0x4f64ab=_0x4f64ab||0xc8;return function(_0x244d00){if(_0x244d00){return _0x56032f[_0xda5a('0x1e')](_0x4f64ab)['json'](_0x244d00);}};}function respondWithFilteredResult(_0x559578,_0x34ef16){return function(_0x26c640){if(_0x26c640){var _0x6b9805=_0x26c640[_0xda5a('0x20')],_0x54d838=_0x34ef16[_0xda5a('0x21')],_0x3982ac=_0x34ef16[_0xda5a('0x21')]+_0x34ef16[_0xda5a('0x22')],_0x29b45d;if(_0x3982ac>=_0x6b9805){_0x3982ac=_0x6b9805;_0x29b45d=0xc8;}else{_0x29b45d=0xce;}_0x559578[_0xda5a('0x1e')](_0x29b45d);return _0x559578[_0xda5a('0x23')](_0xda5a('0x24'),_0x54d838+'-'+_0x3982ac+'/'+_0x6b9805)[_0xda5a('0x25')](_0x26c640);}return null;};}function patchUpdates(_0x53a220){return function(_0x466eb5){try{jsonpatch['apply'](_0x466eb5,_0x53a220,!![]);}catch(_0x55f348){return BPromise[_0xda5a('0x26')](_0x55f348);}return _0x466eb5[_0xda5a('0x27')]();};}function saveUpdates(_0x4c3503,_0x39ae08){return function(_0x2249c3){if(_0x2249c3){return _0x2249c3['update'](_0x4c3503)[_0xda5a('0x28')](function(_0x4dfd46){return _0x4dfd46;});}return null;};}function removeEntity(_0xd499c9,_0x3774a7){return function(_0x37e1b1){if(_0x37e1b1){return _0x37e1b1[_0xda5a('0x29')]()[_0xda5a('0x28')](function(){_0xd499c9[_0xda5a('0x1e')](0xcc)[_0xda5a('0x1f')]();});}};}function handleEntityNotFound(_0x1d149b,_0x304bb3){return function(_0x55baeb){if(!_0x55baeb){_0x1d149b[_0xda5a('0x1d')](0x194);}return _0x55baeb;};}function handleError(_0x46f0ee,_0x5a9aa0){_0x5a9aa0=_0x5a9aa0||0x1f4;return function(_0x17d307){logger[_0xda5a('0x2a')](_0x17d307[_0xda5a('0x2b')]);if(_0x17d307[_0xda5a('0x2c')]){delete _0x17d307[_0xda5a('0x2c')];}_0x46f0ee['status'](_0x5a9aa0)[_0xda5a('0x2d')](_0x17d307);};}exports[_0xda5a('0x2e')]=function(_0x1f4d0f,_0x18833e){var _0x276776={},_0x17d8f0={},_0x29d8b4={'count':0x0,'rows':[]};var _0x89fc5c=db[_0xda5a('0x2f')][_0xda5a('0x30')];_0x17d8f0[_0xda5a('0x31')]=_['keys'](_0x89fc5c);_0x17d8f0[_0xda5a('0x32')]=_[_0xda5a('0x33')](_0x1f4d0f[_0xda5a('0x32')]);_0x17d8f0[_0xda5a('0x34')]=_[_0xda5a('0x35')](_0x17d8f0[_0xda5a('0x31')],_0x17d8f0[_0xda5a('0x32')]);_0x276776[_0xda5a('0x36')]=_['intersection'](_0x17d8f0[_0xda5a('0x31')],qs[_0xda5a('0x37')](_0x1f4d0f[_0xda5a('0x32')][_0xda5a('0x37')]));_0x276776[_0xda5a('0x36')]=_0x276776[_0xda5a('0x36')][_0xda5a('0x38')]?_0x276776[_0xda5a('0x36')]:_0x17d8f0[_0xda5a('0x31')];if(!_0x1f4d0f[_0xda5a('0x32')]['hasOwnProperty'](_0xda5a('0x39'))){_0x276776['limit']=qs[_0xda5a('0x22')](_0x1f4d0f[_0xda5a('0x32')][_0xda5a('0x22')]);_0x276776[_0xda5a('0x21')]=qs[_0xda5a('0x21')](_0x1f4d0f[_0xda5a('0x32')][_0xda5a('0x21')]);}_0x276776['order']=qs['sort'](_0x1f4d0f[_0xda5a('0x32')]['sort']);_0x276776[_0xda5a('0x3a')]=qs[_0xda5a('0x34')](_[_0xda5a('0x3b')](_0x1f4d0f['query'],_0x17d8f0[_0xda5a('0x34')]));if(_0x1f4d0f[_0xda5a('0x32')][_0xda5a('0x3c')]){_0x276776['where']=_['merge'](_0x276776['where'],{'$or':_['map'](_0x89fc5c,function(_0x478068){if(_0x478068[_0xda5a('0x3d')]['key']!==_0xda5a('0x3e')){var _0x487b7b={};_0x487b7b[_0x478068[_0xda5a('0x3f')]]={'$like':'%'+_0x1f4d0f['query'][_0xda5a('0x3c')]+'%'};return _0x487b7b;}})});}_0x276776=_[_0xda5a('0x40')]({},_0x276776,_0x1f4d0f[_0xda5a('0x41')]);var _0x5110e8={'where':_0x276776['where']};return db[_0xda5a('0x2f')][_0xda5a('0x20')](_0x5110e8)[_0xda5a('0x28')](function(_0x24d291){_0x29d8b4[_0xda5a('0x20')]=_0x24d291;if(_0x1f4d0f['query'][_0xda5a('0x42')]){_0x276776[_0xda5a('0x43')]=[{'all':!![]}];}return db[_0xda5a('0x2f')]['findAll'](_0x276776);})[_0xda5a('0x28')](function(_0x48b2d9){_0x29d8b4['rows']=_0x48b2d9;return _0x29d8b4;})[_0xda5a('0x28')](respondWithFilteredResult(_0x18833e,_0x276776))[_0xda5a('0x44')](handleError(_0x18833e,null));};exports['show']=function(_0x562fae,_0xf5839d){var _0x9e02a9={'raw':!![],'where':{'id':_0x562fae[_0xda5a('0x45')]['id']}},_0x158c0c={};_0x158c0c['model']=_[_0xda5a('0x33')](db[_0xda5a('0x2f')][_0xda5a('0x30')]);_0x158c0c[_0xda5a('0x32')]=_['keys'](_0x562fae[_0xda5a('0x32')]);_0x158c0c[_0xda5a('0x34')]=_[_0xda5a('0x35')](_0x158c0c[_0xda5a('0x31')],_0x158c0c['query']);_0x9e02a9['attributes']=_['intersection'](_0x158c0c[_0xda5a('0x31')],qs[_0xda5a('0x37')](_0x562fae[_0xda5a('0x32')][_0xda5a('0x37')]));_0x9e02a9[_0xda5a('0x36')]=_0x9e02a9[_0xda5a('0x36')]['length']?_0x9e02a9[_0xda5a('0x36')]:_0x158c0c[_0xda5a('0x31')];if(_0x562fae['query'][_0xda5a('0x42')]){_0x9e02a9['include']=[{'all':!![]}];}_0x9e02a9=_[_0xda5a('0x40')]({},_0x9e02a9,_0x562fae['options']);return db[_0xda5a('0x2f')][_0xda5a('0x46')](_0x9e02a9)['then'](handleEntityNotFound(_0xf5839d,null))[_0xda5a('0x28')](respondWithResult(_0xf5839d,null))[_0xda5a('0x44')](handleError(_0xf5839d,null));};exports[_0xda5a('0x47')]=function(_0x59304d,_0x1396b1){return db[_0xda5a('0x2f')][_0xda5a('0x47')](_0x59304d[_0xda5a('0x48')],{})['then'](respondWithResult(_0x1396b1,0xc9))['catch'](handleError(_0x1396b1,null));};exports[_0xda5a('0x49')]=function(_0x5b8dc7,_0x2f9227){if(_0x5b8dc7[_0xda5a('0x48')]['id']){delete _0x5b8dc7[_0xda5a('0x48')]['id'];}return db[_0xda5a('0x2f')]['find']({'where':{'id':_0x5b8dc7['params']['id']}})[_0xda5a('0x28')](handleEntityNotFound(_0x2f9227,null))[_0xda5a('0x28')](saveUpdates(_0x5b8dc7[_0xda5a('0x48')],null))[_0xda5a('0x28')](respondWithResult(_0x2f9227,null))[_0xda5a('0x44')](handleError(_0x2f9227,null));};exports['destroy']=function(_0x1bf284,_0x4c1ec3){return db[_0xda5a('0x2f')][_0xda5a('0x46')]({'where':{'id':_0x1bf284[_0xda5a('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c1ec3,null))[_0xda5a('0x28')](removeEntity(_0x4c1ec3,null))[_0xda5a('0x44')](handleError(_0x4c1ec3,null));}; \ No newline at end of file +var _0x98be=['merge','type','key','VIRTUAL','field','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','Dynamics365Field','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x39bf53,_0x367c0f){var _0x1a1afc=function(_0x42334c){while(--_0x42334c){_0x39bf53['push'](_0x39bf53['shift']());}};_0x1a1afc(++_0x367c0f);}(_0x98be,0x1e5));var _0xe98b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x98be[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0xe98b('0x0'));var emlformat=require(_0xe98b('0x1'));var rimraf=require(_0xe98b('0x2'));var zipdir=require(_0xe98b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe98b('0x4'));var moment=require(_0xe98b('0x5'));var BPromise=require(_0xe98b('0x6'));var Mustache=require(_0xe98b('0x7'));var util=require(_0xe98b('0x8'));var path=require(_0xe98b('0x9'));var sox=require(_0xe98b('0xa'));var csv=require(_0xe98b('0xb'));var ejs=require(_0xe98b('0xc'));var fs=require('fs');var _=require(_0xe98b('0xd'));var squel=require(_0xe98b('0xe'));var crypto=require(_0xe98b('0xf'));var jsforce=require(_0xe98b('0x10'));var deskjs=require(_0xe98b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe98b('0x12'));var Papa=require('papaparse');var Redis=require(_0xe98b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe98b('0x14'));var hardwareService=require(_0xe98b('0x15'));var logger=require(_0xe98b('0x16'))('api');var utils=require(_0xe98b('0x17'));var config=require(_0xe98b('0x18'));var db=require(_0xe98b('0x19'))['db'];function respondWithStatusCode(_0x51ee68,_0x5ec3a8){_0x5ec3a8=_0x5ec3a8||0xcc;return function(_0x392a08){if(_0x392a08){return _0x51ee68[_0xe98b('0x1a')](_0x5ec3a8);}return _0x51ee68[_0xe98b('0x1b')](_0x5ec3a8)[_0xe98b('0x1c')]();};}function respondWithResult(_0x2913f6,_0x5b56a2){_0x5b56a2=_0x5b56a2||0xc8;return function(_0x2e615a){if(_0x2e615a){return _0x2913f6[_0xe98b('0x1b')](_0x5b56a2)[_0xe98b('0x1d')](_0x2e615a);}};}function respondWithFilteredResult(_0x3632b3,_0x58efa3){return function(_0x3aa8f1){if(_0x3aa8f1){var _0x36ba2b=_0x3aa8f1[_0xe98b('0x1e')],_0x269af6=_0x58efa3[_0xe98b('0x1f')],_0x2bd843=_0x58efa3[_0xe98b('0x1f')]+_0x58efa3[_0xe98b('0x20')],_0x1738d4;if(_0x2bd843>=_0x36ba2b){_0x2bd843=_0x36ba2b;_0x1738d4=0xc8;}else{_0x1738d4=0xce;}_0x3632b3[_0xe98b('0x1b')](_0x1738d4);return _0x3632b3[_0xe98b('0x21')]('Content-Range',_0x269af6+'-'+_0x2bd843+'/'+_0x36ba2b)[_0xe98b('0x1d')](_0x3aa8f1);}return null;};}function patchUpdates(_0x1cb009){return function(_0x28e201){try{jsonpatch[_0xe98b('0x22')](_0x28e201,_0x1cb009,!![]);}catch(_0x1abd0f){return BPromise[_0xe98b('0x23')](_0x1abd0f);}return _0x28e201[_0xe98b('0x24')]();};}function saveUpdates(_0x28b310,_0x4b32a1){return function(_0x11215b){if(_0x11215b){return _0x11215b[_0xe98b('0x25')](_0x28b310)['then'](function(_0x150342){return _0x150342;});}return null;};}function removeEntity(_0x51a982,_0x3b7e3c){return function(_0x4b23b2){if(_0x4b23b2){return _0x4b23b2[_0xe98b('0x26')]()[_0xe98b('0x27')](function(){_0x51a982[_0xe98b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc02f,_0x516723){return function(_0x16e058){if(!_0x16e058){_0x3cc02f[_0xe98b('0x1a')](0x194);}return _0x16e058;};}function handleError(_0x321cf0,_0x4ec43e){_0x4ec43e=_0x4ec43e||0x1f4;return function(_0x1c915a){logger[_0xe98b('0x28')](_0x1c915a[_0xe98b('0x29')]);if(_0x1c915a[_0xe98b('0x2a')]){delete _0x1c915a[_0xe98b('0x2a')];}_0x321cf0[_0xe98b('0x1b')](_0x4ec43e)[_0xe98b('0x2b')](_0x1c915a);};}exports[_0xe98b('0x2c')]=function(_0x486d66,_0x195cc6){var _0xee5df={},_0x33cfae={},_0x13c104={'count':0x0,'rows':[]};var _0x4bd7ef=db[_0xe98b('0x2d')][_0xe98b('0x2e')];_0x33cfae['model']=_['keys'](_0x4bd7ef);_0x33cfae[_0xe98b('0x2f')]=_[_0xe98b('0x30')](_0x486d66['query']);_0x33cfae[_0xe98b('0x31')]=_[_0xe98b('0x32')](_0x33cfae[_0xe98b('0x33')],_0x33cfae['query']);_0xee5df[_0xe98b('0x34')]=_[_0xe98b('0x32')](_0x33cfae[_0xe98b('0x33')],qs[_0xe98b('0x35')](_0x486d66[_0xe98b('0x2f')][_0xe98b('0x35')]));_0xee5df[_0xe98b('0x34')]=_0xee5df[_0xe98b('0x34')]['length']?_0xee5df['attributes']:_0x33cfae[_0xe98b('0x33')];if(!_0x486d66['query'][_0xe98b('0x36')](_0xe98b('0x37'))){_0xee5df[_0xe98b('0x20')]=qs[_0xe98b('0x20')](_0x486d66['query'][_0xe98b('0x20')]);_0xee5df[_0xe98b('0x1f')]=qs['offset'](_0x486d66[_0xe98b('0x2f')][_0xe98b('0x1f')]);}_0xee5df[_0xe98b('0x38')]=qs[_0xe98b('0x39')](_0x486d66[_0xe98b('0x2f')]['sort']);_0xee5df[_0xe98b('0x3a')]=qs[_0xe98b('0x31')](_[_0xe98b('0x3b')](_0x486d66[_0xe98b('0x2f')],_0x33cfae[_0xe98b('0x31')]));if(_0x486d66[_0xe98b('0x2f')][_0xe98b('0x3c')]){_0xee5df[_0xe98b('0x3a')]=_[_0xe98b('0x3d')](_0xee5df['where'],{'$or':_['map'](_0x4bd7ef,function(_0x4c18f8){if(_0x4c18f8[_0xe98b('0x3e')][_0xe98b('0x3f')]!==_0xe98b('0x40')){var _0x222925={};_0x222925[_0x4c18f8[_0xe98b('0x41')]]={'$like':'%'+_0x486d66[_0xe98b('0x2f')][_0xe98b('0x3c')]+'%'};return _0x222925;}})});}_0xee5df=_['merge']({},_0xee5df,_0x486d66[_0xe98b('0x42')]);var _0x1ddbe3={'where':_0xee5df[_0xe98b('0x3a')]};return db[_0xe98b('0x2d')]['count'](_0x1ddbe3)[_0xe98b('0x27')](function(_0x455d7d){_0x13c104[_0xe98b('0x1e')]=_0x455d7d;if(_0x486d66[_0xe98b('0x2f')]['includeAll']){_0xee5df[_0xe98b('0x43')]=[{'all':!![]}];}return db[_0xe98b('0x2d')][_0xe98b('0x44')](_0xee5df);})[_0xe98b('0x27')](function(_0x3a2763){_0x13c104[_0xe98b('0x45')]=_0x3a2763;return _0x13c104;})[_0xe98b('0x27')](respondWithFilteredResult(_0x195cc6,_0xee5df))[_0xe98b('0x46')](handleError(_0x195cc6,null));};exports[_0xe98b('0x47')]=function(_0x2f3fcd,_0x50f87d){var _0x29cfb0={'raw':!![],'where':{'id':_0x2f3fcd[_0xe98b('0x48')]['id']}},_0x42cc28={};_0x42cc28[_0xe98b('0x33')]=_[_0xe98b('0x30')](db[_0xe98b('0x2d')][_0xe98b('0x2e')]);_0x42cc28['query']=_[_0xe98b('0x30')](_0x2f3fcd['query']);_0x42cc28['filters']=_[_0xe98b('0x32')](_0x42cc28['model'],_0x42cc28[_0xe98b('0x2f')]);_0x29cfb0[_0xe98b('0x34')]=_[_0xe98b('0x32')](_0x42cc28[_0xe98b('0x33')],qs[_0xe98b('0x35')](_0x2f3fcd[_0xe98b('0x2f')]['fields']));_0x29cfb0[_0xe98b('0x34')]=_0x29cfb0['attributes'][_0xe98b('0x49')]?_0x29cfb0[_0xe98b('0x34')]:_0x42cc28['model'];if(_0x2f3fcd[_0xe98b('0x2f')][_0xe98b('0x4a')]){_0x29cfb0[_0xe98b('0x43')]=[{'all':!![]}];}_0x29cfb0=_[_0xe98b('0x3d')]({},_0x29cfb0,_0x2f3fcd[_0xe98b('0x42')]);return db[_0xe98b('0x2d')][_0xe98b('0x4b')](_0x29cfb0)[_0xe98b('0x27')](handleEntityNotFound(_0x50f87d,null))[_0xe98b('0x27')](respondWithResult(_0x50f87d,null))['catch'](handleError(_0x50f87d,null));};exports['create']=function(_0x3961c7,_0x392e5c){return db[_0xe98b('0x2d')][_0xe98b('0x4c')](_0x3961c7[_0xe98b('0x4d')],{})[_0xe98b('0x27')](respondWithResult(_0x392e5c,0xc9))['catch'](handleError(_0x392e5c,null));};exports[_0xe98b('0x25')]=function(_0x31e99c,_0x101594){if(_0x31e99c[_0xe98b('0x4d')]['id']){delete _0x31e99c[_0xe98b('0x4d')]['id'];}return db[_0xe98b('0x2d')]['find']({'where':{'id':_0x31e99c[_0xe98b('0x48')]['id']}})[_0xe98b('0x27')](handleEntityNotFound(_0x101594,null))[_0xe98b('0x27')](saveUpdates(_0x31e99c['body'],null))[_0xe98b('0x27')](respondWithResult(_0x101594,null))['catch'](handleError(_0x101594,null));};exports[_0xe98b('0x26')]=function(_0x56b84a,_0x55180e){return db[_0xe98b('0x2d')][_0xe98b('0x4b')]({'where':{'id':_0x56b84a[_0xe98b('0x48')]['id']}})[_0xe98b('0x27')](handleEntityNotFound(_0x55180e,null))['then'](removeEntity(_0x55180e,null))[_0xe98b('0x46')](handleError(_0x55180e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3d413e2..c6b1707 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 _0x7a54=['int_dynamics365_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field'];(function(_0x44d4c9,_0x369668){var _0x11aa5f=function(_0x37fdb3){while(--_0x37fdb3){_0x44d4c9['push'](_0x44d4c9['shift']());}};_0x11aa5f(++_0x369668);}(_0x7a54,0x106));var _0x47a5=function(_0x51def7,_0x398a06){_0x51def7=_0x51def7-0x0;var _0x457240=_0x7a54[_0x51def7];return _0x457240;};'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':'dynamics365_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_dynamics365_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field'];(function(_0xb4064,_0x40e10e){var _0x2c4031=function(_0x4d7f2a){while(--_0x4d7f2a){_0xb4064['push'](_0xb4064['shift']());}};_0x2c4031(++_0x40e10e);}(_0x7a54,0x106));var _0x47a5=function(_0x3fb675,_0x17847d){_0x3fb675=_0x3fb675-0x0;var _0x5e9ec2=_0x7a54[_0x3fb675];return _0x5e9ec2;};'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':'dynamics365_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2bebcda..0a8d669 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 _0x2d07=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d07,0x13a));var _0x72d0=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2d07[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdad2db,_0x2a4100,_0x47a826){return new BPromise(function(_0x4f2c34,_0x6d0ff6){return client['request'](_0xdad2db,_0x47a826)['then'](function(_0x5db523){logger[_0x72d0('0xb')](_0x72d0('0xc'),_0x2a4100,_0x72d0('0xd'));logger[_0x72d0('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2a4100,'request\x20sent',JSON['stringify'](_0x5db523));if(_0x5db523[_0x72d0('0xf')]){if(_0x5db523[_0x72d0('0xf')][_0x72d0('0x10')]===0x1f4){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x5db523['error'][_0x72d0('0x11')]);return _0x6d0ff6(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}logger['error'](_0x72d0('0xc'),_0x2a4100,_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);return _0x4f2c34(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}else{logger[_0x72d0('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x2a4100,_0x72d0('0xd'));_0x4f2c34(_0x5db523[_0x72d0('0x12')][_0x72d0('0x11')]);}})[_0x72d0('0x13')](function(_0x2a761c){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x2a761c);_0x6d0ff6(_0x2a761c);});});} \ No newline at end of file +var _0x2f56=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0x2f56,0xb5));var _0x62f5=function(_0x53e36c,_0x5adedd){_0x53e36c=_0x53e36c-0x0;var _0x1fc47d=_0x2f56[_0x53e36c];return _0x1fc47d;};'use strict';var _=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var moment=require(_0x62f5('0x2'));var BPromise=require(_0x62f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62f5('0x4'));var db=require(_0x62f5('0x5'))['db'];var utils=require(_0x62f5('0x6'));var logger=require(_0x62f5('0x7'))(_0x62f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x62f5('0x9'));var client=jayson[_0x62f5('0xa')][_0x62f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x387150,_0x58ae99,_0x3ee814){return new BPromise(function(_0xc11beb,_0x505bfd){return client[_0x62f5('0xc')](_0x387150,_0x3ee814)[_0x62f5('0xd')](function(_0x4a3621){logger[_0x62f5('0xe')](_0x62f5('0xf'),_0x58ae99,_0x62f5('0x10'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x58ae99,_0x62f5('0x10'),JSON[_0x62f5('0x11')](_0x4a3621));if(_0x4a3621[_0x62f5('0x12')]){if(_0x4a3621[_0x62f5('0x12')][_0x62f5('0x13')]===0x1f4){logger[_0x62f5('0x12')](_0x62f5('0xf'),_0x58ae99,_0x4a3621['error'][_0x62f5('0x14')]);return _0x505bfd(_0x4a3621['error'][_0x62f5('0x14')]);}logger[_0x62f5('0x12')](_0x62f5('0xf'),_0x58ae99,_0x4a3621[_0x62f5('0x12')]['message']);return _0xc11beb(_0x4a3621[_0x62f5('0x12')]['message']);}else{logger[_0x62f5('0xe')](_0x62f5('0xf'),_0x58ae99,_0x62f5('0x10'));_0xc11beb(_0x4a3621[_0x62f5('0x15')][_0x62f5('0x14')]);}})[_0x62f5('0x16')](function(_0x2756cb){logger[_0x62f5('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x58ae99,_0x2756cb);_0x505bfd(_0x2756cb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4056055..db9afc2 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 _0x9b7c=['./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9b7c,0x139));var _0xc9b7=function(_0x11008e,_0x3c9be6){_0x11008e=_0x11008e-0x0;var _0x4ae70d=_0x9b7c[_0x11008e];return _0x4ae70d;};'use strict';var multer=require('multer');var util=require(_0xc9b7('0x0'));var path=require(_0xc9b7('0x1'));var timeout=require(_0xc9b7('0x2'));var express=require(_0xc9b7('0x3'));var router=express[_0xc9b7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc9b7('0x5'));var config=require(_0xc9b7('0x6'));var controller=require(_0xc9b7('0x7'));router[_0xc9b7('0x8')]('/',auth[_0xc9b7('0x9')](),controller['index']);router[_0xc9b7('0x8')](_0xc9b7('0xa'),auth[_0xc9b7('0x9')](),controller[_0xc9b7('0xb')]);router['get'](_0xc9b7('0xc'),auth['isAuthenticated'](),controller[_0xc9b7('0xd')]);router[_0xc9b7('0x8')]('/:id/fields',auth[_0xc9b7('0x9')](),controller[_0xc9b7('0xe')]);router[_0xc9b7('0xf')]('/',auth[_0xc9b7('0x9')](),controller[_0xc9b7('0x10')]);router[_0xc9b7('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc9b7('0x11')]);router['put'](_0xc9b7('0xa'),auth[_0xc9b7('0x9')](),controller[_0xc9b7('0x12')]);router['delete'](_0xc9b7('0xa'),auth['isAuthenticated'](),controller[_0xc9b7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7751=['/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshdeskAccount.controller','get','/:id','show'];(function(_0x84797a,_0x3557f3){var _0x2fd077=function(_0x52aad2){while(--_0x52aad2){_0x84797a['push'](_0x84797a['shift']());}};_0x2fd077(++_0x3557f3);}(_0x7751,0x155));var _0x1775=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7751[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1775('0x0'));var util=require(_0x1775('0x1'));var path=require(_0x1775('0x2'));var timeout=require(_0x1775('0x3'));var express=require(_0x1775('0x4'));var router=express[_0x1775('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1775('0x6'));var controller=require(_0x1775('0x7'));router[_0x1775('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1775('0x8')](_0x1775('0x9'),auth['isAuthenticated'](),controller[_0x1775('0xa')]);router[_0x1775('0x8')](_0x1775('0xb'),auth[_0x1775('0xc')](),controller['getConfigurations']);router[_0x1775('0x8')](_0x1775('0xd'),auth['isAuthenticated'](),controller[_0x1775('0xe')]);router[_0x1775('0xf')]('/',auth[_0x1775('0xc')](),controller[_0x1775('0x10')]);router[_0x1775('0xf')](_0x1775('0xb'),auth[_0x1775('0xc')](),controller[_0x1775('0x11')]);router[_0x1775('0x12')](_0x1775('0x9'),auth[_0x1775('0xc')](),controller[_0x1775('0x13')]);router[_0x1775('0x14')](_0x1775('0x9'),auth[_0x1775('0xc')](),controller['destroy']);module[_0x1775('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 39b4b0e..41b51d7 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 _0xb175=['sequelize','exports','STRING','username'];(function(_0x4358d1,_0x52ac73){var _0x4cd4fc=function(_0x26f988){while(--_0x26f988){_0x4358d1['push'](_0x4358d1['shift']());}};_0x4cd4fc(++_0x52ac73);}(_0xb175,0x1a4));var _0x5b17=function(_0x1040c4,_0x50a88a){_0x1040c4=_0x1040c4-0x0;var _0x303d9e=_0xb175[_0x1040c4];return _0x303d9e;};'use strict';var Sequelize=require(_0x5b17('0x0'));module[_0x5b17('0x1')]={'name':{'type':Sequelize[_0x5b17('0x2')]},'description':{'type':Sequelize[_0x5b17('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x5b17('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x431d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x431d,0x1db));var _0xd431=function(_0x28aeb2,_0x319b38){_0x28aeb2=_0x28aeb2-0x0;var _0x1d33e1=_0x431d[_0x28aeb2];return _0x1d33e1;};'use strict';var Sequelize=require(_0xd431('0x0'));module[_0xd431('0x1')]={'name':{'type':Sequelize[_0xd431('0x2')]},'description':{'type':Sequelize[_0xd431('0x2')]},'username':{'type':Sequelize[_0xd431('0x2')],'unique':_0xd431('0x3')},'apiKey':{'type':Sequelize[_0xd431('0x2')]},'remoteUri':{'type':Sequelize[_0xd431('0x2')],'unique':_0xd431('0x4')},'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 b0068c1..2384e01 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 _0x25ed=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','name','FreshdeskAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','field','options','count','includeAll','include','findAll','rows','params','find','create','body','findOne','FreshdeskConfiguration','sort','map','getConfigurations','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4f595e,_0x20a345){var _0x4684b0=function(_0x5ad986){while(--_0x5ad986){_0x4f595e['push'](_0x4f595e['shift']());}};_0x4684b0(++_0x20a345);}(_0x25ed,0x1e8));var _0xd25e=function(_0x5b95d9,_0x24d08e){_0x5b95d9=_0x5b95d9-0x0;var _0x20523c=_0x25ed[_0x5b95d9];return _0x20523c;};'use strict';var pdf=require(_0xd25e('0x0'));var emlformat=require(_0xd25e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd25e('0x2'));var jsonpatch=require(_0xd25e('0x3'));var rp=require(_0xd25e('0x4'));var moment=require(_0xd25e('0x5'));var BPromise=require(_0xd25e('0x6'));var Mustache=require(_0xd25e('0x7'));var util=require(_0xd25e('0x8'));var path=require(_0xd25e('0x9'));var sox=require(_0xd25e('0xa'));var csv=require(_0xd25e('0xb'));var ejs=require(_0xd25e('0xc'));var fs=require('fs');var _=require(_0xd25e('0xd'));var squel=require(_0xd25e('0xe'));var crypto=require(_0xd25e('0xf'));var jsforce=require(_0xd25e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd25e('0xb'));var querystring=require(_0xd25e('0x11'));var Papa=require(_0xd25e('0x12'));var Redis=require(_0xd25e('0x13'));var authService=require(_0xd25e('0x14'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd25e('0x15'));var config=require(_0xd25e('0x16'));var db=require(_0xd25e('0x17'))['db'];var integrations=require(_0xd25e('0x18'));var jayson=require(_0xd25e('0x19'));var client=jayson[_0xd25e('0x1a')][_0xd25e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2afb97,_0x50986e,_0x58cdc7){if(_0x58cdc7){var _0x3350ef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3350ef[_0xd25e('0x1c')](_0x50986e)){return _0x2afb97;}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 _0x2afb97;}}function respondWithRpcPromise(_0x293388,_0x862015,_0x296cc7,_0x2ebd2d){return new BPromise(function(_0x5e9481,_0x1bed2e){var _0x48c98e=_0x2ebd2d||client;return _0x48c98e[_0xd25e('0x1d')](_0x293388,_0x296cc7)['then'](function(_0x2b8bb2){logger['info'](_0xd25e('0x1e'),_0x862015,_0xd25e('0x1f'));logger[_0xd25e('0x20')](_0xd25e('0x21'),_0x862015,_0xd25e('0x1f'),JSON[_0xd25e('0x22')](_0x2b8bb2));if(_0x2b8bb2[_0xd25e('0x23')]){if(_0x2b8bb2[_0xd25e('0x23')][_0xd25e('0x24')]===0x1f4){logger[_0xd25e('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x862015,_0x2b8bb2[_0xd25e('0x23')][_0xd25e('0x25')]);return _0x1bed2e(_0x2b8bb2[_0xd25e('0x23')]['message']);}logger[_0xd25e('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x862015,_0x2b8bb2[_0xd25e('0x23')][_0xd25e('0x25')]);return _0x5e9481(_0x2b8bb2[_0xd25e('0x23')][_0xd25e('0x25')]);}else{logger[_0xd25e('0x26')](_0xd25e('0x1e'),_0x862015,_0xd25e('0x1f'));_0x5e9481(_0x2b8bb2[_0xd25e('0x27')]['message']);}})[_0xd25e('0x28')](function(_0x3f6c9d){logger[_0xd25e('0x23')](_0xd25e('0x1e'),_0x862015,_0x3f6c9d);_0x1bed2e(_0x3f6c9d);});});}function respondWithStatusCode(_0x30f785,_0x3a1b08){_0x3a1b08=_0x3a1b08||0xcc;return function(_0x1250d6){if(_0x1250d6){return _0x30f785['sendStatus'](_0x3a1b08);}return _0x30f785[_0xd25e('0x29')](_0x3a1b08)[_0xd25e('0x2a')]();};}function respondWithResult(_0x15e802,_0x33970e){_0x33970e=_0x33970e||0xc8;return function(_0x43e038){if(_0x43e038){return _0x15e802[_0xd25e('0x29')](_0x33970e)['json'](_0x43e038);}};}function respondWithFilteredResult(_0x32df25,_0xb900c1){return function(_0x4b3c86){if(_0x4b3c86){var _0x4133a9=_0x4b3c86['count'],_0x3f46c9=_0xb900c1[_0xd25e('0x2b')],_0x21f7ee=_0xb900c1[_0xd25e('0x2b')]+_0xb900c1[_0xd25e('0x2c')],_0xafb7d;if(_0x21f7ee>=_0x4133a9){_0x21f7ee=_0x4133a9;_0xafb7d=0xc8;}else{_0xafb7d=0xce;}_0x32df25[_0xd25e('0x29')](_0xafb7d);return _0x32df25[_0xd25e('0x2d')]('Content-Range',_0x3f46c9+'-'+_0x21f7ee+'/'+_0x4133a9)['json'](_0x4b3c86);}return null;};}function patchUpdates(_0x30642e){return function(_0x489f68){try{jsonpatch[_0xd25e('0x2e')](_0x489f68,_0x30642e,!![]);}catch(_0x225eed){return BPromise[_0xd25e('0x2f')](_0x225eed);}return _0x489f68[_0xd25e('0x30')]();};}function saveUpdates(_0x39e1c8,_0xcff3af){return function(_0x94f360){if(_0x94f360){return _0x94f360[_0xd25e('0x31')](_0x39e1c8)[_0xd25e('0x32')](function(_0x22b5cb){return _0x22b5cb;});}return null;};}function removeEntity(_0x4c668a,_0x39e359){return function(_0xfcf88c){if(_0xfcf88c){return _0xfcf88c[_0xd25e('0x33')]()[_0xd25e('0x32')](function(){_0x4c668a[_0xd25e('0x29')](0xcc)[_0xd25e('0x2a')]();});}};}function handleEntityNotFound(_0x6cfc7b,_0x531611){return function(_0x35a771){if(!_0x35a771){_0x6cfc7b[_0xd25e('0x34')](0x194);}return _0x35a771;};}function handleError(_0x5689de,_0x236f07){_0x236f07=_0x236f07||0x1f4;return function(_0x47b928){logger[_0xd25e('0x23')](_0x47b928['stack']);if(_0x47b928['name']){delete _0x47b928[_0xd25e('0x35')];}_0x5689de[_0xd25e('0x29')](_0x236f07)['send'](_0x47b928);};}exports['index']=function(_0x2a44ff,_0x2482e2){var _0x470985={},_0x5b2d16={},_0x5d14c5={'count':0x0,'rows':[]};var _0xbbc5b0=db[_0xd25e('0x36')][_0xd25e('0x37')];_0x5b2d16[_0xd25e('0x38')]=_[_0xd25e('0x39')](_0xbbc5b0);_0x5b2d16[_0xd25e('0x3a')]=_[_0xd25e('0x39')](_0x2a44ff[_0xd25e('0x3a')]);_0x5b2d16[_0xd25e('0x3b')]=_[_0xd25e('0x3c')](_0x5b2d16[_0xd25e('0x38')],_0x5b2d16['query']);_0x470985[_0xd25e('0x3d')]=_[_0xd25e('0x3c')](_0x5b2d16[_0xd25e('0x38')],qs[_0xd25e('0x3e')](_0x2a44ff[_0xd25e('0x3a')][_0xd25e('0x3e')]));_0x470985[_0xd25e('0x3d')]=_0x470985['attributes'][_0xd25e('0x3f')]?_0x470985['attributes']:_0x5b2d16[_0xd25e('0x38')];if(!_0x2a44ff[_0xd25e('0x3a')][_0xd25e('0x40')]('nolimit')){_0x470985[_0xd25e('0x2c')]=qs[_0xd25e('0x2c')](_0x2a44ff[_0xd25e('0x3a')][_0xd25e('0x2c')]);_0x470985[_0xd25e('0x2b')]=qs[_0xd25e('0x2b')](_0x2a44ff[_0xd25e('0x3a')][_0xd25e('0x2b')]);}_0x470985[_0xd25e('0x41')]=qs['sort'](_0x2a44ff[_0xd25e('0x3a')]['sort']);_0x470985[_0xd25e('0x42')]=qs[_0xd25e('0x3b')](_[_0xd25e('0x43')](_0x2a44ff[_0xd25e('0x3a')],_0x5b2d16[_0xd25e('0x3b')]));if(_0x2a44ff[_0xd25e('0x3a')][_0xd25e('0x44')]){_0x470985[_0xd25e('0x42')]=_[_0xd25e('0x45')](_0x470985[_0xd25e('0x42')],{'$or':_['map'](_0xbbc5b0,function(_0x24f960){if(_0x24f960[_0xd25e('0x46')]['key']!=='VIRTUAL'){var _0x5981d0={};_0x5981d0[_0x24f960[_0xd25e('0x47')]]={'$like':'%'+_0x2a44ff['query'][_0xd25e('0x44')]+'%'};return _0x5981d0;}})});}_0x470985=_['merge']({},_0x470985,_0x2a44ff[_0xd25e('0x48')]);var _0x512295={'where':_0x470985['where']};return db[_0xd25e('0x36')]['count'](_0x512295)[_0xd25e('0x32')](function(_0x49a0ff){_0x5d14c5[_0xd25e('0x49')]=_0x49a0ff;if(_0x2a44ff['query'][_0xd25e('0x4a')]){_0x470985[_0xd25e('0x4b')]=[{'all':!![]}];}return db[_0xd25e('0x36')][_0xd25e('0x4c')](_0x470985);})['then'](function(_0x142967){_0x5d14c5[_0xd25e('0x4d')]=_0x142967;return _0x5d14c5;})[_0xd25e('0x32')](respondWithFilteredResult(_0x2482e2,_0x470985))[_0xd25e('0x28')](handleError(_0x2482e2,null));};exports['show']=function(_0x3f698d,_0x3f6bd5){var _0x5088a5={'raw':![],'where':{'id':_0x3f698d[_0xd25e('0x4e')]['id']}},_0x2e340d={};_0x2e340d['model']=_[_0xd25e('0x39')](db['FreshdeskAccount']['rawAttributes']);_0x2e340d['query']=_['keys'](_0x3f698d[_0xd25e('0x3a')]);_0x2e340d['filters']=_[_0xd25e('0x3c')](_0x2e340d[_0xd25e('0x38')],_0x2e340d[_0xd25e('0x3a')]);_0x5088a5[_0xd25e('0x3d')]=_[_0xd25e('0x3c')](_0x2e340d[_0xd25e('0x38')],qs['fields'](_0x3f698d['query']['fields']));_0x5088a5[_0xd25e('0x3d')]=_0x5088a5[_0xd25e('0x3d')][_0xd25e('0x3f')]?_0x5088a5['attributes']:_0x2e340d[_0xd25e('0x38')];if(_0x3f698d[_0xd25e('0x3a')][_0xd25e('0x4a')]){_0x5088a5[_0xd25e('0x4b')]=[{'all':!![]}];}_0x5088a5=_[_0xd25e('0x45')]({},_0x5088a5,_0x3f698d[_0xd25e('0x48')]);return db['FreshdeskAccount'][_0xd25e('0x4f')](_0x5088a5)['then'](handleEntityNotFound(_0x3f6bd5,null))[_0xd25e('0x32')](respondWithResult(_0x3f6bd5,null))[_0xd25e('0x28')](handleError(_0x3f6bd5,null));};exports['create']=function(_0x36dc2f,_0x4411e7){return db[_0xd25e('0x36')][_0xd25e('0x50')](_0x36dc2f[_0xd25e('0x51')],{})[_0xd25e('0x32')](respondWithResult(_0x4411e7,0xc9))[_0xd25e('0x28')](handleError(_0x4411e7,null));};exports[_0xd25e('0x31')]=function(_0x5d484c,_0x25d91c){if(_0x5d484c['body']['id']){delete _0x5d484c['body']['id'];}return db[_0xd25e('0x36')][_0xd25e('0x4f')]({'where':{'id':_0x5d484c[_0xd25e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x25d91c,null))[_0xd25e('0x32')](saveUpdates(_0x5d484c[_0xd25e('0x51')],null))[_0xd25e('0x32')](respondWithResult(_0x25d91c,null))[_0xd25e('0x28')](handleError(_0x25d91c,null));};exports[_0xd25e('0x33')]=function(_0x13b623,_0x9dce7c){return db[_0xd25e('0x36')][_0xd25e('0x4f')]({'where':{'id':_0x13b623['params']['id']}})['then'](handleEntityNotFound(_0x9dce7c,null))['then'](removeEntity(_0x9dce7c,null))['catch'](handleError(_0x9dce7c,null));};exports['getConfigurations']=function(_0x348e7b,_0xc3e6f2,_0x12f958){var _0x51c909={};var _0x22c611={};var _0x28714c;var _0x88fda7;return db[_0xd25e('0x36')][_0xd25e('0x52')]({'where':{'id':_0x348e7b[_0xd25e('0x4e')]['id']}})[_0xd25e('0x32')](handleEntityNotFound(_0xc3e6f2,null))['then'](function(_0x529ee7){if(_0x529ee7){_0x28714c=_0x529ee7;_0x22c611['model']=_[_0xd25e('0x39')](db[_0xd25e('0x53')]['rawAttributes']);_0x22c611[_0xd25e('0x3a')]=_[_0xd25e('0x39')](_0x348e7b[_0xd25e('0x3a')]);_0x22c611[_0xd25e('0x3b')]=_['intersection'](_0x22c611[_0xd25e('0x38')],_0x22c611[_0xd25e('0x3a')]);_0x51c909[_0xd25e('0x3d')]=_[_0xd25e('0x3c')](_0x22c611['model'],qs[_0xd25e('0x3e')](_0x348e7b['query'][_0xd25e('0x3e')]));_0x51c909[_0xd25e('0x3d')]=_0x51c909[_0xd25e('0x3d')][_0xd25e('0x3f')]?_0x51c909[_0xd25e('0x3d')]:_0x22c611['model'];_0x51c909[_0xd25e('0x41')]=qs[_0xd25e('0x54')](_0x348e7b[_0xd25e('0x3a')][_0xd25e('0x54')]);_0x51c909[_0xd25e('0x42')]=qs[_0xd25e('0x3b')](_[_0xd25e('0x43')](_0x348e7b[_0xd25e('0x3a')],_0x22c611[_0xd25e('0x3b')]));if(_0x348e7b[_0xd25e('0x3a')][_0xd25e('0x44')]){_0x51c909[_0xd25e('0x42')]=_[_0xd25e('0x45')](_0x51c909['where'],{'$or':_[_0xd25e('0x55')](_0x51c909['attributes'],function(_0x30aa92){var _0x2e4b19={};_0x2e4b19[_0x30aa92]={'$like':'%'+_0x348e7b[_0xd25e('0x3a')]['filter']+'%'};return _0x2e4b19;})});}_0x51c909=_[_0xd25e('0x45')]({},_0x51c909,_0x348e7b[_0xd25e('0x48')]);return _0x28714c[_0xd25e('0x56')](_0x51c909);}})['then'](function(_0x5464d5){if(_0x5464d5){_0x88fda7=_0x5464d5[_0xd25e('0x3f')];if(!_0x348e7b[_0xd25e('0x3a')][_0xd25e('0x40')](_0xd25e('0x57'))){_0x51c909['limit']=qs[_0xd25e('0x2c')](_0x348e7b[_0xd25e('0x3a')]['limit']);_0x51c909['offset']=qs[_0xd25e('0x2b')](_0x348e7b[_0xd25e('0x3a')][_0xd25e('0x2b')]);}return _0x28714c['getConfigurations'](_0x51c909);}})['then'](function(_0x36c503){if(_0x36c503){return _0x36c503?{'count':_0x88fda7,'rows':_0x36c503}:null;}})[_0xd25e('0x32')](respondWithResult(_0xc3e6f2,null))[_0xd25e('0x28')](handleError(_0xc3e6f2,null));};exports[_0xd25e('0x58')]=function(_0x5a7bc8,_0x3feb45,_0x1bbd1e){if(_0x5a7bc8[_0xd25e('0x51')]['id']){delete _0x5a7bc8[_0xd25e('0x51')]['id'];}return db[_0xd25e('0x36')]['findOne']({'where':{'id':_0x5a7bc8[_0xd25e('0x4e')]['id']}})[_0xd25e('0x32')](handleEntityNotFound(_0x3feb45,null))[_0xd25e('0x32')](function(_0x3adf28){if(_0x3adf28){_0x5a7bc8[_0xd25e('0x51')]['AccountId']=_0x3adf28['id'];_0x5a7bc8['body']['Subjects']=integrations[_0xd25e('0x59')](_0x5a7bc8[_0xd25e('0x51')][_0xd25e('0x5a')],_0x5a7bc8['body']['type']);_0x5a7bc8[_0xd25e('0x51')][_0xd25e('0x5b')]=integrations[_0xd25e('0x5c')](_0x5a7bc8[_0xd25e('0x51')]['channel'],_0x5a7bc8[_0xd25e('0x51')]['type']);return db[_0xd25e('0x53')][_0xd25e('0x50')](_0x5a7bc8[_0xd25e('0x51')],{'include':[{'model':db[_0xd25e('0x5d')],'as':_0xd25e('0x5e')},{'model':db[_0xd25e('0x5d')],'as':_0xd25e('0x5b')}]});}return null;})[_0xd25e('0x32')](respondWithResult(_0x3feb45,null))[_0xd25e('0x28')](handleError(_0x3feb45,null));};exports[_0xd25e('0x5f')]=function(_0x3eb9d3,_0x435998,_0x2ef844){var _0x4a2743='';return db[_0xd25e('0x36')][_0xd25e('0x52')]({'where':{'id':_0x3eb9d3[_0xd25e('0x4e')]['id']},'attributes':['id',_0xd25e('0x60'),_0xd25e('0x61')]})[_0xd25e('0x32')](handleEntityNotFound(_0x435998,null))[_0xd25e('0x32')](function(_0x1adff1){if(_0x1adff1){_0x4a2743=_0x1adff1[_0xd25e('0x60')];var _0x4ddf64=_0x4a2743[_0xd25e('0x62')](-0x1);if(_0x4ddf64==='/'){_0x4a2743=_0x4a2743[_0xd25e('0x63')](0x0,_0x4a2743[_0xd25e('0x64')](_0x4ddf64));}return rp({'method':'GET','uri':util['format']('%s/%s',_0x4a2743,_0xd25e('0x65')),'headers':{'Authorization':util['format'](_0xd25e('0x66'),new Buffer(util['format'](_0xd25e('0x67'),_0x1adff1['apiKey']))[_0xd25e('0x68')](_0xd25e('0x69')))},'json':!![]});}})[_0xd25e('0x32')](function(_0x6a593e){if(_0x6a593e){var _0x560522=[_0xd25e('0x6a'),'subject',_0xd25e('0x6b'),_0xd25e('0x6c'),_0xd25e('0x29'),_0xd25e('0x6d'),_0xd25e('0x6e'),_0xd25e('0x6f'),_0xd25e('0x70'),_0xd25e('0x6e'),_0xd25e('0x71')];_[_0xd25e('0x72')](_0x6a593e,function(_0x3a8017){return _0x560522[_0xd25e('0x73')](_0x3a8017[_0xd25e('0x35')])||!_0x3a8017[_0xd25e('0x74')]&&_0x3a8017[_0xd25e('0x46')]!=='custom_text'&&_0x3a8017[_0xd25e('0x46')]!==_0xd25e('0x75');});return{'count':_0x6a593e[_0xd25e('0x3f')],'rows':_[_0xd25e('0x55')](_0x6a593e,function(_0x3b3583){return{'id':_0x3b3583[_0xd25e('0x35')],'name':_0x3b3583[_0xd25e('0x76')],'custom':!_0x3b3583[_0xd25e('0x74')],'options':_0x3b3583[_0xd25e('0x77')]?_['map'](_0x3b3583[_0xd25e('0x77')],function(_0x1c3dd3){return{'name':_[_0xd25e('0x78')](_0x1c3dd3),'value':_0x1c3dd3};}):[]};})};}})['then'](respondWithResult(_0x435998,null))[_0xd25e('0x28')](function(_0x2b4414){var _0x29eb55=_0x3eb9d3[_0xd25e('0x3a')][_0xd25e('0x1c')]?0x1f4:_0x2b4414[_0xd25e('0x79')]||0x1f4;logger[_0xd25e('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x29eb55,JSON['stringify'](_0x2b4414));delete _0x2b4414[_0xd25e('0x35')];if(_0x29eb55===0x191){_0x29eb55=0x190;}_0x435998[_0xd25e('0x29')](_0x29eb55)[_0xd25e('0x7a')](_0x3eb9d3[_0xd25e('0x3a')][_0xd25e('0x1c')]?{'message':_0xd25e('0x7b'),'statusCode':_0x2b4414[_0xd25e('0x79')]}:_0x2b4414);});}; \ No newline at end of file +var _0x7d28=['toString','subject','agent','description','priority','group','source','company','remove','includes','default','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','field','options','count','includeAll','include','FreshdeskAccount','findAll','rows','show','merge','find','create','body','params','getConfigurations','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X'];(function(_0x4ed17b,_0x2b1745){var _0x24b248=function(_0x136ab1){while(--_0x136ab1){_0x4ed17b['push'](_0x4ed17b['shift']());}};_0x24b248(++_0x2b1745);}(_0x7d28,0x112));var _0x87d2=function(_0x7d84fb,_0x143672){_0x7d84fb=_0x7d84fb-0x0;var _0x59fd7b=_0x7d28[_0x7d84fb];return _0x59fd7b;};'use strict';var pdf=require(_0x87d2('0x0'));var emlformat=require(_0x87d2('0x1'));var rimraf=require(_0x87d2('0x2'));var zipdir=require(_0x87d2('0x3'));var jsonpatch=require(_0x87d2('0x4'));var rp=require(_0x87d2('0x5'));var moment=require('moment');var BPromise=require(_0x87d2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x87d2('0x7'));var sox=require('sox');var csv=require(_0x87d2('0x8'));var ejs=require(_0x87d2('0x9'));var fs=require('fs');var _=require(_0x87d2('0xa'));var squel=require(_0x87d2('0xb'));var crypto=require(_0x87d2('0xc'));var jsforce=require(_0x87d2('0xd'));var deskjs=require(_0x87d2('0xe'));var toCsv=require(_0x87d2('0x8'));var querystring=require(_0x87d2('0xf'));var Papa=require('papaparse');var Redis=require(_0x87d2('0x10'));var authService=require(_0x87d2('0x11'));var qs=require(_0x87d2('0x12'));var hardwareService=require(_0x87d2('0x13'));var logger=require(_0x87d2('0x14'))(_0x87d2('0x15'));var utils=require(_0x87d2('0x16'));var config=require(_0x87d2('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x87d2('0x18'));var jayson=require(_0x87d2('0x19'));var client=jayson[_0x87d2('0x1a')][_0x87d2('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2a9387,_0x57ec73,_0x1fb66b){if(_0x1fb66b){var _0x1180ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1180ed['test'](_0x57ec73)){return _0x2a9387;}else{throw new Error(_0x87d2('0x1c'));}}else{return _0x2a9387;}}function respondWithRpcPromise(_0x2ba3c4,_0x39f1ed,_0x4f5a1d,_0x3d203a){return new BPromise(function(_0x4bb56e,_0x3ee74a){var _0x5bc682=_0x3d203a||client;return _0x5bc682[_0x87d2('0x1d')](_0x2ba3c4,_0x4f5a1d)[_0x87d2('0x1e')](function(_0x51cd23){logger[_0x87d2('0x1f')](_0x87d2('0x20'),_0x39f1ed,'request\x20sent');logger[_0x87d2('0x21')](_0x87d2('0x22'),_0x39f1ed,_0x87d2('0x23'),JSON['stringify'](_0x51cd23));if(_0x51cd23['error']){if(_0x51cd23[_0x87d2('0x24')][_0x87d2('0x25')]===0x1f4){logger[_0x87d2('0x24')](_0x87d2('0x20'),_0x39f1ed,_0x51cd23[_0x87d2('0x24')][_0x87d2('0x26')]);return _0x3ee74a(_0x51cd23[_0x87d2('0x24')][_0x87d2('0x26')]);}logger[_0x87d2('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x39f1ed,_0x51cd23['error'][_0x87d2('0x26')]);return _0x4bb56e(_0x51cd23['error'][_0x87d2('0x26')]);}else{logger['info'](_0x87d2('0x20'),_0x39f1ed,'request\x20sent');_0x4bb56e(_0x51cd23[_0x87d2('0x27')][_0x87d2('0x26')]);}})[_0x87d2('0x28')](function(_0x4c2816){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x39f1ed,_0x4c2816);_0x3ee74a(_0x4c2816);});});}function respondWithStatusCode(_0x542095,_0x1189e1){_0x1189e1=_0x1189e1||0xcc;return function(_0x25c18f){if(_0x25c18f){return _0x542095[_0x87d2('0x29')](_0x1189e1);}return _0x542095[_0x87d2('0x2a')](_0x1189e1)[_0x87d2('0x2b')]();};}function respondWithResult(_0x2fd268,_0x23e95d){_0x23e95d=_0x23e95d||0xc8;return function(_0x38da34){if(_0x38da34){return _0x2fd268[_0x87d2('0x2a')](_0x23e95d)[_0x87d2('0x2c')](_0x38da34);}};}function respondWithFilteredResult(_0x48f65c,_0x2ea1d6){return function(_0x16aa1f){if(_0x16aa1f){var _0x15ad34=_0x16aa1f['count'],_0x2b932e=_0x2ea1d6['offset'],_0x3ced2a=_0x2ea1d6[_0x87d2('0x2d')]+_0x2ea1d6[_0x87d2('0x2e')],_0x92d513;if(_0x3ced2a>=_0x15ad34){_0x3ced2a=_0x15ad34;_0x92d513=0xc8;}else{_0x92d513=0xce;}_0x48f65c['status'](_0x92d513);return _0x48f65c[_0x87d2('0x2f')](_0x87d2('0x30'),_0x2b932e+'-'+_0x3ced2a+'/'+_0x15ad34)[_0x87d2('0x2c')](_0x16aa1f);}return null;};}function patchUpdates(_0x329ddf){return function(_0x5089fe){try{jsonpatch['apply'](_0x5089fe,_0x329ddf,!![]);}catch(_0x30c90b){return BPromise[_0x87d2('0x31')](_0x30c90b);}return _0x5089fe['save']();};}function saveUpdates(_0x306984,_0x143b6e){return function(_0x207113){if(_0x207113){return _0x207113[_0x87d2('0x32')](_0x306984)['then'](function(_0x252cf0){return _0x252cf0;});}return null;};}function removeEntity(_0x212c03,_0x152aa8){return function(_0x341f90){if(_0x341f90){return _0x341f90[_0x87d2('0x33')]()[_0x87d2('0x1e')](function(){_0x212c03[_0x87d2('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83ebe3,_0x30d646){return function(_0x8ba6c6){if(!_0x8ba6c6){_0x83ebe3['sendStatus'](0x194);}return _0x8ba6c6;};}function handleError(_0x935c32,_0x2394ac){_0x2394ac=_0x2394ac||0x1f4;return function(_0xfe90eb){logger[_0x87d2('0x24')](_0xfe90eb[_0x87d2('0x34')]);if(_0xfe90eb[_0x87d2('0x35')]){delete _0xfe90eb['name'];}_0x935c32[_0x87d2('0x2a')](_0x2394ac)[_0x87d2('0x36')](_0xfe90eb);};}exports[_0x87d2('0x37')]=function(_0x14e977,_0x5f2ac5){var _0x30d728={},_0x3343aa={},_0x4f3c29={'count':0x0,'rows':[]};var _0x17eb07=db['FreshdeskAccount'][_0x87d2('0x38')];_0x3343aa[_0x87d2('0x39')]=_[_0x87d2('0x3a')](_0x17eb07);_0x3343aa[_0x87d2('0x3b')]=_[_0x87d2('0x3a')](_0x14e977[_0x87d2('0x3b')]);_0x3343aa[_0x87d2('0x3c')]=_['intersection'](_0x3343aa[_0x87d2('0x39')],_0x3343aa[_0x87d2('0x3b')]);_0x30d728[_0x87d2('0x3d')]=_[_0x87d2('0x3e')](_0x3343aa[_0x87d2('0x39')],qs[_0x87d2('0x3f')](_0x14e977[_0x87d2('0x3b')][_0x87d2('0x3f')]));_0x30d728['attributes']=_0x30d728['attributes'][_0x87d2('0x40')]?_0x30d728[_0x87d2('0x3d')]:_0x3343aa['model'];if(!_0x14e977[_0x87d2('0x3b')][_0x87d2('0x41')](_0x87d2('0x42'))){_0x30d728[_0x87d2('0x2e')]=qs['limit'](_0x14e977[_0x87d2('0x3b')]['limit']);_0x30d728['offset']=qs[_0x87d2('0x2d')](_0x14e977[_0x87d2('0x3b')]['offset']);}_0x30d728[_0x87d2('0x43')]=qs[_0x87d2('0x44')](_0x14e977[_0x87d2('0x3b')]['sort']);_0x30d728[_0x87d2('0x45')]=qs['filters'](_[_0x87d2('0x46')](_0x14e977[_0x87d2('0x3b')],_0x3343aa[_0x87d2('0x3c')]));if(_0x14e977[_0x87d2('0x3b')][_0x87d2('0x47')]){_0x30d728['where']=_['merge'](_0x30d728['where'],{'$or':_[_0x87d2('0x48')](_0x17eb07,function(_0x133368){if(_0x133368[_0x87d2('0x49')][_0x87d2('0x4a')]!=='VIRTUAL'){var _0x58c43e={};_0x58c43e[_0x133368[_0x87d2('0x4b')]]={'$like':'%'+_0x14e977['query'][_0x87d2('0x47')]+'%'};return _0x58c43e;}})});}_0x30d728=_['merge']({},_0x30d728,_0x14e977[_0x87d2('0x4c')]);var _0x15918c={'where':_0x30d728['where']};return db['FreshdeskAccount'][_0x87d2('0x4d')](_0x15918c)[_0x87d2('0x1e')](function(_0x33837b){_0x4f3c29[_0x87d2('0x4d')]=_0x33837b;if(_0x14e977[_0x87d2('0x3b')][_0x87d2('0x4e')]){_0x30d728[_0x87d2('0x4f')]=[{'all':!![]}];}return db[_0x87d2('0x50')][_0x87d2('0x51')](_0x30d728);})[_0x87d2('0x1e')](function(_0x344205){_0x4f3c29[_0x87d2('0x52')]=_0x344205;return _0x4f3c29;})[_0x87d2('0x1e')](respondWithFilteredResult(_0x5f2ac5,_0x30d728))[_0x87d2('0x28')](handleError(_0x5f2ac5,null));};exports[_0x87d2('0x53')]=function(_0x585e86,_0x2af80d){var _0x551e98={'raw':![],'where':{'id':_0x585e86['params']['id']}},_0x46928b={};_0x46928b[_0x87d2('0x39')]=_[_0x87d2('0x3a')](db[_0x87d2('0x50')][_0x87d2('0x38')]);_0x46928b['query']=_[_0x87d2('0x3a')](_0x585e86[_0x87d2('0x3b')]);_0x46928b[_0x87d2('0x3c')]=_[_0x87d2('0x3e')](_0x46928b['model'],_0x46928b[_0x87d2('0x3b')]);_0x551e98[_0x87d2('0x3d')]=_[_0x87d2('0x3e')](_0x46928b['model'],qs[_0x87d2('0x3f')](_0x585e86[_0x87d2('0x3b')]['fields']));_0x551e98[_0x87d2('0x3d')]=_0x551e98['attributes']['length']?_0x551e98[_0x87d2('0x3d')]:_0x46928b[_0x87d2('0x39')];if(_0x585e86[_0x87d2('0x3b')][_0x87d2('0x4e')]){_0x551e98['include']=[{'all':!![]}];}_0x551e98=_[_0x87d2('0x54')]({},_0x551e98,_0x585e86[_0x87d2('0x4c')]);return db['FreshdeskAccount'][_0x87d2('0x55')](_0x551e98)[_0x87d2('0x1e')](handleEntityNotFound(_0x2af80d,null))['then'](respondWithResult(_0x2af80d,null))[_0x87d2('0x28')](handleError(_0x2af80d,null));};exports[_0x87d2('0x56')]=function(_0x2921ca,_0x2ec277){return db['FreshdeskAccount']['create'](_0x2921ca['body'],{})[_0x87d2('0x1e')](respondWithResult(_0x2ec277,0xc9))[_0x87d2('0x28')](handleError(_0x2ec277,null));};exports[_0x87d2('0x32')]=function(_0x57fad9,_0xb9aed5){if(_0x57fad9[_0x87d2('0x57')]['id']){delete _0x57fad9[_0x87d2('0x57')]['id'];}return db['FreshdeskAccount'][_0x87d2('0x55')]({'where':{'id':_0x57fad9[_0x87d2('0x58')]['id']}})[_0x87d2('0x1e')](handleEntityNotFound(_0xb9aed5,null))[_0x87d2('0x1e')](saveUpdates(_0x57fad9['body'],null))[_0x87d2('0x1e')](respondWithResult(_0xb9aed5,null))[_0x87d2('0x28')](handleError(_0xb9aed5,null));};exports[_0x87d2('0x33')]=function(_0x425782,_0x4bae36){return db[_0x87d2('0x50')]['find']({'where':{'id':_0x425782[_0x87d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bae36,null))['then'](removeEntity(_0x4bae36,null))[_0x87d2('0x28')](handleError(_0x4bae36,null));};exports[_0x87d2('0x59')]=function(_0x292c57,_0x358a5a,_0x533900){var _0x5cb281={};var _0x2f4b5={};var _0x18ee2c;var _0x116f8a;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x292c57[_0x87d2('0x58')]['id']}})[_0x87d2('0x1e')](handleEntityNotFound(_0x358a5a,null))['then'](function(_0x155ccf){if(_0x155ccf){_0x18ee2c=_0x155ccf;_0x2f4b5[_0x87d2('0x39')]=_['keys'](db[_0x87d2('0x5a')]['rawAttributes']);_0x2f4b5[_0x87d2('0x3b')]=_['keys'](_0x292c57[_0x87d2('0x3b')]);_0x2f4b5[_0x87d2('0x3c')]=_[_0x87d2('0x3e')](_0x2f4b5['model'],_0x2f4b5[_0x87d2('0x3b')]);_0x5cb281[_0x87d2('0x3d')]=_[_0x87d2('0x3e')](_0x2f4b5[_0x87d2('0x39')],qs[_0x87d2('0x3f')](_0x292c57[_0x87d2('0x3b')][_0x87d2('0x3f')]));_0x5cb281[_0x87d2('0x3d')]=_0x5cb281[_0x87d2('0x3d')]['length']?_0x5cb281['attributes']:_0x2f4b5['model'];_0x5cb281[_0x87d2('0x43')]=qs['sort'](_0x292c57['query'][_0x87d2('0x44')]);_0x5cb281[_0x87d2('0x45')]=qs[_0x87d2('0x3c')](_[_0x87d2('0x46')](_0x292c57[_0x87d2('0x3b')],_0x2f4b5[_0x87d2('0x3c')]));if(_0x292c57[_0x87d2('0x3b')]['filter']){_0x5cb281[_0x87d2('0x45')]=_[_0x87d2('0x54')](_0x5cb281[_0x87d2('0x45')],{'$or':_[_0x87d2('0x48')](_0x5cb281['attributes'],function(_0x3c7ed8){var _0x26b4e1={};_0x26b4e1[_0x3c7ed8]={'$like':'%'+_0x292c57[_0x87d2('0x3b')][_0x87d2('0x47')]+'%'};return _0x26b4e1;})});}_0x5cb281=_[_0x87d2('0x54')]({},_0x5cb281,_0x292c57['options']);return _0x18ee2c[_0x87d2('0x59')](_0x5cb281);}})['then'](function(_0x4afb5a){if(_0x4afb5a){_0x116f8a=_0x4afb5a[_0x87d2('0x40')];if(!_0x292c57['query'][_0x87d2('0x41')](_0x87d2('0x42'))){_0x5cb281[_0x87d2('0x2e')]=qs[_0x87d2('0x2e')](_0x292c57['query'][_0x87d2('0x2e')]);_0x5cb281[_0x87d2('0x2d')]=qs[_0x87d2('0x2d')](_0x292c57[_0x87d2('0x3b')][_0x87d2('0x2d')]);}return _0x18ee2c['getConfigurations'](_0x5cb281);}})[_0x87d2('0x1e')](function(_0x2593c9){if(_0x2593c9){return _0x2593c9?{'count':_0x116f8a,'rows':_0x2593c9}:null;}})[_0x87d2('0x1e')](respondWithResult(_0x358a5a,null))[_0x87d2('0x28')](handleError(_0x358a5a,null));};exports[_0x87d2('0x5b')]=function(_0x95a81c,_0x2755d0,_0x14d984){if(_0x95a81c[_0x87d2('0x57')]['id']){delete _0x95a81c[_0x87d2('0x57')]['id'];}return db[_0x87d2('0x50')]['findOne']({'where':{'id':_0x95a81c[_0x87d2('0x58')]['id']}})[_0x87d2('0x1e')](handleEntityNotFound(_0x2755d0,null))['then'](function(_0x103c37){if(_0x103c37){_0x95a81c[_0x87d2('0x57')]['AccountId']=_0x103c37['id'];_0x95a81c[_0x87d2('0x57')][_0x87d2('0x5c')]=integrations[_0x87d2('0x5d')](_0x95a81c[_0x87d2('0x57')][_0x87d2('0x5e')],_0x95a81c[_0x87d2('0x57')]['type']);_0x95a81c[_0x87d2('0x57')][_0x87d2('0x5f')]=integrations[_0x87d2('0x60')](_0x95a81c[_0x87d2('0x57')]['channel'],_0x95a81c[_0x87d2('0x57')][_0x87d2('0x49')]);return db[_0x87d2('0x5a')][_0x87d2('0x56')](_0x95a81c[_0x87d2('0x57')],{'include':[{'model':db[_0x87d2('0x61')],'as':_0x87d2('0x5c')},{'model':db['FreshdeskField'],'as':_0x87d2('0x5f')}]});}return null;})['then'](respondWithResult(_0x2755d0,null))['catch'](handleError(_0x2755d0,null));};exports[_0x87d2('0x62')]=function(_0x1d8e7e,_0x1351c3,_0x2bc3fb){var _0x4b20b2='';return db[_0x87d2('0x50')][_0x87d2('0x63')]({'where':{'id':_0x1d8e7e[_0x87d2('0x58')]['id']},'attributes':['id',_0x87d2('0x64'),_0x87d2('0x65')]})['then'](handleEntityNotFound(_0x1351c3,null))[_0x87d2('0x1e')](function(_0x4348dc){if(_0x4348dc){_0x4b20b2=_0x4348dc[_0x87d2('0x64')];var _0x2cbe20=_0x4b20b2[_0x87d2('0x66')](-0x1);if(_0x2cbe20==='/'){_0x4b20b2=_0x4b20b2[_0x87d2('0x67')](0x0,_0x4b20b2['lastIndexOf'](_0x2cbe20));}return rp({'method':_0x87d2('0x68'),'uri':util[_0x87d2('0x69')](_0x87d2('0x6a'),_0x4b20b2,_0x87d2('0x6b')),'headers':{'Authorization':util[_0x87d2('0x69')](_0x87d2('0x6c'),new Buffer(util[_0x87d2('0x69')](_0x87d2('0x6d'),_0x4348dc['apiKey']))[_0x87d2('0x6e')]('base64'))},'json':!![]});}})[_0x87d2('0x1e')](function(_0xcd6171){if(_0xcd6171){var _0x4401ae=['requester',_0x87d2('0x6f'),_0x87d2('0x70'),_0x87d2('0x71'),_0x87d2('0x2a'),_0x87d2('0x72'),_0x87d2('0x73'),_0x87d2('0x74'),'ticket_type',_0x87d2('0x73'),_0x87d2('0x75')];_[_0x87d2('0x76')](_0xcd6171,function(_0x221c5e){return _0x4401ae[_0x87d2('0x77')](_0x221c5e[_0x87d2('0x35')])||!_0x221c5e[_0x87d2('0x78')]&&_0x221c5e[_0x87d2('0x49')]!=='custom_text'&&_0x221c5e[_0x87d2('0x49')]!==_0x87d2('0x79');});return{'count':_0xcd6171[_0x87d2('0x40')],'rows':_[_0x87d2('0x48')](_0xcd6171,function(_0x4d27da){return{'id':_0x4d27da[_0x87d2('0x35')],'name':_0x4d27da[_0x87d2('0x7a')],'custom':!_0x4d27da['default'],'options':_0x4d27da[_0x87d2('0x7b')]?_[_0x87d2('0x48')](_0x4d27da[_0x87d2('0x7b')],function(_0x2e1c1d){return{'name':_['capitalize'](_0x2e1c1d),'value':_0x2e1c1d};}):[]};})};}})[_0x87d2('0x1e')](respondWithResult(_0x1351c3,null))[_0x87d2('0x28')](function(_0x59c68d){var _0x43e03a=_0x1d8e7e[_0x87d2('0x3b')][_0x87d2('0x7c')]?0x1f4:_0x59c68d[_0x87d2('0x7d')]||0x1f4;logger['error'](_0x87d2('0x7e'),_0x87d2('0x62'),_0x43e03a,JSON[_0x87d2('0x7f')](_0x59c68d));delete _0x59c68d[_0x87d2('0x35')];if(_0x43e03a===0x191){_0x43e03a=0x190;}_0x1351c3[_0x87d2('0x2a')](_0x43e03a)[_0x87d2('0x36')](_0x1d8e7e['query'][_0x87d2('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x59c68d[_0x87d2('0x7d')]}:_0x59c68d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 06a7eb1..dca5967 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 _0x2c43=['FreshdeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x268183,_0x4e4e0b){var _0x3db400=function(_0x3352cf){while(--_0x3352cf){_0x268183['push'](_0x268183['shift']());}};_0x3db400(++_0x4e4e0b);}(_0x2c43,0x1e2));var _0x32c4=function(_0x385034,_0x18122f){_0x385034=_0x385034-0x0;var _0x447185=_0x2c43[_0x385034];return _0x447185;};'use strict';var _=require(_0x32c4('0x0'));var util=require(_0x32c4('0x1'));var logger=require(_0x32c4('0x2'))(_0x32c4('0x3'));var moment=require('moment');var BPromise=require(_0x32c4('0x4'));var rp=require(_0x32c4('0x5'));var fs=require('fs');var path=require(_0x32c4('0x6'));var rimraf=require(_0x32c4('0x7'));var config=require(_0x32c4('0x8'));var attributes=require(_0x32c4('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x32c4('0xa')]=function(_0x1e59b6,_0x465b59){return _0x1e59b6[_0x32c4('0xb')](_0x32c4('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51c7=['../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x51c7,0x194));var _0x751c=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0x51c7[_0x23ca3a];return _0x5c1aab;};'use strict';var _=require(_0x751c('0x0'));var util=require(_0x751c('0x1'));var logger=require(_0x751c('0x2'))(_0x751c('0x3'));var moment=require('moment');var BPromise=require(_0x751c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x751c('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x751c('0x6'));module['exports']=function(_0x1f2fd8,_0x27c661){return _0x1f2fd8[_0x751c('0x7')](_0x751c('0x8'),attributes,{'tableName':_0x751c('0x9'),'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 95b2a6e..2a28e69 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 _0x728e=['ShowFreshdeskAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','where','limit','include','model','attributes','map','stringify','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x728e,0x146));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe728('0x0'));var moment=require(_0xe728('0x1'));var BPromise=require(_0xe728('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe728('0x3'));var db=require(_0xe728('0x4'))['db'];var utils=require(_0xe728('0x5'));var logger=require(_0xe728('0x6'))('rpc');var config=require(_0xe728('0x7'));var jayson=require(_0xe728('0x8'));var client=jayson['client'][_0xe728('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357a7b,_0x35e968,_0x302ab5){return new BPromise(function(_0x3d484d,_0x1306bf){return client[_0xe728('0xa')](_0x357a7b,_0x302ab5)[_0xe728('0xb')](function(_0x1ee652){logger[_0xe728('0xc')](_0xe728('0xd'),_0x35e968,'request\x20sent');logger[_0xe728('0xe')](_0xe728('0xf'),_0x35e968,_0xe728('0x10'),JSON['stringify'](_0x1ee652));if(_0x1ee652['error']){if(_0x1ee652[_0xe728('0x11')][_0xe728('0x12')]===0x1f4){logger[_0xe728('0x11')](_0xe728('0xd'),_0x35e968,_0x1ee652[_0xe728('0x11')][_0xe728('0x13')]);return _0x1306bf(_0x1ee652[_0xe728('0x11')][_0xe728('0x13')]);}logger[_0xe728('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x35e968,_0x1ee652[_0xe728('0x11')][_0xe728('0x13')]);return _0x3d484d(_0x1ee652[_0xe728('0x11')]['message']);}else{logger[_0xe728('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x35e968,'request\x20sent');_0x3d484d(_0x1ee652[_0xe728('0x14')][_0xe728('0x13')]);}})['catch'](function(_0x26f97d){logger[_0xe728('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x35e968,_0x26f97d);_0x1306bf(_0x26f97d);});});}exports[_0xe728('0x15')]=function(_0x31b3c0){var _0xe0ce=this;return new Promise(function(_0x45c520,_0x58664c){return db[_0xe728('0x16')][_0xe728('0x17')]({'raw':_0x31b3c0['options']?_0x31b3c0['options'][_0xe728('0x18')]===undefined?!![]:![]:!![],'where':_0x31b3c0['options']?_0x31b3c0[_0xe728('0x19')][_0xe728('0x1a')]||null:null,'attributes':_0x31b3c0[_0xe728('0x19')]?_0x31b3c0[_0xe728('0x19')]['attributes']||null:null,'limit':_0x31b3c0['options']?_0x31b3c0[_0xe728('0x19')][_0xe728('0x1b')]||null:null,'include':_0x31b3c0[_0xe728('0x19')]?_0x31b3c0[_0xe728('0x19')][_0xe728('0x1c')]?_['map'](_0x31b3c0['options']['include'],function(_0x15ee8f){return{'model':db[_0x15ee8f[_0xe728('0x1d')]],'as':_0x15ee8f['as'],'attributes':_0x15ee8f[_0xe728('0x1e')],'include':_0x15ee8f['include']?_[_0xe728('0x1f')](_0x15ee8f['include'],function(_0x3b26dd){return{'model':db[_0x3b26dd[_0xe728('0x1d')]],'as':_0x3b26dd['as'],'attributes':_0x3b26dd[_0xe728('0x1e')],'include':_0x3b26dd['include']?_[_0xe728('0x1f')](_0x3b26dd['include'],function(_0x55af74){return{'model':db[_0x55af74[_0xe728('0x1d')]],'as':_0x55af74['as'],'attributes':_0x55af74[_0xe728('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe728('0xb')](function(_0x2419ed){logger['info']('GetFreshdeskAccount',_0x31b3c0);logger[_0xe728('0xe')](_0xe728('0x15'),_0x31b3c0,JSON[_0xe728('0x20')](_0x2419ed));_0x45c520(_0x2419ed);})[_0xe728('0x21')](function(_0x45e8d9){logger[_0xe728('0x11')](_0xe728('0x15'),_0x45e8d9[_0xe728('0x13')],_0x31b3c0);_0x58664c(_0xe0ce[_0xe728('0x11')](0x1f4,_0x45e8d9[_0xe728('0x13')]));});});};exports[_0xe728('0x22')]=function(_0x74fb39){var _0x587439=this;return new Promise(function(_0x463c1c,_0x1f1a68){return db['FreshdeskAccount'][_0xe728('0x23')]({'raw':_0x74fb39[_0xe728('0x19')]?_0x74fb39[_0xe728('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x74fb39[_0xe728('0x19')]?_0x74fb39[_0xe728('0x19')][_0xe728('0x1a')]||null:null,'attributes':_0x74fb39['options']?_0x74fb39['options'][_0xe728('0x1e')]||null:null,'include':_0x74fb39[_0xe728('0x19')]?_0x74fb39[_0xe728('0x19')][_0xe728('0x1c')]?_['map'](_0x74fb39[_0xe728('0x19')][_0xe728('0x1c')],function(_0x139b6d){return{'model':db[_0x139b6d[_0xe728('0x1d')]],'as':_0x139b6d['as'],'attributes':_0x139b6d[_0xe728('0x1e')],'include':_0x139b6d[_0xe728('0x1c')]?_[_0xe728('0x1f')](_0x139b6d[_0xe728('0x1c')],function(_0x2ef2c7){return{'model':db[_0x2ef2c7['model']],'as':_0x2ef2c7['as'],'attributes':_0x2ef2c7[_0xe728('0x1e')],'include':_0x2ef2c7[_0xe728('0x1c')]?_[_0xe728('0x1f')](_0x2ef2c7['include'],function(_0x4a14d6){return{'model':db[_0x4a14d6[_0xe728('0x1d')]],'as':_0x4a14d6['as'],'attributes':_0x4a14d6[_0xe728('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe728('0xb')](function(_0x48d6a7){logger[_0xe728('0xc')](_0xe728('0x22'),_0x74fb39);logger[_0xe728('0xe')]('ShowFreshdeskAccount',_0x74fb39,JSON[_0xe728('0x20')](_0x48d6a7));_0x463c1c(_0x48d6a7);})[_0xe728('0x21')](function(_0x5495a2){logger[_0xe728('0x11')](_0xe728('0x22'),_0x5495a2['message'],_0x74fb39);_0x1f1a68(_0x587439['error'](0x1f4,_0x5495a2[_0xe728('0x13')]));});});}; \ No newline at end of file +var _0x57b6=['catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x4bbb17,_0x23d492){var _0x31a5a1=function(_0x2e799e){while(--_0x2e799e){_0x4bbb17['push'](_0x4bbb17['shift']());}};_0x31a5a1(++_0x23d492);}(_0x57b6,0xc2));var _0x657b=function(_0x19fc9b,_0x2cc98a){_0x19fc9b=_0x19fc9b-0x0;var _0x47f7cb=_0x57b6[_0x19fc9b];return _0x47f7cb;};'use strict';var _=require(_0x657b('0x0'));var util=require(_0x657b('0x1'));var moment=require(_0x657b('0x2'));var BPromise=require(_0x657b('0x3'));var rs=require(_0x657b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x657b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x657b('0x6'))('rpc');var config=require(_0x657b('0x7'));var jayson=require(_0x657b('0x8'));var client=jayson[_0x657b('0x9')][_0x657b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfb59a5,_0x176e58,_0x1067d0){return new BPromise(function(_0x272f32,_0x528b85){return client[_0x657b('0xb')](_0xfb59a5,_0x1067d0)[_0x657b('0xc')](function(_0x218b18){logger[_0x657b('0xd')](_0x657b('0xe'),_0x176e58,'request\x20sent');logger['debug'](_0x657b('0xf'),_0x176e58,'request\x20sent',JSON[_0x657b('0x10')](_0x218b18));if(_0x218b18[_0x657b('0x11')]){if(_0x218b18[_0x657b('0x11')][_0x657b('0x12')]===0x1f4){logger[_0x657b('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x176e58,_0x218b18[_0x657b('0x11')][_0x657b('0x13')]);return _0x528b85(_0x218b18['error'][_0x657b('0x13')]);}logger[_0x657b('0x11')](_0x657b('0xe'),_0x176e58,_0x218b18['error']['message']);return _0x272f32(_0x218b18[_0x657b('0x11')][_0x657b('0x13')]);}else{logger['info'](_0x657b('0xe'),_0x176e58,_0x657b('0x14'));_0x272f32(_0x218b18[_0x657b('0x15')][_0x657b('0x13')]);}})[_0x657b('0x16')](function(_0x1096d2){logger['error'](_0x657b('0xe'),_0x176e58,_0x1096d2);_0x528b85(_0x1096d2);});});}exports[_0x657b('0x17')]=function(_0x4f3a1e){var _0x31fb61=this;return new Promise(function(_0x177323,_0x2ec1d7){return db[_0x657b('0x18')][_0x657b('0x19')]({'raw':_0x4f3a1e[_0x657b('0x1a')]?_0x4f3a1e[_0x657b('0x1a')][_0x657b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f3a1e[_0x657b('0x1a')]?_0x4f3a1e[_0x657b('0x1a')][_0x657b('0x1c')]||null:null,'attributes':_0x4f3a1e['options']?_0x4f3a1e[_0x657b('0x1a')][_0x657b('0x1d')]||null:null,'limit':_0x4f3a1e[_0x657b('0x1a')]?_0x4f3a1e[_0x657b('0x1a')][_0x657b('0x1e')]||null:null,'include':_0x4f3a1e[_0x657b('0x1a')]?_0x4f3a1e[_0x657b('0x1a')][_0x657b('0x1f')]?_[_0x657b('0x20')](_0x4f3a1e[_0x657b('0x1a')][_0x657b('0x1f')],function(_0x29b69){return{'model':db[_0x29b69[_0x657b('0x21')]],'as':_0x29b69['as'],'attributes':_0x29b69[_0x657b('0x1d')],'include':_0x29b69[_0x657b('0x1f')]?_[_0x657b('0x20')](_0x29b69[_0x657b('0x1f')],function(_0x42f254){return{'model':db[_0x42f254[_0x657b('0x21')]],'as':_0x42f254['as'],'attributes':_0x42f254[_0x657b('0x1d')],'include':_0x42f254['include']?_[_0x657b('0x20')](_0x42f254['include'],function(_0x55e010){return{'model':db[_0x55e010[_0x657b('0x21')]],'as':_0x55e010['as'],'attributes':_0x55e010[_0x657b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb7543b){logger[_0x657b('0xd')](_0x657b('0x17'),_0x4f3a1e);logger['debug'](_0x657b('0x17'),_0x4f3a1e,JSON[_0x657b('0x10')](_0xb7543b));_0x177323(_0xb7543b);})[_0x657b('0x16')](function(_0x12e1cf){logger[_0x657b('0x11')]('GetFreshdeskAccount',_0x12e1cf[_0x657b('0x13')],_0x4f3a1e);_0x2ec1d7(_0x31fb61[_0x657b('0x11')](0x1f4,_0x12e1cf['message']));});});};exports[_0x657b('0x22')]=function(_0xbfe5c2){var _0x1d2355=this;return new Promise(function(_0x20bc2a,_0x140548){return db[_0x657b('0x18')][_0x657b('0x23')]({'raw':_0xbfe5c2[_0x657b('0x1a')]?_0xbfe5c2[_0x657b('0x1a')][_0x657b('0x1b')]===undefined?!![]:![]:!![],'where':_0xbfe5c2[_0x657b('0x1a')]?_0xbfe5c2['options'][_0x657b('0x1c')]||null:null,'attributes':_0xbfe5c2['options']?_0xbfe5c2[_0x657b('0x1a')][_0x657b('0x1d')]||null:null,'include':_0xbfe5c2[_0x657b('0x1a')]?_0xbfe5c2[_0x657b('0x1a')][_0x657b('0x1f')]?_[_0x657b('0x20')](_0xbfe5c2[_0x657b('0x1a')]['include'],function(_0x497943){return{'model':db[_0x497943[_0x657b('0x21')]],'as':_0x497943['as'],'attributes':_0x497943['attributes'],'include':_0x497943[_0x657b('0x1f')]?_[_0x657b('0x20')](_0x497943['include'],function(_0xbddac0){return{'model':db[_0xbddac0[_0x657b('0x21')]],'as':_0xbddac0['as'],'attributes':_0xbddac0[_0x657b('0x1d')],'include':_0xbddac0[_0x657b('0x1f')]?_[_0x657b('0x20')](_0xbddac0[_0x657b('0x1f')],function(_0x279102){return{'model':db[_0x279102['model']],'as':_0x279102['as'],'attributes':_0x279102[_0x657b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x657b('0xc')](function(_0x9d89f2){logger[_0x657b('0xd')](_0x657b('0x22'),_0xbfe5c2);logger['debug'](_0x657b('0x22'),_0xbfe5c2,JSON[_0x657b('0x10')](_0x9d89f2));_0x20bc2a(_0x9d89f2);})[_0x657b('0x16')](function(_0x5e34d7){logger[_0x657b('0x11')](_0x657b('0x22'),_0x5e34d7[_0x657b('0x13')],_0xbfe5c2);_0x140548(_0x1d2355[_0x657b('0x11')](0x1f4,_0x5e34d7[_0x657b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 289bc60..70cb246 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 _0xd0bb=['/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','getDescriptions'];(function(_0xbc25e1,_0x27007d){var _0xaf0a85=function(_0x52acb3){while(--_0x52acb3){_0xbc25e1['push'](_0xbc25e1['shift']());}};_0xaf0a85(++_0x27007d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4d94db,_0x5a2d71){_0x4d94db=_0x4d94db-0x0;var _0x41d157=_0xd0bb[_0x4d94db];return _0x41d157;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var auth=require(_0xbd0b('0x4'));var interaction=require(_0xbd0b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd0b('0x6'));router['get']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x8')]);router[_0xbd0b('0x9')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller['show']);router[_0xbd0b('0x9')](_0xbd0b('0xb'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xbd0b('0xd')]);router[_0xbd0b('0x9')]('/:id/descriptions',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xe')]);router['get'](_0xbd0b('0xf'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x10')]);router[_0xbd0b('0x11')]('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x12')]);router[_0xbd0b('0x11')](_0xbd0b('0xf'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x13')]);router[_0xbd0b('0x14')]('/:id',auth[_0xbd0b('0x7')](),controller['update']);router['delete'](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x15')]);module[_0xbd0b('0x16')]=router; \ No newline at end of file +var _0xa41a=['post','create','setTags','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x152b03,_0x2b427f){var _0x5a5d4b=function(_0x3037a3){while(--_0x3037a3){_0x152b03['push'](_0x152b03['shift']());}};_0x5a5d4b(++_0x2b427f);}(_0xa41a,0x6b));var _0xaa41=function(_0x36241d,_0x888d29){_0x36241d=_0x36241d-0x0;var _0x36b52c=_0xa41a[_0x36241d];return _0x36b52c;};'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')]('/:id',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id/fields',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x9')](_0xaa41('0x10'),auth[_0xaa41('0xc')](),controller['getDescriptions']);router[_0xaa41('0x9')](_0xaa41('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0xaa41('0x12')]('/',auth['isAuthenticated'](),controller[_0xaa41('0x13')]);router[_0xaa41('0x12')](_0xaa41('0x11'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x14')]);router['put'](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x17')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x18')]);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 a7412ed..29fcd41 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 _0x0688=['sequelize','exports','STRING'];(function(_0x1f67f1,_0x17b369){var _0x1238cf=function(_0x3553b2){while(--_0x3553b2){_0x1f67f1['push'](_0x1f67f1['shift']());}};_0x1238cf(++_0x17b369);}(_0x0688,0x165));var _0x8068=function(_0x31117c,_0x4da16e){_0x31117c=_0x31117c-0x0;var _0x596505=_0x0688[_0x31117c];return _0x596505;};'use strict';var Sequelize=require(_0x8068('0x0'));module[_0x8068('0x1')]={'name':{'type':Sequelize[_0x8068('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd745=['sequelize','exports','STRING'];(function(_0x170755,_0x58c6a9){var _0x19b747=function(_0xb068d5){while(--_0xb068d5){_0x170755['push'](_0x170755['shift']());}};_0x19b747(++_0x58c6a9);}(_0xd745,0x14d));var _0x5d74=function(_0x2d283b,_0x2e9e50){_0x2d283b=_0x2d283b-0x0;var _0x1534d7=_0xd745[_0x2d283b];return _0x1534d7;};'use strict';var Sequelize=require(_0x5d74('0x0'));module[_0x5d74('0x1')]={'name':{'type':Sequelize[_0x5d74('0x2')]},'description':{'type':Sequelize[_0x5d74('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5dfd1b3..dd616aa 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 _0xa9e0=['length','find','create','catch','body','params','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','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','../../config/license/hardware','../../config/logger','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','end','stack','name','index','FreshdeskConfiguration','rawAttributes','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','rows','show','keys'];(function(_0x11e10a,_0x4009a8){var _0x3f8d8a=function(_0x2fd76e){while(--_0x2fd76e){_0x11e10a['push'](_0x11e10a['shift']());}};_0x3f8d8a(++_0x4009a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x0a9e('0x13'));var client=jayson[_0x0a9e('0x14')][_0x0a9e('0x15')]({'port':0x232a});function checkPasswordPattern(_0x26d672,_0x32d742,_0x69aeb7){if(_0x69aeb7){var _0x5db4b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db4b0[_0x0a9e('0x16')](_0x32d742)){return _0x26d672;}else{throw new Error(_0x0a9e('0x17'));}}else{return _0x26d672;}}function respondWithRpcPromise(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){return new BPromise(function(_0x52a03d,_0x22dccb){var _0x5d0880=_0x4d5611||client;return _0x5d0880[_0x0a9e('0x18')](_0x2b4227,_0x44dcfd)['then'](function(_0x16033c){logger[_0x0a9e('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x281129,_0x0a9e('0x1a'));logger['debug'](_0x0a9e('0x1b'),_0x281129,_0x0a9e('0x1a'),JSON[_0x0a9e('0x1c')](_0x16033c));if(_0x16033c[_0x0a9e('0x1d')]){if(_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x281129,_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x22dccb(_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger['error'](_0x0a9e('0x1f'),_0x281129,_0x16033c[_0x0a9e('0x1d')]['message']);return _0x52a03d(_0x16033c[_0x0a9e('0x1d')]['message']);}else{logger['info'](_0x0a9e('0x1f'),_0x281129,_0x0a9e('0x1a'));_0x52a03d(_0x16033c[_0x0a9e('0x21')][_0x0a9e('0x20')]);}})['catch'](function(_0xfb6e48){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x281129,_0xfb6e48);_0x22dccb(_0xfb6e48);});});}function respondWithStatusCode(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0xcc;return function(_0x42ac8f){if(_0x42ac8f){return _0x4d00e6[_0x0a9e('0x22')](_0x370d86);}return _0x4d00e6['status'](_0x370d86)['end']();};}function respondWithResult(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xc8;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x23')](_0x3a8e58)['json'](_0x40c424);}};}function respondWithFilteredResult(_0x384319,_0x479bc4){return function(_0x45a1e7){if(_0x45a1e7){var _0x5bfb33=_0x45a1e7[_0x0a9e('0x24')],_0x1dc186=_0x479bc4[_0x0a9e('0x25')],_0x34dc65=_0x479bc4[_0x0a9e('0x25')]+_0x479bc4[_0x0a9e('0x26')],_0x25fba9;if(_0x34dc65>=_0x5bfb33){_0x34dc65=_0x5bfb33;_0x25fba9=0xc8;}else{_0x25fba9=0xce;}_0x384319[_0x0a9e('0x23')](_0x25fba9);return _0x384319['set'](_0x0a9e('0x27'),_0x1dc186+'-'+_0x34dc65+'/'+_0x5bfb33)[_0x0a9e('0x28')](_0x45a1e7);}return null;};}function patchUpdates(_0x2b1f27){return function(_0x2ec755){try{jsonpatch['apply'](_0x2ec755,_0x2b1f27,!![]);}catch(_0x15b200){return BPromise[_0x0a9e('0x29')](_0x15b200);}return _0x2ec755[_0x0a9e('0x2a')]();};}function saveUpdates(_0x824a4f,_0x58b06f){return function(_0x563b45){if(_0x563b45){return _0x563b45[_0x0a9e('0x2b')](_0x824a4f)[_0x0a9e('0x2c')](function(_0x1dbde2){return _0x1dbde2;});}return null;};}function removeEntity(_0x540530,_0x426950){return function(_0x5d1e0e){if(_0x5d1e0e){return _0x5d1e0e[_0x0a9e('0x2d')]()[_0x0a9e('0x2c')](function(){_0x540530[_0x0a9e('0x23')](0xcc)[_0x0a9e('0x2e')]();});}};}function handleEntityNotFound(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(!_0x66c1d2){_0x25ce3a[_0x0a9e('0x22')](0x194);}return _0x66c1d2;};}function handleError(_0x40cb85,_0x2da5c0){_0x2da5c0=_0x2da5c0||0x1f4;return function(_0x2b45ea){logger[_0x0a9e('0x1d')](_0x2b45ea[_0x0a9e('0x2f')]);if(_0x2b45ea[_0x0a9e('0x30')]){delete _0x2b45ea['name'];}_0x40cb85[_0x0a9e('0x23')](_0x2da5c0)['send'](_0x2b45ea);};}exports[_0x0a9e('0x31')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41={},_0x567193={},_0x191e91={'count':0x0,'rows':[]};var _0xd1836d=db[_0x0a9e('0x32')][_0x0a9e('0x33')];_0x567193['model']=_['keys'](_0xd1836d);_0x567193[_0x0a9e('0x34')]=_['keys'](_0x14b13f[_0x0a9e('0x34')]);_0x567193[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x567193[_0x0a9e('0x37')],_0x567193['query']);_0x3f3d41[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x567193[_0x0a9e('0x37')],qs['fields'](_0x14b13f[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x3f3d41[_0x0a9e('0x38')]=_0x3f3d41['attributes']['length']?_0x3f3d41[_0x0a9e('0x38')]:_0x567193[_0x0a9e('0x37')];if(!_0x14b13f['query'][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x3f3d41[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x14b13f['query']['limit']);_0x3f3d41[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x14b13f['query'][_0x0a9e('0x25')]);}_0x3f3d41[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x14b13f['query'][_0x0a9e('0x3d')]);_0x3f3d41[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_[_0x0a9e('0x3f')](_0x14b13f[_0x0a9e('0x34')],_0x567193[_0x0a9e('0x35')]));if(_0x14b13f[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x3f3d41[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x3f3d41[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x42')](_0xd1836d,function(_0x1a7bce){if(_0x1a7bce[_0x0a9e('0x43')][_0x0a9e('0x44')]!=='VIRTUAL'){var _0x52628e={};_0x52628e[_0x1a7bce[_0x0a9e('0x45')]]={'$like':'%'+_0x14b13f[_0x0a9e('0x34')][_0x0a9e('0x40')]+'%'};return _0x52628e;}})});}_0x3f3d41=_[_0x0a9e('0x41')]({},_0x3f3d41,_0x14b13f[_0x0a9e('0x46')]);var _0xc9a702={'where':_0x3f3d41[_0x0a9e('0x3e')]};return db[_0x0a9e('0x32')][_0x0a9e('0x24')](_0xc9a702)[_0x0a9e('0x2c')](function(_0x2c2cb0){_0x191e91[_0x0a9e('0x24')]=_0x2c2cb0;if(_0x14b13f['query'][_0x0a9e('0x47')]){_0x3f3d41[_0x0a9e('0x48')]=[{'all':!![]}];}return db[_0x0a9e('0x32')][_0x0a9e('0x49')](_0x3f3d41);})[_0x0a9e('0x2c')](function(_0xbe9d19){_0x191e91[_0x0a9e('0x4a')]=_0xbe9d19;return _0x191e91;})[_0x0a9e('0x2c')](respondWithFilteredResult(_0x2b7e7f,_0x3f3d41))['catch'](handleError(_0x2b7e7f,null));};exports[_0x0a9e('0x4b')]=function(_0x48fd45,_0x473dc8){var _0x476688={'raw':![],'where':{'id':_0x48fd45['params']['id']}},_0x8d6dd1={};_0x8d6dd1[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x32')][_0x0a9e('0x33')]);_0x8d6dd1[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x48fd45[_0x0a9e('0x34')]);_0x8d6dd1['filters']=_[_0x0a9e('0x36')](_0x8d6dd1[_0x0a9e('0x37')],_0x8d6dd1[_0x0a9e('0x34')]);_0x476688[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x8d6dd1[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x48fd45[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x476688['attributes']=_0x476688[_0x0a9e('0x38')][_0x0a9e('0x4d')]?_0x476688['attributes']:_0x8d6dd1['model'];if(_0x48fd45['query'][_0x0a9e('0x47')]){_0x476688[_0x0a9e('0x48')]=[{'all':!![]}];}_0x476688=_[_0x0a9e('0x41')]({},_0x476688,_0x48fd45[_0x0a9e('0x46')]);return db[_0x0a9e('0x32')][_0x0a9e('0x4e')](_0x476688)[_0x0a9e('0x2c')](handleEntityNotFound(_0x473dc8,null))[_0x0a9e('0x2c')](respondWithResult(_0x473dc8,null))['catch'](handleError(_0x473dc8,null));};exports['create']=function(_0x53975a,_0x39d77d){return db[_0x0a9e('0x32')][_0x0a9e('0x4f')](_0x53975a['body'],{})[_0x0a9e('0x2c')](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x50')](handleError(_0x39d77d,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x51')]['id'];}return db['FreshdeskConfiguration'][_0x0a9e('0x4e')]({'where':{'id':_0x5a88da[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x51')],null))[_0x0a9e('0x2c')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['FreshdeskConfiguration'][_0x0a9e('0x4e')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x50')](handleError(_0x3aedd0,null));};exports['getFields']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={};var _0x2f7092={};var _0x65432;var _0x3cfd00;return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x5da27d[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x2c')](function(_0x4e67ab){if(_0x4e67ab){_0x65432=_0x4e67ab;_0x2f7092[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x54')][_0x0a9e('0x33')]);_0x2f7092[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x34')]);_0x47de4c['attributes']=_[_0x0a9e('0x36')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x39')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x38')][_0x0a9e('0x4d')]?_0x47de4c[_0x0a9e('0x38')]:_0x2f7092[_0x0a9e('0x37')];_0x47de4c[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x5da27d['query'][_0x0a9e('0x3d')]);_0x47de4c['where']=qs[_0x0a9e('0x35')](_[_0x0a9e('0x3f')](_0x5da27d[_0x0a9e('0x34')],_0x2f7092['filters']));if(_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x47de4c[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x42')](_0x47de4c[_0x0a9e('0x38')],function(_0x54327c){var _0x797b45={};_0x797b45[_0x54327c]={'$like':'%'+_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x40')]+'%'};return _0x797b45;})});}_0x47de4c=_[_0x0a9e('0x41')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x46')]);return _0x65432['getFields'](_0x47de4c);}})[_0x0a9e('0x2c')](function(_0x2937e0){if(_0x2937e0){_0x3cfd00=_0x2937e0[_0x0a9e('0x4d')];if(!_0x5da27d['query'][_0x0a9e('0x3a')]('nolimit')){_0x47de4c['limit']=qs[_0x0a9e('0x26')](_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x47de4c[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x25')]);}return _0x65432[_0x0a9e('0x55')](_0x47de4c);}})[_0x0a9e('0x2c')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3?{'count':_0x3cfd00,'rows':_0x1cc4f3}:null;}})[_0x0a9e('0x2c')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x50')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x56')]=function(_0x2b8192,_0x320898,_0x412a72){var _0x2a28c0={};var _0x4257c9={};var _0x5150a4;var _0x1b0b98;return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x2b8192['params']['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x320898,null))[_0x0a9e('0x2c')](function(_0x4b341d){if(_0x4b341d){_0x5150a4=_0x4b341d;_0x4257c9[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x54')][_0x0a9e('0x33')]);_0x4257c9[_0x0a9e('0x34')]=_['keys'](_0x2b8192['query']);_0x4257c9['filters']=_[_0x0a9e('0x36')](_0x4257c9[_0x0a9e('0x37')],_0x4257c9[_0x0a9e('0x34')]);_0x2a28c0[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x4257c9[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x2b8192[_0x0a9e('0x34')]['fields']));_0x2a28c0[_0x0a9e('0x38')]=_0x2a28c0[_0x0a9e('0x38')][_0x0a9e('0x4d')]?_0x2a28c0['attributes']:_0x4257c9[_0x0a9e('0x37')];_0x2a28c0['order']=qs[_0x0a9e('0x3d')](_0x2b8192[_0x0a9e('0x34')]['sort']);_0x2a28c0[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_[_0x0a9e('0x3f')](_0x2b8192[_0x0a9e('0x34')],_0x4257c9['filters']));if(_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x2a28c0[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x2a28c0['where'],{'$or':_[_0x0a9e('0x42')](_0x2a28c0[_0x0a9e('0x38')],function(_0x2d5506){var _0x361b21={};_0x361b21[_0x2d5506]={'$like':'%'+_0x2b8192['query'][_0x0a9e('0x40')]+'%'};return _0x361b21;})});}_0x2a28c0=_[_0x0a9e('0x41')]({},_0x2a28c0,_0x2b8192[_0x0a9e('0x46')]);return _0x5150a4[_0x0a9e('0x56')](_0x2a28c0);}})[_0x0a9e('0x2c')](function(_0xdb98ca){if(_0xdb98ca){_0x1b0b98=_0xdb98ca[_0x0a9e('0x4d')];if(!_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x2a28c0[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x2a28c0['offset']=qs[_0x0a9e('0x25')](_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x25')]);}return _0x5150a4['getSubjects'](_0x2a28c0);}})[_0x0a9e('0x2c')](function(_0x33dda0){if(_0x33dda0){return _0x33dda0?{'count':_0x1b0b98,'rows':_0x33dda0}:null;}})[_0x0a9e('0x2c')](respondWithResult(_0x320898,null))[_0x0a9e('0x50')](handleError(_0x320898,null));};exports['getDescriptions']=function(_0x541e80,_0x7ebea8,_0x2bbdb5){var _0x4c54fa={};var _0x45108c={};var _0x53a6a1;var _0x260f4b;return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x541e80[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x7ebea8,null))[_0x0a9e('0x2c')](function(_0x42b959){if(_0x42b959){_0x53a6a1=_0x42b959;_0x45108c[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x45108c[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x541e80[_0x0a9e('0x34')]);_0x45108c[_0x0a9e('0x35')]=_['intersection'](_0x45108c[_0x0a9e('0x37')],_0x45108c[_0x0a9e('0x34')]);_0x4c54fa['attributes']=_[_0x0a9e('0x36')](_0x45108c['model'],qs[_0x0a9e('0x39')](_0x541e80[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x4c54fa[_0x0a9e('0x38')]=_0x4c54fa['attributes']['length']?_0x4c54fa[_0x0a9e('0x38')]:_0x45108c[_0x0a9e('0x37')];_0x4c54fa[_0x0a9e('0x3c')]=qs['sort'](_0x541e80[_0x0a9e('0x34')][_0x0a9e('0x3d')]);_0x4c54fa['where']=qs['filters'](_[_0x0a9e('0x3f')](_0x541e80['query'],_0x45108c['filters']));if(_0x541e80['query'][_0x0a9e('0x40')]){_0x4c54fa[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x4c54fa[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x42')](_0x4c54fa[_0x0a9e('0x38')],function(_0x5a8854){var _0x5fd5db={};_0x5fd5db[_0x5a8854]={'$like':'%'+_0x541e80['query'][_0x0a9e('0x40')]+'%'};return _0x5fd5db;})});}_0x4c54fa=_[_0x0a9e('0x41')]({},_0x4c54fa,_0x541e80[_0x0a9e('0x46')]);return _0x53a6a1[_0x0a9e('0x57')](_0x4c54fa);}})['then'](function(_0x46c9ac){if(_0x46c9ac){_0x260f4b=_0x46c9ac[_0x0a9e('0x4d')];if(!_0x541e80[_0x0a9e('0x34')]['hasOwnProperty'](_0x0a9e('0x3b'))){_0x4c54fa[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x541e80[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x4c54fa[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x541e80[_0x0a9e('0x34')]['offset']);}return _0x53a6a1[_0x0a9e('0x57')](_0x4c54fa);}})[_0x0a9e('0x2c')](function(_0x589ff3){if(_0x589ff3){return _0x589ff3?{'count':_0x260f4b,'rows':_0x589ff3}:null;}})[_0x0a9e('0x2c')](respondWithResult(_0x7ebea8,null))[_0x0a9e('0x50')](handleError(_0x7ebea8,null));};exports[_0x0a9e('0x58')]=function(_0x5a26c8,_0x96672f,_0x52ec10){var _0x8c8fbe={};var _0x2b5148={};var _0x558a87;var _0x1f29bd;return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x5a26c8[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x96672f,null))['then'](function(_0x329d88){if(_0x329d88){_0x558a87=_0x329d88;_0x2b5148[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x59')][_0x0a9e('0x33')]);_0x2b5148[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x5a26c8[_0x0a9e('0x34')]);_0x2b5148[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2b5148[_0x0a9e('0x37')],_0x2b5148[_0x0a9e('0x34')]);_0x8c8fbe[_0x0a9e('0x38')]=_['intersection'](_0x2b5148[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x8c8fbe[_0x0a9e('0x38')]=_0x8c8fbe['attributes'][_0x0a9e('0x4d')]?_0x8c8fbe[_0x0a9e('0x38')]:_0x2b5148['model'];_0x8c8fbe[_0x0a9e('0x3c')]=qs['sort'](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x3d')]);_0x8c8fbe[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_['pick'](_0x5a26c8[_0x0a9e('0x34')],_0x2b5148['filters']));if(_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x8c8fbe['where']=_[_0x0a9e('0x41')](_0x8c8fbe[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x42')](_0x8c8fbe['attributes'],function(_0x4c788f){var _0x1b82b7={};_0x1b82b7[_0x4c788f]={'$like':'%'+_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x40')]+'%'};return _0x1b82b7;})});}_0x8c8fbe=_[_0x0a9e('0x41')]({},_0x8c8fbe,_0x5a26c8[_0x0a9e('0x46')]);return _0x558a87[_0x0a9e('0x58')](_0x8c8fbe);}})[_0x0a9e('0x2c')](function(_0x3c75b9){if(_0x3c75b9){_0x1f29bd=_0x3c75b9[_0x0a9e('0x4d')];if(!_0x5a26c8['query'][_0x0a9e('0x3a')]('nolimit')){_0x8c8fbe[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x8c8fbe[_0x0a9e('0x25')]=qs['offset'](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x25')]);}return _0x558a87[_0x0a9e('0x58')](_0x8c8fbe);}})[_0x0a9e('0x2c')](function(_0x2263f1){if(_0x2263f1){return _0x2263f1?{'count':_0x1f29bd,'rows':_0x2263f1}:null;}})['then'](respondWithResult(_0x96672f,null))['catch'](handleError(_0x96672f,null));};exports[_0x0a9e('0x5a')]=function(_0x583662,_0x25eae0,_0x4658df){if(_0x583662[_0x0a9e('0x51')]['id']){delete _0x583662[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x583662['params']['id']}})['then'](handleEntityNotFound(_0x25eae0,null))[_0x0a9e('0x2c')](function(_0x5dfbe2){if(_0x5dfbe2){return _0x5dfbe2[_0x0a9e('0x5a')](_0x583662['body'][_0x0a9e('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x25eae0,null))['catch'](handleError(_0x25eae0,null));}; \ No newline at end of file +var _0xa9e0=['length','find','create','catch','body','params','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','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','../../config/license/hardware','../../config/logger','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','end','stack','name','index','FreshdeskConfiguration','rawAttributes','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','rows','show','keys'];(function(_0x38b0ee,_0x38f896){var _0x31c545=function(_0x29cedf){while(--_0x29cedf){_0x38b0ee['push'](_0x38b0ee['shift']());}};_0x31c545(++_0x38f896);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x0a9e('0x13'));var client=jayson[_0x0a9e('0x14')][_0x0a9e('0x15')]({'port':0x232a});function checkPasswordPattern(_0x26d672,_0x32d742,_0x69aeb7){if(_0x69aeb7){var _0x5db4b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db4b0[_0x0a9e('0x16')](_0x32d742)){return _0x26d672;}else{throw new Error(_0x0a9e('0x17'));}}else{return _0x26d672;}}function respondWithRpcPromise(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){return new BPromise(function(_0x52a03d,_0x22dccb){var _0x5d0880=_0x4d5611||client;return _0x5d0880[_0x0a9e('0x18')](_0x2b4227,_0x44dcfd)['then'](function(_0x16033c){logger[_0x0a9e('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x281129,_0x0a9e('0x1a'));logger['debug'](_0x0a9e('0x1b'),_0x281129,_0x0a9e('0x1a'),JSON[_0x0a9e('0x1c')](_0x16033c));if(_0x16033c[_0x0a9e('0x1d')]){if(_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x281129,_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x22dccb(_0x16033c[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger['error'](_0x0a9e('0x1f'),_0x281129,_0x16033c[_0x0a9e('0x1d')]['message']);return _0x52a03d(_0x16033c[_0x0a9e('0x1d')]['message']);}else{logger['info'](_0x0a9e('0x1f'),_0x281129,_0x0a9e('0x1a'));_0x52a03d(_0x16033c[_0x0a9e('0x21')][_0x0a9e('0x20')]);}})['catch'](function(_0xfb6e48){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x281129,_0xfb6e48);_0x22dccb(_0xfb6e48);});});}function respondWithStatusCode(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0xcc;return function(_0x42ac8f){if(_0x42ac8f){return _0x4d00e6[_0x0a9e('0x22')](_0x370d86);}return _0x4d00e6['status'](_0x370d86)['end']();};}function respondWithResult(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xc8;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x23')](_0x3a8e58)['json'](_0x40c424);}};}function respondWithFilteredResult(_0x384319,_0x479bc4){return function(_0x45a1e7){if(_0x45a1e7){var _0x5bfb33=_0x45a1e7[_0x0a9e('0x24')],_0x1dc186=_0x479bc4[_0x0a9e('0x25')],_0x34dc65=_0x479bc4[_0x0a9e('0x25')]+_0x479bc4[_0x0a9e('0x26')],_0x25fba9;if(_0x34dc65>=_0x5bfb33){_0x34dc65=_0x5bfb33;_0x25fba9=0xc8;}else{_0x25fba9=0xce;}_0x384319[_0x0a9e('0x23')](_0x25fba9);return _0x384319['set'](_0x0a9e('0x27'),_0x1dc186+'-'+_0x34dc65+'/'+_0x5bfb33)[_0x0a9e('0x28')](_0x45a1e7);}return null;};}function patchUpdates(_0x2b1f27){return function(_0x2ec755){try{jsonpatch['apply'](_0x2ec755,_0x2b1f27,!![]);}catch(_0x15b200){return BPromise[_0x0a9e('0x29')](_0x15b200);}return _0x2ec755[_0x0a9e('0x2a')]();};}function saveUpdates(_0x824a4f,_0x58b06f){return function(_0x563b45){if(_0x563b45){return _0x563b45[_0x0a9e('0x2b')](_0x824a4f)[_0x0a9e('0x2c')](function(_0x1dbde2){return _0x1dbde2;});}return null;};}function removeEntity(_0x540530,_0x426950){return function(_0x5d1e0e){if(_0x5d1e0e){return _0x5d1e0e[_0x0a9e('0x2d')]()[_0x0a9e('0x2c')](function(){_0x540530[_0x0a9e('0x23')](0xcc)[_0x0a9e('0x2e')]();});}};}function handleEntityNotFound(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(!_0x66c1d2){_0x25ce3a[_0x0a9e('0x22')](0x194);}return _0x66c1d2;};}function handleError(_0x40cb85,_0x2da5c0){_0x2da5c0=_0x2da5c0||0x1f4;return function(_0x2b45ea){logger[_0x0a9e('0x1d')](_0x2b45ea[_0x0a9e('0x2f')]);if(_0x2b45ea[_0x0a9e('0x30')]){delete _0x2b45ea['name'];}_0x40cb85[_0x0a9e('0x23')](_0x2da5c0)['send'](_0x2b45ea);};}exports[_0x0a9e('0x31')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41={},_0x567193={},_0x191e91={'count':0x0,'rows':[]};var _0xd1836d=db[_0x0a9e('0x32')][_0x0a9e('0x33')];_0x567193['model']=_['keys'](_0xd1836d);_0x567193[_0x0a9e('0x34')]=_['keys'](_0x14b13f[_0x0a9e('0x34')]);_0x567193[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x567193[_0x0a9e('0x37')],_0x567193['query']);_0x3f3d41[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x567193[_0x0a9e('0x37')],qs['fields'](_0x14b13f[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x3f3d41[_0x0a9e('0x38')]=_0x3f3d41['attributes']['length']?_0x3f3d41[_0x0a9e('0x38')]:_0x567193[_0x0a9e('0x37')];if(!_0x14b13f['query'][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x3f3d41[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x14b13f['query']['limit']);_0x3f3d41[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x14b13f['query'][_0x0a9e('0x25')]);}_0x3f3d41[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x14b13f['query'][_0x0a9e('0x3d')]);_0x3f3d41[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_[_0x0a9e('0x3f')](_0x14b13f[_0x0a9e('0x34')],_0x567193[_0x0a9e('0x35')]));if(_0x14b13f[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x3f3d41[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x3f3d41[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x42')](_0xd1836d,function(_0x1a7bce){if(_0x1a7bce[_0x0a9e('0x43')][_0x0a9e('0x44')]!=='VIRTUAL'){var _0x52628e={};_0x52628e[_0x1a7bce[_0x0a9e('0x45')]]={'$like':'%'+_0x14b13f[_0x0a9e('0x34')][_0x0a9e('0x40')]+'%'};return _0x52628e;}})});}_0x3f3d41=_[_0x0a9e('0x41')]({},_0x3f3d41,_0x14b13f[_0x0a9e('0x46')]);var _0xc9a702={'where':_0x3f3d41[_0x0a9e('0x3e')]};return db[_0x0a9e('0x32')][_0x0a9e('0x24')](_0xc9a702)[_0x0a9e('0x2c')](function(_0x2c2cb0){_0x191e91[_0x0a9e('0x24')]=_0x2c2cb0;if(_0x14b13f['query'][_0x0a9e('0x47')]){_0x3f3d41[_0x0a9e('0x48')]=[{'all':!![]}];}return db[_0x0a9e('0x32')][_0x0a9e('0x49')](_0x3f3d41);})[_0x0a9e('0x2c')](function(_0xbe9d19){_0x191e91[_0x0a9e('0x4a')]=_0xbe9d19;return _0x191e91;})[_0x0a9e('0x2c')](respondWithFilteredResult(_0x2b7e7f,_0x3f3d41))['catch'](handleError(_0x2b7e7f,null));};exports[_0x0a9e('0x4b')]=function(_0x48fd45,_0x473dc8){var _0x476688={'raw':![],'where':{'id':_0x48fd45['params']['id']}},_0x8d6dd1={};_0x8d6dd1[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x32')][_0x0a9e('0x33')]);_0x8d6dd1[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x48fd45[_0x0a9e('0x34')]);_0x8d6dd1['filters']=_[_0x0a9e('0x36')](_0x8d6dd1[_0x0a9e('0x37')],_0x8d6dd1[_0x0a9e('0x34')]);_0x476688[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x8d6dd1[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x48fd45[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x476688['attributes']=_0x476688[_0x0a9e('0x38')][_0x0a9e('0x4d')]?_0x476688['attributes']:_0x8d6dd1['model'];if(_0x48fd45['query'][_0x0a9e('0x47')]){_0x476688[_0x0a9e('0x48')]=[{'all':!![]}];}_0x476688=_[_0x0a9e('0x41')]({},_0x476688,_0x48fd45[_0x0a9e('0x46')]);return db[_0x0a9e('0x32')][_0x0a9e('0x4e')](_0x476688)[_0x0a9e('0x2c')](handleEntityNotFound(_0x473dc8,null))[_0x0a9e('0x2c')](respondWithResult(_0x473dc8,null))['catch'](handleError(_0x473dc8,null));};exports['create']=function(_0x53975a,_0x39d77d){return db[_0x0a9e('0x32')][_0x0a9e('0x4f')](_0x53975a['body'],{})[_0x0a9e('0x2c')](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x50')](handleError(_0x39d77d,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x51')]['id'];}return db['FreshdeskConfiguration'][_0x0a9e('0x4e')]({'where':{'id':_0x5a88da[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x51')],null))[_0x0a9e('0x2c')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['FreshdeskConfiguration'][_0x0a9e('0x4e')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x50')](handleError(_0x3aedd0,null));};exports['getFields']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={};var _0x2f7092={};var _0x65432;var _0x3cfd00;return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x5da27d[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x2c')](function(_0x4e67ab){if(_0x4e67ab){_0x65432=_0x4e67ab;_0x2f7092[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x54')][_0x0a9e('0x33')]);_0x2f7092[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x34')]);_0x47de4c['attributes']=_[_0x0a9e('0x36')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x39')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x38')][_0x0a9e('0x4d')]?_0x47de4c[_0x0a9e('0x38')]:_0x2f7092[_0x0a9e('0x37')];_0x47de4c[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x5da27d['query'][_0x0a9e('0x3d')]);_0x47de4c['where']=qs[_0x0a9e('0x35')](_[_0x0a9e('0x3f')](_0x5da27d[_0x0a9e('0x34')],_0x2f7092['filters']));if(_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x47de4c[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x42')](_0x47de4c[_0x0a9e('0x38')],function(_0x54327c){var _0x797b45={};_0x797b45[_0x54327c]={'$like':'%'+_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x40')]+'%'};return _0x797b45;})});}_0x47de4c=_[_0x0a9e('0x41')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x46')]);return _0x65432['getFields'](_0x47de4c);}})[_0x0a9e('0x2c')](function(_0x2937e0){if(_0x2937e0){_0x3cfd00=_0x2937e0[_0x0a9e('0x4d')];if(!_0x5da27d['query'][_0x0a9e('0x3a')]('nolimit')){_0x47de4c['limit']=qs[_0x0a9e('0x26')](_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x47de4c[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x5da27d[_0x0a9e('0x34')][_0x0a9e('0x25')]);}return _0x65432[_0x0a9e('0x55')](_0x47de4c);}})[_0x0a9e('0x2c')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3?{'count':_0x3cfd00,'rows':_0x1cc4f3}:null;}})[_0x0a9e('0x2c')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x50')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x56')]=function(_0x2b8192,_0x320898,_0x412a72){var _0x2a28c0={};var _0x4257c9={};var _0x5150a4;var _0x1b0b98;return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x2b8192['params']['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x320898,null))[_0x0a9e('0x2c')](function(_0x4b341d){if(_0x4b341d){_0x5150a4=_0x4b341d;_0x4257c9[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x54')][_0x0a9e('0x33')]);_0x4257c9[_0x0a9e('0x34')]=_['keys'](_0x2b8192['query']);_0x4257c9['filters']=_[_0x0a9e('0x36')](_0x4257c9[_0x0a9e('0x37')],_0x4257c9[_0x0a9e('0x34')]);_0x2a28c0[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x4257c9[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x2b8192[_0x0a9e('0x34')]['fields']));_0x2a28c0[_0x0a9e('0x38')]=_0x2a28c0[_0x0a9e('0x38')][_0x0a9e('0x4d')]?_0x2a28c0['attributes']:_0x4257c9[_0x0a9e('0x37')];_0x2a28c0['order']=qs[_0x0a9e('0x3d')](_0x2b8192[_0x0a9e('0x34')]['sort']);_0x2a28c0[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_[_0x0a9e('0x3f')](_0x2b8192[_0x0a9e('0x34')],_0x4257c9['filters']));if(_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x2a28c0[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x2a28c0['where'],{'$or':_[_0x0a9e('0x42')](_0x2a28c0[_0x0a9e('0x38')],function(_0x2d5506){var _0x361b21={};_0x361b21[_0x2d5506]={'$like':'%'+_0x2b8192['query'][_0x0a9e('0x40')]+'%'};return _0x361b21;})});}_0x2a28c0=_[_0x0a9e('0x41')]({},_0x2a28c0,_0x2b8192[_0x0a9e('0x46')]);return _0x5150a4[_0x0a9e('0x56')](_0x2a28c0);}})[_0x0a9e('0x2c')](function(_0xdb98ca){if(_0xdb98ca){_0x1b0b98=_0xdb98ca[_0x0a9e('0x4d')];if(!_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x2a28c0[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x2a28c0['offset']=qs[_0x0a9e('0x25')](_0x2b8192[_0x0a9e('0x34')][_0x0a9e('0x25')]);}return _0x5150a4['getSubjects'](_0x2a28c0);}})[_0x0a9e('0x2c')](function(_0x33dda0){if(_0x33dda0){return _0x33dda0?{'count':_0x1b0b98,'rows':_0x33dda0}:null;}})[_0x0a9e('0x2c')](respondWithResult(_0x320898,null))[_0x0a9e('0x50')](handleError(_0x320898,null));};exports['getDescriptions']=function(_0x541e80,_0x7ebea8,_0x2bbdb5){var _0x4c54fa={};var _0x45108c={};var _0x53a6a1;var _0x260f4b;return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x541e80[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x7ebea8,null))[_0x0a9e('0x2c')](function(_0x42b959){if(_0x42b959){_0x53a6a1=_0x42b959;_0x45108c[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x45108c[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x541e80[_0x0a9e('0x34')]);_0x45108c[_0x0a9e('0x35')]=_['intersection'](_0x45108c[_0x0a9e('0x37')],_0x45108c[_0x0a9e('0x34')]);_0x4c54fa['attributes']=_[_0x0a9e('0x36')](_0x45108c['model'],qs[_0x0a9e('0x39')](_0x541e80[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x4c54fa[_0x0a9e('0x38')]=_0x4c54fa['attributes']['length']?_0x4c54fa[_0x0a9e('0x38')]:_0x45108c[_0x0a9e('0x37')];_0x4c54fa[_0x0a9e('0x3c')]=qs['sort'](_0x541e80[_0x0a9e('0x34')][_0x0a9e('0x3d')]);_0x4c54fa['where']=qs['filters'](_[_0x0a9e('0x3f')](_0x541e80['query'],_0x45108c['filters']));if(_0x541e80['query'][_0x0a9e('0x40')]){_0x4c54fa[_0x0a9e('0x3e')]=_[_0x0a9e('0x41')](_0x4c54fa[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x42')](_0x4c54fa[_0x0a9e('0x38')],function(_0x5a8854){var _0x5fd5db={};_0x5fd5db[_0x5a8854]={'$like':'%'+_0x541e80['query'][_0x0a9e('0x40')]+'%'};return _0x5fd5db;})});}_0x4c54fa=_[_0x0a9e('0x41')]({},_0x4c54fa,_0x541e80[_0x0a9e('0x46')]);return _0x53a6a1[_0x0a9e('0x57')](_0x4c54fa);}})['then'](function(_0x46c9ac){if(_0x46c9ac){_0x260f4b=_0x46c9ac[_0x0a9e('0x4d')];if(!_0x541e80[_0x0a9e('0x34')]['hasOwnProperty'](_0x0a9e('0x3b'))){_0x4c54fa[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x541e80[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x4c54fa[_0x0a9e('0x25')]=qs[_0x0a9e('0x25')](_0x541e80[_0x0a9e('0x34')]['offset']);}return _0x53a6a1[_0x0a9e('0x57')](_0x4c54fa);}})[_0x0a9e('0x2c')](function(_0x589ff3){if(_0x589ff3){return _0x589ff3?{'count':_0x260f4b,'rows':_0x589ff3}:null;}})[_0x0a9e('0x2c')](respondWithResult(_0x7ebea8,null))[_0x0a9e('0x50')](handleError(_0x7ebea8,null));};exports[_0x0a9e('0x58')]=function(_0x5a26c8,_0x96672f,_0x52ec10){var _0x8c8fbe={};var _0x2b5148={};var _0x558a87;var _0x1f29bd;return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x5a26c8[_0x0a9e('0x52')]['id']}})[_0x0a9e('0x2c')](handleEntityNotFound(_0x96672f,null))['then'](function(_0x329d88){if(_0x329d88){_0x558a87=_0x329d88;_0x2b5148[_0x0a9e('0x37')]=_[_0x0a9e('0x4c')](db[_0x0a9e('0x59')][_0x0a9e('0x33')]);_0x2b5148[_0x0a9e('0x34')]=_[_0x0a9e('0x4c')](_0x5a26c8[_0x0a9e('0x34')]);_0x2b5148[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2b5148[_0x0a9e('0x37')],_0x2b5148[_0x0a9e('0x34')]);_0x8c8fbe[_0x0a9e('0x38')]=_['intersection'](_0x2b5148[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x8c8fbe[_0x0a9e('0x38')]=_0x8c8fbe['attributes'][_0x0a9e('0x4d')]?_0x8c8fbe[_0x0a9e('0x38')]:_0x2b5148['model'];_0x8c8fbe[_0x0a9e('0x3c')]=qs['sort'](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x3d')]);_0x8c8fbe[_0x0a9e('0x3e')]=qs[_0x0a9e('0x35')](_['pick'](_0x5a26c8[_0x0a9e('0x34')],_0x2b5148['filters']));if(_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x40')]){_0x8c8fbe['where']=_[_0x0a9e('0x41')](_0x8c8fbe[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x42')](_0x8c8fbe['attributes'],function(_0x4c788f){var _0x1b82b7={};_0x1b82b7[_0x4c788f]={'$like':'%'+_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x40')]+'%'};return _0x1b82b7;})});}_0x8c8fbe=_[_0x0a9e('0x41')]({},_0x8c8fbe,_0x5a26c8[_0x0a9e('0x46')]);return _0x558a87[_0x0a9e('0x58')](_0x8c8fbe);}})[_0x0a9e('0x2c')](function(_0x3c75b9){if(_0x3c75b9){_0x1f29bd=_0x3c75b9[_0x0a9e('0x4d')];if(!_0x5a26c8['query'][_0x0a9e('0x3a')]('nolimit')){_0x8c8fbe[_0x0a9e('0x26')]=qs[_0x0a9e('0x26')](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x26')]);_0x8c8fbe[_0x0a9e('0x25')]=qs['offset'](_0x5a26c8[_0x0a9e('0x34')][_0x0a9e('0x25')]);}return _0x558a87[_0x0a9e('0x58')](_0x8c8fbe);}})[_0x0a9e('0x2c')](function(_0x2263f1){if(_0x2263f1){return _0x2263f1?{'count':_0x1f29bd,'rows':_0x2263f1}:null;}})['then'](respondWithResult(_0x96672f,null))['catch'](handleError(_0x96672f,null));};exports[_0x0a9e('0x5a')]=function(_0x583662,_0x25eae0,_0x4658df){if(_0x583662[_0x0a9e('0x51')]['id']){delete _0x583662[_0x0a9e('0x51')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x53')]({'where':{'id':_0x583662['params']['id']}})['then'](handleEntityNotFound(_0x25eae0,null))[_0x0a9e('0x2c')](function(_0x5dfbe2){if(_0x5dfbe2){return _0x5dfbe2[_0x0a9e('0x5a')](_0x583662['body'][_0x0a9e('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x25eae0,null))['catch'](handleError(_0x25eae0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 1fff170..b5c6011 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 _0x095b=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x293c02,_0x22a469){var _0x38a38a=function(_0x2046c8){while(--_0x2046c8){_0x293c02['push'](_0x293c02['shift']());}};_0x38a38a(++_0x22a469);}(_0x095b,0x75));var _0xb095=function(_0x10e996,_0x3a37db){_0x10e996=_0x10e996-0x0;var _0x6772d0=_0x095b[_0x10e996];return _0x6772d0;};'use strict';var _=require(_0xb095('0x0'));var util=require(_0xb095('0x1'));var logger=require(_0xb095('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb095('0x3'));var rp=require(_0xb095('0x4'));var fs=require('fs');var path=require(_0xb095('0x5'));var rimraf=require(_0xb095('0x6'));var config=require(_0xb095('0x7'));var attributes=require(_0xb095('0x8'));module[_0xb095('0x9')]=function(_0x90501f,_0x5d2b9f){return _0x90501f[_0xb095('0xa')](_0xb095('0xb'),attributes,{'tableName':_0xb095('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38f0=['api','moment','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x2bbf5b,_0x225431){var _0x6cce2a=function(_0x5c57ec){while(--_0x5c57ec){_0x2bbf5b['push'](_0x2bbf5b['shift']());}};_0x6cce2a(++_0x225431);}(_0x38f0,0x190));var _0x038f=function(_0x529723,_0x330a7f){_0x529723=_0x529723-0x0;var _0x1aad0a=_0x38f0[_0x529723];return _0x1aad0a;};'use strict';var _=require(_0x038f('0x0'));var util=require(_0x038f('0x1'));var logger=require(_0x038f('0x2'))(_0x038f('0x3'));var moment=require(_0x038f('0x4'));var BPromise=require('bluebird');var rp=require(_0x038f('0x5'));var fs=require('fs');var path=require(_0x038f('0x6'));var rimraf=require(_0x038f('0x7'));var config=require('../../config/environment');var attributes=require(_0x038f('0x8'));module[_0x038f('0x9')]=function(_0x3f342c,_0x4c6be7){return _0x3f342c[_0x038f('0xa')](_0x038f('0xb'),attributes,{'tableName':_0x038f('0xc'),'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 d16aacf..c457646 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 _0x933c=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x933c,0xd1));var _0xc933=function(_0x2eb8eb,_0x3b203d){_0x2eb8eb=_0x2eb8eb-0x0;var _0x3ad863=_0x933c[_0x2eb8eb];return _0x3ad863;};'use strict';var _=require(_0xc933('0x0'));var util=require(_0xc933('0x1'));var moment=require('moment');var BPromise=require(_0xc933('0x2'));var rs=require(_0xc933('0x3'));var fs=require('fs');var Redis=require(_0xc933('0x4'));var db=require(_0xc933('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc933('0x6'))(_0xc933('0x7'));var config=require(_0xc933('0x8'));var jayson=require(_0xc933('0x9'));var client=jayson[_0xc933('0xa')][_0xc933('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x197ec7,_0x2dc5a8,_0x2c90d1){return new BPromise(function(_0x5549b0,_0x1e14c9){return client[_0xc933('0xc')](_0x197ec7,_0x2c90d1)[_0xc933('0xd')](function(_0x5b448d){logger[_0xc933('0xe')](_0xc933('0xf'),_0x2dc5a8,_0xc933('0x10'));logger[_0xc933('0x11')](_0xc933('0x12'),_0x2dc5a8,'request\x20sent',JSON[_0xc933('0x13')](_0x5b448d));if(_0x5b448d[_0xc933('0x14')]){if(_0x5b448d['error']['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2dc5a8,_0x5b448d['error'][_0xc933('0x15')]);return _0x1e14c9(_0x5b448d[_0xc933('0x14')][_0xc933('0x15')]);}logger[_0xc933('0x14')](_0xc933('0xf'),_0x2dc5a8,_0x5b448d[_0xc933('0x14')][_0xc933('0x15')]);return _0x5549b0(_0x5b448d[_0xc933('0x14')][_0xc933('0x15')]);}else{logger[_0xc933('0xe')](_0xc933('0xf'),_0x2dc5a8,_0xc933('0x10'));_0x5549b0(_0x5b448d[_0xc933('0x16')]['message']);}})['catch'](function(_0x412b83){logger[_0xc933('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2dc5a8,_0x412b83);_0x1e14c9(_0x412b83);});});} \ No newline at end of file +var _0xd1f7=['result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0xd1f7,0x9a));var _0x7d1f=function(_0x521054,_0x227c2f){_0x521054=_0x521054-0x0;var _0x4136d9=_0xd1f7[_0x521054];return _0x4136d9;};'use strict';var _=require('lodash');var util=require(_0x7d1f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d1f('0x1'));var fs=require('fs');var Redis=require(_0x7d1f('0x2'));var db=require(_0x7d1f('0x3'))['db'];var utils=require(_0x7d1f('0x4'));var logger=require('../../config/logger')(_0x7d1f('0x5'));var config=require(_0x7d1f('0x6'));var jayson=require(_0x7d1f('0x7'));var client=jayson[_0x7d1f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9f10,_0x155c38,_0x421993){return new BPromise(function(_0x4fddcb,_0x533f43){return client[_0x7d1f('0x9')](_0x2a9f10,_0x421993)['then'](function(_0x1d0615){logger[_0x7d1f('0xa')](_0x7d1f('0xb'),_0x155c38,_0x7d1f('0xc'));logger[_0x7d1f('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x155c38,_0x7d1f('0xc'),JSON['stringify'](_0x1d0615));if(_0x1d0615[_0x7d1f('0xe')]){if(_0x1d0615[_0x7d1f('0xe')][_0x7d1f('0xf')]===0x1f4){logger['error'](_0x7d1f('0xb'),_0x155c38,_0x1d0615[_0x7d1f('0xe')][_0x7d1f('0x10')]);return _0x533f43(_0x1d0615[_0x7d1f('0xe')][_0x7d1f('0x10')]);}logger[_0x7d1f('0xe')](_0x7d1f('0xb'),_0x155c38,_0x1d0615[_0x7d1f('0xe')][_0x7d1f('0x10')]);return _0x4fddcb(_0x1d0615['error'][_0x7d1f('0x10')]);}else{logger[_0x7d1f('0xa')](_0x7d1f('0xb'),_0x155c38,_0x7d1f('0xc'));_0x4fddcb(_0x1d0615[_0x7d1f('0x11')]['message']);}})[_0x7d1f('0x12')](function(_0x279d78){logger[_0x7d1f('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x155c38,_0x279d78);_0x533f43(_0x279d78);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 32f4e7f..a873232 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 _0x680f=['index','get','show','create','put','/:id','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x43645f,_0x656278){var _0x36f9ab=function(_0x20f6ec){while(--_0x20f6ec){_0x43645f['push'](_0x43645f['shift']());}};_0x36f9ab(++_0x656278);}(_0x680f,0x78));var _0xf680=function(_0xd9109c,_0x5d36bf){_0xd9109c=_0xd9109c-0x0;var _0xeadb4a=_0x680f[_0xd9109c];return _0xeadb4a;};'use strict';var multer=require(_0xf680('0x0'));var util=require(_0xf680('0x1'));var path=require(_0xf680('0x2'));var timeout=require('connect-timeout');var express=require(_0xf680('0x3'));var router=express[_0xf680('0x4')]();var auth=require(_0xf680('0x5'));var interaction=require(_0xf680('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xf680('0x7')](),controller[_0xf680('0x8')]);router[_0xf680('0x9')]('/:id',auth[_0xf680('0x7')](),controller[_0xf680('0xa')]);router['post']('/',auth[_0xf680('0x7')](),controller[_0xf680('0xb')]);router[_0xf680('0xc')](_0xf680('0xd'),auth[_0xf680('0x7')](),controller[_0xf680('0xe')]);router['delete'](_0xf680('0xd'),auth['isAuthenticated'](),controller[_0xf680('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2f3a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','multer'];(function(_0x4a1835,_0xe4a237){var _0x203f1b=function(_0x52886e){while(--_0x52886e){_0x4a1835['push'](_0x4a1835['shift']());}};_0x203f1b(++_0xe4a237);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x4d3a08,_0x3f8cc3){_0x4d3a08=_0x4d3a08-0x0;var _0x5d0a08=_0x2f3a[_0x4d3a08];return _0x5d0a08;};'use strict';var multer=require(_0xa2f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa2f3('0x1'));var express=require(_0xa2f3('0x2'));var router=express[_0xa2f3('0x3')]();var auth=require(_0xa2f3('0x4'));var interaction=require(_0xa2f3('0x5'));var config=require(_0xa2f3('0x6'));var controller=require('./intFreshdeskField.controller');router[_0xa2f3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa2f3('0x8')]);router[_0xa2f3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa2f3('0x9')]);router[_0xa2f3('0xa')]('/',auth[_0xa2f3('0xb')](),controller[_0xa2f3('0xc')]);router['put'](_0xa2f3('0xd'),auth[_0xa2f3('0xb')](),controller[_0xa2f3('0xe')]);router[_0xa2f3('0xf')](_0xa2f3('0xd'),auth['isAuthenticated'](),controller[_0xa2f3('0x10')]);module[_0xa2f3('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 3c09b4e..23ee0da 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 _0xe706=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x81fc31,_0x151260){var _0x3c1234=function(_0x45ccc5){while(--_0x45ccc5){_0x81fc31['push'](_0x81fc31['shift']());}};_0x3c1234(++_0x151260);}(_0xe706,0xa3));var _0x6e70=function(_0x309458,_0xba6e63){_0x309458=_0x309458-0x0;var _0x3306ee=_0xe706[_0x309458];return _0x3306ee;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'type':{'type':Sequelize[_0x6e70('0x2')]('string',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')),'defaultValue':_0x6e70('0x6')},'content':{'type':Sequelize[_0x6e70('0x7')]},'key':{'type':Sequelize[_0x6e70('0x7')]},'keyType':{'type':Sequelize[_0x6e70('0x2')](_0x6e70('0x6'),_0x6e70('0x3'),_0x6e70('0x4'))},'keyContent':{'type':Sequelize[_0x6e70('0x7')]},'idField':{'type':Sequelize[_0x6e70('0x7')]},'nameField':{'type':Sequelize[_0x6e70('0x7')]},'customField':{'type':Sequelize[_0x6e70('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e70('0x7')]}}; \ No newline at end of file +var _0x6f7a=['ENUM','string','customVariable','keyValue','STRING','variable','sequelize','exports'];(function(_0x5f1204,_0x92b018){var _0x44cf32=function(_0x2f7aaf){while(--_0x2f7aaf){_0x5f1204['push'](_0x5f1204['shift']());}};_0x44cf32(++_0x92b018);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xa35391,_0x14f31b){_0xa35391=_0xa35391-0x0;var _0x909a72=_0x6f7a[_0xa35391];return _0x909a72;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'type':{'type':Sequelize[_0xa6f7('0x2')](_0xa6f7('0x3'),'variable',_0xa6f7('0x4'),_0xa6f7('0x5')),'defaultValue':_0xa6f7('0x3')},'content':{'type':Sequelize[_0xa6f7('0x6')]},'key':{'type':Sequelize[_0xa6f7('0x6')]},'keyType':{'type':Sequelize[_0xa6f7('0x2')](_0xa6f7('0x3'),_0xa6f7('0x7'),_0xa6f7('0x4'))},'keyContent':{'type':Sequelize[_0xa6f7('0x6')]},'idField':{'type':Sequelize[_0xa6f7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6f7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ff542b8..a059ed0 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 _0x474f=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','type','key','field','includeAll','include','findAll','catch','show','options','create','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','FreshdeskField','rawAttributes','model','keys','filters'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x474f,0xac));var _0xf474=function(_0x1e6849,_0xf94aab){_0x1e6849=_0x1e6849-0x0;var _0x417613=_0x474f[_0x1e6849];return _0x417613;};'use strict';var pdf=require(_0xf474('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf474('0x1'));var zipdir=require(_0xf474('0x2'));var jsonpatch=require(_0xf474('0x3'));var rp=require(_0xf474('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf474('0x5'));var util=require(_0xf474('0x6'));var path=require(_0xf474('0x7'));var sox=require(_0xf474('0x8'));var csv=require(_0xf474('0x9'));var ejs=require(_0xf474('0xa'));var fs=require('fs');var _=require(_0xf474('0xb'));var squel=require(_0xf474('0xc'));var crypto=require(_0xf474('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf474('0x9'));var querystring=require(_0xf474('0xe'));var Papa=require(_0xf474('0xf'));var Redis=require(_0xf474('0x10'));var authService=require(_0xf474('0x11'));var qs=require(_0xf474('0x12'));var hardwareService=require(_0xf474('0x13'));var logger=require('../../config/logger')(_0xf474('0x14'));var utils=require(_0xf474('0x15'));var config=require(_0xf474('0x16'));var db=require(_0xf474('0x17'))['db'];function respondWithStatusCode(_0x4b19ca,_0x3188b5){_0x3188b5=_0x3188b5||0xcc;return function(_0x119785){if(_0x119785){return _0x4b19ca[_0xf474('0x18')](_0x3188b5);}return _0x4b19ca[_0xf474('0x19')](_0x3188b5)[_0xf474('0x1a')]();};}function respondWithResult(_0xf3b921,_0x51f55e){_0x51f55e=_0x51f55e||0xc8;return function(_0x34fffe){if(_0x34fffe){return _0xf3b921[_0xf474('0x19')](_0x51f55e)['json'](_0x34fffe);}};}function respondWithFilteredResult(_0xdb98c0,_0x529f7b){return function(_0x2174c9){if(_0x2174c9){var _0x1c1e6b=_0x2174c9[_0xf474('0x1b')],_0x299bc0=_0x529f7b[_0xf474('0x1c')],_0x52b0ab=_0x529f7b[_0xf474('0x1c')]+_0x529f7b[_0xf474('0x1d')],_0x114d22;if(_0x52b0ab>=_0x1c1e6b){_0x52b0ab=_0x1c1e6b;_0x114d22=0xc8;}else{_0x114d22=0xce;}_0xdb98c0[_0xf474('0x19')](_0x114d22);return _0xdb98c0[_0xf474('0x1e')](_0xf474('0x1f'),_0x299bc0+'-'+_0x52b0ab+'/'+_0x1c1e6b)[_0xf474('0x20')](_0x2174c9);}return null;};}function patchUpdates(_0x3109ea){return function(_0x279759){try{jsonpatch[_0xf474('0x21')](_0x279759,_0x3109ea,!![]);}catch(_0x83cd0c){return BPromise[_0xf474('0x22')](_0x83cd0c);}return _0x279759['save']();};}function saveUpdates(_0x4c062f,_0xeb70e9){return function(_0x4eef93){if(_0x4eef93){return _0x4eef93[_0xf474('0x23')](_0x4c062f)[_0xf474('0x24')](function(_0x5d8fd8){return _0x5d8fd8;});}return null;};}function removeEntity(_0x46fff8,_0x42a487){return function(_0x3ec2ec){if(_0x3ec2ec){return _0x3ec2ec[_0xf474('0x25')]()['then'](function(){_0x46fff8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b2b6,_0x16cedc){return function(_0xde235e){if(!_0xde235e){_0x14b2b6[_0xf474('0x18')](0x194);}return _0xde235e;};}function handleError(_0x2bac12,_0x27fa0d){_0x27fa0d=_0x27fa0d||0x1f4;return function(_0x3b22ae){logger[_0xf474('0x26')](_0x3b22ae['stack']);if(_0x3b22ae[_0xf474('0x27')]){delete _0x3b22ae[_0xf474('0x27')];}_0x2bac12[_0xf474('0x19')](_0x27fa0d)[_0xf474('0x28')](_0x3b22ae);};}exports[_0xf474('0x29')]=function(_0x5c3fc8,_0x478d27){var _0x349016={},_0x58b233={},_0x3605f7={'count':0x0,'rows':[]};var _0x28321d=db[_0xf474('0x2a')][_0xf474('0x2b')];_0x58b233[_0xf474('0x2c')]=_[_0xf474('0x2d')](_0x28321d);_0x58b233['query']=_['keys'](_0x5c3fc8['query']);_0x58b233[_0xf474('0x2e')]=_[_0xf474('0x2f')](_0x58b233[_0xf474('0x2c')],_0x58b233[_0xf474('0x30')]);_0x349016[_0xf474('0x31')]=_[_0xf474('0x2f')](_0x58b233['model'],qs[_0xf474('0x32')](_0x5c3fc8[_0xf474('0x30')][_0xf474('0x32')]));_0x349016['attributes']=_0x349016[_0xf474('0x31')][_0xf474('0x33')]?_0x349016['attributes']:_0x58b233[_0xf474('0x2c')];if(!_0x5c3fc8[_0xf474('0x30')][_0xf474('0x34')](_0xf474('0x35'))){_0x349016['limit']=qs[_0xf474('0x1d')](_0x5c3fc8[_0xf474('0x30')]['limit']);_0x349016[_0xf474('0x1c')]=qs['offset'](_0x5c3fc8[_0xf474('0x30')][_0xf474('0x1c')]);}_0x349016[_0xf474('0x36')]=qs['sort'](_0x5c3fc8['query']['sort']);_0x349016['where']=qs[_0xf474('0x2e')](_[_0xf474('0x37')](_0x5c3fc8[_0xf474('0x30')],_0x58b233['filters']));if(_0x5c3fc8['query'][_0xf474('0x38')]){_0x349016[_0xf474('0x39')]=_[_0xf474('0x3a')](_0x349016[_0xf474('0x39')],{'$or':_[_0xf474('0x3b')](_0x28321d,function(_0x44f1ca){if(_0x44f1ca[_0xf474('0x3c')][_0xf474('0x3d')]!=='VIRTUAL'){var _0x26cb77={};_0x26cb77[_0x44f1ca[_0xf474('0x3e')]]={'$like':'%'+_0x5c3fc8[_0xf474('0x30')]['filter']+'%'};return _0x26cb77;}})});}_0x349016=_[_0xf474('0x3a')]({},_0x349016,_0x5c3fc8['options']);var _0x3437db={'where':_0x349016[_0xf474('0x39')]};return db[_0xf474('0x2a')][_0xf474('0x1b')](_0x3437db)[_0xf474('0x24')](function(_0x1874ec){_0x3605f7[_0xf474('0x1b')]=_0x1874ec;if(_0x5c3fc8[_0xf474('0x30')][_0xf474('0x3f')]){_0x349016[_0xf474('0x40')]=[{'all':!![]}];}return db[_0xf474('0x2a')][_0xf474('0x41')](_0x349016);})[_0xf474('0x24')](function(_0x21b6cd){_0x3605f7['rows']=_0x21b6cd;return _0x3605f7;})[_0xf474('0x24')](respondWithFilteredResult(_0x478d27,_0x349016))[_0xf474('0x42')](handleError(_0x478d27,null));};exports[_0xf474('0x43')]=function(_0x250be6,_0x1e6a2e){var _0x405ee9={'raw':!![],'where':{'id':_0x250be6['params']['id']}},_0xa232d0={};_0xa232d0[_0xf474('0x2c')]=_[_0xf474('0x2d')](db[_0xf474('0x2a')][_0xf474('0x2b')]);_0xa232d0[_0xf474('0x30')]=_[_0xf474('0x2d')](_0x250be6['query']);_0xa232d0[_0xf474('0x2e')]=_[_0xf474('0x2f')](_0xa232d0[_0xf474('0x2c')],_0xa232d0[_0xf474('0x30')]);_0x405ee9['attributes']=_[_0xf474('0x2f')](_0xa232d0[_0xf474('0x2c')],qs[_0xf474('0x32')](_0x250be6[_0xf474('0x30')][_0xf474('0x32')]));_0x405ee9[_0xf474('0x31')]=_0x405ee9[_0xf474('0x31')][_0xf474('0x33')]?_0x405ee9[_0xf474('0x31')]:_0xa232d0['model'];if(_0x250be6[_0xf474('0x30')][_0xf474('0x3f')]){_0x405ee9['include']=[{'all':!![]}];}_0x405ee9=_[_0xf474('0x3a')]({},_0x405ee9,_0x250be6[_0xf474('0x44')]);return db[_0xf474('0x2a')]['find'](_0x405ee9)[_0xf474('0x24')](handleEntityNotFound(_0x1e6a2e,null))[_0xf474('0x24')](respondWithResult(_0x1e6a2e,null))[_0xf474('0x42')](handleError(_0x1e6a2e,null));};exports[_0xf474('0x45')]=function(_0xf6f6c2,_0x120b43){return db[_0xf474('0x2a')][_0xf474('0x45')](_0xf6f6c2[_0xf474('0x46')],{})[_0xf474('0x24')](respondWithResult(_0x120b43,0xc9))['catch'](handleError(_0x120b43,null));};exports[_0xf474('0x23')]=function(_0x1291c5,_0x22ab7c){if(_0x1291c5[_0xf474('0x46')]['id']){delete _0x1291c5[_0xf474('0x46')]['id'];}return db[_0xf474('0x2a')][_0xf474('0x47')]({'where':{'id':_0x1291c5['params']['id']}})[_0xf474('0x24')](handleEntityNotFound(_0x22ab7c,null))[_0xf474('0x24')](saveUpdates(_0x1291c5['body'],null))[_0xf474('0x24')](respondWithResult(_0x22ab7c,null))[_0xf474('0x42')](handleError(_0x22ab7c,null));};exports[_0xf474('0x25')]=function(_0x3f887c,_0x486d67){return db[_0xf474('0x2a')]['find']({'where':{'id':_0x3f887c[_0xf474('0x48')]['id']}})[_0xf474('0x24')](handleEntityNotFound(_0x486d67,null))[_0xf474('0x24')](removeEntity(_0x486d67,null))[_0xf474('0x42')](handleError(_0x486d67,null));}; \ No newline at end of file +var _0x5887=['merge','map','type','includeAll','findAll','rows','show','keys','options','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where'];(function(_0x41cdde,_0x4bd78c){var _0x2dec1e=function(_0xc4e978){while(--_0xc4e978){_0x41cdde['push'](_0x41cdde['shift']());}};_0x2dec1e(++_0x4bd78c);}(_0x5887,0x12e));var _0x7588=function(_0xe45b6d,_0x443cac){_0xe45b6d=_0xe45b6d-0x0;var _0x4d6f47=_0x5887[_0xe45b6d];return _0x4d6f47;};'use strict';var pdf=require(_0x7588('0x0'));var emlformat=require(_0x7588('0x1'));var rimraf=require(_0x7588('0x2'));var zipdir=require(_0x7588('0x3'));var jsonpatch=require(_0x7588('0x4'));var rp=require(_0x7588('0x5'));var moment=require(_0x7588('0x6'));var BPromise=require(_0x7588('0x7'));var Mustache=require('mustache');var util=require(_0x7588('0x8'));var path=require(_0x7588('0x9'));var sox=require('sox');var csv=require(_0x7588('0xa'));var ejs=require(_0x7588('0xb'));var fs=require('fs');var _=require(_0x7588('0xc'));var squel=require(_0x7588('0xd'));var crypto=require(_0x7588('0xe'));var jsforce=require(_0x7588('0xf'));var deskjs=require(_0x7588('0x10'));var toCsv=require(_0x7588('0xa'));var querystring=require(_0x7588('0x11'));var Papa=require(_0x7588('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7588('0x13'));var hardwareService=require(_0x7588('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7588('0x15'));var config=require(_0x7588('0x16'));var db=require(_0x7588('0x17'))['db'];function respondWithStatusCode(_0x5b1d18,_0x13fde6){_0x13fde6=_0x13fde6||0xcc;return function(_0x5d61d1){if(_0x5d61d1){return _0x5b1d18[_0x7588('0x18')](_0x13fde6);}return _0x5b1d18[_0x7588('0x19')](_0x13fde6)[_0x7588('0x1a')]();};}function respondWithResult(_0x2d914e,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x57f035){if(_0x57f035){return _0x2d914e[_0x7588('0x19')](_0x16e490)['json'](_0x57f035);}};}function respondWithFilteredResult(_0x57b601,_0x58c9ac){return function(_0x45f3d8){if(_0x45f3d8){var _0x5c115f=_0x45f3d8[_0x7588('0x1b')],_0x4b1528=_0x58c9ac[_0x7588('0x1c')],_0x5c5d11=_0x58c9ac[_0x7588('0x1c')]+_0x58c9ac[_0x7588('0x1d')],_0x58c94a;if(_0x5c5d11>=_0x5c115f){_0x5c5d11=_0x5c115f;_0x58c94a=0xc8;}else{_0x58c94a=0xce;}_0x57b601[_0x7588('0x19')](_0x58c94a);return _0x57b601[_0x7588('0x1e')](_0x7588('0x1f'),_0x4b1528+'-'+_0x5c5d11+'/'+_0x5c115f)[_0x7588('0x20')](_0x45f3d8);}return null;};}function patchUpdates(_0x57e6dd){return function(_0x4e6777){try{jsonpatch[_0x7588('0x21')](_0x4e6777,_0x57e6dd,!![]);}catch(_0x44dc15){return BPromise['reject'](_0x44dc15);}return _0x4e6777[_0x7588('0x22')]();};}function saveUpdates(_0x13874b,_0x482fdb){return function(_0x435924){if(_0x435924){return _0x435924[_0x7588('0x23')](_0x13874b)[_0x7588('0x24')](function(_0x18b6e8){return _0x18b6e8;});}return null;};}function removeEntity(_0x393f41,_0x24e274){return function(_0x2b4295){if(_0x2b4295){return _0x2b4295[_0x7588('0x25')]()[_0x7588('0x24')](function(){_0x393f41[_0x7588('0x19')](0xcc)[_0x7588('0x1a')]();});}};}function handleEntityNotFound(_0x3b4369,_0x481b78){return function(_0x193d9c){if(!_0x193d9c){_0x3b4369[_0x7588('0x18')](0x194);}return _0x193d9c;};}function handleError(_0x5b7b00,_0x26162f){_0x26162f=_0x26162f||0x1f4;return function(_0x4aba35){logger[_0x7588('0x26')](_0x4aba35[_0x7588('0x27')]);if(_0x4aba35[_0x7588('0x28')]){delete _0x4aba35[_0x7588('0x28')];}_0x5b7b00[_0x7588('0x19')](_0x26162f)[_0x7588('0x29')](_0x4aba35);};}exports[_0x7588('0x2a')]=function(_0x3f6d0b,_0x3ec236){var _0x2a67d8={},_0xe91a36={},_0x18e1ab={'count':0x0,'rows':[]};var _0x2e3a38=db[_0x7588('0x2b')][_0x7588('0x2c')];_0xe91a36[_0x7588('0x2d')]=_['keys'](_0x2e3a38);_0xe91a36['query']=_['keys'](_0x3f6d0b[_0x7588('0x2e')]);_0xe91a36['filters']=_[_0x7588('0x2f')](_0xe91a36[_0x7588('0x2d')],_0xe91a36[_0x7588('0x2e')]);_0x2a67d8['attributes']=_[_0x7588('0x2f')](_0xe91a36['model'],qs[_0x7588('0x30')](_0x3f6d0b[_0x7588('0x2e')]['fields']));_0x2a67d8[_0x7588('0x31')]=_0x2a67d8[_0x7588('0x31')][_0x7588('0x32')]?_0x2a67d8[_0x7588('0x31')]:_0xe91a36[_0x7588('0x2d')];if(!_0x3f6d0b[_0x7588('0x2e')][_0x7588('0x33')](_0x7588('0x34'))){_0x2a67d8[_0x7588('0x1d')]=qs[_0x7588('0x1d')](_0x3f6d0b[_0x7588('0x2e')][_0x7588('0x1d')]);_0x2a67d8[_0x7588('0x1c')]=qs[_0x7588('0x1c')](_0x3f6d0b[_0x7588('0x2e')][_0x7588('0x1c')]);}_0x2a67d8['order']=qs[_0x7588('0x35')](_0x3f6d0b[_0x7588('0x2e')]['sort']);_0x2a67d8['where']=qs[_0x7588('0x36')](_[_0x7588('0x37')](_0x3f6d0b['query'],_0xe91a36['filters']));if(_0x3f6d0b['query'][_0x7588('0x38')]){_0x2a67d8[_0x7588('0x39')]=_[_0x7588('0x3a')](_0x2a67d8[_0x7588('0x39')],{'$or':_[_0x7588('0x3b')](_0x2e3a38,function(_0x2ac10d){if(_0x2ac10d[_0x7588('0x3c')]['key']!=='VIRTUAL'){var _0x2282fb={};_0x2282fb[_0x2ac10d['field']]={'$like':'%'+_0x3f6d0b[_0x7588('0x2e')]['filter']+'%'};return _0x2282fb;}})});}_0x2a67d8=_[_0x7588('0x3a')]({},_0x2a67d8,_0x3f6d0b['options']);var _0x5a3388={'where':_0x2a67d8[_0x7588('0x39')]};return db[_0x7588('0x2b')][_0x7588('0x1b')](_0x5a3388)[_0x7588('0x24')](function(_0x302597){_0x18e1ab['count']=_0x302597;if(_0x3f6d0b[_0x7588('0x2e')][_0x7588('0x3d')]){_0x2a67d8['include']=[{'all':!![]}];}return db[_0x7588('0x2b')][_0x7588('0x3e')](_0x2a67d8);})[_0x7588('0x24')](function(_0x171890){_0x18e1ab[_0x7588('0x3f')]=_0x171890;return _0x18e1ab;})[_0x7588('0x24')](respondWithFilteredResult(_0x3ec236,_0x2a67d8))['catch'](handleError(_0x3ec236,null));};exports[_0x7588('0x40')]=function(_0x1f1fe5,_0x486fd9){var _0x1f8676={'raw':!![],'where':{'id':_0x1f1fe5['params']['id']}},_0x1a1ac2={};_0x1a1ac2[_0x7588('0x2d')]=_[_0x7588('0x41')](db[_0x7588('0x2b')][_0x7588('0x2c')]);_0x1a1ac2[_0x7588('0x2e')]=_[_0x7588('0x41')](_0x1f1fe5[_0x7588('0x2e')]);_0x1a1ac2['filters']=_[_0x7588('0x2f')](_0x1a1ac2['model'],_0x1a1ac2[_0x7588('0x2e')]);_0x1f8676[_0x7588('0x31')]=_['intersection'](_0x1a1ac2['model'],qs[_0x7588('0x30')](_0x1f1fe5['query'][_0x7588('0x30')]));_0x1f8676[_0x7588('0x31')]=_0x1f8676[_0x7588('0x31')][_0x7588('0x32')]?_0x1f8676[_0x7588('0x31')]:_0x1a1ac2[_0x7588('0x2d')];if(_0x1f1fe5['query'][_0x7588('0x3d')]){_0x1f8676['include']=[{'all':!![]}];}_0x1f8676=_[_0x7588('0x3a')]({},_0x1f8676,_0x1f1fe5[_0x7588('0x42')]);return db[_0x7588('0x2b')][_0x7588('0x43')](_0x1f8676)['then'](handleEntityNotFound(_0x486fd9,null))[_0x7588('0x24')](respondWithResult(_0x486fd9,null))[_0x7588('0x44')](handleError(_0x486fd9,null));};exports[_0x7588('0x45')]=function(_0x4cb7b8,_0x4c99ae){return db[_0x7588('0x2b')][_0x7588('0x45')](_0x4cb7b8[_0x7588('0x46')],{})[_0x7588('0x24')](respondWithResult(_0x4c99ae,0xc9))['catch'](handleError(_0x4c99ae,null));};exports[_0x7588('0x23')]=function(_0x2808d4,_0x56b6da){if(_0x2808d4[_0x7588('0x46')]['id']){delete _0x2808d4['body']['id'];}return db['FreshdeskField'][_0x7588('0x43')]({'where':{'id':_0x2808d4[_0x7588('0x47')]['id']}})[_0x7588('0x24')](handleEntityNotFound(_0x56b6da,null))[_0x7588('0x24')](saveUpdates(_0x2808d4['body'],null))['then'](respondWithResult(_0x56b6da,null))[_0x7588('0x44')](handleError(_0x56b6da,null));};exports[_0x7588('0x25')]=function(_0x2dc1fb,_0x4c6ae5){return db[_0x7588('0x2b')][_0x7588('0x43')]({'where':{'id':_0x2dc1fb[_0x7588('0x47')]['id']}})[_0x7588('0x24')](handleEntityNotFound(_0x4c6ae5,null))['then'](removeEntity(_0x4c6ae5,null))[_0x7588('0x44')](handleError(_0x4c6ae5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7f48812..4439876 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 _0x0a21=['FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x38dc11,_0x5a6bc9){var _0x36d581=function(_0x465e48){while(--_0x465e48){_0x38dc11['push'](_0x38dc11['shift']());}};_0x36d581(++_0x5a6bc9);}(_0x0a21,0xee));var _0x10a2=function(_0x44e3f6,_0x18a192){_0x44e3f6=_0x44e3f6-0x0;var _0x2d4d5d=_0x0a21[_0x44e3f6];return _0x2d4d5d;};'use strict';var _=require(_0x10a2('0x0'));var util=require('util');var logger=require(_0x10a2('0x1'))(_0x10a2('0x2'));var moment=require(_0x10a2('0x3'));var BPromise=require(_0x10a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10a2('0x5'));var rimraf=require('rimraf');var config=require(_0x10a2('0x6'));var attributes=require(_0x10a2('0x7'));module['exports']=function(_0x36bd7c,_0xcecbf7){return _0x36bd7c[_0x10a2('0x8')](_0x10a2('0x9'),attributes,{'tableName':_0x10a2('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x10a2('0xb'),_0x10a2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc058=['./intFreshdeskField.attributes','exports','define','FreshdeskField','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1eed8e,_0xe05364){var _0x564f41=function(_0x394a61){while(--_0x394a61){_0x1eed8e['push'](_0x1eed8e['shift']());}};_0x564f41(++_0xe05364);}(_0xc058,0x1c6));var _0x8c05=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xc058[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x8c05('0x0'));var util=require(_0x8c05('0x1'));var logger=require(_0x8c05('0x2'))(_0x8c05('0x3'));var moment=require('moment');var BPromise=require(_0x8c05('0x4'));var rp=require(_0x8c05('0x5'));var fs=require('fs');var path=require(_0x8c05('0x6'));var rimraf=require(_0x8c05('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c05('0x8'));module[_0x8c05('0x9')]=function(_0x38a0c2,_0x1639f6){return _0x38a0c2[_0x8c05('0xa')](_0x8c05('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x8c05('0xc'),_0x8c05('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 cb6f52f..de5c66a 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 _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xca115,_0x3bc5ae){var _0x405361=function(_0x3a5856){while(--_0x3a5856){_0xca115['push'](_0xca115['shift']());}};_0x405361(++_0x3bc5ae);}(_0xdd0c,0x165));var _0xcdd0=function(_0x59db8f,_0x4c911c){_0x59db8f=_0x59db8f-0x0;var _0x2c3a68=_0xdd0c[_0x59db8f];return _0x2c3a68;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file +var _0x19ea=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x96a5a5,_0x556806){var _0xdbab27=function(_0x337177){while(--_0x337177){_0x96a5a5['push'](_0x96a5a5['shift']());}};_0xdbab27(++_0x556806);}(_0x19ea,0xfe));var _0xa19e=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x19ea[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7943671..23ccc67 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 _0xd115=['connect-timeout','Router','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x57408b,_0xb7cbc5){var _0x31a897=function(_0x5810ac){while(--_0x5810ac){_0x57408b['push'](_0x57408b['shift']());}};_0x31a897(++_0xb7cbc5);}(_0xd115,0x9e));var _0x5d11=function(_0x1760a9,_0x2832cd){_0x1760a9=_0x1760a9-0x0;var _0x48c82e=_0xd115[_0x1760a9];return _0x48c82e;};'use strict';var multer=require(_0x5d11('0x0'));var util=require(_0x5d11('0x1'));var path=require('path');var timeout=require(_0x5d11('0x2'));var express=require('express');var router=express[_0x5d11('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5d11('0x4'));var config=require('../../config/environment');var controller=require(_0x5d11('0x5'));router[_0x5d11('0x6')]('/',auth[_0x5d11('0x7')](),controller['index']);router['get'](_0x5d11('0x8'),auth['isAuthenticated'](),controller[_0x5d11('0x9')]);router[_0x5d11('0x6')](_0x5d11('0xa'),auth['isAuthenticated'](),controller[_0x5d11('0xb')]);router[_0x5d11('0x6')]('/:id/fields',auth[_0x5d11('0x7')](),controller[_0x5d11('0xc')]);router[_0x5d11('0xd')]('/',auth[_0x5d11('0x7')](),controller[_0x5d11('0xe')]);router[_0x5d11('0xd')](_0x5d11('0xa'),auth[_0x5d11('0x7')](),controller['addConfiguration']);router[_0x5d11('0xf')](_0x5d11('0x8'),auth[_0x5d11('0x7')](),controller[_0x5d11('0x10')]);router[_0x5d11('0x11')](_0x5d11('0x8'),auth['isAuthenticated'](),controller[_0x5d11('0x12')]);module[_0x5d11('0x13')]=router; \ No newline at end of file +var _0x8143=['../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x8143,0x1f4));var _0x3814=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8143[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x3814('0x0'));var util=require(_0x3814('0x1'));var path=require('path');var timeout=require(_0x3814('0x2'));var express=require(_0x3814('0x3'));var router=express[_0x3814('0x4')]();var auth=require(_0x3814('0x5'));var interaction=require(_0x3814('0x6'));var config=require(_0x3814('0x7'));var controller=require(_0x3814('0x8'));router[_0x3814('0x9')]('/',auth[_0x3814('0xa')](),controller['index']);router[_0x3814('0x9')]('/:id',auth[_0x3814('0xa')](),controller[_0x3814('0xb')]);router[_0x3814('0x9')]('/:id/configurations',auth[_0x3814('0xa')](),controller[_0x3814('0xc')]);router['get']('/:id/fields',auth[_0x3814('0xa')](),controller[_0x3814('0xd')]);router['post']('/',auth[_0x3814('0xa')](),controller[_0x3814('0xe')]);router[_0x3814('0xf')](_0x3814('0x10'),auth[_0x3814('0xa')](),controller[_0x3814('0x11')]);router['put'](_0x3814('0x12'),auth[_0x3814('0xa')](),controller[_0x3814('0x13')]);router[_0x3814('0x14')](_0x3814('0x12'),auth[_0x3814('0xa')](),controller['destroy']);module[_0x3814('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 2ffda4b..ee18a6c 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 _0x072d=['ENUM','integrationTab','newTab','sequelize','STRING','username'];(function(_0x2ce877,_0x2f24d7){var _0x40a0ba=function(_0x479f73){while(--_0x479f73){_0x2ce877['push'](_0x2ce877['shift']());}};_0x40a0ba(++_0x2f24d7);}(_0x072d,0x105));var _0xd072=function(_0x11c8eb,_0x1ddaf6){_0x11c8eb=_0x11c8eb-0x0;var _0x1dea92=_0x072d[_0x11c8eb];return _0x1dea92;};'use strict';var Sequelize=require(_0xd072('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd072('0x1')],'unique':_0xd072('0x2')},'remoteUri':{'type':Sequelize[_0xd072('0x1')]},'password':{'type':Sequelize[_0xd072('0x1')]},'clientId':{'type':Sequelize[_0xd072('0x1')]},'clientSecret':{'type':Sequelize[_0xd072('0x1')]},'securityToken':{'type':Sequelize[_0xd072('0x1')]},'serverUrl':{'type':Sequelize[_0xd072('0x1')]},'type':{'type':Sequelize[_0xd072('0x3')](_0xd072('0x4'),_0xd072('0x5')),'defaultValue':_0xd072('0x4')}}; \ No newline at end of file +var _0xa63e=['username','integrationTab','newTab','exports','STRING'];(function(_0x5af84b,_0x9ee7d9){var _0x4845dd=function(_0x589c1f){while(--_0x589c1f){_0x5af84b['push'](_0x5af84b['shift']());}};_0x4845dd(++_0x9ee7d9);}(_0xa63e,0xda));var _0xea63=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa63e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xea63('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea63('0x1')]},'username':{'type':Sequelize[_0xea63('0x1')],'unique':_0xea63('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xea63('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xea63('0x1')]},'securityToken':{'type':Sequelize[_0xea63('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xea63('0x3'),_0xea63('0x4')),'defaultValue':_0xea63('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d2fe896..fe7e356 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 _0x4156=['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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','send','index','SalesforceAccount','rawAttributes','model','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','field','filter','options','count','includeAll','rows','params','keys','intersection','fields','include','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','length','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','clientId','clientSecret','password','securityToken','remoteUri','slice','substring','lastIndexOf','login','username','concat','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','isNil','Origin','Reason','IsEscalated','SuppliedName','remove','custom','includes','name','label','value','boolean','True','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test'];(function(_0x1e892f,_0x2512de){var _0x5e693e=function(_0x4c03fc){while(--_0x4c03fc){_0x1e892f['push'](_0x1e892f['shift']());}};_0x5e693e(++_0x2512de);}(_0x4156,0xf1));var _0x6415=function(_0x3ec201,_0x3979ad){_0x3ec201=_0x3ec201-0x0;var _0x2dc7c5=_0x4156[_0x3ec201];return _0x2dc7c5;};'use strict';var pdf=require(_0x6415('0x0'));var emlformat=require(_0x6415('0x1'));var rimraf=require(_0x6415('0x2'));var zipdir=require(_0x6415('0x3'));var jsonpatch=require(_0x6415('0x4'));var rp=require('request-promise');var moment=require(_0x6415('0x5'));var BPromise=require(_0x6415('0x6'));var Mustache=require(_0x6415('0x7'));var util=require(_0x6415('0x8'));var path=require(_0x6415('0x9'));var sox=require(_0x6415('0xa'));var csv=require(_0x6415('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6415('0xc'));var squel=require('squel');var crypto=require(_0x6415('0xd'));var jsforce=require(_0x6415('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6415('0xb'));var querystring=require(_0x6415('0xf'));var Papa=require(_0x6415('0x10'));var Redis=require(_0x6415('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6415('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6415('0x13'));var utils=require(_0x6415('0x14'));var config=require(_0x6415('0x15'));var db=require(_0x6415('0x16'))['db'];var integrations=require(_0x6415('0x17'));var jayson=require(_0x6415('0x18'));var client=jayson[_0x6415('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x5b3493,_0x8e7067,_0x49d6b7){if(_0x49d6b7){var _0x2a4d5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a4d5c[_0x6415('0x1a')](_0x8e7067)){return _0x5b3493;}else{throw new Error(_0x6415('0x1b'));}}else{return _0x5b3493;}}function respondWithRpcPromise(_0x5b2a26,_0x52165c,_0x2389e4,_0x780643){return new BPromise(function(_0x48017d,_0x1d540c){var _0x41f9b0=_0x780643||client;return _0x41f9b0['request'](_0x5b2a26,_0x2389e4)['then'](function(_0x352a04){logger[_0x6415('0x1c')](_0x6415('0x1d'),_0x52165c,_0x6415('0x1e'));logger[_0x6415('0x1f')](_0x6415('0x20'),_0x52165c,_0x6415('0x1e'),JSON[_0x6415('0x21')](_0x352a04));if(_0x352a04[_0x6415('0x22')]){if(_0x352a04['error']['code']===0x1f4){logger['error'](_0x6415('0x1d'),_0x52165c,_0x352a04[_0x6415('0x22')][_0x6415('0x23')]);return _0x1d540c(_0x352a04[_0x6415('0x22')]['message']);}logger[_0x6415('0x22')](_0x6415('0x1d'),_0x52165c,_0x352a04[_0x6415('0x22')]['message']);return _0x48017d(_0x352a04[_0x6415('0x22')][_0x6415('0x23')]);}else{logger[_0x6415('0x1c')](_0x6415('0x1d'),_0x52165c,_0x6415('0x1e'));_0x48017d(_0x352a04[_0x6415('0x24')][_0x6415('0x23')]);}})[_0x6415('0x25')](function(_0x1496c1){logger['error'](_0x6415('0x1d'),_0x52165c,_0x1496c1);_0x1d540c(_0x1496c1);});});}function respondWithStatusCode(_0xa1f297,_0x53646e){_0x53646e=_0x53646e||0xcc;return function(_0x15be31){if(_0x15be31){return _0xa1f297[_0x6415('0x26')](_0x53646e);}return _0xa1f297[_0x6415('0x27')](_0x53646e)[_0x6415('0x28')]();};}function respondWithResult(_0x31dabc,_0x5b5f39){_0x5b5f39=_0x5b5f39||0xc8;return function(_0x30d857){if(_0x30d857){return _0x31dabc['status'](_0x5b5f39)[_0x6415('0x29')](_0x30d857);}};}function respondWithFilteredResult(_0xbe3a32,_0x25d459){return function(_0x4d66d0){if(_0x4d66d0){var _0x4dea9d=_0x4d66d0['count'],_0x514f51=_0x25d459['offset'],_0x61e827=_0x25d459[_0x6415('0x2a')]+_0x25d459[_0x6415('0x2b')],_0x31f717;if(_0x61e827>=_0x4dea9d){_0x61e827=_0x4dea9d;_0x31f717=0xc8;}else{_0x31f717=0xce;}_0xbe3a32[_0x6415('0x27')](_0x31f717);return _0xbe3a32[_0x6415('0x2c')](_0x6415('0x2d'),_0x514f51+'-'+_0x61e827+'/'+_0x4dea9d)[_0x6415('0x29')](_0x4d66d0);}return null;};}function patchUpdates(_0x5b15fd){return function(_0xeb5401){try{jsonpatch[_0x6415('0x2e')](_0xeb5401,_0x5b15fd,!![]);}catch(_0x900b7b){return BPromise[_0x6415('0x2f')](_0x900b7b);}return _0xeb5401['save']();};}function saveUpdates(_0x4fc558,_0x5681aa){return function(_0x2bd0db){if(_0x2bd0db){return _0x2bd0db['update'](_0x4fc558)[_0x6415('0x30')](function(_0x51253e){return _0x51253e;});}return null;};}function removeEntity(_0x1ee01f,_0x272432){return function(_0x31bf7b){if(_0x31bf7b){return _0x31bf7b[_0x6415('0x31')]()['then'](function(){_0x1ee01f['status'](0xcc)[_0x6415('0x28')]();});}};}function handleEntityNotFound(_0x40d7b7,_0x87d807){return function(_0x2cd321){if(!_0x2cd321){_0x40d7b7[_0x6415('0x26')](0x194);}return _0x2cd321;};}function handleError(_0x143163,_0x551dda){_0x551dda=_0x551dda||0x1f4;return function(_0x2a5f9a){logger['error'](_0x2a5f9a['stack']);if(_0x2a5f9a['name']){delete _0x2a5f9a['name'];}_0x143163[_0x6415('0x27')](_0x551dda)[_0x6415('0x32')](_0x2a5f9a);};}exports[_0x6415('0x33')]=function(_0x49e7a8,_0x29223d){var _0x1cdaec={},_0x4ebbca={},_0x25dd54={'count':0x0,'rows':[]};var _0xa3a985=db[_0x6415('0x34')][_0x6415('0x35')];_0x4ebbca[_0x6415('0x36')]=_['keys'](_0xa3a985);_0x4ebbca[_0x6415('0x37')]=_['keys'](_0x49e7a8[_0x6415('0x37')]);_0x4ebbca[_0x6415('0x38')]=_['intersection'](_0x4ebbca[_0x6415('0x36')],_0x4ebbca[_0x6415('0x37')]);_0x1cdaec['attributes']=_['intersection'](_0x4ebbca[_0x6415('0x36')],qs['fields'](_0x49e7a8[_0x6415('0x37')]['fields']));_0x1cdaec[_0x6415('0x39')]=_0x1cdaec[_0x6415('0x39')]['length']?_0x1cdaec[_0x6415('0x39')]:_0x4ebbca['model'];if(!_0x49e7a8[_0x6415('0x37')][_0x6415('0x3a')](_0x6415('0x3b'))){_0x1cdaec[_0x6415('0x2b')]=qs[_0x6415('0x2b')](_0x49e7a8[_0x6415('0x37')][_0x6415('0x2b')]);_0x1cdaec[_0x6415('0x2a')]=qs[_0x6415('0x2a')](_0x49e7a8[_0x6415('0x37')][_0x6415('0x2a')]);}_0x1cdaec[_0x6415('0x3c')]=qs[_0x6415('0x3d')](_0x49e7a8[_0x6415('0x37')][_0x6415('0x3d')]);_0x1cdaec[_0x6415('0x3e')]=qs[_0x6415('0x38')](_[_0x6415('0x3f')](_0x49e7a8[_0x6415('0x37')],_0x4ebbca['filters']));if(_0x49e7a8[_0x6415('0x37')]['filter']){_0x1cdaec[_0x6415('0x3e')]=_[_0x6415('0x40')](_0x1cdaec['where'],{'$or':_[_0x6415('0x41')](_0xa3a985,function(_0x122eca){if(_0x122eca[_0x6415('0x42')][_0x6415('0x43')]!=='VIRTUAL'){var _0x4c0340={};_0x4c0340[_0x122eca[_0x6415('0x44')]]={'$like':'%'+_0x49e7a8['query'][_0x6415('0x45')]+'%'};return _0x4c0340;}})});}_0x1cdaec=_['merge']({},_0x1cdaec,_0x49e7a8[_0x6415('0x46')]);var _0x198f24={'where':_0x1cdaec[_0x6415('0x3e')]};return db[_0x6415('0x34')][_0x6415('0x47')](_0x198f24)[_0x6415('0x30')](function(_0xba2047){_0x25dd54['count']=_0xba2047;if(_0x49e7a8[_0x6415('0x37')][_0x6415('0x48')]){_0x1cdaec['include']=[{'all':!![]}];}return db[_0x6415('0x34')]['findAll'](_0x1cdaec);})[_0x6415('0x30')](function(_0xf14291){_0x25dd54[_0x6415('0x49')]=_0xf14291;return _0x25dd54;})[_0x6415('0x30')](respondWithFilteredResult(_0x29223d,_0x1cdaec))[_0x6415('0x25')](handleError(_0x29223d,null));};exports['show']=function(_0x3894d8,_0x4d9708){var _0x3782a0={'raw':![],'where':{'id':_0x3894d8[_0x6415('0x4a')]['id']}},_0x462348={};_0x462348[_0x6415('0x36')]=_['keys'](db[_0x6415('0x34')]['rawAttributes']);_0x462348[_0x6415('0x37')]=_[_0x6415('0x4b')](_0x3894d8['query']);_0x462348[_0x6415('0x38')]=_[_0x6415('0x4c')](_0x462348[_0x6415('0x36')],_0x462348['query']);_0x3782a0[_0x6415('0x39')]=_[_0x6415('0x4c')](_0x462348[_0x6415('0x36')],qs[_0x6415('0x4d')](_0x3894d8[_0x6415('0x37')][_0x6415('0x4d')]));_0x3782a0[_0x6415('0x39')]=_0x3782a0[_0x6415('0x39')]['length']?_0x3782a0[_0x6415('0x39')]:_0x462348[_0x6415('0x36')];if(_0x3894d8[_0x6415('0x37')][_0x6415('0x48')]){_0x3782a0[_0x6415('0x4e')]=[{'all':!![]}];}_0x3782a0=_['merge']({},_0x3782a0,_0x3894d8[_0x6415('0x46')]);return db[_0x6415('0x34')][_0x6415('0x4f')](_0x3782a0)[_0x6415('0x30')](handleEntityNotFound(_0x4d9708,null))[_0x6415('0x30')](respondWithResult(_0x4d9708,null))[_0x6415('0x25')](handleError(_0x4d9708,null));};exports[_0x6415('0x50')]=function(_0x385a97,_0x54cb7c){return db[_0x6415('0x34')]['create'](_0x385a97[_0x6415('0x51')],{})[_0x6415('0x30')](respondWithResult(_0x54cb7c,0xc9))[_0x6415('0x25')](handleError(_0x54cb7c,null));};exports[_0x6415('0x52')]=function(_0x2ccaf3,_0x5acdee){if(_0x2ccaf3[_0x6415('0x51')]['id']){delete _0x2ccaf3[_0x6415('0x51')]['id'];}return db[_0x6415('0x34')]['find']({'where':{'id':_0x2ccaf3[_0x6415('0x4a')]['id']}})[_0x6415('0x30')](handleEntityNotFound(_0x5acdee,null))[_0x6415('0x30')](saveUpdates(_0x2ccaf3[_0x6415('0x51')],null))[_0x6415('0x30')](respondWithResult(_0x5acdee,null))[_0x6415('0x25')](handleError(_0x5acdee,null));};exports['destroy']=function(_0x1c5481,_0x4a0fc1){return db[_0x6415('0x34')][_0x6415('0x4f')]({'where':{'id':_0x1c5481['params']['id']}})[_0x6415('0x30')](handleEntityNotFound(_0x4a0fc1,null))[_0x6415('0x30')](removeEntity(_0x4a0fc1,null))[_0x6415('0x25')](handleError(_0x4a0fc1,null));};exports[_0x6415('0x53')]=function(_0x3fc55d,_0xa1ab22,_0x498d88){var _0x461f58={};var _0x2837e7={};var _0x3a1b9e;var _0x411927;return db[_0x6415('0x34')][_0x6415('0x54')]({'where':{'id':_0x3fc55d[_0x6415('0x4a')]['id']}})[_0x6415('0x30')](handleEntityNotFound(_0xa1ab22,null))[_0x6415('0x30')](function(_0x5f4d04){if(_0x5f4d04){_0x3a1b9e=_0x5f4d04;_0x2837e7['model']=_[_0x6415('0x4b')](db[_0x6415('0x55')]['rawAttributes']);_0x2837e7[_0x6415('0x37')]=_[_0x6415('0x4b')](_0x3fc55d[_0x6415('0x37')]);_0x2837e7[_0x6415('0x38')]=_[_0x6415('0x4c')](_0x2837e7['model'],_0x2837e7[_0x6415('0x37')]);_0x461f58['attributes']=_[_0x6415('0x4c')](_0x2837e7[_0x6415('0x36')],qs['fields'](_0x3fc55d[_0x6415('0x37')][_0x6415('0x4d')]));_0x461f58[_0x6415('0x39')]=_0x461f58[_0x6415('0x39')][_0x6415('0x56')]?_0x461f58[_0x6415('0x39')]:_0x2837e7[_0x6415('0x36')];_0x461f58['order']=qs['sort'](_0x3fc55d[_0x6415('0x37')][_0x6415('0x3d')]);_0x461f58[_0x6415('0x3e')]=qs[_0x6415('0x38')](_['pick'](_0x3fc55d[_0x6415('0x37')],_0x2837e7['filters']));if(_0x3fc55d[_0x6415('0x37')][_0x6415('0x45')]){_0x461f58[_0x6415('0x3e')]=_[_0x6415('0x40')](_0x461f58[_0x6415('0x3e')],{'$or':_[_0x6415('0x41')](_0x461f58[_0x6415('0x39')],function(_0x2d0ef7){var _0x21f027={};_0x21f027[_0x2d0ef7]={'$like':'%'+_0x3fc55d[_0x6415('0x37')][_0x6415('0x45')]+'%'};return _0x21f027;})});}_0x461f58=_[_0x6415('0x40')]({},_0x461f58,_0x3fc55d[_0x6415('0x46')]);return _0x3a1b9e[_0x6415('0x53')](_0x461f58);}})[_0x6415('0x30')](function(_0x1ba608){if(_0x1ba608){_0x411927=_0x1ba608[_0x6415('0x56')];if(!_0x3fc55d[_0x6415('0x37')][_0x6415('0x3a')](_0x6415('0x3b'))){_0x461f58[_0x6415('0x2b')]=qs[_0x6415('0x2b')](_0x3fc55d[_0x6415('0x37')]['limit']);_0x461f58[_0x6415('0x2a')]=qs['offset'](_0x3fc55d['query'][_0x6415('0x2a')]);}return _0x3a1b9e['getConfigurations'](_0x461f58);}})['then'](function(_0x2cadf8){if(_0x2cadf8){return _0x2cadf8?{'count':_0x411927,'rows':_0x2cadf8}:null;}})[_0x6415('0x30')](respondWithResult(_0xa1ab22,null))[_0x6415('0x25')](handleError(_0xa1ab22,null));};exports['addConfiguration']=function(_0x186ff4,_0x1fcaf6,_0x2e0a91){if(_0x186ff4['body']['id']){delete _0x186ff4['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x186ff4[_0x6415('0x4a')]['id']}})[_0x6415('0x30')](handleEntityNotFound(_0x1fcaf6,null))[_0x6415('0x30')](function(_0x5a49a5){if(_0x5a49a5){_0x186ff4['body'][_0x6415('0x57')]=_0x5a49a5['id'];_0x186ff4[_0x6415('0x51')][_0x6415('0x58')]=integrations[_0x6415('0x59')](_0x186ff4[_0x6415('0x51')][_0x6415('0x5a')],_0x186ff4['body'][_0x6415('0x42')]);_0x186ff4[_0x6415('0x51')]['Descriptions']=integrations['getDescriptions'](_0x186ff4[_0x6415('0x51')][_0x6415('0x5a')],_0x186ff4[_0x6415('0x51')]['type']);return db[_0x6415('0x55')][_0x6415('0x50')](_0x186ff4[_0x6415('0x51')],{'include':[{'model':db[_0x6415('0x5b')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x6415('0x5c')}]});}return null;})['then'](respondWithResult(_0x1fcaf6,null))[_0x6415('0x25')](handleError(_0x1fcaf6,null));};exports[_0x6415('0x5d')]=function(_0xbb822e,_0x3e56bb,_0x4d4993){var _0x5909f2;var _0x455ddd='';var _0x40788b=_0x6415('0x5e');return db['SalesforceAccount'][_0x6415('0x54')]({'where':{'id':_0xbb822e[_0x6415('0x4a')]['id']},'attributes':['id','remoteUri',_0x6415('0x5f'),_0x6415('0x60'),'username',_0x6415('0x61'),_0x6415('0x62')]})[_0x6415('0x30')](handleEntityNotFound(_0x3e56bb,null))['then'](function(_0x3182e0){if(_0x3182e0){_0x455ddd=_0x3182e0[_0x6415('0x63')];var _0x483094=_0x455ddd[_0x6415('0x64')](-0x1);if(_0x483094==='/'){_0x455ddd=_0x455ddd[_0x6415('0x65')](0x0,_0x455ddd[_0x6415('0x66')](_0x483094));}_0x5909f2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x455ddd,'clientId':_0x3182e0[_0x6415('0x5f')],'clientSecret':_0x3182e0[_0x6415('0x60')]}});return _0x5909f2[_0x6415('0x67')](_0x3182e0[_0x6415('0x68')],_0x3182e0[_0x6415('0x61')][_0x6415('0x69')](_0x3182e0[_0x6415('0x62')]));}})[_0x6415('0x30')](function(_0x347a7f){if(_0x347a7f){if(!_['isNil'](_0xbb822e[_0x6415('0x37')][_0x6415('0x6a')])){_0x40788b=_0xbb822e[_0x6415('0x37')][_0x6415('0x6a')];}return _0x5909f2[_0x6415('0x6b')](_0x40788b)[_0x6415('0x6c')]();}})[_0x6415('0x30')](function(_0x206e92){var _0x39ab8c=['CallDisposition',_0x6415('0x6d'),_0x6415('0x6e'),_0x6415('0x6f'),_0x6415('0x70'),_0x6415('0x71'),_0x6415('0x72'),_0x6415('0x73')];if(!_[_0x6415('0x74')](_0xbb822e[_0x6415('0x37')][_0x6415('0x6a')])&&_0xbb822e[_0x6415('0x37')]['ticketType']==='Case'){_0x39ab8c=[_0x6415('0x73'),_0x6415('0x75'),_0x6415('0x76'),_0x6415('0x72'),_0x6415('0x71'),_0x6415('0x77'),_0x6415('0x78'),'SuppliedCompany'];}if(_0x206e92){_[_0x6415('0x79')](_0x206e92['fields'],function(_0x599765){return _0x599765[_0x6415('0x7a')]===![]&&!_0x39ab8c[_0x6415('0x7b')](_0x599765[_0x6415('0x7c')]);});return{'count':_0x206e92[_0x6415('0x4d')]['length'],'rows':_['map'](_0x206e92['fields'],function(_0x3b9661){return{'id':_0x3b9661[_0x6415('0x7c')],'name':_0x3b9661[_0x6415('0x7d')],'custom':_0x3b9661[_0x6415('0x7a')],'options':_0x3b9661['picklistValues'][_0x6415('0x56')]>0x0?_[_0x6415('0x41')](_0x3b9661['picklistValues'],function(_0x485f9c){return{'name':_0x485f9c['label'],'value':_0x485f9c[_0x6415('0x7e')]};}):_0x3b9661[_0x6415('0x42')]==_0x6415('0x7f')?[{'name':_0x6415('0x80'),'value':'true'},{'name':_0x6415('0x81'),'value':_0x6415('0x82')}]:[]};})};}})[_0x6415('0x30')](respondWithResult(_0x3e56bb,null))['catch'](function(_0x26daf1){var _0x3bbaaa=_0xbb822e[_0x6415('0x37')]['test']?0x1f4:_0x26daf1[_0x6415('0x83')]||0x1f4;logger[_0x6415('0x22')](_0x6415('0x84'),_0x6415('0x5d'),_0x3bbaaa,JSON['stringify'](_0x26daf1));delete _0x26daf1[_0x6415('0x7c')];if(_0x3bbaaa===0x191){_0x3bbaaa=0x190;}_0x3e56bb[_0x6415('0x27')](_0x3bbaaa)[_0x6415('0x32')](_0xbb822e[_0x6415('0x37')][_0x6415('0x1a')]?{'message':_0x6415('0x85'),'statusCode':_0x26daf1[_0x6415('0x83')]}:_0x26daf1);});}; \ No newline at end of file +var _0x4986=['test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','Content-Range','update','sendStatus','stack','name','index','SalesforceAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','key','VIRTUAL','includeAll','findAll','show','params','length','include','options','find','create','body','destroy','findOne','SalesforceConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0x13393c,_0x5c5ca0){var _0x2ecbe7=function(_0x3d6d7c){while(--_0x3d6d7c){_0x13393c['push'](_0x13393c['shift']());}};_0x2ecbe7(++_0x5c5ca0);}(_0x4986,0x6e));var _0x6498=function(_0xfdbdd5,_0x3d9191){_0xfdbdd5=_0xfdbdd5-0x0;var _0xab1705=_0x4986[_0xfdbdd5];return _0xab1705;};'use strict';var pdf=require(_0x6498('0x0'));var emlformat=require(_0x6498('0x1'));var rimraf=require(_0x6498('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6498('0x3'));var moment=require(_0x6498('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6498('0x5'));var util=require(_0x6498('0x6'));var path=require(_0x6498('0x7'));var sox=require(_0x6498('0x8'));var csv=require(_0x6498('0x9'));var ejs=require(_0x6498('0xa'));var fs=require('fs');var _=require(_0x6498('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6498('0xc'));var deskjs=require(_0x6498('0xd'));var toCsv=require(_0x6498('0x9'));var querystring=require(_0x6498('0xe'));var Papa=require(_0x6498('0xf'));var Redis=require('ioredis');var authService=require(_0x6498('0x10'));var qs=require(_0x6498('0x11'));var hardwareService=require(_0x6498('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6498('0x13'));var config=require('../../config/environment');var db=require(_0x6498('0x14'))['db'];var integrations=require(_0x6498('0x15'));var jayson=require(_0x6498('0x16'));var client=jayson[_0x6498('0x17')][_0x6498('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3771b1,_0x45b86e,_0x4eaf5d){if(_0x4eaf5d){var _0x5e1e56=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e1e56[_0x6498('0x19')](_0x45b86e)){return _0x3771b1;}else{throw new Error(_0x6498('0x1a'));}}else{return _0x3771b1;}}function respondWithRpcPromise(_0x3ae8e5,_0x3a076f,_0x1d49ef,_0x59833d){return new BPromise(function(_0x318b75,_0x2ab98d){var _0x172b0e=_0x59833d||client;return _0x172b0e[_0x6498('0x1b')](_0x3ae8e5,_0x1d49ef)[_0x6498('0x1c')](function(_0x1b4083){logger[_0x6498('0x1d')]('SalesforceAccount,\x20%s,\x20%s',_0x3a076f,_0x6498('0x1e'));logger[_0x6498('0x1f')](_0x6498('0x20'),_0x3a076f,_0x6498('0x1e'),JSON[_0x6498('0x21')](_0x1b4083));if(_0x1b4083['error']){if(_0x1b4083['error'][_0x6498('0x22')]===0x1f4){logger[_0x6498('0x23')](_0x6498('0x24'),_0x3a076f,_0x1b4083[_0x6498('0x23')][_0x6498('0x25')]);return _0x2ab98d(_0x1b4083[_0x6498('0x23')][_0x6498('0x25')]);}logger[_0x6498('0x23')](_0x6498('0x24'),_0x3a076f,_0x1b4083[_0x6498('0x23')][_0x6498('0x25')]);return _0x318b75(_0x1b4083[_0x6498('0x23')][_0x6498('0x25')]);}else{logger[_0x6498('0x1d')]('SalesforceAccount,\x20%s,\x20%s',_0x3a076f,'request\x20sent');_0x318b75(_0x1b4083[_0x6498('0x26')]['message']);}})[_0x6498('0x27')](function(_0x30d261){logger[_0x6498('0x23')](_0x6498('0x24'),_0x3a076f,_0x30d261);_0x2ab98d(_0x30d261);});});}function respondWithStatusCode(_0x4dcead,_0x5b6007){_0x5b6007=_0x5b6007||0xcc;return function(_0x43b1d2){if(_0x43b1d2){return _0x4dcead['sendStatus'](_0x5b6007);}return _0x4dcead[_0x6498('0x28')](_0x5b6007)[_0x6498('0x29')]();};}function respondWithResult(_0x41d43f,_0x271048){_0x271048=_0x271048||0xc8;return function(_0x1ce28d){if(_0x1ce28d){return _0x41d43f[_0x6498('0x28')](_0x271048)[_0x6498('0x2a')](_0x1ce28d);}};}function respondWithFilteredResult(_0x26f01f,_0x119790){return function(_0x2213a4){if(_0x2213a4){var _0x660782=_0x2213a4[_0x6498('0x2b')],_0x3c80da=_0x119790[_0x6498('0x2c')],_0x64df19=_0x119790['offset']+_0x119790['limit'],_0x4be06f;if(_0x64df19>=_0x660782){_0x64df19=_0x660782;_0x4be06f=0xc8;}else{_0x4be06f=0xce;}_0x26f01f['status'](_0x4be06f);return _0x26f01f['set'](_0x6498('0x2d'),_0x3c80da+'-'+_0x64df19+'/'+_0x660782)[_0x6498('0x2a')](_0x2213a4);}return null;};}function patchUpdates(_0xd17dab){return function(_0x2696f9){try{jsonpatch['apply'](_0x2696f9,_0xd17dab,!![]);}catch(_0x46b361){return BPromise['reject'](_0x46b361);}return _0x2696f9['save']();};}function saveUpdates(_0x49c4fd,_0x565975){return function(_0x28bac3){if(_0x28bac3){return _0x28bac3[_0x6498('0x2e')](_0x49c4fd)['then'](function(_0x40618c){return _0x40618c;});}return null;};}function removeEntity(_0x541271,_0x420bb3){return function(_0x23c651){if(_0x23c651){return _0x23c651['destroy']()['then'](function(){_0x541271[_0x6498('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x327a42,_0x12fdb6){return function(_0x5d3de5){if(!_0x5d3de5){_0x327a42[_0x6498('0x2f')](0x194);}return _0x5d3de5;};}function handleError(_0x52ef6c,_0xd0b96d){_0xd0b96d=_0xd0b96d||0x1f4;return function(_0x340827){logger[_0x6498('0x23')](_0x340827[_0x6498('0x30')]);if(_0x340827[_0x6498('0x31')]){delete _0x340827[_0x6498('0x31')];}_0x52ef6c[_0x6498('0x28')](_0xd0b96d)['send'](_0x340827);};}exports[_0x6498('0x32')]=function(_0x5b340e,_0x2548b8){var _0x5b5089={},_0x12c2c4={},_0x50179d={'count':0x0,'rows':[]};var _0x2411ee=db[_0x6498('0x33')][_0x6498('0x34')];_0x12c2c4[_0x6498('0x35')]=_[_0x6498('0x36')](_0x2411ee);_0x12c2c4[_0x6498('0x37')]=_[_0x6498('0x36')](_0x5b340e['query']);_0x12c2c4[_0x6498('0x38')]=_[_0x6498('0x39')](_0x12c2c4[_0x6498('0x35')],_0x12c2c4[_0x6498('0x37')]);_0x5b5089[_0x6498('0x3a')]=_[_0x6498('0x39')](_0x12c2c4[_0x6498('0x35')],qs[_0x6498('0x3b')](_0x5b340e['query'][_0x6498('0x3b')]));_0x5b5089[_0x6498('0x3a')]=_0x5b5089[_0x6498('0x3a')]['length']?_0x5b5089[_0x6498('0x3a')]:_0x12c2c4[_0x6498('0x35')];if(!_0x5b340e[_0x6498('0x37')][_0x6498('0x3c')](_0x6498('0x3d'))){_0x5b5089[_0x6498('0x3e')]=qs[_0x6498('0x3e')](_0x5b340e[_0x6498('0x37')][_0x6498('0x3e')]);_0x5b5089[_0x6498('0x2c')]=qs[_0x6498('0x2c')](_0x5b340e[_0x6498('0x37')]['offset']);}_0x5b5089['order']=qs['sort'](_0x5b340e[_0x6498('0x37')][_0x6498('0x3f')]);_0x5b5089[_0x6498('0x40')]=qs[_0x6498('0x38')](_[_0x6498('0x41')](_0x5b340e[_0x6498('0x37')],_0x12c2c4[_0x6498('0x38')]));if(_0x5b340e['query'][_0x6498('0x42')]){_0x5b5089[_0x6498('0x40')]=_[_0x6498('0x43')](_0x5b5089[_0x6498('0x40')],{'$or':_[_0x6498('0x44')](_0x2411ee,function(_0x3bc9ca){if(_0x3bc9ca['type'][_0x6498('0x45')]!==_0x6498('0x46')){var _0x482be7={};_0x482be7[_0x3bc9ca['field']]={'$like':'%'+_0x5b340e[_0x6498('0x37')][_0x6498('0x42')]+'%'};return _0x482be7;}})});}_0x5b5089=_[_0x6498('0x43')]({},_0x5b5089,_0x5b340e['options']);var _0x4fb005={'where':_0x5b5089[_0x6498('0x40')]};return db['SalesforceAccount'][_0x6498('0x2b')](_0x4fb005)[_0x6498('0x1c')](function(_0x34e5b2){_0x50179d[_0x6498('0x2b')]=_0x34e5b2;if(_0x5b340e[_0x6498('0x37')][_0x6498('0x47')]){_0x5b5089['include']=[{'all':!![]}];}return db[_0x6498('0x33')][_0x6498('0x48')](_0x5b5089);})[_0x6498('0x1c')](function(_0x3d2d1f){_0x50179d['rows']=_0x3d2d1f;return _0x50179d;})[_0x6498('0x1c')](respondWithFilteredResult(_0x2548b8,_0x5b5089))[_0x6498('0x27')](handleError(_0x2548b8,null));};exports[_0x6498('0x49')]=function(_0x1a1fe2,_0x172076){var _0x1a498c={'raw':![],'where':{'id':_0x1a1fe2[_0x6498('0x4a')]['id']}},_0x74668c={};_0x74668c['model']=_[_0x6498('0x36')](db[_0x6498('0x33')][_0x6498('0x34')]);_0x74668c[_0x6498('0x37')]=_[_0x6498('0x36')](_0x1a1fe2[_0x6498('0x37')]);_0x74668c[_0x6498('0x38')]=_[_0x6498('0x39')](_0x74668c[_0x6498('0x35')],_0x74668c[_0x6498('0x37')]);_0x1a498c[_0x6498('0x3a')]=_[_0x6498('0x39')](_0x74668c[_0x6498('0x35')],qs[_0x6498('0x3b')](_0x1a1fe2[_0x6498('0x37')][_0x6498('0x3b')]));_0x1a498c[_0x6498('0x3a')]=_0x1a498c[_0x6498('0x3a')][_0x6498('0x4b')]?_0x1a498c[_0x6498('0x3a')]:_0x74668c[_0x6498('0x35')];if(_0x1a1fe2['query'][_0x6498('0x47')]){_0x1a498c[_0x6498('0x4c')]=[{'all':!![]}];}_0x1a498c=_[_0x6498('0x43')]({},_0x1a498c,_0x1a1fe2[_0x6498('0x4d')]);return db[_0x6498('0x33')][_0x6498('0x4e')](_0x1a498c)['then'](handleEntityNotFound(_0x172076,null))['then'](respondWithResult(_0x172076,null))[_0x6498('0x27')](handleError(_0x172076,null));};exports['create']=function(_0x458815,_0x14355b){return db[_0x6498('0x33')][_0x6498('0x4f')](_0x458815[_0x6498('0x50')],{})['then'](respondWithResult(_0x14355b,0xc9))[_0x6498('0x27')](handleError(_0x14355b,null));};exports[_0x6498('0x2e')]=function(_0x3ed025,_0x1bf245){if(_0x3ed025['body']['id']){delete _0x3ed025['body']['id'];}return db[_0x6498('0x33')]['find']({'where':{'id':_0x3ed025[_0x6498('0x4a')]['id']}})[_0x6498('0x1c')](handleEntityNotFound(_0x1bf245,null))[_0x6498('0x1c')](saveUpdates(_0x3ed025[_0x6498('0x50')],null))[_0x6498('0x1c')](respondWithResult(_0x1bf245,null))[_0x6498('0x27')](handleError(_0x1bf245,null));};exports[_0x6498('0x51')]=function(_0x11e978,_0x4dea24){return db[_0x6498('0x33')][_0x6498('0x4e')]({'where':{'id':_0x11e978[_0x6498('0x4a')]['id']}})[_0x6498('0x1c')](handleEntityNotFound(_0x4dea24,null))['then'](removeEntity(_0x4dea24,null))[_0x6498('0x27')](handleError(_0x4dea24,null));};exports['getConfigurations']=function(_0xb624b6,_0x4af617,_0x463127){var _0x1cd0d4={};var _0x4de80c={};var _0x4b75b0;var _0x49e066;return db[_0x6498('0x33')][_0x6498('0x52')]({'where':{'id':_0xb624b6['params']['id']}})[_0x6498('0x1c')](handleEntityNotFound(_0x4af617,null))[_0x6498('0x1c')](function(_0x5d5c8c){if(_0x5d5c8c){_0x4b75b0=_0x5d5c8c;_0x4de80c['model']=_[_0x6498('0x36')](db[_0x6498('0x53')][_0x6498('0x34')]);_0x4de80c[_0x6498('0x37')]=_[_0x6498('0x36')](_0xb624b6[_0x6498('0x37')]);_0x4de80c[_0x6498('0x38')]=_[_0x6498('0x39')](_0x4de80c[_0x6498('0x35')],_0x4de80c['query']);_0x1cd0d4['attributes']=_[_0x6498('0x39')](_0x4de80c[_0x6498('0x35')],qs['fields'](_0xb624b6[_0x6498('0x37')][_0x6498('0x3b')]));_0x1cd0d4[_0x6498('0x3a')]=_0x1cd0d4[_0x6498('0x3a')][_0x6498('0x4b')]?_0x1cd0d4[_0x6498('0x3a')]:_0x4de80c['model'];_0x1cd0d4['order']=qs['sort'](_0xb624b6[_0x6498('0x37')][_0x6498('0x3f')]);_0x1cd0d4['where']=qs[_0x6498('0x38')](_[_0x6498('0x41')](_0xb624b6[_0x6498('0x37')],_0x4de80c[_0x6498('0x38')]));if(_0xb624b6[_0x6498('0x37')][_0x6498('0x42')]){_0x1cd0d4[_0x6498('0x40')]=_[_0x6498('0x43')](_0x1cd0d4[_0x6498('0x40')],{'$or':_[_0x6498('0x44')](_0x1cd0d4['attributes'],function(_0x4496f0){var _0x2e8ed8={};_0x2e8ed8[_0x4496f0]={'$like':'%'+_0xb624b6['query']['filter']+'%'};return _0x2e8ed8;})});}_0x1cd0d4=_['merge']({},_0x1cd0d4,_0xb624b6['options']);return _0x4b75b0[_0x6498('0x54')](_0x1cd0d4);}})[_0x6498('0x1c')](function(_0x43296a){if(_0x43296a){_0x49e066=_0x43296a[_0x6498('0x4b')];if(!_0xb624b6['query'][_0x6498('0x3c')]('nolimit')){_0x1cd0d4[_0x6498('0x3e')]=qs[_0x6498('0x3e')](_0xb624b6[_0x6498('0x37')][_0x6498('0x3e')]);_0x1cd0d4[_0x6498('0x2c')]=qs[_0x6498('0x2c')](_0xb624b6[_0x6498('0x37')][_0x6498('0x2c')]);}return _0x4b75b0[_0x6498('0x54')](_0x1cd0d4);}})[_0x6498('0x1c')](function(_0x562263){if(_0x562263){return _0x562263?{'count':_0x49e066,'rows':_0x562263}:null;}})[_0x6498('0x1c')](respondWithResult(_0x4af617,null))[_0x6498('0x27')](handleError(_0x4af617,null));};exports['addConfiguration']=function(_0x4d6b2d,_0x521896,_0x25f50a){if(_0x4d6b2d[_0x6498('0x50')]['id']){delete _0x4d6b2d['body']['id'];}return db['SalesforceAccount'][_0x6498('0x52')]({'where':{'id':_0x4d6b2d[_0x6498('0x4a')]['id']}})[_0x6498('0x1c')](handleEntityNotFound(_0x521896,null))['then'](function(_0xb13dd0){if(_0xb13dd0){_0x4d6b2d[_0x6498('0x50')][_0x6498('0x55')]=_0xb13dd0['id'];_0x4d6b2d[_0x6498('0x50')][_0x6498('0x56')]=integrations[_0x6498('0x57')](_0x4d6b2d[_0x6498('0x50')][_0x6498('0x58')],_0x4d6b2d['body'][_0x6498('0x59')]);_0x4d6b2d[_0x6498('0x50')][_0x6498('0x5a')]=integrations[_0x6498('0x5b')](_0x4d6b2d['body'][_0x6498('0x58')],_0x4d6b2d[_0x6498('0x50')][_0x6498('0x59')]);return db['SalesforceConfiguration'][_0x6498('0x4f')](_0x4d6b2d[_0x6498('0x50')],{'include':[{'model':db[_0x6498('0x5c')],'as':_0x6498('0x56')},{'model':db[_0x6498('0x5c')],'as':_0x6498('0x5a')}]});}return null;})['then'](respondWithResult(_0x521896,null))[_0x6498('0x27')](handleError(_0x521896,null));};exports[_0x6498('0x5d')]=function(_0x1fc595,_0x5319d5,_0x154b28){var _0x154d27;var _0x4834fa='';var _0x27728e=_0x6498('0x5e');return db[_0x6498('0x33')][_0x6498('0x52')]({'where':{'id':_0x1fc595['params']['id']},'attributes':['id',_0x6498('0x5f'),_0x6498('0x60'),_0x6498('0x61'),_0x6498('0x62'),_0x6498('0x63'),_0x6498('0x64')]})[_0x6498('0x1c')](handleEntityNotFound(_0x5319d5,null))[_0x6498('0x1c')](function(_0x1f1bc7){if(_0x1f1bc7){_0x4834fa=_0x1f1bc7['remoteUri'];var _0x40f208=_0x4834fa[_0x6498('0x65')](-0x1);if(_0x40f208==='/'){_0x4834fa=_0x4834fa[_0x6498('0x66')](0x0,_0x4834fa[_0x6498('0x67')](_0x40f208));}_0x154d27=new jsforce[(_0x6498('0x68'))]({'oauth2':{'loginUrl':_0x4834fa,'clientId':_0x1f1bc7[_0x6498('0x60')],'clientSecret':_0x1f1bc7[_0x6498('0x61')]}});return _0x154d27[_0x6498('0x69')](_0x1f1bc7[_0x6498('0x62')],_0x1f1bc7[_0x6498('0x63')][_0x6498('0x6a')](_0x1f1bc7[_0x6498('0x64')]));}})[_0x6498('0x1c')](function(_0x410fff){if(_0x410fff){if(!_[_0x6498('0x6b')](_0x1fc595[_0x6498('0x37')][_0x6498('0x6c')])){_0x27728e=_0x1fc595[_0x6498('0x37')][_0x6498('0x6c')];}return _0x154d27[_0x6498('0x6d')](_0x27728e)[_0x6498('0x6e')]();}})[_0x6498('0x1c')](function(_0x3525e6){var _0x3a8880=[_0x6498('0x6f'),_0x6498('0x70'),_0x6498('0x71'),'CallType','IsArchived',_0x6498('0x72'),_0x6498('0x73'),_0x6498('0x74')];if(!_[_0x6498('0x6b')](_0x1fc595[_0x6498('0x37')][_0x6498('0x6c')])&&_0x1fc595[_0x6498('0x37')][_0x6498('0x6c')]===_0x6498('0x75')){_0x3a8880=[_0x6498('0x74'),'Origin',_0x6498('0x76'),_0x6498('0x73'),_0x6498('0x72'),_0x6498('0x77'),'SuppliedName',_0x6498('0x78')];}if(_0x3525e6){_[_0x6498('0x79')](_0x3525e6[_0x6498('0x3b')],function(_0x26a997){return _0x26a997[_0x6498('0x7a')]===![]&&!_0x3a8880[_0x6498('0x7b')](_0x26a997['name']);});return{'count':_0x3525e6['fields'][_0x6498('0x4b')],'rows':_[_0x6498('0x44')](_0x3525e6[_0x6498('0x3b')],function(_0x4f3aab){return{'id':_0x4f3aab[_0x6498('0x31')],'name':_0x4f3aab[_0x6498('0x7c')],'custom':_0x4f3aab[_0x6498('0x7a')],'options':_0x4f3aab[_0x6498('0x7d')]['length']>0x0?_['map'](_0x4f3aab[_0x6498('0x7d')],function(_0x15d672){return{'name':_0x15d672[_0x6498('0x7c')],'value':_0x15d672[_0x6498('0x7e')]};}):_0x4f3aab[_0x6498('0x59')]==_0x6498('0x7f')?[{'name':_0x6498('0x80'),'value':_0x6498('0x81')},{'name':'False','value':_0x6498('0x82')}]:[]};})};}})['then'](respondWithResult(_0x5319d5,null))[_0x6498('0x27')](function(_0x5043c7){var _0x56763f=_0x1fc595[_0x6498('0x37')]['test']?0x1f4:_0x5043c7[_0x6498('0x83')]||0x1f4;logger[_0x6498('0x23')](_0x6498('0x84'),_0x6498('0x5d'),_0x56763f,JSON[_0x6498('0x21')](_0x5043c7));delete _0x5043c7[_0x6498('0x31')];if(_0x56763f===0x191){_0x56763f=0x190;}_0x5319d5[_0x6498('0x28')](_0x56763f)[_0x6498('0x85')](_0x1fc595[_0x6498('0x37')][_0x6498('0x19')]?{'message':_0x6498('0x86'),'statusCode':_0x5043c7[_0x6498('0x83')]}:_0x5043c7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7d21ac1..8d02c78 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 _0xd523=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x381eb0,_0x17c821){var _0x203b9e=function(_0x3ffa4c){while(--_0x3ffa4c){_0x381eb0['push'](_0x381eb0['shift']());}};_0x203b9e(++_0x17c821);}(_0xd523,0x153));var _0x3d52=function(_0x383f4f,_0x48fe2b){_0x383f4f=_0x383f4f-0x0;var _0x64b499=_0xd523[_0x383f4f];return _0x64b499;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var logger=require(_0x3d52('0x2'))(_0x3d52('0x3'));var moment=require('moment');var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require(_0x3d52('0x6'));var rimraf=require('rimraf');var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));var integrations=require(_0x3d52('0x9'));module[_0x3d52('0xa')]=function(_0x580f82,_0x4fcc92){return _0x580f82[_0x3d52('0xb')](_0x3d52('0xc'),attributes,{'tableName':_0x3d52('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcffe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x5318fe,_0xed4ea){var _0xd3852f=function(_0x184315){while(--_0x184315){_0x5318fe['push'](_0x5318fe['shift']());}};_0xd3852f(++_0xed4ea);}(_0xcffe,0x1a1));var _0xecff=function(_0x151e0b,_0x3bec86){_0x151e0b=_0x151e0b-0x0;var _0x5d4a5c=_0xcffe[_0x151e0b];return _0x5d4a5c;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var logger=require(_0xecff('0x2'))(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var rp=require(_0xecff('0x6'));var fs=require('fs');var path=require(_0xecff('0x7'));var rimraf=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xecff('0xa')]=function(_0x25572c,_0x2e2fa9){return _0x25572c[_0xecff('0xb')](_0xecff('0xc'),attributes,{'tableName':_0xecff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e70657f..2c9f1e9 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 _0x119a=['message','SalesforceAccount','options','where','attributes','limit','include','map','model','GetSalesforceAccount','debug','catch','ShowSalesforceAccount','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SalesforceAccount,\x20%s,\x20%s','info','result'];(function(_0x18c6a7,_0x51ecf7){var _0x44f494=function(_0x214423){while(--_0x214423){_0x18c6a7['push'](_0x18c6a7['shift']());}};_0x44f494(++_0x51ecf7);}(_0x119a,0x16d));var _0xa119=function(_0x445b16,_0x9dd537){_0x445b16=_0x445b16-0x0;var _0x99b277=_0x119a[_0x445b16];return _0x99b277;};'use strict';var _=require(_0xa119('0x0'));var util=require('util');var moment=require(_0xa119('0x1'));var BPromise=require(_0xa119('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa119('0x3'));var db=require(_0xa119('0x4'))['db'];var utils=require(_0xa119('0x5'));var logger=require(_0xa119('0x6'))('rpc');var config=require(_0xa119('0x7'));var jayson=require(_0xa119('0x8'));var client=jayson[_0xa119('0x9')][_0xa119('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x557ac4,_0x458398,_0x1f1b4b){return new BPromise(function(_0x4b9adf,_0x296bef){return client[_0xa119('0xb')](_0x557ac4,_0x1f1b4b)[_0xa119('0xc')](function(_0x9bb1b9){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x458398,'request\x20sent');logger['debug'](_0xa119('0xd'),_0x458398,_0xa119('0xe'),JSON[_0xa119('0xf')](_0x9bb1b9));if(_0x9bb1b9[_0xa119('0x10')]){if(_0x9bb1b9[_0xa119('0x10')]['code']===0x1f4){logger[_0xa119('0x10')](_0xa119('0x11'),_0x458398,_0x9bb1b9['error']['message']);return _0x296bef(_0x9bb1b9[_0xa119('0x10')]['message']);}logger[_0xa119('0x10')](_0xa119('0x11'),_0x458398,_0x9bb1b9['error']['message']);return _0x4b9adf(_0x9bb1b9[_0xa119('0x10')]['message']);}else{logger[_0xa119('0x12')](_0xa119('0x11'),_0x458398,_0xa119('0xe'));_0x4b9adf(_0x9bb1b9[_0xa119('0x13')][_0xa119('0x14')]);}})['catch'](function(_0x3dd60d){logger['error'](_0xa119('0x11'),_0x458398,_0x3dd60d);_0x296bef(_0x3dd60d);});});}exports['GetSalesforceAccount']=function(_0x336544){var _0x24f532=this;return new Promise(function(_0x53d35d,_0x5ab683){return db[_0xa119('0x15')]['findAll']({'raw':_0x336544[_0xa119('0x16')]?_0x336544['options']['raw']===undefined?!![]:![]:!![],'where':_0x336544['options']?_0x336544['options'][_0xa119('0x17')]||null:null,'attributes':_0x336544[_0xa119('0x16')]?_0x336544['options'][_0xa119('0x18')]||null:null,'limit':_0x336544[_0xa119('0x16')]?_0x336544[_0xa119('0x16')][_0xa119('0x19')]||null:null,'include':_0x336544['options']?_0x336544[_0xa119('0x16')][_0xa119('0x1a')]?_[_0xa119('0x1b')](_0x336544['options']['include'],function(_0x5b502d){return{'model':db[_0x5b502d[_0xa119('0x1c')]],'as':_0x5b502d['as'],'attributes':_0x5b502d[_0xa119('0x18')],'include':_0x5b502d[_0xa119('0x1a')]?_[_0xa119('0x1b')](_0x5b502d['include'],function(_0x38e50c){return{'model':db[_0x38e50c[_0xa119('0x1c')]],'as':_0x38e50c['as'],'attributes':_0x38e50c[_0xa119('0x18')],'include':_0x38e50c[_0xa119('0x1a')]?_[_0xa119('0x1b')](_0x38e50c['include'],function(_0x48e106){return{'model':db[_0x48e106[_0xa119('0x1c')]],'as':_0x48e106['as'],'attributes':_0x48e106[_0xa119('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa119('0xc')](function(_0x48d7e3){logger[_0xa119('0x12')](_0xa119('0x1d'),_0x336544);logger[_0xa119('0x1e')](_0xa119('0x1d'),_0x336544,JSON[_0xa119('0xf')](_0x48d7e3));_0x53d35d(_0x48d7e3);})[_0xa119('0x1f')](function(_0x1face2){logger[_0xa119('0x10')](_0xa119('0x1d'),_0x1face2[_0xa119('0x14')],_0x336544);_0x5ab683(_0x24f532[_0xa119('0x10')](0x1f4,_0x1face2[_0xa119('0x14')]));});});};exports[_0xa119('0x20')]=function(_0xe29c31){var _0x5a635f=this;return new Promise(function(_0xb8a7ea,_0x4123fa){return db['SalesforceAccount'][_0xa119('0x21')]({'raw':_0xe29c31[_0xa119('0x16')]?_0xe29c31[_0xa119('0x16')][_0xa119('0x22')]===undefined?!![]:![]:!![],'where':_0xe29c31[_0xa119('0x16')]?_0xe29c31[_0xa119('0x16')][_0xa119('0x17')]||null:null,'attributes':_0xe29c31[_0xa119('0x16')]?_0xe29c31[_0xa119('0x16')]['attributes']||null:null,'include':_0xe29c31[_0xa119('0x16')]?_0xe29c31[_0xa119('0x16')][_0xa119('0x1a')]?_['map'](_0xe29c31['options'][_0xa119('0x1a')],function(_0x3d96ae){return{'model':db[_0x3d96ae[_0xa119('0x1c')]],'as':_0x3d96ae['as'],'attributes':_0x3d96ae[_0xa119('0x18')],'include':_0x3d96ae[_0xa119('0x1a')]?_[_0xa119('0x1b')](_0x3d96ae[_0xa119('0x1a')],function(_0x2c6146){return{'model':db[_0x2c6146['model']],'as':_0x2c6146['as'],'attributes':_0x2c6146[_0xa119('0x18')],'include':_0x2c6146[_0xa119('0x1a')]?_['map'](_0x2c6146['include'],function(_0x2e9181){return{'model':db[_0x2e9181[_0xa119('0x1c')]],'as':_0x2e9181['as'],'attributes':_0x2e9181[_0xa119('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa119('0xc')](function(_0x379d93){logger[_0xa119('0x12')](_0xa119('0x20'),_0xe29c31);logger[_0xa119('0x1e')]('ShowSalesforceAccount',_0xe29c31,JSON['stringify'](_0x379d93));_0xb8a7ea(_0x379d93);})['catch'](function(_0x2f6a41){logger['error']('ShowSalesforceAccount',_0x2f6a41['message'],_0xe29c31);_0x4123fa(_0x5a635f[_0xa119('0x10')](0x1f4,_0x2f6a41[_0xa119('0x14')]));});});}; \ No newline at end of file +var _0x8427=['rpc','../../config/environment','jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8427,0x1c0));var _0x7842=function(_0x2e5395,_0x575a12){_0x2e5395=_0x2e5395-0x0;var _0x47c312=_0x8427[_0x2e5395];return _0x47c312;};'use strict';var _=require('lodash');var util=require(_0x7842('0x0'));var moment=require(_0x7842('0x1'));var BPromise=require(_0x7842('0x2'));var rs=require(_0x7842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7842('0x4'))['db'];var utils=require(_0x7842('0x5'));var logger=require(_0x7842('0x6'))(_0x7842('0x7'));var config=require(_0x7842('0x8'));var jayson=require(_0x7842('0x9'));var client=jayson[_0x7842('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fed48,_0x46e83d,_0x251618){return new BPromise(function(_0x324732,_0x1e9872){return client[_0x7842('0xb')](_0x3fed48,_0x251618)['then'](function(_0x835571){logger[_0x7842('0xc')](_0x7842('0xd'),_0x46e83d,_0x7842('0xe'));logger['debug'](_0x7842('0xf'),_0x46e83d,'request\x20sent',JSON[_0x7842('0x10')](_0x835571));if(_0x835571[_0x7842('0x11')]){if(_0x835571[_0x7842('0x11')][_0x7842('0x12')]===0x1f4){logger[_0x7842('0x11')](_0x7842('0xd'),_0x46e83d,_0x835571[_0x7842('0x11')][_0x7842('0x13')]);return _0x1e9872(_0x835571['error'][_0x7842('0x13')]);}logger[_0x7842('0x11')](_0x7842('0xd'),_0x46e83d,_0x835571[_0x7842('0x11')]['message']);return _0x324732(_0x835571[_0x7842('0x11')][_0x7842('0x13')]);}else{logger[_0x7842('0xc')](_0x7842('0xd'),_0x46e83d,'request\x20sent');_0x324732(_0x835571[_0x7842('0x14')]['message']);}})[_0x7842('0x15')](function(_0x1f58ef){logger[_0x7842('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x46e83d,_0x1f58ef);_0x1e9872(_0x1f58ef);});});}exports[_0x7842('0x16')]=function(_0x197052){var _0x14cdcc=this;return new Promise(function(_0x4e67cd,_0x2f1fbb){return db[_0x7842('0x17')][_0x7842('0x18')]({'raw':_0x197052[_0x7842('0x19')]?_0x197052[_0x7842('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x197052[_0x7842('0x19')]?_0x197052['options'][_0x7842('0x1a')]||null:null,'attributes':_0x197052['options']?_0x197052[_0x7842('0x19')][_0x7842('0x1b')]||null:null,'limit':_0x197052['options']?_0x197052[_0x7842('0x19')][_0x7842('0x1c')]||null:null,'include':_0x197052['options']?_0x197052[_0x7842('0x19')][_0x7842('0x1d')]?_[_0x7842('0x1e')](_0x197052[_0x7842('0x19')][_0x7842('0x1d')],function(_0x55993b){return{'model':db[_0x55993b['model']],'as':_0x55993b['as'],'attributes':_0x55993b['attributes'],'include':_0x55993b[_0x7842('0x1d')]?_[_0x7842('0x1e')](_0x55993b[_0x7842('0x1d')],function(_0x35c4ca){return{'model':db[_0x35c4ca[_0x7842('0x1f')]],'as':_0x35c4ca['as'],'attributes':_0x35c4ca[_0x7842('0x1b')],'include':_0x35c4ca[_0x7842('0x1d')]?_[_0x7842('0x1e')](_0x35c4ca['include'],function(_0x5279f6){return{'model':db[_0x5279f6['model']],'as':_0x5279f6['as'],'attributes':_0x5279f6[_0x7842('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a3259){logger[_0x7842('0xc')]('GetSalesforceAccount',_0x197052);logger['debug'](_0x7842('0x16'),_0x197052,JSON['stringify'](_0x2a3259));_0x4e67cd(_0x2a3259);})['catch'](function(_0x3212ec){logger[_0x7842('0x11')](_0x7842('0x16'),_0x3212ec[_0x7842('0x13')],_0x197052);_0x2f1fbb(_0x14cdcc[_0x7842('0x11')](0x1f4,_0x3212ec[_0x7842('0x13')]));});});};exports[_0x7842('0x20')]=function(_0x5612fe){var _0x140b7d=this;return new Promise(function(_0x2c28db,_0x293965){return db[_0x7842('0x17')][_0x7842('0x21')]({'raw':_0x5612fe[_0x7842('0x19')]?_0x5612fe['options']['raw']===undefined?!![]:![]:!![],'where':_0x5612fe['options']?_0x5612fe[_0x7842('0x19')][_0x7842('0x1a')]||null:null,'attributes':_0x5612fe[_0x7842('0x19')]?_0x5612fe[_0x7842('0x19')]['attributes']||null:null,'include':_0x5612fe[_0x7842('0x19')]?_0x5612fe[_0x7842('0x19')][_0x7842('0x1d')]?_[_0x7842('0x1e')](_0x5612fe['options'][_0x7842('0x1d')],function(_0x2629dc){return{'model':db[_0x2629dc[_0x7842('0x1f')]],'as':_0x2629dc['as'],'attributes':_0x2629dc[_0x7842('0x1b')],'include':_0x2629dc['include']?_['map'](_0x2629dc[_0x7842('0x1d')],function(_0x4d3338){return{'model':db[_0x4d3338[_0x7842('0x1f')]],'as':_0x4d3338['as'],'attributes':_0x4d3338[_0x7842('0x1b')],'include':_0x4d3338['include']?_[_0x7842('0x1e')](_0x4d3338['include'],function(_0x12c464){return{'model':db[_0x12c464[_0x7842('0x1f')]],'as':_0x12c464['as'],'attributes':_0x12c464[_0x7842('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7842('0x22')](function(_0x36f09d){logger[_0x7842('0xc')](_0x7842('0x20'),_0x5612fe);logger['debug'](_0x7842('0x20'),_0x5612fe,JSON[_0x7842('0x10')](_0x36f09d));_0x2c28db(_0x36f09d);})[_0x7842('0x15')](function(_0x1d3f47){logger[_0x7842('0x11')](_0x7842('0x20'),_0x1d3f47['message'],_0x5612fe);_0x293965(_0x140b7d[_0x7842('0x11')](0x1f4,_0x1d3f47[_0x7842('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b7ec2a6..dd7e495 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 _0xe63b=['post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x419715,_0x221336){var _0x274fbd=function(_0x5119b0){while(--_0x5119b0){_0x419715['push'](_0x419715['shift']());}};_0x274fbd(++_0x221336);}(_0xe63b,0xa0));var _0xbe63=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xe63b[_0x4ed4d2];return _0x15ae2e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe63('0x0'));var timeout=require(_0xbe63('0x1'));var express=require(_0xbe63('0x2'));var router=express[_0xbe63('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe63('0x4'));var config=require(_0xbe63('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0xbe63('0x6')]('/',auth[_0xbe63('0x7')](),controller[_0xbe63('0x8')]);router[_0xbe63('0x6')](_0xbe63('0x9'),auth['isAuthenticated'](),controller[_0xbe63('0xa')]);router[_0xbe63('0x6')](_0xbe63('0xb'),auth[_0xbe63('0x7')](),controller[_0xbe63('0xc')]);router['get'](_0xbe63('0xd'),auth['isAuthenticated'](),controller[_0xbe63('0xe')]);router[_0xbe63('0x6')]('/:id/descriptions',auth[_0xbe63('0x7')](),controller[_0xbe63('0xf')]);router[_0xbe63('0x10')]('/',auth[_0xbe63('0x7')](),controller[_0xbe63('0x11')]);router[_0xbe63('0x12')](_0xbe63('0x9'),auth[_0xbe63('0x7')](),controller[_0xbe63('0x13')]);router[_0xbe63('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbe63('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9976=['get','/:id','getFields','/:id/descriptions','post','put','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index'];(function(_0x2a1428,_0x1ef92){var _0x596521=function(_0x56088b){while(--_0x56088b){_0x2a1428['push'](_0x2a1428['shift']());}};_0x596521(++_0x1ef92);}(_0x9976,0x178));var _0x6997=function(_0x1c5eff,_0x41175b){_0x1c5eff=_0x1c5eff-0x0;var _0x685ea0=_0x9976[_0x1c5eff];return _0x685ea0;};'use strict';var multer=require(_0x6997('0x0'));var util=require('util');var path=require(_0x6997('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6997('0x2')]();var auth=require(_0x6997('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6997('0x4'));var controller=require(_0x6997('0x5'));router['get']('/',auth[_0x6997('0x6')](),controller[_0x6997('0x7')]);router[_0x6997('0x8')](_0x6997('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6997('0x8')]('/:id/fields',auth[_0x6997('0x6')](),controller[_0x6997('0xa')]);router[_0x6997('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x6997('0x8')](_0x6997('0xb'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6997('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6997('0xd')](_0x6997('0x9'),auth[_0x6997('0x6')](),controller['update']);router['delete'](_0x6997('0x9'),auth['isAuthenticated'](),controller[_0x6997('0xe')]);module[_0x6997('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index e12987f..2cf0c7a 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 _0xd408=['nothing','lead','sequelize','exports','STRING','Case','Task','contact_lead','contact','ENUM'];(function(_0x1f4a09,_0x339167){var _0x1b4ac0=function(_0xe2aeae){while(--_0xe2aeae){_0x1f4a09['push'](_0x1f4a09['shift']());}};_0x1b4ac0(++_0x339167);}(_0xd408,0x160));var _0x8d40=function(_0x2239f1,_0x1e1461){_0x2239f1=_0x2239f1-0x0;var _0x5c1a73=_0xd408[_0x2239f1];return _0x5c1a73;};'use strict';var Sequelize=require(_0x8d40('0x0'));module[_0x8d40('0x1')]={'name':{'type':Sequelize[_0x8d40('0x2')]},'description':{'type':Sequelize[_0x8d40('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x8d40('0x3')),'defaultValue':_0x8d40('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x8d40('0x5'),_0x8d40('0x6'),'lead'),'defaultValue':_0x8d40('0x5')},'moduleCreate':{'type':Sequelize[_0x8d40('0x7')](_0x8d40('0x8'),_0x8d40('0x6'),'lead'),'defaultValue':_0x8d40('0x9')}}; \ No newline at end of file +var _0x0122=['contact','lead','nothing','STRING','ENUM','Task','Case','contact_lead'];(function(_0x79f3b4,_0x526d9e){var _0x4473c9=function(_0x22ab7e){while(--_0x22ab7e){_0x79f3b4['push'](_0x79f3b4['shift']());}};_0x4473c9(++_0x526d9e);}(_0x0122,0xd3));var _0x2012=function(_0x17b1d8,_0x1827f6){_0x17b1d8=_0x17b1d8-0x0;var _0x30313f=_0x0122[_0x17b1d8];return _0x30313f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2012('0x0')]},'description':{'type':Sequelize[_0x2012('0x0')]},'ticketType':{'type':Sequelize[_0x2012('0x1')](_0x2012('0x2'),_0x2012('0x3')),'defaultValue':_0x2012('0x2')},'moduleSearch':{'type':Sequelize[_0x2012('0x1')](_0x2012('0x4'),_0x2012('0x5'),_0x2012('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2012('0x1')](_0x2012('0x7'),_0x2012('0x5'),_0x2012('0x6')),'defaultValue':_0x2012('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 1276e3e..73c33e9 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 _0x60b3=['request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','set','json','apply','stack','name','SalesforceConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','include','findAll','rows','show','find','create','body','params','destroy','getFields','findOne','SalesforceField','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x60b3,0x144));var _0x360b=function(_0x4d2938,_0x332d65){_0x4d2938=_0x4d2938-0x0;var _0x5e7d9b=_0x60b3[_0x4d2938];return _0x5e7d9b;};'use strict';var pdf=require(_0x360b('0x0'));var emlformat=require(_0x360b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x360b('0x2'));var jsonpatch=require(_0x360b('0x3'));var rp=require('request-promise');var moment=require(_0x360b('0x4'));var BPromise=require(_0x360b('0x5'));var Mustache=require(_0x360b('0x6'));var util=require(_0x360b('0x7'));var path=require(_0x360b('0x8'));var sox=require(_0x360b('0x9'));var csv=require(_0x360b('0xa'));var ejs=require(_0x360b('0xb'));var fs=require('fs');var _=require(_0x360b('0xc'));var squel=require(_0x360b('0xd'));var crypto=require(_0x360b('0xe'));var jsforce=require(_0x360b('0xf'));var deskjs=require(_0x360b('0x10'));var toCsv=require(_0x360b('0xa'));var querystring=require(_0x360b('0x11'));var Papa=require(_0x360b('0x12'));var Redis=require(_0x360b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x360b('0x14'))(_0x360b('0x15'));var utils=require(_0x360b('0x16'));var config=require(_0x360b('0x17'));var db=require(_0x360b('0x18'))['db'];var jayson=require(_0x360b('0x19'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4759b2,_0x38d59f,_0x76da1f){if(_0x76da1f){var _0x298477=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x298477[_0x360b('0x1a')](_0x38d59f)){return _0x4759b2;}else{throw new Error(_0x360b('0x1b'));}}else{return _0x4759b2;}}function respondWithRpcPromise(_0x43dbbf,_0x270347,_0x31227d,_0x41bacd){return new BPromise(function(_0x2f1902,_0x1bbc8e){var _0x2d2d2e=_0x41bacd||client;return _0x2d2d2e[_0x360b('0x1c')](_0x43dbbf,_0x31227d)[_0x360b('0x1d')](function(_0x1aba92){logger[_0x360b('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s',_0x270347,_0x360b('0x1f'));logger[_0x360b('0x20')](_0x360b('0x21'),_0x270347,_0x360b('0x1f'),JSON[_0x360b('0x22')](_0x1aba92));if(_0x1aba92[_0x360b('0x23')]){if(_0x1aba92['error'][_0x360b('0x24')]===0x1f4){logger['error'](_0x360b('0x25'),_0x270347,_0x1aba92['error'][_0x360b('0x26')]);return _0x1bbc8e(_0x1aba92[_0x360b('0x23')]['message']);}logger[_0x360b('0x23')](_0x360b('0x25'),_0x270347,_0x1aba92[_0x360b('0x23')][_0x360b('0x26')]);return _0x2f1902(_0x1aba92[_0x360b('0x23')][_0x360b('0x26')]);}else{logger[_0x360b('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s',_0x270347,_0x360b('0x1f'));_0x2f1902(_0x1aba92['result'][_0x360b('0x26')]);}})[_0x360b('0x27')](function(_0x29d222){logger[_0x360b('0x23')](_0x360b('0x25'),_0x270347,_0x29d222);_0x1bbc8e(_0x29d222);});});}function respondWithStatusCode(_0x41f033,_0x7563cd){_0x7563cd=_0x7563cd||0xcc;return function(_0x42e018){if(_0x42e018){return _0x41f033[_0x360b('0x28')](_0x7563cd);}return _0x41f033[_0x360b('0x29')](_0x7563cd)[_0x360b('0x2a')]();};}function respondWithResult(_0x340c5b,_0x3f53f6){_0x3f53f6=_0x3f53f6||0xc8;return function(_0x38f8f2){if(_0x38f8f2){return _0x340c5b[_0x360b('0x29')](_0x3f53f6)['json'](_0x38f8f2);}};}function respondWithFilteredResult(_0x2f7012,_0x275eb4){return function(_0x29290f){if(_0x29290f){var _0x24b17b=_0x29290f[_0x360b('0x2b')],_0x5c86ad=_0x275eb4['offset'],_0x213fef=_0x275eb4['offset']+_0x275eb4['limit'],_0x320f17;if(_0x213fef>=_0x24b17b){_0x213fef=_0x24b17b;_0x320f17=0xc8;}else{_0x320f17=0xce;}_0x2f7012['status'](_0x320f17);return _0x2f7012[_0x360b('0x2c')]('Content-Range',_0x5c86ad+'-'+_0x213fef+'/'+_0x24b17b)[_0x360b('0x2d')](_0x29290f);}return null;};}function patchUpdates(_0x302cf9){return function(_0xed69ee){try{jsonpatch[_0x360b('0x2e')](_0xed69ee,_0x302cf9,!![]);}catch(_0x281d67){return BPromise['reject'](_0x281d67);}return _0xed69ee['save']();};}function saveUpdates(_0x14994c,_0x109b47){return function(_0x34c4d7){if(_0x34c4d7){return _0x34c4d7['update'](_0x14994c)['then'](function(_0x4967c6){return _0x4967c6;});}return null;};}function removeEntity(_0x44c32d,_0x11f67f){return function(_0x3719af){if(_0x3719af){return _0x3719af['destroy']()['then'](function(){_0x44c32d['status'](0xcc)[_0x360b('0x2a')]();});}};}function handleEntityNotFound(_0x49e044,_0x53bbd3){return function(_0x5785ad){if(!_0x5785ad){_0x49e044[_0x360b('0x28')](0x194);}return _0x5785ad;};}function handleError(_0x3c17b2,_0x606cfc){_0x606cfc=_0x606cfc||0x1f4;return function(_0x4442f9){logger[_0x360b('0x23')](_0x4442f9[_0x360b('0x2f')]);if(_0x4442f9['name']){delete _0x4442f9[_0x360b('0x30')];}_0x3c17b2[_0x360b('0x29')](_0x606cfc)['send'](_0x4442f9);};}exports['index']=function(_0x27e9ad,_0x51abfe){var _0xb36f45={},_0x22d67a={},_0x3c3f23={'count':0x0,'rows':[]};var _0x5a48f1=db[_0x360b('0x31')][_0x360b('0x32')];_0x22d67a[_0x360b('0x33')]=_[_0x360b('0x34')](_0x5a48f1);_0x22d67a[_0x360b('0x35')]=_[_0x360b('0x34')](_0x27e9ad[_0x360b('0x35')]);_0x22d67a[_0x360b('0x36')]=_[_0x360b('0x37')](_0x22d67a['model'],_0x22d67a['query']);_0xb36f45[_0x360b('0x38')]=_['intersection'](_0x22d67a['model'],qs['fields'](_0x27e9ad[_0x360b('0x35')][_0x360b('0x39')]));_0xb36f45[_0x360b('0x38')]=_0xb36f45[_0x360b('0x38')][_0x360b('0x3a')]?_0xb36f45['attributes']:_0x22d67a[_0x360b('0x33')];if(!_0x27e9ad[_0x360b('0x35')][_0x360b('0x3b')]('nolimit')){_0xb36f45['limit']=qs[_0x360b('0x3c')](_0x27e9ad[_0x360b('0x35')][_0x360b('0x3c')]);_0xb36f45[_0x360b('0x3d')]=qs[_0x360b('0x3d')](_0x27e9ad[_0x360b('0x35')][_0x360b('0x3d')]);}_0xb36f45[_0x360b('0x3e')]=qs[_0x360b('0x3f')](_0x27e9ad[_0x360b('0x35')][_0x360b('0x3f')]);_0xb36f45[_0x360b('0x40')]=qs[_0x360b('0x36')](_[_0x360b('0x41')](_0x27e9ad[_0x360b('0x35')],_0x22d67a[_0x360b('0x36')]));if(_0x27e9ad[_0x360b('0x35')][_0x360b('0x42')]){_0xb36f45['where']=_[_0x360b('0x43')](_0xb36f45['where'],{'$or':_[_0x360b('0x44')](_0x5a48f1,function(_0x1b7334){if(_0x1b7334[_0x360b('0x45')]['key']!==_0x360b('0x46')){var _0x17d11a={};_0x17d11a[_0x1b7334[_0x360b('0x47')]]={'$like':'%'+_0x27e9ad['query'][_0x360b('0x42')]+'%'};return _0x17d11a;}})});}_0xb36f45=_['merge']({},_0xb36f45,_0x27e9ad[_0x360b('0x48')]);var _0x45b43a={'where':_0xb36f45[_0x360b('0x40')]};return db[_0x360b('0x31')]['count'](_0x45b43a)['then'](function(_0x1248a6){_0x3c3f23[_0x360b('0x2b')]=_0x1248a6;if(_0x27e9ad['query']['includeAll']){_0xb36f45[_0x360b('0x49')]=[{'all':!![]}];}return db[_0x360b('0x31')][_0x360b('0x4a')](_0xb36f45);})['then'](function(_0x3a20d2){_0x3c3f23[_0x360b('0x4b')]=_0x3a20d2;return _0x3c3f23;})[_0x360b('0x1d')](respondWithFilteredResult(_0x51abfe,_0xb36f45))[_0x360b('0x27')](handleError(_0x51abfe,null));};exports[_0x360b('0x4c')]=function(_0x4eb15d,_0x17a6f1){var _0x527027={'raw':![],'where':{'id':_0x4eb15d['params']['id']}},_0xe9b2b8={};_0xe9b2b8[_0x360b('0x33')]=_[_0x360b('0x34')](db['SalesforceConfiguration']['rawAttributes']);_0xe9b2b8[_0x360b('0x35')]=_['keys'](_0x4eb15d[_0x360b('0x35')]);_0xe9b2b8[_0x360b('0x36')]=_['intersection'](_0xe9b2b8[_0x360b('0x33')],_0xe9b2b8['query']);_0x527027[_0x360b('0x38')]=_[_0x360b('0x37')](_0xe9b2b8[_0x360b('0x33')],qs['fields'](_0x4eb15d[_0x360b('0x35')]['fields']));_0x527027[_0x360b('0x38')]=_0x527027[_0x360b('0x38')][_0x360b('0x3a')]?_0x527027[_0x360b('0x38')]:_0xe9b2b8[_0x360b('0x33')];if(_0x4eb15d[_0x360b('0x35')]['includeAll']){_0x527027['include']=[{'all':!![]}];}_0x527027=_[_0x360b('0x43')]({},_0x527027,_0x4eb15d['options']);return db[_0x360b('0x31')][_0x360b('0x4d')](_0x527027)['then'](handleEntityNotFound(_0x17a6f1,null))[_0x360b('0x1d')](respondWithResult(_0x17a6f1,null))['catch'](handleError(_0x17a6f1,null));};exports[_0x360b('0x4e')]=function(_0x3532d0,_0x7b7145){return db[_0x360b('0x31')][_0x360b('0x4e')](_0x3532d0[_0x360b('0x4f')],{})[_0x360b('0x1d')](respondWithResult(_0x7b7145,0xc9))[_0x360b('0x27')](handleError(_0x7b7145,null));};exports['update']=function(_0x5f29e9,_0x4a53ac){if(_0x5f29e9[_0x360b('0x4f')]['id']){delete _0x5f29e9['body']['id'];}return db[_0x360b('0x31')][_0x360b('0x4d')]({'where':{'id':_0x5f29e9[_0x360b('0x50')]['id']}})[_0x360b('0x1d')](handleEntityNotFound(_0x4a53ac,null))[_0x360b('0x1d')](saveUpdates(_0x5f29e9[_0x360b('0x4f')],null))[_0x360b('0x1d')](respondWithResult(_0x4a53ac,null))['catch'](handleError(_0x4a53ac,null));};exports[_0x360b('0x51')]=function(_0x4a927c,_0x4a588e){return db[_0x360b('0x31')][_0x360b('0x4d')]({'where':{'id':_0x4a927c['params']['id']}})[_0x360b('0x1d')](handleEntityNotFound(_0x4a588e,null))[_0x360b('0x1d')](removeEntity(_0x4a588e,null))[_0x360b('0x27')](handleError(_0x4a588e,null));};exports[_0x360b('0x52')]=function(_0x151169,_0x44fd85,_0x2fd9d8){var _0x4423cf={};var _0xfc2ef3={};var _0x4d92b5;var _0x5af1fa;return db[_0x360b('0x31')][_0x360b('0x53')]({'where':{'id':_0x151169[_0x360b('0x50')]['id']}})[_0x360b('0x1d')](handleEntityNotFound(_0x44fd85,null))[_0x360b('0x1d')](function(_0x398a61){if(_0x398a61){_0x4d92b5=_0x398a61;_0xfc2ef3[_0x360b('0x33')]=_[_0x360b('0x34')](db[_0x360b('0x54')][_0x360b('0x32')]);_0xfc2ef3[_0x360b('0x35')]=_[_0x360b('0x34')](_0x151169[_0x360b('0x35')]);_0xfc2ef3[_0x360b('0x36')]=_[_0x360b('0x37')](_0xfc2ef3[_0x360b('0x33')],_0xfc2ef3[_0x360b('0x35')]);_0x4423cf['attributes']=_['intersection'](_0xfc2ef3[_0x360b('0x33')],qs[_0x360b('0x39')](_0x151169[_0x360b('0x35')][_0x360b('0x39')]));_0x4423cf[_0x360b('0x38')]=_0x4423cf[_0x360b('0x38')][_0x360b('0x3a')]?_0x4423cf[_0x360b('0x38')]:_0xfc2ef3[_0x360b('0x33')];_0x4423cf[_0x360b('0x3e')]=qs[_0x360b('0x3f')](_0x151169[_0x360b('0x35')]['sort']);_0x4423cf[_0x360b('0x40')]=qs[_0x360b('0x36')](_[_0x360b('0x41')](_0x151169[_0x360b('0x35')],_0xfc2ef3[_0x360b('0x36')]));if(_0x151169[_0x360b('0x35')][_0x360b('0x42')]){_0x4423cf[_0x360b('0x40')]=_[_0x360b('0x43')](_0x4423cf[_0x360b('0x40')],{'$or':_['map'](_0x4423cf[_0x360b('0x38')],function(_0x4acb69){var _0x87b13f={};_0x87b13f[_0x4acb69]={'$like':'%'+_0x151169[_0x360b('0x35')][_0x360b('0x42')]+'%'};return _0x87b13f;})});}_0x4423cf=_[_0x360b('0x43')]({},_0x4423cf,_0x151169[_0x360b('0x48')]);return _0x4d92b5['getFields'](_0x4423cf);}})['then'](function(_0x258a1b){if(_0x258a1b){_0x5af1fa=_0x258a1b[_0x360b('0x3a')];if(!_0x151169[_0x360b('0x35')][_0x360b('0x3b')]('nolimit')){_0x4423cf[_0x360b('0x3c')]=qs[_0x360b('0x3c')](_0x151169[_0x360b('0x35')][_0x360b('0x3c')]);_0x4423cf[_0x360b('0x3d')]=qs[_0x360b('0x3d')](_0x151169[_0x360b('0x35')][_0x360b('0x3d')]);}return _0x4d92b5[_0x360b('0x52')](_0x4423cf);}})[_0x360b('0x1d')](function(_0x474093){if(_0x474093){return _0x474093?{'count':_0x5af1fa,'rows':_0x474093}:null;}})[_0x360b('0x1d')](respondWithResult(_0x44fd85,null))['catch'](handleError(_0x44fd85,null));};exports[_0x360b('0x55')]=function(_0x6b1beb,_0x50ce6f,_0x2779d2){var _0x1c1833={};var _0x1beb3d={};var _0x527941;var _0x411b1f;return db['SalesforceConfiguration'][_0x360b('0x53')]({'where':{'id':_0x6b1beb[_0x360b('0x50')]['id']}})[_0x360b('0x1d')](handleEntityNotFound(_0x50ce6f,null))['then'](function(_0x48601c){if(_0x48601c){_0x527941=_0x48601c;_0x1beb3d[_0x360b('0x33')]=_['keys'](db[_0x360b('0x54')][_0x360b('0x32')]);_0x1beb3d[_0x360b('0x35')]=_[_0x360b('0x34')](_0x6b1beb[_0x360b('0x35')]);_0x1beb3d[_0x360b('0x36')]=_['intersection'](_0x1beb3d[_0x360b('0x33')],_0x1beb3d['query']);_0x1c1833[_0x360b('0x38')]=_['intersection'](_0x1beb3d[_0x360b('0x33')],qs[_0x360b('0x39')](_0x6b1beb[_0x360b('0x35')]['fields']));_0x1c1833[_0x360b('0x38')]=_0x1c1833['attributes'][_0x360b('0x3a')]?_0x1c1833[_0x360b('0x38')]:_0x1beb3d[_0x360b('0x33')];_0x1c1833[_0x360b('0x3e')]=qs[_0x360b('0x3f')](_0x6b1beb[_0x360b('0x35')][_0x360b('0x3f')]);_0x1c1833[_0x360b('0x40')]=qs[_0x360b('0x36')](_[_0x360b('0x41')](_0x6b1beb[_0x360b('0x35')],_0x1beb3d[_0x360b('0x36')]));if(_0x6b1beb[_0x360b('0x35')][_0x360b('0x42')]){_0x1c1833[_0x360b('0x40')]=_[_0x360b('0x43')](_0x1c1833['where'],{'$or':_[_0x360b('0x44')](_0x1c1833[_0x360b('0x38')],function(_0xd7b43){var _0x55e3ad={};_0x55e3ad[_0xd7b43]={'$like':'%'+_0x6b1beb[_0x360b('0x35')][_0x360b('0x42')]+'%'};return _0x55e3ad;})});}_0x1c1833=_[_0x360b('0x43')]({},_0x1c1833,_0x6b1beb['options']);return _0x527941['getSubjects'](_0x1c1833);}})[_0x360b('0x1d')](function(_0x4c3912){if(_0x4c3912){_0x411b1f=_0x4c3912[_0x360b('0x3a')];if(!_0x6b1beb['query']['hasOwnProperty'](_0x360b('0x56'))){_0x1c1833[_0x360b('0x3c')]=qs['limit'](_0x6b1beb['query'][_0x360b('0x3c')]);_0x1c1833[_0x360b('0x3d')]=qs[_0x360b('0x3d')](_0x6b1beb[_0x360b('0x35')][_0x360b('0x3d')]);}return _0x527941[_0x360b('0x55')](_0x1c1833);}})[_0x360b('0x1d')](function(_0x54bbe7){if(_0x54bbe7){return _0x54bbe7?{'count':_0x411b1f,'rows':_0x54bbe7}:null;}})[_0x360b('0x1d')](respondWithResult(_0x50ce6f,null))[_0x360b('0x27')](handleError(_0x50ce6f,null));};exports[_0x360b('0x57')]=function(_0x48e7d2,_0x3f500b,_0x58176b){var _0x595447={};var _0x4fd1f4={};var _0x7b7806;var _0x233a88;return db[_0x360b('0x31')][_0x360b('0x53')]({'where':{'id':_0x48e7d2[_0x360b('0x50')]['id']}})[_0x360b('0x1d')](handleEntityNotFound(_0x3f500b,null))[_0x360b('0x1d')](function(_0x1d4ac2){if(_0x1d4ac2){_0x7b7806=_0x1d4ac2;_0x4fd1f4[_0x360b('0x33')]=_['keys'](db['SalesforceField'][_0x360b('0x32')]);_0x4fd1f4['query']=_[_0x360b('0x34')](_0x48e7d2['query']);_0x4fd1f4[_0x360b('0x36')]=_[_0x360b('0x37')](_0x4fd1f4['model'],_0x4fd1f4['query']);_0x595447[_0x360b('0x38')]=_[_0x360b('0x37')](_0x4fd1f4[_0x360b('0x33')],qs[_0x360b('0x39')](_0x48e7d2['query']['fields']));_0x595447[_0x360b('0x38')]=_0x595447['attributes'][_0x360b('0x3a')]?_0x595447[_0x360b('0x38')]:_0x4fd1f4[_0x360b('0x33')];_0x595447['order']=qs[_0x360b('0x3f')](_0x48e7d2[_0x360b('0x35')][_0x360b('0x3f')]);_0x595447[_0x360b('0x40')]=qs[_0x360b('0x36')](_[_0x360b('0x41')](_0x48e7d2[_0x360b('0x35')],_0x4fd1f4[_0x360b('0x36')]));if(_0x48e7d2[_0x360b('0x35')][_0x360b('0x42')]){_0x595447[_0x360b('0x40')]=_['merge'](_0x595447[_0x360b('0x40')],{'$or':_[_0x360b('0x44')](_0x595447[_0x360b('0x38')],function(_0x420f7c){var _0x49bdfe={};_0x49bdfe[_0x420f7c]={'$like':'%'+_0x48e7d2[_0x360b('0x35')][_0x360b('0x42')]+'%'};return _0x49bdfe;})});}_0x595447=_[_0x360b('0x43')]({},_0x595447,_0x48e7d2[_0x360b('0x48')]);return _0x7b7806[_0x360b('0x57')](_0x595447);}})[_0x360b('0x1d')](function(_0x514b1d){if(_0x514b1d){_0x233a88=_0x514b1d[_0x360b('0x3a')];if(!_0x48e7d2[_0x360b('0x35')][_0x360b('0x3b')](_0x360b('0x56'))){_0x595447[_0x360b('0x3c')]=qs[_0x360b('0x3c')](_0x48e7d2[_0x360b('0x35')][_0x360b('0x3c')]);_0x595447[_0x360b('0x3d')]=qs[_0x360b('0x3d')](_0x48e7d2['query'][_0x360b('0x3d')]);}return _0x7b7806['getDescriptions'](_0x595447);}})[_0x360b('0x1d')](function(_0xde3bb0){if(_0xde3bb0){return _0xde3bb0?{'count':_0x233a88,'rows':_0xde3bb0}:null;}})[_0x360b('0x1d')](respondWithResult(_0x3f500b,null))[_0x360b('0x27')](handleError(_0x3f500b,null));}; \ No newline at end of file +var _0x4d47=['result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','destroy','stack','name','send','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','options','includeAll','include','SalesforceConfiguration','rows','show','params','rawAttributes','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x58c844,_0x313e00){var _0x5efd30=function(_0x2d5c1f){while(--_0x2d5c1f){_0x58c844['push'](_0x58c844['shift']());}};_0x5efd30(++_0x313e00);}(_0x4d47,0x1f1));var _0x74d4=function(_0x32f8a2,_0x49c502){_0x32f8a2=_0x32f8a2-0x0;var _0x258cca=_0x4d47[_0x32f8a2];return _0x258cca;};'use strict';var pdf=require(_0x74d4('0x0'));var emlformat=require(_0x74d4('0x1'));var rimraf=require(_0x74d4('0x2'));var zipdir=require(_0x74d4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74d4('0x4'));var moment=require(_0x74d4('0x5'));var BPromise=require(_0x74d4('0x6'));var Mustache=require(_0x74d4('0x7'));var util=require('util');var path=require(_0x74d4('0x8'));var sox=require(_0x74d4('0x9'));var csv=require(_0x74d4('0xa'));var ejs=require(_0x74d4('0xb'));var fs=require('fs');var _=require(_0x74d4('0xc'));var squel=require(_0x74d4('0xd'));var crypto=require(_0x74d4('0xe'));var jsforce=require(_0x74d4('0xf'));var deskjs=require(_0x74d4('0x10'));var toCsv=require(_0x74d4('0xa'));var querystring=require('querystring');var Papa=require(_0x74d4('0x11'));var Redis=require(_0x74d4('0x12'));var authService=require(_0x74d4('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x74d4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x74d4('0x15'));var config=require(_0x74d4('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x74d4('0x17'));var client=jayson[_0x74d4('0x18')][_0x74d4('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3cdabf,_0x21a01c,_0x1d7553){if(_0x1d7553){var _0x449e3e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x449e3e[_0x74d4('0x1a')](_0x21a01c)){return _0x3cdabf;}else{throw new Error(_0x74d4('0x1b'));}}else{return _0x3cdabf;}}function respondWithRpcPromise(_0x1049f4,_0x361ba8,_0x46464f,_0x1de8dc){return new BPromise(function(_0x576a93,_0x4047b5){var _0x13e7c9=_0x1de8dc||client;return _0x13e7c9[_0x74d4('0x1c')](_0x1049f4,_0x46464f)[_0x74d4('0x1d')](function(_0x448cbd){logger[_0x74d4('0x1e')](_0x74d4('0x1f'),_0x361ba8,_0x74d4('0x20'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x361ba8,_0x74d4('0x20'),JSON[_0x74d4('0x21')](_0x448cbd));if(_0x448cbd[_0x74d4('0x22')]){if(_0x448cbd[_0x74d4('0x22')][_0x74d4('0x23')]===0x1f4){logger[_0x74d4('0x22')](_0x74d4('0x1f'),_0x361ba8,_0x448cbd[_0x74d4('0x22')][_0x74d4('0x24')]);return _0x4047b5(_0x448cbd[_0x74d4('0x22')][_0x74d4('0x24')]);}logger[_0x74d4('0x22')](_0x74d4('0x1f'),_0x361ba8,_0x448cbd[_0x74d4('0x22')][_0x74d4('0x24')]);return _0x576a93(_0x448cbd['error'][_0x74d4('0x24')]);}else{logger[_0x74d4('0x1e')](_0x74d4('0x1f'),_0x361ba8,_0x74d4('0x20'));_0x576a93(_0x448cbd[_0x74d4('0x25')][_0x74d4('0x24')]);}})[_0x74d4('0x26')](function(_0x26184a){logger[_0x74d4('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x361ba8,_0x26184a);_0x4047b5(_0x26184a);});});}function respondWithStatusCode(_0x5995c5,_0x230fe1){_0x230fe1=_0x230fe1||0xcc;return function(_0x5989d1){if(_0x5989d1){return _0x5995c5[_0x74d4('0x27')](_0x230fe1);}return _0x5995c5[_0x74d4('0x28')](_0x230fe1)[_0x74d4('0x29')]();};}function respondWithResult(_0x5cf73e,_0x280395){_0x280395=_0x280395||0xc8;return function(_0x49df56){if(_0x49df56){return _0x5cf73e['status'](_0x280395)['json'](_0x49df56);}};}function respondWithFilteredResult(_0x481b01,_0x4cd36d){return function(_0x52b0fb){if(_0x52b0fb){var _0x2bf416=_0x52b0fb[_0x74d4('0x2a')],_0x325756=_0x4cd36d[_0x74d4('0x2b')],_0x17eff8=_0x4cd36d[_0x74d4('0x2b')]+_0x4cd36d['limit'],_0x4528c8;if(_0x17eff8>=_0x2bf416){_0x17eff8=_0x2bf416;_0x4528c8=0xc8;}else{_0x4528c8=0xce;}_0x481b01[_0x74d4('0x28')](_0x4528c8);return _0x481b01[_0x74d4('0x2c')](_0x74d4('0x2d'),_0x325756+'-'+_0x17eff8+'/'+_0x2bf416)[_0x74d4('0x2e')](_0x52b0fb);}return null;};}function patchUpdates(_0x5af71b){return function(_0x22cc21){try{jsonpatch[_0x74d4('0x2f')](_0x22cc21,_0x5af71b,!![]);}catch(_0x2b9f0b){return BPromise[_0x74d4('0x30')](_0x2b9f0b);}return _0x22cc21['save']();};}function saveUpdates(_0xce3617,_0x3d3547){return function(_0x53e92c){if(_0x53e92c){return _0x53e92c['update'](_0xce3617)['then'](function(_0x121134){return _0x121134;});}return null;};}function removeEntity(_0x5cf68c,_0x2108d5){return function(_0x31f94d){if(_0x31f94d){return _0x31f94d[_0x74d4('0x31')]()['then'](function(){_0x5cf68c['status'](0xcc)[_0x74d4('0x29')]();});}};}function handleEntityNotFound(_0x59a997,_0x52bff7){return function(_0x5a755d){if(!_0x5a755d){_0x59a997[_0x74d4('0x27')](0x194);}return _0x5a755d;};}function handleError(_0x53a7c2,_0x4f235e){_0x4f235e=_0x4f235e||0x1f4;return function(_0x4016e1){logger['error'](_0x4016e1[_0x74d4('0x32')]);if(_0x4016e1[_0x74d4('0x33')]){delete _0x4016e1[_0x74d4('0x33')];}_0x53a7c2['status'](_0x4f235e)[_0x74d4('0x34')](_0x4016e1);};}exports['index']=function(_0x56a21f,_0x254ee2){var _0x2abd22={},_0x2c1366={},_0x533b5a={'count':0x0,'rows':[]};var _0x4b694a=db['SalesforceConfiguration']['rawAttributes'];_0x2c1366[_0x74d4('0x35')]=_[_0x74d4('0x36')](_0x4b694a);_0x2c1366[_0x74d4('0x37')]=_[_0x74d4('0x36')](_0x56a21f[_0x74d4('0x37')]);_0x2c1366[_0x74d4('0x38')]=_['intersection'](_0x2c1366[_0x74d4('0x35')],_0x2c1366['query']);_0x2abd22[_0x74d4('0x39')]=_[_0x74d4('0x3a')](_0x2c1366['model'],qs[_0x74d4('0x3b')](_0x56a21f['query'][_0x74d4('0x3b')]));_0x2abd22[_0x74d4('0x39')]=_0x2abd22['attributes'][_0x74d4('0x3c')]?_0x2abd22[_0x74d4('0x39')]:_0x2c1366[_0x74d4('0x35')];if(!_0x56a21f[_0x74d4('0x37')][_0x74d4('0x3d')](_0x74d4('0x3e'))){_0x2abd22[_0x74d4('0x3f')]=qs[_0x74d4('0x3f')](_0x56a21f[_0x74d4('0x37')][_0x74d4('0x3f')]);_0x2abd22['offset']=qs[_0x74d4('0x2b')](_0x56a21f['query']['offset']);}_0x2abd22[_0x74d4('0x40')]=qs['sort'](_0x56a21f['query'][_0x74d4('0x41')]);_0x2abd22['where']=qs[_0x74d4('0x38')](_[_0x74d4('0x42')](_0x56a21f[_0x74d4('0x37')],_0x2c1366[_0x74d4('0x38')]));if(_0x56a21f[_0x74d4('0x37')][_0x74d4('0x43')]){_0x2abd22[_0x74d4('0x44')]=_[_0x74d4('0x45')](_0x2abd22[_0x74d4('0x44')],{'$or':_[_0x74d4('0x46')](_0x4b694a,function(_0x5d6910){if(_0x5d6910[_0x74d4('0x47')][_0x74d4('0x48')]!==_0x74d4('0x49')){var _0x4c2a71={};_0x4c2a71[_0x5d6910['field']]={'$like':'%'+_0x56a21f[_0x74d4('0x37')][_0x74d4('0x43')]+'%'};return _0x4c2a71;}})});}_0x2abd22=_[_0x74d4('0x45')]({},_0x2abd22,_0x56a21f[_0x74d4('0x4a')]);var _0x577394={'where':_0x2abd22[_0x74d4('0x44')]};return db['SalesforceConfiguration'][_0x74d4('0x2a')](_0x577394)['then'](function(_0x1e27d3){_0x533b5a[_0x74d4('0x2a')]=_0x1e27d3;if(_0x56a21f['query'][_0x74d4('0x4b')]){_0x2abd22[_0x74d4('0x4c')]=[{'all':!![]}];}return db[_0x74d4('0x4d')]['findAll'](_0x2abd22);})['then'](function(_0x203bed){_0x533b5a[_0x74d4('0x4e')]=_0x203bed;return _0x533b5a;})['then'](respondWithFilteredResult(_0x254ee2,_0x2abd22))[_0x74d4('0x26')](handleError(_0x254ee2,null));};exports[_0x74d4('0x4f')]=function(_0x21b9fd,_0x4e7e5c){var _0x5e6f4a={'raw':![],'where':{'id':_0x21b9fd[_0x74d4('0x50')]['id']}},_0x417de1={};_0x417de1[_0x74d4('0x35')]=_[_0x74d4('0x36')](db[_0x74d4('0x4d')][_0x74d4('0x51')]);_0x417de1[_0x74d4('0x37')]=_['keys'](_0x21b9fd[_0x74d4('0x37')]);_0x417de1[_0x74d4('0x38')]=_[_0x74d4('0x3a')](_0x417de1[_0x74d4('0x35')],_0x417de1[_0x74d4('0x37')]);_0x5e6f4a[_0x74d4('0x39')]=_[_0x74d4('0x3a')](_0x417de1[_0x74d4('0x35')],qs[_0x74d4('0x3b')](_0x21b9fd['query'][_0x74d4('0x3b')]));_0x5e6f4a['attributes']=_0x5e6f4a[_0x74d4('0x39')][_0x74d4('0x3c')]?_0x5e6f4a['attributes']:_0x417de1[_0x74d4('0x35')];if(_0x21b9fd['query'][_0x74d4('0x4b')]){_0x5e6f4a[_0x74d4('0x4c')]=[{'all':!![]}];}_0x5e6f4a=_[_0x74d4('0x45')]({},_0x5e6f4a,_0x21b9fd[_0x74d4('0x4a')]);return db[_0x74d4('0x4d')]['find'](_0x5e6f4a)[_0x74d4('0x1d')](handleEntityNotFound(_0x4e7e5c,null))[_0x74d4('0x1d')](respondWithResult(_0x4e7e5c,null))[_0x74d4('0x26')](handleError(_0x4e7e5c,null));};exports[_0x74d4('0x52')]=function(_0x57f0c9,_0x461d4b){return db[_0x74d4('0x4d')][_0x74d4('0x52')](_0x57f0c9[_0x74d4('0x53')],{})['then'](respondWithResult(_0x461d4b,0xc9))[_0x74d4('0x26')](handleError(_0x461d4b,null));};exports['update']=function(_0x5d9a7c,_0x1b2db2){if(_0x5d9a7c[_0x74d4('0x53')]['id']){delete _0x5d9a7c['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x5d9a7c[_0x74d4('0x50')]['id']}})[_0x74d4('0x1d')](handleEntityNotFound(_0x1b2db2,null))[_0x74d4('0x1d')](saveUpdates(_0x5d9a7c[_0x74d4('0x53')],null))[_0x74d4('0x1d')](respondWithResult(_0x1b2db2,null))['catch'](handleError(_0x1b2db2,null));};exports[_0x74d4('0x31')]=function(_0x1ceafe,_0x966ab2){return db[_0x74d4('0x4d')]['find']({'where':{'id':_0x1ceafe[_0x74d4('0x50')]['id']}})[_0x74d4('0x1d')](handleEntityNotFound(_0x966ab2,null))[_0x74d4('0x1d')](removeEntity(_0x966ab2,null))[_0x74d4('0x26')](handleError(_0x966ab2,null));};exports[_0x74d4('0x54')]=function(_0x5c2c59,_0xf1f6eb,_0x2094ab){var _0x3620e0={};var _0xff3e08={};var _0x32d942;var _0x55f0ac;return db['SalesforceConfiguration'][_0x74d4('0x55')]({'where':{'id':_0x5c2c59[_0x74d4('0x50')]['id']}})[_0x74d4('0x1d')](handleEntityNotFound(_0xf1f6eb,null))[_0x74d4('0x1d')](function(_0x598dd8){if(_0x598dd8){_0x32d942=_0x598dd8;_0xff3e08[_0x74d4('0x35')]=_[_0x74d4('0x36')](db[_0x74d4('0x56')][_0x74d4('0x51')]);_0xff3e08[_0x74d4('0x37')]=_[_0x74d4('0x36')](_0x5c2c59['query']);_0xff3e08[_0x74d4('0x38')]=_[_0x74d4('0x3a')](_0xff3e08['model'],_0xff3e08[_0x74d4('0x37')]);_0x3620e0[_0x74d4('0x39')]=_['intersection'](_0xff3e08[_0x74d4('0x35')],qs[_0x74d4('0x3b')](_0x5c2c59[_0x74d4('0x37')][_0x74d4('0x3b')]));_0x3620e0[_0x74d4('0x39')]=_0x3620e0[_0x74d4('0x39')][_0x74d4('0x3c')]?_0x3620e0[_0x74d4('0x39')]:_0xff3e08[_0x74d4('0x35')];_0x3620e0[_0x74d4('0x40')]=qs[_0x74d4('0x41')](_0x5c2c59['query'][_0x74d4('0x41')]);_0x3620e0['where']=qs[_0x74d4('0x38')](_[_0x74d4('0x42')](_0x5c2c59[_0x74d4('0x37')],_0xff3e08[_0x74d4('0x38')]));if(_0x5c2c59[_0x74d4('0x37')]['filter']){_0x3620e0[_0x74d4('0x44')]=_['merge'](_0x3620e0['where'],{'$or':_[_0x74d4('0x46')](_0x3620e0[_0x74d4('0x39')],function(_0x48472e){var _0x488bbf={};_0x488bbf[_0x48472e]={'$like':'%'+_0x5c2c59[_0x74d4('0x37')][_0x74d4('0x43')]+'%'};return _0x488bbf;})});}_0x3620e0=_[_0x74d4('0x45')]({},_0x3620e0,_0x5c2c59[_0x74d4('0x4a')]);return _0x32d942[_0x74d4('0x54')](_0x3620e0);}})[_0x74d4('0x1d')](function(_0x3db248){if(_0x3db248){_0x55f0ac=_0x3db248[_0x74d4('0x3c')];if(!_0x5c2c59[_0x74d4('0x37')][_0x74d4('0x3d')](_0x74d4('0x3e'))){_0x3620e0['limit']=qs[_0x74d4('0x3f')](_0x5c2c59['query']['limit']);_0x3620e0[_0x74d4('0x2b')]=qs[_0x74d4('0x2b')](_0x5c2c59[_0x74d4('0x37')]['offset']);}return _0x32d942['getFields'](_0x3620e0);}})['then'](function(_0x9286bd){if(_0x9286bd){return _0x9286bd?{'count':_0x55f0ac,'rows':_0x9286bd}:null;}})[_0x74d4('0x1d')](respondWithResult(_0xf1f6eb,null))[_0x74d4('0x26')](handleError(_0xf1f6eb,null));};exports[_0x74d4('0x57')]=function(_0x46e1ec,_0x5cd266,_0x4e60e0){var _0x445076={};var _0x1efa15={};var _0x185f00;var _0x64eee6;return db[_0x74d4('0x4d')][_0x74d4('0x55')]({'where':{'id':_0x46e1ec[_0x74d4('0x50')]['id']}})[_0x74d4('0x1d')](handleEntityNotFound(_0x5cd266,null))['then'](function(_0x1a1407){if(_0x1a1407){_0x185f00=_0x1a1407;_0x1efa15[_0x74d4('0x35')]=_['keys'](db[_0x74d4('0x56')]['rawAttributes']);_0x1efa15['query']=_[_0x74d4('0x36')](_0x46e1ec[_0x74d4('0x37')]);_0x1efa15[_0x74d4('0x38')]=_[_0x74d4('0x3a')](_0x1efa15[_0x74d4('0x35')],_0x1efa15['query']);_0x445076[_0x74d4('0x39')]=_['intersection'](_0x1efa15[_0x74d4('0x35')],qs['fields'](_0x46e1ec['query']['fields']));_0x445076[_0x74d4('0x39')]=_0x445076[_0x74d4('0x39')][_0x74d4('0x3c')]?_0x445076[_0x74d4('0x39')]:_0x1efa15[_0x74d4('0x35')];_0x445076[_0x74d4('0x40')]=qs[_0x74d4('0x41')](_0x46e1ec[_0x74d4('0x37')][_0x74d4('0x41')]);_0x445076[_0x74d4('0x44')]=qs['filters'](_[_0x74d4('0x42')](_0x46e1ec[_0x74d4('0x37')],_0x1efa15[_0x74d4('0x38')]));if(_0x46e1ec['query'][_0x74d4('0x43')]){_0x445076[_0x74d4('0x44')]=_['merge'](_0x445076[_0x74d4('0x44')],{'$or':_[_0x74d4('0x46')](_0x445076[_0x74d4('0x39')],function(_0x267dc4){var _0xa42a6a={};_0xa42a6a[_0x267dc4]={'$like':'%'+_0x46e1ec[_0x74d4('0x37')][_0x74d4('0x43')]+'%'};return _0xa42a6a;})});}_0x445076=_[_0x74d4('0x45')]({},_0x445076,_0x46e1ec[_0x74d4('0x4a')]);return _0x185f00[_0x74d4('0x57')](_0x445076);}})[_0x74d4('0x1d')](function(_0x45f451){if(_0x45f451){_0x64eee6=_0x45f451[_0x74d4('0x3c')];if(!_0x46e1ec[_0x74d4('0x37')][_0x74d4('0x3d')](_0x74d4('0x3e'))){_0x445076[_0x74d4('0x3f')]=qs['limit'](_0x46e1ec['query'][_0x74d4('0x3f')]);_0x445076[_0x74d4('0x2b')]=qs['offset'](_0x46e1ec[_0x74d4('0x37')][_0x74d4('0x2b')]);}return _0x185f00['getSubjects'](_0x445076);}})[_0x74d4('0x1d')](function(_0x2e0761){if(_0x2e0761){return _0x2e0761?{'count':_0x64eee6,'rows':_0x2e0761}:null;}})[_0x74d4('0x1d')](respondWithResult(_0x5cd266,null))[_0x74d4('0x26')](handleError(_0x5cd266,null));};exports[_0x74d4('0x58')]=function(_0x32304b,_0x2d4166,_0x362bd9){var _0x25c1b8={};var _0x14ec59={};var _0x1c6372;var _0x455069;return db['SalesforceConfiguration'][_0x74d4('0x55')]({'where':{'id':_0x32304b[_0x74d4('0x50')]['id']}})[_0x74d4('0x1d')](handleEntityNotFound(_0x2d4166,null))[_0x74d4('0x1d')](function(_0x1fe7cf){if(_0x1fe7cf){_0x1c6372=_0x1fe7cf;_0x14ec59[_0x74d4('0x35')]=_[_0x74d4('0x36')](db[_0x74d4('0x56')][_0x74d4('0x51')]);_0x14ec59['query']=_[_0x74d4('0x36')](_0x32304b[_0x74d4('0x37')]);_0x14ec59['filters']=_[_0x74d4('0x3a')](_0x14ec59[_0x74d4('0x35')],_0x14ec59[_0x74d4('0x37')]);_0x25c1b8[_0x74d4('0x39')]=_[_0x74d4('0x3a')](_0x14ec59[_0x74d4('0x35')],qs[_0x74d4('0x3b')](_0x32304b[_0x74d4('0x37')][_0x74d4('0x3b')]));_0x25c1b8[_0x74d4('0x39')]=_0x25c1b8[_0x74d4('0x39')][_0x74d4('0x3c')]?_0x25c1b8[_0x74d4('0x39')]:_0x14ec59[_0x74d4('0x35')];_0x25c1b8[_0x74d4('0x40')]=qs[_0x74d4('0x41')](_0x32304b[_0x74d4('0x37')][_0x74d4('0x41')]);_0x25c1b8['where']=qs[_0x74d4('0x38')](_['pick'](_0x32304b[_0x74d4('0x37')],_0x14ec59[_0x74d4('0x38')]));if(_0x32304b[_0x74d4('0x37')]['filter']){_0x25c1b8[_0x74d4('0x44')]=_[_0x74d4('0x45')](_0x25c1b8[_0x74d4('0x44')],{'$or':_[_0x74d4('0x46')](_0x25c1b8['attributes'],function(_0x5a4a6a){var _0x1adc00={};_0x1adc00[_0x5a4a6a]={'$like':'%'+_0x32304b[_0x74d4('0x37')][_0x74d4('0x43')]+'%'};return _0x1adc00;})});}_0x25c1b8=_['merge']({},_0x25c1b8,_0x32304b['options']);return _0x1c6372[_0x74d4('0x58')](_0x25c1b8);}})['then'](function(_0x130427){if(_0x130427){_0x455069=_0x130427[_0x74d4('0x3c')];if(!_0x32304b['query'][_0x74d4('0x3d')]('nolimit')){_0x25c1b8[_0x74d4('0x3f')]=qs['limit'](_0x32304b[_0x74d4('0x37')]['limit']);_0x25c1b8[_0x74d4('0x2b')]=qs[_0x74d4('0x2b')](_0x32304b[_0x74d4('0x37')][_0x74d4('0x2b')]);}return _0x1c6372[_0x74d4('0x58')](_0x25c1b8);}})['then'](function(_0x1f1b25){if(_0x1f1b25){return _0x1f1b25?{'count':_0x455069,'rows':_0x1f1b25}:null;}})[_0x74d4('0x1d')](respondWithResult(_0x2d4166,null))['catch'](handleError(_0x2d4166,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3f6ce9c..9f8cd10 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 _0x90a3=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','lodash','util','bluebird','request-promise'];(function(_0x2630f3,_0x53de9d){var _0x3ab661=function(_0x25e01b){while(--_0x25e01b){_0x2630f3['push'](_0x2630f3['shift']());}};_0x3ab661(++_0x53de9d);}(_0x90a3,0x8c));var _0x390a=function(_0xcbf6ff,_0x4aefdd){_0xcbf6ff=_0xcbf6ff-0x0;var _0x4de327=_0x90a3[_0xcbf6ff];return _0x4de327;};'use strict';var _=require(_0x390a('0x0'));var util=require(_0x390a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x390a('0x2'));var rp=require(_0x390a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x390a('0x4'));var config=require(_0x390a('0x5'));var attributes=require(_0x390a('0x6'));module[_0x390a('0x7')]=function(_0xbdba34,_0x10080f){return _0xbdba34[_0x390a('0x8')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1b=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x233eab,_0x5c910f){var _0x288cc3=function(_0x399690){while(--_0x399690){_0x233eab['push'](_0x233eab['shift']());}};_0x288cc3(++_0x5c910f);}(_0x3e1b,0x6c));var _0xb3e1=function(_0x1380f7,_0x23614a){_0x1380f7=_0x1380f7-0x0;var _0x12c94b=_0x3e1b[_0x1380f7];return _0x12c94b;};'use strict';var _=require(_0xb3e1('0x0'));var util=require(_0xb3e1('0x1'));var logger=require(_0xb3e1('0x2'))('api');var moment=require(_0xb3e1('0x3'));var BPromise=require(_0xb3e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3e1('0x5'));var rimraf=require(_0xb3e1('0x6'));var config=require(_0xb3e1('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xb3e1('0x8')]=function(_0x456439,_0x46d8f1){return _0x456439['define'](_0xb3e1('0x9'),attributes,{'tableName':_0xb3e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 070195d..60bce33 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x34adab,_0x165f04){var _0x314227=function(_0x25c2fd){while(--_0x25c2fd){_0x34adab['push'](_0x34adab['shift']());}};_0x314227(++_0x165f04);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x5fc3[_0x1d7037];return _0x4d6568;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x1261=['then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x41b234,_0x3852a3){var _0x1a8ec9=function(_0x449e68){while(--_0x449e68){_0x41b234['push'](_0x41b234['shift']());}};_0x1a8ec9(++_0x3852a3);}(_0x1261,0x144));var _0x1126=function(_0x1b9cd5,_0x103dc4){_0x1b9cd5=_0x1b9cd5-0x0;var _0x4c74ca=_0x1261[_0x1b9cd5];return _0x4c74ca;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 94d8db3..e6428d5 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 _0xe8a4=['express','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xe8a4,0x18d));var _0x4e8a=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe8a4[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x4e8a('0x0'));var util=require('util');var path=require(_0x4e8a('0x1'));var timeout=require(_0x4e8a('0x2'));var express=require(_0x4e8a('0x3'));var router=express['Router']();var auth=require(_0x4e8a('0x4'));var interaction=require(_0x4e8a('0x5'));var config=require('../../config/environment');var controller=require(_0x4e8a('0x6'));router[_0x4e8a('0x7')]('/',auth[_0x4e8a('0x8')](),controller['index']);router[_0x4e8a('0x7')](_0x4e8a('0x9'),auth['isAuthenticated'](),controller[_0x4e8a('0xa')]);router[_0x4e8a('0xb')]('/',auth['isAuthenticated'](),controller[_0x4e8a('0xc')]);router['put'](_0x4e8a('0x9'),auth[_0x4e8a('0x8')](),controller['update']);router[_0x4e8a('0xd')](_0x4e8a('0x9'),auth[_0x4e8a('0x8')](),controller[_0x4e8a('0xe')]);module[_0x4e8a('0xf')]=router; \ No newline at end of file +var _0x79a3=['/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x79a3,0x1f4));var _0x379a=function(_0x1bd251,_0x338d85){_0x1bd251=_0x1bd251-0x0;var _0x29ef4c=_0x79a3[_0x1bd251];return _0x29ef4c;};'use strict';var multer=require(_0x379a('0x0'));var util=require(_0x379a('0x1'));var path=require('path');var timeout=require(_0x379a('0x2'));var express=require('express');var router=express[_0x379a('0x3')]();var auth=require(_0x379a('0x4'));var interaction=require(_0x379a('0x5'));var config=require(_0x379a('0x6'));var controller=require(_0x379a('0x7'));router[_0x379a('0x8')]('/',auth['isAuthenticated'](),controller[_0x379a('0x9')]);router[_0x379a('0x8')](_0x379a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x379a('0xb')]('/',auth[_0x379a('0xc')](),controller['create']);router['put'](_0x379a('0xa'),auth[_0x379a('0xc')](),controller[_0x379a('0xd')]);router[_0x379a('0xe')](_0x379a('0xa'),auth['isAuthenticated'](),controller[_0x379a('0xf')]);module[_0x379a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index aebbaeb..3fae334 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 _0xd84e=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x30ba61,_0x48b905){var _0x7300ad=function(_0x3b4f73){while(--_0x3b4f73){_0x30ba61['push'](_0x30ba61['shift']());}};_0x7300ad(++_0x48b905);}(_0xd84e,0x99));var _0xed84=function(_0x317b44,_0xe8cb7b){_0x317b44=_0x317b44-0x0;var _0x596d98=_0xd84e[_0x317b44];return _0x596d98;};'use strict';var Sequelize=require(_0xed84('0x0'));module[_0xed84('0x1')]={'type':{'type':Sequelize[_0xed84('0x2')](_0xed84('0x3'),_0xed84('0x4'),_0xed84('0x5'),_0xed84('0x6')),'defaultValue':_0xed84('0x3')},'content':{'type':Sequelize[_0xed84('0x7')]},'key':{'type':Sequelize[_0xed84('0x7')]},'keyType':{'type':Sequelize[_0xed84('0x2')](_0xed84('0x3'),'variable',_0xed84('0x5'))},'keyContent':{'type':Sequelize[_0xed84('0x7')]},'idField':{'type':Sequelize[_0xed84('0x7')]},'variableName':{'type':Sequelize[_0xed84('0x7')]}}; \ No newline at end of file +var _0x7492=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x5b7db1,_0x43492f){var _0x2d9a57=function(_0x3a2154){while(--_0x3a2154){_0x5b7db1['push'](_0x5b7db1['shift']());}};_0x2d9a57(++_0x43492f);}(_0x7492,0x175));var _0x2749=function(_0x3a162e,_0x2b1d7b){_0x3a162e=_0x3a162e-0x0;var _0x915ad=_0x7492[_0x3a162e];return _0x915ad;};'use strict';var Sequelize=require(_0x2749('0x0'));module[_0x2749('0x1')]={'type':{'type':Sequelize[_0x2749('0x2')](_0x2749('0x3'),_0x2749('0x4'),_0x2749('0x5'),_0x2749('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2749('0x7')]},'key':{'type':Sequelize[_0x2749('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x2749('0x3'),_0x2749('0x4'),_0x2749('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2749('0x7')]},'variableName':{'type':Sequelize[_0x2749('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e4b64f8..eb357bd 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 _0xd13e=['bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','rawAttributes','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','map','type','key','SalesforceField','include','findAll','catch','show','params','includeAll','options','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x4824c1,_0x2657fa){var _0x7cd05a=function(_0x6c3aa9){while(--_0x6c3aa9){_0x4824c1['push'](_0x4824c1['shift']());}};_0x7cd05a(++_0x2657fa);}(_0xd13e,0x193));var _0xed13=function(_0x4504e3,_0x428c1a){_0x4504e3=_0x4504e3-0x0;var _0x3f9e5a=_0xd13e[_0x4504e3];return _0x3f9e5a;};'use strict';var pdf=require(_0xed13('0x0'));var emlformat=require(_0xed13('0x1'));var rimraf=require(_0xed13('0x2'));var zipdir=require(_0xed13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed13('0x4'));var moment=require('moment');var BPromise=require(_0xed13('0x5'));var Mustache=require('mustache');var util=require(_0xed13('0x6'));var path=require(_0xed13('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var hardwareService=require(_0xed13('0x12'));var logger=require(_0xed13('0x13'))(_0xed13('0x14'));var utils=require(_0xed13('0x15'));var config=require('../../config/environment');var db=require(_0xed13('0x16'))['db'];function respondWithStatusCode(_0x18d7f9,_0x2c68db){_0x2c68db=_0x2c68db||0xcc;return function(_0x3c0b22){if(_0x3c0b22){return _0x18d7f9[_0xed13('0x17')](_0x2c68db);}return _0x18d7f9[_0xed13('0x18')](_0x2c68db)['end']();};}function respondWithResult(_0xdee482,_0x4a3ff4){_0x4a3ff4=_0x4a3ff4||0xc8;return function(_0x257074){if(_0x257074){return _0xdee482['status'](_0x4a3ff4)[_0xed13('0x19')](_0x257074);}};}function respondWithFilteredResult(_0x56108d,_0x1de882){return function(_0x4d5435){if(_0x4d5435){var _0x38901a=_0x4d5435[_0xed13('0x1a')],_0xf900d2=_0x1de882[_0xed13('0x1b')],_0x1d3d67=_0x1de882[_0xed13('0x1b')]+_0x1de882[_0xed13('0x1c')],_0xa260ed;if(_0x1d3d67>=_0x38901a){_0x1d3d67=_0x38901a;_0xa260ed=0xc8;}else{_0xa260ed=0xce;}_0x56108d[_0xed13('0x18')](_0xa260ed);return _0x56108d[_0xed13('0x1d')](_0xed13('0x1e'),_0xf900d2+'-'+_0x1d3d67+'/'+_0x38901a)[_0xed13('0x19')](_0x4d5435);}return null;};}function patchUpdates(_0x2893d2){return function(_0xaa6f5){try{jsonpatch[_0xed13('0x1f')](_0xaa6f5,_0x2893d2,!![]);}catch(_0x2f38c9){return BPromise['reject'](_0x2f38c9);}return _0xaa6f5['save']();};}function saveUpdates(_0x1f3646,_0xfd0dd5){return function(_0x4f455b){if(_0x4f455b){return _0x4f455b[_0xed13('0x20')](_0x1f3646)['then'](function(_0x4e9e3b){return _0x4e9e3b;});}return null;};}function removeEntity(_0x3b5b1e,_0x3a2b76){return function(_0x2d62cd){if(_0x2d62cd){return _0x2d62cd[_0xed13('0x21')]()[_0xed13('0x22')](function(){_0x3b5b1e[_0xed13('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0daf,_0x5d7ae1){return function(_0x19d51b){if(!_0x19d51b){_0x5c0daf[_0xed13('0x17')](0x194);}return _0x19d51b;};}function handleError(_0x3f5b68,_0x3898d9){_0x3898d9=_0x3898d9||0x1f4;return function(_0x1a0458){logger[_0xed13('0x23')](_0x1a0458[_0xed13('0x24')]);if(_0x1a0458[_0xed13('0x25')]){delete _0x1a0458[_0xed13('0x25')];}_0x3f5b68[_0xed13('0x18')](_0x3898d9)[_0xed13('0x26')](_0x1a0458);};}exports[_0xed13('0x27')]=function(_0x2c6c33,_0x322fc3){var _0x4e03d1={},_0x5e399c={},_0x12a019={'count':0x0,'rows':[]};var _0x2ebdf6=db['SalesforceField'][_0xed13('0x28')];_0x5e399c[_0xed13('0x29')]=_['keys'](_0x2ebdf6);_0x5e399c[_0xed13('0x2a')]=_[_0xed13('0x2b')](_0x2c6c33[_0xed13('0x2a')]);_0x5e399c['filters']=_[_0xed13('0x2c')](_0x5e399c[_0xed13('0x29')],_0x5e399c['query']);_0x4e03d1[_0xed13('0x2d')]=_[_0xed13('0x2c')](_0x5e399c['model'],qs[_0xed13('0x2e')](_0x2c6c33[_0xed13('0x2a')][_0xed13('0x2e')]));_0x4e03d1[_0xed13('0x2d')]=_0x4e03d1[_0xed13('0x2d')][_0xed13('0x2f')]?_0x4e03d1[_0xed13('0x2d')]:_0x5e399c['model'];if(!_0x2c6c33[_0xed13('0x2a')]['hasOwnProperty']('nolimit')){_0x4e03d1[_0xed13('0x1c')]=qs[_0xed13('0x1c')](_0x2c6c33[_0xed13('0x2a')]['limit']);_0x4e03d1[_0xed13('0x1b')]=qs[_0xed13('0x1b')](_0x2c6c33[_0xed13('0x2a')]['offset']);}_0x4e03d1[_0xed13('0x30')]=qs[_0xed13('0x31')](_0x2c6c33[_0xed13('0x2a')][_0xed13('0x31')]);_0x4e03d1['where']=qs[_0xed13('0x32')](_[_0xed13('0x33')](_0x2c6c33[_0xed13('0x2a')],_0x5e399c[_0xed13('0x32')]));if(_0x2c6c33[_0xed13('0x2a')][_0xed13('0x34')]){_0x4e03d1[_0xed13('0x35')]=_[_0xed13('0x36')](_0x4e03d1[_0xed13('0x35')],{'$or':_[_0xed13('0x37')](_0x2ebdf6,function(_0x5a09e4){if(_0x5a09e4[_0xed13('0x38')][_0xed13('0x39')]!=='VIRTUAL'){var _0x59218d={};_0x59218d[_0x5a09e4['field']]={'$like':'%'+_0x2c6c33[_0xed13('0x2a')][_0xed13('0x34')]+'%'};return _0x59218d;}})});}_0x4e03d1=_['merge']({},_0x4e03d1,_0x2c6c33['options']);var _0x1781c6={'where':_0x4e03d1[_0xed13('0x35')]};return db[_0xed13('0x3a')][_0xed13('0x1a')](_0x1781c6)[_0xed13('0x22')](function(_0x49bf50){_0x12a019['count']=_0x49bf50;if(_0x2c6c33[_0xed13('0x2a')]['includeAll']){_0x4e03d1[_0xed13('0x3b')]=[{'all':!![]}];}return db['SalesforceField'][_0xed13('0x3c')](_0x4e03d1);})['then'](function(_0x4d6429){_0x12a019['rows']=_0x4d6429;return _0x12a019;})[_0xed13('0x22')](respondWithFilteredResult(_0x322fc3,_0x4e03d1))[_0xed13('0x3d')](handleError(_0x322fc3,null));};exports[_0xed13('0x3e')]=function(_0x42d5f7,_0x2d29aa){var _0x56ae05={'raw':!![],'where':{'id':_0x42d5f7[_0xed13('0x3f')]['id']}},_0xb52363={};_0xb52363[_0xed13('0x29')]=_[_0xed13('0x2b')](db[_0xed13('0x3a')]['rawAttributes']);_0xb52363[_0xed13('0x2a')]=_[_0xed13('0x2b')](_0x42d5f7[_0xed13('0x2a')]);_0xb52363[_0xed13('0x32')]=_[_0xed13('0x2c')](_0xb52363[_0xed13('0x29')],_0xb52363['query']);_0x56ae05[_0xed13('0x2d')]=_[_0xed13('0x2c')](_0xb52363[_0xed13('0x29')],qs[_0xed13('0x2e')](_0x42d5f7[_0xed13('0x2a')][_0xed13('0x2e')]));_0x56ae05[_0xed13('0x2d')]=_0x56ae05[_0xed13('0x2d')][_0xed13('0x2f')]?_0x56ae05[_0xed13('0x2d')]:_0xb52363[_0xed13('0x29')];if(_0x42d5f7[_0xed13('0x2a')][_0xed13('0x40')]){_0x56ae05[_0xed13('0x3b')]=[{'all':!![]}];}_0x56ae05=_['merge']({},_0x56ae05,_0x42d5f7[_0xed13('0x41')]);return db[_0xed13('0x3a')]['find'](_0x56ae05)[_0xed13('0x22')](handleEntityNotFound(_0x2d29aa,null))[_0xed13('0x22')](respondWithResult(_0x2d29aa,null))[_0xed13('0x3d')](handleError(_0x2d29aa,null));};exports['create']=function(_0x257d8b,_0x2afab0){return db[_0xed13('0x3a')]['create'](_0x257d8b['body'],{})[_0xed13('0x22')](respondWithResult(_0x2afab0,0xc9))[_0xed13('0x3d')](handleError(_0x2afab0,null));};exports['update']=function(_0x848f0f,_0x3c0dd9){if(_0x848f0f[_0xed13('0x42')]['id']){delete _0x848f0f[_0xed13('0x42')]['id'];}return db['SalesforceField'][_0xed13('0x43')]({'where':{'id':_0x848f0f[_0xed13('0x3f')]['id']}})[_0xed13('0x22')](handleEntityNotFound(_0x3c0dd9,null))[_0xed13('0x22')](saveUpdates(_0x848f0f['body'],null))[_0xed13('0x22')](respondWithResult(_0x3c0dd9,null))['catch'](handleError(_0x3c0dd9,null));};exports[_0xed13('0x21')]=function(_0x50d12f,_0x5a0828){return db[_0xed13('0x3a')][_0xed13('0x43')]({'where':{'id':_0x50d12f['params']['id']}})[_0xed13('0x22')](handleEntityNotFound(_0x5a0828,null))[_0xed13('0x22')](removeEntity(_0x5a0828,null))[_0xed13('0x3d')](handleError(_0x5a0828,null));}; \ No newline at end of file +var _0x6011=['include','find','create','body','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','type','field','options','SalesforceField','count','findAll','rows','catch','show','params','includeAll'];(function(_0x19e3c9,_0x2fb0c3){var _0x377fc9=function(_0x5bd928){while(--_0x5bd928){_0x19e3c9['push'](_0x19e3c9['shift']());}};_0x377fc9(++_0x2fb0c3);}(_0x6011,0x196));var _0x1601=function(_0x1ec1e5,_0x5e968a){_0x1ec1e5=_0x1ec1e5-0x0;var _0x393ca2=_0x6011[_0x1ec1e5];return _0x393ca2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1601('0x0'));var moment=require(_0x1601('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1601('0x2'));var util=require(_0x1601('0x3'));var path=require(_0x1601('0x4'));var sox=require(_0x1601('0x5'));var csv=require(_0x1601('0x6'));var ejs=require(_0x1601('0x7'));var fs=require('fs');var _=require(_0x1601('0x8'));var squel=require(_0x1601('0x9'));var crypto=require(_0x1601('0xa'));var jsforce=require(_0x1601('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1601('0x6'));var querystring=require(_0x1601('0xc'));var Papa=require(_0x1601('0xd'));var Redis=require(_0x1601('0xe'));var authService=require(_0x1601('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1601('0x10'));var utils=require('../../config/utils');var config=require(_0x1601('0x11'));var db=require(_0x1601('0x12'))['db'];function respondWithStatusCode(_0x14db9f,_0x24cc39){_0x24cc39=_0x24cc39||0xcc;return function(_0x263bef){if(_0x263bef){return _0x14db9f[_0x1601('0x13')](_0x24cc39);}return _0x14db9f[_0x1601('0x14')](_0x24cc39)[_0x1601('0x15')]();};}function respondWithResult(_0x5da646,_0x11bbe5){_0x11bbe5=_0x11bbe5||0xc8;return function(_0x555d4f){if(_0x555d4f){return _0x5da646[_0x1601('0x14')](_0x11bbe5)['json'](_0x555d4f);}};}function respondWithFilteredResult(_0x2f0837,_0x3b6554){return function(_0x4bb5c1){if(_0x4bb5c1){var _0x1b40be=_0x4bb5c1['count'],_0x39873a=_0x3b6554[_0x1601('0x16')],_0x12ddb0=_0x3b6554[_0x1601('0x16')]+_0x3b6554[_0x1601('0x17')],_0x595c96;if(_0x12ddb0>=_0x1b40be){_0x12ddb0=_0x1b40be;_0x595c96=0xc8;}else{_0x595c96=0xce;}_0x2f0837[_0x1601('0x14')](_0x595c96);return _0x2f0837[_0x1601('0x18')](_0x1601('0x19'),_0x39873a+'-'+_0x12ddb0+'/'+_0x1b40be)[_0x1601('0x1a')](_0x4bb5c1);}return null;};}function patchUpdates(_0x3ae0c6){return function(_0x1ce2b2){try{jsonpatch['apply'](_0x1ce2b2,_0x3ae0c6,!![]);}catch(_0x4d077e){return BPromise[_0x1601('0x1b')](_0x4d077e);}return _0x1ce2b2[_0x1601('0x1c')]();};}function saveUpdates(_0xb09057,_0x5bd8fb){return function(_0x2c3b5d){if(_0x2c3b5d){return _0x2c3b5d[_0x1601('0x1d')](_0xb09057)[_0x1601('0x1e')](function(_0x2e2e0d){return _0x2e2e0d;});}return null;};}function removeEntity(_0x3fa19f,_0x54398a){return function(_0x1b8314){if(_0x1b8314){return _0x1b8314[_0x1601('0x1f')]()[_0x1601('0x1e')](function(){_0x3fa19f['status'](0xcc)[_0x1601('0x15')]();});}};}function handleEntityNotFound(_0x330033,_0x4f918b){return function(_0x2b01da){if(!_0x2b01da){_0x330033[_0x1601('0x13')](0x194);}return _0x2b01da;};}function handleError(_0x5c9543,_0x5ae062){_0x5ae062=_0x5ae062||0x1f4;return function(_0x65fb4f){logger[_0x1601('0x20')](_0x65fb4f[_0x1601('0x21')]);if(_0x65fb4f['name']){delete _0x65fb4f[_0x1601('0x22')];}_0x5c9543[_0x1601('0x14')](_0x5ae062)[_0x1601('0x23')](_0x65fb4f);};}exports[_0x1601('0x24')]=function(_0x296c34,_0x47ed39){var _0x4b2f0d={},_0x1fa0a6={},_0x1aef35={'count':0x0,'rows':[]};var _0x18509c=db['SalesforceField'][_0x1601('0x25')];_0x1fa0a6['model']=_[_0x1601('0x26')](_0x18509c);_0x1fa0a6[_0x1601('0x27')]=_[_0x1601('0x26')](_0x296c34['query']);_0x1fa0a6[_0x1601('0x28')]=_[_0x1601('0x29')](_0x1fa0a6[_0x1601('0x2a')],_0x1fa0a6[_0x1601('0x27')]);_0x4b2f0d['attributes']=_[_0x1601('0x29')](_0x1fa0a6[_0x1601('0x2a')],qs[_0x1601('0x2b')](_0x296c34[_0x1601('0x27')][_0x1601('0x2b')]));_0x4b2f0d[_0x1601('0x2c')]=_0x4b2f0d[_0x1601('0x2c')][_0x1601('0x2d')]?_0x4b2f0d[_0x1601('0x2c')]:_0x1fa0a6[_0x1601('0x2a')];if(!_0x296c34[_0x1601('0x27')][_0x1601('0x2e')](_0x1601('0x2f'))){_0x4b2f0d['limit']=qs[_0x1601('0x17')](_0x296c34[_0x1601('0x27')][_0x1601('0x17')]);_0x4b2f0d[_0x1601('0x16')]=qs[_0x1601('0x16')](_0x296c34['query'][_0x1601('0x16')]);}_0x4b2f0d[_0x1601('0x30')]=qs['sort'](_0x296c34[_0x1601('0x27')]['sort']);_0x4b2f0d[_0x1601('0x31')]=qs[_0x1601('0x28')](_['pick'](_0x296c34[_0x1601('0x27')],_0x1fa0a6[_0x1601('0x28')]));if(_0x296c34[_0x1601('0x27')][_0x1601('0x32')]){_0x4b2f0d[_0x1601('0x31')]=_[_0x1601('0x33')](_0x4b2f0d[_0x1601('0x31')],{'$or':_['map'](_0x18509c,function(_0x39da55){if(_0x39da55[_0x1601('0x34')]['key']!=='VIRTUAL'){var _0x431439={};_0x431439[_0x39da55[_0x1601('0x35')]]={'$like':'%'+_0x296c34[_0x1601('0x27')][_0x1601('0x32')]+'%'};return _0x431439;}})});}_0x4b2f0d=_[_0x1601('0x33')]({},_0x4b2f0d,_0x296c34[_0x1601('0x36')]);var _0x36d496={'where':_0x4b2f0d['where']};return db[_0x1601('0x37')][_0x1601('0x38')](_0x36d496)['then'](function(_0x5c79d2){_0x1aef35[_0x1601('0x38')]=_0x5c79d2;if(_0x296c34['query']['includeAll']){_0x4b2f0d['include']=[{'all':!![]}];}return db[_0x1601('0x37')][_0x1601('0x39')](_0x4b2f0d);})[_0x1601('0x1e')](function(_0xb8146e){_0x1aef35[_0x1601('0x3a')]=_0xb8146e;return _0x1aef35;})[_0x1601('0x1e')](respondWithFilteredResult(_0x47ed39,_0x4b2f0d))[_0x1601('0x3b')](handleError(_0x47ed39,null));};exports[_0x1601('0x3c')]=function(_0x388f3b,_0x2b829a){var _0x3cc562={'raw':!![],'where':{'id':_0x388f3b[_0x1601('0x3d')]['id']}},_0x3acb2d={};_0x3acb2d['model']=_[_0x1601('0x26')](db['SalesforceField']['rawAttributes']);_0x3acb2d['query']=_[_0x1601('0x26')](_0x388f3b[_0x1601('0x27')]);_0x3acb2d[_0x1601('0x28')]=_['intersection'](_0x3acb2d['model'],_0x3acb2d[_0x1601('0x27')]);_0x3cc562[_0x1601('0x2c')]=_[_0x1601('0x29')](_0x3acb2d['model'],qs[_0x1601('0x2b')](_0x388f3b['query'][_0x1601('0x2b')]));_0x3cc562[_0x1601('0x2c')]=_0x3cc562[_0x1601('0x2c')][_0x1601('0x2d')]?_0x3cc562['attributes']:_0x3acb2d[_0x1601('0x2a')];if(_0x388f3b['query'][_0x1601('0x3e')]){_0x3cc562[_0x1601('0x3f')]=[{'all':!![]}];}_0x3cc562=_['merge']({},_0x3cc562,_0x388f3b[_0x1601('0x36')]);return db[_0x1601('0x37')][_0x1601('0x40')](_0x3cc562)['then'](handleEntityNotFound(_0x2b829a,null))[_0x1601('0x1e')](respondWithResult(_0x2b829a,null))['catch'](handleError(_0x2b829a,null));};exports[_0x1601('0x41')]=function(_0x2391a1,_0x419e97){return db[_0x1601('0x37')][_0x1601('0x41')](_0x2391a1[_0x1601('0x42')],{})[_0x1601('0x1e')](respondWithResult(_0x419e97,0xc9))[_0x1601('0x3b')](handleError(_0x419e97,null));};exports[_0x1601('0x1d')]=function(_0x4a710f,_0x143c82){if(_0x4a710f['body']['id']){delete _0x4a710f[_0x1601('0x42')]['id'];}return db[_0x1601('0x37')]['find']({'where':{'id':_0x4a710f[_0x1601('0x3d')]['id']}})[_0x1601('0x1e')](handleEntityNotFound(_0x143c82,null))['then'](saveUpdates(_0x4a710f[_0x1601('0x42')],null))[_0x1601('0x1e')](respondWithResult(_0x143c82,null))[_0x1601('0x3b')](handleError(_0x143c82,null));};exports[_0x1601('0x1f')]=function(_0x30f2bf,_0xf14c98){return db[_0x1601('0x37')][_0x1601('0x40')]({'where':{'id':_0x30f2bf[_0x1601('0x3d')]['id']}})[_0x1601('0x1e')](handleEntityNotFound(_0xf14c98,null))['then'](removeEntity(_0xf14c98,null))[_0x1601('0x3b')](handleError(_0xf14c98,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ec9e5a7..95570af 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 _0xab12=['SalesforceField','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x2d15de,_0x4151b5){var _0x95f0f6=function(_0x1f79ed){while(--_0x1f79ed){_0x2d15de['push'](_0x2d15de['shift']());}};_0x95f0f6(++_0x4151b5);}(_0xab12,0x189));var _0x2ab1=function(_0x323ffb,_0x4b9a09){_0x323ffb=_0x323ffb-0x0;var _0x40f0fd=_0xab12[_0x323ffb];return _0x40f0fd;};'use strict';var _=require(_0x2ab1('0x0'));var util=require('util');var logger=require(_0x2ab1('0x1'))(_0x2ab1('0x2'));var moment=require(_0x2ab1('0x3'));var BPromise=require(_0x2ab1('0x4'));var rp=require(_0x2ab1('0x5'));var fs=require('fs');var path=require(_0x2ab1('0x6'));var rimraf=require(_0x2ab1('0x7'));var config=require(_0x2ab1('0x8'));var attributes=require(_0x2ab1('0x9'));module[_0x2ab1('0xa')]=function(_0xd212aa,_0x51e311){return _0xd212aa[_0x2ab1('0xb')](_0x2ab1('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x2ab1('0xd'),'fields':[_0x2ab1('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1e8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0xb1e8,0x180));var _0x8b1e=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xb1e8[_0x54defc];return _0x1955d3;};'use strict';var _=require(_0x8b1e('0x0'));var util=require(_0x8b1e('0x1'));var logger=require(_0x8b1e('0x2'))(_0x8b1e('0x3'));var moment=require(_0x8b1e('0x4'));var BPromise=require(_0x8b1e('0x5'));var rp=require(_0x8b1e('0x6'));var fs=require('fs');var path=require(_0x8b1e('0x7'));var rimraf=require(_0x8b1e('0x8'));var config=require(_0x8b1e('0x9'));var attributes=require(_0x8b1e('0xa'));module[_0x8b1e('0xb')]=function(_0x5bf352,_0x3e0719){return _0x5bf352[_0x8b1e('0xc')]('SalesforceField',attributes,{'tableName':_0x8b1e('0xd'),'paranoid':![],'indexes':[{'name':_0x8b1e('0xe'),'fields':[_0x8b1e('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 6beefe3..cecfe3f 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 _0x5ddf=['../../config/environment','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2b49eb,_0x176904){var _0x3227d8=function(_0xae5dce){while(--_0xae5dce){_0x2b49eb['push'](_0x2b49eb['shift']());}};_0x3227d8(++_0x176904);}(_0x5ddf,0x117));var _0xf5dd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5ddf[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xf5dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf5dd('0x1'));var rs=require(_0xf5dd('0x2'));var fs=require('fs');var Redis=require(_0xf5dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5dd('0x4'));var logger=require(_0xf5dd('0x5'))(_0xf5dd('0x6'));var config=require(_0xf5dd('0x7'));var jayson=require(_0xf5dd('0x8'));var client=jayson['client'][_0xf5dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298211,_0x1ae230,_0x17372e){return new BPromise(function(_0x4fe9d4,_0x4f94fb){return client[_0xf5dd('0xa')](_0x298211,_0x17372e)[_0xf5dd('0xb')](function(_0x39ae77){logger['info'](_0xf5dd('0xc'),_0x1ae230,_0xf5dd('0xd'));logger['debug'](_0xf5dd('0xe'),_0x1ae230,_0xf5dd('0xd'),JSON[_0xf5dd('0xf')](_0x39ae77));if(_0x39ae77[_0xf5dd('0x10')]){if(_0x39ae77[_0xf5dd('0x10')][_0xf5dd('0x11')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1ae230,_0x39ae77[_0xf5dd('0x10')]['message']);return _0x4f94fb(_0x39ae77['error'][_0xf5dd('0x12')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x1ae230,_0x39ae77[_0xf5dd('0x10')][_0xf5dd('0x12')]);return _0x4fe9d4(_0x39ae77[_0xf5dd('0x10')][_0xf5dd('0x12')]);}else{logger[_0xf5dd('0x13')](_0xf5dd('0xc'),_0x1ae230,_0xf5dd('0xd'));_0x4fe9d4(_0x39ae77[_0xf5dd('0x14')][_0xf5dd('0x12')]);}})[_0xf5dd('0x15')](function(_0x31c0ef){logger['error'](_0xf5dd('0xc'),_0x1ae230,_0x31c0ef);_0x4f94fb(_0x31c0ef);});});} \ No newline at end of file +var _0x5755=['info','SalesforceField,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then'];(function(_0x161768,_0x220e2c){var _0x1c09d3=function(_0x303b54){while(--_0x303b54){_0x161768['push'](_0x161768['shift']());}};_0x1c09d3(++_0x220e2c);}(_0x5755,0x16c));var _0x5575=function(_0x1b776e,_0x1d341e){_0x1b776e=_0x1b776e-0x0;var _0x3b8294=_0x5755[_0x1b776e];return _0x3b8294;};'use strict';var _=require(_0x5575('0x0'));var util=require(_0x5575('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5575('0x2'));var fs=require('fs');var Redis=require(_0x5575('0x3'));var db=require(_0x5575('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5575('0x5'))(_0x5575('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5575('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x496771,_0x46039e,_0x26351e){return new BPromise(function(_0x4c48bf,_0x9ab960){return client[_0x5575('0x8')](_0x496771,_0x26351e)[_0x5575('0x9')](function(_0x39fd21){logger[_0x5575('0xa')](_0x5575('0xb'),_0x46039e,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x46039e,'request\x20sent',JSON[_0x5575('0xc')](_0x39fd21));if(_0x39fd21[_0x5575('0xd')]){if(_0x39fd21[_0x5575('0xd')]['code']===0x1f4){logger[_0x5575('0xd')](_0x5575('0xb'),_0x46039e,_0x39fd21[_0x5575('0xd')][_0x5575('0xe')]);return _0x9ab960(_0x39fd21[_0x5575('0xd')][_0x5575('0xe')]);}logger[_0x5575('0xd')]('SalesforceField,\x20%s,\x20%s',_0x46039e,_0x39fd21['error'][_0x5575('0xe')]);return _0x4c48bf(_0x39fd21[_0x5575('0xd')][_0x5575('0xe')]);}else{logger[_0x5575('0xa')](_0x5575('0xb'),_0x46039e,'request\x20sent');_0x4c48bf(_0x39fd21[_0x5575('0xf')]['message']);}})[_0x5575('0x10')](function(_0x48eee7){logger[_0x5575('0xd')]('SalesforceField,\x20%s,\x20%s',_0x46039e,_0x48eee7);_0x9ab960(_0x48eee7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8dfa906..9ff42d3 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 _0x7dd9=['../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x4bdd87,_0x450a6d){var _0x501dd8=function(_0x49e3c4){while(--_0x49e3c4){_0x4bdd87['push'](_0x4bdd87['shift']());}};_0x501dd8(++_0x450a6d);}(_0x7dd9,0xe2));var _0x97dd=function(_0x60ffca,_0x7b135c){_0x60ffca=_0x60ffca-0x0;var _0x43f9bc=_0x7dd9[_0x60ffca];return _0x43f9bc;};'use strict';var multer=require(_0x97dd('0x0'));var util=require(_0x97dd('0x1'));var path=require(_0x97dd('0x2'));var timeout=require(_0x97dd('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x97dd('0x4'));var interaction=require(_0x97dd('0x5'));var config=require(_0x97dd('0x6'));var controller=require(_0x97dd('0x7'));router['get']('/',auth[_0x97dd('0x8')](),controller[_0x97dd('0x9')]);router['get'](_0x97dd('0xa'),auth[_0x97dd('0x8')](),controller['show']);router['get'](_0x97dd('0xb'),auth['isAuthenticated'](),controller[_0x97dd('0xc')]);router[_0x97dd('0xd')](_0x97dd('0xe'),auth['isAuthenticated'](),controller[_0x97dd('0xf')]);router[_0x97dd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x97dd('0x10')](_0x97dd('0xb'),auth['isAuthenticated'](),controller[_0x97dd('0x11')]);router[_0x97dd('0x12')](_0x97dd('0xa'),auth[_0x97dd('0x8')](),controller[_0x97dd('0x13')]);router['delete']('/:id',auth[_0x97dd('0x8')](),controller[_0x97dd('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3d4b=['express','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','delete','destroy','exports','multer','path'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x3d4b,0x17a));var _0xb3d4=function(_0x18d1f0,_0x4669a1){_0x18d1f0=_0x18d1f0-0x0;var _0x153ba7=_0x3d4b[_0x18d1f0];return _0x153ba7;};'use strict';var multer=require(_0xb3d4('0x0'));var util=require('util');var path=require(_0xb3d4('0x1'));var timeout=require('connect-timeout');var express=require(_0xb3d4('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb3d4('0x3'));var config=require(_0xb3d4('0x4'));var controller=require(_0xb3d4('0x5'));router[_0xb3d4('0x6')]('/',auth[_0xb3d4('0x7')](),controller[_0xb3d4('0x8')]);router[_0xb3d4('0x6')](_0xb3d4('0x9'),auth[_0xb3d4('0x7')](),controller[_0xb3d4('0xa')]);router[_0xb3d4('0x6')](_0xb3d4('0xb'),auth[_0xb3d4('0x7')](),controller[_0xb3d4('0xc')]);router[_0xb3d4('0x6')](_0xb3d4('0xd'),auth[_0xb3d4('0x7')](),controller[_0xb3d4('0xe')]);router[_0xb3d4('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3d4('0xf')](_0xb3d4('0xb'),auth[_0xb3d4('0x7')](),controller['addConfiguration']);router['put'](_0xb3d4('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xb3d4('0x10')](_0xb3d4('0x9'),auth['isAuthenticated'](),controller[_0xb3d4('0x11')]);module[_0xb3d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 219c53a..0b5e502 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 _0x7072=['exports','STRING','username'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7072,0x138));var _0x2707=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x7072[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')]},'description':{'type':Sequelize[_0x2707('0x1')]},'username':{'type':Sequelize[_0x2707('0x1')],'unique':_0x2707('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2707('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2707('0x1')]}}; \ No newline at end of file +var _0xd8b0=['username','STRING','remoteUri','sequelize','exports'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_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')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0d8b('0x2')},'password':{'type':Sequelize[_0x0d8b('0x3')]},'email':{'type':Sequelize[_0x0d8b('0x3')]},'remoteUri':{'type':Sequelize[_0x0d8b('0x3')],'unique':_0x0d8b('0x4')},'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 4cab4f2..28d004a 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 _0x6ed5=['label','push','all','log','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','result','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','count','offset','limit','set','json','apply','save','destroy','sendStatus','name','send','index','ServicenowAccount','rawAttributes','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','key','field','options','include','findAll','rows','show','keys','includeAll','find','create','body','update','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','impact','active','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','subcategory','short_description','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','sla_due','approval','sys_mod_count','location','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','includes','internalType'];(function(_0x295cf1,_0x69ce40){var _0x45f71a=function(_0x1d9b25){while(--_0x1d9b25){_0x295cf1['push'](_0x295cf1['shift']());}};_0x45f71a(++_0x69ce40);}(_0x6ed5,0x192));var _0x56ed=function(_0xa7a846,_0x3e2ac0){_0xa7a846=_0xa7a846-0x0;var _0x52aa22=_0x6ed5[_0xa7a846];return _0x52aa22;};'use strict';var pdf=require(_0x56ed('0x0'));var emlformat=require(_0x56ed('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x56ed('0x2'));var jsonpatch=require(_0x56ed('0x3'));var rp=require('request-promise');var moment=require(_0x56ed('0x4'));var BPromise=require(_0x56ed('0x5'));var Mustache=require(_0x56ed('0x6'));var util=require(_0x56ed('0x7'));var path=require(_0x56ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x56ed('0x9'));var squel=require(_0x56ed('0xa'));var crypto=require(_0x56ed('0xb'));var jsforce=require(_0x56ed('0xc'));var deskjs=require(_0x56ed('0xd'));var toCsv=require(_0x56ed('0xe'));var querystring=require('querystring');var Papa=require(_0x56ed('0xf'));var Redis=require(_0x56ed('0x10'));var authService=require(_0x56ed('0x11'));var qs=require(_0x56ed('0x12'));var hardwareService=require(_0x56ed('0x13'));var logger=require(_0x56ed('0x14'))(_0x56ed('0x15'));var utils=require(_0x56ed('0x16'));var config=require(_0x56ed('0x17'));var db=require(_0x56ed('0x18'))['db'];var integrations=require(_0x56ed('0x19'));var jayson=require(_0x56ed('0x1a'));var client=jayson['client'][_0x56ed('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1ea074,_0x314443,_0xf0f6f){if(_0xf0f6f){var _0x57000b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57000b[_0x56ed('0x1c')](_0x314443)){return _0x1ea074;}else{throw new Error(_0x56ed('0x1d'));}}else{return _0x1ea074;}}function respondWithRpcPromise(_0x353796,_0x23a427,_0x554a5f,_0x1c9021){return new BPromise(function(_0x1f8b37,_0x44b874){var _0x28355e=_0x1c9021||client;return _0x28355e[_0x56ed('0x1e')](_0x353796,_0x554a5f)[_0x56ed('0x1f')](function(_0x42bac0){logger[_0x56ed('0x20')](_0x56ed('0x21'),_0x23a427,'request\x20sent');logger[_0x56ed('0x22')](_0x56ed('0x23'),_0x23a427,_0x56ed('0x24'),JSON[_0x56ed('0x25')](_0x42bac0));if(_0x42bac0[_0x56ed('0x26')]){if(_0x42bac0['error'][_0x56ed('0x27')]===0x1f4){logger[_0x56ed('0x26')](_0x56ed('0x21'),_0x23a427,_0x42bac0[_0x56ed('0x26')][_0x56ed('0x28')]);return _0x44b874(_0x42bac0[_0x56ed('0x26')][_0x56ed('0x28')]);}logger[_0x56ed('0x26')](_0x56ed('0x21'),_0x23a427,_0x42bac0[_0x56ed('0x26')]['message']);return _0x1f8b37(_0x42bac0[_0x56ed('0x26')]['message']);}else{logger[_0x56ed('0x20')](_0x56ed('0x21'),_0x23a427,'request\x20sent');_0x1f8b37(_0x42bac0['result']['message']);}})[_0x56ed('0x29')](function(_0x589fc3){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x23a427,_0x589fc3);_0x44b874(_0x589fc3);});});}function respondWithStatusCode(_0x5660fb,_0x4b3543){_0x4b3543=_0x4b3543||0xcc;return function(_0x23a24f){if(_0x23a24f){return _0x5660fb['sendStatus'](_0x4b3543);}return _0x5660fb[_0x56ed('0x2a')](_0x4b3543)[_0x56ed('0x2b')]();};}function respondWithResult(_0x5e6e7e,_0x239495){_0x239495=_0x239495||0xc8;return function(_0x253166){if(_0x253166){return _0x5e6e7e[_0x56ed('0x2a')](_0x239495)['json'](_0x253166);}};}function respondWithFilteredResult(_0xe52dc3,_0x12cace){return function(_0x425651){if(_0x425651){var _0x1f5779=_0x425651[_0x56ed('0x2c')],_0x772c4f=_0x12cace[_0x56ed('0x2d')],_0x435ae4=_0x12cace[_0x56ed('0x2d')]+_0x12cace[_0x56ed('0x2e')],_0x3f10ce;if(_0x435ae4>=_0x1f5779){_0x435ae4=_0x1f5779;_0x3f10ce=0xc8;}else{_0x3f10ce=0xce;}_0xe52dc3['status'](_0x3f10ce);return _0xe52dc3[_0x56ed('0x2f')]('Content-Range',_0x772c4f+'-'+_0x435ae4+'/'+_0x1f5779)[_0x56ed('0x30')](_0x425651);}return null;};}function patchUpdates(_0x3a2b94){return function(_0x3a53ab){try{jsonpatch[_0x56ed('0x31')](_0x3a53ab,_0x3a2b94,!![]);}catch(_0x56d47d){return BPromise['reject'](_0x56d47d);}return _0x3a53ab[_0x56ed('0x32')]();};}function saveUpdates(_0x556bfa,_0x40a1be){return function(_0x22c23d){if(_0x22c23d){return _0x22c23d['update'](_0x556bfa)[_0x56ed('0x1f')](function(_0x1f5a92){return _0x1f5a92;});}return null;};}function removeEntity(_0x505c01,_0x1a1b88){return function(_0x468c3b){if(_0x468c3b){return _0x468c3b[_0x56ed('0x33')]()['then'](function(){_0x505c01[_0x56ed('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2309ba,_0x7915df){return function(_0x299d26){if(!_0x299d26){_0x2309ba[_0x56ed('0x34')](0x194);}return _0x299d26;};}function handleError(_0x598861,_0x362617){_0x362617=_0x362617||0x1f4;return function(_0x37a055){logger['error'](_0x37a055['stack']);if(_0x37a055[_0x56ed('0x35')]){delete _0x37a055[_0x56ed('0x35')];}_0x598861[_0x56ed('0x2a')](_0x362617)[_0x56ed('0x36')](_0x37a055);};}exports[_0x56ed('0x37')]=function(_0x4bf3a7,_0x362c27){var _0x38f971={},_0x4a5c3a={},_0x136a6a={'count':0x0,'rows':[]};var _0x180ef8=db[_0x56ed('0x38')][_0x56ed('0x39')];_0x4a5c3a['model']=_['keys'](_0x180ef8);_0x4a5c3a[_0x56ed('0x3a')]=_['keys'](_0x4bf3a7[_0x56ed('0x3a')]);_0x4a5c3a[_0x56ed('0x3b')]=_['intersection'](_0x4a5c3a[_0x56ed('0x3c')],_0x4a5c3a[_0x56ed('0x3a')]);_0x38f971[_0x56ed('0x3d')]=_[_0x56ed('0x3e')](_0x4a5c3a[_0x56ed('0x3c')],qs[_0x56ed('0x3f')](_0x4bf3a7[_0x56ed('0x3a')][_0x56ed('0x3f')]));_0x38f971[_0x56ed('0x3d')]=_0x38f971[_0x56ed('0x3d')][_0x56ed('0x40')]?_0x38f971[_0x56ed('0x3d')]:_0x4a5c3a[_0x56ed('0x3c')];if(!_0x4bf3a7[_0x56ed('0x3a')][_0x56ed('0x41')]('nolimit')){_0x38f971[_0x56ed('0x2e')]=qs[_0x56ed('0x2e')](_0x4bf3a7[_0x56ed('0x3a')]['limit']);_0x38f971[_0x56ed('0x2d')]=qs[_0x56ed('0x2d')](_0x4bf3a7[_0x56ed('0x3a')][_0x56ed('0x2d')]);}_0x38f971[_0x56ed('0x42')]=qs[_0x56ed('0x43')](_0x4bf3a7[_0x56ed('0x3a')][_0x56ed('0x43')]);_0x38f971['where']=qs['filters'](_[_0x56ed('0x44')](_0x4bf3a7['query'],_0x4a5c3a[_0x56ed('0x3b')]));if(_0x4bf3a7['query'][_0x56ed('0x45')]){_0x38f971[_0x56ed('0x46')]=_[_0x56ed('0x47')](_0x38f971['where'],{'$or':_[_0x56ed('0x48')](_0x180ef8,function(_0x1ba0af){if(_0x1ba0af[_0x56ed('0x49')][_0x56ed('0x4a')]!=='VIRTUAL'){var _0x5314a4={};_0x5314a4[_0x1ba0af[_0x56ed('0x4b')]]={'$like':'%'+_0x4bf3a7[_0x56ed('0x3a')][_0x56ed('0x45')]+'%'};return _0x5314a4;}})});}_0x38f971=_['merge']({},_0x38f971,_0x4bf3a7[_0x56ed('0x4c')]);var _0x1e6415={'where':_0x38f971[_0x56ed('0x46')]};return db['ServicenowAccount']['count'](_0x1e6415)[_0x56ed('0x1f')](function(_0x53ad89){_0x136a6a[_0x56ed('0x2c')]=_0x53ad89;if(_0x4bf3a7[_0x56ed('0x3a')]['includeAll']){_0x38f971[_0x56ed('0x4d')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x56ed('0x4e')](_0x38f971);})[_0x56ed('0x1f')](function(_0x3de0fc){_0x136a6a[_0x56ed('0x4f')]=_0x3de0fc;return _0x136a6a;})[_0x56ed('0x1f')](respondWithFilteredResult(_0x362c27,_0x38f971))[_0x56ed('0x29')](handleError(_0x362c27,null));};exports[_0x56ed('0x50')]=function(_0x4b9bb4,_0x4103d){var _0x3d9875={'raw':![],'where':{'id':_0x4b9bb4['params']['id']}},_0xb9d48c={};_0xb9d48c['model']=_[_0x56ed('0x51')](db[_0x56ed('0x38')][_0x56ed('0x39')]);_0xb9d48c['query']=_['keys'](_0x4b9bb4[_0x56ed('0x3a')]);_0xb9d48c[_0x56ed('0x3b')]=_[_0x56ed('0x3e')](_0xb9d48c['model'],_0xb9d48c[_0x56ed('0x3a')]);_0x3d9875[_0x56ed('0x3d')]=_['intersection'](_0xb9d48c[_0x56ed('0x3c')],qs['fields'](_0x4b9bb4['query'][_0x56ed('0x3f')]));_0x3d9875['attributes']=_0x3d9875[_0x56ed('0x3d')][_0x56ed('0x40')]?_0x3d9875[_0x56ed('0x3d')]:_0xb9d48c['model'];if(_0x4b9bb4['query'][_0x56ed('0x52')]){_0x3d9875[_0x56ed('0x4d')]=[{'all':!![]}];}_0x3d9875=_[_0x56ed('0x47')]({},_0x3d9875,_0x4b9bb4[_0x56ed('0x4c')]);return db['ServicenowAccount'][_0x56ed('0x53')](_0x3d9875)[_0x56ed('0x1f')](handleEntityNotFound(_0x4103d,null))[_0x56ed('0x1f')](respondWithResult(_0x4103d,null))[_0x56ed('0x29')](handleError(_0x4103d,null));};exports[_0x56ed('0x54')]=function(_0xb17d14,_0x159c7e){return db[_0x56ed('0x38')][_0x56ed('0x54')](_0xb17d14[_0x56ed('0x55')],{})['then'](respondWithResult(_0x159c7e,0xc9))['catch'](handleError(_0x159c7e,null));};exports[_0x56ed('0x56')]=function(_0x59dc48,_0x73eaa7){if(_0x59dc48[_0x56ed('0x55')]['id']){delete _0x59dc48['body']['id'];}return db[_0x56ed('0x38')][_0x56ed('0x53')]({'where':{'id':_0x59dc48[_0x56ed('0x57')]['id']}})[_0x56ed('0x1f')](handleEntityNotFound(_0x73eaa7,null))[_0x56ed('0x1f')](saveUpdates(_0x59dc48[_0x56ed('0x55')],null))[_0x56ed('0x1f')](respondWithResult(_0x73eaa7,null))['catch'](handleError(_0x73eaa7,null));};exports[_0x56ed('0x33')]=function(_0x1effe2,_0xec361a){return db[_0x56ed('0x38')]['find']({'where':{'id':_0x1effe2['params']['id']}})['then'](handleEntityNotFound(_0xec361a,null))[_0x56ed('0x1f')](removeEntity(_0xec361a,null))[_0x56ed('0x29')](handleError(_0xec361a,null));};exports[_0x56ed('0x58')]=function(_0x49faf6,_0x227cf3,_0x50ce15){var _0x1f59c6={};var _0x7889a5={};var _0x450a00;var _0x260eae;return db['ServicenowAccount'][_0x56ed('0x59')]({'where':{'id':_0x49faf6[_0x56ed('0x57')]['id']}})['then'](handleEntityNotFound(_0x227cf3,null))[_0x56ed('0x1f')](function(_0x118fa4){if(_0x118fa4){_0x450a00=_0x118fa4;_0x7889a5[_0x56ed('0x3c')]=_[_0x56ed('0x51')](db['ServicenowConfiguration'][_0x56ed('0x39')]);_0x7889a5[_0x56ed('0x3a')]=_[_0x56ed('0x51')](_0x49faf6[_0x56ed('0x3a')]);_0x7889a5[_0x56ed('0x3b')]=_[_0x56ed('0x3e')](_0x7889a5[_0x56ed('0x3c')],_0x7889a5[_0x56ed('0x3a')]);_0x1f59c6[_0x56ed('0x3d')]=_['intersection'](_0x7889a5[_0x56ed('0x3c')],qs[_0x56ed('0x3f')](_0x49faf6[_0x56ed('0x3a')][_0x56ed('0x3f')]));_0x1f59c6[_0x56ed('0x3d')]=_0x1f59c6['attributes'][_0x56ed('0x40')]?_0x1f59c6[_0x56ed('0x3d')]:_0x7889a5[_0x56ed('0x3c')];_0x1f59c6[_0x56ed('0x42')]=qs[_0x56ed('0x43')](_0x49faf6[_0x56ed('0x3a')]['sort']);_0x1f59c6[_0x56ed('0x46')]=qs[_0x56ed('0x3b')](_[_0x56ed('0x44')](_0x49faf6['query'],_0x7889a5[_0x56ed('0x3b')]));if(_0x49faf6[_0x56ed('0x3a')]['filter']){_0x1f59c6[_0x56ed('0x46')]=_[_0x56ed('0x47')](_0x1f59c6['where'],{'$or':_[_0x56ed('0x48')](_0x1f59c6[_0x56ed('0x3d')],function(_0x2a2482){var _0x4720a0={};_0x4720a0[_0x2a2482]={'$like':'%'+_0x49faf6[_0x56ed('0x3a')][_0x56ed('0x45')]+'%'};return _0x4720a0;})});}_0x1f59c6=_[_0x56ed('0x47')]({},_0x1f59c6,_0x49faf6[_0x56ed('0x4c')]);return _0x450a00[_0x56ed('0x58')](_0x1f59c6);}})['then'](function(_0x130695){if(_0x130695){_0x260eae=_0x130695[_0x56ed('0x40')];if(!_0x49faf6['query'][_0x56ed('0x41')](_0x56ed('0x5a'))){_0x1f59c6[_0x56ed('0x2e')]=qs['limit'](_0x49faf6[_0x56ed('0x3a')][_0x56ed('0x2e')]);_0x1f59c6[_0x56ed('0x2d')]=qs[_0x56ed('0x2d')](_0x49faf6['query'][_0x56ed('0x2d')]);}return _0x450a00[_0x56ed('0x58')](_0x1f59c6);}})[_0x56ed('0x1f')](function(_0x318917){if(_0x318917){return _0x318917?{'count':_0x260eae,'rows':_0x318917}:null;}})[_0x56ed('0x1f')](respondWithResult(_0x227cf3,null))[_0x56ed('0x29')](handleError(_0x227cf3,null));};exports[_0x56ed('0x5b')]=function(_0x3704e0,_0x2d758e,_0x8e242a){if(_0x3704e0[_0x56ed('0x55')]['id']){delete _0x3704e0[_0x56ed('0x55')]['id'];}return db[_0x56ed('0x38')][_0x56ed('0x59')]({'where':{'id':_0x3704e0[_0x56ed('0x57')]['id']}})[_0x56ed('0x1f')](handleEntityNotFound(_0x2d758e,null))[_0x56ed('0x1f')](function(_0x8d1b99){if(_0x8d1b99){_0x3704e0[_0x56ed('0x55')][_0x56ed('0x5c')]=_0x8d1b99['id'];_0x3704e0[_0x56ed('0x55')][_0x56ed('0x5d')]=integrations[_0x56ed('0x5e')](_0x3704e0[_0x56ed('0x55')][_0x56ed('0x5f')],_0x3704e0[_0x56ed('0x55')][_0x56ed('0x49')]);_0x3704e0[_0x56ed('0x55')][_0x56ed('0x60')]=integrations[_0x56ed('0x61')](_0x3704e0[_0x56ed('0x55')][_0x56ed('0x5f')],_0x3704e0[_0x56ed('0x55')][_0x56ed('0x49')]);return db[_0x56ed('0x62')][_0x56ed('0x54')](_0x3704e0[_0x56ed('0x55')],{'include':[{'model':db[_0x56ed('0x63')],'as':'Subjects'},{'model':db[_0x56ed('0x63')],'as':'Descriptions'}]});}return null;})[_0x56ed('0x1f')](respondWithResult(_0x2d758e,null))[_0x56ed('0x29')](handleError(_0x2d758e,null));};exports[_0x56ed('0x64')]=function(_0x3c5e7d,_0xabb170,_0x1b54f9){var _0x5b92aa=[_0x56ed('0x65'),_0x56ed('0x66'),_0x56ed('0x67'),'subcategory',_0x56ed('0x68'),_0x56ed('0x69'),'incident_state',_0x56ed('0x6a'),_0x56ed('0x6b')];var _0x31d72c=[_0x56ed('0x6c'),_0x56ed('0x65'),_0x56ed('0x6d'),_0x56ed('0x6e'),_0x56ed('0x6f'),_0x56ed('0x70'),_0x56ed('0x71'),_0x56ed('0x66'),_0x56ed('0x72'),_0x56ed('0x73'),_0x56ed('0x74'),'sys_updated_by','opened_by',_0x56ed('0x75'),_0x56ed('0x76'),_0x56ed('0x77'),_0x56ed('0x78'),_0x56ed('0x79'),_0x56ed('0x67'),'order',_0x56ed('0x7a'),'closed_at',_0x56ed('0x7b'),'delivery_plan',_0x56ed('0x7c'),_0x56ed('0x7d'),'work_notes_list','business_service','priority',_0x56ed('0x7e'),_0x56ed('0x7f'),_0x56ed('0x80'),_0x56ed('0x81'),_0x56ed('0x82'),'business_duration',_0x56ed('0x83'),_0x56ed('0x84'),_0x56ed('0x85'),_0x56ed('0x86'),'caller_id','approval_set',_0x56ed('0x87'),'work_notes',_0x56ed('0x88'),_0x56ed('0x68'),'correlation_display',_0x56ed('0x89'),_0x56ed('0x8a'),_0x56ed('0x8b'),'business_stc',_0x56ed('0x8c'),_0x56ed('0x8d'),_0x56ed('0x8e'),_0x56ed('0x69'),_0x56ed('0x8f'),_0x56ed('0x90'),'closed_by',_0x56ed('0x91'),_0x56ed('0x92'),_0x56ed('0x93'),_0x56ed('0x94'),_0x56ed('0x95'),'incident_state',_0x56ed('0x96'),_0x56ed('0x97'),'company',_0x56ed('0x98'),_0x56ed('0x99'),_0x56ed('0x9a'),_0x56ed('0x6a'),'comments',_0x56ed('0x9b'),_0x56ed('0x9c'),'comments_and_work_notes','due_date',_0x56ed('0x9d'),'reopen_count','sys_tags','escalation','upon_approval','correlation_id',_0x56ed('0x9e'),'category'];var _0x41f172='';var _0x4906ec='';var _0x1c84a4=[];var _0x1f1aa5='';var _0x2ab16c='';var _0x13c3f3=[];var _0x2f0084='';var _0x3d8a09='';var _0x4e8118={};var _0x1eca5b='';return db[_0x56ed('0x38')][_0x56ed('0x59')]({'where':{'id':_0x3c5e7d[_0x56ed('0x57')]['id']},'attributes':['id','username',_0x56ed('0x9f'),_0x56ed('0xa0'),_0x56ed('0xa1'),_0x56ed('0xa2')]})[_0x56ed('0x1f')](handleEntityNotFound(_0xabb170,null))['then'](function(_0x46ab5f){if(_0x46ab5f){_0x1eca5b=_0x46ab5f['remoteUri'];var _0x311c30=_0x1eca5b['slice'](-0x1);if(_0x311c30==='/'){_0x1eca5b=_0x1eca5b[_0x56ed('0xa3')](0x0,_0x1eca5b[_0x56ed('0xa4')](_0x311c30));}_0x3d8a09=util[_0x56ed('0xa5')]('%s/api/now/doc/table/schema/',_0x1eca5b);_0x2f0084=util[_0x56ed('0xa5')](_0x56ed('0xa6'),_0x1eca5b);_0x4e8118={'user':_0x46ab5f[_0x56ed('0xa7')],'pass':_0x46ab5f[_0x56ed('0x9f')]};var _0x444526={'method':_0x56ed('0xa8'),'uri':_0x3d8a09+_0x56ed('0xa9'),'auth':_0x4e8118,'json':!![]};return rp(_0x444526);}})[_0x56ed('0x1f')](function(_0x1ad51b){if(_0x1ad51b['result'][_0x56ed('0x40')]>0x0){_0x41f172=_0x1ad51b['result'];}console['log'](_0x56ed('0xaa'),_0x41f172);_0x13c3f3=[];_0x4906ec=Object[_0x56ed('0xab')]([],_0x41f172);_['remove'](_0x4906ec,function(_0x44b96f){return!_0x5b92aa[_0x56ed('0xac')](_0x44b96f['name']);});_0x4906ec['forEach'](function(_0x34c14b){var _0x4d6e53=createFieldObject(_0x2f0084,_0x4e8118,_0x34c14b[_0x56ed('0xad')],_0x34c14b['name'],_0x34c14b[_0x56ed('0xae')],![]);_0x13c3f3[_0x56ed('0xaf')](_0x4d6e53);});return Promise[_0x56ed('0xb0')](_0x13c3f3);})[_0x56ed('0x1f')](function(_0x5311d4){_0x1c84a4=_0x5311d4;_0x1f1aa5=Object['assign']([],_0x41f172);console[_0x56ed('0xb1')]('TCL:\x20_object',_0x41f172);_[_0x56ed('0xb2')](_0x1f1aa5,function(_0x19bd1d){return _0x31d72c['includes'](_0x19bd1d[_0x56ed('0x35')]);});console['log'](_0x56ed('0xb3'),_0x1f1aa5);_0x13c3f3=[];_0x1f1aa5[_0x56ed('0xb4')](function(_0x41f73d){var _0x969013=createFieldObject(_0x2f0084,_0x4e8118,_0x41f73d[_0x56ed('0xad')],_0x41f73d[_0x56ed('0x35')],_0x41f73d[_0x56ed('0xae')],!![]);_0x13c3f3[_0x56ed('0xaf')](_0x969013);});return Promise['all'](_0x13c3f3);})['then'](function(_0x46f5f6){_0x2ab16c=_0x46f5f6;var _0x48c6a2=_0x1c84a4['concat'](_0x2ab16c);return{'count':_0x48c6a2[_0x56ed('0x40')],'rows':_0x48c6a2};})[_0x56ed('0x1f')](respondWithResult(_0xabb170,null))[_0x56ed('0x29')](function(_0x5cd285){console[_0x56ed('0xb1')]('ServiceNow\x20error:\x20'+_0x5cd285);var _0x2b53e0=_0x3c5e7d[_0x56ed('0x3a')][_0x56ed('0x1c')]?0x1f4:_0x5cd285[_0x56ed('0xb5')]||0x1f4;logger[_0x56ed('0x26')](_0x5cd285['stack']);delete _0x5cd285[_0x56ed('0x35')];if(_0x2b53e0===0x191){_0x2b53e0=0x190;}_0xabb170['status'](_0x2b53e0)[_0x56ed('0x36')](_0x3c5e7d['query'][_0x56ed('0x1c')]?{'message':_0x56ed('0xb6'),'statusCode':_0x5cd285['statusCode']}:_0x5cd285);});};function createFieldObject(_0x46d183,_0xb47dc4,_0x3d1913,_0x596310,_0x7e6e4a,_0x2223fb){return new Promise(function(_0x201dfa,_0x3d8745){var _0x471c6e={'id':_0x596310,'name':_0x7e6e4a,'custom':_0x2223fb};if(_0x3d1913===_0x56ed('0xb7')){_0x471c6e[_0x56ed('0x4c')]=[{'name':_0x56ed('0xb8'),'value':_0x56ed('0xb9')},{'name':_0x56ed('0xba'),'value':_0x56ed('0xbb')}];_0x201dfa(_0x471c6e);}else{var _0x52bcf8={'method':_0x56ed('0xa8'),'uri':_0x46d183+_0x56ed('0xbc')+_0x596310,'auth':_0xb47dc4,'json':!![]};return rp(_0x52bcf8)[_0x56ed('0x1f')](function(_0x22db11){var _0x69438c=[];if(_0x22db11[_0x56ed('0xbd')][_0x56ed('0x40')]>0x0){_0x22db11[_0x56ed('0xbd')][_0x56ed('0xb4')](function(_0x215b31){if(_0x215b31[_0x56ed('0xbe')]===_0x56ed('0xbb')){var _0x492898={'name':_0x215b31[_0x56ed('0xae')],'value':_0x215b31[_0x56ed('0xbf')]};_0x69438c[_0x56ed('0xaf')](_0x492898);}});}_0x471c6e['options']=_0x69438c;if(_0x471c6e[_0x56ed('0x4c')][_0x56ed('0x40')]>0x0){_0x201dfa(_0x471c6e);}else{if(_0x2223fb==![]){_0x201dfa();}else{_0x201dfa(_0x471c6e);}}});}});} \ No newline at end of file +var _0x4651=['model','query','filters','attributes','fields','length','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','params','rawAttributes','create','body','find','getConfigurations','keys','intersection','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','user_input','sys_created_on','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','short_description','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','severity','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','upon_approval','findOne','username','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','ServicenowAccount'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x4651,0x8d));var _0x1465=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4651[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1465('0x0'));var emlformat=require(_0x1465('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1465('0x2'));var jsonpatch=require(_0x1465('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1465('0x4'));var Mustache=require('mustache');var util=require(_0x1465('0x5'));var path=require(_0x1465('0x6'));var sox=require(_0x1465('0x7'));var csv=require('to-csv');var ejs=require(_0x1465('0x8'));var fs=require('fs');var _=require(_0x1465('0x9'));var squel=require(_0x1465('0xa'));var crypto=require(_0x1465('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1465('0xc'));var toCsv=require(_0x1465('0xd'));var querystring=require(_0x1465('0xe'));var Papa=require(_0x1465('0xf'));var Redis=require('ioredis');var authService=require(_0x1465('0x10'));var qs=require(_0x1465('0x11'));var hardwareService=require(_0x1465('0x12'));var logger=require(_0x1465('0x13'))('api');var utils=require(_0x1465('0x14'));var config=require(_0x1465('0x15'));var db=require(_0x1465('0x16'))['db'];var integrations=require(_0x1465('0x17'));var jayson=require(_0x1465('0x18'));var client=jayson[_0x1465('0x19')][_0x1465('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5968ad,_0x18dc96,_0x5da4fc){if(_0x5da4fc){var _0x136f71=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x136f71['test'](_0x18dc96)){return _0x5968ad;}else{throw new Error(_0x1465('0x1b'));}}else{return _0x5968ad;}}function respondWithRpcPromise(_0x43858f,_0x4cbe4f,_0x5e2e15,_0x23b0c2){return new BPromise(function(_0x1ba32f,_0x242969){var _0xcaa0d7=_0x23b0c2||client;return _0xcaa0d7[_0x1465('0x1c')](_0x43858f,_0x5e2e15)[_0x1465('0x1d')](function(_0x2647fa){logger[_0x1465('0x1e')](_0x1465('0x1f'),_0x4cbe4f,_0x1465('0x20'));logger[_0x1465('0x21')](_0x1465('0x22'),_0x4cbe4f,'request\x20sent',JSON[_0x1465('0x23')](_0x2647fa));if(_0x2647fa['error']){if(_0x2647fa['error'][_0x1465('0x24')]===0x1f4){logger[_0x1465('0x25')](_0x1465('0x1f'),_0x4cbe4f,_0x2647fa[_0x1465('0x25')][_0x1465('0x26')]);return _0x242969(_0x2647fa[_0x1465('0x25')][_0x1465('0x26')]);}logger[_0x1465('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x4cbe4f,_0x2647fa[_0x1465('0x25')][_0x1465('0x26')]);return _0x1ba32f(_0x2647fa[_0x1465('0x25')][_0x1465('0x26')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x4cbe4f,_0x1465('0x20'));_0x1ba32f(_0x2647fa[_0x1465('0x27')][_0x1465('0x26')]);}})[_0x1465('0x28')](function(_0x10c48d){logger[_0x1465('0x25')](_0x1465('0x1f'),_0x4cbe4f,_0x10c48d);_0x242969(_0x10c48d);});});}function respondWithStatusCode(_0x38f4b4,_0x3c3445){_0x3c3445=_0x3c3445||0xcc;return function(_0x44423d){if(_0x44423d){return _0x38f4b4[_0x1465('0x29')](_0x3c3445);}return _0x38f4b4[_0x1465('0x2a')](_0x3c3445)[_0x1465('0x2b')]();};}function respondWithResult(_0x13ba4d,_0x2b4976){_0x2b4976=_0x2b4976||0xc8;return function(_0x59655f){if(_0x59655f){return _0x13ba4d['status'](_0x2b4976)[_0x1465('0x2c')](_0x59655f);}};}function respondWithFilteredResult(_0x12eacc,_0x36e371){return function(_0x1e6069){if(_0x1e6069){var _0x3d2267=_0x1e6069['count'],_0x394dfd=_0x36e371['offset'],_0xb4645=_0x36e371[_0x1465('0x2d')]+_0x36e371[_0x1465('0x2e')],_0x363399;if(_0xb4645>=_0x3d2267){_0xb4645=_0x3d2267;_0x363399=0xc8;}else{_0x363399=0xce;}_0x12eacc[_0x1465('0x2a')](_0x363399);return _0x12eacc[_0x1465('0x2f')](_0x1465('0x30'),_0x394dfd+'-'+_0xb4645+'/'+_0x3d2267)[_0x1465('0x2c')](_0x1e6069);}return null;};}function patchUpdates(_0x3b037f){return function(_0x31c58e){try{jsonpatch[_0x1465('0x31')](_0x31c58e,_0x3b037f,!![]);}catch(_0x515dc5){return BPromise[_0x1465('0x32')](_0x515dc5);}return _0x31c58e[_0x1465('0x33')]();};}function saveUpdates(_0x5701ab,_0x6c2c84){return function(_0x1ef157){if(_0x1ef157){return _0x1ef157[_0x1465('0x34')](_0x5701ab)[_0x1465('0x1d')](function(_0x290f65){return _0x290f65;});}return null;};}function removeEntity(_0x5c2c8e,_0x4318fe){return function(_0x4f3f64){if(_0x4f3f64){return _0x4f3f64[_0x1465('0x35')]()[_0x1465('0x1d')](function(){_0x5c2c8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44415c,_0x227734){return function(_0x1eac48){if(!_0x1eac48){_0x44415c[_0x1465('0x29')](0x194);}return _0x1eac48;};}function handleError(_0x1f06be,_0x2f8ddb){_0x2f8ddb=_0x2f8ddb||0x1f4;return function(_0x472721){logger[_0x1465('0x25')](_0x472721[_0x1465('0x36')]);if(_0x472721[_0x1465('0x37')]){delete _0x472721[_0x1465('0x37')];}_0x1f06be[_0x1465('0x2a')](_0x2f8ddb)['send'](_0x472721);};}exports[_0x1465('0x38')]=function(_0x581132,_0x2209b2){var _0x5b70f1={},_0x3e0307={},_0x2ff35a={'count':0x0,'rows':[]};var _0x3bd7bd=db[_0x1465('0x39')]['rawAttributes'];_0x3e0307[_0x1465('0x3a')]=_['keys'](_0x3bd7bd);_0x3e0307[_0x1465('0x3b')]=_['keys'](_0x581132[_0x1465('0x3b')]);_0x3e0307[_0x1465('0x3c')]=_['intersection'](_0x3e0307[_0x1465('0x3a')],_0x3e0307[_0x1465('0x3b')]);_0x5b70f1[_0x1465('0x3d')]=_['intersection'](_0x3e0307['model'],qs[_0x1465('0x3e')](_0x581132[_0x1465('0x3b')][_0x1465('0x3e')]));_0x5b70f1[_0x1465('0x3d')]=_0x5b70f1[_0x1465('0x3d')][_0x1465('0x3f')]?_0x5b70f1[_0x1465('0x3d')]:_0x3e0307[_0x1465('0x3a')];if(!_0x581132[_0x1465('0x3b')]['hasOwnProperty']('nolimit')){_0x5b70f1['limit']=qs[_0x1465('0x2e')](_0x581132[_0x1465('0x3b')][_0x1465('0x2e')]);_0x5b70f1[_0x1465('0x2d')]=qs[_0x1465('0x2d')](_0x581132[_0x1465('0x3b')][_0x1465('0x2d')]);}_0x5b70f1[_0x1465('0x40')]=qs['sort'](_0x581132[_0x1465('0x3b')][_0x1465('0x41')]);_0x5b70f1[_0x1465('0x42')]=qs['filters'](_['pick'](_0x581132[_0x1465('0x3b')],_0x3e0307[_0x1465('0x3c')]));if(_0x581132[_0x1465('0x3b')][_0x1465('0x43')]){_0x5b70f1[_0x1465('0x42')]=_[_0x1465('0x44')](_0x5b70f1[_0x1465('0x42')],{'$or':_[_0x1465('0x45')](_0x3bd7bd,function(_0x465729){if(_0x465729[_0x1465('0x46')][_0x1465('0x47')]!==_0x1465('0x48')){var _0x3138fe={};_0x3138fe[_0x465729[_0x1465('0x49')]]={'$like':'%'+_0x581132[_0x1465('0x3b')][_0x1465('0x43')]+'%'};return _0x3138fe;}})});}_0x5b70f1=_['merge']({},_0x5b70f1,_0x581132[_0x1465('0x4a')]);var _0x3b0cc8={'where':_0x5b70f1[_0x1465('0x42')]};return db['ServicenowAccount'][_0x1465('0x4b')](_0x3b0cc8)[_0x1465('0x1d')](function(_0x1d8ccf){_0x2ff35a[_0x1465('0x4b')]=_0x1d8ccf;if(_0x581132[_0x1465('0x3b')][_0x1465('0x4c')]){_0x5b70f1[_0x1465('0x4d')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1465('0x4e')](_0x5b70f1);})[_0x1465('0x1d')](function(_0x20df4c){_0x2ff35a[_0x1465('0x4f')]=_0x20df4c;return _0x2ff35a;})['then'](respondWithFilteredResult(_0x2209b2,_0x5b70f1))['catch'](handleError(_0x2209b2,null));};exports['show']=function(_0x46ae58,_0x1f8b6d){var _0x252ba0={'raw':![],'where':{'id':_0x46ae58[_0x1465('0x50')]['id']}},_0x39e553={};_0x39e553[_0x1465('0x3a')]=_['keys'](db[_0x1465('0x39')][_0x1465('0x51')]);_0x39e553[_0x1465('0x3b')]=_['keys'](_0x46ae58['query']);_0x39e553[_0x1465('0x3c')]=_['intersection'](_0x39e553[_0x1465('0x3a')],_0x39e553[_0x1465('0x3b')]);_0x252ba0['attributes']=_['intersection'](_0x39e553[_0x1465('0x3a')],qs[_0x1465('0x3e')](_0x46ae58[_0x1465('0x3b')][_0x1465('0x3e')]));_0x252ba0[_0x1465('0x3d')]=_0x252ba0[_0x1465('0x3d')][_0x1465('0x3f')]?_0x252ba0[_0x1465('0x3d')]:_0x39e553[_0x1465('0x3a')];if(_0x46ae58[_0x1465('0x3b')][_0x1465('0x4c')]){_0x252ba0[_0x1465('0x4d')]=[{'all':!![]}];}_0x252ba0=_['merge']({},_0x252ba0,_0x46ae58['options']);return db['ServicenowAccount']['find'](_0x252ba0)[_0x1465('0x1d')](handleEntityNotFound(_0x1f8b6d,null))[_0x1465('0x1d')](respondWithResult(_0x1f8b6d,null))[_0x1465('0x28')](handleError(_0x1f8b6d,null));};exports[_0x1465('0x52')]=function(_0x314700,_0x2a94dc){return db[_0x1465('0x39')][_0x1465('0x52')](_0x314700[_0x1465('0x53')],{})[_0x1465('0x1d')](respondWithResult(_0x2a94dc,0xc9))[_0x1465('0x28')](handleError(_0x2a94dc,null));};exports['update']=function(_0x5c3ce7,_0x23a394){if(_0x5c3ce7[_0x1465('0x53')]['id']){delete _0x5c3ce7['body']['id'];}return db['ServicenowAccount'][_0x1465('0x54')]({'where':{'id':_0x5c3ce7[_0x1465('0x50')]['id']}})[_0x1465('0x1d')](handleEntityNotFound(_0x23a394,null))[_0x1465('0x1d')](saveUpdates(_0x5c3ce7[_0x1465('0x53')],null))[_0x1465('0x1d')](respondWithResult(_0x23a394,null))['catch'](handleError(_0x23a394,null));};exports['destroy']=function(_0x1c892a,_0x3fa4cd){return db[_0x1465('0x39')]['find']({'where':{'id':_0x1c892a[_0x1465('0x50')]['id']}})[_0x1465('0x1d')](handleEntityNotFound(_0x3fa4cd,null))['then'](removeEntity(_0x3fa4cd,null))[_0x1465('0x28')](handleError(_0x3fa4cd,null));};exports[_0x1465('0x55')]=function(_0x49822e,_0x254b63,_0x805067){var _0x154b51={};var _0x5e3ad6={};var _0x212d87;var _0x2c5669;return db['ServicenowAccount']['findOne']({'where':{'id':_0x49822e[_0x1465('0x50')]['id']}})[_0x1465('0x1d')](handleEntityNotFound(_0x254b63,null))[_0x1465('0x1d')](function(_0x562953){if(_0x562953){_0x212d87=_0x562953;_0x5e3ad6['model']=_['keys'](db['ServicenowConfiguration'][_0x1465('0x51')]);_0x5e3ad6[_0x1465('0x3b')]=_[_0x1465('0x56')](_0x49822e[_0x1465('0x3b')]);_0x5e3ad6[_0x1465('0x3c')]=_['intersection'](_0x5e3ad6[_0x1465('0x3a')],_0x5e3ad6['query']);_0x154b51['attributes']=_[_0x1465('0x57')](_0x5e3ad6[_0x1465('0x3a')],qs['fields'](_0x49822e[_0x1465('0x3b')]['fields']));_0x154b51[_0x1465('0x3d')]=_0x154b51[_0x1465('0x3d')]['length']?_0x154b51[_0x1465('0x3d')]:_0x5e3ad6['model'];_0x154b51['order']=qs[_0x1465('0x41')](_0x49822e['query'][_0x1465('0x41')]);_0x154b51[_0x1465('0x42')]=qs[_0x1465('0x3c')](_[_0x1465('0x58')](_0x49822e[_0x1465('0x3b')],_0x5e3ad6[_0x1465('0x3c')]));if(_0x49822e[_0x1465('0x3b')][_0x1465('0x43')]){_0x154b51['where']=_[_0x1465('0x44')](_0x154b51[_0x1465('0x42')],{'$or':_[_0x1465('0x45')](_0x154b51[_0x1465('0x3d')],function(_0x264e24){var _0x411a9d={};_0x411a9d[_0x264e24]={'$like':'%'+_0x49822e[_0x1465('0x3b')][_0x1465('0x43')]+'%'};return _0x411a9d;})});}_0x154b51=_[_0x1465('0x44')]({},_0x154b51,_0x49822e[_0x1465('0x4a')]);return _0x212d87[_0x1465('0x55')](_0x154b51);}})[_0x1465('0x1d')](function(_0x4dabe3){if(_0x4dabe3){_0x2c5669=_0x4dabe3['length'];if(!_0x49822e['query'][_0x1465('0x59')](_0x1465('0x5a'))){_0x154b51['limit']=qs[_0x1465('0x2e')](_0x49822e[_0x1465('0x3b')]['limit']);_0x154b51[_0x1465('0x2d')]=qs[_0x1465('0x2d')](_0x49822e[_0x1465('0x3b')][_0x1465('0x2d')]);}return _0x212d87[_0x1465('0x55')](_0x154b51);}})[_0x1465('0x1d')](function(_0x30f609){if(_0x30f609){return _0x30f609?{'count':_0x2c5669,'rows':_0x30f609}:null;}})[_0x1465('0x1d')](respondWithResult(_0x254b63,null))[_0x1465('0x28')](handleError(_0x254b63,null));};exports[_0x1465('0x5b')]=function(_0x255321,_0x2559e3,_0xf61426){if(_0x255321[_0x1465('0x53')]['id']){delete _0x255321[_0x1465('0x53')]['id'];}return db[_0x1465('0x39')]['findOne']({'where':{'id':_0x255321[_0x1465('0x50')]['id']}})[_0x1465('0x1d')](handleEntityNotFound(_0x2559e3,null))['then'](function(_0x200775){if(_0x200775){_0x255321[_0x1465('0x53')][_0x1465('0x5c')]=_0x200775['id'];_0x255321[_0x1465('0x53')][_0x1465('0x5d')]=integrations[_0x1465('0x5e')](_0x255321[_0x1465('0x53')][_0x1465('0x5f')],_0x255321[_0x1465('0x53')][_0x1465('0x46')]);_0x255321['body'][_0x1465('0x60')]=integrations[_0x1465('0x61')](_0x255321[_0x1465('0x53')]['channel'],_0x255321['body'][_0x1465('0x46')]);return db[_0x1465('0x62')]['create'](_0x255321['body'],{'include':[{'model':db[_0x1465('0x63')],'as':_0x1465('0x5d')},{'model':db['ServicenowField'],'as':_0x1465('0x60')}]});}return null;})['then'](respondWithResult(_0x2559e3,null))[_0x1465('0x28')](handleError(_0x2559e3,null));};exports[_0x1465('0x64')]=function(_0x25af6e,_0x24026e,_0x6899a8){var _0x1e39f5=[_0x1465('0x65'),_0x1465('0x66'),_0x1465('0x67'),_0x1465('0x68'),_0x1465('0x69'),_0x1465('0x6a'),'incident_state','severity',_0x1465('0x6b')];var _0xabd775=[_0x1465('0x6c'),_0x1465('0x65'),'caused_by',_0x1465('0x6d'),_0x1465('0x6e'),_0x1465('0x6f'),'child_incidents',_0x1465('0x66'),_0x1465('0x70'),_0x1465('0x71'),_0x1465('0x72'),'sys_updated_by','opened_by',_0x1465('0x73'),_0x1465('0x74'),'sys_domain','state',_0x1465('0x75'),_0x1465('0x67'),_0x1465('0x40'),'calendar_stc',_0x1465('0x76'),_0x1465('0x77'),_0x1465('0x78'),_0x1465('0x79'),_0x1465('0x7a'),_0x1465('0x7b'),_0x1465('0x7c'),_0x1465('0x7d'),_0x1465('0x7e'),_0x1465('0x7f'),_0x1465('0x80'),_0x1465('0x81'),_0x1465('0x82'),_0x1465('0x83'),_0x1465('0x84'),_0x1465('0x85'),_0x1465('0x86'),'resolved_at',_0x1465('0x87'),_0x1465('0x88'),'subcategory','work_notes',_0x1465('0x89'),_0x1465('0x69'),'correlation_display',_0x1465('0x8a'),_0x1465('0x8b'),_0x1465('0x8c'),'business_stc',_0x1465('0x8d'),_0x1465('0x8e'),_0x1465('0x8f'),'notify',_0x1465('0x90'),_0x1465('0x91'),_0x1465('0x92'),_0x1465('0x93'),'parent_incident',_0x1465('0x94'),_0x1465('0x95'),_0x1465('0x96'),_0x1465('0x97'),_0x1465('0x98'),_0x1465('0x99'),_0x1465('0x9a'),_0x1465('0x9b'),'activity_due','assigned_to',_0x1465('0x9c'),_0x1465('0x9d'),'sla_due','approval',_0x1465('0x9e'),_0x1465('0x9f'),_0x1465('0xa0'),_0x1465('0xa1'),'sys_tags','escalation',_0x1465('0xa2'),'correlation_id','location','category'];var _0x524f01='';var _0x55d216='';var _0x9057f6=[];var _0x3c8906='';var _0x53d1e1='';var _0x10b638=[];var _0x5cb1d5='';var _0x5a84e8='';var _0x107eb6={};var _0x3a4c3c='';return db['ServicenowAccount'][_0x1465('0xa3')]({'where':{'id':_0x25af6e[_0x1465('0x50')]['id']},'attributes':['id',_0x1465('0xa4'),'password','email',_0x1465('0xa5'),'serverUrl']})['then'](handleEntityNotFound(_0x24026e,null))[_0x1465('0x1d')](function(_0x16f573){if(_0x16f573){_0x3a4c3c=_0x16f573[_0x1465('0xa5')];var _0x3ebd05=_0x3a4c3c[_0x1465('0xa6')](-0x1);if(_0x3ebd05==='/'){_0x3a4c3c=_0x3a4c3c[_0x1465('0xa7')](0x0,_0x3a4c3c[_0x1465('0xa8')](_0x3ebd05));}_0x5a84e8=util[_0x1465('0xa9')]('%s/api/now/doc/table/schema/',_0x3a4c3c);_0x5cb1d5=util[_0x1465('0xa9')](_0x1465('0xaa'),_0x3a4c3c);_0x107eb6={'user':_0x16f573[_0x1465('0xa4')],'pass':_0x16f573[_0x1465('0xab')]};var _0x4b92ca={'method':_0x1465('0xac'),'uri':_0x5a84e8+_0x1465('0xad'),'auth':_0x107eb6,'json':!![]};return rp(_0x4b92ca);}})[_0x1465('0x1d')](function(_0x2f5d18){if(_0x2f5d18[_0x1465('0x27')][_0x1465('0x3f')]>0x0){_0x524f01=_0x2f5d18[_0x1465('0x27')];}console[_0x1465('0xae')](_0x1465('0xaf'),_0x524f01);_0x10b638=[];_0x55d216=Object[_0x1465('0xb0')]([],_0x524f01);_[_0x1465('0xb1')](_0x55d216,function(_0x523fcf){return!_0x1e39f5['includes'](_0x523fcf[_0x1465('0x37')]);});_0x55d216[_0x1465('0xb2')](function(_0x33130c){var _0x56ca55=createFieldObject(_0x5cb1d5,_0x107eb6,_0x33130c[_0x1465('0xb3')],_0x33130c[_0x1465('0x37')],_0x33130c[_0x1465('0xb4')],![]);_0x10b638['push'](_0x56ca55);});return Promise[_0x1465('0xb5')](_0x10b638);})[_0x1465('0x1d')](function(_0xfd0813){_0x9057f6=_0xfd0813;_0x3c8906=Object[_0x1465('0xb0')]([],_0x524f01);console[_0x1465('0xae')](_0x1465('0xb6'),_0x524f01);_[_0x1465('0xb1')](_0x3c8906,function(_0x39c7c5){return _0xabd775[_0x1465('0xb7')](_0x39c7c5[_0x1465('0x37')]);});console['log'](_0x1465('0xb8'),_0x3c8906);_0x10b638=[];_0x3c8906[_0x1465('0xb2')](function(_0xdf3043){var _0x1bb523=createFieldObject(_0x5cb1d5,_0x107eb6,_0xdf3043[_0x1465('0xb3')],_0xdf3043[_0x1465('0x37')],_0xdf3043[_0x1465('0xb4')],!![]);_0x10b638[_0x1465('0xb9')](_0x1bb523);});return Promise[_0x1465('0xb5')](_0x10b638);})['then'](function(_0x37a747){_0x53d1e1=_0x37a747;var _0x25eeda=_0x9057f6[_0x1465('0xba')](_0x53d1e1);return{'count':_0x25eeda[_0x1465('0x3f')],'rows':_0x25eeda};})[_0x1465('0x1d')](respondWithResult(_0x24026e,null))[_0x1465('0x28')](function(_0x47add3){console['log'](_0x1465('0xbb')+_0x47add3);var _0x1dd702=_0x25af6e[_0x1465('0x3b')]['test']?0x1f4:_0x47add3[_0x1465('0xbc')]||0x1f4;logger[_0x1465('0x25')](_0x47add3[_0x1465('0x36')]);delete _0x47add3['name'];if(_0x1dd702===0x191){_0x1dd702=0x190;}_0x24026e[_0x1465('0x2a')](_0x1dd702)[_0x1465('0xbd')](_0x25af6e[_0x1465('0x3b')]['test']?{'message':_0x1465('0xbe'),'statusCode':_0x47add3['statusCode']}:_0x47add3);});};function createFieldObject(_0x5db3d4,_0x3bbd2a,_0x49f933,_0x4529fe,_0x40cb8c,_0x1ed739){return new Promise(function(_0x23327a,_0x57ddb5){var _0x530e0f={'id':_0x4529fe,'name':_0x40cb8c,'custom':_0x1ed739};if(_0x49f933===_0x1465('0xbf')){_0x530e0f[_0x1465('0x4a')]=[{'name':_0x1465('0xc0'),'value':_0x1465('0xc1')},{'name':_0x1465('0xc2'),'value':_0x1465('0xc3')}];_0x23327a(_0x530e0f);}else{var _0x3a8fe7={'method':_0x1465('0xac'),'uri':_0x5db3d4+_0x1465('0xc4')+_0x4529fe,'auth':_0x3bbd2a,'json':!![]};return rp(_0x3a8fe7)['then'](function(_0x35402a){var _0xec6f44=[];if(_0x35402a[_0x1465('0x27')][_0x1465('0x3f')]>0x0){_0x35402a[_0x1465('0x27')][_0x1465('0xb2')](function(_0x5c2182){if(_0x5c2182[_0x1465('0xc5')]===_0x1465('0xc3')){var _0x1f26a0={'name':_0x5c2182[_0x1465('0xb4')],'value':_0x5c2182[_0x1465('0xc6')]};_0xec6f44[_0x1465('0xb9')](_0x1f26a0);}});}_0x530e0f[_0x1465('0x4a')]=_0xec6f44;if(_0x530e0f[_0x1465('0x4a')][_0x1465('0x3f')]>0x0){_0x23327a(_0x530e0f);}else{if(_0x1ed739==![]){_0x23327a();}else{_0x23327a(_0x530e0f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9ba4039..9407265 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0x7a54,0x106));var _0x47a5=function(_0x1d5fa1,_0x27ea86){_0x1d5fa1=_0x1d5fa1-0x0;var _0x3b84a7=_0x7a54[_0x1d5fa1];return _0x3b84a7;};'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'));var integrations=require(_0x47a5('0x9'));module['exports']=function(_0x3d5629,_0x59199c){return _0x3d5629[_0x47a5('0xa')](_0x47a5('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util'];(function(_0x18e001,_0x2d1dc4){var _0x5e7333=function(_0x35ac30){while(--_0x35ac30){_0x18e001['push'](_0x18e001['shift']());}};_0x5e7333(++_0x2d1dc4);}(_0x814b,0x1a2));var _0xb814=function(_0x929c7e,_0x38c4cc){_0x929c7e=_0x929c7e-0x0;var _0x5de099=_0x814b[_0x929c7e];return _0x5de099;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));var integrations=require(_0xb814('0xa'));module[_0xb814('0xb')]=function(_0x53e507,_0x3b0829){return _0x53e507[_0xb814('0xc')]('ServicenowAccount',attributes,{'tableName':_0xb814('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 0374dc6..3b4f398 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 _0x36e0=['ShowServicenowAccount','ServicenowAccount','find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','GetServicenowAccount','options','raw','where','attributes','limit','include','map','catch'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x36e0,0xdc));var _0x036e=function(_0x331b69,_0x5e646d){_0x331b69=_0x331b69-0x0;var _0x274d34=_0x36e0[_0x331b69];return _0x274d34;};'use strict';var _=require(_0x036e('0x0'));var util=require(_0x036e('0x1'));var moment=require(_0x036e('0x2'));var BPromise=require(_0x036e('0x3'));var rs=require(_0x036e('0x4'));var fs=require('fs');var Redis=require(_0x036e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x036e('0x6'));var logger=require(_0x036e('0x7'))(_0x036e('0x8'));var config=require(_0x036e('0x9'));var jayson=require(_0x036e('0xa'));var client=jayson[_0x036e('0xb')][_0x036e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178eac,_0x55fd68,_0x2fc311){return new BPromise(function(_0x456bd8,_0x5c49bc){return client[_0x036e('0xd')](_0x178eac,_0x2fc311)[_0x036e('0xe')](function(_0x2a72ed){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x55fd68,_0x036e('0xf'));logger[_0x036e('0x10')](_0x036e('0x11'),_0x55fd68,_0x036e('0xf'),JSON['stringify'](_0x2a72ed));if(_0x2a72ed[_0x036e('0x12')]){if(_0x2a72ed[_0x036e('0x12')]['code']===0x1f4){logger[_0x036e('0x12')](_0x036e('0x13'),_0x55fd68,_0x2a72ed[_0x036e('0x12')][_0x036e('0x14')]);return _0x5c49bc(_0x2a72ed[_0x036e('0x12')][_0x036e('0x14')]);}logger[_0x036e('0x12')](_0x036e('0x13'),_0x55fd68,_0x2a72ed['error'][_0x036e('0x14')]);return _0x456bd8(_0x2a72ed[_0x036e('0x12')][_0x036e('0x14')]);}else{logger[_0x036e('0x15')](_0x036e('0x13'),_0x55fd68,'request\x20sent');_0x456bd8(_0x2a72ed[_0x036e('0x16')][_0x036e('0x14')]);}})['catch'](function(_0x3f54b5){logger[_0x036e('0x12')](_0x036e('0x13'),_0x55fd68,_0x3f54b5);_0x5c49bc(_0x3f54b5);});});}exports[_0x036e('0x17')]=function(_0x137dda){var _0x216836=this;return new Promise(function(_0x2e50d9,_0x3f01a6){return db['ServicenowAccount']['findAll']({'raw':_0x137dda[_0x036e('0x18')]?_0x137dda['options'][_0x036e('0x19')]===undefined?!![]:![]:!![],'where':_0x137dda[_0x036e('0x18')]?_0x137dda[_0x036e('0x18')][_0x036e('0x1a')]||null:null,'attributes':_0x137dda['options']?_0x137dda[_0x036e('0x18')][_0x036e('0x1b')]||null:null,'limit':_0x137dda['options']?_0x137dda[_0x036e('0x18')][_0x036e('0x1c')]||null:null,'include':_0x137dda[_0x036e('0x18')]?_0x137dda[_0x036e('0x18')][_0x036e('0x1d')]?_[_0x036e('0x1e')](_0x137dda[_0x036e('0x18')][_0x036e('0x1d')],function(_0x418123){return{'model':db[_0x418123['model']],'as':_0x418123['as'],'attributes':_0x418123[_0x036e('0x1b')],'include':_0x418123[_0x036e('0x1d')]?_[_0x036e('0x1e')](_0x418123[_0x036e('0x1d')],function(_0x5e2ce0){return{'model':db[_0x5e2ce0['model']],'as':_0x5e2ce0['as'],'attributes':_0x5e2ce0[_0x036e('0x1b')],'include':_0x5e2ce0[_0x036e('0x1d')]?_['map'](_0x5e2ce0[_0x036e('0x1d')],function(_0x4ee34b){return{'model':db[_0x4ee34b['model']],'as':_0x4ee34b['as'],'attributes':_0x4ee34b[_0x036e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x036e('0xe')](function(_0x1b33ad){logger[_0x036e('0x15')](_0x036e('0x17'),_0x137dda);logger[_0x036e('0x10')]('GetServicenowAccount',_0x137dda,JSON['stringify'](_0x1b33ad));_0x2e50d9(_0x1b33ad);})[_0x036e('0x1f')](function(_0x4ca56d){logger[_0x036e('0x12')](_0x036e('0x17'),_0x4ca56d['message'],_0x137dda);_0x3f01a6(_0x216836[_0x036e('0x12')](0x1f4,_0x4ca56d[_0x036e('0x14')]));});});};exports[_0x036e('0x20')]=function(_0x4df8f3){var _0x5941db=this;return new Promise(function(_0x108436,_0x38971d){return db[_0x036e('0x21')][_0x036e('0x22')]({'raw':_0x4df8f3[_0x036e('0x18')]?_0x4df8f3[_0x036e('0x18')][_0x036e('0x19')]===undefined?!![]:![]:!![],'where':_0x4df8f3[_0x036e('0x18')]?_0x4df8f3['options']['where']||null:null,'attributes':_0x4df8f3['options']?_0x4df8f3[_0x036e('0x18')]['attributes']||null:null,'include':_0x4df8f3[_0x036e('0x18')]?_0x4df8f3[_0x036e('0x18')]['include']?_[_0x036e('0x1e')](_0x4df8f3[_0x036e('0x18')][_0x036e('0x1d')],function(_0x29b95c){return{'model':db[_0x29b95c['model']],'as':_0x29b95c['as'],'attributes':_0x29b95c[_0x036e('0x1b')],'include':_0x29b95c['include']?_[_0x036e('0x1e')](_0x29b95c[_0x036e('0x1d')],function(_0x2f7cd8){return{'model':db[_0x2f7cd8[_0x036e('0x23')]],'as':_0x2f7cd8['as'],'attributes':_0x2f7cd8[_0x036e('0x1b')],'include':_0x2f7cd8[_0x036e('0x1d')]?_[_0x036e('0x1e')](_0x2f7cd8['include'],function(_0x5a0e9a){return{'model':db[_0x5a0e9a[_0x036e('0x23')]],'as':_0x5a0e9a['as'],'attributes':_0x5a0e9a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2792bc){logger['info'](_0x036e('0x20'),_0x4df8f3);logger['debug'](_0x036e('0x20'),_0x4df8f3,JSON['stringify'](_0x2792bc));_0x108436(_0x2792bc);})[_0x036e('0x1f')](function(_0x303670){logger[_0x036e('0x12')]('ShowServicenowAccount',_0x303670['message'],_0x4df8f3);_0x38971d(_0x5941db[_0x036e('0x12')](0x1f4,_0x303670['message']));});});}; \ No newline at end of file +var _0x6324=['error','code','message','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1da746,_0x28d928){var _0x4a8fb8=function(_0x40bd95){while(--_0x40bd95){_0x1da746['push'](_0x1da746['shift']());}};_0x4a8fb8(++_0x28d928);}(_0x6324,0x116));var _0x4632=function(_0x5459c1,_0x36f6f0){_0x5459c1=_0x5459c1-0x0;var _0x3f99b5=_0x6324[_0x5459c1];return _0x3f99b5;};'use strict';var _=require('lodash');var util=require(_0x4632('0x0'));var moment=require(_0x4632('0x1'));var BPromise=require(_0x4632('0x2'));var rs=require(_0x4632('0x3'));var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require(_0x4632('0x5'))['db'];var utils=require(_0x4632('0x6'));var logger=require(_0x4632('0x7'))(_0x4632('0x8'));var config=require(_0x4632('0x9'));var jayson=require(_0x4632('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x472349,_0x1ae14c,_0x3f02c9){return new BPromise(function(_0x6d14f3,_0x55b0eb){return client[_0x4632('0xb')](_0x472349,_0x3f02c9)['then'](function(_0x5a6c4f){logger[_0x4632('0xc')](_0x4632('0xd'),_0x1ae14c,_0x4632('0xe'));logger[_0x4632('0xf')](_0x4632('0x10'),_0x1ae14c,_0x4632('0xe'),JSON[_0x4632('0x11')](_0x5a6c4f));if(_0x5a6c4f['error']){if(_0x5a6c4f[_0x4632('0x12')][_0x4632('0x13')]===0x1f4){logger['error'](_0x4632('0xd'),_0x1ae14c,_0x5a6c4f[_0x4632('0x12')]['message']);return _0x55b0eb(_0x5a6c4f[_0x4632('0x12')]['message']);}logger[_0x4632('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x1ae14c,_0x5a6c4f[_0x4632('0x12')][_0x4632('0x14')]);return _0x6d14f3(_0x5a6c4f['error']['message']);}else{logger[_0x4632('0xc')](_0x4632('0xd'),_0x1ae14c,_0x4632('0xe'));_0x6d14f3(_0x5a6c4f[_0x4632('0x15')][_0x4632('0x14')]);}})[_0x4632('0x16')](function(_0x4ddd3e){logger[_0x4632('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x1ae14c,_0x4ddd3e);_0x55b0eb(_0x4ddd3e);});});}exports['GetServicenowAccount']=function(_0x2a9380){var _0x453ce7=this;return new Promise(function(_0x5b8d16,_0xb536e1){return db[_0x4632('0x17')][_0x4632('0x18')]({'raw':_0x2a9380['options']?_0x2a9380[_0x4632('0x19')][_0x4632('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a9380[_0x4632('0x19')]?_0x2a9380['options'][_0x4632('0x1b')]||null:null,'attributes':_0x2a9380[_0x4632('0x19')]?_0x2a9380[_0x4632('0x19')][_0x4632('0x1c')]||null:null,'limit':_0x2a9380[_0x4632('0x19')]?_0x2a9380[_0x4632('0x19')][_0x4632('0x1d')]||null:null,'include':_0x2a9380['options']?_0x2a9380[_0x4632('0x19')]['include']?_['map'](_0x2a9380[_0x4632('0x19')][_0x4632('0x1e')],function(_0x318d6c){return{'model':db[_0x318d6c['model']],'as':_0x318d6c['as'],'attributes':_0x318d6c['attributes'],'include':_0x318d6c['include']?_[_0x4632('0x1f')](_0x318d6c['include'],function(_0x4e59d2){return{'model':db[_0x4e59d2['model']],'as':_0x4e59d2['as'],'attributes':_0x4e59d2['attributes'],'include':_0x4e59d2['include']?_[_0x4632('0x1f')](_0x4e59d2[_0x4632('0x1e')],function(_0x3438da){return{'model':db[_0x3438da[_0x4632('0x20')]],'as':_0x3438da['as'],'attributes':_0x3438da[_0x4632('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25a2b9){logger['info'](_0x4632('0x21'),_0x2a9380);logger[_0x4632('0xf')](_0x4632('0x21'),_0x2a9380,JSON[_0x4632('0x11')](_0x25a2b9));_0x5b8d16(_0x25a2b9);})[_0x4632('0x16')](function(_0x34ebef){logger[_0x4632('0x12')](_0x4632('0x21'),_0x34ebef['message'],_0x2a9380);_0xb536e1(_0x453ce7[_0x4632('0x12')](0x1f4,_0x34ebef[_0x4632('0x14')]));});});};exports[_0x4632('0x22')]=function(_0x445253){var _0x422ce2=this;return new Promise(function(_0x303cfa,_0x5bb8dc){return db[_0x4632('0x17')][_0x4632('0x23')]({'raw':_0x445253[_0x4632('0x19')]?_0x445253['options']['raw']===undefined?!![]:![]:!![],'where':_0x445253[_0x4632('0x19')]?_0x445253[_0x4632('0x19')][_0x4632('0x1b')]||null:null,'attributes':_0x445253[_0x4632('0x19')]?_0x445253['options']['attributes']||null:null,'include':_0x445253['options']?_0x445253[_0x4632('0x19')][_0x4632('0x1e')]?_['map'](_0x445253[_0x4632('0x19')][_0x4632('0x1e')],function(_0xa84f3b){return{'model':db[_0xa84f3b['model']],'as':_0xa84f3b['as'],'attributes':_0xa84f3b[_0x4632('0x1c')],'include':_0xa84f3b[_0x4632('0x1e')]?_['map'](_0xa84f3b[_0x4632('0x1e')],function(_0x36366a){return{'model':db[_0x36366a['model']],'as':_0x36366a['as'],'attributes':_0x36366a[_0x4632('0x1c')],'include':_0x36366a[_0x4632('0x1e')]?_[_0x4632('0x1f')](_0x36366a[_0x4632('0x1e')],function(_0x321f66){return{'model':db[_0x321f66[_0x4632('0x20')]],'as':_0x321f66['as'],'attributes':_0x321f66[_0x4632('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4632('0x24')](function(_0x3f66e3){logger[_0x4632('0xc')](_0x4632('0x22'),_0x445253);logger[_0x4632('0xf')]('ShowServicenowAccount',_0x445253,JSON[_0x4632('0x11')](_0x3f66e3));_0x303cfa(_0x3f66e3);})[_0x4632('0x16')](function(_0x153792){logger[_0x4632('0x12')]('ShowServicenowAccount',_0x153792[_0x4632('0x14')],_0x445253);_0x5bb8dc(_0x422ce2[_0x4632('0x12')](0x1f4,_0x153792[_0x4632('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 06425f1..7ff4135 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 _0xe605=['../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','get','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b84a0,_0x22fc34){var _0x5bc6f4=function(_0x48175b){while(--_0x48175b){_0x4b84a0['push'](_0x4b84a0['shift']());}};_0x5bc6f4(++_0x22fc34);}(_0xe605,0x133));var _0x5e60=function(_0x3e8a87,_0x1b7e79){_0x3e8a87=_0x3e8a87-0x0;var _0x4ac440=_0xe605[_0x3e8a87];return _0x4ac440;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require(_0x5e60('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e60('0x3')]();var auth=require(_0x5e60('0x4'));var interaction=require(_0x5e60('0x5'));var config=require('../../config/environment');var controller=require(_0x5e60('0x6'));router['get']('/',auth[_0x5e60('0x7')](),controller[_0x5e60('0x8')]);router['get'](_0x5e60('0x9'),auth['isAuthenticated'](),controller[_0x5e60('0xa')]);router['get'](_0x5e60('0xb'),auth[_0x5e60('0x7')](),controller[_0x5e60('0xc')]);router['get'](_0x5e60('0xd'),auth[_0x5e60('0x7')](),controller[_0x5e60('0xe')]);router[_0x5e60('0xf')](_0x5e60('0x10'),auth[_0x5e60('0x7')](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0x7')](),controller['create']);router[_0x5e60('0x13')](_0x5e60('0x9'),auth[_0x5e60('0x7')](),controller[_0x5e60('0x14')]);router[_0x5e60('0x15')](_0x5e60('0x9'),auth[_0x5e60('0x7')](),controller[_0x5e60('0x16')]);module[_0x5e60('0x17')]=router; \ No newline at end of file +var _0xbe45=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy'];(function(_0x18eae1,_0x2f237a){var _0x50c72d=function(_0x2fcc0c){while(--_0x2fcc0c){_0x18eae1['push'](_0x18eae1['shift']());}};_0x50c72d(++_0x2f237a);}(_0xbe45,0x19f));var _0x5be4=function(_0x38029b,_0x419fa2){_0x38029b=_0x38029b-0x0;var _0x5cdc38=_0xbe45[_0x38029b];return _0x5cdc38;};'use strict';var multer=require(_0x5be4('0x0'));var util=require(_0x5be4('0x1'));var path=require(_0x5be4('0x2'));var timeout=require(_0x5be4('0x3'));var express=require(_0x5be4('0x4'));var router=express[_0x5be4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5be4('0x6'));var controller=require(_0x5be4('0x7'));router[_0x5be4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5be4('0x8')](_0x5be4('0x9'),auth[_0x5be4('0xa')](),controller[_0x5be4('0xb')]);router[_0x5be4('0x8')](_0x5be4('0xc'),auth[_0x5be4('0xa')](),controller[_0x5be4('0xd')]);router[_0x5be4('0x8')](_0x5be4('0xe'),auth['isAuthenticated'](),controller[_0x5be4('0xf')]);router['get'](_0x5be4('0x10'),auth[_0x5be4('0xa')](),controller['getDescriptions']);router[_0x5be4('0x11')]('/',auth[_0x5be4('0xa')](),controller['create']);router[_0x5be4('0x12')](_0x5be4('0x9'),auth[_0x5be4('0xa')](),controller[_0x5be4('0x13')]);router[_0x5be4('0x14')](_0x5be4('0x9'),auth['isAuthenticated'](),controller[_0x5be4('0x15')]);module[_0x5be4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index fc2653e..bf3f90e 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 _0xd4bc=['STRING','sequelize','exports'];(function(_0x22b782,_0x10154f){var _0x50780e=function(_0x3f4034){while(--_0x3f4034){_0x22b782['push'](_0x22b782['shift']());}};_0x50780e(++_0x10154f);}(_0xd4bc,0xcd));var _0xcd4b=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0xd4bc[_0x522c6d];return _0x26300d;};'use strict';var Sequelize=require(_0xcd4b('0x0'));module[_0xcd4b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd4b('0x2')]}}; \ No newline at end of file +var _0xf5bf=['sequelize','exports','STRING'];(function(_0x3bb462,_0xdc1cd2){var _0x2aeb62=function(_0x3d5fc7){while(--_0x3d5fc7){_0x3bb462['push'](_0x3bb462['shift']());}};_0x2aeb62(++_0xdc1cd2);}(_0xf5bf,0x1c2));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xff5b('0x0'));module[_0xff5b('0x1')]={'name':{'type':Sequelize[_0xff5b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3ae5e5d..fad17b6 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 _0x326f=['hasOwnProperty','limit','order','sort','where','filters','pick','filter','map','type','key','VIRTUAL','field','merge','options','ServicenowConfiguration','include','findAll','rows','show','params','includeAll','find','create','body','update','getFields','findOne','ServicenowField','nolimit','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','count','offset','set','json','apply','reject','save','destroy','sendStatus','name','send','rawAttributes','model','keys','query','intersection','attributes','fields','length'];(function(_0x381cd7,_0x5cd931){var _0x42fb4d=function(_0x2ee505){while(--_0x2ee505){_0x381cd7['push'](_0x381cd7['shift']());}};_0x42fb4d(++_0x5cd931);}(_0x326f,0xd1));var _0xf326=function(_0x40f7d2,_0x24ffc8){_0x40f7d2=_0x40f7d2-0x0;var _0x3a0ce4=_0x326f[_0x40f7d2];return _0x3a0ce4;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var hardwareService=require(_0xf326('0x13'));var logger=require('../../config/logger')(_0xf326('0x14'));var utils=require('../../config/utils');var config=require(_0xf326('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf326('0x16'));var client=jayson['client'][_0xf326('0x17')]({'port':0x232a});function checkPasswordPattern(_0x9ed463,_0x4b3966,_0x342fe5){if(_0x342fe5){var _0x472632=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x472632[_0xf326('0x18')](_0x4b3966)){return _0x9ed463;}else{throw new Error(_0xf326('0x19'));}}else{return _0x9ed463;}}function respondWithRpcPromise(_0x5c8483,_0x45c1b6,_0x5204ee,_0x54bd1a){return new BPromise(function(_0xdf21d9,_0x11f6d2){var _0x1f2e5a=_0x54bd1a||client;return _0x1f2e5a[_0xf326('0x1a')](_0x5c8483,_0x5204ee)[_0xf326('0x1b')](function(_0x287a2a){logger[_0xf326('0x1c')](_0xf326('0x1d'),_0x45c1b6,'request\x20sent');logger[_0xf326('0x1e')](_0xf326('0x1f'),_0x45c1b6,_0xf326('0x20'),JSON[_0xf326('0x21')](_0x287a2a));if(_0x287a2a[_0xf326('0x22')]){if(_0x287a2a[_0xf326('0x22')]['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x45c1b6,_0x287a2a[_0xf326('0x22')][_0xf326('0x23')]);return _0x11f6d2(_0x287a2a['error']['message']);}logger[_0xf326('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x45c1b6,_0x287a2a['error'][_0xf326('0x23')]);return _0xdf21d9(_0x287a2a[_0xf326('0x22')]['message']);}else{logger['info'](_0xf326('0x1d'),_0x45c1b6,_0xf326('0x20'));_0xdf21d9(_0x287a2a['result'][_0xf326('0x23')]);}})[_0xf326('0x24')](function(_0x43c53e){logger[_0xf326('0x22')](_0xf326('0x1d'),_0x45c1b6,_0x43c53e);_0x11f6d2(_0x43c53e);});});}function respondWithStatusCode(_0x2049ec,_0x5ce532){_0x5ce532=_0x5ce532||0xcc;return function(_0x55b9f4){if(_0x55b9f4){return _0x2049ec['sendStatus'](_0x5ce532);}return _0x2049ec[_0xf326('0x25')](_0x5ce532)[_0xf326('0x26')]();};}function respondWithResult(_0x2cd45a,_0x1ff2b5){_0x1ff2b5=_0x1ff2b5||0xc8;return function(_0x148953){if(_0x148953){return _0x2cd45a[_0xf326('0x25')](_0x1ff2b5)['json'](_0x148953);}};}function respondWithFilteredResult(_0x201d28,_0xa3c0b){return function(_0x212d5d){if(_0x212d5d){var _0x581531=_0x212d5d[_0xf326('0x27')],_0x1617d2=_0xa3c0b[_0xf326('0x28')],_0x55ad0f=_0xa3c0b[_0xf326('0x28')]+_0xa3c0b['limit'],_0x4a9abf;if(_0x55ad0f>=_0x581531){_0x55ad0f=_0x581531;_0x4a9abf=0xc8;}else{_0x4a9abf=0xce;}_0x201d28[_0xf326('0x25')](_0x4a9abf);return _0x201d28[_0xf326('0x29')]('Content-Range',_0x1617d2+'-'+_0x55ad0f+'/'+_0x581531)[_0xf326('0x2a')](_0x212d5d);}return null;};}function patchUpdates(_0x119ab8){return function(_0xd77aba){try{jsonpatch[_0xf326('0x2b')](_0xd77aba,_0x119ab8,!![]);}catch(_0xa80156){return BPromise[_0xf326('0x2c')](_0xa80156);}return _0xd77aba[_0xf326('0x2d')]();};}function saveUpdates(_0x39a1e2,_0x43b951){return function(_0x349a03){if(_0x349a03){return _0x349a03['update'](_0x39a1e2)[_0xf326('0x1b')](function(_0x424104){return _0x424104;});}return null;};}function removeEntity(_0x21b23d,_0x4792d2){return function(_0x2c0cac){if(_0x2c0cac){return _0x2c0cac[_0xf326('0x2e')]()[_0xf326('0x1b')](function(){_0x21b23d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b8b31,_0x46d75e){return function(_0x9c3039){if(!_0x9c3039){_0x2b8b31[_0xf326('0x2f')](0x194);}return _0x9c3039;};}function handleError(_0x30694f,_0x2e8a64){_0x2e8a64=_0x2e8a64||0x1f4;return function(_0x62585a){logger[_0xf326('0x22')](_0x62585a['stack']);if(_0x62585a[_0xf326('0x30')]){delete _0x62585a[_0xf326('0x30')];}_0x30694f['status'](_0x2e8a64)[_0xf326('0x31')](_0x62585a);};}exports['index']=function(_0xce1cbb,_0x481b64){var _0x51f147={},_0xadb020={},_0x4d8eac={'count':0x0,'rows':[]};var _0x40dcb4=db['ServicenowConfiguration'][_0xf326('0x32')];_0xadb020[_0xf326('0x33')]=_[_0xf326('0x34')](_0x40dcb4);_0xadb020['query']=_[_0xf326('0x34')](_0xce1cbb[_0xf326('0x35')]);_0xadb020['filters']=_[_0xf326('0x36')](_0xadb020[_0xf326('0x33')],_0xadb020[_0xf326('0x35')]);_0x51f147[_0xf326('0x37')]=_['intersection'](_0xadb020[_0xf326('0x33')],qs[_0xf326('0x38')](_0xce1cbb[_0xf326('0x35')][_0xf326('0x38')]));_0x51f147[_0xf326('0x37')]=_0x51f147['attributes'][_0xf326('0x39')]?_0x51f147[_0xf326('0x37')]:_0xadb020['model'];if(!_0xce1cbb['query'][_0xf326('0x3a')]('nolimit')){_0x51f147['limit']=qs[_0xf326('0x3b')](_0xce1cbb['query'][_0xf326('0x3b')]);_0x51f147[_0xf326('0x28')]=qs[_0xf326('0x28')](_0xce1cbb[_0xf326('0x35')]['offset']);}_0x51f147[_0xf326('0x3c')]=qs[_0xf326('0x3d')](_0xce1cbb[_0xf326('0x35')][_0xf326('0x3d')]);_0x51f147[_0xf326('0x3e')]=qs[_0xf326('0x3f')](_[_0xf326('0x40')](_0xce1cbb[_0xf326('0x35')],_0xadb020[_0xf326('0x3f')]));if(_0xce1cbb[_0xf326('0x35')][_0xf326('0x41')]){_0x51f147[_0xf326('0x3e')]=_['merge'](_0x51f147[_0xf326('0x3e')],{'$or':_[_0xf326('0x42')](_0x40dcb4,function(_0x2ed1a7){if(_0x2ed1a7[_0xf326('0x43')][_0xf326('0x44')]!==_0xf326('0x45')){var _0x4f4c51={};_0x4f4c51[_0x2ed1a7[_0xf326('0x46')]]={'$like':'%'+_0xce1cbb[_0xf326('0x35')]['filter']+'%'};return _0x4f4c51;}})});}_0x51f147=_[_0xf326('0x47')]({},_0x51f147,_0xce1cbb[_0xf326('0x48')]);var _0x130c56={'where':_0x51f147[_0xf326('0x3e')]};return db[_0xf326('0x49')]['count'](_0x130c56)['then'](function(_0x184a74){_0x4d8eac[_0xf326('0x27')]=_0x184a74;if(_0xce1cbb['query']['includeAll']){_0x51f147[_0xf326('0x4a')]=[{'all':!![]}];}return db[_0xf326('0x49')][_0xf326('0x4b')](_0x51f147);})['then'](function(_0x301e65){_0x4d8eac[_0xf326('0x4c')]=_0x301e65;return _0x4d8eac;})[_0xf326('0x1b')](respondWithFilteredResult(_0x481b64,_0x51f147))[_0xf326('0x24')](handleError(_0x481b64,null));};exports[_0xf326('0x4d')]=function(_0x2d9bba,_0x12792c){var _0x3b90dc={'raw':![],'where':{'id':_0x2d9bba[_0xf326('0x4e')]['id']}},_0x3df9a8={};_0x3df9a8[_0xf326('0x33')]=_[_0xf326('0x34')](db[_0xf326('0x49')][_0xf326('0x32')]);_0x3df9a8[_0xf326('0x35')]=_['keys'](_0x2d9bba[_0xf326('0x35')]);_0x3df9a8[_0xf326('0x3f')]=_[_0xf326('0x36')](_0x3df9a8[_0xf326('0x33')],_0x3df9a8['query']);_0x3b90dc[_0xf326('0x37')]=_[_0xf326('0x36')](_0x3df9a8[_0xf326('0x33')],qs[_0xf326('0x38')](_0x2d9bba['query'][_0xf326('0x38')]));_0x3b90dc[_0xf326('0x37')]=_0x3b90dc[_0xf326('0x37')][_0xf326('0x39')]?_0x3b90dc[_0xf326('0x37')]:_0x3df9a8['model'];if(_0x2d9bba['query'][_0xf326('0x4f')]){_0x3b90dc[_0xf326('0x4a')]=[{'all':!![]}];}_0x3b90dc=_[_0xf326('0x47')]({},_0x3b90dc,_0x2d9bba['options']);return db[_0xf326('0x49')][_0xf326('0x50')](_0x3b90dc)[_0xf326('0x1b')](handleEntityNotFound(_0x12792c,null))['then'](respondWithResult(_0x12792c,null))['catch'](handleError(_0x12792c,null));};exports[_0xf326('0x51')]=function(_0x5b4832,_0x1cf58f){return db['ServicenowConfiguration'][_0xf326('0x51')](_0x5b4832[_0xf326('0x52')],{})[_0xf326('0x1b')](respondWithResult(_0x1cf58f,0xc9))[_0xf326('0x24')](handleError(_0x1cf58f,null));};exports[_0xf326('0x53')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x52')]['id'];}return db[_0xf326('0x49')][_0xf326('0x50')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x1b')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x1b')](saveUpdates(_0x35d3c8[_0xf326('0x52')],null))[_0xf326('0x1b')](respondWithResult(_0x7f7ece,null))[_0xf326('0x24')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x49')][_0xf326('0x50')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x1b')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x1b')](removeEntity(_0x21eac7,null))[_0xf326('0x24')](handleError(_0x21eac7,null));};exports[_0xf326('0x54')]=function(_0x4d3b9e,_0x5be2b1,_0x18b46e){var _0x44d2ed={};var _0x55ca96={};var _0x3cf6fa;var _0x29de71;return db[_0xf326('0x49')][_0xf326('0x55')]({'where':{'id':_0x4d3b9e['params']['id']}})[_0xf326('0x1b')](handleEntityNotFound(_0x5be2b1,null))['then'](function(_0x5dbeb9){if(_0x5dbeb9){_0x3cf6fa=_0x5dbeb9;_0x55ca96[_0xf326('0x33')]=_['keys'](db[_0xf326('0x56')][_0xf326('0x32')]);_0x55ca96[_0xf326('0x35')]=_['keys'](_0x4d3b9e['query']);_0x55ca96[_0xf326('0x3f')]=_[_0xf326('0x36')](_0x55ca96[_0xf326('0x33')],_0x55ca96['query']);_0x44d2ed[_0xf326('0x37')]=_['intersection'](_0x55ca96[_0xf326('0x33')],qs[_0xf326('0x38')](_0x4d3b9e[_0xf326('0x35')][_0xf326('0x38')]));_0x44d2ed[_0xf326('0x37')]=_0x44d2ed[_0xf326('0x37')][_0xf326('0x39')]?_0x44d2ed[_0xf326('0x37')]:_0x55ca96[_0xf326('0x33')];_0x44d2ed[_0xf326('0x3c')]=qs[_0xf326('0x3d')](_0x4d3b9e[_0xf326('0x35')][_0xf326('0x3d')]);_0x44d2ed['where']=qs[_0xf326('0x3f')](_['pick'](_0x4d3b9e[_0xf326('0x35')],_0x55ca96[_0xf326('0x3f')]));if(_0x4d3b9e['query'][_0xf326('0x41')]){_0x44d2ed['where']=_[_0xf326('0x47')](_0x44d2ed[_0xf326('0x3e')],{'$or':_[_0xf326('0x42')](_0x44d2ed[_0xf326('0x37')],function(_0x31b6dd){var _0x51ff5e={};_0x51ff5e[_0x31b6dd]={'$like':'%'+_0x4d3b9e['query'][_0xf326('0x41')]+'%'};return _0x51ff5e;})});}_0x44d2ed=_[_0xf326('0x47')]({},_0x44d2ed,_0x4d3b9e[_0xf326('0x48')]);return _0x3cf6fa[_0xf326('0x54')](_0x44d2ed);}})[_0xf326('0x1b')](function(_0x579d2c){if(_0x579d2c){_0x29de71=_0x579d2c[_0xf326('0x39')];if(!_0x4d3b9e[_0xf326('0x35')]['hasOwnProperty']('nolimit')){_0x44d2ed['limit']=qs[_0xf326('0x3b')](_0x4d3b9e[_0xf326('0x35')][_0xf326('0x3b')]);_0x44d2ed[_0xf326('0x28')]=qs[_0xf326('0x28')](_0x4d3b9e[_0xf326('0x35')][_0xf326('0x28')]);}return _0x3cf6fa['getFields'](_0x44d2ed);}})[_0xf326('0x1b')](function(_0x588d26){if(_0x588d26){return _0x588d26?{'count':_0x29de71,'rows':_0x588d26}:null;}})[_0xf326('0x1b')](respondWithResult(_0x5be2b1,null))[_0xf326('0x24')](handleError(_0x5be2b1,null));};exports['getSubjects']=function(_0x3717fe,_0x5eebe8,_0x499b59){var _0x2dd9e4={};var _0x540fa0={};var _0x78ba34;var _0x3411a4;return db[_0xf326('0x49')][_0xf326('0x55')]({'where':{'id':_0x3717fe[_0xf326('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5eebe8,null))['then'](function(_0x48d84a){if(_0x48d84a){_0x78ba34=_0x48d84a;_0x540fa0[_0xf326('0x33')]=_[_0xf326('0x34')](db[_0xf326('0x56')][_0xf326('0x32')]);_0x540fa0[_0xf326('0x35')]=_['keys'](_0x3717fe[_0xf326('0x35')]);_0x540fa0[_0xf326('0x3f')]=_[_0xf326('0x36')](_0x540fa0['model'],_0x540fa0['query']);_0x2dd9e4[_0xf326('0x37')]=_[_0xf326('0x36')](_0x540fa0['model'],qs['fields'](_0x3717fe[_0xf326('0x35')]['fields']));_0x2dd9e4[_0xf326('0x37')]=_0x2dd9e4['attributes']['length']?_0x2dd9e4['attributes']:_0x540fa0[_0xf326('0x33')];_0x2dd9e4[_0xf326('0x3c')]=qs[_0xf326('0x3d')](_0x3717fe['query'][_0xf326('0x3d')]);_0x2dd9e4[_0xf326('0x3e')]=qs[_0xf326('0x3f')](_[_0xf326('0x40')](_0x3717fe[_0xf326('0x35')],_0x540fa0[_0xf326('0x3f')]));if(_0x3717fe[_0xf326('0x35')][_0xf326('0x41')]){_0x2dd9e4[_0xf326('0x3e')]=_['merge'](_0x2dd9e4[_0xf326('0x3e')],{'$or':_['map'](_0x2dd9e4[_0xf326('0x37')],function(_0x366312){var _0x40ee66={};_0x40ee66[_0x366312]={'$like':'%'+_0x3717fe['query'][_0xf326('0x41')]+'%'};return _0x40ee66;})});}_0x2dd9e4=_[_0xf326('0x47')]({},_0x2dd9e4,_0x3717fe[_0xf326('0x48')]);return _0x78ba34['getSubjects'](_0x2dd9e4);}})[_0xf326('0x1b')](function(_0x4057e1){if(_0x4057e1){_0x3411a4=_0x4057e1[_0xf326('0x39')];if(!_0x3717fe[_0xf326('0x35')]['hasOwnProperty'](_0xf326('0x57'))){_0x2dd9e4['limit']=qs['limit'](_0x3717fe[_0xf326('0x35')][_0xf326('0x3b')]);_0x2dd9e4['offset']=qs['offset'](_0x3717fe['query'][_0xf326('0x28')]);}return _0x78ba34['getSubjects'](_0x2dd9e4);}})[_0xf326('0x1b')](function(_0x37a564){if(_0x37a564){return _0x37a564?{'count':_0x3411a4,'rows':_0x37a564}:null;}})[_0xf326('0x1b')](respondWithResult(_0x5eebe8,null))[_0xf326('0x24')](handleError(_0x5eebe8,null));};exports[_0xf326('0x58')]=function(_0x25b56c,_0x5d23f0,_0x39edf8){var _0x323926={};var _0x5f1724={};var _0x497ada;var _0x14eecc;return db['ServicenowConfiguration'][_0xf326('0x55')]({'where':{'id':_0x25b56c[_0xf326('0x4e')]['id']}})[_0xf326('0x1b')](handleEntityNotFound(_0x5d23f0,null))[_0xf326('0x1b')](function(_0x19d676){if(_0x19d676){_0x497ada=_0x19d676;_0x5f1724[_0xf326('0x33')]=_[_0xf326('0x34')](db[_0xf326('0x56')][_0xf326('0x32')]);_0x5f1724['query']=_[_0xf326('0x34')](_0x25b56c[_0xf326('0x35')]);_0x5f1724['filters']=_[_0xf326('0x36')](_0x5f1724['model'],_0x5f1724[_0xf326('0x35')]);_0x323926[_0xf326('0x37')]=_[_0xf326('0x36')](_0x5f1724['model'],qs[_0xf326('0x38')](_0x25b56c[_0xf326('0x35')][_0xf326('0x38')]));_0x323926[_0xf326('0x37')]=_0x323926[_0xf326('0x37')][_0xf326('0x39')]?_0x323926[_0xf326('0x37')]:_0x5f1724[_0xf326('0x33')];_0x323926[_0xf326('0x3c')]=qs[_0xf326('0x3d')](_0x25b56c[_0xf326('0x35')][_0xf326('0x3d')]);_0x323926[_0xf326('0x3e')]=qs[_0xf326('0x3f')](_[_0xf326('0x40')](_0x25b56c['query'],_0x5f1724[_0xf326('0x3f')]));if(_0x25b56c[_0xf326('0x35')]['filter']){_0x323926[_0xf326('0x3e')]=_[_0xf326('0x47')](_0x323926['where'],{'$or':_[_0xf326('0x42')](_0x323926[_0xf326('0x37')],function(_0x2b5747){var _0x8dbd96={};_0x8dbd96[_0x2b5747]={'$like':'%'+_0x25b56c[_0xf326('0x35')][_0xf326('0x41')]+'%'};return _0x8dbd96;})});}_0x323926=_[_0xf326('0x47')]({},_0x323926,_0x25b56c['options']);return _0x497ada[_0xf326('0x58')](_0x323926);}})[_0xf326('0x1b')](function(_0x323fb1){if(_0x323fb1){_0x14eecc=_0x323fb1[_0xf326('0x39')];if(!_0x25b56c[_0xf326('0x35')][_0xf326('0x3a')](_0xf326('0x57'))){_0x323926[_0xf326('0x3b')]=qs['limit'](_0x25b56c[_0xf326('0x35')][_0xf326('0x3b')]);_0x323926['offset']=qs[_0xf326('0x28')](_0x25b56c['query'][_0xf326('0x28')]);}return _0x497ada[_0xf326('0x58')](_0x323926);}})[_0xf326('0x1b')](function(_0x2a0f36){if(_0x2a0f36){return _0x2a0f36?{'count':_0x14eecc,'rows':_0x2a0f36}:null;}})[_0xf326('0x1b')](respondWithResult(_0x5d23f0,null))[_0xf326('0x24')](handleError(_0x5d23f0,null));}; \ No newline at end of file +var _0xe14b=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','ServicenowConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','map','field','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x581d41,_0x5e60bf){var _0x266d6a=function(_0x37a6ca){while(--_0x37a6ca){_0x581d41['push'](_0x581d41['shift']());}};_0x266d6a(++_0x5e60bf);}(_0xe14b,0x93));var _0xbe14=function(_0x3c029a,_0x30fbba){_0x3c029a=_0x3c029a-0x0;var _0x619f33=_0xe14b[_0x3c029a];return _0x619f33;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe14('0x10'))(_0xbe14('0x11'));var utils=require('../../config/utils');var config=require(_0xbe14('0x12'));var db=require(_0xbe14('0x13'))['db'];var jayson=require(_0xbe14('0x14'));var client=jayson[_0xbe14('0x15')][_0xbe14('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3b898d,_0x23a730,_0x2850cb){if(_0x2850cb){var _0x16893f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16893f[_0xbe14('0x17')](_0x23a730)){return _0x3b898d;}else{throw new Error(_0xbe14('0x18'));}}else{return _0x3b898d;}}function respondWithRpcPromise(_0x33fd54,_0x813399,_0x530538,_0x55b3a7){return new BPromise(function(_0x3f58f5,_0x3dc4a9){var _0xf4ac9=_0x55b3a7||client;return _0xf4ac9[_0xbe14('0x19')](_0x33fd54,_0x530538)['then'](function(_0x21c789){logger[_0xbe14('0x1a')](_0xbe14('0x1b'),_0x813399,_0xbe14('0x1c'));logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x813399,_0xbe14('0x1c'),JSON['stringify'](_0x21c789));if(_0x21c789[_0xbe14('0x1f')]){if(_0x21c789[_0xbe14('0x1f')][_0xbe14('0x20')]===0x1f4){logger[_0xbe14('0x1f')](_0xbe14('0x1b'),_0x813399,_0x21c789[_0xbe14('0x1f')]['message']);return _0x3dc4a9(_0x21c789[_0xbe14('0x1f')][_0xbe14('0x21')]);}logger[_0xbe14('0x1f')](_0xbe14('0x1b'),_0x813399,_0x21c789[_0xbe14('0x1f')]['message']);return _0x3f58f5(_0x21c789[_0xbe14('0x1f')]['message']);}else{logger[_0xbe14('0x1a')]('ServicenowConfiguration,\x20%s,\x20%s',_0x813399,_0xbe14('0x1c'));_0x3f58f5(_0x21c789['result'][_0xbe14('0x21')]);}})[_0xbe14('0x22')](function(_0x505dbd){logger[_0xbe14('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0x813399,_0x505dbd);_0x3dc4a9(_0x505dbd);});});}function respondWithStatusCode(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0xcc;return function(_0x36a21e){if(_0x36a21e){return _0x4587a8[_0xbe14('0x23')](_0x4851f8);}return _0x4587a8[_0xbe14('0x24')](_0x4851f8)[_0xbe14('0x25')]();};}function respondWithResult(_0x15ef02,_0x2703f5){_0x2703f5=_0x2703f5||0xc8;return function(_0x55d001){if(_0x55d001){return _0x15ef02[_0xbe14('0x24')](_0x2703f5)[_0xbe14('0x26')](_0x55d001);}};}function respondWithFilteredResult(_0x391556,_0x169369){return function(_0x5dd475){if(_0x5dd475){var _0x16f884=_0x5dd475[_0xbe14('0x27')],_0x29fc64=_0x169369[_0xbe14('0x28')],_0x59bf34=_0x169369[_0xbe14('0x28')]+_0x169369[_0xbe14('0x29')],_0x3c3613;if(_0x59bf34>=_0x16f884){_0x59bf34=_0x16f884;_0x3c3613=0xc8;}else{_0x3c3613=0xce;}_0x391556[_0xbe14('0x24')](_0x3c3613);return _0x391556[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x29fc64+'-'+_0x59bf34+'/'+_0x16f884)[_0xbe14('0x26')](_0x5dd475);}return null;};}function patchUpdates(_0x16a159){return function(_0x40538f){try{jsonpatch[_0xbe14('0x2c')](_0x40538f,_0x16a159,!![]);}catch(_0x39dc0a){return BPromise[_0xbe14('0x2d')](_0x39dc0a);}return _0x40538f[_0xbe14('0x2e')]();};}function saveUpdates(_0xe6feb2,_0x6ba36c){return function(_0x2ff48e){if(_0x2ff48e){return _0x2ff48e[_0xbe14('0x2f')](_0xe6feb2)[_0xbe14('0x30')](function(_0x581e86){return _0x581e86;});}return null;};}function removeEntity(_0x2e33e1,_0x499793){return function(_0x58f8de){if(_0x58f8de){return _0x58f8de[_0xbe14('0x31')]()['then'](function(){_0x2e33e1[_0xbe14('0x24')](0xcc)[_0xbe14('0x25')]();});}};}function handleEntityNotFound(_0x52a25c,_0x50cb09){return function(_0x5798c7){if(!_0x5798c7){_0x52a25c[_0xbe14('0x23')](0x194);}return _0x5798c7;};}function handleError(_0xa3d24,_0x5f27b6){_0x5f27b6=_0x5f27b6||0x1f4;return function(_0x46c570){logger[_0xbe14('0x1f')](_0x46c570[_0xbe14('0x32')]);if(_0x46c570[_0xbe14('0x33')]){delete _0x46c570[_0xbe14('0x33')];}_0xa3d24['status'](_0x5f27b6)['send'](_0x46c570);};}exports[_0xbe14('0x34')]=function(_0x52b24c,_0x5dd7aa){var _0x5c5e9f={},_0x163ef7={},_0x393f6b={'count':0x0,'rows':[]};var _0x2bb45=db[_0xbe14('0x35')][_0xbe14('0x36')];_0x163ef7[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x2bb45);_0x163ef7[_0xbe14('0x39')]=_[_0xbe14('0x38')](_0x52b24c[_0xbe14('0x39')]);_0x163ef7[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x163ef7['model'],_0x163ef7['query']);_0x5c5e9f[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x163ef7[_0xbe14('0x37')],qs['fields'](_0x52b24c[_0xbe14('0x39')][_0xbe14('0x3d')]));_0x5c5e9f[_0xbe14('0x3c')]=_0x5c5e9f[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x5c5e9f[_0xbe14('0x3c')]:_0x163ef7[_0xbe14('0x37')];if(!_0x52b24c[_0xbe14('0x39')][_0xbe14('0x3f')]('nolimit')){_0x5c5e9f[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x52b24c[_0xbe14('0x39')][_0xbe14('0x29')]);_0x5c5e9f[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x52b24c['query'][_0xbe14('0x28')]);}_0x5c5e9f[_0xbe14('0x40')]=qs[_0xbe14('0x41')](_0x52b24c[_0xbe14('0x39')]['sort']);_0x5c5e9f['where']=qs[_0xbe14('0x3a')](_[_0xbe14('0x42')](_0x52b24c[_0xbe14('0x39')],_0x163ef7['filters']));if(_0x52b24c['query'][_0xbe14('0x43')]){_0x5c5e9f['where']=_['merge'](_0x5c5e9f[_0xbe14('0x44')],{'$or':_[_0xbe14('0x45')](_0x2bb45,function(_0x8216c3){if(_0x8216c3['type']['key']!=='VIRTUAL'){var _0x46fee8={};_0x46fee8[_0x8216c3[_0xbe14('0x46')]]={'$like':'%'+_0x52b24c[_0xbe14('0x39')]['filter']+'%'};return _0x46fee8;}})});}_0x5c5e9f=_[_0xbe14('0x47')]({},_0x5c5e9f,_0x52b24c[_0xbe14('0x48')]);var _0x32f22e={'where':_0x5c5e9f[_0xbe14('0x44')]};return db['ServicenowConfiguration']['count'](_0x32f22e)[_0xbe14('0x30')](function(_0x34ffa0){_0x393f6b[_0xbe14('0x27')]=_0x34ffa0;if(_0x52b24c[_0xbe14('0x39')][_0xbe14('0x49')]){_0x5c5e9f['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xbe14('0x4a')](_0x5c5e9f);})[_0xbe14('0x30')](function(_0x238c60){_0x393f6b[_0xbe14('0x4b')]=_0x238c60;return _0x393f6b;})['then'](respondWithFilteredResult(_0x5dd7aa,_0x5c5e9f))[_0xbe14('0x22')](handleError(_0x5dd7aa,null));};exports[_0xbe14('0x4c')]=function(_0x53e8ab,_0x396e40){var _0x2a35e5={'raw':![],'where':{'id':_0x53e8ab[_0xbe14('0x4d')]['id']}},_0x2d6ee8={};_0x2d6ee8['model']=_['keys'](db[_0xbe14('0x35')][_0xbe14('0x36')]);_0x2d6ee8['query']=_['keys'](_0x53e8ab[_0xbe14('0x39')]);_0x2d6ee8[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x2d6ee8[_0xbe14('0x37')],_0x2d6ee8[_0xbe14('0x39')]);_0x2a35e5[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x2d6ee8['model'],qs[_0xbe14('0x3d')](_0x53e8ab[_0xbe14('0x39')][_0xbe14('0x3d')]));_0x2a35e5[_0xbe14('0x3c')]=_0x2a35e5[_0xbe14('0x3c')]['length']?_0x2a35e5[_0xbe14('0x3c')]:_0x2d6ee8[_0xbe14('0x37')];if(_0x53e8ab[_0xbe14('0x39')][_0xbe14('0x49')]){_0x2a35e5[_0xbe14('0x4e')]=[{'all':!![]}];}_0x2a35e5=_[_0xbe14('0x47')]({},_0x2a35e5,_0x53e8ab['options']);return db['ServicenowConfiguration'][_0xbe14('0x4f')](_0x2a35e5)[_0xbe14('0x30')](handleEntityNotFound(_0x396e40,null))[_0xbe14('0x30')](respondWithResult(_0x396e40,null))['catch'](handleError(_0x396e40,null));};exports['create']=function(_0x44fe0d,_0x134878){return db['ServicenowConfiguration'][_0xbe14('0x50')](_0x44fe0d[_0xbe14('0x51')],{})['then'](respondWithResult(_0x134878,0xc9))[_0xbe14('0x22')](handleError(_0x134878,null));};exports['update']=function(_0x41ba58,_0x410c59){if(_0x41ba58[_0xbe14('0x51')]['id']){delete _0x41ba58['body']['id'];}return db[_0xbe14('0x35')][_0xbe14('0x4f')]({'where':{'id':_0x41ba58['params']['id']}})[_0xbe14('0x30')](handleEntityNotFound(_0x410c59,null))[_0xbe14('0x30')](saveUpdates(_0x41ba58[_0xbe14('0x51')],null))[_0xbe14('0x30')](respondWithResult(_0x410c59,null))[_0xbe14('0x22')](handleError(_0x410c59,null));};exports['destroy']=function(_0x42a346,_0x34cd66){return db[_0xbe14('0x35')][_0xbe14('0x4f')]({'where':{'id':_0x42a346[_0xbe14('0x4d')]['id']}})[_0xbe14('0x30')](handleEntityNotFound(_0x34cd66,null))[_0xbe14('0x30')](removeEntity(_0x34cd66,null))['catch'](handleError(_0x34cd66,null));};exports[_0xbe14('0x52')]=function(_0x1b47a4,_0x941ee2,_0x1201e2){var _0x246ed5={};var _0x2ed3fb={};var _0xd8f78f;var _0x32df3c;return db[_0xbe14('0x35')][_0xbe14('0x53')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x941ee2,null))['then'](function(_0x58dd79){if(_0x58dd79){_0xd8f78f=_0x58dd79;_0x2ed3fb[_0xbe14('0x37')]=_[_0xbe14('0x38')](db[_0xbe14('0x54')][_0xbe14('0x36')]);_0x2ed3fb[_0xbe14('0x39')]=_[_0xbe14('0x38')](_0x1b47a4[_0xbe14('0x39')]);_0x2ed3fb[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x2ed3fb[_0xbe14('0x37')],_0x2ed3fb[_0xbe14('0x39')]);_0x246ed5[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x2ed3fb[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0x1b47a4[_0xbe14('0x39')][_0xbe14('0x3d')]));_0x246ed5[_0xbe14('0x3c')]=_0x246ed5[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x246ed5['attributes']:_0x2ed3fb[_0xbe14('0x37')];_0x246ed5[_0xbe14('0x40')]=qs[_0xbe14('0x41')](_0x1b47a4[_0xbe14('0x39')][_0xbe14('0x41')]);_0x246ed5[_0xbe14('0x44')]=qs[_0xbe14('0x3a')](_[_0xbe14('0x42')](_0x1b47a4[_0xbe14('0x39')],_0x2ed3fb[_0xbe14('0x3a')]));if(_0x1b47a4['query'][_0xbe14('0x43')]){_0x246ed5[_0xbe14('0x44')]=_[_0xbe14('0x47')](_0x246ed5[_0xbe14('0x44')],{'$or':_[_0xbe14('0x45')](_0x246ed5['attributes'],function(_0x42b341){var _0x120077={};_0x120077[_0x42b341]={'$like':'%'+_0x1b47a4[_0xbe14('0x39')][_0xbe14('0x43')]+'%'};return _0x120077;})});}_0x246ed5=_[_0xbe14('0x47')]({},_0x246ed5,_0x1b47a4['options']);return _0xd8f78f[_0xbe14('0x52')](_0x246ed5);}})[_0xbe14('0x30')](function(_0x7ea146){if(_0x7ea146){_0x32df3c=_0x7ea146[_0xbe14('0x3e')];if(!_0x1b47a4[_0xbe14('0x39')][_0xbe14('0x3f')](_0xbe14('0x55'))){_0x246ed5[_0xbe14('0x29')]=qs['limit'](_0x1b47a4[_0xbe14('0x39')][_0xbe14('0x29')]);_0x246ed5[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x1b47a4[_0xbe14('0x39')][_0xbe14('0x28')]);}return _0xd8f78f[_0xbe14('0x52')](_0x246ed5);}})['then'](function(_0x4eedd2){if(_0x4eedd2){return _0x4eedd2?{'count':_0x32df3c,'rows':_0x4eedd2}:null;}})[_0xbe14('0x30')](respondWithResult(_0x941ee2,null))[_0xbe14('0x22')](handleError(_0x941ee2,null));};exports[_0xbe14('0x56')]=function(_0x2510a0,_0x312504,_0x28cade){var _0x23a32f={};var _0x43511e={};var _0x50e644;var _0x5ca835;return db[_0xbe14('0x35')][_0xbe14('0x53')]({'where':{'id':_0x2510a0[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x312504,null))[_0xbe14('0x30')](function(_0x16bca1){if(_0x16bca1){_0x50e644=_0x16bca1;_0x43511e[_0xbe14('0x37')]=_[_0xbe14('0x38')](db[_0xbe14('0x54')][_0xbe14('0x36')]);_0x43511e[_0xbe14('0x39')]=_['keys'](_0x2510a0[_0xbe14('0x39')]);_0x43511e[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x43511e[_0xbe14('0x37')],_0x43511e[_0xbe14('0x39')]);_0x23a32f[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x43511e['model'],qs[_0xbe14('0x3d')](_0x2510a0[_0xbe14('0x39')][_0xbe14('0x3d')]));_0x23a32f[_0xbe14('0x3c')]=_0x23a32f[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x23a32f[_0xbe14('0x3c')]:_0x43511e[_0xbe14('0x37')];_0x23a32f['order']=qs[_0xbe14('0x41')](_0x2510a0[_0xbe14('0x39')][_0xbe14('0x41')]);_0x23a32f[_0xbe14('0x44')]=qs[_0xbe14('0x3a')](_[_0xbe14('0x42')](_0x2510a0['query'],_0x43511e[_0xbe14('0x3a')]));if(_0x2510a0[_0xbe14('0x39')][_0xbe14('0x43')]){_0x23a32f[_0xbe14('0x44')]=_['merge'](_0x23a32f[_0xbe14('0x44')],{'$or':_[_0xbe14('0x45')](_0x23a32f[_0xbe14('0x3c')],function(_0x1e7770){var _0x80b6ec={};_0x80b6ec[_0x1e7770]={'$like':'%'+_0x2510a0[_0xbe14('0x39')][_0xbe14('0x43')]+'%'};return _0x80b6ec;})});}_0x23a32f=_['merge']({},_0x23a32f,_0x2510a0[_0xbe14('0x48')]);return _0x50e644['getSubjects'](_0x23a32f);}})[_0xbe14('0x30')](function(_0x5d85d3){if(_0x5d85d3){_0x5ca835=_0x5d85d3[_0xbe14('0x3e')];if(!_0x2510a0[_0xbe14('0x39')][_0xbe14('0x3f')]('nolimit')){_0x23a32f[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x2510a0[_0xbe14('0x39')]['limit']);_0x23a32f[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x2510a0[_0xbe14('0x39')][_0xbe14('0x28')]);}return _0x50e644['getSubjects'](_0x23a32f);}})[_0xbe14('0x30')](function(_0x39bc54){if(_0x39bc54){return _0x39bc54?{'count':_0x5ca835,'rows':_0x39bc54}:null;}})[_0xbe14('0x30')](respondWithResult(_0x312504,null))[_0xbe14('0x22')](handleError(_0x312504,null));};exports[_0xbe14('0x57')]=function(_0x2b9732,_0x2737ba,_0x5ab298){var _0x2ff94c={};var _0x123f4f={};var _0x2137d5;var _0x5c89a0;return db[_0xbe14('0x35')][_0xbe14('0x53')]({'where':{'id':_0x2b9732[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2737ba,null))[_0xbe14('0x30')](function(_0x1205d1){if(_0x1205d1){_0x2137d5=_0x1205d1;_0x123f4f['model']=_[_0xbe14('0x38')](db['ServicenowField'][_0xbe14('0x36')]);_0x123f4f[_0xbe14('0x39')]=_['keys'](_0x2b9732['query']);_0x123f4f[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x123f4f[_0xbe14('0x37')],_0x123f4f['query']);_0x2ff94c[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x123f4f[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0x2b9732['query']['fields']));_0x2ff94c[_0xbe14('0x3c')]=_0x2ff94c[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x2ff94c[_0xbe14('0x3c')]:_0x123f4f[_0xbe14('0x37')];_0x2ff94c[_0xbe14('0x40')]=qs[_0xbe14('0x41')](_0x2b9732['query'][_0xbe14('0x41')]);_0x2ff94c['where']=qs[_0xbe14('0x3a')](_[_0xbe14('0x42')](_0x2b9732[_0xbe14('0x39')],_0x123f4f[_0xbe14('0x3a')]));if(_0x2b9732['query'][_0xbe14('0x43')]){_0x2ff94c[_0xbe14('0x44')]=_[_0xbe14('0x47')](_0x2ff94c['where'],{'$or':_[_0xbe14('0x45')](_0x2ff94c[_0xbe14('0x3c')],function(_0x4090bc){var _0x34a277={};_0x34a277[_0x4090bc]={'$like':'%'+_0x2b9732[_0xbe14('0x39')][_0xbe14('0x43')]+'%'};return _0x34a277;})});}_0x2ff94c=_[_0xbe14('0x47')]({},_0x2ff94c,_0x2b9732[_0xbe14('0x48')]);return _0x2137d5[_0xbe14('0x57')](_0x2ff94c);}})[_0xbe14('0x30')](function(_0x2bf94c){if(_0x2bf94c){_0x5c89a0=_0x2bf94c[_0xbe14('0x3e')];if(!_0x2b9732[_0xbe14('0x39')][_0xbe14('0x3f')](_0xbe14('0x55'))){_0x2ff94c[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x2b9732[_0xbe14('0x39')][_0xbe14('0x29')]);_0x2ff94c[_0xbe14('0x28')]=qs['offset'](_0x2b9732[_0xbe14('0x39')]['offset']);}return _0x2137d5[_0xbe14('0x57')](_0x2ff94c);}})[_0xbe14('0x30')](function(_0x262bc0){if(_0x262bc0){return _0x262bc0?{'count':_0x5c89a0,'rows':_0x262bc0}:null;}})[_0xbe14('0x30')](respondWithResult(_0x2737ba,null))[_0xbe14('0x22')](handleError(_0x2737ba,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b636a78..a741820 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 _0xa904=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x3ef8f7,_0x35359a){var _0x3b097e=function(_0x189c92){while(--_0x189c92){_0x3ef8f7['push'](_0x3ef8f7['shift']());}};_0x3b097e(++_0x35359a);}(_0xa904,0xff));var _0x4a90=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xa904[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x4a90('0x0'));var util=require(_0x4a90('0x1'));var logger=require('../../config/logger')(_0x4a90('0x2'));var moment=require(_0x4a90('0x3'));var BPromise=require(_0x4a90('0x4'));var rp=require(_0x4a90('0x5'));var fs=require('fs');var path=require(_0x4a90('0x6'));var rimraf=require(_0x4a90('0x7'));var config=require(_0x4a90('0x8'));var attributes=require(_0x4a90('0x9'));module[_0x4a90('0xa')]=function(_0x4e14ea,_0x3cc791){return _0x4e14ea[_0x4a90('0xb')](_0x4a90('0xc'),attributes,{'tableName':_0x4a90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8da=['api','moment','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x41007e,_0x2d23b7){var _0xf6126d=function(_0xf1bc88){while(--_0xf1bc88){_0x41007e['push'](_0x41007e['shift']());}};_0xf6126d(++_0x2d23b7);}(_0xc8da,0x8d));var _0xac8d=function(_0x1fd05,_0x57f487){_0x1fd05=_0x1fd05-0x0;var _0x1e79a1=_0xc8da[_0x1fd05];return _0x1e79a1;};'use strict';var _=require(_0xac8d('0x0'));var util=require(_0xac8d('0x1'));var logger=require(_0xac8d('0x2'))(_0xac8d('0x3'));var moment=require(_0xac8d('0x4'));var BPromise=require('bluebird');var rp=require(_0xac8d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac8d('0x6'));var config=require(_0xac8d('0x7'));var attributes=require(_0xac8d('0x8'));module[_0xac8d('0x9')]=function(_0x4bfeb2,_0x201109){return _0x4bfeb2[_0xac8d('0xa')](_0xac8d('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 87a2f35..56dcdb8 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 _0x7c2d=['ioredis','../../mysqldb','rpc','../../config/environment','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring'];(function(_0x345865,_0x1d878d){var _0x2e14f4=function(_0x52e646){while(--_0x52e646){_0x345865['push'](_0x345865['shift']());}};_0x2e14f4(++_0x1d878d);}(_0x7c2d,0x113));var _0xd7c2=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7c2d[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xd7c2('0x0'));var util=require(_0xd7c2('0x1'));var moment=require(_0xd7c2('0x2'));var BPromise=require(_0xd7c2('0x3'));var rs=require(_0xd7c2('0x4'));var fs=require('fs');var Redis=require(_0xd7c2('0x5'));var db=require(_0xd7c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7c2('0x7'));var config=require(_0xd7c2('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7b24,_0x22449b,_0x1b3822){return new BPromise(function(_0x8e105,_0x109999){return client[_0xd7c2('0x9')](_0x2d7b24,_0x1b3822)[_0xd7c2('0xa')](function(_0x3617a2){logger['info'](_0xd7c2('0xb'),_0x22449b,_0xd7c2('0xc'));logger[_0xd7c2('0xd')](_0xd7c2('0xe'),_0x22449b,'request\x20sent',JSON[_0xd7c2('0xf')](_0x3617a2));if(_0x3617a2[_0xd7c2('0x10')]){if(_0x3617a2[_0xd7c2('0x10')][_0xd7c2('0x11')]===0x1f4){logger[_0xd7c2('0x10')](_0xd7c2('0xb'),_0x22449b,_0x3617a2['error'][_0xd7c2('0x12')]);return _0x109999(_0x3617a2['error'][_0xd7c2('0x12')]);}logger[_0xd7c2('0x10')](_0xd7c2('0xb'),_0x22449b,_0x3617a2[_0xd7c2('0x10')]['message']);return _0x8e105(_0x3617a2['error'][_0xd7c2('0x12')]);}else{logger[_0xd7c2('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x22449b,_0xd7c2('0xc'));_0x8e105(_0x3617a2['result'][_0xd7c2('0x12')]);}})['catch'](function(_0x5c1454){logger[_0xd7c2('0x10')](_0xd7c2('0xb'),_0x22449b,_0x5c1454);_0x109999(_0x5c1454);});});} \ No newline at end of file +var _0xfbe6=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0xfbe6,0xf7));var _0x6fbe=function(_0x512738,_0x52ef6b){_0x512738=_0x512738-0x0;var _0x1bdb2b=_0xfbe6[_0x512738];return _0x1bdb2b;};'use strict';var _=require(_0x6fbe('0x0'));var util=require(_0x6fbe('0x1'));var moment=require(_0x6fbe('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fbe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fbe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fbe('0x5'))('rpc');var config=require(_0x6fbe('0x6'));var jayson=require(_0x6fbe('0x7'));var client=jayson['client'][_0x6fbe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a4f40,_0x145a1b,_0xc1d998){return new BPromise(function(_0x57c5f8,_0x318df5){return client[_0x6fbe('0x9')](_0x1a4f40,_0xc1d998)[_0x6fbe('0xa')](function(_0x3221c6){logger[_0x6fbe('0xb')](_0x6fbe('0xc'),_0x145a1b,_0x6fbe('0xd'));logger['debug'](_0x6fbe('0xe'),_0x145a1b,_0x6fbe('0xd'),JSON[_0x6fbe('0xf')](_0x3221c6));if(_0x3221c6[_0x6fbe('0x10')]){if(_0x3221c6[_0x6fbe('0x10')]['code']===0x1f4){logger['error'](_0x6fbe('0xc'),_0x145a1b,_0x3221c6[_0x6fbe('0x10')][_0x6fbe('0x11')]);return _0x318df5(_0x3221c6['error']['message']);}logger[_0x6fbe('0x10')](_0x6fbe('0xc'),_0x145a1b,_0x3221c6[_0x6fbe('0x10')]['message']);return _0x57c5f8(_0x3221c6[_0x6fbe('0x10')][_0x6fbe('0x11')]);}else{logger[_0x6fbe('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x145a1b,_0x6fbe('0xd'));_0x57c5f8(_0x3221c6['result']['message']);}})[_0x6fbe('0x12')](function(_0x3111b5){logger[_0x6fbe('0x10')](_0x6fbe('0xc'),_0x145a1b,_0x3111b5);_0x318df5(_0x3111b5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9a623f9..9b02718 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 _0xf5d4=['isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x18a715,_0x227c47){var _0xef1375=function(_0x2da19c){while(--_0x2da19c){_0x18a715['push'](_0x18a715['shift']());}};_0xef1375(++_0x227c47);}(_0xf5d4,0x16f));var _0x4f5d=function(_0x2a70ae,_0x5e95ae){_0x2a70ae=_0x2a70ae-0x0;var _0x5a099b=_0xf5d4[_0x2a70ae];return _0x5a099b;};'use strict';var multer=require(_0x4f5d('0x0'));var util=require(_0x4f5d('0x1'));var path=require('path');var timeout=require(_0x4f5d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4f5d('0x3'));var interaction=require(_0x4f5d('0x4'));var config=require(_0x4f5d('0x5'));var controller=require('./intServicenowField.controller');router[_0x4f5d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4f5d('0x7'),auth[_0x4f5d('0x8')](),controller['show']);router['post']('/',auth[_0x4f5d('0x8')](),controller[_0x4f5d('0x9')]);router[_0x4f5d('0xa')](_0x4f5d('0x7'),auth[_0x4f5d('0x8')](),controller[_0x4f5d('0xb')]);router[_0x4f5d('0xc')](_0x4f5d('0x7'),auth[_0x4f5d('0x8')](),controller[_0x4f5d('0xd')]);module[_0x4f5d('0xe')]=router; \ No newline at end of file +var _0xa418=['/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x199037,_0x830990){var _0x30613d=function(_0x2f9772){while(--_0x2f9772){_0x199037['push'](_0x199037['shift']());}};_0x30613d(++_0x830990);}(_0xa418,0x1c9));var _0x8a41=function(_0x5d014e,_0x37e90c){_0x5d014e=_0x5d014e-0x0;var _0x2a4fa2=_0xa418[_0x5d014e];return _0x2a4fa2;};'use strict';var multer=require(_0x8a41('0x0'));var util=require(_0x8a41('0x1'));var path=require(_0x8a41('0x2'));var timeout=require(_0x8a41('0x3'));var express=require(_0x8a41('0x4'));var router=express['Router']();var auth=require(_0x8a41('0x5'));var interaction=require(_0x8a41('0x6'));var config=require(_0x8a41('0x7'));var controller=require(_0x8a41('0x8'));router[_0x8a41('0x9')]('/',auth[_0x8a41('0xa')](),controller['index']);router[_0x8a41('0x9')](_0x8a41('0xb'),auth[_0x8a41('0xa')](),controller[_0x8a41('0xc')]);router['post']('/',auth[_0x8a41('0xa')](),controller[_0x8a41('0xd')]);router['put'](_0x8a41('0xb'),auth[_0x8a41('0xa')](),controller[_0x8a41('0xe')]);router[_0x8a41('0xf')](_0x8a41('0xb'),auth[_0x8a41('0xa')](),controller[_0x8a41('0x10')]);module[_0x8a41('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 884bbce..29aa912 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 _0x70e0=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x101baf,_0x52fc6a){var _0xc45614=function(_0x5590df){while(--_0x5590df){_0x101baf['push'](_0x101baf['shift']());}};_0xc45614(++_0x52fc6a);}(_0x70e0,0x17b));var _0x070e=function(_0x449e68,_0x38a8b6){_0x449e68=_0x449e68-0x0;var _0x455fc0=_0x70e0[_0x449e68];return _0x455fc0;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'type':{'type':Sequelize[_0x070e('0x2')]('string','variable',_0x070e('0x3'),_0x070e('0x4')),'defaultValue':_0x070e('0x5')},'content':{'type':Sequelize[_0x070e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x070e('0x2')]('string',_0x070e('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x070e('0x6')]},'customField':{'type':Sequelize[_0x070e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xdace=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0xe10b42,_0x450598){var _0x44607e=function(_0x5aa619){while(--_0x5aa619){_0xe10b42['push'](_0xe10b42['shift']());}};_0x44607e(++_0x450598);}(_0xdace,0xc5));var _0xedac=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xdace[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'type':{'type':Sequelize[_0xedac('0x1')](_0xedac('0x2'),_0xedac('0x3'),'customVariable',_0xedac('0x4')),'defaultValue':_0xedac('0x2')},'content':{'type':Sequelize[_0xedac('0x5')]},'key':{'type':Sequelize[_0xedac('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xedac('0x2'),_0xedac('0x3'),_0xedac('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xedac('0x5')]},'nameField':{'type':Sequelize[_0xedac('0x5')]},'customField':{'type':Sequelize[_0xedac('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a93ca99..3b54b26 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 _0x2328=['send','index','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','ServicenowField','findAll','rows','catch','show','intersection','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','stack','name'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x2328,0xae));var _0x8232=function(_0x3d5c8c,_0x1126bd){_0x3d5c8c=_0x3d5c8c-0x0;var _0x4482c8=_0x2328[_0x3d5c8c];return _0x4482c8;};'use strict';var pdf=require(_0x8232('0x0'));var emlformat=require(_0x8232('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8232('0x2'));var rp=require(_0x8232('0x3'));var moment=require(_0x8232('0x4'));var BPromise=require(_0x8232('0x5'));var Mustache=require('mustache');var util=require(_0x8232('0x6'));var path=require(_0x8232('0x7'));var sox=require(_0x8232('0x8'));var csv=require(_0x8232('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8232('0xa'));var squel=require(_0x8232('0xb'));var crypto=require(_0x8232('0xc'));var jsforce=require(_0x8232('0xd'));var deskjs=require(_0x8232('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8232('0xf'));var Papa=require(_0x8232('0x10'));var Redis=require(_0x8232('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8232('0x12'));var hardwareService=require(_0x8232('0x13'));var logger=require(_0x8232('0x14'))(_0x8232('0x15'));var utils=require(_0x8232('0x16'));var config=require(_0x8232('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dedf8,_0x11358c){_0x11358c=_0x11358c||0xcc;return function(_0x2af861){if(_0x2af861){return _0x5dedf8[_0x8232('0x18')](_0x11358c);}return _0x5dedf8[_0x8232('0x19')](_0x11358c)[_0x8232('0x1a')]();};}function respondWithResult(_0x394167,_0x33a0fa){_0x33a0fa=_0x33a0fa||0xc8;return function(_0x4dd50e){if(_0x4dd50e){return _0x394167[_0x8232('0x19')](_0x33a0fa)['json'](_0x4dd50e);}};}function respondWithFilteredResult(_0xa25bcb,_0x4d43d1){return function(_0x4397e5){if(_0x4397e5){var _0x1a9705=_0x4397e5[_0x8232('0x1b')],_0x4cc35a=_0x4d43d1[_0x8232('0x1c')],_0x41c407=_0x4d43d1[_0x8232('0x1c')]+_0x4d43d1[_0x8232('0x1d')],_0x871407;if(_0x41c407>=_0x1a9705){_0x41c407=_0x1a9705;_0x871407=0xc8;}else{_0x871407=0xce;}_0xa25bcb[_0x8232('0x19')](_0x871407);return _0xa25bcb['set'](_0x8232('0x1e'),_0x4cc35a+'-'+_0x41c407+'/'+_0x1a9705)[_0x8232('0x1f')](_0x4397e5);}return null;};}function patchUpdates(_0x15d8cb){return function(_0x13e75c){try{jsonpatch['apply'](_0x13e75c,_0x15d8cb,!![]);}catch(_0x3fc068){return BPromise[_0x8232('0x20')](_0x3fc068);}return _0x13e75c[_0x8232('0x21')]();};}function saveUpdates(_0x5846bd,_0x2fc0f5){return function(_0xf979cc){if(_0xf979cc){return _0xf979cc[_0x8232('0x22')](_0x5846bd)[_0x8232('0x23')](function(_0x178865){return _0x178865;});}return null;};}function removeEntity(_0x4c4a82,_0x19ddeb){return function(_0x23ab6a){if(_0x23ab6a){return _0x23ab6a[_0x8232('0x24')]()[_0x8232('0x23')](function(){_0x4c4a82['status'](0xcc)[_0x8232('0x1a')]();});}};}function handleEntityNotFound(_0x568990,_0x5c7df2){return function(_0x81f835){if(!_0x81f835){_0x568990['sendStatus'](0x194);}return _0x81f835;};}function handleError(_0x1875ab,_0x36d132){_0x36d132=_0x36d132||0x1f4;return function(_0xae874d){logger['error'](_0xae874d[_0x8232('0x25')]);if(_0xae874d[_0x8232('0x26')]){delete _0xae874d[_0x8232('0x26')];}_0x1875ab[_0x8232('0x19')](_0x36d132)[_0x8232('0x27')](_0xae874d);};}exports[_0x8232('0x28')]=function(_0x2c85c8,_0x2ac529){var _0x1ab672={},_0x106f07={},_0x112f17={'count':0x0,'rows':[]};var _0x566d13=db['ServicenowField'][_0x8232('0x29')];_0x106f07[_0x8232('0x2a')]=_[_0x8232('0x2b')](_0x566d13);_0x106f07[_0x8232('0x2c')]=_[_0x8232('0x2b')](_0x2c85c8['query']);_0x106f07[_0x8232('0x2d')]=_['intersection'](_0x106f07[_0x8232('0x2a')],_0x106f07[_0x8232('0x2c')]);_0x1ab672[_0x8232('0x2e')]=_['intersection'](_0x106f07[_0x8232('0x2a')],qs[_0x8232('0x2f')](_0x2c85c8[_0x8232('0x2c')][_0x8232('0x2f')]));_0x1ab672[_0x8232('0x2e')]=_0x1ab672[_0x8232('0x2e')][_0x8232('0x30')]?_0x1ab672[_0x8232('0x2e')]:_0x106f07[_0x8232('0x2a')];if(!_0x2c85c8[_0x8232('0x2c')][_0x8232('0x31')](_0x8232('0x32'))){_0x1ab672[_0x8232('0x1d')]=qs[_0x8232('0x1d')](_0x2c85c8['query'][_0x8232('0x1d')]);_0x1ab672[_0x8232('0x1c')]=qs['offset'](_0x2c85c8[_0x8232('0x2c')]['offset']);}_0x1ab672[_0x8232('0x33')]=qs[_0x8232('0x34')](_0x2c85c8[_0x8232('0x2c')][_0x8232('0x34')]);_0x1ab672[_0x8232('0x35')]=qs[_0x8232('0x2d')](_[_0x8232('0x36')](_0x2c85c8[_0x8232('0x2c')],_0x106f07['filters']));if(_0x2c85c8[_0x8232('0x2c')][_0x8232('0x37')]){_0x1ab672[_0x8232('0x35')]=_[_0x8232('0x38')](_0x1ab672[_0x8232('0x35')],{'$or':_['map'](_0x566d13,function(_0x11debc){if(_0x11debc[_0x8232('0x39')]['key']!==_0x8232('0x3a')){var _0x565ad9={};_0x565ad9[_0x11debc['field']]={'$like':'%'+_0x2c85c8['query'][_0x8232('0x37')]+'%'};return _0x565ad9;}})});}_0x1ab672=_[_0x8232('0x38')]({},_0x1ab672,_0x2c85c8[_0x8232('0x3b')]);var _0x1bcec0={'where':_0x1ab672[_0x8232('0x35')]};return db['ServicenowField'][_0x8232('0x1b')](_0x1bcec0)[_0x8232('0x23')](function(_0xa08113){_0x112f17['count']=_0xa08113;if(_0x2c85c8['query'][_0x8232('0x3c')]){_0x1ab672['include']=[{'all':!![]}];}return db[_0x8232('0x3d')][_0x8232('0x3e')](_0x1ab672);})[_0x8232('0x23')](function(_0x40cf1b){_0x112f17[_0x8232('0x3f')]=_0x40cf1b;return _0x112f17;})[_0x8232('0x23')](respondWithFilteredResult(_0x2ac529,_0x1ab672))[_0x8232('0x40')](handleError(_0x2ac529,null));};exports[_0x8232('0x41')]=function(_0x2abd87,_0x2d6cd4){var _0x4f0c40={'raw':!![],'where':{'id':_0x2abd87['params']['id']}},_0x1693fe={};_0x1693fe[_0x8232('0x2a')]=_['keys'](db[_0x8232('0x3d')][_0x8232('0x29')]);_0x1693fe[_0x8232('0x2c')]=_[_0x8232('0x2b')](_0x2abd87['query']);_0x1693fe[_0x8232('0x2d')]=_[_0x8232('0x42')](_0x1693fe[_0x8232('0x2a')],_0x1693fe[_0x8232('0x2c')]);_0x4f0c40[_0x8232('0x2e')]=_['intersection'](_0x1693fe[_0x8232('0x2a')],qs['fields'](_0x2abd87[_0x8232('0x2c')][_0x8232('0x2f')]));_0x4f0c40[_0x8232('0x2e')]=_0x4f0c40[_0x8232('0x2e')][_0x8232('0x30')]?_0x4f0c40[_0x8232('0x2e')]:_0x1693fe['model'];if(_0x2abd87['query'][_0x8232('0x3c')]){_0x4f0c40['include']=[{'all':!![]}];}_0x4f0c40=_[_0x8232('0x38')]({},_0x4f0c40,_0x2abd87[_0x8232('0x3b')]);return db['ServicenowField'][_0x8232('0x43')](_0x4f0c40)[_0x8232('0x23')](handleEntityNotFound(_0x2d6cd4,null))[_0x8232('0x23')](respondWithResult(_0x2d6cd4,null))[_0x8232('0x40')](handleError(_0x2d6cd4,null));};exports['create']=function(_0x274cfe,_0x57a285){return db[_0x8232('0x3d')][_0x8232('0x44')](_0x274cfe['body'],{})[_0x8232('0x23')](respondWithResult(_0x57a285,0xc9))[_0x8232('0x40')](handleError(_0x57a285,null));};exports['update']=function(_0x432feb,_0x315f32){if(_0x432feb[_0x8232('0x45')]['id']){delete _0x432feb[_0x8232('0x45')]['id'];}return db[_0x8232('0x3d')]['find']({'where':{'id':_0x432feb[_0x8232('0x46')]['id']}})[_0x8232('0x23')](handleEntityNotFound(_0x315f32,null))[_0x8232('0x23')](saveUpdates(_0x432feb[_0x8232('0x45')],null))[_0x8232('0x23')](respondWithResult(_0x315f32,null))[_0x8232('0x40')](handleError(_0x315f32,null));};exports[_0x8232('0x24')]=function(_0x16b3c8,_0x973ed5){return db[_0x8232('0x3d')][_0x8232('0x43')]({'where':{'id':_0x16b3c8['params']['id']}})[_0x8232('0x23')](handleEntityNotFound(_0x973ed5,null))[_0x8232('0x23')](removeEntity(_0x973ed5,null))[_0x8232('0x40')](handleError(_0x973ed5,null));}; \ No newline at end of file +var _0xcbc6=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowField','model','keys','query'];(function(_0x308d8d,_0x479ebd){var _0x374fcd=function(_0x5f1fb5){while(--_0x5f1fb5){_0x308d8d['push'](_0x308d8d['shift']());}};_0x374fcd(++_0x479ebd);}(_0xcbc6,0x64));var _0x6cbc=function(_0x303e2c,_0x4aafae){_0x303e2c=_0x303e2c-0x0;var _0x400cd7=_0xcbc6[_0x303e2c];return _0x400cd7;};'use strict';var pdf=require(_0x6cbc('0x0'));var emlformat=require(_0x6cbc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6cbc('0x2'));var moment=require(_0x6cbc('0x3'));var BPromise=require(_0x6cbc('0x4'));var Mustache=require(_0x6cbc('0x5'));var util=require('util');var path=require(_0x6cbc('0x6'));var sox=require(_0x6cbc('0x7'));var csv=require('to-csv');var ejs=require(_0x6cbc('0x8'));var fs=require('fs');var _=require(_0x6cbc('0x9'));var squel=require(_0x6cbc('0xa'));var crypto=require('crypto');var jsforce=require(_0x6cbc('0xb'));var deskjs=require(_0x6cbc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6cbc('0xd'));var Papa=require('papaparse');var Redis=require(_0x6cbc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x6cbc('0xf'));var logger=require(_0x6cbc('0x10'))(_0x6cbc('0x11'));var utils=require(_0x6cbc('0x12'));var config=require(_0x6cbc('0x13'));var db=require(_0x6cbc('0x14'))['db'];function respondWithStatusCode(_0x2222cc,_0x28552c){_0x28552c=_0x28552c||0xcc;return function(_0x477d55){if(_0x477d55){return _0x2222cc[_0x6cbc('0x15')](_0x28552c);}return _0x2222cc[_0x6cbc('0x16')](_0x28552c)[_0x6cbc('0x17')]();};}function respondWithResult(_0x13b4f1,_0x4984bb){_0x4984bb=_0x4984bb||0xc8;return function(_0x3128cf){if(_0x3128cf){return _0x13b4f1['status'](_0x4984bb)['json'](_0x3128cf);}};}function respondWithFilteredResult(_0x112b11,_0x2c3b9f){return function(_0x556bf0){if(_0x556bf0){var _0x4831c1=_0x556bf0[_0x6cbc('0x18')],_0x2e7380=_0x2c3b9f[_0x6cbc('0x19')],_0x590e52=_0x2c3b9f[_0x6cbc('0x19')]+_0x2c3b9f[_0x6cbc('0x1a')],_0x23998c;if(_0x590e52>=_0x4831c1){_0x590e52=_0x4831c1;_0x23998c=0xc8;}else{_0x23998c=0xce;}_0x112b11[_0x6cbc('0x16')](_0x23998c);return _0x112b11[_0x6cbc('0x1b')]('Content-Range',_0x2e7380+'-'+_0x590e52+'/'+_0x4831c1)[_0x6cbc('0x1c')](_0x556bf0);}return null;};}function patchUpdates(_0x228b4c){return function(_0x3a4006){try{jsonpatch[_0x6cbc('0x1d')](_0x3a4006,_0x228b4c,!![]);}catch(_0x181c4f){return BPromise[_0x6cbc('0x1e')](_0x181c4f);}return _0x3a4006[_0x6cbc('0x1f')]();};}function saveUpdates(_0x11c93f,_0x2d9899){return function(_0x52bc83){if(_0x52bc83){return _0x52bc83[_0x6cbc('0x20')](_0x11c93f)[_0x6cbc('0x21')](function(_0x40df7d){return _0x40df7d;});}return null;};}function removeEntity(_0x3f4142,_0x9c3948){return function(_0x664716){if(_0x664716){return _0x664716[_0x6cbc('0x22')]()[_0x6cbc('0x21')](function(){_0x3f4142[_0x6cbc('0x16')](0xcc)[_0x6cbc('0x17')]();});}};}function handleEntityNotFound(_0x4264a2,_0x33e047){return function(_0x3981ac){if(!_0x3981ac){_0x4264a2[_0x6cbc('0x15')](0x194);}return _0x3981ac;};}function handleError(_0x4399e6,_0x2e5c7b){_0x2e5c7b=_0x2e5c7b||0x1f4;return function(_0x4ed23a){logger[_0x6cbc('0x23')](_0x4ed23a[_0x6cbc('0x24')]);if(_0x4ed23a[_0x6cbc('0x25')]){delete _0x4ed23a[_0x6cbc('0x25')];}_0x4399e6[_0x6cbc('0x16')](_0x2e5c7b)[_0x6cbc('0x26')](_0x4ed23a);};}exports[_0x6cbc('0x27')]=function(_0x1cf225,_0x4e2111){var _0x2347e5={},_0x1442ef={},_0xd4da46={'count':0x0,'rows':[]};var _0x4549da=db[_0x6cbc('0x28')]['rawAttributes'];_0x1442ef[_0x6cbc('0x29')]=_[_0x6cbc('0x2a')](_0x4549da);_0x1442ef[_0x6cbc('0x2b')]=_['keys'](_0x1cf225['query']);_0x1442ef[_0x6cbc('0x2c')]=_[_0x6cbc('0x2d')](_0x1442ef['model'],_0x1442ef[_0x6cbc('0x2b')]);_0x2347e5[_0x6cbc('0x2e')]=_['intersection'](_0x1442ef[_0x6cbc('0x29')],qs[_0x6cbc('0x2f')](_0x1cf225[_0x6cbc('0x2b')][_0x6cbc('0x2f')]));_0x2347e5[_0x6cbc('0x2e')]=_0x2347e5['attributes'][_0x6cbc('0x30')]?_0x2347e5[_0x6cbc('0x2e')]:_0x1442ef[_0x6cbc('0x29')];if(!_0x1cf225['query'][_0x6cbc('0x31')](_0x6cbc('0x32'))){_0x2347e5[_0x6cbc('0x1a')]=qs['limit'](_0x1cf225[_0x6cbc('0x2b')]['limit']);_0x2347e5[_0x6cbc('0x19')]=qs[_0x6cbc('0x19')](_0x1cf225['query'][_0x6cbc('0x19')]);}_0x2347e5[_0x6cbc('0x33')]=qs[_0x6cbc('0x34')](_0x1cf225[_0x6cbc('0x2b')][_0x6cbc('0x34')]);_0x2347e5[_0x6cbc('0x35')]=qs['filters'](_[_0x6cbc('0x36')](_0x1cf225[_0x6cbc('0x2b')],_0x1442ef[_0x6cbc('0x2c')]));if(_0x1cf225[_0x6cbc('0x2b')]['filter']){_0x2347e5[_0x6cbc('0x35')]=_[_0x6cbc('0x37')](_0x2347e5[_0x6cbc('0x35')],{'$or':_[_0x6cbc('0x38')](_0x4549da,function(_0x10861a){if(_0x10861a[_0x6cbc('0x39')][_0x6cbc('0x3a')]!==_0x6cbc('0x3b')){var _0x2e954c={};_0x2e954c[_0x10861a[_0x6cbc('0x3c')]]={'$like':'%'+_0x1cf225[_0x6cbc('0x2b')]['filter']+'%'};return _0x2e954c;}})});}_0x2347e5=_[_0x6cbc('0x37')]({},_0x2347e5,_0x1cf225[_0x6cbc('0x3d')]);var _0xcf7bc6={'where':_0x2347e5[_0x6cbc('0x35')]};return db[_0x6cbc('0x28')][_0x6cbc('0x18')](_0xcf7bc6)[_0x6cbc('0x21')](function(_0x19d276){_0xd4da46[_0x6cbc('0x18')]=_0x19d276;if(_0x1cf225[_0x6cbc('0x2b')][_0x6cbc('0x3e')]){_0x2347e5[_0x6cbc('0x3f')]=[{'all':!![]}];}return db[_0x6cbc('0x28')][_0x6cbc('0x40')](_0x2347e5);})[_0x6cbc('0x21')](function(_0x75d600){_0xd4da46['rows']=_0x75d600;return _0xd4da46;})[_0x6cbc('0x21')](respondWithFilteredResult(_0x4e2111,_0x2347e5))[_0x6cbc('0x41')](handleError(_0x4e2111,null));};exports[_0x6cbc('0x42')]=function(_0x44eadc,_0x2549ba){var _0x160f0b={'raw':!![],'where':{'id':_0x44eadc[_0x6cbc('0x43')]['id']}},_0x3469fc={};_0x3469fc[_0x6cbc('0x29')]=_[_0x6cbc('0x2a')](db[_0x6cbc('0x28')][_0x6cbc('0x44')]);_0x3469fc[_0x6cbc('0x2b')]=_[_0x6cbc('0x2a')](_0x44eadc[_0x6cbc('0x2b')]);_0x3469fc['filters']=_[_0x6cbc('0x2d')](_0x3469fc[_0x6cbc('0x29')],_0x3469fc[_0x6cbc('0x2b')]);_0x160f0b['attributes']=_[_0x6cbc('0x2d')](_0x3469fc[_0x6cbc('0x29')],qs['fields'](_0x44eadc[_0x6cbc('0x2b')][_0x6cbc('0x2f')]));_0x160f0b[_0x6cbc('0x2e')]=_0x160f0b[_0x6cbc('0x2e')][_0x6cbc('0x30')]?_0x160f0b[_0x6cbc('0x2e')]:_0x3469fc[_0x6cbc('0x29')];if(_0x44eadc[_0x6cbc('0x2b')]['includeAll']){_0x160f0b[_0x6cbc('0x3f')]=[{'all':!![]}];}_0x160f0b=_[_0x6cbc('0x37')]({},_0x160f0b,_0x44eadc['options']);return db[_0x6cbc('0x28')][_0x6cbc('0x45')](_0x160f0b)[_0x6cbc('0x21')](handleEntityNotFound(_0x2549ba,null))[_0x6cbc('0x21')](respondWithResult(_0x2549ba,null))['catch'](handleError(_0x2549ba,null));};exports[_0x6cbc('0x46')]=function(_0x53efcf,_0x4fade1){return db[_0x6cbc('0x28')][_0x6cbc('0x46')](_0x53efcf[_0x6cbc('0x47')],{})[_0x6cbc('0x21')](respondWithResult(_0x4fade1,0xc9))[_0x6cbc('0x41')](handleError(_0x4fade1,null));};exports[_0x6cbc('0x20')]=function(_0x3e50f6,_0x4a2e57){if(_0x3e50f6[_0x6cbc('0x47')]['id']){delete _0x3e50f6['body']['id'];}return db[_0x6cbc('0x28')][_0x6cbc('0x45')]({'where':{'id':_0x3e50f6[_0x6cbc('0x43')]['id']}})[_0x6cbc('0x21')](handleEntityNotFound(_0x4a2e57,null))[_0x6cbc('0x21')](saveUpdates(_0x3e50f6[_0x6cbc('0x47')],null))[_0x6cbc('0x21')](respondWithResult(_0x4a2e57,null))[_0x6cbc('0x41')](handleError(_0x4a2e57,null));};exports['destroy']=function(_0xc23c34,_0x10c0f8){return db[_0x6cbc('0x28')]['find']({'where':{'id':_0xc23c34[_0x6cbc('0x43')]['id']}})[_0x6cbc('0x21')](handleEntityNotFound(_0x10c0f8,null))[_0x6cbc('0x21')](removeEntity(_0x10c0f8,null))[_0x6cbc('0x41')](handleError(_0x10c0f8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index df9bd67..c24754b 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 _0x6f49=['rimraf','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x43caa8,_0x48236b){var _0x2d8042=function(_0x44e3fe){while(--_0x44e3fe){_0x43caa8['push'](_0x43caa8['shift']());}};_0x2d8042(++_0x48236b);}(_0x6f49,0x14a));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x96f4('0x0'));var logger=require(_0x96f4('0x1'))(_0x96f4('0x2'));var moment=require(_0x96f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x96f4('0x4'));var fs=require('fs');var path=require(_0x96f4('0x5'));var rimraf=require(_0x96f4('0x6'));var config=require('../../config/environment');var attributes=require(_0x96f4('0x7'));module[_0x96f4('0x8')]=function(_0x325d2e,_0x11f796){return _0x325d2e[_0x96f4('0x9')](_0x96f4('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x96f4('0xb'),'fields':[_0x96f4('0xc'),_0x96f4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf4e=['request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf4e,0x170));var _0xedf4=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xdf4e[_0x47c5bf];return _0x11b779;};'use strict';var _=require(_0xedf4('0x0'));var util=require(_0xedf4('0x1'));var logger=require(_0xedf4('0x2'))(_0xedf4('0x3'));var moment=require(_0xedf4('0x4'));var BPromise=require(_0xedf4('0x5'));var rp=require(_0xedf4('0x6'));var fs=require('fs');var path=require(_0xedf4('0x7'));var rimraf=require(_0xedf4('0x8'));var config=require(_0xedf4('0x9'));var attributes=require('./intServicenowField.attributes');module[_0xedf4('0xa')]=function(_0x3c9f8c,_0xbe844a){return _0x3c9f8c[_0xedf4('0xb')](_0xedf4('0xc'),attributes,{'tableName':_0xedf4('0xd'),'paranoid':![],'indexes':[{'name':_0xedf4('0xe'),'fields':[_0xedf4('0xf'),_0xedf4('0x10')],'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 513a112..e27198b 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 _0x5430=['ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5430,0x10c));var _0x0543=function(_0xb5bd0e,_0xe958f5){_0xb5bd0e=_0xb5bd0e-0x0;var _0x1a1dfa=_0x5430[_0xb5bd0e];return _0x1a1dfa;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('ServicenowField,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('ServicenowField,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x80d9c9,_0x499db2){var _0x4e3c5b=function(_0x4e22b1){while(--_0x4e22b1){_0x80d9c9['push'](_0x80d9c9['shift']());}};_0x4e3c5b(++_0x499db2);}(_0xdb28,0x106));var _0x8db2=function(_0x1b9435,_0x284cac){_0x1b9435=_0x1b9435-0x0;var _0xc53501=_0xdb28[_0x1b9435];return _0xc53501;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5d21b46..fd75d49 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 _0x962b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x962b,0xba));var _0xb962=function(_0x5b56e3,_0x9e2d1e){_0x5b56e3=_0x5b56e3-0x0;var _0x337e10=_0x962b[_0x5b56e3];return _0x337e10;};'use strict';var multer=require(_0xb962('0x0'));var util=require(_0xb962('0x1'));var path=require(_0xb962('0x2'));var timeout=require(_0xb962('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb962('0x4'));var config=require(_0xb962('0x5'));var controller=require('./intSugarcrmAccount.controller');router[_0xb962('0x6')]('/',auth[_0xb962('0x7')](),controller[_0xb962('0x8')]);router[_0xb962('0x6')](_0xb962('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb962('0x6')](_0xb962('0xa'),auth[_0xb962('0x7')](),controller['getConfigurations']);router[_0xb962('0x6')](_0xb962('0xb'),auth[_0xb962('0x7')](),controller['getFields']);router[_0xb962('0xc')]('/',auth['isAuthenticated'](),controller[_0xb962('0xd')]);router['post'](_0xb962('0xa'),auth[_0xb962('0x7')](),controller[_0xb962('0xe')]);router[_0xb962('0xf')](_0xb962('0x9'),auth[_0xb962('0x7')](),controller['update']);router[_0xb962('0x10')](_0xb962('0x9'),auth[_0xb962('0x7')](),controller[_0xb962('0x11')]);module[_0xb962('0x12')]=router; \ No newline at end of file +var _0x0778=['express','../../components/interaction/service','get','isAuthenticated','index','/:id/configurations','/:id/fields','post','create','put','/:id','update','delete','multer','util','path','connect-timeout'];(function(_0x3f71ed,_0x13709b){var _0x5c3986=function(_0x4946d2){while(--_0x4946d2){_0x3f71ed['push'](_0x3f71ed['shift']());}};_0x5c3986(++_0x13709b);}(_0x0778,0x172));var _0x8077=function(_0x23b746,_0x26147b){_0x23b746=_0x23b746-0x0;var _0x20e630=_0x0778[_0x23b746];return _0x20e630;};'use strict';var multer=require(_0x8077('0x0'));var util=require(_0x8077('0x1'));var path=require(_0x8077('0x2'));var timeout=require(_0x8077('0x3'));var express=require(_0x8077('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8077('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0x8077('0x6')]('/',auth[_0x8077('0x7')](),controller[_0x8077('0x8')]);router[_0x8077('0x6')]('/:id',auth[_0x8077('0x7')](),controller['show']);router['get'](_0x8077('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x8077('0x6')](_0x8077('0xa'),auth[_0x8077('0x7')](),controller['getFields']);router[_0x8077('0xb')]('/',auth['isAuthenticated'](),controller[_0x8077('0xc')]);router[_0x8077('0xb')]('/:id/configurations',auth[_0x8077('0x7')](),controller['addConfiguration']);router[_0x8077('0xd')](_0x8077('0xe'),auth[_0x8077('0x7')](),controller[_0x8077('0xf')]);router[_0x8077('0x10')]('/:id',auth[_0x8077('0x7')](),controller['destroy']);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 256aced..de6cd6b 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 _0xb54c=['exports','STRING','remoteUri','sequelize'];(function(_0x2f9570,_0x57dc72){var _0x52df62=function(_0x537234){while(--_0x537234){_0x2f9570['push'](_0x2f9570['shift']());}};_0x52df62(++_0x57dc72);}(_0xb54c,0xd3));var _0xcb54=function(_0x5c8dcb,_0xf3b432){_0x5c8dcb=_0x5c8dcb-0x0;var _0x5eb929=_0xb54c[_0x5c8dcb];return _0x5eb929;};'use strict';var Sequelize=require(_0xcb54('0x0'));module[_0xcb54('0x1')]={'name':{'type':Sequelize[_0xcb54('0x2')]},'description':{'type':Sequelize[_0xcb54('0x2')]},'username':{'type':Sequelize[_0xcb54('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcb54('0x3')},'serverUrl':{'type':Sequelize[_0xcb54('0x2')]}}; \ No newline at end of file +var _0xe132=['exports','STRING','username','remoteUri'];(function(_0x5377ad,_0x56abc0){var _0x295812=function(_0x136910){while(--_0x136910){_0x5377ad['push'](_0x5377ad['shift']());}};_0x295812(++_0x56abc0);}(_0xe132,0xbc));var _0x2e13=function(_0x458898,_0x1ecb02){_0x458898=_0x458898-0x0;var _0x41c38a=_0xe132[_0x458898];return _0x41c38a;};'use strict';var Sequelize=require('sequelize');module[_0x2e13('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e13('0x1')]},'username':{'type':Sequelize[_0x2e13('0x1')],'unique':_0x2e13('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2e13('0x3')},'serverUrl':{'type':Sequelize[_0x2e13('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index b4fab9e..097a046 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 _0xf29d=['send','index','SugarcrmAccount','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','show','params','rawAttributes','length','create','body','find','getConfigurations','findOne','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','duration_hours','parent_id','parent_name','direction','password','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','Password\x20Expired','Calls','values','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name'];(function(_0x25676a,_0x41355f){var _0x1e4786=function(_0x17ab71){while(--_0x17ab71){_0x25676a['push'](_0x25676a['shift']());}};_0x1e4786(++_0x41355f);}(_0xf29d,0xc4));var _0xdf29=function(_0x3dec74,_0x2bfb09){_0x3dec74=_0x3dec74-0x0;var _0x43d2ec=_0xf29d[_0x3dec74];return _0x43d2ec;};'use strict';var pdf=require(_0xdf29('0x0'));var emlformat=require(_0xdf29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf29('0x2'));var jsonpatch=require(_0xdf29('0x3'));var rp=require(_0xdf29('0x4'));var moment=require(_0xdf29('0x5'));var BPromise=require(_0xdf29('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdf29('0x7'));var csv=require(_0xdf29('0x8'));var ejs=require(_0xdf29('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf29('0xa'));var crypto=require(_0xdf29('0xb'));var jsforce=require(_0xdf29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf29('0x8'));var querystring=require(_0xdf29('0xd'));var Papa=require(_0xdf29('0xe'));var Redis=require(_0xdf29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xdf29('0x10'));var logger=require(_0xdf29('0x11'))('api');var utils=require(_0xdf29('0x12'));var config=require(_0xdf29('0x13'));var db=require(_0xdf29('0x14'))['db'];var integrations=require(_0xdf29('0x15'));var jayson=require(_0xdf29('0x16'));var client=jayson['client'][_0xdf29('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4f0875,_0x756e52,_0x196db8){if(_0x196db8){var _0x11bf94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11bf94['test'](_0x756e52)){return _0x4f0875;}else{throw new Error(_0xdf29('0x18'));}}else{return _0x4f0875;}}function respondWithRpcPromise(_0xacbef1,_0x5478df,_0xcf93bd,_0x950f44){return new BPromise(function(_0x14ddaa,_0x598f2a){var _0x45ea43=_0x950f44||client;return _0x45ea43['request'](_0xacbef1,_0xcf93bd)['then'](function(_0x1c993b){logger[_0xdf29('0x19')]('SugarcrmAccount,\x20%s,\x20%s',_0x5478df,'request\x20sent');logger[_0xdf29('0x1a')](_0xdf29('0x1b'),_0x5478df,'request\x20sent',JSON[_0xdf29('0x1c')](_0x1c993b));if(_0x1c993b[_0xdf29('0x1d')]){if(_0x1c993b[_0xdf29('0x1d')][_0xdf29('0x1e')]===0x1f4){logger[_0xdf29('0x1d')](_0xdf29('0x1f'),_0x5478df,_0x1c993b[_0xdf29('0x1d')][_0xdf29('0x20')]);return _0x598f2a(_0x1c993b[_0xdf29('0x1d')][_0xdf29('0x20')]);}logger[_0xdf29('0x1d')](_0xdf29('0x1f'),_0x5478df,_0x1c993b[_0xdf29('0x1d')][_0xdf29('0x20')]);return _0x14ddaa(_0x1c993b[_0xdf29('0x1d')][_0xdf29('0x20')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5478df,_0xdf29('0x21'));_0x14ddaa(_0x1c993b[_0xdf29('0x22')][_0xdf29('0x20')]);}})[_0xdf29('0x23')](function(_0x1e311b){logger['error'](_0xdf29('0x1f'),_0x5478df,_0x1e311b);_0x598f2a(_0x1e311b);});});}function respondWithStatusCode(_0x20907f,_0x3c93e2){_0x3c93e2=_0x3c93e2||0xcc;return function(_0x41f6c5){if(_0x41f6c5){return _0x20907f['sendStatus'](_0x3c93e2);}return _0x20907f[_0xdf29('0x24')](_0x3c93e2)['end']();};}function respondWithResult(_0x493d01,_0x4d743b){_0x4d743b=_0x4d743b||0xc8;return function(_0x484989){if(_0x484989){return _0x493d01['status'](_0x4d743b)[_0xdf29('0x25')](_0x484989);}};}function respondWithFilteredResult(_0x5ae2de,_0xc7c1e6){return function(_0x4da675){if(_0x4da675){var _0x50c533=_0x4da675[_0xdf29('0x26')],_0x54d96d=_0xc7c1e6[_0xdf29('0x27')],_0x3f5a96=_0xc7c1e6[_0xdf29('0x27')]+_0xc7c1e6[_0xdf29('0x28')],_0x3cdca4;if(_0x3f5a96>=_0x50c533){_0x3f5a96=_0x50c533;_0x3cdca4=0xc8;}else{_0x3cdca4=0xce;}_0x5ae2de['status'](_0x3cdca4);return _0x5ae2de['set'](_0xdf29('0x29'),_0x54d96d+'-'+_0x3f5a96+'/'+_0x50c533)[_0xdf29('0x25')](_0x4da675);}return null;};}function patchUpdates(_0x301bc5){return function(_0x240777){try{jsonpatch[_0xdf29('0x2a')](_0x240777,_0x301bc5,!![]);}catch(_0x304b61){return BPromise[_0xdf29('0x2b')](_0x304b61);}return _0x240777[_0xdf29('0x2c')]();};}function saveUpdates(_0x3780d2,_0xec3f3d){return function(_0x1bb3ce){if(_0x1bb3ce){return _0x1bb3ce[_0xdf29('0x2d')](_0x3780d2)[_0xdf29('0x2e')](function(_0x1a4c24){return _0x1a4c24;});}return null;};}function removeEntity(_0x20ba6b,_0x481941){return function(_0x2d65f9){if(_0x2d65f9){return _0x2d65f9[_0xdf29('0x2f')]()['then'](function(){_0x20ba6b[_0xdf29('0x24')](0xcc)[_0xdf29('0x30')]();});}};}function handleEntityNotFound(_0x3ab315,_0x55eb27){return function(_0xe3127){if(!_0xe3127){_0x3ab315[_0xdf29('0x31')](0x194);}return _0xe3127;};}function handleError(_0x10d72f,_0x27f330){_0x27f330=_0x27f330||0x1f4;return function(_0x5b77db){logger[_0xdf29('0x1d')](_0x5b77db[_0xdf29('0x32')]);if(_0x5b77db['name']){delete _0x5b77db[_0xdf29('0x33')];}_0x10d72f['status'](_0x27f330)[_0xdf29('0x34')](_0x5b77db);};}exports[_0xdf29('0x35')]=function(_0x33af6a,_0xb51e91){var _0x174c9e={},_0x44419a={},_0x47126b={'count':0x0,'rows':[]};var _0x331d66=db[_0xdf29('0x36')]['rawAttributes'];_0x44419a[_0xdf29('0x37')]=_[_0xdf29('0x38')](_0x331d66);_0x44419a[_0xdf29('0x39')]=_[_0xdf29('0x38')](_0x33af6a[_0xdf29('0x39')]);_0x44419a[_0xdf29('0x3a')]=_[_0xdf29('0x3b')](_0x44419a[_0xdf29('0x37')],_0x44419a['query']);_0x174c9e['attributes']=_[_0xdf29('0x3b')](_0x44419a['model'],qs[_0xdf29('0x3c')](_0x33af6a[_0xdf29('0x39')][_0xdf29('0x3c')]));_0x174c9e[_0xdf29('0x3d')]=_0x174c9e[_0xdf29('0x3d')]['length']?_0x174c9e[_0xdf29('0x3d')]:_0x44419a[_0xdf29('0x37')];if(!_0x33af6a['query'][_0xdf29('0x3e')](_0xdf29('0x3f'))){_0x174c9e[_0xdf29('0x28')]=qs['limit'](_0x33af6a[_0xdf29('0x39')][_0xdf29('0x28')]);_0x174c9e[_0xdf29('0x27')]=qs['offset'](_0x33af6a[_0xdf29('0x39')]['offset']);}_0x174c9e['order']=qs[_0xdf29('0x40')](_0x33af6a[_0xdf29('0x39')][_0xdf29('0x40')]);_0x174c9e[_0xdf29('0x41')]=qs['filters'](_[_0xdf29('0x42')](_0x33af6a[_0xdf29('0x39')],_0x44419a[_0xdf29('0x3a')]));if(_0x33af6a[_0xdf29('0x39')][_0xdf29('0x43')]){_0x174c9e['where']=_[_0xdf29('0x44')](_0x174c9e[_0xdf29('0x41')],{'$or':_[_0xdf29('0x45')](_0x331d66,function(_0x51d602){if(_0x51d602[_0xdf29('0x46')][_0xdf29('0x47')]!=='VIRTUAL'){var _0x2eaaa1={};_0x2eaaa1[_0x51d602[_0xdf29('0x48')]]={'$like':'%'+_0x33af6a[_0xdf29('0x39')][_0xdf29('0x43')]+'%'};return _0x2eaaa1;}})});}_0x174c9e=_['merge']({},_0x174c9e,_0x33af6a[_0xdf29('0x49')]);var _0x5d6961={'where':_0x174c9e[_0xdf29('0x41')]};return db[_0xdf29('0x36')][_0xdf29('0x26')](_0x5d6961)[_0xdf29('0x2e')](function(_0xb1f6ae){_0x47126b[_0xdf29('0x26')]=_0xb1f6ae;if(_0x33af6a[_0xdf29('0x39')][_0xdf29('0x4a')]){_0x174c9e[_0xdf29('0x4b')]=[{'all':!![]}];}return db[_0xdf29('0x36')][_0xdf29('0x4c')](_0x174c9e);})[_0xdf29('0x2e')](function(_0x30c4b4){_0x47126b['rows']=_0x30c4b4;return _0x47126b;})['then'](respondWithFilteredResult(_0xb51e91,_0x174c9e))[_0xdf29('0x23')](handleError(_0xb51e91,null));};exports[_0xdf29('0x4d')]=function(_0x52d3a8,_0x4f5605){var _0x3bdfd6={'raw':![],'where':{'id':_0x52d3a8[_0xdf29('0x4e')]['id']}},_0x491ea4={};_0x491ea4[_0xdf29('0x37')]=_[_0xdf29('0x38')](db['SugarcrmAccount'][_0xdf29('0x4f')]);_0x491ea4[_0xdf29('0x39')]=_[_0xdf29('0x38')](_0x52d3a8[_0xdf29('0x39')]);_0x491ea4[_0xdf29('0x3a')]=_[_0xdf29('0x3b')](_0x491ea4['model'],_0x491ea4[_0xdf29('0x39')]);_0x3bdfd6[_0xdf29('0x3d')]=_[_0xdf29('0x3b')](_0x491ea4[_0xdf29('0x37')],qs[_0xdf29('0x3c')](_0x52d3a8['query'][_0xdf29('0x3c')]));_0x3bdfd6[_0xdf29('0x3d')]=_0x3bdfd6['attributes'][_0xdf29('0x50')]?_0x3bdfd6[_0xdf29('0x3d')]:_0x491ea4['model'];if(_0x52d3a8['query']['includeAll']){_0x3bdfd6[_0xdf29('0x4b')]=[{'all':!![]}];}_0x3bdfd6=_[_0xdf29('0x44')]({},_0x3bdfd6,_0x52d3a8['options']);return db[_0xdf29('0x36')]['find'](_0x3bdfd6)['then'](handleEntityNotFound(_0x4f5605,null))['then'](respondWithResult(_0x4f5605,null))[_0xdf29('0x23')](handleError(_0x4f5605,null));};exports['create']=function(_0x47f695,_0x339a06){return db[_0xdf29('0x36')][_0xdf29('0x51')](_0x47f695[_0xdf29('0x52')],{})[_0xdf29('0x2e')](respondWithResult(_0x339a06,0xc9))[_0xdf29('0x23')](handleError(_0x339a06,null));};exports[_0xdf29('0x2d')]=function(_0x3fade5,_0x19ec82){if(_0x3fade5['body']['id']){delete _0x3fade5['body']['id'];}return db[_0xdf29('0x36')][_0xdf29('0x53')]({'where':{'id':_0x3fade5[_0xdf29('0x4e')]['id']}})[_0xdf29('0x2e')](handleEntityNotFound(_0x19ec82,null))[_0xdf29('0x2e')](saveUpdates(_0x3fade5[_0xdf29('0x52')],null))['then'](respondWithResult(_0x19ec82,null))[_0xdf29('0x23')](handleError(_0x19ec82,null));};exports[_0xdf29('0x2f')]=function(_0x1a163e,_0x208ec2){return db[_0xdf29('0x36')][_0xdf29('0x53')]({'where':{'id':_0x1a163e[_0xdf29('0x4e')]['id']}})[_0xdf29('0x2e')](handleEntityNotFound(_0x208ec2,null))[_0xdf29('0x2e')](removeEntity(_0x208ec2,null))[_0xdf29('0x23')](handleError(_0x208ec2,null));};exports[_0xdf29('0x54')]=function(_0x1d58da,_0x2e71ca,_0x208795){var _0x3d5cb8={};var _0x40d420={};var _0x1a2050;var _0x382e1d;return db[_0xdf29('0x36')][_0xdf29('0x55')]({'where':{'id':_0x1d58da['params']['id']}})['then'](handleEntityNotFound(_0x2e71ca,null))[_0xdf29('0x2e')](function(_0x29251f){if(_0x29251f){_0x1a2050=_0x29251f;_0x40d420[_0xdf29('0x37')]=_[_0xdf29('0x38')](db['SugarcrmConfiguration'][_0xdf29('0x4f')]);_0x40d420[_0xdf29('0x39')]=_[_0xdf29('0x38')](_0x1d58da[_0xdf29('0x39')]);_0x40d420[_0xdf29('0x3a')]=_[_0xdf29('0x3b')](_0x40d420[_0xdf29('0x37')],_0x40d420[_0xdf29('0x39')]);_0x3d5cb8[_0xdf29('0x3d')]=_[_0xdf29('0x3b')](_0x40d420[_0xdf29('0x37')],qs['fields'](_0x1d58da['query']['fields']));_0x3d5cb8[_0xdf29('0x3d')]=_0x3d5cb8[_0xdf29('0x3d')][_0xdf29('0x50')]?_0x3d5cb8[_0xdf29('0x3d')]:_0x40d420['model'];_0x3d5cb8[_0xdf29('0x56')]=qs['sort'](_0x1d58da['query']['sort']);_0x3d5cb8['where']=qs[_0xdf29('0x3a')](_[_0xdf29('0x42')](_0x1d58da[_0xdf29('0x39')],_0x40d420[_0xdf29('0x3a')]));if(_0x1d58da[_0xdf29('0x39')][_0xdf29('0x43')]){_0x3d5cb8[_0xdf29('0x41')]=_[_0xdf29('0x44')](_0x3d5cb8[_0xdf29('0x41')],{'$or':_[_0xdf29('0x45')](_0x3d5cb8['attributes'],function(_0x3d6f48){var _0x401181={};_0x401181[_0x3d6f48]={'$like':'%'+_0x1d58da[_0xdf29('0x39')][_0xdf29('0x43')]+'%'};return _0x401181;})});}_0x3d5cb8=_[_0xdf29('0x44')]({},_0x3d5cb8,_0x1d58da[_0xdf29('0x49')]);return _0x1a2050[_0xdf29('0x54')](_0x3d5cb8);}})[_0xdf29('0x2e')](function(_0x3d90e6){if(_0x3d90e6){_0x382e1d=_0x3d90e6['length'];if(!_0x1d58da['query'][_0xdf29('0x3e')](_0xdf29('0x3f'))){_0x3d5cb8[_0xdf29('0x28')]=qs['limit'](_0x1d58da['query'][_0xdf29('0x28')]);_0x3d5cb8['offset']=qs['offset'](_0x1d58da[_0xdf29('0x39')]['offset']);}return _0x1a2050['getConfigurations'](_0x3d5cb8);}})[_0xdf29('0x2e')](function(_0xaba721){if(_0xaba721){return _0xaba721?{'count':_0x382e1d,'rows':_0xaba721}:null;}})[_0xdf29('0x2e')](respondWithResult(_0x2e71ca,null))[_0xdf29('0x23')](handleError(_0x2e71ca,null));};exports[_0xdf29('0x57')]=function(_0x2213f6,_0x3ede51,_0x3c825a){if(_0x2213f6['body']['id']){delete _0x2213f6[_0xdf29('0x52')]['id'];}return db[_0xdf29('0x36')][_0xdf29('0x55')]({'where':{'id':_0x2213f6[_0xdf29('0x4e')]['id']}})[_0xdf29('0x2e')](handleEntityNotFound(_0x3ede51,null))[_0xdf29('0x2e')](function(_0x16a4da){if(_0x16a4da){_0x2213f6[_0xdf29('0x52')][_0xdf29('0x58')]=_0x16a4da['id'];_0x2213f6['body']['Subjects']=integrations[_0xdf29('0x59')](_0x2213f6[_0xdf29('0x52')][_0xdf29('0x5a')],_0x2213f6[_0xdf29('0x52')][_0xdf29('0x46')]);_0x2213f6['body'][_0xdf29('0x5b')]=integrations[_0xdf29('0x5c')](_0x2213f6['body'][_0xdf29('0x5a')],_0x2213f6[_0xdf29('0x52')][_0xdf29('0x46')]);return db['SugarcrmConfiguration'][_0xdf29('0x51')](_0x2213f6[_0xdf29('0x52')],{'include':[{'model':db[_0xdf29('0x5d')],'as':_0xdf29('0x5e')},{'model':db[_0xdf29('0x5d')],'as':_0xdf29('0x5b')}]});}return null;})['then'](respondWithResult(_0x3ede51,null))['catch'](handleError(_0x3ede51,null));};exports[_0xdf29('0x5f')]=function(_0x588dc4,_0x3f7018,_0xecc8b7){var _0x81e389='';var _0x514830=['id',_0xdf29('0x33'),_0xdf29('0x60'),'created_by',_0xdf29('0x61'),'date_start',_0xdf29('0x62'),'duration_minutes',_0xdf29('0x63'),'parent_type',_0xdf29('0x64'),_0xdf29('0x65')];return db[_0xdf29('0x36')][_0xdf29('0x55')]({'where':{'id':_0x588dc4['params']['id']},'attributes':['id','username',_0xdf29('0x66'),_0xdf29('0x67')]})['then'](handleEntityNotFound(_0x3f7018,null))[_0xdf29('0x2e')](function(_0x44d239){if(_0x44d239){_0x81e389=_0x44d239[_0xdf29('0x67')];var _0x3a5ea9=_0x81e389['slice'](-0x1);if(_0x3a5ea9==='/'){_0x81e389=_0x81e389[_0xdf29('0x68')](0x0,_0x81e389[_0xdf29('0x69')](_0x3a5ea9));}return rp({'method':_0xdf29('0x6a'),'uri':util['format'](_0xdf29('0x6b'),_0x81e389,_0xdf29('0x6c')),'json':!![],'form':{'method':_0xdf29('0x6d'),'input_type':'JSON','response_type':_0xdf29('0x6e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x44d239[_0xdf29('0x6f')],'password':_0x44d239[_0xdf29('0x66')],'encryption':_0xdf29('0x70')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x1f08f2){if(_0x1f08f2&&_0x1f08f2[_0xdf29('0x33')]!=='Invalid\x20Login'&&_0x1f08f2['name']!==_0xdf29('0x71')){return rp({'method':_0xdf29('0x6a'),'uri':util['format'](_0xdf29('0x6b'),_0x81e389,_0xdf29('0x6c')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xdf29('0x6e'),'response_type':'JSON','rest_data':JSON[_0xdf29('0x1c')]({'session':_0x1f08f2['id'],'module_name':_0xdf29('0x72')})}})[_0xdf29('0x2e')](function(_0x17edf8){if(_0x17edf8){var _0x320785=_[_0xdf29('0x73')](_0x17edf8['module_fields']);_['remove'](_0x320785,function(_0x314e6d){return _0x514830[_0xdf29('0x74')](_0x314e6d[_0xdf29('0x33')]);});return{'count':_0x320785['length'],'rows':_['map'](_0x320785,function(_0x238ebe){return{'id':_0x238ebe[_0xdf29('0x33')],'name':_0x238ebe[_0xdf29('0x75')],'custom':_[_0xdf29('0x76')](_0x238ebe[_0xdf29('0x33')],'_c')?!![]:![],'options':_0x238ebe[_0xdf29('0x49')]?_[_0xdf29('0x45')](_['values'](_0x238ebe['options']),function(_0x5b938a){return{'name':_0x5b938a[_0xdf29('0x77')],'value':_0x5b938a[_0xdf29('0x33')]};}):[]};})};}})[_0xdf29('0x2e')](respondWithResult(_0x3f7018,null))['catch'](function(_0xb31905){var _0x55449d=_0x588dc4[_0xdf29('0x39')][_0xdf29('0x78')]?0x1f4:_0xb31905[_0xdf29('0x79')]||0x1f4;logger[_0xdf29('0x1d')](_0xdf29('0x7a'),_0xdf29('0x5f'),_0x55449d,JSON[_0xdf29('0x1c')](_0xb31905));delete _0xb31905[_0xdf29('0x33')];if(_0x55449d===0x191){_0x55449d=0x190;}_0x3f7018[_0xdf29('0x24')](_0x55449d)[_0xdf29('0x34')](_0x588dc4['query'][_0xdf29('0x78')]?{'message':_0xdf29('0x7b'),'statusCode':_0xb31905[_0xdf29('0x79')]}:_0xb31905);});}else{var _0x1c65e6=0x1f4;_0x3f7018[_0xdf29('0x24')](_0x1c65e6)[_0xdf29('0x34')]({'message':_0xdf29('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x7da6=['getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','type','Descriptions','SugarcrmField','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_type','direction','username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','remove','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','key','VIRTUAL','merge','count','includeAll','include','findAll','show','params','length','options','find','create','body'];(function(_0x226aea,_0x78e3ed){var _0x229e93=function(_0x2166a9){while(--_0x2166a9){_0x226aea['push'](_0x226aea['shift']());}};_0x229e93(++_0x78e3ed);}(_0x7da6,0x124));var _0x67da=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0x7da6[_0x48326a];return _0x466709;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x67da('0x0'));var zipdir=require(_0x67da('0x1'));var jsonpatch=require(_0x67da('0x2'));var rp=require(_0x67da('0x3'));var moment=require('moment');var BPromise=require(_0x67da('0x4'));var Mustache=require(_0x67da('0x5'));var util=require(_0x67da('0x6'));var path=require(_0x67da('0x7'));var sox=require(_0x67da('0x8'));var csv=require(_0x67da('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x67da('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x67da('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x67da('0x9'));var querystring=require('querystring');var Papa=require(_0x67da('0xc'));var Redis=require(_0x67da('0xd'));var authService=require(_0x67da('0xe'));var qs=require(_0x67da('0xf'));var hardwareService=require(_0x67da('0x10'));var logger=require(_0x67da('0x11'))(_0x67da('0x12'));var utils=require('../../config/utils');var config=require(_0x67da('0x13'));var db=require(_0x67da('0x14'))['db'];var integrations=require(_0x67da('0x15'));var jayson=require(_0x67da('0x16'));var client=jayson[_0x67da('0x17')][_0x67da('0x18')]({'port':0x232a});function checkPasswordPattern(_0x483e7f,_0x745b5d,_0x9beca6){if(_0x9beca6){var _0x3929fb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3929fb[_0x67da('0x19')](_0x745b5d)){return _0x483e7f;}else{throw new Error(_0x67da('0x1a'));}}else{return _0x483e7f;}}function respondWithRpcPromise(_0x508b4a,_0x11c7b5,_0x33c466,_0x5e0802){return new BPromise(function(_0x11e151,_0x3b7f96){var _0x16760f=_0x5e0802||client;return _0x16760f[_0x67da('0x1b')](_0x508b4a,_0x33c466)[_0x67da('0x1c')](function(_0xb3a67){logger[_0x67da('0x1d')](_0x67da('0x1e'),_0x11c7b5,'request\x20sent');logger[_0x67da('0x1f')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x11c7b5,_0x67da('0x20'),JSON['stringify'](_0xb3a67));if(_0xb3a67[_0x67da('0x21')]){if(_0xb3a67[_0x67da('0x21')][_0x67da('0x22')]===0x1f4){logger[_0x67da('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x11c7b5,_0xb3a67[_0x67da('0x21')]['message']);return _0x3b7f96(_0xb3a67['error'][_0x67da('0x23')]);}logger[_0x67da('0x21')](_0x67da('0x1e'),_0x11c7b5,_0xb3a67[_0x67da('0x21')]['message']);return _0x11e151(_0xb3a67['error']['message']);}else{logger[_0x67da('0x1d')](_0x67da('0x1e'),_0x11c7b5,_0x67da('0x20'));_0x11e151(_0xb3a67[_0x67da('0x24')][_0x67da('0x23')]);}})[_0x67da('0x25')](function(_0x5f1a47){logger[_0x67da('0x21')](_0x67da('0x1e'),_0x11c7b5,_0x5f1a47);_0x3b7f96(_0x5f1a47);});});}function respondWithStatusCode(_0x535b83,_0x35bac5){_0x35bac5=_0x35bac5||0xcc;return function(_0x599a9d){if(_0x599a9d){return _0x535b83[_0x67da('0x26')](_0x35bac5);}return _0x535b83[_0x67da('0x27')](_0x35bac5)[_0x67da('0x28')]();};}function respondWithResult(_0x17e76f,_0x33a74d){_0x33a74d=_0x33a74d||0xc8;return function(_0x35b1bc){if(_0x35b1bc){return _0x17e76f['status'](_0x33a74d)[_0x67da('0x29')](_0x35b1bc);}};}function respondWithFilteredResult(_0x168a49,_0x5875d9){return function(_0x5afdc4){if(_0x5afdc4){var _0x37f276=_0x5afdc4['count'],_0x4753ea=_0x5875d9[_0x67da('0x2a')],_0x16a7f0=_0x5875d9[_0x67da('0x2a')]+_0x5875d9[_0x67da('0x2b')],_0x42c511;if(_0x16a7f0>=_0x37f276){_0x16a7f0=_0x37f276;_0x42c511=0xc8;}else{_0x42c511=0xce;}_0x168a49[_0x67da('0x27')](_0x42c511);return _0x168a49[_0x67da('0x2c')](_0x67da('0x2d'),_0x4753ea+'-'+_0x16a7f0+'/'+_0x37f276)[_0x67da('0x29')](_0x5afdc4);}return null;};}function patchUpdates(_0x1e2bd0){return function(_0x36d143){try{jsonpatch[_0x67da('0x2e')](_0x36d143,_0x1e2bd0,!![]);}catch(_0x18dd99){return BPromise[_0x67da('0x2f')](_0x18dd99);}return _0x36d143[_0x67da('0x30')]();};}function saveUpdates(_0x38a502,_0x48e08a){return function(_0x229b6b){if(_0x229b6b){return _0x229b6b[_0x67da('0x31')](_0x38a502)[_0x67da('0x1c')](function(_0x18aaed){return _0x18aaed;});}return null;};}function removeEntity(_0x64a68e,_0x2fa5bb){return function(_0x594a18){if(_0x594a18){return _0x594a18[_0x67da('0x32')]()[_0x67da('0x1c')](function(){_0x64a68e[_0x67da('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a21e6,_0x5c9ab8){return function(_0x4cfcab){if(!_0x4cfcab){_0x5a21e6[_0x67da('0x26')](0x194);}return _0x4cfcab;};}function handleError(_0x4b796b,_0x2cb5eb){_0x2cb5eb=_0x2cb5eb||0x1f4;return function(_0x3fb284){logger[_0x67da('0x21')](_0x3fb284[_0x67da('0x33')]);if(_0x3fb284[_0x67da('0x34')]){delete _0x3fb284[_0x67da('0x34')];}_0x4b796b[_0x67da('0x27')](_0x2cb5eb)[_0x67da('0x35')](_0x3fb284);};}exports[_0x67da('0x36')]=function(_0x11ec02,_0x207e63){var _0x13796d={},_0x2720e5={},_0x1348bb={'count':0x0,'rows':[]};var _0x3e48bf=db[_0x67da('0x37')][_0x67da('0x38')];_0x2720e5[_0x67da('0x39')]=_[_0x67da('0x3a')](_0x3e48bf);_0x2720e5[_0x67da('0x3b')]=_[_0x67da('0x3a')](_0x11ec02[_0x67da('0x3b')]);_0x2720e5[_0x67da('0x3c')]=_[_0x67da('0x3d')](_0x2720e5[_0x67da('0x39')],_0x2720e5[_0x67da('0x3b')]);_0x13796d['attributes']=_[_0x67da('0x3d')](_0x2720e5[_0x67da('0x39')],qs['fields'](_0x11ec02[_0x67da('0x3b')][_0x67da('0x3e')]));_0x13796d['attributes']=_0x13796d['attributes']['length']?_0x13796d[_0x67da('0x3f')]:_0x2720e5[_0x67da('0x39')];if(!_0x11ec02[_0x67da('0x3b')][_0x67da('0x40')](_0x67da('0x41'))){_0x13796d['limit']=qs[_0x67da('0x2b')](_0x11ec02['query'][_0x67da('0x2b')]);_0x13796d[_0x67da('0x2a')]=qs[_0x67da('0x2a')](_0x11ec02[_0x67da('0x3b')]['offset']);}_0x13796d[_0x67da('0x42')]=qs['sort'](_0x11ec02[_0x67da('0x3b')][_0x67da('0x43')]);_0x13796d[_0x67da('0x44')]=qs['filters'](_[_0x67da('0x45')](_0x11ec02[_0x67da('0x3b')],_0x2720e5[_0x67da('0x3c')]));if(_0x11ec02[_0x67da('0x3b')][_0x67da('0x46')]){_0x13796d[_0x67da('0x44')]=_['merge'](_0x13796d['where'],{'$or':_[_0x67da('0x47')](_0x3e48bf,function(_0x31b30e){if(_0x31b30e['type'][_0x67da('0x48')]!==_0x67da('0x49')){var _0x5dbd8f={};_0x5dbd8f[_0x31b30e['field']]={'$like':'%'+_0x11ec02[_0x67da('0x3b')][_0x67da('0x46')]+'%'};return _0x5dbd8f;}})});}_0x13796d=_[_0x67da('0x4a')]({},_0x13796d,_0x11ec02['options']);var _0x1fb7f6={'where':_0x13796d['where']};return db[_0x67da('0x37')][_0x67da('0x4b')](_0x1fb7f6)[_0x67da('0x1c')](function(_0x594f38){_0x1348bb[_0x67da('0x4b')]=_0x594f38;if(_0x11ec02['query'][_0x67da('0x4c')]){_0x13796d[_0x67da('0x4d')]=[{'all':!![]}];}return db[_0x67da('0x37')][_0x67da('0x4e')](_0x13796d);})['then'](function(_0x43c5b5){_0x1348bb['rows']=_0x43c5b5;return _0x1348bb;})[_0x67da('0x1c')](respondWithFilteredResult(_0x207e63,_0x13796d))[_0x67da('0x25')](handleError(_0x207e63,null));};exports[_0x67da('0x4f')]=function(_0x40b69c,_0x446fb3){var _0x40420b={'raw':![],'where':{'id':_0x40b69c[_0x67da('0x50')]['id']}},_0x5d9ebc={};_0x5d9ebc[_0x67da('0x39')]=_['keys'](db[_0x67da('0x37')][_0x67da('0x38')]);_0x5d9ebc[_0x67da('0x3b')]=_[_0x67da('0x3a')](_0x40b69c[_0x67da('0x3b')]);_0x5d9ebc['filters']=_[_0x67da('0x3d')](_0x5d9ebc[_0x67da('0x39')],_0x5d9ebc[_0x67da('0x3b')]);_0x40420b[_0x67da('0x3f')]=_[_0x67da('0x3d')](_0x5d9ebc[_0x67da('0x39')],qs[_0x67da('0x3e')](_0x40b69c[_0x67da('0x3b')]['fields']));_0x40420b[_0x67da('0x3f')]=_0x40420b[_0x67da('0x3f')][_0x67da('0x51')]?_0x40420b['attributes']:_0x5d9ebc[_0x67da('0x39')];if(_0x40b69c[_0x67da('0x3b')][_0x67da('0x4c')]){_0x40420b['include']=[{'all':!![]}];}_0x40420b=_[_0x67da('0x4a')]({},_0x40420b,_0x40b69c[_0x67da('0x52')]);return db[_0x67da('0x37')][_0x67da('0x53')](_0x40420b)[_0x67da('0x1c')](handleEntityNotFound(_0x446fb3,null))[_0x67da('0x1c')](respondWithResult(_0x446fb3,null))[_0x67da('0x25')](handleError(_0x446fb3,null));};exports['create']=function(_0xbdde9b,_0x28b71a){return db['SugarcrmAccount'][_0x67da('0x54')](_0xbdde9b['body'],{})[_0x67da('0x1c')](respondWithResult(_0x28b71a,0xc9))[_0x67da('0x25')](handleError(_0x28b71a,null));};exports[_0x67da('0x31')]=function(_0x485399,_0x1b82f9){if(_0x485399[_0x67da('0x55')]['id']){delete _0x485399['body']['id'];}return db['SugarcrmAccount'][_0x67da('0x53')]({'where':{'id':_0x485399[_0x67da('0x50')]['id']}})[_0x67da('0x1c')](handleEntityNotFound(_0x1b82f9,null))['then'](saveUpdates(_0x485399[_0x67da('0x55')],null))['then'](respondWithResult(_0x1b82f9,null))['catch'](handleError(_0x1b82f9,null));};exports['destroy']=function(_0x7210cc,_0x525f1a){return db[_0x67da('0x37')][_0x67da('0x53')]({'where':{'id':_0x7210cc['params']['id']}})[_0x67da('0x1c')](handleEntityNotFound(_0x525f1a,null))[_0x67da('0x1c')](removeEntity(_0x525f1a,null))[_0x67da('0x25')](handleError(_0x525f1a,null));};exports[_0x67da('0x56')]=function(_0x54713b,_0x1c478f,_0x1160b1){var _0x4ac3df={};var _0x27cebd={};var _0x45f320;var _0x142518;return db[_0x67da('0x37')][_0x67da('0x57')]({'where':{'id':_0x54713b[_0x67da('0x50')]['id']}})[_0x67da('0x1c')](handleEntityNotFound(_0x1c478f,null))['then'](function(_0x2ae5ba){if(_0x2ae5ba){_0x45f320=_0x2ae5ba;_0x27cebd['model']=_[_0x67da('0x3a')](db[_0x67da('0x58')][_0x67da('0x38')]);_0x27cebd['query']=_[_0x67da('0x3a')](_0x54713b[_0x67da('0x3b')]);_0x27cebd[_0x67da('0x3c')]=_[_0x67da('0x3d')](_0x27cebd[_0x67da('0x39')],_0x27cebd[_0x67da('0x3b')]);_0x4ac3df['attributes']=_['intersection'](_0x27cebd['model'],qs[_0x67da('0x3e')](_0x54713b[_0x67da('0x3b')][_0x67da('0x3e')]));_0x4ac3df[_0x67da('0x3f')]=_0x4ac3df['attributes']['length']?_0x4ac3df[_0x67da('0x3f')]:_0x27cebd[_0x67da('0x39')];_0x4ac3df[_0x67da('0x42')]=qs[_0x67da('0x43')](_0x54713b['query'][_0x67da('0x43')]);_0x4ac3df[_0x67da('0x44')]=qs['filters'](_[_0x67da('0x45')](_0x54713b[_0x67da('0x3b')],_0x27cebd[_0x67da('0x3c')]));if(_0x54713b[_0x67da('0x3b')][_0x67da('0x46')]){_0x4ac3df[_0x67da('0x44')]=_['merge'](_0x4ac3df[_0x67da('0x44')],{'$or':_[_0x67da('0x47')](_0x4ac3df[_0x67da('0x3f')],function(_0x4a9155){var _0x2f265c={};_0x2f265c[_0x4a9155]={'$like':'%'+_0x54713b['query'][_0x67da('0x46')]+'%'};return _0x2f265c;})});}_0x4ac3df=_[_0x67da('0x4a')]({},_0x4ac3df,_0x54713b[_0x67da('0x52')]);return _0x45f320[_0x67da('0x56')](_0x4ac3df);}})['then'](function(_0x2fac12){if(_0x2fac12){_0x142518=_0x2fac12[_0x67da('0x51')];if(!_0x54713b['query']['hasOwnProperty'](_0x67da('0x41'))){_0x4ac3df[_0x67da('0x2b')]=qs[_0x67da('0x2b')](_0x54713b[_0x67da('0x3b')][_0x67da('0x2b')]);_0x4ac3df[_0x67da('0x2a')]=qs[_0x67da('0x2a')](_0x54713b[_0x67da('0x3b')]['offset']);}return _0x45f320[_0x67da('0x56')](_0x4ac3df);}})[_0x67da('0x1c')](function(_0x1c216){if(_0x1c216){return _0x1c216?{'count':_0x142518,'rows':_0x1c216}:null;}})['then'](respondWithResult(_0x1c478f,null))[_0x67da('0x25')](handleError(_0x1c478f,null));};exports[_0x67da('0x59')]=function(_0x21b303,_0xd28cb4,_0x167038){if(_0x21b303[_0x67da('0x55')]['id']){delete _0x21b303[_0x67da('0x55')]['id'];}return db[_0x67da('0x37')][_0x67da('0x57')]({'where':{'id':_0x21b303[_0x67da('0x50')]['id']}})[_0x67da('0x1c')](handleEntityNotFound(_0xd28cb4,null))[_0x67da('0x1c')](function(_0x3e270b){if(_0x3e270b){_0x21b303['body'][_0x67da('0x5a')]=_0x3e270b['id'];_0x21b303[_0x67da('0x55')][_0x67da('0x5b')]=integrations['getSubjects'](_0x21b303[_0x67da('0x55')][_0x67da('0x5c')],_0x21b303[_0x67da('0x55')][_0x67da('0x5d')]);_0x21b303[_0x67da('0x55')][_0x67da('0x5e')]=integrations['getDescriptions'](_0x21b303[_0x67da('0x55')][_0x67da('0x5c')],_0x21b303[_0x67da('0x55')]['type']);return db[_0x67da('0x58')][_0x67da('0x54')](_0x21b303[_0x67da('0x55')],{'include':[{'model':db[_0x67da('0x5f')],'as':_0x67da('0x5b')},{'model':db['SugarcrmField'],'as':_0x67da('0x5e')}]});}return null;})[_0x67da('0x1c')](respondWithResult(_0xd28cb4,null))[_0x67da('0x25')](handleError(_0xd28cb4,null));};exports['getFields']=function(_0x445634,_0x30332e,_0x5154cf){var _0x41f1a2='';var _0xa7877=['id',_0x67da('0x34'),_0x67da('0x60'),'created_by',_0x67da('0x61'),_0x67da('0x62'),_0x67da('0x63'),_0x67da('0x64'),'parent_id',_0x67da('0x65'),'parent_name',_0x67da('0x66')];return db[_0x67da('0x37')][_0x67da('0x57')]({'where':{'id':_0x445634[_0x67da('0x50')]['id']},'attributes':['id',_0x67da('0x67'),_0x67da('0x68'),_0x67da('0x69')]})[_0x67da('0x1c')](handleEntityNotFound(_0x30332e,null))['then'](function(_0x41b2f6){if(_0x41b2f6){_0x41f1a2=_0x41b2f6[_0x67da('0x69')];var _0x59ebe9=_0x41f1a2['slice'](-0x1);if(_0x59ebe9==='/'){_0x41f1a2=_0x41f1a2[_0x67da('0x6a')](0x0,_0x41f1a2['lastIndexOf'](_0x59ebe9));}return rp({'method':_0x67da('0x6b'),'uri':util[_0x67da('0x6c')](_0x67da('0x6d'),_0x41f1a2,_0x67da('0x6e')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x67da('0x6f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x41b2f6[_0x67da('0x67')],'password':_0x41b2f6[_0x67da('0x68')],'encryption':_0x67da('0x70')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x67da('0x1c')](function(_0x1c7df9){if(_0x1c7df9&&_0x1c7df9[_0x67da('0x34')]!==_0x67da('0x71')&&_0x1c7df9['name']!==_0x67da('0x72')){return rp({'method':_0x67da('0x6b'),'uri':util[_0x67da('0x6c')](_0x67da('0x6d'),_0x41f1a2,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x67da('0x73'),'input_type':_0x67da('0x6f'),'response_type':_0x67da('0x6f'),'rest_data':JSON['stringify']({'session':_0x1c7df9['id'],'module_name':'Calls'})}})[_0x67da('0x1c')](function(_0x434565){if(_0x434565){var _0xfaf2c3=_[_0x67da('0x74')](_0x434565[_0x67da('0x75')]);_[_0x67da('0x76')](_0xfaf2c3,function(_0x219ddd){return _0xa7877['includes'](_0x219ddd[_0x67da('0x34')]);});return{'count':_0xfaf2c3[_0x67da('0x51')],'rows':_[_0x67da('0x47')](_0xfaf2c3,function(_0x48e1d2){return{'id':_0x48e1d2[_0x67da('0x34')],'name':_0x48e1d2[_0x67da('0x77')],'custom':_['endsWith'](_0x48e1d2[_0x67da('0x34')],'_c')?!![]:![],'options':_0x48e1d2['options']?_['map'](_[_0x67da('0x74')](_0x48e1d2[_0x67da('0x52')]),function(_0x725dc7){return{'name':_0x725dc7[_0x67da('0x78')],'value':_0x725dc7[_0x67da('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x30332e,null))[_0x67da('0x25')](function(_0x3d702f){var _0x24684a=_0x445634[_0x67da('0x3b')]['test']?0x1f4:_0x3d702f[_0x67da('0x79')]||0x1f4;logger['error'](_0x67da('0x7a'),_0x67da('0x7b'),_0x24684a,JSON[_0x67da('0x7c')](_0x3d702f));delete _0x3d702f[_0x67da('0x34')];if(_0x24684a===0x191){_0x24684a=0x190;}_0x30332e[_0x67da('0x27')](_0x24684a)[_0x67da('0x35')](_0x445634[_0x67da('0x3b')][_0x67da('0x19')]?{'message':_0x67da('0x7d'),'statusCode':_0x3d702f[_0x67da('0x79')]}:_0x3d702f);});}else{var _0x237db6=0x1f4;_0x30332e[_0x67da('0x27')](_0x237db6)[_0x67da('0x35')]({'message':_0x67da('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 7c9d888..58fd938 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 _0x3cca=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','lodash'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x3cca,0x15b));var _0xa3cc=function(_0x274f8f,_0x8c6d2c){_0x274f8f=_0x274f8f-0x0;var _0x47c7d0=_0x3cca[_0x274f8f];return _0x47c7d0;};'use strict';var _=require(_0xa3cc('0x0'));var util=require(_0xa3cc('0x1'));var logger=require(_0xa3cc('0x2'))(_0xa3cc('0x3'));var moment=require(_0xa3cc('0x4'));var BPromise=require(_0xa3cc('0x5'));var rp=require(_0xa3cc('0x6'));var fs=require('fs');var path=require(_0xa3cc('0x7'));var rimraf=require(_0xa3cc('0x8'));var config=require('../../config/environment');var attributes=require(_0xa3cc('0x9'));var integrations=require(_0xa3cc('0xa'));module['exports']=function(_0x414f04,_0x5742ad){return _0x414f04[_0xa3cc('0xb')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66f3=['../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','request-promise','rimraf'];(function(_0x354dd4,_0x2ec598){var _0x3dfaac=function(_0x2f7916){while(--_0x2f7916){_0x354dd4['push'](_0x354dd4['shift']());}};_0x3dfaac(++_0x2ec598);}(_0x66f3,0x12e));var _0x366f=function(_0x4a6a6b,_0x1909e3){_0x4a6a6b=_0x4a6a6b-0x0;var _0x3335a6=_0x66f3[_0x4a6a6b];return _0x3335a6;};'use strict';var _=require(_0x366f('0x0'));var util=require('util');var logger=require(_0x366f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x366f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x366f('0x3'));var config=require(_0x366f('0x4'));var attributes=require(_0x366f('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x366f('0x6')]=function(_0x140246,_0x4e312c){return _0x140246['define'](_0x366f('0x7'),attributes,{'tableName':_0x366f('0x8'),'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 a7ee78a..a5903be 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 _0xf538=['debug','find','ShowSugarcrmAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','then'];(function(_0x475278,_0x38c7a9){var _0x26da4e=function(_0x263a41){while(--_0x263a41){_0x475278['push'](_0x475278['shift']());}};_0x26da4e(++_0x38c7a9);}(_0xf538,0x13e));var _0x8f53=function(_0x186095,_0x597ba6){_0x186095=_0x186095-0x0;var _0x4ca775=_0xf538[_0x186095];return _0x4ca775;};'use strict';var _=require(_0x8f53('0x0'));var util=require('util');var moment=require(_0x8f53('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f53('0x2'));var fs=require('fs');var Redis=require(_0x8f53('0x3'));var db=require(_0x8f53('0x4'))['db'];var utils=require(_0x8f53('0x5'));var logger=require('../../config/logger')(_0x8f53('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f53('0x7'));var client=jayson[_0x8f53('0x8')][_0x8f53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b4c56,_0x1e4178,_0x509254){return new BPromise(function(_0x3f1b1b,_0x346925){return client[_0x8f53('0xa')](_0x3b4c56,_0x509254)['then'](function(_0x317054){logger[_0x8f53('0xb')](_0x8f53('0xc'),_0x1e4178,_0x8f53('0xd'));logger['debug'](_0x8f53('0xe'),_0x1e4178,_0x8f53('0xd'),JSON[_0x8f53('0xf')](_0x317054));if(_0x317054[_0x8f53('0x10')]){if(_0x317054[_0x8f53('0x10')]['code']===0x1f4){logger['error'](_0x8f53('0xc'),_0x1e4178,_0x317054[_0x8f53('0x10')][_0x8f53('0x11')]);return _0x346925(_0x317054['error'][_0x8f53('0x11')]);}logger[_0x8f53('0x10')](_0x8f53('0xc'),_0x1e4178,_0x317054[_0x8f53('0x10')]['message']);return _0x3f1b1b(_0x317054[_0x8f53('0x10')][_0x8f53('0x11')]);}else{logger[_0x8f53('0xb')](_0x8f53('0xc'),_0x1e4178,_0x8f53('0xd'));_0x3f1b1b(_0x317054[_0x8f53('0x12')][_0x8f53('0x11')]);}})[_0x8f53('0x13')](function(_0x4259db){logger[_0x8f53('0x10')](_0x8f53('0xc'),_0x1e4178,_0x4259db);_0x346925(_0x4259db);});});}exports[_0x8f53('0x14')]=function(_0x3a7f3c){var _0x2478f9=this;return new Promise(function(_0x1fd657,_0x177cc9){return db[_0x8f53('0x15')][_0x8f53('0x16')]({'raw':_0x3a7f3c['options']?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x18')]===undefined?!![]:![]:!![],'where':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x19')]||null:null,'attributes':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1a')]||null:null,'limit':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1b')]||null:null,'include':_0x3a7f3c[_0x8f53('0x17')]?_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1c')]?_['map'](_0x3a7f3c[_0x8f53('0x17')][_0x8f53('0x1c')],function(_0x1dbe78){return{'model':db[_0x1dbe78[_0x8f53('0x1d')]],'as':_0x1dbe78['as'],'attributes':_0x1dbe78[_0x8f53('0x1a')],'include':_0x1dbe78[_0x8f53('0x1c')]?_[_0x8f53('0x1e')](_0x1dbe78[_0x8f53('0x1c')],function(_0x2473f3){return{'model':db[_0x2473f3[_0x8f53('0x1d')]],'as':_0x2473f3['as'],'attributes':_0x2473f3[_0x8f53('0x1a')],'include':_0x2473f3[_0x8f53('0x1c')]?_['map'](_0x2473f3[_0x8f53('0x1c')],function(_0x5ee006){return{'model':db[_0x5ee006[_0x8f53('0x1d')]],'as':_0x5ee006['as'],'attributes':_0x5ee006[_0x8f53('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8f53('0x1f')](function(_0x29b469){logger[_0x8f53('0xb')]('GetSugarcrmAccount',_0x3a7f3c);logger[_0x8f53('0x20')](_0x8f53('0x14'),_0x3a7f3c,JSON[_0x8f53('0xf')](_0x29b469));_0x1fd657(_0x29b469);})[_0x8f53('0x13')](function(_0x46f631){logger[_0x8f53('0x10')](_0x8f53('0x14'),_0x46f631[_0x8f53('0x11')],_0x3a7f3c);_0x177cc9(_0x2478f9[_0x8f53('0x10')](0x1f4,_0x46f631[_0x8f53('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x48d685){var _0x7ad5b7=this;return new Promise(function(_0x2a59e9,_0x542722){return db[_0x8f53('0x15')][_0x8f53('0x21')]({'raw':_0x48d685[_0x8f53('0x17')]?_0x48d685['options'][_0x8f53('0x18')]===undefined?!![]:![]:!![],'where':_0x48d685['options']?_0x48d685[_0x8f53('0x17')][_0x8f53('0x19')]||null:null,'attributes':_0x48d685[_0x8f53('0x17')]?_0x48d685[_0x8f53('0x17')][_0x8f53('0x1a')]||null:null,'include':_0x48d685[_0x8f53('0x17')]?_0x48d685['options'][_0x8f53('0x1c')]?_[_0x8f53('0x1e')](_0x48d685[_0x8f53('0x17')][_0x8f53('0x1c')],function(_0x21bc3f){return{'model':db[_0x21bc3f[_0x8f53('0x1d')]],'as':_0x21bc3f['as'],'attributes':_0x21bc3f[_0x8f53('0x1a')],'include':_0x21bc3f[_0x8f53('0x1c')]?_[_0x8f53('0x1e')](_0x21bc3f['include'],function(_0xdad4a0){return{'model':db[_0xdad4a0[_0x8f53('0x1d')]],'as':_0xdad4a0['as'],'attributes':_0xdad4a0[_0x8f53('0x1a')],'include':_0xdad4a0[_0x8f53('0x1c')]?_[_0x8f53('0x1e')](_0xdad4a0[_0x8f53('0x1c')],function(_0x560bfd){return{'model':db[_0x560bfd[_0x8f53('0x1d')]],'as':_0x560bfd['as'],'attributes':_0x560bfd[_0x8f53('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18d815){logger['info'](_0x8f53('0x22'),_0x48d685);logger[_0x8f53('0x20')](_0x8f53('0x22'),_0x48d685,JSON['stringify'](_0x18d815));_0x2a59e9(_0x18d815);})['catch'](function(_0x3bfbdb){logger[_0x8f53('0x10')](_0x8f53('0x22'),_0x3bfbdb[_0x8f53('0x11')],_0x48d685);_0x542722(_0x7ad5b7['error'](0x1f4,_0x3bfbdb[_0x8f53('0x11')]));});});}; \ No newline at end of file +var _0xa1b9=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','include','model','map','stringify','ShowSugarcrmAccount','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client'];(function(_0x7291bf,_0x3c48a6){var _0x36e485=function(_0x3b96db){while(--_0x3b96db){_0x7291bf['push'](_0x7291bf['shift']());}};_0x36e485(++_0x3c48a6);}(_0xa1b9,0x155));var _0x9a1b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa1b9[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x9a1b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9a1b('0x1'));var rs=require(_0x9a1b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a1b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a1b('0x4'))(_0x9a1b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a1b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x467643,_0x30c00f,_0x344dbd){return new BPromise(function(_0x4522d5,_0x23cb51){return client[_0x9a1b('0x7')](_0x467643,_0x344dbd)[_0x9a1b('0x8')](function(_0xc31527){logger[_0x9a1b('0x9')](_0x9a1b('0xa'),_0x30c00f,_0x9a1b('0xb'));logger[_0x9a1b('0xc')](_0x9a1b('0xd'),_0x30c00f,_0x9a1b('0xb'),JSON['stringify'](_0xc31527));if(_0xc31527[_0x9a1b('0xe')]){if(_0xc31527[_0x9a1b('0xe')][_0x9a1b('0xf')]===0x1f4){logger[_0x9a1b('0xe')](_0x9a1b('0xa'),_0x30c00f,_0xc31527[_0x9a1b('0xe')][_0x9a1b('0x10')]);return _0x23cb51(_0xc31527[_0x9a1b('0xe')]['message']);}logger[_0x9a1b('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x30c00f,_0xc31527['error'][_0x9a1b('0x10')]);return _0x4522d5(_0xc31527[_0x9a1b('0xe')][_0x9a1b('0x10')]);}else{logger[_0x9a1b('0x9')](_0x9a1b('0xa'),_0x30c00f,_0x9a1b('0xb'));_0x4522d5(_0xc31527['result'][_0x9a1b('0x10')]);}})[_0x9a1b('0x11')](function(_0x5f1749){logger[_0x9a1b('0xe')](_0x9a1b('0xa'),_0x30c00f,_0x5f1749);_0x23cb51(_0x5f1749);});});}exports[_0x9a1b('0x12')]=function(_0x24ca44){var _0x5bb79a=this;return new Promise(function(_0x5d7cf6,_0x23c559){return db[_0x9a1b('0x13')]['findAll']({'raw':_0x24ca44['options']?_0x24ca44[_0x9a1b('0x14')][_0x9a1b('0x15')]===undefined?!![]:![]:!![],'where':_0x24ca44['options']?_0x24ca44['options'][_0x9a1b('0x16')]||null:null,'attributes':_0x24ca44[_0x9a1b('0x14')]?_0x24ca44[_0x9a1b('0x14')][_0x9a1b('0x17')]||null:null,'limit':_0x24ca44[_0x9a1b('0x14')]?_0x24ca44['options']['limit']||null:null,'include':_0x24ca44[_0x9a1b('0x14')]?_0x24ca44[_0x9a1b('0x14')]['include']?_['map'](_0x24ca44['options'][_0x9a1b('0x18')],function(_0x3691a6){return{'model':db[_0x3691a6[_0x9a1b('0x19')]],'as':_0x3691a6['as'],'attributes':_0x3691a6['attributes'],'include':_0x3691a6[_0x9a1b('0x18')]?_[_0x9a1b('0x1a')](_0x3691a6['include'],function(_0x8e5f61){return{'model':db[_0x8e5f61[_0x9a1b('0x19')]],'as':_0x8e5f61['as'],'attributes':_0x8e5f61[_0x9a1b('0x17')],'include':_0x8e5f61[_0x9a1b('0x18')]?_[_0x9a1b('0x1a')](_0x8e5f61[_0x9a1b('0x18')],function(_0x54ccf6){return{'model':db[_0x54ccf6['model']],'as':_0x54ccf6['as'],'attributes':_0x54ccf6[_0x9a1b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aac5c){logger[_0x9a1b('0x9')](_0x9a1b('0x12'),_0x24ca44);logger[_0x9a1b('0xc')](_0x9a1b('0x12'),_0x24ca44,JSON[_0x9a1b('0x1b')](_0x2aac5c));_0x5d7cf6(_0x2aac5c);})[_0x9a1b('0x11')](function(_0x1dc3a8){logger[_0x9a1b('0xe')](_0x9a1b('0x12'),_0x1dc3a8[_0x9a1b('0x10')],_0x24ca44);_0x23c559(_0x5bb79a[_0x9a1b('0xe')](0x1f4,_0x1dc3a8[_0x9a1b('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x2a3e4b){var _0x31b0a3=this;return new Promise(function(_0x2af1f8,_0x2dc147){return db[_0x9a1b('0x13')]['find']({'raw':_0x2a3e4b[_0x9a1b('0x14')]?_0x2a3e4b[_0x9a1b('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2a3e4b[_0x9a1b('0x14')]?_0x2a3e4b[_0x9a1b('0x14')][_0x9a1b('0x16')]||null:null,'attributes':_0x2a3e4b[_0x9a1b('0x14')]?_0x2a3e4b[_0x9a1b('0x14')][_0x9a1b('0x17')]||null:null,'include':_0x2a3e4b[_0x9a1b('0x14')]?_0x2a3e4b[_0x9a1b('0x14')][_0x9a1b('0x18')]?_[_0x9a1b('0x1a')](_0x2a3e4b[_0x9a1b('0x14')]['include'],function(_0x3c717c){return{'model':db[_0x3c717c[_0x9a1b('0x19')]],'as':_0x3c717c['as'],'attributes':_0x3c717c['attributes'],'include':_0x3c717c[_0x9a1b('0x18')]?_[_0x9a1b('0x1a')](_0x3c717c[_0x9a1b('0x18')],function(_0x4a3266){return{'model':db[_0x4a3266['model']],'as':_0x4a3266['as'],'attributes':_0x4a3266[_0x9a1b('0x17')],'include':_0x4a3266['include']?_['map'](_0x4a3266[_0x9a1b('0x18')],function(_0x2eb770){return{'model':db[_0x2eb770['model']],'as':_0x2eb770['as'],'attributes':_0x2eb770[_0x9a1b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9a1b('0x8')](function(_0xc172c0){logger[_0x9a1b('0x9')](_0x9a1b('0x1c'),_0x2a3e4b);logger['debug'](_0x9a1b('0x1c'),_0x2a3e4b,JSON['stringify'](_0xc172c0));_0x2af1f8(_0xc172c0);})['catch'](function(_0x27b8bf){logger[_0x9a1b('0xe')](_0x9a1b('0x1c'),_0x27b8bf[_0x9a1b('0x10')],_0x2a3e4b);_0x2dc147(_0x31b0a3[_0x9a1b('0xe')](0x1f4,_0x27b8bf['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3ebfacd..2b4dfee 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 _0xe4ab=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/descriptions','post','put'];(function(_0x12d459,_0x2a589f){var _0x4cb094=function(_0x41e3bb){while(--_0x41e3bb){_0x12d459['push'](_0x12d459['shift']());}};_0x4cb094(++_0x2a589f);}(_0xe4ab,0x17d));var _0xbe4a=function(_0xe2a69a,_0x2d7630){_0xe2a69a=_0xe2a69a-0x0;var _0x509f6f=_0xe4ab[_0xe2a69a];return _0x509f6f;};'use strict';var multer=require(_0xbe4a('0x0'));var util=require('util');var path=require(_0xbe4a('0x1'));var timeout=require(_0xbe4a('0x2'));var express=require(_0xbe4a('0x3'));var router=express[_0xbe4a('0x4')]();var auth=require(_0xbe4a('0x5'));var interaction=require(_0xbe4a('0x6'));var config=require(_0xbe4a('0x7'));var controller=require(_0xbe4a('0x8'));router[_0xbe4a('0x9')]('/',auth[_0xbe4a('0xa')](),controller['index']);router[_0xbe4a('0x9')](_0xbe4a('0xb'),auth['isAuthenticated'](),controller[_0xbe4a('0xc')]);router[_0xbe4a('0x9')](_0xbe4a('0xd'),auth[_0xbe4a('0xa')](),controller[_0xbe4a('0xe')]);router[_0xbe4a('0x9')]('/:id/subjects',auth[_0xbe4a('0xa')](),controller['getSubjects']);router[_0xbe4a('0x9')](_0xbe4a('0xf'),auth[_0xbe4a('0xa')](),controller['getDescriptions']);router[_0xbe4a('0x10')]('/',auth[_0xbe4a('0xa')](),controller['create']);router[_0xbe4a('0x11')](_0xbe4a('0xb'),auth['isAuthenticated'](),controller[_0xbe4a('0x12')]);router[_0xbe4a('0x13')](_0xbe4a('0xb'),auth[_0xbe4a('0xa')](),controller['destroy']);module[_0xbe4a('0x14')]=router; \ No newline at end of file +var _0xda79=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','util'];(function(_0xe93b11,_0x39d892){var _0x3239fe=function(_0x29533d){while(--_0x29533d){_0xe93b11['push'](_0xe93b11['shift']());}};_0x3239fe(++_0x39d892);}(_0xda79,0x82));var _0x9da7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xda79[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var path=require('path');var timeout=require(_0x9da7('0x2'));var express=require('express');var router=express[_0x9da7('0x3')]();var auth=require(_0x9da7('0x4'));var interaction=require(_0x9da7('0x5'));var config=require('../../config/environment');var controller=require(_0x9da7('0x6'));router[_0x9da7('0x7')]('/',auth[_0x9da7('0x8')](),controller[_0x9da7('0x9')]);router[_0x9da7('0x7')](_0x9da7('0xa'),auth[_0x9da7('0x8')](),controller['show']);router['get'](_0x9da7('0xb'),auth['isAuthenticated'](),controller[_0x9da7('0xc')]);router[_0x9da7('0x7')](_0x9da7('0xd'),auth[_0x9da7('0x8')](),controller[_0x9da7('0xe')]);router[_0x9da7('0x7')]('/:id/descriptions',auth[_0x9da7('0x8')](),controller[_0x9da7('0xf')]);router[_0x9da7('0x10')]('/',auth['isAuthenticated'](),controller[_0x9da7('0x11')]);router[_0x9da7('0x12')](_0x9da7('0xa'),auth[_0x9da7('0x8')](),controller[_0x9da7('0x13')]);router[_0x9da7('0x14')](_0x9da7('0xa'),auth[_0x9da7('0x8')](),controller['destroy']);module[_0x9da7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 67e18f6..f29aa17 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 _0xd31e=['STRING','sequelize','exports'];(function(_0x3aa855,_0x335774){var _0x245db2=function(_0x15c0cc){while(--_0x15c0cc){_0x3aa855['push'](_0x3aa855['shift']());}};_0x245db2(++_0x335774);}(_0xd31e,0x12a));var _0xed31=function(_0x1df09f,_0x27bc62){_0x1df09f=_0x1df09f-0x0;var _0xad715d=_0xd31e[_0x1df09f];return _0xad715d;};'use strict';var Sequelize=require(_0xed31('0x0'));module[_0xed31('0x1')]={'name':{'type':Sequelize[_0xed31('0x2')]},'description':{'type':Sequelize[_0xed31('0x2')]}}; \ No newline at end of file +var _0x2256=['exports','STRING','sequelize'];(function(_0x5da17a,_0x480929){var _0x51fa58=function(_0x57fe5b){while(--_0x57fe5b){_0x5da17a['push'](_0x5da17a['shift']());}};_0x51fa58(++_0x480929);}(_0x2256,0xcb));var _0x6225=function(_0x30a0b1,_0x1117c1){_0x30a0b1=_0x30a0b1-0x0;var _0x4f9204=_0x2256[_0x30a0b1];return _0x4f9204;};'use strict';var Sequelize=require(_0x6225('0x0'));module[_0x6225('0x1')]={'name':{'type':Sequelize[_0x6225('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index e180a31..690fd8d 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 _0x0c44=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','send','index','SugarcrmConfiguration','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map','type','key','field','options','then','include','rows','includeAll','find','create','body','params','getFields','findOne','SugarcrmField','rawAttributes','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x237acc,_0x22acdf){var _0x39a9b7=function(_0x38a20f){while(--_0x38a20f){_0x237acc['push'](_0x237acc['shift']());}};_0x39a9b7(++_0x22acdf);}(_0x0c44,0x101));var _0x40c4=function(_0x3b9369,_0x524a16){_0x3b9369=_0x3b9369-0x0;var _0x2c02c2=_0x0c44[_0x3b9369];return _0x2c02c2;};'use strict';var pdf=require(_0x40c4('0x0'));var emlformat=require(_0x40c4('0x1'));var rimraf=require(_0x40c4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40c4('0x3'));var rp=require(_0x40c4('0x4'));var moment=require(_0x40c4('0x5'));var BPromise=require(_0x40c4('0x6'));var Mustache=require(_0x40c4('0x7'));var util=require(_0x40c4('0x8'));var path=require(_0x40c4('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40c4('0xa'));var fs=require('fs');var _=require(_0x40c4('0xb'));var squel=require('squel');var crypto=require(_0x40c4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x40c4('0xd'));var Papa=require(_0x40c4('0xe'));var Redis=require(_0x40c4('0xf'));var authService=require(_0x40c4('0x10'));var qs=require(_0x40c4('0x11'));var hardwareService=require(_0x40c4('0x12'));var logger=require('../../config/logger')(_0x40c4('0x13'));var utils=require(_0x40c4('0x14'));var config=require(_0x40c4('0x15'));var db=require(_0x40c4('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x40c4('0x17')][_0x40c4('0x18')]({'port':0x232a});function checkPasswordPattern(_0x30e3c6,_0x21dfc6,_0x28b47d){if(_0x28b47d){var _0x222c1c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x222c1c[_0x40c4('0x19')](_0x21dfc6)){return _0x30e3c6;}else{throw new Error(_0x40c4('0x1a'));}}else{return _0x30e3c6;}}function respondWithRpcPromise(_0x3dac82,_0x1c1e37,_0x4ed256,_0x2b886a){return new BPromise(function(_0x342550,_0x5c5657){var _0x573790=_0x2b886a||client;return _0x573790[_0x40c4('0x1b')](_0x3dac82,_0x4ed256)['then'](function(_0x572f74){logger[_0x40c4('0x1c')](_0x40c4('0x1d'),_0x1c1e37,'request\x20sent');logger[_0x40c4('0x1e')](_0x40c4('0x1f'),_0x1c1e37,_0x40c4('0x20'),JSON[_0x40c4('0x21')](_0x572f74));if(_0x572f74[_0x40c4('0x22')]){if(_0x572f74[_0x40c4('0x22')][_0x40c4('0x23')]===0x1f4){logger['error'](_0x40c4('0x1d'),_0x1c1e37,_0x572f74[_0x40c4('0x22')]['message']);return _0x5c5657(_0x572f74[_0x40c4('0x22')][_0x40c4('0x24')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1c1e37,_0x572f74[_0x40c4('0x22')][_0x40c4('0x24')]);return _0x342550(_0x572f74['error'][_0x40c4('0x24')]);}else{logger['info'](_0x40c4('0x1d'),_0x1c1e37,'request\x20sent');_0x342550(_0x572f74[_0x40c4('0x25')]['message']);}})[_0x40c4('0x26')](function(_0x18b71a){logger['error'](_0x40c4('0x1d'),_0x1c1e37,_0x18b71a);_0x5c5657(_0x18b71a);});});}function respondWithStatusCode(_0x240068,_0x34d834){_0x34d834=_0x34d834||0xcc;return function(_0x3d306e){if(_0x3d306e){return _0x240068[_0x40c4('0x27')](_0x34d834);}return _0x240068['status'](_0x34d834)[_0x40c4('0x28')]();};}function respondWithResult(_0x24e8c7,_0x4660a8){_0x4660a8=_0x4660a8||0xc8;return function(_0x99ffee){if(_0x99ffee){return _0x24e8c7[_0x40c4('0x29')](_0x4660a8)[_0x40c4('0x2a')](_0x99ffee);}};}function respondWithFilteredResult(_0xda1d94,_0x208601){return function(_0x2a6100){if(_0x2a6100){var _0x4dcfa4=_0x2a6100[_0x40c4('0x2b')],_0x5055f0=_0x208601[_0x40c4('0x2c')],_0x761b2f=_0x208601[_0x40c4('0x2c')]+_0x208601[_0x40c4('0x2d')],_0x57450f;if(_0x761b2f>=_0x4dcfa4){_0x761b2f=_0x4dcfa4;_0x57450f=0xc8;}else{_0x57450f=0xce;}_0xda1d94[_0x40c4('0x29')](_0x57450f);return _0xda1d94[_0x40c4('0x2e')](_0x40c4('0x2f'),_0x5055f0+'-'+_0x761b2f+'/'+_0x4dcfa4)[_0x40c4('0x2a')](_0x2a6100);}return null;};}function patchUpdates(_0x5e50f7){return function(_0x3a0f4f){try{jsonpatch[_0x40c4('0x30')](_0x3a0f4f,_0x5e50f7,!![]);}catch(_0x227ad6){return BPromise[_0x40c4('0x31')](_0x227ad6);}return _0x3a0f4f['save']();};}function saveUpdates(_0x3a73aa,_0x4dc07b){return function(_0x53b960){if(_0x53b960){return _0x53b960[_0x40c4('0x32')](_0x3a73aa)['then'](function(_0x2c3f6f){return _0x2c3f6f;});}return null;};}function removeEntity(_0xf760f3,_0x233cef){return function(_0x335bf2){if(_0x335bf2){return _0x335bf2[_0x40c4('0x33')]()['then'](function(){_0xf760f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59cd69,_0x3cc23f){return function(_0x20848b){if(!_0x20848b){_0x59cd69[_0x40c4('0x27')](0x194);}return _0x20848b;};}function handleError(_0x4d17d6,_0x47877d){_0x47877d=_0x47877d||0x1f4;return function(_0x4c78e4){logger[_0x40c4('0x22')](_0x4c78e4['stack']);if(_0x4c78e4['name']){delete _0x4c78e4[_0x40c4('0x34')];}_0x4d17d6[_0x40c4('0x29')](_0x47877d)[_0x40c4('0x35')](_0x4c78e4);};}exports[_0x40c4('0x36')]=function(_0x5d4e1d,_0x524b3a){var _0x4f2fe2={},_0x1ae24b={},_0x106762={'count':0x0,'rows':[]};var _0x40b2d8=db[_0x40c4('0x37')]['rawAttributes'];_0x1ae24b[_0x40c4('0x38')]=_['keys'](_0x40b2d8);_0x1ae24b[_0x40c4('0x39')]=_[_0x40c4('0x3a')](_0x5d4e1d[_0x40c4('0x39')]);_0x1ae24b[_0x40c4('0x3b')]=_[_0x40c4('0x3c')](_0x1ae24b['model'],_0x1ae24b[_0x40c4('0x39')]);_0x4f2fe2[_0x40c4('0x3d')]=_[_0x40c4('0x3c')](_0x1ae24b['model'],qs['fields'](_0x5d4e1d[_0x40c4('0x39')][_0x40c4('0x3e')]));_0x4f2fe2[_0x40c4('0x3d')]=_0x4f2fe2[_0x40c4('0x3d')][_0x40c4('0x3f')]?_0x4f2fe2[_0x40c4('0x3d')]:_0x1ae24b[_0x40c4('0x38')];if(!_0x5d4e1d[_0x40c4('0x39')]['hasOwnProperty']('nolimit')){_0x4f2fe2[_0x40c4('0x2d')]=qs['limit'](_0x5d4e1d['query'][_0x40c4('0x2d')]);_0x4f2fe2['offset']=qs[_0x40c4('0x2c')](_0x5d4e1d[_0x40c4('0x39')][_0x40c4('0x2c')]);}_0x4f2fe2[_0x40c4('0x40')]=qs[_0x40c4('0x41')](_0x5d4e1d[_0x40c4('0x39')][_0x40c4('0x41')]);_0x4f2fe2[_0x40c4('0x42')]=qs[_0x40c4('0x3b')](_[_0x40c4('0x43')](_0x5d4e1d['query'],_0x1ae24b['filters']));if(_0x5d4e1d['query'][_0x40c4('0x44')]){_0x4f2fe2[_0x40c4('0x42')]=_[_0x40c4('0x45')](_0x4f2fe2[_0x40c4('0x42')],{'$or':_[_0x40c4('0x46')](_0x40b2d8,function(_0x2d1aa8){if(_0x2d1aa8[_0x40c4('0x47')][_0x40c4('0x48')]!=='VIRTUAL'){var _0x2827e2={};_0x2827e2[_0x2d1aa8[_0x40c4('0x49')]]={'$like':'%'+_0x5d4e1d[_0x40c4('0x39')][_0x40c4('0x44')]+'%'};return _0x2827e2;}})});}_0x4f2fe2=_[_0x40c4('0x45')]({},_0x4f2fe2,_0x5d4e1d[_0x40c4('0x4a')]);var _0x24240b={'where':_0x4f2fe2[_0x40c4('0x42')]};return db[_0x40c4('0x37')][_0x40c4('0x2b')](_0x24240b)[_0x40c4('0x4b')](function(_0x4d1756){_0x106762['count']=_0x4d1756;if(_0x5d4e1d['query']['includeAll']){_0x4f2fe2[_0x40c4('0x4c')]=[{'all':!![]}];}return db[_0x40c4('0x37')]['findAll'](_0x4f2fe2);})['then'](function(_0xb6b9d5){_0x106762[_0x40c4('0x4d')]=_0xb6b9d5;return _0x106762;})[_0x40c4('0x4b')](respondWithFilteredResult(_0x524b3a,_0x4f2fe2))['catch'](handleError(_0x524b3a,null));};exports['show']=function(_0x5537e5,_0xe9c1ef){var _0x1c0da8={'raw':![],'where':{'id':_0x5537e5['params']['id']}},_0x3262e5={};_0x3262e5[_0x40c4('0x38')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x3262e5[_0x40c4('0x39')]=_['keys'](_0x5537e5[_0x40c4('0x39')]);_0x3262e5[_0x40c4('0x3b')]=_['intersection'](_0x3262e5[_0x40c4('0x38')],_0x3262e5[_0x40c4('0x39')]);_0x1c0da8[_0x40c4('0x3d')]=_[_0x40c4('0x3c')](_0x3262e5[_0x40c4('0x38')],qs[_0x40c4('0x3e')](_0x5537e5['query'][_0x40c4('0x3e')]));_0x1c0da8[_0x40c4('0x3d')]=_0x1c0da8[_0x40c4('0x3d')][_0x40c4('0x3f')]?_0x1c0da8['attributes']:_0x3262e5[_0x40c4('0x38')];if(_0x5537e5[_0x40c4('0x39')][_0x40c4('0x4e')]){_0x1c0da8['include']=[{'all':!![]}];}_0x1c0da8=_['merge']({},_0x1c0da8,_0x5537e5['options']);return db[_0x40c4('0x37')][_0x40c4('0x4f')](_0x1c0da8)[_0x40c4('0x4b')](handleEntityNotFound(_0xe9c1ef,null))[_0x40c4('0x4b')](respondWithResult(_0xe9c1ef,null))[_0x40c4('0x26')](handleError(_0xe9c1ef,null));};exports[_0x40c4('0x50')]=function(_0x4aeef7,_0x30baab){return db[_0x40c4('0x37')][_0x40c4('0x50')](_0x4aeef7[_0x40c4('0x51')],{})[_0x40c4('0x4b')](respondWithResult(_0x30baab,0xc9))[_0x40c4('0x26')](handleError(_0x30baab,null));};exports['update']=function(_0x5723c5,_0x17767c){if(_0x5723c5['body']['id']){delete _0x5723c5[_0x40c4('0x51')]['id'];}return db[_0x40c4('0x37')][_0x40c4('0x4f')]({'where':{'id':_0x5723c5[_0x40c4('0x52')]['id']}})[_0x40c4('0x4b')](handleEntityNotFound(_0x17767c,null))['then'](saveUpdates(_0x5723c5[_0x40c4('0x51')],null))[_0x40c4('0x4b')](respondWithResult(_0x17767c,null))['catch'](handleError(_0x17767c,null));};exports[_0x40c4('0x33')]=function(_0x40efbc,_0x564895){return db['SugarcrmConfiguration'][_0x40c4('0x4f')]({'where':{'id':_0x40efbc[_0x40c4('0x52')]['id']}})[_0x40c4('0x4b')](handleEntityNotFound(_0x564895,null))[_0x40c4('0x4b')](removeEntity(_0x564895,null))[_0x40c4('0x26')](handleError(_0x564895,null));};exports[_0x40c4('0x53')]=function(_0x313fb5,_0x3cbf1a,_0x482d58){var _0x4c5ce6={};var _0x1674aa={};var _0x508298;var _0x4ba062;return db['SugarcrmConfiguration'][_0x40c4('0x54')]({'where':{'id':_0x313fb5['params']['id']}})[_0x40c4('0x4b')](handleEntityNotFound(_0x3cbf1a,null))[_0x40c4('0x4b')](function(_0x3c091d){if(_0x3c091d){_0x508298=_0x3c091d;_0x1674aa[_0x40c4('0x38')]=_[_0x40c4('0x3a')](db[_0x40c4('0x55')][_0x40c4('0x56')]);_0x1674aa[_0x40c4('0x39')]=_[_0x40c4('0x3a')](_0x313fb5['query']);_0x1674aa[_0x40c4('0x3b')]=_['intersection'](_0x1674aa[_0x40c4('0x38')],_0x1674aa[_0x40c4('0x39')]);_0x4c5ce6[_0x40c4('0x3d')]=_[_0x40c4('0x3c')](_0x1674aa['model'],qs[_0x40c4('0x3e')](_0x313fb5['query']['fields']));_0x4c5ce6[_0x40c4('0x3d')]=_0x4c5ce6[_0x40c4('0x3d')][_0x40c4('0x3f')]?_0x4c5ce6[_0x40c4('0x3d')]:_0x1674aa['model'];_0x4c5ce6[_0x40c4('0x40')]=qs[_0x40c4('0x41')](_0x313fb5['query'][_0x40c4('0x41')]);_0x4c5ce6[_0x40c4('0x42')]=qs[_0x40c4('0x3b')](_['pick'](_0x313fb5[_0x40c4('0x39')],_0x1674aa[_0x40c4('0x3b')]));if(_0x313fb5['query'][_0x40c4('0x44')]){_0x4c5ce6['where']=_[_0x40c4('0x45')](_0x4c5ce6[_0x40c4('0x42')],{'$or':_[_0x40c4('0x46')](_0x4c5ce6['attributes'],function(_0x261adf){var _0x4f3199={};_0x4f3199[_0x261adf]={'$like':'%'+_0x313fb5[_0x40c4('0x39')]['filter']+'%'};return _0x4f3199;})});}_0x4c5ce6=_[_0x40c4('0x45')]({},_0x4c5ce6,_0x313fb5['options']);return _0x508298[_0x40c4('0x53')](_0x4c5ce6);}})[_0x40c4('0x4b')](function(_0x13578a){if(_0x13578a){_0x4ba062=_0x13578a[_0x40c4('0x3f')];if(!_0x313fb5[_0x40c4('0x39')][_0x40c4('0x57')](_0x40c4('0x58'))){_0x4c5ce6['limit']=qs[_0x40c4('0x2d')](_0x313fb5['query'][_0x40c4('0x2d')]);_0x4c5ce6[_0x40c4('0x2c')]=qs[_0x40c4('0x2c')](_0x313fb5[_0x40c4('0x39')]['offset']);}return _0x508298[_0x40c4('0x53')](_0x4c5ce6);}})[_0x40c4('0x4b')](function(_0x61bcf7){if(_0x61bcf7){return _0x61bcf7?{'count':_0x4ba062,'rows':_0x61bcf7}:null;}})['then'](respondWithResult(_0x3cbf1a,null))['catch'](handleError(_0x3cbf1a,null));};exports[_0x40c4('0x59')]=function(_0x2e311d,_0x295eda,_0x133dcc){var _0x5e3936={};var _0x110c76={};var _0x4a7a88;var _0xb8c8a;return db[_0x40c4('0x37')][_0x40c4('0x54')]({'where':{'id':_0x2e311d[_0x40c4('0x52')]['id']}})[_0x40c4('0x4b')](handleEntityNotFound(_0x295eda,null))[_0x40c4('0x4b')](function(_0x10f3fb){if(_0x10f3fb){_0x4a7a88=_0x10f3fb;_0x110c76['model']=_[_0x40c4('0x3a')](db[_0x40c4('0x55')]['rawAttributes']);_0x110c76[_0x40c4('0x39')]=_['keys'](_0x2e311d[_0x40c4('0x39')]);_0x110c76[_0x40c4('0x3b')]=_[_0x40c4('0x3c')](_0x110c76[_0x40c4('0x38')],_0x110c76[_0x40c4('0x39')]);_0x5e3936['attributes']=_['intersection'](_0x110c76[_0x40c4('0x38')],qs['fields'](_0x2e311d[_0x40c4('0x39')][_0x40c4('0x3e')]));_0x5e3936[_0x40c4('0x3d')]=_0x5e3936[_0x40c4('0x3d')][_0x40c4('0x3f')]?_0x5e3936['attributes']:_0x110c76[_0x40c4('0x38')];_0x5e3936[_0x40c4('0x40')]=qs[_0x40c4('0x41')](_0x2e311d['query'][_0x40c4('0x41')]);_0x5e3936['where']=qs['filters'](_[_0x40c4('0x43')](_0x2e311d[_0x40c4('0x39')],_0x110c76[_0x40c4('0x3b')]));if(_0x2e311d[_0x40c4('0x39')][_0x40c4('0x44')]){_0x5e3936[_0x40c4('0x42')]=_[_0x40c4('0x45')](_0x5e3936['where'],{'$or':_[_0x40c4('0x46')](_0x5e3936[_0x40c4('0x3d')],function(_0x310239){var _0x19c6cb={};_0x19c6cb[_0x310239]={'$like':'%'+_0x2e311d[_0x40c4('0x39')][_0x40c4('0x44')]+'%'};return _0x19c6cb;})});}_0x5e3936=_[_0x40c4('0x45')]({},_0x5e3936,_0x2e311d[_0x40c4('0x4a')]);return _0x4a7a88[_0x40c4('0x59')](_0x5e3936);}})[_0x40c4('0x4b')](function(_0x298f62){if(_0x298f62){_0xb8c8a=_0x298f62[_0x40c4('0x3f')];if(!_0x2e311d[_0x40c4('0x39')][_0x40c4('0x57')](_0x40c4('0x58'))){_0x5e3936[_0x40c4('0x2d')]=qs[_0x40c4('0x2d')](_0x2e311d['query'][_0x40c4('0x2d')]);_0x5e3936[_0x40c4('0x2c')]=qs['offset'](_0x2e311d[_0x40c4('0x39')]['offset']);}return _0x4a7a88[_0x40c4('0x59')](_0x5e3936);}})[_0x40c4('0x4b')](function(_0x3bd0ed){if(_0x3bd0ed){return _0x3bd0ed?{'count':_0xb8c8a,'rows':_0x3bd0ed}:null;}})[_0x40c4('0x4b')](respondWithResult(_0x295eda,null))[_0x40c4('0x26')](handleError(_0x295eda,null));};exports[_0x40c4('0x5a')]=function(_0x3d6237,_0x24481b,_0x461326){var _0x4f2209={};var _0x1b7280={};var _0x98dbdf;var _0x4f78a9;return db[_0x40c4('0x37')]['findOne']({'where':{'id':_0x3d6237['params']['id']}})[_0x40c4('0x4b')](handleEntityNotFound(_0x24481b,null))[_0x40c4('0x4b')](function(_0x4fe7ce){if(_0x4fe7ce){_0x98dbdf=_0x4fe7ce;_0x1b7280['model']=_[_0x40c4('0x3a')](db['SugarcrmField']['rawAttributes']);_0x1b7280['query']=_[_0x40c4('0x3a')](_0x3d6237[_0x40c4('0x39')]);_0x1b7280['filters']=_[_0x40c4('0x3c')](_0x1b7280[_0x40c4('0x38')],_0x1b7280[_0x40c4('0x39')]);_0x4f2209[_0x40c4('0x3d')]=_[_0x40c4('0x3c')](_0x1b7280[_0x40c4('0x38')],qs[_0x40c4('0x3e')](_0x3d6237[_0x40c4('0x39')][_0x40c4('0x3e')]));_0x4f2209[_0x40c4('0x3d')]=_0x4f2209['attributes'][_0x40c4('0x3f')]?_0x4f2209['attributes']:_0x1b7280[_0x40c4('0x38')];_0x4f2209['order']=qs[_0x40c4('0x41')](_0x3d6237[_0x40c4('0x39')][_0x40c4('0x41')]);_0x4f2209[_0x40c4('0x42')]=qs['filters'](_[_0x40c4('0x43')](_0x3d6237[_0x40c4('0x39')],_0x1b7280[_0x40c4('0x3b')]));if(_0x3d6237[_0x40c4('0x39')][_0x40c4('0x44')]){_0x4f2209[_0x40c4('0x42')]=_[_0x40c4('0x45')](_0x4f2209[_0x40c4('0x42')],{'$or':_['map'](_0x4f2209['attributes'],function(_0x22267d){var _0x250bf2={};_0x250bf2[_0x22267d]={'$like':'%'+_0x3d6237[_0x40c4('0x39')][_0x40c4('0x44')]+'%'};return _0x250bf2;})});}_0x4f2209=_[_0x40c4('0x45')]({},_0x4f2209,_0x3d6237[_0x40c4('0x4a')]);return _0x98dbdf[_0x40c4('0x5a')](_0x4f2209);}})[_0x40c4('0x4b')](function(_0x1fc30f){if(_0x1fc30f){_0x4f78a9=_0x1fc30f[_0x40c4('0x3f')];if(!_0x3d6237[_0x40c4('0x39')][_0x40c4('0x57')](_0x40c4('0x58'))){_0x4f2209[_0x40c4('0x2d')]=qs['limit'](_0x3d6237[_0x40c4('0x39')][_0x40c4('0x2d')]);_0x4f2209[_0x40c4('0x2c')]=qs[_0x40c4('0x2c')](_0x3d6237['query'][_0x40c4('0x2c')]);}return _0x98dbdf[_0x40c4('0x5a')](_0x4f2209);}})[_0x40c4('0x4b')](function(_0x10ac97){if(_0x10ac97){return _0x10ac97?{'count':_0x4f78a9,'rows':_0x10ac97}:null;}})[_0x40c4('0x4b')](respondWithResult(_0x24481b,null))[_0x40c4('0x26')](handleError(_0x24481b,null));}; \ No newline at end of file +var _0xb086=['../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','field','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','findOne','SugarcrmField','sort','map','getFields','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x405439,_0xe4fb83){var _0x26725f=function(_0x2595b9){while(--_0x2595b9){_0x405439['push'](_0x405439['shift']());}};_0x26725f(++_0xe4fb83);}(_0xb086,0x1ab));var _0x6b08=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb086[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x6b08('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b08('0x1'));var zipdir=require(_0x6b08('0x2'));var jsonpatch=require(_0x6b08('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b08('0x4'));var util=require('util');var path=require(_0x6b08('0x5'));var sox=require('sox');var csv=require(_0x6b08('0x6'));var ejs=require(_0x6b08('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6b08('0x8'));var crypto=require(_0x6b08('0x9'));var jsforce=require(_0x6b08('0xa'));var deskjs=require(_0x6b08('0xb'));var toCsv=require(_0x6b08('0x6'));var querystring=require(_0x6b08('0xc'));var Papa=require(_0x6b08('0xd'));var Redis=require(_0x6b08('0xe'));var authService=require(_0x6b08('0xf'));var qs=require(_0x6b08('0x10'));var hardwareService=require(_0x6b08('0x11'));var logger=require(_0x6b08('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6b08('0x13'));var db=require(_0x6b08('0x14'))['db'];var jayson=require(_0x6b08('0x15'));var client=jayson[_0x6b08('0x16')][_0x6b08('0x17')]({'port':0x232a});function checkPasswordPattern(_0xf27cb5,_0x13cca5,_0x391ac0){if(_0x391ac0){var _0x581070=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x581070['test'](_0x13cca5)){return _0xf27cb5;}else{throw new Error(_0x6b08('0x18'));}}else{return _0xf27cb5;}}function respondWithRpcPromise(_0x5bbe09,_0x3a7bbb,_0x226543,_0x44b2d8){return new BPromise(function(_0x159f43,_0x4eb00f){var _0x2e7cb6=_0x44b2d8||client;return _0x2e7cb6[_0x6b08('0x19')](_0x5bbe09,_0x226543)[_0x6b08('0x1a')](function(_0x4e5ab7){logger['info'](_0x6b08('0x1b'),_0x3a7bbb,_0x6b08('0x1c'));logger[_0x6b08('0x1d')](_0x6b08('0x1e'),_0x3a7bbb,_0x6b08('0x1c'),JSON[_0x6b08('0x1f')](_0x4e5ab7));if(_0x4e5ab7['error']){if(_0x4e5ab7[_0x6b08('0x20')]['code']===0x1f4){logger['error'](_0x6b08('0x1b'),_0x3a7bbb,_0x4e5ab7[_0x6b08('0x20')][_0x6b08('0x21')]);return _0x4eb00f(_0x4e5ab7[_0x6b08('0x20')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3a7bbb,_0x4e5ab7[_0x6b08('0x20')][_0x6b08('0x21')]);return _0x159f43(_0x4e5ab7['error']['message']);}else{logger[_0x6b08('0x22')](_0x6b08('0x1b'),_0x3a7bbb,_0x6b08('0x1c'));_0x159f43(_0x4e5ab7[_0x6b08('0x23')][_0x6b08('0x21')]);}})[_0x6b08('0x24')](function(_0x1535ea){logger[_0x6b08('0x20')](_0x6b08('0x1b'),_0x3a7bbb,_0x1535ea);_0x4eb00f(_0x1535ea);});});}function respondWithStatusCode(_0x2e1b27,_0x26ff49){_0x26ff49=_0x26ff49||0xcc;return function(_0xafb979){if(_0xafb979){return _0x2e1b27[_0x6b08('0x25')](_0x26ff49);}return _0x2e1b27[_0x6b08('0x26')](_0x26ff49)['end']();};}function respondWithResult(_0x5a53c9,_0x3e5867){_0x3e5867=_0x3e5867||0xc8;return function(_0x3ea500){if(_0x3ea500){return _0x5a53c9[_0x6b08('0x26')](_0x3e5867)[_0x6b08('0x27')](_0x3ea500);}};}function respondWithFilteredResult(_0x59ce27,_0x4c8ce6){return function(_0x1fab41){if(_0x1fab41){var _0x2ecfa2=_0x1fab41[_0x6b08('0x28')],_0x325737=_0x4c8ce6[_0x6b08('0x29')],_0x3fbfab=_0x4c8ce6[_0x6b08('0x29')]+_0x4c8ce6[_0x6b08('0x2a')],_0x9cc9cb;if(_0x3fbfab>=_0x2ecfa2){_0x3fbfab=_0x2ecfa2;_0x9cc9cb=0xc8;}else{_0x9cc9cb=0xce;}_0x59ce27[_0x6b08('0x26')](_0x9cc9cb);return _0x59ce27[_0x6b08('0x2b')](_0x6b08('0x2c'),_0x325737+'-'+_0x3fbfab+'/'+_0x2ecfa2)[_0x6b08('0x27')](_0x1fab41);}return null;};}function patchUpdates(_0x51d085){return function(_0x220ec8){try{jsonpatch['apply'](_0x220ec8,_0x51d085,!![]);}catch(_0x369981){return BPromise[_0x6b08('0x2d')](_0x369981);}return _0x220ec8[_0x6b08('0x2e')]();};}function saveUpdates(_0x526ecf,_0x5bf1af){return function(_0x27ffd1){if(_0x27ffd1){return _0x27ffd1[_0x6b08('0x2f')](_0x526ecf)['then'](function(_0x22fcfb){return _0x22fcfb;});}return null;};}function removeEntity(_0xecc413,_0x134629){return function(_0x31cc55){if(_0x31cc55){return _0x31cc55[_0x6b08('0x30')]()['then'](function(){_0xecc413[_0x6b08('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35750f,_0x408133){return function(_0x4c136f){if(!_0x4c136f){_0x35750f[_0x6b08('0x25')](0x194);}return _0x4c136f;};}function handleError(_0x1d0e95,_0x390c24){_0x390c24=_0x390c24||0x1f4;return function(_0x1c1b54){logger[_0x6b08('0x20')](_0x1c1b54[_0x6b08('0x31')]);if(_0x1c1b54[_0x6b08('0x32')]){delete _0x1c1b54[_0x6b08('0x32')];}_0x1d0e95[_0x6b08('0x26')](_0x390c24)['send'](_0x1c1b54);};}exports[_0x6b08('0x33')]=function(_0x3d3aab,_0x7238e4){var _0xa970={},_0xbaf152={},_0x17667d={'count':0x0,'rows':[]};var _0x5a71b4=db[_0x6b08('0x34')][_0x6b08('0x35')];_0xbaf152[_0x6b08('0x36')]=_[_0x6b08('0x37')](_0x5a71b4);_0xbaf152['query']=_[_0x6b08('0x37')](_0x3d3aab[_0x6b08('0x38')]);_0xbaf152[_0x6b08('0x39')]=_[_0x6b08('0x3a')](_0xbaf152[_0x6b08('0x36')],_0xbaf152[_0x6b08('0x38')]);_0xa970[_0x6b08('0x3b')]=_[_0x6b08('0x3a')](_0xbaf152[_0x6b08('0x36')],qs[_0x6b08('0x3c')](_0x3d3aab['query'][_0x6b08('0x3c')]));_0xa970[_0x6b08('0x3b')]=_0xa970['attributes'][_0x6b08('0x3d')]?_0xa970[_0x6b08('0x3b')]:_0xbaf152[_0x6b08('0x36')];if(!_0x3d3aab[_0x6b08('0x38')][_0x6b08('0x3e')](_0x6b08('0x3f'))){_0xa970[_0x6b08('0x2a')]=qs[_0x6b08('0x2a')](_0x3d3aab[_0x6b08('0x38')][_0x6b08('0x2a')]);_0xa970[_0x6b08('0x29')]=qs[_0x6b08('0x29')](_0x3d3aab[_0x6b08('0x38')]['offset']);}_0xa970[_0x6b08('0x40')]=qs['sort'](_0x3d3aab[_0x6b08('0x38')]['sort']);_0xa970[_0x6b08('0x41')]=qs[_0x6b08('0x39')](_[_0x6b08('0x42')](_0x3d3aab[_0x6b08('0x38')],_0xbaf152['filters']));if(_0x3d3aab['query']['filter']){_0xa970[_0x6b08('0x41')]=_[_0x6b08('0x43')](_0xa970[_0x6b08('0x41')],{'$or':_['map'](_0x5a71b4,function(_0x1353a7){if(_0x1353a7[_0x6b08('0x44')]['key']!==_0x6b08('0x45')){var _0x41b231={};_0x41b231[_0x1353a7[_0x6b08('0x46')]]={'$like':'%'+_0x3d3aab[_0x6b08('0x38')][_0x6b08('0x47')]+'%'};return _0x41b231;}})});}_0xa970=_[_0x6b08('0x43')]({},_0xa970,_0x3d3aab[_0x6b08('0x48')]);var _0x415ec6={'where':_0xa970[_0x6b08('0x41')]};return db[_0x6b08('0x34')]['count'](_0x415ec6)[_0x6b08('0x1a')](function(_0x921253){_0x17667d[_0x6b08('0x28')]=_0x921253;if(_0x3d3aab[_0x6b08('0x38')][_0x6b08('0x49')]){_0xa970['include']=[{'all':!![]}];}return db[_0x6b08('0x34')][_0x6b08('0x4a')](_0xa970);})[_0x6b08('0x1a')](function(_0x46a3d6){_0x17667d[_0x6b08('0x4b')]=_0x46a3d6;return _0x17667d;})[_0x6b08('0x1a')](respondWithFilteredResult(_0x7238e4,_0xa970))['catch'](handleError(_0x7238e4,null));};exports[_0x6b08('0x4c')]=function(_0x2c1fe4,_0x3b47d8){var _0x201df4={'raw':![],'where':{'id':_0x2c1fe4[_0x6b08('0x4d')]['id']}},_0x17e25c={};_0x17e25c['model']=_[_0x6b08('0x37')](db[_0x6b08('0x34')]['rawAttributes']);_0x17e25c[_0x6b08('0x38')]=_[_0x6b08('0x37')](_0x2c1fe4[_0x6b08('0x38')]);_0x17e25c['filters']=_[_0x6b08('0x3a')](_0x17e25c[_0x6b08('0x36')],_0x17e25c[_0x6b08('0x38')]);_0x201df4['attributes']=_[_0x6b08('0x3a')](_0x17e25c['model'],qs[_0x6b08('0x3c')](_0x2c1fe4[_0x6b08('0x38')][_0x6b08('0x3c')]));_0x201df4['attributes']=_0x201df4[_0x6b08('0x3b')][_0x6b08('0x3d')]?_0x201df4['attributes']:_0x17e25c[_0x6b08('0x36')];if(_0x2c1fe4['query'][_0x6b08('0x49')]){_0x201df4[_0x6b08('0x4e')]=[{'all':!![]}];}_0x201df4=_['merge']({},_0x201df4,_0x2c1fe4[_0x6b08('0x48')]);return db[_0x6b08('0x34')][_0x6b08('0x4f')](_0x201df4)[_0x6b08('0x1a')](handleEntityNotFound(_0x3b47d8,null))[_0x6b08('0x1a')](respondWithResult(_0x3b47d8,null))[_0x6b08('0x24')](handleError(_0x3b47d8,null));};exports[_0x6b08('0x50')]=function(_0x481f42,_0x4c9bdd){return db[_0x6b08('0x34')][_0x6b08('0x50')](_0x481f42[_0x6b08('0x51')],{})[_0x6b08('0x1a')](respondWithResult(_0x4c9bdd,0xc9))[_0x6b08('0x24')](handleError(_0x4c9bdd,null));};exports[_0x6b08('0x2f')]=function(_0x116e58,_0x3a571c){if(_0x116e58[_0x6b08('0x51')]['id']){delete _0x116e58[_0x6b08('0x51')]['id'];}return db[_0x6b08('0x34')]['find']({'where':{'id':_0x116e58[_0x6b08('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3a571c,null))[_0x6b08('0x1a')](saveUpdates(_0x116e58[_0x6b08('0x51')],null))[_0x6b08('0x1a')](respondWithResult(_0x3a571c,null))[_0x6b08('0x24')](handleError(_0x3a571c,null));};exports['destroy']=function(_0x3f45d1,_0x3b6d83){return db[_0x6b08('0x34')][_0x6b08('0x4f')]({'where':{'id':_0x3f45d1[_0x6b08('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b6d83,null))['then'](removeEntity(_0x3b6d83,null))[_0x6b08('0x24')](handleError(_0x3b6d83,null));};exports['getFields']=function(_0x7964e,_0x350770,_0x299fc2){var _0xc90ec8={};var _0xb3fb28={};var _0x58035f;var _0x1d9d15;return db['SugarcrmConfiguration'][_0x6b08('0x52')]({'where':{'id':_0x7964e[_0x6b08('0x4d')]['id']}})['then'](handleEntityNotFound(_0x350770,null))['then'](function(_0x17a21d){if(_0x17a21d){_0x58035f=_0x17a21d;_0xb3fb28[_0x6b08('0x36')]=_['keys'](db[_0x6b08('0x53')][_0x6b08('0x35')]);_0xb3fb28[_0x6b08('0x38')]=_[_0x6b08('0x37')](_0x7964e[_0x6b08('0x38')]);_0xb3fb28[_0x6b08('0x39')]=_[_0x6b08('0x3a')](_0xb3fb28[_0x6b08('0x36')],_0xb3fb28[_0x6b08('0x38')]);_0xc90ec8[_0x6b08('0x3b')]=_[_0x6b08('0x3a')](_0xb3fb28['model'],qs[_0x6b08('0x3c')](_0x7964e['query'][_0x6b08('0x3c')]));_0xc90ec8[_0x6b08('0x3b')]=_0xc90ec8[_0x6b08('0x3b')]['length']?_0xc90ec8[_0x6b08('0x3b')]:_0xb3fb28[_0x6b08('0x36')];_0xc90ec8[_0x6b08('0x40')]=qs[_0x6b08('0x54')](_0x7964e['query'][_0x6b08('0x54')]);_0xc90ec8['where']=qs['filters'](_[_0x6b08('0x42')](_0x7964e[_0x6b08('0x38')],_0xb3fb28[_0x6b08('0x39')]));if(_0x7964e[_0x6b08('0x38')]['filter']){_0xc90ec8[_0x6b08('0x41')]=_[_0x6b08('0x43')](_0xc90ec8[_0x6b08('0x41')],{'$or':_[_0x6b08('0x55')](_0xc90ec8[_0x6b08('0x3b')],function(_0x1f2983){var _0x3bc024={};_0x3bc024[_0x1f2983]={'$like':'%'+_0x7964e['query']['filter']+'%'};return _0x3bc024;})});}_0xc90ec8=_[_0x6b08('0x43')]({},_0xc90ec8,_0x7964e[_0x6b08('0x48')]);return _0x58035f[_0x6b08('0x56')](_0xc90ec8);}})[_0x6b08('0x1a')](function(_0x548184){if(_0x548184){_0x1d9d15=_0x548184[_0x6b08('0x3d')];if(!_0x7964e[_0x6b08('0x38')][_0x6b08('0x3e')](_0x6b08('0x3f'))){_0xc90ec8[_0x6b08('0x2a')]=qs['limit'](_0x7964e[_0x6b08('0x38')][_0x6b08('0x2a')]);_0xc90ec8[_0x6b08('0x29')]=qs['offset'](_0x7964e[_0x6b08('0x38')][_0x6b08('0x29')]);}return _0x58035f[_0x6b08('0x56')](_0xc90ec8);}})['then'](function(_0x5b9086){if(_0x5b9086){return _0x5b9086?{'count':_0x1d9d15,'rows':_0x5b9086}:null;}})[_0x6b08('0x1a')](respondWithResult(_0x350770,null))['catch'](handleError(_0x350770,null));};exports[_0x6b08('0x57')]=function(_0x54393e,_0x1c1324,_0x1d81a4){var _0x2471c1={};var _0x326e60={};var _0x1e4778;var _0xb3ba41;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x54393e['params']['id']}})[_0x6b08('0x1a')](handleEntityNotFound(_0x1c1324,null))[_0x6b08('0x1a')](function(_0x5a51ce){if(_0x5a51ce){_0x1e4778=_0x5a51ce;_0x326e60[_0x6b08('0x36')]=_[_0x6b08('0x37')](db[_0x6b08('0x53')]['rawAttributes']);_0x326e60[_0x6b08('0x38')]=_['keys'](_0x54393e['query']);_0x326e60[_0x6b08('0x39')]=_['intersection'](_0x326e60[_0x6b08('0x36')],_0x326e60[_0x6b08('0x38')]);_0x2471c1[_0x6b08('0x3b')]=_['intersection'](_0x326e60[_0x6b08('0x36')],qs['fields'](_0x54393e[_0x6b08('0x38')][_0x6b08('0x3c')]));_0x2471c1[_0x6b08('0x3b')]=_0x2471c1[_0x6b08('0x3b')]['length']?_0x2471c1[_0x6b08('0x3b')]:_0x326e60[_0x6b08('0x36')];_0x2471c1[_0x6b08('0x40')]=qs[_0x6b08('0x54')](_0x54393e[_0x6b08('0x38')]['sort']);_0x2471c1[_0x6b08('0x41')]=qs[_0x6b08('0x39')](_[_0x6b08('0x42')](_0x54393e[_0x6b08('0x38')],_0x326e60[_0x6b08('0x39')]));if(_0x54393e[_0x6b08('0x38')][_0x6b08('0x47')]){_0x2471c1[_0x6b08('0x41')]=_[_0x6b08('0x43')](_0x2471c1[_0x6b08('0x41')],{'$or':_[_0x6b08('0x55')](_0x2471c1['attributes'],function(_0x51620e){var _0xe1400b={};_0xe1400b[_0x51620e]={'$like':'%'+_0x54393e[_0x6b08('0x38')][_0x6b08('0x47')]+'%'};return _0xe1400b;})});}_0x2471c1=_[_0x6b08('0x43')]({},_0x2471c1,_0x54393e['options']);return _0x1e4778[_0x6b08('0x57')](_0x2471c1);}})[_0x6b08('0x1a')](function(_0x25415a){if(_0x25415a){_0xb3ba41=_0x25415a['length'];if(!_0x54393e[_0x6b08('0x38')][_0x6b08('0x3e')](_0x6b08('0x3f'))){_0x2471c1['limit']=qs[_0x6b08('0x2a')](_0x54393e[_0x6b08('0x38')][_0x6b08('0x2a')]);_0x2471c1[_0x6b08('0x29')]=qs['offset'](_0x54393e[_0x6b08('0x38')][_0x6b08('0x29')]);}return _0x1e4778['getSubjects'](_0x2471c1);}})[_0x6b08('0x1a')](function(_0x176b49){if(_0x176b49){return _0x176b49?{'count':_0xb3ba41,'rows':_0x176b49}:null;}})['then'](respondWithResult(_0x1c1324,null))[_0x6b08('0x24')](handleError(_0x1c1324,null));};exports[_0x6b08('0x58')]=function(_0x5129be,_0x5da797,_0x431503){var _0x1a06ca={};var _0x23f44c={};var _0x26d032;var _0x14a54a;return db[_0x6b08('0x34')][_0x6b08('0x52')]({'where':{'id':_0x5129be[_0x6b08('0x4d')]['id']}})[_0x6b08('0x1a')](handleEntityNotFound(_0x5da797,null))[_0x6b08('0x1a')](function(_0x269004){if(_0x269004){_0x26d032=_0x269004;_0x23f44c[_0x6b08('0x36')]=_[_0x6b08('0x37')](db[_0x6b08('0x53')][_0x6b08('0x35')]);_0x23f44c[_0x6b08('0x38')]=_[_0x6b08('0x37')](_0x5129be['query']);_0x23f44c[_0x6b08('0x39')]=_[_0x6b08('0x3a')](_0x23f44c[_0x6b08('0x36')],_0x23f44c[_0x6b08('0x38')]);_0x1a06ca[_0x6b08('0x3b')]=_[_0x6b08('0x3a')](_0x23f44c[_0x6b08('0x36')],qs['fields'](_0x5129be[_0x6b08('0x38')][_0x6b08('0x3c')]));_0x1a06ca[_0x6b08('0x3b')]=_0x1a06ca[_0x6b08('0x3b')]['length']?_0x1a06ca[_0x6b08('0x3b')]:_0x23f44c['model'];_0x1a06ca['order']=qs[_0x6b08('0x54')](_0x5129be['query'][_0x6b08('0x54')]);_0x1a06ca[_0x6b08('0x41')]=qs[_0x6b08('0x39')](_[_0x6b08('0x42')](_0x5129be[_0x6b08('0x38')],_0x23f44c[_0x6b08('0x39')]));if(_0x5129be['query']['filter']){_0x1a06ca[_0x6b08('0x41')]=_[_0x6b08('0x43')](_0x1a06ca[_0x6b08('0x41')],{'$or':_[_0x6b08('0x55')](_0x1a06ca['attributes'],function(_0x2cc1c0){var _0x5659e1={};_0x5659e1[_0x2cc1c0]={'$like':'%'+_0x5129be[_0x6b08('0x38')][_0x6b08('0x47')]+'%'};return _0x5659e1;})});}_0x1a06ca=_['merge']({},_0x1a06ca,_0x5129be[_0x6b08('0x48')]);return _0x26d032['getDescriptions'](_0x1a06ca);}})[_0x6b08('0x1a')](function(_0x243244){if(_0x243244){_0x14a54a=_0x243244['length'];if(!_0x5129be[_0x6b08('0x38')]['hasOwnProperty'](_0x6b08('0x3f'))){_0x1a06ca['limit']=qs[_0x6b08('0x2a')](_0x5129be['query'][_0x6b08('0x2a')]);_0x1a06ca[_0x6b08('0x29')]=qs['offset'](_0x5129be[_0x6b08('0x38')][_0x6b08('0x29')]);}return _0x26d032[_0x6b08('0x58')](_0x1a06ca);}})[_0x6b08('0x1a')](function(_0x2873df){if(_0x2873df){return _0x2873df?{'count':_0x14a54a,'rows':_0x2873df}:null;}})[_0x6b08('0x1a')](respondWithResult(_0x5da797,null))[_0x6b08('0x24')](handleError(_0x5da797,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 44b694d..66ce3ee 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 _0x6ebe=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x2e8512,_0x264cb1){var _0x318355=function(_0x347156){while(--_0x347156){_0x2e8512['push'](_0x2e8512['shift']());}};_0x318355(++_0x264cb1);}(_0x6ebe,0x19f));var _0xe6eb=function(_0x2160bc,_0x417d34){_0x2160bc=_0x2160bc-0x0;var _0xb81542=_0x6ebe[_0x2160bc];return _0xb81542;};'use strict';var _=require(_0xe6eb('0x0'));var util=require(_0xe6eb('0x1'));var logger=require(_0xe6eb('0x2'))(_0xe6eb('0x3'));var moment=require('moment');var BPromise=require(_0xe6eb('0x4'));var rp=require(_0xe6eb('0x5'));var fs=require('fs');var path=require(_0xe6eb('0x6'));var rimraf=require(_0xe6eb('0x7'));var config=require(_0xe6eb('0x8'));var attributes=require(_0xe6eb('0x9'));module[_0xe6eb('0xa')]=function(_0x1f99eb,_0x224a32){return _0x1f99eb[_0xe6eb('0xb')](_0xe6eb('0xc'),attributes,{'tableName':_0xe6eb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3406=['int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','exports','define','SugarcrmConfiguration'];(function(_0x4b5f64,_0x5993b8){var _0x17b254=function(_0xc7c934){while(--_0xc7c934){_0x4b5f64['push'](_0x4b5f64['shift']());}};_0x17b254(++_0x5993b8);}(_0x3406,0x119));var _0x6340=function(_0x36debe,_0xa2f296){_0x36debe=_0x36debe-0x0;var _0x503055=_0x3406[_0x36debe];return _0x503055;};'use strict';var _=require(_0x6340('0x0'));var util=require('util');var logger=require(_0x6340('0x1'))(_0x6340('0x2'));var moment=require('moment');var BPromise=require(_0x6340('0x3'));var rp=require(_0x6340('0x4'));var fs=require('fs');var path=require(_0x6340('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x6340('0x6')]=function(_0x8adb72,_0x50916d){return _0x8adb72[_0x6340('0x7')](_0x6340('0x8'),attributes,{'tableName':_0x6340('0x9'),'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 6223275..86d44b1 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 _0xf276=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3bdaaf,_0x4e8aae){var _0x3478a6=function(_0x2e158c){while(--_0x2e158c){_0x3bdaaf['push'](_0x3bdaaf['shift']());}};_0x3478a6(++_0x4e8aae);}(_0xf276,0x199));var _0x6f27=function(_0x4733d6,_0x3621e2){_0x4733d6=_0x4733d6-0x0;var _0x2d7781=_0xf276[_0x4733d6];return _0x2d7781;};'use strict';var _=require('lodash');var util=require(_0x6f27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f27('0x1'));var fs=require('fs');var Redis=require(_0x6f27('0x2'));var db=require(_0x6f27('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f27('0x4'))(_0x6f27('0x5'));var config=require(_0x6f27('0x6'));var jayson=require(_0x6f27('0x7'));var client=jayson[_0x6f27('0x8')][_0x6f27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b5904,_0x3bdce0,_0x6d9541){return new BPromise(function(_0x5ca07a,_0x20ff36){return client[_0x6f27('0xa')](_0x5b5904,_0x6d9541)[_0x6f27('0xb')](function(_0x5ad5f7){logger[_0x6f27('0xc')](_0x6f27('0xd'),_0x3bdce0,'request\x20sent');logger[_0x6f27('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3bdce0,_0x6f27('0xf'),JSON[_0x6f27('0x10')](_0x5ad5f7));if(_0x5ad5f7['error']){if(_0x5ad5f7[_0x6f27('0x11')][_0x6f27('0x12')]===0x1f4){logger[_0x6f27('0x11')](_0x6f27('0xd'),_0x3bdce0,_0x5ad5f7[_0x6f27('0x11')][_0x6f27('0x13')]);return _0x20ff36(_0x5ad5f7[_0x6f27('0x11')][_0x6f27('0x13')]);}logger[_0x6f27('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bdce0,_0x5ad5f7[_0x6f27('0x11')][_0x6f27('0x13')]);return _0x5ca07a(_0x5ad5f7[_0x6f27('0x11')][_0x6f27('0x13')]);}else{logger[_0x6f27('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bdce0,_0x6f27('0xf'));_0x5ca07a(_0x5ad5f7[_0x6f27('0x14')][_0x6f27('0x13')]);}})[_0x6f27('0x15')](function(_0x2d775e){logger[_0x6f27('0x11')](_0x6f27('0xd'),_0x3bdce0,_0x2d775e);_0x20ff36(_0x2d775e);});});} \ No newline at end of file +var _0xeeb7=['http','request','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xeeb7,0xab));var _0x7eeb=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xeeb7[_0x148c09];return _0x18e613;};'use strict';var _=require('lodash');var util=require(_0x7eeb('0x0'));var moment=require('moment');var BPromise=require(_0x7eeb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eeb('0x2'));var db=require(_0x7eeb('0x3'))['db'];var utils=require(_0x7eeb('0x4'));var logger=require(_0x7eeb('0x5'))('rpc');var config=require(_0x7eeb('0x6'));var jayson=require(_0x7eeb('0x7'));var client=jayson[_0x7eeb('0x8')][_0x7eeb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53ec83,_0x29b311,_0x30aa10){return new BPromise(function(_0x4e803e,_0xf7dbc){return client[_0x7eeb('0xa')](_0x53ec83,_0x30aa10)['then'](function(_0x491c29){logger[_0x7eeb('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x29b311,_0x7eeb('0xc'));logger[_0x7eeb('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x29b311,_0x7eeb('0xc'),JSON[_0x7eeb('0xe')](_0x491c29));if(_0x491c29[_0x7eeb('0xf')]){if(_0x491c29[_0x7eeb('0xf')][_0x7eeb('0x10')]===0x1f4){logger[_0x7eeb('0xf')](_0x7eeb('0x11'),_0x29b311,_0x491c29['error']['message']);return _0xf7dbc(_0x491c29['error']['message']);}logger['error'](_0x7eeb('0x11'),_0x29b311,_0x491c29['error'][_0x7eeb('0x12')]);return _0x4e803e(_0x491c29[_0x7eeb('0xf')][_0x7eeb('0x12')]);}else{logger[_0x7eeb('0xb')](_0x7eeb('0x11'),_0x29b311,'request\x20sent');_0x4e803e(_0x491c29[_0x7eeb('0x13')][_0x7eeb('0x12')]);}})['catch'](function(_0x5732c4){logger[_0x7eeb('0xf')](_0x7eeb('0x11'),_0x29b311,_0x5732c4);_0xf7dbc(_0x5732c4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e869508..a6c84a0 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 _0xf628=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x437339,_0x5ef32b){var _0x3b4c70=function(_0x227cab){while(--_0x227cab){_0x437339['push'](_0x437339['shift']());}};_0x3b4c70(++_0x5ef32b);}(_0xf628,0xa9));var _0x8f62=function(_0x5767d4,_0x537518){_0x5767d4=_0x5767d4-0x0;var _0x1fac9b=_0xf628[_0x5767d4];return _0x1fac9b;};'use strict';var multer=require(_0x8f62('0x0'));var util=require(_0x8f62('0x1'));var path=require(_0x8f62('0x2'));var timeout=require(_0x8f62('0x3'));var express=require(_0x8f62('0x4'));var router=express['Router']();var auth=require(_0x8f62('0x5'));var interaction=require(_0x8f62('0x6'));var config=require(_0x8f62('0x7'));var controller=require(_0x8f62('0x8'));router[_0x8f62('0x9')]('/',auth[_0x8f62('0xa')](),controller['index']);router[_0x8f62('0x9')]('/:id',auth[_0x8f62('0xa')](),controller[_0x8f62('0xb')]);router[_0x8f62('0xc')]('/',auth[_0x8f62('0xa')](),controller[_0x8f62('0xd')]);router[_0x8f62('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8f62('0xf')]('/:id',auth[_0x8f62('0xa')](),controller[_0x8f62('0x10')]);module[_0x8f62('0x11')]=router; \ No newline at end of file +var _0x23ce=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','post','create','update','destroy'];(function(_0x18b7db,_0x568c13){var _0x4fef76=function(_0x5126c0){while(--_0x5126c0){_0x18b7db['push'](_0x18b7db['shift']());}};_0x4fef76(++_0x568c13);}(_0x23ce,0x161));var _0xe23c=function(_0x244770,_0x573542){_0x244770=_0x244770-0x0;var _0x40fba5=_0x23ce[_0x244770];return _0x40fba5;};'use strict';var multer=require('multer');var util=require(_0xe23c('0x0'));var path=require(_0xe23c('0x1'));var timeout=require(_0xe23c('0x2'));var express=require('express');var router=express[_0xe23c('0x3')]();var auth=require(_0xe23c('0x4'));var interaction=require(_0xe23c('0x5'));var config=require(_0xe23c('0x6'));var controller=require(_0xe23c('0x7'));router['get']('/',auth[_0xe23c('0x8')](),controller['index']);router[_0xe23c('0x9')](_0xe23c('0xa'),auth[_0xe23c('0x8')](),controller['show']);router[_0xe23c('0xb')]('/',auth[_0xe23c('0x8')](),controller[_0xe23c('0xc')]);router['put'](_0xe23c('0xa'),auth[_0xe23c('0x8')](),controller[_0xe23c('0xd')]);router['delete']('/:id',auth[_0xe23c('0x8')](),controller[_0xe23c('0xe')]);module[_0xe23c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index f92b5a0..6584d87 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 _0x13f6=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x2bcbcc,_0x17e3dd){var _0x593f1e=function(_0x215a52){while(--_0x215a52){_0x2bcbcc['push'](_0x2bcbcc['shift']());}};_0x593f1e(++_0x17e3dd);}(_0x13f6,0x124));var _0x613f=function(_0x364f4e,_0x56fa4a){_0x364f4e=_0x364f4e-0x0;var _0xa42cb0=_0x13f6[_0x364f4e];return _0xa42cb0;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x613f('0x2'),_0x613f('0x3'),_0x613f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x613f('0x5')]},'key':{'type':Sequelize[_0x613f('0x5')]},'keyType':{'type':Sequelize[_0x613f('0x6')]('string',_0x613f('0x2'),_0x613f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x613f('0x5')]}}; \ No newline at end of file +var _0x4ea3=['sequelize','exports','ENUM','string','customVariable','variable','STRING'];(function(_0x449723,_0x16e4aa){var _0x16dd8f=function(_0x581472){while(--_0x581472){_0x449723['push'](_0x449723['shift']());}};_0x16dd8f(++_0x16e4aa);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'type':{'type':Sequelize[_0x34ea('0x2')](_0x34ea('0x3'),'variable',_0x34ea('0x4'),'keyValue'),'defaultValue':_0x34ea('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x34ea('0x2')](_0x34ea('0x3'),_0x34ea('0x5'),_0x34ea('0x4'))},'keyContent':{'type':Sequelize[_0x34ea('0x6')]},'idField':{'type':Sequelize[_0x34ea('0x6')]},'nameField':{'type':Sequelize[_0x34ea('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x34ea('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c1ae021..ca4e0e3 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 _0x6201=['find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','destroy','then','end','error','stack','name','index','SugarcrmField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','create','body','update'];(function(_0x894798,_0x1e1e12){var _0x4f561e=function(_0x1423ae){while(--_0x1423ae){_0x894798['push'](_0x894798['shift']());}};_0x4f561e(++_0x1e1e12);}(_0x6201,0x169));var _0x1620=function(_0x1bf2b2,_0x3a065e){_0x1bf2b2=_0x1bf2b2-0x0;var _0xa57f43=_0x6201[_0x1bf2b2];return _0xa57f43;};'use strict';var pdf=require(_0x1620('0x0'));var emlformat=require(_0x1620('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1620('0x2'));var jsonpatch=require(_0x1620('0x3'));var rp=require('request-promise');var moment=require(_0x1620('0x4'));var BPromise=require(_0x1620('0x5'));var Mustache=require(_0x1620('0x6'));var util=require(_0x1620('0x7'));var path=require(_0x1620('0x8'));var sox=require(_0x1620('0x9'));var csv=require(_0x1620('0xa'));var ejs=require(_0x1620('0xb'));var fs=require('fs');var _=require(_0x1620('0xc'));var squel=require(_0x1620('0xd'));var crypto=require(_0x1620('0xe'));var jsforce=require(_0x1620('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1620('0xa'));var querystring=require(_0x1620('0x10'));var Papa=require('papaparse');var Redis=require(_0x1620('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1620('0x12'));var hardwareService=require(_0x1620('0x13'));var logger=require(_0x1620('0x14'))('api');var utils=require(_0x1620('0x15'));var config=require(_0x1620('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a81b1,_0x36c3be){_0x36c3be=_0x36c3be||0xcc;return function(_0x1ec433){if(_0x1ec433){return _0x1a81b1[_0x1620('0x17')](_0x36c3be);}return _0x1a81b1['status'](_0x36c3be)['end']();};}function respondWithResult(_0x1ac8b3,_0x44b9de){_0x44b9de=_0x44b9de||0xc8;return function(_0x110ebc){if(_0x110ebc){return _0x1ac8b3[_0x1620('0x18')](_0x44b9de)['json'](_0x110ebc);}};}function respondWithFilteredResult(_0x34e9b9,_0x1e4c85){return function(_0x429af8){if(_0x429af8){var _0x5a7be8=_0x429af8[_0x1620('0x19')],_0x75d293=_0x1e4c85[_0x1620('0x1a')],_0x719746=_0x1e4c85[_0x1620('0x1a')]+_0x1e4c85[_0x1620('0x1b')],_0x35cae8;if(_0x719746>=_0x5a7be8){_0x719746=_0x5a7be8;_0x35cae8=0xc8;}else{_0x35cae8=0xce;}_0x34e9b9[_0x1620('0x18')](_0x35cae8);return _0x34e9b9[_0x1620('0x1c')](_0x1620('0x1d'),_0x75d293+'-'+_0x719746+'/'+_0x5a7be8)[_0x1620('0x1e')](_0x429af8);}return null;};}function patchUpdates(_0x1f95c7){return function(_0x2a46c0){try{jsonpatch[_0x1620('0x1f')](_0x2a46c0,_0x1f95c7,!![]);}catch(_0x477902){return BPromise['reject'](_0x477902);}return _0x2a46c0[_0x1620('0x20')]();};}function saveUpdates(_0x1694eb,_0xcb69c7){return function(_0x198798){if(_0x198798){return _0x198798['update'](_0x1694eb)['then'](function(_0x26d50c){return _0x26d50c;});}return null;};}function removeEntity(_0x51720e,_0x3a0df1){return function(_0x7e13ea){if(_0x7e13ea){return _0x7e13ea[_0x1620('0x21')]()[_0x1620('0x22')](function(){_0x51720e[_0x1620('0x18')](0xcc)[_0x1620('0x23')]();});}};}function handleEntityNotFound(_0x4fe8b6,_0x1e7816){return function(_0x4dd6b3){if(!_0x4dd6b3){_0x4fe8b6[_0x1620('0x17')](0x194);}return _0x4dd6b3;};}function handleError(_0x441d38,_0x190e96){_0x190e96=_0x190e96||0x1f4;return function(_0x5b9493){logger[_0x1620('0x24')](_0x5b9493[_0x1620('0x25')]);if(_0x5b9493[_0x1620('0x26')]){delete _0x5b9493[_0x1620('0x26')];}_0x441d38['status'](_0x190e96)['send'](_0x5b9493);};}exports[_0x1620('0x27')]=function(_0x39b9ec,_0x5c1d7f){var _0x469832={},_0x1c7e0d={},_0x26b365={'count':0x0,'rows':[]};var _0x2d4840=db[_0x1620('0x28')][_0x1620('0x29')];_0x1c7e0d[_0x1620('0x2a')]=_[_0x1620('0x2b')](_0x2d4840);_0x1c7e0d[_0x1620('0x2c')]=_[_0x1620('0x2b')](_0x39b9ec[_0x1620('0x2c')]);_0x1c7e0d[_0x1620('0x2d')]=_[_0x1620('0x2e')](_0x1c7e0d[_0x1620('0x2a')],_0x1c7e0d[_0x1620('0x2c')]);_0x469832[_0x1620('0x2f')]=_['intersection'](_0x1c7e0d[_0x1620('0x2a')],qs[_0x1620('0x30')](_0x39b9ec['query'][_0x1620('0x30')]));_0x469832['attributes']=_0x469832['attributes'][_0x1620('0x31')]?_0x469832[_0x1620('0x2f')]:_0x1c7e0d[_0x1620('0x2a')];if(!_0x39b9ec['query']['hasOwnProperty'](_0x1620('0x32'))){_0x469832[_0x1620('0x1b')]=qs[_0x1620('0x1b')](_0x39b9ec[_0x1620('0x2c')]['limit']);_0x469832[_0x1620('0x1a')]=qs[_0x1620('0x1a')](_0x39b9ec['query']['offset']);}_0x469832[_0x1620('0x33')]=qs[_0x1620('0x34')](_0x39b9ec[_0x1620('0x2c')][_0x1620('0x34')]);_0x469832[_0x1620('0x35')]=qs[_0x1620('0x2d')](_[_0x1620('0x36')](_0x39b9ec['query'],_0x1c7e0d[_0x1620('0x2d')]));if(_0x39b9ec[_0x1620('0x2c')][_0x1620('0x37')]){_0x469832['where']=_[_0x1620('0x38')](_0x469832[_0x1620('0x35')],{'$or':_[_0x1620('0x39')](_0x2d4840,function(_0x3369f6){if(_0x3369f6['type'][_0x1620('0x3a')]!==_0x1620('0x3b')){var _0x451e28={};_0x451e28[_0x3369f6[_0x1620('0x3c')]]={'$like':'%'+_0x39b9ec[_0x1620('0x2c')][_0x1620('0x37')]+'%'};return _0x451e28;}})});}_0x469832=_[_0x1620('0x38')]({},_0x469832,_0x39b9ec[_0x1620('0x3d')]);var _0x13940b={'where':_0x469832[_0x1620('0x35')]};return db[_0x1620('0x28')]['count'](_0x13940b)[_0x1620('0x22')](function(_0x380453){_0x26b365[_0x1620('0x19')]=_0x380453;if(_0x39b9ec[_0x1620('0x2c')][_0x1620('0x3e')]){_0x469832[_0x1620('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x1620('0x40')](_0x469832);})[_0x1620('0x22')](function(_0x275689){_0x26b365[_0x1620('0x41')]=_0x275689;return _0x26b365;})[_0x1620('0x22')](respondWithFilteredResult(_0x5c1d7f,_0x469832))[_0x1620('0x42')](handleError(_0x5c1d7f,null));};exports['show']=function(_0x56f677,_0x35083b){var _0x4dcdc6={'raw':!![],'where':{'id':_0x56f677[_0x1620('0x43')]['id']}},_0x51bbcc={};_0x51bbcc[_0x1620('0x2a')]=_[_0x1620('0x2b')](db[_0x1620('0x28')][_0x1620('0x29')]);_0x51bbcc['query']=_[_0x1620('0x2b')](_0x56f677[_0x1620('0x2c')]);_0x51bbcc[_0x1620('0x2d')]=_[_0x1620('0x2e')](_0x51bbcc[_0x1620('0x2a')],_0x51bbcc[_0x1620('0x2c')]);_0x4dcdc6['attributes']=_[_0x1620('0x2e')](_0x51bbcc[_0x1620('0x2a')],qs[_0x1620('0x30')](_0x56f677[_0x1620('0x2c')][_0x1620('0x30')]));_0x4dcdc6[_0x1620('0x2f')]=_0x4dcdc6[_0x1620('0x2f')]['length']?_0x4dcdc6[_0x1620('0x2f')]:_0x51bbcc[_0x1620('0x2a')];if(_0x56f677[_0x1620('0x2c')][_0x1620('0x3e')]){_0x4dcdc6[_0x1620('0x3f')]=[{'all':!![]}];}_0x4dcdc6=_[_0x1620('0x38')]({},_0x4dcdc6,_0x56f677[_0x1620('0x3d')]);return db['SugarcrmField']['find'](_0x4dcdc6)[_0x1620('0x22')](handleEntityNotFound(_0x35083b,null))['then'](respondWithResult(_0x35083b,null))[_0x1620('0x42')](handleError(_0x35083b,null));};exports[_0x1620('0x44')]=function(_0x169ba3,_0x5a9212){return db[_0x1620('0x28')][_0x1620('0x44')](_0x169ba3[_0x1620('0x45')],{})['then'](respondWithResult(_0x5a9212,0xc9))['catch'](handleError(_0x5a9212,null));};exports[_0x1620('0x46')]=function(_0xa185,_0x593385){if(_0xa185['body']['id']){delete _0xa185[_0x1620('0x45')]['id'];}return db[_0x1620('0x28')][_0x1620('0x47')]({'where':{'id':_0xa185[_0x1620('0x43')]['id']}})[_0x1620('0x22')](handleEntityNotFound(_0x593385,null))[_0x1620('0x22')](saveUpdates(_0xa185[_0x1620('0x45')],null))[_0x1620('0x22')](respondWithResult(_0x593385,null))[_0x1620('0x42')](handleError(_0x593385,null));};exports['destroy']=function(_0x272bd9,_0x2ffa9f){return db[_0x1620('0x28')]['find']({'where':{'id':_0x272bd9['params']['id']}})[_0x1620('0x22')](handleEntityNotFound(_0x2ffa9f,null))[_0x1620('0x22')](removeEntity(_0x2ffa9f,null))[_0x1620('0x42')](handleError(_0x2ffa9f,null));}; \ No newline at end of file +var _0x7969=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','map','key','VIRTUAL','field','options','count','includeAll','include','SugarcrmField','findAll','rows','params','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7969,0x14c));var _0x9796=function(_0x432ef2,_0x309f5e){_0x432ef2=_0x432ef2-0x0;var _0x4efda6=_0x7969[_0x432ef2];return _0x4efda6;};'use strict';var pdf=require(_0x9796('0x0'));var emlformat=require(_0x9796('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9796('0x2'));var jsonpatch=require(_0x9796('0x3'));var rp=require(_0x9796('0x4'));var moment=require(_0x9796('0x5'));var BPromise=require(_0x9796('0x6'));var Mustache=require('mustache');var util=require(_0x9796('0x7'));var path=require(_0x9796('0x8'));var sox=require(_0x9796('0x9'));var csv=require(_0x9796('0xa'));var ejs=require(_0x9796('0xb'));var fs=require('fs');var _=require(_0x9796('0xc'));var squel=require(_0x9796('0xd'));var crypto=require(_0x9796('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9796('0xf'));var Redis=require(_0x9796('0x10'));var authService=require(_0x9796('0x11'));var qs=require(_0x9796('0x12'));var hardwareService=require(_0x9796('0x13'));var logger=require(_0x9796('0x14'))(_0x9796('0x15'));var utils=require(_0x9796('0x16'));var config=require(_0x9796('0x17'));var db=require(_0x9796('0x18'))['db'];function respondWithStatusCode(_0x47b647,_0x121cd0){_0x121cd0=_0x121cd0||0xcc;return function(_0x176aa8){if(_0x176aa8){return _0x47b647['sendStatus'](_0x121cd0);}return _0x47b647[_0x9796('0x19')](_0x121cd0)[_0x9796('0x1a')]();};}function respondWithResult(_0x4fc5a8,_0x238c80){_0x238c80=_0x238c80||0xc8;return function(_0x9ec7b){if(_0x9ec7b){return _0x4fc5a8[_0x9796('0x19')](_0x238c80)['json'](_0x9ec7b);}};}function respondWithFilteredResult(_0x1bc1cf,_0x5c1b55){return function(_0x71af2c){if(_0x71af2c){var _0x31a576=_0x71af2c['count'],_0x1d52b8=_0x5c1b55['offset'],_0x2c3d24=_0x5c1b55[_0x9796('0x1b')]+_0x5c1b55['limit'],_0x533bff;if(_0x2c3d24>=_0x31a576){_0x2c3d24=_0x31a576;_0x533bff=0xc8;}else{_0x533bff=0xce;}_0x1bc1cf[_0x9796('0x19')](_0x533bff);return _0x1bc1cf[_0x9796('0x1c')](_0x9796('0x1d'),_0x1d52b8+'-'+_0x2c3d24+'/'+_0x31a576)['json'](_0x71af2c);}return null;};}function patchUpdates(_0x10f9a9){return function(_0x14e4c0){try{jsonpatch['apply'](_0x14e4c0,_0x10f9a9,!![]);}catch(_0x53f4ce){return BPromise[_0x9796('0x1e')](_0x53f4ce);}return _0x14e4c0[_0x9796('0x1f')]();};}function saveUpdates(_0x256fcb,_0x972d46){return function(_0x593ca0){if(_0x593ca0){return _0x593ca0[_0x9796('0x20')](_0x256fcb)[_0x9796('0x21')](function(_0x186df6){return _0x186df6;});}return null;};}function removeEntity(_0x451d04,_0x435d52){return function(_0x1ec4b8){if(_0x1ec4b8){return _0x1ec4b8[_0x9796('0x22')]()['then'](function(){_0x451d04['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ce48,_0x1a460f){return function(_0x3fa637){if(!_0x3fa637){_0x35ce48['sendStatus'](0x194);}return _0x3fa637;};}function handleError(_0x19b760,_0x260e88){_0x260e88=_0x260e88||0x1f4;return function(_0x24521f){logger['error'](_0x24521f[_0x9796('0x23')]);if(_0x24521f[_0x9796('0x24')]){delete _0x24521f[_0x9796('0x24')];}_0x19b760[_0x9796('0x19')](_0x260e88)['send'](_0x24521f);};}exports[_0x9796('0x25')]=function(_0x4d09ea,_0x146960){var _0x159ec4={},_0x207420={},_0x56f167={'count':0x0,'rows':[]};var _0x274b9a=db['SugarcrmField'][_0x9796('0x26')];_0x207420[_0x9796('0x27')]=_['keys'](_0x274b9a);_0x207420[_0x9796('0x28')]=_[_0x9796('0x29')](_0x4d09ea[_0x9796('0x28')]);_0x207420[_0x9796('0x2a')]=_[_0x9796('0x2b')](_0x207420[_0x9796('0x27')],_0x207420['query']);_0x159ec4[_0x9796('0x2c')]=_[_0x9796('0x2b')](_0x207420[_0x9796('0x27')],qs[_0x9796('0x2d')](_0x4d09ea[_0x9796('0x28')][_0x9796('0x2d')]));_0x159ec4[_0x9796('0x2c')]=_0x159ec4[_0x9796('0x2c')][_0x9796('0x2e')]?_0x159ec4[_0x9796('0x2c')]:_0x207420[_0x9796('0x27')];if(!_0x4d09ea[_0x9796('0x28')][_0x9796('0x2f')](_0x9796('0x30'))){_0x159ec4[_0x9796('0x31')]=qs['limit'](_0x4d09ea[_0x9796('0x28')][_0x9796('0x31')]);_0x159ec4[_0x9796('0x1b')]=qs[_0x9796('0x1b')](_0x4d09ea[_0x9796('0x28')]['offset']);}_0x159ec4['order']=qs[_0x9796('0x32')](_0x4d09ea[_0x9796('0x28')]['sort']);_0x159ec4[_0x9796('0x33')]=qs['filters'](_['pick'](_0x4d09ea[_0x9796('0x28')],_0x207420[_0x9796('0x2a')]));if(_0x4d09ea[_0x9796('0x28')][_0x9796('0x34')]){_0x159ec4[_0x9796('0x33')]=_[_0x9796('0x35')](_0x159ec4['where'],{'$or':_[_0x9796('0x36')](_0x274b9a,function(_0x362b07){if(_0x362b07['type'][_0x9796('0x37')]!==_0x9796('0x38')){var _0x4490a2={};_0x4490a2[_0x362b07[_0x9796('0x39')]]={'$like':'%'+_0x4d09ea[_0x9796('0x28')][_0x9796('0x34')]+'%'};return _0x4490a2;}})});}_0x159ec4=_[_0x9796('0x35')]({},_0x159ec4,_0x4d09ea[_0x9796('0x3a')]);var _0x4c8fe5={'where':_0x159ec4[_0x9796('0x33')]};return db['SugarcrmField']['count'](_0x4c8fe5)['then'](function(_0x2bbb27){_0x56f167[_0x9796('0x3b')]=_0x2bbb27;if(_0x4d09ea[_0x9796('0x28')][_0x9796('0x3c')]){_0x159ec4[_0x9796('0x3d')]=[{'all':!![]}];}return db[_0x9796('0x3e')][_0x9796('0x3f')](_0x159ec4);})[_0x9796('0x21')](function(_0x1f041a){_0x56f167[_0x9796('0x40')]=_0x1f041a;return _0x56f167;})['then'](respondWithFilteredResult(_0x146960,_0x159ec4))['catch'](handleError(_0x146960,null));};exports['show']=function(_0x326911,_0x14ebb7){var _0x59f4cf={'raw':!![],'where':{'id':_0x326911[_0x9796('0x41')]['id']}},_0x3f464a={};_0x3f464a[_0x9796('0x27')]=_[_0x9796('0x29')](db[_0x9796('0x3e')][_0x9796('0x26')]);_0x3f464a[_0x9796('0x28')]=_[_0x9796('0x29')](_0x326911[_0x9796('0x28')]);_0x3f464a[_0x9796('0x2a')]=_[_0x9796('0x2b')](_0x3f464a[_0x9796('0x27')],_0x3f464a[_0x9796('0x28')]);_0x59f4cf['attributes']=_[_0x9796('0x2b')](_0x3f464a[_0x9796('0x27')],qs[_0x9796('0x2d')](_0x326911['query'][_0x9796('0x2d')]));_0x59f4cf[_0x9796('0x2c')]=_0x59f4cf[_0x9796('0x2c')][_0x9796('0x2e')]?_0x59f4cf[_0x9796('0x2c')]:_0x3f464a[_0x9796('0x27')];if(_0x326911[_0x9796('0x28')][_0x9796('0x3c')]){_0x59f4cf[_0x9796('0x3d')]=[{'all':!![]}];}_0x59f4cf=_[_0x9796('0x35')]({},_0x59f4cf,_0x326911[_0x9796('0x3a')]);return db[_0x9796('0x3e')][_0x9796('0x42')](_0x59f4cf)['then'](handleEntityNotFound(_0x14ebb7,null))['then'](respondWithResult(_0x14ebb7,null))[_0x9796('0x43')](handleError(_0x14ebb7,null));};exports[_0x9796('0x44')]=function(_0x694a39,_0xcb3b46){return db[_0x9796('0x3e')]['create'](_0x694a39['body'],{})[_0x9796('0x21')](respondWithResult(_0xcb3b46,0xc9))[_0x9796('0x43')](handleError(_0xcb3b46,null));};exports[_0x9796('0x20')]=function(_0x3bdecd,_0x3f8a9d){if(_0x3bdecd['body']['id']){delete _0x3bdecd[_0x9796('0x45')]['id'];}return db[_0x9796('0x3e')][_0x9796('0x42')]({'where':{'id':_0x3bdecd[_0x9796('0x41')]['id']}})[_0x9796('0x21')](handleEntityNotFound(_0x3f8a9d,null))['then'](saveUpdates(_0x3bdecd['body'],null))[_0x9796('0x21')](respondWithResult(_0x3f8a9d,null))[_0x9796('0x43')](handleError(_0x3f8a9d,null));};exports['destroy']=function(_0x27c855,_0x29fc92){return db[_0x9796('0x3e')]['find']({'where':{'id':_0x27c855[_0x9796('0x41')]['id']}})[_0x9796('0x21')](handleEntityNotFound(_0x29fc92,null))[_0x9796('0x21')](removeEntity(_0x29fc92,null))[_0x9796('0x43')](handleError(_0x29fc92,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 69fab74..eb315f4 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 _0x2181=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','FieldId','lodash','util'];(function(_0x1b8962,_0x4e44f0){var _0x593fb7=function(_0x4c5d38){while(--_0x4c5d38){_0x1b8962['push'](_0x1b8962['shift']());}};_0x593fb7(++_0x4e44f0);}(_0x2181,0x143));var _0x1218=function(_0x484e74,_0x4e62bd){_0x484e74=_0x484e74-0x0;var _0x2874fa=_0x2181[_0x484e74];return _0x2874fa;};'use strict';var _=require(_0x1218('0x0'));var util=require(_0x1218('0x1'));var logger=require(_0x1218('0x2'))(_0x1218('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1218('0x4'));var fs=require('fs');var path=require(_0x1218('0x5'));var rimraf=require(_0x1218('0x6'));var config=require(_0x1218('0x7'));var attributes=require(_0x1218('0x8'));module[_0x1218('0x9')]=function(_0x357ef4,_0x170c9a){return _0x357ef4['define'](_0x1218('0xa'),attributes,{'tableName':_0x1218('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x1218('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89ff=['bluebird','request-promise','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1c4525,_0x1097e6){var _0x21592f=function(_0x2a1811){while(--_0x2a1811){_0x1c4525['push'](_0x1c4525['shift']());}};_0x21592f(++_0x1097e6);}(_0x89ff,0x19b));var _0xf89f=function(_0x27638d,_0x4094db){_0x27638d=_0x27638d-0x0;var _0x35da35=_0x89ff[_0x27638d];return _0x35da35;};'use strict';var _=require(_0xf89f('0x0'));var util=require(_0xf89f('0x1'));var logger=require(_0xf89f('0x2'))(_0xf89f('0x3'));var moment=require(_0xf89f('0x4'));var BPromise=require(_0xf89f('0x5'));var rp=require(_0xf89f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf89f('0x7'));var config=require(_0xf89f('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xf89f('0x9')]=function(_0x4db0b4,_0x2e6984){return _0x4db0b4[_0xf89f('0xa')](_0xf89f('0xb'),attributes,{'tableName':_0xf89f('0xc'),'paranoid':![],'indexes':[{'name':_0xf89f('0xd'),'fields':[_0xf89f('0xe'),_0xf89f('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 4e7a69f..a41b941 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 _0xf34c=['stringify','code','error','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3c949b,_0x3f406e){var _0x2ea9ea=function(_0x32684f){while(--_0x32684f){_0x3c949b['push'](_0x3c949b['shift']());}};_0x2ea9ea(++_0x3f406e);}(_0xf34c,0x11f));var _0xcf34=function(_0x2815d8,_0x582baa){_0x2815d8=_0x2815d8-0x0;var _0x59fb7a=_0xf34c[_0x2815d8];return _0x59fb7a;};'use strict';var _=require(_0xcf34('0x0'));var util=require(_0xcf34('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf34('0x2'));var db=require(_0xcf34('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf34('0x4'))(_0xcf34('0x5'));var config=require(_0xcf34('0x6'));var jayson=require(_0xcf34('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee086,_0x176931,_0x379534){return new BPromise(function(_0x244e14,_0xfcd8f9){return client[_0xcf34('0x8')](_0x2ee086,_0x379534)[_0xcf34('0x9')](function(_0x5401f9){logger['info'](_0xcf34('0xa'),_0x176931,'request\x20sent');logger[_0xcf34('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x176931,_0xcf34('0xc'),JSON[_0xcf34('0xd')](_0x5401f9));if(_0x5401f9['error']){if(_0x5401f9['error'][_0xcf34('0xe')]===0x1f4){logger[_0xcf34('0xf')](_0xcf34('0xa'),_0x176931,_0x5401f9[_0xcf34('0xf')][_0xcf34('0x10')]);return _0xfcd8f9(_0x5401f9[_0xcf34('0xf')][_0xcf34('0x10')]);}logger[_0xcf34('0xf')](_0xcf34('0xa'),_0x176931,_0x5401f9['error']['message']);return _0x244e14(_0x5401f9['error'][_0xcf34('0x10')]);}else{logger[_0xcf34('0x11')](_0xcf34('0xa'),_0x176931,'request\x20sent');_0x244e14(_0x5401f9[_0xcf34('0x12')][_0xcf34('0x10')]);}})[_0xcf34('0x13')](function(_0xe09369){logger['error'](_0xcf34('0xa'),_0x176931,_0xe09369);_0xfcd8f9(_0xe09369);});});} \ No newline at end of file +var _0x07fd=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x260478,_0x2040a1){var _0x4048fb=function(_0x49b513){while(--_0x49b513){_0x260478['push'](_0x260478['shift']());}};_0x4048fb(++_0x2040a1);}(_0x07fd,0x13d));var _0xd07f=function(_0x155c12,_0x928a07){_0x155c12=_0x155c12-0x0;var _0x3d26f4=_0x07fd[_0x155c12];return _0x3d26f4;};'use strict';var _=require(_0xd07f('0x0'));var util=require(_0xd07f('0x1'));var moment=require('moment');var BPromise=require(_0xd07f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd07f('0x3'));var logger=require(_0xd07f('0x4'))('rpc');var config=require(_0xd07f('0x5'));var jayson=require(_0xd07f('0x6'));var client=jayson['client'][_0xd07f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b8cd1,_0x4f75d5,_0x47a086){return new BPromise(function(_0x19a8b9,_0x1d00c0){return client[_0xd07f('0x8')](_0x2b8cd1,_0x47a086)[_0xd07f('0x9')](function(_0x39bfa0){logger[_0xd07f('0xa')](_0xd07f('0xb'),_0x4f75d5,'request\x20sent');logger[_0xd07f('0xc')](_0xd07f('0xd'),_0x4f75d5,_0xd07f('0xe'),JSON[_0xd07f('0xf')](_0x39bfa0));if(_0x39bfa0['error']){if(_0x39bfa0[_0xd07f('0x10')][_0xd07f('0x11')]===0x1f4){logger[_0xd07f('0x10')](_0xd07f('0xb'),_0x4f75d5,_0x39bfa0['error'][_0xd07f('0x12')]);return _0x1d00c0(_0x39bfa0[_0xd07f('0x10')][_0xd07f('0x12')]);}logger['error'](_0xd07f('0xb'),_0x4f75d5,_0x39bfa0['error']['message']);return _0x19a8b9(_0x39bfa0[_0xd07f('0x10')][_0xd07f('0x12')]);}else{logger[_0xd07f('0xa')](_0xd07f('0xb'),_0x4f75d5,'request\x20sent');_0x19a8b9(_0x39bfa0['result'][_0xd07f('0x12')]);}})[_0xd07f('0x13')](function(_0x58f23d){logger[_0xd07f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4f75d5,_0x58f23d);_0x1d00c0(_0x58f23d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2fa6ca7..034e071 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 _0x296d=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c5bda,_0x14c1a2){var _0x42e76b=function(_0x3c417e){while(--_0x3c417e){_0x5c5bda['push'](_0x5c5bda['shift']());}};_0x42e76b(++_0x14c1a2);}(_0x296d,0x10a));var _0xd296=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x296d[_0x5af97c];return _0x3472ae;};'use strict';var multer=require(_0xd296('0x0'));var util=require(_0xd296('0x1'));var path=require(_0xd296('0x2'));var timeout=require(_0xd296('0x3'));var express=require(_0xd296('0x4'));var router=express[_0xd296('0x5')]();var auth=require(_0xd296('0x6'));var interaction=require(_0xd296('0x7'));var config=require(_0xd296('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xd296('0x9')]('/',auth[_0xd296('0xa')](),controller[_0xd296('0xb')]);router[_0xd296('0x9')](_0xd296('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd296('0xd'),auth[_0xd296('0xa')](),controller['getConfigurations']);router[_0xd296('0x9')]('/:id/fields',auth[_0xd296('0xa')](),controller['getFields']);router[_0xd296('0xe')]('/',auth[_0xd296('0xa')](),controller[_0xd296('0xf')]);router[_0xd296('0xe')](_0xd296('0xd'),auth[_0xd296('0xa')](),controller[_0xd296('0x10')]);router[_0xd296('0x11')](_0xd296('0xc'),auth[_0xd296('0xa')](),controller[_0xd296('0x12')]);router['delete'](_0xd296('0xc'),auth['isAuthenticated'](),controller[_0xd296('0x13')]);module[_0xd296('0x14')]=router; \ No newline at end of file +var _0xbe70=['post','create','put','delete','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x21370e,_0x1f3ffa){var _0x1c7618=function(_0x3f5452){while(--_0x3f5452){_0x21370e['push'](_0x21370e['shift']());}};_0x1c7618(++_0x1f3ffa);}(_0xbe70,0x71));var _0x0be7=function(_0xdaaae3,_0x3f3379){_0xdaaae3=_0xdaaae3-0x0;var _0x519d8d=_0xbe70[_0xdaaae3];return _0x519d8d;};'use strict';var multer=require(_0x0be7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0be7('0x1'));var express=require(_0x0be7('0x2'));var router=express['Router']();var auth=require(_0x0be7('0x3'));var interaction=require(_0x0be7('0x4'));var config=require('../../config/environment');var controller=require(_0x0be7('0x5'));router[_0x0be7('0x6')]('/',auth[_0x0be7('0x7')](),controller['index']);router[_0x0be7('0x6')](_0x0be7('0x8'),auth[_0x0be7('0x7')](),controller[_0x0be7('0x9')]);router[_0x0be7('0x6')](_0x0be7('0xa'),auth['isAuthenticated'](),controller[_0x0be7('0xb')]);router[_0x0be7('0x6')](_0x0be7('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x0be7('0xd')]('/',auth[_0x0be7('0x7')](),controller[_0x0be7('0xe')]);router[_0x0be7('0xd')](_0x0be7('0xa'),auth[_0x0be7('0x7')](),controller['addConfiguration']);router[_0x0be7('0xf')](_0x0be7('0x8'),auth[_0x0be7('0x7')](),controller['update']);router[_0x0be7('0x10')](_0x0be7('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x0be7('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 8b2406c..911e667 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 _0x888c=['STRING','HelpDesk','sequelize','exports'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x888c,0xd2));var _0xc888=function(_0x22229e,_0x99430f){_0x22229e=_0x22229e-0x0;var _0x2ffd96=_0x888c[_0x22229e];return _0x2ffd96;};'use strict';var Sequelize=require(_0xc888('0x0'));module[_0xc888('0x1')]={'name':{'type':Sequelize[_0xc888('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc888('0x2')]},'username':{'type':Sequelize[_0xc888('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc888('0x2')],'allowNull':![],'defaultValue':_0xc888('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc888('0x2')]},'accessKey':{'type':Sequelize[_0xc888('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0d1b=['STRING','HelpDesk','sequelize','exports'];(function(_0xfc219c,_0x561b52){var _0x3f1e88=function(_0x30d2b2){while(--_0x30d2b2){_0xfc219c['push'](_0xfc219c['shift']());}};_0x3f1e88(++_0x561b52);}(_0x0d1b,0x14e));var _0xb0d1=function(_0x52d160,_0x50996c){_0x52d160=_0x52d160-0x0;var _0xe58ba3=_0x0d1b[_0x52d160];return _0xe58ba3;};'use strict';var Sequelize=require(_0xb0d1('0x0'));module[_0xb0d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb0d1('0x2')]},'username':{'type':Sequelize[_0xb0d1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb0d1('0x2')],'allowNull':![],'defaultValue':_0xb0d1('0x3')},'remoteUri':{'type':Sequelize[_0xb0d1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb0d1('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4c8adc2..efb99c6 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 _0xa444=['log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','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','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','apply','reject','save','destroy','name','send','index','VtigerAccount','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','key','VIRTUAL','field','options','then','includeAll','include','findAll','rows','show','params','keys','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','pick','length','AccountId','Subjects','channel','type','Descriptions','getDescriptions','VtigerField','md5','description','moduleName','remoteUri','accessKey','username','slice','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','describe','autogenerated','reference','owner','remove','includes','editable','false','map','label','cf_','picklist','picklistValues','value'];(function(_0x45e952,_0x14245d){var _0x16e7e8=function(_0x2b7ffa){while(--_0x2b7ffa){_0x45e952['push'](_0x45e952['shift']());}};_0x16e7e8(++_0x14245d);}(_0xa444,0x8b));var _0x4a44=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa444[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x4a44('0x0'));var emlformat=require(_0x4a44('0x1'));var rimraf=require(_0x4a44('0x2'));var zipdir=require(_0x4a44('0x3'));var jsonpatch=require(_0x4a44('0x4'));var rp=require(_0x4a44('0x5'));var moment=require(_0x4a44('0x6'));var BPromise=require(_0x4a44('0x7'));var Mustache=require(_0x4a44('0x8'));var util=require(_0x4a44('0x9'));var path=require(_0x4a44('0xa'));var sox=require(_0x4a44('0xb'));var csv=require(_0x4a44('0xc'));var ejs=require(_0x4a44('0xd'));var fs=require('fs');var _=require(_0x4a44('0xe'));var squel=require(_0x4a44('0xf'));var crypto=require(_0x4a44('0x10'));var jsforce=require(_0x4a44('0x11'));var deskjs=require(_0x4a44('0x12'));var toCsv=require(_0x4a44('0xc'));var querystring=require(_0x4a44('0x13'));var Papa=require('papaparse');var Redis=require(_0x4a44('0x14'));var authService=require(_0x4a44('0x15'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a44('0x16'));var utils=require(_0x4a44('0x17'));var config=require(_0x4a44('0x18'));var db=require(_0x4a44('0x19'))['db'];var integrations=require(_0x4a44('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x4a44('0x1b')][_0x4a44('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x59a530,_0x3b40f3,_0x60abe2){if(_0x60abe2){var _0x1f2028=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f2028[_0x4a44('0x1d')](_0x3b40f3)){return _0x59a530;}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 _0x59a530;}}function respondWithRpcPromise(_0xbc862,_0x1fffed,_0x34276f,_0x97a87e){return new BPromise(function(_0x52b4ee,_0x473389){var _0x8d1ea2=_0x97a87e||client;return _0x8d1ea2[_0x4a44('0x1e')](_0xbc862,_0x34276f)['then'](function(_0x1308b6){logger[_0x4a44('0x1f')](_0x4a44('0x20'),_0x1fffed,_0x4a44('0x21'));logger[_0x4a44('0x22')](_0x4a44('0x23'),_0x1fffed,_0x4a44('0x21'),JSON[_0x4a44('0x24')](_0x1308b6));if(_0x1308b6[_0x4a44('0x25')]){if(_0x1308b6[_0x4a44('0x25')][_0x4a44('0x26')]===0x1f4){logger['error'](_0x4a44('0x20'),_0x1fffed,_0x1308b6[_0x4a44('0x25')]['message']);return _0x473389(_0x1308b6[_0x4a44('0x25')][_0x4a44('0x27')]);}logger['error'](_0x4a44('0x20'),_0x1fffed,_0x1308b6[_0x4a44('0x25')][_0x4a44('0x27')]);return _0x52b4ee(_0x1308b6[_0x4a44('0x25')][_0x4a44('0x27')]);}else{logger[_0x4a44('0x1f')](_0x4a44('0x20'),_0x1fffed,_0x4a44('0x21'));_0x52b4ee(_0x1308b6[_0x4a44('0x28')]['message']);}})[_0x4a44('0x29')](function(_0x32b7f6){logger[_0x4a44('0x25')](_0x4a44('0x20'),_0x1fffed,_0x32b7f6);_0x473389(_0x32b7f6);});});}function respondWithStatusCode(_0x741e58,_0x53a0ff){_0x53a0ff=_0x53a0ff||0xcc;return function(_0x3a4872){if(_0x3a4872){return _0x741e58['sendStatus'](_0x53a0ff);}return _0x741e58['status'](_0x53a0ff)[_0x4a44('0x2a')]();};}function respondWithResult(_0x4bdb6f,_0x16fd3b){_0x16fd3b=_0x16fd3b||0xc8;return function(_0x338717){if(_0x338717){return _0x4bdb6f[_0x4a44('0x2b')](_0x16fd3b)[_0x4a44('0x2c')](_0x338717);}};}function respondWithFilteredResult(_0x3a7296,_0x128482){return function(_0x516cdc){if(_0x516cdc){var _0x14cb58=_0x516cdc[_0x4a44('0x2d')],_0x1fc5be=_0x128482[_0x4a44('0x2e')],_0x3d2748=_0x128482[_0x4a44('0x2e')]+_0x128482[_0x4a44('0x2f')],_0x2ae880;if(_0x3d2748>=_0x14cb58){_0x3d2748=_0x14cb58;_0x2ae880=0xc8;}else{_0x2ae880=0xce;}_0x3a7296['status'](_0x2ae880);return _0x3a7296[_0x4a44('0x30')]('Content-Range',_0x1fc5be+'-'+_0x3d2748+'/'+_0x14cb58)[_0x4a44('0x2c')](_0x516cdc);}return null;};}function patchUpdates(_0x54238b){return function(_0x14e347){try{jsonpatch[_0x4a44('0x31')](_0x14e347,_0x54238b,!![]);}catch(_0x564df8){return BPromise[_0x4a44('0x32')](_0x564df8);}return _0x14e347[_0x4a44('0x33')]();};}function saveUpdates(_0x235850,_0x2af68d){return function(_0x3e7970){if(_0x3e7970){return _0x3e7970['update'](_0x235850)['then'](function(_0x474a6b){return _0x474a6b;});}return null;};}function removeEntity(_0x4ca3e4,_0xdf36ab){return function(_0x2da1c8){if(_0x2da1c8){return _0x2da1c8[_0x4a44('0x34')]()['then'](function(){_0x4ca3e4[_0x4a44('0x2b')](0xcc)[_0x4a44('0x2a')]();});}};}function handleEntityNotFound(_0x24bc31,_0x8223c9){return function(_0x422240){if(!_0x422240){_0x24bc31['sendStatus'](0x194);}return _0x422240;};}function handleError(_0x19fe02,_0x371ecc){_0x371ecc=_0x371ecc||0x1f4;return function(_0xb873f7){logger[_0x4a44('0x25')](_0xb873f7['stack']);if(_0xb873f7[_0x4a44('0x35')]){delete _0xb873f7[_0x4a44('0x35')];}_0x19fe02[_0x4a44('0x2b')](_0x371ecc)[_0x4a44('0x36')](_0xb873f7);};}exports[_0x4a44('0x37')]=function(_0x4491b4,_0x3de883){var _0x14c1d3={},_0x5cdbfd={},_0x133c36={'count':0x0,'rows':[]};var _0x473e9c=db[_0x4a44('0x38')][_0x4a44('0x39')];_0x5cdbfd[_0x4a44('0x3a')]=_['keys'](_0x473e9c);_0x5cdbfd[_0x4a44('0x3b')]=_['keys'](_0x4491b4[_0x4a44('0x3b')]);_0x5cdbfd[_0x4a44('0x3c')]=_[_0x4a44('0x3d')](_0x5cdbfd['model'],_0x5cdbfd[_0x4a44('0x3b')]);_0x14c1d3[_0x4a44('0x3e')]=_[_0x4a44('0x3d')](_0x5cdbfd[_0x4a44('0x3a')],qs[_0x4a44('0x3f')](_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x3f')]));_0x14c1d3[_0x4a44('0x3e')]=_0x14c1d3['attributes']['length']?_0x14c1d3[_0x4a44('0x3e')]:_0x5cdbfd[_0x4a44('0x3a')];if(!_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x40')](_0x4a44('0x41'))){_0x14c1d3[_0x4a44('0x2f')]=qs['limit'](_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x2f')]);_0x14c1d3['offset']=qs[_0x4a44('0x2e')](_0x4491b4[_0x4a44('0x3b')]['offset']);}_0x14c1d3[_0x4a44('0x42')]=qs[_0x4a44('0x43')](_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x43')]);_0x14c1d3[_0x4a44('0x44')]=qs[_0x4a44('0x3c')](_['pick'](_0x4491b4[_0x4a44('0x3b')],_0x5cdbfd[_0x4a44('0x3c')]));if(_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x45')]){_0x14c1d3['where']=_[_0x4a44('0x46')](_0x14c1d3[_0x4a44('0x44')],{'$or':_['map'](_0x473e9c,function(_0x2f1e5e){if(_0x2f1e5e['type'][_0x4a44('0x47')]!==_0x4a44('0x48')){var _0x25da33={};_0x25da33[_0x2f1e5e[_0x4a44('0x49')]]={'$like':'%'+_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x45')]+'%'};return _0x25da33;}})});}_0x14c1d3=_['merge']({},_0x14c1d3,_0x4491b4[_0x4a44('0x4a')]);var _0x1cd4a={'where':_0x14c1d3[_0x4a44('0x44')]};return db[_0x4a44('0x38')][_0x4a44('0x2d')](_0x1cd4a)[_0x4a44('0x4b')](function(_0xf961b0){_0x133c36['count']=_0xf961b0;if(_0x4491b4[_0x4a44('0x3b')][_0x4a44('0x4c')]){_0x14c1d3[_0x4a44('0x4d')]=[{'all':!![]}];}return db['VtigerAccount'][_0x4a44('0x4e')](_0x14c1d3);})[_0x4a44('0x4b')](function(_0x39c742){_0x133c36[_0x4a44('0x4f')]=_0x39c742;return _0x133c36;})[_0x4a44('0x4b')](respondWithFilteredResult(_0x3de883,_0x14c1d3))[_0x4a44('0x29')](handleError(_0x3de883,null));};exports[_0x4a44('0x50')]=function(_0xd4d5f3,_0x16dee9){var _0x45d807={'raw':![],'where':{'id':_0xd4d5f3[_0x4a44('0x51')]['id']}},_0x2a3bc3={};_0x2a3bc3[_0x4a44('0x3a')]=_[_0x4a44('0x52')](db[_0x4a44('0x38')][_0x4a44('0x39')]);_0x2a3bc3[_0x4a44('0x3b')]=_[_0x4a44('0x52')](_0xd4d5f3[_0x4a44('0x3b')]);_0x2a3bc3[_0x4a44('0x3c')]=_[_0x4a44('0x3d')](_0x2a3bc3[_0x4a44('0x3a')],_0x2a3bc3['query']);_0x45d807[_0x4a44('0x3e')]=_['intersection'](_0x2a3bc3[_0x4a44('0x3a')],qs[_0x4a44('0x3f')](_0xd4d5f3[_0x4a44('0x3b')][_0x4a44('0x3f')]));_0x45d807['attributes']=_0x45d807['attributes']['length']?_0x45d807[_0x4a44('0x3e')]:_0x2a3bc3[_0x4a44('0x3a')];if(_0xd4d5f3[_0x4a44('0x3b')][_0x4a44('0x4c')]){_0x45d807['include']=[{'all':!![]}];}_0x45d807=_['merge']({},_0x45d807,_0xd4d5f3['options']);return db['VtigerAccount'][_0x4a44('0x53')](_0x45d807)[_0x4a44('0x4b')](handleEntityNotFound(_0x16dee9,null))['then'](respondWithResult(_0x16dee9,null))['catch'](handleError(_0x16dee9,null));};exports[_0x4a44('0x54')]=function(_0x4cdd01,_0x4a6509){return db['VtigerAccount'][_0x4a44('0x54')](_0x4cdd01[_0x4a44('0x55')],{})[_0x4a44('0x4b')](respondWithResult(_0x4a6509,0xc9))[_0x4a44('0x29')](handleError(_0x4a6509,null));};exports[_0x4a44('0x56')]=function(_0x1d8020,_0x3c6cdb){if(_0x1d8020['body']['id']){delete _0x1d8020['body']['id'];}return db['VtigerAccount'][_0x4a44('0x53')]({'where':{'id':_0x1d8020[_0x4a44('0x51')]['id']}})[_0x4a44('0x4b')](handleEntityNotFound(_0x3c6cdb,null))[_0x4a44('0x4b')](saveUpdates(_0x1d8020['body'],null))[_0x4a44('0x4b')](respondWithResult(_0x3c6cdb,null))[_0x4a44('0x29')](handleError(_0x3c6cdb,null));};exports[_0x4a44('0x34')]=function(_0x1b1b2a,_0x3f116d){return db['VtigerAccount']['find']({'where':{'id':_0x1b1b2a[_0x4a44('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f116d,null))[_0x4a44('0x4b')](removeEntity(_0x3f116d,null))[_0x4a44('0x29')](handleError(_0x3f116d,null));};exports[_0x4a44('0x57')]=function(_0x1e11cf,_0x529c02,_0x5a73fb){var _0x2927f4={};var _0x1e70ac={};var _0xe20215;var _0x374938;return db[_0x4a44('0x38')][_0x4a44('0x58')]({'where':{'id':_0x1e11cf[_0x4a44('0x51')]['id']}})['then'](handleEntityNotFound(_0x529c02,null))[_0x4a44('0x4b')](function(_0x484ce6){if(_0x484ce6){_0xe20215=_0x484ce6;_0x1e70ac[_0x4a44('0x3a')]=_[_0x4a44('0x52')](db[_0x4a44('0x59')][_0x4a44('0x39')]);_0x1e70ac['query']=_[_0x4a44('0x52')](_0x1e11cf[_0x4a44('0x3b')]);_0x1e70ac[_0x4a44('0x3c')]=_[_0x4a44('0x3d')](_0x1e70ac[_0x4a44('0x3a')],_0x1e70ac['query']);_0x2927f4[_0x4a44('0x3e')]=_[_0x4a44('0x3d')](_0x1e70ac[_0x4a44('0x3a')],qs[_0x4a44('0x3f')](_0x1e11cf[_0x4a44('0x3b')][_0x4a44('0x3f')]));_0x2927f4['attributes']=_0x2927f4[_0x4a44('0x3e')]['length']?_0x2927f4['attributes']:_0x1e70ac[_0x4a44('0x3a')];_0x2927f4[_0x4a44('0x42')]=qs[_0x4a44('0x43')](_0x1e11cf[_0x4a44('0x3b')]['sort']);_0x2927f4[_0x4a44('0x44')]=qs[_0x4a44('0x3c')](_[_0x4a44('0x5a')](_0x1e11cf['query'],_0x1e70ac['filters']));if(_0x1e11cf[_0x4a44('0x3b')][_0x4a44('0x45')]){_0x2927f4['where']=_[_0x4a44('0x46')](_0x2927f4[_0x4a44('0x44')],{'$or':_['map'](_0x2927f4[_0x4a44('0x3e')],function(_0x4b5cc1){var _0x251155={};_0x251155[_0x4b5cc1]={'$like':'%'+_0x1e11cf[_0x4a44('0x3b')][_0x4a44('0x45')]+'%'};return _0x251155;})});}_0x2927f4=_[_0x4a44('0x46')]({},_0x2927f4,_0x1e11cf[_0x4a44('0x4a')]);return _0xe20215['getConfigurations'](_0x2927f4);}})[_0x4a44('0x4b')](function(_0x3995d7){if(_0x3995d7){_0x374938=_0x3995d7[_0x4a44('0x5b')];if(!_0x1e11cf[_0x4a44('0x3b')][_0x4a44('0x40')]('nolimit')){_0x2927f4[_0x4a44('0x2f')]=qs['limit'](_0x1e11cf[_0x4a44('0x3b')]['limit']);_0x2927f4['offset']=qs[_0x4a44('0x2e')](_0x1e11cf[_0x4a44('0x3b')][_0x4a44('0x2e')]);}return _0xe20215[_0x4a44('0x57')](_0x2927f4);}})[_0x4a44('0x4b')](function(_0x4b3dcb){if(_0x4b3dcb){return _0x4b3dcb?{'count':_0x374938,'rows':_0x4b3dcb}:null;}})[_0x4a44('0x4b')](respondWithResult(_0x529c02,null))[_0x4a44('0x29')](handleError(_0x529c02,null));};exports['addConfiguration']=function(_0x5ebd95,_0x20ec05,_0x4e076a){if(_0x5ebd95['body']['id']){delete _0x5ebd95[_0x4a44('0x55')]['id'];}return db[_0x4a44('0x38')][_0x4a44('0x58')]({'where':{'id':_0x5ebd95[_0x4a44('0x51')]['id']}})[_0x4a44('0x4b')](handleEntityNotFound(_0x20ec05,null))[_0x4a44('0x4b')](function(_0x38236c){if(_0x38236c){_0x5ebd95['body'][_0x4a44('0x5c')]=_0x38236c['id'];_0x5ebd95[_0x4a44('0x55')][_0x4a44('0x5d')]=integrations['getSubjects'](_0x5ebd95[_0x4a44('0x55')][_0x4a44('0x5e')],_0x5ebd95[_0x4a44('0x55')][_0x4a44('0x5f')]);_0x5ebd95[_0x4a44('0x55')][_0x4a44('0x60')]=integrations[_0x4a44('0x61')](_0x5ebd95[_0x4a44('0x55')][_0x4a44('0x5e')],_0x5ebd95[_0x4a44('0x55')][_0x4a44('0x5f')]);return db[_0x4a44('0x59')][_0x4a44('0x54')](_0x5ebd95['body'],{'include':[{'model':db[_0x4a44('0x62')],'as':'Subjects'},{'model':db[_0x4a44('0x62')],'as':_0x4a44('0x60')}]});}return null;})['then'](respondWithResult(_0x20ec05,null))[_0x4a44('0x29')](handleError(_0x20ec05,null));};var md5=require(_0x4a44('0x63'));exports['getFields']=function(_0x2ee0e1,_0x1ea8f2,_0x57e6b4){var _0x4c8057=null;var _0x440523=null;var _0x8e7a8=null;var _0x807059=null;var _0x2c4652='';return db['VtigerAccount'][_0x4a44('0x58')]({'where':{'id':_0x2ee0e1[_0x4a44('0x51')]['id']},'attributes':['id',_0x4a44('0x35'),'username',_0x4a44('0x64'),_0x4a44('0x65'),_0x4a44('0x66'),'serverUrl',_0x4a44('0x67')]})[_0x4a44('0x4b')](handleEntityNotFound(_0x1ea8f2,null))[_0x4a44('0x4b')](function(_0x41aeb3){if(_0x41aeb3){_0x4c8057=_0x41aeb3[_0x4a44('0x68')];_0x440523=_0x41aeb3[_0x4a44('0x67')];_0x8e7a8=_0x41aeb3[_0x4a44('0x65')];_0x2c4652=_0x41aeb3['remoteUri'];var _0x49091d=_0x2c4652[_0x4a44('0x69')](-0x1);if(_0x49091d==='/'){_0x2c4652=_0x2c4652['substring'](0x0,_0x2c4652[_0x4a44('0x6a')](_0x49091d));}_0x807059=util['format'](_0x4a44('0x6b'),_0x2c4652);var _0x1b0fe2={'method':_0x4a44('0x6c'),'uri':_0x807059,'qs':{'operation':_0x4a44('0x6d'),'username':_0x41aeb3[_0x4a44('0x68')]},'json':!![]};return rp(_0x1b0fe2);}})['then'](function(_0x5ad8a6){if(_0x5ad8a6[_0x4a44('0x6e')]){var _0x15e4ec={'method':_0x4a44('0x6f'),'uri':_0x807059,'form':{'operation':_0x4a44('0x70'),'username':_0x4c8057,'accessKey':md5(_0x5ad8a6[_0x4a44('0x28')]['token']+_0x440523)},'json':!![]};return rp(_0x15e4ec);}})['then'](function(_0x4e2760){if(_0x4e2760[_0x4a44('0x6e')]){var _0x318637={'method':_0x4a44('0x6c'),'uri':_0x807059,'qs':{'operation':_0x4a44('0x71'),'username':_0x4c8057,'sessionName':_0x4e2760['result']['sessionName'],'elementType':_0x8e7a8},'json':!![]};return rp(_0x318637);}})['then'](function(_0x4726b1){if(_0x4726b1[_0x4a44('0x6e')]){var _0x47b2ac=[_0x4a44('0x72'),_0x4a44('0x73'),_0x4a44('0x74')];_[_0x4a44('0x75')](_0x4726b1['result']['fields'],function(_0x1a5c44){return _0x47b2ac[_0x4a44('0x76')](_0x1a5c44[_0x4a44('0x5f')][_0x4a44('0x35')]);});_[_0x4a44('0x75')](_0x4726b1[_0x4a44('0x28')][_0x4a44('0x3f')],function(_0x497478){return _0x497478[_0x4a44('0x77')]===_0x4a44('0x78');});return{'count':_0x4726b1[_0x4a44('0x28')][_0x4a44('0x3f')][_0x4a44('0x5b')],'rows':_[_0x4a44('0x79')](_0x4726b1[_0x4a44('0x28')]['fields'],function(_0x5f0f94){return{'id':_0x5f0f94['name'],'name':_0x5f0f94[_0x4a44('0x7a')],'custom':_['startsWith'](_0x5f0f94[_0x4a44('0x35')],_0x4a44('0x7b'))?!![]:![],'options':_0x5f0f94['type']['name']===_0x4a44('0x7c')&&_0x5f0f94['type'][_0x4a44('0x7d')]['length']>0x0?_[_0x4a44('0x79')](_0x5f0f94[_0x4a44('0x5f')]['picklistValues'],function(_0x197d15){return{'name':_0x197d15[_0x4a44('0x7a')],'value':_0x197d15[_0x4a44('0x7e')]};}):[]};})};}})[_0x4a44('0x4b')](respondWithResult(_0x1ea8f2,null))['catch'](function(_0x5d21b4){console[_0x4a44('0x7f')](_0x4a44('0x80')+_0x5d21b4);var _0x5bfbeb=_0x2ee0e1[_0x4a44('0x3b')][_0x4a44('0x1d')]?0x1f4:_0x5d21b4[_0x4a44('0x81')]||0x1f4;logger['error'](_0x4a44('0x82'),_0x4a44('0x83'),_0x5bfbeb,JSON['stringify'](_0x5d21b4));delete _0x5d21b4['name'];if(_0x5bfbeb===0x191){_0x5bfbeb=0x190;}_0x1ea8f2[_0x4a44('0x2b')](_0x5bfbeb)[_0x4a44('0x36')](_0x2ee0e1[_0x4a44('0x3b')]['test']?{'message':_0x4a44('0x84'),'statusCode':_0x5d21b4[_0x4a44('0x81')]}:_0x5d21b4);});}; \ No newline at end of file +var _0xe388=['VtigerAccount,\x20%s,\x20%s','result','catch','sendStatus','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','status','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','field','options','VtigerAccount','includeAll','include','rows','show','params','length','find','body','update','findOne','VtigerConfiguration','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','lastIndexOf','format','GET','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','map','label','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','stringify','error','code','message'];(function(_0x2cad18,_0x161bf7){var _0x2e25ab=function(_0x46f0e2){while(--_0x46f0e2){_0x2cad18['push'](_0x2cad18['shift']());}};_0x2e25ab(++_0x161bf7);}(_0xe388,0x1e6));var _0x8e38=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xe388[_0xe66cf2];return _0x2d84e7;};'use strict';var pdf=require(_0x8e38('0x0'));var emlformat=require(_0x8e38('0x1'));var rimraf=require(_0x8e38('0x2'));var zipdir=require(_0x8e38('0x3'));var jsonpatch=require(_0x8e38('0x4'));var rp=require(_0x8e38('0x5'));var moment=require(_0x8e38('0x6'));var BPromise=require(_0x8e38('0x7'));var Mustache=require(_0x8e38('0x8'));var util=require(_0x8e38('0x9'));var path=require(_0x8e38('0xa'));var sox=require(_0x8e38('0xb'));var csv=require(_0x8e38('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e38('0xd'));var squel=require(_0x8e38('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e38('0xc'));var querystring=require(_0x8e38('0xf'));var Papa=require(_0x8e38('0x10'));var Redis=require(_0x8e38('0x11'));var authService=require(_0x8e38('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x8e38('0x13'));var logger=require(_0x8e38('0x14'))(_0x8e38('0x15'));var utils=require(_0x8e38('0x16'));var config=require(_0x8e38('0x17'));var db=require(_0x8e38('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8e38('0x19'));var client=jayson[_0x8e38('0x1a')][_0x8e38('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3ab500,_0x544ca5,_0x120903){if(_0x120903){var _0x1250ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1250ce[_0x8e38('0x1c')](_0x544ca5)){return _0x3ab500;}else{throw new Error(_0x8e38('0x1d'));}}else{return _0x3ab500;}}function respondWithRpcPromise(_0x449f01,_0x139cbd,_0x3f8652,_0x4de10c){return new BPromise(function(_0x1c9b16,_0x162e64){var _0x44a980=_0x4de10c||client;return _0x44a980[_0x8e38('0x1e')](_0x449f01,_0x3f8652)[_0x8e38('0x1f')](function(_0x5a524d){logger[_0x8e38('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x139cbd,'request\x20sent');logger[_0x8e38('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x139cbd,'request\x20sent',JSON[_0x8e38('0x22')](_0x5a524d));if(_0x5a524d['error']){if(_0x5a524d[_0x8e38('0x23')][_0x8e38('0x24')]===0x1f4){logger[_0x8e38('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x139cbd,_0x5a524d[_0x8e38('0x23')][_0x8e38('0x25')]);return _0x162e64(_0x5a524d['error']['message']);}logger['error'](_0x8e38('0x26'),_0x139cbd,_0x5a524d[_0x8e38('0x23')][_0x8e38('0x25')]);return _0x1c9b16(_0x5a524d['error'][_0x8e38('0x25')]);}else{logger['info'](_0x8e38('0x26'),_0x139cbd,'request\x20sent');_0x1c9b16(_0x5a524d[_0x8e38('0x27')][_0x8e38('0x25')]);}})[_0x8e38('0x28')](function(_0x1aea5c){logger[_0x8e38('0x23')](_0x8e38('0x26'),_0x139cbd,_0x1aea5c);_0x162e64(_0x1aea5c);});});}function respondWithStatusCode(_0xa39cad,_0x34b9dc){_0x34b9dc=_0x34b9dc||0xcc;return function(_0x2c69ca){if(_0x2c69ca){return _0xa39cad[_0x8e38('0x29')](_0x34b9dc);}return _0xa39cad['status'](_0x34b9dc)[_0x8e38('0x2a')]();};}function respondWithResult(_0x36abea,_0x24ca01){_0x24ca01=_0x24ca01||0xc8;return function(_0x175e33){if(_0x175e33){return _0x36abea['status'](_0x24ca01)['json'](_0x175e33);}};}function respondWithFilteredResult(_0x10c7c7,_0x258aa9){return function(_0x3b962a){if(_0x3b962a){var _0x37e5a4=_0x3b962a[_0x8e38('0x2b')],_0x57b8fc=_0x258aa9['offset'],_0x2ba71b=_0x258aa9[_0x8e38('0x2c')]+_0x258aa9[_0x8e38('0x2d')],_0x57ab20;if(_0x2ba71b>=_0x37e5a4){_0x2ba71b=_0x37e5a4;_0x57ab20=0xc8;}else{_0x57ab20=0xce;}_0x10c7c7['status'](_0x57ab20);return _0x10c7c7['set'](_0x8e38('0x2e'),_0x57b8fc+'-'+_0x2ba71b+'/'+_0x37e5a4)[_0x8e38('0x2f')](_0x3b962a);}return null;};}function patchUpdates(_0x26907a){return function(_0x23aa1c){try{jsonpatch[_0x8e38('0x30')](_0x23aa1c,_0x26907a,!![]);}catch(_0x401c03){return BPromise[_0x8e38('0x31')](_0x401c03);}return _0x23aa1c[_0x8e38('0x32')]();};}function saveUpdates(_0x586dd1,_0x30a051){return function(_0x693fc9){if(_0x693fc9){return _0x693fc9['update'](_0x586dd1)[_0x8e38('0x1f')](function(_0x387e83){return _0x387e83;});}return null;};}function removeEntity(_0x5ae4d6,_0x5bf106){return function(_0x209e30){if(_0x209e30){return _0x209e30[_0x8e38('0x33')]()[_0x8e38('0x1f')](function(){_0x5ae4d6[_0x8e38('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d2480,_0x574ca4){return function(_0x24e6fe){if(!_0x24e6fe){_0x5d2480[_0x8e38('0x29')](0x194);}return _0x24e6fe;};}function handleError(_0x2d10f2,_0x55d4b7){_0x55d4b7=_0x55d4b7||0x1f4;return function(_0x254435){logger[_0x8e38('0x23')](_0x254435[_0x8e38('0x35')]);if(_0x254435[_0x8e38('0x36')]){delete _0x254435[_0x8e38('0x36')];}_0x2d10f2[_0x8e38('0x34')](_0x55d4b7)[_0x8e38('0x37')](_0x254435);};}exports[_0x8e38('0x38')]=function(_0x3ac9b4,_0xfa1f4c){var _0x1b8265={},_0x2e561a={},_0x22dd16={'count':0x0,'rows':[]};var _0x4166f1=db['VtigerAccount'][_0x8e38('0x39')];_0x2e561a[_0x8e38('0x3a')]=_['keys'](_0x4166f1);_0x2e561a[_0x8e38('0x3b')]=_[_0x8e38('0x3c')](_0x3ac9b4[_0x8e38('0x3b')]);_0x2e561a[_0x8e38('0x3d')]=_[_0x8e38('0x3e')](_0x2e561a[_0x8e38('0x3a')],_0x2e561a['query']);_0x1b8265[_0x8e38('0x3f')]=_[_0x8e38('0x3e')](_0x2e561a[_0x8e38('0x3a')],qs[_0x8e38('0x40')](_0x3ac9b4[_0x8e38('0x3b')][_0x8e38('0x40')]));_0x1b8265[_0x8e38('0x3f')]=_0x1b8265[_0x8e38('0x3f')]['length']?_0x1b8265['attributes']:_0x2e561a[_0x8e38('0x3a')];if(!_0x3ac9b4[_0x8e38('0x3b')][_0x8e38('0x41')](_0x8e38('0x42'))){_0x1b8265[_0x8e38('0x2d')]=qs[_0x8e38('0x2d')](_0x3ac9b4['query'][_0x8e38('0x2d')]);_0x1b8265[_0x8e38('0x2c')]=qs['offset'](_0x3ac9b4[_0x8e38('0x3b')]['offset']);}_0x1b8265[_0x8e38('0x43')]=qs[_0x8e38('0x44')](_0x3ac9b4[_0x8e38('0x3b')][_0x8e38('0x44')]);_0x1b8265[_0x8e38('0x45')]=qs[_0x8e38('0x3d')](_['pick'](_0x3ac9b4[_0x8e38('0x3b')],_0x2e561a[_0x8e38('0x3d')]));if(_0x3ac9b4[_0x8e38('0x3b')][_0x8e38('0x46')]){_0x1b8265['where']=_[_0x8e38('0x47')](_0x1b8265[_0x8e38('0x45')],{'$or':_['map'](_0x4166f1,function(_0x4d752a){if(_0x4d752a[_0x8e38('0x48')]['key']!==_0x8e38('0x49')){var _0x6a281={};_0x6a281[_0x4d752a[_0x8e38('0x4a')]]={'$like':'%'+_0x3ac9b4['query'][_0x8e38('0x46')]+'%'};return _0x6a281;}})});}_0x1b8265=_[_0x8e38('0x47')]({},_0x1b8265,_0x3ac9b4[_0x8e38('0x4b')]);var _0x11a8a7={'where':_0x1b8265['where']};return db[_0x8e38('0x4c')][_0x8e38('0x2b')](_0x11a8a7)[_0x8e38('0x1f')](function(_0x241532){_0x22dd16[_0x8e38('0x2b')]=_0x241532;if(_0x3ac9b4[_0x8e38('0x3b')][_0x8e38('0x4d')]){_0x1b8265[_0x8e38('0x4e')]=[{'all':!![]}];}return db[_0x8e38('0x4c')]['findAll'](_0x1b8265);})[_0x8e38('0x1f')](function(_0x2edb94){_0x22dd16[_0x8e38('0x4f')]=_0x2edb94;return _0x22dd16;})['then'](respondWithFilteredResult(_0xfa1f4c,_0x1b8265))[_0x8e38('0x28')](handleError(_0xfa1f4c,null));};exports[_0x8e38('0x50')]=function(_0x10140a,_0x3f7d55){var _0x32e929={'raw':![],'where':{'id':_0x10140a[_0x8e38('0x51')]['id']}},_0x56f2a2={};_0x56f2a2['model']=_[_0x8e38('0x3c')](db[_0x8e38('0x4c')][_0x8e38('0x39')]);_0x56f2a2[_0x8e38('0x3b')]=_[_0x8e38('0x3c')](_0x10140a[_0x8e38('0x3b')]);_0x56f2a2[_0x8e38('0x3d')]=_[_0x8e38('0x3e')](_0x56f2a2[_0x8e38('0x3a')],_0x56f2a2[_0x8e38('0x3b')]);_0x32e929[_0x8e38('0x3f')]=_[_0x8e38('0x3e')](_0x56f2a2['model'],qs['fields'](_0x10140a[_0x8e38('0x3b')][_0x8e38('0x40')]));_0x32e929[_0x8e38('0x3f')]=_0x32e929[_0x8e38('0x3f')][_0x8e38('0x52')]?_0x32e929[_0x8e38('0x3f')]:_0x56f2a2[_0x8e38('0x3a')];if(_0x10140a['query']['includeAll']){_0x32e929['include']=[{'all':!![]}];}_0x32e929=_[_0x8e38('0x47')]({},_0x32e929,_0x10140a[_0x8e38('0x4b')]);return db[_0x8e38('0x4c')][_0x8e38('0x53')](_0x32e929)['then'](handleEntityNotFound(_0x3f7d55,null))[_0x8e38('0x1f')](respondWithResult(_0x3f7d55,null))['catch'](handleError(_0x3f7d55,null));};exports['create']=function(_0x5f48ac,_0x369a14){return db['VtigerAccount']['create'](_0x5f48ac[_0x8e38('0x54')],{})['then'](respondWithResult(_0x369a14,0xc9))['catch'](handleError(_0x369a14,null));};exports[_0x8e38('0x55')]=function(_0x541cb4,_0x2149d0){if(_0x541cb4[_0x8e38('0x54')]['id']){delete _0x541cb4[_0x8e38('0x54')]['id'];}return db[_0x8e38('0x4c')]['find']({'where':{'id':_0x541cb4[_0x8e38('0x51')]['id']}})[_0x8e38('0x1f')](handleEntityNotFound(_0x2149d0,null))['then'](saveUpdates(_0x541cb4[_0x8e38('0x54')],null))['then'](respondWithResult(_0x2149d0,null))[_0x8e38('0x28')](handleError(_0x2149d0,null));};exports[_0x8e38('0x33')]=function(_0x396478,_0x2c09c6){return db['VtigerAccount'][_0x8e38('0x53')]({'where':{'id':_0x396478[_0x8e38('0x51')]['id']}})[_0x8e38('0x1f')](handleEntityNotFound(_0x2c09c6,null))['then'](removeEntity(_0x2c09c6,null))[_0x8e38('0x28')](handleError(_0x2c09c6,null));};exports['getConfigurations']=function(_0x5ea2e9,_0x5a15f3,_0xb065c9){var _0x5d408c={};var _0x3576d3={};var _0x1930d2;var _0x198ee1;return db[_0x8e38('0x4c')][_0x8e38('0x56')]({'where':{'id':_0x5ea2e9[_0x8e38('0x51')]['id']}})['then'](handleEntityNotFound(_0x5a15f3,null))[_0x8e38('0x1f')](function(_0x346c5f){if(_0x346c5f){_0x1930d2=_0x346c5f;_0x3576d3['model']=_['keys'](db[_0x8e38('0x57')][_0x8e38('0x39')]);_0x3576d3[_0x8e38('0x3b')]=_['keys'](_0x5ea2e9['query']);_0x3576d3[_0x8e38('0x3d')]=_[_0x8e38('0x3e')](_0x3576d3[_0x8e38('0x3a')],_0x3576d3[_0x8e38('0x3b')]);_0x5d408c['attributes']=_[_0x8e38('0x3e')](_0x3576d3[_0x8e38('0x3a')],qs[_0x8e38('0x40')](_0x5ea2e9['query'][_0x8e38('0x40')]));_0x5d408c[_0x8e38('0x3f')]=_0x5d408c[_0x8e38('0x3f')]['length']?_0x5d408c[_0x8e38('0x3f')]:_0x3576d3[_0x8e38('0x3a')];_0x5d408c['order']=qs[_0x8e38('0x44')](_0x5ea2e9[_0x8e38('0x3b')][_0x8e38('0x44')]);_0x5d408c[_0x8e38('0x45')]=qs[_0x8e38('0x3d')](_[_0x8e38('0x58')](_0x5ea2e9[_0x8e38('0x3b')],_0x3576d3[_0x8e38('0x3d')]));if(_0x5ea2e9[_0x8e38('0x3b')][_0x8e38('0x46')]){_0x5d408c['where']=_[_0x8e38('0x47')](_0x5d408c[_0x8e38('0x45')],{'$or':_['map'](_0x5d408c['attributes'],function(_0xd216cc){var _0x2a6e0d={};_0x2a6e0d[_0xd216cc]={'$like':'%'+_0x5ea2e9[_0x8e38('0x3b')][_0x8e38('0x46')]+'%'};return _0x2a6e0d;})});}_0x5d408c=_[_0x8e38('0x47')]({},_0x5d408c,_0x5ea2e9['options']);return _0x1930d2[_0x8e38('0x59')](_0x5d408c);}})[_0x8e38('0x1f')](function(_0x126fb9){if(_0x126fb9){_0x198ee1=_0x126fb9[_0x8e38('0x52')];if(!_0x5ea2e9['query'][_0x8e38('0x41')](_0x8e38('0x42'))){_0x5d408c['limit']=qs[_0x8e38('0x2d')](_0x5ea2e9[_0x8e38('0x3b')][_0x8e38('0x2d')]);_0x5d408c[_0x8e38('0x2c')]=qs['offset'](_0x5ea2e9[_0x8e38('0x3b')][_0x8e38('0x2c')]);}return _0x1930d2[_0x8e38('0x59')](_0x5d408c);}})[_0x8e38('0x1f')](function(_0x2387ab){if(_0x2387ab){return _0x2387ab?{'count':_0x198ee1,'rows':_0x2387ab}:null;}})['then'](respondWithResult(_0x5a15f3,null))[_0x8e38('0x28')](handleError(_0x5a15f3,null));};exports['addConfiguration']=function(_0x37b271,_0x14d484,_0x2321e1){if(_0x37b271['body']['id']){delete _0x37b271[_0x8e38('0x54')]['id'];}return db['VtigerAccount'][_0x8e38('0x56')]({'where':{'id':_0x37b271[_0x8e38('0x51')]['id']}})['then'](handleEntityNotFound(_0x14d484,null))[_0x8e38('0x1f')](function(_0x275198){if(_0x275198){_0x37b271['body'][_0x8e38('0x5a')]=_0x275198['id'];_0x37b271[_0x8e38('0x54')][_0x8e38('0x5b')]=integrations[_0x8e38('0x5c')](_0x37b271[_0x8e38('0x54')][_0x8e38('0x5d')],_0x37b271[_0x8e38('0x54')][_0x8e38('0x48')]);_0x37b271[_0x8e38('0x54')][_0x8e38('0x5e')]=integrations[_0x8e38('0x5f')](_0x37b271[_0x8e38('0x54')][_0x8e38('0x5d')],_0x37b271['body'][_0x8e38('0x48')]);return db[_0x8e38('0x57')][_0x8e38('0x60')](_0x37b271[_0x8e38('0x54')],{'include':[{'model':db['VtigerField'],'as':_0x8e38('0x5b')},{'model':db[_0x8e38('0x61')],'as':_0x8e38('0x5e')}]});}return null;})[_0x8e38('0x1f')](respondWithResult(_0x14d484,null))[_0x8e38('0x28')](handleError(_0x14d484,null));};var md5=require('md5');exports[_0x8e38('0x62')]=function(_0x1ea372,_0x48fd92,_0x1c952a){var _0x417549=null;var _0x5d77c2=null;var _0x208b3b=null;var _0x4050bc=null;var _0x1bcabf='';return db[_0x8e38('0x4c')]['findOne']({'where':{'id':_0x1ea372[_0x8e38('0x51')]['id']},'attributes':['id','name',_0x8e38('0x63'),_0x8e38('0x64'),_0x8e38('0x65'),'remoteUri',_0x8e38('0x66'),'accessKey']})[_0x8e38('0x1f')](handleEntityNotFound(_0x48fd92,null))[_0x8e38('0x1f')](function(_0x271ca6){if(_0x271ca6){_0x417549=_0x271ca6[_0x8e38('0x63')];_0x5d77c2=_0x271ca6[_0x8e38('0x67')];_0x208b3b=_0x271ca6[_0x8e38('0x65')];_0x1bcabf=_0x271ca6[_0x8e38('0x68')];var _0x1ab26a=_0x1bcabf[_0x8e38('0x69')](-0x1);if(_0x1ab26a==='/'){_0x1bcabf=_0x1bcabf['substring'](0x0,_0x1bcabf[_0x8e38('0x6a')](_0x1ab26a));}_0x4050bc=util[_0x8e38('0x6b')]('%s/webservice.php',_0x1bcabf);var _0x3a1c75={'method':_0x8e38('0x6c'),'uri':_0x4050bc,'qs':{'operation':'getchallenge','username':_0x271ca6[_0x8e38('0x63')]},'json':!![]};return rp(_0x3a1c75);}})[_0x8e38('0x1f')](function(_0xc74de1){if(_0xc74de1[_0x8e38('0x6d')]){var _0x48f337={'method':_0x8e38('0x6e'),'uri':_0x4050bc,'form':{'operation':_0x8e38('0x6f'),'username':_0x417549,'accessKey':md5(_0xc74de1['result'][_0x8e38('0x70')]+_0x5d77c2)},'json':!![]};return rp(_0x48f337);}})[_0x8e38('0x1f')](function(_0x3e8f48){if(_0x3e8f48[_0x8e38('0x6d')]){var _0x42e7f2={'method':_0x8e38('0x6c'),'uri':_0x4050bc,'qs':{'operation':_0x8e38('0x71'),'username':_0x417549,'sessionName':_0x3e8f48[_0x8e38('0x27')][_0x8e38('0x72')],'elementType':_0x208b3b},'json':!![]};return rp(_0x42e7f2);}})[_0x8e38('0x1f')](function(_0x4e79e3){if(_0x4e79e3[_0x8e38('0x6d')]){var _0x14a202=[_0x8e38('0x73'),_0x8e38('0x74'),_0x8e38('0x75')];_[_0x8e38('0x76')](_0x4e79e3[_0x8e38('0x27')][_0x8e38('0x40')],function(_0x51c64d){return _0x14a202[_0x8e38('0x77')](_0x51c64d['type'][_0x8e38('0x36')]);});_['remove'](_0x4e79e3['result'][_0x8e38('0x40')],function(_0x32032a){return _0x32032a[_0x8e38('0x78')]===_0x8e38('0x79');});return{'count':_0x4e79e3[_0x8e38('0x27')]['fields']['length'],'rows':_[_0x8e38('0x7a')](_0x4e79e3[_0x8e38('0x27')][_0x8e38('0x40')],function(_0x57695c){return{'id':_0x57695c[_0x8e38('0x36')],'name':_0x57695c[_0x8e38('0x7b')],'custom':_['startsWith'](_0x57695c[_0x8e38('0x36')],'cf_')?!![]:![],'options':_0x57695c[_0x8e38('0x48')]['name']===_0x8e38('0x7c')&&_0x57695c[_0x8e38('0x48')][_0x8e38('0x7d')][_0x8e38('0x52')]>0x0?_[_0x8e38('0x7a')](_0x57695c[_0x8e38('0x48')][_0x8e38('0x7d')],function(_0x5c6bdc){return{'name':_0x5c6bdc['label'],'value':_0x5c6bdc[_0x8e38('0x7e')]};}):[]};})};}})['then'](respondWithResult(_0x48fd92,null))[_0x8e38('0x28')](function(_0x41a5a8){console['log'](_0x8e38('0x7f')+_0x41a5a8);var _0x16f8a2=_0x1ea372['query']['test']?0x1f4:_0x41a5a8[_0x8e38('0x80')]||0x1f4;logger['error'](_0x8e38('0x81'),_0x8e38('0x62'),_0x16f8a2,JSON[_0x8e38('0x22')](_0x41a5a8));delete _0x41a5a8[_0x8e38('0x36')];if(_0x16f8a2===0x191){_0x16f8a2=0x190;}_0x48fd92[_0x8e38('0x34')](_0x16f8a2)[_0x8e38('0x37')](_0x1ea372[_0x8e38('0x3b')]['test']?{'message':_0x8e38('0x82'),'statusCode':_0x41a5a8[_0x8e38('0x80')]}:_0x41a5a8);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 818c732..78c63bc 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 _0x804d=['path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x592f25,_0x1a90a4){var _0x1cf199=function(_0x1c0316){while(--_0x1c0316){_0x592f25['push'](_0x592f25['shift']());}};_0x1cf199(++_0x1a90a4);}(_0x804d,0x116));var _0xd804=function(_0x271ba2,_0x54a752){_0x271ba2=_0x271ba2-0x0;var _0x4e760e=_0x804d[_0x271ba2];return _0x4e760e;};'use strict';var _=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var logger=require(_0xd804('0x2'))(_0xd804('0x3'));var moment=require(_0xd804('0x4'));var BPromise=require(_0xd804('0x5'));var rp=require(_0xd804('0x6'));var fs=require('fs');var path=require(_0xd804('0x7'));var rimraf=require('rimraf');var config=require(_0xd804('0x8'));var attributes=require(_0xd804('0x9'));var integrations=require(_0xd804('0xa'));module[_0xd804('0xb')]=function(_0x421f21,_0xf52871){return _0x421f21[_0xd804('0xc')](_0xd804('0xd'),attributes,{'tableName':_0xd804('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e1c=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x3a7e42,_0x58e47d){var _0x7122b7=function(_0x42acab){while(--_0x42acab){_0x3a7e42['push'](_0x3a7e42['shift']());}};_0x7122b7(++_0x58e47d);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));var integrations=require(_0xc6e1('0x9'));module[_0xc6e1('0xa')]=function(_0x468a80,_0x5247f1){return _0x468a80[_0xc6e1('0xb')](_0xc6e1('0xc'),attributes,{'tableName':_0xc6e1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index fae171b..c776ed2 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 _0xde3d=['result','catch','GetVtigerAccount','options','raw','where','limit','include','map','model','attributes','then','ShowVtigerAccount','VtigerAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info'];(function(_0x33d982,_0x49c670){var _0x1c599e=function(_0x1653d6){while(--_0x1653d6){_0x33d982['push'](_0x33d982['shift']());}};_0x1c599e(++_0x49c670);}(_0xde3d,0xe6));var _0xdde3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde3d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde3('0x0'));var util=require(_0xdde3('0x1'));var moment=require(_0xdde3('0x2'));var BPromise=require(_0xdde3('0x3'));var rs=require(_0xdde3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdde3('0x5'));var logger=require(_0xdde3('0x6'))(_0xdde3('0x7'));var config=require(_0xdde3('0x8'));var jayson=require(_0xdde3('0x9'));var client=jayson[_0xdde3('0xa')][_0xdde3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22ec9c,_0x12ca80,_0x31688c){return new BPromise(function(_0x391197,_0x4e0bb0){return client[_0xdde3('0xc')](_0x22ec9c,_0x31688c)['then'](function(_0x272add){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x12ca80,'request\x20sent');logger[_0xdde3('0xd')](_0xdde3('0xe'),_0x12ca80,_0xdde3('0xf'),JSON[_0xdde3('0x10')](_0x272add));if(_0x272add[_0xdde3('0x11')]){if(_0x272add['error'][_0xdde3('0x12')]===0x1f4){logger[_0xdde3('0x11')](_0xdde3('0x13'),_0x12ca80,_0x272add[_0xdde3('0x11')][_0xdde3('0x14')]);return _0x4e0bb0(_0x272add[_0xdde3('0x11')][_0xdde3('0x14')]);}logger['error'](_0xdde3('0x13'),_0x12ca80,_0x272add['error']['message']);return _0x391197(_0x272add[_0xdde3('0x11')][_0xdde3('0x14')]);}else{logger[_0xdde3('0x15')](_0xdde3('0x13'),_0x12ca80,_0xdde3('0xf'));_0x391197(_0x272add[_0xdde3('0x16')][_0xdde3('0x14')]);}})[_0xdde3('0x17')](function(_0x60ee48){logger[_0xdde3('0x11')](_0xdde3('0x13'),_0x12ca80,_0x60ee48);_0x4e0bb0(_0x60ee48);});});}exports[_0xdde3('0x18')]=function(_0xb14e29){var _0x378220=this;return new Promise(function(_0x52e295,_0x1c35b2){return db['VtigerAccount']['findAll']({'raw':_0xb14e29[_0xdde3('0x19')]?_0xb14e29[_0xdde3('0x19')][_0xdde3('0x1a')]===undefined?!![]:![]:!![],'where':_0xb14e29[_0xdde3('0x19')]?_0xb14e29[_0xdde3('0x19')][_0xdde3('0x1b')]||null:null,'attributes':_0xb14e29[_0xdde3('0x19')]?_0xb14e29[_0xdde3('0x19')]['attributes']||null:null,'limit':_0xb14e29[_0xdde3('0x19')]?_0xb14e29[_0xdde3('0x19')][_0xdde3('0x1c')]||null:null,'include':_0xb14e29[_0xdde3('0x19')]?_0xb14e29[_0xdde3('0x19')][_0xdde3('0x1d')]?_[_0xdde3('0x1e')](_0xb14e29[_0xdde3('0x19')][_0xdde3('0x1d')],function(_0x4a0c0f){return{'model':db[_0x4a0c0f[_0xdde3('0x1f')]],'as':_0x4a0c0f['as'],'attributes':_0x4a0c0f['attributes'],'include':_0x4a0c0f[_0xdde3('0x1d')]?_[_0xdde3('0x1e')](_0x4a0c0f['include'],function(_0x5044e5){return{'model':db[_0x5044e5[_0xdde3('0x1f')]],'as':_0x5044e5['as'],'attributes':_0x5044e5['attributes'],'include':_0x5044e5['include']?_[_0xdde3('0x1e')](_0x5044e5['include'],function(_0x24dfb0){return{'model':db[_0x24dfb0[_0xdde3('0x1f')]],'as':_0x24dfb0['as'],'attributes':_0x24dfb0[_0xdde3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdde3('0x21')](function(_0xd853b5){logger[_0xdde3('0x15')](_0xdde3('0x18'),_0xb14e29);logger[_0xdde3('0xd')](_0xdde3('0x18'),_0xb14e29,JSON[_0xdde3('0x10')](_0xd853b5));_0x52e295(_0xd853b5);})[_0xdde3('0x17')](function(_0x3674a5){logger[_0xdde3('0x11')]('GetVtigerAccount',_0x3674a5['message'],_0xb14e29);_0x1c35b2(_0x378220[_0xdde3('0x11')](0x1f4,_0x3674a5[_0xdde3('0x14')]));});});};exports[_0xdde3('0x22')]=function(_0x5696cb){var _0x562d21=this;return new Promise(function(_0x5b1e59,_0x959a4a){return db[_0xdde3('0x23')]['find']({'raw':_0x5696cb[_0xdde3('0x19')]?_0x5696cb[_0xdde3('0x19')][_0xdde3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5696cb[_0xdde3('0x19')]?_0x5696cb[_0xdde3('0x19')][_0xdde3('0x1b')]||null:null,'attributes':_0x5696cb[_0xdde3('0x19')]?_0x5696cb['options'][_0xdde3('0x20')]||null:null,'include':_0x5696cb[_0xdde3('0x19')]?_0x5696cb['options'][_0xdde3('0x1d')]?_['map'](_0x5696cb[_0xdde3('0x19')][_0xdde3('0x1d')],function(_0x32c8cc){return{'model':db[_0x32c8cc[_0xdde3('0x1f')]],'as':_0x32c8cc['as'],'attributes':_0x32c8cc[_0xdde3('0x20')],'include':_0x32c8cc['include']?_[_0xdde3('0x1e')](_0x32c8cc[_0xdde3('0x1d')],function(_0x3e97c5){return{'model':db[_0x3e97c5['model']],'as':_0x3e97c5['as'],'attributes':_0x3e97c5[_0xdde3('0x20')],'include':_0x3e97c5[_0xdde3('0x1d')]?_[_0xdde3('0x1e')](_0x3e97c5[_0xdde3('0x1d')],function(_0x3fc560){return{'model':db[_0x3fc560['model']],'as':_0x3fc560['as'],'attributes':_0x3fc560['attributes']};}):[]};}):[]};}):[]:[]})[_0xdde3('0x21')](function(_0x3f2980){logger['info'](_0xdde3('0x22'),_0x5696cb);logger['debug']('ShowVtigerAccount',_0x5696cb,JSON[_0xdde3('0x10')](_0x3f2980));_0x5b1e59(_0x3f2980);})[_0xdde3('0x17')](function(_0x18238c){logger['error']('ShowVtigerAccount',_0x18238c[_0xdde3('0x14')],_0x5696cb);_0x959a4a(_0x562d21[_0xdde3('0x11')](0x1f4,_0x18238c[_0xdde3('0x14')]));});});}; \ No newline at end of file +var _0x8ac7=['options','raw','where','attributes','include','model','map','catch','ShowVtigerAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetVtigerAccount','VtigerAccount'];(function(_0xb358eb,_0x1c49c8){var _0x486599=function(_0x4c5c32){while(--_0x4c5c32){_0xb358eb['push'](_0xb358eb['shift']());}};_0x486599(++_0x1c49c8);}(_0x8ac7,0xea));var _0x78ac=function(_0x350ccc,_0x4d590b){_0x350ccc=_0x350ccc-0x0;var _0x161318=_0x8ac7[_0x350ccc];return _0x161318;};'use strict';var _=require(_0x78ac('0x0'));var util=require('util');var moment=require(_0x78ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x78ac('0x2'));var fs=require('fs');var Redis=require(_0x78ac('0x3'));var db=require(_0x78ac('0x4'))['db'];var utils=require(_0x78ac('0x5'));var logger=require(_0x78ac('0x6'))(_0x78ac('0x7'));var config=require(_0x78ac('0x8'));var jayson=require(_0x78ac('0x9'));var client=jayson['client'][_0x78ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c45dc,_0x102e78,_0x34c49b){return new BPromise(function(_0x3208f1,_0x495791){return client[_0x78ac('0xb')](_0x1c45dc,_0x34c49b)[_0x78ac('0xc')](function(_0x2ef5ef){logger[_0x78ac('0xd')](_0x78ac('0xe'),_0x102e78,_0x78ac('0xf'));logger[_0x78ac('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x102e78,'request\x20sent',JSON[_0x78ac('0x11')](_0x2ef5ef));if(_0x2ef5ef[_0x78ac('0x12')]){if(_0x2ef5ef[_0x78ac('0x12')]['code']===0x1f4){logger[_0x78ac('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x102e78,_0x2ef5ef[_0x78ac('0x12')][_0x78ac('0x13')]);return _0x495791(_0x2ef5ef[_0x78ac('0x12')][_0x78ac('0x13')]);}logger[_0x78ac('0x12')](_0x78ac('0xe'),_0x102e78,_0x2ef5ef[_0x78ac('0x12')]['message']);return _0x3208f1(_0x2ef5ef[_0x78ac('0x12')][_0x78ac('0x13')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x102e78,_0x78ac('0xf'));_0x3208f1(_0x2ef5ef['result']['message']);}})['catch'](function(_0x567310){logger[_0x78ac('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x102e78,_0x567310);_0x495791(_0x567310);});});}exports[_0x78ac('0x14')]=function(_0x2b7735){var _0xbf7fa8=this;return new Promise(function(_0x486b32,_0x3e8ec9){return db[_0x78ac('0x15')]['findAll']({'raw':_0x2b7735[_0x78ac('0x16')]?_0x2b7735[_0x78ac('0x16')][_0x78ac('0x17')]===undefined?!![]:![]:!![],'where':_0x2b7735[_0x78ac('0x16')]?_0x2b7735[_0x78ac('0x16')][_0x78ac('0x18')]||null:null,'attributes':_0x2b7735[_0x78ac('0x16')]?_0x2b7735[_0x78ac('0x16')][_0x78ac('0x19')]||null:null,'limit':_0x2b7735[_0x78ac('0x16')]?_0x2b7735[_0x78ac('0x16')]['limit']||null:null,'include':_0x2b7735[_0x78ac('0x16')]?_0x2b7735[_0x78ac('0x16')][_0x78ac('0x1a')]?_['map'](_0x2b7735[_0x78ac('0x16')][_0x78ac('0x1a')],function(_0x4c1dde){return{'model':db[_0x4c1dde[_0x78ac('0x1b')]],'as':_0x4c1dde['as'],'attributes':_0x4c1dde[_0x78ac('0x19')],'include':_0x4c1dde[_0x78ac('0x1a')]?_[_0x78ac('0x1c')](_0x4c1dde['include'],function(_0x4fd73f){return{'model':db[_0x4fd73f[_0x78ac('0x1b')]],'as':_0x4fd73f['as'],'attributes':_0x4fd73f['attributes'],'include':_0x4fd73f[_0x78ac('0x1a')]?_[_0x78ac('0x1c')](_0x4fd73f[_0x78ac('0x1a')],function(_0x57a3f0){return{'model':db[_0x57a3f0[_0x78ac('0x1b')]],'as':_0x57a3f0['as'],'attributes':_0x57a3f0['attributes']};}):[]};}):[]};}):[]:[]})[_0x78ac('0xc')](function(_0x4d65f2){logger[_0x78ac('0xd')](_0x78ac('0x14'),_0x2b7735);logger['debug'](_0x78ac('0x14'),_0x2b7735,JSON['stringify'](_0x4d65f2));_0x486b32(_0x4d65f2);})[_0x78ac('0x1d')](function(_0x37b28c){logger[_0x78ac('0x12')](_0x78ac('0x14'),_0x37b28c[_0x78ac('0x13')],_0x2b7735);_0x3e8ec9(_0xbf7fa8[_0x78ac('0x12')](0x1f4,_0x37b28c[_0x78ac('0x13')]));});});};exports[_0x78ac('0x1e')]=function(_0x11d0cd){var _0x46bc27=this;return new Promise(function(_0x591ee7,_0x211ab1){return db[_0x78ac('0x15')][_0x78ac('0x1f')]({'raw':_0x11d0cd['options']?_0x11d0cd[_0x78ac('0x16')][_0x78ac('0x17')]===undefined?!![]:![]:!![],'where':_0x11d0cd[_0x78ac('0x16')]?_0x11d0cd[_0x78ac('0x16')][_0x78ac('0x18')]||null:null,'attributes':_0x11d0cd[_0x78ac('0x16')]?_0x11d0cd[_0x78ac('0x16')][_0x78ac('0x19')]||null:null,'include':_0x11d0cd[_0x78ac('0x16')]?_0x11d0cd[_0x78ac('0x16')][_0x78ac('0x1a')]?_['map'](_0x11d0cd[_0x78ac('0x16')]['include'],function(_0x113400){return{'model':db[_0x113400[_0x78ac('0x1b')]],'as':_0x113400['as'],'attributes':_0x113400[_0x78ac('0x19')],'include':_0x113400[_0x78ac('0x1a')]?_['map'](_0x113400[_0x78ac('0x1a')],function(_0x18cd7b){return{'model':db[_0x18cd7b['model']],'as':_0x18cd7b['as'],'attributes':_0x18cd7b[_0x78ac('0x19')],'include':_0x18cd7b[_0x78ac('0x1a')]?_['map'](_0x18cd7b[_0x78ac('0x1a')],function(_0x350b03){return{'model':db[_0x350b03[_0x78ac('0x1b')]],'as':_0x350b03['as'],'attributes':_0x350b03[_0x78ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0x78ac('0xc')](function(_0x345c83){logger[_0x78ac('0xd')]('ShowVtigerAccount',_0x11d0cd);logger['debug']('ShowVtigerAccount',_0x11d0cd,JSON[_0x78ac('0x11')](_0x345c83));_0x591ee7(_0x345c83);})[_0x78ac('0x1d')](function(_0x2866bf){logger[_0x78ac('0x12')](_0x78ac('0x1e'),_0x2866bf[_0x78ac('0x13')],_0x11d0cd);_0x211ab1(_0x46bc27[_0x78ac('0x12')](0x1f4,_0x2866bf[_0x78ac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ecc4290..bcc1d63 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 _0xcb91=['/:id/descriptions','getDescriptions','post','create','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xcb91[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/fields',auth[_0x1cb9('0x7')](),controller['getFields']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x6')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x11')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe706=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put'];(function(_0x4c8232,_0x4e0dea){var _0x3cc8e5=function(_0x248561){while(--_0x248561){_0x4c8232['push'](_0x4c8232['shift']());}};_0x3cc8e5(++_0x4e0dea);}(_0xe706,0xa3));var _0x6e70=function(_0xfa716b,_0x1fa236){_0xfa716b=_0xfa716b-0x0;var _0xe946ab=_0xe706[_0xfa716b];return _0xe946ab;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router[_0x6e70('0x14')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 27e165d..452501f 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 _0xecca=['exports'];(function(_0x50b875,_0x5a9f1f){var _0x5d5baf=function(_0x3641f7){while(--_0x3641f7){_0x50b875['push'](_0x50b875['shift']());}};_0x5d5baf(++_0x5a9f1f);}(_0xecca,0x1c1));var _0xaecc=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xecca[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require('sequelize');module[_0xaecc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x587f=['sequelize'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x587f,0x18e));var _0xf587=function(_0x2803dc,_0x1cdaf1){_0x2803dc=_0x2803dc-0x0;var _0x552ae4=_0x587f[_0x2803dc];return _0x552ae4;};'use strict';var Sequelize=require(_0xf587('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e53e0cf..3135373 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 _0x826a=['jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','params','length','body','find','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x826a,0x1aa));var _0xa826=function(_0x301502,_0x174937){_0x301502=_0x301502-0x0;var _0x263e3e=_0x826a[_0x301502];return _0x263e3e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa826('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa826('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa826('0x2'));var moment=require(_0xa826('0x3'));var BPromise=require(_0xa826('0x4'));var Mustache=require(_0xa826('0x5'));var util=require('util');var path=require(_0xa826('0x6'));var sox=require(_0xa826('0x7'));var csv=require(_0xa826('0x8'));var ejs=require(_0xa826('0x9'));var fs=require('fs');var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x8'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var hardwareService=require(_0xa826('0x14'));var logger=require('../../config/logger')(_0xa826('0x15'));var utils=require('../../config/utils');var config=require(_0xa826('0x16'));var db=require(_0xa826('0x17'))['db'];var jayson=require(_0xa826('0x18'));var client=jayson[_0xa826('0x19')][_0xa826('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x40838f,_0x2f1d39,_0x528cb8){if(_0x528cb8){var _0x74f6ec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x74f6ec['test'](_0x2f1d39)){return _0x40838f;}else{throw new Error(_0xa826('0x1b'));}}else{return _0x40838f;}}function respondWithRpcPromise(_0x41c0c2,_0x5dc0c7,_0x512ba9,_0x49c91e){return new BPromise(function(_0x1b6d16,_0x4f25bd){var _0x4c546b=_0x49c91e||client;return _0x4c546b[_0xa826('0x1c')](_0x41c0c2,_0x512ba9)[_0xa826('0x1d')](function(_0x2e15e2){logger['info'](_0xa826('0x1e'),_0x5dc0c7,_0xa826('0x1f'));logger[_0xa826('0x20')](_0xa826('0x21'),_0x5dc0c7,_0xa826('0x1f'),JSON['stringify'](_0x2e15e2));if(_0x2e15e2[_0xa826('0x22')]){if(_0x2e15e2[_0xa826('0x22')][_0xa826('0x23')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x5dc0c7,_0x2e15e2[_0xa826('0x22')][_0xa826('0x24')]);return _0x4f25bd(_0x2e15e2[_0xa826('0x22')][_0xa826('0x24')]);}logger[_0xa826('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x5dc0c7,_0x2e15e2[_0xa826('0x22')][_0xa826('0x24')]);return _0x1b6d16(_0x2e15e2[_0xa826('0x22')]['message']);}else{logger['info'](_0xa826('0x1e'),_0x5dc0c7,_0xa826('0x1f'));_0x1b6d16(_0x2e15e2[_0xa826('0x25')]['message']);}})[_0xa826('0x26')](function(_0x26ef25){logger[_0xa826('0x22')](_0xa826('0x1e'),_0x5dc0c7,_0x26ef25);_0x4f25bd(_0x26ef25);});});}function respondWithStatusCode(_0x1ec8a8,_0x4d6909){_0x4d6909=_0x4d6909||0xcc;return function(_0x13329a){if(_0x13329a){return _0x1ec8a8['sendStatus'](_0x4d6909);}return _0x1ec8a8[_0xa826('0x27')](_0x4d6909)[_0xa826('0x28')]();};}function respondWithResult(_0x51de9a,_0xfc0448){_0xfc0448=_0xfc0448||0xc8;return function(_0xfa4d94){if(_0xfa4d94){return _0x51de9a[_0xa826('0x27')](_0xfc0448)[_0xa826('0x29')](_0xfa4d94);}};}function respondWithFilteredResult(_0x1107a4,_0x3c6307){return function(_0x14e836){if(_0x14e836){var _0x3b9c6d=_0x14e836[_0xa826('0x2a')],_0x36ded2=_0x3c6307[_0xa826('0x2b')],_0x3d126c=_0x3c6307[_0xa826('0x2b')]+_0x3c6307[_0xa826('0x2c')],_0x1e35de;if(_0x3d126c>=_0x3b9c6d){_0x3d126c=_0x3b9c6d;_0x1e35de=0xc8;}else{_0x1e35de=0xce;}_0x1107a4[_0xa826('0x27')](_0x1e35de);return _0x1107a4['set'](_0xa826('0x2d'),_0x36ded2+'-'+_0x3d126c+'/'+_0x3b9c6d)['json'](_0x14e836);}return null;};}function patchUpdates(_0x2dd810){return function(_0x1b5160){try{jsonpatch[_0xa826('0x2e')](_0x1b5160,_0x2dd810,!![]);}catch(_0x27d779){return BPromise[_0xa826('0x2f')](_0x27d779);}return _0x1b5160['save']();};}function saveUpdates(_0x4e04e8,_0x41ecbf){return function(_0x6bf769){if(_0x6bf769){return _0x6bf769[_0xa826('0x30')](_0x4e04e8)[_0xa826('0x1d')](function(_0x4cec68){return _0x4cec68;});}return null;};}function removeEntity(_0x3d210f,_0x3e308d){return function(_0x5a3fa3){if(_0x5a3fa3){return _0x5a3fa3[_0xa826('0x31')]()['then'](function(){_0x3d210f[_0xa826('0x27')](0xcc)[_0xa826('0x28')]();});}};}function handleEntityNotFound(_0x1b41d8,_0x16700f){return function(_0x24efa7){if(!_0x24efa7){_0x1b41d8['sendStatus'](0x194);}return _0x24efa7;};}function handleError(_0x16f535,_0x250583){_0x250583=_0x250583||0x1f4;return function(_0x29404c){logger[_0xa826('0x22')](_0x29404c[_0xa826('0x32')]);if(_0x29404c[_0xa826('0x33')]){delete _0x29404c[_0xa826('0x33')];}_0x16f535[_0xa826('0x27')](_0x250583)[_0xa826('0x34')](_0x29404c);};}exports[_0xa826('0x35')]=function(_0xd82ea2,_0x5e5916){var _0x46f50e={},_0x4d8b06={},_0x3828a6={'count':0x0,'rows':[]};var _0x4d8c2a=db[_0xa826('0x36')][_0xa826('0x37')];_0x4d8b06[_0xa826('0x38')]=_[_0xa826('0x39')](_0x4d8c2a);_0x4d8b06[_0xa826('0x3a')]=_[_0xa826('0x39')](_0xd82ea2[_0xa826('0x3a')]);_0x4d8b06[_0xa826('0x3b')]=_[_0xa826('0x3c')](_0x4d8b06[_0xa826('0x38')],_0x4d8b06[_0xa826('0x3a')]);_0x46f50e[_0xa826('0x3d')]=_['intersection'](_0x4d8b06[_0xa826('0x38')],qs[_0xa826('0x3e')](_0xd82ea2[_0xa826('0x3a')]['fields']));_0x46f50e[_0xa826('0x3d')]=_0x46f50e[_0xa826('0x3d')]['length']?_0x46f50e[_0xa826('0x3d')]:_0x4d8b06['model'];if(!_0xd82ea2['query'][_0xa826('0x3f')](_0xa826('0x40'))){_0x46f50e[_0xa826('0x2c')]=qs[_0xa826('0x2c')](_0xd82ea2[_0xa826('0x3a')][_0xa826('0x2c')]);_0x46f50e['offset']=qs[_0xa826('0x2b')](_0xd82ea2[_0xa826('0x3a')][_0xa826('0x2b')]);}_0x46f50e[_0xa826('0x41')]=qs[_0xa826('0x42')](_0xd82ea2[_0xa826('0x3a')]['sort']);_0x46f50e[_0xa826('0x43')]=qs[_0xa826('0x3b')](_[_0xa826('0x44')](_0xd82ea2[_0xa826('0x3a')],_0x4d8b06[_0xa826('0x3b')]));if(_0xd82ea2['query'][_0xa826('0x45')]){_0x46f50e[_0xa826('0x43')]=_[_0xa826('0x46')](_0x46f50e[_0xa826('0x43')],{'$or':_[_0xa826('0x47')](_0x4d8c2a,function(_0x1fdc39){if(_0x1fdc39[_0xa826('0x48')][_0xa826('0x49')]!==_0xa826('0x4a')){var _0x2b0613={};_0x2b0613[_0x1fdc39[_0xa826('0x4b')]]={'$like':'%'+_0xd82ea2[_0xa826('0x3a')]['filter']+'%'};return _0x2b0613;}})});}_0x46f50e=_[_0xa826('0x46')]({},_0x46f50e,_0xd82ea2[_0xa826('0x4c')]);var _0x19e96d={'where':_0x46f50e['where']};return db[_0xa826('0x36')][_0xa826('0x2a')](_0x19e96d)[_0xa826('0x1d')](function(_0x3e98c2){_0x3828a6[_0xa826('0x2a')]=_0x3e98c2;if(_0xd82ea2['query'][_0xa826('0x4d')]){_0x46f50e[_0xa826('0x4e')]=[{'all':!![]}];}return db[_0xa826('0x36')][_0xa826('0x4f')](_0x46f50e);})[_0xa826('0x1d')](function(_0x30aac0){_0x3828a6[_0xa826('0x50')]=_0x30aac0;return _0x3828a6;})['then'](respondWithFilteredResult(_0x5e5916,_0x46f50e))[_0xa826('0x26')](handleError(_0x5e5916,null));};exports['show']=function(_0x4f953b,_0x4b4352){var _0x26a858={'raw':![],'where':{'id':_0x4f953b[_0xa826('0x51')]['id']}},_0x35d118={};_0x35d118[_0xa826('0x38')]=_['keys'](db[_0xa826('0x36')]['rawAttributes']);_0x35d118['query']=_[_0xa826('0x39')](_0x4f953b[_0xa826('0x3a')]);_0x35d118['filters']=_[_0xa826('0x3c')](_0x35d118[_0xa826('0x38')],_0x35d118['query']);_0x26a858['attributes']=_['intersection'](_0x35d118['model'],qs['fields'](_0x4f953b['query']['fields']));_0x26a858[_0xa826('0x3d')]=_0x26a858['attributes'][_0xa826('0x52')]?_0x26a858['attributes']:_0x35d118[_0xa826('0x38')];if(_0x4f953b[_0xa826('0x3a')][_0xa826('0x4d')]){_0x26a858[_0xa826('0x4e')]=[{'all':!![]}];}_0x26a858=_[_0xa826('0x46')]({},_0x26a858,_0x4f953b['options']);return db[_0xa826('0x36')]['find'](_0x26a858)['then'](handleEntityNotFound(_0x4b4352,null))[_0xa826('0x1d')](respondWithResult(_0x4b4352,null))[_0xa826('0x26')](handleError(_0x4b4352,null));};exports['create']=function(_0x1c7d5c,_0x424de7){return db[_0xa826('0x36')]['create'](_0x1c7d5c[_0xa826('0x53')],{})[_0xa826('0x1d')](respondWithResult(_0x424de7,0xc9))[_0xa826('0x26')](handleError(_0x424de7,null));};exports[_0xa826('0x30')]=function(_0x3806a5,_0x45be13){if(_0x3806a5[_0xa826('0x53')]['id']){delete _0x3806a5[_0xa826('0x53')]['id'];}return db['VtigerConfiguration'][_0xa826('0x54')]({'where':{'id':_0x3806a5[_0xa826('0x51')]['id']}})[_0xa826('0x1d')](handleEntityNotFound(_0x45be13,null))[_0xa826('0x1d')](saveUpdates(_0x3806a5[_0xa826('0x53')],null))['then'](respondWithResult(_0x45be13,null))[_0xa826('0x26')](handleError(_0x45be13,null));};exports[_0xa826('0x31')]=function(_0x2f2ee5,_0x5a1362){return db[_0xa826('0x36')][_0xa826('0x54')]({'where':{'id':_0x2f2ee5['params']['id']}})[_0xa826('0x1d')](handleEntityNotFound(_0x5a1362,null))[_0xa826('0x1d')](removeEntity(_0x5a1362,null))[_0xa826('0x26')](handleError(_0x5a1362,null));};exports[_0xa826('0x55')]=function(_0x334bd2,_0x1cd351,_0x21469f){var _0x115337={};var _0x1d5ad1={};var _0x2287ea;var _0x1745ea;return db['VtigerConfiguration'][_0xa826('0x56')]({'where':{'id':_0x334bd2[_0xa826('0x51')]['id']}})[_0xa826('0x1d')](handleEntityNotFound(_0x1cd351,null))[_0xa826('0x1d')](function(_0x29ed95){if(_0x29ed95){_0x2287ea=_0x29ed95;_0x1d5ad1[_0xa826('0x38')]=_[_0xa826('0x39')](db[_0xa826('0x57')]['rawAttributes']);_0x1d5ad1[_0xa826('0x3a')]=_[_0xa826('0x39')](_0x334bd2[_0xa826('0x3a')]);_0x1d5ad1['filters']=_[_0xa826('0x3c')](_0x1d5ad1[_0xa826('0x38')],_0x1d5ad1[_0xa826('0x3a')]);_0x115337['attributes']=_['intersection'](_0x1d5ad1[_0xa826('0x38')],qs[_0xa826('0x3e')](_0x334bd2[_0xa826('0x3a')][_0xa826('0x3e')]));_0x115337['attributes']=_0x115337[_0xa826('0x3d')][_0xa826('0x52')]?_0x115337[_0xa826('0x3d')]:_0x1d5ad1[_0xa826('0x38')];_0x115337[_0xa826('0x41')]=qs[_0xa826('0x42')](_0x334bd2[_0xa826('0x3a')][_0xa826('0x42')]);_0x115337[_0xa826('0x43')]=qs['filters'](_['pick'](_0x334bd2['query'],_0x1d5ad1['filters']));if(_0x334bd2[_0xa826('0x3a')][_0xa826('0x45')]){_0x115337[_0xa826('0x43')]=_[_0xa826('0x46')](_0x115337[_0xa826('0x43')],{'$or':_[_0xa826('0x47')](_0x115337['attributes'],function(_0x192cba){var _0x3da3f5={};_0x3da3f5[_0x192cba]={'$like':'%'+_0x334bd2[_0xa826('0x3a')]['filter']+'%'};return _0x3da3f5;})});}_0x115337=_[_0xa826('0x46')]({},_0x115337,_0x334bd2[_0xa826('0x4c')]);return _0x2287ea[_0xa826('0x55')](_0x115337);}})[_0xa826('0x1d')](function(_0x3e4adb){if(_0x3e4adb){_0x1745ea=_0x3e4adb[_0xa826('0x52')];if(!_0x334bd2[_0xa826('0x3a')][_0xa826('0x3f')](_0xa826('0x40'))){_0x115337[_0xa826('0x2c')]=qs[_0xa826('0x2c')](_0x334bd2[_0xa826('0x3a')][_0xa826('0x2c')]);_0x115337[_0xa826('0x2b')]=qs[_0xa826('0x2b')](_0x334bd2['query'][_0xa826('0x2b')]);}return _0x2287ea['getFields'](_0x115337);}})[_0xa826('0x1d')](function(_0x52f377){if(_0x52f377){return _0x52f377?{'count':_0x1745ea,'rows':_0x52f377}:null;}})[_0xa826('0x1d')](respondWithResult(_0x1cd351,null))['catch'](handleError(_0x1cd351,null));};exports[_0xa826('0x58')]=function(_0x3036e5,_0x46cc87,_0x545eaa){var _0x5d41f8={};var _0x5ea2d2={};var _0x16222c;var _0x281f63;return db[_0xa826('0x36')]['findOne']({'where':{'id':_0x3036e5[_0xa826('0x51')]['id']}})[_0xa826('0x1d')](handleEntityNotFound(_0x46cc87,null))[_0xa826('0x1d')](function(_0x425fe2){if(_0x425fe2){_0x16222c=_0x425fe2;_0x5ea2d2['model']=_[_0xa826('0x39')](db[_0xa826('0x57')][_0xa826('0x37')]);_0x5ea2d2[_0xa826('0x3a')]=_[_0xa826('0x39')](_0x3036e5['query']);_0x5ea2d2['filters']=_[_0xa826('0x3c')](_0x5ea2d2[_0xa826('0x38')],_0x5ea2d2[_0xa826('0x3a')]);_0x5d41f8[_0xa826('0x3d')]=_[_0xa826('0x3c')](_0x5ea2d2['model'],qs['fields'](_0x3036e5[_0xa826('0x3a')][_0xa826('0x3e')]));_0x5d41f8[_0xa826('0x3d')]=_0x5d41f8[_0xa826('0x3d')][_0xa826('0x52')]?_0x5d41f8[_0xa826('0x3d')]:_0x5ea2d2['model'];_0x5d41f8[_0xa826('0x41')]=qs['sort'](_0x3036e5[_0xa826('0x3a')][_0xa826('0x42')]);_0x5d41f8['where']=qs[_0xa826('0x3b')](_['pick'](_0x3036e5[_0xa826('0x3a')],_0x5ea2d2['filters']));if(_0x3036e5[_0xa826('0x3a')][_0xa826('0x45')]){_0x5d41f8[_0xa826('0x43')]=_[_0xa826('0x46')](_0x5d41f8[_0xa826('0x43')],{'$or':_[_0xa826('0x47')](_0x5d41f8['attributes'],function(_0x5c92ce){var _0x575804={};_0x575804[_0x5c92ce]={'$like':'%'+_0x3036e5['query'][_0xa826('0x45')]+'%'};return _0x575804;})});}_0x5d41f8=_[_0xa826('0x46')]({},_0x5d41f8,_0x3036e5[_0xa826('0x4c')]);return _0x16222c['getSubjects'](_0x5d41f8);}})[_0xa826('0x1d')](function(_0x3c4ea8){if(_0x3c4ea8){_0x281f63=_0x3c4ea8[_0xa826('0x52')];if(!_0x3036e5[_0xa826('0x3a')][_0xa826('0x3f')]('nolimit')){_0x5d41f8[_0xa826('0x2c')]=qs[_0xa826('0x2c')](_0x3036e5[_0xa826('0x3a')][_0xa826('0x2c')]);_0x5d41f8[_0xa826('0x2b')]=qs[_0xa826('0x2b')](_0x3036e5[_0xa826('0x3a')][_0xa826('0x2b')]);}return _0x16222c[_0xa826('0x58')](_0x5d41f8);}})[_0xa826('0x1d')](function(_0x4d0fcd){if(_0x4d0fcd){return _0x4d0fcd?{'count':_0x281f63,'rows':_0x4d0fcd}:null;}})[_0xa826('0x1d')](respondWithResult(_0x46cc87,null))[_0xa826('0x26')](handleError(_0x46cc87,null));};exports['getDescriptions']=function(_0x5e0468,_0x28aabc,_0x27bc6e){var _0x5a152a={};var _0x1d26c7={};var _0x5fc4ad;var _0x336ca8;return db[_0xa826('0x36')]['findOne']({'where':{'id':_0x5e0468['params']['id']}})[_0xa826('0x1d')](handleEntityNotFound(_0x28aabc,null))[_0xa826('0x1d')](function(_0x4fb14a){if(_0x4fb14a){_0x5fc4ad=_0x4fb14a;_0x1d26c7[_0xa826('0x38')]=_[_0xa826('0x39')](db[_0xa826('0x57')][_0xa826('0x37')]);_0x1d26c7[_0xa826('0x3a')]=_[_0xa826('0x39')](_0x5e0468[_0xa826('0x3a')]);_0x1d26c7[_0xa826('0x3b')]=_['intersection'](_0x1d26c7[_0xa826('0x38')],_0x1d26c7[_0xa826('0x3a')]);_0x5a152a[_0xa826('0x3d')]=_[_0xa826('0x3c')](_0x1d26c7['model'],qs[_0xa826('0x3e')](_0x5e0468[_0xa826('0x3a')][_0xa826('0x3e')]));_0x5a152a[_0xa826('0x3d')]=_0x5a152a[_0xa826('0x3d')][_0xa826('0x52')]?_0x5a152a[_0xa826('0x3d')]:_0x1d26c7['model'];_0x5a152a[_0xa826('0x41')]=qs[_0xa826('0x42')](_0x5e0468[_0xa826('0x3a')][_0xa826('0x42')]);_0x5a152a[_0xa826('0x43')]=qs[_0xa826('0x3b')](_['pick'](_0x5e0468[_0xa826('0x3a')],_0x1d26c7[_0xa826('0x3b')]));if(_0x5e0468[_0xa826('0x3a')]['filter']){_0x5a152a[_0xa826('0x43')]=_[_0xa826('0x46')](_0x5a152a[_0xa826('0x43')],{'$or':_[_0xa826('0x47')](_0x5a152a['attributes'],function(_0x2117e5){var _0x354a12={};_0x354a12[_0x2117e5]={'$like':'%'+_0x5e0468['query'][_0xa826('0x45')]+'%'};return _0x354a12;})});}_0x5a152a=_['merge']({},_0x5a152a,_0x5e0468[_0xa826('0x4c')]);return _0x5fc4ad[_0xa826('0x59')](_0x5a152a);}})[_0xa826('0x1d')](function(_0x2de5c0){if(_0x2de5c0){_0x336ca8=_0x2de5c0[_0xa826('0x52')];if(!_0x5e0468[_0xa826('0x3a')]['hasOwnProperty'](_0xa826('0x40'))){_0x5a152a[_0xa826('0x2c')]=qs[_0xa826('0x2c')](_0x5e0468[_0xa826('0x3a')]['limit']);_0x5a152a[_0xa826('0x2b')]=qs[_0xa826('0x2b')](_0x5e0468[_0xa826('0x3a')][_0xa826('0x2b')]);}return _0x5fc4ad[_0xa826('0x59')](_0x5a152a);}})[_0xa826('0x1d')](function(_0x3329ce){if(_0x3329ce){return _0x3329ce?{'count':_0x336ca8,'rows':_0x3329ce}:null;}})[_0xa826('0x1d')](respondWithResult(_0x28aabc,null))['catch'](handleError(_0x28aabc,null));}; \ No newline at end of file +var _0x5178=['body','getFields','findOne','VtigerField','pick','options','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','name','index','VtigerConfiguration','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','params','find','create'];(function(_0x246f57,_0x2fdf0a){var _0x565d50=function(_0xd0439e){while(--_0xd0439e){_0x246f57['push'](_0x246f57['shift']());}};_0x565d50(++_0x2fdf0a);}(_0x5178,0x171));var _0x8517=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5178[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8517('0x0'));var rimraf=require(_0x8517('0x1'));var zipdir=require(_0x8517('0x2'));var jsonpatch=require(_0x8517('0x3'));var rp=require(_0x8517('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8517('0x5'));var util=require(_0x8517('0x6'));var path=require('path');var sox=require(_0x8517('0x7'));var csv=require('to-csv');var ejs=require(_0x8517('0x8'));var fs=require('fs');var _=require(_0x8517('0x9'));var squel=require(_0x8517('0xa'));var crypto=require(_0x8517('0xb'));var jsforce=require(_0x8517('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8517('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8517('0xe'));var authService=require(_0x8517('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x8517('0x10'));var logger=require(_0x8517('0x11'))(_0x8517('0x12'));var utils=require(_0x8517('0x13'));var config=require(_0x8517('0x14'));var db=require(_0x8517('0x15'))['db'];var jayson=require(_0x8517('0x16'));var client=jayson[_0x8517('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x9c57de,_0x7f429a,_0x268128){if(_0x268128){var _0x170214=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x170214[_0x8517('0x18')](_0x7f429a)){return _0x9c57de;}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 _0x9c57de;}}function respondWithRpcPromise(_0x385219,_0x19dd9d,_0x126e0b,_0x100280){return new BPromise(function(_0x411d29,_0x18a984){var _0x260a15=_0x100280||client;return _0x260a15[_0x8517('0x19')](_0x385219,_0x126e0b)[_0x8517('0x1a')](function(_0x2953dd){logger[_0x8517('0x1b')](_0x8517('0x1c'),_0x19dd9d,'request\x20sent');logger[_0x8517('0x1d')](_0x8517('0x1e'),_0x19dd9d,_0x8517('0x1f'),JSON[_0x8517('0x20')](_0x2953dd));if(_0x2953dd[_0x8517('0x21')]){if(_0x2953dd[_0x8517('0x21')][_0x8517('0x22')]===0x1f4){logger['error'](_0x8517('0x1c'),_0x19dd9d,_0x2953dd['error']['message']);return _0x18a984(_0x2953dd[_0x8517('0x21')][_0x8517('0x23')]);}logger[_0x8517('0x21')](_0x8517('0x1c'),_0x19dd9d,_0x2953dd[_0x8517('0x21')][_0x8517('0x23')]);return _0x411d29(_0x2953dd['error']['message']);}else{logger[_0x8517('0x1b')](_0x8517('0x1c'),_0x19dd9d,_0x8517('0x1f'));_0x411d29(_0x2953dd[_0x8517('0x24')][_0x8517('0x23')]);}})[_0x8517('0x25')](function(_0x5f02ee){logger[_0x8517('0x21')](_0x8517('0x1c'),_0x19dd9d,_0x5f02ee);_0x18a984(_0x5f02ee);});});}function respondWithStatusCode(_0x5578f0,_0x7f4cf8){_0x7f4cf8=_0x7f4cf8||0xcc;return function(_0x2febd5){if(_0x2febd5){return _0x5578f0[_0x8517('0x26')](_0x7f4cf8);}return _0x5578f0['status'](_0x7f4cf8)[_0x8517('0x27')]();};}function respondWithResult(_0x572ce4,_0x2880b6){_0x2880b6=_0x2880b6||0xc8;return function(_0x2a2b7e){if(_0x2a2b7e){return _0x572ce4[_0x8517('0x28')](_0x2880b6)[_0x8517('0x29')](_0x2a2b7e);}};}function respondWithFilteredResult(_0x238f2c,_0x300e3f){return function(_0x481ceb){if(_0x481ceb){var _0x39764e=_0x481ceb[_0x8517('0x2a')],_0x51d516=_0x300e3f[_0x8517('0x2b')],_0x197aaf=_0x300e3f[_0x8517('0x2b')]+_0x300e3f[_0x8517('0x2c')],_0x70ee9d;if(_0x197aaf>=_0x39764e){_0x197aaf=_0x39764e;_0x70ee9d=0xc8;}else{_0x70ee9d=0xce;}_0x238f2c['status'](_0x70ee9d);return _0x238f2c[_0x8517('0x2d')]('Content-Range',_0x51d516+'-'+_0x197aaf+'/'+_0x39764e)[_0x8517('0x29')](_0x481ceb);}return null;};}function patchUpdates(_0x4b9983){return function(_0x1dd9fb){try{jsonpatch[_0x8517('0x2e')](_0x1dd9fb,_0x4b9983,!![]);}catch(_0x3cf945){return BPromise[_0x8517('0x2f')](_0x3cf945);}return _0x1dd9fb[_0x8517('0x30')]();};}function saveUpdates(_0x4100d5,_0x647d81){return function(_0x559707){if(_0x559707){return _0x559707[_0x8517('0x31')](_0x4100d5)[_0x8517('0x1a')](function(_0x773e3c){return _0x773e3c;});}return null;};}function removeEntity(_0x53c009,_0x5db173){return function(_0x5cb78c){if(_0x5cb78c){return _0x5cb78c[_0x8517('0x32')]()[_0x8517('0x1a')](function(){_0x53c009[_0x8517('0x28')](0xcc)[_0x8517('0x27')]();});}};}function handleEntityNotFound(_0x5ed2a9,_0x254566){return function(_0x5d9d04){if(!_0x5d9d04){_0x5ed2a9[_0x8517('0x26')](0x194);}return _0x5d9d04;};}function handleError(_0x234da4,_0x3fc3aa){_0x3fc3aa=_0x3fc3aa||0x1f4;return function(_0x55785d){logger[_0x8517('0x21')](_0x55785d['stack']);if(_0x55785d[_0x8517('0x33')]){delete _0x55785d[_0x8517('0x33')];}_0x234da4['status'](_0x3fc3aa)['send'](_0x55785d);};}exports[_0x8517('0x34')]=function(_0x27edbe,_0x2c1292){var _0x67c412={},_0x4f93bd={},_0x5b1d34={'count':0x0,'rows':[]};var _0x2cb889=db[_0x8517('0x35')][_0x8517('0x36')];_0x4f93bd['model']=_[_0x8517('0x37')](_0x2cb889);_0x4f93bd[_0x8517('0x38')]=_['keys'](_0x27edbe[_0x8517('0x38')]);_0x4f93bd[_0x8517('0x39')]=_[_0x8517('0x3a')](_0x4f93bd[_0x8517('0x3b')],_0x4f93bd['query']);_0x67c412[_0x8517('0x3c')]=_[_0x8517('0x3a')](_0x4f93bd[_0x8517('0x3b')],qs[_0x8517('0x3d')](_0x27edbe[_0x8517('0x38')][_0x8517('0x3d')]));_0x67c412[_0x8517('0x3c')]=_0x67c412[_0x8517('0x3c')][_0x8517('0x3e')]?_0x67c412[_0x8517('0x3c')]:_0x4f93bd[_0x8517('0x3b')];if(!_0x27edbe[_0x8517('0x38')][_0x8517('0x3f')]('nolimit')){_0x67c412['limit']=qs[_0x8517('0x2c')](_0x27edbe[_0x8517('0x38')][_0x8517('0x2c')]);_0x67c412[_0x8517('0x2b')]=qs[_0x8517('0x2b')](_0x27edbe['query'][_0x8517('0x2b')]);}_0x67c412[_0x8517('0x40')]=qs['sort'](_0x27edbe[_0x8517('0x38')][_0x8517('0x41')]);_0x67c412[_0x8517('0x42')]=qs[_0x8517('0x39')](_['pick'](_0x27edbe[_0x8517('0x38')],_0x4f93bd[_0x8517('0x39')]));if(_0x27edbe['query'][_0x8517('0x43')]){_0x67c412[_0x8517('0x42')]=_[_0x8517('0x44')](_0x67c412['where'],{'$or':_[_0x8517('0x45')](_0x2cb889,function(_0x31c0b9){if(_0x31c0b9[_0x8517('0x46')][_0x8517('0x47')]!==_0x8517('0x48')){var _0x1f4648={};_0x1f4648[_0x31c0b9[_0x8517('0x49')]]={'$like':'%'+_0x27edbe['query'][_0x8517('0x43')]+'%'};return _0x1f4648;}})});}_0x67c412=_[_0x8517('0x44')]({},_0x67c412,_0x27edbe['options']);var _0x326323={'where':_0x67c412[_0x8517('0x42')]};return db[_0x8517('0x35')][_0x8517('0x2a')](_0x326323)[_0x8517('0x1a')](function(_0x29ab7b){_0x5b1d34['count']=_0x29ab7b;if(_0x27edbe[_0x8517('0x38')][_0x8517('0x4a')]){_0x67c412[_0x8517('0x4b')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x8517('0x4c')](_0x67c412);})[_0x8517('0x1a')](function(_0x56d08b){_0x5b1d34[_0x8517('0x4d')]=_0x56d08b;return _0x5b1d34;})[_0x8517('0x1a')](respondWithFilteredResult(_0x2c1292,_0x67c412))['catch'](handleError(_0x2c1292,null));};exports['show']=function(_0x560e3a,_0x1dd87c){var _0x250a14={'raw':![],'where':{'id':_0x560e3a[_0x8517('0x4e')]['id']}},_0x4ec257={};_0x4ec257['model']=_['keys'](db[_0x8517('0x35')][_0x8517('0x36')]);_0x4ec257[_0x8517('0x38')]=_[_0x8517('0x37')](_0x560e3a['query']);_0x4ec257[_0x8517('0x39')]=_[_0x8517('0x3a')](_0x4ec257[_0x8517('0x3b')],_0x4ec257['query']);_0x250a14[_0x8517('0x3c')]=_[_0x8517('0x3a')](_0x4ec257[_0x8517('0x3b')],qs[_0x8517('0x3d')](_0x560e3a[_0x8517('0x38')][_0x8517('0x3d')]));_0x250a14[_0x8517('0x3c')]=_0x250a14['attributes'][_0x8517('0x3e')]?_0x250a14['attributes']:_0x4ec257['model'];if(_0x560e3a[_0x8517('0x38')][_0x8517('0x4a')]){_0x250a14[_0x8517('0x4b')]=[{'all':!![]}];}_0x250a14=_[_0x8517('0x44')]({},_0x250a14,_0x560e3a['options']);return db[_0x8517('0x35')][_0x8517('0x4f')](_0x250a14)['then'](handleEntityNotFound(_0x1dd87c,null))['then'](respondWithResult(_0x1dd87c,null))[_0x8517('0x25')](handleError(_0x1dd87c,null));};exports[_0x8517('0x50')]=function(_0x28c1fb,_0x53b617){return db[_0x8517('0x35')]['create'](_0x28c1fb[_0x8517('0x51')],{})[_0x8517('0x1a')](respondWithResult(_0x53b617,0xc9))[_0x8517('0x25')](handleError(_0x53b617,null));};exports[_0x8517('0x31')]=function(_0x2a2cac,_0x126082){if(_0x2a2cac[_0x8517('0x51')]['id']){delete _0x2a2cac[_0x8517('0x51')]['id'];}return db[_0x8517('0x35')]['find']({'where':{'id':_0x2a2cac['params']['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x126082,null))[_0x8517('0x1a')](saveUpdates(_0x2a2cac[_0x8517('0x51')],null))['then'](respondWithResult(_0x126082,null))[_0x8517('0x25')](handleError(_0x126082,null));};exports[_0x8517('0x32')]=function(_0x445f9b,_0x4cc9e2){return db['VtigerConfiguration'][_0x8517('0x4f')]({'where':{'id':_0x445f9b[_0x8517('0x4e')]['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x4cc9e2,null))[_0x8517('0x1a')](removeEntity(_0x4cc9e2,null))[_0x8517('0x25')](handleError(_0x4cc9e2,null));};exports[_0x8517('0x52')]=function(_0x3d8773,_0x123504,_0xb87fa1){var _0x343b20={};var _0x3f6f67={};var _0x3c5462;var _0xf303bb;return db[_0x8517('0x35')][_0x8517('0x53')]({'where':{'id':_0x3d8773[_0x8517('0x4e')]['id']}})['then'](handleEntityNotFound(_0x123504,null))[_0x8517('0x1a')](function(_0x9b0b48){if(_0x9b0b48){_0x3c5462=_0x9b0b48;_0x3f6f67[_0x8517('0x3b')]=_[_0x8517('0x37')](db[_0x8517('0x54')][_0x8517('0x36')]);_0x3f6f67[_0x8517('0x38')]=_['keys'](_0x3d8773[_0x8517('0x38')]);_0x3f6f67[_0x8517('0x39')]=_[_0x8517('0x3a')](_0x3f6f67[_0x8517('0x3b')],_0x3f6f67[_0x8517('0x38')]);_0x343b20['attributes']=_[_0x8517('0x3a')](_0x3f6f67['model'],qs[_0x8517('0x3d')](_0x3d8773[_0x8517('0x38')][_0x8517('0x3d')]));_0x343b20[_0x8517('0x3c')]=_0x343b20[_0x8517('0x3c')]['length']?_0x343b20[_0x8517('0x3c')]:_0x3f6f67[_0x8517('0x3b')];_0x343b20[_0x8517('0x40')]=qs[_0x8517('0x41')](_0x3d8773['query']['sort']);_0x343b20[_0x8517('0x42')]=qs['filters'](_[_0x8517('0x55')](_0x3d8773[_0x8517('0x38')],_0x3f6f67['filters']));if(_0x3d8773[_0x8517('0x38')][_0x8517('0x43')]){_0x343b20['where']=_[_0x8517('0x44')](_0x343b20[_0x8517('0x42')],{'$or':_[_0x8517('0x45')](_0x343b20[_0x8517('0x3c')],function(_0x836e5d){var _0x30260f={};_0x30260f[_0x836e5d]={'$like':'%'+_0x3d8773[_0x8517('0x38')][_0x8517('0x43')]+'%'};return _0x30260f;})});}_0x343b20=_['merge']({},_0x343b20,_0x3d8773[_0x8517('0x56')]);return _0x3c5462[_0x8517('0x52')](_0x343b20);}})[_0x8517('0x1a')](function(_0x1b9c97){if(_0x1b9c97){_0xf303bb=_0x1b9c97['length'];if(!_0x3d8773[_0x8517('0x38')]['hasOwnProperty'](_0x8517('0x57'))){_0x343b20[_0x8517('0x2c')]=qs[_0x8517('0x2c')](_0x3d8773[_0x8517('0x38')]['limit']);_0x343b20['offset']=qs[_0x8517('0x2b')](_0x3d8773[_0x8517('0x38')][_0x8517('0x2b')]);}return _0x3c5462[_0x8517('0x52')](_0x343b20);}})['then'](function(_0x11a801){if(_0x11a801){return _0x11a801?{'count':_0xf303bb,'rows':_0x11a801}:null;}})[_0x8517('0x1a')](respondWithResult(_0x123504,null))[_0x8517('0x25')](handleError(_0x123504,null));};exports[_0x8517('0x58')]=function(_0x1de091,_0x38f15f,_0x2f105f){var _0x3b7aea={};var _0x3347a9={};var _0x3d089c;var _0x4bdb9f;return db[_0x8517('0x35')][_0x8517('0x53')]({'where':{'id':_0x1de091[_0x8517('0x4e')]['id']}})['then'](handleEntityNotFound(_0x38f15f,null))[_0x8517('0x1a')](function(_0x58f10a){if(_0x58f10a){_0x3d089c=_0x58f10a;_0x3347a9[_0x8517('0x3b')]=_[_0x8517('0x37')](db['VtigerField'][_0x8517('0x36')]);_0x3347a9[_0x8517('0x38')]=_[_0x8517('0x37')](_0x1de091[_0x8517('0x38')]);_0x3347a9[_0x8517('0x39')]=_[_0x8517('0x3a')](_0x3347a9['model'],_0x3347a9[_0x8517('0x38')]);_0x3b7aea['attributes']=_[_0x8517('0x3a')](_0x3347a9[_0x8517('0x3b')],qs[_0x8517('0x3d')](_0x1de091[_0x8517('0x38')]['fields']));_0x3b7aea[_0x8517('0x3c')]=_0x3b7aea[_0x8517('0x3c')][_0x8517('0x3e')]?_0x3b7aea['attributes']:_0x3347a9[_0x8517('0x3b')];_0x3b7aea[_0x8517('0x40')]=qs[_0x8517('0x41')](_0x1de091[_0x8517('0x38')][_0x8517('0x41')]);_0x3b7aea[_0x8517('0x42')]=qs[_0x8517('0x39')](_['pick'](_0x1de091[_0x8517('0x38')],_0x3347a9['filters']));if(_0x1de091['query'][_0x8517('0x43')]){_0x3b7aea[_0x8517('0x42')]=_[_0x8517('0x44')](_0x3b7aea['where'],{'$or':_[_0x8517('0x45')](_0x3b7aea[_0x8517('0x3c')],function(_0x55403d){var _0x1c83e7={};_0x1c83e7[_0x55403d]={'$like':'%'+_0x1de091['query']['filter']+'%'};return _0x1c83e7;})});}_0x3b7aea=_[_0x8517('0x44')]({},_0x3b7aea,_0x1de091[_0x8517('0x56')]);return _0x3d089c[_0x8517('0x58')](_0x3b7aea);}})[_0x8517('0x1a')](function(_0x37896a){if(_0x37896a){_0x4bdb9f=_0x37896a['length'];if(!_0x1de091[_0x8517('0x38')][_0x8517('0x3f')]('nolimit')){_0x3b7aea['limit']=qs[_0x8517('0x2c')](_0x1de091[_0x8517('0x38')][_0x8517('0x2c')]);_0x3b7aea[_0x8517('0x2b')]=qs[_0x8517('0x2b')](_0x1de091[_0x8517('0x38')]['offset']);}return _0x3d089c['getSubjects'](_0x3b7aea);}})[_0x8517('0x1a')](function(_0x1c0cfc){if(_0x1c0cfc){return _0x1c0cfc?{'count':_0x4bdb9f,'rows':_0x1c0cfc}:null;}})['then'](respondWithResult(_0x38f15f,null))[_0x8517('0x25')](handleError(_0x38f15f,null));};exports[_0x8517('0x59')]=function(_0x577a90,_0x3a0597,_0x3304ee){var _0x3c1b7e={};var _0x590a99={};var _0x5195a2;var _0x3cb505;return db[_0x8517('0x35')][_0x8517('0x53')]({'where':{'id':_0x577a90[_0x8517('0x4e')]['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x3a0597,null))['then'](function(_0x782f1d){if(_0x782f1d){_0x5195a2=_0x782f1d;_0x590a99[_0x8517('0x3b')]=_['keys'](db[_0x8517('0x54')][_0x8517('0x36')]);_0x590a99[_0x8517('0x38')]=_[_0x8517('0x37')](_0x577a90[_0x8517('0x38')]);_0x590a99[_0x8517('0x39')]=_[_0x8517('0x3a')](_0x590a99[_0x8517('0x3b')],_0x590a99[_0x8517('0x38')]);_0x3c1b7e[_0x8517('0x3c')]=_[_0x8517('0x3a')](_0x590a99[_0x8517('0x3b')],qs[_0x8517('0x3d')](_0x577a90[_0x8517('0x38')][_0x8517('0x3d')]));_0x3c1b7e[_0x8517('0x3c')]=_0x3c1b7e[_0x8517('0x3c')][_0x8517('0x3e')]?_0x3c1b7e[_0x8517('0x3c')]:_0x590a99['model'];_0x3c1b7e[_0x8517('0x40')]=qs[_0x8517('0x41')](_0x577a90[_0x8517('0x38')][_0x8517('0x41')]);_0x3c1b7e[_0x8517('0x42')]=qs[_0x8517('0x39')](_[_0x8517('0x55')](_0x577a90['query'],_0x590a99[_0x8517('0x39')]));if(_0x577a90[_0x8517('0x38')][_0x8517('0x43')]){_0x3c1b7e[_0x8517('0x42')]=_[_0x8517('0x44')](_0x3c1b7e[_0x8517('0x42')],{'$or':_['map'](_0x3c1b7e[_0x8517('0x3c')],function(_0x360df5){var _0x40ad1e={};_0x40ad1e[_0x360df5]={'$like':'%'+_0x577a90[_0x8517('0x38')][_0x8517('0x43')]+'%'};return _0x40ad1e;})});}_0x3c1b7e=_['merge']({},_0x3c1b7e,_0x577a90[_0x8517('0x56')]);return _0x5195a2[_0x8517('0x59')](_0x3c1b7e);}})[_0x8517('0x1a')](function(_0x26ade2){if(_0x26ade2){_0x3cb505=_0x26ade2['length'];if(!_0x577a90[_0x8517('0x38')]['hasOwnProperty'](_0x8517('0x57'))){_0x3c1b7e[_0x8517('0x2c')]=qs[_0x8517('0x2c')](_0x577a90[_0x8517('0x38')][_0x8517('0x2c')]);_0x3c1b7e[_0x8517('0x2b')]=qs[_0x8517('0x2b')](_0x577a90[_0x8517('0x38')][_0x8517('0x2b')]);}return _0x5195a2['getDescriptions'](_0x3c1b7e);}})[_0x8517('0x1a')](function(_0x23445b){if(_0x23445b){return _0x23445b?{'count':_0x3cb505,'rows':_0x23445b}:null;}})[_0x8517('0x1a')](respondWithResult(_0x3a0597,null))[_0x8517('0x25')](handleError(_0x3a0597,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d7de06e..931d019 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 _0xa9e0=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3f86df,_0x41c257){var _0x290cb1=function(_0x270809){while(--_0x270809){_0x3f86df['push'](_0x3f86df['shift']());}};_0x290cb1(++_0x41c257);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x481f77,_0xb531b6){var _0x3cf417=function(_0x104f0b){while(--_0x104f0b){_0x481f77['push'](_0x481f77['shift']());}};_0x3cf417(++_0xb531b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 122847e..af4a412 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 _0x2c8e=['error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c8e,0x97));var _0xe2c8=function(_0x2def0c,_0x2b9d5f){_0x2def0c=_0x2def0c-0x0;var _0x1c2a60=_0x2c8e[_0x2def0c];return _0x1c2a60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe2c8('0x0'));var BPromise=require(_0xe2c8('0x1'));var rs=require(_0xe2c8('0x2'));var fs=require('fs');var Redis=require(_0xe2c8('0x3'));var db=require(_0xe2c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2c8('0x5'));var config=require(_0xe2c8('0x6'));var jayson=require(_0xe2c8('0x7'));var client=jayson[_0xe2c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40feab,_0x5d1a9c,_0x17bb53){return new BPromise(function(_0x220ea5,_0xf33779){return client[_0xe2c8('0x9')](_0x40feab,_0x17bb53)[_0xe2c8('0xa')](function(_0xe9d23b){logger[_0xe2c8('0xb')](_0xe2c8('0xc'),_0x5d1a9c,_0xe2c8('0xd'));logger[_0xe2c8('0xe')](_0xe2c8('0xf'),_0x5d1a9c,'request\x20sent',JSON[_0xe2c8('0x10')](_0xe9d23b));if(_0xe9d23b[_0xe2c8('0x11')]){if(_0xe9d23b[_0xe2c8('0x11')][_0xe2c8('0x12')]===0x1f4){logger[_0xe2c8('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x5d1a9c,_0xe9d23b[_0xe2c8('0x11')]['message']);return _0xf33779(_0xe9d23b[_0xe2c8('0x11')][_0xe2c8('0x13')]);}logger[_0xe2c8('0x11')](_0xe2c8('0xc'),_0x5d1a9c,_0xe9d23b['error'][_0xe2c8('0x13')]);return _0x220ea5(_0xe9d23b[_0xe2c8('0x11')][_0xe2c8('0x13')]);}else{logger['info'](_0xe2c8('0xc'),_0x5d1a9c,_0xe2c8('0xd'));_0x220ea5(_0xe9d23b[_0xe2c8('0x14')][_0xe2c8('0x13')]);}})['catch'](function(_0x2207a9){logger['error'](_0xe2c8('0xc'),_0x5d1a9c,_0x2207a9);_0xf33779(_0x2207a9);});});} \ No newline at end of file +var _0x9fd3=['VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9fd3,0xc9));var _0x39fd=function(_0xf1aa01,_0x477960){_0xf1aa01=_0xf1aa01-0x0;var _0x2e8946=_0x9fd3[_0xf1aa01];return _0x2e8946;};'use strict';var _=require(_0x39fd('0x0'));var util=require('util');var moment=require(_0x39fd('0x1'));var BPromise=require(_0x39fd('0x2'));var rs=require(_0x39fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39fd('0x4'))['db'];var utils=require(_0x39fd('0x5'));var logger=require(_0x39fd('0x6'))(_0x39fd('0x7'));var config=require(_0x39fd('0x8'));var jayson=require(_0x39fd('0x9'));var client=jayson[_0x39fd('0xa')][_0x39fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x160ff2,_0x2814c3,_0x587edc){return new BPromise(function(_0x1b6435,_0x5b07dc){return client[_0x39fd('0xc')](_0x160ff2,_0x587edc)[_0x39fd('0xd')](function(_0x12f770){logger[_0x39fd('0xe')](_0x39fd('0xf'),_0x2814c3,'request\x20sent');logger[_0x39fd('0x10')](_0x39fd('0x11'),_0x2814c3,_0x39fd('0x12'),JSON['stringify'](_0x12f770));if(_0x12f770[_0x39fd('0x13')]){if(_0x12f770['error'][_0x39fd('0x14')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2814c3,_0x12f770[_0x39fd('0x13')][_0x39fd('0x15')]);return _0x5b07dc(_0x12f770['error']['message']);}logger[_0x39fd('0x13')](_0x39fd('0xf'),_0x2814c3,_0x12f770[_0x39fd('0x13')][_0x39fd('0x15')]);return _0x1b6435(_0x12f770[_0x39fd('0x13')][_0x39fd('0x15')]);}else{logger[_0x39fd('0xe')](_0x39fd('0xf'),_0x2814c3,'request\x20sent');_0x1b6435(_0x12f770[_0x39fd('0x16')][_0x39fd('0x15')]);}})[_0x39fd('0x17')](function(_0x12d8a2){logger[_0x39fd('0x13')](_0x39fd('0xf'),_0x2814c3,_0x12d8a2);_0x5b07dc(_0x12d8a2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5ece3fb..98c64dc 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 _0xbcd2=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','/:id','show','post','isAuthenticated'];(function(_0x11fd30,_0xee24ee){var _0x333ff1=function(_0x297b43){while(--_0x297b43){_0x11fd30['push'](_0x11fd30['shift']());}};_0x333ff1(++_0xee24ee);}(_0xbcd2,0x10e));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2bcd('0x0'));var util=require(_0x2bcd('0x1'));var path=require(_0x2bcd('0x2'));var timeout=require(_0x2bcd('0x3'));var express=require(_0x2bcd('0x4'));var router=express[_0x2bcd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2bcd('0x6'));var config=require(_0x2bcd('0x7'));var controller=require(_0x2bcd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2bcd('0x9')]);router[_0x2bcd('0xa')](_0x2bcd('0xb'),auth['isAuthenticated'](),controller[_0x2bcd('0xc')]);router[_0x2bcd('0xd')]('/',auth[_0x2bcd('0xe')](),controller[_0x2bcd('0xf')]);router[_0x2bcd('0x10')](_0x2bcd('0xb'),auth['isAuthenticated'](),controller[_0x2bcd('0x11')]);router['delete'](_0x2bcd('0xb'),auth[_0x2bcd('0xe')](),controller[_0x2bcd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6202=['../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6202,0x191));var _0x2620=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x6202[_0x2b91c5];return _0xbd5531;};'use strict';var multer=require(_0x2620('0x0'));var util=require('util');var path=require(_0x2620('0x1'));var timeout=require(_0x2620('0x2'));var express=require(_0x2620('0x3'));var router=express[_0x2620('0x4')]();var auth=require(_0x2620('0x5'));var interaction=require(_0x2620('0x6'));var config=require(_0x2620('0x7'));var controller=require('./intVtigerField.controller');router[_0x2620('0x8')]('/',auth[_0x2620('0x9')](),controller[_0x2620('0xa')]);router[_0x2620('0x8')](_0x2620('0xb'),auth[_0x2620('0x9')](),controller['show']);router['post']('/',auth[_0x2620('0x9')](),controller[_0x2620('0xc')]);router[_0x2620('0xd')]('/:id',auth[_0x2620('0x9')](),controller[_0x2620('0xe')]);router[_0x2620('0xf')](_0x2620('0xb'),auth['isAuthenticated'](),controller[_0x2620('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 19a58f9..85ad62c 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 _0x6324=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x31d8d3,_0x49a3af){var _0x56c2ac=function(_0x4a553d){while(--_0x4a553d){_0x31d8d3['push'](_0x31d8d3['shift']());}};_0x56c2ac(++_0x49a3af);}(_0x6324,0x142));var _0x4632=function(_0x4dee14,_0x3d6aba){_0x4dee14=_0x4dee14-0x0;var _0x4daacb=_0x6324[_0x4dee14];return _0x4daacb;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'type':{'type':Sequelize[_0x4632('0x2')](_0x4632('0x3'),'variable',_0x4632('0x4'),'keyValue'),'defaultValue':_0x4632('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4632('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4632('0x3'),_0x4632('0x6'),_0x4632('0x4'))},'keyContent':{'type':Sequelize[_0x4632('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4632('0x5')]},'customField':{'type':Sequelize[_0x4632('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4632('0x5')]}}; \ No newline at end of file +var _0x2750=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0x2750,0x13b));var _0x0275=function(_0x528284,_0x3ed944){_0x528284=_0x528284-0x0;var _0x3fb5ac=_0x2750[_0x528284];return _0x3fb5ac;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'type':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2'),_0x0275('0x3'),_0x0275('0x4'),_0x0275('0x5')),'defaultValue':_0x0275('0x2')},'content':{'type':Sequelize[_0x0275('0x6')]},'key':{'type':Sequelize[_0x0275('0x6')]},'keyType':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2'),'variable',_0x0275('0x4'))},'keyContent':{'type':Sequelize[_0x0275('0x6')]},'idField':{'type':Sequelize[_0x0275('0x6')]},'nameField':{'type':Sequelize[_0x0275('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0275('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f4b2784..0eb4b12 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 _0x3b3d=['eml-format','rimraf','fast-json-patch','moment','mustache','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','VtigerField','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','order','sort','pick','where','field','merge','includeAll','findAll','catch','show','params','include','create','body','find','html-pdf'];(function(_0x212e36,_0x578705){var _0x390c2c=function(_0x4a82aa){while(--_0x4a82aa){_0x212e36['push'](_0x212e36['shift']());}};_0x390c2c(++_0x578705);}(_0x3b3d,0x173));var _0xd3b3=function(_0x39ad4c,_0x2fa27e){_0x39ad4c=_0x39ad4c-0x0;var _0xf3314d=_0x3b3d[_0x39ad4c];return _0xf3314d;};'use strict';var pdf=require(_0xd3b3('0x0'));var emlformat=require(_0xd3b3('0x1'));var rimraf=require(_0xd3b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3b3('0x3'));var rp=require('request-promise');var moment=require(_0xd3b3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd3b3('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd3b3('0x6'));var csv=require('to-csv');var ejs=require(_0xd3b3('0x7'));var fs=require('fs');var _=require(_0xd3b3('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3b3('0x9'));var deskjs=require(_0xd3b3('0xa'));var toCsv=require(_0xd3b3('0xb'));var querystring=require(_0xd3b3('0xc'));var Papa=require('papaparse');var Redis=require(_0xd3b3('0xd'));var authService=require(_0xd3b3('0xe'));var qs=require(_0xd3b3('0xf'));var hardwareService=require(_0xd3b3('0x10'));var logger=require('../../config/logger')(_0xd3b3('0x11'));var utils=require(_0xd3b3('0x12'));var config=require('../../config/environment');var db=require(_0xd3b3('0x13'))['db'];function respondWithStatusCode(_0x5cfef1,_0x56eaeb){_0x56eaeb=_0x56eaeb||0xcc;return function(_0x30892a){if(_0x30892a){return _0x5cfef1[_0xd3b3('0x14')](_0x56eaeb);}return _0x5cfef1[_0xd3b3('0x15')](_0x56eaeb)[_0xd3b3('0x16')]();};}function respondWithResult(_0x359949,_0xf38e7d){_0xf38e7d=_0xf38e7d||0xc8;return function(_0x4f09f8){if(_0x4f09f8){return _0x359949[_0xd3b3('0x15')](_0xf38e7d)['json'](_0x4f09f8);}};}function respondWithFilteredResult(_0x521558,_0x32a15c){return function(_0x2fddbf){if(_0x2fddbf){var _0x1963aa=_0x2fddbf[_0xd3b3('0x17')],_0x1a2d71=_0x32a15c[_0xd3b3('0x18')],_0x2f51b8=_0x32a15c[_0xd3b3('0x18')]+_0x32a15c[_0xd3b3('0x19')],_0x32a810;if(_0x2f51b8>=_0x1963aa){_0x2f51b8=_0x1963aa;_0x32a810=0xc8;}else{_0x32a810=0xce;}_0x521558[_0xd3b3('0x15')](_0x32a810);return _0x521558[_0xd3b3('0x1a')](_0xd3b3('0x1b'),_0x1a2d71+'-'+_0x2f51b8+'/'+_0x1963aa)[_0xd3b3('0x1c')](_0x2fddbf);}return null;};}function patchUpdates(_0x471868){return function(_0x3447df){try{jsonpatch['apply'](_0x3447df,_0x471868,!![]);}catch(_0x32ba03){return BPromise[_0xd3b3('0x1d')](_0x32ba03);}return _0x3447df[_0xd3b3('0x1e')]();};}function saveUpdates(_0x5585f3,_0x3d1b99){return function(_0x4b3b6d){if(_0x4b3b6d){return _0x4b3b6d[_0xd3b3('0x1f')](_0x5585f3)[_0xd3b3('0x20')](function(_0x43d584){return _0x43d584;});}return null;};}function removeEntity(_0x567c8e,_0xa88a08){return function(_0x527b90){if(_0x527b90){return _0x527b90[_0xd3b3('0x21')]()[_0xd3b3('0x20')](function(){_0x567c8e[_0xd3b3('0x15')](0xcc)[_0xd3b3('0x16')]();});}};}function handleEntityNotFound(_0x2fb333,_0x588a2c){return function(_0x5b665a){if(!_0x5b665a){_0x2fb333[_0xd3b3('0x14')](0x194);}return _0x5b665a;};}function handleError(_0x1caeba,_0x1e82b8){_0x1e82b8=_0x1e82b8||0x1f4;return function(_0x345643){logger[_0xd3b3('0x22')](_0x345643[_0xd3b3('0x23')]);if(_0x345643['name']){delete _0x345643[_0xd3b3('0x24')];}_0x1caeba[_0xd3b3('0x15')](_0x1e82b8)['send'](_0x345643);};}exports['index']=function(_0x360cb5,_0x20a18f){var _0xca258e={},_0x47023d={},_0x4a32b0={'count':0x0,'rows':[]};var _0x3ec367=db[_0xd3b3('0x25')][_0xd3b3('0x26')];_0x47023d['model']=_[_0xd3b3('0x27')](_0x3ec367);_0x47023d['query']=_['keys'](_0x360cb5[_0xd3b3('0x28')]);_0x47023d[_0xd3b3('0x29')]=_[_0xd3b3('0x2a')](_0x47023d[_0xd3b3('0x2b')],_0x47023d[_0xd3b3('0x28')]);_0xca258e[_0xd3b3('0x2c')]=_[_0xd3b3('0x2a')](_0x47023d['model'],qs[_0xd3b3('0x2d')](_0x360cb5['query'][_0xd3b3('0x2d')]));_0xca258e[_0xd3b3('0x2c')]=_0xca258e[_0xd3b3('0x2c')][_0xd3b3('0x2e')]?_0xca258e[_0xd3b3('0x2c')]:_0x47023d['model'];if(!_0x360cb5[_0xd3b3('0x28')]['hasOwnProperty']('nolimit')){_0xca258e[_0xd3b3('0x19')]=qs['limit'](_0x360cb5['query'][_0xd3b3('0x19')]);_0xca258e[_0xd3b3('0x18')]=qs[_0xd3b3('0x18')](_0x360cb5['query'][_0xd3b3('0x18')]);}_0xca258e[_0xd3b3('0x2f')]=qs[_0xd3b3('0x30')](_0x360cb5[_0xd3b3('0x28')]['sort']);_0xca258e['where']=qs[_0xd3b3('0x29')](_[_0xd3b3('0x31')](_0x360cb5['query'],_0x47023d[_0xd3b3('0x29')]));if(_0x360cb5['query']['filter']){_0xca258e[_0xd3b3('0x32')]=_['merge'](_0xca258e[_0xd3b3('0x32')],{'$or':_['map'](_0x3ec367,function(_0x426396){if(_0x426396['type']['key']!=='VIRTUAL'){var _0x5363b4={};_0x5363b4[_0x426396[_0xd3b3('0x33')]]={'$like':'%'+_0x360cb5[_0xd3b3('0x28')]['filter']+'%'};return _0x5363b4;}})});}_0xca258e=_[_0xd3b3('0x34')]({},_0xca258e,_0x360cb5['options']);var _0x518ede={'where':_0xca258e[_0xd3b3('0x32')]};return db[_0xd3b3('0x25')][_0xd3b3('0x17')](_0x518ede)[_0xd3b3('0x20')](function(_0x54ee16){_0x4a32b0['count']=_0x54ee16;if(_0x360cb5[_0xd3b3('0x28')][_0xd3b3('0x35')]){_0xca258e['include']=[{'all':!![]}];}return db['VtigerField'][_0xd3b3('0x36')](_0xca258e);})[_0xd3b3('0x20')](function(_0x350d2a){_0x4a32b0['rows']=_0x350d2a;return _0x4a32b0;})[_0xd3b3('0x20')](respondWithFilteredResult(_0x20a18f,_0xca258e))[_0xd3b3('0x37')](handleError(_0x20a18f,null));};exports[_0xd3b3('0x38')]=function(_0x54593b,_0x36d8e3){var _0x3604e6={'raw':!![],'where':{'id':_0x54593b[_0xd3b3('0x39')]['id']}},_0x87c5be={};_0x87c5be['model']=_['keys'](db[_0xd3b3('0x25')][_0xd3b3('0x26')]);_0x87c5be['query']=_[_0xd3b3('0x27')](_0x54593b[_0xd3b3('0x28')]);_0x87c5be['filters']=_[_0xd3b3('0x2a')](_0x87c5be[_0xd3b3('0x2b')],_0x87c5be[_0xd3b3('0x28')]);_0x3604e6[_0xd3b3('0x2c')]=_[_0xd3b3('0x2a')](_0x87c5be[_0xd3b3('0x2b')],qs['fields'](_0x54593b[_0xd3b3('0x28')][_0xd3b3('0x2d')]));_0x3604e6[_0xd3b3('0x2c')]=_0x3604e6[_0xd3b3('0x2c')][_0xd3b3('0x2e')]?_0x3604e6[_0xd3b3('0x2c')]:_0x87c5be[_0xd3b3('0x2b')];if(_0x54593b[_0xd3b3('0x28')]['includeAll']){_0x3604e6[_0xd3b3('0x3a')]=[{'all':!![]}];}_0x3604e6=_[_0xd3b3('0x34')]({},_0x3604e6,_0x54593b['options']);return db[_0xd3b3('0x25')]['find'](_0x3604e6)[_0xd3b3('0x20')](handleEntityNotFound(_0x36d8e3,null))[_0xd3b3('0x20')](respondWithResult(_0x36d8e3,null))[_0xd3b3('0x37')](handleError(_0x36d8e3,null));};exports[_0xd3b3('0x3b')]=function(_0x2c587c,_0x52e67c){return db[_0xd3b3('0x25')][_0xd3b3('0x3b')](_0x2c587c[_0xd3b3('0x3c')],{})[_0xd3b3('0x20')](respondWithResult(_0x52e67c,0xc9))[_0xd3b3('0x37')](handleError(_0x52e67c,null));};exports[_0xd3b3('0x1f')]=function(_0x47ed70,_0x14f6bf){if(_0x47ed70[_0xd3b3('0x3c')]['id']){delete _0x47ed70['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x47ed70[_0xd3b3('0x39')]['id']}})[_0xd3b3('0x20')](handleEntityNotFound(_0x14f6bf,null))[_0xd3b3('0x20')](saveUpdates(_0x47ed70[_0xd3b3('0x3c')],null))['then'](respondWithResult(_0x14f6bf,null))['catch'](handleError(_0x14f6bf,null));};exports[_0xd3b3('0x21')]=function(_0x54f2b4,_0x330159){return db[_0xd3b3('0x25')][_0xd3b3('0x3d')]({'where':{'id':_0x54f2b4[_0xd3b3('0x39')]['id']}})['then'](handleEntityNotFound(_0x330159,null))[_0xd3b3('0x20')](removeEntity(_0x330159,null))[_0xd3b3('0x37')](handleError(_0x330159,null));}; \ No newline at end of file +var _0xe3fa=['where','filters','pick','filter','merge','map','key','VIRTUAL','options','VtigerField','includeAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','index','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort'];(function(_0x5b3231,_0x19dc47){var _0x296d34=function(_0x3958b4){while(--_0x3958b4){_0x5b3231['push'](_0x5b3231['shift']());}};_0x296d34(++_0x19dc47);}(_0xe3fa,0x1d6));var _0xae3f=function(_0x6daa52,_0x5dc467){_0x6daa52=_0x6daa52-0x0;var _0x1723bf=_0xe3fa[_0x6daa52];return _0x1723bf;};'use strict';var pdf=require(_0xae3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xae3f('0x1'));var zipdir=require(_0xae3f('0x2'));var jsonpatch=require(_0xae3f('0x3'));var rp=require(_0xae3f('0x4'));var moment=require(_0xae3f('0x5'));var BPromise=require(_0xae3f('0x6'));var Mustache=require(_0xae3f('0x7'));var util=require(_0xae3f('0x8'));var path=require('path');var sox=require(_0xae3f('0x9'));var csv=require(_0xae3f('0xa'));var ejs=require(_0xae3f('0xb'));var fs=require('fs');var _=require(_0xae3f('0xc'));var squel=require('squel');var crypto=require(_0xae3f('0xd'));var jsforce=require(_0xae3f('0xe'));var deskjs=require(_0xae3f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae3f('0x10'));var Papa=require(_0xae3f('0x11'));var Redis=require(_0xae3f('0x12'));var authService=require(_0xae3f('0x13'));var qs=require(_0xae3f('0x14'));var hardwareService=require(_0xae3f('0x15'));var logger=require('../../config/logger')(_0xae3f('0x16'));var utils=require(_0xae3f('0x17'));var config=require(_0xae3f('0x18'));var db=require(_0xae3f('0x19'))['db'];function respondWithStatusCode(_0x1334d9,_0x1772b6){_0x1772b6=_0x1772b6||0xcc;return function(_0x489fb9){if(_0x489fb9){return _0x1334d9[_0xae3f('0x1a')](_0x1772b6);}return _0x1334d9[_0xae3f('0x1b')](_0x1772b6)[_0xae3f('0x1c')]();};}function respondWithResult(_0x18d691,_0x5819a8){_0x5819a8=_0x5819a8||0xc8;return function(_0x31ef11){if(_0x31ef11){return _0x18d691[_0xae3f('0x1b')](_0x5819a8)['json'](_0x31ef11);}};}function respondWithFilteredResult(_0x32a55d,_0x58a613){return function(_0xc8426a){if(_0xc8426a){var _0x1c6382=_0xc8426a[_0xae3f('0x1d')],_0x613080=_0x58a613['offset'],_0x3f0134=_0x58a613['offset']+_0x58a613[_0xae3f('0x1e')],_0x3a3326;if(_0x3f0134>=_0x1c6382){_0x3f0134=_0x1c6382;_0x3a3326=0xc8;}else{_0x3a3326=0xce;}_0x32a55d[_0xae3f('0x1b')](_0x3a3326);return _0x32a55d[_0xae3f('0x1f')](_0xae3f('0x20'),_0x613080+'-'+_0x3f0134+'/'+_0x1c6382)[_0xae3f('0x21')](_0xc8426a);}return null;};}function patchUpdates(_0x111663){return function(_0x539331){try{jsonpatch['apply'](_0x539331,_0x111663,!![]);}catch(_0x5b85f7){return BPromise[_0xae3f('0x22')](_0x5b85f7);}return _0x539331[_0xae3f('0x23')]();};}function saveUpdates(_0x569333,_0x526831){return function(_0xf655f2){if(_0xf655f2){return _0xf655f2[_0xae3f('0x24')](_0x569333)[_0xae3f('0x25')](function(_0x1439f7){return _0x1439f7;});}return null;};}function removeEntity(_0x2de6a2,_0x395f96){return function(_0x37548b){if(_0x37548b){return _0x37548b['destroy']()[_0xae3f('0x25')](function(){_0x2de6a2[_0xae3f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306128,_0x1f9ecf){return function(_0x271281){if(!_0x271281){_0x306128[_0xae3f('0x1a')](0x194);}return _0x271281;};}function handleError(_0x1e63d9,_0x5be237){_0x5be237=_0x5be237||0x1f4;return function(_0x406e22){logger[_0xae3f('0x26')](_0x406e22[_0xae3f('0x27')]);if(_0x406e22['name']){delete _0x406e22[_0xae3f('0x28')];}_0x1e63d9[_0xae3f('0x1b')](_0x5be237)['send'](_0x406e22);};}exports[_0xae3f('0x29')]=function(_0x324e1b,_0x2b776d){var _0x456eb3={},_0x44ee06={},_0x393e53={'count':0x0,'rows':[]};var _0x5bf7eb=db['VtigerField'][_0xae3f('0x2a')];_0x44ee06[_0xae3f('0x2b')]=_['keys'](_0x5bf7eb);_0x44ee06[_0xae3f('0x2c')]=_[_0xae3f('0x2d')](_0x324e1b['query']);_0x44ee06['filters']=_[_0xae3f('0x2e')](_0x44ee06[_0xae3f('0x2b')],_0x44ee06[_0xae3f('0x2c')]);_0x456eb3[_0xae3f('0x2f')]=_[_0xae3f('0x2e')](_0x44ee06['model'],qs[_0xae3f('0x30')](_0x324e1b['query'][_0xae3f('0x30')]));_0x456eb3[_0xae3f('0x2f')]=_0x456eb3[_0xae3f('0x2f')][_0xae3f('0x31')]?_0x456eb3[_0xae3f('0x2f')]:_0x44ee06[_0xae3f('0x2b')];if(!_0x324e1b['query'][_0xae3f('0x32')](_0xae3f('0x33'))){_0x456eb3['limit']=qs[_0xae3f('0x1e')](_0x324e1b[_0xae3f('0x2c')][_0xae3f('0x1e')]);_0x456eb3[_0xae3f('0x34')]=qs[_0xae3f('0x34')](_0x324e1b[_0xae3f('0x2c')][_0xae3f('0x34')]);}_0x456eb3[_0xae3f('0x35')]=qs[_0xae3f('0x36')](_0x324e1b['query'][_0xae3f('0x36')]);_0x456eb3[_0xae3f('0x37')]=qs[_0xae3f('0x38')](_[_0xae3f('0x39')](_0x324e1b[_0xae3f('0x2c')],_0x44ee06[_0xae3f('0x38')]));if(_0x324e1b['query'][_0xae3f('0x3a')]){_0x456eb3['where']=_[_0xae3f('0x3b')](_0x456eb3[_0xae3f('0x37')],{'$or':_[_0xae3f('0x3c')](_0x5bf7eb,function(_0x20eafb){if(_0x20eafb['type'][_0xae3f('0x3d')]!==_0xae3f('0x3e')){var _0x2ec0db={};_0x2ec0db[_0x20eafb['field']]={'$like':'%'+_0x324e1b['query'][_0xae3f('0x3a')]+'%'};return _0x2ec0db;}})});}_0x456eb3=_[_0xae3f('0x3b')]({},_0x456eb3,_0x324e1b[_0xae3f('0x3f')]);var _0x28d900={'where':_0x456eb3[_0xae3f('0x37')]};return db[_0xae3f('0x40')][_0xae3f('0x1d')](_0x28d900)[_0xae3f('0x25')](function(_0x185b14){_0x393e53[_0xae3f('0x1d')]=_0x185b14;if(_0x324e1b[_0xae3f('0x2c')][_0xae3f('0x41')]){_0x456eb3['include']=[{'all':!![]}];}return db[_0xae3f('0x40')]['findAll'](_0x456eb3);})[_0xae3f('0x25')](function(_0x3f7219){_0x393e53[_0xae3f('0x42')]=_0x3f7219;return _0x393e53;})['then'](respondWithFilteredResult(_0x2b776d,_0x456eb3))[_0xae3f('0x43')](handleError(_0x2b776d,null));};exports[_0xae3f('0x44')]=function(_0x14dea8,_0x2aecc4){var _0x474b79={'raw':!![],'where':{'id':_0x14dea8[_0xae3f('0x45')]['id']}},_0x461c06={};_0x461c06['model']=_[_0xae3f('0x2d')](db[_0xae3f('0x40')]['rawAttributes']);_0x461c06[_0xae3f('0x2c')]=_[_0xae3f('0x2d')](_0x14dea8[_0xae3f('0x2c')]);_0x461c06[_0xae3f('0x38')]=_[_0xae3f('0x2e')](_0x461c06[_0xae3f('0x2b')],_0x461c06[_0xae3f('0x2c')]);_0x474b79[_0xae3f('0x2f')]=_[_0xae3f('0x2e')](_0x461c06[_0xae3f('0x2b')],qs[_0xae3f('0x30')](_0x14dea8['query'][_0xae3f('0x30')]));_0x474b79[_0xae3f('0x2f')]=_0x474b79[_0xae3f('0x2f')][_0xae3f('0x31')]?_0x474b79[_0xae3f('0x2f')]:_0x461c06[_0xae3f('0x2b')];if(_0x14dea8[_0xae3f('0x2c')]['includeAll']){_0x474b79[_0xae3f('0x46')]=[{'all':!![]}];}_0x474b79=_[_0xae3f('0x3b')]({},_0x474b79,_0x14dea8[_0xae3f('0x3f')]);return db[_0xae3f('0x40')][_0xae3f('0x47')](_0x474b79)[_0xae3f('0x25')](handleEntityNotFound(_0x2aecc4,null))[_0xae3f('0x25')](respondWithResult(_0x2aecc4,null))['catch'](handleError(_0x2aecc4,null));};exports[_0xae3f('0x48')]=function(_0x2442c0,_0x4f8de6){return db[_0xae3f('0x40')][_0xae3f('0x48')](_0x2442c0[_0xae3f('0x49')],{})[_0xae3f('0x25')](respondWithResult(_0x4f8de6,0xc9))[_0xae3f('0x43')](handleError(_0x4f8de6,null));};exports[_0xae3f('0x24')]=function(_0x222c19,_0x149833){if(_0x222c19['body']['id']){delete _0x222c19[_0xae3f('0x49')]['id'];}return db[_0xae3f('0x40')][_0xae3f('0x47')]({'where':{'id':_0x222c19[_0xae3f('0x45')]['id']}})['then'](handleEntityNotFound(_0x149833,null))['then'](saveUpdates(_0x222c19[_0xae3f('0x49')],null))[_0xae3f('0x25')](respondWithResult(_0x149833,null))['catch'](handleError(_0x149833,null));};exports[_0xae3f('0x4a')]=function(_0x4a4493,_0x3a3bc6){return db['VtigerField'][_0xae3f('0x47')]({'where':{'id':_0x4a4493[_0xae3f('0x45')]['id']}})[_0xae3f('0x25')](handleEntityNotFound(_0x3a3bc6,null))[_0xae3f('0x25')](removeEntity(_0x3a3bc6,null))[_0xae3f('0x43')](handleError(_0x3a3bc6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ab5c8eb..e4e8821 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 _0x5a06=['../../config/environment','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x5a06,0x1ce));var _0x65a0=function(_0x13216b,_0x3a99b1){_0x13216b=_0x13216b-0x0;var _0xa27b54=_0x5a06[_0x13216b];return _0xa27b54;};'use strict';var _=require(_0x65a0('0x0'));var util=require('util');var logger=require(_0x65a0('0x1'))(_0x65a0('0x2'));var moment=require(_0x65a0('0x3'));var BPromise=require(_0x65a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65a0('0x5'));var config=require(_0x65a0('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x65a0('0x7')]=function(_0x299262,_0x2617d0){return _0x299262[_0x65a0('0x8')](_0x65a0('0x9'),attributes,{'tableName':_0x65a0('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x65a0('0xb'),_0x65a0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38ab=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','util','moment','bluebird','path','rimraf','./intVtigerField.attributes','exports'];(function(_0x38a3d2,_0x20a5d8){var _0x22af63=function(_0xba59c4){while(--_0xba59c4){_0x38a3d2['push'](_0x38a3d2['shift']());}};_0x22af63(++_0x20a5d8);}(_0x38ab,0x119));var _0xb38a=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x38ab[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require('lodash');var util=require(_0xb38a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb38a('0x1'));var BPromise=require(_0xb38a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb38a('0x3'));var rimraf=require(_0xb38a('0x4'));var config=require('../../config/environment');var attributes=require(_0xb38a('0x5'));module[_0xb38a('0x6')]=function(_0x4e78b8,_0x15e5c6){return _0x4e78b8[_0xb38a('0x7')](_0xb38a('0x8'),attributes,{'tableName':_0xb38a('0x9'),'paranoid':![],'indexes':[{'name':_0xb38a('0xa'),'fields':['idField',_0xb38a('0xb')],'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 b321552..89ce90c 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 _0x24a0=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x2f9a0b,_0x507dad){var _0x49c803=function(_0x3a03a0){while(--_0x3a03a0){_0x2f9a0b['push'](_0x2f9a0b['shift']());}};_0x49c803(++_0x507dad);}(_0x24a0,0x11e));var _0x024a=function(_0x40040c,_0x5ca5b4){_0x40040c=_0x40040c-0x0;var _0x4ec0cd=_0x24a0[_0x40040c];return _0x4ec0cd;};'use strict';var _=require(_0x024a('0x0'));var util=require(_0x024a('0x1'));var moment=require('moment');var BPromise=require(_0x024a('0x2'));var rs=require(_0x024a('0x3'));var fs=require('fs');var Redis=require(_0x024a('0x4'));var db=require(_0x024a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x024a('0x6'));var jayson=require(_0x024a('0x7'));var client=jayson[_0x024a('0x8')][_0x024a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x128671,_0x2cab35,_0x470b37){return new BPromise(function(_0x39f1e5,_0x1d534f){return client[_0x024a('0xa')](_0x128671,_0x470b37)[_0x024a('0xb')](function(_0x4e87a7){logger[_0x024a('0xc')](_0x024a('0xd'),_0x2cab35,_0x024a('0xe'));logger[_0x024a('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x2cab35,_0x024a('0xe'),JSON[_0x024a('0x10')](_0x4e87a7));if(_0x4e87a7[_0x024a('0x11')]){if(_0x4e87a7[_0x024a('0x11')][_0x024a('0x12')]===0x1f4){logger[_0x024a('0x11')](_0x024a('0xd'),_0x2cab35,_0x4e87a7[_0x024a('0x11')]['message']);return _0x1d534f(_0x4e87a7[_0x024a('0x11')]['message']);}logger['error'](_0x024a('0xd'),_0x2cab35,_0x4e87a7['error'][_0x024a('0x13')]);return _0x39f1e5(_0x4e87a7[_0x024a('0x11')][_0x024a('0x13')]);}else{logger[_0x024a('0xc')](_0x024a('0xd'),_0x2cab35,_0x024a('0xe'));_0x39f1e5(_0x4e87a7[_0x024a('0x14')][_0x024a('0x13')]);}})[_0x024a('0x15')](function(_0x10f8ee){logger[_0x024a('0x11')](_0x024a('0xd'),_0x2cab35,_0x10f8ee);_0x1d534f(_0x10f8ee);});});} \ No newline at end of file +var _0x2218=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xf3d3d,_0x18c710){var _0x1e5511=function(_0x2b25e9){while(--_0x2b25e9){_0xf3d3d['push'](_0xf3d3d['shift']());}};_0x1e5511(++_0x18c710);}(_0x2218,0x1b2));var _0x8221=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0x2218[_0x534c8f];return _0x5a57f5;};'use strict';var _=require(_0x8221('0x0'));var util=require('util');var moment=require(_0x8221('0x1'));var BPromise=require(_0x8221('0x2'));var rs=require(_0x8221('0x3'));var fs=require('fs');var Redis=require(_0x8221('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8221('0x5'));var logger=require(_0x8221('0x6'))(_0x8221('0x7'));var config=require(_0x8221('0x8'));var jayson=require(_0x8221('0x9'));var client=jayson[_0x8221('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53dda2,_0x16491e,_0x47073a){return new BPromise(function(_0x100267,_0x30cf70){return client[_0x8221('0xb')](_0x53dda2,_0x47073a)['then'](function(_0x4dcc06){logger[_0x8221('0xc')](_0x8221('0xd'),_0x16491e,_0x8221('0xe'));logger[_0x8221('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x16491e,_0x8221('0xe'),JSON[_0x8221('0x10')](_0x4dcc06));if(_0x4dcc06['error']){if(_0x4dcc06[_0x8221('0x11')][_0x8221('0x12')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x16491e,_0x4dcc06[_0x8221('0x11')][_0x8221('0x13')]);return _0x30cf70(_0x4dcc06[_0x8221('0x11')][_0x8221('0x13')]);}logger[_0x8221('0x11')]('VtigerField,\x20%s,\x20%s',_0x16491e,_0x4dcc06[_0x8221('0x11')][_0x8221('0x13')]);return _0x100267(_0x4dcc06[_0x8221('0x11')][_0x8221('0x13')]);}else{logger[_0x8221('0xc')](_0x8221('0xd'),_0x16491e,'request\x20sent');_0x100267(_0x4dcc06[_0x8221('0x14')][_0x8221('0x13')]);}})[_0x8221('0x15')](function(_0x2c206d){logger['error']('VtigerField,\x20%s,\x20%s',_0x16491e,_0x2c206d);_0x30cf70(_0x2c206d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1b8be21..5106024 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 _0xd285=['../../components/auth/service','./intZendeskAccount.controller','get','index','/:id','show','isAuthenticated','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x2b6c53,_0xfd8e3d){var _0x517026=function(_0x127043){while(--_0x127043){_0x2b6c53['push'](_0x2b6c53['shift']());}};_0x517026(++_0xfd8e3d);}(_0xd285,0x6a));var _0x5d28=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0xd285[_0x4c630b];return _0x181259;};'use strict';var multer=require('multer');var util=require(_0x5d28('0x0'));var path=require(_0x5d28('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x5d28('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d28('0x3'));router[_0x5d28('0x4')]('/',auth['isAuthenticated'](),controller[_0x5d28('0x5')]);router['get'](_0x5d28('0x6'),auth['isAuthenticated'](),controller[_0x5d28('0x7')]);router['get']('/:id/configurations',auth[_0x5d28('0x8')](),controller[_0x5d28('0x9')]);router['get']('/:id/fields',auth[_0x5d28('0x8')](),controller[_0x5d28('0xa')]);router[_0x5d28('0xb')]('/',auth[_0x5d28('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5d28('0xc')]);router[_0x5d28('0xd')](_0x5d28('0x6'),auth[_0x5d28('0x8')](),controller[_0x5d28('0xe')]);router[_0x5d28('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5d28('0x10')]);module[_0x5d28('0x11')]=router; \ No newline at end of file +var _0x7b5f=['Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','index','get','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','addConfiguration','delete','/:id','destroy','multer','util','connect-timeout','express'];(function(_0xd309a4,_0x100f7b){var _0x164f91=function(_0xeae99c){while(--_0xeae99c){_0xd309a4['push'](_0xd309a4['shift']());}};_0x164f91(++_0x100f7b);}(_0x7b5f,0x114));var _0xf7b5=function(_0x5942d8,_0x59d24b){_0x5942d8=_0x5942d8-0x0;var _0x1b0d93=_0x7b5f[_0x5942d8];return _0x1b0d93;};'use strict';var multer=require(_0xf7b5('0x0'));var util=require(_0xf7b5('0x1'));var path=require('path');var timeout=require(_0xf7b5('0x2'));var express=require(_0xf7b5('0x3'));var router=express[_0xf7b5('0x4')]();var auth=require(_0xf7b5('0x5'));var interaction=require(_0xf7b5('0x6'));var config=require('../../config/environment');var controller=require(_0xf7b5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7b5('0x8')]);router[_0xf7b5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf7b5('0xa')]);router[_0xf7b5('0x9')](_0xf7b5('0xb'),auth[_0xf7b5('0xc')](),controller[_0xf7b5('0xd')]);router[_0xf7b5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf7b5('0xe')]);router[_0xf7b5('0xf')]('/',auth[_0xf7b5('0xc')](),controller['create']);router[_0xf7b5('0xf')]('/:id/configurations',auth[_0xf7b5('0xc')](),controller[_0xf7b5('0x10')]);router['put']('/:id',auth[_0xf7b5('0xc')](),controller['update']);router[_0xf7b5('0x11')](_0xf7b5('0x12'),auth[_0xf7b5('0xc')](),controller[_0xf7b5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 042e8f3..b38fe9b 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 _0xd3fd=['sequelize','exports','STRING','remoteUri','ENUM','password','integrationTab'];(function(_0x1dc00e,_0x473adc){var _0x5a716a=function(_0x2b2708){while(--_0x2b2708){_0x1dc00e['push'](_0x1dc00e['shift']());}};_0x5a716a(++_0x473adc);}(_0xd3fd,0x10a));var _0xdd3f=function(_0x3e4e62,_0xaccb6a){_0x3e4e62=_0x3e4e62-0x0;var _0x238753=_0xd3fd[_0x3e4e62];return _0x238753;};'use strict';var Sequelize=require(_0xdd3f('0x0'));module[_0xdd3f('0x1')]={'name':{'type':Sequelize[_0xdd3f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdd3f('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xdd3f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdd3f('0x3')},'authType':{'type':Sequelize[_0xdd3f('0x4')](_0xdd3f('0x5'),'token'),'defaultValue':_0xdd3f('0x5')},'serverUrl':{'type':Sequelize[_0xdd3f('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0xdd3f('0x6')}}; \ No newline at end of file +var _0x38c7=['integrationTab','newTab','sequelize','STRING','token','ENUM'];(function(_0x5c7141,_0x5b61ec){var _0x5b356b=function(_0x617bfc){while(--_0x617bfc){_0x5c7141['push'](_0x5c7141['shift']());}};_0x5b356b(++_0x5b61ec);}(_0x38c7,0x68));var _0x738c=function(_0x20d2ba,_0x13c6db){_0x20d2ba=_0x20d2ba-0x0;var _0x506a99=_0x38c7[_0x20d2ba];return _0x506a99;};'use strict';var Sequelize=require(_0x738c('0x0'));module['exports']={'name':{'type':Sequelize[_0x738c('0x1')]},'description':{'type':Sequelize[_0x738c('0x1')]},'username':{'type':Sequelize[_0x738c('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x738c('0x1')]},'token':{'type':Sequelize[_0x738c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x738c('0x2')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x738c('0x1')]},'type':{'type':Sequelize[_0x738c('0x3')](_0x738c('0x4'),_0x738c('0x5')),'defaultValue':_0x738c('0x4')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8080c0a..0fa2b2d 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 _0x3238=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','destroy','name','index','ZendeskAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','type','key','VIRTUAL','options','includeAll','findAll','rows','show','find','create','update','body','params','getConfigurations','pick','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','Subjects','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','password','headers','Basic\x20%s','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0xd3f0b2,_0x58be3c){var _0xa5e495=function(_0x5b222f){while(--_0x5b222f){_0xd3f0b2['push'](_0xd3f0b2['shift']());}};_0xa5e495(++_0x58be3c);}(_0x3238,0x1e3));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x8323('0x0'));var emlformat=require(_0x8323('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8323('0x2'));var jsonpatch=require(_0x8323('0x3'));var rp=require(_0x8323('0x4'));var moment=require(_0x8323('0x5'));var BPromise=require(_0x8323('0x6'));var Mustache=require(_0x8323('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8323('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8323('0x9'));var squel=require(_0x8323('0xa'));var crypto=require(_0x8323('0xb'));var jsforce=require(_0x8323('0xc'));var deskjs=require(_0x8323('0xd'));var toCsv=require(_0x8323('0xe'));var querystring=require('querystring');var Papa=require(_0x8323('0xf'));var Redis=require(_0x8323('0x10'));var authService=require(_0x8323('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8323('0x12'))('api');var utils=require(_0x8323('0x13'));var config=require(_0x8323('0x14'));var db=require(_0x8323('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x8323('0x16')][_0x8323('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5c34bc,_0x31061e,_0x433c21){if(_0x433c21){var _0x6c37a6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6c37a6[_0x8323('0x18')](_0x31061e)){return _0x5c34bc;}else{throw new Error(_0x8323('0x19'));}}else{return _0x5c34bc;}}function respondWithRpcPromise(_0x532e86,_0x5d57af,_0xcb036,_0xcd6e66){return new BPromise(function(_0x2394cb,_0xb9b961){var _0x35ccb3=_0xcd6e66||client;return _0x35ccb3[_0x8323('0x1a')](_0x532e86,_0xcb036)[_0x8323('0x1b')](function(_0x524326){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x5d57af,_0x8323('0x1c'));logger[_0x8323('0x1d')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5d57af,_0x8323('0x1c'),JSON[_0x8323('0x1e')](_0x524326));if(_0x524326['error']){if(_0x524326[_0x8323('0x1f')][_0x8323('0x20')]===0x1f4){logger['error'](_0x8323('0x21'),_0x5d57af,_0x524326[_0x8323('0x1f')][_0x8323('0x22')]);return _0xb9b961(_0x524326[_0x8323('0x1f')][_0x8323('0x22')]);}logger[_0x8323('0x1f')](_0x8323('0x21'),_0x5d57af,_0x524326[_0x8323('0x1f')][_0x8323('0x22')]);return _0x2394cb(_0x524326['error'][_0x8323('0x22')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x5d57af,_0x8323('0x1c'));_0x2394cb(_0x524326['result'][_0x8323('0x22')]);}})[_0x8323('0x23')](function(_0x59c7e3){logger[_0x8323('0x1f')](_0x8323('0x21'),_0x5d57af,_0x59c7e3);_0xb9b961(_0x59c7e3);});});}function respondWithStatusCode(_0x119f23,_0x2aa55c){_0x2aa55c=_0x2aa55c||0xcc;return function(_0x581d02){if(_0x581d02){return _0x119f23[_0x8323('0x24')](_0x2aa55c);}return _0x119f23[_0x8323('0x25')](_0x2aa55c)['end']();};}function respondWithResult(_0x3af861,_0x1a353a){_0x1a353a=_0x1a353a||0xc8;return function(_0x5be3fd){if(_0x5be3fd){return _0x3af861[_0x8323('0x25')](_0x1a353a)['json'](_0x5be3fd);}};}function respondWithFilteredResult(_0x62e3af,_0x103580){return function(_0x4f57d0){if(_0x4f57d0){var _0x1bee6d=_0x4f57d0[_0x8323('0x26')],_0x2a2e0b=_0x103580[_0x8323('0x27')],_0x4cc713=_0x103580[_0x8323('0x27')]+_0x103580['limit'],_0x1e5064;if(_0x4cc713>=_0x1bee6d){_0x4cc713=_0x1bee6d;_0x1e5064=0xc8;}else{_0x1e5064=0xce;}_0x62e3af[_0x8323('0x25')](_0x1e5064);return _0x62e3af[_0x8323('0x28')](_0x8323('0x29'),_0x2a2e0b+'-'+_0x4cc713+'/'+_0x1bee6d)[_0x8323('0x2a')](_0x4f57d0);}return null;};}function patchUpdates(_0xd5aafa){return function(_0x3e89a4){try{jsonpatch[_0x8323('0x2b')](_0x3e89a4,_0xd5aafa,!![]);}catch(_0x5a1dca){return BPromise[_0x8323('0x2c')](_0x5a1dca);}return _0x3e89a4[_0x8323('0x2d')]();};}function saveUpdates(_0x3ce79e,_0x5b9d15){return function(_0x552157){if(_0x552157){return _0x552157['update'](_0x3ce79e)[_0x8323('0x1b')](function(_0x103e89){return _0x103e89;});}return null;};}function removeEntity(_0x118777,_0xe698e){return function(_0xeec64e){if(_0xeec64e){return _0xeec64e[_0x8323('0x2e')]()[_0x8323('0x1b')](function(){_0x118777[_0x8323('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cd9f9,_0x323c6a){return function(_0xa755cf){if(!_0xa755cf){_0x1cd9f9[_0x8323('0x24')](0x194);}return _0xa755cf;};}function handleError(_0x5a7f57,_0x2e9734){_0x2e9734=_0x2e9734||0x1f4;return function(_0x243521){logger[_0x8323('0x1f')](_0x243521['stack']);if(_0x243521[_0x8323('0x2f')]){delete _0x243521[_0x8323('0x2f')];}_0x5a7f57[_0x8323('0x25')](_0x2e9734)['send'](_0x243521);};}exports[_0x8323('0x30')]=function(_0x5dc56d,_0x4900a2){var _0x227a18={},_0x5654f1={},_0x5030f7={'count':0x0,'rows':[]};var _0x437d93=db[_0x8323('0x31')][_0x8323('0x32')];_0x5654f1[_0x8323('0x33')]=_[_0x8323('0x34')](_0x437d93);_0x5654f1[_0x8323('0x35')]=_[_0x8323('0x34')](_0x5dc56d[_0x8323('0x35')]);_0x5654f1[_0x8323('0x36')]=_[_0x8323('0x37')](_0x5654f1[_0x8323('0x33')],_0x5654f1[_0x8323('0x35')]);_0x227a18['attributes']=_[_0x8323('0x37')](_0x5654f1['model'],qs[_0x8323('0x38')](_0x5dc56d[_0x8323('0x35')][_0x8323('0x38')]));_0x227a18[_0x8323('0x39')]=_0x227a18[_0x8323('0x39')][_0x8323('0x3a')]?_0x227a18[_0x8323('0x39')]:_0x5654f1[_0x8323('0x33')];if(!_0x5dc56d[_0x8323('0x35')][_0x8323('0x3b')](_0x8323('0x3c'))){_0x227a18[_0x8323('0x3d')]=qs['limit'](_0x5dc56d[_0x8323('0x35')]['limit']);_0x227a18[_0x8323('0x27')]=qs[_0x8323('0x27')](_0x5dc56d[_0x8323('0x35')]['offset']);}_0x227a18[_0x8323('0x3e')]=qs[_0x8323('0x3f')](_0x5dc56d[_0x8323('0x35')][_0x8323('0x3f')]);_0x227a18[_0x8323('0x40')]=qs['filters'](_['pick'](_0x5dc56d['query'],_0x5654f1[_0x8323('0x36')]));if(_0x5dc56d[_0x8323('0x35')][_0x8323('0x41')]){_0x227a18[_0x8323('0x40')]=_[_0x8323('0x42')](_0x227a18[_0x8323('0x40')],{'$or':_[_0x8323('0x43')](_0x437d93,function(_0x739974){if(_0x739974[_0x8323('0x44')][_0x8323('0x45')]!==_0x8323('0x46')){var _0x1afa7b={};_0x1afa7b[_0x739974['field']]={'$like':'%'+_0x5dc56d[_0x8323('0x35')][_0x8323('0x41')]+'%'};return _0x1afa7b;}})});}_0x227a18=_[_0x8323('0x42')]({},_0x227a18,_0x5dc56d[_0x8323('0x47')]);var _0x3c1cf4={'where':_0x227a18['where']};return db[_0x8323('0x31')][_0x8323('0x26')](_0x3c1cf4)[_0x8323('0x1b')](function(_0x57b79b){_0x5030f7['count']=_0x57b79b;if(_0x5dc56d[_0x8323('0x35')][_0x8323('0x48')]){_0x227a18['include']=[{'all':!![]}];}return db[_0x8323('0x31')][_0x8323('0x49')](_0x227a18);})[_0x8323('0x1b')](function(_0x5c4b13){_0x5030f7[_0x8323('0x4a')]=_0x5c4b13;return _0x5030f7;})[_0x8323('0x1b')](respondWithFilteredResult(_0x4900a2,_0x227a18))[_0x8323('0x23')](handleError(_0x4900a2,null));};exports[_0x8323('0x4b')]=function(_0x2ff8c5,_0x373ffc){var _0x1f59e9={'raw':![],'where':{'id':_0x2ff8c5['params']['id']}},_0x520c65={};_0x520c65[_0x8323('0x33')]=_['keys'](db[_0x8323('0x31')][_0x8323('0x32')]);_0x520c65[_0x8323('0x35')]=_[_0x8323('0x34')](_0x2ff8c5['query']);_0x520c65[_0x8323('0x36')]=_['intersection'](_0x520c65['model'],_0x520c65[_0x8323('0x35')]);_0x1f59e9[_0x8323('0x39')]=_[_0x8323('0x37')](_0x520c65['model'],qs[_0x8323('0x38')](_0x2ff8c5[_0x8323('0x35')][_0x8323('0x38')]));_0x1f59e9[_0x8323('0x39')]=_0x1f59e9[_0x8323('0x39')]['length']?_0x1f59e9[_0x8323('0x39')]:_0x520c65['model'];if(_0x2ff8c5[_0x8323('0x35')][_0x8323('0x48')]){_0x1f59e9['include']=[{'all':!![]}];}_0x1f59e9=_[_0x8323('0x42')]({},_0x1f59e9,_0x2ff8c5[_0x8323('0x47')]);return db[_0x8323('0x31')][_0x8323('0x4c')](_0x1f59e9)['then'](handleEntityNotFound(_0x373ffc,null))['then'](respondWithResult(_0x373ffc,null))['catch'](handleError(_0x373ffc,null));};exports[_0x8323('0x4d')]=function(_0x5d2550,_0x4190b4){return db['ZendeskAccount'][_0x8323('0x4d')](_0x5d2550['body'],{})[_0x8323('0x1b')](respondWithResult(_0x4190b4,0xc9))['catch'](handleError(_0x4190b4,null));};exports[_0x8323('0x4e')]=function(_0x16ce7a,_0x4df0d3){if(_0x16ce7a[_0x8323('0x4f')]['id']){delete _0x16ce7a[_0x8323('0x4f')]['id'];}return db[_0x8323('0x31')][_0x8323('0x4c')]({'where':{'id':_0x16ce7a[_0x8323('0x50')]['id']}})[_0x8323('0x1b')](handleEntityNotFound(_0x4df0d3,null))['then'](saveUpdates(_0x16ce7a[_0x8323('0x4f')],null))['then'](respondWithResult(_0x4df0d3,null))['catch'](handleError(_0x4df0d3,null));};exports['destroy']=function(_0xf0faf6,_0x55cc11){return db[_0x8323('0x31')]['find']({'where':{'id':_0xf0faf6[_0x8323('0x50')]['id']}})['then'](handleEntityNotFound(_0x55cc11,null))['then'](removeEntity(_0x55cc11,null))[_0x8323('0x23')](handleError(_0x55cc11,null));};exports[_0x8323('0x51')]=function(_0x1c0d22,_0x57c880,_0x494079){var _0x129a83={};var _0x139a28={};var _0x7a5fd3;var _0x35495e;return db[_0x8323('0x31')]['findOne']({'where':{'id':_0x1c0d22[_0x8323('0x50')]['id']}})[_0x8323('0x1b')](handleEntityNotFound(_0x57c880,null))[_0x8323('0x1b')](function(_0x26fb36){if(_0x26fb36){_0x7a5fd3=_0x26fb36;_0x139a28[_0x8323('0x33')]=_[_0x8323('0x34')](db['ZendeskConfiguration'][_0x8323('0x32')]);_0x139a28['query']=_[_0x8323('0x34')](_0x1c0d22[_0x8323('0x35')]);_0x139a28['filters']=_[_0x8323('0x37')](_0x139a28[_0x8323('0x33')],_0x139a28[_0x8323('0x35')]);_0x129a83[_0x8323('0x39')]=_[_0x8323('0x37')](_0x139a28[_0x8323('0x33')],qs[_0x8323('0x38')](_0x1c0d22[_0x8323('0x35')]['fields']));_0x129a83['attributes']=_0x129a83['attributes'][_0x8323('0x3a')]?_0x129a83['attributes']:_0x139a28['model'];_0x129a83[_0x8323('0x3e')]=qs[_0x8323('0x3f')](_0x1c0d22['query'][_0x8323('0x3f')]);_0x129a83[_0x8323('0x40')]=qs['filters'](_[_0x8323('0x52')](_0x1c0d22['query'],_0x139a28[_0x8323('0x36')]));if(_0x1c0d22['query'][_0x8323('0x41')]){_0x129a83[_0x8323('0x40')]=_[_0x8323('0x42')](_0x129a83[_0x8323('0x40')],{'$or':_[_0x8323('0x43')](_0x129a83[_0x8323('0x39')],function(_0x1b650e){var _0x57734d={};_0x57734d[_0x1b650e]={'$like':'%'+_0x1c0d22[_0x8323('0x35')]['filter']+'%'};return _0x57734d;})});}_0x129a83=_[_0x8323('0x42')]({},_0x129a83,_0x1c0d22['options']);return _0x7a5fd3['getConfigurations'](_0x129a83);}})[_0x8323('0x1b')](function(_0x2552cc){if(_0x2552cc){_0x35495e=_0x2552cc[_0x8323('0x3a')];if(!_0x1c0d22[_0x8323('0x35')]['hasOwnProperty'](_0x8323('0x3c'))){_0x129a83[_0x8323('0x3d')]=qs[_0x8323('0x3d')](_0x1c0d22['query'][_0x8323('0x3d')]);_0x129a83[_0x8323('0x27')]=qs[_0x8323('0x27')](_0x1c0d22[_0x8323('0x35')]['offset']);}return _0x7a5fd3[_0x8323('0x51')](_0x129a83);}})[_0x8323('0x1b')](function(_0x183898){if(_0x183898){return _0x183898?{'count':_0x35495e,'rows':_0x183898}:null;}})[_0x8323('0x1b')](respondWithResult(_0x57c880,null))[_0x8323('0x23')](handleError(_0x57c880,null));};exports[_0x8323('0x53')]=function(_0xf0a64a,_0x2fc087,_0x2e301e){if(_0xf0a64a[_0x8323('0x4f')]['id']){delete _0xf0a64a[_0x8323('0x4f')]['id'];}return db[_0x8323('0x31')][_0x8323('0x54')]({'where':{'id':_0xf0a64a[_0x8323('0x50')]['id']}})['then'](handleEntityNotFound(_0x2fc087,null))['then'](function(_0x22039b){if(_0x22039b){_0xf0a64a[_0x8323('0x4f')][_0x8323('0x55')]=_0x22039b['id'];_0xf0a64a['body']['Subjects']=integrations['getSubjects'](_0xf0a64a[_0x8323('0x4f')][_0x8323('0x56')],_0xf0a64a[_0x8323('0x4f')][_0x8323('0x44')]);_0xf0a64a['body'][_0x8323('0x57')]=integrations[_0x8323('0x58')](_0xf0a64a[_0x8323('0x4f')]['channel'],_0xf0a64a[_0x8323('0x4f')][_0x8323('0x44')]);return db[_0x8323('0x59')][_0x8323('0x4d')](_0xf0a64a['body'],{'include':[{'model':db[_0x8323('0x5a')],'as':_0x8323('0x5b')},{'model':db[_0x8323('0x5a')],'as':_0x8323('0x57')}]});}return null;})[_0x8323('0x1b')](respondWithResult(_0x2fc087,null))[_0x8323('0x23')](handleError(_0x2fc087,null));};exports[_0x8323('0x5c')]=function(_0x2bdf83,_0x5ca516,_0x2b3dd0){var _0x3d7f84='';return db[_0x8323('0x31')][_0x8323('0x54')]({'where':{'id':_0x2bdf83[_0x8323('0x50')]['id']},'attributes':['id',_0x8323('0x5d'),'password',_0x8323('0x5e'),_0x8323('0x5f'),_0x8323('0x60')]})[_0x8323('0x1b')](handleEntityNotFound(_0x5ca516,null))[_0x8323('0x1b')](function(_0x2d7201){if(_0x2d7201){_0x3d7f84=_0x2d7201[_0x8323('0x60')];var _0x2a190e=_0x3d7f84[_0x8323('0x61')](-0x1);if(_0x2a190e==='/'){_0x3d7f84=_0x3d7f84[_0x8323('0x62')](0x0,_0x3d7f84[_0x8323('0x63')](_0x2a190e));}var _0x4f1e3f={'method':_0x8323('0x64'),'uri':util[_0x8323('0x65')]('%s/%s',_0x3d7f84,'ticket_fields'),'json':!![]};switch(_0x2d7201[_0x8323('0x5f')]){case _0x8323('0x66'):_0x4f1e3f[_0x8323('0x67')]={'Authorization':util['format'](_0x8323('0x68'),new Buffer(util[_0x8323('0x65')]('%s:%s',_0x2d7201[_0x8323('0x5d')],_0x2d7201['password']))[_0x8323('0x69')](_0x8323('0x6a')))};break;case _0x8323('0x5e'):_0x4f1e3f[_0x8323('0x67')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x8323('0x6b'),_0x2d7201[_0x8323('0x5d')],_0x2d7201['token']))[_0x8323('0x69')](_0x8323('0x6a')))};break;default:throw new db['Sequelize'][(_0x8323('0x6c'))](_0x8323('0x6d'));}return rp(_0x4f1e3f);}})[_0x8323('0x1b')](function(_0x4e5c7b){if(_0x4e5c7b){var _0x16c2a2=[_0x8323('0x6e'),_0x8323('0x6f'),_0x8323('0x70'),_0x8323('0x71')];_[_0x8323('0x72')](_0x4e5c7b[_0x8323('0x73')],function(_0x36421b){return _0x16c2a2[_0x8323('0x74')](_0x36421b['type']);});return{'count':_0x4e5c7b['ticket_fields'][_0x8323('0x3a')],'rows':_['map'](_0x4e5c7b[_0x8323('0x73')],function(_0x20e6fd){return{'id':_0x20e6fd['id'],'name':_0x20e6fd[_0x8323('0x75')]>0x7?_0x20e6fd[_0x8323('0x76')]:_0x20e6fd['type'],'custom':_0x20e6fd[_0x8323('0x75')]>0x7?!![]:![],'options':_0x20e6fd['system_field_options']?_0x20e6fd[_0x8323('0x77')]:_0x20e6fd[_0x8323('0x78')]?_0x20e6fd[_0x8323('0x78')]:[]};})};}})[_0x8323('0x1b')](respondWithResult(_0x5ca516,null))[_0x8323('0x23')](function(_0x8b987){var _0x5b16be=_0x2bdf83[_0x8323('0x35')][_0x8323('0x18')]?0x1f4:_0x8b987[_0x8323('0x79')]||0x1f4;logger[_0x8323('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x8323('0x5c'),_0x5b16be,JSON[_0x8323('0x1e')](_0x8b987));delete _0x8b987[_0x8323('0x2f')];if(_0x5b16be===0x191){_0x5b16be=0x190;}_0x5ca516[_0x8323('0x25')](_0x5b16be)[_0x8323('0x7a')](_0x2bdf83[_0x8323('0x35')][_0x8323('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x8b987[_0x8323('0x79')]}:_0x8b987);});}; \ No newline at end of file +var _0xb780=['type','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','length','find','create','body','findOne','order','getConfigurations','hasOwnProperty','addConfiguration','AccountId','channel','getDescriptions','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','token','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','group','remove','position','title','system_field_options','custom_field_options','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','request\x20sent','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','apply','update','destroy','stack','name','send','index','ZendeskAccount','rawAttributes','keys','query','filters','intersection','model','fields','attributes','nolimit','limit','sort','where','pick','filter','merge','map'];(function(_0x17c36e,_0x1f5f48){var _0x1510ea=function(_0x25aee2){while(--_0x25aee2){_0x17c36e['push'](_0x17c36e['shift']());}};_0x1510ea(++_0x1f5f48);}(_0xb780,0x127));var _0x0b78=function(_0x151f10,_0xa05471){_0x151f10=_0x151f10-0x0;var _0x2fba12=_0xb780[_0x151f10];return _0x2fba12;};'use strict';var pdf=require(_0x0b78('0x0'));var emlformat=require(_0x0b78('0x1'));var rimraf=require(_0x0b78('0x2'));var zipdir=require(_0x0b78('0x3'));var jsonpatch=require(_0x0b78('0x4'));var rp=require(_0x0b78('0x5'));var moment=require('moment');var BPromise=require(_0x0b78('0x6'));var Mustache=require('mustache');var util=require(_0x0b78('0x7'));var path=require(_0x0b78('0x8'));var sox=require(_0x0b78('0x9'));var csv=require(_0x0b78('0xa'));var ejs=require(_0x0b78('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0b78('0xc'));var crypto=require('crypto');var jsforce=require(_0x0b78('0xd'));var deskjs=require(_0x0b78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b78('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b78('0x10'));var qs=require(_0x0b78('0x11'));var hardwareService=require(_0x0b78('0x12'));var logger=require(_0x0b78('0x13'))(_0x0b78('0x14'));var utils=require(_0x0b78('0x15'));var config=require('../../config/environment');var db=require(_0x0b78('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0b78('0x17'));var client=jayson[_0x0b78('0x18')][_0x0b78('0x19')]({'port':0x232a});function checkPasswordPattern(_0x39dbb0,_0x20c01a,_0x14f23e){if(_0x14f23e){var _0x246e3c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x246e3c[_0x0b78('0x1a')](_0x20c01a)){return _0x39dbb0;}else{throw new Error(_0x0b78('0x1b'));}}else{return _0x39dbb0;}}function respondWithRpcPromise(_0x59e353,_0x554146,_0x392db7,_0x1de7f5){return new BPromise(function(_0x49568d,_0x27e437){var _0x2a8746=_0x1de7f5||client;return _0x2a8746[_0x0b78('0x1c')](_0x59e353,_0x392db7)[_0x0b78('0x1d')](function(_0x42e8f1){logger[_0x0b78('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x554146,'request\x20sent');logger[_0x0b78('0x1f')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x554146,_0x0b78('0x20'),JSON[_0x0b78('0x21')](_0x42e8f1));if(_0x42e8f1[_0x0b78('0x22')]){if(_0x42e8f1[_0x0b78('0x22')][_0x0b78('0x23')]===0x1f4){logger[_0x0b78('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x554146,_0x42e8f1[_0x0b78('0x22')]['message']);return _0x27e437(_0x42e8f1[_0x0b78('0x22')][_0x0b78('0x24')]);}logger[_0x0b78('0x22')](_0x0b78('0x25'),_0x554146,_0x42e8f1[_0x0b78('0x22')][_0x0b78('0x24')]);return _0x49568d(_0x42e8f1['error'][_0x0b78('0x24')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x554146,_0x0b78('0x20'));_0x49568d(_0x42e8f1[_0x0b78('0x26')][_0x0b78('0x24')]);}})[_0x0b78('0x27')](function(_0xa6d98c){logger[_0x0b78('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x554146,_0xa6d98c);_0x27e437(_0xa6d98c);});});}function respondWithStatusCode(_0x41f9e2,_0x3f69a5){_0x3f69a5=_0x3f69a5||0xcc;return function(_0x1a3556){if(_0x1a3556){return _0x41f9e2[_0x0b78('0x28')](_0x3f69a5);}return _0x41f9e2[_0x0b78('0x29')](_0x3f69a5)[_0x0b78('0x2a')]();};}function respondWithResult(_0x5c1faa,_0x250d04){_0x250d04=_0x250d04||0xc8;return function(_0x12183d){if(_0x12183d){return _0x5c1faa[_0x0b78('0x29')](_0x250d04)[_0x0b78('0x2b')](_0x12183d);}};}function respondWithFilteredResult(_0x6f5de3,_0x564e1f){return function(_0x4aeea2){if(_0x4aeea2){var _0x21bc9c=_0x4aeea2[_0x0b78('0x2c')],_0x3c97f6=_0x564e1f[_0x0b78('0x2d')],_0x1ba542=_0x564e1f['offset']+_0x564e1f['limit'],_0x39193e;if(_0x1ba542>=_0x21bc9c){_0x1ba542=_0x21bc9c;_0x39193e=0xc8;}else{_0x39193e=0xce;}_0x6f5de3['status'](_0x39193e);return _0x6f5de3[_0x0b78('0x2e')]('Content-Range',_0x3c97f6+'-'+_0x1ba542+'/'+_0x21bc9c)[_0x0b78('0x2b')](_0x4aeea2);}return null;};}function patchUpdates(_0x44b6a0){return function(_0x385db7){try{jsonpatch[_0x0b78('0x2f')](_0x385db7,_0x44b6a0,!![]);}catch(_0x15456f){return BPromise['reject'](_0x15456f);}return _0x385db7['save']();};}function saveUpdates(_0x400738,_0x57cb74){return function(_0x500ddb){if(_0x500ddb){return _0x500ddb[_0x0b78('0x30')](_0x400738)[_0x0b78('0x1d')](function(_0x44c018){return _0x44c018;});}return null;};}function removeEntity(_0x21d953,_0xe00bb3){return function(_0x4fa7b4){if(_0x4fa7b4){return _0x4fa7b4[_0x0b78('0x31')]()[_0x0b78('0x1d')](function(){_0x21d953[_0x0b78('0x29')](0xcc)[_0x0b78('0x2a')]();});}};}function handleEntityNotFound(_0x50bd46,_0x1aacd5){return function(_0x161306){if(!_0x161306){_0x50bd46[_0x0b78('0x28')](0x194);}return _0x161306;};}function handleError(_0x326ceb,_0x1a9b93){_0x1a9b93=_0x1a9b93||0x1f4;return function(_0x1d02f5){logger[_0x0b78('0x22')](_0x1d02f5[_0x0b78('0x32')]);if(_0x1d02f5[_0x0b78('0x33')]){delete _0x1d02f5[_0x0b78('0x33')];}_0x326ceb['status'](_0x1a9b93)[_0x0b78('0x34')](_0x1d02f5);};}exports[_0x0b78('0x35')]=function(_0x50863b,_0x32266b){var _0x5c5e02={},_0x962b04={},_0x2c6965={'count':0x0,'rows':[]};var _0x4ea841=db[_0x0b78('0x36')][_0x0b78('0x37')];_0x962b04['model']=_[_0x0b78('0x38')](_0x4ea841);_0x962b04[_0x0b78('0x39')]=_[_0x0b78('0x38')](_0x50863b[_0x0b78('0x39')]);_0x962b04[_0x0b78('0x3a')]=_[_0x0b78('0x3b')](_0x962b04[_0x0b78('0x3c')],_0x962b04[_0x0b78('0x39')]);_0x5c5e02['attributes']=_['intersection'](_0x962b04[_0x0b78('0x3c')],qs[_0x0b78('0x3d')](_0x50863b[_0x0b78('0x39')][_0x0b78('0x3d')]));_0x5c5e02['attributes']=_0x5c5e02[_0x0b78('0x3e')]['length']?_0x5c5e02[_0x0b78('0x3e')]:_0x962b04[_0x0b78('0x3c')];if(!_0x50863b[_0x0b78('0x39')]['hasOwnProperty'](_0x0b78('0x3f'))){_0x5c5e02[_0x0b78('0x40')]=qs[_0x0b78('0x40')](_0x50863b[_0x0b78('0x39')]['limit']);_0x5c5e02['offset']=qs[_0x0b78('0x2d')](_0x50863b['query'][_0x0b78('0x2d')]);}_0x5c5e02['order']=qs[_0x0b78('0x41')](_0x50863b[_0x0b78('0x39')][_0x0b78('0x41')]);_0x5c5e02[_0x0b78('0x42')]=qs[_0x0b78('0x3a')](_[_0x0b78('0x43')](_0x50863b[_0x0b78('0x39')],_0x962b04[_0x0b78('0x3a')]));if(_0x50863b['query'][_0x0b78('0x44')]){_0x5c5e02['where']=_[_0x0b78('0x45')](_0x5c5e02['where'],{'$or':_[_0x0b78('0x46')](_0x4ea841,function(_0x5bf6aa){if(_0x5bf6aa[_0x0b78('0x47')]['key']!==_0x0b78('0x48')){var _0x1fd816={};_0x1fd816[_0x5bf6aa[_0x0b78('0x49')]]={'$like':'%'+_0x50863b[_0x0b78('0x39')][_0x0b78('0x44')]+'%'};return _0x1fd816;}})});}_0x5c5e02=_['merge']({},_0x5c5e02,_0x50863b[_0x0b78('0x4a')]);var _0x117b2f={'where':_0x5c5e02['where']};return db[_0x0b78('0x36')][_0x0b78('0x2c')](_0x117b2f)[_0x0b78('0x1d')](function(_0x361938){_0x2c6965['count']=_0x361938;if(_0x50863b[_0x0b78('0x39')][_0x0b78('0x4b')]){_0x5c5e02[_0x0b78('0x4c')]=[{'all':!![]}];}return db[_0x0b78('0x36')][_0x0b78('0x4d')](_0x5c5e02);})['then'](function(_0x2426c4){_0x2c6965[_0x0b78('0x4e')]=_0x2426c4;return _0x2c6965;})[_0x0b78('0x1d')](respondWithFilteredResult(_0x32266b,_0x5c5e02))[_0x0b78('0x27')](handleError(_0x32266b,null));};exports[_0x0b78('0x4f')]=function(_0x30c46a,_0xff4d7e){var _0x230843={'raw':![],'where':{'id':_0x30c46a[_0x0b78('0x50')]['id']}},_0x368fec={};_0x368fec[_0x0b78('0x3c')]=_[_0x0b78('0x38')](db[_0x0b78('0x36')][_0x0b78('0x37')]);_0x368fec['query']=_[_0x0b78('0x38')](_0x30c46a['query']);_0x368fec[_0x0b78('0x3a')]=_[_0x0b78('0x3b')](_0x368fec['model'],_0x368fec['query']);_0x230843['attributes']=_[_0x0b78('0x3b')](_0x368fec[_0x0b78('0x3c')],qs[_0x0b78('0x3d')](_0x30c46a[_0x0b78('0x39')][_0x0b78('0x3d')]));_0x230843[_0x0b78('0x3e')]=_0x230843[_0x0b78('0x3e')][_0x0b78('0x51')]?_0x230843[_0x0b78('0x3e')]:_0x368fec[_0x0b78('0x3c')];if(_0x30c46a[_0x0b78('0x39')][_0x0b78('0x4b')]){_0x230843[_0x0b78('0x4c')]=[{'all':!![]}];}_0x230843=_[_0x0b78('0x45')]({},_0x230843,_0x30c46a[_0x0b78('0x4a')]);return db[_0x0b78('0x36')][_0x0b78('0x52')](_0x230843)['then'](handleEntityNotFound(_0xff4d7e,null))['then'](respondWithResult(_0xff4d7e,null))[_0x0b78('0x27')](handleError(_0xff4d7e,null));};exports[_0x0b78('0x53')]=function(_0x4785bb,_0x3e8046){return db[_0x0b78('0x36')][_0x0b78('0x53')](_0x4785bb['body'],{})['then'](respondWithResult(_0x3e8046,0xc9))[_0x0b78('0x27')](handleError(_0x3e8046,null));};exports[_0x0b78('0x30')]=function(_0x2230f5,_0xe287ea){if(_0x2230f5[_0x0b78('0x54')]['id']){delete _0x2230f5[_0x0b78('0x54')]['id'];}return db[_0x0b78('0x36')][_0x0b78('0x52')]({'where':{'id':_0x2230f5[_0x0b78('0x50')]['id']}})[_0x0b78('0x1d')](handleEntityNotFound(_0xe287ea,null))[_0x0b78('0x1d')](saveUpdates(_0x2230f5['body'],null))['then'](respondWithResult(_0xe287ea,null))[_0x0b78('0x27')](handleError(_0xe287ea,null));};exports['destroy']=function(_0xb5124c,_0x24d5be){return db['ZendeskAccount'][_0x0b78('0x52')]({'where':{'id':_0xb5124c['params']['id']}})['then'](handleEntityNotFound(_0x24d5be,null))['then'](removeEntity(_0x24d5be,null))[_0x0b78('0x27')](handleError(_0x24d5be,null));};exports['getConfigurations']=function(_0x38bbc8,_0x100ccf,_0x50d122){var _0x14d58f={};var _0x2c787d={};var _0x181ef0;var _0x12884c;return db['ZendeskAccount'][_0x0b78('0x55')]({'where':{'id':_0x38bbc8[_0x0b78('0x50')]['id']}})[_0x0b78('0x1d')](handleEntityNotFound(_0x100ccf,null))['then'](function(_0x4cdcd0){if(_0x4cdcd0){_0x181ef0=_0x4cdcd0;_0x2c787d['model']=_['keys'](db['ZendeskConfiguration'][_0x0b78('0x37')]);_0x2c787d[_0x0b78('0x39')]=_[_0x0b78('0x38')](_0x38bbc8[_0x0b78('0x39')]);_0x2c787d[_0x0b78('0x3a')]=_[_0x0b78('0x3b')](_0x2c787d[_0x0b78('0x3c')],_0x2c787d[_0x0b78('0x39')]);_0x14d58f['attributes']=_[_0x0b78('0x3b')](_0x2c787d[_0x0b78('0x3c')],qs[_0x0b78('0x3d')](_0x38bbc8['query'][_0x0b78('0x3d')]));_0x14d58f[_0x0b78('0x3e')]=_0x14d58f[_0x0b78('0x3e')][_0x0b78('0x51')]?_0x14d58f[_0x0b78('0x3e')]:_0x2c787d[_0x0b78('0x3c')];_0x14d58f[_0x0b78('0x56')]=qs[_0x0b78('0x41')](_0x38bbc8[_0x0b78('0x39')][_0x0b78('0x41')]);_0x14d58f[_0x0b78('0x42')]=qs[_0x0b78('0x3a')](_['pick'](_0x38bbc8[_0x0b78('0x39')],_0x2c787d['filters']));if(_0x38bbc8['query'][_0x0b78('0x44')]){_0x14d58f[_0x0b78('0x42')]=_[_0x0b78('0x45')](_0x14d58f['where'],{'$or':_[_0x0b78('0x46')](_0x14d58f[_0x0b78('0x3e')],function(_0x1924f9){var _0x3f63e8={};_0x3f63e8[_0x1924f9]={'$like':'%'+_0x38bbc8['query']['filter']+'%'};return _0x3f63e8;})});}_0x14d58f=_[_0x0b78('0x45')]({},_0x14d58f,_0x38bbc8[_0x0b78('0x4a')]);return _0x181ef0[_0x0b78('0x57')](_0x14d58f);}})[_0x0b78('0x1d')](function(_0x325685){if(_0x325685){_0x12884c=_0x325685['length'];if(!_0x38bbc8['query'][_0x0b78('0x58')](_0x0b78('0x3f'))){_0x14d58f[_0x0b78('0x40')]=qs[_0x0b78('0x40')](_0x38bbc8[_0x0b78('0x39')][_0x0b78('0x40')]);_0x14d58f[_0x0b78('0x2d')]=qs[_0x0b78('0x2d')](_0x38bbc8[_0x0b78('0x39')][_0x0b78('0x2d')]);}return _0x181ef0[_0x0b78('0x57')](_0x14d58f);}})[_0x0b78('0x1d')](function(_0x510855){if(_0x510855){return _0x510855?{'count':_0x12884c,'rows':_0x510855}:null;}})[_0x0b78('0x1d')](respondWithResult(_0x100ccf,null))[_0x0b78('0x27')](handleError(_0x100ccf,null));};exports[_0x0b78('0x59')]=function(_0x5de20c,_0x53fcea,_0x23b962){if(_0x5de20c[_0x0b78('0x54')]['id']){delete _0x5de20c[_0x0b78('0x54')]['id'];}return db[_0x0b78('0x36')][_0x0b78('0x55')]({'where':{'id':_0x5de20c['params']['id']}})[_0x0b78('0x1d')](handleEntityNotFound(_0x53fcea,null))['then'](function(_0x2b14bf){if(_0x2b14bf){_0x5de20c[_0x0b78('0x54')][_0x0b78('0x5a')]=_0x2b14bf['id'];_0x5de20c[_0x0b78('0x54')]['Subjects']=integrations['getSubjects'](_0x5de20c[_0x0b78('0x54')][_0x0b78('0x5b')],_0x5de20c[_0x0b78('0x54')]['type']);_0x5de20c[_0x0b78('0x54')]['Descriptions']=integrations[_0x0b78('0x5c')](_0x5de20c[_0x0b78('0x54')][_0x0b78('0x5b')],_0x5de20c['body']['type']);return db[_0x0b78('0x5d')]['create'](_0x5de20c['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x0b78('0x5e')],'as':_0x0b78('0x5f')}]});}return null;})[_0x0b78('0x1d')](respondWithResult(_0x53fcea,null))[_0x0b78('0x27')](handleError(_0x53fcea,null));};exports[_0x0b78('0x60')]=function(_0x41facd,_0xd6a774,_0x5d7650){var _0xd62c59='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x41facd['params']['id']},'attributes':['id',_0x0b78('0x61'),'password',_0x0b78('0x62'),'authType','remoteUri']})[_0x0b78('0x1d')](handleEntityNotFound(_0xd6a774,null))[_0x0b78('0x1d')](function(_0x2f45ea){if(_0x2f45ea){_0xd62c59=_0x2f45ea['remoteUri'];var _0x55bb7c=_0xd62c59[_0x0b78('0x63')](-0x1);if(_0x55bb7c==='/'){_0xd62c59=_0xd62c59['substring'](0x0,_0xd62c59[_0x0b78('0x64')](_0x55bb7c));}var _0x3dcbbc={'method':_0x0b78('0x65'),'uri':util[_0x0b78('0x66')](_0x0b78('0x67'),_0xd62c59,_0x0b78('0x68')),'json':!![]};switch(_0x2f45ea[_0x0b78('0x69')]){case _0x0b78('0x6a'):_0x3dcbbc[_0x0b78('0x6b')]={'Authorization':util[_0x0b78('0x66')](_0x0b78('0x6c'),new Buffer(util[_0x0b78('0x66')](_0x0b78('0x6d'),_0x2f45ea[_0x0b78('0x61')],_0x2f45ea[_0x0b78('0x6a')]))[_0x0b78('0x6e')](_0x0b78('0x6f')))};break;case _0x0b78('0x62'):_0x3dcbbc['headers']={'Authorization':util[_0x0b78('0x66')](_0x0b78('0x6c'),new Buffer(util['format'](_0x0b78('0x70'),_0x2f45ea[_0x0b78('0x61')],_0x2f45ea[_0x0b78('0x62')]))[_0x0b78('0x6e')](_0x0b78('0x6f')))};break;default:throw new db[(_0x0b78('0x71'))]['ValidationError'](_0x0b78('0x72'));}return rp(_0x3dcbbc);}})[_0x0b78('0x1d')](function(_0x5d1477){if(_0x5d1477){var _0x279d50=['subject','description',_0x0b78('0x73'),'assignee'];_[_0x0b78('0x74')](_0x5d1477[_0x0b78('0x68')],function(_0x1d09c3){return _0x279d50['includes'](_0x1d09c3[_0x0b78('0x47')]);});return{'count':_0x5d1477['ticket_fields'][_0x0b78('0x51')],'rows':_[_0x0b78('0x46')](_0x5d1477[_0x0b78('0x68')],function(_0xf3591b){return{'id':_0xf3591b['id'],'name':_0xf3591b[_0x0b78('0x75')]>0x7?_0xf3591b[_0x0b78('0x76')]:_0xf3591b[_0x0b78('0x47')],'custom':_0xf3591b[_0x0b78('0x75')]>0x7?!![]:![],'options':_0xf3591b[_0x0b78('0x77')]?_0xf3591b[_0x0b78('0x77')]:_0xf3591b[_0x0b78('0x78')]?_0xf3591b[_0x0b78('0x78')]:[]};})};}})[_0x0b78('0x1d')](respondWithResult(_0xd6a774,null))[_0x0b78('0x27')](function(_0x4d54c9){var _0x3e1c2f=_0x41facd['query'][_0x0b78('0x1a')]?0x1f4:_0x4d54c9[_0x0b78('0x79')]||0x1f4;logger[_0x0b78('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x0b78('0x60'),_0x3e1c2f,JSON[_0x0b78('0x21')](_0x4d54c9));delete _0x4d54c9[_0x0b78('0x33')];if(_0x3e1c2f===0x191){_0x3e1c2f=0x190;}_0xd6a774[_0x0b78('0x29')](_0x3e1c2f)[_0x0b78('0x34')](_0x41facd[_0x0b78('0x39')][_0x0b78('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x4d54c9[_0x0b78('0x79')]}:_0x4d54c9);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7082012..ce0d454 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 _0x3d3c=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','../../components/integrations/configuration'];(function(_0x235bf4,_0x4fda52){var _0x46e6c0=function(_0x378a63){while(--_0x378a63){_0x235bf4['push'](_0x235bf4['shift']());}};_0x46e6c0(++_0x4fda52);}(_0x3d3c,0x98));var _0xc3d3=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x3d3c[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xc3d3('0x0'));var util=require(_0xc3d3('0x1'));var logger=require(_0xc3d3('0x2'))(_0xc3d3('0x3'));var moment=require(_0xc3d3('0x4'));var BPromise=require(_0xc3d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc3d3('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xc3d3('0x7'));module[_0xc3d3('0x8')]=function(_0x3bc44b,_0x4b559d){return _0x3bc44b[_0xc3d3('0x9')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x972c=['ZendeskAccount','int_zendesk_accounts','../../config/logger','api','bluebird','request-promise','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x972c,0xf2));var _0xc972=function(_0x184336,_0x43385a){_0x184336=_0x184336-0x0;var _0x519390=_0x972c[_0x184336];return _0x519390;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc972('0x0'))(_0xc972('0x1'));var moment=require('moment');var BPromise=require(_0xc972('0x2'));var rp=require(_0xc972('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc972('0x4'));var attributes=require(_0xc972('0x5'));var integrations=require(_0xc972('0x6'));module['exports']=function(_0xd70261,_0x4cff66){return _0xd70261[_0xc972('0x7')](_0xc972('0x8'),attributes,{'tableName':_0xc972('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 5c8e14b..bf27f42 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 _0x1c45=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','result','catch','findAll','raw','options','where','limit','include','map','model','attributes','GetZendeskAccount','ZendeskAccount','find','ShowZendeskAccount','debug','lodash','util','moment','bluebird'];(function(_0x58cad2,_0x4a2995){var _0x46dc3a=function(_0x1dada2){while(--_0x1dada2){_0x58cad2['push'](_0x58cad2['shift']());}};_0x46dc3a(++_0x4a2995);}(_0x1c45,0x8c));var _0x51c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1c45[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var moment=require(_0x51c4('0x2'));var BPromise=require(_0x51c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51c4('0x4'));var logger=require(_0x51c4('0x5'))(_0x51c4('0x6'));var config=require(_0x51c4('0x7'));var jayson=require(_0x51c4('0x8'));var client=jayson[_0x51c4('0x9')][_0x51c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45a92e,_0x338827,_0x252081){return new BPromise(function(_0x10ad60,_0x4dc8bd){return client[_0x51c4('0xb')](_0x45a92e,_0x252081)[_0x51c4('0xc')](function(_0x292a80){logger[_0x51c4('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x338827,_0x51c4('0xe'));logger['debug'](_0x51c4('0xf'),_0x338827,'request\x20sent',JSON[_0x51c4('0x10')](_0x292a80));if(_0x292a80['error']){if(_0x292a80[_0x51c4('0x11')]['code']===0x1f4){logger['error'](_0x51c4('0x12'),_0x338827,_0x292a80[_0x51c4('0x11')][_0x51c4('0x13')]);return _0x4dc8bd(_0x292a80[_0x51c4('0x11')][_0x51c4('0x13')]);}logger[_0x51c4('0x11')](_0x51c4('0x12'),_0x338827,_0x292a80[_0x51c4('0x11')]['message']);return _0x10ad60(_0x292a80[_0x51c4('0x11')][_0x51c4('0x13')]);}else{logger[_0x51c4('0xd')](_0x51c4('0x12'),_0x338827,'request\x20sent');_0x10ad60(_0x292a80[_0x51c4('0x14')][_0x51c4('0x13')]);}})[_0x51c4('0x15')](function(_0x4ef4bd){logger['error'](_0x51c4('0x12'),_0x338827,_0x4ef4bd);_0x4dc8bd(_0x4ef4bd);});});}exports['GetZendeskAccount']=function(_0x441d4f){var _0x3c53da=this;return new Promise(function(_0x5db32f,_0xe53543){return db['ZendeskAccount'][_0x51c4('0x16')]({'raw':_0x441d4f['options']?_0x441d4f['options'][_0x51c4('0x17')]===undefined?!![]:![]:!![],'where':_0x441d4f[_0x51c4('0x18')]?_0x441d4f['options'][_0x51c4('0x19')]||null:null,'attributes':_0x441d4f[_0x51c4('0x18')]?_0x441d4f[_0x51c4('0x18')]['attributes']||null:null,'limit':_0x441d4f[_0x51c4('0x18')]?_0x441d4f[_0x51c4('0x18')][_0x51c4('0x1a')]||null:null,'include':_0x441d4f[_0x51c4('0x18')]?_0x441d4f[_0x51c4('0x18')][_0x51c4('0x1b')]?_[_0x51c4('0x1c')](_0x441d4f['options'][_0x51c4('0x1b')],function(_0x115598){return{'model':db[_0x115598[_0x51c4('0x1d')]],'as':_0x115598['as'],'attributes':_0x115598[_0x51c4('0x1e')],'include':_0x115598[_0x51c4('0x1b')]?_[_0x51c4('0x1c')](_0x115598[_0x51c4('0x1b')],function(_0x3d5628){return{'model':db[_0x3d5628[_0x51c4('0x1d')]],'as':_0x3d5628['as'],'attributes':_0x3d5628[_0x51c4('0x1e')],'include':_0x3d5628[_0x51c4('0x1b')]?_[_0x51c4('0x1c')](_0x3d5628[_0x51c4('0x1b')],function(_0x5436be){return{'model':db[_0x5436be['model']],'as':_0x5436be['as'],'attributes':_0x5436be[_0x51c4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54560d){logger['info'](_0x51c4('0x1f'),_0x441d4f);logger['debug'](_0x51c4('0x1f'),_0x441d4f,JSON[_0x51c4('0x10')](_0x54560d));_0x5db32f(_0x54560d);})[_0x51c4('0x15')](function(_0x54dc47){logger[_0x51c4('0x11')](_0x51c4('0x1f'),_0x54dc47[_0x51c4('0x13')],_0x441d4f);_0xe53543(_0x3c53da[_0x51c4('0x11')](0x1f4,_0x54dc47[_0x51c4('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x1a268b){var _0xe1bea9=this;return new Promise(function(_0x4b4b22,_0x16618e){return db[_0x51c4('0x20')][_0x51c4('0x21')]({'raw':_0x1a268b[_0x51c4('0x18')]?_0x1a268b[_0x51c4('0x18')][_0x51c4('0x17')]===undefined?!![]:![]:!![],'where':_0x1a268b['options']?_0x1a268b[_0x51c4('0x18')][_0x51c4('0x19')]||null:null,'attributes':_0x1a268b[_0x51c4('0x18')]?_0x1a268b[_0x51c4('0x18')]['attributes']||null:null,'include':_0x1a268b[_0x51c4('0x18')]?_0x1a268b['options']['include']?_[_0x51c4('0x1c')](_0x1a268b['options']['include'],function(_0xa1852a){return{'model':db[_0xa1852a['model']],'as':_0xa1852a['as'],'attributes':_0xa1852a[_0x51c4('0x1e')],'include':_0xa1852a[_0x51c4('0x1b')]?_[_0x51c4('0x1c')](_0xa1852a[_0x51c4('0x1b')],function(_0x36a533){return{'model':db[_0x36a533[_0x51c4('0x1d')]],'as':_0x36a533['as'],'attributes':_0x36a533['attributes'],'include':_0x36a533[_0x51c4('0x1b')]?_['map'](_0x36a533[_0x51c4('0x1b')],function(_0x585eeb){return{'model':db[_0x585eeb['model']],'as':_0x585eeb['as'],'attributes':_0x585eeb[_0x51c4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x51c4('0xc')](function(_0x128039){logger['info'](_0x51c4('0x22'),_0x1a268b);logger[_0x51c4('0x23')](_0x51c4('0x22'),_0x1a268b,JSON[_0x51c4('0x10')](_0x128039));_0x4b4b22(_0x128039);})['catch'](function(_0x28087e){logger[_0x51c4('0x11')]('ShowZendeskAccount',_0x28087e[_0x51c4('0x13')],_0x1a268b);_0x16618e(_0xe1bea9['error'](0x1f4,_0x28087e[_0x51c4('0x13')]));});});}; \ No newline at end of file +var _0x140b=['map','model','attributes','GetZendeskAccount','ShowZendeskAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','ZendeskAccount,\x20%s,\x20%s','message','result','catch','ZendeskAccount','findAll','options','raw','where','limit','include'];(function(_0x42da4c,_0x3be988){var _0x4c4955=function(_0x47b600){while(--_0x47b600){_0x42da4c['push'](_0x42da4c['shift']());}};_0x4c4955(++_0x3be988);}(_0x140b,0x6f));var _0xb140=function(_0x155976,_0x52d024){_0x155976=_0x155976-0x0;var _0x44c06a=_0x140b[_0x155976];return _0x44c06a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb140('0x0'));var BPromise=require('bluebird');var rs=require(_0xb140('0x1'));var fs=require('fs');var Redis=require(_0xb140('0x2'));var db=require(_0xb140('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb140('0x4'))(_0xb140('0x5'));var config=require(_0xb140('0x6'));var jayson=require(_0xb140('0x7'));var client=jayson[_0xb140('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe5c500,_0x166cf5,_0x2c9702){return new BPromise(function(_0x367779,_0x375bf7){return client[_0xb140('0x9')](_0xe5c500,_0x2c9702)[_0xb140('0xa')](function(_0x305e73){logger[_0xb140('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x166cf5,_0xb140('0xc'));logger[_0xb140('0xd')](_0xb140('0xe'),_0x166cf5,'request\x20sent',JSON[_0xb140('0xf')](_0x305e73));if(_0x305e73['error']){if(_0x305e73['error'][_0xb140('0x10')]===0x1f4){logger[_0xb140('0x11')](_0xb140('0x12'),_0x166cf5,_0x305e73[_0xb140('0x11')][_0xb140('0x13')]);return _0x375bf7(_0x305e73['error'][_0xb140('0x13')]);}logger[_0xb140('0x11')](_0xb140('0x12'),_0x166cf5,_0x305e73[_0xb140('0x11')][_0xb140('0x13')]);return _0x367779(_0x305e73[_0xb140('0x11')]['message']);}else{logger[_0xb140('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x166cf5,'request\x20sent');_0x367779(_0x305e73[_0xb140('0x14')]['message']);}})[_0xb140('0x15')](function(_0x4a17ec){logger['error'](_0xb140('0x12'),_0x166cf5,_0x4a17ec);_0x375bf7(_0x4a17ec);});});}exports['GetZendeskAccount']=function(_0x54f935){var _0x5c6049=this;return new Promise(function(_0x3cacda,_0x425ae6){return db[_0xb140('0x16')][_0xb140('0x17')]({'raw':_0x54f935[_0xb140('0x18')]?_0x54f935[_0xb140('0x18')][_0xb140('0x19')]===undefined?!![]:![]:!![],'where':_0x54f935[_0xb140('0x18')]?_0x54f935[_0xb140('0x18')][_0xb140('0x1a')]||null:null,'attributes':_0x54f935['options']?_0x54f935['options']['attributes']||null:null,'limit':_0x54f935['options']?_0x54f935[_0xb140('0x18')][_0xb140('0x1b')]||null:null,'include':_0x54f935[_0xb140('0x18')]?_0x54f935['options'][_0xb140('0x1c')]?_[_0xb140('0x1d')](_0x54f935[_0xb140('0x18')]['include'],function(_0x364519){return{'model':db[_0x364519['model']],'as':_0x364519['as'],'attributes':_0x364519['attributes'],'include':_0x364519[_0xb140('0x1c')]?_[_0xb140('0x1d')](_0x364519[_0xb140('0x1c')],function(_0x2664d){return{'model':db[_0x2664d[_0xb140('0x1e')]],'as':_0x2664d['as'],'attributes':_0x2664d[_0xb140('0x1f')],'include':_0x2664d[_0xb140('0x1c')]?_['map'](_0x2664d['include'],function(_0x3fb68a){return{'model':db[_0x3fb68a[_0xb140('0x1e')]],'as':_0x3fb68a['as'],'attributes':_0x3fb68a[_0xb140('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb140('0xa')](function(_0x35c3c4){logger[_0xb140('0xb')](_0xb140('0x20'),_0x54f935);logger['debug'](_0xb140('0x20'),_0x54f935,JSON[_0xb140('0xf')](_0x35c3c4));_0x3cacda(_0x35c3c4);})[_0xb140('0x15')](function(_0x559349){logger[_0xb140('0x11')](_0xb140('0x20'),_0x559349[_0xb140('0x13')],_0x54f935);_0x425ae6(_0x5c6049['error'](0x1f4,_0x559349[_0xb140('0x13')]));});});};exports[_0xb140('0x21')]=function(_0x1f2e61){var _0x5ad8ee=this;return new Promise(function(_0x11701d,_0x2e976e){return db[_0xb140('0x16')][_0xb140('0x22')]({'raw':_0x1f2e61['options']?_0x1f2e61[_0xb140('0x18')][_0xb140('0x19')]===undefined?!![]:![]:!![],'where':_0x1f2e61[_0xb140('0x18')]?_0x1f2e61[_0xb140('0x18')]['where']||null:null,'attributes':_0x1f2e61[_0xb140('0x18')]?_0x1f2e61['options']['attributes']||null:null,'include':_0x1f2e61[_0xb140('0x18')]?_0x1f2e61['options'][_0xb140('0x1c')]?_[_0xb140('0x1d')](_0x1f2e61['options'][_0xb140('0x1c')],function(_0x5a15cf){return{'model':db[_0x5a15cf[_0xb140('0x1e')]],'as':_0x5a15cf['as'],'attributes':_0x5a15cf[_0xb140('0x1f')],'include':_0x5a15cf[_0xb140('0x1c')]?_[_0xb140('0x1d')](_0x5a15cf['include'],function(_0x3eaa2e){return{'model':db[_0x3eaa2e[_0xb140('0x1e')]],'as':_0x3eaa2e['as'],'attributes':_0x3eaa2e[_0xb140('0x1f')],'include':_0x3eaa2e[_0xb140('0x1c')]?_[_0xb140('0x1d')](_0x3eaa2e['include'],function(_0x5d1f5a){return{'model':db[_0x5d1f5a['model']],'as':_0x5d1f5a['as'],'attributes':_0x5d1f5a[_0xb140('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb140('0xa')](function(_0x5069b5){logger[_0xb140('0xb')](_0xb140('0x21'),_0x1f2e61);logger[_0xb140('0xd')]('ShowZendeskAccount',_0x1f2e61,JSON[_0xb140('0xf')](_0x5069b5));_0x11701d(_0x5069b5);})[_0xb140('0x15')](function(_0x2f6352){logger[_0xb140('0x11')]('ShowZendeskAccount',_0x2f6352[_0xb140('0x13')],_0x1f2e61);_0x2e976e(_0x5ad8ee['error'](0x1f4,_0x2f6352[_0xb140('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6895142..fa72447 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 _0x4009=['exports','path','connect-timeout','express','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy'];(function(_0x550651,_0x32926b){var _0x53edcf=function(_0x1ebc42){while(--_0x1ebc42){_0x550651['push'](_0x550651['shift']());}};_0x53edcf(++_0x32926b);}(_0x4009,0x121));var _0x9400=function(_0x407d08,_0x27a5e6){_0x407d08=_0x407d08-0x0;var _0x354f1c=_0x4009[_0x407d08];return _0x354f1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9400('0x0'));var timeout=require(_0x9400('0x1'));var express=require(_0x9400('0x2'));var router=express[_0x9400('0x3')]();var auth=require(_0x9400('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9400('0x5'));router[_0x9400('0x6')]('/',auth[_0x9400('0x7')](),controller[_0x9400('0x8')]);router[_0x9400('0x6')](_0x9400('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9400('0x6')](_0x9400('0xa'),auth[_0x9400('0x7')](),controller['getFields']);router[_0x9400('0x6')](_0x9400('0xb'),auth[_0x9400('0x7')](),controller[_0x9400('0xc')]);router[_0x9400('0x6')](_0x9400('0xd'),auth['isAuthenticated'](),controller[_0x9400('0xe')]);router['get'](_0x9400('0xf'),auth[_0x9400('0x7')](),controller[_0x9400('0x10')]);router[_0x9400('0x11')]('/',auth[_0x9400('0x7')](),controller[_0x9400('0x12')]);router[_0x9400('0x11')](_0x9400('0xf'),auth[_0x9400('0x7')](),controller[_0x9400('0x13')]);router[_0x9400('0x14')](_0x9400('0x9'),auth[_0x9400('0x7')](),controller[_0x9400('0x15')]);router['delete'](_0x9400('0x9'),auth[_0x9400('0x7')](),controller[_0x9400('0x16')]);module[_0x9400('0x17')]=router; \ No newline at end of file +var _0x2fb5=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x2fb5,0xff));var _0x52fb=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x2fb5[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x52fb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x52fb('0x1'));var express=require(_0x52fb('0x2'));var router=express[_0x52fb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x52fb('0x4'));var config=require(_0x52fb('0x5'));var controller=require(_0x52fb('0x6'));router[_0x52fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x52fb('0x8')]);router['get'](_0x52fb('0x9'),auth[_0x52fb('0xa')](),controller[_0x52fb('0xb')]);router[_0x52fb('0x7')](_0x52fb('0xc'),auth[_0x52fb('0xa')](),controller['getFields']);router[_0x52fb('0x7')]('/:id/subjects',auth[_0x52fb('0xa')](),controller[_0x52fb('0xd')]);router[_0x52fb('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x52fb('0xe')]);router['get'](_0x52fb('0xf'),auth['isAuthenticated'](),controller[_0x52fb('0x10')]);router[_0x52fb('0x11')]('/',auth[_0x52fb('0xa')](),controller[_0x52fb('0x12')]);router['post'](_0x52fb('0xf'),auth[_0x52fb('0xa')](),controller[_0x52fb('0x13')]);router[_0x52fb('0x14')]('/:id',auth[_0x52fb('0xa')](),controller['update']);router['delete']('/:id',auth[_0x52fb('0xa')](),controller[_0x52fb('0x15')]);module[_0x52fb('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6d9ed34..8fbf269 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 _0xd264=['STRING'];(function(_0x31e635,_0xfa822d){var _0x1c6360=function(_0x1c8024){while(--_0x1c8024){_0x31e635['push'](_0x31e635['shift']());}};_0x1c6360(++_0xfa822d);}(_0xd264,0x1ab));var _0x4d26=function(_0x5a76cd,_0x364502){_0x5a76cd=_0x5a76cd-0x0;var _0xf60d8=_0xd264[_0x5a76cd];return _0xf60d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4d26('0x0')]}}; \ No newline at end of file +var _0xd929=['STRING','sequelize','exports'];(function(_0x2ba5a8,_0x331996){var _0x53b347=function(_0x446d5e){while(--_0x446d5e){_0x2ba5a8['push'](_0x2ba5a8['shift']());}};_0x53b347(++_0x331996);}(_0xd929,0x11b));var _0x9d92=function(_0x51813e,_0x12e0af){_0x51813e=_0x51813e-0x0;var _0x53fb97=_0xd929[_0x51813e];return _0x53fb97;};'use strict';var Sequelize=require(_0x9d92('0x0'));module[_0x9d92('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d92('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6705a41..ea5e3b6 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 _0xedd9=['info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\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','rawAttributes','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','ZendeskConfiguration','rows','params','length','includeAll','options','find','create','body','getFields','findOne','ZendeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then'];(function(_0x567ea1,_0x3cb026){var _0x20964d=function(_0x2a7102){while(--_0x2a7102){_0x567ea1['push'](_0x567ea1['shift']());}};_0x20964d(++_0x3cb026);}(_0xedd9,0xfc));var _0x9edd=function(_0x262428,_0x4698f0){_0x262428=_0x262428-0x0;var _0x30a3d7=_0xedd9[_0x262428];return _0x30a3d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var hardwareService=require(_0x9edd('0x12'));var logger=require('../../config/logger')(_0x9edd('0x13'));var utils=require(_0x9edd('0x14'));var config=require('../../config/environment');var db=require(_0x9edd('0x15'))['db'];var jayson=require(_0x9edd('0x16'));var client=jayson[_0x9edd('0x17')][_0x9edd('0x18')]({'port':0x232a});function checkPasswordPattern(_0x287ddd,_0x3a7b84,_0xfca576){if(_0xfca576){var _0xef5498=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xef5498['test'](_0x3a7b84)){return _0x287ddd;}else{throw new Error(_0x9edd('0x19'));}}else{return _0x287ddd;}}function respondWithRpcPromise(_0x44fc7c,_0x891832,_0x4d9a7,_0x13b6b6){return new BPromise(function(_0x338f3c,_0x1042aa){var _0x75a4ab=_0x13b6b6||client;return _0x75a4ab['request'](_0x44fc7c,_0x4d9a7)[_0x9edd('0x1a')](function(_0x448996){logger[_0x9edd('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x891832,_0x9edd('0x1c'));logger[_0x9edd('0x1d')](_0x9edd('0x1e'),_0x891832,'request\x20sent',JSON[_0x9edd('0x1f')](_0x448996));if(_0x448996['error']){if(_0x448996[_0x9edd('0x20')][_0x9edd('0x21')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x891832,_0x448996[_0x9edd('0x20')]['message']);return _0x1042aa(_0x448996[_0x9edd('0x20')]['message']);}logger['error'](_0x9edd('0x22'),_0x891832,_0x448996[_0x9edd('0x20')]['message']);return _0x338f3c(_0x448996['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1b')](_0x9edd('0x22'),_0x891832,'request\x20sent');_0x338f3c(_0x448996[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x2ca65f){logger[_0x9edd('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x891832,_0x2ca65f);_0x1042aa(_0x2ca65f);});});}function respondWithStatusCode(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0xcc;return function(_0x3a1ea5){if(_0x3a1ea5){return _0x46c383[_0x9edd('0x26')](_0xeaf55a);}return _0x46c383[_0x9edd('0x27')](_0xeaf55a)['end']();};}function respondWithResult(_0x4b3d1b,_0x3276ee){_0x3276ee=_0x3276ee||0xc8;return function(_0xfeca7b){if(_0xfeca7b){return _0x4b3d1b[_0x9edd('0x27')](_0x3276ee)[_0x9edd('0x28')](_0xfeca7b);}};}function respondWithFilteredResult(_0x3c2227,_0x4fe471){return function(_0x57a2cc){if(_0x57a2cc){var _0x214d0a=_0x57a2cc[_0x9edd('0x29')],_0x257a26=_0x4fe471[_0x9edd('0x2a')],_0x1c762c=_0x4fe471[_0x9edd('0x2a')]+_0x4fe471[_0x9edd('0x2b')],_0x52746a;if(_0x1c762c>=_0x214d0a){_0x1c762c=_0x214d0a;_0x52746a=0xc8;}else{_0x52746a=0xce;}_0x3c2227['status'](_0x52746a);return _0x3c2227[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x257a26+'-'+_0x1c762c+'/'+_0x214d0a)[_0x9edd('0x28')](_0x57a2cc);}return null;};}function patchUpdates(_0x12c1bc){return function(_0xbbf08f){try{jsonpatch[_0x9edd('0x2e')](_0xbbf08f,_0x12c1bc,!![]);}catch(_0x209aba){return BPromise[_0x9edd('0x2f')](_0x209aba);}return _0xbbf08f[_0x9edd('0x30')]();};}function saveUpdates(_0x1c2e2b,_0x4fd03f){return function(_0x138002){if(_0x138002){return _0x138002[_0x9edd('0x31')](_0x1c2e2b)[_0x9edd('0x1a')](function(_0x1a6c23){return _0x1a6c23;});}return null;};}function removeEntity(_0x5af178,_0x1453d2){return function(_0x259259){if(_0x259259){return _0x259259[_0x9edd('0x32')]()['then'](function(){_0x5af178[_0x9edd('0x27')](0xcc)[_0x9edd('0x33')]();});}};}function handleEntityNotFound(_0xde9b13,_0x38a7be){return function(_0x21bc30){if(!_0x21bc30){_0xde9b13[_0x9edd('0x26')](0x194);}return _0x21bc30;};}function handleError(_0x473068,_0x438a5d){_0x438a5d=_0x438a5d||0x1f4;return function(_0xd0fd74){logger[_0x9edd('0x20')](_0xd0fd74[_0x9edd('0x34')]);if(_0xd0fd74[_0x9edd('0x35')]){delete _0xd0fd74[_0x9edd('0x35')];}_0x473068[_0x9edd('0x27')](_0x438a5d)['send'](_0xd0fd74);};}exports[_0x9edd('0x36')]=function(_0x5ed62d,_0x968303){var _0x148630={},_0x10d6fd={},_0x434d26={'count':0x0,'rows':[]};var _0x16770e=db['ZendeskConfiguration'][_0x9edd('0x37')];_0x10d6fd[_0x9edd('0x38')]=_[_0x9edd('0x39')](_0x16770e);_0x10d6fd[_0x9edd('0x3a')]=_[_0x9edd('0x39')](_0x5ed62d[_0x9edd('0x3a')]);_0x10d6fd[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0x10d6fd[_0x9edd('0x38')],_0x10d6fd[_0x9edd('0x3a')]);_0x148630['attributes']=_[_0x9edd('0x3c')](_0x10d6fd['model'],qs[_0x9edd('0x3d')](_0x5ed62d['query'][_0x9edd('0x3d')]));_0x148630[_0x9edd('0x3e')]=_0x148630[_0x9edd('0x3e')]['length']?_0x148630[_0x9edd('0x3e')]:_0x10d6fd[_0x9edd('0x38')];if(!_0x5ed62d[_0x9edd('0x3a')]['hasOwnProperty'](_0x9edd('0x3f'))){_0x148630['limit']=qs[_0x9edd('0x2b')](_0x5ed62d[_0x9edd('0x3a')]['limit']);_0x148630[_0x9edd('0x2a')]=qs[_0x9edd('0x2a')](_0x5ed62d[_0x9edd('0x3a')][_0x9edd('0x2a')]);}_0x148630['order']=qs[_0x9edd('0x40')](_0x5ed62d['query'][_0x9edd('0x40')]);_0x148630[_0x9edd('0x41')]=qs['filters'](_[_0x9edd('0x42')](_0x5ed62d['query'],_0x10d6fd['filters']));if(_0x5ed62d[_0x9edd('0x3a')][_0x9edd('0x43')]){_0x148630[_0x9edd('0x41')]=_[_0x9edd('0x44')](_0x148630[_0x9edd('0x41')],{'$or':_[_0x9edd('0x45')](_0x16770e,function(_0x3ff512){if(_0x3ff512[_0x9edd('0x46')][_0x9edd('0x47')]!==_0x9edd('0x48')){var _0x37a263={};_0x37a263[_0x3ff512[_0x9edd('0x49')]]={'$like':'%'+_0x5ed62d[_0x9edd('0x3a')][_0x9edd('0x43')]+'%'};return _0x37a263;}})});}_0x148630=_[_0x9edd('0x44')]({},_0x148630,_0x5ed62d['options']);var _0x13197d={'where':_0x148630[_0x9edd('0x41')]};return db[_0x9edd('0x4a')][_0x9edd('0x29')](_0x13197d)[_0x9edd('0x1a')](function(_0x3ecdfd){_0x434d26[_0x9edd('0x29')]=_0x3ecdfd;if(_0x5ed62d['query']['includeAll']){_0x148630['include']=[{'all':!![]}];}return db[_0x9edd('0x4a')]['findAll'](_0x148630);})[_0x9edd('0x1a')](function(_0x19b56b){_0x434d26[_0x9edd('0x4b')]=_0x19b56b;return _0x434d26;})[_0x9edd('0x1a')](respondWithFilteredResult(_0x968303,_0x148630))[_0x9edd('0x25')](handleError(_0x968303,null));};exports['show']=function(_0x387fb8,_0x35e63c){var _0x40e33d={'raw':![],'where':{'id':_0x387fb8[_0x9edd('0x4c')]['id']}},_0x4a89ae={};_0x4a89ae[_0x9edd('0x38')]=_[_0x9edd('0x39')](db[_0x9edd('0x4a')][_0x9edd('0x37')]);_0x4a89ae[_0x9edd('0x3a')]=_['keys'](_0x387fb8[_0x9edd('0x3a')]);_0x4a89ae[_0x9edd('0x3b')]=_['intersection'](_0x4a89ae[_0x9edd('0x38')],_0x4a89ae[_0x9edd('0x3a')]);_0x40e33d['attributes']=_[_0x9edd('0x3c')](_0x4a89ae[_0x9edd('0x38')],qs[_0x9edd('0x3d')](_0x387fb8['query'][_0x9edd('0x3d')]));_0x40e33d[_0x9edd('0x3e')]=_0x40e33d[_0x9edd('0x3e')][_0x9edd('0x4d')]?_0x40e33d['attributes']:_0x4a89ae[_0x9edd('0x38')];if(_0x387fb8[_0x9edd('0x3a')][_0x9edd('0x4e')]){_0x40e33d['include']=[{'all':!![]}];}_0x40e33d=_[_0x9edd('0x44')]({},_0x40e33d,_0x387fb8[_0x9edd('0x4f')]);return db['ZendeskConfiguration'][_0x9edd('0x50')](_0x40e33d)['then'](handleEntityNotFound(_0x35e63c,null))[_0x9edd('0x1a')](respondWithResult(_0x35e63c,null))[_0x9edd('0x25')](handleError(_0x35e63c,null));};exports[_0x9edd('0x51')]=function(_0x3fcdf5,_0x1e3c19){return db[_0x9edd('0x4a')][_0x9edd('0x51')](_0x3fcdf5[_0x9edd('0x52')],{})[_0x9edd('0x1a')](respondWithResult(_0x1e3c19,0xc9))[_0x9edd('0x25')](handleError(_0x1e3c19,null));};exports[_0x9edd('0x31')]=function(_0x5a3b1d,_0x161bea){if(_0x5a3b1d[_0x9edd('0x52')]['id']){delete _0x5a3b1d[_0x9edd('0x52')]['id'];}return db['ZendeskConfiguration'][_0x9edd('0x50')]({'where':{'id':_0x5a3b1d['params']['id']}})['then'](handleEntityNotFound(_0x161bea,null))['then'](saveUpdates(_0x5a3b1d[_0x9edd('0x52')],null))[_0x9edd('0x1a')](respondWithResult(_0x161bea,null))[_0x9edd('0x25')](handleError(_0x161bea,null));};exports[_0x9edd('0x32')]=function(_0x48a900,_0x56b38b){return db['ZendeskConfiguration'][_0x9edd('0x50')]({'where':{'id':_0x48a900[_0x9edd('0x4c')]['id']}})[_0x9edd('0x1a')](handleEntityNotFound(_0x56b38b,null))[_0x9edd('0x1a')](removeEntity(_0x56b38b,null))[_0x9edd('0x25')](handleError(_0x56b38b,null));};exports[_0x9edd('0x53')]=function(_0x25906c,_0x1e3087,_0x4eb780){var _0x16dfdc={};var _0x49d0ce={};var _0x421e82;var _0x6a1cfc;return db['ZendeskConfiguration'][_0x9edd('0x54')]({'where':{'id':_0x25906c[_0x9edd('0x4c')]['id']}})[_0x9edd('0x1a')](handleEntityNotFound(_0x1e3087,null))['then'](function(_0xc648c4){if(_0xc648c4){_0x421e82=_0xc648c4;_0x49d0ce[_0x9edd('0x38')]=_[_0x9edd('0x39')](db[_0x9edd('0x55')][_0x9edd('0x37')]);_0x49d0ce[_0x9edd('0x3a')]=_['keys'](_0x25906c['query']);_0x49d0ce[_0x9edd('0x3b')]=_['intersection'](_0x49d0ce[_0x9edd('0x38')],_0x49d0ce[_0x9edd('0x3a')]);_0x16dfdc[_0x9edd('0x3e')]=_[_0x9edd('0x3c')](_0x49d0ce['model'],qs[_0x9edd('0x3d')](_0x25906c['query'][_0x9edd('0x3d')]));_0x16dfdc[_0x9edd('0x3e')]=_0x16dfdc[_0x9edd('0x3e')]['length']?_0x16dfdc[_0x9edd('0x3e')]:_0x49d0ce['model'];_0x16dfdc[_0x9edd('0x56')]=qs[_0x9edd('0x40')](_0x25906c['query'][_0x9edd('0x40')]);_0x16dfdc['where']=qs[_0x9edd('0x3b')](_[_0x9edd('0x42')](_0x25906c[_0x9edd('0x3a')],_0x49d0ce['filters']));if(_0x25906c[_0x9edd('0x3a')][_0x9edd('0x43')]){_0x16dfdc[_0x9edd('0x41')]=_[_0x9edd('0x44')](_0x16dfdc[_0x9edd('0x41')],{'$or':_['map'](_0x16dfdc['attributes'],function(_0x2e1a96){var _0x211526={};_0x211526[_0x2e1a96]={'$like':'%'+_0x25906c['query']['filter']+'%'};return _0x211526;})});}_0x16dfdc=_['merge']({},_0x16dfdc,_0x25906c[_0x9edd('0x4f')]);return _0x421e82['getFields'](_0x16dfdc);}})['then'](function(_0x3ef9c9){if(_0x3ef9c9){_0x6a1cfc=_0x3ef9c9[_0x9edd('0x4d')];if(!_0x25906c['query'][_0x9edd('0x57')](_0x9edd('0x3f'))){_0x16dfdc[_0x9edd('0x2b')]=qs['limit'](_0x25906c[_0x9edd('0x3a')]['limit']);_0x16dfdc[_0x9edd('0x2a')]=qs[_0x9edd('0x2a')](_0x25906c['query'][_0x9edd('0x2a')]);}return _0x421e82[_0x9edd('0x53')](_0x16dfdc);}})['then'](function(_0x2bd6d1){if(_0x2bd6d1){return _0x2bd6d1?{'count':_0x6a1cfc,'rows':_0x2bd6d1}:null;}})[_0x9edd('0x1a')](respondWithResult(_0x1e3087,null))[_0x9edd('0x25')](handleError(_0x1e3087,null));};exports[_0x9edd('0x58')]=function(_0x5ce70b,_0x366b04,_0x58330c){var _0x1a618c={};var _0x1a5cdb={};var _0xf6c8aa;var _0x5ad6f4;return db[_0x9edd('0x4a')][_0x9edd('0x54')]({'where':{'id':_0x5ce70b[_0x9edd('0x4c')]['id']}})[_0x9edd('0x1a')](handleEntityNotFound(_0x366b04,null))[_0x9edd('0x1a')](function(_0x14e2e5){if(_0x14e2e5){_0xf6c8aa=_0x14e2e5;_0x1a5cdb[_0x9edd('0x38')]=_['keys'](db['ZendeskField'][_0x9edd('0x37')]);_0x1a5cdb[_0x9edd('0x3a')]=_[_0x9edd('0x39')](_0x5ce70b[_0x9edd('0x3a')]);_0x1a5cdb[_0x9edd('0x3b')]=_['intersection'](_0x1a5cdb[_0x9edd('0x38')],_0x1a5cdb[_0x9edd('0x3a')]);_0x1a618c[_0x9edd('0x3e')]=_['intersection'](_0x1a5cdb[_0x9edd('0x38')],qs[_0x9edd('0x3d')](_0x5ce70b['query'][_0x9edd('0x3d')]));_0x1a618c[_0x9edd('0x3e')]=_0x1a618c['attributes'][_0x9edd('0x4d')]?_0x1a618c[_0x9edd('0x3e')]:_0x1a5cdb['model'];_0x1a618c[_0x9edd('0x56')]=qs['sort'](_0x5ce70b['query'][_0x9edd('0x40')]);_0x1a618c[_0x9edd('0x41')]=qs[_0x9edd('0x3b')](_['pick'](_0x5ce70b[_0x9edd('0x3a')],_0x1a5cdb[_0x9edd('0x3b')]));if(_0x5ce70b['query'][_0x9edd('0x43')]){_0x1a618c[_0x9edd('0x41')]=_[_0x9edd('0x44')](_0x1a618c[_0x9edd('0x41')],{'$or':_['map'](_0x1a618c['attributes'],function(_0x1129b7){var _0x5bb28c={};_0x5bb28c[_0x1129b7]={'$like':'%'+_0x5ce70b[_0x9edd('0x3a')][_0x9edd('0x43')]+'%'};return _0x5bb28c;})});}_0x1a618c=_[_0x9edd('0x44')]({},_0x1a618c,_0x5ce70b[_0x9edd('0x4f')]);return _0xf6c8aa[_0x9edd('0x58')](_0x1a618c);}})[_0x9edd('0x1a')](function(_0x1eabcd){if(_0x1eabcd){_0x5ad6f4=_0x1eabcd[_0x9edd('0x4d')];if(!_0x5ce70b[_0x9edd('0x3a')]['hasOwnProperty'](_0x9edd('0x3f'))){_0x1a618c[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x5ce70b[_0x9edd('0x3a')][_0x9edd('0x2b')]);_0x1a618c[_0x9edd('0x2a')]=qs[_0x9edd('0x2a')](_0x5ce70b['query'][_0x9edd('0x2a')]);}return _0xf6c8aa[_0x9edd('0x58')](_0x1a618c);}})['then'](function(_0x26c11a){if(_0x26c11a){return _0x26c11a?{'count':_0x5ad6f4,'rows':_0x26c11a}:null;}})[_0x9edd('0x1a')](respondWithResult(_0x366b04,null))['catch'](handleError(_0x366b04,null));};exports[_0x9edd('0x59')]=function(_0x3d6d7a,_0xfd1b61,_0x55d112){var _0x41cd76={};var _0x191c3e={};var _0x3f04d3;var _0x5a7de3;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3d6d7a['params']['id']}})[_0x9edd('0x1a')](handleEntityNotFound(_0xfd1b61,null))[_0x9edd('0x1a')](function(_0x179b7f){if(_0x179b7f){_0x3f04d3=_0x179b7f;_0x191c3e['model']=_['keys'](db['ZendeskField'][_0x9edd('0x37')]);_0x191c3e[_0x9edd('0x3a')]=_[_0x9edd('0x39')](_0x3d6d7a[_0x9edd('0x3a')]);_0x191c3e[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0x191c3e[_0x9edd('0x38')],_0x191c3e[_0x9edd('0x3a')]);_0x41cd76[_0x9edd('0x3e')]=_[_0x9edd('0x3c')](_0x191c3e[_0x9edd('0x38')],qs[_0x9edd('0x3d')](_0x3d6d7a['query'][_0x9edd('0x3d')]));_0x41cd76[_0x9edd('0x3e')]=_0x41cd76[_0x9edd('0x3e')][_0x9edd('0x4d')]?_0x41cd76[_0x9edd('0x3e')]:_0x191c3e[_0x9edd('0x38')];_0x41cd76[_0x9edd('0x56')]=qs[_0x9edd('0x40')](_0x3d6d7a['query']['sort']);_0x41cd76[_0x9edd('0x41')]=qs['filters'](_[_0x9edd('0x42')](_0x3d6d7a['query'],_0x191c3e[_0x9edd('0x3b')]));if(_0x3d6d7a[_0x9edd('0x3a')]['filter']){_0x41cd76[_0x9edd('0x41')]=_[_0x9edd('0x44')](_0x41cd76['where'],{'$or':_[_0x9edd('0x45')](_0x41cd76[_0x9edd('0x3e')],function(_0x42d546){var _0xa36fa1={};_0xa36fa1[_0x42d546]={'$like':'%'+_0x3d6d7a[_0x9edd('0x3a')]['filter']+'%'};return _0xa36fa1;})});}_0x41cd76=_[_0x9edd('0x44')]({},_0x41cd76,_0x3d6d7a[_0x9edd('0x4f')]);return _0x3f04d3[_0x9edd('0x59')](_0x41cd76);}})[_0x9edd('0x1a')](function(_0xe898ec){if(_0xe898ec){_0x5a7de3=_0xe898ec['length'];if(!_0x3d6d7a['query']['hasOwnProperty']('nolimit')){_0x41cd76['limit']=qs[_0x9edd('0x2b')](_0x3d6d7a['query']['limit']);_0x41cd76[_0x9edd('0x2a')]=qs[_0x9edd('0x2a')](_0x3d6d7a[_0x9edd('0x3a')][_0x9edd('0x2a')]);}return _0x3f04d3[_0x9edd('0x59')](_0x41cd76);}})[_0x9edd('0x1a')](function(_0x23e213){if(_0x23e213){return _0x23e213?{'count':_0x5a7de3,'rows':_0x23e213}:null;}})[_0x9edd('0x1a')](respondWithResult(_0xfd1b61,null))[_0x9edd('0x25')](handleError(_0xfd1b61,null));};exports[_0x9edd('0x5a')]=function(_0x5b5ae9,_0x14e003,_0x2fb1c2){var _0x40df6e={};var _0x4376aa={};var _0x27c993;var _0x23e925;return db[_0x9edd('0x4a')][_0x9edd('0x54')]({'where':{'id':_0x5b5ae9['params']['id']}})['then'](handleEntityNotFound(_0x14e003,null))[_0x9edd('0x1a')](function(_0x13a2e8){if(_0x13a2e8){_0x27c993=_0x13a2e8;_0x4376aa[_0x9edd('0x38')]=_[_0x9edd('0x39')](db[_0x9edd('0x5b')][_0x9edd('0x37')]);_0x4376aa[_0x9edd('0x3a')]=_[_0x9edd('0x39')](_0x5b5ae9[_0x9edd('0x3a')]);_0x4376aa[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0x4376aa[_0x9edd('0x38')],_0x4376aa[_0x9edd('0x3a')]);_0x40df6e[_0x9edd('0x3e')]=_['intersection'](_0x4376aa[_0x9edd('0x38')],qs[_0x9edd('0x3d')](_0x5b5ae9['query'][_0x9edd('0x3d')]));_0x40df6e[_0x9edd('0x3e')]=_0x40df6e[_0x9edd('0x3e')][_0x9edd('0x4d')]?_0x40df6e['attributes']:_0x4376aa[_0x9edd('0x38')];_0x40df6e[_0x9edd('0x56')]=qs[_0x9edd('0x40')](_0x5b5ae9[_0x9edd('0x3a')][_0x9edd('0x40')]);_0x40df6e['where']=qs[_0x9edd('0x3b')](_[_0x9edd('0x42')](_0x5b5ae9[_0x9edd('0x3a')],_0x4376aa[_0x9edd('0x3b')]));if(_0x5b5ae9[_0x9edd('0x3a')]['filter']){_0x40df6e['where']=_[_0x9edd('0x44')](_0x40df6e['where'],{'$or':_[_0x9edd('0x45')](_0x40df6e['attributes'],function(_0xe9ab48){var _0x82f31a={};_0x82f31a[_0xe9ab48]={'$like':'%'+_0x5b5ae9[_0x9edd('0x3a')][_0x9edd('0x43')]+'%'};return _0x82f31a;})});}_0x40df6e=_[_0x9edd('0x44')]({},_0x40df6e,_0x5b5ae9[_0x9edd('0x4f')]);return _0x27c993['getTags'](_0x40df6e);}})[_0x9edd('0x1a')](function(_0x33beb7){if(_0x33beb7){_0x23e925=_0x33beb7[_0x9edd('0x4d')];if(!_0x5b5ae9[_0x9edd('0x3a')][_0x9edd('0x57')](_0x9edd('0x3f'))){_0x40df6e[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x5b5ae9['query'][_0x9edd('0x2b')]);_0x40df6e[_0x9edd('0x2a')]=qs[_0x9edd('0x2a')](_0x5b5ae9[_0x9edd('0x3a')][_0x9edd('0x2a')]);}return _0x27c993[_0x9edd('0x5a')](_0x40df6e);}})[_0x9edd('0x1a')](function(_0xf2ba6a){if(_0xf2ba6a){return _0xf2ba6a?{'count':_0x23e925,'rows':_0xf2ba6a}:null;}})[_0x9edd('0x1a')](respondWithResult(_0x14e003,null))[_0x9edd('0x25')](handleError(_0x14e003,null));};exports[_0x9edd('0x5c')]=function(_0x294035,_0xcadc0,_0x315a4c){if(_0x294035[_0x9edd('0x52')]['id']){delete _0x294035[_0x9edd('0x52')]['id'];}return db[_0x9edd('0x4a')][_0x9edd('0x54')]({'where':{'id':_0x294035[_0x9edd('0x4c')]['id']}})[_0x9edd('0x1a')](handleEntityNotFound(_0xcadc0,null))[_0x9edd('0x1a')](function(_0x495db0){if(_0x495db0){return _0x495db0[_0x9edd('0x5c')](_0x294035['body']['ids']||[]);}return null;})[_0x9edd('0x1a')](respondWithResult(_0xcadc0,null))[_0x9edd('0x25')](handleError(_0xcadc0,null));}; \ No newline at end of file +var _0x9c44=['order','sort','where','pick','filter','map','type','key','field','merge','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','getFields','ZendeskField','getSubjects','findOne','getDescriptions','Tag','getTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','catch','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','update','destroy','name','send','index','ZendeskConfiguration','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x132605,_0x18f711){var _0x1312d3=function(_0x45db2e){while(--_0x45db2e){_0x132605['push'](_0x132605['shift']());}};_0x1312d3(++_0x18f711);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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 hardwareService=require(_0x49c4('0x10'));var logger=require('../../config/logger')(_0x49c4('0x11'));var utils=require(_0x49c4('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x49c4('0x13'));var client=jayson[_0x49c4('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x7df3a9,_0x403bfb,_0x5f2fd9){if(_0x5f2fd9){var _0x1909fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1909fe[_0x49c4('0x15')](_0x403bfb)){return _0x7df3a9;}else{throw new Error(_0x49c4('0x16'));}}else{return _0x7df3a9;}}function respondWithRpcPromise(_0x2decee,_0x12777c,_0x18211c,_0x75ea8){return new BPromise(function(_0x3de397,_0x58d177){var _0x3acd06=_0x75ea8||client;return _0x3acd06[_0x49c4('0x17')](_0x2decee,_0x18211c)[_0x49c4('0x18')](function(_0x81e831){logger[_0x49c4('0x19')]('ZendeskConfiguration,\x20%s,\x20%s',_0x12777c,_0x49c4('0x1a'));logger[_0x49c4('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x12777c,'request\x20sent',JSON[_0x49c4('0x1c')](_0x81e831));if(_0x81e831[_0x49c4('0x1d')]){if(_0x81e831[_0x49c4('0x1d')]['code']===0x1f4){logger[_0x49c4('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x12777c,_0x81e831[_0x49c4('0x1d')][_0x49c4('0x1e')]);return _0x58d177(_0x81e831[_0x49c4('0x1d')][_0x49c4('0x1e')]);}logger[_0x49c4('0x1d')](_0x49c4('0x1f'),_0x12777c,_0x81e831[_0x49c4('0x1d')][_0x49c4('0x1e')]);return _0x3de397(_0x81e831[_0x49c4('0x1d')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x12777c,_0x49c4('0x1a'));_0x3de397(_0x81e831['result']['message']);}})[_0x49c4('0x20')](function(_0x15581b){logger[_0x49c4('0x1d')](_0x49c4('0x1f'),_0x12777c,_0x15581b);_0x58d177(_0x15581b);});});}function respondWithStatusCode(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0xcc;return function(_0x180276){if(_0x180276){return _0x4811c4[_0x49c4('0x21')](_0x5850f2);}return _0x4811c4['status'](_0x5850f2)[_0x49c4('0x22')]();};}function respondWithResult(_0x43e014,_0x210159){_0x210159=_0x210159||0xc8;return function(_0xa7a826){if(_0xa7a826){return _0x43e014['status'](_0x210159)['json'](_0xa7a826);}};}function respondWithFilteredResult(_0x449960,_0x53c199){return function(_0x3800b7){if(_0x3800b7){var _0x3852b2=_0x3800b7[_0x49c4('0x23')],_0x3f1708=_0x53c199[_0x49c4('0x24')],_0x372a47=_0x53c199[_0x49c4('0x24')]+_0x53c199[_0x49c4('0x25')],_0x5987ae;if(_0x372a47>=_0x3852b2){_0x372a47=_0x3852b2;_0x5987ae=0xc8;}else{_0x5987ae=0xce;}_0x449960[_0x49c4('0x26')](_0x5987ae);return _0x449960[_0x49c4('0x27')](_0x49c4('0x28'),_0x3f1708+'-'+_0x372a47+'/'+_0x3852b2)[_0x49c4('0x29')](_0x3800b7);}return null;};}function patchUpdates(_0x17b50f){return function(_0x2cbd88){try{jsonpatch[_0x49c4('0x2a')](_0x2cbd88,_0x17b50f,!![]);}catch(_0x4ea6ea){return BPromise['reject'](_0x4ea6ea);}return _0x2cbd88['save']();};}function saveUpdates(_0x134928,_0x7ee704){return function(_0x1eb035){if(_0x1eb035){return _0x1eb035[_0x49c4('0x2b')](_0x134928)[_0x49c4('0x18')](function(_0x574fd3){return _0x574fd3;});}return null;};}function removeEntity(_0x38ad77,_0x116eb4){return function(_0x2e7a69){if(_0x2e7a69){return _0x2e7a69[_0x49c4('0x2c')]()['then'](function(){_0x38ad77['status'](0xcc)[_0x49c4('0x22')]();});}};}function handleEntityNotFound(_0x9a1bed,_0x167efe){return function(_0x13b3b4){if(!_0x13b3b4){_0x9a1bed[_0x49c4('0x21')](0x194);}return _0x13b3b4;};}function handleError(_0x4a0c7a,_0x2aac35){_0x2aac35=_0x2aac35||0x1f4;return function(_0x84c621){logger[_0x49c4('0x1d')](_0x84c621['stack']);if(_0x84c621['name']){delete _0x84c621[_0x49c4('0x2d')];}_0x4a0c7a[_0x49c4('0x26')](_0x2aac35)[_0x49c4('0x2e')](_0x84c621);};}exports[_0x49c4('0x2f')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557={},_0x27ef5f={},_0x3209cd={'count':0x0,'rows':[]};var _0x4e0209=db[_0x49c4('0x30')]['rawAttributes'];_0x27ef5f[_0x49c4('0x31')]=_[_0x49c4('0x32')](_0x4e0209);_0x27ef5f[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x2b45a1['query']);_0x27ef5f[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x27ef5f[_0x49c4('0x31')],_0x27ef5f['query']);_0x1d1557[_0x49c4('0x36')]=_[_0x49c4('0x35')](_0x27ef5f[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x2b45a1[_0x49c4('0x33')][_0x49c4('0x37')]));_0x1d1557[_0x49c4('0x36')]=_0x1d1557[_0x49c4('0x36')][_0x49c4('0x38')]?_0x1d1557[_0x49c4('0x36')]:_0x27ef5f[_0x49c4('0x31')];if(!_0x2b45a1['query'][_0x49c4('0x39')](_0x49c4('0x3a'))){_0x1d1557[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x2b45a1[_0x49c4('0x33')][_0x49c4('0x25')]);_0x1d1557[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x2b45a1[_0x49c4('0x33')][_0x49c4('0x24')]);}_0x1d1557[_0x49c4('0x3b')]=qs[_0x49c4('0x3c')](_0x2b45a1[_0x49c4('0x33')]['sort']);_0x1d1557[_0x49c4('0x3d')]=qs['filters'](_[_0x49c4('0x3e')](_0x2b45a1[_0x49c4('0x33')],_0x27ef5f[_0x49c4('0x34')]));if(_0x2b45a1[_0x49c4('0x33')][_0x49c4('0x3f')]){_0x1d1557[_0x49c4('0x3d')]=_['merge'](_0x1d1557['where'],{'$or':_[_0x49c4('0x40')](_0x4e0209,function(_0x1e7bdc){if(_0x1e7bdc[_0x49c4('0x41')][_0x49c4('0x42')]!=='VIRTUAL'){var _0x3baff9={};_0x3baff9[_0x1e7bdc[_0x49c4('0x43')]]={'$like':'%'+_0x2b45a1[_0x49c4('0x33')][_0x49c4('0x3f')]+'%'};return _0x3baff9;}})});}_0x1d1557=_[_0x49c4('0x44')]({},_0x1d1557,_0x2b45a1[_0x49c4('0x45')]);var _0x1a9593={'where':_0x1d1557[_0x49c4('0x3d')]};return db[_0x49c4('0x30')]['count'](_0x1a9593)[_0x49c4('0x18')](function(_0x4d27d0){_0x3209cd[_0x49c4('0x23')]=_0x4d27d0;if(_0x2b45a1[_0x49c4('0x33')][_0x49c4('0x46')]){_0x1d1557[_0x49c4('0x47')]=[{'all':!![]}];}return db[_0x49c4('0x30')]['findAll'](_0x1d1557);})[_0x49c4('0x18')](function(_0x15b674){_0x3209cd[_0x49c4('0x48')]=_0x15b674;return _0x3209cd;})[_0x49c4('0x18')](respondWithFilteredResult(_0x2cf897,_0x1d1557))[_0x49c4('0x20')](handleError(_0x2cf897,null));};exports[_0x49c4('0x49')]=function(_0x9779ef,_0x4d89e0){var _0x3bac1b={'raw':![],'where':{'id':_0x9779ef[_0x49c4('0x4a')]['id']}},_0x5cfff9={};_0x5cfff9[_0x49c4('0x31')]=_[_0x49c4('0x32')](db[_0x49c4('0x30')][_0x49c4('0x4b')]);_0x5cfff9[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x9779ef['query']);_0x5cfff9[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x5cfff9['model'],_0x5cfff9[_0x49c4('0x33')]);_0x3bac1b[_0x49c4('0x36')]=_[_0x49c4('0x35')](_0x5cfff9[_0x49c4('0x31')],qs['fields'](_0x9779ef['query'][_0x49c4('0x37')]));_0x3bac1b['attributes']=_0x3bac1b[_0x49c4('0x36')][_0x49c4('0x38')]?_0x3bac1b[_0x49c4('0x36')]:_0x5cfff9[_0x49c4('0x31')];if(_0x9779ef[_0x49c4('0x33')][_0x49c4('0x46')]){_0x3bac1b[_0x49c4('0x47')]=[{'all':!![]}];}_0x3bac1b=_['merge']({},_0x3bac1b,_0x9779ef[_0x49c4('0x45')]);return db[_0x49c4('0x30')][_0x49c4('0x4c')](_0x3bac1b)[_0x49c4('0x18')](handleEntityNotFound(_0x4d89e0,null))[_0x49c4('0x18')](respondWithResult(_0x4d89e0,null))[_0x49c4('0x20')](handleError(_0x4d89e0,null));};exports[_0x49c4('0x4d')]=function(_0x25d174,_0x1e0b4f){return db[_0x49c4('0x30')]['create'](_0x25d174['body'],{})[_0x49c4('0x18')](respondWithResult(_0x1e0b4f,0xc9))[_0x49c4('0x20')](handleError(_0x1e0b4f,null));};exports['update']=function(_0x59a8bc,_0x77163d){if(_0x59a8bc['body']['id']){delete _0x59a8bc['body']['id'];}return db[_0x49c4('0x30')][_0x49c4('0x4c')]({'where':{'id':_0x59a8bc[_0x49c4('0x4a')]['id']}})[_0x49c4('0x18')](handleEntityNotFound(_0x77163d,null))[_0x49c4('0x18')](saveUpdates(_0x59a8bc[_0x49c4('0x4e')],null))[_0x49c4('0x18')](respondWithResult(_0x77163d,null))['catch'](handleError(_0x77163d,null));};exports[_0x49c4('0x2c')]=function(_0xcc6a2b,_0x207572){return db[_0x49c4('0x30')][_0x49c4('0x4c')]({'where':{'id':_0xcc6a2b[_0x49c4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x207572,null))['then'](removeEntity(_0x207572,null))[_0x49c4('0x20')](handleError(_0x207572,null));};exports[_0x49c4('0x4f')]=function(_0x2a6308,_0xf7a10f,_0x23288e){var _0x6b2592={};var _0xc2033f={};var _0x58dc5f;var _0x45d715;return db[_0x49c4('0x30')]['findOne']({'where':{'id':_0x2a6308[_0x49c4('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf7a10f,null))[_0x49c4('0x18')](function(_0x147ebd){if(_0x147ebd){_0x58dc5f=_0x147ebd;_0xc2033f[_0x49c4('0x31')]=_[_0x49c4('0x32')](db[_0x49c4('0x50')][_0x49c4('0x4b')]);_0xc2033f[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x2a6308['query']);_0xc2033f[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0xc2033f['model'],_0xc2033f[_0x49c4('0x33')]);_0x6b2592[_0x49c4('0x36')]=_['intersection'](_0xc2033f[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x2a6308['query']['fields']));_0x6b2592['attributes']=_0x6b2592['attributes'][_0x49c4('0x38')]?_0x6b2592['attributes']:_0xc2033f[_0x49c4('0x31')];_0x6b2592[_0x49c4('0x3b')]=qs['sort'](_0x2a6308[_0x49c4('0x33')][_0x49c4('0x3c')]);_0x6b2592['where']=qs[_0x49c4('0x34')](_[_0x49c4('0x3e')](_0x2a6308[_0x49c4('0x33')],_0xc2033f[_0x49c4('0x34')]));if(_0x2a6308['query'][_0x49c4('0x3f')]){_0x6b2592[_0x49c4('0x3d')]=_[_0x49c4('0x44')](_0x6b2592[_0x49c4('0x3d')],{'$or':_['map'](_0x6b2592[_0x49c4('0x36')],function(_0x4a93bc){var _0x568457={};_0x568457[_0x4a93bc]={'$like':'%'+_0x2a6308['query']['filter']+'%'};return _0x568457;})});}_0x6b2592=_[_0x49c4('0x44')]({},_0x6b2592,_0x2a6308[_0x49c4('0x45')]);return _0x58dc5f[_0x49c4('0x4f')](_0x6b2592);}})[_0x49c4('0x18')](function(_0x5b056e){if(_0x5b056e){_0x45d715=_0x5b056e['length'];if(!_0x2a6308[_0x49c4('0x33')][_0x49c4('0x39')](_0x49c4('0x3a'))){_0x6b2592[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x2a6308[_0x49c4('0x33')][_0x49c4('0x25')]);_0x6b2592[_0x49c4('0x24')]=qs['offset'](_0x2a6308[_0x49c4('0x33')]['offset']);}return _0x58dc5f[_0x49c4('0x4f')](_0x6b2592);}})[_0x49c4('0x18')](function(_0x1a5d4c){if(_0x1a5d4c){return _0x1a5d4c?{'count':_0x45d715,'rows':_0x1a5d4c}:null;}})[_0x49c4('0x18')](respondWithResult(_0xf7a10f,null))[_0x49c4('0x20')](handleError(_0xf7a10f,null));};exports[_0x49c4('0x51')]=function(_0x13d657,_0x3feb0b,_0x13d951){var _0x1743d0={};var _0x1e3911={};var _0x1c5315;var _0x217ced;return db[_0x49c4('0x30')][_0x49c4('0x52')]({'where':{'id':_0x13d657[_0x49c4('0x4a')]['id']}})[_0x49c4('0x18')](handleEntityNotFound(_0x3feb0b,null))[_0x49c4('0x18')](function(_0x4e1544){if(_0x4e1544){_0x1c5315=_0x4e1544;_0x1e3911['model']=_[_0x49c4('0x32')](db[_0x49c4('0x50')]['rawAttributes']);_0x1e3911[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x13d657[_0x49c4('0x33')]);_0x1e3911[_0x49c4('0x34')]=_['intersection'](_0x1e3911['model'],_0x1e3911['query']);_0x1743d0[_0x49c4('0x36')]=_[_0x49c4('0x35')](_0x1e3911[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x13d657[_0x49c4('0x33')][_0x49c4('0x37')]));_0x1743d0[_0x49c4('0x36')]=_0x1743d0[_0x49c4('0x36')][_0x49c4('0x38')]?_0x1743d0['attributes']:_0x1e3911[_0x49c4('0x31')];_0x1743d0[_0x49c4('0x3b')]=qs[_0x49c4('0x3c')](_0x13d657['query'][_0x49c4('0x3c')]);_0x1743d0[_0x49c4('0x3d')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3e')](_0x13d657[_0x49c4('0x33')],_0x1e3911[_0x49c4('0x34')]));if(_0x13d657[_0x49c4('0x33')][_0x49c4('0x3f')]){_0x1743d0['where']=_[_0x49c4('0x44')](_0x1743d0[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x40')](_0x1743d0[_0x49c4('0x36')],function(_0x1e948a){var _0x4a204d={};_0x4a204d[_0x1e948a]={'$like':'%'+_0x13d657['query'][_0x49c4('0x3f')]+'%'};return _0x4a204d;})});}_0x1743d0=_['merge']({},_0x1743d0,_0x13d657[_0x49c4('0x45')]);return _0x1c5315['getSubjects'](_0x1743d0);}})[_0x49c4('0x18')](function(_0x27b77d){if(_0x27b77d){_0x217ced=_0x27b77d[_0x49c4('0x38')];if(!_0x13d657[_0x49c4('0x33')]['hasOwnProperty'](_0x49c4('0x3a'))){_0x1743d0[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x13d657[_0x49c4('0x33')][_0x49c4('0x25')]);_0x1743d0[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x13d657[_0x49c4('0x33')][_0x49c4('0x24')]);}return _0x1c5315[_0x49c4('0x51')](_0x1743d0);}})['then'](function(_0x228189){if(_0x228189){return _0x228189?{'count':_0x217ced,'rows':_0x228189}:null;}})[_0x49c4('0x18')](respondWithResult(_0x3feb0b,null))['catch'](handleError(_0x3feb0b,null));};exports[_0x49c4('0x53')]=function(_0x5c7e8c,_0x1e6644,_0x1bfb8d){var _0x1f14a6={};var _0x28b0db={};var _0x2c32c0;var _0x58b90c;return db[_0x49c4('0x30')][_0x49c4('0x52')]({'where':{'id':_0x5c7e8c['params']['id']}})[_0x49c4('0x18')](handleEntityNotFound(_0x1e6644,null))[_0x49c4('0x18')](function(_0x4eb72a){if(_0x4eb72a){_0x2c32c0=_0x4eb72a;_0x28b0db[_0x49c4('0x31')]=_[_0x49c4('0x32')](db['ZendeskField'][_0x49c4('0x4b')]);_0x28b0db[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x5c7e8c[_0x49c4('0x33')]);_0x28b0db['filters']=_[_0x49c4('0x35')](_0x28b0db[_0x49c4('0x31')],_0x28b0db['query']);_0x1f14a6[_0x49c4('0x36')]=_['intersection'](_0x28b0db['model'],qs[_0x49c4('0x37')](_0x5c7e8c['query']['fields']));_0x1f14a6[_0x49c4('0x36')]=_0x1f14a6[_0x49c4('0x36')]['length']?_0x1f14a6[_0x49c4('0x36')]:_0x28b0db['model'];_0x1f14a6['order']=qs['sort'](_0x5c7e8c[_0x49c4('0x33')][_0x49c4('0x3c')]);_0x1f14a6[_0x49c4('0x3d')]=qs[_0x49c4('0x34')](_['pick'](_0x5c7e8c['query'],_0x28b0db[_0x49c4('0x34')]));if(_0x5c7e8c['query'][_0x49c4('0x3f')]){_0x1f14a6['where']=_[_0x49c4('0x44')](_0x1f14a6[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x40')](_0x1f14a6[_0x49c4('0x36')],function(_0x12d060){var _0x198924={};_0x198924[_0x12d060]={'$like':'%'+_0x5c7e8c[_0x49c4('0x33')]['filter']+'%'};return _0x198924;})});}_0x1f14a6=_[_0x49c4('0x44')]({},_0x1f14a6,_0x5c7e8c[_0x49c4('0x45')]);return _0x2c32c0[_0x49c4('0x53')](_0x1f14a6);}})[_0x49c4('0x18')](function(_0x6571a2){if(_0x6571a2){_0x58b90c=_0x6571a2['length'];if(!_0x5c7e8c[_0x49c4('0x33')][_0x49c4('0x39')](_0x49c4('0x3a'))){_0x1f14a6['limit']=qs['limit'](_0x5c7e8c[_0x49c4('0x33')][_0x49c4('0x25')]);_0x1f14a6[_0x49c4('0x24')]=qs[_0x49c4('0x24')](_0x5c7e8c[_0x49c4('0x33')]['offset']);}return _0x2c32c0[_0x49c4('0x53')](_0x1f14a6);}})[_0x49c4('0x18')](function(_0x191974){if(_0x191974){return _0x191974?{'count':_0x58b90c,'rows':_0x191974}:null;}})[_0x49c4('0x18')](respondWithResult(_0x1e6644,null))['catch'](handleError(_0x1e6644,null));};exports['getTags']=function(_0x2ca918,_0x1d710a,_0x467213){var _0x294ba0={};var _0x3dac77={};var _0x5413d8;var _0x389edb;return db[_0x49c4('0x30')][_0x49c4('0x52')]({'where':{'id':_0x2ca918[_0x49c4('0x4a')]['id']}})[_0x49c4('0x18')](handleEntityNotFound(_0x1d710a,null))[_0x49c4('0x18')](function(_0x4d60cc){if(_0x4d60cc){_0x5413d8=_0x4d60cc;_0x3dac77[_0x49c4('0x31')]=_[_0x49c4('0x32')](db[_0x49c4('0x54')][_0x49c4('0x4b')]);_0x3dac77['query']=_['keys'](_0x2ca918[_0x49c4('0x33')]);_0x3dac77['filters']=_[_0x49c4('0x35')](_0x3dac77['model'],_0x3dac77[_0x49c4('0x33')]);_0x294ba0[_0x49c4('0x36')]=_[_0x49c4('0x35')](_0x3dac77[_0x49c4('0x31')],qs['fields'](_0x2ca918['query'][_0x49c4('0x37')]));_0x294ba0[_0x49c4('0x36')]=_0x294ba0[_0x49c4('0x36')]['length']?_0x294ba0['attributes']:_0x3dac77[_0x49c4('0x31')];_0x294ba0['order']=qs['sort'](_0x2ca918[_0x49c4('0x33')]['sort']);_0x294ba0[_0x49c4('0x3d')]=qs[_0x49c4('0x34')](_['pick'](_0x2ca918[_0x49c4('0x33')],_0x3dac77[_0x49c4('0x34')]));if(_0x2ca918['query']['filter']){_0x294ba0[_0x49c4('0x3d')]=_['merge'](_0x294ba0[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x40')](_0x294ba0[_0x49c4('0x36')],function(_0x352733){var _0x1bfc82={};_0x1bfc82[_0x352733]={'$like':'%'+_0x2ca918[_0x49c4('0x33')][_0x49c4('0x3f')]+'%'};return _0x1bfc82;})});}_0x294ba0=_['merge']({},_0x294ba0,_0x2ca918[_0x49c4('0x45')]);return _0x5413d8[_0x49c4('0x55')](_0x294ba0);}})[_0x49c4('0x18')](function(_0xcc42bf){if(_0xcc42bf){_0x389edb=_0xcc42bf[_0x49c4('0x38')];if(!_0x2ca918['query'][_0x49c4('0x39')]('nolimit')){_0x294ba0[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x2ca918[_0x49c4('0x33')][_0x49c4('0x25')]);_0x294ba0['offset']=qs[_0x49c4('0x24')](_0x2ca918[_0x49c4('0x33')][_0x49c4('0x24')]);}return _0x5413d8[_0x49c4('0x55')](_0x294ba0);}})[_0x49c4('0x18')](function(_0x315c35){if(_0x315c35){return _0x315c35?{'count':_0x389edb,'rows':_0x315c35}:null;}})['then'](respondWithResult(_0x1d710a,null))[_0x49c4('0x20')](handleError(_0x1d710a,null));};exports['setTags']=function(_0xac53ad,_0x24929d,_0x1db53d){if(_0xac53ad[_0x49c4('0x4e')]['id']){delete _0xac53ad['body']['id'];}return db[_0x49c4('0x30')][_0x49c4('0x52')]({'where':{'id':_0xac53ad['params']['id']}})[_0x49c4('0x18')](handleEntityNotFound(_0x24929d,null))[_0x49c4('0x18')](function(_0x4971b1){if(_0x4971b1){return _0x4971b1['setTags'](_0xac53ad[_0x49c4('0x4e')][_0x49c4('0x56')]||[]);}return null;})[_0x49c4('0x18')](respondWithResult(_0x24929d,null))[_0x49c4('0x20')](handleError(_0x24929d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 371f219..2f41b74 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 _0x3d1f=['./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e4141,_0x6052ca){var _0x7bf0ca=function(_0x332e71){while(--_0x332e71){_0x1e4141['push'](_0x1e4141['shift']());}};_0x7bf0ca(++_0x6052ca);}(_0x3d1f,0xfb));var _0xf3d1=function(_0x39eeed,_0x5762af){_0x39eeed=_0x39eeed-0x0;var _0x45db65=_0x3d1f[_0x39eeed];return _0x45db65;};'use strict';var _=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var logger=require(_0xf3d1('0x2'))(_0xf3d1('0x3'));var moment=require('moment');var BPromise=require(_0xf3d1('0x4'));var rp=require(_0xf3d1('0x5'));var fs=require('fs');var path=require(_0xf3d1('0x6'));var rimraf=require(_0xf3d1('0x7'));var config=require(_0xf3d1('0x8'));var attributes=require(_0xf3d1('0x9'));module[_0xf3d1('0xa')]=function(_0x4a7083,_0x458014){return _0x4a7083[_0xf3d1('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0xf3d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa3a=['api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger'];(function(_0x3a607b,_0x4060ec){var _0x381f9e=function(_0x586d1e){while(--_0x586d1e){_0x3a607b['push'](_0x3a607b['shift']());}};_0x381f9e(++_0x4060ec);}(_0xfa3a,0xa6));var _0xafa3=function(_0x2ec3aa,_0x29bd65){_0x2ec3aa=_0x2ec3aa-0x0;var _0x284ab2=_0xfa3a[_0x2ec3aa];return _0x284ab2;};'use strict';var _=require(_0xafa3('0x0'));var util=require(_0xafa3('0x1'));var logger=require(_0xafa3('0x2'))(_0xafa3('0x3'));var moment=require(_0xafa3('0x4'));var BPromise=require(_0xafa3('0x5'));var rp=require(_0xafa3('0x6'));var fs=require('fs');var path=require(_0xafa3('0x7'));var rimraf=require('rimraf');var config=require(_0xafa3('0x8'));var attributes=require(_0xafa3('0x9'));module[_0xafa3('0xa')]=function(_0x1e3b62,_0x21e8f9){return _0x1e3b62[_0xafa3('0xb')](_0xafa3('0xc'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 59bb1db..aa91e6c 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 _0x2d0b=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x2d0b,0x116));var _0xb2d0=function(_0x2933a8,_0xa5003e){_0x2933a8=_0x2933a8-0x0;var _0x287b33=_0x2d0b[_0x2933a8];return _0x287b33;};'use strict';var _=require(_0xb2d0('0x0'));var util=require(_0xb2d0('0x1'));var moment=require(_0xb2d0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2d0('0x3'));var db=require(_0xb2d0('0x4'))['db'];var utils=require(_0xb2d0('0x5'));var logger=require(_0xb2d0('0x6'))('rpc');var config=require(_0xb2d0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb2d0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7dbe2e,_0x152257,_0x5a7d93){return new BPromise(function(_0x4339ee,_0x4b7886){return client[_0xb2d0('0x9')](_0x7dbe2e,_0x5a7d93)[_0xb2d0('0xa')](function(_0x3a8f8d){logger[_0xb2d0('0xb')](_0xb2d0('0xc'),_0x152257,_0xb2d0('0xd'));logger[_0xb2d0('0xe')](_0xb2d0('0xf'),_0x152257,_0xb2d0('0xd'),JSON[_0xb2d0('0x10')](_0x3a8f8d));if(_0x3a8f8d[_0xb2d0('0x11')]){if(_0x3a8f8d[_0xb2d0('0x11')][_0xb2d0('0x12')]===0x1f4){logger[_0xb2d0('0x11')](_0xb2d0('0xc'),_0x152257,_0x3a8f8d['error'][_0xb2d0('0x13')]);return _0x4b7886(_0x3a8f8d[_0xb2d0('0x11')]['message']);}logger[_0xb2d0('0x11')](_0xb2d0('0xc'),_0x152257,_0x3a8f8d[_0xb2d0('0x11')][_0xb2d0('0x13')]);return _0x4339ee(_0x3a8f8d[_0xb2d0('0x11')][_0xb2d0('0x13')]);}else{logger[_0xb2d0('0xb')](_0xb2d0('0xc'),_0x152257,'request\x20sent');_0x4339ee(_0x3a8f8d[_0xb2d0('0x14')][_0xb2d0('0x13')]);}})['catch'](function(_0x5bbcc8){logger['error'](_0xb2d0('0xc'),_0x152257,_0x5bbcc8);_0x4b7886(_0x5bbcc8);});});} \ No newline at end of file +var _0x2236=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b173c,_0x27d0b2){var _0x51be42=function(_0x5592da){while(--_0x5592da){_0x2b173c['push'](_0x2b173c['shift']());}};_0x51be42(++_0x27d0b2);}(_0x2236,0x87));var _0x6223=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x2236[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0x6223('0x0'));var util=require(_0x6223('0x1'));var moment=require(_0x6223('0x2'));var BPromise=require(_0x6223('0x3'));var rs=require(_0x6223('0x4'));var fs=require('fs');var Redis=require(_0x6223('0x5'));var db=require(_0x6223('0x6'))['db'];var utils=require(_0x6223('0x7'));var logger=require(_0x6223('0x8'))(_0x6223('0x9'));var config=require(_0x6223('0xa'));var jayson=require(_0x6223('0xb'));var client=jayson[_0x6223('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55ba12,_0x4ee6e8,_0x26cb82){return new BPromise(function(_0x42f0cb,_0x2ccc46){return client[_0x6223('0xd')](_0x55ba12,_0x26cb82)['then'](function(_0x1a75fd){logger[_0x6223('0xe')](_0x6223('0xf'),_0x4ee6e8,_0x6223('0x10'));logger['debug'](_0x6223('0x11'),_0x4ee6e8,_0x6223('0x10'),JSON[_0x6223('0x12')](_0x1a75fd));if(_0x1a75fd['error']){if(_0x1a75fd[_0x6223('0x13')]['code']===0x1f4){logger['error'](_0x6223('0xf'),_0x4ee6e8,_0x1a75fd[_0x6223('0x13')][_0x6223('0x14')]);return _0x2ccc46(_0x1a75fd[_0x6223('0x13')]['message']);}logger[_0x6223('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ee6e8,_0x1a75fd[_0x6223('0x13')]['message']);return _0x42f0cb(_0x1a75fd['error'][_0x6223('0x14')]);}else{logger[_0x6223('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ee6e8,_0x6223('0x10'));_0x42f0cb(_0x1a75fd['result'][_0x6223('0x14')]);}})[_0x6223('0x15')](function(_0x24f7dd){logger[_0x6223('0x13')](_0x6223('0xf'),_0x4ee6e8,_0x24f7dd);_0x2ccc46(_0x24f7dd);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 799096c..56588c5 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 _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x55206c,_0x500d88){var _0x1fc57=function(_0x3cbf53){while(--_0x3cbf53){_0x55206c['push'](_0x55206c['shift']());}};_0x1fc57(++_0x500d88);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router; \ No newline at end of file +var _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x561a56,_0x35978e){var _0x402f3a=function(_0x353bf4){while(--_0x353bf4){_0x561a56['push'](_0x561a56['shift']());}};_0x402f3a(++_0x35978e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('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 c6b9f62..ad06851 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 _0xe706=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x25f8e8,_0x519d8e){var _0x1df02c=function(_0x1bee7b){while(--_0x1bee7b){_0x25f8e8['push'](_0x25f8e8['shift']());}};_0x1df02c(++_0x519d8e);}(_0xe706,0xa3));var _0x6e70=function(_0x8b2a7f,_0x5987a7){_0x8b2a7f=_0x8b2a7f-0x0;var _0x2116e4=_0xe706[_0x8b2a7f];return _0x2116e4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'type':{'type':Sequelize[_0x6e70('0x2')]('string',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')),'defaultValue':_0x6e70('0x6')},'content':{'type':Sequelize[_0x6e70('0x7')]},'key':{'type':Sequelize[_0x6e70('0x7')]},'keyType':{'type':Sequelize[_0x6e70('0x2')](_0x6e70('0x6'),_0x6e70('0x3'),_0x6e70('0x4'))},'keyContent':{'type':Sequelize[_0x6e70('0x7')]},'idField':{'type':Sequelize[_0x6e70('0x7')]},'nameField':{'type':Sequelize[_0x6e70('0x7')]},'customField':{'type':Sequelize[_0x6e70('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e70('0x7')]}}; \ No newline at end of file +var _0x0bb5=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0bb5,0x148));var _0x50bb=function(_0x146790,_0x40b78b){_0x146790=_0x146790-0x0;var _0x1f89da=_0x0bb5[_0x146790];return _0x1f89da;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x50bb('0x2'),_0x50bb('0x3'),_0x50bb('0x4')),'defaultValue':_0x50bb('0x5')},'content':{'type':Sequelize[_0x50bb('0x6')]},'key':{'type':Sequelize[_0x50bb('0x6')]},'keyType':{'type':Sequelize[_0x50bb('0x7')](_0x50bb('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x50bb('0x6')]},'idField':{'type':Sequelize[_0x50bb('0x6')]},'nameField':{'type':Sequelize[_0x50bb('0x6')]},'customField':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b778efd..c924b88 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 _0x3248=['query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','field','options','ZendeskField','includeAll','include','findAll','rows','show','params','rawAttributes','length','create','body','catch','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','count','offset','limit','apply','save','update','destroy','then','end','error','stack','name','send','index','model','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3248,0x1bc));var _0x8324=function(_0x248790,_0x3cca73){_0x248790=_0x248790-0x0;var _0x5f26b3=_0x3248[_0x248790];return _0x5f26b3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8324('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8324('0x1'));var rp=require(_0x8324('0x2'));var moment=require(_0x8324('0x3'));var BPromise=require(_0x8324('0x4'));var Mustache=require(_0x8324('0x5'));var util=require(_0x8324('0x6'));var path=require('path');var sox=require(_0x8324('0x7'));var csv=require(_0x8324('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8324('0x9'));var squel=require(_0x8324('0xa'));var crypto=require(_0x8324('0xb'));var jsforce=require(_0x8324('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8324('0x8'));var querystring=require(_0x8324('0xd'));var Papa=require(_0x8324('0xe'));var Redis=require(_0x8324('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8324('0x10'));var hardwareService=require(_0x8324('0x11'));var logger=require('../../config/logger')(_0x8324('0x12'));var utils=require(_0x8324('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4790f0,_0x26ffe2){_0x26ffe2=_0x26ffe2||0xcc;return function(_0x24d731){if(_0x24d731){return _0x4790f0[_0x8324('0x14')](_0x26ffe2);}return _0x4790f0[_0x8324('0x15')](_0x26ffe2)['end']();};}function respondWithResult(_0x296bda,_0x10cfea){_0x10cfea=_0x10cfea||0xc8;return function(_0x3882a4){if(_0x3882a4){return _0x296bda[_0x8324('0x15')](_0x10cfea)[_0x8324('0x16')](_0x3882a4);}};}function respondWithFilteredResult(_0x48a712,_0x6710f4){return function(_0x4651a0){if(_0x4651a0){var _0x411e41=_0x4651a0[_0x8324('0x17')],_0x3b1a18=_0x6710f4[_0x8324('0x18')],_0x3f8f66=_0x6710f4[_0x8324('0x18')]+_0x6710f4[_0x8324('0x19')],_0x5ecb20;if(_0x3f8f66>=_0x411e41){_0x3f8f66=_0x411e41;_0x5ecb20=0xc8;}else{_0x5ecb20=0xce;}_0x48a712['status'](_0x5ecb20);return _0x48a712['set']('Content-Range',_0x3b1a18+'-'+_0x3f8f66+'/'+_0x411e41)['json'](_0x4651a0);}return null;};}function patchUpdates(_0x1c4e04){return function(_0x466cb6){try{jsonpatch[_0x8324('0x1a')](_0x466cb6,_0x1c4e04,!![]);}catch(_0x111f33){return BPromise['reject'](_0x111f33);}return _0x466cb6[_0x8324('0x1b')]();};}function saveUpdates(_0x3852c1,_0x2ff429){return function(_0xbbf8e3){if(_0xbbf8e3){return _0xbbf8e3[_0x8324('0x1c')](_0x3852c1)['then'](function(_0x43ef2b){return _0x43ef2b;});}return null;};}function removeEntity(_0x7cb877,_0x165f4c){return function(_0x4d648b){if(_0x4d648b){return _0x4d648b[_0x8324('0x1d')]()[_0x8324('0x1e')](function(){_0x7cb877[_0x8324('0x15')](0xcc)[_0x8324('0x1f')]();});}};}function handleEntityNotFound(_0x24e5e3,_0x4d0e92){return function(_0x21c707){if(!_0x21c707){_0x24e5e3[_0x8324('0x14')](0x194);}return _0x21c707;};}function handleError(_0x5274a1,_0xb0bd4b){_0xb0bd4b=_0xb0bd4b||0x1f4;return function(_0xd50595){logger[_0x8324('0x20')](_0xd50595[_0x8324('0x21')]);if(_0xd50595[_0x8324('0x22')]){delete _0xd50595['name'];}_0x5274a1['status'](_0xb0bd4b)[_0x8324('0x23')](_0xd50595);};}exports[_0x8324('0x24')]=function(_0x3e78f2,_0x3e70fe){var _0x2bd3bb={},_0x41e2fd={},_0x5b2a1a={'count':0x0,'rows':[]};var _0x329ccc=db['ZendeskField']['rawAttributes'];_0x41e2fd[_0x8324('0x25')]=_[_0x8324('0x26')](_0x329ccc);_0x41e2fd[_0x8324('0x27')]=_[_0x8324('0x26')](_0x3e78f2[_0x8324('0x27')]);_0x41e2fd['filters']=_['intersection'](_0x41e2fd[_0x8324('0x25')],_0x41e2fd['query']);_0x2bd3bb['attributes']=_[_0x8324('0x28')](_0x41e2fd['model'],qs['fields'](_0x3e78f2[_0x8324('0x27')][_0x8324('0x29')]));_0x2bd3bb[_0x8324('0x2a')]=_0x2bd3bb[_0x8324('0x2a')]['length']?_0x2bd3bb[_0x8324('0x2a')]:_0x41e2fd[_0x8324('0x25')];if(!_0x3e78f2[_0x8324('0x27')]['hasOwnProperty'](_0x8324('0x2b'))){_0x2bd3bb[_0x8324('0x19')]=qs[_0x8324('0x19')](_0x3e78f2['query'][_0x8324('0x19')]);_0x2bd3bb[_0x8324('0x18')]=qs['offset'](_0x3e78f2[_0x8324('0x27')][_0x8324('0x18')]);}_0x2bd3bb[_0x8324('0x2c')]=qs[_0x8324('0x2d')](_0x3e78f2[_0x8324('0x27')][_0x8324('0x2d')]);_0x2bd3bb[_0x8324('0x2e')]=qs[_0x8324('0x2f')](_[_0x8324('0x30')](_0x3e78f2[_0x8324('0x27')],_0x41e2fd[_0x8324('0x2f')]));if(_0x3e78f2['query'][_0x8324('0x31')]){_0x2bd3bb[_0x8324('0x2e')]=_[_0x8324('0x32')](_0x2bd3bb[_0x8324('0x2e')],{'$or':_[_0x8324('0x33')](_0x329ccc,function(_0x22ac18){if(_0x22ac18[_0x8324('0x34')]['key']!==_0x8324('0x35')){var _0x459cb1={};_0x459cb1[_0x22ac18[_0x8324('0x36')]]={'$like':'%'+_0x3e78f2[_0x8324('0x27')][_0x8324('0x31')]+'%'};return _0x459cb1;}})});}_0x2bd3bb=_[_0x8324('0x32')]({},_0x2bd3bb,_0x3e78f2[_0x8324('0x37')]);var _0x42b07b={'where':_0x2bd3bb['where']};return db[_0x8324('0x38')][_0x8324('0x17')](_0x42b07b)[_0x8324('0x1e')](function(_0x29a163){_0x5b2a1a[_0x8324('0x17')]=_0x29a163;if(_0x3e78f2[_0x8324('0x27')][_0x8324('0x39')]){_0x2bd3bb[_0x8324('0x3a')]=[{'all':!![]}];}return db[_0x8324('0x38')][_0x8324('0x3b')](_0x2bd3bb);})['then'](function(_0x3ecc37){_0x5b2a1a[_0x8324('0x3c')]=_0x3ecc37;return _0x5b2a1a;})[_0x8324('0x1e')](respondWithFilteredResult(_0x3e70fe,_0x2bd3bb))['catch'](handleError(_0x3e70fe,null));};exports[_0x8324('0x3d')]=function(_0x2a86f9,_0x274438){var _0x5dac5f={'raw':!![],'where':{'id':_0x2a86f9[_0x8324('0x3e')]['id']}},_0x2ed870={};_0x2ed870['model']=_['keys'](db['ZendeskField'][_0x8324('0x3f')]);_0x2ed870['query']=_[_0x8324('0x26')](_0x2a86f9[_0x8324('0x27')]);_0x2ed870[_0x8324('0x2f')]=_[_0x8324('0x28')](_0x2ed870[_0x8324('0x25')],_0x2ed870[_0x8324('0x27')]);_0x5dac5f[_0x8324('0x2a')]=_['intersection'](_0x2ed870[_0x8324('0x25')],qs[_0x8324('0x29')](_0x2a86f9[_0x8324('0x27')][_0x8324('0x29')]));_0x5dac5f[_0x8324('0x2a')]=_0x5dac5f['attributes'][_0x8324('0x40')]?_0x5dac5f[_0x8324('0x2a')]:_0x2ed870[_0x8324('0x25')];if(_0x2a86f9[_0x8324('0x27')][_0x8324('0x39')]){_0x5dac5f[_0x8324('0x3a')]=[{'all':!![]}];}_0x5dac5f=_['merge']({},_0x5dac5f,_0x2a86f9[_0x8324('0x37')]);return db[_0x8324('0x38')]['find'](_0x5dac5f)[_0x8324('0x1e')](handleEntityNotFound(_0x274438,null))[_0x8324('0x1e')](respondWithResult(_0x274438,null))['catch'](handleError(_0x274438,null));};exports[_0x8324('0x41')]=function(_0x349404,_0x43bc86){return db[_0x8324('0x38')][_0x8324('0x41')](_0x349404[_0x8324('0x42')],{})[_0x8324('0x1e')](respondWithResult(_0x43bc86,0xc9))[_0x8324('0x43')](handleError(_0x43bc86,null));};exports[_0x8324('0x1c')]=function(_0x5e9f9f,_0x5bc62b){if(_0x5e9f9f[_0x8324('0x42')]['id']){delete _0x5e9f9f[_0x8324('0x42')]['id'];}return db['ZendeskField'][_0x8324('0x44')]({'where':{'id':_0x5e9f9f[_0x8324('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5bc62b,null))[_0x8324('0x1e')](saveUpdates(_0x5e9f9f[_0x8324('0x42')],null))['then'](respondWithResult(_0x5bc62b,null))['catch'](handleError(_0x5bc62b,null));};exports['destroy']=function(_0x528749,_0x1ddee1){return db['ZendeskField'][_0x8324('0x44')]({'where':{'id':_0x528749[_0x8324('0x3e')]['id']}})[_0x8324('0x1e')](handleEntityNotFound(_0x1ddee1,null))[_0x8324('0x1e')](removeEntity(_0x1ddee1,null))[_0x8324('0x43')](handleError(_0x1ddee1,null));}; \ No newline at end of file +var _0x3645=['then','stack','name','send','ZendeskField','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x3645,0x154));var _0x5364=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x3645[_0xe30e17];return _0x2342c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5364('0x0'));var rimraf=require(_0x5364('0x1'));var zipdir=require(_0x5364('0x2'));var jsonpatch=require(_0x5364('0x3'));var rp=require(_0x5364('0x4'));var moment=require(_0x5364('0x5'));var BPromise=require(_0x5364('0x6'));var Mustache=require('mustache');var util=require(_0x5364('0x7'));var path=require(_0x5364('0x8'));var sox=require(_0x5364('0x9'));var csv=require(_0x5364('0xa'));var ejs=require(_0x5364('0xb'));var fs=require('fs');var _=require(_0x5364('0xc'));var squel=require(_0x5364('0xd'));var crypto=require(_0x5364('0xe'));var jsforce=require(_0x5364('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5364('0xa'));var querystring=require(_0x5364('0x10'));var Papa=require(_0x5364('0x11'));var Redis=require(_0x5364('0x12'));var authService=require(_0x5364('0x13'));var qs=require(_0x5364('0x14'));var hardwareService=require(_0x5364('0x15'));var logger=require(_0x5364('0x16'))(_0x5364('0x17'));var utils=require(_0x5364('0x18'));var config=require(_0x5364('0x19'));var db=require(_0x5364('0x1a'))['db'];function respondWithStatusCode(_0x36ef4d,_0x495688){_0x495688=_0x495688||0xcc;return function(_0x18e3aa){if(_0x18e3aa){return _0x36ef4d[_0x5364('0x1b')](_0x495688);}return _0x36ef4d[_0x5364('0x1c')](_0x495688)[_0x5364('0x1d')]();};}function respondWithResult(_0x5a2552,_0x3eb7f3){_0x3eb7f3=_0x3eb7f3||0xc8;return function(_0x50c5ab){if(_0x50c5ab){return _0x5a2552[_0x5364('0x1c')](_0x3eb7f3)['json'](_0x50c5ab);}};}function respondWithFilteredResult(_0x3ffd5d,_0x13c7d1){return function(_0x11f05e){if(_0x11f05e){var _0x2abe2a=_0x11f05e[_0x5364('0x1e')],_0x3889e4=_0x13c7d1[_0x5364('0x1f')],_0x567bb4=_0x13c7d1[_0x5364('0x1f')]+_0x13c7d1[_0x5364('0x20')],_0x50e6ce;if(_0x567bb4>=_0x2abe2a){_0x567bb4=_0x2abe2a;_0x50e6ce=0xc8;}else{_0x50e6ce=0xce;}_0x3ffd5d[_0x5364('0x1c')](_0x50e6ce);return _0x3ffd5d[_0x5364('0x21')](_0x5364('0x22'),_0x3889e4+'-'+_0x567bb4+'/'+_0x2abe2a)[_0x5364('0x23')](_0x11f05e);}return null;};}function patchUpdates(_0xaa4323){return function(_0x5192df){try{jsonpatch[_0x5364('0x24')](_0x5192df,_0xaa4323,!![]);}catch(_0x37e0a3){return BPromise[_0x5364('0x25')](_0x37e0a3);}return _0x5192df[_0x5364('0x26')]();};}function saveUpdates(_0x3c2283,_0x32a60d){return function(_0x1d5a30){if(_0x1d5a30){return _0x1d5a30[_0x5364('0x27')](_0x3c2283)[_0x5364('0x28')](function(_0x356eca){return _0x356eca;});}return null;};}function removeEntity(_0x39dc4a,_0x5a04ef){return function(_0xbb788){if(_0xbb788){return _0xbb788['destroy']()['then'](function(){_0x39dc4a[_0x5364('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd706,_0x2a8dd6){return function(_0x1c08f9){if(!_0x1c08f9){_0x1bd706[_0x5364('0x1b')](0x194);}return _0x1c08f9;};}function handleError(_0x1dfa2c,_0x553e1d){_0x553e1d=_0x553e1d||0x1f4;return function(_0x23c6e4){logger['error'](_0x23c6e4[_0x5364('0x29')]);if(_0x23c6e4[_0x5364('0x2a')]){delete _0x23c6e4['name'];}_0x1dfa2c[_0x5364('0x1c')](_0x553e1d)[_0x5364('0x2b')](_0x23c6e4);};}exports['index']=function(_0xb5ae80,_0x3302c8){var _0x2f4ae2={},_0x22fc39={},_0x4d3460={'count':0x0,'rows':[]};var _0x34248a=db[_0x5364('0x2c')][_0x5364('0x2d')];_0x22fc39[_0x5364('0x2e')]=_[_0x5364('0x2f')](_0x34248a);_0x22fc39[_0x5364('0x30')]=_['keys'](_0xb5ae80['query']);_0x22fc39[_0x5364('0x31')]=_['intersection'](_0x22fc39[_0x5364('0x2e')],_0x22fc39[_0x5364('0x30')]);_0x2f4ae2[_0x5364('0x32')]=_[_0x5364('0x33')](_0x22fc39[_0x5364('0x2e')],qs['fields'](_0xb5ae80[_0x5364('0x30')][_0x5364('0x34')]));_0x2f4ae2[_0x5364('0x32')]=_0x2f4ae2[_0x5364('0x32')][_0x5364('0x35')]?_0x2f4ae2[_0x5364('0x32')]:_0x22fc39[_0x5364('0x2e')];if(!_0xb5ae80[_0x5364('0x30')][_0x5364('0x36')](_0x5364('0x37'))){_0x2f4ae2[_0x5364('0x20')]=qs['limit'](_0xb5ae80['query'][_0x5364('0x20')]);_0x2f4ae2[_0x5364('0x1f')]=qs[_0x5364('0x1f')](_0xb5ae80['query']['offset']);}_0x2f4ae2[_0x5364('0x38')]=qs[_0x5364('0x39')](_0xb5ae80[_0x5364('0x30')]['sort']);_0x2f4ae2[_0x5364('0x3a')]=qs['filters'](_[_0x5364('0x3b')](_0xb5ae80['query'],_0x22fc39['filters']));if(_0xb5ae80[_0x5364('0x30')][_0x5364('0x3c')]){_0x2f4ae2[_0x5364('0x3a')]=_[_0x5364('0x3d')](_0x2f4ae2[_0x5364('0x3a')],{'$or':_['map'](_0x34248a,function(_0x5db982){if(_0x5db982[_0x5364('0x3e')][_0x5364('0x3f')]!==_0x5364('0x40')){var _0x146570={};_0x146570[_0x5db982[_0x5364('0x41')]]={'$like':'%'+_0xb5ae80[_0x5364('0x30')][_0x5364('0x3c')]+'%'};return _0x146570;}})});}_0x2f4ae2=_['merge']({},_0x2f4ae2,_0xb5ae80['options']);var _0x50b596={'where':_0x2f4ae2[_0x5364('0x3a')]};return db[_0x5364('0x2c')][_0x5364('0x1e')](_0x50b596)[_0x5364('0x28')](function(_0x2e6575){_0x4d3460[_0x5364('0x1e')]=_0x2e6575;if(_0xb5ae80[_0x5364('0x30')][_0x5364('0x42')]){_0x2f4ae2[_0x5364('0x43')]=[{'all':!![]}];}return db[_0x5364('0x2c')][_0x5364('0x44')](_0x2f4ae2);})[_0x5364('0x28')](function(_0x5ccc98){_0x4d3460[_0x5364('0x45')]=_0x5ccc98;return _0x4d3460;})[_0x5364('0x28')](respondWithFilteredResult(_0x3302c8,_0x2f4ae2))[_0x5364('0x46')](handleError(_0x3302c8,null));};exports[_0x5364('0x47')]=function(_0x19aa25,_0x3a430d){var _0x21fdd8={'raw':!![],'where':{'id':_0x19aa25[_0x5364('0x48')]['id']}},_0x3b907e={};_0x3b907e[_0x5364('0x2e')]=_[_0x5364('0x2f')](db[_0x5364('0x2c')][_0x5364('0x2d')]);_0x3b907e[_0x5364('0x30')]=_[_0x5364('0x2f')](_0x19aa25['query']);_0x3b907e[_0x5364('0x31')]=_['intersection'](_0x3b907e['model'],_0x3b907e[_0x5364('0x30')]);_0x21fdd8[_0x5364('0x32')]=_[_0x5364('0x33')](_0x3b907e[_0x5364('0x2e')],qs[_0x5364('0x34')](_0x19aa25[_0x5364('0x30')]['fields']));_0x21fdd8[_0x5364('0x32')]=_0x21fdd8[_0x5364('0x32')][_0x5364('0x35')]?_0x21fdd8['attributes']:_0x3b907e[_0x5364('0x2e')];if(_0x19aa25['query'][_0x5364('0x42')]){_0x21fdd8['include']=[{'all':!![]}];}_0x21fdd8=_[_0x5364('0x3d')]({},_0x21fdd8,_0x19aa25['options']);return db['ZendeskField'][_0x5364('0x49')](_0x21fdd8)[_0x5364('0x28')](handleEntityNotFound(_0x3a430d,null))[_0x5364('0x28')](respondWithResult(_0x3a430d,null))['catch'](handleError(_0x3a430d,null));};exports[_0x5364('0x4a')]=function(_0x4c5b41,_0x3cc725){return db['ZendeskField']['create'](_0x4c5b41['body'],{})[_0x5364('0x28')](respondWithResult(_0x3cc725,0xc9))[_0x5364('0x46')](handleError(_0x3cc725,null));};exports[_0x5364('0x27')]=function(_0x265fab,_0x4321fe){if(_0x265fab[_0x5364('0x4b')]['id']){delete _0x265fab[_0x5364('0x4b')]['id'];}return db[_0x5364('0x2c')]['find']({'where':{'id':_0x265fab[_0x5364('0x48')]['id']}})[_0x5364('0x28')](handleEntityNotFound(_0x4321fe,null))[_0x5364('0x28')](saveUpdates(_0x265fab['body'],null))[_0x5364('0x28')](respondWithResult(_0x4321fe,null))[_0x5364('0x46')](handleError(_0x4321fe,null));};exports['destroy']=function(_0x11ab7c,_0x41441b){return db[_0x5364('0x2c')][_0x5364('0x49')]({'where':{'id':_0x11ab7c[_0x5364('0x48')]['id']}})['then'](handleEntityNotFound(_0x41441b,null))[_0x5364('0x28')](removeEntity(_0x41441b,null))[_0x5364('0x46')](handleError(_0x41441b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d33e23a..a950dc9 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 _0xec78=['./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3e0a0e,_0x1ecf6d){var _0x8e0d0a=function(_0x521ce6){while(--_0x521ce6){_0x3e0a0e['push'](_0x3e0a0e['shift']());}};_0x8e0d0a(++_0x1ecf6d);}(_0xec78,0x149));var _0x8ec7=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0xec78[_0x4ef826];return _0x154b8;};'use strict';var _=require(_0x8ec7('0x0'));var util=require(_0x8ec7('0x1'));var logger=require('../../config/logger')(_0x8ec7('0x2'));var moment=require(_0x8ec7('0x3'));var BPromise=require(_0x8ec7('0x4'));var rp=require(_0x8ec7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ec7('0x6'));var attributes=require(_0x8ec7('0x7'));module['exports']=function(_0x2d2afa,_0x1c3bc0){return _0x2d2afa['define'](_0x8ec7('0x8'),attributes,{'tableName':_0x8ec7('0x9'),'paranoid':![],'indexes':[{'name':_0x8ec7('0xa'),'fields':[_0x8ec7('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb6e=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb6e,0x13a));var _0xedb6=function(_0x4d7d33,_0x575510){_0x4d7d33=_0x4d7d33-0x0;var _0x19407b=_0xdb6e[_0x4d7d33];return _0x19407b;};'use strict';var _=require(_0xedb6('0x0'));var util=require(_0xedb6('0x1'));var logger=require(_0xedb6('0x2'))(_0xedb6('0x3'));var moment=require(_0xedb6('0x4'));var BPromise=require(_0xedb6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xedb6('0x6'));var config=require(_0xedb6('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x2304fe,_0x32ce57){return _0x2304fe['define'](_0xedb6('0x8'),attributes,{'tableName':_0xedb6('0x9'),'paranoid':![],'indexes':[{'name':_0xedb6('0xa'),'fields':[_0xedb6('0xb'),_0xedb6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index df92038..393504a 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 _0x9e6b=['request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9e6b[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var moment=require('moment');var BPromise=require(_0xb9e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9e6('0x3'))['db'];var utils=require(_0xb9e6('0x4'));var logger=require(_0xb9e6('0x5'))(_0xb9e6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9e6('0x7'));var client=jayson[_0xb9e6('0x8')][_0xb9e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bb674,_0x2cbcf7,_0x49565c){return new BPromise(function(_0x5a54db,_0x4cc018){return client[_0xb9e6('0xa')](_0x4bb674,_0x49565c)['then'](function(_0x378e17){logger[_0xb9e6('0xb')](_0xb9e6('0xc'),_0x2cbcf7,_0xb9e6('0xd'));logger[_0xb9e6('0xe')](_0xb9e6('0xf'),_0x2cbcf7,_0xb9e6('0xd'),JSON[_0xb9e6('0x10')](_0x378e17));if(_0x378e17[_0xb9e6('0x11')]){if(_0x378e17[_0xb9e6('0x11')]['code']===0x1f4){logger[_0xb9e6('0x11')](_0xb9e6('0xc'),_0x2cbcf7,_0x378e17[_0xb9e6('0x11')][_0xb9e6('0x12')]);return _0x4cc018(_0x378e17['error'][_0xb9e6('0x12')]);}logger[_0xb9e6('0x11')]('ZendeskField,\x20%s,\x20%s',_0x2cbcf7,_0x378e17['error'][_0xb9e6('0x12')]);return _0x5a54db(_0x378e17[_0xb9e6('0x11')][_0xb9e6('0x12')]);}else{logger[_0xb9e6('0xb')]('ZendeskField,\x20%s,\x20%s',_0x2cbcf7,_0xb9e6('0xd'));_0x5a54db(_0x378e17[_0xb9e6('0x13')][_0xb9e6('0x12')]);}})[_0xb9e6('0x14')](function(_0x15aa3d){logger[_0xb9e6('0x11')](_0xb9e6('0xc'),_0x2cbcf7,_0x15aa3d);_0x4cc018(_0x15aa3d);});});} \ No newline at end of file +var _0x2547=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x2547,0x1cd));var _0x7254=function(_0x5abede,_0x33a5f8){_0x5abede=_0x5abede-0x0;var _0x23e145=_0x2547[_0x5abede];return _0x23e145;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('ZendeskField,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e7f4f38..25fc260 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 _0xe511=['post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields'];(function(_0x510eca,_0xd3c7f8){var _0xd170a0=function(_0x8efe19){while(--_0x8efe19){_0x510eca['push'](_0x510eca['shift']());}};_0xd170a0(++_0xd3c7f8);}(_0xe511,0x16f));var _0x1e51=function(_0x4fcf10,_0x2db1c9){_0x4fcf10=_0x4fcf10-0x0;var _0x474d90=_0xe511[_0x4fcf10];return _0x474d90;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var auth=require(_0x1e51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e51('0x5'));var controller=require(_0x1e51('0x6'));router[_0x1e51('0x7')]('/',auth[_0x1e51('0x8')](),controller['index']);router[_0x1e51('0x7')](_0x1e51('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1e51('0x7')](_0x1e51('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1e51('0x7')](_0x1e51('0xb'),auth[_0x1e51('0x8')](),controller[_0x1e51('0xc')]);router[_0x1e51('0xd')]('/',auth[_0x1e51('0x8')](),controller['create']);router[_0x1e51('0xd')](_0x1e51('0xa'),auth[_0x1e51('0x8')](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')](_0x1e51('0x9'),auth['isAuthenticated'](),controller[_0x1e51('0x10')]);router[_0x1e51('0x11')](_0x1e51('0x9'),auth[_0x1e51('0x8')](),controller[_0x1e51('0x12')]);module[_0x1e51('0x13')]=router; \ No newline at end of file +var _0x8f4c=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','delete'];(function(_0x379d8a,_0x1b8006){var _0xd13759=function(_0x176ec0){while(--_0x176ec0){_0x379d8a['push'](_0x379d8a['shift']());}};_0xd13759(++_0x1b8006);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3d4454,_0x25d4d3){_0x3d4454=_0x3d4454-0x0;var _0x2425f9=_0x8f4c[_0x3d4454];return _0x2425f9;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8f4('0x6'));var config=require(_0xc8f4('0x7'));var controller=require(_0xc8f4('0x8'));router['get']('/',auth[_0xc8f4('0x9')](),controller['index']);router['get']('/:id',auth[_0xc8f4('0x9')](),controller['show']);router[_0xc8f4('0xa')](_0xc8f4('0xb'),auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xc')]);router[_0xc8f4('0xa')]('/:id/fields',auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xd')]);router[_0xc8f4('0xe')]('/',auth[_0xc8f4('0x9')](),controller['create']);router[_0xc8f4('0xe')]('/:id/configurations',auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xf')]);router[_0xc8f4('0x10')](_0xc8f4('0x11'),auth[_0xc8f4('0x9')](),controller['update']);router[_0xc8f4('0x12')](_0xc8f4('0x11'),auth[_0xc8f4('0x9')](),controller[_0xc8f4('0x13')]);module[_0xc8f4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 366f708..8c0881b 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 _0x05c3=['STRING','sequelize','exports'];(function(_0x259a12,_0x10f4cd){var _0x585c0c=function(_0x27c140){while(--_0x27c140){_0x259a12['push'](_0x259a12['shift']());}};_0x585c0c(++_0x10f4cd);}(_0x05c3,0x166));var _0x305c=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0x05c3[_0x5d3903];return _0x4b8bc9;};'use strict';var Sequelize=require(_0x305c('0x0'));module[_0x305c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x305c('0x2')]},'authToken':{'type':Sequelize[_0x305c('0x2')]},'host':{'type':Sequelize[_0x305c('0x2')]},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd49=['sequelize','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfd49,0x1ef));var _0x9fd4=function(_0x16c7fc,_0x36450b){_0x16c7fc=_0x16c7fc-0x0;var _0x1bf4a1=_0xfd49[_0x16c7fc];return _0x1bf4a1;};'use strict';var Sequelize=require(_0x9fd4('0x0'));module[_0x9fd4('0x1')]={'name':{'type':Sequelize[_0x9fd4('0x2')]},'description':{'type':Sequelize[_0x9fd4('0x2')]},'authToken':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9fd4('0x2')]},'serverUrl':{'type':Sequelize[_0x9fd4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7f60d24..7e15872 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 _0x42e5=['ZohoConfiguration','rawAttributes','map','nolimit','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','getFields','host','authToken','slice','substring','lastIndexOf','GET','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','section','Call\x20Purpose','includes','push','label','customfield','true','val','test','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','ZohoAccount','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','find','catch','create','body','findOne'];(function(_0x58175f,_0x275d92){var _0x37e6bc=function(_0x495260){while(--_0x495260){_0x58175f['push'](_0x58175f['shift']());}};_0x37e6bc(++_0x275d92);}(_0x42e5,0x96));var _0x542e=function(_0x204e52,_0x1d553a){_0x204e52=_0x204e52-0x0;var _0xe5dd25=_0x42e5[_0x204e52];return _0xe5dd25;};'use strict';var pdf=require(_0x542e('0x0'));var emlformat=require(_0x542e('0x1'));var rimraf=require(_0x542e('0x2'));var zipdir=require(_0x542e('0x3'));var jsonpatch=require(_0x542e('0x4'));var rp=require(_0x542e('0x5'));var moment=require(_0x542e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x542e('0x7'));var util=require('util');var path=require(_0x542e('0x8'));var sox=require('sox');var csv=require(_0x542e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x542e('0xa'));var squel=require('squel');var crypto=require(_0x542e('0xb'));var jsforce=require(_0x542e('0xc'));var deskjs=require(_0x542e('0xd'));var toCsv=require(_0x542e('0x9'));var querystring=require(_0x542e('0xe'));var Papa=require(_0x542e('0xf'));var Redis=require(_0x542e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x542e('0x11'));var hardwareService=require(_0x542e('0x12'));var logger=require(_0x542e('0x13'))(_0x542e('0x14'));var utils=require(_0x542e('0x15'));var config=require(_0x542e('0x16'));var db=require(_0x542e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x542e('0x18'));var client=jayson['client'][_0x542e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x51c863,_0x25ce02,_0x8810ad){if(_0x8810ad){var _0x5864fc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5864fc['test'](_0x25ce02)){return _0x51c863;}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 _0x51c863;}}function respondWithRpcPromise(_0x3c0ea5,_0x68c456,_0x27143b,_0x51eb38){return new BPromise(function(_0x46595a,_0x6aa76c){var _0x488061=_0x51eb38||client;return _0x488061[_0x542e('0x1a')](_0x3c0ea5,_0x27143b)[_0x542e('0x1b')](function(_0x5be450){logger[_0x542e('0x1c')](_0x542e('0x1d'),_0x68c456,'request\x20sent');logger[_0x542e('0x1e')](_0x542e('0x1f'),_0x68c456,_0x542e('0x20'),JSON[_0x542e('0x21')](_0x5be450));if(_0x5be450['error']){if(_0x5be450['error']['code']===0x1f4){logger[_0x542e('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x68c456,_0x5be450['error'][_0x542e('0x23')]);return _0x6aa76c(_0x5be450['error'][_0x542e('0x23')]);}logger['error'](_0x542e('0x1d'),_0x68c456,_0x5be450[_0x542e('0x22')]['message']);return _0x46595a(_0x5be450[_0x542e('0x22')]['message']);}else{logger[_0x542e('0x1c')](_0x542e('0x1d'),_0x68c456,_0x542e('0x20'));_0x46595a(_0x5be450[_0x542e('0x24')]['message']);}})['catch'](function(_0x5a36c1){logger[_0x542e('0x22')](_0x542e('0x1d'),_0x68c456,_0x5a36c1);_0x6aa76c(_0x5a36c1);});});}function respondWithStatusCode(_0x1b4da2,_0x30fa23){_0x30fa23=_0x30fa23||0xcc;return function(_0x3aabd4){if(_0x3aabd4){return _0x1b4da2[_0x542e('0x25')](_0x30fa23);}return _0x1b4da2[_0x542e('0x26')](_0x30fa23)[_0x542e('0x27')]();};}function respondWithResult(_0x320048,_0x1fdba2){_0x1fdba2=_0x1fdba2||0xc8;return function(_0x35dc1a){if(_0x35dc1a){return _0x320048['status'](_0x1fdba2)[_0x542e('0x28')](_0x35dc1a);}};}function respondWithFilteredResult(_0x111088,_0x2e43b3){return function(_0x2392c7){if(_0x2392c7){var _0x377ac4=_0x2392c7[_0x542e('0x29')],_0xa74da7=_0x2e43b3[_0x542e('0x2a')],_0x2c7ea4=_0x2e43b3[_0x542e('0x2a')]+_0x2e43b3['limit'],_0x52b320;if(_0x2c7ea4>=_0x377ac4){_0x2c7ea4=_0x377ac4;_0x52b320=0xc8;}else{_0x52b320=0xce;}_0x111088[_0x542e('0x26')](_0x52b320);return _0x111088[_0x542e('0x2b')](_0x542e('0x2c'),_0xa74da7+'-'+_0x2c7ea4+'/'+_0x377ac4)[_0x542e('0x28')](_0x2392c7);}return null;};}function patchUpdates(_0x3b269){return function(_0x4f8424){try{jsonpatch[_0x542e('0x2d')](_0x4f8424,_0x3b269,!![]);}catch(_0x5c1b49){return BPromise[_0x542e('0x2e')](_0x5c1b49);}return _0x4f8424[_0x542e('0x2f')]();};}function saveUpdates(_0x10c5f1,_0x27253c){return function(_0x4fe9c1){if(_0x4fe9c1){return _0x4fe9c1[_0x542e('0x30')](_0x10c5f1)[_0x542e('0x1b')](function(_0x23630a){return _0x23630a;});}return null;};}function removeEntity(_0xa116a1,_0x1d6dc7){return function(_0xa0c2d8){if(_0xa0c2d8){return _0xa0c2d8[_0x542e('0x31')]()[_0x542e('0x1b')](function(){_0xa116a1[_0x542e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb467,_0x46b1ad){return function(_0x304ae9){if(!_0x304ae9){_0x3fb467[_0x542e('0x25')](0x194);}return _0x304ae9;};}function handleError(_0x4349de,_0x4c87c7){_0x4c87c7=_0x4c87c7||0x1f4;return function(_0x59adbe){logger['error'](_0x59adbe['stack']);if(_0x59adbe[_0x542e('0x32')]){delete _0x59adbe[_0x542e('0x32')];}_0x4349de[_0x542e('0x26')](_0x4c87c7)[_0x542e('0x33')](_0x59adbe);};}exports['index']=function(_0x42076d,_0x3ae582){var _0x4ff5d4={},_0x2b686c={},_0x2935c3={'count':0x0,'rows':[]};var _0x376694=db[_0x542e('0x34')]['rawAttributes'];_0x2b686c['model']=_[_0x542e('0x35')](_0x376694);_0x2b686c['query']=_[_0x542e('0x35')](_0x42076d[_0x542e('0x36')]);_0x2b686c['filters']=_[_0x542e('0x37')](_0x2b686c[_0x542e('0x38')],_0x2b686c[_0x542e('0x36')]);_0x4ff5d4[_0x542e('0x39')]=_[_0x542e('0x37')](_0x2b686c['model'],qs[_0x542e('0x3a')](_0x42076d[_0x542e('0x36')][_0x542e('0x3a')]));_0x4ff5d4[_0x542e('0x39')]=_0x4ff5d4['attributes'][_0x542e('0x3b')]?_0x4ff5d4[_0x542e('0x39')]:_0x2b686c['model'];if(!_0x42076d[_0x542e('0x36')][_0x542e('0x3c')]('nolimit')){_0x4ff5d4[_0x542e('0x3d')]=qs[_0x542e('0x3d')](_0x42076d[_0x542e('0x36')]['limit']);_0x4ff5d4[_0x542e('0x2a')]=qs['offset'](_0x42076d[_0x542e('0x36')][_0x542e('0x2a')]);}_0x4ff5d4[_0x542e('0x3e')]=qs[_0x542e('0x3f')](_0x42076d[_0x542e('0x36')][_0x542e('0x3f')]);_0x4ff5d4[_0x542e('0x40')]=qs[_0x542e('0x41')](_[_0x542e('0x42')](_0x42076d[_0x542e('0x36')],_0x2b686c[_0x542e('0x41')]));if(_0x42076d['query'][_0x542e('0x43')]){_0x4ff5d4['where']=_['merge'](_0x4ff5d4[_0x542e('0x40')],{'$or':_['map'](_0x376694,function(_0x37e181){if(_0x37e181[_0x542e('0x44')]['key']!==_0x542e('0x45')){var _0x5b8b24={};_0x5b8b24[_0x37e181['field']]={'$like':'%'+_0x42076d[_0x542e('0x36')][_0x542e('0x43')]+'%'};return _0x5b8b24;}})});}_0x4ff5d4=_[_0x542e('0x46')]({},_0x4ff5d4,_0x42076d[_0x542e('0x47')]);var _0x1c7864={'where':_0x4ff5d4[_0x542e('0x40')]};return db[_0x542e('0x34')][_0x542e('0x29')](_0x1c7864)['then'](function(_0x320036){_0x2935c3[_0x542e('0x29')]=_0x320036;if(_0x42076d[_0x542e('0x36')][_0x542e('0x48')]){_0x4ff5d4['include']=[{'all':!![]}];}return db[_0x542e('0x34')][_0x542e('0x49')](_0x4ff5d4);})[_0x542e('0x1b')](function(_0xb83af9){_0x2935c3[_0x542e('0x4a')]=_0xb83af9;return _0x2935c3;})[_0x542e('0x1b')](respondWithFilteredResult(_0x3ae582,_0x4ff5d4))['catch'](handleError(_0x3ae582,null));};exports[_0x542e('0x4b')]=function(_0x56f195,_0x198961){var _0x2d20b6={'raw':![],'where':{'id':_0x56f195[_0x542e('0x4c')]['id']}},_0x24ced2={};_0x24ced2[_0x542e('0x38')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x24ced2[_0x542e('0x36')]=_['keys'](_0x56f195['query']);_0x24ced2[_0x542e('0x41')]=_[_0x542e('0x37')](_0x24ced2[_0x542e('0x38')],_0x24ced2[_0x542e('0x36')]);_0x2d20b6['attributes']=_[_0x542e('0x37')](_0x24ced2['model'],qs[_0x542e('0x3a')](_0x56f195[_0x542e('0x36')][_0x542e('0x3a')]));_0x2d20b6[_0x542e('0x39')]=_0x2d20b6['attributes'][_0x542e('0x3b')]?_0x2d20b6[_0x542e('0x39')]:_0x24ced2[_0x542e('0x38')];if(_0x56f195[_0x542e('0x36')][_0x542e('0x48')]){_0x2d20b6['include']=[{'all':!![]}];}_0x2d20b6=_['merge']({},_0x2d20b6,_0x56f195[_0x542e('0x47')]);return db[_0x542e('0x34')][_0x542e('0x4d')](_0x2d20b6)[_0x542e('0x1b')](handleEntityNotFound(_0x198961,null))[_0x542e('0x1b')](respondWithResult(_0x198961,null))[_0x542e('0x4e')](handleError(_0x198961,null));};exports[_0x542e('0x4f')]=function(_0xf1ad79,_0x486e10){return db[_0x542e('0x34')][_0x542e('0x4f')](_0xf1ad79['body'],{})['then'](respondWithResult(_0x486e10,0xc9))['catch'](handleError(_0x486e10,null));};exports[_0x542e('0x30')]=function(_0x38b869,_0x5d570a){if(_0x38b869[_0x542e('0x50')]['id']){delete _0x38b869[_0x542e('0x50')]['id'];}return db[_0x542e('0x34')][_0x542e('0x4d')]({'where':{'id':_0x38b869[_0x542e('0x4c')]['id']}})[_0x542e('0x1b')](handleEntityNotFound(_0x5d570a,null))[_0x542e('0x1b')](saveUpdates(_0x38b869['body'],null))[_0x542e('0x1b')](respondWithResult(_0x5d570a,null))['catch'](handleError(_0x5d570a,null));};exports[_0x542e('0x31')]=function(_0x48d31a,_0x5ba677){return db['ZohoAccount'][_0x542e('0x4d')]({'where':{'id':_0x48d31a[_0x542e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ba677,null))[_0x542e('0x1b')](removeEntity(_0x5ba677,null))['catch'](handleError(_0x5ba677,null));};exports['getConfigurations']=function(_0xc84d42,_0x206a5f,_0x2d3215){var _0x107797={};var _0x566781={};var _0x193d3a;var _0x32fd9c;return db[_0x542e('0x34')][_0x542e('0x51')]({'where':{'id':_0xc84d42['params']['id']}})[_0x542e('0x1b')](handleEntityNotFound(_0x206a5f,null))[_0x542e('0x1b')](function(_0x463ee8){if(_0x463ee8){_0x193d3a=_0x463ee8;_0x566781[_0x542e('0x38')]=_[_0x542e('0x35')](db[_0x542e('0x52')][_0x542e('0x53')]);_0x566781[_0x542e('0x36')]=_[_0x542e('0x35')](_0xc84d42['query']);_0x566781[_0x542e('0x41')]=_[_0x542e('0x37')](_0x566781['model'],_0x566781[_0x542e('0x36')]);_0x107797[_0x542e('0x39')]=_[_0x542e('0x37')](_0x566781[_0x542e('0x38')],qs['fields'](_0xc84d42['query']['fields']));_0x107797[_0x542e('0x39')]=_0x107797[_0x542e('0x39')][_0x542e('0x3b')]?_0x107797[_0x542e('0x39')]:_0x566781[_0x542e('0x38')];_0x107797[_0x542e('0x3e')]=qs['sort'](_0xc84d42[_0x542e('0x36')]['sort']);_0x107797[_0x542e('0x40')]=qs[_0x542e('0x41')](_['pick'](_0xc84d42[_0x542e('0x36')],_0x566781[_0x542e('0x41')]));if(_0xc84d42['query'][_0x542e('0x43')]){_0x107797[_0x542e('0x40')]=_[_0x542e('0x46')](_0x107797['where'],{'$or':_[_0x542e('0x54')](_0x107797[_0x542e('0x39')],function(_0x122ba3){var _0x382231={};_0x382231[_0x122ba3]={'$like':'%'+_0xc84d42[_0x542e('0x36')][_0x542e('0x43')]+'%'};return _0x382231;})});}_0x107797=_[_0x542e('0x46')]({},_0x107797,_0xc84d42[_0x542e('0x47')]);return _0x193d3a['getConfigurations'](_0x107797);}})[_0x542e('0x1b')](function(_0x56db1e){if(_0x56db1e){_0x32fd9c=_0x56db1e['length'];if(!_0xc84d42[_0x542e('0x36')][_0x542e('0x3c')](_0x542e('0x55'))){_0x107797['limit']=qs[_0x542e('0x3d')](_0xc84d42[_0x542e('0x36')][_0x542e('0x3d')]);_0x107797[_0x542e('0x2a')]=qs[_0x542e('0x2a')](_0xc84d42['query'][_0x542e('0x2a')]);}return _0x193d3a[_0x542e('0x56')](_0x107797);}})[_0x542e('0x1b')](function(_0x2ce24d){if(_0x2ce24d){return _0x2ce24d?{'count':_0x32fd9c,'rows':_0x2ce24d}:null;}})[_0x542e('0x1b')](respondWithResult(_0x206a5f,null))['catch'](handleError(_0x206a5f,null));};exports['addConfiguration']=function(_0x157bec,_0x4ebdfa,_0x249996){if(_0x157bec['body']['id']){delete _0x157bec[_0x542e('0x50')]['id'];}return db[_0x542e('0x34')][_0x542e('0x51')]({'where':{'id':_0x157bec[_0x542e('0x4c')]['id']}})[_0x542e('0x1b')](handleEntityNotFound(_0x4ebdfa,null))[_0x542e('0x1b')](function(_0x4c43f7){if(_0x4c43f7){_0x157bec[_0x542e('0x50')][_0x542e('0x57')]=_0x4c43f7['id'];_0x157bec['body'][_0x542e('0x58')]=integrations[_0x542e('0x59')](_0x157bec[_0x542e('0x50')]['channel'],_0x157bec['body']['type']);_0x157bec[_0x542e('0x50')][_0x542e('0x5a')]=integrations[_0x542e('0x5b')](_0x157bec[_0x542e('0x50')][_0x542e('0x5c')],_0x157bec[_0x542e('0x50')][_0x542e('0x44')]);return db[_0x542e('0x52')][_0x542e('0x4f')](_0x157bec[_0x542e('0x50')],{'include':[{'model':db[_0x542e('0x5d')],'as':_0x542e('0x58')},{'model':db[_0x542e('0x5d')],'as':_0x542e('0x5a')}]});}return null;})['then'](respondWithResult(_0x4ebdfa,null))['catch'](handleError(_0x4ebdfa,null));};exports[_0x542e('0x5e')]=function(_0x4bb4b4,_0x17d2ab,_0x6a6626){var _0x2ed543='';return db['ZohoAccount']['findOne']({'where':{'id':_0x4bb4b4[_0x542e('0x4c')]['id']},'attributes':['id',_0x542e('0x5f'),_0x542e('0x60')]})[_0x542e('0x1b')](handleEntityNotFound(_0x17d2ab,null))['then'](function(_0xc08dd7){if(_0xc08dd7){_0x2ed543=_0xc08dd7[_0x542e('0x5f')];var _0x50f601=_0x2ed543[_0x542e('0x61')](-0x1);if(_0x50f601==='/'){_0x2ed543=_0x2ed543[_0x542e('0x62')](0x0,_0x2ed543[_0x542e('0x63')](_0x50f601));}return rp({'method':_0x542e('0x64'),'uri':util[_0x542e('0x65')](_0x542e('0x66'),_0x2ed543),'qs':{'authtoken':_0xc08dd7[_0x542e('0x60')],'scope':_0x542e('0x67')},'json':!![]});}})[_0x542e('0x1b')](function(_0xae8a97){if(_0xae8a97){if(_0xae8a97[_0x542e('0x68')]&&_0xae8a97['response']['error']){throw new Error(_0xae8a97[_0x542e('0x68')][_0x542e('0x22')]['message']);}var _0x53e8a3=[];if(_0xae8a97[_0x542e('0x69')]&&_0xae8a97[_0x542e('0x69')]['section']){if(_0xae8a97['Calls'][_0x542e('0x6a')]['FL']){var _0x9980fb=[_0x542e('0x6b')];for(var _0x4e3131=0x0,_0x1b9d72=_0xae8a97[_0x542e('0x69')][_0x542e('0x6a')]['FL']['length'];_0x4e3131<_0x1b9d72;_0x4e3131++){if(_[_0x542e('0x6c')](_0x9980fb,_0xae8a97['Calls']['section']['FL'][_0x4e3131]['dv'])){_0x53e8a3[_0x542e('0x6d')]({'id':_0xae8a97[_0x542e('0x69')][_0x542e('0x6a')]['FL'][_0x4e3131]['dv'],'name':_0xae8a97[_0x542e('0x69')]['section']['FL'][_0x4e3131][_0x542e('0x6e')],'custom':_0xae8a97[_0x542e('0x69')]['section']['FL'][_0x4e3131][_0x542e('0x6f')]===_0x542e('0x70')?!![]:![],'options':_0xae8a97[_0x542e('0x69')]['section']['FL'][_0x4e3131][_0x542e('0x44')]==='Pick\x20List'&&_0xae8a97['Calls'][_0x542e('0x6a')]['FL'][_0x4e3131][_0x542e('0x71')]?_[_0x542e('0x54')](_0xae8a97[_0x542e('0x69')][_0x542e('0x6a')]['FL'][_0x4e3131][_0x542e('0x71')],function(_0x1ff076){return{'name':_0x1ff076,'value':_0x1ff076};}):[]});}}}}return{'count':_0x53e8a3['length'],'rows':_0x53e8a3};}})[_0x542e('0x1b')](respondWithResult(_0x17d2ab,null))[_0x542e('0x4e')](function(_0x3ebcbb){var _0x146d8e=_0x4bb4b4[_0x542e('0x36')][_0x542e('0x72')]?0x1f4:_0x3ebcbb[_0x542e('0x73')]||0x1f4;logger[_0x542e('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x542e('0x5e'),_0x146d8e,JSON[_0x542e('0x21')](_0x3ebcbb));delete _0x3ebcbb[_0x542e('0x32')];if(_0x146d8e===0x191){_0x146d8e=0x190;}_0x17d2ab[_0x542e('0x26')](_0x146d8e)['send'](_0x4bb4b4[_0x542e('0x36')][_0x542e('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x3ebcbb[_0x542e('0x73')]}:_0x3ebcbb);});}; \ No newline at end of file +var _0xd5aa=['lastIndexOf','format','https://crm.%s/crm/private/json/Calls/getFields','authToken','crmapi','response','Calls','section','Call\x20Purpose','includes','push','label','true','Pick\x20List','val','statusCode','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','ZohoAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','type','key','VIRTUAL','options','where','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','host','slice','substring'];(function(_0x381594,_0xb0d5c9){var _0xbf799=function(_0x53acce){while(--_0x53acce){_0x381594['push'](_0x381594['shift']());}};_0xbf799(++_0xb0d5c9);}(_0xd5aa,0x1e2));var _0xad5a=function(_0x3d6e37,_0x32cbdc){_0x3d6e37=_0x3d6e37-0x0;var _0x1a61f3=_0xd5aa[_0x3d6e37];return _0x1a61f3;};'use strict';var pdf=require(_0xad5a('0x0'));var emlformat=require(_0xad5a('0x1'));var rimraf=require(_0xad5a('0x2'));var zipdir=require(_0xad5a('0x3'));var jsonpatch=require(_0xad5a('0x4'));var rp=require(_0xad5a('0x5'));var moment=require(_0xad5a('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad5a('0x7'));var path=require(_0xad5a('0x8'));var sox=require('sox');var csv=require(_0xad5a('0x9'));var ejs=require(_0xad5a('0xa'));var fs=require('fs');var _=require(_0xad5a('0xb'));var squel=require(_0xad5a('0xc'));var crypto=require('crypto');var jsforce=require(_0xad5a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xad5a('0x9'));var querystring=require('querystring');var Papa=require(_0xad5a('0xe'));var Redis=require('ioredis');var authService=require(_0xad5a('0xf'));var qs=require(_0xad5a('0x10'));var hardwareService=require(_0xad5a('0x11'));var logger=require(_0xad5a('0x12'))(_0xad5a('0x13'));var utils=require(_0xad5a('0x14'));var config=require('../../config/environment');var db=require(_0xad5a('0x15'))['db'];var integrations=require(_0xad5a('0x16'));var jayson=require(_0xad5a('0x17'));var client=jayson[_0xad5a('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x289dfb,_0x1084c9,_0x4163d1){if(_0x4163d1){var _0x1cee76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cee76[_0xad5a('0x19')](_0x1084c9)){return _0x289dfb;}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 _0x289dfb;}}function respondWithRpcPromise(_0x587d5b,_0x3ae82f,_0x2780b8,_0x49d9dc){return new BPromise(function(_0x415bba,_0x31d21b){var _0x16df52=_0x49d9dc||client;return _0x16df52[_0xad5a('0x1a')](_0x587d5b,_0x2780b8)[_0xad5a('0x1b')](function(_0xf28cab){logger['info'](_0xad5a('0x1c'),_0x3ae82f,_0xad5a('0x1d'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3ae82f,_0xad5a('0x1d'),JSON[_0xad5a('0x1e')](_0xf28cab));if(_0xf28cab[_0xad5a('0x1f')]){if(_0xf28cab[_0xad5a('0x1f')][_0xad5a('0x20')]===0x1f4){logger[_0xad5a('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x3ae82f,_0xf28cab['error'][_0xad5a('0x21')]);return _0x31d21b(_0xf28cab[_0xad5a('0x1f')][_0xad5a('0x21')]);}logger[_0xad5a('0x1f')](_0xad5a('0x1c'),_0x3ae82f,_0xf28cab['error'][_0xad5a('0x21')]);return _0x415bba(_0xf28cab['error'][_0xad5a('0x21')]);}else{logger[_0xad5a('0x22')](_0xad5a('0x1c'),_0x3ae82f,_0xad5a('0x1d'));_0x415bba(_0xf28cab[_0xad5a('0x23')][_0xad5a('0x21')]);}})[_0xad5a('0x24')](function(_0x1f7552){logger['error'](_0xad5a('0x1c'),_0x3ae82f,_0x1f7552);_0x31d21b(_0x1f7552);});});}function respondWithStatusCode(_0x552db8,_0x1f1413){_0x1f1413=_0x1f1413||0xcc;return function(_0x1f0be){if(_0x1f0be){return _0x552db8[_0xad5a('0x25')](_0x1f1413);}return _0x552db8[_0xad5a('0x26')](_0x1f1413)[_0xad5a('0x27')]();};}function respondWithResult(_0x3ae895,_0x201a2b){_0x201a2b=_0x201a2b||0xc8;return function(_0x3a8928){if(_0x3a8928){return _0x3ae895[_0xad5a('0x26')](_0x201a2b)[_0xad5a('0x28')](_0x3a8928);}};}function respondWithFilteredResult(_0x4c9627,_0x259fdf){return function(_0x288a24){if(_0x288a24){var _0x28364c=_0x288a24[_0xad5a('0x29')],_0xf071d3=_0x259fdf['offset'],_0x3e4512=_0x259fdf[_0xad5a('0x2a')]+_0x259fdf[_0xad5a('0x2b')],_0x43f739;if(_0x3e4512>=_0x28364c){_0x3e4512=_0x28364c;_0x43f739=0xc8;}else{_0x43f739=0xce;}_0x4c9627[_0xad5a('0x26')](_0x43f739);return _0x4c9627[_0xad5a('0x2c')](_0xad5a('0x2d'),_0xf071d3+'-'+_0x3e4512+'/'+_0x28364c)[_0xad5a('0x28')](_0x288a24);}return null;};}function patchUpdates(_0x5818f7){return function(_0x32164f){try{jsonpatch[_0xad5a('0x2e')](_0x32164f,_0x5818f7,!![]);}catch(_0x148641){return BPromise['reject'](_0x148641);}return _0x32164f[_0xad5a('0x2f')]();};}function saveUpdates(_0x100bf7,_0x2f8c44){return function(_0x29a3b0){if(_0x29a3b0){return _0x29a3b0[_0xad5a('0x30')](_0x100bf7)[_0xad5a('0x1b')](function(_0x4dfaa7){return _0x4dfaa7;});}return null;};}function removeEntity(_0x1d2ab0,_0xb06ec8){return function(_0x2bed19){if(_0x2bed19){return _0x2bed19[_0xad5a('0x31')]()[_0xad5a('0x1b')](function(){_0x1d2ab0['status'](0xcc)[_0xad5a('0x27')]();});}};}function handleEntityNotFound(_0x5af00d,_0x4378a4){return function(_0xb70adf){if(!_0xb70adf){_0x5af00d[_0xad5a('0x25')](0x194);}return _0xb70adf;};}function handleError(_0x5043b9,_0x2896b8){_0x2896b8=_0x2896b8||0x1f4;return function(_0x4e3edd){logger[_0xad5a('0x1f')](_0x4e3edd[_0xad5a('0x32')]);if(_0x4e3edd[_0xad5a('0x33')]){delete _0x4e3edd[_0xad5a('0x33')];}_0x5043b9[_0xad5a('0x26')](_0x2896b8)[_0xad5a('0x34')](_0x4e3edd);};}exports[_0xad5a('0x35')]=function(_0x878f86,_0x4256fb){var _0x4788be={},_0xac094b={},_0x352952={'count':0x0,'rows':[]};var _0x38bcb2=db[_0xad5a('0x36')][_0xad5a('0x37')];_0xac094b[_0xad5a('0x38')]=_[_0xad5a('0x39')](_0x38bcb2);_0xac094b[_0xad5a('0x3a')]=_[_0xad5a('0x39')](_0x878f86[_0xad5a('0x3a')]);_0xac094b[_0xad5a('0x3b')]=_[_0xad5a('0x3c')](_0xac094b[_0xad5a('0x38')],_0xac094b[_0xad5a('0x3a')]);_0x4788be[_0xad5a('0x3d')]=_[_0xad5a('0x3c')](_0xac094b[_0xad5a('0x38')],qs[_0xad5a('0x3e')](_0x878f86[_0xad5a('0x3a')][_0xad5a('0x3e')]));_0x4788be[_0xad5a('0x3d')]=_0x4788be['attributes'][_0xad5a('0x3f')]?_0x4788be[_0xad5a('0x3d')]:_0xac094b[_0xad5a('0x38')];if(!_0x878f86[_0xad5a('0x3a')][_0xad5a('0x40')](_0xad5a('0x41'))){_0x4788be[_0xad5a('0x2b')]=qs['limit'](_0x878f86[_0xad5a('0x3a')]['limit']);_0x4788be['offset']=qs[_0xad5a('0x2a')](_0x878f86[_0xad5a('0x3a')][_0xad5a('0x2a')]);}_0x4788be[_0xad5a('0x42')]=qs['sort'](_0x878f86[_0xad5a('0x3a')][_0xad5a('0x43')]);_0x4788be['where']=qs[_0xad5a('0x3b')](_[_0xad5a('0x44')](_0x878f86[_0xad5a('0x3a')],_0xac094b[_0xad5a('0x3b')]));if(_0x878f86[_0xad5a('0x3a')][_0xad5a('0x45')]){_0x4788be['where']=_[_0xad5a('0x46')](_0x4788be['where'],{'$or':_[_0xad5a('0x47')](_0x38bcb2,function(_0x4eb21e){if(_0x4eb21e[_0xad5a('0x48')][_0xad5a('0x49')]!==_0xad5a('0x4a')){var _0x3fd0ba={};_0x3fd0ba[_0x4eb21e['field']]={'$like':'%'+_0x878f86[_0xad5a('0x3a')][_0xad5a('0x45')]+'%'};return _0x3fd0ba;}})});}_0x4788be=_[_0xad5a('0x46')]({},_0x4788be,_0x878f86[_0xad5a('0x4b')]);var _0x2a7819={'where':_0x4788be[_0xad5a('0x4c')]};return db[_0xad5a('0x36')][_0xad5a('0x29')](_0x2a7819)[_0xad5a('0x1b')](function(_0x156c6f){_0x352952['count']=_0x156c6f;if(_0x878f86[_0xad5a('0x3a')][_0xad5a('0x4d')]){_0x4788be[_0xad5a('0x4e')]=[{'all':!![]}];}return db[_0xad5a('0x36')][_0xad5a('0x4f')](_0x4788be);})[_0xad5a('0x1b')](function(_0x184f53){_0x352952['rows']=_0x184f53;return _0x352952;})[_0xad5a('0x1b')](respondWithFilteredResult(_0x4256fb,_0x4788be))['catch'](handleError(_0x4256fb,null));};exports[_0xad5a('0x50')]=function(_0x2e958a,_0x241959){var _0x5f7f82={'raw':![],'where':{'id':_0x2e958a[_0xad5a('0x51')]['id']}},_0x2c2f83={};_0x2c2f83[_0xad5a('0x38')]=_['keys'](db[_0xad5a('0x36')][_0xad5a('0x37')]);_0x2c2f83[_0xad5a('0x3a')]=_[_0xad5a('0x39')](_0x2e958a[_0xad5a('0x3a')]);_0x2c2f83['filters']=_['intersection'](_0x2c2f83[_0xad5a('0x38')],_0x2c2f83[_0xad5a('0x3a')]);_0x5f7f82[_0xad5a('0x3d')]=_[_0xad5a('0x3c')](_0x2c2f83['model'],qs[_0xad5a('0x3e')](_0x2e958a[_0xad5a('0x3a')][_0xad5a('0x3e')]));_0x5f7f82[_0xad5a('0x3d')]=_0x5f7f82[_0xad5a('0x3d')]['length']?_0x5f7f82[_0xad5a('0x3d')]:_0x2c2f83[_0xad5a('0x38')];if(_0x2e958a['query'][_0xad5a('0x4d')]){_0x5f7f82[_0xad5a('0x4e')]=[{'all':!![]}];}_0x5f7f82=_[_0xad5a('0x46')]({},_0x5f7f82,_0x2e958a['options']);return db[_0xad5a('0x36')][_0xad5a('0x52')](_0x5f7f82)[_0xad5a('0x1b')](handleEntityNotFound(_0x241959,null))[_0xad5a('0x1b')](respondWithResult(_0x241959,null))[_0xad5a('0x24')](handleError(_0x241959,null));};exports[_0xad5a('0x53')]=function(_0x310ffb,_0x4beae0){return db[_0xad5a('0x36')]['create'](_0x310ffb[_0xad5a('0x54')],{})['then'](respondWithResult(_0x4beae0,0xc9))['catch'](handleError(_0x4beae0,null));};exports[_0xad5a('0x30')]=function(_0x1e7db5,_0xd9278d){if(_0x1e7db5['body']['id']){delete _0x1e7db5[_0xad5a('0x54')]['id'];}return db[_0xad5a('0x36')]['find']({'where':{'id':_0x1e7db5[_0xad5a('0x51')]['id']}})[_0xad5a('0x1b')](handleEntityNotFound(_0xd9278d,null))[_0xad5a('0x1b')](saveUpdates(_0x1e7db5[_0xad5a('0x54')],null))[_0xad5a('0x1b')](respondWithResult(_0xd9278d,null))[_0xad5a('0x24')](handleError(_0xd9278d,null));};exports[_0xad5a('0x31')]=function(_0x3042dc,_0x4bdc76){return db[_0xad5a('0x36')][_0xad5a('0x52')]({'where':{'id':_0x3042dc[_0xad5a('0x51')]['id']}})[_0xad5a('0x1b')](handleEntityNotFound(_0x4bdc76,null))[_0xad5a('0x1b')](removeEntity(_0x4bdc76,null))[_0xad5a('0x24')](handleError(_0x4bdc76,null));};exports[_0xad5a('0x55')]=function(_0x3765a8,_0x3f5f7a,_0x2ccb24){var _0x3cf8ed={};var _0x1d5018={};var _0x1a153b;var _0x5725c5;return db[_0xad5a('0x36')][_0xad5a('0x56')]({'where':{'id':_0x3765a8[_0xad5a('0x51')]['id']}})[_0xad5a('0x1b')](handleEntityNotFound(_0x3f5f7a,null))[_0xad5a('0x1b')](function(_0x4f1787){if(_0x4f1787){_0x1a153b=_0x4f1787;_0x1d5018[_0xad5a('0x38')]=_[_0xad5a('0x39')](db['ZohoConfiguration'][_0xad5a('0x37')]);_0x1d5018[_0xad5a('0x3a')]=_['keys'](_0x3765a8[_0xad5a('0x3a')]);_0x1d5018[_0xad5a('0x3b')]=_[_0xad5a('0x3c')](_0x1d5018[_0xad5a('0x38')],_0x1d5018[_0xad5a('0x3a')]);_0x3cf8ed[_0xad5a('0x3d')]=_['intersection'](_0x1d5018[_0xad5a('0x38')],qs['fields'](_0x3765a8[_0xad5a('0x3a')][_0xad5a('0x3e')]));_0x3cf8ed[_0xad5a('0x3d')]=_0x3cf8ed[_0xad5a('0x3d')][_0xad5a('0x3f')]?_0x3cf8ed[_0xad5a('0x3d')]:_0x1d5018[_0xad5a('0x38')];_0x3cf8ed[_0xad5a('0x42')]=qs[_0xad5a('0x43')](_0x3765a8[_0xad5a('0x3a')][_0xad5a('0x43')]);_0x3cf8ed['where']=qs[_0xad5a('0x3b')](_[_0xad5a('0x44')](_0x3765a8[_0xad5a('0x3a')],_0x1d5018['filters']));if(_0x3765a8[_0xad5a('0x3a')][_0xad5a('0x45')]){_0x3cf8ed[_0xad5a('0x4c')]=_[_0xad5a('0x46')](_0x3cf8ed['where'],{'$or':_[_0xad5a('0x47')](_0x3cf8ed[_0xad5a('0x3d')],function(_0x180932){var _0x489500={};_0x489500[_0x180932]={'$like':'%'+_0x3765a8[_0xad5a('0x3a')][_0xad5a('0x45')]+'%'};return _0x489500;})});}_0x3cf8ed=_[_0xad5a('0x46')]({},_0x3cf8ed,_0x3765a8['options']);return _0x1a153b[_0xad5a('0x55')](_0x3cf8ed);}})[_0xad5a('0x1b')](function(_0x335e15){if(_0x335e15){_0x5725c5=_0x335e15[_0xad5a('0x3f')];if(!_0x3765a8[_0xad5a('0x3a')]['hasOwnProperty'](_0xad5a('0x41'))){_0x3cf8ed[_0xad5a('0x2b')]=qs[_0xad5a('0x2b')](_0x3765a8[_0xad5a('0x3a')][_0xad5a('0x2b')]);_0x3cf8ed[_0xad5a('0x2a')]=qs['offset'](_0x3765a8['query'][_0xad5a('0x2a')]);}return _0x1a153b['getConfigurations'](_0x3cf8ed);}})[_0xad5a('0x1b')](function(_0x1b5bc6){if(_0x1b5bc6){return _0x1b5bc6?{'count':_0x5725c5,'rows':_0x1b5bc6}:null;}})[_0xad5a('0x1b')](respondWithResult(_0x3f5f7a,null))[_0xad5a('0x24')](handleError(_0x3f5f7a,null));};exports[_0xad5a('0x57')]=function(_0xe8004e,_0x47bfaf,_0x41493e){if(_0xe8004e[_0xad5a('0x54')]['id']){delete _0xe8004e[_0xad5a('0x54')]['id'];}return db[_0xad5a('0x36')][_0xad5a('0x56')]({'where':{'id':_0xe8004e[_0xad5a('0x51')]['id']}})[_0xad5a('0x1b')](handleEntityNotFound(_0x47bfaf,null))['then'](function(_0x545d45){if(_0x545d45){_0xe8004e['body'][_0xad5a('0x58')]=_0x545d45['id'];_0xe8004e[_0xad5a('0x54')][_0xad5a('0x59')]=integrations[_0xad5a('0x5a')](_0xe8004e[_0xad5a('0x54')][_0xad5a('0x5b')],_0xe8004e[_0xad5a('0x54')]['type']);_0xe8004e[_0xad5a('0x54')][_0xad5a('0x5c')]=integrations[_0xad5a('0x5d')](_0xe8004e['body'][_0xad5a('0x5b')],_0xe8004e[_0xad5a('0x54')][_0xad5a('0x48')]);return db['ZohoConfiguration'][_0xad5a('0x53')](_0xe8004e[_0xad5a('0x54')],{'include':[{'model':db[_0xad5a('0x5e')],'as':_0xad5a('0x59')},{'model':db[_0xad5a('0x5e')],'as':_0xad5a('0x5c')}]});}return null;})[_0xad5a('0x1b')](respondWithResult(_0x47bfaf,null))['catch'](handleError(_0x47bfaf,null));};exports['getFields']=function(_0x3fbb16,_0x150445,_0x16dbd0){var _0x188794='';return db[_0xad5a('0x36')][_0xad5a('0x56')]({'where':{'id':_0x3fbb16[_0xad5a('0x51')]['id']},'attributes':['id','host','authToken']})[_0xad5a('0x1b')](handleEntityNotFound(_0x150445,null))['then'](function(_0x5446a6){if(_0x5446a6){_0x188794=_0x5446a6[_0xad5a('0x5f')];var _0x16b2a3=_0x188794[_0xad5a('0x60')](-0x1);if(_0x16b2a3==='/'){_0x188794=_0x188794[_0xad5a('0x61')](0x0,_0x188794[_0xad5a('0x62')](_0x16b2a3));}return rp({'method':'GET','uri':util[_0xad5a('0x63')](_0xad5a('0x64'),_0x188794),'qs':{'authtoken':_0x5446a6[_0xad5a('0x65')],'scope':_0xad5a('0x66')},'json':!![]});}})[_0xad5a('0x1b')](function(_0xb19e0f){if(_0xb19e0f){if(_0xb19e0f[_0xad5a('0x67')]&&_0xb19e0f[_0xad5a('0x67')]['error']){throw new Error(_0xb19e0f[_0xad5a('0x67')][_0xad5a('0x1f')]['message']);}var _0xba0de=[];if(_0xb19e0f[_0xad5a('0x68')]&&_0xb19e0f['Calls']['section']){if(_0xb19e0f['Calls'][_0xad5a('0x69')]['FL']){var _0x25bf8d=[_0xad5a('0x6a')];for(var _0x448d19=0x0,_0xab1208=_0xb19e0f[_0xad5a('0x68')][_0xad5a('0x69')]['FL'][_0xad5a('0x3f')];_0x448d19<_0xab1208;_0x448d19++){if(_[_0xad5a('0x6b')](_0x25bf8d,_0xb19e0f[_0xad5a('0x68')][_0xad5a('0x69')]['FL'][_0x448d19]['dv'])){_0xba0de[_0xad5a('0x6c')]({'id':_0xb19e0f[_0xad5a('0x68')]['section']['FL'][_0x448d19]['dv'],'name':_0xb19e0f[_0xad5a('0x68')][_0xad5a('0x69')]['FL'][_0x448d19][_0xad5a('0x6d')],'custom':_0xb19e0f['Calls'][_0xad5a('0x69')]['FL'][_0x448d19]['customfield']===_0xad5a('0x6e')?!![]:![],'options':_0xb19e0f[_0xad5a('0x68')][_0xad5a('0x69')]['FL'][_0x448d19][_0xad5a('0x48')]===_0xad5a('0x6f')&&_0xb19e0f[_0xad5a('0x68')][_0xad5a('0x69')]['FL'][_0x448d19]['val']?_[_0xad5a('0x47')](_0xb19e0f[_0xad5a('0x68')][_0xad5a('0x69')]['FL'][_0x448d19][_0xad5a('0x70')],function(_0x17f0f7){return{'name':_0x17f0f7,'value':_0x17f0f7};}):[]});}}}}return{'count':_0xba0de['length'],'rows':_0xba0de};}})['then'](respondWithResult(_0x150445,null))[_0xad5a('0x24')](function(_0x258829){var _0x12ceed=_0x3fbb16[_0xad5a('0x3a')][_0xad5a('0x19')]?0x1f4:_0x258829[_0xad5a('0x71')]||0x1f4;logger[_0xad5a('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xad5a('0x72'),_0x12ceed,JSON[_0xad5a('0x1e')](_0x258829));delete _0x258829[_0xad5a('0x33')];if(_0x12ceed===0x191){_0x12ceed=0x190;}_0x150445[_0xad5a('0x26')](_0x12ceed)[_0xad5a('0x34')](_0x3fbb16[_0xad5a('0x3a')][_0xad5a('0x19')]?{'message':_0xad5a('0x73'),'statusCode':_0x258829[_0xad5a('0x71')]}:_0x258829);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e2a3fd6..a792fa8 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 _0x70af=['path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bbdca,_0x2efe61){var _0xcbd55=function(_0x2ee60e){while(--_0x2ee60e){_0x1bbdca['push'](_0x1bbdca['shift']());}};_0xcbd55(++_0x2efe61);}(_0x70af,0x78));var _0xf70a=function(_0x180fb9,_0x280b52){_0x180fb9=_0x180fb9-0x0;var _0x8284d0=_0x70af[_0x180fb9];return _0x8284d0;};'use strict';var _=require('lodash');var util=require(_0xf70a('0x0'));var logger=require(_0xf70a('0x1'))(_0xf70a('0x2'));var moment=require(_0xf70a('0x3'));var BPromise=require(_0xf70a('0x4'));var rp=require(_0xf70a('0x5'));var fs=require('fs');var path=require(_0xf70a('0x6'));var rimraf=require(_0xf70a('0x7'));var config=require(_0xf70a('0x8'));var attributes=require(_0xf70a('0x9'));var integrations=require(_0xf70a('0xa'));module[_0xf70a('0xb')]=function(_0x4bd56f,_0x57ab54){return _0x4bd56f[_0xf70a('0xc')](_0xf70a('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc7b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','lodash'];(function(_0x3f9a53,_0x210f42){var _0x45fc20=function(_0x68bb52){while(--_0x68bb52){_0x3f9a53['push'](_0x3f9a53['shift']());}};_0x45fc20(++_0x210f42);}(_0xbc7b,0x195));var _0xbbc7=function(_0x18e919,_0x150e77){_0x18e919=_0x18e919-0x0;var _0x379d42=_0xbc7b[_0x18e919];return _0x379d42;};'use strict';var _=require(_0xbbc7('0x0'));var util=require('util');var logger=require(_0xbbc7('0x1'))(_0xbbc7('0x2'));var moment=require(_0xbbc7('0x3'));var BPromise=require(_0xbbc7('0x4'));var rp=require(_0xbbc7('0x5'));var fs=require('fs');var path=require(_0xbbc7('0x6'));var rimraf=require(_0xbbc7('0x7'));var config=require(_0xbbc7('0x8'));var attributes=require(_0xbbc7('0x9'));var integrations=require(_0xbbc7('0xa'));module[_0xbbc7('0xb')]=function(_0x5a230b,_0x256169){return _0x5a230b[_0xbbc7('0xc')]('ZohoAccount',attributes,{'tableName':_0xbbc7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ff759ff..f161e6d 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 _0xd987=['http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where','limit','map','include','model','attributes','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x21ba7d,_0x3721f1){var _0x1445b6=function(_0xde3c73){while(--_0xde3c73){_0x21ba7d['push'](_0x21ba7d['shift']());}};_0x1445b6(++_0x3721f1);}(_0xd987,0x15d));var _0x7d98=function(_0x603f79,_0x1308f0){_0x603f79=_0x603f79-0x0;var _0x4df97b=_0xd987[_0x603f79];return _0x4df97b;};'use strict';var _=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var moment=require(_0x7d98('0x2'));var BPromise=require(_0x7d98('0x3'));var rs=require(_0x7d98('0x4'));var fs=require('fs');var Redis=require(_0x7d98('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d98('0x6'));var logger=require(_0x7d98('0x7'))(_0x7d98('0x8'));var config=require(_0x7d98('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d98('0xa')][_0x7d98('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcfcf4c,_0x4a4d96,_0x2bc05f){return new BPromise(function(_0x3e2e11,_0x4d5442){return client['request'](_0xcfcf4c,_0x2bc05f)[_0x7d98('0xc')](function(_0x59cf2e){logger[_0x7d98('0xd')](_0x7d98('0xe'),_0x4a4d96,_0x7d98('0xf'));logger[_0x7d98('0x10')](_0x7d98('0x11'),_0x4a4d96,_0x7d98('0xf'),JSON[_0x7d98('0x12')](_0x59cf2e));if(_0x59cf2e[_0x7d98('0x13')]){if(_0x59cf2e[_0x7d98('0x13')][_0x7d98('0x14')]===0x1f4){logger[_0x7d98('0x13')](_0x7d98('0xe'),_0x4a4d96,_0x59cf2e[_0x7d98('0x13')][_0x7d98('0x15')]);return _0x4d5442(_0x59cf2e[_0x7d98('0x13')][_0x7d98('0x15')]);}logger[_0x7d98('0x13')](_0x7d98('0xe'),_0x4a4d96,_0x59cf2e[_0x7d98('0x13')][_0x7d98('0x15')]);return _0x3e2e11(_0x59cf2e[_0x7d98('0x13')][_0x7d98('0x15')]);}else{logger[_0x7d98('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x4a4d96,'request\x20sent');_0x3e2e11(_0x59cf2e[_0x7d98('0x16')][_0x7d98('0x15')]);}})[_0x7d98('0x17')](function(_0x673a9){logger[_0x7d98('0x13')](_0x7d98('0xe'),_0x4a4d96,_0x673a9);_0x4d5442(_0x673a9);});});}exports[_0x7d98('0x18')]=function(_0x2cee51){var _0x506e5a=this;return new Promise(function(_0x19c39a,_0x404551){return db[_0x7d98('0x19')][_0x7d98('0x1a')]({'raw':_0x2cee51['options']?_0x2cee51['options'][_0x7d98('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cee51[_0x7d98('0x1c')]?_0x2cee51[_0x7d98('0x1c')][_0x7d98('0x1d')]||null:null,'attributes':_0x2cee51[_0x7d98('0x1c')]?_0x2cee51[_0x7d98('0x1c')]['attributes']||null:null,'limit':_0x2cee51['options']?_0x2cee51[_0x7d98('0x1c')][_0x7d98('0x1e')]||null:null,'include':_0x2cee51['options']?_0x2cee51[_0x7d98('0x1c')]['include']?_[_0x7d98('0x1f')](_0x2cee51[_0x7d98('0x1c')][_0x7d98('0x20')],function(_0x262e63){return{'model':db[_0x262e63[_0x7d98('0x21')]],'as':_0x262e63['as'],'attributes':_0x262e63[_0x7d98('0x22')],'include':_0x262e63[_0x7d98('0x20')]?_[_0x7d98('0x1f')](_0x262e63[_0x7d98('0x20')],function(_0x5bae1b){return{'model':db[_0x5bae1b['model']],'as':_0x5bae1b['as'],'attributes':_0x5bae1b['attributes'],'include':_0x5bae1b[_0x7d98('0x20')]?_[_0x7d98('0x1f')](_0x5bae1b['include'],function(_0x189588){return{'model':db[_0x189588[_0x7d98('0x21')]],'as':_0x189588['as'],'attributes':_0x189588[_0x7d98('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa6ff29){logger[_0x7d98('0xd')](_0x7d98('0x18'),_0x2cee51);logger[_0x7d98('0x10')](_0x7d98('0x18'),_0x2cee51,JSON[_0x7d98('0x12')](_0xa6ff29));_0x19c39a(_0xa6ff29);})['catch'](function(_0x5be840){logger[_0x7d98('0x13')](_0x7d98('0x18'),_0x5be840[_0x7d98('0x15')],_0x2cee51);_0x404551(_0x506e5a[_0x7d98('0x13')](0x1f4,_0x5be840[_0x7d98('0x15')]));});});};exports['ShowZohoAccount']=function(_0x32412d){var _0x2cf448=this;return new Promise(function(_0x3b618c,_0xce7eea){return db[_0x7d98('0x19')]['find']({'raw':_0x32412d[_0x7d98('0x1c')]?_0x32412d[_0x7d98('0x1c')][_0x7d98('0x1b')]===undefined?!![]:![]:!![],'where':_0x32412d[_0x7d98('0x1c')]?_0x32412d['options'][_0x7d98('0x1d')]||null:null,'attributes':_0x32412d['options']?_0x32412d[_0x7d98('0x1c')][_0x7d98('0x22')]||null:null,'include':_0x32412d['options']?_0x32412d['options'][_0x7d98('0x20')]?_[_0x7d98('0x1f')](_0x32412d['options'][_0x7d98('0x20')],function(_0x1f31e8){return{'model':db[_0x1f31e8[_0x7d98('0x21')]],'as':_0x1f31e8['as'],'attributes':_0x1f31e8[_0x7d98('0x22')],'include':_0x1f31e8[_0x7d98('0x20')]?_[_0x7d98('0x1f')](_0x1f31e8[_0x7d98('0x20')],function(_0x2cbdbf){return{'model':db[_0x2cbdbf['model']],'as':_0x2cbdbf['as'],'attributes':_0x2cbdbf[_0x7d98('0x22')],'include':_0x2cbdbf[_0x7d98('0x20')]?_[_0x7d98('0x1f')](_0x2cbdbf[_0x7d98('0x20')],function(_0x419a3b){return{'model':db[_0x419a3b[_0x7d98('0x21')]],'as':_0x419a3b['as'],'attributes':_0x419a3b[_0x7d98('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bebd6){logger[_0x7d98('0xd')](_0x7d98('0x23'),_0x32412d);logger['debug'](_0x7d98('0x23'),_0x32412d,JSON[_0x7d98('0x12')](_0x2bebd6));_0x3b618c(_0x2bebd6);})['catch'](function(_0x526890){logger[_0x7d98('0x13')](_0x7d98('0x23'),_0x526890[_0x7d98('0x15')],_0x32412d);_0xce7eea(_0x2cf448['error'](0x1f4,_0x526890[_0x7d98('0x15')]));});});}; \ No newline at end of file +var _0x760b=['options','raw','where','attributes','limit','include','model','map','stringify','ShowZohoAccount','find','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0xd0a0c4,_0x4ebd2d){var _0x395963=function(_0x45d2d8){while(--_0x45d2d8){_0xd0a0c4['push'](_0xd0a0c4['shift']());}};_0x395963(++_0x4ebd2d);}(_0x760b,0x97));var _0xb760=function(_0x13eabb,_0x2ee286){_0x13eabb=_0x13eabb-0x0;var _0x10dea9=_0x760b[_0x13eabb];return _0x10dea9;};'use strict';var _=require(_0xb760('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb760('0x1'));var db=require(_0xb760('0x2'))['db'];var utils=require(_0xb760('0x3'));var logger=require(_0xb760('0x4'))(_0xb760('0x5'));var config=require(_0xb760('0x6'));var jayson=require(_0xb760('0x7'));var client=jayson[_0xb760('0x8')][_0xb760('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x180165,_0x544b01,_0x6f857c){return new BPromise(function(_0x2492e5,_0x5e1c46){return client[_0xb760('0xa')](_0x180165,_0x6f857c)[_0xb760('0xb')](function(_0x3d3a79){logger['info'](_0xb760('0xc'),_0x544b01,_0xb760('0xd'));logger[_0xb760('0xe')](_0xb760('0xf'),_0x544b01,'request\x20sent',JSON['stringify'](_0x3d3a79));if(_0x3d3a79[_0xb760('0x10')]){if(_0x3d3a79['error'][_0xb760('0x11')]===0x1f4){logger[_0xb760('0x10')](_0xb760('0xc'),_0x544b01,_0x3d3a79[_0xb760('0x10')][_0xb760('0x12')]);return _0x5e1c46(_0x3d3a79['error'][_0xb760('0x12')]);}logger[_0xb760('0x10')](_0xb760('0xc'),_0x544b01,_0x3d3a79['error'][_0xb760('0x12')]);return _0x2492e5(_0x3d3a79[_0xb760('0x10')][_0xb760('0x12')]);}else{logger[_0xb760('0x13')](_0xb760('0xc'),_0x544b01,'request\x20sent');_0x2492e5(_0x3d3a79['result']['message']);}})[_0xb760('0x14')](function(_0x3697e1){logger[_0xb760('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x544b01,_0x3697e1);_0x5e1c46(_0x3697e1);});});}exports[_0xb760('0x15')]=function(_0x217f01){var _0x52ef1e=this;return new Promise(function(_0x9c0bbe,_0x20ca5b){return db[_0xb760('0x16')][_0xb760('0x17')]({'raw':_0x217f01['options']?_0x217f01[_0xb760('0x18')][_0xb760('0x19')]===undefined?!![]:![]:!![],'where':_0x217f01[_0xb760('0x18')]?_0x217f01[_0xb760('0x18')][_0xb760('0x1a')]||null:null,'attributes':_0x217f01['options']?_0x217f01[_0xb760('0x18')][_0xb760('0x1b')]||null:null,'limit':_0x217f01[_0xb760('0x18')]?_0x217f01[_0xb760('0x18')][_0xb760('0x1c')]||null:null,'include':_0x217f01[_0xb760('0x18')]?_0x217f01[_0xb760('0x18')][_0xb760('0x1d')]?_['map'](_0x217f01[_0xb760('0x18')][_0xb760('0x1d')],function(_0x23b14f){return{'model':db[_0x23b14f[_0xb760('0x1e')]],'as':_0x23b14f['as'],'attributes':_0x23b14f[_0xb760('0x1b')],'include':_0x23b14f['include']?_[_0xb760('0x1f')](_0x23b14f[_0xb760('0x1d')],function(_0x44a4f5){return{'model':db[_0x44a4f5[_0xb760('0x1e')]],'as':_0x44a4f5['as'],'attributes':_0x44a4f5[_0xb760('0x1b')],'include':_0x44a4f5['include']?_[_0xb760('0x1f')](_0x44a4f5[_0xb760('0x1d')],function(_0x333aa0){return{'model':db[_0x333aa0[_0xb760('0x1e')]],'as':_0x333aa0['as'],'attributes':_0x333aa0['attributes']};}):[]};}):[]};}):[]:[]})[_0xb760('0xb')](function(_0x1d1379){logger[_0xb760('0x13')]('GetZohoAccount',_0x217f01);logger[_0xb760('0xe')](_0xb760('0x15'),_0x217f01,JSON[_0xb760('0x20')](_0x1d1379));_0x9c0bbe(_0x1d1379);})[_0xb760('0x14')](function(_0x3beac4){logger[_0xb760('0x10')](_0xb760('0x15'),_0x3beac4[_0xb760('0x12')],_0x217f01);_0x20ca5b(_0x52ef1e[_0xb760('0x10')](0x1f4,_0x3beac4['message']));});});};exports[_0xb760('0x21')]=function(_0xf83e95){var _0x2308fc=this;return new Promise(function(_0x3fa154,_0x3f70e8){return db[_0xb760('0x16')][_0xb760('0x22')]({'raw':_0xf83e95['options']?_0xf83e95[_0xb760('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf83e95[_0xb760('0x18')]?_0xf83e95['options'][_0xb760('0x1a')]||null:null,'attributes':_0xf83e95[_0xb760('0x18')]?_0xf83e95[_0xb760('0x18')]['attributes']||null:null,'include':_0xf83e95[_0xb760('0x18')]?_0xf83e95['options'][_0xb760('0x1d')]?_['map'](_0xf83e95['options'][_0xb760('0x1d')],function(_0x264337){return{'model':db[_0x264337[_0xb760('0x1e')]],'as':_0x264337['as'],'attributes':_0x264337[_0xb760('0x1b')],'include':_0x264337[_0xb760('0x1d')]?_[_0xb760('0x1f')](_0x264337['include'],function(_0x1eb6b7){return{'model':db[_0x1eb6b7[_0xb760('0x1e')]],'as':_0x1eb6b7['as'],'attributes':_0x1eb6b7[_0xb760('0x1b')],'include':_0x1eb6b7[_0xb760('0x1d')]?_[_0xb760('0x1f')](_0x1eb6b7[_0xb760('0x1d')],function(_0x16c9f8){return{'model':db[_0x16c9f8[_0xb760('0x1e')]],'as':_0x16c9f8['as'],'attributes':_0x16c9f8[_0xb760('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb760('0xb')](function(_0x40e8da){logger[_0xb760('0x13')](_0xb760('0x21'),_0xf83e95);logger['debug'](_0xb760('0x21'),_0xf83e95,JSON[_0xb760('0x20')](_0x40e8da));_0x3fa154(_0x40e8da);})['catch'](function(_0x4a8153){logger[_0xb760('0x10')]('ShowZohoAccount',_0x4a8153[_0xb760('0x12')],_0xf83e95);_0x3f70e8(_0x2308fc[_0xb760('0x10')](0x1f4,_0x4a8153[_0xb760('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ea0599f..6330cc1 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 _0x5a52=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete','destroy','exports','multer','express'];(function(_0x353a61,_0x49a332){var _0x2c6d8e=function(_0x407a25){while(--_0x407a25){_0x353a61['push'](_0x353a61['shift']());}};_0x2c6d8e(++_0x49a332);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x25a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x25a5('0x1'));var router=express[_0x25a5('0x2')]();var auth=require(_0x25a5('0x3'));var interaction=require(_0x25a5('0x4'));var config=require(_0x25a5('0x5'));var controller=require(_0x25a5('0x6'));router[_0x25a5('0x7')]('/',auth[_0x25a5('0x8')](),controller['index']);router[_0x25a5('0x7')]('/:id',auth[_0x25a5('0x8')](),controller[_0x25a5('0x9')]);router[_0x25a5('0x7')](_0x25a5('0xa'),auth[_0x25a5('0x8')](),controller[_0x25a5('0xb')]);router['get']('/:id/subjects',auth[_0x25a5('0x8')](),controller[_0x25a5('0xc')]);router[_0x25a5('0x7')](_0x25a5('0xd'),auth[_0x25a5('0x8')](),controller[_0x25a5('0xe')]);router[_0x25a5('0xf')]('/',auth[_0x25a5('0x8')](),controller['create']);router[_0x25a5('0x10')](_0x25a5('0x11'),auth[_0x25a5('0x8')](),controller['update']);router[_0x25a5('0x12')]('/:id',auth[_0x25a5('0x8')](),controller[_0x25a5('0x13')]);module[_0x25a5('0x14')]=router; \ No newline at end of file +var _0xaeaf=['create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xaeaf,0x14e));var _0xfaea=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0xaeaf[_0x1a89ca];return _0x29cbb2;};'use strict';var multer=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var path=require(_0xfaea('0x2'));var timeout=require(_0xfaea('0x3'));var express=require(_0xfaea('0x4'));var router=express[_0xfaea('0x5')]();var auth=require(_0xfaea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfaea('0x7'));var controller=require(_0xfaea('0x8'));router[_0xfaea('0x9')]('/',auth[_0xfaea('0xa')](),controller['index']);router[_0xfaea('0x9')](_0xfaea('0xb'),auth[_0xfaea('0xa')](),controller[_0xfaea('0xc')]);router[_0xfaea('0x9')]('/:id/fields',auth[_0xfaea('0xa')](),controller[_0xfaea('0xd')]);router['get'](_0xfaea('0xe'),auth[_0xfaea('0xa')](),controller[_0xfaea('0xf')]);router['get'](_0xfaea('0x10'),auth[_0xfaea('0xa')](),controller[_0xfaea('0x11')]);router['post']('/',auth[_0xfaea('0xa')](),controller[_0xfaea('0x12')]);router[_0xfaea('0x13')](_0xfaea('0xb'),auth[_0xfaea('0xa')](),controller['update']);router[_0xfaea('0x14')]('/:id',auth[_0xfaea('0xa')](),controller['destroy']);module[_0xfaea('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 822d4f7..04e9554 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 _0xef6a=['STRING','sequelize','exports'];(function(_0x43e9ad,_0x5d7887){var _0x1fb9f8=function(_0x4e951d){while(--_0x4e951d){_0x43e9ad['push'](_0x43e9ad['shift']());}};_0x1fb9f8(++_0x5d7887);}(_0xef6a,0x1ab));var _0xaef6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xef6a[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xaef6('0x0'));module[_0xaef6('0x1')]={'name':{'type':Sequelize[_0xaef6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e4a=['STRING','exports'];(function(_0x89d76b,_0x163667){var _0xe4588e=function(_0x99fd97){while(--_0x99fd97){_0x89d76b['push'](_0x89d76b['shift']());}};_0xe4588e(++_0x163667);}(_0x5e4a,0x139));var _0xa5e4=function(_0x8a4d73,_0x38f93c){_0x8a4d73=_0x8a4d73-0x0;var _0x356e64=_0x5e4a[_0x8a4d73];return _0x356e64;};'use strict';var Sequelize=require('sequelize');module[_0xa5e4('0x0')]={'name':{'type':Sequelize[_0xa5e4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 620e982..4d1f662 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 _0x3e74=['save','update','then','destroy','sendStatus','ZohoConfiguration','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','key','VIRTUAL','options','count','include','findAll','rows','show','includeAll','find','create','body','params','findOne','pick','getFields','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','json','apply','reject'];(function(_0x52ac2a,_0x315f9e){var _0x100473=function(_0x4a5b86){while(--_0x4a5b86){_0x52ac2a['push'](_0x52ac2a['shift']());}};_0x100473(++_0x315f9e);}(_0x3e74,0x175));var _0x43e7=function(_0x41016f,_0x59ebf0){_0x41016f=_0x41016f-0x0;var _0x44a190=_0x3e74[_0x41016f];return _0x44a190;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var hardwareService=require(_0x43e7('0x10'));var logger=require('../../config/logger')(_0x43e7('0x11'));var utils=require('../../config/utils');var config=require(_0x43e7('0x12'));var db=require(_0x43e7('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x43e7('0x14')][_0x43e7('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2718d3,_0x3bb83f,_0x4e008c){if(_0x4e008c){var _0x583d85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x583d85[_0x43e7('0x16')](_0x3bb83f)){return _0x2718d3;}else{throw new Error(_0x43e7('0x17'));}}else{return _0x2718d3;}}function respondWithRpcPromise(_0x44b0bd,_0x51b974,_0x5e641c,_0x16849c){return new BPromise(function(_0x14c146,_0x203378){var _0x328445=_0x16849c||client;return _0x328445['request'](_0x44b0bd,_0x5e641c)['then'](function(_0xdf16c){logger[_0x43e7('0x18')](_0x43e7('0x19'),_0x51b974,'request\x20sent');logger['debug'](_0x43e7('0x1a'),_0x51b974,_0x43e7('0x1b'),JSON[_0x43e7('0x1c')](_0xdf16c));if(_0xdf16c[_0x43e7('0x1d')]){if(_0xdf16c[_0x43e7('0x1d')][_0x43e7('0x1e')]===0x1f4){logger[_0x43e7('0x1d')](_0x43e7('0x19'),_0x51b974,_0xdf16c[_0x43e7('0x1d')][_0x43e7('0x1f')]);return _0x203378(_0xdf16c[_0x43e7('0x1d')][_0x43e7('0x1f')]);}logger['error'](_0x43e7('0x19'),_0x51b974,_0xdf16c[_0x43e7('0x1d')]['message']);return _0x14c146(_0xdf16c[_0x43e7('0x1d')][_0x43e7('0x1f')]);}else{logger[_0x43e7('0x18')](_0x43e7('0x19'),_0x51b974,_0x43e7('0x1b'));_0x14c146(_0xdf16c[_0x43e7('0x20')]['message']);}})[_0x43e7('0x21')](function(_0x4eea52){logger['error'](_0x43e7('0x19'),_0x51b974,_0x4eea52);_0x203378(_0x4eea52);});});}function respondWithStatusCode(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0xcc;return function(_0x1f0673){if(_0x1f0673){return _0x43f4ff['sendStatus'](_0x4b2b9f);}return _0x43f4ff[_0x43e7('0x22')](_0x4b2b9f)['end']();};}function respondWithResult(_0x1af208,_0x1b5f50){_0x1b5f50=_0x1b5f50||0xc8;return function(_0x20888b){if(_0x20888b){return _0x1af208[_0x43e7('0x22')](_0x1b5f50)['json'](_0x20888b);}};}function respondWithFilteredResult(_0x52b7b3,_0x805b54){return function(_0x501551){if(_0x501551){var _0x2dd5f=_0x501551['count'],_0x40dc8f=_0x805b54[_0x43e7('0x23')],_0x3565cf=_0x805b54[_0x43e7('0x23')]+_0x805b54[_0x43e7('0x24')],_0xb1fc63;if(_0x3565cf>=_0x2dd5f){_0x3565cf=_0x2dd5f;_0xb1fc63=0xc8;}else{_0xb1fc63=0xce;}_0x52b7b3[_0x43e7('0x22')](_0xb1fc63);return _0x52b7b3[_0x43e7('0x25')](_0x43e7('0x26'),_0x40dc8f+'-'+_0x3565cf+'/'+_0x2dd5f)[_0x43e7('0x27')](_0x501551);}return null;};}function patchUpdates(_0x31b2a6){return function(_0x3bf475){try{jsonpatch[_0x43e7('0x28')](_0x3bf475,_0x31b2a6,!![]);}catch(_0x17df44){return BPromise[_0x43e7('0x29')](_0x17df44);}return _0x3bf475[_0x43e7('0x2a')]();};}function saveUpdates(_0x208706,_0x4bdb17){return function(_0x238321){if(_0x238321){return _0x238321[_0x43e7('0x2b')](_0x208706)[_0x43e7('0x2c')](function(_0x183c81){return _0x183c81;});}return null;};}function removeEntity(_0x4251c8,_0x4c8650){return function(_0x1eba65){if(_0x1eba65){return _0x1eba65[_0x43e7('0x2d')]()[_0x43e7('0x2c')](function(){_0x4251c8[_0x43e7('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a7342,_0x5e203f){return function(_0xf8320){if(!_0xf8320){_0x5a7342[_0x43e7('0x2e')](0x194);}return _0xf8320;};}function handleError(_0x117c07,_0x234fe6){_0x234fe6=_0x234fe6||0x1f4;return function(_0x108313){logger[_0x43e7('0x1d')](_0x108313['stack']);if(_0x108313['name']){delete _0x108313['name'];}_0x117c07['status'](_0x234fe6)['send'](_0x108313);};}exports['index']=function(_0x5cb753,_0x14d888){var _0x49cda6={},_0x2b4bfd={},_0x8e9f40={'count':0x0,'rows':[]};var _0x31bc78=db[_0x43e7('0x2f')][_0x43e7('0x30')];_0x2b4bfd[_0x43e7('0x31')]=_[_0x43e7('0x32')](_0x31bc78);_0x2b4bfd['query']=_['keys'](_0x5cb753['query']);_0x2b4bfd[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x2b4bfd[_0x43e7('0x31')],_0x2b4bfd[_0x43e7('0x35')]);_0x49cda6[_0x43e7('0x36')]=_[_0x43e7('0x34')](_0x2b4bfd[_0x43e7('0x31')],qs[_0x43e7('0x37')](_0x5cb753['query'][_0x43e7('0x37')]));_0x49cda6[_0x43e7('0x36')]=_0x49cda6['attributes'][_0x43e7('0x38')]?_0x49cda6['attributes']:_0x2b4bfd[_0x43e7('0x31')];if(!_0x5cb753[_0x43e7('0x35')][_0x43e7('0x39')](_0x43e7('0x3a'))){_0x49cda6[_0x43e7('0x24')]=qs[_0x43e7('0x24')](_0x5cb753['query']['limit']);_0x49cda6[_0x43e7('0x23')]=qs[_0x43e7('0x23')](_0x5cb753[_0x43e7('0x35')][_0x43e7('0x23')]);}_0x49cda6[_0x43e7('0x3b')]=qs['sort'](_0x5cb753[_0x43e7('0x35')][_0x43e7('0x3c')]);_0x49cda6['where']=qs[_0x43e7('0x33')](_['pick'](_0x5cb753[_0x43e7('0x35')],_0x2b4bfd['filters']));if(_0x5cb753[_0x43e7('0x35')][_0x43e7('0x3d')]){_0x49cda6[_0x43e7('0x3e')]=_[_0x43e7('0x3f')](_0x49cda6['where'],{'$or':_['map'](_0x31bc78,function(_0x103393){if(_0x103393[_0x43e7('0x40')][_0x43e7('0x41')]!==_0x43e7('0x42')){var _0x56346a={};_0x56346a[_0x103393['field']]={'$like':'%'+_0x5cb753['query'][_0x43e7('0x3d')]+'%'};return _0x56346a;}})});}_0x49cda6=_['merge']({},_0x49cda6,_0x5cb753[_0x43e7('0x43')]);var _0x4b3a59={'where':_0x49cda6['where']};return db[_0x43e7('0x2f')]['count'](_0x4b3a59)[_0x43e7('0x2c')](function(_0x39db7f){_0x8e9f40[_0x43e7('0x44')]=_0x39db7f;if(_0x5cb753[_0x43e7('0x35')]['includeAll']){_0x49cda6[_0x43e7('0x45')]=[{'all':!![]}];}return db[_0x43e7('0x2f')][_0x43e7('0x46')](_0x49cda6);})[_0x43e7('0x2c')](function(_0x296dc8){_0x8e9f40[_0x43e7('0x47')]=_0x296dc8;return _0x8e9f40;})['then'](respondWithFilteredResult(_0x14d888,_0x49cda6))['catch'](handleError(_0x14d888,null));};exports[_0x43e7('0x48')]=function(_0x36a09e,_0x212841){var _0x4c00a8={'raw':![],'where':{'id':_0x36a09e['params']['id']}},_0x5c1c18={};_0x5c1c18[_0x43e7('0x31')]=_[_0x43e7('0x32')](db['ZohoConfiguration'][_0x43e7('0x30')]);_0x5c1c18[_0x43e7('0x35')]=_[_0x43e7('0x32')](_0x36a09e['query']);_0x5c1c18['filters']=_['intersection'](_0x5c1c18['model'],_0x5c1c18[_0x43e7('0x35')]);_0x4c00a8[_0x43e7('0x36')]=_['intersection'](_0x5c1c18[_0x43e7('0x31')],qs[_0x43e7('0x37')](_0x36a09e[_0x43e7('0x35')][_0x43e7('0x37')]));_0x4c00a8['attributes']=_0x4c00a8[_0x43e7('0x36')]['length']?_0x4c00a8['attributes']:_0x5c1c18[_0x43e7('0x31')];if(_0x36a09e[_0x43e7('0x35')][_0x43e7('0x49')]){_0x4c00a8[_0x43e7('0x45')]=[{'all':!![]}];}_0x4c00a8=_[_0x43e7('0x3f')]({},_0x4c00a8,_0x36a09e[_0x43e7('0x43')]);return db[_0x43e7('0x2f')][_0x43e7('0x4a')](_0x4c00a8)[_0x43e7('0x2c')](handleEntityNotFound(_0x212841,null))[_0x43e7('0x2c')](respondWithResult(_0x212841,null))['catch'](handleError(_0x212841,null));};exports[_0x43e7('0x4b')]=function(_0x46c910,_0x499c03){return db[_0x43e7('0x2f')]['create'](_0x46c910[_0x43e7('0x4c')],{})[_0x43e7('0x2c')](respondWithResult(_0x499c03,0xc9))[_0x43e7('0x21')](handleError(_0x499c03,null));};exports[_0x43e7('0x2b')]=function(_0xfe13fa,_0x5e5556){if(_0xfe13fa['body']['id']){delete _0xfe13fa[_0x43e7('0x4c')]['id'];}return db[_0x43e7('0x2f')][_0x43e7('0x4a')]({'where':{'id':_0xfe13fa[_0x43e7('0x4d')]['id']}})[_0x43e7('0x2c')](handleEntityNotFound(_0x5e5556,null))[_0x43e7('0x2c')](saveUpdates(_0xfe13fa[_0x43e7('0x4c')],null))[_0x43e7('0x2c')](respondWithResult(_0x5e5556,null))[_0x43e7('0x21')](handleError(_0x5e5556,null));};exports[_0x43e7('0x2d')]=function(_0x312306,_0x4ace49){return db[_0x43e7('0x2f')][_0x43e7('0x4a')]({'where':{'id':_0x312306['params']['id']}})[_0x43e7('0x2c')](handleEntityNotFound(_0x4ace49,null))[_0x43e7('0x2c')](removeEntity(_0x4ace49,null))[_0x43e7('0x21')](handleError(_0x4ace49,null));};exports['getFields']=function(_0x5d63c6,_0x459c13,_0x3d9a29){var _0x4ebdde={};var _0x283dd8={};var _0x54506d;var _0x49a6ce;return db[_0x43e7('0x2f')][_0x43e7('0x4e')]({'where':{'id':_0x5d63c6[_0x43e7('0x4d')]['id']}})[_0x43e7('0x2c')](handleEntityNotFound(_0x459c13,null))[_0x43e7('0x2c')](function(_0x4dfdb0){if(_0x4dfdb0){_0x54506d=_0x4dfdb0;_0x283dd8[_0x43e7('0x31')]=_[_0x43e7('0x32')](db['ZohoField'][_0x43e7('0x30')]);_0x283dd8[_0x43e7('0x35')]=_[_0x43e7('0x32')](_0x5d63c6['query']);_0x283dd8['filters']=_['intersection'](_0x283dd8[_0x43e7('0x31')],_0x283dd8[_0x43e7('0x35')]);_0x4ebdde[_0x43e7('0x36')]=_[_0x43e7('0x34')](_0x283dd8['model'],qs['fields'](_0x5d63c6[_0x43e7('0x35')][_0x43e7('0x37')]));_0x4ebdde[_0x43e7('0x36')]=_0x4ebdde[_0x43e7('0x36')]['length']?_0x4ebdde[_0x43e7('0x36')]:_0x283dd8[_0x43e7('0x31')];_0x4ebdde[_0x43e7('0x3b')]=qs[_0x43e7('0x3c')](_0x5d63c6[_0x43e7('0x35')][_0x43e7('0x3c')]);_0x4ebdde[_0x43e7('0x3e')]=qs[_0x43e7('0x33')](_[_0x43e7('0x4f')](_0x5d63c6[_0x43e7('0x35')],_0x283dd8[_0x43e7('0x33')]));if(_0x5d63c6['query']['filter']){_0x4ebdde[_0x43e7('0x3e')]=_['merge'](_0x4ebdde['where'],{'$or':_['map'](_0x4ebdde[_0x43e7('0x36')],function(_0xe666b0){var _0x5d7b37={};_0x5d7b37[_0xe666b0]={'$like':'%'+_0x5d63c6[_0x43e7('0x35')][_0x43e7('0x3d')]+'%'};return _0x5d7b37;})});}_0x4ebdde=_[_0x43e7('0x3f')]({},_0x4ebdde,_0x5d63c6['options']);return _0x54506d[_0x43e7('0x50')](_0x4ebdde);}})[_0x43e7('0x2c')](function(_0x289f86){if(_0x289f86){_0x49a6ce=_0x289f86[_0x43e7('0x38')];if(!_0x5d63c6[_0x43e7('0x35')][_0x43e7('0x39')](_0x43e7('0x3a'))){_0x4ebdde['limit']=qs[_0x43e7('0x24')](_0x5d63c6[_0x43e7('0x35')][_0x43e7('0x24')]);_0x4ebdde['offset']=qs['offset'](_0x5d63c6[_0x43e7('0x35')]['offset']);}return _0x54506d['getFields'](_0x4ebdde);}})[_0x43e7('0x2c')](function(_0x154e47){if(_0x154e47){return _0x154e47?{'count':_0x49a6ce,'rows':_0x154e47}:null;}})['then'](respondWithResult(_0x459c13,null))[_0x43e7('0x21')](handleError(_0x459c13,null));};exports[_0x43e7('0x51')]=function(_0x1e2fed,_0x3401ec,_0x16499c){var _0x13ef5c={};var _0x398a78={};var _0x4ce33c;var _0x10cf5d;return db[_0x43e7('0x2f')]['findOne']({'where':{'id':_0x1e2fed[_0x43e7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3401ec,null))[_0x43e7('0x2c')](function(_0x248936){if(_0x248936){_0x4ce33c=_0x248936;_0x398a78[_0x43e7('0x31')]=_[_0x43e7('0x32')](db['ZohoField'][_0x43e7('0x30')]);_0x398a78[_0x43e7('0x35')]=_[_0x43e7('0x32')](_0x1e2fed['query']);_0x398a78[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x398a78[_0x43e7('0x31')],_0x398a78[_0x43e7('0x35')]);_0x13ef5c[_0x43e7('0x36')]=_['intersection'](_0x398a78[_0x43e7('0x31')],qs[_0x43e7('0x37')](_0x1e2fed[_0x43e7('0x35')][_0x43e7('0x37')]));_0x13ef5c[_0x43e7('0x36')]=_0x13ef5c[_0x43e7('0x36')][_0x43e7('0x38')]?_0x13ef5c['attributes']:_0x398a78['model'];_0x13ef5c[_0x43e7('0x3b')]=qs['sort'](_0x1e2fed['query']['sort']);_0x13ef5c[_0x43e7('0x3e')]=qs[_0x43e7('0x33')](_[_0x43e7('0x4f')](_0x1e2fed[_0x43e7('0x35')],_0x398a78[_0x43e7('0x33')]));if(_0x1e2fed[_0x43e7('0x35')]['filter']){_0x13ef5c[_0x43e7('0x3e')]=_[_0x43e7('0x3f')](_0x13ef5c[_0x43e7('0x3e')],{'$or':_['map'](_0x13ef5c[_0x43e7('0x36')],function(_0xea84ec){var _0x184ae3={};_0x184ae3[_0xea84ec]={'$like':'%'+_0x1e2fed[_0x43e7('0x35')][_0x43e7('0x3d')]+'%'};return _0x184ae3;})});}_0x13ef5c=_[_0x43e7('0x3f')]({},_0x13ef5c,_0x1e2fed[_0x43e7('0x43')]);return _0x4ce33c[_0x43e7('0x51')](_0x13ef5c);}})['then'](function(_0x52c757){if(_0x52c757){_0x10cf5d=_0x52c757['length'];if(!_0x1e2fed[_0x43e7('0x35')][_0x43e7('0x39')]('nolimit')){_0x13ef5c[_0x43e7('0x24')]=qs[_0x43e7('0x24')](_0x1e2fed[_0x43e7('0x35')][_0x43e7('0x24')]);_0x13ef5c['offset']=qs['offset'](_0x1e2fed['query'][_0x43e7('0x23')]);}return _0x4ce33c[_0x43e7('0x51')](_0x13ef5c);}})['then'](function(_0x58cbb7){if(_0x58cbb7){return _0x58cbb7?{'count':_0x10cf5d,'rows':_0x58cbb7}:null;}})[_0x43e7('0x2c')](respondWithResult(_0x3401ec,null))[_0x43e7('0x21')](handleError(_0x3401ec,null));};exports[_0x43e7('0x52')]=function(_0x4ae26f,_0x80334,_0x3d750f){var _0x401654={};var _0xb04082={};var _0x48f1dc;var _0x1d7048;return db['ZohoConfiguration'][_0x43e7('0x4e')]({'where':{'id':_0x4ae26f[_0x43e7('0x4d')]['id']}})[_0x43e7('0x2c')](handleEntityNotFound(_0x80334,null))[_0x43e7('0x2c')](function(_0xa7cb2c){if(_0xa7cb2c){_0x48f1dc=_0xa7cb2c;_0xb04082[_0x43e7('0x31')]=_[_0x43e7('0x32')](db['ZohoField'][_0x43e7('0x30')]);_0xb04082[_0x43e7('0x35')]=_[_0x43e7('0x32')](_0x4ae26f[_0x43e7('0x35')]);_0xb04082['filters']=_['intersection'](_0xb04082['model'],_0xb04082[_0x43e7('0x35')]);_0x401654['attributes']=_[_0x43e7('0x34')](_0xb04082[_0x43e7('0x31')],qs[_0x43e7('0x37')](_0x4ae26f[_0x43e7('0x35')][_0x43e7('0x37')]));_0x401654[_0x43e7('0x36')]=_0x401654[_0x43e7('0x36')][_0x43e7('0x38')]?_0x401654[_0x43e7('0x36')]:_0xb04082[_0x43e7('0x31')];_0x401654[_0x43e7('0x3b')]=qs['sort'](_0x4ae26f[_0x43e7('0x35')][_0x43e7('0x3c')]);_0x401654[_0x43e7('0x3e')]=qs[_0x43e7('0x33')](_[_0x43e7('0x4f')](_0x4ae26f['query'],_0xb04082['filters']));if(_0x4ae26f[_0x43e7('0x35')][_0x43e7('0x3d')]){_0x401654['where']=_[_0x43e7('0x3f')](_0x401654[_0x43e7('0x3e')],{'$or':_['map'](_0x401654['attributes'],function(_0x1e869a){var _0x3667a4={};_0x3667a4[_0x1e869a]={'$like':'%'+_0x4ae26f[_0x43e7('0x35')][_0x43e7('0x3d')]+'%'};return _0x3667a4;})});}_0x401654=_[_0x43e7('0x3f')]({},_0x401654,_0x4ae26f['options']);return _0x48f1dc['getDescriptions'](_0x401654);}})[_0x43e7('0x2c')](function(_0x18c438){if(_0x18c438){_0x1d7048=_0x18c438[_0x43e7('0x38')];if(!_0x4ae26f[_0x43e7('0x35')]['hasOwnProperty'](_0x43e7('0x3a'))){_0x401654[_0x43e7('0x24')]=qs[_0x43e7('0x24')](_0x4ae26f[_0x43e7('0x35')]['limit']);_0x401654[_0x43e7('0x23')]=qs[_0x43e7('0x23')](_0x4ae26f[_0x43e7('0x35')][_0x43e7('0x23')]);}return _0x48f1dc[_0x43e7('0x52')](_0x401654);}})['then'](function(_0x36d61f){if(_0x36d61f){return _0x36d61f?{'count':_0x1d7048,'rows':_0x36d61f}:null;}})[_0x43e7('0x2c')](respondWithResult(_0x80334,null))['catch'](handleError(_0x80334,null));}; \ No newline at end of file +var _0x7fbe=['send','ZohoConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','field','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','getFields','map','hasOwnProperty','findOne','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x16bb1c,_0x58f468){_0x16bb1c=_0x16bb1c-0x0;var _0xace56c=_0x7fbe[_0x16bb1c];return _0xace56c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var hardwareService=require(_0xe7fb('0x13'));var logger=require(_0xe7fb('0x14'))(_0xe7fb('0x15'));var utils=require(_0xe7fb('0x16'));var config=require(_0xe7fb('0x17'));var db=require(_0xe7fb('0x18'))['db'];var jayson=require(_0xe7fb('0x19'));var client=jayson[_0xe7fb('0x1a')][_0xe7fb('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x188e1d,_0xdf9760,_0x45fe75){if(_0x45fe75){var _0x7fe4d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7fe4d3['test'](_0xdf9760)){return _0x188e1d;}else{throw new Error(_0xe7fb('0x1c'));}}else{return _0x188e1d;}}function respondWithRpcPromise(_0x2225e5,_0x5573ab,_0x30015a,_0x37eb9f){return new BPromise(function(_0x482f7d,_0xa76acf){var _0x559129=_0x37eb9f||client;return _0x559129[_0xe7fb('0x1d')](_0x2225e5,_0x30015a)[_0xe7fb('0x1e')](function(_0x12603d){logger[_0xe7fb('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x5573ab,_0xe7fb('0x20'));logger['debug'](_0xe7fb('0x21'),_0x5573ab,'request\x20sent',JSON[_0xe7fb('0x22')](_0x12603d));if(_0x12603d[_0xe7fb('0x23')]){if(_0x12603d[_0xe7fb('0x23')][_0xe7fb('0x24')]===0x1f4){logger['error'](_0xe7fb('0x25'),_0x5573ab,_0x12603d['error'][_0xe7fb('0x26')]);return _0xa76acf(_0x12603d['error'][_0xe7fb('0x26')]);}logger['error'](_0xe7fb('0x25'),_0x5573ab,_0x12603d[_0xe7fb('0x23')]['message']);return _0x482f7d(_0x12603d[_0xe7fb('0x23')][_0xe7fb('0x26')]);}else{logger[_0xe7fb('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x5573ab,_0xe7fb('0x20'));_0x482f7d(_0x12603d[_0xe7fb('0x27')]['message']);}})['catch'](function(_0x52f08b){logger[_0xe7fb('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x5573ab,_0x52f08b);_0xa76acf(_0x52f08b);});});}function respondWithStatusCode(_0x49b219,_0x4026b1){_0x4026b1=_0x4026b1||0xcc;return function(_0x32e8b2){if(_0x32e8b2){return _0x49b219[_0xe7fb('0x28')](_0x4026b1);}return _0x49b219['status'](_0x4026b1)[_0xe7fb('0x29')]();};}function respondWithResult(_0x2b69c4,_0x390f32){_0x390f32=_0x390f32||0xc8;return function(_0x1ceed8){if(_0x1ceed8){return _0x2b69c4[_0xe7fb('0x2a')](_0x390f32)[_0xe7fb('0x2b')](_0x1ceed8);}};}function respondWithFilteredResult(_0x380130,_0x59e015){return function(_0x5df9f2){if(_0x5df9f2){var _0x1086e6=_0x5df9f2[_0xe7fb('0x2c')],_0x3bdee9=_0x59e015[_0xe7fb('0x2d')],_0xead63=_0x59e015[_0xe7fb('0x2d')]+_0x59e015[_0xe7fb('0x2e')],_0x4fd290;if(_0xead63>=_0x1086e6){_0xead63=_0x1086e6;_0x4fd290=0xc8;}else{_0x4fd290=0xce;}_0x380130[_0xe7fb('0x2a')](_0x4fd290);return _0x380130[_0xe7fb('0x2f')](_0xe7fb('0x30'),_0x3bdee9+'-'+_0xead63+'/'+_0x1086e6)[_0xe7fb('0x2b')](_0x5df9f2);}return null;};}function patchUpdates(_0x4ce993){return function(_0x3d1fb5){try{jsonpatch[_0xe7fb('0x31')](_0x3d1fb5,_0x4ce993,!![]);}catch(_0x29d1ca){return BPromise['reject'](_0x29d1ca);}return _0x3d1fb5['save']();};}function saveUpdates(_0xf5cd9a,_0x4a9fea){return function(_0xac56b4){if(_0xac56b4){return _0xac56b4[_0xe7fb('0x32')](_0xf5cd9a)[_0xe7fb('0x1e')](function(_0x2a4745){return _0x2a4745;});}return null;};}function removeEntity(_0x556368,_0x1af472){return function(_0x1d56d3){if(_0x1d56d3){return _0x1d56d3[_0xe7fb('0x33')]()[_0xe7fb('0x1e')](function(){_0x556368[_0xe7fb('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256694,_0x121d19){return function(_0x209eaa){if(!_0x209eaa){_0x256694[_0xe7fb('0x28')](0x194);}return _0x209eaa;};}function handleError(_0x46f430,_0x25e925){_0x25e925=_0x25e925||0x1f4;return function(_0x1bc72d){logger[_0xe7fb('0x23')](_0x1bc72d[_0xe7fb('0x34')]);if(_0x1bc72d['name']){delete _0x1bc72d[_0xe7fb('0x35')];}_0x46f430[_0xe7fb('0x2a')](_0x25e925)[_0xe7fb('0x36')](_0x1bc72d);};}exports['index']=function(_0x1de75a,_0x3502dc){var _0x4218bc={},_0x1530b1={},_0x402ca3={'count':0x0,'rows':[]};var _0x35b828=db[_0xe7fb('0x37')][_0xe7fb('0x38')];_0x1530b1[_0xe7fb('0x39')]=_[_0xe7fb('0x3a')](_0x35b828);_0x1530b1[_0xe7fb('0x3b')]=_[_0xe7fb('0x3a')](_0x1de75a[_0xe7fb('0x3b')]);_0x1530b1[_0xe7fb('0x3c')]=_[_0xe7fb('0x3d')](_0x1530b1[_0xe7fb('0x39')],_0x1530b1[_0xe7fb('0x3b')]);_0x4218bc[_0xe7fb('0x3e')]=_[_0xe7fb('0x3d')](_0x1530b1['model'],qs[_0xe7fb('0x3f')](_0x1de75a[_0xe7fb('0x3b')][_0xe7fb('0x3f')]));_0x4218bc[_0xe7fb('0x3e')]=_0x4218bc['attributes'][_0xe7fb('0x40')]?_0x4218bc[_0xe7fb('0x3e')]:_0x1530b1[_0xe7fb('0x39')];if(!_0x1de75a[_0xe7fb('0x3b')]['hasOwnProperty'](_0xe7fb('0x41'))){_0x4218bc[_0xe7fb('0x2e')]=qs[_0xe7fb('0x2e')](_0x1de75a[_0xe7fb('0x3b')][_0xe7fb('0x2e')]);_0x4218bc[_0xe7fb('0x2d')]=qs['offset'](_0x1de75a[_0xe7fb('0x3b')][_0xe7fb('0x2d')]);}_0x4218bc[_0xe7fb('0x42')]=qs['sort'](_0x1de75a[_0xe7fb('0x3b')][_0xe7fb('0x43')]);_0x4218bc['where']=qs['filters'](_['pick'](_0x1de75a['query'],_0x1530b1['filters']));if(_0x1de75a[_0xe7fb('0x3b')][_0xe7fb('0x44')]){_0x4218bc[_0xe7fb('0x45')]=_['merge'](_0x4218bc[_0xe7fb('0x45')],{'$or':_['map'](_0x35b828,function(_0x19277f){if(_0x19277f[_0xe7fb('0x46')]['key']!==_0xe7fb('0x47')){var _0x2a3422={};_0x2a3422[_0x19277f[_0xe7fb('0x48')]]={'$like':'%'+_0x1de75a[_0xe7fb('0x3b')]['filter']+'%'};return _0x2a3422;}})});}_0x4218bc=_[_0xe7fb('0x49')]({},_0x4218bc,_0x1de75a[_0xe7fb('0x4a')]);var _0x1b8a34={'where':_0x4218bc['where']};return db[_0xe7fb('0x37')][_0xe7fb('0x2c')](_0x1b8a34)[_0xe7fb('0x1e')](function(_0xd23540){_0x402ca3[_0xe7fb('0x2c')]=_0xd23540;if(_0x1de75a['query'][_0xe7fb('0x4b')]){_0x4218bc['include']=[{'all':!![]}];}return db[_0xe7fb('0x37')][_0xe7fb('0x4c')](_0x4218bc);})[_0xe7fb('0x1e')](function(_0x1ecbfd){_0x402ca3[_0xe7fb('0x4d')]=_0x1ecbfd;return _0x402ca3;})['then'](respondWithFilteredResult(_0x3502dc,_0x4218bc))[_0xe7fb('0x4e')](handleError(_0x3502dc,null));};exports['show']=function(_0x511759,_0x12c828){var _0x3d740f={'raw':![],'where':{'id':_0x511759['params']['id']}},_0x16327f={};_0x16327f[_0xe7fb('0x39')]=_[_0xe7fb('0x3a')](db['ZohoConfiguration']['rawAttributes']);_0x16327f[_0xe7fb('0x3b')]=_[_0xe7fb('0x3a')](_0x511759[_0xe7fb('0x3b')]);_0x16327f[_0xe7fb('0x3c')]=_[_0xe7fb('0x3d')](_0x16327f[_0xe7fb('0x39')],_0x16327f[_0xe7fb('0x3b')]);_0x3d740f[_0xe7fb('0x3e')]=_['intersection'](_0x16327f[_0xe7fb('0x39')],qs['fields'](_0x511759[_0xe7fb('0x3b')][_0xe7fb('0x3f')]));_0x3d740f['attributes']=_0x3d740f[_0xe7fb('0x3e')]['length']?_0x3d740f[_0xe7fb('0x3e')]:_0x16327f['model'];if(_0x511759[_0xe7fb('0x3b')]['includeAll']){_0x3d740f[_0xe7fb('0x4f')]=[{'all':!![]}];}_0x3d740f=_['merge']({},_0x3d740f,_0x511759[_0xe7fb('0x4a')]);return db[_0xe7fb('0x37')][_0xe7fb('0x50')](_0x3d740f)[_0xe7fb('0x1e')](handleEntityNotFound(_0x12c828,null))[_0xe7fb('0x1e')](respondWithResult(_0x12c828,null))[_0xe7fb('0x4e')](handleError(_0x12c828,null));};exports[_0xe7fb('0x51')]=function(_0x582a4a,_0x5d20dc){return db[_0xe7fb('0x37')]['create'](_0x582a4a['body'],{})['then'](respondWithResult(_0x5d20dc,0xc9))['catch'](handleError(_0x5d20dc,null));};exports['update']=function(_0x18773c,_0x34dd69){if(_0x18773c[_0xe7fb('0x52')]['id']){delete _0x18773c[_0xe7fb('0x52')]['id'];}return db['ZohoConfiguration'][_0xe7fb('0x50')]({'where':{'id':_0x18773c[_0xe7fb('0x53')]['id']}})[_0xe7fb('0x1e')](handleEntityNotFound(_0x34dd69,null))['then'](saveUpdates(_0x18773c['body'],null))[_0xe7fb('0x1e')](respondWithResult(_0x34dd69,null))[_0xe7fb('0x4e')](handleError(_0x34dd69,null));};exports[_0xe7fb('0x33')]=function(_0x4f4ba3,_0x27f860){return db[_0xe7fb('0x37')][_0xe7fb('0x50')]({'where':{'id':_0x4f4ba3[_0xe7fb('0x53')]['id']}})['then'](handleEntityNotFound(_0x27f860,null))['then'](removeEntity(_0x27f860,null))[_0xe7fb('0x4e')](handleError(_0x27f860,null));};exports[_0xe7fb('0x54')]=function(_0x1f16b2,_0x2f61b1,_0x3b0147){var _0x5dd7c8={};var _0x9c45a={};var _0x349a2a;var _0x23755b;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1f16b2[_0xe7fb('0x53')]['id']}})[_0xe7fb('0x1e')](handleEntityNotFound(_0x2f61b1,null))[_0xe7fb('0x1e')](function(_0x1c4035){if(_0x1c4035){_0x349a2a=_0x1c4035;_0x9c45a[_0xe7fb('0x39')]=_[_0xe7fb('0x3a')](db['ZohoField'][_0xe7fb('0x38')]);_0x9c45a[_0xe7fb('0x3b')]=_[_0xe7fb('0x3a')](_0x1f16b2[_0xe7fb('0x3b')]);_0x9c45a[_0xe7fb('0x3c')]=_[_0xe7fb('0x3d')](_0x9c45a['model'],_0x9c45a[_0xe7fb('0x3b')]);_0x5dd7c8['attributes']=_[_0xe7fb('0x3d')](_0x9c45a[_0xe7fb('0x39')],qs[_0xe7fb('0x3f')](_0x1f16b2[_0xe7fb('0x3b')]['fields']));_0x5dd7c8['attributes']=_0x5dd7c8[_0xe7fb('0x3e')][_0xe7fb('0x40')]?_0x5dd7c8[_0xe7fb('0x3e')]:_0x9c45a[_0xe7fb('0x39')];_0x5dd7c8[_0xe7fb('0x42')]=qs['sort'](_0x1f16b2[_0xe7fb('0x3b')]['sort']);_0x5dd7c8[_0xe7fb('0x45')]=qs['filters'](_['pick'](_0x1f16b2[_0xe7fb('0x3b')],_0x9c45a[_0xe7fb('0x3c')]));if(_0x1f16b2[_0xe7fb('0x3b')]['filter']){_0x5dd7c8[_0xe7fb('0x45')]=_[_0xe7fb('0x49')](_0x5dd7c8[_0xe7fb('0x45')],{'$or':_[_0xe7fb('0x55')](_0x5dd7c8[_0xe7fb('0x3e')],function(_0x597ce8){var _0x404498={};_0x404498[_0x597ce8]={'$like':'%'+_0x1f16b2[_0xe7fb('0x3b')]['filter']+'%'};return _0x404498;})});}_0x5dd7c8=_[_0xe7fb('0x49')]({},_0x5dd7c8,_0x1f16b2[_0xe7fb('0x4a')]);return _0x349a2a['getFields'](_0x5dd7c8);}})[_0xe7fb('0x1e')](function(_0x4c04e1){if(_0x4c04e1){_0x23755b=_0x4c04e1[_0xe7fb('0x40')];if(!_0x1f16b2[_0xe7fb('0x3b')][_0xe7fb('0x56')]('nolimit')){_0x5dd7c8[_0xe7fb('0x2e')]=qs[_0xe7fb('0x2e')](_0x1f16b2[_0xe7fb('0x3b')][_0xe7fb('0x2e')]);_0x5dd7c8[_0xe7fb('0x2d')]=qs[_0xe7fb('0x2d')](_0x1f16b2[_0xe7fb('0x3b')][_0xe7fb('0x2d')]);}return _0x349a2a['getFields'](_0x5dd7c8);}})['then'](function(_0x3ebbd8){if(_0x3ebbd8){return _0x3ebbd8?{'count':_0x23755b,'rows':_0x3ebbd8}:null;}})[_0xe7fb('0x1e')](respondWithResult(_0x2f61b1,null))[_0xe7fb('0x4e')](handleError(_0x2f61b1,null));};exports['getSubjects']=function(_0x519c5f,_0x1ac1fd,_0x2b071c){var _0xad7c53={};var _0x1df857={};var _0x2d558c;var _0x336fd3;return db[_0xe7fb('0x37')][_0xe7fb('0x57')]({'where':{'id':_0x519c5f[_0xe7fb('0x53')]['id']}})[_0xe7fb('0x1e')](handleEntityNotFound(_0x1ac1fd,null))[_0xe7fb('0x1e')](function(_0xf423ab){if(_0xf423ab){_0x2d558c=_0xf423ab;_0x1df857[_0xe7fb('0x39')]=_['keys'](db['ZohoField'][_0xe7fb('0x38')]);_0x1df857[_0xe7fb('0x3b')]=_[_0xe7fb('0x3a')](_0x519c5f[_0xe7fb('0x3b')]);_0x1df857[_0xe7fb('0x3c')]=_['intersection'](_0x1df857[_0xe7fb('0x39')],_0x1df857[_0xe7fb('0x3b')]);_0xad7c53[_0xe7fb('0x3e')]=_[_0xe7fb('0x3d')](_0x1df857[_0xe7fb('0x39')],qs[_0xe7fb('0x3f')](_0x519c5f[_0xe7fb('0x3b')][_0xe7fb('0x3f')]));_0xad7c53[_0xe7fb('0x3e')]=_0xad7c53['attributes'][_0xe7fb('0x40')]?_0xad7c53['attributes']:_0x1df857[_0xe7fb('0x39')];_0xad7c53[_0xe7fb('0x42')]=qs[_0xe7fb('0x43')](_0x519c5f[_0xe7fb('0x3b')][_0xe7fb('0x43')]);_0xad7c53['where']=qs[_0xe7fb('0x3c')](_[_0xe7fb('0x58')](_0x519c5f[_0xe7fb('0x3b')],_0x1df857[_0xe7fb('0x3c')]));if(_0x519c5f[_0xe7fb('0x3b')][_0xe7fb('0x44')]){_0xad7c53[_0xe7fb('0x45')]=_[_0xe7fb('0x49')](_0xad7c53[_0xe7fb('0x45')],{'$or':_[_0xe7fb('0x55')](_0xad7c53[_0xe7fb('0x3e')],function(_0x14b028){var _0x3a68c0={};_0x3a68c0[_0x14b028]={'$like':'%'+_0x519c5f[_0xe7fb('0x3b')]['filter']+'%'};return _0x3a68c0;})});}_0xad7c53=_['merge']({},_0xad7c53,_0x519c5f['options']);return _0x2d558c[_0xe7fb('0x59')](_0xad7c53);}})[_0xe7fb('0x1e')](function(_0x25e4d9){if(_0x25e4d9){_0x336fd3=_0x25e4d9[_0xe7fb('0x40')];if(!_0x519c5f['query'][_0xe7fb('0x56')](_0xe7fb('0x41'))){_0xad7c53[_0xe7fb('0x2e')]=qs[_0xe7fb('0x2e')](_0x519c5f['query'][_0xe7fb('0x2e')]);_0xad7c53['offset']=qs[_0xe7fb('0x2d')](_0x519c5f[_0xe7fb('0x3b')][_0xe7fb('0x2d')]);}return _0x2d558c[_0xe7fb('0x59')](_0xad7c53);}})[_0xe7fb('0x1e')](function(_0x4ab541){if(_0x4ab541){return _0x4ab541?{'count':_0x336fd3,'rows':_0x4ab541}:null;}})[_0xe7fb('0x1e')](respondWithResult(_0x1ac1fd,null))['catch'](handleError(_0x1ac1fd,null));};exports[_0xe7fb('0x5a')]=function(_0x5410a1,_0x2aeeed,_0x38f52c){var _0x4c37cd={};var _0x2b6d69={};var _0x31642f;var _0xb19e94;return db[_0xe7fb('0x37')]['findOne']({'where':{'id':_0x5410a1[_0xe7fb('0x53')]['id']}})[_0xe7fb('0x1e')](handleEntityNotFound(_0x2aeeed,null))[_0xe7fb('0x1e')](function(_0x4d0eed){if(_0x4d0eed){_0x31642f=_0x4d0eed;_0x2b6d69[_0xe7fb('0x39')]=_['keys'](db['ZohoField']['rawAttributes']);_0x2b6d69[_0xe7fb('0x3b')]=_[_0xe7fb('0x3a')](_0x5410a1['query']);_0x2b6d69[_0xe7fb('0x3c')]=_[_0xe7fb('0x3d')](_0x2b6d69[_0xe7fb('0x39')],_0x2b6d69[_0xe7fb('0x3b')]);_0x4c37cd[_0xe7fb('0x3e')]=_[_0xe7fb('0x3d')](_0x2b6d69[_0xe7fb('0x39')],qs[_0xe7fb('0x3f')](_0x5410a1[_0xe7fb('0x3b')][_0xe7fb('0x3f')]));_0x4c37cd[_0xe7fb('0x3e')]=_0x4c37cd[_0xe7fb('0x3e')][_0xe7fb('0x40')]?_0x4c37cd[_0xe7fb('0x3e')]:_0x2b6d69[_0xe7fb('0x39')];_0x4c37cd[_0xe7fb('0x42')]=qs[_0xe7fb('0x43')](_0x5410a1[_0xe7fb('0x3b')][_0xe7fb('0x43')]);_0x4c37cd[_0xe7fb('0x45')]=qs['filters'](_[_0xe7fb('0x58')](_0x5410a1[_0xe7fb('0x3b')],_0x2b6d69[_0xe7fb('0x3c')]));if(_0x5410a1[_0xe7fb('0x3b')][_0xe7fb('0x44')]){_0x4c37cd[_0xe7fb('0x45')]=_[_0xe7fb('0x49')](_0x4c37cd['where'],{'$or':_['map'](_0x4c37cd[_0xe7fb('0x3e')],function(_0x4e1865){var _0x2f486={};_0x2f486[_0x4e1865]={'$like':'%'+_0x5410a1[_0xe7fb('0x3b')]['filter']+'%'};return _0x2f486;})});}_0x4c37cd=_[_0xe7fb('0x49')]({},_0x4c37cd,_0x5410a1[_0xe7fb('0x4a')]);return _0x31642f[_0xe7fb('0x5a')](_0x4c37cd);}})[_0xe7fb('0x1e')](function(_0x1f5687){if(_0x1f5687){_0xb19e94=_0x1f5687[_0xe7fb('0x40')];if(!_0x5410a1['query'][_0xe7fb('0x56')](_0xe7fb('0x41'))){_0x4c37cd[_0xe7fb('0x2e')]=qs[_0xe7fb('0x2e')](_0x5410a1[_0xe7fb('0x3b')][_0xe7fb('0x2e')]);_0x4c37cd['offset']=qs['offset'](_0x5410a1['query'][_0xe7fb('0x2d')]);}return _0x31642f[_0xe7fb('0x5a')](_0x4c37cd);}})[_0xe7fb('0x1e')](function(_0x499498){if(_0x499498){return _0x499498?{'count':_0xb19e94,'rows':_0x499498}:null;}})[_0xe7fb('0x1e')](respondWithResult(_0x2aeeed,null))['catch'](handleError(_0x2aeeed,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index a725bdb..79445fb 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 _0xea28=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f9a92,_0x28fe41){var _0x51e262=function(_0xd52495){while(--_0xd52495){_0x4f9a92['push'](_0x4f9a92['shift']());}};_0x51e262(++_0x28fe41);}(_0xea28,0x13a));var _0x8ea2=function(_0x34d32d,_0x3d660a){_0x34d32d=_0x34d32d-0x0;var _0x8c3479=_0xea28[_0x34d32d];return _0x8c3479;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['define','int_zoho_configurations','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0x757a,0xde));var _0xa757=function(_0x30f37a,_0x7f1fc0){_0x30f37a=_0x30f37a-0x0;var _0x2e0453=_0x757a[_0x30f37a];return _0x2e0453;};'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')]('ZohoConfiguration',attributes,{'tableName':_0xa757('0x9'),'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 41a004d..2a6e09e 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 _0x934f=['../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x419c02,_0x209453){var _0x31857a=function(_0x162fb3){while(--_0x162fb3){_0x419c02['push'](_0x419c02['shift']());}};_0x31857a(++_0x209453);}(_0x934f,0x1ed));var _0xf934=function(_0x2c0323,_0x22ade0){_0x2c0323=_0x2c0323-0x0;var _0x2253ad=_0x934f[_0x2c0323];return _0x2253ad;};'use strict';var _=require(_0xf934('0x0'));var util=require(_0xf934('0x1'));var moment=require('moment');var BPromise=require(_0xf934('0x2'));var rs=require(_0xf934('0x3'));var fs=require('fs');var Redis=require(_0xf934('0x4'));var db=require(_0xf934('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf934('0x6'));var config=require(_0xf934('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf934('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x471a77,_0x282883,_0xc654af){return new BPromise(function(_0x4e77af,_0x3b35eb){return client[_0xf934('0x9')](_0x471a77,_0xc654af)[_0xf934('0xa')](function(_0x4760db){logger[_0xf934('0xb')](_0xf934('0xc'),_0x282883,_0xf934('0xd'));logger[_0xf934('0xe')](_0xf934('0xf'),_0x282883,'request\x20sent',JSON['stringify'](_0x4760db));if(_0x4760db[_0xf934('0x10')]){if(_0x4760db[_0xf934('0x10')][_0xf934('0x11')]===0x1f4){logger['error'](_0xf934('0xc'),_0x282883,_0x4760db['error'][_0xf934('0x12')]);return _0x3b35eb(_0x4760db[_0xf934('0x10')][_0xf934('0x12')]);}logger[_0xf934('0x10')](_0xf934('0xc'),_0x282883,_0x4760db[_0xf934('0x10')]['message']);return _0x4e77af(_0x4760db[_0xf934('0x10')][_0xf934('0x12')]);}else{logger[_0xf934('0xb')](_0xf934('0xc'),_0x282883,_0xf934('0xd'));_0x4e77af(_0x4760db['result']['message']);}})[_0xf934('0x13')](function(_0x26964c){logger[_0xf934('0x10')](_0xf934('0xc'),_0x282883,_0x26964c);_0x3b35eb(_0x26964c);});});} \ No newline at end of file +var _0xa2f3=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../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(_0x179e37,_0x3e304d){var _0x39033b=function(_0x536982){while(--_0x536982){_0x179e37['push'](_0x179e37['shift']());}};_0x39033b(++_0x3e304d);}(_0xa2f3,0x1b8));var _0x3a2f=function(_0x1dacbf,_0x3e12d6){_0x1dacbf=_0x1dacbf-0x0;var _0x29baab=_0xa2f3[_0x1dacbf];return _0x29baab;};'use strict';var _=require(_0x3a2f('0x0'));var util=require(_0x3a2f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a2f('0x2'));var fs=require('fs');var Redis=require(_0x3a2f('0x3'));var db=require(_0x3a2f('0x4'))['db'];var utils=require(_0x3a2f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a2f('0x6'));var jayson=require(_0x3a2f('0x7'));var client=jayson[_0x3a2f('0x8')][_0x3a2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f4843,_0x122fd,_0x565133){return new BPromise(function(_0x3dcb72,_0xc76a45){return client[_0x3a2f('0xa')](_0x5f4843,_0x565133)[_0x3a2f('0xb')](function(_0x3fdd81){logger[_0x3a2f('0xc')](_0x3a2f('0xd'),_0x122fd,_0x3a2f('0xe'));logger[_0x3a2f('0xf')](_0x3a2f('0x10'),_0x122fd,_0x3a2f('0xe'),JSON[_0x3a2f('0x11')](_0x3fdd81));if(_0x3fdd81[_0x3a2f('0x12')]){if(_0x3fdd81[_0x3a2f('0x12')][_0x3a2f('0x13')]===0x1f4){logger['error'](_0x3a2f('0xd'),_0x122fd,_0x3fdd81['error']['message']);return _0xc76a45(_0x3fdd81[_0x3a2f('0x12')][_0x3a2f('0x14')]);}logger[_0x3a2f('0x12')](_0x3a2f('0xd'),_0x122fd,_0x3fdd81['error']['message']);return _0x3dcb72(_0x3fdd81[_0x3a2f('0x12')][_0x3a2f('0x14')]);}else{logger[_0x3a2f('0xc')](_0x3a2f('0xd'),_0x122fd,_0x3a2f('0xe'));_0x3dcb72(_0x3fdd81[_0x3a2f('0x15')][_0x3a2f('0x14')]);}})[_0x3a2f('0x16')](function(_0x5d56f8){logger[_0x3a2f('0x12')](_0x3a2f('0xd'),_0x122fd,_0x5d56f8);_0xc76a45(_0x5d56f8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 537b43b..1f2c40c 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 _0xae57=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','put','update','delete','destroy'];(function(_0x9320f9,_0x1d1d5a){var _0x3fbe06=function(_0x440bf4){while(--_0x440bf4){_0x9320f9['push'](_0x9320f9['shift']());}};_0x3fbe06(++_0x1d1d5a);}(_0xae57,0x1c2));var _0x7ae5=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xae57[_0x2dea24];return _0x309d58;};'use strict';var multer=require(_0x7ae5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7ae5('0x1'));var express=require(_0x7ae5('0x2'));var router=express[_0x7ae5('0x3')]();var auth=require(_0x7ae5('0x4'));var interaction=require(_0x7ae5('0x5'));var config=require(_0x7ae5('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x7ae5('0x7')](),controller['index']);router[_0x7ae5('0x8')](_0x7ae5('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7ae5('0xa')]('/',auth[_0x7ae5('0x7')](),controller['create']);router[_0x7ae5('0xb')](_0x7ae5('0x9'),auth[_0x7ae5('0x7')](),controller[_0x7ae5('0xc')]);router[_0x7ae5('0xd')](_0x7ae5('0x9'),auth['isAuthenticated'](),controller[_0x7ae5('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf019=['./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x51a618,_0xe824f2){var _0x8fbf8d=function(_0x5dc44d){while(--_0x5dc44d){_0x51a618['push'](_0x51a618['shift']());}};_0x8fbf8d(++_0xe824f2);}(_0xf019,0x110));var _0x9f01=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf019[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x9f01('0x0'));var path=require(_0x9f01('0x1'));var timeout=require(_0x9f01('0x2'));var express=require(_0x9f01('0x3'));var router=express[_0x9f01('0x4')]();var auth=require(_0x9f01('0x5'));var interaction=require(_0x9f01('0x6'));var config=require(_0x9f01('0x7'));var controller=require(_0x9f01('0x8'));router[_0x9f01('0x9')]('/',auth[_0x9f01('0xa')](),controller[_0x9f01('0xb')]);router['get'](_0x9f01('0xc'),auth['isAuthenticated'](),controller[_0x9f01('0xd')]);router[_0x9f01('0xe')]('/',auth[_0x9f01('0xa')](),controller[_0x9f01('0xf')]);router[_0x9f01('0x10')](_0x9f01('0xc'),auth[_0x9f01('0xa')](),controller[_0x9f01('0x11')]);router[_0x9f01('0x12')](_0x9f01('0xc'),auth[_0x9f01('0xa')](),controller[_0x9f01('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0b75df9..70313ad 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 _0x55e0=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x55e0,0xdc));var _0x055e=function(_0x11d910,_0xb81183){_0x11d910=_0x11d910-0x0;var _0x3da5af=_0x55e0[_0x11d910];return _0x3da5af;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'type':{'type':Sequelize[_0x055e('0x2')](_0x055e('0x3'),'variable','customVariable',_0x055e('0x4')),'defaultValue':_0x055e('0x3')},'content':{'type':Sequelize[_0x055e('0x5')]},'key':{'type':Sequelize[_0x055e('0x5')]},'keyType':{'type':Sequelize[_0x055e('0x2')](_0x055e('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x055e('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x055e('0x5')]},'customField':{'type':Sequelize[_0x055e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x055e('0x5')]}}; \ No newline at end of file +var _0x22fb=['string','STRING','BOOLEAN','ENUM','variable','customVariable','keyValue'];(function(_0x5738fd,_0x4e4947){var _0x586364=function(_0x3500d7){while(--_0x3500d7){_0x5738fd['push'](_0x5738fd['shift']());}};_0x586364(++_0x4e4947);}(_0x22fb,0x192));var _0xb22f=function(_0x89826d,_0x47e716){_0x89826d=_0x89826d-0x0;var _0x1bfb8d=_0x22fb[_0x89826d];return _0x1bfb8d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb22f('0x0')]('string',_0xb22f('0x1'),_0xb22f('0x2'),_0xb22f('0x3')),'defaultValue':_0xb22f('0x4')},'content':{'type':Sequelize[_0xb22f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb22f('0x0')](_0xb22f('0x4'),_0xb22f('0x1'),_0xb22f('0x2'))},'keyContent':{'type':Sequelize[_0xb22f('0x5')]},'idField':{'type':Sequelize[_0xb22f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb22f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb22f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index e92e8ab..bdd6c3b 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 _0xadb5=['save','update','destroy','then','sendStatus','error','name','send','index','ZohoField','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','nolimit','where','pick','filter','merge','type','VIRTUAL','field','options','includeAll','include','findAll','show','params','find','create','body','catch','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','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xadb5,0xad));var _0x5adb=function(_0x571271,_0x491a4d){_0x571271=_0x571271-0x0;var _0x20c05a=_0xadb5[_0x571271];return _0x20c05a;};'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 hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5adb('0x14'));var utils=require(_0x5adb('0x15'));var config=require(_0x5adb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f0d5,_0x56012f){_0x56012f=_0x56012f||0xcc;return function(_0x2a0b70){if(_0x2a0b70){return _0x29f0d5['sendStatus'](_0x56012f);}return _0x29f0d5[_0x5adb('0x17')](_0x56012f)[_0x5adb('0x18')]();};}function respondWithResult(_0x44abe3,_0x5c929a){_0x5c929a=_0x5c929a||0xc8;return function(_0x2a545b){if(_0x2a545b){return _0x44abe3[_0x5adb('0x17')](_0x5c929a)[_0x5adb('0x19')](_0x2a545b);}};}function respondWithFilteredResult(_0x5263ec,_0x2312de){return function(_0x518823){if(_0x518823){var _0x367d82=_0x518823[_0x5adb('0x1a')],_0x42a482=_0x2312de[_0x5adb('0x1b')],_0x30614e=_0x2312de[_0x5adb('0x1b')]+_0x2312de[_0x5adb('0x1c')],_0x304784;if(_0x30614e>=_0x367d82){_0x30614e=_0x367d82;_0x304784=0xc8;}else{_0x304784=0xce;}_0x5263ec[_0x5adb('0x17')](_0x304784);return _0x5263ec['set'](_0x5adb('0x1d'),_0x42a482+'-'+_0x30614e+'/'+_0x367d82)['json'](_0x518823);}return null;};}function patchUpdates(_0x1d9e86){return function(_0x558f76){try{jsonpatch[_0x5adb('0x1e')](_0x558f76,_0x1d9e86,!![]);}catch(_0x50e84f){return BPromise['reject'](_0x50e84f);}return _0x558f76[_0x5adb('0x1f')]();};}function saveUpdates(_0x1bed20,_0x438671){return function(_0x1fd4a7){if(_0x1fd4a7){return _0x1fd4a7[_0x5adb('0x20')](_0x1bed20)['then'](function(_0x3255b3){return _0x3255b3;});}return null;};}function removeEntity(_0x5c296e,_0x4e9f16){return function(_0x3754cc){if(_0x3754cc){return _0x3754cc[_0x5adb('0x21')]()[_0x5adb('0x22')](function(){_0x5c296e[_0x5adb('0x17')](0xcc)[_0x5adb('0x18')]();});}};}function handleEntityNotFound(_0x413911,_0xfd9bb9){return function(_0x4ca150){if(!_0x4ca150){_0x413911[_0x5adb('0x23')](0x194);}return _0x4ca150;};}function handleError(_0x373cc3,_0x3220cd){_0x3220cd=_0x3220cd||0x1f4;return function(_0x3839fb){logger[_0x5adb('0x24')](_0x3839fb['stack']);if(_0x3839fb[_0x5adb('0x25')]){delete _0x3839fb[_0x5adb('0x25')];}_0x373cc3['status'](_0x3220cd)[_0x5adb('0x26')](_0x3839fb);};}exports[_0x5adb('0x27')]=function(_0x1a0acd,_0x55b40a){var _0x13ad1d={},_0xbe21b1={},_0x3a4fca={'count':0x0,'rows':[]};var _0x2c64a3=db[_0x5adb('0x28')][_0x5adb('0x29')];_0xbe21b1['model']=_['keys'](_0x2c64a3);_0xbe21b1['query']=_[_0x5adb('0x2a')](_0x1a0acd[_0x5adb('0x2b')]);_0xbe21b1[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0xbe21b1[_0x5adb('0x2e')],_0xbe21b1['query']);_0x13ad1d[_0x5adb('0x2f')]=_[_0x5adb('0x2d')](_0xbe21b1[_0x5adb('0x2e')],qs[_0x5adb('0x30')](_0x1a0acd[_0x5adb('0x2b')][_0x5adb('0x30')]));_0x13ad1d[_0x5adb('0x2f')]=_0x13ad1d[_0x5adb('0x2f')][_0x5adb('0x31')]?_0x13ad1d[_0x5adb('0x2f')]:_0xbe21b1['model'];if(!_0x1a0acd[_0x5adb('0x2b')]['hasOwnProperty'](_0x5adb('0x32'))){_0x13ad1d[_0x5adb('0x1c')]=qs['limit'](_0x1a0acd[_0x5adb('0x2b')][_0x5adb('0x1c')]);_0x13ad1d[_0x5adb('0x1b')]=qs['offset'](_0x1a0acd[_0x5adb('0x2b')][_0x5adb('0x1b')]);}_0x13ad1d['order']=qs['sort'](_0x1a0acd[_0x5adb('0x2b')]['sort']);_0x13ad1d[_0x5adb('0x33')]=qs[_0x5adb('0x2c')](_[_0x5adb('0x34')](_0x1a0acd[_0x5adb('0x2b')],_0xbe21b1[_0x5adb('0x2c')]));if(_0x1a0acd['query'][_0x5adb('0x35')]){_0x13ad1d[_0x5adb('0x33')]=_[_0x5adb('0x36')](_0x13ad1d['where'],{'$or':_['map'](_0x2c64a3,function(_0x32eb69){if(_0x32eb69[_0x5adb('0x37')]['key']!==_0x5adb('0x38')){var _0x4a4260={};_0x4a4260[_0x32eb69[_0x5adb('0x39')]]={'$like':'%'+_0x1a0acd['query'][_0x5adb('0x35')]+'%'};return _0x4a4260;}})});}_0x13ad1d=_['merge']({},_0x13ad1d,_0x1a0acd[_0x5adb('0x3a')]);var _0x23a1db={'where':_0x13ad1d['where']};return db[_0x5adb('0x28')]['count'](_0x23a1db)[_0x5adb('0x22')](function(_0x34e828){_0x3a4fca[_0x5adb('0x1a')]=_0x34e828;if(_0x1a0acd['query'][_0x5adb('0x3b')]){_0x13ad1d[_0x5adb('0x3c')]=[{'all':!![]}];}return db[_0x5adb('0x28')][_0x5adb('0x3d')](_0x13ad1d);})[_0x5adb('0x22')](function(_0x52d74f){_0x3a4fca['rows']=_0x52d74f;return _0x3a4fca;})['then'](respondWithFilteredResult(_0x55b40a,_0x13ad1d))['catch'](handleError(_0x55b40a,null));};exports[_0x5adb('0x3e')]=function(_0x2fbe14,_0x3a104a){var _0x399489={'raw':!![],'where':{'id':_0x2fbe14[_0x5adb('0x3f')]['id']}},_0x130e18={};_0x130e18[_0x5adb('0x2e')]=_[_0x5adb('0x2a')](db['ZohoField']['rawAttributes']);_0x130e18[_0x5adb('0x2b')]=_['keys'](_0x2fbe14[_0x5adb('0x2b')]);_0x130e18[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x130e18[_0x5adb('0x2e')],_0x130e18[_0x5adb('0x2b')]);_0x399489['attributes']=_[_0x5adb('0x2d')](_0x130e18[_0x5adb('0x2e')],qs['fields'](_0x2fbe14[_0x5adb('0x2b')][_0x5adb('0x30')]));_0x399489['attributes']=_0x399489[_0x5adb('0x2f')][_0x5adb('0x31')]?_0x399489[_0x5adb('0x2f')]:_0x130e18[_0x5adb('0x2e')];if(_0x2fbe14[_0x5adb('0x2b')][_0x5adb('0x3b')]){_0x399489[_0x5adb('0x3c')]=[{'all':!![]}];}_0x399489=_['merge']({},_0x399489,_0x2fbe14['options']);return db[_0x5adb('0x28')][_0x5adb('0x40')](_0x399489)[_0x5adb('0x22')](handleEntityNotFound(_0x3a104a,null))[_0x5adb('0x22')](respondWithResult(_0x3a104a,null))['catch'](handleError(_0x3a104a,null));};exports['create']=function(_0xaa32e4,_0x4d7d86){return db[_0x5adb('0x28')][_0x5adb('0x41')](_0xaa32e4[_0x5adb('0x42')],{})['then'](respondWithResult(_0x4d7d86,0xc9))[_0x5adb('0x43')](handleError(_0x4d7d86,null));};exports[_0x5adb('0x20')]=function(_0x5b574c,_0x7786c4){if(_0x5b574c[_0x5adb('0x42')]['id']){delete _0x5b574c[_0x5adb('0x42')]['id'];}return db[_0x5adb('0x28')][_0x5adb('0x40')]({'where':{'id':_0x5b574c[_0x5adb('0x3f')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x7786c4,null))[_0x5adb('0x22')](saveUpdates(_0x5b574c['body'],null))[_0x5adb('0x22')](respondWithResult(_0x7786c4,null))['catch'](handleError(_0x7786c4,null));};exports['destroy']=function(_0x5015ee,_0x3cd211){return db[_0x5adb('0x28')][_0x5adb('0x40')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))['then'](removeEntity(_0x3cd211,null))[_0x5adb('0x43')](handleError(_0x3cd211,null));}; \ No newline at end of file +var _0x5fab=['hasOwnProperty','offset','order','sort','where','filter','merge','map','type','VIRTUAL','field','includeAll','include','rows','catch','params','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ZohoField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0xee1ec9,_0x2f0599){var _0x102a53=function(_0x4e5f7f){while(--_0x4e5f7f){_0xee1ec9['push'](_0xee1ec9['shift']());}};_0x102a53(++_0x2f0599);}(_0x5fab,0x177));var _0xb5fa=function(_0x335136,_0x131d00){_0x335136=_0x335136-0x0;var _0x234b60=_0x5fab[_0x335136];return _0x234b60;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var hardwareService=require(_0xb5fa('0x12'));var logger=require(_0xb5fa('0x13'))(_0xb5fa('0x14'));var utils=require(_0xb5fa('0x15'));var config=require(_0xb5fa('0x16'));var db=require(_0xb5fa('0x17'))['db'];function respondWithStatusCode(_0x46da66,_0x309740){_0x309740=_0x309740||0xcc;return function(_0x4d3576){if(_0x4d3576){return _0x46da66[_0xb5fa('0x18')](_0x309740);}return _0x46da66[_0xb5fa('0x19')](_0x309740)['end']();};}function respondWithResult(_0x116849,_0x577af0){_0x577af0=_0x577af0||0xc8;return function(_0x265992){if(_0x265992){return _0x116849[_0xb5fa('0x19')](_0x577af0)[_0xb5fa('0x1a')](_0x265992);}};}function respondWithFilteredResult(_0xca8d82,_0x8e9d1c){return function(_0x5371cf){if(_0x5371cf){var _0x567f31=_0x5371cf[_0xb5fa('0x1b')],_0x38e964=_0x8e9d1c['offset'],_0x587043=_0x8e9d1c['offset']+_0x8e9d1c[_0xb5fa('0x1c')],_0x31f252;if(_0x587043>=_0x567f31){_0x587043=_0x567f31;_0x31f252=0xc8;}else{_0x31f252=0xce;}_0xca8d82[_0xb5fa('0x19')](_0x31f252);return _0xca8d82[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x38e964+'-'+_0x587043+'/'+_0x567f31)[_0xb5fa('0x1a')](_0x5371cf);}return null;};}function patchUpdates(_0x13e82b){return function(_0x3b0f69){try{jsonpatch[_0xb5fa('0x1f')](_0x3b0f69,_0x13e82b,!![]);}catch(_0xc14dc4){return BPromise[_0xb5fa('0x20')](_0xc14dc4);}return _0x3b0f69[_0xb5fa('0x21')]();};}function saveUpdates(_0x1f5064,_0x5cd822){return function(_0x432bfa){if(_0x432bfa){return _0x432bfa['update'](_0x1f5064)[_0xb5fa('0x22')](function(_0x4a6c04){return _0x4a6c04;});}return null;};}function removeEntity(_0xd0fe2b,_0x43c09f){return function(_0x4e05c0){if(_0x4e05c0){return _0x4e05c0[_0xb5fa('0x23')]()[_0xb5fa('0x22')](function(){_0xd0fe2b[_0xb5fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a85c,_0xec108f){return function(_0x444237){if(!_0x444237){_0x32a85c['sendStatus'](0x194);}return _0x444237;};}function handleError(_0x224ec8,_0x5d55f7){_0x5d55f7=_0x5d55f7||0x1f4;return function(_0x106c4b){logger[_0xb5fa('0x24')](_0x106c4b[_0xb5fa('0x25')]);if(_0x106c4b[_0xb5fa('0x26')]){delete _0x106c4b[_0xb5fa('0x26')];}_0x224ec8[_0xb5fa('0x19')](_0x5d55f7)[_0xb5fa('0x27')](_0x106c4b);};}exports[_0xb5fa('0x28')]=function(_0x568870,_0x4ec294){var _0x5bdf11={},_0x5a1c39={},_0x28a350={'count':0x0,'rows':[]};var _0x460b54=db[_0xb5fa('0x29')][_0xb5fa('0x2a')];_0x5a1c39[_0xb5fa('0x2b')]=_[_0xb5fa('0x2c')](_0x460b54);_0x5a1c39[_0xb5fa('0x2d')]=_[_0xb5fa('0x2c')](_0x568870[_0xb5fa('0x2d')]);_0x5a1c39[_0xb5fa('0x2e')]=_[_0xb5fa('0x2f')](_0x5a1c39[_0xb5fa('0x2b')],_0x5a1c39[_0xb5fa('0x2d')]);_0x5bdf11[_0xb5fa('0x30')]=_[_0xb5fa('0x2f')](_0x5a1c39[_0xb5fa('0x2b')],qs[_0xb5fa('0x31')](_0x568870[_0xb5fa('0x2d')][_0xb5fa('0x31')]));_0x5bdf11[_0xb5fa('0x30')]=_0x5bdf11[_0xb5fa('0x30')][_0xb5fa('0x32')]?_0x5bdf11[_0xb5fa('0x30')]:_0x5a1c39[_0xb5fa('0x2b')];if(!_0x568870['query'][_0xb5fa('0x33')]('nolimit')){_0x5bdf11['limit']=qs['limit'](_0x568870[_0xb5fa('0x2d')]['limit']);_0x5bdf11[_0xb5fa('0x34')]=qs['offset'](_0x568870['query'][_0xb5fa('0x34')]);}_0x5bdf11[_0xb5fa('0x35')]=qs['sort'](_0x568870['query'][_0xb5fa('0x36')]);_0x5bdf11[_0xb5fa('0x37')]=qs[_0xb5fa('0x2e')](_['pick'](_0x568870[_0xb5fa('0x2d')],_0x5a1c39[_0xb5fa('0x2e')]));if(_0x568870['query'][_0xb5fa('0x38')]){_0x5bdf11[_0xb5fa('0x37')]=_[_0xb5fa('0x39')](_0x5bdf11['where'],{'$or':_[_0xb5fa('0x3a')](_0x460b54,function(_0x2c950e){if(_0x2c950e[_0xb5fa('0x3b')]['key']!==_0xb5fa('0x3c')){var _0x1c818f={};_0x1c818f[_0x2c950e[_0xb5fa('0x3d')]]={'$like':'%'+_0x568870[_0xb5fa('0x2d')]['filter']+'%'};return _0x1c818f;}})});}_0x5bdf11=_['merge']({},_0x5bdf11,_0x568870['options']);var _0x49e786={'where':_0x5bdf11['where']};return db['ZohoField'][_0xb5fa('0x1b')](_0x49e786)['then'](function(_0x43de71){_0x28a350[_0xb5fa('0x1b')]=_0x43de71;if(_0x568870[_0xb5fa('0x2d')][_0xb5fa('0x3e')]){_0x5bdf11[_0xb5fa('0x3f')]=[{'all':!![]}];}return db[_0xb5fa('0x29')]['findAll'](_0x5bdf11);})['then'](function(_0x4c4bf0){_0x28a350[_0xb5fa('0x40')]=_0x4c4bf0;return _0x28a350;})['then'](respondWithFilteredResult(_0x4ec294,_0x5bdf11))[_0xb5fa('0x41')](handleError(_0x4ec294,null));};exports['show']=function(_0x58aa97,_0x3cdf63){var _0x42d331={'raw':!![],'where':{'id':_0x58aa97[_0xb5fa('0x42')]['id']}},_0x2e056e={};_0x2e056e[_0xb5fa('0x2b')]=_[_0xb5fa('0x2c')](db[_0xb5fa('0x29')][_0xb5fa('0x2a')]);_0x2e056e[_0xb5fa('0x2d')]=_[_0xb5fa('0x2c')](_0x58aa97['query']);_0x2e056e[_0xb5fa('0x2e')]=_['intersection'](_0x2e056e[_0xb5fa('0x2b')],_0x2e056e[_0xb5fa('0x2d')]);_0x42d331[_0xb5fa('0x30')]=_[_0xb5fa('0x2f')](_0x2e056e[_0xb5fa('0x2b')],qs[_0xb5fa('0x31')](_0x58aa97[_0xb5fa('0x2d')][_0xb5fa('0x31')]));_0x42d331['attributes']=_0x42d331[_0xb5fa('0x30')][_0xb5fa('0x32')]?_0x42d331['attributes']:_0x2e056e[_0xb5fa('0x2b')];if(_0x58aa97['query'][_0xb5fa('0x3e')]){_0x42d331[_0xb5fa('0x3f')]=[{'all':!![]}];}_0x42d331=_['merge']({},_0x42d331,_0x58aa97['options']);return db[_0xb5fa('0x29')][_0xb5fa('0x43')](_0x42d331)[_0xb5fa('0x22')](handleEntityNotFound(_0x3cdf63,null))[_0xb5fa('0x22')](respondWithResult(_0x3cdf63,null))[_0xb5fa('0x41')](handleError(_0x3cdf63,null));};exports[_0xb5fa('0x44')]=function(_0x10f354,_0x125a5c){return db['ZohoField'][_0xb5fa('0x44')](_0x10f354[_0xb5fa('0x45')],{})['then'](respondWithResult(_0x125a5c,0xc9))[_0xb5fa('0x41')](handleError(_0x125a5c,null));};exports[_0xb5fa('0x46')]=function(_0x247999,_0x43b056){if(_0x247999[_0xb5fa('0x45')]['id']){delete _0x247999[_0xb5fa('0x45')]['id'];}return db[_0xb5fa('0x29')][_0xb5fa('0x43')]({'where':{'id':_0x247999[_0xb5fa('0x42')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x43b056,null))[_0xb5fa('0x22')](saveUpdates(_0x247999[_0xb5fa('0x45')],null))[_0xb5fa('0x22')](respondWithResult(_0x43b056,null))[_0xb5fa('0x41')](handleError(_0x43b056,null));};exports[_0xb5fa('0x23')]=function(_0x3a39f2,_0x52f5d8){return db['ZohoField'][_0xb5fa('0x43')]({'where':{'id':_0x3a39f2['params']['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x22')](removeEntity(_0x52f5d8,null))['catch'](handleError(_0x52f5d8,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 026e477..893d22b 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 _0xc38d=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc38d,0x1da));var _0xdc38=function(_0xfe4571,_0x4fcb06){_0xfe4571=_0xfe4571-0x0;var _0x148587=_0xc38d[_0xfe4571];return _0x148587;};'use strict';var _=require(_0xdc38('0x0'));var util=require(_0xdc38('0x1'));var logger=require(_0xdc38('0x2'))('api');var moment=require(_0xdc38('0x3'));var BPromise=require(_0xdc38('0x4'));var rp=require(_0xdc38('0x5'));var fs=require('fs');var path=require(_0xdc38('0x6'));var rimraf=require(_0xdc38('0x7'));var config=require(_0xdc38('0x8'));var attributes=require(_0xdc38('0x9'));module[_0xdc38('0xa')]=function(_0x4beb56,_0x45efb1){return _0x4beb56[_0xdc38('0xb')](_0xdc38('0xc'),attributes,{'tableName':_0xdc38('0xd'),'paranoid':![],'indexes':[{'name':_0xdc38('0xe'),'fields':[_0xdc38('0xf'),_0xdc38('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9984=['moment','bluebird','request-promise','path','../../config/environment','exports','ZohoField','int_zoho_fields','idField','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9984,0x1dd));var _0x4998=function(_0x31ee92,_0x578e93){_0x31ee92=_0x31ee92-0x0;var _0x310f31=_0x9984[_0x31ee92];return _0x310f31;};'use strict';var _=require(_0x4998('0x0'));var util=require('util');var logger=require(_0x4998('0x1'))(_0x4998('0x2'));var moment=require(_0x4998('0x3'));var BPromise=require(_0x4998('0x4'));var rp=require(_0x4998('0x5'));var fs=require('fs');var path=require(_0x4998('0x6'));var rimraf=require('rimraf');var config=require(_0x4998('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4998('0x8')]=function(_0x7f74c3,_0x30e76a){return _0x7f74c3['define'](_0x4998('0x9'),attributes,{'tableName':_0x4998('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x4998('0xb'),'FieldId'],'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 b8c37b6..f74745e 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 _0x5266=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5fe69a,_0x5484f5){var _0x3f1aee=function(_0x54387f){while(--_0x54387f){_0x5fe69a['push'](_0x5fe69a['shift']());}};_0x3f1aee(++_0x5484f5);}(_0x5266,0xf1));var _0x6526=function(_0x1f7928,_0xdafed0){_0x1f7928=_0x1f7928-0x0;var _0x498443=_0x5266[_0x1f7928];return _0x498443;};'use strict';var _=require('lodash');var util=require(_0x6526('0x0'));var moment=require(_0x6526('0x1'));var BPromise=require(_0x6526('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6526('0x3'));var db=require(_0x6526('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6526('0x5'));var config=require(_0x6526('0x6'));var jayson=require(_0x6526('0x7'));var client=jayson[_0x6526('0x8')][_0x6526('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40c62b,_0x2ccd91,_0x2bffa0){return new BPromise(function(_0x32e0bc,_0x5493d4){return client[_0x6526('0xa')](_0x40c62b,_0x2bffa0)['then'](function(_0x2b98a0){logger[_0x6526('0xb')](_0x6526('0xc'),_0x2ccd91,_0x6526('0xd'));logger[_0x6526('0xe')](_0x6526('0xf'),_0x2ccd91,'request\x20sent',JSON[_0x6526('0x10')](_0x2b98a0));if(_0x2b98a0['error']){if(_0x2b98a0[_0x6526('0x11')]['code']===0x1f4){logger['error'](_0x6526('0xc'),_0x2ccd91,_0x2b98a0[_0x6526('0x11')][_0x6526('0x12')]);return _0x5493d4(_0x2b98a0['error'][_0x6526('0x12')]);}logger[_0x6526('0x11')](_0x6526('0xc'),_0x2ccd91,_0x2b98a0[_0x6526('0x11')]['message']);return _0x32e0bc(_0x2b98a0[_0x6526('0x11')][_0x6526('0x12')]);}else{logger[_0x6526('0xb')](_0x6526('0xc'),_0x2ccd91,_0x6526('0xd'));_0x32e0bc(_0x2b98a0[_0x6526('0x13')][_0x6526('0x12')]);}})[_0x6526('0x14')](function(_0x4f4e1d){logger['error'](_0x6526('0xc'),_0x2ccd91,_0x4f4e1d);_0x5493d4(_0x4f4e1d);});});} \ No newline at end of file +var _0xb2c2=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x4a8f12,_0x49a6f3){var _0x54871b=function(_0xd9190e){while(--_0xd9190e){_0x4a8f12['push'](_0x4a8f12['shift']());}};_0x54871b(++_0x49a6f3);}(_0xb2c2,0x7e));var _0x2b2c=function(_0x5de889,_0x115fc4){_0x5de889=_0x5de889-0x0;var _0x549a4f=_0xb2c2[_0x5de889];return _0x549a4f;};'use strict';var _=require(_0x2b2c('0x0'));var util=require(_0x2b2c('0x1'));var moment=require(_0x2b2c('0x2'));var BPromise=require(_0x2b2c('0x3'));var rs=require(_0x2b2c('0x4'));var fs=require('fs');var Redis=require(_0x2b2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b2c('0x6'));var logger=require(_0x2b2c('0x7'))(_0x2b2c('0x8'));var config=require(_0x2b2c('0x9'));var jayson=require(_0x2b2c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47e267,_0x857ac7,_0x48b924){return new BPromise(function(_0x3cb156,_0x15e83c){return client[_0x2b2c('0xb')](_0x47e267,_0x48b924)[_0x2b2c('0xc')](function(_0x5703c5){logger[_0x2b2c('0xd')](_0x2b2c('0xe'),_0x857ac7,_0x2b2c('0xf'));logger[_0x2b2c('0x10')](_0x2b2c('0x11'),_0x857ac7,_0x2b2c('0xf'),JSON[_0x2b2c('0x12')](_0x5703c5));if(_0x5703c5[_0x2b2c('0x13')]){if(_0x5703c5[_0x2b2c('0x13')][_0x2b2c('0x14')]===0x1f4){logger['error'](_0x2b2c('0xe'),_0x857ac7,_0x5703c5['error'][_0x2b2c('0x15')]);return _0x15e83c(_0x5703c5[_0x2b2c('0x13')][_0x2b2c('0x15')]);}logger[_0x2b2c('0x13')]('ZohoField,\x20%s,\x20%s',_0x857ac7,_0x5703c5['error']['message']);return _0x3cb156(_0x5703c5[_0x2b2c('0x13')][_0x2b2c('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x857ac7,_0x2b2c('0xf'));_0x3cb156(_0x5703c5[_0x2b2c('0x16')]['message']);}})[_0x2b2c('0x17')](function(_0x506548){logger[_0x2b2c('0x13')]('ZohoField,\x20%s,\x20%s',_0x857ac7,_0x506548);_0x15e83c(_0x506548);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6eb5614..8db77f0 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 _0x6657=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6657,0x17f));var _0x7665=function(_0x5f05ec,_0x1fdb88){_0x5f05ec=_0x5f05ec-0x0;var _0x20c8ed=_0x6657[_0x5f05ec];return _0x20c8ed;};'use strict';var multer=require(_0x7665('0x0'));var util=require('util');var path=require(_0x7665('0x1'));var timeout=require(_0x7665('0x2'));var express=require(_0x7665('0x3'));var router=express[_0x7665('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7665('0x5'));var config=require(_0x7665('0x6'));module[_0x7665('0x7')]=router; \ No newline at end of file +var _0x16ce=['path','connect-timeout','express','Router','../../components/auth/service','util'];(function(_0x1c08ae,_0x2c5f55){var _0x5bcfcb=function(_0x467f55){while(--_0x467f55){_0x1c08ae['push'](_0x1c08ae['shift']());}};_0x5bcfcb(++_0x2c5f55);}(_0x16ce,0xfb));var _0xe16c=function(_0x4659dd,_0x1bba21){_0x4659dd=_0x4659dd-0x0;var _0x597c28=_0x16ce[_0x4659dd];return _0x597c28;};'use strict';var multer=require('multer');var util=require(_0xe16c('0x0'));var path=require(_0xe16c('0x1'));var timeout=require(_0xe16c('0x2'));var express=require(_0xe16c('0x3'));var router=express[_0xe16c('0x4')]();var auth=require(_0xe16c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 949829d..0762d8f 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 _0x8007=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x496590,_0x3426e9){var _0x585ebc=function(_0x5a3f53){while(--_0x5a3f53){_0x496590['push'](_0x496590['shift']());}};_0x585ebc(++_0x3426e9);}(_0x8007,0x183));var _0x7800=function(_0x4f1326,_0x35127d){_0x4f1326=_0x4f1326-0x0;var _0x15e896=_0x8007[_0x4f1326];return _0x15e896;};'use strict';var Sequelize=require('sequelize');module[_0x7800('0x0')]={'name':{'type':Sequelize[_0x7800('0x1')],'allowNull':![],'unique':_0x7800('0x2')},'version':{'type':Sequelize[_0x7800('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x7800('0x3')},'filename':{'type':Sequelize[_0x7800('0x1')]},'path':{'type':Sequelize[_0x7800('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x7800('0x4')]},'active':{'type':Sequelize[_0x7800('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x7800('0x1')]},'logo':{'type':Sequelize[_0x7800('0x1')]},'state':{'type':Sequelize[_0x7800('0x1')],'unique':_0x7800('0x6')},'description':{'type':Sequelize[_0x7800('0x1')]},'title':{'type':Sequelize[_0x7800('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x7800('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc4db=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x62565c,_0x13148e){var _0x5cfa37=function(_0x334f2c){while(--_0x334f2c){_0x62565c['push'](_0x62565c['shift']());}};_0x5cfa37(++_0x13148e);}(_0xc4db,0x1d1));var _0xbc4d=function(_0x285d29,_0x52c639){_0x285d29=_0x285d29-0x0;var _0x202256=_0xc4db[_0x285d29];return _0x202256;};'use strict';var Sequelize=require(_0xbc4d('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc4d('0x1')],'allowNull':![],'unique':_0xbc4d('0x2')},'version':{'type':Sequelize[_0xbc4d('0x1')],'allowNull':![],'unique':_0xbc4d('0x2')},'main':{'type':Sequelize[_0xbc4d('0x1')],'defaultValue':_0xbc4d('0x3')},'filename':{'type':Sequelize[_0xbc4d('0x1')]},'path':{'type':Sequelize[_0xbc4d('0x1')]},'type':{'type':Sequelize[_0xbc4d('0x1')]},'size':{'type':Sequelize[_0xbc4d('0x4')]},'active':{'type':Sequelize[_0xbc4d('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xbc4d('0x1')]},'logo':{'type':Sequelize[_0xbc4d('0x1')]},'state':{'type':Sequelize[_0xbc4d('0x1')],'unique':_0xbc4d('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xbc4d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xbc4d('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b6f430c..c6f257b 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 _0xa9e0=['fields','length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','destroy','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','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','Integration','rawAttributes','model','keys','query','filters','attributes','intersection'];(function(_0x5b4d0b,_0x2903a2){var _0x49529d=function(_0x48adbc){while(--_0x48adbc){_0x5b4d0b['push'](_0x5b4d0b['shift']());}};_0x49529d(++_0x2903a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={},_0x479bc4={},_0x45a1e7={'count':0x0,'rows':[]};var _0x5bfb33=db[_0x0a9e('0x24')][_0x0a9e('0x25')];_0x479bc4[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x5bfb33);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_['intersection'](_0x479bc4[_0x0a9e('0x26')],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x479bc4['model'],qs[_0x0a9e('0x2c')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x384319[_0x0a9e('0x2a')]=_0x384319[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x384319[_0x0a9e('0x2a')]:_0x479bc4[_0x0a9e('0x26')];if(!_0x33161b[_0x0a9e('0x28')]['hasOwnProperty'](_0x0a9e('0x2e'))){_0x384319['limit']=qs[_0x0a9e('0x19')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x19')]);_0x384319[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x33161b['query'][_0x0a9e('0x18')]);}_0x384319[_0x0a9e('0x2f')]=qs[_0x0a9e('0x30')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x30')]);_0x384319[_0x0a9e('0x31')]=qs[_0x0a9e('0x29')](_[_0x0a9e('0x32')](_0x33161b['query'],_0x479bc4[_0x0a9e('0x29')]));if(_0x33161b['query'][_0x0a9e('0x33')]){_0x384319[_0x0a9e('0x31')]=_[_0x0a9e('0x34')](_0x384319[_0x0a9e('0x31')],{'$or':_['map'](_0x5bfb33,function(_0x191e91){if(_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4853b1={};_0x4853b1[_0x191e91['field']]={'$like':'%'+_0x33161b[_0x0a9e('0x28')]['filter']+'%'};return _0x4853b1;}})});}_0x384319=_[_0x0a9e('0x34')]({},_0x384319,_0x33161b[_0x0a9e('0x38')]);var _0x381c37={'where':_0x384319[_0x0a9e('0x31')]};return db['Integration'][_0x0a9e('0x17')](_0x381c37)[_0x0a9e('0x1f')](function(_0x3cae){_0x45a1e7['count']=_0x3cae;if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x384319[_0x0a9e('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x384319);})[_0x0a9e('0x1f')](function(_0x40d766){_0x45a1e7['rows']=_0x40d766;return _0x45a1e7;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x526cf3,_0x384319))[_0x0a9e('0x3b')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x3c')]=function(_0x148f55,_0x4b38d9){var _0x5a594b={'raw':![],'where':{'id':_0x148f55[_0x0a9e('0x3d')]['id']}},_0x15e37d={};_0x15e37d['model']=_[_0x0a9e('0x27')](db[_0x0a9e('0x24')][_0x0a9e('0x25')]);_0x15e37d['query']=_[_0x0a9e('0x27')](_0x148f55[_0x0a9e('0x28')]);_0x15e37d[_0x0a9e('0x29')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],_0x15e37d[_0x0a9e('0x28')]);_0x5a594b[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],qs[_0x0a9e('0x2c')](_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x5a594b[_0x0a9e('0x2a')]=_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x5a594b['attributes']:_0x15e37d['model'];if(_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x5a594b[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5a594b=_[_0x0a9e('0x34')]({},_0x5a594b,_0x148f55[_0x0a9e('0x38')]);return db[_0x0a9e('0x24')][_0x0a9e('0x3e')](_0x5a594b)[_0x0a9e('0x1f')](handleEntityNotFound(_0x4b38d9,null))[_0x0a9e('0x1f')](respondWithResult(_0x4b38d9,null))[_0x0a9e('0x3b')](handleError(_0x4b38d9,null));};exports[_0x0a9e('0x3f')]=function(_0x35ed4a,_0x5026aa){return db[_0x0a9e('0x24')][_0x0a9e('0x3f')](_0x35ed4a[_0x0a9e('0x40')],{})[_0x0a9e('0x1f')](respondWithResult(_0x5026aa,0xc9))[_0x0a9e('0x3b')](handleError(_0x5026aa,null));};exports[_0x0a9e('0x41')]=function(_0x21eb86,_0x44dd99){if(_0x21eb86['body']['id']){delete _0x21eb86[_0x0a9e('0x40')]['id'];}return db['Integration'][_0x0a9e('0x3e')]({'where':{'id':_0x21eb86[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x44dd99,null))['then'](saveUpdates(_0x21eb86[_0x0a9e('0x40')],null))[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,null))[_0x0a9e('0x3b')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x42')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x24')]['find']({'where':{'id':_0x45c845[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x1f')](removeEntity(_0x37be73,null))[_0x0a9e('0x3b')](handleError(_0x37be73,null));}; \ No newline at end of file +var _0xa9e0=['fields','length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','destroy','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','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','Integration','rawAttributes','model','keys','query','filters','attributes','intersection'];(function(_0x3869e7,_0x37e1dc){var _0x66260d=function(_0x4e0f2d){while(--_0x4e0f2d){_0x3869e7['push'](_0x3869e7['shift']());}};_0x66260d(++_0x37e1dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={},_0x479bc4={},_0x45a1e7={'count':0x0,'rows':[]};var _0x5bfb33=db[_0x0a9e('0x24')][_0x0a9e('0x25')];_0x479bc4[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x5bfb33);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_['intersection'](_0x479bc4[_0x0a9e('0x26')],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x479bc4['model'],qs[_0x0a9e('0x2c')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x384319[_0x0a9e('0x2a')]=_0x384319[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x384319[_0x0a9e('0x2a')]:_0x479bc4[_0x0a9e('0x26')];if(!_0x33161b[_0x0a9e('0x28')]['hasOwnProperty'](_0x0a9e('0x2e'))){_0x384319['limit']=qs[_0x0a9e('0x19')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x19')]);_0x384319[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x33161b['query'][_0x0a9e('0x18')]);}_0x384319[_0x0a9e('0x2f')]=qs[_0x0a9e('0x30')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x30')]);_0x384319[_0x0a9e('0x31')]=qs[_0x0a9e('0x29')](_[_0x0a9e('0x32')](_0x33161b['query'],_0x479bc4[_0x0a9e('0x29')]));if(_0x33161b['query'][_0x0a9e('0x33')]){_0x384319[_0x0a9e('0x31')]=_[_0x0a9e('0x34')](_0x384319[_0x0a9e('0x31')],{'$or':_['map'](_0x5bfb33,function(_0x191e91){if(_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4853b1={};_0x4853b1[_0x191e91['field']]={'$like':'%'+_0x33161b[_0x0a9e('0x28')]['filter']+'%'};return _0x4853b1;}})});}_0x384319=_[_0x0a9e('0x34')]({},_0x384319,_0x33161b[_0x0a9e('0x38')]);var _0x381c37={'where':_0x384319[_0x0a9e('0x31')]};return db['Integration'][_0x0a9e('0x17')](_0x381c37)[_0x0a9e('0x1f')](function(_0x3cae){_0x45a1e7['count']=_0x3cae;if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x384319[_0x0a9e('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x384319);})[_0x0a9e('0x1f')](function(_0x40d766){_0x45a1e7['rows']=_0x40d766;return _0x45a1e7;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x526cf3,_0x384319))[_0x0a9e('0x3b')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x3c')]=function(_0x148f55,_0x4b38d9){var _0x5a594b={'raw':![],'where':{'id':_0x148f55[_0x0a9e('0x3d')]['id']}},_0x15e37d={};_0x15e37d['model']=_[_0x0a9e('0x27')](db[_0x0a9e('0x24')][_0x0a9e('0x25')]);_0x15e37d['query']=_[_0x0a9e('0x27')](_0x148f55[_0x0a9e('0x28')]);_0x15e37d[_0x0a9e('0x29')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],_0x15e37d[_0x0a9e('0x28')]);_0x5a594b[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],qs[_0x0a9e('0x2c')](_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x5a594b[_0x0a9e('0x2a')]=_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x5a594b['attributes']:_0x15e37d['model'];if(_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x5a594b[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5a594b=_[_0x0a9e('0x34')]({},_0x5a594b,_0x148f55[_0x0a9e('0x38')]);return db[_0x0a9e('0x24')][_0x0a9e('0x3e')](_0x5a594b)[_0x0a9e('0x1f')](handleEntityNotFound(_0x4b38d9,null))[_0x0a9e('0x1f')](respondWithResult(_0x4b38d9,null))[_0x0a9e('0x3b')](handleError(_0x4b38d9,null));};exports[_0x0a9e('0x3f')]=function(_0x35ed4a,_0x5026aa){return db[_0x0a9e('0x24')][_0x0a9e('0x3f')](_0x35ed4a[_0x0a9e('0x40')],{})[_0x0a9e('0x1f')](respondWithResult(_0x5026aa,0xc9))[_0x0a9e('0x3b')](handleError(_0x5026aa,null));};exports[_0x0a9e('0x41')]=function(_0x21eb86,_0x44dd99){if(_0x21eb86['body']['id']){delete _0x21eb86[_0x0a9e('0x40')]['id'];}return db['Integration'][_0x0a9e('0x3e')]({'where':{'id':_0x21eb86[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x44dd99,null))['then'](saveUpdates(_0x21eb86[_0x0a9e('0x40')],null))[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,null))[_0x0a9e('0x3b')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x42')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x24')]['find']({'where':{'id':_0x45c845[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x1f')](removeEntity(_0x37be73,null))[_0x0a9e('0x3b')](handleError(_0x37be73,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 834b4d3..b700dea 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 _0xa601=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','api','moment','bluebird','request-promise'];(function(_0x5df735,_0x4aa901){var _0x426a45=function(_0x4ad957){while(--_0x4ad957){_0x5df735['push'](_0x5df735['shift']());}};_0x426a45(++_0x4aa901);}(_0xa601,0x11b));var _0x1a60=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xa601[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0x1a60('0x0'));var logger=require('../../config/logger')(_0x1a60('0x1'));var moment=require(_0x1a60('0x2'));var BPromise=require(_0x1a60('0x3'));var rp=require(_0x1a60('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a60('0x5'));var config=require(_0x1a60('0x6'));var attributes=require(_0x1a60('0x7'));module[_0x1a60('0x8')]=function(_0x55ed16,_0x466f6d){return _0x55ed16[_0x1a60('0x9')](_0x1a60('0xa'),attributes,{'tableName':_0x1a60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b93=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','Integration'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8b93,0x15e));var _0x38b9=function(_0x2e38e8,_0xacd5a9){_0x2e38e8=_0x2e38e8-0x0;var _0x11289d=_0x8b93[_0x2e38e8];return _0x11289d;};'use strict';var _=require(_0x38b9('0x0'));var util=require(_0x38b9('0x1'));var logger=require('../../config/logger')(_0x38b9('0x2'));var moment=require(_0x38b9('0x3'));var BPromise=require(_0x38b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x38b9('0x5'));var config=require(_0x38b9('0x6'));var attributes=require(_0x38b9('0x7'));module[_0x38b9('0x8')]=function(_0x29ad63,_0x13a23d){return _0x29ad63['define'](_0x38b9('0x9'),attributes,{'tableName':'integrations','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 8769e9b..dcc3563 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 _0x0234=['rpc','../../config/environment','jayson/promise','client','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1e8242,_0x31e119){var _0x40856a=function(_0x58f74c){while(--_0x58f74c){_0x1e8242['push'](_0x1e8242['shift']());}};_0x40856a(++_0x31e119);}(_0x0234,0xea));var _0x4023=function(_0x519af2,_0x1043e9){_0x519af2=_0x519af2-0x0;var _0x3743b8=_0x0234[_0x519af2];return _0x3743b8;};'use strict';var _=require(_0x4023('0x0'));var util=require(_0x4023('0x1'));var moment=require(_0x4023('0x2'));var BPromise=require(_0x4023('0x3'));var rs=require(_0x4023('0x4'));var fs=require('fs');var Redis=require(_0x4023('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4023('0x6'));var logger=require(_0x4023('0x7'))(_0x4023('0x8'));var config=require(_0x4023('0x9'));var jayson=require(_0x4023('0xa'));var client=jayson[_0x4023('0xb')][_0x4023('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a5811,_0x578e93,_0x4e2bbc){return new BPromise(function(_0x19ab21,_0x44458f){return client['request'](_0x2a5811,_0x4e2bbc)[_0x4023('0xd')](function(_0x4111cd){logger[_0x4023('0xe')](_0x4023('0xf'),_0x578e93,_0x4023('0x10'));logger['debug'](_0x4023('0x11'),_0x578e93,_0x4023('0x10'),JSON['stringify'](_0x4111cd));if(_0x4111cd[_0x4023('0x12')]){if(_0x4111cd[_0x4023('0x12')][_0x4023('0x13')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x578e93,_0x4111cd['error']['message']);return _0x44458f(_0x4111cd['error'][_0x4023('0x14')]);}logger['error'](_0x4023('0xf'),_0x578e93,_0x4111cd[_0x4023('0x12')][_0x4023('0x14')]);return _0x19ab21(_0x4111cd[_0x4023('0x12')]['message']);}else{logger[_0x4023('0xe')](_0x4023('0xf'),_0x578e93,_0x4023('0x10'));_0x19ab21(_0x4111cd[_0x4023('0x15')][_0x4023('0x14')]);}})['catch'](function(_0x12df10){logger['error'](_0x4023('0xf'),_0x578e93,_0x12df10);_0x44458f(_0x12df10);});});} \ No newline at end of file +var _0x86d5=['info','Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x3ef22c,_0x10dea6){var _0x201a9a=function(_0x1dbc50){while(--_0x1dbc50){_0x3ef22c['push'](_0x3ef22c['shift']());}};_0x201a9a(++_0x10dea6);}(_0x86d5,0x128));var _0x586d=function(_0x3464e8,_0x4a208a){_0x3464e8=_0x3464e8-0x0;var _0x4e3dbb=_0x86d5[_0x3464e8];return _0x4e3dbb;};'use strict';var _=require(_0x586d('0x0'));var util=require('util');var moment=require(_0x586d('0x1'));var BPromise=require(_0x586d('0x2'));var rs=require(_0x586d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x586d('0x4'));var logger=require(_0x586d('0x5'))(_0x586d('0x6'));var config=require(_0x586d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x586d('0x8')][_0x586d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6b5f,_0x54e898,_0xe4f238){return new BPromise(function(_0x3fdb2b,_0x388aba){return client[_0x586d('0xa')](_0x2e6b5f,_0xe4f238)[_0x586d('0xb')](function(_0xb14ae8){logger[_0x586d('0xc')](_0x586d('0xd'),_0x54e898,'request\x20sent');logger[_0x586d('0xe')]('Integration,\x20%s,\x20%s,\x20%s',_0x54e898,_0x586d('0xf'),JSON[_0x586d('0x10')](_0xb14ae8));if(_0xb14ae8[_0x586d('0x11')]){if(_0xb14ae8[_0x586d('0x11')][_0x586d('0x12')]===0x1f4){logger[_0x586d('0x11')](_0x586d('0xd'),_0x54e898,_0xb14ae8[_0x586d('0x11')][_0x586d('0x13')]);return _0x388aba(_0xb14ae8['error'][_0x586d('0x13')]);}logger['error'](_0x586d('0xd'),_0x54e898,_0xb14ae8['error'][_0x586d('0x13')]);return _0x3fdb2b(_0xb14ae8[_0x586d('0x11')][_0x586d('0x13')]);}else{logger[_0x586d('0xc')]('Integration,\x20%s,\x20%s',_0x54e898,'request\x20sent');_0x3fdb2b(_0xb14ae8[_0x586d('0x14')][_0x586d('0x13')]);}})[_0x586d('0x15')](function(_0x237c5f){logger[_0x586d('0x11')](_0x586d('0xd'),_0x54e898,_0x237c5f);_0x388aba(_0x237c5f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a55cc36..d5acef9 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 _0x0c4c=['show','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x2faec2,_0xa9b209){var _0x31a6ce=function(_0x39c03d){while(--_0x39c03d){_0x2faec2['push'](_0x2faec2['shift']());}};_0x31a6ce(++_0xa9b209);}(_0x0c4c,0x102));var _0xc0c4=function(_0x2bbb49,_0x13bc74){_0x2bbb49=_0x2bbb49-0x0;var _0x276690=_0x0c4c[_0x2bbb49];return _0x276690;};'use strict';var multer=require(_0xc0c4('0x0'));var util=require(_0xc0c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc0c4('0x2'));var router=express[_0xc0c4('0x3')]();var auth=require(_0xc0c4('0x4'));var interaction=require(_0xc0c4('0x5'));var config=require(_0xc0c4('0x6'));var controller=require(_0xc0c4('0x7'));router[_0xc0c4('0x8')]('/',auth[_0xc0c4('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc0c4('0xa')]);router[_0xc0c4('0x8')](_0xc0c4('0xb'),auth[_0xc0c4('0x9')](),controller[_0xc0c4('0xc')]);router['post']('/',auth[_0xc0c4('0x9')](),controller[_0xc0c4('0xd')]);router[_0xc0c4('0xe')](_0xc0c4('0xb'),auth[_0xc0c4('0x9')](),controller[_0xc0c4('0xf')]);router[_0xc0c4('0x10')]('/:id',auth[_0xc0c4('0x9')](),controller['destroy']);module[_0xc0c4('0x11')]=router; \ No newline at end of file +var _0x9e6c=['./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b7c03,_0x166134){var _0x2bc83f=function(_0x408580){while(--_0x408580){_0x2b7c03['push'](_0x2b7c03['shift']());}};_0x2bc83f(++_0x166134);}(_0x9e6c,0x1d5));var _0xc9e6=function(_0x397a8c,_0x142f55){_0x397a8c=_0x397a8c-0x0;var _0x565aa2=_0x9e6c[_0x397a8c];return _0x565aa2;};'use strict';var multer=require(_0xc9e6('0x0'));var util=require(_0xc9e6('0x1'));var path=require('path');var timeout=require(_0xc9e6('0x2'));var express=require('express');var router=express[_0xc9e6('0x3')]();var auth=require(_0xc9e6('0x4'));var interaction=require(_0xc9e6('0x5'));var config=require('../../config/environment');var controller=require(_0xc9e6('0x6'));router[_0xc9e6('0x7')]('/',auth['isAuthenticated'](),controller[_0xc9e6('0x8')]);router[_0xc9e6('0x7')](_0xc9e6('0x9'),auth[_0xc9e6('0xa')](),controller[_0xc9e6('0xb')]);router['get'](_0xc9e6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc9e6('0xd')]('/',auth[_0xc9e6('0xa')](),controller[_0xc9e6('0xe')]);router[_0xc9e6('0xf')](_0xc9e6('0xc'),auth[_0xc9e6('0xa')](),controller[_0xc9e6('0x10')]);router['delete'](_0xc9e6('0xc'),auth['isAuthenticated'](),controller[_0xc9e6('0x11')]);module[_0xc9e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 971c599..ce79211 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 _0x03b2=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','sequelize','exports'];(function(_0x1a3d11,_0x186bf6){var _0x823d17=function(_0x4cc8c5){while(--_0x4cc8c5){_0x1a3d11['push'](_0x1a3d11['shift']());}};_0x823d17(++_0x186bf6);}(_0x03b2,0x1de));var _0x203b=function(_0x2aa83a,_0x4b5c0b){_0x2aa83a=_0x2aa83a-0x0;var _0x36a653=_0x03b2[_0x2aa83a];return _0x36a653;};'use strict';var Sequelize=require(_0x203b('0x0'));module[_0x203b('0x1')]={'integration':{'type':Sequelize[_0x203b('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x203b('0x2')]},'integrationId':{'type':Sequelize[_0x203b('0x3')]},'contacts':{'type':Sequelize[_0x203b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x203b('0x2')]},'calleridname':{'type':Sequelize[_0x203b('0x2')]},'queue':{'type':Sequelize[_0x203b('0x2')]},'interface':{'type':Sequelize[_0x203b('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x203b('0x4')]},'agentconnectAt':{'type':Sequelize[_0x203b('0x4')]},'holdtime':{'type':Sequelize[_0x203b('0x3')]},'agentcomplete':{'type':Sequelize[_0x203b('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x203b('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x203b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x203b('0x3')]},'reason':{'type':Sequelize[_0x203b('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x203b('0x4')]},'agentdump':{'type':Sequelize[_0x203b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x203b('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x203b('0x2')]},'channelstate':{'type':Sequelize[_0x203b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x203b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x203b('0x2')]},'connectedlinename':{'type':Sequelize[_0x203b('0x2')]},'language':{'type':Sequelize[_0x203b('0x2')]},'accountcode':{'type':Sequelize[_0x203b('0x2')]},'context':{'type':Sequelize[_0x203b('0x2')]},'exten':{'type':Sequelize[_0x203b('0x2')]},'priority':{'type':Sequelize[_0x203b('0x2')]},'destchannel':{'type':Sequelize[_0x203b('0x2')]},'destchannelstate':{'type':Sequelize[_0x203b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x203b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x203b('0x2')]},'destcalleridname':{'type':Sequelize[_0x203b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x203b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x203b('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x203b('0x2')]},'destcontext':{'type':Sequelize[_0x203b('0x2')]},'destexten':{'type':Sequelize[_0x203b('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x203b('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x203b('0x2')]},'subject':{'type':Sequelize[_0x203b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x203b('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x203b('0x6')]},'html':{'type':Sequelize[_0x203b('0x6')]},'text':{'type':Sequelize[_0x203b('0x6')]},'status':{'type':Sequelize[_0x203b('0x7')]('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0x203b('0x2')]},'app':{'type':Sequelize[_0x203b('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x203b('0x3')]}}; \ No newline at end of file +var _0xcdfb=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x59da33,_0x555969){var _0x1da20f=function(_0x3623c7){while(--_0x3623c7){_0x59da33['push'](_0x59da33['shift']());}};_0x1da20f(++_0x555969);}(_0xcdfb,0xfe));var _0xbcdf=function(_0x229992,_0x968621){_0x229992=_0x229992-0x0;var _0x62d9b2=_0xcdfb[_0x229992];return _0x62d9b2;};'use strict';var Sequelize=require('sequelize');module[_0xbcdf('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xbcdf('0x1')]},'ticketId':{'type':Sequelize[_0xbcdf('0x1')]},'integrationId':{'type':Sequelize[_0xbcdf('0x2')]},'contacts':{'type':Sequelize[_0xbcdf('0x1')]},'uniqueid':{'type':Sequelize[_0xbcdf('0x1')]},'calleridnum':{'type':Sequelize[_0xbcdf('0x1')]},'calleridname':{'type':Sequelize[_0xbcdf('0x1')]},'queue':{'type':Sequelize[_0xbcdf('0x1')]},'interface':{'type':Sequelize[_0xbcdf('0x1')]},'membername':{'type':Sequelize[_0xbcdf('0x1')]},'agentcalledAt':{'type':Sequelize[_0xbcdf('0x3')]},'agentconnectAt':{'type':Sequelize[_0xbcdf('0x3')]},'holdtime':{'type':Sequelize[_0xbcdf('0x2')]},'agentcomplete':{'type':Sequelize[_0xbcdf('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xbcdf('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbcdf('0x2')]},'reason':{'type':Sequelize[_0xbcdf('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbcdf('0x3')]},'agentdump':{'type':Sequelize[_0xbcdf('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xbcdf('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbcdf('0x1')]},'connectedlinenum':{'type':Sequelize[_0xbcdf('0x1')]},'connectedlinename':{'type':Sequelize[_0xbcdf('0x1')]},'language':{'type':Sequelize[_0xbcdf('0x1')]},'accountcode':{'type':Sequelize[_0xbcdf('0x1')]},'context':{'type':Sequelize[_0xbcdf('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbcdf('0x1')]},'destchannel':{'type':Sequelize[_0xbcdf('0x1')]},'destchannelstate':{'type':Sequelize[_0xbcdf('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xbcdf('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbcdf('0x1')]},'destcalleridname':{'type':Sequelize[_0xbcdf('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xbcdf('0x1')]},'destlanguage':{'type':Sequelize[_0xbcdf('0x1')]},'destaccountcode':{'type':Sequelize[_0xbcdf('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbcdf('0x1')]},'destpriority':{'type':Sequelize[_0xbcdf('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xbcdf('0x1')]},'inReplyTo':{'type':Sequelize[_0xbcdf('0x1')]},'subject':{'type':Sequelize[_0xbcdf('0x1')]},'from':{'type':Sequelize[_0xbcdf('0x1')]},'to':{'type':Sequelize[_0xbcdf('0x1')]},'cc':{'type':Sequelize[_0xbcdf('0x1')]},'attachment':{'type':Sequelize[_0xbcdf('0x5')]},'html':{'type':Sequelize[_0xbcdf('0x5')]},'text':{'type':Sequelize[_0xbcdf('0x5')]},'status':{'type':Sequelize[_0xbcdf('0x6')](_0xbcdf('0x7'),_0xbcdf('0x8'),_0xbcdf('0x9'),_0xbcdf('0xa'))},'url':{'type':Sequelize[_0xbcdf('0x1')]},'app':{'type':Sequelize[_0xbcdf('0x1')]},'appdata':{'type':Sequelize[_0xbcdf('0x1')]},'projectId':{'type':Sequelize[_0xbcdf('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5fc9282..45f37b5 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 _0x8acb=['request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','error','stack','name','send','IntegrationReport','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','type','key','options','where','count','includeAll','include','rows','catch','show','params','rawAttributes','find','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x10d202,_0x17956c){var _0x568ad6=function(_0x1bdca2){while(--_0x1bdca2){_0x10d202['push'](_0x10d202['shift']());}};_0x568ad6(++_0x17956c);}(_0x8acb,0x1ac));var _0xb8ac=function(_0x20a8f6,_0x4e4479){_0x20a8f6=_0x20a8f6-0x0;var _0x7d544f=_0x8acb[_0x20a8f6];return _0x7d544f;};'use strict';var pdf=require(_0xb8ac('0x0'));var emlformat=require(_0xb8ac('0x1'));var rimraf=require(_0xb8ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8ac('0x3'));var rp=require(_0xb8ac('0x4'));var moment=require(_0xb8ac('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8ac('0x6'));var path=require(_0xb8ac('0x7'));var sox=require(_0xb8ac('0x8'));var csv=require(_0xb8ac('0x9'));var ejs=require(_0xb8ac('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb8ac('0xb'));var crypto=require(_0xb8ac('0xc'));var jsforce=require(_0xb8ac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb8ac('0x9'));var querystring=require(_0xb8ac('0xe'));var Papa=require(_0xb8ac('0xf'));var Redis=require(_0xb8ac('0x10'));var authService=require(_0xb8ac('0x11'));var qs=require(_0xb8ac('0x12'));var hardwareService=require(_0xb8ac('0x13'));var logger=require(_0xb8ac('0x14'))('api');var utils=require(_0xb8ac('0x15'));var config=require(_0xb8ac('0x16'));var db=require(_0xb8ac('0x17'))['db'];function respondWithStatusCode(_0x5d777d,_0x11ec5d){_0x11ec5d=_0x11ec5d||0xcc;return function(_0x4fc176){if(_0x4fc176){return _0x5d777d[_0xb8ac('0x18')](_0x11ec5d);}return _0x5d777d[_0xb8ac('0x19')](_0x11ec5d)[_0xb8ac('0x1a')]();};}function respondWithResult(_0x541280,_0x224f46){_0x224f46=_0x224f46||0xc8;return function(_0x418fe4){if(_0x418fe4){return _0x541280[_0xb8ac('0x19')](_0x224f46)[_0xb8ac('0x1b')](_0x418fe4);}};}function respondWithFilteredResult(_0x3a64ef,_0x57f8f0){return function(_0x11b5cf){if(_0x11b5cf){var _0x1c8803=_0x11b5cf['count'],_0xc25556=_0x57f8f0[_0xb8ac('0x1c')],_0x294f18=_0x57f8f0[_0xb8ac('0x1c')]+_0x57f8f0[_0xb8ac('0x1d')],_0x40830c;if(_0x294f18>=_0x1c8803){_0x294f18=_0x1c8803;_0x40830c=0xc8;}else{_0x40830c=0xce;}_0x3a64ef[_0xb8ac('0x19')](_0x40830c);return _0x3a64ef[_0xb8ac('0x1e')](_0xb8ac('0x1f'),_0xc25556+'-'+_0x294f18+'/'+_0x1c8803)[_0xb8ac('0x1b')](_0x11b5cf);}return null;};}function patchUpdates(_0x2e17c8){return function(_0x7ce33a){try{jsonpatch['apply'](_0x7ce33a,_0x2e17c8,!![]);}catch(_0xd10026){return BPromise[_0xb8ac('0x20')](_0xd10026);}return _0x7ce33a[_0xb8ac('0x21')]();};}function saveUpdates(_0x3fc452,_0x3ec789){return function(_0x1f71ef){if(_0x1f71ef){return _0x1f71ef['update'](_0x3fc452)[_0xb8ac('0x22')](function(_0x4e4470){return _0x4e4470;});}return null;};}function removeEntity(_0x41f371,_0x3adc18){return function(_0x436df2){if(_0x436df2){return _0x436df2['destroy']()[_0xb8ac('0x22')](function(){_0x41f371[_0xb8ac('0x19')](0xcc)[_0xb8ac('0x1a')]();});}};}function handleEntityNotFound(_0x4c9b6d,_0x3f5b2e){return function(_0x38ec76){if(!_0x38ec76){_0x4c9b6d[_0xb8ac('0x18')](0x194);}return _0x38ec76;};}function handleError(_0x31becf,_0x3fa34a){_0x3fa34a=_0x3fa34a||0x1f4;return function(_0x19d701){logger[_0xb8ac('0x23')](_0x19d701[_0xb8ac('0x24')]);if(_0x19d701[_0xb8ac('0x25')]){delete _0x19d701['name'];}_0x31becf['status'](_0x3fa34a)[_0xb8ac('0x26')](_0x19d701);};}exports['index']=function(_0x37824e,_0x21024e){var _0x5aad1f={},_0x5fd7c9={},_0x31ea9f={'count':0x0,'rows':[]};var _0xc96ced=db[_0xb8ac('0x27')]['rawAttributes'];_0x5fd7c9['model']=_[_0xb8ac('0x28')](_0xc96ced);_0x5fd7c9[_0xb8ac('0x29')]=_['keys'](_0x37824e[_0xb8ac('0x29')]);_0x5fd7c9[_0xb8ac('0x2a')]=_[_0xb8ac('0x2b')](_0x5fd7c9[_0xb8ac('0x2c')],_0x5fd7c9['query']);_0x5aad1f[_0xb8ac('0x2d')]=_[_0xb8ac('0x2b')](_0x5fd7c9[_0xb8ac('0x2c')],qs[_0xb8ac('0x2e')](_0x37824e['query'][_0xb8ac('0x2e')]));_0x5aad1f[_0xb8ac('0x2d')]=_0x5aad1f[_0xb8ac('0x2d')][_0xb8ac('0x2f')]?_0x5aad1f['attributes']:_0x5fd7c9[_0xb8ac('0x2c')];if(!_0x37824e[_0xb8ac('0x29')][_0xb8ac('0x30')](_0xb8ac('0x31'))){_0x5aad1f['limit']=qs[_0xb8ac('0x1d')](_0x37824e['query'][_0xb8ac('0x1d')]);_0x5aad1f[_0xb8ac('0x1c')]=qs[_0xb8ac('0x1c')](_0x37824e[_0xb8ac('0x29')]['offset']);}_0x5aad1f[_0xb8ac('0x32')]=qs[_0xb8ac('0x33')](_0x37824e['query'][_0xb8ac('0x33')]);_0x5aad1f['where']=qs[_0xb8ac('0x2a')](_[_0xb8ac('0x34')](_0x37824e[_0xb8ac('0x29')],_0x5fd7c9['filters']));if(_0x37824e[_0xb8ac('0x29')][_0xb8ac('0x35')]){_0x5aad1f['where']=_[_0xb8ac('0x36')](_0x5aad1f['where'],{'$or':_[_0xb8ac('0x37')](_0xc96ced,function(_0x1cce96){if(_0x1cce96[_0xb8ac('0x38')][_0xb8ac('0x39')]!=='VIRTUAL'){var _0x4d1520={};_0x4d1520[_0x1cce96['field']]={'$like':'%'+_0x37824e[_0xb8ac('0x29')][_0xb8ac('0x35')]+'%'};return _0x4d1520;}})});}_0x5aad1f=_['merge']({},_0x5aad1f,_0x37824e[_0xb8ac('0x3a')]);var _0x2e4947={'where':_0x5aad1f[_0xb8ac('0x3b')]};return db[_0xb8ac('0x27')]['count'](_0x2e4947)[_0xb8ac('0x22')](function(_0x2163d1){_0x31ea9f[_0xb8ac('0x3c')]=_0x2163d1;if(_0x37824e[_0xb8ac('0x29')][_0xb8ac('0x3d')]){_0x5aad1f[_0xb8ac('0x3e')]=[{'all':!![]}];}return db[_0xb8ac('0x27')]['findAll'](_0x5aad1f);})[_0xb8ac('0x22')](function(_0x1fc7eb){_0x31ea9f[_0xb8ac('0x3f')]=_0x1fc7eb;return _0x31ea9f;})['then'](respondWithFilteredResult(_0x21024e,_0x5aad1f))[_0xb8ac('0x40')](handleError(_0x21024e,null));};exports[_0xb8ac('0x41')]=function(_0x12d5bb,_0xc87319){var _0x519ec8={'raw':![],'where':{'id':_0x12d5bb[_0xb8ac('0x42')]['id']}},_0x366acf={};_0x366acf[_0xb8ac('0x2c')]=_[_0xb8ac('0x28')](db[_0xb8ac('0x27')][_0xb8ac('0x43')]);_0x366acf[_0xb8ac('0x29')]=_[_0xb8ac('0x28')](_0x12d5bb[_0xb8ac('0x29')]);_0x366acf[_0xb8ac('0x2a')]=_[_0xb8ac('0x2b')](_0x366acf[_0xb8ac('0x2c')],_0x366acf[_0xb8ac('0x29')]);_0x519ec8[_0xb8ac('0x2d')]=_[_0xb8ac('0x2b')](_0x366acf[_0xb8ac('0x2c')],qs['fields'](_0x12d5bb[_0xb8ac('0x29')][_0xb8ac('0x2e')]));_0x519ec8[_0xb8ac('0x2d')]=_0x519ec8['attributes'][_0xb8ac('0x2f')]?_0x519ec8[_0xb8ac('0x2d')]:_0x366acf[_0xb8ac('0x2c')];if(_0x12d5bb[_0xb8ac('0x29')][_0xb8ac('0x3d')]){_0x519ec8['include']=[{'all':!![]}];}_0x519ec8=_['merge']({},_0x519ec8,_0x12d5bb[_0xb8ac('0x3a')]);return db['IntegrationReport'][_0xb8ac('0x44')](_0x519ec8)['then'](handleEntityNotFound(_0xc87319,null))[_0xb8ac('0x22')](respondWithResult(_0xc87319,null))[_0xb8ac('0x40')](handleError(_0xc87319,null));};exports['create']=function(_0x159836,_0x43a32e){return db[_0xb8ac('0x27')]['create'](_0x159836[_0xb8ac('0x45')],{})[_0xb8ac('0x22')](respondWithResult(_0x43a32e,0xc9))[_0xb8ac('0x40')](handleError(_0x43a32e,null));};exports[_0xb8ac('0x46')]=function(_0x442025,_0x57354f){if(_0x442025['body']['id']){delete _0x442025[_0xb8ac('0x45')]['id'];}return db[_0xb8ac('0x27')][_0xb8ac('0x44')]({'where':{'id':_0x442025['params']['id']}})[_0xb8ac('0x22')](handleEntityNotFound(_0x57354f,null))[_0xb8ac('0x22')](saveUpdates(_0x442025[_0xb8ac('0x45')],null))[_0xb8ac('0x22')](respondWithResult(_0x57354f,null))[_0xb8ac('0x40')](handleError(_0x57354f,null));};exports['destroy']=function(_0x3a1699,_0x20a959){return db[_0xb8ac('0x27')][_0xb8ac('0x44')]({'where':{'id':_0x3a1699['params']['id']}})[_0xb8ac('0x22')](handleEntityNotFound(_0x20a959,null))[_0xb8ac('0x22')](removeEntity(_0x20a959,null))[_0xb8ac('0x40')](handleError(_0x20a959,null));};exports[_0xb8ac('0x47')]=function(_0x396dcd,_0x5c98d9){return db[_0xb8ac('0x27')][_0xb8ac('0x47')]()[_0xb8ac('0x22')](respondWithResult(_0x5c98d9,null))[_0xb8ac('0x40')](handleError(_0x5c98d9,null));}; \ No newline at end of file +var _0x1e6e=['rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','IntegrationReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll'];(function(_0x43b145,_0x334544){var _0x4b80ec=function(_0x3af778){while(--_0x3af778){_0x43b145['push'](_0x43b145['shift']());}};_0x4b80ec(++_0x334544);}(_0x1e6e,0xe6));var _0xe1e6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x1e6e[_0x1589dd];return _0x1bddd1;};'use strict';var pdf=require(_0xe1e6('0x0'));var emlformat=require(_0xe1e6('0x1'));var rimraf=require(_0xe1e6('0x2'));var zipdir=require(_0xe1e6('0x3'));var jsonpatch=require(_0xe1e6('0x4'));var rp=require('request-promise');var moment=require(_0xe1e6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1e6('0x6'));var path=require(_0xe1e6('0x7'));var sox=require(_0xe1e6('0x8'));var csv=require(_0xe1e6('0x9'));var ejs=require(_0xe1e6('0xa'));var fs=require('fs');var _=require(_0xe1e6('0xb'));var squel=require(_0xe1e6('0xc'));var crypto=require('crypto');var jsforce=require(_0xe1e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe1e6('0x9'));var querystring=require(_0xe1e6('0xe'));var Papa=require(_0xe1e6('0xf'));var Redis=require(_0xe1e6('0x10'));var authService=require(_0xe1e6('0x11'));var qs=require(_0xe1e6('0x12'));var hardwareService=require(_0xe1e6('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe1e6('0x14'));var db=require(_0xe1e6('0x15'))['db'];function respondWithStatusCode(_0x4ec6e7,_0x2a52d1){_0x2a52d1=_0x2a52d1||0xcc;return function(_0xccf9d1){if(_0xccf9d1){return _0x4ec6e7[_0xe1e6('0x16')](_0x2a52d1);}return _0x4ec6e7[_0xe1e6('0x17')](_0x2a52d1)[_0xe1e6('0x18')]();};}function respondWithResult(_0x89ca6,_0x372360){_0x372360=_0x372360||0xc8;return function(_0x40bd0f){if(_0x40bd0f){return _0x89ca6['status'](_0x372360)[_0xe1e6('0x19')](_0x40bd0f);}};}function respondWithFilteredResult(_0x34a121,_0x580b4c){return function(_0x510f02){if(_0x510f02){var _0x305c94=_0x510f02[_0xe1e6('0x1a')],_0x52cdc8=_0x580b4c[_0xe1e6('0x1b')],_0x225f8e=_0x580b4c[_0xe1e6('0x1b')]+_0x580b4c[_0xe1e6('0x1c')],_0x4a9158;if(_0x225f8e>=_0x305c94){_0x225f8e=_0x305c94;_0x4a9158=0xc8;}else{_0x4a9158=0xce;}_0x34a121[_0xe1e6('0x17')](_0x4a9158);return _0x34a121[_0xe1e6('0x1d')](_0xe1e6('0x1e'),_0x52cdc8+'-'+_0x225f8e+'/'+_0x305c94)['json'](_0x510f02);}return null;};}function patchUpdates(_0x2ab7db){return function(_0x2026b3){try{jsonpatch[_0xe1e6('0x1f')](_0x2026b3,_0x2ab7db,!![]);}catch(_0x36f2ed){return BPromise[_0xe1e6('0x20')](_0x36f2ed);}return _0x2026b3[_0xe1e6('0x21')]();};}function saveUpdates(_0x5e18ff,_0x4eb89b){return function(_0x279019){if(_0x279019){return _0x279019[_0xe1e6('0x22')](_0x5e18ff)[_0xe1e6('0x23')](function(_0x4772fb){return _0x4772fb;});}return null;};}function removeEntity(_0xfcc7b,_0x1e93b5){return function(_0x735dd4){if(_0x735dd4){return _0x735dd4[_0xe1e6('0x24')]()[_0xe1e6('0x23')](function(){_0xfcc7b[_0xe1e6('0x17')](0xcc)[_0xe1e6('0x18')]();});}};}function handleEntityNotFound(_0x5b8573,_0x2f4032){return function(_0x1dad52){if(!_0x1dad52){_0x5b8573[_0xe1e6('0x16')](0x194);}return _0x1dad52;};}function handleError(_0x445688,_0x3e0110){_0x3e0110=_0x3e0110||0x1f4;return function(_0x3a0904){logger[_0xe1e6('0x25')](_0x3a0904[_0xe1e6('0x26')]);if(_0x3a0904[_0xe1e6('0x27')]){delete _0x3a0904[_0xe1e6('0x27')];}_0x445688[_0xe1e6('0x17')](_0x3e0110)['send'](_0x3a0904);};}exports[_0xe1e6('0x28')]=function(_0x186098,_0x46aa15){var _0x226bd2={},_0x398269={},_0x164b3a={'count':0x0,'rows':[]};var _0x2b6b76=db[_0xe1e6('0x29')]['rawAttributes'];_0x398269[_0xe1e6('0x2a')]=_[_0xe1e6('0x2b')](_0x2b6b76);_0x398269[_0xe1e6('0x2c')]=_[_0xe1e6('0x2b')](_0x186098[_0xe1e6('0x2c')]);_0x398269[_0xe1e6('0x2d')]=_[_0xe1e6('0x2e')](_0x398269['model'],_0x398269[_0xe1e6('0x2c')]);_0x226bd2[_0xe1e6('0x2f')]=_['intersection'](_0x398269['model'],qs[_0xe1e6('0x30')](_0x186098[_0xe1e6('0x2c')][_0xe1e6('0x30')]));_0x226bd2['attributes']=_0x226bd2[_0xe1e6('0x2f')][_0xe1e6('0x31')]?_0x226bd2[_0xe1e6('0x2f')]:_0x398269['model'];if(!_0x186098[_0xe1e6('0x2c')][_0xe1e6('0x32')](_0xe1e6('0x33'))){_0x226bd2[_0xe1e6('0x1c')]=qs[_0xe1e6('0x1c')](_0x186098[_0xe1e6('0x2c')][_0xe1e6('0x1c')]);_0x226bd2[_0xe1e6('0x1b')]=qs['offset'](_0x186098[_0xe1e6('0x2c')][_0xe1e6('0x1b')]);}_0x226bd2['order']=qs[_0xe1e6('0x34')](_0x186098[_0xe1e6('0x2c')]['sort']);_0x226bd2[_0xe1e6('0x35')]=qs[_0xe1e6('0x2d')](_[_0xe1e6('0x36')](_0x186098[_0xe1e6('0x2c')],_0x398269[_0xe1e6('0x2d')]));if(_0x186098[_0xe1e6('0x2c')][_0xe1e6('0x37')]){_0x226bd2[_0xe1e6('0x35')]=_[_0xe1e6('0x38')](_0x226bd2[_0xe1e6('0x35')],{'$or':_[_0xe1e6('0x39')](_0x2b6b76,function(_0x1406dc){if(_0x1406dc[_0xe1e6('0x3a')][_0xe1e6('0x3b')]!==_0xe1e6('0x3c')){var _0x54a9e9={};_0x54a9e9[_0x1406dc[_0xe1e6('0x3d')]]={'$like':'%'+_0x186098['query'][_0xe1e6('0x37')]+'%'};return _0x54a9e9;}})});}_0x226bd2=_[_0xe1e6('0x38')]({},_0x226bd2,_0x186098[_0xe1e6('0x3e')]);var _0x2c1e0a={'where':_0x226bd2[_0xe1e6('0x35')]};return db[_0xe1e6('0x29')][_0xe1e6('0x1a')](_0x2c1e0a)['then'](function(_0x1dbe2b){_0x164b3a[_0xe1e6('0x1a')]=_0x1dbe2b;if(_0x186098[_0xe1e6('0x2c')][_0xe1e6('0x3f')]){_0x226bd2[_0xe1e6('0x40')]=[{'all':!![]}];}return db[_0xe1e6('0x29')][_0xe1e6('0x41')](_0x226bd2);})[_0xe1e6('0x23')](function(_0x4baf27){_0x164b3a[_0xe1e6('0x42')]=_0x4baf27;return _0x164b3a;})[_0xe1e6('0x23')](respondWithFilteredResult(_0x46aa15,_0x226bd2))[_0xe1e6('0x43')](handleError(_0x46aa15,null));};exports[_0xe1e6('0x44')]=function(_0x594b58,_0x3fb840){var _0x26551e={'raw':![],'where':{'id':_0x594b58[_0xe1e6('0x45')]['id']}},_0x3ed4b6={};_0x3ed4b6['model']=_[_0xe1e6('0x2b')](db[_0xe1e6('0x29')]['rawAttributes']);_0x3ed4b6['query']=_[_0xe1e6('0x2b')](_0x594b58[_0xe1e6('0x2c')]);_0x3ed4b6['filters']=_['intersection'](_0x3ed4b6['model'],_0x3ed4b6[_0xe1e6('0x2c')]);_0x26551e[_0xe1e6('0x2f')]=_[_0xe1e6('0x2e')](_0x3ed4b6['model'],qs[_0xe1e6('0x30')](_0x594b58[_0xe1e6('0x2c')][_0xe1e6('0x30')]));_0x26551e[_0xe1e6('0x2f')]=_0x26551e['attributes'][_0xe1e6('0x31')]?_0x26551e[_0xe1e6('0x2f')]:_0x3ed4b6[_0xe1e6('0x2a')];if(_0x594b58['query'][_0xe1e6('0x3f')]){_0x26551e[_0xe1e6('0x40')]=[{'all':!![]}];}_0x26551e=_[_0xe1e6('0x38')]({},_0x26551e,_0x594b58[_0xe1e6('0x3e')]);return db[_0xe1e6('0x29')][_0xe1e6('0x46')](_0x26551e)[_0xe1e6('0x23')](handleEntityNotFound(_0x3fb840,null))['then'](respondWithResult(_0x3fb840,null))[_0xe1e6('0x43')](handleError(_0x3fb840,null));};exports[_0xe1e6('0x47')]=function(_0x2d63fa,_0xa2f5ac){return db[_0xe1e6('0x29')][_0xe1e6('0x47')](_0x2d63fa['body'],{})[_0xe1e6('0x23')](respondWithResult(_0xa2f5ac,0xc9))[_0xe1e6('0x43')](handleError(_0xa2f5ac,null));};exports[_0xe1e6('0x22')]=function(_0x5c3cca,_0x21495e){if(_0x5c3cca[_0xe1e6('0x48')]['id']){delete _0x5c3cca[_0xe1e6('0x48')]['id'];}return db[_0xe1e6('0x29')][_0xe1e6('0x46')]({'where':{'id':_0x5c3cca[_0xe1e6('0x45')]['id']}})[_0xe1e6('0x23')](handleEntityNotFound(_0x21495e,null))[_0xe1e6('0x23')](saveUpdates(_0x5c3cca[_0xe1e6('0x48')],null))[_0xe1e6('0x23')](respondWithResult(_0x21495e,null))[_0xe1e6('0x43')](handleError(_0x21495e,null));};exports[_0xe1e6('0x24')]=function(_0x1b8753,_0x378dd9){return db[_0xe1e6('0x29')][_0xe1e6('0x46')]({'where':{'id':_0x1b8753['params']['id']}})[_0xe1e6('0x23')](handleEntityNotFound(_0x378dd9,null))['then'](removeEntity(_0x378dd9,null))[_0xe1e6('0x43')](handleError(_0x378dd9,null));};exports['describe']=function(_0x39f717,_0x29c9df){return db[_0xe1e6('0x29')][_0xe1e6('0x49')]()[_0xe1e6('0x23')](respondWithResult(_0x29c9df,null))[_0xe1e6('0x43')](handleError(_0x29c9df,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 293e334..6032875 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 _0x7217=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'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 +var _0x04de=['./integrationReport.attributes','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x04de,0x107));var _0xe04d=function(_0x533aa0,_0x36167e){_0x533aa0=_0x533aa0-0x0;var _0x1fc20c=_0x04de[_0x533aa0];return _0x1fc20c;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var logger=require(_0xe04d('0x2'))(_0xe04d('0x3'));var moment=require(_0xe04d('0x4'));var BPromise=require(_0xe04d('0x5'));var rp=require(_0xe04d('0x6'));var fs=require('fs');var path=require(_0xe04d('0x7'));var rimraf=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var attributes=require(_0xe04d('0xa'));module['exports']=function(_0x4bb925,_0x4f7637){return _0x4bb925['define'](_0xe04d('0xb'),attributes,{'tableName':_0xe04d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 5ee36bb..b35ffdb 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 _0x3f26=['then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39b38f,_0x1e050d){var _0x3cb6e4=function(_0x2bdd30){while(--_0x2bdd30){_0x39b38f['push'](_0x39b38f['shift']());}};_0x3cb6e4(++_0x1e050d);}(_0x3f26,0x78));var _0x63f2=function(_0x429edc,_0x2133d8){_0x429edc=_0x429edc-0x0;var _0x2c5642=_0x3f26[_0x429edc];return _0x2c5642;};'use strict';var _=require(_0x63f2('0x0'));var util=require('util');var moment=require(_0x63f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x63f2('0x2'));var fs=require('fs');var Redis=require(_0x63f2('0x3'));var db=require(_0x63f2('0x4'))['db'];var utils=require(_0x63f2('0x5'));var logger=require(_0x63f2('0x6'))(_0x63f2('0x7'));var config=require(_0x63f2('0x8'));var jayson=require(_0x63f2('0x9'));var client=jayson[_0x63f2('0xa')][_0x63f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29dbf8,_0x471603,_0x1dbc5d){return new BPromise(function(_0x1e9022,_0x8047b5){return client['request'](_0x29dbf8,_0x1dbc5d)[_0x63f2('0xc')](function(_0x572022){logger[_0x63f2('0xd')](_0x63f2('0xe'),_0x471603,'request\x20sent');logger[_0x63f2('0xf')](_0x63f2('0x10'),_0x471603,_0x63f2('0x11'),JSON['stringify'](_0x572022));if(_0x572022['error']){if(_0x572022[_0x63f2('0x12')][_0x63f2('0x13')]===0x1f4){logger['error'](_0x63f2('0xe'),_0x471603,_0x572022[_0x63f2('0x12')]['message']);return _0x8047b5(_0x572022[_0x63f2('0x12')][_0x63f2('0x14')]);}logger[_0x63f2('0x12')](_0x63f2('0xe'),_0x471603,_0x572022['error']['message']);return _0x1e9022(_0x572022[_0x63f2('0x12')]['message']);}else{logger[_0x63f2('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x471603,_0x63f2('0x11'));_0x1e9022(_0x572022['result'][_0x63f2('0x14')]);}})[_0x63f2('0x15')](function(_0x14e8b3){logger[_0x63f2('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x471603,_0x14e8b3);_0x8047b5(_0x14e8b3);});});} \ No newline at end of file +var _0xad9c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash'];(function(_0x3512c9,_0x4172f6){var _0x1f725d=function(_0x3527a3){while(--_0x3527a3){_0x3512c9['push'](_0x3512c9['shift']());}};_0x1f725d(++_0x4172f6);}(_0xad9c,0x1e2));var _0xcad9=function(_0xa0ea1c,_0x1398ea){_0xa0ea1c=_0xa0ea1c-0x0;var _0x1854e2=_0xad9c[_0xa0ea1c];return _0x1854e2;};'use strict';var _=require(_0xcad9('0x0'));var util=require(_0xcad9('0x1'));var moment=require(_0xcad9('0x2'));var BPromise=require(_0xcad9('0x3'));var rs=require(_0xcad9('0x4'));var fs=require('fs');var Redis=require(_0xcad9('0x5'));var db=require(_0xcad9('0x6'))['db'];var utils=require(_0xcad9('0x7'));var logger=require(_0xcad9('0x8'))(_0xcad9('0x9'));var config=require(_0xcad9('0xa'));var jayson=require(_0xcad9('0xb'));var client=jayson[_0xcad9('0xc')][_0xcad9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5d6a2b,_0x595442,_0x174b2b){return new BPromise(function(_0xfb51aa,_0x28c9d3){return client[_0xcad9('0xe')](_0x5d6a2b,_0x174b2b)[_0xcad9('0xf')](function(_0xb2c9c2){logger['info'](_0xcad9('0x10'),_0x595442,_0xcad9('0x11'));logger['debug'](_0xcad9('0x12'),_0x595442,'request\x20sent',JSON['stringify'](_0xb2c9c2));if(_0xb2c9c2[_0xcad9('0x13')]){if(_0xb2c9c2[_0xcad9('0x13')][_0xcad9('0x14')]===0x1f4){logger['error'](_0xcad9('0x10'),_0x595442,_0xb2c9c2[_0xcad9('0x13')]['message']);return _0x28c9d3(_0xb2c9c2['error']['message']);}logger[_0xcad9('0x13')](_0xcad9('0x10'),_0x595442,_0xb2c9c2[_0xcad9('0x13')][_0xcad9('0x15')]);return _0xfb51aa(_0xb2c9c2[_0xcad9('0x13')]['message']);}else{logger[_0xcad9('0x16')]('IntegrationReport,\x20%s,\x20%s',_0x595442,_0xcad9('0x11'));_0xfb51aa(_0xb2c9c2['result'][_0xcad9('0x15')]);}})['catch'](function(_0x5b8c58){logger[_0xcad9('0x13')](_0xcad9('0x10'),_0x595442,_0x5b8c58);_0x28c9d3(_0x5b8c58);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d4f6d49..61f4540 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 _0xd06f=['isAuthenticated','index','get','/:id','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x2ced00,_0x37ea1d){var _0x485e77=function(_0x368723){while(--_0x368723){_0x2ced00['push'](_0x2ced00['shift']());}};_0x485e77(++_0x37ea1d);}(_0xd06f,0x13c));var _0xfd06=function(_0x386bf3,_0x39de2f){_0x386bf3=_0x386bf3-0x0;var _0x4e8eb5=_0xd06f[_0x386bf3];return _0x4e8eb5;};'use strict';var multer=require(_0xfd06('0x0'));var util=require(_0xfd06('0x1'));var path=require('path');var timeout=require(_0xfd06('0x2'));var express=require(_0xfd06('0x3'));var router=express[_0xfd06('0x4')]();var auth=require(_0xfd06('0x5'));var interaction=require(_0xfd06('0x6'));var config=require(_0xfd06('0x7'));var controller=require(_0xfd06('0x8'));router['get']('/',auth[_0xfd06('0x9')](),controller[_0xfd06('0xa')]);router[_0xfd06('0xb')](_0xfd06('0xc'),auth[_0xfd06('0x9')](),controller[_0xfd06('0xd')]);router['get']('/:id/sub_intervals',auth[_0xfd06('0x9')](),controller[_0xfd06('0xe')]);router[_0xfd06('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd06('0x10')]);router[_0xfd06('0xf')](_0xfd06('0x11'),auth[_0xfd06('0x9')](),controller[_0xfd06('0x12')]);router['post'](_0xfd06('0x13'),auth[_0xfd06('0x9')](),controller[_0xfd06('0x14')]);router[_0xfd06('0x15')](_0xfd06('0xc'),auth[_0xfd06('0x9')](),controller[_0xfd06('0x16')]);router[_0xfd06('0x17')](_0xfd06('0xc'),auth[_0xfd06('0x9')](),controller[_0xfd06('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8a2=['addInterval','addIntervals','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','get','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xd8a2,0x128));var _0x2d8a=function(_0x23844d,_0x10eccb){_0x23844d=_0x23844d-0x0;var _0x51010d=_0xd8a2[_0x23844d];return _0x51010d;};'use strict';var multer=require(_0x2d8a('0x0'));var util=require(_0x2d8a('0x1'));var path=require(_0x2d8a('0x2'));var timeout=require(_0x2d8a('0x3'));var express=require(_0x2d8a('0x4'));var router=express[_0x2d8a('0x5')]();var auth=require(_0x2d8a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d8a('0x7'));var controller=require(_0x2d8a('0x8'));router['get']('/',auth[_0x2d8a('0x9')](),controller['index']);router[_0x2d8a('0xa')]('/:id',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xb')]);router[_0x2d8a('0xa')](_0x2d8a('0xc'),auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xd')]);router[_0x2d8a('0xe')]('/',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0xf')]);router[_0x2d8a('0xe')](_0x2d8a('0xc'),auth['isAuthenticated'](),controller[_0x2d8a('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0x2d8a('0x9')](),controller[_0x2d8a('0x11')]);router[_0x2d8a('0x12')](_0x2d8a('0x13'),auth[_0x2d8a('0x9')](),controller[_0x2d8a('0x14')]);router[_0x2d8a('0x15')](_0x2d8a('0x13'),auth[_0x2d8a('0x9')](),controller[_0x2d8a('0x16')]);module[_0x2d8a('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b9b5934..3c67f48 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 _0xcb07=['exports','STRING','sequelize'];(function(_0x2cda85,_0x2be174){var _0x2705dc=function(_0x2bf7d4){while(--_0x2bf7d4){_0x2cda85['push'](_0x2cda85['shift']());}};_0x2705dc(++_0x2be174);}(_0xcb07,0x98));var _0x7cb0=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xcb07[_0x154983];return _0x3d1243;};'use strict';var Sequelize=require(_0x7cb0('0x0'));module[_0x7cb0('0x1')]={'name':{'type':Sequelize[_0x7cb0('0x2')]},'description':{'type':Sequelize[_0x7cb0('0x2')]},'interval':{'type':Sequelize[_0x7cb0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x76d8=['exports','STRING','sequelize'];(function(_0x4bfbd3,_0x3578d1){var _0x171b82=function(_0x4e649d){while(--_0x4e649d){_0x4bfbd3['push'](_0x4bfbd3['shift']());}};_0x171b82(++_0x3578d1);}(_0x76d8,0x107));var _0x876d=function(_0x3af74b,_0x38b611){_0x3af74b=_0x3af74b-0x0;var _0x2ebbe7=_0x76d8[_0x3af74b];return _0x2ebbe7;};'use strict';var Sequelize=require(_0x876d('0x0'));module[_0x876d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x876d('0x2')]},'interval':{'type':Sequelize[_0x876d('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 c7a22f9..c9d886f 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 _0xd0f4=['then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','Interval','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','map','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','body','IntervalId','getIntervals','findOne','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x5e8917,_0x658bc){var _0x761061=function(_0x3fef40){while(--_0x3fef40){_0x5e8917['push'](_0x5e8917['shift']());}};_0x761061(++_0x658bc);}(_0xd0f4,0x1db));var _0x4d0f=function(_0x56c540,_0x3ca49c){_0x56c540=_0x56c540-0x0;var _0x1ee77c=_0xd0f4[_0x56c540];return _0x1ee77c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4d0f('0x0'));var rimraf=require(_0x4d0f('0x1'));var zipdir=require(_0x4d0f('0x2'));var jsonpatch=require(_0x4d0f('0x3'));var rp=require(_0x4d0f('0x4'));var moment=require(_0x4d0f('0x5'));var BPromise=require(_0x4d0f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d0f('0x7'));var sox=require(_0x4d0f('0x8'));var csv=require(_0x4d0f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d0f('0xa'));var squel=require(_0x4d0f('0xb'));var crypto=require(_0x4d0f('0xc'));var jsforce=require(_0x4d0f('0xd'));var deskjs=require(_0x4d0f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4d0f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4d0f('0x10'));var qs=require(_0x4d0f('0x11'));var hardwareService=require(_0x4d0f('0x12'));var logger=require('../../config/logger')(_0x4d0f('0x13'));var utils=require('../../config/utils');var config=require(_0x4d0f('0x14'));var db=require(_0x4d0f('0x15'))['db'];var extensions=require(_0x4d0f('0x16'));function respondWithStatusCode(_0x397fba,_0x5d92e5){_0x5d92e5=_0x5d92e5||0xcc;return function(_0x11b96d){if(_0x11b96d){return _0x397fba[_0x4d0f('0x17')](_0x5d92e5);}return _0x397fba[_0x4d0f('0x18')](_0x5d92e5)[_0x4d0f('0x19')]();};}function respondWithResult(_0x35add8,_0xd330e8){_0xd330e8=_0xd330e8||0xc8;return function(_0x2ed41f){if(_0x2ed41f){return _0x35add8['status'](_0xd330e8)[_0x4d0f('0x1a')](_0x2ed41f);}};}function respondWithFilteredResult(_0x2d6a02,_0x200c54){return function(_0x1506a4){if(_0x1506a4){var _0x1450a7=_0x1506a4[_0x4d0f('0x1b')],_0x534369=_0x200c54[_0x4d0f('0x1c')],_0x59f86d=_0x200c54[_0x4d0f('0x1c')]+_0x200c54[_0x4d0f('0x1d')],_0x1d5835;if(_0x59f86d>=_0x1450a7){_0x59f86d=_0x1450a7;_0x1d5835=0xc8;}else{_0x1d5835=0xce;}_0x2d6a02[_0x4d0f('0x18')](_0x1d5835);return _0x2d6a02[_0x4d0f('0x1e')](_0x4d0f('0x1f'),_0x534369+'-'+_0x59f86d+'/'+_0x1450a7)[_0x4d0f('0x1a')](_0x1506a4);}return null;};}function patchUpdates(_0x5385bf){return function(_0x201deb){try{jsonpatch['apply'](_0x201deb,_0x5385bf,!![]);}catch(_0x19a03f){return BPromise[_0x4d0f('0x20')](_0x19a03f);}return _0x201deb[_0x4d0f('0x21')]();};}function saveUpdates(_0xf58930,_0x3591a4){return function(_0x423e21){if(_0x423e21){return _0x423e21[_0x4d0f('0x22')](_0xf58930)[_0x4d0f('0x23')](function(_0x5041de){return _0x5041de;});}return null;};}function removeEntity(_0x1e8af0,_0xba8f84){return function(_0x1984a5){if(_0x1984a5){return _0x1984a5[_0x4d0f('0x24')]()[_0x4d0f('0x23')](function(){var _0x3a9de7=_0x1984a5[_0x4d0f('0x25')]({'plain':!![]});var _0x232618=_0x4d0f('0x26');return db[_0x4d0f('0x27')][_0x4d0f('0x24')]({'where':{'type':_0x232618,'resourceId':_0x3a9de7['id']}})[_0x4d0f('0x23')](function(){return _0x1984a5;});})['then'](function(){_0x1e8af0['status'](0xcc)[_0x4d0f('0x19')]();});}};}function handleEntityNotFound(_0x12efb8,_0x57faa5){return function(_0x1aa5be){if(!_0x1aa5be){_0x12efb8[_0x4d0f('0x17')](0x194);}return _0x1aa5be;};}function handleError(_0x53aedd,_0x1be113){_0x1be113=_0x1be113||0x1f4;return function(_0x24e8e9){logger[_0x4d0f('0x28')](_0x24e8e9[_0x4d0f('0x29')]);if(_0x24e8e9[_0x4d0f('0x2a')]){delete _0x24e8e9[_0x4d0f('0x2a')];}_0x53aedd[_0x4d0f('0x18')](_0x1be113)['send'](_0x24e8e9);};}exports[_0x4d0f('0x2b')]=function(_0xa54211,_0x19368e){var _0x56b70c={},_0x533b6d={},_0x590202={'count':0x0,'rows':[]};var _0xdbcb5f=db[_0x4d0f('0x2c')][_0x4d0f('0x2d')];_0x533b6d[_0x4d0f('0x2e')]=_[_0x4d0f('0x2f')](_0xdbcb5f);_0x533b6d[_0x4d0f('0x30')]=_[_0x4d0f('0x2f')](_0xa54211[_0x4d0f('0x30')]);_0x533b6d['filters']=_[_0x4d0f('0x31')](_0x533b6d[_0x4d0f('0x2e')],_0x533b6d['query']);_0x56b70c[_0x4d0f('0x32')]=_['intersection'](_0x533b6d['model'],qs[_0x4d0f('0x33')](_0xa54211['query'][_0x4d0f('0x33')]));_0x56b70c['attributes']=_0x56b70c[_0x4d0f('0x32')][_0x4d0f('0x34')]?_0x56b70c['attributes']:_0x533b6d[_0x4d0f('0x2e')];if(!_0xa54211[_0x4d0f('0x30')][_0x4d0f('0x35')](_0x4d0f('0x36'))){_0x56b70c[_0x4d0f('0x1d')]=qs[_0x4d0f('0x1d')](_0xa54211[_0x4d0f('0x30')][_0x4d0f('0x1d')]);_0x56b70c[_0x4d0f('0x1c')]=qs[_0x4d0f('0x1c')](_0xa54211[_0x4d0f('0x30')][_0x4d0f('0x1c')]);}_0x56b70c[_0x4d0f('0x37')]=qs[_0x4d0f('0x38')](_0xa54211['query'][_0x4d0f('0x38')]);_0x56b70c[_0x4d0f('0x39')]=qs['filters'](_[_0x4d0f('0x3a')](_0xa54211[_0x4d0f('0x30')],_0x533b6d[_0x4d0f('0x3b')]));if(_0xa54211[_0x4d0f('0x30')]['filter']){_0x56b70c[_0x4d0f('0x39')]=_[_0x4d0f('0x3c')](_0x56b70c[_0x4d0f('0x39')],{'$or':_[_0x4d0f('0x3d')](_0xdbcb5f,function(_0xc362a8){if(_0xc362a8['type'][_0x4d0f('0x3e')]!==_0x4d0f('0x3f')){var _0x191b3f={};_0x191b3f[_0xc362a8[_0x4d0f('0x40')]]={'$like':'%'+_0xa54211[_0x4d0f('0x30')][_0x4d0f('0x41')]+'%'};return _0x191b3f;}})});}_0x56b70c=_['merge']({},_0x56b70c,_0xa54211[_0x4d0f('0x42')]);var _0x21c612={'where':_0x56b70c[_0x4d0f('0x39')]};return db[_0x4d0f('0x2c')][_0x4d0f('0x1b')](_0x21c612)[_0x4d0f('0x23')](function(_0x452dfa){_0x590202['count']=_0x452dfa;if(_0xa54211['query'][_0x4d0f('0x43')]){_0x56b70c[_0x4d0f('0x44')]=[{'all':!![]}];}return db['Interval'][_0x4d0f('0x45')](_0x56b70c);})[_0x4d0f('0x23')](function(_0x3670b8){_0x590202[_0x4d0f('0x46')]=_0x3670b8;return _0x590202;})[_0x4d0f('0x23')](respondWithFilteredResult(_0x19368e,_0x56b70c))[_0x4d0f('0x47')](handleError(_0x19368e,null));};exports[_0x4d0f('0x48')]=function(_0x5b15a1,_0x547c06){var _0x13c299={'raw':!![],'where':{'id':_0x5b15a1[_0x4d0f('0x49')]['id']}},_0x2f42c3={};_0x2f42c3[_0x4d0f('0x2e')]=_[_0x4d0f('0x2f')](db[_0x4d0f('0x2c')][_0x4d0f('0x2d')]);_0x2f42c3[_0x4d0f('0x30')]=_[_0x4d0f('0x2f')](_0x5b15a1['query']);_0x2f42c3['filters']=_[_0x4d0f('0x31')](_0x2f42c3[_0x4d0f('0x2e')],_0x2f42c3[_0x4d0f('0x30')]);_0x13c299[_0x4d0f('0x32')]=_['intersection'](_0x2f42c3[_0x4d0f('0x2e')],qs[_0x4d0f('0x33')](_0x5b15a1['query']['fields']));_0x13c299[_0x4d0f('0x32')]=_0x13c299[_0x4d0f('0x32')][_0x4d0f('0x34')]?_0x13c299[_0x4d0f('0x32')]:_0x2f42c3[_0x4d0f('0x2e')];if(_0x5b15a1['query'][_0x4d0f('0x43')]){_0x13c299[_0x4d0f('0x44')]=[{'all':!![]}];}_0x13c299=_[_0x4d0f('0x3c')]({},_0x13c299,_0x5b15a1[_0x4d0f('0x42')]);return db[_0x4d0f('0x2c')][_0x4d0f('0x4a')](_0x13c299)[_0x4d0f('0x23')](handleEntityNotFound(_0x547c06,null))[_0x4d0f('0x23')](respondWithResult(_0x547c06,null))[_0x4d0f('0x47')](handleError(_0x547c06,null));};exports[_0x4d0f('0x4b')]=function(_0x2e3d11,_0x2647b8){return db['Interval']['create'](_0x2e3d11['body'],{})[_0x4d0f('0x23')](function(_0x16b304){var _0x4689dc=_0x2e3d11['user'][_0x4d0f('0x25')]({'plain':!![]});if(!_0x4689dc)throw new Error(_0x4d0f('0x4c'));if(_0x4689dc['role']===_0x4d0f('0x4d')){var _0x4af619=_0x16b304[_0x4d0f('0x25')]({'plain':!![]});var _0x35f33d=_0x4d0f('0x26');return db['UserProfileSection'][_0x4d0f('0x4a')]({'where':{'name':_0x35f33d,'userProfileId':_0x4689dc[_0x4d0f('0x4e')]},'raw':!![]})['then'](function(_0x6050a1){if(_0x6050a1&&_0x6050a1['autoAssociation']===0x0){return db[_0x4d0f('0x27')]['create']({'name':_0x4af619[_0x4d0f('0x2a')],'resourceId':_0x4af619['id'],'type':_0x6050a1[_0x4d0f('0x2a')],'sectionId':_0x6050a1['id']},{})[_0x4d0f('0x23')](function(){return _0x16b304;});}else{return _0x16b304;}})[_0x4d0f('0x47')](function(_0x2a98d1){logger[_0x4d0f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a98d1);throw _0x2a98d1;});}return _0x16b304;})[_0x4d0f('0x23')](respondWithResult(_0x2647b8,0xc9))[_0x4d0f('0x47')](handleError(_0x2647b8,null));};exports[_0x4d0f('0x22')]=function(_0x3e223b,_0x52a752){if(_0x3e223b['body']['id']){delete _0x3e223b['body']['id'];}return db['Interval'][_0x4d0f('0x4a')]({'where':{'id':_0x3e223b[_0x4d0f('0x49')]['id']}})[_0x4d0f('0x23')](handleEntityNotFound(_0x52a752,null))[_0x4d0f('0x23')](saveUpdates(_0x3e223b['body'],null))['then'](respondWithResult(_0x52a752,null))[_0x4d0f('0x47')](handleError(_0x52a752,null));};exports[_0x4d0f('0x24')]=function(_0xa0ec24,_0x4a016f){return db[_0x4d0f('0x2c')][_0x4d0f('0x4a')]({'where':{'id':_0xa0ec24[_0x4d0f('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a016f,null))[_0x4d0f('0x23')](removeEntity(_0x4a016f,null))['catch'](handleError(_0x4a016f,null));};exports['addInterval']=function(_0x48ed91,_0x392e54,_0x47d182){if(_0x48ed91[_0x4d0f('0x4f')]['id']){delete _0x48ed91['body']['id'];}return db['Interval'][_0x4d0f('0x4a')]({'where':{'id':_0x48ed91[_0x4d0f('0x49')]['id']}})[_0x4d0f('0x23')](handleEntityNotFound(_0x392e54,null))[_0x4d0f('0x23')](function(_0x39aba2){if(_0x39aba2){_0x48ed91[_0x4d0f('0x4f')][_0x4d0f('0x50')]=_0x39aba2['id'];return db[_0x4d0f('0x2c')][_0x4d0f('0x4b')](_0x48ed91[_0x4d0f('0x4f')]);}})[_0x4d0f('0x23')](respondWithResult(_0x392e54,null))[_0x4d0f('0x47')](handleError(_0x392e54,null));};exports[_0x4d0f('0x51')]=function(_0x30bdda,_0x4ef393,_0xed59ca){var _0x22f684={};var _0x33046d={};var _0x4c8e4f;var _0xd8b939;return db['Interval']['findOne']({'where':{'id':_0x30bdda[_0x4d0f('0x49')]['id']}})[_0x4d0f('0x23')](handleEntityNotFound(_0x4ef393,null))[_0x4d0f('0x23')](function(_0x1def46){if(_0x1def46){_0x4c8e4f=_0x1def46;_0x33046d['model']=_['keys'](db[_0x4d0f('0x2c')]['rawAttributes']);_0x33046d['query']=_[_0x4d0f('0x2f')](_0x30bdda[_0x4d0f('0x30')]);_0x33046d[_0x4d0f('0x3b')]=_['intersection'](_0x33046d[_0x4d0f('0x2e')],_0x33046d[_0x4d0f('0x30')]);_0x22f684['attributes']=_[_0x4d0f('0x31')](_0x33046d[_0x4d0f('0x2e')],qs[_0x4d0f('0x33')](_0x30bdda[_0x4d0f('0x30')][_0x4d0f('0x33')]));_0x22f684[_0x4d0f('0x32')]=_0x22f684[_0x4d0f('0x32')][_0x4d0f('0x34')]?_0x22f684[_0x4d0f('0x32')]:_0x33046d[_0x4d0f('0x2e')];_0x22f684[_0x4d0f('0x37')]=qs[_0x4d0f('0x38')](_0x30bdda[_0x4d0f('0x30')]['sort']);_0x22f684['where']=qs[_0x4d0f('0x3b')](_['pick'](_0x30bdda[_0x4d0f('0x30')],_0x33046d['filters']));if(_0x30bdda[_0x4d0f('0x30')][_0x4d0f('0x41')]){_0x22f684[_0x4d0f('0x39')]=_['merge'](_0x22f684['where'],{'$or':_[_0x4d0f('0x3d')](_0x22f684[_0x4d0f('0x32')],function(_0x540bc6){var _0x1ba56c={};_0x1ba56c[_0x540bc6]={'$like':'%'+_0x30bdda['query'][_0x4d0f('0x41')]+'%'};return _0x1ba56c;})});}_0x22f684=_[_0x4d0f('0x3c')]({},_0x22f684,_0x30bdda['options']);return _0x4c8e4f[_0x4d0f('0x51')](_0x22f684);}})[_0x4d0f('0x23')](function(_0xf42ad1){if(_0xf42ad1){_0xd8b939=_0xf42ad1[_0x4d0f('0x34')];if(!_0x30bdda[_0x4d0f('0x30')][_0x4d0f('0x35')]('nolimit')){_0x22f684[_0x4d0f('0x1d')]=qs['limit'](_0x30bdda[_0x4d0f('0x30')][_0x4d0f('0x1d')]);_0x22f684['offset']=qs[_0x4d0f('0x1c')](_0x30bdda[_0x4d0f('0x30')][_0x4d0f('0x1c')]);}return _0x4c8e4f[_0x4d0f('0x51')](_0x22f684);}})[_0x4d0f('0x23')](function(_0x53c50d){if(_0x53c50d){return _0x53c50d?{'count':_0xd8b939,'rows':_0x53c50d}:null;}})[_0x4d0f('0x23')](respondWithResult(_0x4ef393,null))['catch'](handleError(_0x4ef393,null));};exports['addIntervals']=function(_0x508ee2,_0xb7a726,_0x1c9d16){return db['Interval'][_0x4d0f('0x52')]({'where':{'id':_0x508ee2[_0x4d0f('0x49')]['id']}})['then'](handleEntityNotFound(_0xb7a726,null))['then'](function(_0x40b47a){if(_0x40b47a){return db[_0x4d0f('0x53')][_0x4d0f('0x54')](function(_0x2aa395){return db[_0x4d0f('0x2c')][_0x4d0f('0x24')]({'where':{'IntervalId':_0x508ee2[_0x4d0f('0x49')]['id']},'transaction':_0x2aa395})['then'](function(_0x125364){var _0xff3ee3=_[_0x4d0f('0x3d')](_0x508ee2[_0x4d0f('0x4f')],function(_0x2f8044){delete _0x2f8044['id'];_0x2f8044[_0x4d0f('0x50')]=_0x508ee2['params']['id'];return _0x2f8044;});return db[_0x4d0f('0x2c')]['bulkCreate'](_0xff3ee3,{'transaction':_0x2aa395});});})[_0x4d0f('0x23')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x508ee2['params']['id']}});});}})[_0x4d0f('0x23')](respondWithResult(_0xb7a726,null))[_0x4d0f('0x47')](handleError(_0xb7a726,null));}; \ No newline at end of file +var _0x188a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','map','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/extensions/rewrite','end','status','count','offset','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','stack','name','send','Interval','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','key','VIRTUAL','field','filter','merge','options','include','rows','catch','show','includeAll','find','create','body','user'];(function(_0x440f7a,_0x4368eb){var _0x5325e1=function(_0x1324a7){while(--_0x1324a7){_0x440f7a['push'](_0x440f7a['shift']());}};_0x5325e1(++_0x4368eb);}(_0x188a,0x69));var _0xa188=function(_0x2f636a,_0x14c607){_0x2f636a=_0x2f636a-0x0;var _0x39c291=_0x188a[_0x2f636a];return _0x39c291;};'use strict';var pdf=require(_0xa188('0x0'));var emlformat=require(_0xa188('0x1'));var rimraf=require(_0xa188('0x2'));var zipdir=require(_0xa188('0x3'));var jsonpatch=require(_0xa188('0x4'));var rp=require(_0xa188('0x5'));var moment=require(_0xa188('0x6'));var BPromise=require(_0xa188('0x7'));var Mustache=require(_0xa188('0x8'));var util=require(_0xa188('0x9'));var path=require(_0xa188('0xa'));var sox=require(_0xa188('0xb'));var csv=require(_0xa188('0xc'));var ejs=require(_0xa188('0xd'));var fs=require('fs');var _=require(_0xa188('0xe'));var squel=require(_0xa188('0xf'));var crypto=require('crypto');var jsforce=require(_0xa188('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa188('0xc'));var querystring=require(_0xa188('0x11'));var Papa=require(_0xa188('0x12'));var Redis=require(_0xa188('0x13'));var authService=require(_0xa188('0x14'));var qs=require(_0xa188('0x15'));var hardwareService=require(_0xa188('0x16'));var logger=require(_0xa188('0x17'))('api');var utils=require(_0xa188('0x18'));var config=require(_0xa188('0x19'));var db=require('../../mysqldb')['db'];var extensions=require(_0xa188('0x1a'));function respondWithStatusCode(_0x27f06c,_0x137575){_0x137575=_0x137575||0xcc;return function(_0x118e5d){if(_0x118e5d){return _0x27f06c['sendStatus'](_0x137575);}return _0x27f06c['status'](_0x137575)[_0xa188('0x1b')]();};}function respondWithResult(_0x27f5c2,_0x4aa42c){_0x4aa42c=_0x4aa42c||0xc8;return function(_0x8fa4e){if(_0x8fa4e){return _0x27f5c2[_0xa188('0x1c')](_0x4aa42c)['json'](_0x8fa4e);}};}function respondWithFilteredResult(_0x4f4043,_0x3aa361){return function(_0xe05457){if(_0xe05457){var _0x2f7af5=_0xe05457[_0xa188('0x1d')],_0x44d064=_0x3aa361[_0xa188('0x1e')],_0x5cb486=_0x3aa361[_0xa188('0x1e')]+_0x3aa361['limit'],_0x50457d;if(_0x5cb486>=_0x2f7af5){_0x5cb486=_0x2f7af5;_0x50457d=0xc8;}else{_0x50457d=0xce;}_0x4f4043['status'](_0x50457d);return _0x4f4043['set'](_0xa188('0x1f'),_0x44d064+'-'+_0x5cb486+'/'+_0x2f7af5)['json'](_0xe05457);}return null;};}function patchUpdates(_0x49f4e9){return function(_0x192c30){try{jsonpatch['apply'](_0x192c30,_0x49f4e9,!![]);}catch(_0x482fdf){return BPromise[_0xa188('0x20')](_0x482fdf);}return _0x192c30[_0xa188('0x21')]();};}function saveUpdates(_0x59ec52,_0x40ab20){return function(_0x4d0ec5){if(_0x4d0ec5){return _0x4d0ec5[_0xa188('0x22')](_0x59ec52)[_0xa188('0x23')](function(_0x41f20a){return _0x41f20a;});}return null;};}function removeEntity(_0x10781a,_0x2576da){return function(_0xf21a48){if(_0xf21a48){return _0xf21a48[_0xa188('0x24')]()[_0xa188('0x23')](function(){var _0x9873f9=_0xf21a48[_0xa188('0x25')]({'plain':!![]});var _0x2b0c79=_0xa188('0x26');return db[_0xa188('0x27')][_0xa188('0x24')]({'where':{'type':_0x2b0c79,'resourceId':_0x9873f9['id']}})[_0xa188('0x23')](function(){return _0xf21a48;});})[_0xa188('0x23')](function(){_0x10781a[_0xa188('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3440e4,_0x501c01){return function(_0x9c89e5){if(!_0x9c89e5){_0x3440e4[_0xa188('0x28')](0x194);}return _0x9c89e5;};}function handleError(_0xa8e200,_0x124d04){_0x124d04=_0x124d04||0x1f4;return function(_0x3c3b29){logger['error'](_0x3c3b29[_0xa188('0x29')]);if(_0x3c3b29['name']){delete _0x3c3b29[_0xa188('0x2a')];}_0xa8e200['status'](_0x124d04)[_0xa188('0x2b')](_0x3c3b29);};}exports['index']=function(_0x1cb428,_0x271e8f){var _0x225225={},_0x5e9257={},_0x1a9022={'count':0x0,'rows':[]};var _0xf70fcd=db[_0xa188('0x2c')][_0xa188('0x2d')];_0x5e9257[_0xa188('0x2e')]=_[_0xa188('0x2f')](_0xf70fcd);_0x5e9257[_0xa188('0x30')]=_[_0xa188('0x2f')](_0x1cb428['query']);_0x5e9257[_0xa188('0x31')]=_[_0xa188('0x32')](_0x5e9257['model'],_0x5e9257[_0xa188('0x30')]);_0x225225[_0xa188('0x33')]=_[_0xa188('0x32')](_0x5e9257[_0xa188('0x2e')],qs[_0xa188('0x34')](_0x1cb428[_0xa188('0x30')][_0xa188('0x34')]));_0x225225[_0xa188('0x33')]=_0x225225['attributes'][_0xa188('0x35')]?_0x225225['attributes']:_0x5e9257['model'];if(!_0x1cb428[_0xa188('0x30')][_0xa188('0x36')](_0xa188('0x37'))){_0x225225[_0xa188('0x38')]=qs[_0xa188('0x38')](_0x1cb428[_0xa188('0x30')][_0xa188('0x38')]);_0x225225[_0xa188('0x1e')]=qs['offset'](_0x1cb428[_0xa188('0x30')][_0xa188('0x1e')]);}_0x225225[_0xa188('0x39')]=qs[_0xa188('0x3a')](_0x1cb428[_0xa188('0x30')][_0xa188('0x3a')]);_0x225225[_0xa188('0x3b')]=qs[_0xa188('0x31')](_[_0xa188('0x3c')](_0x1cb428[_0xa188('0x30')],_0x5e9257[_0xa188('0x31')]));if(_0x1cb428[_0xa188('0x30')]['filter']){_0x225225[_0xa188('0x3b')]=_['merge'](_0x225225['where'],{'$or':_['map'](_0xf70fcd,function(_0x1350cd){if(_0x1350cd[_0xa188('0x3d')][_0xa188('0x3e')]!==_0xa188('0x3f')){var _0x521546={};_0x521546[_0x1350cd[_0xa188('0x40')]]={'$like':'%'+_0x1cb428[_0xa188('0x30')][_0xa188('0x41')]+'%'};return _0x521546;}})});}_0x225225=_[_0xa188('0x42')]({},_0x225225,_0x1cb428[_0xa188('0x43')]);var _0x8af3ff={'where':_0x225225[_0xa188('0x3b')]};return db[_0xa188('0x2c')][_0xa188('0x1d')](_0x8af3ff)[_0xa188('0x23')](function(_0x4077e7){_0x1a9022[_0xa188('0x1d')]=_0x4077e7;if(_0x1cb428[_0xa188('0x30')]['includeAll']){_0x225225[_0xa188('0x44')]=[{'all':!![]}];}return db[_0xa188('0x2c')]['findAll'](_0x225225);})[_0xa188('0x23')](function(_0x3ae8ae){_0x1a9022[_0xa188('0x45')]=_0x3ae8ae;return _0x1a9022;})['then'](respondWithFilteredResult(_0x271e8f,_0x225225))[_0xa188('0x46')](handleError(_0x271e8f,null));};exports[_0xa188('0x47')]=function(_0x5bb522,_0x1ce743){var _0x51395a={'raw':!![],'where':{'id':_0x5bb522['params']['id']}},_0x3b18a2={};_0x3b18a2[_0xa188('0x2e')]=_[_0xa188('0x2f')](db[_0xa188('0x2c')][_0xa188('0x2d')]);_0x3b18a2[_0xa188('0x30')]=_[_0xa188('0x2f')](_0x5bb522[_0xa188('0x30')]);_0x3b18a2[_0xa188('0x31')]=_[_0xa188('0x32')](_0x3b18a2[_0xa188('0x2e')],_0x3b18a2[_0xa188('0x30')]);_0x51395a['attributes']=_[_0xa188('0x32')](_0x3b18a2[_0xa188('0x2e')],qs['fields'](_0x5bb522[_0xa188('0x30')]['fields']));_0x51395a[_0xa188('0x33')]=_0x51395a[_0xa188('0x33')][_0xa188('0x35')]?_0x51395a[_0xa188('0x33')]:_0x3b18a2[_0xa188('0x2e')];if(_0x5bb522['query'][_0xa188('0x48')]){_0x51395a[_0xa188('0x44')]=[{'all':!![]}];}_0x51395a=_['merge']({},_0x51395a,_0x5bb522[_0xa188('0x43')]);return db['Interval'][_0xa188('0x49')](_0x51395a)[_0xa188('0x23')](handleEntityNotFound(_0x1ce743,null))[_0xa188('0x23')](respondWithResult(_0x1ce743,null))[_0xa188('0x46')](handleError(_0x1ce743,null));};exports[_0xa188('0x4a')]=function(_0x3db669,_0x1903c4){return db[_0xa188('0x2c')][_0xa188('0x4a')](_0x3db669[_0xa188('0x4b')],{})[_0xa188('0x23')](function(_0x555dda){var _0xfc7c6d=_0x3db669[_0xa188('0x4c')][_0xa188('0x25')]({'plain':!![]});if(!_0xfc7c6d)throw new Error(_0xa188('0x4d'));if(_0xfc7c6d[_0xa188('0x4e')]===_0xa188('0x4c')){var _0x52d0eb=_0x555dda[_0xa188('0x25')]({'plain':!![]});var _0x155749=_0xa188('0x26');return db[_0xa188('0x4f')][_0xa188('0x49')]({'where':{'name':_0x155749,'userProfileId':_0xfc7c6d['userProfileId']},'raw':!![]})['then'](function(_0x2280cf){if(_0x2280cf&&_0x2280cf[_0xa188('0x50')]===0x0){return db[_0xa188('0x27')]['create']({'name':_0x52d0eb['name'],'resourceId':_0x52d0eb['id'],'type':_0x2280cf[_0xa188('0x2a')],'sectionId':_0x2280cf['id']},{})[_0xa188('0x23')](function(){return _0x555dda;});}else{return _0x555dda;}})[_0xa188('0x46')](function(_0x57fe2f){logger['error'](_0xa188('0x51'),_0x57fe2f);throw _0x57fe2f;});}return _0x555dda;})['then'](respondWithResult(_0x1903c4,0xc9))['catch'](handleError(_0x1903c4,null));};exports[_0xa188('0x22')]=function(_0x4b3e94,_0x546c87){if(_0x4b3e94[_0xa188('0x4b')]['id']){delete _0x4b3e94['body']['id'];}return db[_0xa188('0x2c')][_0xa188('0x49')]({'where':{'id':_0x4b3e94['params']['id']}})[_0xa188('0x23')](handleEntityNotFound(_0x546c87,null))['then'](saveUpdates(_0x4b3e94['body'],null))[_0xa188('0x23')](respondWithResult(_0x546c87,null))[_0xa188('0x46')](handleError(_0x546c87,null));};exports[_0xa188('0x24')]=function(_0x4a9d62,_0x210978){return db[_0xa188('0x2c')][_0xa188('0x49')]({'where':{'id':_0x4a9d62[_0xa188('0x52')]['id']}})[_0xa188('0x23')](handleEntityNotFound(_0x210978,null))['then'](removeEntity(_0x210978,null))[_0xa188('0x46')](handleError(_0x210978,null));};exports['addInterval']=function(_0x5120e5,_0xf092c2,_0x360458){if(_0x5120e5[_0xa188('0x4b')]['id']){delete _0x5120e5[_0xa188('0x4b')]['id'];}return db[_0xa188('0x2c')][_0xa188('0x49')]({'where':{'id':_0x5120e5[_0xa188('0x52')]['id']}})[_0xa188('0x23')](handleEntityNotFound(_0xf092c2,null))[_0xa188('0x23')](function(_0x5cc63b){if(_0x5cc63b){_0x5120e5[_0xa188('0x4b')][_0xa188('0x53')]=_0x5cc63b['id'];return db[_0xa188('0x2c')]['create'](_0x5120e5[_0xa188('0x4b')]);}})[_0xa188('0x23')](respondWithResult(_0xf092c2,null))['catch'](handleError(_0xf092c2,null));};exports[_0xa188('0x54')]=function(_0x3e2fe0,_0x32fd05,_0x554bf9){var _0x275e3a={};var _0xf0d2de={};var _0x2dd41c;var _0x439b20;return db['Interval'][_0xa188('0x55')]({'where':{'id':_0x3e2fe0['params']['id']}})[_0xa188('0x23')](handleEntityNotFound(_0x32fd05,null))['then'](function(_0xf3bc4a){if(_0xf3bc4a){_0x2dd41c=_0xf3bc4a;_0xf0d2de[_0xa188('0x2e')]=_['keys'](db[_0xa188('0x2c')][_0xa188('0x2d')]);_0xf0d2de[_0xa188('0x30')]=_[_0xa188('0x2f')](_0x3e2fe0[_0xa188('0x30')]);_0xf0d2de['filters']=_[_0xa188('0x32')](_0xf0d2de[_0xa188('0x2e')],_0xf0d2de[_0xa188('0x30')]);_0x275e3a[_0xa188('0x33')]=_['intersection'](_0xf0d2de[_0xa188('0x2e')],qs[_0xa188('0x34')](_0x3e2fe0[_0xa188('0x30')][_0xa188('0x34')]));_0x275e3a['attributes']=_0x275e3a['attributes'][_0xa188('0x35')]?_0x275e3a[_0xa188('0x33')]:_0xf0d2de[_0xa188('0x2e')];_0x275e3a[_0xa188('0x39')]=qs['sort'](_0x3e2fe0['query']['sort']);_0x275e3a[_0xa188('0x3b')]=qs[_0xa188('0x31')](_[_0xa188('0x3c')](_0x3e2fe0['query'],_0xf0d2de[_0xa188('0x31')]));if(_0x3e2fe0[_0xa188('0x30')][_0xa188('0x41')]){_0x275e3a[_0xa188('0x3b')]=_[_0xa188('0x42')](_0x275e3a[_0xa188('0x3b')],{'$or':_[_0xa188('0x56')](_0x275e3a[_0xa188('0x33')],function(_0x1f7039){var _0x56a59a={};_0x56a59a[_0x1f7039]={'$like':'%'+_0x3e2fe0[_0xa188('0x30')][_0xa188('0x41')]+'%'};return _0x56a59a;})});}_0x275e3a=_[_0xa188('0x42')]({},_0x275e3a,_0x3e2fe0[_0xa188('0x43')]);return _0x2dd41c['getIntervals'](_0x275e3a);}})[_0xa188('0x23')](function(_0x228b50){if(_0x228b50){_0x439b20=_0x228b50[_0xa188('0x35')];if(!_0x3e2fe0[_0xa188('0x30')][_0xa188('0x36')](_0xa188('0x37'))){_0x275e3a['limit']=qs[_0xa188('0x38')](_0x3e2fe0['query']['limit']);_0x275e3a[_0xa188('0x1e')]=qs[_0xa188('0x1e')](_0x3e2fe0['query'][_0xa188('0x1e')]);}return _0x2dd41c[_0xa188('0x54')](_0x275e3a);}})['then'](function(_0x3a30be){if(_0x3a30be){return _0x3a30be?{'count':_0x439b20,'rows':_0x3a30be}:null;}})['then'](respondWithResult(_0x32fd05,null))[_0xa188('0x46')](handleError(_0x32fd05,null));};exports[_0xa188('0x57')]=function(_0x2cd01b,_0xe6abf3,_0x1e1749){return db[_0xa188('0x2c')][_0xa188('0x55')]({'where':{'id':_0x2cd01b['params']['id']}})[_0xa188('0x23')](handleEntityNotFound(_0xe6abf3,null))[_0xa188('0x23')](function(_0x2703f2){if(_0x2703f2){return db[_0xa188('0x58')][_0xa188('0x59')](function(_0x2de933){return db[_0xa188('0x2c')]['destroy']({'where':{'IntervalId':_0x2cd01b[_0xa188('0x52')]['id']},'transaction':_0x2de933})[_0xa188('0x23')](function(_0xb5ec3e){var _0x38b023=_[_0xa188('0x56')](_0x2cd01b[_0xa188('0x4b')],function(_0x478f22){delete _0x478f22['id'];_0x478f22[_0xa188('0x53')]=_0x2cd01b[_0xa188('0x52')]['id'];return _0x478f22;});return db['Interval'][_0xa188('0x5a')](_0x38b023,{'transaction':_0x2de933});});})[_0xa188('0x23')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x2cd01b['params']['id']}});});}})[_0xa188('0x23')](respondWithResult(_0xe6abf3,null))['catch'](handleError(_0xe6abf3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c6cb30d..e05c2fc 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 _0x6d50=['../../components/extensions/rewrite','exports','define','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x6d50,0x66));var _0x06d5=function(_0xb9809b,_0x3b138d){_0xb9809b=_0xb9809b-0x0;var _0x2cfa55=_0x6d50[_0xb9809b];return _0x2cfa55;};'use strict';var _=require('lodash');var util=require(_0x06d5('0x0'));var logger=require(_0x06d5('0x1'))(_0x06d5('0x2'));var moment=require(_0x06d5('0x3'));var BPromise=require(_0x06d5('0x4'));var rp=require(_0x06d5('0x5'));var fs=require('fs');var path=require(_0x06d5('0x6'));var rimraf=require(_0x06d5('0x7'));var config=require(_0x06d5('0x8'));var attributes=require(_0x06d5('0x9'));var extensions=require(_0x06d5('0xa'));module[_0x06d5('0xb')]=function(_0x3ac352,_0x43710b){return _0x3ac352[_0x06d5('0xc')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1015dc,_0x18037a){extensions[_0x06d5('0xd')](_0x3ac352,_0x1015dc);},'afterBulkCreate':function(_0x2fe842,_0x264710,_0x4f6de7){_0x4f6de7();extensions[_0x06d5('0xd')](_0x3ac352,_0x2fe842[0x0]);},'afterUpdate':function(_0x294f58,_0x359f3b){extensions['rewrite'](_0x3ac352,_0x294f58);},'afterDestroy':function(_0x1d7cd5,_0x3d4c46){extensions[_0x06d5('0xd')](_0x3ac352,_0x1d7cd5);}}});}; \ No newline at end of file +var _0xa78b=['exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x54489b,_0xbfe813){var _0x1143fa=function(_0x39579d){while(--_0x39579d){_0x54489b['push'](_0x54489b['shift']());}};_0x1143fa(++_0xbfe813);}(_0xa78b,0x1a5));var _0xba78=function(_0x14d90b,_0xfdf44f){_0x14d90b=_0x14d90b-0x0;var _0x71212f=_0xa78b[_0x14d90b];return _0x71212f;};'use strict';var _=require('lodash');var util=require(_0xba78('0x0'));var logger=require(_0xba78('0x1'))('api');var moment=require(_0xba78('0x2'));var BPromise=require('bluebird');var rp=require(_0xba78('0x3'));var fs=require('fs');var path=require(_0xba78('0x4'));var rimraf=require(_0xba78('0x5'));var config=require(_0xba78('0x6'));var attributes=require(_0xba78('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0xba78('0x8')]=function(_0x3a3489,_0x20d344){return _0x3a3489[_0xba78('0x9')](_0xba78('0xa'),attributes,{'tableName':_0xba78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13eeb2,_0x287d18){extensions[_0xba78('0xc')](_0x3a3489,_0x13eeb2);},'afterBulkCreate':function(_0x1a0823,_0x2b3b9c,_0x361c05){_0x361c05();extensions['rewrite'](_0x3a3489,_0x1a0823[0x0]);},'afterUpdate':function(_0x37a6eb,_0x48ac40){extensions[_0xba78('0xc')](_0x3a3489,_0x37a6eb);},'afterDestroy':function(_0x166661,_0x4e58d4){extensions[_0xba78('0xc')](_0x3a3489,_0x166661);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5b30840..8849a07 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 _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','Interval,\x20%s,\x20%s','message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowInterval','stringify','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xee14,0x13a));var _0x4ee1=function(_0x27e9fe,_0x30522b){_0x27e9fe=_0x27e9fe-0x0;var _0x2744ac=_0xee14[_0x27e9fe];return _0x2744ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('Interval,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('Interval,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});}exports[_0x4ee1('0x15')]=function(_0x360056){var _0x3a0967=this;return new Promise(function(_0x274de5,_0x5d76de){return db[_0x4ee1('0x16')][_0x4ee1('0x17')]({'raw':_0x360056[_0x4ee1('0x18')]?_0x360056[_0x4ee1('0x18')][_0x4ee1('0x19')]===undefined?!![]:![]:!![],'where':_0x360056[_0x4ee1('0x18')]?_0x360056['options'][_0x4ee1('0x1a')]||null:null,'attributes':_0x360056[_0x4ee1('0x18')]?_0x360056[_0x4ee1('0x18')][_0x4ee1('0x1b')]||null:null,'limit':_0x360056[_0x4ee1('0x18')]?_0x360056[_0x4ee1('0x18')][_0x4ee1('0x1c')]||null:null,'include':_0x360056[_0x4ee1('0x18')]?_0x360056[_0x4ee1('0x18')][_0x4ee1('0x1d')]?_['map'](_0x360056['options'][_0x4ee1('0x1d')],function(_0x459e2e){return{'model':db[_0x459e2e[_0x4ee1('0x1e')]],'as':_0x459e2e['as'],'attributes':_0x459e2e[_0x4ee1('0x1b')],'include':_0x459e2e[_0x4ee1('0x1d')]?_[_0x4ee1('0x1f')](_0x459e2e['include'],function(_0x5cc0b5){return{'model':db[_0x5cc0b5[_0x4ee1('0x1e')]],'as':_0x5cc0b5['as'],'attributes':_0x5cc0b5[_0x4ee1('0x1b')],'include':_0x5cc0b5['include']?_[_0x4ee1('0x1f')](_0x5cc0b5[_0x4ee1('0x1d')],function(_0x36654c){return{'model':db[_0x36654c[_0x4ee1('0x1e')]],'as':_0x36654c['as'],'attributes':_0x36654c[_0x4ee1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ee1('0x20')](function(_0x45bd0d){logger['info'](_0x4ee1('0x15'),_0x360056);logger['debug'](_0x4ee1('0x15'),_0x360056,JSON['stringify'](_0x45bd0d));_0x274de5(_0x45bd0d);})[_0x4ee1('0x14')](function(_0x1d91be){logger[_0x4ee1('0xf')](_0x4ee1('0x15'),_0x1d91be[_0x4ee1('0x12')],_0x360056);_0x5d76de(_0x3a0967['error'](0x1f4,_0x1d91be[_0x4ee1('0x12')]));});});};exports['ShowInterval']=function(_0x121301){var _0x3d5e6c=this;return new Promise(function(_0x33fd38,_0x37bc2e){return db[_0x4ee1('0x16')]['find']({'raw':_0x121301[_0x4ee1('0x18')]?_0x121301[_0x4ee1('0x18')][_0x4ee1('0x19')]===undefined?!![]:![]:!![],'where':_0x121301[_0x4ee1('0x18')]?_0x121301[_0x4ee1('0x18')][_0x4ee1('0x1a')]||null:null,'attributes':_0x121301['options']?_0x121301['options'][_0x4ee1('0x1b')]||null:null,'include':_0x121301[_0x4ee1('0x18')]?_0x121301[_0x4ee1('0x18')]['include']?_[_0x4ee1('0x1f')](_0x121301[_0x4ee1('0x18')][_0x4ee1('0x1d')],function(_0x346e87){return{'model':db[_0x346e87[_0x4ee1('0x1e')]],'as':_0x346e87['as'],'attributes':_0x346e87[_0x4ee1('0x1b')],'include':_0x346e87[_0x4ee1('0x1d')]?_[_0x4ee1('0x1f')](_0x346e87[_0x4ee1('0x1d')],function(_0x3cc595){return{'model':db[_0x3cc595[_0x4ee1('0x1e')]],'as':_0x3cc595['as'],'attributes':_0x3cc595[_0x4ee1('0x1b')],'include':_0x3cc595[_0x4ee1('0x1d')]?_['map'](_0x3cc595[_0x4ee1('0x1d')],function(_0x3de40e){return{'model':db[_0x3de40e[_0x4ee1('0x1e')]],'as':_0x3de40e['as'],'attributes':_0x3de40e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257f67){logger[_0x4ee1('0xb')](_0x4ee1('0x21'),_0x121301);logger[_0x4ee1('0xd')]('ShowInterval',_0x121301,JSON[_0x4ee1('0x22')](_0x257f67));_0x33fd38(_0x257f67);})[_0x4ee1('0x14')](function(_0x11721a){logger[_0x4ee1('0xf')](_0x4ee1('0x21'),_0x11721a[_0x4ee1('0x12')],_0x121301);_0x37bc2e(_0x3d5e6c[_0x4ee1('0xf')](0x1f4,_0x11721a[_0x4ee1('0x12')]));});});}; \ No newline at end of file +var _0x04de=['Interval','findAll','options','raw','where','attributes','include','model','ShowInterval','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Interval,\x20%s,\x20%s','result','catch','GetInterval'];(function(_0x1777b0,_0x4789d6){var _0x4587e8=function(_0x296e41){while(--_0x296e41){_0x1777b0['push'](_0x1777b0['shift']());}};_0x4587e8(++_0x4789d6);}(_0x04de,0x107));var _0xe04d=function(_0x16d2a9,_0x141852){_0x16d2a9=_0x16d2a9-0x0;var _0x2cbf9d=_0x04de[_0x16d2a9];return _0x2cbf9d;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));var BPromise=require(_0xe04d('0x3'));var rs=require(_0xe04d('0x4'));var fs=require('fs');var Redis=require(_0xe04d('0x5'));var db=require(_0xe04d('0x6'))['db'];var utils=require(_0xe04d('0x7'));var logger=require(_0xe04d('0x8'))(_0xe04d('0x9'));var config=require(_0xe04d('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x531688,_0x55efb5,_0x210e93){return new BPromise(function(_0x72b1ce,_0x1be121){return client[_0xe04d('0xb')](_0x531688,_0x210e93)[_0xe04d('0xc')](function(_0x2ae3c9){logger[_0xe04d('0xd')]('Interval,\x20%s,\x20%s',_0x55efb5,_0xe04d('0xe'));logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x55efb5,_0xe04d('0xe'),JSON[_0xe04d('0x11')](_0x2ae3c9));if(_0x2ae3c9[_0xe04d('0x12')]){if(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x13')]===0x1f4){logger[_0xe04d('0x12')]('Interval,\x20%s,\x20%s',_0x55efb5,_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);return _0x1be121(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);}logger[_0xe04d('0x12')](_0xe04d('0x15'),_0x55efb5,_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);return _0x72b1ce(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);}else{logger[_0xe04d('0xd')](_0xe04d('0x15'),_0x55efb5,'request\x20sent');_0x72b1ce(_0x2ae3c9[_0xe04d('0x16')]['message']);}})[_0xe04d('0x17')](function(_0x49c063){logger[_0xe04d('0x12')](_0xe04d('0x15'),_0x55efb5,_0x49c063);_0x1be121(_0x49c063);});});}exports[_0xe04d('0x18')]=function(_0x93b107){var _0x4090e0=this;return new Promise(function(_0x35a2b4,_0x251772){return db[_0xe04d('0x19')][_0xe04d('0x1a')]({'raw':_0x93b107['options']?_0x93b107[_0xe04d('0x1b')][_0xe04d('0x1c')]===undefined?!![]:![]:!![],'where':_0x93b107[_0xe04d('0x1b')]?_0x93b107[_0xe04d('0x1b')][_0xe04d('0x1d')]||null:null,'attributes':_0x93b107[_0xe04d('0x1b')]?_0x93b107['options'][_0xe04d('0x1e')]||null:null,'limit':_0x93b107[_0xe04d('0x1b')]?_0x93b107['options']['limit']||null:null,'include':_0x93b107['options']?_0x93b107[_0xe04d('0x1b')]['include']?_['map'](_0x93b107[_0xe04d('0x1b')][_0xe04d('0x1f')],function(_0x495f73){return{'model':db[_0x495f73[_0xe04d('0x20')]],'as':_0x495f73['as'],'attributes':_0x495f73['attributes'],'include':_0x495f73[_0xe04d('0x1f')]?_['map'](_0x495f73[_0xe04d('0x1f')],function(_0x456822){return{'model':db[_0x456822[_0xe04d('0x20')]],'as':_0x456822['as'],'attributes':_0x456822[_0xe04d('0x1e')],'include':_0x456822[_0xe04d('0x1f')]?_['map'](_0x456822[_0xe04d('0x1f')],function(_0x3e43ca){return{'model':db[_0x3e43ca[_0xe04d('0x20')]],'as':_0x3e43ca['as'],'attributes':_0x3e43ca[_0xe04d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc73068){logger[_0xe04d('0xd')](_0xe04d('0x18'),_0x93b107);logger['debug'](_0xe04d('0x18'),_0x93b107,JSON['stringify'](_0xc73068));_0x35a2b4(_0xc73068);})['catch'](function(_0x569e4b){logger[_0xe04d('0x12')](_0xe04d('0x18'),_0x569e4b['message'],_0x93b107);_0x251772(_0x4090e0['error'](0x1f4,_0x569e4b[_0xe04d('0x14')]));});});};exports[_0xe04d('0x21')]=function(_0xff4dfb){var _0x4a2a10=this;return new Promise(function(_0x2cf005,_0x370cea){return db['Interval'][_0xe04d('0x22')]({'raw':_0xff4dfb['options']?_0xff4dfb[_0xe04d('0x1b')][_0xe04d('0x1c')]===undefined?!![]:![]:!![],'where':_0xff4dfb['options']?_0xff4dfb[_0xe04d('0x1b')]['where']||null:null,'attributes':_0xff4dfb[_0xe04d('0x1b')]?_0xff4dfb[_0xe04d('0x1b')][_0xe04d('0x1e')]||null:null,'include':_0xff4dfb[_0xe04d('0x1b')]?_0xff4dfb[_0xe04d('0x1b')][_0xe04d('0x1f')]?_[_0xe04d('0x23')](_0xff4dfb['options'][_0xe04d('0x1f')],function(_0x152837){return{'model':db[_0x152837[_0xe04d('0x20')]],'as':_0x152837['as'],'attributes':_0x152837[_0xe04d('0x1e')],'include':_0x152837[_0xe04d('0x1f')]?_[_0xe04d('0x23')](_0x152837[_0xe04d('0x1f')],function(_0x10b44f){return{'model':db[_0x10b44f[_0xe04d('0x20')]],'as':_0x10b44f['as'],'attributes':_0x10b44f['attributes'],'include':_0x10b44f[_0xe04d('0x1f')]?_['map'](_0x10b44f[_0xe04d('0x1f')],function(_0x547f56){return{'model':db[_0x547f56['model']],'as':_0x547f56['as'],'attributes':_0x547f56[_0xe04d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe04d('0xc')](function(_0x261116){logger[_0xe04d('0xd')]('ShowInterval',_0xff4dfb);logger[_0xe04d('0xf')](_0xe04d('0x21'),_0xff4dfb,JSON[_0xe04d('0x11')](_0x261116));_0x2cf005(_0x261116);})[_0xe04d('0x17')](function(_0x322228){logger['error']('ShowInterval',_0x322228[_0xe04d('0x14')],_0xff4dfb);_0x370cea(_0x4a2a10['error'](0x1f4,_0x322228['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 08ac32c..757441f 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x27ff08,_0x5dbdbe){var _0x565bdf=function(_0x2e872b){while(--_0x2e872b){_0x27ff08['push'](_0x27ff08['shift']());}};_0x565bdf(++_0x5dbdbe);}(_0x2ef3,0xba));var _0x32ef=function(_0x591a9b,_0x5e8e55){_0x591a9b=_0x591a9b-0x0;var _0x546d6c=_0x2ef3[_0x591a9b];return _0x546d6c;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x515e72,_0x224638){var _0x21d3bf=function(_0x46dfbe){while(--_0x46dfbe){_0x515e72['push'](_0x515e72['shift']());}};_0x21d3bf(++_0x224638);}(_0x5f2f,0x73));var _0xf5f2=function(_0x26a4fb,_0x58ef61){_0x26a4fb=_0x26a4fb-0x0;var _0x542743=_0x5f2f[_0x26a4fb];return _0x542743;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e15fdcf..dd873ed 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 _0xa9e0=['Basic\x20','toString','base64','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var BPromise=require(_0x0a9e('0x0'));var https=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var USERNAME='support';var PASSWORD=_0x0a9e('0x3');function openIssue(_0x4ce2f1,_0x333808){var _0x432180={'fields':{'project':{'key':_0x4ce2f1[_0x0a9e('0x4')]||_0x0a9e('0x5')},'summary':(_0x4ce2f1[_0x0a9e('0x6')]||'Report')+_0x0a9e('0x7')+_0x4ce2f1['ip'],'description':_0x4ce2f1[_0x0a9e('0x8')]||JSON[_0x0a9e('0x9')](_0x4ce2f1),'issuetype':{'name':_0x4ce2f1['issuetype']||'Bug'}}};_0x432180[_0x0a9e('0xa')]['customfield_11500']=_0x4ce2f1['email'];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xb')]=_0x4ce2f1[_0x0a9e('0xc')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xd')]=_0x4ce2f1[_0x0a9e('0xe')];_0x432180['fields']['customfield_11503']=_0x4ce2f1['name'];_0x432180['fields'][_0x0a9e('0xf')]=_0x4ce2f1[_0x0a9e('0x10')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0x11')]=_0x4ce2f1['ip'];var _0x32d742={'host':_0x0a9e('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0a9e('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x0a9e('0x14'),'Authorization':_0x0a9e('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x0a9e('0x16')](_0x0a9e('0x17'))}};var _0x4d5611=JSON['stringify'](_0x432180);var _0x22dccb=https['request'](_0x32d742,function(_0x1985b6){_0x1985b6['setEncoding'](_0x0a9e('0x18'));var _0x12066b='';_0x1985b6['on']('data',function(_0x225616){_0x12066b+=_0x225616;});_0x1985b6['on']('end',function(){if(_0x333808){return _0x333808[_0x0a9e('0x19')](_0x1985b6[_0x0a9e('0x1a')])[_0x0a9e('0x1b')](JSON[_0x0a9e('0x1c')](_0x12066b));}});});_0x22dccb['on'](_0x0a9e('0x1d'),function(_0x2eb11f){if(_0x333808){return _0x333808[_0x0a9e('0x19')](0x1f4)[_0x0a9e('0x1b')]({'errors':[{'message':_0x0a9e('0x1e'),'type':_0x0a9e('0x1f')}]});}});_0x22dccb[_0x0a9e('0x20')](_0x4d5611);_0x22dccb[_0x0a9e('0x21')]();}exports['openIssue']=openIssue;exports[_0x0a9e('0x22')]=function(_0x155cce,_0x53682f){_0x155cce[_0x0a9e('0x23')]['ip']=_0x155cce['headers']['x-forwarded-for']||_0x155cce[_0x0a9e('0x24')][_0x0a9e('0x25')]||_0x155cce[_0x0a9e('0x26')][_0x0a9e('0x25')]||_0x155cce['connection'][_0x0a9e('0x26')][_0x0a9e('0x25')];return openIssue(_0x155cce[_0x0a9e('0x23')],_0x53682f);}; \ No newline at end of file +var _0xa9e0=['Basic\x20','toString','base64','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json'];(function(_0x14ed4e,_0x3dcf54){var _0x5c3d8a=function(_0x284a91){while(--_0x284a91){_0x14ed4e['push'](_0x14ed4e['shift']());}};_0x5c3d8a(++_0x3dcf54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var https=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var USERNAME='support';var PASSWORD=_0x0a9e('0x3');function openIssue(_0x4ce2f1,_0x333808){var _0x432180={'fields':{'project':{'key':_0x4ce2f1[_0x0a9e('0x4')]||_0x0a9e('0x5')},'summary':(_0x4ce2f1[_0x0a9e('0x6')]||'Report')+_0x0a9e('0x7')+_0x4ce2f1['ip'],'description':_0x4ce2f1[_0x0a9e('0x8')]||JSON[_0x0a9e('0x9')](_0x4ce2f1),'issuetype':{'name':_0x4ce2f1['issuetype']||'Bug'}}};_0x432180[_0x0a9e('0xa')]['customfield_11500']=_0x4ce2f1['email'];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xb')]=_0x4ce2f1[_0x0a9e('0xc')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xd')]=_0x4ce2f1[_0x0a9e('0xe')];_0x432180['fields']['customfield_11503']=_0x4ce2f1['name'];_0x432180['fields'][_0x0a9e('0xf')]=_0x4ce2f1[_0x0a9e('0x10')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0x11')]=_0x4ce2f1['ip'];var _0x32d742={'host':_0x0a9e('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0a9e('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x0a9e('0x14'),'Authorization':_0x0a9e('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x0a9e('0x16')](_0x0a9e('0x17'))}};var _0x4d5611=JSON['stringify'](_0x432180);var _0x22dccb=https['request'](_0x32d742,function(_0x1985b6){_0x1985b6['setEncoding'](_0x0a9e('0x18'));var _0x12066b='';_0x1985b6['on']('data',function(_0x225616){_0x12066b+=_0x225616;});_0x1985b6['on']('end',function(){if(_0x333808){return _0x333808[_0x0a9e('0x19')](_0x1985b6[_0x0a9e('0x1a')])[_0x0a9e('0x1b')](JSON[_0x0a9e('0x1c')](_0x12066b));}});});_0x22dccb['on'](_0x0a9e('0x1d'),function(_0x2eb11f){if(_0x333808){return _0x333808[_0x0a9e('0x19')](0x1f4)[_0x0a9e('0x1b')]({'errors':[{'message':_0x0a9e('0x1e'),'type':_0x0a9e('0x1f')}]});}});_0x22dccb[_0x0a9e('0x20')](_0x4d5611);_0x22dccb[_0x0a9e('0x21')]();}exports['openIssue']=openIssue;exports[_0x0a9e('0x22')]=function(_0x155cce,_0x53682f){_0x155cce[_0x0a9e('0x23')]['ip']=_0x155cce['headers']['x-forwarded-for']||_0x155cce[_0x0a9e('0x24')][_0x0a9e('0x25')]||_0x155cce[_0x0a9e('0x26')][_0x0a9e('0x25')]||_0x155cce['connection'][_0x0a9e('0x26')][_0x0a9e('0x25')];return openIssue(_0x155cce[_0x0a9e('0x23')],_0x53682f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index be32cd1..108be15 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 _0xcc3b=['./jscriptyAnswerReport.controller','get','index','describe','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d4e15,_0x17ad72){var _0x20d2a4=function(_0x32ceee){while(--_0x32ceee){_0x3d4e15['push'](_0x3d4e15['shift']());}};_0x20d2a4(++_0x17ad72);}(_0xcc3b,0x7f));var _0xbcc3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcc3b[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xbcc3('0x0'));var util=require(_0xbcc3('0x1'));var path=require('path');var timeout=require(_0xbcc3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbcc3('0x3'));var interaction=require(_0xbcc3('0x4'));var config=require(_0xbcc3('0x5'));var controller=require(_0xbcc3('0x6'));router[_0xbcc3('0x7')]('/',auth['isAuthenticated'](),controller[_0xbcc3('0x8')]);router[_0xbcc3('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xbcc3('0x9')]);router[_0xbcc3('0x7')]('/:id',auth[_0xbcc3('0xa')](),controller[_0xbcc3('0xb')]);router[_0xbcc3('0xc')]('/',auth[_0xbcc3('0xa')](),controller[_0xbcc3('0xd')]);router[_0xbcc3('0xe')](_0xbcc3('0xf'),auth['isAuthenticated'](),controller[_0xbcc3('0x10')]);router['delete']('/:id',auth[_0xbcc3('0xa')](),controller[_0xbcc3('0x11')]);module[_0xbcc3('0x12')]=router; \ No newline at end of file +var _0x4e3d=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4e3d,0x105));var _0xd4e3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4e3d[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xd4e3('0x0'));var util=require(_0xd4e3('0x1'));var path=require('path');var timeout=require(_0xd4e3('0x2'));var express=require(_0xd4e3('0x3'));var router=express[_0xd4e3('0x4')]();var auth=require(_0xd4e3('0x5'));var interaction=require(_0xd4e3('0x6'));var config=require('../../config/environment');var controller=require(_0xd4e3('0x7'));router['get']('/',auth[_0xd4e3('0x8')](),controller[_0xd4e3('0x9')]);router['get'](_0xd4e3('0xa'),auth[_0xd4e3('0x8')](),controller[_0xd4e3('0xb')]);router['get'](_0xd4e3('0xc'),auth['isAuthenticated'](),controller[_0xd4e3('0xd')]);router['post']('/',auth[_0xd4e3('0x8')](),controller[_0xd4e3('0xe')]);router[_0xd4e3('0xf')](_0xd4e3('0xc'),auth['isAuthenticated'](),controller[_0xd4e3('0x10')]);router[_0xd4e3('0x11')]('/:id',auth[_0xd4e3('0x8')](),controller['destroy']);module[_0xd4e3('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 a8e3620..5143e5b 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 _0x80c7=['TEXT','sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x80c7,0x8d));var _0x780c=function(_0xb9fb50,_0x31a651){_0xb9fb50=_0xb9fb50-0x0;var _0x3cb32d=_0x80c7[_0xb9fb50];return _0x3cb32d;};'use strict';var Sequelize=require(_0x780c('0x0'));module[_0x780c('0x1')]={'question':{'type':Sequelize[_0x780c('0x2')]},'answer':{'type':Sequelize[_0x780c('0x3')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x780c('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x780c('0x2')]},'calleridname':{'type':Sequelize[_0x780c('0x2')]},'calleridnum':{'type':Sequelize[_0x780c('0x2')]},'questionId':{'type':Sequelize[_0x780c('0x2')]}}; \ No newline at end of file +var _0xe43c=['exports','STRING','TEXT','long','sequelize'];(function(_0x26ac27,_0x574b86){var _0x44a599=function(_0x130e2c){while(--_0x130e2c){_0x26ac27['push'](_0x26ac27['shift']());}};_0x44a599(++_0x574b86);}(_0xe43c,0x180));var _0xce43=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe43c[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'question':{'type':Sequelize[_0xce43('0x2')]},'answer':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x4'))},'membername':{'type':Sequelize[_0xce43('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xce43('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xce43('0x2')]},'calleridnum':{'type':Sequelize[_0xce43('0x2')]},'questionId':{'type':Sequelize[_0xce43('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index c9f5677..9b0517e 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 _0x99de=['update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','then','destroy','end','stack','name','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','map','type','key','field','merge','options','catch','params','includeAll','find','create','body'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0x99de,0x8a));var _0xe99d=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x99de[_0xe15270];return _0x1e813b;};'use strict';var pdf=require(_0xe99d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe99d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe99d('0x2'));var rp=require(_0xe99d('0x3'));var moment=require(_0xe99d('0x4'));var BPromise=require(_0xe99d('0x5'));var Mustache=require('mustache');var util=require(_0xe99d('0x6'));var path=require(_0xe99d('0x7'));var sox=require(_0xe99d('0x8'));var csv=require(_0xe99d('0x9'));var ejs=require(_0xe99d('0xa'));var fs=require('fs');var _=require(_0xe99d('0xb'));var squel=require(_0xe99d('0xc'));var crypto=require('crypto');var jsforce=require(_0xe99d('0xd'));var deskjs=require(_0xe99d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe99d('0xf'));var Papa=require(_0xe99d('0x10'));var Redis=require(_0xe99d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe99d('0x12'));var hardwareService=require(_0xe99d('0x13'));var logger=require(_0xe99d('0x14'))('api');var utils=require(_0xe99d('0x15'));var config=require(_0xe99d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d5f2,_0x54ffc3){_0x54ffc3=_0x54ffc3||0xcc;return function(_0x49b497){if(_0x49b497){return _0x10d5f2[_0xe99d('0x17')](_0x54ffc3);}return _0x10d5f2[_0xe99d('0x18')](_0x54ffc3)['end']();};}function respondWithResult(_0x55d532,_0x4c1b4d){_0x4c1b4d=_0x4c1b4d||0xc8;return function(_0x588bd8){if(_0x588bd8){return _0x55d532[_0xe99d('0x18')](_0x4c1b4d)[_0xe99d('0x19')](_0x588bd8);}};}function respondWithFilteredResult(_0x149a9f,_0x4eefb5){return function(_0x5a6910){if(_0x5a6910){var _0x1264ef=_0x5a6910[_0xe99d('0x1a')],_0x9b7cd7=_0x4eefb5[_0xe99d('0x1b')],_0x5f5abb=_0x4eefb5['offset']+_0x4eefb5['limit'],_0x1ab36b;if(_0x5f5abb>=_0x1264ef){_0x5f5abb=_0x1264ef;_0x1ab36b=0xc8;}else{_0x1ab36b=0xce;}_0x149a9f[_0xe99d('0x18')](_0x1ab36b);return _0x149a9f[_0xe99d('0x1c')](_0xe99d('0x1d'),_0x9b7cd7+'-'+_0x5f5abb+'/'+_0x1264ef)[_0xe99d('0x19')](_0x5a6910);}return null;};}function patchUpdates(_0x15b438){return function(_0x70625a){try{jsonpatch[_0xe99d('0x1e')](_0x70625a,_0x15b438,!![]);}catch(_0x34849a){return BPromise[_0xe99d('0x1f')](_0x34849a);}return _0x70625a['save']();};}function saveUpdates(_0x11aaca,_0x13f65f){return function(_0x51ad0a){if(_0x51ad0a){return _0x51ad0a['update'](_0x11aaca)[_0xe99d('0x20')](function(_0x24397f){return _0x24397f;});}return null;};}function removeEntity(_0x30c2bb,_0x58088c){return function(_0x5a8471){if(_0x5a8471){return _0x5a8471[_0xe99d('0x21')]()[_0xe99d('0x20')](function(){_0x30c2bb[_0xe99d('0x18')](0xcc)[_0xe99d('0x22')]();});}};}function handleEntityNotFound(_0x2220cf,_0x2b352b){return function(_0x452796){if(!_0x452796){_0x2220cf[_0xe99d('0x17')](0x194);}return _0x452796;};}function handleError(_0x542b36,_0x3f76e0){_0x3f76e0=_0x3f76e0||0x1f4;return function(_0x1fd42b){logger['error'](_0x1fd42b[_0xe99d('0x23')]);if(_0x1fd42b[_0xe99d('0x24')]){delete _0x1fd42b[_0xe99d('0x24')];}_0x542b36[_0xe99d('0x18')](_0x3f76e0)['send'](_0x1fd42b);};}exports['index']=function(_0x1fc112,_0x26c494){var _0x4a4eac={},_0x4fc273={},_0xfb63f2={'count':0x0,'rows':[]};var _0x7fd7e3=db[_0xe99d('0x25')][_0xe99d('0x26')];_0x4fc273[_0xe99d('0x27')]=_[_0xe99d('0x28')](_0x7fd7e3);_0x4fc273[_0xe99d('0x29')]=_['keys'](_0x1fc112['query']);_0x4fc273[_0xe99d('0x2a')]=_[_0xe99d('0x2b')](_0x4fc273[_0xe99d('0x27')],_0x4fc273[_0xe99d('0x29')]);_0x4a4eac[_0xe99d('0x2c')]=_['intersection'](_0x4fc273['model'],qs[_0xe99d('0x2d')](_0x1fc112[_0xe99d('0x29')][_0xe99d('0x2d')]));_0x4a4eac['attributes']=_0x4a4eac[_0xe99d('0x2c')][_0xe99d('0x2e')]?_0x4a4eac[_0xe99d('0x2c')]:_0x4fc273[_0xe99d('0x27')];if(!_0x1fc112[_0xe99d('0x29')]['hasOwnProperty'](_0xe99d('0x2f'))){_0x4a4eac['limit']=qs['limit'](_0x1fc112[_0xe99d('0x29')][_0xe99d('0x30')]);_0x4a4eac['offset']=qs['offset'](_0x1fc112[_0xe99d('0x29')]['offset']);}_0x4a4eac[_0xe99d('0x31')]=qs['sort'](_0x1fc112[_0xe99d('0x29')][_0xe99d('0x32')]);_0x4a4eac[_0xe99d('0x33')]=qs[_0xe99d('0x2a')](_[_0xe99d('0x34')](_0x1fc112[_0xe99d('0x29')],_0x4fc273[_0xe99d('0x2a')]));if(_0x1fc112[_0xe99d('0x29')][_0xe99d('0x35')]){_0x4a4eac['where']=_['merge'](_0x4a4eac['where'],{'$or':_[_0xe99d('0x36')](_0x7fd7e3,function(_0x231c82){if(_0x231c82[_0xe99d('0x37')][_0xe99d('0x38')]!=='VIRTUAL'){var _0x4285e9={};_0x4285e9[_0x231c82[_0xe99d('0x39')]]={'$like':'%'+_0x1fc112['query'][_0xe99d('0x35')]+'%'};return _0x4285e9;}})});}_0x4a4eac=_[_0xe99d('0x3a')]({},_0x4a4eac,_0x1fc112[_0xe99d('0x3b')]);var _0x1176cb={'where':_0x4a4eac[_0xe99d('0x33')]};return db['JscriptyAnswerReport']['count'](_0x1176cb)[_0xe99d('0x20')](function(_0x214ad6){_0xfb63f2[_0xe99d('0x1a')]=_0x214ad6;if(_0x1fc112[_0xe99d('0x29')]['includeAll']){_0x4a4eac['include']=[{'all':!![]}];}return db[_0xe99d('0x25')]['findAll'](_0x4a4eac);})[_0xe99d('0x20')](function(_0x44823d){_0xfb63f2['rows']=_0x44823d;return _0xfb63f2;})[_0xe99d('0x20')](respondWithFilteredResult(_0x26c494,_0x4a4eac))[_0xe99d('0x3c')](handleError(_0x26c494,null));};exports['show']=function(_0x5ee3d2,_0x282047){var _0x901628={'raw':!![],'where':{'id':_0x5ee3d2[_0xe99d('0x3d')]['id']}},_0x12eebd={};_0x12eebd['model']=_[_0xe99d('0x28')](db[_0xe99d('0x25')][_0xe99d('0x26')]);_0x12eebd[_0xe99d('0x29')]=_['keys'](_0x5ee3d2[_0xe99d('0x29')]);_0x12eebd['filters']=_['intersection'](_0x12eebd[_0xe99d('0x27')],_0x12eebd[_0xe99d('0x29')]);_0x901628[_0xe99d('0x2c')]=_['intersection'](_0x12eebd[_0xe99d('0x27')],qs['fields'](_0x5ee3d2[_0xe99d('0x29')][_0xe99d('0x2d')]));_0x901628[_0xe99d('0x2c')]=_0x901628[_0xe99d('0x2c')][_0xe99d('0x2e')]?_0x901628['attributes']:_0x12eebd[_0xe99d('0x27')];if(_0x5ee3d2['query'][_0xe99d('0x3e')]){_0x901628['include']=[{'all':!![]}];}_0x901628=_[_0xe99d('0x3a')]({},_0x901628,_0x5ee3d2[_0xe99d('0x3b')]);return db[_0xe99d('0x25')][_0xe99d('0x3f')](_0x901628)[_0xe99d('0x20')](handleEntityNotFound(_0x282047,null))[_0xe99d('0x20')](respondWithResult(_0x282047,null))[_0xe99d('0x3c')](handleError(_0x282047,null));};exports[_0xe99d('0x40')]=function(_0x255db3,_0x27752a){return db[_0xe99d('0x25')][_0xe99d('0x40')](_0x255db3[_0xe99d('0x41')],{})['then'](respondWithResult(_0x27752a,0xc9))['catch'](handleError(_0x27752a,null));};exports[_0xe99d('0x42')]=function(_0x35f6bb,_0x2d4f49){if(_0x35f6bb[_0xe99d('0x41')]['id']){delete _0x35f6bb['body']['id'];}return db['JscriptyAnswerReport'][_0xe99d('0x3f')]({'where':{'id':_0x35f6bb[_0xe99d('0x3d')]['id']}})[_0xe99d('0x20')](handleEntityNotFound(_0x2d4f49,null))[_0xe99d('0x20')](saveUpdates(_0x35f6bb[_0xe99d('0x41')],null))['then'](respondWithResult(_0x2d4f49,null))[_0xe99d('0x3c')](handleError(_0x2d4f49,null));};exports[_0xe99d('0x21')]=function(_0x7c42d6,_0x2e0c5c){return db[_0xe99d('0x25')][_0xe99d('0x3f')]({'where':{'id':_0x7c42d6[_0xe99d('0x3d')]['id']}})[_0xe99d('0x20')](handleEntityNotFound(_0x2e0c5c,null))[_0xe99d('0x20')](removeEntity(_0x2e0c5c,null))[_0xe99d('0x3c')](handleError(_0x2e0c5c,null));};exports['describe']=function(_0x5908cd,_0x465966){return db['JscriptyAnswerReport'][_0xe99d('0x43')]()[_0xe99d('0x20')](respondWithResult(_0x465966,null))['catch'](handleError(_0x465966,null));}; \ No newline at end of file +var _0xbffb=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','key','field','count','includeAll','include','findAll','catch','show','length','options','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','apply','save','update','destroy','then','sendStatus','error','send','index','JscriptyAnswerReport','rawAttributes','keys','query','intersection','model','fields'];(function(_0x167914,_0x87b5a){var _0x5e5d79=function(_0x221d4e){while(--_0x221d4e){_0x167914['push'](_0x167914['shift']());}};_0x5e5d79(++_0x87b5a);}(_0xbffb,0x1b7));var _0xbbff=function(_0x7a2a2f,_0x26057a){_0x7a2a2f=_0x7a2a2f-0x0;var _0x4fbb2a=_0xbffb[_0x7a2a2f];return _0x4fbb2a;};'use strict';var pdf=require(_0xbbff('0x0'));var emlformat=require(_0xbbff('0x1'));var rimraf=require(_0xbbff('0x2'));var zipdir=require(_0xbbff('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbff('0x4'));var moment=require('moment');var BPromise=require(_0xbbff('0x5'));var Mustache=require(_0xbbff('0x6'));var util=require(_0xbbff('0x7'));var path=require(_0xbbff('0x8'));var sox=require(_0xbbff('0x9'));var csv=require('to-csv');var ejs=require(_0xbbff('0xa'));var fs=require('fs');var _=require(_0xbbff('0xb'));var squel=require(_0xbbff('0xc'));var crypto=require(_0xbbff('0xd'));var jsforce=require(_0xbbff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbbff('0xf'));var querystring=require(_0xbbff('0x10'));var Papa=require(_0xbbff('0x11'));var Redis=require('ioredis');var authService=require(_0xbbff('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbff('0x13'))(_0xbbff('0x14'));var utils=require(_0xbbff('0x15'));var config=require(_0xbbff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x104385,_0x37a24f){_0x37a24f=_0x37a24f||0xcc;return function(_0x280a34){if(_0x280a34){return _0x104385['sendStatus'](_0x37a24f);}return _0x104385[_0xbbff('0x17')](_0x37a24f)[_0xbbff('0x18')]();};}function respondWithResult(_0x577f5d,_0x5c8cf5){_0x5c8cf5=_0x5c8cf5||0xc8;return function(_0x226cd3){if(_0x226cd3){return _0x577f5d['status'](_0x5c8cf5)[_0xbbff('0x19')](_0x226cd3);}};}function respondWithFilteredResult(_0x5607fe,_0x34dd31){return function(_0x2eae71){if(_0x2eae71){var _0x117a56=_0x2eae71['count'],_0x874ff8=_0x34dd31[_0xbbff('0x1a')],_0x5ba84b=_0x34dd31[_0xbbff('0x1a')]+_0x34dd31[_0xbbff('0x1b')],_0x27a08d;if(_0x5ba84b>=_0x117a56){_0x5ba84b=_0x117a56;_0x27a08d=0xc8;}else{_0x27a08d=0xce;}_0x5607fe[_0xbbff('0x17')](_0x27a08d);return _0x5607fe['set']('Content-Range',_0x874ff8+'-'+_0x5ba84b+'/'+_0x117a56)[_0xbbff('0x19')](_0x2eae71);}return null;};}function patchUpdates(_0x4f5f11){return function(_0x563699){try{jsonpatch[_0xbbff('0x1c')](_0x563699,_0x4f5f11,!![]);}catch(_0x5e3c59){return BPromise['reject'](_0x5e3c59);}return _0x563699[_0xbbff('0x1d')]();};}function saveUpdates(_0x4e1a81,_0x393dd8){return function(_0x31f18b){if(_0x31f18b){return _0x31f18b[_0xbbff('0x1e')](_0x4e1a81)['then'](function(_0x19fedb){return _0x19fedb;});}return null;};}function removeEntity(_0x576865,_0x3d7745){return function(_0x282389){if(_0x282389){return _0x282389[_0xbbff('0x1f')]()[_0xbbff('0x20')](function(){_0x576865[_0xbbff('0x17')](0xcc)[_0xbbff('0x18')]();});}};}function handleEntityNotFound(_0x3de828,_0x3ce922){return function(_0x523dc5){if(!_0x523dc5){_0x3de828[_0xbbff('0x21')](0x194);}return _0x523dc5;};}function handleError(_0x2e4a90,_0x3b1d68){_0x3b1d68=_0x3b1d68||0x1f4;return function(_0x1a1e94){logger[_0xbbff('0x22')](_0x1a1e94['stack']);if(_0x1a1e94['name']){delete _0x1a1e94['name'];}_0x2e4a90[_0xbbff('0x17')](_0x3b1d68)[_0xbbff('0x23')](_0x1a1e94);};}exports[_0xbbff('0x24')]=function(_0x58b65f,_0x3d1239){var _0xb95a76={},_0x2a85c8={},_0x5d3e38={'count':0x0,'rows':[]};var _0x3e5ab4=db[_0xbbff('0x25')][_0xbbff('0x26')];_0x2a85c8['model']=_[_0xbbff('0x27')](_0x3e5ab4);_0x2a85c8[_0xbbff('0x28')]=_[_0xbbff('0x27')](_0x58b65f[_0xbbff('0x28')]);_0x2a85c8['filters']=_[_0xbbff('0x29')](_0x2a85c8[_0xbbff('0x2a')],_0x2a85c8[_0xbbff('0x28')]);_0xb95a76['attributes']=_[_0xbbff('0x29')](_0x2a85c8[_0xbbff('0x2a')],qs[_0xbbff('0x2b')](_0x58b65f[_0xbbff('0x28')][_0xbbff('0x2b')]));_0xb95a76[_0xbbff('0x2c')]=_0xb95a76['attributes']['length']?_0xb95a76['attributes']:_0x2a85c8[_0xbbff('0x2a')];if(!_0x58b65f[_0xbbff('0x28')][_0xbbff('0x2d')](_0xbbff('0x2e'))){_0xb95a76[_0xbbff('0x1b')]=qs[_0xbbff('0x1b')](_0x58b65f[_0xbbff('0x28')][_0xbbff('0x1b')]);_0xb95a76[_0xbbff('0x1a')]=qs[_0xbbff('0x1a')](_0x58b65f[_0xbbff('0x28')][_0xbbff('0x1a')]);}_0xb95a76[_0xbbff('0x2f')]=qs[_0xbbff('0x30')](_0x58b65f['query'][_0xbbff('0x30')]);_0xb95a76[_0xbbff('0x31')]=qs['filters'](_[_0xbbff('0x32')](_0x58b65f[_0xbbff('0x28')],_0x2a85c8[_0xbbff('0x33')]));if(_0x58b65f[_0xbbff('0x28')][_0xbbff('0x34')]){_0xb95a76['where']=_[_0xbbff('0x35')](_0xb95a76[_0xbbff('0x31')],{'$or':_[_0xbbff('0x36')](_0x3e5ab4,function(_0x37d838){if(_0x37d838['type'][_0xbbff('0x37')]!=='VIRTUAL'){var _0x252a81={};_0x252a81[_0x37d838[_0xbbff('0x38')]]={'$like':'%'+_0x58b65f[_0xbbff('0x28')]['filter']+'%'};return _0x252a81;}})});}_0xb95a76=_[_0xbbff('0x35')]({},_0xb95a76,_0x58b65f['options']);var _0xf954eb={'where':_0xb95a76[_0xbbff('0x31')]};return db['JscriptyAnswerReport'][_0xbbff('0x39')](_0xf954eb)[_0xbbff('0x20')](function(_0x504e19){_0x5d3e38[_0xbbff('0x39')]=_0x504e19;if(_0x58b65f[_0xbbff('0x28')][_0xbbff('0x3a')]){_0xb95a76[_0xbbff('0x3b')]=[{'all':!![]}];}return db[_0xbbff('0x25')][_0xbbff('0x3c')](_0xb95a76);})[_0xbbff('0x20')](function(_0x4e62c3){_0x5d3e38['rows']=_0x4e62c3;return _0x5d3e38;})[_0xbbff('0x20')](respondWithFilteredResult(_0x3d1239,_0xb95a76))[_0xbbff('0x3d')](handleError(_0x3d1239,null));};exports[_0xbbff('0x3e')]=function(_0x31470f,_0x52db77){var _0x2190ab={'raw':!![],'where':{'id':_0x31470f['params']['id']}},_0x381b8e={};_0x381b8e[_0xbbff('0x2a')]=_['keys'](db[_0xbbff('0x25')][_0xbbff('0x26')]);_0x381b8e[_0xbbff('0x28')]=_[_0xbbff('0x27')](_0x31470f[_0xbbff('0x28')]);_0x381b8e[_0xbbff('0x33')]=_[_0xbbff('0x29')](_0x381b8e[_0xbbff('0x2a')],_0x381b8e[_0xbbff('0x28')]);_0x2190ab[_0xbbff('0x2c')]=_[_0xbbff('0x29')](_0x381b8e[_0xbbff('0x2a')],qs['fields'](_0x31470f[_0xbbff('0x28')]['fields']));_0x2190ab[_0xbbff('0x2c')]=_0x2190ab[_0xbbff('0x2c')][_0xbbff('0x3f')]?_0x2190ab[_0xbbff('0x2c')]:_0x381b8e['model'];if(_0x31470f['query']['includeAll']){_0x2190ab[_0xbbff('0x3b')]=[{'all':!![]}];}_0x2190ab=_[_0xbbff('0x35')]({},_0x2190ab,_0x31470f[_0xbbff('0x40')]);return db[_0xbbff('0x25')][_0xbbff('0x41')](_0x2190ab)[_0xbbff('0x20')](handleEntityNotFound(_0x52db77,null))[_0xbbff('0x20')](respondWithResult(_0x52db77,null))[_0xbbff('0x3d')](handleError(_0x52db77,null));};exports['create']=function(_0x762000,_0x106c9e){return db['JscriptyAnswerReport']['create'](_0x762000[_0xbbff('0x42')],{})[_0xbbff('0x20')](respondWithResult(_0x106c9e,0xc9))[_0xbbff('0x3d')](handleError(_0x106c9e,null));};exports['update']=function(_0x5bfe7b,_0x2c76be){if(_0x5bfe7b[_0xbbff('0x42')]['id']){delete _0x5bfe7b['body']['id'];}return db[_0xbbff('0x25')][_0xbbff('0x41')]({'where':{'id':_0x5bfe7b[_0xbbff('0x43')]['id']}})[_0xbbff('0x20')](handleEntityNotFound(_0x2c76be,null))[_0xbbff('0x20')](saveUpdates(_0x5bfe7b[_0xbbff('0x42')],null))[_0xbbff('0x20')](respondWithResult(_0x2c76be,null))[_0xbbff('0x3d')](handleError(_0x2c76be,null));};exports[_0xbbff('0x1f')]=function(_0x143ddb,_0x35df3d){return db[_0xbbff('0x25')][_0xbbff('0x41')]({'where':{'id':_0x143ddb[_0xbbff('0x43')]['id']}})[_0xbbff('0x20')](handleEntityNotFound(_0x35df3d,null))[_0xbbff('0x20')](removeEntity(_0x35df3d,null))['catch'](handleError(_0x35df3d,null));};exports[_0xbbff('0x44')]=function(_0x2eade5,_0x4e64cd){return db['JscriptyAnswerReport'][_0xbbff('0x44')]()[_0xbbff('0x20')](respondWithResult(_0x4e64cd,null))[_0xbbff('0x3d')](handleError(_0x4e64cd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 20ded68..25c9ac9 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 _0x228a=['request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5a3ac7,_0xa2bf9b){var _0x11678a=function(_0x36469f){while(--_0x36469f){_0x5a3ac7['push'](_0x5a3ac7['shift']());}};_0x11678a(++_0xa2bf9b);}(_0x228a,0xa4));var _0xa228=function(_0x404a72,_0x97fb5e){_0x404a72=_0x404a72-0x0;var _0xa18d8c=_0x228a[_0x404a72];return _0xa18d8c;};'use strict';var _=require(_0xa228('0x0'));var util=require(_0xa228('0x1'));var logger=require(_0xa228('0x2'))('api');var moment=require(_0xa228('0x3'));var BPromise=require(_0xa228('0x4'));var rp=require(_0xa228('0x5'));var fs=require('fs');var path=require(_0xa228('0x6'));var rimraf=require('rimraf');var config=require(_0xa228('0x7'));var attributes=require(_0xa228('0x8'));module[_0xa228('0x9')]=function(_0x419923,_0x4302dd){return _0x419923[_0xa228('0xa')](_0xa228('0xb'),attributes,{'tableName':_0xa228('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b4c=['./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x48fd78,_0x4b9f37){var _0x1b95b1=function(_0x449a44){while(--_0x449a44){_0x48fd78['push'](_0x48fd78['shift']());}};_0x1b95b1(++_0x4b9f37);}(_0x6b4c,0x117));var _0xc6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6b4('0x0'));var util=require(_0xc6b4('0x1'));var logger=require(_0xc6b4('0x2'))(_0xc6b4('0x3'));var moment=require(_0xc6b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xc6b4('0x5'));var fs=require('fs');var path=require(_0xc6b4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc6b4('0x7'));module[_0xc6b4('0x8')]=function(_0x169366,_0x327ced){return _0x169366['define'](_0xc6b4('0x9'),attributes,{'tableName':_0xc6b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 9242918..ca8c21c 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 _0x96f5=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x677807,_0xb1c8ae){var _0x2478ea=function(_0x15aa28){while(--_0x15aa28){_0x677807['push'](_0x677807['shift']());}};_0x2478ea(++_0xb1c8ae);}(_0x96f5,0x133));var _0x596f=function(_0x2f60d8,_0xee7974){_0x2f60d8=_0x2f60d8-0x0;var _0xa506e9=_0x96f5[_0x2f60d8];return _0xa506e9;};'use strict';var _=require(_0x596f('0x0'));var util=require(_0x596f('0x1'));var moment=require(_0x596f('0x2'));var BPromise=require(_0x596f('0x3'));var rs=require(_0x596f('0x4'));var fs=require('fs');var Redis=require(_0x596f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x596f('0x6'));var logger=require(_0x596f('0x7'))('rpc');var config=require(_0x596f('0x8'));var jayson=require(_0x596f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd9cd,_0x3eaf16,_0x24d9f2){return new BPromise(function(_0x392f78,_0x5241bb){return client['request'](_0x4cd9cd,_0x24d9f2)['then'](function(_0xf9cbe0){logger['info'](_0x596f('0xa'),_0x3eaf16,_0x596f('0xb'));logger['debug'](_0x596f('0xc'),_0x3eaf16,_0x596f('0xb'),JSON[_0x596f('0xd')](_0xf9cbe0));if(_0xf9cbe0[_0x596f('0xe')]){if(_0xf9cbe0[_0x596f('0xe')][_0x596f('0xf')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3eaf16,_0xf9cbe0['error'][_0x596f('0x10')]);return _0x5241bb(_0xf9cbe0[_0x596f('0xe')][_0x596f('0x10')]);}logger[_0x596f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3eaf16,_0xf9cbe0[_0x596f('0xe')][_0x596f('0x10')]);return _0x392f78(_0xf9cbe0[_0x596f('0xe')][_0x596f('0x10')]);}else{logger[_0x596f('0x11')](_0x596f('0xa'),_0x3eaf16,_0x596f('0xb'));_0x392f78(_0xf9cbe0[_0x596f('0x12')][_0x596f('0x10')]);}})['catch'](function(_0x1de95f){logger['error'](_0x596f('0xa'),_0x3eaf16,_0x1de95f);_0x5241bb(_0x1de95f);});});} \ No newline at end of file +var _0xdb35=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x2ef5b8,_0x4c913b){var _0x18bff1=function(_0x5d89b5){while(--_0x5d89b5){_0x2ef5b8['push'](_0x2ef5b8['shift']());}};_0x18bff1(++_0x4c913b);}(_0xdb35,0x8f));var _0x5db3=function(_0x3dd174,_0x31fcf6){_0x3dd174=_0x3dd174-0x0;var _0x2d0e06=_0xdb35[_0x3dd174];return _0x2d0e06;};'use strict';var _=require(_0x5db3('0x0'));var util=require(_0x5db3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5db3('0x2'));var fs=require('fs');var Redis=require(_0x5db3('0x3'));var db=require(_0x5db3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5db3('0x5'))(_0x5db3('0x6'));var config=require('../../config/environment');var jayson=require(_0x5db3('0x7'));var client=jayson[_0x5db3('0x8')][_0x5db3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e74e3,_0x107975,_0x20c1a1){return new BPromise(function(_0x2b0400,_0xfa65d){return client[_0x5db3('0xa')](_0x3e74e3,_0x20c1a1)[_0x5db3('0xb')](function(_0x8d846f){logger[_0x5db3('0xc')](_0x5db3('0xd'),_0x107975,'request\x20sent');logger['debug'](_0x5db3('0xe'),_0x107975,_0x5db3('0xf'),JSON[_0x5db3('0x10')](_0x8d846f));if(_0x8d846f[_0x5db3('0x11')]){if(_0x8d846f[_0x5db3('0x11')][_0x5db3('0x12')]===0x1f4){logger['error'](_0x5db3('0xd'),_0x107975,_0x8d846f[_0x5db3('0x11')][_0x5db3('0x13')]);return _0xfa65d(_0x8d846f[_0x5db3('0x11')]['message']);}logger[_0x5db3('0x11')](_0x5db3('0xd'),_0x107975,_0x8d846f[_0x5db3('0x11')][_0x5db3('0x13')]);return _0x2b0400(_0x8d846f['error'][_0x5db3('0x13')]);}else{logger[_0x5db3('0xc')](_0x5db3('0xd'),_0x107975,_0x5db3('0xf'));_0x2b0400(_0x8d846f['result']['message']);}})[_0x5db3('0x14')](function(_0x2a9182){logger[_0x5db3('0x11')](_0x5db3('0xd'),_0x107975,_0x2a9182);_0xfa65d(_0x2a9182);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 494dd6a..58757d9 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 _0xf1f9=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','getSessions'];(function(_0x5ef55f,_0x3b7c11){var _0x245114=function(_0xb9be2e){while(--_0xb9be2e){_0x5ef55f['push'](_0x5ef55f['shift']());}};_0x245114(++_0x3b7c11);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x126a42,_0x51a8ef){_0x126a42=_0x126a42-0x0;var _0x269949=_0xf1f9[_0x126a42];return _0x269949;};'use strict';var multer=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var path=require(_0x9f1f('0x2'));var timeout=require(_0x9f1f('0x3'));var express=require(_0x9f1f('0x4'));var router=express['Router']();var auth=require(_0x9f1f('0x5'));var interaction=require(_0x9f1f('0x6'));var config=require(_0x9f1f('0x7'));var controller=require(_0x9f1f('0x8'));router[_0x9f1f('0x9')]('/',auth[_0x9f1f('0xa')](),controller['index']);router['get'](_0x9f1f('0xb'),auth[_0x9f1f('0xa')](),controller[_0x9f1f('0xc')]);router[_0x9f1f('0x9')]('/:id/sessions',auth[_0x9f1f('0xa')](),controller[_0x9f1f('0xd')]);router[_0x9f1f('0x9')](_0x9f1f('0xe'),auth[_0x9f1f('0xa')](),controller[_0x9f1f('0xf')]);router[_0x9f1f('0x9')](_0x9f1f('0x10'),auth['isAuthenticated'](),timeout(_0x9f1f('0x11')),controller[_0x9f1f('0x12')]);router[_0x9f1f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f1f('0x13')]('/:id/clone',auth[_0x9f1f('0xa')](),controller[_0x9f1f('0x14')]);router[_0x9f1f('0x15')](_0x9f1f('0xb'),auth[_0x9f1f('0xa')](),controller[_0x9f1f('0x16')]);router[_0x9f1f('0x17')]('/:id',auth[_0x9f1f('0xa')](),controller['destroy']);module[_0x9f1f('0x18')]=router; \ No newline at end of file +var _0x703c=['index','/:id','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','clone','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x31bd6a,_0x19a326){var _0xa747ed=function(_0x380705){while(--_0x380705){_0x31bd6a['push'](_0x31bd6a['shift']());}};_0xa747ed(++_0x19a326);}(_0x703c,0x19e));var _0xc703=function(_0x1fba2a,_0x388738){_0x1fba2a=_0x1fba2a-0x0;var _0x1be278=_0x703c[_0x1fba2a];return _0x1be278;};'use strict';var multer=require(_0xc703('0x0'));var util=require('util');var path=require(_0xc703('0x1'));var timeout=require(_0xc703('0x2'));var express=require(_0xc703('0x3'));var router=express[_0xc703('0x4')]();var auth=require(_0xc703('0x5'));var interaction=require(_0xc703('0x6'));var config=require(_0xc703('0x7'));var controller=require(_0xc703('0x8'));router[_0xc703('0x9')]('/',auth[_0xc703('0xa')](),controller[_0xc703('0xb')]);router[_0xc703('0x9')](_0xc703('0xc'),auth[_0xc703('0xa')](),controller[_0xc703('0xd')]);router['get'](_0xc703('0xe'),auth[_0xc703('0xa')](),controller[_0xc703('0xf')]);router[_0xc703('0x9')]('/:id/answers',auth[_0xc703('0xa')](),controller['getAnswers']);router[_0xc703('0x9')](_0xc703('0x10'),auth[_0xc703('0xa')](),timeout(_0xc703('0x11')),controller[_0xc703('0x12')]);router[_0xc703('0x13')]('/',auth[_0xc703('0xa')](),controller[_0xc703('0x14')]);router[_0xc703('0x13')]('/:id/clone',auth[_0xc703('0xa')](),controller[_0xc703('0x15')]);router[_0xc703('0x16')]('/:id',auth[_0xc703('0xa')](),controller['update']);router[_0xc703('0x17')]('/:id',auth[_0xc703('0xa')](),controller[_0xc703('0x18')]);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 17664d2..ff4bcbd 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 _0x931b=['BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description'];(function(_0x5c0dcb,_0x16cd83){var _0x183a0e=function(_0xfb292d){while(--_0xfb292d){_0x5c0dcb['push'](_0x5c0dcb['shift']());}};_0x183a0e(++_0x16cd83);}(_0x931b,0x10f));var _0xb931=function(_0x409fff,_0x1ef03b){_0x409fff=_0x409fff-0x0;var _0x1d7055=_0x931b[_0x409fff];return _0x1d7055;};'use strict';var Sequelize=require(_0xb931('0x0'));var _=require(_0xb931('0x1'));var util=require(_0xb931('0x2'));module[_0xb931('0x3')]={'name':{'type':Sequelize[_0xb931('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xb931('0x4')]},'formData':{'type':Sequelize[_0xb931('0x5')](_0xb931('0x6')),'set':function(_0x2c28a2){if(_[_0xb931('0x7')](_0x2c28a2)){this['setDataValue'](_0xb931('0x8'),JSON[_0xb931('0x9')](_0x2c28a2));}else if(_[_0xb931('0xa')](_0x2c28a2)){this[_0xb931('0xb')]('formData',_0x2c28a2);}else{this['setDataValue'](_0xb931('0x8'),util['format'](_0xb931('0xc'),this['getDataValue']('name')||'',this['getDataValue'](_0xb931('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb931('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa800=['isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long'];(function(_0x3d8888,_0x3bd9b8){var _0x26aa9e=function(_0x48b85c){while(--_0x48b85c){_0x3d8888['push'](_0x3d8888['shift']());}};_0x26aa9e(++_0x3bd9b8);}(_0xa800,0xa9));var _0x0a80=function(_0x40e854,_0x42f1f6){_0x40e854=_0x40e854-0x0;var _0x1463b3=_0xa800[_0x40e854];return _0x1463b3;};'use strict';var Sequelize=require(_0x0a80('0x0'));var _=require(_0x0a80('0x1'));var util=require(_0x0a80('0x2'));module[_0x0a80('0x3')]={'name':{'type':Sequelize[_0x0a80('0x4')],'unique':_0x0a80('0x5')},'description':{'type':Sequelize[_0x0a80('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x0a80('0x6')),'set':function(_0x35b0d3){if(_[_0x0a80('0x7')](_0x35b0d3)){this['setDataValue'](_0x0a80('0x8'),JSON[_0x0a80('0x9')](_0x35b0d3));}else if(_[_0x0a80('0xa')](_0x35b0d3)){this[_0x0a80('0xb')](_0x0a80('0x8'),_0x35b0d3);}else{this['setDataValue']('formData',util[_0x0a80('0xc')](_0x0a80('0xd'),this['getDataValue']('name')||'',this[_0x0a80('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0a80('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 95c29a5..e0dc2ce 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 _0xda98=['JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','questionId','question','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','text/csv','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','save','then','destroy','get','sendStatus','stack','name','send','rawAttributes','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','merge','where','map','type','key','VIRTUAL','field','JscriptyProject','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','autoAssociation','update','getSessions','findOne','JscriptySessionReport','nolimit','filter','ProjectId'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0xda98,0x1cd));var _0x8da9=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xda98[_0x47a349];return _0x18ab75;};'use strict';var pdf=require(_0x8da9('0x0'));var emlformat=require(_0x8da9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8da9('0x2'));var rp=require(_0x8da9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8da9('0x4'));var util=require(_0x8da9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8da9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8da9('0x7'));var squel=require(_0x8da9('0x8'));var crypto=require(_0x8da9('0x9'));var jsforce=require(_0x8da9('0xa'));var deskjs=require(_0x8da9('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8da9('0xc'));var Papa=require(_0x8da9('0xd'));var Redis=require(_0x8da9('0xe'));var authService=require(_0x8da9('0xf'));var qs=require(_0x8da9('0x10'));var hardwareService=require(_0x8da9('0x11'));var logger=require(_0x8da9('0x12'))(_0x8da9('0x13'));var utils=require('../../config/utils');var config=require(_0x8da9('0x14'));var db=require(_0x8da9('0x15'))['db'];function respondWithStatusCode(_0x238746,_0x5ec1e4){_0x5ec1e4=_0x5ec1e4||0xcc;return function(_0x352fda){if(_0x352fda){return _0x238746['sendStatus'](_0x5ec1e4);}return _0x238746['status'](_0x5ec1e4)['end']();};}function respondWithResult(_0x2b0162,_0x269dd7){_0x269dd7=_0x269dd7||0xc8;return function(_0xaed24b){if(_0xaed24b){return _0x2b0162[_0x8da9('0x16')](_0x269dd7)[_0x8da9('0x17')](_0xaed24b);}};}function respondWithFilteredResult(_0x381908,_0x4fc433){return function(_0x1643ce){if(_0x1643ce){var _0x34b20b=_0x1643ce[_0x8da9('0x18')],_0x39210e=_0x4fc433[_0x8da9('0x19')],_0x5f0e42=_0x4fc433['offset']+_0x4fc433[_0x8da9('0x1a')],_0x4fd67a;if(_0x5f0e42>=_0x34b20b){_0x5f0e42=_0x34b20b;_0x4fd67a=0xc8;}else{_0x4fd67a=0xce;}_0x381908['status'](_0x4fd67a);return _0x381908[_0x8da9('0x1b')]('Content-Range',_0x39210e+'-'+_0x5f0e42+'/'+_0x34b20b)['json'](_0x1643ce);}return null;};}function patchUpdates(_0x4ccf25){return function(_0x513547){try{jsonpatch[_0x8da9('0x1c')](_0x513547,_0x4ccf25,!![]);}catch(_0x9a623a){return BPromise['reject'](_0x9a623a);}return _0x513547[_0x8da9('0x1d')]();};}function saveUpdates(_0x1f4cbd,_0x322923){return function(_0x41cab4){if(_0x41cab4){return _0x41cab4['update'](_0x1f4cbd)[_0x8da9('0x1e')](function(_0x4edfe9){return _0x4edfe9;});}return null;};}function removeEntity(_0x4c17f4,_0x631a8b){return function(_0x51c08f){if(_0x51c08f){return _0x51c08f[_0x8da9('0x1f')]()[_0x8da9('0x1e')](function(){var _0x2bd766=_0x51c08f[_0x8da9('0x20')]({'plain':!![]});var _0x3212d2='Projects';return db['UserProfileResource'][_0x8da9('0x1f')]({'where':{'type':_0x3212d2,'resourceId':_0x2bd766['id']}})[_0x8da9('0x1e')](function(){return _0x51c08f;});})[_0x8da9('0x1e')](function(){_0x4c17f4[_0x8da9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x134b91,_0x225089){return function(_0x57b67d){if(!_0x57b67d){_0x134b91[_0x8da9('0x21')](0x194);}return _0x57b67d;};}function handleError(_0x45336c,_0x152247){_0x152247=_0x152247||0x1f4;return function(_0x33c48d){logger['error'](_0x33c48d[_0x8da9('0x22')]);if(_0x33c48d[_0x8da9('0x23')]){delete _0x33c48d['name'];}_0x45336c[_0x8da9('0x16')](_0x152247)[_0x8da9('0x24')](_0x33c48d);};}exports['index']=function(_0x41c61c,_0x221578){var _0x334a17={},_0x1a946b={},_0x10a26a={'count':0x0,'rows':[]};var _0x10beda=db['JscriptyProject'][_0x8da9('0x25')];_0x1a946b['model']=_[_0x8da9('0x26')](_0x10beda);_0x1a946b[_0x8da9('0x27')]=_[_0x8da9('0x26')](_0x41c61c[_0x8da9('0x27')]);_0x1a946b['filters']=_['intersection'](_0x1a946b[_0x8da9('0x28')],_0x1a946b[_0x8da9('0x27')]);_0x334a17[_0x8da9('0x29')]=_[_0x8da9('0x2a')](_0x1a946b[_0x8da9('0x28')],qs[_0x8da9('0x2b')](_0x41c61c[_0x8da9('0x27')][_0x8da9('0x2b')]));_0x334a17[_0x8da9('0x29')]=_0x334a17[_0x8da9('0x29')][_0x8da9('0x2c')]?_0x334a17[_0x8da9('0x29')]:_0x1a946b[_0x8da9('0x28')];if(!_0x41c61c[_0x8da9('0x27')][_0x8da9('0x2d')]('nolimit')){_0x334a17[_0x8da9('0x1a')]=qs[_0x8da9('0x1a')](_0x41c61c[_0x8da9('0x27')]['limit']);_0x334a17['offset']=qs[_0x8da9('0x19')](_0x41c61c['query']['offset']);}_0x334a17[_0x8da9('0x2e')]=qs[_0x8da9('0x2f')](_0x41c61c[_0x8da9('0x27')][_0x8da9('0x2f')]);_0x334a17['where']=qs[_0x8da9('0x30')](_[_0x8da9('0x31')](_0x41c61c[_0x8da9('0x27')],_0x1a946b['filters']));if(_0x41c61c[_0x8da9('0x27')]['filter']){_0x334a17['where']=_[_0x8da9('0x32')](_0x334a17[_0x8da9('0x33')],{'$or':_[_0x8da9('0x34')](_0x10beda,function(_0x2530d1){if(_0x2530d1[_0x8da9('0x35')][_0x8da9('0x36')]!==_0x8da9('0x37')){var _0x377d1d={};_0x377d1d[_0x2530d1[_0x8da9('0x38')]]={'$like':'%'+_0x41c61c['query']['filter']+'%'};return _0x377d1d;}})});}_0x334a17=_[_0x8da9('0x32')]({},_0x334a17,_0x41c61c['options']);var _0x8fbd73={'where':_0x334a17[_0x8da9('0x33')]};return db[_0x8da9('0x39')][_0x8da9('0x18')](_0x8fbd73)[_0x8da9('0x1e')](function(_0x5e9d04){_0x10a26a[_0x8da9('0x18')]=_0x5e9d04;if(_0x41c61c['query'][_0x8da9('0x3a')]){_0x334a17[_0x8da9('0x3b')]=[{'all':!![]}];}return db[_0x8da9('0x39')][_0x8da9('0x3c')](_0x334a17);})['then'](function(_0x2dbc02){_0x10a26a[_0x8da9('0x3d')]=_0x2dbc02;return _0x10a26a;})[_0x8da9('0x1e')](respondWithFilteredResult(_0x221578,_0x334a17))[_0x8da9('0x3e')](handleError(_0x221578,null));};exports[_0x8da9('0x3f')]=function(_0x348eb1,_0x392955){var _0x24db11={'raw':![],'where':{'id':_0x348eb1['params']['id']}},_0x10b607={};_0x10b607['model']=_['keys'](db[_0x8da9('0x39')][_0x8da9('0x25')]);_0x10b607[_0x8da9('0x27')]=_['keys'](_0x348eb1[_0x8da9('0x27')]);_0x10b607[_0x8da9('0x30')]=_[_0x8da9('0x2a')](_0x10b607[_0x8da9('0x28')],_0x10b607['query']);_0x24db11[_0x8da9('0x29')]=_['intersection'](_0x10b607[_0x8da9('0x28')],qs[_0x8da9('0x2b')](_0x348eb1['query'][_0x8da9('0x2b')]));_0x24db11[_0x8da9('0x29')]=_0x24db11[_0x8da9('0x29')][_0x8da9('0x2c')]?_0x24db11[_0x8da9('0x29')]:_0x10b607[_0x8da9('0x28')];if(_0x348eb1[_0x8da9('0x27')][_0x8da9('0x3a')]){_0x24db11[_0x8da9('0x3b')]=[{'all':!![]}];}_0x24db11=_['merge']({},_0x24db11,_0x348eb1[_0x8da9('0x40')]);return db[_0x8da9('0x39')][_0x8da9('0x41')](_0x24db11)[_0x8da9('0x1e')](handleEntityNotFound(_0x392955,null))[_0x8da9('0x1e')](respondWithResult(_0x392955,null))['catch'](handleError(_0x392955,null));};exports['create']=function(_0x145add,_0x1a7839){return db[_0x8da9('0x39')][_0x8da9('0x42')](_0x145add[_0x8da9('0x43')],{})[_0x8da9('0x1e')](function(_0x156a57){var _0xfc9497=_0x145add[_0x8da9('0x44')]['get']({'plain':!![]});if(!_0xfc9497)throw new Error(_0x8da9('0x45'));if(_0xfc9497[_0x8da9('0x46')]===_0x8da9('0x44')){var _0x848294=_0x156a57[_0x8da9('0x20')]({'plain':!![]});var _0x2589e8=_0x8da9('0x47');return db[_0x8da9('0x48')][_0x8da9('0x41')]({'where':{'name':_0x2589e8,'userProfileId':_0xfc9497['userProfileId']},'raw':!![]})[_0x8da9('0x1e')](function(_0x4e73ab){if(_0x4e73ab&&_0x4e73ab['autoAssociation']===0x0){return db[_0x8da9('0x49')]['create']({'name':_0x848294[_0x8da9('0x23')],'resourceId':_0x848294['id'],'type':_0x4e73ab[_0x8da9('0x23')],'sectionId':_0x4e73ab['id']},{})[_0x8da9('0x1e')](function(){return _0x156a57;});}else{return _0x156a57;}})[_0x8da9('0x3e')](function(_0x5b9d8d){logger[_0x8da9('0x4a')](_0x8da9('0x4b'),_0x5b9d8d);throw _0x5b9d8d;});}return _0x156a57;})[_0x8da9('0x1e')](respondWithResult(_0x1a7839,0xc9))['catch'](handleError(_0x1a7839,null));};exports[_0x8da9('0x4c')]=function(_0x590a57,_0x47f984){var _0x28493c={'raw':![],'where':{'id':_0x590a57[_0x8da9('0x4d')]['id']}},_0x3c5736={};_0x3c5736[_0x8da9('0x28')]=_[_0x8da9('0x26')](db[_0x8da9('0x39')][_0x8da9('0x25')]);_0x28493c[_0x8da9('0x29')]=_[_0x8da9('0x2a')](_0x3c5736[_0x8da9('0x28')],qs[_0x8da9('0x2b')](_0x590a57[_0x8da9('0x27')][_0x8da9('0x2b')]));_0x28493c[_0x8da9('0x29')]=_0x28493c[_0x8da9('0x29')][_0x8da9('0x2c')]?_0x28493c['attributes']:_0x3c5736[_0x8da9('0x28')];if(_0x590a57[_0x8da9('0x27')][_0x8da9('0x3a')]){_0x28493c[_0x8da9('0x3b')]=[{'all':!![]}];}_0x28493c=_[_0x8da9('0x32')]({},_0x28493c,_0x590a57[_0x8da9('0x40')]);return db[_0x8da9('0x39')]['find'](_0x28493c)[_0x8da9('0x1e')](handleEntityNotFound(_0x47f984,null))[_0x8da9('0x1e')](function(_0x28b07c){if(_0x28b07c){var _0x3ecf01=_0x28b07c[_0x8da9('0x20')]({'plain':!![]});_0x3ecf01=qs['omit'](_0x3ecf01,['id',_0x8da9('0x4e'),_0x8da9('0x4f')]);_0x590a57[_0x8da9('0x43')]=_[_0x8da9('0x50')](_0x590a57[_0x8da9('0x43')],['id',_0x8da9('0x4e'),_0x8da9('0x4f')]);return db[_0x8da9('0x39')][_0x8da9('0x42')](_[_0x8da9('0x32')](_0x3ecf01,_0x590a57[_0x8da9('0x43')]),{'include':_0x590a57['query'][_0x8da9('0x3a')]?[{'all':!![]}]:undefined})[_0x8da9('0x1e')](function(_0x409e3a){var _0x368c39=_0x590a57[_0x8da9('0x44')]['get']({'plain':!![]});if(!_0x368c39)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x368c39[_0x8da9('0x46')]==='user'){var _0x45c009=_0x409e3a[_0x8da9('0x20')]({'plain':!![]});var _0x6a206e=_0x8da9('0x47');return db[_0x8da9('0x48')]['find']({'where':{'name':_0x6a206e,'userProfileId':_0x368c39['userProfileId']},'raw':!![]})[_0x8da9('0x1e')](function(_0x4468d6){if(_0x4468d6&&_0x4468d6[_0x8da9('0x51')]===0x0){return db[_0x8da9('0x49')][_0x8da9('0x42')]({'name':_0x45c009[_0x8da9('0x23')],'resourceId':_0x45c009['id'],'type':_0x4468d6[_0x8da9('0x23')],'sectionId':_0x4468d6['id']},{})[_0x8da9('0x1e')](function(){return _0x409e3a;});}else{return _0x409e3a;}})['catch'](function(_0x2d2bce){logger[_0x8da9('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d2bce);throw _0x2d2bce;});}return _0x409e3a;});}})['then'](respondWithResult(_0x47f984,0xc9))[_0x8da9('0x3e')](handleError(_0x47f984,null));};exports[_0x8da9('0x52')]=function(_0x2cdea2,_0x227412){if(_0x2cdea2[_0x8da9('0x43')]['id']){delete _0x2cdea2['body']['id'];}return db['JscriptyProject'][_0x8da9('0x41')]({'where':{'id':_0x2cdea2[_0x8da9('0x4d')]['id']}})[_0x8da9('0x1e')](handleEntityNotFound(_0x227412,null))[_0x8da9('0x1e')](saveUpdates(_0x2cdea2['body'],null))['then'](respondWithResult(_0x227412,null))[_0x8da9('0x3e')](handleError(_0x227412,null));};exports['destroy']=function(_0x1e9d51,_0x2c8ef5){return db[_0x8da9('0x39')][_0x8da9('0x41')]({'where':{'id':_0x1e9d51[_0x8da9('0x4d')]['id']}})[_0x8da9('0x1e')](handleEntityNotFound(_0x2c8ef5,null))[_0x8da9('0x1e')](removeEntity(_0x2c8ef5,null))['catch'](handleError(_0x2c8ef5,null));};exports[_0x8da9('0x53')]=function(_0x51c3dc,_0x58f8d9,_0x10cb92){var _0x1d3374={'raw':!![],'where':{}};var _0x749e37={};var _0x182cef={'count':0x0,'rows':[]};return db[_0x8da9('0x39')][_0x8da9('0x54')]({'where':{'id':_0x51c3dc['params']['id']}})['then'](handleEntityNotFound(_0x58f8d9,null))[_0x8da9('0x1e')](function(_0x360bd4){if(_0x360bd4){_0x749e37[_0x8da9('0x28')]=_[_0x8da9('0x26')](db[_0x8da9('0x55')][_0x8da9('0x25')]);_0x749e37[_0x8da9('0x27')]=_['keys'](_0x51c3dc[_0x8da9('0x27')]);_0x749e37[_0x8da9('0x30')]=_[_0x8da9('0x2a')](_0x749e37[_0x8da9('0x28')],_0x749e37['query']);_0x1d3374[_0x8da9('0x29')]=_[_0x8da9('0x2a')](_0x749e37[_0x8da9('0x28')],qs['fields'](_0x51c3dc[_0x8da9('0x27')][_0x8da9('0x2b')]));_0x1d3374[_0x8da9('0x29')]=_0x1d3374[_0x8da9('0x29')]['length']?_0x1d3374[_0x8da9('0x29')]:_0x749e37[_0x8da9('0x28')];if(!_0x51c3dc[_0x8da9('0x27')][_0x8da9('0x2d')](_0x8da9('0x56'))){_0x1d3374[_0x8da9('0x1a')]=qs[_0x8da9('0x1a')](_0x51c3dc[_0x8da9('0x27')][_0x8da9('0x1a')]);_0x1d3374[_0x8da9('0x19')]=qs[_0x8da9('0x19')](_0x51c3dc['query'][_0x8da9('0x19')]);}_0x1d3374[_0x8da9('0x2e')]=qs['sort'](_0x51c3dc[_0x8da9('0x27')][_0x8da9('0x2f')]);_0x1d3374[_0x8da9('0x33')]=qs['filters'](_['pick'](_0x51c3dc[_0x8da9('0x27')],_0x749e37[_0x8da9('0x30')]));_0x1d3374[_0x8da9('0x33')]['ProjectId']=_0x360bd4['id'];if(_0x51c3dc[_0x8da9('0x27')]['filter']){_0x1d3374[_0x8da9('0x33')]=_[_0x8da9('0x32')](_0x1d3374[_0x8da9('0x33')],{'$or':_['map'](_0x1d3374[_0x8da9('0x29')],function(_0x36f951){var _0x3b31ab={};_0x3b31ab[_0x36f951]={'$like':'%'+_0x51c3dc['query'][_0x8da9('0x57')]+'%'};return _0x3b31ab;})});}_0x1d3374=_[_0x8da9('0x32')]({},_0x1d3374,_0x51c3dc['options']);return db[_0x8da9('0x55')][_0x8da9('0x18')]({'where':_0x1d3374[_0x8da9('0x33')]})['then'](function(_0xdd5ddc){_0x182cef[_0x8da9('0x18')]=_0xdd5ddc;if(_0x51c3dc[_0x8da9('0x27')][_0x8da9('0x3a')]){_0x1d3374[_0x8da9('0x3b')]=[{'all':!![]}];}return db[_0x8da9('0x55')][_0x8da9('0x3c')](_0x1d3374);})[_0x8da9('0x1e')](function(_0x542216){_0x182cef[_0x8da9('0x3d')]=_0x542216;return _0x182cef;});}})[_0x8da9('0x1e')](respondWithFilteredResult(_0x58f8d9,_0x1d3374))[_0x8da9('0x3e')](handleError(_0x58f8d9,null));};exports['getAnswers']=function(_0x1e5220,_0x245b9f,_0x5455b2){var _0x31280a={'raw':!![],'where':{}};var _0x23b7c0={};var _0x5593d5={'count':0x0,'rows':[]};return db[_0x8da9('0x39')][_0x8da9('0x54')]({'where':{'id':_0x1e5220[_0x8da9('0x4d')]['id']}})[_0x8da9('0x1e')](handleEntityNotFound(_0x245b9f,null))['then'](function(_0x514861){if(_0x514861){_0x23b7c0[_0x8da9('0x28')]=_[_0x8da9('0x26')](db['JscriptyAnswerReport'][_0x8da9('0x25')]);_0x23b7c0[_0x8da9('0x27')]=_[_0x8da9('0x26')](_0x1e5220[_0x8da9('0x27')]);_0x23b7c0[_0x8da9('0x30')]=_[_0x8da9('0x2a')](_0x23b7c0[_0x8da9('0x28')],_0x23b7c0[_0x8da9('0x27')]);_0x31280a[_0x8da9('0x29')]=_[_0x8da9('0x2a')](_0x23b7c0[_0x8da9('0x28')],qs[_0x8da9('0x2b')](_0x1e5220['query'][_0x8da9('0x2b')]));_0x31280a[_0x8da9('0x29')]=_0x31280a[_0x8da9('0x29')][_0x8da9('0x2c')]?_0x31280a[_0x8da9('0x29')]:_0x23b7c0[_0x8da9('0x28')];if(!_0x1e5220[_0x8da9('0x27')][_0x8da9('0x2d')](_0x8da9('0x56'))){_0x31280a[_0x8da9('0x1a')]=qs[_0x8da9('0x1a')](_0x1e5220['query'][_0x8da9('0x1a')]);_0x31280a[_0x8da9('0x19')]=qs[_0x8da9('0x19')](_0x1e5220[_0x8da9('0x27')]['offset']);}_0x31280a[_0x8da9('0x2e')]=qs['sort'](_0x1e5220['query'][_0x8da9('0x2f')]);_0x31280a[_0x8da9('0x33')]=qs['filters'](_[_0x8da9('0x31')](_0x1e5220[_0x8da9('0x27')],_0x23b7c0['filters']));_0x31280a[_0x8da9('0x33')][_0x8da9('0x58')]=_0x514861['id'];if(_0x1e5220[_0x8da9('0x27')][_0x8da9('0x57')]){_0x31280a['where']=_[_0x8da9('0x32')](_0x31280a[_0x8da9('0x33')],{'$or':_[_0x8da9('0x34')](_0x31280a[_0x8da9('0x29')],function(_0x31ca65){var _0xc06dc4={};_0xc06dc4[_0x31ca65]={'$like':'%'+_0x1e5220['query'][_0x8da9('0x57')]+'%'};return _0xc06dc4;})});}_0x31280a=_['merge']({},_0x31280a,_0x1e5220[_0x8da9('0x40')]);return db[_0x8da9('0x59')]['count']({'where':_0x31280a[_0x8da9('0x33')]})[_0x8da9('0x1e')](function(_0x957c41){_0x5593d5[_0x8da9('0x18')]=_0x957c41;if(_0x1e5220[_0x8da9('0x27')][_0x8da9('0x3a')]){_0x31280a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x31280a);})[_0x8da9('0x1e')](function(_0x168634){_0x5593d5['rows']=_0x168634;return _0x5593d5;});}})[_0x8da9('0x1e')](respondWithFilteredResult(_0x245b9f,_0x31280a))[_0x8da9('0x3e')](handleError(_0x245b9f,null));};function char(_0x1df01c){return _0x8da9('0x5a')===typeof _0x1df01c?String[_0x8da9('0x5b')]['apply'](null,arguments):_0x1df01c;}function needsEncapsulation(_0x46f254){return!!_0x46f254&&(_0x46f254[_0x8da9('0x5c')]()[_0x8da9('0x5d')](char(0xd))>=0x0||_0x46f254['toString']()[_0x8da9('0x5d')](char(0xa))>=0x0||_0x46f254[_0x8da9('0x5c')]()[_0x8da9('0x5d')](char(0x2c))>=0x0||_0x46f254[_0x8da9('0x5c')]()[_0x8da9('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x4bc0c2){var _0x29ce4b=char(0x22),_0x48ca9a='\x5c'+char(0x22),_0x2f6609=_0x4bc0c2[_0x8da9('0x5c')]()[_0x8da9('0x5e')](new RegExp(_0x29ce4b,'g'),_0x48ca9a);return _0x29ce4b+_0x2f6609+_0x29ce4b;}exports['getSummary']=function(_0x22660f,_0x5baf94,_0x4ddcb5){var _0x26f5a8,_0x2e3c41;var _0x2d5170={'where':{'ProjectId':_0x22660f[_0x8da9('0x4d')]['id']}};if(_0x22660f[_0x8da9('0x27')][_0x8da9('0x5f')]){_0x2d5170[_0x8da9('0x33')][_0x8da9('0x60')]=JSON['parse'](_0x22660f[_0x8da9('0x27')]['startTime']);}return db[_0x8da9('0x55')]['findAll'](_0x2d5170)[_0x8da9('0x1e')](handleEntityNotFound(_0x5baf94,null))[_0x8da9('0x1e')](function(_0x48c7e8){if(_0x48c7e8){_0x26f5a8=_0x48c7e8;return db['JscriptyQuestionReport'][_0x8da9('0x3c')]({'where':{'SessionId':{'$in':_[_0x8da9('0x34')](_0x26f5a8,'id')},'ProjectId':_0x22660f[_0x8da9('0x4d')]['id']},'order':'-createdAt'});}})[_0x8da9('0x1e')](handleEntityNotFound(_0x5baf94,null))['then'](function(_0x23f440){if(_0x23f440){_0x2e3c41=_0x23f440;var _0x54f4a3={};for(var _0x35d086=0x0,_0x25a90f=_0x2e3c41[_0x8da9('0x2c')];_0x35d086<_0x25a90f;_0x35d086++){if(!_0x54f4a3['hasOwnProperty'](_0x2e3c41[_0x35d086][_0x8da9('0x61')])){_0x54f4a3[_0x2e3c41[_0x35d086]['questionId']]=needsEncapsulation(_0x2e3c41[_0x35d086][_0x8da9('0x62')])?encapsulate(_0x2e3c41[_0x35d086]['question']):_0x2e3c41[_0x35d086]['question'];}}var _0x1e2f90=[],_0x25628a={};for(var _0x22cfbe=0x0,_0x1f5f9c=_0x26f5a8[_0x8da9('0x2c')];_0x22cfbe<_0x1f5f9c;_0x22cfbe++){_0x25628a={'ProjectId':_0x22660f[_0x8da9('0x4d')]['id'],'SessionId':_0x26f5a8[_0x22cfbe]['id'],'StartTime':moment(_0x26f5a8[_0x22cfbe][_0x8da9('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1fde9a=0x0,_0x3f6097=_0x2e3c41[_0x8da9('0x2c')];_0x1fde9a<_0x3f6097;_0x1fde9a++){if(_0x2e3c41[_0x1fde9a]['SessionId']==_0x26f5a8[_0x22cfbe]['id']&&_0x54f4a3['hasOwnProperty'](_0x2e3c41[_0x1fde9a]['questionId'])){_0x25628a[_0x54f4a3[_0x2e3c41[_0x1fde9a]['questionId']]]=_0x2e3c41[_0x1fde9a][_0x8da9('0x63')];}}for(var _0x1b1735 in _0x54f4a3){if(!_0x25628a[_0x8da9('0x2d')](_0x54f4a3[_0x1b1735])){_0x25628a[_0x54f4a3[_0x1b1735]]=null;}}_0x1e2f90[_0x8da9('0x64')](_0x25628a);}return _0x1e2f90;}})[_0x8da9('0x1e')](function(_0x57e02c){if(!_[_0x8da9('0x65')](_0x57e02c)){var _0x397bce=toCsv(_0x57e02c);var _0x16f4a8=Date[_0x8da9('0x66')]();fs[_0x8da9('0x67')](util[_0x8da9('0x68')](_0x8da9('0x69'),_0x22660f['params']['id'],_0x16f4a8),_0x397bce);_0x5baf94['setHeader'](_0x8da9('0x6a'),_0x8da9('0x6b')+util[_0x8da9('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x22660f[_0x8da9('0x4d')]['id'],_0x16f4a8));_0x5baf94[_0x8da9('0x6c')]('Content-type',_0x8da9('0x6d'));return _0x5baf94['download'](util[_0x8da9('0x68')](_0x8da9('0x69'),_0x22660f[_0x8da9('0x4d')]['id'],_0x16f4a8));}else{return _0x5baf94['sendStatus'](0xcc);}})['catch'](handleError(_0x5baf94,null));}; \ No newline at end of file +var _0x8313=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','field','filter','options','count','includeAll','include','JscriptyProject','findAll','catch','show','params','keys','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','ProjectId','JscriptySessionReport','rows','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','rawAttributes','model','query','filters'];(function(_0x2322ca,_0x481956){var _0x816402=function(_0x4a2069){while(--_0x4a2069){_0x2322ca['push'](_0x2322ca['shift']());}};_0x816402(++_0x481956);}(_0x8313,0x19e));var _0x3831=function(_0x1407cf,_0x28ede8){_0x1407cf=_0x1407cf-0x0;var _0x52093b=_0x8313[_0x1407cf];return _0x52093b;};'use strict';var pdf=require(_0x3831('0x0'));var emlformat=require(_0x3831('0x1'));var rimraf=require(_0x3831('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3831('0x3'));var rp=require('request-promise');var moment=require(_0x3831('0x4'));var BPromise=require(_0x3831('0x5'));var Mustache=require(_0x3831('0x6'));var util=require(_0x3831('0x7'));var path=require(_0x3831('0x8'));var sox=require(_0x3831('0x9'));var csv=require(_0x3831('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3831('0xb'));var squel=require(_0x3831('0xc'));var crypto=require(_0x3831('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3831('0xa'));var querystring=require(_0x3831('0xe'));var Papa=require(_0x3831('0xf'));var Redis=require(_0x3831('0x10'));var authService=require(_0x3831('0x11'));var qs=require(_0x3831('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3831('0x13'))(_0x3831('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xacc2c7,_0x2cba98){_0x2cba98=_0x2cba98||0xcc;return function(_0x178c62){if(_0x178c62){return _0xacc2c7[_0x3831('0x15')](_0x2cba98);}return _0xacc2c7[_0x3831('0x16')](_0x2cba98)[_0x3831('0x17')]();};}function respondWithResult(_0x17e344,_0x3442f6){_0x3442f6=_0x3442f6||0xc8;return function(_0x3af9be){if(_0x3af9be){return _0x17e344[_0x3831('0x16')](_0x3442f6)[_0x3831('0x18')](_0x3af9be);}};}function respondWithFilteredResult(_0x1f4f33,_0x4658bb){return function(_0x11cabe){if(_0x11cabe){var _0x5d12ca=_0x11cabe['count'],_0x1df003=_0x4658bb[_0x3831('0x19')],_0x3b31a9=_0x4658bb[_0x3831('0x19')]+_0x4658bb[_0x3831('0x1a')],_0x1f8332;if(_0x3b31a9>=_0x5d12ca){_0x3b31a9=_0x5d12ca;_0x1f8332=0xc8;}else{_0x1f8332=0xce;}_0x1f4f33[_0x3831('0x16')](_0x1f8332);return _0x1f4f33[_0x3831('0x1b')]('Content-Range',_0x1df003+'-'+_0x3b31a9+'/'+_0x5d12ca)[_0x3831('0x18')](_0x11cabe);}return null;};}function patchUpdates(_0x1d2110){return function(_0xf52833){try{jsonpatch[_0x3831('0x1c')](_0xf52833,_0x1d2110,!![]);}catch(_0x4e1619){return BPromise[_0x3831('0x1d')](_0x4e1619);}return _0xf52833[_0x3831('0x1e')]();};}function saveUpdates(_0x31c338,_0x571151){return function(_0x11af0b){if(_0x11af0b){return _0x11af0b[_0x3831('0x1f')](_0x31c338)[_0x3831('0x20')](function(_0x435236){return _0x435236;});}return null;};}function removeEntity(_0xfe4523,_0x47b10f){return function(_0x5e9ab1){if(_0x5e9ab1){return _0x5e9ab1[_0x3831('0x21')]()[_0x3831('0x20')](function(){var _0x416d09=_0x5e9ab1[_0x3831('0x22')]({'plain':!![]});var _0x410072=_0x3831('0x23');return db[_0x3831('0x24')][_0x3831('0x21')]({'where':{'type':_0x410072,'resourceId':_0x416d09['id']}})[_0x3831('0x20')](function(){return _0x5e9ab1;});})[_0x3831('0x20')](function(){_0xfe4523['status'](0xcc)[_0x3831('0x17')]();});}};}function handleEntityNotFound(_0x294545,_0x57b1d4){return function(_0x5a89b0){if(!_0x5a89b0){_0x294545[_0x3831('0x15')](0x194);}return _0x5a89b0;};}function handleError(_0x4aafef,_0x2fdcdb){_0x2fdcdb=_0x2fdcdb||0x1f4;return function(_0x346479){logger[_0x3831('0x25')](_0x346479[_0x3831('0x26')]);if(_0x346479[_0x3831('0x27')]){delete _0x346479['name'];}_0x4aafef[_0x3831('0x16')](_0x2fdcdb)[_0x3831('0x28')](_0x346479);};}exports[_0x3831('0x29')]=function(_0x5750ea,_0x5a7fff){var _0x358723={},_0x264e5a={},_0x17a55b={'count':0x0,'rows':[]};var _0x7234f3=db['JscriptyProject'][_0x3831('0x2a')];_0x264e5a[_0x3831('0x2b')]=_['keys'](_0x7234f3);_0x264e5a[_0x3831('0x2c')]=_['keys'](_0x5750ea[_0x3831('0x2c')]);_0x264e5a[_0x3831('0x2d')]=_[_0x3831('0x2e')](_0x264e5a[_0x3831('0x2b')],_0x264e5a[_0x3831('0x2c')]);_0x358723['attributes']=_['intersection'](_0x264e5a[_0x3831('0x2b')],qs[_0x3831('0x2f')](_0x5750ea[_0x3831('0x2c')][_0x3831('0x2f')]));_0x358723[_0x3831('0x30')]=_0x358723[_0x3831('0x30')][_0x3831('0x31')]?_0x358723[_0x3831('0x30')]:_0x264e5a[_0x3831('0x2b')];if(!_0x5750ea[_0x3831('0x2c')][_0x3831('0x32')](_0x3831('0x33'))){_0x358723['limit']=qs[_0x3831('0x1a')](_0x5750ea[_0x3831('0x2c')][_0x3831('0x1a')]);_0x358723['offset']=qs[_0x3831('0x19')](_0x5750ea[_0x3831('0x2c')][_0x3831('0x19')]);}_0x358723[_0x3831('0x34')]=qs[_0x3831('0x35')](_0x5750ea['query'][_0x3831('0x35')]);_0x358723[_0x3831('0x36')]=qs[_0x3831('0x2d')](_[_0x3831('0x37')](_0x5750ea[_0x3831('0x2c')],_0x264e5a['filters']));if(_0x5750ea[_0x3831('0x2c')]['filter']){_0x358723['where']=_[_0x3831('0x38')](_0x358723[_0x3831('0x36')],{'$or':_[_0x3831('0x39')](_0x7234f3,function(_0x2c2aed){if(_0x2c2aed[_0x3831('0x3a')]['key']!==_0x3831('0x3b')){var _0x41d27c={};_0x41d27c[_0x2c2aed[_0x3831('0x3c')]]={'$like':'%'+_0x5750ea['query'][_0x3831('0x3d')]+'%'};return _0x41d27c;}})});}_0x358723=_['merge']({},_0x358723,_0x5750ea[_0x3831('0x3e')]);var _0x456258={'where':_0x358723[_0x3831('0x36')]};return db['JscriptyProject'][_0x3831('0x3f')](_0x456258)[_0x3831('0x20')](function(_0x5a4a36){_0x17a55b['count']=_0x5a4a36;if(_0x5750ea[_0x3831('0x2c')][_0x3831('0x40')]){_0x358723[_0x3831('0x41')]=[{'all':!![]}];}return db[_0x3831('0x42')][_0x3831('0x43')](_0x358723);})['then'](function(_0x25e9f9){_0x17a55b['rows']=_0x25e9f9;return _0x17a55b;})[_0x3831('0x20')](respondWithFilteredResult(_0x5a7fff,_0x358723))[_0x3831('0x44')](handleError(_0x5a7fff,null));};exports[_0x3831('0x45')]=function(_0x2b3370,_0x34c53e){var _0x3d168a={'raw':![],'where':{'id':_0x2b3370[_0x3831('0x46')]['id']}},_0x28149c={};_0x28149c[_0x3831('0x2b')]=_[_0x3831('0x47')](db[_0x3831('0x42')][_0x3831('0x2a')]);_0x28149c['query']=_[_0x3831('0x47')](_0x2b3370[_0x3831('0x2c')]);_0x28149c['filters']=_[_0x3831('0x2e')](_0x28149c[_0x3831('0x2b')],_0x28149c[_0x3831('0x2c')]);_0x3d168a[_0x3831('0x30')]=_[_0x3831('0x2e')](_0x28149c[_0x3831('0x2b')],qs[_0x3831('0x2f')](_0x2b3370[_0x3831('0x2c')][_0x3831('0x2f')]));_0x3d168a['attributes']=_0x3d168a[_0x3831('0x30')][_0x3831('0x31')]?_0x3d168a['attributes']:_0x28149c[_0x3831('0x2b')];if(_0x2b3370['query'][_0x3831('0x40')]){_0x3d168a[_0x3831('0x41')]=[{'all':!![]}];}_0x3d168a=_[_0x3831('0x38')]({},_0x3d168a,_0x2b3370[_0x3831('0x3e')]);return db[_0x3831('0x42')][_0x3831('0x48')](_0x3d168a)[_0x3831('0x20')](handleEntityNotFound(_0x34c53e,null))[_0x3831('0x20')](respondWithResult(_0x34c53e,null))[_0x3831('0x44')](handleError(_0x34c53e,null));};exports[_0x3831('0x49')]=function(_0x595bd7,_0x140859){return db[_0x3831('0x42')][_0x3831('0x49')](_0x595bd7['body'],{})[_0x3831('0x20')](function(_0xbf88e5){var _0x415d39=_0x595bd7[_0x3831('0x4a')][_0x3831('0x22')]({'plain':!![]});if(!_0x415d39)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x415d39[_0x3831('0x4b')]==='user'){var _0x50282f=_0xbf88e5['get']({'plain':!![]});var _0x3dd30d=_0x3831('0x23');return db[_0x3831('0x4c')]['find']({'where':{'name':_0x3dd30d,'userProfileId':_0x415d39[_0x3831('0x4d')]},'raw':!![]})[_0x3831('0x20')](function(_0x4af8c8){if(_0x4af8c8&&_0x4af8c8[_0x3831('0x4e')]===0x0){return db[_0x3831('0x24')][_0x3831('0x49')]({'name':_0x50282f[_0x3831('0x27')],'resourceId':_0x50282f['id'],'type':_0x4af8c8[_0x3831('0x27')],'sectionId':_0x4af8c8['id']},{})[_0x3831('0x20')](function(){return _0xbf88e5;});}else{return _0xbf88e5;}})['catch'](function(_0x23ec07){logger['error'](_0x3831('0x4f'),_0x23ec07);throw _0x23ec07;});}return _0xbf88e5;})[_0x3831('0x20')](respondWithResult(_0x140859,0xc9))[_0x3831('0x44')](handleError(_0x140859,null));};exports[_0x3831('0x50')]=function(_0x4d2e21,_0x2598fa){var _0x464641={'raw':![],'where':{'id':_0x4d2e21[_0x3831('0x46')]['id']}},_0x212fae={};_0x212fae[_0x3831('0x2b')]=_[_0x3831('0x47')](db[_0x3831('0x42')][_0x3831('0x2a')]);_0x464641[_0x3831('0x30')]=_['intersection'](_0x212fae[_0x3831('0x2b')],qs[_0x3831('0x2f')](_0x4d2e21[_0x3831('0x2c')][_0x3831('0x2f')]));_0x464641[_0x3831('0x30')]=_0x464641[_0x3831('0x30')][_0x3831('0x31')]?_0x464641[_0x3831('0x30')]:_0x212fae[_0x3831('0x2b')];if(_0x4d2e21[_0x3831('0x2c')]['includeAll']){_0x464641[_0x3831('0x41')]=[{'all':!![]}];}_0x464641=_[_0x3831('0x38')]({},_0x464641,_0x4d2e21[_0x3831('0x3e')]);return db['JscriptyProject'][_0x3831('0x48')](_0x464641)[_0x3831('0x20')](handleEntityNotFound(_0x2598fa,null))[_0x3831('0x20')](function(_0x26c4ab){if(_0x26c4ab){var _0x5a313c=_0x26c4ab[_0x3831('0x22')]({'plain':!![]});_0x5a313c=qs['omit'](_0x5a313c,['id',_0x3831('0x51'),_0x3831('0x52')]);_0x4d2e21[_0x3831('0x53')]=_[_0x3831('0x54')](_0x4d2e21[_0x3831('0x53')],['id','createdAt',_0x3831('0x52')]);return db[_0x3831('0x42')][_0x3831('0x49')](_['merge'](_0x5a313c,_0x4d2e21['body']),{'include':_0x4d2e21[_0x3831('0x2c')][_0x3831('0x40')]?[{'all':!![]}]:undefined})[_0x3831('0x20')](function(_0x4dfcac){var _0x1109a5=_0x4d2e21[_0x3831('0x4a')][_0x3831('0x22')]({'plain':!![]});if(!_0x1109a5)throw new Error(_0x3831('0x55'));if(_0x1109a5[_0x3831('0x4b')]===_0x3831('0x4a')){var _0x1ae3f2=_0x4dfcac['get']({'plain':!![]});var _0x4bb848='Projects';return db['UserProfileSection'][_0x3831('0x48')]({'where':{'name':_0x4bb848,'userProfileId':_0x1109a5[_0x3831('0x4d')]},'raw':!![]})['then'](function(_0x70cc6d){if(_0x70cc6d&&_0x70cc6d[_0x3831('0x4e')]===0x0){return db['UserProfileResource'][_0x3831('0x49')]({'name':_0x1ae3f2['name'],'resourceId':_0x1ae3f2['id'],'type':_0x70cc6d[_0x3831('0x27')],'sectionId':_0x70cc6d['id']},{})[_0x3831('0x20')](function(){return _0x4dfcac;});}else{return _0x4dfcac;}})[_0x3831('0x44')](function(_0x5b8129){logger[_0x3831('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b8129);throw _0x5b8129;});}return _0x4dfcac;});}})[_0x3831('0x20')](respondWithResult(_0x2598fa,0xc9))[_0x3831('0x44')](handleError(_0x2598fa,null));};exports[_0x3831('0x1f')]=function(_0x3cf764,_0x27f695){if(_0x3cf764['body']['id']){delete _0x3cf764[_0x3831('0x53')]['id'];}return db[_0x3831('0x42')][_0x3831('0x48')]({'where':{'id':_0x3cf764[_0x3831('0x46')]['id']}})[_0x3831('0x20')](handleEntityNotFound(_0x27f695,null))[_0x3831('0x20')](saveUpdates(_0x3cf764[_0x3831('0x53')],null))[_0x3831('0x20')](respondWithResult(_0x27f695,null))['catch'](handleError(_0x27f695,null));};exports[_0x3831('0x21')]=function(_0x17d3e2,_0x4dd608){return db[_0x3831('0x42')]['find']({'where':{'id':_0x17d3e2[_0x3831('0x46')]['id']}})[_0x3831('0x20')](handleEntityNotFound(_0x4dd608,null))[_0x3831('0x20')](removeEntity(_0x4dd608,null))[_0x3831('0x44')](handleError(_0x4dd608,null));};exports[_0x3831('0x56')]=function(_0x14d498,_0x22b3cc,_0x8ffff3){var _0x2ba79f={'raw':!![],'where':{}};var _0x53a01d={};var _0x2787e5={'count':0x0,'rows':[]};return db[_0x3831('0x42')][_0x3831('0x57')]({'where':{'id':_0x14d498[_0x3831('0x46')]['id']}})[_0x3831('0x20')](handleEntityNotFound(_0x22b3cc,null))['then'](function(_0x26ca54){if(_0x26ca54){_0x53a01d[_0x3831('0x2b')]=_[_0x3831('0x47')](db['JscriptySessionReport']['rawAttributes']);_0x53a01d[_0x3831('0x2c')]=_[_0x3831('0x47')](_0x14d498[_0x3831('0x2c')]);_0x53a01d['filters']=_[_0x3831('0x2e')](_0x53a01d[_0x3831('0x2b')],_0x53a01d[_0x3831('0x2c')]);_0x2ba79f['attributes']=_['intersection'](_0x53a01d[_0x3831('0x2b')],qs[_0x3831('0x2f')](_0x14d498[_0x3831('0x2c')][_0x3831('0x2f')]));_0x2ba79f[_0x3831('0x30')]=_0x2ba79f['attributes'][_0x3831('0x31')]?_0x2ba79f[_0x3831('0x30')]:_0x53a01d[_0x3831('0x2b')];if(!_0x14d498[_0x3831('0x2c')]['hasOwnProperty']('nolimit')){_0x2ba79f['limit']=qs['limit'](_0x14d498[_0x3831('0x2c')][_0x3831('0x1a')]);_0x2ba79f[_0x3831('0x19')]=qs['offset'](_0x14d498[_0x3831('0x2c')][_0x3831('0x19')]);}_0x2ba79f[_0x3831('0x34')]=qs['sort'](_0x14d498[_0x3831('0x2c')][_0x3831('0x35')]);_0x2ba79f[_0x3831('0x36')]=qs[_0x3831('0x2d')](_['pick'](_0x14d498['query'],_0x53a01d[_0x3831('0x2d')]));_0x2ba79f[_0x3831('0x36')][_0x3831('0x58')]=_0x26ca54['id'];if(_0x14d498[_0x3831('0x2c')]['filter']){_0x2ba79f['where']=_[_0x3831('0x38')](_0x2ba79f['where'],{'$or':_[_0x3831('0x39')](_0x2ba79f[_0x3831('0x30')],function(_0x648f53){var _0x17f336={};_0x17f336[_0x648f53]={'$like':'%'+_0x14d498[_0x3831('0x2c')][_0x3831('0x3d')]+'%'};return _0x17f336;})});}_0x2ba79f=_['merge']({},_0x2ba79f,_0x14d498[_0x3831('0x3e')]);return db[_0x3831('0x59')]['count']({'where':_0x2ba79f['where']})[_0x3831('0x20')](function(_0x574365){_0x2787e5[_0x3831('0x3f')]=_0x574365;if(_0x14d498[_0x3831('0x2c')]['includeAll']){_0x2ba79f['include']=[{'all':!![]}];}return db[_0x3831('0x59')][_0x3831('0x43')](_0x2ba79f);})['then'](function(_0x9c3290){_0x2787e5[_0x3831('0x5a')]=_0x9c3290;return _0x2787e5;});}})['then'](respondWithFilteredResult(_0x22b3cc,_0x2ba79f))[_0x3831('0x44')](handleError(_0x22b3cc,null));};exports['getAnswers']=function(_0x361889,_0x524b0,_0x57407b){var _0x285805={'raw':!![],'where':{}};var _0x554ac={};var _0x274a63={'count':0x0,'rows':[]};return db[_0x3831('0x42')][_0x3831('0x57')]({'where':{'id':_0x361889['params']['id']}})[_0x3831('0x20')](handleEntityNotFound(_0x524b0,null))[_0x3831('0x20')](function(_0x22d0bb){if(_0x22d0bb){_0x554ac['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x554ac[_0x3831('0x2c')]=_[_0x3831('0x47')](_0x361889['query']);_0x554ac[_0x3831('0x2d')]=_[_0x3831('0x2e')](_0x554ac[_0x3831('0x2b')],_0x554ac['query']);_0x285805[_0x3831('0x30')]=_[_0x3831('0x2e')](_0x554ac[_0x3831('0x2b')],qs[_0x3831('0x2f')](_0x361889[_0x3831('0x2c')][_0x3831('0x2f')]));_0x285805[_0x3831('0x30')]=_0x285805[_0x3831('0x30')][_0x3831('0x31')]?_0x285805[_0x3831('0x30')]:_0x554ac[_0x3831('0x2b')];if(!_0x361889['query'][_0x3831('0x32')](_0x3831('0x33'))){_0x285805['limit']=qs[_0x3831('0x1a')](_0x361889[_0x3831('0x2c')][_0x3831('0x1a')]);_0x285805[_0x3831('0x19')]=qs['offset'](_0x361889['query']['offset']);}_0x285805[_0x3831('0x34')]=qs[_0x3831('0x35')](_0x361889['query']['sort']);_0x285805['where']=qs[_0x3831('0x2d')](_['pick'](_0x361889[_0x3831('0x2c')],_0x554ac['filters']));_0x285805[_0x3831('0x36')]['ProjectId']=_0x22d0bb['id'];if(_0x361889[_0x3831('0x2c')][_0x3831('0x3d')]){_0x285805[_0x3831('0x36')]=_[_0x3831('0x38')](_0x285805[_0x3831('0x36')],{'$or':_[_0x3831('0x39')](_0x285805[_0x3831('0x30')],function(_0x1d81b2){var _0x3365c6={};_0x3365c6[_0x1d81b2]={'$like':'%'+_0x361889['query'][_0x3831('0x3d')]+'%'};return _0x3365c6;})});}_0x285805=_[_0x3831('0x38')]({},_0x285805,_0x361889[_0x3831('0x3e')]);return db[_0x3831('0x5b')][_0x3831('0x3f')]({'where':_0x285805[_0x3831('0x36')]})[_0x3831('0x20')](function(_0x5c228f){_0x274a63['count']=_0x5c228f;if(_0x361889[_0x3831('0x2c')][_0x3831('0x40')]){_0x285805[_0x3831('0x41')]=[{'all':!![]}];}return db[_0x3831('0x5b')][_0x3831('0x43')](_0x285805);})[_0x3831('0x20')](function(_0x3fe571){_0x274a63[_0x3831('0x5a')]=_0x3fe571;return _0x274a63;});}})[_0x3831('0x20')](respondWithFilteredResult(_0x524b0,_0x285805))[_0x3831('0x44')](handleError(_0x524b0,null));};function char(_0x41babf){return'number'===typeof _0x41babf?String[_0x3831('0x5c')]['apply'](null,arguments):_0x41babf;}function needsEncapsulation(_0x446e20){return!!_0x446e20&&(_0x446e20[_0x3831('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x446e20[_0x3831('0x5d')]()[_0x3831('0x5e')](char(0xa))>=0x0||_0x446e20[_0x3831('0x5d')]()[_0x3831('0x5e')](char(0x2c))>=0x0||_0x446e20[_0x3831('0x5d')]()[_0x3831('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x1e4f80){var _0xe17659=char(0x22),_0x507133='\x5c'+char(0x22),_0x10f1c3=_0x1e4f80['toString']()[_0x3831('0x5f')](new RegExp(_0xe17659,'g'),_0x507133);return _0xe17659+_0x10f1c3+_0xe17659;}exports[_0x3831('0x60')]=function(_0x4f62e9,_0x45f6c5,_0x3e28bb){var _0xc0dfc9,_0x30300;var _0x5674cd={'where':{'ProjectId':_0x4f62e9[_0x3831('0x46')]['id']}};if(_0x4f62e9['query'][_0x3831('0x61')]){_0x5674cd[_0x3831('0x36')][_0x3831('0x62')]=JSON[_0x3831('0x63')](_0x4f62e9[_0x3831('0x2c')][_0x3831('0x61')]);}return db[_0x3831('0x59')][_0x3831('0x43')](_0x5674cd)[_0x3831('0x20')](handleEntityNotFound(_0x45f6c5,null))[_0x3831('0x20')](function(_0x45274e){if(_0x45274e){_0xc0dfc9=_0x45274e;return db[_0x3831('0x64')][_0x3831('0x43')]({'where':{'SessionId':{'$in':_[_0x3831('0x39')](_0xc0dfc9,'id')},'ProjectId':_0x4f62e9[_0x3831('0x46')]['id']},'order':'-createdAt'});}})[_0x3831('0x20')](handleEntityNotFound(_0x45f6c5,null))[_0x3831('0x20')](function(_0x40a1f1){if(_0x40a1f1){_0x30300=_0x40a1f1;var _0x4db168={};for(var _0xba3862=0x0,_0x5c712f=_0x30300['length'];_0xba3862<_0x5c712f;_0xba3862++){if(!_0x4db168[_0x3831('0x32')](_0x30300[_0xba3862][_0x3831('0x65')])){_0x4db168[_0x30300[_0xba3862][_0x3831('0x65')]]=needsEncapsulation(_0x30300[_0xba3862]['question'])?encapsulate(_0x30300[_0xba3862][_0x3831('0x66')]):_0x30300[_0xba3862]['question'];}}var _0x293b87=[],_0x2d7958={};for(var _0x4d6431=0x0,_0x411bc5=_0xc0dfc9['length'];_0x4d6431<_0x411bc5;_0x4d6431++){_0x2d7958={'ProjectId':_0x4f62e9[_0x3831('0x46')]['id'],'SessionId':_0xc0dfc9[_0x4d6431]['id'],'StartTime':moment(_0xc0dfc9[_0x4d6431][_0x3831('0x62')])[_0x3831('0x67')](_0x3831('0x68'))};for(var _0x1871f7=0x0,_0x343fd9=_0x30300[_0x3831('0x31')];_0x1871f7<_0x343fd9;_0x1871f7++){if(_0x30300[_0x1871f7]['SessionId']==_0xc0dfc9[_0x4d6431]['id']&&_0x4db168[_0x3831('0x32')](_0x30300[_0x1871f7][_0x3831('0x65')])){_0x2d7958[_0x4db168[_0x30300[_0x1871f7][_0x3831('0x65')]]]=_0x30300[_0x1871f7]['answer'];}}for(var _0x28cee9 in _0x4db168){if(!_0x2d7958[_0x3831('0x32')](_0x4db168[_0x28cee9])){_0x2d7958[_0x4db168[_0x28cee9]]=null;}}_0x293b87[_0x3831('0x69')](_0x2d7958);}return _0x293b87;}})[_0x3831('0x20')](function(_0x113a77){if(!_[_0x3831('0x6a')](_0x113a77)){var _0x51d4ee=toCsv(_0x113a77);var _0x540601=Date[_0x3831('0x6b')]();fs[_0x3831('0x6c')](util[_0x3831('0x67')](_0x3831('0x6d'),_0x4f62e9[_0x3831('0x46')]['id'],_0x540601),_0x51d4ee);_0x45f6c5['setHeader']('Content-disposition','attachment;\x20filename='+util['format'](_0x3831('0x6e'),_0x4f62e9[_0x3831('0x46')]['id'],_0x540601));_0x45f6c5[_0x3831('0x6f')](_0x3831('0x70'),_0x3831('0x71'));return _0x45f6c5[_0x3831('0x72')](util[_0x3831('0x67')](_0x3831('0x6d'),_0x4f62e9[_0x3831('0x46')]['id'],_0x540601));}else{return _0x45f6c5['sendStatus'](0xcc);}})[_0x3831('0x44')](handleError(_0x45f6c5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 17194a5..c909453 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 _0x7556=['path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','api','moment','bluebird','request-promise'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x7556,0x188));var _0x6755=function(_0x400a73,_0x1d3cde){_0x400a73=_0x400a73-0x0;var _0x107a09=_0x7556[_0x400a73];return _0x107a09;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6755('0x0'));var moment=require(_0x6755('0x1'));var BPromise=require(_0x6755('0x2'));var rp=require(_0x6755('0x3'));var fs=require('fs');var path=require(_0x6755('0x4'));var rimraf=require(_0x6755('0x5'));var config=require('../../config/environment');var attributes=require(_0x6755('0x6'));module[_0x6755('0x7')]=function(_0x4029d3,_0xd64c7e){return _0x4029d3[_0x6755('0x8')](_0x6755('0x9'),attributes,{'tableName':_0x6755('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c9c=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x13d577,_0x54156b){var _0x54304e=function(_0x284e92){while(--_0x284e92){_0x13d577['push'](_0x13d577['shift']());}};_0x54304e(++_0x54156b);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c9('0x0'));var util=require(_0xc0c9('0x1'));var logger=require(_0xc0c9('0x2'))(_0xc0c9('0x3'));var moment=require('moment');var BPromise=require(_0xc0c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0c9('0x5'));var rimraf=require(_0xc0c9('0x6'));var config=require(_0xc0c9('0x7'));var attributes=require(_0xc0c9('0x8'));module[_0xc0c9('0x9')]=function(_0x46f5be,_0x439963){return _0x46f5be[_0xc0c9('0xa')](_0xc0c9('0xb'),attributes,{'tableName':_0xc0c9('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 ca8ffb5..41ad880 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 _0xc8c5=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0xc8c5,0x172));var _0x5c8c=function(_0x248952,_0x1c5a48){_0x248952=_0x248952-0x0;var _0x386a71=_0xc8c5[_0x248952];return _0x386a71;};'use strict';var _=require(_0x5c8c('0x0'));var util=require(_0x5c8c('0x1'));var moment=require(_0x5c8c('0x2'));var BPromise=require(_0x5c8c('0x3'));var rs=require(_0x5c8c('0x4'));var fs=require('fs');var Redis=require(_0x5c8c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c8c('0x6'));var logger=require(_0x5c8c('0x7'))(_0x5c8c('0x8'));var config=require(_0x5c8c('0x9'));var jayson=require(_0x5c8c('0xa'));var client=jayson[_0x5c8c('0xb')][_0x5c8c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x325271,_0x4fbcd2,_0x5b2db8){return new BPromise(function(_0x3bd5be,_0x2606fc){return client[_0x5c8c('0xd')](_0x325271,_0x5b2db8)[_0x5c8c('0xe')](function(_0x1a8bf2){logger[_0x5c8c('0xf')](_0x5c8c('0x10'),_0x4fbcd2,_0x5c8c('0x11'));logger[_0x5c8c('0x12')](_0x5c8c('0x13'),_0x4fbcd2,_0x5c8c('0x11'),JSON[_0x5c8c('0x14')](_0x1a8bf2));if(_0x1a8bf2[_0x5c8c('0x15')]){if(_0x1a8bf2[_0x5c8c('0x15')][_0x5c8c('0x16')]===0x1f4){logger[_0x5c8c('0x15')](_0x5c8c('0x10'),_0x4fbcd2,_0x1a8bf2[_0x5c8c('0x15')]['message']);return _0x2606fc(_0x1a8bf2[_0x5c8c('0x15')][_0x5c8c('0x17')]);}logger[_0x5c8c('0x15')](_0x5c8c('0x10'),_0x4fbcd2,_0x1a8bf2['error']['message']);return _0x3bd5be(_0x1a8bf2['error'][_0x5c8c('0x17')]);}else{logger[_0x5c8c('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4fbcd2,_0x5c8c('0x11'));_0x3bd5be(_0x1a8bf2[_0x5c8c('0x18')][_0x5c8c('0x17')]);}})[_0x5c8c('0x19')](function(_0x53dc82){logger[_0x5c8c('0x15')](_0x5c8c('0x10'),_0x4fbcd2,_0x53dc82);_0x2606fc(_0x53dc82);});});} \ No newline at end of file +var _0xf30f=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','request','then','info','request\x20sent','debug','stringify','error'];(function(_0xfb6c20,_0x4bcf73){var _0x4c11c0=function(_0x505f25){while(--_0x505f25){_0xfb6c20['push'](_0xfb6c20['shift']());}};_0x4c11c0(++_0x4bcf73);}(_0xf30f,0x1d9));var _0xff30=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf30f[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xff30('0x0'));var util=require(_0xff30('0x1'));var moment=require('moment');var BPromise=require(_0xff30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff30('0x3'))['db'];var utils=require(_0xff30('0x4'));var logger=require(_0xff30('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43d7da,_0x54291f,_0x1e7a39){return new BPromise(function(_0x213a58,_0xa01a4d){return client[_0xff30('0x6')](_0x43d7da,_0x1e7a39)[_0xff30('0x7')](function(_0xb09bec){logger[_0xff30('0x8')]('JscriptyProject,\x20%s,\x20%s',_0x54291f,_0xff30('0x9'));logger[_0xff30('0xa')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x54291f,_0xff30('0x9'),JSON[_0xff30('0xb')](_0xb09bec));if(_0xb09bec[_0xff30('0xc')]){if(_0xb09bec[_0xff30('0xc')][_0xff30('0xd')]===0x1f4){logger[_0xff30('0xc')](_0xff30('0xe'),_0x54291f,_0xb09bec[_0xff30('0xc')][_0xff30('0xf')]);return _0xa01a4d(_0xb09bec[_0xff30('0xc')][_0xff30('0xf')]);}logger['error'](_0xff30('0xe'),_0x54291f,_0xb09bec[_0xff30('0xc')][_0xff30('0xf')]);return _0x213a58(_0xb09bec['error'][_0xff30('0xf')]);}else{logger[_0xff30('0x8')](_0xff30('0xe'),_0x54291f,_0xff30('0x9'));_0x213a58(_0xb09bec[_0xff30('0x10')]['message']);}})[_0xff30('0x11')](function(_0x1a074b){logger[_0xff30('0xc')](_0xff30('0xe'),_0x54291f,_0x1a074b);_0xa01a4d(_0x1a074b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b1f3f32..2e24a46 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 _0x6406=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2ae7d9,_0x3547c4){var _0x5851e8=function(_0x19da94){while(--_0x19da94){_0x2ae7d9['push'](_0x2ae7d9['shift']());}};_0x5851e8(++_0x3547c4);}(_0x6406,0x94));var _0x6640=function(_0x16192a,_0x5ebefc){_0x16192a=_0x16192a-0x0;var _0x1274fd=_0x6406[_0x16192a];return _0x1274fd;};'use strict';var multer=require(_0x6640('0x0'));var util=require(_0x6640('0x1'));var path=require(_0x6640('0x2'));var timeout=require(_0x6640('0x3'));var express=require('express');var router=express[_0x6640('0x4')]();var auth=require(_0x6640('0x5'));var interaction=require(_0x6640('0x6'));var config=require(_0x6640('0x7'));var controller=require(_0x6640('0x8'));router[_0x6640('0x9')]('/',auth[_0x6640('0xa')](),controller[_0x6640('0xb')]);router['get'](_0x6640('0xc'),auth[_0x6640('0xa')](),controller[_0x6640('0xd')]);router['get'](_0x6640('0xe'),auth[_0x6640('0xa')](),controller[_0x6640('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6640('0x10')]);router[_0x6640('0x11')](_0x6640('0xe'),auth[_0x6640('0xa')](),controller[_0x6640('0x12')]);router[_0x6640('0x13')](_0x6640('0xe'),auth[_0x6640('0xa')](),controller[_0x6640('0x14')]);module[_0x6640('0x15')]=router; \ No newline at end of file +var _0x454d=['isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x49416f,_0x457ccd){var _0x57ee0d=function(_0x416dc0){while(--_0x416dc0){_0x49416f['push'](_0x49416f['shift']());}};_0x57ee0d(++_0x457ccd);}(_0x454d,0x17f));var _0xd454=function(_0x33f7e1,_0x48d209){_0x33f7e1=_0x33f7e1-0x0;var _0x23bab4=_0x454d[_0x33f7e1];return _0x23bab4;};'use strict';var multer=require(_0xd454('0x0'));var util=require('util');var path=require(_0xd454('0x1'));var timeout=require('connect-timeout');var express=require(_0xd454('0x2'));var router=express['Router']();var auth=require(_0xd454('0x3'));var interaction=require(_0xd454('0x4'));var config=require(_0xd454('0x5'));var controller=require(_0xd454('0x6'));router[_0xd454('0x7')]('/',auth[_0xd454('0x8')](),controller['index']);router[_0xd454('0x7')](_0xd454('0x9'),auth[_0xd454('0x8')](),controller[_0xd454('0xa')]);router[_0xd454('0x7')](_0xd454('0xb'),auth[_0xd454('0x8')](),controller['show']);router['post']('/',auth[_0xd454('0x8')](),controller[_0xd454('0xc')]);router[_0xd454('0xd')]('/:id',auth[_0xd454('0x8')](),controller[_0xd454('0xe')]);router[_0xd454('0xf')](_0xd454('0xb'),auth[_0xd454('0x8')](),controller[_0xd454('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 76c8d2e..9e8a3cc 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 _0x9879=['exports','STRING','TEXT','long'];(function(_0x534a40,_0x69f5a3){var _0x1feba1=function(_0x346124){while(--_0x346124){_0x534a40['push'](_0x534a40['shift']());}};_0x1feba1(++_0x69f5a3);}(_0x9879,0x98));var _0x9987=function(_0x5f1efc,_0x422da9){_0x5f1efc=_0x5f1efc-0x0;var _0x5cf36b=_0x9879[_0x5f1efc];return _0x5cf36b;};'use strict';var Sequelize=require('sequelize');module[_0x9987('0x0')]={'question':{'type':Sequelize[_0x9987('0x1')]},'answer':{'type':Sequelize[_0x9987('0x2')](_0x9987('0x3'))},'membername':{'type':Sequelize[_0x9987('0x1')]},'projectname':{'type':Sequelize[_0x9987('0x1')]},'queue':{'type':Sequelize[_0x9987('0x1')]},'uniqueid':{'type':Sequelize[_0x9987('0x1')]},'calleridname':{'type':Sequelize[_0x9987('0x1')]},'calleridnum':{'type':Sequelize[_0x9987('0x1')]},'questionId':{'type':Sequelize[_0x9987('0x1')]}}; \ No newline at end of file +var _0xb74d=['sequelize','STRING','long'];(function(_0x2c482f,_0x448643){var _0x794093=function(_0x4cf611){while(--_0x4cf611){_0x2c482f['push'](_0x2c482f['shift']());}};_0x794093(++_0x448643);}(_0xb74d,0x16e));var _0xdb74=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0xb74d[_0x4df1f5];return _0x56585b;};'use strict';var Sequelize=require(_0xdb74('0x0'));module['exports']={'question':{'type':Sequelize[_0xdb74('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xdb74('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdb74('0x1')]},'queue':{'type':Sequelize[_0xdb74('0x1')]},'uniqueid':{'type':Sequelize[_0xdb74('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdb74('0x1')]},'questionId':{'type':Sequelize[_0xdb74('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index aa775ce..81515fb 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 _0xe31a=['rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','JscriptyQuestionReport','findAll','rows','show','params','create','body','catch','update','find','destroy','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','index'];(function(_0x3629c6,_0x439def){var _0x14b2a9=function(_0x528634){while(--_0x528634){_0x3629c6['push'](_0x3629c6['shift']());}};_0x14b2a9(++_0x439def);}(_0xe31a,0x1ec));var _0xae31=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe31a[_0x5f309e];return _0x487b5e;};'use strict';var pdf=require(_0xae31('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae31('0x2'));var moment=require(_0xae31('0x3'));var BPromise=require(_0xae31('0x4'));var Mustache=require(_0xae31('0x5'));var util=require('util');var path=require(_0xae31('0x6'));var sox=require(_0xae31('0x7'));var csv=require(_0xae31('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae31('0x9'));var squel=require(_0xae31('0xa'));var crypto=require(_0xae31('0xb'));var jsforce=require(_0xae31('0xc'));var deskjs=require(_0xae31('0xd'));var toCsv=require('to-csv');var querystring=require(_0xae31('0xe'));var Papa=require('papaparse');var Redis=require(_0xae31('0xf'));var authService=require(_0xae31('0x10'));var qs=require(_0xae31('0x11'));var hardwareService=require(_0xae31('0x12'));var logger=require(_0xae31('0x13'))(_0xae31('0x14'));var utils=require(_0xae31('0x15'));var config=require(_0xae31('0x16'));var db=require(_0xae31('0x17'))['db'];function respondWithStatusCode(_0x3b964f,_0xa71236){_0xa71236=_0xa71236||0xcc;return function(_0x3a5654){if(_0x3a5654){return _0x3b964f[_0xae31('0x18')](_0xa71236);}return _0x3b964f[_0xae31('0x19')](_0xa71236)[_0xae31('0x1a')]();};}function respondWithResult(_0x1abc90,_0x2a93ef){_0x2a93ef=_0x2a93ef||0xc8;return function(_0x517ba4){if(_0x517ba4){return _0x1abc90[_0xae31('0x19')](_0x2a93ef)['json'](_0x517ba4);}};}function respondWithFilteredResult(_0x3577db,_0x2d8658){return function(_0x3cb249){if(_0x3cb249){var _0x130e15=_0x3cb249[_0xae31('0x1b')],_0x5d818f=_0x2d8658[_0xae31('0x1c')],_0x400057=_0x2d8658[_0xae31('0x1c')]+_0x2d8658[_0xae31('0x1d')],_0x4b8937;if(_0x400057>=_0x130e15){_0x400057=_0x130e15;_0x4b8937=0xc8;}else{_0x4b8937=0xce;}_0x3577db[_0xae31('0x19')](_0x4b8937);return _0x3577db[_0xae31('0x1e')](_0xae31('0x1f'),_0x5d818f+'-'+_0x400057+'/'+_0x130e15)[_0xae31('0x20')](_0x3cb249);}return null;};}function patchUpdates(_0x17264b){return function(_0x409927){try{jsonpatch[_0xae31('0x21')](_0x409927,_0x17264b,!![]);}catch(_0x524251){return BPromise[_0xae31('0x22')](_0x524251);}return _0x409927[_0xae31('0x23')]();};}function saveUpdates(_0x38abf3,_0x468508){return function(_0x3d3377){if(_0x3d3377){return _0x3d3377['update'](_0x38abf3)[_0xae31('0x24')](function(_0xac96c5){return _0xac96c5;});}return null;};}function removeEntity(_0x66587d,_0x5620e2){return function(_0xee5bc8){if(_0xee5bc8){return _0xee5bc8['destroy']()['then'](function(){_0x66587d[_0xae31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5293f9,_0x35e734){return function(_0xc4164d){if(!_0xc4164d){_0x5293f9['sendStatus'](0x194);}return _0xc4164d;};}function handleError(_0x1d8056,_0x338348){_0x338348=_0x338348||0x1f4;return function(_0x7a6721){logger[_0xae31('0x25')](_0x7a6721[_0xae31('0x26')]);if(_0x7a6721['name']){delete _0x7a6721['name'];}_0x1d8056['status'](_0x338348)['send'](_0x7a6721);};}exports[_0xae31('0x27')]=function(_0xd2cabe,_0x5baaa9){var _0x2bd8fd={},_0x55dd89={},_0x3cd202={'count':0x0,'rows':[]};var _0x38f58a=db['JscriptyQuestionReport'][_0xae31('0x28')];_0x55dd89['model']=_[_0xae31('0x29')](_0x38f58a);_0x55dd89['query']=_['keys'](_0xd2cabe[_0xae31('0x2a')]);_0x55dd89[_0xae31('0x2b')]=_[_0xae31('0x2c')](_0x55dd89[_0xae31('0x2d')],_0x55dd89[_0xae31('0x2a')]);_0x2bd8fd['attributes']=_[_0xae31('0x2c')](_0x55dd89[_0xae31('0x2d')],qs['fields'](_0xd2cabe[_0xae31('0x2a')][_0xae31('0x2e')]));_0x2bd8fd[_0xae31('0x2f')]=_0x2bd8fd[_0xae31('0x2f')][_0xae31('0x30')]?_0x2bd8fd[_0xae31('0x2f')]:_0x55dd89[_0xae31('0x2d')];if(!_0xd2cabe['query']['hasOwnProperty'](_0xae31('0x31'))){_0x2bd8fd['limit']=qs[_0xae31('0x1d')](_0xd2cabe[_0xae31('0x2a')][_0xae31('0x1d')]);_0x2bd8fd[_0xae31('0x1c')]=qs[_0xae31('0x1c')](_0xd2cabe[_0xae31('0x2a')]['offset']);}_0x2bd8fd[_0xae31('0x32')]=qs['sort'](_0xd2cabe[_0xae31('0x2a')][_0xae31('0x33')]);_0x2bd8fd[_0xae31('0x34')]=qs[_0xae31('0x2b')](_[_0xae31('0x35')](_0xd2cabe[_0xae31('0x2a')],_0x55dd89[_0xae31('0x2b')]));if(_0xd2cabe[_0xae31('0x2a')][_0xae31('0x36')]){_0x2bd8fd[_0xae31('0x34')]=_[_0xae31('0x37')](_0x2bd8fd[_0xae31('0x34')],{'$or':_[_0xae31('0x38')](_0x38f58a,function(_0x374497){if(_0x374497[_0xae31('0x39')][_0xae31('0x3a')]!==_0xae31('0x3b')){var _0x3c590f={};_0x3c590f[_0x374497[_0xae31('0x3c')]]={'$like':'%'+_0xd2cabe['query'][_0xae31('0x36')]+'%'};return _0x3c590f;}})});}_0x2bd8fd=_['merge']({},_0x2bd8fd,_0xd2cabe[_0xae31('0x3d')]);var _0x32de3a={'where':_0x2bd8fd[_0xae31('0x34')]};return db['JscriptyQuestionReport'][_0xae31('0x1b')](_0x32de3a)[_0xae31('0x24')](function(_0x3b16c6){_0x3cd202[_0xae31('0x1b')]=_0x3b16c6;if(_0xd2cabe[_0xae31('0x2a')][_0xae31('0x3e')]){_0x2bd8fd[_0xae31('0x3f')]=[{'all':!![]}];}return db[_0xae31('0x40')][_0xae31('0x41')](_0x2bd8fd);})['then'](function(_0x307f3e){_0x3cd202[_0xae31('0x42')]=_0x307f3e;return _0x3cd202;})[_0xae31('0x24')](respondWithFilteredResult(_0x5baaa9,_0x2bd8fd))['catch'](handleError(_0x5baaa9,null));};exports[_0xae31('0x43')]=function(_0x481298,_0x342943){var _0x33fd80={'raw':!![],'where':{'id':_0x481298[_0xae31('0x44')]['id']}},_0x12ad0c={};_0x12ad0c[_0xae31('0x2d')]=_[_0xae31('0x29')](db[_0xae31('0x40')][_0xae31('0x28')]);_0x12ad0c[_0xae31('0x2a')]=_['keys'](_0x481298[_0xae31('0x2a')]);_0x12ad0c[_0xae31('0x2b')]=_[_0xae31('0x2c')](_0x12ad0c[_0xae31('0x2d')],_0x12ad0c[_0xae31('0x2a')]);_0x33fd80['attributes']=_[_0xae31('0x2c')](_0x12ad0c[_0xae31('0x2d')],qs['fields'](_0x481298[_0xae31('0x2a')]['fields']));_0x33fd80['attributes']=_0x33fd80[_0xae31('0x2f')][_0xae31('0x30')]?_0x33fd80[_0xae31('0x2f')]:_0x12ad0c['model'];if(_0x481298[_0xae31('0x2a')][_0xae31('0x3e')]){_0x33fd80[_0xae31('0x3f')]=[{'all':!![]}];}_0x33fd80=_[_0xae31('0x37')]({},_0x33fd80,_0x481298['options']);return db[_0xae31('0x40')]['find'](_0x33fd80)[_0xae31('0x24')](handleEntityNotFound(_0x342943,null))[_0xae31('0x24')](respondWithResult(_0x342943,null))['catch'](handleError(_0x342943,null));};exports[_0xae31('0x45')]=function(_0x30e844,_0x4ce2ad){return db[_0xae31('0x40')][_0xae31('0x45')](_0x30e844[_0xae31('0x46')],{})[_0xae31('0x24')](respondWithResult(_0x4ce2ad,0xc9))[_0xae31('0x47')](handleError(_0x4ce2ad,null));};exports[_0xae31('0x48')]=function(_0x57c51a,_0x267205){if(_0x57c51a[_0xae31('0x46')]['id']){delete _0x57c51a[_0xae31('0x46')]['id'];}return db[_0xae31('0x40')][_0xae31('0x49')]({'where':{'id':_0x57c51a['params']['id']}})[_0xae31('0x24')](handleEntityNotFound(_0x267205,null))[_0xae31('0x24')](saveUpdates(_0x57c51a[_0xae31('0x46')],null))[_0xae31('0x24')](respondWithResult(_0x267205,null))['catch'](handleError(_0x267205,null));};exports[_0xae31('0x4a')]=function(_0x3437be,_0x3d983d){return db[_0xae31('0x40')][_0xae31('0x49')]({'where':{'id':_0x3437be[_0xae31('0x44')]['id']}})[_0xae31('0x24')](handleEntityNotFound(_0x3d983d,null))[_0xae31('0x24')](removeEntity(_0x3d983d,null))[_0xae31('0x47')](handleError(_0x3d983d,null));};exports[_0xae31('0x4b')]=function(_0x323fd3,_0x452bcf){return db[_0xae31('0x40')][_0xae31('0x4b')]()[_0xae31('0x24')](respondWithResult(_0x452bcf,null))[_0xae31('0x47')](handleError(_0x452bcf,null));}; \ No newline at end of file +var _0xa045=['end','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','name','index','JscriptyQuestionReport','rawAttributes','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','limit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status'];(function(_0x5d7c46,_0x1ed609){var _0x3bd0c4=function(_0x2f1335){while(--_0x2f1335){_0x5d7c46['push'](_0x5d7c46['shift']());}};_0x3bd0c4(++_0x1ed609);}(_0xa045,0xc4));var _0x5a04=function(_0x1eec9e,_0x3481cd){_0x1eec9e=_0x1eec9e-0x0;var _0x5a5b9d=_0xa045[_0x1eec9e];return _0x5a5b9d;};'use strict';var pdf=require(_0x5a04('0x0'));var emlformat=require(_0x5a04('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a04('0x2'));var jsonpatch=require(_0x5a04('0x3'));var rp=require('request-promise');var moment=require(_0x5a04('0x4'));var BPromise=require(_0x5a04('0x5'));var Mustache=require(_0x5a04('0x6'));var util=require(_0x5a04('0x7'));var path=require(_0x5a04('0x8'));var sox=require(_0x5a04('0x9'));var csv=require('to-csv');var ejs=require(_0x5a04('0xa'));var fs=require('fs');var _=require(_0x5a04('0xb'));var squel=require(_0x5a04('0xc'));var crypto=require('crypto');var jsforce=require(_0x5a04('0xd'));var deskjs=require(_0x5a04('0xe'));var toCsv=require(_0x5a04('0xf'));var querystring=require(_0x5a04('0x10'));var Papa=require(_0x5a04('0x11'));var Redis=require('ioredis');var authService=require(_0x5a04('0x12'));var qs=require(_0x5a04('0x13'));var hardwareService=require(_0x5a04('0x14'));var logger=require(_0x5a04('0x15'))(_0x5a04('0x16'));var utils=require(_0x5a04('0x17'));var config=require('../../config/environment');var db=require(_0x5a04('0x18'))['db'];function respondWithStatusCode(_0x40a5d0,_0x3731ba){_0x3731ba=_0x3731ba||0xcc;return function(_0x542e34){if(_0x542e34){return _0x40a5d0['sendStatus'](_0x3731ba);}return _0x40a5d0[_0x5a04('0x19')](_0x3731ba)[_0x5a04('0x1a')]();};}function respondWithResult(_0x3b21a9,_0x57167f){_0x57167f=_0x57167f||0xc8;return function(_0x562761){if(_0x562761){return _0x3b21a9['status'](_0x57167f)['json'](_0x562761);}};}function respondWithFilteredResult(_0x4c8672,_0x478789){return function(_0x1b6075){if(_0x1b6075){var _0x3accbe=_0x1b6075[_0x5a04('0x1b')],_0x1661ac=_0x478789[_0x5a04('0x1c')],_0x263b05=_0x478789[_0x5a04('0x1c')]+_0x478789['limit'],_0x11c14b;if(_0x263b05>=_0x3accbe){_0x263b05=_0x3accbe;_0x11c14b=0xc8;}else{_0x11c14b=0xce;}_0x4c8672[_0x5a04('0x19')](_0x11c14b);return _0x4c8672[_0x5a04('0x1d')]('Content-Range',_0x1661ac+'-'+_0x263b05+'/'+_0x3accbe)['json'](_0x1b6075);}return null;};}function patchUpdates(_0x16404e){return function(_0x32db32){try{jsonpatch[_0x5a04('0x1e')](_0x32db32,_0x16404e,!![]);}catch(_0x18c6f6){return BPromise[_0x5a04('0x1f')](_0x18c6f6);}return _0x32db32[_0x5a04('0x20')]();};}function saveUpdates(_0x4cc07a,_0x47e18c){return function(_0x22325c){if(_0x22325c){return _0x22325c[_0x5a04('0x21')](_0x4cc07a)[_0x5a04('0x22')](function(_0x6eb0e4){return _0x6eb0e4;});}return null;};}function removeEntity(_0x39d27f,_0x33f253){return function(_0x599b57){if(_0x599b57){return _0x599b57[_0x5a04('0x23')]()[_0x5a04('0x22')](function(){_0x39d27f['status'](0xcc)[_0x5a04('0x1a')]();});}};}function handleEntityNotFound(_0x574451,_0x5efcad){return function(_0x41e7c1){if(!_0x41e7c1){_0x574451[_0x5a04('0x24')](0x194);}return _0x41e7c1;};}function handleError(_0x7c8a09,_0x4ec075){_0x4ec075=_0x4ec075||0x1f4;return function(_0x2506ea){logger[_0x5a04('0x25')](_0x2506ea['stack']);if(_0x2506ea[_0x5a04('0x26')]){delete _0x2506ea[_0x5a04('0x26')];}_0x7c8a09['status'](_0x4ec075)['send'](_0x2506ea);};}exports[_0x5a04('0x27')]=function(_0x3a82e3,_0x1c37f4){var _0x2e5849={},_0x3047f3={},_0x5f327a={'count':0x0,'rows':[]};var _0x38a32e=db[_0x5a04('0x28')][_0x5a04('0x29')];_0x3047f3[_0x5a04('0x2a')]=_[_0x5a04('0x2b')](_0x38a32e);_0x3047f3[_0x5a04('0x2c')]=_[_0x5a04('0x2b')](_0x3a82e3['query']);_0x3047f3[_0x5a04('0x2d')]=_[_0x5a04('0x2e')](_0x3047f3['model'],_0x3047f3[_0x5a04('0x2c')]);_0x2e5849['attributes']=_[_0x5a04('0x2e')](_0x3047f3[_0x5a04('0x2a')],qs['fields'](_0x3a82e3['query'][_0x5a04('0x2f')]));_0x2e5849['attributes']=_0x2e5849['attributes'][_0x5a04('0x30')]?_0x2e5849[_0x5a04('0x31')]:_0x3047f3[_0x5a04('0x2a')];if(!_0x3a82e3['query'][_0x5a04('0x32')]('nolimit')){_0x2e5849[_0x5a04('0x33')]=qs[_0x5a04('0x33')](_0x3a82e3[_0x5a04('0x2c')]['limit']);_0x2e5849['offset']=qs[_0x5a04('0x1c')](_0x3a82e3[_0x5a04('0x2c')][_0x5a04('0x1c')]);}_0x2e5849['order']=qs[_0x5a04('0x34')](_0x3a82e3[_0x5a04('0x2c')]['sort']);_0x2e5849[_0x5a04('0x35')]=qs[_0x5a04('0x2d')](_[_0x5a04('0x36')](_0x3a82e3[_0x5a04('0x2c')],_0x3047f3[_0x5a04('0x2d')]));if(_0x3a82e3[_0x5a04('0x2c')][_0x5a04('0x37')]){_0x2e5849['where']=_[_0x5a04('0x38')](_0x2e5849['where'],{'$or':_[_0x5a04('0x39')](_0x38a32e,function(_0x3e298a){if(_0x3e298a[_0x5a04('0x3a')][_0x5a04('0x3b')]!==_0x5a04('0x3c')){var _0xb37d86={};_0xb37d86[_0x3e298a[_0x5a04('0x3d')]]={'$like':'%'+_0x3a82e3[_0x5a04('0x2c')][_0x5a04('0x37')]+'%'};return _0xb37d86;}})});}_0x2e5849=_[_0x5a04('0x38')]({},_0x2e5849,_0x3a82e3['options']);var _0x23db41={'where':_0x2e5849[_0x5a04('0x35')]};return db[_0x5a04('0x28')][_0x5a04('0x1b')](_0x23db41)[_0x5a04('0x22')](function(_0x4c9b6f){_0x5f327a[_0x5a04('0x1b')]=_0x4c9b6f;if(_0x3a82e3['query'][_0x5a04('0x3e')]){_0x2e5849[_0x5a04('0x3f')]=[{'all':!![]}];}return db[_0x5a04('0x28')][_0x5a04('0x40')](_0x2e5849);})['then'](function(_0x542271){_0x5f327a[_0x5a04('0x41')]=_0x542271;return _0x5f327a;})[_0x5a04('0x22')](respondWithFilteredResult(_0x1c37f4,_0x2e5849))[_0x5a04('0x42')](handleError(_0x1c37f4,null));};exports[_0x5a04('0x43')]=function(_0xb9c2d9,_0x1f4674){var _0x38e58f={'raw':!![],'where':{'id':_0xb9c2d9[_0x5a04('0x44')]['id']}},_0x507a7b={};_0x507a7b['model']=_[_0x5a04('0x2b')](db[_0x5a04('0x28')][_0x5a04('0x29')]);_0x507a7b['query']=_[_0x5a04('0x2b')](_0xb9c2d9[_0x5a04('0x2c')]);_0x507a7b[_0x5a04('0x2d')]=_['intersection'](_0x507a7b[_0x5a04('0x2a')],_0x507a7b[_0x5a04('0x2c')]);_0x38e58f[_0x5a04('0x31')]=_[_0x5a04('0x2e')](_0x507a7b['model'],qs[_0x5a04('0x2f')](_0xb9c2d9[_0x5a04('0x2c')][_0x5a04('0x2f')]));_0x38e58f[_0x5a04('0x31')]=_0x38e58f[_0x5a04('0x31')][_0x5a04('0x30')]?_0x38e58f[_0x5a04('0x31')]:_0x507a7b[_0x5a04('0x2a')];if(_0xb9c2d9[_0x5a04('0x2c')][_0x5a04('0x3e')]){_0x38e58f[_0x5a04('0x3f')]=[{'all':!![]}];}_0x38e58f=_[_0x5a04('0x38')]({},_0x38e58f,_0xb9c2d9[_0x5a04('0x45')]);return db[_0x5a04('0x28')][_0x5a04('0x46')](_0x38e58f)[_0x5a04('0x22')](handleEntityNotFound(_0x1f4674,null))['then'](respondWithResult(_0x1f4674,null))['catch'](handleError(_0x1f4674,null));};exports[_0x5a04('0x47')]=function(_0xdf55fc,_0x7849f9){return db[_0x5a04('0x28')][_0x5a04('0x47')](_0xdf55fc[_0x5a04('0x48')],{})[_0x5a04('0x22')](respondWithResult(_0x7849f9,0xc9))[_0x5a04('0x42')](handleError(_0x7849f9,null));};exports[_0x5a04('0x21')]=function(_0x458ba5,_0x18db66){if(_0x458ba5[_0x5a04('0x48')]['id']){delete _0x458ba5[_0x5a04('0x48')]['id'];}return db[_0x5a04('0x28')][_0x5a04('0x46')]({'where':{'id':_0x458ba5[_0x5a04('0x44')]['id']}})[_0x5a04('0x22')](handleEntityNotFound(_0x18db66,null))['then'](saveUpdates(_0x458ba5[_0x5a04('0x48')],null))['then'](respondWithResult(_0x18db66,null))['catch'](handleError(_0x18db66,null));};exports[_0x5a04('0x23')]=function(_0xe6cf4e,_0x325f60){return db[_0x5a04('0x28')]['find']({'where':{'id':_0xe6cf4e[_0x5a04('0x44')]['id']}})[_0x5a04('0x22')](handleEntityNotFound(_0x325f60,null))[_0x5a04('0x22')](removeEntity(_0x325f60,null))[_0x5a04('0x42')](handleError(_0x325f60,null));};exports[_0x5a04('0x49')]=function(_0xfc18d7,_0x24c404){return db['JscriptyQuestionReport']['describe']()[_0x5a04('0x22')](respondWithResult(_0x24c404,null))[_0x5a04('0x42')](handleError(_0x24c404,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 6263db3..dfe9740 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 _0xdba1=['JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x4deed1,_0x311785){var _0x3212fc=function(_0x2e2d3c){while(--_0x2e2d3c){_0x4deed1['push'](_0x4deed1['shift']());}};_0x3212fc(++_0x311785);}(_0xdba1,0x1e2));var _0x1dba=function(_0x30d44c,_0x1267d5){_0x30d44c=_0x30d44c-0x0;var _0x3c3edc=_0xdba1[_0x30d44c];return _0x3c3edc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1dba('0x0'))(_0x1dba('0x1'));var moment=require(_0x1dba('0x2'));var BPromise=require(_0x1dba('0x3'));var rp=require(_0x1dba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1dba('0x5'));var attributes=require(_0x1dba('0x6'));module[_0x1dba('0x7')]=function(_0x57cbd1,_0x5efc94){return _0x57cbd1['define'](_0x1dba('0x8'),attributes,{'tableName':_0x1dba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d2=['define','JscriptyQuestionReport','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x45423e,_0x4cc862){var _0x3157c1=function(_0x5ddce4){while(--_0x5ddce4){_0x45423e['push'](_0x45423e['shift']());}};_0x3157c1(++_0x4cc862);}(_0xb0d2,0xb2));var _0x2b0d=function(_0x5530d0,_0x56bac6){_0x5530d0=_0x5530d0-0x0;var _0x4b4285=_0xb0d2[_0x5530d0];return _0x4b4285;};'use strict';var _=require(_0x2b0d('0x0'));var util=require(_0x2b0d('0x1'));var logger=require(_0x2b0d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2b0d('0x3'));var rp=require(_0x2b0d('0x4'));var fs=require('fs');var path=require(_0x2b0d('0x5'));var rimraf=require(_0x2b0d('0x6'));var config=require(_0x2b0d('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2b0d('0x8')]=function(_0x1df39d,_0x2e074a){return _0x1df39d[_0x2b0d('0x9')](_0x2b0d('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 825a043..a6b6c11 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 _0x9d1a=['message','JscriptyQuestionReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code'];(function(_0x560844,_0x225e43){var _0x4e7b73=function(_0x2e57a8){while(--_0x2e57a8){_0x560844['push'](_0x560844['shift']());}};_0x4e7b73(++_0x225e43);}(_0x9d1a,0xab));var _0xa9d1=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x9d1a[_0x15cae3];return _0x20596f;};'use strict';var _=require(_0xa9d1('0x0'));var util=require(_0xa9d1('0x1'));var moment=require(_0xa9d1('0x2'));var BPromise=require(_0xa9d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9d1('0x4'));var db=require(_0xa9d1('0x5'))['db'];var utils=require(_0xa9d1('0x6'));var logger=require(_0xa9d1('0x7'))(_0xa9d1('0x8'));var config=require(_0xa9d1('0x9'));var jayson=require(_0xa9d1('0xa'));var client=jayson[_0xa9d1('0xb')][_0xa9d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2712d3,_0x2cdc96,_0x539996){return new BPromise(function(_0x126a96,_0x19b164){return client['request'](_0x2712d3,_0x539996)[_0xa9d1('0xd')](function(_0x3e7584){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cdc96,_0xa9d1('0xe'));logger[_0xa9d1('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2cdc96,'request\x20sent',JSON['stringify'](_0x3e7584));if(_0x3e7584['error']){if(_0x3e7584[_0xa9d1('0x10')][_0xa9d1('0x11')]===0x1f4){logger[_0xa9d1('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cdc96,_0x3e7584['error'][_0xa9d1('0x12')]);return _0x19b164(_0x3e7584['error']['message']);}logger[_0xa9d1('0x10')](_0xa9d1('0x13'),_0x2cdc96,_0x3e7584[_0xa9d1('0x10')]['message']);return _0x126a96(_0x3e7584[_0xa9d1('0x10')][_0xa9d1('0x12')]);}else{logger['info'](_0xa9d1('0x13'),_0x2cdc96,_0xa9d1('0xe'));_0x126a96(_0x3e7584['result'][_0xa9d1('0x12')]);}})[_0xa9d1('0x14')](function(_0xd3ce50){logger[_0xa9d1('0x10')](_0xa9d1('0x13'),_0x2cdc96,_0xd3ce50);_0x19b164(_0xd3ce50);});});} \ No newline at end of file +var _0x1128=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1128,0xef));var _0x8112=function(_0x3102af,_0x137b65){_0x3102af=_0x3102af-0x0;var _0x3c208c=_0x1128[_0x3102af];return _0x3c208c;};'use strict';var _=require('lodash');var util=require(_0x8112('0x0'));var moment=require(_0x8112('0x1'));var BPromise=require(_0x8112('0x2'));var rs=require(_0x8112('0x3'));var fs=require('fs');var Redis=require(_0x8112('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8112('0x5'));var logger=require(_0x8112('0x6'))(_0x8112('0x7'));var config=require('../../config/environment');var jayson=require(_0x8112('0x8'));var client=jayson[_0x8112('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1327c1,_0x58a881,_0x4e86d2){return new BPromise(function(_0x380b6c,_0x47f396){return client[_0x8112('0xa')](_0x1327c1,_0x4e86d2)[_0x8112('0xb')](function(_0x5c4ffc){logger['info'](_0x8112('0xc'),_0x58a881,_0x8112('0xd'));logger[_0x8112('0xe')](_0x8112('0xf'),_0x58a881,_0x8112('0xd'),JSON[_0x8112('0x10')](_0x5c4ffc));if(_0x5c4ffc['error']){if(_0x5c4ffc[_0x8112('0x11')][_0x8112('0x12')]===0x1f4){logger['error'](_0x8112('0xc'),_0x58a881,_0x5c4ffc[_0x8112('0x11')]['message']);return _0x47f396(_0x5c4ffc[_0x8112('0x11')][_0x8112('0x13')]);}logger['error'](_0x8112('0xc'),_0x58a881,_0x5c4ffc[_0x8112('0x11')][_0x8112('0x13')]);return _0x380b6c(_0x5c4ffc[_0x8112('0x11')]['message']);}else{logger[_0x8112('0x14')](_0x8112('0xc'),_0x58a881,_0x8112('0xd'));_0x380b6c(_0x5c4ffc[_0x8112('0x15')][_0x8112('0x13')]);}})['catch'](function(_0x5d3c6e){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x58a881,_0x5d3c6e);_0x47f396(_0x5d3c6e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d68c74a..41964d4 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 _0x0c4c=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','index','get','isAuthenticated','/:id','show','getQuestions','post','create','put','update','destroy','exports','multer'];(function(_0x6c450d,_0x979ea4){var _0x51df30=function(_0x4f41b7){while(--_0x4f41b7){_0x6c450d['push'](_0x6c450d['shift']());}};_0x51df30(++_0x979ea4);}(_0x0c4c,0x1a1));var _0xc0c4=function(_0x471275,_0x49194e){_0x471275=_0x471275-0x0;var _0x3c4542=_0x0c4c[_0x471275];return _0x3c4542;};'use strict';var multer=require(_0xc0c4('0x0'));var util=require('util');var path=require(_0xc0c4('0x1'));var timeout=require(_0xc0c4('0x2'));var express=require('express');var router=express[_0xc0c4('0x3')]();var auth=require(_0xc0c4('0x4'));var interaction=require(_0xc0c4('0x5'));var config=require('../../config/environment');var controller=require(_0xc0c4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc0c4('0x7')]);router[_0xc0c4('0x8')]('/describe',auth[_0xc0c4('0x9')](),controller['describe']);router[_0xc0c4('0x8')](_0xc0c4('0xa'),auth['isAuthenticated'](),controller[_0xc0c4('0xb')]);router['get']('/:id/questions',auth[_0xc0c4('0x9')](),controller[_0xc0c4('0xc')]);router[_0xc0c4('0xd')]('/',auth[_0xc0c4('0x9')](),controller[_0xc0c4('0xe')]);router[_0xc0c4('0xf')](_0xc0c4('0xa'),auth[_0xc0c4('0x9')](),controller[_0xc0c4('0x10')]);router['delete'](_0xc0c4('0xa'),auth['isAuthenticated'](),controller[_0xc0c4('0x11')]);module[_0xc0c4('0x12')]=router; \ No newline at end of file +var _0xf554=['create','put','update','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','getQuestions','post'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xf554,0x194));var _0x4f55=function(_0x108e52,_0x19d2c3){_0x108e52=_0x108e52-0x0;var _0x526cf6=_0xf554[_0x108e52];return _0x526cf6;};'use strict';var multer=require('multer');var util=require(_0x4f55('0x0'));var path=require('path');var timeout=require(_0x4f55('0x1'));var express=require('express');var router=express[_0x4f55('0x2')]();var auth=require(_0x4f55('0x3'));var interaction=require(_0x4f55('0x4'));var config=require(_0x4f55('0x5'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x4f55('0x6')](),controller[_0x4f55('0x7')]);router[_0x4f55('0x8')]('/describe',auth[_0x4f55('0x6')](),controller[_0x4f55('0x9')]);router[_0x4f55('0x8')](_0x4f55('0xa'),auth['isAuthenticated'](),controller[_0x4f55('0xb')]);router['get']('/:id/questions',auth[_0x4f55('0x6')](),controller[_0x4f55('0xc')]);router[_0x4f55('0xd')]('/',auth[_0x4f55('0x6')](),controller[_0x4f55('0xe')]);router[_0x4f55('0xf')](_0x4f55('0xa'),auth['isAuthenticated'](),controller[_0x4f55('0x10')]);router[_0x4f55('0x11')](_0x4f55('0xa'),auth[_0x4f55('0x6')](),controller['destroy']);module[_0x4f55('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5b45650..4df3260 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 _0x3176=['sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x19dcce,_0x4c5f16){var _0x271135=function(_0x1adac0){while(--_0x1adac0){_0x19dcce['push'](_0x19dcce['shift']());}};_0x271135(++_0x4c5f16);}(_0x3176,0x1d8));var _0x6317=function(_0x2d6b86,_0x1bba39){_0x2d6b86=_0x2d6b86-0x0;var _0x597661=_0x3176[_0x2d6b86];return _0x597661;};'use strict';var moment=require(_0x6317('0x0'));var Sequelize=require(_0x6317('0x1'));module[_0x6317('0x2')]={'starttime':{'type':Sequelize[_0x6317('0x3')],'set':function(_0xffbb7a){this[_0x6317('0x4')](_0x6317('0x5'),_0xffbb7a);this[_0x6317('0x4')](_0x6317('0x6'),moment()[_0x6317('0x7')](_0x6317('0x8')));}},'endtime':{'type':Sequelize[_0x6317('0x3')]},'membername':{'type':Sequelize[_0x6317('0x9')]},'projectname':{'type':Sequelize[_0x6317('0x9')]},'queue':{'type':Sequelize[_0x6317('0x9')]},'uniqueid':{'type':Sequelize[_0x6317('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6317('0x9')]},'completed':{'type':Sequelize[_0x6317('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x2169=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize'];(function(_0x421df3,_0x1b9d7d){var _0x1f5106=function(_0x597f54){while(--_0x597f54){_0x421df3['push'](_0x421df3['shift']());}};_0x1f5106(++_0x1b9d7d);}(_0x2169,0x14f));var _0x9216=function(_0x10e5ae,_0x4a8c28){_0x10e5ae=_0x10e5ae-0x0;var _0x27d9b5=_0x2169[_0x10e5ae];return _0x27d9b5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9216('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x9216('0x1')],'set':function(_0x1c1e80){this[_0x9216('0x2')](_0x9216('0x3'),_0x1c1e80);this[_0x9216('0x2')](_0x9216('0x4'),moment()[_0x9216('0x5')](_0x9216('0x6')));}},'endtime':{'type':Sequelize[_0x9216('0x1')]},'membername':{'type':Sequelize[_0x9216('0x7')]},'projectname':{'type':Sequelize[_0x9216('0x7')]},'queue':{'type':Sequelize[_0x9216('0x7')]},'uniqueid':{'type':Sequelize[_0x9216('0x7')]},'calleridname':{'type':Sequelize[_0x9216('0x7')]},'calleridnum':{'type':Sequelize[_0x9216('0x7')]},'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 38a6c09..1d65834 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 _0x599f=['fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','filter','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','end','error','stack','name','index','JscriptySessionReport','model','keys','filters','intersection','attributes'];(function(_0x2ad3cc,_0x5201e2){var _0x472a69=function(_0x41cd86){while(--_0x41cd86){_0x2ad3cc['push'](_0x2ad3cc['shift']());}};_0x472a69(++_0x5201e2);}(_0x599f,0x74));var _0xf599=function(_0xba386f,_0x44b23c){_0xba386f=_0xba386f-0x0;var _0x40b503=_0x599f[_0xba386f];return _0x40b503;};'use strict';var pdf=require(_0xf599('0x0'));var emlformat=require(_0xf599('0x1'));var rimraf=require(_0xf599('0x2'));var zipdir=require(_0xf599('0x3'));var jsonpatch=require(_0xf599('0x4'));var rp=require(_0xf599('0x5'));var moment=require(_0xf599('0x6'));var BPromise=require(_0xf599('0x7'));var Mustache=require(_0xf599('0x8'));var util=require(_0xf599('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf599('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf599('0xb'));var crypto=require(_0xf599('0xc'));var jsforce=require(_0xf599('0xd'));var deskjs=require(_0xf599('0xe'));var toCsv=require(_0xf599('0xf'));var querystring=require(_0xf599('0x10'));var Papa=require(_0xf599('0x11'));var Redis=require(_0xf599('0x12'));var authService=require(_0xf599('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf599('0x14'));var logger=require(_0xf599('0x15'))(_0xf599('0x16'));var utils=require(_0xf599('0x17'));var config=require(_0xf599('0x18'));var db=require(_0xf599('0x19'))['db'];function respondWithStatusCode(_0x1ecedf,_0x48d4cd){_0x48d4cd=_0x48d4cd||0xcc;return function(_0x34da5c){if(_0x34da5c){return _0x1ecedf['sendStatus'](_0x48d4cd);}return _0x1ecedf['status'](_0x48d4cd)['end']();};}function respondWithResult(_0x546d62,_0x332c7b){_0x332c7b=_0x332c7b||0xc8;return function(_0x195941){if(_0x195941){return _0x546d62[_0xf599('0x1a')](_0x332c7b)['json'](_0x195941);}};}function respondWithFilteredResult(_0x53292e,_0x408137){return function(_0x58f810){if(_0x58f810){var _0x5d5bc8=_0x58f810[_0xf599('0x1b')],_0x1e4124=_0x408137[_0xf599('0x1c')],_0x1ead22=_0x408137[_0xf599('0x1c')]+_0x408137[_0xf599('0x1d')],_0x56a408;if(_0x1ead22>=_0x5d5bc8){_0x1ead22=_0x5d5bc8;_0x56a408=0xc8;}else{_0x56a408=0xce;}_0x53292e[_0xf599('0x1a')](_0x56a408);return _0x53292e[_0xf599('0x1e')](_0xf599('0x1f'),_0x1e4124+'-'+_0x1ead22+'/'+_0x5d5bc8)[_0xf599('0x20')](_0x58f810);}return null;};}function patchUpdates(_0x2aff01){return function(_0x4d5d0d){try{jsonpatch['apply'](_0x4d5d0d,_0x2aff01,!![]);}catch(_0x5724a2){return BPromise[_0xf599('0x21')](_0x5724a2);}return _0x4d5d0d[_0xf599('0x22')]();};}function saveUpdates(_0x3df53d,_0x350754){return function(_0x821d48){if(_0x821d48){return _0x821d48[_0xf599('0x23')](_0x3df53d)['then'](function(_0x38e60e){return _0x38e60e;});}return null;};}function removeEntity(_0x99c1ce,_0x47d7d9){return function(_0x4697b5){if(_0x4697b5){return _0x4697b5['destroy']()[_0xf599('0x24')](function(){_0x99c1ce[_0xf599('0x1a')](0xcc)[_0xf599('0x25')]();});}};}function handleEntityNotFound(_0x695ebd,_0x480641){return function(_0x86866f){if(!_0x86866f){_0x695ebd['sendStatus'](0x194);}return _0x86866f;};}function handleError(_0x224744,_0x498634){_0x498634=_0x498634||0x1f4;return function(_0xa786c6){logger[_0xf599('0x26')](_0xa786c6[_0xf599('0x27')]);if(_0xa786c6[_0xf599('0x28')]){delete _0xa786c6['name'];}_0x224744[_0xf599('0x1a')](_0x498634)['send'](_0xa786c6);};}exports[_0xf599('0x29')]=function(_0x4c652e,_0xa8814b){var _0x1127c9={},_0x40ed53={},_0x59cdeb={'count':0x0,'rows':[]};var _0x2f78f1=db[_0xf599('0x2a')]['rawAttributes'];_0x40ed53[_0xf599('0x2b')]=_[_0xf599('0x2c')](_0x2f78f1);_0x40ed53['query']=_[_0xf599('0x2c')](_0x4c652e['query']);_0x40ed53[_0xf599('0x2d')]=_[_0xf599('0x2e')](_0x40ed53[_0xf599('0x2b')],_0x40ed53['query']);_0x1127c9[_0xf599('0x2f')]=_['intersection'](_0x40ed53['model'],qs[_0xf599('0x30')](_0x4c652e[_0xf599('0x31')][_0xf599('0x30')]));_0x1127c9[_0xf599('0x2f')]=_0x1127c9[_0xf599('0x2f')][_0xf599('0x32')]?_0x1127c9['attributes']:_0x40ed53[_0xf599('0x2b')];if(!_0x4c652e[_0xf599('0x31')][_0xf599('0x33')](_0xf599('0x34'))){_0x1127c9[_0xf599('0x1d')]=qs[_0xf599('0x1d')](_0x4c652e[_0xf599('0x31')][_0xf599('0x1d')]);_0x1127c9['offset']=qs[_0xf599('0x1c')](_0x4c652e[_0xf599('0x31')][_0xf599('0x1c')]);}_0x1127c9[_0xf599('0x35')]=qs[_0xf599('0x36')](_0x4c652e[_0xf599('0x31')]['sort']);_0x1127c9[_0xf599('0x37')]=qs[_0xf599('0x2d')](_[_0xf599('0x38')](_0x4c652e[_0xf599('0x31')],_0x40ed53['filters']));if(_0x4c652e['query']['filter']){_0x1127c9['where']=_[_0xf599('0x39')](_0x1127c9[_0xf599('0x37')],{'$or':_[_0xf599('0x3a')](_0x2f78f1,function(_0x3bd103){if(_0x3bd103[_0xf599('0x3b')][_0xf599('0x3c')]!==_0xf599('0x3d')){var _0x484683={};_0x484683[_0x3bd103[_0xf599('0x3e')]]={'$like':'%'+_0x4c652e[_0xf599('0x31')]['filter']+'%'};return _0x484683;}})});}_0x1127c9=_['merge']({},_0x1127c9,_0x4c652e[_0xf599('0x3f')]);var _0x21fb5d={'where':_0x1127c9[_0xf599('0x37')]};return db[_0xf599('0x2a')][_0xf599('0x1b')](_0x21fb5d)[_0xf599('0x24')](function(_0x41b1f9){_0x59cdeb[_0xf599('0x1b')]=_0x41b1f9;if(_0x4c652e['query'][_0xf599('0x40')]){_0x1127c9['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf599('0x41')](_0x1127c9);})[_0xf599('0x24')](function(_0x44e109){_0x59cdeb[_0xf599('0x42')]=_0x44e109;return _0x59cdeb;})[_0xf599('0x24')](respondWithFilteredResult(_0xa8814b,_0x1127c9))[_0xf599('0x43')](handleError(_0xa8814b,null));};exports[_0xf599('0x44')]=function(_0x42e1fc,_0x3ed8c4){var _0x2a4a76={'raw':!![],'where':{'id':_0x42e1fc[_0xf599('0x45')]['id']}},_0x73d7a6={};_0x73d7a6['model']=_[_0xf599('0x2c')](db[_0xf599('0x2a')][_0xf599('0x46')]);_0x73d7a6[_0xf599('0x31')]=_[_0xf599('0x2c')](_0x42e1fc[_0xf599('0x31')]);_0x73d7a6[_0xf599('0x2d')]=_[_0xf599('0x2e')](_0x73d7a6[_0xf599('0x2b')],_0x73d7a6['query']);_0x2a4a76[_0xf599('0x2f')]=_['intersection'](_0x73d7a6[_0xf599('0x2b')],qs['fields'](_0x42e1fc[_0xf599('0x31')][_0xf599('0x30')]));_0x2a4a76[_0xf599('0x2f')]=_0x2a4a76['attributes'][_0xf599('0x32')]?_0x2a4a76[_0xf599('0x2f')]:_0x73d7a6[_0xf599('0x2b')];if(_0x42e1fc[_0xf599('0x31')]['includeAll']){_0x2a4a76[_0xf599('0x47')]=[{'all':!![]}];}_0x2a4a76=_['merge']({},_0x2a4a76,_0x42e1fc[_0xf599('0x3f')]);return db[_0xf599('0x2a')][_0xf599('0x48')](_0x2a4a76)[_0xf599('0x24')](handleEntityNotFound(_0x3ed8c4,null))['then'](respondWithResult(_0x3ed8c4,null))[_0xf599('0x43')](handleError(_0x3ed8c4,null));};exports[_0xf599('0x49')]=function(_0x3c9e57,_0x5412b0){return db['JscriptySessionReport'][_0xf599('0x49')](_0x3c9e57[_0xf599('0x4a')],{})[_0xf599('0x24')](respondWithResult(_0x5412b0,0xc9))['catch'](handleError(_0x5412b0,null));};exports['update']=function(_0x33560a,_0xcf9898){if(_0x33560a['body']['id']){delete _0x33560a[_0xf599('0x4a')]['id'];}return db[_0xf599('0x2a')]['find']({'where':{'id':_0x33560a[_0xf599('0x45')]['id']}})['then'](handleEntityNotFound(_0xcf9898,null))[_0xf599('0x24')](saveUpdates(_0x33560a['body'],null))['then'](respondWithResult(_0xcf9898,null))[_0xf599('0x43')](handleError(_0xcf9898,null));};exports[_0xf599('0x4b')]=function(_0x44505a,_0x26bd39){return db[_0xf599('0x2a')][_0xf599('0x48')]({'where':{'id':_0x44505a[_0xf599('0x45')]['id']}})[_0xf599('0x24')](handleEntityNotFound(_0x26bd39,null))[_0xf599('0x24')](removeEntity(_0x26bd39,null))[_0xf599('0x43')](handleError(_0x26bd39,null));};exports[_0xf599('0x4c')]=function(_0x10ff23,_0x469de8){return db[_0xf599('0x2a')][_0xf599('0x4c')]()[_0xf599('0x24')](respondWithResult(_0x469de8,null))[_0xf599('0x43')](handleError(_0x469de8,null));};exports[_0xf599('0x4d')]=function(_0x26a21b,_0x44a3c2,_0x20e86b){var _0x316ff1={'raw':!![],'where':{}};var _0x586ae0={};var _0x381538={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xf599('0x4e')]({'where':{'id':_0x26a21b[_0xf599('0x45')]['id']}})[_0xf599('0x24')](handleEntityNotFound(_0x44a3c2,null))['then'](function(_0x4f99c6){if(_0x4f99c6){_0x586ae0['model']=_[_0xf599('0x2c')](db[_0xf599('0x4f')][_0xf599('0x46')]);_0x586ae0['query']=_[_0xf599('0x2c')](_0x26a21b[_0xf599('0x31')]);_0x586ae0[_0xf599('0x2d')]=_[_0xf599('0x2e')](_0x586ae0[_0xf599('0x2b')],_0x586ae0[_0xf599('0x31')]);_0x316ff1[_0xf599('0x2f')]=_[_0xf599('0x2e')](_0x586ae0[_0xf599('0x2b')],qs[_0xf599('0x30')](_0x26a21b['query'][_0xf599('0x30')]));_0x316ff1[_0xf599('0x2f')]=_0x316ff1['attributes'][_0xf599('0x32')]?_0x316ff1[_0xf599('0x2f')]:_0x586ae0[_0xf599('0x2b')];if(!_0x26a21b['query'][_0xf599('0x33')](_0xf599('0x34'))){_0x316ff1[_0xf599('0x1d')]=qs[_0xf599('0x1d')](_0x26a21b[_0xf599('0x31')][_0xf599('0x1d')]);_0x316ff1[_0xf599('0x1c')]=qs[_0xf599('0x1c')](_0x26a21b[_0xf599('0x31')][_0xf599('0x1c')]);}_0x316ff1[_0xf599('0x35')]=qs['sort'](_0x26a21b[_0xf599('0x31')][_0xf599('0x36')]);_0x316ff1[_0xf599('0x37')]=qs['filters'](_[_0xf599('0x38')](_0x26a21b['query'],_0x586ae0['filters']));_0x316ff1[_0xf599('0x37')][_0xf599('0x50')]=_0x4f99c6['id'];if(_0x26a21b[_0xf599('0x31')]['filter']){_0x316ff1[_0xf599('0x37')]=_[_0xf599('0x39')](_0x316ff1[_0xf599('0x37')],{'$or':_[_0xf599('0x3a')](_0x316ff1[_0xf599('0x2f')],function(_0x353c48){var _0x390885={};_0x390885[_0x353c48]={'$like':'%'+_0x26a21b['query'][_0xf599('0x51')]+'%'};return _0x390885;})});}_0x316ff1=_['merge']({},_0x316ff1,_0x26a21b[_0xf599('0x3f')]);return db[_0xf599('0x4f')][_0xf599('0x1b')]({'where':_0x316ff1['where']})[_0xf599('0x24')](function(_0x257dda){_0x381538[_0xf599('0x1b')]=_0x257dda;if(_0x26a21b['query'][_0xf599('0x40')]){_0x316ff1[_0xf599('0x47')]=[{'all':!![]}];}return db[_0xf599('0x4f')][_0xf599('0x41')](_0x316ff1);})[_0xf599('0x24')](function(_0x18076d){_0x381538[_0xf599('0x42')]=_0x18076d;return _0x381538;});}})[_0xf599('0x24')](respondWithFilteredResult(_0x44a3c2,_0x316ff1))[_0xf599('0x43')](handleError(_0x44a3c2,null));}; \ No newline at end of file +var _0x81c9=['hasOwnProperty','nolimit','order','SessionId','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','limit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','JscriptySessionReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','getQuestions','findOne','JscriptyQuestionReport'];(function(_0x5046d6,_0x36e665){var _0x3328d8=function(_0x48d0b8){while(--_0x48d0b8){_0x5046d6['push'](_0x5046d6['shift']());}};_0x3328d8(++_0x36e665);}(_0x81c9,0x1de));var _0x981c=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x81c9[_0x4b2863];return _0x567d67;};'use strict';var pdf=require(_0x981c('0x0'));var emlformat=require(_0x981c('0x1'));var rimraf=require(_0x981c('0x2'));var zipdir=require(_0x981c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x981c('0x4'));var moment=require(_0x981c('0x5'));var BPromise=require(_0x981c('0x6'));var Mustache=require('mustache');var util=require(_0x981c('0x7'));var path=require(_0x981c('0x8'));var sox=require(_0x981c('0x9'));var csv=require(_0x981c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x981c('0xb'));var squel=require('squel');var crypto=require(_0x981c('0xc'));var jsforce=require(_0x981c('0xd'));var deskjs=require(_0x981c('0xe'));var toCsv=require(_0x981c('0xa'));var querystring=require(_0x981c('0xf'));var Papa=require(_0x981c('0x10'));var Redis=require(_0x981c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x981c('0x12'));var hardwareService=require(_0x981c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x981c('0x14'));var config=require(_0x981c('0x15'));var db=require(_0x981c('0x16'))['db'];function respondWithStatusCode(_0x529042,_0x5e3bcb){_0x5e3bcb=_0x5e3bcb||0xcc;return function(_0x218f07){if(_0x218f07){return _0x529042['sendStatus'](_0x5e3bcb);}return _0x529042[_0x981c('0x17')](_0x5e3bcb)[_0x981c('0x18')]();};}function respondWithResult(_0x4fd0c7,_0x5c856c){_0x5c856c=_0x5c856c||0xc8;return function(_0x112933){if(_0x112933){return _0x4fd0c7[_0x981c('0x17')](_0x5c856c)['json'](_0x112933);}};}function respondWithFilteredResult(_0x543a66,_0x9cf4fb){return function(_0x2787b6){if(_0x2787b6){var _0x37e070=_0x2787b6[_0x981c('0x19')],_0x1eff46=_0x9cf4fb[_0x981c('0x1a')],_0x302e62=_0x9cf4fb[_0x981c('0x1a')]+_0x9cf4fb['limit'],_0x54ca0f;if(_0x302e62>=_0x37e070){_0x302e62=_0x37e070;_0x54ca0f=0xc8;}else{_0x54ca0f=0xce;}_0x543a66[_0x981c('0x17')](_0x54ca0f);return _0x543a66[_0x981c('0x1b')](_0x981c('0x1c'),_0x1eff46+'-'+_0x302e62+'/'+_0x37e070)[_0x981c('0x1d')](_0x2787b6);}return null;};}function patchUpdates(_0x24d72a){return function(_0x427e0f){try{jsonpatch[_0x981c('0x1e')](_0x427e0f,_0x24d72a,!![]);}catch(_0x1f8f0f){return BPromise[_0x981c('0x1f')](_0x1f8f0f);}return _0x427e0f[_0x981c('0x20')]();};}function saveUpdates(_0x290dba,_0x47ef5d){return function(_0x483af4){if(_0x483af4){return _0x483af4[_0x981c('0x21')](_0x290dba)[_0x981c('0x22')](function(_0x1c3c1e){return _0x1c3c1e;});}return null;};}function removeEntity(_0x563d13,_0x88e860){return function(_0x48d676){if(_0x48d676){return _0x48d676[_0x981c('0x23')]()['then'](function(){_0x563d13[_0x981c('0x17')](0xcc)[_0x981c('0x18')]();});}};}function handleEntityNotFound(_0x3d1c78,_0x25000b){return function(_0x2464c9){if(!_0x2464c9){_0x3d1c78['sendStatus'](0x194);}return _0x2464c9;};}function handleError(_0x3eac07,_0x4ec1ac){_0x4ec1ac=_0x4ec1ac||0x1f4;return function(_0x27ed5d){logger[_0x981c('0x24')](_0x27ed5d[_0x981c('0x25')]);if(_0x27ed5d[_0x981c('0x26')]){delete _0x27ed5d['name'];}_0x3eac07[_0x981c('0x17')](_0x4ec1ac)['send'](_0x27ed5d);};}exports[_0x981c('0x27')]=function(_0x3848d9,_0x2f36c1){var _0x354764={},_0xd911ef={},_0x5bc2be={'count':0x0,'rows':[]};var _0x8d536c=db['JscriptySessionReport'][_0x981c('0x28')];_0xd911ef[_0x981c('0x29')]=_[_0x981c('0x2a')](_0x8d536c);_0xd911ef['query']=_[_0x981c('0x2a')](_0x3848d9[_0x981c('0x2b')]);_0xd911ef[_0x981c('0x2c')]=_[_0x981c('0x2d')](_0xd911ef[_0x981c('0x29')],_0xd911ef[_0x981c('0x2b')]);_0x354764['attributes']=_[_0x981c('0x2d')](_0xd911ef[_0x981c('0x29')],qs['fields'](_0x3848d9[_0x981c('0x2b')][_0x981c('0x2e')]));_0x354764['attributes']=_0x354764[_0x981c('0x2f')][_0x981c('0x30')]?_0x354764[_0x981c('0x2f')]:_0xd911ef['model'];if(!_0x3848d9[_0x981c('0x2b')]['hasOwnProperty']('nolimit')){_0x354764[_0x981c('0x31')]=qs[_0x981c('0x31')](_0x3848d9[_0x981c('0x2b')]['limit']);_0x354764[_0x981c('0x1a')]=qs[_0x981c('0x1a')](_0x3848d9[_0x981c('0x2b')][_0x981c('0x1a')]);}_0x354764['order']=qs[_0x981c('0x32')](_0x3848d9[_0x981c('0x2b')][_0x981c('0x32')]);_0x354764[_0x981c('0x33')]=qs[_0x981c('0x2c')](_[_0x981c('0x34')](_0x3848d9[_0x981c('0x2b')],_0xd911ef[_0x981c('0x2c')]));if(_0x3848d9[_0x981c('0x2b')][_0x981c('0x35')]){_0x354764[_0x981c('0x33')]=_[_0x981c('0x36')](_0x354764[_0x981c('0x33')],{'$or':_[_0x981c('0x37')](_0x8d536c,function(_0xab15bb){if(_0xab15bb[_0x981c('0x38')][_0x981c('0x39')]!==_0x981c('0x3a')){var _0x1894ea={};_0x1894ea[_0xab15bb[_0x981c('0x3b')]]={'$like':'%'+_0x3848d9[_0x981c('0x2b')]['filter']+'%'};return _0x1894ea;}})});}_0x354764=_[_0x981c('0x36')]({},_0x354764,_0x3848d9[_0x981c('0x3c')]);var _0x4622b5={'where':_0x354764[_0x981c('0x33')]};return db[_0x981c('0x3d')]['count'](_0x4622b5)[_0x981c('0x22')](function(_0x14d586){_0x5bc2be[_0x981c('0x19')]=_0x14d586;if(_0x3848d9[_0x981c('0x2b')][_0x981c('0x3e')]){_0x354764[_0x981c('0x3f')]=[{'all':!![]}];}return db[_0x981c('0x3d')][_0x981c('0x40')](_0x354764);})[_0x981c('0x22')](function(_0x3f4355){_0x5bc2be[_0x981c('0x41')]=_0x3f4355;return _0x5bc2be;})[_0x981c('0x22')](respondWithFilteredResult(_0x2f36c1,_0x354764))['catch'](handleError(_0x2f36c1,null));};exports[_0x981c('0x42')]=function(_0x25fdcf,_0x1216fc){var _0x15d831={'raw':!![],'where':{'id':_0x25fdcf[_0x981c('0x43')]['id']}},_0x31bc2b={};_0x31bc2b[_0x981c('0x29')]=_[_0x981c('0x2a')](db[_0x981c('0x3d')][_0x981c('0x28')]);_0x31bc2b[_0x981c('0x2b')]=_['keys'](_0x25fdcf[_0x981c('0x2b')]);_0x31bc2b['filters']=_[_0x981c('0x2d')](_0x31bc2b[_0x981c('0x29')],_0x31bc2b[_0x981c('0x2b')]);_0x15d831[_0x981c('0x2f')]=_[_0x981c('0x2d')](_0x31bc2b[_0x981c('0x29')],qs[_0x981c('0x2e')](_0x25fdcf[_0x981c('0x2b')][_0x981c('0x2e')]));_0x15d831['attributes']=_0x15d831['attributes'][_0x981c('0x30')]?_0x15d831[_0x981c('0x2f')]:_0x31bc2b[_0x981c('0x29')];if(_0x25fdcf[_0x981c('0x2b')][_0x981c('0x3e')]){_0x15d831[_0x981c('0x3f')]=[{'all':!![]}];}_0x15d831=_['merge']({},_0x15d831,_0x25fdcf['options']);return db[_0x981c('0x3d')][_0x981c('0x44')](_0x15d831)[_0x981c('0x22')](handleEntityNotFound(_0x1216fc,null))[_0x981c('0x22')](respondWithResult(_0x1216fc,null))[_0x981c('0x45')](handleError(_0x1216fc,null));};exports[_0x981c('0x46')]=function(_0x1d3617,_0x1101e4){return db['JscriptySessionReport'][_0x981c('0x46')](_0x1d3617[_0x981c('0x47')],{})[_0x981c('0x22')](respondWithResult(_0x1101e4,0xc9))['catch'](handleError(_0x1101e4,null));};exports['update']=function(_0x416b8b,_0x48a5ce){if(_0x416b8b[_0x981c('0x47')]['id']){delete _0x416b8b[_0x981c('0x47')]['id'];}return db[_0x981c('0x3d')][_0x981c('0x44')]({'where':{'id':_0x416b8b[_0x981c('0x43')]['id']}})['then'](handleEntityNotFound(_0x48a5ce,null))[_0x981c('0x22')](saveUpdates(_0x416b8b[_0x981c('0x47')],null))[_0x981c('0x22')](respondWithResult(_0x48a5ce,null))[_0x981c('0x45')](handleError(_0x48a5ce,null));};exports[_0x981c('0x23')]=function(_0x29b59e,_0x30b13b){return db[_0x981c('0x3d')]['find']({'where':{'id':_0x29b59e[_0x981c('0x43')]['id']}})[_0x981c('0x22')](handleEntityNotFound(_0x30b13b,null))[_0x981c('0x22')](removeEntity(_0x30b13b,null))[_0x981c('0x45')](handleError(_0x30b13b,null));};exports['describe']=function(_0x3e6bf9,_0x5e3d8a){return db[_0x981c('0x3d')]['describe']()['then'](respondWithResult(_0x5e3d8a,null))[_0x981c('0x45')](handleError(_0x5e3d8a,null));};exports[_0x981c('0x48')]=function(_0x4b8b16,_0x43baf1,_0x2a7271){var _0x24efc3={'raw':!![],'where':{}};var _0x18c129={};var _0x5bb3b3={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x981c('0x49')]({'where':{'id':_0x4b8b16[_0x981c('0x43')]['id']}})[_0x981c('0x22')](handleEntityNotFound(_0x43baf1,null))[_0x981c('0x22')](function(_0x1809c8){if(_0x1809c8){_0x18c129[_0x981c('0x29')]=_[_0x981c('0x2a')](db[_0x981c('0x4a')]['rawAttributes']);_0x18c129['query']=_[_0x981c('0x2a')](_0x4b8b16[_0x981c('0x2b')]);_0x18c129[_0x981c('0x2c')]=_['intersection'](_0x18c129[_0x981c('0x29')],_0x18c129[_0x981c('0x2b')]);_0x24efc3['attributes']=_[_0x981c('0x2d')](_0x18c129[_0x981c('0x29')],qs['fields'](_0x4b8b16[_0x981c('0x2b')][_0x981c('0x2e')]));_0x24efc3[_0x981c('0x2f')]=_0x24efc3[_0x981c('0x2f')][_0x981c('0x30')]?_0x24efc3[_0x981c('0x2f')]:_0x18c129[_0x981c('0x29')];if(!_0x4b8b16[_0x981c('0x2b')][_0x981c('0x4b')](_0x981c('0x4c'))){_0x24efc3[_0x981c('0x31')]=qs[_0x981c('0x31')](_0x4b8b16[_0x981c('0x2b')][_0x981c('0x31')]);_0x24efc3[_0x981c('0x1a')]=qs[_0x981c('0x1a')](_0x4b8b16[_0x981c('0x2b')]['offset']);}_0x24efc3[_0x981c('0x4d')]=qs[_0x981c('0x32')](_0x4b8b16['query'][_0x981c('0x32')]);_0x24efc3[_0x981c('0x33')]=qs[_0x981c('0x2c')](_[_0x981c('0x34')](_0x4b8b16[_0x981c('0x2b')],_0x18c129['filters']));_0x24efc3[_0x981c('0x33')][_0x981c('0x4e')]=_0x1809c8['id'];if(_0x4b8b16[_0x981c('0x2b')][_0x981c('0x35')]){_0x24efc3[_0x981c('0x33')]=_['merge'](_0x24efc3[_0x981c('0x33')],{'$or':_[_0x981c('0x37')](_0x24efc3[_0x981c('0x2f')],function(_0x34f6cd){var _0x2897c8={};_0x2897c8[_0x34f6cd]={'$like':'%'+_0x4b8b16[_0x981c('0x2b')][_0x981c('0x35')]+'%'};return _0x2897c8;})});}_0x24efc3=_['merge']({},_0x24efc3,_0x4b8b16[_0x981c('0x3c')]);return db[_0x981c('0x4a')][_0x981c('0x19')]({'where':_0x24efc3[_0x981c('0x33')]})[_0x981c('0x22')](function(_0x70c6ca){_0x5bb3b3[_0x981c('0x19')]=_0x70c6ca;if(_0x4b8b16[_0x981c('0x2b')][_0x981c('0x3e')]){_0x24efc3['include']=[{'all':!![]}];}return db[_0x981c('0x4a')][_0x981c('0x40')](_0x24efc3);})['then'](function(_0x472c7a){_0x5bb3b3[_0x981c('0x41')]=_0x472c7a;return _0x5bb3b3;});}})['then'](respondWithFilteredResult(_0x43baf1,_0x24efc3))['catch'](handleError(_0x43baf1,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 22f4182..3de1bd9 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 _0xb00f=['api','request-promise','../../config/environment','./jscriptySessionReport.attributes','exports','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x4dd2d3,_0x264f72){var _0x269be2=function(_0x2315bc){while(--_0x2315bc){_0x4dd2d3['push'](_0x4dd2d3['shift']());}};_0x269be2(++_0x264f72);}(_0xb00f,0x153));var _0xfb00=function(_0x3bed9a,_0x40f7fc){_0x3bed9a=_0x3bed9a-0x0;var _0x1690af=_0xb00f[_0x3bed9a];return _0x1690af;};'use strict';var _=require(_0xfb00('0x0'));var util=require(_0xfb00('0x1'));var logger=require(_0xfb00('0x2'))(_0xfb00('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb00('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb00('0x5'));var attributes=require(_0xfb00('0x6'));module[_0xfb00('0x7')]=function(_0x5d2766,_0x5a0ec5){return _0x5d2766['define']('JscriptySessionReport',attributes,{'tableName':_0xfb00('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd42f=['report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptySessionReport'];(function(_0x5baa27,_0x3f5156){var _0x7793c2=function(_0x531eab){while(--_0x531eab){_0x5baa27['push'](_0x5baa27['shift']());}};_0x7793c2(++_0x3f5156);}(_0xd42f,0x7a));var _0xfd42=function(_0x1ac546,_0x392126){_0x1ac546=_0x1ac546-0x0;var _0x7096bb=_0xd42f[_0x1ac546];return _0x7096bb;};'use strict';var _=require(_0xfd42('0x0'));var util=require('util');var logger=require(_0xfd42('0x1'))('api');var moment=require(_0xfd42('0x2'));var BPromise=require(_0xfd42('0x3'));var rp=require(_0xfd42('0x4'));var fs=require('fs');var path=require(_0xfd42('0x5'));var rimraf=require(_0xfd42('0x6'));var config=require(_0xfd42('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x380c5a,_0x40bdc4){return _0x380c5a[_0xfd42('0x8')](_0xfd42('0x9'),attributes,{'tableName':_0xfd42('0xa'),'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 ade3b2f..df3adf7 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 _0xcb04=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xcb04,0x9a));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var moment=require(_0x4cb0('0x2'));var BPromise=require(_0x4cb0('0x3'));var rs=require(_0x4cb0('0x4'));var fs=require('fs');var Redis=require(_0x4cb0('0x5'));var db=require(_0x4cb0('0x6'))['db'];var utils=require(_0x4cb0('0x7'));var logger=require(_0x4cb0('0x8'))(_0x4cb0('0x9'));var config=require('../../config/environment');var jayson=require(_0x4cb0('0xa'));var client=jayson[_0x4cb0('0xb')][_0x4cb0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ddb52,_0x184a0a,_0x10f98a){return new BPromise(function(_0x362863,_0x3c5793){return client[_0x4cb0('0xd')](_0x1ddb52,_0x10f98a)[_0x4cb0('0xe')](function(_0x143072){logger[_0x4cb0('0xf')](_0x4cb0('0x10'),_0x184a0a,_0x4cb0('0x11'));logger[_0x4cb0('0x12')](_0x4cb0('0x13'),_0x184a0a,_0x4cb0('0x11'),JSON[_0x4cb0('0x14')](_0x143072));if(_0x143072['error']){if(_0x143072[_0x4cb0('0x15')][_0x4cb0('0x16')]===0x1f4){logger[_0x4cb0('0x15')](_0x4cb0('0x10'),_0x184a0a,_0x143072['error'][_0x4cb0('0x17')]);return _0x3c5793(_0x143072[_0x4cb0('0x15')][_0x4cb0('0x17')]);}logger[_0x4cb0('0x15')](_0x4cb0('0x10'),_0x184a0a,_0x143072[_0x4cb0('0x15')][_0x4cb0('0x17')]);return _0x362863(_0x143072[_0x4cb0('0x15')][_0x4cb0('0x17')]);}else{logger['info'](_0x4cb0('0x10'),_0x184a0a,_0x4cb0('0x11'));_0x362863(_0x143072[_0x4cb0('0x18')][_0x4cb0('0x17')]);}})['catch'](function(_0x5a7295){logger[_0x4cb0('0x15')](_0x4cb0('0x10'),_0x184a0a,_0x5a7295);_0x3c5793(_0x5a7295);});});} \ No newline at end of file +var _0x9300=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','bluebird','randomstring'];(function(_0xafdaf4,_0x5bd4d1){var _0x1e70a8=function(_0x33bd10){while(--_0x33bd10){_0xafdaf4['push'](_0xafdaf4['shift']());}};_0x1e70a8(++_0x5bd4d1);}(_0x9300,0x153));var _0x0930=function(_0x1d1967,_0x52b368){_0x1d1967=_0x1d1967-0x0;var _0x5d6ce0=_0x9300[_0x1d1967];return _0x5d6ce0;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0930('0x1'));var rs=require(_0x0930('0x2'));var fs=require('fs');var Redis=require(_0x0930('0x3'));var db=require(_0x0930('0x4'))['db'];var utils=require(_0x0930('0x5'));var logger=require('../../config/logger')(_0x0930('0x6'));var config=require(_0x0930('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0930('0x8')][_0x0930('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45705a,_0x34c693,_0x2c0f94){return new BPromise(function(_0x1ec24f,_0x5bc3df){return client['request'](_0x45705a,_0x2c0f94)[_0x0930('0xa')](function(_0x4b1994){logger[_0x0930('0xb')](_0x0930('0xc'),_0x34c693,'request\x20sent');logger[_0x0930('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x34c693,'request\x20sent',JSON[_0x0930('0xe')](_0x4b1994));if(_0x4b1994[_0x0930('0xf')]){if(_0x4b1994['error']['code']===0x1f4){logger[_0x0930('0xf')](_0x0930('0xc'),_0x34c693,_0x4b1994[_0x0930('0xf')][_0x0930('0x10')]);return _0x5bc3df(_0x4b1994[_0x0930('0xf')][_0x0930('0x10')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x34c693,_0x4b1994['error'][_0x0930('0x10')]);return _0x1ec24f(_0x4b1994['error'][_0x0930('0x10')]);}else{logger[_0x0930('0xb')](_0x0930('0xc'),_0x34c693,_0x0930('0x11'));_0x1ec24f(_0x4b1994[_0x0930('0x12')][_0x0930('0x10')]);}})['catch'](function(_0x3ec27b){logger[_0x0930('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x34c693,_0x3ec27b);_0x5bc3df(_0x3ec27b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6a91829..1f06c84 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 _0xdc45=['update','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdc45,0xfd));var _0x5dc4=function(_0x590cb2,_0x138ebc){_0x590cb2=_0x590cb2-0x0;var _0x3263a2=_0xdc45[_0x590cb2];return _0x3263a2;};'use strict';var multer=require(_0x5dc4('0x0'));var util=require('util');var path=require(_0x5dc4('0x1'));var timeout=require(_0x5dc4('0x2'));var express=require(_0x5dc4('0x3'));var router=express[_0x5dc4('0x4')]();var auth=require(_0x5dc4('0x5'));var interaction=require(_0x5dc4('0x6'));var config=require('../../config/environment');var controller=require(_0x5dc4('0x7'));router[_0x5dc4('0x8')]('/',controller[_0x5dc4('0x9')]);router[_0x5dc4('0xa')](_0x5dc4('0xb'),auth[_0x5dc4('0xc')](),controller[_0x5dc4('0xd')]);module['exports']=router; \ No newline at end of file +var _0x707c=['../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3463c6,_0x49e2fa){var _0x80f9bd=function(_0x4dc61e){while(--_0x4dc61e){_0x3463c6['push'](_0x3463c6['shift']());}};_0x80f9bd(++_0x49e2fa);}(_0x707c,0xa2));var _0xc707=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x707c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc707('0x0'));var util=require(_0xc707('0x1'));var path=require(_0xc707('0x2'));var timeout=require('connect-timeout');var express=require(_0xc707('0x3'));var router=express[_0xc707('0x4')]();var auth=require(_0xc707('0x5'));var interaction=require(_0xc707('0x6'));var config=require(_0xc707('0x7'));var controller=require(_0xc707('0x8'));router[_0xc707('0x9')]('/',controller[_0xc707('0xa')]);router['put'](_0xc707('0xb'),auth['isAuthenticated'](),controller[_0xc707('0xc')]);module[_0xc707('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 335cf37..70ce1d6 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 _0x1146=['INTEGER','sequelize','STRING'];(function(_0x1ec23c,_0x49a1ba){var _0x23b578=function(_0x34ce11){while(--_0x34ce11){_0x1ec23c['push'](_0x1ec23c['shift']());}};_0x23b578(++_0x49a1ba);}(_0x1146,0x85));var _0x6114=function(_0x336df8,_0x4076e0){_0x336df8=_0x336df8-0x0;var _0xb93213=_0x1146[_0x336df8];return _0xb93213;};'use strict';var Sequelize=require(_0x6114('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x6114('0x1')]},'data2':{'type':Sequelize[_0x6114('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x6114('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc763=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x21cc14,_0x105b9c){var _0xb29f5b=function(_0x537678){while(--_0x537678){_0x21cc14['push'](_0x21cc14['shift']());}};_0xb29f5b(++_0x105b9c);}(_0xc763,0xc8));var _0x3c76=function(_0x3f85c6,_0x3fbd94){_0x3f85c6=_0x3f85c6-0x0;var _0x1fa0ac=_0xc763[_0x3f85c6];return _0x1fa0ac;};'use strict';var Sequelize=require(_0x3c76('0x0'));module[_0x3c76('0x1')]={'license':{'type':Sequelize[_0x3c76('0x2')]},'data1':{'type':Sequelize[_0x3c76('0x3')]},'data2':{'type':Sequelize[_0x3c76('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3c76('0x4')],'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 c7898f9..eb48668 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 _0xbc48=['find','get','demo','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','update','then','destroy','error','stack','name','../../config/license/util','index','model','keys','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','body','License'];(function(_0x28f062,_0x163072){var _0x513d01=function(_0x2e6d46){while(--_0x2e6d46){_0x28f062['push'](_0x28f062['shift']());}};_0x513d01(++_0x163072);}(_0xbc48,0x111));var _0x8bc4=function(_0x367253,_0x15d9fb){_0x367253=_0x367253-0x0;var _0x150e8e=_0xbc48[_0x367253];return _0x150e8e;};'use strict';var pdf=require(_0x8bc4('0x0'));var emlformat=require(_0x8bc4('0x1'));var rimraf=require(_0x8bc4('0x2'));var zipdir=require(_0x8bc4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bc4('0x4'));var moment=require(_0x8bc4('0x5'));var BPromise=require(_0x8bc4('0x6'));var Mustache=require(_0x8bc4('0x7'));var util=require('util');var path=require(_0x8bc4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8bc4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8bc4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8bc4('0xb'));var querystring=require(_0x8bc4('0xc'));var Papa=require(_0x8bc4('0xd'));var Redis=require(_0x8bc4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8bc4('0xf'));var hardwareService=require(_0x8bc4('0x10'));var logger=require(_0x8bc4('0x11'))(_0x8bc4('0x12'));var utils=require(_0x8bc4('0x13'));var config=require(_0x8bc4('0x14'));var db=require(_0x8bc4('0x15'))['db'];function respondWithStatusCode(_0x6049b3,_0xc7f809){_0xc7f809=_0xc7f809||0xcc;return function(_0x1f842d){if(_0x1f842d){return _0x6049b3[_0x8bc4('0x16')](_0xc7f809);}return _0x6049b3[_0x8bc4('0x17')](_0xc7f809)[_0x8bc4('0x18')]();};}function respondWithResult(_0x452a05,_0x73435b){_0x73435b=_0x73435b||0xc8;return function(_0x55e23a){if(_0x55e23a){return _0x452a05[_0x8bc4('0x17')](_0x73435b)[_0x8bc4('0x19')](_0x55e23a);}};}function respondWithFilteredResult(_0x1bffd0,_0xca2e4b){return function(_0x2e1213){if(_0x2e1213){var _0x3e3690=_0x2e1213[_0x8bc4('0x1a')],_0x5cd8f7=_0xca2e4b['offset'],_0x4d2530=_0xca2e4b[_0x8bc4('0x1b')]+_0xca2e4b[_0x8bc4('0x1c')],_0x50e59b;if(_0x4d2530>=_0x3e3690){_0x4d2530=_0x3e3690;_0x50e59b=0xc8;}else{_0x50e59b=0xce;}_0x1bffd0[_0x8bc4('0x17')](_0x50e59b);return _0x1bffd0['set'](_0x8bc4('0x1d'),_0x5cd8f7+'-'+_0x4d2530+'/'+_0x3e3690)[_0x8bc4('0x19')](_0x2e1213);}return null;};}function patchUpdates(_0x51b3b2){return function(_0x1c8d5b){try{jsonpatch['apply'](_0x1c8d5b,_0x51b3b2,!![]);}catch(_0x659ae3){return BPromise['reject'](_0x659ae3);}return _0x1c8d5b['save']();};}function saveUpdates(_0x1da3d7,_0x2602c6){return function(_0x415598){if(_0x415598){return _0x415598[_0x8bc4('0x1e')](_0x1da3d7)[_0x8bc4('0x1f')](function(_0xf0a578){return _0xf0a578;});}return null;};}function removeEntity(_0x26aa99,_0x37eaac){return function(_0x26c5e9){if(_0x26c5e9){return _0x26c5e9[_0x8bc4('0x20')]()[_0x8bc4('0x1f')](function(){_0x26aa99['status'](0xcc)[_0x8bc4('0x18')]();});}};}function handleEntityNotFound(_0x33f5b1,_0x23329e){return function(_0x546d83){if(!_0x546d83){_0x33f5b1[_0x8bc4('0x16')](0x194);}return _0x546d83;};}function handleError(_0x247eb8,_0x53aa1b){_0x53aa1b=_0x53aa1b||0x1f4;return function(_0x3eac08){logger[_0x8bc4('0x21')](_0x3eac08[_0x8bc4('0x22')]);if(_0x3eac08['name']){delete _0x3eac08[_0x8bc4('0x23')];}_0x247eb8['status'](_0x53aa1b)['send'](_0x3eac08);};}var utilLicense=require(_0x8bc4('0x24'));exports[_0x8bc4('0x25')]=function(_0x38c941,_0x33a829){var _0x16c2a8={'raw':!![],'where':{'id':0x1}},_0x14c7ec={};_0x14c7ec[_0x8bc4('0x26')]=_[_0x8bc4('0x27')](db['License']['rawAttributes']);_0x14c7ec[_0x8bc4('0x28')]=_[_0x8bc4('0x27')](_0x38c941[_0x8bc4('0x28')]);_0x14c7ec[_0x8bc4('0x29')]=_[_0x8bc4('0x2a')](_0x14c7ec[_0x8bc4('0x26')],_0x14c7ec['query']);_0x16c2a8[_0x8bc4('0x2b')]=_[_0x8bc4('0x2a')](_0x14c7ec[_0x8bc4('0x26')],qs[_0x8bc4('0x2c')](_0x38c941['query'][_0x8bc4('0x2c')]));_0x16c2a8[_0x8bc4('0x2b')]=_0x16c2a8[_0x8bc4('0x2b')][_0x8bc4('0x2d')]?_0x16c2a8[_0x8bc4('0x2b')]:_0x14c7ec['model'];_0x16c2a8=_[_0x8bc4('0x2e')]({},_0x16c2a8,_0x38c941['options']);return utilLicense[_0x8bc4('0x2f')](_0x16c2a8)[_0x8bc4('0x1f')](respondWithResult(_0x33a829,null))[_0x8bc4('0x30')](handleError(_0x33a829,null));};exports[_0x8bc4('0x1e')]=function(_0x4edfda,_0x5dbe7c){if(_0x4edfda[_0x8bc4('0x31')]['id']){delete _0x4edfda[_0x8bc4('0x31')]['id'];}return db[_0x8bc4('0x32')][_0x8bc4('0x33')]({'where':{'id':_0x4edfda['params']['id']}})['then'](handleEntityNotFound(_0x5dbe7c,null))['then'](function(_0x3f1cf8){var _0x8ee9c5=_0x3f1cf8[_0x8bc4('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0x8ee9c5,_0x4edfda['body']['key']);})['then'](function(_0x4c4d8d){if(!_0x4c4d8d[_0x8bc4('0x35')]){return saveUpdates(_0x4edfda[_0x8bc4('0x31')],null);}return _0x4c4d8d;})[_0x8bc4('0x1f')](respondWithResult(_0x5dbe7c,null))['catch'](handleError(_0x5dbe7c,null));}; \ No newline at end of file +var _0x631c=['squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','find','checkLicense','body','demo','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs'];(function(_0x336f5d,_0x7770c2){var _0x1d8289=function(_0x16a3be){while(--_0x16a3be){_0x336f5d['push'](_0x336f5d['shift']());}};_0x1d8289(++_0x7770c2);}(_0x631c,0x1b6));var _0xc631=function(_0xe04309,_0x50b563){_0xe04309=_0xe04309-0x0;var _0x22e704=_0x631c[_0xe04309];return _0x22e704;};'use strict';var pdf=require(_0xc631('0x0'));var emlformat=require(_0xc631('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc631('0x2'));var jsonpatch=require(_0xc631('0x3'));var rp=require('request-promise');var moment=require(_0xc631('0x4'));var BPromise=require(_0xc631('0x5'));var Mustache=require(_0xc631('0x6'));var util=require('util');var path=require(_0xc631('0x7'));var sox=require(_0xc631('0x8'));var csv=require('to-csv');var ejs=require(_0xc631('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc631('0xa'));var crypto=require(_0xc631('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc631('0xc'));var Papa=require('papaparse');var Redis=require(_0xc631('0xd'));var authService=require(_0xc631('0xe'));var qs=require(_0xc631('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc631('0x10'))(_0xc631('0x11'));var utils=require(_0xc631('0x12'));var config=require(_0xc631('0x13'));var db=require(_0xc631('0x14'))['db'];function respondWithStatusCode(_0x2ffc3e,_0x56ef08){_0x56ef08=_0x56ef08||0xcc;return function(_0x3a5efd){if(_0x3a5efd){return _0x2ffc3e[_0xc631('0x15')](_0x56ef08);}return _0x2ffc3e[_0xc631('0x16')](_0x56ef08)[_0xc631('0x17')]();};}function respondWithResult(_0x19af4d,_0x551059){_0x551059=_0x551059||0xc8;return function(_0x241e39){if(_0x241e39){return _0x19af4d[_0xc631('0x16')](_0x551059)['json'](_0x241e39);}};}function respondWithFilteredResult(_0x1022b9,_0xf9bc56){return function(_0x3cc2a5){if(_0x3cc2a5){var _0xac3441=_0x3cc2a5[_0xc631('0x18')],_0x418a7c=_0xf9bc56[_0xc631('0x19')],_0x734989=_0xf9bc56['offset']+_0xf9bc56[_0xc631('0x1a')],_0x3c2c11;if(_0x734989>=_0xac3441){_0x734989=_0xac3441;_0x3c2c11=0xc8;}else{_0x3c2c11=0xce;}_0x1022b9['status'](_0x3c2c11);return _0x1022b9[_0xc631('0x1b')]('Content-Range',_0x418a7c+'-'+_0x734989+'/'+_0xac3441)[_0xc631('0x1c')](_0x3cc2a5);}return null;};}function patchUpdates(_0x5dc64b){return function(_0x4ab1dc){try{jsonpatch[_0xc631('0x1d')](_0x4ab1dc,_0x5dc64b,!![]);}catch(_0x2d09b8){return BPromise[_0xc631('0x1e')](_0x2d09b8);}return _0x4ab1dc[_0xc631('0x1f')]();};}function saveUpdates(_0x21decf,_0x3087c1){return function(_0x487bf9){if(_0x487bf9){return _0x487bf9[_0xc631('0x20')](_0x21decf)[_0xc631('0x21')](function(_0x47efa9){return _0x47efa9;});}return null;};}function removeEntity(_0x195ce1,_0x58a943){return function(_0x229859){if(_0x229859){return _0x229859[_0xc631('0x22')]()[_0xc631('0x21')](function(){_0x195ce1[_0xc631('0x16')](0xcc)[_0xc631('0x17')]();});}};}function handleEntityNotFound(_0x31f871,_0x41a5bc){return function(_0x2486f3){if(!_0x2486f3){_0x31f871['sendStatus'](0x194);}return _0x2486f3;};}function handleError(_0x332fd0,_0x32934a){_0x32934a=_0x32934a||0x1f4;return function(_0x4c6d5b){logger[_0xc631('0x23')](_0x4c6d5b['stack']);if(_0x4c6d5b[_0xc631('0x24')]){delete _0x4c6d5b['name'];}_0x332fd0[_0xc631('0x16')](_0x32934a)[_0xc631('0x25')](_0x4c6d5b);};}var utilLicense=require('../../config/license/util');exports[_0xc631('0x26')]=function(_0x2d4fd0,_0x3ebc41){var _0x5d019b={'raw':!![],'where':{'id':0x1}},_0x5679d6={};_0x5679d6[_0xc631('0x27')]=_[_0xc631('0x28')](db[_0xc631('0x29')]['rawAttributes']);_0x5679d6[_0xc631('0x2a')]=_[_0xc631('0x28')](_0x2d4fd0[_0xc631('0x2a')]);_0x5679d6[_0xc631('0x2b')]=_[_0xc631('0x2c')](_0x5679d6['model'],_0x5679d6[_0xc631('0x2a')]);_0x5d019b[_0xc631('0x2d')]=_[_0xc631('0x2c')](_0x5679d6['model'],qs[_0xc631('0x2e')](_0x2d4fd0[_0xc631('0x2a')]['fields']));_0x5d019b[_0xc631('0x2d')]=_0x5d019b[_0xc631('0x2d')][_0xc631('0x2f')]?_0x5d019b[_0xc631('0x2d')]:_0x5679d6[_0xc631('0x27')];_0x5d019b=_[_0xc631('0x30')]({},_0x5d019b,_0x2d4fd0[_0xc631('0x31')]);return utilLicense[_0xc631('0x32')](_0x5d019b)[_0xc631('0x21')](respondWithResult(_0x3ebc41,null))[_0xc631('0x33')](handleError(_0x3ebc41,null));};exports[_0xc631('0x20')]=function(_0x498695,_0x53afcd){if(_0x498695['body']['id']){delete _0x498695['body']['id'];}return db[_0xc631('0x29')][_0xc631('0x34')]({'where':{'id':_0x498695['params']['id']}})['then'](handleEntityNotFound(_0x53afcd,null))[_0xc631('0x21')](function(_0x3ef80c){var _0x20b794=_0x3ef80c['get']({'plain':!![]});return utilLicense[_0xc631('0x35')](_0x20b794,_0x498695[_0xc631('0x36')]['key']);})[_0xc631('0x21')](function(_0x2f3d29){if(!_0x2f3d29[_0xc631('0x37')]){return saveUpdates(_0x498695[_0xc631('0x36')],null);}return _0x2f3d29;})['then'](respondWithResult(_0x53afcd,null))[_0xc631('0x33')](handleError(_0x53afcd,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4c5708a..594c332 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 _0x4d46=['./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1d7a48,_0x51490b){var _0xc0efea=function(_0x489050){while(--_0x489050){_0x1d7a48['push'](_0x1d7a48['shift']());}};_0xc0efea(++_0x51490b);}(_0x4d46,0x197));var _0x64d4=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0x4d46[_0x1f78cb];return _0x2cf6b8;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var logger=require(_0x64d4('0x2'))(_0x64d4('0x3'));var moment=require(_0x64d4('0x4'));var BPromise=require(_0x64d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64d4('0x6'));var rimraf=require(_0x64d4('0x7'));var config=require(_0x64d4('0x8'));var attributes=require(_0x64d4('0x9'));module[_0x64d4('0xa')]=function(_0x3b8932,_0x4d9222){return _0x3b8932[_0x64d4('0xb')](_0x64d4('0xc'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b70=['./license.attributes','define','license','util','api','moment','request-promise','path','rimraf'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0x0b70,0x159));var _0x00b7=function(_0x2e124d,_0x31ce4a){_0x2e124d=_0x2e124d-0x0;var _0x1c03d2=_0x0b70[_0x2e124d];return _0x1c03d2;};'use strict';var _=require('lodash');var util=require(_0x00b7('0x0'));var logger=require('../../config/logger')(_0x00b7('0x1'));var moment=require(_0x00b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x00b7('0x3'));var fs=require('fs');var path=require(_0x00b7('0x4'));var rimraf=require(_0x00b7('0x5'));var config=require('../../config/environment');var attributes=require(_0x00b7('0x6'));module['exports']=function(_0x81e64,_0x54332d){return _0x81e64[_0x00b7('0x7')]('License',attributes,{'tableName':_0x00b7('0x8'),'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 2bdb79c..87c57ea 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 _0xedbb=['request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xedbb,0xe5));var _0xbedb=function(_0x320048,_0x5a5b70){_0x320048=_0x320048-0x0;var _0x36ac2d=_0xedbb[_0x320048];return _0x36ac2d;};'use strict';var _=require(_0xbedb('0x0'));var util=require(_0xbedb('0x1'));var moment=require(_0xbedb('0x2'));var BPromise=require(_0xbedb('0x3'));var rs=require(_0xbedb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbedb('0x5'));var logger=require('../../config/logger')(_0xbedb('0x6'));var config=require(_0xbedb('0x7'));var jayson=require(_0xbedb('0x8'));var client=jayson[_0xbedb('0x9')][_0xbedb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ee8d3,_0x5ccfc5,_0x46c134){return new BPromise(function(_0xd3f110,_0x115b56){return client[_0xbedb('0xb')](_0x4ee8d3,_0x46c134)[_0xbedb('0xc')](function(_0x53e3ab){logger[_0xbedb('0xd')](_0xbedb('0xe'),_0x5ccfc5,_0xbedb('0xf'));logger[_0xbedb('0x10')](_0xbedb('0x11'),_0x5ccfc5,_0xbedb('0xf'),JSON[_0xbedb('0x12')](_0x53e3ab));if(_0x53e3ab[_0xbedb('0x13')]){if(_0x53e3ab[_0xbedb('0x13')][_0xbedb('0x14')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x5ccfc5,_0x53e3ab[_0xbedb('0x13')][_0xbedb('0x15')]);return _0x115b56(_0x53e3ab['error'][_0xbedb('0x15')]);}logger['error']('License,\x20%s,\x20%s',_0x5ccfc5,_0x53e3ab[_0xbedb('0x13')]['message']);return _0xd3f110(_0x53e3ab[_0xbedb('0x13')][_0xbedb('0x15')]);}else{logger[_0xbedb('0xd')](_0xbedb('0xe'),_0x5ccfc5,_0xbedb('0xf'));_0xd3f110(_0x53e3ab[_0xbedb('0x16')][_0xbedb('0x15')]);}})[_0xbedb('0x17')](function(_0x18e575){logger[_0xbedb('0x13')](_0xbedb('0xe'),_0x5ccfc5,_0x18e575);_0x115b56(_0x18e575);});});} \ No newline at end of file +var _0x027f=['then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x027f,0x95));var _0xf027=function(_0x4346a8,_0x2dd8e2){_0x4346a8=_0x4346a8-0x0;var _0x287ceb=_0x027f[_0x4346a8];return _0x287ceb;};'use strict';var _=require(_0xf027('0x0'));var util=require(_0xf027('0x1'));var moment=require(_0xf027('0x2'));var BPromise=require(_0xf027('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf027('0x4'));var db=require(_0xf027('0x5'))['db'];var utils=require(_0xf027('0x6'));var logger=require(_0xf027('0x7'))(_0xf027('0x8'));var config=require(_0xf027('0x9'));var jayson=require(_0xf027('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fe4a7,_0x294bbd,_0x51bc17){return new BPromise(function(_0x3dd754,_0x5db2f5){return client[_0xf027('0xb')](_0x2fe4a7,_0x51bc17)[_0xf027('0xc')](function(_0xd7c8c7){logger[_0xf027('0xd')](_0xf027('0xe'),_0x294bbd,_0xf027('0xf'));logger[_0xf027('0x10')](_0xf027('0x11'),_0x294bbd,_0xf027('0xf'),JSON[_0xf027('0x12')](_0xd7c8c7));if(_0xd7c8c7['error']){if(_0xd7c8c7[_0xf027('0x13')]['code']===0x1f4){logger[_0xf027('0x13')](_0xf027('0xe'),_0x294bbd,_0xd7c8c7[_0xf027('0x13')]['message']);return _0x5db2f5(_0xd7c8c7[_0xf027('0x13')]['message']);}logger['error'](_0xf027('0xe'),_0x294bbd,_0xd7c8c7['error'][_0xf027('0x14')]);return _0x3dd754(_0xd7c8c7['error'][_0xf027('0x14')]);}else{logger[_0xf027('0xd')](_0xf027('0xe'),_0x294bbd,_0xf027('0xf'));_0x3dd754(_0xd7c8c7[_0xf027('0x15')][_0xf027('0x14')]);}})[_0xf027('0x16')](function(_0x5bb865){logger[_0xf027('0x13')](_0xf027('0xe'),_0x294bbd,_0x5bb865);_0x5db2f5(_0x5bb865);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e973933..26f5ed7 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 _0x4542=['/:id/in_servers','addImap','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4542,0x1b4));var _0x2454=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4542[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x2454('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2454('0x1'));var express=require('express');var router=express[_0x2454('0x2')]();var auth=require(_0x2454('0x3'));var interaction=require(_0x2454('0x4'));var config=require(_0x2454('0x5'));var controller=require(_0x2454('0x6'));router[_0x2454('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2454('0x7')](_0x2454('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x2454('0x7')](_0x2454('0x9'),auth[_0x2454('0xa')](),controller[_0x2454('0xb')]);router[_0x2454('0x7')](_0x2454('0xc'),auth[_0x2454('0xa')](),controller[_0x2454('0xd')]);router['get'](_0x2454('0xe'),auth[_0x2454('0xa')](),controller['getAnswers']);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller['getImap']);router[_0x2454('0x7')](_0x2454('0xf'),auth[_0x2454('0xa')](),controller['getSmtp']);router[_0x2454('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x2454('0x10')]);router[_0x2454('0x7')](_0x2454('0x11'),auth[_0x2454('0xa')](),controller[_0x2454('0x12')]);router[_0x2454('0x7')](_0x2454('0x13'),auth[_0x2454('0xa')](),controller[_0x2454('0x14')]);router[_0x2454('0x7')](_0x2454('0x15'),auth[_0x2454('0xa')](),controller[_0x2454('0x16')]);router[_0x2454('0x7')](_0x2454('0x17'),auth[_0x2454('0xa')](),controller['getAgents']);router[_0x2454('0x18')](_0x2454('0xc'),auth[_0x2454('0xa')](),controller['addDisposition']);router['post'](_0x2454('0xe'),auth[_0x2454('0xa')](),controller[_0x2454('0x19')]);router[_0x2454('0x18')]('/',auth[_0x2454('0xa')](),controller['create']);router['post'](_0x2454('0x1a'),auth[_0x2454('0xa')](),controller[_0x2454('0x1b')]);router['post'](_0x2454('0xf'),auth[_0x2454('0xa')](),controller['addSmtp']);router['post'](_0x2454('0x1c'),auth[_0x2454('0xa')](),controller[_0x2454('0x1d')]);router['post'](_0x2454('0x11'),auth[_0x2454('0xa')](),controller[_0x2454('0x1e')]);router['post'](_0x2454('0x1f'),auth[_0x2454('0xa')](),controller['send']);router[_0x2454('0x18')](_0x2454('0x17'),auth[_0x2454('0xa')](),controller[_0x2454('0x20')]);router[_0x2454('0x21')](_0x2454('0x9'),auth[_0x2454('0xa')](),controller[_0x2454('0x22')]);router['delete'](_0x2454('0xc'),auth[_0x2454('0xa')](),controller[_0x2454('0x23')]);router[_0x2454('0x24')](_0x2454('0xe'),auth[_0x2454('0xa')](),controller['removeAnswers']);router[_0x2454('0x24')](_0x2454('0x1a'),auth[_0x2454('0xa')](),controller[_0x2454('0x25')]);router[_0x2454('0x24')](_0x2454('0xf'),auth[_0x2454('0xa')](),controller[_0x2454('0x26')]);router[_0x2454('0x24')](_0x2454('0x9'),auth[_0x2454('0xa')](),controller[_0x2454('0x27')]);router[_0x2454('0x24')](_0x2454('0x17'),auth['isAuthenticated'](),controller[_0x2454('0x28')]);module[_0x2454('0x29')]=router; \ No newline at end of file +var _0x98ed=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','delete','removeAnswers','/:id/in_servers','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0xeff046,_0x55345b){var _0x2b6269=function(_0x2962b1){while(--_0x2962b1){_0xeff046['push'](_0xeff046['shift']());}};_0x2b6269(++_0x55345b);}(_0x98ed,0x146));var _0xd98e=function(_0x206711,_0x4125b4){_0x206711=_0x206711-0x0;var _0x4fe02b=_0x98ed[_0x206711];return _0x4fe02b;};'use strict';var multer=require(_0xd98e('0x0'));var util=require('util');var path=require(_0xd98e('0x1'));var timeout=require(_0xd98e('0x2'));var express=require('express');var router=express[_0xd98e('0x3')]();var auth=require(_0xd98e('0x4'));var interaction=require(_0xd98e('0x5'));var config=require(_0xd98e('0x6'));var controller=require('./mailAccount.controller');router[_0xd98e('0x7')]('/',auth[_0xd98e('0x8')](),controller['index']);router[_0xd98e('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd98e('0x7')](_0xd98e('0x9'),auth['isAuthenticated'](),controller[_0xd98e('0xa')]);router[_0xd98e('0x7')](_0xd98e('0xb'),auth[_0xd98e('0x8')](),controller[_0xd98e('0xc')]);router[_0xd98e('0x7')](_0xd98e('0xd'),auth[_0xd98e('0x8')](),controller['getAnswers']);router[_0xd98e('0x7')]('/:id/in_servers',auth[_0xd98e('0x8')](),controller['getImap']);router[_0xd98e('0x7')](_0xd98e('0xe'),auth[_0xd98e('0x8')](),controller[_0xd98e('0xf')]);router['get'](_0xd98e('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xd98e('0x11'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x12')]);router[_0xd98e('0x7')](_0xd98e('0x13'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x14')]);router[_0xd98e('0x7')](_0xd98e('0x15'),auth['isAuthenticated'](),controller[_0xd98e('0x16')]);router[_0xd98e('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xd98e('0x17')]);router['post'](_0xd98e('0xb'),auth[_0xd98e('0x8')](),controller['addDisposition']);router[_0xd98e('0x18')]('/:id/canned_answers',auth[_0xd98e('0x8')](),controller[_0xd98e('0x19')]);router[_0xd98e('0x18')]('/',auth[_0xd98e('0x8')](),controller[_0xd98e('0x1a')]);router[_0xd98e('0x18')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xd98e('0x1b')]);router[_0xd98e('0x18')](_0xd98e('0xe'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x1c')]);router[_0xd98e('0x18')](_0xd98e('0x10'),auth['isAuthenticated'](),controller[_0xd98e('0x1d')]);router[_0xd98e('0x18')](_0xd98e('0x11'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x1e')]);router[_0xd98e('0x18')](_0xd98e('0x1f'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x20')]);router['post'](_0xd98e('0x21'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x22')]);router['put']('/:id',auth[_0xd98e('0x8')](),controller['update']);router[_0xd98e('0x23')](_0xd98e('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xd98e('0xd'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x24')]);router[_0xd98e('0x23')](_0xd98e('0x25'),auth[_0xd98e('0x8')](),controller['removeImap']);router['delete'](_0xd98e('0xe'),auth['isAuthenticated'](),controller[_0xd98e('0x26')]);router[_0xd98e('0x23')](_0xd98e('0x9'),auth['isAuthenticated'](),controller[_0xd98e('0x27')]);router['delete'](_0xd98e('0x21'),auth[_0xd98e('0x8')](),controller[_0xd98e('0x28')]);module[_0xd98e('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 802bef9..05cc4f1 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 _0x748e=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x748e,0x103));var _0xe748=function(_0x1b08d4,_0x8a710c){_0x1b08d4=_0x1b08d4-0x0;var _0x9aef3e=_0x748e[_0x1b08d4];return _0x9aef3e;};'use strict';var Sequelize=require('sequelize');module[_0xe748('0x0')]={'description':{'type':Sequelize[_0xe748('0x1')]},'name':{'type':Sequelize[_0xe748('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe748('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe748('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe748('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe748('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe748('0x1')],'allowNull':![],'defaultValue':_0xe748('0x4')},'fontSize':{'type':Sequelize[_0xe748('0x5')](0x2)[_0xe748('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe748('0x3')],'defaultValue':function(){return _0xe748('0x7');}},'notificationSound':{'type':Sequelize[_0xe748('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe748('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe748('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe748('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe748('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe748('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe748('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe748('0x2')],'defaultValue':![],'comment':_0xe748('0x9'),'set':function(_0x34febb){if(!_0x34febb)this[_0xe748('0xa')](_0xe748('0xb'),null);this[_0xe748('0xa')](_0xe748('0xc'),_0x34febb);}}}; \ No newline at end of file +var _0xf595=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x1059a3,_0x43e16c){var _0x450964=function(_0x4185a7){while(--_0x4185a7){_0x1059a3['push'](_0x1059a3['shift']());}};_0x450964(++_0x43e16c);}(_0xf595,0x17d));var _0x5f59=function(_0x712fc1,_0x2d0d08){_0x712fc1=_0x712fc1-0x0;var _0x2cc5bf=_0xf595[_0x712fc1];return _0x2cc5bf;};'use strict';var Sequelize=require(_0x5f59('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x5f59('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x5f59('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5f59('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5f59('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x5f59('0x3')]},'markAsUnread':{'type':Sequelize[_0x5f59('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5f59('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x5f59('0x4')](0x2)[_0x5f59('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5f59('0x6');}},'notificationSound':{'type':Sequelize[_0x5f59('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5f59('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5f59('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5f59('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5f59('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5f59('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x5f59('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e3805){if(!_0x1e3805)this[_0x5f59('0x8')](_0x5f59('0x9'),null);this['setDataValue'](_0x5f59('0xa'),_0x1e3805);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d7e4462..b7131c0 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 _0x80cf=['getSmtp','addSmtp','removeSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','send','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','model','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','include','findAll','rows','show','params','fields','length','find','update','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','order','includeAll','removeAnswers','key','email','isNil','active','description','cservice','cauthentication','cuser','password','cpassword','authentication','host','port','service','user','pass','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','addImap'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0x80cf,0x1b9));var _0xf80c=function(_0xed6626,_0x1308f8){_0xed6626=_0xed6626-0x0;var _0x41cee1=_0x80cf[_0xed6626];return _0x41cee1;};'use strict';var pdf=require(_0xf80c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf80c('0x1'));var jsonpatch=require(_0xf80c('0x2'));var rp=require('request-promise');var moment=require(_0xf80c('0x3'));var BPromise=require(_0xf80c('0x4'));var Mustache=require(_0xf80c('0x5'));var util=require(_0xf80c('0x6'));var path=require(_0xf80c('0x7'));var sox=require(_0xf80c('0x8'));var csv=require(_0xf80c('0x9'));var ejs=require(_0xf80c('0xa'));var fs=require('fs');var _=require(_0xf80c('0xb'));var squel=require(_0xf80c('0xc'));var crypto=require('crypto');var jsforce=require(_0xf80c('0xd'));var deskjs=require(_0xf80c('0xe'));var toCsv=require(_0xf80c('0x9'));var querystring=require(_0xf80c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xf80c('0x10'));var logger=require(_0xf80c('0x11'))(_0xf80c('0x12'));var utils=require(_0xf80c('0x13'));var config=require(_0xf80c('0x14'));var db=require(_0xf80c('0x15'))['db'];config[_0xf80c('0x16')]=_[_0xf80c('0x17')](config['redis'],{'host':_0xf80c('0x18'),'port':0x18eb});var socket=require(_0xf80c('0x19'))(new Redis(config[_0xf80c('0x16')]));require('./mailAccount.socket')[_0xf80c('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf80c('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x5bda56,_0x293853,_0x115ffa){if(_0x115ffa){var _0x24fc00=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24fc00[_0xf80c('0x1c')](_0x293853)){return _0x5bda56;}else{throw new Error(_0xf80c('0x1d'));}}else{return _0x5bda56;}}function respondWithRpcPromise(_0x193b04,_0x25fba1,_0x57dd54,_0xa2b90d){return new BPromise(function(_0x4abe78,_0x457fca){var _0x558693=_0xa2b90d||client;return _0x558693[_0xf80c('0x1e')](_0x193b04,_0x57dd54)[_0xf80c('0x1f')](function(_0x4faf4c){logger[_0xf80c('0x20')]('MailAccount,\x20%s,\x20%s',_0x25fba1,'request\x20sent');logger[_0xf80c('0x21')](_0xf80c('0x22'),_0x25fba1,_0xf80c('0x23'),JSON[_0xf80c('0x24')](_0x4faf4c));if(_0x4faf4c[_0xf80c('0x25')]){if(_0x4faf4c['error'][_0xf80c('0x26')]===0x1f4){logger['error'](_0xf80c('0x27'),_0x25fba1,_0x4faf4c[_0xf80c('0x25')][_0xf80c('0x28')]);return _0x457fca(_0x4faf4c[_0xf80c('0x25')][_0xf80c('0x28')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x25fba1,_0x4faf4c[_0xf80c('0x25')][_0xf80c('0x28')]);return _0x4abe78(_0x4faf4c[_0xf80c('0x25')][_0xf80c('0x28')]);}else{logger[_0xf80c('0x20')]('MailAccount,\x20%s,\x20%s',_0x25fba1,_0xf80c('0x23'));_0x4abe78(_0x4faf4c['result'][_0xf80c('0x28')]);}})[_0xf80c('0x29')](function(_0x5b9672){logger['error'](_0xf80c('0x27'),_0x25fba1,_0x5b9672);_0x457fca(_0x5b9672);});});}function respondWithStatusCode(_0x37e608,_0x4f68c0){_0x4f68c0=_0x4f68c0||0xcc;return function(_0x3a7d8b){if(_0x3a7d8b){return _0x37e608[_0xf80c('0x2a')](_0x4f68c0);}return _0x37e608[_0xf80c('0x2b')](_0x4f68c0)[_0xf80c('0x2c')]();};}function respondWithResult(_0x3ccfbb,_0x3314fd){_0x3314fd=_0x3314fd||0xc8;return function(_0x502c0c){if(_0x502c0c){return _0x3ccfbb[_0xf80c('0x2b')](_0x3314fd)[_0xf80c('0x2d')](_0x502c0c);}};}function respondWithFilteredResult(_0x1d096c,_0x10f113){return function(_0x227127){if(_0x227127){var _0x217cdb=_0x227127['count'],_0x550580=_0x10f113[_0xf80c('0x2e')],_0xdb3694=_0x10f113[_0xf80c('0x2e')]+_0x10f113[_0xf80c('0x2f')],_0x2eedbc;if(_0xdb3694>=_0x217cdb){_0xdb3694=_0x217cdb;_0x2eedbc=0xc8;}else{_0x2eedbc=0xce;}_0x1d096c[_0xf80c('0x2b')](_0x2eedbc);return _0x1d096c[_0xf80c('0x30')](_0xf80c('0x31'),_0x550580+'-'+_0xdb3694+'/'+_0x217cdb)[_0xf80c('0x2d')](_0x227127);}return null;};}function patchUpdates(_0x18f023){return function(_0x191626){try{jsonpatch[_0xf80c('0x32')](_0x191626,_0x18f023,!![]);}catch(_0x23d284){return BPromise[_0xf80c('0x33')](_0x23d284);}return _0x191626[_0xf80c('0x34')]();};}function saveUpdates(_0xb50c73,_0x551260){return function(_0x512d43){if(_0x512d43){return _0x512d43['update'](_0xb50c73)[_0xf80c('0x1f')](function(_0x37582d){return _0x37582d;});}return null;};}function removeEntity(_0xd07e6a,_0x2b8338){return function(_0x4ef4da){if(_0x4ef4da){return _0x4ef4da[_0xf80c('0x35')]()[_0xf80c('0x1f')](function(){var _0x32677d=_0x4ef4da[_0xf80c('0x36')]({'plain':!![]});var _0xece26c='MailAccounts';return db[_0xf80c('0x37')][_0xf80c('0x35')]({'where':{'type':_0xece26c,'resourceId':_0x32677d['id']}})[_0xf80c('0x1f')](function(){return _0x4ef4da;});})[_0xf80c('0x1f')](function(){_0xd07e6a[_0xf80c('0x2b')](0xcc)[_0xf80c('0x2c')]();});}};}function handleEntityNotFound(_0x4509d6,_0x1f14f9){return function(_0x40b3b0){if(!_0x40b3b0){_0x4509d6[_0xf80c('0x2a')](0x194);}return _0x40b3b0;};}function handleError(_0x186ee6,_0x1eca35){_0x1eca35=_0x1eca35||0x1f4;return function(_0x2a5b94){logger['error'](_0x2a5b94['stack']);if(_0x2a5b94[_0xf80c('0x38')]){delete _0x2a5b94['name'];}_0x186ee6[_0xf80c('0x2b')](_0x1eca35)['send'](_0x2a5b94);};}exports[_0xf80c('0x39')]=function(_0x31b255,_0x21eb18){var _0x19bbb1={'include':[{'model':db[_0xf80c('0x3a')],'as':_0xf80c('0x3b')},{'model':db[_0xf80c('0x3c')],'as':_0xf80c('0x3d')},{'model':db[_0xf80c('0x3e')],'as':_0xf80c('0x3f')}]},_0x1c020c={},_0x24bcac={'count':0x0,'rows':[]};var _0x5979f9=db[_0xf80c('0x40')][_0xf80c('0x41')];_0x1c020c[_0xf80c('0x42')]=_['keys'](_0x5979f9);_0x1c020c['query']=_[_0xf80c('0x43')](_0x31b255[_0xf80c('0x44')]);_0x1c020c[_0xf80c('0x45')]=_['intersection'](_0x1c020c['model'],_0x1c020c[_0xf80c('0x44')]);_0x19bbb1[_0xf80c('0x46')]=_[_0xf80c('0x47')](_0x1c020c['model'],qs['fields'](_0x31b255[_0xf80c('0x44')]['fields']));_0x19bbb1[_0xf80c('0x46')]=_0x19bbb1[_0xf80c('0x46')]['length']?_0x19bbb1['attributes']:_0x1c020c[_0xf80c('0x42')];if(!_0x31b255[_0xf80c('0x44')][_0xf80c('0x48')](_0xf80c('0x49'))){_0x19bbb1[_0xf80c('0x2f')]=qs[_0xf80c('0x2f')](_0x31b255[_0xf80c('0x44')][_0xf80c('0x2f')]);_0x19bbb1[_0xf80c('0x2e')]=qs[_0xf80c('0x2e')](_0x31b255[_0xf80c('0x44')][_0xf80c('0x2e')]);}_0x19bbb1['order']=qs['sort'](_0x31b255[_0xf80c('0x44')][_0xf80c('0x4a')]);_0x19bbb1[_0xf80c('0x4b')]=qs[_0xf80c('0x45')](_[_0xf80c('0x4c')](_0x31b255['query'],_0x1c020c[_0xf80c('0x45')]));if(_0x31b255['query'][_0xf80c('0x4d')]){_0x19bbb1[_0xf80c('0x4b')]=_[_0xf80c('0x4e')](_0x19bbb1[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0x5979f9,function(_0x1d9317){if(_0x1d9317['type']['key']!==_0xf80c('0x50')){var _0x45588c={};_0x45588c[_0x1d9317['field']]={'$like':'%'+_0x31b255[_0xf80c('0x44')][_0xf80c('0x4d')]+'%'};return _0x45588c;}})});}_0x19bbb1=_[_0xf80c('0x4e')]({},_0x19bbb1,_0x31b255[_0xf80c('0x51')]);var _0x48232b={'where':_0x19bbb1[_0xf80c('0x4b')]};return db[_0xf80c('0x40')][_0xf80c('0x52')](_0x48232b)[_0xf80c('0x1f')](function(_0x46abfb){_0x24bcac[_0xf80c('0x52')]=_0x46abfb;if(_0x31b255[_0xf80c('0x44')]['includeAll']){_0x19bbb1[_0xf80c('0x53')]=[{'all':!![]}];}return db['MailAccount'][_0xf80c('0x54')](_0x19bbb1);})[_0xf80c('0x1f')](function(_0x973daa){_0x24bcac[_0xf80c('0x55')]=_0x973daa;return _0x24bcac;})[_0xf80c('0x1f')](respondWithFilteredResult(_0x21eb18,_0x19bbb1))['catch'](handleError(_0x21eb18,null));};exports[_0xf80c('0x56')]=function(_0x2c5985,_0x3d8da7){var _0x34eda7={'raw':![],'where':{'id':_0x2c5985[_0xf80c('0x57')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xf80c('0x3c')],'as':_0xf80c('0x3d')},{'model':db[_0xf80c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1a6ab2={};_0x1a6ab2[_0xf80c('0x42')]=_[_0xf80c('0x43')](db['MailAccount'][_0xf80c('0x41')]);_0x1a6ab2[_0xf80c('0x44')]=_[_0xf80c('0x43')](_0x2c5985[_0xf80c('0x44')]);_0x1a6ab2[_0xf80c('0x45')]=_[_0xf80c('0x47')](_0x1a6ab2[_0xf80c('0x42')],_0x1a6ab2[_0xf80c('0x44')]);_0x34eda7['attributes']=_[_0xf80c('0x47')](_0x1a6ab2['model'],qs[_0xf80c('0x58')](_0x2c5985[_0xf80c('0x44')][_0xf80c('0x58')]));_0x34eda7[_0xf80c('0x46')]=_0x34eda7[_0xf80c('0x46')][_0xf80c('0x59')]?_0x34eda7[_0xf80c('0x46')]:_0x1a6ab2['model'];if(_0x2c5985['query']['includeAll']){_0x34eda7[_0xf80c('0x53')]=[{'all':!![]}];}_0x34eda7=_[_0xf80c('0x4e')]({},_0x34eda7,_0x2c5985[_0xf80c('0x51')]);return db['MailAccount'][_0xf80c('0x5a')](_0x34eda7)[_0xf80c('0x1f')](handleEntityNotFound(_0x3d8da7,null))[_0xf80c('0x1f')](respondWithResult(_0x3d8da7,null))[_0xf80c('0x29')](handleError(_0x3d8da7,null));};exports[_0xf80c('0x5b')]=function(_0x5f49fa,_0x4f4468){if(_0x5f49fa[_0xf80c('0x5c')]['id']){delete _0x5f49fa[_0xf80c('0x5c')]['id'];}return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x5f49fa[_0xf80c('0x57')]['id']},'include':[{'model':db[_0xf80c('0x3a')],'as':_0xf80c('0x3b')},{'model':db[_0xf80c('0x3c')],'as':_0xf80c('0x3d')},{'model':db[_0xf80c('0x3e')],'as':_0xf80c('0x3f')}]})[_0xf80c('0x1f')](handleEntityNotFound(_0x4f4468,null))[_0xf80c('0x1f')](saveUpdates(_0x5f49fa[_0xf80c('0x5c')],null))[_0xf80c('0x1f')](function(_0x16b947){if(_0x16b947&&_0x5f49fa[_0xf80c('0x5c')]['Imap']){return db[_0xf80c('0x3a')][_0xf80c('0x5b')](_0x5f49fa[_0xf80c('0x5c')][_0xf80c('0x3b')],{'where':{'MailAccountId':_0x16b947['id']}})[_0xf80c('0x1f')](function(){return _0x16b947;});}return _0x16b947;})['then'](function(_0x2ca97d){if(_0x2ca97d&&_0x5f49fa[_0xf80c('0x5c')][_0xf80c('0x3d')]){return db[_0xf80c('0x3c')]['update'](_0x5f49fa[_0xf80c('0x5c')][_0xf80c('0x3d')],{'where':{'MailAccountId':_0x2ca97d['id']}})[_0xf80c('0x1f')](function(){return _0x2ca97d;});}return _0x2ca97d;})[_0xf80c('0x1f')](respondWithResult(_0x4f4468,null))['catch'](handleError(_0x4f4468,null));};exports[_0xf80c('0x5d')]=function(_0x4e8982,_0x3b7553){return db[_0xf80c('0x40')][_0xf80c('0x5d')]()[_0xf80c('0x1f')](respondWithResult(_0x3b7553,null))['catch'](handleError(_0x3b7553,null));};exports['addDisposition']=function(_0xb6b824,_0x2a0cb8,_0x2372bf){if(_0xb6b824[_0xf80c('0x5c')]['id']){delete _0xb6b824[_0xf80c('0x5c')]['id'];}return db[_0xf80c('0x40')]['find']({'where':{'id':_0xb6b824['params']['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x2a0cb8,null))[_0xf80c('0x1f')](function(_0x19c3f9){if(_0x19c3f9){_0xb6b824[_0xf80c('0x5c')][_0xf80c('0x5e')]=_0x19c3f9['id'];return db[_0xf80c('0x5f')][_0xf80c('0x60')](_0xb6b824['body']);}})[_0xf80c('0x1f')](respondWithResult(_0x2a0cb8,null))['catch'](handleError(_0x2a0cb8,null));};exports[_0xf80c('0x61')]=function(_0xaf6e0b,_0x52110f,_0x288f5e){var _0x322165={'raw':![],'where':{}};var _0x1bfdd5={};var _0x25bb62={'count':0x0,'rows':[]};return db['MailAccount'][_0xf80c('0x62')]({'where':{'id':_0xaf6e0b[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x52110f,null))['then'](function(_0x71c96b){if(_0x71c96b){_0x1bfdd5['model']=_[_0xf80c('0x43')](db[_0xf80c('0x5f')][_0xf80c('0x41')]);_0x1bfdd5[_0xf80c('0x44')]=_[_0xf80c('0x43')](_0xaf6e0b[_0xf80c('0x44')]);_0x1bfdd5[_0xf80c('0x45')]=_[_0xf80c('0x47')](_0x1bfdd5[_0xf80c('0x42')],_0x1bfdd5[_0xf80c('0x44')]);_0x322165[_0xf80c('0x46')]=_[_0xf80c('0x47')](_0x1bfdd5[_0xf80c('0x42')],qs[_0xf80c('0x58')](_0xaf6e0b[_0xf80c('0x44')][_0xf80c('0x58')]));_0x322165['attributes']=_0x322165[_0xf80c('0x46')][_0xf80c('0x59')]?_0x322165['attributes']:_0x1bfdd5[_0xf80c('0x42')];if(!_0xaf6e0b[_0xf80c('0x44')][_0xf80c('0x48')]('nolimit')){_0x322165[_0xf80c('0x2f')]=qs[_0xf80c('0x2f')](_0xaf6e0b[_0xf80c('0x44')][_0xf80c('0x2f')]);_0x322165[_0xf80c('0x2e')]=qs['offset'](_0xaf6e0b['query'][_0xf80c('0x2e')]);}_0x322165['order']=qs[_0xf80c('0x4a')](_0xaf6e0b[_0xf80c('0x44')]['sort']);_0x322165['where']=qs[_0xf80c('0x45')](_[_0xf80c('0x4c')](_0xaf6e0b[_0xf80c('0x44')],_0x1bfdd5[_0xf80c('0x45')]));_0x322165[_0xf80c('0x4b')][_0xf80c('0x5e')]=_0x71c96b['id'];if(_0xaf6e0b[_0xf80c('0x44')]['filter']){_0x322165[_0xf80c('0x4b')]=_[_0xf80c('0x4e')](_0x322165[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0x322165[_0xf80c('0x46')],function(_0x3247a0){var _0x106ed2={};_0x106ed2[_0x3247a0]={'$like':'%'+_0xaf6e0b['query']['filter']+'%'};return _0x106ed2;})});}_0x322165=_['merge']({},_0x322165,_0xaf6e0b[_0xf80c('0x51')]);return db[_0xf80c('0x5f')]['count']({'where':_0x322165[_0xf80c('0x4b')]})[_0xf80c('0x1f')](function(_0x418cad){_0x25bb62[_0xf80c('0x52')]=_0x418cad;if(_0xaf6e0b[_0xf80c('0x44')]['includeAll']){_0x322165['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x322165);})[_0xf80c('0x1f')](function(_0x2cc624){_0x25bb62[_0xf80c('0x55')]=_0x2cc624;return _0x25bb62;});}})['then'](respondWithFilteredResult(_0x52110f,_0x322165))['catch'](handleError(_0x52110f,null));};exports[_0xf80c('0x63')]=function(_0x98d16c,_0x395e4,_0x16cb31){return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x98d16c[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x395e4,null))['then'](function(_0xfaa282){if(_0xfaa282){return _0xfaa282[_0xf80c('0x63')](_0x98d16c[_0xf80c('0x44')][_0xf80c('0x64')]);}})[_0xf80c('0x1f')](respondWithStatusCode(_0x395e4,null))[_0xf80c('0x29')](handleError(_0x395e4,null));};exports[_0xf80c('0x65')]=function(_0x26459b,_0x5c9d13,_0x1cb30c){if(_0x26459b[_0xf80c('0x5c')]['id']){delete _0x26459b[_0xf80c('0x5c')]['id'];}return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x26459b[_0xf80c('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c9d13,null))[_0xf80c('0x1f')](function(_0x520de3){if(_0x520de3){_0x26459b[_0xf80c('0x5c')][_0xf80c('0x5e')]=_0x520de3['id'];return db[_0xf80c('0x66')]['create'](_0x26459b['body']);}})[_0xf80c('0x1f')](respondWithResult(_0x5c9d13,null))[_0xf80c('0x29')](handleError(_0x5c9d13,null));};exports['getAnswers']=function(_0x519916,_0x286fb4,_0x16ef6e){var _0x376a7f={'raw':![],'where':{}};var _0x1feba8={};var _0x80d536={'count':0x0,'rows':[]};return db[_0xf80c('0x40')]['findOne']({'where':{'id':_0x519916[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x286fb4,null))['then'](function(_0x11e3a6){if(_0x11e3a6){_0x1feba8[_0xf80c('0x42')]=_['keys'](db[_0xf80c('0x66')]['rawAttributes']);_0x1feba8[_0xf80c('0x44')]=_[_0xf80c('0x43')](_0x519916[_0xf80c('0x44')]);_0x1feba8[_0xf80c('0x45')]=_[_0xf80c('0x47')](_0x1feba8[_0xf80c('0x42')],_0x1feba8[_0xf80c('0x44')]);_0x376a7f[_0xf80c('0x46')]=_['intersection'](_0x1feba8[_0xf80c('0x42')],qs[_0xf80c('0x58')](_0x519916[_0xf80c('0x44')]['fields']));_0x376a7f[_0xf80c('0x46')]=_0x376a7f[_0xf80c('0x46')][_0xf80c('0x59')]?_0x376a7f[_0xf80c('0x46')]:_0x1feba8[_0xf80c('0x42')];if(!_0x519916[_0xf80c('0x44')]['hasOwnProperty'](_0xf80c('0x49'))){_0x376a7f['limit']=qs[_0xf80c('0x2f')](_0x519916[_0xf80c('0x44')][_0xf80c('0x2f')]);_0x376a7f[_0xf80c('0x2e')]=qs[_0xf80c('0x2e')](_0x519916[_0xf80c('0x44')]['offset']);}_0x376a7f[_0xf80c('0x67')]=qs[_0xf80c('0x4a')](_0x519916[_0xf80c('0x44')]['sort']);_0x376a7f[_0xf80c('0x4b')]=qs['filters'](_['pick'](_0x519916['query'],_0x1feba8[_0xf80c('0x45')]));_0x376a7f[_0xf80c('0x4b')][_0xf80c('0x5e')]=_0x11e3a6['id'];if(_0x519916[_0xf80c('0x44')][_0xf80c('0x4d')]){_0x376a7f[_0xf80c('0x4b')]=_['merge'](_0x376a7f[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0x376a7f[_0xf80c('0x46')],function(_0x4e5541){var _0xd2ba05={};_0xd2ba05[_0x4e5541]={'$like':'%'+_0x519916[_0xf80c('0x44')][_0xf80c('0x4d')]+'%'};return _0xd2ba05;})});}_0x376a7f=_['merge']({},_0x376a7f,_0x519916[_0xf80c('0x51')]);return db[_0xf80c('0x66')]['count']({'where':_0x376a7f[_0xf80c('0x4b')]})['then'](function(_0x4e3646){_0x80d536[_0xf80c('0x52')]=_0x4e3646;if(_0x519916[_0xf80c('0x44')][_0xf80c('0x68')]){_0x376a7f['include']=[{'all':!![]}];}return db[_0xf80c('0x66')][_0xf80c('0x54')](_0x376a7f);})[_0xf80c('0x1f')](function(_0x1408de){_0x80d536['rows']=_0x1408de;return _0x80d536;});}})[_0xf80c('0x1f')](respondWithFilteredResult(_0x286fb4,_0x376a7f))[_0xf80c('0x29')](handleError(_0x286fb4,null));};exports[_0xf80c('0x69')]=function(_0x1f1ebc,_0x3d877a,_0x2e2436){return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x1f1ebc[_0xf80c('0x57')]['id']}})['then'](handleEntityNotFound(_0x3d877a,null))[_0xf80c('0x1f')](function(_0x35e6d2){if(_0x35e6d2){return _0x35e6d2['removeAnswers'](_0x1f1ebc[_0xf80c('0x44')]['ids']);}})[_0xf80c('0x1f')](respondWithStatusCode(_0x3d877a,null))[_0xf80c('0x29')](handleError(_0x3d877a,null));};exports['create']=function(_0x1df208,_0x525339){var _0x3e18a2={'name':_0x1df208[_0xf80c('0x5c')][_0xf80c('0x38')],'key':_0x1df208[_0xf80c('0x5c')][_0xf80c('0x6a')],'email':_0x1df208[_0xf80c('0x5c')][_0xf80c('0x6b')],'ListId':_0x1df208['body']['ListId'],'active':!_[_0xf80c('0x6c')](_0x1df208['body'][_0xf80c('0x6d')])?_0x1df208[_0xf80c('0x5c')][_0xf80c('0x6d')]:!![],'description':_0x1df208[_0xf80c('0x5c')][_0xf80c('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0xf80c('0x6c')](_0x1df208[_0xf80c('0x5c')][_0xf80c('0x6f')])){if(_0x1df208[_0xf80c('0x5c')][_0xf80c('0x70')]){_0x3e18a2[_0xf80c('0x3b')]['user']=_0x3e18a2[_0xf80c('0x3d')]['user']=_0x1df208[_0xf80c('0x5c')][_0xf80c('0x71')];_0x3e18a2[_0xf80c('0x3b')][_0xf80c('0x72')]=_0x3e18a2[_0xf80c('0x3d')]['pass']=_0x1df208[_0xf80c('0x5c')][_0xf80c('0x73')];}else{_0x3e18a2['Imap'][_0xf80c('0x74')]=_0x3e18a2[_0xf80c('0x3d')]['authentication']=![];}_0x3e18a2['Imap'][_0xf80c('0x75')]=_0x1df208[_0xf80c('0x5c')]['Imap'][_0xf80c('0x75')];_0x3e18a2[_0xf80c('0x3b')][_0xf80c('0x76')]=_0x1df208[_0xf80c('0x5c')][_0xf80c('0x3b')][_0xf80c('0x76')];_0x3e18a2[_0xf80c('0x3d')][_0xf80c('0x75')]=_0x1df208[_0xf80c('0x5c')]['Smtp'][_0xf80c('0x75')];_0x3e18a2[_0xf80c('0x3d')][_0xf80c('0x76')]=_0x1df208['body'][_0xf80c('0x3d')]['port'];}else{_0x3e18a2['Imap']['service']=_0x3e18a2['Smtp'][_0xf80c('0x77')]=_0x1df208['body']['cservice'];_0x3e18a2[_0xf80c('0x3b')]['user']=_0x3e18a2[_0xf80c('0x3d')][_0xf80c('0x78')]=_0x1df208[_0xf80c('0x5c')][_0xf80c('0x71')];_0x3e18a2['Imap'][_0xf80c('0x72')]=_0x3e18a2[_0xf80c('0x3d')][_0xf80c('0x79')]=_0x1df208[_0xf80c('0x5c')]['cpassword'];}return db[_0xf80c('0x40')][_0xf80c('0x60')](_0x3e18a2,{'include':[{'model':db[_0xf80c('0x3c')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xf80c('0x3b')}]})[_0xf80c('0x1f')](function(_0x3271f8){var _0x27ee61=_0x1df208[_0xf80c('0x78')][_0xf80c('0x36')]({'plain':!![]});if(!_0x27ee61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27ee61[_0xf80c('0x7a')]===_0xf80c('0x78')){var _0x4765dd=_0x3271f8[_0xf80c('0x36')]({'plain':!![]});return db[_0xf80c('0x7b')][_0xf80c('0x5a')]({'where':{'name':_0xf80c('0x7c'),'userProfileId':_0x27ee61[_0xf80c('0x7d')]},'raw':!![]})[_0xf80c('0x1f')](function(_0x31f1c8){if(_0x31f1c8&&_0x31f1c8[_0xf80c('0x7e')]===0x0){return db[_0xf80c('0x37')][_0xf80c('0x60')]({'name':_0x4765dd[_0xf80c('0x38')],'resourceId':_0x4765dd['id'],'type':_0x31f1c8[_0xf80c('0x38')],'sectionId':_0x31f1c8['id']},{})[_0xf80c('0x1f')](function(){return _0x3271f8;});}else{return _0x3271f8;}})[_0xf80c('0x29')](function(_0x1e6476){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e6476);throw _0x1e6476;});}return _0x3271f8;})['then'](respondWithResult(_0x525339,0xc9))[_0xf80c('0x29')](handleError(_0x525339,null));};exports['getImap']=function(_0x3410e8,_0x332bf5,_0x454dfb){return db[_0xf80c('0x40')][_0xf80c('0x62')]({'where':{'id':_0x3410e8['params']['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x332bf5,null))[_0xf80c('0x1f')](function(_0xb00534){if(_0xb00534){return _0xb00534[_0xf80c('0x7f')]();}return null;})['then'](respondWithResult(_0x332bf5,null))[_0xf80c('0x29')](handleError(_0x332bf5,null));};exports[_0xf80c('0x80')]=function(_0x9f162f,_0x3364bc,_0x56dfdf){if(_0x9f162f[_0xf80c('0x5c')]['id']){delete _0x9f162f[_0xf80c('0x5c')]['id'];}return db['MailAccount'][_0xf80c('0x5a')]({'where':{'id':_0x9f162f['params']['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x3364bc,null))[_0xf80c('0x1f')](function(_0x4e1aa2){if(_0x4e1aa2){_0x9f162f['body'][_0xf80c('0x5e')]=_0x4e1aa2['id'];return db[_0xf80c('0x3a')]['create'](_0x9f162f[_0xf80c('0x5c')]);}})[_0xf80c('0x1f')](respondWithResult(_0x3364bc,null))[_0xf80c('0x29')](handleError(_0x3364bc,null));};exports['removeImap']=function(_0x299b21,_0x5a320d,_0x414228){return db[_0xf80c('0x40')][_0xf80c('0x62')]({'where':{'id':_0x299b21[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x5a320d,null))[_0xf80c('0x1f')](function(_0x50e700){if(_0x50e700){return _0x50e700['setImap'](null);}return null;})[_0xf80c('0x1f')](respondWithStatusCode(_0x5a320d,null))['catch'](handleError(_0x5a320d,null));};exports[_0xf80c('0x81')]=function(_0x359bf6,_0x5e4c96,_0x4eeed3){return db[_0xf80c('0x40')][_0xf80c('0x62')]({'where':{'id':_0x359bf6[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x5e4c96,null))['then'](function(_0x58e24d){if(_0x58e24d){return _0x58e24d[_0xf80c('0x81')]();}return null;})[_0xf80c('0x1f')](respondWithResult(_0x5e4c96,null))[_0xf80c('0x29')](handleError(_0x5e4c96,null));};exports[_0xf80c('0x82')]=function(_0x3ed075,_0x156901,_0x396def){if(_0x3ed075['body']['id']){delete _0x3ed075['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x3ed075['params']['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x156901,null))[_0xf80c('0x1f')](function(_0x3581ac){if(_0x3581ac){_0x3ed075[_0xf80c('0x5c')][_0xf80c('0x5e')]=_0x3581ac['id'];return db[_0xf80c('0x3c')][_0xf80c('0x60')](_0x3ed075[_0xf80c('0x5c')]);}})['then'](respondWithResult(_0x156901,null))[_0xf80c('0x29')](handleError(_0x156901,null));};exports[_0xf80c('0x83')]=function(_0x5153b3,_0xa7a84a,_0x1cb016){return db['MailAccount'][_0xf80c('0x62')]({'where':{'id':_0x5153b3[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0xa7a84a,null))[_0xf80c('0x1f')](function(_0x5f3230){if(_0x5f3230){return _0x5f3230['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0xa7a84a,null))[_0xf80c('0x29')](handleError(_0xa7a84a,null));};exports[_0xf80c('0x84')]=function(_0x441cdf,_0x104821,_0xe209b8){return db['MailInteraction'][_0xf80c('0x5a')]({'where':{'id':_0x441cdf[_0xf80c('0x57')]['id']}})['then'](handleEntityNotFound(_0x104821,null))[_0xf80c('0x1f')](function(_0x4648ad){if(_0x4648ad){return _0x4648ad[_0xf80c('0x84')](_0x441cdf[_0xf80c('0x5c')][_0xf80c('0x64')],_['omit'](_0x441cdf[_0xf80c('0x5c')],[_0xf80c('0x64'),'id'])||{});}})[_0xf80c('0x1f')](respondWithResult(_0x104821,null))[_0xf80c('0x29')](handleError(_0x104821,null));};exports[_0xf80c('0x85')]=function(_0x24a901,_0x6158a,_0x5fbbde){var _0xbecd05={'raw':![],'where':{}};var _0x57b750={};var _0x520a16={'count':0x0,'rows':[]};return db[_0xf80c('0x40')][_0xf80c('0x62')]({'where':{'id':_0x24a901[_0xf80c('0x57')]['id']}})['then'](handleEntityNotFound(_0x6158a,null))[_0xf80c('0x1f')](function(_0x1a428d){if(_0x1a428d){_0x57b750['model']=_['keys'](db[_0xf80c('0x86')][_0xf80c('0x41')]);_0x57b750[_0xf80c('0x44')]=_[_0xf80c('0x43')](_0x24a901[_0xf80c('0x44')]);_0x57b750['filters']=_[_0xf80c('0x47')](_0x57b750[_0xf80c('0x42')],_0x57b750[_0xf80c('0x44')]);_0xbecd05[_0xf80c('0x46')]=_[_0xf80c('0x47')](_0x57b750[_0xf80c('0x42')],qs[_0xf80c('0x58')](_0x24a901['query']['fields']));_0xbecd05[_0xf80c('0x46')]=_0xbecd05['attributes']['length']?_0xbecd05[_0xf80c('0x46')]:_0x57b750[_0xf80c('0x42')];if(!_0x24a901['query'][_0xf80c('0x48')](_0xf80c('0x49'))){_0xbecd05[_0xf80c('0x2f')]=qs['limit'](_0x24a901[_0xf80c('0x44')]['limit']);_0xbecd05[_0xf80c('0x2e')]=qs[_0xf80c('0x2e')](_0x24a901[_0xf80c('0x44')][_0xf80c('0x2e')]);}_0xbecd05['order']=qs['sort'](_0x24a901[_0xf80c('0x44')]['sort']);_0xbecd05[_0xf80c('0x4b')]=qs['filters'](_[_0xf80c('0x4c')](_0x24a901[_0xf80c('0x44')],_0x57b750[_0xf80c('0x45')]));_0xbecd05['where'][_0xf80c('0x5e')]=_0x1a428d['id'];if(_0x24a901[_0xf80c('0x44')][_0xf80c('0x4d')]){_0xbecd05[_0xf80c('0x4b')]=_['merge'](_0xbecd05[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0xbecd05[_0xf80c('0x46')],function(_0x79a82d){var _0x22742a={};_0x22742a[_0x79a82d]={'$like':'%'+_0x24a901[_0xf80c('0x44')][_0xf80c('0x4d')]+'%'};return _0x22742a;})});}_0xbecd05=_['merge']({},_0xbecd05,_0x24a901[_0xf80c('0x51')]);return db['MailInteraction']['count']({'where':_0xbecd05[_0xf80c('0x4b')]})[_0xf80c('0x1f')](function(_0x1cd216){_0x520a16[_0xf80c('0x52')]=_0x1cd216;if(_0x24a901[_0xf80c('0x44')][_0xf80c('0x68')]){_0xbecd05[_0xf80c('0x53')]=[{'model':db[_0xf80c('0x87')],'as':_0xf80c('0x88'),'required':![]},{'model':db[_0xf80c('0x89')],'as':_0xf80c('0x8a'),'attributes':['name',_0xf80c('0x8b'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xf80c('0x8c'),'attributes':['id',_0xf80c('0x38'),_0xf80c('0x8d')],'where':_0x24a901['query'][_0xf80c('0x8e')]?{'id':_0x24a901[_0xf80c('0x44')][_0xf80c('0x8e')]}:undefined,'required':_0x24a901[_0xf80c('0x44')][_0xf80c('0x8e')]?!![]:![]}];}return db[_0xf80c('0x86')]['findAll'](_0xbecd05);})['then'](function(_0x11df50){_0x520a16['rows']=_0x11df50;return _0x520a16;});}})['then'](respondWithFilteredResult(_0x6158a,_0xbecd05))[_0xf80c('0x29')](handleError(_0x6158a,null));};exports['addApplications']=function(_0x2bc16a,_0x41f37e,_0x54043b){return db[_0xf80c('0x40')]['findOne']({'where':{'id':_0x2bc16a[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x41f37e,null))[_0xf80c('0x1f')](function(_0x189d18){if(_0x189d18){return db[_0xf80c('0x8f')][_0xf80c('0x90')](function(_0x13fac9){return db[_0xf80c('0x91')]['destroy']({'where':{'MailAccountId':_0x2bc16a[_0xf80c('0x57')]['id']},'transaction':_0x13fac9})[_0xf80c('0x1f')](function(_0x24bbc0){var _0x2eaca3=_[_0xf80c('0x4f')](_0x2bc16a[_0xf80c('0x5c')],function(_0x5422e3){_0x5422e3[_0xf80c('0x5e')]=_0x2bc16a['params']['id'];return _0x5422e3;});return db[_0xf80c('0x91')][_0xf80c('0x92')](_0x2eaca3,{'transaction':_0x13fac9});});})[_0xf80c('0x1f')](function(){return db[_0xf80c('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x2bc16a['params']['id']},'order':_0xf80c('0x93')});});}})['then'](respondWithResult(_0x41f37e,null))[_0xf80c('0x29')](handleError(_0x41f37e,null));};exports[_0xf80c('0x94')]=function(_0x3b49aa,_0x1f0afc,_0x92dfd0){var _0x3c8a46={};var _0x57cbb8={};var _0x3c4e1e;var _0x379c63;return db[_0xf80c('0x40')][_0xf80c('0x62')]({'where':{'id':_0x3b49aa['params']['id']}})['then'](handleEntityNotFound(_0x1f0afc,null))[_0xf80c('0x1f')](function(_0x4981c0){if(_0x4981c0){_0x3c4e1e=_0x4981c0;_0x57cbb8['model']=_['keys'](db[_0xf80c('0x91')][_0xf80c('0x41')]);_0x57cbb8[_0xf80c('0x44')]=_[_0xf80c('0x43')](_0x3b49aa[_0xf80c('0x44')]);_0x57cbb8[_0xf80c('0x45')]=_['intersection'](_0x57cbb8[_0xf80c('0x42')],_0x57cbb8['query']);_0x3c8a46[_0xf80c('0x46')]=_['intersection'](_0x57cbb8['model'],qs['fields'](_0x3b49aa[_0xf80c('0x44')]['fields']));_0x3c8a46[_0xf80c('0x46')]=_0x3c8a46[_0xf80c('0x46')][_0xf80c('0x59')]?_0x3c8a46[_0xf80c('0x46')]:_0x57cbb8[_0xf80c('0x42')];_0x3c8a46[_0xf80c('0x67')]=qs[_0xf80c('0x4a')](_0x3b49aa[_0xf80c('0x44')][_0xf80c('0x4a')]);_0x3c8a46[_0xf80c('0x4b')]=qs[_0xf80c('0x45')](_[_0xf80c('0x4c')](_0x3b49aa[_0xf80c('0x44')],_0x57cbb8[_0xf80c('0x45')]));if(_0x3b49aa[_0xf80c('0x44')][_0xf80c('0x4d')]){_0x3c8a46['where']=_['merge'](_0x3c8a46[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0x3c8a46[_0xf80c('0x46')],function(_0x2168f8){var _0x1a9144={};_0x1a9144[_0x2168f8]={'$like':'%'+_0x3b49aa['query']['filter']+'%'};return _0x1a9144;})});}_0x3c8a46=_[_0xf80c('0x4e')]({},_0x3c8a46,_0x3b49aa[_0xf80c('0x51')]);return _0x3c4e1e['getApplications'](_0x3c8a46);}})[_0xf80c('0x1f')](function(_0x1f7b29){if(_0x1f7b29){_0x379c63=_0x1f7b29[_0xf80c('0x59')];if(!_0x3b49aa[_0xf80c('0x44')][_0xf80c('0x48')](_0xf80c('0x49'))){_0x3c8a46[_0xf80c('0x2f')]=qs[_0xf80c('0x2f')](_0x3b49aa[_0xf80c('0x44')][_0xf80c('0x2f')]);_0x3c8a46[_0xf80c('0x2e')]=qs[_0xf80c('0x2e')](_0x3b49aa['query']['offset']);}return _0x3c4e1e[_0xf80c('0x94')](_0x3c8a46);}})[_0xf80c('0x1f')](function(_0x1a9ea1){if(_0x1a9ea1){return _0x1a9ea1?{'count':_0x379c63,'rows':_0x1a9ea1}:null;}})[_0xf80c('0x1f')](respondWithResult(_0x1f0afc,null))['catch'](handleError(_0x1f0afc,null));};exports[_0xf80c('0x95')]=function(_0xc459d3,_0x393e15,_0x3929ae){var _0x451751={'raw':!![],'where':{}};var _0x4c2c03={};var _0x41f283={'count':0x0,'rows':[]};return db[_0xf80c('0x40')][_0xf80c('0x62')]({'where':{'id':_0xc459d3[_0xf80c('0x57')]['id']}})['then'](handleEntityNotFound(_0x393e15,null))[_0xf80c('0x1f')](function(_0x356dd9){if(_0x356dd9){_0x4c2c03[_0xf80c('0x42')]=_['keys'](db['MailMessage'][_0xf80c('0x41')]);_0x4c2c03['query']=_[_0xf80c('0x43')](_0xc459d3[_0xf80c('0x44')]);_0x4c2c03[_0xf80c('0x45')]=_[_0xf80c('0x47')](_0x4c2c03[_0xf80c('0x42')],_0x4c2c03[_0xf80c('0x44')]);_0x451751[_0xf80c('0x46')]=_[_0xf80c('0x47')](_0x4c2c03[_0xf80c('0x42')],qs[_0xf80c('0x58')](_0xc459d3['query'][_0xf80c('0x58')]));_0x451751[_0xf80c('0x46')]=_0x451751[_0xf80c('0x46')]['length']?_0x451751[_0xf80c('0x46')]:_0x4c2c03[_0xf80c('0x42')];if(!_0xc459d3[_0xf80c('0x44')][_0xf80c('0x48')](_0xf80c('0x49'))){_0x451751[_0xf80c('0x2f')]=qs[_0xf80c('0x2f')](_0xc459d3[_0xf80c('0x44')]['limit']);_0x451751[_0xf80c('0x2e')]=qs['offset'](_0xc459d3['query'][_0xf80c('0x2e')]);}_0x451751['order']=qs['sort'](_0xc459d3['query']['sort']);_0x451751[_0xf80c('0x4b')]=qs['filters'](_[_0xf80c('0x4c')](_0xc459d3[_0xf80c('0x44')],_0x4c2c03['filters']));_0x451751['where'][_0xf80c('0x5e')]=_0x356dd9['id'];if(_0xc459d3['query'][_0xf80c('0x4d')]){_0x451751[_0xf80c('0x4b')]=_[_0xf80c('0x4e')](_0x451751[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0x451751['attributes'],function(_0x525e69){var _0x15f3bd={};_0x15f3bd[_0x525e69]={'$like':'%'+_0xc459d3['query'][_0xf80c('0x4d')]+'%'};return _0x15f3bd;})});}if(_0xc459d3['query'][_0xf80c('0x96')]){var _0x12d11b=_0xc459d3[_0xf80c('0x44')][_0xf80c('0x96')][_0xf80c('0x97')](',');var _0x25cca0={};_0x25cca0[_0x12d11b[0x0]]={'$gte':moment(_0x12d11b[0x1])[_0xf80c('0x98')](_0xf80c('0x99'))};_0x451751[_0xf80c('0x4b')]=_[_0xf80c('0x4e')](_0x451751[_0xf80c('0x4b')],_0x25cca0);}_0x451751=_[_0xf80c('0x4e')]({},_0x451751,_0xc459d3[_0xf80c('0x51')]);return db[_0xf80c('0x9a')][_0xf80c('0x52')]({'where':_0x451751[_0xf80c('0x4b')]})[_0xf80c('0x1f')](function(_0x5e6371){_0x41f283['count']=_0x5e6371;if(_0xc459d3[_0xf80c('0x44')]['includeAll']){_0x451751[_0xf80c('0x53')]=[{'all':!![]}];}return db[_0xf80c('0x9a')]['findAll'](_0x451751);})[_0xf80c('0x1f')](function(_0x54153a){_0x41f283[_0xf80c('0x55')]=_0x54153a;return _0x41f283;});}})[_0xf80c('0x1f')](respondWithFilteredResult(_0x393e15,_0x451751))[_0xf80c('0x29')](handleError(_0x393e15,null));};exports[_0xf80c('0x9b')]=function(_0x3639b1,_0xd3d489,_0x145097){var _0x2af3dd,_0x47f70f={},_0xdea204;if(_0x3639b1[_0xf80c('0x5c')]['to']){_0xdea204=_0x3639b1[_0xf80c('0x5c')]['to']['split'](',')[0x0];}return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x3639b1[_0xf80c('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xf80c('0x9c'),'include':[{'model':db['CmContact'],'as':_0xf80c('0x9d'),'where':{'email':_0xdea204},'limit':0x1,'order':[[_0xf80c('0x9e'),_0xf80c('0x9f')]]}]},{'model':db[_0xf80c('0x3c')],'as':_0xf80c('0x3d'),'raw':!![]}]})[_0xf80c('0x1f')](handleEntityNotFound(_0xd3d489,null))['then'](function(_0x2d144d){if(_0x2d144d){_0x2af3dd=_0x2d144d;if(_0x2d144d[_0xf80c('0x3d')]){if(_[_0xf80c('0x6c')](_0x3639b1[_0xf80c('0x5c')]['from'])){_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xa0')]=util[_0xf80c('0x98')](_0xf80c('0xa1'),_0x2d144d[_0xf80c('0x38')],_0x2d144d[_0xf80c('0x6b')]||_0x2d144d['Smtp'][_0xf80c('0x78')]);}if(_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xa2')]&&_0x3639b1[_0xf80c('0x5c')]['attachments'][_0xf80c('0x59')]){for(var _0x5a1c5a=0x0;_0x5a1c5a<_0x3639b1['body']['attachments'][_0xf80c('0x59')];_0x5a1c5a+=0x1){_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xa2')][_0x5a1c5a]={'filename':_0x3639b1[_0xf80c('0x5c')]['attachments'][_0x5a1c5a][_0xf80c('0x38')],'path':path[_0xf80c('0xa3')](config[_0xf80c('0xa4')],_0xf80c('0xa5'),_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xa2')][_0x5a1c5a]['basename'])};}}var _0x252042={'tls':{'rejectUnauthorized':![]}};if(_[_0xf80c('0x6c')](_0x2d144d[_0xf80c('0x3d')][_0xf80c('0x77')])){if(_0x2d144d[_0xf80c('0x3d')]['authentication']){_0x252042[_0xf80c('0xa6')]={'user':_0x2d144d[_0xf80c('0x3d')]['user'],'pass':_0x2d144d[_0xf80c('0x3d')][_0xf80c('0x79')]};}_0x252042[_0xf80c('0x75')]=_0x2d144d[_0xf80c('0x3d')][_0xf80c('0x75')];_0x252042[_0xf80c('0x76')]=_0x2d144d['Smtp'][_0xf80c('0x76')];_0x252042[_0xf80c('0xa7')]=_0x2d144d[_0xf80c('0x3d')][_0xf80c('0xa7')];}else{_0x252042[_0xf80c('0x77')]=_0x2d144d[_0xf80c('0x3d')][_0xf80c('0x77')];_0x252042[_0xf80c('0xa6')]={'user':_0x2d144d[_0xf80c('0x3d')]['user'],'pass':_0x2d144d[_0xf80c('0x3d')][_0xf80c('0x79')]};}return respondWithRpcPromise(_0xf80c('0xa8'),_0xf80c('0xa9'),{'account':_0x252042,'message':_0x3639b1[_0xf80c('0x5c')]});}else{throw new Error(_0xf80c('0xaa'));}}})[_0xf80c('0x1f')](function(_0x393ee6){if(_0x393ee6){_0x47f70f=_0x393ee6;if(_0x2af3dd[_0xf80c('0x9c')]){if(_0x2af3dd[_0xf80c('0x9c')]['Contacts'][_0xf80c('0x59')]){return _0x2af3dd[_0xf80c('0x9c')][_0xf80c('0x9d')][0x0];}else{return db[_0xf80c('0x87')]['create'](_[_0xf80c('0x17')](_0x3639b1[_0xf80c('0x5c')],{'firstName':_0x3639b1[_0xf80c('0x5c')]['to'],'email':_0x3639b1[_0xf80c('0x5c')]['to'],'phone':_0x3639b1['body']['to'],'ListId':_0x2af3dd['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0xf80c('0x1f')](function(_0x545443){if(_0x545443){var _0x5b1cde={'UserId':_0x3639b1[_0xf80c('0x78')]['id'],'ContactId':_0x545443['id'],'MailAccountId':_0x2af3dd['id'],'inReplyTo':_0x47f70f['messageId'],'to':_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xa0')],'cc':_0x3639b1[_0xf80c('0x5c')]['cc'],'subject':_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xab')],'attach':_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xac')],'firstMsgDirection':_0xf80c('0xad'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xf80c('0xad'),'lastMsgBody':_0x3639b1[_0xf80c('0x5c')][_0xf80c('0x5c')],'Messages':[_[_0xf80c('0x4e')](_0x3639b1[_0xf80c('0x5c')],{'messageId':_0x47f70f[_0xf80c('0xae')],'sentAt':moment()[_0xf80c('0x98')](_0xf80c('0x99')),'read':!![],'MailAccountId':_0x2af3dd['id'],'UserId':_0x3639b1[_0xf80c('0x78')]['id'],'ContactId':_0x545443['id']})]};if(_0x3639b1[_0xf80c('0x5c')][_0xf80c('0xaf')]){_0x5b1cde=_[_0xf80c('0x4e')](_0x5b1cde,_0x3639b1[_0xf80c('0x5c')]['Interaction']);}return db[_0xf80c('0x86')][_0xf80c('0x60')](_0x5b1cde,{'include':[{'model':db[_0xf80c('0x9a')],'as':'Messages'}]});}})[_0xf80c('0x1f')](respondWithResult(_0xd3d489,null))[_0xf80c('0x29')](handleError(_0xd3d489,null));};exports[_0xf80c('0xb0')]=function(_0x4cb040,_0x2e59fe,_0x23ea21){return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x4cb040[_0xf80c('0x57')]['id']},'include':[{'model':db[_0xf80c('0x3c')],'as':_0xf80c('0x3d'),'raw':!![]}]})[_0xf80c('0x1f')](handleEntityNotFound(_0x2e59fe,null))['then'](function(_0x15d0dc){if(_0x15d0dc&&_0x15d0dc[_0xf80c('0x3d')]){var _0x2e188a={'id':_0x15d0dc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x15d0dc[_0xf80c('0x3d')][_0xf80c('0x77')]){_0x2e188a['service']=_0x15d0dc[_0xf80c('0x3d')][_0xf80c('0x77')];}else{_0x2e188a[_0xf80c('0x75')]=_0x15d0dc['Smtp'][_0xf80c('0x75')];_0x2e188a[_0xf80c('0x76')]=_0x15d0dc[_0xf80c('0x3d')]['port'];_0x2e188a[_0xf80c('0xa7')]=_0x15d0dc['Smtp']['secure'];}if(_0x15d0dc[_0xf80c('0x3d')][_0xf80c('0x74')]){_0x2e188a[_0xf80c('0xa6')]={'user':_0x15d0dc[_0xf80c('0x3d')][_0xf80c('0x78')],'pass':_0x15d0dc[_0xf80c('0x3d')][_0xf80c('0x79')]};}return respondWithRpcPromise(_0xf80c('0xb1'),'verifySmtp',{'account':_0x2e188a});}})[_0xf80c('0x1f')](respondWithResult(_0x2e59fe,null))[_0xf80c('0x29')](handleError(_0x2e59fe,null));};exports[_0xf80c('0x35')]=function(_0x1fa50c,_0x149b56){return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x1fa50c[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x149b56,null))[_0xf80c('0x1f')](function(_0x566e02){if(_0x566e02&&_0x566e02['service']){throw new db[(_0xf80c('0xb2'))][(_0xf80c('0xb3'))](_0xf80c('0xb4'));}return _0x566e02;})['then'](removeEntity(_0x149b56,null))[_0xf80c('0x29')](handleError(_0x149b56,null));};exports[_0xf80c('0xb5')]=function(_0x578e4c,_0xd85e0,_0x527c12){return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x578e4c['params']['id']}})['then'](handleEntityNotFound(_0xd85e0,null))[_0xf80c('0x1f')](function(_0x49aa6f){if(_0x49aa6f){return _0x49aa6f[_0xf80c('0xb5')](_0x578e4c[_0xf80c('0x5c')][_0xf80c('0x64')],_[_0xf80c('0xb6')](_0x578e4c['body'],[_0xf80c('0x64'),'id'])||{})[_0xf80c('0xb7')](function(_0x4ea45f){for(var _0x116f41=0x0;_0x116f41<_0x578e4c[_0xf80c('0x5c')][_0xf80c('0x64')][_0xf80c('0x59')];_0x116f41+=0x1){socket['emit'](_0xf80c('0xb8'),{'UserId':_0x578e4c['body'][_0xf80c('0x64')][_0x116f41],'MailAccountId':_0x578e4c['params']['id']});}return _0x4ea45f;});}})['then'](respondWithResult(_0xd85e0,null))[_0xf80c('0x29')](handleError(_0xd85e0,null));};exports[_0xf80c('0xb9')]=function(_0x46d95d,_0x3f89f8,_0x2abb6a){return db[_0xf80c('0x40')][_0xf80c('0x5a')]({'where':{'id':_0x46d95d[_0xf80c('0x57')]['id']}})['then'](handleEntityNotFound(_0x3f89f8,null))[_0xf80c('0x1f')](function(_0x54b0cb){if(_0x54b0cb){return _0x54b0cb[_0xf80c('0xb9')](_0x46d95d['query'][_0xf80c('0x64')])[_0xf80c('0x1f')](function(){if(_[_0xf80c('0xba')](_0x46d95d['query'][_0xf80c('0x64')])){for(var _0x53434e=0x0;_0x53434e<_0x46d95d[_0xf80c('0x44')][_0xf80c('0x64')]['length'];_0x53434e+=0x1){socket[_0xf80c('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x46d95d[_0xf80c('0x44')][_0xf80c('0x64')][_0x53434e]),'MailAccountId':Number(_0x46d95d['params']['id'])});}}else{socket['emit'](_0xf80c('0xbc'),{'UserId':Number(_0x46d95d['query'][_0xf80c('0x64')]),'MailAccountId':Number(_0x46d95d[_0xf80c('0x57')]['id'])});}});}})[_0xf80c('0x1f')](respondWithStatusCode(_0x3f89f8,null))[_0xf80c('0x29')](handleError(_0x3f89f8,null));};exports[_0xf80c('0xbd')]=function(_0x2f8f3e,_0x5ed07f,_0x231d34){var _0x45c970={};var _0x55b695={};var _0x31136f;var _0x4015b9;return db[_0xf80c('0x40')]['findOne']({'where':{'id':_0x2f8f3e[_0xf80c('0x57')]['id']}})[_0xf80c('0x1f')](handleEntityNotFound(_0x5ed07f,null))[_0xf80c('0x1f')](function(_0x1bd4dd){if(_0x1bd4dd){_0x31136f=_0x1bd4dd;_0x55b695[_0xf80c('0x42')]=_[_0xf80c('0x43')](db[_0xf80c('0x89')][_0xf80c('0x41')]);_0x55b695['query']=_[_0xf80c('0x43')](_0x2f8f3e['query']);_0x55b695[_0xf80c('0x45')]=_['intersection'](_0x55b695['model'],_0x55b695['query']);_0x45c970['attributes']=_[_0xf80c('0x47')](_0x55b695['model'],qs['fields'](_0x2f8f3e[_0xf80c('0x44')][_0xf80c('0x58')]));_0x45c970['attributes']=_0x45c970[_0xf80c('0x46')][_0xf80c('0x59')]?_0x45c970[_0xf80c('0x46')]:_0x55b695['model'];_0x45c970[_0xf80c('0x67')]=qs[_0xf80c('0x4a')](_0x2f8f3e[_0xf80c('0x44')][_0xf80c('0x4a')]);_0x45c970[_0xf80c('0x4b')]=qs[_0xf80c('0x45')](_[_0xf80c('0x4c')](_0x2f8f3e[_0xf80c('0x44')],_0x55b695['filters']));if(_0x2f8f3e['query'][_0xf80c('0x4d')]){_0x45c970[_0xf80c('0x4b')]=_[_0xf80c('0x4e')](_0x45c970[_0xf80c('0x4b')],{'$or':_[_0xf80c('0x4f')](_0x45c970[_0xf80c('0x46')],function(_0x1c2c30){var _0x5c7a41={};_0x5c7a41[_0x1c2c30]={'$like':'%'+_0x2f8f3e[_0xf80c('0x44')][_0xf80c('0x4d')]+'%'};return _0x5c7a41;})});}_0x45c970=_['merge']({},_0x45c970,_0x2f8f3e[_0xf80c('0x51')]);return _0x31136f[_0xf80c('0xbd')](_0x45c970);}})['then'](function(_0x13529f){if(_0x13529f){_0x4015b9=_0x13529f[_0xf80c('0x59')];if(!_0x2f8f3e[_0xf80c('0x44')][_0xf80c('0x48')](_0xf80c('0x49'))){_0x45c970[_0xf80c('0x2f')]=qs[_0xf80c('0x2f')](_0x2f8f3e['query'][_0xf80c('0x2f')]);_0x45c970[_0xf80c('0x2e')]=qs[_0xf80c('0x2e')](_0x2f8f3e[_0xf80c('0x44')][_0xf80c('0x2e')]);}return _0x31136f[_0xf80c('0xbd')](_0x45c970);}})[_0xf80c('0x1f')](function(_0xa43040){if(_0xa43040){return _0xa43040?{'count':_0x4015b9,'rows':_0xa43040}:null;}})['then'](respondWithResult(_0x5ed07f,null))['catch'](handleError(_0x5ed07f,null));}; \ No newline at end of file +var _0x3cbf=['where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','show','params','Imap','rawAttributes','find','body','Disposition','create','getDispositions','findOne','hasOwnProperty','MailAccountId','removeDispositions','ids','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cbf,0x1ee));var _0xf3cb=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x3cbf[_0x295a3d];return _0x23a732;};'use strict';var pdf=require(_0xf3cb('0x0'));var emlformat=require(_0xf3cb('0x1'));var rimraf=require(_0xf3cb('0x2'));var zipdir=require(_0xf3cb('0x3'));var jsonpatch=require(_0xf3cb('0x4'));var rp=require(_0xf3cb('0x5'));var moment=require(_0xf3cb('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf3cb('0x7'));var util=require('util');var path=require(_0xf3cb('0x8'));var sox=require(_0xf3cb('0x9'));var csv=require(_0xf3cb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf3cb('0xb'));var crypto=require('crypto');var jsforce=require(_0xf3cb('0xc'));var deskjs=require(_0xf3cb('0xd'));var toCsv=require(_0xf3cb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf3cb('0xe'));var authService=require(_0xf3cb('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3cb('0x10'))(_0xf3cb('0x11'));var utils=require(_0xf3cb('0x12'));var config=require(_0xf3cb('0x13'));var db=require(_0xf3cb('0x14'))['db'];config[_0xf3cb('0x15')]=_[_0xf3cb('0x16')](config['redis'],{'host':_0xf3cb('0x17'),'port':0x18eb});var socket=require(_0xf3cb('0x18'))(new Redis(config[_0xf3cb('0x15')]));require('./mailAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf3cb('0x19')][_0xf3cb('0x1a')]({'port':0x232b});function checkPasswordPattern(_0x506b12,_0x297dc0,_0x196e0b){if(_0x196e0b){var _0xef88e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xef88e7[_0xf3cb('0x1b')](_0x297dc0)){return _0x506b12;}else{throw new Error(_0xf3cb('0x1c'));}}else{return _0x506b12;}}function respondWithRpcPromise(_0x3a1389,_0x5da239,_0x13bdd5,_0x48b167){return new BPromise(function(_0x174f0f,_0x11326f){var _0xed4e59=_0x48b167||client;return _0xed4e59[_0xf3cb('0x1d')](_0x3a1389,_0x13bdd5)[_0xf3cb('0x1e')](function(_0x140f5b){logger[_0xf3cb('0x1f')]('MailAccount,\x20%s,\x20%s',_0x5da239,_0xf3cb('0x20'));logger[_0xf3cb('0x21')](_0xf3cb('0x22'),_0x5da239,'request\x20sent',JSON['stringify'](_0x140f5b));if(_0x140f5b[_0xf3cb('0x23')]){if(_0x140f5b['error'][_0xf3cb('0x24')]===0x1f4){logger[_0xf3cb('0x23')](_0xf3cb('0x25'),_0x5da239,_0x140f5b['error'][_0xf3cb('0x26')]);return _0x11326f(_0x140f5b[_0xf3cb('0x23')]['message']);}logger[_0xf3cb('0x23')](_0xf3cb('0x25'),_0x5da239,_0x140f5b['error'][_0xf3cb('0x26')]);return _0x174f0f(_0x140f5b[_0xf3cb('0x23')][_0xf3cb('0x26')]);}else{logger[_0xf3cb('0x1f')]('MailAccount,\x20%s,\x20%s',_0x5da239,'request\x20sent');_0x174f0f(_0x140f5b[_0xf3cb('0x27')]['message']);}})[_0xf3cb('0x28')](function(_0x169c8a){logger[_0xf3cb('0x23')](_0xf3cb('0x25'),_0x5da239,_0x169c8a);_0x11326f(_0x169c8a);});});}function respondWithStatusCode(_0x24d458,_0x286972){_0x286972=_0x286972||0xcc;return function(_0x45f6e4){if(_0x45f6e4){return _0x24d458[_0xf3cb('0x29')](_0x286972);}return _0x24d458[_0xf3cb('0x2a')](_0x286972)[_0xf3cb('0x2b')]();};}function respondWithResult(_0x40b6a9,_0xcd22c9){_0xcd22c9=_0xcd22c9||0xc8;return function(_0x225725){if(_0x225725){return _0x40b6a9[_0xf3cb('0x2a')](_0xcd22c9)[_0xf3cb('0x2c')](_0x225725);}};}function respondWithFilteredResult(_0x430172,_0x1691de){return function(_0x316fba){if(_0x316fba){var _0x1edc62=_0x316fba['count'],_0x1b28d5=_0x1691de[_0xf3cb('0x2d')],_0x163f60=_0x1691de[_0xf3cb('0x2d')]+_0x1691de[_0xf3cb('0x2e')],_0x1590ef;if(_0x163f60>=_0x1edc62){_0x163f60=_0x1edc62;_0x1590ef=0xc8;}else{_0x1590ef=0xce;}_0x430172[_0xf3cb('0x2a')](_0x1590ef);return _0x430172['set'](_0xf3cb('0x2f'),_0x1b28d5+'-'+_0x163f60+'/'+_0x1edc62)[_0xf3cb('0x2c')](_0x316fba);}return null;};}function patchUpdates(_0xdada5b){return function(_0x300809){try{jsonpatch[_0xf3cb('0x30')](_0x300809,_0xdada5b,!![]);}catch(_0x51935d){return BPromise[_0xf3cb('0x31')](_0x51935d);}return _0x300809[_0xf3cb('0x32')]();};}function saveUpdates(_0x437cb4,_0x462582){return function(_0x320554){if(_0x320554){return _0x320554[_0xf3cb('0x33')](_0x437cb4)[_0xf3cb('0x1e')](function(_0x2df4cc){return _0x2df4cc;});}return null;};}function removeEntity(_0x3bf876,_0x4963d4){return function(_0x328b0a){if(_0x328b0a){return _0x328b0a[_0xf3cb('0x34')]()[_0xf3cb('0x1e')](function(){var _0x55ffd1=_0x328b0a[_0xf3cb('0x35')]({'plain':!![]});var _0x31868d='MailAccounts';return db[_0xf3cb('0x36')]['destroy']({'where':{'type':_0x31868d,'resourceId':_0x55ffd1['id']}})[_0xf3cb('0x1e')](function(){return _0x328b0a;});})['then'](function(){_0x3bf876[_0xf3cb('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40ed07,_0x257a52){return function(_0x5a4c36){if(!_0x5a4c36){_0x40ed07[_0xf3cb('0x29')](0x194);}return _0x5a4c36;};}function handleError(_0x36d116,_0x1ac020){_0x1ac020=_0x1ac020||0x1f4;return function(_0xc6a8df){logger['error'](_0xc6a8df[_0xf3cb('0x37')]);if(_0xc6a8df[_0xf3cb('0x38')]){delete _0xc6a8df[_0xf3cb('0x38')];}_0x36d116[_0xf3cb('0x2a')](_0x1ac020)[_0xf3cb('0x39')](_0xc6a8df);};}exports[_0xf3cb('0x3a')]=function(_0x4ccac1,_0x5efddb){var _0x19ac25={'include':[{'model':db[_0xf3cb('0x3b')],'as':'Imap'},{'model':db[_0xf3cb('0x3c')],'as':_0xf3cb('0x3d')},{'model':db[_0xf3cb('0x3e')],'as':_0xf3cb('0x3f')}]},_0x142899={},_0x1d0348={'count':0x0,'rows':[]};var _0xf829c3=db[_0xf3cb('0x40')]['rawAttributes'];_0x142899['model']=_[_0xf3cb('0x41')](_0xf829c3);_0x142899[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x4ccac1[_0xf3cb('0x42')]);_0x142899[_0xf3cb('0x43')]=_[_0xf3cb('0x44')](_0x142899[_0xf3cb('0x45')],_0x142899[_0xf3cb('0x42')]);_0x19ac25[_0xf3cb('0x46')]=_[_0xf3cb('0x44')](_0x142899[_0xf3cb('0x45')],qs['fields'](_0x4ccac1['query'][_0xf3cb('0x47')]));_0x19ac25[_0xf3cb('0x46')]=_0x19ac25[_0xf3cb('0x46')][_0xf3cb('0x48')]?_0x19ac25[_0xf3cb('0x46')]:_0x142899[_0xf3cb('0x45')];if(!_0x4ccac1[_0xf3cb('0x42')]['hasOwnProperty'](_0xf3cb('0x49'))){_0x19ac25[_0xf3cb('0x2e')]=qs[_0xf3cb('0x2e')](_0x4ccac1['query']['limit']);_0x19ac25[_0xf3cb('0x2d')]=qs[_0xf3cb('0x2d')](_0x4ccac1['query'][_0xf3cb('0x2d')]);}_0x19ac25[_0xf3cb('0x4a')]=qs[_0xf3cb('0x4b')](_0x4ccac1[_0xf3cb('0x42')][_0xf3cb('0x4b')]);_0x19ac25[_0xf3cb('0x4c')]=qs[_0xf3cb('0x43')](_[_0xf3cb('0x4d')](_0x4ccac1[_0xf3cb('0x42')],_0x142899[_0xf3cb('0x43')]));if(_0x4ccac1[_0xf3cb('0x42')][_0xf3cb('0x4e')]){_0x19ac25['where']=_[_0xf3cb('0x4f')](_0x19ac25[_0xf3cb('0x4c')],{'$or':_[_0xf3cb('0x50')](_0xf829c3,function(_0x1305c2){if(_0x1305c2[_0xf3cb('0x51')][_0xf3cb('0x52')]!==_0xf3cb('0x53')){var _0x2862c5={};_0x2862c5[_0x1305c2[_0xf3cb('0x54')]]={'$like':'%'+_0x4ccac1[_0xf3cb('0x42')]['filter']+'%'};return _0x2862c5;}})});}_0x19ac25=_[_0xf3cb('0x4f')]({},_0x19ac25,_0x4ccac1[_0xf3cb('0x55')]);var _0x1dd4e9={'where':_0x19ac25[_0xf3cb('0x4c')]};return db['MailAccount'][_0xf3cb('0x56')](_0x1dd4e9)['then'](function(_0x456a35){_0x1d0348[_0xf3cb('0x56')]=_0x456a35;if(_0x4ccac1['query'][_0xf3cb('0x57')]){_0x19ac25[_0xf3cb('0x58')]=[{'all':!![]}];}return db[_0xf3cb('0x40')][_0xf3cb('0x59')](_0x19ac25);})['then'](function(_0x324c7c){_0x1d0348[_0xf3cb('0x5a')]=_0x324c7c;return _0x1d0348;})[_0xf3cb('0x1e')](respondWithFilteredResult(_0x5efddb,_0x19ac25))['catch'](handleError(_0x5efddb,null));};exports[_0xf3cb('0x5b')]=function(_0x47f871,_0x370c39){var _0x3df681={'raw':![],'where':{'id':_0x47f871[_0xf3cb('0x5c')]['id']},'include':[{'model':db[_0xf3cb('0x3b')],'as':_0xf3cb('0x5d')},{'model':db[_0xf3cb('0x3c')],'as':_0xf3cb('0x3d')},{'model':db[_0xf3cb('0x3e')],'as':_0xf3cb('0x3f')}]},_0x4ae570={};_0x4ae570[_0xf3cb('0x45')]=_['keys'](db[_0xf3cb('0x40')][_0xf3cb('0x5e')]);_0x4ae570[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x47f871['query']);_0x4ae570[_0xf3cb('0x43')]=_['intersection'](_0x4ae570[_0xf3cb('0x45')],_0x4ae570[_0xf3cb('0x42')]);_0x3df681[_0xf3cb('0x46')]=_[_0xf3cb('0x44')](_0x4ae570[_0xf3cb('0x45')],qs[_0xf3cb('0x47')](_0x47f871['query'][_0xf3cb('0x47')]));_0x3df681[_0xf3cb('0x46')]=_0x3df681[_0xf3cb('0x46')][_0xf3cb('0x48')]?_0x3df681[_0xf3cb('0x46')]:_0x4ae570['model'];if(_0x47f871[_0xf3cb('0x42')][_0xf3cb('0x57')]){_0x3df681[_0xf3cb('0x58')]=[{'all':!![]}];}_0x3df681=_[_0xf3cb('0x4f')]({},_0x3df681,_0x47f871['options']);return db[_0xf3cb('0x40')][_0xf3cb('0x5f')](_0x3df681)[_0xf3cb('0x1e')](handleEntityNotFound(_0x370c39,null))['then'](respondWithResult(_0x370c39,null))[_0xf3cb('0x28')](handleError(_0x370c39,null));};exports[_0xf3cb('0x33')]=function(_0x4a8a96,_0x5738df){if(_0x4a8a96['body']['id']){delete _0x4a8a96[_0xf3cb('0x60')]['id'];}return db['MailAccount'][_0xf3cb('0x5f')]({'where':{'id':_0x4a8a96[_0xf3cb('0x5c')]['id']},'include':[{'model':db[_0xf3cb('0x3b')],'as':_0xf3cb('0x5d')},{'model':db[_0xf3cb('0x3c')],'as':_0xf3cb('0x3d')},{'model':db[_0xf3cb('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xf3cb('0x1e')](handleEntityNotFound(_0x5738df,null))[_0xf3cb('0x1e')](saveUpdates(_0x4a8a96[_0xf3cb('0x60')],null))['then'](function(_0x11d463){if(_0x11d463&&_0x4a8a96['body']['Imap']){return db['MailServerIn'][_0xf3cb('0x33')](_0x4a8a96[_0xf3cb('0x60')][_0xf3cb('0x5d')],{'where':{'MailAccountId':_0x11d463['id']}})[_0xf3cb('0x1e')](function(){return _0x11d463;});}return _0x11d463;})[_0xf3cb('0x1e')](function(_0x5e4e07){if(_0x5e4e07&&_0x4a8a96['body'][_0xf3cb('0x3d')]){return db[_0xf3cb('0x3c')][_0xf3cb('0x33')](_0x4a8a96['body']['Smtp'],{'where':{'MailAccountId':_0x5e4e07['id']}})[_0xf3cb('0x1e')](function(){return _0x5e4e07;});}return _0x5e4e07;})['then'](respondWithResult(_0x5738df,null))['catch'](handleError(_0x5738df,null));};exports['describe']=function(_0x17ba8b,_0x34214c){return db[_0xf3cb('0x40')]['describe']()[_0xf3cb('0x1e')](respondWithResult(_0x34214c,null))['catch'](handleError(_0x34214c,null));};exports['addDisposition']=function(_0x3db738,_0x140a1b,_0xea97ef){if(_0x3db738['body']['id']){delete _0x3db738['body']['id'];}return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x3db738[_0xf3cb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x140a1b,null))[_0xf3cb('0x1e')](function(_0x26f4e4){if(_0x26f4e4){_0x3db738[_0xf3cb('0x60')]['MailAccountId']=_0x26f4e4['id'];return db[_0xf3cb('0x61')][_0xf3cb('0x62')](_0x3db738[_0xf3cb('0x60')]);}})['then'](respondWithResult(_0x140a1b,null))[_0xf3cb('0x28')](handleError(_0x140a1b,null));};exports[_0xf3cb('0x63')]=function(_0x3f6408,_0x140dec,_0xb3e02){var _0x44049a={'raw':![],'where':{}};var _0x4702ac={};var _0x228525={'count':0x0,'rows':[]};return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x3f6408[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x140dec,null))[_0xf3cb('0x1e')](function(_0xf86134){if(_0xf86134){_0x4702ac[_0xf3cb('0x45')]=_[_0xf3cb('0x41')](db[_0xf3cb('0x61')][_0xf3cb('0x5e')]);_0x4702ac[_0xf3cb('0x42')]=_['keys'](_0x3f6408[_0xf3cb('0x42')]);_0x4702ac[_0xf3cb('0x43')]=_['intersection'](_0x4702ac[_0xf3cb('0x45')],_0x4702ac[_0xf3cb('0x42')]);_0x44049a['attributes']=_[_0xf3cb('0x44')](_0x4702ac[_0xf3cb('0x45')],qs[_0xf3cb('0x47')](_0x3f6408[_0xf3cb('0x42')]['fields']));_0x44049a[_0xf3cb('0x46')]=_0x44049a['attributes'][_0xf3cb('0x48')]?_0x44049a['attributes']:_0x4702ac[_0xf3cb('0x45')];if(!_0x3f6408[_0xf3cb('0x42')][_0xf3cb('0x65')]('nolimit')){_0x44049a[_0xf3cb('0x2e')]=qs[_0xf3cb('0x2e')](_0x3f6408[_0xf3cb('0x42')][_0xf3cb('0x2e')]);_0x44049a[_0xf3cb('0x2d')]=qs[_0xf3cb('0x2d')](_0x3f6408[_0xf3cb('0x42')][_0xf3cb('0x2d')]);}_0x44049a[_0xf3cb('0x4a')]=qs[_0xf3cb('0x4b')](_0x3f6408['query']['sort']);_0x44049a[_0xf3cb('0x4c')]=qs[_0xf3cb('0x43')](_[_0xf3cb('0x4d')](_0x3f6408[_0xf3cb('0x42')],_0x4702ac['filters']));_0x44049a[_0xf3cb('0x4c')][_0xf3cb('0x66')]=_0xf86134['id'];if(_0x3f6408['query'][_0xf3cb('0x4e')]){_0x44049a['where']=_[_0xf3cb('0x4f')](_0x44049a['where'],{'$or':_[_0xf3cb('0x50')](_0x44049a[_0xf3cb('0x46')],function(_0x10392a){var _0x4fcdfa={};_0x4fcdfa[_0x10392a]={'$like':'%'+_0x3f6408[_0xf3cb('0x42')][_0xf3cb('0x4e')]+'%'};return _0x4fcdfa;})});}_0x44049a=_[_0xf3cb('0x4f')]({},_0x44049a,_0x3f6408[_0xf3cb('0x55')]);return db['Disposition'][_0xf3cb('0x56')]({'where':_0x44049a[_0xf3cb('0x4c')]})[_0xf3cb('0x1e')](function(_0x51191b){_0x228525[_0xf3cb('0x56')]=_0x51191b;if(_0x3f6408['query']['includeAll']){_0x44049a[_0xf3cb('0x58')]=[{'all':!![]}];}return db[_0xf3cb('0x61')][_0xf3cb('0x59')](_0x44049a);})['then'](function(_0x242a0b){_0x228525['rows']=_0x242a0b;return _0x228525;});}})[_0xf3cb('0x1e')](respondWithFilteredResult(_0x140dec,_0x44049a))[_0xf3cb('0x28')](handleError(_0x140dec,null));};exports[_0xf3cb('0x67')]=function(_0x1b7c28,_0x33bd5a,_0x2e325f){return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x1b7c28['params']['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x33bd5a,null))[_0xf3cb('0x1e')](function(_0x3fda24){if(_0x3fda24){return _0x3fda24['removeDispositions'](_0x1b7c28[_0xf3cb('0x42')][_0xf3cb('0x68')]);}})[_0xf3cb('0x1e')](respondWithStatusCode(_0x33bd5a,null))['catch'](handleError(_0x33bd5a,null));};exports['addAnswer']=function(_0x4b2a11,_0x1fb492,_0x8cb812){if(_0x4b2a11[_0xf3cb('0x60')]['id']){delete _0x4b2a11[_0xf3cb('0x60')]['id'];}return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x4b2a11[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x1fb492,null))[_0xf3cb('0x1e')](function(_0x30a5ff){if(_0x30a5ff){_0x4b2a11[_0xf3cb('0x60')][_0xf3cb('0x66')]=_0x30a5ff['id'];return db[_0xf3cb('0x69')][_0xf3cb('0x62')](_0x4b2a11[_0xf3cb('0x60')]);}})[_0xf3cb('0x1e')](respondWithResult(_0x1fb492,null))['catch'](handleError(_0x1fb492,null));};exports['getAnswers']=function(_0x233542,_0x12f98a,_0xf9e5a8){var _0x1e0a1e={'raw':![],'where':{}};var _0x1d8e18={};var _0x20e5ea={'count':0x0,'rows':[]};return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x233542[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x12f98a,null))[_0xf3cb('0x1e')](function(_0x266050){if(_0x266050){_0x1d8e18[_0xf3cb('0x45')]=_[_0xf3cb('0x41')](db[_0xf3cb('0x69')][_0xf3cb('0x5e')]);_0x1d8e18[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x233542['query']);_0x1d8e18[_0xf3cb('0x43')]=_[_0xf3cb('0x44')](_0x1d8e18['model'],_0x1d8e18[_0xf3cb('0x42')]);_0x1e0a1e[_0xf3cb('0x46')]=_[_0xf3cb('0x44')](_0x1d8e18[_0xf3cb('0x45')],qs['fields'](_0x233542[_0xf3cb('0x42')][_0xf3cb('0x47')]));_0x1e0a1e[_0xf3cb('0x46')]=_0x1e0a1e[_0xf3cb('0x46')][_0xf3cb('0x48')]?_0x1e0a1e[_0xf3cb('0x46')]:_0x1d8e18['model'];if(!_0x233542[_0xf3cb('0x42')][_0xf3cb('0x65')]('nolimit')){_0x1e0a1e['limit']=qs[_0xf3cb('0x2e')](_0x233542[_0xf3cb('0x42')]['limit']);_0x1e0a1e[_0xf3cb('0x2d')]=qs['offset'](_0x233542['query'][_0xf3cb('0x2d')]);}_0x1e0a1e['order']=qs[_0xf3cb('0x4b')](_0x233542[_0xf3cb('0x42')][_0xf3cb('0x4b')]);_0x1e0a1e[_0xf3cb('0x4c')]=qs[_0xf3cb('0x43')](_[_0xf3cb('0x4d')](_0x233542[_0xf3cb('0x42')],_0x1d8e18[_0xf3cb('0x43')]));_0x1e0a1e[_0xf3cb('0x4c')][_0xf3cb('0x66')]=_0x266050['id'];if(_0x233542[_0xf3cb('0x42')][_0xf3cb('0x4e')]){_0x1e0a1e[_0xf3cb('0x4c')]=_[_0xf3cb('0x4f')](_0x1e0a1e[_0xf3cb('0x4c')],{'$or':_['map'](_0x1e0a1e[_0xf3cb('0x46')],function(_0xee670b){var _0x1665f6={};_0x1665f6[_0xee670b]={'$like':'%'+_0x233542[_0xf3cb('0x42')]['filter']+'%'};return _0x1665f6;})});}_0x1e0a1e=_[_0xf3cb('0x4f')]({},_0x1e0a1e,_0x233542[_0xf3cb('0x55')]);return db[_0xf3cb('0x69')][_0xf3cb('0x56')]({'where':_0x1e0a1e[_0xf3cb('0x4c')]})[_0xf3cb('0x1e')](function(_0x4fe12f){_0x20e5ea['count']=_0x4fe12f;if(_0x233542[_0xf3cb('0x42')][_0xf3cb('0x57')]){_0x1e0a1e[_0xf3cb('0x58')]=[{'all':!![]}];}return db[_0xf3cb('0x69')][_0xf3cb('0x59')](_0x1e0a1e);})[_0xf3cb('0x1e')](function(_0x521f3c){_0x20e5ea[_0xf3cb('0x5a')]=_0x521f3c;return _0x20e5ea;});}})[_0xf3cb('0x1e')](respondWithFilteredResult(_0x12f98a,_0x1e0a1e))[_0xf3cb('0x28')](handleError(_0x12f98a,null));};exports[_0xf3cb('0x6a')]=function(_0x19583f,_0x1136c2,_0x229563){return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x19583f['params']['id']}})['then'](handleEntityNotFound(_0x1136c2,null))[_0xf3cb('0x1e')](function(_0x3ad80d){if(_0x3ad80d){return _0x3ad80d[_0xf3cb('0x6a')](_0x19583f[_0xf3cb('0x42')][_0xf3cb('0x68')]);}})['then'](respondWithStatusCode(_0x1136c2,null))[_0xf3cb('0x28')](handleError(_0x1136c2,null));};exports[_0xf3cb('0x62')]=function(_0x5802f9,_0x39568a){var _0x493ddb={'name':_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x38')],'key':_0x5802f9[_0xf3cb('0x60')]['key'],'email':_0x5802f9['body'][_0xf3cb('0x6b')],'ListId':_0x5802f9['body'][_0xf3cb('0x6c')],'active':!_[_0xf3cb('0x6d')](_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x6e')])?_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x6e')]:!![],'description':_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0xf3cb('0x6d')](_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x70')])){if(_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x71')]){_0x493ddb[_0xf3cb('0x5d')]['user']=_0x493ddb[_0xf3cb('0x3d')][_0xf3cb('0x72')]=_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x73')];_0x493ddb[_0xf3cb('0x5d')][_0xf3cb('0x74')]=_0x493ddb[_0xf3cb('0x3d')][_0xf3cb('0x75')]=_0x5802f9[_0xf3cb('0x60')]['cpassword'];}else{_0x493ddb[_0xf3cb('0x5d')][_0xf3cb('0x76')]=_0x493ddb[_0xf3cb('0x3d')]['authentication']=![];}_0x493ddb[_0xf3cb('0x5d')][_0xf3cb('0x77')]=_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x5d')]['host'];_0x493ddb[_0xf3cb('0x5d')][_0xf3cb('0x78')]=_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x5d')][_0xf3cb('0x78')];_0x493ddb[_0xf3cb('0x3d')][_0xf3cb('0x77')]=_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x3d')][_0xf3cb('0x77')];_0x493ddb[_0xf3cb('0x3d')][_0xf3cb('0x78')]=_0x5802f9['body'][_0xf3cb('0x3d')][_0xf3cb('0x78')];}else{_0x493ddb['Imap'][_0xf3cb('0x79')]=_0x493ddb[_0xf3cb('0x3d')][_0xf3cb('0x79')]=_0x5802f9[_0xf3cb('0x60')]['cservice'];_0x493ddb[_0xf3cb('0x5d')][_0xf3cb('0x72')]=_0x493ddb[_0xf3cb('0x3d')][_0xf3cb('0x72')]=_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x73')];_0x493ddb['Imap']['password']=_0x493ddb[_0xf3cb('0x3d')]['pass']=_0x5802f9[_0xf3cb('0x60')][_0xf3cb('0x7a')];}return db[_0xf3cb('0x40')][_0xf3cb('0x62')](_0x493ddb,{'include':[{'model':db[_0xf3cb('0x3c')],'as':_0xf3cb('0x3d')},{'model':db[_0xf3cb('0x3b')],'as':'Imap'}]})[_0xf3cb('0x1e')](function(_0x153ab0){var _0x49feff=_0x5802f9[_0xf3cb('0x72')][_0xf3cb('0x35')]({'plain':!![]});if(!_0x49feff)throw new Error(_0xf3cb('0x7b'));if(_0x49feff[_0xf3cb('0x7c')]===_0xf3cb('0x72')){var _0x553d68=_0x153ab0[_0xf3cb('0x35')]({'plain':!![]});return db['UserProfileSection'][_0xf3cb('0x5f')]({'where':{'name':'MailAccounts','userProfileId':_0x49feff[_0xf3cb('0x7d')]},'raw':!![]})['then'](function(_0x4fef79){if(_0x4fef79&&_0x4fef79['autoAssociation']===0x0){return db[_0xf3cb('0x36')]['create']({'name':_0x553d68[_0xf3cb('0x38')],'resourceId':_0x553d68['id'],'type':_0x4fef79[_0xf3cb('0x38')],'sectionId':_0x4fef79['id']},{})[_0xf3cb('0x1e')](function(){return _0x153ab0;});}else{return _0x153ab0;}})[_0xf3cb('0x28')](function(_0x460666){logger[_0xf3cb('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x460666);throw _0x460666;});}return _0x153ab0;})['then'](respondWithResult(_0x39568a,0xc9))['catch'](handleError(_0x39568a,null));};exports[_0xf3cb('0x7e')]=function(_0x19e7b5,_0x127ddf,_0x4ca790){return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x19e7b5['params']['id']}})['then'](handleEntityNotFound(_0x127ddf,null))['then'](function(_0x4b9371){if(_0x4b9371){return _0x4b9371[_0xf3cb('0x7e')]();}return null;})[_0xf3cb('0x1e')](respondWithResult(_0x127ddf,null))[_0xf3cb('0x28')](handleError(_0x127ddf,null));};exports[_0xf3cb('0x7f')]=function(_0x7ea7,_0x160d11,_0x475558){if(_0x7ea7['body']['id']){delete _0x7ea7['body']['id'];}return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x7ea7[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x160d11,null))['then'](function(_0x463de5){if(_0x463de5){_0x7ea7[_0xf3cb('0x60')]['MailAccountId']=_0x463de5['id'];return db['MailServerIn'][_0xf3cb('0x62')](_0x7ea7[_0xf3cb('0x60')]);}})[_0xf3cb('0x1e')](respondWithResult(_0x160d11,null))[_0xf3cb('0x28')](handleError(_0x160d11,null));};exports[_0xf3cb('0x80')]=function(_0x11d6b3,_0x2eee1b,_0x54e2fe){return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x11d6b3[_0xf3cb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2eee1b,null))[_0xf3cb('0x1e')](function(_0x381987){if(_0x381987){return _0x381987[_0xf3cb('0x81')](null);}return null;})[_0xf3cb('0x1e')](respondWithStatusCode(_0x2eee1b,null))[_0xf3cb('0x28')](handleError(_0x2eee1b,null));};exports[_0xf3cb('0x82')]=function(_0x5a5ff1,_0x4a5960,_0x175d00){return db[_0xf3cb('0x40')]['findOne']({'where':{'id':_0x5a5ff1[_0xf3cb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a5960,null))[_0xf3cb('0x1e')](function(_0x344b69){if(_0x344b69){return _0x344b69[_0xf3cb('0x82')]();}return null;})[_0xf3cb('0x1e')](respondWithResult(_0x4a5960,null))[_0xf3cb('0x28')](handleError(_0x4a5960,null));};exports[_0xf3cb('0x83')]=function(_0x2ef13a,_0x439708,_0x58672b){if(_0x2ef13a['body']['id']){delete _0x2ef13a['body']['id'];}return db[_0xf3cb('0x40')]['find']({'where':{'id':_0x2ef13a[_0xf3cb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x439708,null))[_0xf3cb('0x1e')](function(_0x29ccaf){if(_0x29ccaf){_0x2ef13a['body']['MailAccountId']=_0x29ccaf['id'];return db[_0xf3cb('0x3c')]['create'](_0x2ef13a['body']);}})[_0xf3cb('0x1e')](respondWithResult(_0x439708,null))[_0xf3cb('0x28')](handleError(_0x439708,null));};exports[_0xf3cb('0x84')]=function(_0x317b49,_0x3b8539,_0x277f99){return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x317b49[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x3b8539,null))['then'](function(_0x15c107){if(_0x15c107){return _0x15c107[_0xf3cb('0x85')](null);}return null;})[_0xf3cb('0x1e')](respondWithStatusCode(_0x3b8539,null))[_0xf3cb('0x28')](handleError(_0x3b8539,null));};exports[_0xf3cb('0x86')]=function(_0x50e76b,_0x4cea41,_0x22a591){return db[_0xf3cb('0x87')]['find']({'where':{'id':_0x50e76b[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x4cea41,null))['then'](function(_0x381e9c){if(_0x381e9c){return _0x381e9c[_0xf3cb('0x86')](_0x50e76b['body'][_0xf3cb('0x68')],_[_0xf3cb('0x88')](_0x50e76b['body'],[_0xf3cb('0x68'),'id'])||{});}})['then'](respondWithResult(_0x4cea41,null))['catch'](handleError(_0x4cea41,null));};exports[_0xf3cb('0x89')]=function(_0x2d45a7,_0x27e51f,_0x4f970d){var _0x3f616c={'raw':![],'where':{}};var _0x18e2b0={};var _0x3dc2cc={'count':0x0,'rows':[]};return db['MailAccount'][_0xf3cb('0x64')]({'where':{'id':_0x2d45a7[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x27e51f,null))['then'](function(_0x4cb862){if(_0x4cb862){_0x18e2b0['model']=_[_0xf3cb('0x41')](db['MailInteraction'][_0xf3cb('0x5e')]);_0x18e2b0[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x2d45a7[_0xf3cb('0x42')]);_0x18e2b0['filters']=_[_0xf3cb('0x44')](_0x18e2b0[_0xf3cb('0x45')],_0x18e2b0[_0xf3cb('0x42')]);_0x3f616c[_0xf3cb('0x46')]=_['intersection'](_0x18e2b0['model'],qs[_0xf3cb('0x47')](_0x2d45a7['query'][_0xf3cb('0x47')]));_0x3f616c[_0xf3cb('0x46')]=_0x3f616c[_0xf3cb('0x46')][_0xf3cb('0x48')]?_0x3f616c[_0xf3cb('0x46')]:_0x18e2b0['model'];if(!_0x2d45a7['query'][_0xf3cb('0x65')](_0xf3cb('0x49'))){_0x3f616c[_0xf3cb('0x2e')]=qs[_0xf3cb('0x2e')](_0x2d45a7[_0xf3cb('0x42')]['limit']);_0x3f616c[_0xf3cb('0x2d')]=qs['offset'](_0x2d45a7[_0xf3cb('0x42')]['offset']);}_0x3f616c['order']=qs[_0xf3cb('0x4b')](_0x2d45a7[_0xf3cb('0x42')][_0xf3cb('0x4b')]);_0x3f616c[_0xf3cb('0x4c')]=qs[_0xf3cb('0x43')](_[_0xf3cb('0x4d')](_0x2d45a7[_0xf3cb('0x42')],_0x18e2b0[_0xf3cb('0x43')]));_0x3f616c['where'][_0xf3cb('0x66')]=_0x4cb862['id'];if(_0x2d45a7[_0xf3cb('0x42')]['filter']){_0x3f616c[_0xf3cb('0x4c')]=_[_0xf3cb('0x4f')](_0x3f616c[_0xf3cb('0x4c')],{'$or':_[_0xf3cb('0x50')](_0x3f616c['attributes'],function(_0x2fe4b9){var _0x1d21d2={};_0x1d21d2[_0x2fe4b9]={'$like':'%'+_0x2d45a7[_0xf3cb('0x42')]['filter']+'%'};return _0x1d21d2;})});}_0x3f616c=_['merge']({},_0x3f616c,_0x2d45a7[_0xf3cb('0x55')]);return db[_0xf3cb('0x87')][_0xf3cb('0x56')]({'where':_0x3f616c['where']})[_0xf3cb('0x1e')](function(_0x554f09){_0x3dc2cc[_0xf3cb('0x56')]=_0x554f09;if(_0x2d45a7['query'][_0xf3cb('0x57')]){_0x3f616c[_0xf3cb('0x58')]=[{'model':db['CmContact'],'as':_0xf3cb('0x8a'),'required':![]},{'model':db['User'],'as':_0xf3cb('0x8b'),'attributes':['name',_0xf3cb('0x8c'),_0xf3cb('0x8d')],'required':![]},{'model':db['Tag'],'as':_0xf3cb('0x8e'),'attributes':['id',_0xf3cb('0x38'),_0xf3cb('0x8f')],'where':_0x2d45a7[_0xf3cb('0x42')][_0xf3cb('0x90')]?{'id':_0x2d45a7['query']['tag']}:undefined,'required':_0x2d45a7[_0xf3cb('0x42')][_0xf3cb('0x90')]?!![]:![]}];}return db[_0xf3cb('0x87')]['findAll'](_0x3f616c);})['then'](function(_0x2e2ef3){_0x3dc2cc[_0xf3cb('0x5a')]=_0x2e2ef3;return _0x3dc2cc;});}})[_0xf3cb('0x1e')](respondWithFilteredResult(_0x27e51f,_0x3f616c))[_0xf3cb('0x28')](handleError(_0x27e51f,null));};exports[_0xf3cb('0x91')]=function(_0x254266,_0x4c5b92,_0x3a02c7){return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x254266[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x4c5b92,null))['then'](function(_0x29dfe2){if(_0x29dfe2){return db[_0xf3cb('0x92')]['transaction'](function(_0x4775f6){return db['MailApplication'][_0xf3cb('0x34')]({'where':{'MailAccountId':_0x254266[_0xf3cb('0x5c')]['id']},'transaction':_0x4775f6})[_0xf3cb('0x1e')](function(_0x39317d){var _0x3ff3e3=_[_0xf3cb('0x50')](_0x254266['body'],function(_0x122080){_0x122080[_0xf3cb('0x66')]=_0x254266[_0xf3cb('0x5c')]['id'];return _0x122080;});return db[_0xf3cb('0x93')][_0xf3cb('0x94')](_0x3ff3e3,{'transaction':_0x4775f6});});})['then'](function(){return db[_0xf3cb('0x93')][_0xf3cb('0x95')]({'where':{'MailAccountId':_0x254266[_0xf3cb('0x5c')]['id']},'order':_0xf3cb('0x96')});});}})[_0xf3cb('0x1e')](respondWithResult(_0x4c5b92,null))[_0xf3cb('0x28')](handleError(_0x4c5b92,null));};exports[_0xf3cb('0x97')]=function(_0x1fbfa6,_0x144ca8,_0x2e9551){var _0x4c633f={};var _0x5773d8={};var _0x7b7074;var _0x48d7dd;return db['MailAccount']['findOne']({'where':{'id':_0x1fbfa6[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x144ca8,null))[_0xf3cb('0x1e')](function(_0x481ef0){if(_0x481ef0){_0x7b7074=_0x481ef0;_0x5773d8[_0xf3cb('0x45')]=_[_0xf3cb('0x41')](db['MailApplication'][_0xf3cb('0x5e')]);_0x5773d8[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x1fbfa6['query']);_0x5773d8['filters']=_[_0xf3cb('0x44')](_0x5773d8[_0xf3cb('0x45')],_0x5773d8[_0xf3cb('0x42')]);_0x4c633f['attributes']=_[_0xf3cb('0x44')](_0x5773d8[_0xf3cb('0x45')],qs[_0xf3cb('0x47')](_0x1fbfa6['query'][_0xf3cb('0x47')]));_0x4c633f['attributes']=_0x4c633f[_0xf3cb('0x46')]['length']?_0x4c633f['attributes']:_0x5773d8[_0xf3cb('0x45')];_0x4c633f['order']=qs[_0xf3cb('0x4b')](_0x1fbfa6[_0xf3cb('0x42')][_0xf3cb('0x4b')]);_0x4c633f[_0xf3cb('0x4c')]=qs[_0xf3cb('0x43')](_[_0xf3cb('0x4d')](_0x1fbfa6['query'],_0x5773d8[_0xf3cb('0x43')]));if(_0x1fbfa6[_0xf3cb('0x42')][_0xf3cb('0x4e')]){_0x4c633f['where']=_[_0xf3cb('0x4f')](_0x4c633f[_0xf3cb('0x4c')],{'$or':_[_0xf3cb('0x50')](_0x4c633f['attributes'],function(_0xa422cf){var _0x17034f={};_0x17034f[_0xa422cf]={'$like':'%'+_0x1fbfa6[_0xf3cb('0x42')][_0xf3cb('0x4e')]+'%'};return _0x17034f;})});}_0x4c633f=_[_0xf3cb('0x4f')]({},_0x4c633f,_0x1fbfa6[_0xf3cb('0x55')]);return _0x7b7074[_0xf3cb('0x97')](_0x4c633f);}})['then'](function(_0x259ef7){if(_0x259ef7){_0x48d7dd=_0x259ef7['length'];if(!_0x1fbfa6['query']['hasOwnProperty'](_0xf3cb('0x49'))){_0x4c633f[_0xf3cb('0x2e')]=qs[_0xf3cb('0x2e')](_0x1fbfa6['query'][_0xf3cb('0x2e')]);_0x4c633f[_0xf3cb('0x2d')]=qs[_0xf3cb('0x2d')](_0x1fbfa6[_0xf3cb('0x42')][_0xf3cb('0x2d')]);}return _0x7b7074[_0xf3cb('0x97')](_0x4c633f);}})['then'](function(_0x41ac9d){if(_0x41ac9d){return _0x41ac9d?{'count':_0x48d7dd,'rows':_0x41ac9d}:null;}})[_0xf3cb('0x1e')](respondWithResult(_0x144ca8,null))[_0xf3cb('0x28')](handleError(_0x144ca8,null));};exports[_0xf3cb('0x98')]=function(_0x2ffcb4,_0x15f728,_0x4a09f5){var _0x4afc16={'raw':!![],'where':{}};var _0x2d6851={};var _0xf21e98={'count':0x0,'rows':[]};return db['MailAccount'][_0xf3cb('0x64')]({'where':{'id':_0x2ffcb4[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x15f728,null))[_0xf3cb('0x1e')](function(_0x38c4ad){if(_0x38c4ad){_0x2d6851[_0xf3cb('0x45')]=_[_0xf3cb('0x41')](db[_0xf3cb('0x99')][_0xf3cb('0x5e')]);_0x2d6851[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x2ffcb4[_0xf3cb('0x42')]);_0x2d6851['filters']=_[_0xf3cb('0x44')](_0x2d6851[_0xf3cb('0x45')],_0x2d6851['query']);_0x4afc16['attributes']=_[_0xf3cb('0x44')](_0x2d6851['model'],qs[_0xf3cb('0x47')](_0x2ffcb4[_0xf3cb('0x42')][_0xf3cb('0x47')]));_0x4afc16[_0xf3cb('0x46')]=_0x4afc16['attributes'][_0xf3cb('0x48')]?_0x4afc16[_0xf3cb('0x46')]:_0x2d6851[_0xf3cb('0x45')];if(!_0x2ffcb4[_0xf3cb('0x42')][_0xf3cb('0x65')](_0xf3cb('0x49'))){_0x4afc16[_0xf3cb('0x2e')]=qs['limit'](_0x2ffcb4[_0xf3cb('0x42')][_0xf3cb('0x2e')]);_0x4afc16[_0xf3cb('0x2d')]=qs[_0xf3cb('0x2d')](_0x2ffcb4['query'][_0xf3cb('0x2d')]);}_0x4afc16[_0xf3cb('0x4a')]=qs[_0xf3cb('0x4b')](_0x2ffcb4[_0xf3cb('0x42')][_0xf3cb('0x4b')]);_0x4afc16[_0xf3cb('0x4c')]=qs[_0xf3cb('0x43')](_[_0xf3cb('0x4d')](_0x2ffcb4[_0xf3cb('0x42')],_0x2d6851[_0xf3cb('0x43')]));_0x4afc16[_0xf3cb('0x4c')]['MailAccountId']=_0x38c4ad['id'];if(_0x2ffcb4['query']['filter']){_0x4afc16['where']=_[_0xf3cb('0x4f')](_0x4afc16[_0xf3cb('0x4c')],{'$or':_['map'](_0x4afc16[_0xf3cb('0x46')],function(_0xc53202){var _0x5203f0={};_0x5203f0[_0xc53202]={'$like':'%'+_0x2ffcb4['query'][_0xf3cb('0x4e')]+'%'};return _0x5203f0;})});}if(_0x2ffcb4[_0xf3cb('0x42')][_0xf3cb('0x9a')]){var _0x50e0c4=_0x2ffcb4[_0xf3cb('0x42')][_0xf3cb('0x9a')][_0xf3cb('0x9b')](',');var _0x526233={};_0x526233[_0x50e0c4[0x0]]={'$gte':moment(_0x50e0c4[0x1])[_0xf3cb('0x9c')](_0xf3cb('0x9d'))};_0x4afc16[_0xf3cb('0x4c')]=_[_0xf3cb('0x4f')](_0x4afc16[_0xf3cb('0x4c')],_0x526233);}_0x4afc16=_[_0xf3cb('0x4f')]({},_0x4afc16,_0x2ffcb4[_0xf3cb('0x55')]);return db[_0xf3cb('0x99')][_0xf3cb('0x56')]({'where':_0x4afc16['where']})['then'](function(_0x1af420){_0xf21e98[_0xf3cb('0x56')]=_0x1af420;if(_0x2ffcb4['query'][_0xf3cb('0x57')]){_0x4afc16[_0xf3cb('0x58')]=[{'all':!![]}];}return db[_0xf3cb('0x99')]['findAll'](_0x4afc16);})[_0xf3cb('0x1e')](function(_0x3c8e84){_0xf21e98[_0xf3cb('0x5a')]=_0x3c8e84;return _0xf21e98;});}})[_0xf3cb('0x1e')](respondWithFilteredResult(_0x15f728,_0x4afc16))[_0xf3cb('0x28')](handleError(_0x15f728,null));};exports[_0xf3cb('0x39')]=function(_0x2eec72,_0x51aee4,_0xbd2c72){var _0x375c58,_0x4218e6={},_0x5a7fe8;if(_0x2eec72[_0xf3cb('0x60')]['to']){_0x5a7fe8=_0x2eec72['body']['to'][_0xf3cb('0x9b')](',')[0x0];}return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x2eec72[_0xf3cb('0x5c')]['id']},'include':[{'model':db[_0xf3cb('0x9e')],'as':_0xf3cb('0x9f'),'include':[{'model':db[_0xf3cb('0xa0')],'as':_0xf3cb('0xa1'),'where':{'email':_0x5a7fe8},'limit':0x1,'order':[['updatedAt',_0xf3cb('0xa2')]]}]},{'model':db[_0xf3cb('0x3c')],'as':_0xf3cb('0x3d'),'raw':!![]}]})[_0xf3cb('0x1e')](handleEntityNotFound(_0x51aee4,null))[_0xf3cb('0x1e')](function(_0x1302c4){if(_0x1302c4){_0x375c58=_0x1302c4;if(_0x1302c4[_0xf3cb('0x3d')]){if(_[_0xf3cb('0x6d')](_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa3')])){_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa3')]=util['format'](_0xf3cb('0xa4'),_0x1302c4[_0xf3cb('0x38')],_0x1302c4[_0xf3cb('0x6b')]||_0x1302c4[_0xf3cb('0x3d')][_0xf3cb('0x72')]);}if(_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa5')]&&_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa5')][_0xf3cb('0x48')]){for(var _0xf059c0=0x0;_0xf059c0<_0x2eec72['body']['attachments'][_0xf3cb('0x48')];_0xf059c0+=0x1){_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa5')][_0xf059c0]={'filename':_0x2eec72['body']['attachments'][_0xf059c0][_0xf3cb('0x38')],'path':path[_0xf3cb('0xa6')](config[_0xf3cb('0xa7')],_0xf3cb('0xa8'),_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa5')][_0xf059c0][_0xf3cb('0xa9')])};}}var _0x3513b4={'tls':{'rejectUnauthorized':![]}};if(_[_0xf3cb('0x6d')](_0x1302c4[_0xf3cb('0x3d')][_0xf3cb('0x79')])){if(_0x1302c4['Smtp'][_0xf3cb('0x76')]){_0x3513b4[_0xf3cb('0xaa')]={'user':_0x1302c4['Smtp'][_0xf3cb('0x72')],'pass':_0x1302c4[_0xf3cb('0x3d')][_0xf3cb('0x75')]};}_0x3513b4[_0xf3cb('0x77')]=_0x1302c4[_0xf3cb('0x3d')][_0xf3cb('0x77')];_0x3513b4[_0xf3cb('0x78')]=_0x1302c4[_0xf3cb('0x3d')]['port'];_0x3513b4[_0xf3cb('0xab')]=_0x1302c4[_0xf3cb('0x3d')]['secure'];}else{_0x3513b4['service']=_0x1302c4[_0xf3cb('0x3d')][_0xf3cb('0x79')];_0x3513b4[_0xf3cb('0xaa')]={'user':_0x1302c4['Smtp'][_0xf3cb('0x72')],'pass':_0x1302c4[_0xf3cb('0x3d')][_0xf3cb('0x75')]};}return respondWithRpcPromise('SendMail',_0xf3cb('0xac'),{'account':_0x3513b4,'message':_0x2eec72[_0xf3cb('0x60')]});}else{throw new Error(_0xf3cb('0xad'));}}})['then'](function(_0x42fa0a){if(_0x42fa0a){_0x4218e6=_0x42fa0a;if(_0x375c58[_0xf3cb('0x9f')]){if(_0x375c58[_0xf3cb('0x9f')]['Contacts'][_0xf3cb('0x48')]){return _0x375c58['List']['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xf3cb('0x16')](_0x2eec72[_0xf3cb('0x60')],{'firstName':_0x2eec72[_0xf3cb('0x60')]['to'],'email':_0x2eec72['body']['to'],'phone':_0x2eec72[_0xf3cb('0x60')]['to'],'ListId':_0x375c58['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x3bc6a6){if(_0x3bc6a6){var _0x216001={'UserId':_0x2eec72[_0xf3cb('0x72')]['id'],'ContactId':_0x3bc6a6['id'],'MailAccountId':_0x375c58['id'],'inReplyTo':_0x4218e6['messageId'],'to':_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xa3')],'cc':_0x2eec72[_0xf3cb('0x60')]['cc'],'subject':_0x2eec72['body']['subject'],'attach':_0x2eec72['body'][_0xf3cb('0xae')],'firstMsgDirection':_0xf3cb('0xaf'),'lastMsgAt':moment()[_0xf3cb('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xf3cb('0xaf'),'lastMsgBody':_0x2eec72['body'][_0xf3cb('0x60')],'Messages':[_[_0xf3cb('0x4f')](_0x2eec72[_0xf3cb('0x60')],{'messageId':_0x4218e6['messageId'],'sentAt':moment()['format'](_0xf3cb('0x9d')),'read':!![],'MailAccountId':_0x375c58['id'],'UserId':_0x2eec72['user']['id'],'ContactId':_0x3bc6a6['id']})]};if(_0x2eec72[_0xf3cb('0x60')]['Interaction']){_0x216001=_[_0xf3cb('0x4f')](_0x216001,_0x2eec72[_0xf3cb('0x60')][_0xf3cb('0xb0')]);}return db[_0xf3cb('0x87')]['create'](_0x216001,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0xf3cb('0x1e')](respondWithResult(_0x51aee4,null))[_0xf3cb('0x28')](handleError(_0x51aee4,null));};exports[_0xf3cb('0xb1')]=function(_0x3dddaa,_0x4caad2,_0x5c57c1){return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x3dddaa[_0xf3cb('0x5c')]['id']},'include':[{'model':db[_0xf3cb('0x3c')],'as':'Smtp','raw':!![]}]})[_0xf3cb('0x1e')](handleEntityNotFound(_0x4caad2,null))['then'](function(_0x47fa5c){if(_0x47fa5c&&_0x47fa5c[_0xf3cb('0x3d')]){var _0x175bcb={'id':_0x47fa5c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x47fa5c[_0xf3cb('0x3d')]['service']){_0x175bcb[_0xf3cb('0x79')]=_0x47fa5c['Smtp'][_0xf3cb('0x79')];}else{_0x175bcb[_0xf3cb('0x77')]=_0x47fa5c[_0xf3cb('0x3d')][_0xf3cb('0x77')];_0x175bcb[_0xf3cb('0x78')]=_0x47fa5c[_0xf3cb('0x3d')]['port'];_0x175bcb[_0xf3cb('0xab')]=_0x47fa5c['Smtp'][_0xf3cb('0xab')];}if(_0x47fa5c[_0xf3cb('0x3d')][_0xf3cb('0x76')]){_0x175bcb[_0xf3cb('0xaa')]={'user':_0x47fa5c['Smtp'][_0xf3cb('0x72')],'pass':_0x47fa5c[_0xf3cb('0x3d')][_0xf3cb('0x75')]};}return respondWithRpcPromise(_0xf3cb('0xb2'),'verifySmtp',{'account':_0x175bcb});}})[_0xf3cb('0x1e')](respondWithResult(_0x4caad2,null))['catch'](handleError(_0x4caad2,null));};exports[_0xf3cb('0x34')]=function(_0x41d174,_0x168ff8){return db['MailAccount'][_0xf3cb('0x5f')]({'where':{'id':_0x41d174[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x168ff8,null))['then'](function(_0x2963d0){if(_0x2963d0&&_0x2963d0[_0xf3cb('0x79')]){throw new db[(_0xf3cb('0xb3'))][(_0xf3cb('0xb4'))](_0xf3cb('0xb5'));}return _0x2963d0;})[_0xf3cb('0x1e')](removeEntity(_0x168ff8,null))[_0xf3cb('0x28')](handleError(_0x168ff8,null));};exports['addAgents']=function(_0x4c5484,_0x5abbf2,_0x21d9d7){return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x4c5484[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x5abbf2,null))[_0xf3cb('0x1e')](function(_0x1635e8){if(_0x1635e8){return _0x1635e8[_0xf3cb('0xb6')](_0x4c5484[_0xf3cb('0x60')][_0xf3cb('0x68')],_[_0xf3cb('0x88')](_0x4c5484['body'],['ids','id'])||{})[_0xf3cb('0xb7')](function(_0xe52360){for(var _0x1e1246=0x0;_0x1e1246<_0x4c5484[_0xf3cb('0x60')][_0xf3cb('0x68')][_0xf3cb('0x48')];_0x1e1246+=0x1){socket[_0xf3cb('0xb8')](_0xf3cb('0xb9'),{'UserId':_0x4c5484[_0xf3cb('0x60')][_0xf3cb('0x68')][_0x1e1246],'MailAccountId':_0x4c5484['params']['id']});}return _0xe52360;});}})['then'](respondWithResult(_0x5abbf2,null))['catch'](handleError(_0x5abbf2,null));};exports[_0xf3cb('0xba')]=function(_0x537d5b,_0x419b34,_0x5071de){return db[_0xf3cb('0x40')][_0xf3cb('0x5f')]({'where':{'id':_0x537d5b[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x419b34,null))[_0xf3cb('0x1e')](function(_0x2c6c1b){if(_0x2c6c1b){return _0x2c6c1b[_0xf3cb('0xba')](_0x537d5b[_0xf3cb('0x42')][_0xf3cb('0x68')])[_0xf3cb('0x1e')](function(){if(_[_0xf3cb('0xbb')](_0x537d5b[_0xf3cb('0x42')][_0xf3cb('0x68')])){for(var _0x1f4bb2=0x0;_0x1f4bb2<_0x537d5b[_0xf3cb('0x42')]['ids']['length'];_0x1f4bb2+=0x1){socket[_0xf3cb('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x537d5b['query'][_0xf3cb('0x68')][_0x1f4bb2]),'MailAccountId':Number(_0x537d5b['params']['id'])});}}else{socket[_0xf3cb('0xb8')](_0xf3cb('0xbc'),{'UserId':Number(_0x537d5b[_0xf3cb('0x42')][_0xf3cb('0x68')]),'MailAccountId':Number(_0x537d5b['params']['id'])});}});}})[_0xf3cb('0x1e')](respondWithStatusCode(_0x419b34,null))[_0xf3cb('0x28')](handleError(_0x419b34,null));};exports[_0xf3cb('0xbd')]=function(_0x38d76a,_0x51a9e3,_0x293209){var _0x2f0641={};var _0x47e7f7={};var _0x42a1a6;var _0x530d4c;return db[_0xf3cb('0x40')][_0xf3cb('0x64')]({'where':{'id':_0x38d76a[_0xf3cb('0x5c')]['id']}})[_0xf3cb('0x1e')](handleEntityNotFound(_0x51a9e3,null))['then'](function(_0x332c8f){if(_0x332c8f){_0x42a1a6=_0x332c8f;_0x47e7f7[_0xf3cb('0x45')]=_[_0xf3cb('0x41')](db['User'][_0xf3cb('0x5e')]);_0x47e7f7[_0xf3cb('0x42')]=_[_0xf3cb('0x41')](_0x38d76a[_0xf3cb('0x42')]);_0x47e7f7[_0xf3cb('0x43')]=_[_0xf3cb('0x44')](_0x47e7f7[_0xf3cb('0x45')],_0x47e7f7[_0xf3cb('0x42')]);_0x2f0641[_0xf3cb('0x46')]=_[_0xf3cb('0x44')](_0x47e7f7['model'],qs[_0xf3cb('0x47')](_0x38d76a[_0xf3cb('0x42')]['fields']));_0x2f0641[_0xf3cb('0x46')]=_0x2f0641[_0xf3cb('0x46')][_0xf3cb('0x48')]?_0x2f0641[_0xf3cb('0x46')]:_0x47e7f7[_0xf3cb('0x45')];_0x2f0641['order']=qs[_0xf3cb('0x4b')](_0x38d76a['query']['sort']);_0x2f0641[_0xf3cb('0x4c')]=qs['filters'](_[_0xf3cb('0x4d')](_0x38d76a[_0xf3cb('0x42')],_0x47e7f7['filters']));if(_0x38d76a[_0xf3cb('0x42')][_0xf3cb('0x4e')]){_0x2f0641[_0xf3cb('0x4c')]=_['merge'](_0x2f0641['where'],{'$or':_[_0xf3cb('0x50')](_0x2f0641[_0xf3cb('0x46')],function(_0x846226){var _0x2a5ede={};_0x2a5ede[_0x846226]={'$like':'%'+_0x38d76a[_0xf3cb('0x42')]['filter']+'%'};return _0x2a5ede;})});}_0x2f0641=_[_0xf3cb('0x4f')]({},_0x2f0641,_0x38d76a['options']);return _0x42a1a6['getAgents'](_0x2f0641);}})[_0xf3cb('0x1e')](function(_0x1ae7d6){if(_0x1ae7d6){_0x530d4c=_0x1ae7d6[_0xf3cb('0x48')];if(!_0x38d76a[_0xf3cb('0x42')][_0xf3cb('0x65')](_0xf3cb('0x49'))){_0x2f0641[_0xf3cb('0x2e')]=qs[_0xf3cb('0x2e')](_0x38d76a[_0xf3cb('0x42')][_0xf3cb('0x2e')]);_0x2f0641[_0xf3cb('0x2d')]=qs['offset'](_0x38d76a[_0xf3cb('0x42')][_0xf3cb('0x2d')]);}return _0x42a1a6['getAgents'](_0x2f0641);}})[_0xf3cb('0x1e')](function(_0x19c906){if(_0x19c906){return _0x19c906?{'count':_0x530d4c,'rows':_0x19c906}:null;}})[_0xf3cb('0x1e')](respondWithResult(_0x51a9e3,null))[_0xf3cb('0x28')](handleError(_0x51a9e3,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1554c27..f1fbd91 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','update','emit'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var MailAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){MailAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);MailAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];MailAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var MailAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){MailAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);MailAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];MailAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('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 82b0ef2..f95af96 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 _0x8d62=['mail_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x31dc10,_0x196233){var _0x11e493=function(_0x2c617f){while(--_0x2c617f){_0x31dc10['push'](_0x31dc10['shift']());}};_0x11e493(++_0x196233);}(_0x8d62,0xf8));var _0x28d6=function(_0x4d62b5,_0x459220){_0x4d62b5=_0x4d62b5-0x0;var _0x2142e7=_0x8d62[_0x4d62b5];return _0x2142e7;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var logger=require(_0x28d6('0x1'))(_0x28d6('0x2'));var moment=require(_0x28d6('0x3'));var BPromise=require(_0x28d6('0x4'));var rp=require(_0x28d6('0x5'));var fs=require('fs');var path=require(_0x28d6('0x6'));var rimraf=require(_0x28d6('0x7'));var config=require(_0x28d6('0x8'));var attributes=require(_0x28d6('0x9'));module[_0x28d6('0xa')]=function(_0x4385ba,_0x3c827b){return _0x4385ba[_0x28d6('0xb')]('MailAccount',attributes,{'tableName':_0x28d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae6e=['util','../../config/logger','api','moment','request-promise','rimraf','MailAccount','mail_accounts','lodash'];(function(_0x1e0d60,_0x503460){var _0x5b9564=function(_0x331935){while(--_0x331935){_0x1e0d60['push'](_0x1e0d60['shift']());}};_0x5b9564(++_0x503460);}(_0xae6e,0x1e5));var _0xeae6=function(_0x1b2d8f,_0xac0e97){_0x1b2d8f=_0x1b2d8f-0x0;var _0x3b498b=_0xae6e[_0x1b2d8f];return _0x3b498b;};'use strict';var _=require(_0xeae6('0x0'));var util=require(_0xeae6('0x1'));var logger=require(_0xeae6('0x2'))(_0xeae6('0x3'));var moment=require(_0xeae6('0x4'));var BPromise=require('bluebird');var rp=require(_0xeae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeae6('0x6'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module['exports']=function(_0x1d06ba,_0x33ea23){return _0x1d06ba['define'](_0xeae6('0x7'),attributes,{'tableName':_0xeae6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 61a22f7..cf6fb2f 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 _0xc70c=['MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','interaction','originTo','bcc','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','MailAccount,\x20%s,\x20%s','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','include','model','map','ShowMailAccount','find','where','NotifyMailAccount','body','difference','keys','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','CmContact','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','omit','Applications','applications','List','orderBy','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20deee,_0x493615){var _0x458387=function(_0x4c2802){while(--_0x4c2802){_0x20deee['push'](_0x20deee['shift']());}};_0x458387(++_0x493615);}(_0xc70c,0x1aa));var _0xcc70=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc70c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xcc70('0x0'));var moment=require(_0xcc70('0x1'));var BPromise=require(_0xcc70('0x2'));var rs=require(_0xcc70('0x3'));var fs=require('fs');var Redis=require(_0xcc70('0x4'));var db=require(_0xcc70('0x5'))['db'];var utils=require(_0xcc70('0x6'));var logger=require(_0xcc70('0x7'))(_0xcc70('0x8'));var config=require(_0xcc70('0x9'));var jayson=require(_0xcc70('0xa'));var client=jayson[_0xcc70('0xb')][_0xcc70('0xc')]({'port':0x232c});config[_0xcc70('0xd')]=_[_0xcc70('0xe')](config[_0xcc70('0xd')],{'host':_0xcc70('0xf'),'port':0x18eb});var socket=require(_0xcc70('0x10'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xcc70('0x11')](socket);function respondWithRpcPromise(_0x4a9726,_0x4c70d1,_0xfb898f){return new BPromise(function(_0x2184be,_0x952144){return client[_0xcc70('0x12')](_0x4a9726,_0xfb898f)[_0xcc70('0x13')](function(_0x54f988){logger[_0xcc70('0x14')]('MailAccount,\x20%s,\x20%s',_0x4c70d1,_0xcc70('0x15'));logger[_0xcc70('0x16')](_0xcc70('0x17'),_0x4c70d1,_0xcc70('0x15'),JSON[_0xcc70('0x18')](_0x54f988));if(_0x54f988['error']){if(_0x54f988[_0xcc70('0x19')]['code']===0x1f4){logger[_0xcc70('0x19')]('MailAccount,\x20%s,\x20%s',_0x4c70d1,_0x54f988['error'][_0xcc70('0x1a')]);return _0x952144(_0x54f988[_0xcc70('0x19')][_0xcc70('0x1a')]);}logger[_0xcc70('0x19')](_0xcc70('0x1b'),_0x4c70d1,_0x54f988['error'][_0xcc70('0x1a')]);return _0x2184be(_0x54f988[_0xcc70('0x19')][_0xcc70('0x1a')]);}else{logger[_0xcc70('0x14')]('MailAccount,\x20%s,\x20%s',_0x4c70d1,_0xcc70('0x15'));_0x2184be(_0x54f988[_0xcc70('0x1c')]['message']);}})[_0xcc70('0x1d')](function(_0x42ca25){logger[_0xcc70('0x19')]('MailAccount,\x20%s,\x20%s',_0x4c70d1,_0x42ca25);_0x952144(_0x42ca25);});});}exports[_0xcc70('0x1e')]=function(_0x2e0edf){var _0x111224=this;return new Promise(function(_0x221333,_0x428b18){return db[_0xcc70('0x1f')][_0xcc70('0x20')]({'raw':_0x2e0edf[_0xcc70('0x21')]?_0x2e0edf[_0xcc70('0x21')][_0xcc70('0x22')]===undefined?!![]:![]:!![],'where':_0x2e0edf['options']?_0x2e0edf['options']['where']||null:null,'attributes':_0x2e0edf[_0xcc70('0x21')]?_0x2e0edf[_0xcc70('0x21')][_0xcc70('0x23')]||null:null,'limit':_0x2e0edf[_0xcc70('0x21')]?_0x2e0edf[_0xcc70('0x21')]['limit']||null:null,'include':_0x2e0edf[_0xcc70('0x21')]?_0x2e0edf[_0xcc70('0x21')][_0xcc70('0x24')]?_['map'](_0x2e0edf[_0xcc70('0x21')]['include'],function(_0x3a1efc){return{'model':db[_0x3a1efc['model']],'as':_0x3a1efc['as'],'attributes':_0x3a1efc[_0xcc70('0x23')],'include':_0x3a1efc['include']?_['map'](_0x3a1efc[_0xcc70('0x24')],function(_0x3c5b5e){return{'model':db[_0x3c5b5e[_0xcc70('0x25')]],'as':_0x3c5b5e['as'],'attributes':_0x3c5b5e[_0xcc70('0x23')],'include':_0x3c5b5e[_0xcc70('0x24')]?_[_0xcc70('0x26')](_0x3c5b5e[_0xcc70('0x24')],function(_0x465fb6){return{'model':db[_0x465fb6[_0xcc70('0x25')]],'as':_0x465fb6['as'],'attributes':_0x465fb6[_0xcc70('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcc70('0x13')](function(_0x2d5456){logger[_0xcc70('0x14')](_0xcc70('0x1e'),_0x2e0edf);logger[_0xcc70('0x16')]('GetMailAccount',_0x2e0edf,JSON['stringify'](_0x2d5456));_0x221333(_0x2d5456);})[_0xcc70('0x1d')](function(_0x15f09f){logger['error'](_0xcc70('0x1e'),_0x15f09f[_0xcc70('0x1a')],_0x2e0edf);_0x428b18(_0x111224[_0xcc70('0x19')](0x1f4,_0x15f09f['message']));});});};exports[_0xcc70('0x27')]=function(_0x3e4f46){var _0x48efbf=this;return new Promise(function(_0x400084,_0x10727d){return db[_0xcc70('0x1f')][_0xcc70('0x28')]({'raw':_0x3e4f46['options']?_0x3e4f46['options'][_0xcc70('0x22')]===undefined?!![]:![]:!![],'where':_0x3e4f46[_0xcc70('0x21')]?_0x3e4f46['options'][_0xcc70('0x29')]||null:null,'attributes':_0x3e4f46[_0xcc70('0x21')]?_0x3e4f46['options'][_0xcc70('0x23')]||null:null,'include':_0x3e4f46['options']?_0x3e4f46[_0xcc70('0x21')]['include']?_[_0xcc70('0x26')](_0x3e4f46[_0xcc70('0x21')][_0xcc70('0x24')],function(_0x10f2b9){return{'model':db[_0x10f2b9[_0xcc70('0x25')]],'as':_0x10f2b9['as'],'attributes':_0x10f2b9[_0xcc70('0x23')],'include':_0x10f2b9[_0xcc70('0x24')]?_[_0xcc70('0x26')](_0x10f2b9[_0xcc70('0x24')],function(_0x3a5652){return{'model':db[_0x3a5652[_0xcc70('0x25')]],'as':_0x3a5652['as'],'attributes':_0x3a5652[_0xcc70('0x23')],'include':_0x3a5652['include']?_[_0xcc70('0x26')](_0x3a5652[_0xcc70('0x24')],function(_0x24fd28){return{'model':db[_0x24fd28[_0xcc70('0x25')]],'as':_0x24fd28['as'],'attributes':_0x24fd28[_0xcc70('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcc70('0x13')](function(_0x525a7f){logger[_0xcc70('0x14')](_0xcc70('0x27'),_0x3e4f46);logger[_0xcc70('0x16')](_0xcc70('0x27'),_0x3e4f46,JSON[_0xcc70('0x18')](_0x525a7f));_0x400084(_0x525a7f);})[_0xcc70('0x1d')](function(_0x31fa26){logger['error'](_0xcc70('0x27'),_0x31fa26[_0xcc70('0x1a')],_0x3e4f46);_0x10727d(_0x48efbf['error'](0x1f4,_0x31fa26[_0xcc70('0x1a')]));});});};exports[_0xcc70('0x2a')]=function(_0x3cae74){var _0x3a31de=this;return new Promise(function(_0x1f29f3,_0x1eb4a1){var _0x4bd1a6={'body':_0x3cae74[_0xcc70('0x2b')],'channel':'mail'};var _0x5cf1c0=_[_0xcc70('0x2c')](_[_0xcc70('0x2d')](db['CmContact'][_0xcc70('0x2e')]),['createdAt',_0xcc70('0x2f'),_0xcc70('0x30'),_0xcc70('0x31')]);var _0x285ed9=![];if(_0x3cae74[_0xcc70('0x2b')]['id']){delete _0x3cae74[_0xcc70('0x2b')]['id'];}if(_[_0xcc70('0x32')](_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x33')])){return _0x1eb4a1(_0x3a31de['error'](0x1f4,_0xcc70('0x34')));}if(_[_0xcc70('0x32')](_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x2b')])||_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x2b')]===''){return _0x1eb4a1(_0x3a31de[_0xcc70('0x19')](0x1f4,_0xcc70('0x35')));}if(_[_0xcc70('0x32')](_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x36')])){return _0x1eb4a1(_0x3a31de[_0xcc70('0x19')](0x1f4,_0xcc70('0x37')+_0x5cf1c0));}if(!_['includes'](_0x5cf1c0,_0x3cae74['body'][_0xcc70('0x36')])){return _0x1eb4a1(_0x3a31de[_0xcc70('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cf1c0));}var _0x4dedc2={};_0x4dedc2[_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x36')]]=_0x3cae74['body']['from'];return db[_0xcc70('0x1f')]['find']({'where':{'id':_0x3cae74[_0xcc70('0x38')]['id']},'include':[{'model':db[_0xcc70('0x39')],'as':'List','include':[{'model':db[_0xcc70('0x3a')],'as':_0xcc70('0x3b'),'where':_0x4dedc2,'limit':0x1,'order':[[_0xcc70('0x2f'),_0xcc70('0x3c')]]}]},{'model':db[_0xcc70('0x3d')],'as':'Applications'},{'model':db[_0xcc70('0x3e')],'as':_0xcc70('0x3f')}]})[_0xcc70('0x13')](function(_0x3c27ce){if(_0x3c27ce&&_0x3c27ce['List']){var _0x470781=_0x3c27ce[_0xcc70('0x40')]({'plain':!![]});_0x4bd1a6[_0xcc70('0x38')]=_[_0xcc70('0x41')](_0x470781,[_0xcc70('0x42'),'List']);_0x4bd1a6[_0xcc70('0x43')]=_0x470781[_0xcc70('0x42')];_0x4bd1a6['list']=_0x470781[_0xcc70('0x44')];_0x4bd1a6[_0xcc70('0x43')]=_[_0xcc70('0x45')](_0x4bd1a6[_0xcc70('0x43')],['priority'],[_0xcc70('0x46')]);if(_0x4bd1a6[_0xcc70('0x38')]&&_0x4bd1a6[_0xcc70('0x38')][_0xcc70('0x47')]){_0x4bd1a6['applications'][_0xcc70('0x48')]({'id':0x0,'priority':_0x4bd1a6['applications'][_0xcc70('0x49')]+0x1,'app':'close','appdata':_0xcc70('0x47'),'interval':_0xcc70('0x4a')});}if(_0x4bd1a6[_0xcc70('0x38')]['Applications']){delete _0x4bd1a6[_0xcc70('0x38')][_0xcc70('0x42')];}if(_0x4bd1a6[_0xcc70('0x38')][_0xcc70('0x44')]){delete _0x4bd1a6[_0xcc70('0x38')][_0xcc70('0x44')];}if(_0x470781[_0xcc70('0x44')][_0xcc70('0x3b')]['length']){return _0x470781[_0xcc70('0x44')]['Contacts'][0x0];}var _0x573ec2=_['defaults'](_0x3cae74[_0xcc70('0x2b')],{'firstName':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x33')],'ListId':_0x470781[_0xcc70('0x31')]});_0x573ec2[_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x36')]]=_0x3cae74[_0xcc70('0x2b')]['from'];return db[_0xcc70('0x3a')][_0xcc70('0x4b')](_0x573ec2);}else{throw new Error(_0xcc70('0x4c'));}})['then'](function(_0x2a1a23){_0x4bd1a6[_0xcc70('0x4d')]=_0x2a1a23;if(_0x2a1a23){if(!_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')]['messageId']){_0x3cae74['body'][_0xcc70('0x1a')][_0xcc70('0x4e')]=rs[_0xcc70('0x4f')]()+'\x20'+_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x33')];}var _0x4d3f80={'ContactId':_0x2a1a23['id'],'MailAccountId':_0x3cae74[_0xcc70('0x38')]['id'],'inReplyTo':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x4e')],'to':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x33')],'cc':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')]['cc'],'subject':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x50')],'attach':_0x3cae74[_0xcc70('0x2b')]['message'][_0xcc70('0x51')],'lastMsgAt':moment()[_0xcc70('0x52')](_0xcc70('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x3cae74[_0xcc70('0x2b')]['body']};return db[_0xcc70('0x54')][_0xcc70('0x28')]({'where':{'closed':![],'MailAccountId':_0x3cae74[_0xcc70('0x38')]['id']},'include':[{'model':db[_0xcc70('0x55')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x56')]}}]})[_0xcc70('0x13')](function(_0x4f3f8b){if(_0x4f3f8b){return[_0x4f3f8b,![]];}return db[_0xcc70('0x54')][_0xcc70('0x4b')](_0x4d3f80)['then'](function(_0x4e1794){return[_0x4e1794,!![]];});});}else{throw new Error(_0xcc70('0x57'));}})[_0xcc70('0x58')](function(_0x54d3a5,_0x3aaffd){if(_0x54d3a5){_0x285ed9=_0x3aaffd;if(!_0x3aaffd){return _0x54d3a5[_0xcc70('0x59')]({'inReplyTo':_0x3cae74[_0xcc70('0x2b')]['message'][_0xcc70('0x4e')],'to':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x33')],'cc':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')]['cc'],'subject':_0x3cae74['body']['message'][_0xcc70('0x50')],'attach':_0x54d3a5[_0xcc70('0x51')]?_0x54d3a5[_0xcc70('0x51')]:_0x3cae74[_0xcc70('0x2b')]['message'][_0xcc70('0x51')],'substatus':null,'substatusAt':moment()['format'](_0xcc70('0x53')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x2b')]});}else{return _0x54d3a5;}}})['then'](function(_0x1a2fde){_0x4bd1a6[_0xcc70('0x5a')]=_0x1a2fde['get']({'plain':!![]});_0x4bd1a6['interaction']['created']=_0x285ed9;return db[_0xcc70('0x55')]['create']({'body':_0x3cae74['body'][_0xcc70('0x2b')],'MailAccountId':_0x3cae74['account']['id'],'MailInteractionId':_0x1a2fde['id'],'direction':'in','ContactId':_0x4bd1a6[_0xcc70('0x4d')]['id'],'messageId':_0x3cae74[_0xcc70('0x2b')]['message'][_0xcc70('0x4e')],'from':_0x3cae74[_0xcc70('0x2b')]['message']['from'],'to':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')]['to'],'cc':_0x3cae74['body'][_0xcc70('0x1a')]['cc'],'subject':_0x3cae74[_0xcc70('0x2b')]['message']['subject'],'attach':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')][_0xcc70('0x51')],'Attachments':_0x3cae74['body'][_0xcc70('0x1a')]['attachments'],'originTo':_0x3cae74[_0xcc70('0x2b')]['message'][_0xcc70('0x5b')],'originCc':_0x3cae74[_0xcc70('0x2b')][_0xcc70('0x1a')]['originCc'],'bcc':_0x3cae74[_0xcc70('0x2b')]['message'][_0xcc70('0x5c')]},{'include':[{'model':db['Attachment'],'as':_0xcc70('0x5d')}]});})[_0xcc70('0x13')](function(_0x486e59){_0x4bd1a6[_0xcc70('0x1a')]=_0x486e59;if(_0x4bd1a6[_0xcc70('0x5a')][_0xcc70('0x5e')]){return db[_0xcc70('0x5f')][_0xcc70('0x28')]({'attributes':['id',_0xcc70('0x60')],'where':{'id':_0x4bd1a6[_0xcc70('0x5a')]['UserId']}})[_0xcc70('0x13')](function(_0x35cbf0){if(_0x35cbf0){_0x4bd1a6[_0xcc70('0x43')][_0xcc70('0x61')]({'id':0x0,'priority':0x0,'app':_0xcc70('0x62'),'appdata':_0x35cbf0[_0xcc70('0x60')]+','+(_0x4bd1a6['account'][_0xcc70('0x63')]||0xa),'interval':_0xcc70('0x4a')});}return respondWithRpcPromise(_0xcc70('0x64'),_0xcc70('0x65'),_0x4bd1a6);});}return respondWithRpcPromise(_0xcc70('0x64'),_0xcc70('0x65'),_0x4bd1a6);})['then'](function(_0x18ac3d){_0x1f29f3(_0x18ac3d);})['catch'](function(_0x31cfb8){_0x1eb4a1(_0x3a31de['error'](0x1f4,_0x31cfb8[_0xcc70('0x1a')]));});});}; \ No newline at end of file +var _0x1867=['Messages','Contact\x20not\x20found','spread','update','subject','create','originTo','originCc','bcc','Attachment','Attachments','interaction','UserId','User','unshift','agent','name','Start','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowMailAccount','find','NotifyMailAccount','mail','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','CmContact','Contacts','DESC','Applications','List','get','omit','applications','orderBy','priority','asc','autoclose','push','length','close','defaults','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage'];(function(_0x8d9381,_0x3fc188){var _0x15ec14=function(_0x3fc6af){while(--_0x3fc6af){_0x8d9381['push'](_0x8d9381['shift']());}};_0x15ec14(++_0x3fc188);}(_0x1867,0x77));var _0x7186=function(_0x4d1b81,_0x31c8a4){_0x4d1b81=_0x4d1b81-0x0;var _0x12a337=_0x1867[_0x4d1b81];return _0x12a337;};'use strict';var _=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var moment=require(_0x7186('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7186('0x3'));var db=require(_0x7186('0x4'))['db'];var utils=require(_0x7186('0x5'));var logger=require(_0x7186('0x6'))(_0x7186('0x7'));var config=require('../../config/environment');var jayson=require(_0x7186('0x8'));var client=jayson[_0x7186('0x9')][_0x7186('0xa')]({'port':0x232c});config[_0x7186('0xb')]=_['defaults'](config['redis'],{'host':_0x7186('0xc'),'port':0x18eb});var socket=require(_0x7186('0xd'))(new Redis(config['redis']));require(_0x7186('0xe'))[_0x7186('0xf')](socket);function respondWithRpcPromise(_0x212722,_0xffc348,_0x220c85){return new BPromise(function(_0x51a94d,_0x599a9e){return client[_0x7186('0x10')](_0x212722,_0x220c85)[_0x7186('0x11')](function(_0x51e015){logger['info'](_0x7186('0x12'),_0xffc348,_0x7186('0x13'));logger[_0x7186('0x14')](_0x7186('0x15'),_0xffc348,_0x7186('0x13'),JSON[_0x7186('0x16')](_0x51e015));if(_0x51e015[_0x7186('0x17')]){if(_0x51e015[_0x7186('0x17')]['code']===0x1f4){logger[_0x7186('0x17')](_0x7186('0x12'),_0xffc348,_0x51e015[_0x7186('0x17')][_0x7186('0x18')]);return _0x599a9e(_0x51e015['error'][_0x7186('0x18')]);}logger[_0x7186('0x17')]('MailAccount,\x20%s,\x20%s',_0xffc348,_0x51e015['error'][_0x7186('0x18')]);return _0x51a94d(_0x51e015[_0x7186('0x17')]['message']);}else{logger[_0x7186('0x19')]('MailAccount,\x20%s,\x20%s',_0xffc348,_0x7186('0x13'));_0x51a94d(_0x51e015[_0x7186('0x1a')][_0x7186('0x18')]);}})['catch'](function(_0x2b5601){logger[_0x7186('0x17')]('MailAccount,\x20%s,\x20%s',_0xffc348,_0x2b5601);_0x599a9e(_0x2b5601);});});}exports[_0x7186('0x1b')]=function(_0x563957){var _0x37a515=this;return new Promise(function(_0x5dd4dd,_0x39485c){return db[_0x7186('0x1c')][_0x7186('0x1d')]({'raw':_0x563957[_0x7186('0x1e')]?_0x563957['options'][_0x7186('0x1f')]===undefined?!![]:![]:!![],'where':_0x563957[_0x7186('0x1e')]?_0x563957[_0x7186('0x1e')][_0x7186('0x20')]||null:null,'attributes':_0x563957[_0x7186('0x1e')]?_0x563957['options'][_0x7186('0x21')]||null:null,'limit':_0x563957[_0x7186('0x1e')]?_0x563957['options'][_0x7186('0x22')]||null:null,'include':_0x563957[_0x7186('0x1e')]?_0x563957[_0x7186('0x1e')][_0x7186('0x23')]?_[_0x7186('0x24')](_0x563957[_0x7186('0x1e')][_0x7186('0x23')],function(_0x1f90c5){return{'model':db[_0x1f90c5[_0x7186('0x25')]],'as':_0x1f90c5['as'],'attributes':_0x1f90c5['attributes'],'include':_0x1f90c5[_0x7186('0x23')]?_[_0x7186('0x24')](_0x1f90c5[_0x7186('0x23')],function(_0x1027ab){return{'model':db[_0x1027ab[_0x7186('0x25')]],'as':_0x1027ab['as'],'attributes':_0x1027ab[_0x7186('0x21')],'include':_0x1027ab['include']?_[_0x7186('0x24')](_0x1027ab[_0x7186('0x23')],function(_0xf73e8f){return{'model':db[_0xf73e8f[_0x7186('0x25')]],'as':_0xf73e8f['as'],'attributes':_0xf73e8f[_0x7186('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7186('0x11')](function(_0x22e90f){logger[_0x7186('0x19')](_0x7186('0x1b'),_0x563957);logger['debug'](_0x7186('0x1b'),_0x563957,JSON[_0x7186('0x16')](_0x22e90f));_0x5dd4dd(_0x22e90f);})[_0x7186('0x26')](function(_0x2b8b2c){logger['error']('GetMailAccount',_0x2b8b2c[_0x7186('0x18')],_0x563957);_0x39485c(_0x37a515[_0x7186('0x17')](0x1f4,_0x2b8b2c[_0x7186('0x18')]));});});};exports[_0x7186('0x27')]=function(_0x319b9e){var _0x548d41=this;return new Promise(function(_0x327ee5,_0xd1f0e6){return db[_0x7186('0x1c')][_0x7186('0x28')]({'raw':_0x319b9e[_0x7186('0x1e')]?_0x319b9e[_0x7186('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x319b9e[_0x7186('0x1e')]?_0x319b9e[_0x7186('0x1e')][_0x7186('0x20')]||null:null,'attributes':_0x319b9e[_0x7186('0x1e')]?_0x319b9e[_0x7186('0x1e')][_0x7186('0x21')]||null:null,'include':_0x319b9e[_0x7186('0x1e')]?_0x319b9e['options'][_0x7186('0x23')]?_[_0x7186('0x24')](_0x319b9e[_0x7186('0x1e')][_0x7186('0x23')],function(_0xe63ff){return{'model':db[_0xe63ff['model']],'as':_0xe63ff['as'],'attributes':_0xe63ff[_0x7186('0x21')],'include':_0xe63ff[_0x7186('0x23')]?_[_0x7186('0x24')](_0xe63ff['include'],function(_0xaa06e){return{'model':db[_0xaa06e[_0x7186('0x25')]],'as':_0xaa06e['as'],'attributes':_0xaa06e['attributes'],'include':_0xaa06e['include']?_[_0x7186('0x24')](_0xaa06e[_0x7186('0x23')],function(_0x2f3355){return{'model':db[_0x2f3355[_0x7186('0x25')]],'as':_0x2f3355['as'],'attributes':_0x2f3355[_0x7186('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16540a){logger[_0x7186('0x19')](_0x7186('0x27'),_0x319b9e);logger[_0x7186('0x14')]('ShowMailAccount',_0x319b9e,JSON[_0x7186('0x16')](_0x16540a));_0x327ee5(_0x16540a);})['catch'](function(_0x23224f){logger['error'](_0x7186('0x27'),_0x23224f[_0x7186('0x18')],_0x319b9e);_0xd1f0e6(_0x548d41[_0x7186('0x17')](0x1f4,_0x23224f[_0x7186('0x18')]));});});};exports[_0x7186('0x29')]=function(_0x7fd2af){var _0x1c848b=this;return new Promise(function(_0x28806b,_0x43a9fe){var _0x2bf42b={'body':_0x7fd2af['body'],'channel':_0x7186('0x2a')};var _0x2d94b1=_['difference'](_[_0x7186('0x2b')](db['CmContact']['rawAttributes']),[_0x7186('0x2c'),_0x7186('0x2d'),_0x7186('0x2e'),_0x7186('0x2f')]);var _0x92cfa5=![];if(_0x7fd2af[_0x7186('0x30')]['id']){delete _0x7fd2af[_0x7186('0x30')]['id'];}if(_[_0x7186('0x31')](_0x7fd2af['body'][_0x7186('0x32')])){return _0x43a9fe(_0x1c848b[_0x7186('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7186('0x31')](_0x7fd2af[_0x7186('0x30')][_0x7186('0x30')])||_0x7fd2af['body'][_0x7186('0x30')]===''){return _0x43a9fe(_0x1c848b[_0x7186('0x17')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x7186('0x31')](_0x7fd2af[_0x7186('0x30')][_0x7186('0x33')])){return _0x43a9fe(_0x1c848b[_0x7186('0x17')](0x1f4,_0x7186('0x34')+_0x2d94b1));}if(!_[_0x7186('0x35')](_0x2d94b1,_0x7fd2af[_0x7186('0x30')]['mapKey'])){return _0x43a9fe(_0x1c848b[_0x7186('0x17')](0x1f4,_0x7186('0x36')+_0x2d94b1));}var _0x3c137e={};_0x3c137e[_0x7fd2af[_0x7186('0x30')][_0x7186('0x33')]]=_0x7fd2af['body'][_0x7186('0x32')];return db[_0x7186('0x1c')][_0x7186('0x28')]({'where':{'id':_0x7fd2af[_0x7186('0x37')]['id']},'include':[{'model':db[_0x7186('0x38')],'as':'List','include':[{'model':db[_0x7186('0x39')],'as':_0x7186('0x3a'),'where':_0x3c137e,'limit':0x1,'order':[['updatedAt',_0x7186('0x3b')]]}]},{'model':db['MailApplication'],'as':_0x7186('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x7186('0x11')](function(_0x3362fe){if(_0x3362fe&&_0x3362fe[_0x7186('0x3d')]){var _0x5e0c38=_0x3362fe[_0x7186('0x3e')]({'plain':!![]});_0x2bf42b[_0x7186('0x37')]=_[_0x7186('0x3f')](_0x5e0c38,[_0x7186('0x3c'),_0x7186('0x3d')]);_0x2bf42b[_0x7186('0x40')]=_0x5e0c38[_0x7186('0x3c')];_0x2bf42b['list']=_0x5e0c38['List'];_0x2bf42b[_0x7186('0x40')]=_[_0x7186('0x41')](_0x2bf42b[_0x7186('0x40')],[_0x7186('0x42')],[_0x7186('0x43')]);if(_0x2bf42b[_0x7186('0x37')]&&_0x2bf42b[_0x7186('0x37')][_0x7186('0x44')]){_0x2bf42b[_0x7186('0x40')][_0x7186('0x45')]({'id':0x0,'priority':_0x2bf42b[_0x7186('0x40')][_0x7186('0x46')]+0x1,'app':_0x7186('0x47'),'appdata':_0x7186('0x44'),'interval':'*,*,*,*'});}if(_0x2bf42b[_0x7186('0x37')][_0x7186('0x3c')]){delete _0x2bf42b[_0x7186('0x37')]['Applications'];}if(_0x2bf42b[_0x7186('0x37')][_0x7186('0x3d')]){delete _0x2bf42b[_0x7186('0x37')][_0x7186('0x3d')];}if(_0x5e0c38[_0x7186('0x3d')][_0x7186('0x3a')][_0x7186('0x46')]){return _0x5e0c38['List'][_0x7186('0x3a')][0x0];}var _0x93e17b=_[_0x7186('0x48')](_0x7fd2af[_0x7186('0x30')],{'firstName':_0x7fd2af[_0x7186('0x30')]['from'],'ListId':_0x5e0c38['ListId']});_0x93e17b[_0x7fd2af['body']['mapKey']]=_0x7fd2af[_0x7186('0x30')][_0x7186('0x32')];return db[_0x7186('0x39')]['create'](_0x93e17b);}else{throw new Error(_0x7186('0x49'));}})[_0x7186('0x11')](function(_0xc307a9){_0x2bf42b['contact']=_0xc307a9;if(_0xc307a9){if(!_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x4a')]){_0x7fd2af['body']['message']['messageId']=rs[_0x7186('0x4b')]()+'\x20'+_0x7fd2af[_0x7186('0x30')]['message'][_0x7186('0x32')];}var _0x2099d7={'ContactId':_0xc307a9['id'],'MailAccountId':_0x7fd2af[_0x7186('0x37')]['id'],'inReplyTo':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x4a')],'to':_0x7fd2af['body'][_0x7186('0x18')][_0x7186('0x32')],'cc':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')]['cc'],'subject':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')]['subject'],'attach':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x4c')],'lastMsgAt':moment()[_0x7186('0x4d')](_0x7186('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x7fd2af[_0x7186('0x30')][_0x7186('0x30')]};return db[_0x7186('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0x7fd2af[_0x7186('0x37')]['id']},'include':[{'model':db[_0x7186('0x50')],'as':_0x7186('0x51'),'attributes':[_0x7186('0x4a')],'where':{'messageId':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')]['inReplyTo']}}]})[_0x7186('0x11')](function(_0x3516da){if(_0x3516da){return[_0x3516da,![]];}return db[_0x7186('0x4f')]['create'](_0x2099d7)['then'](function(_0x2b714f){return[_0x2b714f,!![]];});});}else{throw new Error(_0x7186('0x52'));}})[_0x7186('0x53')](function(_0x5e3b99,_0x52e4ac){if(_0x5e3b99){_0x92cfa5=_0x52e4ac;if(!_0x52e4ac){return _0x5e3b99[_0x7186('0x54')]({'inReplyTo':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x4a')],'to':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x32')],'cc':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')]['cc'],'subject':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x55')],'attach':_0x5e3b99['attach']?_0x5e3b99[_0x7186('0x4c')]:_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x4c')],'substatus':null,'substatusAt':moment()[_0x7186('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7186('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x7fd2af['body'][_0x7186('0x30')]});}else{return _0x5e3b99;}}})[_0x7186('0x11')](function(_0x338cad){_0x2bf42b['interaction']=_0x338cad['get']({'plain':!![]});_0x2bf42b['interaction']['created']=_0x92cfa5;return db['MailMessage'][_0x7186('0x56')]({'body':_0x7fd2af[_0x7186('0x30')]['body'],'MailAccountId':_0x7fd2af['account']['id'],'MailInteractionId':_0x338cad['id'],'direction':'in','ContactId':_0x2bf42b['contact']['id'],'messageId':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x4a')],'from':_0x7fd2af[_0x7186('0x30')]['message'][_0x7186('0x32')],'to':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')]['to'],'cc':_0x7fd2af[_0x7186('0x30')]['message']['cc'],'subject':_0x7fd2af['body'][_0x7186('0x18')][_0x7186('0x55')],'attach':_0x7fd2af['body'][_0x7186('0x18')][_0x7186('0x4c')],'Attachments':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')]['attachments'],'originTo':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x57')],'originCc':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x58')],'bcc':_0x7fd2af[_0x7186('0x30')][_0x7186('0x18')][_0x7186('0x59')]},{'include':[{'model':db[_0x7186('0x5a')],'as':_0x7186('0x5b')}]});})['then'](function(_0x4bf731){_0x2bf42b[_0x7186('0x18')]=_0x4bf731;if(_0x2bf42b[_0x7186('0x5c')][_0x7186('0x5d')]){return db[_0x7186('0x5e')]['find']({'attributes':['id','name'],'where':{'id':_0x2bf42b['interaction'][_0x7186('0x5d')]}})[_0x7186('0x11')](function(_0x2a96aa){if(_0x2a96aa){_0x2bf42b[_0x7186('0x40')][_0x7186('0x5f')]({'id':0x0,'priority':0x0,'app':_0x7186('0x60'),'appdata':_0x2a96aa[_0x7186('0x61')]+','+(_0x2bf42b[_0x7186('0x37')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7186('0x62'),'startRouting',_0x2bf42b);});}return respondWithRpcPromise(_0x7186('0x62'),_0x7186('0x63'),_0x2bf42b);})[_0x7186('0x11')](function(_0xd90037){_0x28806b(_0xd90037);})[_0x7186('0x26')](function(_0x30bed6){_0x43a9fe(_0x1c848b[_0x7186('0x17')](0x1f4,_0x30bed6[_0x7186('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a018531..54fac7d 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 _0xa063=['emit','register','length','mailAccount:','save','update'];(function(_0x2bf500,_0x2459fe){var _0xbb983b=function(_0x513f97){while(--_0x513f97){_0x2bf500['push'](_0x2bf500['shift']());}};_0xbb983b(++_0x2459fe);}(_0xa063,0x10c));var _0x3a06=function(_0x4a02c0,_0x5e616c){_0x4a02c0=_0x4a02c0-0x0;var _0xcc6d53=_0xa063[_0x4a02c0];return _0xcc6d53;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3a06('0x0'),'remove',_0x3a06('0x1')];function createListener(_0x11c417,_0x15b931){return function(_0x2dda5a){_0x15b931[_0x3a06('0x2')](_0x11c417,_0x2dda5a);};}function removeListener(_0x2caafb,_0x5e21db){return function(){MailAccountEvents['removeListener'](_0x2caafb,_0x5e21db);};}exports[_0x3a06('0x3')]=function(_0x18ce17){for(var _0x4082d4=0x0,_0xb0351f=events[_0x3a06('0x4')];_0x4082d4<_0xb0351f;_0x4082d4++){var _0x45a6e3=events[_0x4082d4];var _0xb0e634=createListener(_0x3a06('0x5')+_0x45a6e3,_0x18ce17);MailAccountEvents['on'](_0x45a6e3,_0xb0e634);}}; \ No newline at end of file +var _0x716f=['mailAccount:','save','remove','removeListener','register','length'];(function(_0x330075,_0x370c93){var _0x49396c=function(_0x258755){while(--_0x258755){_0x330075['push'](_0x330075['shift']());}};_0x49396c(++_0x370c93);}(_0x716f,0xcd));var _0xf716=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x716f[_0xda464c];return _0x19e222;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xf716('0x0'),_0xf716('0x1'),'update'];function createListener(_0x3e1253,_0x172be1){return function(_0xccbeb4){_0x172be1['emit'](_0x3e1253,_0xccbeb4);};}function removeListener(_0x533791,_0x299e42){return function(){MailAccountEvents[_0xf716('0x2')](_0x533791,_0x299e42);};}exports[_0xf716('0x3')]=function(_0x3a4b78){for(var _0x32da35=0x0,_0x542cc4=events[_0xf716('0x4')];_0x32da35<_0x542cc4;_0x32da35++){var _0x9f090a=events[_0x32da35];var _0x351266=createListener(_0xf716('0x5')+_0x9f090a,_0x3a4b78);MailAccountEvents['on'](_0x9f090a,_0x351266);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index af85554..7b7e7ec 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 _0x8ce3=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','update','destroy'];(function(_0x3a74d3,_0x4c85aa){var _0x4a9d5=function(_0x3f2d8d){while(--_0x3f2d8d){_0x3a74d3['push'](_0x3a74d3['shift']());}};_0x4a9d5(++_0x4c85aa);}(_0x8ce3,0xc3));var _0x38ce=function(_0x1097d7,_0x1bf6df){_0x1097d7=_0x1097d7-0x0;var _0x140177=_0x8ce3[_0x1097d7];return _0x140177;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var auth=require(_0x38ce('0x5'));var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router[_0x38ce('0x9')]('/:id',auth[_0x38ce('0xa')](),controller[_0x38ce('0xb')]);router['put'](_0x38ce('0xc'),auth[_0x38ce('0xa')](),controller[_0x38ce('0xd')]);router['delete'](_0x38ce('0xc'),auth['isAuthenticated'](),controller[_0x38ce('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcffe=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','update'];(function(_0x3619d3,_0x737674){var _0x304b86=function(_0x579856){while(--_0x579856){_0x3619d3['push'](_0x3619d3['shift']());}};_0x304b86(++_0x737674);}(_0xcffe,0x1a1));var _0xecff=function(_0x24f870,_0x2c8a88){_0x24f870=_0x24f870-0x0;var _0x5d065b=_0xcffe[_0x24f870];return _0x5d065b;};'use strict';var multer=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var timeout=require(_0xecff('0x3'));var express=require(_0xecff('0x4'));var router=express[_0xecff('0x5')]();var auth=require(_0xecff('0x6'));var interaction=require(_0xecff('0x7'));var config=require(_0xecff('0x8'));var controller=require(_0xecff('0x9'));router['get']('/:id',auth[_0xecff('0xa')](),controller[_0xecff('0xb')]);router[_0xecff('0xc')](_0xecff('0xd'),auth[_0xecff('0xa')](),controller[_0xecff('0xe')]);router[_0xecff('0xf')]('/:id',auth[_0xecff('0xa')](),controller[_0xecff('0x10')]);module[_0xecff('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a724e49..ef648f8 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 _0x3d3d=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x598393,_0x30769c){var _0xa86d6d=function(_0x324036){while(--_0x324036){_0x598393['push'](_0x598393['shift']());}};_0xa86d6d(++_0x30769c);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd3d3('0x0')]={'priority':{'type':Sequelize[_0xd3d3('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd3d3('0x2')},'appdata':{'type':Sequelize[_0xd3d3('0x3')]()},'description':{'type':Sequelize[_0xd3d3('0x4')]},'interval':{'type':Sequelize[_0xd3d3('0x4')],'defaultValue':_0xd3d3('0x5')}}; \ No newline at end of file +var _0xc599=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc599,0x1b2));var _0x9c59=function(_0x19d828,_0x2439ce){_0x19d828=_0x19d828-0x0;var _0x25b133=_0xc599[_0x19d828];return _0x25b133;};'use strict';var Sequelize=require('sequelize');module[_0x9c59('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':_0x9c59('0x2')},'appdata':{'type':Sequelize[_0x9c59('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9c59('0x1')],'defaultValue':_0x9c59('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9c218a2..9b99847 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 _0x6dda=['reject','save','update','then','error','send','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','catch','body','find','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply'];(function(_0x3d5384,_0x3b2ea9){var _0x71aac7=function(_0x4d4d53){while(--_0x4d4d53){_0x3d5384['push'](_0x3d5384['shift']());}};_0x71aac7(++_0x3b2ea9);}(_0x6dda,0x17a));var _0xa6dd=function(_0x5c71a3,_0x376e34){_0x5c71a3=_0x5c71a3-0x0;var _0x211daf=_0x6dda[_0x5c71a3];return _0x211daf;};'use strict';var pdf=require(_0xa6dd('0x0'));var emlformat=require(_0xa6dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa6dd('0x2'));var jsonpatch=require(_0xa6dd('0x3'));var rp=require(_0xa6dd('0x4'));var moment=require(_0xa6dd('0x5'));var BPromise=require(_0xa6dd('0x6'));var Mustache=require(_0xa6dd('0x7'));var util=require(_0xa6dd('0x8'));var path=require(_0xa6dd('0x9'));var sox=require(_0xa6dd('0xa'));var csv=require(_0xa6dd('0xb'));var ejs=require(_0xa6dd('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa6dd('0xd'));var crypto=require(_0xa6dd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa6dd('0xf'));var toCsv=require(_0xa6dd('0xb'));var querystring=require(_0xa6dd('0x10'));var Papa=require(_0xa6dd('0x11'));var Redis=require(_0xa6dd('0x12'));var authService=require(_0xa6dd('0x13'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xa6dd('0x14'));var logger=require(_0xa6dd('0x15'))(_0xa6dd('0x16'));var utils=require(_0xa6dd('0x17'));var config=require(_0xa6dd('0x18'));var db=require(_0xa6dd('0x19'))['db'];function respondWithStatusCode(_0x9c1749,_0x4ac569){_0x4ac569=_0x4ac569||0xcc;return function(_0x19d01f){if(_0x19d01f){return _0x9c1749[_0xa6dd('0x1a')](_0x4ac569);}return _0x9c1749[_0xa6dd('0x1b')](_0x4ac569)[_0xa6dd('0x1c')]();};}function respondWithResult(_0x52b30a,_0x5c479f){_0x5c479f=_0x5c479f||0xc8;return function(_0x4d6201){if(_0x4d6201){return _0x52b30a[_0xa6dd('0x1b')](_0x5c479f)['json'](_0x4d6201);}};}function respondWithFilteredResult(_0x6a2eec,_0x495a17){return function(_0x52ee68){if(_0x52ee68){var _0x5148c9=_0x52ee68[_0xa6dd('0x1d')],_0xb9c368=_0x495a17[_0xa6dd('0x1e')],_0x4fe167=_0x495a17['offset']+_0x495a17[_0xa6dd('0x1f')],_0x2c24ca;if(_0x4fe167>=_0x5148c9){_0x4fe167=_0x5148c9;_0x2c24ca=0xc8;}else{_0x2c24ca=0xce;}_0x6a2eec['status'](_0x2c24ca);return _0x6a2eec['set'](_0xa6dd('0x20'),_0xb9c368+'-'+_0x4fe167+'/'+_0x5148c9)[_0xa6dd('0x21')](_0x52ee68);}return null;};}function patchUpdates(_0x311aac){return function(_0x33c5dd){try{jsonpatch[_0xa6dd('0x22')](_0x33c5dd,_0x311aac,!![]);}catch(_0x4e1dce){return BPromise[_0xa6dd('0x23')](_0x4e1dce);}return _0x33c5dd[_0xa6dd('0x24')]();};}function saveUpdates(_0x10dd88,_0x2cffa4){return function(_0xc2d5a7){if(_0xc2d5a7){return _0xc2d5a7[_0xa6dd('0x25')](_0x10dd88)['then'](function(_0x202ffe){return _0x202ffe;});}return null;};}function removeEntity(_0x5c9caf,_0x3f23ee){return function(_0x425fe3){if(_0x425fe3){return _0x425fe3['destroy']()[_0xa6dd('0x26')](function(){_0x5c9caf['status'](0xcc)[_0xa6dd('0x1c')]();});}};}function handleEntityNotFound(_0x3cc4cd,_0x357875){return function(_0x52b997){if(!_0x52b997){_0x3cc4cd['sendStatus'](0x194);}return _0x52b997;};}function handleError(_0x2e01e2,_0x442f42){_0x442f42=_0x442f42||0x1f4;return function(_0x1b2d0){logger[_0xa6dd('0x27')](_0x1b2d0['stack']);if(_0x1b2d0['name']){delete _0x1b2d0['name'];}_0x2e01e2[_0xa6dd('0x1b')](_0x442f42)[_0xa6dd('0x28')](_0x1b2d0);};}exports['show']=function(_0x4d2be4,_0x5ec867){var _0x444847={'raw':!![],'where':{'id':_0x4d2be4[_0xa6dd('0x29')]['id']}},_0x26602d={};_0x26602d[_0xa6dd('0x2a')]=_[_0xa6dd('0x2b')](db[_0xa6dd('0x2c')][_0xa6dd('0x2d')]);_0x26602d['query']=_[_0xa6dd('0x2b')](_0x4d2be4[_0xa6dd('0x2e')]);_0x26602d[_0xa6dd('0x2f')]=_[_0xa6dd('0x30')](_0x26602d[_0xa6dd('0x2a')],_0x26602d['query']);_0x444847[_0xa6dd('0x31')]=_[_0xa6dd('0x30')](_0x26602d[_0xa6dd('0x2a')],qs[_0xa6dd('0x32')](_0x4d2be4[_0xa6dd('0x2e')][_0xa6dd('0x32')]));_0x444847[_0xa6dd('0x31')]=_0x444847[_0xa6dd('0x31')][_0xa6dd('0x33')]?_0x444847[_0xa6dd('0x31')]:_0x26602d['model'];if(_0x4d2be4[_0xa6dd('0x2e')][_0xa6dd('0x34')]){_0x444847[_0xa6dd('0x35')]=[{'all':!![]}];}_0x444847=_[_0xa6dd('0x36')]({},_0x444847,_0x4d2be4['options']);return db[_0xa6dd('0x2c')]['find'](_0x444847)[_0xa6dd('0x26')](handleEntityNotFound(_0x5ec867,null))[_0xa6dd('0x26')](respondWithResult(_0x5ec867,null))[_0xa6dd('0x37')](handleError(_0x5ec867,null));};exports[_0xa6dd('0x25')]=function(_0xb3b19d,_0x3952f4){if(_0xb3b19d[_0xa6dd('0x38')]['id']){delete _0xb3b19d[_0xa6dd('0x38')]['id'];}return db[_0xa6dd('0x2c')][_0xa6dd('0x39')]({'where':{'id':_0xb3b19d[_0xa6dd('0x29')]['id']}})['then'](handleEntityNotFound(_0x3952f4,null))[_0xa6dd('0x26')](saveUpdates(_0xb3b19d[_0xa6dd('0x38')],null))['then'](respondWithResult(_0x3952f4,null))[_0xa6dd('0x37')](handleError(_0x3952f4,null));};exports[_0xa6dd('0x3a')]=function(_0x27a52c,_0x290e73){return db[_0xa6dd('0x2c')][_0xa6dd('0x39')]({'where':{'id':_0x27a52c[_0xa6dd('0x29')]['id']}})[_0xa6dd('0x26')](handleEntityNotFound(_0x290e73,null))['then'](removeEntity(_0x290e73,null))['catch'](handleError(_0x290e73,null));}; \ No newline at end of file +var _0xd2d2=['ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','params','model','keys','rawAttributes','filters','intersection','query','fields','attributes','length','includeAll','include','options','MailApplication','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xd2d2,0x101));var _0x2d2d=function(_0x1463ae,_0x3e3161){_0x1463ae=_0x1463ae-0x0;var _0x56caed=_0xd2d2[_0x1463ae];return _0x56caed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d2d('0x0'));var rimraf=require(_0x2d2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d2d('0x2'));var rp=require(_0x2d2d('0x3'));var moment=require(_0x2d2d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d2d('0x5'));var util=require(_0x2d2d('0x6'));var path=require('path');var sox=require(_0x2d2d('0x7'));var csv=require('to-csv');var ejs=require(_0x2d2d('0x8'));var fs=require('fs');var _=require(_0x2d2d('0x9'));var squel=require('squel');var crypto=require(_0x2d2d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2d2d('0xb'));var toCsv=require(_0x2d2d('0xc'));var querystring=require(_0x2d2d('0xd'));var Papa=require(_0x2d2d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d2d('0xf'))('api');var utils=require(_0x2d2d('0x10'));var config=require('../../config/environment');var db=require(_0x2d2d('0x11'))['db'];function respondWithStatusCode(_0x36f172,_0x2fcbfb){_0x2fcbfb=_0x2fcbfb||0xcc;return function(_0x4f3131){if(_0x4f3131){return _0x36f172['sendStatus'](_0x2fcbfb);}return _0x36f172[_0x2d2d('0x12')](_0x2fcbfb)[_0x2d2d('0x13')]();};}function respondWithResult(_0x11e0b8,_0x46b4ef){_0x46b4ef=_0x46b4ef||0xc8;return function(_0x53b696){if(_0x53b696){return _0x11e0b8[_0x2d2d('0x12')](_0x46b4ef)['json'](_0x53b696);}};}function respondWithFilteredResult(_0xa4e627,_0x4a22eb){return function(_0x175af2){if(_0x175af2){var _0x1d91c3=_0x175af2[_0x2d2d('0x14')],_0x2756fd=_0x4a22eb[_0x2d2d('0x15')],_0x224b43=_0x4a22eb[_0x2d2d('0x15')]+_0x4a22eb[_0x2d2d('0x16')],_0x548d35;if(_0x224b43>=_0x1d91c3){_0x224b43=_0x1d91c3;_0x548d35=0xc8;}else{_0x548d35=0xce;}_0xa4e627[_0x2d2d('0x12')](_0x548d35);return _0xa4e627[_0x2d2d('0x17')](_0x2d2d('0x18'),_0x2756fd+'-'+_0x224b43+'/'+_0x1d91c3)[_0x2d2d('0x19')](_0x175af2);}return null;};}function patchUpdates(_0x40572a){return function(_0x168c21){try{jsonpatch['apply'](_0x168c21,_0x40572a,!![]);}catch(_0x52b521){return BPromise[_0x2d2d('0x1a')](_0x52b521);}return _0x168c21[_0x2d2d('0x1b')]();};}function saveUpdates(_0x521c6e,_0x4a93e2){return function(_0x202d8d){if(_0x202d8d){return _0x202d8d[_0x2d2d('0x1c')](_0x521c6e)[_0x2d2d('0x1d')](function(_0x8e6ebe){return _0x8e6ebe;});}return null;};}function removeEntity(_0x556691,_0x4d1ff9){return function(_0x49d245){if(_0x49d245){return _0x49d245[_0x2d2d('0x1e')]()['then'](function(){_0x556691[_0x2d2d('0x12')](0xcc)[_0x2d2d('0x13')]();});}};}function handleEntityNotFound(_0x13837b,_0x41d0e2){return function(_0x299cbf){if(!_0x299cbf){_0x13837b[_0x2d2d('0x1f')](0x194);}return _0x299cbf;};}function handleError(_0x5b8d27,_0x2616e1){_0x2616e1=_0x2616e1||0x1f4;return function(_0xafcc83){logger[_0x2d2d('0x20')](_0xafcc83[_0x2d2d('0x21')]);if(_0xafcc83[_0x2d2d('0x22')]){delete _0xafcc83[_0x2d2d('0x22')];}_0x5b8d27[_0x2d2d('0x12')](_0x2616e1)[_0x2d2d('0x23')](_0xafcc83);};}exports['show']=function(_0xb3c080,_0x2da8b4){var _0x3cd918={'raw':!![],'where':{'id':_0xb3c080[_0x2d2d('0x24')]['id']}},_0x1a6648={};_0x1a6648[_0x2d2d('0x25')]=_[_0x2d2d('0x26')](db['MailApplication'][_0x2d2d('0x27')]);_0x1a6648['query']=_[_0x2d2d('0x26')](_0xb3c080['query']);_0x1a6648[_0x2d2d('0x28')]=_[_0x2d2d('0x29')](_0x1a6648[_0x2d2d('0x25')],_0x1a6648[_0x2d2d('0x2a')]);_0x3cd918['attributes']=_[_0x2d2d('0x29')](_0x1a6648[_0x2d2d('0x25')],qs['fields'](_0xb3c080[_0x2d2d('0x2a')][_0x2d2d('0x2b')]));_0x3cd918[_0x2d2d('0x2c')]=_0x3cd918[_0x2d2d('0x2c')][_0x2d2d('0x2d')]?_0x3cd918[_0x2d2d('0x2c')]:_0x1a6648[_0x2d2d('0x25')];if(_0xb3c080[_0x2d2d('0x2a')][_0x2d2d('0x2e')]){_0x3cd918[_0x2d2d('0x2f')]=[{'all':!![]}];}_0x3cd918=_['merge']({},_0x3cd918,_0xb3c080[_0x2d2d('0x30')]);return db[_0x2d2d('0x31')][_0x2d2d('0x32')](_0x3cd918)[_0x2d2d('0x1d')](handleEntityNotFound(_0x2da8b4,null))[_0x2d2d('0x1d')](respondWithResult(_0x2da8b4,null))[_0x2d2d('0x33')](handleError(_0x2da8b4,null));};exports[_0x2d2d('0x1c')]=function(_0x2409e9,_0x22a8dc){if(_0x2409e9['body']['id']){delete _0x2409e9['body']['id'];}return db[_0x2d2d('0x31')][_0x2d2d('0x32')]({'where':{'id':_0x2409e9['params']['id']}})['then'](handleEntityNotFound(_0x22a8dc,null))['then'](saveUpdates(_0x2409e9[_0x2d2d('0x34')],null))[_0x2d2d('0x1d')](respondWithResult(_0x22a8dc,null))[_0x2d2d('0x33')](handleError(_0x22a8dc,null));};exports[_0x2d2d('0x1e')]=function(_0xbc7ff2,_0x306b19){return db[_0x2d2d('0x31')]['find']({'where':{'id':_0xbc7ff2[_0x2d2d('0x24')]['id']}})[_0x2d2d('0x1d')](handleEntityNotFound(_0x306b19,null))[_0x2d2d('0x1d')](removeEntity(_0x306b19,null))['catch'](handleError(_0x306b19,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c11cbbe..e6c9339 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 _0x0c1c=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','./mailApplication.attributes','exports'];(function(_0x3e8de2,_0x468431){var _0x56b736=function(_0x32da9b){while(--_0x32da9b){_0x3e8de2['push'](_0x3e8de2['shift']());}};_0x56b736(++_0x468431);}(_0x0c1c,0xd5));var _0xc0c1=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x0c1c[_0x8dc04d];return _0x2f5f28;};'use strict';var _=require(_0xc0c1('0x0'));var util=require('util');var logger=require(_0xc0c1('0x1'))(_0xc0c1('0x2'));var moment=require('moment');var BPromise=require(_0xc0c1('0x3'));var rp=require(_0xc0c1('0x4'));var fs=require('fs');var path=require(_0xc0c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc0c1('0x6'));module[_0xc0c1('0x7')]=function(_0x2a2c19,_0x163041){return _0x2a2c19[_0xc0c1('0x8')](_0xc0c1('0x9'),attributes,{'tableName':_0xc0c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0c1('0xb'),'collate':_0xc0c1('0xc')});}; \ No newline at end of file +var _0x4f7a=['utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailApplication.attributes','mail_applications','utf8mb4'];(function(_0x46b11f,_0x4d19f4){var _0x24699c=function(_0xac1baa){while(--_0xac1baa){_0x46b11f['push'](_0x46b11f['shift']());}};_0x24699c(++_0x4d19f4);}(_0x4f7a,0x105));var _0xa4f7=function(_0x198314,_0xa336f9){_0x198314=_0x198314-0x0;var _0x2f58c2=_0x4f7a[_0x198314];return _0x2f58c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4f7('0x0'))(_0xa4f7('0x1'));var moment=require(_0xa4f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4f7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4f7('0x4'));var config=require(_0xa4f7('0x5'));var attributes=require(_0xa4f7('0x6'));module['exports']=function(_0x31c8ab,_0x1d7c51){return _0x31c8ab['define']('MailApplication',attributes,{'tableName':_0xa4f7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4f7('0x8'),'collate':_0xa4f7('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ba4294e..176e373 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 _0x9957=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','lodash','util','moment'];(function(_0xe9e1a,_0x3b0917){var _0x1f2005=function(_0x2281f8){while(--_0x2281f8){_0xe9e1a['push'](_0xe9e1a['shift']());}};_0x1f2005(++_0x3b0917);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('MailApplication,\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['MailApplication'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291317['options']?_0x291317[_0x7995('0x1a')]['where']||null:null,'attributes':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1c')]||null:null,'limit':_0x291317[_0x7995('0x1a')]?_0x291317[_0x7995('0x1a')][_0x7995('0x1d')]||null:null})[_0x7995('0xc')](function(_0x5d40ae){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x5d40ae));_0x37a7d4(_0x5d40ae);})[_0x7995('0x17')](function(_0x475351){logger[_0x7995('0x13')]('UpdateMailApplication',_0x475351[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x475351[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xd6902,_0x39c07e){var _0x4d30ec=function(_0x1c40cf){while(--_0x1c40cf){_0xd6902['push'](_0xd6902['shift']());}};_0x4d30ec(++_0x39c07e);}(_0x7a54,0x106));var _0x47a5=function(_0x13102c,_0x1edddf){_0x13102c=_0x13102c-0x0;var _0x52b3f8=_0x7a54[_0x13102c];return _0x52b3f8;};'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')]('MailApplication,\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['UpdateMailApplication']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateMailApplication',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e0df935..1e1f505 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 _0x008c=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','post','create','addMessage','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','destroy'];(function(_0x5ddda9,_0x4fd640){var _0x1b2397=function(_0x5000c5){while(--_0x5000c5){_0x5ddda9['push'](_0x5ddda9['shift']());}};_0x1b2397(++_0x4fd640);}(_0x008c,0x188));var _0xc008=function(_0x273613,_0x33c414){_0x273613=_0x273613-0x0;var _0x416e5f=_0x008c[_0x273613];return _0x416e5f;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xc008('0x10'),auth[_0xc008('0xa')](),controller['download']);router[_0xc008('0x11')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x11')](_0xc008('0xf'),auth[_0xc008('0xa')](),controller[_0xc008('0x13')]);router['post']('/:id/tags',auth[_0xc008('0xa')](),interaction['tracked'](_0xc008('0x14'),_0xc008('0x15')),controller[_0xc008('0x16')]);router[_0xc008('0x17')](_0xc008('0xe'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xc008('0x18')),controller[_0xc008('0x19')]);router[_0xc008('0x1a')](_0xc008('0xe'),auth['isAuthenticated'](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0xc008('0x1b')]);router[_0xc008('0x1a')]('/:id/tags',auth[_0xc008('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x8ef6=['../../components/auth/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router'];(function(_0x595d8e,_0x3879ec){var _0x4d936d=function(_0x479c60){while(--_0x479c60){_0x595d8e['push'](_0x595d8e['shift']());}};_0x4d936d(++_0x3879ec);}(_0x8ef6,0xf2));var _0x68ef=function(_0x744865,_0x4801ab){_0x744865=_0x744865-0x0;var _0x241ed1=_0x8ef6[_0x744865];return _0x241ed1;};'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('0x9')](_0x68ef('0x11'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')]('/',auth['isAuthenticated'](),controller[_0x68ef('0x14')]);router[_0x68ef('0x13')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x15')]);router[_0x68ef('0x13')]('/:id/tags',auth[_0x68ef('0xa')](),interaction[_0x68ef('0x16')](_0x68ef('0x17'),'mailinteraction:addtags'),controller[_0x68ef('0x18')]);router[_0x68ef('0x19')](_0x68ef('0xd'),auth['isAuthenticated'](),interaction[_0x68ef('0x16')](_0x68ef('0x17'),_0x68ef('0x1a')),controller[_0x68ef('0x1b')]);router['delete'](_0x68ef('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x68ef('0x17'),_0x68ef('0x1c')),controller['destroy']);router['delete'](_0x68ef('0x1d'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 48d36ff..521a852 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 _0xd9fd=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','iconv'];(function(_0xc4f7c0,_0x3d731b){var _0x479501=function(_0x36a2cd){while(--_0x36a2cd){_0xc4f7c0['push'](_0xc4f7c0['shift']());}};_0x479501(++_0x3d731b);}(_0xd9fd,0x1e7));var _0xdd9f=function(_0x137ee6,_0xbaf784){_0x137ee6=_0x137ee6-0x0;var _0x2c11bd=_0xd9fd[_0x137ee6];return _0x2c11bd;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xdd9f('0x0'));module['exports']={'closed':{'type':Sequelize[_0xdd9f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdd9f('0x2')]},'disposition':{'type':Sequelize[_0xdd9f('0x3')]},'note':{'type':Sequelize[_0xdd9f('0x3')]},'inReplyTo':{'type':Sequelize[_0xdd9f('0x3')](0x1fe)},'to':{'type':Sequelize[_0xdd9f('0x3')]},'cc':{'type':Sequelize[_0xdd9f('0x4')](_0xdd9f('0x5'))},'subject':{'type':Sequelize[_0xdd9f('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdd9f('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdd9f('0x6')]('in',_0xdd9f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdd9f('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xdd9f('0x4')](_0xdd9f('0x5'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xdd9f('0x5'))}}; \ No newline at end of file +var _0x5518=['long','ENUM','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x346ab6,_0x3c50e8){var _0x5f3ff0=function(_0x12d7a3){while(--_0x12d7a3){_0x346ab6['push'](_0x346ab6['shift']());}};_0x5f3ff0(++_0x3c50e8);}(_0x5518,0xbf));var _0x8551=function(_0x2ad73d,_0xef509e){_0x2ad73d=_0x2ad73d-0x0;var _0x4f1ec2=_0x5518[_0x2ad73d];return _0x4f1ec2;};'use strict';var Sequelize=require(_0x8551('0x0'));var iconv=require(_0x8551('0x1'));module[_0x8551('0x2')]={'closed':{'type':Sequelize[_0x8551('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8551('0x4')]},'disposition':{'type':Sequelize[_0x8551('0x5')]},'note':{'type':Sequelize[_0x8551('0x5')]},'inReplyTo':{'type':Sequelize[_0x8551('0x5')](0x1fe)},'to':{'type':Sequelize[_0x8551('0x5')]},'cc':{'type':Sequelize[_0x8551('0x6')](_0x8551('0x7'))},'subject':{'type':Sequelize[_0x8551('0x6')]()},'attach':{'type':Sequelize[_0x8551('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x8551('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x8551('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8551('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8551('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x8551('0x7'))},'lastMsgText':{'type':Sequelize[_0x8551('0x6')](_0x8551('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b0d539c..2b633e9 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','keyBy','merge','a.key','Account.key','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.substatus','i.to','i.ContactId','Contact.firstName','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','enableEmailPreview','all','rows','show','params','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','emit','removeTags','unix','root','server','files','join','tmp','interaction-%s.zip','bcc','attachments','Attachment','Attachments','mkdirSync','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','writeFileSync','message%d.eml','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','closed','unreadMessages','MailMessage','Users','map','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgText','trimStart','lastMsgBody','catch','index','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','COUNT(*)','mail_messages','me.MailInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','expr','parse','createdAt','value','startOf','day','utc','and','isArray','TagId','Messages.count','\x20IN\x20?','tableAlias','\x20=\x20?','LIKE','c.lastName','c.email','\x20LIKE\x20?','\x20>\x20?','\x20<\x20?','condition','ContactId','c.firstName','isNil','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','toString','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','clone','advancedFilter','read','format','%s\x20=\x200','having','`Messages.count`\x20>\x200','tag','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','t.id\x20IN\x20?','`Messages.count`\x20=\x200'];(function(_0x795828,_0x329367){var _0x30b038=function(_0x497634){while(--_0x497634){_0x795828['push'](_0x795828['shift']());}};_0x30b038(++_0x329367);}(_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 htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=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(){_0xfb6e48[_0x0a9e('0x1c')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x5ea472,_0x59181e){return function(_0x197ec0){if(!_0x197ec0){_0x5ea472[_0x0a9e('0x1a')](0x194);}return _0x197ec0;};}function handleError(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0x1f4;return function(_0x526cf3){logger[_0x0a9e('0x28')](_0x526cf3['stack']);if(_0x526cf3[_0x0a9e('0x29')]){delete _0x526cf3['name'];}_0x40c424[_0x0a9e('0x1c')](_0x33161b)[_0x0a9e('0x2a')](_0x526cf3);};}function getInteractionUnreadMessages(_0x25fba9){return new BPromise(function(_0x14433c,_0x140511){try{if(_0x25fba9[_0x0a9e('0x2b')]){_0x25fba9[_0x0a9e('0x2c')]=0x0;_0x14433c(_0x25fba9);}else{return db[_0x0a9e('0x2d')]['count']({'where':{'MailInteractionId':_0x25fba9['id'],'direction':'in','read':![]}})[_0x0a9e('0x26')](function(_0x468813){_0x25fba9[_0x0a9e('0x2c')]=_0x468813;_0x14433c(_0x25fba9);});}}catch(_0x2ec755){_0x140511(_0x2ec755);}});}function getInteractionUsers(_0x5c877d,_0x15b200){return new BPromise(function(_0x40e7a3,_0x1843b2){try{if(_0x15b200[_0x5c877d['id']]){_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x15b200[_0x5c877d['id']],function(_0x563b45){return{'id':_0x563b45['id']};});}}catch(_0x296f41){_0x1843b2(_0x296f41);}_0x40e7a3(_0x5c877d);});}function getInteractionTags(_0x2e8759,_0x1dbde2){return new BPromise(function(_0x540530,_0x426950){try{if(_0x2e8759['TagIds']){_0x2e8759[_0x0a9e('0x30')]=[];_0x2e8759[_0x0a9e('0x31')][_0x0a9e('0x32')](',')[_0x0a9e('0x33')](function(_0x25ce3a){_0x2e8759['Tags'][_0x0a9e('0x34')](_0x1dbde2[_0x25ce3a]);});}delete _0x2e8759[_0x0a9e('0x31')];}catch(_0x40cb85){_0x426950(_0x40cb85);}_0x540530(_0x2e8759);});}function getLastMessageText(_0x2da5c0){return new BPromise(function(_0x2b45ea,_0x409319){return db[_0x0a9e('0x35')][_0x0a9e('0x36')]({'where':{'id':_0x2da5c0['id']},'attributes':['lastMsgBody',_0x0a9e('0x37')],'raw':!![]})['then'](function(_0x2cc7a0){if(!_0x2cc7a0[_0x0a9e('0x37')]){_0x2da5c0[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](htmlToText['fromString'](_0x2cc7a0[_0x0a9e('0x39')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2da5c0[_0x0a9e('0x37')]=_0x2cc7a0[_0x0a9e('0x37')];}_0x2b45ea(_0x2da5c0);})[_0x0a9e('0x3a')](function(_0x4853b1){_0x409319(_0x4853b1);});});}function updateMailInteraction(_0x54135e,_0x1e8694,_0x5640eb,_0x24936a){return new BPromise(function(_0x3d9717,_0x381c37){return getInteractionUnreadMessages(_0x54135e)[_0x0a9e('0x26')](function(_0x4f41ae){return getInteractionUsers(_0x4f41ae,_0x5640eb);})[_0x0a9e('0x26')](function(_0x3bfce8){return getInteractionTags(_0x3bfce8,_0x1e8694);})[_0x0a9e('0x26')](function(_0x533942){if(_0x24936a){_0x3d9717(getLastMessageText(_0x533942));}else{_0x3d9717(_0x533942);}})[_0x0a9e('0x3a')](function(_0x1a180b){_0x381c37(_0x1a180b);});});}exports[_0x0a9e('0x3b')]=function(_0x4c1c0e,_0x546ef8){var _0x11b61d={},_0x40d766={},_0x5adda1={'count':0x0,'rows':[]};var _0x2b814e=db[_0x0a9e('0x35')][_0x0a9e('0x3c')];_0x40d766[_0x0a9e('0x3d')]=_['keys'](_0x2b814e);_0x40d766['query']=_[_0x0a9e('0x3e')](_0x4c1c0e[_0x0a9e('0x3f')]);_0x40d766['filters']=_[_0x0a9e('0x40')](_0x40d766[_0x0a9e('0x3d')],_0x40d766[_0x0a9e('0x3f')]);_0x11b61d['attributes']=_[_0x0a9e('0x40')](_0x40d766[_0x0a9e('0x3d')],qs[_0x0a9e('0x41')](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x41')]));_0x11b61d[_0x0a9e('0x42')]=_0x11b61d[_0x0a9e('0x42')][_0x0a9e('0x43')]?_0x11b61d[_0x0a9e('0x42')]:_0x40d766[_0x0a9e('0x3d')];if(!_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x11b61d[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4c1c0e['query']['limit']);_0x11b61d[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x1f')]);}_0x11b61d[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x47')]);_0x11b61d[_0x0a9e('0x48')]=qs[_0x0a9e('0x49')](_[_0x0a9e('0x4a')](_0x4c1c0e[_0x0a9e('0x3f')],_0x40d766['filters']));var _0x117c99=[];var _0x138b8b=squel[_0x0a9e('0x4b')]()[_0x0a9e('0x4c')]('id')[_0x0a9e('0x4c')](_0x0a9e('0x29'))[_0x0a9e('0x4c')](_0x0a9e('0x4d'))['from'](_0x0a9e('0x4e'));var _0x48fd45=squel[_0x0a9e('0x4b')]()[_0x0a9e('0x4c')](_0x0a9e('0x4f'))['from'](_0x0a9e('0x50'),'me')[_0x0a9e('0x48')](_0x0a9e('0x51'))[_0x0a9e('0x48')](_0x0a9e('0x52'))[_0x0a9e('0x48')](_0x0a9e('0x53'));var _0x5bbcde=squel[_0x0a9e('0x4b')]()[_0x0a9e('0x4c')](_0x0a9e('0x54'))[_0x0a9e('0x4c')](_0x0a9e('0x55'))[_0x0a9e('0x56')](_0x0a9e('0x57'),'ui')[_0x0a9e('0x58')](_0x0a9e('0x59'),'u','u.id\x20=\x20ui.UserId');var _0xe401a=squel[_0x0a9e('0x4b')]()['from']('mail_interactions','i')['left_join'](_0x0a9e('0x5a'),'c',_0x0a9e('0x5b'))[_0x0a9e('0x58')](_0x0a9e('0x59'),'o',_0x0a9e('0x5c'))[_0x0a9e('0x58')](_0x0a9e('0x5d'),'a',_0x0a9e('0x5e'))['left_join']('mail_messages','me','me.MailInteractionId\x20=\x20i.id');var _0x39d77d=squel[_0x0a9e('0x5f')]();if(_0x4c1c0e[_0x0a9e('0x3f')]['advancedFilter']){var _0x5fd5db=JSON[_0x0a9e('0x60')](_0x4c1c0e['query']['advancedFilter']);_[_0x0a9e('0x3e')](_0x5fd5db)['forEach'](function(_0x443e72){var _0x4c3845=_0x5fd5db[_0x443e72];if(_0x443e72===_0x0a9e('0x61')){var _0x3c20b2=moment(_0x4c3845[_0x0a9e('0x62')]['dateStart'])[_0x0a9e('0x63')](_0x0a9e('0x64'))['utc']()['format']();var _0x128aa6=moment(_0x128aa6)[_0x0a9e('0x65')]()['endOf'](_0x0a9e('0x64'))['format']();_0x39d77d[_0x0a9e('0x66')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3c20b2,_0x128aa6);}else{if(_[_0x0a9e('0x67')](_0x4c3845['condition'])){_0x4c3845['condition']['forEach'](function(_0x2da03c){switch(_0x4c3845['condition'][_0x0a9e('0x62')]){case'IS':if(_0x443e72!==_0x0a9e('0x68')&&_0x443e72!==_0x0a9e('0x69')){if(_[_0x0a9e('0x67')](_0x4c3845[_0x0a9e('0x62')])&&_0x4c3845[_0x0a9e('0x62')][_0x0a9e('0x43')]>0x1){_0x39d77d[_0x0a9e('0x66')](_0x4c3845['tableAlias']+'.'+_0x443e72+_0x0a9e('0x6a'),_0x4c3845[_0x0a9e('0x62')]);}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x6c'),_0x4c3845[_0x0a9e('0x62')][0x0]);}}break;case'=':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x6c'),_0x4c3845['value']);break;case _0x0a9e('0x6d'):if(_0x443e72==='ContactId'){_0x39d77d[_0x0a9e('0x66')]('c.firstName'+'\x20LIKE\x20?','%'+_0x4c3845['value']+'%');_0x39d77d['or'](_0x0a9e('0x6e')+'\x20LIKE\x20?','%'+_0x4c3845[_0x0a9e('0x62')]+'%');_0x39d77d['or'](_0x0a9e('0x6f')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+'\x20LIKE\x20?','%'+_0x4c3845[_0x0a9e('0x62')]+'%');}break;case'>':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x71'),_0x4c3845[_0x0a9e('0x62')]);break;case'<':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x72'),_0x4c3845[_0x0a9e('0x62')]);break;}});}else{switch(_0x4c3845[_0x0a9e('0x73')]['value']){case'IS':if(_0x443e72!==_0x0a9e('0x68')&&_0x443e72!==_0x0a9e('0x69')){if(_['isArray'](_0x4c3845[_0x0a9e('0x62')])&&_0x4c3845[_0x0a9e('0x62')][_0x0a9e('0x43')]>0x1){_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+'\x20IN\x20?',_0x4c3845[_0x0a9e('0x62')]);}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+'\x20=\x20?',_0x4c3845[_0x0a9e('0x62')][0x0]);}}break;case'=':_0x39d77d['and'](_0x4c3845['tableAlias']+'.'+_0x443e72+_0x0a9e('0x6c'),_0x4c3845[_0x0a9e('0x62')]);break;case _0x0a9e('0x6d'):if(_0x443e72===_0x0a9e('0x74')){_0x39d77d[_0x0a9e('0x66')](_0x0a9e('0x75')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');_0x39d77d['or'](_0x0a9e('0x6e')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');_0x39d77d['or'](_0x0a9e('0x6f')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');}break;case'>':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x71'),_0x4c3845[_0x0a9e('0x62')]);break;case'<':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x72'),_0x4c3845['value']);break;}}}});}else{var _0x83f0b2=_(Object[_0x0a9e('0x3e')](_0x4c1c0e[_0x0a9e('0x3f')]))[_0x0a9e('0x2f')](function(_0x13b5c0){return _0x2b814e['hasOwnProperty'](_0x13b5c0)?_0x13b5c0:undefined;})['filter'](function(_0x4a2438){return!_[_0x0a9e('0x76')](_0x4a2438);})[_0x0a9e('0x62')]();if(!_[_0x0a9e('0x77')](_0x83f0b2)){_0x83f0b2[_0x0a9e('0x33')](function(_0x6abd03){if(_0x6abd03===_0x0a9e('0x78')){_0xe401a[_0x0a9e('0x48')](_0x0a9e('0x79'),[]['concat'](_0x4c1c0e[_0x0a9e('0x3f')][_0x6abd03]));}else if(_0x6abd03===_0x0a9e('0x61')){var _0x12ccdb=JSON['parse'](_0x4c1c0e[_0x0a9e('0x3f')][_0x6abd03])['$gte'];var _0x4437ff=JSON[_0x0a9e('0x60')](_0x4c1c0e['query'][_0x6abd03])[_0x0a9e('0x7a')];_0xe401a[_0x0a9e('0x48')](_0x0a9e('0x7b'),_0x12ccdb,_0x4437ff);}else{if(_0x4c1c0e[_0x0a9e('0x3f')][_0x6abd03]==='null'){_0xe401a[_0x0a9e('0x48')]('i.'+_0x6abd03+_0x0a9e('0x7c'));}else{_0xe401a[_0x0a9e('0x48')]('i.'+_0x6abd03+_0x0a9e('0x6c'),_0x4c1c0e['query'][_0x6abd03]);}}});}if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x7d')]){var _0x2d5506=_0x4c1c0e[_0x0a9e('0x3f')]['filter'][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')]('\x27\x27',_0x0a9e('0x7f'));if(qs[_0x0a9e('0x80')](_0x2d5506)){_0x39d77d['or'](_0x0a9e('0x81'),_0x2d5506+'%');}else if(qs[_0x0a9e('0x82')](_0x2d5506)){_0x39d77d['or'](_0x0a9e('0x83'),_0x2d5506+'%');}else{var _0x3df0e3=[];_0x2d5506[_0x0a9e('0x32')]('\x20')[_0x0a9e('0x33')](function(_0xc4c230){_0x3df0e3[_0x0a9e('0x34')]('+'+_0xc4c230[_0x0a9e('0x84')]());});var _0xe0749e=_0x3df0e3['join']('\x20');_0x39d77d['or'](_0x0a9e('0x85'),_0xe0749e)['or'](_0x0a9e('0x86'),_0xe0749e);}}}_0xe401a[_0x0a9e('0x48')](_0x39d77d);if(_0x11b61d['order']){_0x11b61d[_0x0a9e('0x46')][_0x0a9e('0x33')](function(_0x8cea96){_0xe401a[_0x0a9e('0x46')]('i.'+_0x8cea96[0x0],_0x8cea96[0x1]==='DESC'?![]:!![]);});}_0xe401a['group'](_0x0a9e('0x87'));var _0x2bbdb5={'type':db['Sequelize'][_0x0a9e('0x88')]['SELECT'],'raw':!![]};var _0x260f4b=_0xe401a[_0x0a9e('0x89')]()['field'](_0x0a9e('0x4f'));if(!_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8a')]){if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8b')]){if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8b')]==0x1){_0x260f4b['where'](util[_0x0a9e('0x8c')](_0x0a9e('0x8d'),_0x48fd45[_0x0a9e('0x84')]()));_0xe401a[_0x0a9e('0x8e')]('`Messages.count`\x20=\x200');}else{_0x260f4b[_0x0a9e('0x48')](util[_0x0a9e('0x8c')]('%s\x20>\x200',_0x48fd45[_0x0a9e('0x84')]()));_0xe401a['having'](_0x0a9e('0x8f'));}}if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x90')]){var _0x385d52=_['isArray'](_0x4c1c0e['query'][_0x0a9e('0x90')])?_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x90')]:new Array(_0x4c1c0e['query'][_0x0a9e('0x90')]);var _0x36e975=squel['expr']();_0x385d52['forEach'](function(_0xf0a802){_0x36e975['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf0a802+',%');});_0xe401a['having'](_0x36e975);_0x260f4b['left_join'](_0x0a9e('0x91'),'it',_0x0a9e('0x92'));_0x260f4b[_0x0a9e('0x58')](_0x0a9e('0x4e'),'t',_0x0a9e('0x93'));_0x260f4b[_0x0a9e('0x48')]('t.id\x20IN\x20?',_0x385d52);}}else{var _0x5fd5db=JSON['parse'](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8a')]);_[_0x0a9e('0x3e')](_0x5fd5db)[_0x0a9e('0x33')](function(_0x50f8d7){var _0x46c9ac=_0x5fd5db[_0x50f8d7];if(_0x50f8d7===_0x0a9e('0x68')){var _0x1d4877=_0x46c9ac['value'];var _0xb6e411=squel[_0x0a9e('0x5f')]();_0x1d4877[_0x0a9e('0x33')](function(_0x22063c){_0xb6e411['or'](_0x0a9e('0x94'),'%,'+_0x22063c+',%');});_0xe401a[_0x0a9e('0x8e')](_0xb6e411);_0x260f4b[_0x0a9e('0x58')](_0x0a9e('0x91'),'it','it.MailInteractionId\x20=\x20i.id');_0x260f4b[_0x0a9e('0x58')](_0x0a9e('0x4e'),'t','t.id\x20=\x20it.TagId');_0x260f4b[_0x0a9e('0x48')](_0x0a9e('0x95'),_0x1d4877);}else if(_0x50f8d7===_0x0a9e('0x69')){if(_0x46c9ac['value'][_0x0a9e('0x43')]===0x1){if(_0x46c9ac['value'][0x0]===0x1){_0x260f4b[_0x0a9e('0x48')](util[_0x0a9e('0x8c')](_0x0a9e('0x8d'),_0x48fd45[_0x0a9e('0x84')]()));_0xe401a[_0x0a9e('0x8e')](_0x0a9e('0x96'));}else{_0x260f4b[_0x0a9e('0x48')](util[_0x0a9e('0x8c')]('%s\x20>\x200',_0x48fd45[_0x0a9e('0x84')]()));_0xe401a[_0x0a9e('0x8e')](_0x0a9e('0x8f'));}}}});}db[_0x0a9e('0x97')][_0x0a9e('0x3f')](_0x260f4b[_0x0a9e('0x84')](),_0x2bbdb5)[_0x0a9e('0x26')](function(_0x33f0c9){_0x5adda1[_0x0a9e('0x1e')]=_0x33f0c9[_0x0a9e('0x43')];if(_0x5adda1[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x97')][_0x0a9e('0x3f')](_0x138b8b['toString'](),_0x2bbdb5)[_0x0a9e('0x26')](function(_0x23e2bd){_0x117c99=_[_0x0a9e('0x98')](_0x23e2bd,'id');_0x2bbdb5=_[_0x0a9e('0x99')](_0x2bbdb5,{'model':db[_0x0a9e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});_0xe401a['field'](_0x0a9e('0x9a'),_0x0a9e('0x9b'));_0xe401a['field'](_0x0a9e('0x87'));_0xe401a['field'](_0x0a9e('0x9c'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x9d'));_0xe401a[_0x0a9e('0x4c')]('i.closed');_0xe401a[_0x0a9e('0x4c')]('i.closedAt');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x9e'));_0xe401a['field'](_0x0a9e('0x9f'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa0'));_0xe401a['field']('i.subject');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa1'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa2'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa3'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa4'));_0xe401a[_0x0a9e('0x4c')]('i.MailAccountId');_0xe401a[_0x0a9e('0x4c')]('i.UserId');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x75'),_0x0a9e('0xa5'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x6e'),'Contact.lastName');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x6f'),_0x0a9e('0xa6'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa7'),'Contact.phone');_0xe401a['field'](_0x0a9e('0xa8'),'Contact.mobile');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa9'),_0x0a9e('0xaa'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xab'),_0x0a9e('0x31'));_0xe401a['left_join']('mail_interaction_has_tags','it',_0x0a9e('0x92'));_0xe401a['left_join'](_0x0a9e('0x4e'),'t','t.id\x20=\x20it.TagId');_0xe401a[_0x0a9e('0x20')](_0x11b61d['limit']);_0xe401a['offset'](_0x11b61d[_0x0a9e('0x1f')]);return db[_0x0a9e('0x97')]['query'](_0xe401a[_0x0a9e('0x84')](),_0x2bbdb5);})[_0x0a9e('0x26')](function(_0x15c6b9){_0x5bbcde[_0x0a9e('0x48')](_0x0a9e('0xac'),_['map'](_0x15c6b9,'id'));return db['sequelize'][_0x0a9e('0x3f')](_0x5bbcde[_0x0a9e('0x84')](),_0x2bbdb5)[_0x0a9e('0x26')](function(_0x24beb6){var _0x59303b=_['groupBy'](_0x24beb6,_0x0a9e('0xad'));var _0xadce3d=[];return db['Setting'][_0x0a9e('0x36')]({'attributes':[_0x0a9e('0xae')],'raw':!![]})[_0x0a9e('0x26')](function(_0x2427d5){var _0x23b25b=_0x2427d5[_0x0a9e('0xae')];_0x15c6b9[_0x0a9e('0x33')](function(_0x476993){_0xadce3d[_0x0a9e('0x34')](updateMailInteraction(_0x476993,_0x117c99,_0x59303b,_0x23b25b));});return BPromise[_0x0a9e('0xaf')](_0xadce3d);});});});})['then'](function(_0x1065a7){_0x5adda1[_0x0a9e('0xb0')]=_0x1065a7;return _0x5adda1;})[_0x0a9e('0x26')](respondWithFilteredResult(_0x546ef8,_0x11b61d))[_0x0a9e('0x3a')](handleError(_0x546ef8,null));};exports[_0x0a9e('0xb1')]=function(_0x547e37,_0x500868){var _0x21902c={'raw':![],'where':{'id':_0x547e37[_0x0a9e('0xb2')]['id']}},_0x16ae1a={};_0x16ae1a[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](db['MailInteraction'][_0x0a9e('0x3c')]);_0x16ae1a[_0x0a9e('0x3f')]=_[_0x0a9e('0x3e')](_0x547e37['query']);_0x16ae1a[_0x0a9e('0x49')]=_['intersection'](_0x16ae1a[_0x0a9e('0x3d')],_0x16ae1a['query']);_0x21902c[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x16ae1a[_0x0a9e('0x3d')],qs['fields'](_0x547e37[_0x0a9e('0x3f')]['fields']));_0x21902c[_0x0a9e('0x42')]=_0x21902c[_0x0a9e('0x42')][_0x0a9e('0x43')]?_0x21902c[_0x0a9e('0x42')]:_0x16ae1a[_0x0a9e('0x3d')];if(_0x547e37[_0x0a9e('0x3f')][_0x0a9e('0xb3')]){_0x21902c[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x21902c=_[_0x0a9e('0x99')]({},_0x21902c,_0x547e37[_0x0a9e('0xb5')]);return db[_0x0a9e('0x35')][_0x0a9e('0xb6')](_0x21902c)[_0x0a9e('0x26')](handleEntityNotFound(_0x500868,null))[_0x0a9e('0x26')](respondWithResult(_0x500868,null))[_0x0a9e('0x3a')](handleError(_0x500868,null));};exports[_0x0a9e('0xb7')]=function(_0x5b93dd,_0x556443){return db[_0x0a9e('0x35')]['create'](_0x5b93dd[_0x0a9e('0xb8')],{})[_0x0a9e('0x26')](respondWithResult(_0x556443,0xc9))['catch'](handleError(_0x556443,null));};exports[_0x0a9e('0x25')]=function(_0xe2b083,_0x387bbe){if(_0xe2b083[_0x0a9e('0xb8')]['id']){delete _0xe2b083['body']['id'];}return db[_0x0a9e('0x35')][_0x0a9e('0xb6')]({'where':{'id':_0xe2b083[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x387bbe,null))['then'](saveUpdates(_0xe2b083[_0x0a9e('0xb8')],null))[_0x0a9e('0x26')](respondWithResult(_0x387bbe,null))[_0x0a9e('0x3a')](handleError(_0x387bbe,null));};exports['destroy']=function(_0x2650eb,_0x270df8){return db[_0x0a9e('0x35')]['find']({'where':{'id':_0x2650eb[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x270df8,null))[_0x0a9e('0x26')](removeEntity(_0x270df8,null))[_0x0a9e('0x3a')](handleError(_0x270df8,null));};exports[_0x0a9e('0xb9')]=function(_0x555780,_0x3211d2){return db[_0x0a9e('0x35')]['describe']()[_0x0a9e('0x26')](respondWithResult(_0x3211d2,null))[_0x0a9e('0x3a')](handleError(_0x3211d2,null));};exports[_0x0a9e('0xba')]=function(_0x5822a7,_0x5c3b6f,_0x523d08){return db[_0x0a9e('0x2d')][_0x0a9e('0xb6')]({'where':{'id':_0x5822a7['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5c3b6f,null))[_0x0a9e('0x26')](function(_0x2a8d55){if(_0x2a8d55){return _0x2a8d55['addMessage'](_0x5822a7[_0x0a9e('0xb8')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x5822a7[_0x0a9e('0xb8')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x26')](respondWithResult(_0x5c3b6f,null))[_0x0a9e('0x3a')](handleError(_0x5c3b6f,null));};exports[_0x0a9e('0xbd')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7={'raw':![],'where':{}};var _0x138cf5={};var _0x4093e6={'count':0x0,'rows':[]};return db[_0x0a9e('0x35')][_0x0a9e('0x36')]({'where':{'id':_0x3b5bda[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5a1848,null))['then'](function(_0x1a0314){if(_0x1a0314){_0x138cf5[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x2d')]['rawAttributes']);_0x138cf5[_0x0a9e('0x3f')]=_[_0x0a9e('0x3e')](_0x3b5bda[_0x0a9e('0x3f')]);_0x138cf5[_0x0a9e('0x49')]=_[_0x0a9e('0x40')](_0x138cf5[_0x0a9e('0x3d')],_0x138cf5[_0x0a9e('0x3f')]);_0x5526a7[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x138cf5[_0x0a9e('0x3d')],qs['fields'](_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0x41')]));_0x5526a7[_0x0a9e('0x42')]=_0x5526a7[_0x0a9e('0x42')][_0x0a9e('0x43')]?_0x5526a7[_0x0a9e('0x42')]:_0x138cf5[_0x0a9e('0x3d')];if(!_0x3b5bda[_0x0a9e('0x3f')]['hasOwnProperty'](_0x0a9e('0x45'))){_0x5526a7[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x3b5bda['query'][_0x0a9e('0x20')]);_0x5526a7[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0x1f')]);}_0x5526a7[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0x47')]);_0x5526a7[_0x0a9e('0x48')]=qs['filters'](_[_0x0a9e('0x4a')](_0x3b5bda[_0x0a9e('0x3f')],_0x138cf5[_0x0a9e('0x49')]));_0x5526a7[_0x0a9e('0x48')][_0x0a9e('0xad')]=_0x1a0314['id'];if(_0x3b5bda[_0x0a9e('0x3f')]['filter']){_0x5526a7[_0x0a9e('0x48')]=_['merge'](_0x5526a7['where'],{'$or':_['map'](_0x5526a7[_0x0a9e('0x42')],function(_0x3fa3f2){var _0x426cb4={};_0x426cb4[_0x3fa3f2]={'$like':'%'+_0x3b5bda[_0x0a9e('0x3f')]['filter']+'%'};return _0x426cb4;})});}if(_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0xbe')]){var _0x3ddbc7=_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0xbe')]['split'](',');var _0x57b1b1={};_0x57b1b1[_0x3ddbc7[0x0]]={'$gte':moment(_0x3ddbc7[0x1])[_0x0a9e('0x8c')](_0x0a9e('0xbf'))};_0x5526a7[_0x0a9e('0x48')]=_['merge'](_0x5526a7[_0x0a9e('0x48')],_0x57b1b1);}_0x5526a7=_[_0x0a9e('0x99')]({},_0x5526a7,_0x3b5bda[_0x0a9e('0xb5')]);return db['MailMessage'][_0x0a9e('0x1e')]({'where':_0x5526a7[_0x0a9e('0x48')]})[_0x0a9e('0x26')](function(_0x4eda8f){_0x4093e6[_0x0a9e('0x1e')]=_0x4eda8f;if(_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0xb3')]){_0x5526a7['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5526a7);})[_0x0a9e('0x26')](function(_0x1f50db){_0x4093e6[_0x0a9e('0xb0')]=_0x1f50db;return _0x4093e6;});}})[_0x0a9e('0x26')](respondWithFilteredResult(_0x5a1848,_0x5526a7))['catch'](handleError(_0x5a1848,null));};exports[_0x0a9e('0xc0')]=function(_0x532424,_0x3b4af9,_0x2ff2ab){return db[_0x0a9e('0x35')]['find']({'where':{'id':_0x532424[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x3b4af9,null))[_0x0a9e('0x26')](function(_0x580dd6){if(_0x580dd6){return _0x580dd6[_0x0a9e('0xc1')](_0x532424['body'][_0x0a9e('0xbb')],_['omit'](_0x532424[_0x0a9e('0xb8')],['ids','id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')][_0x0a9e('0xc4')]({'attributes':['id',_0x0a9e('0x29'),_0x0a9e('0x4d')],'where':{'id':_0x532424[_0x0a9e('0xb8')][_0x0a9e('0xbb')]}});})['then'](function(_0x35ace3){socket[_0x0a9e('0xc5')]('mailInteractionTags:save',{'id':Number(_0x532424[_0x0a9e('0xb2')]['id']),'tags':_0x35ace3||[]});return{'id':Number(_0x532424[_0x0a9e('0xb2')]['id']),'tags':_0x35ace3||[]};});}})['then'](respondWithResult(_0x3b4af9,null))[_0x0a9e('0x3a')](handleError(_0x3b4af9,null));};exports[_0x0a9e('0xc6')]=function(_0x16b578,_0x569528,_0x3766d7){return db[_0x0a9e('0x35')][_0x0a9e('0xb6')]({'where':{'id':_0x16b578[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x569528,null))[_0x0a9e('0x26')](function(_0x3ba897){if(_0x3ba897){return _0x3ba897[_0x0a9e('0xc6')](_0x16b578[_0x0a9e('0x3f')][_0x0a9e('0xbb')]);}})['then'](respondWithStatusCode(_0x569528,null))[_0x0a9e('0x3a')](handleError(_0x569528,null));};exports['download']=function(_0x3c9854,_0x2968e2){var _0x5b9c76=moment()[_0x0a9e('0xc7')]()[_0x0a9e('0x84')]();var _0x2d45db=path['join'](config[_0x0a9e('0xc8')],_0x0a9e('0xc9'),_0x0a9e('0xca'),'attachments');var _0x11e4e3=path[_0x0a9e('0xcb')](config[_0x0a9e('0xc8')],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcc'));var _0x1e93f5=path['join'](_0x11e4e3,_0x5b9c76);var _0x4e1b3=util[_0x0a9e('0x8c')](_0x0a9e('0xcd'),_0x5b9c76);var _0x2ce3be=path[_0x0a9e('0xcb')](_0x11e4e3,_0x4e1b3);var _0x241404=![];return db[_0x0a9e('0x35')]['find']({'where':{'id':_0x3c9854['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x2968e2,null))[_0x0a9e('0x26')](function(_0x1f4929){if(_0x1f4929){return _0x1f4929[_0x0a9e('0xbd')]({'attributes':['id',_0x0a9e('0xb8'),_0x0a9e('0x56'),'to','cc',_0x0a9e('0xce'),'subject',_0x0a9e('0x61')],'where':{'secret':![]},'include':_0x3c9854[_0x0a9e('0x3f')][_0x0a9e('0xcf')]?[{'model':db[_0x0a9e('0xd0')],'as':_0x0a9e('0xd1')}]:undefined,'order':qs[_0x0a9e('0x47')]('id')});}return[];})[_0x0a9e('0x26')](function(_0x54f0b8){_0x241404=_0x54f0b8[_0x0a9e('0x43')];if(_0x54f0b8[_0x0a9e('0x43')]){fs[_0x0a9e('0xd2')](_0x1e93f5);return BPromise['each'](_0x54f0b8,function(_0x2b8ad4,_0x387817){var _0x2030cf=_0x2b8ad4;var _0x292f02={'from':_0x2030cf['from'],'to':_0x2030cf['to'],'subject':_0x2030cf[_0x0a9e('0xd3')],'html':_0x2030cf[_0x0a9e('0xb8')],'headers':{'Date':moment(_0x2030cf[_0x0a9e('0x61')])[_0x0a9e('0x8c')](_0x0a9e('0xd4'))},'attachments':[]};if(_0x2b8ad4['cc']){_0x292f02[_0x0a9e('0xd5')]['Cc']=_0x2b8ad4['cc'];}if(_0x2b8ad4[_0x0a9e('0xce')]){_0x292f02[_0x0a9e('0xd5')]['Bcc']=_0x2b8ad4[_0x0a9e('0xce')];}return new BPromise(function(_0x266aa1,_0x25e41f){if(_0x2b8ad4[_0x0a9e('0xd1')]){for(var _0x5f4c6f=0x0;_0x5f4c6f<_0x2b8ad4['Attachments'][_0x0a9e('0x43')];_0x5f4c6f++){var _0x2abe55=_0x2b8ad4[_0x0a9e('0xd1')][_0x5f4c6f];var _0x596ba3=path[_0x0a9e('0xcb')](_0x2d45db,_0x2abe55[_0x0a9e('0xd6')]);if(fs['existsSync'](_0x596ba3)){_0x292f02[_0x0a9e('0xcf')]['push']({'name':_0x2abe55[_0x0a9e('0x29')],'contentType':_0x2abe55['type'],'data':fs['readFileSync'](_0x596ba3)});}}}emlformat['build'](_0x292f02,function(_0xad4d10,_0x4297d1){if(_0xad4d10)return _0x25e41f(_0xad4d10);fs[_0x0a9e('0xd7')](path[_0x0a9e('0xcb')](_0x1e93f5,util[_0x0a9e('0x8c')](_0x0a9e('0xd8'),_0x387817)),_0x4297d1);return _0x266aa1(_0x4297d1);});});});}})['then'](function(){if(_0x241404){return new BPromise(function(_0x5fb7ce,_0x213e5f){zipdir(_0x1e93f5,{'saveTo':_0x2ce3be},function(_0x1713a7,_0xd18f82){if(_0x1713a7)return _0x213e5f(_0x1713a7);return _0x5fb7ce(_0xd18f82);});});}})[_0x0a9e('0x26')](function(){if(_0x241404){return new BPromise(function(_0x18dccf,_0x31c937){rimraf(_0x1e93f5,function(_0x5312fa){if(_0x5312fa)_0x31c937(_0x5312fa);return _0x18dccf();});});}})['then'](function(){if(_0x241404){return _0x2968e2[_0x0a9e('0xd9')](_0x2ce3be,_0x4e1b3,function(_0x5b6edc){if(_0x5b6edc){console[_0x0a9e('0xda')](_0x0a9e('0xdb'),_0x5b6edc);}else{fs[_0x0a9e('0xdc')](_0x2ce3be);}});}else{return _0x2968e2[_0x0a9e('0x1a')](0xc8);}})[_0x0a9e('0x3a')](handleError(_0x2968e2,null));}; \ No newline at end of file +var _0xa9e0=['sequelize','keyBy','merge','a.key','Account.key','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.substatus','i.to','i.ContactId','Contact.firstName','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','enableEmailPreview','all','rows','show','params','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','emit','removeTags','unix','root','server','files','join','tmp','interaction-%s.zip','bcc','attachments','Attachment','Attachments','mkdirSync','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','writeFileSync','message%d.eml','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','closed','unreadMessages','MailMessage','Users','map','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgText','trimStart','lastMsgBody','catch','index','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','COUNT(*)','mail_messages','me.MailInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','expr','parse','createdAt','value','startOf','day','utc','and','isArray','TagId','Messages.count','\x20IN\x20?','tableAlias','\x20=\x20?','LIKE','c.lastName','c.email','\x20LIKE\x20?','\x20>\x20?','\x20<\x20?','condition','ContactId','c.firstName','isNil','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','toString','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','clone','advancedFilter','read','format','%s\x20=\x200','having','`Messages.count`\x20>\x200','tag','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','t.id\x20IN\x20?','`Messages.count`\x20=\x200'];(function(_0x4d9c48,_0x2dbb71){var _0x276911=function(_0x40b506){while(--_0x40b506){_0x4d9c48['push'](_0x4d9c48['shift']());}};_0x276911(++_0x2dbb71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var 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(){_0xfb6e48[_0x0a9e('0x1c')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x5ea472,_0x59181e){return function(_0x197ec0){if(!_0x197ec0){_0x5ea472[_0x0a9e('0x1a')](0x194);}return _0x197ec0;};}function handleError(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0x1f4;return function(_0x526cf3){logger[_0x0a9e('0x28')](_0x526cf3['stack']);if(_0x526cf3[_0x0a9e('0x29')]){delete _0x526cf3['name'];}_0x40c424[_0x0a9e('0x1c')](_0x33161b)[_0x0a9e('0x2a')](_0x526cf3);};}function getInteractionUnreadMessages(_0x25fba9){return new BPromise(function(_0x14433c,_0x140511){try{if(_0x25fba9[_0x0a9e('0x2b')]){_0x25fba9[_0x0a9e('0x2c')]=0x0;_0x14433c(_0x25fba9);}else{return db[_0x0a9e('0x2d')]['count']({'where':{'MailInteractionId':_0x25fba9['id'],'direction':'in','read':![]}})[_0x0a9e('0x26')](function(_0x468813){_0x25fba9[_0x0a9e('0x2c')]=_0x468813;_0x14433c(_0x25fba9);});}}catch(_0x2ec755){_0x140511(_0x2ec755);}});}function getInteractionUsers(_0x5c877d,_0x15b200){return new BPromise(function(_0x40e7a3,_0x1843b2){try{if(_0x15b200[_0x5c877d['id']]){_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x15b200[_0x5c877d['id']],function(_0x563b45){return{'id':_0x563b45['id']};});}}catch(_0x296f41){_0x1843b2(_0x296f41);}_0x40e7a3(_0x5c877d);});}function getInteractionTags(_0x2e8759,_0x1dbde2){return new BPromise(function(_0x540530,_0x426950){try{if(_0x2e8759['TagIds']){_0x2e8759[_0x0a9e('0x30')]=[];_0x2e8759[_0x0a9e('0x31')][_0x0a9e('0x32')](',')[_0x0a9e('0x33')](function(_0x25ce3a){_0x2e8759['Tags'][_0x0a9e('0x34')](_0x1dbde2[_0x25ce3a]);});}delete _0x2e8759[_0x0a9e('0x31')];}catch(_0x40cb85){_0x426950(_0x40cb85);}_0x540530(_0x2e8759);});}function getLastMessageText(_0x2da5c0){return new BPromise(function(_0x2b45ea,_0x409319){return db[_0x0a9e('0x35')][_0x0a9e('0x36')]({'where':{'id':_0x2da5c0['id']},'attributes':['lastMsgBody',_0x0a9e('0x37')],'raw':!![]})['then'](function(_0x2cc7a0){if(!_0x2cc7a0[_0x0a9e('0x37')]){_0x2da5c0[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](htmlToText['fromString'](_0x2cc7a0[_0x0a9e('0x39')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2da5c0[_0x0a9e('0x37')]=_0x2cc7a0[_0x0a9e('0x37')];}_0x2b45ea(_0x2da5c0);})[_0x0a9e('0x3a')](function(_0x4853b1){_0x409319(_0x4853b1);});});}function updateMailInteraction(_0x54135e,_0x1e8694,_0x5640eb,_0x24936a){return new BPromise(function(_0x3d9717,_0x381c37){return getInteractionUnreadMessages(_0x54135e)[_0x0a9e('0x26')](function(_0x4f41ae){return getInteractionUsers(_0x4f41ae,_0x5640eb);})[_0x0a9e('0x26')](function(_0x3bfce8){return getInteractionTags(_0x3bfce8,_0x1e8694);})[_0x0a9e('0x26')](function(_0x533942){if(_0x24936a){_0x3d9717(getLastMessageText(_0x533942));}else{_0x3d9717(_0x533942);}})[_0x0a9e('0x3a')](function(_0x1a180b){_0x381c37(_0x1a180b);});});}exports[_0x0a9e('0x3b')]=function(_0x4c1c0e,_0x546ef8){var _0x11b61d={},_0x40d766={},_0x5adda1={'count':0x0,'rows':[]};var _0x2b814e=db[_0x0a9e('0x35')][_0x0a9e('0x3c')];_0x40d766[_0x0a9e('0x3d')]=_['keys'](_0x2b814e);_0x40d766['query']=_[_0x0a9e('0x3e')](_0x4c1c0e[_0x0a9e('0x3f')]);_0x40d766['filters']=_[_0x0a9e('0x40')](_0x40d766[_0x0a9e('0x3d')],_0x40d766[_0x0a9e('0x3f')]);_0x11b61d['attributes']=_[_0x0a9e('0x40')](_0x40d766[_0x0a9e('0x3d')],qs[_0x0a9e('0x41')](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x41')]));_0x11b61d[_0x0a9e('0x42')]=_0x11b61d[_0x0a9e('0x42')][_0x0a9e('0x43')]?_0x11b61d[_0x0a9e('0x42')]:_0x40d766[_0x0a9e('0x3d')];if(!_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x11b61d[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4c1c0e['query']['limit']);_0x11b61d[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x1f')]);}_0x11b61d[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x47')]);_0x11b61d[_0x0a9e('0x48')]=qs[_0x0a9e('0x49')](_[_0x0a9e('0x4a')](_0x4c1c0e[_0x0a9e('0x3f')],_0x40d766['filters']));var _0x117c99=[];var _0x138b8b=squel[_0x0a9e('0x4b')]()[_0x0a9e('0x4c')]('id')[_0x0a9e('0x4c')](_0x0a9e('0x29'))[_0x0a9e('0x4c')](_0x0a9e('0x4d'))['from'](_0x0a9e('0x4e'));var _0x48fd45=squel[_0x0a9e('0x4b')]()[_0x0a9e('0x4c')](_0x0a9e('0x4f'))['from'](_0x0a9e('0x50'),'me')[_0x0a9e('0x48')](_0x0a9e('0x51'))[_0x0a9e('0x48')](_0x0a9e('0x52'))[_0x0a9e('0x48')](_0x0a9e('0x53'));var _0x5bbcde=squel[_0x0a9e('0x4b')]()[_0x0a9e('0x4c')](_0x0a9e('0x54'))[_0x0a9e('0x4c')](_0x0a9e('0x55'))[_0x0a9e('0x56')](_0x0a9e('0x57'),'ui')[_0x0a9e('0x58')](_0x0a9e('0x59'),'u','u.id\x20=\x20ui.UserId');var _0xe401a=squel[_0x0a9e('0x4b')]()['from']('mail_interactions','i')['left_join'](_0x0a9e('0x5a'),'c',_0x0a9e('0x5b'))[_0x0a9e('0x58')](_0x0a9e('0x59'),'o',_0x0a9e('0x5c'))[_0x0a9e('0x58')](_0x0a9e('0x5d'),'a',_0x0a9e('0x5e'))['left_join']('mail_messages','me','me.MailInteractionId\x20=\x20i.id');var _0x39d77d=squel[_0x0a9e('0x5f')]();if(_0x4c1c0e[_0x0a9e('0x3f')]['advancedFilter']){var _0x5fd5db=JSON[_0x0a9e('0x60')](_0x4c1c0e['query']['advancedFilter']);_[_0x0a9e('0x3e')](_0x5fd5db)['forEach'](function(_0x443e72){var _0x4c3845=_0x5fd5db[_0x443e72];if(_0x443e72===_0x0a9e('0x61')){var _0x3c20b2=moment(_0x4c3845[_0x0a9e('0x62')]['dateStart'])[_0x0a9e('0x63')](_0x0a9e('0x64'))['utc']()['format']();var _0x128aa6=moment(_0x128aa6)[_0x0a9e('0x65')]()['endOf'](_0x0a9e('0x64'))['format']();_0x39d77d[_0x0a9e('0x66')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3c20b2,_0x128aa6);}else{if(_[_0x0a9e('0x67')](_0x4c3845['condition'])){_0x4c3845['condition']['forEach'](function(_0x2da03c){switch(_0x4c3845['condition'][_0x0a9e('0x62')]){case'IS':if(_0x443e72!==_0x0a9e('0x68')&&_0x443e72!==_0x0a9e('0x69')){if(_[_0x0a9e('0x67')](_0x4c3845[_0x0a9e('0x62')])&&_0x4c3845[_0x0a9e('0x62')][_0x0a9e('0x43')]>0x1){_0x39d77d[_0x0a9e('0x66')](_0x4c3845['tableAlias']+'.'+_0x443e72+_0x0a9e('0x6a'),_0x4c3845[_0x0a9e('0x62')]);}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x6c'),_0x4c3845[_0x0a9e('0x62')][0x0]);}}break;case'=':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x6c'),_0x4c3845['value']);break;case _0x0a9e('0x6d'):if(_0x443e72==='ContactId'){_0x39d77d[_0x0a9e('0x66')]('c.firstName'+'\x20LIKE\x20?','%'+_0x4c3845['value']+'%');_0x39d77d['or'](_0x0a9e('0x6e')+'\x20LIKE\x20?','%'+_0x4c3845[_0x0a9e('0x62')]+'%');_0x39d77d['or'](_0x0a9e('0x6f')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+'\x20LIKE\x20?','%'+_0x4c3845[_0x0a9e('0x62')]+'%');}break;case'>':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x71'),_0x4c3845[_0x0a9e('0x62')]);break;case'<':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x72'),_0x4c3845[_0x0a9e('0x62')]);break;}});}else{switch(_0x4c3845[_0x0a9e('0x73')]['value']){case'IS':if(_0x443e72!==_0x0a9e('0x68')&&_0x443e72!==_0x0a9e('0x69')){if(_['isArray'](_0x4c3845[_0x0a9e('0x62')])&&_0x4c3845[_0x0a9e('0x62')][_0x0a9e('0x43')]>0x1){_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+'\x20IN\x20?',_0x4c3845[_0x0a9e('0x62')]);}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+'\x20=\x20?',_0x4c3845[_0x0a9e('0x62')][0x0]);}}break;case'=':_0x39d77d['and'](_0x4c3845['tableAlias']+'.'+_0x443e72+_0x0a9e('0x6c'),_0x4c3845[_0x0a9e('0x62')]);break;case _0x0a9e('0x6d'):if(_0x443e72===_0x0a9e('0x74')){_0x39d77d[_0x0a9e('0x66')](_0x0a9e('0x75')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');_0x39d77d['or'](_0x0a9e('0x6e')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');_0x39d77d['or'](_0x0a9e('0x6f')+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');}else{_0x39d77d[_0x0a9e('0x66')](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x70'),'%'+_0x4c3845[_0x0a9e('0x62')]+'%');}break;case'>':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x71'),_0x4c3845[_0x0a9e('0x62')]);break;case'<':_0x39d77d['and'](_0x4c3845[_0x0a9e('0x6b')]+'.'+_0x443e72+_0x0a9e('0x72'),_0x4c3845['value']);break;}}}});}else{var _0x83f0b2=_(Object[_0x0a9e('0x3e')](_0x4c1c0e[_0x0a9e('0x3f')]))[_0x0a9e('0x2f')](function(_0x13b5c0){return _0x2b814e['hasOwnProperty'](_0x13b5c0)?_0x13b5c0:undefined;})['filter'](function(_0x4a2438){return!_[_0x0a9e('0x76')](_0x4a2438);})[_0x0a9e('0x62')]();if(!_[_0x0a9e('0x77')](_0x83f0b2)){_0x83f0b2[_0x0a9e('0x33')](function(_0x6abd03){if(_0x6abd03===_0x0a9e('0x78')){_0xe401a[_0x0a9e('0x48')](_0x0a9e('0x79'),[]['concat'](_0x4c1c0e[_0x0a9e('0x3f')][_0x6abd03]));}else if(_0x6abd03===_0x0a9e('0x61')){var _0x12ccdb=JSON['parse'](_0x4c1c0e[_0x0a9e('0x3f')][_0x6abd03])['$gte'];var _0x4437ff=JSON[_0x0a9e('0x60')](_0x4c1c0e['query'][_0x6abd03])[_0x0a9e('0x7a')];_0xe401a[_0x0a9e('0x48')](_0x0a9e('0x7b'),_0x12ccdb,_0x4437ff);}else{if(_0x4c1c0e[_0x0a9e('0x3f')][_0x6abd03]==='null'){_0xe401a[_0x0a9e('0x48')]('i.'+_0x6abd03+_0x0a9e('0x7c'));}else{_0xe401a[_0x0a9e('0x48')]('i.'+_0x6abd03+_0x0a9e('0x6c'),_0x4c1c0e['query'][_0x6abd03]);}}});}if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x7d')]){var _0x2d5506=_0x4c1c0e[_0x0a9e('0x3f')]['filter'][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')]('\x27\x27',_0x0a9e('0x7f'));if(qs[_0x0a9e('0x80')](_0x2d5506)){_0x39d77d['or'](_0x0a9e('0x81'),_0x2d5506+'%');}else if(qs[_0x0a9e('0x82')](_0x2d5506)){_0x39d77d['or'](_0x0a9e('0x83'),_0x2d5506+'%');}else{var _0x3df0e3=[];_0x2d5506[_0x0a9e('0x32')]('\x20')[_0x0a9e('0x33')](function(_0xc4c230){_0x3df0e3[_0x0a9e('0x34')]('+'+_0xc4c230[_0x0a9e('0x84')]());});var _0xe0749e=_0x3df0e3['join']('\x20');_0x39d77d['or'](_0x0a9e('0x85'),_0xe0749e)['or'](_0x0a9e('0x86'),_0xe0749e);}}}_0xe401a[_0x0a9e('0x48')](_0x39d77d);if(_0x11b61d['order']){_0x11b61d[_0x0a9e('0x46')][_0x0a9e('0x33')](function(_0x8cea96){_0xe401a[_0x0a9e('0x46')]('i.'+_0x8cea96[0x0],_0x8cea96[0x1]==='DESC'?![]:!![]);});}_0xe401a['group'](_0x0a9e('0x87'));var _0x2bbdb5={'type':db['Sequelize'][_0x0a9e('0x88')]['SELECT'],'raw':!![]};var _0x260f4b=_0xe401a[_0x0a9e('0x89')]()['field'](_0x0a9e('0x4f'));if(!_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8a')]){if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8b')]){if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8b')]==0x1){_0x260f4b['where'](util[_0x0a9e('0x8c')](_0x0a9e('0x8d'),_0x48fd45[_0x0a9e('0x84')]()));_0xe401a[_0x0a9e('0x8e')]('`Messages.count`\x20=\x200');}else{_0x260f4b[_0x0a9e('0x48')](util[_0x0a9e('0x8c')]('%s\x20>\x200',_0x48fd45[_0x0a9e('0x84')]()));_0xe401a['having'](_0x0a9e('0x8f'));}}if(_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x90')]){var _0x385d52=_['isArray'](_0x4c1c0e['query'][_0x0a9e('0x90')])?_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x90')]:new Array(_0x4c1c0e['query'][_0x0a9e('0x90')]);var _0x36e975=squel['expr']();_0x385d52['forEach'](function(_0xf0a802){_0x36e975['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf0a802+',%');});_0xe401a['having'](_0x36e975);_0x260f4b['left_join'](_0x0a9e('0x91'),'it',_0x0a9e('0x92'));_0x260f4b[_0x0a9e('0x58')](_0x0a9e('0x4e'),'t',_0x0a9e('0x93'));_0x260f4b[_0x0a9e('0x48')]('t.id\x20IN\x20?',_0x385d52);}}else{var _0x5fd5db=JSON['parse'](_0x4c1c0e[_0x0a9e('0x3f')][_0x0a9e('0x8a')]);_[_0x0a9e('0x3e')](_0x5fd5db)[_0x0a9e('0x33')](function(_0x50f8d7){var _0x46c9ac=_0x5fd5db[_0x50f8d7];if(_0x50f8d7===_0x0a9e('0x68')){var _0x1d4877=_0x46c9ac['value'];var _0xb6e411=squel[_0x0a9e('0x5f')]();_0x1d4877[_0x0a9e('0x33')](function(_0x22063c){_0xb6e411['or'](_0x0a9e('0x94'),'%,'+_0x22063c+',%');});_0xe401a[_0x0a9e('0x8e')](_0xb6e411);_0x260f4b[_0x0a9e('0x58')](_0x0a9e('0x91'),'it','it.MailInteractionId\x20=\x20i.id');_0x260f4b[_0x0a9e('0x58')](_0x0a9e('0x4e'),'t','t.id\x20=\x20it.TagId');_0x260f4b[_0x0a9e('0x48')](_0x0a9e('0x95'),_0x1d4877);}else if(_0x50f8d7===_0x0a9e('0x69')){if(_0x46c9ac['value'][_0x0a9e('0x43')]===0x1){if(_0x46c9ac['value'][0x0]===0x1){_0x260f4b[_0x0a9e('0x48')](util[_0x0a9e('0x8c')](_0x0a9e('0x8d'),_0x48fd45[_0x0a9e('0x84')]()));_0xe401a[_0x0a9e('0x8e')](_0x0a9e('0x96'));}else{_0x260f4b[_0x0a9e('0x48')](util[_0x0a9e('0x8c')]('%s\x20>\x200',_0x48fd45[_0x0a9e('0x84')]()));_0xe401a[_0x0a9e('0x8e')](_0x0a9e('0x8f'));}}}});}db[_0x0a9e('0x97')][_0x0a9e('0x3f')](_0x260f4b[_0x0a9e('0x84')](),_0x2bbdb5)[_0x0a9e('0x26')](function(_0x33f0c9){_0x5adda1[_0x0a9e('0x1e')]=_0x33f0c9[_0x0a9e('0x43')];if(_0x5adda1[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x97')][_0x0a9e('0x3f')](_0x138b8b['toString'](),_0x2bbdb5)[_0x0a9e('0x26')](function(_0x23e2bd){_0x117c99=_[_0x0a9e('0x98')](_0x23e2bd,'id');_0x2bbdb5=_[_0x0a9e('0x99')](_0x2bbdb5,{'model':db[_0x0a9e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});_0xe401a['field'](_0x0a9e('0x9a'),_0x0a9e('0x9b'));_0xe401a['field'](_0x0a9e('0x87'));_0xe401a['field'](_0x0a9e('0x9c'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x9d'));_0xe401a[_0x0a9e('0x4c')]('i.closed');_0xe401a[_0x0a9e('0x4c')]('i.closedAt');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x9e'));_0xe401a['field'](_0x0a9e('0x9f'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa0'));_0xe401a['field']('i.subject');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa1'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa2'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa3'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa4'));_0xe401a[_0x0a9e('0x4c')]('i.MailAccountId');_0xe401a[_0x0a9e('0x4c')]('i.UserId');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x75'),_0x0a9e('0xa5'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x6e'),'Contact.lastName');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0x6f'),_0x0a9e('0xa6'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa7'),'Contact.phone');_0xe401a['field'](_0x0a9e('0xa8'),'Contact.mobile');_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xa9'),_0x0a9e('0xaa'));_0xe401a[_0x0a9e('0x4c')](_0x0a9e('0xab'),_0x0a9e('0x31'));_0xe401a['left_join']('mail_interaction_has_tags','it',_0x0a9e('0x92'));_0xe401a['left_join'](_0x0a9e('0x4e'),'t','t.id\x20=\x20it.TagId');_0xe401a[_0x0a9e('0x20')](_0x11b61d['limit']);_0xe401a['offset'](_0x11b61d[_0x0a9e('0x1f')]);return db[_0x0a9e('0x97')]['query'](_0xe401a[_0x0a9e('0x84')](),_0x2bbdb5);})[_0x0a9e('0x26')](function(_0x15c6b9){_0x5bbcde[_0x0a9e('0x48')](_0x0a9e('0xac'),_['map'](_0x15c6b9,'id'));return db['sequelize'][_0x0a9e('0x3f')](_0x5bbcde[_0x0a9e('0x84')](),_0x2bbdb5)[_0x0a9e('0x26')](function(_0x24beb6){var _0x59303b=_['groupBy'](_0x24beb6,_0x0a9e('0xad'));var _0xadce3d=[];return db['Setting'][_0x0a9e('0x36')]({'attributes':[_0x0a9e('0xae')],'raw':!![]})[_0x0a9e('0x26')](function(_0x2427d5){var _0x23b25b=_0x2427d5[_0x0a9e('0xae')];_0x15c6b9[_0x0a9e('0x33')](function(_0x476993){_0xadce3d[_0x0a9e('0x34')](updateMailInteraction(_0x476993,_0x117c99,_0x59303b,_0x23b25b));});return BPromise[_0x0a9e('0xaf')](_0xadce3d);});});});})['then'](function(_0x1065a7){_0x5adda1[_0x0a9e('0xb0')]=_0x1065a7;return _0x5adda1;})[_0x0a9e('0x26')](respondWithFilteredResult(_0x546ef8,_0x11b61d))[_0x0a9e('0x3a')](handleError(_0x546ef8,null));};exports[_0x0a9e('0xb1')]=function(_0x547e37,_0x500868){var _0x21902c={'raw':![],'where':{'id':_0x547e37[_0x0a9e('0xb2')]['id']}},_0x16ae1a={};_0x16ae1a[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](db['MailInteraction'][_0x0a9e('0x3c')]);_0x16ae1a[_0x0a9e('0x3f')]=_[_0x0a9e('0x3e')](_0x547e37['query']);_0x16ae1a[_0x0a9e('0x49')]=_['intersection'](_0x16ae1a[_0x0a9e('0x3d')],_0x16ae1a['query']);_0x21902c[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x16ae1a[_0x0a9e('0x3d')],qs['fields'](_0x547e37[_0x0a9e('0x3f')]['fields']));_0x21902c[_0x0a9e('0x42')]=_0x21902c[_0x0a9e('0x42')][_0x0a9e('0x43')]?_0x21902c[_0x0a9e('0x42')]:_0x16ae1a[_0x0a9e('0x3d')];if(_0x547e37[_0x0a9e('0x3f')][_0x0a9e('0xb3')]){_0x21902c[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x21902c=_[_0x0a9e('0x99')]({},_0x21902c,_0x547e37[_0x0a9e('0xb5')]);return db[_0x0a9e('0x35')][_0x0a9e('0xb6')](_0x21902c)[_0x0a9e('0x26')](handleEntityNotFound(_0x500868,null))[_0x0a9e('0x26')](respondWithResult(_0x500868,null))[_0x0a9e('0x3a')](handleError(_0x500868,null));};exports[_0x0a9e('0xb7')]=function(_0x5b93dd,_0x556443){return db[_0x0a9e('0x35')]['create'](_0x5b93dd[_0x0a9e('0xb8')],{})[_0x0a9e('0x26')](respondWithResult(_0x556443,0xc9))['catch'](handleError(_0x556443,null));};exports[_0x0a9e('0x25')]=function(_0xe2b083,_0x387bbe){if(_0xe2b083[_0x0a9e('0xb8')]['id']){delete _0xe2b083['body']['id'];}return db[_0x0a9e('0x35')][_0x0a9e('0xb6')]({'where':{'id':_0xe2b083[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x387bbe,null))['then'](saveUpdates(_0xe2b083[_0x0a9e('0xb8')],null))[_0x0a9e('0x26')](respondWithResult(_0x387bbe,null))[_0x0a9e('0x3a')](handleError(_0x387bbe,null));};exports['destroy']=function(_0x2650eb,_0x270df8){return db[_0x0a9e('0x35')]['find']({'where':{'id':_0x2650eb[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x270df8,null))[_0x0a9e('0x26')](removeEntity(_0x270df8,null))[_0x0a9e('0x3a')](handleError(_0x270df8,null));};exports[_0x0a9e('0xb9')]=function(_0x555780,_0x3211d2){return db[_0x0a9e('0x35')]['describe']()[_0x0a9e('0x26')](respondWithResult(_0x3211d2,null))[_0x0a9e('0x3a')](handleError(_0x3211d2,null));};exports[_0x0a9e('0xba')]=function(_0x5822a7,_0x5c3b6f,_0x523d08){return db[_0x0a9e('0x2d')][_0x0a9e('0xb6')]({'where':{'id':_0x5822a7['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5c3b6f,null))[_0x0a9e('0x26')](function(_0x2a8d55){if(_0x2a8d55){return _0x2a8d55['addMessage'](_0x5822a7[_0x0a9e('0xb8')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x5822a7[_0x0a9e('0xb8')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x26')](respondWithResult(_0x5c3b6f,null))[_0x0a9e('0x3a')](handleError(_0x5c3b6f,null));};exports[_0x0a9e('0xbd')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7={'raw':![],'where':{}};var _0x138cf5={};var _0x4093e6={'count':0x0,'rows':[]};return db[_0x0a9e('0x35')][_0x0a9e('0x36')]({'where':{'id':_0x3b5bda[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5a1848,null))['then'](function(_0x1a0314){if(_0x1a0314){_0x138cf5[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](db[_0x0a9e('0x2d')]['rawAttributes']);_0x138cf5[_0x0a9e('0x3f')]=_[_0x0a9e('0x3e')](_0x3b5bda[_0x0a9e('0x3f')]);_0x138cf5[_0x0a9e('0x49')]=_[_0x0a9e('0x40')](_0x138cf5[_0x0a9e('0x3d')],_0x138cf5[_0x0a9e('0x3f')]);_0x5526a7[_0x0a9e('0x42')]=_[_0x0a9e('0x40')](_0x138cf5[_0x0a9e('0x3d')],qs['fields'](_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0x41')]));_0x5526a7[_0x0a9e('0x42')]=_0x5526a7[_0x0a9e('0x42')][_0x0a9e('0x43')]?_0x5526a7[_0x0a9e('0x42')]:_0x138cf5[_0x0a9e('0x3d')];if(!_0x3b5bda[_0x0a9e('0x3f')]['hasOwnProperty'](_0x0a9e('0x45'))){_0x5526a7[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x3b5bda['query'][_0x0a9e('0x20')]);_0x5526a7[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0x1f')]);}_0x5526a7[_0x0a9e('0x46')]=qs[_0x0a9e('0x47')](_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0x47')]);_0x5526a7[_0x0a9e('0x48')]=qs['filters'](_[_0x0a9e('0x4a')](_0x3b5bda[_0x0a9e('0x3f')],_0x138cf5[_0x0a9e('0x49')]));_0x5526a7[_0x0a9e('0x48')][_0x0a9e('0xad')]=_0x1a0314['id'];if(_0x3b5bda[_0x0a9e('0x3f')]['filter']){_0x5526a7[_0x0a9e('0x48')]=_['merge'](_0x5526a7['where'],{'$or':_['map'](_0x5526a7[_0x0a9e('0x42')],function(_0x3fa3f2){var _0x426cb4={};_0x426cb4[_0x3fa3f2]={'$like':'%'+_0x3b5bda[_0x0a9e('0x3f')]['filter']+'%'};return _0x426cb4;})});}if(_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0xbe')]){var _0x3ddbc7=_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0xbe')]['split'](',');var _0x57b1b1={};_0x57b1b1[_0x3ddbc7[0x0]]={'$gte':moment(_0x3ddbc7[0x1])[_0x0a9e('0x8c')](_0x0a9e('0xbf'))};_0x5526a7[_0x0a9e('0x48')]=_['merge'](_0x5526a7[_0x0a9e('0x48')],_0x57b1b1);}_0x5526a7=_[_0x0a9e('0x99')]({},_0x5526a7,_0x3b5bda[_0x0a9e('0xb5')]);return db['MailMessage'][_0x0a9e('0x1e')]({'where':_0x5526a7[_0x0a9e('0x48')]})[_0x0a9e('0x26')](function(_0x4eda8f){_0x4093e6[_0x0a9e('0x1e')]=_0x4eda8f;if(_0x3b5bda[_0x0a9e('0x3f')][_0x0a9e('0xb3')]){_0x5526a7['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5526a7);})[_0x0a9e('0x26')](function(_0x1f50db){_0x4093e6[_0x0a9e('0xb0')]=_0x1f50db;return _0x4093e6;});}})[_0x0a9e('0x26')](respondWithFilteredResult(_0x5a1848,_0x5526a7))['catch'](handleError(_0x5a1848,null));};exports[_0x0a9e('0xc0')]=function(_0x532424,_0x3b4af9,_0x2ff2ab){return db[_0x0a9e('0x35')]['find']({'where':{'id':_0x532424[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x3b4af9,null))[_0x0a9e('0x26')](function(_0x580dd6){if(_0x580dd6){return _0x580dd6[_0x0a9e('0xc1')](_0x532424['body'][_0x0a9e('0xbb')],_['omit'](_0x532424[_0x0a9e('0xb8')],['ids','id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')][_0x0a9e('0xc4')]({'attributes':['id',_0x0a9e('0x29'),_0x0a9e('0x4d')],'where':{'id':_0x532424[_0x0a9e('0xb8')][_0x0a9e('0xbb')]}});})['then'](function(_0x35ace3){socket[_0x0a9e('0xc5')]('mailInteractionTags:save',{'id':Number(_0x532424[_0x0a9e('0xb2')]['id']),'tags':_0x35ace3||[]});return{'id':Number(_0x532424[_0x0a9e('0xb2')]['id']),'tags':_0x35ace3||[]};});}})['then'](respondWithResult(_0x3b4af9,null))[_0x0a9e('0x3a')](handleError(_0x3b4af9,null));};exports[_0x0a9e('0xc6')]=function(_0x16b578,_0x569528,_0x3766d7){return db[_0x0a9e('0x35')][_0x0a9e('0xb6')]({'where':{'id':_0x16b578[_0x0a9e('0xb2')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x569528,null))[_0x0a9e('0x26')](function(_0x3ba897){if(_0x3ba897){return _0x3ba897[_0x0a9e('0xc6')](_0x16b578[_0x0a9e('0x3f')][_0x0a9e('0xbb')]);}})['then'](respondWithStatusCode(_0x569528,null))[_0x0a9e('0x3a')](handleError(_0x569528,null));};exports['download']=function(_0x3c9854,_0x2968e2){var _0x5b9c76=moment()[_0x0a9e('0xc7')]()[_0x0a9e('0x84')]();var _0x2d45db=path['join'](config[_0x0a9e('0xc8')],_0x0a9e('0xc9'),_0x0a9e('0xca'),'attachments');var _0x11e4e3=path[_0x0a9e('0xcb')](config[_0x0a9e('0xc8')],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcc'));var _0x1e93f5=path['join'](_0x11e4e3,_0x5b9c76);var _0x4e1b3=util[_0x0a9e('0x8c')](_0x0a9e('0xcd'),_0x5b9c76);var _0x2ce3be=path[_0x0a9e('0xcb')](_0x11e4e3,_0x4e1b3);var _0x241404=![];return db[_0x0a9e('0x35')]['find']({'where':{'id':_0x3c9854['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x2968e2,null))[_0x0a9e('0x26')](function(_0x1f4929){if(_0x1f4929){return _0x1f4929[_0x0a9e('0xbd')]({'attributes':['id',_0x0a9e('0xb8'),_0x0a9e('0x56'),'to','cc',_0x0a9e('0xce'),'subject',_0x0a9e('0x61')],'where':{'secret':![]},'include':_0x3c9854[_0x0a9e('0x3f')][_0x0a9e('0xcf')]?[{'model':db[_0x0a9e('0xd0')],'as':_0x0a9e('0xd1')}]:undefined,'order':qs[_0x0a9e('0x47')]('id')});}return[];})[_0x0a9e('0x26')](function(_0x54f0b8){_0x241404=_0x54f0b8[_0x0a9e('0x43')];if(_0x54f0b8[_0x0a9e('0x43')]){fs[_0x0a9e('0xd2')](_0x1e93f5);return BPromise['each'](_0x54f0b8,function(_0x2b8ad4,_0x387817){var _0x2030cf=_0x2b8ad4;var _0x292f02={'from':_0x2030cf['from'],'to':_0x2030cf['to'],'subject':_0x2030cf[_0x0a9e('0xd3')],'html':_0x2030cf[_0x0a9e('0xb8')],'headers':{'Date':moment(_0x2030cf[_0x0a9e('0x61')])[_0x0a9e('0x8c')](_0x0a9e('0xd4'))},'attachments':[]};if(_0x2b8ad4['cc']){_0x292f02[_0x0a9e('0xd5')]['Cc']=_0x2b8ad4['cc'];}if(_0x2b8ad4[_0x0a9e('0xce')]){_0x292f02[_0x0a9e('0xd5')]['Bcc']=_0x2b8ad4[_0x0a9e('0xce')];}return new BPromise(function(_0x266aa1,_0x25e41f){if(_0x2b8ad4[_0x0a9e('0xd1')]){for(var _0x5f4c6f=0x0;_0x5f4c6f<_0x2b8ad4['Attachments'][_0x0a9e('0x43')];_0x5f4c6f++){var _0x2abe55=_0x2b8ad4[_0x0a9e('0xd1')][_0x5f4c6f];var _0x596ba3=path[_0x0a9e('0xcb')](_0x2d45db,_0x2abe55[_0x0a9e('0xd6')]);if(fs['existsSync'](_0x596ba3)){_0x292f02[_0x0a9e('0xcf')]['push']({'name':_0x2abe55[_0x0a9e('0x29')],'contentType':_0x2abe55['type'],'data':fs['readFileSync'](_0x596ba3)});}}}emlformat['build'](_0x292f02,function(_0xad4d10,_0x4297d1){if(_0xad4d10)return _0x25e41f(_0xad4d10);fs[_0x0a9e('0xd7')](path[_0x0a9e('0xcb')](_0x1e93f5,util[_0x0a9e('0x8c')](_0x0a9e('0xd8'),_0x387817)),_0x4297d1);return _0x266aa1(_0x4297d1);});});});}})['then'](function(){if(_0x241404){return new BPromise(function(_0x5fb7ce,_0x213e5f){zipdir(_0x1e93f5,{'saveTo':_0x2ce3be},function(_0x1713a7,_0xd18f82){if(_0x1713a7)return _0x213e5f(_0x1713a7);return _0x5fb7ce(_0xd18f82);});});}})[_0x0a9e('0x26')](function(){if(_0x241404){return new BPromise(function(_0x18dccf,_0x31c937){rimraf(_0x1e93f5,function(_0x5312fa){if(_0x5312fa)_0x31c937(_0x5312fa);return _0x18dccf();});});}})['then'](function(){if(_0x241404){return _0x2968e2[_0x0a9e('0xd9')](_0x2ce3be,_0x4e1b3,function(_0x5b6edc){if(_0x5b6edc){console[_0x0a9e('0xda')](_0x0a9e('0xdb'),_0x5b6edc);}else{fs[_0x0a9e('0xdc')](_0x2ce3be);}});}else{return _0x2968e2[_0x0a9e('0x1a')](0xc8);}})[_0x0a9e('0x3a')](handleError(_0x2968e2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d2e9b6e..9b9f657 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 _0x7390=['update','then','setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save'];(function(_0x311615,_0x43c1a5){var _0x984131=function(_0x11978f){while(--_0x11978f){_0x311615['push'](_0x311615['shift']());}};_0x984131(++_0x43c1a5);}(_0x7390,0x136));var _0x0739=function(_0x267f92,_0x4edb00){_0x267f92=_0x267f92-0x0;var _0x14aa3c=_0x7390[_0x267f92];return _0x14aa3c;};'use strict';var EventEmitter=require(_0x0739('0x0'));var MailInteraction=require(_0x0739('0x1'))['db'][_0x0739('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0739('0x3')](0x0);var events={'afterCreate':_0x0739('0x4'),'afterUpdate':_0x0739('0x5'),'afterDestroy':'remove'};function emitEvent(_0xf53134){return function(_0x5b2bf9,_0x2e9490,_0xd89a14){_0x5b2bf9['getUsers']({'attributes':['id'],'raw':!![]})[_0x0739('0x6')](function(_0x47d86f){_0x5b2bf9[_0x0739('0x7')]('Users',_0x47d86f[_0x0739('0x8')](function(_0xaf703f){return{'id':_0xaf703f['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5b2bf9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x197d33){_0x5b2bf9[_0x0739('0x7')](_0x0739('0x9'),_0x197d33['length']);MailInteractionEvents[_0x0739('0xa')](_0xf53134+':'+_0x5b2bf9['id'],_0x5b2bf9);MailInteractionEvents['emit'](_0xf53134,_0x5b2bf9);_0xd89a14(null);})[_0x0739('0xb')](_0xd89a14(null));};}for(var e in events){if(events[_0x0739('0xc')](e)){var event=events[e];MailInteraction[_0x0739('0xd')](e,emitEvent(event));}}module[_0x0739('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xc3ad=['events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x5f29dd,_0x32daf3){var _0x19498a=function(_0x19b1b3){while(--_0x19b1b3){_0x5f29dd['push'](_0x5f29dd['shift']());}};_0x19498a(++_0x32daf3);}(_0xc3ad,0x187));var _0xdc3a=function(_0x1cb02a,_0xcdc9f8){_0x1cb02a=_0x1cb02a-0x0;var _0x527c1c=_0xc3ad[_0x1cb02a];return _0x527c1c;};'use strict';var EventEmitter=require(_0xdc3a('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xdc3a('0x1')];var MailMessage=require(_0xdc3a('0x2'))['db'][_0xdc3a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdc3a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc3a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x45e865){return function(_0x3d75de,_0x4eb797,_0x1aeb2e){_0x3d75de[_0xdc3a('0x6')]({'attributes':['id'],'raw':!![]})[_0xdc3a('0x7')](function(_0x4ec027){_0x3d75de[_0xdc3a('0x8')](_0xdc3a('0x9'),_0x4ec027[_0xdc3a('0xa')](function(_0x31914a){return{'id':_0x31914a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3d75de['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc3a('0x7')](function(_0x1c9202){_0x3d75de[_0xdc3a('0x8')](_0xdc3a('0xb'),_0x1c9202[_0xdc3a('0xc')]);MailInteractionEvents[_0xdc3a('0xd')](_0x45e865+':'+_0x3d75de['id'],_0x3d75de);MailInteractionEvents[_0xdc3a('0xd')](_0x45e865,_0x3d75de);_0x1aeb2e(null);})['catch'](_0x1aeb2e(null));};}for(var e in events){if(events[_0xdc3a('0xe')](e)){var event=events[e];MailInteraction[_0xdc3a('0xf')](e,emitEvent(event));}}module[_0xdc3a('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 2edacc8..9cbf09c 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 _0x843f=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xdb70bf,_0x50b1fb){var _0xa1fb9a=function(_0x36a72e){while(--_0x36a72e){_0xdb70bf['push'](_0xdb70bf['shift']());}};_0xa1fb9a(++_0x50b1fb);}(_0x843f,0x1be));var _0xf843=function(_0x4b27c5,_0x3fcc04){_0x4b27c5=_0x4b27c5-0x0;var _0x283551=_0x843f[_0x4b27c5];return _0x283551;};'use strict';var _=require(_0xf843('0x0'));var util=require(_0xf843('0x1'));var logger=require(_0xf843('0x2'))(_0xf843('0x3'));var moment=require(_0xf843('0x4'));var BPromise=require(_0xf843('0x5'));var rp=require(_0xf843('0x6'));var fs=require('fs');var path=require(_0xf843('0x7'));var rimraf=require('rimraf');var config=require(_0xf843('0x8'));var attributes=require(_0xf843('0x9'));module[_0xf843('0xa')]=function(_0x4b5025,_0x2ca909){return _0x4b5025['define'](_0xf843('0xb'),attributes,{'tableName':_0xf843('0xc'),'paranoid':![],'indexes':[{'name':_0xf843('0xd'),'fields':[_0xf843('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x147abd,_0x1482f4,_0x4c4128){if(_0x147abd[_0xf843('0xf')]){_0x147abd[_0xf843('0x10')]=moment()['format'](_0xf843('0x11'));}if(_0x147abd[_0xf843('0x12')]){_0x147abd[_0xf843('0x13')]=moment()[_0xf843('0x14')](_0xf843('0x11'));}_0x4c4128(null,_0x1482f4);},'beforeUpdate':function(_0x130580,_0xc22c8f,_0xe81559){if(_0x130580[_0xf843('0x15')](_0xf843('0xf'))){_0x130580[_0xf843('0x10')]=moment()[_0xf843('0x14')](_0xf843('0x11'));}if(_0x130580[_0xf843('0x15')](_0xf843('0x12'))){_0x130580[_0xf843('0x13')]=moment()[_0xf843('0x14')](_0xf843('0x11'));}_0xe81559(null,_0x130580);},'afterUpdate':function(_0x4a5945,_0x3a5f8d,_0xcba2be){var _0x15fdc7=_0x4b5025[_0xf843('0x16')];var _0x978c2d=_0x4a5945['get']({'plain':!![]});if(_0x978c2d[_0xf843('0x12')]){return _0x15fdc7[_0xf843('0x17')][_0xf843('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x978c2d['id']}})[_0xf843('0x19')](function(){_0xcba2be();})['catch'](function(_0x290cd0){_0xcba2be(_0x290cd0);});}else{_0xcba2be();}}},'charset':_0xf843('0x1a'),'collate':_0xf843('0x1b')});}; \ No newline at end of file +var _0xd5e2=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x7ec366,_0x20443c){var _0x19f61f=function(_0xc82c49){while(--_0xc82c49){_0x7ec366['push'](_0x7ec366['shift']());}};_0x19f61f(++_0x20443c);}(_0xd5e2,0x1cb));var _0x2d5e=function(_0x117649,_0x51deae){_0x117649=_0x117649-0x0;var _0x492fcb=_0xd5e2[_0x117649];return _0x492fcb;};'use strict';var _=require('lodash');var util=require(_0x2d5e('0x0'));var logger=require(_0x2d5e('0x1'))('api');var moment=require(_0x2d5e('0x2'));var BPromise=require(_0x2d5e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d5e('0x4'));var rimraf=require(_0x2d5e('0x5'));var config=require(_0x2d5e('0x6'));var attributes=require(_0x2d5e('0x7'));module[_0x2d5e('0x8')]=function(_0x3eb736,_0x3c6445){return _0x3eb736[_0x2d5e('0x9')](_0x2d5e('0xa'),attributes,{'tableName':_0x2d5e('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x2d5e('0xc'),'to'],'type':_0x2d5e('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x531aa7,_0x50569d,_0x4ad8a5){if(_0x531aa7[_0x2d5e('0xe')]){_0x531aa7[_0x2d5e('0xf')]=moment()[_0x2d5e('0x10')](_0x2d5e('0x11'));}if(_0x531aa7[_0x2d5e('0x12')]){_0x531aa7[_0x2d5e('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4ad8a5(null,_0x50569d);},'beforeUpdate':function(_0x271467,_0x55bd92,_0x107d41){if(_0x271467[_0x2d5e('0x14')]('substatus')){_0x271467['substatusAt']=moment()[_0x2d5e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x271467['changed'](_0x2d5e('0x12'))){_0x271467['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x107d41(null,_0x271467);},'afterUpdate':function(_0x3daf69,_0x8310a3,_0x125c4f){var _0x31d92d=_0x3eb736[_0x2d5e('0x15')];var _0x18904b=_0x3daf69[_0x2d5e('0x16')]({'plain':!![]});if(_0x18904b['closed']){return _0x31d92d['MailMessage'][_0x2d5e('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x18904b['id']}})[_0x2d5e('0x18')](function(){_0x125c4f();})[_0x2d5e('0x19')](function(_0x41629c){_0x125c4f(_0x41629c);});}else{_0x125c4f();}}},'charset':_0x2d5e('0x1a'),'collate':_0x2d5e('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 19700e1..f61e8c6 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 _0x29b1=['./mailInteraction.socket','request','info','request\x20sent','debug','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','then','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x29b1,0x13b));var _0x129b=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x29b1[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x129b('0x0'));var BPromise=require(_0x129b('0x1'));var rs=require(_0x129b('0x2'));var fs=require('fs');var Redis=require(_0x129b('0x3'));var db=require(_0x129b('0x4'))['db'];var utils=require(_0x129b('0x5'));var logger=require(_0x129b('0x6'))(_0x129b('0x7'));var config=require(_0x129b('0x8'));var jayson=require(_0x129b('0x9'));var client=jayson[_0x129b('0xa')]['http']({'port':0x232a});config[_0x129b('0xb')]=_['defaults'](config[_0x129b('0xb')],{'host':_0x129b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x129b('0xd'))['register'](socket);function respondWithRpcPromise(_0x3b32a8,_0x22d63a,_0x38980b){return new BPromise(function(_0x228944,_0x1cd1d){return client[_0x129b('0xe')](_0x3b32a8,_0x38980b)['then'](function(_0x1043aa){logger[_0x129b('0xf')]('MailInteraction,\x20%s,\x20%s',_0x22d63a,_0x129b('0x10'));logger[_0x129b('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x22d63a,_0x129b('0x10'),JSON[_0x129b('0x12')](_0x1043aa));if(_0x1043aa[_0x129b('0x13')]){if(_0x1043aa[_0x129b('0x13')][_0x129b('0x14')]===0x1f4){logger['error'](_0x129b('0x15'),_0x22d63a,_0x1043aa[_0x129b('0x13')][_0x129b('0x16')]);return _0x1cd1d(_0x1043aa['error'][_0x129b('0x16')]);}logger[_0x129b('0x13')]('MailInteraction,\x20%s,\x20%s',_0x22d63a,_0x1043aa[_0x129b('0x13')]['message']);return _0x228944(_0x1043aa[_0x129b('0x13')][_0x129b('0x16')]);}else{logger[_0x129b('0xf')](_0x129b('0x15'),_0x22d63a,_0x129b('0x10'));_0x228944(_0x1043aa[_0x129b('0x17')]['message']);}})[_0x129b('0x18')](function(_0xdd3ca3){logger['error'](_0x129b('0x15'),_0x22d63a,_0xdd3ca3);_0x1cd1d(_0xdd3ca3);});});}exports[_0x129b('0x19')]=function(_0xd58ccb){var _0x491620=this;return new Promise(function(_0x17fe3a,_0x1062ab){return db['MailInteraction'][_0x129b('0x1a')](_0xd58ccb[_0x129b('0x1b')],{'raw':_0xd58ccb['options']?_0xd58ccb[_0x129b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd58ccb[_0x129b('0x1c')]?_0xd58ccb['options'][_0x129b('0x1d')]||null:null,'attributes':_0xd58ccb['options']?_0xd58ccb[_0x129b('0x1c')][_0x129b('0x1e')]||null:null,'limit':_0xd58ccb[_0x129b('0x1c')]?_0xd58ccb['options'][_0x129b('0x1f')]||null:null})[_0x129b('0x20')](function(_0x17c055){logger['info']('UpdateMailInteraction',_0xd58ccb);logger[_0x129b('0x11')](_0x129b('0x19'),_0xd58ccb,JSON['stringify'](_0x17c055));_0x17fe3a(_0x17c055);})[_0x129b('0x18')](function(_0x17b6f4){logger[_0x129b('0x13')](_0x129b('0x19'),_0x17b6f4[_0x129b('0x16')],_0xd58ccb);_0x1062ab(_0x491620[_0x129b('0x13')](0x1f4,_0x17b6f4[_0x129b('0x16')]));});});};exports[_0x129b('0x21')]=function(_0x47036d){return new Promise(function(_0x23648c,_0x3979eb){return db[_0x129b('0x22')][_0x129b('0x23')]({'where':_0x47036d[_0x129b('0x1c')]?_0x47036d[_0x129b('0x1c')][_0x129b('0x1d')]||null:null})['then'](function(_0x35ab3b){if(_0x35ab3b){return _0x35ab3b[_0x129b('0x24')](_0x47036d['body'][_0x129b('0x25')],_[_0x129b('0x26')](_0x47036d['body'],['ids','id'])||{});}})[_0x129b('0x27')](function(_0x5b2948){logger[_0x129b('0xf')](_0x129b('0x28'),_0x47036d);logger[_0x129b('0x11')](_0x129b('0x28'),_0x47036d,JSON[_0x129b('0x12')](_0x5b2948));_0x23648c(_0x5b2948);})[_0x129b('0x18')](function(_0x2ada0b){logger[_0x129b('0x13')](_0x129b('0x28'),_0x2ada0b[_0x129b('0x16')],_0x47036d);_0x3979eb(_this[_0x129b('0x13')](0x1f4,_0x2ada0b['message']));});});}; \ No newline at end of file +var _0x55c3=['http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','error','code','message','MailInteraction,\x20%s,\x20%s','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','stringify','catch','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xc71c57,_0x9d9c28){var _0x286d5c=function(_0xd5d3be){while(--_0xd5d3be){_0xc71c57['push'](_0xc71c57['shift']());}};_0x286d5c(++_0x9d9c28);}(_0x55c3,0x189));var _0x355c=function(_0x130c3e,_0x54592a){_0x130c3e=_0x130c3e-0x0;var _0x2b802d=_0x55c3[_0x130c3e];return _0x2b802d;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var moment=require(_0x355c('0x1'));var BPromise=require(_0x355c('0x2'));var rs=require(_0x355c('0x3'));var fs=require('fs');var Redis=require(_0x355c('0x4'));var db=require(_0x355c('0x5'))['db'];var utils=require(_0x355c('0x6'));var logger=require(_0x355c('0x7'))(_0x355c('0x8'));var config=require(_0x355c('0x9'));var jayson=require(_0x355c('0xa'));var client=jayson[_0x355c('0xb')][_0x355c('0xc')]({'port':0x232a});config[_0x355c('0xd')]=_['defaults'](config['redis'],{'host':_0x355c('0xe'),'port':0x18eb});var socket=require(_0x355c('0xf'))(new Redis(config[_0x355c('0xd')]));require(_0x355c('0x10'))[_0x355c('0x11')](socket);function respondWithRpcPromise(_0x3ca52d,_0x4d91bc,_0x12fe87){return new BPromise(function(_0x3cdc28,_0xf40017){return client[_0x355c('0x12')](_0x3ca52d,_0x12fe87)[_0x355c('0x13')](function(_0x386a36){logger[_0x355c('0x14')]('MailInteraction,\x20%s,\x20%s',_0x4d91bc,_0x355c('0x15'));logger[_0x355c('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4d91bc,_0x355c('0x15'),JSON['stringify'](_0x386a36));if(_0x386a36[_0x355c('0x17')]){if(_0x386a36[_0x355c('0x17')][_0x355c('0x18')]===0x1f4){logger[_0x355c('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4d91bc,_0x386a36[_0x355c('0x17')]['message']);return _0xf40017(_0x386a36['error'][_0x355c('0x19')]);}logger[_0x355c('0x17')](_0x355c('0x1a'),_0x4d91bc,_0x386a36[_0x355c('0x17')][_0x355c('0x19')]);return _0x3cdc28(_0x386a36[_0x355c('0x17')][_0x355c('0x19')]);}else{logger[_0x355c('0x14')](_0x355c('0x1a'),_0x4d91bc,'request\x20sent');_0x3cdc28(_0x386a36[_0x355c('0x1b')][_0x355c('0x19')]);}})['catch'](function(_0x4fabef){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4d91bc,_0x4fabef);_0xf40017(_0x4fabef);});});}exports[_0x355c('0x1c')]=function(_0x11b117){var _0x47839f=this;return new Promise(function(_0x5b1788,_0x42323a){return db[_0x355c('0x1d')][_0x355c('0x1e')](_0x11b117[_0x355c('0x1f')],{'raw':_0x11b117[_0x355c('0x20')]?_0x11b117[_0x355c('0x20')][_0x355c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11b117[_0x355c('0x20')]?_0x11b117['options']['where']||null:null,'attributes':_0x11b117[_0x355c('0x20')]?_0x11b117[_0x355c('0x20')][_0x355c('0x22')]||null:null,'limit':_0x11b117['options']?_0x11b117[_0x355c('0x20')]['limit']||null:null})[_0x355c('0x13')](function(_0x285c0b){logger[_0x355c('0x14')](_0x355c('0x1c'),_0x11b117);logger[_0x355c('0x16')]('UpdateMailInteraction',_0x11b117,JSON[_0x355c('0x23')](_0x285c0b));_0x5b1788(_0x285c0b);})[_0x355c('0x24')](function(_0x37ac93){logger[_0x355c('0x17')](_0x355c('0x1c'),_0x37ac93['message'],_0x11b117);_0x42323a(_0x47839f[_0x355c('0x17')](0x1f4,_0x37ac93['message']));});});};exports[_0x355c('0x25')]=function(_0x1b3623){return new Promise(function(_0x44d033,_0x2ba985){return db[_0x355c('0x1d')][_0x355c('0x26')]({'where':_0x1b3623[_0x355c('0x20')]?_0x1b3623['options'][_0x355c('0x27')]||null:null})[_0x355c('0x13')](function(_0xe3acb0){if(_0xe3acb0){return _0xe3acb0[_0x355c('0x28')](_0x1b3623[_0x355c('0x1f')][_0x355c('0x29')],_[_0x355c('0x2a')](_0x1b3623[_0x355c('0x1f')],['ids','id'])||{});}})[_0x355c('0x2b')](function(_0x299e7c){logger[_0x355c('0x14')]('AddTags',_0x1b3623);logger[_0x355c('0x16')]('AddTags',_0x1b3623,JSON[_0x355c('0x23')](_0x299e7c));_0x44d033(_0x299e7c);})[_0x355c('0x24')](function(_0x8fb348){logger['error'](_0x355c('0x2c'),_0x8fb348[_0x355c('0x19')],_0x1b3623);_0x2ba985(_this['error'](0x1f4,_0x8fb348[_0x355c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e911b41..dcefada 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 _0x339c=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0xd043d7,_0x2e88e8){var _0x27f311=function(_0x1beef8){while(--_0x1beef8){_0xd043d7['push'](_0xd043d7['shift']());}};_0x27f311(++_0x2e88e8);}(_0x339c,0x112));var _0xc339=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x339c[_0x17d9e3];return _0x14192d;};'use strict';var MailInteractionEvents=require(_0xc339('0x0'));var events=[_0xc339('0x1'),_0xc339('0x2'),_0xc339('0x3')];function createListener(_0x2d28e4,_0x257d64){return function(_0xfcfbfa){_0x257d64[_0xc339('0x4')](_0x2d28e4,_0xfcfbfa);};}function removeListener(_0x2cd166,_0x827891){return function(){MailInteractionEvents[_0xc339('0x5')](_0x2cd166,_0x827891);};}exports['register']=function(_0xa7eb3c){for(var _0x5ccc65=0x0,_0x2cb227=events[_0xc339('0x6')];_0x5ccc65<_0x2cb227;_0x5ccc65++){var _0x29fdc4=events[_0x5ccc65];var _0xb1bf5b=createListener(_0xc339('0x7')+_0x29fdc4,_0xa7eb3c);MailInteractionEvents['on'](_0x29fdc4,_0xb1bf5b);}}; \ No newline at end of file +var _0x7a75=['register','mailInteraction:','save','remove','emit','removeListener'];(function(_0x1e02d6,_0xcf046c){var _0x4f1232=function(_0x1432d4){while(--_0x1432d4){_0x1e02d6['push'](_0x1e02d6['shift']());}};_0x4f1232(++_0xcf046c);}(_0x7a75,0x14c));var _0x57a7=function(_0x2c2cf2,_0x3f15ba){_0x2c2cf2=_0x2c2cf2-0x0;var _0x4a3724=_0x7a75[_0x2c2cf2];return _0x4a3724;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x57a7('0x0'),_0x57a7('0x1'),'update'];function createListener(_0x3f12c1,_0x5efe95){return function(_0x4c38f7){_0x5efe95[_0x57a7('0x2')](_0x3f12c1,_0x4c38f7);};}function removeListener(_0xb3368b,_0x2a5dbd){return function(){MailInteractionEvents[_0x57a7('0x3')](_0xb3368b,_0x2a5dbd);};}exports[_0x57a7('0x4')]=function(_0x5db2ed){for(var _0x5df601=0x0,_0x4c2ab0=events['length'];_0x5df601<_0x4c2ab0;_0x5df601++){var _0x1b2e57=events[_0x5df601];var _0x501d97=createListener(_0x57a7('0x5')+_0x1b2e57,_0x5db2ed);MailInteractionEvents['on'](_0x1b2e57,_0x501d97);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 8257634..cb5737b 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 _0xeff8=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','/:id','show','download','post','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x552154,_0x33aa5a){var _0x3ac372=function(_0x28c37e){while(--_0x28c37e){_0x552154['push'](_0x552154['shift']());}};_0x3ac372(++_0x33aa5a);}(_0xeff8,0x186));var _0x8eff=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xeff8[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8eff('0x5'));var config=require(_0x8eff('0x6'));var controller=require(_0x8eff('0x7'));router[_0x8eff('0x8')]('/',auth['isAuthenticated'](),controller[_0x8eff('0x9')]);router[_0x8eff('0x8')](_0x8eff('0xa'),auth[_0x8eff('0xb')](),controller['describe']);router[_0x8eff('0x8')](_0x8eff('0xc'),auth[_0x8eff('0xb')](),controller[_0x8eff('0xd')]);router['get']('/:id/download',auth[_0x8eff('0xb')](),controller[_0x8eff('0xe')]);router[_0x8eff('0xf')]('/',auth['isAuthenticated'](),interaction[_0x8eff('0x10')](_0x8eff('0x11'),'mailmessage:create'),controller[_0x8eff('0x12')]);router[_0x8eff('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8eff('0x14')]);router[_0x8eff('0x13')](_0x8eff('0x15'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x16')]);router['put'](_0x8eff('0x17'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x18')]);router[_0x8eff('0x19')](_0x8eff('0xc'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x1a')]);module[_0x8eff('0x1b')]=router; \ No newline at end of file +var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x98a8,0x12c));var _0x898a=function(_0x5173d9,_0x3360d1){_0x5173d9=_0x5173d9-0x0;var _0x4b9bdc=_0x98a8[_0x5173d9];return _0x4b9bdc;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ba6a834..3b51cda 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 _0x8a01=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash','exports','TEXT'];(function(_0x3ec4be,_0x2ab8fc){var _0x70cc19=function(_0x10406b){while(--_0x10406b){_0x3ec4be['push'](_0x3ec4be['shift']());}};_0x70cc19(++_0x2ab8fc);}(_0x8a01,0x13c));var _0x18a0=function(_0x9657cb,_0x3d59b7){_0x9657cb=_0x9657cb-0x0;var _0xebd591=_0x8a01[_0x9657cb];return _0xebd591;};'use strict';var Sequelize=require('sequelize');var _=require(_0x18a0('0x0'));module[_0x18a0('0x1')]={'body':{'type':Sequelize[_0x18a0('0x2')](_0x18a0('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x18a0('0x2')](_0x18a0('0x4'))},'read':{'type':Sequelize[_0x18a0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x18a0('0x6')]('in',_0x18a0('0x7')),'defaultValue':_0x18a0('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x18a0('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x18a0('0x2')](_0x18a0('0x3'))},'cc':{'type':Sequelize[_0x18a0('0x2')]('long')},'bcc':{'type':Sequelize[_0x18a0('0x2')](_0x18a0('0x3'))},'subject':{'type':Sequelize[_0x18a0('0x2')]},'sentAt':{'type':Sequelize[_0x18a0('0x9')]},'attach':{'type':Sequelize[_0x18a0('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x18a0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x18a0('0x9')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT'](_0x18a0('0x3'))}}; \ No newline at end of file +var _0x97f4=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','sequelize','lodash'];(function(_0x30d49d,_0x462622){var _0x387115=function(_0x506903){while(--_0x506903){_0x30d49d['push'](_0x30d49d['shift']());}};_0x387115(++_0x462622);}(_0x97f4,0x166));var _0x497f=function(_0x54d7bd,_0x54cf67){_0x54d7bd=_0x54d7bd-0x0;var _0x5aa862=_0x97f4[_0x54d7bd];return _0x5aa862;};'use strict';var Sequelize=require(_0x497f('0x0'));var _=require(_0x497f('0x1'));module[_0x497f('0x2')]={'body':{'type':Sequelize[_0x497f('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x497f('0x3')](_0x497f('0x4'))},'read':{'type':Sequelize[_0x497f('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x497f('0x6')]('in',_0x497f('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x497f('0x8')]},'to':{'type':Sequelize[_0x497f('0x3')](_0x497f('0x9'))},'cc':{'type':Sequelize[_0x497f('0x3')](_0x497f('0x9'))},'bcc':{'type':Sequelize[_0x497f('0x3')](_0x497f('0x9'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x497f('0xa')]},'attach':{'type':Sequelize[_0x497f('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x497f('0x3')](_0x497f('0x9'))},'originCc':{'type':Sequelize[_0x497f('0x3')](_0x497f('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2f09665..931539e 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 _0xc244=['update','destroy','stack','name','index','MailMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','key','field','options','include','findAll','rows','show','params','includeAll','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','auth','user','pass','secure','attachments','join','server/files/attachments','basename','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','readAt','UserId','CmContact','Contact','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','accept','EventManager','acceptmessage','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','event','rejectmessage','download','toString','root','files','tmp','server','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./mailMessage.socket','register','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x50f431,_0x4489c7){var _0x498836=function(_0x11fc2e){while(--_0x11fc2e){_0x50f431['push'](_0x50f431['shift']());}};_0x498836(++_0x4489c7);}(_0xc244,0x114));var _0x4c24=function(_0x2854a1,_0x3f9675){_0x2854a1=_0x2854a1-0x0;var _0xa6589d=_0xc244[_0x2854a1];return _0xa6589d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4c24('0x0'));var zipdir=require(_0x4c24('0x1'));var jsonpatch=require(_0x4c24('0x2'));var rp=require(_0x4c24('0x3'));var moment=require(_0x4c24('0x4'));var BPromise=require(_0x4c24('0x5'));var Mustache=require(_0x4c24('0x6'));var util=require(_0x4c24('0x7'));var path=require('path');var sox=require(_0x4c24('0x8'));var csv=require(_0x4c24('0x9'));var ejs=require(_0x4c24('0xa'));var fs=require('fs');var _=require(_0x4c24('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c24('0xc'));var deskjs=require(_0x4c24('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4c24('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4c24('0xf'));var qs=require(_0x4c24('0x10'));var hardwareService=require(_0x4c24('0x11'));var logger=require(_0x4c24('0x12'))(_0x4c24('0x13'));var utils=require(_0x4c24('0x14'));var config=require('../../config/environment');var db=require(_0x4c24('0x15'))['db'];config['redis']=_[_0x4c24('0x16')](config[_0x4c24('0x17')],{'host':_0x4c24('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c24('0x17')]));require(_0x4c24('0x19'))[_0x4c24('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c24('0x1b')]['http']({'port':0x232c});var client9003=jayson[_0x4c24('0x1b')][_0x4c24('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x4c24('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x353662,_0x483bc1,_0x3300cd){if(_0x3300cd){var _0x2bd94f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bd94f[_0x4c24('0x1d')](_0x483bc1)){return _0x353662;}else{throw new Error(_0x4c24('0x1e'));}}else{return _0x353662;}}function respondWithRpcPromise(_0x506616,_0x2f543c,_0x19cfe1,_0x4b5dfb){return new BPromise(function(_0xeb87d,_0x50460e){var _0x1fc014=_0x4b5dfb||client;return _0x1fc014[_0x4c24('0x1f')](_0x506616,_0x19cfe1)[_0x4c24('0x20')](function(_0x55324a){logger[_0x4c24('0x21')](_0x4c24('0x22'),_0x2f543c,_0x4c24('0x23'));logger['debug'](_0x4c24('0x24'),_0x2f543c,_0x4c24('0x23'),JSON[_0x4c24('0x25')](_0x55324a));if(_0x55324a[_0x4c24('0x26')]){if(_0x55324a[_0x4c24('0x26')][_0x4c24('0x27')]===0x1f4){logger['error'](_0x4c24('0x22'),_0x2f543c,_0x55324a['error']['message']);return _0x50460e(_0x55324a[_0x4c24('0x26')]['message']);}logger[_0x4c24('0x26')](_0x4c24('0x22'),_0x2f543c,_0x55324a[_0x4c24('0x26')]['message']);return _0xeb87d(_0x55324a[_0x4c24('0x26')]['message']);}else{logger[_0x4c24('0x21')](_0x4c24('0x22'),_0x2f543c,_0x4c24('0x23'));_0xeb87d(_0x55324a[_0x4c24('0x28')][_0x4c24('0x29')]);}})[_0x4c24('0x2a')](function(_0x303471){logger[_0x4c24('0x26')]('MailMessage,\x20%s,\x20%s',_0x2f543c,_0x303471);_0x50460e(_0x303471);});});}function respondWithStatusCode(_0x395c82,_0x3270d8){_0x3270d8=_0x3270d8||0xcc;return function(_0xfc2fb5){if(_0xfc2fb5){return _0x395c82['sendStatus'](_0x3270d8);}return _0x395c82['status'](_0x3270d8)[_0x4c24('0x2b')]();};}function respondWithResult(_0x4b4476,_0x26e27d){_0x26e27d=_0x26e27d||0xc8;return function(_0x4862a7){if(_0x4862a7){return _0x4b4476[_0x4c24('0x2c')](_0x26e27d)[_0x4c24('0x2d')](_0x4862a7);}};}function respondWithFilteredResult(_0x31db21,_0x33f576){return function(_0xc70654){if(_0xc70654){var _0x29978d=_0xc70654[_0x4c24('0x2e')],_0x2c2db3=_0x33f576[_0x4c24('0x2f')],_0x5c81f0=_0x33f576[_0x4c24('0x2f')]+_0x33f576[_0x4c24('0x30')],_0x21281d;if(_0x5c81f0>=_0x29978d){_0x5c81f0=_0x29978d;_0x21281d=0xc8;}else{_0x21281d=0xce;}_0x31db21[_0x4c24('0x2c')](_0x21281d);return _0x31db21[_0x4c24('0x31')](_0x4c24('0x32'),_0x2c2db3+'-'+_0x5c81f0+'/'+_0x29978d)[_0x4c24('0x2d')](_0xc70654);}return null;};}function patchUpdates(_0x2443b4){return function(_0x2ad981){try{jsonpatch[_0x4c24('0x33')](_0x2ad981,_0x2443b4,!![]);}catch(_0x20c9d3){return BPromise[_0x4c24('0x34')](_0x20c9d3);}return _0x2ad981[_0x4c24('0x35')]();};}function saveUpdates(_0x5a1ee2,_0x9b897e){return function(_0x222683){if(_0x222683){return _0x222683[_0x4c24('0x36')](_0x5a1ee2)[_0x4c24('0x20')](function(_0xcc271c){return _0xcc271c;});}return null;};}function removeEntity(_0x1172b9,_0x4d7ab2){return function(_0x545807){if(_0x545807){return _0x545807[_0x4c24('0x37')]()['then'](function(){_0x1172b9[_0x4c24('0x2c')](0xcc)[_0x4c24('0x2b')]();});}};}function handleEntityNotFound(_0x1f45d0,_0x18acb5){return function(_0x204077){if(!_0x204077){_0x1f45d0['sendStatus'](0x194);}return _0x204077;};}function handleError(_0xdc6800,_0x263e6e){_0x263e6e=_0x263e6e||0x1f4;return function(_0x4be3d5){logger[_0x4c24('0x26')](_0x4be3d5[_0x4c24('0x38')]);if(_0x4be3d5['name']){delete _0x4be3d5[_0x4c24('0x39')];}_0xdc6800[_0x4c24('0x2c')](_0x263e6e)['send'](_0x4be3d5);};}exports[_0x4c24('0x3a')]=function(_0x63357e,_0x5b8e51){var _0x8edbc1={},_0x47d75d={},_0x52560a={'count':0x0,'rows':[]};var _0x575b13=db[_0x4c24('0x3b')][_0x4c24('0x3c')];_0x47d75d[_0x4c24('0x3d')]=_[_0x4c24('0x3e')](_0x575b13);_0x47d75d[_0x4c24('0x3f')]=_['keys'](_0x63357e['query']);_0x47d75d[_0x4c24('0x40')]=_[_0x4c24('0x41')](_0x47d75d[_0x4c24('0x3d')],_0x47d75d['query']);_0x8edbc1[_0x4c24('0x42')]=_[_0x4c24('0x41')](_0x47d75d['model'],qs['fields'](_0x63357e[_0x4c24('0x3f')][_0x4c24('0x43')]));_0x8edbc1[_0x4c24('0x42')]=_0x8edbc1[_0x4c24('0x42')][_0x4c24('0x44')]?_0x8edbc1[_0x4c24('0x42')]:_0x47d75d['model'];if(!_0x63357e[_0x4c24('0x3f')]['hasOwnProperty'](_0x4c24('0x45'))){_0x8edbc1['limit']=qs[_0x4c24('0x30')](_0x63357e['query'][_0x4c24('0x30')]);_0x8edbc1['offset']=qs['offset'](_0x63357e[_0x4c24('0x3f')]['offset']);}_0x8edbc1[_0x4c24('0x46')]=qs[_0x4c24('0x47')](_0x63357e[_0x4c24('0x3f')]['sort']);_0x8edbc1['where']=qs[_0x4c24('0x40')](_[_0x4c24('0x48')](_0x63357e[_0x4c24('0x3f')],_0x47d75d['filters']));if(_0x63357e['query'][_0x4c24('0x49')]){_0x8edbc1['where']=_[_0x4c24('0x4a')](_0x8edbc1[_0x4c24('0x4b')],{'$or':_['map'](_0x575b13,function(_0x2bea3e){if(_0x2bea3e[_0x4c24('0x4c')][_0x4c24('0x4d')]!=='VIRTUAL'){var _0x65ae0a={};_0x65ae0a[_0x2bea3e[_0x4c24('0x4e')]]={'$like':'%'+_0x63357e['query'][_0x4c24('0x49')]+'%'};return _0x65ae0a;}})});}_0x8edbc1=_['merge']({},_0x8edbc1,_0x63357e[_0x4c24('0x4f')]);var _0x4cf1a2={'where':_0x8edbc1['where']};return db['MailMessage'][_0x4c24('0x2e')](_0x4cf1a2)[_0x4c24('0x20')](function(_0x5ea021){_0x52560a['count']=_0x5ea021;if(_0x63357e[_0x4c24('0x3f')]['includeAll']){_0x8edbc1[_0x4c24('0x50')]=[{'all':!![]}];}return db['MailMessage'][_0x4c24('0x51')](_0x8edbc1);})[_0x4c24('0x20')](function(_0x40cc98){_0x52560a[_0x4c24('0x52')]=_0x40cc98;return _0x52560a;})[_0x4c24('0x20')](respondWithFilteredResult(_0x5b8e51,_0x8edbc1))['catch'](handleError(_0x5b8e51,null));};exports[_0x4c24('0x53')]=function(_0x389140,_0x577cea){var _0x34f10c={'raw':!![],'where':{'id':_0x389140[_0x4c24('0x54')]['id']}},_0x2294a1={};_0x2294a1['model']=_[_0x4c24('0x3e')](db[_0x4c24('0x3b')][_0x4c24('0x3c')]);_0x2294a1[_0x4c24('0x3f')]=_['keys'](_0x389140[_0x4c24('0x3f')]);_0x2294a1[_0x4c24('0x40')]=_[_0x4c24('0x41')](_0x2294a1[_0x4c24('0x3d')],_0x2294a1[_0x4c24('0x3f')]);_0x34f10c[_0x4c24('0x42')]=_[_0x4c24('0x41')](_0x2294a1[_0x4c24('0x3d')],qs[_0x4c24('0x43')](_0x389140[_0x4c24('0x3f')]['fields']));_0x34f10c['attributes']=_0x34f10c[_0x4c24('0x42')][_0x4c24('0x44')]?_0x34f10c[_0x4c24('0x42')]:_0x2294a1[_0x4c24('0x3d')];if(_0x389140[_0x4c24('0x3f')][_0x4c24('0x55')]){_0x34f10c[_0x4c24('0x50')]=[{'all':!![]}];}_0x34f10c=_['merge']({},_0x34f10c,_0x389140[_0x4c24('0x4f')]);return db[_0x4c24('0x3b')][_0x4c24('0x56')](_0x34f10c)[_0x4c24('0x20')](handleEntityNotFound(_0x577cea,null))[_0x4c24('0x20')](respondWithResult(_0x577cea,null))[_0x4c24('0x2a')](handleError(_0x577cea,null));};exports[_0x4c24('0x36')]=function(_0x4f71c0,_0xf57f1a){if(_0x4f71c0[_0x4c24('0x57')]['id']){delete _0x4f71c0[_0x4c24('0x57')]['id'];}return db[_0x4c24('0x3b')][_0x4c24('0x56')]({'where':{'id':_0x4f71c0[_0x4c24('0x54')]['id']}})['then'](handleEntityNotFound(_0xf57f1a,null))['then'](saveUpdates(_0x4f71c0[_0x4c24('0x57')],null))[_0x4c24('0x20')](respondWithResult(_0xf57f1a,null))[_0x4c24('0x2a')](handleError(_0xf57f1a,null));};exports[_0x4c24('0x37')]=function(_0x444252,_0x341038){return db[_0x4c24('0x3b')][_0x4c24('0x56')]({'where':{'id':_0x444252[_0x4c24('0x54')]['id']}})[_0x4c24('0x20')](handleEntityNotFound(_0x341038,null))[_0x4c24('0x20')](removeEntity(_0x341038,null))[_0x4c24('0x2a')](handleError(_0x341038,null));};exports[_0x4c24('0x58')]=function(_0x4ccc99,_0x1de66a){return db[_0x4c24('0x3b')][_0x4c24('0x58')]()['then'](respondWithResult(_0x1de66a,null))[_0x4c24('0x2a')](handleError(_0x1de66a,null));};exports[_0x4c24('0x59')]=function(_0x41dd54,_0xefa989){return db['MailMessage'][_0x4c24('0x59')](_0x41dd54[_0x4c24('0x57')])[_0x4c24('0x20')](function(_0x58e05d){if(_0x58e05d){if(_0x58e05d[_0x4c24('0x5a')]===_0x4c24('0x5b')&&!_0x58e05d[_0x4c24('0x5c')]){return db[_0x4c24('0x5d')][_0x4c24('0x5e')]({'where':{'id':_0x58e05d[_0x4c24('0x5f')]},'include':[{'model':db[_0x4c24('0x60')],'as':_0x4c24('0x61'),'raw':!![]}]})['then'](function(_0x3ec680){if(_0x3ec680&&_0x3ec680[_0x4c24('0x61')]){var _0x523661={'tls':{'rejectUnauthorized':![]}};if(_[_0x4c24('0x62')](_0x3ec680['Smtp'][_0x4c24('0x63')])){_0x523661[_0x4c24('0x64')]=_0x3ec680[_0x4c24('0x61')][_0x4c24('0x64')];_0x523661[_0x4c24('0x65')]=_0x3ec680[_0x4c24('0x61')][_0x4c24('0x65')];_0x523661['secure']=_0x3ec680[_0x4c24('0x61')]['secure'];if(_0x3ec680[_0x4c24('0x61')]['authentication']){_0x523661[_0x4c24('0x66')]={'user':_0x3ec680[_0x4c24('0x61')][_0x4c24('0x67')],'pass':_0x3ec680[_0x4c24('0x61')][_0x4c24('0x68')]};}}else{_0x523661['service']=_0x3ec680[_0x4c24('0x61')]['service'];_0x523661[_0x4c24('0x66')]={'user':_0x3ec680[_0x4c24('0x61')][_0x4c24('0x67')],'pass':_0x3ec680[_0x4c24('0x61')]['pass']};_0x523661[_0x4c24('0x69')]=_0x3ec680[_0x4c24('0x61')]['secure'];}if(_0x41dd54[_0x4c24('0x57')][_0x4c24('0x6a')]&&_0x41dd54[_0x4c24('0x57')][_0x4c24('0x6a')][_0x4c24('0x44')]){for(var _0x1aa62f=0x0;_0x1aa62f<_0x41dd54[_0x4c24('0x57')]['attachments'][_0x4c24('0x44')];_0x1aa62f+=0x1){_0x41dd54[_0x4c24('0x57')][_0x4c24('0x6a')][_0x1aa62f]={'filename':_0x41dd54[_0x4c24('0x57')][_0x4c24('0x6a')][_0x1aa62f][_0x4c24('0x39')],'path':path[_0x4c24('0x6b')](config['root'],_0x4c24('0x6c'),_0x41dd54[_0x4c24('0x57')]['attachments'][_0x1aa62f][_0x4c24('0x6d')])};}}return{'account':_0x523661,'message':_0x41dd54[_0x4c24('0x57')]};}})['then'](function(_0x31d0fa){if(_0x31d0fa){return respondWithRpcPromise('SendMail',_0x4c24('0x6e'),_0x31d0fa,client9003)[_0x4c24('0x20')](function(_0x51572a){return _0x58e05d[_0x4c24('0x36')]({'read':!![],'messageId':_0x51572a[_0x4c24('0x6f')],'sentAt':moment()[_0x4c24('0x70')](_0x4c24('0x71'))});})[_0x4c24('0x2a')](function(_0x3fcfed){logger[_0x4c24('0x26')]('%s',JSON[_0x4c24('0x25')](_0x3fcfed));return _0x58e05d;});}return _0x58e05d;});}return _0x58e05d;}})[_0x4c24('0x20')](respondWithResult(_0xefa989,0xc9))[_0x4c24('0x2a')](handleError(_0xefa989,null));};var interaction_log=require(_0x4c24('0x12'))(_0x4c24('0x72'));exports['accept']=function(_0x26d849,_0x1fc3c5,_0x51750f){var _0x2272ec={'channel':_0x4c24('0x73')};if(_0x26d849['body']['id']){delete _0x26d849[_0x4c24('0x57')]['id'];}_0x26d849[_0x4c24('0x57')][_0x4c24('0x74')]=!![];_0x26d849[_0x4c24('0x57')][_0x4c24('0x75')]=moment()[_0x4c24('0x70')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d849[_0x4c24('0x57')][_0x4c24('0x76')]=_0x26d849[_0x4c24('0x57')]['UserId']||_0x26d849[_0x4c24('0x67')]['id'];return db[_0x4c24('0x3b')][_0x4c24('0x56')]({'where':{'id':_0x26d849[_0x4c24('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x4c24('0x77')],'as':_0x4c24('0x78')}]})[_0x4c24('0x20')](handleEntityNotFound(_0x1fc3c5,null))[_0x4c24('0x20')](saveUpdates(_0x26d849['body'],null))[_0x4c24('0x20')](function(_0x2ce211){if(_0x2ce211){_0x2272ec[_0x4c24('0x29')]=_0x2ce211[_0x4c24('0x79')]({'plain':!![]});return db['MailInteraction'][_0x4c24('0x56')]({'where':{'id':_0x2ce211[_0x4c24('0x7a')]}});}return null;})[_0x4c24('0x20')](handleEntityNotFound(_0x1fc3c5,null))[_0x4c24('0x20')](function(_0x227676){if(_0x227676){return _0x227676[_0x4c24('0x36')]({'UserId':_0x26d849[_0x4c24('0x57')]['UserId'],'read1stAt':_[_0x4c24('0x62')](_0x227676[_0x4c24('0x7b')])?moment()[_0x4c24('0x70')](_0x4c24('0x71')):undefined});}return null;})[_0x4c24('0x20')](function(_0x1076c1){if(_0x1076c1){_0x2272ec[_0x4c24('0x7c')]=_0x1076c1[_0x4c24('0x79')]({'plain':!![]});interaction_log[_0x4c24('0x21')](_0x4c24('0x7d'),_0x26d849[_0x4c24('0x67')]['id'],_0x26d849[_0x4c24('0x67')][_0x4c24('0x39')],_0x26d849['user'][_0x4c24('0x7e')],_0x2272ec[_0x4c24('0x7c')]['id'],_0x26d849[_0x4c24('0x57')]?JSON[_0x4c24('0x25')](_0x26d849['body']):_0x4c24('0x7f'));return respondWithRpcPromise(_0x4c24('0x80'),_0x4c24('0x81'),_0x2272ec);}return null;})['then'](function(_0x3cb117){if(_0x3cb117){if(_0x26d849[_0x4c24('0x57')][_0x4c24('0x82')]){_0x2272ec['message'][_0x4c24('0x83')]=util[_0x4c24('0x70')]('SIP/%s',_0x26d849[_0x4c24('0x67')][_0x4c24('0x39')]);_0x2272ec[_0x4c24('0x29')][_0x4c24('0x84')]=_0x2272ec[_0x4c24('0x84')];_0x2272ec[_0x4c24('0x29')]['event']=_0x4c24('0x85');return respondWithRpcPromise(_0x4c24('0x86'),_0x4c24('0x86'),{'event':_0x4c24('0x87'),'message':_0x2272ec['message']},client9002)[_0x4c24('0x20')](function(){return _0x2272ec;});}return _0x2272ec;}return null;})['then'](respondWithResult(_0x1fc3c5,null))[_0x4c24('0x2a')](handleError(_0x1fc3c5,null));};var interaction_log=require(_0x4c24('0x12'))(_0x4c24('0x72'));exports['reject']=function(_0x460c4,_0x3044e2,_0x3815b8){var _0x339b55={'agent':{},'channel':_0x4c24('0x73')};if(_0x460c4[_0x4c24('0x57')]['id']){delete _0x460c4[_0x4c24('0x57')]['id'];}_0x460c4[_0x4c24('0x57')][_0x4c24('0x76')]=_0x460c4[_0x4c24('0x57')][_0x4c24('0x76')]||_0x460c4[_0x4c24('0x67')]['id'];_0x339b55[_0x4c24('0x88')]['id']=_0x460c4[_0x4c24('0x57')][_0x4c24('0x76')];return db[_0x4c24('0x3b')][_0x4c24('0x56')]({'where':{'id':_0x460c4[_0x4c24('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3044e2,null))[_0x4c24('0x20')](function(_0x33264b){if(_0x33264b){_0x339b55['message']=_0x33264b[_0x4c24('0x79')]({'plain':!![]});return db[_0x4c24('0x89')][_0x4c24('0x56')]({'where':{'id':_0x33264b['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3044e2,null))[_0x4c24('0x20')](function(_0x172687){if(_0x172687){_0x339b55[_0x4c24('0x7c')]=_0x172687[_0x4c24('0x79')]({'plain':!![]});interaction_log['info'](_0x4c24('0x8a'),_0x460c4[_0x4c24('0x67')]['id'],_0x460c4['user'][_0x4c24('0x39')],_0x460c4[_0x4c24('0x67')]['role'],_0x339b55[_0x4c24('0x7c')]['id'],_0x460c4[_0x4c24('0x57')]?JSON[_0x4c24('0x25')](_0x460c4[_0x4c24('0x57')]):_0x4c24('0x7f'));return respondWithRpcPromise('RejectMessage',_0x4c24('0x8b'),_0x339b55);}return null;})[_0x4c24('0x20')](function(_0x503423){if(_0x503423){_0x503423[_0x4c24('0x29')][_0x4c24('0x83')]=util[_0x4c24('0x70')](_0x4c24('0x8c'),_0x460c4[_0x4c24('0x67')][_0x4c24('0x39')]);_0x503423[_0x4c24('0x29')][_0x4c24('0x84')]=_0x339b55[_0x4c24('0x84')];_0x503423['message'][_0x4c24('0x8d')]=_0x4c24('0x34');respondWithRpcPromise(_0x4c24('0x86'),_0x4c24('0x86'),{'event':_0x4c24('0x8e'),'message':_0x503423['message']},client9002);return _0x339b55;}return null;})['then'](respondWithResult(_0x3044e2,null))['catch'](handleError(_0x3044e2,null));};exports[_0x4c24('0x8f')]=function(_0x6e0b35,_0x362815){var _0x5abc75=moment()['unix']()[_0x4c24('0x90')]();var _0x4f6e74=path[_0x4c24('0x6b')](config[_0x4c24('0x91')],'server',_0x4c24('0x92'),_0x4c24('0x93'));var _0x3dbf45=path[_0x4c24('0x6b')](config['root'],_0x4c24('0x94'),_0x4c24('0x92'),'attachments');var _0x11bf1a=util[_0x4c24('0x70')](_0x4c24('0x95'),_0x5abc75);return db[_0x4c24('0x3b')][_0x4c24('0x56')]({'where':{'id':_0x6e0b35['params']['id']},'attributes':['id',_0x4c24('0x57'),_0x4c24('0x96'),'to','cc',_0x4c24('0x97'),'subject',_0x4c24('0x98')],'include':_0x6e0b35[_0x4c24('0x3f')][_0x4c24('0x6a')]?[{'model':db[_0x4c24('0x99')],'as':_0x4c24('0x9a')}]:undefined})[_0x4c24('0x20')](handleEntityNotFound(_0x362815,null))['then'](function(_0x202b81){if(_0x202b81){var _0x268efd=_0x202b81;var _0x54f904={'from':_0x268efd[_0x4c24('0x96')],'to':_0x268efd['to'],'subject':_0x268efd[_0x4c24('0x9b')],'html':_0x268efd[_0x4c24('0x57')],'headers':{'Date':moment(_0x268efd[_0x4c24('0x98')])['format'](_0x4c24('0x9c'))},'attachments':[]};if(_0x202b81['cc']){_0x54f904[_0x4c24('0x9d')]['Cc']=_0x202b81['cc'];}if(_0x202b81['bcc']){_0x54f904[_0x4c24('0x9d')][_0x4c24('0x9e')]=_0x202b81['bcc'];}return new BPromise(function(_0x3c81c1,_0x259824){if(_0x202b81[_0x4c24('0x9a')]){for(var _0x5c5693=0x0;_0x5c5693<_0x202b81[_0x4c24('0x9a')][_0x4c24('0x44')];_0x5c5693++){var _0x3e073e=_0x202b81[_0x4c24('0x9a')][_0x5c5693];var _0xb488ec=path[_0x4c24('0x6b')](_0x3dbf45,_0x3e073e[_0x4c24('0x6d')]);if(fs[_0x4c24('0x9f')](_0xb488ec)){_0x54f904[_0x4c24('0x6a')]['push']({'name':_0x3e073e['name'],'contentType':_0x3e073e[_0x4c24('0x4c')],'data':fs[_0x4c24('0xa0')](_0xb488ec)});}}}emlformat[_0x4c24('0xa1')](_0x54f904,function(_0x305da0,_0x1c6784){if(_0x305da0)return _0x259824(_0x305da0);fs['writeFileSync'](path[_0x4c24('0x6b')](_0x4f6e74,_0x11bf1a),_0x1c6784);return _0x3c81c1(_0x1c6784);});});}})['then'](function(_0x48f734){if(_0x48f734){return _0x362815[_0x4c24('0x8f')](path['join'](_0x4f6e74,_0x11bf1a),_0x11bf1a,function(_0x51439e){if(_0x51439e){console[_0x4c24('0xa2')](_0x4c24('0xa3'),_0x51439e);}else{fs[_0x4c24('0xa4')](path['join'](_0x4f6e74,_0x11bf1a));}});}})[_0x4c24('0x2a')](handleError(_0x362815,null));}; \ No newline at end of file +var _0x767f=['existsSync','readFileSync','writeFileSync','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailMessage.socket','register','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','map','type','VIRTUAL','merge','MailMessage','count','includeAll','include','findAll','rows','show','params','options','find','body','destroy','describe','create','direction','out','secret','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','authentication','auth','pass','secure','attachments','root','server/files/attachments','basename','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','UserId','user','CmContact','Contact','MailInteraction','MailInteractionId','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','download','unix','join','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','headers','bcc','Bcc'];(function(_0x5b8097,_0x1f4314){var _0x2207b8=function(_0x4b59a3){while(--_0x4b59a3){_0x5b8097['push'](_0x5b8097['shift']());}};_0x2207b8(++_0x1f4314);}(_0x767f,0x144));var _0xf767=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x767f[_0x2235bf];return _0x4c3a64;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf767('0x0'));var rimraf=require(_0xf767('0x1'));var zipdir=require(_0xf767('0x2'));var jsonpatch=require(_0xf767('0x3'));var rp=require('request-promise');var moment=require(_0xf767('0x4'));var BPromise=require(_0xf767('0x5'));var Mustache=require('mustache');var util=require(_0xf767('0x6'));var path=require(_0xf767('0x7'));var sox=require('sox');var csv=require(_0xf767('0x8'));var ejs=require(_0xf767('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf767('0xa'));var deskjs=require(_0xf767('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf767('0xc'));var Redis=require(_0xf767('0xd'));var authService=require(_0xf767('0xe'));var qs=require(_0xf767('0xf'));var hardwareService=require(_0xf767('0x10'));var logger=require(_0xf767('0x11'))(_0xf767('0x12'));var utils=require('../../config/utils');var config=require(_0xf767('0x13'));var db=require(_0xf767('0x14'))['db'];config[_0xf767('0x15')]=_[_0xf767('0x16')](config[_0xf767('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf767('0x15')]));require(_0xf767('0x17'))[_0xf767('0x18')](socket);var jayson=require(_0xf767('0x19'));var client=jayson[_0xf767('0x1a')][_0xf767('0x1b')]({'port':0x232c});var client9003=jayson['client'][_0xf767('0x1b')]({'port':0x232b});var client9002=jayson[_0xf767('0x1a')][_0xf767('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x589f6b,_0x42f3b9,_0x11130f){if(_0x11130f){var _0x2d8a76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d8a76['test'](_0x42f3b9)){return _0x589f6b;}else{throw new Error(_0xf767('0x1c'));}}else{return _0x589f6b;}}function respondWithRpcPromise(_0x2075a7,_0x553a79,_0x18a625,_0x15c348){return new BPromise(function(_0x5b0f17,_0x12746f){var _0x2043f6=_0x15c348||client;return _0x2043f6['request'](_0x2075a7,_0x18a625)[_0xf767('0x1d')](function(_0x483a14){logger[_0xf767('0x1e')](_0xf767('0x1f'),_0x553a79,_0xf767('0x20'));logger[_0xf767('0x21')](_0xf767('0x22'),_0x553a79,_0xf767('0x20'),JSON[_0xf767('0x23')](_0x483a14));if(_0x483a14[_0xf767('0x24')]){if(_0x483a14[_0xf767('0x24')][_0xf767('0x25')]===0x1f4){logger[_0xf767('0x24')]('MailMessage,\x20%s,\x20%s',_0x553a79,_0x483a14[_0xf767('0x24')][_0xf767('0x26')]);return _0x12746f(_0x483a14[_0xf767('0x24')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x553a79,_0x483a14[_0xf767('0x24')][_0xf767('0x26')]);return _0x5b0f17(_0x483a14[_0xf767('0x24')]['message']);}else{logger['info'](_0xf767('0x1f'),_0x553a79,'request\x20sent');_0x5b0f17(_0x483a14['result']['message']);}})[_0xf767('0x27')](function(_0x42d6a8){logger['error'](_0xf767('0x1f'),_0x553a79,_0x42d6a8);_0x12746f(_0x42d6a8);});});}function respondWithStatusCode(_0x31acdc,_0x108694){_0x108694=_0x108694||0xcc;return function(_0x19a13e){if(_0x19a13e){return _0x31acdc[_0xf767('0x28')](_0x108694);}return _0x31acdc[_0xf767('0x29')](_0x108694)['end']();};}function respondWithResult(_0x362803,_0x27956c){_0x27956c=_0x27956c||0xc8;return function(_0x4c5993){if(_0x4c5993){return _0x362803['status'](_0x27956c)[_0xf767('0x2a')](_0x4c5993);}};}function respondWithFilteredResult(_0x306b10,_0x3a7910){return function(_0x3f7d74){if(_0x3f7d74){var _0x5d1249=_0x3f7d74['count'],_0x12e17f=_0x3a7910[_0xf767('0x2b')],_0xbee49b=_0x3a7910[_0xf767('0x2b')]+_0x3a7910[_0xf767('0x2c')],_0xd44c4;if(_0xbee49b>=_0x5d1249){_0xbee49b=_0x5d1249;_0xd44c4=0xc8;}else{_0xd44c4=0xce;}_0x306b10[_0xf767('0x29')](_0xd44c4);return _0x306b10[_0xf767('0x2d')](_0xf767('0x2e'),_0x12e17f+'-'+_0xbee49b+'/'+_0x5d1249)[_0xf767('0x2a')](_0x3f7d74);}return null;};}function patchUpdates(_0x319ccb){return function(_0x59657e){try{jsonpatch[_0xf767('0x2f')](_0x59657e,_0x319ccb,!![]);}catch(_0x59219f){return BPromise['reject'](_0x59219f);}return _0x59657e[_0xf767('0x30')]();};}function saveUpdates(_0x177901,_0x4d505c){return function(_0x55a3ae){if(_0x55a3ae){return _0x55a3ae[_0xf767('0x31')](_0x177901)['then'](function(_0x3e5ec2){return _0x3e5ec2;});}return null;};}function removeEntity(_0x3b17ff,_0x2e3d50){return function(_0x111d23){if(_0x111d23){return _0x111d23['destroy']()['then'](function(){_0x3b17ff[_0xf767('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29ce38,_0x4a96f7){return function(_0xdccbc1){if(!_0xdccbc1){_0x29ce38[_0xf767('0x28')](0x194);}return _0xdccbc1;};}function handleError(_0x14fb48,_0x22bb3c){_0x22bb3c=_0x22bb3c||0x1f4;return function(_0x227711){logger[_0xf767('0x24')](_0x227711[_0xf767('0x32')]);if(_0x227711[_0xf767('0x33')]){delete _0x227711['name'];}_0x14fb48[_0xf767('0x29')](_0x22bb3c)[_0xf767('0x34')](_0x227711);};}exports[_0xf767('0x35')]=function(_0x327852,_0x337fbd){var _0x5e48cc={},_0x192c65={},_0x25c08e={'count':0x0,'rows':[]};var _0x2e5a93=db['MailMessage'][_0xf767('0x36')];_0x192c65[_0xf767('0x37')]=_[_0xf767('0x38')](_0x2e5a93);_0x192c65[_0xf767('0x39')]=_['keys'](_0x327852[_0xf767('0x39')]);_0x192c65[_0xf767('0x3a')]=_['intersection'](_0x192c65[_0xf767('0x37')],_0x192c65[_0xf767('0x39')]);_0x5e48cc[_0xf767('0x3b')]=_[_0xf767('0x3c')](_0x192c65[_0xf767('0x37')],qs[_0xf767('0x3d')](_0x327852[_0xf767('0x39')][_0xf767('0x3d')]));_0x5e48cc[_0xf767('0x3b')]=_0x5e48cc[_0xf767('0x3b')][_0xf767('0x3e')]?_0x5e48cc[_0xf767('0x3b')]:_0x192c65[_0xf767('0x37')];if(!_0x327852['query'][_0xf767('0x3f')](_0xf767('0x40'))){_0x5e48cc[_0xf767('0x2c')]=qs['limit'](_0x327852['query']['limit']);_0x5e48cc[_0xf767('0x2b')]=qs[_0xf767('0x2b')](_0x327852[_0xf767('0x39')]['offset']);}_0x5e48cc['order']=qs['sort'](_0x327852['query']['sort']);_0x5e48cc[_0xf767('0x41')]=qs[_0xf767('0x3a')](_[_0xf767('0x42')](_0x327852[_0xf767('0x39')],_0x192c65[_0xf767('0x3a')]));if(_0x327852[_0xf767('0x39')][_0xf767('0x43')]){_0x5e48cc[_0xf767('0x41')]=_['merge'](_0x5e48cc[_0xf767('0x41')],{'$or':_[_0xf767('0x44')](_0x2e5a93,function(_0x3b1906){if(_0x3b1906[_0xf767('0x45')]['key']!==_0xf767('0x46')){var _0x4d97a1={};_0x4d97a1[_0x3b1906['field']]={'$like':'%'+_0x327852[_0xf767('0x39')][_0xf767('0x43')]+'%'};return _0x4d97a1;}})});}_0x5e48cc=_[_0xf767('0x47')]({},_0x5e48cc,_0x327852['options']);var _0x2237b8={'where':_0x5e48cc['where']};return db[_0xf767('0x48')][_0xf767('0x49')](_0x2237b8)[_0xf767('0x1d')](function(_0x2b7a5d){_0x25c08e[_0xf767('0x49')]=_0x2b7a5d;if(_0x327852[_0xf767('0x39')][_0xf767('0x4a')]){_0x5e48cc[_0xf767('0x4b')]=[{'all':!![]}];}return db[_0xf767('0x48')][_0xf767('0x4c')](_0x5e48cc);})[_0xf767('0x1d')](function(_0x54b289){_0x25c08e[_0xf767('0x4d')]=_0x54b289;return _0x25c08e;})[_0xf767('0x1d')](respondWithFilteredResult(_0x337fbd,_0x5e48cc))['catch'](handleError(_0x337fbd,null));};exports[_0xf767('0x4e')]=function(_0x2ec2ba,_0x28b782){var _0x1dc1b0={'raw':!![],'where':{'id':_0x2ec2ba[_0xf767('0x4f')]['id']}},_0x4562d2={};_0x4562d2['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x4562d2[_0xf767('0x39')]=_['keys'](_0x2ec2ba[_0xf767('0x39')]);_0x4562d2[_0xf767('0x3a')]=_[_0xf767('0x3c')](_0x4562d2[_0xf767('0x37')],_0x4562d2['query']);_0x1dc1b0['attributes']=_['intersection'](_0x4562d2[_0xf767('0x37')],qs[_0xf767('0x3d')](_0x2ec2ba[_0xf767('0x39')]['fields']));_0x1dc1b0[_0xf767('0x3b')]=_0x1dc1b0[_0xf767('0x3b')][_0xf767('0x3e')]?_0x1dc1b0[_0xf767('0x3b')]:_0x4562d2[_0xf767('0x37')];if(_0x2ec2ba[_0xf767('0x39')][_0xf767('0x4a')]){_0x1dc1b0[_0xf767('0x4b')]=[{'all':!![]}];}_0x1dc1b0=_['merge']({},_0x1dc1b0,_0x2ec2ba[_0xf767('0x50')]);return db[_0xf767('0x48')][_0xf767('0x51')](_0x1dc1b0)['then'](handleEntityNotFound(_0x28b782,null))[_0xf767('0x1d')](respondWithResult(_0x28b782,null))[_0xf767('0x27')](handleError(_0x28b782,null));};exports[_0xf767('0x31')]=function(_0x354c16,_0x34d279){if(_0x354c16[_0xf767('0x52')]['id']){delete _0x354c16['body']['id'];}return db[_0xf767('0x48')]['find']({'where':{'id':_0x354c16[_0xf767('0x4f')]['id']}})[_0xf767('0x1d')](handleEntityNotFound(_0x34d279,null))[_0xf767('0x1d')](saveUpdates(_0x354c16[_0xf767('0x52')],null))['then'](respondWithResult(_0x34d279,null))[_0xf767('0x27')](handleError(_0x34d279,null));};exports[_0xf767('0x53')]=function(_0x190cd9,_0x42772f){return db['MailMessage'][_0xf767('0x51')]({'where':{'id':_0x190cd9[_0xf767('0x4f')]['id']}})[_0xf767('0x1d')](handleEntityNotFound(_0x42772f,null))['then'](removeEntity(_0x42772f,null))[_0xf767('0x27')](handleError(_0x42772f,null));};exports[_0xf767('0x54')]=function(_0x374deb,_0x39b6b1){return db[_0xf767('0x48')][_0xf767('0x54')]()[_0xf767('0x1d')](respondWithResult(_0x39b6b1,null))['catch'](handleError(_0x39b6b1,null));};exports[_0xf767('0x55')]=function(_0x106adf,_0x865f42){return db[_0xf767('0x48')]['create'](_0x106adf['body'])['then'](function(_0x5eeed8){if(_0x5eeed8){if(_0x5eeed8[_0xf767('0x56')]===_0xf767('0x57')&&!_0x5eeed8[_0xf767('0x58')]){return db['MailAccount'][_0xf767('0x59')]({'where':{'id':_0x5eeed8[_0xf767('0x5a')]},'include':[{'model':db[_0xf767('0x5b')],'as':_0xf767('0x5c'),'raw':!![]}]})[_0xf767('0x1d')](function(_0x201206){if(_0x201206&&_0x201206['Smtp']){var _0x3b0b8c={'tls':{'rejectUnauthorized':![]}};if(_[_0xf767('0x5d')](_0x201206[_0xf767('0x5c')][_0xf767('0x5e')])){_0x3b0b8c['host']=_0x201206['Smtp'][_0xf767('0x5f')];_0x3b0b8c[_0xf767('0x60')]=_0x201206['Smtp'][_0xf767('0x60')];_0x3b0b8c['secure']=_0x201206[_0xf767('0x5c')]['secure'];if(_0x201206[_0xf767('0x5c')][_0xf767('0x61')]){_0x3b0b8c[_0xf767('0x62')]={'user':_0x201206[_0xf767('0x5c')]['user'],'pass':_0x201206[_0xf767('0x5c')]['pass']};}}else{_0x3b0b8c[_0xf767('0x5e')]=_0x201206['Smtp'][_0xf767('0x5e')];_0x3b0b8c[_0xf767('0x62')]={'user':_0x201206[_0xf767('0x5c')]['user'],'pass':_0x201206[_0xf767('0x5c')][_0xf767('0x63')]};_0x3b0b8c[_0xf767('0x64')]=_0x201206['Smtp'][_0xf767('0x64')];}if(_0x106adf[_0xf767('0x52')][_0xf767('0x65')]&&_0x106adf[_0xf767('0x52')][_0xf767('0x65')][_0xf767('0x3e')]){for(var _0x2405b9=0x0;_0x2405b9<_0x106adf[_0xf767('0x52')][_0xf767('0x65')][_0xf767('0x3e')];_0x2405b9+=0x1){_0x106adf[_0xf767('0x52')]['attachments'][_0x2405b9]={'filename':_0x106adf[_0xf767('0x52')][_0xf767('0x65')][_0x2405b9][_0xf767('0x33')],'path':path['join'](config[_0xf767('0x66')],_0xf767('0x67'),_0x106adf[_0xf767('0x52')][_0xf767('0x65')][_0x2405b9][_0xf767('0x68')])};}}return{'account':_0x3b0b8c,'message':_0x106adf[_0xf767('0x52')]};}})[_0xf767('0x1d')](function(_0xb1b951){if(_0xb1b951){return respondWithRpcPromise(_0xf767('0x69'),_0xf767('0x6a'),_0xb1b951,client9003)[_0xf767('0x1d')](function(_0x1b5710){return _0x5eeed8[_0xf767('0x31')]({'read':!![],'messageId':_0x1b5710[_0xf767('0x6b')],'sentAt':moment()[_0xf767('0x6c')](_0xf767('0x6d'))});})[_0xf767('0x27')](function(_0x3c55a3){logger['error']('%s',JSON[_0xf767('0x23')](_0x3c55a3));return _0x5eeed8;});}return _0x5eeed8;});}return _0x5eeed8;}})['then'](respondWithResult(_0x865f42,0xc9))[_0xf767('0x27')](handleError(_0x865f42,null));};var interaction_log=require(_0xf767('0x11'))(_0xf767('0x6e'));exports['accept']=function(_0x3d70a0,_0x376189,_0x3716bb){var _0x3526fb={'channel':_0xf767('0x6f')};if(_0x3d70a0['body']['id']){delete _0x3d70a0[_0xf767('0x52')]['id'];}_0x3d70a0['body'][_0xf767('0x70')]=!![];_0x3d70a0[_0xf767('0x52')]['readAt']=moment()['format'](_0xf767('0x6d'));_0x3d70a0[_0xf767('0x52')][_0xf767('0x71')]=_0x3d70a0[_0xf767('0x52')][_0xf767('0x71')]||_0x3d70a0[_0xf767('0x72')]['id'];return db[_0xf767('0x48')][_0xf767('0x51')]({'where':{'id':_0x3d70a0[_0xf767('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0xf767('0x73')],'as':_0xf767('0x74')}]})['then'](handleEntityNotFound(_0x376189,null))[_0xf767('0x1d')](saveUpdates(_0x3d70a0[_0xf767('0x52')],null))['then'](function(_0xe855a4){if(_0xe855a4){_0x3526fb[_0xf767('0x26')]=_0xe855a4['get']({'plain':!![]});return db[_0xf767('0x75')][_0xf767('0x51')]({'where':{'id':_0xe855a4[_0xf767('0x76')]}});}return null;})[_0xf767('0x1d')](handleEntityNotFound(_0x376189,null))['then'](function(_0x523c48){if(_0x523c48){return _0x523c48[_0xf767('0x31')]({'UserId':_0x3d70a0[_0xf767('0x52')][_0xf767('0x71')],'read1stAt':_[_0xf767('0x5d')](_0x523c48[_0xf767('0x77')])?moment()[_0xf767('0x6c')](_0xf767('0x6d')):undefined});}return null;})[_0xf767('0x1d')](function(_0x32c3d7){if(_0x32c3d7){_0x3526fb[_0xf767('0x78')]=_0x32c3d7[_0xf767('0x79')]({'plain':!![]});interaction_log[_0xf767('0x1e')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d70a0['user']['id'],_0x3d70a0[_0xf767('0x72')][_0xf767('0x33')],_0x3d70a0['user'][_0xf767('0x7a')],_0x3526fb[_0xf767('0x78')]['id'],_0x3d70a0['body']?JSON['stringify'](_0x3d70a0[_0xf767('0x52')]):'null');return respondWithRpcPromise(_0xf767('0x7b'),_0xf767('0x7c'),_0x3526fb);}return null;})[_0xf767('0x1d')](function(_0x5e6609){if(_0x5e6609){if(_0x3d70a0[_0xf767('0x52')][_0xf767('0x7d')]){_0x3526fb['message'][_0xf767('0x7e')]=util[_0xf767('0x6c')](_0xf767('0x7f'),_0x3d70a0['user'][_0xf767('0x33')]);_0x3526fb[_0xf767('0x26')][_0xf767('0x80')]=_0x3526fb[_0xf767('0x80')];_0x3526fb['message'][_0xf767('0x81')]=_0xf767('0x82');return respondWithRpcPromise('EventManager',_0xf767('0x83'),{'event':_0xf767('0x84'),'message':_0x3526fb['message']},client9002)[_0xf767('0x1d')](function(){return _0x3526fb;});}return _0x3526fb;}return null;})[_0xf767('0x1d')](respondWithResult(_0x376189,null))['catch'](handleError(_0x376189,null));};var interaction_log=require(_0xf767('0x11'))(_0xf767('0x6e'));exports[_0xf767('0x85')]=function(_0x339544,_0x311691,_0x110d76){var _0x381f43={'agent':{},'channel':'mail'};if(_0x339544['body']['id']){delete _0x339544[_0xf767('0x52')]['id'];}_0x339544['body'][_0xf767('0x71')]=_0x339544['body'][_0xf767('0x71')]||_0x339544[_0xf767('0x72')]['id'];_0x381f43[_0xf767('0x86')]['id']=_0x339544[_0xf767('0x52')][_0xf767('0x71')];return db[_0xf767('0x48')][_0xf767('0x51')]({'where':{'id':_0x339544[_0xf767('0x4f')]['id'],'UserId':null}})[_0xf767('0x1d')](handleEntityNotFound(_0x311691,null))[_0xf767('0x1d')](function(_0xdc48c1){if(_0xdc48c1){_0x381f43[_0xf767('0x26')]=_0xdc48c1['get']({'plain':!![]});return db[_0xf767('0x75')][_0xf767('0x51')]({'where':{'id':_0xdc48c1['MailInteractionId']}});}return null;})[_0xf767('0x1d')](handleEntityNotFound(_0x311691,null))[_0xf767('0x1d')](function(_0x1669d0){if(_0x1669d0){_0x381f43['interaction']=_0x1669d0[_0xf767('0x79')]({'plain':!![]});interaction_log[_0xf767('0x1e')](_0xf767('0x87'),_0x339544[_0xf767('0x72')]['id'],_0x339544['user'][_0xf767('0x33')],_0x339544[_0xf767('0x72')]['role'],_0x381f43['interaction']['id'],_0x339544[_0xf767('0x52')]?JSON[_0xf767('0x23')](_0x339544['body']):_0xf767('0x88'));return respondWithRpcPromise(_0xf767('0x89'),_0xf767('0x8a'),_0x381f43);}return null;})[_0xf767('0x1d')](function(_0x177d1d){if(_0x177d1d){_0x177d1d[_0xf767('0x26')][_0xf767('0x7e')]=util[_0xf767('0x6c')](_0xf767('0x7f'),_0x339544[_0xf767('0x72')][_0xf767('0x33')]);_0x177d1d[_0xf767('0x26')]['channel']=_0x381f43[_0xf767('0x80')];_0x177d1d[_0xf767('0x26')]['event']=_0xf767('0x85');respondWithRpcPromise('EventManager',_0xf767('0x83'),{'event':'rejectmessage','message':_0x177d1d[_0xf767('0x26')]},client9002);return _0x381f43;}return null;})[_0xf767('0x1d')](respondWithResult(_0x311691,null))[_0xf767('0x27')](handleError(_0x311691,null));};exports[_0xf767('0x8b')]=function(_0x1cf5dd,_0x10f4ac){var _0x26a3dd=moment()[_0xf767('0x8c')]()['toString']();var _0x13da40=path[_0xf767('0x8d')](config[_0xf767('0x66')],'server',_0xf767('0x8e'),_0xf767('0x8f'));var _0x1137dd=path['join'](config[_0xf767('0x66')],'server','files',_0xf767('0x65'));var _0x741266=util[_0xf767('0x6c')](_0xf767('0x90'),_0x26a3dd);return db[_0xf767('0x48')][_0xf767('0x51')]({'where':{'id':_0x1cf5dd[_0xf767('0x4f')]['id']},'attributes':['id',_0xf767('0x52'),_0xf767('0x91'),'to','cc','bcc',_0xf767('0x92'),_0xf767('0x93')],'include':_0x1cf5dd[_0xf767('0x39')]['attachments']?[{'model':db[_0xf767('0x94')],'as':_0xf767('0x95')}]:undefined})[_0xf767('0x1d')](handleEntityNotFound(_0x10f4ac,null))[_0xf767('0x1d')](function(_0x15f86c){if(_0x15f86c){var _0x8864a6=_0x15f86c;var _0x2c681a={'from':_0x8864a6[_0xf767('0x91')],'to':_0x8864a6['to'],'subject':_0x8864a6[_0xf767('0x92')],'html':_0x8864a6[_0xf767('0x52')],'headers':{'Date':moment(_0x8864a6[_0xf767('0x93')])[_0xf767('0x6c')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x15f86c['cc']){_0x2c681a[_0xf767('0x96')]['Cc']=_0x15f86c['cc'];}if(_0x15f86c[_0xf767('0x97')]){_0x2c681a['headers'][_0xf767('0x98')]=_0x15f86c['bcc'];}return new BPromise(function(_0x232f14,_0x2f3389){if(_0x15f86c['Attachments']){for(var _0x4de200=0x0;_0x4de200<_0x15f86c['Attachments']['length'];_0x4de200++){var _0x2ebe30=_0x15f86c[_0xf767('0x95')][_0x4de200];var _0xf787ff=path[_0xf767('0x8d')](_0x1137dd,_0x2ebe30[_0xf767('0x68')]);if(fs[_0xf767('0x99')](_0xf787ff)){_0x2c681a[_0xf767('0x65')]['push']({'name':_0x2ebe30['name'],'contentType':_0x2ebe30[_0xf767('0x45')],'data':fs[_0xf767('0x9a')](_0xf787ff)});}}}emlformat['build'](_0x2c681a,function(_0x38c6c8,_0x5ed3a9){if(_0x38c6c8)return _0x2f3389(_0x38c6c8);fs[_0xf767('0x9b')](path[_0xf767('0x8d')](_0x13da40,_0x741266),_0x5ed3a9);return _0x232f14(_0x5ed3a9);});});}})[_0xf767('0x1d')](function(_0x1a08af){if(_0x1a08af){return _0x10f4ac[_0xf767('0x8b')](path[_0xf767('0x8d')](_0x13da40,_0x741266),_0x741266,function(_0x5d803f){if(_0x5d803f){console[_0xf767('0x9c')](_0xf767('0x9d'),_0x5d803f);}else{fs[_0xf767('0x9e')](path[_0xf767('0x8d')](_0x13da40,_0x741266));}});}})[_0xf767('0x27')](handleError(_0x10f4ac,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c3a5919..bedccef 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 _0x77b6=['MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0x77b6,0x15e));var _0x677b=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x77b6[_0x4154a6];return _0x3b2786;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x677b('0x0'))['db'][_0x677b('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x677b('0x2')](0x0);var events={'afterCreate':_0x677b('0x3'),'afterUpdate':_0x677b('0x4'),'afterDestroy':_0x677b('0x5')};function emitEvent(_0x3a99a5){return function(_0x138b24,_0x3f68c3,_0xc88ed3){MailMessageEvents[_0x677b('0x6')](_0x3a99a5+':'+_0x138b24['id'],_0x138b24);MailMessageEvents[_0x677b('0x6')](_0x3a99a5,_0x138b24);_0xc88ed3(null);};}for(var e in events){if(events[_0x677b('0x7')](e)){var event=events[e];MailMessage[_0x677b('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xfca0=['exports','events','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfca0,0x196));var _0x0fca=function(_0xa32746,_0x19c503){_0xa32746=_0xa32746-0x0;var _0x495f73=_0xfca0[_0xa32746];return _0x495f73;};'use strict';var EventEmitter=require(_0x0fca('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x0fca('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0fca('0x2')](0x0);var events={'afterCreate':_0x0fca('0x3'),'afterUpdate':'update','afterDestroy':_0x0fca('0x4')};function emitEvent(_0x94c0c4){return function(_0x527176,_0x446d59,_0x50a64f){MailMessageEvents[_0x0fca('0x5')](_0x94c0c4+':'+_0x527176['id'],_0x527176);MailMessageEvents[_0x0fca('0x5')](_0x94c0c4,_0x527176);_0x50a64f(null);};}for(var e in events){if(events[_0x0fca('0x6')](e)){var event=events[e];MailMessage[_0x0fca('0x7')](e,emitEvent(event));}}module[_0x0fca('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 0d3600f..eb2050c 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 _0x1da0=['MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','../../config/logger','api','moment','bluebird','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','isNil','UserId'];(function(_0xca327b,_0x387ec8){var _0x2bc38d=function(_0x1ba45f){while(--_0x1ba45f){_0xca327b['push'](_0xca327b['shift']());}};_0x2bc38d(++_0x387ec8);}(_0x1da0,0x1d8));var _0x01da=function(_0x4c2bdc,_0x5915d7){_0x4c2bdc=_0x4c2bdc-0x0;var _0x5a3222=_0x1da0[_0x4c2bdc];return _0x5a3222;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x01da('0x0'))(_0x01da('0x1'));var moment=require(_0x01da('0x2'));var BPromise=require(_0x01da('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x01da('0x4'));var config=require('../../config/environment');var attributes=require(_0x01da('0x5'));module['exports']=function(_0xd952c6,_0x182be1){return _0xd952c6[_0x01da('0x6')](_0x01da('0x7'),attributes,{'tableName':_0x01da('0x8'),'paranoid':![],'indexes':[{'name':_0x01da('0x9'),'fields':[_0x01da('0x9')]},{'name':'fti_mail_messages','fields':[_0x01da('0xa'),_0x01da('0xb')],'type':_0x01da('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x547fd5,_0x3aa7cc,_0x1938fe){if(_0x547fd5[_0x01da('0xd')]){_0x547fd5[_0x01da('0xa')]=htmlToText['fromString'](_0x547fd5[_0x01da('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1938fe(null,_0x3aa7cc);},'afterCreate':function(_0x34e598,_0x3fa961,_0x1683ec){var _0x1ead21=_0xd952c6[_0x01da('0xe')];var _0xb51d45=_0x34e598[_0x01da('0xf')]({'plain':!![]});if(_0xb51d45[_0x01da('0x10')][_0x01da('0x11')]()==='in'||_0xb51d45[_0x01da('0x10')][_0x01da('0x11')]()===_0x01da('0x12')&&!_0xb51d45['secret']&&!_[_0x01da('0x13')](_0xb51d45[_0x01da('0x14')])){_0x1ead21[_0x01da('0x15')][_0x01da('0x16')]({'where':{'id':_0xb51d45[_0x01da('0x17')]}})[_0x01da('0x18')](function(_0x556fcf){if(_0x556fcf){_0x556fcf['update']({'lastMsgAt':_0xb51d45[_0x01da('0x19')],'lastMsgDirection':_0xb51d45[_0x01da('0x10')]['toLowerCase'](),'lastMsgBody':_0xb51d45[_0x01da('0xd')]});}})[_0x01da('0x1a')](function(_0x18c39d){console[_0x01da('0x1b')](_0x18c39d);});}_0x1683ec();}},'charset':_0x01da('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e0a=['path','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x211f66,_0x6d409f){var _0x324240=function(_0x5b0c0e){while(--_0x5b0c0e){_0x211f66['push'](_0x211f66['shift']());}};_0x324240(++_0x6d409f);}(_0x3e0a,0x158));var _0xa3e0=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x3e0a[_0x2a7b50];return _0x4224c9;};'use strict';var _=require(_0xa3e0('0x0'));var util=require(_0xa3e0('0x1'));var logger=require(_0xa3e0('0x2'))(_0xa3e0('0x3'));var moment=require(_0xa3e0('0x4'));var BPromise=require(_0xa3e0('0x5'));var rp=require(_0xa3e0('0x6'));var htmlToText=require(_0xa3e0('0x7'));var fs=require('fs');var path=require(_0xa3e0('0x8'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3e0('0x9'));module['exports']=function(_0x5e00b3,_0xcdab74){return _0x5e00b3[_0xa3e0('0xa')]('MailMessage',attributes,{'tableName':_0xa3e0('0xb'),'paranoid':![],'indexes':[{'name':_0xa3e0('0xc'),'fields':[_0xa3e0('0xc')]},{'name':_0xa3e0('0xd'),'fields':[_0xa3e0('0xe'),_0xa3e0('0xf')],'type':_0xa3e0('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a0eda,_0x1aee91,_0xa17c07){if(_0x4a0eda[_0xa3e0('0x11')]){_0x4a0eda[_0xa3e0('0xe')]=htmlToText[_0xa3e0('0x12')](_0x4a0eda[_0xa3e0('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xa17c07(null,_0x1aee91);},'afterCreate':function(_0x2bac67,_0x59e829,_0x1f7ccd){var _0x21430a=_0x5e00b3[_0xa3e0('0x13')];var _0x451caa=_0x2bac67['get']({'plain':!![]});if(_0x451caa[_0xa3e0('0x14')][_0xa3e0('0x15')]()==='in'||_0x451caa['direction']['toLowerCase']()===_0xa3e0('0x16')&&!_0x451caa[_0xa3e0('0x17')]&&!_[_0xa3e0('0x18')](_0x451caa[_0xa3e0('0x19')])){_0x21430a['MailInteraction'][_0xa3e0('0x1a')]({'where':{'id':_0x451caa[_0xa3e0('0x1b')]}})['then'](function(_0x1a5a2a){if(_0x1a5a2a){_0x1a5a2a[_0xa3e0('0x1c')]({'lastMsgAt':_0x451caa[_0xa3e0('0x1d')],'lastMsgDirection':_0x451caa[_0xa3e0('0x14')][_0xa3e0('0x15')](),'lastMsgBody':_0x451caa[_0xa3e0('0x11')]});}})['catch'](function(_0x3a487d){console[_0xa3e0('0x1e')](_0x3a487d);});}_0x1f7ccd();}},'charset':_0xa3e0('0x1f'),'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 09a32e7..03ef684 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 _0x78d3=['message','info','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s'];(function(_0x4766f2,_0x38b8a1){var _0xe746c2=function(_0x27ad6d){while(--_0x27ad6d){_0x4766f2['push'](_0x4766f2['shift']());}};_0xe746c2(++_0x38b8a1);}(_0x78d3,0x73));var _0x378d=function(_0x11da19,_0x515102){_0x11da19=_0x11da19-0x0;var _0x28e414=_0x78d3[_0x11da19];return _0x28e414;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x378d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x378d('0xf'))(new Redis(config[_0x378d('0xe')]));require(_0x378d('0x10'))[_0x378d('0x11')](socket);function respondWithRpcPromise(_0x43da5f,_0x12d960,_0x53a4b6){return new BPromise(function(_0x1c4d11,_0x21bf21){return client[_0x378d('0x12')](_0x43da5f,_0x53a4b6)['then'](function(_0x378254){logger['info']('MailMessage,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'));logger[_0x378d('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'),JSON[_0x378d('0x15')](_0x378254));if(_0x378254[_0x378d('0x16')]){if(_0x378254['error'][_0x378d('0x17')]===0x1f4){logger['error'](_0x378d('0x18'),_0x12d960,_0x378254[_0x378d('0x16')][_0x378d('0x19')]);return _0x21bf21(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}logger['error'](_0x378d('0x18'),_0x12d960,_0x378254['error'][_0x378d('0x19')]);return _0x1c4d11(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}else{logger[_0x378d('0x1a')](_0x378d('0x18'),_0x12d960,'request\x20sent');_0x1c4d11(_0x378254[_0x378d('0x1b')]['message']);}})[_0x378d('0x1c')](function(_0x4067d9){logger[_0x378d('0x16')](_0x378d('0x18'),_0x12d960,_0x4067d9);_0x21bf21(_0x4067d9);});});}exports[_0x378d('0x1d')]=function(_0x11584b){var _0x1c9244=this;return new Promise(function(_0x521d40,_0x5a936c){return db[_0x378d('0x1e')][_0x378d('0x1f')](_0x11584b['body'],{'raw':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x21')]===undefined?!![]:![]:!![]})[_0x378d('0x22')](function(_0x3acdf9){logger['info'](_0x378d('0x1d'),_0x11584b);logger['debug'](_0x378d('0x1d'),_0x11584b,JSON[_0x378d('0x15')](_0x3acdf9));_0x521d40(_0x3acdf9);})[_0x378d('0x1c')](function(_0x57e2b2){logger[_0x378d('0x16')](_0x378d('0x1d'),_0x57e2b2[_0x378d('0x19')],_0x11584b);_0x5a936c(_0x1c9244['error'](0x1f4,_0x57e2b2[_0x378d('0x19')]));});});}; \ No newline at end of file +var _0x8c32=['info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then'];(function(_0x43d7bb,_0x806556){var _0x4bc149=function(_0x5a2a29){while(--_0x5a2a29){_0x43d7bb['push'](_0x43d7bb['shift']());}};_0x4bc149(++_0x806556);}(_0x8c32,0x130));var _0x28c3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8c32[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var moment=require(_0x28c3('0x2'));var BPromise=require(_0x28c3('0x3'));var rs=require(_0x28c3('0x4'));var fs=require('fs');var Redis=require(_0x28c3('0x5'));var db=require(_0x28c3('0x6'))['db'];var utils=require(_0x28c3('0x7'));var logger=require(_0x28c3('0x8'))(_0x28c3('0x9'));var config=require(_0x28c3('0xa'));var jayson=require(_0x28c3('0xb'));var client=jayson['client'][_0x28c3('0xc')]({'port':0x232a});config[_0x28c3('0xd')]=_[_0x28c3('0xe')](config[_0x28c3('0xd')],{'host':_0x28c3('0xf'),'port':0x18eb});var socket=require(_0x28c3('0x10'))(new Redis(config['redis']));require(_0x28c3('0x11'))[_0x28c3('0x12')](socket);function respondWithRpcPromise(_0x52d697,_0x509390,_0x485030){return new BPromise(function(_0x472d58,_0x4624f2){return client['request'](_0x52d697,_0x485030)[_0x28c3('0x13')](function(_0x15c306){logger[_0x28c3('0x14')]('MailMessage,\x20%s,\x20%s',_0x509390,_0x28c3('0x15'));logger[_0x28c3('0x16')](_0x28c3('0x17'),_0x509390,_0x28c3('0x15'),JSON[_0x28c3('0x18')](_0x15c306));if(_0x15c306['error']){if(_0x15c306[_0x28c3('0x19')]['code']===0x1f4){logger[_0x28c3('0x19')]('MailMessage,\x20%s,\x20%s',_0x509390,_0x15c306[_0x28c3('0x19')]['message']);return _0x4624f2(_0x15c306[_0x28c3('0x19')][_0x28c3('0x1a')]);}logger['error'](_0x28c3('0x1b'),_0x509390,_0x15c306['error']['message']);return _0x472d58(_0x15c306['error'][_0x28c3('0x1a')]);}else{logger[_0x28c3('0x14')](_0x28c3('0x1b'),_0x509390,'request\x20sent');_0x472d58(_0x15c306[_0x28c3('0x1c')][_0x28c3('0x1a')]);}})[_0x28c3('0x1d')](function(_0x39256d){logger[_0x28c3('0x19')](_0x28c3('0x1b'),_0x509390,_0x39256d);_0x4624f2(_0x39256d);});});}exports[_0x28c3('0x1e')]=function(_0x177189){var _0x3efe77=this;return new Promise(function(_0x1ec227,_0x1c3489){return db[_0x28c3('0x1f')][_0x28c3('0x20')](_0x177189[_0x28c3('0x21')],{'raw':_0x177189[_0x28c3('0x22')]?_0x177189[_0x28c3('0x22')][_0x28c3('0x23')]===undefined?!![]:![]:!![]})[_0x28c3('0x13')](function(_0x864cc0){logger[_0x28c3('0x14')](_0x28c3('0x1e'),_0x177189);logger[_0x28c3('0x16')](_0x28c3('0x1e'),_0x177189,JSON[_0x28c3('0x18')](_0x864cc0));_0x1ec227(_0x864cc0);})['catch'](function(_0x312f25){logger[_0x28c3('0x19')](_0x28c3('0x1e'),_0x312f25[_0x28c3('0x1a')],_0x177189);_0x1c3489(_0x3efe77[_0x28c3('0x19')](0x1f4,_0x312f25['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 447d1ae..ee048e9 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 _0xee89=['update','removeListener','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xee89,0x131));var _0x9ee8=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xee89[_0x28947d];return _0x12d2ee;};'use strict';var MailMessageEvents=require(_0x9ee8('0x0'));var events=[_0x9ee8('0x1'),_0x9ee8('0x2'),_0x9ee8('0x3')];function createListener(_0x42eed4,_0x2f2afd){return function(_0x5a1870){_0x2f2afd['emit'](_0x42eed4,_0x5a1870);};}function removeListener(_0x344811,_0x3c5a8e){return function(){MailMessageEvents[_0x9ee8('0x4')](_0x344811,_0x3c5a8e);};}exports['register']=function(_0x5292e5){for(var _0x4bb705=0x0,_0x32f5b9=events[_0x9ee8('0x5')];_0x4bb705<_0x32f5b9;_0x4bb705++){var _0x2ab776=events[_0x4bb705];var _0x382452=createListener(_0x9ee8('0x6')+_0x2ab776,_0x5292e5);MailMessageEvents['on'](_0x2ab776,_0x382452);}}; \ No newline at end of file +var _0xb018=['register','length','mailMessage:','./mailMessage.events','save','update','emit','removeListener'];(function(_0x5776ef,_0x294402){var _0x356aab=function(_0x384ed4){while(--_0x384ed4){_0x5776ef['push'](_0x5776ef['shift']());}};_0x356aab(++_0x294402);}(_0xb018,0x6b));var _0x8b01=function(_0x13307c,_0x5c20d8){_0x13307c=_0x13307c-0x0;var _0x5b507e=_0xb018[_0x13307c];return _0x5b507e;};'use strict';var MailMessageEvents=require(_0x8b01('0x0'));var events=[_0x8b01('0x1'),'remove',_0x8b01('0x2')];function createListener(_0x353070,_0x46e158){return function(_0x1bbce3){_0x46e158[_0x8b01('0x3')](_0x353070,_0x1bbce3);};}function removeListener(_0x44be4e,_0x34bffc){return function(){MailMessageEvents[_0x8b01('0x4')](_0x44be4e,_0x34bffc);};}exports[_0x8b01('0x5')]=function(_0x4a7206){for(var _0x5d63ef=0x0,_0x17f5fd=events[_0x8b01('0x6')];_0x5d63ef<_0x17f5fd;_0x5d63ef++){var _0x2913f1=events[_0x5d63ef];var _0x5a0bbb=createListener(_0x8b01('0x7')+_0x2913f1,_0x4a7206);MailMessageEvents['on'](_0x2913f1,_0x5a0bbb);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9948845..a46220e 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 _0x2d9c=['util','path','express','Router','../../config/environment','./mailQueue.controller','get','index','/describe','describe','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x28b572,_0x29082d){var _0x5bfb55=function(_0x592ed4){while(--_0x592ed4){_0x28b572['push'](_0x28b572['shift']());}};_0x5bfb55(++_0x29082d);}(_0x2d9c,0x178));var _0xc2d9=function(_0x192538,_0x46e3c1){_0x192538=_0x192538-0x0;var _0x9cb3ac=_0x2d9c[_0x192538];return _0x9cb3ac;};'use strict';var multer=require(_0xc2d9('0x0'));var util=require(_0xc2d9('0x1'));var path=require(_0xc2d9('0x2'));var timeout=require('connect-timeout');var express=require(_0xc2d9('0x3'));var router=express[_0xc2d9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc2d9('0x5'));var controller=require(_0xc2d9('0x6'));router[_0xc2d9('0x7')]('/',auth['isAuthenticated'](),controller[_0xc2d9('0x8')]);router['get'](_0xc2d9('0x9'),auth['isAuthenticated'](),controller[_0xc2d9('0xa')]);router[_0xc2d9('0x7')]('/:id',auth[_0xc2d9('0xb')](),controller[_0xc2d9('0xc')]);router[_0xc2d9('0x7')](_0xc2d9('0xd'),auth['isAuthenticated'](),controller[_0xc2d9('0xe')]);router[_0xc2d9('0x7')]('/:id/teams',auth[_0xc2d9('0xb')](),controller[_0xc2d9('0xf')]);router[_0xc2d9('0x7')](_0xc2d9('0x10'),auth[_0xc2d9('0xb')](),controller[_0xc2d9('0x11')]);router['post']('/',auth[_0xc2d9('0xb')](),controller[_0xc2d9('0x12')]);router[_0xc2d9('0x13')](_0xc2d9('0x14'),auth[_0xc2d9('0xb')](),controller['addTeams']);router[_0xc2d9('0x13')]('/:id/users',auth[_0xc2d9('0xb')](),controller[_0xc2d9('0x15')]);router['put'](_0xc2d9('0x16'),auth[_0xc2d9('0xb')](),controller[_0xc2d9('0x17')]);router[_0xc2d9('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xc2d9('0x19')]);router[_0xc2d9('0x18')](_0xc2d9('0x14'),auth['isAuthenticated'](),controller[_0xc2d9('0x1a')]);router[_0xc2d9('0x18')](_0xc2d9('0x10'),auth[_0xc2d9('0xb')](),controller[_0xc2d9('0x1b')]);module[_0xc2d9('0x1c')]=router; \ No newline at end of file +var _0xfa2b=['isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x55c066,_0x580eca){var _0x453857=function(_0x57478d){while(--_0x57478d){_0x55c066['push'](_0x55c066['shift']());}};_0x453857(++_0x580eca);}(_0xfa2b,0xd5));var _0xbfa2=function(_0x5c1b94,_0x201940){_0x5c1b94=_0x5c1b94-0x0;var _0x196459=_0xfa2b[_0x5c1b94];return _0x196459;};'use strict';var multer=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var path=require(_0xbfa2('0x2'));var timeout=require(_0xbfa2('0x3'));var express=require(_0xbfa2('0x4'));var router=express[_0xbfa2('0x5')]();var auth=require(_0xbfa2('0x6'));var interaction=require(_0xbfa2('0x7'));var config=require(_0xbfa2('0x8'));var controller=require(_0xbfa2('0x9'));router[_0xbfa2('0xa')]('/',auth[_0xbfa2('0xb')](),controller['index']);router[_0xbfa2('0xa')](_0xbfa2('0xc'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0xd')]);router[_0xbfa2('0xa')](_0xbfa2('0xe'),auth['isAuthenticated'](),controller[_0xbfa2('0xf')]);router[_0xbfa2('0xa')](_0xbfa2('0x10'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x11')]);router[_0xbfa2('0xa')](_0xbfa2('0x12'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x13')]);router[_0xbfa2('0xa')](_0xbfa2('0x14'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x15')]);router[_0xbfa2('0x16')]('/',auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x17')]);router[_0xbfa2('0x16')](_0xbfa2('0x12'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x18')]);router[_0xbfa2('0x16')](_0xbfa2('0x14'),auth[_0xbfa2('0xb')](),controller['addAgents']);router[_0xbfa2('0x19')]('/:id',auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbfa2('0x1b')]);router[_0xbfa2('0x1c')]('/:id/teams',auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x1d')]);router[_0xbfa2('0x1c')](_0xbfa2('0x14'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x1e')]);module[_0xbfa2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0f6e15e..c255d48 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 _0x96ca=['sequelize','name','STRING','ENUM','rrmemory','beepall'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x96ca,0x1da));var _0xa96c=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0x96ca[_0x4d6ac0];return _0x5296c4;};'use strict';var Sequelize=require(_0xa96c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa96c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa96c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa96c('0x3')](_0xa96c('0x4'),_0xa96c('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x1437=['ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x56588f,_0x539c4a){var _0x300c82=function(_0x486d5e){while(--_0x486d5e){_0x56588f['push'](_0x56588f['shift']());}};_0x300c82(++_0x539c4a);}(_0x1437,0xbd));var _0x7143=function(_0x50307e,_0x36ac46){_0x50307e=_0x50307e-0x0;var _0x3e41fc=_0x1437[_0x50307e];return _0x3e41fc;};'use strict';var Sequelize=require(_0x7143('0x0'));module[_0x7143('0x1')]={'name':{'type':Sequelize[_0x7143('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7143('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7143('0x3')](_0x7143('0x4'),_0x7143('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 11d0fdf..9a9af6a 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 _0x7ac4=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','MailQueue','query','keys','filters','intersection','model','attributes','length','order','sort','pick','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','hasOwnProperty','addTeams','teams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','fast-json-patch'];(function(_0x43b7e2,_0x205983){var _0x4004c9=function(_0x5c6233){while(--_0x5c6233){_0x43b7e2['push'](_0x43b7e2['shift']());}};_0x4004c9(++_0x205983);}(_0x7ac4,0x8d));var _0x47ac=function(_0x1fe5ee,_0x292522){_0x1fe5ee=_0x1fe5ee-0x0;var _0x3585b2=_0x7ac4[_0x1fe5ee];return _0x3585b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x47ac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x47ac('0x1'));var rp=require(_0x47ac('0x2'));var moment=require(_0x47ac('0x3'));var BPromise=require(_0x47ac('0x4'));var Mustache=require('mustache');var util=require(_0x47ac('0x5'));var path=require(_0x47ac('0x6'));var sox=require(_0x47ac('0x7'));var csv=require(_0x47ac('0x8'));var ejs=require(_0x47ac('0x9'));var fs=require('fs');var _=require(_0x47ac('0xa'));var squel=require(_0x47ac('0xb'));var crypto=require(_0x47ac('0xc'));var jsforce=require(_0x47ac('0xd'));var deskjs=require(_0x47ac('0xe'));var toCsv=require(_0x47ac('0x8'));var querystring=require(_0x47ac('0xf'));var Papa=require(_0x47ac('0x10'));var Redis=require('ioredis');var authService=require(_0x47ac('0x11'));var qs=require(_0x47ac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47ac('0x13'))(_0x47ac('0x14'));var utils=require(_0x47ac('0x15'));var config=require(_0x47ac('0x16'));var db=require(_0x47ac('0x17'))['db'];config['redis']=_[_0x47ac('0x18')](config[_0x47ac('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x47ac('0x1a'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x47ac('0x1b')](socket);function respondWithStatusCode(_0x52cf45,_0x490952){_0x490952=_0x490952||0xcc;return function(_0x57da2b){if(_0x57da2b){return _0x52cf45['sendStatus'](_0x490952);}return _0x52cf45[_0x47ac('0x1c')](_0x490952)[_0x47ac('0x1d')]();};}function respondWithResult(_0x2f7bad,_0x3b7764){_0x3b7764=_0x3b7764||0xc8;return function(_0x450d2e){if(_0x450d2e){return _0x2f7bad[_0x47ac('0x1c')](_0x3b7764)[_0x47ac('0x1e')](_0x450d2e);}};}function respondWithFilteredResult(_0x26a0f4,_0x5e9c40){return function(_0x5d888d){if(_0x5d888d){var _0x4e1920=_0x5d888d[_0x47ac('0x1f')],_0x1705a2=_0x5e9c40[_0x47ac('0x20')],_0x3259b5=_0x5e9c40[_0x47ac('0x20')]+_0x5e9c40[_0x47ac('0x21')],_0x5cb188;if(_0x3259b5>=_0x4e1920){_0x3259b5=_0x4e1920;_0x5cb188=0xc8;}else{_0x5cb188=0xce;}_0x26a0f4[_0x47ac('0x1c')](_0x5cb188);return _0x26a0f4[_0x47ac('0x22')](_0x47ac('0x23'),_0x1705a2+'-'+_0x3259b5+'/'+_0x4e1920)[_0x47ac('0x1e')](_0x5d888d);}return null;};}function patchUpdates(_0xaf910){return function(_0x737358){try{jsonpatch['apply'](_0x737358,_0xaf910,!![]);}catch(_0xc0a7e4){return BPromise[_0x47ac('0x24')](_0xc0a7e4);}return _0x737358[_0x47ac('0x25')]();};}function saveUpdates(_0x584eb3,_0x467115){return function(_0xcdb5f5){if(_0xcdb5f5){return _0xcdb5f5['update'](_0x584eb3)[_0x47ac('0x26')](function(_0x18a04f){return _0x18a04f;});}return null;};}function removeEntity(_0x5e1fda,_0x554fdd){return function(_0x4c5431){if(_0x4c5431){return _0x4c5431[_0x47ac('0x27')]()[_0x47ac('0x26')](function(){var _0x21daeb=_0x4c5431[_0x47ac('0x28')]({'plain':!![]});var _0x4bfe7c=_0x47ac('0x29');return db[_0x47ac('0x2a')]['destroy']({'where':{'type':_0x4bfe7c,'resourceId':_0x21daeb['id']}})[_0x47ac('0x26')](function(){return _0x4c5431;});})[_0x47ac('0x26')](function(){_0x5e1fda[_0x47ac('0x1c')](0xcc)[_0x47ac('0x1d')]();});}};}function handleEntityNotFound(_0x52218a,_0x48616d){return function(_0x3a3a47){if(!_0x3a3a47){_0x52218a[_0x47ac('0x2b')](0x194);}return _0x3a3a47;};}function handleError(_0x794431,_0x1dd7ed){_0x1dd7ed=_0x1dd7ed||0x1f4;return function(_0x589f4a){logger['error'](_0x589f4a[_0x47ac('0x2c')]);if(_0x589f4a[_0x47ac('0x2d')]){delete _0x589f4a['name'];}_0x794431[_0x47ac('0x1c')](_0x1dd7ed)[_0x47ac('0x2e')](_0x589f4a);};}exports[_0x47ac('0x2f')]=function(_0x34898b,_0x5783e8){var _0x523a3e={},_0x279b57={},_0x14ae7e={'count':0x0,'rows':[]};var _0x1c6682=db[_0x47ac('0x30')]['rawAttributes'];_0x279b57['model']=_['keys'](_0x1c6682);_0x279b57[_0x47ac('0x31')]=_[_0x47ac('0x32')](_0x34898b[_0x47ac('0x31')]);_0x279b57[_0x47ac('0x33')]=_[_0x47ac('0x34')](_0x279b57[_0x47ac('0x35')],_0x279b57[_0x47ac('0x31')]);_0x523a3e['attributes']=_['intersection'](_0x279b57[_0x47ac('0x35')],qs['fields'](_0x34898b[_0x47ac('0x31')]['fields']));_0x523a3e[_0x47ac('0x36')]=_0x523a3e[_0x47ac('0x36')][_0x47ac('0x37')]?_0x523a3e[_0x47ac('0x36')]:_0x279b57[_0x47ac('0x35')];if(!_0x34898b[_0x47ac('0x31')]['hasOwnProperty']('nolimit')){_0x523a3e['limit']=qs[_0x47ac('0x21')](_0x34898b[_0x47ac('0x31')][_0x47ac('0x21')]);_0x523a3e[_0x47ac('0x20')]=qs[_0x47ac('0x20')](_0x34898b[_0x47ac('0x31')]['offset']);}_0x523a3e[_0x47ac('0x38')]=qs[_0x47ac('0x39')](_0x34898b[_0x47ac('0x31')]['sort']);_0x523a3e['where']=qs[_0x47ac('0x33')](_[_0x47ac('0x3a')](_0x34898b['query'],_0x279b57[_0x47ac('0x33')]));if(_0x34898b[_0x47ac('0x31')][_0x47ac('0x3b')]){_0x523a3e['where']=_[_0x47ac('0x3c')](_0x523a3e[_0x47ac('0x3d')],{'$or':_[_0x47ac('0x3e')](_0x1c6682,function(_0x157a62){if(_0x157a62[_0x47ac('0x3f')][_0x47ac('0x40')]!==_0x47ac('0x41')){var _0x3f9b73={};_0x3f9b73[_0x157a62['field']]={'$like':'%'+_0x34898b[_0x47ac('0x31')][_0x47ac('0x3b')]+'%'};return _0x3f9b73;}})});}_0x523a3e=_[_0x47ac('0x3c')]({},_0x523a3e,_0x34898b[_0x47ac('0x42')]);var _0x335679={'where':_0x523a3e[_0x47ac('0x3d')]};return db[_0x47ac('0x30')]['count'](_0x335679)[_0x47ac('0x26')](function(_0x29d96d){_0x14ae7e[_0x47ac('0x1f')]=_0x29d96d;if(_0x34898b['query'][_0x47ac('0x43')]){_0x523a3e[_0x47ac('0x44')]=[{'all':!![]}];}return db[_0x47ac('0x30')][_0x47ac('0x45')](_0x523a3e);})[_0x47ac('0x26')](function(_0x263296){_0x14ae7e[_0x47ac('0x46')]=_0x263296;return _0x14ae7e;})[_0x47ac('0x26')](respondWithFilteredResult(_0x5783e8,_0x523a3e))[_0x47ac('0x47')](handleError(_0x5783e8,null));};exports[_0x47ac('0x48')]=function(_0x14fb0b,_0x45d627){var _0x30eec3={'raw':!![],'where':{'id':_0x14fb0b[_0x47ac('0x49')]['id']}},_0x54bfef={};_0x54bfef[_0x47ac('0x35')]=_[_0x47ac('0x32')](db['MailQueue'][_0x47ac('0x4a')]);_0x54bfef[_0x47ac('0x31')]=_[_0x47ac('0x32')](_0x14fb0b[_0x47ac('0x31')]);_0x54bfef[_0x47ac('0x33')]=_['intersection'](_0x54bfef[_0x47ac('0x35')],_0x54bfef['query']);_0x30eec3[_0x47ac('0x36')]=_[_0x47ac('0x34')](_0x54bfef[_0x47ac('0x35')],qs[_0x47ac('0x4b')](_0x14fb0b[_0x47ac('0x31')]['fields']));_0x30eec3[_0x47ac('0x36')]=_0x30eec3[_0x47ac('0x36')]['length']?_0x30eec3[_0x47ac('0x36')]:_0x54bfef[_0x47ac('0x35')];if(_0x14fb0b[_0x47ac('0x31')][_0x47ac('0x43')]){_0x30eec3[_0x47ac('0x44')]=[{'all':!![]}];}_0x30eec3=_['merge']({},_0x30eec3,_0x14fb0b['options']);return db[_0x47ac('0x30')][_0x47ac('0x4c')](_0x30eec3)[_0x47ac('0x26')](handleEntityNotFound(_0x45d627,null))['then'](respondWithResult(_0x45d627,null))[_0x47ac('0x47')](handleError(_0x45d627,null));};exports['create']=function(_0x43a364,_0x3cbef5){return db['MailQueue']['create'](_0x43a364[_0x47ac('0x4d')],{})[_0x47ac('0x26')](function(_0x1fd4b7){var _0x4df8f7=_0x43a364[_0x47ac('0x4e')][_0x47ac('0x28')]({'plain':!![]});if(!_0x4df8f7)throw new Error(_0x47ac('0x4f'));if(_0x4df8f7['role']==='user'){var _0x2d3a11=_0x1fd4b7[_0x47ac('0x28')]({'plain':!![]});var _0x33f397=_0x47ac('0x29');return db[_0x47ac('0x50')][_0x47ac('0x4c')]({'where':{'name':_0x33f397,'userProfileId':_0x4df8f7['userProfileId']},'raw':!![]})['then'](function(_0x2217f1){if(_0x2217f1&&_0x2217f1[_0x47ac('0x51')]===0x0){return db[_0x47ac('0x2a')]['create']({'name':_0x2d3a11['name'],'resourceId':_0x2d3a11['id'],'type':_0x2217f1[_0x47ac('0x2d')],'sectionId':_0x2217f1['id']},{})[_0x47ac('0x26')](function(){return _0x1fd4b7;});}else{return _0x1fd4b7;}})[_0x47ac('0x47')](function(_0x48d316){logger[_0x47ac('0x52')](_0x47ac('0x53'),_0x48d316);throw _0x48d316;});}return _0x1fd4b7;})['then'](respondWithResult(_0x3cbef5,0xc9))[_0x47ac('0x47')](handleError(_0x3cbef5,null));};exports[_0x47ac('0x54')]=function(_0x19da87,_0x497b2d){if(_0x19da87[_0x47ac('0x4d')]['id']){delete _0x19da87[_0x47ac('0x4d')]['id'];}return db[_0x47ac('0x30')][_0x47ac('0x4c')]({'where':{'id':_0x19da87[_0x47ac('0x49')]['id']}})['then'](handleEntityNotFound(_0x497b2d,null))['then'](saveUpdates(_0x19da87['body'],null))['then'](respondWithResult(_0x497b2d,null))[_0x47ac('0x47')](handleError(_0x497b2d,null));};exports[_0x47ac('0x27')]=function(_0x1ca00c,_0x1ea4e8){return db[_0x47ac('0x30')][_0x47ac('0x4c')]({'where':{'id':_0x1ca00c[_0x47ac('0x49')]['id']}})[_0x47ac('0x26')](handleEntityNotFound(_0x1ea4e8,null))['then'](removeEntity(_0x1ea4e8,null))[_0x47ac('0x47')](handleError(_0x1ea4e8,null));};exports['describe']=function(_0xa8d064,_0x3c702f){return db[_0x47ac('0x30')][_0x47ac('0x55')]()[_0x47ac('0x26')](respondWithResult(_0x3c702f,null))[_0x47ac('0x47')](handleError(_0x3c702f,null));};exports[_0x47ac('0x56')]=function(_0xba2332,_0x44a351,_0x39cfd3){var _0x5f3b9c={'raw':!![],'where':{}},_0x50c026={},_0x527791;return db['MailQueue'][_0x47ac('0x57')]({'where':{'id':_0xba2332[_0x47ac('0x49')]['id']}})['then'](handleEntityNotFound(_0x44a351,null))[_0x47ac('0x26')](function(_0x18cd5d){if(_0x18cd5d){_0x527791=_0x18cd5d['get']({'plain':!![]});_0x50c026[_0x47ac('0x35')]=_[_0x47ac('0x32')](db[_0x47ac('0x58')][_0x47ac('0x4a')]);_0x50c026['query']=_[_0x47ac('0x32')](_0xba2332['query']);_0x50c026['filters']=_[_0x47ac('0x34')](_0x50c026[_0x47ac('0x35')],_0x50c026[_0x47ac('0x31')]);_0x5f3b9c[_0x47ac('0x36')]=_[_0x47ac('0x34')](_0x50c026[_0x47ac('0x35')],qs[_0x47ac('0x4b')](_0xba2332[_0x47ac('0x31')][_0x47ac('0x4b')]));_0x5f3b9c[_0x47ac('0x36')]=_0x5f3b9c[_0x47ac('0x36')][_0x47ac('0x37')]?_0x5f3b9c[_0x47ac('0x36')]:_0x50c026[_0x47ac('0x35')];if(!_0xba2332[_0x47ac('0x31')]['hasOwnProperty'](_0x47ac('0x59'))){_0x5f3b9c[_0x47ac('0x21')]=qs['limit'](_0xba2332['query']['limit']);_0x5f3b9c[_0x47ac('0x20')]=qs['offset'](_0xba2332[_0x47ac('0x31')][_0x47ac('0x20')]);}_0x5f3b9c[_0x47ac('0x38')]=qs[_0x47ac('0x39')](_0xba2332[_0x47ac('0x31')][_0x47ac('0x39')]);_0x5f3b9c[_0x47ac('0x3d')]=qs[_0x47ac('0x33')](_['pick'](_0xba2332[_0x47ac('0x31')],_0x50c026[_0x47ac('0x33')]));_0x5f3b9c[_0x47ac('0x3d')][_0x47ac('0x5a')]=_0x18cd5d['id'];if(_0xba2332[_0x47ac('0x31')][_0x47ac('0x3b')]){_0x5f3b9c[_0x47ac('0x3d')]=_['merge'](_0x5f3b9c[_0x47ac('0x3d')],{'$or':_[_0x47ac('0x3e')](_0x5f3b9c[_0x47ac('0x36')],function(_0x1617ec){var _0x39c45b={};_0x39c45b[_0x1617ec]={'$like':'%'+_0xba2332[_0x47ac('0x31')][_0x47ac('0x3b')]+'%'};return _0x39c45b;})});}_0x5f3b9c=_[_0x47ac('0x3c')]({},_0x5f3b9c,_0xba2332['options']);return db[_0x47ac('0x58')]['findAll'](_0x5f3b9c);}})[_0x47ac('0x26')](function(_0x57260b){if(_0x57260b){return db[_0x47ac('0x5b')][_0x47ac('0x5c')]({'where':{'id':_['map'](_0x57260b,_0x47ac('0x5d')),'role':_0x47ac('0x5e')},'attributes':['id','name',_0x47ac('0x5f'),_0x47ac('0x60'),_0x47ac('0x61')]});}})[_0x47ac('0x26')](function(_0x3f0324){if(_0x3f0324){return{'count':_0x3f0324[_0x47ac('0x1f')],'rows':_['map'](_0x3f0324[_0x47ac('0x46')],function(_0xaa848a){return{'membername':_0xaa848a[_0x47ac('0x2d')],'UserId':_0xaa848a['id'],'queue_name':_0x527791[_0x47ac('0x2d')],'MailQueueId':_0x527791['id'],'interface':util['format'](_0x47ac('0x62'),_0x47ac('0x63'),_0xaa848a['name']),'penalty':0x0,'paused':_0xaa848a[_0x47ac('0x5f')],'createdAt':_0xaa848a[_0x47ac('0x61')],'updatedAt':_0xaa848a[_0x47ac('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x47ac('0x26')](respondWithFilteredResult(_0x44a351,_0x5f3b9c))[_0x47ac('0x47')](handleError(_0x44a351,null));};exports['getTeams']=function(_0x11fa60,_0x10788b,_0x21580b){var _0x4a91f7={};var _0x5078b4={};var _0x2b0554;var _0x14dd4d;return db[_0x47ac('0x30')][_0x47ac('0x57')]({'where':{'id':_0x11fa60[_0x47ac('0x49')]['id']}})[_0x47ac('0x26')](handleEntityNotFound(_0x10788b,null))[_0x47ac('0x26')](function(_0x5c8458){if(_0x5c8458){_0x2b0554=_0x5c8458;_0x5078b4[_0x47ac('0x35')]=_['keys'](db[_0x47ac('0x64')][_0x47ac('0x4a')]);_0x5078b4[_0x47ac('0x31')]=_[_0x47ac('0x32')](_0x11fa60[_0x47ac('0x31')]);_0x5078b4[_0x47ac('0x33')]=_[_0x47ac('0x34')](_0x5078b4[_0x47ac('0x35')],_0x5078b4[_0x47ac('0x31')]);_0x4a91f7[_0x47ac('0x36')]=_[_0x47ac('0x34')](_0x5078b4[_0x47ac('0x35')],qs[_0x47ac('0x4b')](_0x11fa60[_0x47ac('0x31')][_0x47ac('0x4b')]));_0x4a91f7['attributes']=_0x4a91f7[_0x47ac('0x36')]['length']?_0x4a91f7[_0x47ac('0x36')]:_0x5078b4['model'];_0x4a91f7[_0x47ac('0x38')]=qs[_0x47ac('0x39')](_0x11fa60['query'][_0x47ac('0x39')]);_0x4a91f7[_0x47ac('0x3d')]=qs[_0x47ac('0x33')](_[_0x47ac('0x3a')](_0x11fa60[_0x47ac('0x31')],_0x5078b4[_0x47ac('0x33')]));if(_0x11fa60[_0x47ac('0x31')][_0x47ac('0x3b')]){_0x4a91f7[_0x47ac('0x3d')]=_[_0x47ac('0x3c')](_0x4a91f7[_0x47ac('0x3d')],{'$or':_[_0x47ac('0x3e')](_0x4a91f7[_0x47ac('0x36')],function(_0x368375){var _0x1611d7={};_0x1611d7[_0x368375]={'$like':'%'+_0x11fa60[_0x47ac('0x31')][_0x47ac('0x3b')]+'%'};return _0x1611d7;})});}_0x4a91f7=_[_0x47ac('0x3c')]({},_0x4a91f7,_0x11fa60[_0x47ac('0x42')]);return _0x2b0554[_0x47ac('0x65')](_0x4a91f7);}})[_0x47ac('0x26')](function(_0x474ead){if(_0x474ead){_0x14dd4d=_0x474ead[_0x47ac('0x37')];if(!_0x11fa60[_0x47ac('0x31')][_0x47ac('0x66')](_0x47ac('0x59'))){_0x4a91f7[_0x47ac('0x21')]=qs[_0x47ac('0x21')](_0x11fa60[_0x47ac('0x31')][_0x47ac('0x21')]);_0x4a91f7[_0x47ac('0x20')]=qs[_0x47ac('0x20')](_0x11fa60['query'][_0x47ac('0x20')]);}return _0x2b0554[_0x47ac('0x65')](_0x4a91f7);}})[_0x47ac('0x26')](function(_0x102208){if(_0x102208){return _0x102208?{'count':_0x14dd4d,'rows':_0x102208}:null;}})[_0x47ac('0x26')](respondWithResult(_0x10788b,null))['catch'](handleError(_0x10788b,null));};exports[_0x47ac('0x67')]=function(_0x31d3ac,_0x5d10bb,_0xa48812){var _0x532e52=_0x31d3ac[_0x47ac('0x4d')][_0x47ac('0x68')];return db[_0x47ac('0x64')][_0x47ac('0x45')]({'where':{'id':_[_0x47ac('0x3e')](_0x532e52,'id')},'attributes':['id'],'include':[{'model':db[_0x47ac('0x5b')],'as':_0x47ac('0x69'),'attributes':['id',_0x47ac('0x2d'),_0x47ac('0x6a'),_0x47ac('0x6b'),_0x47ac('0x6c')],'raw':!![]}]})['then'](function(_0x550989){if(_0x550989){var _0x4c659e=_['flatMap'](_0x550989,function(_0x43de18){var _0x2f4aa1=_0x43de18[_0x47ac('0x28')]({'plain':!![]});return _0x2f4aa1['Agents'];});return db[_0x47ac('0x30')]['find']({'where':{'id':_0x31d3ac[_0x47ac('0x49')]['id']}})['then'](function(_0x51afd2){return db[_0x47ac('0x6d')][_0x47ac('0x6e')](function(_0x608f01){return _0x51afd2[_0x47ac('0x67')](_[_0x47ac('0x3e')](_0x532e52,'id'),{'transaction':_0x608f01})[_0x47ac('0x26')](function(){return BPromise[_0x47ac('0x6f')](_0x4c659e,function(_0x599496){return db['UserMailQueue'][_0x47ac('0x70')]({'where':{'UserId':_0x599496['id'],'MailQueueId':_0x31d3ac['params']['id']},'transaction':_0x608f01});});})[_0x47ac('0x26')](function(){_0x4c659e[_0x47ac('0x71')](function(_0xdbeb1c){socket[_0x47ac('0x72')](_0x47ac('0x73'),{'UserId':_0xdbeb1c['id'],'MailQueueId':_0x51afd2['id']});});});});});}})[_0x47ac('0x26')](respondWithStatusCode(_0x5d10bb,null))[_0x47ac('0x47')](handleError(_0x5d10bb,null));};exports[_0x47ac('0x74')]=function(_0x477227,_0x31aaab,_0x32b12d){return db[_0x47ac('0x64')][_0x47ac('0x45')]({'where':{'id':_0x477227['query'][_0x47ac('0x75')]},'attributes':['id'],'include':[{'model':db[_0x47ac('0x5b')],'as':_0x47ac('0x69'),'attributes':['id'],'raw':!![]}]})[_0x47ac('0x26')](handleEntityNotFound(_0x31aaab,null))[_0x47ac('0x26')](function(_0x5c7e13){var _0x1810d8=_[_0x47ac('0x3e')](_0x5c7e13,'id');var _0x13ff0b=[];var _0x3ebf44=[];var _0x420262=squel[_0x47ac('0x76')]();_0x420262[_0x47ac('0x77')](_0x47ac('0x78'))[_0x47ac('0x79')](_0x47ac('0x7a'),'tq')[_0x47ac('0x7b')](_0x47ac('0x7c'),'ut',_0x47ac('0x7d'))[_0x47ac('0x3d')](_0x47ac('0x7e'),_0x477227['params']['id']);for(var _0x1a56f2=0x0;_0x1a56f2<_0x5c7e13[_0x47ac('0x37')];_0x1a56f2+=0x1){let _0x32f44b=_0x5c7e13[_0x1a56f2];for(var _0x28fda6=0x0;_0x28fda6<_0x32f44b[_0x47ac('0x69')]['length'];_0x28fda6+=0x1){let _0x1e155f=_0x32f44b[_0x47ac('0x69')][_0x28fda6];var _0x40e4da=_0x420262[_0x47ac('0x7f')]();_0x40e4da['where'](_0x47ac('0x80'),_0x1e155f['id']);_0x3ebf44[_0x47ac('0x81')](db[_0x47ac('0x6d')][_0x47ac('0x31')](_0x40e4da['toString'](),{'type':db[_0x47ac('0x6d')][_0x47ac('0x82')][_0x47ac('0x83')]})[_0x47ac('0x26')](function(_0x483946){if(_0x483946['length']===0x1){return _0x1e155f['id'];}else{var _0x2eca72=_[_0x47ac('0x84')](_[_0x47ac('0x3e')](_0x483946,'TeamId'),function(_0x113e09){return _[_0x47ac('0x85')](_0x1810d8,_0x113e09);});if(_0x2eca72){return _0x1e155f['id'];}}}));}}return BPromise[_0x47ac('0x86')](_0x3ebf44)[_0x47ac('0x26')](function(_0x20374a){_0x13ff0b=_(_0x13ff0b)['union'](_0x20374a)['compact']()[_0x47ac('0x87')]();return db[_0x47ac('0x30')][_0x47ac('0x4c')]({'where':{'id':_0x477227[_0x47ac('0x49')]['id']}})['then'](function(_0x3a593d){return db[_0x47ac('0x6d')][_0x47ac('0x6e')](function(_0x3fc93f){return _0x3a593d['removeTeams'](_0x477227[_0x47ac('0x31')]['ids'],{'transaction':_0x3fc93f})[_0x47ac('0x26')](function(){if(!_['isEmpty'](_0x13ff0b)){return _0x3a593d[_0x47ac('0x88')](_0x13ff0b,{'transaction':_0x3fc93f});}})['then'](function(){_0x13ff0b[_0x47ac('0x71')](function(_0x1f579a){socket[_0x47ac('0x72')](_0x47ac('0x89'),{'UserId':_0x1f579a,'MailQueueId':_0x3a593d['id']});});});});});});})[_0x47ac('0x26')](respondWithStatusCode(_0x31aaab,null))[_0x47ac('0x47')](handleError(_0x31aaab,null));};exports['addAgents']=function(_0x17e53c,_0x44e751,_0x55b2ce){return db[_0x47ac('0x30')][_0x47ac('0x4c')]({'where':{'id':_0x17e53c[_0x47ac('0x49')]['id']}})[_0x47ac('0x26')](handleEntityNotFound(_0x44e751,null))[_0x47ac('0x26')](function(_0x5e3695){if(_0x5e3695){return _0x5e3695[_0x47ac('0x8a')](_0x17e53c['body'][_0x47ac('0x75')],_[_0x47ac('0x8b')](_0x17e53c[_0x47ac('0x4d')],[_0x47ac('0x75'),'id'])||{})[_0x47ac('0x8c')](function(_0x401e18){for(var _0x1b7e19=0x0;_0x1b7e19<_0x17e53c[_0x47ac('0x4d')][_0x47ac('0x75')][_0x47ac('0x37')];_0x1b7e19+=0x1){socket[_0x47ac('0x72')](_0x47ac('0x73'),{'UserId':_0x17e53c[_0x47ac('0x4d')][_0x47ac('0x75')][_0x1b7e19],'MailQueueId':_0x17e53c[_0x47ac('0x49')]['id']});}return _0x401e18;});}})[_0x47ac('0x26')](respondWithResult(_0x44e751,null))[_0x47ac('0x47')](handleError(_0x44e751,null));};exports[_0x47ac('0x88')]=function(_0x497540,_0x58d11e,_0x49352d){return db['MailQueue']['find']({'where':{'id':_0x497540[_0x47ac('0x49')]['id']}})[_0x47ac('0x26')](handleEntityNotFound(_0x58d11e,null))[_0x47ac('0x26')](function(_0x4ff725){if(_0x4ff725){return _0x4ff725[_0x47ac('0x88')](_0x497540[_0x47ac('0x31')][_0x47ac('0x75')])[_0x47ac('0x26')](function(){if(_[_0x47ac('0x8d')](_0x497540[_0x47ac('0x31')][_0x47ac('0x75')])){for(var _0x2abb10=0x0;_0x2abb10<_0x497540[_0x47ac('0x31')][_0x47ac('0x75')]['length'];_0x2abb10+=0x1){socket[_0x47ac('0x72')](_0x47ac('0x89'),{'UserId':Number(_0x497540[_0x47ac('0x31')][_0x47ac('0x75')][_0x2abb10]),'MailQueueId':Number(_0x497540[_0x47ac('0x49')]['id'])});}}else{socket['emit'](_0x47ac('0x89'),{'UserId':Number(_0x497540[_0x47ac('0x31')][_0x47ac('0x75')]),'MailQueueId':Number(_0x497540['params']['id'])});}});}})['then'](respondWithStatusCode(_0x58d11e,null))[_0x47ac('0x47')](handleError(_0x58d11e,null));};exports[_0x47ac('0x8e')]=function(_0x1c6553,_0x441f6c,_0x206897){var _0x43f664={};var _0x1f7c79={};var _0x33b9c8;var _0x20ae1d;return db[_0x47ac('0x30')][_0x47ac('0x57')]({'where':{'id':_0x1c6553[_0x47ac('0x49')]['id']}})[_0x47ac('0x26')](handleEntityNotFound(_0x441f6c,null))['then'](function(_0x42088e){if(_0x42088e){_0x33b9c8=_0x42088e;_0x1f7c79[_0x47ac('0x35')]=_[_0x47ac('0x32')](db[_0x47ac('0x5b')][_0x47ac('0x4a')]);_0x1f7c79['query']=_[_0x47ac('0x32')](_0x1c6553['query']);_0x1f7c79[_0x47ac('0x33')]=_[_0x47ac('0x34')](_0x1f7c79['model'],_0x1f7c79[_0x47ac('0x31')]);_0x43f664['attributes']=_[_0x47ac('0x34')](_0x1f7c79[_0x47ac('0x35')],qs[_0x47ac('0x4b')](_0x1c6553['query'][_0x47ac('0x4b')]));_0x43f664[_0x47ac('0x36')]=_0x43f664[_0x47ac('0x36')][_0x47ac('0x37')]?_0x43f664[_0x47ac('0x36')]:_0x1f7c79[_0x47ac('0x35')];_0x43f664[_0x47ac('0x38')]=qs[_0x47ac('0x39')](_0x1c6553['query'][_0x47ac('0x39')]);_0x43f664[_0x47ac('0x3d')]=qs[_0x47ac('0x33')](_[_0x47ac('0x3a')](_0x1c6553[_0x47ac('0x31')],_0x1f7c79[_0x47ac('0x33')]));if(_0x1c6553['query'][_0x47ac('0x3b')]){_0x43f664[_0x47ac('0x3d')]=_['merge'](_0x43f664[_0x47ac('0x3d')],{'$or':_[_0x47ac('0x3e')](_0x43f664[_0x47ac('0x36')],function(_0x5cc717){var _0x1a62ba={};_0x1a62ba[_0x5cc717]={'$like':'%'+_0x1c6553[_0x47ac('0x31')][_0x47ac('0x3b')]+'%'};return _0x1a62ba;})});}_0x43f664=_[_0x47ac('0x3c')]({},_0x43f664,_0x1c6553['options']);return _0x33b9c8[_0x47ac('0x8e')](_0x43f664);}})['then'](function(_0x1fba7d){if(_0x1fba7d){_0x20ae1d=_0x1fba7d['length'];if(!_0x1c6553['query']['hasOwnProperty'](_0x47ac('0x59'))){_0x43f664['limit']=qs['limit'](_0x1c6553[_0x47ac('0x31')][_0x47ac('0x21')]);_0x43f664[_0x47ac('0x20')]=qs[_0x47ac('0x20')](_0x1c6553[_0x47ac('0x31')][_0x47ac('0x20')]);}return _0x33b9c8[_0x47ac('0x8e')](_0x43f664);}})[_0x47ac('0x26')](function(_0x19338f){if(_0x19338f){return _0x19338f?{'count':_0x20ae1d,'rows':_0x19338f}:null;}})['then'](respondWithResult(_0x441f6c,null))[_0x47ac('0x47')](handleError(_0x441f6c,null));}; \ No newline at end of file +var _0x459e=['agent','mailPause','updatedAt','%s/%s','getTeams','findOne','addTeams','teams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','ids','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','MailQueue','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','map','type','key','field','merge','options','includeAll','findAll','rows','params','rawAttributes','length','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','describe','getMembers','UserMailQueue','nolimit','pick','MailQueueId','filter','User','UserId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x459e,0xab));var _0xe459=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x459e[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0xe459('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe459('0x1'));var moment=require(_0xe459('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe459('0x3'));var util=require('util');var path=require(_0xe459('0x4'));var sox=require(_0xe459('0x5'));var csv=require(_0xe459('0x6'));var ejs=require(_0xe459('0x7'));var fs=require('fs');var _=require(_0xe459('0x8'));var squel=require(_0xe459('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe459('0xa'));var toCsv=require(_0xe459('0x6'));var querystring=require(_0xe459('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe459('0xc'));var qs=require(_0xe459('0xd'));var hardwareService=require(_0xe459('0xe'));var logger=require(_0xe459('0xf'))(_0xe459('0x10'));var utils=require('../../config/utils');var config=require(_0xe459('0x11'));var db=require(_0xe459('0x12'))['db'];config[_0xe459('0x13')]=_[_0xe459('0x14')](config[_0xe459('0x13')],{'host':_0xe459('0x15'),'port':0x18eb});var socket=require(_0xe459('0x16'))(new Redis(config[_0xe459('0x13')]));require(_0xe459('0x17'))['register'](socket);function respondWithStatusCode(_0x2c6423,_0x9404d){_0x9404d=_0x9404d||0xcc;return function(_0x58d0d9){if(_0x58d0d9){return _0x2c6423[_0xe459('0x18')](_0x9404d);}return _0x2c6423[_0xe459('0x19')](_0x9404d)[_0xe459('0x1a')]();};}function respondWithResult(_0x28c7f2,_0x104b6b){_0x104b6b=_0x104b6b||0xc8;return function(_0x46406b){if(_0x46406b){return _0x28c7f2[_0xe459('0x19')](_0x104b6b)[_0xe459('0x1b')](_0x46406b);}};}function respondWithFilteredResult(_0x1f9826,_0x494bf4){return function(_0x2d62a8){if(_0x2d62a8){var _0x3a9e1d=_0x2d62a8[_0xe459('0x1c')],_0x51d0ba=_0x494bf4[_0xe459('0x1d')],_0x170857=_0x494bf4[_0xe459('0x1d')]+_0x494bf4['limit'],_0x9c2aaf;if(_0x170857>=_0x3a9e1d){_0x170857=_0x3a9e1d;_0x9c2aaf=0xc8;}else{_0x9c2aaf=0xce;}_0x1f9826[_0xe459('0x19')](_0x9c2aaf);return _0x1f9826[_0xe459('0x1e')](_0xe459('0x1f'),_0x51d0ba+'-'+_0x170857+'/'+_0x3a9e1d)[_0xe459('0x1b')](_0x2d62a8);}return null;};}function patchUpdates(_0x18afe3){return function(_0x2d7a19){try{jsonpatch['apply'](_0x2d7a19,_0x18afe3,!![]);}catch(_0x59ea27){return BPromise[_0xe459('0x20')](_0x59ea27);}return _0x2d7a19['save']();};}function saveUpdates(_0x48bdda,_0x136479){return function(_0x82af03){if(_0x82af03){return _0x82af03[_0xe459('0x21')](_0x48bdda)[_0xe459('0x22')](function(_0x5590fe){return _0x5590fe;});}return null;};}function removeEntity(_0x3f67dd,_0x3ab7eb){return function(_0x284151){if(_0x284151){return _0x284151[_0xe459('0x23')]()[_0xe459('0x22')](function(){var _0xec9b91=_0x284151[_0xe459('0x24')]({'plain':!![]});var _0x3d1530=_0xe459('0x25');return db[_0xe459('0x26')][_0xe459('0x23')]({'where':{'type':_0x3d1530,'resourceId':_0xec9b91['id']}})[_0xe459('0x22')](function(){return _0x284151;});})['then'](function(){_0x3f67dd[_0xe459('0x19')](0xcc)[_0xe459('0x1a')]();});}};}function handleEntityNotFound(_0x5858c3,_0x476ca0){return function(_0x24a315){if(!_0x24a315){_0x5858c3['sendStatus'](0x194);}return _0x24a315;};}function handleError(_0x41efae,_0x131199){_0x131199=_0x131199||0x1f4;return function(_0x17b32d){logger['error'](_0x17b32d[_0xe459('0x27')]);if(_0x17b32d[_0xe459('0x28')]){delete _0x17b32d[_0xe459('0x28')];}_0x41efae[_0xe459('0x19')](_0x131199)[_0xe459('0x29')](_0x17b32d);};}exports[_0xe459('0x2a')]=function(_0x5f3a6a,_0xcefcc4){var _0x2f3704={},_0x5c3893={},_0x1abc03={'count':0x0,'rows':[]};var _0x19617a=db[_0xe459('0x2b')]['rawAttributes'];_0x5c3893['model']=_[_0xe459('0x2c')](_0x19617a);_0x5c3893['query']=_['keys'](_0x5f3a6a[_0xe459('0x2d')]);_0x5c3893[_0xe459('0x2e')]=_[_0xe459('0x2f')](_0x5c3893[_0xe459('0x30')],_0x5c3893[_0xe459('0x2d')]);_0x2f3704[_0xe459('0x31')]=_['intersection'](_0x5c3893['model'],qs[_0xe459('0x32')](_0x5f3a6a[_0xe459('0x2d')]['fields']));_0x2f3704[_0xe459('0x31')]=_0x2f3704['attributes']['length']?_0x2f3704[_0xe459('0x31')]:_0x5c3893[_0xe459('0x30')];if(!_0x5f3a6a['query'][_0xe459('0x33')]('nolimit')){_0x2f3704[_0xe459('0x34')]=qs[_0xe459('0x34')](_0x5f3a6a['query'][_0xe459('0x34')]);_0x2f3704[_0xe459('0x1d')]=qs[_0xe459('0x1d')](_0x5f3a6a[_0xe459('0x2d')][_0xe459('0x1d')]);}_0x2f3704[_0xe459('0x35')]=qs[_0xe459('0x36')](_0x5f3a6a['query']['sort']);_0x2f3704['where']=qs[_0xe459('0x2e')](_['pick'](_0x5f3a6a[_0xe459('0x2d')],_0x5c3893[_0xe459('0x2e')]));if(_0x5f3a6a['query']['filter']){_0x2f3704['where']=_['merge'](_0x2f3704[_0xe459('0x37')],{'$or':_[_0xe459('0x38')](_0x19617a,function(_0x188922){if(_0x188922[_0xe459('0x39')][_0xe459('0x3a')]!=='VIRTUAL'){var _0x27d703={};_0x27d703[_0x188922[_0xe459('0x3b')]]={'$like':'%'+_0x5f3a6a[_0xe459('0x2d')]['filter']+'%'};return _0x27d703;}})});}_0x2f3704=_[_0xe459('0x3c')]({},_0x2f3704,_0x5f3a6a[_0xe459('0x3d')]);var _0x28fb1c={'where':_0x2f3704[_0xe459('0x37')]};return db[_0xe459('0x2b')]['count'](_0x28fb1c)[_0xe459('0x22')](function(_0x66292f){_0x1abc03[_0xe459('0x1c')]=_0x66292f;if(_0x5f3a6a[_0xe459('0x2d')][_0xe459('0x3e')]){_0x2f3704['include']=[{'all':!![]}];}return db['MailQueue'][_0xe459('0x3f')](_0x2f3704);})[_0xe459('0x22')](function(_0x1cc3eb){_0x1abc03[_0xe459('0x40')]=_0x1cc3eb;return _0x1abc03;})[_0xe459('0x22')](respondWithFilteredResult(_0xcefcc4,_0x2f3704))['catch'](handleError(_0xcefcc4,null));};exports['show']=function(_0x323a4d,_0xbc7cac){var _0x265eb0={'raw':!![],'where':{'id':_0x323a4d[_0xe459('0x41')]['id']}},_0x30e146={};_0x30e146[_0xe459('0x30')]=_[_0xe459('0x2c')](db[_0xe459('0x2b')][_0xe459('0x42')]);_0x30e146[_0xe459('0x2d')]=_[_0xe459('0x2c')](_0x323a4d[_0xe459('0x2d')]);_0x30e146[_0xe459('0x2e')]=_[_0xe459('0x2f')](_0x30e146[_0xe459('0x30')],_0x30e146['query']);_0x265eb0[_0xe459('0x31')]=_[_0xe459('0x2f')](_0x30e146[_0xe459('0x30')],qs[_0xe459('0x32')](_0x323a4d[_0xe459('0x2d')][_0xe459('0x32')]));_0x265eb0[_0xe459('0x31')]=_0x265eb0[_0xe459('0x31')][_0xe459('0x43')]?_0x265eb0[_0xe459('0x31')]:_0x30e146[_0xe459('0x30')];if(_0x323a4d[_0xe459('0x2d')][_0xe459('0x3e')]){_0x265eb0[_0xe459('0x44')]=[{'all':!![]}];}_0x265eb0=_[_0xe459('0x3c')]({},_0x265eb0,_0x323a4d['options']);return db[_0xe459('0x2b')][_0xe459('0x45')](_0x265eb0)[_0xe459('0x22')](handleEntityNotFound(_0xbc7cac,null))[_0xe459('0x22')](respondWithResult(_0xbc7cac,null))[_0xe459('0x46')](handleError(_0xbc7cac,null));};exports['create']=function(_0x5044af,_0x45c4a0){return db['MailQueue'][_0xe459('0x47')](_0x5044af[_0xe459('0x48')],{})[_0xe459('0x22')](function(_0x463ad5){var _0x23369f=_0x5044af['user'][_0xe459('0x24')]({'plain':!![]});if(!_0x23369f)throw new Error(_0xe459('0x49'));if(_0x23369f[_0xe459('0x4a')]===_0xe459('0x4b')){var _0x305b4c=_0x463ad5[_0xe459('0x24')]({'plain':!![]});var _0x3e287a='MailQueues';return db[_0xe459('0x4c')][_0xe459('0x45')]({'where':{'name':_0x3e287a,'userProfileId':_0x23369f[_0xe459('0x4d')]},'raw':!![]})[_0xe459('0x22')](function(_0x41e5eb){if(_0x41e5eb&&_0x41e5eb[_0xe459('0x4e')]===0x0){return db['UserProfileResource'][_0xe459('0x47')]({'name':_0x305b4c[_0xe459('0x28')],'resourceId':_0x305b4c['id'],'type':_0x41e5eb[_0xe459('0x28')],'sectionId':_0x41e5eb['id']},{})[_0xe459('0x22')](function(){return _0x463ad5;});}else{return _0x463ad5;}})[_0xe459('0x46')](function(_0x2eaaef){logger[_0xe459('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2eaaef);throw _0x2eaaef;});}return _0x463ad5;})[_0xe459('0x22')](respondWithResult(_0x45c4a0,0xc9))['catch'](handleError(_0x45c4a0,null));};exports['update']=function(_0x473edd,_0x36827a){if(_0x473edd[_0xe459('0x48')]['id']){delete _0x473edd[_0xe459('0x48')]['id'];}return db[_0xe459('0x2b')][_0xe459('0x45')]({'where':{'id':_0x473edd[_0xe459('0x41')]['id']}})['then'](handleEntityNotFound(_0x36827a,null))[_0xe459('0x22')](saveUpdates(_0x473edd[_0xe459('0x48')],null))['then'](respondWithResult(_0x36827a,null))[_0xe459('0x46')](handleError(_0x36827a,null));};exports[_0xe459('0x23')]=function(_0x37f9ca,_0x1f14c8){return db['MailQueue'][_0xe459('0x45')]({'where':{'id':_0x37f9ca[_0xe459('0x41')]['id']}})[_0xe459('0x22')](handleEntityNotFound(_0x1f14c8,null))['then'](removeEntity(_0x1f14c8,null))['catch'](handleError(_0x1f14c8,null));};exports[_0xe459('0x50')]=function(_0x5b3436,_0x2e7f8a){return db[_0xe459('0x2b')][_0xe459('0x50')]()[_0xe459('0x22')](respondWithResult(_0x2e7f8a,null))[_0xe459('0x46')](handleError(_0x2e7f8a,null));};exports[_0xe459('0x51')]=function(_0x437c7e,_0x1790e5,_0x3e29bb){var _0x307499={'raw':!![],'where':{}},_0x2eebfe={},_0x1a4cd1;return db[_0xe459('0x2b')]['findOne']({'where':{'id':_0x437c7e['params']['id']}})[_0xe459('0x22')](handleEntityNotFound(_0x1790e5,null))[_0xe459('0x22')](function(_0x358a82){if(_0x358a82){_0x1a4cd1=_0x358a82[_0xe459('0x24')]({'plain':!![]});_0x2eebfe['model']=_[_0xe459('0x2c')](db[_0xe459('0x52')][_0xe459('0x42')]);_0x2eebfe[_0xe459('0x2d')]=_[_0xe459('0x2c')](_0x437c7e[_0xe459('0x2d')]);_0x2eebfe[_0xe459('0x2e')]=_[_0xe459('0x2f')](_0x2eebfe[_0xe459('0x30')],_0x2eebfe[_0xe459('0x2d')]);_0x307499['attributes']=_[_0xe459('0x2f')](_0x2eebfe[_0xe459('0x30')],qs[_0xe459('0x32')](_0x437c7e[_0xe459('0x2d')]['fields']));_0x307499[_0xe459('0x31')]=_0x307499[_0xe459('0x31')][_0xe459('0x43')]?_0x307499['attributes']:_0x2eebfe[_0xe459('0x30')];if(!_0x437c7e[_0xe459('0x2d')]['hasOwnProperty'](_0xe459('0x53'))){_0x307499[_0xe459('0x34')]=qs[_0xe459('0x34')](_0x437c7e[_0xe459('0x2d')][_0xe459('0x34')]);_0x307499['offset']=qs[_0xe459('0x1d')](_0x437c7e[_0xe459('0x2d')][_0xe459('0x1d')]);}_0x307499[_0xe459('0x35')]=qs[_0xe459('0x36')](_0x437c7e[_0xe459('0x2d')][_0xe459('0x36')]);_0x307499[_0xe459('0x37')]=qs['filters'](_[_0xe459('0x54')](_0x437c7e['query'],_0x2eebfe[_0xe459('0x2e')]));_0x307499[_0xe459('0x37')][_0xe459('0x55')]=_0x358a82['id'];if(_0x437c7e[_0xe459('0x2d')][_0xe459('0x56')]){_0x307499['where']=_[_0xe459('0x3c')](_0x307499[_0xe459('0x37')],{'$or':_[_0xe459('0x38')](_0x307499[_0xe459('0x31')],function(_0x1751f7){var _0x230fa2={};_0x230fa2[_0x1751f7]={'$like':'%'+_0x437c7e['query'][_0xe459('0x56')]+'%'};return _0x230fa2;})});}_0x307499=_[_0xe459('0x3c')]({},_0x307499,_0x437c7e[_0xe459('0x3d')]);return db[_0xe459('0x52')][_0xe459('0x3f')](_0x307499);}})[_0xe459('0x22')](function(_0xedbff4){if(_0xedbff4){return db[_0xe459('0x57')]['findAndCountAll']({'where':{'id':_['map'](_0xedbff4,_0xe459('0x58')),'role':_0xe459('0x59')},'attributes':['id',_0xe459('0x28'),_0xe459('0x5a'),_0xe459('0x5b'),'createdAt']});}})[_0xe459('0x22')](function(_0x483c44){if(_0x483c44){return{'count':_0x483c44[_0xe459('0x1c')],'rows':_['map'](_0x483c44[_0xe459('0x40')],function(_0x21bc14){return{'membername':_0x21bc14[_0xe459('0x28')],'UserId':_0x21bc14['id'],'queue_name':_0x1a4cd1[_0xe459('0x28')],'MailQueueId':_0x1a4cd1['id'],'interface':util['format'](_0xe459('0x5c'),'SIP',_0x21bc14[_0xe459('0x28')]),'penalty':0x0,'paused':_0x21bc14['mailPause'],'createdAt':_0x21bc14['createdAt'],'updatedAt':_0x21bc14[_0xe459('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe459('0x22')](respondWithFilteredResult(_0x1790e5,_0x307499))[_0xe459('0x46')](handleError(_0x1790e5,null));};exports[_0xe459('0x5d')]=function(_0x42d4cf,_0x3eb2aa,_0x187932){var _0x172e09={};var _0x279866={};var _0x14bf33;var _0x5d96b8;return db[_0xe459('0x2b')][_0xe459('0x5e')]({'where':{'id':_0x42d4cf['params']['id']}})['then'](handleEntityNotFound(_0x3eb2aa,null))[_0xe459('0x22')](function(_0x3b2965){if(_0x3b2965){_0x14bf33=_0x3b2965;_0x279866[_0xe459('0x30')]=_['keys'](db['Team']['rawAttributes']);_0x279866['query']=_[_0xe459('0x2c')](_0x42d4cf[_0xe459('0x2d')]);_0x279866[_0xe459('0x2e')]=_[_0xe459('0x2f')](_0x279866[_0xe459('0x30')],_0x279866[_0xe459('0x2d')]);_0x172e09[_0xe459('0x31')]=_['intersection'](_0x279866['model'],qs[_0xe459('0x32')](_0x42d4cf[_0xe459('0x2d')][_0xe459('0x32')]));_0x172e09[_0xe459('0x31')]=_0x172e09[_0xe459('0x31')][_0xe459('0x43')]?_0x172e09['attributes']:_0x279866[_0xe459('0x30')];_0x172e09['order']=qs[_0xe459('0x36')](_0x42d4cf['query'][_0xe459('0x36')]);_0x172e09[_0xe459('0x37')]=qs[_0xe459('0x2e')](_['pick'](_0x42d4cf['query'],_0x279866['filters']));if(_0x42d4cf[_0xe459('0x2d')][_0xe459('0x56')]){_0x172e09[_0xe459('0x37')]=_[_0xe459('0x3c')](_0x172e09[_0xe459('0x37')],{'$or':_[_0xe459('0x38')](_0x172e09[_0xe459('0x31')],function(_0x5dc925){var _0x5395c0={};_0x5395c0[_0x5dc925]={'$like':'%'+_0x42d4cf['query']['filter']+'%'};return _0x5395c0;})});}_0x172e09=_[_0xe459('0x3c')]({},_0x172e09,_0x42d4cf[_0xe459('0x3d')]);return _0x14bf33['getTeams'](_0x172e09);}})[_0xe459('0x22')](function(_0x1adc26){if(_0x1adc26){_0x5d96b8=_0x1adc26[_0xe459('0x43')];if(!_0x42d4cf[_0xe459('0x2d')]['hasOwnProperty'](_0xe459('0x53'))){_0x172e09[_0xe459('0x34')]=qs[_0xe459('0x34')](_0x42d4cf[_0xe459('0x2d')][_0xe459('0x34')]);_0x172e09['offset']=qs['offset'](_0x42d4cf[_0xe459('0x2d')][_0xe459('0x1d')]);}return _0x14bf33[_0xe459('0x5d')](_0x172e09);}})[_0xe459('0x22')](function(_0x5cfd10){if(_0x5cfd10){return _0x5cfd10?{'count':_0x5d96b8,'rows':_0x5cfd10}:null;}})[_0xe459('0x22')](respondWithResult(_0x3eb2aa,null))['catch'](handleError(_0x3eb2aa,null));};exports[_0xe459('0x5f')]=function(_0x49ab7a,_0x4c52d7,_0x10a6c1){var _0x12f72f=_0x49ab7a[_0xe459('0x48')][_0xe459('0x60')];return db[_0xe459('0x61')][_0xe459('0x3f')]({'where':{'id':_[_0xe459('0x38')](_0x12f72f,'id')},'attributes':['id'],'include':[{'model':db[_0xe459('0x57')],'as':_0xe459('0x62'),'attributes':['id',_0xe459('0x28'),_0xe459('0x63'),_0xe459('0x64'),_0xe459('0x65')],'raw':!![]}]})[_0xe459('0x22')](function(_0x2c83a9){if(_0x2c83a9){var _0x4ec74f=_[_0xe459('0x66')](_0x2c83a9,function(_0x42af63){var _0x2b79a5=_0x42af63[_0xe459('0x24')]({'plain':!![]});return _0x2b79a5[_0xe459('0x62')];});return db[_0xe459('0x2b')][_0xe459('0x45')]({'where':{'id':_0x49ab7a[_0xe459('0x41')]['id']}})['then'](function(_0x32bb81){return db[_0xe459('0x67')]['transaction'](function(_0x47b365){return _0x32bb81[_0xe459('0x5f')](_['map'](_0x12f72f,'id'),{'transaction':_0x47b365})['then'](function(){return BPromise[_0xe459('0x68')](_0x4ec74f,function(_0x31f209){return db[_0xe459('0x52')]['findOrCreate']({'where':{'UserId':_0x31f209['id'],'MailQueueId':_0x49ab7a['params']['id']},'transaction':_0x47b365});});})[_0xe459('0x22')](function(){_0x4ec74f[_0xe459('0x69')](function(_0x21d272){socket[_0xe459('0x6a')](_0xe459('0x6b'),{'UserId':_0x21d272['id'],'MailQueueId':_0x32bb81['id']});});});});});}})[_0xe459('0x22')](respondWithStatusCode(_0x4c52d7,null))[_0xe459('0x46')](handleError(_0x4c52d7,null));};exports[_0xe459('0x6c')]=function(_0x2190ef,_0x293459,_0x3e694e){return db[_0xe459('0x61')][_0xe459('0x3f')]({'where':{'id':_0x2190ef[_0xe459('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe459('0x57')],'as':_0xe459('0x62'),'attributes':['id'],'raw':!![]}]})[_0xe459('0x22')](handleEntityNotFound(_0x293459,null))[_0xe459('0x22')](function(_0x1c1918){var _0x3583bb=_[_0xe459('0x38')](_0x1c1918,'id');var _0x38f4a8=[];var _0x57221c=[];var _0x3692de=squel['select']();_0x3692de[_0xe459('0x3b')](_0xe459('0x6d'))['from'](_0xe459('0x6e'),'tq')[_0xe459('0x6f')](_0xe459('0x70'),'ut',_0xe459('0x71'))[_0xe459('0x37')](_0xe459('0x72'),_0x2190ef['params']['id']);for(var _0x5b3f45=0x0;_0x5b3f45<_0x1c1918[_0xe459('0x43')];_0x5b3f45+=0x1){let _0x322142=_0x1c1918[_0x5b3f45];for(var _0x2d1f84=0x0;_0x2d1f84<_0x322142[_0xe459('0x62')][_0xe459('0x43')];_0x2d1f84+=0x1){let _0x3efdc8=_0x322142[_0xe459('0x62')][_0x2d1f84];var _0x231915=_0x3692de['clone']();_0x231915['where'](_0xe459('0x73'),_0x3efdc8['id']);_0x57221c[_0xe459('0x74')](db[_0xe459('0x67')][_0xe459('0x2d')](_0x231915[_0xe459('0x75')](),{'type':db[_0xe459('0x67')]['QueryTypes']['SELECT']})[_0xe459('0x22')](function(_0x2da0b0){if(_0x2da0b0[_0xe459('0x43')]===0x1){return _0x3efdc8['id'];}else{var _0xd1a71=_[_0xe459('0x76')](_[_0xe459('0x38')](_0x2da0b0,_0xe459('0x77')),function(_0xc0daea){return _[_0xe459('0x78')](_0x3583bb,_0xc0daea);});if(_0xd1a71){return _0x3efdc8['id'];}}}));}}return BPromise[_0xe459('0x79')](_0x57221c)[_0xe459('0x22')](function(_0x1dd2a6){_0x38f4a8=_(_0x38f4a8)[_0xe459('0x7a')](_0x1dd2a6)['compact']()['value']();return db[_0xe459('0x2b')][_0xe459('0x45')]({'where':{'id':_0x2190ef['params']['id']}})[_0xe459('0x22')](function(_0x2e1305){return db[_0xe459('0x67')]['transaction'](function(_0x5d1905){return _0x2e1305['removeTeams'](_0x2190ef[_0xe459('0x2d')][_0xe459('0x7b')],{'transaction':_0x5d1905})[_0xe459('0x22')](function(){if(!_['isEmpty'](_0x38f4a8)){return _0x2e1305[_0xe459('0x7c')](_0x38f4a8,{'transaction':_0x5d1905});}})[_0xe459('0x22')](function(){_0x38f4a8[_0xe459('0x69')](function(_0x691da9){socket['emit'](_0xe459('0x7d'),{'UserId':_0x691da9,'MailQueueId':_0x2e1305['id']});});});});});});})[_0xe459('0x22')](respondWithStatusCode(_0x293459,null))[_0xe459('0x46')](handleError(_0x293459,null));};exports[_0xe459('0x7e')]=function(_0xf2c069,_0x8f636b,_0x2de547){return db[_0xe459('0x2b')]['find']({'where':{'id':_0xf2c069[_0xe459('0x41')]['id']}})['then'](handleEntityNotFound(_0x8f636b,null))[_0xe459('0x22')](function(_0x49cc6e){if(_0x49cc6e){return _0x49cc6e['addAgents'](_0xf2c069[_0xe459('0x48')][_0xe459('0x7b')],_['omit'](_0xf2c069[_0xe459('0x48')],['ids','id'])||{})[_0xe459('0x7f')](function(_0x3632d){for(var _0x2ce4ad=0x0;_0x2ce4ad<_0xf2c069[_0xe459('0x48')][_0xe459('0x7b')][_0xe459('0x43')];_0x2ce4ad+=0x1){socket['emit'](_0xe459('0x6b'),{'UserId':_0xf2c069['body'][_0xe459('0x7b')][_0x2ce4ad],'MailQueueId':_0xf2c069[_0xe459('0x41')]['id']});}return _0x3632d;});}})[_0xe459('0x22')](respondWithResult(_0x8f636b,null))[_0xe459('0x46')](handleError(_0x8f636b,null));};exports['removeAgents']=function(_0x205c8e,_0x38f45f,_0x214913){return db[_0xe459('0x2b')]['find']({'where':{'id':_0x205c8e['params']['id']}})[_0xe459('0x22')](handleEntityNotFound(_0x38f45f,null))[_0xe459('0x22')](function(_0x514300){if(_0x514300){return _0x514300[_0xe459('0x7c')](_0x205c8e[_0xe459('0x2d')]['ids'])[_0xe459('0x22')](function(){if(_[_0xe459('0x80')](_0x205c8e[_0xe459('0x2d')][_0xe459('0x7b')])){for(var _0x21595f=0x0;_0x21595f<_0x205c8e['query'][_0xe459('0x7b')][_0xe459('0x43')];_0x21595f+=0x1){socket[_0xe459('0x6a')](_0xe459('0x7d'),{'UserId':Number(_0x205c8e[_0xe459('0x2d')][_0xe459('0x7b')][_0x21595f]),'MailQueueId':Number(_0x205c8e[_0xe459('0x41')]['id'])});}}else{socket[_0xe459('0x6a')](_0xe459('0x7d'),{'UserId':Number(_0x205c8e[_0xe459('0x2d')][_0xe459('0x7b')]),'MailQueueId':Number(_0x205c8e[_0xe459('0x41')]['id'])});}});}})[_0xe459('0x22')](respondWithStatusCode(_0x38f45f,null))[_0xe459('0x46')](handleError(_0x38f45f,null));};exports[_0xe459('0x81')]=function(_0x3bf103,_0x38c4e9,_0x36be71){var _0x24657e={};var _0xe30ab7={};var _0x1560c8;var _0x4c5ca7;return db[_0xe459('0x2b')][_0xe459('0x5e')]({'where':{'id':_0x3bf103['params']['id']}})[_0xe459('0x22')](handleEntityNotFound(_0x38c4e9,null))['then'](function(_0x50da4e){if(_0x50da4e){_0x1560c8=_0x50da4e;_0xe30ab7[_0xe459('0x30')]=_[_0xe459('0x2c')](db[_0xe459('0x57')][_0xe459('0x42')]);_0xe30ab7[_0xe459('0x2d')]=_[_0xe459('0x2c')](_0x3bf103['query']);_0xe30ab7[_0xe459('0x2e')]=_[_0xe459('0x2f')](_0xe30ab7[_0xe459('0x30')],_0xe30ab7[_0xe459('0x2d')]);_0x24657e[_0xe459('0x31')]=_[_0xe459('0x2f')](_0xe30ab7[_0xe459('0x30')],qs[_0xe459('0x32')](_0x3bf103['query'][_0xe459('0x32')]));_0x24657e['attributes']=_0x24657e[_0xe459('0x31')]['length']?_0x24657e[_0xe459('0x31')]:_0xe30ab7[_0xe459('0x30')];_0x24657e['order']=qs[_0xe459('0x36')](_0x3bf103[_0xe459('0x2d')][_0xe459('0x36')]);_0x24657e[_0xe459('0x37')]=qs[_0xe459('0x2e')](_[_0xe459('0x54')](_0x3bf103[_0xe459('0x2d')],_0xe30ab7[_0xe459('0x2e')]));if(_0x3bf103[_0xe459('0x2d')][_0xe459('0x56')]){_0x24657e[_0xe459('0x37')]=_[_0xe459('0x3c')](_0x24657e[_0xe459('0x37')],{'$or':_[_0xe459('0x38')](_0x24657e['attributes'],function(_0x16af57){var _0x542525={};_0x542525[_0x16af57]={'$like':'%'+_0x3bf103[_0xe459('0x2d')]['filter']+'%'};return _0x542525;})});}_0x24657e=_[_0xe459('0x3c')]({},_0x24657e,_0x3bf103['options']);return _0x1560c8[_0xe459('0x81')](_0x24657e);}})[_0xe459('0x22')](function(_0x1605c1){if(_0x1605c1){_0x4c5ca7=_0x1605c1[_0xe459('0x43')];if(!_0x3bf103['query']['hasOwnProperty'](_0xe459('0x53'))){_0x24657e[_0xe459('0x34')]=qs[_0xe459('0x34')](_0x3bf103['query'][_0xe459('0x34')]);_0x24657e[_0xe459('0x1d')]=qs[_0xe459('0x1d')](_0x3bf103[_0xe459('0x2d')][_0xe459('0x1d')]);}return _0x1560c8[_0xe459('0x81')](_0x24657e);}})[_0xe459('0x22')](function(_0x2e2950){if(_0x2e2950){return _0x2e2950?{'count':_0x4c5ca7,'rows':_0x2e2950}:null;}})['then'](respondWithResult(_0x38c4e9,null))[_0xe459('0x46')](handleError(_0x38c4e9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 21ad43f..685058c 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 _0x401c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x401c,0x1d4));var _0xc401=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0x401c[_0x27031e];return _0xfd46b3;};'use strict';var EventEmitter=require(_0xc401('0x0'));var MailQueue=require(_0xc401('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc401('0x2')](0x0);var events={'afterCreate':_0xc401('0x3'),'afterUpdate':_0xc401('0x4'),'afterDestroy':_0xc401('0x5')};function emitEvent(_0x14ce26){return function(_0x4cdc86,_0x5556cc,_0x5976a7){MailQueueEvents['emit'](_0x14ce26+':'+_0x4cdc86['id'],_0x4cdc86);MailQueueEvents[_0xc401('0x6')](_0x14ce26,_0x4cdc86);_0x5976a7(null);};}for(var e in events){if(events[_0xc401('0x7')](e)){var event=events[e];MailQueue[_0xc401('0x8')](e,emitEvent(event));}}module[_0xc401('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x1741=['hasOwnProperty','exports','../../mysqldb','update','emit'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x1741,0x66));var _0x1174=function(_0x3ec822,_0x59a9c2){_0x3ec822=_0x3ec822-0x0;var _0x5927c6=_0x1741[_0x3ec822];return _0x5927c6;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x1174('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1174('0x1'),'afterDestroy':'remove'};function emitEvent(_0x51ba1d){return function(_0x210fe3,_0x53bc2f,_0x455f3b){MailQueueEvents['emit'](_0x51ba1d+':'+_0x210fe3['id'],_0x210fe3);MailQueueEvents[_0x1174('0x2')](_0x51ba1d,_0x210fe3);_0x455f3b(null);};}for(var e in events){if(events[_0x1174('0x3')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x1174('0x4')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 10e7573..60ece44 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 _0xf4eb=['./mailQueue.attributes','exports','define','mail_queues','lodash','bluebird','rimraf','../../config/environment'];(function(_0x72129f,_0x3d52e2){var _0xc0c836=function(_0xd26a50){while(--_0xd26a50){_0x72129f['push'](_0x72129f['shift']());}};_0xc0c836(++_0x3d52e2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x51fd61,_0x5f1ac2){_0x51fd61=_0x51fd61-0x0;var _0x58820e=_0xf4eb[_0x51fd61];return _0x58820e;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('MailQueue',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues'];(function(_0x5bbc31,_0xa486a0){var _0x2c4190=function(_0x5908f3){while(--_0x5908f3){_0x5bbc31['push'](_0x5bbc31['shift']());}};_0x2c4190(++_0xa486a0);}(_0xac4a,0x13f));var _0xaac4=function(_0xa33292,_0x11a10c){_0xa33292=_0xa33292-0x0;var _0xbe8431=_0xac4a[_0xa33292];return _0xbe8431;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('MailQueue',attributes,{'tableName':_0xaac4('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 afe3f1f..59edef3 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 _0x686f=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','request\x20sent','debug','stringify','code','error','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','lodash'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x686f,0x1df));var _0xf686=function(_0x33fd5d,_0x105db5){_0x33fd5d=_0x33fd5d-0x0;var _0xa8931d=_0x686f[_0x33fd5d];return _0xa8931d;};'use strict';var _=require(_0xf686('0x0'));var util=require(_0xf686('0x1'));var moment=require(_0xf686('0x2'));var BPromise=require(_0xf686('0x3'));var rs=require(_0xf686('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf686('0x5'));var logger=require(_0xf686('0x6'))(_0xf686('0x7'));var config=require('../../config/environment');var jayson=require(_0xf686('0x8'));var client=jayson[_0xf686('0x9')][_0xf686('0xa')]({'port':0x232a});config[_0xf686('0xb')]=_[_0xf686('0xc')](config['redis'],{'host':_0xf686('0xd'),'port':0x18eb});var socket=require(_0xf686('0xe'))(new Redis(config[_0xf686('0xb')]));require(_0xf686('0xf'))[_0xf686('0x10')](socket);function respondWithRpcPromise(_0x4ad0ae,_0x5da338,_0x25fbb9){return new BPromise(function(_0x3a6282,_0x3979a8){return client[_0xf686('0x11')](_0x4ad0ae,_0x25fbb9)[_0xf686('0x12')](function(_0x2a4d0a){logger['info']('MailQueue,\x20%s,\x20%s',_0x5da338,_0xf686('0x13'));logger[_0xf686('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x5da338,'request\x20sent',JSON[_0xf686('0x15')](_0x2a4d0a));if(_0x2a4d0a['error']){if(_0x2a4d0a['error'][_0xf686('0x16')]===0x1f4){logger[_0xf686('0x17')](_0xf686('0x18'),_0x5da338,_0x2a4d0a['error']['message']);return _0x3979a8(_0x2a4d0a[_0xf686('0x17')][_0xf686('0x19')]);}logger['error'](_0xf686('0x18'),_0x5da338,_0x2a4d0a['error']['message']);return _0x3a6282(_0x2a4d0a['error'][_0xf686('0x19')]);}else{logger[_0xf686('0x1a')]('MailQueue,\x20%s,\x20%s',_0x5da338,_0xf686('0x13'));_0x3a6282(_0x2a4d0a[_0xf686('0x1b')][_0xf686('0x19')]);}})[_0xf686('0x1c')](function(_0x184195){logger['error']('MailQueue,\x20%s,\x20%s',_0x5da338,_0x184195);_0x3979a8(_0x184195);});});}exports[_0xf686('0x1d')]=function(_0xfae42f){var _0x33771c=this;return new Promise(function(_0x5bfd46,_0x5bc383){return db[_0xf686('0x1e')][_0xf686('0x1f')]({'raw':_0xfae42f['options']?_0xfae42f[_0xf686('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xfae42f[_0xf686('0x20')]?_0xfae42f[_0xf686('0x20')][_0xf686('0x21')]||null:null,'attributes':_0xfae42f[_0xf686('0x20')]?_0xfae42f[_0xf686('0x20')][_0xf686('0x22')]||null:null,'limit':_0xfae42f[_0xf686('0x20')]?_0xfae42f[_0xf686('0x20')][_0xf686('0x23')]||null:null,'include':_0xfae42f[_0xf686('0x20')]?_0xfae42f[_0xf686('0x20')][_0xf686('0x24')]?_[_0xf686('0x25')](_0xfae42f[_0xf686('0x20')]['include'],function(_0x1c53a1){return{'model':db[_0x1c53a1[_0xf686('0x26')]],'as':_0x1c53a1['as'],'attributes':_0x1c53a1[_0xf686('0x22')],'include':_0x1c53a1[_0xf686('0x24')]?_[_0xf686('0x25')](_0x1c53a1['include'],function(_0x1b9e55){return{'model':db[_0x1b9e55[_0xf686('0x26')]],'as':_0x1b9e55['as'],'attributes':_0x1b9e55[_0xf686('0x22')],'include':_0x1b9e55[_0xf686('0x24')]?_[_0xf686('0x25')](_0x1b9e55[_0xf686('0x24')],function(_0xecd933){return{'model':db[_0xecd933[_0xf686('0x26')]],'as':_0xecd933['as'],'attributes':_0xecd933[_0xf686('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf686('0x12')](function(_0x122c88){logger[_0xf686('0x1a')](_0xf686('0x1d'),_0xfae42f);logger[_0xf686('0x14')]('GetMailQueue',_0xfae42f,JSON[_0xf686('0x15')](_0x122c88));_0x5bfd46(_0x122c88);})['catch'](function(_0x3e47a6){logger[_0xf686('0x17')](_0xf686('0x1d'),_0x3e47a6[_0xf686('0x19')],_0xfae42f);_0x5bc383(_0x33771c[_0xf686('0x17')](0x1f4,_0x3e47a6[_0xf686('0x19')]));});});};exports['ShowMailQueue']=function(_0x212719){var _0x4725c6=this;return new Promise(function(_0x54b56b,_0x298a78){return db[_0xf686('0x1e')]['find']({'raw':_0x212719[_0xf686('0x20')]?_0x212719[_0xf686('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x212719[_0xf686('0x20')]?_0x212719[_0xf686('0x20')][_0xf686('0x21')]||null:null,'attributes':_0x212719[_0xf686('0x20')]?_0x212719[_0xf686('0x20')]['attributes']||null:null,'include':_0x212719[_0xf686('0x20')]?_0x212719[_0xf686('0x20')][_0xf686('0x24')]?_[_0xf686('0x25')](_0x212719[_0xf686('0x20')][_0xf686('0x24')],function(_0x5e23cc){return{'model':db[_0x5e23cc['model']],'as':_0x5e23cc['as'],'attributes':_0x5e23cc[_0xf686('0x22')],'include':_0x5e23cc[_0xf686('0x24')]?_['map'](_0x5e23cc[_0xf686('0x24')],function(_0x47d779){return{'model':db[_0x47d779['model']],'as':_0x47d779['as'],'attributes':_0x47d779[_0xf686('0x22')],'include':_0x47d779[_0xf686('0x24')]?_[_0xf686('0x25')](_0x47d779[_0xf686('0x24')],function(_0x49c64d){return{'model':db[_0x49c64d[_0xf686('0x26')]],'as':_0x49c64d['as'],'attributes':_0x49c64d[_0xf686('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf686('0x12')](function(_0x5a869b){logger[_0xf686('0x1a')](_0xf686('0x27'),_0x212719);logger[_0xf686('0x14')](_0xf686('0x27'),_0x212719,JSON[_0xf686('0x15')](_0x5a869b));_0x54b56b(_0x5a869b);})[_0xf686('0x1c')](function(_0x4ed40b){logger['error'](_0xf686('0x27'),_0x4ed40b[_0xf686('0x19')],_0x212719);_0x298a78(_0x4725c6[_0xf686('0x17')](0x1f4,_0x4ed40b['message']));});});}; \ No newline at end of file +var _0xdcab=['message','result','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetMailQueue','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x27dce3,_0x1bdcb3){var _0x456ff6=function(_0x334da6){while(--_0x334da6){_0x27dce3['push'](_0x27dce3['shift']());}};_0x456ff6(++_0x1bdcb3);}(_0xdcab,0x193));var _0xbdca=function(_0x23cb75,_0x3b22ef){_0x23cb75=_0x23cb75-0x0;var _0x4444f2=_0xdcab[_0x23cb75];return _0x4444f2;};'use strict';var _=require(_0xbdca('0x0'));var util=require(_0xbdca('0x1'));var moment=require(_0xbdca('0x2'));var BPromise=require(_0xbdca('0x3'));var rs=require(_0xbdca('0x4'));var fs=require('fs');var Redis=require(_0xbdca('0x5'));var db=require(_0xbdca('0x6'))['db'];var utils=require(_0xbdca('0x7'));var logger=require(_0xbdca('0x8'))('rpc');var config=require(_0xbdca('0x9'));var jayson=require(_0xbdca('0xa'));var client=jayson[_0xbdca('0xb')]['http']({'port':0x232a});config[_0xbdca('0xc')]=_[_0xbdca('0xd')](config[_0xbdca('0xc')],{'host':_0xbdca('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbdca('0xf'))[_0xbdca('0x10')](socket);function respondWithRpcPromise(_0x5f1f49,_0x2e865f,_0x5cb4d6){return new BPromise(function(_0x2b713a,_0x1795fa){return client[_0xbdca('0x11')](_0x5f1f49,_0x5cb4d6)[_0xbdca('0x12')](function(_0x35fadf){logger[_0xbdca('0x13')](_0xbdca('0x14'),_0x2e865f,_0xbdca('0x15'));logger[_0xbdca('0x16')](_0xbdca('0x17'),_0x2e865f,_0xbdca('0x15'),JSON[_0xbdca('0x18')](_0x35fadf));if(_0x35fadf[_0xbdca('0x19')]){if(_0x35fadf[_0xbdca('0x19')][_0xbdca('0x1a')]===0x1f4){logger[_0xbdca('0x19')](_0xbdca('0x14'),_0x2e865f,_0x35fadf[_0xbdca('0x19')][_0xbdca('0x1b')]);return _0x1795fa(_0x35fadf[_0xbdca('0x19')]['message']);}logger[_0xbdca('0x19')](_0xbdca('0x14'),_0x2e865f,_0x35fadf[_0xbdca('0x19')]['message']);return _0x2b713a(_0x35fadf[_0xbdca('0x19')]['message']);}else{logger['info'](_0xbdca('0x14'),_0x2e865f,_0xbdca('0x15'));_0x2b713a(_0x35fadf[_0xbdca('0x1c')][_0xbdca('0x1b')]);}})['catch'](function(_0x51923c){logger['error'](_0xbdca('0x14'),_0x2e865f,_0x51923c);_0x1795fa(_0x51923c);});});}exports['GetMailQueue']=function(_0x48e977){var _0xd1ed68=this;return new Promise(function(_0x51aaa1,_0x7081fd){return db[_0xbdca('0x1d')][_0xbdca('0x1e')]({'raw':_0x48e977[_0xbdca('0x1f')]?_0x48e977[_0xbdca('0x1f')][_0xbdca('0x20')]===undefined?!![]:![]:!![],'where':_0x48e977[_0xbdca('0x1f')]?_0x48e977[_0xbdca('0x1f')][_0xbdca('0x21')]||null:null,'attributes':_0x48e977[_0xbdca('0x1f')]?_0x48e977[_0xbdca('0x1f')][_0xbdca('0x22')]||null:null,'limit':_0x48e977[_0xbdca('0x1f')]?_0x48e977[_0xbdca('0x1f')][_0xbdca('0x23')]||null:null,'include':_0x48e977['options']?_0x48e977[_0xbdca('0x1f')][_0xbdca('0x24')]?_[_0xbdca('0x25')](_0x48e977['options']['include'],function(_0x481b77){return{'model':db[_0x481b77[_0xbdca('0x26')]],'as':_0x481b77['as'],'attributes':_0x481b77[_0xbdca('0x22')],'include':_0x481b77[_0xbdca('0x24')]?_[_0xbdca('0x25')](_0x481b77[_0xbdca('0x24')],function(_0x8428d4){return{'model':db[_0x8428d4[_0xbdca('0x26')]],'as':_0x8428d4['as'],'attributes':_0x8428d4[_0xbdca('0x22')],'include':_0x8428d4[_0xbdca('0x24')]?_['map'](_0x8428d4[_0xbdca('0x24')],function(_0x2e8c0b){return{'model':db[_0x2e8c0b['model']],'as':_0x2e8c0b['as'],'attributes':_0x2e8c0b[_0xbdca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbdca('0x12')](function(_0x2416dd){logger['info'](_0xbdca('0x27'),_0x48e977);logger[_0xbdca('0x16')](_0xbdca('0x27'),_0x48e977,JSON[_0xbdca('0x18')](_0x2416dd));_0x51aaa1(_0x2416dd);})[_0xbdca('0x28')](function(_0x1c2b6b){logger[_0xbdca('0x19')](_0xbdca('0x27'),_0x1c2b6b['message'],_0x48e977);_0x7081fd(_0xd1ed68['error'](0x1f4,_0x1c2b6b[_0xbdca('0x1b')]));});});};exports[_0xbdca('0x29')]=function(_0x44c8dd){var _0x29c6a4=this;return new Promise(function(_0x835f58,_0x5a0aac){return db['MailQueue'][_0xbdca('0x2a')]({'raw':_0x44c8dd[_0xbdca('0x1f')]?_0x44c8dd[_0xbdca('0x1f')][_0xbdca('0x20')]===undefined?!![]:![]:!![],'where':_0x44c8dd[_0xbdca('0x1f')]?_0x44c8dd['options'][_0xbdca('0x21')]||null:null,'attributes':_0x44c8dd[_0xbdca('0x1f')]?_0x44c8dd[_0xbdca('0x1f')][_0xbdca('0x22')]||null:null,'include':_0x44c8dd[_0xbdca('0x1f')]?_0x44c8dd[_0xbdca('0x1f')][_0xbdca('0x24')]?_[_0xbdca('0x25')](_0x44c8dd[_0xbdca('0x1f')][_0xbdca('0x24')],function(_0xdcfc35){return{'model':db[_0xdcfc35[_0xbdca('0x26')]],'as':_0xdcfc35['as'],'attributes':_0xdcfc35[_0xbdca('0x22')],'include':_0xdcfc35['include']?_[_0xbdca('0x25')](_0xdcfc35['include'],function(_0x10da99){return{'model':db[_0x10da99[_0xbdca('0x26')]],'as':_0x10da99['as'],'attributes':_0x10da99[_0xbdca('0x22')],'include':_0x10da99[_0xbdca('0x24')]?_[_0xbdca('0x25')](_0x10da99['include'],function(_0x315fa5){return{'model':db[_0x315fa5[_0xbdca('0x26')]],'as':_0x315fa5['as'],'attributes':_0x315fa5[_0xbdca('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a5ab1){logger['info'](_0xbdca('0x29'),_0x44c8dd);logger[_0xbdca('0x16')](_0xbdca('0x29'),_0x44c8dd,JSON[_0xbdca('0x18')](_0x2a5ab1));_0x835f58(_0x2a5ab1);})[_0xbdca('0x28')](function(_0x5dd719){logger['error'](_0xbdca('0x29'),_0x5dd719['message'],_0x44c8dd);_0x5a0aac(_0x29c6a4['error'](0x1f4,_0x5dd719[_0xbdca('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1024b74..5a5f866 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 _0x72bc=['removeListener','register','length','save','remove','update','emit'];(function(_0x4cd293,_0x268f10){var _0x52f94f=function(_0xf98100){while(--_0xf98100){_0x4cd293['push'](_0x4cd293['shift']());}};_0x52f94f(++_0x268f10);}(_0x72bc,0x1e6));var _0xc72b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x72bc[_0x15bc81];return _0x59440e;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xc72b('0x0'),_0xc72b('0x1'),_0xc72b('0x2')];function createListener(_0x3947b7,_0x24cfb5){return function(_0x3059d4){_0x24cfb5[_0xc72b('0x3')](_0x3947b7,_0x3059d4);};}function removeListener(_0x15af53,_0x4aa963){return function(){MailQueueEvents[_0xc72b('0x4')](_0x15af53,_0x4aa963);};}exports[_0xc72b('0x5')]=function(_0x162560){for(var _0x54548c=0x0,_0x7fa473=events[_0xc72b('0x6')];_0x54548c<_0x7fa473;_0x54548c++){var _0x3625dc=events[_0x54548c];var _0x1b8d19=createListener('mailQueue:'+_0x3625dc,_0x162560);MailQueueEvents['on'](_0x3625dc,_0x1b8d19);}}; \ No newline at end of file +var _0x6bed=['removeListener','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x3e718a,_0x2f6618){var _0x2fbe4d=function(_0x2622d1){while(--_0x2622d1){_0x3e718a['push'](_0x3e718a['shift']());}};_0x2fbe4d(++_0x2f6618);}(_0x6bed,0x11b));var _0xd6be=function(_0x2a4500,_0xaf8f08){_0x2a4500=_0x2a4500-0x0;var _0x24bb99=_0x6bed[_0x2a4500];return _0x24bb99;};'use strict';var MailQueueEvents=require(_0xd6be('0x0'));var events=[_0xd6be('0x1'),_0xd6be('0x2'),_0xd6be('0x3')];function createListener(_0x5899bf,_0xc5aaa0){return function(_0x573072){_0xc5aaa0[_0xd6be('0x4')](_0x5899bf,_0x573072);};}function removeListener(_0x430e87,_0xf1813b){return function(){MailQueueEvents[_0xd6be('0x5')](_0x430e87,_0xf1813b);};}exports['register']=function(_0x36b25a){for(var _0x46cefe=0x0,_0x51377a=events[_0xd6be('0x6')];_0x46cefe<_0x51377a;_0x46cefe++){var _0x596d1f=events[_0x46cefe];var _0xf070b6=createListener(_0xd6be('0x7')+_0x596d1f,_0x36b25a);MailQueueEvents['on'](_0x596d1f,_0xf070b6);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 14c84d1..63bf17d 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 _0x03de=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','destroy','multer'];(function(_0x3e43db,_0x4951ed){var _0x20c442=function(_0x32dfee){while(--_0x32dfee){_0x3e43db['push'](_0x3e43db['shift']());}};_0x20c442(++_0x4951ed);}(_0x03de,0x8b));var _0xe03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03de[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe03d('0x0'));var util=require(_0xe03d('0x1'));var path=require(_0xe03d('0x2'));var timeout=require(_0xe03d('0x3'));var express=require(_0xe03d('0x4'));var router=express[_0xe03d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe03d('0x6'));var config=require(_0xe03d('0x7'));var controller=require(_0xe03d('0x8'));router[_0xe03d('0x9')]('/',auth['isAuthenticated'](),controller[_0xe03d('0xa')]);router[_0xe03d('0x9')](_0xe03d('0xb'),auth[_0xe03d('0xc')](),controller[_0xe03d('0xd')]);router[_0xe03d('0x9')](_0xe03d('0xe'),auth[_0xe03d('0xc')](),controller[_0xe03d('0xf')]);router['post']('/',auth[_0xe03d('0xc')](),controller[_0xe03d('0x10')]);router[_0xe03d('0x11')](_0xe03d('0xe'),auth[_0xe03d('0xc')](),controller[_0xe03d('0x12')]);router['delete'](_0xe03d('0xe'),auth['isAuthenticated'](),controller[_0xe03d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5239=['post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2cad58,_0x62e7c1){var _0x49d0c4=function(_0x1dffe7){while(--_0x1dffe7){_0x2cad58['push'](_0x2cad58['shift']());}};_0x49d0c4(++_0x62e7c1);}(_0x5239,0x17b));var _0x9523=function(_0x5f1a50,_0x2c697e){_0x5f1a50=_0x5f1a50-0x0;var _0x3e78ba=_0x5239[_0x5f1a50];return _0x3e78ba;};'use strict';var multer=require(_0x9523('0x0'));var util=require(_0x9523('0x1'));var path=require(_0x9523('0x2'));var timeout=require(_0x9523('0x3'));var express=require(_0x9523('0x4'));var router=express[_0x9523('0x5')]();var auth=require(_0x9523('0x6'));var interaction=require(_0x9523('0x7'));var config=require(_0x9523('0x8'));var controller=require(_0x9523('0x9'));router[_0x9523('0xa')]('/',auth[_0x9523('0xb')](),controller[_0x9523('0xc')]);router[_0x9523('0xa')](_0x9523('0xd'),auth[_0x9523('0xb')](),controller[_0x9523('0xe')]);router[_0x9523('0xa')](_0x9523('0xf'),auth['isAuthenticated'](),controller[_0x9523('0x10')]);router[_0x9523('0x11')]('/',auth['isAuthenticated'](),controller[_0x9523('0x12')]);router['put'](_0x9523('0xf'),auth['isAuthenticated'](),controller[_0x9523('0x13')]);router[_0x9523('0x14')](_0x9523('0xf'),auth[_0x9523('0xb')](),controller['destroy']);module[_0x9523('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6a21b46..103b70f 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 _0x817a=['DATE','moment','exports','STRING'];(function(_0x2c0593,_0x34a1b1){var _0x26cfa7=function(_0x369fea){while(--_0x369fea){_0x2c0593['push'](_0x2c0593['shift']());}};_0x26cfa7(++_0x34a1b1);}(_0x817a,0x1d5));var _0xa817=function(_0x402170,_0x4a4cdd){_0x402170=_0x402170-0x0;var _0x35122f=_0x817a[_0x402170];return _0x35122f;};'use strict';var moment=require(_0xa817('0x0'));var Sequelize=require('sequelize');module[_0xa817('0x1')]={'uniqueid':{'type':Sequelize[_0xa817('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa817('0x2')]},'joinAt':{'type':Sequelize[_0xa817('0x3')]},'leaveAt':{'type':Sequelize[_0xa817('0x3')]},'acceptAt':{'type':Sequelize[_0xa817('0x3')]},'exitAt':{'type':Sequelize[_0xa817('0x3')]},'reason':{'type':Sequelize[_0xa817('0x2')]}}; \ No newline at end of file +var _0xa1b7=['DATE','moment','sequelize','exports','STRING'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xa1b7,0x6f));var _0x7a1b=function(_0x27039e,_0x3bdf2c){_0x27039e=_0x27039e-0x0;var _0x293568=_0xa1b7[_0x27039e];return _0x293568;};'use strict';var moment=require(_0x7a1b('0x0'));var Sequelize=require(_0x7a1b('0x1'));module[_0x7a1b('0x2')]={'uniqueid':{'type':Sequelize[_0x7a1b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7a1b('0x4')]},'leaveAt':{'type':Sequelize[_0x7a1b('0x4')]},'acceptAt':{'type':Sequelize[_0x7a1b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7a1b('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 210c5cf..3a2e13a 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 _0x8aaa=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','MailQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','limit','offset','order','sort','filter','where','merge','type','key','VIRTUAL','options','include','findAll','catch','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x539e85,_0x490d2f){var _0x2fb3fa=function(_0x46bddc){while(--_0x46bddc){_0x539e85['push'](_0x539e85['shift']());}};_0x2fb3fa(++_0x490d2f);}(_0x8aaa,0x19f));var _0xa8aa=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0x8aaa[_0x19f5fc];return _0x315fa3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa8aa('0x0'));var rimraf=require(_0xa8aa('0x1'));var zipdir=require(_0xa8aa('0x2'));var jsonpatch=require(_0xa8aa('0x3'));var rp=require(_0xa8aa('0x4'));var moment=require(_0xa8aa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8aa('0x6'));var path=require(_0xa8aa('0x7'));var sox=require(_0xa8aa('0x8'));var csv=require(_0xa8aa('0x9'));var ejs=require(_0xa8aa('0xa'));var fs=require('fs');var _=require(_0xa8aa('0xb'));var squel=require(_0xa8aa('0xc'));var crypto=require(_0xa8aa('0xd'));var jsforce=require(_0xa8aa('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa8aa('0xf'));var Papa=require(_0xa8aa('0x10'));var Redis=require(_0xa8aa('0x11'));var authService=require(_0xa8aa('0x12'));var qs=require(_0xa8aa('0x13'));var hardwareService=require(_0xa8aa('0x14'));var logger=require(_0xa8aa('0x15'))(_0xa8aa('0x16'));var utils=require(_0xa8aa('0x17'));var config=require(_0xa8aa('0x18'));var db=require(_0xa8aa('0x19'))['db'];function respondWithStatusCode(_0xe157f9,_0x42ddc1){_0x42ddc1=_0x42ddc1||0xcc;return function(_0x225ad1){if(_0x225ad1){return _0xe157f9['sendStatus'](_0x42ddc1);}return _0xe157f9['status'](_0x42ddc1)['end']();};}function respondWithResult(_0x41732d,_0x36d4d6){_0x36d4d6=_0x36d4d6||0xc8;return function(_0x21bb30){if(_0x21bb30){return _0x41732d[_0xa8aa('0x1a')](_0x36d4d6)[_0xa8aa('0x1b')](_0x21bb30);}};}function respondWithFilteredResult(_0x95ca48,_0x51da70){return function(_0x5b3183){if(_0x5b3183){var _0x3dd6dd=_0x5b3183[_0xa8aa('0x1c')],_0x3a67bc=_0x51da70['offset'],_0x22474c=_0x51da70['offset']+_0x51da70['limit'],_0x182bc3;if(_0x22474c>=_0x3dd6dd){_0x22474c=_0x3dd6dd;_0x182bc3=0xc8;}else{_0x182bc3=0xce;}_0x95ca48[_0xa8aa('0x1a')](_0x182bc3);return _0x95ca48[_0xa8aa('0x1d')](_0xa8aa('0x1e'),_0x3a67bc+'-'+_0x22474c+'/'+_0x3dd6dd)[_0xa8aa('0x1b')](_0x5b3183);}return null;};}function patchUpdates(_0x6b16f2){return function(_0x2aa770){try{jsonpatch[_0xa8aa('0x1f')](_0x2aa770,_0x6b16f2,!![]);}catch(_0x23a505){return BPromise[_0xa8aa('0x20')](_0x23a505);}return _0x2aa770['save']();};}function saveUpdates(_0x112f3a,_0x210800){return function(_0x427a90){if(_0x427a90){return _0x427a90[_0xa8aa('0x21')](_0x112f3a)[_0xa8aa('0x22')](function(_0x57380b){return _0x57380b;});}return null;};}function removeEntity(_0x448964,_0x63333b){return function(_0x18fded){if(_0x18fded){return _0x18fded[_0xa8aa('0x23')]()[_0xa8aa('0x22')](function(){_0x448964[_0xa8aa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd9ae,_0x597a77){return function(_0x45ec1d){if(!_0x45ec1d){_0x2bd9ae[_0xa8aa('0x24')](0x194);}return _0x45ec1d;};}function handleError(_0x14b9a5,_0x1f1f91){_0x1f1f91=_0x1f1f91||0x1f4;return function(_0x48710d){logger[_0xa8aa('0x25')](_0x48710d[_0xa8aa('0x26')]);if(_0x48710d[_0xa8aa('0x27')]){delete _0x48710d['name'];}_0x14b9a5[_0xa8aa('0x1a')](_0x1f1f91)[_0xa8aa('0x28')](_0x48710d);};}exports[_0xa8aa('0x29')]=function(_0x1fab8b,_0x5af90f){var _0x38282a={},_0x3de8ca={},_0x56f78c={'count':0x0,'rows':[]};var _0x2d5f8e=db[_0xa8aa('0x2a')][_0xa8aa('0x2b')];_0x3de8ca[_0xa8aa('0x2c')]=_[_0xa8aa('0x2d')](_0x2d5f8e);_0x3de8ca[_0xa8aa('0x2e')]=_['keys'](_0x1fab8b[_0xa8aa('0x2e')]);_0x3de8ca[_0xa8aa('0x2f')]=_[_0xa8aa('0x30')](_0x3de8ca['model'],_0x3de8ca['query']);_0x38282a[_0xa8aa('0x31')]=_['intersection'](_0x3de8ca[_0xa8aa('0x2c')],qs['fields'](_0x1fab8b[_0xa8aa('0x2e')]['fields']));_0x38282a[_0xa8aa('0x31')]=_0x38282a[_0xa8aa('0x31')][_0xa8aa('0x32')]?_0x38282a[_0xa8aa('0x31')]:_0x3de8ca['model'];if(!_0x1fab8b[_0xa8aa('0x2e')][_0xa8aa('0x33')]('nolimit')){_0x38282a[_0xa8aa('0x34')]=qs[_0xa8aa('0x34')](_0x1fab8b[_0xa8aa('0x2e')]['limit']);_0x38282a['offset']=qs[_0xa8aa('0x35')](_0x1fab8b[_0xa8aa('0x2e')][_0xa8aa('0x35')]);}_0x38282a[_0xa8aa('0x36')]=qs['sort'](_0x1fab8b[_0xa8aa('0x2e')][_0xa8aa('0x37')]);_0x38282a['where']=qs['filters'](_['pick'](_0x1fab8b[_0xa8aa('0x2e')],_0x3de8ca[_0xa8aa('0x2f')]));if(_0x1fab8b[_0xa8aa('0x2e')][_0xa8aa('0x38')]){_0x38282a[_0xa8aa('0x39')]=_[_0xa8aa('0x3a')](_0x38282a['where'],{'$or':_['map'](_0x2d5f8e,function(_0x298bc4){if(_0x298bc4[_0xa8aa('0x3b')][_0xa8aa('0x3c')]!==_0xa8aa('0x3d')){var _0x47f74d={};_0x47f74d[_0x298bc4['field']]={'$like':'%'+_0x1fab8b[_0xa8aa('0x2e')][_0xa8aa('0x38')]+'%'};return _0x47f74d;}})});}_0x38282a=_['merge']({},_0x38282a,_0x1fab8b[_0xa8aa('0x3e')]);var _0x2abce5={'where':_0x38282a[_0xa8aa('0x39')]};return db[_0xa8aa('0x2a')][_0xa8aa('0x1c')](_0x2abce5)[_0xa8aa('0x22')](function(_0x4d3b15){_0x56f78c[_0xa8aa('0x1c')]=_0x4d3b15;if(_0x1fab8b[_0xa8aa('0x2e')]['includeAll']){_0x38282a[_0xa8aa('0x3f')]=[{'all':!![]}];}return db[_0xa8aa('0x2a')][_0xa8aa('0x40')](_0x38282a);})['then'](function(_0x2ce2c7){_0x56f78c['rows']=_0x2ce2c7;return _0x56f78c;})[_0xa8aa('0x22')](respondWithFilteredResult(_0x5af90f,_0x38282a))[_0xa8aa('0x41')](handleError(_0x5af90f,null));};exports['show']=function(_0x54afb8,_0x576d23){var _0x5a8721={'raw':!![],'where':{'id':_0x54afb8[_0xa8aa('0x42')]['id']}},_0x3632a3={};_0x3632a3['model']=_[_0xa8aa('0x2d')](db[_0xa8aa('0x2a')][_0xa8aa('0x2b')]);_0x3632a3[_0xa8aa('0x2e')]=_[_0xa8aa('0x2d')](_0x54afb8[_0xa8aa('0x2e')]);_0x3632a3['filters']=_[_0xa8aa('0x30')](_0x3632a3[_0xa8aa('0x2c')],_0x3632a3[_0xa8aa('0x2e')]);_0x5a8721['attributes']=_[_0xa8aa('0x30')](_0x3632a3[_0xa8aa('0x2c')],qs[_0xa8aa('0x43')](_0x54afb8['query'][_0xa8aa('0x43')]));_0x5a8721[_0xa8aa('0x31')]=_0x5a8721[_0xa8aa('0x31')][_0xa8aa('0x32')]?_0x5a8721[_0xa8aa('0x31')]:_0x3632a3[_0xa8aa('0x2c')];if(_0x54afb8['query']['includeAll']){_0x5a8721['include']=[{'all':!![]}];}_0x5a8721=_[_0xa8aa('0x3a')]({},_0x5a8721,_0x54afb8['options']);return db['MailQueueReport'][_0xa8aa('0x44')](_0x5a8721)[_0xa8aa('0x22')](handleEntityNotFound(_0x576d23,null))[_0xa8aa('0x22')](respondWithResult(_0x576d23,null))[_0xa8aa('0x41')](handleError(_0x576d23,null));};exports[_0xa8aa('0x45')]=function(_0x13e805,_0x214892){return db['MailQueueReport'][_0xa8aa('0x45')](_0x13e805[_0xa8aa('0x46')],{})['then'](respondWithResult(_0x214892,0xc9))[_0xa8aa('0x41')](handleError(_0x214892,null));};exports['update']=function(_0x1d7056,_0x29ca62){if(_0x1d7056['body']['id']){delete _0x1d7056[_0xa8aa('0x46')]['id'];}return db[_0xa8aa('0x2a')][_0xa8aa('0x44')]({'where':{'id':_0x1d7056[_0xa8aa('0x42')]['id']}})[_0xa8aa('0x22')](handleEntityNotFound(_0x29ca62,null))[_0xa8aa('0x22')](saveUpdates(_0x1d7056[_0xa8aa('0x46')],null))['then'](respondWithResult(_0x29ca62,null))[_0xa8aa('0x41')](handleError(_0x29ca62,null));};exports[_0xa8aa('0x23')]=function(_0x3765b3,_0x5c44a2){return db[_0xa8aa('0x2a')]['find']({'where':{'id':_0x3765b3[_0xa8aa('0x42')]['id']}})[_0xa8aa('0x22')](handleEntityNotFound(_0x5c44a2,null))[_0xa8aa('0x22')](removeEntity(_0x5c44a2,null))[_0xa8aa('0x41')](handleError(_0x5c44a2,null));};exports[_0xa8aa('0x47')]=function(_0x61f3eb,_0x178333){return db[_0xa8aa('0x2a')][_0xa8aa('0x47')]()[_0xa8aa('0x22')](respondWithResult(_0x178333,null))['catch'](handleError(_0x178333,null));}; \ No newline at end of file +var _0xf37f=['filter','merge','map','type','key','field','options','MailQueueReport','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x4f144d,_0x154950){var _0x318423=function(_0xa86b01){while(--_0xa86b01){_0x4f144d['push'](_0x4f144d['shift']());}};_0x318423(++_0x154950);}(_0xf37f,0xee));var _0xff37=function(_0xb4bd53,_0x2a6033){_0xb4bd53=_0xb4bd53-0x0;var _0x3c2969=_0xf37f[_0xb4bd53];return _0x3c2969;};'use strict';var pdf=require(_0xff37('0x0'));var emlformat=require(_0xff37('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xff37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff37('0x3'));var moment=require(_0xff37('0x4'));var BPromise=require(_0xff37('0x5'));var Mustache=require(_0xff37('0x6'));var util=require(_0xff37('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff37('0x8'));var fs=require('fs');var _=require(_0xff37('0x9'));var squel=require(_0xff37('0xa'));var crypto=require(_0xff37('0xb'));var jsforce=require(_0xff37('0xc'));var deskjs=require(_0xff37('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff37('0xe'));var Papa=require('papaparse');var Redis=require(_0xff37('0xf'));var authService=require(_0xff37('0x10'));var qs=require(_0xff37('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff37('0x12'))('api');var utils=require(_0xff37('0x13'));var config=require(_0xff37('0x14'));var db=require(_0xff37('0x15'))['db'];function respondWithStatusCode(_0x436a5b,_0x5cef56){_0x5cef56=_0x5cef56||0xcc;return function(_0x13dc93){if(_0x13dc93){return _0x436a5b[_0xff37('0x16')](_0x5cef56);}return _0x436a5b[_0xff37('0x17')](_0x5cef56)[_0xff37('0x18')]();};}function respondWithResult(_0x54f5f2,_0x205f79){_0x205f79=_0x205f79||0xc8;return function(_0x1f7b27){if(_0x1f7b27){return _0x54f5f2[_0xff37('0x17')](_0x205f79)['json'](_0x1f7b27);}};}function respondWithFilteredResult(_0x3a46c2,_0x1c1921){return function(_0x42782f){if(_0x42782f){var _0x3464d8=_0x42782f[_0xff37('0x19')],_0x534c5d=_0x1c1921[_0xff37('0x1a')],_0x506b29=_0x1c1921[_0xff37('0x1a')]+_0x1c1921[_0xff37('0x1b')],_0x2555e9;if(_0x506b29>=_0x3464d8){_0x506b29=_0x3464d8;_0x2555e9=0xc8;}else{_0x2555e9=0xce;}_0x3a46c2['status'](_0x2555e9);return _0x3a46c2[_0xff37('0x1c')](_0xff37('0x1d'),_0x534c5d+'-'+_0x506b29+'/'+_0x3464d8)[_0xff37('0x1e')](_0x42782f);}return null;};}function patchUpdates(_0x41b819){return function(_0x1d370e){try{jsonpatch['apply'](_0x1d370e,_0x41b819,!![]);}catch(_0x4ea7ac){return BPromise['reject'](_0x4ea7ac);}return _0x1d370e[_0xff37('0x1f')]();};}function saveUpdates(_0x1fdb9b,_0x31e1d1){return function(_0x368f46){if(_0x368f46){return _0x368f46[_0xff37('0x20')](_0x1fdb9b)[_0xff37('0x21')](function(_0x2b0876){return _0x2b0876;});}return null;};}function removeEntity(_0x244416,_0x4efe21){return function(_0xfddff3){if(_0xfddff3){return _0xfddff3[_0xff37('0x22')]()[_0xff37('0x21')](function(){_0x244416[_0xff37('0x17')](0xcc)[_0xff37('0x18')]();});}};}function handleEntityNotFound(_0x83da0b,_0x1a1912){return function(_0x58482d){if(!_0x58482d){_0x83da0b['sendStatus'](0x194);}return _0x58482d;};}function handleError(_0x3da1a3,_0x35129b){_0x35129b=_0x35129b||0x1f4;return function(_0x3bfe90){logger[_0xff37('0x23')](_0x3bfe90[_0xff37('0x24')]);if(_0x3bfe90[_0xff37('0x25')]){delete _0x3bfe90[_0xff37('0x25')];}_0x3da1a3['status'](_0x35129b)[_0xff37('0x26')](_0x3bfe90);};}exports[_0xff37('0x27')]=function(_0x4c8852,_0x46c329){var _0x21e3c3={},_0x273cfb={},_0x29cd5a={'count':0x0,'rows':[]};var _0x278973=db['MailQueueReport'][_0xff37('0x28')];_0x273cfb[_0xff37('0x29')]=_[_0xff37('0x2a')](_0x278973);_0x273cfb[_0xff37('0x2b')]=_[_0xff37('0x2a')](_0x4c8852[_0xff37('0x2b')]);_0x273cfb[_0xff37('0x2c')]=_[_0xff37('0x2d')](_0x273cfb[_0xff37('0x29')],_0x273cfb[_0xff37('0x2b')]);_0x21e3c3['attributes']=_['intersection'](_0x273cfb['model'],qs[_0xff37('0x2e')](_0x4c8852[_0xff37('0x2b')][_0xff37('0x2e')]));_0x21e3c3[_0xff37('0x2f')]=_0x21e3c3[_0xff37('0x2f')][_0xff37('0x30')]?_0x21e3c3[_0xff37('0x2f')]:_0x273cfb[_0xff37('0x29')];if(!_0x4c8852[_0xff37('0x2b')][_0xff37('0x31')](_0xff37('0x32'))){_0x21e3c3['limit']=qs[_0xff37('0x1b')](_0x4c8852[_0xff37('0x2b')][_0xff37('0x1b')]);_0x21e3c3[_0xff37('0x1a')]=qs['offset'](_0x4c8852[_0xff37('0x2b')][_0xff37('0x1a')]);}_0x21e3c3['order']=qs[_0xff37('0x33')](_0x4c8852[_0xff37('0x2b')][_0xff37('0x33')]);_0x21e3c3[_0xff37('0x34')]=qs[_0xff37('0x2c')](_[_0xff37('0x35')](_0x4c8852[_0xff37('0x2b')],_0x273cfb['filters']));if(_0x4c8852[_0xff37('0x2b')][_0xff37('0x36')]){_0x21e3c3[_0xff37('0x34')]=_[_0xff37('0x37')](_0x21e3c3[_0xff37('0x34')],{'$or':_[_0xff37('0x38')](_0x278973,function(_0x2a0671){if(_0x2a0671[_0xff37('0x39')][_0xff37('0x3a')]!=='VIRTUAL'){var _0x337162={};_0x337162[_0x2a0671[_0xff37('0x3b')]]={'$like':'%'+_0x4c8852[_0xff37('0x2b')]['filter']+'%'};return _0x337162;}})});}_0x21e3c3=_[_0xff37('0x37')]({},_0x21e3c3,_0x4c8852[_0xff37('0x3c')]);var _0x19e72c={'where':_0x21e3c3['where']};return db[_0xff37('0x3d')]['count'](_0x19e72c)[_0xff37('0x21')](function(_0x38372f){_0x29cd5a[_0xff37('0x19')]=_0x38372f;if(_0x4c8852[_0xff37('0x2b')][_0xff37('0x3e')]){_0x21e3c3[_0xff37('0x3f')]=[{'all':!![]}];}return db[_0xff37('0x3d')][_0xff37('0x40')](_0x21e3c3);})[_0xff37('0x21')](function(_0x5dceed){_0x29cd5a[_0xff37('0x41')]=_0x5dceed;return _0x29cd5a;})[_0xff37('0x21')](respondWithFilteredResult(_0x46c329,_0x21e3c3))['catch'](handleError(_0x46c329,null));};exports[_0xff37('0x42')]=function(_0x25ca3e,_0x30dd5a){var _0x460261={'raw':!![],'where':{'id':_0x25ca3e['params']['id']}},_0x28dd79={};_0x28dd79[_0xff37('0x29')]=_[_0xff37('0x2a')](db[_0xff37('0x3d')]['rawAttributes']);_0x28dd79[_0xff37('0x2b')]=_[_0xff37('0x2a')](_0x25ca3e[_0xff37('0x2b')]);_0x28dd79[_0xff37('0x2c')]=_[_0xff37('0x2d')](_0x28dd79['model'],_0x28dd79[_0xff37('0x2b')]);_0x460261['attributes']=_[_0xff37('0x2d')](_0x28dd79[_0xff37('0x29')],qs[_0xff37('0x2e')](_0x25ca3e[_0xff37('0x2b')][_0xff37('0x2e')]));_0x460261[_0xff37('0x2f')]=_0x460261[_0xff37('0x2f')][_0xff37('0x30')]?_0x460261[_0xff37('0x2f')]:_0x28dd79[_0xff37('0x29')];if(_0x25ca3e['query'][_0xff37('0x3e')]){_0x460261[_0xff37('0x3f')]=[{'all':!![]}];}_0x460261=_[_0xff37('0x37')]({},_0x460261,_0x25ca3e[_0xff37('0x3c')]);return db[_0xff37('0x3d')][_0xff37('0x43')](_0x460261)[_0xff37('0x21')](handleEntityNotFound(_0x30dd5a,null))[_0xff37('0x21')](respondWithResult(_0x30dd5a,null))[_0xff37('0x44')](handleError(_0x30dd5a,null));};exports['create']=function(_0x35e7fb,_0x2d0094){return db['MailQueueReport'][_0xff37('0x45')](_0x35e7fb['body'],{})[_0xff37('0x21')](respondWithResult(_0x2d0094,0xc9))[_0xff37('0x44')](handleError(_0x2d0094,null));};exports[_0xff37('0x20')]=function(_0x3fe398,_0x100925){if(_0x3fe398[_0xff37('0x46')]['id']){delete _0x3fe398[_0xff37('0x46')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x3fe398[_0xff37('0x47')]['id']}})[_0xff37('0x21')](handleEntityNotFound(_0x100925,null))[_0xff37('0x21')](saveUpdates(_0x3fe398['body'],null))[_0xff37('0x21')](respondWithResult(_0x100925,null))[_0xff37('0x44')](handleError(_0x100925,null));};exports[_0xff37('0x22')]=function(_0x40d3fe,_0x4dcbbe){return db[_0xff37('0x3d')][_0xff37('0x43')]({'where':{'id':_0x40d3fe[_0xff37('0x47')]['id']}})[_0xff37('0x21')](handleEntityNotFound(_0x4dcbbe,null))[_0xff37('0x21')](removeEntity(_0x4dcbbe,null))[_0xff37('0x44')](handleError(_0x4dcbbe,null));};exports['describe']=function(_0x1aa5e7,_0x25d8c9){return db['MailQueueReport'][_0xff37('0x48')]()[_0xff37('0x21')](respondWithResult(_0x25d8c9,null))[_0xff37('0x44')](handleError(_0x25d8c9,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index edc9762..4e5be4f 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 _0x9147=['report_mail_queue','uniqueid','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define'];(function(_0x579ecb,_0x48a5a9){var _0x43e9f8=function(_0x39f887){while(--_0x39f887){_0x579ecb['push'](_0x579ecb['shift']());}};_0x43e9f8(++_0x48a5a9);}(_0x9147,0x7b));var _0x7914=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9147[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var logger=require('../../config/logger')(_0x7914('0x2'));var moment=require('moment');var BPromise=require(_0x7914('0x3'));var rp=require(_0x7914('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7914('0x5'));var config=require(_0x7914('0x6'));var attributes=require(_0x7914('0x7'));module['exports']=function(_0x34c372,_0x4dd321){return _0x34c372[_0x7914('0x8')]('MailQueueReport',attributes,{'tableName':_0x7914('0x9'),'paranoid':![],'indexes':[{'name':_0x7914('0xa'),'fields':[_0x7914('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c2c=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','MailQueueReport'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x3c2c,0x160));var _0xc3c2=function(_0x38fc71,_0x1f37a1){_0x38fc71=_0x38fc71-0x0;var _0x121eb6=_0x3c2c[_0x38fc71];return _0x121eb6;};'use strict';var _=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var logger=require(_0xc3c2('0x2'))(_0xc3c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3c2('0x4'));var fs=require('fs');var path=require(_0xc3c2('0x5'));var rimraf=require(_0xc3c2('0x6'));var config=require(_0xc3c2('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xc3c2('0x8')]=function(_0x158a5f,_0x234da9){return _0x158a5f[_0xc3c2('0x9')](_0xc3c2('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','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 34a29cd..090db99 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 _0x5b6c=['message','CreateMailQueueReport','MailQueueReport','create','body','options','raw','debug','stringify','catch','update','where','attributes','limit','UpdateMailQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x39acf8,_0x158e5a){var _0x378ac3=function(_0x2f00e0){while(--_0x2f00e0){_0x39acf8['push'](_0x39acf8['shift']());}};_0x378ac3(++_0x158e5a);}(_0x5b6c,0x141));var _0xc5b6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x5b6c[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0xc5b6('0x0'));var moment=require(_0xc5b6('0x1'));var BPromise=require('bluebird');var rs=require(_0xc5b6('0x2'));var fs=require('fs');var Redis=require(_0xc5b6('0x3'));var db=require(_0xc5b6('0x4'))['db'];var utils=require(_0xc5b6('0x5'));var logger=require(_0xc5b6('0x6'))(_0xc5b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5b6('0x8'));var client=jayson[_0xc5b6('0x9')][_0xc5b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x94caa5,_0x3b0bed,_0x625bfa){return new BPromise(function(_0x26a34e,_0x18b08e){return client[_0xc5b6('0xb')](_0x94caa5,_0x625bfa)[_0xc5b6('0xc')](function(_0x599907){logger[_0xc5b6('0xd')](_0xc5b6('0xe'),_0x3b0bed,_0xc5b6('0xf'));logger['debug'](_0xc5b6('0x10'),_0x3b0bed,_0xc5b6('0xf'),JSON['stringify'](_0x599907));if(_0x599907[_0xc5b6('0x11')]){if(_0x599907[_0xc5b6('0x11')][_0xc5b6('0x12')]===0x1f4){logger[_0xc5b6('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x3b0bed,_0x599907['error'][_0xc5b6('0x13')]);return _0x18b08e(_0x599907[_0xc5b6('0x11')][_0xc5b6('0x13')]);}logger[_0xc5b6('0x11')](_0xc5b6('0xe'),_0x3b0bed,_0x599907[_0xc5b6('0x11')][_0xc5b6('0x13')]);return _0x26a34e(_0x599907[_0xc5b6('0x11')][_0xc5b6('0x13')]);}else{logger[_0xc5b6('0xd')](_0xc5b6('0xe'),_0x3b0bed,_0xc5b6('0xf'));_0x26a34e(_0x599907['result']['message']);}})['catch'](function(_0x95f4e0){logger[_0xc5b6('0x11')](_0xc5b6('0xe'),_0x3b0bed,_0x95f4e0);_0x18b08e(_0x95f4e0);});});}exports[_0xc5b6('0x14')]=function(_0x691969){var _0x451978=this;return new Promise(function(_0x2ff8a1,_0x57ab55){return db[_0xc5b6('0x15')][_0xc5b6('0x16')](_0x691969[_0xc5b6('0x17')],{'raw':_0x691969[_0xc5b6('0x18')]?_0x691969[_0xc5b6('0x18')][_0xc5b6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x115a0f){logger[_0xc5b6('0xd')](_0xc5b6('0x14'),_0x691969);logger[_0xc5b6('0x1a')](_0xc5b6('0x14'),_0x691969,JSON[_0xc5b6('0x1b')](_0x115a0f));_0x2ff8a1(_0x115a0f);})[_0xc5b6('0x1c')](function(_0x56d547){logger[_0xc5b6('0x11')](_0xc5b6('0x14'),_0x56d547['message'],_0x691969);_0x57ab55(_0x451978[_0xc5b6('0x11')](0x1f4,_0x56d547[_0xc5b6('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x94fee2){var _0x2bad89=this;return new Promise(function(_0x30e828,_0x58bda5){return db[_0xc5b6('0x15')][_0xc5b6('0x1d')](_0x94fee2['body'],{'raw':_0x94fee2[_0xc5b6('0x18')]?_0x94fee2[_0xc5b6('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x94fee2['options']?_0x94fee2[_0xc5b6('0x18')][_0xc5b6('0x1e')]||null:null,'attributes':_0x94fee2[_0xc5b6('0x18')]?_0x94fee2[_0xc5b6('0x18')][_0xc5b6('0x1f')]||null:null,'limit':_0x94fee2[_0xc5b6('0x18')]?_0x94fee2['options'][_0xc5b6('0x20')]||null:null})[_0xc5b6('0xc')](function(_0x3ee207){logger[_0xc5b6('0xd')](_0xc5b6('0x21'),_0x94fee2);logger['debug'](_0xc5b6('0x21'),_0x94fee2,JSON[_0xc5b6('0x1b')](_0x3ee207));_0x30e828(_0x3ee207);})['catch'](function(_0x3b5cf9){logger['error']('UpdateMailQueueReport',_0x3b5cf9['message'],_0x94fee2);_0x58bda5(_0x2bad89['error'](0x1f4,_0x3b5cf9[_0xc5b6('0x13')]));});});}; \ No newline at end of file +var _0xbb8d=['stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','options','raw','debug','catch','UpdateMailQueueReport','update','body','where','attributes','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0xdfcfd1,_0x1ec03b){var _0x4e8035=function(_0x18d1c9){while(--_0x18d1c9){_0xdfcfd1['push'](_0xdfcfd1['shift']());}};_0x4e8035(++_0x1ec03b);}(_0xbb8d,0xf1));var _0xdbb8=function(_0x3c6106,_0x1ca4e9){_0x3c6106=_0x3c6106-0x0;var _0x23f6eb=_0xbb8d[_0x3c6106];return _0x23f6eb;};'use strict';var _=require(_0xdbb8('0x0'));var util=require(_0xdbb8('0x1'));var moment=require(_0xdbb8('0x2'));var BPromise=require(_0xdbb8('0x3'));var rs=require(_0xdbb8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbb8('0x5'));var logger=require(_0xdbb8('0x6'))(_0xdbb8('0x7'));var config=require(_0xdbb8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdbb8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18a14a,_0x1d561a,_0x350e85){return new BPromise(function(_0x33abf4,_0x4d8def){return client[_0xdbb8('0xa')](_0x18a14a,_0x350e85)['then'](function(_0x6257c0){logger[_0xdbb8('0xb')](_0xdbb8('0xc'),_0x1d561a,_0xdbb8('0xd'));logger['debug'](_0xdbb8('0xe'),_0x1d561a,_0xdbb8('0xd'),JSON[_0xdbb8('0xf')](_0x6257c0));if(_0x6257c0[_0xdbb8('0x10')]){if(_0x6257c0['error'][_0xdbb8('0x11')]===0x1f4){logger[_0xdbb8('0x10')](_0xdbb8('0xc'),_0x1d561a,_0x6257c0[_0xdbb8('0x10')][_0xdbb8('0x12')]);return _0x4d8def(_0x6257c0[_0xdbb8('0x10')][_0xdbb8('0x12')]);}logger[_0xdbb8('0x10')](_0xdbb8('0xc'),_0x1d561a,_0x6257c0['error'][_0xdbb8('0x12')]);return _0x33abf4(_0x6257c0[_0xdbb8('0x10')][_0xdbb8('0x12')]);}else{logger[_0xdbb8('0xb')](_0xdbb8('0xc'),_0x1d561a,_0xdbb8('0xd'));_0x33abf4(_0x6257c0[_0xdbb8('0x13')][_0xdbb8('0x12')]);}})['catch'](function(_0x50dfb2){logger[_0xdbb8('0x10')](_0xdbb8('0xc'),_0x1d561a,_0x50dfb2);_0x4d8def(_0x50dfb2);});});}exports[_0xdbb8('0x14')]=function(_0x1cb383){var _0x3cfc2e=this;return new Promise(function(_0x1b6804,_0x56bf08){return db[_0xdbb8('0x15')]['create'](_0x1cb383['body'],{'raw':_0x1cb383[_0xdbb8('0x16')]?_0x1cb383[_0xdbb8('0x16')][_0xdbb8('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x299632){logger['info'](_0xdbb8('0x14'),_0x1cb383);logger[_0xdbb8('0x18')](_0xdbb8('0x14'),_0x1cb383,JSON['stringify'](_0x299632));_0x1b6804(_0x299632);})[_0xdbb8('0x19')](function(_0x1ae3f9){logger['error']('CreateMailQueueReport',_0x1ae3f9[_0xdbb8('0x12')],_0x1cb383);_0x56bf08(_0x3cfc2e[_0xdbb8('0x10')](0x1f4,_0x1ae3f9['message']));});});};exports[_0xdbb8('0x1a')]=function(_0x92dd9f){var _0x29ad23=this;return new Promise(function(_0x3c1315,_0x1f79fd){return db[_0xdbb8('0x15')][_0xdbb8('0x1b')](_0x92dd9f[_0xdbb8('0x1c')],{'raw':_0x92dd9f[_0xdbb8('0x16')]?_0x92dd9f[_0xdbb8('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x92dd9f[_0xdbb8('0x16')]?_0x92dd9f[_0xdbb8('0x16')][_0xdbb8('0x1d')]||null:null,'attributes':_0x92dd9f['options']?_0x92dd9f[_0xdbb8('0x16')][_0xdbb8('0x1e')]||null:null,'limit':_0x92dd9f[_0xdbb8('0x16')]?_0x92dd9f[_0xdbb8('0x16')]['limit']||null:null})[_0xdbb8('0x1f')](function(_0x34618c){logger[_0xdbb8('0xb')]('UpdateMailQueueReport',_0x92dd9f);logger[_0xdbb8('0x18')](_0xdbb8('0x1a'),_0x92dd9f,JSON[_0xdbb8('0xf')](_0x34618c));_0x3c1315(_0x34618c);})[_0xdbb8('0x19')](function(_0x4a803a){logger[_0xdbb8('0x10')](_0xdbb8('0x1a'),_0x4a803a[_0xdbb8('0x12')],_0x92dd9f);_0x1f79fd(_0x29ad23[_0xdbb8('0x10')](0x1f4,_0x4a803a[_0xdbb8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7e902a1..a3d3be5 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 _0xfdcd=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x180ac2,_0x219d65){var _0xfcaede=function(_0x728ebe){while(--_0x728ebe){_0x180ac2['push'](_0x180ac2['shift']());}};_0xfcaede(++_0x219d65);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xdfdc('0x0'));var path=require(_0xdfdc('0x1'));var timeout=require(_0xdfdc('0x2'));var express=require('express');var router=express[_0xdfdc('0x3')]();var auth=require(_0xdfdc('0x4'));var interaction=require(_0xdfdc('0x5'));var config=require(_0xdfdc('0x6'));module[_0xdfdc('0x7')]=router; \ No newline at end of file +var _0x7c1f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x3255bc,_0x9b886a){var _0x4d8a50=function(_0x46bcc1){while(--_0x46bcc1){_0x3255bc['push'](_0x3255bc['shift']());}};_0x4d8a50(++_0x9b886a);}(_0x7c1f,0x194));var _0xf7c1=function(_0xe1b5e2,_0x17ab19){_0xe1b5e2=_0xe1b5e2-0x0;var _0x1f0dfc=_0x7c1f[_0xe1b5e2];return _0x1f0dfc;};'use strict';var multer=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var path=require(_0xf7c1('0x2'));var timeout=require(_0xf7c1('0x3'));var express=require(_0xf7c1('0x4'));var router=express['Router']();var auth=require(_0xf7c1('0x5'));var interaction=require(_0xf7c1('0x6'));var config=require(_0xf7c1('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 35a0c57..a15fa5d 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 _0x2547=['STRING','BOOLEAN','username','INTEGER','INBOX','exports'];(function(_0x657251,_0x36c07a){var _0x2604fa=function(_0x5f16a7){while(--_0x5f16a7){_0x657251['push'](_0x657251['shift']());}};_0x2604fa(++_0x36c07a);}(_0x2547,0x1cd));var _0x7254=function(_0x13241f,_0x25777a){_0x13241f=_0x13241f-0x0;var _0x201766=_0x2547[_0x13241f];return _0x201766;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'description':{'type':Sequelize[_0x7254('0x1')]},'host':{'type':Sequelize[_0x7254('0x1')]},'authentication':{'type':Sequelize[_0x7254('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7254('0x1')],'unique':_0x7254('0x3')},'password':{'type':Sequelize[_0x7254('0x1')]},'port':{'type':Sequelize[_0x7254('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7254('0x1')],'defaultValue':_0x7254('0x5')},'connTimeout':{'type':Sequelize[_0x7254('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7254('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e6c=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0x487974,_0x3e5199){var _0x5c3f8d=function(_0x2cf4e2){while(--_0x2cf4e2){_0x487974['push'](_0x487974['shift']());}};_0x5c3f8d(++_0x3e5199);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc6e6('0x2')]},'authentication':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xc6e6('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xc6e6('0x4')},'connTimeout':{'type':Sequelize[_0xc6e6('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xc6e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f852223..35e67e5 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 _0x0837=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0837,0x1db));var _0x7083=function(_0x4677be,_0x305781){_0x4677be=_0x4677be-0x0;var _0x4815fc=_0x0837[_0x4677be];return _0x4815fc;};'use strict';var _=require(_0x7083('0x0'));var util=require(_0x7083('0x1'));var logger=require(_0x7083('0x2'))('api');var moment=require(_0x7083('0x3'));var BPromise=require(_0x7083('0x4'));var rp=require(_0x7083('0x5'));var fs=require('fs');var path=require(_0x7083('0x6'));var rimraf=require(_0x7083('0x7'));var config=require(_0x7083('0x8'));var attributes=require(_0x7083('0x9'));module[_0x7083('0xa')]=function(_0x152edc,_0x4dabb8){return _0x152edc[_0x7083('0xb')](_0x7083('0xc'),attributes,{'tableName':_0x7083('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1642=['path','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','../../config/logger','api'];(function(_0x56303f,_0x1561b5){var _0x35f47d=function(_0x30c467){while(--_0x30c467){_0x56303f['push'](_0x56303f['shift']());}};_0x35f47d(++_0x1561b5);}(_0x1642,0x1e8));var _0x2164=function(_0x53a8c4,_0x1deb52){_0x53a8c4=_0x53a8c4-0x0;var _0x171730=_0x1642[_0x53a8c4];return _0x171730;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2164('0x0'))(_0x2164('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2164('0x2'));var rimraf=require('rimraf');var config=require(_0x2164('0x3'));var attributes=require(_0x2164('0x4'));module['exports']=function(_0x4d51eb,_0x5d7b53){return _0x4d51eb['define'](_0x2164('0x5'),attributes,{'tableName':_0x2164('0x6'),'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 7d4b6eb..423c197 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 _0xf72f=['code','message','result','GetMailServerIn','MailServerIn','findAll','raw','options','attributes','limit','include','model','map','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x435c29,_0x3eb31b){var _0x589371=function(_0x156c4a){while(--_0x156c4a){_0x435c29['push'](_0x435c29['shift']());}};_0x589371(++_0x3eb31b);}(_0xf72f,0x9e));var _0xff72=function(_0x44f416,_0x24f422){_0x44f416=_0x44f416-0x0;var _0x2e4f3b=_0xf72f[_0x44f416];return _0x2e4f3b;};'use strict';var _=require('lodash');var util=require(_0xff72('0x0'));var moment=require(_0xff72('0x1'));var BPromise=require(_0xff72('0x2'));var rs=require(_0xff72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff72('0x4'))['db'];var utils=require(_0xff72('0x5'));var logger=require(_0xff72('0x6'))(_0xff72('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff72('0x8')][_0xff72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xde2eb5,_0x42b7fc,_0x1cbe47){return new BPromise(function(_0x162a1,_0x4d904a){return client['request'](_0xde2eb5,_0x1cbe47)[_0xff72('0xa')](function(_0x368449){logger[_0xff72('0xb')](_0xff72('0xc'),_0x42b7fc,'request\x20sent');logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x42b7fc,_0xff72('0xd'),JSON[_0xff72('0xe')](_0x368449));if(_0x368449[_0xff72('0xf')]){if(_0x368449[_0xff72('0xf')][_0xff72('0x10')]===0x1f4){logger[_0xff72('0xf')](_0xff72('0xc'),_0x42b7fc,_0x368449[_0xff72('0xf')][_0xff72('0x11')]);return _0x4d904a(_0x368449['error']['message']);}logger[_0xff72('0xf')](_0xff72('0xc'),_0x42b7fc,_0x368449['error'][_0xff72('0x11')]);return _0x162a1(_0x368449[_0xff72('0xf')]['message']);}else{logger[_0xff72('0xb')](_0xff72('0xc'),_0x42b7fc,_0xff72('0xd'));_0x162a1(_0x368449[_0xff72('0x12')][_0xff72('0x11')]);}})['catch'](function(_0x55ce7f){logger[_0xff72('0xf')]('MailServerIn,\x20%s,\x20%s',_0x42b7fc,_0x55ce7f);_0x4d904a(_0x55ce7f);});});}exports[_0xff72('0x13')]=function(_0x4d1bbc){var _0x4da1c3=this;return new Promise(function(_0x4bdfc7,_0x59a42d){return db[_0xff72('0x14')][_0xff72('0x15')]({'raw':_0x4d1bbc['options']?_0x4d1bbc['options'][_0xff72('0x16')]===undefined?!![]:![]:!![],'where':_0x4d1bbc['options']?_0x4d1bbc[_0xff72('0x17')]['where']||null:null,'attributes':_0x4d1bbc[_0xff72('0x17')]?_0x4d1bbc[_0xff72('0x17')][_0xff72('0x18')]||null:null,'limit':_0x4d1bbc[_0xff72('0x17')]?_0x4d1bbc[_0xff72('0x17')][_0xff72('0x19')]||null:null,'include':_0x4d1bbc[_0xff72('0x17')]?_0x4d1bbc['options'][_0xff72('0x1a')]?_['map'](_0x4d1bbc[_0xff72('0x17')]['include'],function(_0x5b264d){return{'model':db[_0x5b264d[_0xff72('0x1b')]],'as':_0x5b264d['as'],'attributes':_0x5b264d[_0xff72('0x18')],'include':_0x5b264d['include']?_['map'](_0x5b264d[_0xff72('0x1a')],function(_0x47665f){return{'model':db[_0x47665f[_0xff72('0x1b')]],'as':_0x47665f['as'],'attributes':_0x47665f['attributes'],'include':_0x47665f['include']?_[_0xff72('0x1c')](_0x47665f['include'],function(_0x32fa34){return{'model':db[_0x32fa34['model']],'as':_0x32fa34['as'],'attributes':_0x32fa34['attributes']};}):[]};}):[]};}):[]:[]})[_0xff72('0xa')](function(_0x194b8a){logger['info'](_0xff72('0x13'),_0x4d1bbc);logger['debug'](_0xff72('0x13'),_0x4d1bbc,JSON[_0xff72('0xe')](_0x194b8a));_0x4bdfc7(_0x194b8a);})['catch'](function(_0xce05f1){logger[_0xff72('0xf')](_0xff72('0x13'),_0xce05f1[_0xff72('0x11')],_0x4d1bbc);_0x59a42d(_0x4da1c3[_0xff72('0xf')](0x1f4,_0xce05f1[_0xff72('0x11')]));});});}; \ No newline at end of file +var _0x4334=['GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xb368e7,_0x9f553){var _0x43e0cd=function(_0x36669a){while(--_0x36669a){_0xb368e7['push'](_0xb368e7['shift']());}};_0x43e0cd(++_0x9f553);}(_0x4334,0xcd));var _0x4433=function(_0x304708,_0x243f40){_0x304708=_0x304708-0x0;var _0x5ea96e=_0x4334[_0x304708];return _0x5ea96e;};'use strict';var _=require(_0x4433('0x0'));var util=require(_0x4433('0x1'));var moment=require('moment');var BPromise=require(_0x4433('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4433('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4433('0x4'))(_0x4433('0x5'));var config=require('../../config/environment');var jayson=require(_0x4433('0x6'));var client=jayson[_0x4433('0x7')][_0x4433('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e66c6,_0x2119d7,_0x135b74){return new BPromise(function(_0x2e1174,_0x1f0817){return client[_0x4433('0x9')](_0x2e66c6,_0x135b74)[_0x4433('0xa')](function(_0x560c4e){logger[_0x4433('0xb')](_0x4433('0xc'),_0x2119d7,_0x4433('0xd'));logger['debug'](_0x4433('0xe'),_0x2119d7,_0x4433('0xd'),JSON['stringify'](_0x560c4e));if(_0x560c4e['error']){if(_0x560c4e[_0x4433('0xf')][_0x4433('0x10')]===0x1f4){logger[_0x4433('0xf')](_0x4433('0xc'),_0x2119d7,_0x560c4e[_0x4433('0xf')][_0x4433('0x11')]);return _0x1f0817(_0x560c4e[_0x4433('0xf')][_0x4433('0x11')]);}logger['error'](_0x4433('0xc'),_0x2119d7,_0x560c4e[_0x4433('0xf')][_0x4433('0x11')]);return _0x2e1174(_0x560c4e[_0x4433('0xf')][_0x4433('0x11')]);}else{logger[_0x4433('0xb')]('MailServerIn,\x20%s,\x20%s',_0x2119d7,_0x4433('0xd'));_0x2e1174(_0x560c4e[_0x4433('0x12')][_0x4433('0x11')]);}})['catch'](function(_0x1ad32e){logger[_0x4433('0xf')](_0x4433('0xc'),_0x2119d7,_0x1ad32e);_0x1f0817(_0x1ad32e);});});}exports[_0x4433('0x13')]=function(_0x5e8a64){var _0x10dc68=this;return new Promise(function(_0x385680,_0x169cc3){return db[_0x4433('0x14')][_0x4433('0x15')]({'raw':_0x5e8a64[_0x4433('0x16')]?_0x5e8a64[_0x4433('0x16')][_0x4433('0x17')]===undefined?!![]:![]:!![],'where':_0x5e8a64[_0x4433('0x16')]?_0x5e8a64[_0x4433('0x16')][_0x4433('0x18')]||null:null,'attributes':_0x5e8a64[_0x4433('0x16')]?_0x5e8a64[_0x4433('0x16')][_0x4433('0x19')]||null:null,'limit':_0x5e8a64[_0x4433('0x16')]?_0x5e8a64[_0x4433('0x16')][_0x4433('0x1a')]||null:null,'include':_0x5e8a64[_0x4433('0x16')]?_0x5e8a64[_0x4433('0x16')][_0x4433('0x1b')]?_[_0x4433('0x1c')](_0x5e8a64[_0x4433('0x16')][_0x4433('0x1b')],function(_0x1bf290){return{'model':db[_0x1bf290['model']],'as':_0x1bf290['as'],'attributes':_0x1bf290['attributes'],'include':_0x1bf290[_0x4433('0x1b')]?_[_0x4433('0x1c')](_0x1bf290[_0x4433('0x1b')],function(_0xcba9e){return{'model':db[_0xcba9e[_0x4433('0x1d')]],'as':_0xcba9e['as'],'attributes':_0xcba9e[_0x4433('0x19')],'include':_0xcba9e[_0x4433('0x1b')]?_[_0x4433('0x1c')](_0xcba9e['include'],function(_0x4757ec){return{'model':db[_0x4757ec[_0x4433('0x1d')]],'as':_0x4757ec['as'],'attributes':_0x4757ec[_0x4433('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x382361){logger['info'](_0x4433('0x13'),_0x5e8a64);logger['debug'](_0x4433('0x13'),_0x5e8a64,JSON[_0x4433('0x1e')](_0x382361));_0x385680(_0x382361);})[_0x4433('0x1f')](function(_0x5f4d07){logger[_0x4433('0xf')](_0x4433('0x13'),_0x5f4d07[_0x4433('0x11')],_0x5e8a64);_0x169cc3(_0x10dc68[_0x4433('0xf')](0x1f4,_0x5f4d07['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index fd1ccef..c5db79b 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 _0x0426=['isAuthenticated','index','get','/:id','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0x0426,0x188));var _0x6042=function(_0x5dbfe8,_0x2eb959){_0x5dbfe8=_0x5dbfe8-0x0;var _0x579124=_0x0426[_0x5dbfe8];return _0x579124;};'use strict';var multer=require('multer');var util=require(_0x6042('0x0'));var path=require(_0x6042('0x1'));var timeout=require('connect-timeout');var express=require(_0x6042('0x2'));var router=express[_0x6042('0x3')]();var auth=require(_0x6042('0x4'));var interaction=require(_0x6042('0x5'));var config=require(_0x6042('0x6'));var controller=require(_0x6042('0x7'));router['get']('/',auth[_0x6042('0x8')](),controller[_0x6042('0x9')]);router[_0x6042('0xa')](_0x6042('0xb'),auth[_0x6042('0x8')](),controller['show']);router['post']('/',auth[_0x6042('0x8')](),controller['create']);router[_0x6042('0xc')](_0x6042('0xb'),auth[_0x6042('0x8')](),controller[_0x6042('0xd')]);router[_0x6042('0xe')](_0x6042('0xb'),auth[_0x6042('0x8')](),controller['destroy']);module[_0x6042('0xf')]=router; \ No newline at end of file +var _0x4f7e=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x4f7e,0x10f));var _0xe4f7=function(_0x324647,_0x4510cd){_0x324647=_0x324647-0x0;var _0x2edadf=_0x4f7e[_0x324647];return _0x2edadf;};'use strict';var multer=require(_0xe4f7('0x0'));var util=require(_0xe4f7('0x1'));var path=require(_0xe4f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4f7('0x3'));var router=express[_0xe4f7('0x4')]();var auth=require(_0xe4f7('0x5'));var interaction=require(_0xe4f7('0x6'));var config=require(_0xe4f7('0x7'));var controller=require(_0xe4f7('0x8'));router[_0xe4f7('0x9')]('/',auth[_0xe4f7('0xa')](),controller[_0xe4f7('0xb')]);router[_0xe4f7('0x9')](_0xe4f7('0xc'),auth[_0xe4f7('0xa')](),controller[_0xe4f7('0xd')]);router['post']('/',auth[_0xe4f7('0xa')](),controller['create']);router[_0xe4f7('0xe')](_0xe4f7('0xc'),auth[_0xe4f7('0xa')](),controller['update']);router[_0xe4f7('0xf')](_0xe4f7('0xc'),auth[_0xe4f7('0xa')](),controller[_0xe4f7('0x10')]);module[_0xe4f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f2e5a2b..c8cb23e 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 _0x0e38=['STRING','BOOLEAN','exports'];(function(_0x575b59,_0x5e1244){var _0x3ac89c=function(_0x195f49){while(--_0x195f49){_0x575b59['push'](_0x575b59['shift']());}};_0x3ac89c(++_0x5e1244);}(_0x0e38,0xc2));var _0x80e3=function(_0x3f6e29,_0x418175){_0x3f6e29=_0x3f6e29-0x0;var _0x39a171=_0x0e38[_0x3f6e29];return _0x39a171;};'use strict';var Sequelize=require('sequelize');module[_0x80e3('0x0')]={'description':{'type':Sequelize[_0x80e3('0x1')]},'host':{'type':Sequelize[_0x80e3('0x1')]},'user':{'type':Sequelize[_0x80e3('0x1')]},'pass':{'type':Sequelize[_0x80e3('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x80e3('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x80e3('0x1')]},'authentication':{'type':Sequelize[_0x80e3('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x05cf=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x05cf,0x7b));var _0xf05c=function(_0x2d323e,_0x4fcc48){_0x2d323e=_0x2d323e-0x0;var _0x101ee5=_0x05cf[_0x2d323e];return _0x101ee5;};'use strict';var Sequelize=require(_0xf05c('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf05c('0x1')]},'user':{'type':Sequelize[_0xf05c('0x1')]},'pass':{'type':Sequelize[_0xf05c('0x1')]},'port':{'type':Sequelize[_0xf05c('0x2')]},'secure':{'type':Sequelize[_0xf05c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf05c('0x1')]},'authentication':{'type':Sequelize[_0xf05c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 74fe333..a5912bb 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 _0x4f7a=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','MailServerOut','count','includeAll','include','findAll','rows','params','options','create','body','catch','find','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0x57746e,_0x45093f){var _0x5caeaa=function(_0x4665a2){while(--_0x4665a2){_0x57746e['push'](_0x57746e['shift']());}};_0x5caeaa(++_0x45093f);}(_0x4f7a,0x105));var _0xa4f7=function(_0x61b073,_0x2a5407){_0x61b073=_0x61b073-0x0;var _0x2a2832=_0x4f7a[_0x61b073];return _0x2a2832;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa4f7('0x0'));var zipdir=require(_0xa4f7('0x1'));var jsonpatch=require(_0xa4f7('0x2'));var rp=require('request-promise');var moment=require(_0xa4f7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa4f7('0x4'));var util=require(_0xa4f7('0x5'));var path=require(_0xa4f7('0x6'));var sox=require('sox');var csv=require(_0xa4f7('0x7'));var ejs=require(_0xa4f7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4f7('0x9'));var jsforce=require(_0xa4f7('0xa'));var deskjs=require(_0xa4f7('0xb'));var toCsv=require(_0xa4f7('0x7'));var querystring=require(_0xa4f7('0xc'));var Papa=require('papaparse');var Redis=require(_0xa4f7('0xd'));var authService=require(_0xa4f7('0xe'));var qs=require(_0xa4f7('0xf'));var hardwareService=require(_0xa4f7('0x10'));var logger=require(_0xa4f7('0x11'))(_0xa4f7('0x12'));var utils=require(_0xa4f7('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1015e0,_0x1917f6){_0x1917f6=_0x1917f6||0xcc;return function(_0x4a8cf9){if(_0x4a8cf9){return _0x1015e0[_0xa4f7('0x14')](_0x1917f6);}return _0x1015e0[_0xa4f7('0x15')](_0x1917f6)[_0xa4f7('0x16')]();};}function respondWithResult(_0x54bbd4,_0x1f60b3){_0x1f60b3=_0x1f60b3||0xc8;return function(_0x321bd7){if(_0x321bd7){return _0x54bbd4[_0xa4f7('0x15')](_0x1f60b3)['json'](_0x321bd7);}};}function respondWithFilteredResult(_0xd626dc,_0x1ddb6b){return function(_0x2a255f){if(_0x2a255f){var _0x39d437=_0x2a255f['count'],_0x492500=_0x1ddb6b['offset'],_0x3e9fc7=_0x1ddb6b[_0xa4f7('0x17')]+_0x1ddb6b['limit'],_0x1e13ab;if(_0x3e9fc7>=_0x39d437){_0x3e9fc7=_0x39d437;_0x1e13ab=0xc8;}else{_0x1e13ab=0xce;}_0xd626dc[_0xa4f7('0x15')](_0x1e13ab);return _0xd626dc[_0xa4f7('0x18')]('Content-Range',_0x492500+'-'+_0x3e9fc7+'/'+_0x39d437)[_0xa4f7('0x19')](_0x2a255f);}return null;};}function patchUpdates(_0x5314d5){return function(_0x143dac){try{jsonpatch[_0xa4f7('0x1a')](_0x143dac,_0x5314d5,!![]);}catch(_0x10b16a){return BPromise[_0xa4f7('0x1b')](_0x10b16a);}return _0x143dac[_0xa4f7('0x1c')]();};}function saveUpdates(_0x44a54c,_0x48ec43){return function(_0x18bb7a){if(_0x18bb7a){return _0x18bb7a[_0xa4f7('0x1d')](_0x44a54c)[_0xa4f7('0x1e')](function(_0x33ef47){return _0x33ef47;});}return null;};}function removeEntity(_0x56b730,_0x13106d){return function(_0x392312){if(_0x392312){return _0x392312[_0xa4f7('0x1f')]()[_0xa4f7('0x1e')](function(){_0x56b730[_0xa4f7('0x15')](0xcc)[_0xa4f7('0x16')]();});}};}function handleEntityNotFound(_0x2a59b4,_0xdbc437){return function(_0x16a342){if(!_0x16a342){_0x2a59b4[_0xa4f7('0x14')](0x194);}return _0x16a342;};}function handleError(_0x3ab7a5,_0x119709){_0x119709=_0x119709||0x1f4;return function(_0x53dd1d){logger[_0xa4f7('0x20')](_0x53dd1d[_0xa4f7('0x21')]);if(_0x53dd1d[_0xa4f7('0x22')]){delete _0x53dd1d[_0xa4f7('0x22')];}_0x3ab7a5[_0xa4f7('0x15')](_0x119709)['send'](_0x53dd1d);};}exports['index']=function(_0x4afd1d,_0x311463){var _0x4e6c36={},_0x4859d={},_0x23ffe5={'count':0x0,'rows':[]};var _0x1b8cac=db['MailServerOut'][_0xa4f7('0x23')];_0x4859d['model']=_[_0xa4f7('0x24')](_0x1b8cac);_0x4859d['query']=_[_0xa4f7('0x24')](_0x4afd1d[_0xa4f7('0x25')]);_0x4859d[_0xa4f7('0x26')]=_[_0xa4f7('0x27')](_0x4859d['model'],_0x4859d[_0xa4f7('0x25')]);_0x4e6c36[_0xa4f7('0x28')]=_[_0xa4f7('0x27')](_0x4859d[_0xa4f7('0x29')],qs[_0xa4f7('0x2a')](_0x4afd1d['query'][_0xa4f7('0x2a')]));_0x4e6c36[_0xa4f7('0x28')]=_0x4e6c36['attributes'][_0xa4f7('0x2b')]?_0x4e6c36[_0xa4f7('0x28')]:_0x4859d[_0xa4f7('0x29')];if(!_0x4afd1d['query'][_0xa4f7('0x2c')](_0xa4f7('0x2d'))){_0x4e6c36['limit']=qs['limit'](_0x4afd1d[_0xa4f7('0x25')][_0xa4f7('0x2e')]);_0x4e6c36[_0xa4f7('0x17')]=qs['offset'](_0x4afd1d[_0xa4f7('0x25')][_0xa4f7('0x17')]);}_0x4e6c36[_0xa4f7('0x2f')]=qs[_0xa4f7('0x30')](_0x4afd1d[_0xa4f7('0x25')][_0xa4f7('0x30')]);_0x4e6c36[_0xa4f7('0x31')]=qs[_0xa4f7('0x26')](_[_0xa4f7('0x32')](_0x4afd1d['query'],_0x4859d[_0xa4f7('0x26')]));if(_0x4afd1d[_0xa4f7('0x25')][_0xa4f7('0x33')]){_0x4e6c36[_0xa4f7('0x31')]=_[_0xa4f7('0x34')](_0x4e6c36[_0xa4f7('0x31')],{'$or':_[_0xa4f7('0x35')](_0x1b8cac,function(_0xe03bcd){if(_0xe03bcd['type'][_0xa4f7('0x36')]!==_0xa4f7('0x37')){var _0x5542d8={};_0x5542d8[_0xe03bcd['field']]={'$like':'%'+_0x4afd1d[_0xa4f7('0x25')][_0xa4f7('0x33')]+'%'};return _0x5542d8;}})});}_0x4e6c36=_[_0xa4f7('0x34')]({},_0x4e6c36,_0x4afd1d['options']);var _0x2318fd={'where':_0x4e6c36[_0xa4f7('0x31')]};return db[_0xa4f7('0x38')][_0xa4f7('0x39')](_0x2318fd)['then'](function(_0x3fe379){_0x23ffe5[_0xa4f7('0x39')]=_0x3fe379;if(_0x4afd1d[_0xa4f7('0x25')][_0xa4f7('0x3a')]){_0x4e6c36[_0xa4f7('0x3b')]=[{'all':!![]}];}return db[_0xa4f7('0x38')][_0xa4f7('0x3c')](_0x4e6c36);})[_0xa4f7('0x1e')](function(_0x3601f2){_0x23ffe5[_0xa4f7('0x3d')]=_0x3601f2;return _0x23ffe5;})['then'](respondWithFilteredResult(_0x311463,_0x4e6c36))['catch'](handleError(_0x311463,null));};exports['show']=function(_0x22dfdd,_0x4a8215){var _0x21f672={'raw':!![],'where':{'id':_0x22dfdd[_0xa4f7('0x3e')]['id']}},_0x31f398={};_0x31f398[_0xa4f7('0x29')]=_[_0xa4f7('0x24')](db['MailServerOut'][_0xa4f7('0x23')]);_0x31f398[_0xa4f7('0x25')]=_[_0xa4f7('0x24')](_0x22dfdd[_0xa4f7('0x25')]);_0x31f398[_0xa4f7('0x26')]=_[_0xa4f7('0x27')](_0x31f398[_0xa4f7('0x29')],_0x31f398[_0xa4f7('0x25')]);_0x21f672[_0xa4f7('0x28')]=_[_0xa4f7('0x27')](_0x31f398['model'],qs[_0xa4f7('0x2a')](_0x22dfdd['query']['fields']));_0x21f672[_0xa4f7('0x28')]=_0x21f672[_0xa4f7('0x28')][_0xa4f7('0x2b')]?_0x21f672[_0xa4f7('0x28')]:_0x31f398[_0xa4f7('0x29')];if(_0x22dfdd['query'][_0xa4f7('0x3a')]){_0x21f672[_0xa4f7('0x3b')]=[{'all':!![]}];}_0x21f672=_[_0xa4f7('0x34')]({},_0x21f672,_0x22dfdd[_0xa4f7('0x3f')]);return db[_0xa4f7('0x38')]['find'](_0x21f672)[_0xa4f7('0x1e')](handleEntityNotFound(_0x4a8215,null))[_0xa4f7('0x1e')](respondWithResult(_0x4a8215,null))['catch'](handleError(_0x4a8215,null));};exports[_0xa4f7('0x40')]=function(_0x185206,_0x685f74){return db['MailServerOut']['create'](_0x185206[_0xa4f7('0x41')],{})[_0xa4f7('0x1e')](respondWithResult(_0x685f74,0xc9))[_0xa4f7('0x42')](handleError(_0x685f74,null));};exports['update']=function(_0x299491,_0x4174ad){if(_0x299491[_0xa4f7('0x41')]['id']){delete _0x299491[_0xa4f7('0x41')]['id'];}return db[_0xa4f7('0x38')]['find']({'where':{'id':_0x299491[_0xa4f7('0x3e')]['id']}})[_0xa4f7('0x1e')](handleEntityNotFound(_0x4174ad,null))[_0xa4f7('0x1e')](saveUpdates(_0x299491['body'],null))['then'](respondWithResult(_0x4174ad,null))[_0xa4f7('0x42')](handleError(_0x4174ad,null));};exports[_0xa4f7('0x1f')]=function(_0x44e8a1,_0x1a4afb){return db[_0xa4f7('0x38')][_0xa4f7('0x43')]({'where':{'id':_0x44e8a1[_0xa4f7('0x3e')]['id']}})[_0xa4f7('0x1e')](handleEntityNotFound(_0x1a4afb,null))[_0xa4f7('0x1e')](removeEntity(_0x1a4afb,null))['catch'](handleError(_0x1a4afb,null));}; \ No newline at end of file +var _0x34f0=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','save','update','then','destroy','stack','name','index','MailServerOut','rawAttributes','model','keys','query','filters','attributes','length','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','count','include','rows','show','params','intersection','fields','find','create','body','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x45413e,_0x3d8d36){var _0x1b9cac=function(_0x481444){while(--_0x481444){_0x45413e['push'](_0x45413e['shift']());}};_0x1b9cac(++_0x3d8d36);}(_0x34f0,0x13b));var _0x034f=function(_0x51d3c4,_0x43f5cb){_0x51d3c4=_0x51d3c4-0x0;var _0x2ccbca=_0x34f0[_0x51d3c4];return _0x2ccbca;};'use strict';var pdf=require(_0x034f('0x0'));var emlformat=require(_0x034f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x034f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x034f('0x3'));var moment=require(_0x034f('0x4'));var BPromise=require(_0x034f('0x5'));var Mustache=require(_0x034f('0x6'));var util=require(_0x034f('0x7'));var path=require('path');var sox=require(_0x034f('0x8'));var csv=require(_0x034f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x034f('0xa'));var squel=require('squel');var crypto=require(_0x034f('0xb'));var jsforce=require(_0x034f('0xc'));var deskjs=require(_0x034f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x034f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x034f('0xf'));var hardwareService=require(_0x034f('0x10'));var logger=require(_0x034f('0x11'))(_0x034f('0x12'));var utils=require(_0x034f('0x13'));var config=require('../../config/environment');var db=require(_0x034f('0x14'))['db'];function respondWithStatusCode(_0x446b50,_0x3d0f3b){_0x3d0f3b=_0x3d0f3b||0xcc;return function(_0x568180){if(_0x568180){return _0x446b50[_0x034f('0x15')](_0x3d0f3b);}return _0x446b50['status'](_0x3d0f3b)[_0x034f('0x16')]();};}function respondWithResult(_0x291d94,_0x375b1f){_0x375b1f=_0x375b1f||0xc8;return function(_0x29fe43){if(_0x29fe43){return _0x291d94[_0x034f('0x17')](_0x375b1f)[_0x034f('0x18')](_0x29fe43);}};}function respondWithFilteredResult(_0xc3061c,_0x167804){return function(_0x5bc410){if(_0x5bc410){var _0x538e89=_0x5bc410['count'],_0x101a1e=_0x167804['offset'],_0x3b911f=_0x167804[_0x034f('0x19')]+_0x167804[_0x034f('0x1a')],_0x21cd29;if(_0x3b911f>=_0x538e89){_0x3b911f=_0x538e89;_0x21cd29=0xc8;}else{_0x21cd29=0xce;}_0xc3061c['status'](_0x21cd29);return _0xc3061c[_0x034f('0x1b')]('Content-Range',_0x101a1e+'-'+_0x3b911f+'/'+_0x538e89)[_0x034f('0x18')](_0x5bc410);}return null;};}function patchUpdates(_0x2b57d0){return function(_0x1ebb01){try{jsonpatch['apply'](_0x1ebb01,_0x2b57d0,!![]);}catch(_0x21d0fc){return BPromise[_0x034f('0x1c')](_0x21d0fc);}return _0x1ebb01[_0x034f('0x1d')]();};}function saveUpdates(_0x112833,_0x349f12){return function(_0x5f442b){if(_0x5f442b){return _0x5f442b[_0x034f('0x1e')](_0x112833)[_0x034f('0x1f')](function(_0x32c4ad){return _0x32c4ad;});}return null;};}function removeEntity(_0x491ca3,_0xd6954b){return function(_0x1e9abb){if(_0x1e9abb){return _0x1e9abb[_0x034f('0x20')]()['then'](function(){_0x491ca3['status'](0xcc)[_0x034f('0x16')]();});}};}function handleEntityNotFound(_0x586598,_0x2d951b){return function(_0x1fd774){if(!_0x1fd774){_0x586598[_0x034f('0x15')](0x194);}return _0x1fd774;};}function handleError(_0x22dc21,_0x2943b8){_0x2943b8=_0x2943b8||0x1f4;return function(_0x169b1f){logger['error'](_0x169b1f[_0x034f('0x21')]);if(_0x169b1f[_0x034f('0x22')]){delete _0x169b1f[_0x034f('0x22')];}_0x22dc21[_0x034f('0x17')](_0x2943b8)['send'](_0x169b1f);};}exports[_0x034f('0x23')]=function(_0x8eacf2,_0x41793b){var _0x56d4da={},_0xa1dd7e={},_0x12d945={'count':0x0,'rows':[]};var _0x3016b5=db[_0x034f('0x24')][_0x034f('0x25')];_0xa1dd7e[_0x034f('0x26')]=_[_0x034f('0x27')](_0x3016b5);_0xa1dd7e[_0x034f('0x28')]=_[_0x034f('0x27')](_0x8eacf2[_0x034f('0x28')]);_0xa1dd7e[_0x034f('0x29')]=_['intersection'](_0xa1dd7e['model'],_0xa1dd7e[_0x034f('0x28')]);_0x56d4da['attributes']=_['intersection'](_0xa1dd7e['model'],qs['fields'](_0x8eacf2['query']['fields']));_0x56d4da[_0x034f('0x2a')]=_0x56d4da['attributes'][_0x034f('0x2b')]?_0x56d4da['attributes']:_0xa1dd7e[_0x034f('0x26')];if(!_0x8eacf2['query']['hasOwnProperty']('nolimit')){_0x56d4da[_0x034f('0x1a')]=qs[_0x034f('0x1a')](_0x8eacf2[_0x034f('0x28')]['limit']);_0x56d4da[_0x034f('0x19')]=qs['offset'](_0x8eacf2['query'][_0x034f('0x19')]);}_0x56d4da[_0x034f('0x2c')]=qs[_0x034f('0x2d')](_0x8eacf2[_0x034f('0x28')][_0x034f('0x2d')]);_0x56d4da[_0x034f('0x2e')]=qs[_0x034f('0x29')](_[_0x034f('0x2f')](_0x8eacf2[_0x034f('0x28')],_0xa1dd7e[_0x034f('0x29')]));if(_0x8eacf2[_0x034f('0x28')][_0x034f('0x30')]){_0x56d4da[_0x034f('0x2e')]=_[_0x034f('0x31')](_0x56d4da[_0x034f('0x2e')],{'$or':_['map'](_0x3016b5,function(_0x220eda){if(_0x220eda[_0x034f('0x32')][_0x034f('0x33')]!==_0x034f('0x34')){var _0x5016d0={};_0x5016d0[_0x220eda[_0x034f('0x35')]]={'$like':'%'+_0x8eacf2[_0x034f('0x28')][_0x034f('0x30')]+'%'};return _0x5016d0;}})});}_0x56d4da=_[_0x034f('0x31')]({},_0x56d4da,_0x8eacf2[_0x034f('0x36')]);var _0xd4bbc1={'where':_0x56d4da[_0x034f('0x2e')]};return db[_0x034f('0x24')][_0x034f('0x37')](_0xd4bbc1)[_0x034f('0x1f')](function(_0x38e2ed){_0x12d945['count']=_0x38e2ed;if(_0x8eacf2['query']['includeAll']){_0x56d4da[_0x034f('0x38')]=[{'all':!![]}];}return db[_0x034f('0x24')]['findAll'](_0x56d4da);})[_0x034f('0x1f')](function(_0x3e2340){_0x12d945[_0x034f('0x39')]=_0x3e2340;return _0x12d945;})[_0x034f('0x1f')](respondWithFilteredResult(_0x41793b,_0x56d4da))['catch'](handleError(_0x41793b,null));};exports[_0x034f('0x3a')]=function(_0xc4e184,_0x9d7552){var _0x1c4ae7={'raw':!![],'where':{'id':_0xc4e184[_0x034f('0x3b')]['id']}},_0x2d9c35={};_0x2d9c35[_0x034f('0x26')]=_[_0x034f('0x27')](db[_0x034f('0x24')][_0x034f('0x25')]);_0x2d9c35[_0x034f('0x28')]=_[_0x034f('0x27')](_0xc4e184[_0x034f('0x28')]);_0x2d9c35[_0x034f('0x29')]=_[_0x034f('0x3c')](_0x2d9c35[_0x034f('0x26')],_0x2d9c35[_0x034f('0x28')]);_0x1c4ae7['attributes']=_[_0x034f('0x3c')](_0x2d9c35['model'],qs[_0x034f('0x3d')](_0xc4e184[_0x034f('0x28')][_0x034f('0x3d')]));_0x1c4ae7[_0x034f('0x2a')]=_0x1c4ae7[_0x034f('0x2a')][_0x034f('0x2b')]?_0x1c4ae7[_0x034f('0x2a')]:_0x2d9c35[_0x034f('0x26')];if(_0xc4e184[_0x034f('0x28')]['includeAll']){_0x1c4ae7[_0x034f('0x38')]=[{'all':!![]}];}_0x1c4ae7=_['merge']({},_0x1c4ae7,_0xc4e184[_0x034f('0x36')]);return db[_0x034f('0x24')][_0x034f('0x3e')](_0x1c4ae7)[_0x034f('0x1f')](handleEntityNotFound(_0x9d7552,null))[_0x034f('0x1f')](respondWithResult(_0x9d7552,null))['catch'](handleError(_0x9d7552,null));};exports[_0x034f('0x3f')]=function(_0x1567d2,_0x16de26){return db[_0x034f('0x24')][_0x034f('0x3f')](_0x1567d2[_0x034f('0x40')],{})[_0x034f('0x1f')](respondWithResult(_0x16de26,0xc9))[_0x034f('0x41')](handleError(_0x16de26,null));};exports[_0x034f('0x1e')]=function(_0x111d72,_0x1af91a){if(_0x111d72[_0x034f('0x40')]['id']){delete _0x111d72[_0x034f('0x40')]['id'];}return db[_0x034f('0x24')]['find']({'where':{'id':_0x111d72[_0x034f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1af91a,null))[_0x034f('0x1f')](saveUpdates(_0x111d72[_0x034f('0x40')],null))[_0x034f('0x1f')](respondWithResult(_0x1af91a,null))[_0x034f('0x41')](handleError(_0x1af91a,null));};exports[_0x034f('0x20')]=function(_0x4bb80d,_0x38a48f){return db['MailServerOut']['find']({'where':{'id':_0x4bb80d[_0x034f('0x3b')]['id']}})[_0x034f('0x1f')](handleEntityNotFound(_0x38a48f,null))[_0x034f('0x1f')](removeEntity(_0x38a48f,null))[_0x034f('0x41')](handleError(_0x38a48f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 033e950..3420bb8 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 _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','MailServerOut'];(function(_0x5d7c9f,_0x2a8792){var _0x1985e6=function(_0x53ed30){while(--_0x53ed30){_0x5d7c9f['push'](_0x5d7c9f['shift']());}};_0x1985e6(++_0x2a8792);}(_0x8f4c,0x113));var _0xc8f4=function(_0x7cf586,_0xd0ff06){_0x7cf586=_0x7cf586-0x0;var _0x3c38a4=_0x8f4c[_0x7cf586];return _0x3c38a4;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./mailServerOut.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0abf=['define','mail_servers_out','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x2f1d83,_0x2304f0){var _0x497b4c=function(_0x27b0fb){while(--_0x27b0fb){_0x2f1d83['push'](_0x2f1d83['shift']());}};_0x497b4c(++_0x2304f0);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('MailServerOut',attributes,{'tableName':_0xf0ab('0x9'),'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 1ec25bc..68bb585 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 _0xca4b=['code','MailServerOut,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f4ec6,_0x41db55){var _0xd61143=function(_0x1f22ee){while(--_0x1f22ee){_0x1f4ec6['push'](_0x1f4ec6['shift']());}};_0xd61143(++_0x41db55);}(_0xca4b,0xa6));var _0xbca4=function(_0x50df9b,_0x386b82){_0x50df9b=_0x50df9b-0x0;var _0x52177f=_0xca4b[_0x50df9b];return _0x52177f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbca4('0x0'));var BPromise=require(_0xbca4('0x1'));var rs=require(_0xbca4('0x2'));var fs=require('fs');var Redis=require(_0xbca4('0x3'));var db=require(_0xbca4('0x4'))['db'];var utils=require(_0xbca4('0x5'));var logger=require(_0xbca4('0x6'))(_0xbca4('0x7'));var config=require(_0xbca4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbca4('0x9')][_0xbca4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45630c,_0x3381f5,_0x1f1dfc){return new BPromise(function(_0x3624a7,_0x4184d8){return client['request'](_0x45630c,_0x1f1dfc)[_0xbca4('0xb')](function(_0x5cafc3){logger[_0xbca4('0xc')]('MailServerOut,\x20%s,\x20%s',_0x3381f5,_0xbca4('0xd'));logger[_0xbca4('0xe')](_0xbca4('0xf'),_0x3381f5,_0xbca4('0xd'),JSON[_0xbca4('0x10')](_0x5cafc3));if(_0x5cafc3[_0xbca4('0x11')]){if(_0x5cafc3[_0xbca4('0x11')][_0xbca4('0x12')]===0x1f4){logger[_0xbca4('0x11')](_0xbca4('0x13'),_0x3381f5,_0x5cafc3[_0xbca4('0x11')][_0xbca4('0x14')]);return _0x4184d8(_0x5cafc3[_0xbca4('0x11')][_0xbca4('0x14')]);}logger[_0xbca4('0x11')]('MailServerOut,\x20%s,\x20%s',_0x3381f5,_0x5cafc3['error'][_0xbca4('0x14')]);return _0x3624a7(_0x5cafc3[_0xbca4('0x11')][_0xbca4('0x14')]);}else{logger['info'](_0xbca4('0x13'),_0x3381f5,'request\x20sent');_0x3624a7(_0x5cafc3[_0xbca4('0x15')]['message']);}})[_0xbca4('0x16')](function(_0x6d54){logger[_0xbca4('0x11')](_0xbca4('0x13'),_0x3381f5,_0x6d54);_0x4184d8(_0x6d54);});});} \ No newline at end of file +var _0x52cf=['../../config/logger','rpc','jayson/promise','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x4a9dd1,_0xfa8de5){var _0x2e761a=function(_0x546de0){while(--_0x546de0){_0x4a9dd1['push'](_0x4a9dd1['shift']());}};_0x2e761a(++_0xfa8de5);}(_0x52cf,0x121));var _0xf52c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x52cf[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xf52c('0x0'));var util=require(_0xf52c('0x1'));var moment=require(_0xf52c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf52c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf52c('0x4'));var logger=require(_0xf52c('0x5'))(_0xf52c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf52c('0x7'));var client=jayson['client'][_0xf52c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26a9cc,_0x436a56,_0x57e6c5){return new BPromise(function(_0x57fab5,_0x44a5a6){return client['request'](_0x26a9cc,_0x57e6c5)[_0xf52c('0x9')](function(_0x3290e3){logger[_0xf52c('0xa')](_0xf52c('0xb'),_0x436a56,_0xf52c('0xc'));logger[_0xf52c('0xd')](_0xf52c('0xe'),_0x436a56,'request\x20sent',JSON[_0xf52c('0xf')](_0x3290e3));if(_0x3290e3[_0xf52c('0x10')]){if(_0x3290e3[_0xf52c('0x10')][_0xf52c('0x11')]===0x1f4){logger[_0xf52c('0x10')](_0xf52c('0xb'),_0x436a56,_0x3290e3[_0xf52c('0x10')][_0xf52c('0x12')]);return _0x44a5a6(_0x3290e3[_0xf52c('0x10')][_0xf52c('0x12')]);}logger['error'](_0xf52c('0xb'),_0x436a56,_0x3290e3[_0xf52c('0x10')][_0xf52c('0x12')]);return _0x57fab5(_0x3290e3[_0xf52c('0x10')][_0xf52c('0x12')]);}else{logger[_0xf52c('0xa')](_0xf52c('0xb'),_0x436a56,_0xf52c('0xc'));_0x57fab5(_0x3290e3[_0xf52c('0x13')][_0xf52c('0x12')]);}})[_0xf52c('0x14')](function(_0x21c0c2){logger[_0xf52c('0x10')](_0xf52c('0xb'),_0x436a56,_0x21c0c2);_0x44a5a6(_0x21c0c2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2fe0d22..f7532af 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 _0x3f3c=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3f3c,0x17a));var _0xc3f3=function(_0x26b06d,_0x5a3602){_0x26b06d=_0x26b06d-0x0;var _0x505e97=_0x3f3c[_0x26b06d];return _0x505e97;};'use strict';var multer=require(_0xc3f3('0x0'));var util=require(_0xc3f3('0x1'));var path=require('path');var timeout=require(_0xc3f3('0x2'));var express=require(_0xc3f3('0x3'));var router=express[_0xc3f3('0x4')]();var auth=require(_0xc3f3('0x5'));var interaction=require(_0xc3f3('0x6'));var config=require(_0xc3f3('0x7'));var controller=require('./mailSubstatus.controller');router[_0xc3f3('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3f3('0x9')]);router[_0xc3f3('0x8')](_0xc3f3('0xa'),auth[_0xc3f3('0xb')](),controller[_0xc3f3('0xc')]);router['get'](_0xc3f3('0xd'),auth[_0xc3f3('0xb')](),controller[_0xc3f3('0xe')]);router[_0xc3f3('0xf')]('/',auth[_0xc3f3('0xb')](),controller[_0xc3f3('0x10')]);router[_0xc3f3('0x11')](_0xc3f3('0xd'),auth[_0xc3f3('0xb')](),controller[_0xc3f3('0x12')]);router['delete'](_0xc3f3('0xd'),auth[_0xc3f3('0xb')](),controller[_0xc3f3('0x13')]);module[_0xc3f3('0x14')]=router; \ No newline at end of file +var _0x59a7=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x1cdb2d,_0x8f1f76){var _0x4dafe3=function(_0xec694e){while(--_0xec694e){_0x1cdb2d['push'](_0x1cdb2d['shift']());}};_0x4dafe3(++_0x8f1f76);}(_0x59a7,0x1a7));var _0x759a=function(_0x415250,_0x4ce3f0){_0x415250=_0x415250-0x0;var _0x1ab728=_0x59a7[_0x415250];return _0x1ab728;};'use strict';var multer=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var path=require(_0x759a('0x2'));var timeout=require(_0x759a('0x3'));var express=require('express');var router=express[_0x759a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x759a('0x5'));var config=require(_0x759a('0x6'));var controller=require(_0x759a('0x7'));router[_0x759a('0x8')]('/',auth[_0x759a('0x9')](),controller[_0x759a('0xa')]);router['get'](_0x759a('0xb'),auth[_0x759a('0x9')](),controller[_0x759a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x759a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x759a('0xe')](_0x759a('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x759a('0x10')](_0x759a('0xf'),auth['isAuthenticated'](),controller[_0x759a('0x11')]);module[_0x759a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 5bc0d48..c8be7cc 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 _0xa5fa=['name','exports','STRING'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x2ae424,_0x307344){_0x2ae424=_0x2ae424-0x0;var _0x5c9540=_0xa5fa[_0x2ae424];return _0x5c9540;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'name':{'type':Sequelize[_0xaa5f('0x1')],'unique':_0xaa5f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa5f('0x1')]}}; \ No newline at end of file +var _0xa1b9=['STRING','name','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa1b9,0x71));var _0x9a1b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa1b9[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x9a1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a1b('0x1')],'unique':_0x9a1b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9a1b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index dfc4c20..710e882 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 _0xc964=['ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','save','update','destroy','then','end','stack','name','index','MailSubstatus','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x1176db,_0x2ed65c){var _0x5cb0e3=function(_0x3e7700){while(--_0x3e7700){_0x1176db['push'](_0x1176db['shift']());}};_0x5cb0e3(++_0x2ed65c);}(_0xc964,0x7e));var _0x4c96=function(_0x9f1cb,_0x123884){_0x9f1cb=_0x9f1cb-0x0;var _0x55115b=_0xc964[_0x9f1cb];return _0x55115b;};'use strict';var pdf=require(_0x4c96('0x0'));var emlformat=require(_0x4c96('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c96('0x2'));var jsonpatch=require(_0x4c96('0x3'));var rp=require(_0x4c96('0x4'));var moment=require('moment');var BPromise=require(_0x4c96('0x5'));var Mustache=require('mustache');var util=require(_0x4c96('0x6'));var path=require(_0x4c96('0x7'));var sox=require(_0x4c96('0x8'));var csv=require(_0x4c96('0x9'));var ejs=require(_0x4c96('0xa'));var fs=require('fs');var _=require(_0x4c96('0xb'));var squel=require(_0x4c96('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c96('0xd'));var deskjs=require(_0x4c96('0xe'));var toCsv=require(_0x4c96('0x9'));var querystring=require('querystring');var Papa=require(_0x4c96('0xf'));var Redis=require(_0x4c96('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c96('0x11'))(_0x4c96('0x12'));var utils=require(_0x4c96('0x13'));var config=require('../../config/environment');var db=require(_0x4c96('0x14'))['db'];function respondWithStatusCode(_0x513a79,_0x50267d){_0x50267d=_0x50267d||0xcc;return function(_0xee3c14){if(_0xee3c14){return _0x513a79[_0x4c96('0x15')](_0x50267d);}return _0x513a79[_0x4c96('0x16')](_0x50267d)['end']();};}function respondWithResult(_0x5dddff,_0x28bb9d){_0x28bb9d=_0x28bb9d||0xc8;return function(_0x176ea7){if(_0x176ea7){return _0x5dddff[_0x4c96('0x16')](_0x28bb9d)['json'](_0x176ea7);}};}function respondWithFilteredResult(_0xe42458,_0x334165){return function(_0x167537){if(_0x167537){var _0x3c6fce=_0x167537['count'],_0x433608=_0x334165[_0x4c96('0x17')],_0x66964b=_0x334165['offset']+_0x334165[_0x4c96('0x18')],_0xeb18f3;if(_0x66964b>=_0x3c6fce){_0x66964b=_0x3c6fce;_0xeb18f3=0xc8;}else{_0xeb18f3=0xce;}_0xe42458['status'](_0xeb18f3);return _0xe42458[_0x4c96('0x19')]('Content-Range',_0x433608+'-'+_0x66964b+'/'+_0x3c6fce)[_0x4c96('0x1a')](_0x167537);}return null;};}function patchUpdates(_0x1807b6){return function(_0x2c8974){try{jsonpatch[_0x4c96('0x1b')](_0x2c8974,_0x1807b6,!![]);}catch(_0x8a802a){return BPromise[_0x4c96('0x1c')](_0x8a802a);}return _0x2c8974[_0x4c96('0x1d')]();};}function saveUpdates(_0x3595e6,_0x2202ec){return function(_0x9546c5){if(_0x9546c5){return _0x9546c5[_0x4c96('0x1e')](_0x3595e6)['then'](function(_0x5018b5){return _0x5018b5;});}return null;};}function removeEntity(_0x5ea092,_0x157465){return function(_0x13eaa0){if(_0x13eaa0){return _0x13eaa0[_0x4c96('0x1f')]()[_0x4c96('0x20')](function(){_0x5ea092[_0x4c96('0x16')](0xcc)[_0x4c96('0x21')]();});}};}function handleEntityNotFound(_0x5b549c,_0x25d9a0){return function(_0x451c6c){if(!_0x451c6c){_0x5b549c[_0x4c96('0x15')](0x194);}return _0x451c6c;};}function handleError(_0x31a854,_0x2f6f93){_0x2f6f93=_0x2f6f93||0x1f4;return function(_0x23fbfa){logger['error'](_0x23fbfa[_0x4c96('0x22')]);if(_0x23fbfa[_0x4c96('0x23')]){delete _0x23fbfa['name'];}_0x31a854[_0x4c96('0x16')](_0x2f6f93)['send'](_0x23fbfa);};}exports[_0x4c96('0x24')]=function(_0x2a7605,_0x25b276){var _0x1543d8={},_0x59a913={},_0x20c94f={'count':0x0,'rows':[]};var _0x80b4fb=db[_0x4c96('0x25')][_0x4c96('0x26')];_0x59a913[_0x4c96('0x27')]=_[_0x4c96('0x28')](_0x80b4fb);_0x59a913['query']=_[_0x4c96('0x28')](_0x2a7605[_0x4c96('0x29')]);_0x59a913[_0x4c96('0x2a')]=_[_0x4c96('0x2b')](_0x59a913[_0x4c96('0x27')],_0x59a913[_0x4c96('0x29')]);_0x1543d8['attributes']=_['intersection'](_0x59a913[_0x4c96('0x27')],qs[_0x4c96('0x2c')](_0x2a7605[_0x4c96('0x29')][_0x4c96('0x2c')]));_0x1543d8[_0x4c96('0x2d')]=_0x1543d8['attributes'][_0x4c96('0x2e')]?_0x1543d8['attributes']:_0x59a913[_0x4c96('0x27')];if(!_0x2a7605['query'][_0x4c96('0x2f')](_0x4c96('0x30'))){_0x1543d8[_0x4c96('0x18')]=qs[_0x4c96('0x18')](_0x2a7605[_0x4c96('0x29')][_0x4c96('0x18')]);_0x1543d8[_0x4c96('0x17')]=qs[_0x4c96('0x17')](_0x2a7605[_0x4c96('0x29')][_0x4c96('0x17')]);}_0x1543d8[_0x4c96('0x31')]=qs[_0x4c96('0x32')](_0x2a7605[_0x4c96('0x29')][_0x4c96('0x32')]);_0x1543d8[_0x4c96('0x33')]=qs['filters'](_[_0x4c96('0x34')](_0x2a7605[_0x4c96('0x29')],_0x59a913[_0x4c96('0x2a')]));if(_0x2a7605['query'][_0x4c96('0x35')]){_0x1543d8['where']=_[_0x4c96('0x36')](_0x1543d8['where'],{'$or':_[_0x4c96('0x37')](_0x80b4fb,function(_0x1dde52){if(_0x1dde52[_0x4c96('0x38')]['key']!=='VIRTUAL'){var _0x367230={};_0x367230[_0x1dde52[_0x4c96('0x39')]]={'$like':'%'+_0x2a7605['query'][_0x4c96('0x35')]+'%'};return _0x367230;}})});}_0x1543d8=_[_0x4c96('0x36')]({},_0x1543d8,_0x2a7605[_0x4c96('0x3a')]);var _0x3eff8b={'where':_0x1543d8['where']};return db[_0x4c96('0x25')][_0x4c96('0x3b')](_0x3eff8b)[_0x4c96('0x20')](function(_0x112116){_0x20c94f[_0x4c96('0x3b')]=_0x112116;if(_0x2a7605['query'][_0x4c96('0x3c')]){_0x1543d8[_0x4c96('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0x4c96('0x3e')](_0x1543d8);})[_0x4c96('0x20')](function(_0x17363d){_0x20c94f[_0x4c96('0x3f')]=_0x17363d;return _0x20c94f;})[_0x4c96('0x20')](respondWithFilteredResult(_0x25b276,_0x1543d8))[_0x4c96('0x40')](handleError(_0x25b276,null));};exports[_0x4c96('0x41')]=function(_0x4ec909,_0x3afcae){var _0xeece9a={'raw':!![],'where':{'id':_0x4ec909[_0x4c96('0x42')]['id']}},_0x2e0001={};_0x2e0001[_0x4c96('0x27')]=_[_0x4c96('0x28')](db[_0x4c96('0x25')][_0x4c96('0x26')]);_0x2e0001[_0x4c96('0x29')]=_[_0x4c96('0x28')](_0x4ec909['query']);_0x2e0001[_0x4c96('0x2a')]=_[_0x4c96('0x2b')](_0x2e0001[_0x4c96('0x27')],_0x2e0001[_0x4c96('0x29')]);_0xeece9a[_0x4c96('0x2d')]=_['intersection'](_0x2e0001[_0x4c96('0x27')],qs[_0x4c96('0x2c')](_0x4ec909[_0x4c96('0x29')][_0x4c96('0x2c')]));_0xeece9a['attributes']=_0xeece9a[_0x4c96('0x2d')][_0x4c96('0x2e')]?_0xeece9a[_0x4c96('0x2d')]:_0x2e0001[_0x4c96('0x27')];if(_0x4ec909[_0x4c96('0x29')]['includeAll']){_0xeece9a[_0x4c96('0x3d')]=[{'all':!![]}];}_0xeece9a=_[_0x4c96('0x36')]({},_0xeece9a,_0x4ec909[_0x4c96('0x3a')]);return db[_0x4c96('0x25')][_0x4c96('0x43')](_0xeece9a)['then'](handleEntityNotFound(_0x3afcae,null))['then'](respondWithResult(_0x3afcae,null))[_0x4c96('0x40')](handleError(_0x3afcae,null));};exports['create']=function(_0x5f0da4,_0x3acfca){return db[_0x4c96('0x25')][_0x4c96('0x44')](_0x5f0da4[_0x4c96('0x45')],{})[_0x4c96('0x20')](respondWithResult(_0x3acfca,0xc9))[_0x4c96('0x40')](handleError(_0x3acfca,null));};exports[_0x4c96('0x1e')]=function(_0x8da47c,_0x28ecd7){if(_0x8da47c['body']['id']){delete _0x8da47c[_0x4c96('0x45')]['id'];}return db[_0x4c96('0x25')][_0x4c96('0x43')]({'where':{'id':_0x8da47c[_0x4c96('0x42')]['id']}})[_0x4c96('0x20')](handleEntityNotFound(_0x28ecd7,null))['then'](saveUpdates(_0x8da47c[_0x4c96('0x45')],null))[_0x4c96('0x20')](respondWithResult(_0x28ecd7,null))['catch'](handleError(_0x28ecd7,null));};exports['destroy']=function(_0x106620,_0x33ba81){return db[_0x4c96('0x25')]['find']({'where':{'id':_0x106620[_0x4c96('0x42')]['id']}})[_0x4c96('0x20')](handleEntityNotFound(_0x33ba81,null))['then'](removeEntity(_0x33ba81,null))[_0x4c96('0x40')](handleError(_0x33ba81,null));};exports[_0x4c96('0x46')]=function(_0x407688,_0x564970){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x564970,null))[_0x4c96('0x40')](handleError(_0x564970,null));}; \ No newline at end of file +var _0xad53=['sendStatus','stack','name','send','index','MailSubstatus','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','field','options','count','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','Content-Range','json','reject','save','update','then','destroy'];(function(_0x37fca9,_0x55a5d3){var _0x1581e2=function(_0xdafdd0){while(--_0xdafdd0){_0x37fca9['push'](_0x37fca9['shift']());}};_0x1581e2(++_0x55a5d3);}(_0xad53,0x1ea));var _0x3ad5=function(_0x4c2ec2,_0x225f80){_0x4c2ec2=_0x4c2ec2-0x0;var _0x31bf80=_0xad53[_0x4c2ec2];return _0x31bf80;};'use strict';var pdf=require(_0x3ad5('0x0'));var emlformat=require(_0x3ad5('0x1'));var rimraf=require(_0x3ad5('0x2'));var zipdir=require(_0x3ad5('0x3'));var jsonpatch=require(_0x3ad5('0x4'));var rp=require(_0x3ad5('0x5'));var moment=require(_0x3ad5('0x6'));var BPromise=require(_0x3ad5('0x7'));var Mustache=require('mustache');var util=require(_0x3ad5('0x8'));var path=require(_0x3ad5('0x9'));var sox=require(_0x3ad5('0xa'));var csv=require(_0x3ad5('0xb'));var ejs=require(_0x3ad5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ad5('0xd'));var deskjs=require(_0x3ad5('0xe'));var toCsv=require(_0x3ad5('0xb'));var querystring=require(_0x3ad5('0xf'));var Papa=require(_0x3ad5('0x10'));var Redis=require(_0x3ad5('0x11'));var authService=require(_0x3ad5('0x12'));var qs=require(_0x3ad5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ad5('0x14'))(_0x3ad5('0x15'));var utils=require(_0x3ad5('0x16'));var config=require(_0x3ad5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b1b5d,_0x33ac31){_0x33ac31=_0x33ac31||0xcc;return function(_0x1dc68b){if(_0x1dc68b){return _0x4b1b5d['sendStatus'](_0x33ac31);}return _0x4b1b5d[_0x3ad5('0x18')](_0x33ac31)[_0x3ad5('0x19')]();};}function respondWithResult(_0x2d12cf,_0x214a29){_0x214a29=_0x214a29||0xc8;return function(_0x2cfe73){if(_0x2cfe73){return _0x2d12cf[_0x3ad5('0x18')](_0x214a29)['json'](_0x2cfe73);}};}function respondWithFilteredResult(_0x5bdecb,_0x412b7a){return function(_0x278364){if(_0x278364){var _0xabcbc0=_0x278364['count'],_0x70aec9=_0x412b7a['offset'],_0x1d5868=_0x412b7a[_0x3ad5('0x1a')]+_0x412b7a[_0x3ad5('0x1b')],_0x365f38;if(_0x1d5868>=_0xabcbc0){_0x1d5868=_0xabcbc0;_0x365f38=0xc8;}else{_0x365f38=0xce;}_0x5bdecb['status'](_0x365f38);return _0x5bdecb['set'](_0x3ad5('0x1c'),_0x70aec9+'-'+_0x1d5868+'/'+_0xabcbc0)[_0x3ad5('0x1d')](_0x278364);}return null;};}function patchUpdates(_0x179cda){return function(_0x2a5e60){try{jsonpatch['apply'](_0x2a5e60,_0x179cda,!![]);}catch(_0xb97fb9){return BPromise[_0x3ad5('0x1e')](_0xb97fb9);}return _0x2a5e60[_0x3ad5('0x1f')]();};}function saveUpdates(_0xa639,_0x7250f7){return function(_0x1c37c7){if(_0x1c37c7){return _0x1c37c7[_0x3ad5('0x20')](_0xa639)[_0x3ad5('0x21')](function(_0x177760){return _0x177760;});}return null;};}function removeEntity(_0x5721e8,_0x98dfb5){return function(_0x4d00e2){if(_0x4d00e2){return _0x4d00e2[_0x3ad5('0x22')]()['then'](function(){_0x5721e8[_0x3ad5('0x18')](0xcc)[_0x3ad5('0x19')]();});}};}function handleEntityNotFound(_0x1dcde4,_0xeaf8f7){return function(_0x24d2ee){if(!_0x24d2ee){_0x1dcde4[_0x3ad5('0x23')](0x194);}return _0x24d2ee;};}function handleError(_0x4c59dc,_0x437b4c){_0x437b4c=_0x437b4c||0x1f4;return function(_0x1aa2e9){logger['error'](_0x1aa2e9[_0x3ad5('0x24')]);if(_0x1aa2e9[_0x3ad5('0x25')]){delete _0x1aa2e9[_0x3ad5('0x25')];}_0x4c59dc['status'](_0x437b4c)[_0x3ad5('0x26')](_0x1aa2e9);};}exports[_0x3ad5('0x27')]=function(_0x40da5d,_0x4d73b1){var _0x512d41={},_0x578463={},_0x33c53e={'count':0x0,'rows':[]};var _0x4674f2=db[_0x3ad5('0x28')]['rawAttributes'];_0x578463[_0x3ad5('0x29')]=_[_0x3ad5('0x2a')](_0x4674f2);_0x578463['query']=_['keys'](_0x40da5d[_0x3ad5('0x2b')]);_0x578463['filters']=_[_0x3ad5('0x2c')](_0x578463[_0x3ad5('0x29')],_0x578463[_0x3ad5('0x2b')]);_0x512d41[_0x3ad5('0x2d')]=_[_0x3ad5('0x2c')](_0x578463['model'],qs['fields'](_0x40da5d[_0x3ad5('0x2b')][_0x3ad5('0x2e')]));_0x512d41[_0x3ad5('0x2d')]=_0x512d41[_0x3ad5('0x2d')]['length']?_0x512d41[_0x3ad5('0x2d')]:_0x578463[_0x3ad5('0x29')];if(!_0x40da5d[_0x3ad5('0x2b')][_0x3ad5('0x2f')](_0x3ad5('0x30'))){_0x512d41[_0x3ad5('0x1b')]=qs[_0x3ad5('0x1b')](_0x40da5d[_0x3ad5('0x2b')][_0x3ad5('0x1b')]);_0x512d41[_0x3ad5('0x1a')]=qs['offset'](_0x40da5d[_0x3ad5('0x2b')][_0x3ad5('0x1a')]);}_0x512d41[_0x3ad5('0x31')]=qs[_0x3ad5('0x32')](_0x40da5d[_0x3ad5('0x2b')][_0x3ad5('0x32')]);_0x512d41[_0x3ad5('0x33')]=qs['filters'](_['pick'](_0x40da5d[_0x3ad5('0x2b')],_0x578463[_0x3ad5('0x34')]));if(_0x40da5d['query'][_0x3ad5('0x35')]){_0x512d41[_0x3ad5('0x33')]=_[_0x3ad5('0x36')](_0x512d41[_0x3ad5('0x33')],{'$or':_[_0x3ad5('0x37')](_0x4674f2,function(_0x6b9dbe){if(_0x6b9dbe[_0x3ad5('0x38')][_0x3ad5('0x39')]!==_0x3ad5('0x3a')){var _0x256c59={};_0x256c59[_0x6b9dbe[_0x3ad5('0x3b')]]={'$like':'%'+_0x40da5d[_0x3ad5('0x2b')][_0x3ad5('0x35')]+'%'};return _0x256c59;}})});}_0x512d41=_['merge']({},_0x512d41,_0x40da5d[_0x3ad5('0x3c')]);var _0x5cf352={'where':_0x512d41[_0x3ad5('0x33')]};return db[_0x3ad5('0x28')][_0x3ad5('0x3d')](_0x5cf352)[_0x3ad5('0x21')](function(_0x1d9393){_0x33c53e[_0x3ad5('0x3d')]=_0x1d9393;if(_0x40da5d[_0x3ad5('0x2b')]['includeAll']){_0x512d41['include']=[{'all':!![]}];}return db[_0x3ad5('0x28')][_0x3ad5('0x3e')](_0x512d41);})[_0x3ad5('0x21')](function(_0x1a9b61){_0x33c53e[_0x3ad5('0x3f')]=_0x1a9b61;return _0x33c53e;})[_0x3ad5('0x21')](respondWithFilteredResult(_0x4d73b1,_0x512d41))[_0x3ad5('0x40')](handleError(_0x4d73b1,null));};exports[_0x3ad5('0x41')]=function(_0x462e00,_0x135fa0){var _0xdece6d={'raw':!![],'where':{'id':_0x462e00[_0x3ad5('0x42')]['id']}},_0x3ea7e5={};_0x3ea7e5[_0x3ad5('0x29')]=_[_0x3ad5('0x2a')](db[_0x3ad5('0x28')][_0x3ad5('0x43')]);_0x3ea7e5[_0x3ad5('0x2b')]=_['keys'](_0x462e00['query']);_0x3ea7e5[_0x3ad5('0x34')]=_[_0x3ad5('0x2c')](_0x3ea7e5['model'],_0x3ea7e5[_0x3ad5('0x2b')]);_0xdece6d['attributes']=_['intersection'](_0x3ea7e5[_0x3ad5('0x29')],qs[_0x3ad5('0x2e')](_0x462e00[_0x3ad5('0x2b')][_0x3ad5('0x2e')]));_0xdece6d[_0x3ad5('0x2d')]=_0xdece6d[_0x3ad5('0x2d')][_0x3ad5('0x44')]?_0xdece6d['attributes']:_0x3ea7e5[_0x3ad5('0x29')];if(_0x462e00[_0x3ad5('0x2b')][_0x3ad5('0x45')]){_0xdece6d[_0x3ad5('0x46')]=[{'all':!![]}];}_0xdece6d=_[_0x3ad5('0x36')]({},_0xdece6d,_0x462e00['options']);return db[_0x3ad5('0x28')][_0x3ad5('0x47')](_0xdece6d)[_0x3ad5('0x21')](handleEntityNotFound(_0x135fa0,null))[_0x3ad5('0x21')](respondWithResult(_0x135fa0,null))['catch'](handleError(_0x135fa0,null));};exports['create']=function(_0x54af98,_0x357877){return db[_0x3ad5('0x28')][_0x3ad5('0x48')](_0x54af98[_0x3ad5('0x49')],{})['then'](respondWithResult(_0x357877,0xc9))['catch'](handleError(_0x357877,null));};exports[_0x3ad5('0x20')]=function(_0x4170d1,_0xf8ffe4){if(_0x4170d1['body']['id']){delete _0x4170d1[_0x3ad5('0x49')]['id'];}return db[_0x3ad5('0x28')]['find']({'where':{'id':_0x4170d1[_0x3ad5('0x42')]['id']}})[_0x3ad5('0x21')](handleEntityNotFound(_0xf8ffe4,null))[_0x3ad5('0x21')](saveUpdates(_0x4170d1['body'],null))['then'](respondWithResult(_0xf8ffe4,null))[_0x3ad5('0x40')](handleError(_0xf8ffe4,null));};exports['destroy']=function(_0x256c1d,_0x5351d9){return db[_0x3ad5('0x28')][_0x3ad5('0x47')]({'where':{'id':_0x256c1d['params']['id']}})[_0x3ad5('0x21')](handleEntityNotFound(_0x5351d9,null))[_0x3ad5('0x21')](removeEntity(_0x5351d9,null))[_0x3ad5('0x40')](handleError(_0x5351d9,null));};exports['describe']=function(_0x4871cd,_0x2e0af){return db[_0x3ad5('0x28')][_0x3ad5('0x4a')]()[_0x3ad5('0x21')](respondWithResult(_0x2e0af,null))[_0x3ad5('0x40')](handleError(_0x2e0af,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ee00a1a..5c78661 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 _0x9978=['exports','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9978,0x153));var _0x8997=function(_0x3185f0,_0xbb446c){_0x3185f0=_0x3185f0-0x0;var _0x4f8704=_0x9978[_0x3185f0];return _0x4f8704;};'use strict';var _=require('lodash');var util=require(_0x8997('0x0'));var logger=require(_0x8997('0x1'))(_0x8997('0x2'));var moment=require(_0x8997('0x3'));var BPromise=require(_0x8997('0x4'));var rp=require(_0x8997('0x5'));var fs=require('fs');var path=require(_0x8997('0x6'));var rimraf=require(_0x8997('0x7'));var config=require(_0x8997('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0x8997('0x9')]=function(_0x32bf0a,_0x1af4fc){return _0x32bf0a['define'](_0x8997('0xa'),attributes,{'tableName':_0x8997('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc39=['../../config/environment','exports','define','MailSubstatus','mail_substatuses','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x50c241,_0x26690b){var _0x5f4943=function(_0x4f8871){while(--_0x4f8871){_0x50c241['push'](_0x50c241['shift']());}};_0x5f4943(++_0x26690b);}(_0xdc39,0xc3));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9dc3('0x0'))(_0x9dc3('0x1'));var moment=require('moment');var BPromise=require(_0x9dc3('0x2'));var rp=require(_0x9dc3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9dc3('0x4'));var config=require(_0x9dc3('0x5'));var attributes=require('./mailSubstatus.attributes');module[_0x9dc3('0x6')]=function(_0x5305f0,_0x1586d2){return _0x5305f0[_0x9dc3('0x7')](_0x9dc3('0x8'),attributes,{'tableName':_0x9dc3('0x9'),'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 ba016e3..9e01060 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 _0x6f47=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x3e7950,_0x15c648){var _0x36f1d6=function(_0x3ba444){while(--_0x3ba444){_0x3e7950['push'](_0x3e7950['shift']());}};_0x36f1d6(++_0x15c648);}(_0x6f47,0x78));var _0x76f4=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6f47[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x76f4('0x0'));var util=require('util');var moment=require(_0x76f4('0x1'));var BPromise=require(_0x76f4('0x2'));var rs=require(_0x76f4('0x3'));var fs=require('fs');var Redis=require(_0x76f4('0x4'));var db=require(_0x76f4('0x5'))['db'];var utils=require(_0x76f4('0x6'));var logger=require('../../config/logger')(_0x76f4('0x7'));var config=require(_0x76f4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x176493,_0x3460b3,_0x51e8df){return new BPromise(function(_0x638cd8,_0x3fe740){return client[_0x76f4('0xa')](_0x176493,_0x51e8df)[_0x76f4('0xb')](function(_0x2c7f68){logger[_0x76f4('0xc')](_0x76f4('0xd'),_0x3460b3,_0x76f4('0xe'));logger[_0x76f4('0xf')](_0x76f4('0x10'),_0x3460b3,'request\x20sent',JSON['stringify'](_0x2c7f68));if(_0x2c7f68[_0x76f4('0x11')]){if(_0x2c7f68[_0x76f4('0x11')][_0x76f4('0x12')]===0x1f4){logger[_0x76f4('0x11')](_0x76f4('0xd'),_0x3460b3,_0x2c7f68[_0x76f4('0x11')][_0x76f4('0x13')]);return _0x3fe740(_0x2c7f68[_0x76f4('0x11')][_0x76f4('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3460b3,_0x2c7f68['error'][_0x76f4('0x13')]);return _0x638cd8(_0x2c7f68[_0x76f4('0x11')][_0x76f4('0x13')]);}else{logger[_0x76f4('0xc')](_0x76f4('0xd'),_0x3460b3,_0x76f4('0xe'));_0x638cd8(_0x2c7f68[_0x76f4('0x14')][_0x76f4('0x13')]);}})[_0x76f4('0x15')](function(_0x2a0f15){logger[_0x76f4('0x11')](_0x76f4('0xd'),_0x3460b3,_0x2a0f15);_0x3fe740(_0x2a0f15);});});} \ No newline at end of file +var _0x4def=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client'];(function(_0x498bab,_0x32eb74){var _0x180190=function(_0x5d93d2){while(--_0x5d93d2){_0x498bab['push'](_0x498bab['shift']());}};_0x180190(++_0x32eb74);}(_0x4def,0x196));var _0xf4de=function(_0x3360f3,_0x344f01){_0x3360f3=_0x3360f3-0x0;var _0x45e856=_0x4def[_0x3360f3];return _0x45e856;};'use strict';var _=require(_0xf4de('0x0'));var util=require(_0xf4de('0x1'));var moment=require(_0xf4de('0x2'));var BPromise=require(_0xf4de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4de('0x4'));var config=require(_0xf4de('0x5'));var jayson=require(_0xf4de('0x6'));var client=jayson[_0xf4de('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3488fb,_0x3c8151,_0x2edcf9){return new BPromise(function(_0x86a5db,_0x988bdf){return client['request'](_0x3488fb,_0x2edcf9)[_0xf4de('0x8')](function(_0x23c093){logger[_0xf4de('0x9')](_0xf4de('0xa'),_0x3c8151,_0xf4de('0xb'));logger[_0xf4de('0xc')](_0xf4de('0xd'),_0x3c8151,_0xf4de('0xb'),JSON['stringify'](_0x23c093));if(_0x23c093['error']){if(_0x23c093[_0xf4de('0xe')]['code']===0x1f4){logger[_0xf4de('0xe')](_0xf4de('0xa'),_0x3c8151,_0x23c093[_0xf4de('0xe')][_0xf4de('0xf')]);return _0x988bdf(_0x23c093[_0xf4de('0xe')][_0xf4de('0xf')]);}logger['error'](_0xf4de('0xa'),_0x3c8151,_0x23c093[_0xf4de('0xe')][_0xf4de('0xf')]);return _0x86a5db(_0x23c093[_0xf4de('0xe')][_0xf4de('0xf')]);}else{logger[_0xf4de('0x9')](_0xf4de('0xa'),_0x3c8151,_0xf4de('0xb'));_0x86a5db(_0x23c093[_0xf4de('0x10')]['message']);}})[_0xf4de('0x11')](function(_0x229d68){logger[_0xf4de('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x3c8151,_0x229d68);_0x988bdf(_0x229d68);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cb9ad89..c6e049b 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 _0xa23f=['/:id','show','post','update','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x24509e,_0xef1120){var _0x38fc30=function(_0x4062e5){while(--_0x4062e5){_0x24509e['push'](_0x24509e['shift']());}};_0x38fc30(++_0xef1120);}(_0xa23f,0x7c));var _0xfa23=function(_0x544aec,_0x24c9e){_0x544aec=_0x544aec-0x0;var _0x1597f4=_0xa23f[_0x544aec];return _0x1597f4;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var auth=require(_0xfa23('0x4'));var interaction=require(_0xfa23('0x5'));var config=require('../../config/environment');var controller=require(_0xfa23('0x6'));router['get']('/',auth[_0xfa23('0x7')](),controller[_0xfa23('0x8')]);router[_0xfa23('0x9')](_0xfa23('0xa'),auth['isAuthenticated'](),controller[_0xfa23('0xb')]);router['get'](_0xfa23('0xc'),auth[_0xfa23('0x7')](),controller[_0xfa23('0xd')]);router[_0xfa23('0xe')]('/',auth[_0xfa23('0x7')](),controller['create']);router['put'](_0xfa23('0xc'),auth['isAuthenticated'](),controller[_0xfa23('0xf')]);router['delete'](_0xfa23('0xc'),auth[_0xfa23('0x7')](),controller[_0xfa23('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeff8=['index','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xeff8,0x186));var _0x8eff=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0xeff8[_0x3b96cf];return _0x2e315a;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8eff('0x5'));var config=require(_0x8eff('0x6'));var controller=require(_0x8eff('0x7'));router[_0x8eff('0x8')]('/',auth['isAuthenticated'](),controller[_0x8eff('0x9')]);router[_0x8eff('0x8')](_0x8eff('0xa'),auth[_0x8eff('0xb')](),controller['describe']);router[_0x8eff('0x8')](_0x8eff('0xc'),auth[_0x8eff('0xb')](),controller[_0x8eff('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8eff('0xe')]);router[_0x8eff('0xf')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0x10')]);router[_0x8eff('0x11')]('/:id',auth[_0x8eff('0xb')](),controller[_0x8eff('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index fe82df3..c81f90e 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 _0xd83c=['exports','STRING','ENUM','account','queue','DATE','NOW','moment'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xd83c,0xe7));var _0xcd83=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0xd83c[_0x4e4519];return _0x340044;};'use strict';var moment=require(_0xcd83('0x0'));var Sequelize=require('sequelize');module[_0xcd83('0x1')]={'uniqueid':{'type':Sequelize[_0xcd83('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcd83('0x3')](_0xcd83('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0xcd83('0x5')},'transferredAt':{'type':Sequelize[_0xcd83('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xcd83('0x7')]}}; \ No newline at end of file +var _0x7462=['moment','sequelize','exports','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x36a4bc,_0x3939a5){var _0x2d55fc=function(_0x798e32){while(--_0x798e32){_0x36a4bc['push'](_0x36a4bc['shift']());}};_0x2d55fc(++_0x3939a5);}(_0x7462,0x195));var _0x2746=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x7462[_0x5471ec];return _0x121d4c;};'use strict';var moment=require(_0x2746('0x0'));var Sequelize=require(_0x2746('0x1'));module[_0x2746('0x2')]={'uniqueid':{'type':Sequelize[_0x2746('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2746('0x4')]('account',_0x2746('0x5'),'queue'),'allowNull':![],'defaultValue':_0x2746('0x6')},'transferredAt':{'type':Sequelize[_0x2746('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x2746('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e72baf4..7e22f5d 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 _0x4491=['sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','MailTransferReport','includeAll','findAll','catch','show','params','include','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','then','destroy','error','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x3f5574,_0x1601fb){var _0x42c2b4=function(_0x26fcbc){while(--_0x26fcbc){_0x3f5574['push'](_0x3f5574['shift']());}};_0x42c2b4(++_0x1601fb);}(_0x4491,0x189));var _0x1449=function(_0x18bbfe,_0x8c85ad){_0x18bbfe=_0x18bbfe-0x0;var _0xfe9141=_0x4491[_0x18bbfe];return _0xfe9141;};'use strict';var pdf=require(_0x1449('0x0'));var emlformat=require(_0x1449('0x1'));var rimraf=require(_0x1449('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1449('0x3'));var rp=require(_0x1449('0x4'));var moment=require(_0x1449('0x5'));var BPromise=require(_0x1449('0x6'));var Mustache=require(_0x1449('0x7'));var util=require(_0x1449('0x8'));var path=require(_0x1449('0x9'));var sox=require(_0x1449('0xa'));var csv=require(_0x1449('0xb'));var ejs=require(_0x1449('0xc'));var fs=require('fs');var _=require(_0x1449('0xd'));var squel=require(_0x1449('0xe'));var crypto=require(_0x1449('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1449('0x10'));var toCsv=require(_0x1449('0xb'));var querystring=require(_0x1449('0x11'));var Papa=require(_0x1449('0x12'));var Redis=require('ioredis');var authService=require(_0x1449('0x13'));var qs=require(_0x1449('0x14'));var hardwareService=require(_0x1449('0x15'));var logger=require(_0x1449('0x16'))(_0x1449('0x17'));var utils=require(_0x1449('0x18'));var config=require('../../config/environment');var db=require(_0x1449('0x19'))['db'];function respondWithStatusCode(_0x230a0a,_0x14709b){_0x14709b=_0x14709b||0xcc;return function(_0x1829f1){if(_0x1829f1){return _0x230a0a[_0x1449('0x1a')](_0x14709b);}return _0x230a0a[_0x1449('0x1b')](_0x14709b)['end']();};}function respondWithResult(_0x397958,_0x379554){_0x379554=_0x379554||0xc8;return function(_0x4cbe64){if(_0x4cbe64){return _0x397958[_0x1449('0x1b')](_0x379554)[_0x1449('0x1c')](_0x4cbe64);}};}function respondWithFilteredResult(_0x524b48,_0x387470){return function(_0x4eb6b8){if(_0x4eb6b8){var _0x4d7a3b=_0x4eb6b8[_0x1449('0x1d')],_0x838d7c=_0x387470[_0x1449('0x1e')],_0x1c79f9=_0x387470[_0x1449('0x1e')]+_0x387470['limit'],_0x2f91aa;if(_0x1c79f9>=_0x4d7a3b){_0x1c79f9=_0x4d7a3b;_0x2f91aa=0xc8;}else{_0x2f91aa=0xce;}_0x524b48[_0x1449('0x1b')](_0x2f91aa);return _0x524b48['set'](_0x1449('0x1f'),_0x838d7c+'-'+_0x1c79f9+'/'+_0x4d7a3b)[_0x1449('0x1c')](_0x4eb6b8);}return null;};}function patchUpdates(_0x10f1f9){return function(_0x585d79){try{jsonpatch['apply'](_0x585d79,_0x10f1f9,!![]);}catch(_0x377c9f){return BPromise['reject'](_0x377c9f);}return _0x585d79['save']();};}function saveUpdates(_0xe14a36,_0xdfca8f){return function(_0x524834){if(_0x524834){return _0x524834['update'](_0xe14a36)[_0x1449('0x20')](function(_0x4a2656){return _0x4a2656;});}return null;};}function removeEntity(_0x448b49,_0x34a6fa){return function(_0x19ab05){if(_0x19ab05){return _0x19ab05[_0x1449('0x21')]()[_0x1449('0x20')](function(){_0x448b49[_0x1449('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da11d,_0x30947c){return function(_0x959438){if(!_0x959438){_0x5da11d[_0x1449('0x1a')](0x194);}return _0x959438;};}function handleError(_0xb7b2ae,_0x3f4e29){_0x3f4e29=_0x3f4e29||0x1f4;return function(_0x38327e){logger[_0x1449('0x22')](_0x38327e['stack']);if(_0x38327e[_0x1449('0x23')]){delete _0x38327e['name'];}_0xb7b2ae[_0x1449('0x1b')](_0x3f4e29)[_0x1449('0x24')](_0x38327e);};}exports[_0x1449('0x25')]=function(_0x5826d9,_0x12a05d){var _0x324442={},_0x5660c4={},_0x166d2f={'count':0x0,'rows':[]};var _0x22eded=db['MailTransferReport'][_0x1449('0x26')];_0x5660c4[_0x1449('0x27')]=_[_0x1449('0x28')](_0x22eded);_0x5660c4[_0x1449('0x29')]=_[_0x1449('0x28')](_0x5826d9[_0x1449('0x29')]);_0x5660c4[_0x1449('0x2a')]=_[_0x1449('0x2b')](_0x5660c4[_0x1449('0x27')],_0x5660c4['query']);_0x324442[_0x1449('0x2c')]=_[_0x1449('0x2b')](_0x5660c4[_0x1449('0x27')],qs[_0x1449('0x2d')](_0x5826d9['query'][_0x1449('0x2d')]));_0x324442[_0x1449('0x2c')]=_0x324442[_0x1449('0x2c')][_0x1449('0x2e')]?_0x324442[_0x1449('0x2c')]:_0x5660c4['model'];if(!_0x5826d9[_0x1449('0x29')][_0x1449('0x2f')](_0x1449('0x30'))){_0x324442[_0x1449('0x31')]=qs[_0x1449('0x31')](_0x5826d9[_0x1449('0x29')][_0x1449('0x31')]);_0x324442[_0x1449('0x1e')]=qs[_0x1449('0x1e')](_0x5826d9['query'][_0x1449('0x1e')]);}_0x324442[_0x1449('0x32')]=qs[_0x1449('0x33')](_0x5826d9[_0x1449('0x29')][_0x1449('0x33')]);_0x324442[_0x1449('0x34')]=qs[_0x1449('0x2a')](_[_0x1449('0x35')](_0x5826d9[_0x1449('0x29')],_0x5660c4[_0x1449('0x2a')]));if(_0x5826d9[_0x1449('0x29')][_0x1449('0x36')]){_0x324442[_0x1449('0x34')]=_[_0x1449('0x37')](_0x324442[_0x1449('0x34')],{'$or':_[_0x1449('0x38')](_0x22eded,function(_0x4455ae){if(_0x4455ae[_0x1449('0x39')][_0x1449('0x3a')]!==_0x1449('0x3b')){var _0x5d622c={};_0x5d622c[_0x4455ae[_0x1449('0x3c')]]={'$like':'%'+_0x5826d9[_0x1449('0x29')]['filter']+'%'};return _0x5d622c;}})});}_0x324442=_[_0x1449('0x37')]({},_0x324442,_0x5826d9[_0x1449('0x3d')]);var _0x5dff23={'where':_0x324442[_0x1449('0x34')]};return db[_0x1449('0x3e')][_0x1449('0x1d')](_0x5dff23)[_0x1449('0x20')](function(_0x2dc5b1){_0x166d2f[_0x1449('0x1d')]=_0x2dc5b1;if(_0x5826d9[_0x1449('0x29')][_0x1449('0x3f')]){_0x324442['include']=[{'all':!![]}];}return db[_0x1449('0x3e')][_0x1449('0x40')](_0x324442);})['then'](function(_0x5a830f){_0x166d2f['rows']=_0x5a830f;return _0x166d2f;})[_0x1449('0x20')](respondWithFilteredResult(_0x12a05d,_0x324442))[_0x1449('0x41')](handleError(_0x12a05d,null));};exports[_0x1449('0x42')]=function(_0x381c10,_0x38957f){var _0x4551e0={'raw':!![],'where':{'id':_0x381c10[_0x1449('0x43')]['id']}},_0x30286a={};_0x30286a[_0x1449('0x27')]=_[_0x1449('0x28')](db[_0x1449('0x3e')][_0x1449('0x26')]);_0x30286a['query']=_['keys'](_0x381c10[_0x1449('0x29')]);_0x30286a[_0x1449('0x2a')]=_[_0x1449('0x2b')](_0x30286a[_0x1449('0x27')],_0x30286a[_0x1449('0x29')]);_0x4551e0[_0x1449('0x2c')]=_[_0x1449('0x2b')](_0x30286a[_0x1449('0x27')],qs['fields'](_0x381c10['query'][_0x1449('0x2d')]));_0x4551e0['attributes']=_0x4551e0['attributes'][_0x1449('0x2e')]?_0x4551e0[_0x1449('0x2c')]:_0x30286a[_0x1449('0x27')];if(_0x381c10[_0x1449('0x29')]['includeAll']){_0x4551e0[_0x1449('0x44')]=[{'all':!![]}];}_0x4551e0=_[_0x1449('0x37')]({},_0x4551e0,_0x381c10[_0x1449('0x3d')]);return db[_0x1449('0x3e')][_0x1449('0x45')](_0x4551e0)['then'](handleEntityNotFound(_0x38957f,null))['then'](respondWithResult(_0x38957f,null))['catch'](handleError(_0x38957f,null));};exports[_0x1449('0x46')]=function(_0x1be264,_0x29c681){return db[_0x1449('0x3e')][_0x1449('0x46')](_0x1be264[_0x1449('0x47')],{})[_0x1449('0x20')](respondWithResult(_0x29c681,0xc9))[_0x1449('0x41')](handleError(_0x29c681,null));};exports[_0x1449('0x48')]=function(_0x271a9f,_0x1e0584){if(_0x271a9f[_0x1449('0x47')]['id']){delete _0x271a9f[_0x1449('0x47')]['id'];}return db['MailTransferReport'][_0x1449('0x45')]({'where':{'id':_0x271a9f[_0x1449('0x43')]['id']}})[_0x1449('0x20')](handleEntityNotFound(_0x1e0584,null))[_0x1449('0x20')](saveUpdates(_0x271a9f[_0x1449('0x47')],null))['then'](respondWithResult(_0x1e0584,null))[_0x1449('0x41')](handleError(_0x1e0584,null));};exports[_0x1449('0x21')]=function(_0x3feb72,_0x422bdc){return db[_0x1449('0x3e')][_0x1449('0x45')]({'where':{'id':_0x3feb72[_0x1449('0x43')]['id']}})[_0x1449('0x20')](handleEntityNotFound(_0x422bdc,null))[_0x1449('0x20')](removeEntity(_0x422bdc,null))[_0x1449('0x41')](handleError(_0x422bdc,null));};exports[_0x1449('0x49')]=function(_0x35094b,_0x53585a){return db[_0x1449('0x3e')][_0x1449('0x49')]()[_0x1449('0x20')](respondWithResult(_0x53585a,null))[_0x1449('0x41')](handleError(_0x53585a,null));}; \ No newline at end of file +var _0xf50e=['length','model','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','field','options','includeAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','status','sendStatus','error','stack','name','send','index','MailTransferReport','keys','query','filters','intersection','attributes','fields'];(function(_0xc77218,_0x10cd88){var _0x21a6fe=function(_0x1e809a){while(--_0x1e809a){_0xc77218['push'](_0xc77218['shift']());}};_0x21a6fe(++_0x10cd88);}(_0xf50e,0x1f1));var _0xef50=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xf50e[_0x3b150c];return _0x5cd414;};'use strict';var pdf=require(_0xef50('0x0'));var emlformat=require(_0xef50('0x1'));var rimraf=require(_0xef50('0x2'));var zipdir=require(_0xef50('0x3'));var jsonpatch=require(_0xef50('0x4'));var rp=require(_0xef50('0x5'));var moment=require('moment');var BPromise=require(_0xef50('0x6'));var Mustache=require(_0xef50('0x7'));var util=require(_0xef50('0x8'));var path=require(_0xef50('0x9'));var sox=require(_0xef50('0xa'));var csv=require('to-csv');var ejs=require(_0xef50('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef50('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xef50('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef50('0xe'));var Redis=require(_0xef50('0xf'));var authService=require(_0xef50('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xef50('0x11'));var logger=require(_0xef50('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xef50('0x13'));var db=require(_0xef50('0x14'))['db'];function respondWithStatusCode(_0x4b77ad,_0x55faec){_0x55faec=_0x55faec||0xcc;return function(_0xabc1d8){if(_0xabc1d8){return _0x4b77ad['sendStatus'](_0x55faec);}return _0x4b77ad['status'](_0x55faec)[_0xef50('0x15')]();};}function respondWithResult(_0x59805d,_0x58cb9d){_0x58cb9d=_0x58cb9d||0xc8;return function(_0x31c758){if(_0x31c758){return _0x59805d['status'](_0x58cb9d)[_0xef50('0x16')](_0x31c758);}};}function respondWithFilteredResult(_0x2bd1e4,_0x384b00){return function(_0x3757d8){if(_0x3757d8){var _0x8c7024=_0x3757d8[_0xef50('0x17')],_0x149dd7=_0x384b00[_0xef50('0x18')],_0x47d372=_0x384b00[_0xef50('0x18')]+_0x384b00[_0xef50('0x19')],_0x56aa4c;if(_0x47d372>=_0x8c7024){_0x47d372=_0x8c7024;_0x56aa4c=0xc8;}else{_0x56aa4c=0xce;}_0x2bd1e4['status'](_0x56aa4c);return _0x2bd1e4[_0xef50('0x1a')](_0xef50('0x1b'),_0x149dd7+'-'+_0x47d372+'/'+_0x8c7024)[_0xef50('0x16')](_0x3757d8);}return null;};}function patchUpdates(_0x2957e0){return function(_0x32cbe4){try{jsonpatch[_0xef50('0x1c')](_0x32cbe4,_0x2957e0,!![]);}catch(_0x3d89a6){return BPromise[_0xef50('0x1d')](_0x3d89a6);}return _0x32cbe4['save']();};}function saveUpdates(_0x47447a,_0x342a9d){return function(_0x132643){if(_0x132643){return _0x132643[_0xef50('0x1e')](_0x47447a)[_0xef50('0x1f')](function(_0x552e5c){return _0x552e5c;});}return null;};}function removeEntity(_0x40e544,_0x2cf8ea){return function(_0x5e0bff){if(_0x5e0bff){return _0x5e0bff[_0xef50('0x20')]()[_0xef50('0x1f')](function(){_0x40e544[_0xef50('0x21')](0xcc)[_0xef50('0x15')]();});}};}function handleEntityNotFound(_0x1b475f,_0x440d05){return function(_0x1a630c){if(!_0x1a630c){_0x1b475f[_0xef50('0x22')](0x194);}return _0x1a630c;};}function handleError(_0x3595df,_0x117919){_0x117919=_0x117919||0x1f4;return function(_0x20a865){logger[_0xef50('0x23')](_0x20a865[_0xef50('0x24')]);if(_0x20a865[_0xef50('0x25')]){delete _0x20a865[_0xef50('0x25')];}_0x3595df[_0xef50('0x21')](_0x117919)[_0xef50('0x26')](_0x20a865);};}exports[_0xef50('0x27')]=function(_0x226616,_0x197313){var _0x69ec41={},_0x222fc2={},_0x3049c9={'count':0x0,'rows':[]};var _0x302fb2=db[_0xef50('0x28')]['rawAttributes'];_0x222fc2['model']=_[_0xef50('0x29')](_0x302fb2);_0x222fc2[_0xef50('0x2a')]=_[_0xef50('0x29')](_0x226616['query']);_0x222fc2[_0xef50('0x2b')]=_[_0xef50('0x2c')](_0x222fc2['model'],_0x222fc2['query']);_0x69ec41[_0xef50('0x2d')]=_[_0xef50('0x2c')](_0x222fc2['model'],qs[_0xef50('0x2e')](_0x226616[_0xef50('0x2a')][_0xef50('0x2e')]));_0x69ec41['attributes']=_0x69ec41[_0xef50('0x2d')][_0xef50('0x2f')]?_0x69ec41[_0xef50('0x2d')]:_0x222fc2[_0xef50('0x30')];if(!_0x226616[_0xef50('0x2a')][_0xef50('0x31')](_0xef50('0x32'))){_0x69ec41['limit']=qs[_0xef50('0x19')](_0x226616[_0xef50('0x2a')][_0xef50('0x19')]);_0x69ec41[_0xef50('0x18')]=qs[_0xef50('0x18')](_0x226616[_0xef50('0x2a')][_0xef50('0x18')]);}_0x69ec41['order']=qs[_0xef50('0x33')](_0x226616[_0xef50('0x2a')][_0xef50('0x33')]);_0x69ec41[_0xef50('0x34')]=qs[_0xef50('0x2b')](_[_0xef50('0x35')](_0x226616[_0xef50('0x2a')],_0x222fc2[_0xef50('0x2b')]));if(_0x226616['query']['filter']){_0x69ec41[_0xef50('0x34')]=_[_0xef50('0x36')](_0x69ec41['where'],{'$or':_['map'](_0x302fb2,function(_0x35e6ae){if(_0x35e6ae[_0xef50('0x37')]['key']!==_0xef50('0x38')){var _0x5e9cde={};_0x5e9cde[_0x35e6ae[_0xef50('0x39')]]={'$like':'%'+_0x226616['query']['filter']+'%'};return _0x5e9cde;}})});}_0x69ec41=_[_0xef50('0x36')]({},_0x69ec41,_0x226616[_0xef50('0x3a')]);var _0x2b7cde={'where':_0x69ec41[_0xef50('0x34')]};return db['MailTransferReport'][_0xef50('0x17')](_0x2b7cde)['then'](function(_0x41f9ba){_0x3049c9[_0xef50('0x17')]=_0x41f9ba;if(_0x226616[_0xef50('0x2a')][_0xef50('0x3b')]){_0x69ec41['include']=[{'all':!![]}];}return db[_0xef50('0x28')]['findAll'](_0x69ec41);})[_0xef50('0x1f')](function(_0x56d66b){_0x3049c9[_0xef50('0x3c')]=_0x56d66b;return _0x3049c9;})[_0xef50('0x1f')](respondWithFilteredResult(_0x197313,_0x69ec41))[_0xef50('0x3d')](handleError(_0x197313,null));};exports['show']=function(_0x3ed648,_0x4da119){var _0x40b182={'raw':!![],'where':{'id':_0x3ed648[_0xef50('0x3e')]['id']}},_0x40d42f={};_0x40d42f[_0xef50('0x30')]=_[_0xef50('0x29')](db[_0xef50('0x28')][_0xef50('0x3f')]);_0x40d42f[_0xef50('0x2a')]=_[_0xef50('0x29')](_0x3ed648[_0xef50('0x2a')]);_0x40d42f[_0xef50('0x2b')]=_[_0xef50('0x2c')](_0x40d42f[_0xef50('0x30')],_0x40d42f[_0xef50('0x2a')]);_0x40b182[_0xef50('0x2d')]=_['intersection'](_0x40d42f['model'],qs[_0xef50('0x2e')](_0x3ed648['query'][_0xef50('0x2e')]));_0x40b182[_0xef50('0x2d')]=_0x40b182[_0xef50('0x2d')][_0xef50('0x2f')]?_0x40b182[_0xef50('0x2d')]:_0x40d42f['model'];if(_0x3ed648[_0xef50('0x2a')][_0xef50('0x3b')]){_0x40b182['include']=[{'all':!![]}];}_0x40b182=_[_0xef50('0x36')]({},_0x40b182,_0x3ed648[_0xef50('0x3a')]);return db[_0xef50('0x28')][_0xef50('0x40')](_0x40b182)[_0xef50('0x1f')](handleEntityNotFound(_0x4da119,null))['then'](respondWithResult(_0x4da119,null))['catch'](handleError(_0x4da119,null));};exports['create']=function(_0x1dc179,_0x5c9942){return db[_0xef50('0x28')][_0xef50('0x41')](_0x1dc179['body'],{})[_0xef50('0x1f')](respondWithResult(_0x5c9942,0xc9))[_0xef50('0x3d')](handleError(_0x5c9942,null));};exports['update']=function(_0x1bcddb,_0x4aac8a){if(_0x1bcddb[_0xef50('0x42')]['id']){delete _0x1bcddb[_0xef50('0x42')]['id'];}return db[_0xef50('0x28')][_0xef50('0x40')]({'where':{'id':_0x1bcddb[_0xef50('0x3e')]['id']}})[_0xef50('0x1f')](handleEntityNotFound(_0x4aac8a,null))[_0xef50('0x1f')](saveUpdates(_0x1bcddb[_0xef50('0x42')],null))['then'](respondWithResult(_0x4aac8a,null))[_0xef50('0x3d')](handleError(_0x4aac8a,null));};exports[_0xef50('0x20')]=function(_0x40ba91,_0xc127e1){return db[_0xef50('0x28')][_0xef50('0x40')]({'where':{'id':_0x40ba91[_0xef50('0x3e')]['id']}})[_0xef50('0x1f')](handleEntityNotFound(_0xc127e1,null))[_0xef50('0x1f')](removeEntity(_0xc127e1,null))[_0xef50('0x3d')](handleError(_0xc127e1,null));};exports['describe']=function(_0xc07c20,_0x2762cf){return db[_0xef50('0x28')][_0xef50('0x43')]()[_0xef50('0x1f')](respondWithResult(_0x2762cf,null))[_0xef50('0x3d')](handleError(_0x2762cf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 1802f45..aa693a0 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 _0x46ed=['bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment'];(function(_0x4bbab5,_0x2956f9){var _0x5045da=function(_0x248b37){while(--_0x248b37){_0x4bbab5['push'](_0x4bbab5['shift']());}};_0x5045da(++_0x2956f9);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'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':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','api','bluebird','request-promise'];(function(_0x528c84,_0x57d55a){var _0x1520b8=function(_0x58bc6f){while(--_0x58bc6f){_0x528c84['push'](_0x528c84['shift']());}};_0x1520b8(++_0x57d55a);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 71cb5d2..56b5df8 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 _0xbd8b=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','result'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xbd8b,0x171));var _0xbbd8=function(_0x47081e,_0x389a8b){_0x47081e=_0x47081e-0x0;var _0x404f23=_0xbd8b[_0x47081e];return _0x404f23;};'use strict';var _=require(_0xbbd8('0x0'));var util=require(_0xbbd8('0x1'));var moment=require(_0xbbd8('0x2'));var BPromise=require(_0xbbd8('0x3'));var rs=require(_0xbbd8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbd8('0x5'))['db'];var utils=require(_0xbbd8('0x6'));var logger=require(_0xbbd8('0x7'))(_0xbbd8('0x8'));var config=require(_0xbbd8('0x9'));var jayson=require(_0xbbd8('0xa'));var client=jayson[_0xbbd8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4543c3,_0x37d5b4,_0x36f0b0){return new BPromise(function(_0x48fe07,_0x541faa){return client['request'](_0x4543c3,_0x36f0b0)[_0xbbd8('0xc')](function(_0x47dce8){logger[_0xbbd8('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x37d5b4,_0xbbd8('0xe'));logger[_0xbbd8('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x37d5b4,_0xbbd8('0xe'),JSON[_0xbbd8('0x10')](_0x47dce8));if(_0x47dce8['error']){if(_0x47dce8[_0xbbd8('0x11')][_0xbbd8('0x12')]===0x1f4){logger[_0xbbd8('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x37d5b4,_0x47dce8[_0xbbd8('0x11')][_0xbbd8('0x13')]);return _0x541faa(_0x47dce8[_0xbbd8('0x11')]['message']);}logger['error'](_0xbbd8('0x14'),_0x37d5b4,_0x47dce8[_0xbbd8('0x11')]['message']);return _0x48fe07(_0x47dce8['error'][_0xbbd8('0x13')]);}else{logger[_0xbbd8('0xd')](_0xbbd8('0x14'),_0x37d5b4,_0xbbd8('0xe'));_0x48fe07(_0x47dce8[_0xbbd8('0x15')][_0xbbd8('0x13')]);}})[_0xbbd8('0x16')](function(_0x58eb65){logger[_0xbbd8('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x37d5b4,_0x58eb65);_0x541faa(_0x58eb65);});});} \ No newline at end of file +var _0xeba7=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xeba7,0x1b5));var _0x7eba=function(_0x11059b,_0x409007){_0x11059b=_0x11059b-0x0;var _0x2ebd2d=_0xeba7[_0x11059b];return _0x2ebd2d;};'use strict';var _=require(_0x7eba('0x0'));var util=require('util');var moment=require(_0x7eba('0x1'));var BPromise=require(_0x7eba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eba('0x3'));var db=require(_0x7eba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7eba('0x5'))(_0x7eba('0x6'));var config=require(_0x7eba('0x7'));var jayson=require(_0x7eba('0x8'));var client=jayson[_0x7eba('0x9')][_0x7eba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5114a2,_0xd9eea3,_0x6f060c){return new BPromise(function(_0x33cc11,_0x21d381){return client[_0x7eba('0xb')](_0x5114a2,_0x6f060c)['then'](function(_0x31e380){logger['info'](_0x7eba('0xc'),_0xd9eea3,_0x7eba('0xd'));logger[_0x7eba('0xe')](_0x7eba('0xf'),_0xd9eea3,_0x7eba('0xd'),JSON[_0x7eba('0x10')](_0x31e380));if(_0x31e380[_0x7eba('0x11')]){if(_0x31e380[_0x7eba('0x11')][_0x7eba('0x12')]===0x1f4){logger[_0x7eba('0x11')]('MailTransferReport,\x20%s,\x20%s',_0xd9eea3,_0x31e380[_0x7eba('0x11')][_0x7eba('0x13')]);return _0x21d381(_0x31e380[_0x7eba('0x11')]['message']);}logger['error'](_0x7eba('0xc'),_0xd9eea3,_0x31e380[_0x7eba('0x11')]['message']);return _0x33cc11(_0x31e380[_0x7eba('0x11')][_0x7eba('0x13')]);}else{logger[_0x7eba('0x14')](_0x7eba('0xc'),_0xd9eea3,_0x7eba('0xd'));_0x33cc11(_0x31e380[_0x7eba('0x15')]['message']);}})[_0x7eba('0x16')](function(_0xeff344){logger['error'](_0x7eba('0xc'),_0xd9eea3,_0xeff344);_0x21d381(_0xeff344);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c8d90f6..62f3ea0 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 _0x32bb=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3fb420,_0x403305){var _0x38ba06=function(_0x3fb47c){while(--_0x3fb47c){_0x3fb420['push'](_0x3fb420['shift']());}};_0x38ba06(++_0x403305);}(_0x32bb,0x7e));var _0xb32b=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x32bb[_0x3df871];return _0x570f7b;};'use strict';var multer=require(_0xb32b('0x0'));var util=require(_0xb32b('0x1'));var path=require(_0xb32b('0x2'));var timeout=require(_0xb32b('0x3'));var express=require(_0xb32b('0x4'));var router=express['Router']();var auth=require(_0xb32b('0x5'));var interaction=require(_0xb32b('0x6'));var config=require(_0xb32b('0x7'));var controller=require(_0xb32b('0x8'));router[_0xb32b('0x9')]('/',auth[_0xb32b('0xa')](),controller[_0xb32b('0xb')]);router[_0xb32b('0x9')](_0xb32b('0xc'),auth[_0xb32b('0xa')](),controller['describe']);router[_0xb32b('0x9')](_0xb32b('0xd'),auth[_0xb32b('0xa')](),controller[_0xb32b('0xe')]);router['post']('/',auth[_0xb32b('0xa')](),controller[_0xb32b('0xf')]);router[_0xb32b('0x10')](_0xb32b('0xd'),auth[_0xb32b('0xa')](),controller[_0xb32b('0x11')]);router[_0xb32b('0x12')]('/:id',auth[_0xb32b('0xa')](),controller[_0xb32b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1b92=['post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xee1c5c,_0x161ec5){var _0xe1919a=function(_0x13e116){while(--_0x13e116){_0xee1c5c['push'](_0xee1c5c['shift']());}};_0xe1919a(++_0x161ec5);}(_0x1b92,0x68));var _0x21b9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1b92[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x21b9('0x0'));var util=require(_0x21b9('0x1'));var path=require(_0x21b9('0x2'));var timeout=require(_0x21b9('0x3'));var express=require(_0x21b9('0x4'));var router=express[_0x21b9('0x5')]();var auth=require(_0x21b9('0x6'));var interaction=require(_0x21b9('0x7'));var config=require(_0x21b9('0x8'));var controller=require(_0x21b9('0x9'));router[_0x21b9('0xa')]('/',auth[_0x21b9('0xb')](),controller[_0x21b9('0xc')]);router[_0x21b9('0xa')](_0x21b9('0xd'),auth[_0x21b9('0xb')](),controller[_0x21b9('0xe')]);router['get'](_0x21b9('0xf'),auth[_0x21b9('0xb')](),controller['show']);router[_0x21b9('0x10')]('/',auth[_0x21b9('0xb')](),controller[_0x21b9('0x11')]);router['put'](_0x21b9('0xf'),auth[_0x21b9('0xb')](),controller[_0x21b9('0x12')]);router[_0x21b9('0x13')](_0x21b9('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index a2347b4..56edd0b 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 _0x0a67=['getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE'];(function(_0x5682c1,_0x3e1256){var _0x390222=function(_0x1b01cb){while(--_0x1b01cb){_0x5682c1['push'](_0x5682c1['shift']());}};_0x390222(++_0x3e1256);}(_0x0a67,0x1c4));var _0x70a6=function(_0x50716e,_0x184c4c){_0x50716e=_0x50716e-0x0;var _0x2bbb71=_0x0a67[_0x50716e];return _0x2bbb71;};'use strict';var Sequelize=require(_0x70a6('0x0'));var moment=require(_0x70a6('0x1'));module[_0x70a6('0x2')]={'channel':{'type':Sequelize[_0x70a6('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x70a6('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x70a6('0x4'),'comment':_0x70a6('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x70a6('0x6')],'set':function(_0x4581a6){var _0x590819=moment(_0x4581a6);var _0x3ca3cd=moment(this[_0x70a6('0x7')](_0x70a6('0x8')));var _0x4947fd=_0x590819[_0x70a6('0x9')](_0x3ca3cd,_0x70a6('0xa'));this[_0x70a6('0xb')](_0x70a6('0xc'),_0x4581a6);this['setDataValue']('duration',_0x4947fd||null);}},'data1':{'type':Sequelize[_0x70a6('0x3')],'comment':_0x70a6('0xd')},'data2':{'type':Sequelize[_0x70a6('0x3')],'comment':_0x70a6('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0x70a6('0xf')},'data4':{'type':Sequelize[_0x70a6('0x3')],'comment':_0x70a6('0x10')},'data5':{'type':Sequelize[_0x70a6('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x70a6('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x42f2=['STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','diff','seconds','setDataValue','exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x486ed3,_0x404640){var _0x25fd39=function(_0x2b15c1){while(--_0x2b15c1){_0x486ed3['push'](_0x486ed3['shift']());}};_0x25fd39(++_0x404640);}(_0x42f2,0xfa));var _0x242f=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x42f2[_0x3239f5];return _0x3559c8;};'use strict';var Sequelize=require(_0x242f('0x0'));var moment=require(_0x242f('0x1'));module['exports']={'channel':{'type':Sequelize[_0x242f('0x2')]},'membername':{'type':Sequelize[_0x242f('0x2')]},'interface':{'type':Sequelize[_0x242f('0x2')]},'type':{'type':Sequelize[_0x242f('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x242f('0x3')},'duration':{'type':Sequelize[_0x242f('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x12668e){var _0x176057=moment(_0x12668e);var _0x44ee9e=moment(this[_0x242f('0x5')]('enterAt'));var _0x2ee648=_0x176057[_0x242f('0x6')](_0x44ee9e,_0x242f('0x7'));this[_0x242f('0x8')](_0x242f('0x9'),_0x12668e);this[_0x242f('0x8')]('duration',_0x2ee648||null);}},'data1':{'type':Sequelize[_0x242f('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x242f('0x2')],'comment':_0x242f('0xa')},'data3':{'type':Sequelize[_0x242f('0x2')],'comment':_0x242f('0xb')},'data4':{'type':Sequelize[_0x242f('0x2')],'comment':_0x242f('0xc')},'data5':{'type':Sequelize[_0x242f('0x2')],'comment':_0x242f('0xd')},'role':{'type':Sequelize[_0x242f('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x242f('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4c0215b..6fdd3b0 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 _0x4d4e=['order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','MemberReport','findAll','rows','catch','params','include','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','rawAttributes','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x4d4e,0xa4));var _0xe4d4=function(_0x96fa16,_0xa3a7ac){_0x96fa16=_0x96fa16-0x0;var _0x57f3a4=_0x4d4e[_0x96fa16];return _0x57f3a4;};'use strict';var pdf=require(_0xe4d4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4d4('0x1'));var zipdir=require(_0xe4d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4d4('0x3'));var moment=require(_0xe4d4('0x4'));var BPromise=require(_0xe4d4('0x5'));var Mustache=require(_0xe4d4('0x6'));var util=require(_0xe4d4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe4d4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4d4('0x9'));var jsforce=require(_0xe4d4('0xa'));var deskjs=require(_0xe4d4('0xb'));var toCsv=require(_0xe4d4('0x8'));var querystring=require(_0xe4d4('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe4d4('0xd'));var qs=require(_0xe4d4('0xe'));var hardwareService=require(_0xe4d4('0xf'));var logger=require(_0xe4d4('0x10'))(_0xe4d4('0x11'));var utils=require(_0xe4d4('0x12'));var config=require(_0xe4d4('0x13'));var db=require(_0xe4d4('0x14'))['db'];function respondWithStatusCode(_0x587990,_0x24ed69){_0x24ed69=_0x24ed69||0xcc;return function(_0x24d52a){if(_0x24d52a){return _0x587990[_0xe4d4('0x15')](_0x24ed69);}return _0x587990['status'](_0x24ed69)[_0xe4d4('0x16')]();};}function respondWithResult(_0x171b9f,_0x3914a1){_0x3914a1=_0x3914a1||0xc8;return function(_0x1adc63){if(_0x1adc63){return _0x171b9f['status'](_0x3914a1)['json'](_0x1adc63);}};}function respondWithFilteredResult(_0x54be7a,_0x5e7aa5){return function(_0xc30b58){if(_0xc30b58){var _0x38bc50=_0xc30b58[_0xe4d4('0x17')],_0x56d8c4=_0x5e7aa5[_0xe4d4('0x18')],_0xa3e5d3=_0x5e7aa5[_0xe4d4('0x18')]+_0x5e7aa5[_0xe4d4('0x19')],_0x2c85e4;if(_0xa3e5d3>=_0x38bc50){_0xa3e5d3=_0x38bc50;_0x2c85e4=0xc8;}else{_0x2c85e4=0xce;}_0x54be7a[_0xe4d4('0x1a')](_0x2c85e4);return _0x54be7a[_0xe4d4('0x1b')](_0xe4d4('0x1c'),_0x56d8c4+'-'+_0xa3e5d3+'/'+_0x38bc50)[_0xe4d4('0x1d')](_0xc30b58);}return null;};}function patchUpdates(_0x49b315){return function(_0x323379){try{jsonpatch[_0xe4d4('0x1e')](_0x323379,_0x49b315,!![]);}catch(_0x475726){return BPromise[_0xe4d4('0x1f')](_0x475726);}return _0x323379[_0xe4d4('0x20')]();};}function saveUpdates(_0x33a0fd,_0xe3d223){return function(_0x3bcf3c){if(_0x3bcf3c){return _0x3bcf3c[_0xe4d4('0x21')](_0x33a0fd)[_0xe4d4('0x22')](function(_0x71f000){return _0x71f000;});}return null;};}function removeEntity(_0x325cdd,_0x18b5ad){return function(_0x902386){if(_0x902386){return _0x902386[_0xe4d4('0x23')]()['then'](function(){_0x325cdd[_0xe4d4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a93f8,_0x4f69f3){return function(_0x3da595){if(!_0x3da595){_0x5a93f8[_0xe4d4('0x15')](0x194);}return _0x3da595;};}function handleError(_0x5ed8ea,_0x29512d){_0x29512d=_0x29512d||0x1f4;return function(_0x5b8905){logger[_0xe4d4('0x24')](_0x5b8905['stack']);if(_0x5b8905[_0xe4d4('0x25')]){delete _0x5b8905['name'];}_0x5ed8ea[_0xe4d4('0x1a')](_0x29512d)[_0xe4d4('0x26')](_0x5b8905);};}exports['index']=function(_0x22b30c,_0x25ad5a){var _0x1c1793={},_0x5dcaf2={},_0x217fed={'count':0x0,'rows':[]};var _0x2d4394=db['MemberReport'][_0xe4d4('0x27')];_0x5dcaf2['model']=_[_0xe4d4('0x28')](_0x2d4394);_0x5dcaf2['query']=_[_0xe4d4('0x28')](_0x22b30c['query']);_0x5dcaf2[_0xe4d4('0x29')]=_[_0xe4d4('0x2a')](_0x5dcaf2[_0xe4d4('0x2b')],_0x5dcaf2[_0xe4d4('0x2c')]);_0x1c1793[_0xe4d4('0x2d')]=_[_0xe4d4('0x2a')](_0x5dcaf2[_0xe4d4('0x2b')],qs[_0xe4d4('0x2e')](_0x22b30c[_0xe4d4('0x2c')]['fields']));_0x1c1793[_0xe4d4('0x2d')]=_0x1c1793[_0xe4d4('0x2d')][_0xe4d4('0x2f')]?_0x1c1793[_0xe4d4('0x2d')]:_0x5dcaf2['model'];if(!_0x22b30c[_0xe4d4('0x2c')][_0xe4d4('0x30')]('nolimit')){_0x1c1793[_0xe4d4('0x19')]=qs[_0xe4d4('0x19')](_0x22b30c[_0xe4d4('0x2c')][_0xe4d4('0x19')]);_0x1c1793['offset']=qs['offset'](_0x22b30c[_0xe4d4('0x2c')][_0xe4d4('0x18')]);}_0x1c1793[_0xe4d4('0x31')]=qs['sort'](_0x22b30c[_0xe4d4('0x2c')][_0xe4d4('0x32')]);_0x1c1793[_0xe4d4('0x33')]=qs['filters'](_[_0xe4d4('0x34')](_0x22b30c['query'],_0x5dcaf2[_0xe4d4('0x29')]));if(_0x22b30c[_0xe4d4('0x2c')][_0xe4d4('0x35')]){_0x1c1793[_0xe4d4('0x33')]=_[_0xe4d4('0x36')](_0x1c1793[_0xe4d4('0x33')],{'$or':_[_0xe4d4('0x37')](_0x2d4394,function(_0xb32646){if(_0xb32646[_0xe4d4('0x38')][_0xe4d4('0x39')]!==_0xe4d4('0x3a')){var _0x4527e6={};_0x4527e6[_0xb32646[_0xe4d4('0x3b')]]={'$like':'%'+_0x22b30c[_0xe4d4('0x2c')]['filter']+'%'};return _0x4527e6;}})});}_0x1c1793=_['merge']({},_0x1c1793,_0x22b30c[_0xe4d4('0x3c')]);var _0x199e5f={'where':_0x1c1793['where']};return db[_0xe4d4('0x3d')][_0xe4d4('0x17')](_0x199e5f)[_0xe4d4('0x22')](function(_0x446f33){_0x217fed['count']=_0x446f33;if(_0x22b30c[_0xe4d4('0x2c')]['includeAll']){_0x1c1793['include']=[{'all':!![]}];}return db[_0xe4d4('0x3d')][_0xe4d4('0x3e')](_0x1c1793);})[_0xe4d4('0x22')](function(_0x4bcc85){_0x217fed[_0xe4d4('0x3f')]=_0x4bcc85;return _0x217fed;})[_0xe4d4('0x22')](respondWithFilteredResult(_0x25ad5a,_0x1c1793))[_0xe4d4('0x40')](handleError(_0x25ad5a,null));};exports['show']=function(_0xe80507,_0x3d41fe){var _0x27907f={'raw':!![],'where':{'id':_0xe80507[_0xe4d4('0x41')]['id']}},_0x50f1bc={};_0x50f1bc[_0xe4d4('0x2b')]=_[_0xe4d4('0x28')](db['MemberReport'][_0xe4d4('0x27')]);_0x50f1bc[_0xe4d4('0x2c')]=_[_0xe4d4('0x28')](_0xe80507['query']);_0x50f1bc[_0xe4d4('0x29')]=_['intersection'](_0x50f1bc[_0xe4d4('0x2b')],_0x50f1bc[_0xe4d4('0x2c')]);_0x27907f[_0xe4d4('0x2d')]=_[_0xe4d4('0x2a')](_0x50f1bc[_0xe4d4('0x2b')],qs[_0xe4d4('0x2e')](_0xe80507[_0xe4d4('0x2c')][_0xe4d4('0x2e')]));_0x27907f[_0xe4d4('0x2d')]=_0x27907f[_0xe4d4('0x2d')][_0xe4d4('0x2f')]?_0x27907f[_0xe4d4('0x2d')]:_0x50f1bc[_0xe4d4('0x2b')];if(_0xe80507[_0xe4d4('0x2c')]['includeAll']){_0x27907f[_0xe4d4('0x42')]=[{'all':!![]}];}_0x27907f=_[_0xe4d4('0x36')]({},_0x27907f,_0xe80507['options']);return db[_0xe4d4('0x3d')][_0xe4d4('0x43')](_0x27907f)[_0xe4d4('0x22')](handleEntityNotFound(_0x3d41fe,null))[_0xe4d4('0x22')](respondWithResult(_0x3d41fe,null))[_0xe4d4('0x40')](handleError(_0x3d41fe,null));};exports[_0xe4d4('0x44')]=function(_0x3641cb,_0x248fd1){return db[_0xe4d4('0x3d')][_0xe4d4('0x44')](_0x3641cb[_0xe4d4('0x45')],{})[_0xe4d4('0x22')](respondWithResult(_0x248fd1,0xc9))[_0xe4d4('0x40')](handleError(_0x248fd1,null));};exports[_0xe4d4('0x21')]=function(_0x3a3f53,_0x2c7672){if(_0x3a3f53['body']['id']){delete _0x3a3f53[_0xe4d4('0x45')]['id'];}return db[_0xe4d4('0x3d')][_0xe4d4('0x43')]({'where':{'id':_0x3a3f53[_0xe4d4('0x41')]['id']}})[_0xe4d4('0x22')](handleEntityNotFound(_0x2c7672,null))[_0xe4d4('0x22')](saveUpdates(_0x3a3f53['body'],null))[_0xe4d4('0x22')](respondWithResult(_0x2c7672,null))[_0xe4d4('0x40')](handleError(_0x2c7672,null));};exports[_0xe4d4('0x23')]=function(_0x3d843f,_0x212858){return db[_0xe4d4('0x3d')][_0xe4d4('0x43')]({'where':{'id':_0x3d843f[_0xe4d4('0x41')]['id']}})['then'](handleEntityNotFound(_0x212858,null))['then'](removeEntity(_0x212858,null))[_0xe4d4('0x40')](handleError(_0x212858,null));};exports['describe']=function(_0xcfea29,_0x38c998){return db[_0xe4d4('0x3d')][_0xe4d4('0x46')]()[_0xe4d4('0x22')](respondWithResult(_0x38c998,null))[_0xe4d4('0x40')](handleError(_0x38c998,null));}; \ No newline at end of file +var _0x2c8f=['to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','stack','name','send','index','MemberReport','rawAttributes','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','map','type','key','VIRTUAL','field','merge','options','include','catch','params','keys','includeAll','find','create','body','destroy','describe','eml-format','request-promise','moment','bluebird','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c8f,0x192));var _0xf2c8=function(_0xa536b9,_0x5dec5b){_0xa536b9=_0xa536b9-0x0;var _0x5cb56e=_0x2c8f[_0xa536b9];return _0x5cb56e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf2c8('0x1'));var moment=require(_0xf2c8('0x2'));var BPromise=require(_0xf2c8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf2c8('0x4'));var sox=require(_0xf2c8('0x5'));var csv=require(_0xf2c8('0x6'));var ejs=require(_0xf2c8('0x7'));var fs=require('fs');var _=require(_0xf2c8('0x8'));var squel=require('squel');var crypto=require(_0xf2c8('0x9'));var jsforce=require(_0xf2c8('0xa'));var deskjs=require(_0xf2c8('0xb'));var toCsv=require(_0xf2c8('0x6'));var querystring=require(_0xf2c8('0xc'));var Papa=require(_0xf2c8('0xd'));var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var hardwareService=require(_0xf2c8('0x10'));var logger=require(_0xf2c8('0x11'))(_0xf2c8('0x12'));var utils=require(_0xf2c8('0x13'));var config=require(_0xf2c8('0x14'));var db=require(_0xf2c8('0x15'))['db'];function respondWithStatusCode(_0x514dd1,_0xd90704){_0xd90704=_0xd90704||0xcc;return function(_0x5ce572){if(_0x5ce572){return _0x514dd1[_0xf2c8('0x16')](_0xd90704);}return _0x514dd1[_0xf2c8('0x17')](_0xd90704)[_0xf2c8('0x18')]();};}function respondWithResult(_0x46d0c6,_0x37db9b){_0x37db9b=_0x37db9b||0xc8;return function(_0x40849c){if(_0x40849c){return _0x46d0c6['status'](_0x37db9b)[_0xf2c8('0x19')](_0x40849c);}};}function respondWithFilteredResult(_0x165f5f,_0x9152f1){return function(_0x34f9b1){if(_0x34f9b1){var _0x3ed09e=_0x34f9b1[_0xf2c8('0x1a')],_0x383af2=_0x9152f1[_0xf2c8('0x1b')],_0x1b8c5b=_0x9152f1[_0xf2c8('0x1b')]+_0x9152f1[_0xf2c8('0x1c')],_0x5f37ba;if(_0x1b8c5b>=_0x3ed09e){_0x1b8c5b=_0x3ed09e;_0x5f37ba=0xc8;}else{_0x5f37ba=0xce;}_0x165f5f[_0xf2c8('0x17')](_0x5f37ba);return _0x165f5f['set']('Content-Range',_0x383af2+'-'+_0x1b8c5b+'/'+_0x3ed09e)[_0xf2c8('0x19')](_0x34f9b1);}return null;};}function patchUpdates(_0x290953){return function(_0x2c6d7a){try{jsonpatch[_0xf2c8('0x1d')](_0x2c6d7a,_0x290953,!![]);}catch(_0x516d99){return BPromise[_0xf2c8('0x1e')](_0x516d99);}return _0x2c6d7a[_0xf2c8('0x1f')]();};}function saveUpdates(_0x197435,_0x47b5e4){return function(_0x4442f9){if(_0x4442f9){return _0x4442f9[_0xf2c8('0x20')](_0x197435)['then'](function(_0x5b1e44){return _0x5b1e44;});}return null;};}function removeEntity(_0x43505f,_0x3e7ceb){return function(_0x98f9cb){if(_0x98f9cb){return _0x98f9cb['destroy']()[_0xf2c8('0x21')](function(){_0x43505f[_0xf2c8('0x17')](0xcc)[_0xf2c8('0x18')]();});}};}function handleEntityNotFound(_0x239350,_0x4ba1e0){return function(_0x17956f){if(!_0x17956f){_0x239350[_0xf2c8('0x16')](0x194);}return _0x17956f;};}function handleError(_0x20e994,_0x440b41){_0x440b41=_0x440b41||0x1f4;return function(_0x16938e){logger['error'](_0x16938e[_0xf2c8('0x22')]);if(_0x16938e['name']){delete _0x16938e[_0xf2c8('0x23')];}_0x20e994[_0xf2c8('0x17')](_0x440b41)[_0xf2c8('0x24')](_0x16938e);};}exports[_0xf2c8('0x25')]=function(_0x1d2e74,_0x3160a5){var _0x3ffd20={},_0x132343={},_0x33f1b0={'count':0x0,'rows':[]};var _0xcf5239=db[_0xf2c8('0x26')][_0xf2c8('0x27')];_0x132343[_0xf2c8('0x28')]=_['keys'](_0xcf5239);_0x132343[_0xf2c8('0x29')]=_['keys'](_0x1d2e74['query']);_0x132343[_0xf2c8('0x2a')]=_['intersection'](_0x132343[_0xf2c8('0x28')],_0x132343[_0xf2c8('0x29')]);_0x3ffd20[_0xf2c8('0x2b')]=_[_0xf2c8('0x2c')](_0x132343[_0xf2c8('0x28')],qs[_0xf2c8('0x2d')](_0x1d2e74[_0xf2c8('0x29')]['fields']));_0x3ffd20[_0xf2c8('0x2b')]=_0x3ffd20[_0xf2c8('0x2b')][_0xf2c8('0x2e')]?_0x3ffd20[_0xf2c8('0x2b')]:_0x132343[_0xf2c8('0x28')];if(!_0x1d2e74[_0xf2c8('0x29')]['hasOwnProperty'](_0xf2c8('0x2f'))){_0x3ffd20['limit']=qs[_0xf2c8('0x1c')](_0x1d2e74['query'][_0xf2c8('0x1c')]);_0x3ffd20[_0xf2c8('0x1b')]=qs[_0xf2c8('0x1b')](_0x1d2e74[_0xf2c8('0x29')][_0xf2c8('0x1b')]);}_0x3ffd20['order']=qs[_0xf2c8('0x30')](_0x1d2e74[_0xf2c8('0x29')]['sort']);_0x3ffd20[_0xf2c8('0x31')]=qs[_0xf2c8('0x2a')](_['pick'](_0x1d2e74[_0xf2c8('0x29')],_0x132343[_0xf2c8('0x2a')]));if(_0x1d2e74[_0xf2c8('0x29')][_0xf2c8('0x32')]){_0x3ffd20[_0xf2c8('0x31')]=_['merge'](_0x3ffd20['where'],{'$or':_[_0xf2c8('0x33')](_0xcf5239,function(_0x301567){if(_0x301567[_0xf2c8('0x34')][_0xf2c8('0x35')]!==_0xf2c8('0x36')){var _0x3a807e={};_0x3a807e[_0x301567[_0xf2c8('0x37')]]={'$like':'%'+_0x1d2e74[_0xf2c8('0x29')]['filter']+'%'};return _0x3a807e;}})});}_0x3ffd20=_[_0xf2c8('0x38')]({},_0x3ffd20,_0x1d2e74[_0xf2c8('0x39')]);var _0x2a673a={'where':_0x3ffd20['where']};return db['MemberReport']['count'](_0x2a673a)['then'](function(_0x3af100){_0x33f1b0['count']=_0x3af100;if(_0x1d2e74[_0xf2c8('0x29')]['includeAll']){_0x3ffd20[_0xf2c8('0x3a')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x3ffd20);})[_0xf2c8('0x21')](function(_0x523f92){_0x33f1b0['rows']=_0x523f92;return _0x33f1b0;})[_0xf2c8('0x21')](respondWithFilteredResult(_0x3160a5,_0x3ffd20))[_0xf2c8('0x3b')](handleError(_0x3160a5,null));};exports['show']=function(_0x1f4115,_0x13afbd){var _0xc31337={'raw':!![],'where':{'id':_0x1f4115[_0xf2c8('0x3c')]['id']}},_0x30b9bc={};_0x30b9bc[_0xf2c8('0x28')]=_['keys'](db['MemberReport'][_0xf2c8('0x27')]);_0x30b9bc['query']=_[_0xf2c8('0x3d')](_0x1f4115['query']);_0x30b9bc[_0xf2c8('0x2a')]=_['intersection'](_0x30b9bc[_0xf2c8('0x28')],_0x30b9bc[_0xf2c8('0x29')]);_0xc31337[_0xf2c8('0x2b')]=_[_0xf2c8('0x2c')](_0x30b9bc['model'],qs[_0xf2c8('0x2d')](_0x1f4115[_0xf2c8('0x29')]['fields']));_0xc31337[_0xf2c8('0x2b')]=_0xc31337[_0xf2c8('0x2b')][_0xf2c8('0x2e')]?_0xc31337[_0xf2c8('0x2b')]:_0x30b9bc[_0xf2c8('0x28')];if(_0x1f4115[_0xf2c8('0x29')][_0xf2c8('0x3e')]){_0xc31337['include']=[{'all':!![]}];}_0xc31337=_[_0xf2c8('0x38')]({},_0xc31337,_0x1f4115[_0xf2c8('0x39')]);return db[_0xf2c8('0x26')][_0xf2c8('0x3f')](_0xc31337)['then'](handleEntityNotFound(_0x13afbd,null))['then'](respondWithResult(_0x13afbd,null))[_0xf2c8('0x3b')](handleError(_0x13afbd,null));};exports[_0xf2c8('0x40')]=function(_0x3203c3,_0x520029){return db[_0xf2c8('0x26')][_0xf2c8('0x40')](_0x3203c3['body'],{})['then'](respondWithResult(_0x520029,0xc9))[_0xf2c8('0x3b')](handleError(_0x520029,null));};exports[_0xf2c8('0x20')]=function(_0x3725a3,_0x371d14){if(_0x3725a3['body']['id']){delete _0x3725a3[_0xf2c8('0x41')]['id'];}return db[_0xf2c8('0x26')][_0xf2c8('0x3f')]({'where':{'id':_0x3725a3['params']['id']}})[_0xf2c8('0x21')](handleEntityNotFound(_0x371d14,null))[_0xf2c8('0x21')](saveUpdates(_0x3725a3[_0xf2c8('0x41')],null))['then'](respondWithResult(_0x371d14,null))[_0xf2c8('0x3b')](handleError(_0x371d14,null));};exports[_0xf2c8('0x42')]=function(_0x24d4a2,_0x3d90f5){return db[_0xf2c8('0x26')]['find']({'where':{'id':_0x24d4a2[_0xf2c8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3d90f5,null))['then'](removeEntity(_0x3d90f5,null))[_0xf2c8('0x3b')](handleError(_0x3d90f5,null));};exports[_0xf2c8('0x43')]=function(_0xcd5dfd,_0x184d95){return db[_0xf2c8('0x26')]['describe']()[_0xf2c8('0x21')](respondWithResult(_0x184d95,null))[_0xf2c8('0x3b')](handleError(_0x184d95,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6179c29..faf9331 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 _0x81ef=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MemberReport','membername_interface','interface','util','../../config/logger','api'];(function(_0x562b39,_0x5c952f){var _0x12a274=function(_0x3758dd){while(--_0x3758dd){_0x562b39['push'](_0x562b39['shift']());}};_0x12a274(++_0x5c952f);}(_0x81ef,0x1af));var _0xf81e=function(_0x2df727,_0x4e2964){_0x2df727=_0x2df727-0x0;var _0x4671bd=_0x81ef[_0x2df727];return _0x4671bd;};'use strict';var _=require('lodash');var util=require(_0xf81e('0x0'));var logger=require(_0xf81e('0x1'))(_0xf81e('0x2'));var moment=require(_0xf81e('0x3'));var BPromise=require(_0xf81e('0x4'));var rp=require(_0xf81e('0x5'));var fs=require('fs');var path=require(_0xf81e('0x6'));var rimraf=require(_0xf81e('0x7'));var config=require(_0xf81e('0x8'));var attributes=require('./memberReport.attributes');module[_0xf81e('0x9')]=function(_0x22c354,_0x25b14a){return _0x22c354[_0xf81e('0xa')](_0xf81e('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xf81e('0xc'),'fields':['membername',_0xf81e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9196=['interface','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','MemberReport','report_member','membername_interface'];(function(_0x28705e,_0x13537a){var _0x95ee71=function(_0x5b0ae2){while(--_0x5b0ae2){_0x28705e['push'](_0x28705e['shift']());}};_0x95ee71(++_0x13537a);}(_0x9196,0x69));var _0x6919=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x9196[_0x5180c3];return _0x55c975;};'use strict';var _=require(_0x6919('0x0'));var util=require(_0x6919('0x1'));var logger=require(_0x6919('0x2'))(_0x6919('0x3'));var moment=require(_0x6919('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6919('0x5'));var rimraf=require(_0x6919('0x6'));var config=require(_0x6919('0x7'));var attributes=require('./memberReport.attributes');module[_0x6919('0x8')]=function(_0x31de82,_0x2db121){return _0x31de82['define'](_0x6919('0x9'),attributes,{'tableName':_0x6919('0xa'),'paranoid':![],'indexes':[{'name':_0x6919('0xb'),'fields':['membername',_0x6919('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7dbd4f3..4c8fb7f 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 _0x87ba=['message','info','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','MemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x87ba,0x1d6));var _0xa87b=function(_0x4168ef,_0x1d0494){_0x4168ef=_0x4168ef-0x0;var _0xc1eeeb=_0x87ba[_0x4168ef];return _0xc1eeeb;};'use strict';var _=require(_0xa87b('0x0'));var util=require(_0xa87b('0x1'));var moment=require(_0xa87b('0x2'));var BPromise=require(_0xa87b('0x3'));var rs=require(_0xa87b('0x4'));var fs=require('fs');var Redis=require(_0xa87b('0x5'));var db=require(_0xa87b('0x6'))['db'];var utils=require(_0xa87b('0x7'));var logger=require(_0xa87b('0x8'))(_0xa87b('0x9'));var config=require(_0xa87b('0xa'));var jayson=require(_0xa87b('0xb'));var client=jayson[_0xa87b('0xc')][_0xa87b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x17d290,_0x34003d,_0x260b68){return new BPromise(function(_0x55286a,_0x705e91){return client[_0xa87b('0xe')](_0x17d290,_0x260b68)[_0xa87b('0xf')](function(_0x136087){logger['info'](_0xa87b('0x10'),_0x34003d,_0xa87b('0x11'));logger[_0xa87b('0x12')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x34003d,_0xa87b('0x11'),JSON[_0xa87b('0x13')](_0x136087));if(_0x136087[_0xa87b('0x14')]){if(_0x136087['error'][_0xa87b('0x15')]===0x1f4){logger[_0xa87b('0x14')](_0xa87b('0x10'),_0x34003d,_0x136087[_0xa87b('0x14')][_0xa87b('0x16')]);return _0x705e91(_0x136087['error'][_0xa87b('0x16')]);}logger['error'](_0xa87b('0x10'),_0x34003d,_0x136087[_0xa87b('0x14')][_0xa87b('0x16')]);return _0x55286a(_0x136087['error'][_0xa87b('0x16')]);}else{logger[_0xa87b('0x17')](_0xa87b('0x10'),_0x34003d,_0xa87b('0x11'));_0x55286a(_0x136087['result'][_0xa87b('0x16')]);}})[_0xa87b('0x18')](function(_0x30bec4){logger[_0xa87b('0x14')](_0xa87b('0x10'),_0x34003d,_0x30bec4);_0x705e91(_0x30bec4);});});}exports[_0xa87b('0x19')]=function(_0x4dacd2){var _0x2b18e9=this;return new Promise(function(_0x3d8a6e,_0x2a2547){return db['MemberReport'][_0xa87b('0x1a')]({'raw':_0x4dacd2[_0xa87b('0x1b')]?_0x4dacd2[_0xa87b('0x1b')][_0xa87b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4dacd2[_0xa87b('0x1b')]?_0x4dacd2[_0xa87b('0x1b')][_0xa87b('0x1d')]||null:null,'attributes':_0x4dacd2[_0xa87b('0x1b')]?_0x4dacd2[_0xa87b('0x1b')][_0xa87b('0x1e')]||null:null,'limit':_0x4dacd2[_0xa87b('0x1b')]?_0x4dacd2[_0xa87b('0x1b')][_0xa87b('0x1f')]||null:null,'include':_0x4dacd2[_0xa87b('0x1b')]?_0x4dacd2[_0xa87b('0x1b')][_0xa87b('0x20')]?_['map'](_0x4dacd2[_0xa87b('0x1b')][_0xa87b('0x20')],function(_0x271eff){return{'model':db[_0x271eff['model']],'as':_0x271eff['as'],'attributes':_0x271eff[_0xa87b('0x1e')],'include':_0x271eff[_0xa87b('0x20')]?_[_0xa87b('0x21')](_0x271eff[_0xa87b('0x20')],function(_0x9f7d34){return{'model':db[_0x9f7d34[_0xa87b('0x22')]],'as':_0x9f7d34['as'],'attributes':_0x9f7d34[_0xa87b('0x1e')],'include':_0x9f7d34[_0xa87b('0x20')]?_[_0xa87b('0x21')](_0x9f7d34[_0xa87b('0x20')],function(_0x58614e){return{'model':db[_0x58614e[_0xa87b('0x22')]],'as':_0x58614e['as'],'attributes':_0x58614e[_0xa87b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa87b('0xf')](function(_0x2fb07b){logger['info'](_0xa87b('0x19'),_0x4dacd2);logger[_0xa87b('0x12')](_0xa87b('0x19'),_0x4dacd2,JSON[_0xa87b('0x13')](_0x2fb07b));_0x3d8a6e(_0x2fb07b);})[_0xa87b('0x18')](function(_0x474d22){logger[_0xa87b('0x14')](_0xa87b('0x19'),_0x474d22[_0xa87b('0x16')],_0x4dacd2);_0x2a2547(_0x2b18e9[_0xa87b('0x14')](0x1f4,_0x474d22[_0xa87b('0x16')]));});});};exports[_0xa87b('0x23')]=function(_0x4865ad){var _0x1d8a38=this;return new Promise(function(_0x13fb6c,_0x3caf99){return db[_0xa87b('0x24')][_0xa87b('0x25')](_0x4865ad[_0xa87b('0x26')],{'raw':_0x4865ad[_0xa87b('0x1b')]?_0x4865ad['options'][_0xa87b('0x1c')]===undefined?!![]:![]:!![]})[_0xa87b('0xf')](function(_0x44f874){logger[_0xa87b('0x17')](_0xa87b('0x23'),_0x4865ad);logger[_0xa87b('0x12')](_0xa87b('0x23'),_0x4865ad,JSON[_0xa87b('0x13')](_0x44f874));_0x13fb6c(_0x44f874);})[_0xa87b('0x18')](function(_0x5d6ad3){logger['error'](_0xa87b('0x23'),_0x5d6ad3[_0xa87b('0x16')],_0x4865ad);_0x3caf99(_0x1d8a38[_0xa87b('0x14')](0x1f4,_0x5d6ad3[_0xa87b('0x16')]));});});};exports['UpdateMemberReport']=function(_0x4e0d97){var _0x4ac6fc=this;return new Promise(function(_0x410b00,_0x6f6e00){return db[_0xa87b('0x24')][_0xa87b('0x27')](_0x4e0d97[_0xa87b('0x26')],{'raw':_0x4e0d97[_0xa87b('0x1b')]?_0x4e0d97[_0xa87b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e0d97[_0xa87b('0x1b')]?_0x4e0d97['options'][_0xa87b('0x1d')]||null:null,'attributes':_0x4e0d97[_0xa87b('0x1b')]?_0x4e0d97[_0xa87b('0x1b')][_0xa87b('0x1e')]||null:null,'limit':_0x4e0d97[_0xa87b('0x1b')]?_0x4e0d97[_0xa87b('0x1b')]['limit']||null:null})['then'](function(_0x37e373){logger[_0xa87b('0x17')]('UpdateMemberReport',_0x4e0d97);logger[_0xa87b('0x12')]('UpdateMemberReport',_0x4e0d97,JSON[_0xa87b('0x13')](_0x37e373));_0x410b00(_0x37e373);})[_0xa87b('0x18')](function(_0x588b46){logger[_0xa87b('0x14')](_0xa87b('0x28'),_0x588b46['message'],_0x4e0d97);_0x6f6e00(_0x4ac6fc['error'](0x1f4,_0x588b46[_0xa87b('0x16')]));});});}; \ No newline at end of file +var _0x41e3=['where','limit','include','model','attributes','map','catch','CreateMemberReport','create','body','raw','stringify','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetMemberReport','MemberReport','findAll','options'];(function(_0x2951b1,_0x1e3a2b){var _0x1501f1=function(_0x404653){while(--_0x404653){_0x2951b1['push'](_0x2951b1['shift']());}};_0x1501f1(++_0x1e3a2b);}(_0x41e3,0x1c6));var _0x341e=function(_0x2e72c7,_0x3cefda){_0x2e72c7=_0x2e72c7-0x0;var _0x12f876=_0x41e3[_0x2e72c7];return _0x12f876;};'use strict';var _=require('lodash');var util=require(_0x341e('0x0'));var moment=require(_0x341e('0x1'));var BPromise=require(_0x341e('0x2'));var rs=require(_0x341e('0x3'));var fs=require('fs');var Redis=require(_0x341e('0x4'));var db=require(_0x341e('0x5'))['db'];var utils=require(_0x341e('0x6'));var logger=require(_0x341e('0x7'))('rpc');var config=require(_0x341e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x341e('0x9')][_0x341e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c2e10,_0x508929,_0x298bd0){return new BPromise(function(_0x56368e,_0xc13474){return client[_0x341e('0xb')](_0x7c2e10,_0x298bd0)[_0x341e('0xc')](function(_0x59f9ff){logger['info'](_0x341e('0xd'),_0x508929,_0x341e('0xe'));logger[_0x341e('0xf')](_0x341e('0x10'),_0x508929,'request\x20sent',JSON['stringify'](_0x59f9ff));if(_0x59f9ff[_0x341e('0x11')]){if(_0x59f9ff['error'][_0x341e('0x12')]===0x1f4){logger[_0x341e('0x11')]('MemberReport,\x20%s,\x20%s',_0x508929,_0x59f9ff['error'][_0x341e('0x13')]);return _0xc13474(_0x59f9ff[_0x341e('0x11')]['message']);}logger[_0x341e('0x11')]('MemberReport,\x20%s,\x20%s',_0x508929,_0x59f9ff[_0x341e('0x11')]['message']);return _0x56368e(_0x59f9ff[_0x341e('0x11')][_0x341e('0x13')]);}else{logger[_0x341e('0x14')](_0x341e('0xd'),_0x508929,_0x341e('0xe'));_0x56368e(_0x59f9ff[_0x341e('0x15')][_0x341e('0x13')]);}})['catch'](function(_0x5c5ea2){logger[_0x341e('0x11')](_0x341e('0xd'),_0x508929,_0x5c5ea2);_0xc13474(_0x5c5ea2);});});}exports[_0x341e('0x16')]=function(_0x2705c8){var _0x179f9a=this;return new Promise(function(_0xcb1ae8,_0x32fae1){return db[_0x341e('0x17')][_0x341e('0x18')]({'raw':_0x2705c8['options']?_0x2705c8[_0x341e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2705c8['options']?_0x2705c8[_0x341e('0x19')][_0x341e('0x1a')]||null:null,'attributes':_0x2705c8[_0x341e('0x19')]?_0x2705c8[_0x341e('0x19')]['attributes']||null:null,'limit':_0x2705c8[_0x341e('0x19')]?_0x2705c8[_0x341e('0x19')][_0x341e('0x1b')]||null:null,'include':_0x2705c8[_0x341e('0x19')]?_0x2705c8['options'][_0x341e('0x1c')]?_['map'](_0x2705c8[_0x341e('0x19')]['include'],function(_0x225eb1){return{'model':db[_0x225eb1[_0x341e('0x1d')]],'as':_0x225eb1['as'],'attributes':_0x225eb1[_0x341e('0x1e')],'include':_0x225eb1[_0x341e('0x1c')]?_[_0x341e('0x1f')](_0x225eb1[_0x341e('0x1c')],function(_0x161ebe){return{'model':db[_0x161ebe[_0x341e('0x1d')]],'as':_0x161ebe['as'],'attributes':_0x161ebe[_0x341e('0x1e')],'include':_0x161ebe['include']?_[_0x341e('0x1f')](_0x161ebe[_0x341e('0x1c')],function(_0x509cf9){return{'model':db[_0x509cf9[_0x341e('0x1d')]],'as':_0x509cf9['as'],'attributes':_0x509cf9['attributes']};}):[]};}):[]};}):[]:[]})[_0x341e('0xc')](function(_0x3c80f7){logger[_0x341e('0x14')](_0x341e('0x16'),_0x2705c8);logger[_0x341e('0xf')](_0x341e('0x16'),_0x2705c8,JSON['stringify'](_0x3c80f7));_0xcb1ae8(_0x3c80f7);})[_0x341e('0x20')](function(_0x1a1c7b){logger[_0x341e('0x11')]('GetMemberReport',_0x1a1c7b[_0x341e('0x13')],_0x2705c8);_0x32fae1(_0x179f9a[_0x341e('0x11')](0x1f4,_0x1a1c7b[_0x341e('0x13')]));});});};exports[_0x341e('0x21')]=function(_0x4fd5a6){var _0x1e4f5d=this;return new Promise(function(_0x342149,_0x859dad){return db['MemberReport'][_0x341e('0x22')](_0x4fd5a6[_0x341e('0x23')],{'raw':_0x4fd5a6['options']?_0x4fd5a6['options'][_0x341e('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x457fec){logger[_0x341e('0x14')](_0x341e('0x21'),_0x4fd5a6);logger[_0x341e('0xf')](_0x341e('0x21'),_0x4fd5a6,JSON[_0x341e('0x25')](_0x457fec));_0x342149(_0x457fec);})[_0x341e('0x20')](function(_0x12a4c3){logger['error'](_0x341e('0x21'),_0x12a4c3[_0x341e('0x13')],_0x4fd5a6);_0x859dad(_0x1e4f5d[_0x341e('0x11')](0x1f4,_0x12a4c3[_0x341e('0x13')]));});});};exports[_0x341e('0x26')]=function(_0x3a829d){var _0x44fcb9=this;return new Promise(function(_0x1c14a0,_0x5cc196){return db['MemberReport'][_0x341e('0x27')](_0x3a829d[_0x341e('0x23')],{'raw':_0x3a829d['options']?_0x3a829d[_0x341e('0x19')][_0x341e('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a829d[_0x341e('0x19')]?_0x3a829d['options'][_0x341e('0x1a')]||null:null,'attributes':_0x3a829d[_0x341e('0x19')]?_0x3a829d[_0x341e('0x19')]['attributes']||null:null,'limit':_0x3a829d[_0x341e('0x19')]?_0x3a829d[_0x341e('0x19')]['limit']||null:null})[_0x341e('0xc')](function(_0x10d46e){logger['info'](_0x341e('0x26'),_0x3a829d);logger['debug']('UpdateMemberReport',_0x3a829d,JSON[_0x341e('0x25')](_0x10d46e));_0x1c14a0(_0x10d46e);})[_0x341e('0x20')](function(_0x57d398){logger[_0x341e('0x11')](_0x341e('0x26'),_0x57d398[_0x341e('0x13')],_0x3a829d);_0x5cc196(_0x44fcb9[_0x341e('0x11')](0x1f4,_0x57d398[_0x341e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 308797c..27b837f 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 _0x020a=['get','index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x020a,0xf3));var _0xa020=function(_0x1b9c2a,_0x50582e){_0x1b9c2a=_0x1b9c2a-0x0;var _0x21ab47=_0x020a[_0x1b9c2a];return _0x21ab47;};'use strict';var multer=require(_0xa020('0x0'));var util=require(_0xa020('0x1'));var path=require(_0xa020('0x2'));var timeout=require(_0xa020('0x3'));var express=require('express');var router=express[_0xa020('0x4')]();var auth=require(_0xa020('0x5'));var interaction=require(_0xa020('0x6'));var config=require(_0xa020('0x7'));var controller=require(_0xa020('0x8'));router[_0xa020('0x9')]('/',controller[_0xa020('0xa')]);module[_0xa020('0xb')]=router; \ No newline at end of file +var _0xccce=['Router','../../components/interaction/service','../../config/environment','./migration.controller','get','index','util','path','connect-timeout'];(function(_0x31ccca,_0x514be9){var _0x52dde1=function(_0xe379b0){while(--_0xe379b0){_0x31ccca['push'](_0x31ccca['shift']());}};_0x52dde1(++_0x514be9);}(_0xccce,0x11d));var _0xeccc=function(_0x3c331b,_0x671c94){_0x3c331b=_0x3c331b-0x0;var _0x321d64=_0xccce[_0x3c331b];return _0x321d64;};'use strict';var multer=require('multer');var util=require(_0xeccc('0x0'));var path=require(_0xeccc('0x1'));var timeout=require(_0xeccc('0x2'));var express=require('express');var router=express[_0xeccc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xeccc('0x4'));var config=require(_0xeccc('0x5'));var controller=require(_0xeccc('0x6'));router[_0xeccc('0x7')]('/',controller[_0xeccc('0x8')]);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 0d99184..58593b2 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 _0x2a22=['exports','version','sequelize'];(function(_0x372ce7,_0x556ad1){var _0xf3232a=function(_0x16d646){while(--_0x16d646){_0x372ce7['push'](_0x372ce7['shift']());}};_0xf3232a(++_0x556ad1);}(_0x2a22,0x1a0));var _0x22a2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x2a22[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x22a2('0x0'));module[_0x22a2('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x22a2('0x2')}}; \ No newline at end of file +var _0xbb2f=['sequelize','exports','STRING','version'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xbb2f,0x168));var _0xfbb2=function(_0xbe6591,_0x2de131){_0xbe6591=_0xbe6591-0x0;var _0x30cb56=_0xbb2f[_0xbe6591];return _0x30cb56;};'use strict';var Sequelize=require(_0xfbb2('0x0'));module[_0xfbb2('0x1')]={'version':{'type':Sequelize[_0xfbb2('0x2')],'unique':_0xfbb2('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d5dde5f..cd0ccaa 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 _0x7583=['to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Migration','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','key','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox'];(function(_0x44c106,_0x31d9f2){var _0x555489=function(_0x3ebc41){while(--_0x3ebc41){_0x44c106['push'](_0x44c106['shift']());}};_0x555489(++_0x31d9f2);}(_0x7583,0x7d));var _0x3758=function(_0x588791,_0x35a42e){_0x588791=_0x588791-0x0;var _0x28937a=_0x7583[_0x588791];return _0x28937a;};'use strict';var pdf=require(_0x3758('0x0'));var emlformat=require(_0x3758('0x1'));var rimraf=require(_0x3758('0x2'));var zipdir=require(_0x3758('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3758('0x4'));var moment=require('moment');var BPromise=require(_0x3758('0x5'));var Mustache=require(_0x3758('0x6'));var util=require('util');var path=require(_0x3758('0x7'));var sox=require(_0x3758('0x8'));var csv=require(_0x3758('0x9'));var ejs=require(_0x3758('0xa'));var fs=require('fs');var _=require(_0x3758('0xb'));var squel=require('squel');var crypto=require(_0x3758('0xc'));var jsforce=require(_0x3758('0xd'));var deskjs=require(_0x3758('0xe'));var toCsv=require(_0x3758('0x9'));var querystring=require(_0x3758('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3758('0x10'));var qs=require(_0x3758('0x11'));var hardwareService=require(_0x3758('0x12'));var logger=require(_0x3758('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3758('0x14'));var db=require(_0x3758('0x15'))['db'];function respondWithStatusCode(_0x220a6c,_0x5c4670){_0x5c4670=_0x5c4670||0xcc;return function(_0x473000){if(_0x473000){return _0x220a6c['sendStatus'](_0x5c4670);}return _0x220a6c[_0x3758('0x16')](_0x5c4670)[_0x3758('0x17')]();};}function respondWithResult(_0x1b8557,_0x351938){_0x351938=_0x351938||0xc8;return function(_0x5bab19){if(_0x5bab19){return _0x1b8557[_0x3758('0x16')](_0x351938)[_0x3758('0x18')](_0x5bab19);}};}function respondWithFilteredResult(_0x3800a4,_0x17050e){return function(_0x1338aa){if(_0x1338aa){var _0x353eb3=_0x1338aa[_0x3758('0x19')],_0x30775c=_0x17050e[_0x3758('0x1a')],_0x183ad7=_0x17050e['offset']+_0x17050e[_0x3758('0x1b')],_0x45d038;if(_0x183ad7>=_0x353eb3){_0x183ad7=_0x353eb3;_0x45d038=0xc8;}else{_0x45d038=0xce;}_0x3800a4[_0x3758('0x16')](_0x45d038);return _0x3800a4[_0x3758('0x1c')](_0x3758('0x1d'),_0x30775c+'-'+_0x183ad7+'/'+_0x353eb3)[_0x3758('0x18')](_0x1338aa);}return null;};}function patchUpdates(_0x387924){return function(_0x51788a){try{jsonpatch[_0x3758('0x1e')](_0x51788a,_0x387924,!![]);}catch(_0x5ef97f){return BPromise[_0x3758('0x1f')](_0x5ef97f);}return _0x51788a[_0x3758('0x20')]();};}function saveUpdates(_0x5238a1,_0x9a639f){return function(_0x492d6c){if(_0x492d6c){return _0x492d6c[_0x3758('0x21')](_0x5238a1)[_0x3758('0x22')](function(_0x65fda8){return _0x65fda8;});}return null;};}function removeEntity(_0xf58b85,_0x41be51){return function(_0x44cef3){if(_0x44cef3){return _0x44cef3[_0x3758('0x23')]()[_0x3758('0x22')](function(){_0xf58b85[_0x3758('0x16')](0xcc)[_0x3758('0x17')]();});}};}function handleEntityNotFound(_0x19a24f,_0x70159f){return function(_0x46bf5d){if(!_0x46bf5d){_0x19a24f[_0x3758('0x24')](0x194);}return _0x46bf5d;};}function handleError(_0x8cf1e0,_0x4a4ee0){_0x4a4ee0=_0x4a4ee0||0x1f4;return function(_0xfa8558){logger[_0x3758('0x25')](_0xfa8558[_0x3758('0x26')]);if(_0xfa8558[_0x3758('0x27')]){delete _0xfa8558['name'];}_0x8cf1e0['status'](_0x4a4ee0)[_0x3758('0x28')](_0xfa8558);};}exports[_0x3758('0x29')]=function(_0x22149e,_0x407e2c){var _0x1daa78={},_0x535f3a={},_0xbbacc0={'count':0x0,'rows':[]};var _0x50d7db=db[_0x3758('0x2a')][_0x3758('0x2b')];_0x535f3a[_0x3758('0x2c')]=_[_0x3758('0x2d')](_0x50d7db);_0x535f3a[_0x3758('0x2e')]=_['keys'](_0x22149e[_0x3758('0x2e')]);_0x535f3a[_0x3758('0x2f')]=_['intersection'](_0x535f3a[_0x3758('0x2c')],_0x535f3a[_0x3758('0x2e')]);_0x1daa78[_0x3758('0x30')]=_['intersection'](_0x535f3a[_0x3758('0x2c')],qs['fields'](_0x22149e[_0x3758('0x2e')][_0x3758('0x31')]));_0x1daa78['attributes']=_0x1daa78[_0x3758('0x30')][_0x3758('0x32')]?_0x1daa78[_0x3758('0x30')]:_0x535f3a[_0x3758('0x2c')];if(!_0x22149e[_0x3758('0x2e')][_0x3758('0x33')]('nolimit')){_0x1daa78[_0x3758('0x1b')]=qs['limit'](_0x22149e[_0x3758('0x2e')][_0x3758('0x1b')]);_0x1daa78['offset']=qs[_0x3758('0x1a')](_0x22149e[_0x3758('0x2e')][_0x3758('0x1a')]);}_0x1daa78[_0x3758('0x34')]=qs[_0x3758('0x35')](_0x22149e[_0x3758('0x2e')][_0x3758('0x35')]);_0x1daa78['where']=qs[_0x3758('0x2f')](_[_0x3758('0x36')](_0x22149e['query'],_0x535f3a['filters']));if(_0x22149e[_0x3758('0x2e')][_0x3758('0x37')]){_0x1daa78[_0x3758('0x38')]=_['merge'](_0x1daa78[_0x3758('0x38')],{'$or':_['map'](_0x50d7db,function(_0x8073ff){if(_0x8073ff[_0x3758('0x39')][_0x3758('0x3a')]!==_0x3758('0x3b')){var _0x31750b={};_0x31750b[_0x8073ff['field']]={'$like':'%'+_0x22149e[_0x3758('0x2e')][_0x3758('0x37')]+'%'};return _0x31750b;}})});}_0x1daa78=_[_0x3758('0x3c')]({},_0x1daa78,_0x22149e[_0x3758('0x3d')]);var _0x592941={'where':_0x1daa78[_0x3758('0x38')]};return db[_0x3758('0x2a')][_0x3758('0x19')](_0x592941)[_0x3758('0x22')](function(_0x5a7bc4){_0xbbacc0[_0x3758('0x19')]=_0x5a7bc4;if(_0x22149e['query'][_0x3758('0x3e')]){_0x1daa78[_0x3758('0x3f')]=[{'all':!![]}];}return db['Migration'][_0x3758('0x40')](_0x1daa78);})[_0x3758('0x22')](function(_0x707ca){_0xbbacc0[_0x3758('0x41')]=_0x707ca;return _0xbbacc0;})['then'](respondWithFilteredResult(_0x407e2c,_0x1daa78))[_0x3758('0x42')](handleError(_0x407e2c,null));}; \ No newline at end of file +var _0xe95d=['where','pick','merge','map','type','key','VIRTUAL','field','filter','options','count','includeAll','include','findAll','rows','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','save','update','then','name','send','index','Migration','model','keys','query','filters','attributes','length','hasOwnProperty','order','sort'];(function(_0x80f703,_0x159499){var _0x4479d2=function(_0x350beb){while(--_0x350beb){_0x80f703['push'](_0x80f703['shift']());}};_0x4479d2(++_0x159499);}(_0xe95d,0x85));var _0xde95=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xe95d[_0x5180c3];return _0x55c975;};'use strict';var pdf=require(_0xde95('0x0'));var emlformat=require(_0xde95('0x1'));var rimraf=require(_0xde95('0x2'));var zipdir=require(_0xde95('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xde95('0x4'));var util=require(_0xde95('0x5'));var path=require(_0xde95('0x6'));var sox=require('sox');var csv=require(_0xde95('0x7'));var ejs=require(_0xde95('0x8'));var fs=require('fs');var _=require(_0xde95('0x9'));var squel=require(_0xde95('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde95('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xde95('0xc'));var Redis=require(_0xde95('0xd'));var authService=require(_0xde95('0xe'));var qs=require(_0xde95('0xf'));var hardwareService=require(_0xde95('0x10'));var logger=require('../../config/logger')(_0xde95('0x11'));var utils=require(_0xde95('0x12'));var config=require(_0xde95('0x13'));var db=require(_0xde95('0x14'))['db'];function respondWithStatusCode(_0x3528ab,_0x24b485){_0x24b485=_0x24b485||0xcc;return function(_0x4fc0b3){if(_0x4fc0b3){return _0x3528ab['sendStatus'](_0x24b485);}return _0x3528ab['status'](_0x24b485)[_0xde95('0x15')]();};}function respondWithResult(_0x6a98d1,_0x586cec){_0x586cec=_0x586cec||0xc8;return function(_0x224d42){if(_0x224d42){return _0x6a98d1[_0xde95('0x16')](_0x586cec)[_0xde95('0x17')](_0x224d42);}};}function respondWithFilteredResult(_0x5a5c32,_0x321dd8){return function(_0x2c8ae3){if(_0x2c8ae3){var _0xbd1164=_0x2c8ae3['count'],_0x2f79b2=_0x321dd8[_0xde95('0x18')],_0x2a6a99=_0x321dd8[_0xde95('0x18')]+_0x321dd8[_0xde95('0x19')],_0x21fdeb;if(_0x2a6a99>=_0xbd1164){_0x2a6a99=_0xbd1164;_0x21fdeb=0xc8;}else{_0x21fdeb=0xce;}_0x5a5c32[_0xde95('0x16')](_0x21fdeb);return _0x5a5c32['set'](_0xde95('0x1a'),_0x2f79b2+'-'+_0x2a6a99+'/'+_0xbd1164)[_0xde95('0x17')](_0x2c8ae3);}return null;};}function patchUpdates(_0x35c8bc){return function(_0x44d187){try{jsonpatch[_0xde95('0x1b')](_0x44d187,_0x35c8bc,!![]);}catch(_0x348bc0){return BPromise['reject'](_0x348bc0);}return _0x44d187[_0xde95('0x1c')]();};}function saveUpdates(_0x175669,_0x3c9a24){return function(_0x50ffbb){if(_0x50ffbb){return _0x50ffbb[_0xde95('0x1d')](_0x175669)[_0xde95('0x1e')](function(_0x1ed989){return _0x1ed989;});}return null;};}function removeEntity(_0x27ebbe,_0x1be960){return function(_0x3d08ba){if(_0x3d08ba){return _0x3d08ba['destroy']()['then'](function(){_0x27ebbe[_0xde95('0x16')](0xcc)[_0xde95('0x15')]();});}};}function handleEntityNotFound(_0x4fa7af,_0x1f53a2){return function(_0x5c6a8c){if(!_0x5c6a8c){_0x4fa7af['sendStatus'](0x194);}return _0x5c6a8c;};}function handleError(_0x1144a0,_0x51b1c6){_0x51b1c6=_0x51b1c6||0x1f4;return function(_0x400c28){logger['error'](_0x400c28['stack']);if(_0x400c28['name']){delete _0x400c28[_0xde95('0x1f')];}_0x1144a0[_0xde95('0x16')](_0x51b1c6)[_0xde95('0x20')](_0x400c28);};}exports[_0xde95('0x21')]=function(_0x485627,_0xcb928d){var _0x455045={},_0x2f93f6={},_0x2a723a={'count':0x0,'rows':[]};var _0x407c2f=db[_0xde95('0x22')]['rawAttributes'];_0x2f93f6[_0xde95('0x23')]=_['keys'](_0x407c2f);_0x2f93f6['query']=_[_0xde95('0x24')](_0x485627[_0xde95('0x25')]);_0x2f93f6[_0xde95('0x26')]=_['intersection'](_0x2f93f6[_0xde95('0x23')],_0x2f93f6[_0xde95('0x25')]);_0x455045[_0xde95('0x27')]=_['intersection'](_0x2f93f6[_0xde95('0x23')],qs['fields'](_0x485627[_0xde95('0x25')]['fields']));_0x455045[_0xde95('0x27')]=_0x455045[_0xde95('0x27')][_0xde95('0x28')]?_0x455045[_0xde95('0x27')]:_0x2f93f6[_0xde95('0x23')];if(!_0x485627[_0xde95('0x25')][_0xde95('0x29')]('nolimit')){_0x455045[_0xde95('0x19')]=qs[_0xde95('0x19')](_0x485627['query'][_0xde95('0x19')]);_0x455045[_0xde95('0x18')]=qs['offset'](_0x485627[_0xde95('0x25')][_0xde95('0x18')]);}_0x455045[_0xde95('0x2a')]=qs[_0xde95('0x2b')](_0x485627['query']['sort']);_0x455045[_0xde95('0x2c')]=qs[_0xde95('0x26')](_[_0xde95('0x2d')](_0x485627[_0xde95('0x25')],_0x2f93f6['filters']));if(_0x485627['query']['filter']){_0x455045[_0xde95('0x2c')]=_[_0xde95('0x2e')](_0x455045[_0xde95('0x2c')],{'$or':_[_0xde95('0x2f')](_0x407c2f,function(_0x497fbf){if(_0x497fbf[_0xde95('0x30')][_0xde95('0x31')]!==_0xde95('0x32')){var _0x2af1bb={};_0x2af1bb[_0x497fbf[_0xde95('0x33')]]={'$like':'%'+_0x485627[_0xde95('0x25')][_0xde95('0x34')]+'%'};return _0x2af1bb;}})});}_0x455045=_[_0xde95('0x2e')]({},_0x455045,_0x485627[_0xde95('0x35')]);var _0x6e8349={'where':_0x455045['where']};return db['Migration'][_0xde95('0x36')](_0x6e8349)[_0xde95('0x1e')](function(_0x917be3){_0x2a723a['count']=_0x917be3;if(_0x485627[_0xde95('0x25')][_0xde95('0x37')]){_0x455045[_0xde95('0x38')]=[{'all':!![]}];}return db[_0xde95('0x22')][_0xde95('0x39')](_0x455045);})[_0xde95('0x1e')](function(_0x72599b){_0x2a723a[_0xde95('0x3a')]=_0x72599b;return _0x2a723a;})['then'](respondWithFilteredResult(_0xcb928d,_0x455045))['catch'](handleError(_0xcb928d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e0275f3..1bad422 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 _0x9775=['rimraf','../../config/environment','./migration.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2e8775,_0x310049){var _0x4cbf35=function(_0x103483){while(--_0x103483){_0x2e8775['push'](_0x2e8775['shift']());}};_0x4cbf35(++_0x310049);}(_0x9775,0x10c));var _0x5977=function(_0x1ad17a,_0x2b0b20){_0x1ad17a=_0x1ad17a-0x0;var _0x2c90a7=_0x9775[_0x1ad17a];return _0x2c90a7;};'use strict';var _=require(_0x5977('0x0'));var util=require(_0x5977('0x1'));var logger=require(_0x5977('0x2'))(_0x5977('0x3'));var moment=require('moment');var BPromise=require(_0x5977('0x4'));var rp=require(_0x5977('0x5'));var fs=require('fs');var path=require(_0x5977('0x6'));var rimraf=require(_0x5977('0x7'));var config=require(_0x5977('0x8'));var attributes=require(_0x5977('0x9'));module['exports']=function(_0x4a50fa,_0x5139fe){return _0x4a50fa[_0x5977('0xa')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7777=['api','moment','bluebird','request-promise','path','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger'];(function(_0x571950,_0xf11d26){var _0x1bacce=function(_0x43008b){while(--_0x43008b){_0x571950['push'](_0x571950['shift']());}};_0x1bacce(++_0xf11d26);}(_0x7777,0xc9));var _0x7777=function(_0x477fdb,_0x462b55){_0x477fdb=_0x477fdb-0x0;var _0x32beaf=_0x7777[_0x477fdb];return _0x32beaf;};'use strict';var _=require(_0x7777('0x0'));var util=require(_0x7777('0x1'));var logger=require(_0x7777('0x2'))(_0x7777('0x3'));var moment=require(_0x7777('0x4'));var BPromise=require(_0x7777('0x5'));var rp=require(_0x7777('0x6'));var fs=require('fs');var path=require(_0x7777('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7777('0x8'));module[_0x7777('0x9')]=function(_0x30cf40,_0x29940f){return _0x30cf40['define'](_0x7777('0xa'),attributes,{'tableName':_0x7777('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 4005ae9..6c2a0ed 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 _0xf006=['code','message','result','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x138a07,_0x392f46){var _0x3275b4=function(_0x1bb826){while(--_0x1bb826){_0x138a07['push'](_0x138a07['shift']());}};_0x3275b4(++_0x392f46);}(_0xf006,0x146));var _0x6f00=function(_0x40d816,_0x1bd84d){_0x40d816=_0x40d816-0x0;var _0x181c88=_0xf006[_0x40d816];return _0x181c88;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c29ff,_0x4f918f,_0x3875fb){return new BPromise(function(_0x3001b1,_0x185728){return client[_0x6f00('0x7')](_0x3c29ff,_0x3875fb)[_0x6f00('0x8')](function(_0x3001c6){logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));logger[_0x6f00('0xc')](_0x6f00('0xd'),_0x4f918f,_0x6f00('0xb'),JSON[_0x6f00('0xe')](_0x3001c6));if(_0x3001c6['error']){if(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x10')]===0x1f4){logger[_0x6f00('0xf')](_0x6f00('0xa'),_0x4f918f,_0x3001c6[_0x6f00('0xf')]['message']);return _0x185728(_0x3001c6[_0x6f00('0xf')]['message']);}logger[_0x6f00('0xf')]('Migration,\x20%s,\x20%s',_0x4f918f,_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);return _0x3001b1(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);}else{logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));_0x3001b1(_0x3001c6[_0x6f00('0x12')][_0x6f00('0x11')]);}})['catch'](function(_0x14b15d){logger['error']('Migration,\x20%s,\x20%s',_0x4f918f,_0x14b15d);_0x185728(_0x14b15d);});});} \ No newline at end of file +var _0xb66c=['../../config/environment','jayson/promise','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2b8e23,_0x5c02dc){var _0x451efd=function(_0x4cd906){while(--_0x4cd906){_0x2b8e23['push'](_0x2b8e23['shift']());}};_0x451efd(++_0x5c02dc);}(_0xb66c,0x175));var _0xcb66=function(_0x3fab6f,_0x4253a3){_0x3fab6f=_0x3fab6f-0x0;var _0x1da187=_0xb66c[_0x3fab6f];return _0x1da187;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var moment=require(_0xcb66('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb66('0x2'));var fs=require('fs');var Redis=require(_0xcb66('0x3'));var db=require(_0xcb66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var config=require(_0xcb66('0x7'));var jayson=require(_0xcb66('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19adf5,_0x1b6852,_0xa3993){return new BPromise(function(_0x439f3d,_0xf7bc39){return client['request'](_0x19adf5,_0xa3993)[_0xcb66('0x9')](function(_0x3047f7){logger[_0xcb66('0xa')](_0xcb66('0xb'),_0x1b6852,_0xcb66('0xc'));logger['debug'](_0xcb66('0xd'),_0x1b6852,_0xcb66('0xc'),JSON[_0xcb66('0xe')](_0x3047f7));if(_0x3047f7[_0xcb66('0xf')]){if(_0x3047f7['error'][_0xcb66('0x10')]===0x1f4){logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7[_0xcb66('0xf')]['message']);return _0xf7bc39(_0x3047f7[_0xcb66('0xf')][_0xcb66('0x11')]);}logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7['error'][_0xcb66('0x11')]);return _0x439f3d(_0x3047f7['error'][_0xcb66('0x11')]);}else{logger['info'](_0xcb66('0xb'),_0x1b6852,'request\x20sent');_0x439f3d(_0x3047f7['result'][_0xcb66('0x11')]);}})[_0xcb66('0x12')](function(_0x681ce3){logger[_0xcb66('0xf')]('Migration,\x20%s,\x20%s',_0x1b6852,_0x681ce3);_0xf7bc39(_0x681ce3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c324684..b40493e 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 _0xb2ff=['../../components/interaction/service','./network.controller','get','isAuthenticated','index','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xb2ff,0x123));var _0xfb2f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2ff[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfb2f('0x3'));var config=require('../../config/environment');var controller=require(_0xfb2f('0x4'));router[_0xfb2f('0x5')]('/',auth[_0xfb2f('0x6')](),controller[_0xfb2f('0x7')]);router['get']('/:id',auth[_0xfb2f('0x6')](),controller['show']);router[_0xfb2f('0x8')]('/',auth[_0xfb2f('0x6')](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0xa')]('/:id',auth[_0xfb2f('0x6')](),controller['update']);router[_0xfb2f('0xb')]('/:id',auth[_0xfb2f('0x6')](),controller[_0xfb2f('0xc')]);module[_0xfb2f('0xd')]=router; \ No newline at end of file +var _0x8828=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','put','/:id','multer','util','express'];(function(_0xf78954,_0x16d9c8){var _0x1fef15=function(_0x58aa74){while(--_0x58aa74){_0xf78954['push'](_0xf78954['shift']());}};_0x1fef15(++_0x16d9c8);}(_0x8828,0x1d1));var _0x8882=function(_0x44c87a,_0x30524e){_0x44c87a=_0x44c87a-0x0;var _0x4fc564=_0x8828[_0x44c87a];return _0x4fc564;};'use strict';var multer=require(_0x8882('0x0'));var util=require(_0x8882('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8882('0x2'));var router=express[_0x8882('0x3')]();var auth=require(_0x8882('0x4'));var interaction=require(_0x8882('0x5'));var config=require(_0x8882('0x6'));var controller=require('./network.controller');router[_0x8882('0x7')]('/',auth[_0x8882('0x8')](),controller['index']);router[_0x8882('0x7')]('/:id',auth[_0x8882('0x8')](),controller['show']);router[_0x8882('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8882('0xa')](_0x8882('0xb'),auth[_0x8882('0x8')](),controller['update']);router['delete']('/:id',auth[_0x8882('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1d58331..3a8cba2 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 _0xe942=['externip','STRING','sequelize','exports','ENUM','localnet'];(function(_0x58ee3e,_0x474081){var _0x347c59=function(_0x3347e1){while(--_0x3347e1){_0x58ee3e['push'](_0x58ee3e['shift']());}};_0x347c59(++_0x474081);}(_0xe942,0xe6));var _0x2e94=function(_0x12f57f,_0x459a93){_0x12f57f=_0x12f57f-0x0;var _0x4bd519=_0xe942[_0x12f57f];return _0x4bd519;};'use strict';var Sequelize=require(_0x2e94('0x0'));module[_0x2e94('0x1')]={'type':{'type':Sequelize[_0x2e94('0x2')](_0x2e94('0x3'),_0x2e94('0x4'))},'value':{'type':Sequelize[_0x2e94('0x5')]}}; \ No newline at end of file +var _0xa985=['ENUM','externip','STRING','sequelize','exports'];(function(_0x76c4a1,_0x2f58a9){var _0x1d2e7e=function(_0x63395d){while(--_0x63395d){_0x76c4a1['push'](_0x76c4a1['shift']());}};_0x1d2e7e(++_0x2f58a9);}(_0xa985,0x166));var _0x5a98=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xa985[_0x31ced5];return _0x10d9e5;};'use strict';var Sequelize=require(_0x5a98('0x0'));module[_0x5a98('0x1')]={'type':{'type':Sequelize[_0x5a98('0x2')]('localnet',_0x5a98('0x3'))},'value':{'type':Sequelize[_0x5a98('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5ff3453..e012115 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 _0x3746=['limit','status','set','Content-Range','json','apply','reject','destroy','stack','name','send','index','Network','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','field','includeAll','include','findAll','rows','catch','show','params','find','create','sequelize','transaction','body','readFileSync','join','root','server/files/templates/network.ejs','utf8','render','writeFileSync','format','toLowerCase','chan_sip.so','update','/etc/asterisk/sip_xcally_%s.conf','Reload','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','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','count','offset'];(function(_0x21fdcb,_0x4964c7){var _0x3634f1=function(_0x53aa16){while(--_0x53aa16){_0x21fdcb['push'](_0x21fdcb['shift']());}};_0x3634f1(++_0x4964c7);}(_0x3746,0x1ca));var _0x6374=function(_0x1cc44c,_0x3b9c39){_0x1cc44c=_0x1cc44c-0x0;var _0x3b85e9=_0x3746[_0x1cc44c];return _0x3b85e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6374('0x0'));var rimraf=require(_0x6374('0x1'));var zipdir=require(_0x6374('0x2'));var jsonpatch=require(_0x6374('0x3'));var rp=require(_0x6374('0x4'));var moment=require(_0x6374('0x5'));var BPromise=require(_0x6374('0x6'));var Mustache=require(_0x6374('0x7'));var util=require(_0x6374('0x8'));var path=require(_0x6374('0x9'));var sox=require(_0x6374('0xa'));var csv=require(_0x6374('0xb'));var ejs=require(_0x6374('0xc'));var fs=require('fs');var _=require(_0x6374('0xd'));var squel=require(_0x6374('0xe'));var crypto=require(_0x6374('0xf'));var jsforce=require(_0x6374('0x10'));var deskjs=require(_0x6374('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6374('0x12'));var Papa=require('papaparse');var Redis=require(_0x6374('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x6374('0x14'));var logger=require(_0x6374('0x15'))(_0x6374('0x16'));var utils=require(_0x6374('0x17'));var config=require(_0x6374('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6374('0x19'));var client=jayson['client'][_0x6374('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2a63e8,_0x21c0a1,_0x2a8746){if(_0x2a8746){var _0x526ddf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x526ddf['test'](_0x21c0a1)){return _0x2a63e8;}else{throw new Error(_0x6374('0x1b'));}}else{return _0x2a63e8;}}function respondWithRpcPromise(_0x531e4c,_0x24673f,_0x156d80,_0x557d1a){return new BPromise(function(_0x524bd2,_0x3647ee){var _0x57ad17=_0x557d1a||client;return _0x57ad17[_0x6374('0x1c')](_0x531e4c,_0x156d80)[_0x6374('0x1d')](function(_0xa19a19){logger[_0x6374('0x1e')](_0x6374('0x1f'),_0x24673f,'request\x20sent');logger[_0x6374('0x20')](_0x6374('0x21'),_0x24673f,'request\x20sent',JSON[_0x6374('0x22')](_0xa19a19));if(_0xa19a19['error']){if(_0xa19a19[_0x6374('0x23')][_0x6374('0x24')]===0x1f4){logger[_0x6374('0x23')](_0x6374('0x1f'),_0x24673f,_0xa19a19[_0x6374('0x23')][_0x6374('0x25')]);return _0x3647ee(_0xa19a19[_0x6374('0x23')][_0x6374('0x25')]);}logger[_0x6374('0x23')](_0x6374('0x1f'),_0x24673f,_0xa19a19[_0x6374('0x23')][_0x6374('0x25')]);return _0x524bd2(_0xa19a19[_0x6374('0x23')][_0x6374('0x25')]);}else{logger[_0x6374('0x1e')](_0x6374('0x1f'),_0x24673f,'request\x20sent');_0x524bd2(_0xa19a19[_0x6374('0x26')][_0x6374('0x25')]);}})['catch'](function(_0x6446da){logger[_0x6374('0x23')]('Network,\x20%s,\x20%s',_0x24673f,_0x6446da);_0x3647ee(_0x6446da);});});}function respondWithStatusCode(_0x953fbe,_0x359dbc){_0x359dbc=_0x359dbc||0xcc;return function(_0x2c57ed){if(_0x2c57ed){return _0x953fbe['sendStatus'](_0x359dbc);}return _0x953fbe['status'](_0x359dbc)[_0x6374('0x27')]();};}function respondWithResult(_0x20dfca,_0x47beba){_0x47beba=_0x47beba||0xc8;return function(_0x25e7d4){if(_0x25e7d4){return _0x20dfca['status'](_0x47beba)['json'](_0x25e7d4);}};}function respondWithFilteredResult(_0x30e34e,_0x18127a){return function(_0x3f809e){if(_0x3f809e){var _0x44547e=_0x3f809e[_0x6374('0x28')],_0x1516ce=_0x18127a[_0x6374('0x29')],_0x41f63f=_0x18127a[_0x6374('0x29')]+_0x18127a[_0x6374('0x2a')],_0x36a81b;if(_0x41f63f>=_0x44547e){_0x41f63f=_0x44547e;_0x36a81b=0xc8;}else{_0x36a81b=0xce;}_0x30e34e[_0x6374('0x2b')](_0x36a81b);return _0x30e34e[_0x6374('0x2c')](_0x6374('0x2d'),_0x1516ce+'-'+_0x41f63f+'/'+_0x44547e)[_0x6374('0x2e')](_0x3f809e);}return null;};}function patchUpdates(_0x8c527c){return function(_0x43e043){try{jsonpatch[_0x6374('0x2f')](_0x43e043,_0x8c527c,!![]);}catch(_0x5efe5b){return BPromise[_0x6374('0x30')](_0x5efe5b);}return _0x43e043['save']();};}function saveUpdates(_0x45d20d,_0x2f2302){return function(_0x5ae468){if(_0x5ae468){return _0x5ae468['update'](_0x45d20d)[_0x6374('0x1d')](function(_0x5d0cbf){return _0x5d0cbf;});}return null;};}function removeEntity(_0x547665,_0x434a81){return function(_0x4b4834){if(_0x4b4834){return _0x4b4834[_0x6374('0x31')]()[_0x6374('0x1d')](function(){_0x547665[_0x6374('0x2b')](0xcc)[_0x6374('0x27')]();});}};}function handleEntityNotFound(_0x431118,_0x4fbe66){return function(_0x552b67){if(!_0x552b67){_0x431118['sendStatus'](0x194);}return _0x552b67;};}function handleError(_0x2d2505,_0xbe2a8){_0xbe2a8=_0xbe2a8||0x1f4;return function(_0x3a058e){logger[_0x6374('0x23')](_0x3a058e[_0x6374('0x32')]);if(_0x3a058e[_0x6374('0x33')]){delete _0x3a058e['name'];}_0x2d2505[_0x6374('0x2b')](_0xbe2a8)[_0x6374('0x34')](_0x3a058e);};}exports[_0x6374('0x35')]=function(_0x384a82,_0x56292c){var _0x3a025d={},_0xaf0ce1={},_0x56c882={'count':0x0,'rows':[]};var _0x38b811=db[_0x6374('0x36')][_0x6374('0x37')];_0xaf0ce1['model']=_['keys'](_0x38b811);_0xaf0ce1[_0x6374('0x38')]=_[_0x6374('0x39')](_0x384a82[_0x6374('0x38')]);_0xaf0ce1[_0x6374('0x3a')]=_[_0x6374('0x3b')](_0xaf0ce1['model'],_0xaf0ce1['query']);_0x3a025d['attributes']=_['intersection'](_0xaf0ce1[_0x6374('0x3c')],qs[_0x6374('0x3d')](_0x384a82[_0x6374('0x38')][_0x6374('0x3d')]));_0x3a025d[_0x6374('0x3e')]=_0x3a025d[_0x6374('0x3e')][_0x6374('0x3f')]?_0x3a025d[_0x6374('0x3e')]:_0xaf0ce1[_0x6374('0x3c')];if(!_0x384a82[_0x6374('0x38')][_0x6374('0x40')](_0x6374('0x41'))){_0x3a025d[_0x6374('0x2a')]=qs[_0x6374('0x2a')](_0x384a82['query'][_0x6374('0x2a')]);_0x3a025d['offset']=qs[_0x6374('0x29')](_0x384a82[_0x6374('0x38')]['offset']);}_0x3a025d[_0x6374('0x42')]=qs['sort'](_0x384a82[_0x6374('0x38')][_0x6374('0x43')]);_0x3a025d[_0x6374('0x44')]=qs[_0x6374('0x3a')](_['pick'](_0x384a82[_0x6374('0x38')],_0xaf0ce1[_0x6374('0x3a')]));if(_0x384a82[_0x6374('0x38')][_0x6374('0x45')]){_0x3a025d[_0x6374('0x44')]=_[_0x6374('0x46')](_0x3a025d[_0x6374('0x44')],{'$or':_[_0x6374('0x47')](_0x38b811,function(_0x270f85){if(_0x270f85[_0x6374('0x48')][_0x6374('0x49')]!=='VIRTUAL'){var _0x4b16a4={};_0x4b16a4[_0x270f85[_0x6374('0x4a')]]={'$like':'%'+_0x384a82['query'][_0x6374('0x45')]+'%'};return _0x4b16a4;}})});}_0x3a025d=_['merge']({},_0x3a025d,_0x384a82['options']);var _0x3a26f4={'where':_0x3a025d[_0x6374('0x44')]};return db[_0x6374('0x36')][_0x6374('0x28')](_0x3a26f4)['then'](function(_0x315f38){_0x56c882[_0x6374('0x28')]=_0x315f38;if(_0x384a82[_0x6374('0x38')][_0x6374('0x4b')]){_0x3a025d[_0x6374('0x4c')]=[{'all':!![]}];}return db[_0x6374('0x36')][_0x6374('0x4d')](_0x3a025d);})[_0x6374('0x1d')](function(_0x17cc42){_0x56c882[_0x6374('0x4e')]=_0x17cc42;return _0x56c882;})[_0x6374('0x1d')](respondWithFilteredResult(_0x56292c,_0x3a025d))[_0x6374('0x4f')](handleError(_0x56292c,null));};exports[_0x6374('0x50')]=function(_0x8bffff,_0x42c2c4){var _0x4da919={'raw':!![],'where':{'id':_0x8bffff[_0x6374('0x51')]['id']}},_0x31dac0={};_0x31dac0['model']=_[_0x6374('0x39')](db[_0x6374('0x36')][_0x6374('0x37')]);_0x31dac0[_0x6374('0x38')]=_['keys'](_0x8bffff[_0x6374('0x38')]);_0x31dac0[_0x6374('0x3a')]=_[_0x6374('0x3b')](_0x31dac0[_0x6374('0x3c')],_0x31dac0[_0x6374('0x38')]);_0x4da919[_0x6374('0x3e')]=_[_0x6374('0x3b')](_0x31dac0[_0x6374('0x3c')],qs['fields'](_0x8bffff[_0x6374('0x38')][_0x6374('0x3d')]));_0x4da919[_0x6374('0x3e')]=_0x4da919[_0x6374('0x3e')][_0x6374('0x3f')]?_0x4da919[_0x6374('0x3e')]:_0x31dac0[_0x6374('0x3c')];if(_0x8bffff['query'][_0x6374('0x4b')]){_0x4da919[_0x6374('0x4c')]=[{'all':!![]}];}_0x4da919=_[_0x6374('0x46')]({},_0x4da919,_0x8bffff['options']);return db['Network'][_0x6374('0x52')](_0x4da919)[_0x6374('0x1d')](handleEntityNotFound(_0x42c2c4,null))[_0x6374('0x1d')](respondWithResult(_0x42c2c4,null))['catch'](handleError(_0x42c2c4,null));};exports[_0x6374('0x53')]=function(_0x3916e4,_0xec3d1f,_0x1e37d0){var _0x5640ae;return db[_0x6374('0x54')][_0x6374('0x55')](function(_0x228c17){return db[_0x6374('0x36')]['create'](_0x3916e4['body'],{'raw':!![]})[_0x6374('0x1d')](function(_0x7a8a59){_0x5640ae=_0x7a8a59;return db[_0x6374('0x36')]['findAll']({'where':{'type':_0x3916e4[_0x6374('0x56')][_0x6374('0x48')]},'raw':!![]});})[_0x6374('0x1d')](function(_0x32d89d){var _0x2aa9b2=fs[_0x6374('0x57')](path[_0x6374('0x58')](config[_0x6374('0x59')],_0x6374('0x5a')),_0x6374('0x5b'));var _0x8c9320=ejs[_0x6374('0x5c')](_0x2aa9b2,{'networks':_0x32d89d||[]});fs[_0x6374('0x5d')](util[_0x6374('0x5e')]('/etc/asterisk/sip_xcally_%s.conf',_0x3916e4[_0x6374('0x56')][_0x6374('0x48')][_0x6374('0x5f')]()),_0x8c9320);})[_0x6374('0x1d')](function(){return respondWithRpcPromise('Reload',_0x6374('0x53'),{'module':_0x6374('0x60')});})['then'](function(){return _0x5640ae;});})[_0x6374('0x1d')](respondWithResult(_0xec3d1f,0xc9))[_0x6374('0x4f')](handleError(_0xec3d1f,null));};exports[_0x6374('0x61')]=function(_0x59ccc5,_0x1026c9,_0x668b7a){var _0x2b0f76;return db[_0x6374('0x54')][_0x6374('0x55')](function(_0x1d25b2){return db[_0x6374('0x36')][_0x6374('0x52')]({'where':{'id':_0x59ccc5[_0x6374('0x51')]['id']}})['then'](handleEntityNotFound(_0x1026c9,null))[_0x6374('0x1d')](saveUpdates(_0x59ccc5['body'],null))['then'](function(_0x15ad48){if(_0x15ad48){_0x2b0f76=_0x15ad48;return db['Network'][_0x6374('0x4d')]({'where':{'type':_0x2b0f76[_0x6374('0x48')]},'raw':!![]});}return null;})[_0x6374('0x1d')](function(_0x1a6f6d){if(_0x1a6f6d){var _0x2c424b=fs[_0x6374('0x57')](path[_0x6374('0x58')](config[_0x6374('0x59')],_0x6374('0x5a')),_0x6374('0x5b'));var _0x2f428b=ejs['render'](_0x2c424b,{'networks':_0x1a6f6d||[]});fs[_0x6374('0x5d')](util[_0x6374('0x5e')](_0x6374('0x62'),_0x2b0f76[_0x6374('0x48')][_0x6374('0x5f')]()),_0x2f428b);return respondWithRpcPromise(_0x6374('0x63'),_0x6374('0x61'),{'module':_0x6374('0x60')});}return null;})['then'](function(_0x2529a5){if(_0x2529a5){return _0x2b0f76;}return null;});})[_0x6374('0x1d')](respondWithResult(_0x1026c9,null))[_0x6374('0x4f')](handleError(_0x1026c9,null));};exports[_0x6374('0x31')]=function(_0x26a604,_0x2a6ba0,_0x40994e){var _0x564fc6;return db[_0x6374('0x36')][_0x6374('0x52')]({'where':{'id':_0x26a604['params']['id']}})['then'](function(_0x428295){_0x564fc6=_0x428295;return _0x428295;})[_0x6374('0x1d')](handleEntityNotFound(_0x2a6ba0,null))['then'](removeEntity(_0x2a6ba0,null))[_0x6374('0x1d')](function(){if(_0x564fc6){return db[_0x6374('0x36')][_0x6374('0x4d')]({'where':{'type':_0x564fc6[_0x6374('0x48')]},'raw':!![]});}})['then'](function(_0x154273){if(_0x154273){var _0x354124=fs['readFileSync'](path[_0x6374('0x58')](config[_0x6374('0x59')],_0x6374('0x5a')),_0x6374('0x5b'));var _0x2240c1=ejs[_0x6374('0x5c')](_0x354124,{'networks':_0x154273||[]});fs[_0x6374('0x5d')](util['format'](_0x6374('0x62'),_0x564fc6[_0x6374('0x48')][_0x6374('0x5f')]()),_0x2240c1);return respondWithRpcPromise(_0x6374('0x63'),'destroy',{'module':'chan_sip.so'});}})[_0x6374('0x4f')](handleError(_0x2a6ba0,null));}; \ No newline at end of file +var _0x6398=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','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','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','Network','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','map','VIRTUAL','field','filter','options','count','include','findAll','rows','catch','show','length','includeAll','merge','find','create','transaction','body','type','readFileSync','root','server/files/templates/network.ejs','utf8','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','update','sequelize','params','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x28e62c,_0x401ffa){var _0x367e19=function(_0x28089c){while(--_0x28089c){_0x28e62c['push'](_0x28e62c['shift']());}};_0x367e19(++_0x401ffa);}(_0x6398,0x1ef));var _0x8639=function(_0x2a702f,_0x377aa7){_0x2a702f=_0x2a702f-0x0;var _0x52106f=_0x6398[_0x2a702f];return _0x52106f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8639('0x0'));var rimraf=require(_0x8639('0x1'));var zipdir=require(_0x8639('0x2'));var jsonpatch=require(_0x8639('0x3'));var rp=require(_0x8639('0x4'));var moment=require(_0x8639('0x5'));var BPromise=require(_0x8639('0x6'));var Mustache=require(_0x8639('0x7'));var util=require('util');var path=require(_0x8639('0x8'));var sox=require(_0x8639('0x9'));var csv=require(_0x8639('0xa'));var ejs=require(_0x8639('0xb'));var fs=require('fs');var _=require(_0x8639('0xc'));var squel=require(_0x8639('0xd'));var crypto=require(_0x8639('0xe'));var jsforce=require(_0x8639('0xf'));var deskjs=require(_0x8639('0x10'));var toCsv=require(_0x8639('0xa'));var querystring=require('querystring');var Papa=require(_0x8639('0x11'));var Redis=require(_0x8639('0x12'));var authService=require(_0x8639('0x13'));var qs=require(_0x8639('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8639('0x15'))(_0x8639('0x16'));var utils=require('../../config/utils');var config=require(_0x8639('0x17'));var db=require(_0x8639('0x18'))['db'];var jayson=require(_0x8639('0x19'));var client=jayson[_0x8639('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x42661e,_0x2577d2,_0x44faf3){if(_0x44faf3){var _0x8ad013=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8ad013['test'](_0x2577d2)){return _0x42661e;}else{throw new Error(_0x8639('0x1b'));}}else{return _0x42661e;}}function respondWithRpcPromise(_0x493f3b,_0x2c1684,_0x423c35,_0x3053de){return new BPromise(function(_0x47ec42,_0x58acb9){var _0x4ef2c4=_0x3053de||client;return _0x4ef2c4[_0x8639('0x1c')](_0x493f3b,_0x423c35)[_0x8639('0x1d')](function(_0x3e9b6f){logger[_0x8639('0x1e')]('Network,\x20%s,\x20%s',_0x2c1684,_0x8639('0x1f'));logger[_0x8639('0x20')](_0x8639('0x21'),_0x2c1684,_0x8639('0x1f'),JSON[_0x8639('0x22')](_0x3e9b6f));if(_0x3e9b6f[_0x8639('0x23')]){if(_0x3e9b6f[_0x8639('0x23')][_0x8639('0x24')]===0x1f4){logger[_0x8639('0x23')](_0x8639('0x25'),_0x2c1684,_0x3e9b6f[_0x8639('0x23')][_0x8639('0x26')]);return _0x58acb9(_0x3e9b6f[_0x8639('0x23')][_0x8639('0x26')]);}logger['error'](_0x8639('0x25'),_0x2c1684,_0x3e9b6f[_0x8639('0x23')][_0x8639('0x26')]);return _0x47ec42(_0x3e9b6f['error'][_0x8639('0x26')]);}else{logger[_0x8639('0x1e')](_0x8639('0x25'),_0x2c1684,_0x8639('0x1f'));_0x47ec42(_0x3e9b6f[_0x8639('0x27')][_0x8639('0x26')]);}})['catch'](function(_0x5a6e21){logger[_0x8639('0x23')]('Network,\x20%s,\x20%s',_0x2c1684,_0x5a6e21);_0x58acb9(_0x5a6e21);});});}function respondWithStatusCode(_0x1dabdd,_0x39364d){_0x39364d=_0x39364d||0xcc;return function(_0x5472f0){if(_0x5472f0){return _0x1dabdd[_0x8639('0x28')](_0x39364d);}return _0x1dabdd[_0x8639('0x29')](_0x39364d)[_0x8639('0x2a')]();};}function respondWithResult(_0x2e3314,_0x17bfab){_0x17bfab=_0x17bfab||0xc8;return function(_0x4c4631){if(_0x4c4631){return _0x2e3314['status'](_0x17bfab)[_0x8639('0x2b')](_0x4c4631);}};}function respondWithFilteredResult(_0x105f30,_0x9033e3){return function(_0x298f22){if(_0x298f22){var _0x2e5e4b=_0x298f22['count'],_0x237617=_0x9033e3[_0x8639('0x2c')],_0x37c608=_0x9033e3['offset']+_0x9033e3[_0x8639('0x2d')],_0x3f2b69;if(_0x37c608>=_0x2e5e4b){_0x37c608=_0x2e5e4b;_0x3f2b69=0xc8;}else{_0x3f2b69=0xce;}_0x105f30[_0x8639('0x29')](_0x3f2b69);return _0x105f30[_0x8639('0x2e')](_0x8639('0x2f'),_0x237617+'-'+_0x37c608+'/'+_0x2e5e4b)['json'](_0x298f22);}return null;};}function patchUpdates(_0x491cf0){return function(_0x7912c3){try{jsonpatch[_0x8639('0x30')](_0x7912c3,_0x491cf0,!![]);}catch(_0x23120c){return BPromise['reject'](_0x23120c);}return _0x7912c3[_0x8639('0x31')]();};}function saveUpdates(_0x72ff28,_0x35e0eb){return function(_0xd9bf8e){if(_0xd9bf8e){return _0xd9bf8e['update'](_0x72ff28)[_0x8639('0x1d')](function(_0x2b90a2){return _0x2b90a2;});}return null;};}function removeEntity(_0xc73804,_0x5e598b){return function(_0x557a11){if(_0x557a11){return _0x557a11[_0x8639('0x32')]()['then'](function(){_0xc73804[_0x8639('0x29')](0xcc)[_0x8639('0x2a')]();});}};}function handleEntityNotFound(_0x1052d0,_0x492503){return function(_0x4beed8){if(!_0x4beed8){_0x1052d0[_0x8639('0x28')](0x194);}return _0x4beed8;};}function handleError(_0x11ee18,_0x15b802){_0x15b802=_0x15b802||0x1f4;return function(_0x411438){logger['error'](_0x411438[_0x8639('0x33')]);if(_0x411438[_0x8639('0x34')]){delete _0x411438[_0x8639('0x34')];}_0x11ee18[_0x8639('0x29')](_0x15b802)[_0x8639('0x35')](_0x411438);};}exports['index']=function(_0x73c96,_0x7f3a00){var _0x345605={},_0x5ebe13={},_0x42a067={'count':0x0,'rows':[]};var _0x540e92=db[_0x8639('0x36')][_0x8639('0x37')];_0x5ebe13[_0x8639('0x38')]=_[_0x8639('0x39')](_0x540e92);_0x5ebe13[_0x8639('0x3a')]=_[_0x8639('0x39')](_0x73c96[_0x8639('0x3a')]);_0x5ebe13['filters']=_['intersection'](_0x5ebe13['model'],_0x5ebe13['query']);_0x345605['attributes']=_[_0x8639('0x3b')](_0x5ebe13[_0x8639('0x38')],qs[_0x8639('0x3c')](_0x73c96[_0x8639('0x3a')][_0x8639('0x3c')]));_0x345605[_0x8639('0x3d')]=_0x345605['attributes']['length']?_0x345605[_0x8639('0x3d')]:_0x5ebe13[_0x8639('0x38')];if(!_0x73c96[_0x8639('0x3a')][_0x8639('0x3e')](_0x8639('0x3f'))){_0x345605[_0x8639('0x2d')]=qs[_0x8639('0x2d')](_0x73c96[_0x8639('0x3a')][_0x8639('0x2d')]);_0x345605[_0x8639('0x2c')]=qs[_0x8639('0x2c')](_0x73c96['query']['offset']);}_0x345605[_0x8639('0x40')]=qs[_0x8639('0x41')](_0x73c96['query'][_0x8639('0x41')]);_0x345605[_0x8639('0x42')]=qs[_0x8639('0x43')](_['pick'](_0x73c96[_0x8639('0x3a')],_0x5ebe13[_0x8639('0x43')]));if(_0x73c96[_0x8639('0x3a')]['filter']){_0x345605[_0x8639('0x42')]=_['merge'](_0x345605['where'],{'$or':_[_0x8639('0x44')](_0x540e92,function(_0x15e67d){if(_0x15e67d['type']['key']!==_0x8639('0x45')){var _0x3b418c={};_0x3b418c[_0x15e67d[_0x8639('0x46')]]={'$like':'%'+_0x73c96[_0x8639('0x3a')][_0x8639('0x47')]+'%'};return _0x3b418c;}})});}_0x345605=_['merge']({},_0x345605,_0x73c96[_0x8639('0x48')]);var _0x372252={'where':_0x345605[_0x8639('0x42')]};return db[_0x8639('0x36')]['count'](_0x372252)[_0x8639('0x1d')](function(_0x979ff2){_0x42a067[_0x8639('0x49')]=_0x979ff2;if(_0x73c96[_0x8639('0x3a')]['includeAll']){_0x345605[_0x8639('0x4a')]=[{'all':!![]}];}return db['Network'][_0x8639('0x4b')](_0x345605);})[_0x8639('0x1d')](function(_0x2a8e2d){_0x42a067[_0x8639('0x4c')]=_0x2a8e2d;return _0x42a067;})[_0x8639('0x1d')](respondWithFilteredResult(_0x7f3a00,_0x345605))[_0x8639('0x4d')](handleError(_0x7f3a00,null));};exports[_0x8639('0x4e')]=function(_0xe773a7,_0x59f911){var _0x179195={'raw':!![],'where':{'id':_0xe773a7['params']['id']}},_0x59e3c0={};_0x59e3c0[_0x8639('0x38')]=_[_0x8639('0x39')](db['Network']['rawAttributes']);_0x59e3c0[_0x8639('0x3a')]=_['keys'](_0xe773a7[_0x8639('0x3a')]);_0x59e3c0['filters']=_['intersection'](_0x59e3c0['model'],_0x59e3c0[_0x8639('0x3a')]);_0x179195[_0x8639('0x3d')]=_[_0x8639('0x3b')](_0x59e3c0[_0x8639('0x38')],qs[_0x8639('0x3c')](_0xe773a7['query'][_0x8639('0x3c')]));_0x179195[_0x8639('0x3d')]=_0x179195[_0x8639('0x3d')][_0x8639('0x4f')]?_0x179195[_0x8639('0x3d')]:_0x59e3c0[_0x8639('0x38')];if(_0xe773a7['query'][_0x8639('0x50')]){_0x179195['include']=[{'all':!![]}];}_0x179195=_[_0x8639('0x51')]({},_0x179195,_0xe773a7['options']);return db[_0x8639('0x36')][_0x8639('0x52')](_0x179195)['then'](handleEntityNotFound(_0x59f911,null))[_0x8639('0x1d')](respondWithResult(_0x59f911,null))[_0x8639('0x4d')](handleError(_0x59f911,null));};exports[_0x8639('0x53')]=function(_0x5bca69,_0x5334c2,_0x2790af){var _0x3d891a;return db['sequelize'][_0x8639('0x54')](function(_0x45f331){return db['Network'][_0x8639('0x53')](_0x5bca69[_0x8639('0x55')],{'raw':!![]})[_0x8639('0x1d')](function(_0xea17d7){_0x3d891a=_0xea17d7;return db[_0x8639('0x36')]['findAll']({'where':{'type':_0x5bca69[_0x8639('0x55')][_0x8639('0x56')]},'raw':!![]});})[_0x8639('0x1d')](function(_0x537002){var _0x40976e=fs[_0x8639('0x57')](path['join'](config[_0x8639('0x58')],_0x8639('0x59')),_0x8639('0x5a'));var _0xcb9d0f=ejs[_0x8639('0x5b')](_0x40976e,{'networks':_0x537002||[]});fs[_0x8639('0x5c')](util[_0x8639('0x5d')](_0x8639('0x5e'),_0x5bca69[_0x8639('0x55')]['type'][_0x8639('0x5f')]()),_0xcb9d0f);})[_0x8639('0x1d')](function(){return respondWithRpcPromise(_0x8639('0x60'),'create',{'module':_0x8639('0x61')});})[_0x8639('0x1d')](function(){return _0x3d891a;});})[_0x8639('0x1d')](respondWithResult(_0x5334c2,0xc9))['catch'](handleError(_0x5334c2,null));};exports[_0x8639('0x62')]=function(_0xcf0061,_0x3f2ac4,_0x2efaaa){var _0x46dcda;return db[_0x8639('0x63')][_0x8639('0x54')](function(_0x2e9c85){return db[_0x8639('0x36')][_0x8639('0x52')]({'where':{'id':_0xcf0061[_0x8639('0x64')]['id']}})[_0x8639('0x1d')](handleEntityNotFound(_0x3f2ac4,null))[_0x8639('0x1d')](saveUpdates(_0xcf0061[_0x8639('0x55')],null))[_0x8639('0x1d')](function(_0x333a67){if(_0x333a67){_0x46dcda=_0x333a67;return db[_0x8639('0x36')][_0x8639('0x4b')]({'where':{'type':_0x46dcda['type']},'raw':!![]});}return null;})[_0x8639('0x1d')](function(_0x32d66c){if(_0x32d66c){var _0x4032ce=fs['readFileSync'](path[_0x8639('0x65')](config[_0x8639('0x58')],'server/files/templates/network.ejs'),'utf8');var _0x53a10a=ejs['render'](_0x4032ce,{'networks':_0x32d66c||[]});fs[_0x8639('0x5c')](util[_0x8639('0x5d')]('/etc/asterisk/sip_xcally_%s.conf',_0x46dcda[_0x8639('0x56')][_0x8639('0x5f')]()),_0x53a10a);return respondWithRpcPromise('Reload','update',{'module':_0x8639('0x61')});}return null;})[_0x8639('0x1d')](function(_0x139c01){if(_0x139c01){return _0x46dcda;}return null;});})['then'](respondWithResult(_0x3f2ac4,null))[_0x8639('0x4d')](handleError(_0x3f2ac4,null));};exports['destroy']=function(_0x15a88b,_0x43a10f,_0x3ffecf){var _0x35a4bc;return db['Network'][_0x8639('0x52')]({'where':{'id':_0x15a88b[_0x8639('0x64')]['id']}})['then'](function(_0x426169){_0x35a4bc=_0x426169;return _0x426169;})[_0x8639('0x1d')](handleEntityNotFound(_0x43a10f,null))[_0x8639('0x1d')](removeEntity(_0x43a10f,null))[_0x8639('0x1d')](function(){if(_0x35a4bc){return db[_0x8639('0x36')]['findAll']({'where':{'type':_0x35a4bc[_0x8639('0x56')]},'raw':!![]});}})[_0x8639('0x1d')](function(_0x157a2f){if(_0x157a2f){var _0x9e1496=fs[_0x8639('0x57')](path[_0x8639('0x65')](config[_0x8639('0x58')],_0x8639('0x59')),_0x8639('0x5a'));var _0x57c92b=ejs[_0x8639('0x5b')](_0x9e1496,{'networks':_0x157a2f||[]});fs[_0x8639('0x5c')](util[_0x8639('0x5d')](_0x8639('0x5e'),_0x35a4bc['type'][_0x8639('0x5f')]()),_0x57c92b);return respondWithRpcPromise(_0x8639('0x60'),_0x8639('0x32'),{'module':_0x8639('0x61')});}})[_0x8639('0x4d')](handleError(_0x43a10f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c6971ac..b161226 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 _0x659a=['./network.attributes','exports','define','Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x163472,_0x10042b){var _0xaeaf9=function(_0x565e2e){while(--_0x565e2e){_0x163472['push'](_0x163472['shift']());}};_0xaeaf9(++_0x10042b);}(_0x659a,0x1cc));var _0xa659=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x659a[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xa659('0x0'));var util=require(_0xa659('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa659('0x2'));var BPromise=require(_0xa659('0x3'));var rp=require(_0xa659('0x4'));var fs=require('fs');var path=require(_0xa659('0x5'));var rimraf=require(_0xa659('0x6'));var config=require(_0xa659('0x7'));var attributes=require(_0xa659('0x8'));module[_0xa659('0x9')]=function(_0x50b133,_0x4a52cb){return _0x50b133[_0xa659('0xa')](_0xa659('0xb'),attributes,{'tableName':_0xa659('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ed=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./network.attributes','network'];(function(_0x226a5a,_0x112230){var _0xf36874=function(_0x1f2ccb){while(--_0x1f2ccb){_0x226a5a['push'](_0x226a5a['shift']());}};_0xf36874(++_0x112230);}(_0xb8ed,0x118));var _0xdb8e=function(_0x4ca72a,_0x29cf9a){_0x4ca72a=_0x4ca72a-0x0;var _0x40ce6b=_0xb8ed[_0x4ca72a];return _0x40ce6b;};'use strict';var _=require(_0xdb8e('0x0'));var util=require(_0xdb8e('0x1'));var logger=require(_0xdb8e('0x2'))(_0xdb8e('0x3'));var moment=require('moment');var BPromise=require(_0xdb8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb8e('0x5'));var rimraf=require(_0xdb8e('0x6'));var config=require(_0xdb8e('0x7'));var attributes=require(_0xdb8e('0x8'));module['exports']=function(_0x4402d0,_0x3066b0){return _0x4402d0['define']('Network',attributes,{'tableName':_0xdb8e('0x9'),'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 5a09e03..e03f7b9 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 _0x8958=['client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x8958,0x93));var _0x8895=function(_0x6595a7,_0x1be709){_0x6595a7=_0x6595a7-0x0;var _0x22bb82=_0x8958[_0x6595a7];return _0x22bb82;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){return client[_0x8895('0x7')](_0x124e1e,_0x33013a)[_0x8895('0x8')](function(_0x24fe49){logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));logger[_0x8895('0xc')](_0x8895('0xd'),_0x40cec6,_0x8895('0xb'),JSON['stringify'](_0x24fe49));if(_0x24fe49[_0x8895('0xe')]){if(_0x24fe49[_0x8895('0xe')][_0x8895('0xf')]===0x1f4){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x24fe49[_0x8895('0xe')]['message']);return _0xe018b8(_0x24fe49[_0x8895('0xe')][_0x8895('0x10')]);}logger[_0x8895('0xe')]('Network,\x20%s,\x20%s',_0x40cec6,_0x24fe49['error'][_0x8895('0x10')]);return _0x51376b(_0x24fe49['error'][_0x8895('0x10')]);}else{logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));_0x51376b(_0x24fe49[_0x8895('0x11')]['message']);}})[_0x8895('0x12')](function(_0x100fc8){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x100fc8);_0xe018b8(_0x100fc8);});});} \ No newline at end of file +var _0x8ca9=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x2925d4,_0x274bde){var _0xb2bb3e=function(_0x92509e){while(--_0x92509e){_0x2925d4['push'](_0x2925d4['shift']());}};_0xb2bb3e(++_0x274bde);}(_0x8ca9,0x9c));var _0x98ca=function(_0x52704,_0x86eb21){_0x52704=_0x52704-0x0;var _0x11402f=_0x8ca9[_0x52704];return _0x11402f;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson['client'][_0x98ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca4097,_0x18c349,_0x2852a0){return new BPromise(function(_0x323c95,_0x28a37a){return client[_0x98ca('0xa')](_0xca4097,_0x2852a0)[_0x98ca('0xb')](function(_0x277c29){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x18c349,_0x98ca('0xe'),JSON[_0x98ca('0x11')](_0x277c29));if(_0x277c29[_0x98ca('0x12')]){if(_0x277c29[_0x98ca('0x12')]['code']===0x1f4){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x28a37a(_0x277c29['error'][_0x98ca('0x13')]);}logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x323c95(_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);}else{logger['info'](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));_0x323c95(_0x277c29[_0x98ca('0x14')][_0x98ca('0x13')]);}})['catch'](function(_0x238c1a){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x238c1a);_0x28a37a(_0x238c1a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 86fc08e..f9369de 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 _0x5c70=['show','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','/:id','destroy','/:id/dispositions','delete','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x4c24ab,_0x498c4b){var _0x48bcf3=function(_0x1b3745){while(--_0x1b3745){_0x4c24ab['push'](_0x4c24ab['shift']());}};_0x48bcf3(++_0x498c4b);}(_0x5c70,0xbb));var _0x05c7=function(_0x42bd6b,_0x107bc1){_0x42bd6b=_0x42bd6b-0x0;var _0x1b294d=_0x5c70[_0x42bd6b];return _0x1b294d;};'use strict';var multer=require(_0x05c7('0x0'));var util=require(_0x05c7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x05c7('0x2'));var router=express[_0x05c7('0x3')]();var auth=require(_0x05c7('0x4'));var interaction=require(_0x05c7('0x5'));var config=require(_0x05c7('0x6'));var controller=require(_0x05c7('0x7'));router[_0x05c7('0x8')]('/',auth['isAuthenticated'](),controller[_0x05c7('0x9')]);router[_0x05c7('0x8')](_0x05c7('0xa'),auth[_0x05c7('0xb')](),controller[_0x05c7('0xc')]);router[_0x05c7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x05c7('0xd')]);router[_0x05c7('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x05c7('0xe')]);router[_0x05c7('0x8')](_0x05c7('0xf'),auth[_0x05c7('0xb')](),controller[_0x05c7('0x10')]);router[_0x05c7('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x05c7('0x11')]);router[_0x05c7('0x8')](_0x05c7('0x12'),auth['isAuthenticated'](),controller[_0x05c7('0x13')]);router[_0x05c7('0x8')]('/:id/users',auth[_0x05c7('0xb')](),controller[_0x05c7('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x05c7('0x15')]);router[_0x05c7('0x16')]('/:id/dispositions',auth[_0x05c7('0xb')](),controller[_0x05c7('0x17')]);router[_0x05c7('0x16')](_0x05c7('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x05c7('0x16')](_0x05c7('0x18'),controller[_0x05c7('0x19')]);router[_0x05c7('0x16')]('/:id/applications',auth[_0x05c7('0xb')](),controller[_0x05c7('0x1a')]);router['post'](_0x05c7('0x1b'),auth[_0x05c7('0xb')](),controller[_0x05c7('0x1c')]);router['post'](_0x05c7('0x1d'),auth['isAuthenticated'](),controller[_0x05c7('0x1e')]);router[_0x05c7('0x1f')]('/:id',auth[_0x05c7('0xb')](),controller[_0x05c7('0x20')]);router['delete'](_0x05c7('0x21'),auth[_0x05c7('0xb')](),controller[_0x05c7('0x22')]);router['delete'](_0x05c7('0x23'),auth[_0x05c7('0xb')](),controller['removeDispositions']);router[_0x05c7('0x24')](_0x05c7('0xf'),auth[_0x05c7('0xb')](),controller[_0x05c7('0x25')]);router[_0x05c7('0x24')](_0x05c7('0x1b'),auth[_0x05c7('0xb')](),controller[_0x05c7('0x26')]);module[_0x05c7('0x27')]=router; \ No newline at end of file +var _0x0ad8=['post','addDisposition','/:id/notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users'];(function(_0x2f0570,_0x30e16f){var _0x2b2a29=function(_0x2c335f){while(--_0x2c335f){_0x2f0570['push'](_0x2f0570['shift']());}};_0x2b2a29(++_0x30e16f);}(_0x0ad8,0xfb));var _0x80ad=function(_0x54055c,_0xb744b9){_0x54055c=_0x54055c-0x0;var _0x2f7e14=_0x0ad8[_0x54055c];return _0x2f7e14;};'use strict';var multer=require(_0x80ad('0x0'));var util=require(_0x80ad('0x1'));var path=require(_0x80ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x80ad('0x3'));var router=express['Router']();var auth=require(_0x80ad('0x4'));var interaction=require(_0x80ad('0x5'));var config=require(_0x80ad('0x6'));var controller=require(_0x80ad('0x7'));router['get']('/',auth[_0x80ad('0x8')](),controller['index']);router[_0x80ad('0x9')](_0x80ad('0xa'),auth[_0x80ad('0x8')](),controller[_0x80ad('0xb')]);router[_0x80ad('0x9')]('/:id',auth[_0x80ad('0x8')](),controller[_0x80ad('0xc')]);router[_0x80ad('0x9')](_0x80ad('0xd'),auth[_0x80ad('0x8')](),controller['getDispositions']);router[_0x80ad('0x9')](_0x80ad('0xe'),auth[_0x80ad('0x8')](),controller[_0x80ad('0xf')]);router[_0x80ad('0x9')](_0x80ad('0x10'),auth[_0x80ad('0x8')](),controller[_0x80ad('0x11')]);router['get'](_0x80ad('0x12'),auth[_0x80ad('0x8')](),controller[_0x80ad('0x13')]);router[_0x80ad('0x9')](_0x80ad('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x80ad('0x15')]('/',auth[_0x80ad('0x8')](),controller['create']);router[_0x80ad('0x15')]('/:id/dispositions',auth[_0x80ad('0x8')](),controller[_0x80ad('0x16')]);router[_0x80ad('0x15')](_0x80ad('0xe'),auth[_0x80ad('0x8')](),controller['addAnswer']);router[_0x80ad('0x15')](_0x80ad('0x17'),controller['notify']);router[_0x80ad('0x15')]('/:id/applications',auth[_0x80ad('0x8')](),controller[_0x80ad('0x18')]);router[_0x80ad('0x15')](_0x80ad('0x14'),auth[_0x80ad('0x8')](),controller[_0x80ad('0x19')]);router[_0x80ad('0x15')]('/:id/send',auth[_0x80ad('0x8')](),controller[_0x80ad('0x1a')]);router[_0x80ad('0x1b')]('/:id',auth[_0x80ad('0x8')](),controller[_0x80ad('0x1c')]);router[_0x80ad('0x1d')]('/:id',auth[_0x80ad('0x8')](),controller[_0x80ad('0x1e')]);router[_0x80ad('0x1d')](_0x80ad('0xd'),auth['isAuthenticated'](),controller[_0x80ad('0x1f')]);router['delete']('/:id/canned_answers',auth[_0x80ad('0x8')](),controller['removeAnswers']);router['delete'](_0x80ad('0x14'),auth[_0x80ad('0x8')](),controller[_0x80ad('0x20')]);module[_0x80ad('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0089e60..af96882 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 _0x45a8=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x45a8,0x9f));var _0x845a=function(_0x1d59c5,_0x1a1d39){_0x1d59c5=_0x1d59c5-0x0;var _0x13e8c0=_0x45a8[_0x1d59c5];return _0x13e8c0;};'use strict';var Sequelize=require(_0x845a('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x845a('0x1')],'unique':_0x845a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x845a('0x1')]},'token':{'type':Sequelize[_0x845a('0x1')],'defaultValue':function(){return rs[_0x845a('0x3')]();}},'replyUri':{'type':Sequelize[_0x845a('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x845a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x845a('0x4')],'defaultValue':function(){return _0x845a('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x845a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x845a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x845a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x845a('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x845a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x845a('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x845a('0x6')],'defaultValue':![],'comment':_0x845a('0x8'),'set':function(_0x1d2c02){if(!_0x1d2c02)this[_0x845a('0x9')](_0x845a('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x1d2c02);}}}; \ No newline at end of file +var _0xdcbd=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1d483e,_0x25818f){var _0x3969a3=function(_0x3c3d81){while(--_0x3c3d81){_0x1d483e['push'](_0x1d483e['shift']());}};_0x3969a3(++_0x25818f);}(_0xdcbd,0xb6));var _0xddcb=function(_0x4784f4,_0x199217){_0x4784f4=_0x4784f4-0x0;var _0x1fb0ce=_0xdcbd[_0x4784f4];return _0x1fb0ce;};'use strict';var Sequelize=require(_0xddcb('0x0'));var rs=require('randomstring');module[_0xddcb('0x1')]={'name':{'type':Sequelize[_0xddcb('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xddcb('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xddcb('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xddcb('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xddcb('0x3')],'defaultValue':function(){return _0xddcb('0x4');}},'notificationSound':{'type':Sequelize[_0xddcb('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xddcb('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xddcb('0x2')]},'queueTransfer':{'type':Sequelize[_0xddcb('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xddcb('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xddcb('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xddcb('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xddcb('0x5')],'defaultValue':![],'comment':_0xddcb('0x8'),'set':function(_0x3f848f){if(!_0x3f848f)this[_0xddcb('0x9')](_0xddcb('0xa'),null);this[_0xddcb('0x9')]('mandatoryDisposition',_0x3f848f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b17cbe4..62c8e83 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 _0xb2ec=['options','count','includeAll','rows','show','mandatoryDispositionPause','attributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','OpenchannelAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','ids','notify','openchannel','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Applications','applications','priority','asc','account','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','include','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','OpenchannelAccount','rawAttributes','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','field'];(function(_0x49fff3,_0xe8b995){var _0x3a81fb=function(_0x32c6f3){while(--_0x32c6f3){_0x49fff3['push'](_0x49fff3['shift']());}};_0x3a81fb(++_0xe8b995);}(_0xb2ec,0x6b));var _0xcb2e=function(_0x45a0ec,_0x3f1272){_0x45a0ec=_0x45a0ec-0x0;var _0x5c0598=_0xb2ec[_0x45a0ec];return _0x5c0598;};'use strict';var pdf=require(_0xcb2e('0x0'));var emlformat=require(_0xcb2e('0x1'));var rimraf=require(_0xcb2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb2e('0x3'));var rp=require('request-promise');var moment=require(_0xcb2e('0x4'));var BPromise=require(_0xcb2e('0x5'));var Mustache=require(_0xcb2e('0x6'));var util=require(_0xcb2e('0x7'));var path=require(_0xcb2e('0x8'));var sox=require(_0xcb2e('0x9'));var csv=require(_0xcb2e('0xa'));var ejs=require(_0xcb2e('0xb'));var fs=require('fs');var _=require(_0xcb2e('0xc'));var squel=require(_0xcb2e('0xd'));var crypto=require(_0xcb2e('0xe'));var jsforce=require(_0xcb2e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcb2e('0xa'));var querystring=require(_0xcb2e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb2e('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb2e('0x12'))(_0xcb2e('0x13'));var utils=require(_0xcb2e('0x14'));var config=require(_0xcb2e('0x15'));var db=require(_0xcb2e('0x16'))['db'];config[_0xcb2e('0x17')]=_[_0xcb2e('0x18')](config[_0xcb2e('0x17')],{'host':_0xcb2e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb2e('0x17')]));require(_0xcb2e('0x1a'))[_0xcb2e('0x1b')](socket);var jayson=require(_0xcb2e('0x1c'));var client=jayson[_0xcb2e('0x1d')][_0xcb2e('0x1e')]({'port':0x232c});var client9002=jayson[_0xcb2e('0x1d')][_0xcb2e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x59e84a,_0x391e3c,_0x18bf25){if(_0x18bf25){var _0xdf515c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdf515c[_0xcb2e('0x1f')](_0x391e3c)){return _0x59e84a;}else{throw new Error(_0xcb2e('0x20'));}}else{return _0x59e84a;}}function respondWithRpcPromise(_0x2ea4f2,_0x36ba1a,_0x13436e,_0x2e8cf1){return new BPromise(function(_0x32e786,_0x3c6ca1){var _0x59057f=_0x2e8cf1||client;return _0x59057f[_0xcb2e('0x21')](_0x2ea4f2,_0x13436e)[_0xcb2e('0x22')](function(_0x58e2ed){logger[_0xcb2e('0x23')](_0xcb2e('0x24'),_0x36ba1a,_0xcb2e('0x25'));logger[_0xcb2e('0x26')](_0xcb2e('0x27'),_0x36ba1a,_0xcb2e('0x25'),JSON[_0xcb2e('0x28')](_0x58e2ed));if(_0x58e2ed[_0xcb2e('0x29')]){if(_0x58e2ed[_0xcb2e('0x29')][_0xcb2e('0x2a')]===0x1f4){logger['error'](_0xcb2e('0x24'),_0x36ba1a,_0x58e2ed[_0xcb2e('0x29')][_0xcb2e('0x2b')]);return _0x3c6ca1(_0x58e2ed['error'][_0xcb2e('0x2b')]);}logger[_0xcb2e('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x36ba1a,_0x58e2ed[_0xcb2e('0x29')][_0xcb2e('0x2b')]);return _0x32e786(_0x58e2ed[_0xcb2e('0x29')][_0xcb2e('0x2b')]);}else{logger[_0xcb2e('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x36ba1a,'request\x20sent');_0x32e786(_0x58e2ed[_0xcb2e('0x2c')][_0xcb2e('0x2b')]);}})[_0xcb2e('0x2d')](function(_0x392d5f){logger[_0xcb2e('0x29')](_0xcb2e('0x24'),_0x36ba1a,_0x392d5f);_0x3c6ca1(_0x392d5f);});});}function respondWithStatusCode(_0x17f158,_0x4969ec){_0x4969ec=_0x4969ec||0xcc;return function(_0x3883b4){if(_0x3883b4){return _0x17f158['sendStatus'](_0x4969ec);}return _0x17f158[_0xcb2e('0x2e')](_0x4969ec)[_0xcb2e('0x2f')]();};}function respondWithResult(_0x28ae48,_0x14e655){_0x14e655=_0x14e655||0xc8;return function(_0x2e5e0b){if(_0x2e5e0b){return _0x28ae48[_0xcb2e('0x2e')](_0x14e655)[_0xcb2e('0x30')](_0x2e5e0b);}};}function respondWithFilteredResult(_0x5911b8,_0x361d99){return function(_0x1d40c0){if(_0x1d40c0){var _0x48b420=_0x1d40c0['count'],_0x2654ad=_0x361d99[_0xcb2e('0x31')],_0xe1064=_0x361d99[_0xcb2e('0x31')]+_0x361d99[_0xcb2e('0x32')],_0x566c93;if(_0xe1064>=_0x48b420){_0xe1064=_0x48b420;_0x566c93=0xc8;}else{_0x566c93=0xce;}_0x5911b8[_0xcb2e('0x2e')](_0x566c93);return _0x5911b8[_0xcb2e('0x33')](_0xcb2e('0x34'),_0x2654ad+'-'+_0xe1064+'/'+_0x48b420)['json'](_0x1d40c0);}return null;};}function patchUpdates(_0xfd971f){return function(_0x4716f3){try{jsonpatch[_0xcb2e('0x35')](_0x4716f3,_0xfd971f,!![]);}catch(_0x64db33){return BPromise[_0xcb2e('0x36')](_0x64db33);}return _0x4716f3[_0xcb2e('0x37')]();};}function saveUpdates(_0xf25e73,_0x15ec65){return function(_0x4ad9c2){if(_0x4ad9c2){return _0x4ad9c2[_0xcb2e('0x38')](_0xf25e73)['then'](function(_0xbe4a33){return _0xbe4a33;});}return null;};}function removeEntity(_0x141a03,_0x1dc057){return function(_0x90e1e){if(_0x90e1e){return _0x90e1e[_0xcb2e('0x39')]()[_0xcb2e('0x22')](function(){var _0x5372cb=_0x90e1e[_0xcb2e('0x3a')]({'plain':!![]});var _0x84f6bd=_0xcb2e('0x3b');return db[_0xcb2e('0x3c')]['destroy']({'where':{'type':_0x84f6bd,'resourceId':_0x5372cb['id']}})[_0xcb2e('0x22')](function(){return _0x90e1e;});})[_0xcb2e('0x22')](function(){_0x141a03[_0xcb2e('0x2e')](0xcc)[_0xcb2e('0x2f')]();});}};}function handleEntityNotFound(_0x2a86f5,_0x12542f){return function(_0x33079c){if(!_0x33079c){_0x2a86f5['sendStatus'](0x194);}return _0x33079c;};}function handleError(_0x35bad4,_0x52329a){_0x52329a=_0x52329a||0x1f4;return function(_0x2d01f4){logger[_0xcb2e('0x29')](_0x2d01f4['stack']);if(_0x2d01f4[_0xcb2e('0x3d')]){delete _0x2d01f4[_0xcb2e('0x3d')];}_0x35bad4[_0xcb2e('0x2e')](_0x52329a)[_0xcb2e('0x3e')](_0x2d01f4);};}exports[_0xcb2e('0x3f')]=function(_0xf8162d,_0x6ce161){var _0x4d8895={'include':[{'model':db[_0xcb2e('0x40')],'as':'mandatoryDispositionPause'}]},_0x1dad6d={},_0x4fae80={'count':0x0,'rows':[]};var _0x578d51=db[_0xcb2e('0x41')][_0xcb2e('0x42')];_0x1dad6d[_0xcb2e('0x43')]=_['keys'](_0x578d51);_0x1dad6d[_0xcb2e('0x44')]=_[_0xcb2e('0x45')](_0xf8162d[_0xcb2e('0x44')]);_0x1dad6d[_0xcb2e('0x46')]=_[_0xcb2e('0x47')](_0x1dad6d[_0xcb2e('0x43')],_0x1dad6d[_0xcb2e('0x44')]);_0x4d8895['attributes']=_[_0xcb2e('0x47')](_0x1dad6d[_0xcb2e('0x43')],qs[_0xcb2e('0x48')](_0xf8162d[_0xcb2e('0x44')][_0xcb2e('0x48')]));_0x4d8895['attributes']=_0x4d8895['attributes'][_0xcb2e('0x49')]?_0x4d8895['attributes']:_0x1dad6d[_0xcb2e('0x43')];if(!_0xf8162d[_0xcb2e('0x44')][_0xcb2e('0x4a')](_0xcb2e('0x4b'))){_0x4d8895[_0xcb2e('0x32')]=qs[_0xcb2e('0x32')](_0xf8162d[_0xcb2e('0x44')][_0xcb2e('0x32')]);_0x4d8895[_0xcb2e('0x31')]=qs[_0xcb2e('0x31')](_0xf8162d[_0xcb2e('0x44')][_0xcb2e('0x31')]);}_0x4d8895[_0xcb2e('0x4c')]=qs['sort'](_0xf8162d[_0xcb2e('0x44')][_0xcb2e('0x4d')]);_0x4d8895[_0xcb2e('0x4e')]=qs[_0xcb2e('0x46')](_[_0xcb2e('0x4f')](_0xf8162d[_0xcb2e('0x44')],_0x1dad6d['filters']));if(_0xf8162d[_0xcb2e('0x44')][_0xcb2e('0x50')]){_0x4d8895[_0xcb2e('0x4e')]=_[_0xcb2e('0x51')](_0x4d8895[_0xcb2e('0x4e')],{'$or':_[_0xcb2e('0x52')](_0x578d51,function(_0x56517f){if(_0x56517f['type']['key']!=='VIRTUAL'){var _0x3cc69f={};_0x3cc69f[_0x56517f[_0xcb2e('0x53')]]={'$like':'%'+_0xf8162d[_0xcb2e('0x44')]['filter']+'%'};return _0x3cc69f;}})});}_0x4d8895=_['merge']({},_0x4d8895,_0xf8162d[_0xcb2e('0x54')]);var _0x36bf44={'where':_0x4d8895['where']};return db['OpenchannelAccount'][_0xcb2e('0x55')](_0x36bf44)['then'](function(_0x492754){_0x4fae80[_0xcb2e('0x55')]=_0x492754;if(_0xf8162d['query'][_0xcb2e('0x56')]){_0x4d8895['include']=[{'all':!![]}];}return db[_0xcb2e('0x41')]['findAll'](_0x4d8895);})[_0xcb2e('0x22')](function(_0x4a769b){_0x4fae80[_0xcb2e('0x57')]=_0x4a769b;return _0x4fae80;})[_0xcb2e('0x22')](respondWithFilteredResult(_0x6ce161,_0x4d8895))[_0xcb2e('0x2d')](handleError(_0x6ce161,null));};exports[_0xcb2e('0x58')]=function(_0x47a977,_0xacea5){var _0x16b104={'raw':![],'where':{'id':_0x47a977['params']['id']},'include':[{'model':db[_0xcb2e('0x40')],'as':_0xcb2e('0x59')}]},_0x4c4202={};_0x4c4202[_0xcb2e('0x43')]=_[_0xcb2e('0x45')](db[_0xcb2e('0x41')][_0xcb2e('0x42')]);_0x4c4202[_0xcb2e('0x44')]=_[_0xcb2e('0x45')](_0x47a977[_0xcb2e('0x44')]);_0x4c4202['filters']=_[_0xcb2e('0x47')](_0x4c4202[_0xcb2e('0x43')],_0x4c4202[_0xcb2e('0x44')]);_0x16b104[_0xcb2e('0x5a')]=_['intersection'](_0x4c4202['model'],qs[_0xcb2e('0x48')](_0x47a977['query']['fields']));_0x16b104['attributes']=_0x16b104[_0xcb2e('0x5a')]['length']?_0x16b104[_0xcb2e('0x5a')]:_0x4c4202[_0xcb2e('0x43')];if(_0x47a977[_0xcb2e('0x44')][_0xcb2e('0x56')]){_0x16b104['include']=[{'all':!![]}];}_0x16b104=_[_0xcb2e('0x51')]({},_0x16b104,_0x47a977[_0xcb2e('0x54')]);return db[_0xcb2e('0x41')][_0xcb2e('0x5b')](_0x16b104)['then'](handleEntityNotFound(_0xacea5,null))[_0xcb2e('0x22')](respondWithResult(_0xacea5,null))['catch'](handleError(_0xacea5,null));};exports[_0xcb2e('0x5c')]=function(_0x3f54e5,_0x646e3c){return db[_0xcb2e('0x41')][_0xcb2e('0x5c')](_0x3f54e5['body'],{})['then'](function(_0x31c5a7){var _0x53d871=_0x3f54e5[_0xcb2e('0x5d')]['get']({'plain':!![]});if(!_0x53d871)throw new Error(_0xcb2e('0x5e'));if(_0x53d871['role']===_0xcb2e('0x5d')){var _0x3ec1c8=_0x31c5a7[_0xcb2e('0x3a')]({'plain':!![]});var _0x5d7e44=_0xcb2e('0x3b');return db[_0xcb2e('0x5f')][_0xcb2e('0x5b')]({'where':{'name':_0x5d7e44,'userProfileId':_0x53d871[_0xcb2e('0x60')]},'raw':!![]})[_0xcb2e('0x22')](function(_0x93d5a5){if(_0x93d5a5&&_0x93d5a5['autoAssociation']===0x0){return db[_0xcb2e('0x3c')][_0xcb2e('0x5c')]({'name':_0x3ec1c8[_0xcb2e('0x3d')],'resourceId':_0x3ec1c8['id'],'type':_0x93d5a5[_0xcb2e('0x3d')],'sectionId':_0x93d5a5['id']},{})[_0xcb2e('0x22')](function(){return _0x31c5a7;});}else{return _0x31c5a7;}})[_0xcb2e('0x2d')](function(_0x17de8e){logger[_0xcb2e('0x29')](_0xcb2e('0x61'),_0x17de8e);throw _0x17de8e;});}return _0x31c5a7;})['then'](respondWithResult(_0x646e3c,0xc9))[_0xcb2e('0x2d')](handleError(_0x646e3c,null));};exports[_0xcb2e('0x38')]=function(_0x26e5cb,_0x543879){if(_0x26e5cb[_0xcb2e('0x62')]['id']){delete _0x26e5cb['body']['id'];}return db[_0xcb2e('0x41')][_0xcb2e('0x5b')]({'where':{'id':_0x26e5cb[_0xcb2e('0x63')]['id']},'include':[{'model':db[_0xcb2e('0x40')],'as':'mandatoryDispositionPause'}]})[_0xcb2e('0x22')](handleEntityNotFound(_0x543879,null))['then'](saveUpdates(_0x26e5cb[_0xcb2e('0x62')],null))['then'](respondWithResult(_0x543879,null))[_0xcb2e('0x2d')](handleError(_0x543879,null));};exports['destroy']=function(_0x2cda44,_0x3f8df1){return db['OpenchannelAccount'][_0xcb2e('0x5b')]({'where':{'id':_0x2cda44[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x3f8df1,null))['then'](removeEntity(_0x3f8df1,null))[_0xcb2e('0x2d')](handleError(_0x3f8df1,null));};exports[_0xcb2e('0x64')]=function(_0x1b7856,_0x1aca0c){return db[_0xcb2e('0x41')][_0xcb2e('0x64')]()[_0xcb2e('0x22')](respondWithResult(_0x1aca0c,null))[_0xcb2e('0x2d')](handleError(_0x1aca0c,null));};exports[_0xcb2e('0x65')]=function(_0x39f0a1,_0x3aff6c,_0x136254){if(_0x39f0a1[_0xcb2e('0x62')]['id']){delete _0x39f0a1[_0xcb2e('0x62')]['id'];}return db['OpenchannelAccount'][_0xcb2e('0x5b')]({'where':{'id':_0x39f0a1['params']['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x3aff6c,null))[_0xcb2e('0x22')](function(_0x2410ba){if(_0x2410ba){_0x39f0a1[_0xcb2e('0x62')][_0xcb2e('0x66')]=_0x2410ba['id'];return db[_0xcb2e('0x67')][_0xcb2e('0x5c')](_0x39f0a1[_0xcb2e('0x62')]);}})[_0xcb2e('0x22')](respondWithResult(_0x3aff6c,null))['catch'](handleError(_0x3aff6c,null));};exports[_0xcb2e('0x68')]=function(_0x2bfd08,_0x5dc4da,_0x4acbb1){var _0x40b56d={'raw':![],'where':{}};var _0x47ac12={};var _0x50b3e8={'count':0x0,'rows':[]};return db[_0xcb2e('0x41')]['findOne']({'where':{'id':_0x2bfd08['params']['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x5dc4da,null))[_0xcb2e('0x22')](function(_0x11ad56){if(_0x11ad56){_0x47ac12[_0xcb2e('0x43')]=_[_0xcb2e('0x45')](db[_0xcb2e('0x67')][_0xcb2e('0x42')]);_0x47ac12[_0xcb2e('0x44')]=_[_0xcb2e('0x45')](_0x2bfd08[_0xcb2e('0x44')]);_0x47ac12[_0xcb2e('0x46')]=_[_0xcb2e('0x47')](_0x47ac12[_0xcb2e('0x43')],_0x47ac12[_0xcb2e('0x44')]);_0x40b56d['attributes']=_[_0xcb2e('0x47')](_0x47ac12[_0xcb2e('0x43')],qs[_0xcb2e('0x48')](_0x2bfd08[_0xcb2e('0x44')][_0xcb2e('0x48')]));_0x40b56d[_0xcb2e('0x5a')]=_0x40b56d[_0xcb2e('0x5a')]['length']?_0x40b56d['attributes']:_0x47ac12['model'];if(!_0x2bfd08[_0xcb2e('0x44')][_0xcb2e('0x4a')](_0xcb2e('0x4b'))){_0x40b56d['limit']=qs[_0xcb2e('0x32')](_0x2bfd08[_0xcb2e('0x44')][_0xcb2e('0x32')]);_0x40b56d[_0xcb2e('0x31')]=qs[_0xcb2e('0x31')](_0x2bfd08['query'][_0xcb2e('0x31')]);}_0x40b56d[_0xcb2e('0x4c')]=qs['sort'](_0x2bfd08[_0xcb2e('0x44')][_0xcb2e('0x4d')]);_0x40b56d[_0xcb2e('0x4e')]=qs[_0xcb2e('0x46')](_['pick'](_0x2bfd08[_0xcb2e('0x44')],_0x47ac12[_0xcb2e('0x46')]));_0x40b56d[_0xcb2e('0x4e')][_0xcb2e('0x69')]=_0x11ad56['id'];if(_0x2bfd08[_0xcb2e('0x44')][_0xcb2e('0x50')]){_0x40b56d[_0xcb2e('0x4e')]=_['merge'](_0x40b56d[_0xcb2e('0x4e')],{'$or':_[_0xcb2e('0x52')](_0x40b56d['attributes'],function(_0x573e72){var _0x4b2171={};_0x4b2171[_0x573e72]={'$like':'%'+_0x2bfd08['query'][_0xcb2e('0x50')]+'%'};return _0x4b2171;})});}_0x40b56d=_[_0xcb2e('0x51')]({},_0x40b56d,_0x2bfd08['options']);return db['Disposition'][_0xcb2e('0x55')]({'where':_0x40b56d[_0xcb2e('0x4e')]})['then'](function(_0x1d81c5){_0x50b3e8[_0xcb2e('0x55')]=_0x1d81c5;if(_0x2bfd08[_0xcb2e('0x44')]['includeAll']){_0x40b56d['include']=[{'all':!![]}];}return db[_0xcb2e('0x67')][_0xcb2e('0x6a')](_0x40b56d);})[_0xcb2e('0x22')](function(_0x3d0e0c){_0x50b3e8[_0xcb2e('0x57')]=_0x3d0e0c;return _0x50b3e8;});}})[_0xcb2e('0x22')](respondWithFilteredResult(_0x5dc4da,_0x40b56d))[_0xcb2e('0x2d')](handleError(_0x5dc4da,null));};exports[_0xcb2e('0x6b')]=function(_0x119257,_0x2e8ecf,_0x52f85c){return db[_0xcb2e('0x41')][_0xcb2e('0x5b')]({'where':{'id':_0x119257[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x2e8ecf,null))[_0xcb2e('0x22')](function(_0x392a9a){if(_0x392a9a){return _0x392a9a[_0xcb2e('0x6b')](_0x119257[_0xcb2e('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x2e8ecf,null))[_0xcb2e('0x2d')](handleError(_0x2e8ecf,null));};exports[_0xcb2e('0x6c')]=function(_0x4245ab,_0x131111,_0x476f7d){if(_0x4245ab[_0xcb2e('0x62')]['id']){delete _0x4245ab[_0xcb2e('0x62')]['id'];}return db[_0xcb2e('0x41')]['find']({'where':{'id':_0x4245ab['params']['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x131111,null))[_0xcb2e('0x22')](function(_0x22fb3c){if(_0x22fb3c){_0x4245ab['body']['OpenchannelAccountId']=_0x22fb3c['id'];return db[_0xcb2e('0x6d')][_0xcb2e('0x5c')](_0x4245ab[_0xcb2e('0x62')]);}})[_0xcb2e('0x22')](respondWithResult(_0x131111,null))[_0xcb2e('0x2d')](handleError(_0x131111,null));};exports['getAnswers']=function(_0x444966,_0x1a841a,_0x55a26f){var _0x2c58be={'raw':![],'where':{}};var _0x371ad0={};var _0x2f58f4={'count':0x0,'rows':[]};return db[_0xcb2e('0x41')][_0xcb2e('0x6e')]({'where':{'id':_0x444966[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x1a841a,null))[_0xcb2e('0x22')](function(_0x3d4c05){if(_0x3d4c05){_0x371ad0[_0xcb2e('0x43')]=_['keys'](db['CannedAnswer'][_0xcb2e('0x42')]);_0x371ad0['query']=_[_0xcb2e('0x45')](_0x444966[_0xcb2e('0x44')]);_0x371ad0[_0xcb2e('0x46')]=_[_0xcb2e('0x47')](_0x371ad0[_0xcb2e('0x43')],_0x371ad0[_0xcb2e('0x44')]);_0x2c58be['attributes']=_['intersection'](_0x371ad0[_0xcb2e('0x43')],qs[_0xcb2e('0x48')](_0x444966[_0xcb2e('0x44')][_0xcb2e('0x48')]));_0x2c58be[_0xcb2e('0x5a')]=_0x2c58be['attributes'][_0xcb2e('0x49')]?_0x2c58be[_0xcb2e('0x5a')]:_0x371ad0[_0xcb2e('0x43')];if(!_0x444966[_0xcb2e('0x44')]['hasOwnProperty'](_0xcb2e('0x4b'))){_0x2c58be[_0xcb2e('0x32')]=qs[_0xcb2e('0x32')](_0x444966[_0xcb2e('0x44')][_0xcb2e('0x32')]);_0x2c58be[_0xcb2e('0x31')]=qs[_0xcb2e('0x31')](_0x444966['query']['offset']);}_0x2c58be['order']=qs[_0xcb2e('0x4d')](_0x444966[_0xcb2e('0x44')][_0xcb2e('0x4d')]);_0x2c58be['where']=qs[_0xcb2e('0x46')](_[_0xcb2e('0x4f')](_0x444966['query'],_0x371ad0[_0xcb2e('0x46')]));_0x2c58be[_0xcb2e('0x4e')][_0xcb2e('0x69')]=_0x3d4c05['id'];if(_0x444966[_0xcb2e('0x44')][_0xcb2e('0x50')]){_0x2c58be['where']=_[_0xcb2e('0x51')](_0x2c58be[_0xcb2e('0x4e')],{'$or':_['map'](_0x2c58be['attributes'],function(_0x367e75){var _0x1e1377={};_0x1e1377[_0x367e75]={'$like':'%'+_0x444966['query'][_0xcb2e('0x50')]+'%'};return _0x1e1377;})});}_0x2c58be=_[_0xcb2e('0x51')]({},_0x2c58be,_0x444966[_0xcb2e('0x54')]);return db[_0xcb2e('0x6d')][_0xcb2e('0x55')]({'where':_0x2c58be[_0xcb2e('0x4e')]})[_0xcb2e('0x22')](function(_0x3285af){_0x2f58f4['count']=_0x3285af;if(_0x444966[_0xcb2e('0x44')][_0xcb2e('0x56')]){_0x2c58be['include']=[{'all':!![]}];}return db[_0xcb2e('0x6d')][_0xcb2e('0x6a')](_0x2c58be);})[_0xcb2e('0x22')](function(_0x134e2a){_0x2f58f4[_0xcb2e('0x57')]=_0x134e2a;return _0x2f58f4;});}})[_0xcb2e('0x22')](respondWithFilteredResult(_0x1a841a,_0x2c58be))[_0xcb2e('0x2d')](handleError(_0x1a841a,null));};exports[_0xcb2e('0x6f')]=function(_0x466d8e,_0x5dd84c,_0x40ffad){return db[_0xcb2e('0x41')]['find']({'where':{'id':_0x466d8e[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x5dd84c,null))['then'](function(_0x61375){if(_0x61375){return _0x61375[_0xcb2e('0x6f')](_0x466d8e[_0xcb2e('0x44')][_0xcb2e('0x70')]);}})['then'](respondWithStatusCode(_0x5dd84c,null))['catch'](handleError(_0x5dd84c,null));};exports[_0xcb2e('0x71')]=function(_0x4839b6,_0x24fec7,_0x57795c){var _0x56dc5e={'body':_0x4839b6['body'],'channel':_0xcb2e('0x72')};var _0x4711ab=[];var _0x3eedd1=[];var _0x11ce6c={};var _0x2842fa=![];return db[_0xcb2e('0x73')][_0xcb2e('0x64')]()[_0xcb2e('0x22')](function(_0x3dd18f){if(!_0x3dd18f){throw new db['Sequelize']['ValidationError'](_0xcb2e('0x74'));}_0x4711ab=_['difference'](_[_0xcb2e('0x45')](_0x3dd18f),[_0xcb2e('0x75'),_0xcb2e('0x76')]);_0x3eedd1=_[_0xcb2e('0x77')](_[_0xcb2e('0x45')](_0x3dd18f),[_0xcb2e('0x75'),_0xcb2e('0x76'),_0xcb2e('0x78'),_0xcb2e('0x79')]);if(_0x4839b6[_0xcb2e('0x62')]['id']){delete _0x4839b6[_0xcb2e('0x62')]['id'];}if(_[_0xcb2e('0x7a')](_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x7b')])){throw new db[(_0xcb2e('0x7c'))][(_0xcb2e('0x7d'))](_0xcb2e('0x7e'));}if(_['isNil'](_0x4839b6['body'][_0xcb2e('0x62')])||_0x4839b6['body']['body']===''){throw new db[(_0xcb2e('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4839b6['body'][_0xcb2e('0x7f')])){throw new db[(_0xcb2e('0x7c'))]['ValidationError'](_0xcb2e('0x80')+_0x3eedd1);}if(!_[_0xcb2e('0x81')](_0x3eedd1,_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x7f')])){throw new db[(_0xcb2e('0x7c'))][(_0xcb2e('0x7d'))](_0xcb2e('0x82')+_0x3eedd1);}_0x11ce6c[_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x7f')]]=_0x4839b6[_0xcb2e('0x62')]['from'];})[_0xcb2e('0x22')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x4839b6[_0xcb2e('0x63')]['id']},'include':[{'model':db[_0xcb2e('0x83')],'as':_0xcb2e('0x84'),'include':[{'model':db[_0xcb2e('0x73')],'as':'Contacts','where':_0x11ce6c,'limit':0x1,'order':[[_0xcb2e('0x76'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xcb2e('0x85')}]});})[_0xcb2e('0x22')](handleEntityNotFound(_0x24fec7,null))['then'](function(_0x5c1566){if(_0x5c1566&&_0x5c1566[_0xcb2e('0x84')]){_0x56dc5e['account']=_0x5c1566;_0x56dc5e[_0xcb2e('0x86')]=_0x5c1566[_0xcb2e('0x85')];_0x56dc5e['list']=_0x5c1566['List'];_0x56dc5e[_0xcb2e('0x86')]=_['orderBy'](_0x56dc5e[_0xcb2e('0x86')],[_0xcb2e('0x87')],[_0xcb2e('0x88')]);if(_0x56dc5e['account'][_0xcb2e('0x85')]){delete _0x56dc5e[_0xcb2e('0x89')][_0xcb2e('0x85')];}if(_0x56dc5e[_0xcb2e('0x89')][_0xcb2e('0x84')]&&_0x56dc5e['account'][_0xcb2e('0x84')]['Contacts']['length']){return _0x56dc5e['account']['List'][_0xcb2e('0x8a')][0x0];}var _0x1fdac1=_[_0xcb2e('0x18')](_0x4839b6[_0xcb2e('0x62')],{'firstName':_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x7b')],'ListId':_0x5c1566[_0xcb2e('0x79')]});_0x1fdac1[_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x7f')]]=_0x4839b6['body'][_0xcb2e('0x7b')];return db[_0xcb2e('0x73')]['create'](_0x1fdac1,{'fields':_0x4711ab,'raw':!![]});}})[_0xcb2e('0x22')](handleEntityNotFound(_0x24fec7,null))['then'](function(_0x9aee68){_0x56dc5e[_0xcb2e('0x8b')]=_0x9aee68;if(_0x9aee68){var _0x4fd9ba={'ContactId':_0x9aee68['id'],'OpenchannelAccountId':_0x4839b6[_0xcb2e('0x63')]['id'],'from':(_0x9aee68['firstName']||'')+'\x20'+(_0x9aee68[_0xcb2e('0x8c')]||'')};var _0x2a98ed={'OpenchannelAccountId':_0x4839b6[_0xcb2e('0x63')]['id'],'closed':![]};if(_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x8d')]){_0x2a98ed[_0xcb2e('0x8d')]=_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x8d')];return db[_0xcb2e('0x8e')][_0xcb2e('0x5b')]({'where':_0x2a98ed})[_0xcb2e('0x22')](function(_0x5619b4){if(_0x5619b4){return[_0x5619b4,![]];}_0x4fd9ba[_0xcb2e('0x8d')]=_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x8d')];_0x4fd9ba[_0xcb2e('0x8f')]=_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x8f')];return db[_0xcb2e('0x8e')][_0xcb2e('0x5c')](_0x4fd9ba)[_0xcb2e('0x22')](function(_0x2c695){return[_0x2c695,!![]];});});}else{_0x2a98ed['threadId']=null;}_0x2a98ed[_0xcb2e('0x90')]=_0x9aee68['id'];return db[_0xcb2e('0x8e')][_0xcb2e('0x5b')]({'where':_0x2a98ed})[_0xcb2e('0x22')](function(_0x13462){if(_0x13462){return[_0x13462,![]];}return db[_0xcb2e('0x8e')]['create'](_0x4fd9ba)[_0xcb2e('0x22')](function(_0x30d563){return[_0x30d563,!![]];});});}})[_0xcb2e('0x91')](function(_0x467cce,_0x1cc425){if(_0x467cce){_0x2842fa=_0x1cc425;if(!_0x1cc425){var _0x15918b={'from':(_0x56dc5e[_0xcb2e('0x8b')][_0xcb2e('0x92')]||'')+'\x20'+(_0x56dc5e['contact'][_0xcb2e('0x8c')]||'')};if(_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x8d')]&&_0x4839b6['body'][_0xcb2e('0x93')]&&_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x8d')]!=_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x93')]){_0x15918b[_0xcb2e('0x8d')]=_0x4839b6[_0xcb2e('0x62')]['messageId'];}return _0x467cce[_0xcb2e('0x38')](_0x15918b);}else{return _0x467cce;}}})[_0xcb2e('0x22')](function(_0x3235e9){_0x56dc5e['interaction']=_0x3235e9[_0xcb2e('0x3a')]({'plain':!![]});_0x56dc5e[_0xcb2e('0x94')]['created']=_0x2842fa;if(_0x56dc5e[_0xcb2e('0x94')][_0xcb2e('0x95')]){if(_0x56dc5e['account'][_0xcb2e('0x96')]){_0x56dc5e[_0xcb2e('0x86')][_0xcb2e('0x97')]({'id':0x0,'priority':_0x56dc5e[_0xcb2e('0x86')][_0xcb2e('0x49')]+0x1,'app':'close','appdata':_0xcb2e('0x98'),'interval':_0xcb2e('0x99')});}}return db[_0xcb2e('0x9a')][_0xcb2e('0x5c')]({'body':_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x62')],'OpenchannelAccountId':_0x4839b6[_0xcb2e('0x63')]['id'],'OpenchannelInteractionId':_0x3235e9['id'],'direction':'in','ContactId':_0x56dc5e[_0xcb2e('0x8b')]['id'],'AttachmentId':_0x4839b6[_0xcb2e('0x62')][_0xcb2e('0x9b')]});})[_0xcb2e('0x22')](function(_0x1831c6){_0x56dc5e[_0xcb2e('0x2b')]=_0x1831c6;if(_0x56dc5e['interaction'][_0xcb2e('0x9c')]){return db[_0xcb2e('0x9d')]['find']({'attributes':['id',_0xcb2e('0x3d')],'where':{'id':_0x56dc5e[_0xcb2e('0x94')][_0xcb2e('0x9c')]}})[_0xcb2e('0x22')](function(_0x51b108){if(_0x51b108){_0x56dc5e[_0xcb2e('0x86')][_0xcb2e('0x9e')]({'id':0x0,'priority':0x0,'app':_0xcb2e('0x9f'),'appdata':_0x51b108[_0xcb2e('0x3d')]+','+(_0x56dc5e[_0xcb2e('0x89')][_0xcb2e('0xa0')]||0xa),'interval':'*,*,*,*'});_0x56dc5e[_0xcb2e('0xa1')]=![];}return respondWithRpcPromise(_0xcb2e('0xa2'),'startRouting',_0x56dc5e);});}return respondWithRpcPromise('Start','startRouting',_0x56dc5e);})[_0xcb2e('0x22')](function(_0x3933da){respondWithRpcPromise(_0xcb2e('0xa3'),_0xcb2e('0xa3'),{'event':'notify','message':_0x3933da},client9002);return _0x3933da;})[_0xcb2e('0x22')](respondWithResult(_0x24fec7,null))[_0xcb2e('0x2d')](handleError(_0x24fec7,null));};exports[_0xcb2e('0xa4')]=function(_0x1af7e1,_0x482893,_0x1a1908){return db[_0xcb2e('0x41')]['findOne']({'where':{'id':_0x1af7e1[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x482893,null))['then'](function(_0x16c5cb){if(_0x16c5cb){return db[_0xcb2e('0xa5')]['transaction'](function(_0x41b02e){return db[_0xcb2e('0xa6')][_0xcb2e('0x39')]({'where':{'OpenchannelAccountId':_0x1af7e1[_0xcb2e('0x63')]['id']},'transaction':_0x41b02e})[_0xcb2e('0x22')](function(_0x39400d){var _0x253ebc=_['map'](_0x1af7e1[_0xcb2e('0x62')],function(_0x5efebd){_0x5efebd[_0xcb2e('0x69')]=_0x1af7e1['params']['id'];return _0x5efebd;});return db['OpenchannelApplication'][_0xcb2e('0xa7')](_0x253ebc,{'transaction':_0x41b02e});});})[_0xcb2e('0x22')](function(){return db[_0xcb2e('0xa6')][_0xcb2e('0xa8')]({'where':{'OpenchannelAccountId':_0x1af7e1[_0xcb2e('0x63')]['id']},'order':_0xcb2e('0x87')});});}})[_0xcb2e('0x22')](respondWithResult(_0x482893,null))['catch'](handleError(_0x482893,null));};exports['getApplications']=function(_0x548ff0,_0x981d04,_0x1f5a24){var _0x27fc43={};var _0xcf34f1={};var _0x589534;var _0x512b6f;return db[_0xcb2e('0x41')][_0xcb2e('0x6e')]({'where':{'id':_0x548ff0[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x981d04,null))[_0xcb2e('0x22')](function(_0x5a29c8){if(_0x5a29c8){_0x589534=_0x5a29c8;_0xcf34f1[_0xcb2e('0x43')]=_[_0xcb2e('0x45')](db[_0xcb2e('0xa6')][_0xcb2e('0x42')]);_0xcf34f1[_0xcb2e('0x44')]=_[_0xcb2e('0x45')](_0x548ff0[_0xcb2e('0x44')]);_0xcf34f1['filters']=_['intersection'](_0xcf34f1['model'],_0xcf34f1[_0xcb2e('0x44')]);_0x27fc43[_0xcb2e('0x5a')]=_['intersection'](_0xcf34f1[_0xcb2e('0x43')],qs[_0xcb2e('0x48')](_0x548ff0['query'][_0xcb2e('0x48')]));_0x27fc43[_0xcb2e('0x5a')]=_0x27fc43[_0xcb2e('0x5a')][_0xcb2e('0x49')]?_0x27fc43[_0xcb2e('0x5a')]:_0xcf34f1[_0xcb2e('0x43')];_0x27fc43[_0xcb2e('0x4c')]=qs[_0xcb2e('0x4d')](_0x548ff0[_0xcb2e('0x44')][_0xcb2e('0x4d')]);_0x27fc43[_0xcb2e('0x4e')]=qs[_0xcb2e('0x46')](_[_0xcb2e('0x4f')](_0x548ff0[_0xcb2e('0x44')],_0xcf34f1[_0xcb2e('0x46')]));if(_0x548ff0[_0xcb2e('0x44')]['filter']){_0x27fc43['where']=_[_0xcb2e('0x51')](_0x27fc43['where'],{'$or':_[_0xcb2e('0x52')](_0x27fc43[_0xcb2e('0x5a')],function(_0x4b79dd){var _0x25c319={};_0x25c319[_0x4b79dd]={'$like':'%'+_0x548ff0[_0xcb2e('0x44')]['filter']+'%'};return _0x25c319;})});}_0x27fc43=_['merge']({},_0x27fc43,_0x548ff0['options']);return _0x589534['getApplications'](_0x27fc43);}})[_0xcb2e('0x22')](function(_0x570185){if(_0x570185){_0x512b6f=_0x570185['length'];if(!_0x548ff0[_0xcb2e('0x44')][_0xcb2e('0x4a')](_0xcb2e('0x4b'))){_0x27fc43[_0xcb2e('0x32')]=qs[_0xcb2e('0x32')](_0x548ff0[_0xcb2e('0x44')][_0xcb2e('0x32')]);_0x27fc43['offset']=qs[_0xcb2e('0x31')](_0x548ff0[_0xcb2e('0x44')]['offset']);}return _0x589534[_0xcb2e('0xa9')](_0x27fc43);}})[_0xcb2e('0x22')](function(_0x32f563){if(_0x32f563){return _0x32f563?{'count':_0x512b6f,'rows':_0x32f563}:null;}})[_0xcb2e('0x22')](respondWithResult(_0x981d04,null))[_0xcb2e('0x2d')](handleError(_0x981d04,null));};exports[_0xcb2e('0xaa')]=function(_0x56692b,_0x4e1942,_0x48ab4d){var _0x3476f6={'raw':![],'where':{}};var _0x5617cf={};var _0x27b514={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcb2e('0x6e')]({'where':{'id':_0x56692b[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x4e1942,null))[_0xcb2e('0x22')](function(_0x17d392){if(_0x17d392){_0x5617cf[_0xcb2e('0x43')]=_['keys'](db[_0xcb2e('0x8e')][_0xcb2e('0x42')]);_0x5617cf['query']=_[_0xcb2e('0x45')](_0x56692b['query']);_0x5617cf[_0xcb2e('0x46')]=_[_0xcb2e('0x47')](_0x5617cf[_0xcb2e('0x43')],_0x5617cf['query']);_0x3476f6[_0xcb2e('0x5a')]=_[_0xcb2e('0x47')](_0x5617cf[_0xcb2e('0x43')],qs[_0xcb2e('0x48')](_0x56692b[_0xcb2e('0x44')]['fields']));_0x3476f6[_0xcb2e('0x5a')]=_0x3476f6['attributes'][_0xcb2e('0x49')]?_0x3476f6[_0xcb2e('0x5a')]:_0x5617cf['model'];if(!_0x56692b['query'][_0xcb2e('0x4a')]('nolimit')){_0x3476f6[_0xcb2e('0x32')]=qs[_0xcb2e('0x32')](_0x56692b[_0xcb2e('0x44')][_0xcb2e('0x32')]);_0x3476f6[_0xcb2e('0x31')]=qs[_0xcb2e('0x31')](_0x56692b['query'][_0xcb2e('0x31')]);}_0x3476f6[_0xcb2e('0x4c')]=qs[_0xcb2e('0x4d')](_0x56692b[_0xcb2e('0x44')]['sort']);_0x3476f6[_0xcb2e('0x4e')]=qs['filters'](_[_0xcb2e('0x4f')](_0x56692b['query'],_0x5617cf[_0xcb2e('0x46')]));_0x3476f6[_0xcb2e('0x4e')][_0xcb2e('0x69')]=_0x17d392['id'];if(_0x56692b['query'][_0xcb2e('0x50')]){_0x3476f6[_0xcb2e('0x4e')]=_['merge'](_0x3476f6[_0xcb2e('0x4e')],{'$or':_[_0xcb2e('0x52')](_0x3476f6[_0xcb2e('0x5a')],function(_0x37edd1){var _0x3cf275={};_0x3cf275[_0x37edd1]={'$like':'%'+_0x56692b['query'][_0xcb2e('0x50')]+'%'};return _0x3cf275;})});}_0x3476f6=_[_0xcb2e('0x51')]({},_0x3476f6,_0x56692b[_0xcb2e('0x54')]);return db[_0xcb2e('0x8e')][_0xcb2e('0x55')]({'where':_0x3476f6[_0xcb2e('0x4e')]})[_0xcb2e('0x22')](function(_0x1c9521){_0x27b514[_0xcb2e('0x55')]=_0x1c9521;if(_0x56692b['query'][_0xcb2e('0x56')]){_0x3476f6[_0xcb2e('0xab')]=[{'model':db[_0xcb2e('0x73')],'as':_0xcb2e('0xac'),'required':![]},{'model':db[_0xcb2e('0x9d')],'as':_0xcb2e('0xad'),'attributes':[_0xcb2e('0x3d'),_0xcb2e('0xae'),_0xcb2e('0xaf')],'required':![]},{'model':db[_0xcb2e('0xb0')],'as':'Tags','attributes':['id','name',_0xcb2e('0xb1')],'where':_0x56692b[_0xcb2e('0x44')][_0xcb2e('0xb2')]?{'id':_0x56692b[_0xcb2e('0x44')][_0xcb2e('0xb2')]}:undefined,'required':_0x56692b['query'][_0xcb2e('0xb2')]?!![]:![]}];}return db[_0xcb2e('0x8e')][_0xcb2e('0x6a')](_0x3476f6);})[_0xcb2e('0x22')](function(_0x5d7f7a){_0x27b514[_0xcb2e('0x57')]=_0x5d7f7a;return _0x27b514;});}})[_0xcb2e('0x22')](respondWithFilteredResult(_0x4e1942,_0x3476f6))[_0xcb2e('0x2d')](handleError(_0x4e1942,null));};exports[_0xcb2e('0xb3')]=function(_0x9229a,_0x44161b,_0x24eef2){return db[_0xcb2e('0x41')][_0xcb2e('0x5b')]({'where':{'id':_0x9229a[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x44161b,null))[_0xcb2e('0x22')](function(_0x38826c){if(_0x38826c){return _0x38826c[_0xcb2e('0xb3')](_0x9229a[_0xcb2e('0x62')]['ids'],_[_0xcb2e('0xb4')](_0x9229a[_0xcb2e('0x62')],[_0xcb2e('0x70'),'id'])||{})['spread'](function(_0x6a793b){for(var _0x45f68c=0x0;_0x45f68c<_0x9229a[_0xcb2e('0x62')][_0xcb2e('0x70')][_0xcb2e('0x49')];_0x45f68c+=0x1){socket[_0xcb2e('0xb5')](_0xcb2e('0xb6'),{'UserId':_0x9229a[_0xcb2e('0x62')][_0xcb2e('0x70')][_0x45f68c],'OpenchannelAccountId':_0x9229a[_0xcb2e('0x63')]['id']});}return _0x6a793b;});}})[_0xcb2e('0x22')](respondWithResult(_0x44161b,null))[_0xcb2e('0x2d')](handleError(_0x44161b,null));};exports[_0xcb2e('0xb7')]=function(_0x1ccbd6,_0x1e953c,_0x3f8538){return db['OpenchannelAccount'][_0xcb2e('0x5b')]({'where':{'id':_0x1ccbd6[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x1e953c,null))['then'](function(_0x213d06){if(_0x213d06){return _0x213d06[_0xcb2e('0xb7')](_0x1ccbd6[_0xcb2e('0x44')][_0xcb2e('0x70')])[_0xcb2e('0x22')](function(){if(_[_0xcb2e('0xb8')](_0x1ccbd6[_0xcb2e('0x44')][_0xcb2e('0x70')])){for(var _0x3a2660=0x0;_0x3a2660<_0x1ccbd6[_0xcb2e('0x44')][_0xcb2e('0x70')]['length'];_0x3a2660+=0x1){socket['emit'](_0xcb2e('0xb9'),{'UserId':Number(_0x1ccbd6[_0xcb2e('0x44')][_0xcb2e('0x70')][_0x3a2660]),'OpenchannelAccountId':Number(_0x1ccbd6[_0xcb2e('0x63')]['id'])});}}else{socket[_0xcb2e('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1ccbd6[_0xcb2e('0x44')][_0xcb2e('0x70')]),'OpenchannelAccountId':Number(_0x1ccbd6[_0xcb2e('0x63')]['id'])});}});}})[_0xcb2e('0x22')](respondWithStatusCode(_0x1e953c,null))[_0xcb2e('0x2d')](handleError(_0x1e953c,null));};exports[_0xcb2e('0xba')]=function(_0x278539,_0x28f768,_0xa05846){var _0x511e61={};var _0x5f17f8={};var _0x2229d4;var _0x26e113;return db[_0xcb2e('0x41')]['findOne']({'where':{'id':_0x278539[_0xcb2e('0x63')]['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x28f768,null))['then'](function(_0x5e2a46){if(_0x5e2a46){_0x2229d4=_0x5e2a46;_0x5f17f8['model']=_['keys'](db[_0xcb2e('0x9d')][_0xcb2e('0x42')]);_0x5f17f8[_0xcb2e('0x44')]=_['keys'](_0x278539[_0xcb2e('0x44')]);_0x5f17f8[_0xcb2e('0x46')]=_['intersection'](_0x5f17f8[_0xcb2e('0x43')],_0x5f17f8[_0xcb2e('0x44')]);_0x511e61[_0xcb2e('0x5a')]=_[_0xcb2e('0x47')](_0x5f17f8[_0xcb2e('0x43')],qs[_0xcb2e('0x48')](_0x278539[_0xcb2e('0x44')][_0xcb2e('0x48')]));_0x511e61[_0xcb2e('0x5a')]=_0x511e61['attributes'][_0xcb2e('0x49')]?_0x511e61[_0xcb2e('0x5a')]:_0x5f17f8[_0xcb2e('0x43')];_0x511e61['order']=qs[_0xcb2e('0x4d')](_0x278539[_0xcb2e('0x44')]['sort']);_0x511e61[_0xcb2e('0x4e')]=qs['filters'](_[_0xcb2e('0x4f')](_0x278539[_0xcb2e('0x44')],_0x5f17f8[_0xcb2e('0x46')]));if(_0x278539['query'][_0xcb2e('0x50')]){_0x511e61[_0xcb2e('0x4e')]=_[_0xcb2e('0x51')](_0x511e61[_0xcb2e('0x4e')],{'$or':_[_0xcb2e('0x52')](_0x511e61['attributes'],function(_0x4da470){var _0x2a65cd={};_0x2a65cd[_0x4da470]={'$like':'%'+_0x278539[_0xcb2e('0x44')]['filter']+'%'};return _0x2a65cd;})});}_0x511e61=_[_0xcb2e('0x51')]({},_0x511e61,_0x278539[_0xcb2e('0x54')]);return _0x2229d4[_0xcb2e('0xba')](_0x511e61);}})[_0xcb2e('0x22')](function(_0x45bfcb){if(_0x45bfcb){_0x26e113=_0x45bfcb[_0xcb2e('0x49')];if(!_0x278539[_0xcb2e('0x44')]['hasOwnProperty'](_0xcb2e('0x4b'))){_0x511e61[_0xcb2e('0x32')]=qs['limit'](_0x278539[_0xcb2e('0x44')]['limit']);_0x511e61[_0xcb2e('0x31')]=qs[_0xcb2e('0x31')](_0x278539[_0xcb2e('0x44')][_0xcb2e('0x31')]);}return _0x2229d4[_0xcb2e('0xba')](_0x511e61);}})[_0xcb2e('0x22')](function(_0x214f5d){if(_0x214f5d){return _0x214f5d?{'count':_0x26e113,'rows':_0x214f5d}:null;}})['then'](respondWithResult(_0x28f768,null))['catch'](handleError(_0x28f768,null));};exports['send']=function(_0x481e32,_0x56feb5,_0x552a2d){var _0x2b787c,_0x259e50,_0x3f47de;if(_['isNil'](_0x481e32['body']['body'])||_0x481e32['body'][_0xcb2e('0x62')]===''){throw new db[(_0xcb2e('0x7c'))]['ValidationError'](_0xcb2e('0xbb'));}if(_[_0xcb2e('0x7a')](_0x481e32[_0xcb2e('0x62')]['to'])){}_0x2b787c=_0x481e32[_0xcb2e('0x62')]['to'];return db['OpenchannelAccount'][_0xcb2e('0x6e')]({'where':{'id':_0x481e32['params']['id']}})[_0xcb2e('0x22')](handleEntityNotFound(_0x56feb5,null))['then'](function(_0x2cd713){if(_0x2cd713){return db[_0xcb2e('0x41')][_0xcb2e('0x5b')]({'where':{'id':_0x2cd713['id']},'include':[{'model':db['CmList'],'as':_0xcb2e('0x84'),'include':[{'model':db[_0xcb2e('0x73')],'as':'Contacts','where':{[_0x2cd713['mapKey']]:_0x2b787c},'limit':0x1,'order':[[_0xcb2e('0x76'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x56feb5,null))[_0xcb2e('0x22')](function(_0x3a639f){if(_0x3a639f&&_0x3a639f['List']){_0x259e50=_0x3a639f[_0xcb2e('0x3a')]({'plain':!![]});if(_0x259e50['List']&&_0x259e50[_0xcb2e('0x84')]['Contacts'][_0xcb2e('0x49')]){return _0x259e50[_0xcb2e('0x84')]['Contacts'][0x0];}return db[_0xcb2e('0x73')][_0xcb2e('0x5c')](_[_0xcb2e('0x18')](_0x481e32[_0xcb2e('0x62')],{'firstName':_0x2b787c,[_0x3a639f['mapKey']]:_0x2b787c,'phone':_0x2b787c,'ListId':_0x259e50['ListId']}));}})['then'](handleEntityNotFound(_0x56feb5,null))['then'](function(_0x3ff192){if(_0x3ff192){_0x3f47de=_0x3ff192;return db[_0xcb2e('0x8e')][_0xcb2e('0x5b')]({'where':{'ContactId':_0x3f47de['id'],'closed':![],'OpenchannelAccountId':_0x259e50['id']}})[_0xcb2e('0x22')](function(_0x4f8a94){if(_0x4f8a94){return[_0x4f8a94,![]];}return db[_0xcb2e('0x8e')][_0xcb2e('0x5c')]({'UserId':_0x481e32['user']['id'],'ContactId':_0x3f47de['id'],'OpenchannelAccountId':_0x259e50['id'],'lastMsgDirection':_0xcb2e('0xbc'),'Messages':[_[_0xcb2e('0x51')](_0x481e32['body'],{'read':![],'body':_0x481e32[_0xcb2e('0x62')][_0xcb2e('0x62')],'OpenchannelAccountId':_0x259e50['id'],'UserId':_0x481e32['user']['id'],'ContactId':_0x3f47de['id']})]},{'include':[{'model':db[_0xcb2e('0x9a')],'as':'Messages'}]})[_0xcb2e('0x22')](function(_0xbdb0cf){return[_0xbdb0cf,!![]];});});}})[_0xcb2e('0x91')](function(_0x21d7b0,_0x1a1528){if(_0x1a1528){return _0x21d7b0;}return db[_0xcb2e('0x9a')][_0xcb2e('0x5c')](_[_0xcb2e('0x51')](_0x481e32[_0xcb2e('0x62')],{'read':![],'body':_0x481e32[_0xcb2e('0x62')][_0xcb2e('0x62')],'OpenchannelAccountId':_0x259e50['id'],'OpenchannelInteractionId':_0x21d7b0['id'],'UserId':_0x481e32[_0xcb2e('0x5d')]['id'],'ContactId':_0x3f47de['id']}))['then'](function(_0x53da5b){_0x21d7b0[_0xcb2e('0xbd')][_0xcb2e('0xbe')]=[];_0x21d7b0['dataValues']['Messages'][_0xcb2e('0x97')](_0x53da5b['dataValues']);return _0x21d7b0;});});}})['then'](respondWithResult(_0x56feb5,null))['catch'](handleError(_0x56feb5,null));}; \ No newline at end of file +var _0x4c59=['name','index','Pause','mandatoryDispositionPause','rawAttributes','keys','query','filters','intersection','model','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','Applications','List','list','applications','orderBy','priority','account','Contacts','ListId','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','transaction','OpenchannelApplication','bulkCreate','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','OpenchannelMessage','dataValues','Messages','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','stack'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x4c59,0x80));var _0x94c5=function(_0x30f87a,_0x2cce5a){_0x30f87a=_0x30f87a-0x0;var _0x3a8efc=_0x4c59[_0x30f87a];return _0x3a8efc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x94c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94c5('0x1'));var rp=require(_0x94c5('0x2'));var moment=require(_0x94c5('0x3'));var BPromise=require(_0x94c5('0x4'));var Mustache=require(_0x94c5('0x5'));var util=require(_0x94c5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x94c5('0x7'));var ejs=require(_0x94c5('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x94c5('0x9'));var crypto=require(_0x94c5('0xa'));var jsforce=require(_0x94c5('0xb'));var deskjs=require(_0x94c5('0xc'));var toCsv=require(_0x94c5('0x7'));var querystring=require('querystring');var Papa=require(_0x94c5('0xd'));var Redis=require(_0x94c5('0xe'));var authService=require(_0x94c5('0xf'));var qs=require(_0x94c5('0x10'));var hardwareService=require(_0x94c5('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x94c5('0x12'));var config=require(_0x94c5('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x94c5('0x14')](config[_0x94c5('0x15')],{'host':_0x94c5('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94c5('0x15')]));require(_0x94c5('0x17'))[_0x94c5('0x18')](socket);var jayson=require(_0x94c5('0x19'));var client=jayson['client'][_0x94c5('0x1a')]({'port':0x232c});var client9002=jayson[_0x94c5('0x1b')][_0x94c5('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2a2442,_0x115172,_0x20a22e){if(_0x20a22e){var _0x3431a6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3431a6['test'](_0x115172)){return _0x2a2442;}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 _0x2a2442;}}function respondWithRpcPromise(_0x5d1a94,_0x4ad28d,_0x385022,_0x4864c4){return new BPromise(function(_0x515fc1,_0x50f1ac){var _0x43e994=_0x4864c4||client;return _0x43e994[_0x94c5('0x1c')](_0x5d1a94,_0x385022)[_0x94c5('0x1d')](function(_0x48f268){logger[_0x94c5('0x1e')](_0x94c5('0x1f'),_0x4ad28d,_0x94c5('0x20'));logger[_0x94c5('0x21')](_0x94c5('0x22'),_0x4ad28d,_0x94c5('0x20'),JSON[_0x94c5('0x23')](_0x48f268));if(_0x48f268['error']){if(_0x48f268['error']['code']===0x1f4){logger[_0x94c5('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x4ad28d,_0x48f268[_0x94c5('0x24')]['message']);return _0x50f1ac(_0x48f268[_0x94c5('0x24')][_0x94c5('0x25')]);}logger[_0x94c5('0x24')](_0x94c5('0x1f'),_0x4ad28d,_0x48f268[_0x94c5('0x24')][_0x94c5('0x25')]);return _0x515fc1(_0x48f268[_0x94c5('0x24')][_0x94c5('0x25')]);}else{logger[_0x94c5('0x1e')](_0x94c5('0x1f'),_0x4ad28d,_0x94c5('0x20'));_0x515fc1(_0x48f268[_0x94c5('0x26')][_0x94c5('0x25')]);}})[_0x94c5('0x27')](function(_0x4c792f){logger[_0x94c5('0x24')](_0x94c5('0x1f'),_0x4ad28d,_0x4c792f);_0x50f1ac(_0x4c792f);});});}function respondWithStatusCode(_0x2ebdec,_0x1ccb33){_0x1ccb33=_0x1ccb33||0xcc;return function(_0x4cf85d){if(_0x4cf85d){return _0x2ebdec[_0x94c5('0x28')](_0x1ccb33);}return _0x2ebdec[_0x94c5('0x29')](_0x1ccb33)[_0x94c5('0x2a')]();};}function respondWithResult(_0x25e9e3,_0x509230){_0x509230=_0x509230||0xc8;return function(_0x546501){if(_0x546501){return _0x25e9e3['status'](_0x509230)['json'](_0x546501);}};}function respondWithFilteredResult(_0x23c2e2,_0x10888c){return function(_0x139936){if(_0x139936){var _0x564a7d=_0x139936[_0x94c5('0x2b')],_0x3ea42b=_0x10888c[_0x94c5('0x2c')],_0x28e5d0=_0x10888c[_0x94c5('0x2c')]+_0x10888c['limit'],_0xb7f58c;if(_0x28e5d0>=_0x564a7d){_0x28e5d0=_0x564a7d;_0xb7f58c=0xc8;}else{_0xb7f58c=0xce;}_0x23c2e2['status'](_0xb7f58c);return _0x23c2e2[_0x94c5('0x2d')](_0x94c5('0x2e'),_0x3ea42b+'-'+_0x28e5d0+'/'+_0x564a7d)[_0x94c5('0x2f')](_0x139936);}return null;};}function patchUpdates(_0x38ae36){return function(_0x3d998f){try{jsonpatch['apply'](_0x3d998f,_0x38ae36,!![]);}catch(_0x5028b0){return BPromise[_0x94c5('0x30')](_0x5028b0);}return _0x3d998f[_0x94c5('0x31')]();};}function saveUpdates(_0x25a061,_0xa32f86){return function(_0x3e774c){if(_0x3e774c){return _0x3e774c['update'](_0x25a061)['then'](function(_0x36f687){return _0x36f687;});}return null;};}function removeEntity(_0x10958f,_0x3eb10c){return function(_0x2ed94f){if(_0x2ed94f){return _0x2ed94f[_0x94c5('0x32')]()['then'](function(){var _0x18e977=_0x2ed94f[_0x94c5('0x33')]({'plain':!![]});var _0x173a08=_0x94c5('0x34');return db[_0x94c5('0x35')][_0x94c5('0x32')]({'where':{'type':_0x173a08,'resourceId':_0x18e977['id']}})['then'](function(){return _0x2ed94f;});})[_0x94c5('0x1d')](function(){_0x10958f[_0x94c5('0x29')](0xcc)[_0x94c5('0x2a')]();});}};}function handleEntityNotFound(_0x165266,_0x36f448){return function(_0x3189e1){if(!_0x3189e1){_0x165266[_0x94c5('0x28')](0x194);}return _0x3189e1;};}function handleError(_0x37d37a,_0x329325){_0x329325=_0x329325||0x1f4;return function(_0x583d86){logger['error'](_0x583d86[_0x94c5('0x36')]);if(_0x583d86[_0x94c5('0x37')]){delete _0x583d86[_0x94c5('0x37')];}_0x37d37a['status'](_0x329325)['send'](_0x583d86);};}exports[_0x94c5('0x38')]=function(_0x4abafb,_0x553be6){var _0x519ee6={'include':[{'model':db[_0x94c5('0x39')],'as':_0x94c5('0x3a')}]},_0x25559d={},_0x16f54a={'count':0x0,'rows':[]};var _0x55ce9a=db['OpenchannelAccount'][_0x94c5('0x3b')];_0x25559d['model']=_[_0x94c5('0x3c')](_0x55ce9a);_0x25559d[_0x94c5('0x3d')]=_['keys'](_0x4abafb[_0x94c5('0x3d')]);_0x25559d[_0x94c5('0x3e')]=_[_0x94c5('0x3f')](_0x25559d[_0x94c5('0x40')],_0x25559d[_0x94c5('0x3d')]);_0x519ee6[_0x94c5('0x41')]=_[_0x94c5('0x3f')](_0x25559d[_0x94c5('0x40')],qs['fields'](_0x4abafb['query']['fields']));_0x519ee6[_0x94c5('0x41')]=_0x519ee6[_0x94c5('0x41')][_0x94c5('0x42')]?_0x519ee6['attributes']:_0x25559d[_0x94c5('0x40')];if(!_0x4abafb[_0x94c5('0x3d')]['hasOwnProperty'](_0x94c5('0x43'))){_0x519ee6['limit']=qs[_0x94c5('0x44')](_0x4abafb[_0x94c5('0x3d')][_0x94c5('0x44')]);_0x519ee6[_0x94c5('0x2c')]=qs[_0x94c5('0x2c')](_0x4abafb[_0x94c5('0x3d')][_0x94c5('0x2c')]);}_0x519ee6[_0x94c5('0x45')]=qs[_0x94c5('0x46')](_0x4abafb['query'][_0x94c5('0x46')]);_0x519ee6['where']=qs['filters'](_[_0x94c5('0x47')](_0x4abafb[_0x94c5('0x3d')],_0x25559d[_0x94c5('0x3e')]));if(_0x4abafb[_0x94c5('0x3d')][_0x94c5('0x48')]){_0x519ee6[_0x94c5('0x49')]=_[_0x94c5('0x4a')](_0x519ee6[_0x94c5('0x49')],{'$or':_[_0x94c5('0x4b')](_0x55ce9a,function(_0x3c95a7){if(_0x3c95a7[_0x94c5('0x4c')][_0x94c5('0x4d')]!==_0x94c5('0x4e')){var _0x703c1d={};_0x703c1d[_0x3c95a7[_0x94c5('0x4f')]]={'$like':'%'+_0x4abafb[_0x94c5('0x3d')][_0x94c5('0x48')]+'%'};return _0x703c1d;}})});}_0x519ee6=_[_0x94c5('0x4a')]({},_0x519ee6,_0x4abafb[_0x94c5('0x50')]);var _0x295cd8={'where':_0x519ee6[_0x94c5('0x49')]};return db[_0x94c5('0x51')][_0x94c5('0x2b')](_0x295cd8)['then'](function(_0x313711){_0x16f54a[_0x94c5('0x2b')]=_0x313711;if(_0x4abafb[_0x94c5('0x3d')][_0x94c5('0x52')]){_0x519ee6[_0x94c5('0x53')]=[{'all':!![]}];}return db[_0x94c5('0x51')][_0x94c5('0x54')](_0x519ee6);})[_0x94c5('0x1d')](function(_0x52f4e1){_0x16f54a[_0x94c5('0x55')]=_0x52f4e1;return _0x16f54a;})[_0x94c5('0x1d')](respondWithFilteredResult(_0x553be6,_0x519ee6))[_0x94c5('0x27')](handleError(_0x553be6,null));};exports[_0x94c5('0x56')]=function(_0x5624be,_0x22ca8e){var _0x124b0c={'raw':![],'where':{'id':_0x5624be[_0x94c5('0x57')]['id']},'include':[{'model':db[_0x94c5('0x39')],'as':'mandatoryDispositionPause'}]},_0x358957={};_0x358957[_0x94c5('0x40')]=_[_0x94c5('0x3c')](db[_0x94c5('0x51')][_0x94c5('0x3b')]);_0x358957[_0x94c5('0x3d')]=_[_0x94c5('0x3c')](_0x5624be[_0x94c5('0x3d')]);_0x358957[_0x94c5('0x3e')]=_['intersection'](_0x358957[_0x94c5('0x40')],_0x358957[_0x94c5('0x3d')]);_0x124b0c[_0x94c5('0x41')]=_[_0x94c5('0x3f')](_0x358957[_0x94c5('0x40')],qs[_0x94c5('0x58')](_0x5624be['query']['fields']));_0x124b0c[_0x94c5('0x41')]=_0x124b0c[_0x94c5('0x41')]['length']?_0x124b0c[_0x94c5('0x41')]:_0x358957[_0x94c5('0x40')];if(_0x5624be[_0x94c5('0x3d')][_0x94c5('0x52')]){_0x124b0c[_0x94c5('0x53')]=[{'all':!![]}];}_0x124b0c=_['merge']({},_0x124b0c,_0x5624be[_0x94c5('0x50')]);return db[_0x94c5('0x51')][_0x94c5('0x59')](_0x124b0c)[_0x94c5('0x1d')](handleEntityNotFound(_0x22ca8e,null))[_0x94c5('0x1d')](respondWithResult(_0x22ca8e,null))[_0x94c5('0x27')](handleError(_0x22ca8e,null));};exports['create']=function(_0x2847ed,_0x594baf){return db[_0x94c5('0x51')][_0x94c5('0x5a')](_0x2847ed[_0x94c5('0x5b')],{})[_0x94c5('0x1d')](function(_0x4d0e18){var _0x3e5613=_0x2847ed[_0x94c5('0x5c')][_0x94c5('0x33')]({'plain':!![]});if(!_0x3e5613)throw new Error(_0x94c5('0x5d'));if(_0x3e5613[_0x94c5('0x5e')]===_0x94c5('0x5c')){var _0x3f9c21=_0x4d0e18[_0x94c5('0x33')]({'plain':!![]});var _0x231985=_0x94c5('0x34');return db[_0x94c5('0x5f')][_0x94c5('0x59')]({'where':{'name':_0x231985,'userProfileId':_0x3e5613[_0x94c5('0x60')]},'raw':!![]})['then'](function(_0x156f0a){if(_0x156f0a&&_0x156f0a['autoAssociation']===0x0){return db[_0x94c5('0x35')][_0x94c5('0x5a')]({'name':_0x3f9c21[_0x94c5('0x37')],'resourceId':_0x3f9c21['id'],'type':_0x156f0a[_0x94c5('0x37')],'sectionId':_0x156f0a['id']},{})[_0x94c5('0x1d')](function(){return _0x4d0e18;});}else{return _0x4d0e18;}})['catch'](function(_0x279863){logger[_0x94c5('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x279863);throw _0x279863;});}return _0x4d0e18;})[_0x94c5('0x1d')](respondWithResult(_0x594baf,0xc9))['catch'](handleError(_0x594baf,null));};exports[_0x94c5('0x61')]=function(_0x1a42f3,_0x132113){if(_0x1a42f3[_0x94c5('0x5b')]['id']){delete _0x1a42f3[_0x94c5('0x5b')]['id'];}return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0x1a42f3[_0x94c5('0x57')]['id']},'include':[{'model':db[_0x94c5('0x39')],'as':_0x94c5('0x3a')}]})[_0x94c5('0x1d')](handleEntityNotFound(_0x132113,null))['then'](saveUpdates(_0x1a42f3[_0x94c5('0x5b')],null))[_0x94c5('0x1d')](respondWithResult(_0x132113,null))['catch'](handleError(_0x132113,null));};exports[_0x94c5('0x32')]=function(_0x2cd47b,_0x5e6060){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0x2cd47b[_0x94c5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e6060,null))['then'](removeEntity(_0x5e6060,null))['catch'](handleError(_0x5e6060,null));};exports[_0x94c5('0x62')]=function(_0x9e95a,_0x5e9c4b){return db[_0x94c5('0x51')][_0x94c5('0x62')]()[_0x94c5('0x1d')](respondWithResult(_0x5e9c4b,null))[_0x94c5('0x27')](handleError(_0x5e9c4b,null));};exports[_0x94c5('0x63')]=function(_0x1080d7,_0x1c749f,_0x377930){if(_0x1080d7[_0x94c5('0x5b')]['id']){delete _0x1080d7['body']['id'];}return db[_0x94c5('0x51')]['find']({'where':{'id':_0x1080d7[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x1c749f,null))[_0x94c5('0x1d')](function(_0x5b0ebc){if(_0x5b0ebc){_0x1080d7[_0x94c5('0x5b')][_0x94c5('0x64')]=_0x5b0ebc['id'];return db['Disposition']['create'](_0x1080d7['body']);}})[_0x94c5('0x1d')](respondWithResult(_0x1c749f,null))[_0x94c5('0x27')](handleError(_0x1c749f,null));};exports[_0x94c5('0x65')]=function(_0xa3bc4f,_0x33f839,_0x67583){var _0x3f7fd8={'raw':![],'where':{}};var _0x191c98={};var _0x584950={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x94c5('0x66')]({'where':{'id':_0xa3bc4f[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x33f839,null))[_0x94c5('0x1d')](function(_0x390a72){if(_0x390a72){_0x191c98[_0x94c5('0x40')]=_[_0x94c5('0x3c')](db[_0x94c5('0x67')][_0x94c5('0x3b')]);_0x191c98['query']=_[_0x94c5('0x3c')](_0xa3bc4f[_0x94c5('0x3d')]);_0x191c98['filters']=_[_0x94c5('0x3f')](_0x191c98[_0x94c5('0x40')],_0x191c98[_0x94c5('0x3d')]);_0x3f7fd8[_0x94c5('0x41')]=_[_0x94c5('0x3f')](_0x191c98['model'],qs[_0x94c5('0x58')](_0xa3bc4f[_0x94c5('0x3d')][_0x94c5('0x58')]));_0x3f7fd8[_0x94c5('0x41')]=_0x3f7fd8['attributes'][_0x94c5('0x42')]?_0x3f7fd8[_0x94c5('0x41')]:_0x191c98['model'];if(!_0xa3bc4f['query'][_0x94c5('0x68')]('nolimit')){_0x3f7fd8['limit']=qs['limit'](_0xa3bc4f[_0x94c5('0x3d')][_0x94c5('0x44')]);_0x3f7fd8[_0x94c5('0x2c')]=qs[_0x94c5('0x2c')](_0xa3bc4f[_0x94c5('0x3d')][_0x94c5('0x2c')]);}_0x3f7fd8[_0x94c5('0x45')]=qs[_0x94c5('0x46')](_0xa3bc4f['query'][_0x94c5('0x46')]);_0x3f7fd8['where']=qs[_0x94c5('0x3e')](_[_0x94c5('0x47')](_0xa3bc4f[_0x94c5('0x3d')],_0x191c98['filters']));_0x3f7fd8[_0x94c5('0x49')]['OpenchannelAccountId']=_0x390a72['id'];if(_0xa3bc4f[_0x94c5('0x3d')][_0x94c5('0x48')]){_0x3f7fd8[_0x94c5('0x49')]=_['merge'](_0x3f7fd8[_0x94c5('0x49')],{'$or':_[_0x94c5('0x4b')](_0x3f7fd8['attributes'],function(_0x1f18e4){var _0x13b54d={};_0x13b54d[_0x1f18e4]={'$like':'%'+_0xa3bc4f[_0x94c5('0x3d')][_0x94c5('0x48')]+'%'};return _0x13b54d;})});}_0x3f7fd8=_['merge']({},_0x3f7fd8,_0xa3bc4f[_0x94c5('0x50')]);return db[_0x94c5('0x67')][_0x94c5('0x2b')]({'where':_0x3f7fd8[_0x94c5('0x49')]})[_0x94c5('0x1d')](function(_0x553844){_0x584950[_0x94c5('0x2b')]=_0x553844;if(_0xa3bc4f[_0x94c5('0x3d')][_0x94c5('0x52')]){_0x3f7fd8[_0x94c5('0x53')]=[{'all':!![]}];}return db[_0x94c5('0x67')]['findAll'](_0x3f7fd8);})[_0x94c5('0x1d')](function(_0x3b287c){_0x584950[_0x94c5('0x55')]=_0x3b287c;return _0x584950;});}})[_0x94c5('0x1d')](respondWithFilteredResult(_0x33f839,_0x3f7fd8))[_0x94c5('0x27')](handleError(_0x33f839,null));};exports[_0x94c5('0x69')]=function(_0xe3d534,_0x37a503,_0x6320e5){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0xe3d534[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x37a503,null))['then'](function(_0x4dd0cc){if(_0x4dd0cc){return _0x4dd0cc[_0x94c5('0x69')](_0xe3d534[_0x94c5('0x3d')][_0x94c5('0x6a')]);}})['then'](respondWithStatusCode(_0x37a503,null))[_0x94c5('0x27')](handleError(_0x37a503,null));};exports['addAnswer']=function(_0x551e6f,_0x239d49,_0x2c279b){if(_0x551e6f['body']['id']){delete _0x551e6f[_0x94c5('0x5b')]['id'];}return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0x551e6f[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x239d49,null))['then'](function(_0x28c4ee){if(_0x28c4ee){_0x551e6f[_0x94c5('0x5b')][_0x94c5('0x6b')]=_0x28c4ee['id'];return db[_0x94c5('0x6c')][_0x94c5('0x5a')](_0x551e6f[_0x94c5('0x5b')]);}})[_0x94c5('0x1d')](respondWithResult(_0x239d49,null))[_0x94c5('0x27')](handleError(_0x239d49,null));};exports[_0x94c5('0x6d')]=function(_0x19997a,_0x4ebead,_0x424bec){var _0x21e04b={'raw':![],'where':{}};var _0x58d09b={};var _0x24738a={'count':0x0,'rows':[]};return db[_0x94c5('0x51')][_0x94c5('0x66')]({'where':{'id':_0x19997a['params']['id']}})['then'](handleEntityNotFound(_0x4ebead,null))[_0x94c5('0x1d')](function(_0x209d39){if(_0x209d39){_0x58d09b[_0x94c5('0x40')]=_['keys'](db['CannedAnswer'][_0x94c5('0x3b')]);_0x58d09b[_0x94c5('0x3d')]=_[_0x94c5('0x3c')](_0x19997a[_0x94c5('0x3d')]);_0x58d09b[_0x94c5('0x3e')]=_[_0x94c5('0x3f')](_0x58d09b[_0x94c5('0x40')],_0x58d09b['query']);_0x21e04b[_0x94c5('0x41')]=_[_0x94c5('0x3f')](_0x58d09b[_0x94c5('0x40')],qs[_0x94c5('0x58')](_0x19997a['query']['fields']));_0x21e04b[_0x94c5('0x41')]=_0x21e04b[_0x94c5('0x41')][_0x94c5('0x42')]?_0x21e04b['attributes']:_0x58d09b[_0x94c5('0x40')];if(!_0x19997a[_0x94c5('0x3d')][_0x94c5('0x68')]('nolimit')){_0x21e04b[_0x94c5('0x44')]=qs[_0x94c5('0x44')](_0x19997a['query'][_0x94c5('0x44')]);_0x21e04b['offset']=qs[_0x94c5('0x2c')](_0x19997a[_0x94c5('0x3d')][_0x94c5('0x2c')]);}_0x21e04b[_0x94c5('0x45')]=qs[_0x94c5('0x46')](_0x19997a[_0x94c5('0x3d')]['sort']);_0x21e04b[_0x94c5('0x49')]=qs[_0x94c5('0x3e')](_[_0x94c5('0x47')](_0x19997a[_0x94c5('0x3d')],_0x58d09b[_0x94c5('0x3e')]));_0x21e04b[_0x94c5('0x49')]['OpenchannelAccountId']=_0x209d39['id'];if(_0x19997a[_0x94c5('0x3d')][_0x94c5('0x48')]){_0x21e04b[_0x94c5('0x49')]=_[_0x94c5('0x4a')](_0x21e04b['where'],{'$or':_[_0x94c5('0x4b')](_0x21e04b[_0x94c5('0x41')],function(_0x5ca071){var _0xb39487={};_0xb39487[_0x5ca071]={'$like':'%'+_0x19997a[_0x94c5('0x3d')]['filter']+'%'};return _0xb39487;})});}_0x21e04b=_['merge']({},_0x21e04b,_0x19997a[_0x94c5('0x50')]);return db['CannedAnswer'][_0x94c5('0x2b')]({'where':_0x21e04b['where']})[_0x94c5('0x1d')](function(_0x706915){_0x24738a[_0x94c5('0x2b')]=_0x706915;if(_0x19997a['query']['includeAll']){_0x21e04b[_0x94c5('0x53')]=[{'all':!![]}];}return db[_0x94c5('0x6c')][_0x94c5('0x54')](_0x21e04b);})[_0x94c5('0x1d')](function(_0x5ac9a2){_0x24738a[_0x94c5('0x55')]=_0x5ac9a2;return _0x24738a;});}})['then'](respondWithFilteredResult(_0x4ebead,_0x21e04b))[_0x94c5('0x27')](handleError(_0x4ebead,null));};exports[_0x94c5('0x6e')]=function(_0xae92a2,_0x5bb4e3,_0x12e673){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0xae92a2[_0x94c5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5bb4e3,null))['then'](function(_0x74d341){if(_0x74d341){return _0x74d341[_0x94c5('0x6e')](_0xae92a2[_0x94c5('0x3d')]['ids']);}})[_0x94c5('0x1d')](respondWithStatusCode(_0x5bb4e3,null))[_0x94c5('0x27')](handleError(_0x5bb4e3,null));};exports['notify']=function(_0x568c1e,_0x5a9526,_0x3ecc88){var _0xcca07={'body':_0x568c1e[_0x94c5('0x5b')],'channel':_0x94c5('0x6f')};var _0x17df48=[];var _0x12a6d2=[];var _0x2269a3={};var _0x1f73e0=![];return db[_0x94c5('0x70')]['describe']()[_0x94c5('0x1d')](function(_0x74961c){if(!_0x74961c){throw new db[(_0x94c5('0x71'))][(_0x94c5('0x72'))](_0x94c5('0x73'));}_0x17df48=_[_0x94c5('0x74')](_[_0x94c5('0x3c')](_0x74961c),[_0x94c5('0x75'),'updatedAt']);_0x12a6d2=_[_0x94c5('0x74')](_[_0x94c5('0x3c')](_0x74961c),[_0x94c5('0x75'),_0x94c5('0x76'),_0x94c5('0x77'),'ListId']);if(_0x568c1e[_0x94c5('0x5b')]['id']){delete _0x568c1e[_0x94c5('0x5b')]['id'];}if(_[_0x94c5('0x78')](_0x568c1e['body'][_0x94c5('0x79')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x94c5('0x78')](_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x5b')])||_0x568c1e[_0x94c5('0x5b')]['body']===''){throw new db[(_0x94c5('0x71'))]['ValidationError'](_0x94c5('0x7a'));}if(_['isNil'](_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x7b')])){throw new db['Sequelize'][(_0x94c5('0x72'))](_0x94c5('0x7c')+_0x12a6d2);}if(!_[_0x94c5('0x7d')](_0x12a6d2,_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x7b')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12a6d2);}_0x2269a3[_0x568c1e[_0x94c5('0x5b')]['mapKey']]=_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x79')];})[_0x94c5('0x1d')](function(){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0x568c1e[_0x94c5('0x57')]['id']},'include':[{'model':db[_0x94c5('0x7e')],'as':'List','include':[{'model':db[_0x94c5('0x70')],'as':'Contacts','where':_0x2269a3,'limit':0x1,'order':[[_0x94c5('0x76'),_0x94c5('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0x94c5('0x80')}]});})[_0x94c5('0x1d')](handleEntityNotFound(_0x5a9526,null))[_0x94c5('0x1d')](function(_0x6fb04d){if(_0x6fb04d&&_0x6fb04d[_0x94c5('0x81')]){_0xcca07['account']=_0x6fb04d;_0xcca07['applications']=_0x6fb04d[_0x94c5('0x80')];_0xcca07[_0x94c5('0x82')]=_0x6fb04d[_0x94c5('0x81')];_0xcca07[_0x94c5('0x83')]=_[_0x94c5('0x84')](_0xcca07[_0x94c5('0x83')],[_0x94c5('0x85')],['asc']);if(_0xcca07[_0x94c5('0x86')][_0x94c5('0x80')]){delete _0xcca07[_0x94c5('0x86')]['Applications'];}if(_0xcca07[_0x94c5('0x86')]['List']&&_0xcca07['account']['List'][_0x94c5('0x87')]['length']){return _0xcca07[_0x94c5('0x86')][_0x94c5('0x81')][_0x94c5('0x87')][0x0];}var _0xa0e9cf=_[_0x94c5('0x14')](_0x568c1e[_0x94c5('0x5b')],{'firstName':_0x568c1e[_0x94c5('0x5b')]['from'],'ListId':_0x6fb04d[_0x94c5('0x88')]});_0xa0e9cf[_0x568c1e['body'][_0x94c5('0x7b')]]=_0x568c1e[_0x94c5('0x5b')]['from'];return db[_0x94c5('0x70')][_0x94c5('0x5a')](_0xa0e9cf,{'fields':_0x17df48,'raw':!![]});}})[_0x94c5('0x1d')](handleEntityNotFound(_0x5a9526,null))[_0x94c5('0x1d')](function(_0x1f39e4){_0xcca07['contact']=_0x1f39e4;if(_0x1f39e4){var _0x2c0ebb={'ContactId':_0x1f39e4['id'],'OpenchannelAccountId':_0x568c1e[_0x94c5('0x57')]['id'],'from':(_0x1f39e4['firstName']||'')+'\x20'+(_0x1f39e4[_0x94c5('0x89')]||'')};var _0x36c796={'OpenchannelAccountId':_0x568c1e[_0x94c5('0x57')]['id'],'closed':![]};if(_0x568c1e['body'][_0x94c5('0x8a')]){_0x36c796[_0x94c5('0x8a')]=_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x8a')];return db['OpenchannelInteraction'][_0x94c5('0x59')]({'where':_0x36c796})[_0x94c5('0x1d')](function(_0x235e3a){if(_0x235e3a){return[_0x235e3a,![]];}_0x2c0ebb[_0x94c5('0x8a')]=_0x568c1e[_0x94c5('0x5b')]['threadId'];_0x2c0ebb[_0x94c5('0x8b')]=_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x8b')];return db[_0x94c5('0x8c')][_0x94c5('0x5a')](_0x2c0ebb)['then'](function(_0x4adc68){return[_0x4adc68,!![]];});});}else{_0x36c796[_0x94c5('0x8a')]=null;}_0x36c796['ContactId']=_0x1f39e4['id'];return db[_0x94c5('0x8c')][_0x94c5('0x59')]({'where':_0x36c796})['then'](function(_0x26495d){if(_0x26495d){return[_0x26495d,![]];}return db[_0x94c5('0x8c')][_0x94c5('0x5a')](_0x2c0ebb)[_0x94c5('0x1d')](function(_0x361593){return[_0x361593,!![]];});});}})[_0x94c5('0x8d')](function(_0x44dee1,_0x4aac5e){if(_0x44dee1){_0x1f73e0=_0x4aac5e;if(!_0x4aac5e){var _0x1f76b6={'from':(_0xcca07[_0x94c5('0x8e')]['firstName']||'')+'\x20'+(_0xcca07[_0x94c5('0x8e')][_0x94c5('0x89')]||'')};if(_0x568c1e['body'][_0x94c5('0x8a')]&&_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x8f')]&&_0x568c1e[_0x94c5('0x5b')]['threadId']!=_0x568c1e['body'][_0x94c5('0x8f')]){_0x1f76b6[_0x94c5('0x8a')]=_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x8f')];}return _0x44dee1['update'](_0x1f76b6);}else{return _0x44dee1;}}})[_0x94c5('0x1d')](function(_0x584de4){_0xcca07[_0x94c5('0x90')]=_0x584de4[_0x94c5('0x33')]({'plain':!![]});_0xcca07[_0x94c5('0x90')][_0x94c5('0x91')]=_0x1f73e0;if(_0xcca07['interaction'][_0x94c5('0x91')]){if(_0xcca07[_0x94c5('0x86')][_0x94c5('0x92')]){_0xcca07['applications']['push']({'id':0x0,'priority':_0xcca07['applications'][_0x94c5('0x42')]+0x1,'app':_0x94c5('0x93'),'appdata':_0x94c5('0x94'),'interval':_0x94c5('0x95')});}}return db['OpenchannelMessage'][_0x94c5('0x5a')]({'body':_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x5b')],'OpenchannelAccountId':_0x568c1e['params']['id'],'OpenchannelInteractionId':_0x584de4['id'],'direction':'in','ContactId':_0xcca07[_0x94c5('0x8e')]['id'],'AttachmentId':_0x568c1e[_0x94c5('0x5b')][_0x94c5('0x96')]});})[_0x94c5('0x1d')](function(_0x71d75b){_0xcca07[_0x94c5('0x25')]=_0x71d75b;if(_0xcca07['interaction']['UserId']){return db[_0x94c5('0x97')][_0x94c5('0x59')]({'attributes':['id',_0x94c5('0x37')],'where':{'id':_0xcca07[_0x94c5('0x90')][_0x94c5('0x98')]}})[_0x94c5('0x1d')](function(_0x4fd220){if(_0x4fd220){_0xcca07[_0x94c5('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x94c5('0x99'),'appdata':_0x4fd220[_0x94c5('0x37')]+','+(_0xcca07[_0x94c5('0x86')][_0x94c5('0x9a')]||0xa),'interval':_0x94c5('0x95')});_0xcca07[_0x94c5('0x9b')]=![];}return respondWithRpcPromise(_0x94c5('0x9c'),_0x94c5('0x9d'),_0xcca07);});}return respondWithRpcPromise(_0x94c5('0x9c'),_0x94c5('0x9d'),_0xcca07);})[_0x94c5('0x1d')](function(_0x52a47c){respondWithRpcPromise('EventManager',_0x94c5('0x9e'),{'event':_0x94c5('0x9f'),'message':_0x52a47c},client9002);return _0x52a47c;})[_0x94c5('0x1d')](respondWithResult(_0x5a9526,null))[_0x94c5('0x27')](handleError(_0x5a9526,null));};exports['addApplications']=function(_0x36f7e6,_0x300ac9,_0xc3205b){return db[_0x94c5('0x51')][_0x94c5('0x66')]({'where':{'id':_0x36f7e6[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x300ac9,null))['then'](function(_0x1f6626){if(_0x1f6626){return db['sequelize'][_0x94c5('0xa0')](function(_0x4a66bc){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x36f7e6[_0x94c5('0x57')]['id']},'transaction':_0x4a66bc})[_0x94c5('0x1d')](function(_0x530714){var _0x2504fe=_[_0x94c5('0x4b')](_0x36f7e6[_0x94c5('0x5b')],function(_0x27daa5){_0x27daa5[_0x94c5('0x6b')]=_0x36f7e6['params']['id'];return _0x27daa5;});return db[_0x94c5('0xa1')][_0x94c5('0xa2')](_0x2504fe,{'transaction':_0x4a66bc});});})['then'](function(){return db[_0x94c5('0xa1')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x36f7e6['params']['id']},'order':_0x94c5('0x85')});});}})[_0x94c5('0x1d')](respondWithResult(_0x300ac9,null))[_0x94c5('0x27')](handleError(_0x300ac9,null));};exports[_0x94c5('0xa3')]=function(_0x46eb3d,_0x31878e,_0x10eb8a){var _0x26902c={};var _0x2eb5ef={};var _0x1a3033;var _0x40a39f;return db[_0x94c5('0x51')][_0x94c5('0x66')]({'where':{'id':_0x46eb3d['params']['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x31878e,null))[_0x94c5('0x1d')](function(_0x1d6805){if(_0x1d6805){_0x1a3033=_0x1d6805;_0x2eb5ef[_0x94c5('0x40')]=_['keys'](db[_0x94c5('0xa1')]['rawAttributes']);_0x2eb5ef[_0x94c5('0x3d')]=_[_0x94c5('0x3c')](_0x46eb3d[_0x94c5('0x3d')]);_0x2eb5ef[_0x94c5('0x3e')]=_['intersection'](_0x2eb5ef['model'],_0x2eb5ef[_0x94c5('0x3d')]);_0x26902c[_0x94c5('0x41')]=_[_0x94c5('0x3f')](_0x2eb5ef[_0x94c5('0x40')],qs[_0x94c5('0x58')](_0x46eb3d[_0x94c5('0x3d')][_0x94c5('0x58')]));_0x26902c[_0x94c5('0x41')]=_0x26902c['attributes']['length']?_0x26902c[_0x94c5('0x41')]:_0x2eb5ef[_0x94c5('0x40')];_0x26902c[_0x94c5('0x45')]=qs[_0x94c5('0x46')](_0x46eb3d[_0x94c5('0x3d')][_0x94c5('0x46')]);_0x26902c['where']=qs[_0x94c5('0x3e')](_['pick'](_0x46eb3d[_0x94c5('0x3d')],_0x2eb5ef[_0x94c5('0x3e')]));if(_0x46eb3d['query'][_0x94c5('0x48')]){_0x26902c[_0x94c5('0x49')]=_[_0x94c5('0x4a')](_0x26902c[_0x94c5('0x49')],{'$or':_[_0x94c5('0x4b')](_0x26902c[_0x94c5('0x41')],function(_0x2a0b78){var _0x419dae={};_0x419dae[_0x2a0b78]={'$like':'%'+_0x46eb3d[_0x94c5('0x3d')]['filter']+'%'};return _0x419dae;})});}_0x26902c=_[_0x94c5('0x4a')]({},_0x26902c,_0x46eb3d[_0x94c5('0x50')]);return _0x1a3033[_0x94c5('0xa3')](_0x26902c);}})[_0x94c5('0x1d')](function(_0x59197e){if(_0x59197e){_0x40a39f=_0x59197e[_0x94c5('0x42')];if(!_0x46eb3d['query'][_0x94c5('0x68')](_0x94c5('0x43'))){_0x26902c['limit']=qs[_0x94c5('0x44')](_0x46eb3d[_0x94c5('0x3d')][_0x94c5('0x44')]);_0x26902c[_0x94c5('0x2c')]=qs[_0x94c5('0x2c')](_0x46eb3d[_0x94c5('0x3d')][_0x94c5('0x2c')]);}return _0x1a3033['getApplications'](_0x26902c);}})[_0x94c5('0x1d')](function(_0x267f2f){if(_0x267f2f){return _0x267f2f?{'count':_0x40a39f,'rows':_0x267f2f}:null;}})[_0x94c5('0x1d')](respondWithResult(_0x31878e,null))['catch'](handleError(_0x31878e,null));};exports[_0x94c5('0xa4')]=function(_0x4ffaea,_0x17919e,_0x144284){var _0x331449={'raw':![],'where':{}};var _0x354c64={};var _0x3f35d8={'count':0x0,'rows':[]};return db[_0x94c5('0x51')][_0x94c5('0x66')]({'where':{'id':_0x4ffaea[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x17919e,null))['then'](function(_0x34bcb0){if(_0x34bcb0){_0x354c64[_0x94c5('0x40')]=_['keys'](db[_0x94c5('0x8c')][_0x94c5('0x3b')]);_0x354c64['query']=_[_0x94c5('0x3c')](_0x4ffaea[_0x94c5('0x3d')]);_0x354c64[_0x94c5('0x3e')]=_[_0x94c5('0x3f')](_0x354c64[_0x94c5('0x40')],_0x354c64[_0x94c5('0x3d')]);_0x331449[_0x94c5('0x41')]=_[_0x94c5('0x3f')](_0x354c64['model'],qs[_0x94c5('0x58')](_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0x58')]));_0x331449[_0x94c5('0x41')]=_0x331449['attributes'][_0x94c5('0x42')]?_0x331449['attributes']:_0x354c64[_0x94c5('0x40')];if(!_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0x68')](_0x94c5('0x43'))){_0x331449['limit']=qs[_0x94c5('0x44')](_0x4ffaea[_0x94c5('0x3d')]['limit']);_0x331449[_0x94c5('0x2c')]=qs[_0x94c5('0x2c')](_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0x2c')]);}_0x331449['order']=qs['sort'](_0x4ffaea['query'][_0x94c5('0x46')]);_0x331449['where']=qs[_0x94c5('0x3e')](_[_0x94c5('0x47')](_0x4ffaea[_0x94c5('0x3d')],_0x354c64['filters']));_0x331449['where']['OpenchannelAccountId']=_0x34bcb0['id'];if(_0x4ffaea['query'][_0x94c5('0x48')]){_0x331449['where']=_[_0x94c5('0x4a')](_0x331449[_0x94c5('0x49')],{'$or':_[_0x94c5('0x4b')](_0x331449[_0x94c5('0x41')],function(_0x34b3ef){var _0xd2842e={};_0xd2842e[_0x34b3ef]={'$like':'%'+_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0x48')]+'%'};return _0xd2842e;})});}_0x331449=_['merge']({},_0x331449,_0x4ffaea[_0x94c5('0x50')]);return db[_0x94c5('0x8c')][_0x94c5('0x2b')]({'where':_0x331449['where']})[_0x94c5('0x1d')](function(_0x5e3fcd){_0x3f35d8[_0x94c5('0x2b')]=_0x5e3fcd;if(_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0x52')]){_0x331449['include']=[{'model':db[_0x94c5('0x70')],'as':_0x94c5('0xa5'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x94c5('0xa6'),_0x94c5('0xa7')],'required':![]},{'model':db['Tag'],'as':_0x94c5('0xa8'),'attributes':['id',_0x94c5('0x37'),_0x94c5('0xa9')],'where':_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0xaa')]?{'id':_0x4ffaea['query'][_0x94c5('0xaa')]}:undefined,'required':_0x4ffaea[_0x94c5('0x3d')][_0x94c5('0xaa')]?!![]:![]}];}return db[_0x94c5('0x8c')][_0x94c5('0x54')](_0x331449);})[_0x94c5('0x1d')](function(_0x2fdc70){_0x3f35d8[_0x94c5('0x55')]=_0x2fdc70;return _0x3f35d8;});}})[_0x94c5('0x1d')](respondWithFilteredResult(_0x17919e,_0x331449))[_0x94c5('0x27')](handleError(_0x17919e,null));};exports[_0x94c5('0xab')]=function(_0x3e9033,_0x28ad75,_0x1efd75){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0x3e9033[_0x94c5('0x57')]['id']}})['then'](handleEntityNotFound(_0x28ad75,null))[_0x94c5('0x1d')](function(_0x1d93e8){if(_0x1d93e8){return _0x1d93e8[_0x94c5('0xab')](_0x3e9033['body'][_0x94c5('0x6a')],_['omit'](_0x3e9033[_0x94c5('0x5b')],['ids','id'])||{})[_0x94c5('0x8d')](function(_0x368e16){for(var _0x597dab=0x0;_0x597dab<_0x3e9033['body'][_0x94c5('0x6a')]['length'];_0x597dab+=0x1){socket[_0x94c5('0xac')](_0x94c5('0xad'),{'UserId':_0x3e9033[_0x94c5('0x5b')][_0x94c5('0x6a')][_0x597dab],'OpenchannelAccountId':_0x3e9033[_0x94c5('0x57')]['id']});}return _0x368e16;});}})[_0x94c5('0x1d')](respondWithResult(_0x28ad75,null))[_0x94c5('0x27')](handleError(_0x28ad75,null));};exports[_0x94c5('0xae')]=function(_0xe4dca0,_0x2e6559,_0x409fc9){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0xe4dca0[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x2e6559,null))[_0x94c5('0x1d')](function(_0x9a6765){if(_0x9a6765){return _0x9a6765[_0x94c5('0xae')](_0xe4dca0[_0x94c5('0x3d')]['ids'])['then'](function(){if(_[_0x94c5('0xaf')](_0xe4dca0[_0x94c5('0x3d')][_0x94c5('0x6a')])){for(var _0x206cf3=0x0;_0x206cf3<_0xe4dca0[_0x94c5('0x3d')][_0x94c5('0x6a')][_0x94c5('0x42')];_0x206cf3+=0x1){socket[_0x94c5('0xac')]('userOpenchannelAccount:remove',{'UserId':Number(_0xe4dca0[_0x94c5('0x3d')][_0x94c5('0x6a')][_0x206cf3]),'OpenchannelAccountId':Number(_0xe4dca0['params']['id'])});}}else{socket['emit'](_0x94c5('0xb0'),{'UserId':Number(_0xe4dca0['query'][_0x94c5('0x6a')]),'OpenchannelAccountId':Number(_0xe4dca0[_0x94c5('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x2e6559,null))['catch'](handleError(_0x2e6559,null));};exports[_0x94c5('0xb1')]=function(_0x4b4e92,_0x31a9ac,_0x5125d1){var _0x211a91={};var _0x3381fc={};var _0x2560f8;var _0x3e3623;return db[_0x94c5('0x51')][_0x94c5('0x66')]({'where':{'id':_0x4b4e92['params']['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x31a9ac,null))[_0x94c5('0x1d')](function(_0x344e47){if(_0x344e47){_0x2560f8=_0x344e47;_0x3381fc[_0x94c5('0x40')]=_[_0x94c5('0x3c')](db['User'][_0x94c5('0x3b')]);_0x3381fc[_0x94c5('0x3d')]=_[_0x94c5('0x3c')](_0x4b4e92[_0x94c5('0x3d')]);_0x3381fc[_0x94c5('0x3e')]=_[_0x94c5('0x3f')](_0x3381fc[_0x94c5('0x40')],_0x3381fc[_0x94c5('0x3d')]);_0x211a91['attributes']=_[_0x94c5('0x3f')](_0x3381fc[_0x94c5('0x40')],qs[_0x94c5('0x58')](_0x4b4e92['query']['fields']));_0x211a91['attributes']=_0x211a91[_0x94c5('0x41')][_0x94c5('0x42')]?_0x211a91['attributes']:_0x3381fc[_0x94c5('0x40')];_0x211a91[_0x94c5('0x45')]=qs[_0x94c5('0x46')](_0x4b4e92[_0x94c5('0x3d')]['sort']);_0x211a91[_0x94c5('0x49')]=qs[_0x94c5('0x3e')](_[_0x94c5('0x47')](_0x4b4e92[_0x94c5('0x3d')],_0x3381fc['filters']));if(_0x4b4e92[_0x94c5('0x3d')][_0x94c5('0x48')]){_0x211a91[_0x94c5('0x49')]=_[_0x94c5('0x4a')](_0x211a91[_0x94c5('0x49')],{'$or':_[_0x94c5('0x4b')](_0x211a91['attributes'],function(_0x4bc30a){var _0x13c391={};_0x13c391[_0x4bc30a]={'$like':'%'+_0x4b4e92[_0x94c5('0x3d')]['filter']+'%'};return _0x13c391;})});}_0x211a91=_[_0x94c5('0x4a')]({},_0x211a91,_0x4b4e92[_0x94c5('0x50')]);return _0x2560f8[_0x94c5('0xb1')](_0x211a91);}})[_0x94c5('0x1d')](function(_0x444ed8){if(_0x444ed8){_0x3e3623=_0x444ed8[_0x94c5('0x42')];if(!_0x4b4e92[_0x94c5('0x3d')][_0x94c5('0x68')](_0x94c5('0x43'))){_0x211a91[_0x94c5('0x44')]=qs[_0x94c5('0x44')](_0x4b4e92[_0x94c5('0x3d')]['limit']);_0x211a91[_0x94c5('0x2c')]=qs[_0x94c5('0x2c')](_0x4b4e92[_0x94c5('0x3d')][_0x94c5('0x2c')]);}return _0x2560f8[_0x94c5('0xb1')](_0x211a91);}})[_0x94c5('0x1d')](function(_0xdb62dd){if(_0xdb62dd){return _0xdb62dd?{'count':_0x3e3623,'rows':_0xdb62dd}:null;}})[_0x94c5('0x1d')](respondWithResult(_0x31a9ac,null))['catch'](handleError(_0x31a9ac,null));};exports[_0x94c5('0xb2')]=function(_0x3be7ab,_0x4aa9b7,_0x34e88b){var _0x3e2831,_0x277070,_0x2221f6;if(_[_0x94c5('0x78')](_0x3be7ab[_0x94c5('0x5b')][_0x94c5('0x5b')])||_0x3be7ab[_0x94c5('0x5b')][_0x94c5('0x5b')]===''){throw new db[(_0x94c5('0x71'))][(_0x94c5('0x72'))](_0x94c5('0x7a'));}if(_[_0x94c5('0x78')](_0x3be7ab['body']['to'])){}_0x3e2831=_0x3be7ab['body']['to'];return db[_0x94c5('0x51')][_0x94c5('0x66')]({'where':{'id':_0x3be7ab[_0x94c5('0x57')]['id']}})[_0x94c5('0x1d')](handleEntityNotFound(_0x4aa9b7,null))[_0x94c5('0x1d')](function(_0xfb29a5){if(_0xfb29a5){return db[_0x94c5('0x51')][_0x94c5('0x59')]({'where':{'id':_0xfb29a5['id']},'include':[{'model':db[_0x94c5('0x7e')],'as':_0x94c5('0x81'),'include':[{'model':db[_0x94c5('0x70')],'as':_0x94c5('0x87'),'where':{[_0xfb29a5[_0x94c5('0x7b')]]:_0x3e2831},'limit':0x1,'order':[[_0x94c5('0x76'),_0x94c5('0x7f')]]}]}]})[_0x94c5('0x1d')](handleEntityNotFound(_0x4aa9b7,null))[_0x94c5('0x1d')](function(_0x27b995){if(_0x27b995&&_0x27b995[_0x94c5('0x81')]){_0x277070=_0x27b995[_0x94c5('0x33')]({'plain':!![]});if(_0x277070[_0x94c5('0x81')]&&_0x277070[_0x94c5('0x81')][_0x94c5('0x87')]['length']){return _0x277070['List']['Contacts'][0x0];}return db[_0x94c5('0x70')][_0x94c5('0x5a')](_[_0x94c5('0x14')](_0x3be7ab[_0x94c5('0x5b')],{'firstName':_0x3e2831,[_0x27b995[_0x94c5('0x7b')]]:_0x3e2831,'phone':_0x3e2831,'ListId':_0x277070['ListId']}));}})[_0x94c5('0x1d')](handleEntityNotFound(_0x4aa9b7,null))['then'](function(_0x54bfd3){if(_0x54bfd3){_0x2221f6=_0x54bfd3;return db[_0x94c5('0x8c')][_0x94c5('0x59')]({'where':{'ContactId':_0x2221f6['id'],'closed':![],'OpenchannelAccountId':_0x277070['id']}})[_0x94c5('0x1d')](function(_0x372db4){if(_0x372db4){return[_0x372db4,![]];}return db['OpenchannelInteraction'][_0x94c5('0x5a')]({'UserId':_0x3be7ab[_0x94c5('0x5c')]['id'],'ContactId':_0x2221f6['id'],'OpenchannelAccountId':_0x277070['id'],'lastMsgDirection':_0x94c5('0xb3'),'Messages':[_[_0x94c5('0x4a')](_0x3be7ab[_0x94c5('0x5b')],{'read':![],'body':_0x3be7ab[_0x94c5('0x5b')][_0x94c5('0x5b')],'OpenchannelAccountId':_0x277070['id'],'UserId':_0x3be7ab['user']['id'],'ContactId':_0x2221f6['id']})]},{'include':[{'model':db[_0x94c5('0xb4')],'as':'Messages'}]})[_0x94c5('0x1d')](function(_0x34c5cc){return[_0x34c5cc,!![]];});});}})[_0x94c5('0x8d')](function(_0x2a089b,_0x28de22){if(_0x28de22){return _0x2a089b;}return db[_0x94c5('0xb4')][_0x94c5('0x5a')](_[_0x94c5('0x4a')](_0x3be7ab[_0x94c5('0x5b')],{'read':![],'body':_0x3be7ab[_0x94c5('0x5b')][_0x94c5('0x5b')],'OpenchannelAccountId':_0x277070['id'],'OpenchannelInteractionId':_0x2a089b['id'],'UserId':_0x3be7ab[_0x94c5('0x5c')]['id'],'ContactId':_0x2221f6['id']}))[_0x94c5('0x1d')](function(_0x1eccd0){_0x2a089b[_0x94c5('0xb5')][_0x94c5('0xb6')]=[];_0x2a089b[_0x94c5('0xb5')][_0x94c5('0xb6')]['push'](_0x1eccd0[_0x94c5('0xb5')]);return _0x2a089b;});});}})[_0x94c5('0x1d')](respondWithResult(_0x4aa9b7,null))[_0x94c5('0x27')](handleError(_0x4aa9b7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1dd3f6f..a8cd713 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 _0xb253=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x310a80,_0x28cd8d){var _0x4fe907=function(_0x2750ad){while(--_0x2750ad){_0x310a80['push'](_0x310a80['shift']());}};_0x4fe907(++_0x28cd8d);}(_0xb253,0x95));var _0x3b25=function(_0x2d0500,_0x4412e9){_0x2d0500=_0x2d0500-0x0;var _0x4db83b=_0xb253[_0x2d0500];return _0x4db83b;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x3b25('0x0'))['db'][_0x3b25('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b25('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b25('0x3'),'afterDestroy':_0x3b25('0x4')};function emitEvent(_0x2e2e74){return function(_0x56d01f,_0x309a91,_0x31ae48){OpenchannelAccountEvents[_0x3b25('0x5')](_0x2e2e74+':'+_0x56d01f['id'],_0x56d01f);OpenchannelAccountEvents[_0x3b25('0x5')](_0x2e2e74,_0x56d01f);_0x31ae48(null);};}for(var e in events){if(events[_0x3b25('0x6')](e)){var event=events[e];OpenchannelAccount[_0x3b25('0x7')](e,emitEvent(event));}}module[_0x3b25('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb586=['update','remove','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x197115,_0x14d69a){var _0x19d830=function(_0x1f59c5){while(--_0x1f59c5){_0x197115['push'](_0x197115['shift']());}};_0x19d830(++_0x14d69a);}(_0xb586,0xbd));var _0x6b58=function(_0x104112,_0x342eb6){_0x104112=_0x104112-0x0;var _0x394ab4=_0xb586[_0x104112];return _0x394ab4;};'use strict';var EventEmitter=require(_0x6b58('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b58('0x1')](0x0);var events={'afterCreate':_0x6b58('0x2'),'afterUpdate':_0x6b58('0x3'),'afterDestroy':_0x6b58('0x4')};function emitEvent(_0x5c5e11){return function(_0x3233a3,_0x12e2b2,_0x27edce){OpenchannelAccountEvents[_0x6b58('0x5')](_0x5c5e11+':'+_0x3233a3['id'],_0x3233a3);OpenchannelAccountEvents[_0x6b58('0x5')](_0x5c5e11,_0x3233a3);_0x27edce(null);};}for(var e in events){if(events[_0x6b58('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x6b58('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 9325e4f..23fb36e 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 _0x3955=['exports','define','openchannel_accounts','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./openchannelAccount.attributes'];(function(_0x290258,_0x68ee9a){var _0x274e2f=function(_0x2cdb5d){while(--_0x2cdb5d){_0x290258['push'](_0x290258['shift']());}};_0x274e2f(++_0x68ee9a);}(_0x3955,0x7b));var _0x5395=function(_0x5751e9,_0x3a373e){_0x5751e9=_0x5751e9-0x0;var _0x346c39=_0x3955[_0x5751e9];return _0x346c39;};'use strict';var _=require(_0x5395('0x0'));var util=require('util');var logger=require(_0x5395('0x1'))('api');var moment=require(_0x5395('0x2'));var BPromise=require(_0x5395('0x3'));var rp=require(_0x5395('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5395('0x5'));var attributes=require(_0x5395('0x6'));module[_0x5395('0x7')]=function(_0xe82a96,_0x7a766b){return _0xe82a96[_0x5395('0x8')]('OpenchannelAccount',attributes,{'tableName':_0x5395('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x299c=['../../config/environment','exports','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x299c,0x180));var _0xc299=function(_0x2cddaf,_0x58b553){_0x2cddaf=_0x2cddaf-0x0;var _0x335b8e=_0x299c[_0x2cddaf];return _0x335b8e;};'use strict';var _=require(_0xc299('0x0'));var util=require('util');var logger=require(_0xc299('0x1'))('api');var moment=require(_0xc299('0x2'));var BPromise=require(_0xc299('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc299('0x4'));var rimraf=require(_0xc299('0x5'));var config=require(_0xc299('0x6'));var attributes=require('./openchannelAccount.attributes');module[_0xc299('0x7')]=function(_0x2e4c78,_0x135061){return _0x2e4c78['define'](_0xc299('0x8'),attributes,{'tableName':_0xc299('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index e1fa8ee..6e5388a 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 _0xc4aa=['redis','defaults','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xb879fa,_0x264b04){var _0x1548b8=function(_0x504845){while(--_0x504845){_0xb879fa['push'](_0xb879fa['shift']());}};_0x1548b8(++_0x264b04);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});config[_0xac4a('0xb')]=_[_0xac4a('0xc')](config[_0xac4a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac4a('0xb')]));require(_0xac4a('0xd'))[_0xac4a('0xe')](socket);function respondWithRpcPromise(_0x4f4146,_0x1d182e,_0x3a82de){return new BPromise(function(_0x3e64f5,_0x4d4acc){return client[_0xac4a('0xf')](_0x4f4146,_0x3a82de)['then'](function(_0x2f062c){logger['info'](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));logger[_0xac4a('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1d182e,_0xac4a('0x11'),JSON[_0xac4a('0x13')](_0x2f062c));if(_0x2f062c[_0xac4a('0x14')]){if(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x15')]===0x1f4){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x4d4acc(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}logger[_0xac4a('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x3e64f5(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}else{logger[_0xac4a('0x17')](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));_0x3e64f5(_0x2f062c[_0xac4a('0x18')]['message']);}})['catch'](function(_0x21a729){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x21a729);_0x4d4acc(_0x21a729);});});} \ No newline at end of file +var _0xc4aa=['redis','defaults','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b87f4,_0x5177c4){var _0xc17634=function(_0x285c4c){while(--_0x285c4c){_0x2b87f4['push'](_0x2b87f4['shift']());}};_0xc17634(++_0x5177c4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});config[_0xac4a('0xb')]=_[_0xac4a('0xc')](config[_0xac4a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac4a('0xb')]));require(_0xac4a('0xd'))[_0xac4a('0xe')](socket);function respondWithRpcPromise(_0x4f4146,_0x1d182e,_0x3a82de){return new BPromise(function(_0x3e64f5,_0x4d4acc){return client[_0xac4a('0xf')](_0x4f4146,_0x3a82de)['then'](function(_0x2f062c){logger['info'](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));logger[_0xac4a('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1d182e,_0xac4a('0x11'),JSON[_0xac4a('0x13')](_0x2f062c));if(_0x2f062c[_0xac4a('0x14')]){if(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x15')]===0x1f4){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x4d4acc(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}logger[_0xac4a('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x3e64f5(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}else{logger[_0xac4a('0x17')](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));_0x3e64f5(_0x2f062c[_0xac4a('0x18')]['message']);}})['catch'](function(_0x21a729){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x21a729);_0x4d4acc(_0x21a729);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 448951b..a8771d6 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 _0x37e5=['length','openchannelAccount:','./openchannelAccount.events','update','emit','removeListener','register'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x37e5,0x1de));var _0x537e=function(_0x209bb2,_0x3950e6){_0x209bb2=_0x209bb2-0x0;var _0xdbedfe=_0x37e5[_0x209bb2];return _0xdbedfe;};'use strict';var OpenchannelAccountEvents=require(_0x537e('0x0'));var events=['save','remove',_0x537e('0x1')];function createListener(_0x57b0d8,_0x78508a){return function(_0x12cb44){_0x78508a[_0x537e('0x2')](_0x57b0d8,_0x12cb44);};}function removeListener(_0x33b4ea,_0x1ecd30){return function(){OpenchannelAccountEvents[_0x537e('0x3')](_0x33b4ea,_0x1ecd30);};}exports[_0x537e('0x4')]=function(_0x2096c3){for(var _0x5be0ed=0x0,_0x506abf=events[_0x537e('0x5')];_0x5be0ed<_0x506abf;_0x5be0ed++){var _0x243244=events[_0x5be0ed];var _0x3b12db=createListener(_0x537e('0x6')+_0x243244,_0x2096c3);OpenchannelAccountEvents['on'](_0x243244,_0x3b12db);}}; \ No newline at end of file +var _0xec2d=['remove','update','emit','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x13e0ef,_0x2b966b){var _0x3617e3=function(_0x2fde67){while(--_0x2fde67){_0x13e0ef['push'](_0x13e0ef['shift']());}};_0x3617e3(++_0x2b966b);}(_0xec2d,0xbe));var _0xdec2=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0xec2d[_0x3b6f58];return _0x987c61;};'use strict';var OpenchannelAccountEvents=require(_0xdec2('0x0'));var events=[_0xdec2('0x1'),_0xdec2('0x2'),_0xdec2('0x3')];function createListener(_0x5358ea,_0x71a6f1){return function(_0x411647){_0x71a6f1[_0xdec2('0x4')](_0x5358ea,_0x411647);};}function removeListener(_0x4e4ed4,_0x2ff45f){return function(){OpenchannelAccountEvents['removeListener'](_0x4e4ed4,_0x2ff45f);};}exports[_0xdec2('0x5')]=function(_0x38912e){for(var _0x3c688b=0x0,_0x273192=events[_0xdec2('0x6')];_0x3c688b<_0x273192;_0x3c688b++){var _0x37c3cb=events[_0x3c688b];var _0x1b00fa=createListener(_0xdec2('0x7')+_0x37c3cb,_0x38912e);OpenchannelAccountEvents['on'](_0x37c3cb,_0x1b00fa);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0c56f2b..5f1585c 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 _0xc464=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete'];(function(_0x103fa3,_0x2f6cdd){var _0x5d9929=function(_0x44dc84){while(--_0x44dc84){_0x103fa3['push'](_0x103fa3['shift']());}};_0x5d9929(++_0x2f6cdd);}(_0xc464,0x1a0));var _0x4c46=function(_0x2b5cab,_0x100295){_0x2b5cab=_0x2b5cab-0x0;var _0x2d525a=_0xc464[_0x2b5cab];return _0x2d525a;};'use strict';var multer=require(_0x4c46('0x0'));var util=require('util');var path=require(_0x4c46('0x1'));var timeout=require(_0x4c46('0x2'));var express=require(_0x4c46('0x3'));var router=express[_0x4c46('0x4')]();var auth=require(_0x4c46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c46('0x6'));var controller=require(_0x4c46('0x7'));router[_0x4c46('0x8')]('/',auth[_0x4c46('0x9')](),controller[_0x4c46('0xa')]);router['get'](_0x4c46('0xb'),auth[_0x4c46('0x9')](),controller[_0x4c46('0xc')]);router['post']('/',auth[_0x4c46('0x9')](),controller[_0x4c46('0xd')]);router['put']('/:id',auth[_0x4c46('0x9')](),controller[_0x4c46('0xe')]);router[_0x4c46('0xf')](_0x4c46('0xb'),auth[_0x4c46('0x9')](),controller[_0x4c46('0x10')]);module[_0x4c46('0x11')]=router; \ No newline at end of file +var _0x91f3=['util','path','express','Router','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index','get','/:id','post','create','update','delete','exports'];(function(_0x11fdb0,_0xe744ef){var _0x558d7c=function(_0x3c74c4){while(--_0x3c74c4){_0x11fdb0['push'](_0x11fdb0['shift']());}};_0x558d7c(++_0xe744ef);}(_0x91f3,0x1e0));var _0x391f=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x91f3[_0x467488];return _0x56107f;};'use strict';var multer=require('multer');var util=require(_0x391f('0x0'));var path=require(_0x391f('0x1'));var timeout=require('connect-timeout');var express=require(_0x391f('0x2'));var router=express[_0x391f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x391f('0x4'));var config=require('../../config/environment');var controller=require(_0x391f('0x5'));router['get']('/',auth[_0x391f('0x6')](),controller[_0x391f('0x7')]);router[_0x391f('0x8')](_0x391f('0x9'),auth[_0x391f('0x6')](),controller['show']);router[_0x391f('0xa')]('/',auth[_0x391f('0x6')](),controller[_0x391f('0xb')]);router['put'](_0x391f('0x9'),auth[_0x391f('0x6')](),controller[_0x391f('0xc')]);router[_0x391f('0xd')](_0x391f('0x9'),auth[_0x391f('0x6')](),controller['destroy']);module[_0x391f('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7bfda5b..412ae85 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 _0x6114=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x6114,0x6d));var _0x4611=function(_0x2deed4,_0x2793e8){_0x2deed4=_0x2deed4-0x0;var _0xfb91f4=_0x6114[_0x2deed4];return _0xfb91f4;};'use strict';var Sequelize=require(_0x4611('0x0'));module[_0x4611('0x1')]={'priority':{'type':Sequelize[_0x4611('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4611('0x3')],'allowNull':![],'defaultValue':_0x4611('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4611('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6851=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x4c9472,_0x2a6a24){var _0x29e182=function(_0x2701c6){while(--_0x2701c6){_0x4c9472['push'](_0x4c9472['shift']());}};_0x29e182(++_0x2a6a24);}(_0x6851,0x1df));var _0x1685=function(_0x17f716,_0x4a06c7){_0x17f716=_0x17f716-0x0;var _0x31f0de=_0x6851[_0x17f716];return _0x31f0de;};'use strict';var Sequelize=require(_0x1685('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1685('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1685('0x2')],'allowNull':![],'defaultValue':_0x1685('0x3')},'appdata':{'type':Sequelize[_0x1685('0x4')]()},'description':{'type':Sequelize[_0x1685('0x2')]},'interval':{'type':Sequelize[_0x1685('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6aa4250..5adc859 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 _0x9a5a=['fields','length','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x3f7138,_0x369f9e){var _0x86654=function(_0x32b30f){while(--_0x32b30f){_0x3f7138['push'](_0x3f7138['shift']());}};_0x86654(++_0x369f9e);}(_0x9a5a,0x96));var _0xa9a5=function(_0x593b92,_0x47401b){_0x593b92=_0x593b92-0x0;var _0x1c8ab5=_0x9a5a[_0x593b92];return _0x1c8ab5;};'use strict';var pdf=require(_0xa9a5('0x0'));var emlformat=require(_0xa9a5('0x1'));var rimraf=require(_0xa9a5('0x2'));var zipdir=require(_0xa9a5('0x3'));var jsonpatch=require(_0xa9a5('0x4'));var rp=require('request-promise');var moment=require(_0xa9a5('0x5'));var BPromise=require(_0xa9a5('0x6'));var Mustache=require('mustache');var util=require(_0xa9a5('0x7'));var path=require(_0xa9a5('0x8'));var sox=require(_0xa9a5('0x9'));var csv=require(_0xa9a5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa9a5('0xb'));var squel=require(_0xa9a5('0xc'));var crypto=require('crypto');var jsforce=require(_0xa9a5('0xd'));var deskjs=require(_0xa9a5('0xe'));var toCsv=require(_0xa9a5('0xa'));var querystring=require('querystring');var Papa=require(_0xa9a5('0xf'));var Redis=require('ioredis');var authService=require(_0xa9a5('0x10'));var qs=require(_0xa9a5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9a5('0x12'))(_0xa9a5('0x13'));var utils=require('../../config/utils');var config=require(_0xa9a5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dda9c,_0x545145){_0x545145=_0x545145||0xcc;return function(_0x525d78){if(_0x525d78){return _0x1dda9c[_0xa9a5('0x15')](_0x545145);}return _0x1dda9c[_0xa9a5('0x16')](_0x545145)[_0xa9a5('0x17')]();};}function respondWithResult(_0x33d89f,_0xd81ca4){_0xd81ca4=_0xd81ca4||0xc8;return function(_0x1b429d){if(_0x1b429d){return _0x33d89f['status'](_0xd81ca4)[_0xa9a5('0x18')](_0x1b429d);}};}function respondWithFilteredResult(_0x586d51,_0x1bb8fb){return function(_0x3b9fb0){if(_0x3b9fb0){var _0x23c981=_0x3b9fb0[_0xa9a5('0x19')],_0x4ad944=_0x1bb8fb['offset'],_0x4d5d29=_0x1bb8fb[_0xa9a5('0x1a')]+_0x1bb8fb[_0xa9a5('0x1b')],_0x4d0ccd;if(_0x4d5d29>=_0x23c981){_0x4d5d29=_0x23c981;_0x4d0ccd=0xc8;}else{_0x4d0ccd=0xce;}_0x586d51[_0xa9a5('0x16')](_0x4d0ccd);return _0x586d51[_0xa9a5('0x1c')]('Content-Range',_0x4ad944+'-'+_0x4d5d29+'/'+_0x23c981)[_0xa9a5('0x18')](_0x3b9fb0);}return null;};}function patchUpdates(_0x34c8e1){return function(_0x1c329f){try{jsonpatch[_0xa9a5('0x1d')](_0x1c329f,_0x34c8e1,!![]);}catch(_0x4a79fd){return BPromise[_0xa9a5('0x1e')](_0x4a79fd);}return _0x1c329f['save']();};}function saveUpdates(_0x4165cb,_0x36c82b){return function(_0x2c62d9){if(_0x2c62d9){return _0x2c62d9[_0xa9a5('0x1f')](_0x4165cb)[_0xa9a5('0x20')](function(_0x47db1a){return _0x47db1a;});}return null;};}function removeEntity(_0x4c421b,_0x27e6d0){return function(_0xbc1c66){if(_0xbc1c66){return _0xbc1c66['destroy']()[_0xa9a5('0x20')](function(){_0x4c421b[_0xa9a5('0x16')](0xcc)[_0xa9a5('0x17')]();});}};}function handleEntityNotFound(_0x445a03,_0x378b9d){return function(_0x3e9e8e){if(!_0x3e9e8e){_0x445a03[_0xa9a5('0x15')](0x194);}return _0x3e9e8e;};}function handleError(_0x416b8b,_0x66d74f){_0x66d74f=_0x66d74f||0x1f4;return function(_0xb89dc0){logger[_0xa9a5('0x21')](_0xb89dc0[_0xa9a5('0x22')]);if(_0xb89dc0[_0xa9a5('0x23')]){delete _0xb89dc0[_0xa9a5('0x23')];}_0x416b8b[_0xa9a5('0x16')](_0x66d74f)[_0xa9a5('0x24')](_0xb89dc0);};}exports[_0xa9a5('0x25')]=function(_0x527455,_0x8f9935){var _0x45e4c2={},_0x4f0357={},_0x19c594={'count':0x0,'rows':[]};var _0xfd319c=db[_0xa9a5('0x26')][_0xa9a5('0x27')];_0x4f0357[_0xa9a5('0x28')]=_[_0xa9a5('0x29')](_0xfd319c);_0x4f0357['query']=_[_0xa9a5('0x29')](_0x527455[_0xa9a5('0x2a')]);_0x4f0357[_0xa9a5('0x2b')]=_[_0xa9a5('0x2c')](_0x4f0357[_0xa9a5('0x28')],_0x4f0357[_0xa9a5('0x2a')]);_0x45e4c2['attributes']=_['intersection'](_0x4f0357['model'],qs['fields'](_0x527455[_0xa9a5('0x2a')]['fields']));_0x45e4c2[_0xa9a5('0x2d')]=_0x45e4c2[_0xa9a5('0x2d')]['length']?_0x45e4c2[_0xa9a5('0x2d')]:_0x4f0357['model'];if(!_0x527455[_0xa9a5('0x2a')][_0xa9a5('0x2e')](_0xa9a5('0x2f'))){_0x45e4c2[_0xa9a5('0x1b')]=qs['limit'](_0x527455[_0xa9a5('0x2a')][_0xa9a5('0x1b')]);_0x45e4c2['offset']=qs['offset'](_0x527455['query'][_0xa9a5('0x1a')]);}_0x45e4c2[_0xa9a5('0x30')]=qs[_0xa9a5('0x31')](_0x527455['query']['sort']);_0x45e4c2[_0xa9a5('0x32')]=qs[_0xa9a5('0x2b')](_[_0xa9a5('0x33')](_0x527455[_0xa9a5('0x2a')],_0x4f0357[_0xa9a5('0x2b')]));if(_0x527455[_0xa9a5('0x2a')][_0xa9a5('0x34')]){_0x45e4c2[_0xa9a5('0x32')]=_['merge'](_0x45e4c2[_0xa9a5('0x32')],{'$or':_[_0xa9a5('0x35')](_0xfd319c,function(_0x4b42d5){if(_0x4b42d5[_0xa9a5('0x36')][_0xa9a5('0x37')]!==_0xa9a5('0x38')){var _0x57c0b0={};_0x57c0b0[_0x4b42d5[_0xa9a5('0x39')]]={'$like':'%'+_0x527455[_0xa9a5('0x2a')]['filter']+'%'};return _0x57c0b0;}})});}_0x45e4c2=_[_0xa9a5('0x3a')]({},_0x45e4c2,_0x527455[_0xa9a5('0x3b')]);var _0xb41ccc={'where':_0x45e4c2[_0xa9a5('0x32')]};return db[_0xa9a5('0x26')]['count'](_0xb41ccc)[_0xa9a5('0x20')](function(_0x12290f){_0x19c594[_0xa9a5('0x19')]=_0x12290f;if(_0x527455[_0xa9a5('0x2a')][_0xa9a5('0x3c')]){_0x45e4c2[_0xa9a5('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x45e4c2);})[_0xa9a5('0x20')](function(_0x321510){_0x19c594[_0xa9a5('0x3e')]=_0x321510;return _0x19c594;})[_0xa9a5('0x20')](respondWithFilteredResult(_0x8f9935,_0x45e4c2))[_0xa9a5('0x3f')](handleError(_0x8f9935,null));};exports[_0xa9a5('0x40')]=function(_0x3e5470,_0xea7cce){var _0x185799={'raw':!![],'where':{'id':_0x3e5470[_0xa9a5('0x41')]['id']}},_0x42920f={};_0x42920f['model']=_[_0xa9a5('0x29')](db[_0xa9a5('0x26')]['rawAttributes']);_0x42920f[_0xa9a5('0x2a')]=_[_0xa9a5('0x29')](_0x3e5470['query']);_0x42920f[_0xa9a5('0x2b')]=_[_0xa9a5('0x2c')](_0x42920f['model'],_0x42920f[_0xa9a5('0x2a')]);_0x185799['attributes']=_[_0xa9a5('0x2c')](_0x42920f[_0xa9a5('0x28')],qs[_0xa9a5('0x42')](_0x3e5470[_0xa9a5('0x2a')]['fields']));_0x185799[_0xa9a5('0x2d')]=_0x185799[_0xa9a5('0x2d')][_0xa9a5('0x43')]?_0x185799[_0xa9a5('0x2d')]:_0x42920f[_0xa9a5('0x28')];if(_0x3e5470[_0xa9a5('0x2a')][_0xa9a5('0x3c')]){_0x185799[_0xa9a5('0x3d')]=[{'all':!![]}];}_0x185799=_[_0xa9a5('0x3a')]({},_0x185799,_0x3e5470[_0xa9a5('0x3b')]);return db[_0xa9a5('0x26')][_0xa9a5('0x44')](_0x185799)['then'](handleEntityNotFound(_0xea7cce,null))['then'](respondWithResult(_0xea7cce,null))[_0xa9a5('0x3f')](handleError(_0xea7cce,null));};exports[_0xa9a5('0x45')]=function(_0x33f2f6,_0x59f6f0){return db['OpenchannelApplication'][_0xa9a5('0x45')](_0x33f2f6[_0xa9a5('0x46')],{})[_0xa9a5('0x20')](respondWithResult(_0x59f6f0,0xc9))[_0xa9a5('0x3f')](handleError(_0x59f6f0,null));};exports['update']=function(_0x3dc8a7,_0x1ecef3){if(_0x3dc8a7[_0xa9a5('0x46')]['id']){delete _0x3dc8a7[_0xa9a5('0x46')]['id'];}return db[_0xa9a5('0x26')]['find']({'where':{'id':_0x3dc8a7[_0xa9a5('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ecef3,null))[_0xa9a5('0x20')](saveUpdates(_0x3dc8a7[_0xa9a5('0x46')],null))[_0xa9a5('0x20')](respondWithResult(_0x1ecef3,null))[_0xa9a5('0x3f')](handleError(_0x1ecef3,null));};exports[_0xa9a5('0x47')]=function(_0x2f485e,_0x54adaf){return db[_0xa9a5('0x26')][_0xa9a5('0x44')]({'where':{'id':_0x2f485e[_0xa9a5('0x41')]['id']}})[_0xa9a5('0x20')](handleEntityNotFound(_0x54adaf,null))[_0xa9a5('0x20')](removeEntity(_0x54adaf,null))[_0xa9a5('0x3f')](handleError(_0x54adaf,null));}; \ No newline at end of file +var _0xc136=['params','rawAttributes','length','options','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','index','OpenchannelApplication','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','field','includeAll','include','rows','catch','show'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xc136,0xda));var _0x6c13=function(_0x716b44,_0xf08c1a){_0x716b44=_0x716b44-0x0;var _0xe93129=_0xc136[_0x716b44];return _0xe93129;};'use strict';var pdf=require(_0x6c13('0x0'));var emlformat=require(_0x6c13('0x1'));var rimraf=require(_0x6c13('0x2'));var zipdir=require(_0x6c13('0x3'));var jsonpatch=require(_0x6c13('0x4'));var rp=require(_0x6c13('0x5'));var moment=require('moment');var BPromise=require(_0x6c13('0x6'));var Mustache=require(_0x6c13('0x7'));var util=require(_0x6c13('0x8'));var path=require(_0x6c13('0x9'));var sox=require(_0x6c13('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c13('0xb'));var jsforce=require(_0x6c13('0xc'));var deskjs=require(_0x6c13('0xd'));var toCsv=require(_0x6c13('0xe'));var querystring=require('querystring');var Papa=require(_0x6c13('0xf'));var Redis=require(_0x6c13('0x10'));var authService=require(_0x6c13('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x6c13('0x12'));var logger=require(_0x6c13('0x13'))('api');var utils=require(_0x6c13('0x14'));var config=require(_0x6c13('0x15'));var db=require(_0x6c13('0x16'))['db'];function respondWithStatusCode(_0x586c49,_0x3a39f6){_0x3a39f6=_0x3a39f6||0xcc;return function(_0x37fb76){if(_0x37fb76){return _0x586c49[_0x6c13('0x17')](_0x3a39f6);}return _0x586c49[_0x6c13('0x18')](_0x3a39f6)['end']();};}function respondWithResult(_0x193d9b,_0x1c4c10){_0x1c4c10=_0x1c4c10||0xc8;return function(_0x431b32){if(_0x431b32){return _0x193d9b['status'](_0x1c4c10)['json'](_0x431b32);}};}function respondWithFilteredResult(_0x35322f,_0x2d40ae){return function(_0x5286c4){if(_0x5286c4){var _0x102e67=_0x5286c4[_0x6c13('0x19')],_0x27b225=_0x2d40ae['offset'],_0x2226ff=_0x2d40ae[_0x6c13('0x1a')]+_0x2d40ae[_0x6c13('0x1b')],_0x22c864;if(_0x2226ff>=_0x102e67){_0x2226ff=_0x102e67;_0x22c864=0xc8;}else{_0x22c864=0xce;}_0x35322f[_0x6c13('0x18')](_0x22c864);return _0x35322f[_0x6c13('0x1c')](_0x6c13('0x1d'),_0x27b225+'-'+_0x2226ff+'/'+_0x102e67)['json'](_0x5286c4);}return null;};}function patchUpdates(_0x308a3a){return function(_0x4f6a1e){try{jsonpatch[_0x6c13('0x1e')](_0x4f6a1e,_0x308a3a,!![]);}catch(_0x5dbb41){return BPromise['reject'](_0x5dbb41);}return _0x4f6a1e[_0x6c13('0x1f')]();};}function saveUpdates(_0x13477e,_0x39d72a){return function(_0x4b22af){if(_0x4b22af){return _0x4b22af[_0x6c13('0x20')](_0x13477e)[_0x6c13('0x21')](function(_0x519061){return _0x519061;});}return null;};}function removeEntity(_0x27c248,_0xfa092f){return function(_0x379d29){if(_0x379d29){return _0x379d29['destroy']()['then'](function(){_0x27c248[_0x6c13('0x18')](0xcc)[_0x6c13('0x22')]();});}};}function handleEntityNotFound(_0x3f44b6,_0x235602){return function(_0x5c1cc9){if(!_0x5c1cc9){_0x3f44b6[_0x6c13('0x17')](0x194);}return _0x5c1cc9;};}function handleError(_0x42a7e2,_0x5a55c4){_0x5a55c4=_0x5a55c4||0x1f4;return function(_0x2c662e){logger[_0x6c13('0x23')](_0x2c662e[_0x6c13('0x24')]);if(_0x2c662e['name']){delete _0x2c662e['name'];}_0x42a7e2[_0x6c13('0x18')](_0x5a55c4)['send'](_0x2c662e);};}exports[_0x6c13('0x25')]=function(_0x4b8ed5,_0x53681f){var _0x18a0cf={},_0x1864b1={},_0x1bc839={'count':0x0,'rows':[]};var _0x480133=db[_0x6c13('0x26')]['rawAttributes'];_0x1864b1['model']=_['keys'](_0x480133);_0x1864b1[_0x6c13('0x27')]=_[_0x6c13('0x28')](_0x4b8ed5[_0x6c13('0x27')]);_0x1864b1[_0x6c13('0x29')]=_[_0x6c13('0x2a')](_0x1864b1[_0x6c13('0x2b')],_0x1864b1[_0x6c13('0x27')]);_0x18a0cf[_0x6c13('0x2c')]=_['intersection'](_0x1864b1[_0x6c13('0x2b')],qs['fields'](_0x4b8ed5[_0x6c13('0x27')][_0x6c13('0x2d')]));_0x18a0cf['attributes']=_0x18a0cf['attributes']['length']?_0x18a0cf[_0x6c13('0x2c')]:_0x1864b1['model'];if(!_0x4b8ed5['query'][_0x6c13('0x2e')](_0x6c13('0x2f'))){_0x18a0cf['limit']=qs[_0x6c13('0x1b')](_0x4b8ed5[_0x6c13('0x27')][_0x6c13('0x1b')]);_0x18a0cf['offset']=qs[_0x6c13('0x1a')](_0x4b8ed5[_0x6c13('0x27')]['offset']);}_0x18a0cf['order']=qs[_0x6c13('0x30')](_0x4b8ed5[_0x6c13('0x27')][_0x6c13('0x30')]);_0x18a0cf['where']=qs[_0x6c13('0x29')](_[_0x6c13('0x31')](_0x4b8ed5['query'],_0x1864b1[_0x6c13('0x29')]));if(_0x4b8ed5[_0x6c13('0x27')][_0x6c13('0x32')]){_0x18a0cf[_0x6c13('0x33')]=_[_0x6c13('0x34')](_0x18a0cf[_0x6c13('0x33')],{'$or':_[_0x6c13('0x35')](_0x480133,function(_0x2c7316){if(_0x2c7316[_0x6c13('0x36')][_0x6c13('0x37')]!=='VIRTUAL'){var _0x448610={};_0x448610[_0x2c7316[_0x6c13('0x38')]]={'$like':'%'+_0x4b8ed5[_0x6c13('0x27')][_0x6c13('0x32')]+'%'};return _0x448610;}})});}_0x18a0cf=_[_0x6c13('0x34')]({},_0x18a0cf,_0x4b8ed5['options']);var _0x3bc76b={'where':_0x18a0cf[_0x6c13('0x33')]};return db[_0x6c13('0x26')][_0x6c13('0x19')](_0x3bc76b)[_0x6c13('0x21')](function(_0x39f782){_0x1bc839[_0x6c13('0x19')]=_0x39f782;if(_0x4b8ed5[_0x6c13('0x27')][_0x6c13('0x39')]){_0x18a0cf[_0x6c13('0x3a')]=[{'all':!![]}];}return db[_0x6c13('0x26')]['findAll'](_0x18a0cf);})[_0x6c13('0x21')](function(_0x5bf680){_0x1bc839[_0x6c13('0x3b')]=_0x5bf680;return _0x1bc839;})['then'](respondWithFilteredResult(_0x53681f,_0x18a0cf))[_0x6c13('0x3c')](handleError(_0x53681f,null));};exports[_0x6c13('0x3d')]=function(_0x5d9ae0,_0x1b8e88){var _0x8788c2={'raw':!![],'where':{'id':_0x5d9ae0[_0x6c13('0x3e')]['id']}},_0x14fd14={};_0x14fd14[_0x6c13('0x2b')]=_[_0x6c13('0x28')](db[_0x6c13('0x26')][_0x6c13('0x3f')]);_0x14fd14['query']=_[_0x6c13('0x28')](_0x5d9ae0[_0x6c13('0x27')]);_0x14fd14['filters']=_['intersection'](_0x14fd14[_0x6c13('0x2b')],_0x14fd14[_0x6c13('0x27')]);_0x8788c2[_0x6c13('0x2c')]=_[_0x6c13('0x2a')](_0x14fd14[_0x6c13('0x2b')],qs[_0x6c13('0x2d')](_0x5d9ae0[_0x6c13('0x27')][_0x6c13('0x2d')]));_0x8788c2[_0x6c13('0x2c')]=_0x8788c2[_0x6c13('0x2c')][_0x6c13('0x40')]?_0x8788c2[_0x6c13('0x2c')]:_0x14fd14[_0x6c13('0x2b')];if(_0x5d9ae0['query']['includeAll']){_0x8788c2['include']=[{'all':!![]}];}_0x8788c2=_[_0x6c13('0x34')]({},_0x8788c2,_0x5d9ae0[_0x6c13('0x41')]);return db[_0x6c13('0x26')][_0x6c13('0x42')](_0x8788c2)[_0x6c13('0x21')](handleEntityNotFound(_0x1b8e88,null))[_0x6c13('0x21')](respondWithResult(_0x1b8e88,null))[_0x6c13('0x3c')](handleError(_0x1b8e88,null));};exports[_0x6c13('0x43')]=function(_0x52361b,_0x497450){return db[_0x6c13('0x26')][_0x6c13('0x43')](_0x52361b['body'],{})['then'](respondWithResult(_0x497450,0xc9))['catch'](handleError(_0x497450,null));};exports['update']=function(_0x7ccbf2,_0x4331a1){if(_0x7ccbf2[_0x6c13('0x44')]['id']){delete _0x7ccbf2[_0x6c13('0x44')]['id'];}return db[_0x6c13('0x26')][_0x6c13('0x42')]({'where':{'id':_0x7ccbf2[_0x6c13('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4331a1,null))[_0x6c13('0x21')](saveUpdates(_0x7ccbf2[_0x6c13('0x44')],null))[_0x6c13('0x21')](respondWithResult(_0x4331a1,null))[_0x6c13('0x3c')](handleError(_0x4331a1,null));};exports[_0x6c13('0x45')]=function(_0x58c7f6,_0x1c49af){return db[_0x6c13('0x26')][_0x6c13('0x42')]({'where':{'id':_0x58c7f6[_0x6c13('0x3e')]['id']}})[_0x6c13('0x21')](handleEntityNotFound(_0x1c49af,null))[_0x6c13('0x21')](removeEntity(_0x1c49af,null))[_0x6c13('0x3c')](handleError(_0x1c49af,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0505f85..53d6bc4 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 _0xb028=['path','rimraf','./openchannelApplication.attributes','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird'];(function(_0x2e388d,_0x81de0c){var _0x44b68c=function(_0x4fc78d){while(--_0x4fc78d){_0x2e388d['push'](_0x2e388d['shift']());}};_0x44b68c(++_0x81de0c);}(_0xb028,0x72));var _0x8b02=function(_0x2ce709,_0x41ab1e){_0x2ce709=_0x2ce709-0x0;var _0x908e80=_0xb028[_0x2ce709];return _0x908e80;};'use strict';var _=require(_0x8b02('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8b02('0x1'));var moment=require('moment');var BPromise=require(_0x8b02('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b02('0x3'));var rimraf=require(_0x8b02('0x4'));var config=require('../../config/environment');var attributes=require(_0x8b02('0x5'));module['exports']=function(_0x121512,_0x5a79bc){return _0x121512['define']('OpenchannelApplication',attributes,{'tableName':_0x8b02('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b02('0x7'),'collate':_0x8b02('0x8')});}; \ No newline at end of file +var _0xba78=['../../config/environment','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x3574c7,_0x25df5b){var _0x2e9681=function(_0x4d36f0){while(--_0x4d36f0){_0x3574c7['push'](_0x3574c7['shift']());}};_0x2e9681(++_0x25df5b);}(_0xba78,0x159));var _0x8ba7=function(_0x2ddcf0,_0x547c76){_0x2ddcf0=_0x2ddcf0-0x0;var _0x5ae14b=_0xba78[_0x2ddcf0];return _0x5ae14b;};'use strict';var _=require(_0x8ba7('0x0'));var util=require('util');var logger=require(_0x8ba7('0x1'))(_0x8ba7('0x2'));var moment=require('moment');var BPromise=require(_0x8ba7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8ba7('0x4'));var config=require(_0x8ba7('0x5'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x26fab5,_0x44c8d9){return _0x26fab5['define'](_0x8ba7('0x6'),attributes,{'tableName':_0x8ba7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ba7('0x8'),'collate':_0x8ba7('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 92b9bef..5e9bbcd 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 _0x9632=['raw','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','body','options'];(function(_0x4d27dc,_0x4774e8){var _0x84901e=function(_0x22c6c5){while(--_0x22c6c5){_0x4d27dc['push'](_0x4d27dc['shift']());}};_0x84901e(++_0x4774e8);}(_0x9632,0x1b6));var _0x2963=function(_0x3e5f4a,_0x550b7f){_0x3e5f4a=_0x3e5f4a-0x0;var _0x33bcea=_0x9632[_0x3e5f4a];return _0x33bcea;};'use strict';var _=require(_0x2963('0x0'));var util=require(_0x2963('0x1'));var moment=require(_0x2963('0x2'));var BPromise=require(_0x2963('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2963('0x4'))['db'];var utils=require(_0x2963('0x5'));var logger=require(_0x2963('0x6'))(_0x2963('0x7'));var config=require(_0x2963('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2963('0x9')][_0x2963('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaf1a6,_0x10ec35,_0x44edab){return new BPromise(function(_0xb8cbe2,_0x4f54e2){return client[_0x2963('0xb')](_0xaf1a6,_0x44edab)[_0x2963('0xc')](function(_0x4fa985){logger[_0x2963('0xd')](_0x2963('0xe'),_0x10ec35,'request\x20sent');logger[_0x2963('0xf')](_0x2963('0x10'),_0x10ec35,_0x2963('0x11'),JSON[_0x2963('0x12')](_0x4fa985));if(_0x4fa985[_0x2963('0x13')]){if(_0x4fa985['error'][_0x2963('0x14')]===0x1f4){logger[_0x2963('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x10ec35,_0x4fa985[_0x2963('0x13')]['message']);return _0x4f54e2(_0x4fa985[_0x2963('0x13')][_0x2963('0x15')]);}logger['error'](_0x2963('0xe'),_0x10ec35,_0x4fa985[_0x2963('0x13')]['message']);return _0xb8cbe2(_0x4fa985['error'][_0x2963('0x15')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x10ec35,_0x2963('0x11'));_0xb8cbe2(_0x4fa985['result'][_0x2963('0x15')]);}})['catch'](function(_0x41f0d7){logger[_0x2963('0x13')](_0x2963('0xe'),_0x10ec35,_0x41f0d7);_0x4f54e2(_0x41f0d7);});});}exports[_0x2963('0x16')]=function(_0x589dee){var _0x8cb36f=this;return new Promise(function(_0x473593,_0x14f18d){return db[_0x2963('0x17')]['update'](_0x589dee[_0x2963('0x18')],{'raw':_0x589dee[_0x2963('0x19')]?_0x589dee[_0x2963('0x19')][_0x2963('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x589dee[_0x2963('0x19')]?_0x589dee[_0x2963('0x19')]['where']||null:null,'attributes':_0x589dee[_0x2963('0x19')]?_0x589dee[_0x2963('0x19')][_0x2963('0x1b')]||null:null,'limit':_0x589dee[_0x2963('0x19')]?_0x589dee[_0x2963('0x19')][_0x2963('0x1c')]||null:null})[_0x2963('0xc')](function(_0x17eeff){logger[_0x2963('0xd')]('UpdateOpenchannelApplication',_0x589dee);logger[_0x2963('0xf')](_0x2963('0x16'),_0x589dee,JSON['stringify'](_0x17eeff));_0x473593(_0x17eeff);})['catch'](function(_0x20a332){logger[_0x2963('0x13')](_0x2963('0x16'),_0x20a332[_0x2963('0x15')],_0x589dee);_0x14f18d(_0x8cb36f['error'](0x1f4,_0x20a332[_0x2963('0x15')]));});});}; \ No newline at end of file +var _0xac57=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','update','body','options','where','UpdateOpenchannelApplication'];(function(_0x2bdd00,_0x138793){var _0x7c5e30=function(_0x118f27){while(--_0x118f27){_0x2bdd00['push'](_0x2bdd00['shift']());}};_0x7c5e30(++_0x138793);}(_0xac57,0x6c));var _0x7ac5=function(_0x3736f7,_0xe2b1b4){_0x3736f7=_0x3736f7-0x0;var _0x4d1960=_0xac57[_0x3736f7];return _0x4d1960;};'use strict';var _=require(_0x7ac5('0x0'));var util=require(_0x7ac5('0x1'));var moment=require(_0x7ac5('0x2'));var BPromise=require(_0x7ac5('0x3'));var rs=require(_0x7ac5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ac5('0x5'))['db'];var utils=require(_0x7ac5('0x6'));var logger=require(_0x7ac5('0x7'))(_0x7ac5('0x8'));var config=require(_0x7ac5('0x9'));var jayson=require(_0x7ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a58c7,_0x4ee526,_0x3c2fc8){return new BPromise(function(_0x443004,_0x51f744){return client['request'](_0x5a58c7,_0x3c2fc8)[_0x7ac5('0xb')](function(_0x19b288){logger[_0x7ac5('0xc')](_0x7ac5('0xd'),_0x4ee526,'request\x20sent');logger[_0x7ac5('0xe')](_0x7ac5('0xf'),_0x4ee526,_0x7ac5('0x10'),JSON[_0x7ac5('0x11')](_0x19b288));if(_0x19b288['error']){if(_0x19b288[_0x7ac5('0x12')]['code']===0x1f4){logger['error'](_0x7ac5('0xd'),_0x4ee526,_0x19b288[_0x7ac5('0x12')]['message']);return _0x51f744(_0x19b288['error'][_0x7ac5('0x13')]);}logger[_0x7ac5('0x12')](_0x7ac5('0xd'),_0x4ee526,_0x19b288[_0x7ac5('0x12')][_0x7ac5('0x13')]);return _0x443004(_0x19b288['error'][_0x7ac5('0x13')]);}else{logger[_0x7ac5('0xc')](_0x7ac5('0xd'),_0x4ee526,'request\x20sent');_0x443004(_0x19b288[_0x7ac5('0x14')][_0x7ac5('0x13')]);}})[_0x7ac5('0x15')](function(_0x52694c){logger['error'](_0x7ac5('0xd'),_0x4ee526,_0x52694c);_0x51f744(_0x52694c);});});}exports['UpdateOpenchannelApplication']=function(_0x123942){var _0x5d1fbb=this;return new Promise(function(_0x219be1,_0x3c074d){return db['OpenchannelApplication'][_0x7ac5('0x16')](_0x123942[_0x7ac5('0x17')],{'raw':_0x123942[_0x7ac5('0x18')]?_0x123942[_0x7ac5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x123942['options']?_0x123942[_0x7ac5('0x18')][_0x7ac5('0x19')]||null:null,'attributes':_0x123942[_0x7ac5('0x18')]?_0x123942['options']['attributes']||null:null,'limit':_0x123942['options']?_0x123942[_0x7ac5('0x18')]['limit']||null:null})[_0x7ac5('0xb')](function(_0x437c1a){logger['info']('UpdateOpenchannelApplication',_0x123942);logger[_0x7ac5('0xe')](_0x7ac5('0x1a'),_0x123942,JSON['stringify'](_0x437c1a));_0x219be1(_0x437c1a);})[_0x7ac5('0x15')](function(_0x34f4af){logger[_0x7ac5('0x12')]('UpdateOpenchannelApplication',_0x34f4af['message'],_0x123942);_0x3c074d(_0x5d1fbb[_0x7ac5('0x12')](0x1f4,_0x34f4af[_0x7ac5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e7a28c6..c11b26f 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 _0x6a60=['post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','download'];(function(_0x1e9574,_0x420f84){var _0x42cec3=function(_0x21731f){while(--_0x21731f){_0x1e9574['push'](_0x1e9574['shift']());}};_0x42cec3(++_0x420f84);}(_0x6a60,0x175));var _0x06a6=function(_0x1a1ab9,_0x101883){_0x1a1ab9=_0x1a1ab9-0x0;var _0x1f3d6f=_0x6a60[_0x1a1ab9];return _0x1f3d6f;};'use strict';var multer=require(_0x06a6('0x0'));var util=require(_0x06a6('0x1'));var path=require(_0x06a6('0x2'));var timeout=require(_0x06a6('0x3'));var express=require(_0x06a6('0x4'));var router=express['Router']();var auth=require(_0x06a6('0x5'));var interaction=require(_0x06a6('0x6'));var config=require(_0x06a6('0x7'));var controller=require(_0x06a6('0x8'));router[_0x06a6('0x9')]('/',auth[_0x06a6('0xa')](),controller[_0x06a6('0xb')]);router[_0x06a6('0x9')](_0x06a6('0xc'),auth[_0x06a6('0xa')](),controller['describe']);router[_0x06a6('0x9')](_0x06a6('0xd'),auth[_0x06a6('0xa')](),controller['show']);router[_0x06a6('0x9')](_0x06a6('0xe'),auth['isAuthenticated'](),controller[_0x06a6('0xf')]);router['get']('/:id/download',auth[_0x06a6('0xa')](),controller[_0x06a6('0x10')]);router[_0x06a6('0x11')]('/',auth[_0x06a6('0xa')](),controller[_0x06a6('0x12')]);router[_0x06a6('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x06a6('0x13')]);router[_0x06a6('0x11')](_0x06a6('0x14'),auth[_0x06a6('0xa')](),interaction[_0x06a6('0x15')](_0x06a6('0x16'),_0x06a6('0x17')),controller['addTags']);router[_0x06a6('0x18')](_0x06a6('0xd'),auth[_0x06a6('0xa')](),interaction[_0x06a6('0x15')]('openchannel','openchannelinteraction:update'),controller['update']);router[_0x06a6('0x19')](_0x06a6('0xd'),auth[_0x06a6('0xa')](),interaction[_0x06a6('0x15')]('openchannel',_0x06a6('0x1a')),controller[_0x06a6('0x1b')]);router['delete'](_0x06a6('0x14'),auth[_0x06a6('0xa')](),controller[_0x06a6('0x1c')]);module[_0x06a6('0x1d')]=router; \ No newline at end of file +var _0x07e0=['openchannelinteraction:destroy','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x07e0,0xeb));var _0x007e=function(_0x20b822,_0x4affe3){_0x20b822=_0x20b822-0x0;var _0x3cd815=_0x07e0[_0x20b822];return _0x3cd815;};'use strict';var multer=require(_0x007e('0x0'));var util=require(_0x007e('0x1'));var path=require(_0x007e('0x2'));var timeout=require(_0x007e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x007e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x007e('0x5'));var controller=require('./openchannelInteraction.controller');router[_0x007e('0x6')]('/',auth['isAuthenticated'](),controller[_0x007e('0x7')]);router[_0x007e('0x6')](_0x007e('0x8'),auth[_0x007e('0x9')](),controller[_0x007e('0xa')]);router[_0x007e('0x6')](_0x007e('0xb'),auth['isAuthenticated'](),controller[_0x007e('0xc')]);router[_0x007e('0x6')](_0x007e('0xd'),auth[_0x007e('0x9')](),controller[_0x007e('0xe')]);router[_0x007e('0x6')]('/:id/download',auth[_0x007e('0x9')](),controller[_0x007e('0xf')]);router[_0x007e('0x10')]('/',auth[_0x007e('0x9')](),controller[_0x007e('0x11')]);router[_0x007e('0x10')](_0x007e('0xd'),auth[_0x007e('0x9')](),controller[_0x007e('0x12')]);router[_0x007e('0x10')](_0x007e('0x13'),auth[_0x007e('0x9')](),interaction[_0x007e('0x14')](_0x007e('0x15'),_0x007e('0x16')),controller[_0x007e('0x17')]);router[_0x007e('0x18')](_0x007e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x007e('0x15'),_0x007e('0x19')),controller['update']);router['delete']('/:id',auth[_0x007e('0x9')](),interaction['tracked'](_0x007e('0x15'),_0x007e('0x1a')),controller['destroy']);router[_0x007e('0x1b')](_0x007e('0x13'),auth[_0x007e('0x9')](),controller['removeTags']);module[_0x007e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index adb66b7..dc7a159 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 _0x5292=['STRING','ENUM','sequelize','exports','DATE'];(function(_0x43f136,_0x365817){var _0x531928=function(_0x5a59e9){while(--_0x5a59e9){_0x43f136['push'](_0x43f136['shift']());}};_0x531928(++_0x365817);}(_0x5292,0xf7));var _0x2529=function(_0xa69733,_0x2aa122){_0xa69733=_0xa69733-0x0;var _0xca5645=_0x5292[_0xa69733];return _0xca5645;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2529('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2529('0x3')]},'read1stAt':{'type':Sequelize[_0x2529('0x2')]},'threadId':{'type':Sequelize[_0x2529('0x3')]},'externalUrl':{'type':Sequelize[_0x2529('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2529('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65ff=['STRING','ENUM','exports','BOOLEAN','DATE'];(function(_0x56cb83,_0x2b33d5){var _0x579621=function(_0x581abf){while(--_0x581abf){_0x56cb83['push'](_0x56cb83['shift']());}};_0x579621(++_0x2b33d5);}(_0x65ff,0x1dd));var _0xf65f=function(_0x330ac6,_0x3adc83){_0x330ac6=_0x330ac6-0x0;var _0x59b845=_0x65ff[_0x330ac6];return _0x59b845;};'use strict';var Sequelize=require('sequelize');module[_0xf65f('0x0')]={'closed':{'type':Sequelize[_0xf65f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf65f('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf65f('0x2')]},'threadId':{'type':Sequelize[_0xf65f('0x3')]},'externalUrl':{'type':Sequelize[_0xf65f('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf65f('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf65f('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index dc1acd9..067dcac 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 _0x65ce=['i.id\x20LIKE\x20?','toString','join','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','group','Sequelize','QueryTypes','SELECT','clone','read','%s\x20=\x200','having','`Messages.count`\x20=\x200','%s\x20>\x200','`Messages.count`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','it.OpenchannelInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','sequelize','keyBy','merge','a.key','Account.key','i.*','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','openchannel_interaction_has_tags','groupBy','OpenchannelInteractionId','all','rows','params','intersection','includeAll','include','catch','create','update','body','describe','addMessage','OpenchannelMessage','find','ids','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','Tag','removeTags','download','unix','root','server','tmp','files','attachments','transcript-%d-%s.zip','secret','User','CmContact','Contact','firstName','lastName','Attachment','OpenchannelAccount','Account','Owner','fullname','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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','mkdirSync','closedAt','disposition','threadId','Public','existsSync','pipe','createWriteStream','basename','direction','out','System','renderFile','downloadInteraction.html','transcript-','.pdf','log','unlinkSync','html-pdf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','closed','unreadMessages','Users','map','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','model','keys','query','fields','attributes','nolimit','order','sort','filters','select','field','color','from','tools_tags','COUNT(*)','where','me.OpenchannelInteractionId\x20=\x20i.id','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_messages','expr','advancedFilter','parse','value','day','format','utc','endOf','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','isArray','condition','TagId','Messages.count','length','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','ContactId','c.firstName','\x20LIKE\x20?','c.email','\x20>\x20?','\x20<\x20?','hasOwnProperty','isNil','concat','createdAt','$gte','$lte','null','\x20IS\x20NULL','filter','replace','\x27\x27\x27\x27','isNumeric'];(function(_0x432d8b,_0x4f6242){var _0xe0df3b=function(_0x1b06f4){while(--_0x1b06f4){_0x432d8b['push'](_0x432d8b['shift']());}};_0xe0df3b(++_0x4f6242);}(_0x65ce,0x152));var _0xe65c=function(_0x4cbb95,_0x4a3da5){_0x4cbb95=_0x4cbb95-0x0;var _0x567495=_0x65ce[_0x4cbb95];return _0x567495;};'use strict';var pdf=require(_0xe65c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe65c('0x1'));var jsonpatch=require(_0xe65c('0x2'));var rp=require('request-promise');var moment=require(_0xe65c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe65c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe65c('0x5'));var csv=require(_0xe65c('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe65c('0x7'));var crypto=require(_0xe65c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xe65c('0x9'));var toCsv=require(_0xe65c('0x6'));var querystring=require(_0xe65c('0xa'));var Papa=require(_0xe65c('0xb'));var Redis=require('ioredis');var authService=require(_0xe65c('0xc'));var qs=require(_0xe65c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe65c('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xe65c('0xf'));var db=require(_0xe65c('0x10'))['db'];config[_0xe65c('0x11')]=_[_0xe65c('0x12')](config[_0xe65c('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xe65c('0x13'))(new Redis(config[_0xe65c('0x11')]));require(_0xe65c('0x14'))[_0xe65c('0x15')](socket);function respondWithStatusCode(_0x210e0d,_0x248d54){_0x248d54=_0x248d54||0xcc;return function(_0x220a55){if(_0x220a55){return _0x210e0d['sendStatus'](_0x248d54);}return _0x210e0d[_0xe65c('0x16')](_0x248d54)[_0xe65c('0x17')]();};}function respondWithResult(_0x30ea18,_0x3abb4c){_0x3abb4c=_0x3abb4c||0xc8;return function(_0x223d3a){if(_0x223d3a){return _0x30ea18['status'](_0x3abb4c)[_0xe65c('0x18')](_0x223d3a);}};}function respondWithFilteredResult(_0x5c3d96,_0x5c9567){return function(_0x4749e3){if(_0x4749e3){var _0x30eb67=_0x4749e3[_0xe65c('0x19')],_0x34be6c=_0x5c9567[_0xe65c('0x1a')],_0xb7613c=_0x5c9567[_0xe65c('0x1a')]+_0x5c9567[_0xe65c('0x1b')],_0xbc6ba7;if(_0xb7613c>=_0x30eb67){_0xb7613c=_0x30eb67;_0xbc6ba7=0xc8;}else{_0xbc6ba7=0xce;}_0x5c3d96[_0xe65c('0x16')](_0xbc6ba7);return _0x5c3d96[_0xe65c('0x1c')](_0xe65c('0x1d'),_0x34be6c+'-'+_0xb7613c+'/'+_0x30eb67)[_0xe65c('0x18')](_0x4749e3);}return null;};}function patchUpdates(_0x298c64){return function(_0x13fd68){try{jsonpatch[_0xe65c('0x1e')](_0x13fd68,_0x298c64,!![]);}catch(_0x27cdd2){return BPromise[_0xe65c('0x1f')](_0x27cdd2);}return _0x13fd68[_0xe65c('0x20')]();};}function saveUpdates(_0x4b7917,_0x5c9926){return function(_0x365f0a){if(_0x365f0a){return _0x365f0a['update'](_0x4b7917)[_0xe65c('0x21')](function(_0x476a6b){return _0x476a6b;});}return null;};}function removeEntity(_0x10b76d,_0x7dc2d5){return function(_0x10b435){if(_0x10b435){return _0x10b435[_0xe65c('0x22')]()[_0xe65c('0x21')](function(){_0x10b76d[_0xe65c('0x16')](0xcc)[_0xe65c('0x17')]();});}};}function handleEntityNotFound(_0x1c8e6f,_0x26df82){return function(_0x582a11){if(!_0x582a11){_0x1c8e6f['sendStatus'](0x194);}return _0x582a11;};}function handleError(_0x3f6401,_0x4b2a45){_0x4b2a45=_0x4b2a45||0x1f4;return function(_0x1d3752){logger[_0xe65c('0x23')](_0x1d3752['stack']);if(_0x1d3752['name']){delete _0x1d3752[_0xe65c('0x24')];}_0x3f6401[_0xe65c('0x16')](_0x4b2a45)['send'](_0x1d3752);};}function getInteractionUnreadMessages(_0x353203){return new BPromise(function(_0x24f642,_0xc1f99c){try{if(_0x353203[_0xe65c('0x25')]){_0x353203[_0xe65c('0x26')]=0x0;_0x24f642(_0x353203);}else{return db['OpenchannelMessage'][_0xe65c('0x19')]({'where':{'OpenchannelInteractionId':_0x353203['id'],'direction':'in','read':![]}})[_0xe65c('0x21')](function(_0x59b4b7){_0x353203[_0xe65c('0x26')]=_0x59b4b7;_0x24f642(_0x353203);});}}catch(_0x898d98){_0xc1f99c(_0x898d98);}});}function getInteractionUsers(_0x3eb796,_0x1880cb){return new BPromise(function(_0x3a9f80,_0x5b81ae){try{if(_0x1880cb[_0x3eb796['id']]){_0x3eb796[_0xe65c('0x27')]=_[_0xe65c('0x28')](_0x1880cb[_0x3eb796['id']],function(_0x33e013){return{'id':_0x33e013['id']};});}}catch(_0x519442){_0x5b81ae(_0x519442);}_0x3a9f80(_0x3eb796);});}function getInteractionTags(_0x302449,_0x515d6e){return new BPromise(function(_0x43cd0a,_0x1e514e){try{if(_0x302449[_0xe65c('0x29')]){_0x302449[_0xe65c('0x2a')]=[];_0x302449['TagIds'][_0xe65c('0x2b')](',')[_0xe65c('0x2c')](function(_0x46cff8){_0x302449[_0xe65c('0x2a')][_0xe65c('0x2d')](_0x515d6e[_0x46cff8]);});}delete _0x302449[_0xe65c('0x29')];}catch(_0x1f31ab){_0x1e514e(_0x1f31ab);}_0x43cd0a(_0x302449);});}function updateOpenchannelInteraction(_0x42bfd3,_0x2dab97,_0x1ff0a7){return new BPromise(function(_0x1e2a9d,_0x550464){return getInteractionUnreadMessages(_0x42bfd3)['then'](function(_0x5df70b){return getInteractionUsers(_0x5df70b,_0x1ff0a7);})[_0xe65c('0x21')](function(_0x559a72){return getInteractionTags(_0x559a72,_0x2dab97);})[_0xe65c('0x21')](function(_0x47fc72){_0x1e2a9d(_0x47fc72);})['catch'](function(_0x4e8ab6){_0x550464(_0x4e8ab6);});});}exports[_0xe65c('0x2e')]=function(_0x5f4e06,_0x186849){var _0x5e907a={},_0x48dbd9={},_0x4aa1e8={'count':0x0,'rows':[]};var _0x4306b0=db[_0xe65c('0x2f')][_0xe65c('0x30')];_0x48dbd9[_0xe65c('0x31')]=_[_0xe65c('0x32')](_0x4306b0);_0x48dbd9[_0xe65c('0x33')]=_[_0xe65c('0x32')](_0x5f4e06[_0xe65c('0x33')]);_0x48dbd9['filters']=_['intersection'](_0x48dbd9[_0xe65c('0x31')],_0x48dbd9[_0xe65c('0x33')]);_0x5e907a['attributes']=_['intersection'](_0x48dbd9[_0xe65c('0x31')],qs[_0xe65c('0x34')](_0x5f4e06['query'][_0xe65c('0x34')]));_0x5e907a[_0xe65c('0x35')]=_0x5e907a[_0xe65c('0x35')]['length']?_0x5e907a[_0xe65c('0x35')]:_0x48dbd9[_0xe65c('0x31')];if(!_0x5f4e06[_0xe65c('0x33')]['hasOwnProperty'](_0xe65c('0x36'))){_0x5e907a[_0xe65c('0x1b')]=qs['limit'](_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x1b')]);_0x5e907a['offset']=qs['offset'](_0x5f4e06['query'][_0xe65c('0x1a')]);}_0x5e907a[_0xe65c('0x37')]=qs[_0xe65c('0x38')](_0x5f4e06[_0xe65c('0x33')]['sort']);_0x5e907a['where']=qs[_0xe65c('0x39')](_['pick'](_0x5f4e06[_0xe65c('0x33')],_0x48dbd9[_0xe65c('0x39')]));var _0x37e50a=[];var _0x1c3c33=squel[_0xe65c('0x3a')]()[_0xe65c('0x3b')]('id')['field'](_0xe65c('0x24'))['field'](_0xe65c('0x3c'))[_0xe65c('0x3d')](_0xe65c('0x3e'));var _0x55981d=squel[_0xe65c('0x3a')]()[_0xe65c('0x3b')](_0xe65c('0x3f'))[_0xe65c('0x3d')]('openchannel_messages','me')[_0xe65c('0x40')](_0xe65c('0x41'))['where']('me.direction\x20=\x20\x27in\x27')[_0xe65c('0x40')]('me.read\x20=\x20false');var _0x37b7c8=squel[_0xe65c('0x3a')]()[_0xe65c('0x3b')](_0xe65c('0x42'))[_0xe65c('0x3b')](_0xe65c('0x43'))[_0xe65c('0x3d')](_0xe65c('0x44'),'ui')['left_join'](_0xe65c('0x45'),'u','u.id\x20=\x20ui.UserId');var _0x4daf15=squel[_0xe65c('0x3a')]()[_0xe65c('0x3d')](_0xe65c('0x46'),'i')[_0xe65c('0x47')](_0xe65c('0x48'),'c',_0xe65c('0x49'))['left_join'](_0xe65c('0x45'),'o','o.id\x20=\x20i.UserId')[_0xe65c('0x47')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0xe65c('0x47')](_0xe65c('0x4a'),'me',_0xe65c('0x41'));var _0x5c7afa=squel[_0xe65c('0x4b')]();if(_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x4c')]){var _0x4e91cf=JSON[_0xe65c('0x4d')](_0x5f4e06['query']['advancedFilter']);_['keys'](_0x4e91cf)[_0xe65c('0x2c')](function(_0x2a12ee){var _0x44d83f=_0x4e91cf[_0x2a12ee];if(_0x2a12ee==='createdAt'){var _0x31990a=moment(_0x44d83f[_0xe65c('0x4e')]['dateStart'])['startOf'](_0xe65c('0x4f'))['utc']()[_0xe65c('0x50')]();var _0x249ffc=moment(_0x249ffc)[_0xe65c('0x51')]()[_0xe65c('0x52')]('day')[_0xe65c('0x50')]();_0x5c7afa[_0xe65c('0x53')](_0xe65c('0x54'),_0x31990a,_0x249ffc);}else{if(_[_0xe65c('0x55')](_0x44d83f[_0xe65c('0x56')])){_0x44d83f['condition'][_0xe65c('0x2c')](function(_0x1d145f){switch(_0x44d83f[_0xe65c('0x56')][_0xe65c('0x4e')]){case'IS':if(_0x2a12ee!==_0xe65c('0x57')&&_0x2a12ee!==_0xe65c('0x58')){if(_[_0xe65c('0x55')](_0x44d83f['value'])&&_0x44d83f[_0xe65c('0x4e')][_0xe65c('0x59')]>0x1){_0x5c7afa[_0xe65c('0x53')](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+_0xe65c('0x5b'),_0x44d83f[_0xe65c('0x4e')]);}else{_0x5c7afa['and'](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+_0xe65c('0x5c'),_0x44d83f['value'][0x0]);}}break;case'=':_0x5c7afa[_0xe65c('0x53')](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+'\x20=\x20?',_0x44d83f[_0xe65c('0x4e')]);break;case _0xe65c('0x5d'):if(_0x2a12ee===_0xe65c('0x5e')){_0x5c7afa[_0xe65c('0x53')](_0xe65c('0x5f')+_0xe65c('0x60'),'%'+_0x44d83f['value']+'%');_0x5c7afa['or']('c.lastName'+_0xe65c('0x60'),'%'+_0x44d83f['value']+'%');_0x5c7afa['or'](_0xe65c('0x61')+_0xe65c('0x60'),'%'+_0x44d83f[_0xe65c('0x4e')]+'%');}else{_0x5c7afa[_0xe65c('0x53')](_0x44d83f['tableAlias']+'.'+_0x2a12ee+_0xe65c('0x60'),'%'+_0x44d83f['value']+'%');}break;case'>':_0x5c7afa['and'](_0x44d83f['tableAlias']+'.'+_0x2a12ee+_0xe65c('0x62'),_0x44d83f[_0xe65c('0x4e')]);break;case'<':_0x5c7afa[_0xe65c('0x53')](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+'\x20<\x20?',_0x44d83f['value']);break;}});}else{switch(_0x44d83f[_0xe65c('0x56')][_0xe65c('0x4e')]){case'IS':if(_0x2a12ee!=='TagId'&&_0x2a12ee!==_0xe65c('0x58')){if(_[_0xe65c('0x55')](_0x44d83f[_0xe65c('0x4e')])&&_0x44d83f[_0xe65c('0x4e')]['length']>0x1){_0x5c7afa[_0xe65c('0x53')](_0x44d83f['tableAlias']+'.'+_0x2a12ee+_0xe65c('0x5b'),_0x44d83f['value']);}else{_0x5c7afa[_0xe65c('0x53')](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+'\x20=\x20?',_0x44d83f[_0xe65c('0x4e')][0x0]);}}break;case'=':_0x5c7afa['and'](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+_0xe65c('0x5c'),_0x44d83f['value']);break;case'LIKE':if(_0x2a12ee===_0xe65c('0x5e')){_0x5c7afa['and'](_0xe65c('0x5f')+_0xe65c('0x60'),'%'+_0x44d83f[_0xe65c('0x4e')]+'%');_0x5c7afa['or']('c.lastName'+_0xe65c('0x60'),'%'+_0x44d83f[_0xe65c('0x4e')]+'%');_0x5c7afa['or'](_0xe65c('0x61')+_0xe65c('0x60'),'%'+_0x44d83f['value']+'%');}else{_0x5c7afa['and'](_0x44d83f['tableAlias']+'.'+_0x2a12ee+_0xe65c('0x60'),'%'+_0x44d83f[_0xe65c('0x4e')]+'%');}break;case'>':_0x5c7afa[_0xe65c('0x53')](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+'\x20>\x20?',_0x44d83f[_0xe65c('0x4e')]);break;case'<':_0x5c7afa[_0xe65c('0x53')](_0x44d83f[_0xe65c('0x5a')]+'.'+_0x2a12ee+_0xe65c('0x63'),_0x44d83f[_0xe65c('0x4e')]);break;}}}});}else{var _0x5bc1bd=_(Object[_0xe65c('0x32')](_0x5f4e06['query']))[_0xe65c('0x28')](function(_0x3da9bb){return _0x4306b0[_0xe65c('0x64')](_0x3da9bb)?_0x3da9bb:undefined;})['filter'](function(_0x1a3b76){return!_[_0xe65c('0x65')](_0x1a3b76);})[_0xe65c('0x4e')]();if(!_['isEmpty'](_0x5bc1bd)){_0x5bc1bd['forEach'](function(_0x462b24){if(_0x462b24==='OpenchannelAccountId'){_0x4daf15[_0xe65c('0x40')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xe65c('0x66')](_0x5f4e06[_0xe65c('0x33')][_0x462b24]));}else if(_0x462b24===_0xe65c('0x67')){var _0x27802b=JSON[_0xe65c('0x4d')](_0x5f4e06[_0xe65c('0x33')][_0x462b24])[_0xe65c('0x68')];var _0xd79ccc=JSON[_0xe65c('0x4d')](_0x5f4e06[_0xe65c('0x33')][_0x462b24])[_0xe65c('0x69')];_0x4daf15[_0xe65c('0x40')](_0xe65c('0x54'),_0x27802b,_0xd79ccc);}else{if(_0x5f4e06[_0xe65c('0x33')][_0x462b24]===_0xe65c('0x6a')){_0x4daf15[_0xe65c('0x40')]('i.'+_0x462b24+_0xe65c('0x6b'));}else{_0x4daf15['where']('i.'+_0x462b24+_0xe65c('0x5c'),_0x5f4e06[_0xe65c('0x33')][_0x462b24]);}}});}if(_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x6c')]){var _0x514169=_0x5f4e06[_0xe65c('0x33')]['filter'][_0xe65c('0x6d')]('\x5c','\x5c\x5c')[_0xe65c('0x6d')]('\x27\x27',_0xe65c('0x6e'));if(qs[_0xe65c('0x6f')](_0x514169)){_0x5c7afa['or'](_0xe65c('0x70'),_0x514169+'%');}else{var _0x2df26a=[];_0x514169[_0xe65c('0x2b')]('\x20')[_0xe65c('0x2c')](function(_0x50baa1){_0x2df26a[_0xe65c('0x2d')]('+'+_0x50baa1[_0xe65c('0x71')]());});var _0x34003d=_0x2df26a[_0xe65c('0x72')]('\x20');_0x5c7afa['or'](_0xe65c('0x73'),_0x34003d)['or'](_0xe65c('0x74'),_0x514169+'%')['or'](_0xe65c('0x75'),_0x514169+'%');}}}_0x4daf15['where'](_0x5c7afa);if(_0x5e907a[_0xe65c('0x37')]){_0x5e907a[_0xe65c('0x37')][_0xe65c('0x2c')](function(_0x558b47){_0x4daf15['order']('i.'+_0x558b47[0x0],_0x558b47[0x1]===_0xe65c('0x76')?![]:!![]);});}_0x4daf15[_0xe65c('0x77')]('i.id');var _0x4a7329={'type':db[_0xe65c('0x78')][_0xe65c('0x79')][_0xe65c('0x7a')],'raw':!![]};var _0x131e84=_0x4daf15[_0xe65c('0x7b')]()[_0xe65c('0x3b')]('COUNT(*)');if(!_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x4c')]){if(_0x5f4e06['query'][_0xe65c('0x7c')]){if(_0x5f4e06['query']['read']==0x1){_0x131e84[_0xe65c('0x40')](util[_0xe65c('0x50')](_0xe65c('0x7d'),_0x55981d[_0xe65c('0x71')]()));_0x4daf15[_0xe65c('0x7e')](_0xe65c('0x7f'));}else{_0x131e84[_0xe65c('0x40')](util[_0xe65c('0x50')](_0xe65c('0x80'),_0x55981d[_0xe65c('0x71')]()));_0x4daf15['having'](_0xe65c('0x81'));}}if(_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x82')]){var _0x120bf4=_[_0xe65c('0x55')](_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x82')])?_0x5f4e06['query'][_0xe65c('0x82')]:new Array(_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x82')]);var _0x1a4cf5=squel[_0xe65c('0x4b')]();_0x120bf4['forEach'](function(_0x4ffba4){_0x1a4cf5['or'](_0xe65c('0x83'),'%,'+_0x4ffba4+',%');});_0x4daf15[_0xe65c('0x7e')](_0x1a4cf5);_0x131e84[_0xe65c('0x47')]('openchannel_interaction_has_tags','it',_0xe65c('0x84'));_0x131e84[_0xe65c('0x47')](_0xe65c('0x3e'),'t','t.id\x20=\x20it.TagId');_0x131e84[_0xe65c('0x40')]('t.id\x20IN\x20?',_0x120bf4);}}else{var _0x4e91cf=JSON[_0xe65c('0x4d')](_0x5f4e06[_0xe65c('0x33')][_0xe65c('0x4c')]);_[_0xe65c('0x32')](_0x4e91cf)[_0xe65c('0x2c')](function(_0x470b6a){var _0x40a1bd=_0x4e91cf[_0x470b6a];if(_0x470b6a===_0xe65c('0x57')){var _0x55087f=_0x40a1bd[_0xe65c('0x4e')];var _0x7e75c0=squel['expr']();_0x55087f[_0xe65c('0x2c')](function(_0x4fa850){_0x7e75c0['or'](_0xe65c('0x83'),'%,'+_0x4fa850+',%');});_0x4daf15[_0xe65c('0x7e')](_0x7e75c0);_0x131e84[_0xe65c('0x47')](_0xe65c('0x85'),'it',_0xe65c('0x86'));_0x131e84[_0xe65c('0x47')](_0xe65c('0x3e'),'t',_0xe65c('0x87'));_0x131e84[_0xe65c('0x40')](_0xe65c('0x88'),_0x55087f);}else if(_0x470b6a==='Messages.count'){if(_0x40a1bd['value'][_0xe65c('0x59')]===0x1){if(_0x40a1bd['value'][0x0]===0x1){_0x131e84['where'](util[_0xe65c('0x50')](_0xe65c('0x7d'),_0x55981d[_0xe65c('0x71')]()));_0x4daf15[_0xe65c('0x7e')](_0xe65c('0x7f'));}else{_0x131e84[_0xe65c('0x40')](util[_0xe65c('0x50')](_0xe65c('0x80'),_0x55981d[_0xe65c('0x71')]()));_0x4daf15[_0xe65c('0x7e')](_0xe65c('0x81'));}}}});}db[_0xe65c('0x89')]['query'](_0x131e84[_0xe65c('0x71')](),_0x4a7329)['then'](function(_0xbce964){_0x4aa1e8['count']=_0xbce964[_0xe65c('0x59')];if(_0x4aa1e8['count']===0x0)return[];return db[_0xe65c('0x89')][_0xe65c('0x33')](_0x1c3c33[_0xe65c('0x71')](),_0x4a7329)[_0xe65c('0x21')](function(_0x3204e7){_0x37e50a=_[_0xe65c('0x8a')](_0x3204e7,'id');_0x4a7329=_[_0xe65c('0x8b')](_0x4a7329,{'model':db[_0xe65c('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});_0x4daf15[_0xe65c('0x3b')](_0xe65c('0x8c'),_0xe65c('0x8d'));_0x4daf15[_0xe65c('0x3b')](_0xe65c('0x8e'));_0x4daf15['field'](_0xe65c('0x5f'),'Contact.firstName');_0x4daf15[_0xe65c('0x3b')](_0xe65c('0x8f'),_0xe65c('0x90'));_0x4daf15['field'](_0xe65c('0x61'),_0xe65c('0x91'));_0x4daf15[_0xe65c('0x3b')](_0xe65c('0x92'),_0xe65c('0x93'));_0x4daf15['field'](_0xe65c('0x94'),'Contact.mobile');_0x4daf15[_0xe65c('0x3b')](_0xe65c('0x95'),_0xe65c('0x96'));_0x4daf15[_0xe65c('0x3b')](_0xe65c('0x97'),_0xe65c('0x29'));_0x4daf15[_0xe65c('0x47')](_0xe65c('0x98'),'it',_0xe65c('0x84'));_0x4daf15[_0xe65c('0x47')](_0xe65c('0x3e'),'t','t.id\x20=\x20it.TagId');_0x4daf15[_0xe65c('0x1b')](_0x5e907a[_0xe65c('0x1b')]);_0x4daf15[_0xe65c('0x1a')](_0x5e907a[_0xe65c('0x1a')]);return db['sequelize'][_0xe65c('0x33')](_0x4daf15['toString'](),_0x4a7329);})['then'](function(_0x32e4e3){_0x37b7c8[_0xe65c('0x40')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x32e4e3,'id'));return db[_0xe65c('0x89')][_0xe65c('0x33')](_0x37b7c8[_0xe65c('0x71')](),_0x4a7329)[_0xe65c('0x21')](function(_0x3ea82b){var _0x331c17=_[_0xe65c('0x99')](_0x3ea82b,_0xe65c('0x9a'));var _0x46f065=[];_0x32e4e3[_0xe65c('0x2c')](function(_0xf0390e){_0x46f065[_0xe65c('0x2d')](updateOpenchannelInteraction(_0xf0390e,_0x37e50a,_0x331c17));});return BPromise[_0xe65c('0x9b')](_0x46f065);});});})[_0xe65c('0x21')](function(_0xe6fc45){_0x4aa1e8[_0xe65c('0x9c')]=_0xe6fc45;return _0x4aa1e8;})[_0xe65c('0x21')](respondWithFilteredResult(_0x186849,_0x5e907a))['catch'](handleError(_0x186849,null));};exports['show']=function(_0xf0171a,_0x27f230){var _0x5a7a5d={'raw':![],'where':{'id':_0xf0171a[_0xe65c('0x9d')]['id']}},_0x5d607={};_0x5d607['model']=_[_0xe65c('0x32')](db['OpenchannelInteraction']['rawAttributes']);_0x5d607[_0xe65c('0x33')]=_['keys'](_0xf0171a['query']);_0x5d607[_0xe65c('0x39')]=_[_0xe65c('0x9e')](_0x5d607[_0xe65c('0x31')],_0x5d607[_0xe65c('0x33')]);_0x5a7a5d[_0xe65c('0x35')]=_['intersection'](_0x5d607[_0xe65c('0x31')],qs[_0xe65c('0x34')](_0xf0171a[_0xe65c('0x33')][_0xe65c('0x34')]));_0x5a7a5d[_0xe65c('0x35')]=_0x5a7a5d[_0xe65c('0x35')][_0xe65c('0x59')]?_0x5a7a5d['attributes']:_0x5d607['model'];if(_0xf0171a[_0xe65c('0x33')][_0xe65c('0x9f')]){_0x5a7a5d[_0xe65c('0xa0')]=[{'all':!![]}];}_0x5a7a5d=_[_0xe65c('0x8b')]({},_0x5a7a5d,_0xf0171a['options']);return db[_0xe65c('0x2f')]['find'](_0x5a7a5d)[_0xe65c('0x21')](handleEntityNotFound(_0x27f230,null))[_0xe65c('0x21')](respondWithResult(_0x27f230,null))[_0xe65c('0xa1')](handleError(_0x27f230,null));};exports['create']=function(_0x19a214,_0x4124da){return db[_0xe65c('0x2f')][_0xe65c('0xa2')](_0x19a214['body'],{})['then'](respondWithResult(_0x4124da,0xc9))[_0xe65c('0xa1')](handleError(_0x4124da,null));};exports[_0xe65c('0xa3')]=function(_0x5b688c,_0x361dbb){if(_0x5b688c['body']['id']){delete _0x5b688c['body']['id'];}return db[_0xe65c('0x2f')]['find']({'where':{'id':_0x5b688c['params']['id']}})[_0xe65c('0x21')](handleEntityNotFound(_0x361dbb,null))[_0xe65c('0x21')](saveUpdates(_0x5b688c[_0xe65c('0xa4')],null))['then'](respondWithResult(_0x361dbb,null))[_0xe65c('0xa1')](handleError(_0x361dbb,null));};exports[_0xe65c('0x22')]=function(_0x590287,_0x6b6ae2){return db[_0xe65c('0x2f')]['find']({'where':{'id':_0x590287[_0xe65c('0x9d')]['id']}})['then'](handleEntityNotFound(_0x6b6ae2,null))['then'](removeEntity(_0x6b6ae2,null))[_0xe65c('0xa1')](handleError(_0x6b6ae2,null));};exports[_0xe65c('0xa5')]=function(_0x52f778,_0x1af6a8){return db[_0xe65c('0x2f')][_0xe65c('0xa5')]()[_0xe65c('0x21')](respondWithResult(_0x1af6a8,null))[_0xe65c('0xa1')](handleError(_0x1af6a8,null));};exports[_0xe65c('0xa6')]=function(_0x2508ee,_0x3950a4,_0x1f5652){return db[_0xe65c('0xa7')][_0xe65c('0xa8')]({'where':{'id':_0x2508ee[_0xe65c('0x9d')]['id']}})['then'](handleEntityNotFound(_0x3950a4,null))[_0xe65c('0x21')](function(_0x2e2e3a){if(_0x2e2e3a){return _0x2e2e3a['addMessage'](_0x2508ee['body'][_0xe65c('0xa9')],_['omit'](_0x2508ee[_0xe65c('0xa4')],[_0xe65c('0xa9'),'id'])||{});}})[_0xe65c('0x21')](respondWithResult(_0x3950a4,null))[_0xe65c('0xa1')](handleError(_0x3950a4,null));};exports[_0xe65c('0xaa')]=function(_0x45b30d,_0x38c353,_0x272846){var _0x2dcb36={'raw':![],'where':{}};var _0x198b10={};var _0x1746b2={'count':0x0,'rows':[]};return db[_0xe65c('0x2f')]['findOne']({'where':{'id':_0x45b30d[_0xe65c('0x9d')]['id']}})['then'](handleEntityNotFound(_0x38c353,null))['then'](function(_0x3e2b58){if(_0x3e2b58){_0x198b10[_0xe65c('0x31')]=_[_0xe65c('0x32')](db['OpenchannelMessage']['rawAttributes']);_0x198b10[_0xe65c('0x33')]=_[_0xe65c('0x32')](_0x45b30d[_0xe65c('0x33')]);_0x198b10[_0xe65c('0x39')]=_[_0xe65c('0x9e')](_0x198b10[_0xe65c('0x31')],_0x198b10['query']);_0x2dcb36['attributes']=_[_0xe65c('0x9e')](_0x198b10[_0xe65c('0x31')],qs[_0xe65c('0x34')](_0x45b30d['query'][_0xe65c('0x34')]));_0x2dcb36[_0xe65c('0x35')]=_0x2dcb36[_0xe65c('0x35')]['length']?_0x2dcb36[_0xe65c('0x35')]:_0x198b10[_0xe65c('0x31')];if(!_0x45b30d[_0xe65c('0x33')][_0xe65c('0x64')](_0xe65c('0x36'))){_0x2dcb36['limit']=qs[_0xe65c('0x1b')](_0x45b30d[_0xe65c('0x33')][_0xe65c('0x1b')]);_0x2dcb36[_0xe65c('0x1a')]=qs['offset'](_0x45b30d['query'][_0xe65c('0x1a')]);}_0x2dcb36['order']=qs[_0xe65c('0x38')](_0x45b30d[_0xe65c('0x33')]['sort']);_0x2dcb36[_0xe65c('0x40')]=qs[_0xe65c('0x39')](_[_0xe65c('0xab')](_0x45b30d[_0xe65c('0x33')],_0x198b10[_0xe65c('0x39')]));_0x2dcb36[_0xe65c('0x40')][_0xe65c('0x9a')]=_0x3e2b58['id'];if(_0x45b30d[_0xe65c('0x33')][_0xe65c('0x6c')]){_0x2dcb36[_0xe65c('0x40')]=_['merge'](_0x2dcb36[_0xe65c('0x40')],{'$or':_[_0xe65c('0x28')](_0x2dcb36['attributes'],function(_0x5150ea){var _0x5df3fc={};_0x5df3fc[_0x5150ea]={'$like':'%'+_0x45b30d[_0xe65c('0x33')]['filter']+'%'};return _0x5df3fc;})});}if(_0x45b30d[_0xe65c('0x33')][_0xe65c('0x68')]){var _0x24f2b8=_0x45b30d[_0xe65c('0x33')][_0xe65c('0x68')][_0xe65c('0x2b')](',');var _0x5a3034={};_0x5a3034[_0x24f2b8[0x0]]={'$gte':moment(_0x24f2b8[0x1])['format'](_0xe65c('0xac'))};_0x2dcb36[_0xe65c('0x40')]=_[_0xe65c('0x8b')](_0x2dcb36['where'],_0x5a3034);}_0x2dcb36=_[_0xe65c('0x8b')]({},_0x2dcb36,_0x45b30d[_0xe65c('0xad')]);return db['OpenchannelMessage']['count']({'where':_0x2dcb36[_0xe65c('0x40')]})[_0xe65c('0x21')](function(_0x58275b){_0x1746b2[_0xe65c('0x19')]=_0x58275b;if(_0x45b30d[_0xe65c('0x33')]['includeAll']){_0x2dcb36[_0xe65c('0xa0')]=[{'all':!![]}];}return db[_0xe65c('0xa7')][_0xe65c('0xae')](_0x2dcb36);})[_0xe65c('0x21')](function(_0x4ee6f8){_0x1746b2['rows']=_0x4ee6f8;return _0x1746b2;});}})['then'](respondWithFilteredResult(_0x38c353,_0x2dcb36))[_0xe65c('0xa1')](handleError(_0x38c353,null));};exports['addTags']=function(_0x1539e4,_0x2d69d1,_0x213f13){return db[_0xe65c('0x2f')][_0xe65c('0xa8')]({'where':{'id':_0x1539e4['params']['id']}})[_0xe65c('0x21')](handleEntityNotFound(_0x2d69d1,null))['then'](function(_0x979b4e){if(_0x979b4e){return _0x979b4e[_0xe65c('0xaf')](_0x1539e4[_0xe65c('0xa4')]['ids'],_[_0xe65c('0xb0')](_0x1539e4[_0xe65c('0xa4')],[_0xe65c('0xa9'),'id'])||{})['spread'](function(){return db[_0xe65c('0xb1')][_0xe65c('0xae')]({'attributes':['id',_0xe65c('0x24'),'color'],'where':{'id':_0x1539e4[_0xe65c('0xa4')][_0xe65c('0xa9')]}});})[_0xe65c('0x21')](function(_0x1b184c){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x1539e4[_0xe65c('0x9d')]['id']),'tags':_0x1b184c||[]});return{'id':Number(_0x1539e4['params']['id']),'tags':_0x1b184c||[]};});}})[_0xe65c('0x21')](respondWithResult(_0x2d69d1,null))[_0xe65c('0xa1')](handleError(_0x2d69d1,null));};exports[_0xe65c('0xb2')]=function(_0x88f5de,_0x438918,_0x4d04db){return db['OpenchannelInteraction'][_0xe65c('0xa8')]({'where':{'id':_0x88f5de['params']['id']}})['then'](handleEntityNotFound(_0x438918,null))[_0xe65c('0x21')](function(_0x268df4){if(_0x268df4){return _0x268df4[_0xe65c('0xb2')](_0x88f5de['query'][_0xe65c('0xa9')]);}})[_0xe65c('0x21')](respondWithStatusCode(_0x438918,null))[_0xe65c('0xa1')](handleError(_0x438918,null));};exports[_0xe65c('0xb3')]=function(_0x97c923,_0xa75ac){var _0x8bcc8d=moment()[_0xe65c('0xb4')]()[_0xe65c('0x71')]();var _0x1288cd=path[_0xe65c('0x72')](config[_0xe65c('0xb5')],_0xe65c('0xb6'),'files',_0xe65c('0xb7'));var _0x2652ec=path[_0xe65c('0x72')](config[_0xe65c('0xb5')],'server',_0xe65c('0xb8'),_0xe65c('0xb9'));var _0x47df52=path[_0xe65c('0x72')](_0x1288cd,_0x8bcc8d);var _0x36b791=util[_0xe65c('0x50')](_0xe65c('0xba'),_0x97c923[_0xe65c('0x9d')]['id'],_0x8bcc8d);var _0x1e9d7d=path['join'](_0x1288cd,_0x36b791);var _0x5a4106=![];return db['OpenchannelInteraction'][_0xe65c('0xa8')]({'where':{'id':_0x97c923[_0xe65c('0x9d')]['id']},'include':[{'model':db[_0xe65c('0xa7')],'as':'Messages','attributes':['id','body',_0xe65c('0x67'),'direction',_0xe65c('0xbb')],'include':[{'model':db[_0xe65c('0xbc')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db[_0xe65c('0xbd')],'as':_0xe65c('0xbe'),'attributes':['id',_0xe65c('0xbf'),_0xe65c('0xc0')],'raw':!![]},{'model':db[_0xe65c('0xc1')],'as':'Attachment','raw':!![]}]},{'model':db[_0xe65c('0xc2')],'as':_0xe65c('0xc3'),'attributes':['id',_0xe65c('0x24')]},{'model':db[_0xe65c('0xbc')],'as':_0xe65c('0xc4'),'attributes':['id',_0xe65c('0xc5')]}]})[_0xe65c('0x21')](handleEntityNotFound(_0xa75ac,null))[_0xe65c('0x21')](function(_0x474497){if(_0x474497){var _0x14c09d=_0x474497[_0xe65c('0xc6')]({'plain':!![]});_0x5a4106=!![];var _0x116242={'format':'A4','border':_0xe65c('0xc7'),'header':{'height':_0xe65c('0xc8'),'contents':{'first':_0xe65c('0xc9')}},'footer':{'height':_0xe65c('0xca'),'contents':{'default':util[_0xe65c('0x50')](_0xe65c('0xcb'),util['format'](_0xe65c('0xcc'),_0xe65c('0xcd'),_0x14c09d['id']),moment()['format'](_0xe65c('0xce'))[_0xe65c('0x71')]())}}};fs[_0xe65c('0xcf')](_0x47df52);var _0x570a43={'channel':_0xe65c('0xcd'),'account':_0x14c09d[_0xe65c('0xc3')]['name'],'agent':_0x14c09d[_0xe65c('0xc4')]?_0x14c09d[_0xe65c('0xc4')][_0xe65c('0xc5')]:'N.A.','createdAt':moment(_0x14c09d[_0xe65c('0x67')])[_0xe65c('0x50')](_0xe65c('0xac'))[_0xe65c('0x71')](),'closedAt':_0x14c09d['closed']?moment(_0x14c09d[_0xe65c('0xd0')])['format'](_0xe65c('0xac'))[_0xe65c('0x71')]():'','disposition':_0x14c09d[_0xe65c('0xd1')],'visibility':_0x14c09d[_0xe65c('0xd2')]?_0xe65c('0xd3'):'Private','messages':_(_0x14c09d['Messages'])[_0xe65c('0x6c')]({'secret':![]})[_0xe65c('0x28')](function(_0x323130){if(_0x323130[_0xe65c('0xc1')]){var _0x5b9863=path[_0xe65c('0x72')](_0x2652ec,_0x323130[_0xe65c('0xc1')]['basename']);if(fs[_0xe65c('0xd4')](_0x5b9863)){fs['createReadStream'](_0x5b9863)[_0xe65c('0xd5')](fs[_0xe65c('0xd6')](path['join'](_0x47df52,_0x323130[_0xe65c('0xc1')][_0xe65c('0xd7')])));}}return{'date':moment(_0x323130[_0xe65c('0x67')])[_0xe65c('0x50')](_0xe65c('0xac'))[_0xe65c('0x71')](),'sender':_0x323130[_0xe65c('0xd8')]===_0xe65c('0xd9')?_0x323130[_0xe65c('0xbc')]?_0x323130[_0xe65c('0xbc')][_0xe65c('0xc5')]:_0xe65c('0xda'):_0x323130['Contact'][_0xe65c('0xbf')]+(_0x323130['Contact']['lastName']?'\x20'+_0x323130[_0xe65c('0xbe')][_0xe65c('0xc0')]:''),'body':_0x323130[_0xe65c('0xc1')]?_0x323130[_0xe65c('0xc1')][_0xe65c('0xd7')]:_0x323130[_0xe65c('0xa4')],'direction':_0x323130[_0xe65c('0xd8')]===_0xe65c('0xd9')?'A':'C','secret':_0x323130[_0xe65c('0xbb')],'attachment':_0x323130['Attachment']};})[_0xe65c('0x4e')]()};return ejs[_0xe65c('0xdb')](path[_0xe65c('0x72')](config[_0xe65c('0xb5')],_0xe65c('0xb6'),'views',_0xe65c('0xdc')),{'interaction':_0x570a43})[_0xe65c('0x21')](function(_0x268fff){return new BPromise(function(_0x59b8d1,_0x1ebefe){pdf[_0xe65c('0xa2')](_0x268fff,_0x116242)['toFile'](path[_0xe65c('0x72')](_0x47df52,_0xe65c('0xdd')+_0x14c09d['id']+'-'+_0x8bcc8d+_0xe65c('0xde')),function(_0x1deec1,_0x537bac){if(_0x1deec1)return _0x1ebefe(_0x1deec1);_0x59b8d1(_0x537bac);});});});}})['then'](function(){if(_0x5a4106){return new BPromise(function(_0x3dda4c,_0x2d444f){zipdir(_0x47df52,{'saveTo':_0x1e9d7d},function(_0x2f72be,_0xf1d0b9){if(_0x2f72be)return _0x2d444f(_0x2f72be);return _0x3dda4c(_0xf1d0b9);});})[_0xe65c('0x21')](function(){return new BPromise(function(_0x5b944f,_0x8eea04){rimraf(_0x47df52,function(_0x5b0518){if(_0x5b0518)_0x8eea04(_0x5b0518);return _0x5b944f();});});})[_0xe65c('0x21')](function(){return _0xa75ac[_0xe65c('0xb3')](_0x1e9d7d,_0x36b791,function(_0x3e5065){if(_0x3e5065){console[_0xe65c('0xdf')]('err',_0x3e5065);}else{fs[_0xe65c('0xe0')](_0x1e9d7d);}});});}else{return _0xa75ac['sendStatus'](0xc8);}})[_0xe65c('0xa1')](handleError(_0xa75ac,null));}; \ No newline at end of file +var _0x4091=['spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','join','Messages','direction','secret','User','Contact','firstName','lastName','Attachment','OpenchannelAccount','Account','Owner','fullname','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','closed','closedAt','disposition','Private','basename','createReadStream','pipe','createWriteStream','out','System','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','json','count','offset','limit','apply','update','destroy','then','sendStatus','error','stack','name','unreadMessages','OpenchannelMessage','Users','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','select','field','color','COUNT(*)','from','where','me.OpenchannelInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','expr','advancedFilter','parse','createdAt','value','dateStart','day','utc','endOf','format','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','condition','TagId','Messages.count','isArray','\x20IN\x20?','tableAlias','\x20=\x20?','LIKE','ContactId','c.firstName','c.lastName','\x20LIKE\x20?','c.email','\x20>\x20?','map','filter','isNil','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','$gte','$lte','null','replace','\x27\x27\x27\x27','isNumeric','toString','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','i.id','QueryTypes','SELECT','clone','read','having','%s\x20>\x200','`Messages.count`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','%s\x20=\x200','sequelize','keyBy','merge','a.key','Account.key','i.*','Contact.firstName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','params','rawAttributes','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','sort','OpenchannelInteractionId','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4091,0x1f2));var _0x1409=function(_0x1c648e,_0x5446fc){_0x1c648e=_0x1c648e-0x0;var _0x30608f=_0x4091[_0x1c648e];return _0x30608f;};'use strict';var pdf=require(_0x1409('0x0'));var emlformat=require(_0x1409('0x1'));var rimraf=require(_0x1409('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1409('0x3'));var rp=require(_0x1409('0x4'));var moment=require(_0x1409('0x5'));var BPromise=require(_0x1409('0x6'));var Mustache=require(_0x1409('0x7'));var util=require(_0x1409('0x8'));var path=require('path');var sox=require(_0x1409('0x9'));var csv=require(_0x1409('0xa'));var ejs=require(_0x1409('0xb'));var fs=require('fs');var _=require(_0x1409('0xc'));var squel=require(_0x1409('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1409('0xe'));var toCsv=require(_0x1409('0xa'));var querystring=require(_0x1409('0xf'));var Papa=require(_0x1409('0x10'));var Redis=require(_0x1409('0x11'));var authService=require(_0x1409('0x12'));var qs=require(_0x1409('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1409('0x14'))(_0x1409('0x15'));var utils=require('../../config/utils');var config=require(_0x1409('0x16'));var db=require(_0x1409('0x17'))['db'];config[_0x1409('0x18')]=_[_0x1409('0x19')](config['redis'],{'host':_0x1409('0x1a'),'port':0x18eb});var socket=require(_0x1409('0x1b'))(new Redis(config[_0x1409('0x18')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x324c99,_0xe340ff){_0xe340ff=_0xe340ff||0xcc;return function(_0x1f4378){if(_0x1f4378){return _0x324c99['sendStatus'](_0xe340ff);}return _0x324c99['status'](_0xe340ff)[_0x1409('0x1c')]();};}function respondWithResult(_0x244f7c,_0x372f20){_0x372f20=_0x372f20||0xc8;return function(_0xb14665){if(_0xb14665){return _0x244f7c[_0x1409('0x1d')](_0x372f20)[_0x1409('0x1e')](_0xb14665);}};}function respondWithFilteredResult(_0x2b9c61,_0x1f41d7){return function(_0x200193){if(_0x200193){var _0x4a6a43=_0x200193[_0x1409('0x1f')],_0x52200c=_0x1f41d7[_0x1409('0x20')],_0x467693=_0x1f41d7[_0x1409('0x20')]+_0x1f41d7[_0x1409('0x21')],_0x325008;if(_0x467693>=_0x4a6a43){_0x467693=_0x4a6a43;_0x325008=0xc8;}else{_0x325008=0xce;}_0x2b9c61[_0x1409('0x1d')](_0x325008);return _0x2b9c61['set']('Content-Range',_0x52200c+'-'+_0x467693+'/'+_0x4a6a43)[_0x1409('0x1e')](_0x200193);}return null;};}function patchUpdates(_0x5342be){return function(_0x450762){try{jsonpatch[_0x1409('0x22')](_0x450762,_0x5342be,!![]);}catch(_0x462482){return BPromise['reject'](_0x462482);}return _0x450762['save']();};}function saveUpdates(_0x76a139,_0xea3cd){return function(_0x58585e){if(_0x58585e){return _0x58585e[_0x1409('0x23')](_0x76a139)['then'](function(_0x19c320){return _0x19c320;});}return null;};}function removeEntity(_0x578503,_0x348ec3){return function(_0xc848de){if(_0xc848de){return _0xc848de[_0x1409('0x24')]()[_0x1409('0x25')](function(){_0x578503[_0x1409('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38209c,_0x58e110){return function(_0x27292c){if(!_0x27292c){_0x38209c[_0x1409('0x26')](0x194);}return _0x27292c;};}function handleError(_0x404732,_0xbcd9eb){_0xbcd9eb=_0xbcd9eb||0x1f4;return function(_0x86143b){logger[_0x1409('0x27')](_0x86143b[_0x1409('0x28')]);if(_0x86143b['name']){delete _0x86143b[_0x1409('0x29')];}_0x404732[_0x1409('0x1d')](_0xbcd9eb)['send'](_0x86143b);};}function getInteractionUnreadMessages(_0x1c7f60){return new BPromise(function(_0x5e12a6,_0x18500e){try{if(_0x1c7f60['closed']){_0x1c7f60[_0x1409('0x2a')]=0x0;_0x5e12a6(_0x1c7f60);}else{return db[_0x1409('0x2b')][_0x1409('0x1f')]({'where':{'OpenchannelInteractionId':_0x1c7f60['id'],'direction':'in','read':![]}})[_0x1409('0x25')](function(_0xe2a79b){_0x1c7f60[_0x1409('0x2a')]=_0xe2a79b;_0x5e12a6(_0x1c7f60);});}}catch(_0x5531d5){_0x18500e(_0x5531d5);}});}function getInteractionUsers(_0x51fda2,_0x2f9646){return new BPromise(function(_0x46d9b6,_0x21ee48){try{if(_0x2f9646[_0x51fda2['id']]){_0x51fda2[_0x1409('0x2c')]=_['map'](_0x2f9646[_0x51fda2['id']],function(_0x1f0310){return{'id':_0x1f0310['id']};});}}catch(_0x5ffee0){_0x21ee48(_0x5ffee0);}_0x46d9b6(_0x51fda2);});}function getInteractionTags(_0x9a4112,_0x292797){return new BPromise(function(_0x1f09f9,_0x54f99e){try{if(_0x9a4112[_0x1409('0x2d')]){_0x9a4112[_0x1409('0x2e')]=[];_0x9a4112[_0x1409('0x2d')][_0x1409('0x2f')](',')[_0x1409('0x30')](function(_0x1dcc7e){_0x9a4112[_0x1409('0x2e')][_0x1409('0x31')](_0x292797[_0x1dcc7e]);});}delete _0x9a4112[_0x1409('0x2d')];}catch(_0x2a607){_0x54f99e(_0x2a607);}_0x1f09f9(_0x9a4112);});}function updateOpenchannelInteraction(_0x3acb3c,_0x29f222,_0x9954a3){return new BPromise(function(_0x6e0105,_0x11206c){return getInteractionUnreadMessages(_0x3acb3c)['then'](function(_0x55ae3c){return getInteractionUsers(_0x55ae3c,_0x9954a3);})[_0x1409('0x25')](function(_0x4b0962){return getInteractionTags(_0x4b0962,_0x29f222);})[_0x1409('0x25')](function(_0x3a0462){_0x6e0105(_0x3a0462);})[_0x1409('0x32')](function(_0x2c5ce3){_0x11206c(_0x2c5ce3);});});}exports[_0x1409('0x33')]=function(_0x5c4dbd,_0xe9cd79){var _0x39b96b={},_0x13cf1c={},_0x820394={'count':0x0,'rows':[]};var _0x2d3354=db[_0x1409('0x34')]['rawAttributes'];_0x13cf1c[_0x1409('0x35')]=_[_0x1409('0x36')](_0x2d3354);_0x13cf1c['query']=_[_0x1409('0x36')](_0x5c4dbd[_0x1409('0x37')]);_0x13cf1c[_0x1409('0x38')]=_[_0x1409('0x39')](_0x13cf1c['model'],_0x13cf1c[_0x1409('0x37')]);_0x39b96b[_0x1409('0x3a')]=_[_0x1409('0x39')](_0x13cf1c[_0x1409('0x35')],qs[_0x1409('0x3b')](_0x5c4dbd['query'][_0x1409('0x3b')]));_0x39b96b[_0x1409('0x3a')]=_0x39b96b['attributes'][_0x1409('0x3c')]?_0x39b96b[_0x1409('0x3a')]:_0x13cf1c[_0x1409('0x35')];if(!_0x5c4dbd[_0x1409('0x37')][_0x1409('0x3d')]('nolimit')){_0x39b96b[_0x1409('0x21')]=qs[_0x1409('0x21')](_0x5c4dbd['query'][_0x1409('0x21')]);_0x39b96b[_0x1409('0x20')]=qs[_0x1409('0x20')](_0x5c4dbd[_0x1409('0x37')][_0x1409('0x20')]);}_0x39b96b[_0x1409('0x3e')]=qs['sort'](_0x5c4dbd[_0x1409('0x37')]['sort']);_0x39b96b['where']=qs[_0x1409('0x38')](_[_0x1409('0x3f')](_0x5c4dbd['query'],_0x13cf1c[_0x1409('0x38')]));var _0x1a4972=[];var _0x4c85fb=squel[_0x1409('0x40')]()[_0x1409('0x41')]('id')[_0x1409('0x41')](_0x1409('0x29'))[_0x1409('0x41')](_0x1409('0x42'))['from']('tools_tags');var _0x55ca44=squel[_0x1409('0x40')]()[_0x1409('0x41')](_0x1409('0x43'))[_0x1409('0x44')]('openchannel_messages','me')[_0x1409('0x45')](_0x1409('0x46'))[_0x1409('0x45')](_0x1409('0x47'))[_0x1409('0x45')](_0x1409('0x48'));var _0x5d4659=squel[_0x1409('0x40')]()[_0x1409('0x41')](_0x1409('0x49'))[_0x1409('0x41')]('ui.OpenchannelInteractionId')[_0x1409('0x44')](_0x1409('0x4a'),'ui')[_0x1409('0x4b')]('users','u',_0x1409('0x4c'));var _0x44dc09=squel[_0x1409('0x40')]()[_0x1409('0x44')](_0x1409('0x4d'),'i')[_0x1409('0x4b')]('cm_contacts','c',_0x1409('0x4e'))['left_join'](_0x1409('0x4f'),'o',_0x1409('0x50'))[_0x1409('0x4b')](_0x1409('0x51'),'a',_0x1409('0x52'))['left_join'](_0x1409('0x53'),'me',_0x1409('0x46'));var _0x4ceb0c=squel[_0x1409('0x54')]();if(_0x5c4dbd['query'][_0x1409('0x55')]){var _0x333c48=JSON[_0x1409('0x56')](_0x5c4dbd['query'][_0x1409('0x55')]);_[_0x1409('0x36')](_0x333c48)[_0x1409('0x30')](function(_0x28b9a5){var _0x31fea0=_0x333c48[_0x28b9a5];if(_0x28b9a5===_0x1409('0x57')){var _0x3c04df=moment(_0x31fea0[_0x1409('0x58')][_0x1409('0x59')])['startOf'](_0x1409('0x5a'))[_0x1409('0x5b')]()['format']();var _0x90df97=moment(_0x90df97)[_0x1409('0x5b')]()[_0x1409('0x5c')](_0x1409('0x5a'))[_0x1409('0x5d')]();_0x4ceb0c[_0x1409('0x5e')](_0x1409('0x5f'),_0x3c04df,_0x90df97);}else{if(_['isArray'](_0x31fea0['condition'])){_0x31fea0[_0x1409('0x60')][_0x1409('0x30')](function(_0x35f9d1){switch(_0x31fea0[_0x1409('0x60')][_0x1409('0x58')]){case'IS':if(_0x28b9a5!==_0x1409('0x61')&&_0x28b9a5!==_0x1409('0x62')){if(_[_0x1409('0x63')](_0x31fea0['value'])&&_0x31fea0[_0x1409('0x58')][_0x1409('0x3c')]>0x1){_0x4ceb0c[_0x1409('0x5e')](_0x31fea0['tableAlias']+'.'+_0x28b9a5+_0x1409('0x64'),_0x31fea0['value']);}else{_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+_0x1409('0x66'),_0x31fea0[_0x1409('0x58')][0x0]);}}break;case'=':_0x4ceb0c[_0x1409('0x5e')](_0x31fea0['tableAlias']+'.'+_0x28b9a5+_0x1409('0x66'),_0x31fea0[_0x1409('0x58')]);break;case _0x1409('0x67'):if(_0x28b9a5===_0x1409('0x68')){_0x4ceb0c[_0x1409('0x5e')](_0x1409('0x69')+'\x20LIKE\x20?','%'+_0x31fea0[_0x1409('0x58')]+'%');_0x4ceb0c['or'](_0x1409('0x6a')+_0x1409('0x6b'),'%'+_0x31fea0[_0x1409('0x58')]+'%');_0x4ceb0c['or'](_0x1409('0x6c')+'\x20LIKE\x20?','%'+_0x31fea0[_0x1409('0x58')]+'%');}else{_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+_0x1409('0x6b'),'%'+_0x31fea0[_0x1409('0x58')]+'%');}break;case'>':_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+'\x20>\x20?',_0x31fea0[_0x1409('0x58')]);break;case'<':_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+'\x20<\x20?',_0x31fea0['value']);break;}});}else{switch(_0x31fea0['condition']['value']){case'IS':if(_0x28b9a5!==_0x1409('0x61')&&_0x28b9a5!==_0x1409('0x62')){if(_[_0x1409('0x63')](_0x31fea0[_0x1409('0x58')])&&_0x31fea0['value'][_0x1409('0x3c')]>0x1){_0x4ceb0c['and'](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+_0x1409('0x64'),_0x31fea0['value']);}else{_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+'\x20=\x20?',_0x31fea0[_0x1409('0x58')][0x0]);}}break;case'=':_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+_0x1409('0x66'),_0x31fea0['value']);break;case _0x1409('0x67'):if(_0x28b9a5===_0x1409('0x68')){_0x4ceb0c['and'](_0x1409('0x69')+_0x1409('0x6b'),'%'+_0x31fea0[_0x1409('0x58')]+'%');_0x4ceb0c['or'](_0x1409('0x6a')+_0x1409('0x6b'),'%'+_0x31fea0[_0x1409('0x58')]+'%');_0x4ceb0c['or'](_0x1409('0x6c')+'\x20LIKE\x20?','%'+_0x31fea0[_0x1409('0x58')]+'%');}else{_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+_0x1409('0x6b'),'%'+_0x31fea0[_0x1409('0x58')]+'%');}break;case'>':_0x4ceb0c[_0x1409('0x5e')](_0x31fea0['tableAlias']+'.'+_0x28b9a5+_0x1409('0x6d'),_0x31fea0[_0x1409('0x58')]);break;case'<':_0x4ceb0c[_0x1409('0x5e')](_0x31fea0[_0x1409('0x65')]+'.'+_0x28b9a5+'\x20<\x20?',_0x31fea0[_0x1409('0x58')]);break;}}}});}else{var _0x312db5=_(Object['keys'](_0x5c4dbd[_0x1409('0x37')]))[_0x1409('0x6e')](function(_0x2836fc){return _0x2d3354[_0x1409('0x3d')](_0x2836fc)?_0x2836fc:undefined;})[_0x1409('0x6f')](function(_0x4d4c19){return!_[_0x1409('0x70')](_0x4d4c19);})['value']();if(!_[_0x1409('0x71')](_0x312db5)){_0x312db5[_0x1409('0x30')](function(_0x273420){if(_0x273420===_0x1409('0x72')){_0x44dc09[_0x1409('0x45')](_0x1409('0x73'),[]['concat'](_0x5c4dbd[_0x1409('0x37')][_0x273420]));}else if(_0x273420===_0x1409('0x57')){var _0x4e926=JSON[_0x1409('0x56')](_0x5c4dbd['query'][_0x273420])[_0x1409('0x74')];var _0x2b0c45=JSON[_0x1409('0x56')](_0x5c4dbd[_0x1409('0x37')][_0x273420])[_0x1409('0x75')];_0x44dc09[_0x1409('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e926,_0x2b0c45);}else{if(_0x5c4dbd[_0x1409('0x37')][_0x273420]===_0x1409('0x76')){_0x44dc09['where']('i.'+_0x273420+'\x20IS\x20NULL');}else{_0x44dc09[_0x1409('0x45')]('i.'+_0x273420+'\x20=\x20?',_0x5c4dbd['query'][_0x273420]);}}});}if(_0x5c4dbd[_0x1409('0x37')][_0x1409('0x6f')]){var _0x3277c8=_0x5c4dbd[_0x1409('0x37')][_0x1409('0x6f')][_0x1409('0x77')]('\x5c','\x5c\x5c')[_0x1409('0x77')]('\x27\x27',_0x1409('0x78'));if(qs[_0x1409('0x79')](_0x3277c8)){_0x4ceb0c['or']('i.id\x20LIKE\x20?',_0x3277c8+'%');}else{var _0x3c5b5e=[];_0x3277c8[_0x1409('0x2f')]('\x20')[_0x1409('0x30')](function(_0x41d5d3){_0x3c5b5e['push']('+'+_0x41d5d3[_0x1409('0x7a')]());});var _0x54879b=_0x3c5b5e['join']('\x20');_0x4ceb0c['or'](_0x1409('0x7b'),_0x54879b)['or'](_0x1409('0x7c'),_0x3277c8+'%')['or'](_0x1409('0x7d'),_0x3277c8+'%');}}}_0x44dc09[_0x1409('0x45')](_0x4ceb0c);if(_0x39b96b[_0x1409('0x3e')]){_0x39b96b[_0x1409('0x3e')][_0x1409('0x30')](function(_0x510eff){_0x44dc09[_0x1409('0x3e')]('i.'+_0x510eff[0x0],_0x510eff[0x1]===_0x1409('0x7e')?![]:!![]);});}_0x44dc09['group'](_0x1409('0x7f'));var _0x1dbfb3={'type':db['Sequelize'][_0x1409('0x80')][_0x1409('0x81')],'raw':!![]};var _0x28aa7b=_0x44dc09[_0x1409('0x82')]()[_0x1409('0x41')]('COUNT(*)');if(!_0x5c4dbd[_0x1409('0x37')][_0x1409('0x55')]){if(_0x5c4dbd[_0x1409('0x37')][_0x1409('0x83')]){if(_0x5c4dbd['query'][_0x1409('0x83')]==0x1){_0x28aa7b[_0x1409('0x45')](util['format']('%s\x20=\x200',_0x55ca44['toString']()));_0x44dc09[_0x1409('0x84')]('`Messages.count`\x20=\x200');}else{_0x28aa7b[_0x1409('0x45')](util[_0x1409('0x5d')](_0x1409('0x85'),_0x55ca44[_0x1409('0x7a')]()));_0x44dc09['having'](_0x1409('0x86'));}}if(_0x5c4dbd[_0x1409('0x37')][_0x1409('0x87')]){var _0x32cd6d=_[_0x1409('0x63')](_0x5c4dbd[_0x1409('0x37')][_0x1409('0x87')])?_0x5c4dbd[_0x1409('0x37')][_0x1409('0x87')]:new Array(_0x5c4dbd[_0x1409('0x37')][_0x1409('0x87')]);var _0x515142=squel[_0x1409('0x54')]();_0x32cd6d[_0x1409('0x30')](function(_0x2ee0fe){_0x515142['or'](_0x1409('0x88'),'%,'+_0x2ee0fe+',%');});_0x44dc09['having'](_0x515142);_0x28aa7b['left_join'](_0x1409('0x89'),'it',_0x1409('0x8a'));_0x28aa7b[_0x1409('0x4b')](_0x1409('0x8b'),'t','t.id\x20=\x20it.TagId');_0x28aa7b[_0x1409('0x45')]('t.id\x20IN\x20?',_0x32cd6d);}}else{var _0x333c48=JSON[_0x1409('0x56')](_0x5c4dbd[_0x1409('0x37')][_0x1409('0x55')]);_[_0x1409('0x36')](_0x333c48)[_0x1409('0x30')](function(_0x44905c){var _0x471597=_0x333c48[_0x44905c];if(_0x44905c==='TagId'){var _0x29b564=_0x471597['value'];var _0x93fb04=squel[_0x1409('0x54')]();_0x29b564[_0x1409('0x30')](function(_0x27a23b){_0x93fb04['or'](_0x1409('0x88'),'%,'+_0x27a23b+',%');});_0x44dc09[_0x1409('0x84')](_0x93fb04);_0x28aa7b[_0x1409('0x4b')]('mail_interaction_has_tags','it',_0x1409('0x8c'));_0x28aa7b[_0x1409('0x4b')]('tools_tags','t',_0x1409('0x8d'));_0x28aa7b[_0x1409('0x45')](_0x1409('0x8e'),_0x29b564);}else if(_0x44905c===_0x1409('0x62')){if(_0x471597[_0x1409('0x58')]['length']===0x1){if(_0x471597[_0x1409('0x58')][0x0]===0x1){_0x28aa7b['where'](util['format'](_0x1409('0x8f'),_0x55ca44[_0x1409('0x7a')]()));_0x44dc09[_0x1409('0x84')]('`Messages.count`\x20=\x200');}else{_0x28aa7b['where'](util[_0x1409('0x5d')]('%s\x20>\x200',_0x55ca44[_0x1409('0x7a')]()));_0x44dc09['having']('`Messages.count`\x20>\x200');}}}});}db[_0x1409('0x90')]['query'](_0x28aa7b[_0x1409('0x7a')](),_0x1dbfb3)['then'](function(_0x57652a){_0x820394[_0x1409('0x1f')]=_0x57652a[_0x1409('0x3c')];if(_0x820394[_0x1409('0x1f')]===0x0)return[];return db[_0x1409('0x90')][_0x1409('0x37')](_0x4c85fb[_0x1409('0x7a')](),_0x1dbfb3)[_0x1409('0x25')](function(_0x473845){_0x1a4972=_[_0x1409('0x91')](_0x473845,'id');_0x1dbfb3=_[_0x1409('0x92')](_0x1dbfb3,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});_0x44dc09['field'](_0x1409('0x93'),_0x1409('0x94'));_0x44dc09[_0x1409('0x41')](_0x1409('0x95'));_0x44dc09[_0x1409('0x41')](_0x1409('0x69'),_0x1409('0x96'));_0x44dc09[_0x1409('0x41')]('c.lastName',_0x1409('0x97'));_0x44dc09[_0x1409('0x41')](_0x1409('0x6c'),'Contact.email');_0x44dc09[_0x1409('0x41')](_0x1409('0x98'),_0x1409('0x99'));_0x44dc09[_0x1409('0x41')]('c.mobile',_0x1409('0x9a'));_0x44dc09[_0x1409('0x41')](_0x1409('0x9b'),_0x1409('0x9c'));_0x44dc09[_0x1409('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1409('0x2d'));_0x44dc09[_0x1409('0x4b')]('openchannel_interaction_has_tags','it',_0x1409('0x8a'));_0x44dc09[_0x1409('0x4b')](_0x1409('0x8b'),'t',_0x1409('0x8d'));_0x44dc09[_0x1409('0x21')](_0x39b96b[_0x1409('0x21')]);_0x44dc09[_0x1409('0x20')](_0x39b96b[_0x1409('0x20')]);return db[_0x1409('0x90')][_0x1409('0x37')](_0x44dc09[_0x1409('0x7a')](),_0x1dbfb3);})[_0x1409('0x25')](function(_0x5b1592){_0x5d4659[_0x1409('0x45')](_0x1409('0x9d'),_['map'](_0x5b1592,'id'));return db['sequelize'][_0x1409('0x37')](_0x5d4659[_0x1409('0x7a')](),_0x1dbfb3)[_0x1409('0x25')](function(_0x334759){var _0x4887d5=_[_0x1409('0x9e')](_0x334759,'OpenchannelInteractionId');var _0x20f2b2=[];_0x5b1592[_0x1409('0x30')](function(_0x305a36){_0x20f2b2[_0x1409('0x31')](updateOpenchannelInteraction(_0x305a36,_0x1a4972,_0x4887d5));});return BPromise[_0x1409('0x9f')](_0x20f2b2);});});})[_0x1409('0x25')](function(_0x59e080){_0x820394['rows']=_0x59e080;return _0x820394;})[_0x1409('0x25')](respondWithFilteredResult(_0xe9cd79,_0x39b96b))['catch'](handleError(_0xe9cd79,null));};exports['show']=function(_0x22858f,_0x9079cd){var _0x23ae60={'raw':![],'where':{'id':_0x22858f[_0x1409('0xa0')]['id']}},_0x8651f9={};_0x8651f9[_0x1409('0x35')]=_[_0x1409('0x36')](db[_0x1409('0x34')][_0x1409('0xa1')]);_0x8651f9[_0x1409('0x37')]=_['keys'](_0x22858f['query']);_0x8651f9['filters']=_['intersection'](_0x8651f9['model'],_0x8651f9[_0x1409('0x37')]);_0x23ae60[_0x1409('0x3a')]=_[_0x1409('0x39')](_0x8651f9['model'],qs['fields'](_0x22858f[_0x1409('0x37')][_0x1409('0x3b')]));_0x23ae60[_0x1409('0x3a')]=_0x23ae60[_0x1409('0x3a')][_0x1409('0x3c')]?_0x23ae60[_0x1409('0x3a')]:_0x8651f9[_0x1409('0x35')];if(_0x22858f[_0x1409('0x37')][_0x1409('0xa2')]){_0x23ae60[_0x1409('0xa3')]=[{'all':!![]}];}_0x23ae60=_[_0x1409('0x92')]({},_0x23ae60,_0x22858f[_0x1409('0xa4')]);return db[_0x1409('0x34')][_0x1409('0xa5')](_0x23ae60)[_0x1409('0x25')](handleEntityNotFound(_0x9079cd,null))['then'](respondWithResult(_0x9079cd,null))['catch'](handleError(_0x9079cd,null));};exports[_0x1409('0xa6')]=function(_0xf4ae70,_0x3b379e){return db['OpenchannelInteraction'][_0x1409('0xa6')](_0xf4ae70['body'],{})[_0x1409('0x25')](respondWithResult(_0x3b379e,0xc9))[_0x1409('0x32')](handleError(_0x3b379e,null));};exports[_0x1409('0x23')]=function(_0x5a5c18,_0x2613f0){if(_0x5a5c18['body']['id']){delete _0x5a5c18[_0x1409('0xa7')]['id'];}return db[_0x1409('0x34')][_0x1409('0xa5')]({'where':{'id':_0x5a5c18[_0x1409('0xa0')]['id']}})['then'](handleEntityNotFound(_0x2613f0,null))[_0x1409('0x25')](saveUpdates(_0x5a5c18[_0x1409('0xa7')],null))[_0x1409('0x25')](respondWithResult(_0x2613f0,null))[_0x1409('0x32')](handleError(_0x2613f0,null));};exports['destroy']=function(_0x58b938,_0x27c209){return db['OpenchannelInteraction']['find']({'where':{'id':_0x58b938[_0x1409('0xa0')]['id']}})[_0x1409('0x25')](handleEntityNotFound(_0x27c209,null))['then'](removeEntity(_0x27c209,null))['catch'](handleError(_0x27c209,null));};exports['describe']=function(_0x583604,_0x2593c1){return db[_0x1409('0x34')][_0x1409('0xa8')]()['then'](respondWithResult(_0x2593c1,null))[_0x1409('0x32')](handleError(_0x2593c1,null));};exports['addMessage']=function(_0x3f57ab,_0x169668,_0x5f3f60){return db['OpenchannelMessage'][_0x1409('0xa5')]({'where':{'id':_0x3f57ab[_0x1409('0xa0')]['id']}})[_0x1409('0x25')](handleEntityNotFound(_0x169668,null))[_0x1409('0x25')](function(_0x2a93ea){if(_0x2a93ea){return _0x2a93ea[_0x1409('0xa9')](_0x3f57ab['body'][_0x1409('0xaa')],_[_0x1409('0xab')](_0x3f57ab['body'],['ids','id'])||{});}})[_0x1409('0x25')](respondWithResult(_0x169668,null))[_0x1409('0x32')](handleError(_0x169668,null));};exports[_0x1409('0xac')]=function(_0x308583,_0x446d7b,_0x49a5b3){var _0x5b89e8={'raw':![],'where':{}};var _0x2e5830={};var _0x1521a1={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x1409('0xad')]({'where':{'id':_0x308583['params']['id']}})[_0x1409('0x25')](handleEntityNotFound(_0x446d7b,null))[_0x1409('0x25')](function(_0x5b7b43){if(_0x5b7b43){_0x2e5830[_0x1409('0x35')]=_[_0x1409('0x36')](db[_0x1409('0x2b')][_0x1409('0xa1')]);_0x2e5830[_0x1409('0x37')]=_[_0x1409('0x36')](_0x308583['query']);_0x2e5830[_0x1409('0x38')]=_['intersection'](_0x2e5830[_0x1409('0x35')],_0x2e5830['query']);_0x5b89e8[_0x1409('0x3a')]=_[_0x1409('0x39')](_0x2e5830[_0x1409('0x35')],qs[_0x1409('0x3b')](_0x308583[_0x1409('0x37')]['fields']));_0x5b89e8[_0x1409('0x3a')]=_0x5b89e8[_0x1409('0x3a')]['length']?_0x5b89e8[_0x1409('0x3a')]:_0x2e5830['model'];if(!_0x308583[_0x1409('0x37')]['hasOwnProperty']('nolimit')){_0x5b89e8[_0x1409('0x21')]=qs[_0x1409('0x21')](_0x308583[_0x1409('0x37')][_0x1409('0x21')]);_0x5b89e8['offset']=qs[_0x1409('0x20')](_0x308583[_0x1409('0x37')]['offset']);}_0x5b89e8['order']=qs[_0x1409('0xae')](_0x308583[_0x1409('0x37')]['sort']);_0x5b89e8[_0x1409('0x45')]=qs['filters'](_['pick'](_0x308583[_0x1409('0x37')],_0x2e5830[_0x1409('0x38')]));_0x5b89e8[_0x1409('0x45')][_0x1409('0xaf')]=_0x5b7b43['id'];if(_0x308583[_0x1409('0x37')][_0x1409('0x6f')]){_0x5b89e8['where']=_['merge'](_0x5b89e8[_0x1409('0x45')],{'$or':_[_0x1409('0x6e')](_0x5b89e8[_0x1409('0x3a')],function(_0x391679){var _0x3928a6={};_0x3928a6[_0x391679]={'$like':'%'+_0x308583[_0x1409('0x37')][_0x1409('0x6f')]+'%'};return _0x3928a6;})});}if(_0x308583[_0x1409('0x37')][_0x1409('0x74')]){var _0x572358=_0x308583['query'][_0x1409('0x74')][_0x1409('0x2f')](',');var _0x59569c={};_0x59569c[_0x572358[0x0]]={'$gte':moment(_0x572358[0x1])['format'](_0x1409('0xb0'))};_0x5b89e8[_0x1409('0x45')]=_[_0x1409('0x92')](_0x5b89e8[_0x1409('0x45')],_0x59569c);}_0x5b89e8=_[_0x1409('0x92')]({},_0x5b89e8,_0x308583['options']);return db[_0x1409('0x2b')][_0x1409('0x1f')]({'where':_0x5b89e8[_0x1409('0x45')]})[_0x1409('0x25')](function(_0x325400){_0x1521a1[_0x1409('0x1f')]=_0x325400;if(_0x308583[_0x1409('0x37')]['includeAll']){_0x5b89e8[_0x1409('0xa3')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x5b89e8);})[_0x1409('0x25')](function(_0x575e36){_0x1521a1[_0x1409('0xb1')]=_0x575e36;return _0x1521a1;});}})['then'](respondWithFilteredResult(_0x446d7b,_0x5b89e8))['catch'](handleError(_0x446d7b,null));};exports[_0x1409('0xb2')]=function(_0x4d3106,_0x5f0213,_0xe48cb9){return db[_0x1409('0x34')]['find']({'where':{'id':_0x4d3106['params']['id']}})[_0x1409('0x25')](handleEntityNotFound(_0x5f0213,null))[_0x1409('0x25')](function(_0x2e403d){if(_0x2e403d){return _0x2e403d[_0x1409('0xb3')](_0x4d3106[_0x1409('0xa7')][_0x1409('0xaa')],_['omit'](_0x4d3106[_0x1409('0xa7')],[_0x1409('0xaa'),'id'])||{})[_0x1409('0xb4')](function(){return db[_0x1409('0xb5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4d3106[_0x1409('0xa7')]['ids']}});})[_0x1409('0x25')](function(_0x1ee044){socket[_0x1409('0xb6')](_0x1409('0xb7'),{'id':Number(_0x4d3106[_0x1409('0xa0')]['id']),'tags':_0x1ee044||[]});return{'id':Number(_0x4d3106[_0x1409('0xa0')]['id']),'tags':_0x1ee044||[]};});}})[_0x1409('0x25')](respondWithResult(_0x5f0213,null))[_0x1409('0x32')](handleError(_0x5f0213,null));};exports['removeTags']=function(_0x3651a7,_0x2b6a6f,_0x36aa0f){return db[_0x1409('0x34')][_0x1409('0xa5')]({'where':{'id':_0x3651a7[_0x1409('0xa0')]['id']}})[_0x1409('0x25')](handleEntityNotFound(_0x2b6a6f,null))[_0x1409('0x25')](function(_0x21fa7b){if(_0x21fa7b){return _0x21fa7b[_0x1409('0xb8')](_0x3651a7[_0x1409('0x37')][_0x1409('0xaa')]);}})[_0x1409('0x25')](respondWithStatusCode(_0x2b6a6f,null))[_0x1409('0x32')](handleError(_0x2b6a6f,null));};exports[_0x1409('0xb9')]=function(_0x2c6959,_0x1ec9bb){var _0x48c10e=moment()[_0x1409('0xba')]()['toString']();var _0x1e4a52=path['join'](config[_0x1409('0xbb')],_0x1409('0xbc'),_0x1409('0xbd'),'tmp');var _0x1493d2=path[_0x1409('0xbe')](config[_0x1409('0xbb')],'server','files','attachments');var _0x56d0bb=path[_0x1409('0xbe')](_0x1e4a52,_0x48c10e);var _0x437e9e=util[_0x1409('0x5d')]('transcript-%d-%s.zip',_0x2c6959[_0x1409('0xa0')]['id'],_0x48c10e);var _0x14eb61=path[_0x1409('0xbe')](_0x1e4a52,_0x437e9e);var _0x15129f=![];return db[_0x1409('0x34')][_0x1409('0xa5')]({'where':{'id':_0x2c6959['params']['id']},'include':[{'model':db['OpenchannelMessage'],'as':_0x1409('0xbf'),'attributes':['id',_0x1409('0xa7'),_0x1409('0x57'),_0x1409('0xc0'),_0x1409('0xc1')],'include':[{'model':db[_0x1409('0xc2')],'as':'User','attributes':['id','fullname'],'raw':!![]},{'model':db['CmContact'],'as':_0x1409('0xc3'),'attributes':['id',_0x1409('0xc4'),_0x1409('0xc5')],'raw':!![]},{'model':db[_0x1409('0xc6')],'as':_0x1409('0xc6'),'raw':!![]}]},{'model':db[_0x1409('0xc7')],'as':_0x1409('0xc8'),'attributes':['id',_0x1409('0x29')]},{'model':db[_0x1409('0xc2')],'as':_0x1409('0xc9'),'attributes':['id',_0x1409('0xca')]}]})[_0x1409('0x25')](handleEntityNotFound(_0x1ec9bb,null))[_0x1409('0x25')](function(_0x4f62dd){if(_0x4f62dd){var _0x331e8b=_0x4f62dd[_0x1409('0xcb')]({'plain':!![]});_0x15129f=!![];var _0x5b3ed1={'format':'A4','border':_0x1409('0xcc'),'header':{'height':_0x1409('0xcd'),'contents':{'first':_0x1409('0xce')}},'footer':{'height':'30px','contents':{'default':util[_0x1409('0x5d')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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[_0x1409('0x5d')](_0x1409('0xcf'),_0x1409('0xd0'),_0x331e8b['id']),moment()[_0x1409('0x5d')](_0x1409('0xd1'))[_0x1409('0x7a')]())}}};fs['mkdirSync'](_0x56d0bb);var _0x49c01d={'channel':_0x1409('0xd0'),'account':_0x331e8b[_0x1409('0xc8')][_0x1409('0x29')],'agent':_0x331e8b[_0x1409('0xc9')]?_0x331e8b[_0x1409('0xc9')][_0x1409('0xca')]:'N.A.','createdAt':moment(_0x331e8b[_0x1409('0x57')])[_0x1409('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1409('0x7a')](),'closedAt':_0x331e8b[_0x1409('0xd2')]?moment(_0x331e8b[_0x1409('0xd3')])[_0x1409('0x5d')](_0x1409('0xb0'))[_0x1409('0x7a')]():'','disposition':_0x331e8b[_0x1409('0xd4')],'visibility':_0x331e8b['threadId']?'Public':_0x1409('0xd5'),'messages':_(_0x331e8b[_0x1409('0xbf')])[_0x1409('0x6f')]({'secret':![]})[_0x1409('0x6e')](function(_0x46ef92){if(_0x46ef92[_0x1409('0xc6')]){var _0x2827d2=path[_0x1409('0xbe')](_0x1493d2,_0x46ef92[_0x1409('0xc6')][_0x1409('0xd6')]);if(fs['existsSync'](_0x2827d2)){fs[_0x1409('0xd7')](_0x2827d2)[_0x1409('0xd8')](fs[_0x1409('0xd9')](path[_0x1409('0xbe')](_0x56d0bb,_0x46ef92[_0x1409('0xc6')][_0x1409('0xd6')])));}}return{'date':moment(_0x46ef92[_0x1409('0x57')])['format'](_0x1409('0xb0'))[_0x1409('0x7a')](),'sender':_0x46ef92['direction']===_0x1409('0xda')?_0x46ef92['User']?_0x46ef92['User'][_0x1409('0xca')]:_0x1409('0xdb'):_0x46ef92[_0x1409('0xc3')][_0x1409('0xc4')]+(_0x46ef92[_0x1409('0xc3')][_0x1409('0xc5')]?'\x20'+_0x46ef92[_0x1409('0xc3')]['lastName']:''),'body':_0x46ef92[_0x1409('0xc6')]?_0x46ef92[_0x1409('0xc6')][_0x1409('0xd6')]:_0x46ef92[_0x1409('0xa7')],'direction':_0x46ef92[_0x1409('0xc0')]===_0x1409('0xda')?'A':'C','secret':_0x46ef92[_0x1409('0xc1')],'attachment':_0x46ef92[_0x1409('0xc6')]};})[_0x1409('0x58')]()};return ejs['renderFile'](path[_0x1409('0xbe')](config[_0x1409('0xbb')],'server','views',_0x1409('0xdc')),{'interaction':_0x49c01d})[_0x1409('0x25')](function(_0x1eb87e){return new BPromise(function(_0x2f8874,_0x36544c){pdf[_0x1409('0xa6')](_0x1eb87e,_0x5b3ed1)['toFile'](path['join'](_0x56d0bb,_0x1409('0xdd')+_0x331e8b['id']+'-'+_0x48c10e+_0x1409('0xde')),function(_0x1c9cad,_0x478dbe){if(_0x1c9cad)return _0x36544c(_0x1c9cad);_0x2f8874(_0x478dbe);});});});}})[_0x1409('0x25')](function(){if(_0x15129f){return new BPromise(function(_0x5543ef,_0x50cd18){zipdir(_0x56d0bb,{'saveTo':_0x14eb61},function(_0x14dff7,_0x42dcc2){if(_0x14dff7)return _0x50cd18(_0x14dff7);return _0x5543ef(_0x42dcc2);});})[_0x1409('0x25')](function(){return new BPromise(function(_0x4a6239,_0x24520d){rimraf(_0x56d0bb,function(_0x1fd029){if(_0x1fd029)_0x24520d(_0x1fd029);return _0x4a6239();});});})['then'](function(){return _0x1ec9bb[_0x1409('0xb9')](_0x14eb61,_0x437e9e,function(_0x5d152c){if(_0x5d152c){console[_0x1409('0xdf')](_0x1409('0xe0'),_0x5d152c);}else{fs[_0x1409('0xe1')](_0x14eb61);}});});}else{return _0x1ec9bb[_0x1409('0x26')](0xc8);}})[_0x1409('0x32')](handleError(_0x1ec9bb,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 63f699f..96ed57d 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 _0x4937=['unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','Users','map','then'];(function(_0x284735,_0xdba856){var _0x1e667e=function(_0x1f411b){while(--_0x1f411b){_0x284735['push'](_0x284735['shift']());}};_0x1e667e(++_0xdba856);}(_0x4937,0x1c8));var _0x7493=function(_0x5d22e9,_0x3ae31d){_0x5d22e9=_0x5d22e9-0x0;var _0x5fc9a7=_0x4937[_0x5d22e9];return _0x5fc9a7;};'use strict';var EventEmitter=require(_0x7493('0x0'));var OpenchannelInteraction=require(_0x7493('0x1'))['db'][_0x7493('0x2')];var OpenchannelMessage=require(_0x7493('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7493('0x3')](0x0);var events={'afterCreate':_0x7493('0x4'),'afterUpdate':'update','afterDestroy':_0x7493('0x5')};function emitEvent(_0x19a32c){return function(_0x111154,_0x4ff4a6,_0x1ef051){_0x111154['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x247ef1){_0x111154['setDataValue'](_0x7493('0x6'),_0x247ef1[_0x7493('0x7')](function(_0x24829f){return{'id':_0x24829f['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x111154['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7493('0x8')](function(_0x53edfe){_0x111154['setDataValue'](_0x7493('0x9'),_0x53edfe[_0x7493('0xa')]);OpenchannelInteractionEvents[_0x7493('0xb')](_0x19a32c+':'+_0x111154['id'],_0x111154);OpenchannelInteractionEvents[_0x7493('0xb')](_0x19a32c,_0x111154);_0x1ef051(null);})[_0x7493('0xc')](_0x1ef051(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x7493('0xd')](e,emitEvent(event));}}module[_0x7493('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xdbe5=['setDataValue','Users','map','findAll','unreadMessages','emit','exports','events','OpenchannelInteraction','../../mysqldb','update','remove','getUsers','then'];(function(_0x105a52,_0x4e0f2e){var _0xe660ab=function(_0x3f306d){while(--_0x3f306d){_0x105a52['push'](_0x105a52['shift']());}};_0xe660ab(++_0x4e0f2e);}(_0xdbe5,0x13b));var _0x5dbe=function(_0x2186f2,_0x429eb5){_0x2186f2=_0x2186f2-0x0;var _0x36d766=_0xdbe5[_0x2186f2];return _0x36d766;};'use strict';var EventEmitter=require(_0x5dbe('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x5dbe('0x1')];var OpenchannelMessage=require(_0x5dbe('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5dbe('0x3'),'afterDestroy':_0x5dbe('0x4')};function emitEvent(_0x35b124){return function(_0x553f50,_0x5a5ae6,_0x24afc6){_0x553f50[_0x5dbe('0x5')]({'attributes':['id'],'raw':!![]})[_0x5dbe('0x6')](function(_0x5c6729){_0x553f50[_0x5dbe('0x7')](_0x5dbe('0x8'),_0x5c6729[_0x5dbe('0x9')](function(_0x553910){return{'id':_0x553910['id']};}));return OpenchannelMessage[_0x5dbe('0xa')]({'where':{'OpenchannelInteractionId':_0x553f50['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5dbe('0x6')](function(_0x152a64){_0x553f50['setDataValue'](_0x5dbe('0xb'),_0x152a64['length']);OpenchannelInteractionEvents[_0x5dbe('0xc')](_0x35b124+':'+_0x553f50['id'],_0x553f50);OpenchannelInteractionEvents['emit'](_0x35b124,_0x553f50);_0x24afc6(null);})['catch'](_0x24afc6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x5dbe('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7bf3543..17e7d7f 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 _0x72a2=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','OpenchannelInteraction','openchannel_interactions','closed'];(function(_0xc6591d,_0x138c82){var _0x3a4a37=function(_0x1854b6){while(--_0x1854b6){_0xc6591d['push'](_0xc6591d['shift']());}};_0x3a4a37(++_0x138c82);}(_0x72a2,0x161));var _0x272a=function(_0xd84481,_0x8f14eb){_0xd84481=_0xd84481-0x0;var _0x57d7cb=_0x72a2[_0xd84481];return _0x57d7cb;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var logger=require(_0x272a('0x1'))(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var BPromise=require(_0x272a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272a('0x5'));var rimraf=require('rimraf');var config=require(_0x272a('0x6'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x4f628a,_0x2ba5db){return _0x4f628a[_0x272a('0x7')](_0x272a('0x8'),attributes,{'tableName':_0x272a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54dbfb,_0x484f88,_0x1fdba5){if(_0x54dbfb['changed'](_0x272a('0xa'))){_0x54dbfb['closedAt']=moment()[_0x272a('0xb')](_0x272a('0xc'));}_0x1fdba5(null,_0x54dbfb);}}});}; \ No newline at end of file +var _0x12c9=['../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','closed','format','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x349e0c,_0x3f2bbc){var _0x55a4cf=function(_0x3ede12){while(--_0x3ede12){_0x349e0c['push'](_0x349e0c['shift']());}};_0x55a4cf(++_0x3f2bbc);}(_0x12c9,0x1c9));var _0x912c=function(_0x3a8936,_0x67552b){_0x3a8936=_0x3a8936-0x0;var _0x5b8a9f=_0x12c9[_0x3a8936];return _0x5b8a9f;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require(_0x912c('0x2'))(_0x912c('0x3'));var moment=require(_0x912c('0x4'));var BPromise=require('bluebird');var rp=require(_0x912c('0x5'));var fs=require('fs');var path=require(_0x912c('0x6'));var rimraf=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var attributes=require(_0x912c('0x9'));module['exports']=function(_0x584a27,_0xe29019){return _0x584a27[_0x912c('0xa')](_0x912c('0xb'),attributes,{'tableName':_0x912c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x312a7f,_0x5c740a,_0x11ee0e){if(_0x312a7f['changed'](_0x912c('0xd'))){_0x312a7f['closedAt']=moment()[_0x912c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x11ee0e(null,_0x312a7f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e0efb74..e6929c7 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 _0xf2ca=['debug','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','then','find','addTags','omit','ids','catch','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x31c5e9,_0x30e373){_0x31c5e9=_0x31c5e9-0x0;var _0x517a8d=_0xf2ca[_0x31c5e9];return _0x517a8d;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});config[_0xaf2c('0xc')]=_['defaults'](config[_0xaf2c('0xc')],{'host':_0xaf2c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf2c('0xc')]));require('./openchannelInteraction.socket')[_0xaf2c('0xe')](socket);function respondWithRpcPromise(_0x4a0064,_0x2f5099,_0x144a7a){return new BPromise(function(_0x2e04e5,_0xd891e9){return client['request'](_0x4a0064,_0x144a7a)['then'](function(_0x2c0d88){logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x2f5099,_0xaf2c('0x11'));logger[_0xaf2c('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2f5099,'request\x20sent',JSON[_0xaf2c('0x13')](_0x2c0d88));if(_0x2c0d88[_0xaf2c('0x14')]){if(_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x15')]===0x1f4){logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);return _0xd891e9(_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);}logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);return _0x2e04e5(_0x2c0d88[_0xaf2c('0x14')]['message']);}else{logger[_0xaf2c('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2f5099,_0xaf2c('0x11'));_0x2e04e5(_0x2c0d88[_0xaf2c('0x17')][_0xaf2c('0x16')]);}})['catch'](function(_0x28ae7b){logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x28ae7b);_0xd891e9(_0x28ae7b);});});}exports[_0xaf2c('0x18')]=function(_0x3f977c){var _0x1b7f07=this;return new Promise(function(_0x531609,_0x35e712){return db[_0xaf2c('0x19')][_0xaf2c('0x1a')](_0x3f977c[_0xaf2c('0x1b')],{'raw':_0x3f977c[_0xaf2c('0x1c')]?_0x3f977c['options'][_0xaf2c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f977c[_0xaf2c('0x1c')]?_0x3f977c[_0xaf2c('0x1c')]['where']||null:null,'attributes':_0x3f977c['options']?_0x3f977c[_0xaf2c('0x1c')][_0xaf2c('0x1e')]||null:null,'limit':_0x3f977c[_0xaf2c('0x1c')]?_0x3f977c[_0xaf2c('0x1c')]['limit']||null:null})[_0xaf2c('0x1f')](function(_0xf1a7cf){logger[_0xaf2c('0xf')](_0xaf2c('0x18'),_0x3f977c);logger[_0xaf2c('0x12')](_0xaf2c('0x18'),_0x3f977c,JSON[_0xaf2c('0x13')](_0xf1a7cf));_0x531609(_0xf1a7cf);})['catch'](function(_0x29f8b0){logger[_0xaf2c('0x14')](_0xaf2c('0x18'),_0x29f8b0[_0xaf2c('0x16')],_0x3f977c);_0x35e712(_0x1b7f07['error'](0x1f4,_0x29f8b0[_0xaf2c('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x38db1b){return new Promise(function(_0x42f980,_0x15466b){return db['OpenchannelInteraction'][_0xaf2c('0x20')]({'where':_0x38db1b[_0xaf2c('0x1c')]?_0x38db1b[_0xaf2c('0x1c')]['where']||null:null})[_0xaf2c('0x1f')](function(_0x32d95c){if(_0x32d95c){return _0x32d95c[_0xaf2c('0x21')](_0x38db1b[_0xaf2c('0x1b')]['ids'],_[_0xaf2c('0x22')](_0x38db1b[_0xaf2c('0x1b')],[_0xaf2c('0x23'),'id'])||{});}})['spread'](function(_0x52dd8b){logger[_0xaf2c('0xf')]('AddTags',_0x38db1b);logger[_0xaf2c('0x12')]('AddTags',_0x38db1b,JSON[_0xaf2c('0x13')](_0x52dd8b));_0x42f980(_0x52dd8b);})[_0xaf2c('0x24')](function(_0x4ffbb9){logger[_0xaf2c('0x14')](_0xaf2c('0x25'),_0x4ffbb9['message'],_0x38db1b);_0x15466b(_this[_0xaf2c('0x14')](0x1f4,_0x4ffbb9[_0xaf2c('0x16')]));});});}; \ No newline at end of file +var _0x6455=['message','info','result','catch','OpenchannelInteraction','body','raw','options','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2e612a,_0x106dd7){var _0x3cb97c=function(_0x367d2f){while(--_0x367d2f){_0x2e612a['push'](_0x2e612a['shift']());}};_0x3cb97c(++_0x106dd7);}(_0x6455,0x97));var _0x5645=function(_0x350e44,_0x16fba3){_0x350e44=_0x350e44-0x0;var _0x586844=_0x6455[_0x350e44];return _0x586844;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});config[_0x5645('0xc')]=_[_0x5645('0xd')](config[_0x5645('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5645('0xc')]));require(_0x5645('0xe'))[_0x5645('0xf')](socket);function respondWithRpcPromise(_0x34fe4e,_0x7f9893,_0x16af81){return new BPromise(function(_0x587c61,_0x212e46){return client[_0x5645('0x10')](_0x34fe4e,_0x16af81)[_0x5645('0x11')](function(_0x21e32c){logger['info'](_0x5645('0x12'),_0x7f9893,'request\x20sent');logger[_0x5645('0x13')](_0x5645('0x14'),_0x7f9893,_0x5645('0x15'),JSON[_0x5645('0x16')](_0x21e32c));if(_0x21e32c[_0x5645('0x17')]){if(_0x21e32c[_0x5645('0x17')][_0x5645('0x18')]===0x1f4){logger[_0x5645('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x7f9893,_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);return _0x212e46(_0x21e32c[_0x5645('0x17')]['message']);}logger['error'](_0x5645('0x12'),_0x7f9893,_0x21e32c[_0x5645('0x17')]['message']);return _0x587c61(_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);}else{logger[_0x5645('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x7f9893,_0x5645('0x15'));_0x587c61(_0x21e32c[_0x5645('0x1b')][_0x5645('0x19')]);}})[_0x5645('0x1c')](function(_0x5ac9ee){logger[_0x5645('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x7f9893,_0x5ac9ee);_0x212e46(_0x5ac9ee);});});}exports['UpdateOpenchannelInteraction']=function(_0x7c39d7){var _0x1e2cba=this;return new Promise(function(_0x2e3350,_0x59a491){return db[_0x5645('0x1d')]['update'](_0x7c39d7[_0x5645('0x1e')],{'raw':_0x7c39d7['options']?_0x7c39d7['options'][_0x5645('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7c39d7['options']?_0x7c39d7[_0x5645('0x20')][_0x5645('0x21')]||null:null,'attributes':_0x7c39d7['options']?_0x7c39d7[_0x5645('0x20')][_0x5645('0x22')]||null:null,'limit':_0x7c39d7[_0x5645('0x20')]?_0x7c39d7['options'][_0x5645('0x23')]||null:null})[_0x5645('0x11')](function(_0x3f6929){logger[_0x5645('0x1a')]('UpdateOpenchannelInteraction',_0x7c39d7);logger['debug']('UpdateOpenchannelInteraction',_0x7c39d7,JSON['stringify'](_0x3f6929));_0x2e3350(_0x3f6929);})[_0x5645('0x1c')](function(_0x5df697){logger['error'](_0x5645('0x24'),_0x5df697[_0x5645('0x19')],_0x7c39d7);_0x59a491(_0x1e2cba[_0x5645('0x17')](0x1f4,_0x5df697[_0x5645('0x19')]));});});};exports[_0x5645('0x25')]=function(_0x351cbb){return new Promise(function(_0x3b9d8e,_0xc585f3){return db[_0x5645('0x1d')][_0x5645('0x26')]({'where':_0x351cbb[_0x5645('0x20')]?_0x351cbb[_0x5645('0x20')][_0x5645('0x21')]||null:null})[_0x5645('0x11')](function(_0x52ba45){if(_0x52ba45){return _0x52ba45[_0x5645('0x27')](_0x351cbb['body'][_0x5645('0x28')],_[_0x5645('0x29')](_0x351cbb[_0x5645('0x1e')],[_0x5645('0x28'),'id'])||{});}})[_0x5645('0x2a')](function(_0xc90d52){logger['info']('AddTags',_0x351cbb);logger[_0x5645('0x13')](_0x5645('0x2b'),_0x351cbb,JSON[_0x5645('0x16')](_0xc90d52));_0x3b9d8e(_0xc90d52);})[_0x5645('0x1c')](function(_0x3b070c){logger[_0x5645('0x17')](_0x5645('0x2b'),_0x3b070c[_0x5645('0x19')],_0x351cbb);_0xc585f3(_this[_0x5645('0x17')](0x1f4,_0x3b070c[_0x5645('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3f2e0a3..a7b637e 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 _0xbc6d=['save','remove','update','emit','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x21af74,_0x2e8c78){var _0x1c5a2d=function(_0x289c01){while(--_0x289c01){_0x21af74['push'](_0x21af74['shift']());}};_0x1c5a2d(++_0x2e8c78);}(_0xbc6d,0x141));var _0xdbc6=function(_0x1cb825,_0x909dc6){_0x1cb825=_0x1cb825-0x0;var _0x596088=_0xbc6d[_0x1cb825];return _0x596088;};'use strict';var OpenchannelInteractionEvents=require(_0xdbc6('0x0'));var events=[_0xdbc6('0x1'),_0xdbc6('0x2'),_0xdbc6('0x3')];function createListener(_0x43bb19,_0x5f074c){return function(_0x5d0954){_0x5f074c[_0xdbc6('0x4')](_0x43bb19,_0x5d0954);};}function removeListener(_0x4d180d,_0x432255){return function(){OpenchannelInteractionEvents['removeListener'](_0x4d180d,_0x432255);};}exports['register']=function(_0x22bc8c){for(var _0x5501e8=0x0,_0x21c89b=events[_0xdbc6('0x5')];_0x5501e8<_0x21c89b;_0x5501e8++){var _0x576572=events[_0x5501e8];var _0xf4b7ce=createListener(_0xdbc6('0x6')+_0x576572,_0x22bc8c);OpenchannelInteractionEvents['on'](_0x576572,_0xf4b7ce);}}; \ No newline at end of file +var _0x742d=['remove','update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x506945,_0x2e8058){var _0x361e83=function(_0x38fc1f){while(--_0x38fc1f){_0x506945['push'](_0x506945['shift']());}};_0x361e83(++_0x2e8058);}(_0x742d,0x8e));var _0xd742=function(_0x31df4c,_0xf3bf77){_0x31df4c=_0x31df4c-0x0;var _0x4dae25=_0x742d[_0x31df4c];return _0x4dae25;};'use strict';var OpenchannelInteractionEvents=require(_0xd742('0x0'));var events=[_0xd742('0x1'),_0xd742('0x2'),_0xd742('0x3')];function createListener(_0x4f2ec9,_0x2c9a53){return function(_0x2eed05){_0x2c9a53[_0xd742('0x4')](_0x4f2ec9,_0x2eed05);};}function removeListener(_0x43378b,_0x2ca679){return function(){OpenchannelInteractionEvents[_0xd742('0x5')](_0x43378b,_0x2ca679);};}exports['register']=function(_0x2c0467){for(var _0x4642da=0x0,_0xc9cb9=events[_0xd742('0x6')];_0x4642da<_0xc9cb9;_0x4642da++){var _0x660c4d=events[_0x4642da];var _0x20cbc6=createListener(_0xd742('0x7')+_0x660c4d,_0x2c0467);OpenchannelInteractionEvents['on'](_0x660c4d,_0x20cbc6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index efcabf3..bb7aacb 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 _0xf6da=['put','update','/:id/reject','reject','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','openchannelmessage:create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf6da,0x65));var _0xaf6d=function(_0x234396,_0x1f356e){_0x234396=_0x234396-0x0;var _0x3cd1ca=_0xf6da[_0x234396];return _0x3cd1ca;};'use strict';var multer=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var path=require(_0xaf6d('0x2'));var timeout=require(_0xaf6d('0x3'));var express=require(_0xaf6d('0x4'));var router=express[_0xaf6d('0x5')]();var auth=require(_0xaf6d('0x6'));var interaction=require(_0xaf6d('0x7'));var config=require(_0xaf6d('0x8'));var controller=require(_0xaf6d('0x9'));router[_0xaf6d('0xa')]('/',auth[_0xaf6d('0xb')](),controller['index']);router[_0xaf6d('0xa')](_0xaf6d('0xc'),auth['isAuthenticated'](),controller[_0xaf6d('0xd')]);router['get'](_0xaf6d('0xe'),auth[_0xaf6d('0xb')](),controller[_0xaf6d('0xf')]);router[_0xaf6d('0x10')]('/',auth[_0xaf6d('0xb')](),interaction[_0xaf6d('0x11')]('openchannel',_0xaf6d('0x12')),controller['create']);router[_0xaf6d('0x13')](_0xaf6d('0xe'),auth[_0xaf6d('0xb')](),controller[_0xaf6d('0x14')]);router[_0xaf6d('0x13')]('/:id/accept',auth[_0xaf6d('0xb')](),controller['accept']);router[_0xaf6d('0x13')](_0xaf6d('0x15'),auth[_0xaf6d('0xb')](),controller[_0xaf6d('0x16')]);router['delete'](_0xaf6d('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf6d('0x17')]=router; \ No newline at end of file +var _0xd239=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','/:id/accept','accept','/:id/reject','delete','destroy'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xd239,0x92));var _0x9d23=function(_0x5211f7,_0x1b5bfe){_0x5211f7=_0x5211f7-0x0;var _0x5b8365=_0xd239[_0x5211f7];return _0x5b8365;};'use strict';var multer=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var path=require(_0x9d23('0x2'));var timeout=require(_0x9d23('0x3'));var express=require(_0x9d23('0x4'));var router=express[_0x9d23('0x5')]();var auth=require(_0x9d23('0x6'));var interaction=require(_0x9d23('0x7'));var config=require(_0x9d23('0x8'));var controller=require(_0x9d23('0x9'));router[_0x9d23('0xa')]('/',auth[_0x9d23('0xb')](),controller[_0x9d23('0xc')]);router['get'](_0x9d23('0xd'),auth['isAuthenticated'](),controller[_0x9d23('0xe')]);router['get'](_0x9d23('0xf'),auth[_0x9d23('0xb')](),controller[_0x9d23('0x10')]);router[_0x9d23('0x11')]('/',auth['isAuthenticated'](),interaction[_0x9d23('0x12')](_0x9d23('0x13'),_0x9d23('0x14')),controller[_0x9d23('0x15')]);router['put'](_0x9d23('0xf'),auth['isAuthenticated'](),controller[_0x9d23('0x16')]);router['put'](_0x9d23('0x17'),auth[_0x9d23('0xb')](),controller[_0x9d23('0x18')]);router['put'](_0x9d23('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x9d23('0x1a')]('/:id',auth[_0x9d23('0xb')](),controller[_0x9d23('0x1b')]);module[_0x9d23('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0f37688..bb52aaa 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 _0xe73b=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x5a1ae8,_0xb235fb){var _0x37023c=function(_0xcb4e4){while(--_0xcb4e4){_0x5a1ae8['push'](_0x5a1ae8['shift']());}};_0x37023c(++_0xb235fb);}(_0xe73b,0x19b));var _0xbe73=function(_0x22aa61,_0x45e107){_0x22aa61=_0x22aa61-0x0;var _0x51500a=_0xe73b[_0x22aa61];return _0x51500a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xbe73('0x0')](_0xbe73('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xbe73('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbe73('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbe73('0x3')]('in','out'),'defaultValue':_0xbe73('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbe73('0x5')]}}; \ No newline at end of file +var _0x5c84=['medium','BOOLEAN','out','DATE','sequelize','exports','TEXT'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x5c84,0x1c4));var _0x45c8=function(_0x356554,_0x1fc7a4){_0x356554=_0x356554-0x0;var _0x4f530b=_0x5c84[_0x356554];return _0x4f530b;};'use strict';var Sequelize=require(_0x45c8('0x0'));module[_0x45c8('0x1')]={'body':{'type':Sequelize[_0x45c8('0x2')](_0x45c8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x45c8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x45c8('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x45c8('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e42117e..718b2b8 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 _0x0b0e=['create','body','params','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','event','EventManager','acceptmessage','openchannel','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelMessage,\x20%s,\x20%s','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','OpenchannelMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','type','key','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x4b62b9,_0x27e328){var _0x5da5c6=function(_0x4157a1){while(--_0x4157a1){_0x4b62b9['push'](_0x4b62b9['shift']());}};_0x5da5c6(++_0x27e328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1a27f3,_0x1c082d){_0x1a27f3=_0x1a27f3-0x0;var _0x3ce222=_0x0b0e[_0x1a27f3];return _0x3ce222;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xe0b0('0x12'));var logger=require(_0xe0b0('0x13'))('api');var utils=require(_0xe0b0('0x14'));var config=require(_0xe0b0('0x15'));var db=require(_0xe0b0('0x16'))['db'];config['redis']=_[_0xe0b0('0x17')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x19'),'port':0x18eb});var socket=require(_0xe0b0('0x1a'))(new Redis(config[_0xe0b0('0x18')]));require('./openchannelMessage.socket')[_0xe0b0('0x1b')](socket);var jayson=require(_0xe0b0('0x1c'));var client=jayson[_0xe0b0('0x1d')][_0xe0b0('0x1e')]({'port':0x232c});var client9002=jayson[_0xe0b0('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x41a7e2,_0x5adb01,_0x35cb40){if(_0x35cb40){var _0xadee6e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xadee6e['test'](_0x5adb01)){return _0x41a7e2;}else{throw new Error(_0xe0b0('0x1f'));}}else{return _0x41a7e2;}}function respondWithRpcPromise(_0x4a4cc0,_0x2d6fb6,_0x100204,_0x56bcc7){return new BPromise(function(_0x54a3eb,_0x46bb44){var _0x50a441=_0x56bcc7||client;return _0x50a441['request'](_0x4a4cc0,_0x100204)['then'](function(_0x1920ee){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2d6fb6,_0xe0b0('0x20'));logger['debug'](_0xe0b0('0x21'),_0x2d6fb6,'request\x20sent',JSON[_0xe0b0('0x22')](_0x1920ee));if(_0x1920ee[_0xe0b0('0x23')]){if(_0x1920ee[_0xe0b0('0x23')][_0xe0b0('0x24')]===0x1f4){logger[_0xe0b0('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x2d6fb6,_0x1920ee['error'][_0xe0b0('0x25')]);return _0x46bb44(_0x1920ee['error'][_0xe0b0('0x25')]);}logger[_0xe0b0('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x2d6fb6,_0x1920ee[_0xe0b0('0x23')]['message']);return _0x54a3eb(_0x1920ee[_0xe0b0('0x23')]['message']);}else{logger[_0xe0b0('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2d6fb6,_0xe0b0('0x20'));_0x54a3eb(_0x1920ee['result'][_0xe0b0('0x25')]);}})['catch'](function(_0x3c221d){logger['error'](_0xe0b0('0x27'),_0x2d6fb6,_0x3c221d);_0x46bb44(_0x3c221d);});});}function respondWithStatusCode(_0x3c3bc2,_0x1f1ebd){_0x1f1ebd=_0x1f1ebd||0xcc;return function(_0x1d91ad){if(_0x1d91ad){return _0x3c3bc2[_0xe0b0('0x28')](_0x1f1ebd);}return _0x3c3bc2[_0xe0b0('0x29')](_0x1f1ebd)['end']();};}function respondWithResult(_0x1444b9,_0x1b8aa8){_0x1b8aa8=_0x1b8aa8||0xc8;return function(_0x5b7a64){if(_0x5b7a64){return _0x1444b9[_0xe0b0('0x29')](_0x1b8aa8)[_0xe0b0('0x2a')](_0x5b7a64);}};}function respondWithFilteredResult(_0x36d137,_0x1d5759){return function(_0x3cdbd5){if(_0x3cdbd5){var _0x254cad=_0x3cdbd5[_0xe0b0('0x2b')],_0x136bd4=_0x1d5759['offset'],_0x4fb3b7=_0x1d5759['offset']+_0x1d5759[_0xe0b0('0x2c')],_0x1854b8;if(_0x4fb3b7>=_0x254cad){_0x4fb3b7=_0x254cad;_0x1854b8=0xc8;}else{_0x1854b8=0xce;}_0x36d137[_0xe0b0('0x29')](_0x1854b8);return _0x36d137[_0xe0b0('0x2d')](_0xe0b0('0x2e'),_0x136bd4+'-'+_0x4fb3b7+'/'+_0x254cad)[_0xe0b0('0x2a')](_0x3cdbd5);}return null;};}function patchUpdates(_0x5866e5){return function(_0x32acfe){try{jsonpatch[_0xe0b0('0x2f')](_0x32acfe,_0x5866e5,!![]);}catch(_0x7867c4){return BPromise[_0xe0b0('0x30')](_0x7867c4);}return _0x32acfe[_0xe0b0('0x31')]();};}function saveUpdates(_0x4fe835,_0x3ebf2a){return function(_0x208945){if(_0x208945){return _0x208945[_0xe0b0('0x32')](_0x4fe835)[_0xe0b0('0x33')](function(_0x3575bc){return _0x3575bc;});}return null;};}function removeEntity(_0x12eeb8,_0xf54999){return function(_0x20908f){if(_0x20908f){return _0x20908f[_0xe0b0('0x34')]()[_0xe0b0('0x33')](function(){_0x12eeb8[_0xe0b0('0x29')](0xcc)[_0xe0b0('0x35')]();});}};}function handleEntityNotFound(_0x1d35bc,_0x2a1c44){return function(_0xca25d){if(!_0xca25d){_0x1d35bc['sendStatus'](0x194);}return _0xca25d;};}function handleError(_0x121608,_0x135be5){_0x135be5=_0x135be5||0x1f4;return function(_0xace58a){logger[_0xe0b0('0x23')](_0xace58a[_0xe0b0('0x36')]);if(_0xace58a[_0xe0b0('0x37')]){delete _0xace58a[_0xe0b0('0x37')];}_0x121608['status'](_0x135be5)['send'](_0xace58a);};}exports['index']=function(_0x5317df,_0x26137c){var _0xc3d967={},_0xe6f635={},_0x4e4b20={'count':0x0,'rows':[]};var _0x2dd7e1=db[_0xe0b0('0x38')][_0xe0b0('0x39')];_0xe6f635[_0xe0b0('0x3a')]=_['keys'](_0x2dd7e1);_0xe6f635[_0xe0b0('0x3b')]=_[_0xe0b0('0x3c')](_0x5317df[_0xe0b0('0x3b')]);_0xe6f635[_0xe0b0('0x3d')]=_[_0xe0b0('0x3e')](_0xe6f635[_0xe0b0('0x3a')],_0xe6f635[_0xe0b0('0x3b')]);_0xc3d967[_0xe0b0('0x3f')]=_[_0xe0b0('0x3e')](_0xe6f635['model'],qs[_0xe0b0('0x40')](_0x5317df['query'][_0xe0b0('0x40')]));_0xc3d967[_0xe0b0('0x3f')]=_0xc3d967[_0xe0b0('0x3f')][_0xe0b0('0x41')]?_0xc3d967['attributes']:_0xe6f635[_0xe0b0('0x3a')];if(!_0x5317df[_0xe0b0('0x3b')][_0xe0b0('0x42')](_0xe0b0('0x43'))){_0xc3d967[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x5317df[_0xe0b0('0x3b')][_0xe0b0('0x2c')]);_0xc3d967['offset']=qs[_0xe0b0('0x44')](_0x5317df[_0xe0b0('0x3b')]['offset']);}_0xc3d967['order']=qs[_0xe0b0('0x45')](_0x5317df[_0xe0b0('0x3b')]['sort']);_0xc3d967[_0xe0b0('0x46')]=qs[_0xe0b0('0x3d')](_[_0xe0b0('0x47')](_0x5317df[_0xe0b0('0x3b')],_0xe6f635[_0xe0b0('0x3d')]));if(_0x5317df['query']['filter']){_0xc3d967['where']=_[_0xe0b0('0x48')](_0xc3d967[_0xe0b0('0x46')],{'$or':_['map'](_0x2dd7e1,function(_0x9f7459){if(_0x9f7459[_0xe0b0('0x49')][_0xe0b0('0x4a')]!==_0xe0b0('0x4b')){var _0x16ccca={};_0x16ccca[_0x9f7459['field']]={'$like':'%'+_0x5317df['query'][_0xe0b0('0x4c')]+'%'};return _0x16ccca;}})});}_0xc3d967=_[_0xe0b0('0x48')]({},_0xc3d967,_0x5317df[_0xe0b0('0x4d')]);var _0x1acc50={'where':_0xc3d967[_0xe0b0('0x46')]};return db['OpenchannelMessage'][_0xe0b0('0x2b')](_0x1acc50)[_0xe0b0('0x33')](function(_0x534340){_0x4e4b20['count']=_0x534340;if(_0x5317df['query'][_0xe0b0('0x4e')]){_0xc3d967[_0xe0b0('0x4f')]=[{'all':!![]}];}return db[_0xe0b0('0x38')][_0xe0b0('0x50')](_0xc3d967);})['then'](function(_0x2e2b10){_0x4e4b20[_0xe0b0('0x51')]=_0x2e2b10;return _0x4e4b20;})['then'](respondWithFilteredResult(_0x26137c,_0xc3d967))['catch'](handleError(_0x26137c,null));};exports[_0xe0b0('0x52')]=function(_0x1bc6e0,_0x497f4f){var _0x2b1917={'raw':!![],'where':{'id':_0x1bc6e0['params']['id']}},_0x27fd31={};_0x27fd31['model']=_[_0xe0b0('0x3c')](db['OpenchannelMessage'][_0xe0b0('0x39')]);_0x27fd31[_0xe0b0('0x3b')]=_[_0xe0b0('0x3c')](_0x1bc6e0[_0xe0b0('0x3b')]);_0x27fd31[_0xe0b0('0x3d')]=_[_0xe0b0('0x3e')](_0x27fd31['model'],_0x27fd31['query']);_0x2b1917[_0xe0b0('0x3f')]=_['intersection'](_0x27fd31['model'],qs[_0xe0b0('0x40')](_0x1bc6e0[_0xe0b0('0x3b')]['fields']));_0x2b1917['attributes']=_0x2b1917[_0xe0b0('0x3f')][_0xe0b0('0x41')]?_0x2b1917[_0xe0b0('0x3f')]:_0x27fd31[_0xe0b0('0x3a')];if(_0x1bc6e0[_0xe0b0('0x3b')][_0xe0b0('0x4e')]){_0x2b1917[_0xe0b0('0x4f')]=[{'all':!![]}];}_0x2b1917=_['merge']({},_0x2b1917,_0x1bc6e0[_0xe0b0('0x4d')]);return db['OpenchannelMessage'][_0xe0b0('0x53')](_0x2b1917)['then'](handleEntityNotFound(_0x497f4f,null))['then'](respondWithResult(_0x497f4f,null))[_0xe0b0('0x54')](handleError(_0x497f4f,null));};exports[_0xe0b0('0x55')]=function(_0x228174,_0x2f1712){return db[_0xe0b0('0x38')][_0xe0b0('0x55')](_0x228174[_0xe0b0('0x56')],{})[_0xe0b0('0x33')](respondWithResult(_0x2f1712,0xc9))[_0xe0b0('0x54')](handleError(_0x2f1712,null));};exports['update']=function(_0x253ab0,_0x57ccc9){if(_0x253ab0[_0xe0b0('0x56')]['id']){delete _0x253ab0[_0xe0b0('0x56')]['id'];}return db[_0xe0b0('0x38')][_0xe0b0('0x53')]({'where':{'id':_0x253ab0[_0xe0b0('0x57')]['id']}})[_0xe0b0('0x33')](handleEntityNotFound(_0x57ccc9,null))['then'](saveUpdates(_0x253ab0[_0xe0b0('0x56')],null))[_0xe0b0('0x33')](respondWithResult(_0x57ccc9,null))[_0xe0b0('0x54')](handleError(_0x57ccc9,null));};exports[_0xe0b0('0x34')]=function(_0x3bb6d6,_0x3b015e){return db[_0xe0b0('0x38')][_0xe0b0('0x53')]({'where':{'id':_0x3bb6d6[_0xe0b0('0x57')]['id']}})[_0xe0b0('0x33')](handleEntityNotFound(_0x3b015e,null))[_0xe0b0('0x33')](removeEntity(_0x3b015e,null))[_0xe0b0('0x54')](handleError(_0x3b015e,null));};exports[_0xe0b0('0x58')]=function(_0x10eb99,_0xcdf97){return db[_0xe0b0('0x38')][_0xe0b0('0x58')]()[_0xe0b0('0x33')](respondWithResult(_0xcdf97,null))['catch'](handleError(_0xcdf97,null));};var interaction_log=require(_0xe0b0('0x13'))(_0xe0b0('0x59'));exports[_0xe0b0('0x5a')]=function(_0x2f24e6,_0x3916ab,_0x405d7e){var _0x2bdb59={'channel':'openchannel'};if(_0x2f24e6['body']['id']){delete _0x2f24e6[_0xe0b0('0x56')]['id'];}_0x2f24e6[_0xe0b0('0x56')][_0xe0b0('0x5b')]=!![];_0x2f24e6['body'][_0xe0b0('0x5c')]=moment()[_0xe0b0('0x5d')](_0xe0b0('0x5e'));_0x2f24e6[_0xe0b0('0x56')][_0xe0b0('0x5f')]=_0x2f24e6['body'][_0xe0b0('0x5f')]||_0x2f24e6[_0xe0b0('0x60')]['id'];return db[_0xe0b0('0x38')]['find']({'where':{'id':_0x2f24e6[_0xe0b0('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xe0b0('0x61')],'as':'Contact'}]})[_0xe0b0('0x33')](handleEntityNotFound(_0x3916ab,null))['then'](saveUpdates(_0x2f24e6['body'],null))[_0xe0b0('0x33')](function(_0x57b51e){if(_0x57b51e){_0x2bdb59['message']=_0x57b51e[_0xe0b0('0x62')]({'plain':!![]});return db[_0xe0b0('0x63')][_0xe0b0('0x53')]({'where':{'id':_0x57b51e[_0xe0b0('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3916ab,null))[_0xe0b0('0x33')](function(_0x2287a5){if(_0x2287a5){return _0x2287a5[_0xe0b0('0x32')]({'UserId':_0x2f24e6[_0xe0b0('0x56')][_0xe0b0('0x5f')],'read1stAt':_[_0xe0b0('0x65')](_0x2287a5[_0xe0b0('0x66')])?moment()[_0xe0b0('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4b41a){if(_0x4b41a){_0x2bdb59[_0xe0b0('0x67')]=_0x4b41a[_0xe0b0('0x62')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f24e6[_0xe0b0('0x60')]['id'],_0x2f24e6[_0xe0b0('0x60')]['name'],_0x2f24e6['user'][_0xe0b0('0x68')],_0x2bdb59[_0xe0b0('0x67')]['id'],_0x2f24e6[_0xe0b0('0x56')]?JSON[_0xe0b0('0x22')](_0x2f24e6[_0xe0b0('0x56')]):_0xe0b0('0x69'));return respondWithRpcPromise(_0xe0b0('0x6a'),_0xe0b0('0x6b'),_0x2bdb59);}return null;})['then'](function(_0x1daff7){if(_0x1daff7){if(_0x2f24e6[_0xe0b0('0x56')][_0xe0b0('0x6c')]){_0x2bdb59['message']['interface']=util['format']('SIP/%s',_0x2f24e6['user']['name']);_0x2bdb59[_0xe0b0('0x25')]['channel']=_0x2bdb59['channel'];_0x2bdb59[_0xe0b0('0x25')][_0xe0b0('0x6d')]=_0xe0b0('0x5a');return respondWithRpcPromise(_0xe0b0('0x6e'),_0xe0b0('0x6e'),{'event':_0xe0b0('0x6f'),'message':_0x2bdb59[_0xe0b0('0x25')]},client9002)[_0xe0b0('0x33')](function(){return _0x2bdb59;});}return _0x2bdb59;}return null;})['then'](respondWithResult(_0x3916ab,null))[_0xe0b0('0x54')](handleError(_0x3916ab,null));};var interaction_log=require(_0xe0b0('0x13'))(_0xe0b0('0x59'));exports[_0xe0b0('0x30')]=function(_0x173ed8,_0x1f70fb,_0x16a2ae){var _0x5e3e28={'agent':{},'channel':_0xe0b0('0x70')};if(_0x173ed8['body']['id']){delete _0x173ed8[_0xe0b0('0x56')]['id'];}_0x173ed8[_0xe0b0('0x56')][_0xe0b0('0x5f')]=_0x173ed8[_0xe0b0('0x56')]['UserId']||_0x173ed8[_0xe0b0('0x60')]['id'];_0x5e3e28[_0xe0b0('0x71')]['id']=_0x173ed8['body']['UserId'];return db[_0xe0b0('0x38')][_0xe0b0('0x53')]({'where':{'id':_0x173ed8[_0xe0b0('0x57')]['id'],'UserId':null}})[_0xe0b0('0x33')](handleEntityNotFound(_0x1f70fb,null))[_0xe0b0('0x33')](function(_0x31dd21){if(_0x31dd21){_0x5e3e28[_0xe0b0('0x25')]=_0x31dd21[_0xe0b0('0x62')]({'plain':!![]});return db[_0xe0b0('0x63')][_0xe0b0('0x53')]({'where':{'id':_0x31dd21['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1f70fb,null))[_0xe0b0('0x33')](function(_0x4880d5){if(_0x4880d5){_0x5e3e28['interaction']=_0x4880d5['get']({'plain':!![]});interaction_log['info'](_0xe0b0('0x72'),_0x173ed8['user']['id'],_0x173ed8[_0xe0b0('0x60')][_0xe0b0('0x37')],_0x173ed8[_0xe0b0('0x60')][_0xe0b0('0x68')],_0x5e3e28['interaction']['id'],_0x173ed8[_0xe0b0('0x56')]?JSON[_0xe0b0('0x22')](_0x173ed8['body']):_0xe0b0('0x69'));return respondWithRpcPromise(_0xe0b0('0x73'),_0xe0b0('0x74'),_0x5e3e28);}return null;})[_0xe0b0('0x33')](function(_0x27af09){if(_0x27af09){_0x27af09['message']['interface']=util['format']('SIP/%s',_0x173ed8['user'][_0xe0b0('0x37')]);_0x27af09['message'][_0xe0b0('0x75')]=_0x5e3e28['channel'];_0x27af09[_0xe0b0('0x25')][_0xe0b0('0x6d')]=_0xe0b0('0x30');respondWithRpcPromise(_0xe0b0('0x6e'),_0xe0b0('0x6e'),{'event':_0xe0b0('0x76'),'message':_0x27af09['message']},client9002);return _0x5e3e28;}return null;})['then'](respondWithResult(_0x1f70fb,null))['catch'](handleError(_0x1f70fb,null));}; \ No newline at end of file +var _0x9f0e=['readAt','UserId','user','CmContact','Contact','get','OpenchannelInteraction','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','http','client','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','key','field','merge','options','OpenchannelMessage','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x9f0e,0x116));var _0xe9f0=function(_0x221e44,_0x1cb4d3){_0x221e44=_0x221e44-0x0;var _0x461557=_0x9f0e[_0x221e44];return _0x461557;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var Redis=require(_0xe9f0('0x11'));var authService=require(_0xe9f0('0x12'));var qs=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require(_0xe9f0('0x15'))('api');var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var db=require(_0xe9f0('0x18'))['db'];config['redis']=_[_0xe9f0('0x19')](config['redis'],{'host':_0xe9f0('0x1a'),'port':0x18eb});var socket=require(_0xe9f0('0x1b'))(new Redis(config[_0xe9f0('0x1c')]));require(_0xe9f0('0x1d'))['register'](socket);var jayson=require(_0xe9f0('0x1e'));var client=jayson['client'][_0xe9f0('0x1f')]({'port':0x232c});var client9002=jayson[_0xe9f0('0x20')][_0xe9f0('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x59320d,_0x28bfac,_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e68ef['test'](_0x28bfac)){return _0x59320d;}else{throw new Error(_0xe9f0('0x21'));}}else{return _0x59320d;}}function respondWithRpcPromise(_0x1e16e0,_0xcd2042,_0xd71ac8,_0x3ed69a){return new BPromise(function(_0x2ab12b,_0x3da237){var _0x59bf5a=_0x3ed69a||client;return _0x59bf5a[_0xe9f0('0x22')](_0x1e16e0,_0xd71ac8)[_0xe9f0('0x23')](function(_0x232f2c){logger['info'](_0xe9f0('0x24'),_0xcd2042,_0xe9f0('0x25'));logger[_0xe9f0('0x26')](_0xe9f0('0x27'),_0xcd2042,'request\x20sent',JSON[_0xe9f0('0x28')](_0x232f2c));if(_0x232f2c[_0xe9f0('0x29')]){if(_0x232f2c['error']['code']===0x1f4){logger['error'](_0xe9f0('0x24'),_0xcd2042,_0x232f2c[_0xe9f0('0x29')][_0xe9f0('0x2a')]);return _0x3da237(_0x232f2c[_0xe9f0('0x29')][_0xe9f0('0x2a')]);}logger['error'](_0xe9f0('0x24'),_0xcd2042,_0x232f2c[_0xe9f0('0x29')][_0xe9f0('0x2a')]);return _0x2ab12b(_0x232f2c[_0xe9f0('0x29')][_0xe9f0('0x2a')]);}else{logger[_0xe9f0('0x2b')](_0xe9f0('0x24'),_0xcd2042,_0xe9f0('0x25'));_0x2ab12b(_0x232f2c[_0xe9f0('0x2c')][_0xe9f0('0x2a')]);}})['catch'](function(_0x371095){logger[_0xe9f0('0x29')](_0xe9f0('0x24'),_0xcd2042,_0x371095);_0x3da237(_0x371095);});});}function respondWithStatusCode(_0x1a8478,_0x4cf1b1){_0x4cf1b1=_0x4cf1b1||0xcc;return function(_0x212a38){if(_0x212a38){return _0x1a8478[_0xe9f0('0x2d')](_0x4cf1b1);}return _0x1a8478[_0xe9f0('0x2e')](_0x4cf1b1)[_0xe9f0('0x2f')]();};}function respondWithResult(_0x4335c6,_0x5457f6){_0x5457f6=_0x5457f6||0xc8;return function(_0x130f96){if(_0x130f96){return _0x4335c6[_0xe9f0('0x2e')](_0x5457f6)[_0xe9f0('0x30')](_0x130f96);}};}function respondWithFilteredResult(_0xab3d81,_0xa27c84){return function(_0xd19788){if(_0xd19788){var _0x1d788a=_0xd19788[_0xe9f0('0x31')],_0x2efd33=_0xa27c84[_0xe9f0('0x32')],_0x2b6503=_0xa27c84[_0xe9f0('0x32')]+_0xa27c84[_0xe9f0('0x33')],_0x3dbe49;if(_0x2b6503>=_0x1d788a){_0x2b6503=_0x1d788a;_0x3dbe49=0xc8;}else{_0x3dbe49=0xce;}_0xab3d81[_0xe9f0('0x2e')](_0x3dbe49);return _0xab3d81[_0xe9f0('0x34')](_0xe9f0('0x35'),_0x2efd33+'-'+_0x2b6503+'/'+_0x1d788a)[_0xe9f0('0x30')](_0xd19788);}return null;};}function patchUpdates(_0x2e7535){return function(_0x19d799){try{jsonpatch[_0xe9f0('0x36')](_0x19d799,_0x2e7535,!![]);}catch(_0x589803){return BPromise[_0xe9f0('0x37')](_0x589803);}return _0x19d799[_0xe9f0('0x38')]();};}function saveUpdates(_0x5480ce,_0x49996c){return function(_0x58d38b){if(_0x58d38b){return _0x58d38b[_0xe9f0('0x39')](_0x5480ce)['then'](function(_0x9bf61d){return _0x9bf61d;});}return null;};}function removeEntity(_0xc5fa13,_0x4d3bd6){return function(_0x285457){if(_0x285457){return _0x285457['destroy']()['then'](function(){_0xc5fa13['status'](0xcc)[_0xe9f0('0x2f')]();});}};}function handleEntityNotFound(_0x39722b,_0x5cd6ed){return function(_0x3becb9){if(!_0x3becb9){_0x39722b[_0xe9f0('0x2d')](0x194);}return _0x3becb9;};}function handleError(_0x1d4748,_0x4d4186){_0x4d4186=_0x4d4186||0x1f4;return function(_0x523fbc){logger[_0xe9f0('0x29')](_0x523fbc[_0xe9f0('0x3a')]);if(_0x523fbc[_0xe9f0('0x3b')]){delete _0x523fbc['name'];}_0x1d4748[_0xe9f0('0x2e')](_0x4d4186)[_0xe9f0('0x3c')](_0x523fbc);};}exports[_0xe9f0('0x3d')]=function(_0x2c53f1,_0x2b38de){var _0x552ec2={},_0x2ab492={},_0x3a2b23={'count':0x0,'rows':[]};var _0x2ede2=db['OpenchannelMessage'][_0xe9f0('0x3e')];_0x2ab492[_0xe9f0('0x3f')]=_['keys'](_0x2ede2);_0x2ab492[_0xe9f0('0x40')]=_['keys'](_0x2c53f1[_0xe9f0('0x40')]);_0x2ab492['filters']=_['intersection'](_0x2ab492['model'],_0x2ab492['query']);_0x552ec2['attributes']=_[_0xe9f0('0x41')](_0x2ab492[_0xe9f0('0x3f')],qs[_0xe9f0('0x42')](_0x2c53f1[_0xe9f0('0x40')][_0xe9f0('0x42')]));_0x552ec2[_0xe9f0('0x43')]=_0x552ec2[_0xe9f0('0x43')][_0xe9f0('0x44')]?_0x552ec2[_0xe9f0('0x43')]:_0x2ab492['model'];if(!_0x2c53f1[_0xe9f0('0x40')][_0xe9f0('0x45')](_0xe9f0('0x46'))){_0x552ec2['limit']=qs['limit'](_0x2c53f1[_0xe9f0('0x40')]['limit']);_0x552ec2[_0xe9f0('0x32')]=qs[_0xe9f0('0x32')](_0x2c53f1[_0xe9f0('0x40')][_0xe9f0('0x32')]);}_0x552ec2['order']=qs[_0xe9f0('0x47')](_0x2c53f1[_0xe9f0('0x40')][_0xe9f0('0x47')]);_0x552ec2[_0xe9f0('0x48')]=qs[_0xe9f0('0x49')](_['pick'](_0x2c53f1[_0xe9f0('0x40')],_0x2ab492[_0xe9f0('0x49')]));if(_0x2c53f1[_0xe9f0('0x40')][_0xe9f0('0x4a')]){_0x552ec2[_0xe9f0('0x48')]=_['merge'](_0x552ec2[_0xe9f0('0x48')],{'$or':_['map'](_0x2ede2,function(_0x54e432){if(_0x54e432[_0xe9f0('0x4b')][_0xe9f0('0x4c')]!=='VIRTUAL'){var _0x10a360={};_0x10a360[_0x54e432[_0xe9f0('0x4d')]]={'$like':'%'+_0x2c53f1[_0xe9f0('0x40')][_0xe9f0('0x4a')]+'%'};return _0x10a360;}})});}_0x552ec2=_[_0xe9f0('0x4e')]({},_0x552ec2,_0x2c53f1[_0xe9f0('0x4f')]);var _0x15d529={'where':_0x552ec2['where']};return db[_0xe9f0('0x50')]['count'](_0x15d529)[_0xe9f0('0x23')](function(_0x5a3488){_0x3a2b23[_0xe9f0('0x31')]=_0x5a3488;if(_0x2c53f1['query'][_0xe9f0('0x51')]){_0x552ec2[_0xe9f0('0x52')]=[{'all':!![]}];}return db[_0xe9f0('0x50')]['findAll'](_0x552ec2);})[_0xe9f0('0x23')](function(_0xcf426d){_0x3a2b23[_0xe9f0('0x53')]=_0xcf426d;return _0x3a2b23;})[_0xe9f0('0x23')](respondWithFilteredResult(_0x2b38de,_0x552ec2))[_0xe9f0('0x54')](handleError(_0x2b38de,null));};exports[_0xe9f0('0x55')]=function(_0x6ece3f,_0x42ff7){var _0x18fc2b={'raw':!![],'where':{'id':_0x6ece3f[_0xe9f0('0x56')]['id']}},_0x13c4ad={};_0x13c4ad[_0xe9f0('0x3f')]=_['keys'](db['OpenchannelMessage'][_0xe9f0('0x3e')]);_0x13c4ad[_0xe9f0('0x40')]=_[_0xe9f0('0x57')](_0x6ece3f['query']);_0x13c4ad[_0xe9f0('0x49')]=_['intersection'](_0x13c4ad[_0xe9f0('0x3f')],_0x13c4ad[_0xe9f0('0x40')]);_0x18fc2b[_0xe9f0('0x43')]=_[_0xe9f0('0x41')](_0x13c4ad['model'],qs[_0xe9f0('0x42')](_0x6ece3f[_0xe9f0('0x40')]['fields']));_0x18fc2b[_0xe9f0('0x43')]=_0x18fc2b[_0xe9f0('0x43')][_0xe9f0('0x44')]?_0x18fc2b[_0xe9f0('0x43')]:_0x13c4ad['model'];if(_0x6ece3f[_0xe9f0('0x40')][_0xe9f0('0x51')]){_0x18fc2b[_0xe9f0('0x52')]=[{'all':!![]}];}_0x18fc2b=_[_0xe9f0('0x4e')]({},_0x18fc2b,_0x6ece3f[_0xe9f0('0x4f')]);return db[_0xe9f0('0x50')][_0xe9f0('0x58')](_0x18fc2b)[_0xe9f0('0x23')](handleEntityNotFound(_0x42ff7,null))['then'](respondWithResult(_0x42ff7,null))[_0xe9f0('0x54')](handleError(_0x42ff7,null));};exports[_0xe9f0('0x59')]=function(_0x465380,_0x4728e7){return db[_0xe9f0('0x50')][_0xe9f0('0x59')](_0x465380[_0xe9f0('0x5a')],{})[_0xe9f0('0x23')](respondWithResult(_0x4728e7,0xc9))[_0xe9f0('0x54')](handleError(_0x4728e7,null));};exports[_0xe9f0('0x39')]=function(_0x1df048,_0x3c26ac){if(_0x1df048[_0xe9f0('0x5a')]['id']){delete _0x1df048[_0xe9f0('0x5a')]['id'];}return db['OpenchannelMessage'][_0xe9f0('0x58')]({'where':{'id':_0x1df048[_0xe9f0('0x56')]['id']}})[_0xe9f0('0x23')](handleEntityNotFound(_0x3c26ac,null))['then'](saveUpdates(_0x1df048['body'],null))[_0xe9f0('0x23')](respondWithResult(_0x3c26ac,null))['catch'](handleError(_0x3c26ac,null));};exports[_0xe9f0('0x5b')]=function(_0x31deaf,_0x2b37ff){return db['OpenchannelMessage'][_0xe9f0('0x58')]({'where':{'id':_0x31deaf[_0xe9f0('0x56')]['id']}})[_0xe9f0('0x23')](handleEntityNotFound(_0x2b37ff,null))[_0xe9f0('0x23')](removeEntity(_0x2b37ff,null))['catch'](handleError(_0x2b37ff,null));};exports[_0xe9f0('0x5c')]=function(_0x3a05e7,_0x28a66e){return db[_0xe9f0('0x50')]['describe']()['then'](respondWithResult(_0x28a66e,null))[_0xe9f0('0x54')](handleError(_0x28a66e,null));};var interaction_log=require(_0xe9f0('0x15'))(_0xe9f0('0x5d'));exports[_0xe9f0('0x5e')]=function(_0x7cbe71,_0x4b680e,_0xbe2247){var _0x55ce2d={'channel':_0xe9f0('0x5f')};if(_0x7cbe71['body']['id']){delete _0x7cbe71[_0xe9f0('0x5a')]['id'];}_0x7cbe71[_0xe9f0('0x5a')][_0xe9f0('0x60')]=!![];_0x7cbe71[_0xe9f0('0x5a')][_0xe9f0('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x7cbe71['body'][_0xe9f0('0x62')]=_0x7cbe71[_0xe9f0('0x5a')]['UserId']||_0x7cbe71[_0xe9f0('0x63')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x7cbe71[_0xe9f0('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xe9f0('0x64')],'as':_0xe9f0('0x65')}]})[_0xe9f0('0x23')](handleEntityNotFound(_0x4b680e,null))[_0xe9f0('0x23')](saveUpdates(_0x7cbe71[_0xe9f0('0x5a')],null))['then'](function(_0x5e4ad4){if(_0x5e4ad4){_0x55ce2d[_0xe9f0('0x2a')]=_0x5e4ad4[_0xe9f0('0x66')]({'plain':!![]});return db[_0xe9f0('0x67')][_0xe9f0('0x58')]({'where':{'id':_0x5e4ad4['OpenchannelInteractionId']}});}return null;})[_0xe9f0('0x23')](handleEntityNotFound(_0x4b680e,null))[_0xe9f0('0x23')](function(_0x22b44a){if(_0x22b44a){return _0x22b44a[_0xe9f0('0x39')]({'UserId':_0x7cbe71[_0xe9f0('0x5a')][_0xe9f0('0x62')],'read1stAt':_['isNil'](_0x22b44a[_0xe9f0('0x68')])?moment()[_0xe9f0('0x69')](_0xe9f0('0x6a')):undefined});}return null;})[_0xe9f0('0x23')](function(_0xb6e75d){if(_0xb6e75d){_0x55ce2d['interaction']=_0xb6e75d[_0xe9f0('0x66')]({'plain':!![]});interaction_log[_0xe9f0('0x2b')](_0xe9f0('0x6b'),_0x7cbe71[_0xe9f0('0x63')]['id'],_0x7cbe71[_0xe9f0('0x63')][_0xe9f0('0x3b')],_0x7cbe71[_0xe9f0('0x63')][_0xe9f0('0x6c')],_0x55ce2d[_0xe9f0('0x6d')]['id'],_0x7cbe71[_0xe9f0('0x5a')]?JSON[_0xe9f0('0x28')](_0x7cbe71[_0xe9f0('0x5a')]):'null');return respondWithRpcPromise(_0xe9f0('0x6e'),_0xe9f0('0x6f'),_0x55ce2d);}return null;})[_0xe9f0('0x23')](function(_0x116ec5){if(_0x116ec5){if(_0x7cbe71[_0xe9f0('0x5a')][_0xe9f0('0x70')]){_0x55ce2d[_0xe9f0('0x2a')]['interface']=util[_0xe9f0('0x69')](_0xe9f0('0x71'),_0x7cbe71['user'][_0xe9f0('0x3b')]);_0x55ce2d[_0xe9f0('0x2a')][_0xe9f0('0x72')]=_0x55ce2d['channel'];_0x55ce2d[_0xe9f0('0x2a')][_0xe9f0('0x73')]='accept';return respondWithRpcPromise(_0xe9f0('0x74'),_0xe9f0('0x74'),{'event':'acceptmessage','message':_0x55ce2d['message']},client9002)[_0xe9f0('0x23')](function(){return _0x55ce2d;});}return _0x55ce2d;}return null;})['then'](respondWithResult(_0x4b680e,null))[_0xe9f0('0x54')](handleError(_0x4b680e,null));};var interaction_log=require(_0xe9f0('0x15'))('openchannel-interactions');exports[_0xe9f0('0x37')]=function(_0x155f71,_0x3305b8,_0x300fae){var _0x161ee4={'agent':{},'channel':_0xe9f0('0x5f')};if(_0x155f71[_0xe9f0('0x5a')]['id']){delete _0x155f71[_0xe9f0('0x5a')]['id'];}_0x155f71[_0xe9f0('0x5a')]['UserId']=_0x155f71[_0xe9f0('0x5a')][_0xe9f0('0x62')]||_0x155f71[_0xe9f0('0x63')]['id'];_0x161ee4[_0xe9f0('0x75')]['id']=_0x155f71[_0xe9f0('0x5a')][_0xe9f0('0x62')];return db[_0xe9f0('0x50')][_0xe9f0('0x58')]({'where':{'id':_0x155f71['params']['id'],'UserId':null}})[_0xe9f0('0x23')](handleEntityNotFound(_0x3305b8,null))[_0xe9f0('0x23')](function(_0x2ce60c){if(_0x2ce60c){_0x161ee4[_0xe9f0('0x2a')]=_0x2ce60c[_0xe9f0('0x66')]({'plain':!![]});return db[_0xe9f0('0x67')]['find']({'where':{'id':_0x2ce60c[_0xe9f0('0x76')]}});}return null;})['then'](handleEntityNotFound(_0x3305b8,null))['then'](function(_0x5ca5e5){if(_0x5ca5e5){_0x161ee4[_0xe9f0('0x6d')]=_0x5ca5e5[_0xe9f0('0x66')]({'plain':!![]});interaction_log[_0xe9f0('0x2b')](_0xe9f0('0x77'),_0x155f71[_0xe9f0('0x63')]['id'],_0x155f71[_0xe9f0('0x63')][_0xe9f0('0x3b')],_0x155f71[_0xe9f0('0x63')][_0xe9f0('0x6c')],_0x161ee4['interaction']['id'],_0x155f71[_0xe9f0('0x5a')]?JSON[_0xe9f0('0x28')](_0x155f71[_0xe9f0('0x5a')]):_0xe9f0('0x78'));return respondWithRpcPromise(_0xe9f0('0x79'),_0xe9f0('0x7a'),_0x161ee4);}return null;})[_0xe9f0('0x23')](function(_0x4743df){if(_0x4743df){_0x4743df[_0xe9f0('0x2a')][_0xe9f0('0x7b')]=util['format']('SIP/%s',_0x155f71[_0xe9f0('0x63')][_0xe9f0('0x3b')]);_0x4743df[_0xe9f0('0x2a')][_0xe9f0('0x72')]=_0x161ee4[_0xe9f0('0x72')];_0x4743df[_0xe9f0('0x2a')][_0xe9f0('0x73')]=_0xe9f0('0x37');respondWithRpcPromise('EventManager','EventManager',{'event':_0xe9f0('0x7c'),'message':_0x4743df[_0xe9f0('0x2a')]},client9002);return _0x161ee4;}return null;})['then'](respondWithResult(_0x3305b8,null))['catch'](handleError(_0x3305b8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 13d7c8b..0bc3e0f 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 _0x1185=['remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x1aae15,_0x518e5d){var _0x3d686d=function(_0x1da7c4){while(--_0x1da7c4){_0x1aae15['push'](_0x1aae15['shift']());}};_0x3d686d(++_0x518e5d);}(_0x1185,0x1c6));var _0x5118=function(_0x32d83c,_0x4fd20f){_0x32d83c=_0x32d83c-0x0;var _0x2b78d2=_0x1185[_0x32d83c];return _0x2b78d2;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x5118('0x0'))['db'][_0x5118('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5118('0x2')](0x0);var events={'afterCreate':_0x5118('0x3'),'afterUpdate':_0x5118('0x4'),'afterDestroy':_0x5118('0x5')};function emitEvent(_0x32eb76){return function(_0x2443a6,_0x4f320a,_0x57c407){OpenchannelMessageEvents[_0x5118('0x6')](_0x32eb76+':'+_0x2443a6['id'],_0x2443a6);OpenchannelMessageEvents['emit'](_0x32eb76,_0x2443a6);_0x57c407(null);};}for(var e in events){if(events[_0x5118('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x5118('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xc98b=['hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5b6c71,_0x1fcf9c){var _0x12ce52=function(_0x1fa2d5){while(--_0x1fa2d5){_0x5b6c71['push'](_0x5b6c71['shift']());}};_0x12ce52(++_0x1fcf9c);}(_0xc98b,0x89));var _0xbc98=function(_0x314333,_0x9049dc){_0x314333=_0x314333-0x0;var _0x4f82cf=_0xc98b[_0x314333];return _0x4f82cf;};'use strict';var EventEmitter=require(_0xbc98('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xbc98('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbc98('0x2')](0x0);var events={'afterCreate':_0xbc98('0x3'),'afterUpdate':_0xbc98('0x4'),'afterDestroy':_0xbc98('0x5')};function emitEvent(_0x5eb8af){return function(_0x313de7,_0x19edae,_0x4b3c2b){OpenchannelMessageEvents['emit'](_0x5eb8af+':'+_0x313de7['id'],_0x313de7);OpenchannelMessageEvents[_0xbc98('0x6')](_0x5eb8af,_0x313de7);_0x4b3c2b(null);};}for(var e in events){if(events[_0xbc98('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xbc98('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8759a7c..acc9e05 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 _0x1ef2=['CmContact','find','Interactions','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error'];(function(_0x32c236,_0x4a09da){var _0x2ef80f=function(_0x19aefb){while(--_0x19aefb){_0x32c236['push'](_0x32c236['shift']());}};_0x2ef80f(++_0x4a09da);}(_0x1ef2,0x17b));var _0x21ef=function(_0x5d18b9,_0x1b51dc){_0x5d18b9=_0x5d18b9-0x0;var _0x35adb1=_0x1ef2[_0x5d18b9];return _0x35adb1;};'use strict';var _=require(_0x21ef('0x0'));var util=require(_0x21ef('0x1'));var logger=require(_0x21ef('0x2'))(_0x21ef('0x3'));var moment=require('moment');var BPromise=require(_0x21ef('0x4'));var rp=require(_0x21ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21ef('0x6'));var config=require(_0x21ef('0x7'));var attributes=require(_0x21ef('0x8'));module['exports']=function(_0x520add,_0x1c83c0){return _0x520add[_0x21ef('0x9')](_0x21ef('0xa'),attributes,{'tableName':_0x21ef('0xb'),'paranoid':![],'indexes':[{'name':_0x21ef('0xc'),'fields':[_0x21ef('0xd')],'type':_0x21ef('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x583054,_0x47dd2b,_0x3b15a3){var _0x35016e=_0x520add[_0x21ef('0xf')];var _0x5e2b78=_0x583054['get']({'plain':!![]});if(_0x5e2b78[_0x21ef('0x10')][_0x21ef('0x11')]()==='in'||_0x5e2b78[_0x21ef('0x10')][_0x21ef('0x11')]()===_0x21ef('0x12')&&!_0x5e2b78[_0x21ef('0x13')]&&!_[_0x21ef('0x14')](_0x5e2b78['UserId'])){_0x35016e[_0x21ef('0x15')][_0x21ef('0x16')]({'where':{'id':_0x5e2b78[_0x21ef('0x17')]}})[_0x21ef('0x18')](function(_0x22c3a2){if(_0x22c3a2){_0x22c3a2[_0x21ef('0x19')]({'lastMsgAt':_0x5e2b78[_0x21ef('0x1a')],'lastMsgDirection':_0x5e2b78[_0x21ef('0x10')]['toLowerCase']()});}})[_0x21ef('0x1b')](function(_0x393af4){console[_0x21ef('0x1c')](_0x393af4);});}if(_0x5e2b78[_0x21ef('0x10')]===_0x21ef('0x12')&&!_0x5e2b78[_0x21ef('0x13')]){var _0x50ce14;_0x35016e[_0x21ef('0x1d')]['describe']()[_0x21ef('0x18')](function(_0x122360){return _0x35016e['OpenchannelAccount'][_0x21ef('0x1e')]({'where':{'id':_0x5e2b78['OpenchannelAccountId']},'include':[{'model':_0x35016e[_0x21ef('0x15')],'as':_0x21ef('0x1f'),'where':{'id':_0x5e2b78[_0x21ef('0x17')]},'limit':0x1,'include':[{'model':_0x35016e[_0x21ef('0x1d')],'as':'Contact','attributes':_[_0x21ef('0x20')](_0x122360)}]}]});})[_0x21ef('0x18')](function(_0x2727df){_0x50ce14=_0x2727df[_0x21ef('0x21')]({'plain':!![]});if(_0x50ce14&&_0x50ce14[_0x21ef('0x22')]){logger[_0x21ef('0x23')](_0x21ef('0x24'),_0x21ef('0x25'),util[_0x21ef('0x26')](_0x21ef('0x27'),_0x5e2b78['id'],_0x50ce14[_0x21ef('0x22')]));if(_0x50ce14['Interactions']&&_0x50ce14[_0x21ef('0x1f')][_0x21ef('0x28')]){_0x5e2b78['Interaction']=_[_0x21ef('0x29')](_0x50ce14[_0x21ef('0x1f')][0x0],_0x21ef('0x2a'));_0x5e2b78['Contact']=_0x50ce14['Interactions'][0x0][_0x21ef('0x2a')];}var _0x47dd2b={'method':_0x21ef('0x2b'),'uri':encodeURI(_0x50ce14[_0x21ef('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x47dd2b[_0x21ef('0x2c')]){case _0x21ef('0x2d'):_0x47dd2b['qs']=_0x5e2b78;break;case _0x21ef('0x2b'):_0x47dd2b[_0x21ef('0xd')]=_0x5e2b78;break;}return rp(_0x47dd2b)[_0x21ef('0x18')](function(_0x1ad92d){logger[_0x21ef('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x21ef('0x25'),util[_0x21ef('0x26')](_0x21ef('0x2e'),_0x5e2b78['id'],_0x50ce14[_0x21ef('0x22')]));if(_0x1ad92d[_0x21ef('0xd')][_0x21ef('0x2f')]&&_0x1ad92d[_0x21ef('0xd')][_0x21ef('0x2f')]!=_0x5e2b78[_0x21ef('0x30')][_0x21ef('0x2f')]){return _0x35016e[_0x21ef('0x15')][_0x21ef('0x19')]({'threadId':_0x1ad92d[_0x21ef('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x5e2b78['Interaction']['id']}});}else{return;}})['then'](function(){return _0x583054[_0x21ef('0x19')]({'read':!![]});})[_0x21ef('0x1b')](function(_0x6e5501){logger[_0x21ef('0x1c')](_0x21ef('0x24'),'afterCreate',util['inspect'](_0x6e5501,{'showHidden':![],'depth':null}));_0x3b15a3();});}else{_0x3b15a3();}})[_0x21ef('0x31')](function(){_0x3b15a3();});}else{_0x3b15a3();}}},'charset':_0x21ef('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf9d4=['replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','catch','error','describe','Interactions','OpenchannelInteractionId','CmContact','Contact','keys'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf9d4,0x105));var _0x4f9d=function(_0x1f6a0a,_0x19264d){_0x1f6a0a=_0x1f6a0a-0x0;var _0x34f23f=_0xf9d4[_0x1f6a0a];return _0x34f23f;};'use strict';var _=require(_0x4f9d('0x0'));var util=require(_0x4f9d('0x1'));var logger=require(_0x4f9d('0x2'))(_0x4f9d('0x3'));var moment=require(_0x4f9d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f9d('0x5'));var rimraf=require(_0x4f9d('0x6'));var config=require(_0x4f9d('0x7'));var attributes=require(_0x4f9d('0x8'));module[_0x4f9d('0x9')]=function(_0x88338c,_0x5ef533){return _0x88338c['define'](_0x4f9d('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x4f9d('0xb'),'fields':[_0x4f9d('0xc')],'type':_0x4f9d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29c1a8,_0x35572b,_0xa0badf){var _0x81c45f=_0x88338c[_0x4f9d('0xe')];var _0x309443=_0x29c1a8[_0x4f9d('0xf')]({'plain':!![]});if(_0x309443['direction'][_0x4f9d('0x10')]()==='in'||_0x309443[_0x4f9d('0x11')][_0x4f9d('0x10')]()===_0x4f9d('0x12')&&!_0x309443[_0x4f9d('0x13')]&&!_[_0x4f9d('0x14')](_0x309443[_0x4f9d('0x15')])){_0x81c45f[_0x4f9d('0x16')][_0x4f9d('0x17')]({'where':{'id':_0x309443['OpenchannelInteractionId']}})[_0x4f9d('0x18')](function(_0x2ff520){if(_0x2ff520){_0x2ff520['update']({'lastMsgAt':_0x309443['createdAt'],'lastMsgDirection':_0x309443[_0x4f9d('0x11')][_0x4f9d('0x10')]()});}})[_0x4f9d('0x19')](function(_0x507b40){console[_0x4f9d('0x1a')](_0x507b40);});}if(_0x309443[_0x4f9d('0x11')]===_0x4f9d('0x12')&&!_0x309443[_0x4f9d('0x13')]){var _0x1095cd;_0x81c45f['CmContact'][_0x4f9d('0x1b')]()[_0x4f9d('0x18')](function(_0x1b8f21){return _0x81c45f['OpenchannelAccount']['find']({'where':{'id':_0x309443['OpenchannelAccountId']},'include':[{'model':_0x81c45f[_0x4f9d('0x16')],'as':_0x4f9d('0x1c'),'where':{'id':_0x309443[_0x4f9d('0x1d')]},'limit':0x1,'include':[{'model':_0x81c45f[_0x4f9d('0x1e')],'as':_0x4f9d('0x1f'),'attributes':_[_0x4f9d('0x20')](_0x1b8f21)}]}]});})[_0x4f9d('0x18')](function(_0x215e87){_0x1095cd=_0x215e87[_0x4f9d('0xf')]({'plain':!![]});if(_0x1095cd&&_0x1095cd[_0x4f9d('0x21')]){logger[_0x4f9d('0x22')](_0x4f9d('0x23'),_0x4f9d('0x24'),util[_0x4f9d('0x25')](_0x4f9d('0x26'),_0x309443['id'],_0x1095cd[_0x4f9d('0x21')]));if(_0x1095cd[_0x4f9d('0x1c')]&&_0x1095cd['Interactions']['length']){_0x309443['Interaction']=_[_0x4f9d('0x27')](_0x1095cd[_0x4f9d('0x1c')][0x0],_0x4f9d('0x1f'));_0x309443['Contact']=_0x1095cd['Interactions'][0x0][_0x4f9d('0x1f')];}var _0x35572b={'method':_0x4f9d('0x28'),'uri':encodeURI(_0x1095cd[_0x4f9d('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x35572b[_0x4f9d('0x29')]){case'GET':_0x35572b['qs']=_0x309443;break;case _0x4f9d('0x28'):_0x35572b[_0x4f9d('0xc')]=_0x309443;break;}return rp(_0x35572b)['then'](function(_0x22d2f3){logger[_0x4f9d('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f9d('0x24'),util['format'](_0x4f9d('0x2a'),_0x309443['id'],_0x1095cd[_0x4f9d('0x21')]));if(_0x22d2f3[_0x4f9d('0xc')][_0x4f9d('0x2b')]&&_0x22d2f3[_0x4f9d('0xc')]['threadId']!=_0x309443[_0x4f9d('0x2c')]['threadId']){return _0x81c45f[_0x4f9d('0x16')][_0x4f9d('0x2d')]({'threadId':_0x22d2f3[_0x4f9d('0xc')][_0x4f9d('0x2b')]},{'logging':!![],'where':{'id':_0x309443[_0x4f9d('0x2c')]['id']}});}else{return;}})[_0x4f9d('0x18')](function(){return _0x29c1a8[_0x4f9d('0x2d')]({'read':!![]});})[_0x4f9d('0x19')](function(_0x2d5a35){logger['error'](_0x4f9d('0x23'),_0x4f9d('0x24'),util[_0x4f9d('0x2e')](_0x2d5a35,{'showHidden':![],'depth':null}));_0xa0badf();});}else{_0xa0badf();}})[_0x4f9d('0x2f')](function(){_0xa0badf();});}else{_0xa0badf();}}},'charset':'utf8mb4','collate':_0x4f9d('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index dd2d56a..67ea763 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 _0x3f7d=['catch','OpenchannelMessage','body','options','raw','CreateOpenchannelMessage','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2b24f4,_0x4b879c){var _0xffd134=function(_0x522782){while(--_0x522782){_0x2b24f4['push'](_0x2b24f4['shift']());}};_0xffd134(++_0x4b879c);}(_0x3f7d,0x1f3));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xd3f7('0x0'));var moment=require(_0xd3f7('0x1'));var BPromise=require(_0xd3f7('0x2'));var rs=require(_0xd3f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd3f7('0x4'));var jayson=require(_0xd3f7('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd3f7('0x6')](config['redis'],{'host':_0xd3f7('0x7'),'port':0x18eb});var socket=require(_0xd3f7('0x8'))(new Redis(config[_0xd3f7('0x9')]));require(_0xd3f7('0xa'))[_0xd3f7('0xb')](socket);function respondWithRpcPromise(_0x5a2bf0,_0x1ea078,_0x2d567){return new BPromise(function(_0x39bb3c,_0x51437c){return client[_0xd3f7('0xc')](_0x5a2bf0,_0x2d567)[_0xd3f7('0xd')](function(_0xe6c0a2){logger[_0xd3f7('0xe')](_0xd3f7('0xf'),_0x1ea078,_0xd3f7('0x10'));logger[_0xd3f7('0x11')](_0xd3f7('0x12'),_0x1ea078,_0xd3f7('0x10'),JSON[_0xd3f7('0x13')](_0xe6c0a2));if(_0xe6c0a2[_0xd3f7('0x14')]){if(_0xe6c0a2['error'][_0xd3f7('0x15')]===0x1f4){logger[_0xd3f7('0x14')](_0xd3f7('0xf'),_0x1ea078,_0xe6c0a2[_0xd3f7('0x14')][_0xd3f7('0x16')]);return _0x51437c(_0xe6c0a2['error'][_0xd3f7('0x16')]);}logger[_0xd3f7('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x1ea078,_0xe6c0a2['error'][_0xd3f7('0x16')]);return _0x39bb3c(_0xe6c0a2['error'][_0xd3f7('0x16')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1ea078,_0xd3f7('0x10'));_0x39bb3c(_0xe6c0a2['result'][_0xd3f7('0x16')]);}})[_0xd3f7('0x17')](function(_0x1598f5){logger[_0xd3f7('0x14')](_0xd3f7('0xf'),_0x1ea078,_0x1598f5);_0x51437c(_0x1598f5);});});}exports['CreateOpenchannelMessage']=function(_0x26df02){var _0x223163=this;return new Promise(function(_0x2fcfe6,_0x1f11bf){return db[_0xd3f7('0x18')]['create'](_0x26df02[_0xd3f7('0x19')],{'raw':_0x26df02['options']?_0x26df02[_0xd3f7('0x1a')][_0xd3f7('0x1b')]===undefined?!![]:![]:!![]})[_0xd3f7('0xd')](function(_0x484b73){logger[_0xd3f7('0xe')]('CreateOpenchannelMessage',_0x26df02);logger[_0xd3f7('0x11')]('CreateOpenchannelMessage',_0x26df02,JSON[_0xd3f7('0x13')](_0x484b73));_0x2fcfe6(_0x484b73);})[_0xd3f7('0x17')](function(_0x59d4c0){logger[_0xd3f7('0x14')](_0xd3f7('0x1c'),_0x59d4c0['message'],_0x26df02);_0x1f11bf(_0x223163['error'](0x1f4,_0x59d4c0['message']));});});}; \ No newline at end of file +var _0x2a8e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','raw','lodash','moment'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x2a8e,0x191));var _0xe2a8=function(_0x1cc760,_0x39e78c){_0x1cc760=_0x1cc760-0x0;var _0x549d56=_0x2a8e[_0x1cc760];return _0x549d56;};'use strict';var _=require(_0xe2a8('0x0'));var util=require('util');var moment=require(_0xe2a8('0x1'));var BPromise=require(_0xe2a8('0x2'));var rs=require(_0xe2a8('0x3'));var fs=require('fs');var Redis=require(_0xe2a8('0x4'));var db=require(_0xe2a8('0x5'))['db'];var utils=require(_0xe2a8('0x6'));var logger=require(_0xe2a8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe2a8('0x8'));var client=jayson[_0xe2a8('0x9')][_0xe2a8('0xa')]({'port':0x232a});config[_0xe2a8('0xb')]=_[_0xe2a8('0xc')](config['redis'],{'host':_0xe2a8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2a8('0xb')]));require('./openchannelMessage.socket')[_0xe2a8('0xe')](socket);function respondWithRpcPromise(_0x347200,_0x374016,_0x3f4aa3){return new BPromise(function(_0x1db12c,_0x52c7c1){return client['request'](_0x347200,_0x3f4aa3)['then'](function(_0x5a5bf5){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x374016,_0xe2a8('0xf'));logger[_0xe2a8('0x10')](_0xe2a8('0x11'),_0x374016,_0xe2a8('0xf'),JSON[_0xe2a8('0x12')](_0x5a5bf5));if(_0x5a5bf5[_0xe2a8('0x13')]){if(_0x5a5bf5['error'][_0xe2a8('0x14')]===0x1f4){logger[_0xe2a8('0x13')](_0xe2a8('0x15'),_0x374016,_0x5a5bf5['error'][_0xe2a8('0x16')]);return _0x52c7c1(_0x5a5bf5[_0xe2a8('0x13')][_0xe2a8('0x16')]);}logger[_0xe2a8('0x13')](_0xe2a8('0x15'),_0x374016,_0x5a5bf5[_0xe2a8('0x13')][_0xe2a8('0x16')]);return _0x1db12c(_0x5a5bf5['error']['message']);}else{logger[_0xe2a8('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x374016,_0xe2a8('0xf'));_0x1db12c(_0x5a5bf5[_0xe2a8('0x18')][_0xe2a8('0x16')]);}})[_0xe2a8('0x19')](function(_0x59e492){logger[_0xe2a8('0x13')](_0xe2a8('0x15'),_0x374016,_0x59e492);_0x52c7c1(_0x59e492);});});}exports[_0xe2a8('0x1a')]=function(_0x19fd44){var _0x47fee9=this;return new Promise(function(_0xd286c7,_0x45afbe){return db[_0xe2a8('0x1b')][_0xe2a8('0x1c')](_0x19fd44['body'],{'raw':_0x19fd44[_0xe2a8('0x1d')]?_0x19fd44[_0xe2a8('0x1d')][_0xe2a8('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5cf955){logger[_0xe2a8('0x17')](_0xe2a8('0x1a'),_0x19fd44);logger[_0xe2a8('0x10')]('CreateOpenchannelMessage',_0x19fd44,JSON['stringify'](_0x5cf955));_0xd286c7(_0x5cf955);})[_0xe2a8('0x19')](function(_0x435e56){logger[_0xe2a8('0x13')](_0xe2a8('0x1a'),_0x435e56[_0xe2a8('0x16')],_0x19fd44);_0x45afbe(_0x47fee9[_0xe2a8('0x13')](0x1f4,_0x435e56[_0xe2a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3d1a5bf..741bb52 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 _0x4006=['save','remove','update','emit','length'];(function(_0xb6714a,_0x861bbb){var _0x1ec3a9=function(_0x246fda){while(--_0x246fda){_0xb6714a['push'](_0xb6714a['shift']());}};_0x1ec3a9(++_0x861bbb);}(_0x4006,0x1c7));var _0x6400=function(_0x80b2d2,_0x253864){_0x80b2d2=_0x80b2d2-0x0;var _0x21c116=_0x4006[_0x80b2d2];return _0x21c116;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x6400('0x0'),_0x6400('0x1'),_0x6400('0x2')];function createListener(_0x8fd587,_0x5c8ece){return function(_0x4b7a00){_0x5c8ece[_0x6400('0x3')](_0x8fd587,_0x4b7a00);};}function removeListener(_0x4b0418,_0xd858df){return function(){OpenchannelMessageEvents['removeListener'](_0x4b0418,_0xd858df);};}exports['register']=function(_0x2dbd03){for(var _0x599e6f=0x0,_0x32c0db=events[_0x6400('0x4')];_0x599e6f<_0x32c0db;_0x599e6f++){var _0x2bf4f8=events[_0x599e6f];var _0x250dba=createListener('openchannelMessage:'+_0x2bf4f8,_0x2dbd03);OpenchannelMessageEvents['on'](_0x2bf4f8,_0x250dba);}}; \ No newline at end of file +var _0x106f=['save','update','removeListener','register','./openchannelMessage.events'];(function(_0x3585fb,_0x5df075){var _0x48fb79=function(_0x595516){while(--_0x595516){_0x3585fb['push'](_0x3585fb['shift']());}};_0x48fb79(++_0x5df075);}(_0x106f,0x162));var _0xf106=function(_0x18aef7,_0x1f65e7){_0x18aef7=_0x18aef7-0x0;var _0x5814f3=_0x106f[_0x18aef7];return _0x5814f3;};'use strict';var OpenchannelMessageEvents=require(_0xf106('0x0'));var events=[_0xf106('0x1'),'remove',_0xf106('0x2')];function createListener(_0x6d8236,_0x59bc3a){return function(_0x102554){_0x59bc3a['emit'](_0x6d8236,_0x102554);};}function removeListener(_0x1236af,_0x370f6a){return function(){OpenchannelMessageEvents[_0xf106('0x3')](_0x1236af,_0x370f6a);};}exports[_0xf106('0x4')]=function(_0x253f6d){for(var _0x282fd4=0x0,_0xc9588d=events['length'];_0x282fd4<_0xc9588d;_0x282fd4++){var _0x4ea3b8=events[_0x282fd4];var _0x3ac1bd=createListener('openchannelMessage:'+_0x4ea3b8,_0x253f6d);OpenchannelMessageEvents['on'](_0x4ea3b8,_0x3ac1bd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 3e52438..51639c4 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 _0x91b4=['get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','/:id','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x15db27,_0x2e7e0b){var _0x323465=function(_0x330127){while(--_0x330127){_0x15db27['push'](_0x15db27['shift']());}};_0x323465(++_0x2e7e0b);}(_0x91b4,0x18c));var _0x491b=function(_0xc57a20,_0x46cc58){_0xc57a20=_0xc57a20-0x0;var _0x33fb4f=_0x91b4[_0xc57a20];return _0x33fb4f;};'use strict';var multer=require(_0x491b('0x0'));var util=require(_0x491b('0x1'));var path=require(_0x491b('0x2'));var timeout=require(_0x491b('0x3'));var express=require(_0x491b('0x4'));var router=express[_0x491b('0x5')]();var auth=require(_0x491b('0x6'));var interaction=require(_0x491b('0x7'));var config=require(_0x491b('0x8'));var controller=require(_0x491b('0x9'));router[_0x491b('0xa')]('/',auth[_0x491b('0xb')](),controller[_0x491b('0xc')]);router[_0x491b('0xa')](_0x491b('0xd'),auth[_0x491b('0xb')](),controller[_0x491b('0xe')]);router['get']('/:id',auth[_0x491b('0xb')](),controller[_0x491b('0xf')]);router['get'](_0x491b('0x10'),auth[_0x491b('0xb')](),controller['getMembers']);router[_0x491b('0xa')](_0x491b('0x11'),auth['isAuthenticated'](),controller[_0x491b('0x12')]);router[_0x491b('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x491b('0x13')]('/',auth[_0x491b('0xb')](),controller[_0x491b('0x14')]);router[_0x491b('0x13')]('/:id/teams',auth[_0x491b('0xb')](),controller['addTeams']);router[_0x491b('0x13')](_0x491b('0x15'),auth[_0x491b('0xb')](),controller[_0x491b('0x16')]);router[_0x491b('0x17')](_0x491b('0x18'),auth[_0x491b('0xb')](),controller[_0x491b('0x19')]);router[_0x491b('0x1a')]('/:id',auth[_0x491b('0xb')](),controller['destroy']);router[_0x491b('0x1a')](_0x491b('0x11'),auth[_0x491b('0xb')](),controller[_0x491b('0x1b')]);router[_0x491b('0x1a')]('/:id/users',auth[_0x491b('0xb')](),controller[_0x491b('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x47b8=['/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','describe','/:id','show','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams'];(function(_0x195e6a,_0x379e1c){var _0x4aeab4=function(_0x3318af){while(--_0x3318af){_0x195e6a['push'](_0x195e6a['shift']());}};_0x4aeab4(++_0x379e1c);}(_0x47b8,0x106));var _0x847b=function(_0x769c00,_0x51dfff){_0x769c00=_0x769c00-0x0;var _0x2df989=_0x47b8[_0x769c00];return _0x2df989;};'use strict';var multer=require(_0x847b('0x0'));var util=require(_0x847b('0x1'));var path=require('path');var timeout=require(_0x847b('0x2'));var express=require(_0x847b('0x3'));var router=express[_0x847b('0x4')]();var auth=require(_0x847b('0x5'));var interaction=require(_0x847b('0x6'));var config=require('../../config/environment');var controller=require(_0x847b('0x7'));router[_0x847b('0x8')]('/',auth['isAuthenticated'](),controller[_0x847b('0x9')]);router[_0x847b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x847b('0xa')]);router[_0x847b('0x8')](_0x847b('0xb'),auth['isAuthenticated'](),controller[_0x847b('0xc')]);router[_0x847b('0x8')](_0x847b('0xd'),auth[_0x847b('0xe')](),controller[_0x847b('0xf')]);router['get'](_0x847b('0x10'),auth[_0x847b('0xe')](),controller[_0x847b('0x11')]);router[_0x847b('0x8')](_0x847b('0x12'),auth['isAuthenticated'](),controller[_0x847b('0x13')]);router['post']('/',auth[_0x847b('0xe')](),controller[_0x847b('0x14')]);router[_0x847b('0x15')](_0x847b('0x10'),auth[_0x847b('0xe')](),controller[_0x847b('0x16')]);router[_0x847b('0x15')](_0x847b('0x12'),auth[_0x847b('0xe')](),controller[_0x847b('0x17')]);router[_0x847b('0x18')](_0x847b('0xb'),auth[_0x847b('0xe')](),controller['update']);router[_0x847b('0x19')]('/:id',auth[_0x847b('0xe')](),controller['destroy']);router[_0x847b('0x19')](_0x847b('0x10'),auth['isAuthenticated'](),controller[_0x847b('0x1a')]);router[_0x847b('0x19')](_0x847b('0x12'),auth[_0x847b('0xe')](),controller[_0x847b('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index bdc1643..10a59f0 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 _0x6244=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x27a0c0,_0xd0af5d){var _0x5f3476=function(_0x3fac6d){while(--_0x3fac6d){_0x27a0c0['push'](_0x27a0c0['shift']());}};_0x5f3476(++_0xd0af5d);}(_0x6244,0x17b));var _0x4624=function(_0x18410a,_0x2ecc64){_0x18410a=_0x18410a-0x0;var _0x52a2e1=_0x6244[_0x18410a];return _0x52a2e1;};'use strict';var Sequelize=require(_0x4624('0x0'));module[_0x4624('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4624('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4624('0x3')]},'timeout':{'type':Sequelize[_0x4624('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4624('0x5')](_0x4624('0x6'),_0x4624('0x7'),_0x4624('0x8'))}}; \ No newline at end of file +var _0x5398=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x5398,0x87));var _0x8539=function(_0x29e10d,_0x53cd7f){_0x29e10d=_0x29e10d-0x0;var _0x4a2218=_0x5398[_0x29e10d];return _0x4a2218;};'use strict';var Sequelize=require(_0x8539('0x0'));module[_0x8539('0x1')]={'name':{'type':Sequelize[_0x8539('0x2')],'unique':_0x8539('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8539('0x2')]},'timeout':{'type':Sequelize[_0x8539('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8539('0x5')](_0x8539('0x6'),_0x8539('0x7'),_0x8539('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 52afbe2..4f80b43 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 _0xd878=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','OpenchannelQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','teams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','from','team_has_openchannel_queues','join'];(function(_0x4641a7,_0x201cdf){var _0xd3ad87=function(_0x28157c){while(--_0x28157c){_0x4641a7['push'](_0x4641a7['shift']());}};_0xd3ad87(++_0x201cdf);}(_0xd878,0x135));var _0x8d87=function(_0x34e765,_0x3d23b8){_0x34e765=_0x34e765-0x0;var _0x6e0c1a=_0xd878[_0x34e765];return _0x6e0c1a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d87('0x1'));var jsonpatch=require(_0x8d87('0x2'));var rp=require(_0x8d87('0x3'));var moment=require(_0x8d87('0x4'));var BPromise=require(_0x8d87('0x5'));var Mustache=require(_0x8d87('0x6'));var util=require(_0x8d87('0x7'));var path=require('path');var sox=require(_0x8d87('0x8'));var csv=require('to-csv');var ejs=require(_0x8d87('0x9'));var fs=require('fs');var _=require(_0x8d87('0xa'));var squel=require('squel');var crypto=require(_0x8d87('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8d87('0xc'));var toCsv=require(_0x8d87('0xd'));var querystring=require(_0x8d87('0xe'));var Papa=require('papaparse');var Redis=require(_0x8d87('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8d87('0x10'));var hardwareService=require(_0x8d87('0x11'));var logger=require(_0x8d87('0x12'))(_0x8d87('0x13'));var utils=require(_0x8d87('0x14'));var config=require(_0x8d87('0x15'));var db=require('../../mysqldb')['db'];config[_0x8d87('0x16')]=_[_0x8d87('0x17')](config[_0x8d87('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d87('0x18'))(new Redis(config['redis']));require(_0x8d87('0x19'))[_0x8d87('0x1a')](socket);function respondWithStatusCode(_0x227d0f,_0x1ac8e7){_0x1ac8e7=_0x1ac8e7||0xcc;return function(_0x2d06be){if(_0x2d06be){return _0x227d0f[_0x8d87('0x1b')](_0x1ac8e7);}return _0x227d0f['status'](_0x1ac8e7)[_0x8d87('0x1c')]();};}function respondWithResult(_0x9a5646,_0x5effed){_0x5effed=_0x5effed||0xc8;return function(_0x77eb07){if(_0x77eb07){return _0x9a5646[_0x8d87('0x1d')](_0x5effed)[_0x8d87('0x1e')](_0x77eb07);}};}function respondWithFilteredResult(_0x11a755,_0x56d3af){return function(_0x91ee28){if(_0x91ee28){var _0x3ab0b8=_0x91ee28[_0x8d87('0x1f')],_0x594912=_0x56d3af['offset'],_0x53128f=_0x56d3af[_0x8d87('0x20')]+_0x56d3af[_0x8d87('0x21')],_0x12d9cf;if(_0x53128f>=_0x3ab0b8){_0x53128f=_0x3ab0b8;_0x12d9cf=0xc8;}else{_0x12d9cf=0xce;}_0x11a755['status'](_0x12d9cf);return _0x11a755[_0x8d87('0x22')](_0x8d87('0x23'),_0x594912+'-'+_0x53128f+'/'+_0x3ab0b8)['json'](_0x91ee28);}return null;};}function patchUpdates(_0x5e2289){return function(_0x334806){try{jsonpatch[_0x8d87('0x24')](_0x334806,_0x5e2289,!![]);}catch(_0x151d99){return BPromise[_0x8d87('0x25')](_0x151d99);}return _0x334806[_0x8d87('0x26')]();};}function saveUpdates(_0x535301,_0xac348f){return function(_0x6aeb30){if(_0x6aeb30){return _0x6aeb30[_0x8d87('0x27')](_0x535301)[_0x8d87('0x28')](function(_0x3fbbcd){return _0x3fbbcd;});}return null;};}function removeEntity(_0x488842,_0x445e96){return function(_0x3e130d){if(_0x3e130d){return _0x3e130d[_0x8d87('0x29')]()['then'](function(){var _0x151740=_0x3e130d['get']({'plain':!![]});var _0x127efc=_0x8d87('0x2a');return db[_0x8d87('0x2b')][_0x8d87('0x29')]({'where':{'type':_0x127efc,'resourceId':_0x151740['id']}})[_0x8d87('0x28')](function(){return _0x3e130d;});})[_0x8d87('0x28')](function(){_0x488842[_0x8d87('0x1d')](0xcc)[_0x8d87('0x1c')]();});}};}function handleEntityNotFound(_0x34052e,_0x1b537d){return function(_0x3c86c7){if(!_0x3c86c7){_0x34052e[_0x8d87('0x1b')](0x194);}return _0x3c86c7;};}function handleError(_0x10f308,_0x337e54){_0x337e54=_0x337e54||0x1f4;return function(_0x397bb5){logger['error'](_0x397bb5[_0x8d87('0x2c')]);if(_0x397bb5['name']){delete _0x397bb5[_0x8d87('0x2d')];}_0x10f308['status'](_0x337e54)[_0x8d87('0x2e')](_0x397bb5);};}exports[_0x8d87('0x2f')]=function(_0x3d7057,_0x49862e){var _0x29083f={},_0x5b039a={},_0x545f4a={'count':0x0,'rows':[]};var _0x4456a9=db[_0x8d87('0x30')][_0x8d87('0x31')];_0x5b039a[_0x8d87('0x32')]=_[_0x8d87('0x33')](_0x4456a9);_0x5b039a[_0x8d87('0x34')]=_[_0x8d87('0x33')](_0x3d7057[_0x8d87('0x34')]);_0x5b039a['filters']=_[_0x8d87('0x35')](_0x5b039a['model'],_0x5b039a[_0x8d87('0x34')]);_0x29083f[_0x8d87('0x36')]=_[_0x8d87('0x35')](_0x5b039a[_0x8d87('0x32')],qs[_0x8d87('0x37')](_0x3d7057[_0x8d87('0x34')][_0x8d87('0x37')]));_0x29083f['attributes']=_0x29083f['attributes'][_0x8d87('0x38')]?_0x29083f[_0x8d87('0x36')]:_0x5b039a['model'];if(!_0x3d7057[_0x8d87('0x34')][_0x8d87('0x39')](_0x8d87('0x3a'))){_0x29083f[_0x8d87('0x21')]=qs[_0x8d87('0x21')](_0x3d7057[_0x8d87('0x34')][_0x8d87('0x21')]);_0x29083f[_0x8d87('0x20')]=qs[_0x8d87('0x20')](_0x3d7057['query']['offset']);}_0x29083f[_0x8d87('0x3b')]=qs[_0x8d87('0x3c')](_0x3d7057[_0x8d87('0x34')][_0x8d87('0x3c')]);_0x29083f[_0x8d87('0x3d')]=qs[_0x8d87('0x3e')](_[_0x8d87('0x3f')](_0x3d7057['query'],_0x5b039a['filters']));if(_0x3d7057[_0x8d87('0x34')]['filter']){_0x29083f[_0x8d87('0x3d')]=_[_0x8d87('0x40')](_0x29083f['where'],{'$or':_[_0x8d87('0x41')](_0x4456a9,function(_0x58c56c){if(_0x58c56c[_0x8d87('0x42')]['key']!==_0x8d87('0x43')){var _0x45bc99={};_0x45bc99[_0x58c56c['field']]={'$like':'%'+_0x3d7057['query'][_0x8d87('0x44')]+'%'};return _0x45bc99;}})});}_0x29083f=_[_0x8d87('0x40')]({},_0x29083f,_0x3d7057[_0x8d87('0x45')]);var _0x33f0dd={'where':_0x29083f[_0x8d87('0x3d')]};return db[_0x8d87('0x30')][_0x8d87('0x1f')](_0x33f0dd)[_0x8d87('0x28')](function(_0x508890){_0x545f4a['count']=_0x508890;if(_0x3d7057[_0x8d87('0x34')][_0x8d87('0x46')]){_0x29083f[_0x8d87('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x8d87('0x48')](_0x29083f);})[_0x8d87('0x28')](function(_0x38b178){_0x545f4a[_0x8d87('0x49')]=_0x38b178;return _0x545f4a;})[_0x8d87('0x28')](respondWithFilteredResult(_0x49862e,_0x29083f))[_0x8d87('0x4a')](handleError(_0x49862e,null));};exports[_0x8d87('0x4b')]=function(_0x4fd91e,_0x2b9e54){var _0x45be9c={'raw':!![],'where':{'id':_0x4fd91e[_0x8d87('0x4c')]['id']}},_0x1a7fdd={};_0x1a7fdd[_0x8d87('0x32')]=_[_0x8d87('0x33')](db['OpenchannelQueue'][_0x8d87('0x31')]);_0x1a7fdd[_0x8d87('0x34')]=_['keys'](_0x4fd91e['query']);_0x1a7fdd['filters']=_[_0x8d87('0x35')](_0x1a7fdd[_0x8d87('0x32')],_0x1a7fdd[_0x8d87('0x34')]);_0x45be9c[_0x8d87('0x36')]=_[_0x8d87('0x35')](_0x1a7fdd[_0x8d87('0x32')],qs[_0x8d87('0x37')](_0x4fd91e[_0x8d87('0x34')]['fields']));_0x45be9c[_0x8d87('0x36')]=_0x45be9c[_0x8d87('0x36')]['length']?_0x45be9c[_0x8d87('0x36')]:_0x1a7fdd[_0x8d87('0x32')];if(_0x4fd91e['query'][_0x8d87('0x46')]){_0x45be9c[_0x8d87('0x47')]=[{'all':!![]}];}_0x45be9c=_[_0x8d87('0x40')]({},_0x45be9c,_0x4fd91e[_0x8d87('0x45')]);return db[_0x8d87('0x30')]['find'](_0x45be9c)[_0x8d87('0x28')](handleEntityNotFound(_0x2b9e54,null))[_0x8d87('0x28')](respondWithResult(_0x2b9e54,null))[_0x8d87('0x4a')](handleError(_0x2b9e54,null));};exports[_0x8d87('0x4d')]=function(_0x37b239,_0x24d782){return db[_0x8d87('0x30')]['create'](_0x37b239[_0x8d87('0x4e')],{})[_0x8d87('0x28')](function(_0x19b702){var _0x373357=_0x37b239[_0x8d87('0x4f')][_0x8d87('0x50')]({'plain':!![]});if(!_0x373357)throw new Error(_0x8d87('0x51'));if(_0x373357[_0x8d87('0x52')]===_0x8d87('0x4f')){var _0x113e62=_0x19b702[_0x8d87('0x50')]({'plain':!![]});var _0x4abe5b=_0x8d87('0x2a');return db[_0x8d87('0x53')][_0x8d87('0x54')]({'where':{'name':_0x4abe5b,'userProfileId':_0x373357[_0x8d87('0x55')]},'raw':!![]})[_0x8d87('0x28')](function(_0x3c9b96){if(_0x3c9b96&&_0x3c9b96[_0x8d87('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x113e62[_0x8d87('0x2d')],'resourceId':_0x113e62['id'],'type':_0x3c9b96['name'],'sectionId':_0x3c9b96['id']},{})['then'](function(){return _0x19b702;});}else{return _0x19b702;}})[_0x8d87('0x4a')](function(_0x53921b){logger[_0x8d87('0x57')](_0x8d87('0x58'),_0x53921b);throw _0x53921b;});}return _0x19b702;})['then'](respondWithResult(_0x24d782,0xc9))['catch'](handleError(_0x24d782,null));};exports[_0x8d87('0x27')]=function(_0x17c0d2,_0xbdf69a){if(_0x17c0d2[_0x8d87('0x4e')]['id']){delete _0x17c0d2[_0x8d87('0x4e')]['id'];}return db[_0x8d87('0x30')][_0x8d87('0x54')]({'where':{'id':_0x17c0d2[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0xbdf69a,null))[_0x8d87('0x28')](saveUpdates(_0x17c0d2['body'],null))['then'](respondWithResult(_0xbdf69a,null))[_0x8d87('0x4a')](handleError(_0xbdf69a,null));};exports[_0x8d87('0x29')]=function(_0x4e0e50,_0x3e3541){return db['OpenchannelQueue'][_0x8d87('0x54')]({'where':{'id':_0x4e0e50[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0x3e3541,null))[_0x8d87('0x28')](removeEntity(_0x3e3541,null))[_0x8d87('0x4a')](handleError(_0x3e3541,null));};exports[_0x8d87('0x59')]=function(_0x3ae8d2,_0x343fb3){return db[_0x8d87('0x30')][_0x8d87('0x59')]()[_0x8d87('0x28')](respondWithResult(_0x343fb3,null))[_0x8d87('0x4a')](handleError(_0x343fb3,null));};exports[_0x8d87('0x5a')]=function(_0x596c26,_0x209608,_0x3ac05b){var _0x20e843={'raw':!![],'where':{}},_0x5461b0={},_0x333944;return db[_0x8d87('0x30')][_0x8d87('0x5b')]({'where':{'id':_0x596c26['params']['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0x209608,null))[_0x8d87('0x28')](function(_0xe92019){if(_0xe92019){_0x333944=_0xe92019[_0x8d87('0x50')]({'plain':!![]});_0x5461b0[_0x8d87('0x32')]=_[_0x8d87('0x33')](db[_0x8d87('0x5c')][_0x8d87('0x31')]);_0x5461b0[_0x8d87('0x34')]=_[_0x8d87('0x33')](_0x596c26[_0x8d87('0x34')]);_0x5461b0['filters']=_[_0x8d87('0x35')](_0x5461b0[_0x8d87('0x32')],_0x5461b0[_0x8d87('0x34')]);_0x20e843[_0x8d87('0x36')]=_[_0x8d87('0x35')](_0x5461b0['model'],qs[_0x8d87('0x37')](_0x596c26[_0x8d87('0x34')][_0x8d87('0x37')]));_0x20e843[_0x8d87('0x36')]=_0x20e843[_0x8d87('0x36')][_0x8d87('0x38')]?_0x20e843[_0x8d87('0x36')]:_0x5461b0[_0x8d87('0x32')];if(!_0x596c26[_0x8d87('0x34')]['hasOwnProperty']('nolimit')){_0x20e843[_0x8d87('0x21')]=qs[_0x8d87('0x21')](_0x596c26['query'][_0x8d87('0x21')]);_0x20e843[_0x8d87('0x20')]=qs[_0x8d87('0x20')](_0x596c26[_0x8d87('0x34')][_0x8d87('0x20')]);}_0x20e843[_0x8d87('0x3b')]=qs[_0x8d87('0x3c')](_0x596c26[_0x8d87('0x34')][_0x8d87('0x3c')]);_0x20e843['where']=qs[_0x8d87('0x3e')](_[_0x8d87('0x3f')](_0x596c26[_0x8d87('0x34')],_0x5461b0[_0x8d87('0x3e')]));_0x20e843['where'][_0x8d87('0x5d')]=_0xe92019['id'];if(_0x596c26[_0x8d87('0x34')][_0x8d87('0x44')]){_0x20e843[_0x8d87('0x3d')]=_[_0x8d87('0x40')](_0x20e843[_0x8d87('0x3d')],{'$or':_[_0x8d87('0x41')](_0x20e843['attributes'],function(_0x354b57){var _0x48f6ba={};_0x48f6ba[_0x354b57]={'$like':'%'+_0x596c26['query'][_0x8d87('0x44')]+'%'};return _0x48f6ba;})});}_0x20e843=_['merge']({},_0x20e843,_0x596c26[_0x8d87('0x45')]);return db[_0x8d87('0x5c')][_0x8d87('0x48')](_0x20e843);}})[_0x8d87('0x28')](function(_0x45d99e){if(_0x45d99e){return db[_0x8d87('0x5e')][_0x8d87('0x5f')]({'where':{'id':_[_0x8d87('0x41')](_0x45d99e,_0x8d87('0x60')),'role':'agent'},'attributes':['id',_0x8d87('0x2d'),_0x8d87('0x61'),_0x8d87('0x62'),_0x8d87('0x63')]});}})[_0x8d87('0x28')](function(_0x4e8910){if(_0x4e8910){return{'count':_0x4e8910[_0x8d87('0x1f')],'rows':_[_0x8d87('0x41')](_0x4e8910[_0x8d87('0x49')],function(_0x50c466){return{'membername':_0x50c466[_0x8d87('0x2d')],'UserId':_0x50c466['id'],'queue_name':_0x333944[_0x8d87('0x2d')],'OpenchannelQueueId':_0x333944['id'],'interface':util[_0x8d87('0x64')](_0x8d87('0x65'),_0x8d87('0x66'),_0x50c466[_0x8d87('0x2d')]),'penalty':0x0,'paused':_0x50c466[_0x8d87('0x61')],'createdAt':_0x50c466[_0x8d87('0x63')],'updatedAt':_0x50c466[_0x8d87('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8d87('0x28')](respondWithFilteredResult(_0x209608,_0x20e843))[_0x8d87('0x4a')](handleError(_0x209608,null));};exports[_0x8d87('0x67')]=function(_0x4a4154,_0x34fb68,_0x3ca3dd){var _0x195135={};var _0x57955d={};var _0x10aed4;var _0x3b663d;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4a4154[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0x34fb68,null))['then'](function(_0x3d1d3e){if(_0x3d1d3e){_0x10aed4=_0x3d1d3e;_0x57955d['model']=_[_0x8d87('0x33')](db['Team'][_0x8d87('0x31')]);_0x57955d[_0x8d87('0x34')]=_[_0x8d87('0x33')](_0x4a4154[_0x8d87('0x34')]);_0x57955d[_0x8d87('0x3e')]=_['intersection'](_0x57955d[_0x8d87('0x32')],_0x57955d[_0x8d87('0x34')]);_0x195135[_0x8d87('0x36')]=_[_0x8d87('0x35')](_0x57955d[_0x8d87('0x32')],qs[_0x8d87('0x37')](_0x4a4154[_0x8d87('0x34')][_0x8d87('0x37')]));_0x195135['attributes']=_0x195135[_0x8d87('0x36')][_0x8d87('0x38')]?_0x195135[_0x8d87('0x36')]:_0x57955d['model'];_0x195135[_0x8d87('0x3b')]=qs[_0x8d87('0x3c')](_0x4a4154['query'][_0x8d87('0x3c')]);_0x195135[_0x8d87('0x3d')]=qs['filters'](_[_0x8d87('0x3f')](_0x4a4154[_0x8d87('0x34')],_0x57955d['filters']));if(_0x4a4154[_0x8d87('0x34')][_0x8d87('0x44')]){_0x195135[_0x8d87('0x3d')]=_[_0x8d87('0x40')](_0x195135[_0x8d87('0x3d')],{'$or':_['map'](_0x195135[_0x8d87('0x36')],function(_0xc21045){var _0x367422={};_0x367422[_0xc21045]={'$like':'%'+_0x4a4154[_0x8d87('0x34')][_0x8d87('0x44')]+'%'};return _0x367422;})});}_0x195135=_[_0x8d87('0x40')]({},_0x195135,_0x4a4154[_0x8d87('0x45')]);return _0x10aed4[_0x8d87('0x67')](_0x195135);}})[_0x8d87('0x28')](function(_0x27be1d){if(_0x27be1d){_0x3b663d=_0x27be1d[_0x8d87('0x38')];if(!_0x4a4154[_0x8d87('0x34')]['hasOwnProperty'](_0x8d87('0x3a'))){_0x195135[_0x8d87('0x21')]=qs[_0x8d87('0x21')](_0x4a4154[_0x8d87('0x34')]['limit']);_0x195135['offset']=qs[_0x8d87('0x20')](_0x4a4154[_0x8d87('0x34')][_0x8d87('0x20')]);}return _0x10aed4['getTeams'](_0x195135);}})[_0x8d87('0x28')](function(_0x28d7b4){if(_0x28d7b4){return _0x28d7b4?{'count':_0x3b663d,'rows':_0x28d7b4}:null;}})[_0x8d87('0x28')](respondWithResult(_0x34fb68,null))['catch'](handleError(_0x34fb68,null));};exports[_0x8d87('0x68')]=function(_0x590b64,_0x94ac0f,_0x488f74){var _0x51bec7=_0x590b64[_0x8d87('0x4e')][_0x8d87('0x69')];return db['Team'][_0x8d87('0x48')]({'where':{'id':_[_0x8d87('0x41')](_0x51bec7,'id')},'attributes':['id'],'include':[{'model':db[_0x8d87('0x5e')],'as':'Agents','attributes':['id',_0x8d87('0x2d'),'online',_0x8d87('0x6a'),_0x8d87('0x6b')],'raw':!![]}]})[_0x8d87('0x28')](function(_0x1ff7e2){if(_0x1ff7e2){var _0x255207=_[_0x8d87('0x6c')](_0x1ff7e2,function(_0x3b95bc){var _0x5a7f2b=_0x3b95bc[_0x8d87('0x50')]({'plain':!![]});return _0x5a7f2b[_0x8d87('0x6d')];});return db[_0x8d87('0x30')][_0x8d87('0x54')]({'where':{'id':_0x590b64[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](function(_0x3d1722){return db[_0x8d87('0x6e')][_0x8d87('0x6f')](function(_0x451e98){return _0x3d1722[_0x8d87('0x68')](_[_0x8d87('0x41')](_0x51bec7,'id'),{'transaction':_0x451e98})[_0x8d87('0x28')](function(){return BPromise[_0x8d87('0x70')](_0x255207,function(_0x5da294){return db[_0x8d87('0x5c')][_0x8d87('0x71')]({'where':{'UserId':_0x5da294['id'],'OpenchannelQueueId':_0x590b64['params']['id']},'transaction':_0x451e98});});})[_0x8d87('0x28')](function(){_0x255207[_0x8d87('0x72')](function(_0x261836){socket[_0x8d87('0x73')](_0x8d87('0x74'),{'UserId':_0x261836['id'],'OpenchannelQueueId':_0x3d1722['id']});});});});});}})[_0x8d87('0x28')](respondWithStatusCode(_0x94ac0f,null))[_0x8d87('0x4a')](handleError(_0x94ac0f,null));};exports[_0x8d87('0x75')]=function(_0x292501,_0x5b42d0,_0x59e030){return db['Team'][_0x8d87('0x48')]({'where':{'id':_0x292501['query'][_0x8d87('0x76')]},'attributes':['id'],'include':[{'model':db[_0x8d87('0x5e')],'as':_0x8d87('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b42d0,null))[_0x8d87('0x28')](function(_0x109600){var _0x4644eb=_[_0x8d87('0x41')](_0x109600,'id');var _0x2e1b1b=[];var _0x2b01a8=[];var _0x285b6e=squel[_0x8d87('0x77')]();_0x285b6e['field']('tq.TeamId')[_0x8d87('0x78')](_0x8d87('0x79'),'tq')[_0x8d87('0x7a')](_0x8d87('0x7b'),'ut',_0x8d87('0x7c'))[_0x8d87('0x3d')](_0x8d87('0x7d'),_0x292501[_0x8d87('0x4c')]['id']);for(var _0x33b271=0x0;_0x33b271<_0x109600[_0x8d87('0x38')];_0x33b271+=0x1){let _0x3b4ecd=_0x109600[_0x33b271];for(var _0x4d0f58=0x0;_0x4d0f58<_0x3b4ecd[_0x8d87('0x6d')][_0x8d87('0x38')];_0x4d0f58+=0x1){let _0x4a478b=_0x3b4ecd['Agents'][_0x4d0f58];var _0x2bf6aa=_0x285b6e['clone']();_0x2bf6aa[_0x8d87('0x3d')](_0x8d87('0x7e'),_0x4a478b['id']);_0x2b01a8[_0x8d87('0x7f')](db['sequelize'][_0x8d87('0x34')](_0x2bf6aa[_0x8d87('0x80')](),{'type':db[_0x8d87('0x6e')][_0x8d87('0x81')][_0x8d87('0x82')]})[_0x8d87('0x28')](function(_0x30bb60){if(_0x30bb60[_0x8d87('0x38')]===0x1){return _0x4a478b['id'];}else{var _0x1316a3=_['every'](_[_0x8d87('0x41')](_0x30bb60,_0x8d87('0x83')),function(_0x37910d){return _[_0x8d87('0x84')](_0x4644eb,_0x37910d);});if(_0x1316a3){return _0x4a478b['id'];}}}));}}return BPromise[_0x8d87('0x85')](_0x2b01a8)[_0x8d87('0x28')](function(_0x53fadc){_0x2e1b1b=_(_0x2e1b1b)[_0x8d87('0x86')](_0x53fadc)[_0x8d87('0x87')]()[_0x8d87('0x88')]();return db[_0x8d87('0x30')][_0x8d87('0x54')]({'where':{'id':_0x292501[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](function(_0x417dad){return db['sequelize'][_0x8d87('0x6f')](function(_0x263cdd){return _0x417dad[_0x8d87('0x75')](_0x292501[_0x8d87('0x34')][_0x8d87('0x76')],{'transaction':_0x263cdd})[_0x8d87('0x28')](function(){if(!_[_0x8d87('0x89')](_0x2e1b1b)){return _0x417dad[_0x8d87('0x8a')](_0x2e1b1b,{'transaction':_0x263cdd});}})[_0x8d87('0x28')](function(){_0x2e1b1b['forEach'](function(_0x568898){socket[_0x8d87('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x568898,'OpenchannelQueueId':_0x417dad['id']});});});});});});})[_0x8d87('0x28')](respondWithStatusCode(_0x5b42d0,null))[_0x8d87('0x4a')](handleError(_0x5b42d0,null));};exports['addAgents']=function(_0x58ce56,_0x1f9edb,_0x53ad58){return db['OpenchannelQueue'][_0x8d87('0x54')]({'where':{'id':_0x58ce56[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0x1f9edb,null))[_0x8d87('0x28')](function(_0x49d803){if(_0x49d803){return _0x49d803[_0x8d87('0x8b')](_0x58ce56['body'][_0x8d87('0x76')],_['omit'](_0x58ce56[_0x8d87('0x4e')],['ids','id'])||{})[_0x8d87('0x8c')](function(_0x3edbfb){for(var _0x417f82=0x0;_0x417f82<_0x58ce56[_0x8d87('0x4e')][_0x8d87('0x76')][_0x8d87('0x38')];_0x417f82+=0x1){socket[_0x8d87('0x73')](_0x8d87('0x74'),{'UserId':_0x58ce56[_0x8d87('0x4e')][_0x8d87('0x76')][_0x417f82],'OpenchannelQueueId':_0x58ce56['params']['id']});}return _0x3edbfb;});}})[_0x8d87('0x28')](respondWithResult(_0x1f9edb,null))[_0x8d87('0x4a')](handleError(_0x1f9edb,null));};exports[_0x8d87('0x8a')]=function(_0x574ed9,_0x2d6195,_0x463d7e){return db[_0x8d87('0x30')][_0x8d87('0x54')]({'where':{'id':_0x574ed9[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0x2d6195,null))[_0x8d87('0x28')](function(_0x54e33c){if(_0x54e33c){return _0x54e33c[_0x8d87('0x8a')](_0x574ed9[_0x8d87('0x34')]['ids'])['then'](function(){if(_[_0x8d87('0x8d')](_0x574ed9['query'][_0x8d87('0x76')])){for(var _0x5d3009=0x0;_0x5d3009<_0x574ed9['query']['ids']['length'];_0x5d3009+=0x1){socket[_0x8d87('0x73')](_0x8d87('0x8e'),{'UserId':Number(_0x574ed9[_0x8d87('0x34')][_0x8d87('0x76')][_0x5d3009]),'OpenchannelQueueId':Number(_0x574ed9[_0x8d87('0x4c')]['id'])});}}else{socket[_0x8d87('0x73')](_0x8d87('0x8e'),{'UserId':Number(_0x574ed9[_0x8d87('0x34')][_0x8d87('0x76')]),'OpenchannelQueueId':Number(_0x574ed9[_0x8d87('0x4c')]['id'])});}});}})[_0x8d87('0x28')](respondWithStatusCode(_0x2d6195,null))[_0x8d87('0x4a')](handleError(_0x2d6195,null));};exports[_0x8d87('0x8f')]=function(_0x3cb182,_0x55b25e,_0x16ac5e){var _0x383241={};var _0x170632={};var _0x13bb22;var _0x178b97;return db[_0x8d87('0x30')]['findOne']({'where':{'id':_0x3cb182[_0x8d87('0x4c')]['id']}})[_0x8d87('0x28')](handleEntityNotFound(_0x55b25e,null))[_0x8d87('0x28')](function(_0x44480d){if(_0x44480d){_0x13bb22=_0x44480d;_0x170632['model']=_[_0x8d87('0x33')](db[_0x8d87('0x5e')]['rawAttributes']);_0x170632['query']=_[_0x8d87('0x33')](_0x3cb182[_0x8d87('0x34')]);_0x170632['filters']=_[_0x8d87('0x35')](_0x170632[_0x8d87('0x32')],_0x170632[_0x8d87('0x34')]);_0x383241['attributes']=_[_0x8d87('0x35')](_0x170632[_0x8d87('0x32')],qs['fields'](_0x3cb182[_0x8d87('0x34')]['fields']));_0x383241[_0x8d87('0x36')]=_0x383241[_0x8d87('0x36')]['length']?_0x383241[_0x8d87('0x36')]:_0x170632[_0x8d87('0x32')];_0x383241['order']=qs[_0x8d87('0x3c')](_0x3cb182[_0x8d87('0x34')][_0x8d87('0x3c')]);_0x383241[_0x8d87('0x3d')]=qs[_0x8d87('0x3e')](_[_0x8d87('0x3f')](_0x3cb182[_0x8d87('0x34')],_0x170632[_0x8d87('0x3e')]));if(_0x3cb182[_0x8d87('0x34')][_0x8d87('0x44')]){_0x383241['where']=_['merge'](_0x383241[_0x8d87('0x3d')],{'$or':_[_0x8d87('0x41')](_0x383241[_0x8d87('0x36')],function(_0x41f2aa){var _0x5afc68={};_0x5afc68[_0x41f2aa]={'$like':'%'+_0x3cb182[_0x8d87('0x34')][_0x8d87('0x44')]+'%'};return _0x5afc68;})});}_0x383241=_['merge']({},_0x383241,_0x3cb182[_0x8d87('0x45')]);return _0x13bb22[_0x8d87('0x8f')](_0x383241);}})[_0x8d87('0x28')](function(_0x2605b4){if(_0x2605b4){_0x178b97=_0x2605b4[_0x8d87('0x38')];if(!_0x3cb182[_0x8d87('0x34')][_0x8d87('0x39')](_0x8d87('0x3a'))){_0x383241[_0x8d87('0x21')]=qs[_0x8d87('0x21')](_0x3cb182[_0x8d87('0x34')][_0x8d87('0x21')]);_0x383241[_0x8d87('0x20')]=qs[_0x8d87('0x20')](_0x3cb182[_0x8d87('0x34')][_0x8d87('0x20')]);}return _0x13bb22['getAgents'](_0x383241);}})[_0x8d87('0x28')](function(_0x4266b0){if(_0x4266b0){return _0x4266b0?{'count':_0x178b97,'rows':_0x4266b0}:null;}})[_0x8d87('0x28')](respondWithResult(_0x55b25e,null))['catch'](handleError(_0x55b25e,null));}; \ No newline at end of file +var _0x2651=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','findAll','User','findAndCountAll','agent','updatedAt','format','%s/%s','SIP','openchannelPause','createdAt','getTeams','findOne','Team','pick','addTeams','teams','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','TeamId','union','compact','value','ids','emit','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filter','merge','map','type','key','VIRTUAL','count','includeAll','rows','catch','show','options','find'];(function(_0x26d9ae,_0x419f79){var _0x48df97=function(_0x212031){while(--_0x212031){_0x26d9ae['push'](_0x26d9ae['shift']());}};_0x48df97(++_0x419f79);}(_0x2651,0xce));var _0x1265=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x2651[_0x166d93];return _0xba708;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1265('0x0'));var rimraf=require(_0x1265('0x1'));var zipdir=require(_0x1265('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1265('0x3'));var moment=require(_0x1265('0x4'));var BPromise=require(_0x1265('0x5'));var Mustache=require(_0x1265('0x6'));var util=require('util');var path=require(_0x1265('0x7'));var sox=require(_0x1265('0x8'));var csv=require(_0x1265('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1265('0xa'));var crypto=require(_0x1265('0xb'));var jsforce=require(_0x1265('0xc'));var deskjs=require(_0x1265('0xd'));var toCsv=require(_0x1265('0x9'));var querystring=require(_0x1265('0xe'));var Papa=require(_0x1265('0xf'));var Redis=require('ioredis');var authService=require(_0x1265('0x10'));var qs=require(_0x1265('0x11'));var hardwareService=require(_0x1265('0x12'));var logger=require(_0x1265('0x13'))(_0x1265('0x14'));var utils=require(_0x1265('0x15'));var config=require(_0x1265('0x16'));var db=require(_0x1265('0x17'))['db'];config[_0x1265('0x18')]=_['defaults'](config[_0x1265('0x18')],{'host':_0x1265('0x19'),'port':0x18eb});var socket=require(_0x1265('0x1a'))(new Redis(config[_0x1265('0x18')]));require(_0x1265('0x1b'))[_0x1265('0x1c')](socket);function respondWithStatusCode(_0x1e2ce4,_0x36dd30){_0x36dd30=_0x36dd30||0xcc;return function(_0x2ffb30){if(_0x2ffb30){return _0x1e2ce4[_0x1265('0x1d')](_0x36dd30);}return _0x1e2ce4[_0x1265('0x1e')](_0x36dd30)[_0x1265('0x1f')]();};}function respondWithResult(_0x86e194,_0x3b8051){_0x3b8051=_0x3b8051||0xc8;return function(_0x218af4){if(_0x218af4){return _0x86e194[_0x1265('0x1e')](_0x3b8051)[_0x1265('0x20')](_0x218af4);}};}function respondWithFilteredResult(_0x4edbe5,_0x485457){return function(_0x57a468){if(_0x57a468){var _0x3c12cc=_0x57a468['count'],_0x50504c=_0x485457[_0x1265('0x21')],_0x160004=_0x485457[_0x1265('0x21')]+_0x485457['limit'],_0x14d22f;if(_0x160004>=_0x3c12cc){_0x160004=_0x3c12cc;_0x14d22f=0xc8;}else{_0x14d22f=0xce;}_0x4edbe5[_0x1265('0x1e')](_0x14d22f);return _0x4edbe5[_0x1265('0x22')](_0x1265('0x23'),_0x50504c+'-'+_0x160004+'/'+_0x3c12cc)['json'](_0x57a468);}return null;};}function patchUpdates(_0x541d79){return function(_0x547235){try{jsonpatch['apply'](_0x547235,_0x541d79,!![]);}catch(_0x34bb63){return BPromise[_0x1265('0x24')](_0x34bb63);}return _0x547235[_0x1265('0x25')]();};}function saveUpdates(_0xe95c16,_0x572da6){return function(_0x4a3e6a){if(_0x4a3e6a){return _0x4a3e6a['update'](_0xe95c16)[_0x1265('0x26')](function(_0x149ec3){return _0x149ec3;});}return null;};}function removeEntity(_0x19c847,_0x5e67e0){return function(_0x3240ea){if(_0x3240ea){return _0x3240ea[_0x1265('0x27')]()['then'](function(){var _0x3d4aa6=_0x3240ea[_0x1265('0x28')]({'plain':!![]});var _0x5df5ab=_0x1265('0x29');return db[_0x1265('0x2a')]['destroy']({'where':{'type':_0x5df5ab,'resourceId':_0x3d4aa6['id']}})['then'](function(){return _0x3240ea;});})['then'](function(){_0x19c847[_0x1265('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2194b5,_0x49942a){return function(_0x39687d){if(!_0x39687d){_0x2194b5[_0x1265('0x1d')](0x194);}return _0x39687d;};}function handleError(_0x52b0b3,_0xa99953){_0xa99953=_0xa99953||0x1f4;return function(_0x293039){logger[_0x1265('0x2b')](_0x293039[_0x1265('0x2c')]);if(_0x293039[_0x1265('0x2d')]){delete _0x293039[_0x1265('0x2d')];}_0x52b0b3[_0x1265('0x1e')](_0xa99953)[_0x1265('0x2e')](_0x293039);};}exports[_0x1265('0x2f')]=function(_0x378ec6,_0x31a3c4){var _0x5d1673={},_0xc68354={},_0x34810f={'count':0x0,'rows':[]};var _0x264b69=db[_0x1265('0x30')][_0x1265('0x31')];_0xc68354[_0x1265('0x32')]=_[_0x1265('0x33')](_0x264b69);_0xc68354[_0x1265('0x34')]=_[_0x1265('0x33')](_0x378ec6[_0x1265('0x34')]);_0xc68354[_0x1265('0x35')]=_['intersection'](_0xc68354[_0x1265('0x32')],_0xc68354[_0x1265('0x34')]);_0x5d1673[_0x1265('0x36')]=_[_0x1265('0x37')](_0xc68354['model'],qs[_0x1265('0x38')](_0x378ec6[_0x1265('0x34')][_0x1265('0x38')]));_0x5d1673[_0x1265('0x36')]=_0x5d1673[_0x1265('0x36')][_0x1265('0x39')]?_0x5d1673[_0x1265('0x36')]:_0xc68354['model'];if(!_0x378ec6[_0x1265('0x34')]['hasOwnProperty'](_0x1265('0x3a'))){_0x5d1673[_0x1265('0x3b')]=qs['limit'](_0x378ec6[_0x1265('0x34')][_0x1265('0x3b')]);_0x5d1673[_0x1265('0x21')]=qs[_0x1265('0x21')](_0x378ec6[_0x1265('0x34')]['offset']);}_0x5d1673[_0x1265('0x3c')]=qs[_0x1265('0x3d')](_0x378ec6['query']['sort']);_0x5d1673[_0x1265('0x3e')]=qs[_0x1265('0x35')](_['pick'](_0x378ec6[_0x1265('0x34')],_0xc68354[_0x1265('0x35')]));if(_0x378ec6[_0x1265('0x34')][_0x1265('0x3f')]){_0x5d1673[_0x1265('0x3e')]=_[_0x1265('0x40')](_0x5d1673[_0x1265('0x3e')],{'$or':_[_0x1265('0x41')](_0x264b69,function(_0x5aaa4a){if(_0x5aaa4a[_0x1265('0x42')][_0x1265('0x43')]!==_0x1265('0x44')){var _0x15af31={};_0x15af31[_0x5aaa4a['field']]={'$like':'%'+_0x378ec6[_0x1265('0x34')][_0x1265('0x3f')]+'%'};return _0x15af31;}})});}_0x5d1673=_['merge']({},_0x5d1673,_0x378ec6['options']);var _0x35babf={'where':_0x5d1673[_0x1265('0x3e')]};return db[_0x1265('0x30')]['count'](_0x35babf)[_0x1265('0x26')](function(_0xd6eddd){_0x34810f[_0x1265('0x45')]=_0xd6eddd;if(_0x378ec6['query'][_0x1265('0x46')]){_0x5d1673['include']=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x5d1673);})[_0x1265('0x26')](function(_0x3f2467){_0x34810f[_0x1265('0x47')]=_0x3f2467;return _0x34810f;})[_0x1265('0x26')](respondWithFilteredResult(_0x31a3c4,_0x5d1673))[_0x1265('0x48')](handleError(_0x31a3c4,null));};exports[_0x1265('0x49')]=function(_0xfc6a0e,_0x3cbb24){var _0x5d04ab={'raw':!![],'where':{'id':_0xfc6a0e['params']['id']}},_0x52f885={};_0x52f885[_0x1265('0x32')]=_[_0x1265('0x33')](db[_0x1265('0x30')][_0x1265('0x31')]);_0x52f885[_0x1265('0x34')]=_['keys'](_0xfc6a0e['query']);_0x52f885[_0x1265('0x35')]=_[_0x1265('0x37')](_0x52f885['model'],_0x52f885['query']);_0x5d04ab[_0x1265('0x36')]=_['intersection'](_0x52f885[_0x1265('0x32')],qs[_0x1265('0x38')](_0xfc6a0e[_0x1265('0x34')]['fields']));_0x5d04ab[_0x1265('0x36')]=_0x5d04ab['attributes'][_0x1265('0x39')]?_0x5d04ab['attributes']:_0x52f885['model'];if(_0xfc6a0e['query'][_0x1265('0x46')]){_0x5d04ab['include']=[{'all':!![]}];}_0x5d04ab=_[_0x1265('0x40')]({},_0x5d04ab,_0xfc6a0e[_0x1265('0x4a')]);return db['OpenchannelQueue'][_0x1265('0x4b')](_0x5d04ab)[_0x1265('0x26')](handleEntityNotFound(_0x3cbb24,null))[_0x1265('0x26')](respondWithResult(_0x3cbb24,null))['catch'](handleError(_0x3cbb24,null));};exports[_0x1265('0x4c')]=function(_0x2075ee,_0x4d3322){return db['OpenchannelQueue'][_0x1265('0x4c')](_0x2075ee[_0x1265('0x4d')],{})[_0x1265('0x26')](function(_0x1b3123){var _0xd7a499=_0x2075ee[_0x1265('0x4e')][_0x1265('0x28')]({'plain':!![]});if(!_0xd7a499)throw new Error(_0x1265('0x4f'));if(_0xd7a499[_0x1265('0x50')]===_0x1265('0x4e')){var _0x1ba585=_0x1b3123[_0x1265('0x28')]({'plain':!![]});var _0x5a9448=_0x1265('0x29');return db[_0x1265('0x51')][_0x1265('0x4b')]({'where':{'name':_0x5a9448,'userProfileId':_0xd7a499['userProfileId']},'raw':!![]})['then'](function(_0x5916e5){if(_0x5916e5&&_0x5916e5['autoAssociation']===0x0){return db[_0x1265('0x2a')][_0x1265('0x4c')]({'name':_0x1ba585['name'],'resourceId':_0x1ba585['id'],'type':_0x5916e5['name'],'sectionId':_0x5916e5['id']},{})[_0x1265('0x26')](function(){return _0x1b3123;});}else{return _0x1b3123;}})[_0x1265('0x48')](function(_0x27b946){logger[_0x1265('0x2b')](_0x1265('0x52'),_0x27b946);throw _0x27b946;});}return _0x1b3123;})['then'](respondWithResult(_0x4d3322,0xc9))[_0x1265('0x48')](handleError(_0x4d3322,null));};exports[_0x1265('0x53')]=function(_0x5cf8ad,_0x1b69e0){if(_0x5cf8ad[_0x1265('0x4d')]['id']){delete _0x5cf8ad[_0x1265('0x4d')]['id'];}return db[_0x1265('0x30')][_0x1265('0x4b')]({'where':{'id':_0x5cf8ad[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x1b69e0,null))[_0x1265('0x26')](saveUpdates(_0x5cf8ad[_0x1265('0x4d')],null))[_0x1265('0x26')](respondWithResult(_0x1b69e0,null))[_0x1265('0x48')](handleError(_0x1b69e0,null));};exports['destroy']=function(_0x1d7a71,_0x430e5c){return db[_0x1265('0x30')][_0x1265('0x4b')]({'where':{'id':_0x1d7a71[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x430e5c,null))[_0x1265('0x26')](removeEntity(_0x430e5c,null))[_0x1265('0x48')](handleError(_0x430e5c,null));};exports[_0x1265('0x55')]=function(_0x8bfca6,_0x4aaedf){return db['OpenchannelQueue'][_0x1265('0x55')]()[_0x1265('0x26')](respondWithResult(_0x4aaedf,null))[_0x1265('0x48')](handleError(_0x4aaedf,null));};exports[_0x1265('0x56')]=function(_0x46ca4e,_0x57c38e,_0x4001ef){var _0x4ad7d3={'raw':!![],'where':{}},_0x29f7c9={},_0x1b49cb;return db[_0x1265('0x30')]['findOne']({'where':{'id':_0x46ca4e[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x57c38e,null))[_0x1265('0x26')](function(_0x15658e){if(_0x15658e){_0x1b49cb=_0x15658e[_0x1265('0x28')]({'plain':!![]});_0x29f7c9[_0x1265('0x32')]=_[_0x1265('0x33')](db[_0x1265('0x57')]['rawAttributes']);_0x29f7c9[_0x1265('0x34')]=_[_0x1265('0x33')](_0x46ca4e[_0x1265('0x34')]);_0x29f7c9[_0x1265('0x35')]=_[_0x1265('0x37')](_0x29f7c9[_0x1265('0x32')],_0x29f7c9['query']);_0x4ad7d3[_0x1265('0x36')]=_[_0x1265('0x37')](_0x29f7c9[_0x1265('0x32')],qs[_0x1265('0x38')](_0x46ca4e[_0x1265('0x34')][_0x1265('0x38')]));_0x4ad7d3[_0x1265('0x36')]=_0x4ad7d3[_0x1265('0x36')]['length']?_0x4ad7d3[_0x1265('0x36')]:_0x29f7c9[_0x1265('0x32')];if(!_0x46ca4e[_0x1265('0x34')][_0x1265('0x58')](_0x1265('0x3a'))){_0x4ad7d3[_0x1265('0x3b')]=qs['limit'](_0x46ca4e[_0x1265('0x34')][_0x1265('0x3b')]);_0x4ad7d3[_0x1265('0x21')]=qs['offset'](_0x46ca4e['query'][_0x1265('0x21')]);}_0x4ad7d3[_0x1265('0x3c')]=qs[_0x1265('0x3d')](_0x46ca4e['query'][_0x1265('0x3d')]);_0x4ad7d3['where']=qs[_0x1265('0x35')](_['pick'](_0x46ca4e[_0x1265('0x34')],_0x29f7c9[_0x1265('0x35')]));_0x4ad7d3[_0x1265('0x3e')][_0x1265('0x59')]=_0x15658e['id'];if(_0x46ca4e[_0x1265('0x34')][_0x1265('0x3f')]){_0x4ad7d3['where']=_['merge'](_0x4ad7d3[_0x1265('0x3e')],{'$or':_[_0x1265('0x41')](_0x4ad7d3[_0x1265('0x36')],function(_0x48f883){var _0x57a3c7={};_0x57a3c7[_0x48f883]={'$like':'%'+_0x46ca4e['query'][_0x1265('0x3f')]+'%'};return _0x57a3c7;})});}_0x4ad7d3=_[_0x1265('0x40')]({},_0x4ad7d3,_0x46ca4e[_0x1265('0x4a')]);return db[_0x1265('0x57')][_0x1265('0x5a')](_0x4ad7d3);}})[_0x1265('0x26')](function(_0x5ade14){if(_0x5ade14){return db[_0x1265('0x5b')][_0x1265('0x5c')]({'where':{'id':_[_0x1265('0x41')](_0x5ade14,'UserId'),'role':_0x1265('0x5d')},'attributes':['id',_0x1265('0x2d'),'openchannelPause',_0x1265('0x5e'),'createdAt']});}})['then'](function(_0x25539e){if(_0x25539e){return{'count':_0x25539e[_0x1265('0x45')],'rows':_[_0x1265('0x41')](_0x25539e[_0x1265('0x47')],function(_0xa2a519){return{'membername':_0xa2a519[_0x1265('0x2d')],'UserId':_0xa2a519['id'],'queue_name':_0x1b49cb[_0x1265('0x2d')],'OpenchannelQueueId':_0x1b49cb['id'],'interface':util[_0x1265('0x5f')](_0x1265('0x60'),_0x1265('0x61'),_0xa2a519['name']),'penalty':0x0,'paused':_0xa2a519[_0x1265('0x62')],'createdAt':_0xa2a519[_0x1265('0x63')],'updatedAt':_0xa2a519[_0x1265('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1265('0x26')](respondWithFilteredResult(_0x57c38e,_0x4ad7d3))['catch'](handleError(_0x57c38e,null));};exports[_0x1265('0x64')]=function(_0x59805e,_0x1f09b4,_0x573780){var _0x30c4ca={};var _0x1b5e48={};var _0x3a287c;var _0x335887;return db[_0x1265('0x30')][_0x1265('0x65')]({'where':{'id':_0x59805e[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x1f09b4,null))[_0x1265('0x26')](function(_0x570153){if(_0x570153){_0x3a287c=_0x570153;_0x1b5e48[_0x1265('0x32')]=_['keys'](db[_0x1265('0x66')][_0x1265('0x31')]);_0x1b5e48[_0x1265('0x34')]=_['keys'](_0x59805e[_0x1265('0x34')]);_0x1b5e48['filters']=_[_0x1265('0x37')](_0x1b5e48[_0x1265('0x32')],_0x1b5e48[_0x1265('0x34')]);_0x30c4ca['attributes']=_['intersection'](_0x1b5e48[_0x1265('0x32')],qs['fields'](_0x59805e[_0x1265('0x34')][_0x1265('0x38')]));_0x30c4ca[_0x1265('0x36')]=_0x30c4ca[_0x1265('0x36')][_0x1265('0x39')]?_0x30c4ca[_0x1265('0x36')]:_0x1b5e48[_0x1265('0x32')];_0x30c4ca[_0x1265('0x3c')]=qs[_0x1265('0x3d')](_0x59805e[_0x1265('0x34')][_0x1265('0x3d')]);_0x30c4ca[_0x1265('0x3e')]=qs[_0x1265('0x35')](_[_0x1265('0x67')](_0x59805e[_0x1265('0x34')],_0x1b5e48[_0x1265('0x35')]));if(_0x59805e[_0x1265('0x34')][_0x1265('0x3f')]){_0x30c4ca['where']=_[_0x1265('0x40')](_0x30c4ca[_0x1265('0x3e')],{'$or':_['map'](_0x30c4ca[_0x1265('0x36')],function(_0x3b31dc){var _0x4397a9={};_0x4397a9[_0x3b31dc]={'$like':'%'+_0x59805e['query'][_0x1265('0x3f')]+'%'};return _0x4397a9;})});}_0x30c4ca=_[_0x1265('0x40')]({},_0x30c4ca,_0x59805e[_0x1265('0x4a')]);return _0x3a287c[_0x1265('0x64')](_0x30c4ca);}})[_0x1265('0x26')](function(_0x1d2b79){if(_0x1d2b79){_0x335887=_0x1d2b79[_0x1265('0x39')];if(!_0x59805e[_0x1265('0x34')][_0x1265('0x58')]('nolimit')){_0x30c4ca[_0x1265('0x3b')]=qs[_0x1265('0x3b')](_0x59805e[_0x1265('0x34')][_0x1265('0x3b')]);_0x30c4ca['offset']=qs[_0x1265('0x21')](_0x59805e[_0x1265('0x34')][_0x1265('0x21')]);}return _0x3a287c[_0x1265('0x64')](_0x30c4ca);}})['then'](function(_0x4356c6){if(_0x4356c6){return _0x4356c6?{'count':_0x335887,'rows':_0x4356c6}:null;}})[_0x1265('0x26')](respondWithResult(_0x1f09b4,null))[_0x1265('0x48')](handleError(_0x1f09b4,null));};exports[_0x1265('0x68')]=function(_0x34b9ec,_0x36fd87,_0x36fab1){var _0x5f0b55=_0x34b9ec[_0x1265('0x4d')][_0x1265('0x69')];return db[_0x1265('0x66')][_0x1265('0x5a')]({'where':{'id':_['map'](_0x5f0b55,'id')},'attributes':['id'],'include':[{'model':db[_0x1265('0x5b')],'as':'Agents','attributes':['id',_0x1265('0x2d'),_0x1265('0x6a'),_0x1265('0x6b'),_0x1265('0x6c')],'raw':!![]}]})[_0x1265('0x26')](function(_0x332052){if(_0x332052){var _0x1826ce=_[_0x1265('0x6d')](_0x332052,function(_0x186f0f){var _0x5431ee=_0x186f0f[_0x1265('0x28')]({'plain':!![]});return _0x5431ee[_0x1265('0x6e')];});return db[_0x1265('0x30')][_0x1265('0x4b')]({'where':{'id':_0x34b9ec[_0x1265('0x54')]['id']}})[_0x1265('0x26')](function(_0x2fa183){return db[_0x1265('0x6f')][_0x1265('0x70')](function(_0x30d6fa){return _0x2fa183[_0x1265('0x68')](_[_0x1265('0x41')](_0x5f0b55,'id'),{'transaction':_0x30d6fa})['then'](function(){return BPromise[_0x1265('0x71')](_0x1826ce,function(_0x3aef32){return db[_0x1265('0x57')][_0x1265('0x72')]({'where':{'UserId':_0x3aef32['id'],'OpenchannelQueueId':_0x34b9ec['params']['id']},'transaction':_0x30d6fa});});})['then'](function(){_0x1826ce['forEach'](function(_0x243585){socket['emit'](_0x1265('0x73'),{'UserId':_0x243585['id'],'OpenchannelQueueId':_0x2fa183['id']});});});});});}})[_0x1265('0x26')](respondWithStatusCode(_0x36fd87,null))[_0x1265('0x48')](handleError(_0x36fd87,null));};exports[_0x1265('0x74')]=function(_0x345f5a,_0x10b8b1,_0x84a6fc){return db[_0x1265('0x66')]['findAll']({'where':{'id':_0x345f5a[_0x1265('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1265('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1265('0x26')](handleEntityNotFound(_0x10b8b1,null))['then'](function(_0x5cb332){var _0x105411=_[_0x1265('0x41')](_0x5cb332,'id');var _0x18e018=[];var _0x5d0f60=[];var _0xa1cac0=squel[_0x1265('0x75')]();_0xa1cac0[_0x1265('0x76')]('tq.TeamId')[_0x1265('0x77')](_0x1265('0x78'),'tq')[_0x1265('0x79')](_0x1265('0x7a'),'ut',_0x1265('0x7b'))[_0x1265('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x345f5a['params']['id']);for(var _0x32564e=0x0;_0x32564e<_0x5cb332[_0x1265('0x39')];_0x32564e+=0x1){let _0x4a6ddb=_0x5cb332[_0x32564e];for(var _0x16f15f=0x0;_0x16f15f<_0x4a6ddb[_0x1265('0x6e')][_0x1265('0x39')];_0x16f15f+=0x1){let _0x402444=_0x4a6ddb[_0x1265('0x6e')][_0x16f15f];var _0x27ead0=_0xa1cac0[_0x1265('0x7c')]();_0x27ead0[_0x1265('0x3e')]('ut.UserId\x20=\x20?',_0x402444['id']);_0x5d0f60[_0x1265('0x7d')](db[_0x1265('0x6f')][_0x1265('0x34')](_0x27ead0[_0x1265('0x7e')](),{'type':db[_0x1265('0x6f')]['QueryTypes'][_0x1265('0x7f')]})[_0x1265('0x26')](function(_0x171359){if(_0x171359[_0x1265('0x39')]===0x1){return _0x402444['id'];}else{var _0xa0c5d3=_[_0x1265('0x80')](_[_0x1265('0x41')](_0x171359,_0x1265('0x81')),function(_0x4ab756){return _['includes'](_0x105411,_0x4ab756);});if(_0xa0c5d3){return _0x402444['id'];}}}));}}return BPromise['all'](_0x5d0f60)[_0x1265('0x26')](function(_0xa604fa){_0x18e018=_(_0x18e018)[_0x1265('0x82')](_0xa604fa)[_0x1265('0x83')]()[_0x1265('0x84')]();return db['OpenchannelQueue'][_0x1265('0x4b')]({'where':{'id':_0x345f5a[_0x1265('0x54')]['id']}})[_0x1265('0x26')](function(_0x34c36f){return db[_0x1265('0x6f')][_0x1265('0x70')](function(_0x11c995){return _0x34c36f[_0x1265('0x74')](_0x345f5a[_0x1265('0x34')][_0x1265('0x85')],{'transaction':_0x11c995})['then'](function(){if(!_['isEmpty'](_0x18e018)){return _0x34c36f['removeAgents'](_0x18e018,{'transaction':_0x11c995});}})['then'](function(){_0x18e018['forEach'](function(_0x3977cf){socket[_0x1265('0x86')](_0x1265('0x87'),{'UserId':_0x3977cf,'OpenchannelQueueId':_0x34c36f['id']});});});});});});})[_0x1265('0x26')](respondWithStatusCode(_0x10b8b1,null))[_0x1265('0x48')](handleError(_0x10b8b1,null));};exports[_0x1265('0x88')]=function(_0x3b988a,_0x39a094,_0x13049a){return db['OpenchannelQueue'][_0x1265('0x4b')]({'where':{'id':_0x3b988a[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x39a094,null))['then'](function(_0x43da46){if(_0x43da46){return _0x43da46[_0x1265('0x88')](_0x3b988a[_0x1265('0x4d')][_0x1265('0x85')],_[_0x1265('0x89')](_0x3b988a[_0x1265('0x4d')],[_0x1265('0x85'),'id'])||{})[_0x1265('0x8a')](function(_0xae629a){for(var _0x149c8a=0x0;_0x149c8a<_0x3b988a[_0x1265('0x4d')][_0x1265('0x85')][_0x1265('0x39')];_0x149c8a+=0x1){socket[_0x1265('0x86')](_0x1265('0x73'),{'UserId':_0x3b988a[_0x1265('0x4d')][_0x1265('0x85')][_0x149c8a],'OpenchannelQueueId':_0x3b988a[_0x1265('0x54')]['id']});}return _0xae629a;});}})[_0x1265('0x26')](respondWithResult(_0x39a094,null))[_0x1265('0x48')](handleError(_0x39a094,null));};exports[_0x1265('0x8b')]=function(_0x19a8fc,_0x5c9ba9,_0x2bba4a){return db[_0x1265('0x30')][_0x1265('0x4b')]({'where':{'id':_0x19a8fc[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x5c9ba9,null))['then'](function(_0x5b7da0){if(_0x5b7da0){return _0x5b7da0[_0x1265('0x8b')](_0x19a8fc[_0x1265('0x34')][_0x1265('0x85')])[_0x1265('0x26')](function(){if(_['isArray'](_0x19a8fc[_0x1265('0x34')][_0x1265('0x85')])){for(var _0x2efe0c=0x0;_0x2efe0c<_0x19a8fc[_0x1265('0x34')]['ids'][_0x1265('0x39')];_0x2efe0c+=0x1){socket[_0x1265('0x86')](_0x1265('0x87'),{'UserId':Number(_0x19a8fc[_0x1265('0x34')][_0x1265('0x85')][_0x2efe0c]),'OpenchannelQueueId':Number(_0x19a8fc[_0x1265('0x54')]['id'])});}}else{socket[_0x1265('0x86')](_0x1265('0x87'),{'UserId':Number(_0x19a8fc['query']['ids']),'OpenchannelQueueId':Number(_0x19a8fc['params']['id'])});}});}})[_0x1265('0x26')](respondWithStatusCode(_0x5c9ba9,null))[_0x1265('0x48')](handleError(_0x5c9ba9,null));};exports[_0x1265('0x8c')]=function(_0x54c2ef,_0x504661,_0x2b98e8){var _0x8e4ba5={};var _0x451665={};var _0x3e8932;var _0x1089b4;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x54c2ef[_0x1265('0x54')]['id']}})[_0x1265('0x26')](handleEntityNotFound(_0x504661,null))[_0x1265('0x26')](function(_0x3c8a6b){if(_0x3c8a6b){_0x3e8932=_0x3c8a6b;_0x451665[_0x1265('0x32')]=_['keys'](db[_0x1265('0x5b')][_0x1265('0x31')]);_0x451665['query']=_[_0x1265('0x33')](_0x54c2ef[_0x1265('0x34')]);_0x451665[_0x1265('0x35')]=_[_0x1265('0x37')](_0x451665[_0x1265('0x32')],_0x451665[_0x1265('0x34')]);_0x8e4ba5['attributes']=_['intersection'](_0x451665[_0x1265('0x32')],qs[_0x1265('0x38')](_0x54c2ef['query']['fields']));_0x8e4ba5[_0x1265('0x36')]=_0x8e4ba5[_0x1265('0x36')][_0x1265('0x39')]?_0x8e4ba5['attributes']:_0x451665[_0x1265('0x32')];_0x8e4ba5[_0x1265('0x3c')]=qs[_0x1265('0x3d')](_0x54c2ef[_0x1265('0x34')][_0x1265('0x3d')]);_0x8e4ba5[_0x1265('0x3e')]=qs[_0x1265('0x35')](_['pick'](_0x54c2ef[_0x1265('0x34')],_0x451665[_0x1265('0x35')]));if(_0x54c2ef[_0x1265('0x34')][_0x1265('0x3f')]){_0x8e4ba5[_0x1265('0x3e')]=_['merge'](_0x8e4ba5[_0x1265('0x3e')],{'$or':_['map'](_0x8e4ba5[_0x1265('0x36')],function(_0x13beb1){var _0x20dec0={};_0x20dec0[_0x13beb1]={'$like':'%'+_0x54c2ef['query'][_0x1265('0x3f')]+'%'};return _0x20dec0;})});}_0x8e4ba5=_[_0x1265('0x40')]({},_0x8e4ba5,_0x54c2ef[_0x1265('0x4a')]);return _0x3e8932[_0x1265('0x8c')](_0x8e4ba5);}})[_0x1265('0x26')](function(_0x5af40d){if(_0x5af40d){_0x1089b4=_0x5af40d[_0x1265('0x39')];if(!_0x54c2ef[_0x1265('0x34')][_0x1265('0x58')](_0x1265('0x3a'))){_0x8e4ba5[_0x1265('0x3b')]=qs[_0x1265('0x3b')](_0x54c2ef[_0x1265('0x34')]['limit']);_0x8e4ba5[_0x1265('0x21')]=qs[_0x1265('0x21')](_0x54c2ef[_0x1265('0x34')][_0x1265('0x21')]);}return _0x3e8932[_0x1265('0x8c')](_0x8e4ba5);}})[_0x1265('0x26')](function(_0x2cec4b){if(_0x2cec4b){return _0x2cec4b?{'count':_0x1089b4,'rows':_0x2cec4b}:null;}})[_0x1265('0x26')](respondWithResult(_0x504661,null))[_0x1265('0x48')](handleError(_0x504661,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 915306a..a3b8d5c 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 _0x10c9=['save','update','emit','hasOwnProperty','hook','events','OpenchannelQueue','setMaxListeners'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x10c9,0x18d));var _0x910c=function(_0x23e0f4,_0x271718){_0x23e0f4=_0x23e0f4-0x0;var _0x5756bc=_0x10c9[_0x23e0f4];return _0x5756bc;};'use strict';var EventEmitter=require(_0x910c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x910c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x910c('0x2')](0x0);var events={'afterCreate':_0x910c('0x3'),'afterUpdate':_0x910c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59e333){return function(_0x3a1126,_0x20f7f9,_0x3f85f1){OpenchannelQueueEvents[_0x910c('0x5')](_0x59e333+':'+_0x3a1126['id'],_0x3a1126);OpenchannelQueueEvents[_0x910c('0x5')](_0x59e333,_0x3a1126);_0x3f85f1(null);};}for(var e in events){if(events[_0x910c('0x6')](e)){var event=events[e];OpenchannelQueue[_0x910c('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xa259=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xa259,0x198));var _0x9a25=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xa259[_0x589aee];return _0x2f5ed4;};'use strict';var EventEmitter=require(_0x9a25('0x0'));var OpenchannelQueue=require(_0x9a25('0x1'))['db'][_0x9a25('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9a25('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4b8708){return function(_0x41695a,_0x573a83,_0x5c1fa3){OpenchannelQueueEvents[_0x9a25('0x4')](_0x4b8708+':'+_0x41695a['id'],_0x41695a);OpenchannelQueueEvents[_0x9a25('0x4')](_0x4b8708,_0x41695a);_0x5c1fa3(null);};}for(var e in events){if(events[_0x9a25('0x5')](e)){var event=events[e];OpenchannelQueue[_0x9a25('0x6')](e,emitEvent(event));}}module[_0x9a25('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 20d8ac1..c937d56 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 _0x0845=['path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api','moment'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x0845,0xd7));var _0x5084=function(_0x21fb98,_0x3fce24){_0x21fb98=_0x21fb98-0x0;var _0x3974c1=_0x0845[_0x21fb98];return _0x3974c1;};'use strict';var _=require(_0x5084('0x0'));var util=require(_0x5084('0x1'));var logger=require(_0x5084('0x2'))(_0x5084('0x3'));var moment=require(_0x5084('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5084('0x5'));var rimraf=require(_0x5084('0x6'));var config=require('../../config/environment');var attributes=require(_0x5084('0x7'));module[_0x5084('0x8')]=function(_0x53f9fa,_0x196325){return _0x53f9fa[_0x5084('0x9')](_0x5084('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1637=['openchannel_queues','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x1637,0x6f));var _0x7163=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x1637[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x7163('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7163('0x1'));var moment=require(_0x7163('0x2'));var BPromise=require(_0x7163('0x3'));var rp=require(_0x7163('0x4'));var fs=require('fs');var path=require(_0x7163('0x5'));var rimraf=require('rimraf');var config=require(_0x7163('0x6'));var attributes=require(_0x7163('0x7'));module[_0x7163('0x8')]=function(_0x550ac5,_0x55d93b){return _0x550ac5['define']('OpenchannelQueue',attributes,{'tableName':_0x7163('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 7ffc8c9..6e4c002 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 _0xb903=['http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xadb836,_0xcf09c1){var _0x581385=function(_0x270db4){while(--_0x270db4){_0xadb836['push'](_0xadb836['shift']());}};_0x581385(++_0xcf09c1);}(_0xb903,0x185));var _0x3b90=function(_0x263472,_0x3f503d){_0x263472=_0x263472-0x0;var _0x509806=_0xb903[_0x263472];return _0x509806;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3b90('0xc')],{'host':_0x3b90('0xd'),'port':0x18eb});var socket=require(_0x3b90('0xe'))(new Redis(config[_0x3b90('0xc')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x52401e,_0x51f916,_0x56261b){return new BPromise(function(_0x55db3f,_0x336913){return client[_0x3b90('0xf')](_0x52401e,_0x56261b)['then'](function(_0x30c49c){logger[_0x3b90('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));logger[_0x3b90('0x12')](_0x3b90('0x13'),_0x51f916,'request\x20sent',JSON['stringify'](_0x30c49c));if(_0x30c49c[_0x3b90('0x14')]){if(_0x30c49c['error']['code']===0x1f4){logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c['error']['message']);return _0x336913(_0x30c49c[_0x3b90('0x14')][_0x3b90('0x16')]);}logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c[_0x3b90('0x14')]['message']);return _0x55db3f(_0x30c49c['error'][_0x3b90('0x16')]);}else{logger[_0x3b90('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));_0x55db3f(_0x30c49c[_0x3b90('0x17')][_0x3b90('0x16')]);}})[_0x3b90('0x18')](function(_0x4f388b){logger[_0x3b90('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x51f916,_0x4f388b);_0x336913(_0x4f388b);});});}exports[_0x3b90('0x19')]=function(_0x231690){var _0x535894=this;return new Promise(function(_0x39ae7c,_0x12e1cf){return db[_0x3b90('0x1a')][_0x3b90('0x1b')]({'raw':_0x231690[_0x3b90('0x1c')]?_0x231690[_0x3b90('0x1c')][_0x3b90('0x1d')]===undefined?!![]:![]:!![],'where':_0x231690[_0x3b90('0x1c')]?_0x231690[_0x3b90('0x1c')][_0x3b90('0x1e')]||null:null,'attributes':_0x231690['options']?_0x231690[_0x3b90('0x1c')][_0x3b90('0x1f')]||null:null,'limit':_0x231690[_0x3b90('0x1c')]?_0x231690[_0x3b90('0x1c')][_0x3b90('0x20')]||null:null,'include':_0x231690[_0x3b90('0x1c')]?_0x231690['options']['include']?_[_0x3b90('0x21')](_0x231690[_0x3b90('0x1c')][_0x3b90('0x22')],function(_0x2ffa1a){return{'model':db[_0x2ffa1a['model']],'as':_0x2ffa1a['as'],'attributes':_0x2ffa1a[_0x3b90('0x1f')],'include':_0x2ffa1a[_0x3b90('0x22')]?_[_0x3b90('0x21')](_0x2ffa1a['include'],function(_0x14752c){return{'model':db[_0x14752c[_0x3b90('0x23')]],'as':_0x14752c['as'],'attributes':_0x14752c[_0x3b90('0x1f')],'include':_0x14752c[_0x3b90('0x22')]?_[_0x3b90('0x21')](_0x14752c[_0x3b90('0x22')],function(_0x4b4d33){return{'model':db[_0x4b4d33[_0x3b90('0x23')]],'as':_0x4b4d33['as'],'attributes':_0x4b4d33['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b90('0x24')](function(_0x9891e4){logger[_0x3b90('0x10')](_0x3b90('0x19'),_0x231690);logger[_0x3b90('0x12')](_0x3b90('0x19'),_0x231690,JSON[_0x3b90('0x25')](_0x9891e4));_0x39ae7c(_0x9891e4);})[_0x3b90('0x18')](function(_0x500ceb){logger['error'](_0x3b90('0x19'),_0x500ceb[_0x3b90('0x16')],_0x231690);_0x12e1cf(_0x535894[_0x3b90('0x14')](0x1f4,_0x500ceb[_0x3b90('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x543458){var _0xd33ac9=this;return new Promise(function(_0x412a0f,_0x24d5c9){return db['OpenchannelQueue'][_0x3b90('0x26')]({'raw':_0x543458['options']?_0x543458['options'][_0x3b90('0x1d')]===undefined?!![]:![]:!![],'where':_0x543458[_0x3b90('0x1c')]?_0x543458['options'][_0x3b90('0x1e')]||null:null,'attributes':_0x543458[_0x3b90('0x1c')]?_0x543458[_0x3b90('0x1c')]['attributes']||null:null,'include':_0x543458['options']?_0x543458[_0x3b90('0x1c')][_0x3b90('0x22')]?_[_0x3b90('0x21')](_0x543458[_0x3b90('0x1c')]['include'],function(_0x5a97fe){return{'model':db[_0x5a97fe[_0x3b90('0x23')]],'as':_0x5a97fe['as'],'attributes':_0x5a97fe[_0x3b90('0x1f')],'include':_0x5a97fe['include']?_['map'](_0x5a97fe[_0x3b90('0x22')],function(_0x146bc7){return{'model':db[_0x146bc7[_0x3b90('0x23')]],'as':_0x146bc7['as'],'attributes':_0x146bc7[_0x3b90('0x1f')],'include':_0x146bc7['include']?_[_0x3b90('0x21')](_0x146bc7['include'],function(_0x19533a){return{'model':db[_0x19533a[_0x3b90('0x23')]],'as':_0x19533a['as'],'attributes':_0x19533a[_0x3b90('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x24')](function(_0x2cbae8){logger[_0x3b90('0x10')](_0x3b90('0x27'),_0x543458);logger['debug'](_0x3b90('0x27'),_0x543458,JSON[_0x3b90('0x25')](_0x2cbae8));_0x412a0f(_0x2cbae8);})[_0x3b90('0x18')](function(_0x303922){logger[_0x3b90('0x14')](_0x3b90('0x27'),_0x303922[_0x3b90('0x16')],_0x543458);_0x24d5c9(_0xd33ac9[_0x3b90('0x14')](0x1f4,_0x303922[_0x3b90('0x16')]));});});}; \ No newline at end of file +var _0x07c3=['code','message','info','request\x20sent','result','catch','OpenchannelQueue','options','attributes','limit','include','map','model','GetOpenchannelQueue','find','raw','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55c7ea,_0x17eeaf){var _0x31bdf3=function(_0x25c98a){while(--_0x25c98a){_0x55c7ea['push'](_0x55c7ea['shift']());}};_0x31bdf3(++_0x17eeaf);}(_0x07c3,0x1bf));var _0x307c=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0x07c3[_0x1ce9ea];return _0x2a95b9;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var moment=require(_0x307c('0x2'));var BPromise=require(_0x307c('0x3'));var rs=require(_0x307c('0x4'));var fs=require('fs');var Redis=require(_0x307c('0x5'));var db=require(_0x307c('0x6'))['db'];var utils=require(_0x307c('0x7'));var logger=require('../../config/logger')(_0x307c('0x8'));var config=require(_0x307c('0x9'));var jayson=require(_0x307c('0xa'));var client=jayson[_0x307c('0xb')][_0x307c('0xc')]({'port':0x232a});config[_0x307c('0xd')]=_[_0x307c('0xe')](config[_0x307c('0xd')],{'host':_0x307c('0xf'),'port':0x18eb});var socket=require(_0x307c('0x10'))(new Redis(config[_0x307c('0xd')]));require(_0x307c('0x11'))[_0x307c('0x12')](socket);function respondWithRpcPromise(_0x352f5a,_0x3c4a4c,_0x5d2d0f){return new BPromise(function(_0x8777ee,_0xe8236d){return client[_0x307c('0x13')](_0x352f5a,_0x5d2d0f)[_0x307c('0x14')](function(_0x4c1b82){logger['info'](_0x307c('0x15'),_0x3c4a4c,'request\x20sent');logger[_0x307c('0x16')](_0x307c('0x17'),_0x3c4a4c,'request\x20sent',JSON[_0x307c('0x18')](_0x4c1b82));if(_0x4c1b82[_0x307c('0x19')]){if(_0x4c1b82[_0x307c('0x19')][_0x307c('0x1a')]===0x1f4){logger[_0x307c('0x19')](_0x307c('0x15'),_0x3c4a4c,_0x4c1b82[_0x307c('0x19')][_0x307c('0x1b')]);return _0xe8236d(_0x4c1b82[_0x307c('0x19')][_0x307c('0x1b')]);}logger[_0x307c('0x19')](_0x307c('0x15'),_0x3c4a4c,_0x4c1b82['error'][_0x307c('0x1b')]);return _0x8777ee(_0x4c1b82[_0x307c('0x19')][_0x307c('0x1b')]);}else{logger[_0x307c('0x1c')](_0x307c('0x15'),_0x3c4a4c,_0x307c('0x1d'));_0x8777ee(_0x4c1b82[_0x307c('0x1e')][_0x307c('0x1b')]);}})[_0x307c('0x1f')](function(_0x5e03d0){logger['error'](_0x307c('0x15'),_0x3c4a4c,_0x5e03d0);_0xe8236d(_0x5e03d0);});});}exports['GetOpenchannelQueue']=function(_0x409e5b){var _0x5dafd3=this;return new Promise(function(_0x4cf649,_0x4bcc1a){return db[_0x307c('0x20')]['findAll']({'raw':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')]['where']||null:null,'attributes':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')][_0x307c('0x22')]||null:null,'limit':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')][_0x307c('0x23')]||null:null,'include':_0x409e5b[_0x307c('0x21')]?_0x409e5b[_0x307c('0x21')][_0x307c('0x24')]?_[_0x307c('0x25')](_0x409e5b['options'][_0x307c('0x24')],function(_0x58c383){return{'model':db[_0x58c383['model']],'as':_0x58c383['as'],'attributes':_0x58c383[_0x307c('0x22')],'include':_0x58c383[_0x307c('0x24')]?_[_0x307c('0x25')](_0x58c383[_0x307c('0x24')],function(_0x25dede){return{'model':db[_0x25dede[_0x307c('0x26')]],'as':_0x25dede['as'],'attributes':_0x25dede['attributes'],'include':_0x25dede[_0x307c('0x24')]?_[_0x307c('0x25')](_0x25dede[_0x307c('0x24')],function(_0x54da33){return{'model':db[_0x54da33[_0x307c('0x26')]],'as':_0x54da33['as'],'attributes':_0x54da33[_0x307c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x307c('0x14')](function(_0x12d9a9){logger[_0x307c('0x1c')](_0x307c('0x27'),_0x409e5b);logger['debug'](_0x307c('0x27'),_0x409e5b,JSON[_0x307c('0x18')](_0x12d9a9));_0x4cf649(_0x12d9a9);})[_0x307c('0x1f')](function(_0x313fcf){logger[_0x307c('0x19')](_0x307c('0x27'),_0x313fcf[_0x307c('0x1b')],_0x409e5b);_0x4bcc1a(_0x5dafd3[_0x307c('0x19')](0x1f4,_0x313fcf[_0x307c('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x29c0c4){var _0x1985fb=this;return new Promise(function(_0x325961,_0x1a706a){return db[_0x307c('0x20')][_0x307c('0x28')]({'raw':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')][_0x307c('0x29')]===undefined?!![]:![]:!![],'where':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')]['where']||null:null,'attributes':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')]['attributes']||null:null,'include':_0x29c0c4[_0x307c('0x21')]?_0x29c0c4[_0x307c('0x21')]['include']?_[_0x307c('0x25')](_0x29c0c4['options'][_0x307c('0x24')],function(_0x246a20){return{'model':db[_0x246a20[_0x307c('0x26')]],'as':_0x246a20['as'],'attributes':_0x246a20[_0x307c('0x22')],'include':_0x246a20[_0x307c('0x24')]?_[_0x307c('0x25')](_0x246a20[_0x307c('0x24')],function(_0x4a9adb){return{'model':db[_0x4a9adb[_0x307c('0x26')]],'as':_0x4a9adb['as'],'attributes':_0x4a9adb[_0x307c('0x22')],'include':_0x4a9adb[_0x307c('0x24')]?_[_0x307c('0x25')](_0x4a9adb[_0x307c('0x24')],function(_0x1b7575){return{'model':db[_0x1b7575[_0x307c('0x26')]],'as':_0x1b7575['as'],'attributes':_0x1b7575['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x549aee){logger[_0x307c('0x1c')](_0x307c('0x2a'),_0x29c0c4);logger[_0x307c('0x16')]('ShowOpenchannelQueue',_0x29c0c4,JSON[_0x307c('0x18')](_0x549aee));_0x325961(_0x549aee);})['catch'](function(_0x3d14c8){logger[_0x307c('0x19')](_0x307c('0x2a'),_0x3d14c8[_0x307c('0x1b')],_0x29c0c4);_0x1a706a(_0x1985fb[_0x307c('0x19')](0x1f4,_0x3d14c8[_0x307c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0e3d9fd..589993c 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 _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.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(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a6b1c04..73fac53 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1b323eb..5114a1c 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 _0x9c98=['exports','STRING','DATE','sequelize'];(function(_0x442094,_0x216348){var _0x22f551=function(_0x5934e6){while(--_0x5934e6){_0x442094['push'](_0x442094['shift']());}};_0x22f551(++_0x216348);}(_0x9c98,0xeb));var _0x89c9=function(_0x3375e1,_0x59fb28){_0x3375e1=_0x3375e1-0x0;var _0x2e9c66=_0x9c98[_0x3375e1];return _0x2e9c66;};'use strict';var moment=require('moment');var Sequelize=require(_0x89c9('0x0'));module[_0x89c9('0x1')]={'uniqueid':{'type':Sequelize[_0x89c9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x89c9('0x2')]},'joinAt':{'type':Sequelize[_0x89c9('0x3')]},'leaveAt':{'type':Sequelize[_0x89c9('0x3')]},'acceptAt':{'type':Sequelize[_0x89c9('0x3')]},'exitAt':{'type':Sequelize[_0x89c9('0x3')]},'reason':{'type':Sequelize[_0x89c9('0x2')]}}; \ No newline at end of file +var _0xdfb8=['sequelize','STRING','DATE','moment'];(function(_0x68602,_0x4cfb8d){var _0x690b25=function(_0x5bdeab){while(--_0x5bdeab){_0x68602['push'](_0x68602['shift']());}};_0x690b25(++_0x4cfb8d);}(_0xdfb8,0x113));var _0x8dfb=function(_0xdea1ee,_0x2d2841){_0xdea1ee=_0xdea1ee-0x0;var _0x96c530=_0xdfb8[_0xdea1ee];return _0x96c530;};'use strict';var moment=require(_0x8dfb('0x0'));var Sequelize=require(_0x8dfb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8dfb('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8dfb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8dfb('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 4859bb2..21770a3 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 _0xd935=['include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus','name','index','OpenchannelQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','show','length'];(function(_0x352398,_0x1f0f16){var _0x2d57f8=function(_0x4e7f78){while(--_0x4e7f78){_0x352398['push'](_0x352398['shift']());}};_0x2d57f8(++_0x1f0f16);}(_0xd935,0xd7));var _0x5d93=function(_0x1fd6f7,_0xab186b){_0x1fd6f7=_0x1fd6f7-0x0;var _0x3fac2b=_0xd935[_0x1fd6f7];return _0x3fac2b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5d93('0x0'));var zipdir=require(_0x5d93('0x1'));var jsonpatch=require(_0x5d93('0x2'));var rp=require(_0x5d93('0x3'));var moment=require(_0x5d93('0x4'));var BPromise=require(_0x5d93('0x5'));var Mustache=require(_0x5d93('0x6'));var util=require(_0x5d93('0x7'));var path=require(_0x5d93('0x8'));var sox=require(_0x5d93('0x9'));var csv=require(_0x5d93('0xa'));var ejs=require(_0x5d93('0xb'));var fs=require('fs');var _=require(_0x5d93('0xc'));var squel=require('squel');var crypto=require(_0x5d93('0xd'));var jsforce=require(_0x5d93('0xe'));var deskjs=require(_0x5d93('0xf'));var toCsv=require(_0x5d93('0xa'));var querystring=require(_0x5d93('0x10'));var Papa=require(_0x5d93('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x5d93('0x12'));var logger=require(_0x5d93('0x13'))('api');var utils=require(_0x5d93('0x14'));var config=require(_0x5d93('0x15'));var db=require(_0x5d93('0x16'))['db'];function respondWithStatusCode(_0x2bfd91,_0x21979a){_0x21979a=_0x21979a||0xcc;return function(_0x40bed2){if(_0x40bed2){return _0x2bfd91['sendStatus'](_0x21979a);}return _0x2bfd91[_0x5d93('0x17')](_0x21979a)[_0x5d93('0x18')]();};}function respondWithResult(_0x2f5327,_0x38a116){_0x38a116=_0x38a116||0xc8;return function(_0x4b3d68){if(_0x4b3d68){return _0x2f5327[_0x5d93('0x17')](_0x38a116)[_0x5d93('0x19')](_0x4b3d68);}};}function respondWithFilteredResult(_0x2af496,_0xfe0160){return function(_0x50e37b){if(_0x50e37b){var _0x53578f=_0x50e37b['count'],_0x56ecbf=_0xfe0160['offset'],_0x497516=_0xfe0160[_0x5d93('0x1a')]+_0xfe0160[_0x5d93('0x1b')],_0xf2df1;if(_0x497516>=_0x53578f){_0x497516=_0x53578f;_0xf2df1=0xc8;}else{_0xf2df1=0xce;}_0x2af496[_0x5d93('0x17')](_0xf2df1);return _0x2af496['set'](_0x5d93('0x1c'),_0x56ecbf+'-'+_0x497516+'/'+_0x53578f)[_0x5d93('0x19')](_0x50e37b);}return null;};}function patchUpdates(_0x310472){return function(_0x8c74d3){try{jsonpatch['apply'](_0x8c74d3,_0x310472,!![]);}catch(_0xbc9738){return BPromise[_0x5d93('0x1d')](_0xbc9738);}return _0x8c74d3[_0x5d93('0x1e')]();};}function saveUpdates(_0x17d58e,_0x50282a){return function(_0x46dc39){if(_0x46dc39){return _0x46dc39[_0x5d93('0x1f')](_0x17d58e)[_0x5d93('0x20')](function(_0x21031f){return _0x21031f;});}return null;};}function removeEntity(_0x1b87cb,_0x2be15f){return function(_0x37acc0){if(_0x37acc0){return _0x37acc0[_0x5d93('0x21')]()[_0x5d93('0x20')](function(){_0x1b87cb['status'](0xcc)[_0x5d93('0x18')]();});}};}function handleEntityNotFound(_0x347813,_0x540bc3){return function(_0x4e1ce3){if(!_0x4e1ce3){_0x347813[_0x5d93('0x22')](0x194);}return _0x4e1ce3;};}function handleError(_0x5f1807,_0x24c0bd){_0x24c0bd=_0x24c0bd||0x1f4;return function(_0x3f7dd4){logger['error'](_0x3f7dd4['stack']);if(_0x3f7dd4['name']){delete _0x3f7dd4[_0x5d93('0x23')];}_0x5f1807['status'](_0x24c0bd)['send'](_0x3f7dd4);};}exports[_0x5d93('0x24')]=function(_0x226adb,_0x8b33b9){var _0x17d505={},_0x2b6eea={},_0x2dd8a5={'count':0x0,'rows':[]};var _0x36ebf9=db[_0x5d93('0x25')][_0x5d93('0x26')];_0x2b6eea[_0x5d93('0x27')]=_[_0x5d93('0x28')](_0x36ebf9);_0x2b6eea[_0x5d93('0x29')]=_[_0x5d93('0x28')](_0x226adb[_0x5d93('0x29')]);_0x2b6eea[_0x5d93('0x2a')]=_[_0x5d93('0x2b')](_0x2b6eea[_0x5d93('0x27')],_0x2b6eea[_0x5d93('0x29')]);_0x17d505[_0x5d93('0x2c')]=_['intersection'](_0x2b6eea[_0x5d93('0x27')],qs[_0x5d93('0x2d')](_0x226adb['query'][_0x5d93('0x2d')]));_0x17d505['attributes']=_0x17d505[_0x5d93('0x2c')]['length']?_0x17d505[_0x5d93('0x2c')]:_0x2b6eea[_0x5d93('0x27')];if(!_0x226adb[_0x5d93('0x29')][_0x5d93('0x2e')](_0x5d93('0x2f'))){_0x17d505[_0x5d93('0x1b')]=qs[_0x5d93('0x1b')](_0x226adb[_0x5d93('0x29')]['limit']);_0x17d505[_0x5d93('0x1a')]=qs['offset'](_0x226adb[_0x5d93('0x29')][_0x5d93('0x1a')]);}_0x17d505['order']=qs[_0x5d93('0x30')](_0x226adb[_0x5d93('0x29')][_0x5d93('0x30')]);_0x17d505[_0x5d93('0x31')]=qs['filters'](_[_0x5d93('0x32')](_0x226adb[_0x5d93('0x29')],_0x2b6eea[_0x5d93('0x2a')]));if(_0x226adb['query'][_0x5d93('0x33')]){_0x17d505[_0x5d93('0x31')]=_[_0x5d93('0x34')](_0x17d505[_0x5d93('0x31')],{'$or':_['map'](_0x36ebf9,function(_0x42d3de){if(_0x42d3de[_0x5d93('0x35')][_0x5d93('0x36')]!==_0x5d93('0x37')){var _0x176164={};_0x176164[_0x42d3de[_0x5d93('0x38')]]={'$like':'%'+_0x226adb[_0x5d93('0x29')][_0x5d93('0x33')]+'%'};return _0x176164;}})});}_0x17d505=_[_0x5d93('0x34')]({},_0x17d505,_0x226adb[_0x5d93('0x39')]);var _0x445ec7={'where':_0x17d505['where']};return db[_0x5d93('0x25')][_0x5d93('0x3a')](_0x445ec7)[_0x5d93('0x20')](function(_0x1a3a3c){_0x2dd8a5[_0x5d93('0x3a')]=_0x1a3a3c;if(_0x226adb[_0x5d93('0x29')][_0x5d93('0x3b')]){_0x17d505['include']=[{'all':!![]}];}return db[_0x5d93('0x25')][_0x5d93('0x3c')](_0x17d505);})['then'](function(_0x265dfb){_0x2dd8a5[_0x5d93('0x3d')]=_0x265dfb;return _0x2dd8a5;})['then'](respondWithFilteredResult(_0x8b33b9,_0x17d505))[_0x5d93('0x3e')](handleError(_0x8b33b9,null));};exports[_0x5d93('0x3f')]=function(_0x110221,_0x4a95a2){var _0x4f7776={'raw':!![],'where':{'id':_0x110221['params']['id']}},_0x125231={};_0x125231[_0x5d93('0x27')]=_['keys'](db[_0x5d93('0x25')][_0x5d93('0x26')]);_0x125231[_0x5d93('0x29')]=_['keys'](_0x110221[_0x5d93('0x29')]);_0x125231[_0x5d93('0x2a')]=_[_0x5d93('0x2b')](_0x125231['model'],_0x125231[_0x5d93('0x29')]);_0x4f7776[_0x5d93('0x2c')]=_['intersection'](_0x125231[_0x5d93('0x27')],qs['fields'](_0x110221[_0x5d93('0x29')][_0x5d93('0x2d')]));_0x4f7776['attributes']=_0x4f7776[_0x5d93('0x2c')][_0x5d93('0x40')]?_0x4f7776[_0x5d93('0x2c')]:_0x125231[_0x5d93('0x27')];if(_0x110221[_0x5d93('0x29')]['includeAll']){_0x4f7776[_0x5d93('0x41')]=[{'all':!![]}];}_0x4f7776=_[_0x5d93('0x34')]({},_0x4f7776,_0x110221['options']);return db[_0x5d93('0x25')][_0x5d93('0x42')](_0x4f7776)[_0x5d93('0x20')](handleEntityNotFound(_0x4a95a2,null))['then'](respondWithResult(_0x4a95a2,null))['catch'](handleError(_0x4a95a2,null));};exports[_0x5d93('0x43')]=function(_0x1514b9,_0x1d58af){return db[_0x5d93('0x25')][_0x5d93('0x43')](_0x1514b9['body'],{})[_0x5d93('0x20')](respondWithResult(_0x1d58af,0xc9))[_0x5d93('0x3e')](handleError(_0x1d58af,null));};exports[_0x5d93('0x1f')]=function(_0x5257a5,_0x2fc8a0){if(_0x5257a5[_0x5d93('0x44')]['id']){delete _0x5257a5[_0x5d93('0x44')]['id'];}return db[_0x5d93('0x25')][_0x5d93('0x42')]({'where':{'id':_0x5257a5['params']['id']}})['then'](handleEntityNotFound(_0x2fc8a0,null))[_0x5d93('0x20')](saveUpdates(_0x5257a5[_0x5d93('0x44')],null))[_0x5d93('0x20')](respondWithResult(_0x2fc8a0,null))[_0x5d93('0x3e')](handleError(_0x2fc8a0,null));};exports[_0x5d93('0x21')]=function(_0x3ba251,_0x442fd7){return db[_0x5d93('0x25')]['find']({'where':{'id':_0x3ba251['params']['id']}})[_0x5d93('0x20')](handleEntityNotFound(_0x442fd7,null))['then'](removeEntity(_0x442fd7,null))[_0x5d93('0x3e')](handleError(_0x442fd7,null));};exports[_0x5d93('0x45')]=function(_0x517b09,_0xce0a5d){return db[_0x5d93('0x25')]['describe']()[_0x5d93('0x20')](respondWithResult(_0xce0a5d,null))[_0x5d93('0x3e')](handleError(_0xce0a5d,null));}; \ No newline at end of file +var _0xef0f=['../../config/environment','../../mysqldb','status','end','json','limit','apply','save','then','destroy','sendStatus','error','stack','send','index','OpenchannelQueueReport','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','key','field','options','count','includeAll','include','rows','show','params','rawAttributes','length','find','catch','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xef0f,0x75));var _0xfef0=function(_0x2acfdf,_0x44599a){_0x2acfdf=_0x2acfdf-0x0;var _0x4b3fa9=_0xef0f[_0x2acfdf];return _0x4b3fa9;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require(_0xfef0('0x1'));var rimraf=require(_0xfef0('0x2'));var zipdir=require(_0xfef0('0x3'));var jsonpatch=require(_0xfef0('0x4'));var rp=require(_0xfef0('0x5'));var moment=require(_0xfef0('0x6'));var BPromise=require(_0xfef0('0x7'));var Mustache=require('mustache');var util=require(_0xfef0('0x8'));var path=require(_0xfef0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfef0('0xb'));var jsforce=require(_0xfef0('0xc'));var deskjs=require(_0xfef0('0xd'));var toCsv=require(_0xfef0('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfef0('0xf'));var authService=require(_0xfef0('0x10'));var qs=require(_0xfef0('0x11'));var hardwareService=require(_0xfef0('0x12'));var logger=require(_0xfef0('0x13'))('api');var utils=require(_0xfef0('0x14'));var config=require(_0xfef0('0x15'));var db=require(_0xfef0('0x16'))['db'];function respondWithStatusCode(_0x3c87f9,_0x32a397){_0x32a397=_0x32a397||0xcc;return function(_0x56fcc1){if(_0x56fcc1){return _0x3c87f9['sendStatus'](_0x32a397);}return _0x3c87f9[_0xfef0('0x17')](_0x32a397)[_0xfef0('0x18')]();};}function respondWithResult(_0x30383f,_0x4c661f){_0x4c661f=_0x4c661f||0xc8;return function(_0x58ffac){if(_0x58ffac){return _0x30383f['status'](_0x4c661f)[_0xfef0('0x19')](_0x58ffac);}};}function respondWithFilteredResult(_0x2c1a01,_0x5a8ba9){return function(_0x1284aa){if(_0x1284aa){var _0x2630cb=_0x1284aa['count'],_0x297ea9=_0x5a8ba9['offset'],_0x3c0399=_0x5a8ba9['offset']+_0x5a8ba9[_0xfef0('0x1a')],_0x444fe7;if(_0x3c0399>=_0x2630cb){_0x3c0399=_0x2630cb;_0x444fe7=0xc8;}else{_0x444fe7=0xce;}_0x2c1a01[_0xfef0('0x17')](_0x444fe7);return _0x2c1a01['set']('Content-Range',_0x297ea9+'-'+_0x3c0399+'/'+_0x2630cb)[_0xfef0('0x19')](_0x1284aa);}return null;};}function patchUpdates(_0x54261d){return function(_0x5efbd9){try{jsonpatch[_0xfef0('0x1b')](_0x5efbd9,_0x54261d,!![]);}catch(_0x4e2fda){return BPromise['reject'](_0x4e2fda);}return _0x5efbd9[_0xfef0('0x1c')]();};}function saveUpdates(_0x4e0511,_0x53a6ea){return function(_0x310375){if(_0x310375){return _0x310375['update'](_0x4e0511)[_0xfef0('0x1d')](function(_0x45e611){return _0x45e611;});}return null;};}function removeEntity(_0xf7735,_0x34fabb){return function(_0x2cdf40){if(_0x2cdf40){return _0x2cdf40[_0xfef0('0x1e')]()['then'](function(){_0xf7735[_0xfef0('0x17')](0xcc)[_0xfef0('0x18')]();});}};}function handleEntityNotFound(_0x218b86,_0x5ed001){return function(_0x41fed8){if(!_0x41fed8){_0x218b86[_0xfef0('0x1f')](0x194);}return _0x41fed8;};}function handleError(_0x4307cf,_0x36a7a6){_0x36a7a6=_0x36a7a6||0x1f4;return function(_0x568d34){logger[_0xfef0('0x20')](_0x568d34[_0xfef0('0x21')]);if(_0x568d34['name']){delete _0x568d34['name'];}_0x4307cf[_0xfef0('0x17')](_0x36a7a6)[_0xfef0('0x22')](_0x568d34);};}exports[_0xfef0('0x23')]=function(_0x3a86d5,_0x1b41ae){var _0x39c71a={},_0xce69df={},_0x17fb80={'count':0x0,'rows':[]};var _0x310c3d=db[_0xfef0('0x24')]['rawAttributes'];_0xce69df[_0xfef0('0x25')]=_['keys'](_0x310c3d);_0xce69df[_0xfef0('0x26')]=_[_0xfef0('0x27')](_0x3a86d5[_0xfef0('0x26')]);_0xce69df[_0xfef0('0x28')]=_[_0xfef0('0x29')](_0xce69df[_0xfef0('0x25')],_0xce69df['query']);_0x39c71a['attributes']=_[_0xfef0('0x29')](_0xce69df[_0xfef0('0x25')],qs[_0xfef0('0x2a')](_0x3a86d5[_0xfef0('0x26')][_0xfef0('0x2a')]));_0x39c71a[_0xfef0('0x2b')]=_0x39c71a['attributes']['length']?_0x39c71a['attributes']:_0xce69df[_0xfef0('0x25')];if(!_0x3a86d5[_0xfef0('0x26')][_0xfef0('0x2c')](_0xfef0('0x2d'))){_0x39c71a[_0xfef0('0x1a')]=qs[_0xfef0('0x1a')](_0x3a86d5[_0xfef0('0x26')]['limit']);_0x39c71a['offset']=qs[_0xfef0('0x2e')](_0x3a86d5['query'][_0xfef0('0x2e')]);}_0x39c71a[_0xfef0('0x2f')]=qs[_0xfef0('0x30')](_0x3a86d5['query'][_0xfef0('0x30')]);_0x39c71a[_0xfef0('0x31')]=qs[_0xfef0('0x28')](_[_0xfef0('0x32')](_0x3a86d5[_0xfef0('0x26')],_0xce69df['filters']));if(_0x3a86d5[_0xfef0('0x26')][_0xfef0('0x33')]){_0x39c71a[_0xfef0('0x31')]=_[_0xfef0('0x34')](_0x39c71a[_0xfef0('0x31')],{'$or':_['map'](_0x310c3d,function(_0x44e1e7){if(_0x44e1e7[_0xfef0('0x35')][_0xfef0('0x36')]!=='VIRTUAL'){var _0x15fed2={};_0x15fed2[_0x44e1e7[_0xfef0('0x37')]]={'$like':'%'+_0x3a86d5[_0xfef0('0x26')][_0xfef0('0x33')]+'%'};return _0x15fed2;}})});}_0x39c71a=_['merge']({},_0x39c71a,_0x3a86d5[_0xfef0('0x38')]);var _0x3112dc={'where':_0x39c71a[_0xfef0('0x31')]};return db['OpenchannelQueueReport']['count'](_0x3112dc)[_0xfef0('0x1d')](function(_0x43295b){_0x17fb80[_0xfef0('0x39')]=_0x43295b;if(_0x3a86d5['query'][_0xfef0('0x3a')]){_0x39c71a[_0xfef0('0x3b')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x39c71a);})[_0xfef0('0x1d')](function(_0x2fb22e){_0x17fb80[_0xfef0('0x3c')]=_0x2fb22e;return _0x17fb80;})[_0xfef0('0x1d')](respondWithFilteredResult(_0x1b41ae,_0x39c71a))['catch'](handleError(_0x1b41ae,null));};exports[_0xfef0('0x3d')]=function(_0x3b1e2b,_0x41f7e3){var _0x36e10d={'raw':!![],'where':{'id':_0x3b1e2b[_0xfef0('0x3e')]['id']}},_0x175620={};_0x175620['model']=_[_0xfef0('0x27')](db['OpenchannelQueueReport'][_0xfef0('0x3f')]);_0x175620[_0xfef0('0x26')]=_[_0xfef0('0x27')](_0x3b1e2b[_0xfef0('0x26')]);_0x175620['filters']=_[_0xfef0('0x29')](_0x175620['model'],_0x175620[_0xfef0('0x26')]);_0x36e10d[_0xfef0('0x2b')]=_[_0xfef0('0x29')](_0x175620['model'],qs[_0xfef0('0x2a')](_0x3b1e2b[_0xfef0('0x26')][_0xfef0('0x2a')]));_0x36e10d[_0xfef0('0x2b')]=_0x36e10d[_0xfef0('0x2b')][_0xfef0('0x40')]?_0x36e10d['attributes']:_0x175620[_0xfef0('0x25')];if(_0x3b1e2b[_0xfef0('0x26')]['includeAll']){_0x36e10d[_0xfef0('0x3b')]=[{'all':!![]}];}_0x36e10d=_[_0xfef0('0x34')]({},_0x36e10d,_0x3b1e2b[_0xfef0('0x38')]);return db[_0xfef0('0x24')][_0xfef0('0x41')](_0x36e10d)[_0xfef0('0x1d')](handleEntityNotFound(_0x41f7e3,null))[_0xfef0('0x1d')](respondWithResult(_0x41f7e3,null))[_0xfef0('0x42')](handleError(_0x41f7e3,null));};exports['create']=function(_0x5372f0,_0x59cbed){return db[_0xfef0('0x24')]['create'](_0x5372f0['body'],{})['then'](respondWithResult(_0x59cbed,0xc9))[_0xfef0('0x42')](handleError(_0x59cbed,null));};exports['update']=function(_0x5b98d1,_0x2d1a2d){if(_0x5b98d1[_0xfef0('0x43')]['id']){delete _0x5b98d1['body']['id'];}return db[_0xfef0('0x24')][_0xfef0('0x41')]({'where':{'id':_0x5b98d1[_0xfef0('0x3e')]['id']}})[_0xfef0('0x1d')](handleEntityNotFound(_0x2d1a2d,null))[_0xfef0('0x1d')](saveUpdates(_0x5b98d1[_0xfef0('0x43')],null))[_0xfef0('0x1d')](respondWithResult(_0x2d1a2d,null))[_0xfef0('0x42')](handleError(_0x2d1a2d,null));};exports[_0xfef0('0x1e')]=function(_0x8e1c6b,_0x4f32c6){return db[_0xfef0('0x24')][_0xfef0('0x41')]({'where':{'id':_0x8e1c6b[_0xfef0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4f32c6,null))[_0xfef0('0x1d')](removeEntity(_0x4f32c6,null))['catch'](handleError(_0x4f32c6,null));};exports[_0xfef0('0x44')]=function(_0x2d8ea3,_0x251340){return db['OpenchannelQueueReport']['describe']()['then'](respondWithResult(_0x251340,null))[_0xfef0('0x42')](handleError(_0x251340,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 24a71ca..db859b5 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 _0x34e8=['../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x34e8,0x12c));var _0x834e=function(_0x497d70,_0x4da5f1){_0x497d70=_0x497d70-0x0;var _0x11bc24=_0x34e8[_0x497d70];return _0x11bc24;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb18e=['./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x3fa264,_0xed4e31){var _0x338cf7=function(_0x1721e7){while(--_0x1721e7){_0x3fa264['push'](_0x3fa264['shift']());}};_0x338cf7(++_0xed4e31);}(_0xb18e,0x181));var _0xeb18=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xb18e[_0xccf869];return _0x21a9db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('OpenchannelQueueReport',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[{'name':_0xeb18('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 65ef01e..82f5a64 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 _0xd429=['attributes','UpdateOpenchannelQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','OpenchannelQueueReport','body','options','raw','CreateOpenchannelQueueReport','catch','update','where'];(function(_0x152cc0,_0x305508){var _0xcd01c7=function(_0x2e71eb){while(--_0x2e71eb){_0x152cc0['push'](_0x152cc0['shift']());}};_0xcd01c7(++_0x305508);}(_0xd429,0x134));var _0x9d42=function(_0x25ee92,_0x2610cc){_0x25ee92=_0x25ee92-0x0;var _0x2c3454=_0xd429[_0x25ee92];return _0x2c3454;};'use strict';var _=require(_0x9d42('0x0'));var util=require('util');var moment=require(_0x9d42('0x1'));var BPromise=require(_0x9d42('0x2'));var rs=require(_0x9d42('0x3'));var fs=require('fs');var Redis=require(_0x9d42('0x4'));var db=require(_0x9d42('0x5'))['db'];var utils=require(_0x9d42('0x6'));var logger=require(_0x9d42('0x7'))(_0x9d42('0x8'));var config=require(_0x9d42('0x9'));var jayson=require(_0x9d42('0xa'));var client=jayson[_0x9d42('0xb')][_0x9d42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e895d,_0x1df0f2,_0x1d4bbd){return new BPromise(function(_0x81f1c2,_0x5c5c24){return client['request'](_0x1e895d,_0x1d4bbd)[_0x9d42('0xd')](function(_0x6a9258){logger[_0x9d42('0xe')](_0x9d42('0xf'),_0x1df0f2,_0x9d42('0x10'));logger[_0x9d42('0x11')](_0x9d42('0x12'),_0x1df0f2,_0x9d42('0x10'),JSON[_0x9d42('0x13')](_0x6a9258));if(_0x6a9258['error']){if(_0x6a9258['error'][_0x9d42('0x14')]===0x1f4){logger[_0x9d42('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1df0f2,_0x6a9258['error'][_0x9d42('0x16')]);return _0x5c5c24(_0x6a9258[_0x9d42('0x15')][_0x9d42('0x16')]);}logger[_0x9d42('0x15')](_0x9d42('0xf'),_0x1df0f2,_0x6a9258['error'][_0x9d42('0x16')]);return _0x81f1c2(_0x6a9258['error'][_0x9d42('0x16')]);}else{logger[_0x9d42('0xe')](_0x9d42('0xf'),_0x1df0f2,_0x9d42('0x10'));_0x81f1c2(_0x6a9258[_0x9d42('0x17')][_0x9d42('0x16')]);}})['catch'](function(_0x507a7f){logger['error'](_0x9d42('0xf'),_0x1df0f2,_0x507a7f);_0x5c5c24(_0x507a7f);});});}exports['CreateOpenchannelQueueReport']=function(_0x6caa03){var _0x2adbd2=this;return new Promise(function(_0x35b061,_0x16cecf){return db[_0x9d42('0x18')]['create'](_0x6caa03[_0x9d42('0x19')],{'raw':_0x6caa03[_0x9d42('0x1a')]?_0x6caa03[_0x9d42('0x1a')][_0x9d42('0x1b')]===undefined?!![]:![]:!![]})[_0x9d42('0xd')](function(_0x1a3ba2){logger[_0x9d42('0xe')]('CreateOpenchannelQueueReport',_0x6caa03);logger[_0x9d42('0x11')](_0x9d42('0x1c'),_0x6caa03,JSON[_0x9d42('0x13')](_0x1a3ba2));_0x35b061(_0x1a3ba2);})[_0x9d42('0x1d')](function(_0x374fb4){logger['error'](_0x9d42('0x1c'),_0x374fb4[_0x9d42('0x16')],_0x6caa03);_0x16cecf(_0x2adbd2[_0x9d42('0x15')](0x1f4,_0x374fb4[_0x9d42('0x16')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x4c150f){var _0x462319=this;return new Promise(function(_0x2c7181,_0x3c97ea){return db['OpenchannelQueueReport'][_0x9d42('0x1e')](_0x4c150f[_0x9d42('0x19')],{'raw':_0x4c150f[_0x9d42('0x1a')]?_0x4c150f[_0x9d42('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c150f['options']?_0x4c150f[_0x9d42('0x1a')][_0x9d42('0x1f')]||null:null,'attributes':_0x4c150f[_0x9d42('0x1a')]?_0x4c150f[_0x9d42('0x1a')][_0x9d42('0x20')]||null:null,'limit':_0x4c150f[_0x9d42('0x1a')]?_0x4c150f[_0x9d42('0x1a')]['limit']||null:null})[_0x9d42('0xd')](function(_0x233e02){logger[_0x9d42('0xe')](_0x9d42('0x21'),_0x4c150f);logger[_0x9d42('0x11')](_0x9d42('0x21'),_0x4c150f,JSON['stringify'](_0x233e02));_0x2c7181(_0x233e02);})['catch'](function(_0x218218){logger[_0x9d42('0x15')](_0x9d42('0x21'),_0x218218[_0x9d42('0x16')],_0x4c150f);_0x3c97ea(_0x462319['error'](0x1f4,_0x218218[_0x9d42('0x16')]));});});}; \ No newline at end of file +var _0xf6f2=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','update','limit','UpdateOpenchannelQueueReport','lodash','moment'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xf6f2,0x1b0));var _0x2f6f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf6f2[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2f6f('0x0'));var util=require('util');var moment=require(_0x2f6f('0x1'));var BPromise=require(_0x2f6f('0x2'));var rs=require(_0x2f6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f6f('0x5'));var config=require(_0x2f6f('0x6'));var jayson=require(_0x2f6f('0x7'));var client=jayson[_0x2f6f('0x8')][_0x2f6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x390e86,_0x4cb834,_0x42b4e1){return new BPromise(function(_0x569bbb,_0x2d56dc){return client[_0x2f6f('0xa')](_0x390e86,_0x42b4e1)[_0x2f6f('0xb')](function(_0x337aaf){logger[_0x2f6f('0xc')](_0x2f6f('0xd'),_0x4cb834,_0x2f6f('0xe'));logger[_0x2f6f('0xf')](_0x2f6f('0x10'),_0x4cb834,_0x2f6f('0xe'),JSON[_0x2f6f('0x11')](_0x337aaf));if(_0x337aaf[_0x2f6f('0x12')]){if(_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x13')]===0x1f4){logger[_0x2f6f('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4cb834,_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);return _0x2d56dc(_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);}logger[_0x2f6f('0x12')](_0x2f6f('0xd'),_0x4cb834,_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);return _0x569bbb(_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);}else{logger[_0x2f6f('0xc')](_0x2f6f('0xd'),_0x4cb834,_0x2f6f('0xe'));_0x569bbb(_0x337aaf[_0x2f6f('0x15')][_0x2f6f('0x14')]);}})[_0x2f6f('0x16')](function(_0x1a2f17){logger[_0x2f6f('0x12')](_0x2f6f('0xd'),_0x4cb834,_0x1a2f17);_0x2d56dc(_0x1a2f17);});});}exports[_0x2f6f('0x17')]=function(_0x4b3dbf){var _0x4dacbd=this;return new Promise(function(_0x5cdc01,_0x86ee7e){return db['OpenchannelQueueReport'][_0x2f6f('0x18')](_0x4b3dbf[_0x2f6f('0x19')],{'raw':_0x4b3dbf[_0x2f6f('0x1a')]?_0x4b3dbf[_0x2f6f('0x1a')][_0x2f6f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x58cd21){logger[_0x2f6f('0xc')]('CreateOpenchannelQueueReport',_0x4b3dbf);logger[_0x2f6f('0xf')](_0x2f6f('0x17'),_0x4b3dbf,JSON['stringify'](_0x58cd21));_0x5cdc01(_0x58cd21);})[_0x2f6f('0x16')](function(_0x313b74){logger[_0x2f6f('0x12')](_0x2f6f('0x17'),_0x313b74[_0x2f6f('0x14')],_0x4b3dbf);_0x86ee7e(_0x4dacbd[_0x2f6f('0x12')](0x1f4,_0x313b74['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2ef21f){var _0x2fb86e=this;return new Promise(function(_0x44cbd6,_0x40756d){return db['OpenchannelQueueReport'][_0x2f6f('0x1c')](_0x2ef21f[_0x2f6f('0x19')],{'raw':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')]['where']||null:null,'attributes':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')]['attributes']||null:null,'limit':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')][_0x2f6f('0x1d')]||null:null})[_0x2f6f('0xb')](function(_0x4d5694){logger[_0x2f6f('0xc')](_0x2f6f('0x1e'),_0x2ef21f);logger[_0x2f6f('0xf')]('UpdateOpenchannelQueueReport',_0x2ef21f,JSON['stringify'](_0x4d5694));_0x44cbd6(_0x4d5694);})[_0x2f6f('0x16')](function(_0x337669){logger[_0x2f6f('0x12')](_0x2f6f('0x1e'),_0x337669[_0x2f6f('0x14')],_0x2ef21f);_0x40756d(_0x2fb86e['error'](0x1f4,_0x337669[_0x2f6f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c87469e..cf54e88 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 _0x978c=['update','delete','destroy','exports','multer','express','Router','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x978c,0xc4));var _0xc978=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x978c[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0xc978('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc978('0x1'));var router=express[_0xc978('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc978('0x3'));var controller=require(_0xc978('0x4'));router[_0xc978('0x5')]('/',auth[_0xc978('0x6')](),controller[_0xc978('0x7')]);router[_0xc978('0x5')](_0xc978('0x8'),auth[_0xc978('0x6')](),controller[_0xc978('0x9')]);router['get'](_0xc978('0xa'),auth[_0xc978('0x6')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc978('0xb')]);router['put'](_0xc978('0xa'),auth[_0xc978('0x6')](),controller[_0xc978('0xc')]);router[_0xc978('0xd')](_0xc978('0xa'),auth[_0xc978('0x6')](),controller[_0xc978('0xe')]);module[_0xc978('0xf')]=router; \ No newline at end of file +var _0x9a11=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3a26be,_0x5980e4){var _0x199a1a=function(_0x5737b8){while(--_0x5737b8){_0x3a26be['push'](_0x3a26be['shift']());}};_0x199a1a(++_0x5980e4);}(_0x9a11,0x8f));var _0x19a1=function(_0x4a2a52,_0x252f1a){_0x4a2a52=_0x4a2a52-0x0;var _0x59a43b=_0x9a11[_0x4a2a52];return _0x59a43b;};'use strict';var multer=require(_0x19a1('0x0'));var util=require('util');var path=require(_0x19a1('0x1'));var timeout=require(_0x19a1('0x2'));var express=require(_0x19a1('0x3'));var router=express[_0x19a1('0x4')]();var auth=require(_0x19a1('0x5'));var interaction=require(_0x19a1('0x6'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x19a1('0x7')]('/',auth[_0x19a1('0x8')](),controller[_0x19a1('0x9')]);router[_0x19a1('0x7')](_0x19a1('0xa'),auth['isAuthenticated'](),controller[_0x19a1('0xb')]);router[_0x19a1('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x19a1('0xc')]);router[_0x19a1('0xd')]('/',auth['isAuthenticated'](),controller[_0x19a1('0xe')]);router[_0x19a1('0xf')](_0x19a1('0x10'),auth[_0x19a1('0x8')](),controller[_0x19a1('0x11')]);router[_0x19a1('0x12')](_0x19a1('0x10'),auth['isAuthenticated'](),controller[_0x19a1('0x13')]);module[_0x19a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0b1cdd7..7feeee8 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 _0xd824=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','NOW'];(function(_0x7e38f5,_0x2e16c9){var _0x2b6323=function(_0x141322){while(--_0x141322){_0x7e38f5['push'](_0x7e38f5['shift']());}};_0x2b6323(++_0x2e16c9);}(_0xd824,0xe1));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0x4d82('0x0'));var Sequelize=require(_0x4d82('0x1'));module[_0x4d82('0x2')]={'uniqueid':{'type':Sequelize[_0x4d82('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4d82('0x4')](_0x4d82('0x5'),_0x4d82('0x6'),_0x4d82('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4d82('0x8')]}}; \ No newline at end of file +var _0x17ff=['queue','DATE','NOW','moment','sequelize','account','agent'];(function(_0x46d364,_0xe46e5f){var _0x381392=function(_0x5371f5){while(--_0x5371f5){_0x46d364['push'](_0x46d364['shift']());}};_0x381392(++_0xe46e5f);}(_0x17ff,0x122));var _0xf17f=function(_0x19b3ca,_0x24eb4a){_0x19b3ca=_0x19b3ca-0x0;var _0x123837=_0x17ff[_0x19b3ca];return _0x123837;};'use strict';var moment=require(_0xf17f('0x0'));var Sequelize=require(_0xf17f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf17f('0x2'),_0xf17f('0x3'),'queue'),'allowNull':![],'defaultValue':_0xf17f('0x4')},'transferredAt':{'type':Sequelize[_0xf17f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xf17f('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e5fafea..4880063 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 _0x13c0=['limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','field','options','OpenchannelTransferReport','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','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'];(function(_0x25e7d2,_0x5749d1){var _0xf331f0=function(_0x1498d1){while(--_0x1498d1){_0x25e7d2['push'](_0x25e7d2['shift']());}};_0xf331f0(++_0x5749d1);}(_0x13c0,0x79));var _0x013c=function(_0x4cbb8e,_0x1047c8){_0x4cbb8e=_0x4cbb8e-0x0;var _0x17846f=_0x13c0[_0x4cbb8e];return _0x17846f;};'use strict';var pdf=require(_0x013c('0x0'));var emlformat=require(_0x013c('0x1'));var rimraf=require(_0x013c('0x2'));var zipdir=require(_0x013c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x013c('0x4'));var Mustache=require(_0x013c('0x5'));var util=require(_0x013c('0x6'));var path=require(_0x013c('0x7'));var sox=require(_0x013c('0x8'));var csv=require(_0x013c('0x9'));var ejs=require(_0x013c('0xa'));var fs=require('fs');var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x9'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var hardwareService=require(_0x013c('0x11'));var logger=require(_0x013c('0x12'))(_0x013c('0x13'));var utils=require(_0x013c('0x14'));var config=require(_0x013c('0x15'));var db=require(_0x013c('0x16'))['db'];function respondWithStatusCode(_0x4cc4bd,_0x54aba0){_0x54aba0=_0x54aba0||0xcc;return function(_0xce456f){if(_0xce456f){return _0x4cc4bd[_0x013c('0x17')](_0x54aba0);}return _0x4cc4bd[_0x013c('0x18')](_0x54aba0)[_0x013c('0x19')]();};}function respondWithResult(_0x4f8349,_0x29c12f){_0x29c12f=_0x29c12f||0xc8;return function(_0x2313de){if(_0x2313de){return _0x4f8349[_0x013c('0x18')](_0x29c12f)[_0x013c('0x1a')](_0x2313de);}};}function respondWithFilteredResult(_0x424437,_0x57f017){return function(_0x307f34){if(_0x307f34){var _0x1c2e11=_0x307f34[_0x013c('0x1b')],_0x84244=_0x57f017[_0x013c('0x1c')],_0x92c3ca=_0x57f017[_0x013c('0x1c')]+_0x57f017[_0x013c('0x1d')],_0x1a5e16;if(_0x92c3ca>=_0x1c2e11){_0x92c3ca=_0x1c2e11;_0x1a5e16=0xc8;}else{_0x1a5e16=0xce;}_0x424437[_0x013c('0x18')](_0x1a5e16);return _0x424437[_0x013c('0x1e')](_0x013c('0x1f'),_0x84244+'-'+_0x92c3ca+'/'+_0x1c2e11)[_0x013c('0x1a')](_0x307f34);}return null;};}function patchUpdates(_0x5a9142){return function(_0x59bcbe){try{jsonpatch[_0x013c('0x20')](_0x59bcbe,_0x5a9142,!![]);}catch(_0x153b0a){return BPromise['reject'](_0x153b0a);}return _0x59bcbe[_0x013c('0x21')]();};}function saveUpdates(_0x12e4db,_0x29c141){return function(_0x38bac2){if(_0x38bac2){return _0x38bac2[_0x013c('0x22')](_0x12e4db)['then'](function(_0xb039bc){return _0xb039bc;});}return null;};}function removeEntity(_0x336022,_0x48e6af){return function(_0x1df9d2){if(_0x1df9d2){return _0x1df9d2[_0x013c('0x23')]()['then'](function(){_0x336022['status'](0xcc)[_0x013c('0x19')]();});}};}function handleEntityNotFound(_0x1996e6,_0x2509f4){return function(_0x447c0b){if(!_0x447c0b){_0x1996e6[_0x013c('0x17')](0x194);}return _0x447c0b;};}function handleError(_0x2c28a7,_0x186677){_0x186677=_0x186677||0x1f4;return function(_0x1b9bdc){logger['error'](_0x1b9bdc[_0x013c('0x24')]);if(_0x1b9bdc[_0x013c('0x25')]){delete _0x1b9bdc[_0x013c('0x25')];}_0x2c28a7[_0x013c('0x18')](_0x186677)[_0x013c('0x26')](_0x1b9bdc);};}exports[_0x013c('0x27')]=function(_0x584ddf,_0xc1e719){var _0xd85349={},_0x21c86e={},_0x5f251b={'count':0x0,'rows':[]};var _0xa74f05=db['OpenchannelTransferReport'][_0x013c('0x28')];_0x21c86e[_0x013c('0x29')]=_['keys'](_0xa74f05);_0x21c86e[_0x013c('0x2a')]=_[_0x013c('0x2b')](_0x584ddf[_0x013c('0x2a')]);_0x21c86e[_0x013c('0x2c')]=_[_0x013c('0x2d')](_0x21c86e[_0x013c('0x29')],_0x21c86e[_0x013c('0x2a')]);_0xd85349[_0x013c('0x2e')]=_[_0x013c('0x2d')](_0x21c86e[_0x013c('0x29')],qs['fields'](_0x584ddf[_0x013c('0x2a')][_0x013c('0x2f')]));_0xd85349[_0x013c('0x2e')]=_0xd85349[_0x013c('0x2e')][_0x013c('0x30')]?_0xd85349['attributes']:_0x21c86e[_0x013c('0x29')];if(!_0x584ddf[_0x013c('0x2a')][_0x013c('0x31')](_0x013c('0x32'))){_0xd85349['limit']=qs['limit'](_0x584ddf['query'][_0x013c('0x1d')]);_0xd85349[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0x584ddf[_0x013c('0x2a')][_0x013c('0x1c')]);}_0xd85349[_0x013c('0x33')]=qs[_0x013c('0x34')](_0x584ddf[_0x013c('0x2a')][_0x013c('0x34')]);_0xd85349[_0x013c('0x35')]=qs[_0x013c('0x2c')](_[_0x013c('0x36')](_0x584ddf['query'],_0x21c86e['filters']));if(_0x584ddf[_0x013c('0x2a')][_0x013c('0x37')]){_0xd85349[_0x013c('0x35')]=_[_0x013c('0x38')](_0xd85349['where'],{'$or':_[_0x013c('0x39')](_0xa74f05,function(_0xefb24b){if(_0xefb24b[_0x013c('0x3a')][_0x013c('0x3b')]!=='VIRTUAL'){var _0x2e862a={};_0x2e862a[_0xefb24b[_0x013c('0x3c')]]={'$like':'%'+_0x584ddf['query'][_0x013c('0x37')]+'%'};return _0x2e862a;}})});}_0xd85349=_['merge']({},_0xd85349,_0x584ddf[_0x013c('0x3d')]);var _0x2ff0bb={'where':_0xd85349[_0x013c('0x35')]};return db[_0x013c('0x3e')]['count'](_0x2ff0bb)[_0x013c('0x3f')](function(_0x39b6b3){_0x5f251b[_0x013c('0x1b')]=_0x39b6b3;if(_0x584ddf[_0x013c('0x2a')][_0x013c('0x40')]){_0xd85349[_0x013c('0x41')]=[{'all':!![]}];}return db[_0x013c('0x3e')][_0x013c('0x42')](_0xd85349);})[_0x013c('0x3f')](function(_0x4bd189){_0x5f251b[_0x013c('0x43')]=_0x4bd189;return _0x5f251b;})[_0x013c('0x3f')](respondWithFilteredResult(_0xc1e719,_0xd85349))['catch'](handleError(_0xc1e719,null));};exports[_0x013c('0x44')]=function(_0x1cf2e5,_0x5c7863){var _0x4212f3={'raw':!![],'where':{'id':_0x1cf2e5[_0x013c('0x45')]['id']}},_0x3384da={};_0x3384da[_0x013c('0x29')]=_[_0x013c('0x2b')](db['OpenchannelTransferReport'][_0x013c('0x28')]);_0x3384da['query']=_['keys'](_0x1cf2e5['query']);_0x3384da['filters']=_[_0x013c('0x2d')](_0x3384da[_0x013c('0x29')],_0x3384da[_0x013c('0x2a')]);_0x4212f3['attributes']=_[_0x013c('0x2d')](_0x3384da[_0x013c('0x29')],qs[_0x013c('0x2f')](_0x1cf2e5[_0x013c('0x2a')][_0x013c('0x2f')]));_0x4212f3['attributes']=_0x4212f3[_0x013c('0x2e')][_0x013c('0x30')]?_0x4212f3['attributes']:_0x3384da['model'];if(_0x1cf2e5['query']['includeAll']){_0x4212f3[_0x013c('0x41')]=[{'all':!![]}];}_0x4212f3=_[_0x013c('0x38')]({},_0x4212f3,_0x1cf2e5['options']);return db[_0x013c('0x3e')][_0x013c('0x46')](_0x4212f3)['then'](handleEntityNotFound(_0x5c7863,null))[_0x013c('0x3f')](respondWithResult(_0x5c7863,null))[_0x013c('0x47')](handleError(_0x5c7863,null));};exports[_0x013c('0x48')]=function(_0x315dc5,_0x17bce0){return db[_0x013c('0x3e')][_0x013c('0x48')](_0x315dc5[_0x013c('0x49')],{})['then'](respondWithResult(_0x17bce0,0xc9))[_0x013c('0x47')](handleError(_0x17bce0,null));};exports['update']=function(_0x31fbad,_0x525fbe){if(_0x31fbad['body']['id']){delete _0x31fbad[_0x013c('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x013c('0x46')]({'where':{'id':_0x31fbad[_0x013c('0x45')]['id']}})[_0x013c('0x3f')](handleEntityNotFound(_0x525fbe,null))[_0x013c('0x3f')](saveUpdates(_0x31fbad['body'],null))['then'](respondWithResult(_0x525fbe,null))['catch'](handleError(_0x525fbe,null));};exports['destroy']=function(_0x7f4350,_0x5daeda){return db[_0x013c('0x3e')][_0x013c('0x46')]({'where':{'id':_0x7f4350[_0x013c('0x45')]['id']}})[_0x013c('0x3f')](handleEntityNotFound(_0x5daeda,null))[_0x013c('0x3f')](removeEntity(_0x5daeda,null))[_0x013c('0x47')](handleError(_0x5daeda,null));};exports[_0x013c('0x4a')]=function(_0x1a2497,_0x1069eb){return db['OpenchannelTransferReport'][_0x013c('0x4a')]()['then'](respondWithResult(_0x1069eb,null))['catch'](handleError(_0x1069eb,null));}; \ No newline at end of file +var _0x3036=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','length','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4121c4,_0x487282){var _0xe6c94b=function(_0x4d8a30){while(--_0x4d8a30){_0x4121c4['push'](_0x4121c4['shift']());}};_0xe6c94b(++_0x487282);}(_0x3036,0x1a9));var _0x6303=function(_0x2c8dad,_0x1fc9ca){_0x2c8dad=_0x2c8dad-0x0;var _0x5b764a=_0x3036[_0x2c8dad];return _0x5b764a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6303('0x0'));var zipdir=require(_0x6303('0x1'));var jsonpatch=require(_0x6303('0x2'));var rp=require('request-promise');var moment=require(_0x6303('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6303('0x4'));var sox=require('sox');var csv=require(_0x6303('0x5'));var ejs=require(_0x6303('0x6'));var fs=require('fs');var _=require(_0x6303('0x7'));var squel=require('squel');var crypto=require(_0x6303('0x8'));var jsforce=require(_0x6303('0x9'));var deskjs=require(_0x6303('0xa'));var toCsv=require(_0x6303('0x5'));var querystring=require(_0x6303('0xb'));var Papa=require(_0x6303('0xc'));var Redis=require(_0x6303('0xd'));var authService=require(_0x6303('0xe'));var qs=require(_0x6303('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6303('0x10'))(_0x6303('0x11'));var utils=require(_0x6303('0x12'));var config=require(_0x6303('0x13'));var db=require(_0x6303('0x14'))['db'];function respondWithStatusCode(_0x530f24,_0x397582){_0x397582=_0x397582||0xcc;return function(_0xe6cee4){if(_0xe6cee4){return _0x530f24[_0x6303('0x15')](_0x397582);}return _0x530f24[_0x6303('0x16')](_0x397582)[_0x6303('0x17')]();};}function respondWithResult(_0x48462d,_0x5ef678){_0x5ef678=_0x5ef678||0xc8;return function(_0x5d75c1){if(_0x5d75c1){return _0x48462d[_0x6303('0x16')](_0x5ef678)[_0x6303('0x18')](_0x5d75c1);}};}function respondWithFilteredResult(_0x251995,_0x3e72aa){return function(_0x2bbc57){if(_0x2bbc57){var _0x43526d=_0x2bbc57['count'],_0x3395e0=_0x3e72aa['offset'],_0x2c4cbd=_0x3e72aa[_0x6303('0x19')]+_0x3e72aa[_0x6303('0x1a')],_0x13874f;if(_0x2c4cbd>=_0x43526d){_0x2c4cbd=_0x43526d;_0x13874f=0xc8;}else{_0x13874f=0xce;}_0x251995[_0x6303('0x16')](_0x13874f);return _0x251995[_0x6303('0x1b')](_0x6303('0x1c'),_0x3395e0+'-'+_0x2c4cbd+'/'+_0x43526d)['json'](_0x2bbc57);}return null;};}function patchUpdates(_0x30dcd2){return function(_0x1cdfd7){try{jsonpatch[_0x6303('0x1d')](_0x1cdfd7,_0x30dcd2,!![]);}catch(_0x397b97){return BPromise[_0x6303('0x1e')](_0x397b97);}return _0x1cdfd7[_0x6303('0x1f')]();};}function saveUpdates(_0x3cc5e4,_0x1211b4){return function(_0x223d91){if(_0x223d91){return _0x223d91[_0x6303('0x20')](_0x3cc5e4)[_0x6303('0x21')](function(_0x4e591d){return _0x4e591d;});}return null;};}function removeEntity(_0x579acb,_0x2ee9bb){return function(_0x344dd4){if(_0x344dd4){return _0x344dd4[_0x6303('0x22')]()[_0x6303('0x21')](function(){_0x579acb['status'](0xcc)[_0x6303('0x17')]();});}};}function handleEntityNotFound(_0x3e2a0c,_0x2872e8){return function(_0x18b80a){if(!_0x18b80a){_0x3e2a0c[_0x6303('0x15')](0x194);}return _0x18b80a;};}function handleError(_0x21eec0,_0x213798){_0x213798=_0x213798||0x1f4;return function(_0x52de40){logger['error'](_0x52de40[_0x6303('0x23')]);if(_0x52de40[_0x6303('0x24')]){delete _0x52de40['name'];}_0x21eec0[_0x6303('0x16')](_0x213798)[_0x6303('0x25')](_0x52de40);};}exports[_0x6303('0x26')]=function(_0x53adbd,_0x1e7d33){var _0x45843f={},_0x389ff5={},_0x21b220={'count':0x0,'rows':[]};var _0x768494=db[_0x6303('0x27')][_0x6303('0x28')];_0x389ff5[_0x6303('0x29')]=_[_0x6303('0x2a')](_0x768494);_0x389ff5[_0x6303('0x2b')]=_[_0x6303('0x2a')](_0x53adbd['query']);_0x389ff5[_0x6303('0x2c')]=_['intersection'](_0x389ff5[_0x6303('0x29')],_0x389ff5['query']);_0x45843f['attributes']=_[_0x6303('0x2d')](_0x389ff5[_0x6303('0x29')],qs[_0x6303('0x2e')](_0x53adbd['query']['fields']));_0x45843f[_0x6303('0x2f')]=_0x45843f['attributes']['length']?_0x45843f[_0x6303('0x2f')]:_0x389ff5[_0x6303('0x29')];if(!_0x53adbd[_0x6303('0x2b')][_0x6303('0x30')](_0x6303('0x31'))){_0x45843f['limit']=qs[_0x6303('0x1a')](_0x53adbd[_0x6303('0x2b')][_0x6303('0x1a')]);_0x45843f['offset']=qs['offset'](_0x53adbd[_0x6303('0x2b')]['offset']);}_0x45843f[_0x6303('0x32')]=qs[_0x6303('0x33')](_0x53adbd[_0x6303('0x2b')][_0x6303('0x33')]);_0x45843f[_0x6303('0x34')]=qs['filters'](_[_0x6303('0x35')](_0x53adbd[_0x6303('0x2b')],_0x389ff5[_0x6303('0x2c')]));if(_0x53adbd[_0x6303('0x2b')][_0x6303('0x36')]){_0x45843f['where']=_[_0x6303('0x37')](_0x45843f[_0x6303('0x34')],{'$or':_[_0x6303('0x38')](_0x768494,function(_0x127fd5){if(_0x127fd5[_0x6303('0x39')]['key']!==_0x6303('0x3a')){var _0x5b99bb={};_0x5b99bb[_0x127fd5[_0x6303('0x3b')]]={'$like':'%'+_0x53adbd[_0x6303('0x2b')][_0x6303('0x36')]+'%'};return _0x5b99bb;}})});}_0x45843f=_['merge']({},_0x45843f,_0x53adbd['options']);var _0x7e2e9a={'where':_0x45843f['where']};return db[_0x6303('0x27')][_0x6303('0x3c')](_0x7e2e9a)[_0x6303('0x21')](function(_0x4eb2f5){_0x21b220['count']=_0x4eb2f5;if(_0x53adbd[_0x6303('0x2b')][_0x6303('0x3d')]){_0x45843f[_0x6303('0x3e')]=[{'all':!![]}];}return db[_0x6303('0x27')][_0x6303('0x3f')](_0x45843f);})[_0x6303('0x21')](function(_0x54861c){_0x21b220[_0x6303('0x40')]=_0x54861c;return _0x21b220;})['then'](respondWithFilteredResult(_0x1e7d33,_0x45843f))[_0x6303('0x41')](handleError(_0x1e7d33,null));};exports['show']=function(_0x1688d7,_0x44cd0c){var _0x2f4a2f={'raw':!![],'where':{'id':_0x1688d7['params']['id']}},_0x22b20e={};_0x22b20e[_0x6303('0x29')]=_['keys'](db[_0x6303('0x27')][_0x6303('0x28')]);_0x22b20e['query']=_[_0x6303('0x2a')](_0x1688d7[_0x6303('0x2b')]);_0x22b20e['filters']=_[_0x6303('0x2d')](_0x22b20e['model'],_0x22b20e[_0x6303('0x2b')]);_0x2f4a2f['attributes']=_['intersection'](_0x22b20e['model'],qs[_0x6303('0x2e')](_0x1688d7[_0x6303('0x2b')]['fields']));_0x2f4a2f['attributes']=_0x2f4a2f[_0x6303('0x2f')][_0x6303('0x42')]?_0x2f4a2f['attributes']:_0x22b20e[_0x6303('0x29')];if(_0x1688d7[_0x6303('0x2b')][_0x6303('0x3d')]){_0x2f4a2f[_0x6303('0x3e')]=[{'all':!![]}];}_0x2f4a2f=_['merge']({},_0x2f4a2f,_0x1688d7[_0x6303('0x43')]);return db[_0x6303('0x27')][_0x6303('0x44')](_0x2f4a2f)['then'](handleEntityNotFound(_0x44cd0c,null))[_0x6303('0x21')](respondWithResult(_0x44cd0c,null))[_0x6303('0x41')](handleError(_0x44cd0c,null));};exports[_0x6303('0x45')]=function(_0x2c19fd,_0x692daa){return db[_0x6303('0x27')]['create'](_0x2c19fd['body'],{})[_0x6303('0x21')](respondWithResult(_0x692daa,0xc9))[_0x6303('0x41')](handleError(_0x692daa,null));};exports['update']=function(_0x35cfaf,_0x40b40a){if(_0x35cfaf[_0x6303('0x46')]['id']){delete _0x35cfaf[_0x6303('0x46')]['id'];}return db['OpenchannelTransferReport'][_0x6303('0x44')]({'where':{'id':_0x35cfaf[_0x6303('0x47')]['id']}})[_0x6303('0x21')](handleEntityNotFound(_0x40b40a,null))[_0x6303('0x21')](saveUpdates(_0x35cfaf['body'],null))[_0x6303('0x21')](respondWithResult(_0x40b40a,null))[_0x6303('0x41')](handleError(_0x40b40a,null));};exports['destroy']=function(_0x31f0e7,_0x174121){return db[_0x6303('0x27')][_0x6303('0x44')]({'where':{'id':_0x31f0e7[_0x6303('0x47')]['id']}})[_0x6303('0x21')](handleEntityNotFound(_0x174121,null))[_0x6303('0x21')](removeEntity(_0x174121,null))[_0x6303('0x41')](handleError(_0x174121,null));};exports[_0x6303('0x48')]=function(_0x3e4dfc,_0x5b10c5){return db[_0x6303('0x27')][_0x6303('0x48')]()['then'](respondWithResult(_0x5b10c5,null))[_0x6303('0x41')](handleError(_0x5b10c5,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e4adacb..610a36c 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 _0x3b7e=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x2a5d5d,_0xd3cb85){var _0xe6fbd7=function(_0x299843){while(--_0x299843){_0x2a5d5d['push'](_0x2a5d5d['shift']());}};_0xe6fbd7(++_0xd3cb85);}(_0x3b7e,0x1b8));var _0xe3b7=function(_0x13642f,_0x2e3b66){_0x13642f=_0x13642f-0x0;var _0xb0b361=_0x3b7e[_0x13642f];return _0xb0b361;};'use strict';var _=require(_0xe3b7('0x0'));var util=require(_0xe3b7('0x1'));var logger=require(_0xe3b7('0x2'))(_0xe3b7('0x3'));var moment=require('moment');var BPromise=require(_0xe3b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3b7('0x5'));var rimraf=require(_0xe3b7('0x6'));var config=require(_0xe3b7('0x7'));var attributes=require(_0xe3b7('0x8'));module['exports']=function(_0x53f823,_0x273077){return _0x53f823[_0xe3b7('0x9')](_0xe3b7('0xa'),attributes,{'tableName':_0xe3b7('0xb'),'paranoid':![],'indexes':[{'name':_0xe3b7('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53d5=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x53d5,0x68));var _0x553d=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x53d5[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require(_0x553d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x553d('0x1'));var moment=require(_0x553d('0x2'));var BPromise=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var fs=require('fs');var path=require(_0x553d('0x5'));var rimraf=require(_0x553d('0x6'));var config=require(_0x553d('0x7'));var attributes=require(_0x553d('0x8'));module[_0x553d('0x9')]=function(_0x3002cc,_0x4c8dd8){return _0x3002cc['define'](_0x553d('0xa'),attributes,{'tableName':_0x553d('0xb'),'paranoid':![],'indexes':[{'name':_0x553d('0xc'),'fields':[_0x553d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 51af2d1..7e0b7b2 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 _0x828d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x828d,0x12c));var _0xd828=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0x828d[_0x2ad1b8];return _0x52547d;};'use strict';var _=require(_0xd828('0x0'));var util=require(_0xd828('0x1'));var moment=require(_0xd828('0x2'));var BPromise=require(_0xd828('0x3'));var rs=require(_0xd828('0x4'));var fs=require('fs');var Redis=require(_0xd828('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd828('0x6'));var logger=require(_0xd828('0x7'))(_0xd828('0x8'));var config=require('../../config/environment');var jayson=require(_0xd828('0x9'));var client=jayson[_0xd828('0xa')][_0xd828('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563135,_0x5b3847,_0x482dfc){return new BPromise(function(_0x44fea5,_0x2e24a2){return client['request'](_0x563135,_0x482dfc)[_0xd828('0xc')](function(_0x6c1f68){logger[_0xd828('0xd')](_0xd828('0xe'),_0x5b3847,'request\x20sent');logger[_0xd828('0xf')](_0xd828('0x10'),_0x5b3847,'request\x20sent',JSON['stringify'](_0x6c1f68));if(_0x6c1f68['error']){if(_0x6c1f68['error'][_0xd828('0x11')]===0x1f4){logger[_0xd828('0x12')](_0xd828('0xe'),_0x5b3847,_0x6c1f68['error']['message']);return _0x2e24a2(_0x6c1f68[_0xd828('0x12')]['message']);}logger[_0xd828('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5b3847,_0x6c1f68[_0xd828('0x12')][_0xd828('0x13')]);return _0x44fea5(_0x6c1f68[_0xd828('0x12')]['message']);}else{logger['info'](_0xd828('0xe'),_0x5b3847,_0xd828('0x14'));_0x44fea5(_0x6c1f68[_0xd828('0x15')][_0xd828('0x13')]);}})[_0xd828('0x16')](function(_0x5850a0){logger[_0xd828('0x12')](_0xd828('0xe'),_0x5b3847,_0x5850a0);_0x2e24a2(_0x5850a0);});});} \ No newline at end of file +var _0xdf85=['../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1af8d3,_0x544d86){var _0x3a50c5=function(_0x4179aa){while(--_0x4179aa){_0x1af8d3['push'](_0x1af8d3['shift']());}};_0x3a50c5(++_0x544d86);}(_0xdf85,0x12c));var _0x5df8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdf85[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x5df8('0x0'));var moment=require('moment');var BPromise=require(_0x5df8('0x1'));var rs=require(_0x5df8('0x2'));var fs=require('fs');var Redis=require(_0x5df8('0x3'));var db=require(_0x5df8('0x4'))['db'];var utils=require(_0x5df8('0x5'));var logger=require(_0x5df8('0x6'))(_0x5df8('0x7'));var config=require(_0x5df8('0x8'));var jayson=require(_0x5df8('0x9'));var client=jayson[_0x5df8('0xa')][_0x5df8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa871,_0xeeaef8,_0x12384d){return new BPromise(function(_0x3dec2d,_0x2b0aee){return client[_0x5df8('0xc')](_0x4aa871,_0x12384d)[_0x5df8('0xd')](function(_0x172560){logger[_0x5df8('0xe')](_0x5df8('0xf'),_0xeeaef8,_0x5df8('0x10'));logger['debug'](_0x5df8('0x11'),_0xeeaef8,_0x5df8('0x10'),JSON[_0x5df8('0x12')](_0x172560));if(_0x172560[_0x5df8('0x13')]){if(_0x172560[_0x5df8('0x13')]['code']===0x1f4){logger[_0x5df8('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xeeaef8,_0x172560[_0x5df8('0x13')]['message']);return _0x2b0aee(_0x172560[_0x5df8('0x13')][_0x5df8('0x14')]);}logger[_0x5df8('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xeeaef8,_0x172560[_0x5df8('0x13')][_0x5df8('0x14')]);return _0x3dec2d(_0x172560[_0x5df8('0x13')][_0x5df8('0x14')]);}else{logger[_0x5df8('0xe')](_0x5df8('0xf'),_0xeeaef8,_0x5df8('0x10'));_0x3dec2d(_0x172560[_0x5df8('0x15')][_0x5df8('0x14')]);}})['catch'](function(_0x103bff){logger[_0x5df8('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xeeaef8,_0x103bff);_0x2b0aee(_0x103bff);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f86a785..23bec39 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 _0x1cf3=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cf3,0x1be));var _0x31cf=function(_0x454555,_0x81e2e4){_0x454555=_0x454555-0x0;var _0x4e2b55=_0x1cf3[_0x454555];return _0x4e2b55;};'use strict';var multer=require(_0x31cf('0x0'));var util=require(_0x31cf('0x1'));var path=require(_0x31cf('0x2'));var timeout=require(_0x31cf('0x3'));var express=require('express');var router=express[_0x31cf('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x31cf('0x5'));var config=require(_0x31cf('0x6'));var controller=require(_0x31cf('0x7'));router[_0x31cf('0x8')]('/',auth[_0x31cf('0x9')](),controller[_0x31cf('0xa')]);router[_0x31cf('0x8')](_0x31cf('0xb'),auth[_0x31cf('0x9')](),controller[_0x31cf('0xc')]);router[_0x31cf('0xd')]('/',auth[_0x31cf('0x9')](),controller[_0x31cf('0xe')]);router[_0x31cf('0xf')]('/:id',auth[_0x31cf('0x9')](),controller[_0x31cf('0x10')]);router[_0x31cf('0x11')]('/:id',auth[_0x31cf('0x9')](),controller[_0x31cf('0x12')]);module[_0x31cf('0x13')]=router; \ No newline at end of file +var _0x2746=['update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xedb7ba,_0x3a5c46){var _0x11c6b6=function(_0x4f236e){while(--_0x4f236e){_0xedb7ba['push'](_0xedb7ba['shift']());}};_0x11c6b6(++_0x3a5c46);}(_0x2746,0x19c));var _0x6274=function(_0x475d0e,_0x25eeb2){_0x475d0e=_0x475d0e-0x0;var _0x24d82b=_0x2746[_0x475d0e];return _0x24d82b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6274('0x0'));var timeout=require(_0x6274('0x1'));var express=require(_0x6274('0x2'));var router=express[_0x6274('0x3')]();var auth=require(_0x6274('0x4'));var interaction=require(_0x6274('0x5'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x6274('0x6')]('/',auth[_0x6274('0x7')](),controller[_0x6274('0x8')]);router['get'](_0x6274('0x9'),auth[_0x6274('0x7')](),controller[_0x6274('0xa')]);router[_0x6274('0xb')]('/',auth[_0x6274('0x7')](),controller['create']);router[_0x6274('0xc')]('/:id',auth[_0x6274('0x7')](),controller[_0x6274('0xd')]);router[_0x6274('0xe')](_0x6274('0x9'),auth[_0x6274('0x7')](),controller[_0x6274('0xf')]);module[_0x6274('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index e147786..1a118a0 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 _0xcb2e=['STRING','name','sequelize','exports'];(function(_0x23d39d,_0x1c0a29){var _0x2eaaac=function(_0xf6b313){while(--_0xf6b313){_0x23d39d['push'](_0x23d39d['shift']());}};_0x2eaaac(++_0x1c0a29);}(_0xcb2e,0x7a));var _0xecb2=function(_0xf925f2,_0x1fb6a0){_0xf925f2=_0xf925f2-0x0;var _0x181a50=_0xcb2e[_0xf925f2];return _0x181a50;};'use strict';var Sequelize=require(_0xecb2('0x0'));module[_0xecb2('0x1')]={'name':{'type':Sequelize[_0xecb2('0x2')],'unique':_0xecb2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xecb2('0x2')]}}; \ No newline at end of file +var _0x304b=['STRING','sequelize','exports'];(function(_0x164df2,_0x4083ee){var _0x4abfa1=function(_0x226c9b){while(--_0x226c9b){_0x164df2['push'](_0x164df2['shift']());}};_0x4abfa1(++_0x4083ee);}(_0x304b,0x103));var _0xb304=function(_0x29e265,_0x27d3d0){_0x29e265=_0x29e265-0x0;var _0x164f23=_0x304b[_0x29e265];return _0x164f23;};'use strict';var Sequelize=require(_0xb304('0x0'));module[_0xb304('0x1')]={'name':{'type':Sequelize[_0xb304('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb304('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d8da5b0..f23e373 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 _0x13a3=['includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','get','Pauses','destroy','name','send','index','Pause','rawAttributes','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','map','type','VIRTUAL','field','filter','options'];(function(_0x4f283b,_0x25c80c){var _0xcf133c=function(_0x185bc0){while(--_0x185bc0){_0x4f283b['push'](_0x4f283b['shift']());}};_0xcf133c(++_0x25c80c);}(_0x13a3,0x19d));var _0x313a=function(_0x4d397c,_0x2d3dc5){_0x4d397c=_0x4d397c-0x0;var _0x1aefca=_0x13a3[_0x4d397c];return _0x1aefca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x313a('0x0'));var rimraf=require(_0x313a('0x1'));var zipdir=require(_0x313a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x313a('0x3'));var moment=require('moment');var BPromise=require(_0x313a('0x4'));var Mustache=require(_0x313a('0x5'));var util=require(_0x313a('0x6'));var path=require(_0x313a('0x7'));var sox=require(_0x313a('0x8'));var csv=require('to-csv');var ejs=require(_0x313a('0x9'));var fs=require('fs');var _=require(_0x313a('0xa'));var squel=require(_0x313a('0xb'));var crypto=require(_0x313a('0xc'));var jsforce=require(_0x313a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x313a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x313a('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x313a('0x10'));var logger=require('../../config/logger')(_0x313a('0x11'));var utils=require(_0x313a('0x12'));var config=require(_0x313a('0x13'));var db=require(_0x313a('0x14'))['db'];function respondWithStatusCode(_0x3f0621,_0x164773){_0x164773=_0x164773||0xcc;return function(_0x338813){if(_0x338813){return _0x3f0621[_0x313a('0x15')](_0x164773);}return _0x3f0621[_0x313a('0x16')](_0x164773)[_0x313a('0x17')]();};}function respondWithResult(_0x5b3342,_0x1b1771){_0x1b1771=_0x1b1771||0xc8;return function(_0x243a8b){if(_0x243a8b){return _0x5b3342['status'](_0x1b1771)[_0x313a('0x18')](_0x243a8b);}};}function respondWithFilteredResult(_0x2fce22,_0x4c12e8){return function(_0x4c8ea9){if(_0x4c8ea9){var _0x255a7c=_0x4c8ea9[_0x313a('0x19')],_0x2a2b74=_0x4c12e8['offset'],_0x1d4bcf=_0x4c12e8[_0x313a('0x1a')]+_0x4c12e8[_0x313a('0x1b')],_0x1d6268;if(_0x1d4bcf>=_0x255a7c){_0x1d4bcf=_0x255a7c;_0x1d6268=0xc8;}else{_0x1d6268=0xce;}_0x2fce22[_0x313a('0x16')](_0x1d6268);return _0x2fce22[_0x313a('0x1c')](_0x313a('0x1d'),_0x2a2b74+'-'+_0x1d4bcf+'/'+_0x255a7c)[_0x313a('0x18')](_0x4c8ea9);}return null;};}function patchUpdates(_0x5f9d37){return function(_0x5f581f){try{jsonpatch[_0x313a('0x1e')](_0x5f581f,_0x5f9d37,!![]);}catch(_0x5ba326){return BPromise[_0x313a('0x1f')](_0x5ba326);}return _0x5f581f['save']();};}function saveUpdates(_0x272cd9,_0x1589b2){return function(_0x10fcc8){if(_0x10fcc8){return _0x10fcc8['update'](_0x272cd9)[_0x313a('0x20')](function(_0x2d77eb){return _0x2d77eb;});}return null;};}function removeEntity(_0xe1bfa6,_0x122b69){return function(_0x2112f7){if(_0x2112f7){return _0x2112f7['destroy']()[_0x313a('0x20')](function(){var _0x57b491=_0x2112f7[_0x313a('0x21')]({'plain':!![]});var _0x24dc9c=_0x313a('0x22');return db['UserProfileResource'][_0x313a('0x23')]({'where':{'type':_0x24dc9c,'resourceId':_0x57b491['id']}})['then'](function(){return _0x2112f7;});})[_0x313a('0x20')](function(){_0xe1bfa6[_0x313a('0x16')](0xcc)[_0x313a('0x17')]();});}};}function handleEntityNotFound(_0x4759b4,_0x33805f){return function(_0x2fc49b){if(!_0x2fc49b){_0x4759b4[_0x313a('0x15')](0x194);}return _0x2fc49b;};}function handleError(_0x455ba7,_0x30e5ac){_0x30e5ac=_0x30e5ac||0x1f4;return function(_0x12e6bb){logger['error'](_0x12e6bb['stack']);if(_0x12e6bb[_0x313a('0x24')]){delete _0x12e6bb[_0x313a('0x24')];}_0x455ba7['status'](_0x30e5ac)[_0x313a('0x25')](_0x12e6bb);};}exports[_0x313a('0x26')]=function(_0x579a7a,_0x17ebf9){var _0x489804={},_0xc4ae4b={},_0x55c413={'count':0x0,'rows':[]};var _0x4596ef=db[_0x313a('0x27')][_0x313a('0x28')];_0xc4ae4b['model']=_['keys'](_0x4596ef);_0xc4ae4b[_0x313a('0x29')]=_['keys'](_0x579a7a[_0x313a('0x29')]);_0xc4ae4b['filters']=_['intersection'](_0xc4ae4b[_0x313a('0x2a')],_0xc4ae4b['query']);_0x489804['attributes']=_[_0x313a('0x2b')](_0xc4ae4b['model'],qs['fields'](_0x579a7a[_0x313a('0x29')][_0x313a('0x2c')]));_0x489804[_0x313a('0x2d')]=_0x489804[_0x313a('0x2d')][_0x313a('0x2e')]?_0x489804[_0x313a('0x2d')]:_0xc4ae4b[_0x313a('0x2a')];if(!_0x579a7a['query'][_0x313a('0x2f')](_0x313a('0x30'))){_0x489804['limit']=qs[_0x313a('0x1b')](_0x579a7a['query'][_0x313a('0x1b')]);_0x489804[_0x313a('0x1a')]=qs['offset'](_0x579a7a[_0x313a('0x29')][_0x313a('0x1a')]);}_0x489804[_0x313a('0x31')]=qs[_0x313a('0x32')](_0x579a7a['query'][_0x313a('0x32')]);_0x489804['where']=qs[_0x313a('0x33')](_[_0x313a('0x34')](_0x579a7a[_0x313a('0x29')],_0xc4ae4b['filters']));if(_0x579a7a['query']['filter']){_0x489804[_0x313a('0x35')]=_[_0x313a('0x36')](_0x489804['where'],{'$or':_[_0x313a('0x37')](_0x4596ef,function(_0xc0c810){if(_0xc0c810[_0x313a('0x38')]['key']!==_0x313a('0x39')){var _0x3efecb={};_0x3efecb[_0xc0c810[_0x313a('0x3a')]]={'$like':'%'+_0x579a7a[_0x313a('0x29')][_0x313a('0x3b')]+'%'};return _0x3efecb;}})});}_0x489804=_[_0x313a('0x36')]({},_0x489804,_0x579a7a[_0x313a('0x3c')]);var _0x249073={'where':_0x489804['where']};return db['Pause']['count'](_0x249073)[_0x313a('0x20')](function(_0x364ca2){_0x55c413[_0x313a('0x19')]=_0x364ca2;if(_0x579a7a[_0x313a('0x29')][_0x313a('0x3d')]){_0x489804[_0x313a('0x3e')]=[{'all':!![]}];}return db[_0x313a('0x27')][_0x313a('0x3f')](_0x489804);})[_0x313a('0x20')](function(_0x666f8b){_0x55c413[_0x313a('0x40')]=_0x666f8b;return _0x55c413;})['then'](respondWithFilteredResult(_0x17ebf9,_0x489804))[_0x313a('0x41')](handleError(_0x17ebf9,null));};exports[_0x313a('0x42')]=function(_0x2949e3,_0x380d23){var _0x5a4977={'raw':!![],'where':{'id':_0x2949e3[_0x313a('0x43')]['id']}},_0x2c051c={};_0x2c051c[_0x313a('0x2a')]=_[_0x313a('0x44')](db['Pause'][_0x313a('0x28')]);_0x2c051c[_0x313a('0x29')]=_['keys'](_0x2949e3[_0x313a('0x29')]);_0x2c051c[_0x313a('0x33')]=_[_0x313a('0x2b')](_0x2c051c[_0x313a('0x2a')],_0x2c051c['query']);_0x5a4977[_0x313a('0x2d')]=_['intersection'](_0x2c051c[_0x313a('0x2a')],qs[_0x313a('0x2c')](_0x2949e3[_0x313a('0x29')][_0x313a('0x2c')]));_0x5a4977[_0x313a('0x2d')]=_0x5a4977[_0x313a('0x2d')][_0x313a('0x2e')]?_0x5a4977[_0x313a('0x2d')]:_0x2c051c['model'];if(_0x2949e3[_0x313a('0x29')][_0x313a('0x3d')]){_0x5a4977[_0x313a('0x3e')]=[{'all':!![]}];}_0x5a4977=_['merge']({},_0x5a4977,_0x2949e3[_0x313a('0x3c')]);return db[_0x313a('0x27')][_0x313a('0x45')](_0x5a4977)['then'](handleEntityNotFound(_0x380d23,null))[_0x313a('0x20')](respondWithResult(_0x380d23,null))[_0x313a('0x41')](handleError(_0x380d23,null));};exports[_0x313a('0x46')]=function(_0x22b7bb,_0x43e7b5){return db['Pause']['create'](_0x22b7bb[_0x313a('0x47')],{})[_0x313a('0x20')](function(_0x2443d8){var _0x562316=_0x22b7bb[_0x313a('0x48')][_0x313a('0x21')]({'plain':!![]});if(!_0x562316)throw new Error(_0x313a('0x49'));if(_0x562316[_0x313a('0x4a')]===_0x313a('0x48')){var _0x535f14=_0x2443d8['get']({'plain':!![]});var _0x38b2f9=_0x313a('0x22');return db[_0x313a('0x4b')][_0x313a('0x45')]({'where':{'name':_0x38b2f9,'userProfileId':_0x562316[_0x313a('0x4c')]},'raw':!![]})[_0x313a('0x20')](function(_0x2bf0e5){if(_0x2bf0e5&&_0x2bf0e5['autoAssociation']===0x0){return db[_0x313a('0x4d')]['create']({'name':_0x535f14[_0x313a('0x24')],'resourceId':_0x535f14['id'],'type':_0x2bf0e5[_0x313a('0x24')],'sectionId':_0x2bf0e5['id']},{})['then'](function(){return _0x2443d8;});}else{return _0x2443d8;}})['catch'](function(_0x1dbe49){logger['error'](_0x313a('0x4e'),_0x1dbe49);throw _0x1dbe49;});}return _0x2443d8;})[_0x313a('0x20')](respondWithResult(_0x43e7b5,0xc9))['catch'](handleError(_0x43e7b5,null));};exports['update']=function(_0x37cea9,_0x29db4a){if(_0x37cea9[_0x313a('0x47')]['id']){delete _0x37cea9[_0x313a('0x47')]['id'];}return db[_0x313a('0x27')][_0x313a('0x45')]({'where':{'id':_0x37cea9[_0x313a('0x43')]['id']}})['then'](handleEntityNotFound(_0x29db4a,null))[_0x313a('0x20')](saveUpdates(_0x37cea9[_0x313a('0x47')],null))['then'](respondWithResult(_0x29db4a,null))[_0x313a('0x41')](handleError(_0x29db4a,null));};exports[_0x313a('0x23')]=function(_0x2b3316,_0xc20a24){return db[_0x313a('0x27')][_0x313a('0x45')]({'where':{'id':_0x2b3316[_0x313a('0x43')]['id']}})[_0x313a('0x20')](handleEntityNotFound(_0xc20a24,null))[_0x313a('0x20')](removeEntity(_0xc20a24,null))[_0x313a('0x41')](handleError(_0xc20a24,null));}; \ No newline at end of file +var _0x7ae3=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','name','send','index','Pause','rawAttributes','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','type','key','VIRTUAL','field','count','includeAll','include','findAll','rows','params','length','options','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','crypto'];(function(_0xadc9a3,_0x464700){var _0x12b61e=function(_0x8bb080){while(--_0x8bb080){_0xadc9a3['push'](_0xadc9a3['shift']());}};_0x12b61e(++_0x464700);}(_0x7ae3,0x17f));var _0x37ae=function(_0x463a43,_0x299df1){_0x463a43=_0x463a43-0x0;var _0x471c37=_0x7ae3[_0x463a43];return _0x471c37;};'use strict';var pdf=require(_0x37ae('0x0'));var emlformat=require(_0x37ae('0x1'));var rimraf=require(_0x37ae('0x2'));var zipdir=require(_0x37ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37ae('0x4'));var moment=require(_0x37ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x37ae('0x6'));var util=require('util');var path=require(_0x37ae('0x7'));var sox=require(_0x37ae('0x8'));var csv=require('to-csv');var ejs=require(_0x37ae('0x9'));var fs=require('fs');var _=require(_0x37ae('0xa'));var squel=require('squel');var crypto=require(_0x37ae('0xb'));var jsforce=require(_0x37ae('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x37ae('0xd'));var querystring=require(_0x37ae('0xe'));var Papa=require(_0x37ae('0xf'));var Redis=require(_0x37ae('0x10'));var authService=require(_0x37ae('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x37ae('0x12'));var logger=require(_0x37ae('0x13'))(_0x37ae('0x14'));var utils=require(_0x37ae('0x15'));var config=require(_0x37ae('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x190e1d,_0x381fab){_0x381fab=_0x381fab||0xcc;return function(_0x3c9bb9){if(_0x3c9bb9){return _0x190e1d[_0x37ae('0x17')](_0x381fab);}return _0x190e1d['status'](_0x381fab)['end']();};}function respondWithResult(_0x525b5e,_0x2b796a){_0x2b796a=_0x2b796a||0xc8;return function(_0x1d350d){if(_0x1d350d){return _0x525b5e[_0x37ae('0x18')](_0x2b796a)[_0x37ae('0x19')](_0x1d350d);}};}function respondWithFilteredResult(_0x88898c,_0x38ecbd){return function(_0x19cfaa){if(_0x19cfaa){var _0x171504=_0x19cfaa['count'],_0x17d0b8=_0x38ecbd['offset'],_0x2b9cf5=_0x38ecbd[_0x37ae('0x1a')]+_0x38ecbd[_0x37ae('0x1b')],_0x36f620;if(_0x2b9cf5>=_0x171504){_0x2b9cf5=_0x171504;_0x36f620=0xc8;}else{_0x36f620=0xce;}_0x88898c[_0x37ae('0x18')](_0x36f620);return _0x88898c[_0x37ae('0x1c')](_0x37ae('0x1d'),_0x17d0b8+'-'+_0x2b9cf5+'/'+_0x171504)[_0x37ae('0x19')](_0x19cfaa);}return null;};}function patchUpdates(_0x2a6e41){return function(_0x1f3a64){try{jsonpatch['apply'](_0x1f3a64,_0x2a6e41,!![]);}catch(_0x1b372f){return BPromise[_0x37ae('0x1e')](_0x1b372f);}return _0x1f3a64[_0x37ae('0x1f')]();};}function saveUpdates(_0x5bad57,_0x2546f5){return function(_0x584559){if(_0x584559){return _0x584559[_0x37ae('0x20')](_0x5bad57)[_0x37ae('0x21')](function(_0x4df229){return _0x4df229;});}return null;};}function removeEntity(_0x31f074,_0x4acf48){return function(_0x6548e5){if(_0x6548e5){return _0x6548e5[_0x37ae('0x22')]()['then'](function(){var _0x3a7faa=_0x6548e5[_0x37ae('0x23')]({'plain':!![]});var _0x334489=_0x37ae('0x24');return db[_0x37ae('0x25')]['destroy']({'where':{'type':_0x334489,'resourceId':_0x3a7faa['id']}})[_0x37ae('0x21')](function(){return _0x6548e5;});})[_0x37ae('0x21')](function(){_0x31f074[_0x37ae('0x18')](0xcc)[_0x37ae('0x26')]();});}};}function handleEntityNotFound(_0x576b34,_0xed9054){return function(_0x1c434f){if(!_0x1c434f){_0x576b34[_0x37ae('0x17')](0x194);}return _0x1c434f;};}function handleError(_0x6e29d7,_0x50f4a4){_0x50f4a4=_0x50f4a4||0x1f4;return function(_0x572a89){logger[_0x37ae('0x27')](_0x572a89['stack']);if(_0x572a89[_0x37ae('0x28')]){delete _0x572a89[_0x37ae('0x28')];}_0x6e29d7[_0x37ae('0x18')](_0x50f4a4)[_0x37ae('0x29')](_0x572a89);};}exports[_0x37ae('0x2a')]=function(_0x1a315e,_0x32eaa4){var _0x1f0442={},_0x1b9613={},_0x34731a={'count':0x0,'rows':[]};var _0x200396=db[_0x37ae('0x2b')][_0x37ae('0x2c')];_0x1b9613['model']=_[_0x37ae('0x2d')](_0x200396);_0x1b9613[_0x37ae('0x2e')]=_[_0x37ae('0x2d')](_0x1a315e[_0x37ae('0x2e')]);_0x1b9613[_0x37ae('0x2f')]=_[_0x37ae('0x30')](_0x1b9613[_0x37ae('0x31')],_0x1b9613[_0x37ae('0x2e')]);_0x1f0442['attributes']=_[_0x37ae('0x30')](_0x1b9613[_0x37ae('0x31')],qs[_0x37ae('0x32')](_0x1a315e['query'][_0x37ae('0x32')]));_0x1f0442[_0x37ae('0x33')]=_0x1f0442[_0x37ae('0x33')]['length']?_0x1f0442[_0x37ae('0x33')]:_0x1b9613[_0x37ae('0x31')];if(!_0x1a315e['query'][_0x37ae('0x34')]('nolimit')){_0x1f0442[_0x37ae('0x1b')]=qs[_0x37ae('0x1b')](_0x1a315e[_0x37ae('0x2e')][_0x37ae('0x1b')]);_0x1f0442[_0x37ae('0x1a')]=qs['offset'](_0x1a315e['query'][_0x37ae('0x1a')]);}_0x1f0442[_0x37ae('0x35')]=qs[_0x37ae('0x36')](_0x1a315e['query'][_0x37ae('0x36')]);_0x1f0442['where']=qs[_0x37ae('0x2f')](_['pick'](_0x1a315e[_0x37ae('0x2e')],_0x1b9613[_0x37ae('0x2f')]));if(_0x1a315e[_0x37ae('0x2e')][_0x37ae('0x37')]){_0x1f0442[_0x37ae('0x38')]=_[_0x37ae('0x39')](_0x1f0442[_0x37ae('0x38')],{'$or':_['map'](_0x200396,function(_0x48854e){if(_0x48854e[_0x37ae('0x3a')][_0x37ae('0x3b')]!==_0x37ae('0x3c')){var _0x4ca313={};_0x4ca313[_0x48854e[_0x37ae('0x3d')]]={'$like':'%'+_0x1a315e[_0x37ae('0x2e')][_0x37ae('0x37')]+'%'};return _0x4ca313;}})});}_0x1f0442=_[_0x37ae('0x39')]({},_0x1f0442,_0x1a315e['options']);var _0x5e1adb={'where':_0x1f0442['where']};return db[_0x37ae('0x2b')][_0x37ae('0x3e')](_0x5e1adb)['then'](function(_0x2d11e6){_0x34731a[_0x37ae('0x3e')]=_0x2d11e6;if(_0x1a315e[_0x37ae('0x2e')][_0x37ae('0x3f')]){_0x1f0442[_0x37ae('0x40')]=[{'all':!![]}];}return db[_0x37ae('0x2b')][_0x37ae('0x41')](_0x1f0442);})[_0x37ae('0x21')](function(_0xbe7729){_0x34731a[_0x37ae('0x42')]=_0xbe7729;return _0x34731a;})[_0x37ae('0x21')](respondWithFilteredResult(_0x32eaa4,_0x1f0442))['catch'](handleError(_0x32eaa4,null));};exports['show']=function(_0x3e13c0,_0x3ed7ce){var _0x2363ca={'raw':!![],'where':{'id':_0x3e13c0[_0x37ae('0x43')]['id']}},_0x1aa1e8={};_0x1aa1e8['model']=_[_0x37ae('0x2d')](db[_0x37ae('0x2b')][_0x37ae('0x2c')]);_0x1aa1e8[_0x37ae('0x2e')]=_['keys'](_0x3e13c0[_0x37ae('0x2e')]);_0x1aa1e8[_0x37ae('0x2f')]=_[_0x37ae('0x30')](_0x1aa1e8[_0x37ae('0x31')],_0x1aa1e8['query']);_0x2363ca[_0x37ae('0x33')]=_['intersection'](_0x1aa1e8['model'],qs[_0x37ae('0x32')](_0x3e13c0[_0x37ae('0x2e')]['fields']));_0x2363ca[_0x37ae('0x33')]=_0x2363ca[_0x37ae('0x33')][_0x37ae('0x44')]?_0x2363ca[_0x37ae('0x33')]:_0x1aa1e8[_0x37ae('0x31')];if(_0x3e13c0['query'][_0x37ae('0x3f')]){_0x2363ca['include']=[{'all':!![]}];}_0x2363ca=_[_0x37ae('0x39')]({},_0x2363ca,_0x3e13c0[_0x37ae('0x45')]);return db[_0x37ae('0x2b')][_0x37ae('0x46')](_0x2363ca)[_0x37ae('0x21')](handleEntityNotFound(_0x3ed7ce,null))[_0x37ae('0x21')](respondWithResult(_0x3ed7ce,null))[_0x37ae('0x47')](handleError(_0x3ed7ce,null));};exports[_0x37ae('0x48')]=function(_0x72c167,_0x10e64e){return db[_0x37ae('0x2b')]['create'](_0x72c167[_0x37ae('0x49')],{})[_0x37ae('0x21')](function(_0x4b8935){var _0x291d49=_0x72c167[_0x37ae('0x4a')][_0x37ae('0x23')]({'plain':!![]});if(!_0x291d49)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x291d49[_0x37ae('0x4b')]===_0x37ae('0x4a')){var _0x24a0f9=_0x4b8935[_0x37ae('0x23')]({'plain':!![]});var _0x3f4f0f=_0x37ae('0x24');return db['UserProfileSection'][_0x37ae('0x46')]({'where':{'name':_0x3f4f0f,'userProfileId':_0x291d49[_0x37ae('0x4c')]},'raw':!![]})[_0x37ae('0x21')](function(_0x2437c2){if(_0x2437c2&&_0x2437c2[_0x37ae('0x4d')]===0x0){return db[_0x37ae('0x25')][_0x37ae('0x48')]({'name':_0x24a0f9[_0x37ae('0x28')],'resourceId':_0x24a0f9['id'],'type':_0x2437c2['name'],'sectionId':_0x2437c2['id']},{})['then'](function(){return _0x4b8935;});}else{return _0x4b8935;}})[_0x37ae('0x47')](function(_0x2adc0e){logger[_0x37ae('0x27')](_0x37ae('0x4e'),_0x2adc0e);throw _0x2adc0e;});}return _0x4b8935;})[_0x37ae('0x21')](respondWithResult(_0x10e64e,0xc9))[_0x37ae('0x47')](handleError(_0x10e64e,null));};exports[_0x37ae('0x20')]=function(_0x266bb2,_0x5f389f){if(_0x266bb2[_0x37ae('0x49')]['id']){delete _0x266bb2[_0x37ae('0x49')]['id'];}return db[_0x37ae('0x2b')][_0x37ae('0x46')]({'where':{'id':_0x266bb2['params']['id']}})[_0x37ae('0x21')](handleEntityNotFound(_0x5f389f,null))[_0x37ae('0x21')](saveUpdates(_0x266bb2[_0x37ae('0x49')],null))[_0x37ae('0x21')](respondWithResult(_0x5f389f,null))[_0x37ae('0x47')](handleError(_0x5f389f,null));};exports[_0x37ae('0x22')]=function(_0x5bfd2d,_0xecde){return db[_0x37ae('0x2b')]['find']({'where':{'id':_0x5bfd2d[_0x37ae('0x43')]['id']}})[_0x37ae('0x21')](handleEntityNotFound(_0xecde,null))[_0x37ae('0x21')](removeEntity(_0xecde,null))['catch'](handleError(_0xecde,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index e2acdb0..e217867 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 _0xca6b=['define','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x48fa7e,_0x343a02){var _0x256391=function(_0x5d52ec){while(--_0x5d52ec){_0x48fa7e['push'](_0x48fa7e['shift']());}};_0x256391(++_0x343a02);}(_0xca6b,0x92));var _0xbca6=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xca6b[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xbca6('0x0'));var util=require(_0xbca6('0x1'));var logger=require(_0xbca6('0x2'))(_0xbca6('0x3'));var moment=require(_0xbca6('0x4'));var BPromise=require(_0xbca6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbca6('0x6'));var rimraf=require(_0xbca6('0x7'));var config=require(_0xbca6('0x8'));var attributes=require('./pause.attributes');module[_0xbca6('0x9')]=function(_0x5923ff,_0x352d4c){return _0x5923ff[_0xbca6('0xa')]('Pause',attributes,{'tableName':_0xbca6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf714=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','define','tools_pauses','lodash'];(function(_0x242a86,_0x16d528){var _0x4d0a6d=function(_0x3f563c){while(--_0x3f563c){_0x242a86['push'](_0x242a86['shift']());}};_0x4d0a6d(++_0x16d528);}(_0xf714,0xdb));var _0x4f71=function(_0x296b3c,_0x203828){_0x296b3c=_0x296b3c-0x0;var _0x53adfa=_0xf714[_0x296b3c];return _0x53adfa;};'use strict';var _=require(_0x4f71('0x0'));var util=require(_0x4f71('0x1'));var logger=require(_0x4f71('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f71('0x3'));var rp=require(_0x4f71('0x4'));var fs=require('fs');var path=require(_0x4f71('0x5'));var rimraf=require(_0x4f71('0x6'));var config=require(_0x4f71('0x7'));var attributes=require(_0x4f71('0x8'));module['exports']=function(_0x50ed05,_0x465820){return _0x50ed05[_0x4f71('0x9')]('Pause',attributes,{'tableName':_0x4f71('0xa'),'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 3d5fb52..214df21 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 _0xb90d=['../../config/logger','rpc','../../config/environment','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb90d,0x17a));var _0xdb90=function(_0x11cbbd,_0x5d4106){_0x11cbbd=_0x11cbbd-0x0;var _0x153af2=_0xb90d[_0x11cbbd];return _0x153af2;};'use strict';var _=require('lodash');var util=require(_0xdb90('0x0'));var moment=require(_0xdb90('0x1'));var BPromise=require(_0xdb90('0x2'));var rs=require(_0xdb90('0x3'));var fs=require('fs');var Redis=require(_0xdb90('0x4'));var db=require(_0xdb90('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb90('0x6'))(_0xdb90('0x7'));var config=require(_0xdb90('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdb90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x155cdf,_0x6d8ec5,_0xbb1e2){return new BPromise(function(_0x57862b,_0x343ec1){return client[_0xdb90('0xa')](_0x155cdf,_0xbb1e2)[_0xdb90('0xb')](function(_0x54e3e6){logger[_0xdb90('0xc')](_0xdb90('0xd'),_0x6d8ec5,_0xdb90('0xe'));logger[_0xdb90('0xf')](_0xdb90('0x10'),_0x6d8ec5,'request\x20sent',JSON['stringify'](_0x54e3e6));if(_0x54e3e6['error']){if(_0x54e3e6[_0xdb90('0x11')][_0xdb90('0x12')]===0x1f4){logger[_0xdb90('0x11')](_0xdb90('0xd'),_0x6d8ec5,_0x54e3e6[_0xdb90('0x11')][_0xdb90('0x13')]);return _0x343ec1(_0x54e3e6['error']['message']);}logger['error']('Pause,\x20%s,\x20%s',_0x6d8ec5,_0x54e3e6['error']['message']);return _0x57862b(_0x54e3e6[_0xdb90('0x11')][_0xdb90('0x13')]);}else{logger['info'](_0xdb90('0xd'),_0x6d8ec5,_0xdb90('0xe'));_0x57862b(_0x54e3e6['result']['message']);}})[_0xdb90('0x14')](function(_0x2bde8b){logger[_0xdb90('0x11')]('Pause,\x20%s,\x20%s',_0x6d8ec5,_0x2bde8b);_0x343ec1(_0x2bde8b);});});}exports[_0xdb90('0x15')]=function(_0x13f6df){var _0xd50abd=this;return new Promise(function(_0x44d4d4,_0x1673a3){return db[_0xdb90('0x16')][_0xdb90('0x17')]({'raw':_0x13f6df[_0xdb90('0x18')]?_0x13f6df[_0xdb90('0x18')][_0xdb90('0x19')]===undefined?!![]:![]:!![],'where':_0x13f6df['options']?_0x13f6df['options'][_0xdb90('0x1a')]||null:null,'attributes':_0x13f6df[_0xdb90('0x18')]?_0x13f6df[_0xdb90('0x18')][_0xdb90('0x1b')]||null:null,'include':_0x13f6df[_0xdb90('0x18')]?_0x13f6df['options'][_0xdb90('0x1c')]?_[_0xdb90('0x1d')](_0x13f6df['options'][_0xdb90('0x1c')],function(_0x5aecb7){return{'model':db[_0x5aecb7[_0xdb90('0x1e')]],'as':_0x5aecb7['as'],'attributes':_0x5aecb7[_0xdb90('0x1b')],'include':_0x5aecb7[_0xdb90('0x1c')]?_[_0xdb90('0x1d')](_0x5aecb7[_0xdb90('0x1c')],function(_0x67f251){return{'model':db[_0x67f251[_0xdb90('0x1e')]],'as':_0x67f251['as'],'attributes':_0x67f251[_0xdb90('0x1b')],'include':_0x67f251[_0xdb90('0x1c')]?_[_0xdb90('0x1d')](_0x67f251[_0xdb90('0x1c')],function(_0x5d3b63){return{'model':db[_0x5d3b63[_0xdb90('0x1e')]],'as':_0x5d3b63['as'],'attributes':_0x5d3b63[_0xdb90('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdb90('0xb')](function(_0x54f2aa){logger['info'](_0xdb90('0x15'),_0x13f6df);logger[_0xdb90('0xf')](_0xdb90('0x15'),_0x13f6df,JSON[_0xdb90('0x1f')](_0x54f2aa));_0x44d4d4(_0x54f2aa);})[_0xdb90('0x14')](function(_0x321efc){logger[_0xdb90('0x11')](_0xdb90('0x15'),_0x321efc['message'],_0x13f6df);_0x1673a3(_0xd50abd[_0xdb90('0x11')](0x1f4,_0x321efc[_0xdb90('0x13')]));});});}; \ No newline at end of file +var _0xed4b=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','ShowPause','Pause','find','options','raw','include','attributes','map','stringify','lodash','util','moment','randomstring','ioredis'];(function(_0x5be060,_0x92d4ed){var _0x29d466=function(_0x22bd54){while(--_0x22bd54){_0x5be060['push'](_0x5be060['shift']());}};_0x29d466(++_0x92d4ed);}(_0xed4b,0x96));var _0xbed4=function(_0x1b5fa5,_0x262242){_0x1b5fa5=_0x1b5fa5-0x0;var _0x3ef222=_0xed4b[_0x1b5fa5];return _0x3ef222;};'use strict';var _=require(_0xbed4('0x0'));var util=require(_0xbed4('0x1'));var moment=require(_0xbed4('0x2'));var BPromise=require('bluebird');var rs=require(_0xbed4('0x3'));var fs=require('fs');var Redis=require(_0xbed4('0x4'));var db=require(_0xbed4('0x5'))['db'];var utils=require(_0xbed4('0x6'));var logger=require(_0xbed4('0x7'))(_0xbed4('0x8'));var config=require('../../config/environment');var jayson=require(_0xbed4('0x9'));var client=jayson[_0xbed4('0xa')][_0xbed4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x272560,_0x303394,_0x413e70){return new BPromise(function(_0x112c5d,_0xb635b3){return client[_0xbed4('0xc')](_0x272560,_0x413e70)[_0xbed4('0xd')](function(_0x4813a9){logger[_0xbed4('0xe')](_0xbed4('0xf'),_0x303394,'request\x20sent');logger[_0xbed4('0x10')](_0xbed4('0x11'),_0x303394,'request\x20sent',JSON['stringify'](_0x4813a9));if(_0x4813a9['error']){if(_0x4813a9[_0xbed4('0x12')][_0xbed4('0x13')]===0x1f4){logger[_0xbed4('0x12')](_0xbed4('0xf'),_0x303394,_0x4813a9[_0xbed4('0x12')][_0xbed4('0x14')]);return _0xb635b3(_0x4813a9[_0xbed4('0x12')]['message']);}logger[_0xbed4('0x12')](_0xbed4('0xf'),_0x303394,_0x4813a9[_0xbed4('0x12')]['message']);return _0x112c5d(_0x4813a9[_0xbed4('0x12')][_0xbed4('0x14')]);}else{logger[_0xbed4('0xe')](_0xbed4('0xf'),_0x303394,_0xbed4('0x15'));_0x112c5d(_0x4813a9['result']['message']);}})['catch'](function(_0xbada41){logger['error']('Pause,\x20%s,\x20%s',_0x303394,_0xbada41);_0xb635b3(_0xbada41);});});}exports[_0xbed4('0x16')]=function(_0x540b){var _0x4e80dc=this;return new Promise(function(_0x483474,_0x3e6120){return db[_0xbed4('0x17')][_0xbed4('0x18')]({'raw':_0x540b[_0xbed4('0x19')]?_0x540b[_0xbed4('0x19')][_0xbed4('0x1a')]===undefined?!![]:![]:!![],'where':_0x540b[_0xbed4('0x19')]?_0x540b[_0xbed4('0x19')]['where']||null:null,'attributes':_0x540b[_0xbed4('0x19')]?_0x540b[_0xbed4('0x19')]['attributes']||null:null,'include':_0x540b['options']?_0x540b[_0xbed4('0x19')][_0xbed4('0x1b')]?_['map'](_0x540b[_0xbed4('0x19')]['include'],function(_0x443de3){return{'model':db[_0x443de3['model']],'as':_0x443de3['as'],'attributes':_0x443de3[_0xbed4('0x1c')],'include':_0x443de3['include']?_[_0xbed4('0x1d')](_0x443de3[_0xbed4('0x1b')],function(_0x27ea52){return{'model':db[_0x27ea52['model']],'as':_0x27ea52['as'],'attributes':_0x27ea52[_0xbed4('0x1c')],'include':_0x27ea52[_0xbed4('0x1b')]?_['map'](_0x27ea52[_0xbed4('0x1b')],function(_0x4a8901){return{'model':db[_0x4a8901['model']],'as':_0x4a8901['as'],'attributes':_0x4a8901[_0xbed4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbed4('0xd')](function(_0xe705a6){logger[_0xbed4('0xe')]('ShowPause',_0x540b);logger['debug'](_0xbed4('0x16'),_0x540b,JSON[_0xbed4('0x1e')](_0xe705a6));_0x483474(_0xe705a6);})['catch'](function(_0xe87da8){logger['error'](_0xbed4('0x16'),_0xe87da8[_0xbed4('0x14')],_0x540b);_0x3e6120(_0x4e80dc['error'](0x1f4,_0xe87da8[_0xbed4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 7b0a974..eba24d0 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 _0x65e0=['update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','diskStorage','join','server/files/plugins','replace','format','%s-%s%s','basename','extname','originalname','now','post','file','webhookPost','put'];(function(_0xea46b9,_0x3bf12a){var _0x290ca0=function(_0x35af69){while(--_0x35af69){_0xea46b9['push'](_0xea46b9['shift']());}};_0x290ca0(++_0x3bf12a);}(_0x65e0,0xbc));var _0x065e=function(_0x294726,_0x5db9e9){_0x294726=_0x294726-0x0;var _0x39e2e3=_0x65e0[_0x294726];return _0x39e2e3;};'use strict';var multer=require('multer');var util=require(_0x065e('0x0'));var path=require(_0x065e('0x1'));var timeout=require(_0x065e('0x2'));var express=require(_0x065e('0x3'));var router=express[_0x065e('0x4')]();var auth=require(_0x065e('0x5'));var interaction=require(_0x065e('0x6'));var config=require('../../config/environment');var controller=require(_0x065e('0x7'));router[_0x065e('0x8')]('/',auth[_0x065e('0x9')](),controller[_0x065e('0xa')]);router[_0x065e('0x8')](_0x065e('0xb'),controller['webhookGet']);router[_0x065e('0x8')](_0x065e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x065e('0x8')](_0x065e('0xd'),auth[_0x065e('0x9')](),controller[_0x065e('0xe')]);var upload=multer({'storage':multer[_0x065e('0xf')]({'destination':function(_0x499e99,_0x39fb71,_0xad41bc){_0xad41bc(null,path[_0x065e('0x10')](config['root'],_0x065e('0x11')));},'filename':function(_0x2bc165,_0x42f93a,_0x16d9da){_0x42f93a['originalname']=_0x42f93a['originalname'][_0x065e('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16d9da(null,util[_0x065e('0x13')](_0x065e('0x14'),path[_0x065e('0x15')](_0x42f93a['originalname'],path[_0x065e('0x16')](_0x42f93a[_0x065e('0x17')])),Date[_0x065e('0x18')](),path['extname'](_0x42f93a[_0x065e('0x17')])));}})});router[_0x065e('0x19')]('/',upload['single'](_0x065e('0x1a')),controller['upload']);router[_0x065e('0x19')](_0x065e('0xb'),controller[_0x065e('0x1b')]);router[_0x065e('0x1c')](_0x065e('0xc'),auth[_0x065e('0x9')](),controller[_0x065e('0x1d')]);router[_0x065e('0x1e')](_0x065e('0xc'),auth[_0x065e('0x9')](),controller[_0x065e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x363e=['root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x2a4000,_0x3c88d7){var _0x226381=function(_0x3c228e){while(--_0x3c228e){_0x2a4000['push'](_0x2a4000['shift']());}};_0x226381(++_0x3c88d7);}(_0x363e,0x192));var _0xe363=function(_0x364d12,_0x2c31cc){_0x364d12=_0x364d12-0x0;var _0x521308=_0x363e[_0x364d12];return _0x521308;};'use strict';var multer=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var path=require(_0xe363('0x2'));var timeout=require(_0xe363('0x3'));var express=require(_0xe363('0x4'));var router=express[_0xe363('0x5')]();var auth=require(_0xe363('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe363('0x7'));var controller=require('./plugin.controller');router[_0xe363('0x8')]('/',auth[_0xe363('0x9')](),controller[_0xe363('0xa')]);router['get'](_0xe363('0xb'),controller[_0xe363('0xc')]);router[_0xe363('0x8')](_0xe363('0xd'),auth[_0xe363('0x9')](),controller[_0xe363('0xe')]);router['get']('/:id/download',auth[_0xe363('0x9')](),controller[_0xe363('0xf')]);var upload=multer({'storage':multer[_0xe363('0x10')]({'destination':function(_0x4e7d9e,_0x2f73ac,_0x19956a){_0x19956a(null,path[_0xe363('0x11')](config[_0xe363('0x12')],_0xe363('0x13')));},'filename':function(_0x3e261d,_0x418e8b,_0x505313){_0x418e8b[_0xe363('0x14')]=_0x418e8b[_0xe363('0x14')][_0xe363('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x505313(null,util[_0xe363('0x16')](_0xe363('0x17'),path[_0xe363('0x18')](_0x418e8b[_0xe363('0x14')],path[_0xe363('0x19')](_0x418e8b[_0xe363('0x14')])),Date[_0xe363('0x1a')](),path[_0xe363('0x19')](_0x418e8b[_0xe363('0x14')])));}})});router[_0xe363('0x1b')]('/',upload[_0xe363('0x1c')](_0xe363('0x1d')),controller['upload']);router[_0xe363('0x1b')]('/webhook',controller[_0xe363('0x1e')]);router[_0xe363('0x1f')](_0xe363('0xd'),auth[_0xe363('0x9')](),controller[_0xe363('0x20')]);router[_0xe363('0x21')](_0xe363('0xd'),auth[_0xe363('0x9')](),controller['delete']);module[_0xe363('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 3afd730..4216a1e 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 _0xb6b5=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','sequelize','exports','STRING','ENUM'];(function(_0x5148bf,_0x558958){var _0x1e79fb=function(_0x295b2b){while(--_0x295b2b){_0x5148bf['push'](_0x5148bf['shift']());}};_0x1e79fb(++_0x558958);}(_0xb6b5,0x1d5));var _0x5b6b=function(_0x1bff17,_0x47a110){_0x1bff17=_0x1bff17-0x0;var _0x4dba05=_0xb6b5[_0x1bff17];return _0x4dba05;};'use strict';var Sequelize=require(_0x5b6b('0x0'));module[_0x5b6b('0x1')]={'name':{'type':Sequelize[_0x5b6b('0x2')]},'type':{'type':Sequelize[_0x5b6b('0x3')](_0x5b6b('0x4'),_0x5b6b('0x5'))},'description':{'type':Sequelize[_0x5b6b('0x6')]},'version':{'type':Sequelize[_0x5b6b('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0x5b6b('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5b6b('0x8')},'sidebar':{'type':Sequelize[_0x5b6b('0x3')](_0x5b6b('0x9'),'agentOnly','always','never'),'defaultValue':_0x5b6b('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5b6b('0x2')]},'adminUrl':{'type':Sequelize[_0x5b6b('0x2')]},'agentUrl':{'type':Sequelize[_0x5b6b('0x2')]},'scriptName':{'type':Sequelize[_0x5b6b('0x2')]},'scriptPath':{'type':Sequelize[_0x5b6b('0x2')]}}; \ No newline at end of file +var _0xab44=['STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0xab44,0xe2));var _0x4ab4=function(_0x1390c3,_0x3bb90e){_0x1390c3=_0x1390c3-0x0;var _0x444609=_0xab44[_0x1390c3];return _0x444609;};'use strict';var Sequelize=require(_0x4ab4('0x0'));module[_0x4ab4('0x1')]={'name':{'type':Sequelize[_0x4ab4('0x2')]},'type':{'type':Sequelize[_0x4ab4('0x3')](_0x4ab4('0x4'),_0x4ab4('0x5'))},'description':{'type':Sequelize[_0x4ab4('0x6')]},'version':{'type':Sequelize[_0x4ab4('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x4ab4('0x7')],'defaultValue':0x0,'comment':_0x4ab4('0x8')},'sidebar':{'type':Sequelize[_0x4ab4('0x3')]('adminOnly',_0x4ab4('0x9'),_0x4ab4('0xa'),'never'),'defaultValue':_0x4ab4('0xa'),'comment':_0x4ab4('0xb')},'icon':{'type':Sequelize[_0x4ab4('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4ab4('0x2')]},'scriptPath':{'type':Sequelize[_0x4ab4('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f624076..8a710b1 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 _0x2bb1=['Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','node_modules/**/*','attachments/**/*','finalize','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','statusCode','webhookPost','port','%s%s','html-pdf','rimraf','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','save','update','then','destroy','get','UserProfileResource','end','error','name','index','Plugin','rawAttributes','model','keys','query','filters','intersection','fields','attributes','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code'];(function(_0x149308,_0x35c50d){var _0x2df35a=function(_0x537155){while(--_0x537155){_0x149308['push'](_0x149308['shift']());}};_0x2df35a(++_0x35c50d);}(_0x2bb1,0x19d));var _0x12bb=function(_0x2a3e6d,_0x568de5){_0x2a3e6d=_0x2a3e6d-0x0;var _0x4b27a6=_0x2bb1[_0x2a3e6d];return _0x4b27a6;};'use strict';var pdf=require(_0x12bb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x12bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x12bb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x12bb('0x3'));var util=require(_0x12bb('0x4'));var path=require(_0x12bb('0x5'));var sox=require(_0x12bb('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x12bb('0x7'));var squel=require(_0x12bb('0x8'));var crypto=require(_0x12bb('0x9'));var jsforce=require(_0x12bb('0xa'));var deskjs=require(_0x12bb('0xb'));var toCsv=require(_0x12bb('0xc'));var querystring=require(_0x12bb('0xd'));var Papa=require('papaparse');var extract=require(_0x12bb('0xe'));var rimraf=require(_0x12bb('0x1'));var archiver=require(_0x12bb('0xf'));var Redis=require(_0x12bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x12bb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12bb('0x12'))(_0x12bb('0x13'));var utils=require(_0x12bb('0x14'));var config=require('../../config/environment');var db=require(_0x12bb('0x15'))['db'];config['redis']=_[_0x12bb('0x16')](config[_0x12bb('0x17')],{'host':_0x12bb('0x18'),'port':0x18eb});var socket=require(_0x12bb('0x19'))(new Redis(config[_0x12bb('0x17')]));require('./plugin.socket')[_0x12bb('0x1a')](socket);function respondWithStatusCode(_0x532c29,_0x450a88){_0x450a88=_0x450a88||0xcc;return function(_0x2f22b9){if(_0x2f22b9){return _0x532c29[_0x12bb('0x1b')](_0x450a88);}return _0x532c29[_0x12bb('0x1c')](_0x450a88)['end']();};}function respondWithResult(_0x152e41,_0x129b3a){_0x129b3a=_0x129b3a||0xc8;return function(_0x37a4da){if(_0x37a4da){return _0x152e41['status'](_0x129b3a)[_0x12bb('0x1d')](_0x37a4da);}};}function respondWithFilteredResult(_0x3e7c4e,_0x127e2c){return function(_0x58e5ad){if(_0x58e5ad){var _0x4c65d5=_0x58e5ad['count'],_0x49bf32=_0x127e2c[_0x12bb('0x1e')],_0x2966f1=_0x127e2c[_0x12bb('0x1e')]+_0x127e2c[_0x12bb('0x1f')],_0x34754b;if(_0x2966f1>=_0x4c65d5){_0x2966f1=_0x4c65d5;_0x34754b=0xc8;}else{_0x34754b=0xce;}_0x3e7c4e[_0x12bb('0x1c')](_0x34754b);return _0x3e7c4e['set']('Content-Range',_0x49bf32+'-'+_0x2966f1+'/'+_0x4c65d5)[_0x12bb('0x1d')](_0x58e5ad);}return null;};}function patchUpdates(_0x4b921c){return function(_0x4f9dd0){try{jsonpatch['apply'](_0x4f9dd0,_0x4b921c,!![]);}catch(_0x44879a){return BPromise['reject'](_0x44879a);}return _0x4f9dd0[_0x12bb('0x20')]();};}function saveUpdates(_0x4e100e,_0x82c105){return function(_0x785f78){if(_0x785f78){return _0x785f78[_0x12bb('0x21')](_0x4e100e)[_0x12bb('0x22')](function(_0x1058ee){return _0x1058ee;});}return null;};}function removeEntity(_0x3aec38,_0x16a649){return function(_0x25bc63){if(_0x25bc63){return _0x25bc63[_0x12bb('0x23')]()[_0x12bb('0x22')](function(){var _0x344e7e=_0x25bc63[_0x12bb('0x24')]({'plain':!![]});var _0x59196c='Plugins';return db[_0x12bb('0x25')][_0x12bb('0x23')]({'where':{'type':_0x59196c,'resourceId':_0x344e7e['id']}})[_0x12bb('0x22')](function(){return _0x25bc63;});})[_0x12bb('0x22')](function(){_0x3aec38['status'](0xcc)[_0x12bb('0x26')]();});}};}function handleEntityNotFound(_0x423b71,_0x554dd6){return function(_0x59e96e){if(!_0x59e96e){_0x423b71[_0x12bb('0x1b')](0x194);}return _0x59e96e;};}function handleError(_0x48b65c,_0x5835fa){_0x5835fa=_0x5835fa||0x1f4;return function(_0x3bc1d1){logger[_0x12bb('0x27')](_0x3bc1d1['stack']);if(_0x3bc1d1[_0x12bb('0x28')]){delete _0x3bc1d1[_0x12bb('0x28')];}_0x48b65c[_0x12bb('0x1c')](_0x5835fa)['send'](_0x3bc1d1);};}exports[_0x12bb('0x29')]=function(_0x1c4ddc,_0x37b47a){var _0x5048aa={},_0x1baa5e={},_0x22990e={'count':0x0,'rows':[]};var _0x3258b9=db[_0x12bb('0x2a')][_0x12bb('0x2b')];_0x1baa5e[_0x12bb('0x2c')]=_[_0x12bb('0x2d')](_0x3258b9);_0x1baa5e[_0x12bb('0x2e')]=_[_0x12bb('0x2d')](_0x1c4ddc[_0x12bb('0x2e')]);_0x1baa5e[_0x12bb('0x2f')]=_['intersection'](_0x1baa5e[_0x12bb('0x2c')],_0x1baa5e[_0x12bb('0x2e')]);_0x5048aa['attributes']=_[_0x12bb('0x30')](_0x1baa5e[_0x12bb('0x2c')],qs[_0x12bb('0x31')](_0x1c4ddc[_0x12bb('0x2e')][_0x12bb('0x31')]));_0x5048aa['attributes']=_0x5048aa[_0x12bb('0x32')]['length']?_0x5048aa[_0x12bb('0x32')]:_0x1baa5e[_0x12bb('0x2c')];if(!_0x1c4ddc[_0x12bb('0x2e')]['hasOwnProperty']('nolimit')){_0x5048aa[_0x12bb('0x1f')]=qs[_0x12bb('0x1f')](_0x1c4ddc[_0x12bb('0x2e')][_0x12bb('0x1f')]);_0x5048aa[_0x12bb('0x1e')]=qs[_0x12bb('0x1e')](_0x1c4ddc[_0x12bb('0x2e')][_0x12bb('0x1e')]);}_0x5048aa['order']=qs[_0x12bb('0x33')](_0x1c4ddc[_0x12bb('0x2e')][_0x12bb('0x33')]);_0x5048aa[_0x12bb('0x34')]=qs[_0x12bb('0x2f')](_[_0x12bb('0x35')](_0x1c4ddc['query'],_0x1baa5e['filters']));if(_0x1c4ddc['query'][_0x12bb('0x36')]){_0x5048aa['where']=_[_0x12bb('0x37')](_0x5048aa[_0x12bb('0x34')],{'$or':_[_0x12bb('0x38')](_0x3258b9,function(_0x3d8307){if(_0x3d8307[_0x12bb('0x39')]['key']!==_0x12bb('0x3a')){var _0xdd83dd={};_0xdd83dd[_0x3d8307['field']]={'$like':'%'+_0x1c4ddc[_0x12bb('0x2e')][_0x12bb('0x36')]+'%'};return _0xdd83dd;}})});}_0x5048aa=_[_0x12bb('0x37')]({},_0x5048aa,_0x1c4ddc[_0x12bb('0x3b')]);var _0x5868d2={'where':_0x5048aa['where']};return db['Plugin'][_0x12bb('0x3c')](_0x5868d2)[_0x12bb('0x22')](function(_0x33decc){_0x22990e[_0x12bb('0x3c')]=_0x33decc;if(_0x1c4ddc[_0x12bb('0x2e')][_0x12bb('0x3d')]){_0x5048aa['include']=[{'all':!![]}];}return db[_0x12bb('0x2a')][_0x12bb('0x3e')](_0x5048aa);})[_0x12bb('0x22')](function(_0x937680){_0x22990e[_0x12bb('0x3f')]=_0x937680;return _0x22990e;})['then'](respondWithFilteredResult(_0x37b47a,_0x5048aa))[_0x12bb('0x40')](handleError(_0x37b47a,null));};exports[_0x12bb('0x41')]=function(_0x9204a9,_0x587907){var _0x29527c={'raw':!![],'where':{'id':_0x9204a9[_0x12bb('0x42')]['id']}},_0x206c88={};_0x206c88[_0x12bb('0x2c')]=_[_0x12bb('0x2d')](db[_0x12bb('0x2a')]['rawAttributes']);_0x206c88[_0x12bb('0x2e')]=_[_0x12bb('0x2d')](_0x9204a9[_0x12bb('0x2e')]);_0x206c88[_0x12bb('0x2f')]=_['intersection'](_0x206c88[_0x12bb('0x2c')],_0x206c88[_0x12bb('0x2e')]);_0x29527c[_0x12bb('0x32')]=_['intersection'](_0x206c88['model'],qs[_0x12bb('0x31')](_0x9204a9[_0x12bb('0x2e')]['fields']));_0x29527c[_0x12bb('0x32')]=_0x29527c[_0x12bb('0x32')][_0x12bb('0x43')]?_0x29527c[_0x12bb('0x32')]:_0x206c88['model'];if(_0x9204a9[_0x12bb('0x2e')][_0x12bb('0x3d')]){_0x29527c[_0x12bb('0x44')]=[{'all':!![]}];}_0x29527c=_[_0x12bb('0x37')]({},_0x29527c,_0x9204a9[_0x12bb('0x3b')]);return db['Plugin'][_0x12bb('0x45')](_0x29527c)['then'](handleEntityNotFound(_0x587907,null))[_0x12bb('0x22')](respondWithResult(_0x587907,null))[_0x12bb('0x40')](handleError(_0x587907,null));};exports['download']=function(_0x31c7e7,_0x57db7d,_0x944fb4){return db['Plugin'][_0x12bb('0x45')]({'where':{'id':_0x31c7e7[_0x12bb('0x42')]['id']},'attributes':[_0x12bb('0x28'),'path'],'raw':!![]})[_0x12bb('0x22')](handleEntityNotFound(_0x57db7d,null))[_0x12bb('0x22')](function(_0x355ea9){if(_0x355ea9){var _0x2c9dbf=path[_0x12bb('0x46')](config[_0x12bb('0x47')],_0x12bb('0x48'),util[_0x12bb('0x49')](_0x12bb('0x4a'),path[_0x12bb('0x4b')](_0x355ea9['path'])));var _0x38c702=fs[_0x12bb('0x4c')](_0x2c9dbf);var _0x1d9b7b=archiver(_0x12bb('0x4d'),{'zlib':{'level':0x9}});_0x1d9b7b['on']('warning',function(_0x2da81f){if(_0x2da81f[_0x12bb('0x4e')]==='ENOENT'){logger[_0x12bb('0x27')](_0x2da81f);}else{throw new db[(_0x12bb('0x4f'))]['Error'](_0x12bb('0x50'));}});_0x1d9b7b['on'](_0x12bb('0x27'),function(_0x375f95){throw new db[(_0x12bb('0x4f'))][(_0x12bb('0x51'))](_0x12bb('0x50'));});_0x1d9b7b[_0x12bb('0x52')](_0x38c702);_0x1d9b7b[_0x12bb('0x53')]('**/*',{'cwd':path['join'](config['root'],'server/files/plugins',path['dirname'](_0x355ea9['path'])),'ignore':[path['join'](path[_0x12bb('0x4b')](_0x355ea9[_0x12bb('0x5')]),_0x12bb('0x54')),path['join'](path[_0x12bb('0x4b')](_0x355ea9[_0x12bb('0x5')]),_0x12bb('0x55'))],'nodir':!![]})[_0x12bb('0x56')]();_0x38c702['on']('close',function(){if(!fs[_0x12bb('0x57')](_0x2c9dbf)){throw new db['Sequelize'][(_0x12bb('0x51'))]('Plugin\x20not\x20found');}return _0x57db7d[_0x12bb('0x58')](_0x2c9dbf,util[_0x12bb('0x49')](_0x12bb('0x4a'),path[_0x12bb('0x4b')](_0x355ea9[_0x12bb('0x5')])),function(_0x23e7f8){if(_0x23e7f8){throw new db[(_0x12bb('0x4f'))]['Error'](_0x12bb('0x59'));}fs[_0x12bb('0x5a')](_0x2c9dbf);logger[_0x12bb('0x5b')](_0x12bb('0x5c'));logger['info'](_0x12bb('0x5d'));});});}return null;})[_0x12bb('0x40')](handleError(_0x57db7d,null));};exports[_0x12bb('0x5e')]=function(_0x3ad848,_0x2feaa7,_0x253642){var _0x28604c=path[_0x12bb('0x4b')](_0x3ad848['file'][_0x12bb('0x5f')],path[_0x12bb('0x60')](_0x3ad848[_0x12bb('0x61')][_0x12bb('0x5f')]));var _0x3ff859=path[_0x12bb('0x46')](config['root'],_0x12bb('0x48'),_0x3ad848[_0x12bb('0x61')][_0x12bb('0x5f')]);var _0x269574=path[_0x12bb('0x46')](config[_0x12bb('0x47')],'server/files/plugins',_0x28604c);logger[_0x12bb('0x5b')](_0x12bb('0x62'),_0x3ff859);logger['info'](_0x12bb('0x63'),_0x269574);try{fs[_0x12bb('0x64')](_0x3ff859,parseInt(_0x12bb('0x65'),0x8));extract(_0x3ff859,{'dir':_0x269574},function(_0x2770a0){if(_0x2770a0){logger[_0x12bb('0x27')](_0x2770a0);handleError(_0x2770a0,!![]);};var _0x2339b3=fs[_0x12bb('0x66')](_0x269574);if(_0x2339b3['length']>0x1){removeReferences(_0x3ff859,_0x269574);logger[_0x12bb('0x27')]('Invalid\x20plugin\x20structure');return _0x253642(new Error(_0x12bb('0x67')));}var _0x23c917=fs[_0x12bb('0x68')](path[_0x12bb('0x46')](_0x269574,_0x2339b3[0x0]));if(_0x23c917[_0x12bb('0x69')]()){removeReferences(_0x3ff859,_0x269574);logger[_0x12bb('0x27')](_0x12bb('0x67'));return _0x253642(new Error(_0x12bb('0x67')));}if(_0x23c917[_0x12bb('0x6a')]()){var _0xd7648=fs[_0x12bb('0x66')](path['join'](_0x269574,_0x2339b3[0x0]));if(_0xd7648[_0x12bb('0x43')]===0x0){removeReferences(_0x3ff859,_0x269574);logger[_0x12bb('0x27')](_0x12bb('0x67'));return _0x253642(new Error('Invalid\x20plugin\x20structure'));}var _0x44f9d0=_0xd7648[_0x12bb('0x6b')](function(_0x5362b6){return _0x5362b6===_0x12bb('0x6c');});if(!_0x44f9d0){return _0x253642(new Error(_0x12bb('0x6d')));}var _0x3fc20a=fs[_0x12bb('0x6e')](path['join'](_0x269574,_0x2339b3[0x0],'manifest.json'));var _0x3bfcc6=JSON[_0x12bb('0x6f')](_0x3fc20a);if(_0x12bb('0x70')==typeof _0x3bfcc6[_0x12bb('0x28')]){return _0x253642(new Error(_0x12bb('0x71')));}if(_0x12bb('0x70')==typeof _0x3bfcc6['type']){return _0x253642(new Error(_0x12bb('0x72')));}if('undefined'==typeof _0x3bfcc6[_0x12bb('0x73')]){return _0x253642(new Error(_0x12bb('0x74')));}if(_0x12bb('0x70')==typeof _0x3bfcc6[_0x12bb('0x75')]){return _0x253642(new Error(_0x12bb('0x76')));}if(_0x3bfcc6[_0x12bb('0x39')]===_0x12bb('0x77')){if(_0x12bb('0x70')==typeof _0x3bfcc6[_0x12bb('0x75')]['views']){return _0x253642(new Error(_0x12bb('0x78')));}if(_0x12bb('0x70')==typeof _0x3bfcc6['parameters'][_0x12bb('0x79')]['admin']&&'undefined'==typeof _0x3bfcc6['parameters'][_0x12bb('0x79')][_0x12bb('0x7a')]){return _0x253642(new Error(_0x12bb('0x7b')));}}else if(_0x3bfcc6[_0x12bb('0x39')]===_0x12bb('0x7c')){if(_0x12bb('0x70')==typeof _0x3bfcc6['parameters'][_0x12bb('0x7d')]){return _0x253642(new Error(_0x12bb('0x7e')));}if(_0x12bb('0x70')==typeof _0x3bfcc6[_0x12bb('0x75')]['scriptPath']){return _0x253642(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x253642(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x13612b=_0x3bfcc6[_0x12bb('0x28')];var _0x3f899d=_0x3bfcc6[_0x12bb('0x7f')];var _0x7d96cf=_0x3bfcc6[_0x12bb('0x39')];var _0x4df73a=_0x3bfcc6[_0x12bb('0x80')]?_0x3bfcc6[_0x12bb('0x80')]:_0x12bb('0x81');var _0x3633e4=_0x3bfcc6[_0x12bb('0x82')]?_0x3bfcc6[_0x12bb('0x82')]:'icon-apps';var _0x341f46='';var _0x45c95d='';var _0x1f7e12='';var _0x5ebab0='';var _0x4d4c19=_0x3bfcc6['version'];if(_0x7d96cf==='html'){if(_0x12bb('0x70')!=typeof _0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x79')][_0x12bb('0x83')]){var _0x37c599=_0x3bfcc6[_0x12bb('0x75')]['views'][_0x12bb('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x12bb('0x84')](_0x37c599)){_0x341f46=path[_0x12bb('0x46')](_0x12bb('0x85'),_0x28604c,_0x2339b3[0x0],_0x37c599);}else{_0x341f46=_0x37c599;}}else{logger[_0x12bb('0x5b')](_0x12bb('0x86'));}if(_0x12bb('0x70')!=typeof _0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x79')][_0x12bb('0x7a')]){var _0x25d067=_0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x79')][_0x12bb('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x12bb('0x84')](_0x25d067)){_0x45c95d=path[_0x12bb('0x46')](_0x12bb('0x85'),_0x28604c,_0x2339b3[0x0],_0x25d067);}else{_0x45c95d=_0x25d067;}}else{logger['info'](_0x12bb('0x87'));}}else if(_0x7d96cf===_0x12bb('0x7c')){_0x1f7e12=_0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x7d')];_0x5ebab0=_0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x88')];if('undefined'!=typeof _0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x79')]){if(_0x12bb('0x70')!=typeof _0x3bfcc6['parameters'][_0x12bb('0x79')][_0x12bb('0x83')]){var _0x37c599=_0x3bfcc6[_0x12bb('0x75')][_0x12bb('0x79')][_0x12bb('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x12bb('0x84')](_0x37c599)){_0x341f46=path[_0x12bb('0x46')](_0x12bb('0x85'),_0x28604c,_0x2339b3[0x0],_0x37c599);}else{_0x341f46=_0x37c599;}}if(_0x12bb('0x70')!=typeof _0x3bfcc6['parameters'][_0x12bb('0x79')]['agent']){var _0x25d067=_0x3bfcc6[_0x12bb('0x75')]['views'][_0x12bb('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x12bb('0x84')](_0x25d067)){_0x45c95d=path['join']('plugins',_0x28604c,_0x2339b3[0x0],_0x25d067);}else{_0x45c95d=_0x25d067;}}}}var _0x114e9f={'name':_0x13612b,'description':_0x3f899d,'path':path['join'](_0x28604c,_0x2339b3[0x0]),'type':_0x7d96cf,'sidebar':_0x4df73a,'icon':_0x3633e4,'adminUrl':_0x341f46,'agentUrl':_0x45c95d,'scriptName':_0x1f7e12,'scriptPath':_0x5ebab0,'version':_0x4d4c19};removeReferences(_0x3ff859,null);return db[_0x12bb('0x2a')][_0x12bb('0x89')](_0x114e9f)[_0x12bb('0x22')](function(_0x285a62){var _0x2db9ae={'role':_0x3ad848['body']['role'],'userProfileId':_0x3ad848[_0x12bb('0x8a')]['userProfileId']};if(!_0x2db9ae)throw new Error(_0x12bb('0x8b'));if(_0x2db9ae[_0x12bb('0x8c')]===_0x12bb('0x8d')){var _0x29f419=_0x285a62['get']({'plain':!![]});return db['UserProfileSection'][_0x12bb('0x45')]({'where':{'name':'Plugins','userProfileId':_0x2db9ae[_0x12bb('0x8e')]},'raw':!![]})[_0x12bb('0x22')](function(_0x389433){if(_0x389433&&_0x389433[_0x12bb('0x8f')]===0x0){return db['UserProfileResource'][_0x12bb('0x89')]({'name':_0x29f419[_0x12bb('0x28')],'resourceId':_0x29f419['id'],'type':_0x389433[_0x12bb('0x28')],'sectionId':_0x389433['id']},{})['then'](function(){return _0x285a62;});}else{return _0x285a62;}})['catch'](function(_0x5814db){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5814db);throw _0x5814db;});}return _0x285a62;})[_0x12bb('0x22')](respondWithResult(_0x2feaa7,null))['catch'](handleError(_0x2feaa7,null));}});}catch(_0x22c9b5){_0x2feaa7[_0x12bb('0x1c')](0x1f4)[_0x12bb('0x90')](_0x22c9b5);}};function removeReferences(_0x245788,_0x1b7e08){try{if(_0x245788){fs[_0x12bb('0x5a')](_0x245788);logger[_0x12bb('0x5b')](_0x12bb('0x91'));}if(_0x1b7e08){rimraf(_0x1b7e08,function(){});logger[_0x12bb('0x5b')](_0x12bb('0x92'));}}catch(_0x579027){logger[_0x12bb('0x27')](_0x579027);}}exports[_0x12bb('0x21')]=function(_0x7efb0a,_0x36c16d,_0x669dc7){return db[_0x12bb('0x2a')][_0x12bb('0x45')]({'where':{'id':_0x7efb0a[_0x12bb('0x42')]['id']}})[_0x12bb('0x22')](handleEntityNotFound(_0x36c16d,null))['then'](saveUpdates(_0x7efb0a[_0x12bb('0x8a')],null))[_0x12bb('0x22')](respondWithResult(_0x36c16d,null))[_0x12bb('0x40')](handleError(_0x36c16d,null));};exports[_0x12bb('0x93')]=function(_0x5444c5,_0x4150e0,_0x3bf3bb){return db[_0x12bb('0x2a')][_0x12bb('0x45')]({'where':{'id':_0x5444c5[_0x12bb('0x42')]['id']}})[_0x12bb('0x22')](function(_0x577aab){if(_0x577aab){return _0x577aab[_0x12bb('0x23')]();}})['then'](function(_0xd1f510){rimraf(path['join'](config[_0x12bb('0x47')],'server/files/plugins',path[_0x12bb('0x94')](_0xd1f510[_0x12bb('0x5')])),function(){});return _0xd1f510;})[_0x12bb('0x22')](handleEntityNotFound(_0x4150e0,null))[_0x12bb('0x22')](respondWithStatusCode(_0x4150e0,null))[_0x12bb('0x40')](handleError(_0x4150e0,null));};exports['webhookGet']=function(_0xa9ff1d,_0xf7700d,_0x2e0156){return BPromise[_0x12bb('0x95')]()['then'](function(){if(!_0xa9ff1d[_0x12bb('0x2e')]['path']){throw new Error(_0x12bb('0x96'));}if(!_0xa9ff1d[_0x12bb('0x2e')]['port']){throw new Error(_0x12bb('0x97'));}var _0x21d757=_0xa9ff1d[_0x12bb('0x2e')][_0x12bb('0x98')]?_0xa9ff1d[_0x12bb('0x2e')][_0x12bb('0x98')]+':'+_0xa9ff1d['query']['port']:_0x12bb('0x99')+_0xa9ff1d[_0x12bb('0x2e')]['port'];var _0x4f2f6f=_0xa9ff1d[_0x12bb('0x2e')][_0x12bb('0x1d')]?_0xa9ff1d[_0x12bb('0x2e')][_0x12bb('0x1d')]:!![];var _0x161d7f=_0xa9ff1d['query'][_0x12bb('0x9a')]?_0xa9ff1d[_0x12bb('0x2e')][_0x12bb('0x9a')]:null;var _0x730248={'method':_0xa9ff1d[_0x12bb('0x9b')],'uri':util[_0x12bb('0x49')]('%s%s',_0x21d757,_0xa9ff1d['query'][_0x12bb('0x5')]),'json':_0x4f2f6f,'resolveWithFullResponse':!![],'encoding':_0x161d7f,'qs':_0xa9ff1d[_0x12bb('0x2e')]};if(_0xa9ff1d[_0x12bb('0x9c')]){_0x730248[_0x12bb('0x9c')]=_0xa9ff1d[_0x12bb('0x9c')];if(_0x730248[_0x12bb('0x9c')][_0x12bb('0x9d')]){delete _0x730248[_0x12bb('0x9c')]['content-length'];}}if(_0x730248[_0x12bb('0x9c')]['content-type']){delete _0x730248[_0x12bb('0x9c')][_0x12bb('0x9e')];}return rp(_0x730248);})[_0x12bb('0x22')](function(_0x1f2fe2){if(_0x1f2fe2){_0xf7700d[_0x12bb('0x9f')](_0x1f2fe2[_0x12bb('0x9c')]);logger[_0x12bb('0x5b')](_0x1f2fe2['body']);if(_['endsWith'](_0xa9ff1d[_0x12bb('0x2e')][_0x12bb('0x5')],_0x12bb('0x58'))&&_0x1f2fe2[_0x12bb('0xa0')]==0x1f4){return _0xf7700d[_0x12bb('0x1b')](_0x1f2fe2['statusCode']);}else{return _0xf7700d[_0x12bb('0x1c')](_0x1f2fe2[_0x12bb('0xa0')])['send'](_0x1f2fe2[_0x12bb('0x8a')]);}}else{return _0xf7700d[_0x12bb('0x1b')](0xc8);}})[_0x12bb('0x40')](handleError(_0xf7700d,null));};exports[_0x12bb('0xa1')]=function(_0x447a35,_0x20901b,_0x2b5d16){return BPromise[_0x12bb('0x95')]()[_0x12bb('0x22')](function(){if(!_0x447a35[_0x12bb('0x2e')][_0x12bb('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x447a35[_0x12bb('0x2e')][_0x12bb('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5da3de=_0x447a35[_0x12bb('0x2e')][_0x12bb('0x98')]?_0x447a35[_0x12bb('0x2e')][_0x12bb('0x98')]+':'+_0x447a35[_0x12bb('0x2e')]['port']:_0x12bb('0x99')+_0x447a35['query']['port'];var _0x2af86c=_0x447a35[_0x12bb('0x2e')][_0x12bb('0x1d')]?_0x447a35['query'][_0x12bb('0x1d')]:!![];var _0x4e643a=_0x447a35[_0x12bb('0x2e')][_0x12bb('0x9a')]?_0x447a35['query'][_0x12bb('0x9a')]:null;var _0x44dae5={'method':_0x447a35[_0x12bb('0x9b')],'uri':util['format'](_0x12bb('0xa3'),_0x5da3de,_0x447a35[_0x12bb('0x2e')][_0x12bb('0x5')]),'json':_0x2af86c,'resolveWithFullResponse':!![],'encoding':_0x4e643a,'body':_0x447a35['body']};if(_0x447a35['headers']){_0x44dae5['headers']=_0x447a35['headers'];if(_0x44dae5[_0x12bb('0x9c')]['content-length']){delete _0x44dae5[_0x12bb('0x9c')]['content-length'];}}if(_0x44dae5['headers']['content-type']){delete _0x44dae5['headers'][_0x12bb('0x9e')];}return rp(_0x44dae5);})[_0x12bb('0x22')](function(_0x20099f){if(_0x20099f){_0x20901b[_0x12bb('0x9f')](_0x20099f[_0x12bb('0x9c')]);logger[_0x12bb('0x5b')](_0x20099f[_0x12bb('0x8a')]);return _0x20901b[_0x12bb('0x1c')](_0x20099f[_0x12bb('0xa0')])[_0x12bb('0x90')](_0x20099f[_0x12bb('0x8a')]);}else{return _0x20901b['sendStatus'](0xc8);}})[_0x12bb('0x40')](handleError(_0x20901b,null));}; \ No newline at end of file +var _0x3437=['update','then','destroy','get','UserProfileResource','error','stack','name','send','index','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','Plugin','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','format','%s%s','headers','content-length','statusCode','webhookPost','http://localhost:','content-type','set','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x6c7f6f,_0x4c9659){var _0x279db4=function(_0x380692){while(--_0x380692){_0x6c7f6f['push'](_0x6c7f6f['shift']());}};_0x279db4(++_0x4c9659);}(_0x3437,0x1e0));var _0x7343=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3437[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x7343('0x0'));var emlformat=require(_0x7343('0x1'));var rimraf=require(_0x7343('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7343('0x3'));var moment=require('moment');var BPromise=require(_0x7343('0x4'));var Mustache=require(_0x7343('0x5'));var util=require('util');var path=require(_0x7343('0x6'));var sox=require(_0x7343('0x7'));var csv=require('to-csv');var ejs=require(_0x7343('0x8'));var fs=require('fs');var _=require(_0x7343('0x9'));var squel=require('squel');var crypto=require(_0x7343('0xa'));var jsforce=require(_0x7343('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7343('0xc'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x7343('0xd'));var Redis=require(_0x7343('0xe'));var authService=require(_0x7343('0xf'));var qs=require(_0x7343('0x10'));var hardwareService=require(_0x7343('0x11'));var logger=require(_0x7343('0x12'))(_0x7343('0x13'));var utils=require(_0x7343('0x14'));var config=require(_0x7343('0x15'));var db=require(_0x7343('0x16'))['db'];config['redis']=_[_0x7343('0x17')](config[_0x7343('0x18')],{'host':_0x7343('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7343('0x18')]));require(_0x7343('0x1a'))[_0x7343('0x1b')](socket);function respondWithStatusCode(_0x16f6b3,_0x59bf58){_0x59bf58=_0x59bf58||0xcc;return function(_0x1719ec){if(_0x1719ec){return _0x16f6b3[_0x7343('0x1c')](_0x59bf58);}return _0x16f6b3[_0x7343('0x1d')](_0x59bf58)[_0x7343('0x1e')]();};}function respondWithResult(_0x6c871a,_0x479e2e){_0x479e2e=_0x479e2e||0xc8;return function(_0x4d22b4){if(_0x4d22b4){return _0x6c871a[_0x7343('0x1d')](_0x479e2e)[_0x7343('0x1f')](_0x4d22b4);}};}function respondWithFilteredResult(_0x30a2da,_0x5c0648){return function(_0x340d3d){if(_0x340d3d){var _0x5dd801=_0x340d3d[_0x7343('0x20')],_0x22c8c7=_0x5c0648[_0x7343('0x21')],_0xfd2bbf=_0x5c0648[_0x7343('0x21')]+_0x5c0648[_0x7343('0x22')],_0x4cb395;if(_0xfd2bbf>=_0x5dd801){_0xfd2bbf=_0x5dd801;_0x4cb395=0xc8;}else{_0x4cb395=0xce;}_0x30a2da['status'](_0x4cb395);return _0x30a2da['set'](_0x7343('0x23'),_0x22c8c7+'-'+_0xfd2bbf+'/'+_0x5dd801)[_0x7343('0x1f')](_0x340d3d);}return null;};}function patchUpdates(_0x108356){return function(_0x108032){try{jsonpatch[_0x7343('0x24')](_0x108032,_0x108356,!![]);}catch(_0x1b3485){return BPromise[_0x7343('0x25')](_0x1b3485);}return _0x108032[_0x7343('0x26')]();};}function saveUpdates(_0x4a4d17,_0x16e53f){return function(_0x301177){if(_0x301177){return _0x301177[_0x7343('0x27')](_0x4a4d17)[_0x7343('0x28')](function(_0x451c96){return _0x451c96;});}return null;};}function removeEntity(_0x2d3347,_0x570b13){return function(_0x1f9ab0){if(_0x1f9ab0){return _0x1f9ab0[_0x7343('0x29')]()[_0x7343('0x28')](function(){var _0x3c3834=_0x1f9ab0[_0x7343('0x2a')]({'plain':!![]});var _0x3bb012='Plugins';return db[_0x7343('0x2b')][_0x7343('0x29')]({'where':{'type':_0x3bb012,'resourceId':_0x3c3834['id']}})[_0x7343('0x28')](function(){return _0x1f9ab0;});})[_0x7343('0x28')](function(){_0x2d3347[_0x7343('0x1d')](0xcc)[_0x7343('0x1e')]();});}};}function handleEntityNotFound(_0x2da240,_0x2c39d4){return function(_0x18fa55){if(!_0x18fa55){_0x2da240['sendStatus'](0x194);}return _0x18fa55;};}function handleError(_0x3695b2,_0xe1550d){_0xe1550d=_0xe1550d||0x1f4;return function(_0x371ae7){logger[_0x7343('0x2c')](_0x371ae7[_0x7343('0x2d')]);if(_0x371ae7[_0x7343('0x2e')]){delete _0x371ae7[_0x7343('0x2e')];}_0x3695b2[_0x7343('0x1d')](_0xe1550d)[_0x7343('0x2f')](_0x371ae7);};}exports[_0x7343('0x30')]=function(_0x2f902c,_0x57abfb){var _0x150768={},_0xc611a5={},_0x2b0193={'count':0x0,'rows':[]};var _0x2d9c44=db['Plugin']['rawAttributes'];_0xc611a5['model']=_[_0x7343('0x31')](_0x2d9c44);_0xc611a5[_0x7343('0x32')]=_['keys'](_0x2f902c[_0x7343('0x32')]);_0xc611a5[_0x7343('0x33')]=_[_0x7343('0x34')](_0xc611a5[_0x7343('0x35')],_0xc611a5[_0x7343('0x32')]);_0x150768[_0x7343('0x36')]=_[_0x7343('0x34')](_0xc611a5[_0x7343('0x35')],qs[_0x7343('0x37')](_0x2f902c[_0x7343('0x32')][_0x7343('0x37')]));_0x150768['attributes']=_0x150768[_0x7343('0x36')]['length']?_0x150768[_0x7343('0x36')]:_0xc611a5[_0x7343('0x35')];if(!_0x2f902c[_0x7343('0x32')][_0x7343('0x38')](_0x7343('0x39'))){_0x150768[_0x7343('0x22')]=qs['limit'](_0x2f902c['query']['limit']);_0x150768[_0x7343('0x21')]=qs[_0x7343('0x21')](_0x2f902c[_0x7343('0x32')][_0x7343('0x21')]);}_0x150768[_0x7343('0x3a')]=qs[_0x7343('0x3b')](_0x2f902c[_0x7343('0x32')]['sort']);_0x150768[_0x7343('0x3c')]=qs[_0x7343('0x33')](_['pick'](_0x2f902c['query'],_0xc611a5[_0x7343('0x33')]));if(_0x2f902c['query'][_0x7343('0x3d')]){_0x150768['where']=_[_0x7343('0x3e')](_0x150768['where'],{'$or':_[_0x7343('0x3f')](_0x2d9c44,function(_0x56f845){if(_0x56f845[_0x7343('0x40')][_0x7343('0x41')]!==_0x7343('0x42')){var _0x561ac3={};_0x561ac3[_0x56f845[_0x7343('0x43')]]={'$like':'%'+_0x2f902c[_0x7343('0x32')]['filter']+'%'};return _0x561ac3;}})});}_0x150768=_[_0x7343('0x3e')]({},_0x150768,_0x2f902c[_0x7343('0x44')]);var _0x5eae9a={'where':_0x150768['where']};return db[_0x7343('0x45')][_0x7343('0x20')](_0x5eae9a)['then'](function(_0x4b80aa){_0x2b0193[_0x7343('0x20')]=_0x4b80aa;if(_0x2f902c['query'][_0x7343('0x46')]){_0x150768[_0x7343('0x47')]=[{'all':!![]}];}return db[_0x7343('0x45')][_0x7343('0x48')](_0x150768);})[_0x7343('0x28')](function(_0x4efabc){_0x2b0193[_0x7343('0x49')]=_0x4efabc;return _0x2b0193;})[_0x7343('0x28')](respondWithFilteredResult(_0x57abfb,_0x150768))[_0x7343('0x4a')](handleError(_0x57abfb,null));};exports[_0x7343('0x4b')]=function(_0x5b53d3,_0x585e5a){var _0x4522e9={'raw':!![],'where':{'id':_0x5b53d3[_0x7343('0x4c')]['id']}},_0xe70a16={};_0xe70a16[_0x7343('0x35')]=_[_0x7343('0x31')](db[_0x7343('0x45')]['rawAttributes']);_0xe70a16[_0x7343('0x32')]=_[_0x7343('0x31')](_0x5b53d3['query']);_0xe70a16['filters']=_[_0x7343('0x34')](_0xe70a16['model'],_0xe70a16[_0x7343('0x32')]);_0x4522e9[_0x7343('0x36')]=_[_0x7343('0x34')](_0xe70a16[_0x7343('0x35')],qs['fields'](_0x5b53d3[_0x7343('0x32')]['fields']));_0x4522e9['attributes']=_0x4522e9[_0x7343('0x36')]['length']?_0x4522e9[_0x7343('0x36')]:_0xe70a16[_0x7343('0x35')];if(_0x5b53d3[_0x7343('0x32')][_0x7343('0x46')]){_0x4522e9['include']=[{'all':!![]}];}_0x4522e9=_[_0x7343('0x3e')]({},_0x4522e9,_0x5b53d3[_0x7343('0x44')]);return db[_0x7343('0x45')][_0x7343('0x4d')](_0x4522e9)[_0x7343('0x28')](handleEntityNotFound(_0x585e5a,null))[_0x7343('0x28')](respondWithResult(_0x585e5a,null))[_0x7343('0x4a')](handleError(_0x585e5a,null));};exports[_0x7343('0x4e')]=function(_0x392bd1,_0x168c6b,_0x26c155){return db['Plugin'][_0x7343('0x4d')]({'where':{'id':_0x392bd1['params']['id']},'attributes':[_0x7343('0x2e'),_0x7343('0x6')],'raw':!![]})[_0x7343('0x28')](handleEntityNotFound(_0x168c6b,null))[_0x7343('0x28')](function(_0x38e873){if(_0x38e873){var _0x2236b1=path[_0x7343('0x4f')](config[_0x7343('0x50')],_0x7343('0x51'),util['format']('%s.zip',path[_0x7343('0x52')](_0x38e873['path'])));var _0x385d2a=fs['createWriteStream'](_0x2236b1);var _0xcd862c=archiver('zip',{'zlib':{'level':0x9}});_0xcd862c['on'](_0x7343('0x53'),function(_0x22fb1f){if(_0x22fb1f[_0x7343('0x54')]===_0x7343('0x55')){logger[_0x7343('0x2c')](_0x22fb1f);}else{throw new db[(_0x7343('0x56'))][(_0x7343('0x57'))](_0x7343('0x58'));}});_0xcd862c['on'](_0x7343('0x2c'),function(_0x16a66c){throw new db[(_0x7343('0x56'))][(_0x7343('0x57'))](_0x7343('0x58'));});_0xcd862c['pipe'](_0x385d2a);_0xcd862c['glob'](_0x7343('0x59'),{'cwd':path[_0x7343('0x4f')](config[_0x7343('0x50')],'server/files/plugins',path['dirname'](_0x38e873['path'])),'ignore':[path['join'](path[_0x7343('0x52')](_0x38e873[_0x7343('0x6')]),_0x7343('0x5a')),path[_0x7343('0x4f')](path[_0x7343('0x52')](_0x38e873[_0x7343('0x6')]),_0x7343('0x5b'))],'nodir':!![]})[_0x7343('0x5c')]();_0x385d2a['on'](_0x7343('0x5d'),function(){if(!fs[_0x7343('0x5e')](_0x2236b1)){throw new db[(_0x7343('0x56'))]['Error']('Plugin\x20not\x20found');}return _0x168c6b[_0x7343('0x4e')](_0x2236b1,util['format']('%s.zip',path[_0x7343('0x52')](_0x38e873[_0x7343('0x6')])),function(_0x1cfa41){if(_0x1cfa41){throw new db[(_0x7343('0x56'))][(_0x7343('0x57'))](_0x7343('0x5f'));}fs['unlinkSync'](_0x2236b1);logger['info'](_0x7343('0x60'));logger['info'](_0x7343('0x61'));});});}return null;})[_0x7343('0x4a')](handleError(_0x168c6b,null));};exports[_0x7343('0x62')]=function(_0x250e15,_0x386066,_0xa588ec){var _0x107af5=path[_0x7343('0x52')](_0x250e15[_0x7343('0x63')][_0x7343('0x64')],path['extname'](_0x250e15['file'][_0x7343('0x64')]));var _0x169333=path[_0x7343('0x4f')](config[_0x7343('0x50')],'server/files/plugins',_0x250e15[_0x7343('0x63')][_0x7343('0x64')]);var _0x4bbf09=path[_0x7343('0x4f')](config['root'],_0x7343('0x51'),_0x107af5);logger[_0x7343('0x65')](_0x7343('0x66'),_0x169333);logger[_0x7343('0x65')](_0x7343('0x67'),_0x4bbf09);try{fs[_0x7343('0x68')](_0x169333,parseInt(_0x7343('0x69'),0x8));extract(_0x169333,{'dir':_0x4bbf09},function(_0x40c572){if(_0x40c572){logger[_0x7343('0x2c')](_0x40c572);handleError(_0x40c572,!![]);};var _0x466948=fs[_0x7343('0x6a')](_0x4bbf09);if(_0x466948[_0x7343('0x6b')]>0x1){removeReferences(_0x169333,_0x4bbf09);logger[_0x7343('0x2c')]('Invalid\x20plugin\x20structure');return _0xa588ec(new Error(_0x7343('0x6c')));}var _0xa8ca00=fs[_0x7343('0x6d')](path[_0x7343('0x4f')](_0x4bbf09,_0x466948[0x0]));if(_0xa8ca00[_0x7343('0x6e')]()){removeReferences(_0x169333,_0x4bbf09);logger['error'](_0x7343('0x6c'));return _0xa588ec(new Error(_0x7343('0x6c')));}if(_0xa8ca00[_0x7343('0x6f')]()){var _0x430575=fs[_0x7343('0x6a')](path[_0x7343('0x4f')](_0x4bbf09,_0x466948[0x0]));if(_0x430575[_0x7343('0x6b')]===0x0){removeReferences(_0x169333,_0x4bbf09);logger['error'](_0x7343('0x6c'));return _0xa588ec(new Error('Invalid\x20plugin\x20structure'));}var _0x38308a=_0x430575['some'](function(_0x52948c){return _0x52948c===_0x7343('0x70');});if(!_0x38308a){return _0xa588ec(new Error(_0x7343('0x71')));}var _0x1da5f6=fs['readFileSync'](path[_0x7343('0x4f')](_0x4bbf09,_0x466948[0x0],'manifest.json'));var _0x43ff35=JSON[_0x7343('0x72')](_0x1da5f6);if(_0x7343('0x73')==typeof _0x43ff35[_0x7343('0x2e')]){return _0xa588ec(new Error(_0x7343('0x74')));}if(_0x7343('0x73')==typeof _0x43ff35[_0x7343('0x40')]){return _0xa588ec(new Error(_0x7343('0x75')));}if(_0x7343('0x73')==typeof _0x43ff35[_0x7343('0x76')]){return _0xa588ec(new Error(_0x7343('0x77')));}if(_0x7343('0x73')==typeof _0x43ff35[_0x7343('0x78')]){return _0xa588ec(new Error(_0x7343('0x79')));}if(_0x43ff35[_0x7343('0x40')]===_0x7343('0x7a')){if(_0x7343('0x73')==typeof _0x43ff35['parameters'][_0x7343('0x7b')]){return _0xa588ec(new Error(_0x7343('0x7c')));}if(_0x7343('0x73')==typeof _0x43ff35['parameters'][_0x7343('0x7b')][_0x7343('0x7d')]&&'undefined'==typeof _0x43ff35[_0x7343('0x78')][_0x7343('0x7b')][_0x7343('0x7e')]){return _0xa588ec(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x43ff35['type']===_0x7343('0x7f')){if(_0x7343('0x73')==typeof _0x43ff35[_0x7343('0x78')][_0x7343('0x80')]){return _0xa588ec(new Error(_0x7343('0x81')));}if('undefined'==typeof _0x43ff35[_0x7343('0x78')][_0x7343('0x82')]){return _0xa588ec(new Error(_0x7343('0x83')));}}else{return _0xa588ec(new Error(_0x7343('0x84')));}var _0x574cf4=_0x43ff35[_0x7343('0x2e')];var _0x5d7289=_0x43ff35[_0x7343('0x85')];var _0x5b1d32=_0x43ff35['type'];var _0x1426e6=_0x43ff35['sidebar']?_0x43ff35[_0x7343('0x86')]:_0x7343('0x87');var _0x317964=_0x43ff35[_0x7343('0x88')]?_0x43ff35[_0x7343('0x88')]:_0x7343('0x89');var _0x5260e5='';var _0x1d13f8='';var _0x41827e='';var _0xb9a9b3='';var _0x3b3352=_0x43ff35[_0x7343('0x76')];if(_0x5b1d32===_0x7343('0x7a')){if(_0x7343('0x73')!=typeof _0x43ff35[_0x7343('0x78')][_0x7343('0x7b')][_0x7343('0x7d')]){var _0xfb2e0e=_0x43ff35[_0x7343('0x78')][_0x7343('0x7b')][_0x7343('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x7343('0x8a')](_0xfb2e0e)){_0x5260e5=path[_0x7343('0x4f')](_0x7343('0x8b'),_0x107af5,_0x466948[0x0],_0xfb2e0e);}else{_0x5260e5=_0xfb2e0e;}}else{logger[_0x7343('0x65')](_0x7343('0x8c'));}if(_0x7343('0x73')!=typeof _0x43ff35['parameters'][_0x7343('0x7b')][_0x7343('0x7e')]){var _0x1ff884=_0x43ff35['parameters'][_0x7343('0x7b')][_0x7343('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1ff884)){_0x1d13f8=path[_0x7343('0x4f')](_0x7343('0x8b'),_0x107af5,_0x466948[0x0],_0x1ff884);}else{_0x1d13f8=_0x1ff884;}}else{logger[_0x7343('0x65')](_0x7343('0x8d'));}}else if(_0x5b1d32===_0x7343('0x7f')){_0x41827e=_0x43ff35[_0x7343('0x78')][_0x7343('0x80')];_0xb9a9b3=_0x43ff35['parameters'][_0x7343('0x82')];if('undefined'!=typeof _0x43ff35[_0x7343('0x78')][_0x7343('0x7b')]){if('undefined'!=typeof _0x43ff35['parameters']['views'][_0x7343('0x7d')]){var _0xfb2e0e=_0x43ff35[_0x7343('0x78')][_0x7343('0x7b')][_0x7343('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x7343('0x8a')](_0xfb2e0e)){_0x5260e5=path[_0x7343('0x4f')](_0x7343('0x8b'),_0x107af5,_0x466948[0x0],_0xfb2e0e);}else{_0x5260e5=_0xfb2e0e;}}if(_0x7343('0x73')!=typeof _0x43ff35[_0x7343('0x78')][_0x7343('0x7b')][_0x7343('0x7e')]){var _0x1ff884=_0x43ff35[_0x7343('0x78')]['views'][_0x7343('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x7343('0x8a')](_0x1ff884)){_0x1d13f8=path[_0x7343('0x4f')](_0x7343('0x8b'),_0x107af5,_0x466948[0x0],_0x1ff884);}else{_0x1d13f8=_0x1ff884;}}}}var _0x54c410={'name':_0x574cf4,'description':_0x5d7289,'path':path['join'](_0x107af5,_0x466948[0x0]),'type':_0x5b1d32,'sidebar':_0x1426e6,'icon':_0x317964,'adminUrl':_0x5260e5,'agentUrl':_0x1d13f8,'scriptName':_0x41827e,'scriptPath':_0xb9a9b3,'version':_0x3b3352};removeReferences(_0x169333,null);return db[_0x7343('0x45')][_0x7343('0x8e')](_0x54c410)['then'](function(_0x374c42){var _0x148171={'role':_0x250e15[_0x7343('0x8f')][_0x7343('0x90')],'userProfileId':_0x250e15[_0x7343('0x8f')][_0x7343('0x91')]};if(!_0x148171)throw new Error(_0x7343('0x92'));if(_0x148171[_0x7343('0x90')]===_0x7343('0x93')){var _0x45e2fc=_0x374c42[_0x7343('0x2a')]({'plain':!![]});return db[_0x7343('0x94')]['find']({'where':{'name':_0x7343('0x95'),'userProfileId':_0x148171[_0x7343('0x91')]},'raw':!![]})[_0x7343('0x28')](function(_0x19e206){if(_0x19e206&&_0x19e206[_0x7343('0x96')]===0x0){return db[_0x7343('0x2b')]['create']({'name':_0x45e2fc[_0x7343('0x2e')],'resourceId':_0x45e2fc['id'],'type':_0x19e206[_0x7343('0x2e')],'sectionId':_0x19e206['id']},{})[_0x7343('0x28')](function(){return _0x374c42;});}else{return _0x374c42;}})['catch'](function(_0x119457){logger[_0x7343('0x2c')](_0x7343('0x97'),_0x119457);throw _0x119457;});}return _0x374c42;})[_0x7343('0x28')](respondWithResult(_0x386066,null))[_0x7343('0x4a')](handleError(_0x386066,null));}});}catch(_0x198b0f){_0x386066[_0x7343('0x1d')](0x1f4)[_0x7343('0x2f')](_0x198b0f);}};function removeReferences(_0x240376,_0x4797ae){try{if(_0x240376){fs[_0x7343('0x98')](_0x240376);logger['info'](_0x7343('0x99'));}if(_0x4797ae){rimraf(_0x4797ae,function(){});logger[_0x7343('0x65')](_0x7343('0x9a'));}}catch(_0x438c42){logger[_0x7343('0x2c')](_0x438c42);}}exports[_0x7343('0x27')]=function(_0x2dc79a,_0x3fed62,_0x303ae4){return db['Plugin'][_0x7343('0x4d')]({'where':{'id':_0x2dc79a[_0x7343('0x4c')]['id']}})[_0x7343('0x28')](handleEntityNotFound(_0x3fed62,null))[_0x7343('0x28')](saveUpdates(_0x2dc79a[_0x7343('0x8f')],null))[_0x7343('0x28')](respondWithResult(_0x3fed62,null))[_0x7343('0x4a')](handleError(_0x3fed62,null));};exports['delete']=function(_0x454709,_0x4cd02f,_0x6d3c8f){return db[_0x7343('0x45')]['find']({'where':{'id':_0x454709[_0x7343('0x4c')]['id']}})[_0x7343('0x28')](function(_0xf02f9){if(_0xf02f9){return _0xf02f9[_0x7343('0x29')]();}})['then'](function(_0x37643f){rimraf(path[_0x7343('0x4f')](config[_0x7343('0x50')],_0x7343('0x51'),path[_0x7343('0x9b')](_0x37643f[_0x7343('0x6')])),function(){});return _0x37643f;})[_0x7343('0x28')](handleEntityNotFound(_0x4cd02f,null))['then'](respondWithStatusCode(_0x4cd02f,null))['catch'](handleError(_0x4cd02f,null));};exports[_0x7343('0x9c')]=function(_0xa4bafa,_0x33559c,_0x457fec){return BPromise[_0x7343('0x9d')]()[_0x7343('0x28')](function(){if(!_0xa4bafa['query'][_0x7343('0x6')]){throw new Error(_0x7343('0x9e'));}if(!_0xa4bafa[_0x7343('0x32')][_0x7343('0x9f')]){throw new Error(_0x7343('0xa0'));}var _0x78a8e7=_0xa4bafa[_0x7343('0x32')][_0x7343('0xa1')]?_0xa4bafa[_0x7343('0x32')][_0x7343('0xa1')]+':'+_0xa4bafa[_0x7343('0x32')][_0x7343('0x9f')]:'http://localhost:'+_0xa4bafa['query']['port'];var _0x2a7623=_0xa4bafa[_0x7343('0x32')][_0x7343('0x1f')]?_0xa4bafa[_0x7343('0x32')][_0x7343('0x1f')]:!![];var _0x1e25fe=_0xa4bafa['query'][_0x7343('0xa2')]?_0xa4bafa[_0x7343('0x32')]['encoding']:null;var _0x57dd8f={'method':_0xa4bafa[_0x7343('0xa3')],'uri':util[_0x7343('0xa4')](_0x7343('0xa5'),_0x78a8e7,_0xa4bafa[_0x7343('0x32')][_0x7343('0x6')]),'json':_0x2a7623,'resolveWithFullResponse':!![],'encoding':_0x1e25fe,'qs':_0xa4bafa[_0x7343('0x32')]};if(_0xa4bafa[_0x7343('0xa6')]){_0x57dd8f[_0x7343('0xa6')]=_0xa4bafa[_0x7343('0xa6')];if(_0x57dd8f[_0x7343('0xa6')][_0x7343('0xa7')]){delete _0x57dd8f['headers'][_0x7343('0xa7')];}}if(_0x57dd8f[_0x7343('0xa6')]['content-type']){delete _0x57dd8f[_0x7343('0xa6')]['content-type'];}return rp(_0x57dd8f);})[_0x7343('0x28')](function(_0x39606b){if(_0x39606b){_0x33559c['set'](_0x39606b[_0x7343('0xa6')]);logger[_0x7343('0x65')](_0x39606b['body']);if(_['endsWith'](_0xa4bafa[_0x7343('0x32')][_0x7343('0x6')],_0x7343('0x4e'))&&_0x39606b['statusCode']==0x1f4){return _0x33559c[_0x7343('0x1c')](_0x39606b[_0x7343('0xa8')]);}else{return _0x33559c[_0x7343('0x1d')](_0x39606b[_0x7343('0xa8')])[_0x7343('0x2f')](_0x39606b[_0x7343('0x8f')]);}}else{return _0x33559c[_0x7343('0x1c')](0xc8);}})[_0x7343('0x4a')](handleError(_0x33559c,null));};exports[_0x7343('0xa9')]=function(_0x1cfbe6,_0x5867e5,_0x542796){return BPromise[_0x7343('0x9d')]()[_0x7343('0x28')](function(){if(!_0x1cfbe6['query'][_0x7343('0x6')]){throw new Error(_0x7343('0x9e'));}if(!_0x1cfbe6['query'][_0x7343('0x9f')]){throw new Error(_0x7343('0xa0'));}var _0x2e17f8=_0x1cfbe6[_0x7343('0x32')]['hostname']?_0x1cfbe6[_0x7343('0x32')][_0x7343('0xa1')]+':'+_0x1cfbe6[_0x7343('0x32')][_0x7343('0x9f')]:_0x7343('0xaa')+_0x1cfbe6[_0x7343('0x32')]['port'];var _0x91f27a=_0x1cfbe6[_0x7343('0x32')][_0x7343('0x1f')]?_0x1cfbe6[_0x7343('0x32')][_0x7343('0x1f')]:!![];var _0x531f8d=_0x1cfbe6[_0x7343('0x32')][_0x7343('0xa2')]?_0x1cfbe6['query'][_0x7343('0xa2')]:null;var _0x283df8={'method':_0x1cfbe6[_0x7343('0xa3')],'uri':util['format'](_0x7343('0xa5'),_0x2e17f8,_0x1cfbe6[_0x7343('0x32')]['path']),'json':_0x91f27a,'resolveWithFullResponse':!![],'encoding':_0x531f8d,'body':_0x1cfbe6[_0x7343('0x8f')]};if(_0x1cfbe6[_0x7343('0xa6')]){_0x283df8[_0x7343('0xa6')]=_0x1cfbe6[_0x7343('0xa6')];if(_0x283df8[_0x7343('0xa6')][_0x7343('0xa7')]){delete _0x283df8[_0x7343('0xa6')][_0x7343('0xa7')];}}if(_0x283df8[_0x7343('0xa6')]['content-type']){delete _0x283df8['headers'][_0x7343('0xab')];}return rp(_0x283df8);})[_0x7343('0x28')](function(_0x154e81){if(_0x154e81){_0x5867e5[_0x7343('0xac')](_0x154e81[_0x7343('0xa6')]);logger['info'](_0x154e81[_0x7343('0x8f')]);return _0x5867e5[_0x7343('0x1d')](_0x154e81[_0x7343('0xa8')])[_0x7343('0x2f')](_0x154e81['body']);}else{return _0x5867e5[_0x7343('0x1c')](0xc8);}})['catch'](handleError(_0x5867e5,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ebac2bf..b3679e5 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 _0xfa9b=['update','emit','hook','../../mysqldb','Plugin','setMaxListeners'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfa9b,0xa5));var _0xbfa9=function(_0x37f0e3,_0x4d4245){_0x37f0e3=_0x37f0e3-0x0;var _0x1e6b6f=_0xfa9b[_0x37f0e3];return _0x1e6b6f;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xbfa9('0x0'))['db'][_0xbfa9('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbfa9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfa9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40fda5){return function(_0xb0aa43,_0x73738a,_0x2749e3){PluginEvents[_0xbfa9('0x4')](_0x40fda5+':'+_0xb0aa43['id'],_0xb0aa43);PluginEvents[_0xbfa9('0x4')](_0x40fda5,_0xb0aa43);_0x2749e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xbfa9('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x7453=['hasOwnProperty','hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x3fbc5d,_0xe7c039){var _0x3bc704=function(_0x1e1ccd){while(--_0x1e1ccd){_0x3fbc5d['push'](_0x3fbc5d['shift']());}};_0x3bc704(++_0xe7c039);}(_0x7453,0x1e3));var _0x3745=function(_0x4e1e2a,_0x4d57c3){_0x4e1e2a=_0x4e1e2a-0x0;var _0x4158aa=_0x7453[_0x4e1e2a];return _0x4158aa;};'use strict';var EventEmitter=require(_0x3745('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x3745('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3745('0x2'),'afterDestroy':_0x3745('0x3')};function emitEvent(_0x53a9de){return function(_0x3337a4,_0xdbf401,_0xc28104){PluginEvents[_0x3745('0x4')](_0x53a9de+':'+_0x3337a4['id'],_0x3337a4);PluginEvents[_0x3745('0x4')](_0x53a9de,_0x3337a4);_0xc28104(null);};}for(var e in events){if(events[_0x3745('0x5')](e)){var event=events[e];Plugin[_0x3745('0x6')](e,emitEvent(event));}}module[_0x3745('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4d468c4..343d06e 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 _0x960c=['rimraf','../../config/environment','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2efcd6,_0xfb94a0){var _0x9cd15d=function(_0x5a72af){while(--_0x5a72af){_0x2efcd6['push'](_0x2efcd6['shift']());}};_0x9cd15d(++_0xfb94a0);}(_0x960c,0x113));var _0xc960=function(_0x599484,_0x4fc0df){_0x599484=_0x599484-0x0;var _0xd846b1=_0x960c[_0x599484];return _0xd846b1;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var logger=require(_0xc960('0x1'))('api');var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rp=require(_0xc960('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x2bb9df,_0x2beb88){return _0x2bb9df[_0xc960('0x7')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a7=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x20c075,_0x1d5ee6){var _0x1ef060=function(_0x2805dd){while(--_0x2805dd){_0x20c075['push'](_0x20c075['shift']());}};_0x1ef060(++_0x1d5ee6);}(_0xb9a7,0x172));var _0x7b9a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xb9a7[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x7b9a('0x0'));var util=require('util');var logger=require(_0x7b9a('0x1'))(_0x7b9a('0x2'));var moment=require(_0x7b9a('0x3'));var BPromise=require(_0x7b9a('0x4'));var rp=require(_0x7b9a('0x5'));var fs=require('fs');var path=require(_0x7b9a('0x6'));var rimraf=require(_0x7b9a('0x7'));var config=require(_0x7b9a('0x8'));var attributes=require(_0x7b9a('0x9'));module[_0x7b9a('0xa')]=function(_0x6f548e,_0x24526d){return _0x6f548e[_0x7b9a('0xb')](_0x7b9a('0xc'),attributes,{'tableName':_0x7b9a('0xd'),'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 19c1ade..48fa202 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 _0xdfa7=['message','result','catch','CreatePlugin','Plugin','create','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x544172,_0x30815f){var _0x1bd927=function(_0x120feb){while(--_0x120feb){_0x544172['push'](_0x544172['shift']());}};_0x1bd927(++_0x30815f);}(_0xdfa7,0x1a8));var _0x7dfa=function(_0xbd27e,_0x5e944b){_0xbd27e=_0xbd27e-0x0;var _0xbd3a3b=_0xdfa7[_0xbd27e];return _0xbd3a3b;};'use strict';var _=require(_0x7dfa('0x0'));var util=require(_0x7dfa('0x1'));var moment=require(_0x7dfa('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dfa('0x3'));var fs=require('fs');var Redis=require(_0x7dfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dfa('0x5'));var logger=require('../../config/logger')(_0x7dfa('0x6'));var config=require('../../config/environment');var jayson=require(_0x7dfa('0x7'));var client=jayson[_0x7dfa('0x8')][_0x7dfa('0x9')]({'port':0x232a});config[_0x7dfa('0xa')]=_[_0x7dfa('0xb')](config[_0x7dfa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7dfa('0xc'))(new Redis(config[_0x7dfa('0xa')]));require(_0x7dfa('0xd'))[_0x7dfa('0xe')](socket);function respondWithRpcPromise(_0x48520e,_0x19d152,_0x4da435){return new BPromise(function(_0x2d6caa,_0x16efe2){return client[_0x7dfa('0xf')](_0x48520e,_0x4da435)[_0x7dfa('0x10')](function(_0x163409){logger[_0x7dfa('0x11')](_0x7dfa('0x12'),_0x19d152,_0x7dfa('0x13'));logger[_0x7dfa('0x14')](_0x7dfa('0x15'),_0x19d152,_0x7dfa('0x13'),JSON[_0x7dfa('0x16')](_0x163409));if(_0x163409[_0x7dfa('0x17')]){if(_0x163409[_0x7dfa('0x17')]['code']===0x1f4){logger[_0x7dfa('0x17')]('Plugin,\x20%s,\x20%s',_0x19d152,_0x163409[_0x7dfa('0x17')]['message']);return _0x16efe2(_0x163409[_0x7dfa('0x17')][_0x7dfa('0x18')]);}logger[_0x7dfa('0x17')](_0x7dfa('0x12'),_0x19d152,_0x163409[_0x7dfa('0x17')]['message']);return _0x2d6caa(_0x163409[_0x7dfa('0x17')][_0x7dfa('0x18')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x19d152,_0x7dfa('0x13'));_0x2d6caa(_0x163409[_0x7dfa('0x19')][_0x7dfa('0x18')]);}})[_0x7dfa('0x1a')](function(_0x2e624f){logger[_0x7dfa('0x17')](_0x7dfa('0x12'),_0x19d152,_0x2e624f);_0x16efe2(_0x2e624f);});});}exports[_0x7dfa('0x1b')]=function(_0x2ea078){var _0x1502fa=this;return new Promise(function(_0x5569a0,_0x135c7c){return db[_0x7dfa('0x1c')][_0x7dfa('0x1d')](_0x2ea078[_0x7dfa('0x1e')],{'raw':_0x2ea078[_0x7dfa('0x1f')]?_0x2ea078[_0x7dfa('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x22ead1){logger[_0x7dfa('0x11')](_0x7dfa('0x1b'),_0x2ea078);logger[_0x7dfa('0x14')](_0x7dfa('0x1b'),_0x2ea078,JSON[_0x7dfa('0x16')](_0x22ead1));_0x5569a0(_0x22ead1);})['catch'](function(_0x19dfdc){logger[_0x7dfa('0x17')](_0x7dfa('0x1b'),_0x19dfdc[_0x7dfa('0x18')],_0x2ea078);_0x135c7c(_0x1502fa[_0x7dfa('0x17')](0x1f4,_0x19dfdc['message']));});});}; \ No newline at end of file +var _0x6536=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','CreatePlugin','create','body','options','raw','moment'];(function(_0x3becc8,_0x3dc8a9){var _0x49f387=function(_0x48765f){while(--_0x48765f){_0x3becc8['push'](_0x3becc8['shift']());}};_0x49f387(++_0x3dc8a9);}(_0x6536,0x1cf));var _0x6653=function(_0x3a7272,_0x5f0cae){_0x3a7272=_0x3a7272-0x0;var _0x2483d5=_0x6536[_0x3a7272];return _0x2483d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6653('0x0'));var BPromise=require('bluebird');var rs=require(_0x6653('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6653('0x2'));var logger=require(_0x6653('0x3'))(_0x6653('0x4'));var config=require(_0x6653('0x5'));var jayson=require(_0x6653('0x6'));var client=jayson[_0x6653('0x7')][_0x6653('0x8')]({'port':0x232a});config[_0x6653('0x9')]=_['defaults'](config[_0x6653('0x9')],{'host':_0x6653('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6653('0x9')]));require(_0x6653('0xb'))[_0x6653('0xc')](socket);function respondWithRpcPromise(_0x5e5385,_0x3110bc,_0x2179f3){return new BPromise(function(_0x4f8aa9,_0x1027cc){return client[_0x6653('0xd')](_0x5e5385,_0x2179f3)[_0x6653('0xe')](function(_0x55b1c0){logger['info'](_0x6653('0xf'),_0x3110bc,'request\x20sent');logger[_0x6653('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x3110bc,_0x6653('0x11'),JSON[_0x6653('0x12')](_0x55b1c0));if(_0x55b1c0[_0x6653('0x13')]){if(_0x55b1c0[_0x6653('0x13')][_0x6653('0x14')]===0x1f4){logger[_0x6653('0x13')](_0x6653('0xf'),_0x3110bc,_0x55b1c0[_0x6653('0x13')][_0x6653('0x15')]);return _0x1027cc(_0x55b1c0['error'][_0x6653('0x15')]);}logger['error'](_0x6653('0xf'),_0x3110bc,_0x55b1c0[_0x6653('0x13')][_0x6653('0x15')]);return _0x4f8aa9(_0x55b1c0[_0x6653('0x13')][_0x6653('0x15')]);}else{logger[_0x6653('0x16')](_0x6653('0xf'),_0x3110bc,_0x6653('0x11'));_0x4f8aa9(_0x55b1c0[_0x6653('0x17')][_0x6653('0x15')]);}})['catch'](function(_0xb8bd56){logger['error'](_0x6653('0xf'),_0x3110bc,_0xb8bd56);_0x1027cc(_0xb8bd56);});});}exports[_0x6653('0x18')]=function(_0x6b2caa){var _0x32f907=this;return new Promise(function(_0x1d8b2a,_0xff8315){return db['Plugin'][_0x6653('0x19')](_0x6b2caa[_0x6653('0x1a')],{'raw':_0x6b2caa['options']?_0x6b2caa[_0x6653('0x1b')][_0x6653('0x1c')]===undefined?!![]:![]:!![]})[_0x6653('0xe')](function(_0x311050){logger[_0x6653('0x16')](_0x6653('0x18'),_0x6b2caa);logger[_0x6653('0x10')](_0x6653('0x18'),_0x6b2caa,JSON[_0x6653('0x12')](_0x311050));_0x1d8b2a(_0x311050);})['catch'](function(_0xaea7ff){logger[_0x6653('0x13')](_0x6653('0x18'),_0xaea7ff['message'],_0x6b2caa);_0xff8315(_0x32f907[_0x6653('0x13')](0x1f4,_0xaea7ff['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7ceaee2..d2422a1 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 _0xddbb=['remove','update','emit','register','plugin:','save'];(function(_0x38e32b,_0x57c8f8){var _0xd4284f=function(_0x508620){while(--_0x508620){_0x38e32b['push'](_0x38e32b['shift']());}};_0xd4284f(++_0x57c8f8);}(_0xddbb,0xa7));var _0xbddb=function(_0x1b726a,_0xa927ae){_0x1b726a=_0x1b726a-0x0;var _0x2c84dc=_0xddbb[_0x1b726a];return _0x2c84dc;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xbddb('0x0'),_0xbddb('0x1'),_0xbddb('0x2')];function createListener(_0x20bb1a,_0x3d15e9){return function(_0x2438c1){_0x3d15e9[_0xbddb('0x3')](_0x20bb1a,_0x2438c1);};}function removeListener(_0x23a6ba,_0x42c9d7){return function(){PluginEvents['removeListener'](_0x23a6ba,_0x42c9d7);};}exports[_0xbddb('0x4')]=function(_0x2d28d4){for(var _0x168b16=0x0,_0x3ecdd6=events['length'];_0x168b16<_0x3ecdd6;_0x168b16++){var _0x3d88ab=events[_0x168b16];var _0x219120=createListener(_0xbddb('0x5')+_0x3d88ab,_0x2d28d4);PluginEvents['on'](_0x3d88ab,_0x219120);}}; \ No newline at end of file +var _0x826b=['update','emit','removeListener','register','length','./plugin.events','save','remove'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x826b,0x8d));var _0xb826=function(_0x16baab,_0xa449b2){_0x16baab=_0x16baab-0x0;var _0x3fbfc2=_0x826b[_0x16baab];return _0x3fbfc2;};'use strict';var PluginEvents=require(_0xb826('0x0'));var events=[_0xb826('0x1'),_0xb826('0x2'),_0xb826('0x3')];function createListener(_0xba1f0e,_0x1cddb7){return function(_0x8feb26){_0x1cddb7[_0xb826('0x4')](_0xba1f0e,_0x8feb26);};}function removeListener(_0x4e2eff,_0x7e1fa8){return function(){PluginEvents[_0xb826('0x5')](_0x4e2eff,_0x7e1fa8);};}exports[_0xb826('0x6')]=function(_0x274c77){for(var _0x4b31b4=0x0,_0x32f6c6=events[_0xb826('0x7')];_0x4b31b4<_0x32f6c6;_0x4b31b4++){var _0x26f8c7=events[_0x4b31b4];var _0x391277=createListener('plugin:'+_0x26f8c7,_0x274c77);PluginEvents['on'](_0x26f8c7,_0x391277);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 5e24847..3500552 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 _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x1c9c27,_0x29f66b){var _0x1ead39=function(_0xad79ef){while(--_0xad79ef){_0x1c9c27['push'](_0x1c9c27['shift']());}};_0x1ead39(++_0x29f66b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x5cad77,_0x49181b){var _0x14ba74=function(_0x25e175){while(--_0x25e175){_0x5cad77['push'](_0x5cad77['shift']());}};_0x14ba74(++_0x49181b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 9897053..af1575b 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 _0xa59d=['child_process','exec','bluebird','sendStatus','status','error','stack','name','send','info','index','then','reject','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path'];(function(_0x40387f,_0x53a660){var _0x10f4e2=function(_0x33075b){while(--_0x33075b){_0x40387f['push'](_0x40387f['shift']());}};_0x10f4e2(++_0x53a660);}(_0xa59d,0x15b));var _0xda59=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa59d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xda59('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xda59('0x1'))(_0xda59('0x2'));var path=require(_0xda59('0x3'));var exec=require(_0xda59('0x4'))[_0xda59('0x5')];var BPromise=require(_0xda59('0x6'));function handleEntityNotFound(_0x4d4990,_0x492f0a){return function(_0x10dbf2){if(!_0x10dbf2){_0x4d4990[_0xda59('0x7')](0x194);;}return _0x10dbf2;};}function respondWithResult(_0x305f9c,_0x582a43){_0x582a43=_0x582a43||0xc8;return function(_0x2cc569){if(_0x2cc569){return _0x305f9c[_0xda59('0x8')](_0x582a43)['json'](_0x2cc569);}return null;};}function handleError(_0x1b0f3e,_0x59bfa7){_0x59bfa7=_0x59bfa7||0x1f4;return function(_0x4a63b1){logger[_0xda59('0x9')](_0x4a63b1[_0xda59('0xa')]);if(_0x4a63b1[_0xda59('0xb')]){delete _0x4a63b1[_0xda59('0xb')];}_0x1b0f3e[_0xda59('0x8')](_0x59bfa7)[_0xda59('0xc')](_0x4a63b1);};}function execChildProcess(){return new BPromise(function(_0x1064b9,_0xd8a0b3){exec('npm\x20install',function(_0x61b7e2,_0xe3e0d1,_0x4d94ed){logger[_0xda59('0xd')](_0xe3e0d1);logger[_0xda59('0xd')](_0x4d94ed);if(_0x61b7e2){logger['error'](_0x61b7e2);return _0xd8a0b3(_0x61b7e2);}return _0x1064b9(_0xe3e0d1);});});}exports[_0xda59('0xe')]=function(_0x1b5c50,_0x49ef6d){return pm2['list']()[_0xda59('0xf')](function(_0x890719){if(_0x890719){var _0x35e7c2=_[_0xda59('0x10')](_0x890719,function(_0x24fa7e){return _0x24fa7e[_0xda59('0xb')]===_0xda59('0x11')||_0x24fa7e[_0xda59('0xb')]===_0xda59('0x12');});return{'rows':_0x35e7c2,'count':_0x35e7c2['length']};}return null;})[_0xda59('0xf')](respondWithResult(_0x49ef6d,null))[_0xda59('0x13')](handleError(_0x49ef6d,null));};exports[_0xda59('0x14')]=function(_0x1b243b,_0x54de38){return pm2[_0xda59('0x15')](_0x1b243b[_0xda59('0x16')]['id'])['then'](respondWithResult(_0x54de38,null))[_0xda59('0xf')](handleEntityNotFound(_0x54de38,null))['catch'](handleError(_0x54de38,null));};exports[_0xda59('0x17')]=function(_0x33904f,_0x5add40){if(_0x33904f[_0xda59('0x18')][_0xda59('0xb')]&&_0x33904f[_0xda59('0x18')]['script']){var _0x48d1af=path[_0xda59('0x19')](__dirname,_0xda59('0x1a'),_0x33904f[_0xda59('0x18')][_0xda59('0x1b')]);var _0x2293d8=process['cwd']();process['chdir'](path['dirname'](_0x48d1af));return execChildProcess()['then'](function(_0x170f4){process['chdir'](_0x2293d8);return pm2[_0xda59('0x1c')]({'name':_0x33904f['body']['name'],'script':_0x48d1af});})[_0xda59('0xf')](function(_0x38a7a9){pm2[_0xda59('0x1d')]();return _0x38a7a9[0x0];})[_0xda59('0xf')](respondWithResult(_0x5add40,0xc9))[_0xda59('0x13')](handleError(_0x5add40,null));}else{return _0x5add40[_0xda59('0x8')](0x1f4)[_0xda59('0xc')]({'message':_0xda59('0x1e')});}};exports[_0xda59('0x1f')]=function(_0x2a83de,_0x3788cc){if(_0x2a83de[_0xda59('0x18')]['id']){delete _0x2a83de[_0xda59('0x18')]['id'];}var _0xc86e1b={'online':_0xda59('0x20'),'stopped':_0xda59('0x21')};if(_0xc86e1b[_0xda59('0x22')](_0x2a83de[_0xda59('0x18')][_0xda59('0x8')])){return pm2[_0xc86e1b[_0x2a83de['body']['status']]](_0x2a83de[_0xda59('0x16')]['id'])['then'](respondWithResult(_0x3788cc,0xc8))[_0xda59('0x13')](handleError(_0x3788cc,null));}else{return _0x3788cc['status'](0x1f4)['send']({'message':_0xda59('0x23')});}};exports[_0xda59('0x24')]=function(_0x2ed87e,_0x5a7b6b){if(_0x2ed87e[_0xda59('0x18')]['id']){delete _0x2ed87e[_0xda59('0x18')]['id'];}if(_0x2ed87e['params']['id']){return pm2[_0xda59('0x25')](_0x2ed87e[_0xda59('0x16')]['id'])[_0xda59('0xf')](function(_0x51aab4){pm2['dump']();return _0x51aab4[0x0];})[_0xda59('0xf')](respondWithResult(_0x5a7b6b,null))['catch'](handleError(_0x5a7b6b,null));}else{return _0x5a7b6b[_0xda59('0x8')](0x1f4)[_0xda59('0xc')]({'message':_0xda59('0x26')});}}; \ No newline at end of file +var _0xc55e=['path','exec','bluebird','error','stack','name','status','send','info','index','then','reject','express','motion2','catch','show','params','create','body','script','cwd','chdir','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api'];(function(_0x4e5af1,_0x1dfc1f){var _0x357f9d=function(_0x645f3b){while(--_0x645f3b){_0x4e5af1['push'](_0x4e5af1['shift']());}};_0x357f9d(++_0x1dfc1f);}(_0xc55e,0x146));var _0xec55=function(_0x1b9669,_0x37b934){_0x1b9669=_0x1b9669-0x0;var _0x1e04f3=_0xc55e[_0x1b9669];return _0x1e04f3;};'use strict';var _=require(_0xec55('0x0'));var pm2=require(_0xec55('0x1'));var logger=require(_0xec55('0x2'))(_0xec55('0x3'));var path=require(_0xec55('0x4'));var exec=require('child_process')[_0xec55('0x5')];var BPromise=require(_0xec55('0x6'));function handleEntityNotFound(_0x35cd14,_0xdcb93){return function(_0x3b7b45){if(!_0x3b7b45){_0x35cd14['sendStatus'](0x194);;}return _0x3b7b45;};}function respondWithResult(_0x1cda69,_0x3a887a){_0x3a887a=_0x3a887a||0xc8;return function(_0x239eeb){if(_0x239eeb){return _0x1cda69['status'](_0x3a887a)['json'](_0x239eeb);}return null;};}function handleError(_0x49c6dc,_0x1566f4){_0x1566f4=_0x1566f4||0x1f4;return function(_0x344c12){logger[_0xec55('0x7')](_0x344c12[_0xec55('0x8')]);if(_0x344c12[_0xec55('0x9')]){delete _0x344c12['name'];}_0x49c6dc[_0xec55('0xa')](_0x1566f4)[_0xec55('0xb')](_0x344c12);};}function execChildProcess(){return new BPromise(function(_0xe73275,_0x52e8d2){exec('npm\x20install',function(_0x54dc1a,_0x9d358,_0x16fa06){logger[_0xec55('0xc')](_0x9d358);logger['info'](_0x16fa06);if(_0x54dc1a){logger[_0xec55('0x7')](_0x54dc1a);return _0x52e8d2(_0x54dc1a);}return _0xe73275(_0x9d358);});});}exports[_0xec55('0xd')]=function(_0x1a508c,_0x1f5874){return pm2['list']()[_0xec55('0xe')](function(_0x5f0a85){if(_0x5f0a85){var _0x2faa9d=_[_0xec55('0xf')](_0x5f0a85,function(_0x199e9b){return _0x199e9b['name']===_0xec55('0x10')||_0x199e9b[_0xec55('0x9')]===_0xec55('0x11');});return{'rows':_0x2faa9d,'count':_0x2faa9d['length']};}return null;})[_0xec55('0xe')](respondWithResult(_0x1f5874,null))[_0xec55('0x12')](handleError(_0x1f5874,null));};exports[_0xec55('0x13')]=function(_0x3b471c,_0x65bef5){return pm2['describe'](_0x3b471c[_0xec55('0x14')]['id'])[_0xec55('0xe')](respondWithResult(_0x65bef5,null))[_0xec55('0xe')](handleEntityNotFound(_0x65bef5,null))['catch'](handleError(_0x65bef5,null));};exports[_0xec55('0x15')]=function(_0x25adea,_0x1ccecc){if(_0x25adea['body'][_0xec55('0x9')]&&_0x25adea[_0xec55('0x16')]['script']){var _0x3c8871=path['join'](__dirname,'../../files/plugins',_0x25adea[_0xec55('0x16')][_0xec55('0x17')]);var _0x2c9eb1=process[_0xec55('0x18')]();process[_0xec55('0x19')](path['dirname'](_0x3c8871));return execChildProcess()['then'](function(_0x368d09){process[_0xec55('0x19')](_0x2c9eb1);return pm2['start']({'name':_0x25adea[_0xec55('0x16')][_0xec55('0x9')],'script':_0x3c8871});})[_0xec55('0xe')](function(_0x1cec0a){pm2[_0xec55('0x1a')]();return _0x1cec0a[0x0];})[_0xec55('0xe')](respondWithResult(_0x1ccecc,0xc9))[_0xec55('0x12')](handleError(_0x1ccecc,null));}else{return _0x1ccecc[_0xec55('0xa')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xec55('0x1b')]=function(_0x26e9dd,_0x170a53){if(_0x26e9dd[_0xec55('0x16')]['id']){delete _0x26e9dd['body']['id'];}var _0x38f7fb={'online':_0xec55('0x1c'),'stopped':_0xec55('0x1d')};if(_0x38f7fb[_0xec55('0x1e')](_0x26e9dd[_0xec55('0x16')]['status'])){return pm2[_0x38f7fb[_0x26e9dd[_0xec55('0x16')]['status']]](_0x26e9dd[_0xec55('0x14')]['id'])[_0xec55('0xe')](respondWithResult(_0x170a53,0xc8))[_0xec55('0x12')](handleError(_0x170a53,null));}else{return _0x170a53[_0xec55('0xa')](0x1f4)[_0xec55('0xb')]({'message':_0xec55('0x1f')});}};exports['destroy']=function(_0x35f522,_0x1ad344){if(_0x35f522[_0xec55('0x16')]['id']){delete _0x35f522['body']['id'];}if(_0x35f522['params']['id']){return pm2['delete'](_0x35f522[_0xec55('0x14')]['id'])['then'](function(_0x53e8f7){pm2[_0xec55('0x1a')]();return _0x53e8f7[0x0];})['then'](respondWithResult(_0x1ad344,null))[_0xec55('0x12')](handleError(_0x1ad344,null));}else{return _0x1ad344['status'](0x1f4)[_0xec55('0xb')]({'message':_0xec55('0x20')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5e7a9ea..347e71b 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 _0xb4d9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x2832d2,_0x374b17){var _0x19b16=function(_0xced542){while(--_0xced542){_0x2832d2['push'](_0x2832d2['shift']());}};_0x19b16(++_0x374b17);}(_0xb4d9,0xce));var _0x9b4d=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb4d9[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var path=require('path');var timeout=require(_0x9b4d('0x2'));var express=require(_0x9b4d('0x3'));var router=express[_0x9b4d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b4d('0x5'));var config=require(_0x9b4d('0x6'));module[_0x9b4d('0x7')]=router; \ No newline at end of file +var _0x0f4d=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x114e1d,_0xeda681){var _0x4a2043=function(_0x3495bf){while(--_0x3495bf){_0x114e1d['push'](_0x114e1d['shift']());}};_0x4a2043(++_0xeda681);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x46ad6f,_0x33844d){_0x46ad6f=_0x46ad6f-0x0;var _0x3c48ce=_0x0f4d[_0x46ad6f];return _0x3c48ce;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var auth=require(_0xd0f4('0x2'));var interaction=require(_0xd0f4('0x3'));var config=require(_0xd0f4('0x4'));module[_0xd0f4('0x5')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c0224a0..70891cb 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 _0xaa7d=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x4509cb,_0x32b361){var _0x349183=function(_0x4bb431){while(--_0x4bb431){_0x4509cb['push'](_0x4509cb['shift']());}};_0x349183(++_0x32b361);}(_0xaa7d,0xd8));var _0xdaa7=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xaa7d[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xdaa7('0x0'));module[_0xdaa7('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xdaa7('0x2')]},'scheduledat':{'type':Sequelize[_0xdaa7('0x3')]},'uniqueid':{'type':Sequelize[_0xdaa7('0x2')]},'starttime':{'type':Sequelize[_0xdaa7('0x3')]},'responsetime':{'type':Sequelize[_0xdaa7('0x3')]},'ringtime':{'type':Sequelize[_0xdaa7('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdaa7('0x2')]},'campaigntype':{'type':Sequelize[_0xdaa7('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3382=['exports','STRING','DATE','INTEGER'];(function(_0x565b76,_0x1d150b){var _0x80f363=function(_0x140b02){while(--_0x140b02){_0x565b76['push'](_0x565b76['shift']());}};_0x80f363(++_0x1d150b);}(_0x3382,0x17c));var _0x2338=function(_0x52838e,_0x4f9d9d){_0x52838e=_0x52838e-0x0;var _0x2c8940=_0x3382[_0x52838e];return _0x2c8940;};'use strict';var Sequelize=require('sequelize');module[_0x2338('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2338('0x1')]},'scheduledat':{'type':Sequelize[_0x2338('0x2')]},'uniqueid':{'type':Sequelize[_0x2338('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2338('0x2')]},'ringtime':{'type':Sequelize[_0x2338('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'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 ea0727c..e0cb50d 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 _0x0396=['path','../../config/environment','exports','define','ReportAgentPreview','util','../../config/logger','api','request-promise'];(function(_0x59b467,_0x2df0d9){var _0x305346=function(_0x30b0ec){while(--_0x30b0ec){_0x59b467['push'](_0x59b467['shift']());}};_0x305346(++_0x2df0d9);}(_0x0396,0x149));var _0x6039=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x0396[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x6039('0x0'));var logger=require(_0x6039('0x1'))(_0x6039('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6039('0x3'));var fs=require('fs');var path=require(_0x6039('0x4'));var rimraf=require('rimraf');var config=require(_0x6039('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0x6039('0x6')]=function(_0x1f92d7,_0x5a924e){return _0x1f92d7[_0x6039('0x7')](_0x6039('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x240b=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','util','../../config/logger','api','moment'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x240b,0x133));var _0xb240=function(_0x43d24c,_0x3c1879){_0x43d24c=_0x43d24c-0x0;var _0x41a60c=_0x240b[_0x43d24c];return _0x41a60c;};'use strict';var _=require(_0xb240('0x0'));var util=require(_0xb240('0x1'));var logger=require(_0xb240('0x2'))(_0xb240('0x3'));var moment=require(_0xb240('0x4'));var BPromise=require('bluebird');var rp=require(_0xb240('0x5'));var fs=require('fs');var path=require(_0xb240('0x6'));var rimraf=require(_0xb240('0x7'));var config=require(_0xb240('0x8'));var attributes=require(_0xb240('0x9'));module[_0xb240('0xa')]=function(_0xacee7d,_0x584293){return _0xacee7d['define'](_0xb240('0xb'),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 1a41f5e..1f56d1f 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 _0xcf5a=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','stringify','lodash','util','moment','randomstring'];(function(_0x175a24,_0x5445b8){var _0x10aed4=function(_0x25d1b4){while(--_0x25d1b4){_0x175a24['push'](_0x175a24['shift']());}};_0x10aed4(++_0x5445b8);}(_0xcf5a,0x14c));var _0xacf5=function(_0x57fb86,_0x880cc1){_0x57fb86=_0x57fb86-0x0;var _0x382686=_0xcf5a[_0x57fb86];return _0x382686;};'use strict';var _=require(_0xacf5('0x0'));var util=require(_0xacf5('0x1'));var moment=require(_0xacf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xacf5('0x3'));var fs=require('fs');var Redis=require(_0xacf5('0x4'));var db=require(_0xacf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xacf5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xacf5('0x7'));var client=jayson[_0xacf5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x320c6b,_0x2aed0d,_0x4d7d6b){return new BPromise(function(_0x6b3bc3,_0x2d15df){return client[_0xacf5('0x9')](_0x320c6b,_0x4d7d6b)[_0xacf5('0xa')](function(_0x26c926){logger[_0xacf5('0xb')](_0xacf5('0xc'),_0x2aed0d,_0xacf5('0xd'));logger['debug'](_0xacf5('0xe'),_0x2aed0d,_0xacf5('0xd'),JSON['stringify'](_0x26c926));if(_0x26c926[_0xacf5('0xf')]){if(_0x26c926[_0xacf5('0xf')][_0xacf5('0x10')]===0x1f4){logger[_0xacf5('0xf')](_0xacf5('0xc'),_0x2aed0d,_0x26c926[_0xacf5('0xf')][_0xacf5('0x11')]);return _0x2d15df(_0x26c926['error']['message']);}logger[_0xacf5('0xf')](_0xacf5('0xc'),_0x2aed0d,_0x26c926[_0xacf5('0xf')][_0xacf5('0x11')]);return _0x6b3bc3(_0x26c926[_0xacf5('0xf')][_0xacf5('0x11')]);}else{logger[_0xacf5('0xb')](_0xacf5('0xc'),_0x2aed0d,_0xacf5('0xd'));_0x6b3bc3(_0x26c926[_0xacf5('0x12')][_0xacf5('0x11')]);}})[_0xacf5('0x13')](function(_0x1c08a7){logger[_0xacf5('0xf')](_0xacf5('0xc'),_0x2aed0d,_0x1c08a7);_0x2d15df(_0x1c08a7);});});}exports[_0xacf5('0x14')]=function(_0x4ae444){var _0xae621c=this;return new Promise(function(_0x12ea1a,_0x158b86){return db[_0xacf5('0x15')][_0xacf5('0x16')](_0x4ae444[_0xacf5('0x17')],{'raw':_0x4ae444['options']?_0x4ae444[_0xacf5('0x18')][_0xacf5('0x19')]===undefined?!![]:![]:!![]})[_0xacf5('0xa')](function(_0x1df768){logger['info'](_0xacf5('0x14'),_0x4ae444);logger[_0xacf5('0x1a')](_0xacf5('0x14'),_0x4ae444,JSON[_0xacf5('0x1b')](_0x1df768));_0x12ea1a(_0x1df768);})[_0xacf5('0x13')](function(_0x3f7aba){logger['error'](_0xacf5('0x14'),_0x3f7aba[_0xacf5('0x11')],_0x4ae444);_0x158b86(_0xae621c['error'](0x1f4,_0x3f7aba['message']));});});}; \ No newline at end of file +var _0xee6c=['CreateReportAgentPreview','create','body','options','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0xee6c,0x131));var _0xcee6=function(_0x548f4a,_0x46d1e5){_0x548f4a=_0x548f4a-0x0;var _0x24a283=_0xee6c[_0x548f4a];return _0x24a283;};'use strict';var _=require(_0xcee6('0x0'));var util=require(_0xcee6('0x1'));var moment=require(_0xcee6('0x2'));var BPromise=require(_0xcee6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcee6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcee6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcee6('0x6'));var client=jayson[_0xcee6('0x7')][_0xcee6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52851f,_0x4cfef1,_0x554d55){return new BPromise(function(_0x53a0de,_0x34a3bb){return client['request'](_0x52851f,_0x554d55)[_0xcee6('0x9')](function(_0x3a773f){logger[_0xcee6('0xa')](_0xcee6('0xb'),_0x4cfef1,_0xcee6('0xc'));logger['debug'](_0xcee6('0xd'),_0x4cfef1,_0xcee6('0xc'),JSON[_0xcee6('0xe')](_0x3a773f));if(_0x3a773f[_0xcee6('0xf')]){if(_0x3a773f['error'][_0xcee6('0x10')]===0x1f4){logger[_0xcee6('0xf')](_0xcee6('0xb'),_0x4cfef1,_0x3a773f[_0xcee6('0xf')][_0xcee6('0x11')]);return _0x34a3bb(_0x3a773f['error'][_0xcee6('0x11')]);}logger[_0xcee6('0xf')](_0xcee6('0xb'),_0x4cfef1,_0x3a773f[_0xcee6('0xf')][_0xcee6('0x11')]);return _0x53a0de(_0x3a773f['error'][_0xcee6('0x11')]);}else{logger['info'](_0xcee6('0xb'),_0x4cfef1,_0xcee6('0xc'));_0x53a0de(_0x3a773f[_0xcee6('0x12')][_0xcee6('0x11')]);}})[_0xcee6('0x13')](function(_0x180add){logger[_0xcee6('0xf')](_0xcee6('0xb'),_0x4cfef1,_0x180add);_0x34a3bb(_0x180add);});});}exports[_0xcee6('0x14')]=function(_0x234e14){var _0x56c26e=this;return new Promise(function(_0x138061,_0x5b4b16){return db['ReportAgentPreview'][_0xcee6('0x15')](_0x234e14[_0xcee6('0x16')],{'raw':_0x234e14[_0xcee6('0x17')]?_0x234e14['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x202043){logger[_0xcee6('0xa')]('CreateReportAgentPreview',_0x234e14);logger[_0xcee6('0x18')](_0xcee6('0x14'),_0x234e14,JSON[_0xcee6('0xe')](_0x202043));_0x138061(_0x202043);})[_0xcee6('0x13')](function(_0x444243){logger['error'](_0xcee6('0x14'),_0x444243[_0xcee6('0x11')],_0x234e14);_0x5b4b16(_0x56c26e['error'](0x1f4,_0x444243[_0xcee6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 87b3139..50166a9 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 _0x2f77=['/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2f77,0x1d2));var _0x72f7=function(_0x12ca67,_0x49e74a){_0x12ca67=_0x12ca67-0x0;var _0x617cab=_0x2f77[_0x12ca67];return _0x617cab;};'use strict';var multer=require(_0x72f7('0x0'));var util=require(_0x72f7('0x1'));var path=require(_0x72f7('0x2'));var express=require(_0x72f7('0x3'));var router=express[_0x72f7('0x4')]();var auth=require(_0x72f7('0x5'));var controller=require('./rpc.controller');router[_0x72f7('0x6')](_0x72f7('0x7'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x9')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x72f7('0xa')]);router[_0x72f7('0x6')](_0x72f7('0xb'),auth[_0x72f7('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x72f7('0x6')]('/voice/queues',auth[_0x72f7('0x8')](),controller[_0x72f7('0xc')]);router['get'](_0x72f7('0xd'),auth['isAuthenticated'](),controller[_0x72f7('0xe')]);router['get'](_0x72f7('0xf'),auth[_0x72f7('0x8')](),controller['mailQueues']);router[_0x72f7('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x72f7('0x10')]);router[_0x72f7('0x6')](_0x72f7('0x11'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x12')]);router[_0x72f7('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0x72f7('0x13')]);router[_0x72f7('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x72f7('0x14')]);router[_0x72f7('0x6')](_0x72f7('0x15'),auth[_0x72f7('0x8')](),controller['voiceQueuesPreview']);router[_0x72f7('0x6')](_0x72f7('0x16'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x17')]);router['get'](_0x72f7('0x18'),auth['isAuthenticated'](),controller[_0x72f7('0x19')]);router[_0x72f7('0x6')](_0x72f7('0x1a'),auth['isAuthenticated'](),controller[_0x72f7('0x1b')]);router[_0x72f7('0x6')](_0x72f7('0x1c'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x1d')]);router['get'](_0x72f7('0x1e'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x1f')]);router[_0x72f7('0x6')]('/outbound',auth[_0x72f7('0x8')](),controller[_0x72f7('0x20')]);router[_0x72f7('0x6')](_0x72f7('0x21'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x22')]);router[_0x72f7('0x6')](_0x72f7('0x23'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x24')]);router['put'](_0x72f7('0x25'),auth[_0x72f7('0x8')](),controller['agentCapacity']);router[_0x72f7('0x6')](_0x72f7('0x26'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x27')]);router[_0x72f7('0x6')](_0x72f7('0x28'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x29')]);router['get'](_0x72f7('0x2a'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x2b')]);router['get']('/fax/accounts',auth[_0x72f7('0x8')](),controller[_0x72f7('0x2c')]);router[_0x72f7('0x6')](_0x72f7('0x2d'),auth[_0x72f7('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x72f7('0x6')](_0x72f7('0x2e'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x2f')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x72f7('0x8')](),controller[_0x72f7('0x30')]);router[_0x72f7('0x6')](_0x72f7('0x31'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x32')]);router['get'](_0x72f7('0x33'),auth['isAuthenticated'](),controller[_0x72f7('0x34')]);router[_0x72f7('0x35')](_0x72f7('0x36'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x37')](_0x72f7('0x38')));router[_0x72f7('0x6')](_0x72f7('0x39'),auth['isAuthenticated'](),controller[_0x72f7('0x3a')]);router[_0x72f7('0x35')](_0x72f7('0x3b'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x37')](_0x72f7('0x3c')));router[_0x72f7('0x6')](_0x72f7('0x3d'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x3e')]);router[_0x72f7('0x35')]('/fax/queues/:id/notify',auth[_0x72f7('0x8')](),controller[_0x72f7('0x37')](_0x72f7('0x3f')));router[_0x72f7('0x6')](_0x72f7('0x40'),auth[_0x72f7('0x8')](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router['get'](_0x72f7('0x41'),auth[_0x72f7('0x8')](),controller[_0x72f7('0x42')]);router[_0x72f7('0x35')](_0x72f7('0x43'),auth['isAuthenticated'](),controller[_0x72f7('0x37')](_0x72f7('0x44')));router[_0x72f7('0x6')]('/sms/queues/:id',auth[_0x72f7('0x8')](),controller[_0x72f7('0x45')]);router['post'](_0x72f7('0x46'),auth[_0x72f7('0x8')](),controller['agentNotify']);module[_0x72f7('0x47')]=router; \ No newline at end of file +var _0x3134=['showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id'];(function(_0x7efd60,_0x24f0c6){var _0x3e0b93=function(_0x3e61dc){while(--_0x3e61dc){_0x7efd60['push'](_0x7efd60['shift']());}};_0x3e0b93(++_0x24f0c6);}(_0x3134,0xdf));var _0x4313=function(_0x69bb39,_0xa07fb2){_0x69bb39=_0x69bb39-0x0;var _0x25349b=_0x3134[_0x69bb39];return _0x25349b;};'use strict';var multer=require(_0x4313('0x0'));var util=require('util');var path=require('path');var express=require(_0x4313('0x1'));var router=express[_0x4313('0x2')]();var auth=require(_0x4313('0x3'));var controller=require(_0x4313('0x4'));router[_0x4313('0x5')]('/voice/channels',auth['isAuthenticated'](),controller[_0x4313('0x6')]);router[_0x4313('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x4313('0x7')](),controller['voiceChannelMixMonitor']);router['get'](_0x4313('0x8'),auth[_0x4313('0x7')](),controller[_0x4313('0x9')]);router[_0x4313('0x5')](_0x4313('0xa'),auth[_0x4313('0x7')](),controller[_0x4313('0xb')]);router[_0x4313('0x5')](_0x4313('0xc'),auth['isAuthenticated'](),controller[_0x4313('0xd')]);router[_0x4313('0x5')](_0x4313('0xe'),auth['isAuthenticated'](),controller[_0x4313('0xf')]);router[_0x4313('0x5')](_0x4313('0x10'),auth[_0x4313('0x7')](),controller[_0x4313('0x11')]);router[_0x4313('0x5')](_0x4313('0x12'),auth[_0x4313('0x7')](),controller[_0x4313('0x13')]);router[_0x4313('0x5')](_0x4313('0x14'),auth[_0x4313('0x7')](),controller[_0x4313('0x15')]);router[_0x4313('0x5')](_0x4313('0x16'),auth[_0x4313('0x7')](),controller[_0x4313('0x17')]);router[_0x4313('0x5')]('/voice/queues/preview/:id',auth[_0x4313('0x7')](),controller[_0x4313('0x18')]);router['get'](_0x4313('0x19'),auth['isAuthenticated'](),controller[_0x4313('0x1a')]);router[_0x4313('0x5')](_0x4313('0x1b'),auth[_0x4313('0x7')](),controller[_0x4313('0x1c')]);router[_0x4313('0x5')](_0x4313('0x1d'),auth[_0x4313('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x4313('0x5')](_0x4313('0x1e'),auth[_0x4313('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x4313('0x5')]('/voice/queues/:id',auth[_0x4313('0x7')](),controller['showVoiceQueues']);router[_0x4313('0x5')]('/outbound',auth[_0x4313('0x7')](),controller['outbound']);router[_0x4313('0x5')](_0x4313('0x1f'),auth[_0x4313('0x7')](),controller[_0x4313('0x20')]);router['get'](_0x4313('0x21'),auth['isAuthenticated'](),controller[_0x4313('0x22')]);router[_0x4313('0x23')](_0x4313('0x24'),auth['isAuthenticated'](),controller[_0x4313('0x25')]);router[_0x4313('0x5')](_0x4313('0x26'),auth[_0x4313('0x7')](),controller[_0x4313('0x27')]);router[_0x4313('0x5')](_0x4313('0x28'),auth[_0x4313('0x7')](),controller['trunks']);router[_0x4313('0x5')](_0x4313('0x29'),auth[_0x4313('0x7')](),controller[_0x4313('0x2a')]);router['get']('/fax/accounts',auth[_0x4313('0x7')](),controller[_0x4313('0x2b')]);router['get'](_0x4313('0x2c'),auth['isAuthenticated'](),controller[_0x4313('0x2d')]);router[_0x4313('0x5')](_0x4313('0x2e'),auth[_0x4313('0x7')](),controller[_0x4313('0x2f')]);router['get'](_0x4313('0x30'),auth[_0x4313('0x7')](),controller[_0x4313('0x31')]);router['get']('/sms/queues/waitinginteractions',auth[_0x4313('0x7')](),controller[_0x4313('0x32')]);router[_0x4313('0x5')](_0x4313('0x33'),auth['isAuthenticated'](),controller[_0x4313('0x34')]);router[_0x4313('0x35')](_0x4313('0x36'),auth[_0x4313('0x7')](),controller[_0x4313('0x37')](_0x4313('0x38')));router[_0x4313('0x5')](_0x4313('0x39'),auth['isAuthenticated'](),controller[_0x4313('0x3a')]);router[_0x4313('0x35')](_0x4313('0x3b'),auth[_0x4313('0x7')](),controller['queueNotify'](_0x4313('0x3c')));router[_0x4313('0x5')]('/chat/queues/:id',auth[_0x4313('0x7')](),controller[_0x4313('0x3d')]);router['post'](_0x4313('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0x4313('0x3f')));router[_0x4313('0x5')]('/fax/queues/:id',auth['isAuthenticated'](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth[_0x4313('0x7')](),controller[_0x4313('0x37')]('openchannel'));router[_0x4313('0x5')](_0x4313('0x40'),auth[_0x4313('0x7')](),controller[_0x4313('0x41')]);router[_0x4313('0x35')](_0x4313('0x42'),auth[_0x4313('0x7')](),controller[_0x4313('0x37')](_0x4313('0x43')));router[_0x4313('0x5')](_0x4313('0x44'),auth[_0x4313('0x7')](),controller[_0x4313('0x45')]);router[_0x4313('0x35')](_0x4313('0x46'),auth['isAuthenticated'](),controller[_0x4313('0x47')]);module[_0x4313('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 447a535..d24e841 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 _0xeda1=['InteractionId','agentTransferTimeout','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','catch','status','sendStatus','stack','name','isNil','find','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','SIP/%s','interface','agent','internal','capacity','telephones','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','From','QueueId','TransferReport','create','Start','queue','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','\x20Message\x20not\x20found','update','MessageId'];(function(_0x103f0b,_0x4aba35){var _0x29b3b7=function(_0x3aa9c3){while(--_0x3aa9c3){_0x103f0b['push'](_0x103f0b['shift']());}};_0x29b3b7(++_0x4aba35);}(_0xeda1,0x1c6));var _0x1eda=function(_0x4f0159,_0xaf2d85){_0x4f0159=_0x4f0159-0x0;var _0x2b53a8=_0xeda1[_0x4f0159];return _0x2b53a8;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x1eda('0x0'));var util=require(_0x1eda('0x1'));var db=require(_0x1eda('0x2'))['db'];var logger=require(_0x1eda('0x3'))(_0x1eda('0x4'));var jayson=require(_0x1eda('0x5'));var amiClient=jayson[_0x1eda('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x1eda('0x6')][_0x1eda('0x7')]({'port':0x232b});var routingClient=jayson[_0x1eda('0x6')][_0x1eda('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x8e3f19,_0x153f3e,_0x57cb0d){return new BPromise(function(_0x145403,_0x27964a){var _0x12cf47=_0x57cb0d?_0x57cb0d:amiClient;return _0x12cf47[_0x1eda('0x8')](_0x8e3f19,_0x153f3e)[_0x1eda('0x9')](function(_0x33f13a){if(_0x33f13a[_0x1eda('0xa')]){if(_0x33f13a[_0x1eda('0xa')][_0x1eda('0xb')]===0x1f4){return _0x27964a(_0x33f13a[_0x1eda('0xa')][_0x1eda('0xc')]);}return _0x145403(_0x33f13a[_0x1eda('0xa')][_0x1eda('0xc')]);}else{_0x145403(_0x33f13a['result']);}})[_0x1eda('0xd')](function(_0x1133d3){_0x27964a(_0x1133d3);});});}function respondWithResult(_0x269c85,_0x4990b5){_0x4990b5=_0x4990b5||0xc8;return function(_0x49d1e2){if(_0x49d1e2){return _0x269c85[_0x1eda('0xe')](_0x4990b5)['json'](_0x49d1e2);}return _0x269c85[_0x1eda('0xf')](0x194);};}function handleError(_0x184608,_0x1d1f57){_0x1d1f57=_0x1d1f57||0x1f4;return function(_0x325e8e){logger[_0x1eda('0xa')](_0x325e8e[_0x1eda('0x10')]);if(_0x325e8e[_0x1eda('0x11')]){delete _0x325e8e[_0x1eda('0x11')];}_0x184608['status'](_0x1d1f57)['send'](_0x325e8e);};}function findById(_0x526a8c){return function(_0x30ffbb){if(!_['isNil'](_0x526a8c)&&!_[_0x1eda('0x12')](_0x30ffbb)&&!_[_0x1eda('0x12')](_0x30ffbb['rows'])){return _[_0x1eda('0x13')](_0x30ffbb[_0x1eda('0x14')],function(_0x5e7bd1){return _0x5e7bd1['id']==_0x526a8c;});}return null;};}exports[_0x1eda('0x15')]=function(_0x5362db,_0x1df208){return respondWithRpcPromise(_0x1eda('0x16'),_0x5362db[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x1df208,null))[_0x1eda('0xd')](handleError(_0x1df208,null));};exports['voiceChannelMixMonitor']=function(_0x133665,_0xc70dcb){return respondWithRpcPromise(_0x1eda('0x18'),_['merge'](_0x133665[_0x1eda('0x17')],_0x133665[_0x1eda('0x19')]))['then'](respondWithResult(_0xc70dcb,null))[_0x1eda('0xd')](handleError(_0xc70dcb,null));};exports['voiceChannelStopMixMonitor']=function(_0x20be32,_0x21311f){return respondWithRpcPromise(_0x1eda('0x1a'),_[_0x1eda('0x1b')](_0x20be32[_0x1eda('0x17')],_0x20be32[_0x1eda('0x19')]))[_0x1eda('0x9')](respondWithResult(_0x21311f,null))[_0x1eda('0xd')](handleError(_0x21311f,null));};exports[_0x1eda('0x1c')]=function(_0x3685a1,_0x49c640){return respondWithRpcPromise(_0x1eda('0x1d'),_0x3685a1[_0x1eda('0x17')])['then'](respondWithResult(_0x49c640,null))[_0x1eda('0xd')](handleError(_0x49c640,null));};exports[_0x1eda('0x1e')]=function(_0x8d1816,_0x2f1543){return respondWithRpcPromise('VoiceQueues',_0x8d1816[_0x1eda('0x17')])[_0x1eda('0x9')](findById(_0x8d1816[_0x1eda('0x19')]['id']))['then'](respondWithResult(_0x2f1543,null))['catch'](handleError(_0x2f1543,null));};exports[_0x1eda('0x1f')]=function(_0x157fe4,_0x4d362f){return respondWithRpcPromise(_0x1eda('0x20'),_[_0x1eda('0x1b')](_0x157fe4[_0x1eda('0x17')],_0x157fe4[_0x1eda('0x19')]))[_0x1eda('0x9')](respondWithResult(_0x4d362f,null))[_0x1eda('0xd')](handleError(_0x4d362f,null));};exports['voiceQueuesChannels']=function(_0x3d6621,_0x48aa06){return respondWithRpcPromise(_0x1eda('0x21'),_0x3d6621[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x48aa06,null))[_0x1eda('0xd')](handleError(_0x48aa06,null));};exports[_0x1eda('0x22')]=function(_0x48170a,_0xb090ee){return respondWithRpcPromise(_0x1eda('0x23'),_['merge'](_0x48170a[_0x1eda('0x17')],_0x48170a['params']))[_0x1eda('0x9')](respondWithResult(_0xb090ee,null))['catch'](handleError(_0xb090ee,null));};exports['voiceQueuesChannelHangup']=function(_0xb56f3f,_0x219758){return respondWithRpcPromise(_0x1eda('0x24'),_['merge'](_0xb56f3f[_0x1eda('0x17')],_0xb56f3f['params']))[_0x1eda('0x9')](respondWithResult(_0x219758,null))['catch'](handleError(_0x219758,null));};exports[_0x1eda('0x25')]=function(_0x241fd6,_0x227394){return respondWithRpcPromise(_0x1eda('0x26'),_['merge'](_0x241fd6['query'],_0x241fd6['params']))['then'](respondWithResult(_0x227394,null))[_0x1eda('0xd')](handleError(_0x227394,null));};exports[_0x1eda('0x27')]=function(_0x14522c,_0x45a847){return respondWithRpcPromise(_0x1eda('0x28'),_0x14522c[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x45a847,null))[_0x1eda('0xd')](handleError(_0x45a847,null));};exports[_0x1eda('0x29')]=function(_0x3dd92b,_0x3f6eae){return respondWithRpcPromise(_0x1eda('0x2a'),_0x3dd92b[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x3f6eae,null))[_0x1eda('0xd')](handleError(_0x3f6eae,null));};exports[_0x1eda('0x2b')]=function(_0x6f0a98,_0x2d6471){var _0x5bb0e2;return respondWithRpcPromise(_0x1eda('0x2c'),_0x6f0a98[_0x1eda('0x17')])['then'](function(_0x49b9d0){_0x5bb0e2=_0x49b9d0;return respondWithRpcPromise('Agents',_0x6f0a98[_0x1eda('0x17')],routingClient);})['then'](function(_0x43c170){return _[_0x1eda('0x1b')]({},_0x43c170,_0x5bb0e2);})[_0x1eda('0x9')](respondWithResult(_0x2d6471,null))[_0x1eda('0xd')](handleError(_0x2d6471,null));};exports[_0x1eda('0x2d')]=function(_0x275cc1,_0x49bb43){if(_0x275cc1[_0x1eda('0x2e')]&&_0x275cc1['body'][_0x1eda('0x2f')]&&_0x275cc1['user']&&_0x275cc1[_0x1eda('0x30')][_0x1eda('0x11')]){for(var _0x285a5b in _0x275cc1['body']['interaction']){if(_0x275cc1[_0x1eda('0x2e')]['interaction'][_0x1eda('0x31')](_0x285a5b)){db[_0x1eda('0x32')][_0x1eda('0x33')]({'where':{'channel':_0x285a5b,'membername':_0x275cc1[_0x1eda('0x30')][_0x1eda('0x11')],'type':_0x1eda('0x34'),'exitAt':null,'uniqueid':_0x275cc1[_0x1eda('0x2e')]['interaction'][_0x285a5b]&&_0x275cc1[_0x1eda('0x2e')][_0x1eda('0x2f')][_0x285a5b]['length']?{'$notIn':_0x275cc1['body'][_0x1eda('0x2f')][_0x285a5b]}:{'$ne':null}}})['then'](function(_0x1588c1){var _0x289ae5=moment()[_0x1eda('0x35')](_0x1eda('0x36'));for(var _0xf813e2=0x0,_0x936ac6=_0x1588c1[_0x1eda('0x37')];_0xf813e2<_0x936ac6;_0xf813e2+=0x1){_0x1588c1[_0xf813e2][_0x1eda('0x38')]({'exitAt':_0x289ae5});}});for(var _0x1ca5db=0x0;_0x1ca5db<_0x275cc1['body'][_0x1eda('0x2f')][_0x285a5b][_0x1eda('0x37')];_0x1ca5db+=0x1){db[_0x1eda('0x32')][_0x1eda('0x39')]({'where':{'channel':_0x285a5b,'membername':_0x275cc1[_0x1eda('0x30')][_0x1eda('0x11')],'type':_0x1eda('0x34'),'uniqueid':_0x275cc1['body'][_0x1eda('0x2f')][_0x285a5b][_0x1ca5db],'exitAt':null},'defaults':{'channel':_0x285a5b,'membername':_0x275cc1['user'][_0x1eda('0x11')],'interface':_[_0x1eda('0x12')](_0x275cc1['user']['interface'])?util['format'](_0x1eda('0x3a'),_0x275cc1[_0x1eda('0x30')][_0x1eda('0x11')]):_0x275cc1['user'][_0x1eda('0x3b')],'type':'INTERACTION','enterAt':moment()[_0x1eda('0x35')](_0x1eda('0x36')),'role':_0x1eda('0x3c'),'internal':_0x275cc1[_0x1eda('0x30')][_0x1eda('0x3d')],'uniqueid':_0x275cc1[_0x1eda('0x2e')][_0x1eda('0x2f')][_0x285a5b][_0x1ca5db]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x275cc1[_0x1eda('0x19')]['id'],'capacity':_0x275cc1['body'][_0x1eda('0x3e')]},routingClient)[_0x1eda('0x9')](respondWithResult(_0x49bb43,null))[_0x1eda('0xd')](handleError(_0x49bb43,null));};exports[_0x1eda('0x3f')]=function(_0x72c005,_0x4ef94f){return respondWithRpcPromise('Telephones',_0x72c005[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x4ef94f,null))[_0x1eda('0xd')](handleError(_0x4ef94f,null));};exports['trunks']=function(_0x3a2263,_0x1789dd){return respondWithRpcPromise(_0x1eda('0x40'),_0x3a2263[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x1789dd,null))['catch'](handleError(_0x1789dd,null));};exports[_0x1eda('0x41')]=function(_0x493365,_0x5adce5){return respondWithRpcPromise(_0x1eda('0x42'),_0x493365[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x5adce5,null))['catch'](handleError(_0x5adce5,null));};exports[_0x1eda('0x43')]=function(_0x47b500,_0x5a3127){return respondWithRpcPromise('ChatQueues',_0x47b500['query'],routingClient)[_0x1eda('0x9')](respondWithResult(_0x5a3127,null))['catch'](handleError(_0x5a3127,null));};exports[_0x1eda('0x44')]=function(_0x31bd6d,_0x2f2554){return respondWithRpcPromise(_0x1eda('0x45'),_0x31bd6d[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](findById(_0x31bd6d['params']['id']))[_0x1eda('0x9')](respondWithResult(_0x2f2554,null))[_0x1eda('0xd')](handleError(_0x2f2554,null));};exports[_0x1eda('0x46')]=function(_0x21dcad,_0x3430d3){return respondWithRpcPromise(_0x1eda('0x47'),_0x21dcad[_0x1eda('0x17')],routingClient)['then'](respondWithResult(_0x3430d3,null))['catch'](handleError(_0x3430d3,null));};exports[_0x1eda('0x48')]=function(_0x488c88,_0x717e88){return respondWithRpcPromise(_0x1eda('0x47'),_0x488c88[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](findById(_0x488c88[_0x1eda('0x19')]['id']))['then'](respondWithResult(_0x717e88,null))[_0x1eda('0xd')](handleError(_0x717e88,null));};exports[_0x1eda('0x49')]=function(_0x2eae6f,_0x290698){return respondWithRpcPromise('MailAccounts',_0x2eae6f[_0x1eda('0x17')],mailClient)['then'](respondWithResult(_0x290698,null))[_0x1eda('0xd')](handleError(_0x290698,null));};exports[_0x1eda('0x4a')]=function(_0x213ad5,_0x38f5b9){return respondWithRpcPromise('OpenchannelQueues',_0x213ad5[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](respondWithResult(_0x38f5b9,null))[_0x1eda('0xd')](handleError(_0x38f5b9,null));};exports[_0x1eda('0x4b')]=function(_0x145ddf,_0x2cf9b9){return respondWithRpcPromise('OpenchannelQueues',_0x145ddf['query'],routingClient)['then'](findById(_0x145ddf[_0x1eda('0x19')]['id']))[_0x1eda('0x9')](respondWithResult(_0x2cf9b9,null))[_0x1eda('0xd')](handleError(_0x2cf9b9,null));};exports['smsQueues']=function(_0x2a35a5,_0x194c7f){return respondWithRpcPromise('SmsQueues',_0x2a35a5[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](respondWithResult(_0x194c7f,null))[_0x1eda('0xd')](handleError(_0x194c7f,null));};exports[_0x1eda('0x4c')]=function(_0x5255a3,_0x3f2a07){return respondWithRpcPromise('SmsQueues',_0x5255a3[_0x1eda('0x17')],routingClient)['then'](findById(_0x5255a3['params']['id']))['then'](respondWithResult(_0x3f2a07,null))[_0x1eda('0xd')](handleError(_0x3f2a07,null));};exports[_0x1eda('0x4d')]=function(_0x4af289,_0x2610c7){return respondWithRpcPromise(_0x1eda('0x4e'),_0x4af289[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](respondWithResult(_0x2610c7,null))['catch'](handleError(_0x2610c7,null));};exports[_0x1eda('0x4f')]=function(_0x5c613b,_0x609dd8){return respondWithRpcPromise('FaxQueues',_0x5c613b[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](findById(_0x5c613b[_0x1eda('0x19')]['id']))[_0x1eda('0x9')](respondWithResult(_0x609dd8,null))['catch'](handleError(_0x609dd8,null));};exports[_0x1eda('0x50')]=function(_0x2ae5a3,_0x2c0184){return respondWithRpcPromise('FaxAccounts',_0x2ae5a3[_0x1eda('0x17')])[_0x1eda('0x9')](respondWithResult(_0x2c0184,null))[_0x1eda('0xd')](handleError(_0x2c0184,null));};exports[_0x1eda('0x51')]=function(_0x2e9c95,_0x2a5b6c){return respondWithRpcPromise(_0x1eda('0x52'),_0x2e9c95[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](respondWithResult(_0x2a5b6c,null))[_0x1eda('0xd')](handleError(_0x2a5b6c,null));};exports[_0x1eda('0x53')]=function(_0x13aaaa,_0xbab886){return respondWithRpcPromise(_0x1eda('0x54'),_0x13aaaa['query'],routingClient)[_0x1eda('0x9')](respondWithResult(_0xbab886,null))['catch'](handleError(_0xbab886,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2dff8b,_0x20a10c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2dff8b[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](respondWithResult(_0x20a10c,null))[_0x1eda('0xd')](handleError(_0x20a10c,null));};exports['smsQueuesWaitingInteractions']=function(_0x294f17,_0x4322bd){return respondWithRpcPromise(_0x1eda('0x55'),_0x294f17[_0x1eda('0x17')],routingClient)[_0x1eda('0x9')](respondWithResult(_0x4322bd,null))[_0x1eda('0xd')](handleError(_0x4322bd,null));};exports[_0x1eda('0x56')]=function(_0x3b51f0,_0x5a5ddd){return respondWithRpcPromise(_0x1eda('0x57'),_0x3b51f0['query'],routingClient)[_0x1eda('0x9')](respondWithResult(_0x5a5ddd,null))[_0x1eda('0xd')](handleError(_0x5a5ddd,null));};exports[_0x1eda('0x58')]=function(_0x44c80e){return function(_0x8e3e9,_0x185a34){var _0x176d4b,_0x9b365c;var _0x48a48e=_[_0x1eda('0x59')](_0x44c80e);var _0x15bae2=_0x44c80e===_0x1eda('0x5a')?_0x1eda('0x5b'):_0x1eda('0x5c');return db[_0x48a48e+'Queue'][_0x1eda('0x5d')]({'raw':!![],'where':{'id':_0x8e3e9['params']['id']}})[_0x1eda('0x9')](function(_0x1e4bc3){if(_[_0x1eda('0x12')](_0x1e4bc3)){throw new Error(_0x48a48e+_0x1eda('0x5e'));}_0x176d4b=_0x1e4bc3;return db[_0x48a48e+_0x1eda('0x5f')]['findOne']({'where':{'id':_0x8e3e9[_0x1eda('0x2e')][_0x1eda('0x60')]},'include':[{'model':db[_0x48a48e+_0x1eda('0x61')],'as':_0x1eda('0x61')},{'model':db[_0x48a48e+_0x15bae2],'as':_0x1eda('0x5c')}]});})[_0x1eda('0x9')](function(_0x4e87e3){if(_[_0x1eda('0x12')](_0x4e87e3)){throw new Error(_0x48a48e+'\x20Message\x20not\x20found');}_0x9b365c=_0x4e87e3;return _0x4e87e3['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x1eda('0x9')](function(){var _0x271216={'uniqueid':_0x44c80e+'.'+_0x9b365c['id']+'.'+_0x9b365c[_0x1eda('0x61')]['id'],'FromUserId':_0x8e3e9[_0x1eda('0x30')]['id'],'type':'queue'};_0x271216[_0x48a48e+'MessageId']=_0x9b365c['id'];_0x271216[_0x48a48e+'InteractionId']=_0x9b365c['Interaction']['id'];_0x271216[_0x1eda('0x62')+_0x48a48e+_0x15bae2+'Id']=_0x9b365c[_0x1eda('0x5c')]['id'];_0x271216['To'+_0x48a48e+_0x1eda('0x63')]=_0x176d4b['id'];return db[_0x48a48e+_0x1eda('0x64')][_0x1eda('0x65')](_0x271216);})[_0x1eda('0x9')](function(){return respondWithRpcPromise(_0x1eda('0x66'),{'channel':_0x44c80e,'interaction':_0x9b365c[_0x1eda('0x61')],'message':_0x9b365c,'account':_0x9b365c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1eda('0x67'),'appdata':_0x176d4b[_0x1eda('0x11')]+','+(_0x9b365c[_0x1eda('0x5c')]['queueTransferTimeout']||0x12c),'interval':_0x1eda('0x68')}]},routingClient);})[_0x1eda('0x9')](respondWithResult(_0x185a34,null))[_0x1eda('0xd')](handleError(_0x185a34,null));};};exports['agentNotify']=function(_0x4866ba,_0x5938cf){var _0x329524,_0x772a3c;if(_[_0x1eda('0x12')](_0x4866ba[_0x1eda('0x2e')][_0x1eda('0x69')])){throw new Error(_0x1eda('0x6a'));}var _0x596821=_0x4866ba[_0x1eda('0x2e')][_0x1eda('0x69')];var _0x206592=_[_0x1eda('0x59')](_0x596821);var _0x589736=_0x596821===_0x1eda('0x5a')?_0x1eda('0x5b'):_0x1eda('0x5c');return db[_0x1eda('0x6b')][_0x1eda('0x5d')]({'raw':!![],'where':{'id':_0x4866ba[_0x1eda('0x19')]['id'],'role':'agent'}})[_0x1eda('0x9')](function(_0x223b4b){if(_[_0x1eda('0x12')](_0x223b4b)){throw new Error('Agent\x20not\x20found');}_0x329524=_0x223b4b;return db[_0x206592+_0x1eda('0x5f')][_0x1eda('0x5d')]({'where':{'id':_0x4866ba[_0x1eda('0x2e')][_0x1eda('0x60')]},'include':[{'model':db[_0x206592+_0x1eda('0x61')],'as':_0x1eda('0x61')},{'model':db[_0x206592+_0x589736],'as':'Account'}]});})[_0x1eda('0x9')](function(_0x4722fe){if(_[_0x1eda('0x12')](_0x4722fe)){throw new Error(_0x206592+_0x1eda('0x6c'));}_0x772a3c=_0x4722fe;return _0x4722fe[_0x1eda('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1eda('0x9')](function(){var _0x3bb9d3={'uniqueid':_0x596821+'.'+_0x772a3c['id']+'.'+_0x772a3c[_0x1eda('0x61')]['id'],'FromUserId':_0x4866ba['user']['id'],'type':_0x1eda('0x67'),'ToUserId':_0x329524['id']};_0x3bb9d3[_0x206592+_0x1eda('0x6e')]=_0x772a3c['id'];_0x3bb9d3[_0x206592+_0x1eda('0x6f')]=_0x772a3c[_0x1eda('0x61')]['id'];_0x3bb9d3[_0x1eda('0x62')+_0x206592+_0x589736+'Id']=_0x772a3c[_0x1eda('0x5c')]['id'];return db[_0x206592+'TransferReport'][_0x1eda('0x65')](_0x3bb9d3);})[_0x1eda('0x9')](function(){return respondWithRpcPromise(_0x1eda('0x66'),{'channel':_0x596821,'interaction':_0x772a3c[_0x1eda('0x61')],'message':_0x772a3c,'account':_0x772a3c[_0x1eda('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1eda('0x3c'),'appdata':_0x329524[_0x1eda('0x11')]+','+(_0x772a3c[_0x1eda('0x5c')][_0x1eda('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1eda('0x9')](respondWithResult(_0x5938cf,null))[_0x1eda('0xd')](handleError(_0x5938cf,null));}; \ No newline at end of file +var _0x0222=['openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','findOne','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0222,0x106));var _0x2022=function(_0x2a0c95,_0x4cb39a){_0x2a0c95=_0x2a0c95-0x0;var _0x37a612=_0x0222[_0x2a0c95];return _0x37a612;};'use strict';var BPromise=require(_0x2022('0x0'));var moment=require(_0x2022('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x2022('0x2'))(_0x2022('0x3'));var jayson=require(_0x2022('0x4'));var amiClient=jayson[_0x2022('0x5')][_0x2022('0x6')]({'port':0x232a});var mailClient=jayson[_0x2022('0x5')][_0x2022('0x6')]({'port':0x232b});var routingClient=jayson[_0x2022('0x5')][_0x2022('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x43dce3,_0x4dac5e,_0x10c2b3){return new BPromise(function(_0x1bfa55,_0x25108b){var _0x3d25f5=_0x10c2b3?_0x10c2b3:amiClient;return _0x3d25f5[_0x2022('0x7')](_0x43dce3,_0x4dac5e)[_0x2022('0x8')](function(_0x387281){if(_0x387281[_0x2022('0x9')]){if(_0x387281[_0x2022('0x9')][_0x2022('0xa')]===0x1f4){return _0x25108b(_0x387281[_0x2022('0x9')]['message']);}return _0x1bfa55(_0x387281[_0x2022('0x9')][_0x2022('0xb')]);}else{_0x1bfa55(_0x387281[_0x2022('0xc')]);}})[_0x2022('0xd')](function(_0x646fdc){_0x25108b(_0x646fdc);});});}function respondWithResult(_0x59f475,_0x25e2a5){_0x25e2a5=_0x25e2a5||0xc8;return function(_0x20c845){if(_0x20c845){return _0x59f475[_0x2022('0xe')](_0x25e2a5)['json'](_0x20c845);}return _0x59f475['sendStatus'](0x194);};}function handleError(_0x4f520a,_0x491aa1){_0x491aa1=_0x491aa1||0x1f4;return function(_0x5e70cf){logger[_0x2022('0x9')](_0x5e70cf[_0x2022('0xf')]);if(_0x5e70cf[_0x2022('0x10')]){delete _0x5e70cf[_0x2022('0x10')];}_0x4f520a[_0x2022('0xe')](_0x491aa1)[_0x2022('0x11')](_0x5e70cf);};}function findById(_0x1ff95a){return function(_0x1f7135){if(!_['isNil'](_0x1ff95a)&&!_[_0x2022('0x12')](_0x1f7135)&&!_['isNil'](_0x1f7135[_0x2022('0x13')])){return _[_0x2022('0x14')](_0x1f7135[_0x2022('0x13')],function(_0x41046f){return _0x41046f['id']==_0x1ff95a;});}return null;};}exports[_0x2022('0x15')]=function(_0x9b9b38,_0x746cc9){return respondWithRpcPromise('VoiceChannels',_0x9b9b38[_0x2022('0x16')])['then'](respondWithResult(_0x746cc9,null))[_0x2022('0xd')](handleError(_0x746cc9,null));};exports[_0x2022('0x17')]=function(_0x3dc0c5,_0x45475e){return respondWithRpcPromise(_0x2022('0x18'),_['merge'](_0x3dc0c5[_0x2022('0x16')],_0x3dc0c5[_0x2022('0x19')]))[_0x2022('0x8')](respondWithResult(_0x45475e,null))['catch'](handleError(_0x45475e,null));};exports[_0x2022('0x1a')]=function(_0xe29812,_0x4b452f){return respondWithRpcPromise(_0x2022('0x1b'),_[_0x2022('0x1c')](_0xe29812[_0x2022('0x16')],_0xe29812['params']))[_0x2022('0x8')](respondWithResult(_0x4b452f,null))[_0x2022('0xd')](handleError(_0x4b452f,null));};exports['voiceQueues']=function(_0x261d2d,_0x15b6e6){return respondWithRpcPromise(_0x2022('0x1d'),_0x261d2d[_0x2022('0x16')])[_0x2022('0x8')](respondWithResult(_0x15b6e6,null))['catch'](handleError(_0x15b6e6,null));};exports[_0x2022('0x1e')]=function(_0x11f8b6,_0x195987){return respondWithRpcPromise('VoiceQueues',_0x11f8b6['query'])[_0x2022('0x8')](findById(_0x11f8b6['params']['id']))['then'](respondWithResult(_0x195987,null))[_0x2022('0xd')](handleError(_0x195987,null));};exports['voiceQueuesPreview']=function(_0x54d55b,_0x55f38a){return respondWithRpcPromise(_0x2022('0x1f'),_[_0x2022('0x1c')](_0x54d55b[_0x2022('0x16')],_0x54d55b[_0x2022('0x19')]))['then'](respondWithResult(_0x55f38a,null))[_0x2022('0xd')](handleError(_0x55f38a,null));};exports['voiceQueuesChannels']=function(_0x48d20b,_0x12252a){return respondWithRpcPromise(_0x2022('0x20'),_0x48d20b[_0x2022('0x16')])[_0x2022('0x8')](respondWithResult(_0x12252a,null))['catch'](handleError(_0x12252a,null));};exports[_0x2022('0x21')]=function(_0x4b61ce,_0x4c81de){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x2022('0x1c')](_0x4b61ce[_0x2022('0x16')],_0x4b61ce[_0x2022('0x19')]))[_0x2022('0x8')](respondWithResult(_0x4c81de,null))['catch'](handleError(_0x4c81de,null));};exports[_0x2022('0x22')]=function(_0x262f7b,_0x452670){return respondWithRpcPromise(_0x2022('0x23'),_[_0x2022('0x1c')](_0x262f7b['query'],_0x262f7b[_0x2022('0x19')]))['then'](respondWithResult(_0x452670,null))[_0x2022('0xd')](handleError(_0x452670,null));};exports[_0x2022('0x24')]=function(_0x9c24d8,_0x4f6f21){return respondWithRpcPromise(_0x2022('0x25'),_[_0x2022('0x1c')](_0x9c24d8[_0x2022('0x16')],_0x9c24d8[_0x2022('0x19')]))['then'](respondWithResult(_0x4f6f21,null))['catch'](handleError(_0x4f6f21,null));};exports[_0x2022('0x26')]=function(_0x2adca0,_0x4c9442){return respondWithRpcPromise(_0x2022('0x27'),_0x2adca0[_0x2022('0x16')])['then'](respondWithResult(_0x4c9442,null))[_0x2022('0xd')](handleError(_0x4c9442,null));};exports[_0x2022('0x28')]=function(_0x484adc,_0x355afd){return respondWithRpcPromise(_0x2022('0x29'),_0x484adc['query'])[_0x2022('0x8')](respondWithResult(_0x355afd,null))['catch'](handleError(_0x355afd,null));};exports[_0x2022('0x2a')]=function(_0x16d6b4,_0x4f5c8b){var _0x1bbd3f;return respondWithRpcPromise(_0x2022('0x2b'),_0x16d6b4[_0x2022('0x16')])['then'](function(_0x4b6a66){_0x1bbd3f=_0x4b6a66;return respondWithRpcPromise('Agents',_0x16d6b4[_0x2022('0x16')],routingClient);})['then'](function(_0x4d8467){return _['merge']({},_0x4d8467,_0x1bbd3f);})['then'](respondWithResult(_0x4f5c8b,null))[_0x2022('0xd')](handleError(_0x4f5c8b,null));};exports[_0x2022('0x2c')]=function(_0x4a3be7,_0x3ee323){if(_0x4a3be7['body']&&_0x4a3be7[_0x2022('0x2d')][_0x2022('0x2e')]&&_0x4a3be7[_0x2022('0x2f')]&&_0x4a3be7['user'][_0x2022('0x10')]){for(var _0x5705c7 in _0x4a3be7[_0x2022('0x2d')][_0x2022('0x2e')]){if(_0x4a3be7[_0x2022('0x2d')][_0x2022('0x2e')][_0x2022('0x30')](_0x5705c7)){db[_0x2022('0x31')][_0x2022('0x32')]({'where':{'channel':_0x5705c7,'membername':_0x4a3be7[_0x2022('0x2f')][_0x2022('0x10')],'type':_0x2022('0x33'),'exitAt':null,'uniqueid':_0x4a3be7['body'][_0x2022('0x2e')][_0x5705c7]&&_0x4a3be7[_0x2022('0x2d')][_0x2022('0x2e')][_0x5705c7][_0x2022('0x34')]?{'$notIn':_0x4a3be7[_0x2022('0x2d')][_0x2022('0x2e')][_0x5705c7]}:{'$ne':null}}})[_0x2022('0x8')](function(_0x371edc){var _0x70f042=moment()[_0x2022('0x35')](_0x2022('0x36'));for(var _0x2db035=0x0,_0x3cf576=_0x371edc[_0x2022('0x34')];_0x2db035<_0x3cf576;_0x2db035+=0x1){_0x371edc[_0x2db035][_0x2022('0x37')]({'exitAt':_0x70f042});}});for(var _0x2d05b4=0x0;_0x2d05b4<_0x4a3be7['body'][_0x2022('0x2e')][_0x5705c7][_0x2022('0x34')];_0x2d05b4+=0x1){db['MemberReport'][_0x2022('0x38')]({'where':{'channel':_0x5705c7,'membername':_0x4a3be7[_0x2022('0x2f')][_0x2022('0x10')],'type':_0x2022('0x33'),'uniqueid':_0x4a3be7[_0x2022('0x2d')][_0x2022('0x2e')][_0x5705c7][_0x2d05b4],'exitAt':null},'defaults':{'channel':_0x5705c7,'membername':_0x4a3be7[_0x2022('0x2f')][_0x2022('0x10')],'interface':_[_0x2022('0x12')](_0x4a3be7[_0x2022('0x2f')][_0x2022('0x39')])?util[_0x2022('0x35')](_0x2022('0x3a'),_0x4a3be7['user'][_0x2022('0x10')]):_0x4a3be7[_0x2022('0x2f')][_0x2022('0x39')],'type':_0x2022('0x33'),'enterAt':moment()[_0x2022('0x35')](_0x2022('0x36')),'role':_0x2022('0x3b'),'internal':_0x4a3be7['user']['internal'],'uniqueid':_0x4a3be7['body'][_0x2022('0x2e')][_0x5705c7][_0x2d05b4]}});}}}}return respondWithRpcPromise(_0x2022('0x3c'),{'id':_0x4a3be7[_0x2022('0x19')]['id'],'capacity':_0x4a3be7[_0x2022('0x2d')][_0x2022('0x3d')]},routingClient)[_0x2022('0x8')](respondWithResult(_0x3ee323,null))[_0x2022('0xd')](handleError(_0x3ee323,null));};exports[_0x2022('0x3e')]=function(_0x124450,_0x16c9df){return respondWithRpcPromise(_0x2022('0x3f'),_0x124450[_0x2022('0x16')])[_0x2022('0x8')](respondWithResult(_0x16c9df,null))[_0x2022('0xd')](handleError(_0x16c9df,null));};exports[_0x2022('0x40')]=function(_0x3445f5,_0x2025e6){return respondWithRpcPromise(_0x2022('0x41'),_0x3445f5[_0x2022('0x16')])[_0x2022('0x8')](respondWithResult(_0x2025e6,null))[_0x2022('0xd')](handleError(_0x2025e6,null));};exports[_0x2022('0x42')]=function(_0x5cddde,_0x4eb352){return respondWithRpcPromise(_0x2022('0x43'),_0x5cddde[_0x2022('0x16')])[_0x2022('0x8')](respondWithResult(_0x4eb352,null))['catch'](handleError(_0x4eb352,null));};exports[_0x2022('0x44')]=function(_0x4071a2,_0x46a311){return respondWithRpcPromise(_0x2022('0x45'),_0x4071a2['query'],routingClient)['then'](respondWithResult(_0x46a311,null))[_0x2022('0xd')](handleError(_0x46a311,null));};exports[_0x2022('0x46')]=function(_0x503695,_0x35023b){return respondWithRpcPromise(_0x2022('0x45'),_0x503695['query'],routingClient)[_0x2022('0x8')](findById(_0x503695['params']['id']))[_0x2022('0x8')](respondWithResult(_0x35023b,null))[_0x2022('0xd')](handleError(_0x35023b,null));};exports[_0x2022('0x47')]=function(_0xcf80ef,_0x36f918){return respondWithRpcPromise(_0x2022('0x48'),_0xcf80ef[_0x2022('0x16')],routingClient)[_0x2022('0x8')](respondWithResult(_0x36f918,null))[_0x2022('0xd')](handleError(_0x36f918,null));};exports['showMailQueues']=function(_0x2a613e,_0x28179f){return respondWithRpcPromise(_0x2022('0x48'),_0x2a613e[_0x2022('0x16')],routingClient)[_0x2022('0x8')](findById(_0x2a613e['params']['id']))[_0x2022('0x8')](respondWithResult(_0x28179f,null))['catch'](handleError(_0x28179f,null));};exports['mailAccounts']=function(_0x4fd348,_0x8d4a06){return respondWithRpcPromise(_0x2022('0x49'),_0x4fd348['query'],mailClient)[_0x2022('0x8')](respondWithResult(_0x8d4a06,null))[_0x2022('0xd')](handleError(_0x8d4a06,null));};exports[_0x2022('0x4a')]=function(_0x8677e7,_0x59f6e1){return respondWithRpcPromise('OpenchannelQueues',_0x8677e7['query'],routingClient)['then'](respondWithResult(_0x59f6e1,null))['catch'](handleError(_0x59f6e1,null));};exports[_0x2022('0x4b')]=function(_0x46c0e8,_0xe1c8e7){return respondWithRpcPromise(_0x2022('0x4c'),_0x46c0e8['query'],routingClient)[_0x2022('0x8')](findById(_0x46c0e8[_0x2022('0x19')]['id']))['then'](respondWithResult(_0xe1c8e7,null))[_0x2022('0xd')](handleError(_0xe1c8e7,null));};exports['smsQueues']=function(_0x580401,_0xc1972){return respondWithRpcPromise(_0x2022('0x4d'),_0x580401[_0x2022('0x16')],routingClient)['then'](respondWithResult(_0xc1972,null))['catch'](handleError(_0xc1972,null));};exports['showSmsQueues']=function(_0x6f8c7e,_0x4bb6f1){return respondWithRpcPromise(_0x2022('0x4d'),_0x6f8c7e[_0x2022('0x16')],routingClient)['then'](findById(_0x6f8c7e[_0x2022('0x19')]['id']))[_0x2022('0x8')](respondWithResult(_0x4bb6f1,null))[_0x2022('0xd')](handleError(_0x4bb6f1,null));};exports[_0x2022('0x4e')]=function(_0x3b30d4,_0x546d52){return respondWithRpcPromise(_0x2022('0x4f'),_0x3b30d4[_0x2022('0x16')],routingClient)[_0x2022('0x8')](respondWithResult(_0x546d52,null))['catch'](handleError(_0x546d52,null));};exports[_0x2022('0x50')]=function(_0x5d7c83,_0x4505f0){return respondWithRpcPromise(_0x2022('0x4f'),_0x5d7c83['query'],routingClient)[_0x2022('0x8')](findById(_0x5d7c83[_0x2022('0x19')]['id']))[_0x2022('0x8')](respondWithResult(_0x4505f0,null))[_0x2022('0xd')](handleError(_0x4505f0,null));};exports['faxAccounts']=function(_0x590221,_0x50d29c){return respondWithRpcPromise(_0x2022('0x51'),_0x590221[_0x2022('0x16')])[_0x2022('0x8')](respondWithResult(_0x50d29c,null))[_0x2022('0xd')](handleError(_0x50d29c,null));};exports[_0x2022('0x52')]=function(_0x5e34d7,_0x39049d){return respondWithRpcPromise(_0x2022('0x53'),_0x5e34d7['query'],routingClient)['then'](respondWithResult(_0x39049d,null))[_0x2022('0xd')](handleError(_0x39049d,null));};exports['mailQueuesWaitingInteractions']=function(_0x31f76e,_0x1d6171){return respondWithRpcPromise(_0x2022('0x54'),_0x31f76e[_0x2022('0x16')],routingClient)['then'](respondWithResult(_0x1d6171,null))[_0x2022('0xd')](handleError(_0x1d6171,null));};exports[_0x2022('0x55')]=function(_0xc8b5e5,_0x4fc017){return respondWithRpcPromise(_0x2022('0x56'),_0xc8b5e5[_0x2022('0x16')],routingClient)[_0x2022('0x8')](respondWithResult(_0x4fc017,null))[_0x2022('0xd')](handleError(_0x4fc017,null));};exports[_0x2022('0x57')]=function(_0x1f57b6,_0x3556e1){return respondWithRpcPromise(_0x2022('0x58'),_0x1f57b6[_0x2022('0x16')],routingClient)[_0x2022('0x8')](respondWithResult(_0x3556e1,null))[_0x2022('0xd')](handleError(_0x3556e1,null));};exports['faxQueuesWaitingInteractions']=function(_0x4a6e95,_0x4ff447){return respondWithRpcPromise(_0x2022('0x59'),_0x4a6e95['query'],routingClient)[_0x2022('0x8')](respondWithResult(_0x4ff447,null))[_0x2022('0xd')](handleError(_0x4ff447,null));};exports['queueNotify']=function(_0x32e23f){return function(_0x3375fe,_0xf35297){var _0x1c984e,_0x32f15c;var _0x42f89e=_[_0x2022('0x5a')](_0x32e23f);var _0xf814f5=_0x32e23f===_0x2022('0x5b')?_0x2022('0x5c'):'Account';return db[_0x42f89e+'Queue'][_0x2022('0x5d')]({'raw':!![],'where':{'id':_0x3375fe[_0x2022('0x19')]['id']}})[_0x2022('0x8')](function(_0x359a00){if(_['isNil'](_0x359a00)){throw new Error(_0x42f89e+'\x20Queue\x20not\x20found');}_0x1c984e=_0x359a00;return db[_0x42f89e+_0x2022('0x5e')][_0x2022('0x5d')]({'where':{'id':_0x3375fe[_0x2022('0x2d')][_0x2022('0x5f')]},'include':[{'model':db[_0x42f89e+_0x2022('0x60')],'as':_0x2022('0x60')},{'model':db[_0x42f89e+_0xf814f5],'as':_0x2022('0x61')}]});})[_0x2022('0x8')](function(_0x50c73a){if(_[_0x2022('0x12')](_0x50c73a)){throw new Error(_0x42f89e+_0x2022('0x62'));}_0x32f15c=_0x50c73a;return _0x50c73a[_0x2022('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2022('0x8')](function(){var _0x2868c4={'uniqueid':_0x32e23f+'.'+_0x32f15c['id']+'.'+_0x32f15c[_0x2022('0x60')]['id'],'FromUserId':_0x3375fe[_0x2022('0x2f')]['id'],'type':_0x2022('0x64')};_0x2868c4[_0x42f89e+_0x2022('0x65')]=_0x32f15c['id'];_0x2868c4[_0x42f89e+_0x2022('0x66')]=_0x32f15c['Interaction']['id'];_0x2868c4['From'+_0x42f89e+_0xf814f5+'Id']=_0x32f15c[_0x2022('0x61')]['id'];_0x2868c4['To'+_0x42f89e+_0x2022('0x67')]=_0x1c984e['id'];return db[_0x42f89e+_0x2022('0x68')][_0x2022('0x69')](_0x2868c4);})[_0x2022('0x8')](function(){return respondWithRpcPromise(_0x2022('0x6a'),{'channel':_0x32e23f,'interaction':_0x32f15c[_0x2022('0x60')],'message':_0x32f15c,'account':_0x32f15c[_0x2022('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2022('0x64'),'appdata':_0x1c984e[_0x2022('0x10')]+','+(_0x32f15c[_0x2022('0x61')]['queueTransferTimeout']||0x12c),'interval':_0x2022('0x6b')}]},routingClient);})[_0x2022('0x8')](respondWithResult(_0xf35297,null))[_0x2022('0xd')](handleError(_0xf35297,null));};};exports[_0x2022('0x6c')]=function(_0x1e2bd3,_0x8c79e3){var _0x5b6da7,_0x4855f9;if(_['isNil'](_0x1e2bd3[_0x2022('0x2d')][_0x2022('0x6d')])){throw new Error(_0x2022('0x6e'));}var _0x48b86c=_0x1e2bd3[_0x2022('0x2d')][_0x2022('0x6d')];var _0x152e7b=_[_0x2022('0x5a')](_0x48b86c);var _0x5ae9aa=_0x48b86c===_0x2022('0x5b')?_0x2022('0x5c'):'Account';return db[_0x2022('0x6f')][_0x2022('0x5d')]({'raw':!![],'where':{'id':_0x1e2bd3[_0x2022('0x19')]['id'],'role':_0x2022('0x3b')}})[_0x2022('0x8')](function(_0x5f2926){if(_[_0x2022('0x12')](_0x5f2926)){throw new Error('Agent\x20not\x20found');}_0x5b6da7=_0x5f2926;return db[_0x152e7b+_0x2022('0x5e')][_0x2022('0x5d')]({'where':{'id':_0x1e2bd3[_0x2022('0x2d')][_0x2022('0x5f')]},'include':[{'model':db[_0x152e7b+_0x2022('0x60')],'as':_0x2022('0x60')},{'model':db[_0x152e7b+_0x5ae9aa],'as':_0x2022('0x61')}]});})[_0x2022('0x8')](function(_0x8d75d2){if(_[_0x2022('0x12')](_0x8d75d2)){throw new Error(_0x152e7b+_0x2022('0x62'));}_0x4855f9=_0x8d75d2;return _0x8d75d2[_0x2022('0x63')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2c97ca={'uniqueid':_0x48b86c+'.'+_0x4855f9['id']+'.'+_0x4855f9[_0x2022('0x60')]['id'],'FromUserId':_0x1e2bd3[_0x2022('0x2f')]['id'],'type':_0x2022('0x64'),'ToUserId':_0x5b6da7['id']};_0x2c97ca[_0x152e7b+_0x2022('0x65')]=_0x4855f9['id'];_0x2c97ca[_0x152e7b+_0x2022('0x66')]=_0x4855f9[_0x2022('0x60')]['id'];_0x2c97ca['From'+_0x152e7b+_0x5ae9aa+'Id']=_0x4855f9['Account']['id'];return db[_0x152e7b+_0x2022('0x68')][_0x2022('0x69')](_0x2c97ca);})[_0x2022('0x8')](function(){return respondWithRpcPromise(_0x2022('0x6a'),{'channel':_0x48b86c,'interaction':_0x4855f9[_0x2022('0x60')],'message':_0x4855f9,'account':_0x4855f9['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2022('0x3b'),'appdata':_0x5b6da7['name']+','+(_0x4855f9[_0x2022('0x61')]['agentTransferTimeout']||0x12c),'interval':_0x2022('0x6b')}]},routingClient);})[_0x2022('0x8')](respondWithResult(_0x8c79e3,null))[_0x2022('0xd')](handleError(_0x8c79e3,null));}; \ No newline at end of file diff --git a/server/api/saAsset/index.js b/server/api/saAsset/index.js index 4096cf8..7d015af 100644 --- a/server/api/saAsset/index.js +++ b/server/api/saAsset/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f99=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/getSubscriptions','getSubscriptions','/:id','show','post','create','automaticSubscriptionInvoiceAlignment','/:id/automaticSubscriptionInvoice','automaticSubscriptionInvoice'];(function(_0x4f7e42,_0x436165){var _0x5bcdb9=function(_0x8f3bd5){while(--_0x8f3bd5){_0x4f7e42['push'](_0x4f7e42['shift']());}};_0x5bcdb9(++_0x436165);}(_0x4f99,0x157));var _0x94f9=function(_0x4d7988,_0x4c62e3){_0x4d7988=_0x4d7988-0x0;var _0x97e287=_0x4f99[_0x4d7988];return _0x97e287;};'use strict';var multer=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var path=require('path');var timeout=require(_0x94f9('0x2'));var express=require(_0x94f9('0x3'));var router=express[_0x94f9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x94f9('0x5'));var config=require(_0x94f9('0x6'));var controller=require('./saAsset.controller');router[_0x94f9('0x7')]('/',auth[_0x94f9('0x8')](),controller[_0x94f9('0x9')]);router[_0x94f9('0x7')](_0x94f9('0xa'),auth['isAuthenticated'](),controller[_0x94f9('0xb')]);router['get'](_0x94f9('0xc'),auth['isAuthenticated'](),controller[_0x94f9('0xd')]);router['get'](_0x94f9('0xe'),auth[_0x94f9('0x8')](),controller[_0x94f9('0xf')]);router[_0x94f9('0x10')]('/',auth[_0x94f9('0x8')](),controller[_0x94f9('0x11')]);router[_0x94f9('0x10')]('/:id/automaticSubscriptionInvoiceAlignment',auth[_0x94f9('0x8')](),controller[_0x94f9('0x12')]);router[_0x94f9('0x10')](_0x94f9('0x13'),auth[_0x94f9('0x8')](),controller[_0x94f9('0x14')]);router[_0x94f9('0x15')](_0x94f9('0xe'),auth[_0x94f9('0x8')](),controller[_0x94f9('0x16')]);router[_0x94f9('0x17')](_0x94f9('0xe'),auth[_0x94f9('0x8')](),controller[_0x94f9('0x18')]);module[_0x94f9('0x19')]=router; \ No newline at end of file +var _0xac9d=['show','post','create','automaticSubscriptionInvoiceAlignment','/:id/automaticSubscriptionInvoice','automaticSubscriptionInvoice','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./saAsset.controller','isAuthenticated','index','get','/describe','describe','/getSubscriptions','getSubscriptions','/:id'];(function(_0x2c16ab,_0xaa3f47){var _0x50d50c=function(_0x4bd914){while(--_0x4bd914){_0x2c16ab['push'](_0x2c16ab['shift']());}};_0x50d50c(++_0xaa3f47);}(_0xac9d,0x14d));var _0xdac9=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xac9d[_0x1bc0ae];return _0x501104;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var auth=require(_0xdac9('0x6'));var interaction=require(_0xdac9('0x7'));var config=require('../../config/environment');var controller=require(_0xdac9('0x8'));router['get']('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0xa')]);router[_0xdac9('0xb')](_0xdac9('0xc'),auth[_0xdac9('0x9')](),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0xb')](_0xdac9('0x10'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x11')]);router[_0xdac9('0x12')]('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0x13')]);router[_0xdac9('0x12')]('/:id/automaticSubscriptionInvoiceAlignment',auth[_0xdac9('0x9')](),controller[_0xdac9('0x14')]);router['post'](_0xdac9('0x15'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x16')]);router['put'](_0xdac9('0x10'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x17')]);router['delete']('/:id',auth[_0xdac9('0x9')](),controller[_0xdac9('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saAsset/saAsset.attributes.js b/server/api/saAsset/saAsset.attributes.js index 69a8759..a4a44c2 100644 --- a/server/api/saAsset/saAsset.attributes.js +++ b/server/api/saAsset/saAsset.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9ad=['\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DECIMAL','DATE','BOOLEAN','sequelize','exports','STRING','INTEGER','TEXT'];(function(_0x18c9bf,_0x46c593){var _0x22faa0=function(_0xebc362){while(--_0xebc362){_0x18c9bf['push'](_0x18c9bf['shift']());}};_0x22faa0(++_0x46c593);}(_0xe9ad,0x82));var _0xde9a=function(_0x73f87f,_0x2eb5c5){_0x73f87f=_0x73f87f-0x0;var _0x11899b=_0xe9ad[_0x73f87f];return _0x11899b;};'use strict';var Sequelize=require(_0xde9a('0x0'));module[_0xde9a('0x1')]={'companyName':{'type':Sequelize[_0xde9a('0x2')]},'companyId':{'type':Sequelize[_0xde9a('0x3')]},'productName':{'type':Sequelize[_0xde9a('0x4')],'allowNull':![]},'productCode':{'type':Sequelize[_0xde9a('0x2')],'allowNull':![]},'productDescription':{'type':Sequelize[_0xde9a('0x4')]('long')+_0xde9a('0x5')},'typeName':{'type':Sequelize[_0xde9a('0x2')]},'pricelistName':{'type':Sequelize[_0xde9a('0x4')]},'pricelistId':{'type':Sequelize[_0xde9a('0x4')]},'netPrice':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0xde9a('0x6')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0xde9a('0x6')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0xde9a('0x2')]},'note':{'type':Sequelize['TEXT']},'dateLastInvoice':{'type':Sequelize[_0xde9a('0x7')]},'dateNextInvoice':{'type':Sequelize[_0xde9a('0x7')]},'subscriptionId':{'type':Sequelize[_0xde9a('0x3')],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0xde9a('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0xde9a('0x3')],'allowNull':![]},'deleted':{'type':Sequelize[_0xde9a('0x8')]},'status':{'type':Sequelize[_0xde9a('0x2')]}}; \ No newline at end of file +var _0xeea4=['\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DECIMAL','DATE','BOOLEAN','sequelize','exports','STRING','INTEGER','TEXT','long'];(function(_0x2aaa7f,_0x5300a0){var _0x45804f=function(_0x121a3f){while(--_0x121a3f){_0x2aaa7f['push'](_0x2aaa7f['shift']());}};_0x45804f(++_0x5300a0);}(_0xeea4,0x19e));var _0x4eea=function(_0x13ca47,_0x3cbb9f){_0x13ca47=_0x13ca47-0x0;var _0x27a3aa=_0xeea4[_0x13ca47];return _0x27a3aa;};'use strict';var Sequelize=require(_0x4eea('0x0'));module[_0x4eea('0x1')]={'companyName':{'type':Sequelize[_0x4eea('0x2')]},'companyId':{'type':Sequelize[_0x4eea('0x3')]},'productName':{'type':Sequelize[_0x4eea('0x4')],'allowNull':![]},'productCode':{'type':Sequelize[_0x4eea('0x2')],'allowNull':![]},'productDescription':{'type':Sequelize[_0x4eea('0x4')](_0x4eea('0x5'))+_0x4eea('0x6')},'typeName':{'type':Sequelize['STRING']},'pricelistName':{'type':Sequelize[_0x4eea('0x4')]},'pricelistId':{'type':Sequelize['TEXT']},'netPrice':{'type':Sequelize[_0x4eea('0x7')](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0x4eea('0x7')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0x4eea('0x7')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4eea('0x4')]},'dateLastInvoice':{'type':Sequelize[_0x4eea('0x8')]},'dateNextInvoice':{'type':Sequelize['DATE']},'subscriptionId':{'type':Sequelize[_0x4eea('0x3')],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0x4eea('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0x4eea('0x3')],'allowNull':![]},'deleted':{'type':Sequelize[_0x4eea('0x9')]},'status':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/saAsset/saAsset.controller.js b/server/api/saAsset/saAsset.controller.js index 618cede..531382b 100644 --- a/server/api/saAsset/saAsset.controller.js +++ b/server/api/saAsset/saAsset.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','SAAsset','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','key','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','getSubscriptions','nolimit','CONCAT\x20(`companyName`,\x22\x20\x22,`pricelistName`,\x22\x20\x22,`subscriptionName`)\x20as\x20SubscriptionName,DATEDIFF\x20(`dateNextInvoice`,NOW())\x20as\x20Expired,`subscriptionId`,`companyName`,`companyId`,`pricelistName`,`pricelistId`,`subscriptionName`,`dateNextInvoice`,SUM(`netPrice`\x20-\x20(`netPrice`\x20/\x20100\x20*\x20`discount`))\x20as\x20TotalNetPrice,SUM((`netPrice`\x20-\x20(`netPrice`\x20/\x20100\x20*\x20`discount`))\x20/\x20100\x20*\x20`tax`)\x20as\x20TotalTax','companyName','companyId','pricelistName','pricelistId','subscriptionId','dateNextInvoice','automaticSubscriptionInvoiceAlignment','sequelize','transaction','findOne','DESC','forEach','log','automaticSubscriptionInvoice\x20productForCompany->','push','all','INFO','No\x20invoice.\x20Invoice\x20expired!!\x20','SequelizeUniqueConstraintError','??????\x20updSubscriptionDetail\x20product->','Partial','add','subscriptionMonthly','lastInvoice','nextInvoice','productName','productDescription','typeName','netPrice','discount','tax','System','note','subscriptionName','quantity','SAInvoiceDetail','CmCompany','SAPaymentMethod','saPaymentMethod','Invoice\x20','close','saCity','saCountry','saISOCode','saFiscalCode','saPIVA','saSDICode','saStreet','saPostalCode','saFiscalMessage','saSocCap','bankName','bankpostalCode','bankcountry','bankBICSWIFT','phone','fax','email','bankABI','banckCAB','paypalEmail','SAInvoice','productCode','groupBy','negate','isNull','mapValues','createdAt','value','TCL:\x20exports.automaticProformaInvoice\x20->\x20err','diff','diffDay','total','automaticSubscriptionInvoice','££££££££\x20products','Total','WARNING','No\x20product\x20to\x20assign\x20invoice.\x20Invoice\x20not\x20created!!\x20','Duplicate\x20entry.','html-pdf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xefda,0x96));var _0xaefd=function(_0x17fa42,_0x536f5f){_0x17fa42=_0x17fa42-0x0;var _0x14cd67=_0xefda[_0x17fa42];return _0x14cd67;};'use strict';var pdf=require(_0xaefd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaefd('0x1'));var jsonpatch=require(_0xaefd('0x2'));var rp=require('request-promise');var moment=require(_0xaefd('0x3'));var BPromise=require(_0xaefd('0x4'));var Mustache=require(_0xaefd('0x5'));var util=require(_0xaefd('0x6'));var path=require(_0xaefd('0x7'));var sox=require(_0xaefd('0x8'));var csv=require('to-csv');var ejs=require(_0xaefd('0x9'));var fs=require('fs');var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0xe'));var querystring=require(_0xaefd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var db=require(_0xaefd('0x16'))['db'];function respondWithStatusCode(_0x3dfddf,_0x27be0f){_0x27be0f=_0x27be0f||0xcc;return function(_0x382983){if(_0x382983){return _0x3dfddf[_0xaefd('0x17')](_0x27be0f);}return _0x3dfddf['status'](_0x27be0f)[_0xaefd('0x18')]();};}function respondWithResult(_0x4ac467,_0xd88c7c){_0xd88c7c=_0xd88c7c||0xc8;return function(_0x1725af){if(_0x1725af){return _0x4ac467[_0xaefd('0x19')](_0xd88c7c)[_0xaefd('0x1a')](_0x1725af);}};}function respondWithFilteredResult(_0x4ec92a,_0x16e4f4){return function(_0x13492c){if(_0x13492c){var _0x41f345=_0x13492c[_0xaefd('0x1b')],_0x411701=_0x16e4f4[_0xaefd('0x1c')],_0x10ee28=_0x16e4f4['offset']+_0x16e4f4[_0xaefd('0x1d')],_0x32f75e;if(_0x10ee28>=_0x41f345){_0x10ee28=_0x41f345;_0x32f75e=0xc8;}else{_0x32f75e=0xce;}_0x4ec92a[_0xaefd('0x19')](_0x32f75e);return _0x4ec92a[_0xaefd('0x1e')](_0xaefd('0x1f'),_0x411701+'-'+_0x10ee28+'/'+_0x41f345)[_0xaefd('0x1a')](_0x13492c);}return null;};}function patchUpdates(_0x244956){return function(_0x516e84){try{jsonpatch[_0xaefd('0x20')](_0x516e84,_0x244956,!![]);}catch(_0x182f9a){return BPromise[_0xaefd('0x21')](_0x182f9a);}return _0x516e84[_0xaefd('0x22')]();};}function saveUpdates(_0x45ebf2,_0x1f302c){return function(_0x5282ed){if(_0x5282ed){return _0x5282ed[_0xaefd('0x23')](_0x45ebf2)[_0xaefd('0x24')](function(_0x2dcdd8){return _0x2dcdd8;});}return null;};}function removeEntity(_0x3d9823,_0x2d490b){return function(_0x577fb7){if(_0x577fb7){return _0x577fb7['destroy']()['then'](function(){_0x3d9823[_0xaefd('0x19')](0xcc)[_0xaefd('0x18')]();});}};}function handleEntityNotFound(_0x313a6f,_0x5a44ed){return function(_0x23060f){if(!_0x23060f){_0x313a6f['sendStatus'](0x194);}return _0x23060f;};}function handleError(_0x3deec8,_0x3caa99){_0x3caa99=_0x3caa99||0x1f4;return function(_0x1a05eb){logger['error'](_0x1a05eb[_0xaefd('0x25')]);if(_0x1a05eb[_0xaefd('0x26')]){delete _0x1a05eb[_0xaefd('0x26')];}_0x3deec8[_0xaefd('0x19')](_0x3caa99)[_0xaefd('0x27')](_0x1a05eb);};}exports['index']=function(_0x2fe27e,_0x58c008){var _0x810bf={},_0x16f10f={},_0x5470bd={'count':0x0,'rows':[]};var _0x2b3d3d=db[_0xaefd('0x28')]['rawAttributes'];_0x16f10f[_0xaefd('0x29')]=_[_0xaefd('0x2a')](_0x2b3d3d);_0x16f10f[_0xaefd('0x2b')]=_['keys'](_0x2fe27e[_0xaefd('0x2b')]);_0x16f10f['filters']=_[_0xaefd('0x2c')](_0x16f10f['model'],_0x16f10f['query']);_0x810bf[_0xaefd('0x2d')]=_[_0xaefd('0x2c')](_0x16f10f['model'],qs['fields'](_0x2fe27e['query'][_0xaefd('0x2e')]));_0x810bf[_0xaefd('0x2d')]=_0x810bf['attributes']['length']?_0x810bf[_0xaefd('0x2d')]:_0x16f10f[_0xaefd('0x29')];if(!_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x2f')]('nolimit')){_0x810bf[_0xaefd('0x1d')]=qs[_0xaefd('0x1d')](_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x1d')]);_0x810bf[_0xaefd('0x1c')]=qs[_0xaefd('0x1c')](_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x1c')]);}_0x810bf[_0xaefd('0x30')]=qs[_0xaefd('0x31')](_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x31')]);_0x810bf[_0xaefd('0x32')]=qs[_0xaefd('0x33')](_[_0xaefd('0x34')](_0x2fe27e[_0xaefd('0x2b')],_0x16f10f['filters']));if(_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x35')]){_0x810bf[_0xaefd('0x32')]=_['merge'](_0x810bf[_0xaefd('0x32')],{'$or':_['map'](_0x2b3d3d,function(_0x187e76){if(_0x187e76[_0xaefd('0x36')][_0xaefd('0x37')]!==_0xaefd('0x38')){var _0x2c0d72={};_0x2c0d72[_0x187e76[_0xaefd('0x39')]]={'$like':'%'+_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x35')]+'%'};return _0x2c0d72;}})});}_0x810bf=_[_0xaefd('0x3a')]({},_0x810bf,_0x2fe27e[_0xaefd('0x3b')]);var _0x27e3d0={'where':_0x810bf[_0xaefd('0x32')]};return db[_0xaefd('0x28')][_0xaefd('0x1b')](_0x27e3d0)['then'](function(_0x1cfd6d){_0x5470bd['count']=_0x1cfd6d;if(_0x2fe27e[_0xaefd('0x2b')][_0xaefd('0x3c')]){_0x810bf[_0xaefd('0x3d')]=[{'all':!![]}];}return db[_0xaefd('0x28')][_0xaefd('0x3e')](_0x810bf);})[_0xaefd('0x24')](function(_0xa98181){_0x5470bd[_0xaefd('0x3f')]=_0xa98181;return _0x5470bd;})[_0xaefd('0x24')](respondWithFilteredResult(_0x58c008,_0x810bf))[_0xaefd('0x40')](handleError(_0x58c008,null));};exports['show']=function(_0x696af5,_0x3296ac){var _0x4dfea1={'raw':![],'where':{'id':_0x696af5[_0xaefd('0x41')]['id']}},_0x427f00={};_0x427f00[_0xaefd('0x29')]=_['keys'](db['SAAsset'][_0xaefd('0x42')]);_0x427f00[_0xaefd('0x2b')]=_[_0xaefd('0x2a')](_0x696af5[_0xaefd('0x2b')]);_0x427f00[_0xaefd('0x33')]=_[_0xaefd('0x2c')](_0x427f00[_0xaefd('0x29')],_0x427f00[_0xaefd('0x2b')]);_0x4dfea1['attributes']=_[_0xaefd('0x2c')](_0x427f00[_0xaefd('0x29')],qs[_0xaefd('0x2e')](_0x696af5[_0xaefd('0x2b')][_0xaefd('0x2e')]));_0x4dfea1[_0xaefd('0x2d')]=_0x4dfea1[_0xaefd('0x2d')][_0xaefd('0x43')]?_0x4dfea1['attributes']:_0x427f00['model'];if(_0x696af5[_0xaefd('0x2b')][_0xaefd('0x3c')]){_0x4dfea1['include']=[{'all':!![]}];}_0x4dfea1=_['merge']({},_0x4dfea1,_0x696af5[_0xaefd('0x3b')]);return db[_0xaefd('0x28')][_0xaefd('0x44')](_0x4dfea1)[_0xaefd('0x24')](handleEntityNotFound(_0x3296ac,null))[_0xaefd('0x24')](respondWithResult(_0x3296ac,null))[_0xaefd('0x40')](handleError(_0x3296ac,null));};exports[_0xaefd('0x45')]=function(_0x1c42fc,_0x332ebb){return db['SAAsset'][_0xaefd('0x45')](_0x1c42fc[_0xaefd('0x46')],{})[_0xaefd('0x24')](respondWithResult(_0x332ebb,0xc9))[_0xaefd('0x40')](handleError(_0x332ebb,null));};exports[_0xaefd('0x23')]=function(_0x2cb72f,_0xf54e83){if(_0x2cb72f['body']['id']){delete _0x2cb72f[_0xaefd('0x46')]['id'];}return db['SAAsset'][_0xaefd('0x44')]({'where':{'id':_0x2cb72f[_0xaefd('0x41')]['id']}})[_0xaefd('0x24')](handleEntityNotFound(_0xf54e83,null))[_0xaefd('0x24')](saveUpdates(_0x2cb72f['body'],null))['then'](respondWithResult(_0xf54e83,null))[_0xaefd('0x40')](handleError(_0xf54e83,null));};exports[_0xaefd('0x47')]=function(_0x179b8b,_0x4eeb56){return db[_0xaefd('0x28')][_0xaefd('0x44')]({'where':{'id':_0x179b8b['params']['id']}})[_0xaefd('0x24')](handleEntityNotFound(_0x4eeb56,null))[_0xaefd('0x24')](removeEntity(_0x4eeb56,null))[_0xaefd('0x40')](handleError(_0x4eeb56,null));};exports[_0xaefd('0x48')]=function(_0x398aee,_0xcdb133){return db[_0xaefd('0x28')][_0xaefd('0x48')]()['then'](respondWithResult(_0xcdb133,null))['catch'](handleError(_0xcdb133,null));};exports[_0xaefd('0x49')]=function(_0x2aad86,_0x578e0c){var _0x332743=qs['sort'](_0x2aad86[_0xaefd('0x2b')][_0xaefd('0x31')]);if(!_0x2aad86[_0xaefd('0x2b')][_0xaefd('0x2f')](_0xaefd('0x4a'))){var _0xf727cd=qs['limit'](_0x2aad86['query'][_0xaefd('0x1d')]);var _0x338823=qs['offset'](_0x2aad86[_0xaefd('0x2b')][_0xaefd('0x1c')]);}return db[_0xaefd('0x28')][_0xaefd('0x3e')]({'attributes':[db['sequelize']['literal'](_0xaefd('0x4b'))],'group':[_0xaefd('0x4c'),_0xaefd('0x4d'),_0xaefd('0x4e'),_0xaefd('0x4f'),'subscriptionName',_0xaefd('0x50'),_0xaefd('0x51')],'order':_0x332743,'limit':_0xf727cd,'offset':_0x338823,'raw':!![]})['then'](function(_0xbeca29){return{'count':_0xbeca29[_0xaefd('0x43')],'rows':_0xbeca29};})['then'](handleEntityNotFound(_0x578e0c,null))[_0xaefd('0x24')](respondWithResult(_0x578e0c,null))[_0xaefd('0x40')](handleError(_0x578e0c,null));};exports[_0xaefd('0x52')]=function(_0x4a5ddf,_0x444c05,_0x1a9842){var _0x584df3;if(_0x4a5ddf[_0xaefd('0x46')]['id']){delete _0x4a5ddf[_0xaefd('0x46')]['id'];}return db[_0xaefd('0x53')][_0xaefd('0x54')](function(_0x54382b){return db['CmCompany'][_0xaefd('0x55')]({'where':{'defaultEntry':0x1},'raw':!![]})[_0xaefd('0x24')](function(_0x4007d5){_0x584df3=_0x4007d5;return db[_0xaefd('0x28')][_0xaefd('0x3e')]({'where':{'dateLastInvoice':null,'deleted':null},'order':[[_0xaefd('0x4d'),_0xaefd('0x56')],[_0xaefd('0x4f'),_0xaefd('0x56')],[_0xaefd('0x50'),'DESC']],'raw':!![]});})['then'](function(_0x324eb4){if(_0x324eb4[_0xaefd('0x43')]>0x0){var _0x1682d8=[];var _0x36b151=_['groupBy'](_0x324eb4,_0xaefd('0x4d'));Object[_0xaefd('0x2a')](_0x36b151)[_0xaefd('0x57')](function(_0x1ad04e){var _0x16c227=_0x36b151[_0x1ad04e];console[_0xaefd('0x58')](_0xaefd('0x59'),_0x16c227);_0x1682d8[_0xaefd('0x5a')](addSubscriptionInvoice(_0x16c227,_0x584df3,_0x1ad04e,'Partial',_0x54382b));});return BPromise[_0xaefd('0x5b')](_0x1682d8);}else{var _0x3339e6={'errors':[{'type':_0xaefd('0x5c'),'message':_0xaefd('0x5d')}]};throw _0x3339e6;}});})['then'](function(){return _0x444c05[_0xaefd('0x17')](0xc8);})['catch'](function(_0xeb739){console[_0xaefd('0x58')]('TCL:\x20exports.automaticProformaInvoice\x20->\x20err',_0xeb739);if(_0xeb739['name']===_0xaefd('0x5e')){var _0xeb739={'errors':[{'message':'Duplicate\x20entry.'}]};}_0x444c05['status'](0x1f4)[_0xaefd('0x27')](_0xeb739);});};function updSubscriptionDetail(_0x2747b4,_0x27fcb4,_0xfe01f8){console[_0xaefd('0x58')](_0xaefd('0x5f'),_0x2747b4);console['log']('??????\x20invoiceType',_0x27fcb4);console['log']('??????\x20updSubscriptionDetail\x20product.id->',_0x2747b4['id']);console[_0xaefd('0x58')]('??????\x20updSubscriptionDetail\x20product.dateNextInvoice->',_0x2747b4[_0xaefd('0x51')]);var _0x481e3a;var _0x2fd43e;if(_0x27fcb4===_0xaefd('0x60')){_0x481e3a=moment();_0x2fd43e=_0x2747b4[_0xaefd('0x51')];}else{_0x481e3a=_0x2747b4[_0xaefd('0x51')];_0x2fd43e=moment(_0x2747b4[_0xaefd('0x51')])[_0xaefd('0x61')](_0x2747b4[_0xaefd('0x62')],'months');}console[_0xaefd('0x58')](_0xaefd('0x63'),_0x481e3a);console[_0xaefd('0x58')](_0xaefd('0x64'),_0x2fd43e);return db['SAAsset'][_0xaefd('0x23')]({'dateLastInvoice':_0x481e3a,'dateNextInvoice':_0x2fd43e,'agentFullname':'System'},{'where':{'id':_0x2747b4['id']},'raw':!![],'transaction':_0xfe01f8})[_0xaefd('0x40')](function(_0x40b493){throw _0x40b493;});}function addSubscriptionInvoiceDetail(_0x110379,_0x1f335d,_0x142fb1){var _0xa918d3={'companyName':_0x110379['companyName'],'companyId':_0x110379[_0xaefd('0x4d')],'productName':_0x110379[_0xaefd('0x65')],'productCode':_0x110379['productCode'],'productDescription':_0x110379[_0xaefd('0x66')],'typeName':_0x110379[_0xaefd('0x67')],'pricelistName':_0x110379['pricelistName'],'priceListId':_0x110379[_0xaefd('0x4f')],'netPrice':_0x110379[_0xaefd('0x68')],'discount':_0x110379[_0xaefd('0x69')],'tax':_0x110379[_0xaefd('0x6a')],'agentFullname':_0xaefd('0x6b'),'note':_0x110379[_0xaefd('0x6c')],'subscriptionId':_0x110379[_0xaefd('0x50')],'subscriptionName':_0x110379[_0xaefd('0x6d')],'subscriptionMonthly':_0x110379[_0xaefd('0x62')],'quantity':_0x110379[_0xaefd('0x6e')],'InvoiceId':_0x1f335d['id']};return db[_0xaefd('0x6f')][_0xaefd('0x45')](_0xa918d3,{'raw':!![],'transaction':_0x142fb1})[_0xaefd('0x40')](function(_0x43338b){throw _0x43338b;});}function addSubscriptionInvoice(_0x39a2eb,_0x93e875,_0x3e0836,_0x4f849b,_0x41dcbf){return db[_0xaefd('0x70')][_0xaefd('0x55')]({'where':{'id':_0x3e0836},'raw':!![]})['then'](function(_0x35f0a3){return db[_0xaefd('0x71')][_0xaefd('0x55')]({'where':{'id':_0x35f0a3[_0xaefd('0x72')]},'raw':!![]})['then'](function(_0x2db702){var _0x5b0e27={'name':_0xaefd('0x73')+moment()+'_'+_0x4f849b,'note':'Automatic\x20Job','agentFullname':_0xaefd('0x6b'),'status':_0xaefd('0x74'),'companyName':_0x35f0a3[_0xaefd('0x26')],'companyId':_0x35f0a3['id'],'paid':0x0,'discount':0x0,'receivingStreet':_0x35f0a3['saStreet'],'receivingPostalCode':_0x35f0a3['saPostalCode'],'receivingCity':_0x35f0a3[_0xaefd('0x75')],'receivingCountry':_0x35f0a3[_0xaefd('0x76')],'receivingISOCode':_0x35f0a3[_0xaefd('0x77')],'receivingFiscalCode':_0x35f0a3[_0xaefd('0x78')],'receivingPIVA':_0x35f0a3[_0xaefd('0x79')],'receivingSDICode':_0x35f0a3[_0xaefd('0x7a')],'receivingFiscalMessage':_0x35f0a3['saFiscalMessage'],'receivingExpiryDay':_0x35f0a3['saExpiryDay'],'receivingEurope':_0x35f0a3['saEurope'],'receivingSocCap':_0x35f0a3['saSocCap'],'issuerName':_0x93e875['name'],'issuerStreet':_0x93e875[_0xaefd('0x7b')],'issuerPostalCode':_0x93e875[_0xaefd('0x7c')],'issuerCity':_0x93e875[_0xaefd('0x75')],'issuerCountry':_0x93e875[_0xaefd('0x76')],'issuerISOCode':_0x93e875['saISOCode'],'issuerFiscalCode':_0x93e875[_0xaefd('0x78')],'issuerPIVA':_0x93e875[_0xaefd('0x79')],'issuerSDICode':_0x93e875['saSDICode'],'issuerFiscalMessage':_0x93e875[_0xaefd('0x7d')],'issuerExpiryDay':_0x93e875['saExpiryDay'],'issuerSocCap':_0x93e875[_0xaefd('0x7e')],'issuerBankAccount':_0x2db702['bankAccount'],'issuerBankName':_0x2db702[_0xaefd('0x7f')],'issuerBankStreet':_0x2db702['bankstreet'],'issuerBankPostalCode':_0x2db702[_0xaefd('0x80')],'issuerBankCity':_0x2db702['bankcity'],'issuerBankCountry':_0x2db702[_0xaefd('0x81')],'issuerBankBICSWIFT':_0x2db702[_0xaefd('0x82')],'issuerBankIBAN':_0x2db702['bankIBAN'],'issuerPhone':_0x93e875[_0xaefd('0x83')],'issuerFax':_0x93e875[_0xaefd('0x84')],'issuerEmail':_0x93e875[_0xaefd('0x85')],'issuerWeb':_0x93e875['website'],'issuerABI':_0x2db702[_0xaefd('0x86')],'issuerCAB':_0x2db702[_0xaefd('0x87')],'issuerPayPal':_0x2db702[_0xaefd('0x88')]};return db[_0xaefd('0x89')][_0xaefd('0x45')](_0x5b0e27,{'transaction':_0x41dcbf})['then'](function(_0x191a38){var _0x315fe1=[];for(var _0x4ebd3e=0x0;_0x4ebd3e<_0x39a2eb[_0xaefd('0x43')];_0x4ebd3e++){_0x315fe1[_0xaefd('0x5a')](updSubscriptionDetail(_0x39a2eb[_0x4ebd3e],_0x4f849b,_0x41dcbf));}var _0x1298e4=[_0xaefd('0x8a'),'pricelistId',_0xaefd('0x50'),'netPrice'];_(_0x39a2eb)[_0xaefd('0x8b')](function(_0x1bbeec){return _[_0xaefd('0x44')](_['pick'](_0x1bbeec,_0x1298e4),_[_0xaefd('0x8c')](_[_0xaefd('0x8d')]));})[_0xaefd('0x8e')](function(_0x5afbda){var _0x1ed6d9=_0x5afbda[0x0];_0x1ed6d9[_0xaefd('0x6e')]=_0x5afbda[_0xaefd('0x43')];if(_0x4f849b===_0xaefd('0x60')){_0x1ed6d9['netPrice']=computePrice(_0x1ed6d9[_0xaefd('0x8f')],_0x1ed6d9[_0xaefd('0x51')],_0x1ed6d9[_0xaefd('0x68')],_0x1ed6d9[_0xaefd('0x62')]);}_0x315fe1['push'](addSubscriptionInvoiceDetail(_0x1ed6d9,_0x191a38,_0x41dcbf));})[_0xaefd('0x90')]();return BPromise[_0xaefd('0x5b')](_0x315fe1);});});})[_0xaefd('0x40')](function(_0x206474){console['log'](_0xaefd('0x91'),_0x206474);throw _0x206474;});}function computePrice(_0x4b6ea9,_0x35ab26,_0x5e0aaf,_0x163914){var _0x2991f3=_0x5e0aaf;console[_0xaefd('0x58')](_0xaefd('0x8f'),_0x4b6ea9);console[_0xaefd('0x58')]('dateNextInvoice',_0x35ab26);console[_0xaefd('0x58')]('subscriptionMonthly',_0x163914);console[_0xaefd('0x58')]('netPrice',_0x5e0aaf);if(_0x163914!=0x0){var _0x2164a3=moment(_0x4b6ea9);var _0x1c63ad=moment(_0x35ab26);var _0x288421=Math['abs'](_0x2164a3[_0xaefd('0x92')](_0x1c63ad,'days'));console[_0xaefd('0x58')](_0xaefd('0x93'),_0x288421);var _0xe247e4=_0x5e0aaf/(0x1e*_0x163914);console[_0xaefd('0x58')]('dayPrice',_0xe247e4);_0x2991f3=_0xe247e4*_0x288421;}console[_0xaefd('0x58')](_0xaefd('0x94'),_0x2991f3);return _0x2991f3;}exports[_0xaefd('0x95')]=function(_0x407c6a,_0x117019,_0x235f49){var _0x1ec569;if(_0x407c6a[_0xaefd('0x46')]['id']){delete _0x407c6a[_0xaefd('0x46')]['id'];}return db['sequelize'][_0xaefd('0x54')](function(_0x3539f0){return db[_0xaefd('0x70')][_0xaefd('0x55')]({'where':{'defaultEntry':0x1},'raw':!![]})[_0xaefd('0x24')](function(_0x3126f4){_0x1ec569=_0x3126f4;return db[_0xaefd('0x28')][_0xaefd('0x3e')]({'where':{'dateNextInvoice':{'$lt':moment()},'subscriptionMonthly':{'$ne':0x0},'deleted':null},'order':[[_0xaefd('0x4d'),_0xaefd('0x56')],[_0xaefd('0x4f'),_0xaefd('0x56')],[_0xaefd('0x50'),_0xaefd('0x56')]],'raw':!![]});})[_0xaefd('0x24')](function(_0x4db4b0){console['log'](_0xaefd('0x96'),_0x4db4b0);if(_0x4db4b0[_0xaefd('0x43')]>0x0){var _0x48e33f=[];var _0x24c994=_[_0xaefd('0x8b')](_0x4db4b0,_0xaefd('0x4d'));Object[_0xaefd('0x2a')](_0x24c994)[_0xaefd('0x57')](function(_0x128a26){var _0x56d2f0=_0x24c994[_0x128a26];console[_0xaefd('0x58')](_0xaefd('0x59'),_0x56d2f0);_0x48e33f[_0xaefd('0x5a')](addSubscriptionInvoice(_0x56d2f0,_0x1ec569,_0x128a26,_0xaefd('0x97'),_0x3539f0));});return BPromise['all'](_0x48e33f);}else{var _0x44180e={'errors':[{'type':_0xaefd('0x98'),'message':_0xaefd('0x99')}]};throw _0x44180e;}});})[_0xaefd('0x24')](function(){return _0x117019['sendStatus'](0xc8);})[_0xaefd('0x40')](function(_0x169cb3){console['log'](_0xaefd('0x91'),_0x169cb3);if(_0x169cb3[_0xaefd('0x26')]==='SequelizeUniqueConstraintError'){var _0x169cb3={'errors':[{'message':_0xaefd('0x9a')}]};}_0x117019[_0xaefd('0x19')](0x1f4)['send'](_0x169cb3);});}; \ No newline at end of file +var _0xbdb7=['value','days','diffDay','dayPrice','total','££££££££\x20products','WARNING','No\x20product\x20to\x20assign\x20invoice.\x20Invoice\x20not\x20created!!\x20','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','name','send','index','SAAsset','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','map','type','key','VIRTUAL','field','include','findAll','rows','catch','show','includeAll','options','create','body','update','find','params','describe','getSubscriptions','sort','CONCAT\x20(`companyName`,\x22\x20\x22,`pricelistName`,\x22\x20\x22,`subscriptionName`)\x20as\x20SubscriptionName,DATEDIFF\x20(`dateNextInvoice`,NOW())\x20as\x20Expired,`subscriptionId`,`companyName`,`companyId`,`pricelistName`,`pricelistId`,`subscriptionName`,`dateNextInvoice`,SUM(`netPrice`\x20-\x20(`netPrice`\x20/\x20100\x20*\x20`discount`))\x20as\x20TotalNetPrice,SUM((`netPrice`\x20-\x20(`netPrice`\x20/\x20100\x20*\x20`discount`))\x20/\x20100\x20*\x20`tax`)\x20as\x20TotalTax','pricelistName','pricelistId','subscriptionName','subscriptionId','automaticSubscriptionInvoiceAlignment','sequelize','transaction','CmCompany','companyId','DESC','groupBy','forEach','log','automaticSubscriptionInvoice\x20productForCompany->','push','all','No\x20invoice.\x20Invoice\x20expired!!\x20','TCL:\x20exports.automaticProformaInvoice\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','??????\x20updSubscriptionDetail\x20product->','??????\x20updSubscriptionDetail\x20product.id->','??????\x20updSubscriptionDetail\x20product.dateNextInvoice->','dateNextInvoice','Partial','add','subscriptionMonthly','nextInvoice','System','companyName','productName','productCode','typeName','netPrice','tax','note','findOne','SAPaymentMethod','saPaymentMethod','Automatic\x20Job','close','saStreet','saPostalCode','saCity','saCountry','saISOCode','saSDICode','saFiscalMessage','saEurope','saSocCap','saPIVA','bankName','bankpostalCode','bankcity','bankcountry','bankBICSWIFT','phone','fax','website','bankABI','paypalEmail','SAInvoice','pick','negate','isNull','mapValues','quantity','createdAt'];(function(_0x3c1199,_0x40e349){var _0x48196f=function(_0x3106d5){while(--_0x3106d5){_0x3c1199['push'](_0x3c1199['shift']());}};_0x48196f(++_0x40e349);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x335e20,_0x3b998c){_0x335e20=_0x335e20-0x0;var _0x410b0f=_0xbdb7[_0x335e20];return _0x410b0f;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var hardwareService=require(_0x7bdb('0x12'));var logger=require(_0x7bdb('0x13'))(_0x7bdb('0x14'));var utils=require(_0x7bdb('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b9b9,_0x3053d0){_0x3053d0=_0x3053d0||0xcc;return function(_0x25e3cb){if(_0x25e3cb){return _0x52b9b9['sendStatus'](_0x3053d0);}return _0x52b9b9[_0x7bdb('0x16')](_0x3053d0)['end']();};}function respondWithResult(_0x5898c1,_0x2abca6){_0x2abca6=_0x2abca6||0xc8;return function(_0x46dd4a){if(_0x46dd4a){return _0x5898c1['status'](_0x2abca6)['json'](_0x46dd4a);}};}function respondWithFilteredResult(_0x4e98f7,_0x4476ff){return function(_0x195b2e){if(_0x195b2e){var _0xe9919f=_0x195b2e[_0x7bdb('0x17')],_0x25d417=_0x4476ff[_0x7bdb('0x18')],_0x31c909=_0x4476ff['offset']+_0x4476ff[_0x7bdb('0x19')],_0xbde12a;if(_0x31c909>=_0xe9919f){_0x31c909=_0xe9919f;_0xbde12a=0xc8;}else{_0xbde12a=0xce;}_0x4e98f7[_0x7bdb('0x16')](_0xbde12a);return _0x4e98f7[_0x7bdb('0x1a')](_0x7bdb('0x1b'),_0x25d417+'-'+_0x31c909+'/'+_0xe9919f)['json'](_0x195b2e);}return null;};}function patchUpdates(_0x41f540){return function(_0x23e9eb){try{jsonpatch['apply'](_0x23e9eb,_0x41f540,!![]);}catch(_0x3e5f8e){return BPromise[_0x7bdb('0x1c')](_0x3e5f8e);}return _0x23e9eb[_0x7bdb('0x1d')]();};}function saveUpdates(_0x45d552,_0x112793){return function(_0x5bfc35){if(_0x5bfc35){return _0x5bfc35['update'](_0x45d552)[_0x7bdb('0x1e')](function(_0xcb25f2){return _0xcb25f2;});}return null;};}function removeEntity(_0x5daea4,_0x341fe4){return function(_0x118ea1){if(_0x118ea1){return _0x118ea1[_0x7bdb('0x1f')]()[_0x7bdb('0x1e')](function(){_0x5daea4[_0x7bdb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d37ac,_0xdad53d){return function(_0x40c447){if(!_0x40c447){_0x1d37ac[_0x7bdb('0x20')](0x194);}return _0x40c447;};}function handleError(_0x481f4b,_0x4d6e44){_0x4d6e44=_0x4d6e44||0x1f4;return function(_0x3c423f){logger['error'](_0x3c423f['stack']);if(_0x3c423f['name']){delete _0x3c423f[_0x7bdb('0x21')];}_0x481f4b['status'](_0x4d6e44)[_0x7bdb('0x22')](_0x3c423f);};}exports[_0x7bdb('0x23')]=function(_0x3ec129,_0x7c09cf){var _0x2a494e={},_0x523869={},_0x10e818={'count':0x0,'rows':[]};var _0x32242d=db[_0x7bdb('0x24')][_0x7bdb('0x25')];_0x523869[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](_0x32242d);_0x523869[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x3ec129[_0x7bdb('0x28')]);_0x523869[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],_0x523869['query']);_0x2a494e[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],qs[_0x7bdb('0x2c')](_0x3ec129[_0x7bdb('0x28')]['fields']));_0x2a494e[_0x7bdb('0x2b')]=_0x2a494e[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2a494e[_0x7bdb('0x2b')]:_0x523869['model'];if(!_0x3ec129['query']['hasOwnProperty'](_0x7bdb('0x2e'))){_0x2a494e['limit']=qs[_0x7bdb('0x19')](_0x3ec129['query'][_0x7bdb('0x19')]);_0x2a494e[_0x7bdb('0x18')]=qs[_0x7bdb('0x18')](_0x3ec129['query'][_0x7bdb('0x18')]);}_0x2a494e['order']=qs['sort'](_0x3ec129[_0x7bdb('0x28')]['sort']);_0x2a494e[_0x7bdb('0x2f')]=qs['filters'](_['pick'](_0x3ec129[_0x7bdb('0x28')],_0x523869[_0x7bdb('0x29')]));if(_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]){_0x2a494e[_0x7bdb('0x2f')]=_[_0x7bdb('0x31')](_0x2a494e['where'],{'$or':_[_0x7bdb('0x32')](_0x32242d,function(_0x464fde){if(_0x464fde[_0x7bdb('0x33')][_0x7bdb('0x34')]!==_0x7bdb('0x35')){var _0x14c522={};_0x14c522[_0x464fde[_0x7bdb('0x36')]]={'$like':'%'+_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]+'%'};return _0x14c522;}})});}_0x2a494e=_['merge']({},_0x2a494e,_0x3ec129['options']);var _0x19c237={'where':_0x2a494e[_0x7bdb('0x2f')]};return db[_0x7bdb('0x24')][_0x7bdb('0x17')](_0x19c237)[_0x7bdb('0x1e')](function(_0x509e90){_0x10e818['count']=_0x509e90;if(_0x3ec129[_0x7bdb('0x28')]['includeAll']){_0x2a494e[_0x7bdb('0x37')]=[{'all':!![]}];}return db['SAAsset'][_0x7bdb('0x38')](_0x2a494e);})['then'](function(_0x4cf3fa){_0x10e818[_0x7bdb('0x39')]=_0x4cf3fa;return _0x10e818;})[_0x7bdb('0x1e')](respondWithFilteredResult(_0x7c09cf,_0x2a494e))[_0x7bdb('0x3a')](handleError(_0x7c09cf,null));};exports[_0x7bdb('0x3b')]=function(_0x43c7d3,_0x2b4829){var _0x2e10f3={'raw':![],'where':{'id':_0x43c7d3['params']['id']}},_0x501aff={};_0x501aff[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](db[_0x7bdb('0x24')][_0x7bdb('0x25')]);_0x501aff[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x43c7d3[_0x7bdb('0x28')]);_0x501aff['filters']=_['intersection'](_0x501aff[_0x7bdb('0x26')],_0x501aff[_0x7bdb('0x28')]);_0x2e10f3[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x501aff['model'],qs[_0x7bdb('0x2c')](_0x43c7d3['query'][_0x7bdb('0x2c')]));_0x2e10f3[_0x7bdb('0x2b')]=_0x2e10f3[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2e10f3[_0x7bdb('0x2b')]:_0x501aff[_0x7bdb('0x26')];if(_0x43c7d3[_0x7bdb('0x28')][_0x7bdb('0x3c')]){_0x2e10f3[_0x7bdb('0x37')]=[{'all':!![]}];}_0x2e10f3=_['merge']({},_0x2e10f3,_0x43c7d3[_0x7bdb('0x3d')]);return db[_0x7bdb('0x24')]['find'](_0x2e10f3)[_0x7bdb('0x1e')](handleEntityNotFound(_0x2b4829,null))['then'](respondWithResult(_0x2b4829,null))[_0x7bdb('0x3a')](handleError(_0x2b4829,null));};exports[_0x7bdb('0x3e')]=function(_0x122beb,_0x3a8415){return db[_0x7bdb('0x24')]['create'](_0x122beb[_0x7bdb('0x3f')],{})[_0x7bdb('0x1e')](respondWithResult(_0x3a8415,0xc9))[_0x7bdb('0x3a')](handleError(_0x3a8415,null));};exports[_0x7bdb('0x40')]=function(_0x31244f,_0x5021cd){if(_0x31244f[_0x7bdb('0x3f')]['id']){delete _0x31244f[_0x7bdb('0x3f')]['id'];}return db[_0x7bdb('0x24')][_0x7bdb('0x41')]({'where':{'id':_0x31244f[_0x7bdb('0x42')]['id']}})[_0x7bdb('0x1e')](handleEntityNotFound(_0x5021cd,null))[_0x7bdb('0x1e')](saveUpdates(_0x31244f[_0x7bdb('0x3f')],null))[_0x7bdb('0x1e')](respondWithResult(_0x5021cd,null))[_0x7bdb('0x3a')](handleError(_0x5021cd,null));};exports['destroy']=function(_0x189cf8,_0x58c4bc){return db['SAAsset'][_0x7bdb('0x41')]({'where':{'id':_0x189cf8[_0x7bdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x58c4bc,null))[_0x7bdb('0x1e')](removeEntity(_0x58c4bc,null))[_0x7bdb('0x3a')](handleError(_0x58c4bc,null));};exports['describe']=function(_0x54ac12,_0x4edd0d){return db[_0x7bdb('0x24')][_0x7bdb('0x43')]()[_0x7bdb('0x1e')](respondWithResult(_0x4edd0d,null))[_0x7bdb('0x3a')](handleError(_0x4edd0d,null));};exports[_0x7bdb('0x44')]=function(_0x24b7b8,_0x28b5e5){var _0x2cae2e=qs[_0x7bdb('0x45')](_0x24b7b8[_0x7bdb('0x28')]['sort']);if(!_0x24b7b8[_0x7bdb('0x28')]['hasOwnProperty'](_0x7bdb('0x2e'))){var _0x27358d=qs[_0x7bdb('0x19')](_0x24b7b8[_0x7bdb('0x28')]['limit']);var _0x258f29=qs['offset'](_0x24b7b8['query'][_0x7bdb('0x18')]);}return db[_0x7bdb('0x24')]['findAll']({'attributes':[db['sequelize']['literal'](_0x7bdb('0x46'))],'group':['companyName','companyId',_0x7bdb('0x47'),_0x7bdb('0x48'),_0x7bdb('0x49'),_0x7bdb('0x4a'),'dateNextInvoice'],'order':_0x2cae2e,'limit':_0x27358d,'offset':_0x258f29,'raw':!![]})[_0x7bdb('0x1e')](function(_0x4c5c8c){return{'count':_0x4c5c8c[_0x7bdb('0x2d')],'rows':_0x4c5c8c};})[_0x7bdb('0x1e')](handleEntityNotFound(_0x28b5e5,null))[_0x7bdb('0x1e')](respondWithResult(_0x28b5e5,null))[_0x7bdb('0x3a')](handleError(_0x28b5e5,null));};exports[_0x7bdb('0x4b')]=function(_0x9beb5c,_0x52d90e,_0x40d3b5){var _0x3022ee;if(_0x9beb5c[_0x7bdb('0x3f')]['id']){delete _0x9beb5c['body']['id'];}return db[_0x7bdb('0x4c')][_0x7bdb('0x4d')](function(_0x4d813f){return db[_0x7bdb('0x4e')]['findOne']({'where':{'defaultEntry':0x1},'raw':!![]})[_0x7bdb('0x1e')](function(_0xc3a0cb){_0x3022ee=_0xc3a0cb;return db['SAAsset']['findAll']({'where':{'dateLastInvoice':null,'deleted':null},'order':[[_0x7bdb('0x4f'),_0x7bdb('0x50')],['pricelistId',_0x7bdb('0x50')],['subscriptionId',_0x7bdb('0x50')]],'raw':!![]});})['then'](function(_0x496cc3){if(_0x496cc3[_0x7bdb('0x2d')]>0x0){var _0x2d4b59=[];var _0x19bb3f=_[_0x7bdb('0x51')](_0x496cc3,_0x7bdb('0x4f'));Object[_0x7bdb('0x27')](_0x19bb3f)[_0x7bdb('0x52')](function(_0x8cf13a){var _0x3aac96=_0x19bb3f[_0x8cf13a];console[_0x7bdb('0x53')](_0x7bdb('0x54'),_0x3aac96);_0x2d4b59[_0x7bdb('0x55')](addSubscriptionInvoice(_0x3aac96,_0x3022ee,_0x8cf13a,'Partial',_0x4d813f));});return BPromise[_0x7bdb('0x56')](_0x2d4b59);}else{var _0x2d6234={'errors':[{'type':'INFO','message':_0x7bdb('0x57')}]};throw _0x2d6234;}});})[_0x7bdb('0x1e')](function(){return _0x52d90e[_0x7bdb('0x20')](0xc8);})[_0x7bdb('0x3a')](function(_0x85c7b8){console['log'](_0x7bdb('0x58'),_0x85c7b8);if(_0x85c7b8[_0x7bdb('0x21')]===_0x7bdb('0x59')){var _0x85c7b8={'errors':[{'message':_0x7bdb('0x5a')}]};}_0x52d90e[_0x7bdb('0x16')](0x1f4)[_0x7bdb('0x22')](_0x85c7b8);});};function updSubscriptionDetail(_0x11ec61,_0x30d069,_0x364385){console[_0x7bdb('0x53')](_0x7bdb('0x5b'),_0x11ec61);console[_0x7bdb('0x53')]('??????\x20invoiceType',_0x30d069);console[_0x7bdb('0x53')](_0x7bdb('0x5c'),_0x11ec61['id']);console[_0x7bdb('0x53')](_0x7bdb('0x5d'),_0x11ec61[_0x7bdb('0x5e')]);var _0xc83f14;var _0x22aa65;if(_0x30d069===_0x7bdb('0x5f')){_0xc83f14=moment();_0x22aa65=_0x11ec61[_0x7bdb('0x5e')];}else{_0xc83f14=_0x11ec61[_0x7bdb('0x5e')];_0x22aa65=moment(_0x11ec61[_0x7bdb('0x5e')])[_0x7bdb('0x60')](_0x11ec61[_0x7bdb('0x61')],'months');}console[_0x7bdb('0x53')]('lastInvoice',_0xc83f14);console[_0x7bdb('0x53')](_0x7bdb('0x62'),_0x22aa65);return db[_0x7bdb('0x24')]['update']({'dateLastInvoice':_0xc83f14,'dateNextInvoice':_0x22aa65,'agentFullname':_0x7bdb('0x63')},{'where':{'id':_0x11ec61['id']},'raw':!![],'transaction':_0x364385})[_0x7bdb('0x3a')](function(_0x4ebc9f){throw _0x4ebc9f;});}function addSubscriptionInvoiceDetail(_0x3b4736,_0x1f9024,_0x5b3105){var _0x1c4525={'companyName':_0x3b4736[_0x7bdb('0x64')],'companyId':_0x3b4736['companyId'],'productName':_0x3b4736[_0x7bdb('0x65')],'productCode':_0x3b4736[_0x7bdb('0x66')],'productDescription':_0x3b4736['productDescription'],'typeName':_0x3b4736[_0x7bdb('0x67')],'pricelistName':_0x3b4736[_0x7bdb('0x47')],'priceListId':_0x3b4736['pricelistId'],'netPrice':_0x3b4736[_0x7bdb('0x68')],'discount':_0x3b4736['discount'],'tax':_0x3b4736[_0x7bdb('0x69')],'agentFullname':_0x7bdb('0x63'),'note':_0x3b4736[_0x7bdb('0x6a')],'subscriptionId':_0x3b4736[_0x7bdb('0x4a')],'subscriptionName':_0x3b4736[_0x7bdb('0x49')],'subscriptionMonthly':_0x3b4736['subscriptionMonthly'],'quantity':_0x3b4736['quantity'],'InvoiceId':_0x1f9024['id']};return db['SAInvoiceDetail'][_0x7bdb('0x3e')](_0x1c4525,{'raw':!![],'transaction':_0x5b3105})['catch'](function(_0x242a35){throw _0x242a35;});}function addSubscriptionInvoice(_0x1a1979,_0x139f4e,_0x57d36d,_0x509531,_0x26cde0){return db[_0x7bdb('0x4e')][_0x7bdb('0x6b')]({'where':{'id':_0x57d36d},'raw':!![]})[_0x7bdb('0x1e')](function(_0x572cbe){return db[_0x7bdb('0x6c')][_0x7bdb('0x6b')]({'where':{'id':_0x572cbe[_0x7bdb('0x6d')]},'raw':!![]})[_0x7bdb('0x1e')](function(_0x48ee68){var _0x381326={'name':'Invoice\x20'+moment()+'_'+_0x509531,'note':_0x7bdb('0x6e'),'agentFullname':'System','status':_0x7bdb('0x6f'),'companyName':_0x572cbe['name'],'companyId':_0x572cbe['id'],'paid':0x0,'discount':0x0,'receivingStreet':_0x572cbe[_0x7bdb('0x70')],'receivingPostalCode':_0x572cbe[_0x7bdb('0x71')],'receivingCity':_0x572cbe[_0x7bdb('0x72')],'receivingCountry':_0x572cbe[_0x7bdb('0x73')],'receivingISOCode':_0x572cbe[_0x7bdb('0x74')],'receivingFiscalCode':_0x572cbe['saFiscalCode'],'receivingPIVA':_0x572cbe['saPIVA'],'receivingSDICode':_0x572cbe[_0x7bdb('0x75')],'receivingFiscalMessage':_0x572cbe[_0x7bdb('0x76')],'receivingExpiryDay':_0x572cbe['saExpiryDay'],'receivingEurope':_0x572cbe[_0x7bdb('0x77')],'receivingSocCap':_0x572cbe[_0x7bdb('0x78')],'issuerName':_0x139f4e['name'],'issuerStreet':_0x139f4e[_0x7bdb('0x70')],'issuerPostalCode':_0x139f4e[_0x7bdb('0x71')],'issuerCity':_0x139f4e['saCity'],'issuerCountry':_0x139f4e[_0x7bdb('0x73')],'issuerISOCode':_0x139f4e['saISOCode'],'issuerFiscalCode':_0x139f4e['saFiscalCode'],'issuerPIVA':_0x139f4e[_0x7bdb('0x79')],'issuerSDICode':_0x139f4e[_0x7bdb('0x75')],'issuerFiscalMessage':_0x139f4e['saFiscalMessage'],'issuerExpiryDay':_0x139f4e['saExpiryDay'],'issuerSocCap':_0x139f4e[_0x7bdb('0x78')],'issuerBankAccount':_0x48ee68['bankAccount'],'issuerBankName':_0x48ee68[_0x7bdb('0x7a')],'issuerBankStreet':_0x48ee68['bankstreet'],'issuerBankPostalCode':_0x48ee68[_0x7bdb('0x7b')],'issuerBankCity':_0x48ee68[_0x7bdb('0x7c')],'issuerBankCountry':_0x48ee68[_0x7bdb('0x7d')],'issuerBankBICSWIFT':_0x48ee68[_0x7bdb('0x7e')],'issuerBankIBAN':_0x48ee68['bankIBAN'],'issuerPhone':_0x139f4e[_0x7bdb('0x7f')],'issuerFax':_0x139f4e[_0x7bdb('0x80')],'issuerEmail':_0x139f4e['email'],'issuerWeb':_0x139f4e[_0x7bdb('0x81')],'issuerABI':_0x48ee68[_0x7bdb('0x82')],'issuerCAB':_0x48ee68['banckCAB'],'issuerPayPal':_0x48ee68[_0x7bdb('0x83')]};return db[_0x7bdb('0x84')][_0x7bdb('0x3e')](_0x381326,{'transaction':_0x26cde0})[_0x7bdb('0x1e')](function(_0x521d68){var _0x324285=[];for(var _0x5af736=0x0;_0x5af736<_0x1a1979[_0x7bdb('0x2d')];_0x5af736++){_0x324285[_0x7bdb('0x55')](updSubscriptionDetail(_0x1a1979[_0x5af736],_0x509531,_0x26cde0));}var _0x3dd0b0=['productCode',_0x7bdb('0x48'),_0x7bdb('0x4a'),_0x7bdb('0x68')];_(_0x1a1979)[_0x7bdb('0x51')](function(_0xc444ef){return _[_0x7bdb('0x41')](_[_0x7bdb('0x85')](_0xc444ef,_0x3dd0b0),_[_0x7bdb('0x86')](_[_0x7bdb('0x87')]));})[_0x7bdb('0x88')](function(_0x3cacbf){var _0x3b2731=_0x3cacbf[0x0];_0x3b2731[_0x7bdb('0x89')]=_0x3cacbf[_0x7bdb('0x2d')];if(_0x509531===_0x7bdb('0x5f')){_0x3b2731[_0x7bdb('0x68')]=computePrice(_0x3b2731[_0x7bdb('0x8a')],_0x3b2731[_0x7bdb('0x5e')],_0x3b2731['netPrice'],_0x3b2731[_0x7bdb('0x61')]);}_0x324285[_0x7bdb('0x55')](addSubscriptionInvoiceDetail(_0x3b2731,_0x521d68,_0x26cde0));})[_0x7bdb('0x8b')]();return BPromise[_0x7bdb('0x56')](_0x324285);});});})[_0x7bdb('0x3a')](function(_0x7a0b00){console[_0x7bdb('0x53')](_0x7bdb('0x58'),_0x7a0b00);throw _0x7a0b00;});}function computePrice(_0x209585,_0x472026,_0x1c09dc,_0x4fbf29){var _0x51a50d=_0x1c09dc;console['log'](_0x7bdb('0x8a'),_0x209585);console[_0x7bdb('0x53')]('dateNextInvoice',_0x472026);console[_0x7bdb('0x53')](_0x7bdb('0x61'),_0x4fbf29);console['log']('netPrice',_0x1c09dc);if(_0x4fbf29!=0x0){var _0x5a98de=moment(_0x209585);var _0x338424=moment(_0x472026);var _0x53bcad=Math['abs'](_0x5a98de['diff'](_0x338424,_0x7bdb('0x8c')));console[_0x7bdb('0x53')](_0x7bdb('0x8d'),_0x53bcad);var _0x535a06=_0x1c09dc/(0x1e*_0x4fbf29);console[_0x7bdb('0x53')](_0x7bdb('0x8e'),_0x535a06);_0x51a50d=_0x535a06*_0x53bcad;}console[_0x7bdb('0x53')](_0x7bdb('0x8f'),_0x51a50d);return _0x51a50d;}exports['automaticSubscriptionInvoice']=function(_0x11f759,_0x4dddbf,_0x21ff92){var _0x1bb65a;if(_0x11f759[_0x7bdb('0x3f')]['id']){delete _0x11f759['body']['id'];}return db[_0x7bdb('0x4c')][_0x7bdb('0x4d')](function(_0x341a54){return db['CmCompany'][_0x7bdb('0x6b')]({'where':{'defaultEntry':0x1},'raw':!![]})[_0x7bdb('0x1e')](function(_0x58d401){_0x1bb65a=_0x58d401;return db[_0x7bdb('0x24')][_0x7bdb('0x38')]({'where':{'dateNextInvoice':{'$lt':moment()},'subscriptionMonthly':{'$ne':0x0},'deleted':null},'order':[['companyId',_0x7bdb('0x50')],[_0x7bdb('0x48'),_0x7bdb('0x50')],[_0x7bdb('0x4a'),_0x7bdb('0x50')]],'raw':!![]});})['then'](function(_0x3f3336){console['log'](_0x7bdb('0x90'),_0x3f3336);if(_0x3f3336[_0x7bdb('0x2d')]>0x0){var _0x190319=[];var _0x4b7730=_[_0x7bdb('0x51')](_0x3f3336,'companyId');Object[_0x7bdb('0x27')](_0x4b7730)['forEach'](function(_0x2e28ec){var _0x2620d1=_0x4b7730[_0x2e28ec];console[_0x7bdb('0x53')](_0x7bdb('0x54'),_0x2620d1);_0x190319[_0x7bdb('0x55')](addSubscriptionInvoice(_0x2620d1,_0x1bb65a,_0x2e28ec,'Total',_0x341a54));});return BPromise['all'](_0x190319);}else{var _0x3370ae={'errors':[{'type':_0x7bdb('0x91'),'message':_0x7bdb('0x92')}]};throw _0x3370ae;}});})[_0x7bdb('0x1e')](function(){return _0x4dddbf['sendStatus'](0xc8);})[_0x7bdb('0x3a')](function(_0x4f0d1f){console['log'](_0x7bdb('0x58'),_0x4f0d1f);if(_0x4f0d1f[_0x7bdb('0x21')]==='SequelizeUniqueConstraintError'){var _0x4f0d1f={'errors':[{'message':_0x7bdb('0x5a')}]};}_0x4dddbf[_0x7bdb('0x16')](0x1f4)[_0x7bdb('0x22')](_0x4f0d1f);});}; \ No newline at end of file diff --git a/server/api/saAsset/saAsset.model.js b/server/api/saAsset/saAsset.model.js index 92982f2..49dd580 100644 --- a/server/api/saAsset/saAsset.model.js +++ b/server/api/saAsset/saAsset.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb68=['./saAsset.attributes','exports','define','sa_assets','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d7f8c,_0x270d59){var _0x1c897c=function(_0x54e2c3){while(--_0x54e2c3){_0x1d7f8c['push'](_0x1d7f8c['shift']());}};_0x1c897c(++_0x270d59);}(_0xbb68,0x1a4));var _0x8bb6=function(_0xffb0a4,_0x132ab5){_0xffb0a4=_0xffb0a4-0x0;var _0x451726=_0xbb68[_0xffb0a4];return _0x451726;};'use strict';var _=require(_0x8bb6('0x0'));var util=require(_0x8bb6('0x1'));var logger=require(_0x8bb6('0x2'))(_0x8bb6('0x3'));var moment=require('moment');var BPromise=require(_0x8bb6('0x4'));var rp=require(_0x8bb6('0x5'));var fs=require('fs');var path=require(_0x8bb6('0x6'));var rimraf=require(_0x8bb6('0x7'));var config=require(_0x8bb6('0x8'));var attributes=require(_0x8bb6('0x9'));module[_0x8bb6('0xa')]=function(_0xb7287,_0x3ec0cf){return _0xb7287[_0x8bb6('0xb')]('SAAsset',attributes,{'tableName':_0x8bb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e39=['path','rimraf','../../config/environment','exports','define','SAAsset','sa_assets','lodash','util','moment','bluebird','request-promise'];(function(_0x448ce2,_0x5ada5d){var _0x48e7ab=function(_0x32e47b){while(--_0x32e47b){_0x448ce2['push'](_0x448ce2['shift']());}};_0x48e7ab(++_0x5ada5d);}(_0x5e39,0x10f));var _0x95e3=function(_0x496d52,_0x21fd80){_0x496d52=_0x496d52-0x0;var _0xf6c38c=_0x5e39[_0x496d52];return _0xf6c38c;};'use strict';var _=require(_0x95e3('0x0'));var util=require(_0x95e3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x95e3('0x2'));var BPromise=require(_0x95e3('0x3'));var rp=require(_0x95e3('0x4'));var fs=require('fs');var path=require(_0x95e3('0x5'));var rimraf=require(_0x95e3('0x6'));var config=require(_0x95e3('0x7'));var attributes=require('./saAsset.attributes');module[_0x95e3('0x8')]=function(_0x5784fe,_0x306d15){return _0x5784fe[_0x95e3('0x9')](_0x95e3('0xa'),attributes,{'tableName':_0x95e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saAsset/saAsset.rpc.js b/server/api/saAsset/saAsset.rpc.js index 67d9fb6..84ac103 100644 --- a/server/api/saAsset/saAsset.rpc.js +++ b/server/api/saAsset/saAsset.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe74c=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SAAsset,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x21df38,_0x53e341){var _0x4c7533=function(_0x3d6c27){while(--_0x3d6c27){_0x21df38['push'](_0x21df38['shift']());}};_0x4c7533(++_0x53e341);}(_0xe74c,0x1ba));var _0xce74=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe74c[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xce74('0x0'));var util=require(_0xce74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce74('0x2'));var fs=require('fs');var Redis=require(_0xce74('0x3'));var db=require(_0xce74('0x4'))['db'];var utils=require(_0xce74('0x5'));var logger=require(_0xce74('0x6'))(_0xce74('0x7'));var config=require('../../config/environment');var jayson=require(_0xce74('0x8'));var client=jayson[_0xce74('0x9')][_0xce74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4599,_0x145da0,_0x4f9a63){return new BPromise(function(_0x453b41,_0x5683fc){return client[_0xce74('0xb')](_0x1d4599,_0x4f9a63)[_0xce74('0xc')](function(_0x5b2bd5){logger[_0xce74('0xd')](_0xce74('0xe'),_0x145da0,_0xce74('0xf'));logger[_0xce74('0x10')]('SAAsset,\x20%s,\x20%s,\x20%s',_0x145da0,_0xce74('0xf'),JSON[_0xce74('0x11')](_0x5b2bd5));if(_0x5b2bd5[_0xce74('0x12')]){if(_0x5b2bd5[_0xce74('0x12')]['code']===0x1f4){logger['error'](_0xce74('0xe'),_0x145da0,_0x5b2bd5[_0xce74('0x12')][_0xce74('0x13')]);return _0x5683fc(_0x5b2bd5['error'][_0xce74('0x13')]);}logger[_0xce74('0x12')](_0xce74('0xe'),_0x145da0,_0x5b2bd5['error'][_0xce74('0x13')]);return _0x453b41(_0x5b2bd5[_0xce74('0x12')][_0xce74('0x13')]);}else{logger[_0xce74('0xd')]('SAAsset,\x20%s,\x20%s',_0x145da0,_0xce74('0xf'));_0x453b41(_0x5b2bd5[_0xce74('0x14')][_0xce74('0x13')]);}})[_0xce74('0x15')](function(_0x4fc98f){logger[_0xce74('0x12')](_0xce74('0xe'),_0x145da0,_0x4fc98f);_0x5683fc(_0x4fc98f);});});} \ No newline at end of file +var _0x2b18=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','SAAsset,\x20%s,\x20%s,\x20%s','error','code','SAAsset,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x937e9f,_0x53fac2){var _0x36adb3=function(_0x589fa6){while(--_0x589fa6){_0x937e9f['push'](_0x937e9f['shift']());}};_0x36adb3(++_0x53fac2);}(_0x2b18,0x87));var _0x82b1=function(_0x1a39bc,_0x23b0c8){_0x1a39bc=_0x1a39bc-0x0;var _0x572056=_0x2b18[_0x1a39bc];return _0x572056;};'use strict';var _=require(_0x82b1('0x0'));var util=require(_0x82b1('0x1'));var moment=require(_0x82b1('0x2'));var BPromise=require(_0x82b1('0x3'));var rs=require(_0x82b1('0x4'));var fs=require('fs');var Redis=require(_0x82b1('0x5'));var db=require(_0x82b1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x82b1('0x7'))(_0x82b1('0x8'));var config=require(_0x82b1('0x9'));var jayson=require(_0x82b1('0xa'));var client=jayson['client'][_0x82b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34d7a7,_0x518476,_0x5934a7){return new BPromise(function(_0x4e158d,_0xb6e102){return client['request'](_0x34d7a7,_0x5934a7)[_0x82b1('0xc')](function(_0x472549){logger[_0x82b1('0xd')]('SAAsset,\x20%s,\x20%s',_0x518476,_0x82b1('0xe'));logger['debug'](_0x82b1('0xf'),_0x518476,'request\x20sent',JSON['stringify'](_0x472549));if(_0x472549[_0x82b1('0x10')]){if(_0x472549[_0x82b1('0x10')][_0x82b1('0x11')]===0x1f4){logger[_0x82b1('0x10')](_0x82b1('0x12'),_0x518476,_0x472549[_0x82b1('0x10')][_0x82b1('0x13')]);return _0xb6e102(_0x472549['error']['message']);}logger[_0x82b1('0x10')](_0x82b1('0x12'),_0x518476,_0x472549[_0x82b1('0x10')][_0x82b1('0x13')]);return _0x4e158d(_0x472549[_0x82b1('0x10')]['message']);}else{logger[_0x82b1('0xd')](_0x82b1('0x12'),_0x518476,_0x82b1('0xe'));_0x4e158d(_0x472549['result'][_0x82b1('0x13')]);}})['catch'](function(_0x6ebfdf){logger['error'](_0x82b1('0x12'),_0x518476,_0x6ebfdf);_0xb6e102(_0x6ebfdf);});});} \ No newline at end of file diff --git a/server/api/saCompanyRelationship/index.js b/server/api/saCompanyRelationship/index.js index 4b2df1c..15095fb 100644 --- a/server/api/saCompanyRelationship/index.js +++ b/server/api/saCompanyRelationship/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc9=['/describe','isAuthenticated','describe','show','create','/:id','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./saCompanyRelationship.controller','get','index'];(function(_0x13ceed,_0xecda6a){var _0x545d11=function(_0x3f40a0){while(--_0x3f40a0){_0x13ceed['push'](_0x13ceed['shift']());}};_0x545d11(++_0xecda6a);}(_0x4fc9,0x1c2));var _0x94fc=function(_0x186557,_0x47e458){_0x186557=_0x186557-0x0;var _0x3db94c=_0x4fc9[_0x186557];return _0x3db94c;};'use strict';var multer=require(_0x94fc('0x0'));var util=require(_0x94fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94fc('0x2'));var router=express['Router']();var auth=require(_0x94fc('0x3'));var interaction=require(_0x94fc('0x4'));var config=require(_0x94fc('0x5'));var controller=require(_0x94fc('0x6'));router[_0x94fc('0x7')]('/',auth['isAuthenticated'](),controller[_0x94fc('0x8')]);router[_0x94fc('0x7')](_0x94fc('0x9'),auth[_0x94fc('0xa')](),controller[_0x94fc('0xb')]);router[_0x94fc('0x7')]('/:id',auth[_0x94fc('0xa')](),controller[_0x94fc('0xc')]);router['post']('/',auth[_0x94fc('0xa')](),controller[_0x94fc('0xd')]);router['put'](_0x94fc('0xe'),auth[_0x94fc('0xa')](),controller['update']);router['delete'](_0x94fc('0xe'),auth[_0x94fc('0xa')](),controller[_0x94fc('0xf')]);module[_0x94fc('0x10')]=router; \ No newline at end of file +var _0xd545=['Router','../../components/interaction/service','./saCompanyRelationship.controller','get','/describe','describe','isAuthenticated','create','/:id','update','delete','destroy','connect-timeout','express'];(function(_0x4743ce,_0x55dafa){var _0xa05bc1=function(_0x289089){while(--_0x289089){_0x4743ce['push'](_0x4743ce['shift']());}};_0xa05bc1(++_0x55dafa);}(_0xd545,0x140));var _0x5d54=function(_0x586266,_0x21ce2b){_0x586266=_0x586266-0x0;var _0x4df015=_0xd545[_0x586266];return _0x4df015;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5d54('0x0'));var express=require(_0x5d54('0x1'));var router=express[_0x5d54('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5d54('0x3'));var config=require('../../config/environment');var controller=require(_0x5d54('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5d54('0x5')](_0x5d54('0x6'),auth['isAuthenticated'](),controller[_0x5d54('0x7')]);router[_0x5d54('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5d54('0x8')](),controller[_0x5d54('0x9')]);router['put'](_0x5d54('0xa'),auth['isAuthenticated'](),controller[_0x5d54('0xb')]);router[_0x5d54('0xc')](_0x5d54('0xa'),auth[_0x5d54('0x8')](),controller[_0x5d54('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saCompanyRelationship/saCompanyRelationship.attributes.js b/server/api/saCompanyRelationship/saCompanyRelationship.attributes.js index 71b4539..156cbe6 100644 --- a/server/api/saCompanyRelationship/saCompanyRelationship.attributes.js +++ b/server/api/saCompanyRelationship/saCompanyRelationship.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83d8=['sequelize','exports','name'];(function(_0x22df4d,_0xa4790a){var _0x6a2020=function(_0x215c88){while(--_0x215c88){_0x22df4d['push'](_0x22df4d['shift']());}};_0x6a2020(++_0xa4790a);}(_0x83d8,0x192));var _0x883d=function(_0x283cd8,_0xe47de3){_0x283cd8=_0x283cd8-0x0;var _0x20a57b=_0x83d8[_0x283cd8];return _0x20a57b;};'use strict';var Sequelize=require(_0x883d('0x0'));module[_0x883d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x883d('0x2')}}; \ No newline at end of file +var _0xdeb2=['exports','STRING','sequelize'];(function(_0x1fa0b9,_0x556f29){var _0x3ac6fe=function(_0x9b3315){while(--_0x9b3315){_0x1fa0b9['push'](_0x1fa0b9['shift']());}};_0x3ac6fe(++_0x556f29);}(_0xdeb2,0x7d));var _0x2deb=function(_0x436a79,_0x35e097){_0x436a79=_0x436a79-0x0;var _0x166908=_0xdeb2[_0x436a79];return _0x166908;};'use strict';var Sequelize=require(_0x2deb('0x0'));module[_0x2deb('0x1')]={'name':{'type':Sequelize[_0x2deb('0x2')],'allowNull':![],'unique':'name'}}; \ No newline at end of file diff --git a/server/api/saCompanyRelationship/saCompanyRelationship.controller.js b/server/api/saCompanyRelationship/saCompanyRelationship.controller.js index b1b1b2e..8ddd07e 100644 --- a/server/api/saCompanyRelationship/saCompanyRelationship.controller.js +++ b/server/api/saCompanyRelationship/saCompanyRelationship.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1be9=['order','sort','where','pick','filter','merge','map','type','key','field','options','include','findAll','rows','catch','show','SACompanyRelationship','fields','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','index','rawAttributes','keys','filters','intersection','model','attributes','query','length','nolimit','limit'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x1be9,0xe9));var _0x91be=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x1be9[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require(_0x91be('0x0'));var emlformat=require(_0x91be('0x1'));var rimraf=require(_0x91be('0x2'));var zipdir=require(_0x91be('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91be('0x4'));var moment=require(_0x91be('0x5'));var BPromise=require(_0x91be('0x6'));var Mustache=require(_0x91be('0x7'));var util=require(_0x91be('0x8'));var path=require(_0x91be('0x9'));var sox=require('sox');var csv=require(_0x91be('0xa'));var ejs=require(_0x91be('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x91be('0xc'));var jsforce=require(_0x91be('0xd'));var deskjs=require(_0x91be('0xe'));var toCsv=require(_0x91be('0xa'));var querystring=require(_0x91be('0xf'));var Papa=require('papaparse');var Redis=require(_0x91be('0x10'));var authService=require(_0x91be('0x11'));var qs=require(_0x91be('0x12'));var hardwareService=require(_0x91be('0x13'));var logger=require(_0x91be('0x14'))(_0x91be('0x15'));var utils=require('../../config/utils');var config=require(_0x91be('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed551,_0x5d44ca){_0x5d44ca=_0x5d44ca||0xcc;return function(_0x2466af){if(_0x2466af){return _0x3ed551['sendStatus'](_0x5d44ca);}return _0x3ed551[_0x91be('0x17')](_0x5d44ca)['end']();};}function respondWithResult(_0x20467a,_0xe0718b){_0xe0718b=_0xe0718b||0xc8;return function(_0x22183d){if(_0x22183d){return _0x20467a[_0x91be('0x17')](_0xe0718b)[_0x91be('0x18')](_0x22183d);}};}function respondWithFilteredResult(_0x537d32,_0x3bf382){return function(_0x3831a4){if(_0x3831a4){var _0x53df77=_0x3831a4[_0x91be('0x19')],_0x1b040a=_0x3bf382['offset'],_0x5b0199=_0x3bf382[_0x91be('0x1a')]+_0x3bf382['limit'],_0x1682cf;if(_0x5b0199>=_0x53df77){_0x5b0199=_0x53df77;_0x1682cf=0xc8;}else{_0x1682cf=0xce;}_0x537d32[_0x91be('0x17')](_0x1682cf);return _0x537d32[_0x91be('0x1b')](_0x91be('0x1c'),_0x1b040a+'-'+_0x5b0199+'/'+_0x53df77)['json'](_0x3831a4);}return null;};}function patchUpdates(_0x34bc37){return function(_0x29e93a){try{jsonpatch['apply'](_0x29e93a,_0x34bc37,!![]);}catch(_0xf5e1c1){return BPromise[_0x91be('0x1d')](_0xf5e1c1);}return _0x29e93a[_0x91be('0x1e')]();};}function saveUpdates(_0x3e1a8c,_0x354aef){return function(_0x26201f){if(_0x26201f){return _0x26201f[_0x91be('0x1f')](_0x3e1a8c)[_0x91be('0x20')](function(_0x30dabb){return _0x30dabb;});}return null;};}function removeEntity(_0x40d616,_0x2df02c){return function(_0x246ab7){if(_0x246ab7){return _0x246ab7[_0x91be('0x21')]()['then'](function(){_0x40d616['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9ae3,_0xcaead0){return function(_0x29a662){if(!_0x29a662){_0x2b9ae3['sendStatus'](0x194);}return _0x29a662;};}function handleError(_0x5c4018,_0x1bbf7b){_0x1bbf7b=_0x1bbf7b||0x1f4;return function(_0x1ef877){logger[_0x91be('0x22')](_0x1ef877['stack']);if(_0x1ef877[_0x91be('0x23')]){delete _0x1ef877[_0x91be('0x23')];}_0x5c4018[_0x91be('0x17')](_0x1bbf7b)['send'](_0x1ef877);};}exports[_0x91be('0x24')]=function(_0x41a6ad,_0xacd478){var _0x1bd608={},_0x2ee2eb={},_0x18e929={'count':0x0,'rows':[]};var _0x1dbfdc=db['SACompanyRelationship'][_0x91be('0x25')];_0x2ee2eb['model']=_[_0x91be('0x26')](_0x1dbfdc);_0x2ee2eb['query']=_[_0x91be('0x26')](_0x41a6ad['query']);_0x2ee2eb[_0x91be('0x27')]=_[_0x91be('0x28')](_0x2ee2eb[_0x91be('0x29')],_0x2ee2eb['query']);_0x1bd608[_0x91be('0x2a')]=_[_0x91be('0x28')](_0x2ee2eb[_0x91be('0x29')],qs['fields'](_0x41a6ad[_0x91be('0x2b')]['fields']));_0x1bd608[_0x91be('0x2a')]=_0x1bd608[_0x91be('0x2a')][_0x91be('0x2c')]?_0x1bd608[_0x91be('0x2a')]:_0x2ee2eb['model'];if(!_0x41a6ad[_0x91be('0x2b')]['hasOwnProperty'](_0x91be('0x2d'))){_0x1bd608[_0x91be('0x2e')]=qs[_0x91be('0x2e')](_0x41a6ad['query'][_0x91be('0x2e')]);_0x1bd608[_0x91be('0x1a')]=qs[_0x91be('0x1a')](_0x41a6ad[_0x91be('0x2b')][_0x91be('0x1a')]);}_0x1bd608[_0x91be('0x2f')]=qs[_0x91be('0x30')](_0x41a6ad[_0x91be('0x2b')][_0x91be('0x30')]);_0x1bd608[_0x91be('0x31')]=qs[_0x91be('0x27')](_[_0x91be('0x32')](_0x41a6ad[_0x91be('0x2b')],_0x2ee2eb[_0x91be('0x27')]));if(_0x41a6ad[_0x91be('0x2b')][_0x91be('0x33')]){_0x1bd608['where']=_[_0x91be('0x34')](_0x1bd608['where'],{'$or':_[_0x91be('0x35')](_0x1dbfdc,function(_0x1ca441){if(_0x1ca441[_0x91be('0x36')][_0x91be('0x37')]!=='VIRTUAL'){var _0x3d933e={};_0x3d933e[_0x1ca441[_0x91be('0x38')]]={'$like':'%'+_0x41a6ad[_0x91be('0x2b')][_0x91be('0x33')]+'%'};return _0x3d933e;}})});}_0x1bd608=_[_0x91be('0x34')]({},_0x1bd608,_0x41a6ad[_0x91be('0x39')]);var _0x2da328={'where':_0x1bd608['where']};return db['SACompanyRelationship'][_0x91be('0x19')](_0x2da328)[_0x91be('0x20')](function(_0x13b363){_0x18e929[_0x91be('0x19')]=_0x13b363;if(_0x41a6ad[_0x91be('0x2b')]['includeAll']){_0x1bd608[_0x91be('0x3a')]=[{'all':!![]}];}return db['SACompanyRelationship'][_0x91be('0x3b')](_0x1bd608);})[_0x91be('0x20')](function(_0x42cda2){_0x18e929[_0x91be('0x3c')]=_0x42cda2;return _0x18e929;})['then'](respondWithFilteredResult(_0xacd478,_0x1bd608))[_0x91be('0x3d')](handleError(_0xacd478,null));};exports[_0x91be('0x3e')]=function(_0x534a09,_0x3bdba9){var _0x59eb76={'raw':![],'where':{'id':_0x534a09['params']['id']}},_0xa5220c={};_0xa5220c[_0x91be('0x29')]=_[_0x91be('0x26')](db[_0x91be('0x3f')][_0x91be('0x25')]);_0xa5220c['query']=_['keys'](_0x534a09[_0x91be('0x2b')]);_0xa5220c[_0x91be('0x27')]=_['intersection'](_0xa5220c['model'],_0xa5220c[_0x91be('0x2b')]);_0x59eb76[_0x91be('0x2a')]=_[_0x91be('0x28')](_0xa5220c[_0x91be('0x29')],qs[_0x91be('0x40')](_0x534a09[_0x91be('0x2b')][_0x91be('0x40')]));_0x59eb76[_0x91be('0x2a')]=_0x59eb76[_0x91be('0x2a')]['length']?_0x59eb76['attributes']:_0xa5220c['model'];if(_0x534a09[_0x91be('0x2b')][_0x91be('0x41')]){_0x59eb76[_0x91be('0x3a')]=[{'all':!![]}];}_0x59eb76=_['merge']({},_0x59eb76,_0x534a09['options']);return db[_0x91be('0x3f')][_0x91be('0x42')](_0x59eb76)['then'](handleEntityNotFound(_0x3bdba9,null))[_0x91be('0x20')](respondWithResult(_0x3bdba9,null))['catch'](handleError(_0x3bdba9,null));};exports[_0x91be('0x43')]=function(_0x589e09,_0x324c5a){return db['SACompanyRelationship'][_0x91be('0x43')](_0x589e09[_0x91be('0x44')],{})[_0x91be('0x20')](respondWithResult(_0x324c5a,0xc9))[_0x91be('0x3d')](handleError(_0x324c5a,null));};exports[_0x91be('0x1f')]=function(_0x12a372,_0x4a1eeb){if(_0x12a372[_0x91be('0x44')]['id']){delete _0x12a372[_0x91be('0x44')]['id'];}return db[_0x91be('0x3f')][_0x91be('0x42')]({'where':{'id':_0x12a372[_0x91be('0x45')]['id']}})[_0x91be('0x20')](handleEntityNotFound(_0x4a1eeb,null))[_0x91be('0x20')](saveUpdates(_0x12a372[_0x91be('0x44')],null))[_0x91be('0x20')](respondWithResult(_0x4a1eeb,null))['catch'](handleError(_0x4a1eeb,null));};exports[_0x91be('0x21')]=function(_0x19c565,_0x2e9cc9){return db['SACompanyRelationship'][_0x91be('0x42')]({'where':{'id':_0x19c565[_0x91be('0x45')]['id']}})[_0x91be('0x20')](handleEntityNotFound(_0x2e9cc9,null))['then'](removeEntity(_0x2e9cc9,null))[_0x91be('0x3d')](handleError(_0x2e9cc9,null));};exports['describe']=function(_0x208f78,_0xd028ec){return db['SACompanyRelationship']['describe']()[_0x91be('0x20')](respondWithResult(_0xd028ec,null))[_0x91be('0x3d')](handleError(_0xd028ec,null));}; \ No newline at end of file +var _0x1f96=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','SACompanyRelationship','model','keys','query','filters','attributes','intersection','hasOwnProperty','order','sort','filter','where','map','type','key','field','options','includeAll','include','findAll','rows','show','params','fields','length','merge','create','body','catch','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0xc05058,_0x4beed4){var _0x1fe6bd=function(_0x19b54c){while(--_0x19b54c){_0xc05058['push'](_0xc05058['shift']());}};_0x1fe6bd(++_0x4beed4);}(_0x1f96,0xcf));var _0x61f9=function(_0x127e17,_0x26830a){_0x127e17=_0x127e17-0x0;var _0x3ef8ac=_0x1f96[_0x127e17];return _0x3ef8ac;};'use strict';var pdf=require(_0x61f9('0x0'));var emlformat=require(_0x61f9('0x1'));var rimraf=require(_0x61f9('0x2'));var zipdir=require(_0x61f9('0x3'));var jsonpatch=require(_0x61f9('0x4'));var rp=require('request-promise');var moment=require(_0x61f9('0x5'));var BPromise=require(_0x61f9('0x6'));var Mustache=require(_0x61f9('0x7'));var util=require(_0x61f9('0x8'));var path=require('path');var sox=require(_0x61f9('0x9'));var csv=require(_0x61f9('0xa'));var ejs=require(_0x61f9('0xb'));var fs=require('fs');var _=require(_0x61f9('0xc'));var squel=require(_0x61f9('0xd'));var crypto=require(_0x61f9('0xe'));var jsforce=require(_0x61f9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x61f9('0x10'));var Papa=require(_0x61f9('0x11'));var Redis=require(_0x61f9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x61f9('0x13'));var hardwareService=require(_0x61f9('0x14'));var logger=require(_0x61f9('0x15'))(_0x61f9('0x16'));var utils=require(_0x61f9('0x17'));var config=require('../../config/environment');var db=require(_0x61f9('0x18'))['db'];function respondWithStatusCode(_0x5bb58b,_0x3ee3f5){_0x3ee3f5=_0x3ee3f5||0xcc;return function(_0x54194f){if(_0x54194f){return _0x5bb58b[_0x61f9('0x19')](_0x3ee3f5);}return _0x5bb58b['status'](_0x3ee3f5)[_0x61f9('0x1a')]();};}function respondWithResult(_0x9cab0f,_0x119835){_0x119835=_0x119835||0xc8;return function(_0x12f74f){if(_0x12f74f){return _0x9cab0f[_0x61f9('0x1b')](_0x119835)[_0x61f9('0x1c')](_0x12f74f);}};}function respondWithFilteredResult(_0x4ef83b,_0x55b9b8){return function(_0x467467){if(_0x467467){var _0x386853=_0x467467[_0x61f9('0x1d')],_0x66c83=_0x55b9b8['offset'],_0x78605b=_0x55b9b8[_0x61f9('0x1e')]+_0x55b9b8[_0x61f9('0x1f')],_0x13e2f3;if(_0x78605b>=_0x386853){_0x78605b=_0x386853;_0x13e2f3=0xc8;}else{_0x13e2f3=0xce;}_0x4ef83b[_0x61f9('0x1b')](_0x13e2f3);return _0x4ef83b['set'](_0x61f9('0x20'),_0x66c83+'-'+_0x78605b+'/'+_0x386853)[_0x61f9('0x1c')](_0x467467);}return null;};}function patchUpdates(_0x5e98d1){return function(_0x20e21c){try{jsonpatch[_0x61f9('0x21')](_0x20e21c,_0x5e98d1,!![]);}catch(_0x4480ba){return BPromise[_0x61f9('0x22')](_0x4480ba);}return _0x20e21c[_0x61f9('0x23')]();};}function saveUpdates(_0x2773f6,_0x44ae0a){return function(_0x4fb28d){if(_0x4fb28d){return _0x4fb28d[_0x61f9('0x24')](_0x2773f6)[_0x61f9('0x25')](function(_0x6ba4fa){return _0x6ba4fa;});}return null;};}function removeEntity(_0x3c9e6f,_0x4647a6){return function(_0xcdf8eb){if(_0xcdf8eb){return _0xcdf8eb['destroy']()[_0x61f9('0x25')](function(){_0x3c9e6f[_0x61f9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e600c,_0x3762bd){return function(_0xee9d5e){if(!_0xee9d5e){_0x4e600c[_0x61f9('0x19')](0x194);}return _0xee9d5e;};}function handleError(_0x5b911f,_0x1abb2e){_0x1abb2e=_0x1abb2e||0x1f4;return function(_0x399886){logger['error'](_0x399886[_0x61f9('0x26')]);if(_0x399886[_0x61f9('0x27')]){delete _0x399886[_0x61f9('0x27')];}_0x5b911f['status'](_0x1abb2e)[_0x61f9('0x28')](_0x399886);};}exports['index']=function(_0x33a783,_0x5eac31){var _0x4bd8b4={},_0x39d2e4={},_0x5c9199={'count':0x0,'rows':[]};var _0x31d777=db[_0x61f9('0x29')]['rawAttributes'];_0x39d2e4[_0x61f9('0x2a')]=_[_0x61f9('0x2b')](_0x31d777);_0x39d2e4[_0x61f9('0x2c')]=_[_0x61f9('0x2b')](_0x33a783['query']);_0x39d2e4[_0x61f9('0x2d')]=_['intersection'](_0x39d2e4['model'],_0x39d2e4[_0x61f9('0x2c')]);_0x4bd8b4[_0x61f9('0x2e')]=_[_0x61f9('0x2f')](_0x39d2e4[_0x61f9('0x2a')],qs['fields'](_0x33a783[_0x61f9('0x2c')]['fields']));_0x4bd8b4[_0x61f9('0x2e')]=_0x4bd8b4[_0x61f9('0x2e')]['length']?_0x4bd8b4['attributes']:_0x39d2e4[_0x61f9('0x2a')];if(!_0x33a783[_0x61f9('0x2c')][_0x61f9('0x30')]('nolimit')){_0x4bd8b4[_0x61f9('0x1f')]=qs['limit'](_0x33a783['query']['limit']);_0x4bd8b4[_0x61f9('0x1e')]=qs[_0x61f9('0x1e')](_0x33a783[_0x61f9('0x2c')][_0x61f9('0x1e')]);}_0x4bd8b4[_0x61f9('0x31')]=qs[_0x61f9('0x32')](_0x33a783[_0x61f9('0x2c')][_0x61f9('0x32')]);_0x4bd8b4['where']=qs[_0x61f9('0x2d')](_['pick'](_0x33a783[_0x61f9('0x2c')],_0x39d2e4[_0x61f9('0x2d')]));if(_0x33a783['query'][_0x61f9('0x33')]){_0x4bd8b4['where']=_['merge'](_0x4bd8b4[_0x61f9('0x34')],{'$or':_[_0x61f9('0x35')](_0x31d777,function(_0x5c07a9){if(_0x5c07a9[_0x61f9('0x36')][_0x61f9('0x37')]!=='VIRTUAL'){var _0x347a57={};_0x347a57[_0x5c07a9[_0x61f9('0x38')]]={'$like':'%'+_0x33a783['query'][_0x61f9('0x33')]+'%'};return _0x347a57;}})});}_0x4bd8b4=_['merge']({},_0x4bd8b4,_0x33a783[_0x61f9('0x39')]);var _0xf4c7d8={'where':_0x4bd8b4[_0x61f9('0x34')]};return db['SACompanyRelationship'][_0x61f9('0x1d')](_0xf4c7d8)[_0x61f9('0x25')](function(_0x2155e0){_0x5c9199['count']=_0x2155e0;if(_0x33a783[_0x61f9('0x2c')][_0x61f9('0x3a')]){_0x4bd8b4[_0x61f9('0x3b')]=[{'all':!![]}];}return db[_0x61f9('0x29')][_0x61f9('0x3c')](_0x4bd8b4);})[_0x61f9('0x25')](function(_0x254b53){_0x5c9199[_0x61f9('0x3d')]=_0x254b53;return _0x5c9199;})[_0x61f9('0x25')](respondWithFilteredResult(_0x5eac31,_0x4bd8b4))['catch'](handleError(_0x5eac31,null));};exports[_0x61f9('0x3e')]=function(_0x4151bb,_0xde9d56){var _0x37cb52={'raw':![],'where':{'id':_0x4151bb[_0x61f9('0x3f')]['id']}},_0x45845c={};_0x45845c[_0x61f9('0x2a')]=_[_0x61f9('0x2b')](db[_0x61f9('0x29')]['rawAttributes']);_0x45845c['query']=_['keys'](_0x4151bb[_0x61f9('0x2c')]);_0x45845c[_0x61f9('0x2d')]=_[_0x61f9('0x2f')](_0x45845c['model'],_0x45845c[_0x61f9('0x2c')]);_0x37cb52[_0x61f9('0x2e')]=_[_0x61f9('0x2f')](_0x45845c['model'],qs[_0x61f9('0x40')](_0x4151bb[_0x61f9('0x2c')][_0x61f9('0x40')]));_0x37cb52[_0x61f9('0x2e')]=_0x37cb52[_0x61f9('0x2e')][_0x61f9('0x41')]?_0x37cb52[_0x61f9('0x2e')]:_0x45845c['model'];if(_0x4151bb[_0x61f9('0x2c')]['includeAll']){_0x37cb52[_0x61f9('0x3b')]=[{'all':!![]}];}_0x37cb52=_[_0x61f9('0x42')]({},_0x37cb52,_0x4151bb['options']);return db[_0x61f9('0x29')]['find'](_0x37cb52)['then'](handleEntityNotFound(_0xde9d56,null))['then'](respondWithResult(_0xde9d56,null))['catch'](handleError(_0xde9d56,null));};exports[_0x61f9('0x43')]=function(_0x518c06,_0x31e434){return db[_0x61f9('0x29')]['create'](_0x518c06[_0x61f9('0x44')],{})[_0x61f9('0x25')](respondWithResult(_0x31e434,0xc9))['catch'](handleError(_0x31e434,null));};exports[_0x61f9('0x24')]=function(_0x312ee8,_0x52ca41){if(_0x312ee8[_0x61f9('0x44')]['id']){delete _0x312ee8['body']['id'];}return db[_0x61f9('0x29')]['find']({'where':{'id':_0x312ee8[_0x61f9('0x3f')]['id']}})[_0x61f9('0x25')](handleEntityNotFound(_0x52ca41,null))[_0x61f9('0x25')](saveUpdates(_0x312ee8[_0x61f9('0x44')],null))[_0x61f9('0x25')](respondWithResult(_0x52ca41,null))[_0x61f9('0x45')](handleError(_0x52ca41,null));};exports['destroy']=function(_0x190939,_0x206114){return db[_0x61f9('0x29')][_0x61f9('0x46')]({'where':{'id':_0x190939[_0x61f9('0x3f')]['id']}})[_0x61f9('0x25')](handleEntityNotFound(_0x206114,null))['then'](removeEntity(_0x206114,null))[_0x61f9('0x45')](handleError(_0x206114,null));};exports['describe']=function(_0x4470ad,_0x14d86f){return db['SACompanyRelationship'][_0x61f9('0x47')]()['then'](respondWithResult(_0x14d86f,null))[_0x61f9('0x45')](handleError(_0x14d86f,null));}; \ No newline at end of file diff --git a/server/api/saCompanyRelationship/saCompanyRelationship.model.js b/server/api/saCompanyRelationship/saCompanyRelationship.model.js index 77cdf05..2005ba6 100644 --- a/server/api/saCompanyRelationship/saCompanyRelationship.model.js +++ b/server/api/saCompanyRelationship/saCompanyRelationship.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfe1=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./saCompanyRelationship.attributes','exports','define'];(function(_0x133fb8,_0x529dd7){var _0x5b7427=function(_0x4af6cb){while(--_0x4af6cb){_0x133fb8['push'](_0x133fb8['shift']());}};_0x5b7427(++_0x529dd7);}(_0xcfe1,0x14a));var _0x1cfe=function(_0xf49a6f,_0x3b581f){_0xf49a6f=_0xf49a6f-0x0;var _0x51abb1=_0xcfe1[_0xf49a6f];return _0x51abb1;};'use strict';var _=require(_0x1cfe('0x0'));var util=require(_0x1cfe('0x1'));var logger=require(_0x1cfe('0x2'))(_0x1cfe('0x3'));var moment=require('moment');var BPromise=require(_0x1cfe('0x4'));var rp=require(_0x1cfe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cfe('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cfe('0x7'));module[_0x1cfe('0x8')]=function(_0x168da0,_0xdfbd9b){return _0x168da0[_0x1cfe('0x9')]('SACompanyRelationship',attributes,{'tableName':'sa_company_relationships','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bf2=['./saCompanyRelationship.attributes','exports','define','lodash','moment','request-promise'];(function(_0x145b93,_0x4cf77a){var _0x596ac2=function(_0x2c418d){while(--_0x2c418d){_0x145b93['push'](_0x145b93['shift']());}};_0x596ac2(++_0x4cf77a);}(_0x6bf2,0xc9));var _0x26bf=function(_0x46f5ca,_0xecad5){_0x46f5ca=_0x46f5ca-0x0;var _0x57b513=_0x6bf2[_0x46f5ca];return _0x57b513;};'use strict';var _=require(_0x26bf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x26bf('0x1'));var BPromise=require('bluebird');var rp=require(_0x26bf('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26bf('0x3'));module[_0x26bf('0x4')]=function(_0x5a1135,_0x265c7b){return _0x5a1135[_0x26bf('0x5')]('SACompanyRelationship',attributes,{'tableName':'sa_company_relationships','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saCompanyRelationship/saCompanyRelationship.rpc.js b/server/api/saCompanyRelationship/saCompanyRelationship.rpc.js index fb5a000..424bfde 100644 --- a/server/api/saCompanyRelationship/saCompanyRelationship.rpc.js +++ b/server/api/saCompanyRelationship/saCompanyRelationship.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa63b=['request\x20sent','SACompanyRelationship,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SACompanyRelationship,\x20%s,\x20%s'];(function(_0xa0a732,_0x5597f2){var _0xada315=function(_0x5355bb){while(--_0x5355bb){_0xa0a732['push'](_0xa0a732['shift']());}};_0xada315(++_0x5597f2);}(_0xa63b,0x119));var _0xba63=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa63b[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xba63('0x0'));var util=require(_0xba63('0x1'));var moment=require('moment');var BPromise=require(_0xba63('0x2'));var rs=require(_0xba63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba63('0x4'))['db'];var utils=require(_0xba63('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xba63('0x6'));var jayson=require(_0xba63('0x7'));var client=jayson[_0xba63('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc40e7f,_0xe20a37,_0x21c69f){return new BPromise(function(_0x189c13,_0x4599d7){return client[_0xba63('0x9')](_0xc40e7f,_0x21c69f)[_0xba63('0xa')](function(_0x37bc52){logger[_0xba63('0xb')](_0xba63('0xc'),_0xe20a37,_0xba63('0xd'));logger['debug'](_0xba63('0xe'),_0xe20a37,_0xba63('0xd'),JSON[_0xba63('0xf')](_0x37bc52));if(_0x37bc52[_0xba63('0x10')]){if(_0x37bc52[_0xba63('0x10')][_0xba63('0x11')]===0x1f4){logger[_0xba63('0x10')](_0xba63('0xc'),_0xe20a37,_0x37bc52[_0xba63('0x10')]['message']);return _0x4599d7(_0x37bc52[_0xba63('0x10')][_0xba63('0x12')]);}logger[_0xba63('0x10')](_0xba63('0xc'),_0xe20a37,_0x37bc52[_0xba63('0x10')]['message']);return _0x189c13(_0x37bc52[_0xba63('0x10')][_0xba63('0x12')]);}else{logger[_0xba63('0xb')](_0xba63('0xc'),_0xe20a37,_0xba63('0xd'));_0x189c13(_0x37bc52[_0xba63('0x13')][_0xba63('0x12')]);}})[_0xba63('0x14')](function(_0x2c5787){logger[_0xba63('0x10')]('SACompanyRelationship,\x20%s,\x20%s',_0xe20a37,_0x2c5787);_0x4599d7(_0x2c5787);});});} \ No newline at end of file +var _0x1959=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','SACompanyRelationship,\x20%s,\x20%s','request\x20sent','debug','SACompanyRelationship,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1959,0x15d));var _0x9195=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1959[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x9195('0x0'));var util=require(_0x9195('0x1'));var moment=require(_0x9195('0x2'));var BPromise=require(_0x9195('0x3'));var rs=require(_0x9195('0x4'));var fs=require('fs');var Redis=require(_0x9195('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9195('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9195('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9195('0x8')][_0x9195('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14ed8e,_0x1cac32,_0x49ee87){return new BPromise(function(_0x41dbf7,_0x535127){return client[_0x9195('0xa')](_0x14ed8e,_0x49ee87)[_0x9195('0xb')](function(_0x22dcc7){logger['info'](_0x9195('0xc'),_0x1cac32,_0x9195('0xd'));logger[_0x9195('0xe')](_0x9195('0xf'),_0x1cac32,_0x9195('0xd'),JSON[_0x9195('0x10')](_0x22dcc7));if(_0x22dcc7[_0x9195('0x11')]){if(_0x22dcc7[_0x9195('0x11')][_0x9195('0x12')]===0x1f4){logger['error'](_0x9195('0xc'),_0x1cac32,_0x22dcc7[_0x9195('0x11')][_0x9195('0x13')]);return _0x535127(_0x22dcc7['error']['message']);}logger[_0x9195('0x11')]('SACompanyRelationship,\x20%s,\x20%s',_0x1cac32,_0x22dcc7[_0x9195('0x11')][_0x9195('0x13')]);return _0x41dbf7(_0x22dcc7['error'][_0x9195('0x13')]);}else{logger[_0x9195('0x14')](_0x9195('0xc'),_0x1cac32,'request\x20sent');_0x41dbf7(_0x22dcc7[_0x9195('0x15')][_0x9195('0x13')]);}})[_0x9195('0x16')](function(_0x28257b){logger[_0x9195('0x11')](_0x9195('0xc'),_0x1cac32,_0x28257b);_0x535127(_0x28257b);});});} \ No newline at end of file diff --git a/server/api/saCompanyType/index.js b/server/api/saCompanyType/index.js index 770e964..2a2936c 100644 --- a/server/api/saCompanyType/index.js +++ b/server/api/saCompanyType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./saCompanyType.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xe2b8fc,_0x3ec76a){var _0x1bfefb=function(_0x11e1ec){while(--_0x11e1ec){_0xe2b8fc['push'](_0xe2b8fc['shift']());}};_0x1bfefb(++_0x3ec76a);}(_0x008c,0x188));var _0xc008=function(_0x20a394,_0x5c4e0c){_0x20a394=_0x20a394-0x0;var _0x8a454f=_0x008c[_0x20a394];return _0x8a454f;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['put']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['delete'](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saCompanyType.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id'];(function(_0xea16f5,_0x2afb9a){var _0x5aefb7=function(_0x1fc6e2){while(--_0x1fc6e2){_0xea16f5['push'](_0xea16f5['shift']());}};_0x5aefb7(++_0x2afb9a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xf2ca[_0x359377];return _0x8be18a;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xb')]('/:id',auth[_0xaf2c('0x9')](),controller['show']);router[_0xaf2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0x11'),auth[_0xaf2c('0x9')](),controller['update']);router['delete'](_0xaf2c('0x11'),auth[_0xaf2c('0x9')](),controller[_0xaf2c('0x12')]);module[_0xaf2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/saCompanyType/saCompanyType.attributes.js b/server/api/saCompanyType/saCompanyType.attributes.js index ea808cd..be163b1 100644 --- a/server/api/saCompanyType/saCompanyType.attributes.js +++ b/server/api/saCompanyType/saCompanyType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43fd=['exports','STRING'];(function(_0x4a1b21,_0x1b0ca9){var _0x51a8fd=function(_0x4dcffd){while(--_0x4dcffd){_0x4a1b21['push'](_0x4a1b21['shift']());}};_0x51a8fd(++_0x1b0ca9);}(_0x43fd,0x1ec));var _0xd43f=function(_0x17e4c1,_0x20cbf0){_0x17e4c1=_0x17e4c1-0x0;var _0x655418=_0x43fd[_0x17e4c1];return _0x655418;};'use strict';var Sequelize=require('sequelize');module[_0xd43f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'fieldsToCheck':{'type':Sequelize[_0xd43f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','name'];(function(_0x214eea,_0x307aa5){var _0x280550=function(_0x39cc34){while(--_0x39cc34){_0x214eea['push'](_0x214eea['shift']());}};_0x280550(++_0x307aa5);}(_0x98a8,0x12c));var _0x898a=function(_0x4d5d71,_0x4cba11){_0x4d5d71=_0x4d5d71-0x0;var _0x20f425=_0x98a8[_0x4d5d71];return _0x20f425;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![],'unique':_0x898a('0x3')},'fieldsToCheck':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/saCompanyType/saCompanyType.controller.js b/server/api/saCompanyType/saCompanyType.controller.js index 69c4676..2514a1f 100644 --- a/server/api/saCompanyType/saCompanyType.controller.js +++ b/server/api/saCompanyType/saCompanyType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30b3=['catch','params','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','type','key','VIRTUAL','field','options','SACompanyType','include'];(function(_0x2fb325,_0x1d68c5){var _0x46634=function(_0x403db6){while(--_0x403db6){_0x2fb325['push'](_0x2fb325['shift']());}};_0x46634(++_0x1d68c5);}(_0x30b3,0x119));var _0x330b=function(_0x3b7c91,_0x5296fd){_0x3b7c91=_0x3b7c91-0x0;var _0x2587ae=_0x30b3[_0x3b7c91];return _0x2587ae;};'use strict';var pdf=require(_0x330b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x330b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x330b('0x2'));var rp=require(_0x330b('0x3'));var moment=require('moment');var BPromise=require(_0x330b('0x4'));var Mustache=require('mustache');var util=require(_0x330b('0x5'));var path=require(_0x330b('0x6'));var sox=require(_0x330b('0x7'));var csv=require(_0x330b('0x8'));var ejs=require(_0x330b('0x9'));var fs=require('fs');var _=require(_0x330b('0xa'));var squel=require('squel');var crypto=require(_0x330b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x330b('0xc'));var toCsv=require(_0x330b('0x8'));var querystring=require(_0x330b('0xd'));var Papa=require('papaparse');var Redis=require(_0x330b('0xe'));var authService=require(_0x330b('0xf'));var qs=require(_0x330b('0x10'));var hardwareService=require(_0x330b('0x11'));var logger=require(_0x330b('0x12'))(_0x330b('0x13'));var utils=require(_0x330b('0x14'));var config=require('../../config/environment');var db=require(_0x330b('0x15'))['db'];function respondWithStatusCode(_0x4d949a,_0x5c8512){_0x5c8512=_0x5c8512||0xcc;return function(_0x1f9d93){if(_0x1f9d93){return _0x4d949a[_0x330b('0x16')](_0x5c8512);}return _0x4d949a[_0x330b('0x17')](_0x5c8512)[_0x330b('0x18')]();};}function respondWithResult(_0x3c9163,_0x4297d8){_0x4297d8=_0x4297d8||0xc8;return function(_0x426837){if(_0x426837){return _0x3c9163[_0x330b('0x17')](_0x4297d8)[_0x330b('0x19')](_0x426837);}};}function respondWithFilteredResult(_0x28eb5b,_0xcf025c){return function(_0x2b126b){if(_0x2b126b){var _0x430ce8=_0x2b126b[_0x330b('0x1a')],_0x2fa55a=_0xcf025c[_0x330b('0x1b')],_0x52e7d7=_0xcf025c[_0x330b('0x1b')]+_0xcf025c[_0x330b('0x1c')],_0x4f0a76;if(_0x52e7d7>=_0x430ce8){_0x52e7d7=_0x430ce8;_0x4f0a76=0xc8;}else{_0x4f0a76=0xce;}_0x28eb5b[_0x330b('0x17')](_0x4f0a76);return _0x28eb5b[_0x330b('0x1d')](_0x330b('0x1e'),_0x2fa55a+'-'+_0x52e7d7+'/'+_0x430ce8)['json'](_0x2b126b);}return null;};}function patchUpdates(_0x300501){return function(_0x3cc458){try{jsonpatch[_0x330b('0x1f')](_0x3cc458,_0x300501,!![]);}catch(_0x15a377){return BPromise[_0x330b('0x20')](_0x15a377);}return _0x3cc458[_0x330b('0x21')]();};}function saveUpdates(_0x501069,_0x53efe0){return function(_0x358c53){if(_0x358c53){return _0x358c53[_0x330b('0x22')](_0x501069)[_0x330b('0x23')](function(_0xb694f){return _0xb694f;});}return null;};}function removeEntity(_0x4494f9,_0x47c736){return function(_0x414d52){if(_0x414d52){return _0x414d52[_0x330b('0x24')]()[_0x330b('0x23')](function(){_0x4494f9['status'](0xcc)[_0x330b('0x18')]();});}};}function handleEntityNotFound(_0x5d09a0,_0xeccf52){return function(_0x4f8be0){if(!_0x4f8be0){_0x5d09a0[_0x330b('0x16')](0x194);}return _0x4f8be0;};}function handleError(_0x3f2f30,_0x592ce6){_0x592ce6=_0x592ce6||0x1f4;return function(_0x2fe3d8){logger[_0x330b('0x25')](_0x2fe3d8[_0x330b('0x26')]);if(_0x2fe3d8[_0x330b('0x27')]){delete _0x2fe3d8['name'];}_0x3f2f30[_0x330b('0x17')](_0x592ce6)[_0x330b('0x28')](_0x2fe3d8);};}exports['index']=function(_0x586ff4,_0x4aca3e){var _0x48fb90={},_0x4bb80b={},_0x18ff9c={'count':0x0,'rows':[]};var _0x350074=db['SACompanyType'][_0x330b('0x29')];_0x4bb80b['model']=_[_0x330b('0x2a')](_0x350074);_0x4bb80b['query']=_[_0x330b('0x2a')](_0x586ff4[_0x330b('0x2b')]);_0x4bb80b[_0x330b('0x2c')]=_[_0x330b('0x2d')](_0x4bb80b[_0x330b('0x2e')],_0x4bb80b[_0x330b('0x2b')]);_0x48fb90[_0x330b('0x2f')]=_['intersection'](_0x4bb80b['model'],qs[_0x330b('0x30')](_0x586ff4[_0x330b('0x2b')][_0x330b('0x30')]));_0x48fb90[_0x330b('0x2f')]=_0x48fb90['attributes'][_0x330b('0x31')]?_0x48fb90[_0x330b('0x2f')]:_0x4bb80b[_0x330b('0x2e')];if(!_0x586ff4[_0x330b('0x2b')][_0x330b('0x32')](_0x330b('0x33'))){_0x48fb90[_0x330b('0x1c')]=qs[_0x330b('0x1c')](_0x586ff4[_0x330b('0x2b')][_0x330b('0x1c')]);_0x48fb90[_0x330b('0x1b')]=qs[_0x330b('0x1b')](_0x586ff4[_0x330b('0x2b')][_0x330b('0x1b')]);}_0x48fb90['order']=qs[_0x330b('0x34')](_0x586ff4[_0x330b('0x2b')][_0x330b('0x34')]);_0x48fb90['where']=qs[_0x330b('0x2c')](_['pick'](_0x586ff4[_0x330b('0x2b')],_0x4bb80b[_0x330b('0x2c')]));if(_0x586ff4[_0x330b('0x2b')][_0x330b('0x35')]){_0x48fb90[_0x330b('0x36')]=_[_0x330b('0x37')](_0x48fb90[_0x330b('0x36')],{'$or':_[_0x330b('0x38')](_0x350074,function(_0x751084){if(_0x751084[_0x330b('0x39')][_0x330b('0x3a')]!==_0x330b('0x3b')){var _0x1537db={};_0x1537db[_0x751084[_0x330b('0x3c')]]={'$like':'%'+_0x586ff4[_0x330b('0x2b')][_0x330b('0x35')]+'%'};return _0x1537db;}})});}_0x48fb90=_[_0x330b('0x37')]({},_0x48fb90,_0x586ff4[_0x330b('0x3d')]);var _0x3df601={'where':_0x48fb90['where']};return db[_0x330b('0x3e')][_0x330b('0x1a')](_0x3df601)['then'](function(_0x443017){_0x18ff9c[_0x330b('0x1a')]=_0x443017;if(_0x586ff4[_0x330b('0x2b')]['includeAll']){_0x48fb90[_0x330b('0x3f')]=[{'all':!![]}];}return db[_0x330b('0x3e')]['findAll'](_0x48fb90);})[_0x330b('0x23')](function(_0x3eb2bf){_0x18ff9c['rows']=_0x3eb2bf;return _0x18ff9c;})[_0x330b('0x23')](respondWithFilteredResult(_0x4aca3e,_0x48fb90))[_0x330b('0x40')](handleError(_0x4aca3e,null));};exports['show']=function(_0x18ddd9,_0x611178){var _0x36ba29={'raw':![],'where':{'id':_0x18ddd9[_0x330b('0x41')]['id']}},_0x5860f9={};_0x5860f9[_0x330b('0x2e')]=_[_0x330b('0x2a')](db[_0x330b('0x3e')][_0x330b('0x29')]);_0x5860f9[_0x330b('0x2b')]=_[_0x330b('0x2a')](_0x18ddd9[_0x330b('0x2b')]);_0x5860f9[_0x330b('0x2c')]=_[_0x330b('0x2d')](_0x5860f9[_0x330b('0x2e')],_0x5860f9[_0x330b('0x2b')]);_0x36ba29['attributes']=_[_0x330b('0x2d')](_0x5860f9[_0x330b('0x2e')],qs[_0x330b('0x30')](_0x18ddd9[_0x330b('0x2b')]['fields']));_0x36ba29[_0x330b('0x2f')]=_0x36ba29[_0x330b('0x2f')][_0x330b('0x31')]?_0x36ba29[_0x330b('0x2f')]:_0x5860f9[_0x330b('0x2e')];if(_0x18ddd9[_0x330b('0x2b')]['includeAll']){_0x36ba29[_0x330b('0x3f')]=[{'all':!![]}];}_0x36ba29=_[_0x330b('0x37')]({},_0x36ba29,_0x18ddd9['options']);return db[_0x330b('0x3e')]['find'](_0x36ba29)[_0x330b('0x23')](handleEntityNotFound(_0x611178,null))[_0x330b('0x23')](respondWithResult(_0x611178,null))[_0x330b('0x40')](handleError(_0x611178,null));};exports['create']=function(_0x1d54d5,_0x52c164){return db['SACompanyType']['create'](_0x1d54d5[_0x330b('0x42')],{})[_0x330b('0x23')](respondWithResult(_0x52c164,0xc9))[_0x330b('0x40')](handleError(_0x52c164,null));};exports[_0x330b('0x22')]=function(_0x27c2b6,_0x4cee70){if(_0x27c2b6[_0x330b('0x42')]['id']){delete _0x27c2b6[_0x330b('0x42')]['id'];}return db[_0x330b('0x3e')][_0x330b('0x43')]({'where':{'id':_0x27c2b6[_0x330b('0x41')]['id']}})[_0x330b('0x23')](handleEntityNotFound(_0x4cee70,null))[_0x330b('0x23')](saveUpdates(_0x27c2b6[_0x330b('0x42')],null))[_0x330b('0x23')](respondWithResult(_0x4cee70,null))['catch'](handleError(_0x4cee70,null));};exports[_0x330b('0x24')]=function(_0x5d8e8a,_0x3011b6){return db[_0x330b('0x3e')]['find']({'where':{'id':_0x5d8e8a[_0x330b('0x41')]['id']}})[_0x330b('0x23')](handleEntityNotFound(_0x3011b6,null))['then'](removeEntity(_0x3011b6,null))[_0x330b('0x40')](handleError(_0x3011b6,null));};exports[_0x330b('0x44')]=function(_0x360437,_0x57522a){return db[_0x330b('0x3e')][_0x330b('0x44')]()[_0x330b('0x23')](respondWithResult(_0x57522a,null))[_0x330b('0x40')](handleError(_0x57522a,null));}; \ No newline at end of file +var _0x2bbc=['params','length','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','SACompanyType','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','where','filters','pick','filter','merge','type','key','field','options','includeAll','include','rows'];(function(_0x1f97a9,_0x34df0f){var _0xd3d5df=function(_0x7327f1){while(--_0x7327f1){_0x1f97a9['push'](_0x1f97a9['shift']());}};_0xd3d5df(++_0x34df0f);}(_0x2bbc,0x1dc));var _0xc2bb=function(_0x551911,_0x522e8c){_0x551911=_0x551911-0x0;var _0x578831=_0x2bbc[_0x551911];return _0x578831;};'use strict';var pdf=require(_0xc2bb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc2bb('0x1'));var zipdir=require(_0xc2bb('0x2'));var jsonpatch=require(_0xc2bb('0x3'));var rp=require(_0xc2bb('0x4'));var moment=require('moment');var BPromise=require(_0xc2bb('0x5'));var Mustache=require(_0xc2bb('0x6'));var util=require(_0xc2bb('0x7'));var path=require(_0xc2bb('0x8'));var sox=require(_0xc2bb('0x9'));var csv=require(_0xc2bb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc2bb('0xb'));var crypto=require('crypto');var jsforce=require(_0xc2bb('0xc'));var deskjs=require(_0xc2bb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc2bb('0xe'));var Papa=require(_0xc2bb('0xf'));var Redis=require(_0xc2bb('0x10'));var authService=require(_0xc2bb('0x11'));var qs=require(_0xc2bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2bb('0x13'))('api');var utils=require(_0xc2bb('0x14'));var config=require('../../config/environment');var db=require(_0xc2bb('0x15'))['db'];function respondWithStatusCode(_0x526a98,_0x4020d9){_0x4020d9=_0x4020d9||0xcc;return function(_0x5dd113){if(_0x5dd113){return _0x526a98[_0xc2bb('0x16')](_0x4020d9);}return _0x526a98['status'](_0x4020d9)[_0xc2bb('0x17')]();};}function respondWithResult(_0x42a343,_0x127c9b){_0x127c9b=_0x127c9b||0xc8;return function(_0x3c55b2){if(_0x3c55b2){return _0x42a343[_0xc2bb('0x18')](_0x127c9b)[_0xc2bb('0x19')](_0x3c55b2);}};}function respondWithFilteredResult(_0x475724,_0x1bbd10){return function(_0x4fe3a4){if(_0x4fe3a4){var _0x2e3d7d=_0x4fe3a4[_0xc2bb('0x1a')],_0x503ad9=_0x1bbd10[_0xc2bb('0x1b')],_0x38a2a6=_0x1bbd10[_0xc2bb('0x1b')]+_0x1bbd10[_0xc2bb('0x1c')],_0x231946;if(_0x38a2a6>=_0x2e3d7d){_0x38a2a6=_0x2e3d7d;_0x231946=0xc8;}else{_0x231946=0xce;}_0x475724[_0xc2bb('0x18')](_0x231946);return _0x475724[_0xc2bb('0x1d')]('Content-Range',_0x503ad9+'-'+_0x38a2a6+'/'+_0x2e3d7d)['json'](_0x4fe3a4);}return null;};}function patchUpdates(_0x670e35){return function(_0x36e31d){try{jsonpatch[_0xc2bb('0x1e')](_0x36e31d,_0x670e35,!![]);}catch(_0x364485){return BPromise[_0xc2bb('0x1f')](_0x364485);}return _0x36e31d[_0xc2bb('0x20')]();};}function saveUpdates(_0x3e34e3,_0x1964c5){return function(_0x1069e5){if(_0x1069e5){return _0x1069e5[_0xc2bb('0x21')](_0x3e34e3)[_0xc2bb('0x22')](function(_0x51bb25){return _0x51bb25;});}return null;};}function removeEntity(_0x17e6dc,_0x18952c){return function(_0x5e9c2f){if(_0x5e9c2f){return _0x5e9c2f[_0xc2bb('0x23')]()[_0xc2bb('0x22')](function(){_0x17e6dc['status'](0xcc)[_0xc2bb('0x17')]();});}};}function handleEntityNotFound(_0x52c0fd,_0x5cbfd2){return function(_0x44e6a3){if(!_0x44e6a3){_0x52c0fd['sendStatus'](0x194);}return _0x44e6a3;};}function handleError(_0x3ab705,_0x41a202){_0x41a202=_0x41a202||0x1f4;return function(_0xbcaf5a){logger[_0xc2bb('0x24')](_0xbcaf5a['stack']);if(_0xbcaf5a[_0xc2bb('0x25')]){delete _0xbcaf5a[_0xc2bb('0x25')];}_0x3ab705['status'](_0x41a202)['send'](_0xbcaf5a);};}exports['index']=function(_0x369539,_0x1b6317){var _0x320fd3={},_0x22c6f5={},_0xab2107={'count':0x0,'rows':[]};var _0x2b8fe9=db[_0xc2bb('0x26')][_0xc2bb('0x27')];_0x22c6f5[_0xc2bb('0x28')]=_[_0xc2bb('0x29')](_0x2b8fe9);_0x22c6f5[_0xc2bb('0x2a')]=_[_0xc2bb('0x29')](_0x369539[_0xc2bb('0x2a')]);_0x22c6f5['filters']=_[_0xc2bb('0x2b')](_0x22c6f5[_0xc2bb('0x28')],_0x22c6f5[_0xc2bb('0x2a')]);_0x320fd3[_0xc2bb('0x2c')]=_[_0xc2bb('0x2b')](_0x22c6f5[_0xc2bb('0x28')],qs['fields'](_0x369539[_0xc2bb('0x2a')][_0xc2bb('0x2d')]));_0x320fd3['attributes']=_0x320fd3[_0xc2bb('0x2c')]['length']?_0x320fd3[_0xc2bb('0x2c')]:_0x22c6f5['model'];if(!_0x369539[_0xc2bb('0x2a')][_0xc2bb('0x2e')]('nolimit')){_0x320fd3[_0xc2bb('0x1c')]=qs[_0xc2bb('0x1c')](_0x369539['query']['limit']);_0x320fd3[_0xc2bb('0x1b')]=qs[_0xc2bb('0x1b')](_0x369539['query']['offset']);}_0x320fd3[_0xc2bb('0x2f')]=qs['sort'](_0x369539[_0xc2bb('0x2a')]['sort']);_0x320fd3[_0xc2bb('0x30')]=qs[_0xc2bb('0x31')](_[_0xc2bb('0x32')](_0x369539[_0xc2bb('0x2a')],_0x22c6f5[_0xc2bb('0x31')]));if(_0x369539[_0xc2bb('0x2a')][_0xc2bb('0x33')]){_0x320fd3['where']=_[_0xc2bb('0x34')](_0x320fd3[_0xc2bb('0x30')],{'$or':_['map'](_0x2b8fe9,function(_0x2f84d7){if(_0x2f84d7[_0xc2bb('0x35')][_0xc2bb('0x36')]!=='VIRTUAL'){var _0x262dd9={};_0x262dd9[_0x2f84d7[_0xc2bb('0x37')]]={'$like':'%'+_0x369539[_0xc2bb('0x2a')]['filter']+'%'};return _0x262dd9;}})});}_0x320fd3=_[_0xc2bb('0x34')]({},_0x320fd3,_0x369539[_0xc2bb('0x38')]);var _0x34623f={'where':_0x320fd3[_0xc2bb('0x30')]};return db['SACompanyType']['count'](_0x34623f)[_0xc2bb('0x22')](function(_0x145ddd){_0xab2107[_0xc2bb('0x1a')]=_0x145ddd;if(_0x369539['query'][_0xc2bb('0x39')]){_0x320fd3[_0xc2bb('0x3a')]=[{'all':!![]}];}return db[_0xc2bb('0x26')]['findAll'](_0x320fd3);})[_0xc2bb('0x22')](function(_0x19c7ef){_0xab2107[_0xc2bb('0x3b')]=_0x19c7ef;return _0xab2107;})['then'](respondWithFilteredResult(_0x1b6317,_0x320fd3))['catch'](handleError(_0x1b6317,null));};exports['show']=function(_0x114963,_0x8fc77b){var _0x2f033a={'raw':![],'where':{'id':_0x114963[_0xc2bb('0x3c')]['id']}},_0x97e409={};_0x97e409[_0xc2bb('0x28')]=_[_0xc2bb('0x29')](db[_0xc2bb('0x26')][_0xc2bb('0x27')]);_0x97e409[_0xc2bb('0x2a')]=_['keys'](_0x114963['query']);_0x97e409['filters']=_[_0xc2bb('0x2b')](_0x97e409[_0xc2bb('0x28')],_0x97e409['query']);_0x2f033a[_0xc2bb('0x2c')]=_[_0xc2bb('0x2b')](_0x97e409[_0xc2bb('0x28')],qs[_0xc2bb('0x2d')](_0x114963[_0xc2bb('0x2a')][_0xc2bb('0x2d')]));_0x2f033a[_0xc2bb('0x2c')]=_0x2f033a[_0xc2bb('0x2c')][_0xc2bb('0x3d')]?_0x2f033a[_0xc2bb('0x2c')]:_0x97e409['model'];if(_0x114963[_0xc2bb('0x2a')][_0xc2bb('0x39')]){_0x2f033a['include']=[{'all':!![]}];}_0x2f033a=_[_0xc2bb('0x34')]({},_0x2f033a,_0x114963['options']);return db['SACompanyType'][_0xc2bb('0x3e')](_0x2f033a)[_0xc2bb('0x22')](handleEntityNotFound(_0x8fc77b,null))[_0xc2bb('0x22')](respondWithResult(_0x8fc77b,null))[_0xc2bb('0x3f')](handleError(_0x8fc77b,null));};exports[_0xc2bb('0x40')]=function(_0x79ca9f,_0x4c3eca){return db[_0xc2bb('0x26')][_0xc2bb('0x40')](_0x79ca9f[_0xc2bb('0x41')],{})[_0xc2bb('0x22')](respondWithResult(_0x4c3eca,0xc9))['catch'](handleError(_0x4c3eca,null));};exports[_0xc2bb('0x21')]=function(_0x5a80e8,_0x4f874d){if(_0x5a80e8['body']['id']){delete _0x5a80e8[_0xc2bb('0x41')]['id'];}return db['SACompanyType'][_0xc2bb('0x3e')]({'where':{'id':_0x5a80e8[_0xc2bb('0x3c')]['id']}})[_0xc2bb('0x22')](handleEntityNotFound(_0x4f874d,null))[_0xc2bb('0x22')](saveUpdates(_0x5a80e8[_0xc2bb('0x41')],null))[_0xc2bb('0x22')](respondWithResult(_0x4f874d,null))[_0xc2bb('0x3f')](handleError(_0x4f874d,null));};exports[_0xc2bb('0x23')]=function(_0x2cefe8,_0x38e38c){return db[_0xc2bb('0x26')][_0xc2bb('0x3e')]({'where':{'id':_0x2cefe8[_0xc2bb('0x3c')]['id']}})[_0xc2bb('0x22')](handleEntityNotFound(_0x38e38c,null))[_0xc2bb('0x22')](removeEntity(_0x38e38c,null))[_0xc2bb('0x3f')](handleError(_0x38e38c,null));};exports[_0xc2bb('0x42')]=function(_0xd51d13,_0x1164e3){return db[_0xc2bb('0x26')]['describe']()[_0xc2bb('0x22')](respondWithResult(_0x1164e3,null))[_0xc2bb('0x3f')](handleError(_0x1164e3,null));}; \ No newline at end of file diff --git a/server/api/saCompanyType/saCompanyType.model.js b/server/api/saCompanyType/saCompanyType.model.js index 26bb791..bbf3335 100644 --- a/server/api/saCompanyType/saCompanyType.model.js +++ b/server/api/saCompanyType/saCompanyType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b1f=['sa_company_types','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./saCompanyType.attributes','exports','SACompanyType'];(function(_0x26fea6,_0x30877f){var _0x7ab7c5=function(_0x35e603){while(--_0x35e603){_0x26fea6['push'](_0x26fea6['shift']());}};_0x7ab7c5(++_0x30877f);}(_0x3b1f,0x64));var _0xf3b1=function(_0x176dbe,_0x4fc5a1){_0x176dbe=_0x176dbe-0x0;var _0x27784d=_0x3b1f[_0x176dbe];return _0x27784d;};'use strict';var _=require(_0xf3b1('0x0'));var util=require(_0xf3b1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3b1('0x2'));var BPromise=require(_0xf3b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3b1('0x4'));var rimraf=require(_0xf3b1('0x5'));var config=require(_0xf3b1('0x6'));var attributes=require(_0xf3b1('0x7'));module[_0xf3b1('0x8')]=function(_0x2debf6,_0x27200e){return _0x2debf6['define'](_0xf3b1('0x9'),attributes,{'tableName':_0xf3b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff41=['define','SACompanyType','sa_company_types','lodash','../../config/logger','bluebird','request-promise','path','rimraf','exports'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0xff41,0x157));var _0x1ff4=function(_0x4e5215,_0x40374f){_0x4e5215=_0x4e5215-0x0;var _0x44e904=_0xff41[_0x4e5215];return _0x44e904;};'use strict';var _=require(_0x1ff4('0x0'));var util=require('util');var logger=require(_0x1ff4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1ff4('0x2'));var rp=require(_0x1ff4('0x3'));var fs=require('fs');var path=require(_0x1ff4('0x4'));var rimraf=require(_0x1ff4('0x5'));var config=require('../../config/environment');var attributes=require('./saCompanyType.attributes');module[_0x1ff4('0x6')]=function(_0xd96370,_0x12f024){return _0xd96370[_0x1ff4('0x7')](_0x1ff4('0x8'),attributes,{'tableName':_0x1ff4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saCompanyType/saCompanyType.rpc.js b/server/api/saCompanyType/saCompanyType.rpc.js index 0a8fc12..f54b5f9 100644 --- a/server/api/saCompanyType/saCompanyType.rpc.js +++ b/server/api/saCompanyType/saCompanyType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x566f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SACompanyType,\x20%s,\x20%s','request\x20sent','SACompanyType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a2b12,_0x43e228){var _0x667fc8=function(_0x522c0c){while(--_0x522c0c){_0x2a2b12['push'](_0x2a2b12['shift']());}};_0x667fc8(++_0x43e228);}(_0x566f,0x124));var _0xf566=function(_0x25ded3,_0x4bdc27){_0x25ded3=_0x25ded3-0x0;var _0x55825d=_0x566f[_0x25ded3];return _0x55825d;};'use strict';var _=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var moment=require(_0xf566('0x2'));var BPromise=require(_0xf566('0x3'));var rs=require(_0xf566('0x4'));var fs=require('fs');var Redis=require(_0xf566('0x5'));var db=require(_0xf566('0x6'))['db'];var utils=require(_0xf566('0x7'));var logger=require('../../config/logger')(_0xf566('0x8'));var config=require(_0xf566('0x9'));var jayson=require(_0xf566('0xa'));var client=jayson[_0xf566('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xacfc48,_0x354e78,_0x3af552){return new BPromise(function(_0x1e33fa,_0x588e82){return client[_0xf566('0xc')](_0xacfc48,_0x3af552)['then'](function(_0x112610){logger[_0xf566('0xd')](_0xf566('0xe'),_0x354e78,_0xf566('0xf'));logger['debug'](_0xf566('0x10'),_0x354e78,_0xf566('0xf'),JSON[_0xf566('0x11')](_0x112610));if(_0x112610[_0xf566('0x12')]){if(_0x112610[_0xf566('0x12')][_0xf566('0x13')]===0x1f4){logger[_0xf566('0x12')](_0xf566('0xe'),_0x354e78,_0x112610['error'][_0xf566('0x14')]);return _0x588e82(_0x112610[_0xf566('0x12')][_0xf566('0x14')]);}logger[_0xf566('0x12')]('SACompanyType,\x20%s,\x20%s',_0x354e78,_0x112610[_0xf566('0x12')]['message']);return _0x1e33fa(_0x112610['error'][_0xf566('0x14')]);}else{logger[_0xf566('0xd')]('SACompanyType,\x20%s,\x20%s',_0x354e78,_0xf566('0xf'));_0x1e33fa(_0x112610[_0xf566('0x15')]['message']);}})[_0xf566('0x16')](function(_0x5e208d){logger[_0xf566('0x12')]('SACompanyType,\x20%s,\x20%s',_0x354e78,_0x5e208d);_0x588e82(_0x5e208d);});});} \ No newline at end of file +var _0xeef7=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','request','then','info','SACompanyType,\x20%s,\x20%s','request\x20sent','debug','SACompanyType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x28a8ea,_0x43e163){var _0x2f6276=function(_0x17c12e){while(--_0x17c12e){_0x28a8ea['push'](_0x28a8ea['shift']());}};_0x2f6276(++_0x43e163);}(_0xeef7,0x7d));var _0x7eef=function(_0x418082,_0x22f950){_0x418082=_0x418082-0x0;var _0x3a57b5=_0xeef7[_0x418082];return _0x3a57b5;};'use strict';var _=require(_0x7eef('0x0'));var util=require(_0x7eef('0x1'));var moment=require('moment');var BPromise=require(_0x7eef('0x2'));var rs=require(_0x7eef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7eef('0x4'))(_0x7eef('0x5'));var config=require(_0x7eef('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x378a20,_0x4261aa,_0x4283d3){return new BPromise(function(_0x51bca2,_0x3c3c2b){return client[_0x7eef('0x7')](_0x378a20,_0x4283d3)[_0x7eef('0x8')](function(_0x16c390){logger[_0x7eef('0x9')](_0x7eef('0xa'),_0x4261aa,_0x7eef('0xb'));logger[_0x7eef('0xc')](_0x7eef('0xd'),_0x4261aa,'request\x20sent',JSON[_0x7eef('0xe')](_0x16c390));if(_0x16c390[_0x7eef('0xf')]){if(_0x16c390[_0x7eef('0xf')][_0x7eef('0x10')]===0x1f4){logger[_0x7eef('0xf')](_0x7eef('0xa'),_0x4261aa,_0x16c390[_0x7eef('0xf')]['message']);return _0x3c3c2b(_0x16c390[_0x7eef('0xf')][_0x7eef('0x11')]);}logger[_0x7eef('0xf')](_0x7eef('0xa'),_0x4261aa,_0x16c390['error']['message']);return _0x51bca2(_0x16c390[_0x7eef('0xf')][_0x7eef('0x11')]);}else{logger[_0x7eef('0x9')](_0x7eef('0xa'),_0x4261aa,_0x7eef('0xb'));_0x51bca2(_0x16c390[_0x7eef('0x12')][_0x7eef('0x11')]);}})[_0x7eef('0x13')](function(_0x263c33){logger[_0x7eef('0xf')](_0x7eef('0xa'),_0x4261aa,_0x263c33);_0x3c3c2b(_0x263c33);});});} \ No newline at end of file diff --git a/server/api/saCreditNote/index.js b/server/api/saCreditNote/index.js index 80c637a..ded00f9 100644 --- a/server/api/saCreditNote/index.js +++ b/server/api/saCreditNote/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./saCreditNote.controller','get','isAuthenticated','/describe','/:id','/:id/download','getCreditnotePDF','post','update'];(function(_0x32ee50,_0x564493){var _0x12a1b3=function(_0x3d6bc8){while(--_0x3d6bc8){_0x32ee50['push'](_0x32ee50['shift']());}};_0x12a1b3(++_0x564493);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file +var _0xa9e0=['delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./saCreditNote.controller','get','isAuthenticated','/describe','/:id','/:id/download','getCreditnotePDF','post','update'];(function(_0x5572b7,_0x244036){var _0x1bc232=function(_0x338cc0){while(--_0x338cc0){_0x5572b7['push'](_0x5572b7['shift']());}};_0x1bc232(++_0x244036);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/saCreditNote/saCreditNote.attributes.js b/server/api/saCreditNote/saCreditNote.attributes.js index 2d8dd0d..4fc8efc 100644 --- a/server/api/saCreditNote/saCreditNote.attributes.js +++ b/server/api/saCreditNote/saCreditNote.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24f7=['exports','STRING','INTEGER','TEXT','DECIMAL','BOOLEAN','DATE','sequelize'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x24f7,0xf7));var _0x724f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x24f7[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x724f('0x0'));module[_0x724f('0x1')]={'name':{'type':Sequelize[_0x724f('0x2')],'allowNull':![]},'InvoiceId':{'type':Sequelize[_0x724f('0x3')]},'note':{'type':Sequelize[_0x724f('0x4')]},'agentFullname':{'type':Sequelize[_0x724f('0x2')]},'status':{'type':Sequelize[_0x724f('0x4')]},'companyName':{'type':Sequelize['STRING'],'allowNull':![]},'companyId':{'type':Sequelize[_0x724f('0x3')],'allowNull':![]},'paid':{'type':Sequelize[_0x724f('0x3')],'defaultValue':0x0},'discount':{'type':Sequelize[_0x724f('0x5')](0xd,0x4)},'receivingStreet':{'type':Sequelize[_0x724f('0x2')]},'receivingPostalCode':{'type':Sequelize[_0x724f('0x2')]},'receivingCity':{'type':Sequelize[_0x724f('0x2')]},'receivingCountry':{'type':Sequelize[_0x724f('0x2')]},'receivingISOCode':{'type':Sequelize[_0x724f('0x2')](0x3)},'receivingFiscalCode':{'type':Sequelize[_0x724f('0x2')](0x32)},'receivingPIVA':{'type':Sequelize[_0x724f('0x2')](0x32)},'receivingSDICode':{'type':Sequelize[_0x724f('0x2')](0x15)},'receivingFiscalMessage':{'type':Sequelize[_0x724f('0x2')](0x3e8)},'receivingExpiryDay':{'type':Sequelize[_0x724f('0x3')]},'receivingEurope':{'type':Sequelize[_0x724f('0x6')]},'receivingSocCap':{'type':Sequelize[_0x724f('0x2')](0xff)},'issuerName':{'type':Sequelize[_0x724f('0x2')]},'issuerStreet':{'type':Sequelize[_0x724f('0x2')]},'issuerPostalCode':{'type':Sequelize[_0x724f('0x2')]},'issuerCity':{'type':Sequelize['STRING']},'issuerCountry':{'type':Sequelize[_0x724f('0x2')]},'issuerISOCode':{'type':Sequelize[_0x724f('0x2')](0x3)},'issuerFiscalCode':{'type':Sequelize[_0x724f('0x2')](0x32)},'issuerPIVA':{'type':Sequelize[_0x724f('0x2')](0x32)},'issuerSDICode':{'type':Sequelize[_0x724f('0x2')](0x15)},'issuerFiscalMessage':{'type':Sequelize[_0x724f('0x2')]},'issuerExpiryDay':{'type':Sequelize[_0x724f('0x3')]},'issuerEurope':{'type':Sequelize['BOOLEAN']},'issuerSocCap':{'type':Sequelize[_0x724f('0x2')](0xff)},'issuerBankAccount':{'type':Sequelize[_0x724f('0x2')](0xff)},'issuerBankName':{'type':Sequelize[_0x724f('0x2')](0xff)},'issuerBankStreet':{'type':Sequelize[_0x724f('0x2')]},'issuerBankPostalCode':{'type':Sequelize['STRING']},'issuerBankCity':{'type':Sequelize[_0x724f('0x2')]},'issuerBankCountry':{'type':Sequelize[_0x724f('0x2')]},'issuerBankBICSWIFT':{'type':Sequelize['STRING']},'issuerBankIBAN':{'type':Sequelize[_0x724f('0x2')]},'issuerPhone':{'type':Sequelize[_0x724f('0x2')]},'issuerFax':{'type':Sequelize[_0x724f('0x2')]},'issuerEmail':{'type':Sequelize['STRING']},'issuerWeb':{'type':Sequelize[_0x724f('0x2')]},'issuerABI':{'type':Sequelize[_0x724f('0x2')]},'issuerCAB':{'type':Sequelize[_0x724f('0x2')]},'issuerPayPal':{'type':Sequelize['STRING']},'startDate':{'type':Sequelize[_0x724f('0x7')]},'endDate':{'type':Sequelize[_0x724f('0x7')]},'beginningCompetence':{'type':Sequelize['DATE']},'endCompetence':{'type':Sequelize[_0x724f('0x7')]},'clientCode':{'type':Sequelize[_0x724f('0x2')]},'number':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf174=['STRING','DECIMAL','BOOLEAN','DATE','sequelize','exports','INTEGER','TEXT'];(function(_0x4ec65a,_0x33a77d){var _0x4b73ab=function(_0x454617){while(--_0x454617){_0x4ec65a['push'](_0x4ec65a['shift']());}};_0x4b73ab(++_0x33a77d);}(_0xf174,0x1c4));var _0x4f17=function(_0xa37c9c,_0x3de9e8){_0xa37c9c=_0xa37c9c-0x0;var _0x2bdb44=_0xf174[_0xa37c9c];return _0x2bdb44;};'use strict';var Sequelize=require(_0x4f17('0x0'));module[_0x4f17('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'InvoiceId':{'type':Sequelize[_0x4f17('0x2')]},'note':{'type':Sequelize[_0x4f17('0x3')]},'agentFullname':{'type':Sequelize[_0x4f17('0x4')]},'status':{'type':Sequelize[_0x4f17('0x3')]},'companyName':{'type':Sequelize[_0x4f17('0x4')],'allowNull':![]},'companyId':{'type':Sequelize[_0x4f17('0x2')],'allowNull':![]},'paid':{'type':Sequelize[_0x4f17('0x2')],'defaultValue':0x0},'discount':{'type':Sequelize[_0x4f17('0x5')](0xd,0x4)},'receivingStreet':{'type':Sequelize[_0x4f17('0x4')]},'receivingPostalCode':{'type':Sequelize[_0x4f17('0x4')]},'receivingCity':{'type':Sequelize[_0x4f17('0x4')]},'receivingCountry':{'type':Sequelize['STRING']},'receivingISOCode':{'type':Sequelize['STRING'](0x3)},'receivingFiscalCode':{'type':Sequelize[_0x4f17('0x4')](0x32)},'receivingPIVA':{'type':Sequelize[_0x4f17('0x4')](0x32)},'receivingSDICode':{'type':Sequelize[_0x4f17('0x4')](0x15)},'receivingFiscalMessage':{'type':Sequelize[_0x4f17('0x4')](0x3e8)},'receivingExpiryDay':{'type':Sequelize[_0x4f17('0x2')]},'receivingEurope':{'type':Sequelize[_0x4f17('0x6')]},'receivingSocCap':{'type':Sequelize[_0x4f17('0x4')](0xff)},'issuerName':{'type':Sequelize[_0x4f17('0x4')]},'issuerStreet':{'type':Sequelize[_0x4f17('0x4')]},'issuerPostalCode':{'type':Sequelize['STRING']},'issuerCity':{'type':Sequelize[_0x4f17('0x4')]},'issuerCountry':{'type':Sequelize['STRING']},'issuerISOCode':{'type':Sequelize[_0x4f17('0x4')](0x3)},'issuerFiscalCode':{'type':Sequelize['STRING'](0x32)},'issuerPIVA':{'type':Sequelize[_0x4f17('0x4')](0x32)},'issuerSDICode':{'type':Sequelize['STRING'](0x15)},'issuerFiscalMessage':{'type':Sequelize[_0x4f17('0x4')]},'issuerExpiryDay':{'type':Sequelize[_0x4f17('0x2')]},'issuerEurope':{'type':Sequelize[_0x4f17('0x6')]},'issuerSocCap':{'type':Sequelize[_0x4f17('0x4')](0xff)},'issuerBankAccount':{'type':Sequelize['STRING'](0xff)},'issuerBankName':{'type':Sequelize[_0x4f17('0x4')](0xff)},'issuerBankStreet':{'type':Sequelize['STRING']},'issuerBankPostalCode':{'type':Sequelize[_0x4f17('0x4')]},'issuerBankCity':{'type':Sequelize[_0x4f17('0x4')]},'issuerBankCountry':{'type':Sequelize['STRING']},'issuerBankBICSWIFT':{'type':Sequelize[_0x4f17('0x4')]},'issuerBankIBAN':{'type':Sequelize['STRING']},'issuerPhone':{'type':Sequelize['STRING']},'issuerFax':{'type':Sequelize[_0x4f17('0x4')]},'issuerEmail':{'type':Sequelize[_0x4f17('0x4')]},'issuerWeb':{'type':Sequelize['STRING']},'issuerABI':{'type':Sequelize[_0x4f17('0x4')]},'issuerCAB':{'type':Sequelize[_0x4f17('0x4')]},'issuerPayPal':{'type':Sequelize[_0x4f17('0x4')]},'startDate':{'type':Sequelize[_0x4f17('0x7')]},'endDate':{'type':Sequelize[_0x4f17('0x7')]},'beginningCompetence':{'type':Sequelize[_0x4f17('0x7')]},'endCompetence':{'type':Sequelize[_0x4f17('0x7')]},'clientCode':{'type':Sequelize[_0x4f17('0x4')]},'number':{'type':Sequelize[_0x4f17('0x2')]}}; \ No newline at end of file diff --git a/server/api/saCreditNote/saCreditNote.controller.js b/server/api/saCreditNote/saCreditNote.controller.js index 287e3c5..ac21c25 100644 --- a/server/api/saCreditNote/saCreditNote.controller.js +++ b/server/api/saCreditNote/saCreditNote.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc57=['BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','creditnote','receivingCountry','Italy','\x20','','\x20%s
','issuerName','%s
','issuerStreet','issuerPostalCode','\x20%s','-\x20%s\x20
','issuerCountry',':\x20%s
','issuerPhone','email','issuerEmail','piva','issuerPIVA','issuerFiscalCode','sdi','issuerSDICode','issuerSocCap','','%s','companyName','receivingStreet','%s\x20-\x20','receivingPostalCode','receivingFiscalCode','receivingPIVA','receivingSDICode','','','%s,\x20','updatedAt','DD/MM/YYYY','%s\x20','add','saExpiryDay','days','','duedate','','','description','hrsqty','unitprice','netPrice','discount','tax','quantity','%s','%d','toFixed','\x20€','','','isNil','indexOf','split\x20payment','','','\x20','','total','','nettopay','','\x20','','receivingFiscalMessage','replace','fromCharCode','','','sendpayment',':','issuerBankAccount',':\x20','','bankname','issuerBankName','\x20','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','abi','issuerCAB','swif','issuerBankBICSWIFT','iban','issuerBankIBAN','issuerPayPal','paypal','','','thank2','
','','','toFile','TCL:\x20exports.getCreditnotePDF\x20->\x20saveTo,\x20fileName','download','err','foldername','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','SACreditNote','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getCreditnotePDF','unix','toString','join','root','tmp','server','images','logos','logo-invoice.png','paid-invoice.png','format','Credinote_%s-%s.pdf','SACreditNoteDetail','details','portrait','10mm','footer','default','contents','','issuerWeb','','mkdirSync','','\x20\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}','Phone','Fax','Email','Tax\x20code','I.S.\x20code','Invoice','Fattura','Proforma','Due\x20date','Item','Articolo','Description','Descrizione','Hrs/Qty','Unit\x20Price','Sub\x20Total','Sub\x20Totale','Discount','Sconto','Subtotal','Tasse','Total','Totale','Please\x20send\x20PAYMENT\x20to','Conto\x20intestato\x20a','Bank\x20name','Indirizzo\x20banca','ABI','CAB'];(function(_0x181d1b,_0x3ed004){var _0x2887d6=function(_0x51b45e){while(--_0x51b45e){_0x181d1b['push'](_0x181d1b['shift']());}};_0x2887d6(++_0x3ed004);}(_0xcc57,0x168));var _0x7cc5=function(_0x263520,_0x271c36){_0x263520=_0x263520-0x0;var _0x4b27a1=_0xcc57[_0x263520];return _0x4b27a1;};'use strict';var pdf=require(_0x7cc5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7cc5('0x1'));var zipdir=require(_0x7cc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cc5('0x3'));var moment=require(_0x7cc5('0x4'));var BPromise=require(_0x7cc5('0x5'));var Mustache=require(_0x7cc5('0x6'));var util=require(_0x7cc5('0x7'));var path=require(_0x7cc5('0x8'));var sox=require('sox');var csv=require(_0x7cc5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7cc5('0xa'));var squel=require('squel');var crypto=require(_0x7cc5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7cc5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7cc5('0xc'));var authService=require(_0x7cc5('0xd'));var qs=require(_0x7cc5('0xe'));var hardwareService=require(_0x7cc5('0xf'));var logger=require(_0x7cc5('0x10'))(_0x7cc5('0x11'));var utils=require(_0x7cc5('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302cb5,_0x3af795){_0x3af795=_0x3af795||0xcc;return function(_0x16d8eb){if(_0x16d8eb){return _0x302cb5[_0x7cc5('0x13')](_0x3af795);}return _0x302cb5[_0x7cc5('0x14')](_0x3af795)[_0x7cc5('0x15')]();};}function respondWithResult(_0x1fc085,_0x3ad26d){_0x3ad26d=_0x3ad26d||0xc8;return function(_0x2d7004){if(_0x2d7004){return _0x1fc085[_0x7cc5('0x14')](_0x3ad26d)[_0x7cc5('0x16')](_0x2d7004);}};}function respondWithFilteredResult(_0x5ed19c,_0x58718b){return function(_0x5938b0){if(_0x5938b0){var _0x2e0ed2=_0x5938b0[_0x7cc5('0x17')],_0x20dbce=_0x58718b[_0x7cc5('0x18')],_0x4c9e8d=_0x58718b[_0x7cc5('0x18')]+_0x58718b[_0x7cc5('0x19')],_0x40a835;if(_0x4c9e8d>=_0x2e0ed2){_0x4c9e8d=_0x2e0ed2;_0x40a835=0xc8;}else{_0x40a835=0xce;}_0x5ed19c[_0x7cc5('0x14')](_0x40a835);return _0x5ed19c[_0x7cc5('0x1a')]('Content-Range',_0x20dbce+'-'+_0x4c9e8d+'/'+_0x2e0ed2)[_0x7cc5('0x16')](_0x5938b0);}return null;};}function patchUpdates(_0x1af592){return function(_0x4450d7){try{jsonpatch[_0x7cc5('0x1b')](_0x4450d7,_0x1af592,!![]);}catch(_0x5a3d12){return BPromise[_0x7cc5('0x1c')](_0x5a3d12);}return _0x4450d7[_0x7cc5('0x1d')]();};}function saveUpdates(_0x4e9d18,_0x441fed){return function(_0x363759){if(_0x363759){return _0x363759[_0x7cc5('0x1e')](_0x4e9d18)[_0x7cc5('0x1f')](function(_0x4dd44d){return _0x4dd44d;});}return null;};}function removeEntity(_0x5d3da1,_0x3fa085){return function(_0x5ca2d4){if(_0x5ca2d4){return _0x5ca2d4[_0x7cc5('0x20')]()[_0x7cc5('0x1f')](function(){_0x5d3da1[_0x7cc5('0x14')](0xcc)[_0x7cc5('0x15')]();});}};}function handleEntityNotFound(_0x2d6bff,_0x1b2a8b){return function(_0x16f16e){if(!_0x16f16e){_0x2d6bff[_0x7cc5('0x13')](0x194);}return _0x16f16e;};}function handleError(_0x54c3d4,_0x239af7){_0x239af7=_0x239af7||0x1f4;return function(_0x40b1f5){logger[_0x7cc5('0x21')](_0x40b1f5[_0x7cc5('0x22')]);if(_0x40b1f5[_0x7cc5('0x23')]){delete _0x40b1f5[_0x7cc5('0x23')];}_0x54c3d4[_0x7cc5('0x14')](_0x239af7)[_0x7cc5('0x24')](_0x40b1f5);};}exports['index']=function(_0x4b2481,_0x495a49){var _0x300dbb={},_0x531212={},_0x708c39={'count':0x0,'rows':[]};var _0x55ebce=db[_0x7cc5('0x25')][_0x7cc5('0x26')];_0x531212[_0x7cc5('0x27')]=_[_0x7cc5('0x28')](_0x55ebce);_0x531212[_0x7cc5('0x29')]=_[_0x7cc5('0x28')](_0x4b2481[_0x7cc5('0x29')]);_0x531212[_0x7cc5('0x2a')]=_['intersection'](_0x531212[_0x7cc5('0x27')],_0x531212[_0x7cc5('0x29')]);_0x300dbb[_0x7cc5('0x2b')]=_[_0x7cc5('0x2c')](_0x531212[_0x7cc5('0x27')],qs[_0x7cc5('0x2d')](_0x4b2481[_0x7cc5('0x29')][_0x7cc5('0x2d')]));_0x300dbb[_0x7cc5('0x2b')]=_0x300dbb[_0x7cc5('0x2b')][_0x7cc5('0x2e')]?_0x300dbb[_0x7cc5('0x2b')]:_0x531212['model'];if(!_0x4b2481[_0x7cc5('0x29')]['hasOwnProperty'](_0x7cc5('0x2f'))){_0x300dbb[_0x7cc5('0x19')]=qs[_0x7cc5('0x19')](_0x4b2481[_0x7cc5('0x29')][_0x7cc5('0x19')]);_0x300dbb['offset']=qs[_0x7cc5('0x18')](_0x4b2481[_0x7cc5('0x29')][_0x7cc5('0x18')]);}_0x300dbb[_0x7cc5('0x30')]=qs[_0x7cc5('0x31')](_0x4b2481[_0x7cc5('0x29')][_0x7cc5('0x31')]);_0x300dbb[_0x7cc5('0x32')]=qs[_0x7cc5('0x2a')](_[_0x7cc5('0x33')](_0x4b2481[_0x7cc5('0x29')],_0x531212[_0x7cc5('0x2a')]));if(_0x4b2481[_0x7cc5('0x29')][_0x7cc5('0x34')]){_0x300dbb[_0x7cc5('0x32')]=_[_0x7cc5('0x35')](_0x300dbb[_0x7cc5('0x32')],{'$or':_[_0x7cc5('0x36')](_0x55ebce,function(_0x544782){if(_0x544782['type'][_0x7cc5('0x37')]!==_0x7cc5('0x38')){var _0x34001a={};_0x34001a[_0x544782[_0x7cc5('0x39')]]={'$like':'%'+_0x4b2481[_0x7cc5('0x29')]['filter']+'%'};return _0x34001a;}})});}_0x300dbb=_['merge']({},_0x300dbb,_0x4b2481['options']);var _0xc7916e={'where':_0x300dbb['where']};return db[_0x7cc5('0x25')][_0x7cc5('0x17')](_0xc7916e)['then'](function(_0x1f4d02){_0x708c39[_0x7cc5('0x17')]=_0x1f4d02;if(_0x4b2481['query'][_0x7cc5('0x3a')]){_0x300dbb[_0x7cc5('0x3b')]=[{'all':!![]}];}return db[_0x7cc5('0x25')][_0x7cc5('0x3c')](_0x300dbb);})[_0x7cc5('0x1f')](function(_0x5b7e46){_0x708c39[_0x7cc5('0x3d')]=_0x5b7e46;return _0x708c39;})[_0x7cc5('0x1f')](respondWithFilteredResult(_0x495a49,_0x300dbb))[_0x7cc5('0x3e')](handleError(_0x495a49,null));};exports[_0x7cc5('0x3f')]=function(_0x4534ee,_0x325c10){var _0x20a1c6={'raw':![],'where':{'id':_0x4534ee[_0x7cc5('0x40')]['id']}},_0x1fcae5={};_0x1fcae5[_0x7cc5('0x27')]=_[_0x7cc5('0x28')](db[_0x7cc5('0x25')][_0x7cc5('0x26')]);_0x1fcae5[_0x7cc5('0x29')]=_[_0x7cc5('0x28')](_0x4534ee[_0x7cc5('0x29')]);_0x1fcae5[_0x7cc5('0x2a')]=_[_0x7cc5('0x2c')](_0x1fcae5[_0x7cc5('0x27')],_0x1fcae5[_0x7cc5('0x29')]);_0x20a1c6[_0x7cc5('0x2b')]=_[_0x7cc5('0x2c')](_0x1fcae5[_0x7cc5('0x27')],qs['fields'](_0x4534ee[_0x7cc5('0x29')][_0x7cc5('0x2d')]));_0x20a1c6[_0x7cc5('0x2b')]=_0x20a1c6[_0x7cc5('0x2b')][_0x7cc5('0x2e')]?_0x20a1c6['attributes']:_0x1fcae5[_0x7cc5('0x27')];if(_0x4534ee[_0x7cc5('0x29')][_0x7cc5('0x3a')]){_0x20a1c6[_0x7cc5('0x3b')]=[{'all':!![]}];}_0x20a1c6=_[_0x7cc5('0x35')]({},_0x20a1c6,_0x4534ee['options']);return db[_0x7cc5('0x25')][_0x7cc5('0x41')](_0x20a1c6)[_0x7cc5('0x1f')](handleEntityNotFound(_0x325c10,null))[_0x7cc5('0x1f')](respondWithResult(_0x325c10,null))[_0x7cc5('0x3e')](handleError(_0x325c10,null));};exports[_0x7cc5('0x42')]=function(_0x2737b5,_0x62d411){return db[_0x7cc5('0x25')]['create'](_0x2737b5[_0x7cc5('0x43')],{})[_0x7cc5('0x1f')](respondWithResult(_0x62d411,0xc9))[_0x7cc5('0x3e')](handleError(_0x62d411,null));};exports[_0x7cc5('0x1e')]=function(_0x4b6a9e,_0x14a84b){if(_0x4b6a9e[_0x7cc5('0x43')]['id']){delete _0x4b6a9e[_0x7cc5('0x43')]['id'];}return db[_0x7cc5('0x25')]['find']({'where':{'id':_0x4b6a9e[_0x7cc5('0x40')]['id']}})[_0x7cc5('0x1f')](handleEntityNotFound(_0x14a84b,null))[_0x7cc5('0x1f')](saveUpdates(_0x4b6a9e[_0x7cc5('0x43')],null))[_0x7cc5('0x1f')](respondWithResult(_0x14a84b,null))[_0x7cc5('0x3e')](handleError(_0x14a84b,null));};exports[_0x7cc5('0x20')]=function(_0x2300f2,_0x170e4c){return db[_0x7cc5('0x25')][_0x7cc5('0x41')]({'where':{'id':_0x2300f2[_0x7cc5('0x40')]['id']}})[_0x7cc5('0x1f')](handleEntityNotFound(_0x170e4c,null))['then'](removeEntity(_0x170e4c,null))['catch'](handleError(_0x170e4c,null));};exports['describe']=function(_0x3c398d,_0x20b9db){return db['SACreditNote'][_0x7cc5('0x44')]()['then'](respondWithResult(_0x20b9db,null))[_0x7cc5('0x3e')](handleError(_0x20b9db,null));};exports[_0x7cc5('0x45')]=function(_0x5ae321,_0x4fbb0a){var _0xe66608=moment()[_0x7cc5('0x46')]()[_0x7cc5('0x47')]();var _0x549e4b=path[_0x7cc5('0x48')](config[_0x7cc5('0x49')],'server','files',_0x7cc5('0x4a'));var _0x349c6c=path[_0x7cc5('0x48')](config[_0x7cc5('0x49')],_0x7cc5('0x4b'),'files',_0x7cc5('0x4c'),_0x7cc5('0x4d'),_0x7cc5('0x4e'));var _0x11c8a9=path[_0x7cc5('0x48')](config[_0x7cc5('0x49')],'server','files',_0x7cc5('0x4c'),_0x7cc5('0x4d'),_0x7cc5('0x4f'));var _0x15c67b=path[_0x7cc5('0x48')](_0x549e4b,_0xe66608);var _0x90eccc=util[_0x7cc5('0x50')](_0x7cc5('0x51'),_0x5ae321[_0x7cc5('0x40')]['id'],_0xe66608);var _0x2fda7d=path[_0x7cc5('0x48')](_0x15c67b,_0x90eccc);var _0x255f37=![];var _0x11fab6={};return db[_0x7cc5('0x25')][_0x7cc5('0x41')]({'where':{'id':_0x5ae321[_0x7cc5('0x40')]['id']},'raw':!![]})[_0x7cc5('0x1f')](handleEntityNotFound(_0x4fbb0a,null))[_0x7cc5('0x1f')](function(_0x50e2f1){if(_0x50e2f1){_0x11fab6['creditnote']=_0x50e2f1;return db[_0x7cc5('0x52')]['findAll']({'where':{'CreditNoteId':_0x50e2f1['id']},'raw':!![],'logging':console['log']})[_0x7cc5('0x1f')](function(_0x4c82e5){_0x11fab6[_0x7cc5('0x53')]=_0x4c82e5;_0x255f37=!![];var _0x5e24c4='';var _0x4e8e2d={'format':'A4','orientation':_0x7cc5('0x54'),'border':'1cm','footer':{'height':_0x7cc5('0x55'),'contents':{'default':'{{page}}/{{pages}}'}}};_0x4e8e2d[_0x7cc5('0x56')]['contents'][_0x7cc5('0x57')]=_0x4e8e2d[_0x7cc5('0x56')][_0x7cc5('0x58')][_0x7cc5('0x57')]+_0x7cc5('0x59')+_0x11fab6['creditnote'][_0x7cc5('0x5a')]+_0x7cc5('0x5b');fs[_0x7cc5('0x5c')](_0x15c67b);_0x5e24c4=_0x7cc5('0x5d');_0x5e24c4+=_0x7cc5('0x5e');_0x5e24c4+='';var _0x2abbbc={'phone':{'en':_0x7cc5('0x5f'),'it':'Telefono'},'fax':{'en':_0x7cc5('0x60'),'it':'Fax'},'email':{'en':_0x7cc5('0x61'),'it':'Email'},'piva':{'en':'VAT\x20number','it':'P.IVA'},'cf':{'en':_0x7cc5('0x62'),'it':'C.F.'},'sdi':{'en':_0x7cc5('0x63'),'it':'Codice\x20S.D.I.'},'cs':{'en':'Soc.Cap.\x20fp','it':'Cap.Soc.\x20iv'},'invoice':{'en':_0x7cc5('0x64'),'it':_0x7cc5('0x65')},'proforma':{'en':_0x7cc5('0x66'),'it':_0x7cc5('0x66')},'creditnote':{'en':'Credit\x20note','it':'Nota\x20di\x20credito'},'duedate':{'en':_0x7cc5('0x67'),'it':'Scadenza'},'item':{'en':_0x7cc5('0x68'),'it':_0x7cc5('0x69')},'description':{'en':_0x7cc5('0x6a'),'it':_0x7cc5('0x6b')},'hrsqty':{'en':_0x7cc5('0x6c'),'it':'Ore/Qta'},'unitprice':{'en':_0x7cc5('0x6d'),'it':'Prezzo\x20Unitario'},'subtotal':{'en':_0x7cc5('0x6e'),'it':_0x7cc5('0x6f')},'discount':{'en':_0x7cc5('0x70'),'it':_0x7cc5('0x71')},'total':{'en':_0x7cc5('0x72'),'it':'Imponibile'},'tax':{'en':'Tax','it':_0x7cc5('0x73')},'nettopay':{'en':_0x7cc5('0x74'),'it':_0x7cc5('0x75')},'sendpayment':{'en':_0x7cc5('0x76'),'it':'Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a'},'accountholder':{'en':'Account\x20Holder','it':_0x7cc5('0x77')},'bankname':{'en':_0x7cc5('0x78'),'it':'Nome\x20banca'},'bankaddress':{'en':'Bank\x20Address','it':_0x7cc5('0x79')},'abi':{'en':_0x7cc5('0x7a'),'it':_0x7cc5('0x7a')},'cab':{'en':_0x7cc5('0x7b'),'it':_0x7cc5('0x7b')},'bic':{'en':'BIC','it':_0x7cc5('0x7c')},'swif':{'en':_0x7cc5('0x7d'),'it':_0x7cc5('0x7d')},'iban':{'en':'IBAN','it':_0x7cc5('0x7e')},'paypal':{'en':_0x7cc5('0x7f'),'it':_0x7cc5('0x80')},'thank1':{'en':_0x7cc5('0x81'),'it':_0x7cc5('0x82')},'thank2':{'en':_0x7cc5('0x83'),'it':_0x7cc5('0x84')}};var _0x3d5709='it';if(_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x86')]!==_0x7cc5('0x87')){_0x3d5709='en';}_0x5e24c4+='';_0x5e24c4+=_0x7cc5('0x88')+_0x349c6c+_0x7cc5('0x89');_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0x8b'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x8c')]);_0x5e24c4+=util['format'](_0x7cc5('0x8d'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x8e')]);_0x5e24c4+=util[_0x7cc5('0x50')]('%s',_0x11fab6['creditnote'][_0x7cc5('0x8f')]);_0x5e24c4+=util['format'](_0x7cc5('0x90'),_0x11fab6[_0x7cc5('0x85')]['issuerCity']);_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0x91'),_0x11fab6['creditnote'][_0x7cc5('0x92')]);_0x5e24c4+=util[_0x7cc5('0x50')]('-\x20%s\x20
',_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x92')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc['phone'][_0x3d5709]+_0x7cc5('0x93'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x94')]);_0x5e24c4+=util['format'](_0x2abbbc['fax'][_0x3d5709]+':\x20%s
',_0x11fab6['creditnote']['issuerFax']);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc[_0x7cc5('0x95')][_0x3d5709]+_0x7cc5('0x8d'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x96')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc[_0x7cc5('0x97')][_0x3d5709]+':\x20%s
',_0x11fab6['creditnote'][_0x7cc5('0x98')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc['cf'][_0x3d5709]+_0x7cc5('0x93'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x99')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc[_0x7cc5('0x9a')][_0x3d5709]+_0x7cc5('0x8d'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x9b')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc['cs'][_0x3d5709]+_0x7cc5('0x93'),_0x11fab6['creditnote'][_0x7cc5('0x9c')]);_0x5e24c4+='';_0x5e24c4+='';_0x5e24c4+=_0x7cc5('0x9d');_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0x9e'),_0x11fab6['creditnote'][_0x7cc5('0x9f')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0x8d'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xa0')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0xa1'),_0x11fab6['creditnote'][_0x7cc5('0xa2')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0x8d'),_0x11fab6[_0x7cc5('0x85')]['receivingCity']);_0x5e24c4+=util[_0x7cc5('0x50')]('%s
',_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0x86')]);_0x5e24c4+=util[_0x7cc5('0x50')](''+_0x2abbbc['cf'][_0x3d5709]+_0x7cc5('0x93'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xa3')]);_0x5e24c4+=util[_0x7cc5('0x50')](_0x2abbbc[_0x7cc5('0x97')][_0x3d5709]+_0x7cc5('0x93'),_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xa4')]);_0x5e24c4+=util['format'](_0x2abbbc[_0x7cc5('0x9a')][_0x3d5709]+':\x20%s
',_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xa5')]);_0x5e24c4+='';_0x5e24c4+=_0x7cc5('0xa6');_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=_0x7cc5('0xa7');_0x5e24c4+=util['format'](''+_0x2abbbc[_0x7cc5('0x85')][_0x3d5709]+'\x20N.%d',_0x50e2f1['id']);_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0xa8'),_0x11fab6[_0x7cc5('0x85')]['issuerCity']);var _0x12b34a=moment(_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xa9')])[_0x7cc5('0x50')](_0x7cc5('0xaa'));_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0xab'),_0x12b34a);var _0x5ac750=moment(_0x11fab6[_0x7cc5('0x85')]['updatedAt'])[_0x7cc5('0xac')](_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xad')],_0x7cc5('0xae'))[_0x7cc5('0x50')]('DD/MM/YYYY');_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0xaf')+_0x2abbbc[_0x7cc5('0xb0')][_0x3d5709]+':\x20%s',_0x5ac750);_0x5e24c4+=_0x7cc5('0xa6');_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+='';_0x5e24c4+='';_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=_0x7cc5('0xb1')+_0x2abbbc['item'][_0x3d5709]+_0x7cc5('0xb2');_0x5e24c4+=''+_0x2abbbc[_0x7cc5('0xb3')][_0x3d5709]+_0x7cc5('0xb2');_0x5e24c4+=_0x7cc5('0xb1')+_0x2abbbc[_0x7cc5('0xb4')][_0x3d5709]+'';_0x5e24c4+=_0x7cc5('0xb1')+_0x2abbbc[_0x7cc5('0xb5')][_0x3d5709]+_0x7cc5('0xb2');_0x5e24c4+=_0x7cc5('0xb1')+_0x2abbbc['subtotal'][_0x3d5709]+_0x7cc5('0xb2');_0x5e24c4+='';var _0x5a593a=0x0;var _0x27d5cb=0x0;for(var _0x4e2e05=0x0;_0x4e2e05<_0x11fab6[_0x7cc5('0x53')][_0x7cc5('0x2e')];_0x4e2e05++){var _0x2f1da7=0x0;var _0x16d817=0x0;var _0x42f05d=0x0;var _0x3dd534=0x0;_0x2f1da7=_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb6')]-_0x11fab6['details'][_0x4e2e05][_0x7cc5('0xb6')]/0x64*_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb7')];_0x16d817=_0x2f1da7/0x64*_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb8')];_0x42f05d=_0x2f1da7*_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb9')];_0x3dd534=_0x16d817*_0x11fab6['details'][_0x4e2e05][_0x7cc5('0xb9')];_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=util[_0x7cc5('0x50')]('%s',_0x11fab6['details'][_0x4e2e05]['productName']);_0x5e24c4+=util[_0x7cc5('0x50')](_0x7cc5('0xba'),_0x11fab6[_0x7cc5('0x53')][_0x4e2e05]['productDescription']);_0x5e24c4+=util['format'](_0x7cc5('0xbb'),_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb9')]);_0x5e24c4+=''+_0x2f1da7[_0x7cc5('0xbc')](0x2)+_0x7cc5('0xbd');_0x5e24c4+=_0x7cc5('0xbe')+_0x42f05d[_0x7cc5('0xbc')](0x2)+_0x7cc5('0xbd');_0x5e24c4+='';_0x5a593a+=_0x42f05d;_0x27d5cb+=_0x3dd534;}_0x5e24c4+=_0x7cc5('0xbf');if(!_[_0x7cc5('0xc0')](_0x11fab6[_0x7cc5('0x85')]['discount'])){var _0x16950e=0x0;var _0xdee00a=0x0;var _0x3682bd=_0x11fab6['creditnote']['discount']*0x64/_0x5a593a;for(var _0x4e2e05=0x0;_0x4e2e05<_0x11fab6['details']['length'];_0x4e2e05++){var _0x1b9452=0x0;var _0x4e12dd=0x0;var _0x1e2bb6=0x0;_0x2f1da7=_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb6')]-_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb6')]/0x64*_0x11fab6['details'][_0x4e2e05][_0x7cc5('0xb7')];_0x1b9452=_0x2f1da7/0x64*_0x3682bd;_0x4e12dd=_0x2f1da7-_0x1b9452;_0x1e2bb6=_0x4e12dd*_0x11fab6[_0x7cc5('0x53')][_0x4e2e05][_0x7cc5('0xb9')];_0x16950e+=_0x1e2bb6;_0xdee00a+=_0x1e2bb6/0x64*_0x11fab6['details'][_0x4e2e05]['tax'];}}var _0x236de7=0x0;var _0x4fd245=0x0;var _0x67c9eb=![];var _0x5cfd10=_0x11fab6[_0x7cc5('0x85')]['receivingFiscalMessage'];if(_0x5cfd10[_0x7cc5('0xc1')](_0x7cc5('0xc2'))!=-0x1){_0x67c9eb=!![];}if(!_[_0x7cc5('0xc0')](_0x11fab6['creditnote'][_0x7cc5('0xb7')])){_0x5e24c4+=_0x7cc5('0x8a');if(_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xb7')]>0x0){_0x5e24c4+=_0x7cc5('0xc3')+_0x2abbbc[_0x7cc5('0xb7')][_0x3d5709]+_0x7cc5('0xc4');_0x5e24c4+=_0x7cc5('0xc5')+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xb7')]['toFixed'](0x2)+_0x7cc5('0xbd');}_0x5e24c4+=_0x7cc5('0xa6');_0x236de7=_0xdee00a;_0x4fd245=_0x16950e;}else{_0x236de7=_0x27d5cb;_0x4fd245=_0x5a593a;}if(_0x236de7>0x0||_0x11fab6['creditnote']['discount']>0x0){_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=_0x7cc5('0xc6')+_0x2abbbc[_0x7cc5('0xc7')][_0x3d5709]+_0x7cc5('0xc4');_0x5e24c4+=_0x7cc5('0xbe')+_0x4fd245[_0x7cc5('0xbc')](0x2)+_0x7cc5('0xbd');_0x5e24c4+=_0x7cc5('0xa6');}if(_0x236de7>0x0){_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=_0x7cc5('0xc6')+_0x2abbbc['tax'][_0x3d5709]+_0x7cc5('0xc4');_0x5e24c4+=_0x7cc5('0xbe')+_0x236de7[_0x7cc5('0xbc')](0x2)+_0x7cc5('0xbd');_0x5e24c4+='';}_0x5e24c4+=_0x7cc5('0x8a');var _0x17e215;if(_0x67c9eb){_0x17e215=_0x4fd245;}else{_0x17e215=_0x4fd245+_0x236de7;}_0x5e24c4+=_0x7cc5('0xc8')+_0x2abbbc[_0x7cc5('0xc9')][_0x3d5709]+_0x7cc5('0xca')+_0x17e215['toFixed'](0x2)+_0x7cc5('0xbd');_0x5e24c4+=_0x7cc5('0xcb');_0x5e24c4+=' ';_0x5e24c4+=_0x7cc5('0xcc');_0x5e24c4+=_0x7cc5('0x8a');_0x5e24c4+=util['format']('\x20%s\x20',_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xcd')][_0x7cc5('0xce')](new RegExp(String[_0x7cc5('0xcf')](0xd),'g'),_0x7cc5('0xd0')));_0x5e24c4+=_0x7cc5('0xa6');_0x5e24c4+='';_0x5e24c4+='';_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc[_0x7cc5('0xd2')][_0x3d5709]+_0x7cc5('0xd3');if(!_[_0x7cc5('0xc0')](_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xd4')])){_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc['accountholder'][_0x3d5709]+_0x7cc5('0xd5')+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xd4')]+_0x7cc5('0xd6');_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc[_0x7cc5('0xd7')][_0x3d5709]+_0x7cc5('0xd5')+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xd8')]+_0x7cc5('0xd9');_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc[_0x7cc5('0xda')][_0x3d5709]+_0x7cc5('0xd5')+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xdb')]+',\x20'+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xdc')]+_0x7cc5('0xdd')+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xde')]+'\x20('+_0x11fab6[_0x7cc5('0x85')]['issuerBankCountry']+')'+_0x7cc5('0xd6');_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc[_0x7cc5('0xdf')][_0x3d5709]+'/'+_0x2abbbc['cab'][_0x3d5709]+':\x20'+_0x11fab6['creditnote']['issuerABI']+'/'+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xe0')]+'';_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc['bic'][_0x3d5709]+'/'+_0x2abbbc[_0x7cc5('0xe1')][_0x3d5709]+':\x20'+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xe2')]+_0x7cc5('0xd6');_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc[_0x7cc5('0xe3')][_0x3d5709]+_0x7cc5('0xd5')+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xe4')]+_0x7cc5('0xd6');}if(!_[_0x7cc5('0xc0')](_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xe5')])){_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc[_0x7cc5('0xe6')][_0x3d5709]+':\x20'+_0x11fab6[_0x7cc5('0x85')][_0x7cc5('0xe5')]+_0x7cc5('0xd6');}_0x5e24c4+=_0x7cc5('0xd1')+_0x2abbbc['thank1'][_0x3d5709]+_0x7cc5('0xe7')+_0x5ac750+_0x7cc5('0xe8')+_0x2abbbc[_0x7cc5('0xe9')][_0x3d5709]+_0x7cc5('0x5b');_0x5e24c4+='';_0x5e24c4+=_0x7cc5('0xa6');_0x5e24c4+=_0x7cc5('0xea');_0x5e24c4+=_0x7cc5('0xeb');_0x5e24c4+=_0x7cc5('0xec');return new BPromise(function(_0x1f4e4c,_0x4e7b2c){pdf[_0x7cc5('0x42')](_0x5e24c4,_0x4e8e2d)[_0x7cc5('0xed')](path['join'](_0x15c67b,_0x90eccc),function(_0x206e97,_0x306986){if(_0x206e97)return _0x4e7b2c(_0x206e97);_0x1f4e4c(_0x306986);});});});}})['then'](function(){if(_0x255f37){console['log'](_0x7cc5('0xee'),_0x2fda7d,_0x90eccc);return _0x4fbb0a[_0x7cc5('0xef')](_0x2fda7d,_0x90eccc,function(_0x3f2964){if(_0x3f2964){console['log'](_0x7cc5('0xf0'),_0x3f2964);}else{console['log'](_0x7cc5('0xf1'),_0x15c67b);rimraf(_0x15c67b,function(){});}});}else{return _0x4fbb0a[_0x7cc5('0x13')](0xc8);}})[_0x7cc5('0x3e')](handleError(_0x4fbb0a,null));}; \ No newline at end of file +var _0xf7de=['../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','SACreditNote','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','where','merge','type','key','VIRTUAL','field','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','update','find','describe','toString','join','root','server','tmp','files','images','logo-invoice.png','paid-invoice.png','format','Credinote_%s-%s.pdf','SACreditNoteDetail','details','portrait','10mm','{{page}}/{{pages}}','contents','default','footer','','mkdirSync','','\x20\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}','Phone','Telefono','Fax','Email','VAT\x20number','P.IVA','C.F.','I.S.\x20code','Codice\x20S.D.I.','Soc.Cap.\x20fp','Cap.Soc.\x20iv','Invoice','Fattura','Proforma','Credit\x20note','Nota\x20di\x20credito','Due\x20date','Scadenza','Item','Articolo','Description','Descrizione','Hrs/Qty','Ore/Qta','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Discount','Sconto','Subtotal','Imponibile','Total','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Bank\x20name','Nome\x20banca','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','receivingCountry','Italy','','\x20','','\x20%s
','creditnote','issuerName','%s
','issuerStreet','\x20%s','-\x20%s\x20
','issuerCountry','fax',':\x20%s
','email','issuerEmail','piva','issuerPIVA','issuerFiscalCode','sdi','issuerSocCap','','','','%s','companyName','receivingStreet','%s\x20-\x20','receivingPostalCode','receivingCity','','receivingFiscalCode','receivingSDICode','','','','%s,\x20','issuerCity','updatedAt','%s\x20','saExpiryDay','DD/MM/YYYY','','','','item','','description','hrsqty','subtotal','netPrice','discount','tax','quantity','%s','productName','%d','','toFixed','\x20€','','isNil','receivingFiscalMessage','indexOf','split\x20payment','','\x20','','','','\x20',' ','\x20%s\x20','replace','','','sendpayment',':','issuerBankAccount','accountholder',':\x20','bankname','issuerBankName','\x20','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCountry','','abi','cab','issuerABI','issuerCAB','bic','iban','paypal','issuerPayPal','thank1','','','thank2','','','','toFile','log','TCL:\x20exports.getCreditnotePDF\x20->\x20saveTo,\x20fileName','err','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5a3339,_0x49273c){var _0x243c5b=function(_0x2f4638){while(--_0x2f4638){_0x5a3339['push'](_0x5a3339['shift']());}};_0x243c5b(++_0x49273c);}(_0xf7de,0x1e8));var _0xef7d=function(_0xb92c08,_0x25c6ad){_0xb92c08=_0xb92c08-0x0;var _0x361491=_0xf7de[_0xb92c08];return _0x361491;};'use strict';var pdf=require(_0xef7d('0x0'));var emlformat=require(_0xef7d('0x1'));var rimraf=require(_0xef7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef7d('0x3'));var rp=require('request-promise');var moment=require(_0xef7d('0x4'));var BPromise=require(_0xef7d('0x5'));var Mustache=require('mustache');var util=require(_0xef7d('0x6'));var path=require(_0xef7d('0x7'));var sox=require('sox');var csv=require(_0xef7d('0x8'));var ejs=require(_0xef7d('0x9'));var fs=require('fs');var _=require(_0xef7d('0xa'));var squel=require('squel');var crypto=require(_0xef7d('0xb'));var jsforce=require(_0xef7d('0xc'));var deskjs=require(_0xef7d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xef7d('0xe'));var Papa=require('papaparse');var Redis=require(_0xef7d('0xf'));var authService=require(_0xef7d('0x10'));var qs=require(_0xef7d('0x11'));var hardwareService=require(_0xef7d('0x12'));var logger=require(_0xef7d('0x13'))(_0xef7d('0x14'));var utils=require(_0xef7d('0x15'));var config=require(_0xef7d('0x16'));var db=require(_0xef7d('0x17'))['db'];function respondWithStatusCode(_0x32beb3,_0x5543fa){_0x5543fa=_0x5543fa||0xcc;return function(_0x2a4169){if(_0x2a4169){return _0x32beb3[_0xef7d('0x18')](_0x5543fa);}return _0x32beb3[_0xef7d('0x19')](_0x5543fa)['end']();};}function respondWithResult(_0x316de6,_0x28711f){_0x28711f=_0x28711f||0xc8;return function(_0x44b95c){if(_0x44b95c){return _0x316de6[_0xef7d('0x19')](_0x28711f)['json'](_0x44b95c);}};}function respondWithFilteredResult(_0x4fb4ce,_0x2b3180){return function(_0x52fd69){if(_0x52fd69){var _0x5729f5=_0x52fd69[_0xef7d('0x1a')],_0x2bab5d=_0x2b3180[_0xef7d('0x1b')],_0x9a3313=_0x2b3180['offset']+_0x2b3180[_0xef7d('0x1c')],_0x493d32;if(_0x9a3313>=_0x5729f5){_0x9a3313=_0x5729f5;_0x493d32=0xc8;}else{_0x493d32=0xce;}_0x4fb4ce['status'](_0x493d32);return _0x4fb4ce['set'](_0xef7d('0x1d'),_0x2bab5d+'-'+_0x9a3313+'/'+_0x5729f5)[_0xef7d('0x1e')](_0x52fd69);}return null;};}function patchUpdates(_0x38395f){return function(_0x26f971){try{jsonpatch[_0xef7d('0x1f')](_0x26f971,_0x38395f,!![]);}catch(_0x1b6bf4){return BPromise[_0xef7d('0x20')](_0x1b6bf4);}return _0x26f971[_0xef7d('0x21')]();};}function saveUpdates(_0x36c58a,_0x3c7827){return function(_0x3e1a7d){if(_0x3e1a7d){return _0x3e1a7d['update'](_0x36c58a)[_0xef7d('0x22')](function(_0x4f0763){return _0x4f0763;});}return null;};}function removeEntity(_0x34eac0,_0xc84416){return function(_0xa2e26a){if(_0xa2e26a){return _0xa2e26a[_0xef7d('0x23')]()[_0xef7d('0x22')](function(){_0x34eac0[_0xef7d('0x19')](0xcc)[_0xef7d('0x24')]();});}};}function handleEntityNotFound(_0x37ae50,_0x3966aa){return function(_0x55f332){if(!_0x55f332){_0x37ae50[_0xef7d('0x18')](0x194);}return _0x55f332;};}function handleError(_0x56ec0a,_0x4e6374){_0x4e6374=_0x4e6374||0x1f4;return function(_0x59ea10){logger['error'](_0x59ea10[_0xef7d('0x25')]);if(_0x59ea10[_0xef7d('0x26')]){delete _0x59ea10['name'];}_0x56ec0a[_0xef7d('0x19')](_0x4e6374)[_0xef7d('0x27')](_0x59ea10);};}exports[_0xef7d('0x28')]=function(_0x431506,_0x7e97df){var _0x1314b5={},_0x34ae17={},_0x256f5a={'count':0x0,'rows':[]};var _0x5cc748=db[_0xef7d('0x29')]['rawAttributes'];_0x34ae17[_0xef7d('0x2a')]=_[_0xef7d('0x2b')](_0x5cc748);_0x34ae17[_0xef7d('0x2c')]=_[_0xef7d('0x2b')](_0x431506[_0xef7d('0x2c')]);_0x34ae17['filters']=_[_0xef7d('0x2d')](_0x34ae17['model'],_0x34ae17[_0xef7d('0x2c')]);_0x1314b5[_0xef7d('0x2e')]=_[_0xef7d('0x2d')](_0x34ae17[_0xef7d('0x2a')],qs[_0xef7d('0x2f')](_0x431506[_0xef7d('0x2c')][_0xef7d('0x2f')]));_0x1314b5[_0xef7d('0x2e')]=_0x1314b5[_0xef7d('0x2e')][_0xef7d('0x30')]?_0x1314b5[_0xef7d('0x2e')]:_0x34ae17[_0xef7d('0x2a')];if(!_0x431506[_0xef7d('0x2c')]['hasOwnProperty'](_0xef7d('0x31'))){_0x1314b5[_0xef7d('0x1c')]=qs['limit'](_0x431506[_0xef7d('0x2c')][_0xef7d('0x1c')]);_0x1314b5['offset']=qs['offset'](_0x431506[_0xef7d('0x2c')][_0xef7d('0x1b')]);}_0x1314b5[_0xef7d('0x32')]=qs[_0xef7d('0x33')](_0x431506['query'][_0xef7d('0x33')]);_0x1314b5['where']=qs[_0xef7d('0x34')](_['pick'](_0x431506['query'],_0x34ae17['filters']));if(_0x431506[_0xef7d('0x2c')]['filter']){_0x1314b5[_0xef7d('0x35')]=_[_0xef7d('0x36')](_0x1314b5[_0xef7d('0x35')],{'$or':_['map'](_0x5cc748,function(_0x4c5942){if(_0x4c5942[_0xef7d('0x37')][_0xef7d('0x38')]!==_0xef7d('0x39')){var _0x492763={};_0x492763[_0x4c5942[_0xef7d('0x3a')]]={'$like':'%'+_0x431506[_0xef7d('0x2c')][_0xef7d('0x3b')]+'%'};return _0x492763;}})});}_0x1314b5=_[_0xef7d('0x36')]({},_0x1314b5,_0x431506[_0xef7d('0x3c')]);var _0x38963a={'where':_0x1314b5[_0xef7d('0x35')]};return db['SACreditNote']['count'](_0x38963a)[_0xef7d('0x22')](function(_0x4e7c1d){_0x256f5a['count']=_0x4e7c1d;if(_0x431506['query'][_0xef7d('0x3d')]){_0x1314b5['include']=[{'all':!![]}];}return db['SACreditNote'][_0xef7d('0x3e')](_0x1314b5);})[_0xef7d('0x22')](function(_0x5b827f){_0x256f5a[_0xef7d('0x3f')]=_0x5b827f;return _0x256f5a;})[_0xef7d('0x22')](respondWithFilteredResult(_0x7e97df,_0x1314b5))[_0xef7d('0x40')](handleError(_0x7e97df,null));};exports['show']=function(_0x179f6e,_0x303685){var _0x551e17={'raw':![],'where':{'id':_0x179f6e[_0xef7d('0x41')]['id']}},_0xfa4ca2={};_0xfa4ca2[_0xef7d('0x2a')]=_[_0xef7d('0x2b')](db[_0xef7d('0x29')][_0xef7d('0x42')]);_0xfa4ca2[_0xef7d('0x2c')]=_[_0xef7d('0x2b')](_0x179f6e['query']);_0xfa4ca2[_0xef7d('0x34')]=_['intersection'](_0xfa4ca2[_0xef7d('0x2a')],_0xfa4ca2[_0xef7d('0x2c')]);_0x551e17['attributes']=_['intersection'](_0xfa4ca2[_0xef7d('0x2a')],qs[_0xef7d('0x2f')](_0x179f6e[_0xef7d('0x2c')][_0xef7d('0x2f')]));_0x551e17[_0xef7d('0x2e')]=_0x551e17[_0xef7d('0x2e')][_0xef7d('0x30')]?_0x551e17['attributes']:_0xfa4ca2[_0xef7d('0x2a')];if(_0x179f6e[_0xef7d('0x2c')][_0xef7d('0x3d')]){_0x551e17[_0xef7d('0x43')]=[{'all':!![]}];}_0x551e17=_['merge']({},_0x551e17,_0x179f6e[_0xef7d('0x3c')]);return db['SACreditNote']['find'](_0x551e17)['then'](handleEntityNotFound(_0x303685,null))['then'](respondWithResult(_0x303685,null))[_0xef7d('0x40')](handleError(_0x303685,null));};exports[_0xef7d('0x44')]=function(_0x4646de,_0x173151){return db[_0xef7d('0x29')]['create'](_0x4646de[_0xef7d('0x45')],{})[_0xef7d('0x22')](respondWithResult(_0x173151,0xc9))[_0xef7d('0x40')](handleError(_0x173151,null));};exports[_0xef7d('0x46')]=function(_0xd160de,_0x989707){if(_0xd160de['body']['id']){delete _0xd160de['body']['id'];}return db['SACreditNote']['find']({'where':{'id':_0xd160de[_0xef7d('0x41')]['id']}})[_0xef7d('0x22')](handleEntityNotFound(_0x989707,null))['then'](saveUpdates(_0xd160de[_0xef7d('0x45')],null))['then'](respondWithResult(_0x989707,null))[_0xef7d('0x40')](handleError(_0x989707,null));};exports[_0xef7d('0x23')]=function(_0x1b737e,_0x5cf4fd){return db['SACreditNote'][_0xef7d('0x47')]({'where':{'id':_0x1b737e['params']['id']}})[_0xef7d('0x22')](handleEntityNotFound(_0x5cf4fd,null))[_0xef7d('0x22')](removeEntity(_0x5cf4fd,null))[_0xef7d('0x40')](handleError(_0x5cf4fd,null));};exports['describe']=function(_0x3ffa27,_0x2d2d18){return db[_0xef7d('0x29')][_0xef7d('0x48')]()[_0xef7d('0x22')](respondWithResult(_0x2d2d18,null))[_0xef7d('0x40')](handleError(_0x2d2d18,null));};exports['getCreditnotePDF']=function(_0x3ada2b,_0x3cf151){var _0x5063cd=moment()['unix']()[_0xef7d('0x49')]();var _0x1e0ca1=path[_0xef7d('0x4a')](config[_0xef7d('0x4b')],_0xef7d('0x4c'),'files',_0xef7d('0x4d'));var _0x3bc591=path[_0xef7d('0x4a')](config['root'],_0xef7d('0x4c'),_0xef7d('0x4e'),_0xef7d('0x4f'),'logos',_0xef7d('0x50'));var _0x38e05c=path[_0xef7d('0x4a')](config[_0xef7d('0x4b')],_0xef7d('0x4c'),_0xef7d('0x4e'),'images','logos',_0xef7d('0x51'));var _0x51cdf5=path['join'](_0x1e0ca1,_0x5063cd);var _0xc385ac=util[_0xef7d('0x52')](_0xef7d('0x53'),_0x3ada2b[_0xef7d('0x41')]['id'],_0x5063cd);var _0x39af72=path[_0xef7d('0x4a')](_0x51cdf5,_0xc385ac);var _0x1d284e=![];var _0x231e98={};return db[_0xef7d('0x29')][_0xef7d('0x47')]({'where':{'id':_0x3ada2b[_0xef7d('0x41')]['id']},'raw':!![]})[_0xef7d('0x22')](handleEntityNotFound(_0x3cf151,null))['then'](function(_0x2acafb){if(_0x2acafb){_0x231e98['creditnote']=_0x2acafb;return db[_0xef7d('0x54')][_0xef7d('0x3e')]({'where':{'CreditNoteId':_0x2acafb['id']},'raw':!![],'logging':console['log']})[_0xef7d('0x22')](function(_0x1904db){_0x231e98[_0xef7d('0x55')]=_0x1904db;_0x1d284e=!![];var _0x4af906='';var _0x3baac3={'format':'A4','orientation':_0xef7d('0x56'),'border':'1cm','footer':{'height':_0xef7d('0x57'),'contents':{'default':_0xef7d('0x58')}}};_0x3baac3['footer'][_0xef7d('0x59')][_0xef7d('0x5a')]=_0x3baac3[_0xef7d('0x5b')][_0xef7d('0x59')][_0xef7d('0x5a')]+''+_0x231e98['creditnote']['issuerWeb']+_0xef7d('0x5c');fs[_0xef7d('0x5d')](_0x51cdf5);_0x4af906=_0xef7d('0x5e');_0x4af906+=_0xef7d('0x5f');_0x4af906+='';var _0x5441a8={'phone':{'en':_0xef7d('0x60'),'it':_0xef7d('0x61')},'fax':{'en':'Fax','it':_0xef7d('0x62')},'email':{'en':'Email','it':_0xef7d('0x63')},'piva':{'en':_0xef7d('0x64'),'it':_0xef7d('0x65')},'cf':{'en':'Tax\x20code','it':_0xef7d('0x66')},'sdi':{'en':_0xef7d('0x67'),'it':_0xef7d('0x68')},'cs':{'en':_0xef7d('0x69'),'it':_0xef7d('0x6a')},'invoice':{'en':_0xef7d('0x6b'),'it':_0xef7d('0x6c')},'proforma':{'en':_0xef7d('0x6d'),'it':_0xef7d('0x6d')},'creditnote':{'en':_0xef7d('0x6e'),'it':_0xef7d('0x6f')},'duedate':{'en':_0xef7d('0x70'),'it':_0xef7d('0x71')},'item':{'en':_0xef7d('0x72'),'it':_0xef7d('0x73')},'description':{'en':_0xef7d('0x74'),'it':_0xef7d('0x75')},'hrsqty':{'en':_0xef7d('0x76'),'it':_0xef7d('0x77')},'unitprice':{'en':_0xef7d('0x78'),'it':_0xef7d('0x79')},'subtotal':{'en':_0xef7d('0x7a'),'it':_0xef7d('0x7b')},'discount':{'en':_0xef7d('0x7c'),'it':_0xef7d('0x7d')},'total':{'en':_0xef7d('0x7e'),'it':_0xef7d('0x7f')},'tax':{'en':'Tax','it':'Tasse'},'nettopay':{'en':_0xef7d('0x80'),'it':'Totale'},'sendpayment':{'en':_0xef7d('0x81'),'it':_0xef7d('0x82')},'accountholder':{'en':'Account\x20Holder','it':'Conto\x20intestato\x20a'},'bankname':{'en':_0xef7d('0x83'),'it':_0xef7d('0x84')},'bankaddress':{'en':_0xef7d('0x85'),'it':_0xef7d('0x86')},'abi':{'en':_0xef7d('0x87'),'it':_0xef7d('0x87')},'cab':{'en':_0xef7d('0x88'),'it':'CAB'},'bic':{'en':_0xef7d('0x89'),'it':'BIC'},'swif':{'en':_0xef7d('0x8a'),'it':_0xef7d('0x8a')},'iban':{'en':_0xef7d('0x8b'),'it':_0xef7d('0x8b')},'paypal':{'en':_0xef7d('0x8c'),'it':_0xef7d('0x8d')},'thank1':{'en':_0xef7d('0x8e'),'it':'Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20'},'thank2':{'en':_0xef7d('0x8f'),'it':_0xef7d('0x90')}};var _0x2f77cd='it';if(_0x231e98['creditnote'][_0xef7d('0x91')]!==_0xef7d('0x92')){_0x2f77cd='en';}_0x4af906+=_0xef7d('0x93');_0x4af906+=_0xef7d('0x94')+_0x3bc591+_0xef7d('0x95');_0x4af906+=_0xef7d('0x96');_0x4af906+=util['format'](_0xef7d('0x97'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x99')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x9b')]);_0x4af906+=util[_0xef7d('0x52')]('%s',_0x231e98[_0xef7d('0x98')]['issuerPostalCode']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9c'),_0x231e98['creditnote']['issuerCity']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9d'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x9e')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9d'),_0x231e98[_0xef7d('0x98')][_0xef7d('0x9e')]);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8['phone'][_0x2f77cd]+':\x20%s
',_0x231e98['creditnote']['issuerPhone']);_0x4af906+=util['format'](_0x5441a8[_0xef7d('0x9f')][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98[_0xef7d('0x98')]['issuerFax']);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8[_0xef7d('0xa1')][_0x2f77cd]+_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xa2')]);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8[_0xef7d('0xa3')][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xa4')]);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8['cf'][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98['creditnote'][_0xef7d('0xa5')]);_0x4af906+=util['format'](_0x5441a8[_0xef7d('0xa6')][_0x2f77cd]+_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')]['issuerSDICode']);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8['cs'][_0x2f77cd]+_0xef7d('0xa0'),_0x231e98['creditnote'][_0xef7d('0xa7')]);_0x4af906+=_0xef7d('0xa8');_0x4af906+=_0xef7d('0xa9');_0x4af906+=_0xef7d('0xaa');_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xab'),_0x231e98['creditnote'][_0xef7d('0xac')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9a'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xad')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xae'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xaf')]);_0x4af906+=util['format'](_0xef7d('0x9a'),_0x231e98['creditnote'][_0xef7d('0xb0')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0x9a'),_0x231e98['creditnote'][_0xef7d('0x91')]);_0x4af906+=util['format'](_0xef7d('0xb1')+_0x5441a8['cf'][_0x2f77cd]+':\x20%s
',_0x231e98[_0xef7d('0x98')][_0xef7d('0xb2')]);_0x4af906+=util['format'](_0x5441a8[_0xef7d('0xa3')][_0x2f77cd]+':\x20%s
',_0x231e98[_0xef7d('0x98')]['receivingPIVA']);_0x4af906+=util[_0xef7d('0x52')](_0x5441a8[_0xef7d('0xa6')][_0x2f77cd]+':\x20%s
',_0x231e98['creditnote'][_0xef7d('0xb3')]);_0x4af906+=_0xef7d('0xb4');_0x4af906+=_0xef7d('0xb5');_0x4af906+='';_0x4af906+='';_0x4af906+=util['format'](_0xef7d('0xb6')+_0x5441a8[_0xef7d('0x98')][_0x2f77cd]+'\x20N.%d',_0x2acafb['id']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xb7'),_0x231e98[_0xef7d('0x98')][_0xef7d('0xb8')]);var _0x4d131e=moment(_0x231e98[_0xef7d('0x98')][_0xef7d('0xb9')])[_0xef7d('0x52')]('DD/MM/YYYY');_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xba'),_0x4d131e);var _0x3744d2=moment(_0x231e98[_0xef7d('0x98')]['updatedAt'])['add'](_0x231e98[_0xef7d('0x98')][_0xef7d('0xbb')],'days')[_0xef7d('0x52')](_0xef7d('0xbc'));_0x4af906+=util[_0xef7d('0x52')](''+_0x5441a8['duedate'][_0x2f77cd]+':\x20%s',_0x3744d2);_0x4af906+=_0xef7d('0xb5');_0x4af906+='';_0x4af906+=_0xef7d('0xbd');_0x4af906+=_0xef7d('0xbe');_0x4af906+='';_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc0')][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc2')][_0x2f77cd]+'';_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc3')][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+=_0xef7d('0xbf')+_0x5441a8['unitprice'][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+=_0xef7d('0xbf')+_0x5441a8[_0xef7d('0xc4')][_0x2f77cd]+_0xef7d('0xc1');_0x4af906+='';var _0x56e6b3=0x0;var _0x3c9734=0x0;for(var _0x352fee=0x0;_0x352fee<_0x231e98[_0xef7d('0x55')][_0xef7d('0x30')];_0x352fee++){var _0x52e713=0x0;var _0x4753ec=0x0;var _0x36f760=0x0;var _0x315dc0=0x0;_0x52e713=_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc5')]-_0x231e98[_0xef7d('0x55')][_0x352fee]['netPrice']/0x64*_0x231e98['details'][_0x352fee][_0xef7d('0xc6')];_0x4753ec=_0x52e713/0x64*_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc7')];_0x36f760=_0x52e713*_0x231e98['details'][_0x352fee][_0xef7d('0xc8')];_0x315dc0=_0x4753ec*_0x231e98['details'][_0x352fee]['quantity'];_0x4af906+=_0xef7d('0x96');_0x4af906+=util['format'](_0xef7d('0xc9'),_0x231e98['details'][_0x352fee][_0xef7d('0xca')]);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xc9'),_0x231e98[_0xef7d('0x55')][_0x352fee]['productDescription']);_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xcb'),_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc8')]);_0x4af906+=_0xef7d('0xcc')+_0x52e713[_0xef7d('0xcd')](0x2)+'\x20€';_0x4af906+=_0xef7d('0xcc')+_0x36f760[_0xef7d('0xcd')](0x2)+_0xef7d('0xce');_0x4af906+=_0xef7d('0xb5');_0x56e6b3+=_0x36f760;_0x3c9734+=_0x315dc0;}_0x4af906+=_0xef7d('0xcf');if(!_[_0xef7d('0xd0')](_0x231e98[_0xef7d('0x98')][_0xef7d('0xc6')])){var _0x166fde=0x0;var _0x4fc44f=0x0;var _0x210a39=_0x231e98[_0xef7d('0x98')]['discount']*0x64/_0x56e6b3;for(var _0x352fee=0x0;_0x352fee<_0x231e98[_0xef7d('0x55')][_0xef7d('0x30')];_0x352fee++){var _0x430630=0x0;var _0x1705b6=0x0;var _0x987301=0x0;_0x52e713=_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc5')]-_0x231e98[_0xef7d('0x55')][_0x352fee][_0xef7d('0xc5')]/0x64*_0x231e98[_0xef7d('0x55')][_0x352fee]['discount'];_0x430630=_0x52e713/0x64*_0x210a39;_0x1705b6=_0x52e713-_0x430630;_0x987301=_0x1705b6*_0x231e98[_0xef7d('0x55')][_0x352fee]['quantity'];_0x166fde+=_0x987301;_0x4fc44f+=_0x987301/0x64*_0x231e98[_0xef7d('0x55')][_0x352fee]['tax'];}}var _0x2ce295=0x0;var _0x579318=0x0;var _0x365bf7=![];var _0x46a3ec=_0x231e98[_0xef7d('0x98')][_0xef7d('0xd1')];if(_0x46a3ec[_0xef7d('0xd2')](_0xef7d('0xd3'))!=-0x1){_0x365bf7=!![];}if(!_[_0xef7d('0xd0')](_0x231e98['creditnote']['discount'])){_0x4af906+=_0xef7d('0x96');if(_0x231e98[_0xef7d('0x98')]['discount']>0x0){_0x4af906+=_0xef7d('0xd4')+_0x5441a8[_0xef7d('0xc6')][_0x2f77cd]+'';_0x4af906+=_0xef7d('0xd5')+_0x231e98['creditnote']['discount'][_0xef7d('0xcd')](0x2)+'\x20€';}_0x4af906+=_0xef7d('0xb5');_0x2ce295=_0x4fc44f;_0x579318=_0x166fde;}else{_0x2ce295=_0x3c9734;_0x579318=_0x56e6b3;}if(_0x2ce295>0x0||_0x231e98['creditnote'][_0xef7d('0xc6')]>0x0){_0x4af906+=_0xef7d('0x96');_0x4af906+=_0xef7d('0xd6')+_0x5441a8['total'][_0x2f77cd]+_0xef7d('0xa8');_0x4af906+=_0xef7d('0xcc')+_0x579318[_0xef7d('0xcd')](0x2)+_0xef7d('0xce');_0x4af906+='';}if(_0x2ce295>0x0){_0x4af906+='';_0x4af906+=''+_0x5441a8['tax'][_0x2f77cd]+_0xef7d('0xa8');_0x4af906+=''+_0x2ce295[_0xef7d('0xcd')](0x2)+'\x20€';_0x4af906+='';}_0x4af906+=_0xef7d('0x96');var _0x254ca5;if(_0x365bf7){_0x254ca5=_0x579318;}else{_0x254ca5=_0x579318+_0x2ce295;}_0x4af906+=_0xef7d('0xd7')+_0x5441a8['nettopay'][_0x2f77cd]+_0xef7d('0xd8')+_0x254ca5['toFixed'](0x2)+_0xef7d('0xce');_0x4af906+=_0xef7d('0xd9');_0x4af906+=_0xef7d('0xda');_0x4af906+='';_0x4af906+=_0xef7d('0x96');_0x4af906+=util[_0xef7d('0x52')](_0xef7d('0xdb'),_0x231e98[_0xef7d('0x98')]['receivingFiscalMessage'][_0xef7d('0xdc')](new RegExp(String['fromCharCode'](0xd),'g'),_0xef7d('0xdd')));_0x4af906+='';_0x4af906+='';_0x4af906+=_0xef7d('0xbd');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xdf')][_0x2f77cd]+_0xef7d('0xe0');if(!_[_0xef7d('0xd0')](_0x231e98[_0xef7d('0x98')][_0xef7d('0xe1')])){_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xe2')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')][_0xef7d('0xe1')]+'';_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xe4')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')][_0xef7d('0xe5')]+_0xef7d('0xe6');_0x4af906+=_0xef7d('0xde')+_0x5441a8['bankaddress'][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98['creditnote'][_0xef7d('0xe7')]+',\x20'+_0x231e98[_0xef7d('0x98')][_0xef7d('0xe8')]+_0xef7d('0xe9')+_0x231e98['creditnote']['issuerBankCity']+'\x20('+_0x231e98[_0xef7d('0x98')][_0xef7d('0xea')]+')'+_0xef7d('0xeb');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xec')][_0x2f77cd]+'/'+_0x5441a8[_0xef7d('0xed')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98['creditnote'][_0xef7d('0xee')]+'/'+_0x231e98['creditnote'][_0xef7d('0xef')]+_0xef7d('0xeb');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xf0')][_0x2f77cd]+'/'+_0x5441a8['swif'][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')]['issuerBankBICSWIFT']+_0xef7d('0xeb');_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xf1')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98[_0xef7d('0x98')]['issuerBankIBAN']+'';}if(!_[_0xef7d('0xd0')](_0x231e98['creditnote']['issuerPayPal'])){_0x4af906+=_0xef7d('0xde')+_0x5441a8[_0xef7d('0xf2')][_0x2f77cd]+_0xef7d('0xe3')+_0x231e98['creditnote'][_0xef7d('0xf3')]+'';}_0x4af906+=''+_0x5441a8[_0xef7d('0xf4')][_0x2f77cd]+_0xef7d('0xf5')+_0x3744d2+_0xef7d('0xf6')+_0x5441a8[_0xef7d('0xf7')][_0x2f77cd]+_0xef7d('0x5c');_0x4af906+=_0xef7d('0xa8');_0x4af906+=_0xef7d('0xb5');_0x4af906+=_0xef7d('0xf8');_0x4af906+=_0xef7d('0xf9');_0x4af906+=_0xef7d('0xfa');return new BPromise(function(_0x66b8f0,_0x3d123b){pdf[_0xef7d('0x44')](_0x4af906,_0x3baac3)[_0xef7d('0xfb')](path['join'](_0x51cdf5,_0xc385ac),function(_0x55a524,_0x58d662){if(_0x55a524)return _0x3d123b(_0x55a524);_0x66b8f0(_0x58d662);});});});}})['then'](function(){if(_0x1d284e){console[_0xef7d('0xfc')](_0xef7d('0xfd'),_0x39af72,_0xc385ac);return _0x3cf151['download'](_0x39af72,_0xc385ac,function(_0x1da70d){if(_0x1da70d){console['log'](_0xef7d('0xfe'),_0x1da70d);}else{console['log']('foldername',_0x51cdf5);rimraf(_0x51cdf5,function(){});}});}else{return _0x3cf151[_0xef7d('0x18')](0xc8);}})[_0xef7d('0x40')](handleError(_0x3cf151,null));}; \ No newline at end of file diff --git a/server/api/saCreditNote/saCreditNote.model.js b/server/api/saCreditNote/saCreditNote.model.js index 243da37..8269799 100644 --- a/server/api/saCreditNote/saCreditNote.model.js +++ b/server/api/saCreditNote/saCreditNote.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41bb=['SACreditNoteNumber','findOne','transaction','then','update','create','log','TCL:\x20error','lodash','util','api','bluebird','request-promise','path','rimraf','./saCreditNote.attributes','exports','sa_creditNotes','models','get','YYYY'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0x41bb,0xc5));var _0xb41b=function(_0x1b06ea,_0x390686){_0x1b06ea=_0x1b06ea-0x0;var _0x178e30=_0x41bb[_0x1b06ea];return _0x178e30;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('SACreditNote',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29c30d,_0x53722a,_0x13d44e){var _0x2c1a53=_0x2dbaa3[_0xb41b('0xa')];var _0xa2aa66=_0x29c30d[_0xb41b('0xb')]({'plain':!![]});var _0x11f049=0x1;var _0x5e5c5b=parseInt(moment()['format'](_0xb41b('0xc')));try{if(_['has'](_0xa2aa66,'id')){return _0x2c1a53[_0xb41b('0xd')][_0xb41b('0xe')]({'where':{'year':_0x5e5c5b},'raw':!![],'logging':!![],'transaction':_0x53722a[_0xb41b('0xf')]})[_0xb41b('0x10')](function(_0x2066d5){if(_0x2066d5){_0x11f049=_0x2066d5['number']+0x1;return _0x2c1a53[_0xb41b('0xd')][_0xb41b('0x11')]({'number':_0x11f049},{'where':{'id':_0x2066d5['id']},'transaction':_0x53722a[_0xb41b('0xf')],'logging':!![]});}return _0x2c1a53[_0xb41b('0xd')][_0xb41b('0x12')]({'year':_0x5e5c5b,'number':_0x11f049},{'logging':!![],'transaction':_0x53722a['transaction']});})['then'](function(){_0xa2aa66['number']=_0x11f049;})[_0xb41b('0x10')](function(){_0x13d44e();});}}catch(_0xdc5fb0){console[_0xb41b('0x13')](_0xb41b('0x14'),_0xdc5fb0);_0x13d44e();}}}});}; \ No newline at end of file +var _0xf4eb=['findOne','transaction','update','SACreditNoteNumber','create','then','log','TCL:\x20error','lodash','bluebird','rimraf','../../config/environment','./saCreditNote.attributes','exports','define','sa_creditNotes','models','get','has'];(function(_0x248d01,_0x49e69a){var _0x36d675=function(_0x33286c){while(--_0x33286c){_0x248d01['push'](_0x248d01['shift']());}};_0x36d675(++_0x49e69a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x50904c,_0xc8a03c){_0x50904c=_0x50904c-0x0;var _0x3ea910=_0xf4eb[_0x50904c];return _0x3ea910;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('SACreditNote',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5013c2,_0x5e23d4,_0xa4280c){var _0x3761c1=_0xa4dcf5[_0xbf4e('0x8')];var _0xc86f04=_0x5013c2[_0xbf4e('0x9')]({'plain':!![]});var _0x22668b=0x1;var _0x177342=parseInt(moment()['format']('YYYY'));try{if(_[_0xbf4e('0xa')](_0xc86f04,'id')){return _0x3761c1['SACreditNoteNumber'][_0xbf4e('0xb')]({'where':{'year':_0x177342},'raw':!![],'logging':!![],'transaction':_0x5e23d4[_0xbf4e('0xc')]})['then'](function(_0x17fd01){if(_0x17fd01){_0x22668b=_0x17fd01['number']+0x1;return _0x3761c1['SACreditNoteNumber'][_0xbf4e('0xd')]({'number':_0x22668b},{'where':{'id':_0x17fd01['id']},'transaction':_0x5e23d4[_0xbf4e('0xc')],'logging':!![]});}return _0x3761c1[_0xbf4e('0xe')][_0xbf4e('0xf')]({'year':_0x177342,'number':_0x22668b},{'logging':!![],'transaction':_0x5e23d4[_0xbf4e('0xc')]});})[_0xbf4e('0x10')](function(){_0xc86f04['number']=_0x22668b;})['then'](function(){_0xa4280c();});}}catch(_0x180432){console[_0xbf4e('0x11')](_0xbf4e('0x12'),_0x180432);_0xa4280c();}}}});}; \ No newline at end of file diff --git a/server/api/saCreditNote/saCreditNote.rpc.js b/server/api/saCreditNote/saCreditNote.rpc.js index 5e5b91e..56ed6a9 100644 --- a/server/api/saCreditNote/saCreditNote.rpc.js +++ b/server/api/saCreditNote/saCreditNote.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeba2=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','SACreditNote,\x20%s,\x20%s','request\x20sent','debug','SACreditNote,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0xeba2,0x70));var _0x2eba=function(_0x10d8c7,_0xa80d12){_0x10d8c7=_0x10d8c7-0x0;var _0x4105b9=_0xeba2[_0x10d8c7];return _0x4105b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2eba('0x0'));var BPromise=require(_0x2eba('0x1'));var rs=require(_0x2eba('0x2'));var fs=require('fs');var Redis=require(_0x2eba('0x3'));var db=require(_0x2eba('0x4'))['db'];var utils=require(_0x2eba('0x5'));var logger=require(_0x2eba('0x6'))(_0x2eba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2eba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4d9a,_0x14c40a,_0x4e7a50){return new BPromise(function(_0x279806,_0x1fed79){return client[_0x2eba('0x9')](_0x1b4d9a,_0x4e7a50)[_0x2eba('0xa')](function(_0x1cc4e){logger[_0x2eba('0xb')](_0x2eba('0xc'),_0x14c40a,_0x2eba('0xd'));logger[_0x2eba('0xe')](_0x2eba('0xf'),_0x14c40a,'request\x20sent',JSON[_0x2eba('0x10')](_0x1cc4e));if(_0x1cc4e[_0x2eba('0x11')]){if(_0x1cc4e['error'][_0x2eba('0x12')]===0x1f4){logger[_0x2eba('0x11')](_0x2eba('0xc'),_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x1fed79(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}logger['error']('SACreditNote,\x20%s,\x20%s',_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x279806(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}else{logger[_0x2eba('0xb')]('SACreditNote,\x20%s,\x20%s',_0x14c40a,_0x2eba('0xd'));_0x279806(_0x1cc4e[_0x2eba('0x14')][_0x2eba('0x13')]);}})[_0x2eba('0x15')](function(_0x2de66e){logger['error'](_0x2eba('0xc'),_0x14c40a,_0x2de66e);_0x1fed79(_0x2de66e);});});} \ No newline at end of file +var _0xa809=['error','message','info','result','catch','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SACreditNote,\x20%s,\x20%s','request\x20sent','debug','SACreditNote,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3013b9,_0x2c55e8){var _0x2089a9=function(_0x268650){while(--_0x268650){_0x3013b9['push'](_0x3013b9['shift']());}};_0x2089a9(++_0x2c55e8);}(_0xa809,0x1f3));var _0x9a80=function(_0x54a190,_0x1815e2){_0x54a190=_0x54a190-0x0;var _0x1550e7=_0xa809[_0x54a190];return _0x1550e7;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a80('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var config=require(_0x9a80('0x4'));var jayson=require(_0x9a80('0x5'));var client=jayson['client'][_0x9a80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x504ba8,_0x17b704,_0x286ac5){return new BPromise(function(_0x4ea507,_0x1ef67a){return client[_0x9a80('0x7')](_0x504ba8,_0x286ac5)[_0x9a80('0x8')](function(_0x269ee2){logger['info'](_0x9a80('0x9'),_0x17b704,_0x9a80('0xa'));logger[_0x9a80('0xb')](_0x9a80('0xc'),_0x17b704,_0x9a80('0xa'),JSON[_0x9a80('0xd')](_0x269ee2));if(_0x269ee2[_0x9a80('0xe')]){if(_0x269ee2[_0x9a80('0xe')]['code']===0x1f4){logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);return _0x1ef67a(_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);}logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2['error'][_0x9a80('0xf')]);return _0x4ea507(_0x269ee2['error'][_0x9a80('0xf')]);}else{logger[_0x9a80('0x10')](_0x9a80('0x9'),_0x17b704,'request\x20sent');_0x4ea507(_0x269ee2[_0x9a80('0x11')][_0x9a80('0xf')]);}})[_0x9a80('0x12')](function(_0x12ecee){logger[_0x9a80('0xe')]('SACreditNote,\x20%s,\x20%s',_0x17b704,_0x12ecee);_0x1ef67a(_0x12ecee);});});} \ No newline at end of file diff --git a/server/api/saCreditNoteDetail/index.js b/server/api/saCreditNoteDetail/index.js index bc78c3f..a620cfd 100644 --- a/server/api/saCreditNoteDetail/index.js +++ b/server/api/saCreditNoteDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7d5=['../../components/auth/service','../../config/environment','./saCreditNoteDetail.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe7d5,0xf6));var _0x5e7d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe7d5[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5e7d('0x0'));var util=require(_0x5e7d('0x1'));var path=require(_0x5e7d('0x2'));var timeout=require(_0x5e7d('0x3'));var express=require(_0x5e7d('0x4'));var router=express[_0x5e7d('0x5')]();var auth=require(_0x5e7d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5e7d('0x7'));var controller=require(_0x5e7d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5e7d('0x9')]);router[_0x5e7d('0xa')](_0x5e7d('0xb'),auth[_0x5e7d('0xc')](),controller['describe']);router[_0x5e7d('0xa')](_0x5e7d('0xd'),auth[_0x5e7d('0xc')](),controller[_0x5e7d('0xe')]);router[_0x5e7d('0xf')]('/',auth['isAuthenticated'](),controller[_0x5e7d('0x10')]);router[_0x5e7d('0x11')](_0x5e7d('0xd'),auth[_0x5e7d('0xc')](),controller[_0x5e7d('0x12')]);router[_0x5e7d('0x13')](_0x5e7d('0xd'),auth[_0x5e7d('0xc')](),controller['destroy']);module[_0x5e7d('0x14')]=router; \ No newline at end of file +var _0x16e1=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','update','delete','destroy'];(function(_0x1cf870,_0x5f172d){var _0x439018=function(_0x4e0f93){while(--_0x4e0f93){_0x1cf870['push'](_0x1cf870['shift']());}};_0x439018(++_0x5f172d);}(_0x16e1,0xfc));var _0x116e=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x16e1[_0x25662e];return _0x59b7bc;};'use strict';var multer=require(_0x116e('0x0'));var util=require(_0x116e('0x1'));var path=require(_0x116e('0x2'));var timeout=require(_0x116e('0x3'));var express=require(_0x116e('0x4'));var router=express[_0x116e('0x5')]();var auth=require(_0x116e('0x6'));var interaction=require(_0x116e('0x7'));var config=require(_0x116e('0x8'));var controller=require('./saCreditNoteDetail.controller');router['get']('/',auth[_0x116e('0x9')](),controller[_0x116e('0xa')]);router[_0x116e('0xb')]('/describe',auth[_0x116e('0x9')](),controller['describe']);router['get'](_0x116e('0xc'),auth[_0x116e('0x9')](),controller[_0x116e('0xd')]);router[_0x116e('0xe')]('/',auth[_0x116e('0x9')](),controller['create']);router['put']('/:id',auth[_0x116e('0x9')](),controller[_0x116e('0xf')]);router[_0x116e('0x10')](_0x116e('0xc'),auth[_0x116e('0x9')](),controller[_0x116e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saCreditNoteDetail/saCreditNoteDetail.attributes.js b/server/api/saCreditNoteDetail/saCreditNoteDetail.attributes.js index 4284e8b..a2c19f7 100644 --- a/server/api/saCreditNoteDetail/saCreditNoteDetail.attributes.js +++ b/server/api/saCreditNoteDetail/saCreditNoteDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['DECIMAL','sequelize','INTEGER','STRING','TEXT','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'];(function(_0x1e4662,_0x26a207){var _0x5f5724=function(_0x575d40){while(--_0x575d40){_0x1e4662['push'](_0x1e4662['shift']());}};_0x5f5724(++_0x26a207);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'companyName':{'type':Sequelize['STRING'],'allowNull':![]},'companyId':{'type':Sequelize[_0xee2f('0x1')],'allowNull':![]},'productName':{'type':Sequelize['TEXT'],'allowNull':![]},'productCode':{'type':Sequelize[_0xee2f('0x2')],'allowNull':![]},'productDescription':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4'))+_0xee2f('0x5')},'typeName':{'type':Sequelize[_0xee2f('0x2')],'allowNull':![]},'unitName':{'type':Sequelize['STRING']},'pricelistName':{'type':Sequelize[_0xee2f('0x3')],'allowNull':![]},'priceListId':{'type':Sequelize[_0xee2f('0x1')],'allowNull':![]},'netPrice':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0xee2f('0x6')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0xee2f('0x6')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize['STRING'],'allowNull':![]},'note':{'type':Sequelize[_0xee2f('0x3')]},'subscriptionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0xee2f('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0xee2f('0x1')],'allowNull':![]},'quantity':{'type':Sequelize['INTEGER'],'allowNull':![]}}; \ No newline at end of file +var _0xeff8=['INTEGER','TEXT','STRING','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DECIMAL','sequelize','exports'];(function(_0x4630b8,_0x2fd52d){var _0x355db1=function(_0xd4e176){while(--_0xd4e176){_0x4630b8['push'](_0x4630b8['shift']());}};_0x355db1(++_0x2fd52d);}(_0xeff8,0x186));var _0x8eff=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xeff8[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'companyName':{'type':Sequelize['STRING'],'allowNull':![]},'companyId':{'type':Sequelize[_0x8eff('0x2')],'allowNull':![]},'productName':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'productCode':{'type':Sequelize[_0x8eff('0x4')],'allowNull':![]},'productDescription':{'type':Sequelize['TEXT'](_0x8eff('0x5'))+_0x8eff('0x6')},'typeName':{'type':Sequelize[_0x8eff('0x4')],'allowNull':![]},'unitName':{'type':Sequelize[_0x8eff('0x4')]},'pricelistName':{'type':Sequelize['TEXT'],'allowNull':![]},'priceListId':{'type':Sequelize[_0x8eff('0x2')],'allowNull':![]},'netPrice':{'type':Sequelize[_0x8eff('0x7')](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0x8eff('0x7')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0x8eff('0x7')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize['STRING'],'allowNull':![]},'note':{'type':Sequelize[_0x8eff('0x3')]},'subscriptionId':{'type':Sequelize[_0x8eff('0x2')],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0x8eff('0x4')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0x8eff('0x2')],'allowNull':![]},'quantity':{'type':Sequelize['INTEGER'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/saCreditNoteDetail/saCreditNoteDetail.controller.js b/server/api/saCreditNoteDetail/saCreditNoteDetail.controller.js index 6b092f3..73e80f5 100644 --- a/server/api/saCreditNoteDetail/saCreditNoteDetail.controller.js +++ b/server/api/saCreditNoteDetail/saCreditNoteDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f3c=['intersection','attributes','fields','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','field','filter','options','includeAll','include','findAll','params','length','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SACreditNoteDetail','model','keys','query','filters'];(function(_0x1aa552,_0x3ac508){var _0x4a773d=function(_0x8ed0dd){while(--_0x8ed0dd){_0x1aa552['push'](_0x1aa552['shift']());}};_0x4a773d(++_0x3ac508);}(_0x5f3c,0xab));var _0xc5f3=function(_0xc2dccb,_0x5957f2){_0xc2dccb=_0xc2dccb-0x0;var _0x3239b3=_0x5f3c[_0xc2dccb];return _0x3239b3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc5f3('0x0'));var zipdir=require(_0xc5f3('0x1'));var jsonpatch=require(_0xc5f3('0x2'));var rp=require(_0xc5f3('0x3'));var moment=require(_0xc5f3('0x4'));var BPromise=require(_0xc5f3('0x5'));var Mustache=require(_0xc5f3('0x6'));var util=require(_0xc5f3('0x7'));var path=require('path');var sox=require(_0xc5f3('0x8'));var csv=require('to-csv');var ejs=require(_0xc5f3('0x9'));var fs=require('fs');var _=require(_0xc5f3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5f3('0xb'));var deskjs=require(_0xc5f3('0xc'));var toCsv=require(_0xc5f3('0xd'));var querystring=require(_0xc5f3('0xe'));var Papa=require(_0xc5f3('0xf'));var Redis=require(_0xc5f3('0x10'));var authService=require(_0xc5f3('0x11'));var qs=require(_0xc5f3('0x12'));var hardwareService=require(_0xc5f3('0x13'));var logger=require(_0xc5f3('0x14'))(_0xc5f3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5f3('0x16'));var db=require(_0xc5f3('0x17'))['db'];function respondWithStatusCode(_0x375fe6,_0x4e9a97){_0x4e9a97=_0x4e9a97||0xcc;return function(_0x2b28b5){if(_0x2b28b5){return _0x375fe6[_0xc5f3('0x18')](_0x4e9a97);}return _0x375fe6[_0xc5f3('0x19')](_0x4e9a97)[_0xc5f3('0x1a')]();};}function respondWithResult(_0x44faf1,_0x4c2cd1){_0x4c2cd1=_0x4c2cd1||0xc8;return function(_0xc09ab7){if(_0xc09ab7){return _0x44faf1[_0xc5f3('0x19')](_0x4c2cd1)['json'](_0xc09ab7);}};}function respondWithFilteredResult(_0x36ff2f,_0x4524d1){return function(_0x38ed11){if(_0x38ed11){var _0x42462d=_0x38ed11[_0xc5f3('0x1b')],_0x5d75cb=_0x4524d1[_0xc5f3('0x1c')],_0x3127a2=_0x4524d1[_0xc5f3('0x1c')]+_0x4524d1[_0xc5f3('0x1d')],_0x588a20;if(_0x3127a2>=_0x42462d){_0x3127a2=_0x42462d;_0x588a20=0xc8;}else{_0x588a20=0xce;}_0x36ff2f[_0xc5f3('0x19')](_0x588a20);return _0x36ff2f[_0xc5f3('0x1e')]('Content-Range',_0x5d75cb+'-'+_0x3127a2+'/'+_0x42462d)[_0xc5f3('0x1f')](_0x38ed11);}return null;};}function patchUpdates(_0x19dd2e){return function(_0x298c14){try{jsonpatch[_0xc5f3('0x20')](_0x298c14,_0x19dd2e,!![]);}catch(_0x5eae58){return BPromise[_0xc5f3('0x21')](_0x5eae58);}return _0x298c14[_0xc5f3('0x22')]();};}function saveUpdates(_0x59f5cf,_0x694345){return function(_0x5a7921){if(_0x5a7921){return _0x5a7921[_0xc5f3('0x23')](_0x59f5cf)[_0xc5f3('0x24')](function(_0x3ccc1c){return _0x3ccc1c;});}return null;};}function removeEntity(_0x560fa0,_0x17a532){return function(_0x4b4bdf){if(_0x4b4bdf){return _0x4b4bdf[_0xc5f3('0x25')]()[_0xc5f3('0x24')](function(){_0x560fa0[_0xc5f3('0x19')](0xcc)[_0xc5f3('0x1a')]();});}};}function handleEntityNotFound(_0x3a3017,_0x45585b){return function(_0x908a0a){if(!_0x908a0a){_0x3a3017[_0xc5f3('0x18')](0x194);}return _0x908a0a;};}function handleError(_0x564f35,_0x22f6f3){_0x22f6f3=_0x22f6f3||0x1f4;return function(_0x359685){logger[_0xc5f3('0x26')](_0x359685[_0xc5f3('0x27')]);if(_0x359685[_0xc5f3('0x28')]){delete _0x359685[_0xc5f3('0x28')];}_0x564f35['status'](_0x22f6f3)[_0xc5f3('0x29')](_0x359685);};}exports[_0xc5f3('0x2a')]=function(_0x13a9b2,_0x241f78){var _0x279ff9={},_0x20b8df={},_0x4013fe={'count':0x0,'rows':[]};var _0x34e1ab=db[_0xc5f3('0x2b')]['rawAttributes'];_0x20b8df[_0xc5f3('0x2c')]=_[_0xc5f3('0x2d')](_0x34e1ab);_0x20b8df[_0xc5f3('0x2e')]=_[_0xc5f3('0x2d')](_0x13a9b2[_0xc5f3('0x2e')]);_0x20b8df[_0xc5f3('0x2f')]=_[_0xc5f3('0x30')](_0x20b8df['model'],_0x20b8df[_0xc5f3('0x2e')]);_0x279ff9[_0xc5f3('0x31')]=_[_0xc5f3('0x30')](_0x20b8df[_0xc5f3('0x2c')],qs[_0xc5f3('0x32')](_0x13a9b2[_0xc5f3('0x2e')][_0xc5f3('0x32')]));_0x279ff9['attributes']=_0x279ff9[_0xc5f3('0x31')]['length']?_0x279ff9[_0xc5f3('0x31')]:_0x20b8df['model'];if(!_0x13a9b2[_0xc5f3('0x2e')]['hasOwnProperty'](_0xc5f3('0x33'))){_0x279ff9[_0xc5f3('0x1d')]=qs[_0xc5f3('0x1d')](_0x13a9b2['query'][_0xc5f3('0x1d')]);_0x279ff9[_0xc5f3('0x1c')]=qs[_0xc5f3('0x1c')](_0x13a9b2['query']['offset']);}_0x279ff9[_0xc5f3('0x34')]=qs[_0xc5f3('0x35')](_0x13a9b2[_0xc5f3('0x2e')][_0xc5f3('0x35')]);_0x279ff9[_0xc5f3('0x36')]=qs['filters'](_[_0xc5f3('0x37')](_0x13a9b2[_0xc5f3('0x2e')],_0x20b8df[_0xc5f3('0x2f')]));if(_0x13a9b2['query']['filter']){_0x279ff9[_0xc5f3('0x36')]=_[_0xc5f3('0x38')](_0x279ff9[_0xc5f3('0x36')],{'$or':_[_0xc5f3('0x39')](_0x34e1ab,function(_0x375097){if(_0x375097[_0xc5f3('0x3a')]['key']!==_0xc5f3('0x3b')){var _0x199164={};_0x199164[_0x375097[_0xc5f3('0x3c')]]={'$like':'%'+_0x13a9b2[_0xc5f3('0x2e')][_0xc5f3('0x3d')]+'%'};return _0x199164;}})});}_0x279ff9=_[_0xc5f3('0x38')]({},_0x279ff9,_0x13a9b2[_0xc5f3('0x3e')]);var _0x22982f={'where':_0x279ff9[_0xc5f3('0x36')]};return db['SACreditNoteDetail'][_0xc5f3('0x1b')](_0x22982f)[_0xc5f3('0x24')](function(_0x548e16){_0x4013fe[_0xc5f3('0x1b')]=_0x548e16;if(_0x13a9b2[_0xc5f3('0x2e')][_0xc5f3('0x3f')]){_0x279ff9[_0xc5f3('0x40')]=[{'all':!![]}];}return db[_0xc5f3('0x2b')][_0xc5f3('0x41')](_0x279ff9);})[_0xc5f3('0x24')](function(_0x3e8cf6){_0x4013fe['rows']=_0x3e8cf6;return _0x4013fe;})[_0xc5f3('0x24')](respondWithFilteredResult(_0x241f78,_0x279ff9))['catch'](handleError(_0x241f78,null));};exports['show']=function(_0x2bfda2,_0x4ff23b){var _0x49be27={'raw':![],'where':{'id':_0x2bfda2[_0xc5f3('0x42')]['id']}},_0x1c3e06={};_0x1c3e06[_0xc5f3('0x2c')]=_['keys'](db[_0xc5f3('0x2b')]['rawAttributes']);_0x1c3e06['query']=_[_0xc5f3('0x2d')](_0x2bfda2[_0xc5f3('0x2e')]);_0x1c3e06['filters']=_[_0xc5f3('0x30')](_0x1c3e06[_0xc5f3('0x2c')],_0x1c3e06[_0xc5f3('0x2e')]);_0x49be27[_0xc5f3('0x31')]=_[_0xc5f3('0x30')](_0x1c3e06[_0xc5f3('0x2c')],qs['fields'](_0x2bfda2['query'][_0xc5f3('0x32')]));_0x49be27[_0xc5f3('0x31')]=_0x49be27[_0xc5f3('0x31')][_0xc5f3('0x43')]?_0x49be27[_0xc5f3('0x31')]:_0x1c3e06[_0xc5f3('0x2c')];if(_0x2bfda2[_0xc5f3('0x2e')]['includeAll']){_0x49be27[_0xc5f3('0x40')]=[{'all':!![]}];}_0x49be27=_[_0xc5f3('0x38')]({},_0x49be27,_0x2bfda2['options']);return db['SACreditNoteDetail']['find'](_0x49be27)[_0xc5f3('0x24')](handleEntityNotFound(_0x4ff23b,null))['then'](respondWithResult(_0x4ff23b,null))[_0xc5f3('0x44')](handleError(_0x4ff23b,null));};exports[_0xc5f3('0x45')]=function(_0x23b243,_0x1a529b){return db[_0xc5f3('0x2b')][_0xc5f3('0x45')](_0x23b243['body'],{})[_0xc5f3('0x24')](respondWithResult(_0x1a529b,0xc9))[_0xc5f3('0x44')](handleError(_0x1a529b,null));};exports[_0xc5f3('0x23')]=function(_0x4fd16e,_0x42df5d){if(_0x4fd16e[_0xc5f3('0x46')]['id']){delete _0x4fd16e[_0xc5f3('0x46')]['id'];}return db[_0xc5f3('0x2b')][_0xc5f3('0x47')]({'where':{'id':_0x4fd16e[_0xc5f3('0x42')]['id']}})[_0xc5f3('0x24')](handleEntityNotFound(_0x42df5d,null))[_0xc5f3('0x24')](saveUpdates(_0x4fd16e['body'],null))[_0xc5f3('0x24')](respondWithResult(_0x42df5d,null))[_0xc5f3('0x44')](handleError(_0x42df5d,null));};exports[_0xc5f3('0x25')]=function(_0x3bfd51,_0x15882b){return db['SACreditNoteDetail']['find']({'where':{'id':_0x3bfd51[_0xc5f3('0x42')]['id']}})[_0xc5f3('0x24')](handleEntityNotFound(_0x15882b,null))['then'](removeEntity(_0x15882b,null))[_0xc5f3('0x44')](handleError(_0x15882b,null));};exports[_0xc5f3('0x48')]=function(_0x4ed9ac,_0x16bb99){return db[_0xc5f3('0x2b')][_0xc5f3('0x48')]()[_0xc5f3('0x24')](respondWithResult(_0x16bb99,null))[_0xc5f3('0x44')](handleError(_0x16bb99,null));}; \ No newline at end of file +var _0x399c=['count','offset','limit','Content-Range','apply','reject','update','then','error','name','send','SACreditNoteDetail','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x4a09d2,_0xac1d3){var _0x2372cd=function(_0x2cf0c8){while(--_0x2cf0c8){_0x4a09d2['push'](_0x4a09d2['shift']());}};_0x2372cd(++_0xac1d3);}(_0x399c,0x10d));var _0xc399=function(_0x1771d9,_0x106001){_0x1771d9=_0x1771d9-0x0;var _0x3ce681=_0x399c[_0x1771d9];return _0x3ce681;};'use strict';var pdf=require(_0xc399('0x0'));var emlformat=require(_0xc399('0x1'));var rimraf=require(_0xc399('0x2'));var zipdir=require(_0xc399('0x3'));var jsonpatch=require(_0xc399('0x4'));var rp=require(_0xc399('0x5'));var moment=require(_0xc399('0x6'));var BPromise=require(_0xc399('0x7'));var Mustache=require(_0xc399('0x8'));var util=require(_0xc399('0x9'));var path=require(_0xc399('0xa'));var sox=require(_0xc399('0xb'));var csv=require('to-csv');var ejs=require(_0xc399('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc399('0xd'));var crypto=require('crypto');var jsforce=require(_0xc399('0xe'));var deskjs=require(_0xc399('0xf'));var toCsv=require(_0xc399('0x10'));var querystring=require(_0xc399('0x11'));var Papa=require(_0xc399('0x12'));var Redis=require(_0xc399('0x13'));var authService=require(_0xc399('0x14'));var qs=require(_0xc399('0x15'));var hardwareService=require(_0xc399('0x16'));var logger=require(_0xc399('0x17'))(_0xc399('0x18'));var utils=require('../../config/utils');var config=require(_0xc399('0x19'));var db=require(_0xc399('0x1a'))['db'];function respondWithStatusCode(_0x51b8d3,_0xf068ca){_0xf068ca=_0xf068ca||0xcc;return function(_0x150e75){if(_0x150e75){return _0x51b8d3[_0xc399('0x1b')](_0xf068ca);}return _0x51b8d3[_0xc399('0x1c')](_0xf068ca)[_0xc399('0x1d')]();};}function respondWithResult(_0x117704,_0x4d5dae){_0x4d5dae=_0x4d5dae||0xc8;return function(_0x2c11f1){if(_0x2c11f1){return _0x117704['status'](_0x4d5dae)[_0xc399('0x1e')](_0x2c11f1);}};}function respondWithFilteredResult(_0x5cb78e,_0x55fc11){return function(_0x31b792){if(_0x31b792){var _0x4a8cd6=_0x31b792[_0xc399('0x1f')],_0xe3b6b7=_0x55fc11[_0xc399('0x20')],_0x377939=_0x55fc11[_0xc399('0x20')]+_0x55fc11[_0xc399('0x21')],_0x4690a3;if(_0x377939>=_0x4a8cd6){_0x377939=_0x4a8cd6;_0x4690a3=0xc8;}else{_0x4690a3=0xce;}_0x5cb78e[_0xc399('0x1c')](_0x4690a3);return _0x5cb78e['set'](_0xc399('0x22'),_0xe3b6b7+'-'+_0x377939+'/'+_0x4a8cd6)['json'](_0x31b792);}return null;};}function patchUpdates(_0x4e1635){return function(_0x17e538){try{jsonpatch[_0xc399('0x23')](_0x17e538,_0x4e1635,!![]);}catch(_0x519dba){return BPromise[_0xc399('0x24')](_0x519dba);}return _0x17e538['save']();};}function saveUpdates(_0xc4e7ba,_0x381dd6){return function(_0x54685f){if(_0x54685f){return _0x54685f[_0xc399('0x25')](_0xc4e7ba)[_0xc399('0x26')](function(_0x74053b){return _0x74053b;});}return null;};}function removeEntity(_0x3217ec,_0x22e50d){return function(_0xc74372){if(_0xc74372){return _0xc74372['destroy']()[_0xc399('0x26')](function(){_0x3217ec[_0xc399('0x1c')](0xcc)[_0xc399('0x1d')]();});}};}function handleEntityNotFound(_0x48cddd,_0xec2527){return function(_0x55fe5e){if(!_0x55fe5e){_0x48cddd['sendStatus'](0x194);}return _0x55fe5e;};}function handleError(_0x49ed8d,_0x180c91){_0x180c91=_0x180c91||0x1f4;return function(_0xb26999){logger[_0xc399('0x27')](_0xb26999['stack']);if(_0xb26999[_0xc399('0x28')]){delete _0xb26999[_0xc399('0x28')];}_0x49ed8d[_0xc399('0x1c')](_0x180c91)[_0xc399('0x29')](_0xb26999);};}exports['index']=function(_0x2fb951,_0x686df0){var _0x1b4aef={},_0x55d053={},_0x640498={'count':0x0,'rows':[]};var _0x182c88=db[_0xc399('0x2a')][_0xc399('0x2b')];_0x55d053[_0xc399('0x2c')]=_['keys'](_0x182c88);_0x55d053[_0xc399('0x2d')]=_['keys'](_0x2fb951['query']);_0x55d053[_0xc399('0x2e')]=_[_0xc399('0x2f')](_0x55d053[_0xc399('0x2c')],_0x55d053['query']);_0x1b4aef['attributes']=_[_0xc399('0x2f')](_0x55d053[_0xc399('0x2c')],qs[_0xc399('0x30')](_0x2fb951[_0xc399('0x2d')][_0xc399('0x30')]));_0x1b4aef[_0xc399('0x31')]=_0x1b4aef[_0xc399('0x31')][_0xc399('0x32')]?_0x1b4aef[_0xc399('0x31')]:_0x55d053[_0xc399('0x2c')];if(!_0x2fb951[_0xc399('0x2d')][_0xc399('0x33')](_0xc399('0x34'))){_0x1b4aef['limit']=qs['limit'](_0x2fb951[_0xc399('0x2d')]['limit']);_0x1b4aef[_0xc399('0x20')]=qs[_0xc399('0x20')](_0x2fb951[_0xc399('0x2d')][_0xc399('0x20')]);}_0x1b4aef[_0xc399('0x35')]=qs['sort'](_0x2fb951[_0xc399('0x2d')]['sort']);_0x1b4aef[_0xc399('0x36')]=qs['filters'](_[_0xc399('0x37')](_0x2fb951[_0xc399('0x2d')],_0x55d053[_0xc399('0x2e')]));if(_0x2fb951['query'][_0xc399('0x38')]){_0x1b4aef['where']=_[_0xc399('0x39')](_0x1b4aef['where'],{'$or':_[_0xc399('0x3a')](_0x182c88,function(_0xdf9a84){if(_0xdf9a84[_0xc399('0x3b')][_0xc399('0x3c')]!=='VIRTUAL'){var _0x4908a4={};_0x4908a4[_0xdf9a84[_0xc399('0x3d')]]={'$like':'%'+_0x2fb951[_0xc399('0x2d')][_0xc399('0x38')]+'%'};return _0x4908a4;}})});}_0x1b4aef=_['merge']({},_0x1b4aef,_0x2fb951[_0xc399('0x3e')]);var _0x21592d={'where':_0x1b4aef[_0xc399('0x36')]};return db[_0xc399('0x2a')][_0xc399('0x1f')](_0x21592d)[_0xc399('0x26')](function(_0x5b6362){_0x640498[_0xc399('0x1f')]=_0x5b6362;if(_0x2fb951[_0xc399('0x2d')][_0xc399('0x3f')]){_0x1b4aef[_0xc399('0x40')]=[{'all':!![]}];}return db[_0xc399('0x2a')][_0xc399('0x41')](_0x1b4aef);})[_0xc399('0x26')](function(_0x2ac86b){_0x640498[_0xc399('0x42')]=_0x2ac86b;return _0x640498;})[_0xc399('0x26')](respondWithFilteredResult(_0x686df0,_0x1b4aef))[_0xc399('0x43')](handleError(_0x686df0,null));};exports['show']=function(_0x563852,_0x1000da){var _0x5906b5={'raw':![],'where':{'id':_0x563852[_0xc399('0x44')]['id']}},_0x3ed276={};_0x3ed276[_0xc399('0x2c')]=_[_0xc399('0x45')](db[_0xc399('0x2a')]['rawAttributes']);_0x3ed276[_0xc399('0x2d')]=_[_0xc399('0x45')](_0x563852[_0xc399('0x2d')]);_0x3ed276['filters']=_['intersection'](_0x3ed276[_0xc399('0x2c')],_0x3ed276[_0xc399('0x2d')]);_0x5906b5['attributes']=_[_0xc399('0x2f')](_0x3ed276[_0xc399('0x2c')],qs[_0xc399('0x30')](_0x563852[_0xc399('0x2d')][_0xc399('0x30')]));_0x5906b5[_0xc399('0x31')]=_0x5906b5[_0xc399('0x31')]['length']?_0x5906b5[_0xc399('0x31')]:_0x3ed276[_0xc399('0x2c')];if(_0x563852[_0xc399('0x2d')][_0xc399('0x3f')]){_0x5906b5[_0xc399('0x40')]=[{'all':!![]}];}_0x5906b5=_[_0xc399('0x39')]({},_0x5906b5,_0x563852[_0xc399('0x3e')]);return db['SACreditNoteDetail']['find'](_0x5906b5)[_0xc399('0x26')](handleEntityNotFound(_0x1000da,null))['then'](respondWithResult(_0x1000da,null))[_0xc399('0x43')](handleError(_0x1000da,null));};exports[_0xc399('0x46')]=function(_0x3577dd,_0xed1758){return db[_0xc399('0x2a')][_0xc399('0x46')](_0x3577dd[_0xc399('0x47')],{})[_0xc399('0x26')](respondWithResult(_0xed1758,0xc9))[_0xc399('0x43')](handleError(_0xed1758,null));};exports[_0xc399('0x25')]=function(_0x3a3fe5,_0x24fb26){if(_0x3a3fe5[_0xc399('0x47')]['id']){delete _0x3a3fe5[_0xc399('0x47')]['id'];}return db[_0xc399('0x2a')][_0xc399('0x48')]({'where':{'id':_0x3a3fe5[_0xc399('0x44')]['id']}})[_0xc399('0x26')](handleEntityNotFound(_0x24fb26,null))[_0xc399('0x26')](saveUpdates(_0x3a3fe5['body'],null))['then'](respondWithResult(_0x24fb26,null))[_0xc399('0x43')](handleError(_0x24fb26,null));};exports[_0xc399('0x49')]=function(_0x55a146,_0xf7484e){return db[_0xc399('0x2a')][_0xc399('0x48')]({'where':{'id':_0x55a146[_0xc399('0x44')]['id']}})[_0xc399('0x26')](handleEntityNotFound(_0xf7484e,null))[_0xc399('0x26')](removeEntity(_0xf7484e,null))[_0xc399('0x43')](handleError(_0xf7484e,null));};exports[_0xc399('0x4a')]=function(_0x3e3b05,_0x59963d){return db[_0xc399('0x2a')][_0xc399('0x4a')]()['then'](respondWithResult(_0x59963d,null))[_0xc399('0x43')](handleError(_0x59963d,null));}; \ No newline at end of file diff --git a/server/api/saCreditNoteDetail/saCreditNoteDetail.model.js b/server/api/saCreditNoteDetail/saCreditNoteDetail.model.js index 3bbba7d..52a4e33 100644 --- a/server/api/saCreditNoteDetail/saCreditNoteDetail.model.js +++ b/server/api/saCreditNoteDetail/saCreditNoteDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55cd=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SACreditNoteDetail','sa_creditNote_details'];(function(_0x4df8a1,_0x51c009){var _0x4e1d00=function(_0x30856b){while(--_0x30856b){_0x4df8a1['push'](_0x4df8a1['shift']());}};_0x4e1d00(++_0x51c009);}(_0x55cd,0x1c8));var _0xd55c=function(_0x276a45,_0x524a0a){_0x276a45=_0x276a45-0x0;var _0x32128d=_0x55cd[_0x276a45];return _0x32128d;};'use strict';var _=require(_0xd55c('0x0'));var util=require(_0xd55c('0x1'));var logger=require('../../config/logger')(_0xd55c('0x2'));var moment=require(_0xd55c('0x3'));var BPromise=require(_0xd55c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd55c('0x5'));var rimraf=require(_0xd55c('0x6'));var config=require(_0xd55c('0x7'));var attributes=require('./saCreditNoteDetail.attributes');module[_0xd55c('0x8')]=function(_0x316fd0,_0x357c90){return _0x316fd0[_0xd55c('0x9')](_0xd55c('0xa'),attributes,{'tableName':_0xd55c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c4a=['define','SACreditNoteDetail','sa_creditNote_details','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./saCreditNoteDetail.attributes','exports'];(function(_0x5c4e4e,_0x126618){var _0x246195=function(_0x2bbc33){while(--_0x2bbc33){_0x5c4e4e['push'](_0x5c4e4e['shift']());}};_0x246195(++_0x126618);}(_0x0c4a,0x12f));var _0xa0c4=function(_0x4905fd,_0xde9d0f){_0x4905fd=_0x4905fd-0x0;var _0x3c9f2e=_0x0c4a[_0x4905fd];return _0x3c9f2e;};'use strict';var _=require(_0xa0c4('0x0'));var util=require(_0xa0c4('0x1'));var logger=require(_0xa0c4('0x2'))(_0xa0c4('0x3'));var moment=require(_0xa0c4('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa0c4('0x6'));var attributes=require(_0xa0c4('0x7'));module[_0xa0c4('0x8')]=function(_0x5a6060,_0x4faede){return _0x5a6060[_0xa0c4('0x9')](_0xa0c4('0xa'),attributes,{'tableName':_0xa0c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saCreditNoteDetail/saCreditNoteDetail.rpc.js b/server/api/saCreditNoteDetail/saCreditNoteDetail.rpc.js index f5c4562..b16687e 100644 --- a/server/api/saCreditNoteDetail/saCreditNoteDetail.rpc.js +++ b/server/api/saCreditNoteDetail/saCreditNoteDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7443=['request','then','info','SACreditNoteDetail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x7443,0x8f));var _0x3744=function(_0x4b23fb,_0x3e5765){_0x4b23fb=_0x4b23fb-0x0;var _0x2e16d4=_0x7443[_0x4b23fb];return _0x2e16d4;};'use strict';var _=require(_0x3744('0x0'));var util=require('util');var moment=require(_0x3744('0x1'));var BPromise=require(_0x3744('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3744('0x3'));var db=require(_0x3744('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3744('0x5'))(_0x3744('0x6'));var config=require(_0x3744('0x7'));var jayson=require(_0x3744('0x8'));var client=jayson[_0x3744('0x9')][_0x3744('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4894b3,_0xb64248,_0x5c58c8){return new BPromise(function(_0x483eed,_0x1ccde3){return client[_0x3744('0xb')](_0x4894b3,_0x5c58c8)[_0x3744('0xc')](function(_0xeae0fd){logger[_0x3744('0xd')](_0x3744('0xe'),_0xb64248,_0x3744('0xf'));logger[_0x3744('0x10')]('SACreditNoteDetail,\x20%s,\x20%s,\x20%s',_0xb64248,_0x3744('0xf'),JSON[_0x3744('0x11')](_0xeae0fd));if(_0xeae0fd[_0x3744('0x12')]){if(_0xeae0fd[_0x3744('0x12')]['code']===0x1f4){logger[_0x3744('0x12')]('SACreditNoteDetail,\x20%s,\x20%s',_0xb64248,_0xeae0fd[_0x3744('0x12')]['message']);return _0x1ccde3(_0xeae0fd['error'][_0x3744('0x13')]);}logger[_0x3744('0x12')]('SACreditNoteDetail,\x20%s,\x20%s',_0xb64248,_0xeae0fd[_0x3744('0x12')]['message']);return _0x483eed(_0xeae0fd[_0x3744('0x12')][_0x3744('0x13')]);}else{logger[_0x3744('0xd')](_0x3744('0xe'),_0xb64248,_0x3744('0xf'));_0x483eed(_0xeae0fd[_0x3744('0x14')][_0x3744('0x13')]);}})[_0x3744('0x15')](function(_0x37d2e3){logger['error'](_0x3744('0xe'),_0xb64248,_0x37d2e3);_0x1ccde3(_0x37d2e3);});});} \ No newline at end of file +var _0xc35a=['request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SACreditNoteDetail,\x20%s,\x20%s'];(function(_0x181d96,_0x4ffa6f){var _0x3dc5c3=function(_0x12ced6){while(--_0x12ced6){_0x181d96['push'](_0x181d96['shift']());}};_0x3dc5c3(++_0x4ffa6f);}(_0xc35a,0x182));var _0xac35=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc35a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xac35('0x0'));var moment=require(_0xac35('0x1'));var BPromise=require(_0xac35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xac35('0x4'));var logger=require(_0xac35('0x5'))(_0xac35('0x6'));var config=require('../../config/environment');var jayson=require(_0xac35('0x7'));var client=jayson['client'][_0xac35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a9eef,_0x57348a,_0x759e88){return new BPromise(function(_0x246542,_0x35c51c){return client[_0xac35('0x9')](_0x1a9eef,_0x759e88)[_0xac35('0xa')](function(_0x5effe9){logger[_0xac35('0xb')](_0xac35('0xc'),_0x57348a,_0xac35('0xd'));logger[_0xac35('0xe')]('SACreditNoteDetail,\x20%s,\x20%s,\x20%s',_0x57348a,'request\x20sent',JSON[_0xac35('0xf')](_0x5effe9));if(_0x5effe9[_0xac35('0x10')]){if(_0x5effe9[_0xac35('0x10')]['code']===0x1f4){logger[_0xac35('0x10')](_0xac35('0xc'),_0x57348a,_0x5effe9[_0xac35('0x10')][_0xac35('0x11')]);return _0x35c51c(_0x5effe9['error'][_0xac35('0x11')]);}logger['error']('SACreditNoteDetail,\x20%s,\x20%s',_0x57348a,_0x5effe9[_0xac35('0x10')][_0xac35('0x11')]);return _0x246542(_0x5effe9['error']['message']);}else{logger['info'](_0xac35('0xc'),_0x57348a,_0xac35('0xd'));_0x246542(_0x5effe9[_0xac35('0x12')]['message']);}})['catch'](function(_0x450298){logger[_0xac35('0x10')](_0xac35('0xc'),_0x57348a,_0x450298);_0x35c51c(_0x450298);});});} \ No newline at end of file diff --git a/server/api/saCreditNoteNumber/index.js b/server/api/saCreditNoteNumber/index.js index 09a0ce1..277f3de 100644 --- a/server/api/saCreditNoteNumber/index.js +++ b/server/api/saCreditNoteNumber/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a18=['../../components/auth/service','../../components/interaction/service','../../config/environment','./saCreditNoteNumber.controller','get','isAuthenticated','index','/describe','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x58a037,_0x116964){var _0x447e3b=function(_0x69c409){while(--_0x69c409){_0x58a037['push'](_0x58a037['shift']());}};_0x447e3b(++_0x116964);}(_0x7a18,0x150));var _0x87a1=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x7a18[_0xfedc72];return _0x2c7c78;};'use strict';var multer=require(_0x87a1('0x0'));var util=require(_0x87a1('0x1'));var path=require(_0x87a1('0x2'));var timeout=require(_0x87a1('0x3'));var express=require(_0x87a1('0x4'));var router=express[_0x87a1('0x5')]();var auth=require(_0x87a1('0x6'));var interaction=require(_0x87a1('0x7'));var config=require(_0x87a1('0x8'));var controller=require(_0x87a1('0x9'));router[_0x87a1('0xa')]('/',auth[_0x87a1('0xb')](),controller[_0x87a1('0xc')]);router[_0x87a1('0xa')](_0x87a1('0xd'),auth[_0x87a1('0xb')](),controller['describe']);router['get']('/:id',auth[_0x87a1('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x87a1('0xe')]);router['put'](_0x87a1('0xf'),auth[_0x87a1('0xb')](),controller[_0x87a1('0x10')]);router[_0x87a1('0x11')]('/:id',auth[_0x87a1('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x99bb=['isAuthenticated','show','post','create','put','/:id','update','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./saCreditNoteNumber.controller','get','index','/describe'];(function(_0x105611,_0x10ad65){var _0x42bb12=function(_0x4d3228){while(--_0x4d3228){_0x105611['push'](_0x105611['shift']());}};_0x42bb12(++_0x10ad65);}(_0x99bb,0x86));var _0xb99b=function(_0x4a06fb,_0x664507){_0x4a06fb=_0x4a06fb-0x0;var _0x2616e9=_0x99bb[_0x4a06fb];return _0x2616e9;};'use strict';var multer=require(_0xb99b('0x0'));var util=require('util');var path=require(_0xb99b('0x1'));var timeout=require('connect-timeout');var express=require(_0xb99b('0x2'));var router=express[_0xb99b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb99b('0x4'));var config=require(_0xb99b('0x5'));var controller=require(_0xb99b('0x6'));router[_0xb99b('0x7')]('/',auth['isAuthenticated'](),controller[_0xb99b('0x8')]);router[_0xb99b('0x7')](_0xb99b('0x9'),auth[_0xb99b('0xa')](),controller['describe']);router['get']('/:id',auth[_0xb99b('0xa')](),controller[_0xb99b('0xb')]);router[_0xb99b('0xc')]('/',auth[_0xb99b('0xa')](),controller[_0xb99b('0xd')]);router[_0xb99b('0xe')](_0xb99b('0xf'),auth[_0xb99b('0xa')](),controller[_0xb99b('0x10')]);router['delete']('/:id',auth[_0xb99b('0xa')](),controller['destroy']);module[_0xb99b('0x11')]=router; \ No newline at end of file diff --git a/server/api/saCreditNoteNumber/saCreditNoteNumber.attributes.js b/server/api/saCreditNoteNumber/saCreditNoteNumber.attributes.js index 9b5cb12..c59af75 100644 --- a/server/api/saCreditNoteNumber/saCreditNoteNumber.attributes.js +++ b/server/api/saCreditNoteNumber/saCreditNoteNumber.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b7e=['INTEGER','sequelize'];(function(_0x1af119,_0x85aa7){var _0x3d9ac5=function(_0x333e85){while(--_0x333e85){_0x1af119['push'](_0x1af119['shift']());}};_0x3d9ac5(++_0x85aa7);}(_0x4b7e,0x1e9));var _0xe4b7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4b7e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xe4b7('0x0'));module['exports']={'year':{'type':Sequelize[_0xe4b7('0x1')]},'number':{'type':Sequelize[_0xe4b7('0x1')]}}; \ No newline at end of file +var _0xe6f6=['sequelize','exports','INTEGER'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xe6f6,0xcf));var _0x6e6f=function(_0x131e9b,_0x568d58){_0x131e9b=_0x131e9b-0x0;var _0x380d10=_0xe6f6[_0x131e9b];return _0x380d10;};'use strict';var Sequelize=require(_0x6e6f('0x0'));module[_0x6e6f('0x1')]={'year':{'type':Sequelize[_0x6e6f('0x2')]},'number':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/saCreditNoteNumber/saCreditNoteNumber.controller.js b/server/api/saCreditNoteNumber/saCreditNoteNumber.controller.js index 1e7c0b0..78cb002 100644 --- a/server/api/saCreditNoteNumber/saCreditNoteNumber.controller.js +++ b/server/api/saCreditNoteNumber/saCreditNoteNumber.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6aa=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','reject','save','update','destroy','then','error','name','rawAttributes','keys','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','SACreditNoteNumber','count','includeAll','include','show','find','create','body','catch','params','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0xc6aa,0x75));var _0xac6a=function(_0x135731,_0x1c2a09){_0x135731=_0x135731-0x0;var _0x5368b3=_0xc6aa[_0x135731];return _0x5368b3;};'use strict';var pdf=require(_0xac6a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac6a('0x2'));var moment=require(_0xac6a('0x3'));var BPromise=require(_0xac6a('0x4'));var Mustache=require(_0xac6a('0x5'));var util=require(_0xac6a('0x6'));var path=require(_0xac6a('0x7'));var sox=require(_0xac6a('0x8'));var csv=require(_0xac6a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xac6a('0xa'));var crypto=require(_0xac6a('0xb'));var jsforce=require(_0xac6a('0xc'));var deskjs=require(_0xac6a('0xd'));var toCsv=require(_0xac6a('0x9'));var querystring=require(_0xac6a('0xe'));var Papa=require(_0xac6a('0xf'));var Redis=require(_0xac6a('0x10'));var authService=require(_0xac6a('0x11'));var qs=require(_0xac6a('0x12'));var hardwareService=require(_0xac6a('0x13'));var logger=require(_0xac6a('0x14'))(_0xac6a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xac6a('0x16'))['db'];function respondWithStatusCode(_0x23e894,_0x2bc27e){_0x2bc27e=_0x2bc27e||0xcc;return function(_0x3a8bca){if(_0x3a8bca){return _0x23e894[_0xac6a('0x17')](_0x2bc27e);}return _0x23e894[_0xac6a('0x18')](_0x2bc27e)[_0xac6a('0x19')]();};}function respondWithResult(_0x2b46f4,_0x3596d2){_0x3596d2=_0x3596d2||0xc8;return function(_0x47ccbc){if(_0x47ccbc){return _0x2b46f4[_0xac6a('0x18')](_0x3596d2)['json'](_0x47ccbc);}};}function respondWithFilteredResult(_0x15df42,_0x4b85bb){return function(_0x5c141d){if(_0x5c141d){var _0x59c420=_0x5c141d['count'],_0x20b836=_0x4b85bb[_0xac6a('0x1a')],_0x54813a=_0x4b85bb['offset']+_0x4b85bb[_0xac6a('0x1b')],_0x3ab41f;if(_0x54813a>=_0x59c420){_0x54813a=_0x59c420;_0x3ab41f=0xc8;}else{_0x3ab41f=0xce;}_0x15df42[_0xac6a('0x18')](_0x3ab41f);return _0x15df42['set'](_0xac6a('0x1c'),_0x20b836+'-'+_0x54813a+'/'+_0x59c420)['json'](_0x5c141d);}return null;};}function patchUpdates(_0x546832){return function(_0x56f8ba){try{jsonpatch['apply'](_0x56f8ba,_0x546832,!![]);}catch(_0x291e74){return BPromise[_0xac6a('0x1d')](_0x291e74);}return _0x56f8ba[_0xac6a('0x1e')]();};}function saveUpdates(_0x2c93c6,_0x28f850){return function(_0x4ca4e5){if(_0x4ca4e5){return _0x4ca4e5[_0xac6a('0x1f')](_0x2c93c6)['then'](function(_0x1cba51){return _0x1cba51;});}return null;};}function removeEntity(_0x3c196f,_0x4d98e7){return function(_0x2cfb23){if(_0x2cfb23){return _0x2cfb23[_0xac6a('0x20')]()[_0xac6a('0x21')](function(){_0x3c196f[_0xac6a('0x18')](0xcc)[_0xac6a('0x19')]();});}};}function handleEntityNotFound(_0x5a269d,_0x3d9ce6){return function(_0x4451f0){if(!_0x4451f0){_0x5a269d[_0xac6a('0x17')](0x194);}return _0x4451f0;};}function handleError(_0x2c9c7f,_0x195f05){_0x195f05=_0x195f05||0x1f4;return function(_0x531df0){logger[_0xac6a('0x22')](_0x531df0['stack']);if(_0x531df0[_0xac6a('0x23')]){delete _0x531df0['name'];}_0x2c9c7f[_0xac6a('0x18')](_0x195f05)['send'](_0x531df0);};}exports['index']=function(_0x122988,_0x230595){var _0x4853f9={},_0x9f2893={},_0x1491f6={'count':0x0,'rows':[]};var _0x453059=db['SACreditNoteNumber'][_0xac6a('0x24')];_0x9f2893['model']=_[_0xac6a('0x25')](_0x453059);_0x9f2893['query']=_[_0xac6a('0x25')](_0x122988[_0xac6a('0x26')]);_0x9f2893[_0xac6a('0x27')]=_['intersection'](_0x9f2893[_0xac6a('0x28')],_0x9f2893[_0xac6a('0x26')]);_0x4853f9['attributes']=_[_0xac6a('0x29')](_0x9f2893['model'],qs[_0xac6a('0x2a')](_0x122988[_0xac6a('0x26')]['fields']));_0x4853f9[_0xac6a('0x2b')]=_0x4853f9['attributes'][_0xac6a('0x2c')]?_0x4853f9['attributes']:_0x9f2893[_0xac6a('0x28')];if(!_0x122988['query']['hasOwnProperty'](_0xac6a('0x2d'))){_0x4853f9[_0xac6a('0x1b')]=qs[_0xac6a('0x1b')](_0x122988[_0xac6a('0x26')][_0xac6a('0x1b')]);_0x4853f9[_0xac6a('0x1a')]=qs[_0xac6a('0x1a')](_0x122988[_0xac6a('0x26')][_0xac6a('0x1a')]);}_0x4853f9[_0xac6a('0x2e')]=qs[_0xac6a('0x2f')](_0x122988[_0xac6a('0x26')]['sort']);_0x4853f9[_0xac6a('0x30')]=qs[_0xac6a('0x27')](_[_0xac6a('0x31')](_0x122988[_0xac6a('0x26')],_0x9f2893[_0xac6a('0x27')]));if(_0x122988['query'][_0xac6a('0x32')]){_0x4853f9[_0xac6a('0x30')]=_[_0xac6a('0x33')](_0x4853f9['where'],{'$or':_[_0xac6a('0x34')](_0x453059,function(_0x1f8374){if(_0x1f8374['type'][_0xac6a('0x35')]!==_0xac6a('0x36')){var _0x223483={};_0x223483[_0x1f8374[_0xac6a('0x37')]]={'$like':'%'+_0x122988[_0xac6a('0x26')][_0xac6a('0x32')]+'%'};return _0x223483;}})});}_0x4853f9=_[_0xac6a('0x33')]({},_0x4853f9,_0x122988[_0xac6a('0x38')]);var _0x52b093={'where':_0x4853f9[_0xac6a('0x30')]};return db[_0xac6a('0x39')][_0xac6a('0x3a')](_0x52b093)['then'](function(_0x3564e9){_0x1491f6[_0xac6a('0x3a')]=_0x3564e9;if(_0x122988[_0xac6a('0x26')][_0xac6a('0x3b')]){_0x4853f9[_0xac6a('0x3c')]=[{'all':!![]}];}return db[_0xac6a('0x39')]['findAll'](_0x4853f9);})[_0xac6a('0x21')](function(_0x2ed8bc){_0x1491f6['rows']=_0x2ed8bc;return _0x1491f6;})[_0xac6a('0x21')](respondWithFilteredResult(_0x230595,_0x4853f9))['catch'](handleError(_0x230595,null));};exports[_0xac6a('0x3d')]=function(_0x27d58f,_0x37f6e4){var _0x4635b2={'raw':![],'where':{'id':_0x27d58f['params']['id']}},_0x1fa559={};_0x1fa559['model']=_['keys'](db[_0xac6a('0x39')][_0xac6a('0x24')]);_0x1fa559['query']=_[_0xac6a('0x25')](_0x27d58f[_0xac6a('0x26')]);_0x1fa559['filters']=_[_0xac6a('0x29')](_0x1fa559[_0xac6a('0x28')],_0x1fa559['query']);_0x4635b2['attributes']=_['intersection'](_0x1fa559[_0xac6a('0x28')],qs[_0xac6a('0x2a')](_0x27d58f[_0xac6a('0x26')][_0xac6a('0x2a')]));_0x4635b2['attributes']=_0x4635b2[_0xac6a('0x2b')]['length']?_0x4635b2['attributes']:_0x1fa559[_0xac6a('0x28')];if(_0x27d58f[_0xac6a('0x26')][_0xac6a('0x3b')]){_0x4635b2[_0xac6a('0x3c')]=[{'all':!![]}];}_0x4635b2=_[_0xac6a('0x33')]({},_0x4635b2,_0x27d58f[_0xac6a('0x38')]);return db['SACreditNoteNumber'][_0xac6a('0x3e')](_0x4635b2)[_0xac6a('0x21')](handleEntityNotFound(_0x37f6e4,null))[_0xac6a('0x21')](respondWithResult(_0x37f6e4,null))['catch'](handleError(_0x37f6e4,null));};exports[_0xac6a('0x3f')]=function(_0x3664ba,_0xa4bc26){return db['SACreditNoteNumber'][_0xac6a('0x3f')](_0x3664ba[_0xac6a('0x40')],{})[_0xac6a('0x21')](respondWithResult(_0xa4bc26,0xc9))[_0xac6a('0x41')](handleError(_0xa4bc26,null));};exports[_0xac6a('0x1f')]=function(_0x326ca3,_0x4c7173){if(_0x326ca3[_0xac6a('0x40')]['id']){delete _0x326ca3[_0xac6a('0x40')]['id'];}return db[_0xac6a('0x39')][_0xac6a('0x3e')]({'where':{'id':_0x326ca3[_0xac6a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c7173,null))[_0xac6a('0x21')](saveUpdates(_0x326ca3[_0xac6a('0x40')],null))['then'](respondWithResult(_0x4c7173,null))[_0xac6a('0x41')](handleError(_0x4c7173,null));};exports[_0xac6a('0x20')]=function(_0x3e4b6c,_0x275456){return db[_0xac6a('0x39')][_0xac6a('0x3e')]({'where':{'id':_0x3e4b6c[_0xac6a('0x42')]['id']}})[_0xac6a('0x21')](handleEntityNotFound(_0x275456,null))['then'](removeEntity(_0x275456,null))[_0xac6a('0x41')](handleError(_0x275456,null));};exports['describe']=function(_0x5e16b8,_0x47994d){return db['SACreditNoteNumber']['describe']()[_0xac6a('0x21')](respondWithResult(_0x47994d,null))[_0xac6a('0x41')](handleError(_0x47994d,null));}; \ No newline at end of file +var _0x64f7=['where','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','request-promise','bluebird','mustache','path','to-csv','ejs','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','SACreditNoteNumber','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x13eddd,_0x2bb439){var _0x3125b5=function(_0x5c2188){while(--_0x5c2188){_0x13eddd['push'](_0x13eddd['shift']());}};_0x3125b5(++_0x2bb439);}(_0x64f7,0x11b));var _0x764f=function(_0x428f3a,_0x5ddbab){_0x428f3a=_0x428f3a-0x0;var _0x3501be=_0x64f7[_0x428f3a];return _0x3501be;};'use strict';var pdf=require(_0x764f('0x0'));var emlformat=require(_0x764f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x764f('0x2'));var moment=require('moment');var BPromise=require(_0x764f('0x3'));var Mustache=require(_0x764f('0x4'));var util=require('util');var path=require(_0x764f('0x5'));var sox=require('sox');var csv=require(_0x764f('0x6'));var ejs=require(_0x764f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x764f('0x6'));var querystring=require(_0x764f('0x8'));var Papa=require(_0x764f('0x9'));var Redis=require(_0x764f('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x764f('0xb'));var hardwareService=require(_0x764f('0xc'));var logger=require('../../config/logger')(_0x764f('0xd'));var utils=require(_0x764f('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdb970c,_0x5f56ee){_0x5f56ee=_0x5f56ee||0xcc;return function(_0x2394e8){if(_0x2394e8){return _0xdb970c[_0x764f('0xf')](_0x5f56ee);}return _0xdb970c[_0x764f('0x10')](_0x5f56ee)['end']();};}function respondWithResult(_0x14f324,_0x2282f3){_0x2282f3=_0x2282f3||0xc8;return function(_0x5965da){if(_0x5965da){return _0x14f324[_0x764f('0x10')](_0x2282f3)[_0x764f('0x11')](_0x5965da);}};}function respondWithFilteredResult(_0x4c5b88,_0x136355){return function(_0x40dbd7){if(_0x40dbd7){var _0x347128=_0x40dbd7[_0x764f('0x12')],_0x2bd730=_0x136355['offset'],_0x3ebb85=_0x136355[_0x764f('0x13')]+_0x136355[_0x764f('0x14')],_0x1d80ab;if(_0x3ebb85>=_0x347128){_0x3ebb85=_0x347128;_0x1d80ab=0xc8;}else{_0x1d80ab=0xce;}_0x4c5b88[_0x764f('0x10')](_0x1d80ab);return _0x4c5b88[_0x764f('0x15')](_0x764f('0x16'),_0x2bd730+'-'+_0x3ebb85+'/'+_0x347128)['json'](_0x40dbd7);}return null;};}function patchUpdates(_0x1b436e){return function(_0x4f6600){try{jsonpatch[_0x764f('0x17')](_0x4f6600,_0x1b436e,!![]);}catch(_0xe4bef6){return BPromise[_0x764f('0x18')](_0xe4bef6);}return _0x4f6600[_0x764f('0x19')]();};}function saveUpdates(_0x5b7728,_0x445a18){return function(_0x3b4ebe){if(_0x3b4ebe){return _0x3b4ebe[_0x764f('0x1a')](_0x5b7728)[_0x764f('0x1b')](function(_0xa976ba){return _0xa976ba;});}return null;};}function removeEntity(_0x4b4d37,_0x429fed){return function(_0x437805){if(_0x437805){return _0x437805[_0x764f('0x1c')]()[_0x764f('0x1b')](function(){_0x4b4d37['status'](0xcc)[_0x764f('0x1d')]();});}};}function handleEntityNotFound(_0x1e0156,_0x4027e5){return function(_0x1305ee){if(!_0x1305ee){_0x1e0156[_0x764f('0xf')](0x194);}return _0x1305ee;};}function handleError(_0x30e7e6,_0x1489ff){_0x1489ff=_0x1489ff||0x1f4;return function(_0x325f58){logger[_0x764f('0x1e')](_0x325f58[_0x764f('0x1f')]);if(_0x325f58[_0x764f('0x20')]){delete _0x325f58['name'];}_0x30e7e6[_0x764f('0x10')](_0x1489ff)['send'](_0x325f58);};}exports[_0x764f('0x21')]=function(_0x26de92,_0x11c2b4){var _0x4cbc60={},_0x384ffc={},_0x32a93a={'count':0x0,'rows':[]};var _0x22a6c0=db[_0x764f('0x22')]['rawAttributes'];_0x384ffc['model']=_[_0x764f('0x23')](_0x22a6c0);_0x384ffc['query']=_['keys'](_0x26de92[_0x764f('0x24')]);_0x384ffc[_0x764f('0x25')]=_['intersection'](_0x384ffc[_0x764f('0x26')],_0x384ffc[_0x764f('0x24')]);_0x4cbc60['attributes']=_[_0x764f('0x27')](_0x384ffc[_0x764f('0x26')],qs[_0x764f('0x28')](_0x26de92['query'][_0x764f('0x28')]));_0x4cbc60[_0x764f('0x29')]=_0x4cbc60[_0x764f('0x29')]['length']?_0x4cbc60['attributes']:_0x384ffc[_0x764f('0x26')];if(!_0x26de92[_0x764f('0x24')][_0x764f('0x2a')](_0x764f('0x2b'))){_0x4cbc60[_0x764f('0x14')]=qs['limit'](_0x26de92[_0x764f('0x24')]['limit']);_0x4cbc60[_0x764f('0x13')]=qs[_0x764f('0x13')](_0x26de92[_0x764f('0x24')]['offset']);}_0x4cbc60['order']=qs[_0x764f('0x2c')](_0x26de92[_0x764f('0x24')][_0x764f('0x2c')]);_0x4cbc60['where']=qs['filters'](_[_0x764f('0x2d')](_0x26de92[_0x764f('0x24')],_0x384ffc[_0x764f('0x25')]));if(_0x26de92[_0x764f('0x24')][_0x764f('0x2e')]){_0x4cbc60[_0x764f('0x2f')]=_[_0x764f('0x30')](_0x4cbc60[_0x764f('0x2f')],{'$or':_[_0x764f('0x31')](_0x22a6c0,function(_0x5ed88a){if(_0x5ed88a[_0x764f('0x32')][_0x764f('0x33')]!==_0x764f('0x34')){var _0x888ced={};_0x888ced[_0x5ed88a[_0x764f('0x35')]]={'$like':'%'+_0x26de92['query'][_0x764f('0x2e')]+'%'};return _0x888ced;}})});}_0x4cbc60=_['merge']({},_0x4cbc60,_0x26de92[_0x764f('0x36')]);var _0x2a1749={'where':_0x4cbc60['where']};return db[_0x764f('0x22')][_0x764f('0x12')](_0x2a1749)[_0x764f('0x1b')](function(_0x56e122){_0x32a93a[_0x764f('0x12')]=_0x56e122;if(_0x26de92[_0x764f('0x24')][_0x764f('0x37')]){_0x4cbc60['include']=[{'all':!![]}];}return db[_0x764f('0x22')][_0x764f('0x38')](_0x4cbc60);})[_0x764f('0x1b')](function(_0x42c119){_0x32a93a[_0x764f('0x39')]=_0x42c119;return _0x32a93a;})['then'](respondWithFilteredResult(_0x11c2b4,_0x4cbc60))[_0x764f('0x3a')](handleError(_0x11c2b4,null));};exports[_0x764f('0x3b')]=function(_0x307f10,_0x570c65){var _0x9fec0d={'raw':![],'where':{'id':_0x307f10['params']['id']}},_0x484602={};_0x484602[_0x764f('0x26')]=_[_0x764f('0x23')](db['SACreditNoteNumber'][_0x764f('0x3c')]);_0x484602['query']=_['keys'](_0x307f10[_0x764f('0x24')]);_0x484602[_0x764f('0x25')]=_['intersection'](_0x484602[_0x764f('0x26')],_0x484602['query']);_0x9fec0d['attributes']=_[_0x764f('0x27')](_0x484602[_0x764f('0x26')],qs[_0x764f('0x28')](_0x307f10[_0x764f('0x24')][_0x764f('0x28')]));_0x9fec0d[_0x764f('0x29')]=_0x9fec0d[_0x764f('0x29')]['length']?_0x9fec0d[_0x764f('0x29')]:_0x484602['model'];if(_0x307f10[_0x764f('0x24')][_0x764f('0x37')]){_0x9fec0d[_0x764f('0x3d')]=[{'all':!![]}];}_0x9fec0d=_[_0x764f('0x30')]({},_0x9fec0d,_0x307f10[_0x764f('0x36')]);return db[_0x764f('0x22')][_0x764f('0x3e')](_0x9fec0d)[_0x764f('0x1b')](handleEntityNotFound(_0x570c65,null))['then'](respondWithResult(_0x570c65,null))['catch'](handleError(_0x570c65,null));};exports[_0x764f('0x3f')]=function(_0x187cdd,_0x52aeb5){return db['SACreditNoteNumber'][_0x764f('0x3f')](_0x187cdd[_0x764f('0x40')],{})[_0x764f('0x1b')](respondWithResult(_0x52aeb5,0xc9))['catch'](handleError(_0x52aeb5,null));};exports['update']=function(_0xf613bc,_0x9efc3d){if(_0xf613bc[_0x764f('0x40')]['id']){delete _0xf613bc[_0x764f('0x40')]['id'];}return db['SACreditNoteNumber'][_0x764f('0x3e')]({'where':{'id':_0xf613bc['params']['id']}})[_0x764f('0x1b')](handleEntityNotFound(_0x9efc3d,null))[_0x764f('0x1b')](saveUpdates(_0xf613bc[_0x764f('0x40')],null))[_0x764f('0x1b')](respondWithResult(_0x9efc3d,null))[_0x764f('0x3a')](handleError(_0x9efc3d,null));};exports[_0x764f('0x1c')]=function(_0x2ee175,_0x321ee0){return db[_0x764f('0x22')][_0x764f('0x3e')]({'where':{'id':_0x2ee175['params']['id']}})[_0x764f('0x1b')](handleEntityNotFound(_0x321ee0,null))[_0x764f('0x1b')](removeEntity(_0x321ee0,null))['catch'](handleError(_0x321ee0,null));};exports[_0x764f('0x41')]=function(_0x53b918,_0x530348){return db[_0x764f('0x22')][_0x764f('0x41')]()[_0x764f('0x1b')](respondWithResult(_0x530348,null))[_0x764f('0x3a')](handleError(_0x530348,null));}; \ No newline at end of file diff --git a/server/api/saCreditNoteNumber/saCreditNoteNumber.model.js b/server/api/saCreditNoteNumber/saCreditNoteNumber.model.js index 8b78135..792def2 100644 --- a/server/api/saCreditNoteNumber/saCreditNoteNumber.model.js +++ b/server/api/saCreditNoteNumber/saCreditNoteNumber.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96dd=['exports','define','SACreditNoteNumber','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./saCreditNoteNumber.attributes'];(function(_0x2834c2,_0x597eaf){var _0x4bb874=function(_0x202057){while(--_0x202057){_0x2834c2['push'](_0x2834c2['shift']());}};_0x4bb874(++_0x597eaf);}(_0x96dd,0x73));var _0xd96d=function(_0x31f063,_0x2dccc2){_0x31f063=_0x31f063-0x0;var _0x51e3dd=_0x96dd[_0x31f063];return _0x51e3dd;};'use strict';var _=require(_0xd96d('0x0'));var util=require(_0xd96d('0x1'));var logger=require(_0xd96d('0x2'))(_0xd96d('0x3'));var moment=require(_0xd96d('0x4'));var BPromise=require(_0xd96d('0x5'));var rp=require(_0xd96d('0x6'));var fs=require('fs');var path=require(_0xd96d('0x7'));var rimraf=require(_0xd96d('0x8'));var config=require(_0xd96d('0x9'));var attributes=require(_0xd96d('0xa'));module[_0xd96d('0xb')]=function(_0x46d1a2,_0x3dff13){return _0x46d1a2[_0xd96d('0xc')](_0xd96d('0xd'),attributes,{'tableName':'sa_creditNote_numbers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cc2=['exports','SACreditNoteNumber','sa_creditNote_numbers','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./saCreditNoteNumber.attributes'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8cc2,0x1cb));var _0x28cc=function(_0xc18746,_0x7387a9){_0xc18746=_0xc18746-0x0;var _0x56c6cd=_0x8cc2[_0xc18746];return _0x56c6cd;};'use strict';var _=require('lodash');var util=require(_0x28cc('0x0'));var logger=require('../../config/logger')(_0x28cc('0x1'));var moment=require(_0x28cc('0x2'));var BPromise=require(_0x28cc('0x3'));var rp=require(_0x28cc('0x4'));var fs=require('fs');var path=require(_0x28cc('0x5'));var rimraf=require(_0x28cc('0x6'));var config=require(_0x28cc('0x7'));var attributes=require(_0x28cc('0x8'));module[_0x28cc('0x9')]=function(_0x16916d,_0x14a531){return _0x16916d['define'](_0x28cc('0xa'),attributes,{'tableName':_0x28cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saCreditNoteNumber/saCreditNoteNumber.rpc.js b/server/api/saCreditNoteNumber/saCreditNoteNumber.rpc.js index 527eb45..c2f5c91 100644 --- a/server/api/saCreditNoteNumber/saCreditNoteNumber.rpc.js +++ b/server/api/saCreditNoteNumber/saCreditNoteNumber.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb991=['jayson/promise','client','http','info','SACreditNoteNumber,\x20%s,\x20%s','request\x20sent','SACreditNoteNumber,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x171e4d,_0x4f2493){var _0x2d2bf4=function(_0x3a74cc){while(--_0x3a74cc){_0x171e4d['push'](_0x171e4d['shift']());}};_0x2d2bf4(++_0x4f2493);}(_0xb991,0x69));var _0x1b99=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xb991[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x1b99('0x0'));var util=require(_0x1b99('0x1'));var moment=require(_0x1b99('0x2'));var BPromise=require(_0x1b99('0x3'));var rs=require(_0x1b99('0x4'));var fs=require('fs');var Redis=require(_0x1b99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b99('0x6'));var logger=require(_0x1b99('0x7'))(_0x1b99('0x8'));var config=require(_0x1b99('0x9'));var jayson=require(_0x1b99('0xa'));var client=jayson[_0x1b99('0xb')][_0x1b99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2693a5,_0x5cd2d3,_0x592297){return new BPromise(function(_0x3bb0ee,_0x1694e7){return client['request'](_0x2693a5,_0x592297)['then'](function(_0x415ae1){logger[_0x1b99('0xd')](_0x1b99('0xe'),_0x5cd2d3,_0x1b99('0xf'));logger['debug'](_0x1b99('0x10'),_0x5cd2d3,_0x1b99('0xf'),JSON[_0x1b99('0x11')](_0x415ae1));if(_0x415ae1[_0x1b99('0x12')]){if(_0x415ae1['error'][_0x1b99('0x13')]===0x1f4){logger['error'](_0x1b99('0xe'),_0x5cd2d3,_0x415ae1[_0x1b99('0x12')][_0x1b99('0x14')]);return _0x1694e7(_0x415ae1[_0x1b99('0x12')][_0x1b99('0x14')]);}logger[_0x1b99('0x12')](_0x1b99('0xe'),_0x5cd2d3,_0x415ae1['error'][_0x1b99('0x14')]);return _0x3bb0ee(_0x415ae1['error'][_0x1b99('0x14')]);}else{logger[_0x1b99('0xd')](_0x1b99('0xe'),_0x5cd2d3,'request\x20sent');_0x3bb0ee(_0x415ae1[_0x1b99('0x15')]['message']);}})[_0x1b99('0x16')](function(_0x2f4e6a){logger[_0x1b99('0x12')](_0x1b99('0xe'),_0x5cd2d3,_0x2f4e6a);_0x1694e7(_0x2f4e6a);});});} \ No newline at end of file +var _0x4285=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SACreditNoteNumber,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x460d27,_0x522d83){var _0xa11cb2=function(_0x1f9636){while(--_0x1f9636){_0x460d27['push'](_0x460d27['shift']());}};_0xa11cb2(++_0x522d83);}(_0x4285,0xf3));var _0x5428=function(_0x18dd3d,_0x58196f){_0x18dd3d=_0x18dd3d-0x0;var _0x42ab14=_0x4285[_0x18dd3d];return _0x42ab14;};'use strict';var _=require(_0x5428('0x0'));var util=require(_0x5428('0x1'));var moment=require(_0x5428('0x2'));var BPromise=require(_0x5428('0x3'));var rs=require(_0x5428('0x4'));var fs=require('fs');var Redis=require(_0x5428('0x5'));var db=require(_0x5428('0x6'))['db'];var utils=require(_0x5428('0x7'));var logger=require('../../config/logger')(_0x5428('0x8'));var config=require(_0x5428('0x9'));var jayson=require(_0x5428('0xa'));var client=jayson[_0x5428('0xb')][_0x5428('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x130a47,_0x30821c,_0x1dbf06){return new BPromise(function(_0x4ab545,_0x25b6e2){return client[_0x5428('0xd')](_0x130a47,_0x1dbf06)[_0x5428('0xe')](function(_0x4b59c1){logger[_0x5428('0xf')](_0x5428('0x10'),_0x30821c,_0x5428('0x11'));logger[_0x5428('0x12')]('SACreditNoteNumber,\x20%s,\x20%s,\x20%s',_0x30821c,_0x5428('0x11'),JSON['stringify'](_0x4b59c1));if(_0x4b59c1['error']){if(_0x4b59c1[_0x5428('0x13')][_0x5428('0x14')]===0x1f4){logger[_0x5428('0x13')](_0x5428('0x10'),_0x30821c,_0x4b59c1[_0x5428('0x13')][_0x5428('0x15')]);return _0x25b6e2(_0x4b59c1['error'][_0x5428('0x15')]);}logger['error'](_0x5428('0x10'),_0x30821c,_0x4b59c1[_0x5428('0x13')][_0x5428('0x15')]);return _0x4ab545(_0x4b59c1['error'][_0x5428('0x15')]);}else{logger[_0x5428('0xf')](_0x5428('0x10'),_0x30821c,_0x5428('0x11'));_0x4ab545(_0x4b59c1[_0x5428('0x16')][_0x5428('0x15')]);}})[_0x5428('0x17')](function(_0x2fb7b7){logger['error'](_0x5428('0x10'),_0x30821c,_0x2fb7b7);_0x25b6e2(_0x2fb7b7);});});} \ No newline at end of file diff --git a/server/api/saDossier/index.js b/server/api/saDossier/index.js index 928c73d..f05663a 100644 --- a/server/api/saDossier/index.js +++ b/server/api/saDossier/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4124=['index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saDossier.controller','get','isAuthenticated'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0x4124,0x1ed));var _0x4412=function(_0x46fb45,_0x504b8a){_0x46fb45=_0x46fb45-0x0;var _0x4b16a2=_0x4124[_0x46fb45];return _0x4b16a2;};'use strict';var multer=require(_0x4412('0x0'));var util=require('util');var path=require(_0x4412('0x1'));var timeout=require(_0x4412('0x2'));var express=require(_0x4412('0x3'));var router=express[_0x4412('0x4')]();var auth=require(_0x4412('0x5'));var interaction=require(_0x4412('0x6'));var config=require(_0x4412('0x7'));var controller=require(_0x4412('0x8'));router[_0x4412('0x9')]('/',auth[_0x4412('0xa')](),controller[_0x4412('0xb')]);router[_0x4412('0x9')](_0x4412('0xc'),auth['isAuthenticated'](),controller[_0x4412('0xd')]);router[_0x4412('0x9')](_0x4412('0xe'),auth['isAuthenticated'](),controller[_0x4412('0xf')]);router[_0x4412('0x10')]('/',auth[_0x4412('0xa')](),controller[_0x4412('0x11')]);router['put'](_0x4412('0xe'),auth[_0x4412('0xa')](),controller['update']);router[_0x4412('0x12')]('/:id',auth[_0x4412('0xa')](),controller[_0x4412('0x13')]);module[_0x4412('0x14')]=router; \ No newline at end of file +var _0x7291=['./saDossier.controller','index','get','/describe','isAuthenticated','describe','post','put','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13a599,_0x9c2347){var _0x2ab78f=function(_0x17e5a8){while(--_0x17e5a8){_0x13a599['push'](_0x13a599['shift']());}};_0x2ab78f(++_0x9c2347);}(_0x7291,0xad));var _0x1729=function(_0x217928,_0x296b23){_0x217928=_0x217928-0x0;var _0x434f52=_0x7291[_0x217928];return _0x434f52;};'use strict';var multer=require(_0x1729('0x0'));var util=require(_0x1729('0x1'));var path=require('path');var timeout=require(_0x1729('0x2'));var express=require('express');var router=express[_0x1729('0x3')]();var auth=require(_0x1729('0x4'));var interaction=require(_0x1729('0x5'));var config=require(_0x1729('0x6'));var controller=require(_0x1729('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1729('0x8')]);router[_0x1729('0x9')](_0x1729('0xa'),auth[_0x1729('0xb')](),controller[_0x1729('0xc')]);router[_0x1729('0x9')]('/:id',auth[_0x1729('0xb')](),controller['show']);router[_0x1729('0xd')]('/',auth[_0x1729('0xb')](),controller['create']);router[_0x1729('0xe')](_0x1729('0xf'),auth[_0x1729('0xb')](),controller['update']);router['delete'](_0x1729('0xf'),auth['isAuthenticated'](),controller[_0x1729('0x10')]);module[_0x1729('0x11')]=router; \ No newline at end of file diff --git a/server/api/saDossier/saDossier.attributes.js b/server/api/saDossier/saDossier.attributes.js index a55610d..40d4f55 100644 --- a/server/api/saDossier/saDossier.attributes.js +++ b/server/api/saDossier/saDossier.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd2e=['STRING','TEXT','exports'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0xcd2e,0xfb));var _0xecd2=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xcd2e[_0x4aa4e6];return _0x322588;};'use strict';var Sequelize=require('sequelize');module[_0xecd2('0x0')]={'name':{'type':Sequelize[_0xecd2('0x1')],'allowNull':![]},'agentFullname':{'type':Sequelize[_0xecd2('0x1')]},'note':{'type':Sequelize[_0xecd2('0x2')]}}; \ No newline at end of file +var _0x78f4=['exports','STRING','TEXT'];(function(_0x543951,_0xc3790c){var _0x414c3d=function(_0x51b408){while(--_0x51b408){_0x543951['push'](_0x543951['shift']());}};_0x414c3d(++_0xc3790c);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x478f('0x0')]={'name':{'type':Sequelize[_0x478f('0x1')],'allowNull':![]},'agentFullname':{'type':Sequelize[_0x478f('0x1')]},'note':{'type':Sequelize[_0x478f('0x2')]}}; \ No newline at end of file diff --git a/server/api/saDossier/saDossier.controller.js b/server/api/saDossier/saDossier.controller.js index 014db7a..6ce3871 100644 --- a/server/api/saDossier/saDossier.controller.js +++ b/server/api/saDossier/saDossier.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04b8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','SADossier','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','options','count','includeAll','include','findAll','rows','params','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0x04b8,0x159));var _0x804b=function(_0x17c624,_0x2c6f74){_0x17c624=_0x17c624-0x0;var _0x24c927=_0x04b8[_0x17c624];return _0x24c927;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x804b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x804b('0x1'));var jsonpatch=require(_0x804b('0x2'));var rp=require('request-promise');var moment=require(_0x804b('0x3'));var BPromise=require(_0x804b('0x4'));var Mustache=require('mustache');var util=require(_0x804b('0x5'));var path=require(_0x804b('0x6'));var sox=require(_0x804b('0x7'));var csv=require('to-csv');var ejs=require(_0x804b('0x8'));var fs=require('fs');var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x804b('0x12'))(_0x804b('0x13'));var utils=require(_0x804b('0x14'));var config=require(_0x804b('0x15'));var db=require(_0x804b('0x16'))['db'];function respondWithStatusCode(_0x12e7b4,_0x50ba27){_0x50ba27=_0x50ba27||0xcc;return function(_0x15a4eb){if(_0x15a4eb){return _0x12e7b4['sendStatus'](_0x50ba27);}return _0x12e7b4[_0x804b('0x17')](_0x50ba27)[_0x804b('0x18')]();};}function respondWithResult(_0xfa2ddd,_0x1f915d){_0x1f915d=_0x1f915d||0xc8;return function(_0x581fbf){if(_0x581fbf){return _0xfa2ddd[_0x804b('0x17')](_0x1f915d)[_0x804b('0x19')](_0x581fbf);}};}function respondWithFilteredResult(_0x274bb8,_0x236a85){return function(_0x4ff1be){if(_0x4ff1be){var _0x2fd593=_0x4ff1be['count'],_0x8ccbe0=_0x236a85[_0x804b('0x1a')],_0x5e1cfe=_0x236a85[_0x804b('0x1a')]+_0x236a85[_0x804b('0x1b')],_0x3c5986;if(_0x5e1cfe>=_0x2fd593){_0x5e1cfe=_0x2fd593;_0x3c5986=0xc8;}else{_0x3c5986=0xce;}_0x274bb8[_0x804b('0x17')](_0x3c5986);return _0x274bb8[_0x804b('0x1c')]('Content-Range',_0x8ccbe0+'-'+_0x5e1cfe+'/'+_0x2fd593)[_0x804b('0x19')](_0x4ff1be);}return null;};}function patchUpdates(_0x50b4fe){return function(_0x247380){try{jsonpatch[_0x804b('0x1d')](_0x247380,_0x50b4fe,!![]);}catch(_0x42cceb){return BPromise[_0x804b('0x1e')](_0x42cceb);}return _0x247380['save']();};}function saveUpdates(_0x2892b8,_0x1e29a7){return function(_0x427166){if(_0x427166){return _0x427166[_0x804b('0x1f')](_0x2892b8)[_0x804b('0x20')](function(_0x267878){return _0x267878;});}return null;};}function removeEntity(_0x3241a0,_0x162204){return function(_0xaa9521){if(_0xaa9521){return _0xaa9521[_0x804b('0x21')]()[_0x804b('0x20')](function(){_0x3241a0['status'](0xcc)[_0x804b('0x18')]();});}};}function handleEntityNotFound(_0x5a77e0,_0x5585f8){return function(_0x44a921){if(!_0x44a921){_0x5a77e0[_0x804b('0x22')](0x194);}return _0x44a921;};}function handleError(_0x115b8f,_0x2309a2){_0x2309a2=_0x2309a2||0x1f4;return function(_0x9080c2){logger['error'](_0x9080c2[_0x804b('0x23')]);if(_0x9080c2[_0x804b('0x24')]){delete _0x9080c2['name'];}_0x115b8f[_0x804b('0x17')](_0x2309a2)[_0x804b('0x25')](_0x9080c2);};}exports[_0x804b('0x26')]=function(_0x27d5ec,_0x2d88da){var _0x5cc1dd={},_0x456580={},_0x22f822={'count':0x0,'rows':[]};var _0x1f08f4=db[_0x804b('0x27')][_0x804b('0x28')];_0x456580['model']=_[_0x804b('0x29')](_0x1f08f4);_0x456580[_0x804b('0x2a')]=_[_0x804b('0x29')](_0x27d5ec['query']);_0x456580[_0x804b('0x2b')]=_[_0x804b('0x2c')](_0x456580[_0x804b('0x2d')],_0x456580['query']);_0x5cc1dd[_0x804b('0x2e')]=_[_0x804b('0x2c')](_0x456580['model'],qs[_0x804b('0x2f')](_0x27d5ec[_0x804b('0x2a')][_0x804b('0x2f')]));_0x5cc1dd[_0x804b('0x2e')]=_0x5cc1dd[_0x804b('0x2e')][_0x804b('0x30')]?_0x5cc1dd['attributes']:_0x456580[_0x804b('0x2d')];if(!_0x27d5ec[_0x804b('0x2a')][_0x804b('0x31')](_0x804b('0x32'))){_0x5cc1dd[_0x804b('0x1b')]=qs[_0x804b('0x1b')](_0x27d5ec[_0x804b('0x2a')][_0x804b('0x1b')]);_0x5cc1dd[_0x804b('0x1a')]=qs[_0x804b('0x1a')](_0x27d5ec[_0x804b('0x2a')][_0x804b('0x1a')]);}_0x5cc1dd[_0x804b('0x33')]=qs[_0x804b('0x34')](_0x27d5ec[_0x804b('0x2a')][_0x804b('0x34')]);_0x5cc1dd[_0x804b('0x35')]=qs[_0x804b('0x2b')](_[_0x804b('0x36')](_0x27d5ec[_0x804b('0x2a')],_0x456580[_0x804b('0x2b')]));if(_0x27d5ec[_0x804b('0x2a')][_0x804b('0x37')]){_0x5cc1dd[_0x804b('0x35')]=_[_0x804b('0x38')](_0x5cc1dd['where'],{'$or':_['map'](_0x1f08f4,function(_0x584452){if(_0x584452[_0x804b('0x39')][_0x804b('0x3a')]!==_0x804b('0x3b')){var _0x5b28d7={};_0x5b28d7[_0x584452['field']]={'$like':'%'+_0x27d5ec['query'][_0x804b('0x37')]+'%'};return _0x5b28d7;}})});}_0x5cc1dd=_[_0x804b('0x38')]({},_0x5cc1dd,_0x27d5ec[_0x804b('0x3c')]);var _0x2f6c2e={'where':_0x5cc1dd[_0x804b('0x35')]};return db[_0x804b('0x27')][_0x804b('0x3d')](_0x2f6c2e)[_0x804b('0x20')](function(_0x27ba88){_0x22f822[_0x804b('0x3d')]=_0x27ba88;if(_0x27d5ec[_0x804b('0x2a')][_0x804b('0x3e')]){_0x5cc1dd[_0x804b('0x3f')]=[{'all':!![]}];}return db['SADossier'][_0x804b('0x40')](_0x5cc1dd);})[_0x804b('0x20')](function(_0xb877d6){_0x22f822[_0x804b('0x41')]=_0xb877d6;return _0x22f822;})[_0x804b('0x20')](respondWithFilteredResult(_0x2d88da,_0x5cc1dd))['catch'](handleError(_0x2d88da,null));};exports['show']=function(_0x203890,_0x2afafd){var _0xbaa118={'raw':![],'where':{'id':_0x203890[_0x804b('0x42')]['id']}},_0x5206f9={};_0x5206f9['model']=_[_0x804b('0x29')](db[_0x804b('0x27')][_0x804b('0x28')]);_0x5206f9[_0x804b('0x2a')]=_[_0x804b('0x29')](_0x203890[_0x804b('0x2a')]);_0x5206f9[_0x804b('0x2b')]=_['intersection'](_0x5206f9[_0x804b('0x2d')],_0x5206f9[_0x804b('0x2a')]);_0xbaa118[_0x804b('0x2e')]=_[_0x804b('0x2c')](_0x5206f9['model'],qs[_0x804b('0x2f')](_0x203890[_0x804b('0x2a')][_0x804b('0x2f')]));_0xbaa118[_0x804b('0x2e')]=_0xbaa118[_0x804b('0x2e')][_0x804b('0x30')]?_0xbaa118[_0x804b('0x2e')]:_0x5206f9[_0x804b('0x2d')];if(_0x203890['query'][_0x804b('0x3e')]){_0xbaa118['include']=[{'all':!![]}];}_0xbaa118=_['merge']({},_0xbaa118,_0x203890['options']);return db[_0x804b('0x27')]['find'](_0xbaa118)[_0x804b('0x20')](handleEntityNotFound(_0x2afafd,null))[_0x804b('0x20')](respondWithResult(_0x2afafd,null))[_0x804b('0x43')](handleError(_0x2afafd,null));};exports[_0x804b('0x44')]=function(_0x562711,_0x471f00){return db[_0x804b('0x27')][_0x804b('0x44')](_0x562711['body'],{})[_0x804b('0x20')](respondWithResult(_0x471f00,0xc9))[_0x804b('0x43')](handleError(_0x471f00,null));};exports[_0x804b('0x1f')]=function(_0x4cada2,_0x37627c){if(_0x4cada2[_0x804b('0x45')]['id']){delete _0x4cada2[_0x804b('0x45')]['id'];}return db[_0x804b('0x27')][_0x804b('0x46')]({'where':{'id':_0x4cada2[_0x804b('0x42')]['id']}})[_0x804b('0x20')](handleEntityNotFound(_0x37627c,null))[_0x804b('0x20')](saveUpdates(_0x4cada2[_0x804b('0x45')],null))[_0x804b('0x20')](respondWithResult(_0x37627c,null))[_0x804b('0x43')](handleError(_0x37627c,null));};exports[_0x804b('0x21')]=function(_0x20862f,_0x2c1796){return db['SADossier']['find']({'where':{'id':_0x20862f[_0x804b('0x42')]['id']}})[_0x804b('0x20')](handleEntityNotFound(_0x2c1796,null))[_0x804b('0x20')](removeEntity(_0x2c1796,null))[_0x804b('0x43')](handleError(_0x2c1796,null));};exports[_0x804b('0x47')]=function(_0x4ceea0,_0x458283){return db[_0x804b('0x27')][_0x804b('0x47')]()[_0x804b('0x20')](respondWithResult(_0x458283,null))[_0x804b('0x43')](handleError(_0x458283,null));}; \ No newline at end of file +var _0x3f8c=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','SADossier','rawAttributes','keys','query','filters','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','count','includeAll','include','rows','show','params','intersection','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4c7d82,_0x4a0fcf){var _0x3913c=function(_0x46f5aa){while(--_0x46f5aa){_0x4c7d82['push'](_0x4c7d82['shift']());}};_0x3913c(++_0x4a0fcf);}(_0x3f8c,0x104));var _0xc3f8=function(_0x3fbf5b,_0x1adc7a){_0x3fbf5b=_0x3fbf5b-0x0;var _0x11ceb8=_0x3f8c[_0x3fbf5b];return _0x11ceb8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc3f8('0x0'));var zipdir=require(_0xc3f8('0x1'));var jsonpatch=require(_0xc3f8('0x2'));var rp=require(_0xc3f8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc3f8('0x4'));var csv=require(_0xc3f8('0x5'));var ejs=require(_0xc3f8('0x6'));var fs=require('fs');var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x5'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3f8('0x10'))(_0xc3f8('0x11'));var utils=require(_0xc3f8('0x12'));var config=require(_0xc3f8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x313714,_0x28e4c7){_0x28e4c7=_0x28e4c7||0xcc;return function(_0x256e3d){if(_0x256e3d){return _0x313714[_0xc3f8('0x14')](_0x28e4c7);}return _0x313714['status'](_0x28e4c7)[_0xc3f8('0x15')]();};}function respondWithResult(_0x1cb7a9,_0x3d7b67){_0x3d7b67=_0x3d7b67||0xc8;return function(_0x44632a){if(_0x44632a){return _0x1cb7a9[_0xc3f8('0x16')](_0x3d7b67)[_0xc3f8('0x17')](_0x44632a);}};}function respondWithFilteredResult(_0x29e2b6,_0x4731cd){return function(_0x12b141){if(_0x12b141){var _0x2fd8e8=_0x12b141['count'],_0x3cb28a=_0x4731cd[_0xc3f8('0x18')],_0x2a9f64=_0x4731cd['offset']+_0x4731cd['limit'],_0x29d031;if(_0x2a9f64>=_0x2fd8e8){_0x2a9f64=_0x2fd8e8;_0x29d031=0xc8;}else{_0x29d031=0xce;}_0x29e2b6[_0xc3f8('0x16')](_0x29d031);return _0x29e2b6[_0xc3f8('0x19')](_0xc3f8('0x1a'),_0x3cb28a+'-'+_0x2a9f64+'/'+_0x2fd8e8)[_0xc3f8('0x17')](_0x12b141);}return null;};}function patchUpdates(_0x47a185){return function(_0x3e75a4){try{jsonpatch[_0xc3f8('0x1b')](_0x3e75a4,_0x47a185,!![]);}catch(_0x5df6f9){return BPromise[_0xc3f8('0x1c')](_0x5df6f9);}return _0x3e75a4['save']();};}function saveUpdates(_0x3912c7,_0x42ce65){return function(_0x3b2e98){if(_0x3b2e98){return _0x3b2e98['update'](_0x3912c7)['then'](function(_0x113cd2){return _0x113cd2;});}return null;};}function removeEntity(_0x2a7096,_0x1436d7){return function(_0x25a4c7){if(_0x25a4c7){return _0x25a4c7[_0xc3f8('0x1d')]()[_0xc3f8('0x1e')](function(){_0x2a7096[_0xc3f8('0x16')](0xcc)[_0xc3f8('0x15')]();});}};}function handleEntityNotFound(_0x49aeea,_0x571f92){return function(_0x4b83f0){if(!_0x4b83f0){_0x49aeea[_0xc3f8('0x14')](0x194);}return _0x4b83f0;};}function handleError(_0x5e1d14,_0x11335){_0x11335=_0x11335||0x1f4;return function(_0x3f196d){logger['error'](_0x3f196d[_0xc3f8('0x1f')]);if(_0x3f196d[_0xc3f8('0x20')]){delete _0x3f196d[_0xc3f8('0x20')];}_0x5e1d14[_0xc3f8('0x16')](_0x11335)[_0xc3f8('0x21')](_0x3f196d);};}exports[_0xc3f8('0x22')]=function(_0xf1d460,_0x7f14ad){var _0x21b002={},_0xbea3b8={},_0x22c8e6={'count':0x0,'rows':[]};var _0x394629=db[_0xc3f8('0x23')][_0xc3f8('0x24')];_0xbea3b8['model']=_[_0xc3f8('0x25')](_0x394629);_0xbea3b8[_0xc3f8('0x26')]=_[_0xc3f8('0x25')](_0xf1d460['query']);_0xbea3b8[_0xc3f8('0x27')]=_['intersection'](_0xbea3b8[_0xc3f8('0x28')],_0xbea3b8[_0xc3f8('0x26')]);_0x21b002['attributes']=_['intersection'](_0xbea3b8[_0xc3f8('0x28')],qs[_0xc3f8('0x29')](_0xf1d460[_0xc3f8('0x26')][_0xc3f8('0x29')]));_0x21b002[_0xc3f8('0x2a')]=_0x21b002[_0xc3f8('0x2a')][_0xc3f8('0x2b')]?_0x21b002[_0xc3f8('0x2a')]:_0xbea3b8[_0xc3f8('0x28')];if(!_0xf1d460[_0xc3f8('0x26')]['hasOwnProperty'](_0xc3f8('0x2c'))){_0x21b002[_0xc3f8('0x2d')]=qs[_0xc3f8('0x2d')](_0xf1d460[_0xc3f8('0x26')][_0xc3f8('0x2d')]);_0x21b002['offset']=qs['offset'](_0xf1d460[_0xc3f8('0x26')][_0xc3f8('0x18')]);}_0x21b002[_0xc3f8('0x2e')]=qs[_0xc3f8('0x2f')](_0xf1d460[_0xc3f8('0x26')]['sort']);_0x21b002[_0xc3f8('0x30')]=qs[_0xc3f8('0x27')](_[_0xc3f8('0x31')](_0xf1d460['query'],_0xbea3b8[_0xc3f8('0x27')]));if(_0xf1d460[_0xc3f8('0x26')][_0xc3f8('0x32')]){_0x21b002['where']=_[_0xc3f8('0x33')](_0x21b002[_0xc3f8('0x30')],{'$or':_['map'](_0x394629,function(_0x2bf1c0){if(_0x2bf1c0[_0xc3f8('0x34')][_0xc3f8('0x35')]!==_0xc3f8('0x36')){var _0x1f4c55={};_0x1f4c55[_0x2bf1c0[_0xc3f8('0x37')]]={'$like':'%'+_0xf1d460['query'][_0xc3f8('0x32')]+'%'};return _0x1f4c55;}})});}_0x21b002=_[_0xc3f8('0x33')]({},_0x21b002,_0xf1d460[_0xc3f8('0x38')]);var _0x2f589d={'where':_0x21b002[_0xc3f8('0x30')]};return db['SADossier'][_0xc3f8('0x39')](_0x2f589d)[_0xc3f8('0x1e')](function(_0xaa4c98){_0x22c8e6['count']=_0xaa4c98;if(_0xf1d460[_0xc3f8('0x26')][_0xc3f8('0x3a')]){_0x21b002[_0xc3f8('0x3b')]=[{'all':!![]}];}return db[_0xc3f8('0x23')]['findAll'](_0x21b002);})[_0xc3f8('0x1e')](function(_0x45d416){_0x22c8e6[_0xc3f8('0x3c')]=_0x45d416;return _0x22c8e6;})[_0xc3f8('0x1e')](respondWithFilteredResult(_0x7f14ad,_0x21b002))['catch'](handleError(_0x7f14ad,null));};exports[_0xc3f8('0x3d')]=function(_0x5db44d,_0x5d144b){var _0x2923a8={'raw':![],'where':{'id':_0x5db44d[_0xc3f8('0x3e')]['id']}},_0x1f3aef={};_0x1f3aef[_0xc3f8('0x28')]=_['keys'](db['SADossier'][_0xc3f8('0x24')]);_0x1f3aef[_0xc3f8('0x26')]=_[_0xc3f8('0x25')](_0x5db44d[_0xc3f8('0x26')]);_0x1f3aef[_0xc3f8('0x27')]=_[_0xc3f8('0x3f')](_0x1f3aef[_0xc3f8('0x28')],_0x1f3aef[_0xc3f8('0x26')]);_0x2923a8[_0xc3f8('0x2a')]=_[_0xc3f8('0x3f')](_0x1f3aef[_0xc3f8('0x28')],qs['fields'](_0x5db44d[_0xc3f8('0x26')][_0xc3f8('0x29')]));_0x2923a8['attributes']=_0x2923a8[_0xc3f8('0x2a')][_0xc3f8('0x2b')]?_0x2923a8['attributes']:_0x1f3aef[_0xc3f8('0x28')];if(_0x5db44d[_0xc3f8('0x26')][_0xc3f8('0x3a')]){_0x2923a8[_0xc3f8('0x3b')]=[{'all':!![]}];}_0x2923a8=_[_0xc3f8('0x33')]({},_0x2923a8,_0x5db44d[_0xc3f8('0x38')]);return db[_0xc3f8('0x23')][_0xc3f8('0x40')](_0x2923a8)[_0xc3f8('0x1e')](handleEntityNotFound(_0x5d144b,null))[_0xc3f8('0x1e')](respondWithResult(_0x5d144b,null))[_0xc3f8('0x41')](handleError(_0x5d144b,null));};exports['create']=function(_0x35ce2f,_0x42b071){return db['SADossier'][_0xc3f8('0x42')](_0x35ce2f[_0xc3f8('0x43')],{})[_0xc3f8('0x1e')](respondWithResult(_0x42b071,0xc9))[_0xc3f8('0x41')](handleError(_0x42b071,null));};exports['update']=function(_0x4d80e4,_0x35ef68){if(_0x4d80e4[_0xc3f8('0x43')]['id']){delete _0x4d80e4[_0xc3f8('0x43')]['id'];}return db['SADossier'][_0xc3f8('0x40')]({'where':{'id':_0x4d80e4[_0xc3f8('0x3e')]['id']}})[_0xc3f8('0x1e')](handleEntityNotFound(_0x35ef68,null))[_0xc3f8('0x1e')](saveUpdates(_0x4d80e4[_0xc3f8('0x43')],null))['then'](respondWithResult(_0x35ef68,null))[_0xc3f8('0x41')](handleError(_0x35ef68,null));};exports[_0xc3f8('0x1d')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x23')][_0xc3f8('0x40')]({'where':{'id':_0x5961ab[_0xc3f8('0x3e')]['id']}})[_0xc3f8('0x1e')](handleEntityNotFound(_0x1becae,null))[_0xc3f8('0x1e')](removeEntity(_0x1becae,null))[_0xc3f8('0x41')](handleError(_0x1becae,null));};exports['describe']=function(_0x38d132,_0x257be1){return db['SADossier'][_0xc3f8('0x44')]()[_0xc3f8('0x1e')](respondWithResult(_0x257be1,null))[_0xc3f8('0x41')](handleError(_0x257be1,null));}; \ No newline at end of file diff --git a/server/api/saDossier/saDossier.model.js b/server/api/saDossier/saDossier.model.js index 44434fe..ec80131 100644 --- a/server/api/saDossier/saDossier.model.js +++ b/server/api/saDossier/saDossier.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','sa_dossiers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./saDossier.attributes','exports'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0x008c,0x188));var _0xc008=function(_0x3ca75e,_0x3c827e){_0x3ca75e=_0x3ca75e-0x0;var _0x3ca1d1=_0x008c[_0x3ca75e];return _0x3ca1d1;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('SADossier',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','SADossier','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./saDossier.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'sa_dossiers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saDossier/saDossier.rpc.js b/server/api/saDossier/saDossier.rpc.js index 285466d..31ad155 100644 --- a/server/api/saDossier/saDossier.rpc.js +++ b/server/api/saDossier/saDossier.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bd8=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SADossier,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','randomstring'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x4bd8,0x1c9));var _0x84bd=function(_0x4c632c,_0x46748a){_0x4c632c=_0x4c632c-0x0;var _0x4802e6=_0x4bd8[_0x4c632c];return _0x4802e6;};'use strict';var _=require(_0x84bd('0x0'));var util=require(_0x84bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84bd('0x2'));var fs=require('fs');var Redis=require(_0x84bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x84bd('0x4'))(_0x84bd('0x5'));var config=require(_0x84bd('0x6'));var jayson=require(_0x84bd('0x7'));var client=jayson[_0x84bd('0x8')][_0x84bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553d7e,_0x4b602a,_0x591627){return new BPromise(function(_0x273589,_0x2f284d){return client[_0x84bd('0xa')](_0x553d7e,_0x591627)[_0x84bd('0xb')](function(_0x5a6785){logger[_0x84bd('0xc')](_0x84bd('0xd'),_0x4b602a,_0x84bd('0xe'));logger[_0x84bd('0xf')]('SADossier,\x20%s,\x20%s,\x20%s',_0x4b602a,'request\x20sent',JSON[_0x84bd('0x10')](_0x5a6785));if(_0x5a6785['error']){if(_0x5a6785[_0x84bd('0x11')]['code']===0x1f4){logger[_0x84bd('0x11')](_0x84bd('0xd'),_0x4b602a,_0x5a6785[_0x84bd('0x11')][_0x84bd('0x12')]);return _0x2f284d(_0x5a6785[_0x84bd('0x11')][_0x84bd('0x12')]);}logger[_0x84bd('0x11')](_0x84bd('0xd'),_0x4b602a,_0x5a6785[_0x84bd('0x11')][_0x84bd('0x12')]);return _0x273589(_0x5a6785[_0x84bd('0x11')]['message']);}else{logger['info'](_0x84bd('0xd'),_0x4b602a,_0x84bd('0xe'));_0x273589(_0x5a6785[_0x84bd('0x13')][_0x84bd('0x12')]);}})['catch'](function(_0x5910fe){logger[_0x84bd('0x11')](_0x84bd('0xd'),_0x4b602a,_0x5910fe);_0x2f284d(_0x5910fe);});});} \ No newline at end of file +var _0xaa2c=['request','then','info','SADossier,\x20%s,\x20%s','request\x20sent','debug','SADossier,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0xaa2c,0x79));var _0xcaa2=function(_0x55bfbd,_0x16f64f){_0x55bfbd=_0x55bfbd-0x0;var _0x190dec=_0xaa2c[_0x55bfbd];return _0x190dec;};'use strict';var _=require(_0xcaa2('0x0'));var util=require(_0xcaa2('0x1'));var moment=require('moment');var BPromise=require(_0xcaa2('0x2'));var rs=require(_0xcaa2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcaa2('0x4'));var logger=require(_0xcaa2('0x5'))(_0xcaa2('0x6'));var config=require(_0xcaa2('0x7'));var jayson=require(_0xcaa2('0x8'));var client=jayson[_0xcaa2('0x9')][_0xcaa2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae7fe,_0x3e2679,_0x298193){return new BPromise(function(_0x3f2365,_0x83b11c){return client[_0xcaa2('0xb')](_0x4ae7fe,_0x298193)[_0xcaa2('0xc')](function(_0xc5b849){logger[_0xcaa2('0xd')](_0xcaa2('0xe'),_0x3e2679,_0xcaa2('0xf'));logger[_0xcaa2('0x10')](_0xcaa2('0x11'),_0x3e2679,_0xcaa2('0xf'),JSON['stringify'](_0xc5b849));if(_0xc5b849[_0xcaa2('0x12')]){if(_0xc5b849[_0xcaa2('0x12')][_0xcaa2('0x13')]===0x1f4){logger[_0xcaa2('0x12')](_0xcaa2('0xe'),_0x3e2679,_0xc5b849[_0xcaa2('0x12')]['message']);return _0x83b11c(_0xc5b849[_0xcaa2('0x12')][_0xcaa2('0x14')]);}logger[_0xcaa2('0x12')]('SADossier,\x20%s,\x20%s',_0x3e2679,_0xc5b849[_0xcaa2('0x12')]['message']);return _0x3f2365(_0xc5b849['error'][_0xcaa2('0x14')]);}else{logger['info'](_0xcaa2('0xe'),_0x3e2679,_0xcaa2('0xf'));_0x3f2365(_0xc5b849['result'][_0xcaa2('0x14')]);}})[_0xcaa2('0x15')](function(_0x4c0bf3){logger[_0xcaa2('0x12')](_0xcaa2('0xe'),_0x3e2679,_0x4c0bf3);_0x83b11c(_0x4c0bf3);});});} \ No newline at end of file diff --git a/server/api/saInvoice/index.js b/server/api/saInvoice/index.js index b234d4c..7fcbb16 100644 --- a/server/api/saInvoice/index.js +++ b/server/api/saInvoice/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f5a=['/:id','show','getInvoicePDF','create','post','/:id/automaticInvoiceCreditnote','automaticInvoiceCreditnote','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./saInvoice.controller','isAuthenticated','index','/describe','describe','/getInvoicesNumberByYear','getInvoicesNumberByYear','get'];(function(_0x4aaef6,_0x314c64){var _0x283cb8=function(_0x135861){while(--_0x135861){_0x4aaef6['push'](_0x4aaef6['shift']());}};_0x283cb8(++_0x314c64);}(_0x2f5a,0x1e6));var _0xa2f5=function(_0x4b1fb4,_0x36f2e0){_0x4b1fb4=_0x4b1fb4-0x0;var _0x1617cc=_0x2f5a[_0x4b1fb4];return _0x1617cc;};'use strict';var multer=require('multer');var util=require(_0xa2f5('0x0'));var path=require('path');var timeout=require(_0xa2f5('0x1'));var express=require(_0xa2f5('0x2'));var router=express[_0xa2f5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa2f5('0x4'));var config=require(_0xa2f5('0x5'));var controller=require(_0xa2f5('0x6'));router['get']('/',auth[_0xa2f5('0x7')](),controller[_0xa2f5('0x8')]);router['get'](_0xa2f5('0x9'),auth[_0xa2f5('0x7')](),controller[_0xa2f5('0xa')]);router['get'](_0xa2f5('0xb'),auth[_0xa2f5('0x7')](),controller[_0xa2f5('0xc')]);router[_0xa2f5('0xd')](_0xa2f5('0xe'),auth['isAuthenticated'](),controller[_0xa2f5('0xf')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa2f5('0x10')]);router['post']('/',auth[_0xa2f5('0x7')](),controller[_0xa2f5('0x11')]);router[_0xa2f5('0x12')](_0xa2f5('0x13'),auth[_0xa2f5('0x7')](),controller[_0xa2f5('0x14')]);router[_0xa2f5('0x15')](_0xa2f5('0xe'),auth['isAuthenticated'](),controller[_0xa2f5('0x16')]);router[_0xa2f5('0x17')](_0xa2f5('0xe'),auth['isAuthenticated'](),controller[_0xa2f5('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4119=['show','/:id/download','post','create','/:id/automaticInvoiceCreditnote','automaticInvoiceCreditnote','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/getInvoicesNumberByYear','/:id'];(function(_0x3e15af,_0x16d1f5){var _0x312cb6=function(_0x583ad5){while(--_0x583ad5){_0x3e15af['push'](_0x3e15af['shift']());}};_0x312cb6(++_0x16d1f5);}(_0x4119,0xfa));var _0x9411=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x4119[_0x411add];return _0x238242;};'use strict';var multer=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var path=require(_0x9411('0x2'));var timeout=require(_0x9411('0x3'));var express=require(_0x9411('0x4'));var router=express[_0x9411('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9411('0x6'));var config=require(_0x9411('0x7'));var controller=require('./saInvoice.controller');router[_0x9411('0x8')]('/',auth[_0x9411('0x9')](),controller[_0x9411('0xa')]);router[_0x9411('0x8')](_0x9411('0xb'),auth[_0x9411('0x9')](),controller['describe']);router[_0x9411('0x8')](_0x9411('0xc'),auth[_0x9411('0x9')](),controller['getInvoicesNumberByYear']);router[_0x9411('0x8')](_0x9411('0xd'),auth[_0x9411('0x9')](),controller[_0x9411('0xe')]);router[_0x9411('0x8')](_0x9411('0xf'),auth[_0x9411('0x9')](),controller['getInvoicePDF']);router[_0x9411('0x10')]('/',auth['isAuthenticated'](),controller[_0x9411('0x11')]);router[_0x9411('0x10')](_0x9411('0x12'),auth['isAuthenticated'](),controller[_0x9411('0x13')]);router[_0x9411('0x14')](_0x9411('0xd'),auth[_0x9411('0x9')](),controller[_0x9411('0x15')]);router['delete'](_0x9411('0xd'),auth['isAuthenticated'](),controller[_0x9411('0x16')]);module[_0x9411('0x17')]=router; \ No newline at end of file diff --git a/server/api/saInvoice/saInvoice.attributes.js b/server/api/saInvoice/saInvoice.attributes.js index 31d2d75..18896c5 100644 --- a/server/api/saInvoice/saInvoice.attributes.js +++ b/server/api/saInvoice/saInvoice.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46cd=['DATE','exports','STRING','TEXT','INTEGER','BOOLEAN'];(function(_0x4cd14a,_0x3c08b4){var _0x59ac6a=function(_0x5d95ec){while(--_0x5d95ec){_0x4cd14a['push'](_0x4cd14a['shift']());}};_0x59ac6a(++_0x3c08b4);}(_0x46cd,0x181));var _0xd46c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x46cd[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require('sequelize');module[_0xd46c('0x0')]={'name':{'type':Sequelize[_0xd46c('0x1')]},'note':{'type':Sequelize[_0xd46c('0x2')]},'agentFullname':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd46c('0x2')]},'companyName':{'type':Sequelize[_0xd46c('0x1')],'allowNull':![]},'companyId':{'type':Sequelize[_0xd46c('0x3')],'allowNull':![]},'paid':{'type':Sequelize[_0xd46c('0x3')],'defaultValue':0x0},'discount':{'type':Sequelize['DECIMAL'](0xd,0x4)},'receivingStreet':{'type':Sequelize[_0xd46c('0x1')]},'receivingPostalCode':{'type':Sequelize['STRING']},'receivingCity':{'type':Sequelize['STRING']},'receivingCountry':{'type':Sequelize['STRING']},'receivingISOCode':{'type':Sequelize[_0xd46c('0x1')](0x3)},'receivingFiscalCode':{'type':Sequelize[_0xd46c('0x1')](0x32)},'receivingPIVA':{'type':Sequelize[_0xd46c('0x1')](0x32)},'receivingSDICode':{'type':Sequelize['STRING'](0x15)},'receivingFiscalMessage':{'type':Sequelize[_0xd46c('0x1')](0x3e8)},'receivingExpiryDay':{'type':Sequelize['INTEGER']},'receivingEurope':{'type':Sequelize[_0xd46c('0x4')]},'receivingSocCap':{'type':Sequelize['STRING'](0xff)},'issuerName':{'type':Sequelize[_0xd46c('0x1')]},'issuerStreet':{'type':Sequelize[_0xd46c('0x1')]},'issuerPostalCode':{'type':Sequelize[_0xd46c('0x1')]},'issuerCity':{'type':Sequelize[_0xd46c('0x1')]},'issuerCountry':{'type':Sequelize[_0xd46c('0x1')]},'issuerISOCode':{'type':Sequelize['STRING'](0x3)},'issuerFiscalCode':{'type':Sequelize[_0xd46c('0x1')](0x32)},'issuerPIVA':{'type':Sequelize[_0xd46c('0x1')](0x32)},'issuerSDICode':{'type':Sequelize[_0xd46c('0x1')](0x15)},'issuerFiscalMessage':{'type':Sequelize[_0xd46c('0x1')](0x3e8)},'issuerExpiryDay':{'type':Sequelize[_0xd46c('0x3')]},'issuerEurope':{'type':Sequelize[_0xd46c('0x4')]},'issuerSocCap':{'type':Sequelize[_0xd46c('0x1')](0xff)},'issuerBankAccount':{'type':Sequelize[_0xd46c('0x1')](0xff)},'issuerBankName':{'type':Sequelize[_0xd46c('0x1')](0xff)},'issuerBankStreet':{'type':Sequelize[_0xd46c('0x1')]},'issuerBankPostalCode':{'type':Sequelize[_0xd46c('0x1')]},'issuerBankCity':{'type':Sequelize[_0xd46c('0x1')]},'issuerBankCountry':{'type':Sequelize[_0xd46c('0x1')]},'issuerBankBICSWIFT':{'type':Sequelize['STRING']},'issuerBankIBAN':{'type':Sequelize['STRING']},'issuerPhone':{'type':Sequelize['STRING']},'issuerFax':{'type':Sequelize[_0xd46c('0x1')]},'issuerEmail':{'type':Sequelize['STRING']},'issuerWeb':{'type':Sequelize[_0xd46c('0x1')]},'issuerABI':{'type':Sequelize[_0xd46c('0x1')]},'issuerCAB':{'type':Sequelize[_0xd46c('0x1')]},'issuerPayPal':{'type':Sequelize['STRING']},'startDate':{'type':Sequelize[_0xd46c('0x5')]},'endDate':{'type':Sequelize[_0xd46c('0x5')]},'number':{'type':Sequelize[_0xd46c('0x3')]},'beginningCompetence':{'type':Sequelize['DATE']},'endCompetence':{'type':Sequelize[_0xd46c('0x5')]},'clientCode':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65b3=['STRING','TEXT','INTEGER','DECIMAL','BOOLEAN','DATE','sequelize','exports'];(function(_0x10f50d,_0x1b200c){var _0x24128c=function(_0x18819a){while(--_0x18819a){_0x10f50d['push'](_0x10f50d['shift']());}};_0x24128c(++_0x1b200c);}(_0x65b3,0xc6));var _0x365b=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x65b3[_0x256d6a];return _0x460058;};'use strict';var Sequelize=require(_0x365b('0x0'));module[_0x365b('0x1')]={'name':{'type':Sequelize[_0x365b('0x2')]},'note':{'type':Sequelize[_0x365b('0x3')]},'agentFullname':{'type':Sequelize[_0x365b('0x2')]},'status':{'type':Sequelize[_0x365b('0x3')]},'companyName':{'type':Sequelize['STRING'],'allowNull':![]},'companyId':{'type':Sequelize[_0x365b('0x4')],'allowNull':![]},'paid':{'type':Sequelize[_0x365b('0x4')],'defaultValue':0x0},'discount':{'type':Sequelize[_0x365b('0x5')](0xd,0x4)},'receivingStreet':{'type':Sequelize['STRING']},'receivingPostalCode':{'type':Sequelize[_0x365b('0x2')]},'receivingCity':{'type':Sequelize[_0x365b('0x2')]},'receivingCountry':{'type':Sequelize[_0x365b('0x2')]},'receivingISOCode':{'type':Sequelize['STRING'](0x3)},'receivingFiscalCode':{'type':Sequelize[_0x365b('0x2')](0x32)},'receivingPIVA':{'type':Sequelize[_0x365b('0x2')](0x32)},'receivingSDICode':{'type':Sequelize[_0x365b('0x2')](0x15)},'receivingFiscalMessage':{'type':Sequelize[_0x365b('0x2')](0x3e8)},'receivingExpiryDay':{'type':Sequelize[_0x365b('0x4')]},'receivingEurope':{'type':Sequelize['BOOLEAN']},'receivingSocCap':{'type':Sequelize[_0x365b('0x2')](0xff)},'issuerName':{'type':Sequelize[_0x365b('0x2')]},'issuerStreet':{'type':Sequelize[_0x365b('0x2')]},'issuerPostalCode':{'type':Sequelize[_0x365b('0x2')]},'issuerCity':{'type':Sequelize[_0x365b('0x2')]},'issuerCountry':{'type':Sequelize['STRING']},'issuerISOCode':{'type':Sequelize[_0x365b('0x2')](0x3)},'issuerFiscalCode':{'type':Sequelize[_0x365b('0x2')](0x32)},'issuerPIVA':{'type':Sequelize[_0x365b('0x2')](0x32)},'issuerSDICode':{'type':Sequelize[_0x365b('0x2')](0x15)},'issuerFiscalMessage':{'type':Sequelize['STRING'](0x3e8)},'issuerExpiryDay':{'type':Sequelize['INTEGER']},'issuerEurope':{'type':Sequelize[_0x365b('0x6')]},'issuerSocCap':{'type':Sequelize[_0x365b('0x2')](0xff)},'issuerBankAccount':{'type':Sequelize[_0x365b('0x2')](0xff)},'issuerBankName':{'type':Sequelize['STRING'](0xff)},'issuerBankStreet':{'type':Sequelize[_0x365b('0x2')]},'issuerBankPostalCode':{'type':Sequelize['STRING']},'issuerBankCity':{'type':Sequelize[_0x365b('0x2')]},'issuerBankCountry':{'type':Sequelize[_0x365b('0x2')]},'issuerBankBICSWIFT':{'type':Sequelize[_0x365b('0x2')]},'issuerBankIBAN':{'type':Sequelize[_0x365b('0x2')]},'issuerPhone':{'type':Sequelize[_0x365b('0x2')]},'issuerFax':{'type':Sequelize[_0x365b('0x2')]},'issuerEmail':{'type':Sequelize[_0x365b('0x2')]},'issuerWeb':{'type':Sequelize[_0x365b('0x2')]},'issuerABI':{'type':Sequelize[_0x365b('0x2')]},'issuerCAB':{'type':Sequelize[_0x365b('0x2')]},'issuerPayPal':{'type':Sequelize[_0x365b('0x2')]},'startDate':{'type':Sequelize[_0x365b('0x7')]},'endDate':{'type':Sequelize[_0x365b('0x7')]},'number':{'type':Sequelize[_0x365b('0x4')]},'beginningCompetence':{'type':Sequelize[_0x365b('0x7')]},'endCompetence':{'type':Sequelize[_0x365b('0x7')]},'clientCode':{'type':Sequelize[_0x365b('0x2')]}}; \ No newline at end of file diff --git a/server/api/saInvoice/saInvoice.controller.js b/server/api/saInvoice/saInvoice.controller.js index 6435f47..09a2ba2 100644 --- a/server/api/saInvoice/saInvoice.controller.js +++ b/server/api/saInvoice/saInvoice.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd914=['subtotal','length','netPrice','discount','tax','quantity','productName','','productDescription','%d','','toFixed','\x20€','
%s
','isNil','receivingFiscalMessage','indexOf','split\x20payment','','\x20','total','','nettopay','','\x20','','\x20%s\x20','replace','fromCharCode','','','sendpayment',':','accountholder',':\x20','','bankname','issuerBankName','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerBankCountry','abi','cab','issuerCAB','swif','issuerBankBICSWIFT','issuerBankIBAN','issuerPayPal','','thank1','','paid','','log','create','toFile','TCL:\x20exports.getInvoicePDF\x20->\x20saveTo,\x20fileName','download','err','getInvoicesNumberByYear','years','select','from','field','count(id)','invoiceNumber','invoiceYear','MONTH(startDate)','invoiceMonth','YEAR(startDate)\x20IN\x20(','YEAR(startDate)','group','sequelize','toString','QueryTypes','addInvoiceCreditnoteDetail->>','pricelistName','priceListId','agentFullname','subscriptionId','subscriptionName','subscriptionMonthly','unitName','SACreditNoteDetail','automaticInvoiceCreditnote','SACreditNote','push','all','WARNING','No\x20product\x20to\x20assign\x20credit\x20note.\x20Credit\x20note\x20not\x20created!!\x20','TCL:\x20exports.automaticInvoiceCreditnote\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','end','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','map','type','key','VIRTUAL','filter','SAInvoice','includeAll','rows','catch','show','params','include','options','find','transaction','Sequelize','Transaction','ISOLATION_LEVELS','body','destroy','describe','getInvoicePDF','unix','join','root','server','files','tmp','images','logos','logo-invoice.png','paid-invoice.png','format','Invoice_%s-%s.pdf','findAll','details','portrait','1cm','10mm','{{page}}/{{pages}}','footer','contents','default','invoice','issuerWeb','','','','Fax','Email','VAT\x20number','P.IVA','Tax\x20code','C.F.','I.S.\x20code','Codice\x20S.D.I.','Invoice','Fattura','Proforma','Credit\x20note','Nota\x20di\x20credito','Due\x20date','Scadenza','Item','Ore/Qta','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Discount','Sconto','Subtotal','Imponibile','Tax','Tasse','Total','Totale','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Account\x20Holder','Conto\x20intestato\x20a','Nome\x20banca','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','Italy','','\x20','','\x20%s
','issuerName','\x20%s','issuerCity','-\x20%s\x20
','phone',':\x20%s
','issuerPhone','email','issuerEmail','piva','issuerFiscalCode','sdi','issuerSDICode','','
','','companyName','%s
','receivingStreet','receivingPostalCode','receivingCity','receivingCountry','','receivingSDICode','','','\x20N.%d','updatedAt','DD/MM/YYYY','%s\x20','add','saExpiryDay','days','',':\x20%s','
','','','item','','description','hrsqty','unitprice'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd914,0x17f));var _0x4d91=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xd914[_0x32c012];return _0x48562e;};'use strict';var pdf=require(_0x4d91('0x0'));var emlformat=require(_0x4d91('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d91('0x2'));var jsonpatch=require(_0x4d91('0x3'));var rp=require(_0x4d91('0x4'));var moment=require(_0x4d91('0x5'));var BPromise=require(_0x4d91('0x6'));var Mustache=require(_0x4d91('0x7'));var util=require('util');var path=require(_0x4d91('0x8'));var sox=require('sox');var csv=require(_0x4d91('0x9'));var ejs=require(_0x4d91('0xa'));var fs=require('fs');var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x9'));var querystring=require('querystring');var Papa=require(_0x4d91('0x10'));var Redis=require(_0x4d91('0x11'));var authService=require(_0x4d91('0x12'));var qs=require(_0x4d91('0x13'));var hardwareService=require(_0x4d91('0x14'));var logger=require(_0x4d91('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4d91('0x16'));var db=require(_0x4d91('0x17'))['db'];function respondWithStatusCode(_0x9d9542,_0x370e78){_0x370e78=_0x370e78||0xcc;return function(_0x1c15b7){if(_0x1c15b7){return _0x9d9542[_0x4d91('0x18')](_0x370e78);}return _0x9d9542['status'](_0x370e78)['end']();};}function respondWithResult(_0x38e89e,_0x1e7600){_0x1e7600=_0x1e7600||0xc8;return function(_0xb6590d){if(_0xb6590d){return _0x38e89e[_0x4d91('0x19')](_0x1e7600)[_0x4d91('0x1a')](_0xb6590d);}};}function respondWithFilteredResult(_0x25bafc,_0x36f606){return function(_0x4f5aef){if(_0x4f5aef){var _0x3a8ec9=_0x4f5aef[_0x4d91('0x1b')],_0x42631a=_0x36f606['offset'],_0x1e2ef7=_0x36f606[_0x4d91('0x1c')]+_0x36f606[_0x4d91('0x1d')],_0xb92681;if(_0x1e2ef7>=_0x3a8ec9){_0x1e2ef7=_0x3a8ec9;_0xb92681=0xc8;}else{_0xb92681=0xce;}_0x25bafc[_0x4d91('0x19')](_0xb92681);return _0x25bafc[_0x4d91('0x1e')]('Content-Range',_0x42631a+'-'+_0x1e2ef7+'/'+_0x3a8ec9)[_0x4d91('0x1a')](_0x4f5aef);}return null;};}function patchUpdates(_0x3b579b){return function(_0x13254c){try{jsonpatch['apply'](_0x13254c,_0x3b579b,!![]);}catch(_0x13ef2c){return BPromise[_0x4d91('0x1f')](_0x13ef2c);}return _0x13254c[_0x4d91('0x20')]();};}function saveUpdates(_0xd59fe,_0x10b767){return function(_0x40cde4){if(_0x40cde4){return _0x40cde4[_0x4d91('0x21')](_0xd59fe)[_0x4d91('0x22')](function(_0x30d911){return _0x30d911;});}return null;};}function removeEntity(_0x226d85,_0x554878){return function(_0x4493da){if(_0x4493da){return _0x4493da['destroy']()['then'](function(){_0x226d85[_0x4d91('0x19')](0xcc)[_0x4d91('0x23')]();});}};}function handleEntityNotFound(_0x341d18,_0x9cb864){return function(_0x7d8cbf){if(!_0x7d8cbf){_0x341d18[_0x4d91('0x18')](0x194);}return _0x7d8cbf;};}function handleError(_0x100cd4,_0x123606){_0x123606=_0x123606||0x1f4;return function(_0x55356b){logger['error'](_0x55356b[_0x4d91('0x24')]);if(_0x55356b[_0x4d91('0x25')]){delete _0x55356b[_0x4d91('0x25')];}_0x100cd4[_0x4d91('0x19')](_0x123606)[_0x4d91('0x26')](_0x55356b);};}exports[_0x4d91('0x27')]=function(_0x14bdb4,_0x560966){var _0x3dc353={},_0xda9802={},_0x12ac74={'count':0x0,'rows':[]};var _0x5dded7=db['SAInvoice'][_0x4d91('0x28')];_0xda9802[_0x4d91('0x29')]=_['keys'](_0x5dded7);_0xda9802['query']=_[_0x4d91('0x2a')](_0x14bdb4[_0x4d91('0x2b')]);_0xda9802[_0x4d91('0x2c')]=_[_0x4d91('0x2d')](_0xda9802['model'],_0xda9802[_0x4d91('0x2b')]);_0x3dc353[_0x4d91('0x2e')]=_[_0x4d91('0x2d')](_0xda9802[_0x4d91('0x29')],qs[_0x4d91('0x2f')](_0x14bdb4[_0x4d91('0x2b')][_0x4d91('0x2f')]));_0x3dc353['attributes']=_0x3dc353[_0x4d91('0x2e')]['length']?_0x3dc353['attributes']:_0xda9802[_0x4d91('0x29')];if(!_0x14bdb4[_0x4d91('0x2b')]['hasOwnProperty'](_0x4d91('0x30'))){_0x3dc353[_0x4d91('0x1d')]=qs[_0x4d91('0x1d')](_0x14bdb4[_0x4d91('0x2b')][_0x4d91('0x1d')]);_0x3dc353['offset']=qs[_0x4d91('0x1c')](_0x14bdb4[_0x4d91('0x2b')][_0x4d91('0x1c')]);}_0x3dc353[_0x4d91('0x31')]=qs[_0x4d91('0x32')](_0x14bdb4[_0x4d91('0x2b')]['sort']);_0x3dc353[_0x4d91('0x33')]=qs[_0x4d91('0x2c')](_['pick'](_0x14bdb4[_0x4d91('0x2b')],_0xda9802[_0x4d91('0x2c')]));if(_0x14bdb4[_0x4d91('0x2b')]['filter']){_0x3dc353[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x3dc353[_0x4d91('0x33')],{'$or':_[_0x4d91('0x35')](_0x5dded7,function(_0x4945c5){if(_0x4945c5[_0x4d91('0x36')][_0x4d91('0x37')]!==_0x4d91('0x38')){var _0x2ffa6f={};_0x2ffa6f[_0x4945c5['field']]={'$like':'%'+_0x14bdb4['query'][_0x4d91('0x39')]+'%'};return _0x2ffa6f;}})});}_0x3dc353=_[_0x4d91('0x34')]({},_0x3dc353,_0x14bdb4['options']);var _0x25ee27={'where':_0x3dc353[_0x4d91('0x33')]};return db[_0x4d91('0x3a')][_0x4d91('0x1b')](_0x25ee27)['then'](function(_0x2eb7c7){_0x12ac74[_0x4d91('0x1b')]=_0x2eb7c7;if(_0x14bdb4['query'][_0x4d91('0x3b')]){_0x3dc353['include']=[{'all':!![]}];}return db[_0x4d91('0x3a')]['findAll'](_0x3dc353);})[_0x4d91('0x22')](function(_0x49742b){_0x12ac74[_0x4d91('0x3c')]=_0x49742b;return _0x12ac74;})[_0x4d91('0x22')](respondWithFilteredResult(_0x560966,_0x3dc353))[_0x4d91('0x3d')](handleError(_0x560966,null));};exports[_0x4d91('0x3e')]=function(_0x4f6576,_0x5bcc9b){var _0x25e0f5={'raw':![],'where':{'id':_0x4f6576[_0x4d91('0x3f')]['id']}},_0x55c8d0={};_0x55c8d0[_0x4d91('0x29')]=_['keys'](db[_0x4d91('0x3a')][_0x4d91('0x28')]);_0x55c8d0[_0x4d91('0x2b')]=_[_0x4d91('0x2a')](_0x4f6576[_0x4d91('0x2b')]);_0x55c8d0[_0x4d91('0x2c')]=_[_0x4d91('0x2d')](_0x55c8d0['model'],_0x55c8d0[_0x4d91('0x2b')]);_0x25e0f5['attributes']=_[_0x4d91('0x2d')](_0x55c8d0[_0x4d91('0x29')],qs[_0x4d91('0x2f')](_0x4f6576[_0x4d91('0x2b')][_0x4d91('0x2f')]));_0x25e0f5[_0x4d91('0x2e')]=_0x25e0f5['attributes']['length']?_0x25e0f5[_0x4d91('0x2e')]:_0x55c8d0[_0x4d91('0x29')];if(_0x4f6576['query'][_0x4d91('0x3b')]){_0x25e0f5[_0x4d91('0x40')]=[{'all':!![]}];}_0x25e0f5=_[_0x4d91('0x34')]({},_0x25e0f5,_0x4f6576[_0x4d91('0x41')]);return db[_0x4d91('0x3a')][_0x4d91('0x42')](_0x25e0f5)[_0x4d91('0x22')](handleEntityNotFound(_0x5bcc9b,null))[_0x4d91('0x22')](respondWithResult(_0x5bcc9b,null))[_0x4d91('0x3d')](handleError(_0x5bcc9b,null));};exports['create']=function(_0x5099e8,_0x1736dc){return db['sequelize'][_0x4d91('0x43')]({'isolationLevel':db[_0x4d91('0x44')][_0x4d91('0x45')][_0x4d91('0x46')]['SERIALIZABLE']},function(_0x18e8e8){return db['SAInvoice']['create'](_0x5099e8[_0x4d91('0x47')],{'transaction':_0x18e8e8});})[_0x4d91('0x22')](respondWithResult(_0x1736dc,0xc9))[_0x4d91('0x3d')](handleError(_0x1736dc,null));};exports[_0x4d91('0x21')]=function(_0x1f91ec,_0x238742){if(_0x1f91ec['body']['id']){delete _0x1f91ec[_0x4d91('0x47')]['id'];}return db[_0x4d91('0x3a')][_0x4d91('0x42')]({'where':{'id':_0x1f91ec[_0x4d91('0x3f')]['id']}})[_0x4d91('0x22')](handleEntityNotFound(_0x238742,null))[_0x4d91('0x22')](saveUpdates(_0x1f91ec[_0x4d91('0x47')],null))[_0x4d91('0x22')](respondWithResult(_0x238742,null))[_0x4d91('0x3d')](handleError(_0x238742,null));};exports[_0x4d91('0x48')]=function(_0x16f776,_0x5a67fa){return db[_0x4d91('0x3a')]['find']({'where':{'id':_0x16f776[_0x4d91('0x3f')]['id']}})[_0x4d91('0x22')](handleEntityNotFound(_0x5a67fa,null))[_0x4d91('0x22')](removeEntity(_0x5a67fa,null))[_0x4d91('0x3d')](handleError(_0x5a67fa,null));};exports[_0x4d91('0x49')]=function(_0x3edc43,_0x3028b1){return db[_0x4d91('0x3a')]['describe']()[_0x4d91('0x22')](respondWithResult(_0x3028b1,null))[_0x4d91('0x3d')](handleError(_0x3028b1,null));};exports[_0x4d91('0x4a')]=function(_0x2bba43,_0x26ecd7){var _0x19e57e=moment()[_0x4d91('0x4b')]()['toString']();var _0x392cc3=path[_0x4d91('0x4c')](config[_0x4d91('0x4d')],_0x4d91('0x4e'),_0x4d91('0x4f'),_0x4d91('0x50'));var _0x2875f4=path[_0x4d91('0x4c')](config[_0x4d91('0x4d')],_0x4d91('0x4e'),_0x4d91('0x4f'),_0x4d91('0x51'),_0x4d91('0x52'),_0x4d91('0x53'));var _0x3e9154=path[_0x4d91('0x4c')](config[_0x4d91('0x4d')],'server','files','images',_0x4d91('0x52'),_0x4d91('0x54'));var _0x373857=path['join'](_0x392cc3,_0x19e57e);var _0x44957a=util[_0x4d91('0x55')](_0x4d91('0x56'),_0x2bba43['params']['id'],_0x19e57e);var _0x4fbe92=path['join'](_0x373857,_0x44957a);var _0x75aa6d=![];var _0x26bfde={};return db[_0x4d91('0x3a')][_0x4d91('0x42')]({'where':{'id':_0x2bba43[_0x4d91('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26ecd7,null))[_0x4d91('0x22')](function(_0x20c0f2){if(_0x20c0f2){_0x26bfde['invoice']=_0x20c0f2;return db['SAInvoiceDetail'][_0x4d91('0x57')]({'where':{'InvoiceId':_0x20c0f2['id']},'raw':!![]})['then'](function(_0x3fda50){_0x26bfde[_0x4d91('0x58')]=_0x3fda50;_0x75aa6d=!![];var _0x20a29c='';var _0x4e6ae2={'format':'A4','orientation':_0x4d91('0x59'),'border':_0x4d91('0x5a'),'footer':{'height':_0x4d91('0x5b'),'contents':{'default':_0x4d91('0x5c')}}};_0x4e6ae2[_0x4d91('0x5d')][_0x4d91('0x5e')][_0x4d91('0x5f')]=_0x4e6ae2['footer']['contents']['default']+''+_0x26bfde[_0x4d91('0x60')][_0x4d91('0x61')]+_0x4d91('0x62');fs['mkdirSync'](_0x373857);_0x20a29c=_0x4d91('0x63');_0x20a29c+='\x20\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}';_0x20a29c+=_0x4d91('0x64');var _0x169863={'phone':{'en':'Phone','it':'Telefono'},'fax':{'en':_0x4d91('0x65'),'it':_0x4d91('0x65')},'email':{'en':_0x4d91('0x66'),'it':_0x4d91('0x66')},'piva':{'en':_0x4d91('0x67'),'it':_0x4d91('0x68')},'cf':{'en':_0x4d91('0x69'),'it':_0x4d91('0x6a')},'sdi':{'en':_0x4d91('0x6b'),'it':_0x4d91('0x6c')},'cs':{'en':'Soc.Cap.\x20fp','it':'Cap.Soc.\x20iv'},'invoice':{'en':_0x4d91('0x6d'),'it':_0x4d91('0x6e')},'proforma':{'en':_0x4d91('0x6f'),'it':_0x4d91('0x6f')},'creditnote':{'en':_0x4d91('0x70'),'it':_0x4d91('0x71')},'duedate':{'en':_0x4d91('0x72'),'it':_0x4d91('0x73')},'item':{'en':_0x4d91('0x74'),'it':'Articolo'},'description':{'en':'Description','it':'Descrizione'},'hrsqty':{'en':'Hrs/Qty','it':_0x4d91('0x75')},'unitprice':{'en':_0x4d91('0x76'),'it':_0x4d91('0x77')},'subtotal':{'en':_0x4d91('0x78'),'it':_0x4d91('0x79')},'discount':{'en':_0x4d91('0x7a'),'it':_0x4d91('0x7b')},'total':{'en':_0x4d91('0x7c'),'it':_0x4d91('0x7d')},'tax':{'en':_0x4d91('0x7e'),'it':_0x4d91('0x7f')},'nettopay':{'en':_0x4d91('0x80'),'it':_0x4d91('0x81')},'sendpayment':{'en':_0x4d91('0x82'),'it':_0x4d91('0x83')},'accountholder':{'en':_0x4d91('0x84'),'it':_0x4d91('0x85')},'bankname':{'en':'Bank\x20name','it':_0x4d91('0x86')},'bankaddress':{'en':_0x4d91('0x87'),'it':_0x4d91('0x88')},'abi':{'en':_0x4d91('0x89'),'it':_0x4d91('0x89')},'cab':{'en':'CAB','it':_0x4d91('0x8a')},'bic':{'en':_0x4d91('0x8b'),'it':'BIC'},'swif':{'en':_0x4d91('0x8c'),'it':_0x4d91('0x8c')},'iban':{'en':_0x4d91('0x8d'),'it':_0x4d91('0x8d')},'paypal':{'en':_0x4d91('0x8e'),'it':'Paga\x20con\x20Paypal'},'thank1':{'en':_0x4d91('0x8f'),'it':_0x4d91('0x90')},'thank2':{'en':',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','it':_0x4d91('0x91')}};var _0x1c966f='it';if(_0x26bfde[_0x4d91('0x60')]['receivingCountry']!==_0x4d91('0x92')){_0x1c966f='en';}_0x20a29c+=_0x4d91('0x93');_0x20a29c+=_0x4d91('0x94')+_0x2875f4+_0x4d91('0x95');_0x20a29c+=_0x4d91('0x96');_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0x97'),_0x26bfde['invoice'][_0x4d91('0x98')]);_0x20a29c+=util[_0x4d91('0x55')]('%s
',_0x26bfde[_0x4d91('0x60')]['issuerStreet']);_0x20a29c+=util['format']('%s',_0x26bfde[_0x4d91('0x60')]['issuerPostalCode']);_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0x99'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0x9a')]);_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0x9b'),_0x26bfde[_0x4d91('0x60')]['issuerCountry']);_0x20a29c+=util['format'](_0x169863[_0x4d91('0x9c')][_0x1c966f]+_0x4d91('0x9d'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0x9e')]);_0x20a29c+=util[_0x4d91('0x55')](_0x169863['fax'][_0x1c966f]+':\x20%s
',_0x26bfde[_0x4d91('0x60')]['issuerFax']);_0x20a29c+=util['format'](_0x169863[_0x4d91('0x9f')][_0x1c966f]+':\x20%s
',_0x26bfde['invoice'][_0x4d91('0xa0')]);_0x20a29c+=util[_0x4d91('0x55')](_0x169863[_0x4d91('0xa1')][_0x1c966f]+':\x20%s
',_0x26bfde['invoice']['issuerPIVA']);_0x20a29c+=util[_0x4d91('0x55')](_0x169863['cf'][_0x1c966f]+_0x4d91('0x9d'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0xa2')]);_0x20a29c+=util[_0x4d91('0x55')](_0x169863[_0x4d91('0xa3')][_0x1c966f]+_0x4d91('0x9d'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0xa4')]);_0x20a29c+=util['format'](_0x169863['cs'][_0x1c966f]+_0x4d91('0x9d'),_0x26bfde['invoice']['issuerSocCap']);_0x20a29c+=_0x4d91('0xa5');_0x20a29c+=_0x4d91('0xa6');_0x20a29c+=_0x4d91('0xa7');_0x20a29c+=util[_0x4d91('0x55')]('%s',_0x26bfde[_0x4d91('0x60')][_0x4d91('0xa8')]);_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xa9'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0xaa')]);_0x20a29c+=util[_0x4d91('0x55')]('%s\x20-\x20',_0x26bfde[_0x4d91('0x60')][_0x4d91('0xab')]);_0x20a29c+=util[_0x4d91('0x55')]('%s
',_0x26bfde[_0x4d91('0x60')][_0x4d91('0xac')]);_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xa9'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0xad')]);_0x20a29c+=util['format'](_0x4d91('0xae')+_0x169863['cf'][_0x1c966f]+':\x20%s
',_0x26bfde[_0x4d91('0x60')]['receivingFiscalCode']);_0x20a29c+=util[_0x4d91('0x55')](_0x169863[_0x4d91('0xa1')][_0x1c966f]+':\x20%s
',_0x26bfde['invoice']['receivingPIVA']);_0x20a29c+=util[_0x4d91('0x55')](_0x169863[_0x4d91('0xa3')][_0x1c966f]+_0x4d91('0x9d'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0xaf')]);_0x20a29c+='';_0x20a29c+='';_0x20a29c+=_0x4d91('0x96');_0x20a29c+=_0x4d91('0xb0');_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xb1')+_0x169863[_0x4d91('0x60')][_0x1c966f]+_0x4d91('0xb2'),_0x20c0f2['id']);_0x20a29c+=util[_0x4d91('0x55')]('%s,\x20',_0x26bfde[_0x4d91('0x60')][_0x4d91('0x9a')]);var _0x173900=moment(_0x26bfde[_0x4d91('0x60')][_0x4d91('0xb3')])[_0x4d91('0x55')](_0x4d91('0xb4'));_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xb5'),_0x173900);var _0x578ca8=moment(_0x26bfde[_0x4d91('0x60')][_0x4d91('0xb3')])[_0x4d91('0xb6')](_0x26bfde[_0x4d91('0x60')][_0x4d91('0xb7')],_0x4d91('0xb8'))[_0x4d91('0x55')]('DD/MM/YYYY');_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xb9')+_0x169863['duedate'][_0x1c966f]+_0x4d91('0xba'),_0x578ca8);_0x20a29c+=_0x4d91('0xbb');_0x20a29c+='
';_0x20a29c+=_0x4d91('0xb0');_0x20a29c+=_0x4d91('0xbc');_0x20a29c+=_0x4d91('0x96');_0x20a29c+=_0x4d91('0xbd')+_0x169863[_0x4d91('0xbe')][_0x1c966f]+_0x4d91('0xbf');_0x20a29c+=''+_0x169863[_0x4d91('0xc0')][_0x1c966f]+_0x4d91('0xbf');_0x20a29c+=_0x4d91('0xbd')+_0x169863[_0x4d91('0xc1')][_0x1c966f]+_0x4d91('0xbf');_0x20a29c+=''+_0x169863[_0x4d91('0xc2')][_0x1c966f]+_0x4d91('0xbf');_0x20a29c+=_0x4d91('0xbd')+_0x169863[_0x4d91('0xc3')][_0x1c966f]+_0x4d91('0xbf');_0x20a29c+=_0x4d91('0xbb');var _0x18f844=0x0;var _0x3e93d0=0x0;for(var _0x463f3e=0x0;_0x463f3e<_0x26bfde[_0x4d91('0x58')][_0x4d91('0xc4')];_0x463f3e++){var _0x451e14=0x0;var _0x37fe62=0x0;var _0xd65ad9=0x0;var _0x1ffc02=0x0;_0x451e14=_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc5')]-_0x26bfde[_0x4d91('0x58')][_0x463f3e]['netPrice']/0x64*_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc6')];_0x37fe62=_0x451e14/0x64*_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc7')];_0xd65ad9=_0x451e14*_0x26bfde['details'][_0x463f3e]['quantity'];_0x1ffc02=_0x37fe62*_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc8')];_0x20a29c+=_0x4d91('0x96');_0x20a29c+=util[_0x4d91('0x55')]('',_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc9')]);_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xca'),_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xcb')]);_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xcc'),_0x26bfde[_0x4d91('0x58')][_0x463f3e]['quantity']);_0x20a29c+=_0x4d91('0xcd')+_0x451e14[_0x4d91('0xce')](0x2)+_0x4d91('0xcf');_0x20a29c+=_0x4d91('0xcd')+_0xd65ad9[_0x4d91('0xce')](0x2)+_0x4d91('0xcf');_0x20a29c+=_0x4d91('0xbb');_0x18f844+=_0xd65ad9;_0x3e93d0+=_0x1ffc02;}_0x20a29c+=_0x4d91('0xd0');if(!_[_0x4d91('0xd1')](_0x26bfde[_0x4d91('0x60')][_0x4d91('0xc6')])){var _0x17474b=0x0;var _0x531fe9=0x0;var _0x42dc92=_0x26bfde[_0x4d91('0x60')][_0x4d91('0xc6')]*0x64/_0x18f844;for(var _0x463f3e=0x0;_0x463f3e<_0x26bfde[_0x4d91('0x58')][_0x4d91('0xc4')];_0x463f3e++){var _0x1197e5=0x0;var _0x43b35f=0x0;var _0xfedc8e=0x0;_0x451e14=_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc5')]-_0x26bfde[_0x4d91('0x58')][_0x463f3e]['netPrice']/0x64*_0x26bfde['details'][_0x463f3e][_0x4d91('0xc6')];_0x1197e5=_0x451e14/0x64*_0x42dc92;_0x43b35f=_0x451e14-_0x1197e5;_0xfedc8e=_0x43b35f*_0x26bfde['details'][_0x463f3e][_0x4d91('0xc8')];_0x17474b+=_0xfedc8e;_0x531fe9+=_0xfedc8e/0x64*_0x26bfde[_0x4d91('0x58')][_0x463f3e][_0x4d91('0xc7')];}}var _0x186818=0x0;var _0x3ddd81=0x0;var _0x36c8d6=![];var _0x493156=_0x26bfde[_0x4d91('0x60')][_0x4d91('0xd2')];if(_0x493156[_0x4d91('0xd3')](_0x4d91('0xd4'))!=-0x1){_0x36c8d6=!![];}if(!_[_0x4d91('0xd1')](_0x26bfde[_0x4d91('0x60')][_0x4d91('0xc6')])){_0x20a29c+=_0x4d91('0x96');if(_0x26bfde['invoice'][_0x4d91('0xc6')]>0x0){_0x20a29c+=_0x4d91('0xd5')+_0x169863[_0x4d91('0xc6')][_0x1c966f]+_0x4d91('0xa5');_0x20a29c+=_0x4d91('0xd6')+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xc6')][_0x4d91('0xce')](0x2)+_0x4d91('0xcf');}_0x20a29c+=_0x4d91('0xbb');_0x186818=_0x531fe9;_0x3ddd81=_0x17474b;}else{_0x186818=_0x3e93d0;_0x3ddd81=_0x18f844;}if(_0x186818>0x0||_0x26bfde['invoice'][_0x4d91('0xc6')]>0x0){_0x20a29c+=_0x4d91('0x96');_0x20a29c+=''+_0x169863[_0x4d91('0xd7')][_0x1c966f]+_0x4d91('0xa5');_0x20a29c+=_0x4d91('0xcd')+_0x3ddd81['toFixed'](0x2)+_0x4d91('0xcf');_0x20a29c+=_0x4d91('0xbb');}if(_0x186818>0x0){_0x20a29c+='';_0x20a29c+=''+_0x169863[_0x4d91('0xc7')][_0x1c966f]+_0x4d91('0xa5');_0x20a29c+=_0x4d91('0xcd')+_0x186818['toFixed'](0x2)+_0x4d91('0xcf');_0x20a29c+=_0x4d91('0xbb');}_0x20a29c+=_0x4d91('0x96');var _0x3b2e36;if(_0x36c8d6){_0x3b2e36=_0x3ddd81;}else{_0x3b2e36=_0x3ddd81+_0x186818;}_0x20a29c+=_0x4d91('0xd8')+_0x169863[_0x4d91('0xd9')][_0x1c966f]+_0x4d91('0xda')+_0x3b2e36[_0x4d91('0xce')](0x2)+_0x4d91('0xcf');_0x20a29c+=_0x4d91('0xdb');_0x20a29c+=_0x4d91('0xbb');_0x20a29c+=' ';_0x20a29c+=_0x4d91('0xdc');_0x20a29c+=_0x4d91('0x96');_0x20a29c+=util[_0x4d91('0x55')](_0x4d91('0xdd'),_0x26bfde[_0x4d91('0x60')][_0x4d91('0xd2')][_0x4d91('0xde')](new RegExp(String[_0x4d91('0xdf')](0xd),'g'),_0x4d91('0xe0')));_0x20a29c+=_0x4d91('0xbb');_0x20a29c+=_0x4d91('0x96');_0x20a29c+=_0x4d91('0xb0');_0x20a29c+=_0x4d91('0xe1')+_0x169863[_0x4d91('0xe2')][_0x1c966f]+_0x4d91('0xe3');if(!_[_0x4d91('0xd1')](_0x26bfde[_0x4d91('0x60')]['issuerBankAccount'])){_0x20a29c+=''+_0x169863[_0x4d91('0xe4')][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')]['issuerBankAccount']+_0x4d91('0xe6');_0x20a29c+=_0x4d91('0xe1')+_0x169863[_0x4d91('0xe7')][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xe8')]+'\x20';_0x20a29c+=''+_0x169863['bankaddress'][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')]['issuerBankStreet']+',\x20'+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xe9')]+_0x4d91('0xea')+_0x26bfde['invoice'][_0x4d91('0xeb')]+'\x20('+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xec')]+')'+'';_0x20a29c+=_0x4d91('0xe1')+_0x169863[_0x4d91('0xed')][_0x1c966f]+'/'+_0x169863[_0x4d91('0xee')][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')]['issuerABI']+'/'+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xef')]+_0x4d91('0xe6');_0x20a29c+=_0x4d91('0xe1')+_0x169863['bic'][_0x1c966f]+'/'+_0x169863[_0x4d91('0xf0')][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xf1')]+_0x4d91('0xe6');_0x20a29c+=_0x4d91('0xe1')+_0x169863['iban'][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xf2')]+_0x4d91('0xe6');}if(!_[_0x4d91('0xd1')](_0x26bfde[_0x4d91('0x60')][_0x4d91('0xf3')])){_0x20a29c+=''+_0x169863['paypal'][_0x1c966f]+_0x4d91('0xe5')+_0x26bfde[_0x4d91('0x60')][_0x4d91('0xf3')]+_0x4d91('0xf4');}_0x20a29c+=_0x4d91('0xe1')+_0x169863[_0x4d91('0xf5')][_0x1c966f]+''+_0x578ca8+_0x4d91('0xf6')+_0x169863['thank2'][_0x1c966f]+_0x4d91('0x62');_0x20a29c+=_0x4d91('0xa5');_0x20a29c+='';if(_0x26bfde[_0x4d91('0x60')][_0x4d91('0xf7')]===0x1){_0x20a29c+='\x20';}_0x20a29c+='
%s
';_0x20a29c+=_0x4d91('0xf8');_0x20a29c+='';console[_0x4d91('0xf9')](_0x4d91('0x47'),_0x20a29c);return new BPromise(function(_0x4da3b1,_0x5999e1){pdf[_0x4d91('0xfa')](_0x20a29c,_0x4e6ae2)[_0x4d91('0xfb')](path[_0x4d91('0x4c')](_0x373857,_0x44957a),function(_0x1aac7b,_0x2e2d77){if(_0x1aac7b)return _0x5999e1(_0x1aac7b);_0x4da3b1(_0x2e2d77);});});});}})[_0x4d91('0x22')](function(){if(_0x75aa6d){console[_0x4d91('0xf9')](_0x4d91('0xfc'),_0x4fbe92,_0x44957a);return _0x26ecd7[_0x4d91('0xfd')](_0x4fbe92,_0x44957a,function(_0x14db9a){if(_0x14db9a){console[_0x4d91('0xf9')](_0x4d91('0xfe'),_0x14db9a);}else{console[_0x4d91('0xf9')]('foldername',_0x373857);rimraf(_0x373857,function(){});}});}else{return _0x26ecd7[_0x4d91('0x18')](0xc8);}})[_0x4d91('0x3d')](handleError(_0x26ecd7,null));};exports[_0x4d91('0xff')]=function(_0x27c2ee,_0xceec3){var _0x41ebc5=_0x27c2ee['query'][_0x4d91('0x100')];var _0x92ead3=squel[_0x4d91('0x101')]()[_0x4d91('0x102')]('sa_invoices')[_0x4d91('0x103')](_0x4d91('0x104'),_0x4d91('0x105'))[_0x4d91('0x103')]('YEAR(startDate)',_0x4d91('0x106'))[_0x4d91('0x103')](_0x4d91('0x107'),_0x4d91('0x108'))[_0x4d91('0x33')](_0x4d91('0x109')+_0x41ebc5+')')['order'](_0x4d91('0x107'))[_0x4d91('0x31')](_0x4d91('0x10a'),![])[_0x4d91('0x10b')](_0x4d91('0x10a'))[_0x4d91('0x10b')]('MONTH(startDate)');return db[_0x4d91('0x10c')][_0x4d91('0x2b')](_0x92ead3[_0x4d91('0x10d')](),{'type':db[_0x4d91('0x10c')][_0x4d91('0x10e')]['SELECT']})[_0x4d91('0x22')](function(_0x551031){return{'count':_0x551031[_0x4d91('0xc4')],'rows':_0x551031};})[_0x4d91('0x22')](handleEntityNotFound(_0xceec3,null))[_0x4d91('0x22')](respondWithResult(_0xceec3,null))['catch'](handleError(_0xceec3,null));};function addInvoiceCreditnoteDetail(_0x4b0d0d,_0x240571,_0x3e4879){console[_0x4d91('0xf9')](_0x4d91('0x10f'),_0x4b0d0d);var _0xfe4dae={'companyName':_0x4b0d0d['companyName'],'companyId':_0x4b0d0d['companyId'],'productName':_0x4b0d0d[_0x4d91('0xc9')],'productCode':_0x4b0d0d['productCode'],'productDescription':_0x4b0d0d['productDescription'],'typeName':_0x4b0d0d['typeName'],'pricelistName':_0x4b0d0d[_0x4d91('0x110')],'priceListId':_0x4b0d0d[_0x4d91('0x111')],'netPrice':_0x4b0d0d[_0x4d91('0xc5')],'discount':_0x4b0d0d[_0x4d91('0xc6')],'tax':_0x4b0d0d[_0x4d91('0xc7')],'agentFullname':_0x4b0d0d[_0x4d91('0x112')],'note':_0x4b0d0d['note'],'subscriptionId':_0x4b0d0d[_0x4d91('0x113')],'subscriptionName':_0x4b0d0d[_0x4d91('0x114')],'subscriptionMonthly':_0x4b0d0d[_0x4d91('0x115')],'quantity':_0x4b0d0d['quantity'],'CreditNoteId':_0x240571,'unitName':_0x4b0d0d[_0x4d91('0x116')]};return db[_0x4d91('0x117')][_0x4d91('0xfa')](_0xfe4dae,{'transaction':_0x3e4879});}exports[_0x4d91('0x118')]=function(_0x544f8d,_0x24f334,_0x34d074){var _0x5661b4;if(_0x544f8d['body']['id']){delete _0x544f8d['body']['id'];}console[_0x4d91('0xf9')](_0x544f8d);return db[_0x4d91('0x10c')][_0x4d91('0x43')](function(_0xb0ef65){return db[_0x4d91('0x119')][_0x4d91('0xfa')](_0x544f8d[_0x4d91('0x47')],{'transaction':_0xb0ef65})[_0x4d91('0x22')](function(_0x477b8c){_0x5661b4=_0x477b8c;var _0x2716bb=_0x544f8d['params']['id'];return db['SAInvoiceDetail']['findAll']({'where':{'InvoiceId':_0x2716bb},'raw':!![],'logging':console[_0x4d91('0xf9')]});})['then'](function(_0x5c070d){if(_0x5c070d[_0x4d91('0xc4')]>0x0){var _0x4bd1e2=[];for(var _0x38b459=0x0;_0x38b459<_0x5c070d[_0x4d91('0xc4')];_0x38b459++){_0x4bd1e2[_0x4d91('0x11a')](addInvoiceCreditnoteDetail(_0x5c070d[_0x38b459],_0x5661b4['id'],_0xb0ef65));}return BPromise[_0x4d91('0x11b')](_0x4bd1e2);}else{var _0x4933bf={'errors':[{'type':_0x4d91('0x11c'),'message':_0x4d91('0x11d')}]};throw _0x4933bf;}});})[_0x4d91('0x22')](function(){return _0x24f334[_0x4d91('0x18')](0xc8);})['catch'](function(_0x518d07){console[_0x4d91('0xf9')](_0x4d91('0x11e'),_0x518d07);if(_0x518d07[_0x4d91('0x25')]===_0x4d91('0x11f')){var _0x518d07={'errors':[{'message':_0x4d91('0x120')}]};}_0x24f334[_0x4d91('0x19')](0x1f4)[_0x4d91('0x26')](_0x518d07);});}; \ No newline at end of file +var _0xb62e=['I.S.\x20code','Codice\x20S.D.I.','Soc.Cap.\x20fp','Cap.Soc.\x20iv','Invoice','Fattura','Proforma','Nota\x20di\x20credito','Due\x20date','Scadenza','Item','Articolo','Description','Descrizione','Hrs/Qty','Ore/Qta','Unit\x20Price','Sub\x20Total','Sub\x20Totale','Discount','Sconto','Imponibile','Tax','Tasse','Total','Totale','Please\x20send\x20PAYMENT\x20to','Account\x20Holder','Conto\x20intestato\x20a','Bank\x20name','Nome\x20banca','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Paga\x20con\x20Paypal','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','receivingCountry','Italy','','\x20','','format','\x20%s
','issuerName','issuerStreet','\x20%s','issuerCity','-\x20%s\x20
','issuerCountry','phone',':\x20%s
','issuerPhone','issuerFax','email','issuerEmail','piva','issuerFiscalCode','sdi','issuerSDICode','issuerSocCap','','','%s','companyName','%s
','receivingStreet','%s\x20-\x20','receivingPostalCode','receivingCity','','receivingPIVA','receivingSDICode','','','','','%s,\x20','updatedAt','DD/MM/YYYY','%s\x20','add','saExpiryDay','days','duedate',':\x20%s','','item','','description','','hrsqty','subtotal','quantity','%s','productDescription','','\x20€','toFixed','isNil','discount','netPrice','tax','receivingFiscalMessage','indexOf','','\x20','total','','nettopay','','\x20',' ','','\x20%s\x20','replace','fromCharCode','','','sendpayment',':','issuerBankAccount','accountholder',':\x20','','bankname','issuerBankName','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerABI','bic','swif','iban','issuerPayPal','paypal','','thank1','','thank2','paid','
','','log','TCL:\x20exports.getInvoicePDF\x20->\x20saveTo,\x20fileName','download','err','foldername','getInvoicesNumberByYear','years','select','from','invoiceYear','MONTH(startDate)','invoiceMonth','YEAR(startDate)\x20IN\x20(','YEAR(startDate)','group','QueryTypes','SELECT','addInvoiceCreditnoteDetail->>','companyId','productName','productCode','typeName','pricelistName','priceListId','agentFullname','note','subscriptionId','subscriptionMonthly','automaticInvoiceCreditnote','SACreditNote','WARNING','No\x20product\x20to\x20assign\x20credit\x20note.\x20Credit\x20note\x20not\x20created!!\x20','TCL:\x20exports.automaticInvoiceCreditnote\x20->\x20err','Duplicate\x20entry.','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','index','SAInvoice','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','find','create','sequelize','transaction','body','params','describe','getInvoicePDF','unix','toString','join','server','files','tmp','root','images','logos','paid-invoice.png','Invoice_%s-%s.pdf','invoice','SAInvoiceDetail','details','portrait','1cm','10mm','{{page}}/{{pages}}','contents','','issuerWeb','','mkdirSync','','\x20\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}','','Phone','Fax','Email','P.IVA','Tax\x20code','C.F.'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0xb62e,0x1de));var _0xeb62=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb62e[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var hardwareService=require(_0xeb62('0x13'));var logger=require(_0xeb62('0x14'))(_0xeb62('0x15'));var utils=require(_0xeb62('0x16'));var config=require(_0xeb62('0x17'));var db=require(_0xeb62('0x18'))['db'];function respondWithStatusCode(_0x17724e,_0x4a493c){_0x4a493c=_0x4a493c||0xcc;return function(_0x422daf){if(_0x422daf){return _0x17724e[_0xeb62('0x19')](_0x4a493c);}return _0x17724e[_0xeb62('0x1a')](_0x4a493c)[_0xeb62('0x1b')]();};}function respondWithResult(_0x55a629,_0x333126){_0x333126=_0x333126||0xc8;return function(_0x2fbad2){if(_0x2fbad2){return _0x55a629[_0xeb62('0x1a')](_0x333126)['json'](_0x2fbad2);}};}function respondWithFilteredResult(_0x26c3fd,_0x195837){return function(_0x2fd4c7){if(_0x2fd4c7){var _0x4ce9fa=_0x2fd4c7[_0xeb62('0x1c')],_0x1f6a1f=_0x195837[_0xeb62('0x1d')],_0x15b3e8=_0x195837[_0xeb62('0x1d')]+_0x195837[_0xeb62('0x1e')],_0x184106;if(_0x15b3e8>=_0x4ce9fa){_0x15b3e8=_0x4ce9fa;_0x184106=0xc8;}else{_0x184106=0xce;}_0x26c3fd[_0xeb62('0x1a')](_0x184106);return _0x26c3fd[_0xeb62('0x1f')](_0xeb62('0x20'),_0x1f6a1f+'-'+_0x15b3e8+'/'+_0x4ce9fa)[_0xeb62('0x21')](_0x2fd4c7);}return null;};}function patchUpdates(_0x11d516){return function(_0x3cdf76){try{jsonpatch['apply'](_0x3cdf76,_0x11d516,!![]);}catch(_0x38c5e4){return BPromise[_0xeb62('0x22')](_0x38c5e4);}return _0x3cdf76[_0xeb62('0x23')]();};}function saveUpdates(_0xb44905,_0x425817){return function(_0x24cbf3){if(_0x24cbf3){return _0x24cbf3[_0xeb62('0x24')](_0xb44905)['then'](function(_0x599d0b){return _0x599d0b;});}return null;};}function removeEntity(_0x1fbfaa,_0x154451){return function(_0x11ed9c){if(_0x11ed9c){return _0x11ed9c[_0xeb62('0x25')]()[_0xeb62('0x26')](function(){_0x1fbfaa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4664ce,_0x132861){return function(_0x182781){if(!_0x182781){_0x4664ce[_0xeb62('0x19')](0x194);}return _0x182781;};}function handleError(_0x55a169,_0x4e92f5){_0x4e92f5=_0x4e92f5||0x1f4;return function(_0x3ef988){logger['error'](_0x3ef988[_0xeb62('0x27')]);if(_0x3ef988['name']){delete _0x3ef988[_0xeb62('0x28')];}_0x55a169['status'](_0x4e92f5)[_0xeb62('0x29')](_0x3ef988);};}exports[_0xeb62('0x2a')]=function(_0x46d1bb,_0x4e4268){var _0x3ef784={},_0x3ae031={},_0x5222f4={'count':0x0,'rows':[]};var _0xe8872c=db[_0xeb62('0x2b')][_0xeb62('0x2c')];_0x3ae031['model']=_[_0xeb62('0x2d')](_0xe8872c);_0x3ae031[_0xeb62('0x2e')]=_['keys'](_0x46d1bb[_0xeb62('0x2e')]);_0x3ae031[_0xeb62('0x2f')]=_[_0xeb62('0x30')](_0x3ae031[_0xeb62('0x31')],_0x3ae031[_0xeb62('0x2e')]);_0x3ef784['attributes']=_['intersection'](_0x3ae031[_0xeb62('0x31')],qs[_0xeb62('0x32')](_0x46d1bb[_0xeb62('0x2e')][_0xeb62('0x32')]));_0x3ef784[_0xeb62('0x33')]=_0x3ef784[_0xeb62('0x33')][_0xeb62('0x34')]?_0x3ef784['attributes']:_0x3ae031[_0xeb62('0x31')];if(!_0x46d1bb['query']['hasOwnProperty'](_0xeb62('0x35'))){_0x3ef784[_0xeb62('0x1e')]=qs['limit'](_0x46d1bb[_0xeb62('0x2e')]['limit']);_0x3ef784[_0xeb62('0x1d')]=qs[_0xeb62('0x1d')](_0x46d1bb['query'][_0xeb62('0x1d')]);}_0x3ef784[_0xeb62('0x36')]=qs['sort'](_0x46d1bb[_0xeb62('0x2e')][_0xeb62('0x37')]);_0x3ef784[_0xeb62('0x38')]=qs[_0xeb62('0x2f')](_['pick'](_0x46d1bb[_0xeb62('0x2e')],_0x3ae031[_0xeb62('0x2f')]));if(_0x46d1bb['query']['filter']){_0x3ef784[_0xeb62('0x38')]=_[_0xeb62('0x39')](_0x3ef784['where'],{'$or':_[_0xeb62('0x3a')](_0xe8872c,function(_0x30cff0){if(_0x30cff0[_0xeb62('0x3b')][_0xeb62('0x3c')]!==_0xeb62('0x3d')){var _0x15387a={};_0x15387a[_0x30cff0[_0xeb62('0x3e')]]={'$like':'%'+_0x46d1bb['query']['filter']+'%'};return _0x15387a;}})});}_0x3ef784=_[_0xeb62('0x39')]({},_0x3ef784,_0x46d1bb[_0xeb62('0x3f')]);var _0x21772a={'where':_0x3ef784[_0xeb62('0x38')]};return db['SAInvoice'][_0xeb62('0x1c')](_0x21772a)['then'](function(_0x20fd7a){_0x5222f4[_0xeb62('0x1c')]=_0x20fd7a;if(_0x46d1bb[_0xeb62('0x2e')][_0xeb62('0x40')]){_0x3ef784[_0xeb62('0x41')]=[{'all':!![]}];}return db[_0xeb62('0x2b')][_0xeb62('0x42')](_0x3ef784);})[_0xeb62('0x26')](function(_0x5e8ef8){_0x5222f4[_0xeb62('0x43')]=_0x5e8ef8;return _0x5222f4;})[_0xeb62('0x26')](respondWithFilteredResult(_0x4e4268,_0x3ef784))[_0xeb62('0x44')](handleError(_0x4e4268,null));};exports[_0xeb62('0x45')]=function(_0x5dd0e3,_0x4eda8b){var _0x46a560={'raw':![],'where':{'id':_0x5dd0e3['params']['id']}},_0x41fb7d={};_0x41fb7d[_0xeb62('0x31')]=_[_0xeb62('0x2d')](db['SAInvoice'][_0xeb62('0x2c')]);_0x41fb7d['query']=_[_0xeb62('0x2d')](_0x5dd0e3['query']);_0x41fb7d[_0xeb62('0x2f')]=_['intersection'](_0x41fb7d[_0xeb62('0x31')],_0x41fb7d[_0xeb62('0x2e')]);_0x46a560[_0xeb62('0x33')]=_['intersection'](_0x41fb7d['model'],qs[_0xeb62('0x32')](_0x5dd0e3[_0xeb62('0x2e')][_0xeb62('0x32')]));_0x46a560[_0xeb62('0x33')]=_0x46a560[_0xeb62('0x33')]['length']?_0x46a560[_0xeb62('0x33')]:_0x41fb7d['model'];if(_0x5dd0e3[_0xeb62('0x2e')]['includeAll']){_0x46a560[_0xeb62('0x41')]=[{'all':!![]}];}_0x46a560=_['merge']({},_0x46a560,_0x5dd0e3[_0xeb62('0x3f')]);return db['SAInvoice'][_0xeb62('0x46')](_0x46a560)[_0xeb62('0x26')](handleEntityNotFound(_0x4eda8b,null))[_0xeb62('0x26')](respondWithResult(_0x4eda8b,null))[_0xeb62('0x44')](handleError(_0x4eda8b,null));};exports[_0xeb62('0x47')]=function(_0x21bb97,_0x4e62eb){return db[_0xeb62('0x48')][_0xeb62('0x49')]({'isolationLevel':db['Sequelize']['Transaction']['ISOLATION_LEVELS']['SERIALIZABLE']},function(_0x24dff5){return db[_0xeb62('0x2b')]['create'](_0x21bb97[_0xeb62('0x4a')],{'transaction':_0x24dff5});})[_0xeb62('0x26')](respondWithResult(_0x4e62eb,0xc9))[_0xeb62('0x44')](handleError(_0x4e62eb,null));};exports[_0xeb62('0x24')]=function(_0x39595c,_0x555812){if(_0x39595c[_0xeb62('0x4a')]['id']){delete _0x39595c['body']['id'];}return db[_0xeb62('0x2b')][_0xeb62('0x46')]({'where':{'id':_0x39595c[_0xeb62('0x4b')]['id']}})[_0xeb62('0x26')](handleEntityNotFound(_0x555812,null))[_0xeb62('0x26')](saveUpdates(_0x39595c[_0xeb62('0x4a')],null))[_0xeb62('0x26')](respondWithResult(_0x555812,null))[_0xeb62('0x44')](handleError(_0x555812,null));};exports[_0xeb62('0x25')]=function(_0x3a29ac,_0xe13846){return db[_0xeb62('0x2b')]['find']({'where':{'id':_0x3a29ac[_0xeb62('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe13846,null))['then'](removeEntity(_0xe13846,null))[_0xeb62('0x44')](handleError(_0xe13846,null));};exports[_0xeb62('0x4c')]=function(_0x482fae,_0x373505){return db[_0xeb62('0x2b')]['describe']()[_0xeb62('0x26')](respondWithResult(_0x373505,null))[_0xeb62('0x44')](handleError(_0x373505,null));};exports[_0xeb62('0x4d')]=function(_0x60617,_0xe71e83){var _0x1e6238=moment()[_0xeb62('0x4e')]()[_0xeb62('0x4f')]();var _0x497714=path[_0xeb62('0x50')](config['root'],_0xeb62('0x51'),_0xeb62('0x52'),_0xeb62('0x53'));var _0x289af0=path[_0xeb62('0x50')](config[_0xeb62('0x54')],_0xeb62('0x51'),_0xeb62('0x52'),'images','logos','logo-invoice.png');var _0x5033eb=path[_0xeb62('0x50')](config['root'],_0xeb62('0x51'),'files',_0xeb62('0x55'),_0xeb62('0x56'),_0xeb62('0x57'));var _0x595797=path[_0xeb62('0x50')](_0x497714,_0x1e6238);var _0x1486a6=util['format'](_0xeb62('0x58'),_0x60617[_0xeb62('0x4b')]['id'],_0x1e6238);var _0x39190c=path[_0xeb62('0x50')](_0x595797,_0x1486a6);var _0x55370c=![];var _0x3be3e1={};return db[_0xeb62('0x2b')]['find']({'where':{'id':_0x60617[_0xeb62('0x4b')]['id']},'raw':!![]})[_0xeb62('0x26')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x26')](function(_0x466c3c){if(_0x466c3c){_0x3be3e1[_0xeb62('0x59')]=_0x466c3c;return db[_0xeb62('0x5a')][_0xeb62('0x42')]({'where':{'InvoiceId':_0x466c3c['id']},'raw':!![]})[_0xeb62('0x26')](function(_0x222d0c){_0x3be3e1[_0xeb62('0x5b')]=_0x222d0c;_0x55370c=!![];var _0x130153='';var _0x15c93f={'format':'A4','orientation':_0xeb62('0x5c'),'border':_0xeb62('0x5d'),'footer':{'height':_0xeb62('0x5e'),'contents':{'default':_0xeb62('0x5f')}}};_0x15c93f['footer']['contents']['default']=_0x15c93f['footer'][_0xeb62('0x60')]['default']+_0xeb62('0x61')+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0x62')]+_0xeb62('0x63');fs[_0xeb62('0x64')](_0x595797);_0x130153=_0xeb62('0x65');_0x130153+=_0xeb62('0x66');_0x130153+=_0xeb62('0x67');var _0x349916={'phone':{'en':_0xeb62('0x68'),'it':'Telefono'},'fax':{'en':_0xeb62('0x69'),'it':_0xeb62('0x69')},'email':{'en':_0xeb62('0x6a'),'it':_0xeb62('0x6a')},'piva':{'en':'VAT\x20number','it':_0xeb62('0x6b')},'cf':{'en':_0xeb62('0x6c'),'it':_0xeb62('0x6d')},'sdi':{'en':_0xeb62('0x6e'),'it':_0xeb62('0x6f')},'cs':{'en':_0xeb62('0x70'),'it':_0xeb62('0x71')},'invoice':{'en':_0xeb62('0x72'),'it':_0xeb62('0x73')},'proforma':{'en':_0xeb62('0x74'),'it':_0xeb62('0x74')},'creditnote':{'en':'Credit\x20note','it':_0xeb62('0x75')},'duedate':{'en':_0xeb62('0x76'),'it':_0xeb62('0x77')},'item':{'en':_0xeb62('0x78'),'it':_0xeb62('0x79')},'description':{'en':_0xeb62('0x7a'),'it':_0xeb62('0x7b')},'hrsqty':{'en':_0xeb62('0x7c'),'it':_0xeb62('0x7d')},'unitprice':{'en':_0xeb62('0x7e'),'it':'Prezzo\x20Unitario'},'subtotal':{'en':_0xeb62('0x7f'),'it':_0xeb62('0x80')},'discount':{'en':_0xeb62('0x81'),'it':_0xeb62('0x82')},'total':{'en':'Subtotal','it':_0xeb62('0x83')},'tax':{'en':_0xeb62('0x84'),'it':_0xeb62('0x85')},'nettopay':{'en':_0xeb62('0x86'),'it':_0xeb62('0x87')},'sendpayment':{'en':_0xeb62('0x88'),'it':'Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a'},'accountholder':{'en':_0xeb62('0x89'),'it':_0xeb62('0x8a')},'bankname':{'en':_0xeb62('0x8b'),'it':_0xeb62('0x8c')},'bankaddress':{'en':_0xeb62('0x8d'),'it':_0xeb62('0x8e')},'abi':{'en':_0xeb62('0x8f'),'it':_0xeb62('0x8f')},'cab':{'en':_0xeb62('0x90'),'it':_0xeb62('0x90')},'bic':{'en':_0xeb62('0x91'),'it':_0xeb62('0x91')},'swif':{'en':_0xeb62('0x92'),'it':_0xeb62('0x92')},'iban':{'en':_0xeb62('0x93'),'it':_0xeb62('0x93')},'paypal':{'en':'Pay\x20via\x20Paypal','it':_0xeb62('0x94')},'thank1':{'en':'Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','it':_0xeb62('0x95')},'thank2':{'en':_0xeb62('0x96'),'it':'\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.'}};var _0x2d8bbe='it';if(_0x3be3e1[_0xeb62('0x59')][_0xeb62('0x97')]!==_0xeb62('0x98')){_0x2d8bbe='en';}_0x130153+=_0xeb62('0x99');_0x130153+=_0xeb62('0x9a')+_0x289af0+_0xeb62('0x9b');_0x130153+=_0xeb62('0x9c');_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0x9e'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0x9f')]);_0x130153+=util[_0xeb62('0x9d')]('%s
',_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xa0')]);_0x130153+=util['format']('%s',_0x3be3e1[_0xeb62('0x59')]['issuerPostalCode']);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xa1'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xa2')]);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xa3'),_0x3be3e1['invoice'][_0xeb62('0xa4')]);_0x130153+=util['format'](_0x349916[_0xeb62('0xa5')][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xa7')]);_0x130153+=util[_0xeb62('0x9d')](_0x349916['fax'][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xa8')]);_0x130153+=util['format'](_0x349916[_0xeb62('0xa9')][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xaa')]);_0x130153+=util[_0xeb62('0x9d')](_0x349916[_0xeb62('0xab')][_0x2d8bbe]+':\x20%s
',_0x3be3e1['invoice']['issuerPIVA']);_0x130153+=util['format'](_0x349916['cf'][_0x2d8bbe]+':\x20%s
',_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xac')]);_0x130153+=util[_0xeb62('0x9d')](_0x349916[_0xeb62('0xad')][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xae')]);_0x130153+=util[_0xeb62('0x9d')](_0x349916['cs'][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xaf')]);_0x130153+=_0xeb62('0xb0');_0x130153+='';_0x130153+=_0xeb62('0xb1');_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xb2'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xb3')]);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xb4'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xb5')]);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xb6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xb7')]);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xb4'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xb8')]);_0x130153+=util[_0xeb62('0x9d')]('%s
',_0x3be3e1[_0xeb62('0x59')]['receivingCountry']);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xb9')+_0x349916['cf'][_0x2d8bbe]+':\x20%s
',_0x3be3e1[_0xeb62('0x59')]['receivingFiscalCode']);_0x130153+=util['format'](_0x349916[_0xeb62('0xab')][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xba')]);_0x130153+=util['format'](_0x349916[_0xeb62('0xad')][_0x2d8bbe]+_0xeb62('0xa6'),_0x3be3e1['invoice'][_0xeb62('0xbb')]);_0x130153+=_0xeb62('0xbc');_0x130153+=_0xeb62('0xbd');_0x130153+=_0xeb62('0x9c');_0x130153+=_0xeb62('0xbe');_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xbf')+_0x349916[_0xeb62('0x59')][_0x2d8bbe]+'\x20N.%d',_0x466c3c['id']);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xc0'),_0x3be3e1['invoice'][_0xeb62('0xa2')]);var _0x5c83b8=moment(_0x3be3e1['invoice'][_0xeb62('0xc1')])[_0xeb62('0x9d')](_0xeb62('0xc2'));_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xc3'),_0x5c83b8);var _0x5072fd=moment(_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xc1')])[_0xeb62('0xc4')](_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xc5')],_0xeb62('0xc6'))[_0xeb62('0x9d')](_0xeb62('0xc2'));_0x130153+=util['format'](''+_0x349916[_0xeb62('0xc7')][_0x2d8bbe]+_0xeb62('0xc8'),_0x5072fd);_0x130153+=_0xeb62('0xbd');_0x130153+=_0xeb62('0x9c');_0x130153+='';_0x130153+=_0xeb62('0xc9');_0x130153+='';_0x130153+=''+_0x349916[_0xeb62('0xca')][_0x2d8bbe]+_0xeb62('0xcb');_0x130153+=''+_0x349916[_0xeb62('0xcc')][_0x2d8bbe]+'';_0x130153+=_0xeb62('0xcd')+_0x349916[_0xeb62('0xce')][_0x2d8bbe]+_0xeb62('0xcb');_0x130153+=''+_0x349916['unitprice'][_0x2d8bbe]+_0xeb62('0xcb');_0x130153+=_0xeb62('0xcd')+_0x349916[_0xeb62('0xcf')][_0x2d8bbe]+'';_0x130153+=_0xeb62('0xbd');var _0x162993=0x0;var _0x3f5c93=0x0;for(var _0x4d0392=0x0;_0x4d0392<_0x3be3e1[_0xeb62('0x5b')][_0xeb62('0x34')];_0x4d0392++){var _0x518655=0x0;var _0x4cd599=0x0;var _0x5d0c09=0x0;var _0x23c6d7=0x0;_0x518655=_0x3be3e1['details'][_0x4d0392]['netPrice']-_0x3be3e1[_0xeb62('0x5b')][_0x4d0392]['netPrice']/0x64*_0x3be3e1['details'][_0x4d0392]['discount'];_0x4cd599=_0x518655/0x64*_0x3be3e1[_0xeb62('0x5b')][_0x4d0392]['tax'];_0x5d0c09=_0x518655*_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd0')];_0x23c6d7=_0x4cd599*_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd0')];_0x130153+=_0xeb62('0x9c');_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xd1'),_0x3be3e1['details'][_0x4d0392]['productName']);_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xd1'),_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd2')]);_0x130153+=util[_0xeb62('0x9d')]('%d',_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd0')]);_0x130153+=_0xeb62('0xd3')+_0x518655['toFixed'](0x2)+_0xeb62('0xd4');_0x130153+=''+_0x5d0c09[_0xeb62('0xd5')](0x2)+_0xeb62('0xd4');_0x130153+='';_0x162993+=_0x5d0c09;_0x3f5c93+=_0x23c6d7;}_0x130153+='';if(!_[_0xeb62('0xd6')](_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xd7')])){var _0x1b7039=0x0;var _0x4ad034=0x0;var _0x403ae5=_0x3be3e1[_0xeb62('0x59')]['discount']*0x64/_0x162993;for(var _0x4d0392=0x0;_0x4d0392<_0x3be3e1[_0xeb62('0x5b')][_0xeb62('0x34')];_0x4d0392++){var _0x42b301=0x0;var _0x478336=0x0;var _0x396185=0x0;_0x518655=_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd8')]-_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd8')]/0x64*_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd7')];_0x42b301=_0x518655/0x64*_0x403ae5;_0x478336=_0x518655-_0x42b301;_0x396185=_0x478336*_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd0')];_0x1b7039+=_0x396185;_0x4ad034+=_0x396185/0x64*_0x3be3e1[_0xeb62('0x5b')][_0x4d0392][_0xeb62('0xd9')];}}var _0xf2a819=0x0;var _0x5984d2=0x0;var _0x1be079=![];var _0x459066=_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xda')];if(_0x459066[_0xeb62('0xdb')]('split\x20payment')!=-0x1){_0x1be079=!![];}if(!_['isNil'](_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xd7')])){_0x130153+=_0xeb62('0x9c');if(_0x3be3e1[_0xeb62('0x59')]['discount']>0x0){_0x130153+=_0xeb62('0xdc')+_0x349916['discount'][_0x2d8bbe]+_0xeb62('0xb0');_0x130153+=_0xeb62('0xdd')+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xd7')][_0xeb62('0xd5')](0x2)+'\x20€';}_0x130153+=_0xeb62('0xbd');_0xf2a819=_0x4ad034;_0x5984d2=_0x1b7039;}else{_0xf2a819=_0x3f5c93;_0x5984d2=_0x162993;}if(_0xf2a819>0x0||_0x3be3e1[_0xeb62('0x59')]['discount']>0x0){_0x130153+=_0xeb62('0x9c');_0x130153+=''+_0x349916[_0xeb62('0xde')][_0x2d8bbe]+_0xeb62('0xb0');_0x130153+=_0xeb62('0xd3')+_0x5984d2[_0xeb62('0xd5')](0x2)+_0xeb62('0xd4');_0x130153+=_0xeb62('0xbd');}if(_0xf2a819>0x0){_0x130153+='';_0x130153+=''+_0x349916[_0xeb62('0xd9')][_0x2d8bbe]+_0xeb62('0xb0');_0x130153+=_0xeb62('0xd3')+_0xf2a819[_0xeb62('0xd5')](0x2)+'\x20€';_0x130153+='';}_0x130153+=_0xeb62('0x9c');var _0x527de3;if(_0x1be079){_0x527de3=_0x5984d2;}else{_0x527de3=_0x5984d2+_0xf2a819;}_0x130153+=_0xeb62('0xdf')+_0x349916[_0xeb62('0xe0')][_0x2d8bbe]+_0xeb62('0xe1')+_0x527de3['toFixed'](0x2)+_0xeb62('0xd4');_0x130153+=_0xeb62('0xe2');_0x130153+=_0xeb62('0xbd');_0x130153+=_0xeb62('0xe3');_0x130153+=_0xeb62('0xe4');_0x130153+=_0xeb62('0x9c');_0x130153+=util[_0xeb62('0x9d')](_0xeb62('0xe5'),_0x3be3e1['invoice'][_0xeb62('0xda')][_0xeb62('0xe6')](new RegExp(String[_0xeb62('0xe7')](0xd),'g'),_0xeb62('0xe8')));_0x130153+='';_0x130153+=_0xeb62('0x9c');_0x130153+=_0xeb62('0xbe');_0x130153+=_0xeb62('0xe9')+_0x349916[_0xeb62('0xea')][_0x2d8bbe]+_0xeb62('0xeb');if(!_['isNil'](_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xec')])){_0x130153+=_0xeb62('0xe9')+_0x349916[_0xeb62('0xed')][_0x2d8bbe]+_0xeb62('0xee')+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xec')]+_0xeb62('0xef');_0x130153+=_0xeb62('0xe9')+_0x349916[_0xeb62('0xf0')][_0x2d8bbe]+':\x20'+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xf1')]+'\x20';_0x130153+=''+_0x349916[_0xeb62('0xf2')][_0x2d8bbe]+_0xeb62('0xee')+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xf3')]+',\x20'+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xf4')]+_0xeb62('0xf5')+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xf6')]+'\x20('+_0x3be3e1['invoice']['issuerBankCountry']+')'+_0xeb62('0xef');_0x130153+=_0xeb62('0xe9')+_0x349916['abi'][_0x2d8bbe]+'/'+_0x349916['cab'][_0x2d8bbe]+_0xeb62('0xee')+_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xf7')]+'/'+_0x3be3e1['invoice']['issuerCAB']+_0xeb62('0xef');_0x130153+=''+_0x349916[_0xeb62('0xf8')][_0x2d8bbe]+'/'+_0x349916[_0xeb62('0xf9')][_0x2d8bbe]+_0xeb62('0xee')+_0x3be3e1['invoice']['issuerBankBICSWIFT']+'';_0x130153+=_0xeb62('0xe9')+_0x349916[_0xeb62('0xfa')][_0x2d8bbe]+_0xeb62('0xee')+_0x3be3e1[_0xeb62('0x59')]['issuerBankIBAN']+_0xeb62('0xef');}if(!_[_0xeb62('0xd6')](_0x3be3e1[_0xeb62('0x59')][_0xeb62('0xfb')])){_0x130153+=_0xeb62('0xe9')+_0x349916[_0xeb62('0xfc')][_0x2d8bbe]+_0xeb62('0xee')+_0x3be3e1[_0xeb62('0x59')]['issuerPayPal']+_0xeb62('0xfd');}_0x130153+=_0xeb62('0xe9')+_0x349916[_0xeb62('0xfe')][_0x2d8bbe]+_0xeb62('0xff')+_0x5072fd+''+_0x349916[_0xeb62('0x100')][_0x2d8bbe]+_0xeb62('0x63');_0x130153+='';_0x130153+=_0xeb62('0xbd');if(_0x3be3e1[_0xeb62('0x59')][_0xeb62('0x101')]===0x1){_0x130153+=_0xeb62('0x9a')+_0x5033eb+_0xeb62('0x9b');}_0x130153+=_0xeb62('0x102');_0x130153+=_0xeb62('0x103');_0x130153+='';console[_0xeb62('0x104')]('body',_0x130153);return new BPromise(function(_0x3578a9,_0xc28582){pdf[_0xeb62('0x47')](_0x130153,_0x15c93f)['toFile'](path['join'](_0x595797,_0x1486a6),function(_0x13abd2,_0x716f0e){if(_0x13abd2)return _0xc28582(_0x13abd2);_0x3578a9(_0x716f0e);});});});}})[_0xeb62('0x26')](function(){if(_0x55370c){console[_0xeb62('0x104')](_0xeb62('0x105'),_0x39190c,_0x1486a6);return _0xe71e83[_0xeb62('0x106')](_0x39190c,_0x1486a6,function(_0x32f326){if(_0x32f326){console[_0xeb62('0x104')](_0xeb62('0x107'),_0x32f326);}else{console['log'](_0xeb62('0x108'),_0x595797);rimraf(_0x595797,function(){});}});}else{return _0xe71e83[_0xeb62('0x19')](0xc8);}})[_0xeb62('0x44')](handleError(_0xe71e83,null));};exports[_0xeb62('0x109')]=function(_0x1cda96,_0x4dc827){var _0x36a455=_0x1cda96['query'][_0xeb62('0x10a')];var _0x2d2b3c=squel[_0xeb62('0x10b')]()[_0xeb62('0x10c')]('sa_invoices')['field']('count(id)','invoiceNumber')[_0xeb62('0x3e')]('YEAR(startDate)',_0xeb62('0x10d'))[_0xeb62('0x3e')](_0xeb62('0x10e'),_0xeb62('0x10f'))[_0xeb62('0x38')](_0xeb62('0x110')+_0x36a455+')')[_0xeb62('0x36')](_0xeb62('0x10e'))[_0xeb62('0x36')](_0xeb62('0x111'),![])['group'](_0xeb62('0x111'))[_0xeb62('0x112')](_0xeb62('0x10e'));return db[_0xeb62('0x48')][_0xeb62('0x2e')](_0x2d2b3c[_0xeb62('0x4f')](),{'type':db[_0xeb62('0x48')][_0xeb62('0x113')][_0xeb62('0x114')]})['then'](function(_0x2880fb){return{'count':_0x2880fb[_0xeb62('0x34')],'rows':_0x2880fb};})[_0xeb62('0x26')](handleEntityNotFound(_0x4dc827,null))['then'](respondWithResult(_0x4dc827,null))[_0xeb62('0x44')](handleError(_0x4dc827,null));};function addInvoiceCreditnoteDetail(_0x4e505e,_0x2925ef,_0x115b6e){console['log'](_0xeb62('0x115'),_0x4e505e);var _0x585e6b={'companyName':_0x4e505e[_0xeb62('0xb3')],'companyId':_0x4e505e[_0xeb62('0x116')],'productName':_0x4e505e[_0xeb62('0x117')],'productCode':_0x4e505e[_0xeb62('0x118')],'productDescription':_0x4e505e[_0xeb62('0xd2')],'typeName':_0x4e505e[_0xeb62('0x119')],'pricelistName':_0x4e505e[_0xeb62('0x11a')],'priceListId':_0x4e505e[_0xeb62('0x11b')],'netPrice':_0x4e505e[_0xeb62('0xd8')],'discount':_0x4e505e[_0xeb62('0xd7')],'tax':_0x4e505e['tax'],'agentFullname':_0x4e505e[_0xeb62('0x11c')],'note':_0x4e505e[_0xeb62('0x11d')],'subscriptionId':_0x4e505e[_0xeb62('0x11e')],'subscriptionName':_0x4e505e['subscriptionName'],'subscriptionMonthly':_0x4e505e[_0xeb62('0x11f')],'quantity':_0x4e505e['quantity'],'CreditNoteId':_0x2925ef,'unitName':_0x4e505e['unitName']};return db['SACreditNoteDetail']['create'](_0x585e6b,{'transaction':_0x115b6e});}exports[_0xeb62('0x120')]=function(_0x2bf699,_0x504bfe,_0x3fedd4){var _0x24b424;if(_0x2bf699[_0xeb62('0x4a')]['id']){delete _0x2bf699[_0xeb62('0x4a')]['id'];}console[_0xeb62('0x104')](_0x2bf699);return db[_0xeb62('0x48')][_0xeb62('0x49')](function(_0x5cf011){return db[_0xeb62('0x121')][_0xeb62('0x47')](_0x2bf699[_0xeb62('0x4a')],{'transaction':_0x5cf011})['then'](function(_0xc8c0dd){_0x24b424=_0xc8c0dd;var _0x4c56a2=_0x2bf699[_0xeb62('0x4b')]['id'];return db[_0xeb62('0x5a')][_0xeb62('0x42')]({'where':{'InvoiceId':_0x4c56a2},'raw':!![],'logging':console['log']});})[_0xeb62('0x26')](function(_0x135a1b){if(_0x135a1b[_0xeb62('0x34')]>0x0){var _0x45b4f5=[];for(var _0x44d59b=0x0;_0x44d59b<_0x135a1b[_0xeb62('0x34')];_0x44d59b++){_0x45b4f5['push'](addInvoiceCreditnoteDetail(_0x135a1b[_0x44d59b],_0x24b424['id'],_0x5cf011));}return BPromise['all'](_0x45b4f5);}else{var _0x54c8d0={'errors':[{'type':_0xeb62('0x122'),'message':_0xeb62('0x123')}]};throw _0x54c8d0;}});})[_0xeb62('0x26')](function(){return _0x504bfe[_0xeb62('0x19')](0xc8);})['catch'](function(_0x3ffed8){console['log'](_0xeb62('0x124'),_0x3ffed8);if(_0x3ffed8['name']==='SequelizeUniqueConstraintError'){var _0x3ffed8={'errors':[{'message':_0xeb62('0x125')}]};}_0x504bfe[_0xeb62('0x1a')](0x1f4)[_0xeb62('0x29')](_0x3ffed8);});}; \ No newline at end of file diff --git a/server/api/saInvoice/saInvoice.model.js b/server/api/saInvoice/saInvoice.model.js index 73667d7..bcb4969 100644 --- a/server/api/saInvoice/saInvoice.model.js +++ b/server/api/saInvoice/saInvoice.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c09=['rimraf','../../config/environment','./saInvoice.attributes','define','SAInvoice','sa_invoices','get','format','YYYY','has','SAInvoiceNumber','findOne','transaction','then','number','update','log','TCL:\x20error','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7c09,0x102));var _0x97c0=function(_0x3add4a,_0x3f851d){_0x3add4a=_0x3add4a-0x0;var _0x53efec=_0x7c09[_0x3add4a];return _0x53efec;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x109bc8,_0x293785,_0x57661a){var _0x205520=_0x4b2f81['models'];var _0x2d5507=_0x109bc8[_0x97c0('0xc')]({'plain':!![]});var _0x52bce2=0x1;var _0x50412f=parseInt(moment()[_0x97c0('0xd')](_0x97c0('0xe')));try{if(_[_0x97c0('0xf')](_0x2d5507,'id')){return _0x205520[_0x97c0('0x10')][_0x97c0('0x11')]({'where':{'year':_0x50412f},'raw':!![],'logging':!![],'transaction':_0x293785[_0x97c0('0x12')]})[_0x97c0('0x13')](function(_0x39a3b4){if(_0x39a3b4){_0x52bce2=_0x39a3b4[_0x97c0('0x14')]+0x1;return _0x205520[_0x97c0('0x10')][_0x97c0('0x15')]({'number':_0x52bce2},{'where':{'id':_0x39a3b4['id']},'transaction':_0x293785[_0x97c0('0x12')],'logging':!![]});}return _0x205520[_0x97c0('0x10')]['create']({'year':_0x50412f,'number':_0x52bce2},{'logging':!![],'transaction':_0x293785[_0x97c0('0x12')]});})[_0x97c0('0x13')](function(){_0x2d5507[_0x97c0('0x14')]=_0x52bce2;})['then'](function(){_0x57661a();});}}catch(_0x42027d){console[_0x97c0('0x16')](_0x97c0('0x17'),_0x42027d);_0x57661a();}}}});}; \ No newline at end of file +var _0x814b=['rimraf','../../config/environment','./saInvoice.attributes','exports','define','SAInvoice','models','get','format','YYYY','SAInvoiceNumber','transaction','then','number','update','create','log','TCL:\x20error','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xbc88bc,_0x10ea66){var _0x548858=function(_0x178473){while(--_0x178473){_0xbc88bc['push'](_0xbc88bc['shift']());}};_0x548858(++_0x10ea66);}(_0x814b,0x1a2));var _0xb814=function(_0x493503,_0x351993){_0x493503=_0x493503-0x0;var _0x1986d0=_0x814b[_0x493503];return _0x1986d0;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'sa_invoices','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x271af9,_0x2913a6,_0x186d5a){var _0x41166c=_0x322a70[_0xb814('0xd')];var _0x21d4a5=_0x271af9[_0xb814('0xe')]({'plain':!![]});var _0x19aad8=0x1;var _0x207dbc=parseInt(moment()[_0xb814('0xf')](_0xb814('0x10')));try{if(_['has'](_0x21d4a5,'id')){return _0x41166c[_0xb814('0x11')]['findOne']({'where':{'year':_0x207dbc},'raw':!![],'logging':!![],'transaction':_0x2913a6[_0xb814('0x12')]})[_0xb814('0x13')](function(_0x35b10d){if(_0x35b10d){_0x19aad8=_0x35b10d[_0xb814('0x14')]+0x1;return _0x41166c[_0xb814('0x11')][_0xb814('0x15')]({'number':_0x19aad8},{'where':{'id':_0x35b10d['id']},'transaction':_0x2913a6[_0xb814('0x12')],'logging':!![]});}return _0x41166c[_0xb814('0x11')][_0xb814('0x16')]({'year':_0x207dbc,'number':_0x19aad8},{'logging':!![],'transaction':_0x2913a6[_0xb814('0x12')]});})[_0xb814('0x13')](function(){_0x21d4a5[_0xb814('0x14')]=_0x19aad8;})[_0xb814('0x13')](function(){_0x186d5a();});}}catch(_0x39bfcf){console[_0xb814('0x17')](_0xb814('0x18'),_0x39bfcf);_0x186d5a();}}}});}; \ No newline at end of file diff --git a/server/api/saInvoice/saInvoice.rpc.js b/server/api/saInvoice/saInvoice.rpc.js index a3e686b..50db073 100644 --- a/server/api/saInvoice/saInvoice.rpc.js +++ b/server/api/saInvoice/saInvoice.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd40a=['message','result','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SAInvoice,\x20%s,\x20%s','request\x20sent','debug','SAInvoice,\x20%s,\x20%s,\x20%s','error'];(function(_0xfa2394,_0xe61b77){var _0x40a19b=function(_0x2be7a4){while(--_0x2be7a4){_0xfa2394['push'](_0xfa2394['shift']());}};_0x40a19b(++_0xe61b77);}(_0xd40a,0x74));var _0xad40=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd40a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xad40('0x0'));var util=require(_0xad40('0x1'));var moment=require(_0xad40('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad40('0x3'))['db'];var utils=require(_0xad40('0x4'));var logger=require('../../config/logger')(_0xad40('0x5'));var config=require(_0xad40('0x6'));var jayson=require(_0xad40('0x7'));var client=jayson[_0xad40('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x141048,_0x4de32d,_0x436c05){return new BPromise(function(_0x3078f2,_0x550e9c){return client[_0xad40('0x9')](_0x141048,_0x436c05)[_0xad40('0xa')](function(_0x2af068){logger[_0xad40('0xb')](_0xad40('0xc'),_0x4de32d,_0xad40('0xd'));logger[_0xad40('0xe')](_0xad40('0xf'),_0x4de32d,_0xad40('0xd'),JSON['stringify'](_0x2af068));if(_0x2af068['error']){if(_0x2af068['error']['code']===0x1f4){logger[_0xad40('0x10')](_0xad40('0xc'),_0x4de32d,_0x2af068[_0xad40('0x10')][_0xad40('0x11')]);return _0x550e9c(_0x2af068[_0xad40('0x10')]['message']);}logger[_0xad40('0x10')](_0xad40('0xc'),_0x4de32d,_0x2af068[_0xad40('0x10')][_0xad40('0x11')]);return _0x3078f2(_0x2af068[_0xad40('0x10')]['message']);}else{logger['info']('SAInvoice,\x20%s,\x20%s',_0x4de32d,_0xad40('0xd'));_0x3078f2(_0x2af068[_0xad40('0x12')][_0xad40('0x11')]);}})['catch'](function(_0x1771ca){logger[_0xad40('0x10')](_0xad40('0xc'),_0x4de32d,_0x1771ca);_0x550e9c(_0x1771ca);});});} \ No newline at end of file +var _0x687e=['bluebird','ioredis','../../config/utils','../../config/environment','http','then','SAInvoice,\x20%s,\x20%s','request\x20sent','debug','SAInvoice,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment'];(function(_0x4db3f4,_0x3a0dfb){var _0x488893=function(_0xaa4952){while(--_0xaa4952){_0x4db3f4['push'](_0x4db3f4['shift']());}};_0x488893(++_0x3a0dfb);}(_0x687e,0x141));var _0xe687=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x687e[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xe687('0x0'));var util=require(_0xe687('0x1'));var moment=require(_0xe687('0x2'));var BPromise=require(_0xe687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe687('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe687('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe687('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe687('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36a614,_0x5b9e26,_0x58c5e2){return new BPromise(function(_0x390aa8,_0x489d79){return client['request'](_0x36a614,_0x58c5e2)[_0xe687('0x8')](function(_0x2fc466){logger['info'](_0xe687('0x9'),_0x5b9e26,_0xe687('0xa'));logger[_0xe687('0xb')](_0xe687('0xc'),_0x5b9e26,_0xe687('0xa'),JSON['stringify'](_0x2fc466));if(_0x2fc466[_0xe687('0xd')]){if(_0x2fc466[_0xe687('0xd')][_0xe687('0xe')]===0x1f4){logger[_0xe687('0xd')]('SAInvoice,\x20%s,\x20%s',_0x5b9e26,_0x2fc466[_0xe687('0xd')]['message']);return _0x489d79(_0x2fc466['error'][_0xe687('0xf')]);}logger[_0xe687('0xd')](_0xe687('0x9'),_0x5b9e26,_0x2fc466[_0xe687('0xd')]['message']);return _0x390aa8(_0x2fc466[_0xe687('0xd')]['message']);}else{logger[_0xe687('0x10')]('SAInvoice,\x20%s,\x20%s',_0x5b9e26,_0xe687('0xa'));_0x390aa8(_0x2fc466['result']['message']);}})[_0xe687('0x11')](function(_0x14c8ac){logger[_0xe687('0xd')](_0xe687('0x9'),_0x5b9e26,_0x14c8ac);_0x489d79(_0x14c8ac);});});} \ No newline at end of file diff --git a/server/api/saInvoiceDetail/index.js b/server/api/saInvoiceDetail/index.js index 6c6ebb8..d405453 100644 --- a/server/api/saInvoiceDetail/index.js +++ b/server/api/saInvoiceDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5b5=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./saInvoiceDetail.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','delete','exports','util','path'];(function(_0x4a18f9,_0x323188){var _0x447da5=function(_0x1dc100){while(--_0x1dc100){_0x4a18f9['push'](_0x4a18f9['shift']());}};_0x447da5(++_0x323188);}(_0xd5b5,0x14e));var _0x5d5b=function(_0x2b1ea9,_0x22091f){_0x2b1ea9=_0x2b1ea9-0x0;var _0xcee5e0=_0xd5b5[_0x2b1ea9];return _0xcee5e0;};'use strict';var multer=require('multer');var util=require(_0x5d5b('0x0'));var path=require(_0x5d5b('0x1'));var timeout=require(_0x5d5b('0x2'));var express=require(_0x5d5b('0x3'));var router=express[_0x5d5b('0x4')]();var auth=require(_0x5d5b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5d5b('0x6'));var controller=require(_0x5d5b('0x7'));router['get']('/',auth[_0x5d5b('0x8')](),controller[_0x5d5b('0x9')]);router['get'](_0x5d5b('0xa'),auth[_0x5d5b('0x8')](),controller[_0x5d5b('0xb')]);router[_0x5d5b('0xc')](_0x5d5b('0xd'),auth['isAuthenticated'](),controller[_0x5d5b('0xe')]);router[_0x5d5b('0xf')]('/',auth[_0x5d5b('0x8')](),controller[_0x5d5b('0x10')]);router[_0x5d5b('0x11')]('/:id',auth[_0x5d5b('0x8')](),controller[_0x5d5b('0x12')]);router[_0x5d5b('0x13')](_0x5d5b('0xd'),auth[_0x5d5b('0x8')](),controller['destroy']);module[_0x5d5b('0x14')]=router; \ No newline at end of file +var _0x0639=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./saInvoiceDetail.controller'];(function(_0x46adb7,_0x433103){var _0x2db644=function(_0x2cd347){while(--_0x2cd347){_0x46adb7['push'](_0x46adb7['shift']());}};_0x2db644(++_0x433103);}(_0x0639,0xf4));var _0x9063=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x0639[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0x9063('0x0'));var util=require(_0x9063('0x1'));var path=require(_0x9063('0x2'));var timeout=require(_0x9063('0x3'));var express=require(_0x9063('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9063('0x5'));var config=require(_0x9063('0x6'));var controller=require(_0x9063('0x7'));router[_0x9063('0x8')]('/',auth[_0x9063('0x9')](),controller[_0x9063('0xa')]);router[_0x9063('0x8')](_0x9063('0xb'),auth[_0x9063('0x9')](),controller[_0x9063('0xc')]);router[_0x9063('0x8')](_0x9063('0xd'),auth[_0x9063('0x9')](),controller[_0x9063('0xe')]);router[_0x9063('0xf')]('/',auth['isAuthenticated'](),controller[_0x9063('0x10')]);router['put'](_0x9063('0xd'),auth[_0x9063('0x9')](),controller[_0x9063('0x11')]);router[_0x9063('0x12')](_0x9063('0xd'),auth[_0x9063('0x9')](),controller[_0x9063('0x13')]);module[_0x9063('0x14')]=router; \ No newline at end of file diff --git a/server/api/saInvoiceDetail/saInvoiceDetail.attributes.js b/server/api/saInvoiceDetail/saInvoiceDetail.attributes.js index 64d62da..7400f70 100644 --- a/server/api/saInvoiceDetail/saInvoiceDetail.attributes.js +++ b/server/api/saInvoiceDetail/saInvoiceDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52e6=['STRING','INTEGER','TEXT','long','DECIMAL','sequelize','exports'];(function(_0x140ddb,_0x122890){var _0x180285=function(_0x4dcf8f){while(--_0x4dcf8f){_0x140ddb['push'](_0x140ddb['shift']());}};_0x180285(++_0x122890);}(_0x52e6,0x19b));var _0x652e=function(_0x480896,_0x590e7b){_0x480896=_0x480896-0x0;var _0x361c52=_0x52e6[_0x480896];return _0x361c52;};'use strict';var Sequelize=require(_0x652e('0x0'));module[_0x652e('0x1')]={'companyName':{'type':Sequelize[_0x652e('0x2')],'allowNull':![]},'companyId':{'type':Sequelize[_0x652e('0x3')],'allowNull':![]},'productName':{'type':Sequelize[_0x652e('0x4')],'allowNull':![]},'productCode':{'type':Sequelize[_0x652e('0x2')],'allowNull':![]},'productDescription':{'type':Sequelize[_0x652e('0x4')](_0x652e('0x5'))+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'},'typeName':{'type':Sequelize[_0x652e('0x2')],'allowNull':![]},'unitName':{'type':Sequelize[_0x652e('0x2')]},'pricelistName':{'type':Sequelize[_0x652e('0x4')],'allowNull':![]},'priceListId':{'type':Sequelize[_0x652e('0x3')],'allowNull':![]},'netPrice':{'type':Sequelize[_0x652e('0x6')](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0x652e('0x6')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0x652e('0x6')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0x652e('0x2')],'allowNull':![]},'note':{'type':Sequelize[_0x652e('0x4')]},'subscriptionId':{'type':Sequelize[_0x652e('0x3')],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0x652e('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0x652e('0x3')],'allowNull':![]},'quantity':{'type':Sequelize[_0x652e('0x3')],'allowNull':![]},'ProductQuotationId':{'type':Sequelize[_0x652e('0x3')]}}; \ No newline at end of file +var _0x1741=['\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DECIMAL','sequelize','exports','STRING','INTEGER','TEXT','long'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x1741,0x10a));var _0x1174=function(_0x4abf13,_0x28742a){_0x4abf13=_0x4abf13-0x0;var _0x27b0e5=_0x1741[_0x4abf13];return _0x27b0e5;};'use strict';var Sequelize=require(_0x1174('0x0'));module[_0x1174('0x1')]={'companyName':{'type':Sequelize[_0x1174('0x2')],'allowNull':![]},'companyId':{'type':Sequelize[_0x1174('0x3')],'allowNull':![]},'productName':{'type':Sequelize[_0x1174('0x4')],'allowNull':![]},'productCode':{'type':Sequelize[_0x1174('0x2')],'allowNull':![]},'productDescription':{'type':Sequelize[_0x1174('0x4')](_0x1174('0x5'))+_0x1174('0x6')},'typeName':{'type':Sequelize[_0x1174('0x2')],'allowNull':![]},'unitName':{'type':Sequelize[_0x1174('0x2')]},'pricelistName':{'type':Sequelize['TEXT'],'allowNull':![]},'priceListId':{'type':Sequelize[_0x1174('0x3')],'allowNull':![]},'netPrice':{'type':Sequelize[_0x1174('0x7')](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0x1174('0x7')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0x1174('0x7')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize['STRING'],'allowNull':![]},'note':{'type':Sequelize[_0x1174('0x4')]},'subscriptionId':{'type':Sequelize[_0x1174('0x3')],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0x1174('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0x1174('0x3')],'allowNull':![]},'quantity':{'type':Sequelize[_0x1174('0x3')],'allowNull':![]},'ProductQuotationId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/saInvoiceDetail/saInvoiceDetail.controller.js b/server/api/saInvoiceDetail/saInvoiceDetail.controller.js index 4e341d8..3d4017c 100644 --- a/server/api/saInvoiceDetail/saInvoiceDetail.controller.js +++ b/server/api/saInvoiceDetail/saInvoiceDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf481=['params','includeAll','create','body','find','describe','html-pdf','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','SAInvoiceDetail','count','include','findAll','catch'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf481,0x11a));var _0x1f48=function(_0x55a89d,_0x584ea7){_0x55a89d=_0x55a89d-0x0;var _0x1b0e5a=_0xf481[_0x55a89d];return _0x1b0e5a;};'use strict';var pdf=require(_0x1f48('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1f48('0x1'));var BPromise=require(_0x1f48('0x2'));var Mustache=require(_0x1f48('0x3'));var util=require('util');var path=require('path');var sox=require(_0x1f48('0x4'));var csv=require(_0x1f48('0x5'));var ejs=require(_0x1f48('0x6'));var fs=require('fs');var _=require(_0x1f48('0x7'));var squel=require(_0x1f48('0x8'));var crypto=require(_0x1f48('0x9'));var jsforce=require(_0x1f48('0xa'));var deskjs=require(_0x1f48('0xb'));var toCsv=require(_0x1f48('0x5'));var querystring=require('querystring');var Papa=require(_0x1f48('0xc'));var Redis=require(_0x1f48('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x1f48('0xe'));var logger=require(_0x1f48('0xf'))(_0x1f48('0x10'));var utils=require('../../config/utils');var config=require(_0x1f48('0x11'));var db=require(_0x1f48('0x12'))['db'];function respondWithStatusCode(_0x21eb3c,_0x2fbff9){_0x2fbff9=_0x2fbff9||0xcc;return function(_0x5b7840){if(_0x5b7840){return _0x21eb3c[_0x1f48('0x13')](_0x2fbff9);}return _0x21eb3c['status'](_0x2fbff9)[_0x1f48('0x14')]();};}function respondWithResult(_0x393568,_0x29f732){_0x29f732=_0x29f732||0xc8;return function(_0x214021){if(_0x214021){return _0x393568[_0x1f48('0x15')](_0x29f732)['json'](_0x214021);}};}function respondWithFilteredResult(_0x476c2b,_0x456ded){return function(_0x9ec085){if(_0x9ec085){var _0x3f225f=_0x9ec085['count'],_0x4209a2=_0x456ded[_0x1f48('0x16')],_0x4473ff=_0x456ded['offset']+_0x456ded['limit'],_0x101b23;if(_0x4473ff>=_0x3f225f){_0x4473ff=_0x3f225f;_0x101b23=0xc8;}else{_0x101b23=0xce;}_0x476c2b['status'](_0x101b23);return _0x476c2b[_0x1f48('0x17')](_0x1f48('0x18'),_0x4209a2+'-'+_0x4473ff+'/'+_0x3f225f)['json'](_0x9ec085);}return null;};}function patchUpdates(_0x57b93b){return function(_0x3fa86d){try{jsonpatch[_0x1f48('0x19')](_0x3fa86d,_0x57b93b,!![]);}catch(_0x3ed7af){return BPromise[_0x1f48('0x1a')](_0x3ed7af);}return _0x3fa86d[_0x1f48('0x1b')]();};}function saveUpdates(_0x37fc90,_0x58870c){return function(_0x266a5b){if(_0x266a5b){return _0x266a5b[_0x1f48('0x1c')](_0x37fc90)[_0x1f48('0x1d')](function(_0x5d3f2c){return _0x5d3f2c;});}return null;};}function removeEntity(_0x2d0220,_0x353ab0){return function(_0x4bf0a3){if(_0x4bf0a3){return _0x4bf0a3[_0x1f48('0x1e')]()[_0x1f48('0x1d')](function(){_0x2d0220[_0x1f48('0x15')](0xcc)[_0x1f48('0x14')]();});}};}function handleEntityNotFound(_0x57d60,_0x27ff35){return function(_0x23e289){if(!_0x23e289){_0x57d60[_0x1f48('0x13')](0x194);}return _0x23e289;};}function handleError(_0xd21626,_0x3bc3db){_0x3bc3db=_0x3bc3db||0x1f4;return function(_0x163ab3){logger['error'](_0x163ab3[_0x1f48('0x1f')]);if(_0x163ab3[_0x1f48('0x20')]){delete _0x163ab3[_0x1f48('0x20')];}_0xd21626[_0x1f48('0x15')](_0x3bc3db)[_0x1f48('0x21')](_0x163ab3);};}exports[_0x1f48('0x22')]=function(_0x50f979,_0x5d8b99){var _0x4087f1={},_0x2c643d={},_0x5ecf33={'count':0x0,'rows':[]};var _0x5dae4c=db['SAInvoiceDetail'][_0x1f48('0x23')];_0x2c643d[_0x1f48('0x24')]=_[_0x1f48('0x25')](_0x5dae4c);_0x2c643d[_0x1f48('0x26')]=_['keys'](_0x50f979[_0x1f48('0x26')]);_0x2c643d[_0x1f48('0x27')]=_[_0x1f48('0x28')](_0x2c643d[_0x1f48('0x24')],_0x2c643d[_0x1f48('0x26')]);_0x4087f1[_0x1f48('0x29')]=_[_0x1f48('0x28')](_0x2c643d[_0x1f48('0x24')],qs[_0x1f48('0x2a')](_0x50f979[_0x1f48('0x26')][_0x1f48('0x2a')]));_0x4087f1[_0x1f48('0x29')]=_0x4087f1[_0x1f48('0x29')][_0x1f48('0x2b')]?_0x4087f1[_0x1f48('0x29')]:_0x2c643d[_0x1f48('0x24')];if(!_0x50f979[_0x1f48('0x26')][_0x1f48('0x2c')]('nolimit')){_0x4087f1[_0x1f48('0x2d')]=qs[_0x1f48('0x2d')](_0x50f979[_0x1f48('0x26')][_0x1f48('0x2d')]);_0x4087f1['offset']=qs[_0x1f48('0x16')](_0x50f979[_0x1f48('0x26')][_0x1f48('0x16')]);}_0x4087f1[_0x1f48('0x2e')]=qs['sort'](_0x50f979[_0x1f48('0x26')][_0x1f48('0x2f')]);_0x4087f1[_0x1f48('0x30')]=qs['filters'](_[_0x1f48('0x31')](_0x50f979[_0x1f48('0x26')],_0x2c643d[_0x1f48('0x27')]));if(_0x50f979['query'][_0x1f48('0x32')]){_0x4087f1[_0x1f48('0x30')]=_[_0x1f48('0x33')](_0x4087f1[_0x1f48('0x30')],{'$or':_[_0x1f48('0x34')](_0x5dae4c,function(_0x1d81c1){if(_0x1d81c1[_0x1f48('0x35')][_0x1f48('0x36')]!==_0x1f48('0x37')){var _0x2fe147={};_0x2fe147[_0x1d81c1[_0x1f48('0x38')]]={'$like':'%'+_0x50f979['query'][_0x1f48('0x32')]+'%'};return _0x2fe147;}})});}_0x4087f1=_[_0x1f48('0x33')]({},_0x4087f1,_0x50f979[_0x1f48('0x39')]);var _0x58ba05={'where':_0x4087f1[_0x1f48('0x30')]};return db[_0x1f48('0x3a')][_0x1f48('0x3b')](_0x58ba05)[_0x1f48('0x1d')](function(_0x24955b){_0x5ecf33[_0x1f48('0x3b')]=_0x24955b;if(_0x50f979[_0x1f48('0x26')]['includeAll']){_0x4087f1[_0x1f48('0x3c')]=[{'all':!![]}];}return db['SAInvoiceDetail'][_0x1f48('0x3d')](_0x4087f1);})[_0x1f48('0x1d')](function(_0x998576){_0x5ecf33['rows']=_0x998576;return _0x5ecf33;})[_0x1f48('0x1d')](respondWithFilteredResult(_0x5d8b99,_0x4087f1))[_0x1f48('0x3e')](handleError(_0x5d8b99,null));};exports['show']=function(_0x5f46f4,_0xfbd18b){var _0x1991c4={'raw':![],'where':{'id':_0x5f46f4[_0x1f48('0x3f')]['id']}},_0x554de5={};_0x554de5[_0x1f48('0x24')]=_['keys'](db[_0x1f48('0x3a')][_0x1f48('0x23')]);_0x554de5['query']=_[_0x1f48('0x25')](_0x5f46f4[_0x1f48('0x26')]);_0x554de5[_0x1f48('0x27')]=_['intersection'](_0x554de5[_0x1f48('0x24')],_0x554de5['query']);_0x1991c4[_0x1f48('0x29')]=_['intersection'](_0x554de5[_0x1f48('0x24')],qs[_0x1f48('0x2a')](_0x5f46f4[_0x1f48('0x26')][_0x1f48('0x2a')]));_0x1991c4['attributes']=_0x1991c4['attributes'][_0x1f48('0x2b')]?_0x1991c4[_0x1f48('0x29')]:_0x554de5['model'];if(_0x5f46f4[_0x1f48('0x26')][_0x1f48('0x40')]){_0x1991c4['include']=[{'all':!![]}];}_0x1991c4=_[_0x1f48('0x33')]({},_0x1991c4,_0x5f46f4[_0x1f48('0x39')]);return db['SAInvoiceDetail']['find'](_0x1991c4)[_0x1f48('0x1d')](handleEntityNotFound(_0xfbd18b,null))[_0x1f48('0x1d')](respondWithResult(_0xfbd18b,null))[_0x1f48('0x3e')](handleError(_0xfbd18b,null));};exports[_0x1f48('0x41')]=function(_0x1b3d5b,_0x2cd2c9){return db[_0x1f48('0x3a')]['create'](_0x1b3d5b[_0x1f48('0x42')],{})[_0x1f48('0x1d')](respondWithResult(_0x2cd2c9,0xc9))[_0x1f48('0x3e')](handleError(_0x2cd2c9,null));};exports['update']=function(_0x3361b5,_0xa144b5){if(_0x3361b5['body']['id']){delete _0x3361b5[_0x1f48('0x42')]['id'];}return db[_0x1f48('0x3a')][_0x1f48('0x43')]({'where':{'id':_0x3361b5[_0x1f48('0x3f')]['id']}})['then'](handleEntityNotFound(_0xa144b5,null))['then'](saveUpdates(_0x3361b5[_0x1f48('0x42')],null))[_0x1f48('0x1d')](respondWithResult(_0xa144b5,null))[_0x1f48('0x3e')](handleError(_0xa144b5,null));};exports['destroy']=function(_0x13d9ca,_0x5f44a6){return db[_0x1f48('0x3a')]['find']({'where':{'id':_0x13d9ca[_0x1f48('0x3f')]['id']}})[_0x1f48('0x1d')](handleEntityNotFound(_0x5f44a6,null))['then'](removeEntity(_0x5f44a6,null))['catch'](handleError(_0x5f44a6,null));};exports[_0x1f48('0x44')]=function(_0x49f320,_0x19beef){return db[_0x1f48('0x3a')][_0x1f48('0x44')]()['then'](respondWithResult(_0x19beef,null))[_0x1f48('0x3e')](handleError(_0x19beef,null));}; \ No newline at end of file +var _0x4348=['status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','error','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','map','type','key','VIRTUAL','field','options','SAInvoiceDetail','then','includeAll','include','findAll','rows','show','params','length','catch','create','body','describe','html-pdf','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','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x4348,0x10e));var _0x8434=function(_0x48027f,_0x472dfc){_0x48027f=_0x48027f-0x0;var _0x551dec=_0x4348[_0x48027f];return _0x551dec;};'use strict';var pdf=require(_0x8434('0x0'));var emlformat=require(_0x8434('0x1'));var rimraf=require(_0x8434('0x2'));var zipdir=require(_0x8434('0x3'));var jsonpatch=require(_0x8434('0x4'));var rp=require(_0x8434('0x5'));var moment=require(_0x8434('0x6'));var BPromise=require(_0x8434('0x7'));var Mustache=require(_0x8434('0x8'));var util=require('util');var path=require(_0x8434('0x9'));var sox=require(_0x8434('0xa'));var csv=require(_0x8434('0xb'));var ejs=require(_0x8434('0xc'));var fs=require('fs');var _=require(_0x8434('0xd'));var squel=require('squel');var crypto=require(_0x8434('0xe'));var jsforce=require(_0x8434('0xf'));var deskjs=require(_0x8434('0x10'));var toCsv=require(_0x8434('0xb'));var querystring=require(_0x8434('0x11'));var Papa=require(_0x8434('0x12'));var Redis=require(_0x8434('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8434('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8434('0x15'))(_0x8434('0x16'));var utils=require(_0x8434('0x17'));var config=require(_0x8434('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x418535,_0x4fe7a2){_0x4fe7a2=_0x4fe7a2||0xcc;return function(_0x2bdcc8){if(_0x2bdcc8){return _0x418535[_0x8434('0x19')](_0x4fe7a2);}return _0x418535[_0x8434('0x1a')](_0x4fe7a2)[_0x8434('0x1b')]();};}function respondWithResult(_0x5c41e1,_0x4fcebe){_0x4fcebe=_0x4fcebe||0xc8;return function(_0x439da8){if(_0x439da8){return _0x5c41e1[_0x8434('0x1a')](_0x4fcebe)['json'](_0x439da8);}};}function respondWithFilteredResult(_0xdbebb0,_0x19b865){return function(_0x586dcd){if(_0x586dcd){var _0x4d7b52=_0x586dcd[_0x8434('0x1c')],_0x2d7d6e=_0x19b865[_0x8434('0x1d')],_0x3598a1=_0x19b865[_0x8434('0x1d')]+_0x19b865[_0x8434('0x1e')],_0x11889e;if(_0x3598a1>=_0x4d7b52){_0x3598a1=_0x4d7b52;_0x11889e=0xc8;}else{_0x11889e=0xce;}_0xdbebb0['status'](_0x11889e);return _0xdbebb0['set'](_0x8434('0x1f'),_0x2d7d6e+'-'+_0x3598a1+'/'+_0x4d7b52)[_0x8434('0x20')](_0x586dcd);}return null;};}function patchUpdates(_0x97f4c2){return function(_0x98940f){try{jsonpatch[_0x8434('0x21')](_0x98940f,_0x97f4c2,!![]);}catch(_0x52d92f){return BPromise[_0x8434('0x22')](_0x52d92f);}return _0x98940f[_0x8434('0x23')]();};}function saveUpdates(_0x5f315c,_0x4f713f){return function(_0x240d37){if(_0x240d37){return _0x240d37[_0x8434('0x24')](_0x5f315c)['then'](function(_0x45b90c){return _0x45b90c;});}return null;};}function removeEntity(_0xb8c2c2,_0x3d6e62){return function(_0x15f540){if(_0x15f540){return _0x15f540[_0x8434('0x25')]()['then'](function(){_0xb8c2c2['status'](0xcc)[_0x8434('0x1b')]();});}};}function handleEntityNotFound(_0x5bf42c,_0x158186){return function(_0x3b1cad){if(!_0x3b1cad){_0x5bf42c[_0x8434('0x19')](0x194);}return _0x3b1cad;};}function handleError(_0x433e52,_0x86c016){_0x86c016=_0x86c016||0x1f4;return function(_0x3ea214){logger[_0x8434('0x26')](_0x3ea214['stack']);if(_0x3ea214['name']){delete _0x3ea214[_0x8434('0x27')];}_0x433e52['status'](_0x86c016)[_0x8434('0x28')](_0x3ea214);};}exports['index']=function(_0x36a821,_0x1d810f){var _0x215afd={},_0x4970f1={},_0x3f9ab9={'count':0x0,'rows':[]};var _0x454599=db['SAInvoiceDetail'][_0x8434('0x29')];_0x4970f1[_0x8434('0x2a')]=_[_0x8434('0x2b')](_0x454599);_0x4970f1[_0x8434('0x2c')]=_[_0x8434('0x2b')](_0x36a821[_0x8434('0x2c')]);_0x4970f1[_0x8434('0x2d')]=_[_0x8434('0x2e')](_0x4970f1[_0x8434('0x2a')],_0x4970f1['query']);_0x215afd[_0x8434('0x2f')]=_[_0x8434('0x2e')](_0x4970f1[_0x8434('0x2a')],qs[_0x8434('0x30')](_0x36a821['query'][_0x8434('0x30')]));_0x215afd['attributes']=_0x215afd[_0x8434('0x2f')]['length']?_0x215afd[_0x8434('0x2f')]:_0x4970f1[_0x8434('0x2a')];if(!_0x36a821[_0x8434('0x2c')]['hasOwnProperty'](_0x8434('0x31'))){_0x215afd[_0x8434('0x1e')]=qs[_0x8434('0x1e')](_0x36a821[_0x8434('0x2c')]['limit']);_0x215afd[_0x8434('0x1d')]=qs['offset'](_0x36a821[_0x8434('0x2c')][_0x8434('0x1d')]);}_0x215afd[_0x8434('0x32')]=qs[_0x8434('0x33')](_0x36a821['query'][_0x8434('0x33')]);_0x215afd['where']=qs[_0x8434('0x2d')](_[_0x8434('0x34')](_0x36a821['query'],_0x4970f1[_0x8434('0x2d')]));if(_0x36a821[_0x8434('0x2c')][_0x8434('0x35')]){_0x215afd[_0x8434('0x36')]=_['merge'](_0x215afd['where'],{'$or':_[_0x8434('0x37')](_0x454599,function(_0x214107){if(_0x214107[_0x8434('0x38')][_0x8434('0x39')]!==_0x8434('0x3a')){var _0x39e499={};_0x39e499[_0x214107[_0x8434('0x3b')]]={'$like':'%'+_0x36a821[_0x8434('0x2c')][_0x8434('0x35')]+'%'};return _0x39e499;}})});}_0x215afd=_['merge']({},_0x215afd,_0x36a821[_0x8434('0x3c')]);var _0x2c21e9={'where':_0x215afd[_0x8434('0x36')]};return db[_0x8434('0x3d')][_0x8434('0x1c')](_0x2c21e9)[_0x8434('0x3e')](function(_0x144d2f){_0x3f9ab9['count']=_0x144d2f;if(_0x36a821['query'][_0x8434('0x3f')]){_0x215afd[_0x8434('0x40')]=[{'all':!![]}];}return db[_0x8434('0x3d')][_0x8434('0x41')](_0x215afd);})['then'](function(_0xa4eaab){_0x3f9ab9[_0x8434('0x42')]=_0xa4eaab;return _0x3f9ab9;})[_0x8434('0x3e')](respondWithFilteredResult(_0x1d810f,_0x215afd))['catch'](handleError(_0x1d810f,null));};exports[_0x8434('0x43')]=function(_0x413641,_0x1ad6a2){var _0x89da95={'raw':![],'where':{'id':_0x413641[_0x8434('0x44')]['id']}},_0x2391cd={};_0x2391cd[_0x8434('0x2a')]=_[_0x8434('0x2b')](db[_0x8434('0x3d')][_0x8434('0x29')]);_0x2391cd[_0x8434('0x2c')]=_[_0x8434('0x2b')](_0x413641[_0x8434('0x2c')]);_0x2391cd['filters']=_['intersection'](_0x2391cd[_0x8434('0x2a')],_0x2391cd['query']);_0x89da95[_0x8434('0x2f')]=_['intersection'](_0x2391cd[_0x8434('0x2a')],qs['fields'](_0x413641[_0x8434('0x2c')][_0x8434('0x30')]));_0x89da95[_0x8434('0x2f')]=_0x89da95[_0x8434('0x2f')][_0x8434('0x45')]?_0x89da95[_0x8434('0x2f')]:_0x2391cd[_0x8434('0x2a')];if(_0x413641[_0x8434('0x2c')]['includeAll']){_0x89da95['include']=[{'all':!![]}];}_0x89da95=_['merge']({},_0x89da95,_0x413641['options']);return db['SAInvoiceDetail']['find'](_0x89da95)[_0x8434('0x3e')](handleEntityNotFound(_0x1ad6a2,null))[_0x8434('0x3e')](respondWithResult(_0x1ad6a2,null))[_0x8434('0x46')](handleError(_0x1ad6a2,null));};exports[_0x8434('0x47')]=function(_0x1f856e,_0x7ceec8){return db['SAInvoiceDetail'][_0x8434('0x47')](_0x1f856e[_0x8434('0x48')],{})[_0x8434('0x3e')](respondWithResult(_0x7ceec8,0xc9))[_0x8434('0x46')](handleError(_0x7ceec8,null));};exports[_0x8434('0x24')]=function(_0x955997,_0x3a0da3){if(_0x955997[_0x8434('0x48')]['id']){delete _0x955997[_0x8434('0x48')]['id'];}return db[_0x8434('0x3d')]['find']({'where':{'id':_0x955997[_0x8434('0x44')]['id']}})[_0x8434('0x3e')](handleEntityNotFound(_0x3a0da3,null))['then'](saveUpdates(_0x955997[_0x8434('0x48')],null))[_0x8434('0x3e')](respondWithResult(_0x3a0da3,null))[_0x8434('0x46')](handleError(_0x3a0da3,null));};exports[_0x8434('0x25')]=function(_0x2a3b16,_0x5dcd80){return db[_0x8434('0x3d')]['find']({'where':{'id':_0x2a3b16[_0x8434('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dcd80,null))['then'](removeEntity(_0x5dcd80,null))[_0x8434('0x46')](handleError(_0x5dcd80,null));};exports[_0x8434('0x49')]=function(_0xf7e7be,_0x18054a){return db['SAInvoiceDetail'][_0x8434('0x49')]()[_0x8434('0x3e')](respondWithResult(_0x18054a,null))[_0x8434('0x46')](handleError(_0x18054a,null));}; \ No newline at end of file diff --git a/server/api/saInvoiceDetail/saInvoiceDetail.model.js b/server/api/saInvoiceDetail/saInvoiceDetail.model.js index 42d34c3..6a0d0c0 100644 --- a/server/api/saInvoiceDetail/saInvoiceDetail.model.js +++ b/server/api/saInvoiceDetail/saInvoiceDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f85=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./saInvoiceDetail.attributes','exports','define','sa_invoice_details','lodash','../../config/logger'];(function(_0x247dcb,_0x5d6a2a){var _0x207c90=function(_0x495061){while(--_0x495061){_0x247dcb['push'](_0x247dcb['shift']());}};_0x207c90(++_0x5d6a2a);}(_0x9f85,0xf5));var _0x59f8=function(_0x4ec2ea,_0x2683c5){_0x4ec2ea=_0x4ec2ea-0x0;var _0x4f2f4b=_0x9f85[_0x4ec2ea];return _0x4f2f4b;};'use strict';var _=require(_0x59f8('0x0'));var util=require('util');var logger=require(_0x59f8('0x1'))(_0x59f8('0x2'));var moment=require(_0x59f8('0x3'));var BPromise=require(_0x59f8('0x4'));var rp=require(_0x59f8('0x5'));var fs=require('fs');var path=require(_0x59f8('0x6'));var rimraf=require(_0x59f8('0x7'));var config=require(_0x59f8('0x8'));var attributes=require(_0x59f8('0x9'));module[_0x59f8('0xa')]=function(_0x947153,_0x302e45){return _0x947153[_0x59f8('0xb')]('SAInvoiceDetail',attributes,{'tableName':_0x59f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['SAInvoiceDetail','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x1b3978,_0x5bedcd){var _0x4ac9e9=function(_0x34d551){while(--_0x34d551){_0x1b3978['push'](_0x1b3978['shift']());}};_0x4ac9e9(++_0x5bedcd);}(_0x7ee1,0xab));var _0x17ee=function(_0x4306ee,_0x1e4122){_0x4306ee=_0x4306ee-0x0;var _0x44b327=_0x7ee1[_0x4306ee];return _0x44b327;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require(_0x17ee('0x1'))(_0x17ee('0x2'));var moment=require(_0x17ee('0x3'));var BPromise=require(_0x17ee('0x4'));var rp=require(_0x17ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x6'));var config=require('../../config/environment');var attributes=require('./saInvoiceDetail.attributes');module[_0x17ee('0x7')]=function(_0x2e4db0,_0x2efefb){return _0x2e4db0[_0x17ee('0x8')](_0x17ee('0x9'),attributes,{'tableName':'sa_invoice_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saInvoiceDetail/saInvoiceDetail.rpc.js b/server/api/saInvoiceDetail/saInvoiceDetail.rpc.js index 22fd05e..4d66632 100644 --- a/server/api/saInvoiceDetail/saInvoiceDetail.rpc.js +++ b/server/api/saInvoiceDetail/saInvoiceDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c61=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SAInvoiceDetail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5788aa,_0x5e95f6){var _0x3db5b6=function(_0x1dbd69){while(--_0x1dbd69){_0x5788aa['push'](_0x5788aa['shift']());}};_0x3db5b6(++_0x5e95f6);}(_0x7c61,0x94));var _0x17c6=function(_0x20c9f8,_0x45d931){_0x20c9f8=_0x20c9f8-0x0;var _0x2dfe50=_0x7c61[_0x20c9f8];return _0x2dfe50;};'use strict';var _=require(_0x17c6('0x0'));var util=require(_0x17c6('0x1'));var moment=require(_0x17c6('0x2'));var BPromise=require(_0x17c6('0x3'));var rs=require(_0x17c6('0x4'));var fs=require('fs');var Redis=require(_0x17c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x17c6('0x6'));var logger=require(_0x17c6('0x7'))(_0x17c6('0x8'));var config=require(_0x17c6('0x9'));var jayson=require(_0x17c6('0xa'));var client=jayson['client'][_0x17c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26a181,_0x497c12,_0x4e871c){return new BPromise(function(_0x4b409a,_0x4899f0){return client[_0x17c6('0xc')](_0x26a181,_0x4e871c)['then'](function(_0x48148){logger[_0x17c6('0xd')](_0x17c6('0xe'),_0x497c12,'request\x20sent');logger[_0x17c6('0xf')]('SAInvoiceDetail,\x20%s,\x20%s,\x20%s',_0x497c12,_0x17c6('0x10'),JSON[_0x17c6('0x11')](_0x48148));if(_0x48148[_0x17c6('0x12')]){if(_0x48148['error'][_0x17c6('0x13')]===0x1f4){logger[_0x17c6('0x12')](_0x17c6('0xe'),_0x497c12,_0x48148['error'][_0x17c6('0x14')]);return _0x4899f0(_0x48148[_0x17c6('0x12')][_0x17c6('0x14')]);}logger[_0x17c6('0x12')]('SAInvoiceDetail,\x20%s,\x20%s',_0x497c12,_0x48148[_0x17c6('0x12')]['message']);return _0x4b409a(_0x48148[_0x17c6('0x12')][_0x17c6('0x14')]);}else{logger['info']('SAInvoiceDetail,\x20%s,\x20%s',_0x497c12,_0x17c6('0x10'));_0x4b409a(_0x48148[_0x17c6('0x15')][_0x17c6('0x14')]);}})['catch'](function(_0x35ba52){logger['error'](_0x17c6('0xe'),_0x497c12,_0x35ba52);_0x4899f0(_0x35ba52);});});} \ No newline at end of file +var _0xa708=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','SAInvoiceDetail,\x20%s,\x20%s','debug','SAInvoiceDetail,\x20%s,\x20%s,\x20%s','code','error','message','result','catch'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xa708,0x7e));var _0x8a70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa708[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a70('0x0'));var util=require(_0x8a70('0x1'));var moment=require(_0x8a70('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a70('0x3'));var fs=require('fs');var Redis=require(_0x8a70('0x4'));var db=require(_0x8a70('0x5'))['db'];var utils=require(_0x8a70('0x6'));var logger=require('../../config/logger')(_0x8a70('0x7'));var config=require(_0x8a70('0x8'));var jayson=require(_0x8a70('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x230653,_0x1e7771,_0x4a57eb){return new BPromise(function(_0x1d4896,_0x4eff08){return client[_0x8a70('0xa')](_0x230653,_0x4a57eb)[_0x8a70('0xb')](function(_0x1eb171){logger[_0x8a70('0xc')](_0x8a70('0xd'),_0x1e7771,'request\x20sent');logger[_0x8a70('0xe')](_0x8a70('0xf'),_0x1e7771,'request\x20sent',JSON['stringify'](_0x1eb171));if(_0x1eb171['error']){if(_0x1eb171['error'][_0x8a70('0x10')]===0x1f4){logger['error']('SAInvoiceDetail,\x20%s,\x20%s',_0x1e7771,_0x1eb171[_0x8a70('0x11')][_0x8a70('0x12')]);return _0x4eff08(_0x1eb171[_0x8a70('0x11')]['message']);}logger[_0x8a70('0x11')](_0x8a70('0xd'),_0x1e7771,_0x1eb171[_0x8a70('0x11')][_0x8a70('0x12')]);return _0x1d4896(_0x1eb171[_0x8a70('0x11')][_0x8a70('0x12')]);}else{logger[_0x8a70('0xc')](_0x8a70('0xd'),_0x1e7771,'request\x20sent');_0x1d4896(_0x1eb171[_0x8a70('0x13')][_0x8a70('0x12')]);}})[_0x8a70('0x14')](function(_0x2ce708){logger[_0x8a70('0x11')](_0x8a70('0xd'),_0x1e7771,_0x2ce708);_0x4eff08(_0x2ce708);});});} \ No newline at end of file diff --git a/server/api/saInvoiceLaw/index.js b/server/api/saInvoiceLaw/index.js index 6dc5acc..bdd9084 100644 --- a/server/api/saInvoiceLaw/index.js +++ b/server/api/saInvoiceLaw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38c8=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x38c8,0x193));var _0x838c=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x38c8[_0x57ee1d];return _0x12a933;};'use strict';var multer=require(_0x838c('0x0'));var util=require(_0x838c('0x1'));var path=require(_0x838c('0x2'));var timeout=require(_0x838c('0x3'));var express=require(_0x838c('0x4'));var router=express[_0x838c('0x5')]();var auth=require(_0x838c('0x6'));var interaction=require(_0x838c('0x7'));var config=require(_0x838c('0x8'));var controller=require('./saInvoiceLaw.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x838c('0x9')](_0x838c('0xa'),auth[_0x838c('0xb')](),controller[_0x838c('0xc')]);router['get'](_0x838c('0xd'),auth[_0x838c('0xb')](),controller['show']);router['post']('/',auth[_0x838c('0xb')](),controller[_0x838c('0xe')]);router[_0x838c('0xf')]('/:id',auth[_0x838c('0xb')](),controller[_0x838c('0x10')]);router[_0x838c('0x11')]('/:id',auth[_0x838c('0xb')](),controller['destroy']);module[_0x838c('0x12')]=router; \ No newline at end of file +var _0x95d5=['Router','../../config/environment','./saInvoiceLaw.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','path','express'];(function(_0x492a0e,_0x404684){var _0x315ed9=function(_0x1b7903){while(--_0x1b7903){_0x492a0e['push'](_0x492a0e['shift']());}};_0x315ed9(++_0x404684);}(_0x95d5,0x15e));var _0x595d=function(_0xbc86fc,_0x1bb24d){_0xbc86fc=_0xbc86fc-0x0;var _0x549976=_0x95d5[_0xbc86fc];return _0x549976;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x595d('0x0'));var timeout=require('connect-timeout');var express=require(_0x595d('0x1'));var router=express[_0x595d('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x595d('0x3'));var controller=require(_0x595d('0x4'));router[_0x595d('0x5')]('/',auth[_0x595d('0x6')](),controller['index']);router[_0x595d('0x5')](_0x595d('0x7'),auth[_0x595d('0x6')](),controller[_0x595d('0x8')]);router[_0x595d('0x5')](_0x595d('0x9'),auth[_0x595d('0x6')](),controller[_0x595d('0xa')]);router[_0x595d('0xb')]('/',auth[_0x595d('0x6')](),controller[_0x595d('0xc')]);router['put'](_0x595d('0x9'),auth['isAuthenticated'](),controller[_0x595d('0xd')]);router[_0x595d('0xe')]('/:id',auth[_0x595d('0x6')](),controller['destroy']);module[_0x595d('0xf')]=router; \ No newline at end of file diff --git a/server/api/saInvoiceLaw/saInvoiceLaw.attributes.js b/server/api/saInvoiceLaw/saInvoiceLaw.attributes.js index ceb2d0e..a36d54b 100644 --- a/server/api/saInvoiceLaw/saInvoiceLaw.attributes.js +++ b/server/api/saInvoiceLaw/saInvoiceLaw.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81e1=['name','exports','STRING'];(function(_0x776ece,_0x2a02fa){var _0x47e56f=function(_0x5419c8){while(--_0x5419c8){_0x776ece['push'](_0x776ece['shift']());}};_0x47e56f(++_0x2a02fa);}(_0x81e1,0xf7));var _0x181e=function(_0x112904,_0x2573f5){_0x112904=_0x112904-0x0;var _0x3fd120=_0x81e1[_0x112904];return _0x3fd120;};'use strict';var Sequelize=require('sequelize');module[_0x181e('0x0')]={'name':{'type':Sequelize[_0x181e('0x1')],'allowNull':![],'unique':_0x181e('0x2')}}; \ No newline at end of file +var _0xb489=['name','sequelize','exports','STRING'];(function(_0x599aaf,_0x3d3622){var _0xd995f3=function(_0x19825e){while(--_0x19825e){_0x599aaf['push'](_0x599aaf['shift']());}};_0xd995f3(++_0x3d3622);}(_0xb489,0x95));var _0x9b48=function(_0x2f0fb1,_0x291a87){_0x2f0fb1=_0x2f0fb1-0x0;var _0x404a09=_0xb489[_0x2f0fb1];return _0x404a09;};'use strict';var Sequelize=require(_0x9b48('0x0'));module[_0x9b48('0x1')]={'name':{'type':Sequelize[_0x9b48('0x2')],'allowNull':![],'unique':_0x9b48('0x3')}}; \ No newline at end of file diff --git a/server/api/saInvoiceLaw/saInvoiceLaw.controller.js b/server/api/saInvoiceLaw/saInvoiceLaw.controller.js index cf9c4e9..06f9653 100644 --- a/server/api/saInvoiceLaw/saInvoiceLaw.controller.js +++ b/server/api/saInvoiceLaw/saInvoiceLaw.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c41=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','stack','name','send','SAInvoiceLaw','rawAttributes','model','keys'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x0c41,0xf9));var _0x10c4=function(_0x1eea0c,_0x1242eb){_0x1eea0c=_0x1eea0c-0x0;var _0x13a1ef=_0x0c41[_0x1eea0c];return _0x13a1ef;};'use strict';var pdf=require(_0x10c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x10c4('0x1'));var zipdir=require(_0x10c4('0x2'));var jsonpatch=require(_0x10c4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x10c4('0x4'));var util=require(_0x10c4('0x5'));var path=require(_0x10c4('0x6'));var sox=require(_0x10c4('0x7'));var csv=require(_0x10c4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x10c4('0x9'));var squel=require(_0x10c4('0xa'));var crypto=require(_0x10c4('0xb'));var jsforce=require(_0x10c4('0xc'));var deskjs=require(_0x10c4('0xd'));var toCsv=require(_0x10c4('0x8'));var querystring=require(_0x10c4('0xe'));var Papa=require(_0x10c4('0xf'));var Redis=require('ioredis');var authService=require(_0x10c4('0x10'));var qs=require(_0x10c4('0x11'));var hardwareService=require(_0x10c4('0x12'));var logger=require(_0x10c4('0x13'))(_0x10c4('0x14'));var utils=require(_0x10c4('0x15'));var config=require(_0x10c4('0x16'));var db=require(_0x10c4('0x17'))['db'];function respondWithStatusCode(_0x6c27e1,_0x5eac29){_0x5eac29=_0x5eac29||0xcc;return function(_0x31a03b){if(_0x31a03b){return _0x6c27e1[_0x10c4('0x18')](_0x5eac29);}return _0x6c27e1[_0x10c4('0x19')](_0x5eac29)[_0x10c4('0x1a')]();};}function respondWithResult(_0x28f861,_0x4097fe){_0x4097fe=_0x4097fe||0xc8;return function(_0x1b29e6){if(_0x1b29e6){return _0x28f861[_0x10c4('0x19')](_0x4097fe)[_0x10c4('0x1b')](_0x1b29e6);}};}function respondWithFilteredResult(_0x5ea321,_0x2b44ed){return function(_0x528e14){if(_0x528e14){var _0x1329f5=_0x528e14[_0x10c4('0x1c')],_0x19c4a7=_0x2b44ed[_0x10c4('0x1d')],_0xab6340=_0x2b44ed['offset']+_0x2b44ed[_0x10c4('0x1e')],_0x1b9157;if(_0xab6340>=_0x1329f5){_0xab6340=_0x1329f5;_0x1b9157=0xc8;}else{_0x1b9157=0xce;}_0x5ea321[_0x10c4('0x19')](_0x1b9157);return _0x5ea321[_0x10c4('0x1f')](_0x10c4('0x20'),_0x19c4a7+'-'+_0xab6340+'/'+_0x1329f5)[_0x10c4('0x1b')](_0x528e14);}return null;};}function patchUpdates(_0x5eda8d){return function(_0x224a70){try{jsonpatch['apply'](_0x224a70,_0x5eda8d,!![]);}catch(_0x4dbe8c){return BPromise['reject'](_0x4dbe8c);}return _0x224a70[_0x10c4('0x21')]();};}function saveUpdates(_0x2781bd,_0xfdc804){return function(_0x2cd3e4){if(_0x2cd3e4){return _0x2cd3e4['update'](_0x2781bd)[_0x10c4('0x22')](function(_0x41b21d){return _0x41b21d;});}return null;};}function removeEntity(_0x1acfbd,_0x18bc4c){return function(_0x46e8be){if(_0x46e8be){return _0x46e8be[_0x10c4('0x23')]()[_0x10c4('0x22')](function(){_0x1acfbd['status'](0xcc)[_0x10c4('0x1a')]();});}};}function handleEntityNotFound(_0x23377d,_0x35dcb1){return function(_0x25d764){if(!_0x25d764){_0x23377d[_0x10c4('0x18')](0x194);}return _0x25d764;};}function handleError(_0x1c062d,_0xe81d8b){_0xe81d8b=_0xe81d8b||0x1f4;return function(_0x27fe66){logger['error'](_0x27fe66[_0x10c4('0x24')]);if(_0x27fe66['name']){delete _0x27fe66[_0x10c4('0x25')];}_0x1c062d[_0x10c4('0x19')](_0xe81d8b)[_0x10c4('0x26')](_0x27fe66);};}exports['index']=function(_0x59f433,_0x528741){var _0x52ced6={},_0x5c5cd0={},_0x276e24={'count':0x0,'rows':[]};var _0x26e8c5=db[_0x10c4('0x27')][_0x10c4('0x28')];_0x5c5cd0[_0x10c4('0x29')]=_[_0x10c4('0x2a')](_0x26e8c5);_0x5c5cd0[_0x10c4('0x2b')]=_['keys'](_0x59f433['query']);_0x5c5cd0[_0x10c4('0x2c')]=_[_0x10c4('0x2d')](_0x5c5cd0[_0x10c4('0x29')],_0x5c5cd0[_0x10c4('0x2b')]);_0x52ced6[_0x10c4('0x2e')]=_[_0x10c4('0x2d')](_0x5c5cd0['model'],qs[_0x10c4('0x2f')](_0x59f433[_0x10c4('0x2b')]['fields']));_0x52ced6[_0x10c4('0x2e')]=_0x52ced6[_0x10c4('0x2e')][_0x10c4('0x30')]?_0x52ced6['attributes']:_0x5c5cd0[_0x10c4('0x29')];if(!_0x59f433['query'][_0x10c4('0x31')](_0x10c4('0x32'))){_0x52ced6['limit']=qs['limit'](_0x59f433[_0x10c4('0x2b')]['limit']);_0x52ced6[_0x10c4('0x1d')]=qs[_0x10c4('0x1d')](_0x59f433['query']['offset']);}_0x52ced6[_0x10c4('0x33')]=qs[_0x10c4('0x34')](_0x59f433[_0x10c4('0x2b')][_0x10c4('0x34')]);_0x52ced6[_0x10c4('0x35')]=qs[_0x10c4('0x2c')](_[_0x10c4('0x36')](_0x59f433['query'],_0x5c5cd0[_0x10c4('0x2c')]));if(_0x59f433[_0x10c4('0x2b')][_0x10c4('0x37')]){_0x52ced6[_0x10c4('0x35')]=_[_0x10c4('0x38')](_0x52ced6['where'],{'$or':_[_0x10c4('0x39')](_0x26e8c5,function(_0x385e3b){if(_0x385e3b['type'][_0x10c4('0x3a')]!==_0x10c4('0x3b')){var _0x2bced2={};_0x2bced2[_0x385e3b[_0x10c4('0x3c')]]={'$like':'%'+_0x59f433[_0x10c4('0x2b')][_0x10c4('0x37')]+'%'};return _0x2bced2;}})});}_0x52ced6=_[_0x10c4('0x38')]({},_0x52ced6,_0x59f433[_0x10c4('0x3d')]);var _0x5e4c7f={'where':_0x52ced6[_0x10c4('0x35')]};return db[_0x10c4('0x27')]['count'](_0x5e4c7f)['then'](function(_0x1b3930){_0x276e24[_0x10c4('0x1c')]=_0x1b3930;if(_0x59f433[_0x10c4('0x2b')][_0x10c4('0x3e')]){_0x52ced6[_0x10c4('0x3f')]=[{'all':!![]}];}return db['SAInvoiceLaw'][_0x10c4('0x40')](_0x52ced6);})['then'](function(_0x59863c){_0x276e24[_0x10c4('0x41')]=_0x59863c;return _0x276e24;})[_0x10c4('0x22')](respondWithFilteredResult(_0x528741,_0x52ced6))[_0x10c4('0x42')](handleError(_0x528741,null));};exports['show']=function(_0x17c098,_0x1eab5a){var _0x36106d={'raw':![],'where':{'id':_0x17c098[_0x10c4('0x43')]['id']}},_0x122488={};_0x122488['model']=_[_0x10c4('0x2a')](db[_0x10c4('0x27')][_0x10c4('0x28')]);_0x122488[_0x10c4('0x2b')]=_[_0x10c4('0x2a')](_0x17c098['query']);_0x122488[_0x10c4('0x2c')]=_[_0x10c4('0x2d')](_0x122488[_0x10c4('0x29')],_0x122488[_0x10c4('0x2b')]);_0x36106d[_0x10c4('0x2e')]=_['intersection'](_0x122488[_0x10c4('0x29')],qs['fields'](_0x17c098['query'][_0x10c4('0x2f')]));_0x36106d[_0x10c4('0x2e')]=_0x36106d[_0x10c4('0x2e')]['length']?_0x36106d[_0x10c4('0x2e')]:_0x122488[_0x10c4('0x29')];if(_0x17c098[_0x10c4('0x2b')][_0x10c4('0x3e')]){_0x36106d['include']=[{'all':!![]}];}_0x36106d=_[_0x10c4('0x38')]({},_0x36106d,_0x17c098[_0x10c4('0x3d')]);return db['SAInvoiceLaw'][_0x10c4('0x44')](_0x36106d)[_0x10c4('0x22')](handleEntityNotFound(_0x1eab5a,null))[_0x10c4('0x22')](respondWithResult(_0x1eab5a,null))[_0x10c4('0x42')](handleError(_0x1eab5a,null));};exports[_0x10c4('0x45')]=function(_0x1997d9,_0x45a45b){return db[_0x10c4('0x27')][_0x10c4('0x45')](_0x1997d9[_0x10c4('0x46')],{})[_0x10c4('0x22')](respondWithResult(_0x45a45b,0xc9))[_0x10c4('0x42')](handleError(_0x45a45b,null));};exports[_0x10c4('0x47')]=function(_0x279c1c,_0x289752){if(_0x279c1c['body']['id']){delete _0x279c1c[_0x10c4('0x46')]['id'];}return db[_0x10c4('0x27')][_0x10c4('0x44')]({'where':{'id':_0x279c1c[_0x10c4('0x43')]['id']}})['then'](handleEntityNotFound(_0x289752,null))[_0x10c4('0x22')](saveUpdates(_0x279c1c['body'],null))[_0x10c4('0x22')](respondWithResult(_0x289752,null))[_0x10c4('0x42')](handleError(_0x289752,null));};exports[_0x10c4('0x23')]=function(_0x4b39d6,_0x484590){return db[_0x10c4('0x27')][_0x10c4('0x44')]({'where':{'id':_0x4b39d6[_0x10c4('0x43')]['id']}})[_0x10c4('0x22')](handleEntityNotFound(_0x484590,null))[_0x10c4('0x22')](removeEntity(_0x484590,null))['catch'](handleError(_0x484590,null));};exports[_0x10c4('0x48')]=function(_0x471cc0,_0x2b4590){return db[_0x10c4('0x27')][_0x10c4('0x48')]()[_0x10c4('0x22')](respondWithResult(_0x2b4590,null))[_0x10c4('0x42')](handleError(_0x2b4590,null));}; \ No newline at end of file +var _0x356e=['reject','save','update','destroy','then','end','error','stack','name','send','index','SAInvoiceLaw','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','field','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','status','json','count','offset','limit','set','apply'];(function(_0x573ded,_0x227028){var _0x1dbb15=function(_0x2f6cb8){while(--_0x2f6cb8){_0x573ded['push'](_0x573ded['shift']());}};_0x1dbb15(++_0x227028);}(_0x356e,0x1dc));var _0xe356=function(_0x1bcf5b,_0xd5637f){_0x1bcf5b=_0x1bcf5b-0x0;var _0x352544=_0x356e[_0x1bcf5b];return _0x352544;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe356('0x0'));var zipdir=require(_0xe356('0x1'));var jsonpatch=require(_0xe356('0x2'));var rp=require(_0xe356('0x3'));var moment=require(_0xe356('0x4'));var BPromise=require(_0xe356('0x5'));var Mustache=require('mustache');var util=require(_0xe356('0x6'));var path=require(_0xe356('0x7'));var sox=require(_0xe356('0x8'));var csv=require(_0xe356('0x9'));var ejs=require(_0xe356('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe356('0xb'));var crypto=require(_0xe356('0xc'));var jsforce=require(_0xe356('0xd'));var deskjs=require(_0xe356('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe356('0xf'));var Papa=require(_0xe356('0x10'));var Redis=require('ioredis');var authService=require(_0xe356('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xe356('0x12'));var logger=require(_0xe356('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe356('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49ab1d,_0x25de51){_0x25de51=_0x25de51||0xcc;return function(_0x5a6f54){if(_0x5a6f54){return _0x49ab1d['sendStatus'](_0x25de51);}return _0x49ab1d[_0xe356('0x15')](_0x25de51)['end']();};}function respondWithResult(_0x4ee14e,_0x5e40df){_0x5e40df=_0x5e40df||0xc8;return function(_0x582c8e){if(_0x582c8e){return _0x4ee14e[_0xe356('0x15')](_0x5e40df)[_0xe356('0x16')](_0x582c8e);}};}function respondWithFilteredResult(_0x489a5b,_0x2b3208){return function(_0x319243){if(_0x319243){var _0x1aa9b3=_0x319243[_0xe356('0x17')],_0x934016=_0x2b3208[_0xe356('0x18')],_0x56e289=_0x2b3208[_0xe356('0x18')]+_0x2b3208[_0xe356('0x19')],_0x461976;if(_0x56e289>=_0x1aa9b3){_0x56e289=_0x1aa9b3;_0x461976=0xc8;}else{_0x461976=0xce;}_0x489a5b[_0xe356('0x15')](_0x461976);return _0x489a5b[_0xe356('0x1a')]('Content-Range',_0x934016+'-'+_0x56e289+'/'+_0x1aa9b3)['json'](_0x319243);}return null;};}function patchUpdates(_0x444880){return function(_0x2d1935){try{jsonpatch[_0xe356('0x1b')](_0x2d1935,_0x444880,!![]);}catch(_0x32f4e1){return BPromise[_0xe356('0x1c')](_0x32f4e1);}return _0x2d1935[_0xe356('0x1d')]();};}function saveUpdates(_0x1635d6,_0x3607d0){return function(_0x128976){if(_0x128976){return _0x128976[_0xe356('0x1e')](_0x1635d6)['then'](function(_0x17c17b){return _0x17c17b;});}return null;};}function removeEntity(_0xa086a9,_0x169439){return function(_0x3f08f1){if(_0x3f08f1){return _0x3f08f1[_0xe356('0x1f')]()[_0xe356('0x20')](function(){_0xa086a9[_0xe356('0x15')](0xcc)[_0xe356('0x21')]();});}};}function handleEntityNotFound(_0x3f2c47,_0xd444b6){return function(_0x178336){if(!_0x178336){_0x3f2c47['sendStatus'](0x194);}return _0x178336;};}function handleError(_0x12dce5,_0x2d9f9a){_0x2d9f9a=_0x2d9f9a||0x1f4;return function(_0x4cf853){logger[_0xe356('0x22')](_0x4cf853[_0xe356('0x23')]);if(_0x4cf853[_0xe356('0x24')]){delete _0x4cf853['name'];}_0x12dce5['status'](_0x2d9f9a)[_0xe356('0x25')](_0x4cf853);};}exports[_0xe356('0x26')]=function(_0x345775,_0x1aaa5c){var _0x5b32e0={},_0x1e1cef={},_0x5ab65f={'count':0x0,'rows':[]};var _0x4b9fdd=db[_0xe356('0x27')]['rawAttributes'];_0x1e1cef['model']=_['keys'](_0x4b9fdd);_0x1e1cef[_0xe356('0x28')]=_['keys'](_0x345775[_0xe356('0x28')]);_0x1e1cef[_0xe356('0x29')]=_[_0xe356('0x2a')](_0x1e1cef[_0xe356('0x2b')],_0x1e1cef[_0xe356('0x28')]);_0x5b32e0['attributes']=_[_0xe356('0x2a')](_0x1e1cef[_0xe356('0x2b')],qs[_0xe356('0x2c')](_0x345775[_0xe356('0x28')][_0xe356('0x2c')]));_0x5b32e0[_0xe356('0x2d')]=_0x5b32e0['attributes'][_0xe356('0x2e')]?_0x5b32e0[_0xe356('0x2d')]:_0x1e1cef[_0xe356('0x2b')];if(!_0x345775['query'][_0xe356('0x2f')](_0xe356('0x30'))){_0x5b32e0[_0xe356('0x19')]=qs[_0xe356('0x19')](_0x345775[_0xe356('0x28')][_0xe356('0x19')]);_0x5b32e0['offset']=qs[_0xe356('0x18')](_0x345775['query'][_0xe356('0x18')]);}_0x5b32e0[_0xe356('0x31')]=qs[_0xe356('0x32')](_0x345775[_0xe356('0x28')][_0xe356('0x32')]);_0x5b32e0[_0xe356('0x33')]=qs['filters'](_[_0xe356('0x34')](_0x345775['query'],_0x1e1cef[_0xe356('0x29')]));if(_0x345775['query']['filter']){_0x5b32e0[_0xe356('0x33')]=_[_0xe356('0x35')](_0x5b32e0['where'],{'$or':_[_0xe356('0x36')](_0x4b9fdd,function(_0x2b30ce){if(_0x2b30ce[_0xe356('0x37')][_0xe356('0x38')]!=='VIRTUAL'){var _0x2b65cc={};_0x2b65cc[_0x2b30ce[_0xe356('0x39')]]={'$like':'%'+_0x345775[_0xe356('0x28')]['filter']+'%'};return _0x2b65cc;}})});}_0x5b32e0=_[_0xe356('0x35')]({},_0x5b32e0,_0x345775['options']);var _0x707050={'where':_0x5b32e0[_0xe356('0x33')]};return db[_0xe356('0x27')]['count'](_0x707050)[_0xe356('0x20')](function(_0x5da513){_0x5ab65f[_0xe356('0x17')]=_0x5da513;if(_0x345775[_0xe356('0x28')][_0xe356('0x3a')]){_0x5b32e0['include']=[{'all':!![]}];}return db[_0xe356('0x27')][_0xe356('0x3b')](_0x5b32e0);})['then'](function(_0x5356ce){_0x5ab65f[_0xe356('0x3c')]=_0x5356ce;return _0x5ab65f;})[_0xe356('0x20')](respondWithFilteredResult(_0x1aaa5c,_0x5b32e0))[_0xe356('0x3d')](handleError(_0x1aaa5c,null));};exports[_0xe356('0x3e')]=function(_0xa9dfc,_0x31ceb5){var _0x1bddaf={'raw':![],'where':{'id':_0xa9dfc[_0xe356('0x3f')]['id']}},_0x1254c6={};_0x1254c6[_0xe356('0x2b')]=_[_0xe356('0x40')](db['SAInvoiceLaw'][_0xe356('0x41')]);_0x1254c6['query']=_[_0xe356('0x40')](_0xa9dfc['query']);_0x1254c6[_0xe356('0x29')]=_[_0xe356('0x2a')](_0x1254c6[_0xe356('0x2b')],_0x1254c6[_0xe356('0x28')]);_0x1bddaf['attributes']=_[_0xe356('0x2a')](_0x1254c6['model'],qs[_0xe356('0x2c')](_0xa9dfc[_0xe356('0x28')][_0xe356('0x2c')]));_0x1bddaf[_0xe356('0x2d')]=_0x1bddaf[_0xe356('0x2d')][_0xe356('0x2e')]?_0x1bddaf[_0xe356('0x2d')]:_0x1254c6[_0xe356('0x2b')];if(_0xa9dfc[_0xe356('0x28')]['includeAll']){_0x1bddaf[_0xe356('0x42')]=[{'all':!![]}];}_0x1bddaf=_['merge']({},_0x1bddaf,_0xa9dfc[_0xe356('0x43')]);return db[_0xe356('0x27')]['find'](_0x1bddaf)[_0xe356('0x20')](handleEntityNotFound(_0x31ceb5,null))[_0xe356('0x20')](respondWithResult(_0x31ceb5,null))[_0xe356('0x3d')](handleError(_0x31ceb5,null));};exports[_0xe356('0x44')]=function(_0xe48326,_0x404afc){return db[_0xe356('0x27')][_0xe356('0x44')](_0xe48326['body'],{})['then'](respondWithResult(_0x404afc,0xc9))[_0xe356('0x3d')](handleError(_0x404afc,null));};exports['update']=function(_0x15d680,_0x1bfeea){if(_0x15d680[_0xe356('0x45')]['id']){delete _0x15d680[_0xe356('0x45')]['id'];}return db[_0xe356('0x27')]['find']({'where':{'id':_0x15d680['params']['id']}})[_0xe356('0x20')](handleEntityNotFound(_0x1bfeea,null))[_0xe356('0x20')](saveUpdates(_0x15d680['body'],null))[_0xe356('0x20')](respondWithResult(_0x1bfeea,null))[_0xe356('0x3d')](handleError(_0x1bfeea,null));};exports[_0xe356('0x1f')]=function(_0x169e7a,_0x18df06){return db['SAInvoiceLaw'][_0xe356('0x46')]({'where':{'id':_0x169e7a[_0xe356('0x3f')]['id']}})[_0xe356('0x20')](handleEntityNotFound(_0x18df06,null))['then'](removeEntity(_0x18df06,null))[_0xe356('0x3d')](handleError(_0x18df06,null));};exports[_0xe356('0x47')]=function(_0x2a3206,_0x105339){return db['SAInvoiceLaw'][_0xe356('0x47')]()[_0xe356('0x20')](respondWithResult(_0x105339,null))[_0xe356('0x3d')](handleError(_0x105339,null));}; \ No newline at end of file diff --git a/server/api/saInvoiceLaw/saInvoiceLaw.model.js b/server/api/saInvoiceLaw/saInvoiceLaw.model.js index 6679f1c..db0e37c 100644 --- a/server/api/saInvoiceLaw/saInvoiceLaw.model.js +++ b/server/api/saInvoiceLaw/saInvoiceLaw.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','SAInvoiceLaw','sa_invoice_laws','lodash'];(function(_0x408d9b,_0x4b06f1){var _0x2a0d38=function(_0x1a4227){while(--_0x1a4227){_0x408d9b['push'](_0x408d9b['shift']());}};_0x2a0d38(++_0x4b06f1);}(_0xa571,0x107));var _0x1a57=function(_0x4f6afe,_0x44a4ff){_0x4f6afe=_0x4f6afe-0x0;var _0x5256f8=_0xa571[_0x4f6afe];return _0x5256f8;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./saInvoiceLaw.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9348=['../../config/environment','./saInvoiceLaw.attributes','exports','define','sa_invoice_laws','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2508c9,_0x3dc064){var _0x48d73e=function(_0x1e67b1){while(--_0x1e67b1){_0x2508c9['push'](_0x2508c9['shift']());}};_0x48d73e(++_0x3dc064);}(_0x9348,0x10d));var _0x8934=function(_0x164098,_0x37c47d){_0x164098=_0x164098-0x0;var _0x386a0d=_0x9348[_0x164098];return _0x386a0d;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('SAInvoiceLaw',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saInvoiceLaw/saInvoiceLaw.rpc.js b/server/api/saInvoiceLaw/saInvoiceLaw.rpc.js index 22767cd..ea5c6df 100644 --- a/server/api/saInvoiceLaw/saInvoiceLaw.rpc.js +++ b/server/api/saInvoiceLaw/saInvoiceLaw.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaad=['SAInvoiceLaw,\x20%s,\x20%s','request\x20sent','SAInvoiceLaw,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfaad,0x159));var _0xdfaa=function(_0x4e122b,_0x24ae5c){_0x4e122b=_0x4e122b-0x0;var _0x2ad450=_0xfaad[_0x4e122b];return _0x2ad450;};'use strict';var _=require(_0xdfaa('0x0'));var util=require('util');var moment=require(_0xdfaa('0x1'));var BPromise=require(_0xdfaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfaa('0x3'));var db=require(_0xdfaa('0x4'))['db'];var utils=require(_0xdfaa('0x5'));var logger=require(_0xdfaa('0x6'))('rpc');var config=require(_0xdfaa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdfaa('0x8')][_0xdfaa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x494ba4,_0x1809d9,_0x11cf32){return new BPromise(function(_0x58e737,_0x14c874){return client[_0xdfaa('0xa')](_0x494ba4,_0x11cf32)['then'](function(_0x134102){logger[_0xdfaa('0xb')](_0xdfaa('0xc'),_0x1809d9,_0xdfaa('0xd'));logger['debug'](_0xdfaa('0xe'),_0x1809d9,'request\x20sent',JSON[_0xdfaa('0xf')](_0x134102));if(_0x134102[_0xdfaa('0x10')]){if(_0x134102[_0xdfaa('0x10')][_0xdfaa('0x11')]===0x1f4){logger[_0xdfaa('0x10')]('SAInvoiceLaw,\x20%s,\x20%s',_0x1809d9,_0x134102['error']['message']);return _0x14c874(_0x134102['error']['message']);}logger[_0xdfaa('0x10')](_0xdfaa('0xc'),_0x1809d9,_0x134102[_0xdfaa('0x10')][_0xdfaa('0x12')]);return _0x58e737(_0x134102[_0xdfaa('0x10')][_0xdfaa('0x12')]);}else{logger[_0xdfaa('0xb')](_0xdfaa('0xc'),_0x1809d9,_0xdfaa('0xd'));_0x58e737(_0x134102[_0xdfaa('0x13')]['message']);}})[_0xdfaa('0x14')](function(_0x761134){logger[_0xdfaa('0x10')](_0xdfaa('0xc'),_0x1809d9,_0x761134);_0x14c874(_0x761134);});});} \ No newline at end of file +var _0xeaa5=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SAInvoiceLaw,\x20%s,\x20%s','request\x20sent','debug','SAInvoiceLaw,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x330900,_0x1c8c84){var _0x1257e4=function(_0x15fd56){while(--_0x15fd56){_0x330900['push'](_0x330900['shift']());}};_0x1257e4(++_0x1c8c84);}(_0xeaa5,0x9f));var _0x5eaa=function(_0x4be1ba,_0x2a20bf){_0x4be1ba=_0x4be1ba-0x0;var _0x171072=_0xeaa5[_0x4be1ba];return _0x171072;};'use strict';var _=require(_0x5eaa('0x0'));var util=require(_0x5eaa('0x1'));var moment=require(_0x5eaa('0x2'));var BPromise=require(_0x5eaa('0x3'));var rs=require(_0x5eaa('0x4'));var fs=require('fs');var Redis=require(_0x5eaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5eaa('0x6'));var logger=require(_0x5eaa('0x7'))(_0x5eaa('0x8'));var config=require(_0x5eaa('0x9'));var jayson=require(_0x5eaa('0xa'));var client=jayson[_0x5eaa('0xb')][_0x5eaa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12cc54,_0x4616c7,_0x179279){return new BPromise(function(_0x12fc18,_0x33c833){return client[_0x5eaa('0xd')](_0x12cc54,_0x179279)['then'](function(_0x1626c2){logger[_0x5eaa('0xe')](_0x5eaa('0xf'),_0x4616c7,_0x5eaa('0x10'));logger[_0x5eaa('0x11')](_0x5eaa('0x12'),_0x4616c7,_0x5eaa('0x10'),JSON['stringify'](_0x1626c2));if(_0x1626c2[_0x5eaa('0x13')]){if(_0x1626c2[_0x5eaa('0x13')][_0x5eaa('0x14')]===0x1f4){logger[_0x5eaa('0x13')](_0x5eaa('0xf'),_0x4616c7,_0x1626c2['error']['message']);return _0x33c833(_0x1626c2[_0x5eaa('0x13')][_0x5eaa('0x15')]);}logger['error'](_0x5eaa('0xf'),_0x4616c7,_0x1626c2[_0x5eaa('0x13')][_0x5eaa('0x15')]);return _0x12fc18(_0x1626c2['error'][_0x5eaa('0x15')]);}else{logger[_0x5eaa('0xe')](_0x5eaa('0xf'),_0x4616c7,_0x5eaa('0x10'));_0x12fc18(_0x1626c2['result'][_0x5eaa('0x15')]);}})[_0x5eaa('0x16')](function(_0x4a9a5e){logger[_0x5eaa('0x13')](_0x5eaa('0xf'),_0x4616c7,_0x4a9a5e);_0x33c833(_0x4a9a5e);});});} \ No newline at end of file diff --git a/server/api/saInvoiceNumber/index.js b/server/api/saInvoiceNumber/index.js index 49eba67..7d9f411 100644 --- a/server/api/saInvoiceNumber/index.js +++ b/server/api/saInvoiceNumber/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa552=['describe','/:id','show','post','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./saInvoiceNumber.controller','get','isAuthenticated','index','/describe'];(function(_0x1e6490,_0x5d3c24){var _0x30d349=function(_0x50bc7b){while(--_0x50bc7b){_0x1e6490['push'](_0x1e6490['shift']());}};_0x30d349(++_0x5d3c24);}(_0xa552,0x67));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a55('0x0'));var timeout=require(_0x2a55('0x1'));var express=require(_0x2a55('0x2'));var router=express['Router']();var auth=require(_0x2a55('0x3'));var interaction=require(_0x2a55('0x4'));var config=require(_0x2a55('0x5'));var controller=require(_0x2a55('0x6'));router[_0x2a55('0x7')]('/',auth[_0x2a55('0x8')](),controller[_0x2a55('0x9')]);router['get'](_0x2a55('0xa'),auth[_0x2a55('0x8')](),controller[_0x2a55('0xb')]);router[_0x2a55('0x7')](_0x2a55('0xc'),auth[_0x2a55('0x8')](),controller[_0x2a55('0xd')]);router[_0x2a55('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2a55('0xf')]);router[_0x2a55('0x10')](_0x2a55('0xc'),auth[_0x2a55('0x8')](),controller[_0x2a55('0x11')]);module[_0x2a55('0x12')]=router; \ No newline at end of file +var _0xa888=['../../components/interaction/service','../../config/environment','./saInvoiceNumber.controller','index','/describe','isAuthenticated','describe','get','show','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xa888,0x18c));var _0x8a88=function(_0x4fefbd,_0x22c958){_0x4fefbd=_0x4fefbd-0x0;var _0x32f069=_0xa888[_0x4fefbd];return _0x32f069;};'use strict';var multer=require('multer');var util=require(_0x8a88('0x0'));var path=require(_0x8a88('0x1'));var timeout=require(_0x8a88('0x2'));var express=require(_0x8a88('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8a88('0x4'));var config=require(_0x8a88('0x5'));var controller=require(_0x8a88('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a88('0x7')]);router['get'](_0x8a88('0x8'),auth[_0x8a88('0x9')](),controller[_0x8a88('0xa')]);router[_0x8a88('0xb')]('/:id',auth[_0x8a88('0x9')](),controller[_0x8a88('0xc')]);router[_0x8a88('0xd')]('/',auth[_0x8a88('0x9')](),controller['create']);router[_0x8a88('0xe')](_0x8a88('0xf'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x10')]);router[_0x8a88('0x11')](_0x8a88('0xf'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x12')]);module[_0x8a88('0x13')]=router; \ No newline at end of file diff --git a/server/api/saInvoiceNumber/saInvoiceNumber.attributes.js b/server/api/saInvoiceNumber/saInvoiceNumber.attributes.js index 7d2353c..261001a 100644 --- a/server/api/saInvoiceNumber/saInvoiceNumber.attributes.js +++ b/server/api/saInvoiceNumber/saInvoiceNumber.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a97=['exports','INTEGER','sequelize'];(function(_0x415005,_0x595685){var _0x50002f=function(_0x68b2a2){while(--_0x68b2a2){_0x415005['push'](_0x415005['shift']());}};_0x50002f(++_0x595685);}(_0x0a97,0x1be));var _0x70a9=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x0a97[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require(_0x70a9('0x0'));module[_0x70a9('0x1')]={'year':{'type':Sequelize['INTEGER']},'number':{'type':Sequelize[_0x70a9('0x2')]}}; \ No newline at end of file +var _0x84f4=['sequelize','exports','INTEGER'];(function(_0x44f5ff,_0x597705){var _0x4df861=function(_0x2ea070){while(--_0x2ea070){_0x44f5ff['push'](_0x44f5ff['shift']());}};_0x4df861(++_0x597705);}(_0x84f4,0x1d7));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x484f('0x0'));module[_0x484f('0x1')]={'year':{'type':Sequelize[_0x484f('0x2')]},'number':{'type':Sequelize[_0x484f('0x2')]}}; \ No newline at end of file diff --git a/server/api/saInvoiceNumber/saInvoiceNumber.controller.js b/server/api/saInvoiceNumber/saInvoiceNumber.controller.js index 5f77171..a8b6319 100644 --- a/server/api/saInvoiceNumber/saInvoiceNumber.controller.js +++ b/server/api/saInvoiceNumber/saInvoiceNumber.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2c4=['stack','name','send','SAInvoiceNumber','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','key','VIRTUAL','merge','options','then','include','catch','show','params','rawAttributes','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','save','update','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb2c4,0x176));var _0x4b2c=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xb2c4[_0x3c51d4];return _0x53c45f;};'use strict';var pdf=require(_0x4b2c('0x0'));var emlformat=require(_0x4b2c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b2c('0x2'));var jsonpatch=require(_0x4b2c('0x3'));var rp=require(_0x4b2c('0x4'));var moment=require(_0x4b2c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4b2c('0x6'));var path=require(_0x4b2c('0x7'));var sox=require(_0x4b2c('0x8'));var csv=require(_0x4b2c('0x9'));var ejs=require(_0x4b2c('0xa'));var fs=require('fs');var _=require(_0x4b2c('0xb'));var squel=require(_0x4b2c('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b2c('0xd'));var deskjs=require(_0x4b2c('0xe'));var toCsv=require(_0x4b2c('0x9'));var querystring=require(_0x4b2c('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b2c('0x10'));var authService=require(_0x4b2c('0x11'));var qs=require(_0x4b2c('0x12'));var hardwareService=require(_0x4b2c('0x13'));var logger=require(_0x4b2c('0x14'))(_0x4b2c('0x15'));var utils=require('../../config/utils');var config=require(_0x4b2c('0x16'));var db=require(_0x4b2c('0x17'))['db'];function respondWithStatusCode(_0x341ee8,_0xdbae79){_0xdbae79=_0xdbae79||0xcc;return function(_0x2c5609){if(_0x2c5609){return _0x341ee8[_0x4b2c('0x18')](_0xdbae79);}return _0x341ee8[_0x4b2c('0x19')](_0xdbae79)[_0x4b2c('0x1a')]();};}function respondWithResult(_0xe4a651,_0x303f9a){_0x303f9a=_0x303f9a||0xc8;return function(_0x5d8ce8){if(_0x5d8ce8){return _0xe4a651['status'](_0x303f9a)['json'](_0x5d8ce8);}};}function respondWithFilteredResult(_0x4ee41c,_0x5da32b){return function(_0x35a096){if(_0x35a096){var _0x5f5909=_0x35a096[_0x4b2c('0x1b')],_0x380ff9=_0x5da32b['offset'],_0x2e9fbb=_0x5da32b[_0x4b2c('0x1c')]+_0x5da32b[_0x4b2c('0x1d')],_0x23ac3a;if(_0x2e9fbb>=_0x5f5909){_0x2e9fbb=_0x5f5909;_0x23ac3a=0xc8;}else{_0x23ac3a=0xce;}_0x4ee41c[_0x4b2c('0x19')](_0x23ac3a);return _0x4ee41c['set']('Content-Range',_0x380ff9+'-'+_0x2e9fbb+'/'+_0x5f5909)[_0x4b2c('0x1e')](_0x35a096);}return null;};}function patchUpdates(_0x5d8606){return function(_0x3409b8){try{jsonpatch['apply'](_0x3409b8,_0x5d8606,!![]);}catch(_0x56838b){return BPromise['reject'](_0x56838b);}return _0x3409b8[_0x4b2c('0x1f')]();};}function saveUpdates(_0x138f6a,_0x203eaf){return function(_0x43135d){if(_0x43135d){return _0x43135d[_0x4b2c('0x20')](_0x138f6a)['then'](function(_0x5237b7){return _0x5237b7;});}return null;};}function removeEntity(_0x3cc422,_0x4871c2){return function(_0x496fbd){if(_0x496fbd){return _0x496fbd[_0x4b2c('0x21')]()['then'](function(){_0x3cc422[_0x4b2c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2553,_0x5431a9){return function(_0x27f8c4){if(!_0x27f8c4){_0x3a2553[_0x4b2c('0x18')](0x194);}return _0x27f8c4;};}function handleError(_0xb8c23f,_0x29a9fe){_0x29a9fe=_0x29a9fe||0x1f4;return function(_0x563251){logger['error'](_0x563251[_0x4b2c('0x22')]);if(_0x563251[_0x4b2c('0x23')]){delete _0x563251[_0x4b2c('0x23')];}_0xb8c23f[_0x4b2c('0x19')](_0x29a9fe)[_0x4b2c('0x24')](_0x563251);};}exports['index']=function(_0x1c2459,_0x215dc4){var _0x53bb0e={},_0x2ecca8={},_0x5627d9={'count':0x0,'rows':[]};var _0x2159d8=db[_0x4b2c('0x25')]['rawAttributes'];_0x2ecca8['model']=_[_0x4b2c('0x26')](_0x2159d8);_0x2ecca8['query']=_['keys'](_0x1c2459['query']);_0x2ecca8[_0x4b2c('0x27')]=_[_0x4b2c('0x28')](_0x2ecca8[_0x4b2c('0x29')],_0x2ecca8[_0x4b2c('0x2a')]);_0x53bb0e[_0x4b2c('0x2b')]=_[_0x4b2c('0x28')](_0x2ecca8[_0x4b2c('0x29')],qs[_0x4b2c('0x2c')](_0x1c2459[_0x4b2c('0x2a')][_0x4b2c('0x2c')]));_0x53bb0e['attributes']=_0x53bb0e['attributes'][_0x4b2c('0x2d')]?_0x53bb0e['attributes']:_0x2ecca8[_0x4b2c('0x29')];if(!_0x1c2459[_0x4b2c('0x2a')][_0x4b2c('0x2e')](_0x4b2c('0x2f'))){_0x53bb0e['limit']=qs[_0x4b2c('0x1d')](_0x1c2459['query'][_0x4b2c('0x1d')]);_0x53bb0e[_0x4b2c('0x1c')]=qs[_0x4b2c('0x1c')](_0x1c2459[_0x4b2c('0x2a')][_0x4b2c('0x1c')]);}_0x53bb0e['order']=qs[_0x4b2c('0x30')](_0x1c2459['query'][_0x4b2c('0x30')]);_0x53bb0e[_0x4b2c('0x31')]=qs[_0x4b2c('0x27')](_[_0x4b2c('0x32')](_0x1c2459['query'],_0x2ecca8[_0x4b2c('0x27')]));if(_0x1c2459[_0x4b2c('0x2a')][_0x4b2c('0x33')]){_0x53bb0e[_0x4b2c('0x31')]=_['merge'](_0x53bb0e[_0x4b2c('0x31')],{'$or':_['map'](_0x2159d8,function(_0x38887b){if(_0x38887b[_0x4b2c('0x34')][_0x4b2c('0x35')]!==_0x4b2c('0x36')){var _0x57652c={};_0x57652c[_0x38887b['field']]={'$like':'%'+_0x1c2459[_0x4b2c('0x2a')][_0x4b2c('0x33')]+'%'};return _0x57652c;}})});}_0x53bb0e=_[_0x4b2c('0x37')]({},_0x53bb0e,_0x1c2459[_0x4b2c('0x38')]);var _0x5709e9={'where':_0x53bb0e['where']};return db['SAInvoiceNumber'][_0x4b2c('0x1b')](_0x5709e9)[_0x4b2c('0x39')](function(_0x5572b8){_0x5627d9[_0x4b2c('0x1b')]=_0x5572b8;if(_0x1c2459[_0x4b2c('0x2a')]['includeAll']){_0x53bb0e[_0x4b2c('0x3a')]=[{'all':!![]}];}return db[_0x4b2c('0x25')]['findAll'](_0x53bb0e);})[_0x4b2c('0x39')](function(_0x50190f){_0x5627d9['rows']=_0x50190f;return _0x5627d9;})[_0x4b2c('0x39')](respondWithFilteredResult(_0x215dc4,_0x53bb0e))[_0x4b2c('0x3b')](handleError(_0x215dc4,null));};exports[_0x4b2c('0x3c')]=function(_0x20def7,_0x3d5321){var _0x47f6ac={'raw':![],'where':{'id':_0x20def7[_0x4b2c('0x3d')]['id']}},_0x210521={};_0x210521[_0x4b2c('0x29')]=_[_0x4b2c('0x26')](db[_0x4b2c('0x25')][_0x4b2c('0x3e')]);_0x210521['query']=_[_0x4b2c('0x26')](_0x20def7[_0x4b2c('0x2a')]);_0x210521[_0x4b2c('0x27')]=_['intersection'](_0x210521[_0x4b2c('0x29')],_0x210521[_0x4b2c('0x2a')]);_0x47f6ac[_0x4b2c('0x2b')]=_['intersection'](_0x210521[_0x4b2c('0x29')],qs[_0x4b2c('0x2c')](_0x20def7[_0x4b2c('0x2a')][_0x4b2c('0x2c')]));_0x47f6ac[_0x4b2c('0x2b')]=_0x47f6ac[_0x4b2c('0x2b')]['length']?_0x47f6ac['attributes']:_0x210521[_0x4b2c('0x29')];if(_0x20def7['query'][_0x4b2c('0x3f')]){_0x47f6ac['include']=[{'all':!![]}];}_0x47f6ac=_[_0x4b2c('0x37')]({},_0x47f6ac,_0x20def7[_0x4b2c('0x38')]);return db[_0x4b2c('0x25')][_0x4b2c('0x40')](_0x47f6ac)['then'](handleEntityNotFound(_0x3d5321,null))[_0x4b2c('0x39')](respondWithResult(_0x3d5321,null))[_0x4b2c('0x3b')](handleError(_0x3d5321,null));};exports['create']=function(_0x5da54,_0x326323){return db[_0x4b2c('0x25')][_0x4b2c('0x41')](_0x5da54[_0x4b2c('0x42')],{})[_0x4b2c('0x39')](respondWithResult(_0x326323,0xc9))['catch'](handleError(_0x326323,null));};exports[_0x4b2c('0x20')]=function(_0x1fbae4,_0xd12b34){if(_0x1fbae4[_0x4b2c('0x42')]['id']){delete _0x1fbae4[_0x4b2c('0x42')]['id'];}return db[_0x4b2c('0x25')][_0x4b2c('0x40')]({'where':{'id':_0x1fbae4['params']['id']}})['then'](handleEntityNotFound(_0xd12b34,null))[_0x4b2c('0x39')](saveUpdates(_0x1fbae4[_0x4b2c('0x42')],null))['then'](respondWithResult(_0xd12b34,null))['catch'](handleError(_0xd12b34,null));};exports['destroy']=function(_0x149659,_0x1559b3){return db[_0x4b2c('0x25')][_0x4b2c('0x40')]({'where':{'id':_0x149659[_0x4b2c('0x3d')]['id']}})[_0x4b2c('0x39')](handleEntityNotFound(_0x1559b3,null))[_0x4b2c('0x39')](removeEntity(_0x1559b3,null))[_0x4b2c('0x3b')](handleError(_0x1559b3,null));};exports[_0x4b2c('0x43')]=function(_0x29da49,_0x27c03b){return db[_0x4b2c('0x25')][_0x4b2c('0x43')]()[_0x4b2c('0x39')](respondWithResult(_0x27c03b,null))[_0x4b2c('0x3b')](handleError(_0x27c03b,null));}; \ No newline at end of file +var _0x563a=['sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','catch','show','params','length','includeAll','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','SAInvoiceNumber','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','offset','order'];(function(_0x310157,_0x27036e){var _0x2efc19=function(_0x2cc1cc){while(--_0x2cc1cc){_0x310157['push'](_0x310157['shift']());}};_0x2efc19(++_0x27036e);}(_0x563a,0xe6));var _0xa563=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x563a[_0x126558];return _0x1f6d14;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa563('0x0'));var rimraf=require(_0xa563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa563('0x2'));var rp=require(_0xa563('0x3'));var moment=require(_0xa563('0x4'));var BPromise=require(_0xa563('0x5'));var Mustache=require(_0xa563('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa563('0x7'));var csv=require('to-csv');var ejs=require(_0xa563('0x8'));var fs=require('fs');var _=require(_0xa563('0x9'));var squel=require('squel');var crypto=require(_0xa563('0xa'));var jsforce=require(_0xa563('0xb'));var deskjs=require(_0xa563('0xc'));var toCsv=require(_0xa563('0xd'));var querystring=require(_0xa563('0xe'));var Papa=require('papaparse');var Redis=require(_0xa563('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa563('0x10'));var hardwareService=require(_0xa563('0x11'));var logger=require(_0xa563('0x12'))('api');var utils=require(_0xa563('0x13'));var config=require(_0xa563('0x14'));var db=require(_0xa563('0x15'))['db'];function respondWithStatusCode(_0x3c7a62,_0x1d0bce){_0x1d0bce=_0x1d0bce||0xcc;return function(_0x174efc){if(_0x174efc){return _0x3c7a62[_0xa563('0x16')](_0x1d0bce);}return _0x3c7a62[_0xa563('0x17')](_0x1d0bce)[_0xa563('0x18')]();};}function respondWithResult(_0x4ffc65,_0x52d4df){_0x52d4df=_0x52d4df||0xc8;return function(_0x352b10){if(_0x352b10){return _0x4ffc65[_0xa563('0x17')](_0x52d4df)[_0xa563('0x19')](_0x352b10);}};}function respondWithFilteredResult(_0x4edeb9,_0x243862){return function(_0xcc8f61){if(_0xcc8f61){var _0x4888fa=_0xcc8f61[_0xa563('0x1a')],_0x1b72d5=_0x243862['offset'],_0x4e0bc7=_0x243862['offset']+_0x243862[_0xa563('0x1b')],_0x4071b6;if(_0x4e0bc7>=_0x4888fa){_0x4e0bc7=_0x4888fa;_0x4071b6=0xc8;}else{_0x4071b6=0xce;}_0x4edeb9[_0xa563('0x17')](_0x4071b6);return _0x4edeb9[_0xa563('0x1c')](_0xa563('0x1d'),_0x1b72d5+'-'+_0x4e0bc7+'/'+_0x4888fa)[_0xa563('0x19')](_0xcc8f61);}return null;};}function patchUpdates(_0x69fa1e){return function(_0x2bfa85){try{jsonpatch[_0xa563('0x1e')](_0x2bfa85,_0x69fa1e,!![]);}catch(_0x1741e1){return BPromise[_0xa563('0x1f')](_0x1741e1);}return _0x2bfa85[_0xa563('0x20')]();};}function saveUpdates(_0x273809,_0x41afa5){return function(_0x1dcf08){if(_0x1dcf08){return _0x1dcf08['update'](_0x273809)['then'](function(_0x33b853){return _0x33b853;});}return null;};}function removeEntity(_0x1b1592,_0x1575df){return function(_0x26df08){if(_0x26df08){return _0x26df08[_0xa563('0x21')]()[_0xa563('0x22')](function(){_0x1b1592[_0xa563('0x17')](0xcc)[_0xa563('0x18')]();});}};}function handleEntityNotFound(_0x289b17,_0x5da582){return function(_0x208da2){if(!_0x208da2){_0x289b17[_0xa563('0x16')](0x194);}return _0x208da2;};}function handleError(_0x4fdf87,_0x40d982){_0x40d982=_0x40d982||0x1f4;return function(_0xb1fceb){logger['error'](_0xb1fceb[_0xa563('0x23')]);if(_0xb1fceb[_0xa563('0x24')]){delete _0xb1fceb[_0xa563('0x24')];}_0x4fdf87[_0xa563('0x17')](_0x40d982)[_0xa563('0x25')](_0xb1fceb);};}exports['index']=function(_0x351a6b,_0x5e0a39){var _0x5824f2={},_0x2745cd={},_0x287c03={'count':0x0,'rows':[]};var _0x1c83b6=db[_0xa563('0x26')][_0xa563('0x27')];_0x2745cd[_0xa563('0x28')]=_[_0xa563('0x29')](_0x1c83b6);_0x2745cd[_0xa563('0x2a')]=_[_0xa563('0x29')](_0x351a6b[_0xa563('0x2a')]);_0x2745cd[_0xa563('0x2b')]=_['intersection'](_0x2745cd[_0xa563('0x28')],_0x2745cd[_0xa563('0x2a')]);_0x5824f2['attributes']=_[_0xa563('0x2c')](_0x2745cd[_0xa563('0x28')],qs[_0xa563('0x2d')](_0x351a6b[_0xa563('0x2a')][_0xa563('0x2d')]));_0x5824f2[_0xa563('0x2e')]=_0x5824f2['attributes']['length']?_0x5824f2['attributes']:_0x2745cd[_0xa563('0x28')];if(!_0x351a6b[_0xa563('0x2a')][_0xa563('0x2f')]('nolimit')){_0x5824f2['limit']=qs['limit'](_0x351a6b[_0xa563('0x2a')][_0xa563('0x1b')]);_0x5824f2['offset']=qs[_0xa563('0x30')](_0x351a6b[_0xa563('0x2a')][_0xa563('0x30')]);}_0x5824f2[_0xa563('0x31')]=qs[_0xa563('0x32')](_0x351a6b[_0xa563('0x2a')][_0xa563('0x32')]);_0x5824f2[_0xa563('0x33')]=qs[_0xa563('0x2b')](_[_0xa563('0x34')](_0x351a6b[_0xa563('0x2a')],_0x2745cd['filters']));if(_0x351a6b[_0xa563('0x2a')][_0xa563('0x35')]){_0x5824f2['where']=_[_0xa563('0x36')](_0x5824f2[_0xa563('0x33')],{'$or':_[_0xa563('0x37')](_0x1c83b6,function(_0x5c0dce){if(_0x5c0dce[_0xa563('0x38')]['key']!==_0xa563('0x39')){var _0x170568={};_0x170568[_0x5c0dce[_0xa563('0x3a')]]={'$like':'%'+_0x351a6b[_0xa563('0x2a')][_0xa563('0x35')]+'%'};return _0x170568;}})});}_0x5824f2=_[_0xa563('0x36')]({},_0x5824f2,_0x351a6b[_0xa563('0x3b')]);var _0x51abd4={'where':_0x5824f2[_0xa563('0x33')]};return db['SAInvoiceNumber'][_0xa563('0x1a')](_0x51abd4)[_0xa563('0x22')](function(_0x5221df){_0x287c03['count']=_0x5221df;if(_0x351a6b[_0xa563('0x2a')]['includeAll']){_0x5824f2['include']=[{'all':!![]}];}return db[_0xa563('0x26')]['findAll'](_0x5824f2);})[_0xa563('0x22')](function(_0x4e9a20){_0x287c03['rows']=_0x4e9a20;return _0x287c03;})[_0xa563('0x22')](respondWithFilteredResult(_0x5e0a39,_0x5824f2))[_0xa563('0x3c')](handleError(_0x5e0a39,null));};exports[_0xa563('0x3d')]=function(_0xf9083d,_0x5526f6){var _0xdd8aca={'raw':![],'where':{'id':_0xf9083d[_0xa563('0x3e')]['id']}},_0x3fa239={};_0x3fa239[_0xa563('0x28')]=_[_0xa563('0x29')](db['SAInvoiceNumber'][_0xa563('0x27')]);_0x3fa239['query']=_[_0xa563('0x29')](_0xf9083d[_0xa563('0x2a')]);_0x3fa239['filters']=_['intersection'](_0x3fa239['model'],_0x3fa239[_0xa563('0x2a')]);_0xdd8aca[_0xa563('0x2e')]=_['intersection'](_0x3fa239[_0xa563('0x28')],qs['fields'](_0xf9083d['query'][_0xa563('0x2d')]));_0xdd8aca[_0xa563('0x2e')]=_0xdd8aca[_0xa563('0x2e')][_0xa563('0x3f')]?_0xdd8aca[_0xa563('0x2e')]:_0x3fa239['model'];if(_0xf9083d[_0xa563('0x2a')][_0xa563('0x40')]){_0xdd8aca[_0xa563('0x41')]=[{'all':!![]}];}_0xdd8aca=_['merge']({},_0xdd8aca,_0xf9083d[_0xa563('0x3b')]);return db['SAInvoiceNumber']['find'](_0xdd8aca)[_0xa563('0x22')](handleEntityNotFound(_0x5526f6,null))[_0xa563('0x22')](respondWithResult(_0x5526f6,null))['catch'](handleError(_0x5526f6,null));};exports[_0xa563('0x42')]=function(_0xb3988c,_0x383c65){return db[_0xa563('0x26')][_0xa563('0x42')](_0xb3988c[_0xa563('0x43')],{})['then'](respondWithResult(_0x383c65,0xc9))[_0xa563('0x3c')](handleError(_0x383c65,null));};exports['update']=function(_0x41e17e,_0x244589){if(_0x41e17e[_0xa563('0x43')]['id']){delete _0x41e17e[_0xa563('0x43')]['id'];}return db['SAInvoiceNumber'][_0xa563('0x44')]({'where':{'id':_0x41e17e['params']['id']}})[_0xa563('0x22')](handleEntityNotFound(_0x244589,null))[_0xa563('0x22')](saveUpdates(_0x41e17e[_0xa563('0x43')],null))[_0xa563('0x22')](respondWithResult(_0x244589,null))[_0xa563('0x3c')](handleError(_0x244589,null));};exports['destroy']=function(_0xdd72da,_0x575cb4){return db[_0xa563('0x26')][_0xa563('0x44')]({'where':{'id':_0xdd72da[_0xa563('0x3e')]['id']}})[_0xa563('0x22')](handleEntityNotFound(_0x575cb4,null))[_0xa563('0x22')](removeEntity(_0x575cb4,null))[_0xa563('0x3c')](handleError(_0x575cb4,null));};exports[_0xa563('0x45')]=function(_0x19af2d,_0x33d83c){return db[_0xa563('0x26')]['describe']()['then'](respondWithResult(_0x33d83c,null))[_0xa563('0x3c')](handleError(_0x33d83c,null));}; \ No newline at end of file diff --git a/server/api/saInvoiceNumber/saInvoiceNumber.model.js b/server/api/saInvoiceNumber/saInvoiceNumber.model.js index 127a0df..645f031 100644 --- a/server/api/saInvoiceNumber/saInvoiceNumber.model.js +++ b/server/api/saInvoiceNumber/saInvoiceNumber.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3478=['./saInvoiceNumber.attributes','define','SAInvoiceNumber','sa_invoice_numbers','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2bcbb4,_0x87a08c){var _0x343a40=function(_0x4623ca){while(--_0x4623ca){_0x2bcbb4['push'](_0x2bcbb4['shift']());}};_0x343a40(++_0x87a08c);}(_0x3478,0x100));var _0x8347=function(_0x11263d,_0x2a5701){_0x11263d=_0x11263d-0x0;var _0x850a0d=_0x3478[_0x11263d];return _0x850a0d;};'use strict';var _=require(_0x8347('0x0'));var util=require('util');var logger=require(_0x8347('0x1'))('api');var moment=require(_0x8347('0x2'));var BPromise=require(_0x8347('0x3'));var rp=require(_0x8347('0x4'));var fs=require('fs');var path=require(_0x8347('0x5'));var rimraf=require(_0x8347('0x6'));var config=require(_0x8347('0x7'));var attributes=require(_0x8347('0x8'));module['exports']=function(_0x15012d,_0xddf6be){return _0x15012d[_0x8347('0x9')](_0x8347('0xa'),attributes,{'tableName':_0x8347('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x068d=['bluebird','request-promise','path','rimraf','./saInvoiceNumber.attributes','define','SAInvoiceNumber','lodash','../../config/logger','api','moment'];(function(_0x4c0baa,_0x2e110f){var _0x4bf459=function(_0x401aa3){while(--_0x401aa3){_0x4c0baa['push'](_0x4c0baa['shift']());}};_0x4bf459(++_0x2e110f);}(_0x068d,0x1d5));var _0xd068=function(_0x9e70c5,_0x284f11){_0x9e70c5=_0x9e70c5-0x0;var _0x43191b=_0x068d[_0x9e70c5];return _0x43191b;};'use strict';var _=require(_0xd068('0x0'));var util=require('util');var logger=require(_0xd068('0x1'))(_0xd068('0x2'));var moment=require(_0xd068('0x3'));var BPromise=require(_0xd068('0x4'));var rp=require(_0xd068('0x5'));var fs=require('fs');var path=require(_0xd068('0x6'));var rimraf=require(_0xd068('0x7'));var config=require('../../config/environment');var attributes=require(_0xd068('0x8'));module['exports']=function(_0x472da1,_0x3a8794){return _0x472da1[_0xd068('0x9')](_0xd068('0xa'),attributes,{'tableName':'sa_invoice_numbers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saInvoiceNumber/saInvoiceNumber.rpc.js b/server/api/saInvoiceNumber/saInvoiceNumber.rpc.js index 8850d9d..c1ea26f 100644 --- a/server/api/saInvoiceNumber/saInvoiceNumber.rpc.js +++ b/server/api/saInvoiceNumber/saInvoiceNumber.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd352=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','SAInvoiceNumber,\x20%s,\x20%s','request\x20sent','debug','SAInvoiceNumber,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xd352,0xc5));var _0x2d35=function(_0x52c1f6,_0x4eda0b){_0x52c1f6=_0x52c1f6-0x0;var _0x4df981=_0xd352[_0x52c1f6];return _0x4df981;};'use strict';var _=require(_0x2d35('0x0'));var util=require(_0x2d35('0x1'));var moment=require(_0x2d35('0x2'));var BPromise=require(_0x2d35('0x3'));var rs=require(_0x2d35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d35('0x5'))['db'];var utils=require(_0x2d35('0x6'));var logger=require(_0x2d35('0x7'))(_0x2d35('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11190d,_0x2fff83,_0x4a7ef7){return new BPromise(function(_0x1dd2de,_0x3d5e86){return client[_0x2d35('0xa')](_0x11190d,_0x4a7ef7)[_0x2d35('0xb')](function(_0x3d7450){logger[_0x2d35('0xc')](_0x2d35('0xd'),_0x2fff83,_0x2d35('0xe'));logger[_0x2d35('0xf')](_0x2d35('0x10'),_0x2fff83,_0x2d35('0xe'),JSON[_0x2d35('0x11')](_0x3d7450));if(_0x3d7450[_0x2d35('0x12')]){if(_0x3d7450['error'][_0x2d35('0x13')]===0x1f4){logger[_0x2d35('0x12')](_0x2d35('0xd'),_0x2fff83,_0x3d7450['error'][_0x2d35('0x14')]);return _0x3d5e86(_0x3d7450['error'][_0x2d35('0x14')]);}logger[_0x2d35('0x12')](_0x2d35('0xd'),_0x2fff83,_0x3d7450[_0x2d35('0x12')][_0x2d35('0x14')]);return _0x1dd2de(_0x3d7450['error']['message']);}else{logger[_0x2d35('0xc')](_0x2d35('0xd'),_0x2fff83,_0x2d35('0xe'));_0x1dd2de(_0x3d7450[_0x2d35('0x15')][_0x2d35('0x14')]);}})['catch'](function(_0x51b212){logger[_0x2d35('0x12')](_0x2d35('0xd'),_0x2fff83,_0x51b212);_0x3d5e86(_0x51b212);});});} \ No newline at end of file +var _0xae4d=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SAInvoiceNumber,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xae4d,0xfb));var _0xdae4=function(_0x4988ce,_0x27a3a7){_0x4988ce=_0x4988ce-0x0;var _0x786381=_0xae4d[_0x4988ce];return _0x786381;};'use strict';var _=require(_0xdae4('0x0'));var util=require(_0xdae4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdae4('0x2'));var fs=require('fs');var Redis=require(_0xdae4('0x3'));var db=require(_0xdae4('0x4'))['db'];var utils=require(_0xdae4('0x5'));var logger=require(_0xdae4('0x6'))(_0xdae4('0x7'));var config=require(_0xdae4('0x8'));var jayson=require(_0xdae4('0x9'));var client=jayson[_0xdae4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42ce5d,_0x43340c,_0x56b45b){return new BPromise(function(_0x4f8bc0,_0x20bc73){return client[_0xdae4('0xb')](_0x42ce5d,_0x56b45b)['then'](function(_0x1db237){logger[_0xdae4('0xc')](_0xdae4('0xd'),_0x43340c,_0xdae4('0xe'));logger[_0xdae4('0xf')]('SAInvoiceNumber,\x20%s,\x20%s,\x20%s',_0x43340c,_0xdae4('0xe'),JSON['stringify'](_0x1db237));if(_0x1db237['error']){if(_0x1db237[_0xdae4('0x10')][_0xdae4('0x11')]===0x1f4){logger['error'](_0xdae4('0xd'),_0x43340c,_0x1db237[_0xdae4('0x10')]['message']);return _0x20bc73(_0x1db237['error'][_0xdae4('0x12')]);}logger[_0xdae4('0x10')](_0xdae4('0xd'),_0x43340c,_0x1db237[_0xdae4('0x10')][_0xdae4('0x12')]);return _0x4f8bc0(_0x1db237['error'][_0xdae4('0x12')]);}else{logger[_0xdae4('0xc')](_0xdae4('0xd'),_0x43340c,'request\x20sent');_0x4f8bc0(_0x1db237[_0xdae4('0x13')][_0xdae4('0x12')]);}})[_0xdae4('0x14')](function(_0x1c037b){logger[_0xdae4('0x10')](_0xdae4('0xd'),_0x43340c,_0x1c037b);_0x20bc73(_0x1c037b);});});} \ No newline at end of file diff --git a/server/api/saOrder/index.js b/server/api/saOrder/index.js index 21edbe1..89a5a6f 100644 --- a/server/api/saOrder/index.js +++ b/server/api/saOrder/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./saOrder.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x29f02f,_0x39196d){var _0x1a439d=function(_0x34fa84){while(--_0x34fa84){_0x29f02f['push'](_0x29f02f['shift']());}};_0x1a439d(++_0x39196d);}(_0xea28,0x13a));var _0x8ea2=function(_0x5096e5,_0x50911d){_0x5096e5=_0x5096e5-0x0;var _0x5aaa19=_0xea28[_0x5096e5];return _0x5aaa19;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var auth=require(_0x8ea2('0x6'));var interaction=require(_0x8ea2('0x7'));var config=require('../../config/environment');var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')]('/',auth[_0x8ea2('0xa')](),controller['index']);router[_0x8ea2('0x9')](_0x8ea2('0xb'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xc')]);router[_0x8ea2('0x9')](_0x8ea2('0xd'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xa')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8ea2('0x12')]);router[_0x8ea2('0x13')](_0x8ea2('0xd'),auth['isAuthenticated'](),controller[_0x8ea2('0x14')]);module[_0x8ea2('0x15')]=router; \ No newline at end of file +var _0x4213=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post'];(function(_0x5c7c31,_0x22aa86){var _0x193fdf=function(_0x271ade){while(--_0x271ade){_0x5c7c31['push'](_0x5c7c31['shift']());}};_0x193fdf(++_0x22aa86);}(_0x4213,0x77));var _0x3421=function(_0x2acd45,_0x2dee47){_0x2acd45=_0x2acd45-0x0;var _0xb53557=_0x4213[_0x2acd45];return _0xb53557;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var auth=require(_0x3421('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3421('0x7'));var controller=require('./saOrder.controller');router[_0x3421('0x8')]('/',auth[_0x3421('0x9')](),controller[_0x3421('0xa')]);router[_0x3421('0x8')]('/describe',auth[_0x3421('0x9')](),controller[_0x3421('0xb')]);router[_0x3421('0x8')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller['show']);router[_0x3421('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3421('0xe')]('/:id',auth[_0x3421('0x9')](),controller[_0x3421('0xf')]);router[_0x3421('0x10')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller[_0x3421('0x11')]);module[_0x3421('0x12')]=router; \ No newline at end of file diff --git a/server/api/saOrder/saOrder.attributes.js b/server/api/saOrder/saOrder.attributes.js index 4a7e487..97d49bb 100644 --- a/server/api/saOrder/saOrder.attributes.js +++ b/server/api/saOrder/saOrder.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','STRING','TEXT'];(function(_0x31457c,_0x520e7d){var _0x304805=function(_0x4bcb5a){while(--_0x4bcb5a){_0x31457c['push'](_0x31457c['shift']());}};_0x304805(++_0x520e7d);}(_0x1261,0x144));var _0x1126=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x1261[_0x5d6e35];return _0x5d7ada;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'clientCode':{'type':Sequelize[_0x1126('0x1')]},'note':{'type':Sequelize[_0x1126('0x2')]},'agentFullname':{'type':Sequelize[_0x1126('0x1')]},'status':{'type':Sequelize[_0x1126('0x1')]}}; \ No newline at end of file +var _0x1261=['exports','STRING','TEXT'];(function(_0x2545d2,_0x395db6){var _0x4e00cd=function(_0x2f5f82){while(--_0x2f5f82){_0x2545d2['push'](_0x2545d2['shift']());}};_0x4e00cd(++_0x395db6);}(_0x1261,0x144));var _0x1126=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x1261[_0x1af0e5];return _0x3c444a;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'clientCode':{'type':Sequelize[_0x1126('0x1')]},'note':{'type':Sequelize[_0x1126('0x2')]},'agentFullname':{'type':Sequelize[_0x1126('0x1')]},'status':{'type':Sequelize[_0x1126('0x1')]}}; \ No newline at end of file diff --git a/server/api/saOrder/saOrder.controller.js b/server/api/saOrder/saOrder.controller.js index a87fdb4..332555a 100644 --- a/server/api/saOrder/saOrder.controller.js +++ b/server/api/saOrder/saOrder.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ba5=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','SAOrder','model','query','keys','intersection','attributes','sort','pick','filters','merge','where','map','type','filter','rows','catch','show','rawAttributes','fields','length','includeAll','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/logger','api'];(function(_0x1e6ff5,_0x26eefb){var _0x58e78e=function(_0x31a806){while(--_0x31a806){_0x1e6ff5['push'](_0x1e6ff5['shift']());}};_0x58e78e(++_0x26eefb);}(_0x4ba5,0xfb));var _0x54ba=function(_0x4b8f4a,_0x30d9f6){_0x4b8f4a=_0x4b8f4a-0x0;var _0x3d84db=_0x4ba5[_0x4b8f4a];return _0x3d84db;};'use strict';var pdf=require(_0x54ba('0x0'));var emlformat=require(_0x54ba('0x1'));var rimraf=require(_0x54ba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x54ba('0x3'));var moment=require(_0x54ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54ba('0x5'));var util=require('util');var path=require('path');var sox=require(_0x54ba('0x6'));var csv=require(_0x54ba('0x7'));var ejs=require(_0x54ba('0x8'));var fs=require('fs');var _=require(_0x54ba('0x9'));var squel=require(_0x54ba('0xa'));var crypto=require(_0x54ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x54ba('0xc'));var toCsv=require(_0x54ba('0x7'));var querystring=require(_0x54ba('0xd'));var Papa=require(_0x54ba('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x54ba('0xf'))(_0x54ba('0x10'));var utils=require(_0x54ba('0x11'));var config=require(_0x54ba('0x12'));var db=require(_0x54ba('0x13'))['db'];function respondWithStatusCode(_0x188a32,_0xa785ff){_0xa785ff=_0xa785ff||0xcc;return function(_0x5e47e6){if(_0x5e47e6){return _0x188a32[_0x54ba('0x14')](_0xa785ff);}return _0x188a32['status'](_0xa785ff)[_0x54ba('0x15')]();};}function respondWithResult(_0x1b15f2,_0x1a3b56){_0x1a3b56=_0x1a3b56||0xc8;return function(_0x5403de){if(_0x5403de){return _0x1b15f2[_0x54ba('0x16')](_0x1a3b56)[_0x54ba('0x17')](_0x5403de);}};}function respondWithFilteredResult(_0x3264f4,_0x4d5b09){return function(_0x4c7c76){if(_0x4c7c76){var _0x218047=_0x4c7c76[_0x54ba('0x18')],_0x59a059=_0x4d5b09[_0x54ba('0x19')],_0x379297=_0x4d5b09[_0x54ba('0x19')]+_0x4d5b09[_0x54ba('0x1a')],_0xfacbbb;if(_0x379297>=_0x218047){_0x379297=_0x218047;_0xfacbbb=0xc8;}else{_0xfacbbb=0xce;}_0x3264f4[_0x54ba('0x16')](_0xfacbbb);return _0x3264f4[_0x54ba('0x1b')]('Content-Range',_0x59a059+'-'+_0x379297+'/'+_0x218047)['json'](_0x4c7c76);}return null;};}function patchUpdates(_0x39d51b){return function(_0x5c603f){try{jsonpatch[_0x54ba('0x1c')](_0x5c603f,_0x39d51b,!![]);}catch(_0x1b47da){return BPromise[_0x54ba('0x1d')](_0x1b47da);}return _0x5c603f[_0x54ba('0x1e')]();};}function saveUpdates(_0x33336b,_0x35f989){return function(_0x530890){if(_0x530890){return _0x530890[_0x54ba('0x1f')](_0x33336b)[_0x54ba('0x20')](function(_0x496a26){return _0x496a26;});}return null;};}function removeEntity(_0x225990,_0x128847){return function(_0x51a30a){if(_0x51a30a){return _0x51a30a[_0x54ba('0x21')]()[_0x54ba('0x20')](function(){_0x225990['status'](0xcc)[_0x54ba('0x15')]();});}};}function handleEntityNotFound(_0x322afc,_0x41b1fe){return function(_0x13c0a5){if(!_0x13c0a5){_0x322afc[_0x54ba('0x14')](0x194);}return _0x13c0a5;};}function handleError(_0xe06667,_0x56583e){_0x56583e=_0x56583e||0x1f4;return function(_0x255bdc){logger[_0x54ba('0x22')](_0x255bdc[_0x54ba('0x23')]);if(_0x255bdc[_0x54ba('0x24')]){delete _0x255bdc[_0x54ba('0x24')];}_0xe06667[_0x54ba('0x16')](_0x56583e)[_0x54ba('0x25')](_0x255bdc);};}exports[_0x54ba('0x26')]=function(_0x4c04e1,_0x3392d5){var _0x825ff0={},_0x48cfc0={},_0x55be5b={'count':0x0,'rows':[]};var _0x342032=db[_0x54ba('0x27')]['rawAttributes'];_0x48cfc0[_0x54ba('0x28')]=_['keys'](_0x342032);_0x48cfc0[_0x54ba('0x29')]=_[_0x54ba('0x2a')](_0x4c04e1[_0x54ba('0x29')]);_0x48cfc0['filters']=_[_0x54ba('0x2b')](_0x48cfc0['model'],_0x48cfc0[_0x54ba('0x29')]);_0x825ff0['attributes']=_['intersection'](_0x48cfc0[_0x54ba('0x28')],qs['fields'](_0x4c04e1['query']['fields']));_0x825ff0[_0x54ba('0x2c')]=_0x825ff0['attributes']['length']?_0x825ff0['attributes']:_0x48cfc0[_0x54ba('0x28')];if(!_0x4c04e1[_0x54ba('0x29')]['hasOwnProperty']('nolimit')){_0x825ff0[_0x54ba('0x1a')]=qs[_0x54ba('0x1a')](_0x4c04e1[_0x54ba('0x29')][_0x54ba('0x1a')]);_0x825ff0[_0x54ba('0x19')]=qs['offset'](_0x4c04e1[_0x54ba('0x29')][_0x54ba('0x19')]);}_0x825ff0['order']=qs[_0x54ba('0x2d')](_0x4c04e1[_0x54ba('0x29')]['sort']);_0x825ff0['where']=qs['filters'](_[_0x54ba('0x2e')](_0x4c04e1['query'],_0x48cfc0[_0x54ba('0x2f')]));if(_0x4c04e1[_0x54ba('0x29')]['filter']){_0x825ff0['where']=_[_0x54ba('0x30')](_0x825ff0[_0x54ba('0x31')],{'$or':_[_0x54ba('0x32')](_0x342032,function(_0x2803a0){if(_0x2803a0[_0x54ba('0x33')]['key']!=='VIRTUAL'){var _0x59b7cf={};_0x59b7cf[_0x2803a0['field']]={'$like':'%'+_0x4c04e1[_0x54ba('0x29')][_0x54ba('0x34')]+'%'};return _0x59b7cf;}})});}_0x825ff0=_[_0x54ba('0x30')]({},_0x825ff0,_0x4c04e1['options']);var _0x3ea6fc={'where':_0x825ff0[_0x54ba('0x31')]};return db['SAOrder'][_0x54ba('0x18')](_0x3ea6fc)[_0x54ba('0x20')](function(_0x21f036){_0x55be5b[_0x54ba('0x18')]=_0x21f036;if(_0x4c04e1['query']['includeAll']){_0x825ff0['include']=[{'all':!![]}];}return db[_0x54ba('0x27')]['findAll'](_0x825ff0);})[_0x54ba('0x20')](function(_0x28a03a){_0x55be5b[_0x54ba('0x35')]=_0x28a03a;return _0x55be5b;})[_0x54ba('0x20')](respondWithFilteredResult(_0x3392d5,_0x825ff0))[_0x54ba('0x36')](handleError(_0x3392d5,null));};exports[_0x54ba('0x37')]=function(_0x38bfb0,_0x2f79d4){var _0x5497ee={'raw':![],'where':{'id':_0x38bfb0['params']['id']}},_0x56d802={};_0x56d802[_0x54ba('0x28')]=_[_0x54ba('0x2a')](db[_0x54ba('0x27')][_0x54ba('0x38')]);_0x56d802[_0x54ba('0x29')]=_[_0x54ba('0x2a')](_0x38bfb0['query']);_0x56d802[_0x54ba('0x2f')]=_['intersection'](_0x56d802[_0x54ba('0x28')],_0x56d802[_0x54ba('0x29')]);_0x5497ee[_0x54ba('0x2c')]=_[_0x54ba('0x2b')](_0x56d802[_0x54ba('0x28')],qs[_0x54ba('0x39')](_0x38bfb0['query'][_0x54ba('0x39')]));_0x5497ee[_0x54ba('0x2c')]=_0x5497ee[_0x54ba('0x2c')][_0x54ba('0x3a')]?_0x5497ee[_0x54ba('0x2c')]:_0x56d802['model'];if(_0x38bfb0[_0x54ba('0x29')][_0x54ba('0x3b')]){_0x5497ee[_0x54ba('0x3c')]=[{'all':!![]}];}_0x5497ee=_[_0x54ba('0x30')]({},_0x5497ee,_0x38bfb0[_0x54ba('0x3d')]);return db[_0x54ba('0x27')][_0x54ba('0x3e')](_0x5497ee)[_0x54ba('0x20')](handleEntityNotFound(_0x2f79d4,null))[_0x54ba('0x20')](respondWithResult(_0x2f79d4,null))[_0x54ba('0x36')](handleError(_0x2f79d4,null));};exports[_0x54ba('0x3f')]=function(_0x3ce9fa,_0x6b0dc){return db[_0x54ba('0x27')]['create'](_0x3ce9fa['body'],{})['then'](respondWithResult(_0x6b0dc,0xc9))[_0x54ba('0x36')](handleError(_0x6b0dc,null));};exports[_0x54ba('0x1f')]=function(_0x53d05c,_0x5e5c57){if(_0x53d05c['body']['id']){delete _0x53d05c[_0x54ba('0x40')]['id'];}return db[_0x54ba('0x27')][_0x54ba('0x3e')]({'where':{'id':_0x53d05c[_0x54ba('0x41')]['id']}})[_0x54ba('0x20')](handleEntityNotFound(_0x5e5c57,null))[_0x54ba('0x20')](saveUpdates(_0x53d05c['body'],null))['then'](respondWithResult(_0x5e5c57,null))[_0x54ba('0x36')](handleError(_0x5e5c57,null));};exports[_0x54ba('0x21')]=function(_0x235583,_0x2b65e7){return db[_0x54ba('0x27')]['find']({'where':{'id':_0x235583[_0x54ba('0x41')]['id']}})[_0x54ba('0x20')](handleEntityNotFound(_0x2b65e7,null))[_0x54ba('0x20')](removeEntity(_0x2b65e7,null))[_0x54ba('0x36')](handleError(_0x2b65e7,null));};exports['describe']=function(_0x1259d2,_0x1f8352){return db['SAOrder'][_0x54ba('0x42')]()[_0x54ba('0x20')](respondWithResult(_0x1f8352,null))['catch'](handleError(_0x1f8352,null));}; \ No newline at end of file +var _0xa302=['status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SAOrder','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','merge','map','type','key','field','filter','includeAll','include','findAll','rows','catch','params','options','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xa302,0x7e));var _0x2a30=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa302[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x2a30('0x0'));var emlformat=require(_0x2a30('0x1'));var rimraf=require(_0x2a30('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a30('0x3'));var rp=require(_0x2a30('0x4'));var moment=require(_0x2a30('0x5'));var BPromise=require(_0x2a30('0x6'));var Mustache=require(_0x2a30('0x7'));var util=require(_0x2a30('0x8'));var path=require(_0x2a30('0x9'));var sox=require('sox');var csv=require(_0x2a30('0xa'));var ejs=require(_0x2a30('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2a30('0xc'));var crypto=require(_0x2a30('0xd'));var jsforce=require(_0x2a30('0xe'));var deskjs=require(_0x2a30('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2a30('0x10'));var Papa=require(_0x2a30('0x11'));var Redis=require(_0x2a30('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2a30('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a30('0x14'))(_0x2a30('0x15'));var utils=require(_0x2a30('0x16'));var config=require(_0x2a30('0x17'));var db=require(_0x2a30('0x18'))['db'];function respondWithStatusCode(_0x2da93e,_0x1e823d){_0x1e823d=_0x1e823d||0xcc;return function(_0x23a6ce){if(_0x23a6ce){return _0x2da93e[_0x2a30('0x19')](_0x1e823d);}return _0x2da93e[_0x2a30('0x1a')](_0x1e823d)[_0x2a30('0x1b')]();};}function respondWithResult(_0x20079a,_0x1707e4){_0x1707e4=_0x1707e4||0xc8;return function(_0xfe86ce){if(_0xfe86ce){return _0x20079a[_0x2a30('0x1a')](_0x1707e4)[_0x2a30('0x1c')](_0xfe86ce);}};}function respondWithFilteredResult(_0x2dcfa9,_0x3846f1){return function(_0x1c60b9){if(_0x1c60b9){var _0x21f3c3=_0x1c60b9[_0x2a30('0x1d')],_0xd503b2=_0x3846f1[_0x2a30('0x1e')],_0x3e44bc=_0x3846f1[_0x2a30('0x1e')]+_0x3846f1['limit'],_0x51ff6d;if(_0x3e44bc>=_0x21f3c3){_0x3e44bc=_0x21f3c3;_0x51ff6d=0xc8;}else{_0x51ff6d=0xce;}_0x2dcfa9[_0x2a30('0x1a')](_0x51ff6d);return _0x2dcfa9[_0x2a30('0x1f')](_0x2a30('0x20'),_0xd503b2+'-'+_0x3e44bc+'/'+_0x21f3c3)[_0x2a30('0x1c')](_0x1c60b9);}return null;};}function patchUpdates(_0x2c89c8){return function(_0x3c706d){try{jsonpatch[_0x2a30('0x21')](_0x3c706d,_0x2c89c8,!![]);}catch(_0x22b4f0){return BPromise[_0x2a30('0x22')](_0x22b4f0);}return _0x3c706d[_0x2a30('0x23')]();};}function saveUpdates(_0x3c2772,_0x46537c){return function(_0x368f6f){if(_0x368f6f){return _0x368f6f[_0x2a30('0x24')](_0x3c2772)[_0x2a30('0x25')](function(_0x5baae9){return _0x5baae9;});}return null;};}function removeEntity(_0x139329,_0x487b0a){return function(_0x5994d1){if(_0x5994d1){return _0x5994d1[_0x2a30('0x26')]()[_0x2a30('0x25')](function(){_0x139329[_0x2a30('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49542d,_0x4a2c49){return function(_0x3d92ab){if(!_0x3d92ab){_0x49542d[_0x2a30('0x19')](0x194);}return _0x3d92ab;};}function handleError(_0x285b9e,_0xdcd319){_0xdcd319=_0xdcd319||0x1f4;return function(_0x34d96f){logger[_0x2a30('0x27')](_0x34d96f[_0x2a30('0x28')]);if(_0x34d96f[_0x2a30('0x29')]){delete _0x34d96f['name'];}_0x285b9e[_0x2a30('0x1a')](_0xdcd319)[_0x2a30('0x2a')](_0x34d96f);};}exports[_0x2a30('0x2b')]=function(_0x3f1d38,_0x4eeb70){var _0x302043={},_0x5b1f9a={},_0x27993d={'count':0x0,'rows':[]};var _0x47b9c2=db[_0x2a30('0x2c')][_0x2a30('0x2d')];_0x5b1f9a['model']=_[_0x2a30('0x2e')](_0x47b9c2);_0x5b1f9a[_0x2a30('0x2f')]=_[_0x2a30('0x2e')](_0x3f1d38['query']);_0x5b1f9a[_0x2a30('0x30')]=_['intersection'](_0x5b1f9a[_0x2a30('0x31')],_0x5b1f9a[_0x2a30('0x2f')]);_0x302043[_0x2a30('0x32')]=_[_0x2a30('0x33')](_0x5b1f9a[_0x2a30('0x31')],qs[_0x2a30('0x34')](_0x3f1d38['query'][_0x2a30('0x34')]));_0x302043[_0x2a30('0x32')]=_0x302043[_0x2a30('0x32')][_0x2a30('0x35')]?_0x302043['attributes']:_0x5b1f9a[_0x2a30('0x31')];if(!_0x3f1d38['query']['hasOwnProperty'](_0x2a30('0x36'))){_0x302043[_0x2a30('0x37')]=qs[_0x2a30('0x37')](_0x3f1d38[_0x2a30('0x2f')]['limit']);_0x302043[_0x2a30('0x1e')]=qs[_0x2a30('0x1e')](_0x3f1d38['query'][_0x2a30('0x1e')]);}_0x302043[_0x2a30('0x38')]=qs[_0x2a30('0x39')](_0x3f1d38[_0x2a30('0x2f')][_0x2a30('0x39')]);_0x302043[_0x2a30('0x3a')]=qs[_0x2a30('0x30')](_['pick'](_0x3f1d38[_0x2a30('0x2f')],_0x5b1f9a[_0x2a30('0x30')]));if(_0x3f1d38[_0x2a30('0x2f')]['filter']){_0x302043[_0x2a30('0x3a')]=_[_0x2a30('0x3b')](_0x302043[_0x2a30('0x3a')],{'$or':_[_0x2a30('0x3c')](_0x47b9c2,function(_0x198e9b){if(_0x198e9b[_0x2a30('0x3d')][_0x2a30('0x3e')]!=='VIRTUAL'){var _0x87cce8={};_0x87cce8[_0x198e9b[_0x2a30('0x3f')]]={'$like':'%'+_0x3f1d38[_0x2a30('0x2f')][_0x2a30('0x40')]+'%'};return _0x87cce8;}})});}_0x302043=_[_0x2a30('0x3b')]({},_0x302043,_0x3f1d38['options']);var _0x1323d7={'where':_0x302043[_0x2a30('0x3a')]};return db[_0x2a30('0x2c')][_0x2a30('0x1d')](_0x1323d7)['then'](function(_0x846807){_0x27993d[_0x2a30('0x1d')]=_0x846807;if(_0x3f1d38['query'][_0x2a30('0x41')]){_0x302043[_0x2a30('0x42')]=[{'all':!![]}];}return db[_0x2a30('0x2c')][_0x2a30('0x43')](_0x302043);})[_0x2a30('0x25')](function(_0x116b6c){_0x27993d[_0x2a30('0x44')]=_0x116b6c;return _0x27993d;})[_0x2a30('0x25')](respondWithFilteredResult(_0x4eeb70,_0x302043))[_0x2a30('0x45')](handleError(_0x4eeb70,null));};exports['show']=function(_0x4b1f14,_0x311bfc){var _0x1acd10={'raw':![],'where':{'id':_0x4b1f14[_0x2a30('0x46')]['id']}},_0x5cfa53={};_0x5cfa53['model']=_[_0x2a30('0x2e')](db[_0x2a30('0x2c')][_0x2a30('0x2d')]);_0x5cfa53[_0x2a30('0x2f')]=_[_0x2a30('0x2e')](_0x4b1f14['query']);_0x5cfa53[_0x2a30('0x30')]=_[_0x2a30('0x33')](_0x5cfa53[_0x2a30('0x31')],_0x5cfa53[_0x2a30('0x2f')]);_0x1acd10['attributes']=_['intersection'](_0x5cfa53[_0x2a30('0x31')],qs[_0x2a30('0x34')](_0x4b1f14[_0x2a30('0x2f')][_0x2a30('0x34')]));_0x1acd10[_0x2a30('0x32')]=_0x1acd10['attributes'][_0x2a30('0x35')]?_0x1acd10[_0x2a30('0x32')]:_0x5cfa53[_0x2a30('0x31')];if(_0x4b1f14['query']['includeAll']){_0x1acd10['include']=[{'all':!![]}];}_0x1acd10=_[_0x2a30('0x3b')]({},_0x1acd10,_0x4b1f14[_0x2a30('0x47')]);return db['SAOrder']['find'](_0x1acd10)[_0x2a30('0x25')](handleEntityNotFound(_0x311bfc,null))['then'](respondWithResult(_0x311bfc,null))[_0x2a30('0x45')](handleError(_0x311bfc,null));};exports[_0x2a30('0x48')]=function(_0xab1eaf,_0x6e98b6){return db[_0x2a30('0x2c')]['create'](_0xab1eaf[_0x2a30('0x49')],{})[_0x2a30('0x25')](respondWithResult(_0x6e98b6,0xc9))[_0x2a30('0x45')](handleError(_0x6e98b6,null));};exports[_0x2a30('0x24')]=function(_0xc33435,_0x421f1a){if(_0xc33435[_0x2a30('0x49')]['id']){delete _0xc33435[_0x2a30('0x49')]['id'];}return db[_0x2a30('0x2c')][_0x2a30('0x4a')]({'where':{'id':_0xc33435[_0x2a30('0x46')]['id']}})[_0x2a30('0x25')](handleEntityNotFound(_0x421f1a,null))[_0x2a30('0x25')](saveUpdates(_0xc33435[_0x2a30('0x49')],null))[_0x2a30('0x25')](respondWithResult(_0x421f1a,null))[_0x2a30('0x45')](handleError(_0x421f1a,null));};exports[_0x2a30('0x26')]=function(_0xe58d57,_0x81937){return db[_0x2a30('0x2c')]['find']({'where':{'id':_0xe58d57[_0x2a30('0x46')]['id']}})[_0x2a30('0x25')](handleEntityNotFound(_0x81937,null))[_0x2a30('0x25')](removeEntity(_0x81937,null))['catch'](handleError(_0x81937,null));};exports[_0x2a30('0x4b')]=function(_0x4c1f0d,_0x175a50){return db[_0x2a30('0x2c')]['describe']()[_0x2a30('0x25')](respondWithResult(_0x175a50,null))[_0x2a30('0x45')](handleError(_0x175a50,null));}; \ No newline at end of file diff --git a/server/api/saOrder/saOrder.model.js b/server/api/saOrder/saOrder.model.js index f12d6b5..550d72c 100644 --- a/server/api/saOrder/saOrder.model.js +++ b/server/api/saOrder/saOrder.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39b9=['api','moment','bluebird','rimraf','../../config/environment','./saOrder.attributes','exports','SAOrder','sa_orders','lodash','util','../../config/logger'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x39b9,0xbd));var _0x939b=function(_0x2eb299,_0x49a841){_0x2eb299=_0x2eb299-0x0;var _0x16eae3=_0x39b9[_0x2eb299];return _0x16eae3;};'use strict';var _=require(_0x939b('0x0'));var util=require(_0x939b('0x1'));var logger=require(_0x939b('0x2'))(_0x939b('0x3'));var moment=require(_0x939b('0x4'));var BPromise=require(_0x939b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x939b('0x6'));var config=require(_0x939b('0x7'));var attributes=require(_0x939b('0x8'));module[_0x939b('0x9')]=function(_0x43ca38,_0x46af33){return _0x43ca38['define'](_0x939b('0xa'),attributes,{'tableName':_0x939b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf66=['define','sa_orders','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./saOrder.attributes','exports'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0xdf66,0x157));var _0x6df6=function(_0xe0c564,_0x2ff569){_0xe0c564=_0xe0c564-0x0;var _0x32e0f6=_0xdf66[_0xe0c564];return _0x32e0f6;};'use strict';var _=require(_0x6df6('0x0'));var util=require(_0x6df6('0x1'));var logger=require(_0x6df6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6df6('0x3'));var rp=require(_0x6df6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6df6('0x5'));var config=require(_0x6df6('0x6'));var attributes=require(_0x6df6('0x7'));module[_0x6df6('0x8')]=function(_0x405040,_0x8f4e48){return _0x405040[_0x6df6('0x9')]('SAOrder',attributes,{'tableName':_0x6df6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saOrder/saOrder.rpc.js b/server/api/saOrder/saOrder.rpc.js index d60db87..cf4a136 100644 --- a/server/api/saOrder/saOrder.rpc.js +++ b/server/api/saOrder/saOrder.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8029=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SAOrder,\x20%s,\x20%s','request\x20sent','debug','SAOrder,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x39064c,_0x29660e){var _0x1960dd=function(_0x5b0828){while(--_0x5b0828){_0x39064c['push'](_0x39064c['shift']());}};_0x1960dd(++_0x29660e);}(_0x8029,0x76));var _0x9802=function(_0x3fd25e,_0x404dd9){_0x3fd25e=_0x3fd25e-0x0;var _0xb5e5d0=_0x8029[_0x3fd25e];return _0xb5e5d0;};'use strict';var _=require(_0x9802('0x0'));var util=require(_0x9802('0x1'));var moment=require(_0x9802('0x2'));var BPromise=require(_0x9802('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9802('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9802('0x5'));var logger=require(_0x9802('0x6'))(_0x9802('0x7'));var config=require('../../config/environment');var jayson=require(_0x9802('0x8'));var client=jayson[_0x9802('0x9')][_0x9802('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x551447,_0x277fb1,_0x57151d){return new BPromise(function(_0x2a9f7e,_0x2cf7da){return client[_0x9802('0xb')](_0x551447,_0x57151d)[_0x9802('0xc')](function(_0x423b98){logger[_0x9802('0xd')](_0x9802('0xe'),_0x277fb1,_0x9802('0xf'));logger[_0x9802('0x10')](_0x9802('0x11'),_0x277fb1,_0x9802('0xf'),JSON[_0x9802('0x12')](_0x423b98));if(_0x423b98[_0x9802('0x13')]){if(_0x423b98[_0x9802('0x13')][_0x9802('0x14')]===0x1f4){logger['error'](_0x9802('0xe'),_0x277fb1,_0x423b98[_0x9802('0x13')][_0x9802('0x15')]);return _0x2cf7da(_0x423b98['error'][_0x9802('0x15')]);}logger[_0x9802('0x13')]('SAOrder,\x20%s,\x20%s',_0x277fb1,_0x423b98[_0x9802('0x13')][_0x9802('0x15')]);return _0x2a9f7e(_0x423b98[_0x9802('0x13')][_0x9802('0x15')]);}else{logger[_0x9802('0xd')](_0x9802('0xe'),_0x277fb1,_0x9802('0xf'));_0x2a9f7e(_0x423b98[_0x9802('0x16')][_0x9802('0x15')]);}})[_0x9802('0x17')](function(_0x5db6c9){logger['error'](_0x9802('0xe'),_0x277fb1,_0x5db6c9);_0x2cf7da(_0x5db6c9);});});} \ No newline at end of file +var _0x1492=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SAOrder,\x20%s,\x20%s','SAOrder,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1492,0x1bc));var _0x2149=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x1492[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x2149('0x0'));var util=require(_0x2149('0x1'));var moment=require(_0x2149('0x2'));var BPromise=require(_0x2149('0x3'));var rs=require(_0x2149('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2149('0x5'));var logger=require(_0x2149('0x6'))(_0x2149('0x7'));var config=require(_0x2149('0x8'));var jayson=require(_0x2149('0x9'));var client=jayson[_0x2149('0xa')][_0x2149('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdcc95e,_0x269753,_0x429523){return new BPromise(function(_0x5cdfc4,_0x179b7d){return client['request'](_0xdcc95e,_0x429523)['then'](function(_0x50e59f){logger[_0x2149('0xc')](_0x2149('0xd'),_0x269753,'request\x20sent');logger['debug'](_0x2149('0xe'),_0x269753,_0x2149('0xf'),JSON[_0x2149('0x10')](_0x50e59f));if(_0x50e59f[_0x2149('0x11')]){if(_0x50e59f['error']['code']===0x1f4){logger[_0x2149('0x11')](_0x2149('0xd'),_0x269753,_0x50e59f[_0x2149('0x11')][_0x2149('0x12')]);return _0x179b7d(_0x50e59f['error'][_0x2149('0x12')]);}logger['error'](_0x2149('0xd'),_0x269753,_0x50e59f[_0x2149('0x11')][_0x2149('0x12')]);return _0x5cdfc4(_0x50e59f['error'][_0x2149('0x12')]);}else{logger[_0x2149('0xc')](_0x2149('0xd'),_0x269753,'request\x20sent');_0x5cdfc4(_0x50e59f[_0x2149('0x13')][_0x2149('0x12')]);}})[_0x2149('0x14')](function(_0x4e00ba){logger[_0x2149('0x11')](_0x2149('0xd'),_0x269753,_0x4e00ba);_0x179b7d(_0x4e00ba);});});} \ No newline at end of file diff --git a/server/api/saPayment/index.js b/server/api/saPayment/index.js index db2a9b3..85c10a9 100644 --- a/server/api/saPayment/index.js +++ b/server/api/saPayment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde3a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./saPayment.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','Router'];(function(_0x5f54ff,_0x20a2dd){var _0x5755fc=function(_0x25fecf){while(--_0x25fecf){_0x5f54ff['push'](_0x5f54ff['shift']());}};_0x5755fc(++_0x20a2dd);}(_0xde3a,0x140));var _0xade3=function(_0x4d8dc1,_0x3dcae4){_0x4d8dc1=_0x4d8dc1-0x0;var _0x56983a=_0xde3a[_0x4d8dc1];return _0x56983a;};'use strict';var multer=require(_0xade3('0x0'));var util=require(_0xade3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xade3('0x2')]();var auth=require(_0xade3('0x3'));var interaction=require(_0xade3('0x4'));var config=require(_0xade3('0x5'));var controller=require(_0xade3('0x6'));router[_0xade3('0x7')]('/',auth[_0xade3('0x8')](),controller[_0xade3('0x9')]);router[_0xade3('0x7')]('/describe',auth[_0xade3('0x8')](),controller[_0xade3('0xa')]);router[_0xade3('0x7')](_0xade3('0xb'),auth[_0xade3('0x8')](),controller[_0xade3('0xc')]);router[_0xade3('0xd')]('/',auth['isAuthenticated'](),controller[_0xade3('0xe')]);router[_0xade3('0xf')](_0xade3('0xb'),auth[_0xade3('0x8')](),controller[_0xade3('0x10')]);router['delete'](_0xade3('0xb'),auth[_0xade3('0x8')](),controller[_0xade3('0x11')]);module[_0xade3('0x12')]=router; \ No newline at end of file +var _0x9bc7=['show','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saPayment.controller','isAuthenticated','index','get','/:id'];(function(_0x2a3e35,_0x220d6f){var _0x2de2ca=function(_0x11f692){while(--_0x11f692){_0x2a3e35['push'](_0x2a3e35['shift']());}};_0x2de2ca(++_0x220d6f);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var path=require(_0x79bc('0x2'));var timeout=require(_0x79bc('0x3'));var express=require(_0x79bc('0x4'));var router=express[_0x79bc('0x5')]();var auth=require(_0x79bc('0x6'));var interaction=require(_0x79bc('0x7'));var config=require(_0x79bc('0x8'));var controller=require(_0x79bc('0x9'));router['get']('/',auth[_0x79bc('0xa')](),controller[_0x79bc('0xb')]);router[_0x79bc('0xc')]('/describe',auth[_0x79bc('0xa')](),controller['describe']);router[_0x79bc('0xc')](_0x79bc('0xd'),auth[_0x79bc('0xa')](),controller[_0x79bc('0xe')]);router[_0x79bc('0xf')]('/',auth['isAuthenticated'](),controller[_0x79bc('0x10')]);router['put'](_0x79bc('0xd'),auth[_0x79bc('0xa')](),controller['update']);router['delete'](_0x79bc('0xd'),auth[_0x79bc('0xa')](),controller[_0x79bc('0x11')]);module[_0x79bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/saPayment/saPayment.attributes.js b/server/api/saPayment/saPayment.attributes.js index fd46ccd..4d63872 100644 --- a/server/api/saPayment/saPayment.attributes.js +++ b/server/api/saPayment/saPayment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc907=['sequelize','exports','TEXT','DATE'];(function(_0x1bfaab,_0x5c8a92){var _0x2e73fb=function(_0x5f23fc){while(--_0x5f23fc){_0x1bfaab['push'](_0x1bfaab['shift']());}};_0x2e73fb(++_0x5c8a92);}(_0xc907,0x78));var _0x7c90=function(_0x2392e5,_0x543c85){_0x2392e5=_0x2392e5-0x0;var _0x3a2ab9=_0xc907[_0x2392e5];return _0x3a2ab9;};'use strict';var Sequelize=require(_0x7c90('0x0'));module[_0x7c90('0x1')]={'payment':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'note':{'type':Sequelize[_0x7c90('0x2')]},'companyId':{'type':Sequelize['INTEGER']},'companyName':{'type':Sequelize[_0x7c90('0x2')]},'paymentMethod':{'type':Sequelize[_0x7c90('0x2')]},'agentFullname':{'type':Sequelize['STRING']},'paymentDate':{'type':Sequelize[_0x7c90('0x3')]}}; \ No newline at end of file +var _0xa5e8=['TEXT','DATE','sequelize','exports'];(function(_0x1c7e4e,_0x580d74){var _0x1edc6d=function(_0x10de31){while(--_0x10de31){_0x1c7e4e['push'](_0x1c7e4e['shift']());}};_0x1edc6d(++_0x580d74);}(_0xa5e8,0xca));var _0x8a5e=function(_0x411296,_0x3431d4){_0x411296=_0x411296-0x0;var _0x3347f8=_0xa5e8[_0x411296];return _0x3347f8;};'use strict';var Sequelize=require(_0x8a5e('0x0'));module[_0x8a5e('0x1')]={'payment':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'note':{'type':Sequelize['TEXT']},'companyId':{'type':Sequelize['INTEGER']},'companyName':{'type':Sequelize[_0x8a5e('0x2')]},'paymentMethod':{'type':Sequelize['TEXT']},'agentFullname':{'type':Sequelize['STRING']},'paymentDate':{'type':Sequelize[_0x8a5e('0x3')]}}; \ No newline at end of file diff --git a/server/api/saPayment/saPayment.controller.js b/server/api/saPayment/saPayment.controller.js index e7ba179..89210f8 100644 --- a/server/api/saPayment/saPayment.controller.js +++ b/server/api/saPayment/saPayment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e6c=['catch','params','model','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','status','error','name','send','SAPayment','rawAttributes','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','findAll','rows'];(function(_0xfacee2,_0x29c3b0){var _0x4cc9ea=function(_0x26ed31){while(--_0x26ed31){_0xfacee2['push'](_0xfacee2['shift']());}};_0x4cc9ea(++_0x29c3b0);}(_0x9e6c,0x174));var _0xc9e6=function(_0x31bdc3,_0x2d4e98){_0x31bdc3=_0x31bdc3-0x0;var _0x2e017f=_0x9e6c[_0x31bdc3];return _0x2e017f;};'use strict';var pdf=require(_0xc9e6('0x0'));var emlformat=require(_0xc9e6('0x1'));var rimraf=require(_0xc9e6('0x2'));var zipdir=require(_0xc9e6('0x3'));var jsonpatch=require(_0xc9e6('0x4'));var rp=require(_0xc9e6('0x5'));var moment=require(_0xc9e6('0x6'));var BPromise=require(_0xc9e6('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc9e6('0x8'));var sox=require(_0xc9e6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9e6('0xa'));var squel=require(_0xc9e6('0xb'));var crypto=require(_0xc9e6('0xc'));var jsforce=require(_0xc9e6('0xd'));var deskjs=require(_0xc9e6('0xe'));var toCsv=require(_0xc9e6('0xf'));var querystring=require('querystring');var Papa=require(_0xc9e6('0x10'));var Redis=require(_0xc9e6('0x11'));var authService=require(_0xc9e6('0x12'));var qs=require(_0xc9e6('0x13'));var hardwareService=require(_0xc9e6('0x14'));var logger=require('../../config/logger')(_0xc9e6('0x15'));var utils=require(_0xc9e6('0x16'));var config=require(_0xc9e6('0x17'));var db=require(_0xc9e6('0x18'))['db'];function respondWithStatusCode(_0x5a0e30,_0x376ed2){_0x376ed2=_0x376ed2||0xcc;return function(_0x239bfd){if(_0x239bfd){return _0x5a0e30[_0xc9e6('0x19')](_0x376ed2);}return _0x5a0e30['status'](_0x376ed2)[_0xc9e6('0x1a')]();};}function respondWithResult(_0x257503,_0xf5779){_0xf5779=_0xf5779||0xc8;return function(_0x2a2567){if(_0x2a2567){return _0x257503['status'](_0xf5779)[_0xc9e6('0x1b')](_0x2a2567);}};}function respondWithFilteredResult(_0x4bb2a7,_0x36fe0c){return function(_0xd5e734){if(_0xd5e734){var _0x331a1b=_0xd5e734[_0xc9e6('0x1c')],_0x3c71e5=_0x36fe0c['offset'],_0x5382e1=_0x36fe0c[_0xc9e6('0x1d')]+_0x36fe0c['limit'],_0x571ba9;if(_0x5382e1>=_0x331a1b){_0x5382e1=_0x331a1b;_0x571ba9=0xc8;}else{_0x571ba9=0xce;}_0x4bb2a7['status'](_0x571ba9);return _0x4bb2a7[_0xc9e6('0x1e')](_0xc9e6('0x1f'),_0x3c71e5+'-'+_0x5382e1+'/'+_0x331a1b)[_0xc9e6('0x1b')](_0xd5e734);}return null;};}function patchUpdates(_0xa7e212){return function(_0x4735b0){try{jsonpatch['apply'](_0x4735b0,_0xa7e212,!![]);}catch(_0x24fb48){return BPromise[_0xc9e6('0x20')](_0x24fb48);}return _0x4735b0[_0xc9e6('0x21')]();};}function saveUpdates(_0x3dc7da,_0x4f7416){return function(_0x3d66dd){if(_0x3d66dd){return _0x3d66dd[_0xc9e6('0x22')](_0x3dc7da)[_0xc9e6('0x23')](function(_0xc3bd7d){return _0xc3bd7d;});}return null;};}function removeEntity(_0x170e74,_0x192ad9){return function(_0x572912){if(_0x572912){return _0x572912[_0xc9e6('0x24')]()[_0xc9e6('0x23')](function(){_0x170e74[_0xc9e6('0x25')](0xcc)[_0xc9e6('0x1a')]();});}};}function handleEntityNotFound(_0x28eb18,_0x56d196){return function(_0x109429){if(!_0x109429){_0x28eb18[_0xc9e6('0x19')](0x194);}return _0x109429;};}function handleError(_0x44fced,_0x1679f5){_0x1679f5=_0x1679f5||0x1f4;return function(_0x5b0be2){logger[_0xc9e6('0x26')](_0x5b0be2['stack']);if(_0x5b0be2[_0xc9e6('0x27')]){delete _0x5b0be2[_0xc9e6('0x27')];}_0x44fced['status'](_0x1679f5)[_0xc9e6('0x28')](_0x5b0be2);};}exports['index']=function(_0xe3326c,_0x309488){var _0x5bbf4b={},_0x43b601={},_0x3e4bf4={'count':0x0,'rows':[]};var _0x2c3110=db[_0xc9e6('0x29')][_0xc9e6('0x2a')];_0x43b601['model']=_[_0xc9e6('0x2b')](_0x2c3110);_0x43b601['query']=_[_0xc9e6('0x2b')](_0xe3326c[_0xc9e6('0x2c')]);_0x43b601[_0xc9e6('0x2d')]=_[_0xc9e6('0x2e')](_0x43b601['model'],_0x43b601[_0xc9e6('0x2c')]);_0x5bbf4b[_0xc9e6('0x2f')]=_['intersection'](_0x43b601['model'],qs[_0xc9e6('0x30')](_0xe3326c[_0xc9e6('0x2c')]['fields']));_0x5bbf4b['attributes']=_0x5bbf4b[_0xc9e6('0x2f')]['length']?_0x5bbf4b[_0xc9e6('0x2f')]:_0x43b601['model'];if(!_0xe3326c[_0xc9e6('0x2c')]['hasOwnProperty'](_0xc9e6('0x31'))){_0x5bbf4b[_0xc9e6('0x32')]=qs[_0xc9e6('0x32')](_0xe3326c[_0xc9e6('0x2c')][_0xc9e6('0x32')]);_0x5bbf4b[_0xc9e6('0x1d')]=qs[_0xc9e6('0x1d')](_0xe3326c[_0xc9e6('0x2c')][_0xc9e6('0x1d')]);}_0x5bbf4b[_0xc9e6('0x33')]=qs[_0xc9e6('0x34')](_0xe3326c[_0xc9e6('0x2c')][_0xc9e6('0x34')]);_0x5bbf4b[_0xc9e6('0x35')]=qs[_0xc9e6('0x2d')](_[_0xc9e6('0x36')](_0xe3326c['query'],_0x43b601['filters']));if(_0xe3326c[_0xc9e6('0x2c')]['filter']){_0x5bbf4b[_0xc9e6('0x35')]=_[_0xc9e6('0x37')](_0x5bbf4b[_0xc9e6('0x35')],{'$or':_[_0xc9e6('0x38')](_0x2c3110,function(_0x59da5e){if(_0x59da5e[_0xc9e6('0x39')][_0xc9e6('0x3a')]!==_0xc9e6('0x3b')){var _0x46e11b={};_0x46e11b[_0x59da5e[_0xc9e6('0x3c')]]={'$like':'%'+_0xe3326c[_0xc9e6('0x2c')][_0xc9e6('0x3d')]+'%'};return _0x46e11b;}})});}_0x5bbf4b=_[_0xc9e6('0x37')]({},_0x5bbf4b,_0xe3326c[_0xc9e6('0x3e')]);var _0x556314={'where':_0x5bbf4b[_0xc9e6('0x35')]};return db[_0xc9e6('0x29')][_0xc9e6('0x1c')](_0x556314)[_0xc9e6('0x23')](function(_0xa52981){_0x3e4bf4[_0xc9e6('0x1c')]=_0xa52981;if(_0xe3326c['query'][_0xc9e6('0x3f')]){_0x5bbf4b['include']=[{'all':!![]}];}return db['SAPayment'][_0xc9e6('0x40')](_0x5bbf4b);})[_0xc9e6('0x23')](function(_0x31f9c2){_0x3e4bf4[_0xc9e6('0x41')]=_0x31f9c2;return _0x3e4bf4;})['then'](respondWithFilteredResult(_0x309488,_0x5bbf4b))[_0xc9e6('0x42')](handleError(_0x309488,null));};exports['show']=function(_0x2e0a4f,_0x1cba4b){var _0x3cf14c={'raw':![],'where':{'id':_0x2e0a4f[_0xc9e6('0x43')]['id']}},_0x3223ad={};_0x3223ad[_0xc9e6('0x44')]=_[_0xc9e6('0x2b')](db[_0xc9e6('0x29')]['rawAttributes']);_0x3223ad[_0xc9e6('0x2c')]=_[_0xc9e6('0x2b')](_0x2e0a4f['query']);_0x3223ad[_0xc9e6('0x2d')]=_[_0xc9e6('0x2e')](_0x3223ad[_0xc9e6('0x44')],_0x3223ad[_0xc9e6('0x2c')]);_0x3cf14c[_0xc9e6('0x2f')]=_[_0xc9e6('0x2e')](_0x3223ad[_0xc9e6('0x44')],qs['fields'](_0x2e0a4f['query']['fields']));_0x3cf14c['attributes']=_0x3cf14c['attributes']['length']?_0x3cf14c[_0xc9e6('0x2f')]:_0x3223ad[_0xc9e6('0x44')];if(_0x2e0a4f['query']['includeAll']){_0x3cf14c['include']=[{'all':!![]}];}_0x3cf14c=_[_0xc9e6('0x37')]({},_0x3cf14c,_0x2e0a4f[_0xc9e6('0x3e')]);return db[_0xc9e6('0x29')]['find'](_0x3cf14c)[_0xc9e6('0x23')](handleEntityNotFound(_0x1cba4b,null))[_0xc9e6('0x23')](respondWithResult(_0x1cba4b,null))[_0xc9e6('0x42')](handleError(_0x1cba4b,null));};exports[_0xc9e6('0x45')]=function(_0x522a03,_0x4bca23){return db[_0xc9e6('0x29')]['create'](_0x522a03[_0xc9e6('0x46')],{})['then'](respondWithResult(_0x4bca23,0xc9))['catch'](handleError(_0x4bca23,null));};exports[_0xc9e6('0x22')]=function(_0x3a799d,_0x3d6778){if(_0x3a799d[_0xc9e6('0x46')]['id']){delete _0x3a799d[_0xc9e6('0x46')]['id'];}return db[_0xc9e6('0x29')][_0xc9e6('0x47')]({'where':{'id':_0x3a799d[_0xc9e6('0x43')]['id']}})[_0xc9e6('0x23')](handleEntityNotFound(_0x3d6778,null))['then'](saveUpdates(_0x3a799d[_0xc9e6('0x46')],null))['then'](respondWithResult(_0x3d6778,null))[_0xc9e6('0x42')](handleError(_0x3d6778,null));};exports[_0xc9e6('0x24')]=function(_0x1795d4,_0x2431f1){return db[_0xc9e6('0x29')][_0xc9e6('0x47')]({'where':{'id':_0x1795d4[_0xc9e6('0x43')]['id']}})['then'](handleEntityNotFound(_0x2431f1,null))['then'](removeEntity(_0x2431f1,null))[_0xc9e6('0x42')](handleError(_0x2431f1,null));};exports[_0xc9e6('0x48')]=function(_0x245cb3,_0x841d1d){return db[_0xc9e6('0x29')][_0xc9e6('0x48')]()[_0xc9e6('0x23')](respondWithResult(_0x841d1d,null))[_0xc9e6('0x42')](handleError(_0x841d1d,null));}; \ No newline at end of file +var _0x60dd=['Content-Range','apply','save','update','then','destroy','error','stack','name','send','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','map','type','key','VIRTUAL','field','filter','merge','SAPayment','count','includeAll','include','rows','show','params','rawAttributes','fields','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','moment','bluebird','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x60dd,0x75));var _0xd60d=function(_0x462342,_0x9ac7bd){_0x462342=_0x462342-0x0;var _0x1f948e=_0x60dd[_0x462342];return _0x1f948e;};'use strict';var pdf=require(_0xd60d('0x0'));var emlformat=require(_0xd60d('0x1'));var rimraf=require(_0xd60d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd60d('0x3'));var BPromise=require(_0xd60d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd60d('0x5'));var csv=require('to-csv');var ejs=require(_0xd60d('0x6'));var fs=require('fs');var _=require(_0xd60d('0x7'));var squel=require('squel');var crypto=require(_0xd60d('0x8'));var jsforce=require(_0xd60d('0x9'));var deskjs=require(_0xd60d('0xa'));var toCsv=require(_0xd60d('0xb'));var querystring=require(_0xd60d('0xc'));var Papa=require(_0xd60d('0xd'));var Redis=require(_0xd60d('0xe'));var authService=require(_0xd60d('0xf'));var qs=require(_0xd60d('0x10'));var hardwareService=require(_0xd60d('0x11'));var logger=require(_0xd60d('0x12'))(_0xd60d('0x13'));var utils=require(_0xd60d('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d9030,_0x5567ca){_0x5567ca=_0x5567ca||0xcc;return function(_0xc2f04a){if(_0xc2f04a){return _0x1d9030[_0xd60d('0x15')](_0x5567ca);}return _0x1d9030[_0xd60d('0x16')](_0x5567ca)[_0xd60d('0x17')]();};}function respondWithResult(_0x29cc2e,_0x8a02b9){_0x8a02b9=_0x8a02b9||0xc8;return function(_0x840d59){if(_0x840d59){return _0x29cc2e[_0xd60d('0x16')](_0x8a02b9)[_0xd60d('0x18')](_0x840d59);}};}function respondWithFilteredResult(_0x33b2a8,_0x12fabb){return function(_0x280995){if(_0x280995){var _0x1a2fb2=_0x280995['count'],_0x4cb8d3=_0x12fabb[_0xd60d('0x19')],_0x25cc58=_0x12fabb[_0xd60d('0x19')]+_0x12fabb[_0xd60d('0x1a')],_0x306d61;if(_0x25cc58>=_0x1a2fb2){_0x25cc58=_0x1a2fb2;_0x306d61=0xc8;}else{_0x306d61=0xce;}_0x33b2a8[_0xd60d('0x16')](_0x306d61);return _0x33b2a8['set'](_0xd60d('0x1b'),_0x4cb8d3+'-'+_0x25cc58+'/'+_0x1a2fb2)[_0xd60d('0x18')](_0x280995);}return null;};}function patchUpdates(_0x293fab){return function(_0x2238b9){try{jsonpatch[_0xd60d('0x1c')](_0x2238b9,_0x293fab,!![]);}catch(_0x361d80){return BPromise['reject'](_0x361d80);}return _0x2238b9[_0xd60d('0x1d')]();};}function saveUpdates(_0x1ca486,_0x1b3e9a){return function(_0x55785f){if(_0x55785f){return _0x55785f[_0xd60d('0x1e')](_0x1ca486)[_0xd60d('0x1f')](function(_0x44282c){return _0x44282c;});}return null;};}function removeEntity(_0x52c3ae,_0x253f14){return function(_0x1ffb64){if(_0x1ffb64){return _0x1ffb64[_0xd60d('0x20')]()[_0xd60d('0x1f')](function(){_0x52c3ae[_0xd60d('0x16')](0xcc)[_0xd60d('0x17')]();});}};}function handleEntityNotFound(_0x462c5b,_0x1834c5){return function(_0x4fde25){if(!_0x4fde25){_0x462c5b['sendStatus'](0x194);}return _0x4fde25;};}function handleError(_0x1caa06,_0x21112e){_0x21112e=_0x21112e||0x1f4;return function(_0x4c3038){logger[_0xd60d('0x21')](_0x4c3038[_0xd60d('0x22')]);if(_0x4c3038['name']){delete _0x4c3038[_0xd60d('0x23')];}_0x1caa06[_0xd60d('0x16')](_0x21112e)[_0xd60d('0x24')](_0x4c3038);};}exports['index']=function(_0x97394a,_0xba8d3b){var _0x3f5139={},_0x3f903a={},_0x357cab={'count':0x0,'rows':[]};var _0xd99602=db['SAPayment']['rawAttributes'];_0x3f903a[_0xd60d('0x25')]=_[_0xd60d('0x26')](_0xd99602);_0x3f903a[_0xd60d('0x27')]=_[_0xd60d('0x26')](_0x97394a[_0xd60d('0x27')]);_0x3f903a['filters']=_[_0xd60d('0x28')](_0x3f903a[_0xd60d('0x25')],_0x3f903a['query']);_0x3f5139[_0xd60d('0x29')]=_[_0xd60d('0x28')](_0x3f903a[_0xd60d('0x25')],qs['fields'](_0x97394a[_0xd60d('0x27')]['fields']));_0x3f5139['attributes']=_0x3f5139['attributes'][_0xd60d('0x2a')]?_0x3f5139['attributes']:_0x3f903a[_0xd60d('0x25')];if(!_0x97394a[_0xd60d('0x27')][_0xd60d('0x2b')](_0xd60d('0x2c'))){_0x3f5139['limit']=qs[_0xd60d('0x1a')](_0x97394a[_0xd60d('0x27')][_0xd60d('0x1a')]);_0x3f5139['offset']=qs[_0xd60d('0x19')](_0x97394a[_0xd60d('0x27')][_0xd60d('0x19')]);}_0x3f5139[_0xd60d('0x2d')]=qs[_0xd60d('0x2e')](_0x97394a['query'][_0xd60d('0x2e')]);_0x3f5139['where']=qs[_0xd60d('0x2f')](_[_0xd60d('0x30')](_0x97394a[_0xd60d('0x27')],_0x3f903a[_0xd60d('0x2f')]));if(_0x97394a[_0xd60d('0x27')]['filter']){_0x3f5139[_0xd60d('0x31')]=_['merge'](_0x3f5139[_0xd60d('0x31')],{'$or':_[_0xd60d('0x32')](_0xd99602,function(_0x55d899){if(_0x55d899[_0xd60d('0x33')][_0xd60d('0x34')]!==_0xd60d('0x35')){var _0x140667={};_0x140667[_0x55d899[_0xd60d('0x36')]]={'$like':'%'+_0x97394a[_0xd60d('0x27')][_0xd60d('0x37')]+'%'};return _0x140667;}})});}_0x3f5139=_[_0xd60d('0x38')]({},_0x3f5139,_0x97394a['options']);var _0x5e0bd5={'where':_0x3f5139[_0xd60d('0x31')]};return db[_0xd60d('0x39')][_0xd60d('0x3a')](_0x5e0bd5)['then'](function(_0x5844eb){_0x357cab[_0xd60d('0x3a')]=_0x5844eb;if(_0x97394a[_0xd60d('0x27')][_0xd60d('0x3b')]){_0x3f5139[_0xd60d('0x3c')]=[{'all':!![]}];}return db[_0xd60d('0x39')]['findAll'](_0x3f5139);})[_0xd60d('0x1f')](function(_0x301d83){_0x357cab[_0xd60d('0x3d')]=_0x301d83;return _0x357cab;})[_0xd60d('0x1f')](respondWithFilteredResult(_0xba8d3b,_0x3f5139))['catch'](handleError(_0xba8d3b,null));};exports[_0xd60d('0x3e')]=function(_0x29189a,_0x1f00a4){var _0x30f73a={'raw':![],'where':{'id':_0x29189a[_0xd60d('0x3f')]['id']}},_0x25b158={};_0x25b158[_0xd60d('0x25')]=_[_0xd60d('0x26')](db[_0xd60d('0x39')][_0xd60d('0x40')]);_0x25b158['query']=_['keys'](_0x29189a[_0xd60d('0x27')]);_0x25b158['filters']=_[_0xd60d('0x28')](_0x25b158[_0xd60d('0x25')],_0x25b158[_0xd60d('0x27')]);_0x30f73a[_0xd60d('0x29')]=_[_0xd60d('0x28')](_0x25b158[_0xd60d('0x25')],qs[_0xd60d('0x41')](_0x29189a[_0xd60d('0x27')][_0xd60d('0x41')]));_0x30f73a[_0xd60d('0x29')]=_0x30f73a[_0xd60d('0x29')][_0xd60d('0x2a')]?_0x30f73a[_0xd60d('0x29')]:_0x25b158[_0xd60d('0x25')];if(_0x29189a[_0xd60d('0x27')][_0xd60d('0x3b')]){_0x30f73a[_0xd60d('0x3c')]=[{'all':!![]}];}_0x30f73a=_[_0xd60d('0x38')]({},_0x30f73a,_0x29189a[_0xd60d('0x42')]);return db[_0xd60d('0x39')][_0xd60d('0x43')](_0x30f73a)['then'](handleEntityNotFound(_0x1f00a4,null))[_0xd60d('0x1f')](respondWithResult(_0x1f00a4,null))[_0xd60d('0x44')](handleError(_0x1f00a4,null));};exports[_0xd60d('0x45')]=function(_0x1975e3,_0x2bf291){return db[_0xd60d('0x39')][_0xd60d('0x45')](_0x1975e3[_0xd60d('0x46')],{})[_0xd60d('0x1f')](respondWithResult(_0x2bf291,0xc9))[_0xd60d('0x44')](handleError(_0x2bf291,null));};exports[_0xd60d('0x1e')]=function(_0x356c90,_0x4ab19e){if(_0x356c90[_0xd60d('0x46')]['id']){delete _0x356c90[_0xd60d('0x46')]['id'];}return db[_0xd60d('0x39')]['find']({'where':{'id':_0x356c90[_0xd60d('0x3f')]['id']}})[_0xd60d('0x1f')](handleEntityNotFound(_0x4ab19e,null))[_0xd60d('0x1f')](saveUpdates(_0x356c90[_0xd60d('0x46')],null))['then'](respondWithResult(_0x4ab19e,null))[_0xd60d('0x44')](handleError(_0x4ab19e,null));};exports[_0xd60d('0x20')]=function(_0xcc3886,_0x4c25dc){return db[_0xd60d('0x39')][_0xd60d('0x43')]({'where':{'id':_0xcc3886[_0xd60d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c25dc,null))[_0xd60d('0x1f')](removeEntity(_0x4c25dc,null))[_0xd60d('0x44')](handleError(_0x4c25dc,null));};exports[_0xd60d('0x47')]=function(_0x4924e6,_0x23d73e){return db['SAPayment'][_0xd60d('0x47')]()[_0xd60d('0x1f')](respondWithResult(_0x23d73e,null))[_0xd60d('0x44')](handleError(_0x23d73e,null));}; \ No newline at end of file diff --git a/server/api/saPayment/saPayment.model.js b/server/api/saPayment/saPayment.model.js index f0c8a3b..5cf1af9 100644 --- a/server/api/saPayment/saPayment.model.js +++ b/server/api/saPayment/saPayment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a3a=['has','InvoiceId','SAInvoice','find','then','invoice','receivingFiscalMessage','indexOf','split\x20payment','SAInvoiceDetail','findAll','details','SAPayment','payments','length','payment','netPrice','discount','tax','quantity','isNil','paid','update','invoice-->','catch','log','TCL:\x20err','SAProforma','ProformaId','proforma','SAProformaDetail','Hook\x20afterCreate:\x20err','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./saPayment.attributes','exports','define','sa_payments','models','get'];(function(_0x30345f,_0x266b42){var _0x3148c0=function(_0x583033){while(--_0x583033){_0x30345f['push'](_0x30345f['shift']());}};_0x3148c0(++_0x266b42);}(_0x3a3a,0x1e2));var _0xa3a3=function(_0x443ebf,_0x176ce8){_0x443ebf=_0x443ebf-0x0;var _0x200e4b=_0x3a3a[_0x443ebf];return _0x200e4b;};'use strict';var _=require(_0xa3a3('0x0'));var util=require('util');var logger=require(_0xa3a3('0x1'))(_0xa3a3('0x2'));var moment=require('moment');var BPromise=require(_0xa3a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3a3('0x4'));var rimraf=require(_0xa3a3('0x5'));var config=require(_0xa3a3('0x6'));var attributes=require(_0xa3a3('0x7'));module[_0xa3a3('0x8')]=function(_0x247249,_0x2c9d57){return _0x247249[_0xa3a3('0x9')]('SAPayment',attributes,{'tableName':_0xa3a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d0d7a,_0x5c2185,_0x23b612){var _0x175c29=_0x247249[_0xa3a3('0xb')];var _0x3e4b19={};var _0x2f8bc8={};var _0x2375be=_0x4d0d7a[_0xa3a3('0xc')]({'plain':!![]});if(_[_0xa3a3('0xd')](_0x2375be,_0xa3a3('0xe'))){_0x175c29[_0xa3a3('0xf')][_0xa3a3('0x10')]({'where':{'id':_0x2375be[_0xa3a3('0xe')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x5ba204){if(_0x5ba204){_0x3e4b19[_0xa3a3('0x12')]=_0x5ba204;var _0x3f394a=![];if(_0x3e4b19[_0xa3a3('0x12')][_0xa3a3('0x13')][_0xa3a3('0x14')](_0xa3a3('0x15'))!=-0x1){_0x3f394a=!![];}return _0x175c29[_0xa3a3('0x16')][_0xa3a3('0x17')]({'where':{'InvoiceId':_0x2375be[_0xa3a3('0xe')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x3237cc){_0x3e4b19[_0xa3a3('0x18')]=_0x3237cc;return _0x175c29[_0xa3a3('0x19')][_0xa3a3('0x17')]({'where':{'InvoiceId':_0x2375be[_0xa3a3('0xe')]},'raw':!![]});})[_0xa3a3('0x11')](function(_0x5db44c){_0x3e4b19[_0xa3a3('0x1a')]=_0x5db44c;var _0x4f9abf=0x0;var _0x183276=0x0;var _0x2ffd27=0x0;var _0x9fc2b1=0x0;var _0x467837=0x0;for(var _0x28d1f9=0x0;_0x28d1f9<_0x3e4b19[_0xa3a3('0x1a')][_0xa3a3('0x1b')];_0x28d1f9++){_0x4f9abf+=_0x3e4b19[_0xa3a3('0x1a')][_0x28d1f9][_0xa3a3('0x1c')];}for(var _0x28d1f9=0x0;_0x28d1f9<_0x3e4b19[_0xa3a3('0x18')]['length'];_0x28d1f9++){var _0x291f31=0x0;var _0x5e6b06=0x0;var _0x1a67da=0x0;var _0x5f43db=0x0;_0x291f31=_0x3e4b19[_0xa3a3('0x18')][_0x28d1f9]['netPrice']-_0x3e4b19[_0xa3a3('0x18')][_0x28d1f9][_0xa3a3('0x1d')]/0x64*_0x3e4b19['details'][_0x28d1f9][_0xa3a3('0x1e')];_0x5e6b06=_0x291f31/0x64*_0x3e4b19[_0xa3a3('0x18')][_0x28d1f9][_0xa3a3('0x1f')];_0x1a67da=_0x291f31*_0x3e4b19[_0xa3a3('0x18')][_0x28d1f9][_0xa3a3('0x20')];_0x5f43db=_0x5e6b06*_0x3e4b19[_0xa3a3('0x18')][_0x28d1f9]['quantity'];_0x9fc2b1+=_0x1a67da;_0x467837+=_0x5f43db;}if(!_['isNil'](_0x3e4b19[_0xa3a3('0x12')]['discount'])){var _0x55fd30=0x0;var _0x355967=0x0;var _0x56b484=_0x3e4b19[_0xa3a3('0x12')][_0xa3a3('0x1e')]*0x64/_0x9fc2b1;for(var _0x364f66=0x0;_0x364f66<_0x3e4b19[_0xa3a3('0x18')][_0xa3a3('0x1b')];_0x364f66++){var _0x45c357=0x0;var _0x45fee8=0x0;var _0x1b6321=0x0;_0x291f31=_0x3e4b19[_0xa3a3('0x18')][_0x364f66][_0xa3a3('0x1d')]-_0x3e4b19['details'][_0x364f66][_0xa3a3('0x1d')]/0x64*_0x3e4b19[_0xa3a3('0x18')][_0x364f66][_0xa3a3('0x1e')];_0x45c357=_0x291f31/0x64*_0x56b484;_0x45fee8=_0x291f31-_0x45c357;_0x1b6321=_0x45fee8*_0x3e4b19[_0xa3a3('0x18')][_0x364f66][_0xa3a3('0x20')];_0x55fd30+=_0x1b6321;_0x355967+=_0x1b6321/0x64*_0x3e4b19[_0xa3a3('0x18')][_0x364f66]['tax'];}}if(!_[_0xa3a3('0x21')](_0x3e4b19[_0xa3a3('0x12')][_0xa3a3('0x1e')])){if(_0x3f394a){_0x183276=_0x55fd30;}else{_0x183276=_0x355967+_0x55fd30;}}else{if(_0x3f394a){_0x183276=_0x9fc2b1;}else{_0x183276=_0x467837+_0x9fc2b1;}}if(_0x4f9abf==_0x183276){_0x3e4b19[_0xa3a3('0x12')]['paid']=0x1;}if(_0x4f9abf<_0x183276){_0x3e4b19[_0xa3a3('0x12')]['paid']=0x2;}if(_0x4f9abf>_0x183276){_0x3e4b19[_0xa3a3('0x12')][_0xa3a3('0x22')]=0x3;}_0x175c29[_0xa3a3('0xf')][_0xa3a3('0x23')](_0x3e4b19[_0xa3a3('0x12')],{'where':{'id':_0x2375be[_0xa3a3('0xe')]}})['then'](function(_0x11d4f6){console['log'](_0xa3a3('0x24'),_0x11d4f6);})[_0xa3a3('0x25')](function(_0x2acd56){console[_0xa3a3('0x26')](_0xa3a3('0x27'),_0x2acd56);});});}});}else{_0x175c29[_0xa3a3('0x28')][_0xa3a3('0x10')]({'where':{'id':_0x2375be[_0xa3a3('0x29')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x3b7120){if(_0x3b7120){_0x2f8bc8[_0xa3a3('0x2a')]=_0x3b7120;var _0x1eb983=![];if(_0x2f8bc8[_0xa3a3('0x2a')][_0xa3a3('0x13')][_0xa3a3('0x14')](_0xa3a3('0x15'))!=-0x1){_0x1eb983=!![];}return _0x175c29[_0xa3a3('0x2b')]['findAll']({'where':{'ProformaId':_0x2375be[_0xa3a3('0x29')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x251a0c){_0x2f8bc8[_0xa3a3('0x18')]=_0x251a0c;return _0x175c29[_0xa3a3('0x19')][_0xa3a3('0x17')]({'where':{'ProformaId':_0x2375be[_0xa3a3('0x29')]},'raw':!![]});})[_0xa3a3('0x11')](function(_0x4d8476){_0x2f8bc8[_0xa3a3('0x1a')]=_0x4d8476;var _0x2864ba=0x0;var _0x205ad7=0x0;var _0x2d7697=0x0;var _0x5a208b=0x0;var _0x51c7bd=0x0;for(var _0x30216e=0x0;_0x30216e<_0x2f8bc8['payments']['length'];_0x30216e++){_0x2864ba+=_0x2f8bc8['payments'][_0x30216e][_0xa3a3('0x1c')];}for(var _0x30216e=0x0;_0x30216e<_0x2f8bc8['details'][_0xa3a3('0x1b')];_0x30216e++){var _0x5ad1b9=0x0;var _0x1dd772=0x0;var _0x15fc6e=0x0;var _0x4ff362=0x0;_0x5ad1b9=_0x2f8bc8[_0xa3a3('0x18')][_0x30216e][_0xa3a3('0x1d')]-_0x2f8bc8[_0xa3a3('0x18')][_0x30216e][_0xa3a3('0x1d')]/0x64*_0x2f8bc8[_0xa3a3('0x18')][_0x30216e][_0xa3a3('0x1e')];_0x1dd772=_0x5ad1b9/0x64*_0x2f8bc8[_0xa3a3('0x18')][_0x30216e]['tax'];_0x15fc6e=_0x5ad1b9*_0x2f8bc8['details'][_0x30216e][_0xa3a3('0x20')];_0x4ff362=_0x1dd772*_0x2f8bc8['details'][_0x30216e]['quantity'];_0x5a208b+=_0x15fc6e;_0x51c7bd+=_0x4ff362;}if(!_[_0xa3a3('0x21')](_0x2f8bc8[_0xa3a3('0x2a')][_0xa3a3('0x1e')])){var _0x515451=0x0;var _0x3701c8=0x0;var _0x239dfd=_0x2f8bc8[_0xa3a3('0x2a')]['discount']*0x64/_0x5a208b;for(var _0x41f2c6=0x0;_0x41f2c6<_0x2f8bc8[_0xa3a3('0x18')]['length'];_0x41f2c6++){var _0xfe7228=0x0;var _0x2047e8=0x0;var _0x5b922a=0x0;_0x5ad1b9=_0x2f8bc8[_0xa3a3('0x18')][_0x41f2c6]['netPrice']-_0x2f8bc8[_0xa3a3('0x18')][_0x41f2c6]['netPrice']/0x64*_0x2f8bc8['details'][_0x41f2c6][_0xa3a3('0x1e')];_0xfe7228=_0x5ad1b9/0x64*_0x239dfd;_0x2047e8=_0x5ad1b9-_0xfe7228;_0x5b922a=_0x2047e8*_0x2f8bc8[_0xa3a3('0x18')][_0x41f2c6][_0xa3a3('0x20')];_0x515451+=_0x5b922a;_0x3701c8+=_0x5b922a/0x64*_0x2f8bc8[_0xa3a3('0x18')][_0x41f2c6][_0xa3a3('0x1f')];}}if(!_['isNil'](_0x2f8bc8[_0xa3a3('0x2a')][_0xa3a3('0x1e')])){if(_0x1eb983){_0x205ad7=_0x515451;}else{_0x205ad7=_0x3701c8+_0x515451;}}else{if(_0x1eb983){_0x205ad7=_0x5a208b;}else{_0x205ad7=_0x51c7bd+_0x5a208b;}}if(_0x2864ba==_0x205ad7){_0x2f8bc8[_0xa3a3('0x2a')][_0xa3a3('0x22')]=0x1;}if(_0x2864ba<_0x205ad7){_0x2f8bc8[_0xa3a3('0x2a')]['paid']=0x2;}if(_0x2864ba>_0x205ad7){_0x2f8bc8['proforma'][_0xa3a3('0x22')]=0x3;}_0x175c29['SAProforma'][_0xa3a3('0x23')](_0x2f8bc8[_0xa3a3('0x2a')],{'where':{'id':_0x2375be['ProformaId']}})[_0xa3a3('0x11')](function(_0x1557c6){})[_0xa3a3('0x25')](function(_0x18f182){console['log'](_0xa3a3('0x2c'),_0x18f182);});});}});}_0x23b612();},'afterUpdate':function(_0x148f42,_0x16aa69,_0x119ba0){var _0x19a05c=_0x247249['models'];var _0x850da1={};var _0x3c454f={};var _0x1ebf33=_0x148f42[_0xa3a3('0xc')]({'plain':!![]});if(_['has'](_0x1ebf33,_0xa3a3('0xe'))){_0x19a05c[_0xa3a3('0xf')][_0xa3a3('0x10')]({'where':{'id':_0x1ebf33[_0xa3a3('0xe')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x5bee33){if(_0x5bee33){_0x850da1['invoice']=_0x5bee33;var _0x160a9a=![];if(_0x850da1[_0xa3a3('0x12')][_0xa3a3('0x13')][_0xa3a3('0x14')]('split\x20payment')!=-0x1){_0x160a9a=!![];}return _0x19a05c[_0xa3a3('0x16')][_0xa3a3('0x17')]({'where':{'InvoiceId':_0x1ebf33[_0xa3a3('0xe')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x3ccec1){_0x850da1['details']=_0x3ccec1;return _0x19a05c[_0xa3a3('0x19')][_0xa3a3('0x17')]({'where':{'InvoiceId':_0x1ebf33[_0xa3a3('0xe')]},'raw':!![]});})['then'](function(_0xe17afe){_0x850da1['payments']=_0xe17afe;var _0x20af11=0x0;var _0x5b1689=0x0;var _0x51e08e=0x0;var _0x54779f=0x0;var _0x5ea3c9=0x0;for(var _0x275a86=0x0;_0x275a86<_0x850da1[_0xa3a3('0x1a')][_0xa3a3('0x1b')];_0x275a86++){_0x20af11+=_0x850da1[_0xa3a3('0x1a')][_0x275a86][_0xa3a3('0x1c')];}for(var _0x275a86=0x0;_0x275a86<_0x850da1[_0xa3a3('0x18')][_0xa3a3('0x1b')];_0x275a86++){var _0x23887f=0x0;var _0x273497=0x0;var _0x437752=0x0;var _0x10e8e5=0x0;_0x23887f=_0x850da1[_0xa3a3('0x18')][_0x275a86][_0xa3a3('0x1d')]-_0x850da1[_0xa3a3('0x18')][_0x275a86]['netPrice']/0x64*_0x850da1[_0xa3a3('0x18')][_0x275a86][_0xa3a3('0x1e')];_0x273497=_0x23887f/0x64*_0x850da1['details'][_0x275a86][_0xa3a3('0x1f')];_0x437752=_0x23887f*_0x850da1[_0xa3a3('0x18')][_0x275a86][_0xa3a3('0x20')];_0x10e8e5=_0x273497*_0x850da1['details'][_0x275a86]['quantity'];_0x54779f+=_0x437752;_0x5ea3c9+=_0x10e8e5;}if(!_[_0xa3a3('0x21')](_0x850da1[_0xa3a3('0x12')][_0xa3a3('0x1e')])){var _0x577ffd=0x0;var _0x4c7af8=0x0;var _0x3436df=_0x850da1['invoice']['discount']*0x64/_0x54779f;for(var _0xddbe3a=0x0;_0xddbe3a<_0x850da1[_0xa3a3('0x18')]['length'];_0xddbe3a++){var _0xc8dfc5=0x0;var _0x4e8a48=0x0;var _0x5c506e=0x0;_0x23887f=_0x850da1[_0xa3a3('0x18')][_0xddbe3a][_0xa3a3('0x1d')]-_0x850da1[_0xa3a3('0x18')][_0xddbe3a][_0xa3a3('0x1d')]/0x64*_0x850da1[_0xa3a3('0x18')][_0xddbe3a][_0xa3a3('0x1e')];_0xc8dfc5=_0x23887f/0x64*_0x3436df;_0x4e8a48=_0x23887f-_0xc8dfc5;_0x5c506e=_0x4e8a48*_0x850da1['details'][_0xddbe3a][_0xa3a3('0x20')];_0x577ffd+=_0x5c506e;_0x4c7af8+=_0x5c506e/0x64*_0x850da1[_0xa3a3('0x18')][_0xddbe3a]['tax'];}}if(!_[_0xa3a3('0x21')](_0x850da1[_0xa3a3('0x12')][_0xa3a3('0x1e')])){if(_0x160a9a){_0x5b1689=_0x577ffd;}else{_0x5b1689=_0x4c7af8+_0x577ffd;}}else{if(_0x160a9a){_0x5b1689=_0x54779f;}else{_0x5b1689=_0x5ea3c9+_0x54779f;}}if(_0x20af11==_0x5b1689){_0x850da1[_0xa3a3('0x12')]['paid']=0x1;}if(_0x20af11<_0x5b1689){_0x850da1[_0xa3a3('0x12')][_0xa3a3('0x22')]=0x2;}if(_0x20af11>_0x5b1689){_0x850da1[_0xa3a3('0x12')][_0xa3a3('0x22')]=0x3;}_0x19a05c[_0xa3a3('0xf')][_0xa3a3('0x23')](_0x850da1[_0xa3a3('0x12')],{'where':{'id':_0x1ebf33['InvoiceId']}})[_0xa3a3('0x11')](function(_0x4641af){console[_0xa3a3('0x26')](_0xa3a3('0x24'),_0x4641af);})[_0xa3a3('0x25')](function(_0x17c9f9){console[_0xa3a3('0x26')](_0xa3a3('0x27'),_0x17c9f9);});});}});}else{_0x19a05c['SAProforma'][_0xa3a3('0x10')]({'where':{'id':_0x1ebf33[_0xa3a3('0x29')]},'raw':!![]})['then'](function(_0x466fe9){if(_0x466fe9){_0x3c454f[_0xa3a3('0x2a')]=_0x466fe9;var _0x3eb672=![];if(_0x850da1['invoice'][_0xa3a3('0x13')][_0xa3a3('0x14')]('split\x20payment')!=-0x1){_0x3eb672=!![];}return _0x19a05c['SAProformaDetail']['findAll']({'where':{'ProformaId':_0x1ebf33[_0xa3a3('0x29')]},'raw':!![]})[_0xa3a3('0x11')](function(_0x2d5e9b){_0x3c454f[_0xa3a3('0x18')]=_0x2d5e9b;return _0x19a05c[_0xa3a3('0x19')][_0xa3a3('0x17')]({'where':{'ProformaId':_0x1ebf33[_0xa3a3('0x29')]},'raw':!![]});})[_0xa3a3('0x11')](function(_0x5bbd23){_0x3c454f['payments']=_0x5bbd23;var _0x5ba0bc=0x0;var _0x554c5a=0x0;var _0x4833f2=0x0;var _0x1147f9=0x0;var _0x7a1299=0x0;for(var _0x32c9ea=0x0;_0x32c9ea<_0x3c454f[_0xa3a3('0x1a')][_0xa3a3('0x1b')];_0x32c9ea++){_0x5ba0bc+=_0x3c454f[_0xa3a3('0x1a')][_0x32c9ea][_0xa3a3('0x1c')];}for(var _0x32c9ea=0x0;_0x32c9ea<_0x3c454f[_0xa3a3('0x18')][_0xa3a3('0x1b')];_0x32c9ea++){var _0x83df44=0x0;var _0x4f911c=0x0;var _0x4ab37f=0x0;var _0x4ae60d=0x0;_0x83df44=_0x3c454f[_0xa3a3('0x18')][_0x32c9ea][_0xa3a3('0x1d')]-_0x3c454f[_0xa3a3('0x18')][_0x32c9ea][_0xa3a3('0x1d')]/0x64*_0x3c454f[_0xa3a3('0x18')][_0x32c9ea][_0xa3a3('0x1e')];_0x4f911c=_0x83df44/0x64*_0x3c454f[_0xa3a3('0x18')][_0x32c9ea][_0xa3a3('0x1f')];_0x4ab37f=_0x83df44*_0x3c454f[_0xa3a3('0x18')][_0x32c9ea][_0xa3a3('0x20')];_0x4ae60d=_0x4f911c*_0x3c454f[_0xa3a3('0x18')][_0x32c9ea]['quantity'];_0x1147f9+=_0x4ab37f;_0x7a1299+=_0x4ae60d;}if(!_[_0xa3a3('0x21')](_0x3c454f[_0xa3a3('0x2a')][_0xa3a3('0x1e')])){var _0x159b91=0x0;var _0x476324=0x0;var _0x50bffa=_0x3c454f[_0xa3a3('0x2a')][_0xa3a3('0x1e')]*0x64/_0x1147f9;for(var _0xf833ec=0x0;_0xf833ec<_0x3c454f[_0xa3a3('0x18')][_0xa3a3('0x1b')];_0xf833ec++){var _0x2c2a12=0x0;var _0x44fb5c=0x0;var _0x3a44a7=0x0;_0x83df44=_0x3c454f[_0xa3a3('0x18')][_0xf833ec][_0xa3a3('0x1d')]-_0x3c454f[_0xa3a3('0x18')][_0xf833ec][_0xa3a3('0x1d')]/0x64*_0x3c454f[_0xa3a3('0x18')][_0xf833ec][_0xa3a3('0x1e')];_0x2c2a12=_0x83df44/0x64*_0x50bffa;_0x44fb5c=_0x83df44-_0x2c2a12;_0x3a44a7=_0x44fb5c*_0x3c454f[_0xa3a3('0x18')][_0xf833ec]['quantity'];_0x159b91+=_0x3a44a7;_0x476324+=_0x3a44a7/0x64*_0x3c454f['details'][_0xf833ec][_0xa3a3('0x1f')];}}if(!_[_0xa3a3('0x21')](_0x3c454f[_0xa3a3('0x2a')][_0xa3a3('0x1e')])){if(_0x3eb672){_0x554c5a=_0x159b91;}else{_0x554c5a=_0x476324+_0x159b91;}}else{if(_0x3eb672){_0x554c5a=_0x1147f9;}else{_0x554c5a=_0x7a1299+_0x1147f9;}}if(_0x5ba0bc==_0x554c5a){_0x3c454f['proforma'][_0xa3a3('0x22')]=0x1;}if(_0x5ba0bc<_0x554c5a){_0x3c454f[_0xa3a3('0x2a')][_0xa3a3('0x22')]=0x2;}if(_0x5ba0bc>_0x554c5a){_0x3c454f[_0xa3a3('0x2a')]['paid']=0x3;}_0x19a05c[_0xa3a3('0x28')][_0xa3a3('0x23')](_0x3c454f[_0xa3a3('0x2a')],{'where':{'id':_0x1ebf33[_0xa3a3('0x29')]}})[_0xa3a3('0x11')](function(_0x4205e3){})['catch'](function(_0x297ae1){console['log'](_0xa3a3('0x2c'),_0x297ae1);});});}});}_0x119ba0();}}});}; \ No newline at end of file +var _0xb6b1=['find','InvoiceId','then','invoice','receivingFiscalMessage','indexOf','split\x20payment','SAInvoiceDetail','details','SAPayment','findAll','payments','length','payment','netPrice','discount','quantity','isNil','tax','paid','log','invoice-->','catch','TCL:\x20err','ProformaId','proforma','SAProformaDetail','SAProforma','update','Hook\x20afterCreate:\x20err','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','sa_payments','models','has','SAInvoice'];(function(_0x554b8f,_0x50ea37){var _0x198fdc=function(_0x56185f){while(--_0x56185f){_0x554b8f['push'](_0x554b8f['shift']());}};_0x198fdc(++_0x50ea37);}(_0xb6b1,0x198));var _0x1b6b=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0xb6b1[_0x137d1d];return _0x485108;};'use strict';var _=require(_0x1b6b('0x0'));var util=require(_0x1b6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1b6b('0x2'));var BPromise=require(_0x1b6b('0x3'));var rp=require(_0x1b6b('0x4'));var fs=require('fs');var path=require(_0x1b6b('0x5'));var rimraf=require(_0x1b6b('0x6'));var config=require(_0x1b6b('0x7'));var attributes=require('./saPayment.attributes');module['exports']=function(_0x3005c0,_0x2fa2f8){return _0x3005c0['define']('SAPayment',attributes,{'tableName':_0x1b6b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35a7e3,_0x433aa8,_0x47a095){var _0x1894b8=_0x3005c0[_0x1b6b('0x9')];var _0x43921a={};var _0x12c661={};var _0xa570e2=_0x35a7e3['get']({'plain':!![]});if(_[_0x1b6b('0xa')](_0xa570e2,'InvoiceId')){_0x1894b8[_0x1b6b('0xb')][_0x1b6b('0xc')]({'where':{'id':_0xa570e2[_0x1b6b('0xd')]},'raw':!![]})[_0x1b6b('0xe')](function(_0x13e99f){if(_0x13e99f){_0x43921a[_0x1b6b('0xf')]=_0x13e99f;var _0x52ec20=![];if(_0x43921a[_0x1b6b('0xf')][_0x1b6b('0x10')][_0x1b6b('0x11')](_0x1b6b('0x12'))!=-0x1){_0x52ec20=!![];}return _0x1894b8[_0x1b6b('0x13')]['findAll']({'where':{'InvoiceId':_0xa570e2[_0x1b6b('0xd')]},'raw':!![]})['then'](function(_0xf25ec2){_0x43921a[_0x1b6b('0x14')]=_0xf25ec2;return _0x1894b8[_0x1b6b('0x15')][_0x1b6b('0x16')]({'where':{'InvoiceId':_0xa570e2[_0x1b6b('0xd')]},'raw':!![]});})['then'](function(_0x5421fa){_0x43921a[_0x1b6b('0x17')]=_0x5421fa;var _0x42ad40=0x0;var _0x148496=0x0;var _0x2789aa=0x0;var _0x1f03de=0x0;var _0x4a4914=0x0;for(var _0x1b55e4=0x0;_0x1b55e4<_0x43921a[_0x1b6b('0x17')][_0x1b6b('0x18')];_0x1b55e4++){_0x42ad40+=_0x43921a['payments'][_0x1b55e4][_0x1b6b('0x19')];}for(var _0x1b55e4=0x0;_0x1b55e4<_0x43921a['details'][_0x1b6b('0x18')];_0x1b55e4++){var _0x131f13=0x0;var _0x15eae7=0x0;var _0x56c0ea=0x0;var _0x3338b5=0x0;_0x131f13=_0x43921a[_0x1b6b('0x14')][_0x1b55e4][_0x1b6b('0x1a')]-_0x43921a[_0x1b6b('0x14')][_0x1b55e4]['netPrice']/0x64*_0x43921a['details'][_0x1b55e4][_0x1b6b('0x1b')];_0x15eae7=_0x131f13/0x64*_0x43921a[_0x1b6b('0x14')][_0x1b55e4]['tax'];_0x56c0ea=_0x131f13*_0x43921a[_0x1b6b('0x14')][_0x1b55e4]['quantity'];_0x3338b5=_0x15eae7*_0x43921a[_0x1b6b('0x14')][_0x1b55e4][_0x1b6b('0x1c')];_0x1f03de+=_0x56c0ea;_0x4a4914+=_0x3338b5;}if(!_[_0x1b6b('0x1d')](_0x43921a[_0x1b6b('0xf')][_0x1b6b('0x1b')])){var _0x2a9665=0x0;var _0x132a83=0x0;var _0x8d5996=_0x43921a['invoice'][_0x1b6b('0x1b')]*0x64/_0x1f03de;for(var _0x4a2dc8=0x0;_0x4a2dc8<_0x43921a[_0x1b6b('0x14')]['length'];_0x4a2dc8++){var _0x4f37bc=0x0;var _0x21d958=0x0;var _0x5ddc99=0x0;_0x131f13=_0x43921a[_0x1b6b('0x14')][_0x4a2dc8][_0x1b6b('0x1a')]-_0x43921a[_0x1b6b('0x14')][_0x4a2dc8][_0x1b6b('0x1a')]/0x64*_0x43921a[_0x1b6b('0x14')][_0x4a2dc8][_0x1b6b('0x1b')];_0x4f37bc=_0x131f13/0x64*_0x8d5996;_0x21d958=_0x131f13-_0x4f37bc;_0x5ddc99=_0x21d958*_0x43921a[_0x1b6b('0x14')][_0x4a2dc8][_0x1b6b('0x1c')];_0x2a9665+=_0x5ddc99;_0x132a83+=_0x5ddc99/0x64*_0x43921a[_0x1b6b('0x14')][_0x4a2dc8][_0x1b6b('0x1e')];}}if(!_[_0x1b6b('0x1d')](_0x43921a[_0x1b6b('0xf')]['discount'])){if(_0x52ec20){_0x148496=_0x2a9665;}else{_0x148496=_0x132a83+_0x2a9665;}}else{if(_0x52ec20){_0x148496=_0x1f03de;}else{_0x148496=_0x4a4914+_0x1f03de;}}if(_0x42ad40==_0x148496){_0x43921a[_0x1b6b('0xf')][_0x1b6b('0x1f')]=0x1;}if(_0x42ad40<_0x148496){_0x43921a['invoice'][_0x1b6b('0x1f')]=0x2;}if(_0x42ad40>_0x148496){_0x43921a[_0x1b6b('0xf')]['paid']=0x3;}_0x1894b8[_0x1b6b('0xb')]['update'](_0x43921a['invoice'],{'where':{'id':_0xa570e2['InvoiceId']}})[_0x1b6b('0xe')](function(_0x5c2ef4){console[_0x1b6b('0x20')](_0x1b6b('0x21'),_0x5c2ef4);})[_0x1b6b('0x22')](function(_0x4fd612){console['log'](_0x1b6b('0x23'),_0x4fd612);});});}});}else{_0x1894b8['SAProforma'][_0x1b6b('0xc')]({'where':{'id':_0xa570e2[_0x1b6b('0x24')]},'raw':!![]})[_0x1b6b('0xe')](function(_0xf9e608){if(_0xf9e608){_0x12c661[_0x1b6b('0x25')]=_0xf9e608;var _0x1f8013=![];if(_0x12c661[_0x1b6b('0x25')][_0x1b6b('0x10')]['indexOf'](_0x1b6b('0x12'))!=-0x1){_0x1f8013=!![];}return _0x1894b8[_0x1b6b('0x26')][_0x1b6b('0x16')]({'where':{'ProformaId':_0xa570e2[_0x1b6b('0x24')]},'raw':!![]})[_0x1b6b('0xe')](function(_0x597e4a){_0x12c661['details']=_0x597e4a;return _0x1894b8['SAPayment'][_0x1b6b('0x16')]({'where':{'ProformaId':_0xa570e2['ProformaId']},'raw':!![]});})[_0x1b6b('0xe')](function(_0x5943a7){_0x12c661[_0x1b6b('0x17')]=_0x5943a7;var _0x81db88=0x0;var _0x456607=0x0;var _0x492c10=0x0;var _0xa23a25=0x0;var _0x3b3bc5=0x0;for(var _0x50ff2f=0x0;_0x50ff2f<_0x12c661[_0x1b6b('0x17')][_0x1b6b('0x18')];_0x50ff2f++){_0x81db88+=_0x12c661[_0x1b6b('0x17')][_0x50ff2f][_0x1b6b('0x19')];}for(var _0x50ff2f=0x0;_0x50ff2f<_0x12c661[_0x1b6b('0x14')][_0x1b6b('0x18')];_0x50ff2f++){var _0x3f850b=0x0;var _0x24579b=0x0;var _0x5284fb=0x0;var _0x179198=0x0;_0x3f850b=_0x12c661[_0x1b6b('0x14')][_0x50ff2f]['netPrice']-_0x12c661['details'][_0x50ff2f][_0x1b6b('0x1a')]/0x64*_0x12c661[_0x1b6b('0x14')][_0x50ff2f][_0x1b6b('0x1b')];_0x24579b=_0x3f850b/0x64*_0x12c661['details'][_0x50ff2f][_0x1b6b('0x1e')];_0x5284fb=_0x3f850b*_0x12c661[_0x1b6b('0x14')][_0x50ff2f][_0x1b6b('0x1c')];_0x179198=_0x24579b*_0x12c661[_0x1b6b('0x14')][_0x50ff2f][_0x1b6b('0x1c')];_0xa23a25+=_0x5284fb;_0x3b3bc5+=_0x179198;}if(!_[_0x1b6b('0x1d')](_0x12c661[_0x1b6b('0x25')]['discount'])){var _0x1ef88f=0x0;var _0x1d7d8c=0x0;var _0x55ca92=_0x12c661[_0x1b6b('0x25')][_0x1b6b('0x1b')]*0x64/_0xa23a25;for(var _0x5a0104=0x0;_0x5a0104<_0x12c661[_0x1b6b('0x14')][_0x1b6b('0x18')];_0x5a0104++){var _0x5c605f=0x0;var _0x13e0d2=0x0;var _0x48fc19=0x0;_0x3f850b=_0x12c661[_0x1b6b('0x14')][_0x5a0104][_0x1b6b('0x1a')]-_0x12c661[_0x1b6b('0x14')][_0x5a0104][_0x1b6b('0x1a')]/0x64*_0x12c661[_0x1b6b('0x14')][_0x5a0104]['discount'];_0x5c605f=_0x3f850b/0x64*_0x55ca92;_0x13e0d2=_0x3f850b-_0x5c605f;_0x48fc19=_0x13e0d2*_0x12c661[_0x1b6b('0x14')][_0x5a0104]['quantity'];_0x1ef88f+=_0x48fc19;_0x1d7d8c+=_0x48fc19/0x64*_0x12c661[_0x1b6b('0x14')][_0x5a0104][_0x1b6b('0x1e')];}}if(!_[_0x1b6b('0x1d')](_0x12c661['proforma'][_0x1b6b('0x1b')])){if(_0x1f8013){_0x456607=_0x1ef88f;}else{_0x456607=_0x1d7d8c+_0x1ef88f;}}else{if(_0x1f8013){_0x456607=_0xa23a25;}else{_0x456607=_0x3b3bc5+_0xa23a25;}}if(_0x81db88==_0x456607){_0x12c661[_0x1b6b('0x25')]['paid']=0x1;}if(_0x81db88<_0x456607){_0x12c661['proforma'][_0x1b6b('0x1f')]=0x2;}if(_0x81db88>_0x456607){_0x12c661[_0x1b6b('0x25')]['paid']=0x3;}_0x1894b8[_0x1b6b('0x27')][_0x1b6b('0x28')](_0x12c661[_0x1b6b('0x25')],{'where':{'id':_0xa570e2[_0x1b6b('0x24')]}})[_0x1b6b('0xe')](function(_0x2b2c5e){})['catch'](function(_0x3b1254){console['log'](_0x1b6b('0x29'),_0x3b1254);});});}});}_0x47a095();},'afterUpdate':function(_0x1f1f38,_0x436863,_0x401fb4){var _0x2166ae=_0x3005c0[_0x1b6b('0x9')];var _0x3c315d={};var _0x35d362={};var _0x42146d=_0x1f1f38['get']({'plain':!![]});if(_[_0x1b6b('0xa')](_0x42146d,'InvoiceId')){_0x2166ae['SAInvoice'][_0x1b6b('0xc')]({'where':{'id':_0x42146d[_0x1b6b('0xd')]},'raw':!![]})[_0x1b6b('0xe')](function(_0x5beaea){if(_0x5beaea){_0x3c315d[_0x1b6b('0xf')]=_0x5beaea;var _0x524526=![];if(_0x3c315d[_0x1b6b('0xf')][_0x1b6b('0x10')][_0x1b6b('0x11')](_0x1b6b('0x12'))!=-0x1){_0x524526=!![];}return _0x2166ae[_0x1b6b('0x13')]['findAll']({'where':{'InvoiceId':_0x42146d[_0x1b6b('0xd')]},'raw':!![]})['then'](function(_0x59e59d){_0x3c315d['details']=_0x59e59d;return _0x2166ae['SAPayment']['findAll']({'where':{'InvoiceId':_0x42146d[_0x1b6b('0xd')]},'raw':!![]});})['then'](function(_0x52284b){_0x3c315d[_0x1b6b('0x17')]=_0x52284b;var _0x3a8a17=0x0;var _0xc6f06a=0x0;var _0x2eb51f=0x0;var _0x298229=0x0;var _0x18ad3e=0x0;for(var _0x2b3184=0x0;_0x2b3184<_0x3c315d['payments'][_0x1b6b('0x18')];_0x2b3184++){_0x3a8a17+=_0x3c315d['payments'][_0x2b3184]['payment'];}for(var _0x2b3184=0x0;_0x2b3184<_0x3c315d['details'][_0x1b6b('0x18')];_0x2b3184++){var _0x3adbf4=0x0;var _0x239bdb=0x0;var _0x55093f=0x0;var _0x3e3dbe=0x0;_0x3adbf4=_0x3c315d[_0x1b6b('0x14')][_0x2b3184][_0x1b6b('0x1a')]-_0x3c315d['details'][_0x2b3184][_0x1b6b('0x1a')]/0x64*_0x3c315d[_0x1b6b('0x14')][_0x2b3184][_0x1b6b('0x1b')];_0x239bdb=_0x3adbf4/0x64*_0x3c315d[_0x1b6b('0x14')][_0x2b3184][_0x1b6b('0x1e')];_0x55093f=_0x3adbf4*_0x3c315d[_0x1b6b('0x14')][_0x2b3184][_0x1b6b('0x1c')];_0x3e3dbe=_0x239bdb*_0x3c315d[_0x1b6b('0x14')][_0x2b3184][_0x1b6b('0x1c')];_0x298229+=_0x55093f;_0x18ad3e+=_0x3e3dbe;}if(!_[_0x1b6b('0x1d')](_0x3c315d[_0x1b6b('0xf')][_0x1b6b('0x1b')])){var _0x20413d=0x0;var _0x4b4a92=0x0;var _0x1a5383=_0x3c315d[_0x1b6b('0xf')][_0x1b6b('0x1b')]*0x64/_0x298229;for(var _0x327f5b=0x0;_0x327f5b<_0x3c315d[_0x1b6b('0x14')][_0x1b6b('0x18')];_0x327f5b++){var _0x551e10=0x0;var _0x41b5e6=0x0;var _0x1aec26=0x0;_0x3adbf4=_0x3c315d[_0x1b6b('0x14')][_0x327f5b][_0x1b6b('0x1a')]-_0x3c315d[_0x1b6b('0x14')][_0x327f5b]['netPrice']/0x64*_0x3c315d['details'][_0x327f5b][_0x1b6b('0x1b')];_0x551e10=_0x3adbf4/0x64*_0x1a5383;_0x41b5e6=_0x3adbf4-_0x551e10;_0x1aec26=_0x41b5e6*_0x3c315d['details'][_0x327f5b][_0x1b6b('0x1c')];_0x20413d+=_0x1aec26;_0x4b4a92+=_0x1aec26/0x64*_0x3c315d[_0x1b6b('0x14')][_0x327f5b][_0x1b6b('0x1e')];}}if(!_['isNil'](_0x3c315d[_0x1b6b('0xf')][_0x1b6b('0x1b')])){if(_0x524526){_0xc6f06a=_0x20413d;}else{_0xc6f06a=_0x4b4a92+_0x20413d;}}else{if(_0x524526){_0xc6f06a=_0x298229;}else{_0xc6f06a=_0x18ad3e+_0x298229;}}if(_0x3a8a17==_0xc6f06a){_0x3c315d['invoice'][_0x1b6b('0x1f')]=0x1;}if(_0x3a8a17<_0xc6f06a){_0x3c315d[_0x1b6b('0xf')][_0x1b6b('0x1f')]=0x2;}if(_0x3a8a17>_0xc6f06a){_0x3c315d['invoice'][_0x1b6b('0x1f')]=0x3;}_0x2166ae['SAInvoice'][_0x1b6b('0x28')](_0x3c315d[_0x1b6b('0xf')],{'where':{'id':_0x42146d[_0x1b6b('0xd')]}})[_0x1b6b('0xe')](function(_0x452d06){console[_0x1b6b('0x20')](_0x1b6b('0x21'),_0x452d06);})[_0x1b6b('0x22')](function(_0x33c36d){console[_0x1b6b('0x20')]('TCL:\x20err',_0x33c36d);});});}});}else{_0x2166ae[_0x1b6b('0x27')][_0x1b6b('0xc')]({'where':{'id':_0x42146d[_0x1b6b('0x24')]},'raw':!![]})['then'](function(_0x548a61){if(_0x548a61){_0x35d362[_0x1b6b('0x25')]=_0x548a61;var _0xe4005a=![];if(_0x3c315d[_0x1b6b('0xf')][_0x1b6b('0x10')][_0x1b6b('0x11')](_0x1b6b('0x12'))!=-0x1){_0xe4005a=!![];}return _0x2166ae[_0x1b6b('0x26')][_0x1b6b('0x16')]({'where':{'ProformaId':_0x42146d['ProformaId']},'raw':!![]})[_0x1b6b('0xe')](function(_0x4bb4df){_0x35d362[_0x1b6b('0x14')]=_0x4bb4df;return _0x2166ae['SAPayment'][_0x1b6b('0x16')]({'where':{'ProformaId':_0x42146d['ProformaId']},'raw':!![]});})[_0x1b6b('0xe')](function(_0x17465d){_0x35d362[_0x1b6b('0x17')]=_0x17465d;var _0x557ae1=0x0;var _0x33289f=0x0;var _0x53562b=0x0;var _0x473475=0x0;var _0x204ba1=0x0;for(var _0x59f870=0x0;_0x59f870<_0x35d362[_0x1b6b('0x17')][_0x1b6b('0x18')];_0x59f870++){_0x557ae1+=_0x35d362[_0x1b6b('0x17')][_0x59f870][_0x1b6b('0x19')];}for(var _0x59f870=0x0;_0x59f870<_0x35d362[_0x1b6b('0x14')][_0x1b6b('0x18')];_0x59f870++){var _0x413474=0x0;var _0x2c9dbb=0x0;var _0x315df6=0x0;var _0x3f6039=0x0;_0x413474=_0x35d362['details'][_0x59f870][_0x1b6b('0x1a')]-_0x35d362[_0x1b6b('0x14')][_0x59f870][_0x1b6b('0x1a')]/0x64*_0x35d362[_0x1b6b('0x14')][_0x59f870]['discount'];_0x2c9dbb=_0x413474/0x64*_0x35d362[_0x1b6b('0x14')][_0x59f870][_0x1b6b('0x1e')];_0x315df6=_0x413474*_0x35d362[_0x1b6b('0x14')][_0x59f870][_0x1b6b('0x1c')];_0x3f6039=_0x2c9dbb*_0x35d362[_0x1b6b('0x14')][_0x59f870]['quantity'];_0x473475+=_0x315df6;_0x204ba1+=_0x3f6039;}if(!_['isNil'](_0x35d362[_0x1b6b('0x25')][_0x1b6b('0x1b')])){var _0x2d99f3=0x0;var _0x3ad0b6=0x0;var _0x58c8ca=_0x35d362[_0x1b6b('0x25')][_0x1b6b('0x1b')]*0x64/_0x473475;for(var _0x27ce70=0x0;_0x27ce70<_0x35d362[_0x1b6b('0x14')][_0x1b6b('0x18')];_0x27ce70++){var _0x378a94=0x0;var _0x9bc553=0x0;var _0x4e3c96=0x0;_0x413474=_0x35d362[_0x1b6b('0x14')][_0x27ce70]['netPrice']-_0x35d362[_0x1b6b('0x14')][_0x27ce70][_0x1b6b('0x1a')]/0x64*_0x35d362['details'][_0x27ce70]['discount'];_0x378a94=_0x413474/0x64*_0x58c8ca;_0x9bc553=_0x413474-_0x378a94;_0x4e3c96=_0x9bc553*_0x35d362[_0x1b6b('0x14')][_0x27ce70]['quantity'];_0x2d99f3+=_0x4e3c96;_0x3ad0b6+=_0x4e3c96/0x64*_0x35d362[_0x1b6b('0x14')][_0x27ce70][_0x1b6b('0x1e')];}}if(!_[_0x1b6b('0x1d')](_0x35d362[_0x1b6b('0x25')][_0x1b6b('0x1b')])){if(_0xe4005a){_0x33289f=_0x2d99f3;}else{_0x33289f=_0x3ad0b6+_0x2d99f3;}}else{if(_0xe4005a){_0x33289f=_0x473475;}else{_0x33289f=_0x204ba1+_0x473475;}}if(_0x557ae1==_0x33289f){_0x35d362['proforma'][_0x1b6b('0x1f')]=0x1;}if(_0x557ae1<_0x33289f){_0x35d362[_0x1b6b('0x25')][_0x1b6b('0x1f')]=0x2;}if(_0x557ae1>_0x33289f){_0x35d362[_0x1b6b('0x25')][_0x1b6b('0x1f')]=0x3;}_0x2166ae[_0x1b6b('0x27')]['update'](_0x35d362[_0x1b6b('0x25')],{'where':{'id':_0x42146d['ProformaId']}})['then'](function(_0x11695c){})[_0x1b6b('0x22')](function(_0x2e88a1){console[_0x1b6b('0x20')]('Hook\x20afterCreate:\x20err',_0x2e88a1);});});}});}_0x401fb4();}}});}; \ No newline at end of file diff --git a/server/api/saPayment/saPayment.rpc.js b/server/api/saPayment/saPayment.rpc.js index b3554b9..274e453 100644 --- a/server/api/saPayment/saPayment.rpc.js +++ b/server/api/saPayment/saPayment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf58b=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SAPayment,\x20%s,\x20%s','request\x20sent','debug','SAPayment,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x157154,_0x12f714){var _0x49b2b0=function(_0x3416ea){while(--_0x3416ea){_0x157154['push'](_0x157154['shift']());}};_0x49b2b0(++_0x12f714);}(_0xf58b,0x186));var _0xbf58=function(_0x565c4e,_0x1e77f9){_0x565c4e=_0x565c4e-0x0;var _0x4a167f=_0xf58b[_0x565c4e];return _0x4a167f;};'use strict';var _=require(_0xbf58('0x0'));var util=require(_0xbf58('0x1'));var moment=require(_0xbf58('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf58('0x3'));var fs=require('fs');var Redis=require(_0xbf58('0x4'));var db=require(_0xbf58('0x5'))['db'];var utils=require(_0xbf58('0x6'));var logger=require('../../config/logger')(_0xbf58('0x7'));var config=require(_0xbf58('0x8'));var jayson=require(_0xbf58('0x9'));var client=jayson[_0xbf58('0xa')][_0xbf58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1708ca,_0x10d1a2,_0x45d324){return new BPromise(function(_0x55337f,_0x3683e7){return client['request'](_0x1708ca,_0x45d324)[_0xbf58('0xc')](function(_0x53df50){logger[_0xbf58('0xd')](_0xbf58('0xe'),_0x10d1a2,_0xbf58('0xf'));logger[_0xbf58('0x10')](_0xbf58('0x11'),_0x10d1a2,_0xbf58('0xf'),JSON['stringify'](_0x53df50));if(_0x53df50['error']){if(_0x53df50[_0xbf58('0x12')][_0xbf58('0x13')]===0x1f4){logger[_0xbf58('0x12')](_0xbf58('0xe'),_0x10d1a2,_0x53df50[_0xbf58('0x12')][_0xbf58('0x14')]);return _0x3683e7(_0x53df50[_0xbf58('0x12')][_0xbf58('0x14')]);}logger[_0xbf58('0x12')](_0xbf58('0xe'),_0x10d1a2,_0x53df50[_0xbf58('0x12')]['message']);return _0x55337f(_0x53df50[_0xbf58('0x12')][_0xbf58('0x14')]);}else{logger[_0xbf58('0xd')](_0xbf58('0xe'),_0x10d1a2,_0xbf58('0xf'));_0x55337f(_0x53df50[_0xbf58('0x15')][_0xbf58('0x14')]);}})['catch'](function(_0xaed4e6){logger[_0xbf58('0x12')](_0xbf58('0xe'),_0x10d1a2,_0xaed4e6);_0x3683e7(_0xaed4e6);});});} \ No newline at end of file +var _0xb5f4=['debug','SAPayment,\x20%s,\x20%s,\x20%s','error','code','SAPayment,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2d64ba,_0x15f324){var _0x256105=function(_0x22ff18){while(--_0x22ff18){_0x2d64ba['push'](_0x2d64ba['shift']());}};_0x256105(++_0x15f324);}(_0xb5f4,0xcd));var _0x4b5f=function(_0xb5c303,_0x5e4f91){_0xb5c303=_0xb5c303-0x0;var _0x160d39=_0xb5f4[_0xb5c303];return _0x160d39;};'use strict';var _=require(_0x4b5f('0x0'));var util=require(_0x4b5f('0x1'));var moment=require('moment');var BPromise=require(_0x4b5f('0x2'));var rs=require(_0x4b5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b5f('0x4'))['db'];var utils=require(_0x4b5f('0x5'));var logger=require(_0x4b5f('0x6'))(_0x4b5f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b5f('0x8'));var client=jayson[_0x4b5f('0x9')][_0x4b5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4937ef,_0x55fdb8,_0x323338){return new BPromise(function(_0x22796f,_0x3a7596){return client[_0x4b5f('0xb')](_0x4937ef,_0x323338)[_0x4b5f('0xc')](function(_0x5a3096){logger[_0x4b5f('0xd')]('SAPayment,\x20%s,\x20%s',_0x55fdb8,_0x4b5f('0xe'));logger[_0x4b5f('0xf')](_0x4b5f('0x10'),_0x55fdb8,_0x4b5f('0xe'),JSON['stringify'](_0x5a3096));if(_0x5a3096['error']){if(_0x5a3096[_0x4b5f('0x11')][_0x4b5f('0x12')]===0x1f4){logger[_0x4b5f('0x11')](_0x4b5f('0x13'),_0x55fdb8,_0x5a3096['error'][_0x4b5f('0x14')]);return _0x3a7596(_0x5a3096['error'][_0x4b5f('0x14')]);}logger[_0x4b5f('0x11')]('SAPayment,\x20%s,\x20%s',_0x55fdb8,_0x5a3096[_0x4b5f('0x11')][_0x4b5f('0x14')]);return _0x22796f(_0x5a3096[_0x4b5f('0x11')][_0x4b5f('0x14')]);}else{logger[_0x4b5f('0xd')](_0x4b5f('0x13'),_0x55fdb8,_0x4b5f('0xe'));_0x22796f(_0x5a3096['result'][_0x4b5f('0x14')]);}})[_0x4b5f('0x15')](function(_0x23e305){logger[_0x4b5f('0x11')](_0x4b5f('0x13'),_0x55fdb8,_0x23e305);_0x3a7596(_0x23e305);});});} \ No newline at end of file diff --git a/server/api/saPaymentMethod/index.js b/server/api/saPaymentMethod/index.js index c6f882d..801aaa4 100644 --- a/server/api/saPaymentMethod/index.js +++ b/server/api/saPaymentMethod/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea5a=['/describe','describe','/:id','show','create','put','update','exports','multer','util','path','express','Router','../../config/environment','./saPaymentMethod.controller','get','isAuthenticated'];(function(_0x4ba74a,_0x3d2a0e){var _0x3a40ae=function(_0x39ad6a){while(--_0x39ad6a){_0x4ba74a['push'](_0x4ba74a['shift']());}};_0x3a40ae(++_0x3d2a0e);}(_0xea5a,0x90));var _0xaea5=function(_0x4ee0ba,_0x340d2c){_0x4ee0ba=_0x4ee0ba-0x0;var _0x52917f=_0xea5a[_0x4ee0ba];return _0x52917f;};'use strict';var multer=require(_0xaea5('0x0'));var util=require(_0xaea5('0x1'));var path=require(_0xaea5('0x2'));var timeout=require('connect-timeout');var express=require(_0xaea5('0x3'));var router=express[_0xaea5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaea5('0x5'));var controller=require(_0xaea5('0x6'));router[_0xaea5('0x7')]('/',auth[_0xaea5('0x8')](),controller['index']);router[_0xaea5('0x7')](_0xaea5('0x9'),auth[_0xaea5('0x8')](),controller[_0xaea5('0xa')]);router[_0xaea5('0x7')](_0xaea5('0xb'),auth[_0xaea5('0x8')](),controller[_0xaea5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaea5('0xd')]);router[_0xaea5('0xe')](_0xaea5('0xb'),auth[_0xaea5('0x8')](),controller[_0xaea5('0xf')]);router['delete']('/:id',auth[_0xaea5('0x8')](),controller['destroy']);module[_0xaea5('0x10')]=router; \ No newline at end of file +var _0x86f7=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saPaymentMethod.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x2f85b4,_0x19e4e7){var _0x34427d=function(_0x1e0acb){while(--_0x1e0acb){_0x2f85b4['push'](_0x2f85b4['shift']());}};_0x34427d(++_0x19e4e7);}(_0x86f7,0x8e));var _0x786f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x86f7[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x786f('0x0'));var util=require(_0x786f('0x1'));var path=require(_0x786f('0x2'));var timeout=require(_0x786f('0x3'));var express=require(_0x786f('0x4'));var router=express[_0x786f('0x5')]();var auth=require(_0x786f('0x6'));var interaction=require(_0x786f('0x7'));var config=require(_0x786f('0x8'));var controller=require(_0x786f('0x9'));router[_0x786f('0xa')]('/',auth['isAuthenticated'](),controller[_0x786f('0xb')]);router['get'](_0x786f('0xc'),auth[_0x786f('0xd')](),controller[_0x786f('0xe')]);router[_0x786f('0xa')](_0x786f('0xf'),auth[_0x786f('0xd')](),controller[_0x786f('0x10')]);router[_0x786f('0x11')]('/',auth[_0x786f('0xd')](),controller[_0x786f('0x12')]);router[_0x786f('0x13')](_0x786f('0xf'),auth[_0x786f('0xd')](),controller[_0x786f('0x14')]);router[_0x786f('0x15')]('/:id',auth[_0x786f('0xd')](),controller['destroy']);module[_0x786f('0x16')]=router; \ No newline at end of file diff --git a/server/api/saPaymentMethod/saPaymentMethod.attributes.js b/server/api/saPaymentMethod/saPaymentMethod.attributes.js index 14fe0df..ad81237 100644 --- a/server/api/saPaymentMethod/saPaymentMethod.attributes.js +++ b/server/api/saPaymentMethod/saPaymentMethod.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c82=['sequelize','exports','STRING'];(function(_0x4fdb2e,_0x1f0ad9){var _0x2f415a=function(_0x442e3c){while(--_0x442e3c){_0x4fdb2e['push'](_0x4fdb2e['shift']());}};_0x2f415a(++_0x1f0ad9);}(_0x5c82,0x1c8));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x25c8('0x0'));module[_0x25c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'bankAccount':{'type':Sequelize[_0x25c8('0x2')]},'paymentType':{'type':Sequelize['STRING']},'bankName':{'type':Sequelize[_0x25c8('0x2')]},'bankstreet':{'type':Sequelize['STRING']},'bankpostalCode':{'type':Sequelize[_0x25c8('0x2')]},'bankcity':{'type':Sequelize[_0x25c8('0x2')]},'bankcountry':{'type':Sequelize['STRING']},'bankBICSWIFT':{'type':Sequelize[_0x25c8('0x2')]},'bankIBAN':{'type':Sequelize['STRING']},'bankABI':{'type':Sequelize[_0x25c8('0x2')]},'banckCAB':{'type':Sequelize[_0x25c8('0x2')]},'paypalEmail':{'type':Sequelize[_0x25c8('0x2')],'validate':{'isEmail':!![]}}}; \ No newline at end of file +var _0x7bbf=['sequelize','exports','STRING','name'];(function(_0x53e576,_0x398a4f){var _0x3e9a7c=function(_0x1cf67a){while(--_0x1cf67a){_0x53e576['push'](_0x53e576['shift']());}};_0x3e9a7c(++_0x398a4f);}(_0x7bbf,0x154));var _0xf7bb=function(_0x18be75,_0x589387){_0x18be75=_0x18be75-0x0;var _0x41cde5=_0x7bbf[_0x18be75];return _0x41cde5;};'use strict';var Sequelize=require(_0xf7bb('0x0'));module[_0xf7bb('0x1')]={'name':{'type':Sequelize[_0xf7bb('0x2')],'allowNull':![],'unique':_0xf7bb('0x3')},'bankAccount':{'type':Sequelize[_0xf7bb('0x2')]},'paymentType':{'type':Sequelize[_0xf7bb('0x2')]},'bankName':{'type':Sequelize[_0xf7bb('0x2')]},'bankstreet':{'type':Sequelize[_0xf7bb('0x2')]},'bankpostalCode':{'type':Sequelize[_0xf7bb('0x2')]},'bankcity':{'type':Sequelize[_0xf7bb('0x2')]},'bankcountry':{'type':Sequelize[_0xf7bb('0x2')]},'bankBICSWIFT':{'type':Sequelize[_0xf7bb('0x2')]},'bankIBAN':{'type':Sequelize[_0xf7bb('0x2')]},'bankABI':{'type':Sequelize['STRING']},'banckCAB':{'type':Sequelize[_0xf7bb('0x2')]},'paypalEmail':{'type':Sequelize[_0xf7bb('0x2')],'validate':{'isEmail':!![]}}}; \ No newline at end of file diff --git a/server/api/saPaymentMethod/saPaymentMethod.controller.js b/server/api/saPaymentMethod/saPaymentMethod.controller.js index cbc044e..57fbcaf 100644 --- a/server/api/saPaymentMethod/saPaymentMethod.controller.js +++ b/server/api/saPaymentMethod/saPaymentMethod.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['where','pick','filter','merge','type','key','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','SAPaymentMethod','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort'];(function(_0x3b31fe,_0x4c3990){var _0x291f15=function(_0x2cedf9){while(--_0x2cedf9){_0x3b31fe['push'](_0x3b31fe['shift']());}};_0x291f15(++_0x4c3990);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={},_0x479bc4={},_0x45a1e7={'count':0x0,'rows':[]};var _0x5bfb33=db[_0x0a9e('0x24')][_0x0a9e('0x25')];_0x479bc4[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x5bfb33);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_['intersection'](_0x479bc4[_0x0a9e('0x26')],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x479bc4['model'],qs[_0x0a9e('0x2c')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x384319[_0x0a9e('0x2a')]=_0x384319[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x384319[_0x0a9e('0x2a')]:_0x479bc4[_0x0a9e('0x26')];if(!_0x33161b[_0x0a9e('0x28')]['hasOwnProperty'](_0x0a9e('0x2e'))){_0x384319['limit']=qs[_0x0a9e('0x19')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x19')]);_0x384319[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x33161b['query'][_0x0a9e('0x18')]);}_0x384319[_0x0a9e('0x2f')]=qs[_0x0a9e('0x30')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x30')]);_0x384319[_0x0a9e('0x31')]=qs[_0x0a9e('0x29')](_[_0x0a9e('0x32')](_0x33161b['query'],_0x479bc4[_0x0a9e('0x29')]));if(_0x33161b['query'][_0x0a9e('0x33')]){_0x384319[_0x0a9e('0x31')]=_[_0x0a9e('0x34')](_0x384319[_0x0a9e('0x31')],{'$or':_['map'](_0x5bfb33,function(_0x191e91){if(_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4853b1={};_0x4853b1[_0x191e91['field']]={'$like':'%'+_0x33161b[_0x0a9e('0x28')]['filter']+'%'};return _0x4853b1;}})});}_0x384319=_[_0x0a9e('0x34')]({},_0x384319,_0x33161b[_0x0a9e('0x38')]);var _0x381c37={'where':_0x384319[_0x0a9e('0x31')]};return db['SAPaymentMethod'][_0x0a9e('0x17')](_0x381c37)[_0x0a9e('0x1f')](function(_0x3cae){_0x45a1e7['count']=_0x3cae;if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x384319[_0x0a9e('0x3a')]=[{'all':!![]}];}return db['SAPaymentMethod']['findAll'](_0x384319);})[_0x0a9e('0x1f')](function(_0x40d766){_0x45a1e7['rows']=_0x40d766;return _0x45a1e7;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x526cf3,_0x384319))[_0x0a9e('0x3b')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x3c')]=function(_0x148f55,_0x4b38d9){var _0x5a594b={'raw':![],'where':{'id':_0x148f55[_0x0a9e('0x3d')]['id']}},_0x15e37d={};_0x15e37d['model']=_[_0x0a9e('0x27')](db[_0x0a9e('0x24')][_0x0a9e('0x25')]);_0x15e37d['query']=_[_0x0a9e('0x27')](_0x148f55[_0x0a9e('0x28')]);_0x15e37d[_0x0a9e('0x29')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],_0x15e37d[_0x0a9e('0x28')]);_0x5a594b[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],qs[_0x0a9e('0x2c')](_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x5a594b[_0x0a9e('0x2a')]=_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x5a594b['attributes']:_0x15e37d['model'];if(_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x5a594b[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5a594b=_[_0x0a9e('0x34')]({},_0x5a594b,_0x148f55[_0x0a9e('0x38')]);return db[_0x0a9e('0x24')][_0x0a9e('0x3e')](_0x5a594b)[_0x0a9e('0x1f')](handleEntityNotFound(_0x4b38d9,null))[_0x0a9e('0x1f')](respondWithResult(_0x4b38d9,null))[_0x0a9e('0x3b')](handleError(_0x4b38d9,null));};exports[_0x0a9e('0x3f')]=function(_0x35ed4a,_0x5026aa){return db[_0x0a9e('0x24')][_0x0a9e('0x3f')](_0x35ed4a[_0x0a9e('0x40')],{})[_0x0a9e('0x1f')](respondWithResult(_0x5026aa,0xc9))[_0x0a9e('0x3b')](handleError(_0x5026aa,null));};exports[_0x0a9e('0x41')]=function(_0x21eb86,_0x44dd99){if(_0x21eb86['body']['id']){delete _0x21eb86[_0x0a9e('0x40')]['id'];}return db['SAPaymentMethod'][_0x0a9e('0x3e')]({'where':{'id':_0x21eb86[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x44dd99,null))['then'](saveUpdates(_0x21eb86[_0x0a9e('0x40')],null))[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,null))[_0x0a9e('0x3b')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x42')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x24')]['find']({'where':{'id':_0x45c845[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x1f')](removeEntity(_0x37be73,null))[_0x0a9e('0x3b')](handleError(_0x37be73,null));};exports[_0x0a9e('0x43')]=function(_0x992c77,_0x6054ee){return db[_0x0a9e('0x24')][_0x0a9e('0x43')]()['then'](respondWithResult(_0x6054ee,null))[_0x0a9e('0x3b')](handleError(_0x6054ee,null));}; \ No newline at end of file +var _0xa9e0=['where','pick','filter','merge','type','key','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','SAPaymentMethod','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort'];(function(_0x5ba099,_0x16a8fe){var _0x384cbd=function(_0x4077f6){while(--_0x4077f6){_0x5ba099['push'](_0x5ba099['shift']());}};_0x384cbd(++_0x16a8fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={},_0x479bc4={},_0x45a1e7={'count':0x0,'rows':[]};var _0x5bfb33=db[_0x0a9e('0x24')][_0x0a9e('0x25')];_0x479bc4[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x5bfb33);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x27')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_['intersection'](_0x479bc4[_0x0a9e('0x26')],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x479bc4['model'],qs[_0x0a9e('0x2c')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x384319[_0x0a9e('0x2a')]=_0x384319[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x384319[_0x0a9e('0x2a')]:_0x479bc4[_0x0a9e('0x26')];if(!_0x33161b[_0x0a9e('0x28')]['hasOwnProperty'](_0x0a9e('0x2e'))){_0x384319['limit']=qs[_0x0a9e('0x19')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x19')]);_0x384319[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x33161b['query'][_0x0a9e('0x18')]);}_0x384319[_0x0a9e('0x2f')]=qs[_0x0a9e('0x30')](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x30')]);_0x384319[_0x0a9e('0x31')]=qs[_0x0a9e('0x29')](_[_0x0a9e('0x32')](_0x33161b['query'],_0x479bc4[_0x0a9e('0x29')]));if(_0x33161b['query'][_0x0a9e('0x33')]){_0x384319[_0x0a9e('0x31')]=_[_0x0a9e('0x34')](_0x384319[_0x0a9e('0x31')],{'$or':_['map'](_0x5bfb33,function(_0x191e91){if(_0x191e91[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4853b1={};_0x4853b1[_0x191e91['field']]={'$like':'%'+_0x33161b[_0x0a9e('0x28')]['filter']+'%'};return _0x4853b1;}})});}_0x384319=_[_0x0a9e('0x34')]({},_0x384319,_0x33161b[_0x0a9e('0x38')]);var _0x381c37={'where':_0x384319[_0x0a9e('0x31')]};return db['SAPaymentMethod'][_0x0a9e('0x17')](_0x381c37)[_0x0a9e('0x1f')](function(_0x3cae){_0x45a1e7['count']=_0x3cae;if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x384319[_0x0a9e('0x3a')]=[{'all':!![]}];}return db['SAPaymentMethod']['findAll'](_0x384319);})[_0x0a9e('0x1f')](function(_0x40d766){_0x45a1e7['rows']=_0x40d766;return _0x45a1e7;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x526cf3,_0x384319))[_0x0a9e('0x3b')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x3c')]=function(_0x148f55,_0x4b38d9){var _0x5a594b={'raw':![],'where':{'id':_0x148f55[_0x0a9e('0x3d')]['id']}},_0x15e37d={};_0x15e37d['model']=_[_0x0a9e('0x27')](db[_0x0a9e('0x24')][_0x0a9e('0x25')]);_0x15e37d['query']=_[_0x0a9e('0x27')](_0x148f55[_0x0a9e('0x28')]);_0x15e37d[_0x0a9e('0x29')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],_0x15e37d[_0x0a9e('0x28')]);_0x5a594b[_0x0a9e('0x2a')]=_[_0x0a9e('0x2b')](_0x15e37d[_0x0a9e('0x26')],qs[_0x0a9e('0x2c')](_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x2c')]));_0x5a594b[_0x0a9e('0x2a')]=_0x5a594b[_0x0a9e('0x2a')][_0x0a9e('0x2d')]?_0x5a594b['attributes']:_0x15e37d['model'];if(_0x148f55[_0x0a9e('0x28')][_0x0a9e('0x39')]){_0x5a594b[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5a594b=_[_0x0a9e('0x34')]({},_0x5a594b,_0x148f55[_0x0a9e('0x38')]);return db[_0x0a9e('0x24')][_0x0a9e('0x3e')](_0x5a594b)[_0x0a9e('0x1f')](handleEntityNotFound(_0x4b38d9,null))[_0x0a9e('0x1f')](respondWithResult(_0x4b38d9,null))[_0x0a9e('0x3b')](handleError(_0x4b38d9,null));};exports[_0x0a9e('0x3f')]=function(_0x35ed4a,_0x5026aa){return db[_0x0a9e('0x24')][_0x0a9e('0x3f')](_0x35ed4a[_0x0a9e('0x40')],{})[_0x0a9e('0x1f')](respondWithResult(_0x5026aa,0xc9))[_0x0a9e('0x3b')](handleError(_0x5026aa,null));};exports[_0x0a9e('0x41')]=function(_0x21eb86,_0x44dd99){if(_0x21eb86['body']['id']){delete _0x21eb86[_0x0a9e('0x40')]['id'];}return db['SAPaymentMethod'][_0x0a9e('0x3e')]({'where':{'id':_0x21eb86[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x44dd99,null))['then'](saveUpdates(_0x21eb86[_0x0a9e('0x40')],null))[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,null))[_0x0a9e('0x3b')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x42')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x24')]['find']({'where':{'id':_0x45c845[_0x0a9e('0x3d')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x1f')](removeEntity(_0x37be73,null))[_0x0a9e('0x3b')](handleError(_0x37be73,null));};exports[_0x0a9e('0x43')]=function(_0x992c77,_0x6054ee){return db[_0x0a9e('0x24')][_0x0a9e('0x43')]()['then'](respondWithResult(_0x6054ee,null))[_0x0a9e('0x3b')](handleError(_0x6054ee,null));}; \ No newline at end of file diff --git a/server/api/saPaymentMethod/saPaymentMethod.model.js b/server/api/saPaymentMethod/saPaymentMethod.model.js index a03b534..21970ec 100644 --- a/server/api/saPaymentMethod/saPaymentMethod.model.js +++ b/server/api/saPaymentMethod/saPaymentMethod.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb74f=['define','SAPaymentMethod','sa_paymentMethods','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./saPaymentMethod.attributes'];(function(_0x3af198,_0x53e7eb){var _0x47abff=function(_0x5d9d8b){while(--_0x5d9d8b){_0x3af198['push'](_0x3af198['shift']());}};_0x47abff(++_0x53e7eb);}(_0xb74f,0xff));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfb74('0x0'));var util=require('util');var logger=require(_0xfb74('0x1'))(_0xfb74('0x2'));var moment=require(_0xfb74('0x3'));var BPromise=require(_0xfb74('0x4'));var rp=require(_0xfb74('0x5'));var fs=require('fs');var path=require(_0xfb74('0x6'));var rimraf=require('rimraf');var config=require(_0xfb74('0x7'));var attributes=require(_0xfb74('0x8'));module['exports']=function(_0x30b3c6,_0x5217eb){return _0x30b3c6[_0xfb74('0x9')](_0xfb74('0xa'),attributes,{'tableName':_0xfb74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5052=['request-promise','rimraf','../../config/environment','./saPaymentMethod.attributes','exports','SAPaymentMethod','sa_paymentMethods','lodash','../../config/logger','api','moment'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0x5052,0x130));var _0x2505=function(_0x5a9597,_0x48e55b){_0x5a9597=_0x5a9597-0x0;var _0x5b1e40=_0x5052[_0x5a9597];return _0x5b1e40;};'use strict';var _=require(_0x2505('0x0'));var util=require('util');var logger=require(_0x2505('0x1'))(_0x2505('0x2'));var moment=require(_0x2505('0x3'));var BPromise=require('bluebird');var rp=require(_0x2505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2505('0x5'));var config=require(_0x2505('0x6'));var attributes=require(_0x2505('0x7'));module[_0x2505('0x8')]=function(_0x2f240b,_0xa9215c){return _0x2f240b['define'](_0x2505('0x9'),attributes,{'tableName':_0x2505('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saPaymentMethod/saPaymentMethod.rpc.js b/server/api/saPaymentMethod/saPaymentMethod.rpc.js index a4e8ff5..60b589c 100644 --- a/server/api/saPaymentMethod/saPaymentMethod.rpc.js +++ b/server/api/saPaymentMethod/saPaymentMethod.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfef=['request\x20sent','debug','SAPaymentMethod,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SAPaymentMethod,\x20%s,\x20%s'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0xdfef,0x1e5));var _0xfdfe=function(_0x4de1bf,_0x2a7391){_0x4de1bf=_0x4de1bf-0x0;var _0x22541f=_0xdfef[_0x4de1bf];return _0x22541f;};'use strict';var _=require(_0xfdfe('0x0'));var util=require(_0xfdfe('0x1'));var moment=require(_0xfdfe('0x2'));var BPromise=require(_0xfdfe('0x3'));var rs=require(_0xfdfe('0x4'));var fs=require('fs');var Redis=require(_0xfdfe('0x5'));var db=require(_0xfdfe('0x6'))['db'];var utils=require(_0xfdfe('0x7'));var logger=require('../../config/logger')(_0xfdfe('0x8'));var config=require(_0xfdfe('0x9'));var jayson=require(_0xfdfe('0xa'));var client=jayson[_0xfdfe('0xb')][_0xfdfe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d75db,_0x563d29,_0x5b3c2b){return new BPromise(function(_0x37db74,_0x2dfa5a){return client[_0xfdfe('0xd')](_0x1d75db,_0x5b3c2b)['then'](function(_0x151ac8){logger['info'](_0xfdfe('0xe'),_0x563d29,_0xfdfe('0xf'));logger[_0xfdfe('0x10')](_0xfdfe('0x11'),_0x563d29,_0xfdfe('0xf'),JSON[_0xfdfe('0x12')](_0x151ac8));if(_0x151ac8[_0xfdfe('0x13')]){if(_0x151ac8[_0xfdfe('0x13')][_0xfdfe('0x14')]===0x1f4){logger[_0xfdfe('0x13')](_0xfdfe('0xe'),_0x563d29,_0x151ac8[_0xfdfe('0x13')][_0xfdfe('0x15')]);return _0x2dfa5a(_0x151ac8[_0xfdfe('0x13')][_0xfdfe('0x15')]);}logger['error']('SAPaymentMethod,\x20%s,\x20%s',_0x563d29,_0x151ac8[_0xfdfe('0x13')]['message']);return _0x37db74(_0x151ac8[_0xfdfe('0x13')][_0xfdfe('0x15')]);}else{logger[_0xfdfe('0x16')](_0xfdfe('0xe'),_0x563d29,_0xfdfe('0xf'));_0x37db74(_0x151ac8[_0xfdfe('0x17')]['message']);}})[_0xfdfe('0x18')](function(_0xabe1b9){logger[_0xfdfe('0x13')](_0xfdfe('0xe'),_0x563d29,_0xabe1b9);_0x2dfa5a(_0xabe1b9);});});} \ No newline at end of file +var _0xca67=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SAPaymentMethod,\x20%s,\x20%s','debug','SAPaymentMethod,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x4fe1a6,_0x86a75d){var _0x36eaba=function(_0x2dd3d9){while(--_0x2dd3d9){_0x4fe1a6['push'](_0x4fe1a6['shift']());}};_0x36eaba(++_0x86a75d);}(_0xca67,0xcf));var _0x7ca6=function(_0x5ef8a6,_0xfc84d5){_0x5ef8a6=_0x5ef8a6-0x0;var _0x5c3972=_0xca67[_0x5ef8a6];return _0x5c3972;};'use strict';var _=require(_0x7ca6('0x0'));var util=require(_0x7ca6('0x1'));var moment=require(_0x7ca6('0x2'));var BPromise=require(_0x7ca6('0x3'));var rs=require(_0x7ca6('0x4'));var fs=require('fs');var Redis=require(_0x7ca6('0x5'));var db=require(_0x7ca6('0x6'))['db'];var utils=require(_0x7ca6('0x7'));var logger=require(_0x7ca6('0x8'))(_0x7ca6('0x9'));var config=require(_0x7ca6('0xa'));var jayson=require(_0x7ca6('0xb'));var client=jayson[_0x7ca6('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19700c,_0x320b1a,_0x2ca4b9){return new BPromise(function(_0x39ffa8,_0x4eb16a){return client['request'](_0x19700c,_0x2ca4b9)['then'](function(_0x283239){logger[_0x7ca6('0xd')](_0x7ca6('0xe'),_0x320b1a,'request\x20sent');logger[_0x7ca6('0xf')](_0x7ca6('0x10'),_0x320b1a,'request\x20sent',JSON['stringify'](_0x283239));if(_0x283239[_0x7ca6('0x11')]){if(_0x283239[_0x7ca6('0x11')]['code']===0x1f4){logger['error'](_0x7ca6('0xe'),_0x320b1a,_0x283239['error'][_0x7ca6('0x12')]);return _0x4eb16a(_0x283239[_0x7ca6('0x11')][_0x7ca6('0x12')]);}logger[_0x7ca6('0x11')]('SAPaymentMethod,\x20%s,\x20%s',_0x320b1a,_0x283239[_0x7ca6('0x11')]['message']);return _0x39ffa8(_0x283239[_0x7ca6('0x11')][_0x7ca6('0x12')]);}else{logger[_0x7ca6('0xd')](_0x7ca6('0xe'),_0x320b1a,'request\x20sent');_0x39ffa8(_0x283239[_0x7ca6('0x13')]['message']);}})[_0x7ca6('0x14')](function(_0x68837f){logger[_0x7ca6('0x11')](_0x7ca6('0xe'),_0x320b1a,_0x68837f);_0x4eb16a(_0x68837f);});});} \ No newline at end of file diff --git a/server/api/saPriceList/index.js b/server/api/saPriceList/index.js index a489c40..2765203 100644 --- a/server/api/saPriceList/index.js +++ b/server/api/saPriceList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2755=['post','create','/:id/clone','addProduct','put','update','delete','destroy','removeProducts','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./saPriceList.controller','get','isAuthenticated','index','describe','/:id','show','/:id/products','getProducts'];(function(_0x41d54e,_0x1f3867){var _0x16fd06=function(_0x238ff3){while(--_0x238ff3){_0x41d54e['push'](_0x41d54e['shift']());}};_0x16fd06(++_0x1f3867);}(_0x2755,0x19a));var _0x5275=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x2755[_0x3c22e0];return _0x215811;};'use strict';var multer=require(_0x5275('0x0'));var util=require('util');var path=require(_0x5275('0x1'));var timeout=require(_0x5275('0x2'));var express=require(_0x5275('0x3'));var router=express['Router']();var auth=require(_0x5275('0x4'));var interaction=require(_0x5275('0x5'));var config=require('../../config/environment');var controller=require(_0x5275('0x6'));router[_0x5275('0x7')]('/',auth[_0x5275('0x8')](),controller[_0x5275('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5275('0xa')]);router[_0x5275('0x7')](_0x5275('0xb'),auth[_0x5275('0x8')](),controller[_0x5275('0xc')]);router['get'](_0x5275('0xd'),auth[_0x5275('0x8')](),controller[_0x5275('0xe')]);router[_0x5275('0xf')]('/',auth[_0x5275('0x8')](),controller[_0x5275('0x10')]);router[_0x5275('0xf')](_0x5275('0x11'),auth[_0x5275('0x8')](),controller['clone']);router[_0x5275('0xf')]('/:id/products',auth[_0x5275('0x8')](),controller[_0x5275('0x12')]);router[_0x5275('0x13')]('/:id',auth[_0x5275('0x8')](),controller[_0x5275('0x14')]);router[_0x5275('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5275('0x16')]);router['delete'](_0x5275('0xd'),auth['isAuthenticated'](),controller[_0x5275('0x17')]);module[_0x5275('0x18')]=router; \ No newline at end of file +var _0xe0af=['util','path','connect-timeout','express','Router','../../components/interaction/service','./saPriceList.controller','isAuthenticated','/describe','describe','/:id','show','getProducts','create','/:id/clone','clone','/:id/products','addProduct','update','delete','destroy','multer'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0xe0af,0x1e3));var _0xfe0a=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xe0af[_0x2b8077];return _0x308091;};'use strict';var multer=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var path=require(_0xfe0a('0x2'));var timeout=require(_0xfe0a('0x3'));var express=require(_0xfe0a('0x4'));var router=express[_0xfe0a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfe0a('0x6'));var config=require('../../config/environment');var controller=require(_0xfe0a('0x7'));router['get']('/',auth[_0xfe0a('0x8')](),controller['index']);router['get'](_0xfe0a('0x9'),auth[_0xfe0a('0x8')](),controller[_0xfe0a('0xa')]);router['get'](_0xfe0a('0xb'),auth['isAuthenticated'](),controller[_0xfe0a('0xc')]);router['get']('/:id/products',auth[_0xfe0a('0x8')](),controller[_0xfe0a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe0a('0xe')]);router['post'](_0xfe0a('0xf'),auth[_0xfe0a('0x8')](),controller[_0xfe0a('0x10')]);router['post'](_0xfe0a('0x11'),auth['isAuthenticated'](),controller[_0xfe0a('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfe0a('0x13')]);router[_0xfe0a('0x14')](_0xfe0a('0xb'),auth[_0xfe0a('0x8')](),controller[_0xfe0a('0x15')]);router[_0xfe0a('0x14')](_0xfe0a('0x11'),auth[_0xfe0a('0x8')](),controller['removeProducts']);module['exports']=router; \ No newline at end of file diff --git a/server/api/saPriceList/saPriceList.attributes.js b/server/api/saPriceList/saPriceList.attributes.js index ef56dd1..b7a5ca5 100644 --- a/server/api/saPriceList/saPriceList.attributes.js +++ b/server/api/saPriceList/saPriceList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x212b=['exports','STRING','name','TEXT','DECIMAL','DATE','sequelize'];(function(_0x5d233d,_0x25a4e9){var _0x3fdfbb=function(_0x50e6b5){while(--_0x50e6b5){_0x5d233d['push'](_0x5d233d['shift']());}};_0x3fdfbb(++_0x25a4e9);}(_0x212b,0xd8));var _0xb212=function(_0x3d5262,_0x4c82e9){_0x3d5262=_0x3d5262-0x0;var _0x5717c7=_0x212b[_0x3d5262];return _0x5717c7;};'use strict';var Sequelize=require(_0xb212('0x0'));module[_0xb212('0x1')]={'name':{'type':Sequelize[_0xb212('0x2')],'allowNull':![],'unique':_0xb212('0x3')},'description':{'type':Sequelize[_0xb212('0x4')],'allowNull':!![]},'discount':{'type':Sequelize[_0xb212('0x5')](0x6,0x3),'allowNull':![]},'startAt':{'type':Sequelize[_0xb212('0x6')],'allowNull':!![]},'endAt':{'type':Sequelize[_0xb212('0x6')],'allowNull':!![]}}; \ No newline at end of file +var _0xe325=['name','TEXT','DATE','sequelize','exports','STRING'];(function(_0x2ab555,_0x279e2f){var _0x560ea6=function(_0x2f3434){while(--_0x2f3434){_0x2ab555['push'](_0x2ab555['shift']());}};_0x560ea6(++_0x279e2f);}(_0xe325,0x75));var _0x5e32=function(_0x1a1460,_0x539531){_0x1a1460=_0x1a1460-0x0;var _0x33ab03=_0xe325[_0x1a1460];return _0x33ab03;};'use strict';var Sequelize=require(_0x5e32('0x0'));module[_0x5e32('0x1')]={'name':{'type':Sequelize[_0x5e32('0x2')],'allowNull':![],'unique':_0x5e32('0x3')},'description':{'type':Sequelize[_0x5e32('0x4')],'allowNull':!![]},'discount':{'type':Sequelize['DECIMAL'](0x6,0x3),'allowNull':![]},'startAt':{'type':Sequelize['DATE'],'allowNull':!![]},'endAt':{'type':Sequelize[_0x5e32('0x5')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/saPriceList/saPriceList.controller.js b/server/api/saPriceList/saPriceList.controller.js index 3bc59b0..6db949e 100644 --- a/server/api/saPriceList/saPriceList.controller.js +++ b/server/api/saPriceList/saPriceList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f1d=['pick','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','CmCompany','company','findAll','rows','show','attributes','length','catch','create','clone','params','find','get','updatedAt','body','omit','createdAt','update','destroy','describe','getProducts','findOne','SAProductPricesList','PriceListId','SAProduct','Pricelist','addProduct','removeProducts','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','SAPriceList','rawAttributes','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','offset','order','sort'];(function(_0x54e8f1,_0x4f0751){var _0xca216f=function(_0x1396dc){while(--_0x1396dc){_0x54e8f1['push'](_0x54e8f1['shift']());}};_0xca216f(++_0x4f0751);}(_0x8f1d,0x82));var _0xd8f1=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x8f1d[_0xd09668];return _0x68726;};'use strict';var pdf=require(_0xd8f1('0x0'));var emlformat=require(_0xd8f1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8f1('0x2'));var jsonpatch=require(_0xd8f1('0x3'));var rp=require(_0xd8f1('0x4'));var moment=require(_0xd8f1('0x5'));var BPromise=require(_0xd8f1('0x6'));var Mustache=require('mustache');var util=require(_0xd8f1('0x7'));var path=require('path');var sox=require(_0xd8f1('0x8'));var csv=require(_0xd8f1('0x9'));var ejs=require(_0xd8f1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd8f1('0xb'));var crypto=require(_0xd8f1('0xc'));var jsforce=require(_0xd8f1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd8f1('0x9'));var querystring=require(_0xd8f1('0xe'));var Papa=require(_0xd8f1('0xf'));var Redis=require(_0xd8f1('0x10'));var authService=require(_0xd8f1('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd8f1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd8f1('0x13'));var db=require(_0xd8f1('0x14'))['db'];function respondWithStatusCode(_0xf56475,_0x54c965){_0x54c965=_0x54c965||0xcc;return function(_0x1e8e07){if(_0x1e8e07){return _0xf56475[_0xd8f1('0x15')](_0x54c965);}return _0xf56475[_0xd8f1('0x16')](_0x54c965)['end']();};}function respondWithResult(_0x567716,_0xb31c7f){_0xb31c7f=_0xb31c7f||0xc8;return function(_0x1f8cbd){if(_0x1f8cbd){return _0x567716[_0xd8f1('0x16')](_0xb31c7f)['json'](_0x1f8cbd);}};}function respondWithFilteredResult(_0x258e2c,_0x88e761){return function(_0x13897f){if(_0x13897f){var _0x5d106f=_0x13897f[_0xd8f1('0x17')],_0x4acb29=_0x88e761['offset'],_0x1e512e=_0x88e761['offset']+_0x88e761[_0xd8f1('0x18')],_0x50f398;if(_0x1e512e>=_0x5d106f){_0x1e512e=_0x5d106f;_0x50f398=0xc8;}else{_0x50f398=0xce;}_0x258e2c['status'](_0x50f398);return _0x258e2c[_0xd8f1('0x19')](_0xd8f1('0x1a'),_0x4acb29+'-'+_0x1e512e+'/'+_0x5d106f)['json'](_0x13897f);}return null;};}function patchUpdates(_0x2d770e){return function(_0x4217eb){try{jsonpatch[_0xd8f1('0x1b')](_0x4217eb,_0x2d770e,!![]);}catch(_0x5c8c6f){return BPromise[_0xd8f1('0x1c')](_0x5c8c6f);}return _0x4217eb[_0xd8f1('0x1d')]();};}function saveUpdates(_0x423d2a,_0x50f9d5){return function(_0x4d266f){if(_0x4d266f){return _0x4d266f['update'](_0x423d2a)[_0xd8f1('0x1e')](function(_0x96e8fc){return _0x96e8fc;});}return null;};}function removeEntity(_0x1cd4c5,_0x13628e){return function(_0x5d7f2a){if(_0x5d7f2a){return _0x5d7f2a['destroy']()[_0xd8f1('0x1e')](function(){_0x1cd4c5[_0xd8f1('0x16')](0xcc)[_0xd8f1('0x1f')]();});}};}function handleEntityNotFound(_0x314afa,_0x1fef7c){return function(_0x5bc2e4){if(!_0x5bc2e4){_0x314afa[_0xd8f1('0x15')](0x194);}return _0x5bc2e4;};}function handleError(_0x20c8ff,_0x1aa411){_0x1aa411=_0x1aa411||0x1f4;return function(_0x25652e){logger[_0xd8f1('0x20')](_0x25652e[_0xd8f1('0x21')]);if(_0x25652e[_0xd8f1('0x22')]){delete _0x25652e[_0xd8f1('0x22')];}_0x20c8ff[_0xd8f1('0x16')](_0x1aa411)[_0xd8f1('0x23')](_0x25652e);};}exports[_0xd8f1('0x24')]=function(_0x34786e,_0xf3440f){var _0x149061={},_0x5b607c={},_0x27dcae={'count':0x0,'rows':[]};var _0x46bba6=db[_0xd8f1('0x25')][_0xd8f1('0x26')];_0x5b607c[_0xd8f1('0x27')]=_['keys'](_0x46bba6);_0x5b607c[_0xd8f1('0x28')]=_[_0xd8f1('0x29')](_0x34786e[_0xd8f1('0x28')]);_0x5b607c[_0xd8f1('0x2a')]=_[_0xd8f1('0x2b')](_0x5b607c[_0xd8f1('0x27')],_0x5b607c[_0xd8f1('0x28')]);_0x149061['attributes']=_[_0xd8f1('0x2b')](_0x5b607c[_0xd8f1('0x27')],qs[_0xd8f1('0x2c')](_0x34786e[_0xd8f1('0x28')][_0xd8f1('0x2c')]));_0x149061['attributes']=_0x149061['attributes']['length']?_0x149061['attributes']:_0x5b607c[_0xd8f1('0x27')];if(!_0x34786e['query'][_0xd8f1('0x2d')](_0xd8f1('0x2e'))){_0x149061['limit']=qs[_0xd8f1('0x18')](_0x34786e[_0xd8f1('0x28')][_0xd8f1('0x18')]);_0x149061[_0xd8f1('0x2f')]=qs[_0xd8f1('0x2f')](_0x34786e[_0xd8f1('0x28')][_0xd8f1('0x2f')]);}_0x149061[_0xd8f1('0x30')]=qs[_0xd8f1('0x31')](_0x34786e['query'][_0xd8f1('0x31')]);_0x149061['where']=qs['filters'](_[_0xd8f1('0x32')](_0x34786e[_0xd8f1('0x28')],_0x5b607c['filters']));if(_0x34786e[_0xd8f1('0x28')][_0xd8f1('0x33')]){_0x149061[_0xd8f1('0x34')]=_[_0xd8f1('0x35')](_0x149061[_0xd8f1('0x34')],{'$or':_['map'](_0x46bba6,function(_0x383336){if(_0x383336[_0xd8f1('0x36')][_0xd8f1('0x37')]!==_0xd8f1('0x38')){var _0x551328={};_0x551328[_0x383336[_0xd8f1('0x39')]]={'$like':'%'+_0x34786e['query'][_0xd8f1('0x33')]+'%'};return _0x551328;}})});}_0x149061=_['merge']({},_0x149061,_0x34786e[_0xd8f1('0x3a')]);var _0x64b8ef={'where':_0x149061[_0xd8f1('0x34')]};return db[_0xd8f1('0x25')][_0xd8f1('0x17')](_0x64b8ef)[_0xd8f1('0x1e')](function(_0x1663c7){_0x27dcae[_0xd8f1('0x17')]=_0x1663c7;if(_0x34786e[_0xd8f1('0x28')][_0xd8f1('0x3b')]){_0x149061[_0xd8f1('0x3c')]=[{'model':db[_0xd8f1('0x3d')],'as':_0xd8f1('0x3e')}];}return db[_0xd8f1('0x25')][_0xd8f1('0x3f')](_0x149061);})[_0xd8f1('0x1e')](function(_0x585a95){_0x27dcae[_0xd8f1('0x40')]=_0x585a95;return _0x27dcae;})['then'](respondWithFilteredResult(_0xf3440f,_0x149061))['catch'](handleError(_0xf3440f,null));};exports[_0xd8f1('0x41')]=function(_0x2c2659,_0x3c2b26){var _0x2cb06b={'raw':![],'where':{'id':_0x2c2659['params']['id']}},_0x5f3b4c={};_0x5f3b4c[_0xd8f1('0x27')]=_[_0xd8f1('0x29')](db[_0xd8f1('0x25')]['rawAttributes']);_0x5f3b4c[_0xd8f1('0x28')]=_[_0xd8f1('0x29')](_0x2c2659[_0xd8f1('0x28')]);_0x5f3b4c[_0xd8f1('0x2a')]=_[_0xd8f1('0x2b')](_0x5f3b4c[_0xd8f1('0x27')],_0x5f3b4c[_0xd8f1('0x28')]);_0x2cb06b[_0xd8f1('0x42')]=_[_0xd8f1('0x2b')](_0x5f3b4c['model'],qs[_0xd8f1('0x2c')](_0x2c2659[_0xd8f1('0x28')][_0xd8f1('0x2c')]));_0x2cb06b['attributes']=_0x2cb06b[_0xd8f1('0x42')][_0xd8f1('0x43')]?_0x2cb06b['attributes']:_0x5f3b4c['model'];if(_0x2c2659['query']['includeAll']){_0x2cb06b[_0xd8f1('0x3c')]=[{'all':!![]}];}_0x2cb06b=_[_0xd8f1('0x35')]({},_0x2cb06b,_0x2c2659['options']);return db['SAPriceList']['find'](_0x2cb06b)[_0xd8f1('0x1e')](handleEntityNotFound(_0x3c2b26,null))[_0xd8f1('0x1e')](respondWithResult(_0x3c2b26,null))[_0xd8f1('0x44')](handleError(_0x3c2b26,null));};exports[_0xd8f1('0x45')]=function(_0x43cad3,_0x16f363){return db[_0xd8f1('0x25')]['create'](_0x43cad3['body'],{})[_0xd8f1('0x1e')](respondWithResult(_0x16f363,0xc9))[_0xd8f1('0x44')](handleError(_0x16f363,null));};exports[_0xd8f1('0x46')]=function(_0x4b7b92,_0x4761d4){var _0x6f1aba={'raw':![],'where':{'id':_0x4b7b92[_0xd8f1('0x47')]['id']}},_0x8c07d1={};_0x8c07d1[_0xd8f1('0x27')]=_[_0xd8f1('0x29')](db[_0xd8f1('0x25')][_0xd8f1('0x26')]);_0x6f1aba[_0xd8f1('0x42')]=_[_0xd8f1('0x2b')](_0x8c07d1['model'],qs[_0xd8f1('0x2c')](_0x4b7b92[_0xd8f1('0x28')]['fields']));_0x6f1aba[_0xd8f1('0x42')]=_0x6f1aba[_0xd8f1('0x42')][_0xd8f1('0x43')]?_0x6f1aba[_0xd8f1('0x42')]:_0x8c07d1['model'];if(_0x4b7b92[_0xd8f1('0x28')]['includeAll']){_0x6f1aba['include']=[{'all':!![]}];}_0x6f1aba=_[_0xd8f1('0x35')]({},_0x6f1aba,_0x4b7b92[_0xd8f1('0x3a')]);return db['SAPriceList'][_0xd8f1('0x48')](_0x6f1aba)[_0xd8f1('0x1e')](handleEntityNotFound(_0x4761d4,null))[_0xd8f1('0x1e')](function(_0x3910c6){if(_0x3910c6){var _0x17bf31=_0x3910c6[_0xd8f1('0x49')]({'plain':!![]});_0x17bf31=qs['omit'](_0x17bf31,['id','createdAt',_0xd8f1('0x4a')]);_0x4b7b92[_0xd8f1('0x4b')]=_[_0xd8f1('0x4c')](_0x4b7b92[_0xd8f1('0x4b')],['id',_0xd8f1('0x4d'),_0xd8f1('0x4a')]);return db[_0xd8f1('0x25')][_0xd8f1('0x45')](_[_0xd8f1('0x35')](_0x17bf31,_0x4b7b92[_0xd8f1('0x4b')]),{'include':_0x4b7b92[_0xd8f1('0x28')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xd8f1('0x1e')](respondWithResult(_0x4761d4,0xc9))[_0xd8f1('0x44')](handleError(_0x4761d4,null));};exports[_0xd8f1('0x4e')]=function(_0x19a021,_0x4d6d3c){if(_0x19a021['body']['id']){delete _0x19a021['body']['id'];}return db[_0xd8f1('0x25')][_0xd8f1('0x48')]({'where':{'id':_0x19a021['params']['id']}})[_0xd8f1('0x1e')](handleEntityNotFound(_0x4d6d3c,null))[_0xd8f1('0x1e')](saveUpdates(_0x19a021[_0xd8f1('0x4b')],null))[_0xd8f1('0x1e')](respondWithResult(_0x4d6d3c,null))[_0xd8f1('0x44')](handleError(_0x4d6d3c,null));};exports[_0xd8f1('0x4f')]=function(_0x2fb4a3,_0x53171e){return db[_0xd8f1('0x25')]['find']({'where':{'id':_0x2fb4a3['params']['id']}})[_0xd8f1('0x1e')](handleEntityNotFound(_0x53171e,null))['then'](removeEntity(_0x53171e,null))['catch'](handleError(_0x53171e,null));};exports[_0xd8f1('0x50')]=function(_0x28d719,_0x227511){return db[_0xd8f1('0x25')][_0xd8f1('0x50')]()['then'](respondWithResult(_0x227511,null))['catch'](handleError(_0x227511,null));};exports[_0xd8f1('0x51')]=function(_0x12e4ee,_0x5a5d8e,_0x3714e4){var _0x5bd6f5={'raw':![],'where':{}};var _0x59d5fb={};var _0x330660={'count':0x0,'rows':[]};return db[_0xd8f1('0x25')][_0xd8f1('0x52')]({'where':{'id':_0x12e4ee[_0xd8f1('0x47')]['id']}})[_0xd8f1('0x1e')](handleEntityNotFound(_0x5a5d8e,null))[_0xd8f1('0x1e')](function(_0xf53a21){if(_0xf53a21){_0x59d5fb[_0xd8f1('0x27')]=_['keys'](db[_0xd8f1('0x53')]['rawAttributes']);_0x59d5fb['query']=_['keys'](_0x12e4ee['query']);_0x59d5fb[_0xd8f1('0x2a')]=_[_0xd8f1('0x2b')](_0x59d5fb['model'],_0x59d5fb[_0xd8f1('0x28')]);_0x5bd6f5['attributes']=_['intersection'](_0x59d5fb[_0xd8f1('0x27')],qs[_0xd8f1('0x2c')](_0x12e4ee[_0xd8f1('0x28')][_0xd8f1('0x2c')]));_0x5bd6f5[_0xd8f1('0x42')]=_0x5bd6f5[_0xd8f1('0x42')]['length']?_0x5bd6f5[_0xd8f1('0x42')]:_0x59d5fb[_0xd8f1('0x27')];if(!_0x12e4ee['query'][_0xd8f1('0x2d')](_0xd8f1('0x2e'))){_0x5bd6f5[_0xd8f1('0x18')]=qs[_0xd8f1('0x18')](_0x12e4ee['query'][_0xd8f1('0x18')]);_0x5bd6f5[_0xd8f1('0x2f')]=qs['offset'](_0x12e4ee['query'][_0xd8f1('0x2f')]);}_0x5bd6f5[_0xd8f1('0x30')]=qs[_0xd8f1('0x31')](_0x12e4ee[_0xd8f1('0x28')][_0xd8f1('0x31')]);_0x5bd6f5['where']=qs['filters'](_[_0xd8f1('0x32')](_0x12e4ee[_0xd8f1('0x28')],_0x59d5fb[_0xd8f1('0x2a')]));_0x5bd6f5[_0xd8f1('0x34')][_0xd8f1('0x54')]=_0xf53a21['id'];if(_0x12e4ee[_0xd8f1('0x28')][_0xd8f1('0x33')]){_0x5bd6f5[_0xd8f1('0x34')]=_[_0xd8f1('0x35')](_0x5bd6f5[_0xd8f1('0x34')],{'$or':_['map'](_0x5bd6f5[_0xd8f1('0x42')],function(_0x424ed0){var _0x529c20={};_0x529c20[_0x424ed0]={'$like':'%'+_0x12e4ee[_0xd8f1('0x28')][_0xd8f1('0x33')]+'%'};return _0x529c20;})});}_0x5bd6f5=_[_0xd8f1('0x35')]({},_0x5bd6f5,_0x12e4ee[_0xd8f1('0x3a')]);return db[_0xd8f1('0x53')][_0xd8f1('0x17')]({'where':_0x5bd6f5[_0xd8f1('0x34')]})[_0xd8f1('0x1e')](function(_0x4abd9e){_0x330660[_0xd8f1('0x17')]=_0x4abd9e;if(_0x12e4ee['query'][_0xd8f1('0x3b')]){_0x5bd6f5[_0xd8f1('0x3c')]=[{'model':db[_0xd8f1('0x55')],'as':'Product','include':[{'all':!![]}]},{'model':db[_0xd8f1('0x25')],'as':_0xd8f1('0x56')}];}return db['SAProductPricesList']['findAll'](_0x5bd6f5);})[_0xd8f1('0x1e')](function(_0x214404){_0x330660[_0xd8f1('0x40')]=_0x214404;return _0x330660;});}})[_0xd8f1('0x1e')](respondWithFilteredResult(_0x5a5d8e,_0x5bd6f5))['catch'](handleError(_0x5a5d8e,null));};exports[_0xd8f1('0x57')]=function(_0x223474,_0x4ccbfd,_0x135483){if(_0x223474[_0xd8f1('0x4b')]['id']){delete _0x223474['body']['id'];}return db['SAPriceList']['find']({'where':{'id':_0x223474['params']['id']}})[_0xd8f1('0x1e')](handleEntityNotFound(_0x4ccbfd,null))[_0xd8f1('0x1e')](function(_0x179df1){if(_0x179df1){_0x223474['body'][_0xd8f1('0x54')]=_0x179df1['id'];return db[_0xd8f1('0x53')][_0xd8f1('0x45')](_0x223474['body']);}})[_0xd8f1('0x1e')](respondWithResult(_0x4ccbfd,null))[_0xd8f1('0x44')](handleError(_0x4ccbfd,null));};exports[_0xd8f1('0x58')]=function(_0x5f3532,_0x4f78de,_0x1f103c){return db[_0xd8f1('0x53')][_0xd8f1('0x48')]({'where':{'id':_0x5f3532[_0xd8f1('0x47')]['id']}})[_0xd8f1('0x1e')](handleEntityNotFound(_0x4f78de,null))['then'](function(_0x5b3b7d){if(_0x5b3b7d){return _0x5b3b7d[_0xd8f1('0x58')](_0x5f3532[_0xd8f1('0x28')][_0xd8f1('0x59')]);}})[_0xd8f1('0x1e')](respondWithStatusCode(_0x4f78de,null))['catch'](handleError(_0x4f78de,null));}; \ No newline at end of file +var _0xbc27=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','SAPriceList','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','count','includeAll','include','CmCompany','company','findAll','rows','catch','show','options','find','create','body','clone','params','omit','createdAt','updatedAt','describe','getProducts','findOne','SAProductPricesList','PriceListId','SAProduct','Product','Pricelist','addProduct','removeProducts','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv'];(function(_0x34613,_0x5c6da8){var _0x3fd314=function(_0x32e845){while(--_0x32e845){_0x34613['push'](_0x34613['shift']());}};_0x3fd314(++_0x5c6da8);}(_0xbc27,0x1b8));var _0x7bc2=function(_0xcd0cba,_0x50d5ef){_0xcd0cba=_0xcd0cba-0x0;var _0x27be30=_0xbc27[_0xcd0cba];return _0x27be30;};'use strict';var pdf=require(_0x7bc2('0x0'));var emlformat=require(_0x7bc2('0x1'));var rimraf=require(_0x7bc2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7bc2('0x3'));var moment=require(_0x7bc2('0x4'));var BPromise=require(_0x7bc2('0x5'));var Mustache=require(_0x7bc2('0x6'));var util=require(_0x7bc2('0x7'));var path=require(_0x7bc2('0x8'));var sox=require(_0x7bc2('0x9'));var csv=require('to-csv');var ejs=require(_0x7bc2('0xa'));var fs=require('fs');var _=require(_0x7bc2('0xb'));var squel=require(_0x7bc2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7bc2('0xd'));var toCsv=require(_0x7bc2('0xe'));var querystring=require('querystring');var Papa=require(_0x7bc2('0xf'));var Redis=require(_0x7bc2('0x10'));var authService=require(_0x7bc2('0x11'));var qs=require(_0x7bc2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bc2('0x13'))(_0x7bc2('0x14'));var utils=require('../../config/utils');var config=require(_0x7bc2('0x15'));var db=require(_0x7bc2('0x16'))['db'];function respondWithStatusCode(_0x5c2ec2,_0x194205){_0x194205=_0x194205||0xcc;return function(_0x532f04){if(_0x532f04){return _0x5c2ec2[_0x7bc2('0x17')](_0x194205);}return _0x5c2ec2[_0x7bc2('0x18')](_0x194205)['end']();};}function respondWithResult(_0x4aeb65,_0x135be3){_0x135be3=_0x135be3||0xc8;return function(_0xecd08a){if(_0xecd08a){return _0x4aeb65[_0x7bc2('0x18')](_0x135be3)[_0x7bc2('0x19')](_0xecd08a);}};}function respondWithFilteredResult(_0x208dd5,_0x16295b){return function(_0x5d79c3){if(_0x5d79c3){var _0x109f15=_0x5d79c3['count'],_0x548466=_0x16295b[_0x7bc2('0x1a')],_0x2338bb=_0x16295b[_0x7bc2('0x1a')]+_0x16295b[_0x7bc2('0x1b')],_0x1496a5;if(_0x2338bb>=_0x109f15){_0x2338bb=_0x109f15;_0x1496a5=0xc8;}else{_0x1496a5=0xce;}_0x208dd5['status'](_0x1496a5);return _0x208dd5[_0x7bc2('0x1c')]('Content-Range',_0x548466+'-'+_0x2338bb+'/'+_0x109f15)[_0x7bc2('0x19')](_0x5d79c3);}return null;};}function patchUpdates(_0x157e70){return function(_0x1415a5){try{jsonpatch[_0x7bc2('0x1d')](_0x1415a5,_0x157e70,!![]);}catch(_0x5b88bd){return BPromise[_0x7bc2('0x1e')](_0x5b88bd);}return _0x1415a5[_0x7bc2('0x1f')]();};}function saveUpdates(_0x11d67c,_0x4b32fe){return function(_0x3462c6){if(_0x3462c6){return _0x3462c6[_0x7bc2('0x20')](_0x11d67c)[_0x7bc2('0x21')](function(_0x2ef2bb){return _0x2ef2bb;});}return null;};}function removeEntity(_0x20b3c4,_0x60d6ca){return function(_0x3a7df0){if(_0x3a7df0){return _0x3a7df0[_0x7bc2('0x22')]()[_0x7bc2('0x21')](function(){_0x20b3c4[_0x7bc2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d0224,_0x4eb96f){return function(_0x58a778){if(!_0x58a778){_0x5d0224[_0x7bc2('0x17')](0x194);}return _0x58a778;};}function handleError(_0x454729,_0x44c004){_0x44c004=_0x44c004||0x1f4;return function(_0x39024a){logger[_0x7bc2('0x23')](_0x39024a[_0x7bc2('0x24')]);if(_0x39024a[_0x7bc2('0x25')]){delete _0x39024a[_0x7bc2('0x25')];}_0x454729[_0x7bc2('0x18')](_0x44c004)[_0x7bc2('0x26')](_0x39024a);};}exports[_0x7bc2('0x27')]=function(_0x546279,_0x2d8d05){var _0x223eaf={},_0x2020f6={},_0x323b69={'count':0x0,'rows':[]};var _0x3e74ad=db[_0x7bc2('0x28')][_0x7bc2('0x29')];_0x2020f6[_0x7bc2('0x2a')]=_['keys'](_0x3e74ad);_0x2020f6['query']=_[_0x7bc2('0x2b')](_0x546279[_0x7bc2('0x2c')]);_0x2020f6[_0x7bc2('0x2d')]=_[_0x7bc2('0x2e')](_0x2020f6['model'],_0x2020f6[_0x7bc2('0x2c')]);_0x223eaf[_0x7bc2('0x2f')]=_['intersection'](_0x2020f6['model'],qs[_0x7bc2('0x30')](_0x546279['query'][_0x7bc2('0x30')]));_0x223eaf['attributes']=_0x223eaf[_0x7bc2('0x2f')][_0x7bc2('0x31')]?_0x223eaf[_0x7bc2('0x2f')]:_0x2020f6[_0x7bc2('0x2a')];if(!_0x546279[_0x7bc2('0x2c')][_0x7bc2('0x32')](_0x7bc2('0x33'))){_0x223eaf[_0x7bc2('0x1b')]=qs[_0x7bc2('0x1b')](_0x546279[_0x7bc2('0x2c')][_0x7bc2('0x1b')]);_0x223eaf[_0x7bc2('0x1a')]=qs[_0x7bc2('0x1a')](_0x546279[_0x7bc2('0x2c')]['offset']);}_0x223eaf[_0x7bc2('0x34')]=qs[_0x7bc2('0x35')](_0x546279['query'][_0x7bc2('0x35')]);_0x223eaf[_0x7bc2('0x36')]=qs[_0x7bc2('0x2d')](_[_0x7bc2('0x37')](_0x546279[_0x7bc2('0x2c')],_0x2020f6[_0x7bc2('0x2d')]));if(_0x546279[_0x7bc2('0x2c')][_0x7bc2('0x38')]){_0x223eaf[_0x7bc2('0x36')]=_['merge'](_0x223eaf[_0x7bc2('0x36')],{'$or':_[_0x7bc2('0x39')](_0x3e74ad,function(_0x220c15){if(_0x220c15[_0x7bc2('0x3a')][_0x7bc2('0x3b')]!==_0x7bc2('0x3c')){var _0x5ed852={};_0x5ed852[_0x220c15[_0x7bc2('0x3d')]]={'$like':'%'+_0x546279[_0x7bc2('0x2c')][_0x7bc2('0x38')]+'%'};return _0x5ed852;}})});}_0x223eaf=_[_0x7bc2('0x3e')]({},_0x223eaf,_0x546279['options']);var _0x45669e={'where':_0x223eaf[_0x7bc2('0x36')]};return db[_0x7bc2('0x28')][_0x7bc2('0x3f')](_0x45669e)[_0x7bc2('0x21')](function(_0x2e4e34){_0x323b69[_0x7bc2('0x3f')]=_0x2e4e34;if(_0x546279[_0x7bc2('0x2c')][_0x7bc2('0x40')]){_0x223eaf[_0x7bc2('0x41')]=[{'model':db[_0x7bc2('0x42')],'as':_0x7bc2('0x43')}];}return db[_0x7bc2('0x28')][_0x7bc2('0x44')](_0x223eaf);})[_0x7bc2('0x21')](function(_0x52a62a){_0x323b69[_0x7bc2('0x45')]=_0x52a62a;return _0x323b69;})[_0x7bc2('0x21')](respondWithFilteredResult(_0x2d8d05,_0x223eaf))[_0x7bc2('0x46')](handleError(_0x2d8d05,null));};exports[_0x7bc2('0x47')]=function(_0x12c0c8,_0x3398f2){var _0x91cbce={'raw':![],'where':{'id':_0x12c0c8['params']['id']}},_0x18b516={};_0x18b516['model']=_['keys'](db['SAPriceList'][_0x7bc2('0x29')]);_0x18b516[_0x7bc2('0x2c')]=_[_0x7bc2('0x2b')](_0x12c0c8[_0x7bc2('0x2c')]);_0x18b516['filters']=_[_0x7bc2('0x2e')](_0x18b516[_0x7bc2('0x2a')],_0x18b516[_0x7bc2('0x2c')]);_0x91cbce[_0x7bc2('0x2f')]=_[_0x7bc2('0x2e')](_0x18b516[_0x7bc2('0x2a')],qs[_0x7bc2('0x30')](_0x12c0c8['query'][_0x7bc2('0x30')]));_0x91cbce[_0x7bc2('0x2f')]=_0x91cbce[_0x7bc2('0x2f')][_0x7bc2('0x31')]?_0x91cbce[_0x7bc2('0x2f')]:_0x18b516[_0x7bc2('0x2a')];if(_0x12c0c8[_0x7bc2('0x2c')][_0x7bc2('0x40')]){_0x91cbce[_0x7bc2('0x41')]=[{'all':!![]}];}_0x91cbce=_[_0x7bc2('0x3e')]({},_0x91cbce,_0x12c0c8[_0x7bc2('0x48')]);return db[_0x7bc2('0x28')][_0x7bc2('0x49')](_0x91cbce)['then'](handleEntityNotFound(_0x3398f2,null))[_0x7bc2('0x21')](respondWithResult(_0x3398f2,null))[_0x7bc2('0x46')](handleError(_0x3398f2,null));};exports[_0x7bc2('0x4a')]=function(_0x49f34d,_0x343f8b){return db[_0x7bc2('0x28')][_0x7bc2('0x4a')](_0x49f34d[_0x7bc2('0x4b')],{})[_0x7bc2('0x21')](respondWithResult(_0x343f8b,0xc9))[_0x7bc2('0x46')](handleError(_0x343f8b,null));};exports[_0x7bc2('0x4c')]=function(_0x4d6095,_0x390552){var _0x53067b={'raw':![],'where':{'id':_0x4d6095[_0x7bc2('0x4d')]['id']}},_0x1ad721={};_0x1ad721[_0x7bc2('0x2a')]=_[_0x7bc2('0x2b')](db['SAPriceList'][_0x7bc2('0x29')]);_0x53067b['attributes']=_[_0x7bc2('0x2e')](_0x1ad721['model'],qs[_0x7bc2('0x30')](_0x4d6095['query']['fields']));_0x53067b[_0x7bc2('0x2f')]=_0x53067b[_0x7bc2('0x2f')][_0x7bc2('0x31')]?_0x53067b[_0x7bc2('0x2f')]:_0x1ad721['model'];if(_0x4d6095['query']['includeAll']){_0x53067b[_0x7bc2('0x41')]=[{'all':!![]}];}_0x53067b=_[_0x7bc2('0x3e')]({},_0x53067b,_0x4d6095['options']);return db['SAPriceList'][_0x7bc2('0x49')](_0x53067b)['then'](handleEntityNotFound(_0x390552,null))[_0x7bc2('0x21')](function(_0x6bcaf0){if(_0x6bcaf0){var _0xfd08e2=_0x6bcaf0['get']({'plain':!![]});_0xfd08e2=qs[_0x7bc2('0x4e')](_0xfd08e2,['id',_0x7bc2('0x4f'),_0x7bc2('0x50')]);_0x4d6095[_0x7bc2('0x4b')]=_[_0x7bc2('0x4e')](_0x4d6095['body'],['id','createdAt',_0x7bc2('0x50')]);return db[_0x7bc2('0x28')]['create'](_[_0x7bc2('0x3e')](_0xfd08e2,_0x4d6095[_0x7bc2('0x4b')]),{'include':_0x4d6095['query'][_0x7bc2('0x40')]?[{'all':!![]}]:undefined});}})[_0x7bc2('0x21')](respondWithResult(_0x390552,0xc9))[_0x7bc2('0x46')](handleError(_0x390552,null));};exports[_0x7bc2('0x20')]=function(_0x5d4339,_0x547065){if(_0x5d4339[_0x7bc2('0x4b')]['id']){delete _0x5d4339[_0x7bc2('0x4b')]['id'];}return db[_0x7bc2('0x28')][_0x7bc2('0x49')]({'where':{'id':_0x5d4339['params']['id']}})[_0x7bc2('0x21')](handleEntityNotFound(_0x547065,null))[_0x7bc2('0x21')](saveUpdates(_0x5d4339[_0x7bc2('0x4b')],null))['then'](respondWithResult(_0x547065,null))[_0x7bc2('0x46')](handleError(_0x547065,null));};exports[_0x7bc2('0x22')]=function(_0x8f706,_0x27f5cf){return db[_0x7bc2('0x28')][_0x7bc2('0x49')]({'where':{'id':_0x8f706[_0x7bc2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27f5cf,null))['then'](removeEntity(_0x27f5cf,null))[_0x7bc2('0x46')](handleError(_0x27f5cf,null));};exports['describe']=function(_0x2310a8,_0x5a89e3){return db[_0x7bc2('0x28')][_0x7bc2('0x51')]()[_0x7bc2('0x21')](respondWithResult(_0x5a89e3,null))[_0x7bc2('0x46')](handleError(_0x5a89e3,null));};exports[_0x7bc2('0x52')]=function(_0x290923,_0x2f5381,_0x18f7c3){var _0x5a3e14={'raw':![],'where':{}};var _0x89a5cb={};var _0x46b967={'count':0x0,'rows':[]};return db['SAPriceList'][_0x7bc2('0x53')]({'where':{'id':_0x290923['params']['id']}})[_0x7bc2('0x21')](handleEntityNotFound(_0x2f5381,null))[_0x7bc2('0x21')](function(_0x3a2010){if(_0x3a2010){_0x89a5cb[_0x7bc2('0x2a')]=_[_0x7bc2('0x2b')](db[_0x7bc2('0x54')]['rawAttributes']);_0x89a5cb[_0x7bc2('0x2c')]=_[_0x7bc2('0x2b')](_0x290923['query']);_0x89a5cb[_0x7bc2('0x2d')]=_[_0x7bc2('0x2e')](_0x89a5cb[_0x7bc2('0x2a')],_0x89a5cb[_0x7bc2('0x2c')]);_0x5a3e14[_0x7bc2('0x2f')]=_[_0x7bc2('0x2e')](_0x89a5cb[_0x7bc2('0x2a')],qs[_0x7bc2('0x30')](_0x290923[_0x7bc2('0x2c')][_0x7bc2('0x30')]));_0x5a3e14[_0x7bc2('0x2f')]=_0x5a3e14['attributes'][_0x7bc2('0x31')]?_0x5a3e14[_0x7bc2('0x2f')]:_0x89a5cb[_0x7bc2('0x2a')];if(!_0x290923['query'][_0x7bc2('0x32')]('nolimit')){_0x5a3e14[_0x7bc2('0x1b')]=qs[_0x7bc2('0x1b')](_0x290923[_0x7bc2('0x2c')][_0x7bc2('0x1b')]);_0x5a3e14[_0x7bc2('0x1a')]=qs[_0x7bc2('0x1a')](_0x290923[_0x7bc2('0x2c')]['offset']);}_0x5a3e14[_0x7bc2('0x34')]=qs[_0x7bc2('0x35')](_0x290923['query'][_0x7bc2('0x35')]);_0x5a3e14[_0x7bc2('0x36')]=qs[_0x7bc2('0x2d')](_[_0x7bc2('0x37')](_0x290923[_0x7bc2('0x2c')],_0x89a5cb[_0x7bc2('0x2d')]));_0x5a3e14[_0x7bc2('0x36')][_0x7bc2('0x55')]=_0x3a2010['id'];if(_0x290923['query'][_0x7bc2('0x38')]){_0x5a3e14[_0x7bc2('0x36')]=_[_0x7bc2('0x3e')](_0x5a3e14[_0x7bc2('0x36')],{'$or':_[_0x7bc2('0x39')](_0x5a3e14[_0x7bc2('0x2f')],function(_0x1b4e81){var _0x59f3c4={};_0x59f3c4[_0x1b4e81]={'$like':'%'+_0x290923['query'][_0x7bc2('0x38')]+'%'};return _0x59f3c4;})});}_0x5a3e14=_[_0x7bc2('0x3e')]({},_0x5a3e14,_0x290923[_0x7bc2('0x48')]);return db[_0x7bc2('0x54')]['count']({'where':_0x5a3e14[_0x7bc2('0x36')]})[_0x7bc2('0x21')](function(_0x34245a){_0x46b967['count']=_0x34245a;if(_0x290923[_0x7bc2('0x2c')]['includeAll']){_0x5a3e14[_0x7bc2('0x41')]=[{'model':db[_0x7bc2('0x56')],'as':_0x7bc2('0x57'),'include':[{'all':!![]}]},{'model':db[_0x7bc2('0x28')],'as':_0x7bc2('0x58')}];}return db['SAProductPricesList'][_0x7bc2('0x44')](_0x5a3e14);})[_0x7bc2('0x21')](function(_0x11241f){_0x46b967[_0x7bc2('0x45')]=_0x11241f;return _0x46b967;});}})['then'](respondWithFilteredResult(_0x2f5381,_0x5a3e14))['catch'](handleError(_0x2f5381,null));};exports[_0x7bc2('0x59')]=function(_0x1ab501,_0x30db22,_0x2b4ac4){if(_0x1ab501[_0x7bc2('0x4b')]['id']){delete _0x1ab501[_0x7bc2('0x4b')]['id'];}return db[_0x7bc2('0x28')][_0x7bc2('0x49')]({'where':{'id':_0x1ab501[_0x7bc2('0x4d')]['id']}})[_0x7bc2('0x21')](handleEntityNotFound(_0x30db22,null))['then'](function(_0x1b4841){if(_0x1b4841){_0x1ab501[_0x7bc2('0x4b')]['PriceListId']=_0x1b4841['id'];return db[_0x7bc2('0x54')][_0x7bc2('0x4a')](_0x1ab501[_0x7bc2('0x4b')]);}})['then'](respondWithResult(_0x30db22,null))['catch'](handleError(_0x30db22,null));};exports[_0x7bc2('0x5a')]=function(_0x57f7a3,_0x12d53d,_0x6a8346){return db[_0x7bc2('0x54')][_0x7bc2('0x49')]({'where':{'id':_0x57f7a3['params']['id']}})[_0x7bc2('0x21')](handleEntityNotFound(_0x12d53d,null))[_0x7bc2('0x21')](function(_0x11076e){if(_0x11076e){return _0x11076e['removeProducts'](_0x57f7a3['query']['ids']);}})['then'](respondWithStatusCode(_0x12d53d,null))[_0x7bc2('0x46')](handleError(_0x12d53d,null));}; \ No newline at end of file diff --git a/server/api/saPriceList/saPriceList.model.js b/server/api/saPriceList/saPriceList.model.js index 693765f..4e02973 100644 --- a/server/api/saPriceList/saPriceList.model.js +++ b/server/api/saPriceList/saPriceList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./saPriceList.attributes','exports','SAPriceList','sa_price_list','lodash','util'];(function(_0x1d5ccb,_0x136776){var _0x49fc07=function(_0x3c29c6){while(--_0x3c29c6){_0x1d5ccb['push'](_0x1d5ccb['shift']());}};_0x49fc07(++_0x136776);}(_0x7a54,0x106));var _0x47a5=function(_0x4ab249,_0x629692){_0x4ab249=_0x4ab249-0x0;var _0x247759=_0x7a54[_0x4ab249];return _0x247759;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./saPriceList.attributes','exports','define','sa_price_list','lodash','../../config/logger'];(function(_0x52a7e1,_0x189bf3){var _0x4f4495=function(_0x5d1915){while(--_0x5d1915){_0x52a7e1['push'](_0x52a7e1['shift']());}};_0x4f4495(++_0x189bf3);}(_0xb10b,0x12a));var _0xbb10=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0xb10b[_0x5515a7];return _0x43f4bf;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('SAPriceList',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saPriceList/saPriceList.rpc.js b/server/api/saPriceList/saPriceList.rpc.js index 4bce893..87ba71a 100644 --- a/server/api/saPriceList/saPriceList.rpc.js +++ b/server/api/saPriceList/saPriceList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37bf=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SAPriceList,\x20%s,\x20%s','debug','SAPriceList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x29e3db,_0x5a9b43){var _0x20f394=function(_0x5d5650){while(--_0x5d5650){_0x29e3db['push'](_0x29e3db['shift']());}};_0x20f394(++_0x5a9b43);}(_0x37bf,0x72));var _0xf37b=function(_0x5e754f,_0x3a351d){_0x5e754f=_0x5e754f-0x0;var _0x1a3d70=_0x37bf[_0x5e754f];return _0x1a3d70;};'use strict';var _=require(_0xf37b('0x0'));var util=require(_0xf37b('0x1'));var moment=require(_0xf37b('0x2'));var BPromise=require(_0xf37b('0x3'));var rs=require(_0xf37b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf37b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf37b('0x6'))(_0xf37b('0x7'));var config=require(_0xf37b('0x8'));var jayson=require(_0xf37b('0x9'));var client=jayson['client'][_0xf37b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x62b9af,_0x34fbae,_0xc407b1){return new BPromise(function(_0x2d9317,_0xb1908){return client[_0xf37b('0xb')](_0x62b9af,_0xc407b1)[_0xf37b('0xc')](function(_0x1efbe7){logger[_0xf37b('0xd')](_0xf37b('0xe'),_0x34fbae,'request\x20sent');logger[_0xf37b('0xf')](_0xf37b('0x10'),_0x34fbae,_0xf37b('0x11'),JSON[_0xf37b('0x12')](_0x1efbe7));if(_0x1efbe7[_0xf37b('0x13')]){if(_0x1efbe7['error']['code']===0x1f4){logger[_0xf37b('0x13')](_0xf37b('0xe'),_0x34fbae,_0x1efbe7[_0xf37b('0x13')]['message']);return _0xb1908(_0x1efbe7['error'][_0xf37b('0x14')]);}logger[_0xf37b('0x13')]('SAPriceList,\x20%s,\x20%s',_0x34fbae,_0x1efbe7['error'][_0xf37b('0x14')]);return _0x2d9317(_0x1efbe7['error'][_0xf37b('0x14')]);}else{logger[_0xf37b('0xd')](_0xf37b('0xe'),_0x34fbae,'request\x20sent');_0x2d9317(_0x1efbe7[_0xf37b('0x15')][_0xf37b('0x14')]);}})[_0xf37b('0x16')](function(_0x214557){logger[_0xf37b('0x13')](_0xf37b('0xe'),_0x34fbae,_0x214557);_0xb1908(_0x214557);});});} \ No newline at end of file +var _0xa480=['info','SAPriceList,\x20%s,\x20%s','request\x20sent','debug','SAPriceList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x503855,_0x37ccc2){var _0x239a9c=function(_0x36b0e8){while(--_0x36b0e8){_0x503855['push'](_0x503855['shift']());}};_0x239a9c(++_0x37ccc2);}(_0xa480,0x1ba));var _0x0a48=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa480[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0a48('0x0'));var util=require('util');var moment=require(_0x0a48('0x1'));var BPromise=require(_0x0a48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a48('0x3'));var db=require(_0x0a48('0x4'))['db'];var utils=require(_0x0a48('0x5'));var logger=require(_0x0a48('0x6'))(_0x0a48('0x7'));var config=require(_0x0a48('0x8'));var jayson=require(_0x0a48('0x9'));var client=jayson[_0x0a48('0xa')][_0x0a48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ead4,_0x39ccf5,_0x5d3eb7){return new BPromise(function(_0x5c8eb2,_0x3df546){return client[_0x0a48('0xc')](_0x16ead4,_0x5d3eb7)[_0x0a48('0xd')](function(_0x1ea055){logger[_0x0a48('0xe')](_0x0a48('0xf'),_0x39ccf5,_0x0a48('0x10'));logger[_0x0a48('0x11')](_0x0a48('0x12'),_0x39ccf5,_0x0a48('0x10'),JSON[_0x0a48('0x13')](_0x1ea055));if(_0x1ea055[_0x0a48('0x14')]){if(_0x1ea055[_0x0a48('0x14')][_0x0a48('0x15')]===0x1f4){logger[_0x0a48('0x14')](_0x0a48('0xf'),_0x39ccf5,_0x1ea055[_0x0a48('0x14')][_0x0a48('0x16')]);return _0x3df546(_0x1ea055[_0x0a48('0x14')][_0x0a48('0x16')]);}logger[_0x0a48('0x14')](_0x0a48('0xf'),_0x39ccf5,_0x1ea055[_0x0a48('0x14')]['message']);return _0x5c8eb2(_0x1ea055[_0x0a48('0x14')][_0x0a48('0x16')]);}else{logger[_0x0a48('0xe')](_0x0a48('0xf'),_0x39ccf5,_0x0a48('0x10'));_0x5c8eb2(_0x1ea055[_0x0a48('0x17')]['message']);}})['catch'](function(_0x24d0be){logger[_0x0a48('0x14')](_0x0a48('0xf'),_0x39ccf5,_0x24d0be);_0x3df546(_0x24d0be);});});} \ No newline at end of file diff --git a/server/api/saProduct/index.js b/server/api/saProduct/index.js index bf2c5f1..7926164 100644 --- a/server/api/saProduct/index.js +++ b/server/api/saProduct/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b21=['./saProduct.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','/:id/clone','clone','put','update','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x197beb,_0x59238a){var _0x1eea7c=function(_0x40c250){while(--_0x40c250){_0x197beb['push'](_0x197beb['shift']());}};_0x1eea7c(++_0x59238a);}(_0x7b21,0x1ed));var _0x17b2=function(_0x3b10ea,_0x36864a){_0x3b10ea=_0x3b10ea-0x0;var _0x237a2c=_0x7b21[_0x3b10ea];return _0x237a2c;};'use strict';var multer=require(_0x17b2('0x0'));var util=require(_0x17b2('0x1'));var path=require('path');var timeout=require(_0x17b2('0x2'));var express=require('express');var router=express[_0x17b2('0x3')]();var auth=require(_0x17b2('0x4'));var interaction=require(_0x17b2('0x5'));var config=require(_0x17b2('0x6'));var controller=require(_0x17b2('0x7'));router['get']('/',auth[_0x17b2('0x8')](),controller['index']);router[_0x17b2('0x9')](_0x17b2('0xa'),auth[_0x17b2('0x8')](),controller[_0x17b2('0xb')]);router[_0x17b2('0x9')](_0x17b2('0xc'),auth[_0x17b2('0x8')](),controller[_0x17b2('0xd')]);router[_0x17b2('0xe')]('/',auth['isAuthenticated'](),controller[_0x17b2('0xf')]);router[_0x17b2('0xe')](_0x17b2('0x10'),auth[_0x17b2('0x8')](),controller[_0x17b2('0x11')]);router[_0x17b2('0x12')]('/:id',auth[_0x17b2('0x8')](),controller[_0x17b2('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa2ad=['../../components/interaction/service','../../config/environment','./saProduct.controller','get','isAuthenticated','show','post','/:id/clone','clone','put','/:id','update','multer','path','express','Router'];(function(_0x5754c1,_0x564a97){var _0x242cef=function(_0x36bee1){while(--_0x36bee1){_0x5754c1['push'](_0x5754c1['shift']());}};_0x242cef(++_0x564a97);}(_0xa2ad,0x1ec));var _0xda2a=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xa2ad[_0x4232d8];return _0x324de2;};'use strict';var multer=require(_0xda2a('0x0'));var util=require('util');var path=require(_0xda2a('0x1'));var timeout=require('connect-timeout');var express=require(_0xda2a('0x2'));var router=express[_0xda2a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xda2a('0x4'));var config=require(_0xda2a('0x5'));var controller=require(_0xda2a('0x6'));router[_0xda2a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xda2a('0x7')]('/:id',auth[_0xda2a('0x8')](),controller[_0xda2a('0x9')]);router['post']('/',auth[_0xda2a('0x8')](),controller['create']);router[_0xda2a('0xa')](_0xda2a('0xb'),auth[_0xda2a('0x8')](),controller[_0xda2a('0xc')]);router[_0xda2a('0xd')](_0xda2a('0xe'),auth[_0xda2a('0x8')](),controller[_0xda2a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saProduct/saProduct.attributes.js b/server/api/saProduct/saProduct.attributes.js index 121011a..9d79cc0 100644 --- a/server/api/saProduct/saProduct.attributes.js +++ b/server/api/saProduct/saProduct.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83c7=['DECIMAL','INTEGER','TEXT','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','exports','STRING','name','productcode'];(function(_0x20516b,_0x2045b7){var _0x575d0a=function(_0x244641){while(--_0x244641){_0x20516b['push'](_0x20516b['shift']());}};_0x575d0a(++_0x2045b7);}(_0x83c7,0x113));var _0x783c=function(_0xe34650,_0x21b38){_0xe34650=_0xe34650-0x0;var _0x19c39f=_0x83c7[_0xe34650];return _0x19c39f;};'use strict';var Sequelize=require('sequelize');module[_0x783c('0x0')]={'name':{'type':Sequelize[_0x783c('0x1')],'allowNull':![],'unique':_0x783c('0x2')},'productcode':{'type':Sequelize[_0x783c('0x1')],'allowNull':![],'unique':_0x783c('0x3')},'netprice':{'type':Sequelize[_0x783c('0x4')](0xd,0x4),'allowNull':![]},'tax':{'type':Sequelize[_0x783c('0x5')],'allowNull':![]},'description':{'type':Sequelize[_0x783c('0x6')](_0x783c('0x7'))+_0x783c('0x8')},'qtymin':{'type':Sequelize['INTEGER'],'allowNull':!![]},'phaseout':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'allowNull':![]}}; \ No newline at end of file +var _0x55ee=['exports','STRING','productcode','DECIMAL','INTEGER','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','BOOLEAN','sequelize'];(function(_0x390d36,_0x51037d){var _0xc5ef84=function(_0x473166){while(--_0x473166){_0x390d36['push'](_0x390d36['shift']());}};_0xc5ef84(++_0x51037d);}(_0x55ee,0x143));var _0xe55e=function(_0x187b7e,_0x1aec7f){_0x187b7e=_0x187b7e-0x0;var _0xb4e76e=_0x55ee[_0x187b7e];return _0xb4e76e;};'use strict';var Sequelize=require(_0xe55e('0x0'));module[_0xe55e('0x1')]={'name':{'type':Sequelize[_0xe55e('0x2')],'allowNull':![],'unique':'name'},'productcode':{'type':Sequelize[_0xe55e('0x2')],'allowNull':![],'unique':_0xe55e('0x3')},'netprice':{'type':Sequelize[_0xe55e('0x4')](0xd,0x4),'allowNull':![]},'tax':{'type':Sequelize[_0xe55e('0x5')],'allowNull':![]},'description':{'type':Sequelize['TEXT'](_0xe55e('0x6'))+_0xe55e('0x7')},'qtymin':{'type':Sequelize['INTEGER'],'allowNull':!![]},'phaseout':{'type':Sequelize[_0xe55e('0x8')],'defaultValue':0x0,'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/saProduct/saProduct.controller.js b/server/api/saProduct/saProduct.controller.js index 07738ac..6b962d4 100644 --- a/server/api/saProduct/saProduct.controller.js +++ b/server/api/saProduct/saProduct.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0152=['../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','SAProduct','includeAll','include','findAll','rows','params','find','catch','create','body','clone','get','omit','createdAt','updatedAt','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1add29,_0x24db1a){var _0x531c01=function(_0xee867d){while(--_0xee867d){_0x1add29['push'](_0x1add29['shift']());}};_0x531c01(++_0x24db1a);}(_0x0152,0x1c3));var _0x2015=function(_0x8bffaf,_0x498eb0){_0x8bffaf=_0x8bffaf-0x0;var _0x1a873c=_0x0152[_0x8bffaf];return _0x1a873c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2015('0x0'));var rimraf=require(_0x2015('0x1'));var zipdir=require(_0x2015('0x2'));var jsonpatch=require(_0x2015('0x3'));var rp=require(_0x2015('0x4'));var moment=require(_0x2015('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2015('0x6'));var util=require('util');var path=require(_0x2015('0x7'));var sox=require(_0x2015('0x8'));var csv=require(_0x2015('0x9'));var ejs=require(_0x2015('0xa'));var fs=require('fs');var _=require(_0x2015('0xb'));var squel=require('squel');var crypto=require(_0x2015('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2015('0xd'));var toCsv=require(_0x2015('0x9'));var querystring=require(_0x2015('0xe'));var Papa=require(_0x2015('0xf'));var Redis=require(_0x2015('0x10'));var authService=require(_0x2015('0x11'));var qs=require(_0x2015('0x12'));var hardwareService=require(_0x2015('0x13'));var logger=require(_0x2015('0x14'))(_0x2015('0x15'));var utils=require(_0x2015('0x16'));var config=require(_0x2015('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8845a7,_0x3edb8d){_0x3edb8d=_0x3edb8d||0xcc;return function(_0x52e919){if(_0x52e919){return _0x8845a7['sendStatus'](_0x3edb8d);}return _0x8845a7[_0x2015('0x18')](_0x3edb8d)[_0x2015('0x19')]();};}function respondWithResult(_0x597971,_0x2d1400){_0x2d1400=_0x2d1400||0xc8;return function(_0x24b58b){if(_0x24b58b){return _0x597971[_0x2015('0x18')](_0x2d1400)[_0x2015('0x1a')](_0x24b58b);}};}function respondWithFilteredResult(_0x408d04,_0x2b0aca){return function(_0x56cb72){if(_0x56cb72){var _0x18a378=_0x56cb72[_0x2015('0x1b')],_0x5328a3=_0x2b0aca[_0x2015('0x1c')],_0x57113a=_0x2b0aca[_0x2015('0x1c')]+_0x2b0aca['limit'],_0xfaa9ef;if(_0x57113a>=_0x18a378){_0x57113a=_0x18a378;_0xfaa9ef=0xc8;}else{_0xfaa9ef=0xce;}_0x408d04[_0x2015('0x18')](_0xfaa9ef);return _0x408d04[_0x2015('0x1d')](_0x2015('0x1e'),_0x5328a3+'-'+_0x57113a+'/'+_0x18a378)[_0x2015('0x1a')](_0x56cb72);}return null;};}function patchUpdates(_0xd18333){return function(_0x3fcc54){try{jsonpatch[_0x2015('0x1f')](_0x3fcc54,_0xd18333,!![]);}catch(_0x1e940b){return BPromise[_0x2015('0x20')](_0x1e940b);}return _0x3fcc54[_0x2015('0x21')]();};}function saveUpdates(_0x2bee3d,_0x580f69){return function(_0x3e1899){if(_0x3e1899){return _0x3e1899[_0x2015('0x22')](_0x2bee3d)[_0x2015('0x23')](function(_0x189277){return _0x189277;});}return null;};}function removeEntity(_0x44063f,_0x545015){return function(_0x1ae573){if(_0x1ae573){return _0x1ae573[_0x2015('0x24')]()['then'](function(){_0x44063f[_0x2015('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcb5b2b,_0x5bb9d2){return function(_0x146f21){if(!_0x146f21){_0xcb5b2b[_0x2015('0x25')](0x194);}return _0x146f21;};}function handleError(_0x19854a,_0x19d9e1){_0x19d9e1=_0x19d9e1||0x1f4;return function(_0x10458d){logger[_0x2015('0x26')](_0x10458d[_0x2015('0x27')]);if(_0x10458d['name']){delete _0x10458d['name'];}_0x19854a[_0x2015('0x18')](_0x19d9e1)[_0x2015('0x28')](_0x10458d);};}exports['index']=function(_0x3d4c6a,_0x4242d1){var _0x58797d={},_0x107f6b={},_0x501cc8={'count':0x0,'rows':[]};var _0xa9ad33=db['SAProduct'][_0x2015('0x29')];_0x107f6b[_0x2015('0x2a')]=_[_0x2015('0x2b')](_0xa9ad33);_0x107f6b[_0x2015('0x2c')]=_[_0x2015('0x2b')](_0x3d4c6a[_0x2015('0x2c')]);_0x107f6b[_0x2015('0x2d')]=_[_0x2015('0x2e')](_0x107f6b[_0x2015('0x2a')],_0x107f6b['query']);_0x58797d[_0x2015('0x2f')]=_[_0x2015('0x2e')](_0x107f6b['model'],qs[_0x2015('0x30')](_0x3d4c6a['query'][_0x2015('0x30')]));_0x58797d[_0x2015('0x2f')]=_0x58797d[_0x2015('0x2f')]['length']?_0x58797d['attributes']:_0x107f6b[_0x2015('0x2a')];if(!_0x3d4c6a[_0x2015('0x2c')][_0x2015('0x31')](_0x2015('0x32'))){_0x58797d[_0x2015('0x33')]=qs['limit'](_0x3d4c6a[_0x2015('0x2c')][_0x2015('0x33')]);_0x58797d[_0x2015('0x1c')]=qs[_0x2015('0x1c')](_0x3d4c6a[_0x2015('0x2c')][_0x2015('0x1c')]);}_0x58797d[_0x2015('0x34')]=qs[_0x2015('0x35')](_0x3d4c6a[_0x2015('0x2c')]['sort']);_0x58797d[_0x2015('0x36')]=qs[_0x2015('0x2d')](_['pick'](_0x3d4c6a['query'],_0x107f6b[_0x2015('0x2d')]));if(_0x3d4c6a[_0x2015('0x2c')][_0x2015('0x37')]){_0x58797d[_0x2015('0x36')]=_[_0x2015('0x38')](_0x58797d[_0x2015('0x36')],{'$or':_[_0x2015('0x39')](_0xa9ad33,function(_0x2e255d){if(_0x2e255d[_0x2015('0x3a')][_0x2015('0x3b')]!==_0x2015('0x3c')){var _0x88e77={};_0x88e77[_0x2e255d[_0x2015('0x3d')]]={'$like':'%'+_0x3d4c6a[_0x2015('0x2c')][_0x2015('0x37')]+'%'};return _0x88e77;}})});}_0x58797d=_['merge']({},_0x58797d,_0x3d4c6a[_0x2015('0x3e')]);var _0x77bbf6={'where':_0x58797d[_0x2015('0x36')]};return db[_0x2015('0x3f')]['count'](_0x77bbf6)['then'](function(_0x3723d9){_0x501cc8[_0x2015('0x1b')]=_0x3723d9;if(_0x3d4c6a['query'][_0x2015('0x40')]){_0x58797d[_0x2015('0x41')]=[{'all':!![]}];}return db[_0x2015('0x3f')][_0x2015('0x42')](_0x58797d);})[_0x2015('0x23')](function(_0x9758df){_0x501cc8[_0x2015('0x43')]=_0x9758df;return _0x501cc8;})[_0x2015('0x23')](respondWithFilteredResult(_0x4242d1,_0x58797d))['catch'](handleError(_0x4242d1,null));};exports['show']=function(_0x21a4d0,_0x802b08){var _0x935e0={'raw':![],'where':{'id':_0x21a4d0[_0x2015('0x44')]['id']}},_0x3408e7={};_0x3408e7[_0x2015('0x2a')]=_['keys'](db[_0x2015('0x3f')][_0x2015('0x29')]);_0x3408e7['query']=_['keys'](_0x21a4d0[_0x2015('0x2c')]);_0x3408e7[_0x2015('0x2d')]=_[_0x2015('0x2e')](_0x3408e7[_0x2015('0x2a')],_0x3408e7[_0x2015('0x2c')]);_0x935e0[_0x2015('0x2f')]=_[_0x2015('0x2e')](_0x3408e7[_0x2015('0x2a')],qs['fields'](_0x21a4d0['query'][_0x2015('0x30')]));_0x935e0[_0x2015('0x2f')]=_0x935e0[_0x2015('0x2f')]['length']?_0x935e0[_0x2015('0x2f')]:_0x3408e7['model'];if(_0x21a4d0['query'][_0x2015('0x40')]){_0x935e0[_0x2015('0x41')]=[{'all':!![]}];}_0x935e0=_[_0x2015('0x38')]({},_0x935e0,_0x21a4d0[_0x2015('0x3e')]);return db[_0x2015('0x3f')][_0x2015('0x45')](_0x935e0)[_0x2015('0x23')](handleEntityNotFound(_0x802b08,null))['then'](respondWithResult(_0x802b08,null))[_0x2015('0x46')](handleError(_0x802b08,null));};exports['create']=function(_0x3d9d5b,_0x9eba5d){return db['SAProduct'][_0x2015('0x47')](_0x3d9d5b[_0x2015('0x48')],{})[_0x2015('0x23')](respondWithResult(_0x9eba5d,0xc9))[_0x2015('0x46')](handleError(_0x9eba5d,null));};exports[_0x2015('0x49')]=function(_0x3c9675,_0x5e1672){var _0x45489d={'raw':![],'where':{'id':_0x3c9675[_0x2015('0x44')]['id']}},_0x495d22={};_0x495d22[_0x2015('0x2a')]=_[_0x2015('0x2b')](db[_0x2015('0x3f')][_0x2015('0x29')]);_0x45489d['attributes']=_[_0x2015('0x2e')](_0x495d22[_0x2015('0x2a')],qs['fields'](_0x3c9675[_0x2015('0x2c')]['fields']));_0x45489d[_0x2015('0x2f')]=_0x45489d['attributes']['length']?_0x45489d[_0x2015('0x2f')]:_0x495d22[_0x2015('0x2a')];if(_0x3c9675[_0x2015('0x2c')][_0x2015('0x40')]){_0x45489d[_0x2015('0x41')]=[{'all':!![]}];}_0x45489d=_[_0x2015('0x38')]({},_0x45489d,_0x3c9675[_0x2015('0x3e')]);return db['SAProduct']['find'](_0x45489d)['then'](handleEntityNotFound(_0x5e1672,null))['then'](function(_0x5b8a6b){if(_0x5b8a6b){var _0x2177a2=_0x5b8a6b[_0x2015('0x4a')]({'plain':!![]});_0x2177a2=qs[_0x2015('0x4b')](_0x2177a2,['id',_0x2015('0x4c'),_0x2015('0x4d')]);_0x3c9675[_0x2015('0x48')]=_[_0x2015('0x4b')](_0x3c9675[_0x2015('0x48')],['id','createdAt',_0x2015('0x4d')]);return db[_0x2015('0x3f')][_0x2015('0x47')](_[_0x2015('0x38')](_0x2177a2,_0x3c9675[_0x2015('0x48')]),{'include':_0x3c9675[_0x2015('0x2c')][_0x2015('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5e1672,0xc9))[_0x2015('0x46')](handleError(_0x5e1672,null));};exports['update']=function(_0x72cc83,_0x5adcb4){if(_0x72cc83[_0x2015('0x48')]['id']){delete _0x72cc83['body']['id'];}return db[_0x2015('0x3f')]['find']({'where':{'id':_0x72cc83[_0x2015('0x44')]['id']}})[_0x2015('0x23')](handleEntityNotFound(_0x5adcb4,null))[_0x2015('0x23')](saveUpdates(_0x72cc83[_0x2015('0x48')],null))['then'](respondWithResult(_0x5adcb4,null))[_0x2015('0x46')](handleError(_0x5adcb4,null));};exports[_0x2015('0x4e')]=function(_0x3ddfd8,_0x8c9ee7){return db[_0x2015('0x3f')][_0x2015('0x4e')]()[_0x2015('0x23')](respondWithResult(_0x8c9ee7,null))[_0x2015('0x46')](handleError(_0x8c9ee7,null));}; \ No newline at end of file +var _0x77e4=['ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SAProduct','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','count','include','findAll','rows','catch','rawAttributes','includeAll','options','find','create','clone','params','get','omit','createdAt','body','updatedAt','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse'];(function(_0x200152,_0x2c9a47){var _0xdbba14=function(_0x349a75){while(--_0x349a75){_0x200152['push'](_0x200152['shift']());}};_0xdbba14(++_0x2c9a47);}(_0x77e4,0x1be));var _0x477e=function(_0x39253e,_0x3c8bf6){_0x39253e=_0x39253e-0x0;var _0xb100ac=_0x77e4[_0x39253e];return _0xb100ac;};'use strict';var pdf=require(_0x477e('0x0'));var emlformat=require(_0x477e('0x1'));var rimraf=require(_0x477e('0x2'));var zipdir=require(_0x477e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x477e('0x4'));var moment=require(_0x477e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x477e('0x6'));var util=require(_0x477e('0x7'));var path=require('path');var sox=require(_0x477e('0x8'));var csv=require('to-csv');var ejs=require(_0x477e('0x9'));var fs=require('fs');var _=require(_0x477e('0xa'));var squel=require(_0x477e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x477e('0xc'));var toCsv=require(_0x477e('0xd'));var querystring=require(_0x477e('0xe'));var Papa=require(_0x477e('0xf'));var Redis=require(_0x477e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x477e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x477e('0x12'))(_0x477e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x477e('0x14'))['db'];function respondWithStatusCode(_0x47fdce,_0xf27af9){_0xf27af9=_0xf27af9||0xcc;return function(_0x3f6bef){if(_0x3f6bef){return _0x47fdce[_0x477e('0x15')](_0xf27af9);}return _0x47fdce[_0x477e('0x16')](_0xf27af9)[_0x477e('0x17')]();};}function respondWithResult(_0x36a68b,_0x9900cf){_0x9900cf=_0x9900cf||0xc8;return function(_0x4906b3){if(_0x4906b3){return _0x36a68b['status'](_0x9900cf)[_0x477e('0x18')](_0x4906b3);}};}function respondWithFilteredResult(_0x425b3e,_0x481277){return function(_0x4f49bd){if(_0x4f49bd){var _0x3b1a5e=_0x4f49bd['count'],_0x12471a=_0x481277[_0x477e('0x19')],_0x292e29=_0x481277[_0x477e('0x19')]+_0x481277[_0x477e('0x1a')],_0x3a164b;if(_0x292e29>=_0x3b1a5e){_0x292e29=_0x3b1a5e;_0x3a164b=0xc8;}else{_0x3a164b=0xce;}_0x425b3e[_0x477e('0x16')](_0x3a164b);return _0x425b3e['set'](_0x477e('0x1b'),_0x12471a+'-'+_0x292e29+'/'+_0x3b1a5e)[_0x477e('0x18')](_0x4f49bd);}return null;};}function patchUpdates(_0x3a7415){return function(_0x4d3cfa){try{jsonpatch[_0x477e('0x1c')](_0x4d3cfa,_0x3a7415,!![]);}catch(_0x1f2444){return BPromise[_0x477e('0x1d')](_0x1f2444);}return _0x4d3cfa[_0x477e('0x1e')]();};}function saveUpdates(_0x127d33,_0x410609){return function(_0x3da319){if(_0x3da319){return _0x3da319[_0x477e('0x1f')](_0x127d33)[_0x477e('0x20')](function(_0x56d21f){return _0x56d21f;});}return null;};}function removeEntity(_0x2e2f0c,_0x6edfd0){return function(_0x4bf673){if(_0x4bf673){return _0x4bf673[_0x477e('0x21')]()[_0x477e('0x20')](function(){_0x2e2f0c['status'](0xcc)[_0x477e('0x17')]();});}};}function handleEntityNotFound(_0x350d06,_0xe0c0c1){return function(_0x3bf4e7){if(!_0x3bf4e7){_0x350d06[_0x477e('0x15')](0x194);}return _0x3bf4e7;};}function handleError(_0x322e33,_0x202abb){_0x202abb=_0x202abb||0x1f4;return function(_0x19d1f0){logger[_0x477e('0x22')](_0x19d1f0[_0x477e('0x23')]);if(_0x19d1f0[_0x477e('0x24')]){delete _0x19d1f0[_0x477e('0x24')];}_0x322e33[_0x477e('0x16')](_0x202abb)[_0x477e('0x25')](_0x19d1f0);};}exports[_0x477e('0x26')]=function(_0x587fba,_0x49a8d5){var _0x55c403={},_0x2ecae6={},_0x271097={'count':0x0,'rows':[]};var _0x267cd2=db[_0x477e('0x27')]['rawAttributes'];_0x2ecae6[_0x477e('0x28')]=_[_0x477e('0x29')](_0x267cd2);_0x2ecae6['query']=_[_0x477e('0x29')](_0x587fba[_0x477e('0x2a')]);_0x2ecae6[_0x477e('0x2b')]=_[_0x477e('0x2c')](_0x2ecae6[_0x477e('0x28')],_0x2ecae6['query']);_0x55c403[_0x477e('0x2d')]=_[_0x477e('0x2c')](_0x2ecae6['model'],qs[_0x477e('0x2e')](_0x587fba[_0x477e('0x2a')][_0x477e('0x2e')]));_0x55c403[_0x477e('0x2d')]=_0x55c403[_0x477e('0x2d')][_0x477e('0x2f')]?_0x55c403['attributes']:_0x2ecae6[_0x477e('0x28')];if(!_0x587fba['query'][_0x477e('0x30')]('nolimit')){_0x55c403[_0x477e('0x1a')]=qs[_0x477e('0x1a')](_0x587fba[_0x477e('0x2a')][_0x477e('0x1a')]);_0x55c403['offset']=qs[_0x477e('0x19')](_0x587fba[_0x477e('0x2a')]['offset']);}_0x55c403[_0x477e('0x31')]=qs[_0x477e('0x32')](_0x587fba[_0x477e('0x2a')]['sort']);_0x55c403[_0x477e('0x33')]=qs['filters'](_[_0x477e('0x34')](_0x587fba[_0x477e('0x2a')],_0x2ecae6[_0x477e('0x2b')]));if(_0x587fba[_0x477e('0x2a')][_0x477e('0x35')]){_0x55c403[_0x477e('0x33')]=_[_0x477e('0x36')](_0x55c403[_0x477e('0x33')],{'$or':_['map'](_0x267cd2,function(_0x2d53ca){if(_0x2d53ca[_0x477e('0x37')][_0x477e('0x38')]!==_0x477e('0x39')){var _0x3b6f01={};_0x3b6f01[_0x2d53ca[_0x477e('0x3a')]]={'$like':'%'+_0x587fba[_0x477e('0x2a')][_0x477e('0x35')]+'%'};return _0x3b6f01;}})});}_0x55c403=_['merge']({},_0x55c403,_0x587fba['options']);var _0xbe97d6={'where':_0x55c403[_0x477e('0x33')]};return db[_0x477e('0x27')][_0x477e('0x3b')](_0xbe97d6)[_0x477e('0x20')](function(_0x4c568e){_0x271097[_0x477e('0x3b')]=_0x4c568e;if(_0x587fba[_0x477e('0x2a')]['includeAll']){_0x55c403[_0x477e('0x3c')]=[{'all':!![]}];}return db[_0x477e('0x27')][_0x477e('0x3d')](_0x55c403);})[_0x477e('0x20')](function(_0x208bcf){_0x271097[_0x477e('0x3e')]=_0x208bcf;return _0x271097;})['then'](respondWithFilteredResult(_0x49a8d5,_0x55c403))[_0x477e('0x3f')](handleError(_0x49a8d5,null));};exports['show']=function(_0x3f092d,_0x4ae9a3){var _0x5852e0={'raw':![],'where':{'id':_0x3f092d['params']['id']}},_0x53010e={};_0x53010e[_0x477e('0x28')]=_[_0x477e('0x29')](db[_0x477e('0x27')][_0x477e('0x40')]);_0x53010e[_0x477e('0x2a')]=_['keys'](_0x3f092d[_0x477e('0x2a')]);_0x53010e[_0x477e('0x2b')]=_[_0x477e('0x2c')](_0x53010e['model'],_0x53010e['query']);_0x5852e0[_0x477e('0x2d')]=_[_0x477e('0x2c')](_0x53010e['model'],qs['fields'](_0x3f092d[_0x477e('0x2a')][_0x477e('0x2e')]));_0x5852e0[_0x477e('0x2d')]=_0x5852e0['attributes'][_0x477e('0x2f')]?_0x5852e0[_0x477e('0x2d')]:_0x53010e[_0x477e('0x28')];if(_0x3f092d[_0x477e('0x2a')][_0x477e('0x41')]){_0x5852e0['include']=[{'all':!![]}];}_0x5852e0=_[_0x477e('0x36')]({},_0x5852e0,_0x3f092d[_0x477e('0x42')]);return db['SAProduct'][_0x477e('0x43')](_0x5852e0)['then'](handleEntityNotFound(_0x4ae9a3,null))[_0x477e('0x20')](respondWithResult(_0x4ae9a3,null))[_0x477e('0x3f')](handleError(_0x4ae9a3,null));};exports[_0x477e('0x44')]=function(_0x459546,_0x587756){return db['SAProduct'][_0x477e('0x44')](_0x459546['body'],{})['then'](respondWithResult(_0x587756,0xc9))[_0x477e('0x3f')](handleError(_0x587756,null));};exports[_0x477e('0x45')]=function(_0x45643f,_0x2db94e){var _0x23fcd3={'raw':![],'where':{'id':_0x45643f[_0x477e('0x46')]['id']}},_0x6b7585={};_0x6b7585[_0x477e('0x28')]=_[_0x477e('0x29')](db['SAProduct'][_0x477e('0x40')]);_0x23fcd3[_0x477e('0x2d')]=_[_0x477e('0x2c')](_0x6b7585[_0x477e('0x28')],qs[_0x477e('0x2e')](_0x45643f['query'][_0x477e('0x2e')]));_0x23fcd3[_0x477e('0x2d')]=_0x23fcd3[_0x477e('0x2d')][_0x477e('0x2f')]?_0x23fcd3['attributes']:_0x6b7585['model'];if(_0x45643f[_0x477e('0x2a')][_0x477e('0x41')]){_0x23fcd3[_0x477e('0x3c')]=[{'all':!![]}];}_0x23fcd3=_[_0x477e('0x36')]({},_0x23fcd3,_0x45643f[_0x477e('0x42')]);return db[_0x477e('0x27')][_0x477e('0x43')](_0x23fcd3)[_0x477e('0x20')](handleEntityNotFound(_0x2db94e,null))['then'](function(_0x5f4832){if(_0x5f4832){var _0x1a066d=_0x5f4832[_0x477e('0x47')]({'plain':!![]});_0x1a066d=qs[_0x477e('0x48')](_0x1a066d,['id',_0x477e('0x49'),'updatedAt']);_0x45643f['body']=_[_0x477e('0x48')](_0x45643f[_0x477e('0x4a')],['id','createdAt',_0x477e('0x4b')]);return db[_0x477e('0x27')][_0x477e('0x44')](_[_0x477e('0x36')](_0x1a066d,_0x45643f['body']),{'include':_0x45643f[_0x477e('0x2a')][_0x477e('0x41')]?[{'all':!![]}]:undefined});}})[_0x477e('0x20')](respondWithResult(_0x2db94e,0xc9))['catch'](handleError(_0x2db94e,null));};exports[_0x477e('0x1f')]=function(_0x5a34f3,_0x4dbdcb){if(_0x5a34f3[_0x477e('0x4a')]['id']){delete _0x5a34f3[_0x477e('0x4a')]['id'];}return db[_0x477e('0x27')]['find']({'where':{'id':_0x5a34f3['params']['id']}})[_0x477e('0x20')](handleEntityNotFound(_0x4dbdcb,null))[_0x477e('0x20')](saveUpdates(_0x5a34f3[_0x477e('0x4a')],null))[_0x477e('0x20')](respondWithResult(_0x4dbdcb,null))['catch'](handleError(_0x4dbdcb,null));};exports['describe']=function(_0x3dee38,_0x4dcd33){return db[_0x477e('0x27')][_0x477e('0x4c')]()[_0x477e('0x20')](respondWithResult(_0x4dcd33,null))[_0x477e('0x3f')](handleError(_0x4dcd33,null));}; \ No newline at end of file diff --git a/server/api/saProduct/saProduct.model.js b/server/api/saProduct/saProduct.model.js index 449822d..c28e51a 100644 --- a/server/api/saProduct/saProduct.model.js +++ b/server/api/saProduct/saProduct.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56bd=['../../config/environment','./saProduct.attributes','define','SAProduct','sa_products','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2cdbee,_0x154de4){var _0x2beda4=function(_0x29d582){while(--_0x29d582){_0x2cdbee['push'](_0x2cdbee['shift']());}};_0x2beda4(++_0x154de4);}(_0x56bd,0x1b2));var _0xd56b=function(_0x45d914,_0x3369e9){_0x45d914=_0x45d914-0x0;var _0x3765c5=_0x56bd[_0x45d914];return _0x3765c5;};'use strict';var _=require(_0xd56b('0x0'));var util=require('util');var logger=require(_0xd56b('0x1'))(_0xd56b('0x2'));var moment=require('moment');var BPromise=require(_0xd56b('0x3'));var rp=require(_0xd56b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd56b('0x5'));var config=require(_0xd56b('0x6'));var attributes=require(_0xd56b('0x7'));module['exports']=function(_0x45cc8c,_0x5ed440){return _0x45cc8c[_0xd56b('0x8')](_0xd56b('0x9'),attributes,{'tableName':_0xd56b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x787a=['../../config/environment','define','sa_products','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x395d59,_0x3aa7d1){var _0x45f776=function(_0x298b5d){while(--_0x298b5d){_0x395d59['push'](_0x395d59['shift']());}};_0x45f776(++_0x3aa7d1);}(_0x787a,0x1ce));var _0xa787=function(_0x15e7e6,_0x1e70ce){_0x15e7e6=_0x15e7e6-0x0;var _0x587485=_0x787a[_0x15e7e6];return _0x587485;};'use strict';var _=require(_0xa787('0x0'));var util=require('util');var logger=require(_0xa787('0x1'))('api');var moment=require(_0xa787('0x2'));var BPromise=require(_0xa787('0x3'));var rp=require(_0xa787('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa787('0x5'));var config=require(_0xa787('0x6'));var attributes=require('./saProduct.attributes');module['exports']=function(_0x236932,_0xf61c38){return _0x236932[_0xa787('0x7')]('SAProduct',attributes,{'tableName':_0xa787('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saProduct/saProduct.rpc.js b/server/api/saProduct/saProduct.rpc.js index 1309fdf..8774f0e 100644 --- a/server/api/saProduct/saProduct.rpc.js +++ b/server/api/saProduct/saProduct.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb903=['http','request','SAProduct,\x20%s,\x20%s,\x20%s','request\x20sent','error','SAProduct,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b1f41,_0x25db71){var _0x4a06e4=function(_0x173457){while(--_0x173457){_0x1b1f41['push'](_0x1b1f41['shift']());}};_0x4a06e4(++_0x25db71);}(_0xb903,0x185));var _0x3b90=function(_0x518b93,_0x4c75d4){_0x518b93=_0x518b93-0x0;var _0x2ff53a=_0xb903[_0x518b93];return _0x2ff53a;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('SAProduct,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('SAProduct,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file +var _0xed1f=['request','then','info','SAProduct,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x378a77,_0x18282e){var _0xb73b0a=function(_0x133ecd){while(--_0x133ecd){_0x378a77['push'](_0x378a77['shift']());}};_0xb73b0a(++_0x18282e);}(_0xed1f,0x6a));var _0xfed1=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xed1f[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('SAProduct,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('SAProduct,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('SAProduct,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('SAProduct,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/saProductOrder/index.js b/server/api/saProductOrder/index.js index a6c7d8e..021bc7c 100644 --- a/server/api/saProductOrder/index.js +++ b/server/api/saProductOrder/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64ea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saProductOrder.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3f8409,_0xb3ab04){var _0x21519f=function(_0x368474){while(--_0x368474){_0x3f8409['push'](_0x3f8409['shift']());}};_0x21519f(++_0xb3ab04);}(_0x64ea,0x9c));var _0xa64e=function(_0x27c7b7,_0x3ac29c){_0x27c7b7=_0x27c7b7-0x0;var _0x22e7d5=_0x64ea[_0x27c7b7];return _0x22e7d5;};'use strict';var multer=require(_0xa64e('0x0'));var util=require(_0xa64e('0x1'));var path=require('path');var timeout=require(_0xa64e('0x2'));var express=require(_0xa64e('0x3'));var router=express[_0xa64e('0x4')]();var auth=require(_0xa64e('0x5'));var interaction=require(_0xa64e('0x6'));var config=require(_0xa64e('0x7'));var controller=require(_0xa64e('0x8'));router[_0xa64e('0x9')]('/',auth[_0xa64e('0xa')](),controller['index']);router[_0xa64e('0x9')](_0xa64e('0xb'),auth['isAuthenticated'](),controller[_0xa64e('0xc')]);router[_0xa64e('0x9')](_0xa64e('0xd'),auth['isAuthenticated'](),controller[_0xa64e('0xe')]);router['post']('/',auth[_0xa64e('0xa')](),controller[_0xa64e('0xf')]);router['put'](_0xa64e('0xd'),auth[_0xa64e('0xa')](),controller[_0xa64e('0x10')]);router[_0xa64e('0x11')](_0xa64e('0xd'),auth[_0xa64e('0xa')](),controller[_0xa64e('0x12')]);module[_0xa64e('0x13')]=router; \ No newline at end of file +var _0x628c=['show','post','create','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./saProductOrder.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5102eb,_0x73cfe5){var _0x36bae9=function(_0x52dea9){while(--_0x52dea9){_0x5102eb['push'](_0x5102eb['shift']());}};_0x36bae9(++_0x73cfe5);}(_0x628c,0x1ab));var _0xc628=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x628c[_0x57975f];return _0x4793b8;};'use strict';var multer=require(_0xc628('0x0'));var util=require(_0xc628('0x1'));var path=require(_0xc628('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc628('0x3')]();var auth=require(_0xc628('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc628('0x5'));var controller=require(_0xc628('0x6'));router[_0xc628('0x7')]('/',auth[_0xc628('0x8')](),controller[_0xc628('0x9')]);router[_0xc628('0x7')](_0xc628('0xa'),auth[_0xc628('0x8')](),controller[_0xc628('0xb')]);router[_0xc628('0x7')](_0xc628('0xc'),auth[_0xc628('0x8')](),controller[_0xc628('0xd')]);router[_0xc628('0xe')]('/',auth['isAuthenticated'](),controller[_0xc628('0xf')]);router['put'](_0xc628('0xc'),auth[_0xc628('0x8')](),controller[_0xc628('0x10')]);router[_0xc628('0x11')](_0xc628('0xc'),auth['isAuthenticated'](),controller[_0xc628('0x12')]);module[_0xc628('0x13')]=router; \ No newline at end of file diff --git a/server/api/saProductOrder/saProductOrder.attributes.js b/server/api/saProductOrder/saProductOrder.attributes.js index 725db86..c479d5d 100644 --- a/server/api/saProductOrder/saProductOrder.attributes.js +++ b/server/api/saProductOrder/saProductOrder.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7393=['compositeIndex_prodCode_OrderID','DECIMAL','INTEGER','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','STRING','BOOLEAN','TEXT'];(function(_0x4d6251,_0x282b8d){var _0x4ceef4=function(_0x3418e2){while(--_0x3418e2){_0x4d6251['push'](_0x4d6251['shift']());}};_0x4ceef4(++_0x282b8d);}(_0x7393,0xbf));var _0x3739=function(_0x20195f,_0x15bc59){_0x20195f=_0x20195f-0x0;var _0x5f352d=_0x7393[_0x20195f];return _0x5f352d;};'use strict';var Sequelize=require('sequelize');module['exports']={'productName':{'type':Sequelize[_0x3739('0x0')],'allowNull':![]},'productCode':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3739('0x1')},'productNetPrice':{'type':Sequelize[_0x3739('0x2')](0xd,0x4)},'productTax':{'type':Sequelize[_0x3739('0x3')]},'productDescription':{'type':Sequelize[_0x3739('0x0')](_0x3739('0x4'))+_0x3739('0x5')},'productQtyMin':{'type':Sequelize[_0x3739('0x3')],'allowNull':!![]},'pricelistName':{'type':Sequelize[_0x3739('0x0')]},'pricelistDiscount':{'type':Sequelize['DECIMAL'](0x6,0x3),'allowNull':![]},'productPricelistDiscount':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'productPricelistNetPrice':{'type':Sequelize[_0x3739('0x2')](0xd,0x4)},'netPrice':{'type':Sequelize[_0x3739('0x2')](0xd,0x4),'allowNull':![]},'quantity':{'type':Sequelize[_0x3739('0x3')],'allowNull':![]},'discount':{'type':Sequelize[_0x3739('0x2')](0x6,0x3),'allowNull':![]},'totalPrice':{'type':Sequelize[_0x3739('0x2')](0xd,0x4),'allowNull':![]},'tax':{'type':Sequelize[_0x3739('0x2')](0xd,0x4),'allowNull':![]},'totalDiscount':{'type':Sequelize[_0x3739('0x2')](0xd,0x4),'allowNull':![]},'totalTax':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0x3739('0x6')]},'note':{'type':Sequelize['TEXT']},'QuotationId':{'type':Sequelize[_0x3739('0x3')]},'OrderId':{'type':Sequelize[_0x3739('0x3')],'unique':'compositeIndex_prodCode_OrderID'},'totalPrice':{'type':Sequelize[_0x3739('0x2')](0xd,0x4)},'totalTax':{'type':Sequelize[_0x3739('0x2')](0xd,0x4)},'typeName':{'type':Sequelize[_0x3739('0x6')]},'TypeId':{'type':Sequelize['INTEGER']},'unitName':{'type':Sequelize[_0x3739('0x6')]},'UnitId':{'type':Sequelize['INTEGER']},'attendanceName':{'type':Sequelize[_0x3739('0x6')]},'attendanceId':{'type':Sequelize['INTEGER']},'attendanceMonthly':{'type':Sequelize[_0x3739('0x3')]},'companyName':{'type':Sequelize[_0x3739('0x6')]},'companyId':{'type':Sequelize[_0x3739('0x3')]},'productAsset':{'type':Sequelize[_0x3739('0x7')]}}; \ No newline at end of file +var _0x8d0d=['TEXT','STRING','compositeIndex_prodCode_OrderID','DECIMAL','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','INTEGER','sequelize','exports'];(function(_0x1c9f4d,_0x3475b0){var _0x58c2ae=function(_0x5519f9){while(--_0x5519f9){_0x1c9f4d['push'](_0x1c9f4d['shift']());}};_0x58c2ae(++_0x3475b0);}(_0x8d0d,0x14b));var _0xd8d0=function(_0xdbce2e,_0x1ba5ba){_0xdbce2e=_0xdbce2e-0x0;var _0x570025=_0x8d0d[_0xdbce2e];return _0x570025;};'use strict';var Sequelize=require(_0xd8d0('0x0'));module[_0xd8d0('0x1')]={'productName':{'type':Sequelize[_0xd8d0('0x2')],'allowNull':![]},'productCode':{'type':Sequelize[_0xd8d0('0x3')],'allowNull':![],'unique':_0xd8d0('0x4')},'productNetPrice':{'type':Sequelize[_0xd8d0('0x5')](0xd,0x4)},'productTax':{'type':Sequelize['INTEGER']},'productDescription':{'type':Sequelize[_0xd8d0('0x2')](_0xd8d0('0x6'))+_0xd8d0('0x7')},'productQtyMin':{'type':Sequelize['INTEGER'],'allowNull':!![]},'pricelistName':{'type':Sequelize['TEXT']},'pricelistDiscount':{'type':Sequelize[_0xd8d0('0x5')](0x6,0x3),'allowNull':![]},'productPricelistDiscount':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'productPricelistNetPrice':{'type':Sequelize[_0xd8d0('0x5')](0xd,0x4)},'netPrice':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'quantity':{'type':Sequelize[_0xd8d0('0x8')],'allowNull':![]},'discount':{'type':Sequelize[_0xd8d0('0x5')](0x6,0x3),'allowNull':![]},'totalPrice':{'type':Sequelize[_0xd8d0('0x5')](0xd,0x4),'allowNull':![]},'tax':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'totalDiscount':{'type':Sequelize[_0xd8d0('0x5')](0xd,0x4),'allowNull':![]},'totalTax':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0xd8d0('0x3')]},'note':{'type':Sequelize['TEXT']},'QuotationId':{'type':Sequelize[_0xd8d0('0x8')]},'OrderId':{'type':Sequelize['INTEGER'],'unique':_0xd8d0('0x4')},'totalPrice':{'type':Sequelize[_0xd8d0('0x5')](0xd,0x4)},'totalTax':{'type':Sequelize[_0xd8d0('0x5')](0xd,0x4)},'typeName':{'type':Sequelize['STRING']},'TypeId':{'type':Sequelize[_0xd8d0('0x8')]},'unitName':{'type':Sequelize[_0xd8d0('0x3')]},'UnitId':{'type':Sequelize[_0xd8d0('0x8')]},'attendanceName':{'type':Sequelize['STRING']},'attendanceId':{'type':Sequelize[_0xd8d0('0x8')]},'attendanceMonthly':{'type':Sequelize[_0xd8d0('0x8')]},'companyName':{'type':Sequelize[_0xd8d0('0x3')]},'companyId':{'type':Sequelize[_0xd8d0('0x8')]},'productAsset':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/saProductOrder/saProductOrder.controller.js b/server/api/saProductOrder/saProductOrder.controller.js index 23b8be2..313e972 100644 --- a/server/api/saProductOrder/saProductOrder.controller.js +++ b/server/api/saProductOrder/saProductOrder.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0387=['merge','filter','map','type','key','VIRTUAL','options','includeAll','include','findAll','catch','show','length','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','end','error','stack','name','send','index','SAProductOrder','rawAttributes','query','dateEnd','dateStart','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day'];(function(_0x11401a,_0x12ccb4){var _0x2d637e=function(_0x3fcfca){while(--_0x3fcfca){_0x11401a['push'](_0x11401a['shift']());}};_0x2d637e(++_0x12ccb4);}(_0x0387,0xa8));var _0x7038=function(_0x45a575,_0x5739cb){_0x45a575=_0x45a575-0x0;var _0x1d7f93=_0x0387[_0x45a575];return _0x1d7f93;};'use strict';var pdf=require(_0x7038('0x0'));var emlformat=require(_0x7038('0x1'));var rimraf=require(_0x7038('0x2'));var zipdir=require(_0x7038('0x3'));var jsonpatch=require(_0x7038('0x4'));var rp=require(_0x7038('0x5'));var moment=require(_0x7038('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7038('0x7'));var path=require(_0x7038('0x8'));var sox=require(_0x7038('0x9'));var csv=require(_0x7038('0xa'));var ejs=require(_0x7038('0xb'));var fs=require('fs');var _=require(_0x7038('0xc'));var squel=require(_0x7038('0xd'));var crypto=require('crypto');var jsforce=require(_0x7038('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7038('0xa'));var querystring=require(_0x7038('0xf'));var Papa=require('papaparse');var Redis=require(_0x7038('0x10'));var qs=require(_0x7038('0x11'));var logger=require(_0x7038('0x12'))(_0x7038('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7038('0x14'))['db'];function respondWithStatusCode(_0x2cc1d6,_0x22296e){_0x22296e=_0x22296e||0xcc;return function(_0x24db78){if(_0x24db78){return _0x2cc1d6['sendStatus'](_0x22296e);}return _0x2cc1d6['status'](_0x22296e)['end']();};}function respondWithResult(_0xfe8cf,_0x117dfa){_0x117dfa=_0x117dfa||0xc8;return function(_0x5d4c60){if(_0x5d4c60){return _0xfe8cf[_0x7038('0x15')](_0x117dfa)['json'](_0x5d4c60);}};}function respondWithFilteredResult(_0xa5ef92,_0x58bbc1){return function(_0x35b989){if(_0x35b989){var _0x206759=_0x35b989[_0x7038('0x16')],_0x3db425=_0x58bbc1[_0x7038('0x17')],_0x19f3cb=_0x58bbc1['offset']+_0x58bbc1[_0x7038('0x18')],_0x5814fd;if(_0x19f3cb>=_0x206759){_0x19f3cb=_0x206759;_0x5814fd=0xc8;}else{_0x5814fd=0xce;}_0xa5ef92[_0x7038('0x15')](_0x5814fd);return _0xa5ef92[_0x7038('0x19')](_0x7038('0x1a'),_0x3db425+'-'+_0x19f3cb+'/'+_0x206759)[_0x7038('0x1b')](_0x35b989);}return null;};}function patchUpdates(_0x48f277){return function(_0x420f93){try{jsonpatch['apply'](_0x420f93,_0x48f277,!![]);}catch(_0x83fbf9){return BPromise[_0x7038('0x1c')](_0x83fbf9);}return _0x420f93['save']();};}function saveUpdates(_0x29c5ae,_0x3706cb){return function(_0x169e2a){if(_0x169e2a){return _0x169e2a[_0x7038('0x1d')](_0x29c5ae)[_0x7038('0x1e')](function(_0x474b60){return _0x474b60;});}return null;};}function removeEntity(_0x415cfd,_0x4695ce){return function(_0x496602){if(_0x496602){return _0x496602[_0x7038('0x1f')]()[_0x7038('0x1e')](function(){_0x415cfd[_0x7038('0x15')](0xcc)[_0x7038('0x20')]();});}};}function handleEntityNotFound(_0x12d2bb,_0x1399dc){return function(_0x456295){if(!_0x456295){_0x12d2bb['sendStatus'](0x194);}return _0x456295;};}function handleError(_0x46c687,_0x58d154){_0x58d154=_0x58d154||0x1f4;return function(_0x4738c7){logger[_0x7038('0x21')](_0x4738c7[_0x7038('0x22')]);if(_0x4738c7['name']){delete _0x4738c7[_0x7038('0x23')];}_0x46c687[_0x7038('0x15')](_0x58d154)[_0x7038('0x24')](_0x4738c7);};}exports[_0x7038('0x25')]=function(_0xc693ca,_0x196401){var _0x11bcdd={'raw':!![]},_0xa7ed13={},_0x2e1cbd={'count':0x0,'rows':[]};var _0x4c6ff1=db[_0x7038('0x26')][_0x7038('0x27')];_0xa7ed13['model']=_['keys'](_0x4c6ff1);var _0x480fb6={'dateStart':_0xc693ca[_0x7038('0x28')]['dateStart'],'dateEnd':_0xc693ca['query'][_0x7038('0x29')]};delete _0xc693ca[_0x7038('0x28')][_0x7038('0x2a')];delete _0xc693ca[_0x7038('0x28')][_0x7038('0x29')];_0xa7ed13[_0x7038('0x28')]=_[_0x7038('0x2b')](_0xc693ca['query']);_0xa7ed13['filters']=_[_0x7038('0x2c')](_0xa7ed13[_0x7038('0x2d')],_0xa7ed13['query']);_0x11bcdd['attributes']=_[_0x7038('0x2c')](_0xa7ed13[_0x7038('0x2d')],qs['fields'](_0xc693ca['query'][_0x7038('0x2e')]));_0x11bcdd[_0x7038('0x2f')]=_0x11bcdd[_0x7038('0x2f')]['length']?_0x11bcdd[_0x7038('0x2f')]:_0xa7ed13[_0x7038('0x2d')];if(!_0xc693ca[_0x7038('0x28')][_0x7038('0x30')](_0x7038('0x31'))){_0x11bcdd[_0x7038('0x18')]=qs[_0x7038('0x18')](_0xc693ca['query'][_0x7038('0x18')]);_0x11bcdd['offset']=qs[_0x7038('0x17')](_0xc693ca['query'][_0x7038('0x17')]);}_0x11bcdd[_0x7038('0x32')]=qs[_0x7038('0x33')](_0xc693ca[_0x7038('0x28')][_0x7038('0x33')]);_0x11bcdd[_0x7038('0x34')]=qs[_0x7038('0x35')](_[_0x7038('0x36')](_0xc693ca[_0x7038('0x28')],_0xa7ed13[_0x7038('0x35')]));if(_0x480fb6['dateStart']){if(_0x480fb6[_0x7038('0x29')]){_0x480fb6[_0x7038('0x29')]=moment(_0x480fb6[_0x7038('0x29')])[_0x7038('0x37')](0x1,_0x7038('0x38'));}else{_0x480fb6['dateEnd']=moment(_0x480fb6[_0x7038('0x2a')])[_0x7038('0x37')](0x1,_0x7038('0x38'));}_[_0x7038('0x39')](_0x11bcdd[_0x7038('0x34')],{'createdAt':{'$gte':_0x480fb6['dateStart'],'$lte':_0x480fb6['dateEnd']}});}if(_0xc693ca[_0x7038('0x28')][_0x7038('0x3a')]){_0x11bcdd[_0x7038('0x34')]=_[_0x7038('0x39')](_0x11bcdd[_0x7038('0x34')],{'$or':_[_0x7038('0x3b')](_0x4c6ff1,function(_0x448a0b){if(_0x448a0b[_0x7038('0x3c')][_0x7038('0x3d')]!==_0x7038('0x3e')){var _0xd06b06={};_0xd06b06[_0x448a0b['field']]={'$like':'%'+_0xc693ca[_0x7038('0x28')][_0x7038('0x3a')]+'%'};return _0xd06b06;}})});}_0x11bcdd=_['merge']({},_0x11bcdd,_0xc693ca[_0x7038('0x3f')]);var _0x19d62e={'where':_0x11bcdd[_0x7038('0x34')]};return db[_0x7038('0x26')][_0x7038('0x16')](_0x19d62e)[_0x7038('0x1e')](function(_0x5a4755){_0x2e1cbd[_0x7038('0x16')]=_0x5a4755;if(_0xc693ca[_0x7038('0x28')][_0x7038('0x40')]){_0x11bcdd[_0x7038('0x41')]=[{'all':!![]}];}return db['SAProductOrder'][_0x7038('0x42')](_0x11bcdd);})[_0x7038('0x1e')](function(_0x405638){_0x2e1cbd['rows']=_0x405638;return _0x2e1cbd;})[_0x7038('0x1e')](respondWithFilteredResult(_0x196401,_0x11bcdd))[_0x7038('0x43')](handleError(_0x196401,null));};exports[_0x7038('0x44')]=function(_0x382959,_0x185f29){var _0x5ea510={'raw':!![],'where':{'id':_0x382959['params']['id']}},_0x5ba927={};_0x5ba927[_0x7038('0x2d')]=_[_0x7038('0x2b')](db[_0x7038('0x26')][_0x7038('0x27')]);_0x5ba927[_0x7038('0x28')]=_['keys'](_0x382959[_0x7038('0x28')]);_0x5ba927[_0x7038('0x35')]=_[_0x7038('0x2c')](_0x5ba927['model'],_0x5ba927[_0x7038('0x28')]);_0x5ea510[_0x7038('0x2f')]=_[_0x7038('0x2c')](_0x5ba927[_0x7038('0x2d')],qs[_0x7038('0x2e')](_0x382959[_0x7038('0x28')][_0x7038('0x2e')]));_0x5ea510[_0x7038('0x2f')]=_0x5ea510['attributes'][_0x7038('0x45')]?_0x5ea510[_0x7038('0x2f')]:_0x5ba927[_0x7038('0x2d')];if(_0x382959[_0x7038('0x28')][_0x7038('0x40')]){_0x5ea510[_0x7038('0x41')]=[{'all':!![]}];}_0x5ea510=_[_0x7038('0x39')]({},_0x5ea510,_0x382959[_0x7038('0x3f')]);return db[_0x7038('0x26')]['find'](_0x5ea510)[_0x7038('0x1e')](handleEntityNotFound(_0x185f29,null))[_0x7038('0x1e')](respondWithResult(_0x185f29,null))['catch'](handleError(_0x185f29,null));};exports[_0x7038('0x46')]=function(_0x502a2a,_0x3bbd2e){return db[_0x7038('0x26')][_0x7038('0x46')](_0x502a2a[_0x7038('0x47')],{})['then'](respondWithResult(_0x3bbd2e,0xc9))['catch'](handleError(_0x3bbd2e,null));};exports[_0x7038('0x1d')]=function(_0x4ee9e4,_0x17d112){if(_0x4ee9e4['body']['id']){delete _0x4ee9e4[_0x7038('0x47')]['id'];}return db[_0x7038('0x26')][_0x7038('0x48')]({'where':{'id':_0x4ee9e4[_0x7038('0x49')]['id']}})[_0x7038('0x1e')](handleEntityNotFound(_0x17d112,null))[_0x7038('0x1e')](saveUpdates(_0x4ee9e4['body'],null))[_0x7038('0x1e')](respondWithResult(_0x17d112,null))[_0x7038('0x43')](handleError(_0x17d112,null));};exports[_0x7038('0x1f')]=function(_0x19f554,_0x20125a){return db[_0x7038('0x26')][_0x7038('0x48')]({'where':{'id':_0x19f554['params']['id']}})[_0x7038('0x1e')](handleEntityNotFound(_0x20125a,null))['then'](removeEntity(_0x20125a,null))['catch'](handleError(_0x20125a,null));};exports[_0x7038('0x4a')]=function(_0x43136f,_0x193a4e){return db[_0x7038('0x26')][_0x7038('0x4a')]()['then'](respondWithResult(_0x193a4e,null))[_0x7038('0x43')](handleError(_0x193a4e,null));}; \ No newline at end of file +var _0xb71c=['json','offset','set','Content-Range','reject','update','then','name','index','SAProductOrder','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','add','day','filter','type','VIRTUAL','field','merge','options','count','includeAll','include','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x44a6e8,_0xd4003c){var _0x5f2893=function(_0x14b15e){while(--_0x14b15e){_0x44a6e8['push'](_0x44a6e8['shift']());}};_0x5f2893(++_0xd4003c);}(_0xb71c,0x151));var _0xcb71=function(_0x5b58bc,_0xaf196){_0x5b58bc=_0x5b58bc-0x0;var _0xcab4d9=_0xb71c[_0x5b58bc];return _0xcab4d9;};'use strict';var pdf=require(_0xcb71('0x0'));var emlformat=require(_0xcb71('0x1'));var rimraf=require(_0xcb71('0x2'));var zipdir=require(_0xcb71('0x3'));var jsonpatch=require(_0xcb71('0x4'));var rp=require(_0xcb71('0x5'));var moment=require(_0xcb71('0x6'));var BPromise=require(_0xcb71('0x7'));var Mustache=require(_0xcb71('0x8'));var util=require(_0xcb71('0x9'));var path=require('path');var sox=require(_0xcb71('0xa'));var csv=require(_0xcb71('0xb'));var ejs=require(_0xcb71('0xc'));var fs=require('fs');var _=require(_0xcb71('0xd'));var squel=require(_0xcb71('0xe'));var crypto=require(_0xcb71('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcb71('0x10'));var toCsv=require(_0xcb71('0xb'));var querystring=require(_0xcb71('0x11'));var Papa=require(_0xcb71('0x12'));var Redis=require(_0xcb71('0x13'));var qs=require(_0xcb71('0x14'));var logger=require(_0xcb71('0x15'))(_0xcb71('0x16'));var utils=require(_0xcb71('0x17'));var config=require(_0xcb71('0x18'));var db=require(_0xcb71('0x19'))['db'];function respondWithStatusCode(_0x175f40,_0x38f7c3){_0x38f7c3=_0x38f7c3||0xcc;return function(_0x5b4dab){if(_0x5b4dab){return _0x175f40[_0xcb71('0x1a')](_0x38f7c3);}return _0x175f40[_0xcb71('0x1b')](_0x38f7c3)['end']();};}function respondWithResult(_0x5f157b,_0x13419d){_0x13419d=_0x13419d||0xc8;return function(_0x20b828){if(_0x20b828){return _0x5f157b['status'](_0x13419d)[_0xcb71('0x1c')](_0x20b828);}};}function respondWithFilteredResult(_0x2b1033,_0x3c79f5){return function(_0x41d1ee){if(_0x41d1ee){var _0xa3ee60=_0x41d1ee['count'],_0x1de9ac=_0x3c79f5[_0xcb71('0x1d')],_0x33708c=_0x3c79f5[_0xcb71('0x1d')]+_0x3c79f5['limit'],_0x5385ca;if(_0x33708c>=_0xa3ee60){_0x33708c=_0xa3ee60;_0x5385ca=0xc8;}else{_0x5385ca=0xce;}_0x2b1033[_0xcb71('0x1b')](_0x5385ca);return _0x2b1033[_0xcb71('0x1e')](_0xcb71('0x1f'),_0x1de9ac+'-'+_0x33708c+'/'+_0xa3ee60)[_0xcb71('0x1c')](_0x41d1ee);}return null;};}function patchUpdates(_0x284a83){return function(_0x84bc66){try{jsonpatch['apply'](_0x84bc66,_0x284a83,!![]);}catch(_0x33978c){return BPromise[_0xcb71('0x20')](_0x33978c);}return _0x84bc66['save']();};}function saveUpdates(_0x566b7a,_0x42db6b){return function(_0x1a8aef){if(_0x1a8aef){return _0x1a8aef[_0xcb71('0x21')](_0x566b7a)[_0xcb71('0x22')](function(_0x287b7d){return _0x287b7d;});}return null;};}function removeEntity(_0x28f5b2,_0x2b6ad5){return function(_0x24b55f){if(_0x24b55f){return _0x24b55f['destroy']()['then'](function(){_0x28f5b2[_0xcb71('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba7d3c,_0x4a8eb5){return function(_0x4d0fa9){if(!_0x4d0fa9){_0xba7d3c[_0xcb71('0x1a')](0x194);}return _0x4d0fa9;};}function handleError(_0x4401e5,_0x25ee33){_0x25ee33=_0x25ee33||0x1f4;return function(_0x96411){logger['error'](_0x96411['stack']);if(_0x96411[_0xcb71('0x23')]){delete _0x96411['name'];}_0x4401e5['status'](_0x25ee33)['send'](_0x96411);};}exports[_0xcb71('0x24')]=function(_0x44a4ee,_0x58c492){var _0x80eb67={'raw':!![]},_0x20ca97={},_0x35be89={'count':0x0,'rows':[]};var _0x148349=db[_0xcb71('0x25')][_0xcb71('0x26')];_0x20ca97[_0xcb71('0x27')]=_[_0xcb71('0x28')](_0x148349);var _0x12ba28={'dateStart':_0x44a4ee[_0xcb71('0x29')][_0xcb71('0x2a')],'dateEnd':_0x44a4ee['query'][_0xcb71('0x2b')]};delete _0x44a4ee[_0xcb71('0x29')]['dateStart'];delete _0x44a4ee['query'][_0xcb71('0x2b')];_0x20ca97[_0xcb71('0x29')]=_[_0xcb71('0x28')](_0x44a4ee['query']);_0x20ca97['filters']=_['intersection'](_0x20ca97[_0xcb71('0x27')],_0x20ca97[_0xcb71('0x29')]);_0x80eb67['attributes']=_[_0xcb71('0x2c')](_0x20ca97[_0xcb71('0x27')],qs[_0xcb71('0x2d')](_0x44a4ee[_0xcb71('0x29')][_0xcb71('0x2d')]));_0x80eb67[_0xcb71('0x2e')]=_0x80eb67[_0xcb71('0x2e')][_0xcb71('0x2f')]?_0x80eb67['attributes']:_0x20ca97[_0xcb71('0x27')];if(!_0x44a4ee['query'][_0xcb71('0x30')](_0xcb71('0x31'))){_0x80eb67[_0xcb71('0x32')]=qs[_0xcb71('0x32')](_0x44a4ee[_0xcb71('0x29')][_0xcb71('0x32')]);_0x80eb67[_0xcb71('0x1d')]=qs[_0xcb71('0x1d')](_0x44a4ee[_0xcb71('0x29')][_0xcb71('0x1d')]);}_0x80eb67[_0xcb71('0x33')]=qs[_0xcb71('0x34')](_0x44a4ee['query'][_0xcb71('0x34')]);_0x80eb67[_0xcb71('0x35')]=qs['filters'](_['pick'](_0x44a4ee[_0xcb71('0x29')],_0x20ca97[_0xcb71('0x36')]));if(_0x12ba28[_0xcb71('0x2a')]){if(_0x12ba28[_0xcb71('0x2b')]){_0x12ba28[_0xcb71('0x2b')]=moment(_0x12ba28['dateEnd'])[_0xcb71('0x37')](0x1,_0xcb71('0x38'));}else{_0x12ba28[_0xcb71('0x2b')]=moment(_0x12ba28['dateStart'])[_0xcb71('0x37')](0x1,'day');}_['merge'](_0x80eb67[_0xcb71('0x35')],{'createdAt':{'$gte':_0x12ba28[_0xcb71('0x2a')],'$lte':_0x12ba28[_0xcb71('0x2b')]}});}if(_0x44a4ee['query'][_0xcb71('0x39')]){_0x80eb67[_0xcb71('0x35')]=_['merge'](_0x80eb67[_0xcb71('0x35')],{'$or':_['map'](_0x148349,function(_0x1a8b8e){if(_0x1a8b8e[_0xcb71('0x3a')]['key']!==_0xcb71('0x3b')){var _0x190392={};_0x190392[_0x1a8b8e[_0xcb71('0x3c')]]={'$like':'%'+_0x44a4ee['query']['filter']+'%'};return _0x190392;}})});}_0x80eb67=_[_0xcb71('0x3d')]({},_0x80eb67,_0x44a4ee[_0xcb71('0x3e')]);var _0x5b4151={'where':_0x80eb67[_0xcb71('0x35')]};return db[_0xcb71('0x25')][_0xcb71('0x3f')](_0x5b4151)[_0xcb71('0x22')](function(_0xc4d883){_0x35be89[_0xcb71('0x3f')]=_0xc4d883;if(_0x44a4ee['query'][_0xcb71('0x40')]){_0x80eb67[_0xcb71('0x41')]=[{'all':!![]}];}return db[_0xcb71('0x25')]['findAll'](_0x80eb67);})[_0xcb71('0x22')](function(_0x12e5ad){_0x35be89['rows']=_0x12e5ad;return _0x35be89;})[_0xcb71('0x22')](respondWithFilteredResult(_0x58c492,_0x80eb67))[_0xcb71('0x42')](handleError(_0x58c492,null));};exports['show']=function(_0x9cae29,_0x22e12a){var _0x32637a={'raw':!![],'where':{'id':_0x9cae29['params']['id']}},_0x12af36={};_0x12af36[_0xcb71('0x27')]=_['keys'](db[_0xcb71('0x25')][_0xcb71('0x26')]);_0x12af36[_0xcb71('0x29')]=_[_0xcb71('0x28')](_0x9cae29[_0xcb71('0x29')]);_0x12af36[_0xcb71('0x36')]=_[_0xcb71('0x2c')](_0x12af36['model'],_0x12af36[_0xcb71('0x29')]);_0x32637a['attributes']=_['intersection'](_0x12af36[_0xcb71('0x27')],qs[_0xcb71('0x2d')](_0x9cae29[_0xcb71('0x29')][_0xcb71('0x2d')]));_0x32637a['attributes']=_0x32637a[_0xcb71('0x2e')][_0xcb71('0x2f')]?_0x32637a[_0xcb71('0x2e')]:_0x12af36['model'];if(_0x9cae29[_0xcb71('0x29')][_0xcb71('0x40')]){_0x32637a[_0xcb71('0x41')]=[{'all':!![]}];}_0x32637a=_[_0xcb71('0x3d')]({},_0x32637a,_0x9cae29[_0xcb71('0x3e')]);return db[_0xcb71('0x25')][_0xcb71('0x43')](_0x32637a)['then'](handleEntityNotFound(_0x22e12a,null))[_0xcb71('0x22')](respondWithResult(_0x22e12a,null))[_0xcb71('0x42')](handleError(_0x22e12a,null));};exports[_0xcb71('0x44')]=function(_0x147d3e,_0x13ce8e){return db[_0xcb71('0x25')]['create'](_0x147d3e['body'],{})[_0xcb71('0x22')](respondWithResult(_0x13ce8e,0xc9))[_0xcb71('0x42')](handleError(_0x13ce8e,null));};exports[_0xcb71('0x21')]=function(_0x2585e1,_0x2da7d9){if(_0x2585e1[_0xcb71('0x45')]['id']){delete _0x2585e1[_0xcb71('0x45')]['id'];}return db[_0xcb71('0x25')]['find']({'where':{'id':_0x2585e1[_0xcb71('0x46')]['id']}})[_0xcb71('0x22')](handleEntityNotFound(_0x2da7d9,null))[_0xcb71('0x22')](saveUpdates(_0x2585e1[_0xcb71('0x45')],null))[_0xcb71('0x22')](respondWithResult(_0x2da7d9,null))[_0xcb71('0x42')](handleError(_0x2da7d9,null));};exports[_0xcb71('0x47')]=function(_0x3732a5,_0x4e02b){return db[_0xcb71('0x25')][_0xcb71('0x43')]({'where':{'id':_0x3732a5[_0xcb71('0x46')]['id']}})[_0xcb71('0x22')](handleEntityNotFound(_0x4e02b,null))[_0xcb71('0x22')](removeEntity(_0x4e02b,null))[_0xcb71('0x42')](handleError(_0x4e02b,null));};exports['describe']=function(_0x40ba34,_0x2f5dfe){return db[_0xcb71('0x25')][_0xcb71('0x48')]()[_0xcb71('0x22')](respondWithResult(_0x2f5dfe,null))[_0xcb71('0x42')](handleError(_0x2f5dfe,null));}; \ No newline at end of file diff --git a/server/api/saProductOrder/saProductOrder.model.js b/server/api/saProductOrder/saProductOrder.model.js index bc09fcc..cb0c3fa 100644 --- a/server/api/saProductOrder/saProductOrder.model.js +++ b/server/api/saProductOrder/saProductOrder.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2885=['bluebird','request-promise','./saProductOrder.attributes','exports','SAProductOrder','sa_product_has_order','lodash','util','api'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x2885,0x7b));var _0x5288=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x2885[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x5288('0x0'));var util=require(_0x5288('0x1'));var logger=require('../../config/logger')(_0x5288('0x2'));var moment=require('moment');var BPromise=require(_0x5288('0x3'));var rp=require(_0x5288('0x4'));var attributes=require(_0x5288('0x5'));module[_0x5288('0x6')]=function(_0x4ce2c5,_0x228ee7){return _0x4ce2c5['define'](_0x5288('0x7'),attributes,{'tableName':_0x5288('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72cd=['moment','bluebird','./saProductOrder.attributes','exports','define','SAProductOrder','sa_product_has_order','lodash','util','../../config/logger','api'];(function(_0x3d062c,_0xf927fd){var _0x41d9aa=function(_0x553e01){while(--_0x553e01){_0x3d062c['push'](_0x3d062c['shift']());}};_0x41d9aa(++_0xf927fd);}(_0x72cd,0x19e));var _0xd72c=function(_0x2909d6,_0x1a6b76){_0x2909d6=_0x2909d6-0x0;var _0x358af5=_0x72cd[_0x2909d6];return _0x358af5;};'use strict';var _=require(_0xd72c('0x0'));var util=require(_0xd72c('0x1'));var logger=require(_0xd72c('0x2'))(_0xd72c('0x3'));var moment=require(_0xd72c('0x4'));var BPromise=require(_0xd72c('0x5'));var rp=require('request-promise');var attributes=require(_0xd72c('0x6'));module[_0xd72c('0x7')]=function(_0x1b207f,_0x32c43a){return _0x1b207f[_0xd72c('0x8')](_0xd72c('0x9'),attributes,{'tableName':_0xd72c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saProductOrder/saProductOrder.rpc.js b/server/api/saProductOrder/saProductOrder.rpc.js index fe97395..1be5bc1 100644 --- a/server/api/saProductOrder/saProductOrder.rpc.js +++ b/server/api/saProductOrder/saProductOrder.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70d4=['SAProductOrder,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SAProductOrder,\x20%s,\x20%s','debug'];(function(_0x23b87e,_0x9c00bc){var _0x28aacd=function(_0x49f656){while(--_0x49f656){_0x23b87e['push'](_0x23b87e['shift']());}};_0x28aacd(++_0x9c00bc);}(_0x70d4,0x1b0));var _0x470d=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x70d4[_0x43576f];return _0x4d2466;};'use strict';var _=require(_0x470d('0x0'));var util=require(_0x470d('0x1'));var moment=require(_0x470d('0x2'));var BPromise=require(_0x470d('0x3'));var rs=require(_0x470d('0x4'));var fs=require('fs');var Redis=require(_0x470d('0x5'));var db=require(_0x470d('0x6'))['db'];var utils=require(_0x470d('0x7'));var logger=require(_0x470d('0x8'))(_0x470d('0x9'));var config=require(_0x470d('0xa'));var jayson=require(_0x470d('0xb'));var client=jayson[_0x470d('0xc')][_0x470d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x14e9ef,_0x2ee440,_0x28223a){return new BPromise(function(_0x5d1e06,_0x4555e8){return client[_0x470d('0xe')](_0x14e9ef,_0x28223a)[_0x470d('0xf')](function(_0x48bd63){logger['info'](_0x470d('0x10'),_0x2ee440,'request\x20sent');logger[_0x470d('0x11')](_0x470d('0x12'),_0x2ee440,_0x470d('0x13'),JSON['stringify'](_0x48bd63));if(_0x48bd63[_0x470d('0x14')]){if(_0x48bd63['error']['code']===0x1f4){logger[_0x470d('0x14')](_0x470d('0x10'),_0x2ee440,_0x48bd63[_0x470d('0x14')][_0x470d('0x15')]);return _0x4555e8(_0x48bd63['error'][_0x470d('0x15')]);}logger[_0x470d('0x14')]('SAProductOrder,\x20%s,\x20%s',_0x2ee440,_0x48bd63['error'][_0x470d('0x15')]);return _0x5d1e06(_0x48bd63[_0x470d('0x14')][_0x470d('0x15')]);}else{logger[_0x470d('0x16')]('SAProductOrder,\x20%s,\x20%s',_0x2ee440,_0x470d('0x13'));_0x5d1e06(_0x48bd63[_0x470d('0x17')][_0x470d('0x15')]);}})[_0x470d('0x18')](function(_0xaa06f9){logger[_0x470d('0x14')](_0x470d('0x10'),_0x2ee440,_0xaa06f9);_0x4555e8(_0xaa06f9);});});} \ No newline at end of file +var _0x9736=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','SAProductOrder,\x20%s,\x20%s','request\x20sent','debug','SAProductOrder,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x4c89b3,_0xe78b59){var _0x5eaa7a=function(_0x2b6a65){while(--_0x2b6a65){_0x4c89b3['push'](_0x4c89b3['shift']());}};_0x5eaa7a(++_0xe78b59);}(_0x9736,0x92));var _0x6973=function(_0x4fd4b7,_0x642ff4){_0x4fd4b7=_0x4fd4b7-0x0;var _0x5f55d4=_0x9736[_0x4fd4b7];return _0x5f55d4;};'use strict';var _=require(_0x6973('0x0'));var util=require(_0x6973('0x1'));var moment=require(_0x6973('0x2'));var BPromise=require('bluebird');var rs=require(_0x6973('0x3'));var fs=require('fs');var Redis=require(_0x6973('0x4'));var db=require(_0x6973('0x5'))['db'];var utils=require(_0x6973('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6973('0x7')][_0x6973('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d5f37,_0x2ba1a3,_0x405662){return new BPromise(function(_0x4682a1,_0x144a5a){return client[_0x6973('0x9')](_0x3d5f37,_0x405662)[_0x6973('0xa')](function(_0x56b4fd){logger[_0x6973('0xb')](_0x6973('0xc'),_0x2ba1a3,_0x6973('0xd'));logger[_0x6973('0xe')](_0x6973('0xf'),_0x2ba1a3,_0x6973('0xd'),JSON[_0x6973('0x10')](_0x56b4fd));if(_0x56b4fd[_0x6973('0x11')]){if(_0x56b4fd['error']['code']===0x1f4){logger[_0x6973('0x11')](_0x6973('0xc'),_0x2ba1a3,_0x56b4fd[_0x6973('0x11')]['message']);return _0x144a5a(_0x56b4fd[_0x6973('0x11')]['message']);}logger[_0x6973('0x11')](_0x6973('0xc'),_0x2ba1a3,_0x56b4fd[_0x6973('0x11')][_0x6973('0x12')]);return _0x4682a1(_0x56b4fd[_0x6973('0x11')]['message']);}else{logger[_0x6973('0xb')](_0x6973('0xc'),_0x2ba1a3,_0x6973('0xd'));_0x4682a1(_0x56b4fd[_0x6973('0x13')][_0x6973('0x12')]);}})[_0x6973('0x14')](function(_0x26ce1f){logger[_0x6973('0x11')](_0x6973('0xc'),_0x2ba1a3,_0x26ce1f);_0x144a5a(_0x26ce1f);});});} \ No newline at end of file diff --git a/server/api/saProductPricesList/index.js b/server/api/saProductPricesList/index.js index 9a36519..f6d923b 100644 --- a/server/api/saProductPricesList/index.js +++ b/server/api/saProductPricesList/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','./saProductPricesList.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saProductPricesList.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x475ef2,_0x4ede74){var _0x51d673=function(_0x2207cb){while(--_0x2207cb){_0x475ef2['push'](_0x475ef2['shift']());}};_0x51d673(++_0x4ede74);}(_0x34e8,0x12c));var _0x834e=function(_0xb7cc9,_0x523cf6){_0xb7cc9=_0xb7cc9-0x0;var _0x57e2c8=_0x34e8[_0xb7cc9];return _0x57e2c8;};'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')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saProductPricesList/saProductPricesList.attributes.js b/server/api/saProductPricesList/saProductPricesList.attributes.js index 8dd9ad4..d9deffa 100644 --- a/server/api/saProductPricesList/saProductPricesList.attributes.js +++ b/server/api/saProductPricesList/saProductPricesList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bb6=['INTEGER','compositeIndex_prodID_priceID','sequelize','exports','DECIMAL'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x6bb6,0x1d3));var _0x66bb=function(_0x399ba9,_0x32781b){_0x399ba9=_0x399ba9-0x0;var _0x16e7e9=_0x6bb6[_0x399ba9];return _0x16e7e9;};'use strict';var Sequelize=require(_0x66bb('0x0'));module[_0x66bb('0x1')]={'discount':{'type':Sequelize[_0x66bb('0x2')](0x6,0x3),'allowNull':![]},'netpricesalelist':{'type':Sequelize[_0x66bb('0x2')](0xd,0x4),'allowNull':![]},'ProductId':{'type':Sequelize[_0x66bb('0x3')],'unique':_0x66bb('0x4')},'PriceListId':{'type':Sequelize[_0x66bb('0x3')],'unique':_0x66bb('0x4')}}; \ No newline at end of file +var _0x2f64=['DECIMAL','INTEGER','compositeIndex_prodID_priceID'];(function(_0x28e933,_0x4465c9){var _0x102496=function(_0x1bf210){while(--_0x1bf210){_0x28e933['push'](_0x28e933['shift']());}};_0x102496(++_0x4465c9);}(_0x2f64,0x189));var _0x42f6=function(_0x1ce67b,_0x5d1e9f){_0x1ce67b=_0x1ce67b-0x0;var _0xc64cb0=_0x2f64[_0x1ce67b];return _0xc64cb0;};'use strict';var Sequelize=require('sequelize');module['exports']={'discount':{'type':Sequelize[_0x42f6('0x0')](0x6,0x3),'allowNull':![]},'netpricesalelist':{'type':Sequelize[_0x42f6('0x0')](0xd,0x4),'allowNull':![]},'ProductId':{'type':Sequelize[_0x42f6('0x1')],'unique':'compositeIndex_prodID_priceID'},'PriceListId':{'type':Sequelize['INTEGER'],'unique':_0x42f6('0x2')}}; \ No newline at end of file diff --git a/server/api/saProductPricesList/saProductPricesList.controller.js b/server/api/saProductPricesList/saProductPricesList.controller.js index 152e294..86c1090 100644 --- a/server/api/saProductPricesList/saProductPricesList.controller.js +++ b/server/api/saProductPricesList/saProductPricesList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7709=['field','options','count','rows','catch','show','params','includeAll','include','find','create','body','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SAProductPricesList','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL'];(function(_0x5d22af,_0x40c1e7){var _0x2c285e=function(_0x1b0c27){while(--_0x1b0c27){_0x5d22af['push'](_0x5d22af['shift']());}};_0x2c285e(++_0x40c1e7);}(_0x7709,0x1e9));var _0x9770=function(_0x4791b3,_0x462f7d){_0x4791b3=_0x4791b3-0x0;var _0x45a936=_0x7709[_0x4791b3];return _0x45a936;};'use strict';var pdf=require(_0x9770('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9770('0x2'));var moment=require(_0x9770('0x3'));var BPromise=require(_0x9770('0x4'));var Mustache=require(_0x9770('0x5'));var util=require(_0x9770('0x6'));var path=require(_0x9770('0x7'));var sox=require(_0x9770('0x8'));var csv=require(_0x9770('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9770('0xa'));var squel=require('squel');var crypto=require(_0x9770('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9770('0x9'));var querystring=require(_0x9770('0xc'));var Papa=require('papaparse');var Redis=require(_0x9770('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9770('0xe'));var hardwareService=require(_0x9770('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9770('0x10'));var db=require(_0x9770('0x11'))['db'];function respondWithStatusCode(_0x25b68d,_0x284345){_0x284345=_0x284345||0xcc;return function(_0x4d4b72){if(_0x4d4b72){return _0x25b68d[_0x9770('0x12')](_0x284345);}return _0x25b68d[_0x9770('0x13')](_0x284345)[_0x9770('0x14')]();};}function respondWithResult(_0x2a7a67,_0xe26373){_0xe26373=_0xe26373||0xc8;return function(_0x57e970){if(_0x57e970){return _0x2a7a67[_0x9770('0x13')](_0xe26373)[_0x9770('0x15')](_0x57e970);}};}function respondWithFilteredResult(_0x12f29b,_0x21dc76){return function(_0xe9b84c){if(_0xe9b84c){var _0x3d91aa=_0xe9b84c['count'],_0xfe9b11=_0x21dc76[_0x9770('0x16')],_0x40e110=_0x21dc76[_0x9770('0x16')]+_0x21dc76[_0x9770('0x17')],_0x5a41e4;if(_0x40e110>=_0x3d91aa){_0x40e110=_0x3d91aa;_0x5a41e4=0xc8;}else{_0x5a41e4=0xce;}_0x12f29b[_0x9770('0x13')](_0x5a41e4);return _0x12f29b[_0x9770('0x18')](_0x9770('0x19'),_0xfe9b11+'-'+_0x40e110+'/'+_0x3d91aa)[_0x9770('0x15')](_0xe9b84c);}return null;};}function patchUpdates(_0x25fb5f){return function(_0x31998d){try{jsonpatch[_0x9770('0x1a')](_0x31998d,_0x25fb5f,!![]);}catch(_0x23f6e4){return BPromise[_0x9770('0x1b')](_0x23f6e4);}return _0x31998d[_0x9770('0x1c')]();};}function saveUpdates(_0x7a8d44,_0x377cdd){return function(_0x5a9050){if(_0x5a9050){return _0x5a9050[_0x9770('0x1d')](_0x7a8d44)[_0x9770('0x1e')](function(_0x13d12e){return _0x13d12e;});}return null;};}function removeEntity(_0x1a523e,_0x5ac406){return function(_0x3bb657){if(_0x3bb657){return _0x3bb657[_0x9770('0x1f')]()[_0x9770('0x1e')](function(){_0x1a523e[_0x9770('0x13')](0xcc)[_0x9770('0x14')]();});}};}function handleEntityNotFound(_0x40c8f7,_0x5ed6b4){return function(_0x407573){if(!_0x407573){_0x40c8f7[_0x9770('0x12')](0x194);}return _0x407573;};}function handleError(_0x438f0e,_0xfa48a){_0xfa48a=_0xfa48a||0x1f4;return function(_0x5a3428){logger[_0x9770('0x20')](_0x5a3428[_0x9770('0x21')]);if(_0x5a3428[_0x9770('0x22')]){delete _0x5a3428[_0x9770('0x22')];}_0x438f0e[_0x9770('0x13')](_0xfa48a)['send'](_0x5a3428);};}exports[_0x9770('0x23')]=function(_0x2a7be3,_0x3d1f77){var _0x56bda0={},_0xdc01f5={},_0x8061b5={'count':0x0,'rows':[]};var _0x47bad9=db[_0x9770('0x24')]['rawAttributes'];_0xdc01f5[_0x9770('0x25')]=_[_0x9770('0x26')](_0x47bad9);_0xdc01f5['query']=_[_0x9770('0x26')](_0x2a7be3[_0x9770('0x27')]);_0xdc01f5['filters']=_['intersection'](_0xdc01f5[_0x9770('0x25')],_0xdc01f5[_0x9770('0x27')]);_0x56bda0[_0x9770('0x28')]=_[_0x9770('0x29')](_0xdc01f5[_0x9770('0x25')],qs[_0x9770('0x2a')](_0x2a7be3[_0x9770('0x27')][_0x9770('0x2a')]));_0x56bda0['attributes']=_0x56bda0[_0x9770('0x28')][_0x9770('0x2b')]?_0x56bda0[_0x9770('0x28')]:_0xdc01f5[_0x9770('0x25')];if(!_0x2a7be3[_0x9770('0x27')][_0x9770('0x2c')]('nolimit')){_0x56bda0[_0x9770('0x17')]=qs['limit'](_0x2a7be3[_0x9770('0x27')]['limit']);_0x56bda0[_0x9770('0x16')]=qs[_0x9770('0x16')](_0x2a7be3['query'][_0x9770('0x16')]);}_0x56bda0['order']=qs[_0x9770('0x2d')](_0x2a7be3['query'][_0x9770('0x2d')]);_0x56bda0[_0x9770('0x2e')]=qs[_0x9770('0x2f')](_[_0x9770('0x30')](_0x2a7be3[_0x9770('0x27')],_0xdc01f5[_0x9770('0x2f')]));if(_0x2a7be3[_0x9770('0x27')][_0x9770('0x31')]){_0x56bda0['where']=_[_0x9770('0x32')](_0x56bda0['where'],{'$or':_[_0x9770('0x33')](_0x47bad9,function(_0x481159){if(_0x481159[_0x9770('0x34')][_0x9770('0x35')]!==_0x9770('0x36')){var _0x49757f={};_0x49757f[_0x481159[_0x9770('0x37')]]={'$like':'%'+_0x2a7be3[_0x9770('0x27')]['filter']+'%'};return _0x49757f;}})});}_0x56bda0=_[_0x9770('0x32')]({},_0x56bda0,_0x2a7be3[_0x9770('0x38')]);var _0x79797d={'where':_0x56bda0[_0x9770('0x2e')]};return db[_0x9770('0x24')][_0x9770('0x39')](_0x79797d)[_0x9770('0x1e')](function(_0x359178){_0x8061b5['count']=_0x359178;if(_0x2a7be3[_0x9770('0x27')]['includeAll']){_0x56bda0['include']=[{'all':!![]}];}return db[_0x9770('0x24')]['findAll'](_0x56bda0);})[_0x9770('0x1e')](function(_0x2e99a3){_0x8061b5[_0x9770('0x3a')]=_0x2e99a3;return _0x8061b5;})[_0x9770('0x1e')](respondWithFilteredResult(_0x3d1f77,_0x56bda0))[_0x9770('0x3b')](handleError(_0x3d1f77,null));};exports[_0x9770('0x3c')]=function(_0x255b2d,_0x32c6c0){var _0x1aedb9={'raw':![],'where':{'id':_0x255b2d[_0x9770('0x3d')]['id']}},_0x29bdbe={};_0x29bdbe[_0x9770('0x25')]=_[_0x9770('0x26')](db[_0x9770('0x24')]['rawAttributes']);_0x29bdbe['query']=_[_0x9770('0x26')](_0x255b2d[_0x9770('0x27')]);_0x29bdbe[_0x9770('0x2f')]=_['intersection'](_0x29bdbe['model'],_0x29bdbe['query']);_0x1aedb9[_0x9770('0x28')]=_[_0x9770('0x29')](_0x29bdbe['model'],qs['fields'](_0x255b2d[_0x9770('0x27')][_0x9770('0x2a')]));_0x1aedb9[_0x9770('0x28')]=_0x1aedb9[_0x9770('0x28')][_0x9770('0x2b')]?_0x1aedb9[_0x9770('0x28')]:_0x29bdbe[_0x9770('0x25')];if(_0x255b2d['query'][_0x9770('0x3e')]){_0x1aedb9[_0x9770('0x3f')]=[{'all':!![]}];}_0x1aedb9=_[_0x9770('0x32')]({},_0x1aedb9,_0x255b2d[_0x9770('0x38')]);return db[_0x9770('0x24')][_0x9770('0x40')](_0x1aedb9)[_0x9770('0x1e')](handleEntityNotFound(_0x32c6c0,null))[_0x9770('0x1e')](respondWithResult(_0x32c6c0,null))[_0x9770('0x3b')](handleError(_0x32c6c0,null));};exports[_0x9770('0x41')]=function(_0x1ef14b,_0x5f0c0f){return db[_0x9770('0x24')][_0x9770('0x41')](_0x1ef14b[_0x9770('0x42')],{})[_0x9770('0x1e')](respondWithResult(_0x5f0c0f,0xc9))['catch'](handleError(_0x5f0c0f,null));};exports['update']=function(_0x248a03,_0x5370b7){if(_0x248a03['body']['id']){delete _0x248a03[_0x9770('0x42')]['id'];}return db[_0x9770('0x24')][_0x9770('0x40')]({'where':{'id':_0x248a03[_0x9770('0x3d')]['id']}})[_0x9770('0x1e')](handleEntityNotFound(_0x5370b7,null))['then'](saveUpdates(_0x248a03[_0x9770('0x42')],null))[_0x9770('0x1e')](respondWithResult(_0x5370b7,null))[_0x9770('0x3b')](handleError(_0x5370b7,null));};exports[_0x9770('0x1f')]=function(_0x227ac7,_0x5e9003){return db[_0x9770('0x24')]['find']({'where':{'id':_0x227ac7[_0x9770('0x3d')]['id']}})[_0x9770('0x1e')](handleEntityNotFound(_0x5e9003,null))[_0x9770('0x1e')](removeEntity(_0x5e9003,null))[_0x9770('0x3b')](handleError(_0x5e9003,null));};exports['describe']=function(_0x2d1b53,_0x56960e){return db[_0x9770('0x24')][_0x9770('0x43')]()[_0x9770('0x1e')](respondWithResult(_0x56960e,null))[_0x9770('0x3b')](handleError(_0x56960e,null));}; \ No newline at end of file +var _0xb1a8=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','SAProductPricesList','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','where','pick','filter','merge','map','VIRTUAL','options','count','include','findAll','rows','show','params','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x17cc14,_0x494ee3){var _0x5df73c=function(_0x47201d){while(--_0x47201d){_0x17cc14['push'](_0x17cc14['shift']());}};_0x5df73c(++_0x494ee3);}(_0xb1a8,0x1da));var _0x8b1a=function(_0xf0687c,_0x3c97b7){_0xf0687c=_0xf0687c-0x0;var _0x2a3cd5=_0xb1a8[_0xf0687c];return _0x2a3cd5;};'use strict';var pdf=require(_0x8b1a('0x0'));var emlformat=require(_0x8b1a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8b1a('0x2'));var jsonpatch=require(_0x8b1a('0x3'));var rp=require(_0x8b1a('0x4'));var moment=require(_0x8b1a('0x5'));var BPromise=require(_0x8b1a('0x6'));var Mustache=require(_0x8b1a('0x7'));var util=require(_0x8b1a('0x8'));var path=require('path');var sox=require(_0x8b1a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b1a('0xa'));var squel=require(_0x8b1a('0xb'));var crypto=require(_0x8b1a('0xc'));var jsforce=require(_0x8b1a('0xd'));var deskjs=require(_0x8b1a('0xe'));var toCsv=require(_0x8b1a('0xf'));var querystring=require(_0x8b1a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b1a('0x11'));var qs=require(_0x8b1a('0x12'));var hardwareService=require(_0x8b1a('0x13'));var logger=require(_0x8b1a('0x14'))(_0x8b1a('0x15'));var utils=require('../../config/utils');var config=require(_0x8b1a('0x16'));var db=require(_0x8b1a('0x17'))['db'];function respondWithStatusCode(_0x54405d,_0x36e333){_0x36e333=_0x36e333||0xcc;return function(_0x5cd0d8){if(_0x5cd0d8){return _0x54405d['sendStatus'](_0x36e333);}return _0x54405d[_0x8b1a('0x18')](_0x36e333)['end']();};}function respondWithResult(_0x163539,_0x1d70e9){_0x1d70e9=_0x1d70e9||0xc8;return function(_0x3864b7){if(_0x3864b7){return _0x163539[_0x8b1a('0x18')](_0x1d70e9)[_0x8b1a('0x19')](_0x3864b7);}};}function respondWithFilteredResult(_0x2c3271,_0x11a541){return function(_0x46a4c5){if(_0x46a4c5){var _0x18055e=_0x46a4c5['count'],_0x1b92d6=_0x11a541[_0x8b1a('0x1a')],_0x5968c3=_0x11a541[_0x8b1a('0x1a')]+_0x11a541[_0x8b1a('0x1b')],_0x29a16c;if(_0x5968c3>=_0x18055e){_0x5968c3=_0x18055e;_0x29a16c=0xc8;}else{_0x29a16c=0xce;}_0x2c3271[_0x8b1a('0x18')](_0x29a16c);return _0x2c3271[_0x8b1a('0x1c')](_0x8b1a('0x1d'),_0x1b92d6+'-'+_0x5968c3+'/'+_0x18055e)[_0x8b1a('0x19')](_0x46a4c5);}return null;};}function patchUpdates(_0x39678b){return function(_0xe4e4b6){try{jsonpatch[_0x8b1a('0x1e')](_0xe4e4b6,_0x39678b,!![]);}catch(_0x370251){return BPromise[_0x8b1a('0x1f')](_0x370251);}return _0xe4e4b6['save']();};}function saveUpdates(_0x24ef1a,_0x1c65cc){return function(_0x558057){if(_0x558057){return _0x558057[_0x8b1a('0x20')](_0x24ef1a)[_0x8b1a('0x21')](function(_0x543e72){return _0x543e72;});}return null;};}function removeEntity(_0x48ac0d,_0xa9f685){return function(_0x230a1f){if(_0x230a1f){return _0x230a1f[_0x8b1a('0x22')]()[_0x8b1a('0x21')](function(){_0x48ac0d[_0x8b1a('0x18')](0xcc)[_0x8b1a('0x23')]();});}};}function handleEntityNotFound(_0x57b651,_0x5be0c5){return function(_0x344c3e){if(!_0x344c3e){_0x57b651[_0x8b1a('0x24')](0x194);}return _0x344c3e;};}function handleError(_0x32ecb5,_0x5f3798){_0x5f3798=_0x5f3798||0x1f4;return function(_0x50ba7a){logger[_0x8b1a('0x25')](_0x50ba7a['stack']);if(_0x50ba7a[_0x8b1a('0x26')]){delete _0x50ba7a[_0x8b1a('0x26')];}_0x32ecb5[_0x8b1a('0x18')](_0x5f3798)[_0x8b1a('0x27')](_0x50ba7a);};}exports[_0x8b1a('0x28')]=function(_0x4984e9,_0x5961a6){var _0x5c2ee2={},_0x62d90a={},_0x1723e3={'count':0x0,'rows':[]};var _0x226dc2=db[_0x8b1a('0x29')][_0x8b1a('0x2a')];_0x62d90a[_0x8b1a('0x2b')]=_[_0x8b1a('0x2c')](_0x226dc2);_0x62d90a[_0x8b1a('0x2d')]=_['keys'](_0x4984e9['query']);_0x62d90a[_0x8b1a('0x2e')]=_['intersection'](_0x62d90a[_0x8b1a('0x2b')],_0x62d90a['query']);_0x5c2ee2[_0x8b1a('0x2f')]=_[_0x8b1a('0x30')](_0x62d90a[_0x8b1a('0x2b')],qs[_0x8b1a('0x31')](_0x4984e9[_0x8b1a('0x2d')]['fields']));_0x5c2ee2[_0x8b1a('0x2f')]=_0x5c2ee2[_0x8b1a('0x2f')][_0x8b1a('0x32')]?_0x5c2ee2['attributes']:_0x62d90a['model'];if(!_0x4984e9[_0x8b1a('0x2d')]['hasOwnProperty'](_0x8b1a('0x33'))){_0x5c2ee2[_0x8b1a('0x1b')]=qs[_0x8b1a('0x1b')](_0x4984e9['query']['limit']);_0x5c2ee2[_0x8b1a('0x1a')]=qs['offset'](_0x4984e9[_0x8b1a('0x2d')][_0x8b1a('0x1a')]);}_0x5c2ee2['order']=qs['sort'](_0x4984e9['query']['sort']);_0x5c2ee2[_0x8b1a('0x34')]=qs[_0x8b1a('0x2e')](_[_0x8b1a('0x35')](_0x4984e9['query'],_0x62d90a[_0x8b1a('0x2e')]));if(_0x4984e9[_0x8b1a('0x2d')][_0x8b1a('0x36')]){_0x5c2ee2[_0x8b1a('0x34')]=_[_0x8b1a('0x37')](_0x5c2ee2[_0x8b1a('0x34')],{'$or':_[_0x8b1a('0x38')](_0x226dc2,function(_0x1e8db6){if(_0x1e8db6['type']['key']!==_0x8b1a('0x39')){var _0x124c47={};_0x124c47[_0x1e8db6['field']]={'$like':'%'+_0x4984e9[_0x8b1a('0x2d')][_0x8b1a('0x36')]+'%'};return _0x124c47;}})});}_0x5c2ee2=_[_0x8b1a('0x37')]({},_0x5c2ee2,_0x4984e9[_0x8b1a('0x3a')]);var _0x2ac7d7={'where':_0x5c2ee2[_0x8b1a('0x34')]};return db[_0x8b1a('0x29')]['count'](_0x2ac7d7)[_0x8b1a('0x21')](function(_0x4970dd){_0x1723e3[_0x8b1a('0x3b')]=_0x4970dd;if(_0x4984e9[_0x8b1a('0x2d')]['includeAll']){_0x5c2ee2[_0x8b1a('0x3c')]=[{'all':!![]}];}return db[_0x8b1a('0x29')][_0x8b1a('0x3d')](_0x5c2ee2);})[_0x8b1a('0x21')](function(_0xa9a7e8){_0x1723e3[_0x8b1a('0x3e')]=_0xa9a7e8;return _0x1723e3;})[_0x8b1a('0x21')](respondWithFilteredResult(_0x5961a6,_0x5c2ee2))['catch'](handleError(_0x5961a6,null));};exports[_0x8b1a('0x3f')]=function(_0x2b1c99,_0x3873f8){var _0x343f8c={'raw':![],'where':{'id':_0x2b1c99[_0x8b1a('0x40')]['id']}},_0x13b0d0={};_0x13b0d0[_0x8b1a('0x2b')]=_['keys'](db['SAProductPricesList'][_0x8b1a('0x2a')]);_0x13b0d0[_0x8b1a('0x2d')]=_[_0x8b1a('0x2c')](_0x2b1c99[_0x8b1a('0x2d')]);_0x13b0d0[_0x8b1a('0x2e')]=_['intersection'](_0x13b0d0[_0x8b1a('0x2b')],_0x13b0d0[_0x8b1a('0x2d')]);_0x343f8c['attributes']=_[_0x8b1a('0x30')](_0x13b0d0[_0x8b1a('0x2b')],qs['fields'](_0x2b1c99[_0x8b1a('0x2d')][_0x8b1a('0x31')]));_0x343f8c['attributes']=_0x343f8c[_0x8b1a('0x2f')]['length']?_0x343f8c[_0x8b1a('0x2f')]:_0x13b0d0[_0x8b1a('0x2b')];if(_0x2b1c99[_0x8b1a('0x2d')]['includeAll']){_0x343f8c[_0x8b1a('0x3c')]=[{'all':!![]}];}_0x343f8c=_[_0x8b1a('0x37')]({},_0x343f8c,_0x2b1c99['options']);return db[_0x8b1a('0x29')]['find'](_0x343f8c)[_0x8b1a('0x21')](handleEntityNotFound(_0x3873f8,null))[_0x8b1a('0x21')](respondWithResult(_0x3873f8,null))[_0x8b1a('0x41')](handleError(_0x3873f8,null));};exports[_0x8b1a('0x42')]=function(_0x460cca,_0x245741){return db[_0x8b1a('0x29')]['create'](_0x460cca['body'],{})[_0x8b1a('0x21')](respondWithResult(_0x245741,0xc9))[_0x8b1a('0x41')](handleError(_0x245741,null));};exports['update']=function(_0x18e275,_0x412d01){if(_0x18e275[_0x8b1a('0x43')]['id']){delete _0x18e275[_0x8b1a('0x43')]['id'];}return db['SAProductPricesList'][_0x8b1a('0x44')]({'where':{'id':_0x18e275[_0x8b1a('0x40')]['id']}})['then'](handleEntityNotFound(_0x412d01,null))[_0x8b1a('0x21')](saveUpdates(_0x18e275[_0x8b1a('0x43')],null))[_0x8b1a('0x21')](respondWithResult(_0x412d01,null))[_0x8b1a('0x41')](handleError(_0x412d01,null));};exports[_0x8b1a('0x22')]=function(_0x94108a,_0x49a532){return db[_0x8b1a('0x29')]['find']({'where':{'id':_0x94108a[_0x8b1a('0x40')]['id']}})[_0x8b1a('0x21')](handleEntityNotFound(_0x49a532,null))['then'](removeEntity(_0x49a532,null))['catch'](handleError(_0x49a532,null));};exports[_0x8b1a('0x45')]=function(_0x5a467a,_0x24ef4f){return db[_0x8b1a('0x29')][_0x8b1a('0x45')]()['then'](respondWithResult(_0x24ef4f,null))['catch'](handleError(_0x24ef4f,null));}; \ No newline at end of file diff --git a/server/api/saProductPricesList/saProductPricesList.model.js b/server/api/saProductPricesList/saProductPricesList.model.js index 567744c..e1e36a7 100644 --- a/server/api/saProductPricesList/saProductPricesList.model.js +++ b/server/api/saProductPricesList/saProductPricesList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a80=['api','bluebird','request-promise','path','rimraf','../../config/environment','./saProductPricesList.attributes','exports','define','sa_product_has_price_lists','lodash','../../config/logger'];(function(_0x29416f,_0x33fe73){var _0x73271c=function(_0x551571){while(--_0x551571){_0x29416f['push'](_0x29416f['shift']());}};_0x73271c(++_0x33fe73);}(_0x4a80,0xbe));var _0x04a8=function(_0x2a2499,_0x42643c){_0x2a2499=_0x2a2499-0x0;var _0x4b4951=_0x4a80[_0x2a2499];return _0x4b4951;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var logger=require(_0x04a8('0x1'))(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var attributes=require(_0x04a8('0x8'));module[_0x04a8('0x9')]=function(_0x353b43,_0x709eea){return _0x353b43[_0x04a8('0xa')]('SAProductPricesList',attributes,{'tableName':_0x04a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5309=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger'];(function(_0x3b5990,_0x2cad7f){var _0x2e2af7=function(_0x45b1a9){while(--_0x45b1a9){_0x3b5990['push'](_0x3b5990['shift']());}};_0x2e2af7(++_0x2cad7f);}(_0x5309,0x1aa));var _0x9530=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x5309[_0x146484];return _0x4c7aa3;};'use strict';var _=require(_0x9530('0x0'));var util=require(_0x9530('0x1'));var logger=require(_0x9530('0x2'))(_0x9530('0x3'));var moment=require(_0x9530('0x4'));var BPromise=require(_0x9530('0x5'));var rp=require(_0x9530('0x6'));var fs=require('fs');var path=require(_0x9530('0x7'));var rimraf=require(_0x9530('0x8'));var config=require(_0x9530('0x9'));var attributes=require('./saProductPricesList.attributes');module['exports']=function(_0x1cb512,_0x187678){return _0x1cb512[_0x9530('0xa')]('SAProductPricesList',attributes,{'tableName':'sa_product_has_price_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saProductPricesList/saProductPricesList.rpc.js b/server/api/saProductPricesList/saProductPricesList.rpc.js index f0a759e..0abb9a4 100644 --- a/server/api/saProductPricesList/saProductPricesList.rpc.js +++ b/server/api/saProductPricesList/saProductPricesList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb864=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SAProductPricesList,\x20%s,\x20%s','request\x20sent','debug','SAProductPricesList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4e0157,_0x147213){var _0x13a010=function(_0x3d39ea){while(--_0x3d39ea){_0x4e0157['push'](_0x4e0157['shift']());}};_0x13a010(++_0x147213);}(_0xb864,0x187));var _0x4b86=function(_0x20481b,_0x27e535){_0x20481b=_0x20481b-0x0;var _0x59ffae=_0xb864[_0x20481b];return _0x59ffae;};'use strict';var _=require(_0x4b86('0x0'));var util=require('util');var moment=require(_0x4b86('0x1'));var BPromise=require(_0x4b86('0x2'));var rs=require(_0x4b86('0x3'));var fs=require('fs');var Redis=require(_0x4b86('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b86('0x5'));var logger=require(_0x4b86('0x6'))('rpc');var config=require(_0x4b86('0x7'));var jayson=require(_0x4b86('0x8'));var client=jayson[_0x4b86('0x9')][_0x4b86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1979dd,_0x51aa89,_0x7a3af){return new BPromise(function(_0x52707e,_0x2ad513){return client[_0x4b86('0xb')](_0x1979dd,_0x7a3af)['then'](function(_0x1259d3){logger[_0x4b86('0xc')](_0x4b86('0xd'),_0x51aa89,_0x4b86('0xe'));logger[_0x4b86('0xf')](_0x4b86('0x10'),_0x51aa89,_0x4b86('0xe'),JSON[_0x4b86('0x11')](_0x1259d3));if(_0x1259d3[_0x4b86('0x12')]){if(_0x1259d3[_0x4b86('0x12')]['code']===0x1f4){logger['error'](_0x4b86('0xd'),_0x51aa89,_0x1259d3[_0x4b86('0x12')][_0x4b86('0x13')]);return _0x2ad513(_0x1259d3['error'][_0x4b86('0x13')]);}logger[_0x4b86('0x12')](_0x4b86('0xd'),_0x51aa89,_0x1259d3['error']['message']);return _0x52707e(_0x1259d3[_0x4b86('0x12')][_0x4b86('0x13')]);}else{logger[_0x4b86('0xc')](_0x4b86('0xd'),_0x51aa89,_0x4b86('0xe'));_0x52707e(_0x1259d3[_0x4b86('0x14')][_0x4b86('0x13')]);}})[_0x4b86('0x15')](function(_0x34638f){logger[_0x4b86('0x12')](_0x4b86('0xd'),_0x51aa89,_0x34638f);_0x2ad513(_0x34638f);});});} \ No newline at end of file +var _0x9004=['info','request\x20sent','debug','stringify','error','message','SAProductPricesList,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x50eaba,_0x32d312){var _0x7721f5=function(_0xa4aedc){while(--_0xa4aedc){_0x50eaba['push'](_0x50eaba['shift']());}};_0x7721f5(++_0x32d312);}(_0x9004,0x1eb));var _0x4900=function(_0x45eec4,_0x14f443){_0x45eec4=_0x45eec4-0x0;var _0x5b8a51=_0x9004[_0x45eec4];return _0x5b8a51;};'use strict';var _=require(_0x4900('0x0'));var util=require(_0x4900('0x1'));var moment=require(_0x4900('0x2'));var BPromise=require(_0x4900('0x3'));var rs=require(_0x4900('0x4'));var fs=require('fs');var Redis=require(_0x4900('0x5'));var db=require(_0x4900('0x6'))['db'];var utils=require(_0x4900('0x7'));var logger=require(_0x4900('0x8'))(_0x4900('0x9'));var config=require(_0x4900('0xa'));var jayson=require(_0x4900('0xb'));var client=jayson[_0x4900('0xc')][_0x4900('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3513ed,_0x3e5fa0,_0x5cea88){return new BPromise(function(_0x477df7,_0x56ec3f){return client[_0x4900('0xe')](_0x3513ed,_0x5cea88)['then'](function(_0x3739a8){logger[_0x4900('0xf')]('SAProductPricesList,\x20%s,\x20%s',_0x3e5fa0,_0x4900('0x10'));logger[_0x4900('0x11')]('SAProductPricesList,\x20%s,\x20%s,\x20%s',_0x3e5fa0,_0x4900('0x10'),JSON[_0x4900('0x12')](_0x3739a8));if(_0x3739a8[_0x4900('0x13')]){if(_0x3739a8[_0x4900('0x13')]['code']===0x1f4){logger['error']('SAProductPricesList,\x20%s,\x20%s',_0x3e5fa0,_0x3739a8['error']['message']);return _0x56ec3f(_0x3739a8['error'][_0x4900('0x14')]);}logger[_0x4900('0x13')](_0x4900('0x15'),_0x3e5fa0,_0x3739a8['error'][_0x4900('0x14')]);return _0x477df7(_0x3739a8['error'][_0x4900('0x14')]);}else{logger['info'](_0x4900('0x15'),_0x3e5fa0,_0x4900('0x10'));_0x477df7(_0x3739a8['result'][_0x4900('0x14')]);}})['catch'](function(_0x470293){logger[_0x4900('0x13')](_0x4900('0x15'),_0x3e5fa0,_0x470293);_0x56ec3f(_0x470293);});});} \ No newline at end of file diff --git a/server/api/saProductQuotation/index.js b/server/api/saProductQuotation/index.js index a6f6ca2..e51765f 100644 --- a/server/api/saProductQuotation/index.js +++ b/server/api/saProductQuotation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da6=['isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/automaticInvoice','automaticInvoice','/:id/automaticProforma','automaticProforma','put','update','updateBulk','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0xe4a052,_0x499b47){var _0x26740a=function(_0x12fe06){while(--_0x12fe06){_0xe4a052['push'](_0xe4a052['shift']());}};_0x26740a(++_0x499b47);}(_0x2da6,0x1dd));var _0x62da=function(_0x545fbe,_0x1b5b08){_0x545fbe=_0x545fbe-0x0;var _0x5b6186=_0x2da6[_0x545fbe];return _0x5b6186;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var auth=require(_0x62da('0x6'));var interaction=require(_0x62da('0x7'));var config=require('../../config/environment');var controller=require('./saProductQuotation.controller');router[_0x62da('0x8')]('/',auth[_0x62da('0x9')](),controller[_0x62da('0xa')]);router[_0x62da('0x8')](_0x62da('0xb'),auth[_0x62da('0x9')](),controller[_0x62da('0xc')]);router[_0x62da('0x8')](_0x62da('0xd'),auth['isAuthenticated'](),controller[_0x62da('0xe')]);router[_0x62da('0xf')]('/',auth[_0x62da('0x9')](),controller[_0x62da('0x10')]);router['post'](_0x62da('0x11'),auth[_0x62da('0x9')](),controller[_0x62da('0x12')]);router[_0x62da('0xf')](_0x62da('0x13'),auth['isAuthenticated'](),controller[_0x62da('0x14')]);router[_0x62da('0x15')](_0x62da('0xd'),auth[_0x62da('0x9')](),controller[_0x62da('0x16')]);router['put']('/:id/updateBulk',auth[_0x62da('0x9')](),controller[_0x62da('0x17')]);router[_0x62da('0x18')](_0x62da('0xd'),auth[_0x62da('0x9')](),controller[_0x62da('0x19')]);module[_0x62da('0x1a')]=router; \ No newline at end of file +var _0xfbbb=['updateBulk','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','post','/:id/automaticInvoice','automaticInvoice','/:id/automaticProforma','automaticProforma','put','update'];(function(_0x3e948f,_0x19484d){var _0x4cc3de=function(_0x335e95){while(--_0x335e95){_0x3e948f['push'](_0x3e948f['shift']());}};_0x4cc3de(++_0x19484d);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x49e6b4,_0x2f453c){_0x49e6b4=_0x49e6b4-0x0;var _0x20c17f=_0xfbbb[_0x49e6b4];return _0x20c17f;};'use strict';var multer=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var path=require(_0xbfbb('0x2'));var timeout=require(_0xbfbb('0x3'));var express=require(_0xbfbb('0x4'));var router=express[_0xbfbb('0x5')]();var auth=require(_0xbfbb('0x6'));var interaction=require(_0xbfbb('0x7'));var config=require(_0xbfbb('0x8'));var controller=require('./saProductQuotation.controller');router['get']('/',auth[_0xbfbb('0x9')](),controller['index']);router[_0xbfbb('0xa')](_0xbfbb('0xb'),auth[_0xbfbb('0x9')](),controller['describe']);router[_0xbfbb('0xa')](_0xbfbb('0xc'),auth[_0xbfbb('0x9')](),controller[_0xbfbb('0xd')]);router[_0xbfbb('0xe')]('/',auth[_0xbfbb('0x9')](),controller['create']);router[_0xbfbb('0xe')](_0xbfbb('0xf'),auth[_0xbfbb('0x9')](),controller[_0xbfbb('0x10')]);router['post'](_0xbfbb('0x11'),auth[_0xbfbb('0x9')](),controller[_0xbfbb('0x12')]);router[_0xbfbb('0x13')](_0xbfbb('0xc'),auth[_0xbfbb('0x9')](),controller[_0xbfbb('0x14')]);router[_0xbfbb('0x13')]('/:id/updateBulk',auth[_0xbfbb('0x9')](),controller[_0xbfbb('0x15')]);router[_0xbfbb('0x16')](_0xbfbb('0xc'),auth[_0xbfbb('0x9')](),controller['destroy']);module[_0xbfbb('0x17')]=router; \ No newline at end of file diff --git a/server/api/saProductQuotation/saProductQuotation.attributes.js b/server/api/saProductQuotation/saProductQuotation.attributes.js index b847386..a79ad00 100644 --- a/server/api/saProductQuotation/saProductQuotation.attributes.js +++ b/server/api/saProductQuotation/saProductQuotation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f4=['exports','TEXT','STRING','compositeIndex_prodCode_QuotationID','DECIMAL','INTEGER','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DATE','sequelize'];(function(_0x13a688,_0x80c22c){var _0x19a153=function(_0x2ec5ec){while(--_0x2ec5ec){_0x13a688['push'](_0x13a688['shift']());}};_0x19a153(++_0x80c22c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x31f8d9,_0x4ce308){_0x31f8d9=_0x31f8d9-0x0;var _0x4aa542=_0xd4f4[_0x31f8d9];return _0x4aa542;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'productName':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'productCode':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![],'unique':_0x4d4f('0x4')},'productNetPrice':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4)},'productTax':{'type':Sequelize[_0x4d4f('0x6')]},'productDescription':{'type':Sequelize[_0x4d4f('0x2')](_0x4d4f('0x7'))+_0x4d4f('0x8')},'productQtyMin':{'type':Sequelize[_0x4d4f('0x6')],'allowNull':!![]},'pricelistName':{'type':Sequelize['TEXT']},'pricelistDiscount':{'type':Sequelize['DECIMAL'](0x6,0x3),'allowNull':![]},'productPricelistDiscount':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'productPricelistNetPrice':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4)},'netPrice':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4),'allowNull':![]},'quantity':{'type':Sequelize[_0x4d4f('0x6')],'allowNull':![]},'discount':{'type':Sequelize[_0x4d4f('0x5')](0x6,0x3),'allowNull':![]},'totalPrice':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4),'allowNull':![]},'tax':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4),'allowNull':![]},'totalDiscount':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4),'allowNull':![]},'totalTax':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0x4d4f('0x3')]},'note':{'type':Sequelize[_0x4d4f('0x2')]},'QuotationId':{'type':Sequelize[_0x4d4f('0x6')],'unique':_0x4d4f('0x4')},'totalPrice':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4)},'totalTax':{'type':Sequelize[_0x4d4f('0x5')](0xd,0x4)},'typeName':{'type':Sequelize[_0x4d4f('0x3')]},'TypeId':{'type':Sequelize[_0x4d4f('0x6')]},'unitName':{'type':Sequelize[_0x4d4f('0x3')]},'UnitId':{'type':Sequelize[_0x4d4f('0x6')]},'subscriptionName':{'type':Sequelize['STRING']},'subscriptionId':{'type':Sequelize['INTEGER']},'subscriptionMonthly':{'type':Sequelize['INTEGER']},'companyName':{'type':Sequelize[_0x4d4f('0x3')]},'companyId':{'type':Sequelize[_0x4d4f('0x6')]},'productAsset':{'type':Sequelize['BOOLEAN']},'deletedAt':{'type':Sequelize[_0x4d4f('0x9')],'unique':_0x4d4f('0x4')}}; \ No newline at end of file +var _0xb248=['STRING','compositeIndex_prodCode_QuotationID','DECIMAL','long','INTEGER','DATE','sequelize','TEXT'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0xb248,0xc6));var _0x8b24=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xb248[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0x8b24('0x0'));module['exports']={'productName':{'type':Sequelize[_0x8b24('0x1')],'allowNull':![]},'productCode':{'type':Sequelize[_0x8b24('0x2')],'allowNull':![],'unique':_0x8b24('0x3')},'productNetPrice':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4)},'productTax':{'type':Sequelize['INTEGER']},'productDescription':{'type':Sequelize[_0x8b24('0x1')](_0x8b24('0x5'))+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'},'productQtyMin':{'type':Sequelize[_0x8b24('0x6')],'allowNull':!![]},'pricelistName':{'type':Sequelize[_0x8b24('0x1')]},'pricelistDiscount':{'type':Sequelize['DECIMAL'](0x6,0x3),'allowNull':![]},'productPricelistDiscount':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4),'allowNull':![]},'productPricelistNetPrice':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4)},'netPrice':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'quantity':{'type':Sequelize[_0x8b24('0x6')],'allowNull':![]},'discount':{'type':Sequelize['DECIMAL'](0x6,0x3),'allowNull':![]},'totalPrice':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4),'allowNull':![]},'tax':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4),'allowNull':![]},'totalDiscount':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4),'allowNull':![]},'totalTax':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0x8b24('0x2')]},'note':{'type':Sequelize[_0x8b24('0x1')]},'QuotationId':{'type':Sequelize[_0x8b24('0x6')],'unique':_0x8b24('0x3')},'totalPrice':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4)},'totalTax':{'type':Sequelize[_0x8b24('0x4')](0xd,0x4)},'typeName':{'type':Sequelize[_0x8b24('0x2')]},'TypeId':{'type':Sequelize[_0x8b24('0x6')]},'unitName':{'type':Sequelize[_0x8b24('0x2')]},'UnitId':{'type':Sequelize[_0x8b24('0x6')]},'subscriptionName':{'type':Sequelize[_0x8b24('0x2')]},'subscriptionId':{'type':Sequelize[_0x8b24('0x6')]},'subscriptionMonthly':{'type':Sequelize[_0x8b24('0x6')]},'companyName':{'type':Sequelize[_0x8b24('0x2')]},'companyId':{'type':Sequelize['INTEGER']},'productAsset':{'type':Sequelize['BOOLEAN']},'deletedAt':{'type':Sequelize[_0x8b24('0x7')],'unique':_0x8b24('0x3')}}; \ No newline at end of file diff --git a/server/api/saProductQuotation/saProductQuotation.controller.js b/server/api/saProductQuotation/saProductQuotation.controller.js index 0518311..192a469 100644 --- a/server/api/saProductQuotation/saProductQuotation.controller.js +++ b/server/api/saProductQuotation/saProductQuotation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','SAProductQuotation','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','map','key','VIRTUAL','field','include','findAll','catch','show','params','length','includeAll','options','find','create','body','describe','ProformaId','InvoiceId','updateBulk','sequelize','companyName','companyId','productName','productCode','productDescription','pricelistName','ProductPriceListId','netPrice','discount','tax','agentFullname','note','subscriptionMonthly','unitName','SAInvoiceDetail','automaticInvoice','transaction','log','result','push','all','WARNING','TCL:\x20exports.automaticInvoice\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','subscriptionId','subscriptionName','SAProformaDetail','automaticProforma','SAProforma','TCL:\x20exports.automaticProforma\x20->\x20err','rimraf','zip-dir'];(function(_0x577fa5,_0x1989b4){var _0x3c36be=function(_0x3f0031){while(--_0x3f0031){_0x577fa5['push'](_0x577fa5['shift']());}};_0x3c36be(++_0x1989b4);}(_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 hardwareService=require(_0x3071('0x14'));var logger=require(_0x3071('0x15'))('api');var utils=require(_0x3071('0x16'));var config=require(_0x3071('0x17'));var db=require(_0x3071('0x18'))['db'];function respondWithStatusCode(_0x3ed4a0,_0xa0c1){_0xa0c1=_0xa0c1||0xcc;return function(_0x4a8cc7){if(_0x4a8cc7){return _0x3ed4a0['sendStatus'](_0xa0c1);}return _0x3ed4a0[_0x3071('0x19')](_0xa0c1)['end']();};}function respondWithResult(_0x31c220,_0x44fbae){_0x44fbae=_0x44fbae||0xc8;return function(_0x5d4883){if(_0x5d4883){return _0x31c220[_0x3071('0x19')](_0x44fbae)['json'](_0x5d4883);}};}function respondWithFilteredResult(_0x2fc15d,_0x45c93b){return function(_0x1271d0){if(_0x1271d0){var _0x1f14e1=_0x1271d0[_0x3071('0x1a')],_0x1caa5d=_0x45c93b[_0x3071('0x1b')],_0x2a6a4b=_0x45c93b[_0x3071('0x1b')]+_0x45c93b['limit'],_0x157a47;if(_0x2a6a4b>=_0x1f14e1){_0x2a6a4b=_0x1f14e1;_0x157a47=0xc8;}else{_0x157a47=0xce;}_0x2fc15d[_0x3071('0x19')](_0x157a47);return _0x2fc15d[_0x3071('0x1c')](_0x3071('0x1d'),_0x1caa5d+'-'+_0x2a6a4b+'/'+_0x1f14e1)[_0x3071('0x1e')](_0x1271d0);}return null;};}function patchUpdates(_0x3acf0e){return function(_0x17aee2){try{jsonpatch[_0x3071('0x1f')](_0x17aee2,_0x3acf0e,!![]);}catch(_0x26f113){return BPromise['reject'](_0x26f113);}return _0x17aee2[_0x3071('0x20')]();};}function saveUpdates(_0x2bfa33,_0xd3e23d){return function(_0x56c267){if(_0x56c267){return _0x56c267[_0x3071('0x21')](_0x2bfa33)['then'](function(_0x833074){return _0x833074;});}return null;};}function removeEntity(_0x43128c,_0x3762d8){return function(_0x457b57){if(_0x457b57){return _0x457b57[_0x3071('0x22')]()[_0x3071('0x23')](function(){_0x43128c[_0x3071('0x19')](0xcc)[_0x3071('0x24')]();});}};}function handleEntityNotFound(_0x542646,_0x481a51){return function(_0x2ce48a){if(!_0x2ce48a){_0x542646[_0x3071('0x25')](0x194);}return _0x2ce48a;};}function handleError(_0x412652,_0x13df9f){_0x13df9f=_0x13df9f||0x1f4;return function(_0x2793ef){logger[_0x3071('0x26')](_0x2793ef[_0x3071('0x27')]);if(_0x2793ef[_0x3071('0x28')]){delete _0x2793ef[_0x3071('0x28')];}_0x412652['status'](_0x13df9f)[_0x3071('0x29')](_0x2793ef);};}exports[_0x3071('0x2a')]=function(_0x177138,_0x4d5c4b){var _0x4fb1ca={'raw':!![]},_0x28792d={},_0x163604={'count':0x0,'rows':[]};var _0x950fde=db[_0x3071('0x2b')][_0x3071('0x2c')];_0x28792d[_0x3071('0x2d')]=_[_0x3071('0x2e')](_0x950fde);_0x28792d[_0x3071('0x2f')]=_[_0x3071('0x2e')](_0x177138[_0x3071('0x2f')]);_0x28792d['filters']=_['intersection'](_0x28792d[_0x3071('0x2d')],_0x28792d[_0x3071('0x2f')]);_0x4fb1ca[_0x3071('0x30')]=_[_0x3071('0x31')](_0x28792d[_0x3071('0x2d')],qs[_0x3071('0x32')](_0x177138[_0x3071('0x2f')][_0x3071('0x32')]));_0x4fb1ca['attributes']=_0x4fb1ca['attributes']['length']?_0x4fb1ca[_0x3071('0x30')]:_0x28792d[_0x3071('0x2d')];if(!_0x177138['query'][_0x3071('0x33')](_0x3071('0x34'))){_0x4fb1ca[_0x3071('0x35')]=qs[_0x3071('0x35')](_0x177138['query'][_0x3071('0x35')]);_0x4fb1ca[_0x3071('0x1b')]=qs[_0x3071('0x1b')](_0x177138[_0x3071('0x2f')][_0x3071('0x1b')]);}_0x4fb1ca[_0x3071('0x36')]=qs[_0x3071('0x37')](_0x177138[_0x3071('0x2f')]['sort']);_0x4fb1ca[_0x3071('0x38')]=qs['filters'](_['pick'](_0x177138[_0x3071('0x2f')],_0x28792d[_0x3071('0x39')]));if(_0x177138['query'][_0x3071('0x3a')]){_0x4fb1ca[_0x3071('0x38')]=_[_0x3071('0x3b')](_0x4fb1ca[_0x3071('0x38')],{'$or':_[_0x3071('0x3c')](_0x950fde,function(_0x232235){if(_0x232235['type'][_0x3071('0x3d')]!==_0x3071('0x3e')){var _0x4ce6d4={};_0x4ce6d4[_0x232235[_0x3071('0x3f')]]={'$like':'%'+_0x177138['query'][_0x3071('0x3a')]+'%'};return _0x4ce6d4;}})});}_0x4fb1ca=_[_0x3071('0x3b')]({},_0x4fb1ca,_0x177138['options']);var _0x593c99={'where':_0x4fb1ca[_0x3071('0x38')]};return db[_0x3071('0x2b')][_0x3071('0x1a')](_0x593c99)['then'](function(_0x4dea69){_0x163604['count']=_0x4dea69;if(_0x177138[_0x3071('0x2f')]['includeAll']){_0x4fb1ca[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x2b')][_0x3071('0x41')](_0x4fb1ca);})[_0x3071('0x23')](function(_0x30ab68){_0x163604['rows']=_0x30ab68;return _0x163604;})['then'](respondWithFilteredResult(_0x4d5c4b,_0x4fb1ca))[_0x3071('0x42')](handleError(_0x4d5c4b,null));};exports[_0x3071('0x43')]=function(_0x1455be,_0x1f69a6){var _0x525389={'raw':!![],'where':{'id':_0x1455be[_0x3071('0x44')]['id']}},_0x3cfc05={};_0x3cfc05[_0x3071('0x2d')]=_[_0x3071('0x2e')](db[_0x3071('0x2b')][_0x3071('0x2c')]);_0x3cfc05['query']=_[_0x3071('0x2e')](_0x1455be['query']);_0x3cfc05['filters']=_['intersection'](_0x3cfc05['model'],_0x3cfc05[_0x3071('0x2f')]);_0x525389[_0x3071('0x30')]=_[_0x3071('0x31')](_0x3cfc05[_0x3071('0x2d')],qs[_0x3071('0x32')](_0x1455be[_0x3071('0x2f')][_0x3071('0x32')]));_0x525389[_0x3071('0x30')]=_0x525389['attributes'][_0x3071('0x45')]?_0x525389[_0x3071('0x30')]:_0x3cfc05[_0x3071('0x2d')];if(_0x1455be[_0x3071('0x2f')][_0x3071('0x46')]){_0x525389['include']=[{'all':!![]}];}_0x525389=_['merge']({},_0x525389,_0x1455be[_0x3071('0x47')]);return db[_0x3071('0x2b')][_0x3071('0x48')](_0x525389)[_0x3071('0x23')](handleEntityNotFound(_0x1f69a6,null))[_0x3071('0x23')](respondWithResult(_0x1f69a6,null))['catch'](handleError(_0x1f69a6,null));};exports[_0x3071('0x49')]=function(_0x4a1d29,_0x18a773){return db['SAProductQuotation']['create'](_0x4a1d29[_0x3071('0x4a')],{})['then'](respondWithResult(_0x18a773,0xc9))[_0x3071('0x42')](handleError(_0x18a773,null));};exports['update']=function(_0x717c43,_0x1d75e5){if(_0x717c43[_0x3071('0x4a')]['id']){delete _0x717c43[_0x3071('0x4a')]['id'];}return db['SAProductQuotation'][_0x3071('0x48')]({'where':{'id':_0x717c43['params']['id']}})[_0x3071('0x23')](handleEntityNotFound(_0x1d75e5,null))['then'](saveUpdates(_0x717c43[_0x3071('0x4a')],null))[_0x3071('0x23')](respondWithResult(_0x1d75e5,null))['catch'](handleError(_0x1d75e5,null));};exports[_0x3071('0x22')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x2b')][_0x3071('0x48')]({'where':{'id':_0x117e73[_0x3071('0x44')]['id']}})[_0x3071('0x23')](handleEntityNotFound(_0x224a70,null))['then'](removeEntity(_0x224a70,null))[_0x3071('0x42')](handleError(_0x224a70,null));};exports[_0x3071('0x4b')]=function(_0x443b0e,_0xda07a4){return db['SAProductQuotation'][_0x3071('0x4b')]()[_0x3071('0x23')](respondWithResult(_0xda07a4,null))[_0x3071('0x42')](handleError(_0xda07a4,null));};function assignProductQuotationToProformaInvoice(_0x2307dd,_0x22aade){if(_0x2307dd[_0x3071('0x4a')]['id']){delete _0x2307dd[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2b')][_0x3071('0x21')]({'ProformaId':_0x2307dd[_0x3071('0x4a')][_0x3071('0x4c')],'InvoiceId':_0x2307dd[_0x3071('0x4a')][_0x3071('0x4d')]},{'where':{'QuotationId':_0x2307dd[_0x3071('0x44')]['id'],'ProformaId':_0x2307dd[_0x3071('0x2f')][_0x3071('0x4c')]||{'$eq':null},'InvoiceId':_0x2307dd['query']['InvoiceId']||{'$eq':null}},'transaction':_0x22aade});}exports[_0x3071('0x4e')]=function(_0x580c04,_0x403761,_0x198168){return db[_0x3071('0x4f')]['transaction'](function(_0x1ec428){return assignProductQuotationToProformaInvoice(_0x580c04,_0x1ec428)[_0x3071('0x23')](function(_0x5bc69e){return _0x403761['sendStatus'](0xc8);})[_0x3071('0x42')](handleError(_0x403761,null));});};function addInvoiceDetail(_0x15abc4,_0x30e9d5,_0x3206c3){var _0x49877e={'companyName':_0x15abc4[_0x3071('0x50')],'companyId':_0x15abc4[_0x3071('0x51')],'productName':_0x15abc4[_0x3071('0x52')],'productCode':_0x15abc4[_0x3071('0x53')],'productDescription':_0x15abc4[_0x3071('0x54')],'typeName':_0x15abc4['typeName'],'pricelistName':_0x15abc4[_0x3071('0x55')],'priceListId':_0x15abc4[_0x3071('0x56')],'netPrice':_0x15abc4[_0x3071('0x57')],'discount':_0x15abc4[_0x3071('0x58')],'tax':_0x15abc4[_0x3071('0x59')],'agentFullname':_0x15abc4[_0x3071('0x5a')],'note':_0x15abc4[_0x3071('0x5b')],'subscriptionId':_0x15abc4['subscriptionId'],'subscriptionName':_0x15abc4['subscriptionName'],'subscriptionMonthly':_0x15abc4[_0x3071('0x5c')],'quantity':_0x15abc4['quantity'],'InvoiceId':_0x30e9d5,'unitName':_0x15abc4[_0x3071('0x5d')]};return db[_0x3071('0x5e')]['create'](_0x49877e,{'transaction':_0x3206c3})[_0x3071('0x23')](function(){return db[_0x3071('0x2b')]['update']({'InvoiceId':_0x30e9d5},{'where':{'id':_0x15abc4['id']},'transaction':_0x3206c3});});}exports[_0x3071('0x5f')]=function(_0x1878e2,_0x180344,_0x6e96c7){if(_0x1878e2[_0x3071('0x4a')]['id']){delete _0x1878e2['body']['id'];}return db[_0x3071('0x4f')][_0x3071('0x60')](function(_0x19252f){return db['SAInvoice'][_0x3071('0x49')](_0x1878e2[_0x3071('0x4a')],{'transaction':_0x19252f})[_0x3071('0x23')](function(_0x25680e){console[_0x3071('0x61')](_0x3071('0x62'),_0x25680e);var _0xe93f28=_0x1878e2[_0x3071('0x44')]['id'];return db[_0x3071('0x2b')]['findAll']({'where':{'QuotationId':_0xe93f28,'productAsset':{'$ne':0x1},'ProformaId':{'$eq':null},'InvoiceId':{'$eq':null}},'raw':!![],'logging':console[_0x3071('0x61')]})[_0x3071('0x23')](function(_0x3bcf28){if(_0x3bcf28[_0x3071('0x45')]>0x0){var _0x466835=[];for(var _0x1543df=0x0;_0x1543df<_0x3bcf28[_0x3071('0x45')];_0x1543df++){_0x466835[_0x3071('0x63')](addInvoiceDetail(_0x3bcf28[_0x1543df],_0x25680e['id'],_0x19252f));}return BPromise[_0x3071('0x64')](_0x466835);}else{var _0x302680={'errors':[{'type':_0x3071('0x65'),'message':'No\x20product\x20to\x20assign\x20invoice.\x20Invoice\x20not\x20created!!'}]};throw _0x302680;}});});})[_0x3071('0x23')](function(){return _0x180344[_0x3071('0x25')](0xc8);})[_0x3071('0x42')](function(_0x3ed86c){console[_0x3071('0x61')](_0x3071('0x66'),_0x3ed86c);if(_0x3ed86c[_0x3071('0x28')]===_0x3071('0x67')){var _0x3ed86c={'errors':[{'message':_0x3071('0x68')}]};}_0x180344[_0x3071('0x19')](0x1f4)['send'](_0x3ed86c);});};function addProformaDetail(_0x5d362f,_0x147856,_0xadffac){var _0x3469c1={'companyName':_0x5d362f[_0x3071('0x50')],'companyId':_0x5d362f['companyId'],'productName':_0x5d362f['productName'],'productCode':_0x5d362f[_0x3071('0x53')],'productDescription':_0x5d362f['productDescription'],'typeName':_0x5d362f['typeName'],'pricelistName':_0x5d362f['pricelistName'],'priceListId':_0x5d362f['ProductPriceListId'],'netPrice':_0x5d362f[_0x3071('0x57')],'discount':_0x5d362f[_0x3071('0x58')],'tax':_0x5d362f[_0x3071('0x59')],'agentFullname':_0x5d362f['agentFullname'],'note':_0x5d362f[_0x3071('0x5b')],'subscriptionId':_0x5d362f[_0x3071('0x69')],'subscriptionName':_0x5d362f[_0x3071('0x6a')],'subscriptionMonthly':_0x5d362f[_0x3071('0x5c')],'quantity':_0x5d362f['quantity'],'ProformaId':_0x147856};return db[_0x3071('0x6b')][_0x3071('0x49')](_0x3469c1,{'transaction':_0xadffac})['then'](function(){return db[_0x3071('0x2b')][_0x3071('0x21')]({'ProformaId':_0x147856},{'where':{'id':_0x5d362f['id']},'transaction':_0xadffac});});}exports[_0x3071('0x6c')]=function(_0x40c258,_0x4edd23,_0x11ffdd){if(_0x40c258[_0x3071('0x4a')]['id']){delete _0x40c258['body']['id'];}return db['sequelize'][_0x3071('0x60')](function(_0x168025){return db[_0x3071('0x6d')]['create'](_0x40c258['body'],{'transaction':_0x168025})[_0x3071('0x23')](function(_0x3d91cf){console[_0x3071('0x61')](_0x3071('0x62'),_0x3d91cf);var _0x2f1935=_0x40c258[_0x3071('0x44')]['id'];return db[_0x3071('0x2b')][_0x3071('0x41')]({'where':{'QuotationId':_0x2f1935,'productAsset':{'$ne':0x1},'ProformaId':{'$eq':null},'InvoiceId':{'$eq':null}},'raw':!![],'logging':console['log']})[_0x3071('0x23')](function(_0x5ea33f){if(_0x5ea33f[_0x3071('0x45')]>0x0){var _0x36146c=[];for(var _0x1afa91=0x0;_0x1afa91<_0x5ea33f[_0x3071('0x45')];_0x1afa91++){_0x36146c[_0x3071('0x63')](addProformaDetail(_0x5ea33f[_0x1afa91],_0x3d91cf['id'],_0x168025));}return BPromise[_0x3071('0x64')](_0x36146c);}else{var _0x155542={'errors':[{'type':_0x3071('0x65'),'message':'No\x20product\x20to\x20assign\x20proforma.\x20Proforma\x20not\x20created!!'}]};throw _0x155542;}});});})[_0x3071('0x23')](function(){return _0x4edd23[_0x3071('0x25')](0xc8);})[_0x3071('0x42')](function(_0x4f06c0){console[_0x3071('0x61')](_0x3071('0x6e'),_0x4f06c0);if(_0x4f06c0[_0x3071('0x28')]==='SequelizeUniqueConstraintError'){var _0x4f06c0={'errors':[{'message':_0x3071('0x68')}]};}_0x4edd23['status'](0x1f4)[_0x3071('0x29')](_0x4f06c0);});}; \ No newline at end of file +var _0x757a=['result','findAll','log','push','all','WARNING','No\x20product\x20to\x20assign\x20invoice.\x20Invoice\x20not\x20created!!','TCL:\x20exports.automaticInvoice\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','send','companyName','companyId','subscriptionName','No\x20product\x20to\x20assign\x20proforma.\x20Proforma\x20not\x20created!!','TCL:\x20exports.automaticProforma\x20->\x20err','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','end','error','name','index','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','map','type','key','VIRTUAL','field','merge','options','SAProductQuotation','includeAll','include','catch','show','params','rawAttributes','create','body','find','describe','ProformaId','InvoiceId','updateBulk','sequelize','transaction','productCode','productDescription','typeName','pricelistName','ProductPriceListId','netPrice','tax','agentFullname','note','subscriptionId','subscriptionMonthly','quantity','SAInvoiceDetail'];(function(_0x1313e9,_0x265500){var _0x5866df=function(_0x2dd36b){while(--_0x2dd36b){_0x1313e9['push'](_0x1313e9['shift']());}};_0x5866df(++_0x265500);}(_0x757a,0xde));var _0xa757=function(_0x1629cd,_0x2fbcda){_0x1629cd=_0x1629cd-0x0;var _0x5e78f7=_0x757a[_0x1629cd];return _0x5e78f7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require(_0xa757('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5958c2,_0x56acfb){_0x56acfb=_0x56acfb||0xcc;return function(_0x4db68e){if(_0x4db68e){return _0x5958c2[_0xa757('0x16')](_0x56acfb);}return _0x5958c2['status'](_0x56acfb)['end']();};}function respondWithResult(_0x2ed0d2,_0x513b1f){_0x513b1f=_0x513b1f||0xc8;return function(_0x481508){if(_0x481508){return _0x2ed0d2[_0xa757('0x17')](_0x513b1f)[_0xa757('0x18')](_0x481508);}};}function respondWithFilteredResult(_0x355f0a,_0x4a0c38){return function(_0x86abd){if(_0x86abd){var _0x31cfd2=_0x86abd[_0xa757('0x19')],_0xf12b68=_0x4a0c38['offset'],_0x2f7947=_0x4a0c38[_0xa757('0x1a')]+_0x4a0c38[_0xa757('0x1b')],_0x185011;if(_0x2f7947>=_0x31cfd2){_0x2f7947=_0x31cfd2;_0x185011=0xc8;}else{_0x185011=0xce;}_0x355f0a[_0xa757('0x17')](_0x185011);return _0x355f0a['set']('Content-Range',_0xf12b68+'-'+_0x2f7947+'/'+_0x31cfd2)[_0xa757('0x18')](_0x86abd);}return null;};}function patchUpdates(_0x468d45){return function(_0x1bd14c){try{jsonpatch[_0xa757('0x1c')](_0x1bd14c,_0x468d45,!![]);}catch(_0x27f4ba){return BPromise[_0xa757('0x1d')](_0x27f4ba);}return _0x1bd14c['save']();};}function saveUpdates(_0x58954,_0x4fec52){return function(_0x32c2a1){if(_0x32c2a1){return _0x32c2a1[_0xa757('0x1e')](_0x58954)[_0xa757('0x1f')](function(_0x2c9ec6){return _0x2c9ec6;});}return null;};}function removeEntity(_0x4d598c,_0x5638c7){return function(_0x40ec48){if(_0x40ec48){return _0x40ec48[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x4d598c[_0xa757('0x17')](0xcc)[_0xa757('0x21')]();});}};}function handleEntityNotFound(_0x40562f,_0x2ca10d){return function(_0x21f1af){if(!_0x21f1af){_0x40562f[_0xa757('0x16')](0x194);}return _0x21f1af;};}function handleError(_0x59fae6,_0x3707c1){_0x3707c1=_0x3707c1||0x1f4;return function(_0x59e9d4){logger[_0xa757('0x22')](_0x59e9d4['stack']);if(_0x59e9d4[_0xa757('0x23')]){delete _0x59e9d4[_0xa757('0x23')];}_0x59fae6[_0xa757('0x17')](_0x3707c1)['send'](_0x59e9d4);};}exports[_0xa757('0x24')]=function(_0xcd98bd,_0x471e84){var _0x3bf7f3={'raw':!![]},_0x5b4779={},_0x449a7d={'count':0x0,'rows':[]};var _0x54263b=db['SAProductQuotation']['rawAttributes'];_0x5b4779['model']=_[_0xa757('0x25')](_0x54263b);_0x5b4779['query']=_[_0xa757('0x25')](_0xcd98bd[_0xa757('0x26')]);_0x5b4779['filters']=_[_0xa757('0x27')](_0x5b4779['model'],_0x5b4779[_0xa757('0x26')]);_0x3bf7f3[_0xa757('0x28')]=_['intersection'](_0x5b4779[_0xa757('0x29')],qs['fields'](_0xcd98bd[_0xa757('0x26')][_0xa757('0x2a')]));_0x3bf7f3[_0xa757('0x28')]=_0x3bf7f3[_0xa757('0x28')][_0xa757('0x2b')]?_0x3bf7f3[_0xa757('0x28')]:_0x5b4779[_0xa757('0x29')];if(!_0xcd98bd[_0xa757('0x26')][_0xa757('0x2c')](_0xa757('0x2d'))){_0x3bf7f3[_0xa757('0x1b')]=qs[_0xa757('0x1b')](_0xcd98bd[_0xa757('0x26')][_0xa757('0x1b')]);_0x3bf7f3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0xcd98bd[_0xa757('0x26')][_0xa757('0x1a')]);}_0x3bf7f3[_0xa757('0x2e')]=qs[_0xa757('0x2f')](_0xcd98bd[_0xa757('0x26')][_0xa757('0x2f')]);_0x3bf7f3[_0xa757('0x30')]=qs[_0xa757('0x31')](_['pick'](_0xcd98bd[_0xa757('0x26')],_0x5b4779[_0xa757('0x31')]));if(_0xcd98bd[_0xa757('0x26')][_0xa757('0x32')]){_0x3bf7f3[_0xa757('0x30')]=_['merge'](_0x3bf7f3[_0xa757('0x30')],{'$or':_[_0xa757('0x33')](_0x54263b,function(_0x37b1a3){if(_0x37b1a3[_0xa757('0x34')][_0xa757('0x35')]!==_0xa757('0x36')){var _0x499390={};_0x499390[_0x37b1a3[_0xa757('0x37')]]={'$like':'%'+_0xcd98bd[_0xa757('0x26')][_0xa757('0x32')]+'%'};return _0x499390;}})});}_0x3bf7f3=_[_0xa757('0x38')]({},_0x3bf7f3,_0xcd98bd[_0xa757('0x39')]);var _0x111cfe={'where':_0x3bf7f3[_0xa757('0x30')]};return db[_0xa757('0x3a')][_0xa757('0x19')](_0x111cfe)['then'](function(_0x300be4){_0x449a7d[_0xa757('0x19')]=_0x300be4;if(_0xcd98bd[_0xa757('0x26')][_0xa757('0x3b')]){_0x3bf7f3[_0xa757('0x3c')]=[{'all':!![]}];}return db[_0xa757('0x3a')]['findAll'](_0x3bf7f3);})[_0xa757('0x1f')](function(_0x6d77ed){_0x449a7d['rows']=_0x6d77ed;return _0x449a7d;})['then'](respondWithFilteredResult(_0x471e84,_0x3bf7f3))[_0xa757('0x3d')](handleError(_0x471e84,null));};exports[_0xa757('0x3e')]=function(_0x5b11fe,_0x51c3d1){var _0xcff7c4={'raw':!![],'where':{'id':_0x5b11fe[_0xa757('0x3f')]['id']}},_0x1725a2={};_0x1725a2['model']=_[_0xa757('0x25')](db[_0xa757('0x3a')][_0xa757('0x40')]);_0x1725a2[_0xa757('0x26')]=_[_0xa757('0x25')](_0x5b11fe['query']);_0x1725a2[_0xa757('0x31')]=_['intersection'](_0x1725a2['model'],_0x1725a2[_0xa757('0x26')]);_0xcff7c4[_0xa757('0x28')]=_[_0xa757('0x27')](_0x1725a2[_0xa757('0x29')],qs[_0xa757('0x2a')](_0x5b11fe['query']['fields']));_0xcff7c4[_0xa757('0x28')]=_0xcff7c4[_0xa757('0x28')][_0xa757('0x2b')]?_0xcff7c4[_0xa757('0x28')]:_0x1725a2[_0xa757('0x29')];if(_0x5b11fe[_0xa757('0x26')]['includeAll']){_0xcff7c4[_0xa757('0x3c')]=[{'all':!![]}];}_0xcff7c4=_[_0xa757('0x38')]({},_0xcff7c4,_0x5b11fe['options']);return db[_0xa757('0x3a')]['find'](_0xcff7c4)[_0xa757('0x1f')](handleEntityNotFound(_0x51c3d1,null))[_0xa757('0x1f')](respondWithResult(_0x51c3d1,null))['catch'](handleError(_0x51c3d1,null));};exports[_0xa757('0x41')]=function(_0x23efad,_0x4bee69){return db[_0xa757('0x3a')][_0xa757('0x41')](_0x23efad[_0xa757('0x42')],{})[_0xa757('0x1f')](respondWithResult(_0x4bee69,0xc9))['catch'](handleError(_0x4bee69,null));};exports[_0xa757('0x1e')]=function(_0x1be3bb,_0x450815){if(_0x1be3bb[_0xa757('0x42')]['id']){delete _0x1be3bb['body']['id'];}return db[_0xa757('0x3a')]['find']({'where':{'id':_0x1be3bb['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x450815,null))[_0xa757('0x1f')](saveUpdates(_0x1be3bb[_0xa757('0x42')],null))['then'](respondWithResult(_0x450815,null))[_0xa757('0x3d')](handleError(_0x450815,null));};exports['destroy']=function(_0x2ed63f,_0x151cc3){return db[_0xa757('0x3a')][_0xa757('0x43')]({'where':{'id':_0x2ed63f[_0xa757('0x3f')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x151cc3,null))[_0xa757('0x1f')](removeEntity(_0x151cc3,null))[_0xa757('0x3d')](handleError(_0x151cc3,null));};exports['describe']=function(_0x2de226,_0x7411a3){return db[_0xa757('0x3a')][_0xa757('0x44')]()[_0xa757('0x1f')](respondWithResult(_0x7411a3,null))[_0xa757('0x3d')](handleError(_0x7411a3,null));};function assignProductQuotationToProformaInvoice(_0x15bad7,_0x2c5b3c){if(_0x15bad7[_0xa757('0x42')]['id']){delete _0x15bad7[_0xa757('0x42')]['id'];}return db[_0xa757('0x3a')][_0xa757('0x1e')]({'ProformaId':_0x15bad7[_0xa757('0x42')][_0xa757('0x45')],'InvoiceId':_0x15bad7[_0xa757('0x42')][_0xa757('0x46')]},{'where':{'QuotationId':_0x15bad7['params']['id'],'ProformaId':_0x15bad7[_0xa757('0x26')]['ProformaId']||{'$eq':null},'InvoiceId':_0x15bad7[_0xa757('0x26')][_0xa757('0x46')]||{'$eq':null}},'transaction':_0x2c5b3c});}exports[_0xa757('0x47')]=function(_0x24c0ad,_0x4cb461,_0x35cd81){return db[_0xa757('0x48')][_0xa757('0x49')](function(_0x980e1){return assignProductQuotationToProformaInvoice(_0x24c0ad,_0x980e1)['then'](function(_0x383674){return _0x4cb461[_0xa757('0x16')](0xc8);})[_0xa757('0x3d')](handleError(_0x4cb461,null));});};function addInvoiceDetail(_0x1c9f1e,_0x33666d,_0x291b26){var _0x55ad28={'companyName':_0x1c9f1e['companyName'],'companyId':_0x1c9f1e['companyId'],'productName':_0x1c9f1e['productName'],'productCode':_0x1c9f1e[_0xa757('0x4a')],'productDescription':_0x1c9f1e[_0xa757('0x4b')],'typeName':_0x1c9f1e[_0xa757('0x4c')],'pricelistName':_0x1c9f1e[_0xa757('0x4d')],'priceListId':_0x1c9f1e[_0xa757('0x4e')],'netPrice':_0x1c9f1e[_0xa757('0x4f')],'discount':_0x1c9f1e['discount'],'tax':_0x1c9f1e[_0xa757('0x50')],'agentFullname':_0x1c9f1e[_0xa757('0x51')],'note':_0x1c9f1e[_0xa757('0x52')],'subscriptionId':_0x1c9f1e[_0xa757('0x53')],'subscriptionName':_0x1c9f1e['subscriptionName'],'subscriptionMonthly':_0x1c9f1e[_0xa757('0x54')],'quantity':_0x1c9f1e[_0xa757('0x55')],'InvoiceId':_0x33666d,'unitName':_0x1c9f1e['unitName']};return db[_0xa757('0x56')]['create'](_0x55ad28,{'transaction':_0x291b26})[_0xa757('0x1f')](function(){return db['SAProductQuotation'][_0xa757('0x1e')]({'InvoiceId':_0x33666d},{'where':{'id':_0x1c9f1e['id']},'transaction':_0x291b26});});}exports['automaticInvoice']=function(_0x4badee,_0x367b48,_0x235c1e){if(_0x4badee[_0xa757('0x42')]['id']){delete _0x4badee[_0xa757('0x42')]['id'];}return db[_0xa757('0x48')][_0xa757('0x49')](function(_0x4c19a6){return db['SAInvoice'][_0xa757('0x41')](_0x4badee[_0xa757('0x42')],{'transaction':_0x4c19a6})[_0xa757('0x1f')](function(_0x4a5ad5){console['log'](_0xa757('0x57'),_0x4a5ad5);var _0x31c4cd=_0x4badee[_0xa757('0x3f')]['id'];return db[_0xa757('0x3a')][_0xa757('0x58')]({'where':{'QuotationId':_0x31c4cd,'productAsset':{'$ne':0x1},'ProformaId':{'$eq':null},'InvoiceId':{'$eq':null}},'raw':!![],'logging':console[_0xa757('0x59')]})['then'](function(_0x466728){if(_0x466728[_0xa757('0x2b')]>0x0){var _0x415fe1=[];for(var _0x24845a=0x0;_0x24845a<_0x466728[_0xa757('0x2b')];_0x24845a++){_0x415fe1[_0xa757('0x5a')](addInvoiceDetail(_0x466728[_0x24845a],_0x4a5ad5['id'],_0x4c19a6));}return BPromise[_0xa757('0x5b')](_0x415fe1);}else{var _0x13dd81={'errors':[{'type':_0xa757('0x5c'),'message':_0xa757('0x5d')}]};throw _0x13dd81;}});});})['then'](function(){return _0x367b48[_0xa757('0x16')](0xc8);})['catch'](function(_0x5851fd){console[_0xa757('0x59')](_0xa757('0x5e'),_0x5851fd);if(_0x5851fd[_0xa757('0x23')]===_0xa757('0x5f')){var _0x5851fd={'errors':[{'message':_0xa757('0x60')}]};}_0x367b48[_0xa757('0x17')](0x1f4)[_0xa757('0x61')](_0x5851fd);});};function addProformaDetail(_0x13e584,_0x22a185,_0x42f2c0){var _0x4fc507={'companyName':_0x13e584[_0xa757('0x62')],'companyId':_0x13e584[_0xa757('0x63')],'productName':_0x13e584['productName'],'productCode':_0x13e584[_0xa757('0x4a')],'productDescription':_0x13e584[_0xa757('0x4b')],'typeName':_0x13e584[_0xa757('0x4c')],'pricelistName':_0x13e584[_0xa757('0x4d')],'priceListId':_0x13e584[_0xa757('0x4e')],'netPrice':_0x13e584[_0xa757('0x4f')],'discount':_0x13e584['discount'],'tax':_0x13e584[_0xa757('0x50')],'agentFullname':_0x13e584['agentFullname'],'note':_0x13e584[_0xa757('0x52')],'subscriptionId':_0x13e584[_0xa757('0x53')],'subscriptionName':_0x13e584[_0xa757('0x64')],'subscriptionMonthly':_0x13e584[_0xa757('0x54')],'quantity':_0x13e584[_0xa757('0x55')],'ProformaId':_0x22a185};return db['SAProformaDetail']['create'](_0x4fc507,{'transaction':_0x42f2c0})[_0xa757('0x1f')](function(){return db[_0xa757('0x3a')][_0xa757('0x1e')]({'ProformaId':_0x22a185},{'where':{'id':_0x13e584['id']},'transaction':_0x42f2c0});});}exports['automaticProforma']=function(_0x115a94,_0x55bc0f,_0x34982a){if(_0x115a94[_0xa757('0x42')]['id']){delete _0x115a94[_0xa757('0x42')]['id'];}return db[_0xa757('0x48')][_0xa757('0x49')](function(_0x40a79b){return db['SAProforma'][_0xa757('0x41')](_0x115a94[_0xa757('0x42')],{'transaction':_0x40a79b})[_0xa757('0x1f')](function(_0x125bda){console[_0xa757('0x59')]('result',_0x125bda);var _0x2586f9=_0x115a94[_0xa757('0x3f')]['id'];return db[_0xa757('0x3a')][_0xa757('0x58')]({'where':{'QuotationId':_0x2586f9,'productAsset':{'$ne':0x1},'ProformaId':{'$eq':null},'InvoiceId':{'$eq':null}},'raw':!![],'logging':console[_0xa757('0x59')]})['then'](function(_0x3f1327){if(_0x3f1327[_0xa757('0x2b')]>0x0){var _0x41490d=[];for(var _0x529298=0x0;_0x529298<_0x3f1327[_0xa757('0x2b')];_0x529298++){_0x41490d[_0xa757('0x5a')](addProformaDetail(_0x3f1327[_0x529298],_0x125bda['id'],_0x40a79b));}return BPromise[_0xa757('0x5b')](_0x41490d);}else{var _0x60f518={'errors':[{'type':_0xa757('0x5c'),'message':_0xa757('0x65')}]};throw _0x60f518;}});});})[_0xa757('0x1f')](function(){return _0x55bc0f[_0xa757('0x16')](0xc8);})[_0xa757('0x3d')](function(_0x95100a){console[_0xa757('0x59')](_0xa757('0x66'),_0x95100a);if(_0x95100a[_0xa757('0x23')]===_0xa757('0x5f')){var _0x95100a={'errors':[{'message':_0xa757('0x60')}]};}_0x55bc0f[_0xa757('0x17')](0x1f4)['send'](_0x95100a);});}; \ No newline at end of file diff --git a/server/api/saProductQuotation/saProductQuotation.model.js b/server/api/saProductQuotation/saProductQuotation.model.js index 6c0ce2d..a63f20d 100644 --- a/server/api/saProductQuotation/saProductQuotation.model.js +++ b/server/api/saProductQuotation/saProductQuotation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x362b=['exports','SAProductQuotation','sa_product_has_quotation','util','api','moment','bluebird','request-promise','path'];(function(_0x5ddcc2,_0x130b3d){var _0x317912=function(_0x314efa){while(--_0x314efa){_0x5ddcc2['push'](_0x5ddcc2['shift']());}};_0x317912(++_0x130b3d);}(_0x362b,0x66));var _0xb362=function(_0x1c3915,_0x374501){_0x1c3915=_0x1c3915-0x0;var _0xfc4110=_0x362b[_0x1c3915];return _0xfc4110;};'use strict';var _=require('lodash');var util=require(_0xb362('0x0'));var logger=require('../../config/logger')(_0xb362('0x1'));var moment=require(_0xb362('0x2'));var BPromise=require(_0xb362('0x3'));var rp=require(_0xb362('0x4'));var fs=require('fs');var path=require(_0xb362('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./saProductQuotation.attributes');module[_0xb362('0x6')]=function(_0x507719,_0x34abbb){return _0x507719['define'](_0xb362('0x7'),attributes,{'tableName':_0xb362('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8efa=['./saProductQuotation.attributes','exports','define','sa_product_has_quotation','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5a7b65,_0x5b8639){var _0x13cb3c=function(_0xfc5d34){while(--_0xfc5d34){_0x5a7b65['push'](_0x5a7b65['shift']());}};_0x13cb3c(++_0x5b8639);}(_0x8efa,0x67));var _0xa8ef=function(_0x5b364e,_0x62bdc1){_0x5b364e=_0x5b364e-0x0;var _0x3041a0=_0x8efa[_0x5b364e];return _0x3041a0;};'use strict';var _=require(_0xa8ef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8ef('0x1'));var moment=require(_0xa8ef('0x2'));var BPromise=require(_0xa8ef('0x3'));var rp=require(_0xa8ef('0x4'));var fs=require('fs');var path=require(_0xa8ef('0x5'));var rimraf=require('rimraf');var config=require(_0xa8ef('0x6'));var attributes=require(_0xa8ef('0x7'));module[_0xa8ef('0x8')]=function(_0x336ab6,_0x28b8c7){return _0x336ab6[_0xa8ef('0x9')]('SAProductQuotation',attributes,{'tableName':_0xa8ef('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saProductQuotation/saProductQuotation.rpc.js b/server/api/saProductQuotation/saProductQuotation.rpc.js index 8696c58..c85159f 100644 --- a/server/api/saProductQuotation/saProductQuotation.rpc.js +++ b/server/api/saProductQuotation/saProductQuotation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ec=['../../config/logger','rpc','../../config/environment','client','http','then','SAProductQuotation,\x20%s,\x20%s','request\x20sent','debug','SAProductQuotation,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d65a4,_0x44e282){var _0x28c091=function(_0x2c7138){while(--_0x2c7138){_0x5d65a4['push'](_0x5d65a4['shift']());}};_0x28c091(++_0x44e282);}(_0x71ec,0x15a));var _0xc71e=function(_0x462b3a,_0x52fa71){_0x462b3a=_0x462b3a-0x0;var _0xbc5daa=_0x71ec[_0x462b3a];return _0xbc5daa;};'use strict';var _=require('lodash');var util=require(_0xc71e('0x0'));var moment=require('moment');var BPromise=require(_0xc71e('0x1'));var rs=require(_0xc71e('0x2'));var fs=require('fs');var Redis=require(_0xc71e('0x3'));var db=require(_0xc71e('0x4'))['db'];var utils=require(_0xc71e('0x5'));var logger=require(_0xc71e('0x6'))(_0xc71e('0x7'));var config=require(_0xc71e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc71e('0x9')][_0xc71e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4839ea,_0x30101c,_0x4f6e86){return new BPromise(function(_0x49f015,_0x4b9b0b){return client['request'](_0x4839ea,_0x4f6e86)[_0xc71e('0xb')](function(_0x4c3fab){logger['info'](_0xc71e('0xc'),_0x30101c,_0xc71e('0xd'));logger[_0xc71e('0xe')](_0xc71e('0xf'),_0x30101c,_0xc71e('0xd'),JSON[_0xc71e('0x10')](_0x4c3fab));if(_0x4c3fab[_0xc71e('0x11')]){if(_0x4c3fab[_0xc71e('0x11')]['code']===0x1f4){logger[_0xc71e('0x11')]('SAProductQuotation,\x20%s,\x20%s',_0x30101c,_0x4c3fab[_0xc71e('0x11')][_0xc71e('0x12')]);return _0x4b9b0b(_0x4c3fab[_0xc71e('0x11')][_0xc71e('0x12')]);}logger[_0xc71e('0x11')]('SAProductQuotation,\x20%s,\x20%s',_0x30101c,_0x4c3fab['error'][_0xc71e('0x12')]);return _0x49f015(_0x4c3fab[_0xc71e('0x11')][_0xc71e('0x12')]);}else{logger[_0xc71e('0x13')](_0xc71e('0xc'),_0x30101c,_0xc71e('0xd'));_0x49f015(_0x4c3fab[_0xc71e('0x14')][_0xc71e('0x12')]);}})[_0xc71e('0x15')](function(_0x2fa34c){logger['error'](_0xc71e('0xc'),_0x30101c,_0x2fa34c);_0x4b9b0b(_0x2fa34c);});});} \ No newline at end of file +var _0x96ba=['client','http','request','then','info','SAProductQuotation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96ba,0xfe));var _0xa96b=function(_0x55d893,_0x325ebe){_0x55d893=_0x55d893-0x0;var _0x52d152=_0x96ba[_0x55d893];return _0x52d152;};'use strict';var _=require(_0xa96b('0x0'));var util=require(_0xa96b('0x1'));var moment=require(_0xa96b('0x2'));var BPromise=require(_0xa96b('0x3'));var rs=require(_0xa96b('0x4'));var fs=require('fs');var Redis=require(_0xa96b('0x5'));var db=require(_0xa96b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa96b('0x7'))(_0xa96b('0x8'));var config=require(_0xa96b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa96b('0xa')][_0xa96b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49cd5d,_0x35c2f8,_0x29d1d3){return new BPromise(function(_0x3496e9,_0x4a3a09){return client[_0xa96b('0xc')](_0x49cd5d,_0x29d1d3)[_0xa96b('0xd')](function(_0x32e575){logger[_0xa96b('0xe')](_0xa96b('0xf'),_0x35c2f8,'request\x20sent');logger[_0xa96b('0x10')]('SAProductQuotation,\x20%s,\x20%s,\x20%s',_0x35c2f8,_0xa96b('0x11'),JSON[_0xa96b('0x12')](_0x32e575));if(_0x32e575[_0xa96b('0x13')]){if(_0x32e575[_0xa96b('0x13')][_0xa96b('0x14')]===0x1f4){logger['error']('SAProductQuotation,\x20%s,\x20%s',_0x35c2f8,_0x32e575[_0xa96b('0x13')][_0xa96b('0x15')]);return _0x4a3a09(_0x32e575[_0xa96b('0x13')][_0xa96b('0x15')]);}logger[_0xa96b('0x13')](_0xa96b('0xf'),_0x35c2f8,_0x32e575[_0xa96b('0x13')][_0xa96b('0x15')]);return _0x3496e9(_0x32e575[_0xa96b('0x13')][_0xa96b('0x15')]);}else{logger['info']('SAProductQuotation,\x20%s,\x20%s',_0x35c2f8,'request\x20sent');_0x3496e9(_0x32e575['result'][_0xa96b('0x15')]);}})['catch'](function(_0x25fff4){logger[_0xa96b('0x13')](_0xa96b('0xf'),_0x35c2f8,_0x25fff4);_0x4a3a09(_0x25fff4);});});} \ No newline at end of file diff --git a/server/api/saProforma/index.js b/server/api/saProforma/index.js index f572f73..572da53 100644 --- a/server/api/saProforma/index.js +++ b/server/api/saProforma/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8581=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./saProforma.controller','get','index','isAuthenticated','describe','/:id','getProformaPDF','create','post','/:id/cloneProforma','update','delete','destroy','multer','util'];(function(_0x3c98c1,_0x524e3c){var _0x45c21b=function(_0x1f8dd0){while(--_0x1f8dd0){_0x3c98c1['push'](_0x3c98c1['shift']());}};_0x45c21b(++_0x524e3c);}(_0x8581,0x163));var _0x1858=function(_0x3509b9,_0x38bb75){_0x3509b9=_0x3509b9-0x0;var _0x11704f=_0x8581[_0x3509b9];return _0x11704f;};'use strict';var multer=require(_0x1858('0x0'));var util=require(_0x1858('0x1'));var path=require(_0x1858('0x2'));var timeout=require(_0x1858('0x3'));var express=require(_0x1858('0x4'));var router=express[_0x1858('0x5')]();var auth=require(_0x1858('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1858('0x7'));var controller=require(_0x1858('0x8'));router[_0x1858('0x9')]('/',auth['isAuthenticated'](),controller[_0x1858('0xa')]);router[_0x1858('0x9')]('/describe',auth[_0x1858('0xb')](),controller[_0x1858('0xc')]);router[_0x1858('0x9')](_0x1858('0xd'),auth[_0x1858('0xb')](),controller['show']);router[_0x1858('0x9')]('/:id/download',auth[_0x1858('0xb')](),controller[_0x1858('0xe')]);router['post']('/',auth[_0x1858('0xb')](),controller[_0x1858('0xf')]);router[_0x1858('0x10')](_0x1858('0x11'),auth['isAuthenticated'](),controller['cloneProforma']);router['put'](_0x1858('0xd'),auth['isAuthenticated'](),controller[_0x1858('0x12')]);router[_0x1858('0x13')](_0x1858('0xd'),auth[_0x1858('0xb')](),controller[_0x1858('0x14')]);module['exports']=router; \ No newline at end of file +var _0x72f9=['/:id','show','/:id/download','getProformaPDF','post','create','/:id/cloneProforma','cloneProforma','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./saProforma.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0x72f9,0x144));var _0x972f=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x72f9[_0x5eaa0b];return _0x28b295;};'use strict';var multer=require(_0x972f('0x0'));var util=require('util');var path=require(_0x972f('0x1'));var timeout=require(_0x972f('0x2'));var express=require('express');var router=express[_0x972f('0x3')]();var auth=require(_0x972f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x972f('0x5'));var controller=require(_0x972f('0x6'));router[_0x972f('0x7')]('/',auth['isAuthenticated'](),controller[_0x972f('0x8')]);router[_0x972f('0x7')](_0x972f('0x9'),auth[_0x972f('0xa')](),controller[_0x972f('0xb')]);router[_0x972f('0x7')](_0x972f('0xc'),auth['isAuthenticated'](),controller[_0x972f('0xd')]);router[_0x972f('0x7')](_0x972f('0xe'),auth[_0x972f('0xa')](),controller[_0x972f('0xf')]);router[_0x972f('0x10')]('/',auth['isAuthenticated'](),controller[_0x972f('0x11')]);router[_0x972f('0x10')](_0x972f('0x12'),auth[_0x972f('0xa')](),controller[_0x972f('0x13')]);router[_0x972f('0x14')](_0x972f('0xc'),auth[_0x972f('0xa')](),controller[_0x972f('0x15')]);router['delete'](_0x972f('0xc'),auth[_0x972f('0xa')](),controller[_0x972f('0x16')]);module[_0x972f('0x17')]=router; \ No newline at end of file diff --git a/server/api/saProforma/saProforma.attributes.js b/server/api/saProforma/saProforma.attributes.js index 7972d28..6e32400 100644 --- a/server/api/saProforma/saProforma.attributes.js +++ b/server/api/saProforma/saProforma.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4019=['sequelize','exports','STRING','TEXT','BOOLEAN','INTEGER','DATE'];(function(_0xa9db74,_0x45e441){var _0x3c8d7a=function(_0x42607a){while(--_0x42607a){_0xa9db74['push'](_0xa9db74['shift']());}};_0x3c8d7a(++_0x45e441);}(_0x4019,0xfc));var _0x9401=function(_0x5cb48d,_0x1b9f1c){_0x5cb48d=_0x5cb48d-0x0;var _0x577a84=_0x4019[_0x5cb48d];return _0x577a84;};'use strict';var Sequelize=require(_0x9401('0x0'));module[_0x9401('0x1')]={'name':{'type':Sequelize[_0x9401('0x2')]},'note':{'type':Sequelize[_0x9401('0x3')]},'agentFullname':{'type':Sequelize[_0x9401('0x2')]},'status':{'type':Sequelize[_0x9401('0x3')]},'companyName':{'type':Sequelize['STRING'],'allowNull':![]},'companyId':{'type':Sequelize['INTEGER'],'allowNull':![]},'authorized':{'type':Sequelize[_0x9401('0x4')]},'clientCode':{'type':Sequelize['STRING']},'discount':{'type':Sequelize['DECIMAL'](0xd,0x4)},'paid':{'type':Sequelize[_0x9401('0x5')],'defaultValue':0x0},'receivingStreet':{'type':Sequelize['STRING']},'receivingPostalCode':{'type':Sequelize[_0x9401('0x2')]},'receivingCity':{'type':Sequelize['STRING']},'receivingCountry':{'type':Sequelize[_0x9401('0x2')]},'receivingISOCode':{'type':Sequelize[_0x9401('0x2')](0x3)},'receivingFiscalCode':{'type':Sequelize[_0x9401('0x2')](0x32)},'receivingPIVA':{'type':Sequelize[_0x9401('0x2')](0x32)},'receivingSDICode':{'type':Sequelize['STRING'](0x15)},'receivingFiscalMessage':{'type':Sequelize[_0x9401('0x2')]},'receivingExpiryDay':{'type':Sequelize[_0x9401('0x5')]},'receivingEurope':{'type':Sequelize[_0x9401('0x4')]},'receivingSocCap':{'type':Sequelize[_0x9401('0x2')](0xff)},'issuerName':{'type':Sequelize[_0x9401('0x2')]},'issuerStreet':{'type':Sequelize['STRING']},'issuerPostalCode':{'type':Sequelize[_0x9401('0x2')]},'issuerCity':{'type':Sequelize[_0x9401('0x2')]},'issuerCountry':{'type':Sequelize['STRING']},'issuerISOCode':{'type':Sequelize[_0x9401('0x2')](0x3)},'issuerFiscalCode':{'type':Sequelize[_0x9401('0x2')](0x32)},'issuerPIVA':{'type':Sequelize[_0x9401('0x2')](0x32)},'issuerSDICode':{'type':Sequelize[_0x9401('0x2')](0x15)},'issuerFiscalMessage':{'type':Sequelize[_0x9401('0x2')](0x3e8)},'issuerExpiryDay':{'type':Sequelize[_0x9401('0x5')]},'issuerEurope':{'type':Sequelize['BOOLEAN']},'issuerSocCap':{'type':Sequelize['STRING'](0xff)},'issuerBankAccount':{'type':Sequelize[_0x9401('0x2')](0xff)},'issuerBankName':{'type':Sequelize[_0x9401('0x2')](0xff)},'issuerBankStreet':{'type':Sequelize[_0x9401('0x2')]},'issuerBankPostalCode':{'type':Sequelize[_0x9401('0x2')]},'issuerBankCity':{'type':Sequelize[_0x9401('0x2')]},'issuerBankCountry':{'type':Sequelize['STRING']},'issuerBankBICSWIFT':{'type':Sequelize['STRING']},'issuerBankIBAN':{'type':Sequelize[_0x9401('0x2')]},'issuerPhone':{'type':Sequelize[_0x9401('0x2')]},'issuerFax':{'type':Sequelize[_0x9401('0x2')]},'issuerEmail':{'type':Sequelize[_0x9401('0x2')]},'issuerWeb':{'type':Sequelize[_0x9401('0x2')]},'issuerABI':{'type':Sequelize[_0x9401('0x2')]},'issuerCAB':{'type':Sequelize['STRING']},'issuerPayPal':{'type':Sequelize['STRING']},'clientCode':{'type':Sequelize[_0x9401('0x2')]},'startDate':{'type':Sequelize[_0x9401('0x6')]},'endDate':{'type':Sequelize[_0x9401('0x6')]},'number':{'type':Sequelize[_0x9401('0x5')]},'beginningCompetence':{'type':Sequelize[_0x9401('0x6')]},'endCompetence':{'type':Sequelize[_0x9401('0x6')]}}; \ No newline at end of file +var _0xa29e=['INTEGER','BOOLEAN','DATE','sequelize','exports','STRING','TEXT'];(function(_0x232b44,_0x26e618){var _0x4830e9=function(_0x4d7f00){while(--_0x4d7f00){_0x232b44['push'](_0x232b44['shift']());}};_0x4830e9(++_0x26e618);}(_0xa29e,0x1a0));var _0xea29=function(_0x265cf6,_0x26f1d8){_0x265cf6=_0x265cf6-0x0;var _0x3f2737=_0xa29e[_0x265cf6];return _0x3f2737;};'use strict';var Sequelize=require(_0xea29('0x0'));module[_0xea29('0x1')]={'name':{'type':Sequelize[_0xea29('0x2')]},'note':{'type':Sequelize['TEXT']},'agentFullname':{'type':Sequelize[_0xea29('0x2')]},'status':{'type':Sequelize[_0xea29('0x3')]},'companyName':{'type':Sequelize[_0xea29('0x2')],'allowNull':![]},'companyId':{'type':Sequelize[_0xea29('0x4')],'allowNull':![]},'authorized':{'type':Sequelize['BOOLEAN']},'clientCode':{'type':Sequelize[_0xea29('0x2')]},'discount':{'type':Sequelize['DECIMAL'](0xd,0x4)},'paid':{'type':Sequelize[_0xea29('0x4')],'defaultValue':0x0},'receivingStreet':{'type':Sequelize[_0xea29('0x2')]},'receivingPostalCode':{'type':Sequelize['STRING']},'receivingCity':{'type':Sequelize[_0xea29('0x2')]},'receivingCountry':{'type':Sequelize[_0xea29('0x2')]},'receivingISOCode':{'type':Sequelize['STRING'](0x3)},'receivingFiscalCode':{'type':Sequelize[_0xea29('0x2')](0x32)},'receivingPIVA':{'type':Sequelize[_0xea29('0x2')](0x32)},'receivingSDICode':{'type':Sequelize[_0xea29('0x2')](0x15)},'receivingFiscalMessage':{'type':Sequelize['STRING']},'receivingExpiryDay':{'type':Sequelize[_0xea29('0x4')]},'receivingEurope':{'type':Sequelize[_0xea29('0x5')]},'receivingSocCap':{'type':Sequelize[_0xea29('0x2')](0xff)},'issuerName':{'type':Sequelize[_0xea29('0x2')]},'issuerStreet':{'type':Sequelize['STRING']},'issuerPostalCode':{'type':Sequelize[_0xea29('0x2')]},'issuerCity':{'type':Sequelize['STRING']},'issuerCountry':{'type':Sequelize['STRING']},'issuerISOCode':{'type':Sequelize[_0xea29('0x2')](0x3)},'issuerFiscalCode':{'type':Sequelize['STRING'](0x32)},'issuerPIVA':{'type':Sequelize['STRING'](0x32)},'issuerSDICode':{'type':Sequelize[_0xea29('0x2')](0x15)},'issuerFiscalMessage':{'type':Sequelize[_0xea29('0x2')](0x3e8)},'issuerExpiryDay':{'type':Sequelize[_0xea29('0x4')]},'issuerEurope':{'type':Sequelize[_0xea29('0x5')]},'issuerSocCap':{'type':Sequelize[_0xea29('0x2')](0xff)},'issuerBankAccount':{'type':Sequelize[_0xea29('0x2')](0xff)},'issuerBankName':{'type':Sequelize[_0xea29('0x2')](0xff)},'issuerBankStreet':{'type':Sequelize[_0xea29('0x2')]},'issuerBankPostalCode':{'type':Sequelize['STRING']},'issuerBankCity':{'type':Sequelize[_0xea29('0x2')]},'issuerBankCountry':{'type':Sequelize[_0xea29('0x2')]},'issuerBankBICSWIFT':{'type':Sequelize[_0xea29('0x2')]},'issuerBankIBAN':{'type':Sequelize[_0xea29('0x2')]},'issuerPhone':{'type':Sequelize[_0xea29('0x2')]},'issuerFax':{'type':Sequelize[_0xea29('0x2')]},'issuerEmail':{'type':Sequelize[_0xea29('0x2')]},'issuerWeb':{'type':Sequelize[_0xea29('0x2')]},'issuerABI':{'type':Sequelize['STRING']},'issuerCAB':{'type':Sequelize[_0xea29('0x2')]},'issuerPayPal':{'type':Sequelize[_0xea29('0x2')]},'clientCode':{'type':Sequelize[_0xea29('0x2')]},'startDate':{'type':Sequelize[_0xea29('0x6')]},'endDate':{'type':Sequelize['DATE']},'number':{'type':Sequelize[_0xea29('0x4')]},'beginningCompetence':{'type':Sequelize[_0xea29('0x6')]},'endCompetence':{'type':Sequelize[_0xea29('0x6')]}}; \ No newline at end of file diff --git a/server/api/saProforma/saProforma.controller.js b/server/api/saProforma/saProforma.controller.js index 89a9bba..bbc1cb6 100644 --- a/server/api/saProforma/saProforma.controller.js +++ b/server/api/saProforma/saProforma.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb702=['bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCountry','cab','issuerABI','issuerCAB','issuerBankBICSWIFT','issuerBankIBAN','issuerPayPal','paypal','thank1','','thank2','\x22\x20width=\x22180\x22>','','','','toFile','log','TCL:\x20exports.getProformaPDF\x20->\x20saveTo,\x20fileName','download','err','addCloneDetail->>','cloneProforma','cloneProforma\x20req.params.id:','sequelize','transaction','result','findAll','push','all','No\x20product\x20to\x20assign\x20new\x20proforma.\x20Proforma\x20not\x20created!!\x20','TCL:\x20exports.cloneProforma\x20->\x20err','SequelizeUniqueConstraintError','Duplicate\x20entry.','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','index','SAProforma','rawAttributes','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','map','type','key','VIRTUAL','filter','options','includeAll','include','rows','catch','find','create','body','params','describe','getProformaPDF','unix','join','root','server','files','tmp','logos','logo-invoice.png','images','format','Proforma_%s-%s.pdf','SAProformaDetail','details','1cm','{{page}}/{{pages}}','contents','default','footer','','proforma','','mkdirSync','','','Phone','Telefono','Fax','Email','VAT\x20number','P.IVA','Tax\x20code','I.S.\x20code','Cap.Soc.\x20iv','Proforma','Nota\x20di\x20credito','Due\x20date','Scadenza','Articolo','Description','Hrs/Qty','Unit\x20Price','Prezzo\x20Unitario','Sub\x20Total','Discount','Sconto','Imponibile','Tax','Tasse','Total','Totale','Please\x20send\x20PAYMENT\x20to','Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a','Conto\x20intestato\x20a','CAB','BIC','SWIF','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20','Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.','receivingCountry','Italy','\x20\x20%s
','issuerName','%s
','issuerPostalCode','\x20%s','issuerCity','-\x20%s\x20
','issuerCountry',':\x20%s
','fax','issuerFax','email','issuerEmail','piva','issuerPIVA','sdi','issuerSDICode','','%s','companyName','receivingStreet','%s\x20-\x20','receivingCity','','receivingFiscalCode','receivingPIVA','receivingSDICode','','','','','\x20N.%d','%s,\x20','updatedAt','DD/MM/YYYY','%s\x20','add','saExpiryDay','','duedate',':\x20%s','','','','description','hrsqty','subtotal','netPrice','discount','tax','quantity','%s','productName','productDescription','%d','','toFixed','\x20€','','isNil','receivingFiscalMessage','split\x20payment','','','','total','','nettopay','','\x20',' ','\x20%s\x20','replace','fromCharCode','','','sendpayment','issuerBankAccount','accountholder',':\x20','','bankname','issuerBankName'];(function(_0x25389e,_0x14ade5){var _0x2e53fe=function(_0x563e9a){while(--_0x563e9a){_0x25389e['push'](_0x25389e['shift']());}};_0x2e53fe(++_0x14ade5);}(_0xb702,0x127));var _0x2b70=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0xb702[_0x1a809b];return _0x5d90e6;};'use strict';var pdf=require(_0x2b70('0x0'));var emlformat=require(_0x2b70('0x1'));var rimraf=require(_0x2b70('0x2'));var zipdir=require(_0x2b70('0x3'));var jsonpatch=require(_0x2b70('0x4'));var rp=require(_0x2b70('0x5'));var moment=require(_0x2b70('0x6'));var BPromise=require(_0x2b70('0x7'));var Mustache=require(_0x2b70('0x8'));var util=require(_0x2b70('0x9'));var path=require(_0x2b70('0xa'));var sox=require('sox');var csv=require(_0x2b70('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2b70('0xc'));var squel=require('squel');var crypto=require(_0x2b70('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b70('0xe'));var toCsv=require(_0x2b70('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b70('0xf'));var qs=require(_0x2b70('0x10'));var hardwareService=require(_0x2b70('0x11'));var logger=require(_0x2b70('0x12'))(_0x2b70('0x13'));var utils=require(_0x2b70('0x14'));var config=require(_0x2b70('0x15'));var db=require(_0x2b70('0x16'))['db'];function respondWithStatusCode(_0x2a374c,_0x4b0241){_0x4b0241=_0x4b0241||0xcc;return function(_0x594cda){if(_0x594cda){return _0x2a374c[_0x2b70('0x17')](_0x4b0241);}return _0x2a374c[_0x2b70('0x18')](_0x4b0241)[_0x2b70('0x19')]();};}function respondWithResult(_0x51d17d,_0x2b1497){_0x2b1497=_0x2b1497||0xc8;return function(_0x329c8f){if(_0x329c8f){return _0x51d17d[_0x2b70('0x18')](_0x2b1497)[_0x2b70('0x1a')](_0x329c8f);}};}function respondWithFilteredResult(_0x32b80d,_0x369c01){return function(_0x4765ce){if(_0x4765ce){var _0x14344a=_0x4765ce[_0x2b70('0x1b')],_0x12a6da=_0x369c01[_0x2b70('0x1c')],_0x30fead=_0x369c01['offset']+_0x369c01[_0x2b70('0x1d')],_0x4bad07;if(_0x30fead>=_0x14344a){_0x30fead=_0x14344a;_0x4bad07=0xc8;}else{_0x4bad07=0xce;}_0x32b80d[_0x2b70('0x18')](_0x4bad07);return _0x32b80d[_0x2b70('0x1e')]('Content-Range',_0x12a6da+'-'+_0x30fead+'/'+_0x14344a)[_0x2b70('0x1a')](_0x4765ce);}return null;};}function patchUpdates(_0x2ed352){return function(_0x22221d){try{jsonpatch[_0x2b70('0x1f')](_0x22221d,_0x2ed352,!![]);}catch(_0x12f51a){return BPromise[_0x2b70('0x20')](_0x12f51a);}return _0x22221d[_0x2b70('0x21')]();};}function saveUpdates(_0x56ec81,_0x230c11){return function(_0x5007c4){if(_0x5007c4){return _0x5007c4[_0x2b70('0x22')](_0x56ec81)[_0x2b70('0x23')](function(_0x2a45fe){return _0x2a45fe;});}return null;};}function removeEntity(_0x271123,_0x28ca13){return function(_0x9019ed){if(_0x9019ed){return _0x9019ed['destroy']()[_0x2b70('0x23')](function(){_0x271123['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f26f,_0x2c2d8a){return function(_0x3917ed){if(!_0x3917ed){_0x41f26f['sendStatus'](0x194);}return _0x3917ed;};}function handleError(_0x10a81b,_0x3588f3){_0x3588f3=_0x3588f3||0x1f4;return function(_0x39d850){logger['error'](_0x39d850[_0x2b70('0x24')]);if(_0x39d850[_0x2b70('0x25')]){delete _0x39d850[_0x2b70('0x25')];}_0x10a81b[_0x2b70('0x18')](_0x3588f3)['send'](_0x39d850);};}exports[_0x2b70('0x26')]=function(_0xbe1c10,_0x466615){var _0x3cb965={},_0x403a82={},_0x49ecc8={'count':0x0,'rows':[]};var _0x57d443=db[_0x2b70('0x27')][_0x2b70('0x28')];_0x403a82['model']=_[_0x2b70('0x29')](_0x57d443);_0x403a82[_0x2b70('0x2a')]=_['keys'](_0xbe1c10['query']);_0x403a82[_0x2b70('0x2b')]=_[_0x2b70('0x2c')](_0x403a82['model'],_0x403a82['query']);_0x3cb965[_0x2b70('0x2d')]=_['intersection'](_0x403a82[_0x2b70('0x2e')],qs[_0x2b70('0x2f')](_0xbe1c10[_0x2b70('0x2a')][_0x2b70('0x2f')]));_0x3cb965[_0x2b70('0x2d')]=_0x3cb965[_0x2b70('0x2d')][_0x2b70('0x30')]?_0x3cb965[_0x2b70('0x2d')]:_0x403a82['model'];if(!_0xbe1c10[_0x2b70('0x2a')][_0x2b70('0x31')](_0x2b70('0x32'))){_0x3cb965[_0x2b70('0x1d')]=qs[_0x2b70('0x1d')](_0xbe1c10[_0x2b70('0x2a')]['limit']);_0x3cb965[_0x2b70('0x1c')]=qs[_0x2b70('0x1c')](_0xbe1c10['query'][_0x2b70('0x1c')]);}_0x3cb965['order']=qs['sort'](_0xbe1c10['query'][_0x2b70('0x33')]);_0x3cb965['where']=qs[_0x2b70('0x2b')](_[_0x2b70('0x34')](_0xbe1c10[_0x2b70('0x2a')],_0x403a82[_0x2b70('0x2b')]));if(_0xbe1c10[_0x2b70('0x2a')]['filter']){_0x3cb965[_0x2b70('0x35')]=_[_0x2b70('0x36')](_0x3cb965[_0x2b70('0x35')],{'$or':_[_0x2b70('0x37')](_0x57d443,function(_0x58df86){if(_0x58df86[_0x2b70('0x38')][_0x2b70('0x39')]!==_0x2b70('0x3a')){var _0x42658b={};_0x42658b[_0x58df86['field']]={'$like':'%'+_0xbe1c10[_0x2b70('0x2a')][_0x2b70('0x3b')]+'%'};return _0x42658b;}})});}_0x3cb965=_[_0x2b70('0x36')]({},_0x3cb965,_0xbe1c10[_0x2b70('0x3c')]);var _0x3b3593={'where':_0x3cb965[_0x2b70('0x35')]};return db['SAProforma']['count'](_0x3b3593)[_0x2b70('0x23')](function(_0x238a3d){_0x49ecc8[_0x2b70('0x1b')]=_0x238a3d;if(_0xbe1c10['query'][_0x2b70('0x3d')]){_0x3cb965[_0x2b70('0x3e')]=[{'all':!![]}];}return db[_0x2b70('0x27')]['findAll'](_0x3cb965);})[_0x2b70('0x23')](function(_0x4cdac4){_0x49ecc8[_0x2b70('0x3f')]=_0x4cdac4;return _0x49ecc8;})['then'](respondWithFilteredResult(_0x466615,_0x3cb965))[_0x2b70('0x40')](handleError(_0x466615,null));};exports['show']=function(_0x56b88a,_0x23661e){var _0x41e7fa={'raw':![],'where':{'id':_0x56b88a['params']['id']}},_0x4c3501={};_0x4c3501['model']=_[_0x2b70('0x29')](db[_0x2b70('0x27')][_0x2b70('0x28')]);_0x4c3501['query']=_[_0x2b70('0x29')](_0x56b88a[_0x2b70('0x2a')]);_0x4c3501[_0x2b70('0x2b')]=_[_0x2b70('0x2c')](_0x4c3501[_0x2b70('0x2e')],_0x4c3501['query']);_0x41e7fa['attributes']=_['intersection'](_0x4c3501['model'],qs[_0x2b70('0x2f')](_0x56b88a['query'][_0x2b70('0x2f')]));_0x41e7fa[_0x2b70('0x2d')]=_0x41e7fa[_0x2b70('0x2d')][_0x2b70('0x30')]?_0x41e7fa[_0x2b70('0x2d')]:_0x4c3501['model'];if(_0x56b88a['query']['includeAll']){_0x41e7fa[_0x2b70('0x3e')]=[{'all':!![]}];}_0x41e7fa=_['merge']({},_0x41e7fa,_0x56b88a[_0x2b70('0x3c')]);return db[_0x2b70('0x27')][_0x2b70('0x41')](_0x41e7fa)[_0x2b70('0x23')](handleEntityNotFound(_0x23661e,null))[_0x2b70('0x23')](respondWithResult(_0x23661e,null))['catch'](handleError(_0x23661e,null));};exports[_0x2b70('0x42')]=function(_0x32cef2,_0xdf5226){return db['SAProforma'][_0x2b70('0x42')](_0x32cef2[_0x2b70('0x43')],{})[_0x2b70('0x23')](respondWithResult(_0xdf5226,0xc9))[_0x2b70('0x40')](handleError(_0xdf5226,null));};exports[_0x2b70('0x22')]=function(_0x103810,_0x4884c1){if(_0x103810[_0x2b70('0x43')]['id']){delete _0x103810[_0x2b70('0x43')]['id'];}return db[_0x2b70('0x27')][_0x2b70('0x41')]({'where':{'id':_0x103810[_0x2b70('0x44')]['id']}})[_0x2b70('0x23')](handleEntityNotFound(_0x4884c1,null))[_0x2b70('0x23')](saveUpdates(_0x103810[_0x2b70('0x43')],null))[_0x2b70('0x23')](respondWithResult(_0x4884c1,null))['catch'](handleError(_0x4884c1,null));};exports['destroy']=function(_0x12be3e,_0x15d451){return db[_0x2b70('0x27')][_0x2b70('0x41')]({'where':{'id':_0x12be3e[_0x2b70('0x44')]['id']}})[_0x2b70('0x23')](handleEntityNotFound(_0x15d451,null))[_0x2b70('0x23')](removeEntity(_0x15d451,null))[_0x2b70('0x40')](handleError(_0x15d451,null));};exports[_0x2b70('0x45')]=function(_0x55aff2,_0x43e1ef){return db[_0x2b70('0x27')][_0x2b70('0x45')]()[_0x2b70('0x23')](respondWithResult(_0x43e1ef,null))['catch'](handleError(_0x43e1ef,null));};exports[_0x2b70('0x46')]=function(_0x3db7e3,_0x3d9cb4){var _0xed6f4f=moment()[_0x2b70('0x47')]()['toString']();var _0x4dcd31=path[_0x2b70('0x48')](config[_0x2b70('0x49')],_0x2b70('0x4a'),_0x2b70('0x4b'),_0x2b70('0x4c'));var _0x56b751=path[_0x2b70('0x48')](config['root'],_0x2b70('0x4a'),_0x2b70('0x4b'),'images',_0x2b70('0x4d'),_0x2b70('0x4e'));var _0x29bd9a=path[_0x2b70('0x48')](config[_0x2b70('0x49')],_0x2b70('0x4a'),_0x2b70('0x4b'),_0x2b70('0x4f'),_0x2b70('0x4d'),'paid-invoice.png');var _0x3019f8=path[_0x2b70('0x48')](_0x4dcd31,_0xed6f4f);var _0x48288a=util[_0x2b70('0x50')](_0x2b70('0x51'),_0x3db7e3[_0x2b70('0x44')]['id'],_0xed6f4f);var _0x21e02c=path['join'](_0x3019f8,_0x48288a);var _0x473aeb=![];var _0x2682bf={};return db['SAProforma']['find']({'where':{'id':_0x3db7e3[_0x2b70('0x44')]['id']},'raw':!![]})[_0x2b70('0x23')](handleEntityNotFound(_0x3d9cb4,null))[_0x2b70('0x23')](function(_0x35be78){if(_0x35be78){_0x2682bf['proforma']=_0x35be78;return db[_0x2b70('0x52')]['findAll']({'where':{'ProformaId':_0x35be78['id']},'raw':!![]})[_0x2b70('0x23')](function(_0x57ece5){_0x2682bf[_0x2b70('0x53')]=_0x57ece5;_0x473aeb=!![];var _0x5f3ebc='';var _0x33c8ca={'format':'A4','orientation':'portrait','border':_0x2b70('0x54'),'footer':{'height':'10mm','contents':{'default':_0x2b70('0x55')}}};_0x33c8ca['footer'][_0x2b70('0x56')][_0x2b70('0x57')]=_0x33c8ca[_0x2b70('0x58')][_0x2b70('0x56')][_0x2b70('0x57')]+_0x2b70('0x59')+_0x2682bf[_0x2b70('0x5a')]['issuerWeb']+_0x2b70('0x5b');fs[_0x2b70('0x5c')](_0x3019f8);_0x5f3ebc=_0x2b70('0x5d');_0x5f3ebc+='\x20\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}';_0x5f3ebc+=_0x2b70('0x5e');var _0x5dac26={'phone':{'en':_0x2b70('0x5f'),'it':_0x2b70('0x60')},'fax':{'en':_0x2b70('0x61'),'it':_0x2b70('0x61')},'email':{'en':_0x2b70('0x62'),'it':_0x2b70('0x62')},'piva':{'en':_0x2b70('0x63'),'it':_0x2b70('0x64')},'cf':{'en':_0x2b70('0x65'),'it':'C.F.'},'sdi':{'en':_0x2b70('0x66'),'it':'Codice\x20S.D.I.'},'cs':{'en':'Soc.Cap.\x20fp','it':_0x2b70('0x67')},'invoice':{'en':'Invoice','it':'Fattura'},'proforma':{'en':_0x2b70('0x68'),'it':_0x2b70('0x68')},'creditnote':{'en':'Credit\x20note','it':_0x2b70('0x69')},'duedate':{'en':_0x2b70('0x6a'),'it':_0x2b70('0x6b')},'item':{'en':'Item','it':_0x2b70('0x6c')},'description':{'en':_0x2b70('0x6d'),'it':'Descrizione'},'hrsqty':{'en':_0x2b70('0x6e'),'it':'Ore/Qta'},'unitprice':{'en':_0x2b70('0x6f'),'it':_0x2b70('0x70')},'subtotal':{'en':_0x2b70('0x71'),'it':'Sub\x20Totale'},'discount':{'en':_0x2b70('0x72'),'it':_0x2b70('0x73')},'total':{'en':'Subtotal','it':_0x2b70('0x74')},'tax':{'en':_0x2b70('0x75'),'it':_0x2b70('0x76')},'nettopay':{'en':_0x2b70('0x77'),'it':_0x2b70('0x78')},'sendpayment':{'en':_0x2b70('0x79'),'it':_0x2b70('0x7a')},'accountholder':{'en':'Account\x20Holder','it':_0x2b70('0x7b')},'bankname':{'en':'Bank\x20name','it':'Nome\x20banca'},'bankaddress':{'en':'Bank\x20Address','it':'Indirizzo\x20banca'},'abi':{'en':'ABI','it':'ABI'},'cab':{'en':_0x2b70('0x7c'),'it':_0x2b70('0x7c')},'bic':{'en':'BIC','it':_0x2b70('0x7d')},'swif':{'en':_0x2b70('0x7e'),'it':_0x2b70('0x7e')},'iban':{'en':'IBAN','it':'IBAN'},'paypal':{'en':_0x2b70('0x7f'),'it':_0x2b70('0x80')},'thank1':{'en':_0x2b70('0x81'),'it':_0x2b70('0x82')},'thank2':{'en':_0x2b70('0x83'),'it':_0x2b70('0x84')}};var _0x2f2fea='it';if(_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x85')]!==_0x2b70('0x86')){_0x2f2fea='en';}_0x5f3ebc+='';_0x5f3ebc+=_0x2b70('0x87')+_0x56b751+'\x22\x20width=\x22180\x22>';_0x5f3ebc+='';_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x88'),_0x2682bf['proforma'][_0x2b70('0x89')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x8a'),_0x2682bf['proforma']['issuerStreet']);_0x5f3ebc+=util['format']('%s',_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x8b')]);_0x5f3ebc+=util['format'](_0x2b70('0x8c'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x8d')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x8e'),_0x2682bf['proforma'][_0x2b70('0x8f')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26['phone'][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf['proforma']['issuerPhone']);_0x5f3ebc+=util['format'](_0x5dac26[_0x2b70('0x91')][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x92')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26[_0x2b70('0x93')][_0x2f2fea]+':\x20%s
',_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x94')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26[_0x2b70('0x95')][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x96')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26['cf'][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf[_0x2b70('0x5a')]['issuerFiscalCode']);_0x5f3ebc+=util['format'](_0x5dac26[_0x2b70('0x97')][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x98')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26['cs'][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf[_0x2b70('0x5a')]['issuerSocCap']);_0x5f3ebc+='';_0x5f3ebc+=_0x2b70('0x99');_0x5f3ebc+='';_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x9a'),_0x2682bf['proforma'][_0x2b70('0x9b')]);_0x5f3ebc+=util['format']('%s
',_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x9c')]);_0x5f3ebc+=util['format'](_0x2b70('0x9d'),_0x2682bf[_0x2b70('0x5a')]['receivingPostalCode']);_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x8a'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x9e')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x8a'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0x85')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0x9f')+_0x5dac26['cf'][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf['proforma'][_0x2b70('0xa0')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26[_0x2b70('0x95')][_0x2f2fea]+_0x2b70('0x90'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xa1')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x5dac26[_0x2b70('0x97')][_0x2f2fea]+':\x20%s
',_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xa2')]);_0x5f3ebc+=_0x2b70('0xa3');_0x5f3ebc+=_0x2b70('0xa4');_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=_0x2b70('0xa6');_0x5f3ebc+=util['format'](''+_0x5dac26[_0x2b70('0x5a')][_0x2f2fea]+_0x2b70('0xa7'),_0x35be78['id']);_0x5f3ebc+=util['format'](_0x2b70('0xa8'),_0x2682bf['proforma'][_0x2b70('0x8d')]);var _0x42d862=moment(_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xa9')])[_0x2b70('0x50')](_0x2b70('0xaa'));_0x5f3ebc+=util['format'](_0x2b70('0xab'),_0x42d862);var _0x2c1d49=moment(_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xa9')])[_0x2b70('0xac')](_0x2682bf['proforma'][_0x2b70('0xad')],'days')[_0x2b70('0x50')](_0x2b70('0xaa'));_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0xae')+_0x5dac26[_0x2b70('0xaf')][_0x2f2fea]+_0x2b70('0xb0'),_0x2c1d49);_0x5f3ebc+=_0x2b70('0xa4');_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=_0x2b70('0xa6');_0x5f3ebc+=_0x2b70('0xb1');_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=_0x2b70('0xb2')+_0x5dac26['item'][_0x2f2fea]+_0x2b70('0xb3');_0x5f3ebc+=_0x2b70('0xb2')+_0x5dac26[_0x2b70('0xb4')][_0x2f2fea]+'';_0x5f3ebc+=''+_0x5dac26[_0x2b70('0xb5')][_0x2f2fea]+_0x2b70('0xb3');_0x5f3ebc+=_0x2b70('0xb2')+_0x5dac26['unitprice'][_0x2f2fea]+_0x2b70('0xb3');_0x5f3ebc+=''+_0x5dac26[_0x2b70('0xb6')][_0x2f2fea]+_0x2b70('0xb3');_0x5f3ebc+=_0x2b70('0xa4');var _0x47f2b6=0x0;var _0x240edb=0x0;for(var _0x11cc9d=0x0;_0x11cc9d<_0x2682bf[_0x2b70('0x53')][_0x2b70('0x30')];_0x11cc9d++){var _0x593d34=0x0;var _0x25ae31=0x0;var _0x55daf3=0x0;var _0x3b9e0f=0x0;_0x593d34=_0x2682bf[_0x2b70('0x53')][_0x11cc9d]['netPrice']-_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xb7')]/0x64*_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xb8')];_0x25ae31=_0x593d34/0x64*_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xb9')];_0x55daf3=_0x593d34*_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xba')];_0x3b9e0f=_0x25ae31*_0x2682bf[_0x2b70('0x53')][_0x11cc9d]['quantity'];_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0xbb'),_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xbc')]);_0x5f3ebc+=util[_0x2b70('0x50')]('%s',_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xbd')]);_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0xbe'),_0x2682bf['details'][_0x11cc9d][_0x2b70('0xba')]);_0x5f3ebc+=_0x2b70('0xbf')+_0x593d34[_0x2b70('0xc0')](0x2)+_0x2b70('0xc1');_0x5f3ebc+=''+_0x55daf3[_0x2b70('0xc0')](0x2)+_0x2b70('0xc1');_0x5f3ebc+=_0x2b70('0xa4');_0x47f2b6+=_0x55daf3;_0x240edb+=_0x3b9e0f;}_0x5f3ebc+=_0x2b70('0xc2');if(!_[_0x2b70('0xc3')](_0x2682bf[_0x2b70('0x5a')]['discount'])){var _0x14e9c4=0x0;var _0x109d7e=0x0;var _0x33cc0f=_0x2682bf['proforma'][_0x2b70('0xb8')]*0x64/_0x47f2b6;for(var _0x11cc9d=0x0;_0x11cc9d<_0x2682bf[_0x2b70('0x53')]['length'];_0x11cc9d++){var _0x45c4b6=0x0;var _0x4d3bcc=0x0;var _0x500db0=0x0;_0x593d34=_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xb7')]-_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xb7')]/0x64*_0x2682bf['details'][_0x11cc9d][_0x2b70('0xb8')];_0x45c4b6=_0x593d34/0x64*_0x33cc0f;_0x4d3bcc=_0x593d34-_0x45c4b6;_0x500db0=_0x4d3bcc*_0x2682bf['details'][_0x11cc9d][_0x2b70('0xba')];_0x14e9c4+=_0x500db0;_0x109d7e+=_0x500db0/0x64*_0x2682bf[_0x2b70('0x53')][_0x11cc9d][_0x2b70('0xb9')];}}var _0x106bb0=0x0;var _0x4e6f2b=0x0;var _0x2b0137=![];var _0x27edb7=_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xc4')];if(_0x27edb7['indexOf'](_0x2b70('0xc5'))!=-0x1){_0x2b0137=!![];}if(!_[_0x2b70('0xc3')](_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xb8')])){_0x5f3ebc+=_0x2b70('0xa5');if(_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xb8')]>0x0){_0x5f3ebc+=_0x2b70('0xc6')+_0x5dac26[_0x2b70('0xb8')][_0x2f2fea]+_0x2b70('0xc7');_0x5f3ebc+=_0x2b70('0xbf')+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xb8')][_0x2b70('0xc0')](0x2)+'\x20€';}_0x5f3ebc+=_0x2b70('0xa4');_0x106bb0=_0x109d7e;_0x4e6f2b=_0x14e9c4;}else{_0x106bb0=_0x240edb;_0x4e6f2b=_0x47f2b6;}if(_0x106bb0>0x0||_0x2682bf['proforma']['discount']>0x0){_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=_0x2b70('0xc8')+_0x5dac26[_0x2b70('0xc9')][_0x2f2fea]+_0x2b70('0xc7');_0x5f3ebc+=_0x2b70('0xbf')+_0x4e6f2b[_0x2b70('0xc0')](0x2)+_0x2b70('0xc1');_0x5f3ebc+=_0x2b70('0xa4');}if(_0x106bb0>0x0){_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=_0x2b70('0xc8')+_0x5dac26['tax'][_0x2f2fea]+'';_0x5f3ebc+=_0x2b70('0xbf')+_0x106bb0[_0x2b70('0xc0')](0x2)+_0x2b70('0xc1');_0x5f3ebc+=_0x2b70('0xa4');}_0x5f3ebc+=_0x2b70('0xa5');var _0x4b8ea9;if(_0x2b0137){_0x4b8ea9=_0x4e6f2b;}else{_0x4b8ea9=_0x4e6f2b+_0x106bb0;}_0x5f3ebc+=_0x2b70('0xca')+_0x5dac26[_0x2b70('0xcb')][_0x2f2fea]+_0x2b70('0xcc')+_0x4b8ea9[_0x2b70('0xc0')](0x2)+_0x2b70('0xc1');_0x5f3ebc+=_0x2b70('0xcd');_0x5f3ebc+=_0x2b70('0xa4');_0x5f3ebc+=_0x2b70('0xce');_0x5f3ebc+='';_0x5f3ebc+=_0x2b70('0xa5');_0x5f3ebc+=util[_0x2b70('0x50')](_0x2b70('0xcf'),_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xc4')][_0x2b70('0xd0')](new RegExp(String[_0x2b70('0xd1')](0xd),'g'),_0x2b70('0xd2')));_0x5f3ebc+='';_0x5f3ebc+='';_0x5f3ebc+=_0x2b70('0xa6');_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26[_0x2b70('0xd4')][_0x2f2fea]+_0x2b70('0x5b');if(!_[_0x2b70('0xc3')](_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xd5')])){_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26[_0x2b70('0xd6')][_0x2f2fea]+_0x2b70('0xd7')+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xd5')]+_0x2b70('0xd8');_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26[_0x2b70('0xd9')][_0x2f2fea]+':\x20'+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xda')]+'\x20';_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26[_0x2b70('0xdb')][_0x2f2fea]+':\x20'+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xdc')]+',\x20'+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xdd')]+_0x2b70('0xde')+_0x2682bf[_0x2b70('0x5a')]['issuerBankCity']+'\x20('+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xdf')]+')'+'';_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26['abi'][_0x2f2fea]+'/'+_0x5dac26[_0x2b70('0xe0')][_0x2f2fea]+':\x20'+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xe1')]+'/'+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xe2')]+'';_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26['bic'][_0x2f2fea]+'/'+_0x5dac26['swif'][_0x2f2fea]+':\x20'+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xe3')]+_0x2b70('0xd8');_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26['iban'][_0x2f2fea]+_0x2b70('0xd7')+_0x2682bf['proforma'][_0x2b70('0xe4')]+_0x2b70('0xd8');}if(!_['isNil'](_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xe5')])){_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26[_0x2b70('0xe6')][_0x2f2fea]+_0x2b70('0xd7')+_0x2682bf[_0x2b70('0x5a')][_0x2b70('0xe5')]+'';}_0x5f3ebc+=_0x2b70('0xd3')+_0x5dac26[_0x2b70('0xe7')][_0x2f2fea]+''+_0x2c1d49+_0x2b70('0xe8')+_0x5dac26[_0x2b70('0xe9')][_0x2f2fea]+_0x2b70('0x5b');_0x5f3ebc+=_0x2b70('0xc7');_0x5f3ebc+=_0x2b70('0xa4');if(_0x2682bf['proforma']['paid']===0x1){_0x5f3ebc+=_0x2b70('0x87')+_0x29bd9a+_0x2b70('0xea');}_0x5f3ebc+=_0x2b70('0xeb');_0x5f3ebc+=_0x2b70('0xec');_0x5f3ebc+=_0x2b70('0xed');return new BPromise(function(_0x400fcd,_0x593e28){pdf[_0x2b70('0x42')](_0x5f3ebc,_0x33c8ca)[_0x2b70('0xee')](path[_0x2b70('0x48')](_0x3019f8,_0x48288a),function(_0x167ac6,_0x8a2ef1){if(_0x167ac6)return _0x593e28(_0x167ac6);_0x400fcd(_0x8a2ef1);});});});}})[_0x2b70('0x23')](function(){if(_0x473aeb){console[_0x2b70('0xef')](_0x2b70('0xf0'),_0x21e02c,_0x48288a);return _0x3d9cb4[_0x2b70('0xf1')](_0x21e02c,_0x48288a,function(_0x42514c){if(_0x42514c){console[_0x2b70('0xef')](_0x2b70('0xf2'),_0x42514c);}else{console[_0x2b70('0xef')]('foldername',_0x3019f8);rimraf(_0x3019f8,function(){});}});}else{return _0x3d9cb4[_0x2b70('0x17')](0xc8);}})[_0x2b70('0x40')](handleError(_0x3d9cb4,null));};function addCloneDetail(_0x3ee75d,_0x859051,_0x48c49e){console['log'](_0x2b70('0xf3'),_0x3ee75d);_0x3ee75d['ProformaId']=_0x859051;delete _0x3ee75d['id'];return db[_0x2b70('0x52')]['create'](_0x3ee75d,{'transaction':_0x48c49e});}exports[_0x2b70('0xf4')]=function(_0x386be9,_0x4c965b,_0x158fc1){var _0x3e074c;if(_0x386be9[_0x2b70('0x43')]['id']){delete _0x386be9[_0x2b70('0x43')]['id'];}console[_0x2b70('0xef')](_0x2b70('0xf5'),_0x386be9[_0x2b70('0x44')]['id']);return db[_0x2b70('0xf6')][_0x2b70('0xf7')](function(_0x51f5f0){return db[_0x2b70('0x27')]['create'](_0x386be9['body'],{'transaction':_0x51f5f0,'logging':console[_0x2b70('0xef')]})[_0x2b70('0x23')](function(_0x5f12fe){console[_0x2b70('0xef')](_0x2b70('0xf8'),_0x5f12fe);_0x3e074c=_0x5f12fe;var _0x5d493d=_0x386be9['params']['id'];return db[_0x2b70('0x52')][_0x2b70('0xf9')]({'where':{'ProformaId':_0x5d493d},'raw':!![]});})[_0x2b70('0x23')](function(_0x3ec7da){console[_0x2b70('0xef')]('cloneProforma\x20productsProforma:',_0x3ec7da);if(_0x3ec7da[_0x2b70('0x30')]>0x0){var _0x4d2a6e=[];for(var _0x73c039=0x0;_0x73c039<_0x3ec7da[_0x2b70('0x30')];_0x73c039++){_0x4d2a6e[_0x2b70('0xfa')](addCloneDetail(_0x3ec7da[_0x73c039],_0x3e074c['id'],_0x51f5f0));}return BPromise[_0x2b70('0xfb')](_0x4d2a6e);}else{var _0x1741cd={'errors':[{'type':'WARNING','message':_0x2b70('0xfc')}]};throw _0x1741cd;}});})['then'](function(){return _0x4c965b[_0x2b70('0x17')](0xc8);})[_0x2b70('0x40')](function(_0xdaed29){console['log'](_0x2b70('0xfd'),_0xdaed29);if(_0xdaed29[_0x2b70('0x25')]===_0x2b70('0xfe')){var _0xdaed29={'errors':[{'message':_0x2b70('0xff')}]};}_0x4c965b['status'](0x1f4)[_0x2b70('0x100')](_0xdaed29);});}; \ No newline at end of file +var _0x258f=['','','Phone','Telefono','Fax','Email','VAT\x20number','P.IVA','Tax\x20code','C.F.','Soc.Cap.\x20fp','Invoice','Fattura','Proforma','Credit\x20note','Nota\x20di\x20credito','Due\x20date','Articolo','Hrs/Qty','Ore/Qta','Prezzo\x20Unitario','Sub\x20Total','Sub\x20Totale','Discount','Subtotal','Tax','Tasse','Total','Please\x20send\x20PAYMENT\x20to','Account\x20Holder','Conto\x20intestato\x20a','Bank\x20name','Nome\x20banca','Bank\x20Address','Indirizzo\x20banca','ABI','CAB','BIC','SWIF','IBAN','Pay\x20via\x20Paypal','Paga\x20con\x20Paypal','Thank\x20you\x20for\x20your\x20business.\x20We\x20do\x20expect\x20payment\x20by\x20',',\x20so\x20please\x20do\x20so\x20within\x20this\x20time.','receivingCountry','Italy','\x20','\x20%s
','issuerName','%s
','issuerPostalCode','\x20%s','issuerCity','-\x20%s\x20
','issuerCountry','phone',':\x20%s
','fax','issuerFax','email','issuerEmail','piva','issuerFiscalCode','sdi','issuerSDICode','','
','%s','companyName','receivingStreet','%s\x20-\x20','receivingPostalCode','receivingCity','','receivingFiscalCode','receivingPIVA','receivingSDICode','','','','\x20N.%d','%s,\x20','DD/MM/YYYY','add','saExpiryDay','days','','duedate','','','','description','hrsqty','unitprice','subtotal','netPrice','discount','tax','quantity','','productName','','toFixed','\x20€','
%s
','isNil','receivingFiscalMessage','indexOf','split\x20payment','','','total','','','\x20',' ','','\x20%s\x20','replace','','','sendpayment','issuerBankAccount','accountholder',':\x20','bankname','issuerBankName','\x20','bankaddress','issuerBankStreet','issuerBankPostalCode','\x20-\x20','issuerBankCity','issuerBankCountry','','abi','cab','issuerABI','issuerCAB','swif','issuerBankBICSWIFT','issuerPayPal','thank1','','thank2','paid','\x22\x20width=\x22180\x22>','','','toFile','log','TCL:\x20exports.getProformaPDF\x20->\x20saveTo,\x20fileName','download','err','addCloneDetail->>','ProformaId','cloneProforma','cloneProforma\x20req.params.id:','sequelize','transaction','result','cloneProforma\x20productsProforma:','push','WARNING','No\x20product\x20to\x20assign\x20new\x20proforma.\x20Proforma\x20not\x20created!!\x20','TCL:\x20exports.cloneProforma\x20->\x20err','Duplicate\x20entry.','html-pdf','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','type','key','options','SAProforma','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getProformaPDF','unix','toString','join','root','server','files','tmp','logo-invoice.png','images','logos','paid-invoice.png','format','Proforma_%s-%s.pdf','proforma','SAProformaDetail','details','portrait','1cm','10mm','{{page}}/{{pages}}','footer','contents','default','','issuerWeb',''];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x258f,0xa8));var _0xf258=function(_0x1c629b,_0x5eaf2a){_0x1c629b=_0x1c629b-0x0;var _0x583efa=_0x258f[_0x1c629b];return _0x583efa;};'use strict';var pdf=require(_0xf258('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf258('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf258('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf258('0x3'));var util=require('util');var path=require(_0xf258('0x4'));var sox=require(_0xf258('0x5'));var csv=require(_0xf258('0x6'));var ejs=require(_0xf258('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf258('0x8'));var crypto=require(_0xf258('0x9'));var jsforce=require(_0xf258('0xa'));var deskjs=require(_0xf258('0xb'));var toCsv=require(_0xf258('0x6'));var querystring=require(_0xf258('0xc'));var Papa=require(_0xf258('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf258('0xe'));var hardwareService=require(_0xf258('0xf'));var logger=require(_0xf258('0x10'))(_0xf258('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf258('0x12'))['db'];function respondWithStatusCode(_0x41124e,_0x44e25d){_0x44e25d=_0x44e25d||0xcc;return function(_0x4457cf){if(_0x4457cf){return _0x41124e[_0xf258('0x13')](_0x44e25d);}return _0x41124e['status'](_0x44e25d)['end']();};}function respondWithResult(_0x3c2429,_0x511ce5){_0x511ce5=_0x511ce5||0xc8;return function(_0x1916f6){if(_0x1916f6){return _0x3c2429[_0xf258('0x14')](_0x511ce5)[_0xf258('0x15')](_0x1916f6);}};}function respondWithFilteredResult(_0x12392b,_0x383e7e){return function(_0x5b8023){if(_0x5b8023){var _0x2e1b6c=_0x5b8023[_0xf258('0x16')],_0x4d9de0=_0x383e7e['offset'],_0x3168a2=_0x383e7e['offset']+_0x383e7e[_0xf258('0x17')],_0x3a99b6;if(_0x3168a2>=_0x2e1b6c){_0x3168a2=_0x2e1b6c;_0x3a99b6=0xc8;}else{_0x3a99b6=0xce;}_0x12392b['status'](_0x3a99b6);return _0x12392b[_0xf258('0x18')](_0xf258('0x19'),_0x4d9de0+'-'+_0x3168a2+'/'+_0x2e1b6c)['json'](_0x5b8023);}return null;};}function patchUpdates(_0x175a31){return function(_0x405460){try{jsonpatch[_0xf258('0x1a')](_0x405460,_0x175a31,!![]);}catch(_0x3b49c9){return BPromise[_0xf258('0x1b')](_0x3b49c9);}return _0x405460[_0xf258('0x1c')]();};}function saveUpdates(_0xabaf18,_0x5375b7){return function(_0x535870){if(_0x535870){return _0x535870[_0xf258('0x1d')](_0xabaf18)[_0xf258('0x1e')](function(_0x240d84){return _0x240d84;});}return null;};}function removeEntity(_0x584e18,_0x95d0d7){return function(_0x49eaa4){if(_0x49eaa4){return _0x49eaa4[_0xf258('0x1f')]()[_0xf258('0x1e')](function(){_0x584e18[_0xf258('0x14')](0xcc)[_0xf258('0x20')]();});}};}function handleEntityNotFound(_0x350aae,_0x34b206){return function(_0x18f951){if(!_0x18f951){_0x350aae[_0xf258('0x13')](0x194);}return _0x18f951;};}function handleError(_0x4042e6,_0x21d6a3){_0x21d6a3=_0x21d6a3||0x1f4;return function(_0x2c7d17){logger[_0xf258('0x21')](_0x2c7d17[_0xf258('0x22')]);if(_0x2c7d17['name']){delete _0x2c7d17[_0xf258('0x23')];}_0x4042e6['status'](_0x21d6a3)[_0xf258('0x24')](_0x2c7d17);};}exports[_0xf258('0x25')]=function(_0x1562d4,_0xc5077c){var _0x29189e={},_0x4368fd={},_0xbf1e64={'count':0x0,'rows':[]};var _0x4d0745=db['SAProforma'][_0xf258('0x26')];_0x4368fd[_0xf258('0x27')]=_[_0xf258('0x28')](_0x4d0745);_0x4368fd[_0xf258('0x29')]=_[_0xf258('0x28')](_0x1562d4[_0xf258('0x29')]);_0x4368fd[_0xf258('0x2a')]=_[_0xf258('0x2b')](_0x4368fd[_0xf258('0x27')],_0x4368fd[_0xf258('0x29')]);_0x29189e[_0xf258('0x2c')]=_[_0xf258('0x2b')](_0x4368fd[_0xf258('0x27')],qs['fields'](_0x1562d4[_0xf258('0x29')][_0xf258('0x2d')]));_0x29189e[_0xf258('0x2c')]=_0x29189e['attributes'][_0xf258('0x2e')]?_0x29189e[_0xf258('0x2c')]:_0x4368fd[_0xf258('0x27')];if(!_0x1562d4[_0xf258('0x29')][_0xf258('0x2f')](_0xf258('0x30'))){_0x29189e[_0xf258('0x17')]=qs[_0xf258('0x17')](_0x1562d4[_0xf258('0x29')][_0xf258('0x17')]);_0x29189e[_0xf258('0x31')]=qs[_0xf258('0x31')](_0x1562d4['query'][_0xf258('0x31')]);}_0x29189e[_0xf258('0x32')]=qs[_0xf258('0x33')](_0x1562d4['query'][_0xf258('0x33')]);_0x29189e[_0xf258('0x34')]=qs['filters'](_[_0xf258('0x35')](_0x1562d4['query'],_0x4368fd[_0xf258('0x2a')]));if(_0x1562d4[_0xf258('0x29')][_0xf258('0x36')]){_0x29189e['where']=_[_0xf258('0x37')](_0x29189e[_0xf258('0x34')],{'$or':_[_0xf258('0x38')](_0x4d0745,function(_0x23ee1a){if(_0x23ee1a[_0xf258('0x39')][_0xf258('0x3a')]!=='VIRTUAL'){var _0x2d9921={};_0x2d9921[_0x23ee1a['field']]={'$like':'%'+_0x1562d4[_0xf258('0x29')][_0xf258('0x36')]+'%'};return _0x2d9921;}})});}_0x29189e=_['merge']({},_0x29189e,_0x1562d4[_0xf258('0x3b')]);var _0x2433a3={'where':_0x29189e['where']};return db[_0xf258('0x3c')][_0xf258('0x16')](_0x2433a3)[_0xf258('0x1e')](function(_0x399c4f){_0xbf1e64[_0xf258('0x16')]=_0x399c4f;if(_0x1562d4[_0xf258('0x29')]['includeAll']){_0x29189e['include']=[{'all':!![]}];}return db[_0xf258('0x3c')][_0xf258('0x3d')](_0x29189e);})[_0xf258('0x1e')](function(_0x61ba3e){_0xbf1e64[_0xf258('0x3e')]=_0x61ba3e;return _0xbf1e64;})['then'](respondWithFilteredResult(_0xc5077c,_0x29189e))[_0xf258('0x3f')](handleError(_0xc5077c,null));};exports[_0xf258('0x40')]=function(_0x291dd3,_0x4a8855){var _0xa174={'raw':![],'where':{'id':_0x291dd3[_0xf258('0x41')]['id']}},_0x1ba260={};_0x1ba260[_0xf258('0x27')]=_[_0xf258('0x28')](db[_0xf258('0x3c')][_0xf258('0x26')]);_0x1ba260[_0xf258('0x29')]=_[_0xf258('0x28')](_0x291dd3[_0xf258('0x29')]);_0x1ba260[_0xf258('0x2a')]=_['intersection'](_0x1ba260['model'],_0x1ba260['query']);_0xa174[_0xf258('0x2c')]=_[_0xf258('0x2b')](_0x1ba260['model'],qs['fields'](_0x291dd3[_0xf258('0x29')][_0xf258('0x2d')]));_0xa174[_0xf258('0x2c')]=_0xa174[_0xf258('0x2c')][_0xf258('0x2e')]?_0xa174['attributes']:_0x1ba260[_0xf258('0x27')];if(_0x291dd3[_0xf258('0x29')][_0xf258('0x42')]){_0xa174['include']=[{'all':!![]}];}_0xa174=_[_0xf258('0x37')]({},_0xa174,_0x291dd3['options']);return db[_0xf258('0x3c')][_0xf258('0x43')](_0xa174)['then'](handleEntityNotFound(_0x4a8855,null))['then'](respondWithResult(_0x4a8855,null))[_0xf258('0x3f')](handleError(_0x4a8855,null));};exports[_0xf258('0x44')]=function(_0x3f2e4b,_0xfcb32d){return db[_0xf258('0x3c')][_0xf258('0x44')](_0x3f2e4b[_0xf258('0x45')],{})[_0xf258('0x1e')](respondWithResult(_0xfcb32d,0xc9))['catch'](handleError(_0xfcb32d,null));};exports[_0xf258('0x1d')]=function(_0x3f67bd,_0x5d7e32){if(_0x3f67bd[_0xf258('0x45')]['id']){delete _0x3f67bd['body']['id'];}return db[_0xf258('0x3c')][_0xf258('0x43')]({'where':{'id':_0x3f67bd[_0xf258('0x41')]['id']}})[_0xf258('0x1e')](handleEntityNotFound(_0x5d7e32,null))['then'](saveUpdates(_0x3f67bd[_0xf258('0x45')],null))[_0xf258('0x1e')](respondWithResult(_0x5d7e32,null))[_0xf258('0x3f')](handleError(_0x5d7e32,null));};exports[_0xf258('0x1f')]=function(_0x349b4e,_0x4e3020){return db[_0xf258('0x3c')][_0xf258('0x43')]({'where':{'id':_0x349b4e['params']['id']}})[_0xf258('0x1e')](handleEntityNotFound(_0x4e3020,null))[_0xf258('0x1e')](removeEntity(_0x4e3020,null))[_0xf258('0x3f')](handleError(_0x4e3020,null));};exports['describe']=function(_0x1a3b7c,_0x5e2217){return db[_0xf258('0x3c')][_0xf258('0x46')]()[_0xf258('0x1e')](respondWithResult(_0x5e2217,null))[_0xf258('0x3f')](handleError(_0x5e2217,null));};exports[_0xf258('0x47')]=function(_0x19284a,_0x21956f){var _0x480ad2=moment()[_0xf258('0x48')]()[_0xf258('0x49')]();var _0x580358=path[_0xf258('0x4a')](config[_0xf258('0x4b')],_0xf258('0x4c'),_0xf258('0x4d'),_0xf258('0x4e'));var _0x53b8f7=path[_0xf258('0x4a')](config[_0xf258('0x4b')],_0xf258('0x4c'),'files','images','logos',_0xf258('0x4f'));var _0x4f7c16=path['join'](config['root'],_0xf258('0x4c'),_0xf258('0x4d'),_0xf258('0x50'),_0xf258('0x51'),_0xf258('0x52'));var _0x26b81a=path['join'](_0x580358,_0x480ad2);var _0xa8efea=util[_0xf258('0x53')](_0xf258('0x54'),_0x19284a['params']['id'],_0x480ad2);var _0x3f27d6=path[_0xf258('0x4a')](_0x26b81a,_0xa8efea);var _0x4a2af3=![];var _0xc61900={};return db[_0xf258('0x3c')][_0xf258('0x43')]({'where':{'id':_0x19284a[_0xf258('0x41')]['id']},'raw':!![]})[_0xf258('0x1e')](handleEntityNotFound(_0x21956f,null))[_0xf258('0x1e')](function(_0xc00890){if(_0xc00890){_0xc61900[_0xf258('0x55')]=_0xc00890;return db[_0xf258('0x56')][_0xf258('0x3d')]({'where':{'ProformaId':_0xc00890['id']},'raw':!![]})['then'](function(_0x53c962){_0xc61900[_0xf258('0x57')]=_0x53c962;_0x4a2af3=!![];var _0xe741ef='';var _0x3d20ab={'format':'A4','orientation':_0xf258('0x58'),'border':_0xf258('0x59'),'footer':{'height':_0xf258('0x5a'),'contents':{'default':_0xf258('0x5b')}}};_0x3d20ab[_0xf258('0x5c')][_0xf258('0x5d')]['default']=_0x3d20ab[_0xf258('0x5c')][_0xf258('0x5d')][_0xf258('0x5e')]+_0xf258('0x5f')+_0xc61900['proforma'][_0xf258('0x60')]+_0xf258('0x61');fs['mkdirSync'](_0x26b81a);_0xe741ef=_0xf258('0x62');_0xe741ef+='\x20\x20body{font-family:\x20Verdana,\x20Geneva,\x20Tahoma,\x20sans-serif;}.itemTabTitle{background-color:\x20lightgray;\x20height:\x2040px;}.issuerInfo{color:\x20lightgray;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;\x20font-size:\x2012px;}.issuerData{font-weight:\x20normal}.issuerFiled{font-weight:\x20bold;\x20font-size:\x2010px;\x20padding-left:\x2010px;}.issuerFiledWeb{font-weight:\x20bold;\x20text-align:\x20center;}.receiperInfo{text-align:\x20right;\x20font-size:\x2012px}.receiperCompanyName{font-weight:\x20bold;\x20padding-top:\x2010px;\x20padding-bottom:\x2015px;\x20font-size:\x2016px}.reciperFiscalInfo{padding-top:\x205px;\x20padding-bottom:\x205px;}table.center{margin-left:\x20auto;\x20margin-right:\x20auto;\x20width:\x2090%;}.total{background-color:\x20lightgray;\x20font-size:\x2018px;\x20font-weight:\x20bold;}.totalText{background-color:\x20lightgray;\x20text-align:\x20right;\x20font-size:\x2016px;\x20padding-right:\x2010px;}.totalEmpty{background-color:\x20#ffffff;}.invoiceNumber{font-weight:\x20bolder;\x20font-size:\x2024px;\x20padding-bottom:\x2020px;}.invoiceNumber{font-weight:\x20bold;\x20font-size:\x2018px;}.createdDate{font-size:\x2014px;\x20padding-top:\x2020px;\x20padding-bottom:\x2020px;}.duedDate{font-size:\x2014px;\x20padding-bottom:\x2010px;}.TFtable{width:\x20100%;\x20font-size:\x2010px;\x20border-collapse:\x20collapse;}.TFtable\x20td{padding:\x207px;}.TFtable\x20tr:nth-child(even){background:\x20#ffffff;}.TFtable\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.numberRight{text-align:\x20right;}.numberCenter{text-align:\x20center}.currency{text-align:\x20left;}table.roundedCorners{border:\x202px\x20solid\x20lightgray;\x20border-radius:\x205px;\x20border-spacing:\x200;\x20width:\x20100%;\x20font-size:\x2010px;}table.roundedCorners\x20td,\x20table.roundedCorners\x20th{border-bottom:\x201px\x20solid\x20lightgray;\x20padding:\x2010px;}table.roundedCorners\x20tr:last-child\x20>\x20td{border-bottom:\x20none;}table.roundedCorners\x20tr:nth-child(even){background:\x20#ffffff;}table.roundedCorners\x20tr:nth-child(odd){background:\x20rgb(237,\x20232,\x20232);}.lex{padding-left:\x2010px;font-size:\x2010px;padding-bottom:\x2020px;}.divTotal{float:\x20right;\x20border-radius:\x205px;\x20border:\x202px\x20solid\x20lightgray;\x20padding:\x2010px;\x20margin-top:30px;}.itemTotal{width:\x20200px;\x20line-height:\x2030px;}.tabTotal{border-collapse:\x20collapse;}';_0xe741ef+=_0xf258('0x63');var _0x47116f={'phone':{'en':_0xf258('0x64'),'it':_0xf258('0x65')},'fax':{'en':_0xf258('0x66'),'it':_0xf258('0x66')},'email':{'en':_0xf258('0x67'),'it':_0xf258('0x67')},'piva':{'en':_0xf258('0x68'),'it':_0xf258('0x69')},'cf':{'en':_0xf258('0x6a'),'it':_0xf258('0x6b')},'sdi':{'en':'I.S.\x20code','it':'Codice\x20S.D.I.'},'cs':{'en':_0xf258('0x6c'),'it':'Cap.Soc.\x20iv'},'invoice':{'en':_0xf258('0x6d'),'it':_0xf258('0x6e')},'proforma':{'en':_0xf258('0x6f'),'it':_0xf258('0x6f')},'creditnote':{'en':_0xf258('0x70'),'it':_0xf258('0x71')},'duedate':{'en':_0xf258('0x72'),'it':'Scadenza'},'item':{'en':'Item','it':_0xf258('0x73')},'description':{'en':'Description','it':'Descrizione'},'hrsqty':{'en':_0xf258('0x74'),'it':_0xf258('0x75')},'unitprice':{'en':'Unit\x20Price','it':_0xf258('0x76')},'subtotal':{'en':_0xf258('0x77'),'it':_0xf258('0x78')},'discount':{'en':_0xf258('0x79'),'it':'Sconto'},'total':{'en':_0xf258('0x7a'),'it':'Imponibile'},'tax':{'en':_0xf258('0x7b'),'it':_0xf258('0x7c')},'nettopay':{'en':_0xf258('0x7d'),'it':'Totale'},'sendpayment':{'en':_0xf258('0x7e'),'it':'Si\x20prega\x20di\x20inviare\x20il\x20pagamento\x20a'},'accountholder':{'en':_0xf258('0x7f'),'it':_0xf258('0x80')},'bankname':{'en':_0xf258('0x81'),'it':_0xf258('0x82')},'bankaddress':{'en':_0xf258('0x83'),'it':_0xf258('0x84')},'abi':{'en':'ABI','it':_0xf258('0x85')},'cab':{'en':'CAB','it':_0xf258('0x86')},'bic':{'en':'BIC','it':_0xf258('0x87')},'swif':{'en':_0xf258('0x88'),'it':'SWIF'},'iban':{'en':_0xf258('0x89'),'it':_0xf258('0x89')},'paypal':{'en':_0xf258('0x8a'),'it':_0xf258('0x8b')},'thank1':{'en':_0xf258('0x8c'),'it':'Grazie.\x20Prevediamo\x20il\x20pagamento\x20entro\x20'},'thank2':{'en':_0xf258('0x8d'),'it':'\x20quindi\x20vi\x20preghiamo\x20di\x20provvedere\x20entro\x20tale\x20termine.'}};var _0xe0f2a7='it';if(_0xc61900[_0xf258('0x55')][_0xf258('0x8e')]!==_0xf258('0x8f')){_0xe0f2a7='en';}_0xe741ef+='';_0xe741ef+=_0xf258('0x90')+_0x53b8f7+'\x22\x20width=\x22180\x22>';_0xe741ef+=_0xf258('0x91');_0xe741ef+=util['format'](_0xf258('0x92'),_0xc61900[_0xf258('0x55')][_0xf258('0x93')]);_0xe741ef+=util[_0xf258('0x53')](_0xf258('0x94'),_0xc61900[_0xf258('0x55')]['issuerStreet']);_0xe741ef+=util[_0xf258('0x53')]('%s',_0xc61900[_0xf258('0x55')][_0xf258('0x95')]);_0xe741ef+=util[_0xf258('0x53')](_0xf258('0x96'),_0xc61900[_0xf258('0x55')][_0xf258('0x97')]);_0xe741ef+=util[_0xf258('0x53')](_0xf258('0x98'),_0xc61900[_0xf258('0x55')][_0xf258('0x99')]);_0xe741ef+=util[_0xf258('0x53')](_0x47116f[_0xf258('0x9a')][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900[_0xf258('0x55')]['issuerPhone']);_0xe741ef+=util[_0xf258('0x53')](_0x47116f[_0xf258('0x9c')][_0xe0f2a7]+':\x20%s
',_0xc61900['proforma'][_0xf258('0x9d')]);_0xe741ef+=util['format'](_0x47116f[_0xf258('0x9e')][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900[_0xf258('0x55')][_0xf258('0x9f')]);_0xe741ef+=util[_0xf258('0x53')](_0x47116f[_0xf258('0xa0')][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900['proforma']['issuerPIVA']);_0xe741ef+=util['format'](_0x47116f['cf'][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900[_0xf258('0x55')][_0xf258('0xa1')]);_0xe741ef+=util[_0xf258('0x53')](_0x47116f[_0xf258('0xa2')][_0xe0f2a7]+':\x20%s
',_0xc61900['proforma'][_0xf258('0xa3')]);_0xe741ef+=util[_0xf258('0x53')](_0x47116f['cs'][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900['proforma']['issuerSocCap']);_0xe741ef+=_0xf258('0xa4');_0xe741ef+=_0xf258('0xa5');_0xe741ef+='';_0xe741ef+=util[_0xf258('0x53')](_0xf258('0xa6'),_0xc61900['proforma'][_0xf258('0xa7')]);_0xe741ef+=util['format']('%s
',_0xc61900['proforma'][_0xf258('0xa8')]);_0xe741ef+=util[_0xf258('0x53')](_0xf258('0xa9'),_0xc61900[_0xf258('0x55')][_0xf258('0xaa')]);_0xe741ef+=util[_0xf258('0x53')](_0xf258('0x94'),_0xc61900[_0xf258('0x55')][_0xf258('0xab')]);_0xe741ef+=util['format'](_0xf258('0x94'),_0xc61900[_0xf258('0x55')][_0xf258('0x8e')]);_0xe741ef+=util['format'](_0xf258('0xac')+_0x47116f['cf'][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900[_0xf258('0x55')][_0xf258('0xad')]);_0xe741ef+=util[_0xf258('0x53')](_0x47116f[_0xf258('0xa0')][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900[_0xf258('0x55')][_0xf258('0xae')]);_0xe741ef+=util[_0xf258('0x53')](_0x47116f[_0xf258('0xa2')][_0xe0f2a7]+_0xf258('0x9b'),_0xc61900[_0xf258('0x55')][_0xf258('0xaf')]);_0xe741ef+=_0xf258('0xb0');_0xe741ef+='';_0xe741ef+='
';_0xe741ef+=_0xf258('0xb1');_0xe741ef+=util[_0xf258('0x53')](_0xf258('0xb2')+_0x47116f[_0xf258('0x55')][_0xe0f2a7]+_0xf258('0xb3'),_0xc00890['id']);_0xe741ef+=util[_0xf258('0x53')](_0xf258('0xb4'),_0xc61900[_0xf258('0x55')][_0xf258('0x97')]);var _0x2a32ee=moment(_0xc61900[_0xf258('0x55')]['updatedAt'])[_0xf258('0x53')](_0xf258('0xb5'));_0xe741ef+=util[_0xf258('0x53')]('%s\x20',_0x2a32ee);var _0x35938f=moment(_0xc61900[_0xf258('0x55')]['updatedAt'])[_0xf258('0xb6')](_0xc61900[_0xf258('0x55')][_0xf258('0xb7')],_0xf258('0xb8'))[_0xf258('0x53')]('DD/MM/YYYY');_0xe741ef+=util['format'](_0xf258('0xb9')+_0x47116f[_0xf258('0xba')][_0xe0f2a7]+':\x20%s',_0x35938f);_0xe741ef+=_0xf258('0xbb');_0xe741ef+=_0xf258('0x91');_0xe741ef+=_0xf258('0xb1');_0xe741ef+='';_0xe741ef+=_0xf258('0x91');_0xe741ef+=_0xf258('0xbc')+_0x47116f['item'][_0xe0f2a7]+_0xf258('0xbd');_0xe741ef+=_0xf258('0xbc')+_0x47116f[_0xf258('0xbe')][_0xe0f2a7]+_0xf258('0xbd');_0xe741ef+=''+_0x47116f[_0xf258('0xbf')][_0xe0f2a7]+'';_0xe741ef+=_0xf258('0xbc')+_0x47116f[_0xf258('0xc0')][_0xe0f2a7]+_0xf258('0xbd');_0xe741ef+=_0xf258('0xbc')+_0x47116f[_0xf258('0xc1')][_0xe0f2a7]+_0xf258('0xbd');_0xe741ef+=_0xf258('0xbb');var _0x229be5=0x0;var _0x3986e6=0x0;for(var _0x2486c6=0x0;_0x2486c6<_0xc61900[_0xf258('0x57')][_0xf258('0x2e')];_0x2486c6++){var _0x2f6fd6=0x0;var _0x3e7077=0x0;var _0x3be318=0x0;var _0x1dfdfa=0x0;_0x2f6fd6=_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc2')]-_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc2')]/0x64*_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc3')];_0x3e7077=_0x2f6fd6/0x64*_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc4')];_0x3be318=_0x2f6fd6*_0xc61900[_0xf258('0x57')][_0x2486c6]['quantity'];_0x1dfdfa=_0x3e7077*_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc5')];_0xe741ef+=_0xf258('0x91');_0xe741ef+=util[_0xf258('0x53')](_0xf258('0xc6'),_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc7')]);_0xe741ef+=util[_0xf258('0x53')]('',_0xc61900[_0xf258('0x57')][_0x2486c6]['productDescription']);_0xe741ef+=util['format']('%d',_0xc61900[_0xf258('0x57')][_0x2486c6][_0xf258('0xc5')]);_0xe741ef+=_0xf258('0xc8')+_0x2f6fd6[_0xf258('0xc9')](0x2)+_0xf258('0xca');_0xe741ef+=''+_0x3be318[_0xf258('0xc9')](0x2)+_0xf258('0xca');_0xe741ef+=_0xf258('0xbb');_0x229be5+=_0x3be318;_0x3986e6+=_0x1dfdfa;}_0xe741ef+=_0xf258('0xcb');if(!_[_0xf258('0xcc')](_0xc61900[_0xf258('0x55')][_0xf258('0xc3')])){var _0x3e2348=0x0;var _0x36122d=0x0;var _0xfa4724=_0xc61900['proforma'][_0xf258('0xc3')]*0x64/_0x229be5;for(var _0x2486c6=0x0;_0x2486c6<_0xc61900[_0xf258('0x57')][_0xf258('0x2e')];_0x2486c6++){var _0x198467=0x0;var _0x47f3b6=0x0;var _0x20ad50=0x0;_0x2f6fd6=_0xc61900['details'][_0x2486c6][_0xf258('0xc2')]-_0xc61900['details'][_0x2486c6][_0xf258('0xc2')]/0x64*_0xc61900['details'][_0x2486c6][_0xf258('0xc3')];_0x198467=_0x2f6fd6/0x64*_0xfa4724;_0x47f3b6=_0x2f6fd6-_0x198467;_0x20ad50=_0x47f3b6*_0xc61900[_0xf258('0x57')][_0x2486c6]['quantity'];_0x3e2348+=_0x20ad50;_0x36122d+=_0x20ad50/0x64*_0xc61900[_0xf258('0x57')][_0x2486c6]['tax'];}}var _0x1b37a6=0x0;var _0x54117e=0x0;var _0xbe204f=![];var _0x66b206=_0xc61900['proforma'][_0xf258('0xcd')];if(_0x66b206[_0xf258('0xce')](_0xf258('0xcf'))!=-0x1){_0xbe204f=!![];}if(!_[_0xf258('0xcc')](_0xc61900[_0xf258('0x55')]['discount'])){_0xe741ef+='';if(_0xc61900['proforma'][_0xf258('0xc3')]>0x0){_0xe741ef+=_0xf258('0xd0')+_0x47116f[_0xf258('0xc3')][_0xe0f2a7]+_0xf258('0xa4');_0xe741ef+=_0xf258('0xc8')+_0xc61900['proforma'][_0xf258('0xc3')][_0xf258('0xc9')](0x2)+_0xf258('0xca');}_0xe741ef+=_0xf258('0xbb');_0x1b37a6=_0x36122d;_0x54117e=_0x3e2348;}else{_0x1b37a6=_0x3986e6;_0x54117e=_0x229be5;}if(_0x1b37a6>0x0||_0xc61900['proforma'][_0xf258('0xc3')]>0x0){_0xe741ef+=_0xf258('0x91');_0xe741ef+=_0xf258('0xd1')+_0x47116f[_0xf258('0xd2')][_0xe0f2a7]+_0xf258('0xa4');_0xe741ef+=_0xf258('0xc8')+_0x54117e[_0xf258('0xc9')](0x2)+'\x20€';_0xe741ef+=_0xf258('0xbb');}if(_0x1b37a6>0x0){_0xe741ef+=_0xf258('0x91');_0xe741ef+=_0xf258('0xd1')+_0x47116f['tax'][_0xe0f2a7]+_0xf258('0xa4');_0xe741ef+=_0xf258('0xc8')+_0x1b37a6[_0xf258('0xc9')](0x2)+_0xf258('0xca');_0xe741ef+=_0xf258('0xbb');}_0xe741ef+=_0xf258('0x91');var _0x2a26f1;if(_0xbe204f){_0x2a26f1=_0x54117e;}else{_0x2a26f1=_0x54117e+_0x1b37a6;}_0xe741ef+=_0xf258('0xd3')+_0x47116f['nettopay'][_0xe0f2a7]+_0xf258('0xd4')+_0x2a26f1[_0xf258('0xc9')](0x2)+_0xf258('0xca');_0xe741ef+=_0xf258('0xd5');_0xe741ef+=_0xf258('0xbb');_0xe741ef+=_0xf258('0xd6');_0xe741ef+=_0xf258('0xd7');_0xe741ef+=_0xf258('0x91');_0xe741ef+=util['format'](_0xf258('0xd8'),_0xc61900['proforma'][_0xf258('0xcd')][_0xf258('0xd9')](new RegExp(String['fromCharCode'](0xd),'g'),_0xf258('0xda')));_0xe741ef+=_0xf258('0xbb');_0xe741ef+=_0xf258('0x91');_0xe741ef+=_0xf258('0xb1');_0xe741ef+=_0xf258('0xdb')+_0x47116f[_0xf258('0xdc')][_0xe0f2a7]+_0xf258('0x61');if(!_['isNil'](_0xc61900[_0xf258('0x55')][_0xf258('0xdd')])){_0xe741ef+=_0xf258('0xdb')+_0x47116f[_0xf258('0xde')][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900[_0xf258('0x55')][_0xf258('0xdd')]+'';_0xe741ef+=_0xf258('0xdb')+_0x47116f[_0xf258('0xe0')][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900[_0xf258('0x55')][_0xf258('0xe1')]+_0xf258('0xe2');_0xe741ef+=''+_0x47116f[_0xf258('0xe3')][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900[_0xf258('0x55')][_0xf258('0xe4')]+',\x20'+_0xc61900[_0xf258('0x55')][_0xf258('0xe5')]+_0xf258('0xe6')+_0xc61900['proforma'][_0xf258('0xe7')]+'\x20('+_0xc61900[_0xf258('0x55')][_0xf258('0xe8')]+')'+_0xf258('0xe9');_0xe741ef+=''+_0x47116f[_0xf258('0xea')][_0xe0f2a7]+'/'+_0x47116f[_0xf258('0xeb')][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900[_0xf258('0x55')][_0xf258('0xec')]+'/'+_0xc61900[_0xf258('0x55')][_0xf258('0xed')]+_0xf258('0xe9');_0xe741ef+=''+_0x47116f['bic'][_0xe0f2a7]+'/'+_0x47116f[_0xf258('0xee')][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900['proforma'][_0xf258('0xef')]+_0xf258('0xe9');_0xe741ef+=_0xf258('0xdb')+_0x47116f['iban'][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900['proforma']['issuerBankIBAN']+_0xf258('0xe9');}if(!_[_0xf258('0xcc')](_0xc61900[_0xf258('0x55')][_0xf258('0xf0')])){_0xe741ef+=_0xf258('0xdb')+_0x47116f['paypal'][_0xe0f2a7]+_0xf258('0xdf')+_0xc61900[_0xf258('0x55')][_0xf258('0xf0')]+_0xf258('0xe9');}_0xe741ef+=''+_0x47116f[_0xf258('0xf1')][_0xe0f2a7]+_0xf258('0xf2')+_0x35938f+''+_0x47116f[_0xf258('0xf3')][_0xe0f2a7]+_0xf258('0x61');_0xe741ef+=_0xf258('0xa4');_0xe741ef+=_0xf258('0xbb');if(_0xc61900[_0xf258('0x55')][_0xf258('0xf4')]===0x1){_0xe741ef+=_0xf258('0x90')+_0x4f7c16+_0xf258('0xf5');}_0xe741ef+='
%s
';_0xe741ef+=_0xf258('0xf6');_0xe741ef+=_0xf258('0xf7');return new BPromise(function(_0x1b0cce,_0xe1db47){pdf['create'](_0xe741ef,_0x3d20ab)[_0xf258('0xf8')](path[_0xf258('0x4a')](_0x26b81a,_0xa8efea),function(_0x2895b1,_0xa1c6a0){if(_0x2895b1)return _0xe1db47(_0x2895b1);_0x1b0cce(_0xa1c6a0);});});});}})[_0xf258('0x1e')](function(){if(_0x4a2af3){console[_0xf258('0xf9')](_0xf258('0xfa'),_0x3f27d6,_0xa8efea);return _0x21956f[_0xf258('0xfb')](_0x3f27d6,_0xa8efea,function(_0x5af8bd){if(_0x5af8bd){console[_0xf258('0xf9')](_0xf258('0xfc'),_0x5af8bd);}else{console[_0xf258('0xf9')]('foldername',_0x26b81a);rimraf(_0x26b81a,function(){});}});}else{return _0x21956f[_0xf258('0x13')](0xc8);}})[_0xf258('0x3f')](handleError(_0x21956f,null));};function addCloneDetail(_0x1f044b,_0x416e26,_0x2a8a6b){console['log'](_0xf258('0xfd'),_0x1f044b);_0x1f044b[_0xf258('0xfe')]=_0x416e26;delete _0x1f044b['id'];return db[_0xf258('0x56')][_0xf258('0x44')](_0x1f044b,{'transaction':_0x2a8a6b});}exports[_0xf258('0xff')]=function(_0x4d4adf,_0x5dc1e8,_0x4f31c9){var _0x36658a;if(_0x4d4adf[_0xf258('0x45')]['id']){delete _0x4d4adf[_0xf258('0x45')]['id'];}console[_0xf258('0xf9')](_0xf258('0x100'),_0x4d4adf[_0xf258('0x41')]['id']);return db[_0xf258('0x101')][_0xf258('0x102')](function(_0x2348b9){return db[_0xf258('0x3c')][_0xf258('0x44')](_0x4d4adf[_0xf258('0x45')],{'transaction':_0x2348b9,'logging':console[_0xf258('0xf9')]})[_0xf258('0x1e')](function(_0x214216){console['log'](_0xf258('0x103'),_0x214216);_0x36658a=_0x214216;var _0x47fa94=_0x4d4adf[_0xf258('0x41')]['id'];return db[_0xf258('0x56')][_0xf258('0x3d')]({'where':{'ProformaId':_0x47fa94},'raw':!![]});})['then'](function(_0x3c01ed){console[_0xf258('0xf9')](_0xf258('0x104'),_0x3c01ed);if(_0x3c01ed['length']>0x0){var _0x5ad893=[];for(var _0xd63247=0x0;_0xd63247<_0x3c01ed[_0xf258('0x2e')];_0xd63247++){_0x5ad893[_0xf258('0x105')](addCloneDetail(_0x3c01ed[_0xd63247],_0x36658a['id'],_0x2348b9));}return BPromise['all'](_0x5ad893);}else{var _0x634221={'errors':[{'type':_0xf258('0x106'),'message':_0xf258('0x107')}]};throw _0x634221;}});})[_0xf258('0x1e')](function(){return _0x5dc1e8['sendStatus'](0xc8);})[_0xf258('0x3f')](function(_0x50a7ac){console[_0xf258('0xf9')](_0xf258('0x108'),_0x50a7ac);if(_0x50a7ac['name']==='SequelizeUniqueConstraintError'){var _0x50a7ac={'errors':[{'message':_0xf258('0x109')}]};}_0x5dc1e8['status'](0x1f4)['send'](_0x50a7ac);});}; \ No newline at end of file diff --git a/server/api/saProforma/saProforma.model.js b/server/api/saProforma/saProforma.model.js index d96def8..d5220aa 100644 --- a/server/api/saProforma/saProforma.model.js +++ b/server/api/saProforma/saProforma.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4538=['path','rimraf','../../config/environment','./saProforma.attributes','exports','define','SAProforma','sa_proformas','api','moment','request-promise'];(function(_0x5ae14c,_0x23d808){var _0x17c638=function(_0x30aa67){while(--_0x30aa67){_0x5ae14c['push'](_0x5ae14c['shift']());}};_0x17c638(++_0x23d808);}(_0x4538,0xce));var _0x8453=function(_0x1d4526,_0x444a20){_0x1d4526=_0x1d4526-0x0;var _0x551d4c=_0x4538[_0x1d4526];return _0x551d4c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8453('0x0'));var moment=require(_0x8453('0x1'));var BPromise=require('bluebird');var rp=require(_0x8453('0x2'));var fs=require('fs');var path=require(_0x8453('0x3'));var rimraf=require(_0x8453('0x4'));var config=require(_0x8453('0x5'));var attributes=require(_0x8453('0x6'));module[_0x8453('0x7')]=function(_0x4fd4e3,_0x272560){return _0x4fd4e3[_0x8453('0x8')](_0x8453('0x9'),attributes,{'tableName':_0x8453('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x692e=['request-promise','rimraf','../../config/environment','exports','define','SAProforma','lodash','../../config/logger','moment'];(function(_0x1261ad,_0x616968){var _0x5ac02c=function(_0x241e37){while(--_0x241e37){_0x1261ad['push'](_0x1261ad['shift']());}};_0x5ac02c(++_0x616968);}(_0x692e,0x96));var _0xe692=function(_0x16bff0,_0x3a777a){_0x16bff0=_0x16bff0-0x0;var _0x378812=_0x692e[_0x16bff0];return _0x378812;};'use strict';var _=require(_0xe692('0x0'));var util=require('util');var logger=require(_0xe692('0x1'))('api');var moment=require(_0xe692('0x2'));var BPromise=require('bluebird');var rp=require(_0xe692('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe692('0x4'));var config=require(_0xe692('0x5'));var attributes=require('./saProforma.attributes');module[_0xe692('0x6')]=function(_0x40399e,_0x29cd91){return _0x40399e[_0xe692('0x7')](_0xe692('0x8'),attributes,{'tableName':'sa_proformas','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saProforma/saProforma.rpc.js b/server/api/saProforma/saProforma.rpc.js index fe44090..795684e 100644 --- a/server/api/saProforma/saProforma.rpc.js +++ b/server/api/saProforma/saProforma.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67b0=['../../config/environment','jayson/promise','client','http','request','then','info','SAProforma,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x29a278,_0xd7edee){var _0x3e9787=function(_0x38dff7){while(--_0x38dff7){_0x29a278['push'](_0x29a278['shift']());}};_0x3e9787(++_0xd7edee);}(_0x67b0,0x1ee));var _0x067b=function(_0x56de16,_0x95833b){_0x56de16=_0x56de16-0x0;var _0x39c7d5=_0x67b0[_0x56de16];return _0x39c7d5;};'use strict';var _=require(_0x067b('0x0'));var util=require(_0x067b('0x1'));var moment=require(_0x067b('0x2'));var BPromise=require(_0x067b('0x3'));var rs=require(_0x067b('0x4'));var fs=require('fs');var Redis=require(_0x067b('0x5'));var db=require(_0x067b('0x6'))['db'];var utils=require(_0x067b('0x7'));var logger=require(_0x067b('0x8'))(_0x067b('0x9'));var config=require(_0x067b('0xa'));var jayson=require(_0x067b('0xb'));var client=jayson[_0x067b('0xc')][_0x067b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x8895d5,_0x4b1fce,_0xb7210c){return new BPromise(function(_0x14832a,_0x524475){return client[_0x067b('0xe')](_0x8895d5,_0xb7210c)[_0x067b('0xf')](function(_0x27cfbd){logger[_0x067b('0x10')](_0x067b('0x11'),_0x4b1fce,'request\x20sent');logger[_0x067b('0x12')]('SAProforma,\x20%s,\x20%s,\x20%s',_0x4b1fce,_0x067b('0x13'),JSON[_0x067b('0x14')](_0x27cfbd));if(_0x27cfbd[_0x067b('0x15')]){if(_0x27cfbd['error'][_0x067b('0x16')]===0x1f4){logger[_0x067b('0x15')](_0x067b('0x11'),_0x4b1fce,_0x27cfbd[_0x067b('0x15')][_0x067b('0x17')]);return _0x524475(_0x27cfbd[_0x067b('0x15')][_0x067b('0x17')]);}logger[_0x067b('0x15')](_0x067b('0x11'),_0x4b1fce,_0x27cfbd[_0x067b('0x15')][_0x067b('0x17')]);return _0x14832a(_0x27cfbd['error'][_0x067b('0x17')]);}else{logger['info'](_0x067b('0x11'),_0x4b1fce,_0x067b('0x13'));_0x14832a(_0x27cfbd['result'][_0x067b('0x17')]);}})['catch'](function(_0x516b26){logger[_0x067b('0x15')]('SAProforma,\x20%s,\x20%s',_0x4b1fce,_0x516b26);_0x524475(_0x516b26);});});} \ No newline at end of file +var _0x9a1f=['SAProforma,\x20%s,\x20%s','request\x20sent','SAProforma,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1cfc39,_0x1d3913){var _0x957a28=function(_0x2be930){while(--_0x2be930){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x957a28(++_0x1d3913);}(_0x9a1f,0x183));var _0xf9a1=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x9a1f[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0xf9a1('0x0'));var util=require(_0xf9a1('0x1'));var moment=require('moment');var BPromise=require(_0xf9a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9a1('0x4'));var logger=require(_0xf9a1('0x5'))(_0xf9a1('0x6'));var config=require(_0xf9a1('0x7'));var jayson=require(_0xf9a1('0x8'));var client=jayson[_0xf9a1('0x9')][_0xf9a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34a51f,_0x340ea9,_0x2c5d51){return new BPromise(function(_0x3af871,_0x219b39){return client[_0xf9a1('0xb')](_0x34a51f,_0x2c5d51)['then'](function(_0x3c5cca){logger[_0xf9a1('0xc')](_0xf9a1('0xd'),_0x340ea9,_0xf9a1('0xe'));logger['debug'](_0xf9a1('0xf'),_0x340ea9,_0xf9a1('0xe'),JSON[_0xf9a1('0x10')](_0x3c5cca));if(_0x3c5cca[_0xf9a1('0x11')]){if(_0x3c5cca[_0xf9a1('0x11')][_0xf9a1('0x12')]===0x1f4){logger[_0xf9a1('0x11')](_0xf9a1('0xd'),_0x340ea9,_0x3c5cca[_0xf9a1('0x11')][_0xf9a1('0x13')]);return _0x219b39(_0x3c5cca[_0xf9a1('0x11')][_0xf9a1('0x13')]);}logger[_0xf9a1('0x11')]('SAProforma,\x20%s,\x20%s',_0x340ea9,_0x3c5cca[_0xf9a1('0x11')][_0xf9a1('0x13')]);return _0x3af871(_0x3c5cca['error'][_0xf9a1('0x13')]);}else{logger[_0xf9a1('0xc')](_0xf9a1('0xd'),_0x340ea9,_0xf9a1('0xe'));_0x3af871(_0x3c5cca['result'][_0xf9a1('0x13')]);}})['catch'](function(_0x5f3342){logger['error'](_0xf9a1('0xd'),_0x340ea9,_0x5f3342);_0x219b39(_0x5f3342);});});} \ No newline at end of file diff --git a/server/api/saProformaDetail/index.js b/server/api/saProformaDetail/index.js index 2da0a4a..b4b7c42 100644 --- a/server/api/saProformaDetail/index.js +++ b/server/api/saProformaDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./saProformaDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','automaticProformaInvoice'];(function(_0x3683ae,_0x4f4fa7){var _0x507e09=function(_0x5e1d1a){while(--_0x5e1d1a){_0x3683ae['push'](_0x3683ae['shift']());}};_0x507e09(++_0x4f4fa7);}(_0xb10b,0x12a));var _0xbb10=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xb10b[_0x50b1c5];return _0x344f99;};'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['post']('/:id/automaticProformaInvoice',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['update']);router[_0xbb10('0x12')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x13')]);module[_0xbb10('0x14')]=router; \ No newline at end of file +var _0xb10b=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./saProformaDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','automaticProformaInvoice'];(function(_0x44471c,_0x193efc){var _0x350549=function(_0x1ee9c2){while(--_0x1ee9c2){_0x44471c['push'](_0x44471c['shift']());}};_0x350549(++_0x193efc);}(_0xb10b,0x12a));var _0xbb10=function(_0x389a03,_0x380e6c){_0x389a03=_0x389a03-0x0;var _0xaf19ea=_0xb10b[_0x389a03];return _0xaf19ea;};'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['post']('/:id/automaticProformaInvoice',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['update']);router[_0xbb10('0x12')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x13')]);module[_0xbb10('0x14')]=router; \ No newline at end of file diff --git a/server/api/saProformaDetail/saProformaDetail.attributes.js b/server/api/saProformaDetail/saProformaDetail.attributes.js index 75e1774..27c7c5b 100644 --- a/server/api/saProformaDetail/saProformaDetail.attributes.js +++ b/server/api/saProformaDetail/saProformaDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44d9=['TEXT','long','INTEGER','DECIMAL','sequelize','exports','STRING'];(function(_0x67220c,_0xa26c22){var _0x3e78cc=function(_0x432e96){while(--_0x432e96){_0x67220c['push'](_0x67220c['shift']());}};_0x3e78cc(++_0xa26c22);}(_0x44d9,0x14d));var _0x944d=function(_0x18a8ff,_0x3f8c85){_0x18a8ff=_0x18a8ff-0x0;var _0x33467a=_0x44d9[_0x18a8ff];return _0x33467a;};'use strict';var Sequelize=require(_0x944d('0x0'));module[_0x944d('0x1')]={'companyName':{'type':Sequelize[_0x944d('0x2')],'allowNull':![]},'companyId':{'type':Sequelize['INTEGER'],'allowNull':![]},'productName':{'type':Sequelize[_0x944d('0x3')],'allowNull':![]},'productCode':{'type':Sequelize[_0x944d('0x2')],'allowNull':![]},'productDescription':{'type':Sequelize[_0x944d('0x3')](_0x944d('0x4'))+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci'},'typeName':{'type':Sequelize[_0x944d('0x2')],'allowNull':![]},'unitName':{'type':Sequelize[_0x944d('0x2')]},'pricelistName':{'type':Sequelize[_0x944d('0x3')],'allowNull':![]},'priceListId':{'type':Sequelize[_0x944d('0x5')],'allowNull':![]},'netPrice':{'type':Sequelize[_0x944d('0x6')](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0x944d('0x6')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0x944d('0x6')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0x944d('0x2')],'allowNull':![]},'note':{'type':Sequelize[_0x944d('0x3')]},'subscriptionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0x944d('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0x944d('0x5')],'allowNull':![]},'quantity':{'type':Sequelize[_0x944d('0x5')],'allowNull':![]},'ProductQuotationId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8cfe=['STRING','TEXT','long','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','INTEGER','DECIMAL','sequelize','exports'];(function(_0x4bb2b1,_0x37e6f1){var _0x5c3081=function(_0x639e99){while(--_0x639e99){_0x4bb2b1['push'](_0x4bb2b1['shift']());}};_0x5c3081(++_0x37e6f1);}(_0x8cfe,0x6e));var _0xe8cf=function(_0x39aa30,_0x12dec8){_0x39aa30=_0x39aa30-0x0;var _0x1b1fa6=_0x8cfe[_0x39aa30];return _0x1b1fa6;};'use strict';var Sequelize=require(_0xe8cf('0x0'));module[_0xe8cf('0x1')]={'companyName':{'type':Sequelize[_0xe8cf('0x2')],'allowNull':![]},'companyId':{'type':Sequelize['INTEGER'],'allowNull':![]},'productName':{'type':Sequelize[_0xe8cf('0x3')],'allowNull':![]},'productCode':{'type':Sequelize['STRING'],'allowNull':![]},'productDescription':{'type':Sequelize[_0xe8cf('0x3')](_0xe8cf('0x4'))+_0xe8cf('0x5')},'typeName':{'type':Sequelize['STRING'],'allowNull':![]},'unitName':{'type':Sequelize['STRING']},'pricelistName':{'type':Sequelize[_0xe8cf('0x3')],'allowNull':![]},'priceListId':{'type':Sequelize[_0xe8cf('0x6')],'allowNull':![]},'netPrice':{'type':Sequelize['DECIMAL'](0xd,0x4),'allowNull':![]},'discount':{'type':Sequelize[_0xe8cf('0x7')](0x6,0x3),'allowNull':![]},'tax':{'type':Sequelize[_0xe8cf('0x7')](0xd,0x4),'allowNull':![]},'agentFullname':{'type':Sequelize[_0xe8cf('0x2')],'allowNull':![]},'note':{'type':Sequelize[_0xe8cf('0x3')]},'subscriptionId':{'type':Sequelize[_0xe8cf('0x6')],'allowNull':![]},'subscriptionName':{'type':Sequelize[_0xe8cf('0x2')],'allowNull':![]},'subscriptionMonthly':{'type':Sequelize[_0xe8cf('0x6')],'allowNull':![]},'quantity':{'type':Sequelize[_0xe8cf('0x6')],'allowNull':![]},'ProductQuotationId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/saProformaDetail/saProformaDetail.controller.js b/server/api/saProformaDetail/saProformaDetail.controller.js index c1df263..1d6912c 100644 --- a/server/api/saProformaDetail/saProformaDetail.controller.js +++ b/server/api/saProformaDetail/saProformaDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7928=['set','Content-Range','reject','save','update','destroy','error','name','index','SAProformaDetail','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','field','options','then','includeAll','findAll','catch','show','params','include','find','create','body','describe','log','addProformaInvoiceDetail->>','companyName','companyId','productName','productCode','productDescription','typeName','pricelistName','netPrice','discount','tax','agentFullname','note','subscriptionId','subscriptionName','subscriptionMonthly','quantity','SAInvoiceDetail','SAProductQuotation','automaticProformaInvoice','WARNING','No\x20product\x20to\x20assign\x20invoice.\x20Invoice\x20not\x20created!!\x20','TCL:\x20exports.automaticProformaInvoice\x20->\x20err','SequelizeUniqueConstraintError','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x85cfa1,_0xcfff0b){var _0x420781=function(_0x576585){while(--_0x576585){_0x85cfa1['push'](_0x85cfa1['shift']());}};_0x420781(++_0xcfff0b);}(_0x7928,0x1d8));var _0x8792=function(_0x2fcfe2,_0x1e60d6){_0x2fcfe2=_0x2fcfe2-0x0;var _0x109d4f=_0x7928[_0x2fcfe2];return _0x109d4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8792('0x0'));var rimraf=require(_0x8792('0x1'));var zipdir=require(_0x8792('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8792('0x3'));var moment=require(_0x8792('0x4'));var BPromise=require(_0x8792('0x5'));var Mustache=require(_0x8792('0x6'));var util=require(_0x8792('0x7'));var path=require(_0x8792('0x8'));var sox=require(_0x8792('0x9'));var csv=require(_0x8792('0xa'));var ejs=require(_0x8792('0xb'));var fs=require('fs');var _=require(_0x8792('0xc'));var squel=require(_0x8792('0xd'));var crypto=require(_0x8792('0xe'));var jsforce=require(_0x8792('0xf'));var deskjs=require(_0x8792('0x10'));var toCsv=require(_0x8792('0xa'));var querystring=require(_0x8792('0x11'));var Papa=require(_0x8792('0x12'));var Redis=require(_0x8792('0x13'));var authService=require(_0x8792('0x14'));var qs=require(_0x8792('0x15'));var hardwareService=require(_0x8792('0x16'));var logger=require(_0x8792('0x17'))(_0x8792('0x18'));var utils=require(_0x8792('0x19'));var config=require('../../config/environment');var db=require(_0x8792('0x1a'))['db'];function respondWithStatusCode(_0x4c59a9,_0x4a3207){_0x4a3207=_0x4a3207||0xcc;return function(_0x10e16b){if(_0x10e16b){return _0x4c59a9[_0x8792('0x1b')](_0x4a3207);}return _0x4c59a9['status'](_0x4a3207)[_0x8792('0x1c')]();};}function respondWithResult(_0x3c4c7a,_0xf73ec0){_0xf73ec0=_0xf73ec0||0xc8;return function(_0x2ca720){if(_0x2ca720){return _0x3c4c7a[_0x8792('0x1d')](_0xf73ec0)[_0x8792('0x1e')](_0x2ca720);}};}function respondWithFilteredResult(_0x15bd47,_0x40136e){return function(_0x193715){if(_0x193715){var _0x2e15ab=_0x193715[_0x8792('0x1f')],_0x3cdd86=_0x40136e[_0x8792('0x20')],_0x1020ab=_0x40136e['offset']+_0x40136e['limit'],_0x3f822a;if(_0x1020ab>=_0x2e15ab){_0x1020ab=_0x2e15ab;_0x3f822a=0xc8;}else{_0x3f822a=0xce;}_0x15bd47[_0x8792('0x1d')](_0x3f822a);return _0x15bd47[_0x8792('0x21')](_0x8792('0x22'),_0x3cdd86+'-'+_0x1020ab+'/'+_0x2e15ab)[_0x8792('0x1e')](_0x193715);}return null;};}function patchUpdates(_0x1a6474){return function(_0x338766){try{jsonpatch['apply'](_0x338766,_0x1a6474,!![]);}catch(_0x4710b8){return BPromise[_0x8792('0x23')](_0x4710b8);}return _0x338766[_0x8792('0x24')]();};}function saveUpdates(_0x54c337,_0x3ab0f5){return function(_0x29808d){if(_0x29808d){return _0x29808d[_0x8792('0x25')](_0x54c337)['then'](function(_0x447c44){return _0x447c44;});}return null;};}function removeEntity(_0x36b1ce,_0xc9483b){return function(_0x1ec4f7){if(_0x1ec4f7){return _0x1ec4f7[_0x8792('0x26')]()['then'](function(){_0x36b1ce[_0x8792('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0406,_0x4e8d98){return function(_0x48f506){if(!_0x48f506){_0x5b0406['sendStatus'](0x194);}return _0x48f506;};}function handleError(_0x34fc2a,_0x1863b5){_0x1863b5=_0x1863b5||0x1f4;return function(_0x1ac265){logger[_0x8792('0x27')](_0x1ac265['stack']);if(_0x1ac265[_0x8792('0x28')]){delete _0x1ac265[_0x8792('0x28')];}_0x34fc2a[_0x8792('0x1d')](_0x1863b5)['send'](_0x1ac265);};}exports[_0x8792('0x29')]=function(_0x41caa8,_0x2690ee){var _0x203629={},_0x46bca0={},_0x3f3e2c={'count':0x0,'rows':[]};var _0x2a41a7=db[_0x8792('0x2a')][_0x8792('0x2b')];_0x46bca0[_0x8792('0x2c')]=_[_0x8792('0x2d')](_0x2a41a7);_0x46bca0['query']=_[_0x8792('0x2d')](_0x41caa8['query']);_0x46bca0[_0x8792('0x2e')]=_[_0x8792('0x2f')](_0x46bca0['model'],_0x46bca0[_0x8792('0x30')]);_0x203629[_0x8792('0x31')]=_['intersection'](_0x46bca0['model'],qs[_0x8792('0x32')](_0x41caa8[_0x8792('0x30')]['fields']));_0x203629[_0x8792('0x31')]=_0x203629['attributes'][_0x8792('0x33')]?_0x203629[_0x8792('0x31')]:_0x46bca0[_0x8792('0x2c')];if(!_0x41caa8[_0x8792('0x30')][_0x8792('0x34')](_0x8792('0x35'))){_0x203629['limit']=qs[_0x8792('0x36')](_0x41caa8['query'][_0x8792('0x36')]);_0x203629['offset']=qs[_0x8792('0x20')](_0x41caa8[_0x8792('0x30')][_0x8792('0x20')]);}_0x203629['order']=qs['sort'](_0x41caa8[_0x8792('0x30')][_0x8792('0x37')]);_0x203629[_0x8792('0x38')]=qs[_0x8792('0x2e')](_[_0x8792('0x39')](_0x41caa8[_0x8792('0x30')],_0x46bca0[_0x8792('0x2e')]));if(_0x41caa8['query'][_0x8792('0x3a')]){_0x203629[_0x8792('0x38')]=_[_0x8792('0x3b')](_0x203629['where'],{'$or':_['map'](_0x2a41a7,function(_0x40914e){if(_0x40914e[_0x8792('0x3c')]['key']!==_0x8792('0x3d')){var _0x5a2a1e={};_0x5a2a1e[_0x40914e[_0x8792('0x3e')]]={'$like':'%'+_0x41caa8[_0x8792('0x30')][_0x8792('0x3a')]+'%'};return _0x5a2a1e;}})});}_0x203629=_['merge']({},_0x203629,_0x41caa8[_0x8792('0x3f')]);var _0x441af5={'where':_0x203629[_0x8792('0x38')]};return db[_0x8792('0x2a')][_0x8792('0x1f')](_0x441af5)[_0x8792('0x40')](function(_0x4f1885){_0x3f3e2c[_0x8792('0x1f')]=_0x4f1885;if(_0x41caa8[_0x8792('0x30')][_0x8792('0x41')]){_0x203629['include']=[{'all':!![]}];}return db[_0x8792('0x2a')][_0x8792('0x42')](_0x203629);})[_0x8792('0x40')](function(_0x1bed19){_0x3f3e2c['rows']=_0x1bed19;return _0x3f3e2c;})[_0x8792('0x40')](respondWithFilteredResult(_0x2690ee,_0x203629))[_0x8792('0x43')](handleError(_0x2690ee,null));};exports[_0x8792('0x44')]=function(_0x4788d7,_0x1caa12){var _0x308948={'raw':![],'where':{'id':_0x4788d7[_0x8792('0x45')]['id']}},_0x15408e={};_0x15408e[_0x8792('0x2c')]=_[_0x8792('0x2d')](db[_0x8792('0x2a')][_0x8792('0x2b')]);_0x15408e[_0x8792('0x30')]=_[_0x8792('0x2d')](_0x4788d7[_0x8792('0x30')]);_0x15408e['filters']=_[_0x8792('0x2f')](_0x15408e[_0x8792('0x2c')],_0x15408e[_0x8792('0x30')]);_0x308948[_0x8792('0x31')]=_[_0x8792('0x2f')](_0x15408e[_0x8792('0x2c')],qs[_0x8792('0x32')](_0x4788d7[_0x8792('0x30')][_0x8792('0x32')]));_0x308948[_0x8792('0x31')]=_0x308948['attributes'][_0x8792('0x33')]?_0x308948[_0x8792('0x31')]:_0x15408e[_0x8792('0x2c')];if(_0x4788d7[_0x8792('0x30')][_0x8792('0x41')]){_0x308948[_0x8792('0x46')]=[{'all':!![]}];}_0x308948=_[_0x8792('0x3b')]({},_0x308948,_0x4788d7[_0x8792('0x3f')]);return db[_0x8792('0x2a')][_0x8792('0x47')](_0x308948)[_0x8792('0x40')](handleEntityNotFound(_0x1caa12,null))[_0x8792('0x40')](respondWithResult(_0x1caa12,null))[_0x8792('0x43')](handleError(_0x1caa12,null));};exports['create']=function(_0x4c42d6,_0x5c3e19){return db['SAProformaDetail'][_0x8792('0x48')](_0x4c42d6[_0x8792('0x49')],{})[_0x8792('0x40')](respondWithResult(_0x5c3e19,0xc9))[_0x8792('0x43')](handleError(_0x5c3e19,null));};exports[_0x8792('0x25')]=function(_0x1b3ed,_0x57cba3){if(_0x1b3ed[_0x8792('0x49')]['id']){delete _0x1b3ed[_0x8792('0x49')]['id'];}return db[_0x8792('0x2a')][_0x8792('0x47')]({'where':{'id':_0x1b3ed[_0x8792('0x45')]['id']}})[_0x8792('0x40')](handleEntityNotFound(_0x57cba3,null))[_0x8792('0x40')](saveUpdates(_0x1b3ed[_0x8792('0x49')],null))[_0x8792('0x40')](respondWithResult(_0x57cba3,null))[_0x8792('0x43')](handleError(_0x57cba3,null));};exports[_0x8792('0x26')]=function(_0x376e87,_0x2bdb88){return db[_0x8792('0x2a')]['find']({'where':{'id':_0x376e87[_0x8792('0x45')]['id']}})[_0x8792('0x40')](handleEntityNotFound(_0x2bdb88,null))[_0x8792('0x40')](removeEntity(_0x2bdb88,null))[_0x8792('0x43')](handleError(_0x2bdb88,null));};exports[_0x8792('0x4a')]=function(_0x2f83cd,_0x95ad68){return db['SAProformaDetail'][_0x8792('0x4a')]()[_0x8792('0x40')](respondWithResult(_0x95ad68,null))[_0x8792('0x43')](handleError(_0x95ad68,null));};function addProformaInvoiceDetail(_0x476218,_0x1d7869,_0x2cdd8b){console[_0x8792('0x4b')](_0x8792('0x4c'),_0x476218);var _0x5c661d={'companyName':_0x476218[_0x8792('0x4d')],'companyId':_0x476218[_0x8792('0x4e')],'productName':_0x476218[_0x8792('0x4f')],'productCode':_0x476218[_0x8792('0x50')],'productDescription':_0x476218[_0x8792('0x51')],'typeName':_0x476218[_0x8792('0x52')],'pricelistName':_0x476218[_0x8792('0x53')],'priceListId':_0x476218['priceListId'],'netPrice':_0x476218[_0x8792('0x54')],'discount':_0x476218[_0x8792('0x55')],'tax':_0x476218[_0x8792('0x56')],'agentFullname':_0x476218[_0x8792('0x57')],'note':_0x476218[_0x8792('0x58')],'subscriptionId':_0x476218[_0x8792('0x59')],'subscriptionName':_0x476218[_0x8792('0x5a')],'subscriptionMonthly':_0x476218[_0x8792('0x5b')],'quantity':_0x476218[_0x8792('0x5c')],'InvoiceId':_0x1d7869};return db[_0x8792('0x5d')]['create'](_0x5c661d,{'transaction':_0x2cdd8b})['then'](function(){return db[_0x8792('0x5e')]['update']({'InvoiceId':_0x1d7869},{'where':{'ProductPriceListId':_0x476218['priceListId'],'productCode':_0x476218[_0x8792('0x50')],'ProformaId':_0x476218['ProformaId']},'transaction':_0x2cdd8b});});}exports[_0x8792('0x5f')]=function(_0x34b96b,_0x285782,_0x2adc13){var _0x56e4a9;if(_0x34b96b[_0x8792('0x49')]['id']){delete _0x34b96b[_0x8792('0x49')]['id'];}console[_0x8792('0x4b')](_0x34b96b);return db['sequelize']['transaction'](function(_0x43bb3c){return db['SAInvoice'][_0x8792('0x48')](_0x34b96b[_0x8792('0x49')],{'transaction':_0x43bb3c,'logging':console[_0x8792('0x4b')]})[_0x8792('0x40')](function(_0x473695){_0x56e4a9=_0x473695;var _0xea45f9=_0x34b96b[_0x8792('0x45')]['id'];return db[_0x8792('0x2a')][_0x8792('0x42')]({'where':{'ProformaId':_0xea45f9},'raw':!![],'logging':console[_0x8792('0x4b')]});})[_0x8792('0x40')](function(_0x4cf824){if(_0x4cf824[_0x8792('0x33')]>0x0){var _0x119766=[];for(var _0x1f97e7=0x0;_0x1f97e7<_0x4cf824[_0x8792('0x33')];_0x1f97e7++){_0x119766['push'](addProformaInvoiceDetail(_0x4cf824[_0x1f97e7],_0x56e4a9['id'],_0x43bb3c));}return BPromise['all'](_0x119766);}else{var _0x37f2f1={'errors':[{'type':_0x8792('0x60'),'message':_0x8792('0x61')}]};throw _0x37f2f1;}});})[_0x8792('0x40')](function(){return _0x285782[_0x8792('0x1b')](0xc8);})[_0x8792('0x43')](function(_0x3dc839){console['log'](_0x8792('0x62'),_0x3dc839);if(_0x3dc839[_0x8792('0x28')]===_0x8792('0x63')){var _0x3dc839={'errors':[{'message':'Duplicate\x20entry.'}]};}_0x285782[_0x8792('0x1d')](0x1f4)[_0x8792('0x64')](_0x3dc839);});}; \ No newline at end of file +var _0xa731=['merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','describe','log','addProformaInvoiceDetail->>','companyName','productCode','productDescription','typeName','priceListId','discount','tax','agentFullname','note','subscriptionId','subscriptionName','subscriptionMonthly','quantity','SAInvoiceDetail','ProformaId','SAInvoice','push','all','WARNING','No\x20product\x20to\x20assign\x20invoice.\x20Invoice\x20not\x20created!!\x20','SequelizeUniqueConstraintError','Duplicate\x20entry.','send','html-pdf','eml-format','rimraf','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','then','error','stack','name','index','SAProformaDetail','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where'];(function(_0x4a5972,_0x22541e){var _0x49a63c=function(_0x4e1d39){while(--_0x4e1d39){_0x4a5972['push'](_0x4a5972['shift']());}};_0x49a63c(++_0x22541e);}(_0xa731,0x1b2));var _0x1a73=function(_0x38f851,_0x47b388){_0x38f851=_0x38f851-0x0;var _0x15d58a=_0xa731[_0x38f851];return _0x15d58a;};'use strict';var pdf=require(_0x1a73('0x0'));var emlformat=require(_0x1a73('0x1'));var rimraf=require(_0x1a73('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1a73('0x3'));var BPromise=require(_0x1a73('0x4'));var Mustache=require('mustache');var util=require(_0x1a73('0x5'));var path=require(_0x1a73('0x6'));var sox=require('sox');var csv=require(_0x1a73('0x7'));var ejs=require(_0x1a73('0x8'));var fs=require('fs');var _=require(_0x1a73('0x9'));var squel=require(_0x1a73('0xa'));var crypto=require('crypto');var jsforce=require(_0x1a73('0xb'));var deskjs=require(_0x1a73('0xc'));var toCsv=require(_0x1a73('0x7'));var querystring=require(_0x1a73('0xd'));var Papa=require(_0x1a73('0xe'));var Redis=require(_0x1a73('0xf'));var authService=require(_0x1a73('0x10'));var qs=require(_0x1a73('0x11'));var hardwareService=require(_0x1a73('0x12'));var logger=require(_0x1a73('0x13'))(_0x1a73('0x14'));var utils=require(_0x1a73('0x15'));var config=require(_0x1a73('0x16'));var db=require(_0x1a73('0x17'))['db'];function respondWithStatusCode(_0x24feeb,_0x38e94b){_0x38e94b=_0x38e94b||0xcc;return function(_0x13e808){if(_0x13e808){return _0x24feeb[_0x1a73('0x18')](_0x38e94b);}return _0x24feeb['status'](_0x38e94b)[_0x1a73('0x19')]();};}function respondWithResult(_0x8156d5,_0x396acf){_0x396acf=_0x396acf||0xc8;return function(_0x3895a7){if(_0x3895a7){return _0x8156d5['status'](_0x396acf)[_0x1a73('0x1a')](_0x3895a7);}};}function respondWithFilteredResult(_0x171bdc,_0x5c8662){return function(_0x15709d){if(_0x15709d){var _0x2c1908=_0x15709d[_0x1a73('0x1b')],_0x4cbef4=_0x5c8662[_0x1a73('0x1c')],_0x5b102d=_0x5c8662[_0x1a73('0x1c')]+_0x5c8662['limit'],_0x3c422f;if(_0x5b102d>=_0x2c1908){_0x5b102d=_0x2c1908;_0x3c422f=0xc8;}else{_0x3c422f=0xce;}_0x171bdc[_0x1a73('0x1d')](_0x3c422f);return _0x171bdc['set'](_0x1a73('0x1e'),_0x4cbef4+'-'+_0x5b102d+'/'+_0x2c1908)[_0x1a73('0x1a')](_0x15709d);}return null;};}function patchUpdates(_0x6dd869){return function(_0xffd16e){try{jsonpatch[_0x1a73('0x1f')](_0xffd16e,_0x6dd869,!![]);}catch(_0x16b32f){return BPromise[_0x1a73('0x20')](_0x16b32f);}return _0xffd16e[_0x1a73('0x21')]();};}function saveUpdates(_0x4e9fa4,_0x579f99){return function(_0x1fd2fe){if(_0x1fd2fe){return _0x1fd2fe['update'](_0x4e9fa4)[_0x1a73('0x22')](function(_0x1bffb2){return _0x1bffb2;});}return null;};}function removeEntity(_0xb9d806,_0x2afd9b){return function(_0x47f7fd){if(_0x47f7fd){return _0x47f7fd['destroy']()[_0x1a73('0x22')](function(){_0xb9d806[_0x1a73('0x1d')](0xcc)[_0x1a73('0x19')]();});}};}function handleEntityNotFound(_0x557bd9,_0x116927){return function(_0x5776c6){if(!_0x5776c6){_0x557bd9['sendStatus'](0x194);}return _0x5776c6;};}function handleError(_0x4fc82b,_0x253056){_0x253056=_0x253056||0x1f4;return function(_0x122494){logger[_0x1a73('0x23')](_0x122494[_0x1a73('0x24')]);if(_0x122494[_0x1a73('0x25')]){delete _0x122494[_0x1a73('0x25')];}_0x4fc82b[_0x1a73('0x1d')](_0x253056)['send'](_0x122494);};}exports[_0x1a73('0x26')]=function(_0x1c4dbe,_0x5ef441){var _0x1b0c0e={},_0x5328d1={},_0x12df9e={'count':0x0,'rows':[]};var _0x353e18=db[_0x1a73('0x27')][_0x1a73('0x28')];_0x5328d1[_0x1a73('0x29')]=_[_0x1a73('0x2a')](_0x353e18);_0x5328d1[_0x1a73('0x2b')]=_['keys'](_0x1c4dbe[_0x1a73('0x2b')]);_0x5328d1[_0x1a73('0x2c')]=_[_0x1a73('0x2d')](_0x5328d1['model'],_0x5328d1[_0x1a73('0x2b')]);_0x1b0c0e[_0x1a73('0x2e')]=_[_0x1a73('0x2d')](_0x5328d1['model'],qs[_0x1a73('0x2f')](_0x1c4dbe[_0x1a73('0x2b')][_0x1a73('0x2f')]));_0x1b0c0e[_0x1a73('0x2e')]=_0x1b0c0e['attributes'][_0x1a73('0x30')]?_0x1b0c0e[_0x1a73('0x2e')]:_0x5328d1[_0x1a73('0x29')];if(!_0x1c4dbe[_0x1a73('0x2b')][_0x1a73('0x31')]('nolimit')){_0x1b0c0e['limit']=qs['limit'](_0x1c4dbe['query'][_0x1a73('0x32')]);_0x1b0c0e[_0x1a73('0x1c')]=qs[_0x1a73('0x1c')](_0x1c4dbe['query'][_0x1a73('0x1c')]);}_0x1b0c0e[_0x1a73('0x33')]=qs[_0x1a73('0x34')](_0x1c4dbe['query'][_0x1a73('0x34')]);_0x1b0c0e['where']=qs[_0x1a73('0x2c')](_[_0x1a73('0x35')](_0x1c4dbe[_0x1a73('0x2b')],_0x5328d1[_0x1a73('0x2c')]));if(_0x1c4dbe[_0x1a73('0x2b')][_0x1a73('0x36')]){_0x1b0c0e[_0x1a73('0x37')]=_[_0x1a73('0x38')](_0x1b0c0e[_0x1a73('0x37')],{'$or':_[_0x1a73('0x39')](_0x353e18,function(_0x1a2b18){if(_0x1a2b18['type'][_0x1a73('0x3a')]!==_0x1a73('0x3b')){var _0x3d18f0={};_0x3d18f0[_0x1a2b18[_0x1a73('0x3c')]]={'$like':'%'+_0x1c4dbe['query']['filter']+'%'};return _0x3d18f0;}})});}_0x1b0c0e=_[_0x1a73('0x38')]({},_0x1b0c0e,_0x1c4dbe[_0x1a73('0x3d')]);var _0x2f8962={'where':_0x1b0c0e[_0x1a73('0x37')]};return db[_0x1a73('0x27')][_0x1a73('0x1b')](_0x2f8962)[_0x1a73('0x22')](function(_0x5066ee){_0x12df9e['count']=_0x5066ee;if(_0x1c4dbe['query'][_0x1a73('0x3e')]){_0x1b0c0e[_0x1a73('0x3f')]=[{'all':!![]}];}return db[_0x1a73('0x27')][_0x1a73('0x40')](_0x1b0c0e);})[_0x1a73('0x22')](function(_0x274173){_0x12df9e[_0x1a73('0x41')]=_0x274173;return _0x12df9e;})[_0x1a73('0x22')](respondWithFilteredResult(_0x5ef441,_0x1b0c0e))[_0x1a73('0x42')](handleError(_0x5ef441,null));};exports['show']=function(_0x51b90b,_0xa35018){var _0xc641b0={'raw':![],'where':{'id':_0x51b90b[_0x1a73('0x43')]['id']}},_0x1047a9={};_0x1047a9['model']=_['keys'](db['SAProformaDetail'][_0x1a73('0x28')]);_0x1047a9['query']=_['keys'](_0x51b90b[_0x1a73('0x2b')]);_0x1047a9[_0x1a73('0x2c')]=_[_0x1a73('0x2d')](_0x1047a9[_0x1a73('0x29')],_0x1047a9['query']);_0xc641b0[_0x1a73('0x2e')]=_[_0x1a73('0x2d')](_0x1047a9[_0x1a73('0x29')],qs[_0x1a73('0x2f')](_0x51b90b[_0x1a73('0x2b')]['fields']));_0xc641b0[_0x1a73('0x2e')]=_0xc641b0['attributes'][_0x1a73('0x30')]?_0xc641b0[_0x1a73('0x2e')]:_0x1047a9[_0x1a73('0x29')];if(_0x51b90b[_0x1a73('0x2b')][_0x1a73('0x3e')]){_0xc641b0[_0x1a73('0x3f')]=[{'all':!![]}];}_0xc641b0=_['merge']({},_0xc641b0,_0x51b90b[_0x1a73('0x3d')]);return db[_0x1a73('0x27')][_0x1a73('0x44')](_0xc641b0)[_0x1a73('0x22')](handleEntityNotFound(_0xa35018,null))[_0x1a73('0x22')](respondWithResult(_0xa35018,null))['catch'](handleError(_0xa35018,null));};exports[_0x1a73('0x45')]=function(_0x3414d0,_0x191936){return db[_0x1a73('0x27')][_0x1a73('0x45')](_0x3414d0['body'],{})[_0x1a73('0x22')](respondWithResult(_0x191936,0xc9))[_0x1a73('0x42')](handleError(_0x191936,null));};exports[_0x1a73('0x46')]=function(_0x333d22,_0x1aa22c){if(_0x333d22['body']['id']){delete _0x333d22[_0x1a73('0x47')]['id'];}return db[_0x1a73('0x27')][_0x1a73('0x44')]({'where':{'id':_0x333d22[_0x1a73('0x43')]['id']}})[_0x1a73('0x22')](handleEntityNotFound(_0x1aa22c,null))[_0x1a73('0x22')](saveUpdates(_0x333d22[_0x1a73('0x47')],null))[_0x1a73('0x22')](respondWithResult(_0x1aa22c,null))[_0x1a73('0x42')](handleError(_0x1aa22c,null));};exports['destroy']=function(_0x8ba93f,_0x47e9ed){return db[_0x1a73('0x27')]['find']({'where':{'id':_0x8ba93f[_0x1a73('0x43')]['id']}})[_0x1a73('0x22')](handleEntityNotFound(_0x47e9ed,null))[_0x1a73('0x22')](removeEntity(_0x47e9ed,null))[_0x1a73('0x42')](handleError(_0x47e9ed,null));};exports[_0x1a73('0x48')]=function(_0x525340,_0x17e4b3){return db['SAProformaDetail'][_0x1a73('0x48')]()['then'](respondWithResult(_0x17e4b3,null))[_0x1a73('0x42')](handleError(_0x17e4b3,null));};function addProformaInvoiceDetail(_0x1c9d39,_0x7062aa,_0x184d7e){console[_0x1a73('0x49')](_0x1a73('0x4a'),_0x1c9d39);var _0x18a9e8={'companyName':_0x1c9d39[_0x1a73('0x4b')],'companyId':_0x1c9d39['companyId'],'productName':_0x1c9d39['productName'],'productCode':_0x1c9d39[_0x1a73('0x4c')],'productDescription':_0x1c9d39[_0x1a73('0x4d')],'typeName':_0x1c9d39[_0x1a73('0x4e')],'pricelistName':_0x1c9d39['pricelistName'],'priceListId':_0x1c9d39[_0x1a73('0x4f')],'netPrice':_0x1c9d39['netPrice'],'discount':_0x1c9d39[_0x1a73('0x50')],'tax':_0x1c9d39[_0x1a73('0x51')],'agentFullname':_0x1c9d39[_0x1a73('0x52')],'note':_0x1c9d39[_0x1a73('0x53')],'subscriptionId':_0x1c9d39[_0x1a73('0x54')],'subscriptionName':_0x1c9d39[_0x1a73('0x55')],'subscriptionMonthly':_0x1c9d39[_0x1a73('0x56')],'quantity':_0x1c9d39[_0x1a73('0x57')],'InvoiceId':_0x7062aa};return db[_0x1a73('0x58')][_0x1a73('0x45')](_0x18a9e8,{'transaction':_0x184d7e})[_0x1a73('0x22')](function(){return db['SAProductQuotation']['update']({'InvoiceId':_0x7062aa},{'where':{'ProductPriceListId':_0x1c9d39['priceListId'],'productCode':_0x1c9d39['productCode'],'ProformaId':_0x1c9d39[_0x1a73('0x59')]},'transaction':_0x184d7e});});}exports['automaticProformaInvoice']=function(_0x1f9c27,_0x4359c2,_0x2b1102){var _0x4e0985;if(_0x1f9c27[_0x1a73('0x47')]['id']){delete _0x1f9c27['body']['id'];}console[_0x1a73('0x49')](_0x1f9c27);return db['sequelize']['transaction'](function(_0x59d7ef){return db[_0x1a73('0x5a')]['create'](_0x1f9c27['body'],{'transaction':_0x59d7ef,'logging':console['log']})[_0x1a73('0x22')](function(_0x5928ca){_0x4e0985=_0x5928ca;var _0x2d16bc=_0x1f9c27[_0x1a73('0x43')]['id'];return db['SAProformaDetail'][_0x1a73('0x40')]({'where':{'ProformaId':_0x2d16bc},'raw':!![],'logging':console['log']});})[_0x1a73('0x22')](function(_0x55a592){if(_0x55a592[_0x1a73('0x30')]>0x0){var _0x345818=[];for(var _0x44d782=0x0;_0x44d782<_0x55a592[_0x1a73('0x30')];_0x44d782++){_0x345818[_0x1a73('0x5b')](addProformaInvoiceDetail(_0x55a592[_0x44d782],_0x4e0985['id'],_0x59d7ef));}return BPromise[_0x1a73('0x5c')](_0x345818);}else{var _0xae7ec2={'errors':[{'type':_0x1a73('0x5d'),'message':_0x1a73('0x5e')}]};throw _0xae7ec2;}});})[_0x1a73('0x22')](function(){return _0x4359c2['sendStatus'](0xc8);})[_0x1a73('0x42')](function(_0x22f1a7){console[_0x1a73('0x49')]('TCL:\x20exports.automaticProformaInvoice\x20->\x20err',_0x22f1a7);if(_0x22f1a7[_0x1a73('0x25')]===_0x1a73('0x5f')){var _0x22f1a7={'errors':[{'message':_0x1a73('0x60')}]};}_0x4359c2[_0x1a73('0x1d')](0x1f4)[_0x1a73('0x61')](_0x22f1a7);});}; \ No newline at end of file diff --git a/server/api/saProformaDetail/saProformaDetail.model.js b/server/api/saProformaDetail/saProformaDetail.model.js index 315d648..6d5a68a 100644 --- a/server/api/saProformaDetail/saProformaDetail.model.js +++ b/server/api/saProformaDetail/saProformaDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e06=['define','SAProformaDetail','sa_proforma_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./saProformaDetail.attributes','exports'];(function(_0x44ca3b,_0x39e71b){var _0x5cdca2=function(_0x45f3d3){while(--_0x45f3d3){_0x44ca3b['push'](_0x44ca3b['shift']());}};_0x5cdca2(++_0x39e71b);}(_0x3e06,0x153));var _0x63e0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3e06[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x63e0('0x0'));var util=require(_0x63e0('0x1'));var logger=require(_0x63e0('0x2'))(_0x63e0('0x3'));var moment=require(_0x63e0('0x4'));var BPromise=require(_0x63e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63e0('0x6'));var rimraf=require(_0x63e0('0x7'));var config=require(_0x63e0('0x8'));var attributes=require(_0x63e0('0x9'));module[_0x63e0('0xa')]=function(_0x562ed8,_0x2630e0){return _0x562ed8[_0x63e0('0xb')](_0x63e0('0xc'),attributes,{'tableName':_0x63e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x776b=['util','../../config/logger','api','moment','request-promise','path','rimraf','./saProformaDetail.attributes','exports','define','SAProformaDetail','lodash'];(function(_0x272149,_0x54498f){var _0x521d60=function(_0x1a7726){while(--_0x1a7726){_0x272149['push'](_0x272149['shift']());}};_0x521d60(++_0x54498f);}(_0x776b,0x12b));var _0xb776=function(_0x32ad18,_0x5cb82f){_0x32ad18=_0x32ad18-0x0;var _0xc68f9d=_0x776b[_0x32ad18];return _0xc68f9d;};'use strict';var _=require(_0xb776('0x0'));var util=require(_0xb776('0x1'));var logger=require(_0xb776('0x2'))(_0xb776('0x3'));var moment=require(_0xb776('0x4'));var BPromise=require('bluebird');var rp=require(_0xb776('0x5'));var fs=require('fs');var path=require(_0xb776('0x6'));var rimraf=require(_0xb776('0x7'));var config=require('../../config/environment');var attributes=require(_0xb776('0x8'));module[_0xb776('0x9')]=function(_0x384a96,_0x4ec98a){return _0x384a96[_0xb776('0xa')](_0xb776('0xb'),attributes,{'tableName':'sa_proforma_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saProformaDetail/saProformaDetail.rpc.js b/server/api/saProformaDetail/saProformaDetail.rpc.js index 4543745..19cc780 100644 --- a/server/api/saProformaDetail/saProformaDetail.rpc.js +++ b/server/api/saProformaDetail/saProformaDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SAProformaDetail,\x20%s,\x20%s','request\x20sent','debug','SAProformaDetail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5bedef,_0x105419){var _0x56cd42=function(_0x1a59e0){while(--_0x1a59e0){_0x5bedef['push'](_0x5bedef['shift']());}};_0x56cd42(++_0x105419);}(_0x34e8,0x12c));var _0x834e=function(_0x5ecf4f,_0x2fc674){_0x5ecf4f=_0x5ecf4f-0x0;var _0x32b3cb=_0x34e8[_0x5ecf4f];return _0x32b3cb;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('SAProformaDetail,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('SAProformaDetail,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SAProformaDetail,\x20%s,\x20%s','request\x20sent','debug','SAProformaDetail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4248f6,_0x3c0b1f){var _0x4db8e9=function(_0x70240){while(--_0x70240){_0x4248f6['push'](_0x4248f6['shift']());}};_0x4db8e9(++_0x3c0b1f);}(_0x34e8,0x12c));var _0x834e=function(_0x29e424,_0x3b08ee){_0x29e424=_0x29e424-0x0;var _0x486ff4=_0x34e8[_0x29e424];return _0x486ff4;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('SAProformaDetail,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('SAProformaDetail,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/saQuotation/index.js b/server/api/saQuotation/index.js index 4e548fb..1268acd 100644 --- a/server/api/saQuotation/index.js +++ b/server/api/saQuotation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37cb=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saQuotation.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','/:id/movequotationassets','moveQuotationAsset','update','delete','util'];(function(_0x4e2370,_0x3c2601){var _0x3a9f59=function(_0x120b51){while(--_0x120b51){_0x4e2370['push'](_0x4e2370['shift']());}};_0x3a9f59(++_0x3c2601);}(_0x37cb,0x164));var _0xb37c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x37cb[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0xb37c('0x0'));var path=require(_0xb37c('0x1'));var timeout=require(_0xb37c('0x2'));var express=require('express');var router=express[_0xb37c('0x3')]();var auth=require(_0xb37c('0x4'));var interaction=require(_0xb37c('0x5'));var config=require(_0xb37c('0x6'));var controller=require(_0xb37c('0x7'));router[_0xb37c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb37c('0x9')]);router[_0xb37c('0x8')](_0xb37c('0xa'),auth[_0xb37c('0xb')](),controller[_0xb37c('0xc')]);router[_0xb37c('0x8')](_0xb37c('0xd'),auth[_0xb37c('0xb')](),controller[_0xb37c('0xe')]);router[_0xb37c('0xf')]('/',auth[_0xb37c('0xb')](),controller[_0xb37c('0x10')]);router[_0xb37c('0xf')](_0xb37c('0x11'),auth[_0xb37c('0xb')](),controller[_0xb37c('0x12')]);router['put'](_0xb37c('0xd'),auth[_0xb37c('0xb')](),controller[_0xb37c('0x13')]);router[_0xb37c('0x14')](_0xb37c('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2414=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./saQuotation.controller','get','/describe','isAuthenticated','/:id','show','post','create','moveQuotationAsset','put'];(function(_0x35f25f,_0x1ec58d){var _0x3ed9aa=function(_0x5ae4d8){while(--_0x5ae4d8){_0x35f25f['push'](_0x35f25f['shift']());}};_0x3ed9aa(++_0x1ec58d);}(_0x2414,0x118));var _0x4241=function(_0x14f4f0,_0x363e98){_0x14f4f0=_0x14f4f0-0x0;var _0x4e1d50=_0x2414[_0x14f4f0];return _0x4e1d50;};'use strict';var multer=require(_0x4241('0x0'));var util=require(_0x4241('0x1'));var path=require(_0x4241('0x2'));var timeout=require(_0x4241('0x3'));var express=require(_0x4241('0x4'));var router=express[_0x4241('0x5')]();var auth=require(_0x4241('0x6'));var interaction=require(_0x4241('0x7'));var config=require(_0x4241('0x8'));var controller=require(_0x4241('0x9'));router[_0x4241('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4241('0xa')](_0x4241('0xb'),auth[_0x4241('0xc')](),controller['describe']);router['get'](_0x4241('0xd'),auth[_0x4241('0xc')](),controller[_0x4241('0xe')]);router[_0x4241('0xf')]('/',auth[_0x4241('0xc')](),controller[_0x4241('0x10')]);router[_0x4241('0xf')]('/:id/movequotationassets',auth[_0x4241('0xc')](),controller[_0x4241('0x11')]);router[_0x4241('0x12')](_0x4241('0xd'),auth[_0x4241('0xc')](),controller[_0x4241('0x13')]);router[_0x4241('0x14')](_0x4241('0xd'),auth[_0x4241('0xc')](),controller[_0x4241('0x15')]);module[_0x4241('0x16')]=router; \ No newline at end of file diff --git a/server/api/saQuotation/saQuotation.attributes.js b/server/api/saQuotation/saQuotation.attributes.js index 68d3947..4cc9c68 100644 --- a/server/api/saQuotation/saQuotation.attributes.js +++ b/server/api/saQuotation/saQuotation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12c1=['STRING','TEXT','INTEGER','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x12c1,0x1af));var _0x112c=function(_0x8bdfef,_0x19560a){_0x8bdfef=_0x8bdfef-0x0;var _0x42a516=_0x12c1[_0x8bdfef];return _0x42a516;};'use strict';var Sequelize=require(_0x112c('0x0'));module['exports']={'name':{'type':Sequelize[_0x112c('0x1')],'unique':'name'},'note':{'type':Sequelize[_0x112c('0x2')]},'agentFullname':{'type':Sequelize[_0x112c('0x1')]},'status':{'type':Sequelize[_0x112c('0x2')]},'companyName':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x112c('0x3')]}}; \ No newline at end of file +var _0x9ae6=['TEXT','INTEGER','sequelize','exports','STRING'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x9ae6,0x1d8));var _0x69ae=function(_0x52de9b,_0x19df61){_0x52de9b=_0x52de9b-0x0;var _0x1ad0c7=_0x9ae6[_0x52de9b];return _0x1ad0c7;};'use strict';var Sequelize=require(_0x69ae('0x0'));module[_0x69ae('0x1')]={'name':{'type':Sequelize[_0x69ae('0x2')],'unique':'name'},'note':{'type':Sequelize[_0x69ae('0x3')]},'agentFullname':{'type':Sequelize[_0x69ae('0x2')]},'status':{'type':Sequelize['TEXT']},'companyName':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x69ae('0x4')]}}; \ No newline at end of file diff --git a/server/api/saQuotation/saQuotation.controller.js b/server/api/saQuotation/saQuotation.controller.js index c8a29db..8185d34 100644 --- a/server/api/saQuotation/saQuotation.controller.js +++ b/server/api/saQuotation/saQuotation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57dd=['log','companyId','SAAsset','TCL:\x20manageProductQuotationIntoAsset\x20->\x20productsAsset','TCL:\x20manageProductQuotationIntoAsset\x20->\x20listproduct','dateNextInvoice','findOne','subscriptionId','ProductPriceListId','spread','quantity','value','abs','WARNING','companyName','productName','productCode','productTax','productDescription','typeName','pricelistName','netPrice','discount','agentFullname','note','tax','subscriptionName','push','bulkCreate','SAProductQuotation','moveQuotationAsset','sequelize','transaction','clone','all','No\x20product\x20to\x20move.','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','filter','SAQuotation','count','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe'];(function(_0x14ae59,_0x282d0c){var _0x195e75=function(_0x894646){while(--_0x894646){_0x14ae59['push'](_0x14ae59['shift']());}};_0x195e75(++_0x282d0c);}(_0x57dd,0x1dc));var _0xd57d=function(_0x4c1fa3,_0x249721){_0x4c1fa3=_0x4c1fa3-0x0;var _0x385fd4=_0x57dd[_0x4c1fa3];return _0x385fd4;};'use strict';var pdf=require(_0xd57d('0x0'));var emlformat=require(_0xd57d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd57d('0x2'));var jsonpatch=require(_0xd57d('0x3'));var rp=require(_0xd57d('0x4'));var moment=require(_0xd57d('0x5'));var BPromise=require(_0xd57d('0x6'));var Mustache=require('mustache');var util=require(_0xd57d('0x7'));var path=require(_0xd57d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd57d('0x9'));var fs=require('fs');var _=require(_0xd57d('0xa'));var squel=require('squel');var crypto=require(_0xd57d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd57d('0xc'));var toCsv=require(_0xd57d('0xd'));var querystring=require(_0xd57d('0xe'));var Papa=require(_0xd57d('0xf'));var Redis=require(_0xd57d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd57d('0x11'));var hardwareService=require(_0xd57d('0x12'));var logger=require(_0xd57d('0x13'))(_0xd57d('0x14'));var utils=require(_0xd57d('0x15'));var config=require('../../config/environment');var db=require(_0xd57d('0x16'))['db'];function respondWithStatusCode(_0x13c856,_0x66320b){_0x66320b=_0x66320b||0xcc;return function(_0x220a7f){if(_0x220a7f){return _0x13c856['sendStatus'](_0x66320b);}return _0x13c856['status'](_0x66320b)['end']();};}function respondWithResult(_0x4eee84,_0x150cc9){_0x150cc9=_0x150cc9||0xc8;return function(_0x288117){if(_0x288117){return _0x4eee84[_0xd57d('0x17')](_0x150cc9)[_0xd57d('0x18')](_0x288117);}};}function respondWithFilteredResult(_0x15afeb,_0x32c311){return function(_0x3473cc){if(_0x3473cc){var _0x27ffb7=_0x3473cc['count'],_0x36c475=_0x32c311['offset'],_0x3f07c5=_0x32c311[_0xd57d('0x19')]+_0x32c311[_0xd57d('0x1a')],_0x27a48e;if(_0x3f07c5>=_0x27ffb7){_0x3f07c5=_0x27ffb7;_0x27a48e=0xc8;}else{_0x27a48e=0xce;}_0x15afeb[_0xd57d('0x17')](_0x27a48e);return _0x15afeb['set'](_0xd57d('0x1b'),_0x36c475+'-'+_0x3f07c5+'/'+_0x27ffb7)['json'](_0x3473cc);}return null;};}function patchUpdates(_0x53caa3){return function(_0x10888a){try{jsonpatch[_0xd57d('0x1c')](_0x10888a,_0x53caa3,!![]);}catch(_0x4c938b){return BPromise[_0xd57d('0x1d')](_0x4c938b);}return _0x10888a[_0xd57d('0x1e')]();};}function saveUpdates(_0x22cdec,_0x2cc57f){return function(_0x24c7ad){if(_0x24c7ad){return _0x24c7ad[_0xd57d('0x1f')](_0x22cdec)[_0xd57d('0x20')](function(_0x4123cd){return _0x4123cd;});}return null;};}function removeEntity(_0x1ae387,_0x8a1fbe){return function(_0x32866a){if(_0x32866a){return _0x32866a['destroy']()[_0xd57d('0x20')](function(){_0x1ae387[_0xd57d('0x17')](0xcc)[_0xd57d('0x21')]();});}};}function handleEntityNotFound(_0x31ed68,_0x1ac8a4){return function(_0x314371){if(!_0x314371){_0x31ed68[_0xd57d('0x22')](0x194);}return _0x314371;};}function handleError(_0x5db804,_0x3dbc42){_0x3dbc42=_0x3dbc42||0x1f4;return function(_0x211b0e){logger[_0xd57d('0x23')](_0x211b0e[_0xd57d('0x24')]);if(_0x211b0e[_0xd57d('0x25')]){delete _0x211b0e[_0xd57d('0x25')];}_0x5db804[_0xd57d('0x17')](_0x3dbc42)[_0xd57d('0x26')](_0x211b0e);};}exports['index']=function(_0x40475e,_0x35d0b2){var _0x52e16a={},_0x42cb15={},_0x2bbb1a={'count':0x0,'rows':[]};var _0x291307=db['SAQuotation'][_0xd57d('0x27')];_0x42cb15[_0xd57d('0x28')]=_['keys'](_0x291307);_0x42cb15['query']=_['keys'](_0x40475e[_0xd57d('0x29')]);_0x42cb15[_0xd57d('0x2a')]=_[_0xd57d('0x2b')](_0x42cb15[_0xd57d('0x28')],_0x42cb15['query']);_0x52e16a['attributes']=_['intersection'](_0x42cb15[_0xd57d('0x28')],qs[_0xd57d('0x2c')](_0x40475e[_0xd57d('0x29')]['fields']));_0x52e16a[_0xd57d('0x2d')]=_0x52e16a['attributes'][_0xd57d('0x2e')]?_0x52e16a[_0xd57d('0x2d')]:_0x42cb15['model'];if(!_0x40475e[_0xd57d('0x29')][_0xd57d('0x2f')](_0xd57d('0x30'))){_0x52e16a[_0xd57d('0x1a')]=qs[_0xd57d('0x1a')](_0x40475e[_0xd57d('0x29')][_0xd57d('0x1a')]);_0x52e16a[_0xd57d('0x19')]=qs['offset'](_0x40475e[_0xd57d('0x29')][_0xd57d('0x19')]);}_0x52e16a[_0xd57d('0x31')]=qs[_0xd57d('0x32')](_0x40475e[_0xd57d('0x29')][_0xd57d('0x32')]);_0x52e16a[_0xd57d('0x33')]=qs[_0xd57d('0x2a')](_[_0xd57d('0x34')](_0x40475e[_0xd57d('0x29')],_0x42cb15[_0xd57d('0x2a')]));if(_0x40475e[_0xd57d('0x29')]['filter']){_0x52e16a[_0xd57d('0x33')]=_[_0xd57d('0x35')](_0x52e16a['where'],{'$or':_[_0xd57d('0x36')](_0x291307,function(_0xbf4d61){if(_0xbf4d61[_0xd57d('0x37')][_0xd57d('0x38')]!==_0xd57d('0x39')){var _0x430815={};_0x430815[_0xbf4d61['field']]={'$like':'%'+_0x40475e['query'][_0xd57d('0x3a')]+'%'};return _0x430815;}})});}_0x52e16a=_[_0xd57d('0x35')]({},_0x52e16a,_0x40475e['options']);var _0x2be525={'where':_0x52e16a[_0xd57d('0x33')]};return db[_0xd57d('0x3b')]['count'](_0x2be525)[_0xd57d('0x20')](function(_0x1cbecb){_0x2bbb1a[_0xd57d('0x3c')]=_0x1cbecb;if(_0x40475e[_0xd57d('0x29')][_0xd57d('0x3d')]){_0x52e16a[_0xd57d('0x3e')]=[{'all':!![]}];}return db[_0xd57d('0x3b')][_0xd57d('0x3f')](_0x52e16a);})[_0xd57d('0x20')](function(_0x1870c8){_0x2bbb1a[_0xd57d('0x40')]=_0x1870c8;return _0x2bbb1a;})[_0xd57d('0x20')](respondWithFilteredResult(_0x35d0b2,_0x52e16a))[_0xd57d('0x41')](handleError(_0x35d0b2,null));};exports[_0xd57d('0x42')]=function(_0x5b681a,_0x27fb95){var _0x2f8f1f={'raw':![],'where':{'id':_0x5b681a['params']['id']}},_0x1f6d9c={};_0x1f6d9c[_0xd57d('0x28')]=_['keys'](db['SAQuotation'][_0xd57d('0x27')]);_0x1f6d9c[_0xd57d('0x29')]=_[_0xd57d('0x43')](_0x5b681a[_0xd57d('0x29')]);_0x1f6d9c[_0xd57d('0x2a')]=_[_0xd57d('0x2b')](_0x1f6d9c['model'],_0x1f6d9c[_0xd57d('0x29')]);_0x2f8f1f['attributes']=_[_0xd57d('0x2b')](_0x1f6d9c[_0xd57d('0x28')],qs[_0xd57d('0x2c')](_0x5b681a[_0xd57d('0x29')]['fields']));_0x2f8f1f[_0xd57d('0x2d')]=_0x2f8f1f['attributes']['length']?_0x2f8f1f[_0xd57d('0x2d')]:_0x1f6d9c[_0xd57d('0x28')];if(_0x5b681a[_0xd57d('0x29')]['includeAll']){_0x2f8f1f['include']=[{'all':!![]}];}_0x2f8f1f=_[_0xd57d('0x35')]({},_0x2f8f1f,_0x5b681a['options']);return db[_0xd57d('0x3b')][_0xd57d('0x44')](_0x2f8f1f)['then'](handleEntityNotFound(_0x27fb95,null))[_0xd57d('0x20')](respondWithResult(_0x27fb95,null))[_0xd57d('0x41')](handleError(_0x27fb95,null));};exports[_0xd57d('0x45')]=function(_0xed2c78,_0xdbc988){return db[_0xd57d('0x3b')][_0xd57d('0x45')](_0xed2c78[_0xd57d('0x46')],{})[_0xd57d('0x20')](respondWithResult(_0xdbc988,0xc9))[_0xd57d('0x41')](handleError(_0xdbc988,null));};exports[_0xd57d('0x1f')]=function(_0x2784e1,_0x5d8e1d){if(_0x2784e1[_0xd57d('0x46')]['id']){delete _0x2784e1['body']['id'];}return db[_0xd57d('0x3b')][_0xd57d('0x44')]({'where':{'id':_0x2784e1[_0xd57d('0x47')]['id']}})[_0xd57d('0x20')](handleEntityNotFound(_0x5d8e1d,null))[_0xd57d('0x20')](saveUpdates(_0x2784e1['body'],null))[_0xd57d('0x20')](respondWithResult(_0x5d8e1d,null))[_0xd57d('0x41')](handleError(_0x5d8e1d,null));};exports[_0xd57d('0x48')]=function(_0x4a6d6b,_0x495ae6){return db[_0xd57d('0x3b')]['find']({'where':{'id':_0x4a6d6b[_0xd57d('0x47')]['id']}})[_0xd57d('0x20')](handleEntityNotFound(_0x495ae6,null))['then'](removeEntity(_0x495ae6,null))[_0xd57d('0x41')](handleError(_0x495ae6,null));};exports['describe']=function(_0x26d318,_0x55983e){return db['SAQuotation'][_0xd57d('0x49')]()[_0xd57d('0x20')](respondWithResult(_0x55983e,null))[_0xd57d('0x41')](handleError(_0x55983e,null));};function manageProductQuotationIntoAsset(_0x3c525c,_0x4daf55){console[_0xd57d('0x4a')]('TCL:\x20manageProductQuotationIntoAsset\x20->\x20productQuotation',_0x3c525c);var _0x10ffe5=_0x3c525c[_0xd57d('0x4b')];var _0x57e466=[];return db[_0xd57d('0x4c')][_0xd57d('0x3f')]({'where':{'companyId':_0x10ffe5,'SubscriptionId':_0x3c525c['subscriptionId'],'pricelistId':_0x3c525c['ProductPriceListId'],'productCode':_0x3c525c['productCode'],'deleted':{'$or':[0x0,null]}},'raw':!![]})[_0xd57d('0x20')](function(_0x3dd8b7){console[_0xd57d('0x4a')](_0xd57d('0x4d'),_0x3dd8b7);_0x57e466=_0x3dd8b7;console['log'](_0xd57d('0x4e'),_0x57e466);if(_0x57e466&&_0x57e466[_0xd57d('0x2e')]>0x0){var _0x4ea533=_0x57e466[0x0][_0xd57d('0x4f')];var _0x5d3497=_0x57e466[_0xd57d('0x2e')];return[_0x4ea533,_0x5d3497];}else{return db[_0xd57d('0x4c')][_0xd57d('0x50')]({'where':{'companyId':_0x10ffe5,'SubscriptionId':_0x3c525c[_0xd57d('0x51')],'pricelistId':_0x3c525c[_0xd57d('0x52')]},'raw':!![]})[_0xd57d('0x20')](function(_0x563eef){var _0x5ae1e3=new Date();if(_0x563eef){_0x5ae1e3=_0x563eef[_0xd57d('0x4f')];}return[_0x5ae1e3,0x0];});}})[_0xd57d('0x53')](function(_0xf89d25,_0x835507){var _0x34e77b=Math['abs'](_0x3c525c[_0xd57d('0x54')]);if(_0x3c525c[_0xd57d('0x54')]<0x0&&_0x34e77b<=_0x835507){var _0x4344f4=_(_0x57e466)['slice'](0x0,_0x34e77b)[_0xd57d('0x36')]('id')[_0xd57d('0x55')]();return db[_0xd57d('0x4c')][_0xd57d('0x1f')]({'deleted':0x1},{'where':{'id':_0x4344f4}});}if(_0x3c525c['quantity']<0x0&&Math[_0xd57d('0x56')](_0x3c525c[_0xd57d('0x54')])>_0x835507){var _0x5c2018={'errors':[{'type':_0xd57d('0x57'),'message':'There\x20are\x20not\x20enough\x20products\x20to\x20cancel.'}]};throw _0x5c2018;}if(_0x3c525c['quantity']>0x0){var _0x4449bf=new Array();for(var _0x2ac7d7=0x0;_0x2ac7d7<_0x3c525c[_0xd57d('0x54')];_0x2ac7d7++){var _0x14c485={'companyName':_0x3c525c[_0xd57d('0x58')],'companyId':_0x3c525c['companyId'],'productName':_0x3c525c[_0xd57d('0x59')],'productCode':_0x3c525c[_0xd57d('0x5a')],'productTax':_0x3c525c[_0xd57d('0x5b')],'productDescription':_0x3c525c[_0xd57d('0x5c')],'typeName':_0x3c525c[_0xd57d('0x5d')],'pricelistName':_0x3c525c[_0xd57d('0x5e')],'pricelistId':_0x3c525c[_0xd57d('0x52')],'netPrice':_0x3c525c[_0xd57d('0x5f')],'discount':_0x3c525c[_0xd57d('0x60')],'agentFullname':_0x3c525c[_0xd57d('0x61')],'note':_0x3c525c[_0xd57d('0x62')],'tax':_0x3c525c[_0xd57d('0x63')],'subscriptionId':_0x3c525c['subscriptionId'],'subscriptionName':_0x3c525c[_0xd57d('0x64')],'subscriptionMonthly':_0x3c525c['subscriptionMonthly']};_0x14c485[_0xd57d('0x4f')]=_0xf89d25;_0x14c485[_0xd57d('0x4b')]=_0x10ffe5;_0x4449bf[_0xd57d('0x65')](_0x14c485);}return db['SAAsset'][_0xd57d('0x66')](_0x4449bf,{'transaction':_0x4daf55})[_0xd57d('0x20')](function(){return db[_0xd57d('0x67')]['update']({'productAsset':0x1},{'where':{'id':_0x3c525c['id']},'transaction':_0x4daf55});});}});}exports[_0xd57d('0x68')]=function(_0x496c8b,_0x14909d,_0x1f3f00){var _0x3fff4d=_0x496c8b[_0xd57d('0x47')]['id'];return db[_0xd57d('0x67')][_0xd57d('0x3f')]({'where':{'QuotationId':_0x3fff4d,'productAsset':null},'raw':!![],'logging':console[_0xd57d('0x4a')]})[_0xd57d('0x20')](function(_0x908b54){if(_0x908b54[_0xd57d('0x2e')]>0x0){return db[_0xd57d('0x69')][_0xd57d('0x6a')](function(_0x317251){var _0x437501=new Array();for(var _0x37ed4c=0x0;_0x37ed4c<_0x908b54[_0xd57d('0x2e')];_0x37ed4c++){var _0x490572=_[_0xd57d('0x6b')](_0x908b54[_0x37ed4c]);_0x437501[_0xd57d('0x65')](manageProductQuotationIntoAsset(_0x490572,_0x317251));}return BPromise[_0xd57d('0x6c')](_0x437501);});}else{var _0x1646be={'errors':[{'type':_0xd57d('0x57'),'message':_0xd57d('0x6d')}]};throw _0x1646be;}})[_0xd57d('0x20')](handleEntityNotFound(_0x14909d,null))['then'](respondWithStatusCode(_0x14909d,0xc8))['catch'](handleError(_0x14909d,null));}; \ No newline at end of file +var _0x7bc8=['bulkCreate','SAProductQuotation','sequelize','clone','all','No\x20product\x20to\x20move.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','limit','status','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','SAQuotation','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','key','VIRTUAL','field','options','count','includeAll','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','update','describe','log','TCL:\x20manageProductQuotationIntoAsset\x20->\x20productQuotation','companyId','SAAsset','subscriptionId','ProductPriceListId','TCL:\x20manageProductQuotationIntoAsset\x20->\x20listproduct','dateNextInvoice','findOne','abs','quantity','slice','map','value','WARNING','There\x20are\x20not\x20enough\x20products\x20to\x20cancel.','companyName','productName','productCode','productDescription','typeName','netPrice','note','tax','subscriptionName','subscriptionMonthly'];(function(_0x20200b,_0x17c2bf){var _0x2bd0a5=function(_0x5392e0){while(--_0x5392e0){_0x20200b['push'](_0x20200b['shift']());}};_0x2bd0a5(++_0x17c2bf);}(_0x7bc8,0xda));var _0x87bc=function(_0x3955eb,_0x5b43f1){_0x3955eb=_0x3955eb-0x0;var _0x268cdd=_0x7bc8[_0x3955eb];return _0x268cdd;};'use strict';var pdf=require(_0x87bc('0x0'));var emlformat=require(_0x87bc('0x1'));var rimraf=require(_0x87bc('0x2'));var zipdir=require(_0x87bc('0x3'));var jsonpatch=require(_0x87bc('0x4'));var rp=require(_0x87bc('0x5'));var moment=require('moment');var BPromise=require(_0x87bc('0x6'));var Mustache=require(_0x87bc('0x7'));var util=require(_0x87bc('0x8'));var path=require(_0x87bc('0x9'));var sox=require(_0x87bc('0xa'));var csv=require(_0x87bc('0xb'));var ejs=require(_0x87bc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x87bc('0xd'));var jsforce=require(_0x87bc('0xe'));var deskjs=require(_0x87bc('0xf'));var toCsv=require(_0x87bc('0xb'));var querystring=require(_0x87bc('0x10'));var Papa=require(_0x87bc('0x11'));var Redis=require(_0x87bc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x87bc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87bc('0x14'))(_0x87bc('0x15'));var utils=require(_0x87bc('0x16'));var config=require(_0x87bc('0x17'));var db=require(_0x87bc('0x18'))['db'];function respondWithStatusCode(_0x1e3c43,_0x2f5969){_0x2f5969=_0x2f5969||0xcc;return function(_0x5ab584){if(_0x5ab584){return _0x1e3c43[_0x87bc('0x19')](_0x2f5969);}return _0x1e3c43['status'](_0x2f5969)['end']();};}function respondWithResult(_0x594752,_0x33fe81){_0x33fe81=_0x33fe81||0xc8;return function(_0x48f277){if(_0x48f277){return _0x594752['status'](_0x33fe81)['json'](_0x48f277);}};}function respondWithFilteredResult(_0x4cffb7,_0x1d3399){return function(_0x46cbc3){if(_0x46cbc3){var _0x3d54aa=_0x46cbc3['count'],_0xaa3c7e=_0x1d3399[_0x87bc('0x1a')],_0x2fad19=_0x1d3399['offset']+_0x1d3399[_0x87bc('0x1b')],_0x17a3a2;if(_0x2fad19>=_0x3d54aa){_0x2fad19=_0x3d54aa;_0x17a3a2=0xc8;}else{_0x17a3a2=0xce;}_0x4cffb7[_0x87bc('0x1c')](_0x17a3a2);return _0x4cffb7['set'](_0x87bc('0x1d'),_0xaa3c7e+'-'+_0x2fad19+'/'+_0x3d54aa)[_0x87bc('0x1e')](_0x46cbc3);}return null;};}function patchUpdates(_0x24dd3a){return function(_0x40f0f5){try{jsonpatch[_0x87bc('0x1f')](_0x40f0f5,_0x24dd3a,!![]);}catch(_0x184efc){return BPromise[_0x87bc('0x20')](_0x184efc);}return _0x40f0f5['save']();};}function saveUpdates(_0xc14dfb,_0x175c00){return function(_0x25448f){if(_0x25448f){return _0x25448f['update'](_0xc14dfb)[_0x87bc('0x21')](function(_0x185aca){return _0x185aca;});}return null;};}function removeEntity(_0x9aac86,_0xf4e6f){return function(_0xc5e5f4){if(_0xc5e5f4){return _0xc5e5f4[_0x87bc('0x22')]()['then'](function(){_0x9aac86[_0x87bc('0x1c')](0xcc)[_0x87bc('0x23')]();});}};}function handleEntityNotFound(_0x1e6204,_0x379755){return function(_0x4ad5fe){if(!_0x4ad5fe){_0x1e6204[_0x87bc('0x19')](0x194);}return _0x4ad5fe;};}function handleError(_0x3e1b44,_0xcf3556){_0xcf3556=_0xcf3556||0x1f4;return function(_0x146d7b){logger[_0x87bc('0x24')](_0x146d7b[_0x87bc('0x25')]);if(_0x146d7b[_0x87bc('0x26')]){delete _0x146d7b[_0x87bc('0x26')];}_0x3e1b44[_0x87bc('0x1c')](_0xcf3556)[_0x87bc('0x27')](_0x146d7b);};}exports[_0x87bc('0x28')]=function(_0x1ede1a,_0x3e7096){var _0xee16be={},_0x4e77aa={},_0x3b75c6={'count':0x0,'rows':[]};var _0x5890ac=db[_0x87bc('0x29')]['rawAttributes'];_0x4e77aa[_0x87bc('0x2a')]=_[_0x87bc('0x2b')](_0x5890ac);_0x4e77aa[_0x87bc('0x2c')]=_[_0x87bc('0x2b')](_0x1ede1a[_0x87bc('0x2c')]);_0x4e77aa[_0x87bc('0x2d')]=_[_0x87bc('0x2e')](_0x4e77aa[_0x87bc('0x2a')],_0x4e77aa[_0x87bc('0x2c')]);_0xee16be['attributes']=_['intersection'](_0x4e77aa[_0x87bc('0x2a')],qs['fields'](_0x1ede1a[_0x87bc('0x2c')][_0x87bc('0x2f')]));_0xee16be[_0x87bc('0x30')]=_0xee16be[_0x87bc('0x30')]['length']?_0xee16be[_0x87bc('0x30')]:_0x4e77aa[_0x87bc('0x2a')];if(!_0x1ede1a[_0x87bc('0x2c')]['hasOwnProperty'](_0x87bc('0x31'))){_0xee16be[_0x87bc('0x1b')]=qs['limit'](_0x1ede1a['query'][_0x87bc('0x1b')]);_0xee16be[_0x87bc('0x1a')]=qs[_0x87bc('0x1a')](_0x1ede1a[_0x87bc('0x2c')][_0x87bc('0x1a')]);}_0xee16be[_0x87bc('0x32')]=qs[_0x87bc('0x33')](_0x1ede1a[_0x87bc('0x2c')]['sort']);_0xee16be[_0x87bc('0x34')]=qs[_0x87bc('0x2d')](_[_0x87bc('0x35')](_0x1ede1a['query'],_0x4e77aa['filters']));if(_0x1ede1a[_0x87bc('0x2c')][_0x87bc('0x36')]){_0xee16be['where']=_[_0x87bc('0x37')](_0xee16be[_0x87bc('0x34')],{'$or':_['map'](_0x5890ac,function(_0x3052f2){if(_0x3052f2['type'][_0x87bc('0x38')]!==_0x87bc('0x39')){var _0xb3eb36={};_0xb3eb36[_0x3052f2[_0x87bc('0x3a')]]={'$like':'%'+_0x1ede1a['query'][_0x87bc('0x36')]+'%'};return _0xb3eb36;}})});}_0xee16be=_[_0x87bc('0x37')]({},_0xee16be,_0x1ede1a[_0x87bc('0x3b')]);var _0x21b623={'where':_0xee16be[_0x87bc('0x34')]};return db[_0x87bc('0x29')][_0x87bc('0x3c')](_0x21b623)[_0x87bc('0x21')](function(_0x37ab46){_0x3b75c6[_0x87bc('0x3c')]=_0x37ab46;if(_0x1ede1a['query'][_0x87bc('0x3d')]){_0xee16be['include']=[{'all':!![]}];}return db[_0x87bc('0x29')][_0x87bc('0x3e')](_0xee16be);})[_0x87bc('0x21')](function(_0x28fad9){_0x3b75c6[_0x87bc('0x3f')]=_0x28fad9;return _0x3b75c6;})[_0x87bc('0x21')](respondWithFilteredResult(_0x3e7096,_0xee16be))['catch'](handleError(_0x3e7096,null));};exports[_0x87bc('0x40')]=function(_0x3b70fa,_0x3d7622){var _0x3cbfd4={'raw':![],'where':{'id':_0x3b70fa[_0x87bc('0x41')]['id']}},_0x439b9b={};_0x439b9b[_0x87bc('0x2a')]=_['keys'](db[_0x87bc('0x29')][_0x87bc('0x42')]);_0x439b9b['query']=_[_0x87bc('0x2b')](_0x3b70fa['query']);_0x439b9b[_0x87bc('0x2d')]=_[_0x87bc('0x2e')](_0x439b9b[_0x87bc('0x2a')],_0x439b9b['query']);_0x3cbfd4[_0x87bc('0x30')]=_['intersection'](_0x439b9b['model'],qs[_0x87bc('0x2f')](_0x3b70fa[_0x87bc('0x2c')][_0x87bc('0x2f')]));_0x3cbfd4[_0x87bc('0x30')]=_0x3cbfd4[_0x87bc('0x30')][_0x87bc('0x43')]?_0x3cbfd4['attributes']:_0x439b9b[_0x87bc('0x2a')];if(_0x3b70fa[_0x87bc('0x2c')][_0x87bc('0x3d')]){_0x3cbfd4['include']=[{'all':!![]}];}_0x3cbfd4=_[_0x87bc('0x37')]({},_0x3cbfd4,_0x3b70fa['options']);return db[_0x87bc('0x29')][_0x87bc('0x44')](_0x3cbfd4)[_0x87bc('0x21')](handleEntityNotFound(_0x3d7622,null))['then'](respondWithResult(_0x3d7622,null))[_0x87bc('0x45')](handleError(_0x3d7622,null));};exports['create']=function(_0x4786e0,_0x5dce55){return db[_0x87bc('0x29')][_0x87bc('0x46')](_0x4786e0[_0x87bc('0x47')],{})[_0x87bc('0x21')](respondWithResult(_0x5dce55,0xc9))[_0x87bc('0x45')](handleError(_0x5dce55,null));};exports[_0x87bc('0x48')]=function(_0x5e63d5,_0x3f2680){if(_0x5e63d5[_0x87bc('0x47')]['id']){delete _0x5e63d5[_0x87bc('0x47')]['id'];}return db[_0x87bc('0x29')]['find']({'where':{'id':_0x5e63d5[_0x87bc('0x41')]['id']}})[_0x87bc('0x21')](handleEntityNotFound(_0x3f2680,null))[_0x87bc('0x21')](saveUpdates(_0x5e63d5[_0x87bc('0x47')],null))['then'](respondWithResult(_0x3f2680,null))[_0x87bc('0x45')](handleError(_0x3f2680,null));};exports[_0x87bc('0x22')]=function(_0x314319,_0x443cf7){return db[_0x87bc('0x29')][_0x87bc('0x44')]({'where':{'id':_0x314319['params']['id']}})['then'](handleEntityNotFound(_0x443cf7,null))[_0x87bc('0x21')](removeEntity(_0x443cf7,null))[_0x87bc('0x45')](handleError(_0x443cf7,null));};exports[_0x87bc('0x49')]=function(_0x3de4a8,_0x20d700){return db['SAQuotation'][_0x87bc('0x49')]()[_0x87bc('0x21')](respondWithResult(_0x20d700,null))['catch'](handleError(_0x20d700,null));};function manageProductQuotationIntoAsset(_0x472ecd,_0x4d40a8){console[_0x87bc('0x4a')](_0x87bc('0x4b'),_0x472ecd);var _0x2bff8d=_0x472ecd[_0x87bc('0x4c')];var _0x12fc12=[];return db[_0x87bc('0x4d')][_0x87bc('0x3e')]({'where':{'companyId':_0x2bff8d,'SubscriptionId':_0x472ecd[_0x87bc('0x4e')],'pricelistId':_0x472ecd[_0x87bc('0x4f')],'productCode':_0x472ecd['productCode'],'deleted':{'$or':[0x0,null]}},'raw':!![]})['then'](function(_0xc24a32){console[_0x87bc('0x4a')]('TCL:\x20manageProductQuotationIntoAsset\x20->\x20productsAsset',_0xc24a32);_0x12fc12=_0xc24a32;console[_0x87bc('0x4a')](_0x87bc('0x50'),_0x12fc12);if(_0x12fc12&&_0x12fc12[_0x87bc('0x43')]>0x0){var _0x266dcf=_0x12fc12[0x0][_0x87bc('0x51')];var _0x45af46=_0x12fc12[_0x87bc('0x43')];return[_0x266dcf,_0x45af46];}else{return db[_0x87bc('0x4d')][_0x87bc('0x52')]({'where':{'companyId':_0x2bff8d,'SubscriptionId':_0x472ecd[_0x87bc('0x4e')],'pricelistId':_0x472ecd[_0x87bc('0x4f')]},'raw':!![]})[_0x87bc('0x21')](function(_0x23c48e){var _0x44c422=new Date();if(_0x23c48e){_0x44c422=_0x23c48e[_0x87bc('0x51')];}return[_0x44c422,0x0];});}})['spread'](function(_0x51f6b7,_0x469a2f){var _0xedd9f0=Math[_0x87bc('0x53')](_0x472ecd[_0x87bc('0x54')]);if(_0x472ecd[_0x87bc('0x54')]<0x0&&_0xedd9f0<=_0x469a2f){var _0x1498a2=_(_0x12fc12)[_0x87bc('0x55')](0x0,_0xedd9f0)[_0x87bc('0x56')]('id')[_0x87bc('0x57')]();return db['SAAsset']['update']({'deleted':0x1},{'where':{'id':_0x1498a2}});}if(_0x472ecd['quantity']<0x0&&Math['abs'](_0x472ecd['quantity'])>_0x469a2f){var _0x431f1e={'errors':[{'type':_0x87bc('0x58'),'message':_0x87bc('0x59')}]};throw _0x431f1e;}if(_0x472ecd[_0x87bc('0x54')]>0x0){var _0x238117=new Array();for(var _0x5d85b2=0x0;_0x5d85b2<_0x472ecd['quantity'];_0x5d85b2++){var _0x441025={'companyName':_0x472ecd[_0x87bc('0x5a')],'companyId':_0x472ecd[_0x87bc('0x4c')],'productName':_0x472ecd[_0x87bc('0x5b')],'productCode':_0x472ecd[_0x87bc('0x5c')],'productTax':_0x472ecd['productTax'],'productDescription':_0x472ecd[_0x87bc('0x5d')],'typeName':_0x472ecd[_0x87bc('0x5e')],'pricelistName':_0x472ecd['pricelistName'],'pricelistId':_0x472ecd[_0x87bc('0x4f')],'netPrice':_0x472ecd[_0x87bc('0x5f')],'discount':_0x472ecd['discount'],'agentFullname':_0x472ecd['agentFullname'],'note':_0x472ecd[_0x87bc('0x60')],'tax':_0x472ecd[_0x87bc('0x61')],'subscriptionId':_0x472ecd[_0x87bc('0x4e')],'subscriptionName':_0x472ecd[_0x87bc('0x62')],'subscriptionMonthly':_0x472ecd[_0x87bc('0x63')]};_0x441025['dateNextInvoice']=_0x51f6b7;_0x441025['companyId']=_0x2bff8d;_0x238117['push'](_0x441025);}return db[_0x87bc('0x4d')][_0x87bc('0x64')](_0x238117,{'transaction':_0x4d40a8})[_0x87bc('0x21')](function(){return db[_0x87bc('0x65')][_0x87bc('0x48')]({'productAsset':0x1},{'where':{'id':_0x472ecd['id']},'transaction':_0x4d40a8});});}});}exports['moveQuotationAsset']=function(_0x1a8508,_0x1a0788,_0x475897){var _0x4ace54=_0x1a8508[_0x87bc('0x41')]['id'];return db[_0x87bc('0x65')][_0x87bc('0x3e')]({'where':{'QuotationId':_0x4ace54,'productAsset':null},'raw':!![],'logging':console['log']})[_0x87bc('0x21')](function(_0x1ed3b0){if(_0x1ed3b0[_0x87bc('0x43')]>0x0){return db[_0x87bc('0x66')]['transaction'](function(_0xbb447d){var _0x216d59=new Array();for(var _0x4466e4=0x0;_0x4466e4<_0x1ed3b0[_0x87bc('0x43')];_0x4466e4++){var _0x507632=_[_0x87bc('0x67')](_0x1ed3b0[_0x4466e4]);_0x216d59['push'](manageProductQuotationIntoAsset(_0x507632,_0xbb447d));}return BPromise[_0x87bc('0x68')](_0x216d59);});}else{var _0x382017={'errors':[{'type':_0x87bc('0x58'),'message':_0x87bc('0x69')}]};throw _0x382017;}})[_0x87bc('0x21')](handleEntityNotFound(_0x1a0788,null))[_0x87bc('0x21')](respondWithStatusCode(_0x1a0788,0xc8))[_0x87bc('0x45')](handleError(_0x1a0788,null));}; \ No newline at end of file diff --git a/server/api/saQuotation/saQuotation.model.js b/server/api/saQuotation/saQuotation.model.js index 0122c0a..937bbac 100644 --- a/server/api/saQuotation/saQuotation.model.js +++ b/server/api/saQuotation/saQuotation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x579c=['define','sa_quotations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./saQuotation.attributes','exports'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x579c,0xda));var _0xc579=function(_0x422eae,_0x2bbd48){_0x422eae=_0x422eae-0x0;var _0x442cca=_0x579c[_0x422eae];return _0x442cca;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var rp=require(_0xc579('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var attributes=require(_0xc579('0x8'));module[_0xc579('0x9')]=function(_0x124ee5,_0x1bd276){return _0x124ee5[_0xc579('0xa')]('SAQuotation',attributes,{'tableName':_0xc579('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0565=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5dcd40,_0x5b24ec){var _0x250a57=function(_0x4bba46){while(--_0x4bba46){_0x5dcd40['push'](_0x5dcd40['shift']());}};_0x250a57(++_0x5b24ec);}(_0x0565,0xf2));var _0x5056=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0565[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var moment=require(_0x5056('0x4'));var BPromise=require(_0x5056('0x5'));var rp=require(_0x5056('0x6'));var fs=require('fs');var path=require(_0x5056('0x7'));var rimraf=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var attributes=require('./saQuotation.attributes');module[_0x5056('0xa')]=function(_0x105ea8,_0x1143df){return _0x105ea8[_0x5056('0xb')]('SAQuotation',attributes,{'tableName':'sa_quotations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saQuotation/saQuotation.rpc.js b/server/api/saQuotation/saQuotation.rpc.js index 3371c68..d9fc788 100644 --- a/server/api/saQuotation/saQuotation.rpc.js +++ b/server/api/saQuotation/saQuotation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9042=['client','http','request','then','SAQuotation,\x20%s,\x20%s','request\x20sent','debug','SAQuotation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x1c2193,_0x56984a){var _0x320d58=function(_0x5b8fb6){while(--_0x5b8fb6){_0x1c2193['push'](_0x1c2193['shift']());}};_0x320d58(++_0x56984a);}(_0x9042,0x151));var _0x2904=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x9042[_0x1b70e3];return _0x1452ab;};'use strict';var _=require('lodash');var util=require(_0x2904('0x0'));var moment=require(_0x2904('0x1'));var BPromise=require(_0x2904('0x2'));var rs=require(_0x2904('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2904('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2904('0x5'))(_0x2904('0x6'));var config=require('../../config/environment');var jayson=require(_0x2904('0x7'));var client=jayson[_0x2904('0x8')][_0x2904('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a0713,_0x1a9258,_0xfbe621){return new BPromise(function(_0x5bf8bc,_0x47db88){return client[_0x2904('0xa')](_0x3a0713,_0xfbe621)[_0x2904('0xb')](function(_0x43cffe){logger['info'](_0x2904('0xc'),_0x1a9258,_0x2904('0xd'));logger[_0x2904('0xe')](_0x2904('0xf'),_0x1a9258,_0x2904('0xd'),JSON[_0x2904('0x10')](_0x43cffe));if(_0x43cffe['error']){if(_0x43cffe[_0x2904('0x11')][_0x2904('0x12')]===0x1f4){logger[_0x2904('0x11')](_0x2904('0xc'),_0x1a9258,_0x43cffe[_0x2904('0x11')]['message']);return _0x47db88(_0x43cffe['error'][_0x2904('0x13')]);}logger[_0x2904('0x11')](_0x2904('0xc'),_0x1a9258,_0x43cffe['error'][_0x2904('0x13')]);return _0x5bf8bc(_0x43cffe['error'][_0x2904('0x13')]);}else{logger[_0x2904('0x14')](_0x2904('0xc'),_0x1a9258,_0x2904('0xd'));_0x5bf8bc(_0x43cffe[_0x2904('0x15')][_0x2904('0x13')]);}})[_0x2904('0x16')](function(_0x1dc976){logger[_0x2904('0x11')](_0x2904('0xc'),_0x1a9258,_0x1dc976);_0x47db88(_0x1dc976);});});} \ No newline at end of file +var _0x0455=['then','info','SAQuotation,\x20%s,\x20%s','debug','SAQuotation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x0455,0xac));var _0x5045=function(_0x48f64b,_0x5eb1bd){_0x48f64b=_0x48f64b-0x0;var _0x42c947=_0x0455[_0x48f64b];return _0x42c947;};'use strict';var _=require(_0x5045('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5045('0x1'));var rs=require(_0x5045('0x2'));var fs=require('fs');var Redis=require(_0x5045('0x3'));var db=require(_0x5045('0x4'))['db'];var utils=require(_0x5045('0x5'));var logger=require(_0x5045('0x6'))(_0x5045('0x7'));var config=require(_0x5045('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5045('0x9')][_0x5045('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x203d5b,_0x6f5045,_0x268b78){return new BPromise(function(_0x1be88f,_0x306667){return client[_0x5045('0xb')](_0x203d5b,_0x268b78)[_0x5045('0xc')](function(_0x225422){logger[_0x5045('0xd')](_0x5045('0xe'),_0x6f5045,'request\x20sent');logger[_0x5045('0xf')](_0x5045('0x10'),_0x6f5045,_0x5045('0x11'),JSON[_0x5045('0x12')](_0x225422));if(_0x225422[_0x5045('0x13')]){if(_0x225422[_0x5045('0x13')]['code']===0x1f4){logger['error'](_0x5045('0xe'),_0x6f5045,_0x225422['error'][_0x5045('0x14')]);return _0x306667(_0x225422[_0x5045('0x13')][_0x5045('0x14')]);}logger[_0x5045('0x13')](_0x5045('0xe'),_0x6f5045,_0x225422[_0x5045('0x13')][_0x5045('0x14')]);return _0x1be88f(_0x225422[_0x5045('0x13')][_0x5045('0x14')]);}else{logger['info'](_0x5045('0xe'),_0x6f5045,_0x5045('0x11'));_0x1be88f(_0x225422[_0x5045('0x15')][_0x5045('0x14')]);}})[_0x5045('0x16')](function(_0x4dfc8f){logger[_0x5045('0x13')](_0x5045('0xe'),_0x6f5045,_0x4dfc8f);_0x306667(_0x4dfc8f);});});} \ No newline at end of file diff --git a/server/api/saRequest/index.js b/server/api/saRequest/index.js index b4644fa..91cb90b 100644 --- a/server/api/saRequest/index.js +++ b/server/api/saRequest/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e50=['../../config/environment','./saRequest.controller','isAuthenticated','get','/describe','/:id','show','post','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x205274,_0x163428){var _0x5775b0=function(_0x89e49f){while(--_0x89e49f){_0x205274['push'](_0x205274['shift']());}};_0x5775b0(++_0x163428);}(_0x7e50,0xfc));var _0x07e5=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x7e50[_0x4709c8];return _0x478cdd;};'use strict';var multer=require(_0x07e5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x07e5('0x1')]();var auth=require(_0x07e5('0x2'));var interaction=require(_0x07e5('0x3'));var config=require(_0x07e5('0x4'));var controller=require(_0x07e5('0x5'));router['get']('/',auth[_0x07e5('0x6')](),controller['index']);router[_0x07e5('0x7')](_0x07e5('0x8'),auth[_0x07e5('0x6')](),controller['describe']);router['get'](_0x07e5('0x9'),auth['isAuthenticated'](),controller[_0x07e5('0xa')]);router[_0x07e5('0xb')]('/',auth[_0x07e5('0x6')](),controller['create']);router['put'](_0x07e5('0x9'),auth[_0x07e5('0x6')](),controller[_0x07e5('0xc')]);router[_0x07e5('0xd')](_0x07e5('0x9'),auth['isAuthenticated'](),controller[_0x07e5('0xe')]);module[_0x07e5('0xf')]=router; \ No newline at end of file +var _0xf989=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','update'];(function(_0x21dcf7,_0x460712){var _0x22f534=function(_0x419e31){while(--_0x419e31){_0x21dcf7['push'](_0x21dcf7['shift']());}};_0x22f534(++_0x460712);}(_0xf989,0xec));var _0x9f98=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0xf989[_0x43a6cd];return _0x5acb36;};'use strict';var multer=require(_0x9f98('0x0'));var util=require(_0x9f98('0x1'));var path=require(_0x9f98('0x2'));var timeout=require(_0x9f98('0x3'));var express=require(_0x9f98('0x4'));var router=express[_0x9f98('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9f98('0x6'));var config=require(_0x9f98('0x7'));var controller=require('./saRequest.controller');router[_0x9f98('0x8')]('/',auth[_0x9f98('0x9')](),controller[_0x9f98('0xa')]);router[_0x9f98('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9f98('0xb')]);router[_0x9f98('0x8')](_0x9f98('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9f98('0xd')]('/',auth['isAuthenticated'](),controller[_0x9f98('0xe')]);router['put'](_0x9f98('0xc'),auth[_0x9f98('0x9')](),controller[_0x9f98('0xf')]);router[_0x9f98('0x10')](_0x9f98('0xc'),auth[_0x9f98('0x9')](),controller[_0x9f98('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saRequest/saRequest.attributes.js b/server/api/saRequest/saRequest.attributes.js index 9a3da5a..e8723cb 100644 --- a/server/api/saRequest/saRequest.attributes.js +++ b/server/api/saRequest/saRequest.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43ca=['TEXT','sequelize','exports','DATE','STRING','name'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x43ca,0x11b));var _0xa43c=function(_0x5a64eb,_0x286782){_0x5a64eb=_0x5a64eb-0x0;var _0x3ad930=_0x43ca[_0x5a64eb];return _0x3ad930;};'use strict';var Sequelize=require(_0xa43c('0x0'));module[_0xa43c('0x1')]={'endAt':{'type':Sequelize[_0xa43c('0x2')]},'name':{'type':Sequelize[_0xa43c('0x3')],'unique':_0xa43c('0x4')},'agentFullname':{'type':Sequelize[_0xa43c('0x3')]},'note':{'type':Sequelize[_0xa43c('0x5')]}}; \ No newline at end of file +var _0x9860=['exports','DATE','name','STRING','TEXT','sequelize'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x9860,0x1d3));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0986('0x0'));module[_0x0986('0x1')]={'endAt':{'type':Sequelize[_0x0986('0x2')]},'name':{'type':Sequelize['STRING'],'unique':_0x0986('0x3')},'agentFullname':{'type':Sequelize[_0x0986('0x4')]},'note':{'type':Sequelize[_0x0986('0x5')]}}; \ No newline at end of file diff --git a/server/api/saRequest/saRequest.controller.js b/server/api/saRequest/saRequest.controller.js index 127e276..6fa266d 100644 --- a/server/api/saRequest/saRequest.controller.js +++ b/server/api/saRequest/saRequest.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','SARequest','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x3eb3ad,_0x2b3c21){var _0x1be5b8=function(_0x1f04de){while(--_0x1f04de){_0x3eb3ad['push'](_0x3eb3ad['shift']());}};_0x1be5b8(++_0x2b3c21);}(_0xb10b,0x12a));var _0xbb10=function(_0x4913a8,_0x5a8cbd){_0x4913a8=_0x4913a8-0x0;var _0x50a4de=_0xb10b[_0x4913a8];return _0x50a4de;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['SARequest']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));}; \ No newline at end of file +var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','SARequest','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x86a1ff,_0x278cea){var _0xfaae0e=function(_0x4d58b2){while(--_0x4d58b2){_0x86a1ff['push'](_0x86a1ff['shift']());}};_0xfaae0e(++_0x278cea);}(_0xb10b,0x12a));var _0xbb10=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0xb10b[_0x5fe69a];return _0x3f1aee;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['SARequest']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));}; \ No newline at end of file diff --git a/server/api/saRequest/saRequest.model.js b/server/api/saRequest/saRequest.model.js index 7509b4c..26009bd 100644 --- a/server/api/saRequest/saRequest.model.js +++ b/server/api/saRequest/saRequest.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./saRequest.attributes','exports','define','SARequest','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x314495,_0x4b5627){var _0x894a28=function(_0x3c862e){while(--_0x3c862e){_0x314495['push'](_0x314495['shift']());}};_0x894a28(++_0x4b5627);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sa_requests','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./saRequest.attributes','exports','define','SARequest','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x111269,_0x3395ff){var _0x364732=function(_0x4097c2){while(--_0x4097c2){_0x111269['push'](_0x111269['shift']());}};_0x364732(++_0x3395ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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':'sa_requests','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saRequest/saRequest.rpc.js b/server/api/saRequest/saRequest.rpc.js index 37952ab..835e4d9 100644 --- a/server/api/saRequest/saRequest.rpc.js +++ b/server/api/saRequest/saRequest.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f60=['stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','info','SARequest,\x20%s,\x20%s','request\x20sent','SARequest,\x20%s,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0f60,0x154));var _0x00f6=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x0f60[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0x00f6('0x0'));var util=require(_0x00f6('0x1'));var moment=require('moment');var BPromise=require(_0x00f6('0x2'));var rs=require(_0x00f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x00f6('0x5'))(_0x00f6('0x6'));var config=require(_0x00f6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dedef,_0x4e6219,_0x5e0a32){return new BPromise(function(_0xf85416,_0x3f860a){return client['request'](_0x4dedef,_0x5e0a32)['then'](function(_0xe3ac81){logger[_0x00f6('0x8')](_0x00f6('0x9'),_0x4e6219,_0x00f6('0xa'));logger['debug'](_0x00f6('0xb'),_0x4e6219,'request\x20sent',JSON[_0x00f6('0xc')](_0xe3ac81));if(_0xe3ac81[_0x00f6('0xd')]){if(_0xe3ac81[_0x00f6('0xd')]['code']===0x1f4){logger[_0x00f6('0xd')]('SARequest,\x20%s,\x20%s',_0x4e6219,_0xe3ac81[_0x00f6('0xd')][_0x00f6('0xe')]);return _0x3f860a(_0xe3ac81['error']['message']);}logger[_0x00f6('0xd')](_0x00f6('0x9'),_0x4e6219,_0xe3ac81[_0x00f6('0xd')][_0x00f6('0xe')]);return _0xf85416(_0xe3ac81[_0x00f6('0xd')]['message']);}else{logger[_0x00f6('0x8')]('SARequest,\x20%s,\x20%s',_0x4e6219,_0x00f6('0xa'));_0xf85416(_0xe3ac81['result'][_0x00f6('0xe')]);}})[_0x00f6('0xf')](function(_0x4ab397){logger[_0x00f6('0xd')]('SARequest,\x20%s,\x20%s',_0x4e6219,_0x4ab397);_0x3f860a(_0x4ab397);});});} \ No newline at end of file +var _0xc721=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SARequest,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xc721,0x101));var _0x1c72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc721[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1c72('0x0'));var util=require(_0x1c72('0x1'));var moment=require(_0x1c72('0x2'));var BPromise=require(_0x1c72('0x3'));var rs=require(_0x1c72('0x4'));var fs=require('fs');var Redis=require(_0x1c72('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c72('0x6'));var logger=require(_0x1c72('0x7'))(_0x1c72('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c72('0x9'));var client=jayson[_0x1c72('0xa')][_0x1c72('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4250e9,_0x5767d0,_0x2f195b){return new BPromise(function(_0x522daf,_0x3f30d1){return client[_0x1c72('0xc')](_0x4250e9,_0x2f195b)[_0x1c72('0xd')](function(_0x51c39c){logger[_0x1c72('0xe')](_0x1c72('0xf'),_0x5767d0,_0x1c72('0x10'));logger['debug']('SARequest,\x20%s,\x20%s,\x20%s',_0x5767d0,'request\x20sent',JSON['stringify'](_0x51c39c));if(_0x51c39c[_0x1c72('0x11')]){if(_0x51c39c['error'][_0x1c72('0x12')]===0x1f4){logger[_0x1c72('0x11')](_0x1c72('0xf'),_0x5767d0,_0x51c39c[_0x1c72('0x11')][_0x1c72('0x13')]);return _0x3f30d1(_0x51c39c['error'][_0x1c72('0x13')]);}logger[_0x1c72('0x11')](_0x1c72('0xf'),_0x5767d0,_0x51c39c['error']['message']);return _0x522daf(_0x51c39c[_0x1c72('0x11')]['message']);}else{logger['info'](_0x1c72('0xf'),_0x5767d0,_0x1c72('0x10'));_0x522daf(_0x51c39c[_0x1c72('0x14')][_0x1c72('0x13')]);}})[_0x1c72('0x15')](function(_0x1dd4a4){logger[_0x1c72('0x11')](_0x1c72('0xf'),_0x5767d0,_0x1dd4a4);_0x3f30d1(_0x1dd4a4);});});} \ No newline at end of file diff --git a/server/api/saSalesCondition/index.js b/server/api/saSalesCondition/index.js index 5c4235d..4000f02 100644 --- a/server/api/saSalesCondition/index.js +++ b/server/api/saSalesCondition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0666=['../../components/interaction/service','./saSalesCondition.controller','get','isAuthenticated','index','/:id','show','post','create','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x0666,0x13d));var _0x6066=function(_0x1946f7,_0x344f58){_0x1946f7=_0x1946f7-0x0;var _0x2f8b34=_0x0666[_0x1946f7];return _0x2f8b34;};'use strict';var multer=require('multer');var util=require(_0x6066('0x0'));var path=require(_0x6066('0x1'));var timeout=require(_0x6066('0x2'));var express=require(_0x6066('0x3'));var router=express['Router']();var auth=require(_0x6066('0x4'));var interaction=require(_0x6066('0x5'));var config=require('../../config/environment');var controller=require(_0x6066('0x6'));router[_0x6066('0x7')]('/',auth[_0x6066('0x8')](),controller[_0x6066('0x9')]);router['get'](_0x6066('0xa'),auth['isAuthenticated'](),controller[_0x6066('0xb')]);router[_0x6066('0xc')]('/',auth['isAuthenticated'](),controller[_0x6066('0xd')]);module['exports']=router; \ No newline at end of file +var _0xf7f6=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./saSalesCondition.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xf7f6,0xb4));var _0x6f7f=function(_0x12f155,_0x16a21d){_0x12f155=_0x12f155-0x0;var _0x452490=_0xf7f6[_0x12f155];return _0x452490;};'use strict';var multer=require(_0x6f7f('0x0'));var util=require(_0x6f7f('0x1'));var path=require('path');var timeout=require(_0x6f7f('0x2'));var express=require(_0x6f7f('0x3'));var router=express[_0x6f7f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6f7f('0x5'));var config=require(_0x6f7f('0x6'));var controller=require(_0x6f7f('0x7'));router['get']('/',auth[_0x6f7f('0x8')](),controller[_0x6f7f('0x9')]);router[_0x6f7f('0xa')](_0x6f7f('0xb'),auth[_0x6f7f('0x8')](),controller[_0x6f7f('0xc')]);router[_0x6f7f('0xd')]('/',auth['isAuthenticated'](),controller[_0x6f7f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saSalesCondition/saSalesCondition.attributes.js b/server/api/saSalesCondition/saSalesCondition.attributes.js index a02f544..9fb47ad 100644 --- a/server/api/saSalesCondition/saSalesCondition.attributes.js +++ b/server/api/saSalesCondition/saSalesCondition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0bb=['exports','STRING','INTEGER','sequelize'];(function(_0x1e829f,_0x4d1242){var _0x320356=function(_0x165a0e){while(--_0x165a0e){_0x1e829f['push'](_0x1e829f['shift']());}};_0x320356(++_0x4d1242);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3fccdc,_0x543784){_0x3fccdc=_0x3fccdc-0x0;var _0x2c37a2=_0xd0bb[_0x3fccdc];return _0x2c37a2;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')],'allowNull':![],'unique':'name'},'momthlysubscription':{'type':Sequelize[_0xbd0b('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5636=['sequelize','exports'];(function(_0x53e695,_0x475ae8){var _0x1d244f=function(_0x77e23d){while(--_0x77e23d){_0x53e695['push'](_0x53e695['shift']());}};_0x1d244f(++_0x475ae8);}(_0x5636,0x102));var _0x6563=function(_0x2e4c2d,_0x4e1f45){_0x2e4c2d=_0x2e4c2d-0x0;var _0x365484=_0x5636[_0x2e4c2d];return _0x365484;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'momthlysubscription':{'type':Sequelize['INTEGER'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/saSalesCondition/saSalesCondition.controller.js b/server/api/saSalesCondition/saSalesCondition.controller.js index d013616..5c4a300 100644 --- a/server/api/saSalesCondition/saSalesCondition.controller.js +++ b/server/api/saSalesCondition/saSalesCondition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b68=['filters','intersection','model','attributes','fields','nolimit','sort','where','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','show','params','length','include','create','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','then','destroy','stack','name','send','index','SASalesCondition','rawAttributes','keys','query'];(function(_0x1327a9,_0x2cbcb5){var _0xe4583b=function(_0x44066e){while(--_0x44066e){_0x1327a9['push'](_0x1327a9['shift']());}};_0xe4583b(++_0x2cbcb5);}(_0x3b68,0xd6));var _0x83b6=function(_0x39ea4d,_0xd1a8f9){_0x39ea4d=_0x39ea4d-0x0;var _0x13266a=_0x3b68[_0x39ea4d];return _0x13266a;};'use strict';var pdf=require(_0x83b6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x83b6('0x1'));var zipdir=require(_0x83b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x83b6('0x3'));var BPromise=require(_0x83b6('0x4'));var Mustache=require(_0x83b6('0x5'));var util=require(_0x83b6('0x6'));var path=require(_0x83b6('0x7'));var sox=require(_0x83b6('0x8'));var csv=require('to-csv');var ejs=require(_0x83b6('0x9'));var fs=require('fs');var _=require(_0x83b6('0xa'));var squel=require(_0x83b6('0xb'));var crypto=require(_0x83b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x83b6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x83b6('0xe'));var Papa=require('papaparse');var Redis=require(_0x83b6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x83b6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x83b6('0x11'));var db=require(_0x83b6('0x12'))['db'];function respondWithStatusCode(_0xc07e9a,_0x5b0b02){_0x5b0b02=_0x5b0b02||0xcc;return function(_0x1125ae){if(_0x1125ae){return _0xc07e9a[_0x83b6('0x13')](_0x5b0b02);}return _0xc07e9a[_0x83b6('0x14')](_0x5b0b02)[_0x83b6('0x15')]();};}function respondWithResult(_0x31cf49,_0x1969c9){_0x1969c9=_0x1969c9||0xc8;return function(_0x8b4100){if(_0x8b4100){return _0x31cf49['status'](_0x1969c9)[_0x83b6('0x16')](_0x8b4100);}};}function respondWithFilteredResult(_0x2c9846,_0x21ad50){return function(_0x5b44e3){if(_0x5b44e3){var _0x529c71=_0x5b44e3['count'],_0x8cc5cf=_0x21ad50[_0x83b6('0x17')],_0x15c12d=_0x21ad50[_0x83b6('0x17')]+_0x21ad50[_0x83b6('0x18')],_0x1e7395;if(_0x15c12d>=_0x529c71){_0x15c12d=_0x529c71;_0x1e7395=0xc8;}else{_0x1e7395=0xce;}_0x2c9846['status'](_0x1e7395);return _0x2c9846[_0x83b6('0x19')](_0x83b6('0x1a'),_0x8cc5cf+'-'+_0x15c12d+'/'+_0x529c71)[_0x83b6('0x16')](_0x5b44e3);}return null;};}function patchUpdates(_0x38415e){return function(_0x3f12ec){try{jsonpatch['apply'](_0x3f12ec,_0x38415e,!![]);}catch(_0x577286){return BPromise['reject'](_0x577286);}return _0x3f12ec[_0x83b6('0x1b')]();};}function saveUpdates(_0x1f6d31,_0x4a4fb5){return function(_0x26df37){if(_0x26df37){return _0x26df37['update'](_0x1f6d31)[_0x83b6('0x1c')](function(_0x460f4e){return _0x460f4e;});}return null;};}function removeEntity(_0x404146,_0xb41c60){return function(_0x215711){if(_0x215711){return _0x215711[_0x83b6('0x1d')]()['then'](function(){_0x404146[_0x83b6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264829,_0x1947dd){return function(_0x3a4ad2){if(!_0x3a4ad2){_0x264829[_0x83b6('0x13')](0x194);}return _0x3a4ad2;};}function handleError(_0x62d62,_0x44f338){_0x44f338=_0x44f338||0x1f4;return function(_0xf14de1){logger['error'](_0xf14de1[_0x83b6('0x1e')]);if(_0xf14de1[_0x83b6('0x1f')]){delete _0xf14de1[_0x83b6('0x1f')];}_0x62d62[_0x83b6('0x14')](_0x44f338)[_0x83b6('0x20')](_0xf14de1);};}exports[_0x83b6('0x21')]=function(_0x3d7cf8,_0x1a63c2){var _0x457f05={'raw':!![]},_0xeede5d={},_0x2e2f26={'count':0x0,'rows':[]};var _0x56b325=db[_0x83b6('0x22')][_0x83b6('0x23')];_0xeede5d['model']=_[_0x83b6('0x24')](_0x56b325);_0xeede5d[_0x83b6('0x25')]=_[_0x83b6('0x24')](_0x3d7cf8[_0x83b6('0x25')]);_0xeede5d[_0x83b6('0x26')]=_[_0x83b6('0x27')](_0xeede5d[_0x83b6('0x28')],_0xeede5d[_0x83b6('0x25')]);_0x457f05[_0x83b6('0x29')]=_[_0x83b6('0x27')](_0xeede5d['model'],qs[_0x83b6('0x2a')](_0x3d7cf8[_0x83b6('0x25')]['fields']));_0x457f05['attributes']=_0x457f05[_0x83b6('0x29')]['length']?_0x457f05['attributes']:_0xeede5d[_0x83b6('0x28')];if(!_0x3d7cf8['query']['hasOwnProperty'](_0x83b6('0x2b'))){_0x457f05[_0x83b6('0x18')]=qs[_0x83b6('0x18')](_0x3d7cf8[_0x83b6('0x25')][_0x83b6('0x18')]);_0x457f05[_0x83b6('0x17')]=qs[_0x83b6('0x17')](_0x3d7cf8['query'][_0x83b6('0x17')]);}_0x457f05['order']=qs[_0x83b6('0x2c')](_0x3d7cf8[_0x83b6('0x25')][_0x83b6('0x2c')]);_0x457f05[_0x83b6('0x2d')]=qs['filters'](_['pick'](_0x3d7cf8[_0x83b6('0x25')],_0xeede5d[_0x83b6('0x26')]));if(_0x3d7cf8[_0x83b6('0x25')][_0x83b6('0x2e')]){_0x457f05[_0x83b6('0x2d')]=_[_0x83b6('0x2f')](_0x457f05[_0x83b6('0x2d')],{'$or':_[_0x83b6('0x30')](_0x56b325,function(_0x1eb2e6){if(_0x1eb2e6[_0x83b6('0x31')]['key']!==_0x83b6('0x32')){var _0x4295cd={};_0x4295cd[_0x1eb2e6[_0x83b6('0x33')]]={'$like':'%'+_0x3d7cf8[_0x83b6('0x25')][_0x83b6('0x2e')]+'%'};return _0x4295cd;}})});}_0x457f05=_['merge']({},_0x457f05,_0x3d7cf8[_0x83b6('0x34')]);var _0x3f21f1={'where':_0x457f05[_0x83b6('0x2d')]};return db[_0x83b6('0x22')][_0x83b6('0x35')](_0x3f21f1)['then'](function(_0x3e36ef){_0x2e2f26[_0x83b6('0x35')]=_0x3e36ef;if(_0x3d7cf8['query'][_0x83b6('0x36')]){_0x457f05['include']=[{'all':!![]}];}return db[_0x83b6('0x22')][_0x83b6('0x37')](_0x457f05);})['then'](function(_0x30d4d4){_0x2e2f26[_0x83b6('0x38')]=_0x30d4d4;return _0x2e2f26;})[_0x83b6('0x1c')](respondWithFilteredResult(_0x1a63c2,_0x457f05))[_0x83b6('0x39')](handleError(_0x1a63c2,null));};exports[_0x83b6('0x3a')]=function(_0x504c3d,_0x2d0713){var _0x33718f={'raw':!![],'where':{'id':_0x504c3d[_0x83b6('0x3b')]['id']}},_0x5d5dbb={};_0x5d5dbb[_0x83b6('0x28')]=_[_0x83b6('0x24')](db['SASalesCondition'][_0x83b6('0x23')]);_0x5d5dbb[_0x83b6('0x25')]=_['keys'](_0x504c3d[_0x83b6('0x25')]);_0x5d5dbb[_0x83b6('0x26')]=_[_0x83b6('0x27')](_0x5d5dbb[_0x83b6('0x28')],_0x5d5dbb['query']);_0x33718f[_0x83b6('0x29')]=_[_0x83b6('0x27')](_0x5d5dbb[_0x83b6('0x28')],qs[_0x83b6('0x2a')](_0x504c3d[_0x83b6('0x25')][_0x83b6('0x2a')]));_0x33718f[_0x83b6('0x29')]=_0x33718f[_0x83b6('0x29')][_0x83b6('0x3c')]?_0x33718f[_0x83b6('0x29')]:_0x5d5dbb[_0x83b6('0x28')];if(_0x504c3d[_0x83b6('0x25')]['includeAll']){_0x33718f[_0x83b6('0x3d')]=[{'all':!![]}];}_0x33718f=_[_0x83b6('0x2f')]({},_0x33718f,_0x504c3d[_0x83b6('0x34')]);return db[_0x83b6('0x22')]['find'](_0x33718f)[_0x83b6('0x1c')](handleEntityNotFound(_0x2d0713,null))[_0x83b6('0x1c')](respondWithResult(_0x2d0713,null))[_0x83b6('0x39')](handleError(_0x2d0713,null));};exports[_0x83b6('0x3e')]=function(_0x238d8f,_0x5c5015){return db['SASalesCondition'][_0x83b6('0x3e')](_0x238d8f['body'],{})[_0x83b6('0x1c')](respondWithResult(_0x5c5015,0xc9))[_0x83b6('0x39')](handleError(_0x5c5015,null));}; \ No newline at end of file +var _0xa43b=['field','options','count','includeAll','include','findAll','catch','show','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','SASalesCondition','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL'];(function(_0x18a772,_0x1a4d3f){var _0xbaac04=function(_0x467aa6){while(--_0x467aa6){_0x18a772['push'](_0x18a772['shift']());}};_0xbaac04(++_0x1a4d3f);}(_0xa43b,0x12e));var _0xba43=function(_0x3aa640,_0x430b73){_0x3aa640=_0x3aa640-0x0;var _0x1cabbc=_0xa43b[_0x3aa640];return _0x1cabbc;};'use strict';var pdf=require(_0xba43('0x0'));var emlformat=require(_0xba43('0x1'));var rimraf=require(_0xba43('0x2'));var zipdir=require(_0xba43('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba43('0x4'));var moment=require(_0xba43('0x5'));var BPromise=require(_0xba43('0x6'));var Mustache=require(_0xba43('0x7'));var util=require(_0xba43('0x8'));var path=require('path');var sox=require(_0xba43('0x9'));var csv=require(_0xba43('0xa'));var ejs=require(_0xba43('0xb'));var fs=require('fs');var _=require(_0xba43('0xc'));var squel=require(_0xba43('0xd'));var crypto=require('crypto');var jsforce=require(_0xba43('0xe'));var deskjs=require(_0xba43('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba43('0x10'));var Redis=require(_0xba43('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xba43('0x12'));var logger=require(_0xba43('0x13'))(_0xba43('0x14'));var utils=require(_0xba43('0x15'));var config=require(_0xba43('0x16'));var db=require(_0xba43('0x17'))['db'];function respondWithStatusCode(_0x3ccd2b,_0x276c1f){_0x276c1f=_0x276c1f||0xcc;return function(_0x529868){if(_0x529868){return _0x3ccd2b['sendStatus'](_0x276c1f);}return _0x3ccd2b[_0xba43('0x18')](_0x276c1f)[_0xba43('0x19')]();};}function respondWithResult(_0xe434ef,_0x284af5){_0x284af5=_0x284af5||0xc8;return function(_0x1ded4b){if(_0x1ded4b){return _0xe434ef['status'](_0x284af5)[_0xba43('0x1a')](_0x1ded4b);}};}function respondWithFilteredResult(_0x418d8b,_0x1d49c1){return function(_0x636803){if(_0x636803){var _0x4a41d0=_0x636803['count'],_0x5584f4=_0x1d49c1[_0xba43('0x1b')],_0x44bcff=_0x1d49c1[_0xba43('0x1b')]+_0x1d49c1[_0xba43('0x1c')],_0x3f2312;if(_0x44bcff>=_0x4a41d0){_0x44bcff=_0x4a41d0;_0x3f2312=0xc8;}else{_0x3f2312=0xce;}_0x418d8b[_0xba43('0x18')](_0x3f2312);return _0x418d8b['set'](_0xba43('0x1d'),_0x5584f4+'-'+_0x44bcff+'/'+_0x4a41d0)[_0xba43('0x1a')](_0x636803);}return null;};}function patchUpdates(_0x14c7a4){return function(_0x2b8aad){try{jsonpatch[_0xba43('0x1e')](_0x2b8aad,_0x14c7a4,!![]);}catch(_0x216b40){return BPromise['reject'](_0x216b40);}return _0x2b8aad[_0xba43('0x1f')]();};}function saveUpdates(_0x46ff98,_0x6bf9c4){return function(_0x2c4d19){if(_0x2c4d19){return _0x2c4d19[_0xba43('0x20')](_0x46ff98)['then'](function(_0x4aa66f){return _0x4aa66f;});}return null;};}function removeEntity(_0x157e63,_0xee7ad6){return function(_0x56f93f){if(_0x56f93f){return _0x56f93f[_0xba43('0x21')]()[_0xba43('0x22')](function(){_0x157e63[_0xba43('0x18')](0xcc)[_0xba43('0x19')]();});}};}function handleEntityNotFound(_0x5b5e9d,_0xceaa3e){return function(_0x3c364b){if(!_0x3c364b){_0x5b5e9d[_0xba43('0x23')](0x194);}return _0x3c364b;};}function handleError(_0x210970,_0x2a0c35){_0x2a0c35=_0x2a0c35||0x1f4;return function(_0x239ea0){logger[_0xba43('0x24')](_0x239ea0[_0xba43('0x25')]);if(_0x239ea0[_0xba43('0x26')]){delete _0x239ea0[_0xba43('0x26')];}_0x210970['status'](_0x2a0c35)[_0xba43('0x27')](_0x239ea0);};}exports[_0xba43('0x28')]=function(_0x5e40ab,_0x20f98d){var _0x52843f={'raw':!![]},_0x3676fe={},_0x24815c={'count':0x0,'rows':[]};var _0x51ebec=db[_0xba43('0x29')][_0xba43('0x2a')];_0x3676fe[_0xba43('0x2b')]=_[_0xba43('0x2c')](_0x51ebec);_0x3676fe[_0xba43('0x2d')]=_[_0xba43('0x2c')](_0x5e40ab[_0xba43('0x2d')]);_0x3676fe[_0xba43('0x2e')]=_[_0xba43('0x2f')](_0x3676fe[_0xba43('0x2b')],_0x3676fe['query']);_0x52843f['attributes']=_[_0xba43('0x2f')](_0x3676fe[_0xba43('0x2b')],qs[_0xba43('0x30')](_0x5e40ab['query'][_0xba43('0x30')]));_0x52843f[_0xba43('0x31')]=_0x52843f[_0xba43('0x31')][_0xba43('0x32')]?_0x52843f['attributes']:_0x3676fe[_0xba43('0x2b')];if(!_0x5e40ab[_0xba43('0x2d')][_0xba43('0x33')](_0xba43('0x34'))){_0x52843f['limit']=qs['limit'](_0x5e40ab[_0xba43('0x2d')][_0xba43('0x1c')]);_0x52843f[_0xba43('0x1b')]=qs[_0xba43('0x1b')](_0x5e40ab[_0xba43('0x2d')]['offset']);}_0x52843f[_0xba43('0x35')]=qs[_0xba43('0x36')](_0x5e40ab['query'][_0xba43('0x36')]);_0x52843f[_0xba43('0x37')]=qs[_0xba43('0x2e')](_[_0xba43('0x38')](_0x5e40ab['query'],_0x3676fe[_0xba43('0x2e')]));if(_0x5e40ab[_0xba43('0x2d')][_0xba43('0x39')]){_0x52843f[_0xba43('0x37')]=_[_0xba43('0x3a')](_0x52843f['where'],{'$or':_[_0xba43('0x3b')](_0x51ebec,function(_0x25c155){if(_0x25c155[_0xba43('0x3c')][_0xba43('0x3d')]!==_0xba43('0x3e')){var _0x135746={};_0x135746[_0x25c155[_0xba43('0x3f')]]={'$like':'%'+_0x5e40ab['query'][_0xba43('0x39')]+'%'};return _0x135746;}})});}_0x52843f=_['merge']({},_0x52843f,_0x5e40ab[_0xba43('0x40')]);var _0x35ce53={'where':_0x52843f[_0xba43('0x37')]};return db[_0xba43('0x29')][_0xba43('0x41')](_0x35ce53)[_0xba43('0x22')](function(_0x39a737){_0x24815c['count']=_0x39a737;if(_0x5e40ab[_0xba43('0x2d')][_0xba43('0x42')]){_0x52843f[_0xba43('0x43')]=[{'all':!![]}];}return db[_0xba43('0x29')][_0xba43('0x44')](_0x52843f);})[_0xba43('0x22')](function(_0x41feea){_0x24815c['rows']=_0x41feea;return _0x24815c;})['then'](respondWithFilteredResult(_0x20f98d,_0x52843f))[_0xba43('0x45')](handleError(_0x20f98d,null));};exports[_0xba43('0x46')]=function(_0x27ca0e,_0x6664a5){var _0x50e43a={'raw':!![],'where':{'id':_0x27ca0e['params']['id']}},_0x3f7e01={};_0x3f7e01[_0xba43('0x2b')]=_[_0xba43('0x2c')](db[_0xba43('0x29')]['rawAttributes']);_0x3f7e01[_0xba43('0x2d')]=_[_0xba43('0x2c')](_0x27ca0e[_0xba43('0x2d')]);_0x3f7e01[_0xba43('0x2e')]=_[_0xba43('0x2f')](_0x3f7e01['model'],_0x3f7e01[_0xba43('0x2d')]);_0x50e43a[_0xba43('0x31')]=_['intersection'](_0x3f7e01[_0xba43('0x2b')],qs['fields'](_0x27ca0e[_0xba43('0x2d')][_0xba43('0x30')]));_0x50e43a['attributes']=_0x50e43a[_0xba43('0x31')]['length']?_0x50e43a['attributes']:_0x3f7e01[_0xba43('0x2b')];if(_0x27ca0e[_0xba43('0x2d')][_0xba43('0x42')]){_0x50e43a[_0xba43('0x43')]=[{'all':!![]}];}_0x50e43a=_[_0xba43('0x3a')]({},_0x50e43a,_0x27ca0e['options']);return db[_0xba43('0x29')]['find'](_0x50e43a)['then'](handleEntityNotFound(_0x6664a5,null))['then'](respondWithResult(_0x6664a5,null))['catch'](handleError(_0x6664a5,null));};exports[_0xba43('0x47')]=function(_0x385a78,_0x15ac7a){return db[_0xba43('0x29')][_0xba43('0x47')](_0x385a78[_0xba43('0x48')],{})[_0xba43('0x22')](respondWithResult(_0x15ac7a,0xc9))['catch'](handleError(_0x15ac7a,null));}; \ No newline at end of file diff --git a/server/api/saSalesCondition/saSalesCondition.model.js b/server/api/saSalesCondition/saSalesCondition.model.js index 756e34c..4c0ce82 100644 --- a/server/api/saSalesCondition/saSalesCondition.model.js +++ b/server/api/saSalesCondition/saSalesCondition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfa4=['rimraf','./saSalesCondition.attributes','exports','define','SASalesCondition','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c8ff9,_0x174266){var _0x419207=function(_0x20f631){while(--_0x20f631){_0x3c8ff9['push'](_0x3c8ff9['shift']());}};_0x419207(++_0x174266);}(_0xdfa4,0x1f1));var _0x4dfa=function(_0x3ac61e,_0x30304b){_0x3ac61e=_0x3ac61e-0x0;var _0x2ac4ca=_0xdfa4[_0x3ac61e];return _0x2ac4ca;};'use strict';var _=require(_0x4dfa('0x0'));var util=require('util');var logger=require(_0x4dfa('0x1'))(_0x4dfa('0x2'));var moment=require(_0x4dfa('0x3'));var BPromise=require(_0x4dfa('0x4'));var rp=require(_0x4dfa('0x5'));var fs=require('fs');var path=require(_0x4dfa('0x6'));var rimraf=require(_0x4dfa('0x7'));var config=require('../../config/environment');var attributes=require(_0x4dfa('0x8'));module[_0x4dfa('0x9')]=function(_0x4af7b2,_0x30db17){return _0x4af7b2[_0x4dfa('0xa')](_0x4dfa('0xb'),attributes,{'tableName':'sa_sales_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fa2=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','SASalesCondition','sa_sales_conditions'];(function(_0x385cac,_0x196617){var _0xc0e067=function(_0x1bd36f){while(--_0x1bd36f){_0x385cac['push'](_0x385cac['shift']());}};_0xc0e067(++_0x196617);}(_0x8fa2,0x1d6));var _0x28fa=function(_0x1621f3,_0x58795a){_0x1621f3=_0x1621f3-0x0;var _0x315c7d=_0x8fa2[_0x1621f3];return _0x315c7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x28fa('0x0'))(_0x28fa('0x1'));var moment=require('moment');var BPromise=require(_0x28fa('0x2'));var rp=require(_0x28fa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28fa('0x4'));var config=require(_0x28fa('0x5'));var attributes=require('./saSalesCondition.attributes');module[_0x28fa('0x6')]=function(_0x52eea2,_0x1c4827){return _0x52eea2[_0x28fa('0x7')](_0x28fa('0x8'),attributes,{'tableName':_0x28fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saSalesCondition/saSalesCondition.rpc.js b/server/api/saSalesCondition/saSalesCondition.rpc.js index fc83a6f..f0225ae 100644 --- a/server/api/saSalesCondition/saSalesCondition.rpc.js +++ b/server/api/saSalesCondition/saSalesCondition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x142c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SASalesCondition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x142c,0x153));var _0xc142=function(_0x267084,_0x224f6d){_0x267084=_0x267084-0x0;var _0x4d9f9f=_0x142c[_0x267084];return _0x4d9f9f;};'use strict';var _=require('lodash');var util=require(_0xc142('0x0'));var moment=require('moment');var BPromise=require(_0xc142('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc142('0x2'));var db=require(_0xc142('0x3'))['db'];var utils=require(_0xc142('0x4'));var logger=require(_0xc142('0x5'))(_0xc142('0x6'));var config=require(_0xc142('0x7'));var jayson=require(_0xc142('0x8'));var client=jayson[_0xc142('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d4cc,_0x439e73,_0x513620){return new BPromise(function(_0x40f79a,_0x2c4313){return client[_0xc142('0xa')](_0x39d4cc,_0x513620)[_0xc142('0xb')](function(_0x3b42b7){logger[_0xc142('0xc')](_0xc142('0xd'),_0x439e73,_0xc142('0xe'));logger['debug']('SASalesCondition,\x20%s,\x20%s,\x20%s',_0x439e73,_0xc142('0xe'),JSON[_0xc142('0xf')](_0x3b42b7));if(_0x3b42b7[_0xc142('0x10')]){if(_0x3b42b7['error'][_0xc142('0x11')]===0x1f4){logger[_0xc142('0x10')]('SASalesCondition,\x20%s,\x20%s',_0x439e73,_0x3b42b7['error'][_0xc142('0x12')]);return _0x2c4313(_0x3b42b7[_0xc142('0x10')][_0xc142('0x12')]);}logger[_0xc142('0x10')](_0xc142('0xd'),_0x439e73,_0x3b42b7[_0xc142('0x10')][_0xc142('0x12')]);return _0x40f79a(_0x3b42b7[_0xc142('0x10')][_0xc142('0x12')]);}else{logger['info'](_0xc142('0xd'),_0x439e73,_0xc142('0xe'));_0x40f79a(_0x3b42b7[_0xc142('0x13')][_0xc142('0x12')]);}})['catch'](function(_0xde7327){logger[_0xc142('0x10')](_0xc142('0xd'),_0x439e73,_0xde7327);_0x2c4313(_0xde7327);});});} \ No newline at end of file +var _0x4315=['then','info','request\x20sent','SASalesCondition,\x20%s,\x20%s,\x20%s','stringify','error','code','SASalesCondition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4093d3,_0x2e2841){var _0x9cc73a=function(_0x261217){while(--_0x261217){_0x4093d3['push'](_0x4093d3['shift']());}};_0x9cc73a(++_0x2e2841);}(_0x4315,0xbb));var _0x5431=function(_0x25b274,_0x578748){_0x25b274=_0x25b274-0x0;var _0x367046=_0x4315[_0x25b274];return _0x367046;};'use strict';var _=require(_0x5431('0x0'));var util=require(_0x5431('0x1'));var moment=require(_0x5431('0x2'));var BPromise=require('bluebird');var rs=require(_0x5431('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5431('0x4'));var logger=require(_0x5431('0x5'))(_0x5431('0x6'));var config=require(_0x5431('0x7'));var jayson=require(_0x5431('0x8'));var client=jayson[_0x5431('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab30a,_0x4b7aec,_0x401a95){return new BPromise(function(_0x124be9,_0x4cefae){return client[_0x5431('0xa')](_0x3ab30a,_0x401a95)[_0x5431('0xb')](function(_0x2a28eb){logger[_0x5431('0xc')]('SASalesCondition,\x20%s,\x20%s',_0x4b7aec,_0x5431('0xd'));logger['debug'](_0x5431('0xe'),_0x4b7aec,_0x5431('0xd'),JSON[_0x5431('0xf')](_0x2a28eb));if(_0x2a28eb[_0x5431('0x10')]){if(_0x2a28eb[_0x5431('0x10')][_0x5431('0x11')]===0x1f4){logger[_0x5431('0x10')](_0x5431('0x12'),_0x4b7aec,_0x2a28eb[_0x5431('0x10')][_0x5431('0x13')]);return _0x4cefae(_0x2a28eb[_0x5431('0x10')][_0x5431('0x13')]);}logger['error']('SASalesCondition,\x20%s,\x20%s',_0x4b7aec,_0x2a28eb[_0x5431('0x10')]['message']);return _0x124be9(_0x2a28eb[_0x5431('0x10')]['message']);}else{logger[_0x5431('0xc')](_0x5431('0x12'),_0x4b7aec,_0x5431('0xd'));_0x124be9(_0x2a28eb[_0x5431('0x14')][_0x5431('0x13')]);}})[_0x5431('0x15')](function(_0x424b11){logger[_0x5431('0x10')]('SASalesCondition,\x20%s,\x20%s',_0x4b7aec,_0x424b11);_0x4cefae(_0x424b11);});});} \ No newline at end of file diff --git a/server/api/saTypeProduct/index.js b/server/api/saTypeProduct/index.js index 3258919..1ee9791 100644 --- a/server/api/saTypeProduct/index.js +++ b/server/api/saTypeProduct/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e83=['../../config/environment','./saTypeProduct.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service'];(function(_0x3a2622,_0xf279df){var _0x26c01f=function(_0x315455){while(--_0x315455){_0x3a2622['push'](_0x3a2622['shift']());}};_0x26c01f(++_0xf279df);}(_0x0e83,0x14f));var _0x30e8=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x0e83[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0x30e8('0x0'));var util=require(_0x30e8('0x1'));var path=require(_0x30e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x30e8('0x3'));var interaction=require(_0x30e8('0x4'));var config=require(_0x30e8('0x5'));var controller=require(_0x30e8('0x6'));router['get']('/',auth[_0x30e8('0x7')](),controller[_0x30e8('0x8')]);router[_0x30e8('0x9')](_0x30e8('0xa'),auth['isAuthenticated'](),controller[_0x30e8('0xb')]);router[_0x30e8('0x9')](_0x30e8('0xc'),auth['isAuthenticated'](),controller[_0x30e8('0xd')]);router[_0x30e8('0xe')]('/',auth['isAuthenticated'](),controller[_0x30e8('0xf')]);router['put'](_0x30e8('0xc'),auth[_0x30e8('0x7')](),controller[_0x30e8('0x10')]);router[_0x30e8('0x11')](_0x30e8('0xc'),auth[_0x30e8('0x7')](),controller[_0x30e8('0x12')]);module[_0x30e8('0x13')]=router; \ No newline at end of file +var _0x4209=['update','delete','/:id','destroy','exports','multer','connect-timeout','express','../../config/environment','./saTypeProduct.controller','get','index','isAuthenticated','show','create','put'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4209,0x155));var _0x9420=function(_0x4c4cbf,_0x1e6e6){_0x4c4cbf=_0x4c4cbf-0x0;var _0xa65774=_0x4209[_0x4c4cbf];return _0xa65774;};'use strict';var multer=require(_0x9420('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9420('0x1'));var express=require(_0x9420('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9420('0x3'));var controller=require(_0x9420('0x4'));router[_0x9420('0x5')]('/',auth['isAuthenticated'](),controller[_0x9420('0x6')]);router[_0x9420('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9420('0x5')]('/:id',auth[_0x9420('0x7')](),controller[_0x9420('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9420('0x9')]);router[_0x9420('0xa')]('/:id',auth[_0x9420('0x7')](),controller[_0x9420('0xb')]);router[_0x9420('0xc')](_0x9420('0xd'),auth[_0x9420('0x7')](),controller[_0x9420('0xe')]);module[_0x9420('0xf')]=router; \ No newline at end of file diff --git a/server/api/saTypeProduct/saTypeProduct.attributes.js b/server/api/saTypeProduct/saTypeProduct.attributes.js index e74ed06..e96798c 100644 --- a/server/api/saTypeProduct/saTypeProduct.attributes.js +++ b/server/api/saTypeProduct/saTypeProduct.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b95=['STRING','sequelize','exports'];(function(_0x13c790,_0x260820){var _0x3fc1e0=function(_0x51d15a){while(--_0x51d15a){_0x13c790['push'](_0x13c790['shift']());}};_0x3fc1e0(++_0x260820);}(_0x6b95,0x9a));var _0x56b9=function(_0x547957,_0x4b9968){_0x547957=_0x547957-0x0;var _0x58860c=_0x6b95[_0x547957];return _0x58860c;};'use strict';var Sequelize=require(_0x56b9('0x0'));module[_0x56b9('0x1')]={'name':{'type':Sequelize[_0x56b9('0x2')],'allowNull':![],'unique':'name'}}; \ No newline at end of file +var _0x6251=['STRING','exports'];(function(_0x5949ad,_0x58a438){var _0x26ef21=function(_0x36b337){while(--_0x36b337){_0x5949ad['push'](_0x5949ad['shift']());}};_0x26ef21(++_0x58a438);}(_0x6251,0x85));var _0x1625=function(_0x4801a0,_0x252c24){_0x4801a0=_0x4801a0-0x0;var _0x338e26=_0x6251[_0x4801a0];return _0x338e26;};'use strict';var Sequelize=require('sequelize');module[_0x1625('0x0')]={'name':{'type':Sequelize[_0x1625('0x1')],'allowNull':![],'unique':'name'}}; \ No newline at end of file diff --git a/server/api/saTypeProduct/saTypeProduct.controller.js b/server/api/saTypeProduct/saTypeProduct.controller.js index 2dbadd6..221dec5 100644 --- a/server/api/saTypeProduct/saTypeProduct.controller.js +++ b/server/api/saTypeProduct/saTypeProduct.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dae=['save','update','then','destroy','error','name','index','SATypeProduct','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','field','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','reject'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x2dae,0x13c));var _0xe2da=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0x2dae[_0x33c637];return _0x14aa20;};'use strict';var pdf=require(_0xe2da('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe2da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var Mustache=require(_0xe2da('0x5'));var util=require(_0xe2da('0x6'));var path=require(_0xe2da('0x7'));var sox=require('sox');var csv=require(_0xe2da('0x8'));var ejs=require(_0xe2da('0x9'));var fs=require('fs');var _=require(_0xe2da('0xa'));var squel=require(_0xe2da('0xb'));var crypto=require(_0xe2da('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe2da('0xd'));var toCsv=require(_0xe2da('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2da('0xe'));var authService=require(_0xe2da('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xe2da('0x10'));var logger=require(_0xe2da('0x11'))(_0xe2da('0x12'));var utils=require(_0xe2da('0x13'));var config=require(_0xe2da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9721e3,_0x60e427){_0x60e427=_0x60e427||0xcc;return function(_0x2f82eb){if(_0x2f82eb){return _0x9721e3[_0xe2da('0x15')](_0x60e427);}return _0x9721e3[_0xe2da('0x16')](_0x60e427)[_0xe2da('0x17')]();};}function respondWithResult(_0x2beb6f,_0x14ff19){_0x14ff19=_0x14ff19||0xc8;return function(_0x4d979f){if(_0x4d979f){return _0x2beb6f[_0xe2da('0x16')](_0x14ff19)[_0xe2da('0x18')](_0x4d979f);}};}function respondWithFilteredResult(_0x5be510,_0x18ee16){return function(_0x195d85){if(_0x195d85){var _0x8ff536=_0x195d85[_0xe2da('0x19')],_0x11b7f1=_0x18ee16[_0xe2da('0x1a')],_0xd30838=_0x18ee16[_0xe2da('0x1a')]+_0x18ee16[_0xe2da('0x1b')],_0x5746d1;if(_0xd30838>=_0x8ff536){_0xd30838=_0x8ff536;_0x5746d1=0xc8;}else{_0x5746d1=0xce;}_0x5be510[_0xe2da('0x16')](_0x5746d1);return _0x5be510['set']('Content-Range',_0x11b7f1+'-'+_0xd30838+'/'+_0x8ff536)['json'](_0x195d85);}return null;};}function patchUpdates(_0x285fd9){return function(_0x928463){try{jsonpatch['apply'](_0x928463,_0x285fd9,!![]);}catch(_0x328e45){return BPromise[_0xe2da('0x1c')](_0x328e45);}return _0x928463[_0xe2da('0x1d')]();};}function saveUpdates(_0x5b29d3,_0x38c83b){return function(_0x529562){if(_0x529562){return _0x529562[_0xe2da('0x1e')](_0x5b29d3)[_0xe2da('0x1f')](function(_0x21cd8e){return _0x21cd8e;});}return null;};}function removeEntity(_0x4a0928,_0x3354a0){return function(_0x31190d){if(_0x31190d){return _0x31190d[_0xe2da('0x20')]()[_0xe2da('0x1f')](function(){_0x4a0928[_0xe2da('0x16')](0xcc)[_0xe2da('0x17')]();});}};}function handleEntityNotFound(_0x3681de,_0x506afb){return function(_0x22abdf){if(!_0x22abdf){_0x3681de[_0xe2da('0x15')](0x194);}return _0x22abdf;};}function handleError(_0x514c94,_0x133180){_0x133180=_0x133180||0x1f4;return function(_0x2a5857){logger[_0xe2da('0x21')](_0x2a5857['stack']);if(_0x2a5857[_0xe2da('0x22')]){delete _0x2a5857[_0xe2da('0x22')];}_0x514c94[_0xe2da('0x16')](_0x133180)['send'](_0x2a5857);};}exports[_0xe2da('0x23')]=function(_0x2b306c,_0x29968a){var _0x3e6c23={},_0x2b01b8={},_0xcaece4={'count':0x0,'rows':[]};var _0x2564e9=db[_0xe2da('0x24')]['rawAttributes'];_0x2b01b8[_0xe2da('0x25')]=_[_0xe2da('0x26')](_0x2564e9);_0x2b01b8[_0xe2da('0x27')]=_[_0xe2da('0x26')](_0x2b306c['query']);_0x2b01b8[_0xe2da('0x28')]=_['intersection'](_0x2b01b8[_0xe2da('0x25')],_0x2b01b8[_0xe2da('0x27')]);_0x3e6c23[_0xe2da('0x29')]=_[_0xe2da('0x2a')](_0x2b01b8[_0xe2da('0x25')],qs[_0xe2da('0x2b')](_0x2b306c[_0xe2da('0x27')]['fields']));_0x3e6c23[_0xe2da('0x29')]=_0x3e6c23[_0xe2da('0x29')][_0xe2da('0x2c')]?_0x3e6c23['attributes']:_0x2b01b8[_0xe2da('0x25')];if(!_0x2b306c[_0xe2da('0x27')][_0xe2da('0x2d')](_0xe2da('0x2e'))){_0x3e6c23[_0xe2da('0x1b')]=qs[_0xe2da('0x1b')](_0x2b306c[_0xe2da('0x27')][_0xe2da('0x1b')]);_0x3e6c23[_0xe2da('0x1a')]=qs[_0xe2da('0x1a')](_0x2b306c[_0xe2da('0x27')]['offset']);}_0x3e6c23[_0xe2da('0x2f')]=qs[_0xe2da('0x30')](_0x2b306c[_0xe2da('0x27')][_0xe2da('0x30')]);_0x3e6c23['where']=qs[_0xe2da('0x28')](_[_0xe2da('0x31')](_0x2b306c[_0xe2da('0x27')],_0x2b01b8[_0xe2da('0x28')]));if(_0x2b306c[_0xe2da('0x27')][_0xe2da('0x32')]){_0x3e6c23[_0xe2da('0x33')]=_[_0xe2da('0x34')](_0x3e6c23[_0xe2da('0x33')],{'$or':_[_0xe2da('0x35')](_0x2564e9,function(_0x166f3c){if(_0x166f3c[_0xe2da('0x36')][_0xe2da('0x37')]!=='VIRTUAL'){var _0xdbe8fe={};_0xdbe8fe[_0x166f3c[_0xe2da('0x38')]]={'$like':'%'+_0x2b306c[_0xe2da('0x27')][_0xe2da('0x32')]+'%'};return _0xdbe8fe;}})});}_0x3e6c23=_[_0xe2da('0x34')]({},_0x3e6c23,_0x2b306c[_0xe2da('0x39')]);var _0x3757bb={'where':_0x3e6c23['where']};return db[_0xe2da('0x24')][_0xe2da('0x19')](_0x3757bb)[_0xe2da('0x1f')](function(_0x3d3725){_0xcaece4['count']=_0x3d3725;if(_0x2b306c['query'][_0xe2da('0x3a')]){_0x3e6c23[_0xe2da('0x3b')]=[{'all':!![]}];}return db[_0xe2da('0x24')]['findAll'](_0x3e6c23);})[_0xe2da('0x1f')](function(_0xc3fa08){_0xcaece4[_0xe2da('0x3c')]=_0xc3fa08;return _0xcaece4;})[_0xe2da('0x1f')](respondWithFilteredResult(_0x29968a,_0x3e6c23))[_0xe2da('0x3d')](handleError(_0x29968a,null));};exports[_0xe2da('0x3e')]=function(_0x40c2f6,_0x56cfe4){var _0x54c8f1={'raw':![],'where':{'id':_0x40c2f6['params']['id']}},_0x1ceeb2={};_0x1ceeb2[_0xe2da('0x25')]=_[_0xe2da('0x26')](db[_0xe2da('0x24')][_0xe2da('0x3f')]);_0x1ceeb2[_0xe2da('0x27')]=_[_0xe2da('0x26')](_0x40c2f6[_0xe2da('0x27')]);_0x1ceeb2['filters']=_[_0xe2da('0x2a')](_0x1ceeb2['model'],_0x1ceeb2[_0xe2da('0x27')]);_0x54c8f1[_0xe2da('0x29')]=_[_0xe2da('0x2a')](_0x1ceeb2[_0xe2da('0x25')],qs[_0xe2da('0x2b')](_0x40c2f6[_0xe2da('0x27')][_0xe2da('0x2b')]));_0x54c8f1['attributes']=_0x54c8f1['attributes'][_0xe2da('0x2c')]?_0x54c8f1[_0xe2da('0x29')]:_0x1ceeb2[_0xe2da('0x25')];if(_0x40c2f6['query'][_0xe2da('0x3a')]){_0x54c8f1['include']=[{'all':!![]}];}_0x54c8f1=_[_0xe2da('0x34')]({},_0x54c8f1,_0x40c2f6['options']);return db['SATypeProduct'][_0xe2da('0x40')](_0x54c8f1)[_0xe2da('0x1f')](handleEntityNotFound(_0x56cfe4,null))['then'](respondWithResult(_0x56cfe4,null))[_0xe2da('0x3d')](handleError(_0x56cfe4,null));};exports['create']=function(_0x38aac6,_0x2284f1){return db[_0xe2da('0x24')][_0xe2da('0x41')](_0x38aac6[_0xe2da('0x42')],{})[_0xe2da('0x1f')](respondWithResult(_0x2284f1,0xc9))[_0xe2da('0x3d')](handleError(_0x2284f1,null));};exports[_0xe2da('0x1e')]=function(_0x80f1a7,_0x38b5ea){if(_0x80f1a7[_0xe2da('0x42')]['id']){delete _0x80f1a7[_0xe2da('0x42')]['id'];}return db['SATypeProduct']['find']({'where':{'id':_0x80f1a7[_0xe2da('0x43')]['id']}})[_0xe2da('0x1f')](handleEntityNotFound(_0x38b5ea,null))[_0xe2da('0x1f')](saveUpdates(_0x80f1a7[_0xe2da('0x42')],null))['then'](respondWithResult(_0x38b5ea,null))[_0xe2da('0x3d')](handleError(_0x38b5ea,null));};exports[_0xe2da('0x20')]=function(_0x19c419,_0x5109ae){return db[_0xe2da('0x24')][_0xe2da('0x40')]({'where':{'id':_0x19c419[_0xe2da('0x43')]['id']}})[_0xe2da('0x1f')](handleEntityNotFound(_0x5109ae,null))[_0xe2da('0x1f')](removeEntity(_0x5109ae,null))[_0xe2da('0x3d')](handleError(_0x5109ae,null));};exports[_0xe2da('0x44')]=function(_0x2ceb48,_0x2ed264){return db[_0xe2da('0x24')]['describe']()[_0xe2da('0x1f')](respondWithResult(_0x2ed264,null))[_0xe2da('0x3d')](handleError(_0x2ed264,null));}; \ No newline at end of file +var _0xceb5=['to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','SATypeProduct','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','merge','map','type','key','VIRTUAL','field','filter','includeAll','catch','show','params','fields','length','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3a01c1,_0x116056){var _0xc6fb88=function(_0x57c9fa){while(--_0x57c9fa){_0x3a01c1['push'](_0x3a01c1['shift']());}};_0xc6fb88(++_0x116056);}(_0xceb5,0x1f4));var _0x5ceb=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xceb5[_0x1406ae];return _0x23a076;};'use strict';var pdf=require(_0x5ceb('0x0'));var emlformat=require(_0x5ceb('0x1'));var rimraf=require(_0x5ceb('0x2'));var zipdir=require(_0x5ceb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ceb('0x4'));var moment=require(_0x5ceb('0x5'));var BPromise=require(_0x5ceb('0x6'));var Mustache=require(_0x5ceb('0x7'));var util=require(_0x5ceb('0x8'));var path=require(_0x5ceb('0x9'));var sox=require(_0x5ceb('0xa'));var csv=require(_0x5ceb('0xb'));var ejs=require(_0x5ceb('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ceb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ceb('0xe'));var Papa=require(_0x5ceb('0xf'));var Redis=require(_0x5ceb('0x10'));var authService=require(_0x5ceb('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x5ceb('0x12'));var logger=require(_0x5ceb('0x13'))(_0x5ceb('0x14'));var utils=require(_0x5ceb('0x15'));var config=require(_0x5ceb('0x16'));var db=require(_0x5ceb('0x17'))['db'];function respondWithStatusCode(_0x56f345,_0x234759){_0x234759=_0x234759||0xcc;return function(_0x2556ad){if(_0x2556ad){return _0x56f345[_0x5ceb('0x18')](_0x234759);}return _0x56f345[_0x5ceb('0x19')](_0x234759)[_0x5ceb('0x1a')]();};}function respondWithResult(_0x30bc20,_0x414f17){_0x414f17=_0x414f17||0xc8;return function(_0x1835aa){if(_0x1835aa){return _0x30bc20['status'](_0x414f17)[_0x5ceb('0x1b')](_0x1835aa);}};}function respondWithFilteredResult(_0x216cbf,_0x11e893){return function(_0x2200b1){if(_0x2200b1){var _0x41d6c3=_0x2200b1[_0x5ceb('0x1c')],_0x29a384=_0x11e893[_0x5ceb('0x1d')],_0x38b15f=_0x11e893[_0x5ceb('0x1d')]+_0x11e893[_0x5ceb('0x1e')],_0x328d2a;if(_0x38b15f>=_0x41d6c3){_0x38b15f=_0x41d6c3;_0x328d2a=0xc8;}else{_0x328d2a=0xce;}_0x216cbf[_0x5ceb('0x19')](_0x328d2a);return _0x216cbf[_0x5ceb('0x1f')](_0x5ceb('0x20'),_0x29a384+'-'+_0x38b15f+'/'+_0x41d6c3)['json'](_0x2200b1);}return null;};}function patchUpdates(_0x2cea16){return function(_0x5cb294){try{jsonpatch[_0x5ceb('0x21')](_0x5cb294,_0x2cea16,!![]);}catch(_0x782ef){return BPromise[_0x5ceb('0x22')](_0x782ef);}return _0x5cb294['save']();};}function saveUpdates(_0x1db4d7,_0xf1338a){return function(_0x79c151){if(_0x79c151){return _0x79c151[_0x5ceb('0x23')](_0x1db4d7)[_0x5ceb('0x24')](function(_0x5910c1){return _0x5910c1;});}return null;};}function removeEntity(_0x4dd255,_0x2efe14){return function(_0x44dd8b){if(_0x44dd8b){return _0x44dd8b[_0x5ceb('0x25')]()[_0x5ceb('0x24')](function(){_0x4dd255[_0x5ceb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2443cd,_0x2facb9){return function(_0x4ac2cb){if(!_0x4ac2cb){_0x2443cd[_0x5ceb('0x18')](0x194);}return _0x4ac2cb;};}function handleError(_0xfe8f6e,_0x30f23e){_0x30f23e=_0x30f23e||0x1f4;return function(_0x1b904e){logger[_0x5ceb('0x26')](_0x1b904e[_0x5ceb('0x27')]);if(_0x1b904e['name']){delete _0x1b904e[_0x5ceb('0x28')];}_0xfe8f6e[_0x5ceb('0x19')](_0x30f23e)['send'](_0x1b904e);};}exports['index']=function(_0xab5abf,_0x1eaa69){var _0x4dc152={},_0x5970e6={},_0x3a338b={'count':0x0,'rows':[]};var _0x3e520c=db[_0x5ceb('0x29')][_0x5ceb('0x2a')];_0x5970e6[_0x5ceb('0x2b')]=_[_0x5ceb('0x2c')](_0x3e520c);_0x5970e6[_0x5ceb('0x2d')]=_[_0x5ceb('0x2c')](_0xab5abf['query']);_0x5970e6[_0x5ceb('0x2e')]=_[_0x5ceb('0x2f')](_0x5970e6['model'],_0x5970e6[_0x5ceb('0x2d')]);_0x4dc152[_0x5ceb('0x30')]=_[_0x5ceb('0x2f')](_0x5970e6[_0x5ceb('0x2b')],qs['fields'](_0xab5abf[_0x5ceb('0x2d')]['fields']));_0x4dc152[_0x5ceb('0x30')]=_0x4dc152[_0x5ceb('0x30')]['length']?_0x4dc152[_0x5ceb('0x30')]:_0x5970e6[_0x5ceb('0x2b')];if(!_0xab5abf[_0x5ceb('0x2d')][_0x5ceb('0x31')](_0x5ceb('0x32'))){_0x4dc152['limit']=qs[_0x5ceb('0x1e')](_0xab5abf['query'][_0x5ceb('0x1e')]);_0x4dc152[_0x5ceb('0x1d')]=qs['offset'](_0xab5abf[_0x5ceb('0x2d')][_0x5ceb('0x1d')]);}_0x4dc152[_0x5ceb('0x33')]=qs[_0x5ceb('0x34')](_0xab5abf[_0x5ceb('0x2d')][_0x5ceb('0x34')]);_0x4dc152['where']=qs['filters'](_['pick'](_0xab5abf[_0x5ceb('0x2d')],_0x5970e6['filters']));if(_0xab5abf[_0x5ceb('0x2d')]['filter']){_0x4dc152[_0x5ceb('0x35')]=_[_0x5ceb('0x36')](_0x4dc152['where'],{'$or':_[_0x5ceb('0x37')](_0x3e520c,function(_0x3537a3){if(_0x3537a3[_0x5ceb('0x38')][_0x5ceb('0x39')]!==_0x5ceb('0x3a')){var _0x476b97={};_0x476b97[_0x3537a3[_0x5ceb('0x3b')]]={'$like':'%'+_0xab5abf[_0x5ceb('0x2d')][_0x5ceb('0x3c')]+'%'};return _0x476b97;}})});}_0x4dc152=_[_0x5ceb('0x36')]({},_0x4dc152,_0xab5abf['options']);var _0x4ad78b={'where':_0x4dc152[_0x5ceb('0x35')]};return db['SATypeProduct'][_0x5ceb('0x1c')](_0x4ad78b)[_0x5ceb('0x24')](function(_0x354ab8){_0x3a338b[_0x5ceb('0x1c')]=_0x354ab8;if(_0xab5abf[_0x5ceb('0x2d')][_0x5ceb('0x3d')]){_0x4dc152['include']=[{'all':!![]}];}return db[_0x5ceb('0x29')]['findAll'](_0x4dc152);})['then'](function(_0x4ab558){_0x3a338b['rows']=_0x4ab558;return _0x3a338b;})[_0x5ceb('0x24')](respondWithFilteredResult(_0x1eaa69,_0x4dc152))[_0x5ceb('0x3e')](handleError(_0x1eaa69,null));};exports[_0x5ceb('0x3f')]=function(_0x4b54a3,_0x2212f1){var _0x2a264a={'raw':![],'where':{'id':_0x4b54a3[_0x5ceb('0x40')]['id']}},_0x5e7a51={};_0x5e7a51[_0x5ceb('0x2b')]=_[_0x5ceb('0x2c')](db[_0x5ceb('0x29')][_0x5ceb('0x2a')]);_0x5e7a51['query']=_[_0x5ceb('0x2c')](_0x4b54a3[_0x5ceb('0x2d')]);_0x5e7a51[_0x5ceb('0x2e')]=_[_0x5ceb('0x2f')](_0x5e7a51[_0x5ceb('0x2b')],_0x5e7a51['query']);_0x2a264a[_0x5ceb('0x30')]=_[_0x5ceb('0x2f')](_0x5e7a51['model'],qs['fields'](_0x4b54a3[_0x5ceb('0x2d')][_0x5ceb('0x41')]));_0x2a264a[_0x5ceb('0x30')]=_0x2a264a[_0x5ceb('0x30')][_0x5ceb('0x42')]?_0x2a264a[_0x5ceb('0x30')]:_0x5e7a51[_0x5ceb('0x2b')];if(_0x4b54a3['query'][_0x5ceb('0x3d')]){_0x2a264a[_0x5ceb('0x43')]=[{'all':!![]}];}_0x2a264a=_[_0x5ceb('0x36')]({},_0x2a264a,_0x4b54a3[_0x5ceb('0x44')]);return db['SATypeProduct'][_0x5ceb('0x45')](_0x2a264a)[_0x5ceb('0x24')](handleEntityNotFound(_0x2212f1,null))[_0x5ceb('0x24')](respondWithResult(_0x2212f1,null))['catch'](handleError(_0x2212f1,null));};exports[_0x5ceb('0x46')]=function(_0x266f78,_0x339a72){return db[_0x5ceb('0x29')][_0x5ceb('0x46')](_0x266f78[_0x5ceb('0x47')],{})[_0x5ceb('0x24')](respondWithResult(_0x339a72,0xc9))[_0x5ceb('0x3e')](handleError(_0x339a72,null));};exports[_0x5ceb('0x23')]=function(_0x592e7e,_0xaf521a){if(_0x592e7e[_0x5ceb('0x47')]['id']){delete _0x592e7e['body']['id'];}return db[_0x5ceb('0x29')][_0x5ceb('0x45')]({'where':{'id':_0x592e7e[_0x5ceb('0x40')]['id']}})[_0x5ceb('0x24')](handleEntityNotFound(_0xaf521a,null))[_0x5ceb('0x24')](saveUpdates(_0x592e7e['body'],null))[_0x5ceb('0x24')](respondWithResult(_0xaf521a,null))[_0x5ceb('0x3e')](handleError(_0xaf521a,null));};exports[_0x5ceb('0x25')]=function(_0x5c95cf,_0x36cb10){return db[_0x5ceb('0x29')][_0x5ceb('0x45')]({'where':{'id':_0x5c95cf[_0x5ceb('0x40')]['id']}})[_0x5ceb('0x24')](handleEntityNotFound(_0x36cb10,null))['then'](removeEntity(_0x36cb10,null))['catch'](handleError(_0x36cb10,null));};exports[_0x5ceb('0x48')]=function(_0x5d2fc5,_0x52aa78){return db[_0x5ceb('0x29')][_0x5ceb('0x48')]()[_0x5ceb('0x24')](respondWithResult(_0x52aa78,null))['catch'](handleError(_0x52aa78,null));}; \ No newline at end of file diff --git a/server/api/saTypeProduct/saTypeProduct.model.js b/server/api/saTypeProduct/saTypeProduct.model.js index c4232a3..5847f0e 100644 --- a/server/api/saTypeProduct/saTypeProduct.model.js +++ b/server/api/saTypeProduct/saTypeProduct.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa78d=['sa_type_products','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./saTypeProduct.attributes','exports','define','SATypeProduct'];(function(_0x37fa71,_0x4a26dc){var _0x2379de=function(_0x459c8e){while(--_0x459c8e){_0x37fa71['push'](_0x37fa71['shift']());}};_0x2379de(++_0x4a26dc);}(_0xa78d,0x11f));var _0xda78=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xa78d[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xda78('0x0'));var util=require(_0xda78('0x1'));var logger=require(_0xda78('0x2'))(_0xda78('0x3'));var moment=require('moment');var BPromise=require(_0xda78('0x4'));var rp=require(_0xda78('0x5'));var fs=require('fs');var path=require(_0xda78('0x6'));var rimraf=require('rimraf');var config=require(_0xda78('0x7'));var attributes=require(_0xda78('0x8'));module[_0xda78('0x9')]=function(_0x9eb28b,_0xa82d26){return _0x9eb28b[_0xda78('0xa')](_0xda78('0xb'),attributes,{'tableName':_0xda78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8304=['SATypeProduct','sa_type_products','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./saTypeProduct.attributes','define'];(function(_0x61872c,_0xc740c0){var _0x3107a4=function(_0x790632){while(--_0x790632){_0x61872c['push'](_0x61872c['shift']());}};_0x3107a4(++_0xc740c0);}(_0x8304,0x16a));var _0x4830=function(_0x1b5fdd,_0x5cf4e5){_0x1b5fdd=_0x1b5fdd-0x0;var _0x234c76=_0x8304[_0x1b5fdd];return _0x234c76;};'use strict';var _=require(_0x4830('0x0'));var util=require('util');var logger=require(_0x4830('0x1'))('api');var moment=require(_0x4830('0x2'));var BPromise=require(_0x4830('0x3'));var rp=require(_0x4830('0x4'));var fs=require('fs');var path=require(_0x4830('0x5'));var rimraf=require(_0x4830('0x6'));var config=require(_0x4830('0x7'));var attributes=require(_0x4830('0x8'));module['exports']=function(_0x16b087,_0x15af8d){return _0x16b087[_0x4830('0x9')](_0x4830('0xa'),attributes,{'tableName':_0x4830('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saTypeProduct/saTypeProduct.rpc.js b/server/api/saTypeProduct/saTypeProduct.rpc.js index 9989f90..4886ef3 100644 --- a/server/api/saTypeProduct/saTypeProduct.rpc.js +++ b/server/api/saTypeProduct/saTypeProduct.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0525=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','request\x20sent','debug','SATypeProduct,\x20%s,\x20%s,\x20%s','stringify','error','code','SATypeProduct,\x20%s,\x20%s','message','result'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x0525,0x74));var _0x5052=function(_0x35213d,_0x5a5f7b){_0x35213d=_0x35213d-0x0;var _0x4559eb=_0x0525[_0x35213d];return _0x4559eb;};'use strict';var _=require(_0x5052('0x0'));var util=require(_0x5052('0x1'));var moment=require(_0x5052('0x2'));var BPromise=require(_0x5052('0x3'));var rs=require(_0x5052('0x4'));var fs=require('fs');var Redis=require(_0x5052('0x5'));var db=require(_0x5052('0x6'))['db'];var utils=require(_0x5052('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5052('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5052('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cf7f5,_0xa8cb07,_0x20b6d5){return new BPromise(function(_0xf1f8af,_0x3c6bf9){return client[_0x5052('0xa')](_0x3cf7f5,_0x20b6d5)[_0x5052('0xb')](function(_0x100ec0){logger[_0x5052('0xc')]('SATypeProduct,\x20%s,\x20%s',_0xa8cb07,_0x5052('0xd'));logger[_0x5052('0xe')](_0x5052('0xf'),_0xa8cb07,_0x5052('0xd'),JSON[_0x5052('0x10')](_0x100ec0));if(_0x100ec0[_0x5052('0x11')]){if(_0x100ec0[_0x5052('0x11')][_0x5052('0x12')]===0x1f4){logger[_0x5052('0x11')](_0x5052('0x13'),_0xa8cb07,_0x100ec0['error']['message']);return _0x3c6bf9(_0x100ec0['error']['message']);}logger[_0x5052('0x11')](_0x5052('0x13'),_0xa8cb07,_0x100ec0['error'][_0x5052('0x14')]);return _0xf1f8af(_0x100ec0[_0x5052('0x11')][_0x5052('0x14')]);}else{logger[_0x5052('0xc')](_0x5052('0x13'),_0xa8cb07,_0x5052('0xd'));_0xf1f8af(_0x100ec0[_0x5052('0x15')][_0x5052('0x14')]);}})[_0x5052('0x16')](function(_0x335d7b){logger[_0x5052('0x11')](_0x5052('0x13'),_0xa8cb07,_0x335d7b);_0x3c6bf9(_0x335d7b);});});} \ No newline at end of file +var _0xcf59=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SATypeProduct,\x20%s,\x20%s','debug','SATypeProduct,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1c7f6f,_0x208f3e){var _0x148a84=function(_0x4bdb76){while(--_0x4bdb76){_0x1c7f6f['push'](_0x1c7f6f['shift']());}};_0x148a84(++_0x208f3e);}(_0xcf59,0x128));var _0x9cf5=function(_0x4dccfb,_0x5c9f92){_0x4dccfb=_0x4dccfb-0x0;var _0x20bc89=_0xcf59[_0x4dccfb];return _0x20bc89;};'use strict';var _=require(_0x9cf5('0x0'));var util=require('util');var moment=require(_0x9cf5('0x1'));var BPromise=require(_0x9cf5('0x2'));var rs=require(_0x9cf5('0x3'));var fs=require('fs');var Redis=require(_0x9cf5('0x4'));var db=require(_0x9cf5('0x5'))['db'];var utils=require(_0x9cf5('0x6'));var logger=require(_0x9cf5('0x7'))(_0x9cf5('0x8'));var config=require(_0x9cf5('0x9'));var jayson=require(_0x9cf5('0xa'));var client=jayson[_0x9cf5('0xb')][_0x9cf5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cdf31,_0x1c72d6,_0x2e391d){return new BPromise(function(_0x3f73ba,_0x10b95a){return client['request'](_0x5cdf31,_0x2e391d)[_0x9cf5('0xd')](function(_0x36474c){logger['info'](_0x9cf5('0xe'),_0x1c72d6,'request\x20sent');logger[_0x9cf5('0xf')](_0x9cf5('0x10'),_0x1c72d6,_0x9cf5('0x11'),JSON[_0x9cf5('0x12')](_0x36474c));if(_0x36474c['error']){if(_0x36474c[_0x9cf5('0x13')][_0x9cf5('0x14')]===0x1f4){logger[_0x9cf5('0x13')](_0x9cf5('0xe'),_0x1c72d6,_0x36474c[_0x9cf5('0x13')][_0x9cf5('0x15')]);return _0x10b95a(_0x36474c[_0x9cf5('0x13')][_0x9cf5('0x15')]);}logger['error'](_0x9cf5('0xe'),_0x1c72d6,_0x36474c[_0x9cf5('0x13')][_0x9cf5('0x15')]);return _0x3f73ba(_0x36474c[_0x9cf5('0x13')][_0x9cf5('0x15')]);}else{logger[_0x9cf5('0x16')](_0x9cf5('0xe'),_0x1c72d6,'request\x20sent');_0x3f73ba(_0x36474c[_0x9cf5('0x17')]['message']);}})[_0x9cf5('0x18')](function(_0x5f44e6){logger[_0x9cf5('0x13')](_0x9cf5('0xe'),_0x1c72d6,_0x5f44e6);_0x10b95a(_0x5f44e6);});});} \ No newline at end of file diff --git a/server/api/saUnitMeasure/index.js b/server/api/saUnitMeasure/index.js index ac6cf58..42ce89f 100644 --- a/server/api/saUnitMeasure/index.js +++ b/server/api/saUnitMeasure/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d28=['/describe','isAuthenticated','describe','show','post','create','/:id','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./saUnitMeasure.controller','get'];(function(_0x598432,_0x3e0a66){var _0x552478=function(_0x56d9c5){while(--_0x56d9c5){_0x598432['push'](_0x598432['shift']());}};_0x552478(++_0x3e0a66);}(_0x2d28,0x13b));var _0x82d2=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x2d28[_0x421eeb];return _0x2c7371;};'use strict';var multer=require(_0x82d2('0x0'));var util=require(_0x82d2('0x1'));var path=require('path');var timeout=require(_0x82d2('0x2'));var express=require(_0x82d2('0x3'));var router=express['Router']();var auth=require(_0x82d2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82d2('0x5'));var controller=require(_0x82d2('0x6'));router[_0x82d2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x82d2('0x7')](_0x82d2('0x8'),auth[_0x82d2('0x9')](),controller[_0x82d2('0xa')]);router[_0x82d2('0x7')]('/:id',auth[_0x82d2('0x9')](),controller[_0x82d2('0xb')]);router[_0x82d2('0xc')]('/',auth[_0x82d2('0x9')](),controller[_0x82d2('0xd')]);router['put'](_0x82d2('0xe'),auth[_0x82d2('0x9')](),controller['update']);router[_0x82d2('0xf')](_0x82d2('0xe'),auth[_0x82d2('0x9')](),controller['destroy']);module[_0x82d2('0x10')]=router; \ No newline at end of file +var _0x6baa=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./saUnitMeasure.controller','get','isAuthenticated','/describe','describe','show','post','put','update','delete','/:id','destroy','multer','util'];(function(_0x39ae60,_0x5b6664){var _0x2d8630=function(_0xd71c4e){while(--_0xd71c4e){_0x39ae60['push'](_0x39ae60['shift']());}};_0x2d8630(++_0x5b6664);}(_0x6baa,0x102));var _0xa6ba=function(_0x4975be,_0x77c086){_0x4975be=_0x4975be-0x0;var _0xa10adf=_0x6baa[_0x4975be];return _0xa10adf;};'use strict';var multer=require(_0xa6ba('0x0'));var util=require(_0xa6ba('0x1'));var path=require(_0xa6ba('0x2'));var timeout=require(_0xa6ba('0x3'));var express=require(_0xa6ba('0x4'));var router=express['Router']();var auth=require(_0xa6ba('0x5'));var interaction=require(_0xa6ba('0x6'));var config=require(_0xa6ba('0x7'));var controller=require(_0xa6ba('0x8'));router[_0xa6ba('0x9')]('/',auth[_0xa6ba('0xa')](),controller['index']);router[_0xa6ba('0x9')](_0xa6ba('0xb'),auth[_0xa6ba('0xa')](),controller[_0xa6ba('0xc')]);router[_0xa6ba('0x9')]('/:id',auth[_0xa6ba('0xa')](),controller[_0xa6ba('0xd')]);router[_0xa6ba('0xe')]('/',auth[_0xa6ba('0xa')](),controller['create']);router[_0xa6ba('0xf')]('/:id',auth[_0xa6ba('0xa')](),controller[_0xa6ba('0x10')]);router[_0xa6ba('0x11')](_0xa6ba('0x12'),auth['isAuthenticated'](),controller[_0xa6ba('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/saUnitMeasure/saUnitMeasure.attributes.js b/server/api/saUnitMeasure/saUnitMeasure.attributes.js index 6390134..4e5a0dd 100644 --- a/server/api/saUnitMeasure/saUnitMeasure.attributes.js +++ b/server/api/saUnitMeasure/saUnitMeasure.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87e7=['CHAR','sequelize','STRING','name'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x87e7,0xad));var _0x787e=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x87e7[_0x3f25b2];return _0xd8caeb;};'use strict';var Sequelize=require(_0x787e('0x0'));module['exports']={'name':{'type':Sequelize[_0x787e('0x1')],'allowNull':![],'unique':_0x787e('0x2')},'abbreviation':{'type':Sequelize[_0x787e('0x3')](0x3),'allowNull':![],'unique':'abbreviation'}}; \ No newline at end of file +var _0x0829=['exports','CHAR','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x0829,0xd7));var _0x9082=function(_0x560bac,_0x28a289){_0x560bac=_0x560bac-0x0;var _0xcf7ea2=_0x0829[_0x560bac];return _0xcf7ea2;};'use strict';var Sequelize=require(_0x9082('0x0'));module[_0x9082('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'abbreviation':{'type':Sequelize[_0x9082('0x2')](0x3),'allowNull':![],'unique':'abbreviation'}}; \ No newline at end of file diff --git a/server/api/saUnitMeasure/saUnitMeasure.controller.js b/server/api/saUnitMeasure/saUnitMeasure.controller.js index f780e78..3b13ac7 100644 --- a/server/api/saUnitMeasure/saUnitMeasure.controller.js +++ b/server/api/saUnitMeasure/saUnitMeasure.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeb8=['end','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','SAUnitMeasure','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','map','type','key','VIRTUAL','field','filter','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1f0e8b,_0x4650a9){var _0x2b57f6=function(_0x355a17){while(--_0x355a17){_0x1f0e8b['push'](_0x1f0e8b['shift']());}};_0x2b57f6(++_0x4650a9);}(_0xaeb8,0xc3));var _0x8aeb=function(_0xdcca54,_0x4b2b61){_0xdcca54=_0xdcca54-0x0;var _0x453197=_0xaeb8[_0xdcca54];return _0x453197;};'use strict';var pdf=require(_0x8aeb('0x0'));var emlformat=require(_0x8aeb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8aeb('0x2'));var jsonpatch=require(_0x8aeb('0x3'));var rp=require('request-promise');var moment=require(_0x8aeb('0x4'));var BPromise=require(_0x8aeb('0x5'));var Mustache=require(_0x8aeb('0x6'));var util=require(_0x8aeb('0x7'));var path=require(_0x8aeb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8aeb('0x9'));var fs=require('fs');var _=require(_0x8aeb('0xa'));var squel=require(_0x8aeb('0xb'));var crypto=require('crypto');var jsforce=require(_0x8aeb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8aeb('0xd'));var querystring=require(_0x8aeb('0xe'));var Papa=require('papaparse');var Redis=require(_0x8aeb('0xf'));var authService=require(_0x8aeb('0x10'));var qs=require(_0x8aeb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aeb('0x12'))(_0x8aeb('0x13'));var utils=require('../../config/utils');var config=require(_0x8aeb('0x14'));var db=require(_0x8aeb('0x15'))['db'];function respondWithStatusCode(_0x30871a,_0x23be74){_0x23be74=_0x23be74||0xcc;return function(_0x474f4a){if(_0x474f4a){return _0x30871a[_0x8aeb('0x16')](_0x23be74);}return _0x30871a[_0x8aeb('0x17')](_0x23be74)[_0x8aeb('0x18')]();};}function respondWithResult(_0x18d70b,_0x2b9968){_0x2b9968=_0x2b9968||0xc8;return function(_0x9f5acd){if(_0x9f5acd){return _0x18d70b[_0x8aeb('0x17')](_0x2b9968)['json'](_0x9f5acd);}};}function respondWithFilteredResult(_0x51e26d,_0x28c329){return function(_0x2ca3a4){if(_0x2ca3a4){var _0x2b067a=_0x2ca3a4['count'],_0x43eee=_0x28c329['offset'],_0x339e8e=_0x28c329[_0x8aeb('0x19')]+_0x28c329['limit'],_0x35e1a0;if(_0x339e8e>=_0x2b067a){_0x339e8e=_0x2b067a;_0x35e1a0=0xc8;}else{_0x35e1a0=0xce;}_0x51e26d['status'](_0x35e1a0);return _0x51e26d[_0x8aeb('0x1a')](_0x8aeb('0x1b'),_0x43eee+'-'+_0x339e8e+'/'+_0x2b067a)['json'](_0x2ca3a4);}return null;};}function patchUpdates(_0x405464){return function(_0x38fa6d){try{jsonpatch['apply'](_0x38fa6d,_0x405464,!![]);}catch(_0x5df643){return BPromise[_0x8aeb('0x1c')](_0x5df643);}return _0x38fa6d[_0x8aeb('0x1d')]();};}function saveUpdates(_0x1dde6b,_0x5eaeaa){return function(_0x4500ee){if(_0x4500ee){return _0x4500ee[_0x8aeb('0x1e')](_0x1dde6b)[_0x8aeb('0x1f')](function(_0x3e009f){return _0x3e009f;});}return null;};}function removeEntity(_0x4f04d2,_0x188bf4){return function(_0x508d2e){if(_0x508d2e){return _0x508d2e[_0x8aeb('0x20')]()[_0x8aeb('0x1f')](function(){_0x4f04d2[_0x8aeb('0x17')](0xcc)[_0x8aeb('0x18')]();});}};}function handleEntityNotFound(_0xf3e5f9,_0x2bb19b){return function(_0x31d845){if(!_0x31d845){_0xf3e5f9[_0x8aeb('0x16')](0x194);}return _0x31d845;};}function handleError(_0x2acdd1,_0x41f9bb){_0x41f9bb=_0x41f9bb||0x1f4;return function(_0x19255f){logger['error'](_0x19255f[_0x8aeb('0x21')]);if(_0x19255f[_0x8aeb('0x22')]){delete _0x19255f['name'];}_0x2acdd1[_0x8aeb('0x17')](_0x41f9bb)[_0x8aeb('0x23')](_0x19255f);};}exports['index']=function(_0x75a2d,_0x5954f7){var _0x42a2e1={},_0x5045da={},_0x2482f4={'count':0x0,'rows':[]};var _0x32a8fd=db[_0x8aeb('0x24')][_0x8aeb('0x25')];_0x5045da['model']=_[_0x8aeb('0x26')](_0x32a8fd);_0x5045da[_0x8aeb('0x27')]=_[_0x8aeb('0x26')](_0x75a2d[_0x8aeb('0x27')]);_0x5045da[_0x8aeb('0x28')]=_[_0x8aeb('0x29')](_0x5045da[_0x8aeb('0x2a')],_0x5045da[_0x8aeb('0x27')]);_0x42a2e1['attributes']=_[_0x8aeb('0x29')](_0x5045da[_0x8aeb('0x2a')],qs[_0x8aeb('0x2b')](_0x75a2d[_0x8aeb('0x27')]['fields']));_0x42a2e1[_0x8aeb('0x2c')]=_0x42a2e1[_0x8aeb('0x2c')][_0x8aeb('0x2d')]?_0x42a2e1[_0x8aeb('0x2c')]:_0x5045da[_0x8aeb('0x2a')];if(!_0x75a2d[_0x8aeb('0x27')][_0x8aeb('0x2e')](_0x8aeb('0x2f'))){_0x42a2e1[_0x8aeb('0x30')]=qs[_0x8aeb('0x30')](_0x75a2d[_0x8aeb('0x27')]['limit']);_0x42a2e1['offset']=qs[_0x8aeb('0x19')](_0x75a2d[_0x8aeb('0x27')]['offset']);}_0x42a2e1[_0x8aeb('0x31')]=qs['sort'](_0x75a2d['query'][_0x8aeb('0x32')]);_0x42a2e1['where']=qs[_0x8aeb('0x28')](_[_0x8aeb('0x33')](_0x75a2d[_0x8aeb('0x27')],_0x5045da[_0x8aeb('0x28')]));if(_0x75a2d[_0x8aeb('0x27')]['filter']){_0x42a2e1[_0x8aeb('0x34')]=_[_0x8aeb('0x35')](_0x42a2e1[_0x8aeb('0x34')],{'$or':_[_0x8aeb('0x36')](_0x32a8fd,function(_0x465544){if(_0x465544[_0x8aeb('0x37')][_0x8aeb('0x38')]!==_0x8aeb('0x39')){var _0x5a49b2={};_0x5a49b2[_0x465544[_0x8aeb('0x3a')]]={'$like':'%'+_0x75a2d[_0x8aeb('0x27')][_0x8aeb('0x3b')]+'%'};return _0x5a49b2;}})});}_0x42a2e1=_[_0x8aeb('0x35')]({},_0x42a2e1,_0x75a2d[_0x8aeb('0x3c')]);var _0x16e8c2={'where':_0x42a2e1['where']};return db[_0x8aeb('0x24')][_0x8aeb('0x3d')](_0x16e8c2)[_0x8aeb('0x1f')](function(_0x35b076){_0x2482f4[_0x8aeb('0x3d')]=_0x35b076;if(_0x75a2d['query']['includeAll']){_0x42a2e1[_0x8aeb('0x3e')]=[{'all':!![]}];}return db[_0x8aeb('0x24')][_0x8aeb('0x3f')](_0x42a2e1);})['then'](function(_0x1cba6c){_0x2482f4[_0x8aeb('0x40')]=_0x1cba6c;return _0x2482f4;})[_0x8aeb('0x1f')](respondWithFilteredResult(_0x5954f7,_0x42a2e1))[_0x8aeb('0x41')](handleError(_0x5954f7,null));};exports[_0x8aeb('0x42')]=function(_0x63b8e7,_0x9c524b){var _0x1cd2f7={'raw':![],'where':{'id':_0x63b8e7[_0x8aeb('0x43')]['id']}},_0x15022a={};_0x15022a[_0x8aeb('0x2a')]=_['keys'](db[_0x8aeb('0x24')][_0x8aeb('0x25')]);_0x15022a[_0x8aeb('0x27')]=_[_0x8aeb('0x26')](_0x63b8e7['query']);_0x15022a['filters']=_[_0x8aeb('0x29')](_0x15022a[_0x8aeb('0x2a')],_0x15022a[_0x8aeb('0x27')]);_0x1cd2f7['attributes']=_[_0x8aeb('0x29')](_0x15022a['model'],qs[_0x8aeb('0x2b')](_0x63b8e7[_0x8aeb('0x27')][_0x8aeb('0x2b')]));_0x1cd2f7[_0x8aeb('0x2c')]=_0x1cd2f7['attributes'][_0x8aeb('0x2d')]?_0x1cd2f7[_0x8aeb('0x2c')]:_0x15022a['model'];if(_0x63b8e7['query'][_0x8aeb('0x44')]){_0x1cd2f7[_0x8aeb('0x3e')]=[{'all':!![]}];}_0x1cd2f7=_[_0x8aeb('0x35')]({},_0x1cd2f7,_0x63b8e7[_0x8aeb('0x3c')]);return db[_0x8aeb('0x24')]['find'](_0x1cd2f7)[_0x8aeb('0x1f')](handleEntityNotFound(_0x9c524b,null))[_0x8aeb('0x1f')](respondWithResult(_0x9c524b,null))['catch'](handleError(_0x9c524b,null));};exports[_0x8aeb('0x45')]=function(_0x5e9c30,_0x224668){return db[_0x8aeb('0x24')][_0x8aeb('0x45')](_0x5e9c30[_0x8aeb('0x46')],{})[_0x8aeb('0x1f')](respondWithResult(_0x224668,0xc9))[_0x8aeb('0x41')](handleError(_0x224668,null));};exports[_0x8aeb('0x1e')]=function(_0x2addbe,_0x55a226){if(_0x2addbe[_0x8aeb('0x46')]['id']){delete _0x2addbe[_0x8aeb('0x46')]['id'];}return db[_0x8aeb('0x24')]['find']({'where':{'id':_0x2addbe[_0x8aeb('0x43')]['id']}})[_0x8aeb('0x1f')](handleEntityNotFound(_0x55a226,null))['then'](saveUpdates(_0x2addbe[_0x8aeb('0x46')],null))[_0x8aeb('0x1f')](respondWithResult(_0x55a226,null))['catch'](handleError(_0x55a226,null));};exports['destroy']=function(_0x21a055,_0x4e50ea){return db[_0x8aeb('0x24')][_0x8aeb('0x47')]({'where':{'id':_0x21a055['params']['id']}})[_0x8aeb('0x1f')](handleEntityNotFound(_0x4e50ea,null))['then'](removeEntity(_0x4e50ea,null))[_0x8aeb('0x41')](handleError(_0x4e50ea,null));};exports[_0x8aeb('0x48')]=function(_0x132ec1,_0x443a0b){return db[_0x8aeb('0x24')][_0x8aeb('0x48')]()[_0x8aeb('0x1f')](respondWithResult(_0x443a0b,null))['catch'](handleError(_0x443a0b,null));}; \ No newline at end of file +var _0x90f6=['merge','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','SAUnitMeasure','rawAttributes','keys','query','filters','attributes','model','fields','length','nolimit','order','sort','where','filter','map','type','key','VIRTUAL','field'];(function(_0x1f62de,_0x1ef9c3){var _0x271a2b=function(_0xb914ff){while(--_0xb914ff){_0x1f62de['push'](_0x1f62de['shift']());}};_0x271a2b(++_0x1ef9c3);}(_0x90f6,0xee));var _0x690f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90f6[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x690f('0x0'));var emlformat=require(_0x690f('0x1'));var rimraf=require(_0x690f('0x2'));var zipdir=require(_0x690f('0x3'));var jsonpatch=require(_0x690f('0x4'));var rp=require(_0x690f('0x5'));var moment=require(_0x690f('0x6'));var BPromise=require(_0x690f('0x7'));var Mustache=require(_0x690f('0x8'));var util=require(_0x690f('0x9'));var path=require(_0x690f('0xa'));var sox=require('sox');var csv=require(_0x690f('0xb'));var ejs=require(_0x690f('0xc'));var fs=require('fs');var _=require(_0x690f('0xd'));var squel=require('squel');var crypto=require(_0x690f('0xe'));var jsforce=require(_0x690f('0xf'));var deskjs=require(_0x690f('0x10'));var toCsv=require(_0x690f('0xb'));var querystring=require(_0x690f('0x11'));var Papa=require(_0x690f('0x12'));var Redis=require(_0x690f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x690f('0x14'));var hardwareService=require(_0x690f('0x15'));var logger=require(_0x690f('0x16'))('api');var utils=require(_0x690f('0x17'));var config=require(_0x690f('0x18'));var db=require(_0x690f('0x19'))['db'];function respondWithStatusCode(_0x136256,_0x11d88e){_0x11d88e=_0x11d88e||0xcc;return function(_0x1f5dc1){if(_0x1f5dc1){return _0x136256[_0x690f('0x1a')](_0x11d88e);}return _0x136256['status'](_0x11d88e)[_0x690f('0x1b')]();};}function respondWithResult(_0x35a9fa,_0x947e27){_0x947e27=_0x947e27||0xc8;return function(_0x38de35){if(_0x38de35){return _0x35a9fa[_0x690f('0x1c')](_0x947e27)['json'](_0x38de35);}};}function respondWithFilteredResult(_0x1f246d,_0x478154){return function(_0x2ebaed){if(_0x2ebaed){var _0x3faf4d=_0x2ebaed[_0x690f('0x1d')],_0x123688=_0x478154[_0x690f('0x1e')],_0x4ffe36=_0x478154[_0x690f('0x1e')]+_0x478154[_0x690f('0x1f')],_0x3d6ac7;if(_0x4ffe36>=_0x3faf4d){_0x4ffe36=_0x3faf4d;_0x3d6ac7=0xc8;}else{_0x3d6ac7=0xce;}_0x1f246d[_0x690f('0x1c')](_0x3d6ac7);return _0x1f246d[_0x690f('0x20')](_0x690f('0x21'),_0x123688+'-'+_0x4ffe36+'/'+_0x3faf4d)['json'](_0x2ebaed);}return null;};}function patchUpdates(_0x235ee2){return function(_0x263f89){try{jsonpatch[_0x690f('0x22')](_0x263f89,_0x235ee2,!![]);}catch(_0x412deb){return BPromise['reject'](_0x412deb);}return _0x263f89[_0x690f('0x23')]();};}function saveUpdates(_0x4d4da0,_0x5e505d){return function(_0x1c10a2){if(_0x1c10a2){return _0x1c10a2[_0x690f('0x24')](_0x4d4da0)[_0x690f('0x25')](function(_0x16a687){return _0x16a687;});}return null;};}function removeEntity(_0x36e700,_0x2b59b3){return function(_0x18f580){if(_0x18f580){return _0x18f580[_0x690f('0x26')]()[_0x690f('0x25')](function(){_0x36e700[_0x690f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484878,_0x319542){return function(_0x5a526f){if(!_0x5a526f){_0x484878[_0x690f('0x1a')](0x194);}return _0x5a526f;};}function handleError(_0x48725d,_0x2f1cb4){_0x2f1cb4=_0x2f1cb4||0x1f4;return function(_0x4c58b1){logger[_0x690f('0x27')](_0x4c58b1['stack']);if(_0x4c58b1['name']){delete _0x4c58b1[_0x690f('0x28')];}_0x48725d['status'](_0x2f1cb4)[_0x690f('0x29')](_0x4c58b1);};}exports[_0x690f('0x2a')]=function(_0x47aaa8,_0x179d7a){var _0x550b5f={},_0x1cd7da={},_0xe0afe2={'count':0x0,'rows':[]};var _0xf8ca16=db[_0x690f('0x2b')][_0x690f('0x2c')];_0x1cd7da['model']=_[_0x690f('0x2d')](_0xf8ca16);_0x1cd7da['query']=_[_0x690f('0x2d')](_0x47aaa8[_0x690f('0x2e')]);_0x1cd7da[_0x690f('0x2f')]=_['intersection'](_0x1cd7da['model'],_0x1cd7da[_0x690f('0x2e')]);_0x550b5f[_0x690f('0x30')]=_['intersection'](_0x1cd7da[_0x690f('0x31')],qs[_0x690f('0x32')](_0x47aaa8[_0x690f('0x2e')][_0x690f('0x32')]));_0x550b5f[_0x690f('0x30')]=_0x550b5f['attributes'][_0x690f('0x33')]?_0x550b5f[_0x690f('0x30')]:_0x1cd7da[_0x690f('0x31')];if(!_0x47aaa8[_0x690f('0x2e')]['hasOwnProperty'](_0x690f('0x34'))){_0x550b5f[_0x690f('0x1f')]=qs[_0x690f('0x1f')](_0x47aaa8[_0x690f('0x2e')][_0x690f('0x1f')]);_0x550b5f[_0x690f('0x1e')]=qs['offset'](_0x47aaa8[_0x690f('0x2e')][_0x690f('0x1e')]);}_0x550b5f[_0x690f('0x35')]=qs[_0x690f('0x36')](_0x47aaa8[_0x690f('0x2e')][_0x690f('0x36')]);_0x550b5f[_0x690f('0x37')]=qs[_0x690f('0x2f')](_['pick'](_0x47aaa8[_0x690f('0x2e')],_0x1cd7da[_0x690f('0x2f')]));if(_0x47aaa8[_0x690f('0x2e')][_0x690f('0x38')]){_0x550b5f[_0x690f('0x37')]=_['merge'](_0x550b5f[_0x690f('0x37')],{'$or':_[_0x690f('0x39')](_0xf8ca16,function(_0x4acea3){if(_0x4acea3[_0x690f('0x3a')][_0x690f('0x3b')]!==_0x690f('0x3c')){var _0x1038da={};_0x1038da[_0x4acea3[_0x690f('0x3d')]]={'$like':'%'+_0x47aaa8[_0x690f('0x2e')][_0x690f('0x38')]+'%'};return _0x1038da;}})});}_0x550b5f=_[_0x690f('0x3e')]({},_0x550b5f,_0x47aaa8[_0x690f('0x3f')]);var _0x6e25c1={'where':_0x550b5f['where']};return db['SAUnitMeasure']['count'](_0x6e25c1)[_0x690f('0x25')](function(_0x145a63){_0xe0afe2[_0x690f('0x1d')]=_0x145a63;if(_0x47aaa8[_0x690f('0x2e')][_0x690f('0x40')]){_0x550b5f[_0x690f('0x41')]=[{'all':!![]}];}return db[_0x690f('0x2b')]['findAll'](_0x550b5f);})[_0x690f('0x25')](function(_0xf0e1e1){_0xe0afe2[_0x690f('0x42')]=_0xf0e1e1;return _0xe0afe2;})[_0x690f('0x25')](respondWithFilteredResult(_0x179d7a,_0x550b5f))[_0x690f('0x43')](handleError(_0x179d7a,null));};exports[_0x690f('0x44')]=function(_0x55f651,_0x452232){var _0xde5367={'raw':![],'where':{'id':_0x55f651[_0x690f('0x45')]['id']}},_0x396eb5={};_0x396eb5['model']=_[_0x690f('0x2d')](db[_0x690f('0x2b')]['rawAttributes']);_0x396eb5['query']=_[_0x690f('0x2d')](_0x55f651[_0x690f('0x2e')]);_0x396eb5[_0x690f('0x2f')]=_[_0x690f('0x46')](_0x396eb5[_0x690f('0x31')],_0x396eb5['query']);_0xde5367[_0x690f('0x30')]=_[_0x690f('0x46')](_0x396eb5[_0x690f('0x31')],qs[_0x690f('0x32')](_0x55f651['query'][_0x690f('0x32')]));_0xde5367['attributes']=_0xde5367[_0x690f('0x30')][_0x690f('0x33')]?_0xde5367[_0x690f('0x30')]:_0x396eb5[_0x690f('0x31')];if(_0x55f651[_0x690f('0x2e')][_0x690f('0x40')]){_0xde5367['include']=[{'all':!![]}];}_0xde5367=_[_0x690f('0x3e')]({},_0xde5367,_0x55f651[_0x690f('0x3f')]);return db[_0x690f('0x2b')][_0x690f('0x47')](_0xde5367)[_0x690f('0x25')](handleEntityNotFound(_0x452232,null))[_0x690f('0x25')](respondWithResult(_0x452232,null))[_0x690f('0x43')](handleError(_0x452232,null));};exports['create']=function(_0x3e7626,_0x4457fa){return db[_0x690f('0x2b')][_0x690f('0x48')](_0x3e7626[_0x690f('0x49')],{})[_0x690f('0x25')](respondWithResult(_0x4457fa,0xc9))['catch'](handleError(_0x4457fa,null));};exports[_0x690f('0x24')]=function(_0x2979f0,_0x399e73){if(_0x2979f0[_0x690f('0x49')]['id']){delete _0x2979f0[_0x690f('0x49')]['id'];}return db['SAUnitMeasure']['find']({'where':{'id':_0x2979f0[_0x690f('0x45')]['id']}})['then'](handleEntityNotFound(_0x399e73,null))[_0x690f('0x25')](saveUpdates(_0x2979f0[_0x690f('0x49')],null))['then'](respondWithResult(_0x399e73,null))[_0x690f('0x43')](handleError(_0x399e73,null));};exports[_0x690f('0x26')]=function(_0x1dd21c,_0x3d646e){return db[_0x690f('0x2b')][_0x690f('0x47')]({'where':{'id':_0x1dd21c[_0x690f('0x45')]['id']}})[_0x690f('0x25')](handleEntityNotFound(_0x3d646e,null))[_0x690f('0x25')](removeEntity(_0x3d646e,null))[_0x690f('0x43')](handleError(_0x3d646e,null));};exports[_0x690f('0x4a')]=function(_0x7ba3b5,_0x1eba11){return db[_0x690f('0x2b')][_0x690f('0x4a')]()['then'](respondWithResult(_0x1eba11,null))[_0x690f('0x43')](handleError(_0x1eba11,null));}; \ No newline at end of file diff --git a/server/api/saUnitMeasure/saUnitMeasure.model.js b/server/api/saUnitMeasure/saUnitMeasure.model.js index 8c76e75..ecd3c69 100644 --- a/server/api/saUnitMeasure/saUnitMeasure.model.js +++ b/server/api/saUnitMeasure/saUnitMeasure.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31bc=['./saUnitMeasure.attributes','exports','SAUnitMeasure','sa_unit_measures','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x4c4f76,_0x5e6ebc){var _0x2fbf54=function(_0x27274a){while(--_0x27274a){_0x4c4f76['push'](_0x4c4f76['shift']());}};_0x2fbf54(++_0x5e6ebc);}(_0x31bc,0x1a2));var _0xc31b=function(_0x340907,_0x4a9781){_0x340907=_0x340907-0x0;var _0x1cd555=_0x31bc[_0x340907];return _0x1cd555;};'use strict';var _=require('lodash');var util=require(_0xc31b('0x0'));var logger=require(_0xc31b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc31b('0x2'));var rp=require(_0xc31b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc31b('0x4'));var config=require('../../config/environment');var attributes=require(_0xc31b('0x5'));module[_0xc31b('0x6')]=function(_0x1536a6,_0x528c96){return _0x1536a6['define'](_0xc31b('0x7'),attributes,{'tableName':_0xc31b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a37=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./saUnitMeasure.attributes','SAUnitMeasure','sa_unit_measures','lodash'];(function(_0xce1284,_0x4ed591){var _0x5d177c=function(_0x48db7e){while(--_0x48db7e){_0xce1284['push'](_0xce1284['shift']());}};_0x5d177c(++_0x4ed591);}(_0x9a37,0xb5));var _0x79a3=function(_0x486008,_0x2b2d05){_0x486008=_0x486008-0x0;var _0x2fefc7=_0x9a37[_0x486008];return _0x2fefc7;};'use strict';var _=require(_0x79a3('0x0'));var util=require(_0x79a3('0x1'));var logger=require(_0x79a3('0x2'))(_0x79a3('0x3'));var moment=require(_0x79a3('0x4'));var BPromise=require(_0x79a3('0x5'));var rp=require(_0x79a3('0x6'));var fs=require('fs');var path=require(_0x79a3('0x7'));var rimraf=require(_0x79a3('0x8'));var config=require(_0x79a3('0x9'));var attributes=require(_0x79a3('0xa'));module['exports']=function(_0x3127ce,_0xfbc85c){return _0x3127ce['define'](_0x79a3('0xb'),attributes,{'tableName':_0x79a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/saUnitMeasure/saUnitMeasure.rpc.js b/server/api/saUnitMeasure/saUnitMeasure.rpc.js index e7c0220..d2067a8 100644 --- a/server/api/saUnitMeasure/saUnitMeasure.rpc.js +++ b/server/api/saUnitMeasure/saUnitMeasure.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb64f=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SAUnitMeasure,\x20%s,\x20%s,\x20%s','stringify','error','code','SAUnitMeasure,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3804da,_0x4b1678){var _0x1038e3=function(_0x46dbaf){while(--_0x46dbaf){_0x3804da['push'](_0x3804da['shift']());}};_0x1038e3(++_0x4b1678);}(_0xb64f,0x7c));var _0xfb64=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xb64f[_0x574617];return _0x29de90;};'use strict';var _=require(_0xfb64('0x0'));var util=require(_0xfb64('0x1'));var moment=require(_0xfb64('0x2'));var BPromise=require(_0xfb64('0x3'));var rs=require(_0xfb64('0x4'));var fs=require('fs');var Redis=require(_0xfb64('0x5'));var db=require(_0xfb64('0x6'))['db'];var utils=require(_0xfb64('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb64('0x8'));var jayson=require(_0xfb64('0x9'));var client=jayson[_0xfb64('0xa')][_0xfb64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x284377,_0x18132b,_0xa8d016){return new BPromise(function(_0x3e2cde,_0x562192){return client['request'](_0x284377,_0xa8d016)[_0xfb64('0xc')](function(_0x2b8e07){logger[_0xfb64('0xd')]('SAUnitMeasure,\x20%s,\x20%s',_0x18132b,_0xfb64('0xe'));logger['debug'](_0xfb64('0xf'),_0x18132b,'request\x20sent',JSON[_0xfb64('0x10')](_0x2b8e07));if(_0x2b8e07[_0xfb64('0x11')]){if(_0x2b8e07[_0xfb64('0x11')][_0xfb64('0x12')]===0x1f4){logger['error'](_0xfb64('0x13'),_0x18132b,_0x2b8e07[_0xfb64('0x11')][_0xfb64('0x14')]);return _0x562192(_0x2b8e07[_0xfb64('0x11')][_0xfb64('0x14')]);}logger[_0xfb64('0x11')](_0xfb64('0x13'),_0x18132b,_0x2b8e07[_0xfb64('0x11')][_0xfb64('0x14')]);return _0x3e2cde(_0x2b8e07[_0xfb64('0x11')][_0xfb64('0x14')]);}else{logger[_0xfb64('0xd')]('SAUnitMeasure,\x20%s,\x20%s',_0x18132b,'request\x20sent');_0x3e2cde(_0x2b8e07['result'][_0xfb64('0x14')]);}})[_0xfb64('0x15')](function(_0x43ad5c){logger['error'](_0xfb64('0x13'),_0x18132b,_0x43ad5c);_0x562192(_0x43ad5c);});});} \ No newline at end of file +var _0x4ae1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SAUnitMeasure,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x425b72,_0x40be8d){var _0x3af242=function(_0x4dad98){while(--_0x4dad98){_0x425b72['push'](_0x425b72['shift']());}};_0x3af242(++_0x40be8d);}(_0x4ae1,0x131));var _0x14ae=function(_0x4dd063,_0x386d0c){_0x4dd063=_0x4dd063-0x0;var _0x2b8747=_0x4ae1[_0x4dd063];return _0x2b8747;};'use strict';var _=require(_0x14ae('0x0'));var util=require(_0x14ae('0x1'));var moment=require('moment');var BPromise=require(_0x14ae('0x2'));var rs=require(_0x14ae('0x3'));var fs=require('fs');var Redis=require(_0x14ae('0x4'));var db=require(_0x14ae('0x5'))['db'];var utils=require(_0x14ae('0x6'));var logger=require(_0x14ae('0x7'))('rpc');var config=require(_0x14ae('0x8'));var jayson=require(_0x14ae('0x9'));var client=jayson[_0x14ae('0xa')][_0x14ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x507863,_0x1fbc46,_0x1bbef8){return new BPromise(function(_0x1254e5,_0x7617d5){return client['request'](_0x507863,_0x1bbef8)[_0x14ae('0xc')](function(_0x505af0){logger[_0x14ae('0xd')](_0x14ae('0xe'),_0x1fbc46,_0x14ae('0xf'));logger['debug']('SAUnitMeasure,\x20%s,\x20%s,\x20%s',_0x1fbc46,_0x14ae('0xf'),JSON[_0x14ae('0x10')](_0x505af0));if(_0x505af0[_0x14ae('0x11')]){if(_0x505af0[_0x14ae('0x11')][_0x14ae('0x12')]===0x1f4){logger[_0x14ae('0x11')](_0x14ae('0xe'),_0x1fbc46,_0x505af0['error'][_0x14ae('0x13')]);return _0x7617d5(_0x505af0[_0x14ae('0x11')][_0x14ae('0x13')]);}logger['error'](_0x14ae('0xe'),_0x1fbc46,_0x505af0[_0x14ae('0x11')][_0x14ae('0x13')]);return _0x1254e5(_0x505af0[_0x14ae('0x11')][_0x14ae('0x13')]);}else{logger[_0x14ae('0xd')](_0x14ae('0xe'),_0x1fbc46,_0x14ae('0xf'));_0x1254e5(_0x505af0[_0x14ae('0x14')][_0x14ae('0x13')]);}})[_0x14ae('0x15')](function(_0x4e16d8){logger[_0x14ae('0x11')]('SAUnitMeasure,\x20%s,\x20%s',_0x1fbc46,_0x4e16d8);_0x7617d5(_0x4e16d8);});});} \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 7d92e98..ed71e7b 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 _0xfb94=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','index','get','/:id','isAuthenticated','show','/:id/run','put','update','delete'];(function(_0x34de7a,_0x57d22c){var _0xd1c14=function(_0x20c909){while(--_0x20c909){_0x34de7a['push'](_0x34de7a['shift']());}};_0xd1c14(++_0x57d22c);}(_0xfb94,0x11e));var _0x4fb9=function(_0x20fb05,_0x2df1d4){_0x20fb05=_0x20fb05-0x0;var _0x2a0825=_0xfb94[_0x20fb05];return _0x2a0825;};'use strict';var multer=require(_0x4fb9('0x0'));var util=require(_0x4fb9('0x1'));var path=require(_0x4fb9('0x2'));var timeout=require(_0x4fb9('0x3'));var express=require(_0x4fb9('0x4'));var router=express[_0x4fb9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4fb9('0x6'));var config=require(_0x4fb9('0x7'));var controller=require(_0x4fb9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4fb9('0x9')]);router[_0x4fb9('0xa')](_0x4fb9('0xb'),auth[_0x4fb9('0xc')](),controller[_0x4fb9('0xd')]);router[_0x4fb9('0xa')](_0x4fb9('0xe'),auth[_0x4fb9('0xc')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4fb9('0xf')]('/:id',auth[_0x4fb9('0xc')](),controller[_0x4fb9('0x10')]);router[_0x4fb9('0x11')](_0x4fb9('0xb'),auth[_0x4fb9('0xc')](),controller['destroy']);module[_0x4fb9('0x12')]=router; \ No newline at end of file +var _0xf9ae=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','create'];(function(_0x2bf835,_0x52b0ea){var _0x2383cc=function(_0x25501b){while(--_0x25501b){_0x2bf835['push'](_0x2bf835['shift']());}};_0x2383cc(++_0x52b0ea);}(_0xf9ae,0x132));var _0xef9a=function(_0x1026b3,_0x51a0b1){_0x1026b3=_0x1026b3-0x0;var _0x5bf0eb=_0xf9ae[_0x1026b3];return _0x5bf0eb;};'use strict';var multer=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var path=require(_0xef9a('0x2'));var timeout=require(_0xef9a('0x3'));var express=require(_0xef9a('0x4'));var router=express[_0xef9a('0x5')]();var auth=require(_0xef9a('0x6'));var interaction=require(_0xef9a('0x7'));var config=require(_0xef9a('0x8'));var controller=require(_0xef9a('0x9'));router[_0xef9a('0xa')]('/',auth['isAuthenticated'](),controller[_0xef9a('0xb')]);router['get'](_0xef9a('0xc'),auth[_0xef9a('0xd')](),controller[_0xef9a('0xe')]);router['get'](_0xef9a('0xf'),auth[_0xef9a('0xd')](),controller['run']);router['post']('/',auth[_0xef9a('0xd')](),controller[_0xef9a('0x10')]);router['put'](_0xef9a('0xc'),auth[_0xef9a('0xd')](),controller[_0xef9a('0x11')]);router['delete']('/:id',auth[_0xef9a('0xd')](),controller['destroy']);module[_0xef9a('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e1eb1c9..d4529a9 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 _0x6392=['weeks','days','minutes','pdf','xlsx','csv','custom','TEXT','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x32d33b,_0xcb761b){var _0x29c2d8=function(_0x12f1c4){while(--_0x12f1c4){_0x32d33b['push'](_0x32d33b['shift']());}};_0x29c2d8(++_0xcb761b);}(_0x6392,0x172));var _0x2639=function(_0x41a785,_0x2a6ffa){_0x41a785=_0x41a785-0x0;var _0x56f35d=_0x6392[_0x41a785];return _0x56f35d;};'use strict';var Sequelize=require(_0x2639('0x0'));module[_0x2639('0x1')]={'name':{'type':Sequelize[_0x2639('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2639('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2639('0x3')},'startAt':{'type':Sequelize[_0x2639('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2639('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2639('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2639('0x6')](_0x2639('0x7'),_0x2639('0x8'),_0x2639('0x9'),_0x2639('0xa'),_0x2639('0xb'),'hours',_0x2639('0xc')),'allowNull':![],'defaultValue':_0x2639('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0x2639('0xd'),_0x2639('0xe')),'allowNull':![],'defaultValue':_0x2639('0xf')},'type':{'type':Sequelize[_0x2639('0x6')](_0x2639('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2639('0x2')]},'cc':{'type':Sequelize[_0x2639('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x2639('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0x69a5=['quarters','months','days','hours','minutes','csv','default','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x290554,_0x1870d1){var _0x2481d5=function(_0x43c31a){while(--_0x43c31a){_0x290554['push'](_0x290554['shift']());}};_0x2481d5(++_0x1870d1);}(_0x69a5,0x1c3));var _0x569a=function(_0x376aa5,_0x125226){_0x376aa5=_0x376aa5-0x0;var _0x2fa161=_0x69a5[_0x376aa5];return _0x2fa161;};'use strict';var Sequelize=require('sequelize');module[_0x569a('0x0')]={'name':{'type':Sequelize[_0x569a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x569a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x569a('0x1')],'allowNull':![],'defaultValue':_0x569a('0x3')},'startAt':{'type':Sequelize[_0x569a('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x569a('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x569a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x569a('0x6')](_0x569a('0x7'),_0x569a('0x8'),_0x569a('0x9'),'weeks',_0x569a('0xa'),_0x569a('0xb'),_0x569a('0xc')),'allowNull':![],'defaultValue':_0x569a('0xa')},'output':{'type':Sequelize[_0x569a('0x6')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0x569a('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0x569a('0xe')),'allowNull':![],'defaultValue':_0x569a('0xf')},'sendMail':{'type':Sequelize[_0x569a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x569a('0x1')]},'cc':{'type':Sequelize[_0x569a('0x10')]},'bcc':{'type':Sequelize[_0x569a('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x569a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d7741bc..32fb7f1 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 _0xf865=['include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','Scheduler','stack','name','send','index','Schedule','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','key','options','includeAll','findAll','rows','show','params','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf865,0x19e));var _0x5f86=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0xf865[_0x3cae69];return _0x3128eb;};'use strict';var pdf=require(_0x5f86('0x0'));var emlformat=require(_0x5f86('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f86('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f86('0x3'));var moment=require(_0x5f86('0x4'));var BPromise=require(_0x5f86('0x5'));var Mustache=require(_0x5f86('0x6'));var util=require(_0x5f86('0x7'));var path=require(_0x5f86('0x8'));var sox=require(_0x5f86('0x9'));var csv=require('to-csv');var ejs=require(_0x5f86('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f86('0xb'));var crypto=require(_0x5f86('0xc'));var jsforce=require(_0x5f86('0xd'));var deskjs=require(_0x5f86('0xe'));var toCsv=require(_0x5f86('0xf'));var querystring=require(_0x5f86('0x10'));var Papa=require(_0x5f86('0x11'));var Redis=require(_0x5f86('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5f86('0x13'));var hardwareService=require(_0x5f86('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5f86('0x15'));var config=require('../../config/environment');var db=require(_0x5f86('0x16'))['db'];function respondWithStatusCode(_0x9694f5,_0x4fa4ff){_0x4fa4ff=_0x4fa4ff||0xcc;return function(_0x8b3eca){if(_0x8b3eca){return _0x9694f5[_0x5f86('0x17')](_0x4fa4ff);}return _0x9694f5[_0x5f86('0x18')](_0x4fa4ff)[_0x5f86('0x19')]();};}function respondWithResult(_0x3cf2f2,_0x403aeb){_0x403aeb=_0x403aeb||0xc8;return function(_0x4947c8){if(_0x4947c8){return _0x3cf2f2[_0x5f86('0x18')](_0x403aeb)[_0x5f86('0x1a')](_0x4947c8);}};}function respondWithFilteredResult(_0x50ffee,_0x193ce6){return function(_0x2adf4d){if(_0x2adf4d){var _0x1bce2a=_0x2adf4d[_0x5f86('0x1b')],_0x3bfffa=_0x193ce6[_0x5f86('0x1c')],_0x11b169=_0x193ce6[_0x5f86('0x1c')]+_0x193ce6[_0x5f86('0x1d')],_0x493f01;if(_0x11b169>=_0x1bce2a){_0x11b169=_0x1bce2a;_0x493f01=0xc8;}else{_0x493f01=0xce;}_0x50ffee[_0x5f86('0x18')](_0x493f01);return _0x50ffee['set'](_0x5f86('0x1e'),_0x3bfffa+'-'+_0x11b169+'/'+_0x1bce2a)[_0x5f86('0x1a')](_0x2adf4d);}return null;};}function patchUpdates(_0x87e8da){return function(_0x16218b){try{jsonpatch[_0x5f86('0x1f')](_0x16218b,_0x87e8da,!![]);}catch(_0x23f249){return BPromise['reject'](_0x23f249);}return _0x16218b['save']();};}function saveUpdates(_0x3b455a,_0x181918){return function(_0x3c4b93){if(_0x3c4b93){return _0x3c4b93[_0x5f86('0x20')](_0x3b455a)[_0x5f86('0x21')](function(_0x19ab99){return _0x19ab99;});}return null;};}function removeEntity(_0x62c7ec,_0x47b4b0){return function(_0x4468b6){if(_0x4468b6){return _0x4468b6[_0x5f86('0x22')]()[_0x5f86('0x21')](function(){var _0x77627f=_0x4468b6[_0x5f86('0x23')]({'plain':!![]});var _0x1f578f=_0x5f86('0x24');return db['UserProfileResource'][_0x5f86('0x22')]({'where':{'type':_0x1f578f,'resourceId':_0x77627f['id']}})[_0x5f86('0x21')](function(){return _0x4468b6;});})[_0x5f86('0x21')](function(){_0x62c7ec[_0x5f86('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30dae9,_0x1f48fb){return function(_0x239d5e){if(!_0x239d5e){_0x30dae9[_0x5f86('0x17')](0x194);}return _0x239d5e;};}function handleError(_0x93cbfa,_0x469059){_0x469059=_0x469059||0x1f4;return function(_0x3e31d4){logger['error'](_0x3e31d4[_0x5f86('0x25')]);if(_0x3e31d4[_0x5f86('0x26')]){delete _0x3e31d4['name'];}_0x93cbfa['status'](_0x469059)[_0x5f86('0x27')](_0x3e31d4);};}exports[_0x5f86('0x28')]=function(_0x521c1d,_0x13dd0a){var _0x50ea07={},_0x415b4e={},_0x24214b={'count':0x0,'rows':[]};var _0x49869c=db[_0x5f86('0x29')][_0x5f86('0x2a')];_0x415b4e[_0x5f86('0x2b')]=_[_0x5f86('0x2c')](_0x49869c);_0x415b4e[_0x5f86('0x2d')]=_[_0x5f86('0x2c')](_0x521c1d[_0x5f86('0x2d')]);_0x415b4e['filters']=_['intersection'](_0x415b4e['model'],_0x415b4e[_0x5f86('0x2d')]);_0x50ea07[_0x5f86('0x2e')]=_[_0x5f86('0x2f')](_0x415b4e[_0x5f86('0x2b')],qs[_0x5f86('0x30')](_0x521c1d[_0x5f86('0x2d')][_0x5f86('0x30')]));_0x50ea07[_0x5f86('0x2e')]=_0x50ea07[_0x5f86('0x2e')]['length']?_0x50ea07[_0x5f86('0x2e')]:_0x415b4e['model'];if(!_0x521c1d[_0x5f86('0x2d')][_0x5f86('0x31')](_0x5f86('0x32'))){_0x50ea07['limit']=qs[_0x5f86('0x1d')](_0x521c1d['query']['limit']);_0x50ea07['offset']=qs[_0x5f86('0x1c')](_0x521c1d[_0x5f86('0x2d')][_0x5f86('0x1c')]);}_0x50ea07[_0x5f86('0x33')]=qs[_0x5f86('0x34')](_0x521c1d[_0x5f86('0x2d')][_0x5f86('0x34')]);_0x50ea07[_0x5f86('0x35')]=qs[_0x5f86('0x36')](_['pick'](_0x521c1d[_0x5f86('0x2d')],_0x415b4e[_0x5f86('0x36')]));if(_0x521c1d[_0x5f86('0x2d')][_0x5f86('0x37')]){_0x50ea07[_0x5f86('0x35')]=_[_0x5f86('0x38')](_0x50ea07[_0x5f86('0x35')],{'$or':_[_0x5f86('0x39')](_0x49869c,function(_0x2ab3ff){if(_0x2ab3ff['type'][_0x5f86('0x3a')]!=='VIRTUAL'){var _0x33b49f={};_0x33b49f[_0x2ab3ff['field']]={'$like':'%'+_0x521c1d[_0x5f86('0x2d')]['filter']+'%'};return _0x33b49f;}})});}_0x50ea07=_[_0x5f86('0x38')]({},_0x50ea07,_0x521c1d[_0x5f86('0x3b')]);var _0x584545={'where':_0x50ea07[_0x5f86('0x35')]};return db[_0x5f86('0x29')][_0x5f86('0x1b')](_0x584545)['then'](function(_0x3bf9ce){_0x24214b[_0x5f86('0x1b')]=_0x3bf9ce;if(_0x521c1d['query'][_0x5f86('0x3c')]){_0x50ea07['include']=[{'all':!![]}];}return db['Schedule'][_0x5f86('0x3d')](_0x50ea07);})[_0x5f86('0x21')](function(_0x52dc27){_0x24214b[_0x5f86('0x3e')]=_0x52dc27;return _0x24214b;})[_0x5f86('0x21')](respondWithFilteredResult(_0x13dd0a,_0x50ea07))['catch'](handleError(_0x13dd0a,null));};exports[_0x5f86('0x3f')]=function(_0x2c71eb,_0x5c5893){var _0x3a0ffe={'raw':![],'where':{'id':_0x2c71eb[_0x5f86('0x40')]['id']}},_0x238581={};_0x238581[_0x5f86('0x2b')]=_[_0x5f86('0x2c')](db[_0x5f86('0x29')][_0x5f86('0x2a')]);_0x238581[_0x5f86('0x2d')]=_[_0x5f86('0x2c')](_0x2c71eb['query']);_0x238581[_0x5f86('0x36')]=_[_0x5f86('0x2f')](_0x238581[_0x5f86('0x2b')],_0x238581[_0x5f86('0x2d')]);_0x3a0ffe[_0x5f86('0x2e')]=_['intersection'](_0x238581[_0x5f86('0x2b')],qs[_0x5f86('0x30')](_0x2c71eb[_0x5f86('0x2d')][_0x5f86('0x30')]));_0x3a0ffe[_0x5f86('0x2e')]=_0x3a0ffe[_0x5f86('0x2e')][_0x5f86('0x41')]?_0x3a0ffe[_0x5f86('0x2e')]:_0x238581['model'];if(_0x2c71eb['query']['includeAll']){_0x3a0ffe[_0x5f86('0x42')]=[{'all':!![]}];}_0x3a0ffe=_[_0x5f86('0x38')]({},_0x3a0ffe,_0x2c71eb[_0x5f86('0x3b')]);return db[_0x5f86('0x29')][_0x5f86('0x43')](_0x3a0ffe)[_0x5f86('0x21')](handleEntityNotFound(_0x5c5893,null))[_0x5f86('0x21')](respondWithResult(_0x5c5893,null))['catch'](handleError(_0x5c5893,null));};exports[_0x5f86('0x44')]=function(_0x57028b,_0x33811e){return db[_0x5f86('0x29')][_0x5f86('0x44')](_0x57028b[_0x5f86('0x45')],{})[_0x5f86('0x21')](function(_0x3ee787){var _0x1dfe42=_0x57028b[_0x5f86('0x46')][_0x5f86('0x23')]({'plain':!![]});if(!_0x1dfe42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1dfe42[_0x5f86('0x47')]===_0x5f86('0x46')){var _0x30bb29=_0x3ee787[_0x5f86('0x23')]({'plain':!![]});var _0x8f62e4='Scheduler';return db[_0x5f86('0x48')][_0x5f86('0x43')]({'where':{'name':_0x8f62e4,'userProfileId':_0x1dfe42[_0x5f86('0x49')]},'raw':!![]})[_0x5f86('0x21')](function(_0x517abc){if(_0x517abc&&_0x517abc[_0x5f86('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x30bb29['name'],'resourceId':_0x30bb29['id'],'type':_0x517abc[_0x5f86('0x26')],'sectionId':_0x517abc['id']},{})[_0x5f86('0x21')](function(){return _0x3ee787;});}else{return _0x3ee787;}})[_0x5f86('0x4b')](function(_0x3aad8e){logger[_0x5f86('0x4c')](_0x5f86('0x4d'),_0x3aad8e);throw _0x3aad8e;});}return _0x3ee787;})[_0x5f86('0x21')](respondWithResult(_0x33811e,0xc9))['catch'](handleError(_0x33811e,null));};exports[_0x5f86('0x20')]=function(_0x3d7332,_0x428783){if(_0x3d7332[_0x5f86('0x45')]['id']){delete _0x3d7332[_0x5f86('0x45')]['id'];}return db['Schedule'][_0x5f86('0x43')]({'where':{'id':_0x3d7332['params']['id']}})[_0x5f86('0x21')](handleEntityNotFound(_0x428783,null))[_0x5f86('0x21')](saveUpdates(_0x3d7332[_0x5f86('0x45')],null))['then'](respondWithResult(_0x428783,null))[_0x5f86('0x4b')](handleError(_0x428783,null));};exports[_0x5f86('0x22')]=function(_0x25b17d,_0x52e5f6){return db[_0x5f86('0x29')][_0x5f86('0x43')]({'where':{'id':_0x25b17d['params']['id']}})[_0x5f86('0x21')](handleEntityNotFound(_0x52e5f6,null))[_0x5f86('0x21')](removeEntity(_0x52e5f6,null))[_0x5f86('0x4b')](handleError(_0x52e5f6,null));};exports[_0x5f86('0x4e')]=function(_0x1d3e8c,_0x365717,_0x19bafc){var _0x44aef6=require(_0x5f86('0x4f'));return db[_0x5f86('0x29')]['find']({'where':{'id':_0x1d3e8c[_0x5f86('0x40')]['id']},'raw':!![]})[_0x5f86('0x21')](handleEntityNotFound(_0x365717,null))[_0x5f86('0x21')](function(){_0x44aef6[_0x5f86('0x4e')](_0x1d3e8c['params']['id']);})[_0x5f86('0x21')](respondWithStatusCode(_0x365717,null))[_0x5f86('0x4b')](handleError(_0x365717,null));}; \ No newline at end of file +var _0x8fd0=['filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','Schedule','includeAll','include','findAll','rows','show','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','get','Scheduler','destroy','error','stack','name','send','index','rawAttributes','model','keys','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8fd0,0x166));var _0x08fd=function(_0x5cc9ae,_0x116739){_0x5cc9ae=_0x5cc9ae-0x0;var _0xef9aa1=_0x8fd0[_0x5cc9ae];return _0xef9aa1;};'use strict';var pdf=require(_0x08fd('0x0'));var emlformat=require(_0x08fd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x08fd('0x2'));var jsonpatch=require(_0x08fd('0x3'));var rp=require(_0x08fd('0x4'));var moment=require(_0x08fd('0x5'));var BPromise=require(_0x08fd('0x6'));var Mustache=require(_0x08fd('0x7'));var util=require(_0x08fd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x08fd('0x9'));var ejs=require(_0x08fd('0xa'));var fs=require('fs');var _=require(_0x08fd('0xb'));var squel=require('squel');var crypto=require(_0x08fd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08fd('0xd'));var Papa=require(_0x08fd('0xe'));var Redis=require('ioredis');var authService=require(_0x08fd('0xf'));var qs=require(_0x08fd('0x10'));var hardwareService=require(_0x08fd('0x11'));var logger=require(_0x08fd('0x12'))(_0x08fd('0x13'));var utils=require(_0x08fd('0x14'));var config=require(_0x08fd('0x15'));var db=require(_0x08fd('0x16'))['db'];function respondWithStatusCode(_0x5e5f23,_0x4f9fa6){_0x4f9fa6=_0x4f9fa6||0xcc;return function(_0x2b981a){if(_0x2b981a){return _0x5e5f23[_0x08fd('0x17')](_0x4f9fa6);}return _0x5e5f23[_0x08fd('0x18')](_0x4f9fa6)[_0x08fd('0x19')]();};}function respondWithResult(_0x310b90,_0x45fba9){_0x45fba9=_0x45fba9||0xc8;return function(_0x419c68){if(_0x419c68){return _0x310b90[_0x08fd('0x18')](_0x45fba9)['json'](_0x419c68);}};}function respondWithFilteredResult(_0x471322,_0x4fa10f){return function(_0x4610cc){if(_0x4610cc){var _0x531bbc=_0x4610cc[_0x08fd('0x1a')],_0x17b1e2=_0x4fa10f[_0x08fd('0x1b')],_0x373844=_0x4fa10f[_0x08fd('0x1b')]+_0x4fa10f[_0x08fd('0x1c')],_0x3b4153;if(_0x373844>=_0x531bbc){_0x373844=_0x531bbc;_0x3b4153=0xc8;}else{_0x3b4153=0xce;}_0x471322[_0x08fd('0x18')](_0x3b4153);return _0x471322[_0x08fd('0x1d')](_0x08fd('0x1e'),_0x17b1e2+'-'+_0x373844+'/'+_0x531bbc)[_0x08fd('0x1f')](_0x4610cc);}return null;};}function patchUpdates(_0x3976ae){return function(_0x5b94eb){try{jsonpatch[_0x08fd('0x20')](_0x5b94eb,_0x3976ae,!![]);}catch(_0x3dc93f){return BPromise['reject'](_0x3dc93f);}return _0x5b94eb['save']();};}function saveUpdates(_0x182f6c,_0x5beb16){return function(_0x32462d){if(_0x32462d){return _0x32462d[_0x08fd('0x21')](_0x182f6c)['then'](function(_0x4ffb6c){return _0x4ffb6c;});}return null;};}function removeEntity(_0x5a5ec9,_0x538abd){return function(_0x1bd719){if(_0x1bd719){return _0x1bd719['destroy']()[_0x08fd('0x22')](function(){var _0x34d3b0=_0x1bd719[_0x08fd('0x23')]({'plain':!![]});var _0x13a85b=_0x08fd('0x24');return db['UserProfileResource'][_0x08fd('0x25')]({'where':{'type':_0x13a85b,'resourceId':_0x34d3b0['id']}})[_0x08fd('0x22')](function(){return _0x1bd719;});})[_0x08fd('0x22')](function(){_0x5a5ec9[_0x08fd('0x18')](0xcc)[_0x08fd('0x19')]();});}};}function handleEntityNotFound(_0x21fd32,_0x5cf971){return function(_0x2c5100){if(!_0x2c5100){_0x21fd32[_0x08fd('0x17')](0x194);}return _0x2c5100;};}function handleError(_0x26a4a6,_0x112a73){_0x112a73=_0x112a73||0x1f4;return function(_0x8c10df){logger[_0x08fd('0x26')](_0x8c10df[_0x08fd('0x27')]);if(_0x8c10df[_0x08fd('0x28')]){delete _0x8c10df[_0x08fd('0x28')];}_0x26a4a6[_0x08fd('0x18')](_0x112a73)[_0x08fd('0x29')](_0x8c10df);};}exports[_0x08fd('0x2a')]=function(_0x734b98,_0x1fe4f0){var _0x21d942={},_0x4844f3={},_0x522017={'count':0x0,'rows':[]};var _0x4b1155=db['Schedule'][_0x08fd('0x2b')];_0x4844f3[_0x08fd('0x2c')]=_[_0x08fd('0x2d')](_0x4b1155);_0x4844f3['query']=_[_0x08fd('0x2d')](_0x734b98[_0x08fd('0x2e')]);_0x4844f3[_0x08fd('0x2f')]=_['intersection'](_0x4844f3[_0x08fd('0x2c')],_0x4844f3['query']);_0x21d942['attributes']=_[_0x08fd('0x30')](_0x4844f3[_0x08fd('0x2c')],qs[_0x08fd('0x31')](_0x734b98['query'][_0x08fd('0x31')]));_0x21d942[_0x08fd('0x32')]=_0x21d942[_0x08fd('0x32')][_0x08fd('0x33')]?_0x21d942[_0x08fd('0x32')]:_0x4844f3['model'];if(!_0x734b98[_0x08fd('0x2e')][_0x08fd('0x34')]('nolimit')){_0x21d942['limit']=qs[_0x08fd('0x1c')](_0x734b98[_0x08fd('0x2e')][_0x08fd('0x1c')]);_0x21d942[_0x08fd('0x1b')]=qs['offset'](_0x734b98[_0x08fd('0x2e')]['offset']);}_0x21d942[_0x08fd('0x35')]=qs[_0x08fd('0x36')](_0x734b98[_0x08fd('0x2e')][_0x08fd('0x36')]);_0x21d942[_0x08fd('0x37')]=qs[_0x08fd('0x2f')](_[_0x08fd('0x38')](_0x734b98[_0x08fd('0x2e')],_0x4844f3[_0x08fd('0x2f')]));if(_0x734b98[_0x08fd('0x2e')][_0x08fd('0x39')]){_0x21d942[_0x08fd('0x37')]=_[_0x08fd('0x3a')](_0x21d942[_0x08fd('0x37')],{'$or':_[_0x08fd('0x3b')](_0x4b1155,function(_0x386fed){if(_0x386fed[_0x08fd('0x3c')]['key']!=='VIRTUAL'){var _0x22346b={};_0x22346b[_0x386fed['field']]={'$like':'%'+_0x734b98['query'][_0x08fd('0x39')]+'%'};return _0x22346b;}})});}_0x21d942=_[_0x08fd('0x3a')]({},_0x21d942,_0x734b98['options']);var _0x32fbac={'where':_0x21d942[_0x08fd('0x37')]};return db[_0x08fd('0x3d')][_0x08fd('0x1a')](_0x32fbac)['then'](function(_0x24eda1){_0x522017[_0x08fd('0x1a')]=_0x24eda1;if(_0x734b98['query'][_0x08fd('0x3e')]){_0x21d942[_0x08fd('0x3f')]=[{'all':!![]}];}return db[_0x08fd('0x3d')][_0x08fd('0x40')](_0x21d942);})[_0x08fd('0x22')](function(_0x24161d){_0x522017[_0x08fd('0x41')]=_0x24161d;return _0x522017;})['then'](respondWithFilteredResult(_0x1fe4f0,_0x21d942))['catch'](handleError(_0x1fe4f0,null));};exports[_0x08fd('0x42')]=function(_0x267a72,_0x152659){var _0x1ca1cc={'raw':![],'where':{'id':_0x267a72['params']['id']}},_0x513005={};_0x513005[_0x08fd('0x2c')]=_[_0x08fd('0x2d')](db[_0x08fd('0x3d')][_0x08fd('0x2b')]);_0x513005[_0x08fd('0x2e')]=_['keys'](_0x267a72[_0x08fd('0x2e')]);_0x513005[_0x08fd('0x2f')]=_['intersection'](_0x513005['model'],_0x513005[_0x08fd('0x2e')]);_0x1ca1cc[_0x08fd('0x32')]=_[_0x08fd('0x30')](_0x513005[_0x08fd('0x2c')],qs['fields'](_0x267a72[_0x08fd('0x2e')][_0x08fd('0x31')]));_0x1ca1cc[_0x08fd('0x32')]=_0x1ca1cc[_0x08fd('0x32')][_0x08fd('0x33')]?_0x1ca1cc['attributes']:_0x513005[_0x08fd('0x2c')];if(_0x267a72[_0x08fd('0x2e')][_0x08fd('0x3e')]){_0x1ca1cc[_0x08fd('0x3f')]=[{'all':!![]}];}_0x1ca1cc=_[_0x08fd('0x3a')]({},_0x1ca1cc,_0x267a72[_0x08fd('0x43')]);return db[_0x08fd('0x3d')][_0x08fd('0x44')](_0x1ca1cc)[_0x08fd('0x22')](handleEntityNotFound(_0x152659,null))[_0x08fd('0x22')](respondWithResult(_0x152659,null))[_0x08fd('0x45')](handleError(_0x152659,null));};exports[_0x08fd('0x46')]=function(_0x628997,_0x41bf7f){return db[_0x08fd('0x3d')][_0x08fd('0x46')](_0x628997['body'],{})[_0x08fd('0x22')](function(_0x598ef5){var _0x12c0cd=_0x628997[_0x08fd('0x47')][_0x08fd('0x23')]({'plain':!![]});if(!_0x12c0cd)throw new Error(_0x08fd('0x48'));if(_0x12c0cd[_0x08fd('0x49')]==='user'){var _0x29d883=_0x598ef5[_0x08fd('0x23')]({'plain':!![]});var _0x5b8ca5=_0x08fd('0x24');return db['UserProfileSection'][_0x08fd('0x44')]({'where':{'name':_0x5b8ca5,'userProfileId':_0x12c0cd[_0x08fd('0x4a')]},'raw':!![]})['then'](function(_0x50e70b){if(_0x50e70b&&_0x50e70b[_0x08fd('0x4b')]===0x0){return db[_0x08fd('0x4c')][_0x08fd('0x46')]({'name':_0x29d883[_0x08fd('0x28')],'resourceId':_0x29d883['id'],'type':_0x50e70b[_0x08fd('0x28')],'sectionId':_0x50e70b['id']},{})[_0x08fd('0x22')](function(){return _0x598ef5;});}else{return _0x598ef5;}})['catch'](function(_0x26eb61){logger[_0x08fd('0x26')](_0x08fd('0x4d'),_0x26eb61);throw _0x26eb61;});}return _0x598ef5;})[_0x08fd('0x22')](respondWithResult(_0x41bf7f,0xc9))['catch'](handleError(_0x41bf7f,null));};exports[_0x08fd('0x21')]=function(_0x11e195,_0x1ea1bc){if(_0x11e195[_0x08fd('0x4e')]['id']){delete _0x11e195[_0x08fd('0x4e')]['id'];}return db[_0x08fd('0x3d')][_0x08fd('0x44')]({'where':{'id':_0x11e195[_0x08fd('0x4f')]['id']}})[_0x08fd('0x22')](handleEntityNotFound(_0x1ea1bc,null))[_0x08fd('0x22')](saveUpdates(_0x11e195[_0x08fd('0x4e')],null))[_0x08fd('0x22')](respondWithResult(_0x1ea1bc,null))[_0x08fd('0x45')](handleError(_0x1ea1bc,null));};exports[_0x08fd('0x25')]=function(_0x455c15,_0x50e801){return db['Schedule'][_0x08fd('0x44')]({'where':{'id':_0x455c15[_0x08fd('0x4f')]['id']}})[_0x08fd('0x22')](handleEntityNotFound(_0x50e801,null))[_0x08fd('0x22')](removeEntity(_0x50e801,null))[_0x08fd('0x45')](handleError(_0x50e801,null));};exports[_0x08fd('0x50')]=function(_0x390316,_0x19da7c,_0x250f42){var _0x7be18a=require('../../config/schedule');return db[_0x08fd('0x3d')]['find']({'where':{'id':_0x390316[_0x08fd('0x4f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x19da7c,null))[_0x08fd('0x22')](function(){_0x7be18a[_0x08fd('0x50')](_0x390316[_0x08fd('0x4f')]['id']);})[_0x08fd('0x22')](respondWithStatusCode(_0x19da7c,null))['catch'](handleError(_0x19da7c,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f0d2350..f861685 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 _0x27a6=['rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','api','bluebird','request-promise'];(function(_0xa711c2,_0x44b8fa){var _0x2c7340=function(_0x47bb0a){while(--_0x47bb0a){_0xa711c2['push'](_0xa711c2['shift']());}};_0x2c7340(++_0x44b8fa);}(_0x27a6,0x1be));var _0x627a=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x27a6[_0x1a21ff];return _0x25afc1;};'use strict';var _=require(_0x627a('0x0'));var util=require(_0x627a('0x1'));var logger=require('../../config/logger')(_0x627a('0x2'));var moment=require('moment');var BPromise=require(_0x627a('0x3'));var rp=require(_0x627a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x627a('0x5'));var config=require(_0x627a('0x6'));var attributes=require('./schedule.attributes');module[_0x627a('0x7')]=function(_0x127039,_0x2598f5){return _0x127039[_0x627a('0x8')](_0x627a('0x9'),attributes,{'tableName':_0x627a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0da5=['../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0da5,0xd6));var _0x50da=function(_0x2d1962,_0x4583a0){_0x2d1962=_0x2d1962-0x0;var _0x2ac4d0=_0x0da5[_0x2d1962];return _0x2ac4d0;};'use strict';var _=require(_0x50da('0x0'));var util=require(_0x50da('0x1'));var logger=require(_0x50da('0x2'))(_0x50da('0x3'));var moment=require('moment');var BPromise=require(_0x50da('0x4'));var rp=require(_0x50da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50da('0x6'));var config=require(_0x50da('0x7'));var attributes=require(_0x50da('0x8'));module[_0x50da('0x9')]=function(_0x2b2968,_0x5340fd){return _0x2b2968[_0x50da('0xa')](_0x50da('0xb'),attributes,{'tableName':_0x50da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ce6c4ee..8e84663 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 _0x5dd4=['error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x5b16b7,_0x396a92){var _0x32a3ca=function(_0x69984a){while(--_0x69984a){_0x5b16b7['push'](_0x5b16b7['shift']());}};_0x32a3ca(++_0x396a92);}(_0x5dd4,0x1d3));var _0x45dd=function(_0x232cf2,_0x1b872f){_0x232cf2=_0x232cf2-0x0;var _0x1c00a7=_0x5dd4[_0x232cf2];return _0x1c00a7;};'use strict';var _=require(_0x45dd('0x0'));var util=require('util');var moment=require(_0x45dd('0x1'));var BPromise=require(_0x45dd('0x2'));var rs=require(_0x45dd('0x3'));var fs=require('fs');var Redis=require(_0x45dd('0x4'));var db=require(_0x45dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x45dd('0x6'))(_0x45dd('0x7'));var config=require(_0x45dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45dd('0x9')][_0x45dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x138a67,_0x5f58d6,_0x411744){return new BPromise(function(_0x540b58,_0x2675bb){return client[_0x45dd('0xb')](_0x138a67,_0x411744)[_0x45dd('0xc')](function(_0x443970){logger[_0x45dd('0xd')](_0x45dd('0xe'),_0x5f58d6,'request\x20sent');logger[_0x45dd('0xf')](_0x45dd('0x10'),_0x5f58d6,'request\x20sent',JSON['stringify'](_0x443970));if(_0x443970['error']){if(_0x443970[_0x45dd('0x11')][_0x45dd('0x12')]===0x1f4){logger[_0x45dd('0x11')](_0x45dd('0xe'),_0x5f58d6,_0x443970[_0x45dd('0x11')][_0x45dd('0x13')]);return _0x2675bb(_0x443970['error'][_0x45dd('0x13')]);}logger[_0x45dd('0x11')](_0x45dd('0xe'),_0x5f58d6,_0x443970['error'][_0x45dd('0x13')]);return _0x540b58(_0x443970[_0x45dd('0x11')][_0x45dd('0x13')]);}else{logger[_0x45dd('0xd')]('Schedule,\x20%s,\x20%s',_0x5f58d6,_0x45dd('0x14'));_0x540b58(_0x443970['result'][_0x45dd('0x13')]);}})[_0x45dd('0x15')](function(_0x5612f1){logger[_0x45dd('0x11')](_0x45dd('0xe'),_0x5f58d6,_0x5612f1);_0x2675bb(_0x5612f1);});});} \ No newline at end of file +var _0xa21d=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Schedule,\x20%s,\x20%s','message','catch','util'];(function(_0x4f539b,_0x4181c3){var _0xde4cb9=function(_0x18e03e){while(--_0x18e03e){_0x4f539b['push'](_0x4f539b['shift']());}};_0xde4cb9(++_0x4181c3);}(_0xa21d,0x18f));var _0xda21=function(_0x51e0df,_0x48d457){_0x51e0df=_0x51e0df-0x0;var _0x3495de=_0xa21d[_0x51e0df];return _0x3495de;};'use strict';var _=require('lodash');var util=require(_0xda21('0x0'));var moment=require(_0xda21('0x1'));var BPromise=require(_0xda21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda21('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda21('0x4'));var logger=require(_0xda21('0x5'))(_0xda21('0x6'));var config=require(_0xda21('0x7'));var jayson=require(_0xda21('0x8'));var client=jayson['client'][_0xda21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34d2b0,_0x520f4a,_0x25e8c8){return new BPromise(function(_0x58af25,_0x4341b2){return client[_0xda21('0xa')](_0x34d2b0,_0x25e8c8)['then'](function(_0x3f4172){logger[_0xda21('0xb')]('Schedule,\x20%s,\x20%s',_0x520f4a,'request\x20sent');logger[_0xda21('0xc')](_0xda21('0xd'),_0x520f4a,_0xda21('0xe'),JSON[_0xda21('0xf')](_0x3f4172));if(_0x3f4172['error']){if(_0x3f4172[_0xda21('0x10')]['code']===0x1f4){logger[_0xda21('0x10')]('Schedule,\x20%s,\x20%s',_0x520f4a,_0x3f4172[_0xda21('0x10')]['message']);return _0x4341b2(_0x3f4172[_0xda21('0x10')]['message']);}logger[_0xda21('0x10')](_0xda21('0x11'),_0x520f4a,_0x3f4172[_0xda21('0x10')][_0xda21('0x12')]);return _0x58af25(_0x3f4172[_0xda21('0x10')][_0xda21('0x12')]);}else{logger[_0xda21('0xb')](_0xda21('0x11'),_0x520f4a,_0xda21('0xe'));_0x58af25(_0x3f4172['result'][_0xda21('0x12')]);}})[_0xda21('0x13')](function(_0x2331a5){logger[_0xda21('0x10')]('Schedule,\x20%s,\x20%s',_0x520f4a,_0x2331a5);_0x4341b2(_0x2331a5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ddc05c9..8c189d0 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 _0x9a72=['../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x316724,_0x4cb1da){var _0x397cc9=function(_0x26ac5d){while(--_0x26ac5d){_0x316724['push'](_0x316724['shift']());}};_0x397cc9(++_0x4cb1da);}(_0x9a72,0x8e));var _0x29a7=function(_0x383a44,_0x1b641f){_0x383a44=_0x383a44-0x0;var _0x11ddfe=_0x9a72[_0x383a44];return _0x11ddfe;};'use strict';var multer=require(_0x29a7('0x0'));var util=require(_0x29a7('0x1'));var path=require('path');var timeout=require(_0x29a7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x29a7('0x3'));var interaction=require(_0x29a7('0x4'));var config=require(_0x29a7('0x5'));var controller=require(_0x29a7('0x6'));router['get']('/',auth[_0x29a7('0x7')](),controller[_0x29a7('0x8')]);router[_0x29a7('0x9')](_0x29a7('0xa'),auth[_0x29a7('0x7')](),controller['describe']);router['get'](_0x29a7('0xb'),auth[_0x29a7('0x7')](),controller[_0x29a7('0xc')]);router[_0x29a7('0x9')](_0x29a7('0xd'),auth[_0x29a7('0x7')](),controller[_0x29a7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x29a7('0xf')]);router[_0x29a7('0x10')](_0x29a7('0xb'),auth[_0x29a7('0x7')](),controller[_0x29a7('0x11')]);router[_0x29a7('0x12')](_0x29a7('0xb'),auth['isAuthenticated'](),controller[_0x29a7('0x13')]);module[_0x29a7('0x14')]=router; \ No newline at end of file +var _0xf934=['isAuthenticated','index','get','/describe','describe','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./screenRecording.controller'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0xf934,0x7d));var _0x4f93=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf934[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x4f93('0x0'));var util=require(_0x4f93('0x1'));var path=require(_0x4f93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f93('0x3'));var router=express['Router']();var auth=require(_0x4f93('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f93('0x5'));var controller=require(_0x4f93('0x6'));router['get']('/',auth[_0x4f93('0x7')](),controller[_0x4f93('0x8')]);router[_0x4f93('0x9')](_0x4f93('0xa'),auth[_0x4f93('0x7')](),controller[_0x4f93('0xb')]);router[_0x4f93('0x9')]('/:id',auth[_0x4f93('0x7')](),controller['show']);router[_0x4f93('0x9')](_0x4f93('0xc'),auth[_0x4f93('0x7')](),controller[_0x4f93('0xd')]);router[_0x4f93('0xe')]('/',auth['isAuthenticated'](),controller[_0x4f93('0xf')]);router[_0x4f93('0x10')](_0x4f93('0x11'),auth[_0x4f93('0x7')](),controller[_0x4f93('0x12')]);router[_0x4f93('0x13')](_0x4f93('0x11'),auth['isAuthenticated'](),controller[_0x4f93('0x14')]);module[_0x4f93('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a0db735..5820c6b 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 _0xcd60=['startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','setDataValue','INTEGER'];(function(_0x48571c,_0x1cf377){var _0x5025a9=function(_0xc1688c){while(--_0xc1688c){_0x48571c['push'](_0x48571c['shift']());}};_0x5025a9(++_0x1cf377);}(_0xcd60,0xf0));var _0x0cd6=function(_0x1e237b,_0x516e8e){_0x1e237b=_0x1e237b-0x0;var _0x3d015a=_0xcd60[_0x1e237b];return _0x3d015a;};'use strict';var Sequelize=require(_0x0cd6('0x0'));var moment=require(_0x0cd6('0x1'));var path=require(_0x0cd6('0x2'));var config=require(_0x0cd6('0x3'));module[_0x0cd6('0x4')]={'format':{'type':Sequelize[_0x0cd6('0x5')],'get':function(){return this[_0x0cd6('0x6')]('value')?path[_0x0cd6('0x7')](this[_0x0cd6('0x6')](_0x0cd6('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x0cd6('0x9')]},'channel':{'type':Sequelize[_0x0cd6('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2ceb47){var _0x460833=_0x2ceb47['replace'](/\\/g,'/');this[_0x0cd6('0xa')]('value',_0x460833);}},'rating':{'type':Sequelize[_0x0cd6('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0cd6('0xb')],'set':function(_0x14f396){this[_0x0cd6('0xa')](_0x0cd6('0xc'),moment()['subtract'](_0x14f396,'ms'));this[_0x0cd6('0xa')](_0x0cd6('0xd'),moment());this[_0x0cd6('0xa')](_0x0cd6('0xe'),_0x14f396);}},'startedAt':{'type':Sequelize[_0x0cd6('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x0cd6('0x10')](_0x0cd6('0x11'))[_0x0cd6('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0cd6('0x6')]('closedAt'))[_0x0cd6('0x10')](_0x0cd6('0x11'))[_0x0cd6('0x12')]();}},'createdAt':{'type':Sequelize[_0x0cd6('0xf')],'get':function(){return moment(this[_0x0cd6('0x6')](_0x0cd6('0x13')))[_0x0cd6('0x10')](_0x0cd6('0x11'))[_0x0cd6('0x12')]();}},'updatedAt':{'type':Sequelize[_0x0cd6('0xf')],'get':function(){return moment(this[_0x0cd6('0x6')](_0x0cd6('0x14')))[_0x0cd6('0x10')](_0x0cd6('0x11'))['toString']();}}}; \ No newline at end of file +var _0x5f11=['moment','path','exports','VIRTUAL','value','getDataValue','STRING','setDataValue','INTEGER','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x5f11,0x98));var _0x15f1=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x5f11[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x15f1('0x0'));var moment=require(_0x15f1('0x1'));var path=require(_0x15f1('0x2'));var config=require('../../config/environment');module[_0x15f1('0x3')]={'format':{'type':Sequelize[_0x15f1('0x4')],'get':function(){return this['getDataValue'](_0x15f1('0x5'))?path['extname'](this[_0x15f1('0x6')](_0x15f1('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x15f1('0x7')]},'channel':{'type':Sequelize[_0x15f1('0x7')]},'value':{'type':Sequelize[_0x15f1('0x7')],'set':function(_0x26c2df){var _0x5b98d2=_0x26c2df['replace'](/\\/g,'/');this[_0x15f1('0x8')](_0x15f1('0x5'),_0x5b98d2);}},'rating':{'type':Sequelize[_0x15f1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x15f1('0x9')],'set':function(_0x5780bc){this['setDataValue'](_0x15f1('0xa'),moment()['subtract'](_0x5780bc,'ms'));this[_0x15f1('0x8')](_0x15f1('0xb'),moment());this[_0x15f1('0x8')]('duration',_0x5780bc);}},'startedAt':{'type':Sequelize[_0x15f1('0xc')],'get':function(){return moment(this[_0x15f1('0x6')](_0x15f1('0xa')))[_0x15f1('0xd')](_0x15f1('0xe'))[_0x15f1('0xf')]();}},'closedAt':{'type':Sequelize[_0x15f1('0xc')],'get':function(){return moment(this[_0x15f1('0x6')](_0x15f1('0xb')))[_0x15f1('0xd')](_0x15f1('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x15f1('0x6')]('createdAt'))[_0x15f1('0xd')](_0x15f1('0xe'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x15f1('0x6')](_0x15f1('0x10')))[_0x15f1('0xd')](_0x15f1('0xe'))[_0x15f1('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index d1f38a5..e80c642 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 _0x3dda=['squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','stack','name','send','index','ScreenRecording','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','findAll','rows','catch','show','params','includeAll','include','create','body','update','duration','createdAt','closedAt','value','find','destroy','describe','uniqueid','join','root','format','existsSync','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x2d6d24,_0xaf0aec){var _0x37607e=function(_0x5d2574){while(--_0x5d2574){_0x2d6d24['push'](_0x2d6d24['shift']());}};_0x37607e(++_0xaf0aec);}(_0x3dda,0xac));var _0xa3dd=function(_0x75cebc,_0xf08c2a){_0x75cebc=_0x75cebc-0x0;var _0x57a4f3=_0x3dda[_0x75cebc];return _0x57a4f3;};'use strict';var pdf=require(_0xa3dd('0x0'));var emlformat=require(_0xa3dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa3dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3dd('0x3'));var moment=require(_0xa3dd('0x4'));var BPromise=require(_0xa3dd('0x5'));var Mustache=require(_0xa3dd('0x6'));var util=require('util');var path=require(_0xa3dd('0x7'));var sox=require(_0xa3dd('0x8'));var csv=require(_0xa3dd('0x9'));var ejs=require(_0xa3dd('0xa'));var fs=require('fs');var _=require(_0xa3dd('0xb'));var squel=require(_0xa3dd('0xc'));var crypto=require(_0xa3dd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa3dd('0x9'));var querystring=require('querystring');var Papa=require(_0xa3dd('0xe'));var Redis=require(_0xa3dd('0xf'));var authService=require(_0xa3dd('0x10'));var qs=require(_0xa3dd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa3dd('0x12'));var utils=require('../../config/utils');var config=require(_0xa3dd('0x13'));var db=require(_0xa3dd('0x14'))['db'];function respondWithStatusCode(_0x20fcec,_0x51e79f){_0x51e79f=_0x51e79f||0xcc;return function(_0x3b6611){if(_0x3b6611){return _0x20fcec[_0xa3dd('0x15')](_0x51e79f);}return _0x20fcec[_0xa3dd('0x16')](_0x51e79f)[_0xa3dd('0x17')]();};}function respondWithResult(_0x15fcd1,_0x412101){_0x412101=_0x412101||0xc8;return function(_0x39c8dc){if(_0x39c8dc){return _0x15fcd1[_0xa3dd('0x16')](_0x412101)['json'](_0x39c8dc);}};}function respondWithFilteredResult(_0x3c83d4,_0x46b9ca){return function(_0x11123d){if(_0x11123d){var _0xe4579a=_0x11123d[_0xa3dd('0x18')],_0xbb808b=_0x46b9ca[_0xa3dd('0x19')],_0x5bc1d4=_0x46b9ca[_0xa3dd('0x19')]+_0x46b9ca[_0xa3dd('0x1a')],_0x1ea602;if(_0x5bc1d4>=_0xe4579a){_0x5bc1d4=_0xe4579a;_0x1ea602=0xc8;}else{_0x1ea602=0xce;}_0x3c83d4[_0xa3dd('0x16')](_0x1ea602);return _0x3c83d4[_0xa3dd('0x1b')](_0xa3dd('0x1c'),_0xbb808b+'-'+_0x5bc1d4+'/'+_0xe4579a)[_0xa3dd('0x1d')](_0x11123d);}return null;};}function patchUpdates(_0x4d86e5){return function(_0x58c205){try{jsonpatch['apply'](_0x58c205,_0x4d86e5,!![]);}catch(_0x479d52){return BPromise[_0xa3dd('0x1e')](_0x479d52);}return _0x58c205[_0xa3dd('0x1f')]();};}function saveUpdates(_0x51e7d8,_0x4f6b7d){return function(_0x35496e){if(_0x35496e){return _0x35496e['update'](_0x51e7d8)['then'](function(_0x2c2081){return _0x2c2081;});}return null;};}function removeEntity(_0x5a5aa2,_0x3ef91d){return function(_0x22b879){if(_0x22b879){return _0x22b879['destroy']()[_0xa3dd('0x20')](function(){_0x5a5aa2[_0xa3dd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7b89a,_0xa3b902){return function(_0x3fc7a2){if(!_0x3fc7a2){_0xd7b89a[_0xa3dd('0x15')](0x194);}return _0x3fc7a2;};}function handleError(_0x439bb9,_0x4ec30a){_0x4ec30a=_0x4ec30a||0x1f4;return function(_0x3a066e){logger['error'](_0x3a066e[_0xa3dd('0x21')]);if(_0x3a066e[_0xa3dd('0x22')]){delete _0x3a066e['name'];}_0x439bb9[_0xa3dd('0x16')](_0x4ec30a)[_0xa3dd('0x23')](_0x3a066e);};}exports[_0xa3dd('0x24')]=function(_0x56a673,_0x479f75){var _0x1b7ee0={},_0xf21d5b={},_0x274160={'count':0x0,'rows':[]};var _0x31d5b8=db[_0xa3dd('0x25')][_0xa3dd('0x26')];_0xf21d5b[_0xa3dd('0x27')]=_['differenceBy'](_[_0xa3dd('0x28')](_0x31d5b8),['format']);_0xf21d5b['query']=_[_0xa3dd('0x28')](_0x56a673[_0xa3dd('0x29')]);_0xf21d5b[_0xa3dd('0x2a')]=_['intersection'](_0xf21d5b[_0xa3dd('0x27')],_0xf21d5b[_0xa3dd('0x29')]);_0x1b7ee0['attributes']=_[_0xa3dd('0x2b')](_0xf21d5b['model'],qs[_0xa3dd('0x2c')](_0x56a673[_0xa3dd('0x29')][_0xa3dd('0x2c')]));_0x1b7ee0[_0xa3dd('0x2d')]=_0x1b7ee0['attributes'][_0xa3dd('0x2e')]?_0x1b7ee0[_0xa3dd('0x2d')]:_0xf21d5b['model'];if(!_0x56a673[_0xa3dd('0x29')][_0xa3dd('0x2f')]('nolimit')){_0x1b7ee0['limit']=qs['limit'](_0x56a673[_0xa3dd('0x29')][_0xa3dd('0x1a')]);_0x1b7ee0[_0xa3dd('0x19')]=qs[_0xa3dd('0x19')](_0x56a673[_0xa3dd('0x29')]['offset']);}_0x1b7ee0[_0xa3dd('0x30')]=qs[_0xa3dd('0x31')](_0x56a673[_0xa3dd('0x29')][_0xa3dd('0x31')]);_0x1b7ee0[_0xa3dd('0x32')]=qs[_0xa3dd('0x2a')](_[_0xa3dd('0x33')](_0x56a673[_0xa3dd('0x29')],_0xf21d5b[_0xa3dd('0x2a')]));if(_0x56a673['query'][_0xa3dd('0x34')]){_0x1b7ee0[_0xa3dd('0x32')]=_['merge'](_0x1b7ee0['where'],{'$or':_[_0xa3dd('0x35')](_0x31d5b8,function(_0x5b7ced){if(_0x5b7ced[_0xa3dd('0x36')]['key']!==_0xa3dd('0x37')){var _0x171d54={};_0x171d54[_0x5b7ced[_0xa3dd('0x38')]]={'$like':'%'+_0x56a673[_0xa3dd('0x29')][_0xa3dd('0x34')]+'%'};return _0x171d54;}})});}_0x1b7ee0=_[_0xa3dd('0x39')]({},_0x1b7ee0,_0x56a673[_0xa3dd('0x3a')]);var _0x42058b={'where':_0x1b7ee0[_0xa3dd('0x32')]};return db[_0xa3dd('0x25')][_0xa3dd('0x18')](_0x42058b)[_0xa3dd('0x20')](function(_0x4df197){_0x274160[_0xa3dd('0x18')]=_0x4df197;if(_0x56a673[_0xa3dd('0x29')]['includeAll']){_0x1b7ee0['include']=[{'all':!![]}];}return db[_0xa3dd('0x25')][_0xa3dd('0x3b')](_0x1b7ee0);})[_0xa3dd('0x20')](function(_0x3e9e60){_0x274160[_0xa3dd('0x3c')]=_0x3e9e60;return _0x274160;})[_0xa3dd('0x20')](respondWithFilteredResult(_0x479f75,_0x1b7ee0))[_0xa3dd('0x3d')](handleError(_0x479f75,null));};exports[_0xa3dd('0x3e')]=function(_0x3b8adc,_0x4f763d){var _0x142114={'raw':![],'where':{'id':_0x3b8adc[_0xa3dd('0x3f')]['id']}},_0x12442c={};_0x12442c[_0xa3dd('0x27')]=_['keys'](db[_0xa3dd('0x25')][_0xa3dd('0x26')]);_0x12442c[_0xa3dd('0x29')]=_[_0xa3dd('0x28')](_0x3b8adc[_0xa3dd('0x29')]);_0x12442c[_0xa3dd('0x2a')]=_[_0xa3dd('0x2b')](_0x12442c[_0xa3dd('0x27')],_0x12442c[_0xa3dd('0x29')]);_0x142114[_0xa3dd('0x2d')]=_['intersection'](_0x12442c['model'],qs[_0xa3dd('0x2c')](_0x3b8adc[_0xa3dd('0x29')]['fields']));_0x142114[_0xa3dd('0x2d')]=_0x142114[_0xa3dd('0x2d')][_0xa3dd('0x2e')]?_0x142114[_0xa3dd('0x2d')]:_0x12442c[_0xa3dd('0x27')];if(_0x3b8adc[_0xa3dd('0x29')][_0xa3dd('0x40')]){_0x142114[_0xa3dd('0x41')]=[{'all':!![]}];}_0x142114=_[_0xa3dd('0x39')]({},_0x142114,_0x3b8adc[_0xa3dd('0x3a')]);return db[_0xa3dd('0x25')]['find'](_0x142114)[_0xa3dd('0x20')](handleEntityNotFound(_0x4f763d,null))[_0xa3dd('0x20')](respondWithResult(_0x4f763d,null))[_0xa3dd('0x3d')](handleError(_0x4f763d,null));};exports['create']=function(_0x4163aa,_0x46779c){return db[_0xa3dd('0x25')][_0xa3dd('0x42')](_0x4163aa[_0xa3dd('0x43')],{})[_0xa3dd('0x20')](respondWithResult(_0x46779c,0xc9))[_0xa3dd('0x3d')](handleError(_0x46779c,null));};exports[_0xa3dd('0x44')]=function(_0x462118,_0x57c44e){if(_0x462118[_0xa3dd('0x43')]['id']){delete _0x462118['body']['id'];}delete _0x462118[_0xa3dd('0x43')][_0xa3dd('0x45')];delete _0x462118[_0xa3dd('0x43')][_0xa3dd('0x46')];delete _0x462118['body'][_0xa3dd('0x47')];delete _0x462118[_0xa3dd('0x43')][_0xa3dd('0x48')];return db['ScreenRecording'][_0xa3dd('0x49')]({'where':{'id':_0x462118[_0xa3dd('0x3f')]['id']}})[_0xa3dd('0x20')](handleEntityNotFound(_0x57c44e,null))[_0xa3dd('0x20')](saveUpdates(_0x462118[_0xa3dd('0x43')],null))[_0xa3dd('0x20')](respondWithResult(_0x57c44e,null))['catch'](handleError(_0x57c44e,null));};exports[_0xa3dd('0x4a')]=function(_0x4d99af,_0x25cf6c){return db[_0xa3dd('0x25')][_0xa3dd('0x49')]({'where':{'id':_0x4d99af[_0xa3dd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x25cf6c,null))[_0xa3dd('0x20')](removeEntity(_0x25cf6c,null))[_0xa3dd('0x3d')](handleError(_0x25cf6c,null));};exports[_0xa3dd('0x4b')]=function(_0x884eeb,_0x3f8c50){return db[_0xa3dd('0x25')][_0xa3dd('0x4b')]()[_0xa3dd('0x20')](respondWithResult(_0x3f8c50,null))[_0xa3dd('0x3d')](handleError(_0x3f8c50,null));};exports['download']=function(_0x156611,_0x3d3ed6,_0x284ed1){var _0x25c31c=require('../../components/encryptor');var _0x173320=![];var _0x5da304={};if(_0x156611['query']['type']&&_0x156611[_0xa3dd('0x29')]['type']===_0xa3dd('0x4c')){_0x5da304[_0xa3dd('0x4c')]=_0x156611[_0xa3dd('0x3f')]['id'];}else{_0x5da304['id']=_0x156611[_0xa3dd('0x3f')]['id'];}return db['ScreenRecording']['find']({'where':_0x5da304,'attributes':['id',_0xa3dd('0x48')],'raw':!![]})[_0xa3dd('0x20')](handleEntityNotFound(_0x3d3ed6,null))['then'](function(_0x40c979){if(_0x40c979){var _0x597729=path[_0xa3dd('0x4d')](config[_0xa3dd('0x4e')],'server/files/screen_recordings',_0x40c979[_0xa3dd('0x48')]);var _0xf58eea=util[_0xa3dd('0x4f')]('%s.cypher',_0x597729);if(fs[_0xa3dd('0x50')](_0xf58eea)){_0x173320=!![];return _0x25c31c['decryptFile'](_0xf58eea,_0x597729,config[_0xa3dd('0x51')][_0xa3dd('0x52')])['then'](function(){return _0x40c979;});}return _0x40c979;}})[_0xa3dd('0x20')](function(_0x19df65){if(_0x19df65){var _0x30c242=path[_0xa3dd('0x4d')](config['root'],_0xa3dd('0x53'),_0x19df65[_0xa3dd('0x48')]);if(!fs[_0xa3dd('0x50')](_0x30c242)){throw new db[(_0xa3dd('0x54'))][(_0xa3dd('0x55'))](_0xa3dd('0x56'));}if(_0x19df65[_0xa3dd('0x57')]){return _0x3d3ed6[_0xa3dd('0x58')](_0x30c242,_0x19df65[_0xa3dd('0x57')]+path[_0xa3dd('0x59')](_0x30c242),function(){if(_0x173320){fs[_0xa3dd('0x5a')](_0x30c242);}});}else{return _0x3d3ed6[_0xa3dd('0x58')](_0x30c242,function(_0x5c3e4f){if(_0x173320){fs[_0xa3dd('0x5a')](_0x30c242);}});}}})[_0xa3dd('0x3d')](function(_0x9ea3f9){if(_0x9ea3f9['message']===_0xa3dd('0x56')){_0x3d3ed6[_0xa3dd('0x16')](0x194)['send'](_0xa3dd('0x5b'));}else{return handleError(_0x3d3ed6,null);}});}; \ No newline at end of file +var _0x1bc1=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','destroy','then','error','stack','name','send','ScreenRecording','rawAttributes','model','differenceBy','format','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','field','options','includeAll','findAll','rows','catch','show','fields','include','find','body','update','createdAt','closedAt','value','params','describe','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1250fd,_0x195dd4){var _0x467027=function(_0x1795b6){while(--_0x1795b6){_0x1250fd['push'](_0x1250fd['shift']());}};_0x467027(++_0x195dd4);}(_0x1bc1,0x128));var _0x11bc=function(_0x26707f,_0x2bcfd5){_0x26707f=_0x26707f-0x0;var _0x3a19df=_0x1bc1[_0x26707f];return _0x3a19df;};'use strict';var pdf=require(_0x11bc('0x0'));var emlformat=require(_0x11bc('0x1'));var rimraf=require(_0x11bc('0x2'));var zipdir=require(_0x11bc('0x3'));var jsonpatch=require(_0x11bc('0x4'));var rp=require(_0x11bc('0x5'));var moment=require(_0x11bc('0x6'));var BPromise=require(_0x11bc('0x7'));var Mustache=require(_0x11bc('0x8'));var util=require(_0x11bc('0x9'));var path=require(_0x11bc('0xa'));var sox=require(_0x11bc('0xb'));var csv=require(_0x11bc('0xc'));var ejs=require(_0x11bc('0xd'));var fs=require('fs');var _=require(_0x11bc('0xe'));var squel=require(_0x11bc('0xf'));var crypto=require(_0x11bc('0x10'));var jsforce=require(_0x11bc('0x11'));var deskjs=require(_0x11bc('0x12'));var toCsv=require(_0x11bc('0xc'));var querystring=require(_0x11bc('0x13'));var Papa=require(_0x11bc('0x14'));var Redis=require(_0x11bc('0x15'));var authService=require(_0x11bc('0x16'));var qs=require(_0x11bc('0x17'));var hardwareService=require(_0x11bc('0x18'));var logger=require(_0x11bc('0x19'))(_0x11bc('0x1a'));var utils=require('../../config/utils');var config=require(_0x11bc('0x1b'));var db=require(_0x11bc('0x1c'))['db'];function respondWithStatusCode(_0x592bc9,_0x1d4278){_0x1d4278=_0x1d4278||0xcc;return function(_0x5f326c){if(_0x5f326c){return _0x592bc9[_0x11bc('0x1d')](_0x1d4278);}return _0x592bc9[_0x11bc('0x1e')](_0x1d4278)[_0x11bc('0x1f')]();};}function respondWithResult(_0xf12bd6,_0x2dd5fa){_0x2dd5fa=_0x2dd5fa||0xc8;return function(_0x44b286){if(_0x44b286){return _0xf12bd6[_0x11bc('0x1e')](_0x2dd5fa)[_0x11bc('0x20')](_0x44b286);}};}function respondWithFilteredResult(_0x304c79,_0x348cda){return function(_0x26da77){if(_0x26da77){var _0x3f695a=_0x26da77[_0x11bc('0x21')],_0x5d002a=_0x348cda[_0x11bc('0x22')],_0x159a37=_0x348cda[_0x11bc('0x22')]+_0x348cda[_0x11bc('0x23')],_0x40e365;if(_0x159a37>=_0x3f695a){_0x159a37=_0x3f695a;_0x40e365=0xc8;}else{_0x40e365=0xce;}_0x304c79[_0x11bc('0x1e')](_0x40e365);return _0x304c79['set']('Content-Range',_0x5d002a+'-'+_0x159a37+'/'+_0x3f695a)[_0x11bc('0x20')](_0x26da77);}return null;};}function patchUpdates(_0x543bee){return function(_0x94d02d){try{jsonpatch[_0x11bc('0x24')](_0x94d02d,_0x543bee,!![]);}catch(_0x544e23){return BPromise['reject'](_0x544e23);}return _0x94d02d[_0x11bc('0x25')]();};}function saveUpdates(_0x4ac299,_0x2c5bfe){return function(_0x456a69){if(_0x456a69){return _0x456a69['update'](_0x4ac299)['then'](function(_0x21e91a){return _0x21e91a;});}return null;};}function removeEntity(_0x45bfb5,_0x4815db){return function(_0x252545){if(_0x252545){return _0x252545[_0x11bc('0x26')]()[_0x11bc('0x27')](function(){_0x45bfb5['status'](0xcc)[_0x11bc('0x1f')]();});}};}function handleEntityNotFound(_0x599be6,_0x53c6aa){return function(_0x5cb7ec){if(!_0x5cb7ec){_0x599be6[_0x11bc('0x1d')](0x194);}return _0x5cb7ec;};}function handleError(_0x560634,_0x4d8053){_0x4d8053=_0x4d8053||0x1f4;return function(_0x4867f9){logger[_0x11bc('0x28')](_0x4867f9[_0x11bc('0x29')]);if(_0x4867f9[_0x11bc('0x2a')]){delete _0x4867f9[_0x11bc('0x2a')];}_0x560634[_0x11bc('0x1e')](_0x4d8053)[_0x11bc('0x2b')](_0x4867f9);};}exports['index']=function(_0x3c9640,_0x392ddc){var _0x34f4c9={},_0x28021a={},_0x212e1f={'count':0x0,'rows':[]};var _0x10096f=db[_0x11bc('0x2c')][_0x11bc('0x2d')];_0x28021a[_0x11bc('0x2e')]=_[_0x11bc('0x2f')](_['keys'](_0x10096f),[_0x11bc('0x30')]);_0x28021a['query']=_[_0x11bc('0x31')](_0x3c9640[_0x11bc('0x32')]);_0x28021a['filters']=_['intersection'](_0x28021a[_0x11bc('0x2e')],_0x28021a['query']);_0x34f4c9[_0x11bc('0x33')]=_[_0x11bc('0x34')](_0x28021a[_0x11bc('0x2e')],qs['fields'](_0x3c9640[_0x11bc('0x32')]['fields']));_0x34f4c9[_0x11bc('0x33')]=_0x34f4c9[_0x11bc('0x33')][_0x11bc('0x35')]?_0x34f4c9[_0x11bc('0x33')]:_0x28021a['model'];if(!_0x3c9640[_0x11bc('0x32')][_0x11bc('0x36')](_0x11bc('0x37'))){_0x34f4c9[_0x11bc('0x23')]=qs[_0x11bc('0x23')](_0x3c9640[_0x11bc('0x32')]['limit']);_0x34f4c9[_0x11bc('0x22')]=qs['offset'](_0x3c9640[_0x11bc('0x32')][_0x11bc('0x22')]);}_0x34f4c9[_0x11bc('0x38')]=qs[_0x11bc('0x39')](_0x3c9640[_0x11bc('0x32')][_0x11bc('0x39')]);_0x34f4c9[_0x11bc('0x3a')]=qs[_0x11bc('0x3b')](_[_0x11bc('0x3c')](_0x3c9640[_0x11bc('0x32')],_0x28021a[_0x11bc('0x3b')]));if(_0x3c9640[_0x11bc('0x32')][_0x11bc('0x3d')]){_0x34f4c9[_0x11bc('0x3a')]=_[_0x11bc('0x3e')](_0x34f4c9[_0x11bc('0x3a')],{'$or':_[_0x11bc('0x3f')](_0x10096f,function(_0x44d178){if(_0x44d178[_0x11bc('0x40')][_0x11bc('0x41')]!=='VIRTUAL'){var _0x582695={};_0x582695[_0x44d178[_0x11bc('0x42')]]={'$like':'%'+_0x3c9640['query'][_0x11bc('0x3d')]+'%'};return _0x582695;}})});}_0x34f4c9=_[_0x11bc('0x3e')]({},_0x34f4c9,_0x3c9640[_0x11bc('0x43')]);var _0x51f083={'where':_0x34f4c9['where']};return db[_0x11bc('0x2c')]['count'](_0x51f083)['then'](function(_0xe25f5e){_0x212e1f[_0x11bc('0x21')]=_0xe25f5e;if(_0x3c9640[_0x11bc('0x32')][_0x11bc('0x44')]){_0x34f4c9['include']=[{'all':!![]}];}return db[_0x11bc('0x2c')][_0x11bc('0x45')](_0x34f4c9);})['then'](function(_0x14995a){_0x212e1f[_0x11bc('0x46')]=_0x14995a;return _0x212e1f;})[_0x11bc('0x27')](respondWithFilteredResult(_0x392ddc,_0x34f4c9))[_0x11bc('0x47')](handleError(_0x392ddc,null));};exports[_0x11bc('0x48')]=function(_0x43cb9c,_0x3dad5){var _0x513157={'raw':![],'where':{'id':_0x43cb9c['params']['id']}},_0x1a8107={};_0x1a8107[_0x11bc('0x2e')]=_[_0x11bc('0x31')](db['ScreenRecording'][_0x11bc('0x2d')]);_0x1a8107['query']=_[_0x11bc('0x31')](_0x43cb9c[_0x11bc('0x32')]);_0x1a8107[_0x11bc('0x3b')]=_[_0x11bc('0x34')](_0x1a8107[_0x11bc('0x2e')],_0x1a8107['query']);_0x513157[_0x11bc('0x33')]=_[_0x11bc('0x34')](_0x1a8107[_0x11bc('0x2e')],qs['fields'](_0x43cb9c[_0x11bc('0x32')][_0x11bc('0x49')]));_0x513157[_0x11bc('0x33')]=_0x513157[_0x11bc('0x33')]['length']?_0x513157[_0x11bc('0x33')]:_0x1a8107[_0x11bc('0x2e')];if(_0x43cb9c[_0x11bc('0x32')][_0x11bc('0x44')]){_0x513157[_0x11bc('0x4a')]=[{'all':!![]}];}_0x513157=_[_0x11bc('0x3e')]({},_0x513157,_0x43cb9c[_0x11bc('0x43')]);return db[_0x11bc('0x2c')][_0x11bc('0x4b')](_0x513157)[_0x11bc('0x27')](handleEntityNotFound(_0x3dad5,null))['then'](respondWithResult(_0x3dad5,null))[_0x11bc('0x47')](handleError(_0x3dad5,null));};exports['create']=function(_0x54c557,_0x3604cf){return db['ScreenRecording']['create'](_0x54c557[_0x11bc('0x4c')],{})[_0x11bc('0x27')](respondWithResult(_0x3604cf,0xc9))[_0x11bc('0x47')](handleError(_0x3604cf,null));};exports[_0x11bc('0x4d')]=function(_0x3aeedc,_0x1aa110){if(_0x3aeedc['body']['id']){delete _0x3aeedc[_0x11bc('0x4c')]['id'];}delete _0x3aeedc[_0x11bc('0x4c')]['duration'];delete _0x3aeedc[_0x11bc('0x4c')][_0x11bc('0x4e')];delete _0x3aeedc[_0x11bc('0x4c')][_0x11bc('0x4f')];delete _0x3aeedc[_0x11bc('0x4c')][_0x11bc('0x50')];return db[_0x11bc('0x2c')][_0x11bc('0x4b')]({'where':{'id':_0x3aeedc['params']['id']}})['then'](handleEntityNotFound(_0x1aa110,null))[_0x11bc('0x27')](saveUpdates(_0x3aeedc[_0x11bc('0x4c')],null))[_0x11bc('0x27')](respondWithResult(_0x1aa110,null))['catch'](handleError(_0x1aa110,null));};exports['destroy']=function(_0x308821,_0x3e7fd2){return db[_0x11bc('0x2c')][_0x11bc('0x4b')]({'where':{'id':_0x308821[_0x11bc('0x51')]['id']}})['then'](handleEntityNotFound(_0x3e7fd2,null))[_0x11bc('0x27')](removeEntity(_0x3e7fd2,null))[_0x11bc('0x47')](handleError(_0x3e7fd2,null));};exports[_0x11bc('0x52')]=function(_0x82254a,_0xdb6a51){return db[_0x11bc('0x2c')][_0x11bc('0x52')]()[_0x11bc('0x27')](respondWithResult(_0xdb6a51,null))[_0x11bc('0x47')](handleError(_0xdb6a51,null));};exports['download']=function(_0x27e04a,_0x7c049b,_0x80b510){var _0x2fe32e=require(_0x11bc('0x53'));var _0x1794a0=![];var _0x499b03={};if(_0x27e04a[_0x11bc('0x32')][_0x11bc('0x40')]&&_0x27e04a['query'][_0x11bc('0x40')]==='uniqueid'){_0x499b03[_0x11bc('0x54')]=_0x27e04a[_0x11bc('0x51')]['id'];}else{_0x499b03['id']=_0x27e04a[_0x11bc('0x51')]['id'];}return db[_0x11bc('0x2c')][_0x11bc('0x4b')]({'where':_0x499b03,'attributes':['id',_0x11bc('0x50')],'raw':!![]})[_0x11bc('0x27')](handleEntityNotFound(_0x7c049b,null))[_0x11bc('0x27')](function(_0x467302){if(_0x467302){var _0x8fdbcb=path[_0x11bc('0x55')](config['root'],_0x11bc('0x56'),_0x467302[_0x11bc('0x50')]);var _0x23c8b6=util[_0x11bc('0x30')](_0x11bc('0x57'),_0x8fdbcb);if(fs[_0x11bc('0x58')](_0x23c8b6)){_0x1794a0=!![];return _0x2fe32e[_0x11bc('0x59')](_0x23c8b6,_0x8fdbcb,config[_0x11bc('0x5a')]['recording'])[_0x11bc('0x27')](function(){return _0x467302;});}return _0x467302;}})[_0x11bc('0x27')](function(_0x7bce9f){if(_0x7bce9f){var _0x51e152=path[_0x11bc('0x55')](config['root'],_0x11bc('0x56'),_0x7bce9f[_0x11bc('0x50')]);if(!fs['existsSync'](_0x51e152)){throw new db[(_0x11bc('0x5b'))][(_0x11bc('0x5c'))](_0x11bc('0x5d'));}if(_0x7bce9f[_0x11bc('0x5e')]){return _0x7c049b[_0x11bc('0x5f')](_0x51e152,_0x7bce9f[_0x11bc('0x5e')]+path[_0x11bc('0x60')](_0x51e152),function(){if(_0x1794a0){fs[_0x11bc('0x61')](_0x51e152);}});}else{return _0x7c049b['download'](_0x51e152,function(_0x2de622){if(_0x1794a0){fs['unlink'](_0x51e152);}});}}})[_0x11bc('0x47')](function(_0x13e6cf){if(_0x13e6cf[_0x11bc('0x62')]===_0x11bc('0x5d')){_0x7c049b['status'](0x194)['send'](_0x11bc('0x63'));}else{return handleError(_0x7c049b,null);}});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 94ec0dd..15f4c98 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 _0xa262=['finally','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','ScreenRecording','screen_recordings','interactionid','isNil','value','join','server','existsSync','log','catch'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xa262,0x169));var _0x2a26=function(_0x5c76c7,_0x3bd533){_0x5c76c7=_0x5c76c7-0x0;var _0x561177=_0xa262[_0x5c76c7];return _0x561177;};'use strict';var _=require(_0x2a26('0x0'));var util=require(_0x2a26('0x1'));var logger=require('../../config/logger')(_0x2a26('0x2'));var moment=require(_0x2a26('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a26('0x4'));var fs=require('fs');var path=require(_0x2a26('0x5'));var rimraf=require(_0x2a26('0x6'));var config=require(_0x2a26('0x7'));var attributes=require('./screenRecording.attributes');module[_0x2a26('0x8')]=function(_0x55cecb,_0x45bbb8){return _0x55cecb['define'](_0x2a26('0x9'),attributes,{'tableName':_0x2a26('0xa'),'paranoid':![],'indexes':[{'name':_0x2a26('0xb'),'fields':['interactionid']}],'timestamps':!![],'hooks':{'afterDestroy':function(_0x433bb9,_0x3dec14,_0x5e6b0c){return new BPromise(function(_0x449b57,_0x13a094){if(!_[_0x2a26('0xc')](_0x433bb9[_0x2a26('0xd')])){var _0x3ab19b=path[_0x2a26('0xe')](config['root'],_0x2a26('0xf'),'files',_0x2a26('0xa'),_0x433bb9[_0x2a26('0xd')]);if(fs[_0x2a26('0x10')](_0x3ab19b)){rimraf(_0x3ab19b,function(_0x28c21a){if(_0x28c21a){console[_0x2a26('0x11')](_0x28c21a);}});}}_0x449b57();})[_0x2a26('0x12')](function(_0x1fd85e){BPromise['resolve']();})[_0x2a26('0x13')](function(){_0x5e6b0c();});}}});}; \ No newline at end of file +var _0x3877=['server','files','existsSync','log','catch','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','isNil','value','join'];(function(_0x2bc400,_0x27208f){var _0x36ab53=function(_0x257660){while(--_0x257660){_0x2bc400['push'](_0x2bc400['shift']());}};_0x36ab53(++_0x27208f);}(_0x3877,0xcc));var _0x7387=function(_0x3d5bfa,_0xf9b44a){_0x3d5bfa=_0x3d5bfa-0x0;var _0x422190=_0x3877[_0x3d5bfa];return _0x422190;};'use strict';var _=require(_0x7387('0x0'));var util=require(_0x7387('0x1'));var logger=require(_0x7387('0x2'))(_0x7387('0x3'));var moment=require(_0x7387('0x4'));var BPromise=require(_0x7387('0x5'));var rp=require(_0x7387('0x6'));var fs=require('fs');var path=require(_0x7387('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7387('0x8'));module[_0x7387('0x9')]=function(_0x443448,_0x134ad2){return _0x443448['define'](_0x7387('0xa'),attributes,{'tableName':_0x7387('0xb'),'paranoid':![],'indexes':[{'name':_0x7387('0xc'),'fields':['interactionid']}],'timestamps':!![],'hooks':{'afterDestroy':function(_0x3f3990,_0x166443,_0x3af416){return new BPromise(function(_0x27da3b,_0x2464d1){if(!_[_0x7387('0xd')](_0x3f3990[_0x7387('0xe')])){var _0x324196=path[_0x7387('0xf')](config['root'],_0x7387('0x10'),_0x7387('0x11'),_0x7387('0xb'),_0x3f3990[_0x7387('0xe')]);if(fs[_0x7387('0x12')](_0x324196)){rimraf(_0x324196,function(_0x33014e){if(_0x33014e){console[_0x7387('0x13')](_0x33014e);}});}}_0x27da3b();})[_0x7387('0x14')](function(_0x267a9d){BPromise['resolve']();})[_0x7387('0x15')](function(){_0x3af416();});}}});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f1ac8a9..a8d434a 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 _0x9c5a=['http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3ce334,_0x1bda64){var _0x37ce7c=function(_0x286e39){while(--_0x286e39){_0x3ce334['push'](_0x3ce334['shift']());}};_0x37ce7c(++_0x1bda64);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x57f830,_0x14884e){_0x57f830=_0x57f830-0x0;var _0x2cbace=_0x9c5a[_0x57f830];return _0x2cbace;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0xcb99=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcb99,0x8b));var _0x9cb9=function(_0x1fb7c9,_0xb14ddf){_0x1fb7c9=_0x1fb7c9-0x0;var _0x5f0c3a=_0xcb99[_0x1fb7c9];return _0x5f0c3a;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var moment=require(_0x9cb9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];var utils=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed26a,_0xa84493,_0x1bf9b7){return new BPromise(function(_0x1dd62f,_0x82e3e){return client[_0x9cb9('0x8')](_0x2ed26a,_0x1bf9b7)[_0x9cb9('0x9')](function(_0x3da50b){logger['info']('ScreenRecording,\x20%s,\x20%s',_0xa84493,_0x9cb9('0xa'));logger[_0x9cb9('0xb')](_0x9cb9('0xc'),_0xa84493,'request\x20sent',JSON[_0x9cb9('0xd')](_0x3da50b));if(_0x3da50b[_0x9cb9('0xe')]){if(_0x3da50b['error']['code']===0x1f4){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x82e3e(_0x3da50b['error'][_0x9cb9('0x10')]);}logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x1dd62f(_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);}else{logger[_0x9cb9('0x11')](_0x9cb9('0xf'),_0xa84493,_0x9cb9('0xa'));_0x1dd62f(_0x3da50b[_0x9cb9('0x12')][_0x9cb9('0x10')]);}})[_0x9cb9('0x13')](function(_0x140910){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x140910);_0x82e3e(_0x140910);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cf3ef5e..8989859 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 _0x4eab=['Router','../../components/auth/service','../../config/environment','./setting.controller','get','index','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','diskStorage','join','format','%s%s','originalname','post','single','file','addLogo','root','server/files/images/logos/','extname','preferred','addPreferred','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x2bc336,_0x31aa33){var _0x15fa92=function(_0x491c9d){while(--_0x491c9d){_0x2bc336['push'](_0x2bc336['shift']());}};_0x15fa92(++_0x31aa33);}(_0x4eab,0xc7));var _0xb4ea=function(_0x552f61,_0x43c074){_0x552f61=_0x552f61-0x0;var _0x2705b7=_0x4eab[_0x552f61];return _0x2705b7;};'use strict';var multer=require(_0xb4ea('0x0'));var util=require(_0xb4ea('0x1'));var path=require(_0xb4ea('0x2'));var timeout=require(_0xb4ea('0x3'));var express=require(_0xb4ea('0x4'));var router=express[_0xb4ea('0x5')]();var auth=require(_0xb4ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb4ea('0x7'));var controller=require(_0xb4ea('0x8'));router[_0xb4ea('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4ea('0xa')]);router['get']('/:id',controller[_0xb4ea('0xb')]);router[_0xb4ea('0x9')](_0xb4ea('0xc'),controller['getLogo']);router[_0xb4ea('0x9')](_0xb4ea('0xd'),controller[_0xb4ea('0xe')]);router[_0xb4ea('0x9')](_0xb4ea('0xf'),controller['gdpr']);router[_0xb4ea('0x9')](_0xb4ea('0x10'),controller['getPreferred']);var upload=multer({'storage':multer[_0xb4ea('0x11')]({'destination':function(_0x454ed5,_0x1de6ca,_0x4352d5){_0x4352d5(null,path[_0xb4ea('0x12')](config['root'],'server/files/images/logos/'));},'filename':function(_0x56c99d,_0x2d422b,_0x2ae94a){_0x2ae94a(null,util[_0xb4ea('0x13')](_0xb4ea('0x14'),'logo',path['extname'](_0x2d422b[_0xb4ea('0x15')])));}})});router[_0xb4ea('0x16')](_0xb4ea('0xc'),upload[_0xb4ea('0x17')](_0xb4ea('0x18')),controller[_0xb4ea('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x371886,_0x17abc4,_0x1c699c){_0x1c699c(null,path['join'](config[_0xb4ea('0x1a')],_0xb4ea('0x1b')));},'filename':function(_0x34f448,_0x2ce6b5,_0x18eeaa){_0x18eeaa(null,util[_0xb4ea('0x13')](_0xb4ea('0x14'),'logologin',path[_0xb4ea('0x1c')](_0x2ce6b5['originalname'])));}})});router[_0xb4ea('0x16')]('/:id/logo_login',upload['single'](_0xb4ea('0x18')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58dc68,_0x1521df,_0x5e1d33){_0x5e1d33(null,path['join'](config[_0xb4ea('0x1a')],'server/files/images/logos/'));},'filename':function(_0x487024,_0x1ec159,_0x4fc6f5){_0x4fc6f5(null,util['format'](_0xb4ea('0x14'),_0xb4ea('0x1d'),path[_0xb4ea('0x1c')](_0x1ec159[_0xb4ea('0x15')])));}})});router['post'](_0xb4ea('0x10'),upload[_0xb4ea('0x17')](_0xb4ea('0x18')),controller[_0xb4ea('0x1e')]);router[_0xb4ea('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0xb4ea('0x20')]);module[_0xb4ea('0x21')]=router; \ No newline at end of file +var _0xb409=['put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','/:id/logo','single','addLogo','logologin','post','file','addLogoLogin','join','preferred','/:id/preferred','addPreferred'];(function(_0x372204,_0x1f3cf9){var _0x53e192=function(_0x56e378){while(--_0x56e378){_0x372204['push'](_0x372204['shift']());}};_0x53e192(++_0x1f3cf9);}(_0xb409,0x174));var _0x9b40=function(_0x44a0b8,_0x4d9270){_0x44a0b8=_0x44a0b8-0x0;var _0xe9e735=_0xb409[_0x44a0b8];return _0xe9e735;};'use strict';var multer=require(_0x9b40('0x0'));var util=require(_0x9b40('0x1'));var path=require(_0x9b40('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b40('0x3'));var router=express[_0x9b40('0x4')]();var auth=require(_0x9b40('0x5'));var interaction=require(_0x9b40('0x6'));var config=require(_0x9b40('0x7'));var controller=require(_0x9b40('0x8'));router[_0x9b40('0x9')]('/',auth[_0x9b40('0xa')](),controller['index']);router[_0x9b40('0x9')](_0x9b40('0xb'),controller[_0x9b40('0xc')]);router[_0x9b40('0x9')]('/:id/logo',controller[_0x9b40('0xd')]);router['get'](_0x9b40('0xe'),controller[_0x9b40('0xf')]);router[_0x9b40('0x9')](_0x9b40('0x10'),controller[_0x9b40('0x11')]);router['get']('/:id/preferred',controller[_0x9b40('0x12')]);var upload=multer({'storage':multer[_0x9b40('0x13')]({'destination':function(_0x171b26,_0x48d2e8,_0x54330d){_0x54330d(null,path['join'](config[_0x9b40('0x14')],_0x9b40('0x15')));},'filename':function(_0x38c3ce,_0x4e8f91,_0x54a8fb){_0x54a8fb(null,util[_0x9b40('0x16')](_0x9b40('0x17'),_0x9b40('0x18'),path[_0x9b40('0x19')](_0x4e8f91[_0x9b40('0x1a')])));}})});router['post'](_0x9b40('0x1b'),upload[_0x9b40('0x1c')]('file'),controller[_0x9b40('0x1d')]);var upload=multer({'storage':multer[_0x9b40('0x13')]({'destination':function(_0xffdade,_0x31d4fb,_0x253c83){_0x253c83(null,path['join'](config[_0x9b40('0x14')],_0x9b40('0x15')));},'filename':function(_0x20c813,_0x58e5f0,_0x430bef){_0x430bef(null,util['format'](_0x9b40('0x17'),_0x9b40('0x1e'),path[_0x9b40('0x19')](_0x58e5f0['originalname'])));}})});router[_0x9b40('0x1f')](_0x9b40('0xe'),upload[_0x9b40('0x1c')](_0x9b40('0x20')),controller[_0x9b40('0x21')]);var upload=multer({'storage':multer[_0x9b40('0x13')]({'destination':function(_0x4e608a,_0x38ab5e,_0x30ed93){_0x30ed93(null,path[_0x9b40('0x22')](config[_0x9b40('0x14')],_0x9b40('0x15')));},'filename':function(_0x407bae,_0x8abcfe,_0x2f4852){_0x2f4852(null,util[_0x9b40('0x16')](_0x9b40('0x17'),_0x9b40('0x23'),path[_0x9b40('0x19')](_0x8abcfe['originalname'])));}})});router[_0x9b40('0x1f')](_0x9b40('0x24'),upload[_0x9b40('0x1c')]('file'),controller[_0x9b40('0x25')]);router[_0x9b40('0x26')](_0x9b40('0xb'),auth[_0x9b40('0xa')](),controller[_0x9b40('0x27')]);module[_0x9b40('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 223dc36..8302490 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 _0x1b73=['/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','exports','INTEGER','min_internal'];(function(_0x592f9f,_0x38cff0){var _0x15b8f8=function(_0x3a64b7){while(--_0x3a64b7){_0x592f9f['push'](_0x592f9f['shift']());}};_0x15b8f8(++_0x38cff0);}(_0x1b73,0x1d5));var _0x31b7=function(_0x16a320,_0x4268c1){_0x16a320=_0x16a320-0x0;var _0x3f4419=_0x1b73[_0x16a320];return _0x3f4419;};'use strict';var Sequelize=require('sequelize');module[_0x31b7('0x0')]={'min_internal':{'type':Sequelize[_0x31b7('0x1')](0xb),'unique':_0x31b7('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x31b7('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x31b7('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x31b7('0x3')},'logo':{'type':Sequelize[_0x31b7('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x31b7('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x31b7('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x31b7('0x4')]},'turnaddr':{'type':Sequelize[_0x31b7('0x4')]},'turnusername':{'type':Sequelize[_0x31b7('0x4')]},'turnpassword':{'type':Sequelize[_0x31b7('0x4')]},'pageTitle':{'type':Sequelize[_0x31b7('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x31b7('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x31b7('0x4')],'defaultValue':_0x31b7('0x6')},'enableEmailPreview':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x31b7('0x7')},'chatTimeout':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x31b7('0x4')]},'defaultPreferred':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x31b7('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x31b7('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2fe3=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','STRING','BOOLEAN'];(function(_0x753026,_0x34dc5c){var _0x443ddf=function(_0x499149){while(--_0x499149){_0x753026['push'](_0x753026['shift']());}};_0x443ddf(++_0x34dc5c);}(_0x2fe3,0x87));var _0x32fe=function(_0x260dac,_0x4cf98d){_0x260dac=_0x260dac-0x0;var _0x513356=_0x2fe3[_0x260dac];return _0x513356;};'use strict';var Sequelize=require(_0x32fe('0x0'));module[_0x32fe('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32fe('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x32fe('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x32fe('0x3')]},'defaultLogo':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x32fe('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32fe('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x32fe('0x3')]},'turnpassword':{'type':Sequelize[_0x32fe('0x3')]},'pageTitle':{'type':Sequelize[_0x32fe('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32fe('0x3')],'defaultValue':_0x32fe('0x5')},'enableEmailPreview':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x32fe('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32fe('0x3')],'defaultValue':_0x32fe('0x6')},'chatTimeout':{'type':Sequelize[_0x32fe('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x32fe('0x3')]},'defaultPreferred':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32fe('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x32fe('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x32fe('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32fe('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1361f0f..18324be 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 _0xe13a=['getLogoLogin','default_loginLogo.png','custom','Sequelize','gdpr','addPreferred','getPreferred','defaultLogo','default_preferred.png','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','test','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','reject','update','sendStatus','stack','name','send','Setting','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','field','options','includeAll','include','catch','show','find','body','get','readFileSync','join','server/files/templates/stun.ejs','server/files/templates/turn.ejs','render','/etc/asterisk/stun_xcally.conf','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_rtp_asterisk.so','addLogo','file','filename','logo','params','loginLogo','../../config/license/util','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','default','upperFirst','default_logo.png','ValidationError','Logo\x20not\x20found','download'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xe13a,0xf5));var _0xae13=function(_0x481559,_0x4aad57){_0x481559=_0x481559-0x0;var _0x1409a7=_0xe13a[_0x481559];return _0x1409a7;};'use strict';var pdf=require(_0xae13('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require(_0xae13('0x4'));var moment=require(_0xae13('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xae13('0x6'));var sox=require(_0xae13('0x7'));var csv=require(_0xae13('0x8'));var ejs=require(_0xae13('0x9'));var fs=require('fs');var _=require(_0xae13('0xa'));var squel=require(_0xae13('0xb'));var crypto=require('crypto');var jsforce=require(_0xae13('0xc'));var deskjs=require(_0xae13('0xd'));var toCsv=require(_0xae13('0x8'));var querystring=require('querystring');var Papa=require(_0xae13('0xe'));var Redis=require(_0xae13('0xf'));var authService=require(_0xae13('0x10'));var qs=require(_0xae13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae13('0x12'))(_0xae13('0x13'));var utils=require('../../config/utils');var config=require(_0xae13('0x14'));var db=require(_0xae13('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xae13('0x16')][_0xae13('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3914c4,_0x375c0d,_0xff07c9){if(_0xff07c9){var _0x8929a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8929a1[_0xae13('0x18')](_0x375c0d)){return _0x3914c4;}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 _0x3914c4;}}function respondWithRpcPromise(_0x1ac035,_0xd178e7,_0x1802aa,_0x8cc89e){return new BPromise(function(_0x1abc35,_0x139566){var _0x27e5f7=_0x8cc89e||client;return _0x27e5f7[_0xae13('0x19')](_0x1ac035,_0x1802aa)[_0xae13('0x1a')](function(_0x2e77f0){logger[_0xae13('0x1b')](_0xae13('0x1c'),_0xd178e7,_0xae13('0x1d'));logger['debug'](_0xae13('0x1e'),_0xd178e7,_0xae13('0x1d'),JSON[_0xae13('0x1f')](_0x2e77f0));if(_0x2e77f0[_0xae13('0x20')]){if(_0x2e77f0['error'][_0xae13('0x21')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0xd178e7,_0x2e77f0[_0xae13('0x20')][_0xae13('0x22')]);return _0x139566(_0x2e77f0[_0xae13('0x20')][_0xae13('0x22')]);}logger[_0xae13('0x20')](_0xae13('0x1c'),_0xd178e7,_0x2e77f0[_0xae13('0x20')][_0xae13('0x22')]);return _0x1abc35(_0x2e77f0[_0xae13('0x20')][_0xae13('0x22')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0xd178e7,_0xae13('0x1d'));_0x1abc35(_0x2e77f0['result'][_0xae13('0x22')]);}})['catch'](function(_0x5a1c01){logger[_0xae13('0x20')](_0xae13('0x1c'),_0xd178e7,_0x5a1c01);_0x139566(_0x5a1c01);});});}function respondWithStatusCode(_0x5ebcc1,_0xcda826){_0xcda826=_0xcda826||0xcc;return function(_0xee8e07){if(_0xee8e07){return _0x5ebcc1['sendStatus'](_0xcda826);}return _0x5ebcc1[_0xae13('0x23')](_0xcda826)[_0xae13('0x24')]();};}function respondWithResult(_0x2ce6c4,_0x59c9b4){_0x59c9b4=_0x59c9b4||0xc8;return function(_0x4e2c7e){if(_0x4e2c7e){return _0x2ce6c4[_0xae13('0x23')](_0x59c9b4)[_0xae13('0x25')](_0x4e2c7e);}};}function respondWithFilteredResult(_0x2bf882,_0x2dc02e){return function(_0x222b3b){if(_0x222b3b){var _0x4fb607=_0x222b3b[_0xae13('0x26')],_0x526d26=_0x2dc02e[_0xae13('0x27')],_0x3f1e30=_0x2dc02e['offset']+_0x2dc02e[_0xae13('0x28')],_0xc22a57;if(_0x3f1e30>=_0x4fb607){_0x3f1e30=_0x4fb607;_0xc22a57=0xc8;}else{_0xc22a57=0xce;}_0x2bf882[_0xae13('0x23')](_0xc22a57);return _0x2bf882[_0xae13('0x29')](_0xae13('0x2a'),_0x526d26+'-'+_0x3f1e30+'/'+_0x4fb607)[_0xae13('0x25')](_0x222b3b);}return null;};}function patchUpdates(_0x517011){return function(_0x27fd51){try{jsonpatch['apply'](_0x27fd51,_0x517011,!![]);}catch(_0x84aeb9){return BPromise[_0xae13('0x2b')](_0x84aeb9);}return _0x27fd51['save']();};}function saveUpdates(_0x4e96d9,_0x3fb1a2){return function(_0x16cc06){if(_0x16cc06){return _0x16cc06[_0xae13('0x2c')](_0x4e96d9)[_0xae13('0x1a')](function(_0x440b6d){return _0x440b6d;});}return null;};}function removeEntity(_0x27b9a6,_0x27c45b){return function(_0x4b4fa4){if(_0x4b4fa4){return _0x4b4fa4['destroy']()[_0xae13('0x1a')](function(){_0x27b9a6['status'](0xcc)[_0xae13('0x24')]();});}};}function handleEntityNotFound(_0x5ca5ab,_0xbed074){return function(_0xc2b2f9){if(!_0xc2b2f9){_0x5ca5ab[_0xae13('0x2d')](0x194);}return _0xc2b2f9;};}function handleError(_0x2a7b26,_0x337993){_0x337993=_0x337993||0x1f4;return function(_0x205e70){logger[_0xae13('0x20')](_0x205e70[_0xae13('0x2e')]);if(_0x205e70[_0xae13('0x2f')]){delete _0x205e70['name'];}_0x2a7b26[_0xae13('0x23')](_0x337993)[_0xae13('0x30')](_0x205e70);};}exports['index']=function(_0x1b9aea,_0x398ea6){var _0x572216={},_0x1f5221={},_0x37a39f={'count':0x0,'rows':[]};var _0x111250=db[_0xae13('0x31')][_0xae13('0x32')];_0x1f5221[_0xae13('0x33')]=_[_0xae13('0x34')](_0x111250);_0x1f5221[_0xae13('0x35')]=_[_0xae13('0x34')](_0x1b9aea['query']);_0x1f5221[_0xae13('0x36')]=_[_0xae13('0x37')](_0x1f5221['model'],_0x1f5221[_0xae13('0x35')]);_0x572216['attributes']=_[_0xae13('0x37')](_0x1f5221[_0xae13('0x33')],qs[_0xae13('0x38')](_0x1b9aea[_0xae13('0x35')][_0xae13('0x38')]));_0x572216[_0xae13('0x39')]=_0x572216['attributes'][_0xae13('0x3a')]?_0x572216[_0xae13('0x39')]:_0x1f5221[_0xae13('0x33')];if(!_0x1b9aea[_0xae13('0x35')][_0xae13('0x3b')](_0xae13('0x3c'))){_0x572216[_0xae13('0x28')]=qs['limit'](_0x1b9aea['query'][_0xae13('0x28')]);_0x572216[_0xae13('0x27')]=qs[_0xae13('0x27')](_0x1b9aea[_0xae13('0x35')][_0xae13('0x27')]);}_0x572216[_0xae13('0x3d')]=qs[_0xae13('0x3e')](_0x1b9aea[_0xae13('0x35')][_0xae13('0x3e')]);_0x572216[_0xae13('0x3f')]=qs['filters'](_[_0xae13('0x40')](_0x1b9aea[_0xae13('0x35')],_0x1f5221[_0xae13('0x36')]));if(_0x1b9aea['query'][_0xae13('0x41')]){_0x572216[_0xae13('0x3f')]=_[_0xae13('0x42')](_0x572216[_0xae13('0x3f')],{'$or':_[_0xae13('0x43')](_0x111250,function(_0x3a7ea9){if(_0x3a7ea9[_0xae13('0x44')]['key']!=='VIRTUAL'){var _0x4d861b={};_0x4d861b[_0x3a7ea9[_0xae13('0x45')]]={'$like':'%'+_0x1b9aea['query'][_0xae13('0x41')]+'%'};return _0x4d861b;}})});}_0x572216=_[_0xae13('0x42')]({},_0x572216,_0x1b9aea[_0xae13('0x46')]);var _0x46702f={'where':_0x572216[_0xae13('0x3f')]};return db[_0xae13('0x31')][_0xae13('0x26')](_0x46702f)[_0xae13('0x1a')](function(_0x5420e8){_0x37a39f['count']=_0x5420e8;if(_0x1b9aea[_0xae13('0x35')][_0xae13('0x47')]){_0x572216[_0xae13('0x48')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x572216);})['then'](function(_0x3456ca){_0x37a39f['rows']=_0x3456ca;return _0x37a39f;})[_0xae13('0x1a')](respondWithFilteredResult(_0x398ea6,_0x572216))[_0xae13('0x49')](handleError(_0x398ea6,null));};exports[_0xae13('0x4a')]=function(_0x24562d,_0x2d125c){var _0x505320={'raw':![],'where':{'id':_0x24562d['params']['id']}},_0x15695c={};_0x15695c[_0xae13('0x33')]=_[_0xae13('0x34')](db['Setting'][_0xae13('0x32')]);_0x15695c['query']=_[_0xae13('0x34')](_0x24562d['query']);_0x15695c[_0xae13('0x36')]=_[_0xae13('0x37')](_0x15695c[_0xae13('0x33')],_0x15695c[_0xae13('0x35')]);_0x505320['attributes']=_[_0xae13('0x37')](_0x15695c['model'],qs['fields'](_0x24562d['query'][_0xae13('0x38')]));_0x505320[_0xae13('0x39')]=_0x505320[_0xae13('0x39')][_0xae13('0x3a')]?_0x505320[_0xae13('0x39')]:_0x15695c['model'];if(_0x24562d[_0xae13('0x35')]['includeAll']){_0x505320['include']=[{'all':!![]}];}_0x505320=_[_0xae13('0x42')]({},_0x505320,_0x24562d['options']);return db[_0xae13('0x31')]['find'](_0x505320)[_0xae13('0x1a')](handleEntityNotFound(_0x2d125c,null))['then'](respondWithResult(_0x2d125c,null))[_0xae13('0x49')](handleError(_0x2d125c,null));};exports[_0xae13('0x2c')]=function(_0x2fd8a5,_0x4b9001,_0x83c64c){var _0x41f0f0;return db[_0xae13('0x31')][_0xae13('0x4b')]({'where':{'id':_0x2fd8a5['params']['id']}})[_0xae13('0x1a')](handleEntityNotFound(_0x4b9001,null))[_0xae13('0x1a')](saveUpdates(_0x2fd8a5[_0xae13('0x4c')],null))['then'](function(_0x27984e){if(_0x27984e){_0x41f0f0=_0x27984e[_0xae13('0x4d')]({'plain':!![]});var _0x5d24d5=fs[_0xae13('0x4e')](path[_0xae13('0x4f')](config['root'],_0xae13('0x50')),'utf8');var _0x58e375=ejs['render'](_0x5d24d5,_0x41f0f0);var _0x5be5d1=fs[_0xae13('0x4e')](path['join'](config['root'],_0xae13('0x51')),'utf8');var _0x21f64d=ejs[_0xae13('0x52')](_0x5be5d1,_0x41f0f0);fs['writeFileSync'](_0xae13('0x53'),_0x58e375);fs[_0xae13('0x54')](_0xae13('0x55'),_0x21f64d);return respondWithRpcPromise(_0xae13('0x56'),_0xae13('0x2c'),{'module':'res_stun_monitor.so'});}})[_0xae13('0x1a')](function(){return respondWithRpcPromise(_0xae13('0x56'),_0xae13('0x2c'),{'module':_0xae13('0x57')});})[_0xae13('0x1a')](function(){return _0x41f0f0||null;})['then'](respondWithResult(_0x4b9001,null))[_0xae13('0x49')](handleError(_0x4b9001,null));};exports[_0xae13('0x58')]=function(_0x59682c,_0x3d2ea4,_0x2864ab){if(_0x59682c[_0xae13('0x59')]&&_0x59682c['file'][_0xae13('0x5a')]){_0x59682c['body'][_0xae13('0x5b')]=_0x59682c['file'][_0xae13('0x5a')];}return db[_0xae13('0x31')][_0xae13('0x4b')]({'where':{'id':_0x59682c[_0xae13('0x5c')]['id']}})[_0xae13('0x1a')](handleEntityNotFound(_0x3d2ea4,null))[_0xae13('0x1a')](saveUpdates(_0x59682c[_0xae13('0x4c')],null))['then'](respondWithResult(_0x3d2ea4,null))['catch'](handleError(_0x3d2ea4,null));};exports['addLogoLogin']=function(_0x267751,_0xec87f9,_0x436438){if(_0x267751['file']&&_0x267751[_0xae13('0x59')]['filename']){_0x267751[_0xae13('0x4c')][_0xae13('0x5d')]=_0x267751[_0xae13('0x59')][_0xae13('0x5a')];}return db[_0xae13('0x31')]['find']({'where':{'id':_0x267751['params']['id']}})['then'](handleEntityNotFound(_0xec87f9,null))[_0xae13('0x1a')](saveUpdates(_0x267751[_0xae13('0x4c')],null))[_0xae13('0x1a')](respondWithResult(_0xec87f9,null))[_0xae13('0x49')](handleError(_0xec87f9,null));};var utilLicense=require(_0xae13('0x5e'));exports['getLogo']=function(_0x460f0a,_0x399273,_0x44c888){var _0x3be4a0=_0xae13('0x5f');var _0x17a919={'custom':![]};return utilLicense[_0xae13('0x60')]()[_0xae13('0x1a')](function(_0x27bc33){if(_0x27bc33){_0x17a919=_0x27bc33;}return db['Setting']['find']({'where':{'id':_0x460f0a[_0xae13('0x5c')]['id']},'attributes':[_0xae13('0x5b'),_0xae13('0x5d'),_0xae13('0x61'),'defaultLogo',_0xae13('0x62'),_0xae13('0x63')],'raw':!![]});})[_0xae13('0x1a')](handleEntityNotFound(_0x399273,null))[_0xae13('0x1a')](function(_0x5e8936){if(_0x5e8936){var _0x554963=_0x5e8936[_0xae13('0x5b')]&&fs[_0xae13('0x64')](path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x3be4a0,_[_0xae13('0x66')](_0x5e8936[_0xae13('0x5b')])))?path['join'](config[_0xae13('0x65')],_0x3be4a0,_['toLower'](_0x5e8936[_0xae13('0x5b')])):path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x3be4a0,_[_0xae13('0x66')]('default_logo.png'));var _0x580b87=_0xae13('0x67')+_[_0xae13('0x68')](_0xae13('0x5b'));if(_0x5e8936[_0x580b87]||!_0x17a919['custom']){_0x554963=path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x3be4a0,_[_0xae13('0x66')](_0xae13('0x69')));}if(!fs[_0xae13('0x64')](_0x554963)){throw new db['Sequelize'][(_0xae13('0x6a'))](_0xae13('0x6b'));}return _0x399273[_0xae13('0x6c')](_0x554963);}})[_0xae13('0x49')](handleError(_0x399273,null));};var utilLicense=require('../../config/license/util');exports[_0xae13('0x6d')]=function(_0x125e2e,_0x8213ff,_0x3d8dad){var _0x5db313='server/files/images/logos';var _0x41c248={'custom':![]};return utilLicense[_0xae13('0x60')]()[_0xae13('0x1a')](function(_0x2ab8a4){if(_0x2ab8a4){_0x41c248=_0x2ab8a4;}return db[_0xae13('0x31')][_0xae13('0x4b')]({'where':{'id':_0x125e2e[_0xae13('0x5c')]['id']},'attributes':['logo','loginLogo',_0xae13('0x61'),'defaultLogo',_0xae13('0x62'),_0xae13('0x63')],'raw':!![]});})[_0xae13('0x1a')](handleEntityNotFound(_0x8213ff,null))['then'](function(_0x2b110d){if(_0x2b110d){var _0x133e9e=_0x2b110d[_0xae13('0x5d')]&&fs[_0xae13('0x64')](path['join'](config[_0xae13('0x65')],_0x5db313,_[_0xae13('0x66')](_0x2b110d[_0xae13('0x5d')])))?path[_0xae13('0x4f')](config['root'],_0x5db313,_[_0xae13('0x66')](_0x2b110d[_0xae13('0x5d')])):path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x5db313,_[_0xae13('0x66')](_0xae13('0x6e')));var _0x373087='default'+_[_0xae13('0x68')](_0xae13('0x5d'));if(_0x2b110d[_0x373087]||!_0x41c248[_0xae13('0x6f')]){_0x133e9e=path['join'](config[_0xae13('0x65')],_0x5db313,_['toLower'](_0xae13('0x6e')));}if(!fs[_0xae13('0x64')](_0x133e9e)){throw new db[(_0xae13('0x70'))][(_0xae13('0x6a'))](_0xae13('0x6b'));}return _0x8213ff[_0xae13('0x6c')](_0x133e9e);}})[_0xae13('0x49')](handleError(_0x8213ff,null));};exports[_0xae13('0x71')]=function(_0x4d3174,_0xb3bcdd){return db['Setting'][_0xae13('0x4b')]({'where':{'id':_0x4d3174[_0xae13('0x5c')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0xb3bcdd,null))[_0xae13('0x49')](handleError(_0xb3bcdd,null));};exports[_0xae13('0x72')]=function(_0x48ad1a,_0x2a3fc3,_0x23c9bd){if(_0x48ad1a[_0xae13('0x59')]&&_0x48ad1a[_0xae13('0x59')][_0xae13('0x5a')]){_0x48ad1a[_0xae13('0x4c')][_0xae13('0x61')]=_0x48ad1a[_0xae13('0x59')]['filename'];}return db[_0xae13('0x31')]['find']({'where':{'id':_0x48ad1a['params']['id']}})[_0xae13('0x1a')](handleEntityNotFound(_0x2a3fc3,null))[_0xae13('0x1a')](saveUpdates(_0x48ad1a['body'],null))[_0xae13('0x1a')](respondWithResult(_0x2a3fc3,null))[_0xae13('0x49')](handleError(_0x2a3fc3,null));};var utilLicense=require(_0xae13('0x5e'));exports[_0xae13('0x73')]=function(_0x3cf41b,_0x1ae768,_0x42e11a){var _0x5f39e0=_0xae13('0x5f');var _0x47fcac={'custom':![]};return utilLicense[_0xae13('0x60')]()[_0xae13('0x1a')](function(_0x810289){if(_0x810289){_0x47fcac=_0x810289;}return db['Setting']['find']({'where':{'id':_0x3cf41b['params']['id']},'attributes':[_0xae13('0x5b'),'loginLogo',_0xae13('0x61'),_0xae13('0x74'),_0xae13('0x62'),_0xae13('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x1ae768,null))[_0xae13('0x1a')](function(_0x260af5){if(_0x260af5){var _0x2e936c=_0x260af5['preferred']&&fs[_0xae13('0x64')](path['join'](config[_0xae13('0x65')],_0x5f39e0,_['toLower'](_0x260af5[_0xae13('0x61')])))?path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x5f39e0,_[_0xae13('0x66')](_0x260af5['preferred'])):path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x5f39e0,_[_0xae13('0x66')](_0xae13('0x75')));var _0x9b4da9='default'+_[_0xae13('0x68')]('preferred');if(_0x260af5[_0x9b4da9]||!_0x47fcac[_0xae13('0x6f')]||!_0x47fcac['preferred']){_0x2e936c=path[_0xae13('0x4f')](config[_0xae13('0x65')],_0x5f39e0,_[_0xae13('0x66')](_0xae13('0x75')));}if(!fs['existsSync'](_0x2e936c)){throw new db[(_0xae13('0x70'))][(_0xae13('0x6a'))](_0xae13('0x6b'));}return _0x1ae768[_0xae13('0x6c')](_0x2e936c);}})[_0xae13('0x49')](handleError(_0x1ae768,null));}; \ No newline at end of file +var _0x11ea=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','count','offset','status','set','Content-Range','json','apply','save','update','then','stack','name','send','index','Setting','rawAttributes','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','where','type','key','VIRTUAL','merge','options','includeAll','rows','intersection','include','find','body','get','readFileSync','join','root','server/files/templates/turn.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','file','filename','logo','params','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','loginLogo','preferred','defaultLogo','defaultLoginLogo','existsSync','toLower','default_logo.png','upperFirst','Sequelize','ValidationError','Logo\x20not\x20found','getLicense','defaultPreferred','default','download','gdpr','addPreferred','custom','default_preferred.png','eml-format','rimraf'];(function(_0x15c65b,_0x506df3){var _0x256424=function(_0x15b381){while(--_0x15b381){_0x15c65b['push'](_0x15c65b['shift']());}};_0x256424(++_0x506df3);}(_0x11ea,0x77));var _0xa11e=function(_0x51bff7,_0xe0cc0d){_0x51bff7=_0x51bff7-0x0;var _0x11c59d=_0x11ea[_0x51bff7];return _0x11c59d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa11e('0x0'));var rimraf=require(_0xa11e('0x1'));var zipdir=require(_0xa11e('0x2'));var jsonpatch=require(_0xa11e('0x3'));var rp=require(_0xa11e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa11e('0x5'));var util=require(_0xa11e('0x6'));var path=require(_0xa11e('0x7'));var sox=require(_0xa11e('0x8'));var csv=require(_0xa11e('0x9'));var ejs=require(_0xa11e('0xa'));var fs=require('fs');var _=require(_0xa11e('0xb'));var squel=require(_0xa11e('0xc'));var crypto=require(_0xa11e('0xd'));var jsforce=require(_0xa11e('0xe'));var deskjs=require(_0xa11e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa11e('0x10'));var Papa=require(_0xa11e('0x11'));var Redis=require(_0xa11e('0x12'));var authService=require(_0xa11e('0x13'));var qs=require(_0xa11e('0x14'));var hardwareService=require(_0xa11e('0x15'));var logger=require(_0xa11e('0x16'))('api');var utils=require(_0xa11e('0x17'));var config=require(_0xa11e('0x18'));var db=require(_0xa11e('0x19'))['db'];var jayson=require(_0xa11e('0x1a'));var client=jayson['client'][_0xa11e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x22dd35,_0x1ad97e,_0x11e10d){if(_0x11e10d){var _0x4a80c4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a80c4[_0xa11e('0x1c')](_0x1ad97e)){return _0x22dd35;}else{throw new Error(_0xa11e('0x1d'));}}else{return _0x22dd35;}}function respondWithRpcPromise(_0x13fc3c,_0x249685,_0x20f40c,_0x4f3b37){return new BPromise(function(_0x49f0ca,_0x38335d){var _0x32d2bf=_0x4f3b37||client;return _0x32d2bf['request'](_0x13fc3c,_0x20f40c)['then'](function(_0x400582){logger[_0xa11e('0x1e')](_0xa11e('0x1f'),_0x249685,_0xa11e('0x20'));logger['debug'](_0xa11e('0x21'),_0x249685,_0xa11e('0x20'),JSON[_0xa11e('0x22')](_0x400582));if(_0x400582['error']){if(_0x400582[_0xa11e('0x23')][_0xa11e('0x24')]===0x1f4){logger[_0xa11e('0x23')](_0xa11e('0x1f'),_0x249685,_0x400582[_0xa11e('0x23')][_0xa11e('0x25')]);return _0x38335d(_0x400582[_0xa11e('0x23')][_0xa11e('0x25')]);}logger[_0xa11e('0x23')](_0xa11e('0x1f'),_0x249685,_0x400582['error'][_0xa11e('0x25')]);return _0x49f0ca(_0x400582[_0xa11e('0x23')][_0xa11e('0x25')]);}else{logger[_0xa11e('0x1e')](_0xa11e('0x1f'),_0x249685,_0xa11e('0x20'));_0x49f0ca(_0x400582[_0xa11e('0x26')][_0xa11e('0x25')]);}})[_0xa11e('0x27')](function(_0x1eba56){logger[_0xa11e('0x23')](_0xa11e('0x1f'),_0x249685,_0x1eba56);_0x38335d(_0x1eba56);});});}function respondWithStatusCode(_0x5ca940,_0x415024){_0x415024=_0x415024||0xcc;return function(_0x247149){if(_0x247149){return _0x5ca940[_0xa11e('0x28')](_0x415024);}return _0x5ca940['status'](_0x415024)[_0xa11e('0x29')]();};}function respondWithResult(_0x13e793,_0x574706){_0x574706=_0x574706||0xc8;return function(_0x1a1a04){if(_0x1a1a04){return _0x13e793['status'](_0x574706)['json'](_0x1a1a04);}};}function respondWithFilteredResult(_0x1f68fd,_0x5631e8){return function(_0x16e205){if(_0x16e205){var _0x5613e8=_0x16e205[_0xa11e('0x2a')],_0x9bb04b=_0x5631e8[_0xa11e('0x2b')],_0x3c48e7=_0x5631e8['offset']+_0x5631e8['limit'],_0x5d84b7;if(_0x3c48e7>=_0x5613e8){_0x3c48e7=_0x5613e8;_0x5d84b7=0xc8;}else{_0x5d84b7=0xce;}_0x1f68fd[_0xa11e('0x2c')](_0x5d84b7);return _0x1f68fd[_0xa11e('0x2d')](_0xa11e('0x2e'),_0x9bb04b+'-'+_0x3c48e7+'/'+_0x5613e8)[_0xa11e('0x2f')](_0x16e205);}return null;};}function patchUpdates(_0x43f179){return function(_0x5235f8){try{jsonpatch[_0xa11e('0x30')](_0x5235f8,_0x43f179,!![]);}catch(_0x47174c){return BPromise['reject'](_0x47174c);}return _0x5235f8[_0xa11e('0x31')]();};}function saveUpdates(_0x528bb6,_0x3e9d19){return function(_0x457a81){if(_0x457a81){return _0x457a81[_0xa11e('0x32')](_0x528bb6)['then'](function(_0x4a0a0d){return _0x4a0a0d;});}return null;};}function removeEntity(_0x2cc36b,_0x1069e8){return function(_0x18e81e){if(_0x18e81e){return _0x18e81e['destroy']()[_0xa11e('0x33')](function(){_0x2cc36b[_0xa11e('0x2c')](0xcc)[_0xa11e('0x29')]();});}};}function handleEntityNotFound(_0x2f4c25,_0x656573){return function(_0x45e24b){if(!_0x45e24b){_0x2f4c25['sendStatus'](0x194);}return _0x45e24b;};}function handleError(_0x5d513e,_0x5a5b06){_0x5a5b06=_0x5a5b06||0x1f4;return function(_0x59cdc2){logger[_0xa11e('0x23')](_0x59cdc2[_0xa11e('0x34')]);if(_0x59cdc2[_0xa11e('0x35')]){delete _0x59cdc2[_0xa11e('0x35')];}_0x5d513e[_0xa11e('0x2c')](_0x5a5b06)[_0xa11e('0x36')](_0x59cdc2);};}exports[_0xa11e('0x37')]=function(_0x2c4d1b,_0x32bc04){var _0x541bc8={},_0x5579c9={},_0x581797={'count':0x0,'rows':[]};var _0x17239c=db[_0xa11e('0x38')][_0xa11e('0x39')];_0x5579c9[_0xa11e('0x3a')]=_['keys'](_0x17239c);_0x5579c9[_0xa11e('0x3b')]=_[_0xa11e('0x3c')](_0x2c4d1b[_0xa11e('0x3b')]);_0x5579c9['filters']=_['intersection'](_0x5579c9[_0xa11e('0x3a')],_0x5579c9[_0xa11e('0x3b')]);_0x541bc8['attributes']=_['intersection'](_0x5579c9['model'],qs['fields'](_0x2c4d1b[_0xa11e('0x3b')][_0xa11e('0x3d')]));_0x541bc8[_0xa11e('0x3e')]=_0x541bc8[_0xa11e('0x3e')][_0xa11e('0x3f')]?_0x541bc8[_0xa11e('0x3e')]:_0x5579c9[_0xa11e('0x3a')];if(!_0x2c4d1b[_0xa11e('0x3b')][_0xa11e('0x40')](_0xa11e('0x41'))){_0x541bc8['limit']=qs[_0xa11e('0x42')](_0x2c4d1b['query'][_0xa11e('0x42')]);_0x541bc8[_0xa11e('0x2b')]=qs['offset'](_0x2c4d1b[_0xa11e('0x3b')][_0xa11e('0x2b')]);}_0x541bc8['order']=qs[_0xa11e('0x43')](_0x2c4d1b[_0xa11e('0x3b')][_0xa11e('0x43')]);_0x541bc8['where']=qs[_0xa11e('0x44')](_[_0xa11e('0x45')](_0x2c4d1b['query'],_0x5579c9[_0xa11e('0x44')]));if(_0x2c4d1b[_0xa11e('0x3b')]['filter']){_0x541bc8[_0xa11e('0x46')]=_['merge'](_0x541bc8[_0xa11e('0x46')],{'$or':_['map'](_0x17239c,function(_0x1d0d15){if(_0x1d0d15[_0xa11e('0x47')][_0xa11e('0x48')]!==_0xa11e('0x49')){var _0x234ded={};_0x234ded[_0x1d0d15['field']]={'$like':'%'+_0x2c4d1b[_0xa11e('0x3b')]['filter']+'%'};return _0x234ded;}})});}_0x541bc8=_[_0xa11e('0x4a')]({},_0x541bc8,_0x2c4d1b[_0xa11e('0x4b')]);var _0x5834a6={'where':_0x541bc8['where']};return db[_0xa11e('0x38')][_0xa11e('0x2a')](_0x5834a6)[_0xa11e('0x33')](function(_0x4c187e){_0x581797[_0xa11e('0x2a')]=_0x4c187e;if(_0x2c4d1b[_0xa11e('0x3b')][_0xa11e('0x4c')]){_0x541bc8['include']=[{'all':!![]}];}return db[_0xa11e('0x38')]['findAll'](_0x541bc8);})[_0xa11e('0x33')](function(_0x429287){_0x581797[_0xa11e('0x4d')]=_0x429287;return _0x581797;})['then'](respondWithFilteredResult(_0x32bc04,_0x541bc8))[_0xa11e('0x27')](handleError(_0x32bc04,null));};exports['show']=function(_0x60360e,_0x5e3bc2){var _0xea784={'raw':![],'where':{'id':_0x60360e['params']['id']}},_0x4754ad={};_0x4754ad[_0xa11e('0x3a')]=_[_0xa11e('0x3c')](db[_0xa11e('0x38')][_0xa11e('0x39')]);_0x4754ad[_0xa11e('0x3b')]=_[_0xa11e('0x3c')](_0x60360e['query']);_0x4754ad['filters']=_[_0xa11e('0x4e')](_0x4754ad[_0xa11e('0x3a')],_0x4754ad[_0xa11e('0x3b')]);_0xea784['attributes']=_[_0xa11e('0x4e')](_0x4754ad[_0xa11e('0x3a')],qs[_0xa11e('0x3d')](_0x60360e['query'][_0xa11e('0x3d')]));_0xea784[_0xa11e('0x3e')]=_0xea784['attributes'][_0xa11e('0x3f')]?_0xea784[_0xa11e('0x3e')]:_0x4754ad[_0xa11e('0x3a')];if(_0x60360e[_0xa11e('0x3b')][_0xa11e('0x4c')]){_0xea784[_0xa11e('0x4f')]=[{'all':!![]}];}_0xea784=_[_0xa11e('0x4a')]({},_0xea784,_0x60360e['options']);return db[_0xa11e('0x38')][_0xa11e('0x50')](_0xea784)[_0xa11e('0x33')](handleEntityNotFound(_0x5e3bc2,null))[_0xa11e('0x33')](respondWithResult(_0x5e3bc2,null))[_0xa11e('0x27')](handleError(_0x5e3bc2,null));};exports[_0xa11e('0x32')]=function(_0x18008f,_0x57d000,_0x27ee49){var _0x13667f;return db[_0xa11e('0x38')][_0xa11e('0x50')]({'where':{'id':_0x18008f['params']['id']}})[_0xa11e('0x33')](handleEntityNotFound(_0x57d000,null))[_0xa11e('0x33')](saveUpdates(_0x18008f[_0xa11e('0x51')],null))['then'](function(_0x144e4e){if(_0x144e4e){_0x13667f=_0x144e4e[_0xa11e('0x52')]({'plain':!![]});var _0x222fd5=fs[_0xa11e('0x53')](path['join'](config['root'],'server/files/templates/stun.ejs'),'utf8');var _0x163fd2=ejs['render'](_0x222fd5,_0x13667f);var _0x5d14ea=fs['readFileSync'](path[_0xa11e('0x54')](config[_0xa11e('0x55')],_0xa11e('0x56')),_0xa11e('0x57'));var _0x12dcaa=ejs['render'](_0x5d14ea,_0x13667f);fs[_0xa11e('0x58')](_0xa11e('0x59'),_0x163fd2);fs[_0xa11e('0x58')](_0xa11e('0x5a'),_0x12dcaa);return respondWithRpcPromise(_0xa11e('0x5b'),'update',{'module':_0xa11e('0x5c')});}})['then'](function(){return respondWithRpcPromise(_0xa11e('0x5b'),_0xa11e('0x32'),{'module':_0xa11e('0x5d')});})[_0xa11e('0x33')](function(){return _0x13667f||null;})[_0xa11e('0x33')](respondWithResult(_0x57d000,null))[_0xa11e('0x27')](handleError(_0x57d000,null));};exports['addLogo']=function(_0x49c4e6,_0x42925a,_0x5c0a4a){if(_0x49c4e6[_0xa11e('0x5e')]&&_0x49c4e6[_0xa11e('0x5e')][_0xa11e('0x5f')]){_0x49c4e6[_0xa11e('0x51')][_0xa11e('0x60')]=_0x49c4e6['file']['filename'];}return db[_0xa11e('0x38')][_0xa11e('0x50')]({'where':{'id':_0x49c4e6[_0xa11e('0x61')]['id']}})[_0xa11e('0x33')](handleEntityNotFound(_0x42925a,null))[_0xa11e('0x33')](saveUpdates(_0x49c4e6[_0xa11e('0x51')],null))['then'](respondWithResult(_0x42925a,null))[_0xa11e('0x27')](handleError(_0x42925a,null));};exports[_0xa11e('0x62')]=function(_0x47c7c7,_0x56c068,_0x114ae4){if(_0x47c7c7[_0xa11e('0x5e')]&&_0x47c7c7[_0xa11e('0x5e')][_0xa11e('0x5f')]){_0x47c7c7[_0xa11e('0x51')]['loginLogo']=_0x47c7c7[_0xa11e('0x5e')][_0xa11e('0x5f')];}return db[_0xa11e('0x38')]['find']({'where':{'id':_0x47c7c7[_0xa11e('0x61')]['id']}})[_0xa11e('0x33')](handleEntityNotFound(_0x56c068,null))[_0xa11e('0x33')](saveUpdates(_0x47c7c7[_0xa11e('0x51')],null))[_0xa11e('0x33')](respondWithResult(_0x56c068,null))[_0xa11e('0x27')](handleError(_0x56c068,null));};var utilLicense=require(_0xa11e('0x63'));exports[_0xa11e('0x64')]=function(_0x231dbf,_0x2b2871,_0x187217){var _0x506e05=_0xa11e('0x65');var _0x5d2982={'custom':![]};return utilLicense['getLicense']()[_0xa11e('0x33')](function(_0xe02774){if(_0xe02774){_0x5d2982=_0xe02774;}return db[_0xa11e('0x38')][_0xa11e('0x50')]({'where':{'id':_0x231dbf[_0xa11e('0x61')]['id']},'attributes':[_0xa11e('0x60'),_0xa11e('0x66'),_0xa11e('0x67'),_0xa11e('0x68'),_0xa11e('0x69'),'defaultPreferred'],'raw':!![]});})['then'](handleEntityNotFound(_0x2b2871,null))[_0xa11e('0x33')](function(_0x49b2c2){if(_0x49b2c2){var _0x57c8a0=_0x49b2c2[_0xa11e('0x60')]&&fs[_0xa11e('0x6a')](path['join'](config[_0xa11e('0x55')],_0x506e05,_[_0xa11e('0x6b')](_0x49b2c2[_0xa11e('0x60')])))?path[_0xa11e('0x54')](config[_0xa11e('0x55')],_0x506e05,_[_0xa11e('0x6b')](_0x49b2c2[_0xa11e('0x60')])):path[_0xa11e('0x54')](config['root'],_0x506e05,_[_0xa11e('0x6b')](_0xa11e('0x6c')));var _0x5acce7='default'+_[_0xa11e('0x6d')]('logo');if(_0x49b2c2[_0x5acce7]||!_0x5d2982['custom']){_0x57c8a0=path['join'](config[_0xa11e('0x55')],_0x506e05,_[_0xa11e('0x6b')]('default_logo.png'));}if(!fs[_0xa11e('0x6a')](_0x57c8a0)){throw new db[(_0xa11e('0x6e'))][(_0xa11e('0x6f'))](_0xa11e('0x70'));}return _0x2b2871['download'](_0x57c8a0);}})[_0xa11e('0x27')](handleError(_0x2b2871,null));};var utilLicense=require(_0xa11e('0x63'));exports['getLogoLogin']=function(_0x411368,_0x1f39b7,_0x543ffd){var _0xb8fe47=_0xa11e('0x65');var _0x2dee71={'custom':![]};return utilLicense[_0xa11e('0x71')]()[_0xa11e('0x33')](function(_0x26f97b){if(_0x26f97b){_0x2dee71=_0x26f97b;}return db[_0xa11e('0x38')][_0xa11e('0x50')]({'where':{'id':_0x411368[_0xa11e('0x61')]['id']},'attributes':[_0xa11e('0x60'),_0xa11e('0x66'),'preferred',_0xa11e('0x68'),'defaultLoginLogo',_0xa11e('0x72')],'raw':!![]});})['then'](handleEntityNotFound(_0x1f39b7,null))[_0xa11e('0x33')](function(_0x1b12c5){if(_0x1b12c5){var _0x16ad32=_0x1b12c5[_0xa11e('0x66')]&&fs[_0xa11e('0x6a')](path[_0xa11e('0x54')](config[_0xa11e('0x55')],_0xb8fe47,_[_0xa11e('0x6b')](_0x1b12c5[_0xa11e('0x66')])))?path[_0xa11e('0x54')](config['root'],_0xb8fe47,_['toLower'](_0x1b12c5['loginLogo'])):path[_0xa11e('0x54')](config[_0xa11e('0x55')],_0xb8fe47,_['toLower']('default_loginLogo.png'));var _0x552e8a=_0xa11e('0x73')+_['upperFirst'](_0xa11e('0x66'));if(_0x1b12c5[_0x552e8a]||!_0x2dee71['custom']){_0x16ad32=path['join'](config[_0xa11e('0x55')],_0xb8fe47,_['toLower']('default_loginLogo.png'));}if(!fs['existsSync'](_0x16ad32)){throw new db[(_0xa11e('0x6e'))][(_0xa11e('0x6f'))](_0xa11e('0x70'));}return _0x1f39b7[_0xa11e('0x74')](_0x16ad32);}})[_0xa11e('0x27')](handleError(_0x1f39b7,null));};exports[_0xa11e('0x75')]=function(_0x31b520,_0x24ba27){return db[_0xa11e('0x38')][_0xa11e('0x50')]({'where':{'id':_0x31b520[_0xa11e('0x61')]['id']},'attributes':['securePassword']})[_0xa11e('0x33')](respondWithResult(_0x24ba27,null))[_0xa11e('0x27')](handleError(_0x24ba27,null));};exports[_0xa11e('0x76')]=function(_0x31e5fb,_0x404074,_0x36f5e2){if(_0x31e5fb[_0xa11e('0x5e')]&&_0x31e5fb['file']['filename']){_0x31e5fb[_0xa11e('0x51')][_0xa11e('0x67')]=_0x31e5fb[_0xa11e('0x5e')][_0xa11e('0x5f')];}return db[_0xa11e('0x38')][_0xa11e('0x50')]({'where':{'id':_0x31e5fb[_0xa11e('0x61')]['id']}})[_0xa11e('0x33')](handleEntityNotFound(_0x404074,null))[_0xa11e('0x33')](saveUpdates(_0x31e5fb[_0xa11e('0x51')],null))['then'](respondWithResult(_0x404074,null))[_0xa11e('0x27')](handleError(_0x404074,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x5da5d5,_0x188092,_0x2b93a9){var _0x4f7ab1=_0xa11e('0x65');var _0x150006={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5a2e38){if(_0x5a2e38){_0x150006=_0x5a2e38;}return db[_0xa11e('0x38')]['find']({'where':{'id':_0x5da5d5[_0xa11e('0x61')]['id']},'attributes':[_0xa11e('0x60'),_0xa11e('0x66'),_0xa11e('0x67'),_0xa11e('0x68'),_0xa11e('0x69'),_0xa11e('0x72')],'raw':!![]});})[_0xa11e('0x33')](handleEntityNotFound(_0x188092,null))[_0xa11e('0x33')](function(_0x208306){if(_0x208306){var _0x5da95d=_0x208306[_0xa11e('0x67')]&&fs[_0xa11e('0x6a')](path[_0xa11e('0x54')](config['root'],_0x4f7ab1,_[_0xa11e('0x6b')](_0x208306[_0xa11e('0x67')])))?path[_0xa11e('0x54')](config[_0xa11e('0x55')],_0x4f7ab1,_[_0xa11e('0x6b')](_0x208306['preferred'])):path[_0xa11e('0x54')](config[_0xa11e('0x55')],_0x4f7ab1,_[_0xa11e('0x6b')]('default_preferred.png'));var _0x21bc07=_0xa11e('0x73')+_['upperFirst'](_0xa11e('0x67'));if(_0x208306[_0x21bc07]||!_0x150006[_0xa11e('0x77')]||!_0x150006[_0xa11e('0x67')]){_0x5da95d=path['join'](config['root'],_0x4f7ab1,_['toLower'](_0xa11e('0x78')));}if(!fs['existsSync'](_0x5da95d)){throw new db[(_0xa11e('0x6e'))][(_0xa11e('0x6f'))](_0xa11e('0x70'));}return _0x188092['download'](_0x5da95d);}})[_0xa11e('0x27')](handleError(_0x188092,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ba63aa6..399f273 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 _0x0767=['bluebird','request-promise','rimraf','../../config/environment','exports','Setting','settings','lodash','util','api','moment'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x0767,0x1ca));var _0x7076=function(_0xb3fad2,_0x3dc781){_0xb3fad2=_0xb3fad2-0x0;var _0x2df922=_0x0767[_0xb3fad2];return _0x2df922;};'use strict';var _=require(_0x7076('0x0'));var util=require(_0x7076('0x1'));var logger=require('../../config/logger')(_0x7076('0x2'));var moment=require(_0x7076('0x3'));var BPromise=require(_0x7076('0x4'));var rp=require(_0x7076('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7076('0x6'));var config=require(_0x7076('0x7'));var attributes=require('./setting.attributes');module[_0x7076('0x8')]=function(_0x25fd04,_0x569e9c){return _0x25fd04['define'](_0x7076('0x9'),attributes,{'tableName':_0x7076('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00c5=['api','moment','bluebird','path','../../config/environment','./setting.attributes','define','Setting','lodash'];(function(_0x5a73a6,_0x23d43f){var _0x3a41ce=function(_0x2ab84d){while(--_0x2ab84d){_0x5a73a6['push'](_0x5a73a6['shift']());}};_0x3a41ce(++_0x23d43f);}(_0x00c5,0x1a6));var _0x500c=function(_0x5c79b3,_0x3c4999){_0x5c79b3=_0x5c79b3-0x0;var _0x2d5ac8=_0x00c5[_0x5c79b3];return _0x2d5ac8;};'use strict';var _=require(_0x500c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x500c('0x1'));var moment=require(_0x500c('0x2'));var BPromise=require(_0x500c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x500c('0x4'));var rimraf=require('rimraf');var config=require(_0x500c('0x5'));var attributes=require(_0x500c('0x6'));module['exports']=function(_0x1773fc,_0x3830bc){return _0x1773fc[_0x500c('0x7')](_0x500c('0x8'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index ae8ec9b..788df2b 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 _0x805b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x805b,0x1a1));var _0xb805=function(_0x1f9e6c,_0x5a3ecd){_0x1f9e6c=_0x1f9e6c-0x0;var _0x51b18e=_0x805b[_0x1f9e6c];return _0x51b18e;};'use strict';var _=require(_0xb805('0x0'));var util=require(_0xb805('0x1'));var moment=require(_0xb805('0x2'));var BPromise=require(_0xb805('0x3'));var rs=require(_0xb805('0x4'));var fs=require('fs');var Redis=require(_0xb805('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb805('0x6'));var logger=require(_0xb805('0x7'))(_0xb805('0x8'));var config=require(_0xb805('0x9'));var jayson=require(_0xb805('0xa'));var client=jayson[_0xb805('0xb')][_0xb805('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83990f,_0x509614,_0x24721e){return new BPromise(function(_0x1bf8ba,_0x4c9d37){return client[_0xb805('0xd')](_0x83990f,_0x24721e)[_0xb805('0xe')](function(_0x3cfc96){logger['info'](_0xb805('0xf'),_0x509614,_0xb805('0x10'));logger[_0xb805('0x11')](_0xb805('0x12'),_0x509614,_0xb805('0x10'),JSON[_0xb805('0x13')](_0x3cfc96));if(_0x3cfc96[_0xb805('0x14')]){if(_0x3cfc96[_0xb805('0x14')][_0xb805('0x15')]===0x1f4){logger[_0xb805('0x14')](_0xb805('0xf'),_0x509614,_0x3cfc96[_0xb805('0x14')][_0xb805('0x16')]);return _0x4c9d37(_0x3cfc96[_0xb805('0x14')][_0xb805('0x16')]);}logger['error'](_0xb805('0xf'),_0x509614,_0x3cfc96[_0xb805('0x14')][_0xb805('0x16')]);return _0x1bf8ba(_0x3cfc96[_0xb805('0x14')][_0xb805('0x16')]);}else{logger[_0xb805('0x17')](_0xb805('0xf'),_0x509614,_0xb805('0x10'));_0x1bf8ba(_0x3cfc96[_0xb805('0x18')]['message']);}})[_0xb805('0x19')](function(_0x19ce4a){logger[_0xb805('0x14')]('Setting,\x20%s,\x20%s',_0x509614,_0x19ce4a);_0x4c9d37(_0x19ce4a);});});} \ No newline at end of file +var _0x6017=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6017,0x12d));var _0x7601=function(_0x557090,_0x46c116){_0x557090=_0x557090-0x0;var _0x3e0fa1=_0x6017[_0x557090];return _0x3e0fa1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7601('0x0'));var BPromise=require(_0x7601('0x1'));var rs=require(_0x7601('0x2'));var fs=require('fs');var Redis=require(_0x7601('0x3'));var db=require(_0x7601('0x4'))['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2d4a,_0x6cc743,_0x4ea5c6){return new BPromise(function(_0x4b6403,_0x23c8e8){return client[_0x7601('0x8')](_0x5b2d4a,_0x4ea5c6)[_0x7601('0x9')](function(_0x1bdd44){logger[_0x7601('0xa')](_0x7601('0xb'),_0x6cc743,_0x7601('0xc'));logger['debug'](_0x7601('0xd'),_0x6cc743,_0x7601('0xc'),JSON[_0x7601('0xe')](_0x1bdd44));if(_0x1bdd44['error']){if(_0x1bdd44[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x6cc743,_0x1bdd44['error'][_0x7601('0x11')]);return _0x23c8e8(_0x1bdd44[_0x7601('0xf')][_0x7601('0x11')]);}logger[_0x7601('0xf')](_0x7601('0xb'),_0x6cc743,_0x1bdd44[_0x7601('0xf')][_0x7601('0x11')]);return _0x4b6403(_0x1bdd44[_0x7601('0xf')][_0x7601('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x6cc743,'request\x20sent');_0x4b6403(_0x1bdd44[_0x7601('0x12')][_0x7601('0x11')]);}})[_0x7601('0x13')](function(_0x52f32b){logger['error']('Setting,\x20%s,\x20%s',_0x6cc743,_0x52f32b);_0x23c8e8(_0x52f32b);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d5e49ba..fc36d07 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 _0xaf37=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','addDisposition','/:id/notify','addApplications','send','status','addAgents','put','update','delete','destroy','removeAnswers','util','path','connect-timeout','Router','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x431127,_0x3296bd){var _0x24ab89=function(_0x213bf0){while(--_0x213bf0){_0x431127['push'](_0x431127['shift']());}};_0x24ab89(++_0x3296bd);}(_0xaf37,0xa1));var _0x7af3=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xaf37[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require('multer');var util=require(_0x7af3('0x0'));var path=require(_0x7af3('0x1'));var timeout=require(_0x7af3('0x2'));var express=require('express');var router=express[_0x7af3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7af3('0x4'));var config=require('../../config/environment');var controller=require(_0x7af3('0x5'));router[_0x7af3('0x6')]('/',auth[_0x7af3('0x7')](),controller['index']);router[_0x7af3('0x6')](_0x7af3('0x8'),auth[_0x7af3('0x7')](),controller[_0x7af3('0x9')]);router[_0x7af3('0x6')](_0x7af3('0xa'),auth[_0x7af3('0x7')](),controller[_0x7af3('0xb')]);router[_0x7af3('0x6')](_0x7af3('0xc'),auth[_0x7af3('0x7')](),controller[_0x7af3('0xd')]);router[_0x7af3('0x6')](_0x7af3('0xe'),auth[_0x7af3('0x7')](),controller[_0x7af3('0xf')]);router[_0x7af3('0x6')]('/:id/applications',auth[_0x7af3('0x7')](),controller[_0x7af3('0x10')]);router[_0x7af3('0x6')](_0x7af3('0x11'),auth['isAuthenticated'](),controller[_0x7af3('0x12')]);router[_0x7af3('0x6')](_0x7af3('0x13'),controller[_0x7af3('0x14')]);router['get'](_0x7af3('0x15'),auth[_0x7af3('0x7')](),controller['getAgents']);router[_0x7af3('0x16')]('/',auth[_0x7af3('0x7')](),controller[_0x7af3('0x17')]);router[_0x7af3('0x16')](_0x7af3('0xc'),auth['isAuthenticated'](),controller[_0x7af3('0x18')]);router[_0x7af3('0x16')](_0x7af3('0xe'),auth[_0x7af3('0x7')](),controller['addAnswer']);router[_0x7af3('0x16')](_0x7af3('0x19'),controller['notify']);router[_0x7af3('0x16')]('/:id/applications',auth[_0x7af3('0x7')](),controller[_0x7af3('0x1a')]);router['post']('/:id/send',auth[_0x7af3('0x7')](),controller[_0x7af3('0x1b')]);router[_0x7af3('0x16')](_0x7af3('0x13'),controller[_0x7af3('0x1c')]);router[_0x7af3('0x16')](_0x7af3('0x15'),auth[_0x7af3('0x7')](),controller[_0x7af3('0x1d')]);router[_0x7af3('0x1e')]('/:id',auth[_0x7af3('0x7')](),controller[_0x7af3('0x1f')]);router[_0x7af3('0x20')](_0x7af3('0xa'),auth[_0x7af3('0x7')](),controller[_0x7af3('0x21')]);router[_0x7af3('0x20')](_0x7af3('0xc'),auth[_0x7af3('0x7')](),controller['removeDispositions']);router[_0x7af3('0x20')](_0x7af3('0xe'),auth[_0x7af3('0x7')](),controller[_0x7af3('0x22')]);router[_0x7af3('0x20')]('/:id/users',auth[_0x7af3('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf1f4=['getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','/:id','/:id/dispositions'];(function(_0x57baae,_0x4fbee0){var _0x33dde6=function(_0xb00c7b){while(--_0xb00c7b){_0x57baae['push'](_0x57baae['shift']());}};_0x33dde6(++_0x4fbee0);}(_0xf1f4,0x13e));var _0x4f1f=function(_0x3efb68,_0x268c1f){_0x3efb68=_0x3efb68-0x0;var _0x348320=_0xf1f4[_0x3efb68];return _0x348320;};'use strict';var multer=require(_0x4f1f('0x0'));var util=require(_0x4f1f('0x1'));var path=require(_0x4f1f('0x2'));var timeout=require(_0x4f1f('0x3'));var express=require(_0x4f1f('0x4'));var router=express[_0x4f1f('0x5')]();var auth=require(_0x4f1f('0x6'));var interaction=require(_0x4f1f('0x7'));var config=require(_0x4f1f('0x8'));var controller=require(_0x4f1f('0x9'));router[_0x4f1f('0xa')]('/',auth[_0x4f1f('0xb')](),controller['index']);router['get'](_0x4f1f('0xc'),auth[_0x4f1f('0xb')](),controller['describe']);router[_0x4f1f('0xa')](_0x4f1f('0xd'),auth[_0x4f1f('0xb')](),controller['show']);router[_0x4f1f('0xa')](_0x4f1f('0xe'),auth['isAuthenticated'](),controller[_0x4f1f('0xf')]);router[_0x4f1f('0xa')](_0x4f1f('0x10'),auth[_0x4f1f('0xb')](),controller['getAnswers']);router[_0x4f1f('0xa')](_0x4f1f('0x11'),auth['isAuthenticated'](),controller[_0x4f1f('0x12')]);router[_0x4f1f('0xa')](_0x4f1f('0x13'),auth['isAuthenticated'](),controller[_0x4f1f('0x14')]);router[_0x4f1f('0xa')](_0x4f1f('0x15'),controller['statusGet']);router['get'](_0x4f1f('0x16'),auth[_0x4f1f('0xb')](),controller['getAgents']);router[_0x4f1f('0x17')]('/',auth[_0x4f1f('0xb')](),controller[_0x4f1f('0x18')]);router[_0x4f1f('0x17')]('/:id/dispositions',auth[_0x4f1f('0xb')](),controller['addDisposition']);router[_0x4f1f('0x17')](_0x4f1f('0x10'),auth[_0x4f1f('0xb')](),controller[_0x4f1f('0x19')]);router[_0x4f1f('0x17')](_0x4f1f('0x1a'),controller[_0x4f1f('0x1b')]);router[_0x4f1f('0x17')](_0x4f1f('0x11'),auth[_0x4f1f('0xb')](),controller['addApplications']);router[_0x4f1f('0x17')](_0x4f1f('0x1c'),auth['isAuthenticated'](),controller[_0x4f1f('0x1d')]);router[_0x4f1f('0x17')](_0x4f1f('0x15'),controller[_0x4f1f('0x1e')]);router['post'](_0x4f1f('0x16'),auth[_0x4f1f('0xb')](),controller[_0x4f1f('0x1f')]);router[_0x4f1f('0x20')](_0x4f1f('0xd'),auth[_0x4f1f('0xb')](),controller[_0x4f1f('0x21')]);router[_0x4f1f('0x22')](_0x4f1f('0xd'),auth[_0x4f1f('0xb')](),controller['destroy']);router[_0x4f1f('0x22')](_0x4f1f('0xe'),auth['isAuthenticated'](),controller[_0x4f1f('0x23')]);router[_0x4f1f('0x22')](_0x4f1f('0x10'),auth[_0x4f1f('0xb')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x4f1f('0xb')](),controller['removeAgents']);module[_0x4f1f('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8f0cfa4..7a95e7e 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 _0xd642=['sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue'];(function(_0x2b9d46,_0x206d77){var _0x167537=function(_0x462c4c){while(--_0x462c4c){_0x2b9d46['push'](_0x2b9d46['shift']());}};_0x167537(++_0x206d77);}(_0xd642,0x90));var _0x2d64=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xd642[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x2d64('0x0'));var rs=require('randomstring');module[_0x2d64('0x1')]={'name':{'type':Sequelize[_0x2d64('0x2')],'unique':_0x2d64('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x2d64('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x2d64('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x2d64('0x2')],'defaultValue':function(){return rs[_0x2d64('0x4')]();}},'phone':{'type':Sequelize[_0x2d64('0x2')]},'type':{'type':Sequelize[_0x2d64('0x5')](_0x2d64('0x6'),_0x2d64('0x7'),'connectel',_0x2d64('0x8'),_0x2d64('0x9'),_0x2d64('0xa'),_0x2d64('0xb'),_0x2d64('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x2d64('0x2')]},'authId':{'type':Sequelize[_0x2d64('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2d64('0x2')]},'password':{'type':Sequelize[_0x2d64('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2d64('0x2')]},'deliveryReport':{'type':Sequelize[_0x2d64('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x2d64('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2d64('0xe')],'defaultValue':function(){return _0x2d64('0xf');}},'notificationSound':{'type':Sequelize[_0x2d64('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2d64('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2d64('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2d64('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d64('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d64('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2d64('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2d64('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x51f10e){if(!_0x51f10e)this[_0x2d64('0x11')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x51f10e);}}}; \ No newline at end of file +var _0x91bb=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','STRING','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1ce50d,_0x1a7b77){var _0x4028b2=function(_0x47331b){while(--_0x47331b){_0x1ce50d['push'](_0x1ce50d['shift']());}};_0x4028b2(++_0x1a7b77);}(_0x91bb,0x192));var _0xb91b=function(_0x4cb03b,_0x47d402){_0x4cb03b=_0x4cb03b-0x0;var _0x132ba4=_0x91bb[_0x4cb03b];return _0x132ba4;};'use strict';var Sequelize=require(_0xb91b('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb91b('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xb91b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb91b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xb91b('0x2')],'defaultValue':function(){return rs[_0xb91b('0x3')]();}},'phone':{'type':Sequelize[_0xb91b('0x2')]},'type':{'type':Sequelize[_0xb91b('0x4')](_0xb91b('0x5'),'skebby',_0xb91b('0x6'),_0xb91b('0x7'),_0xb91b('0x8'),_0xb91b('0x9'),_0xb91b('0xa'),_0xb91b('0xb'),_0xb91b('0xc'))},'accountSid':{'type':Sequelize[_0xb91b('0x2')]},'authId':{'type':Sequelize[_0xb91b('0x2')]},'authToken':{'type':Sequelize[_0xb91b('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xb91b('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xb91b('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xb91b('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb91b('0xe')],'defaultValue':function(){return _0xb91b('0xf');}},'notificationSound':{'type':Sequelize[_0xb91b('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb91b('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb91b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb91b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb91b('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb91b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb91b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb91b('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xb91b('0xd')],'defaultValue':![],'comment':_0xb91b('0x12'),'set':function(_0x2f5cc6){if(!_0x2f5cc6)this['setDataValue'](_0xb91b('0x13'),null);this['setDataValue'](_0xb91b('0x14'),_0x2f5cc6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ce3791a..644ab63 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 _0xc14c=['sendStatus','status','json','count','offset','limit','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','SmsAccount','keys','query','intersection','model','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','rows','params','Pause','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','findAll','removeAnswers','sms','SmsApplication','Applications','account','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','From','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','transaction','bulkCreate','priority','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','groupName','DELIVERED','clickatell','redif','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x1b3aee,_0x1215b2){var _0x3cfc35=function(_0x2cf93b){while(--_0x2cf93b){_0x1b3aee['push'](_0x1b3aee['shift']());}};_0x3cfc35(++_0x1215b2);}(_0xc14c,0xb6));var _0xcc14=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc14c[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xcc14('0x0'));var emlformat=require(_0xcc14('0x1'));var rimraf=require(_0xcc14('0x2'));var zipdir=require(_0xcc14('0x3'));var jsonpatch=require(_0xcc14('0x4'));var rp=require(_0xcc14('0x5'));var moment=require(_0xcc14('0x6'));var BPromise=require(_0xcc14('0x7'));var Mustache=require(_0xcc14('0x8'));var util=require('util');var path=require(_0xcc14('0x9'));var sox=require(_0xcc14('0xa'));var csv=require(_0xcc14('0xb'));var ejs=require(_0xcc14('0xc'));var fs=require('fs');var _=require(_0xcc14('0xd'));var squel=require(_0xcc14('0xe'));var crypto=require(_0xcc14('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcc14('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcc14('0x11'));var Papa=require(_0xcc14('0x12'));var Redis=require('ioredis');var authService=require(_0xcc14('0x13'));var qs=require(_0xcc14('0x14'));var hardwareService=require(_0xcc14('0x15'));var logger=require(_0xcc14('0x16'))(_0xcc14('0x17'));var utils=require(_0xcc14('0x18'));var config=require(_0xcc14('0x19'));var db=require(_0xcc14('0x1a'))['db'];config[_0xcc14('0x1b')]=_['defaults'](config['redis'],{'host':_0xcc14('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc14('0x1b')]));require('./smsAccount.socket')[_0xcc14('0x1d')](socket);var jayson=require(_0xcc14('0x1e'));var client=jayson['client'][_0xcc14('0x1f')]({'port':0x232c});function checkPasswordPattern(_0xff7d02,_0x2da21c,_0x549bc2){if(_0x549bc2){var _0x4ea747=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ea747[_0xcc14('0x20')](_0x2da21c)){return _0xff7d02;}else{throw new Error(_0xcc14('0x21'));}}else{return _0xff7d02;}}function respondWithRpcPromise(_0x3dbe0b,_0x175c29,_0x2669bf,_0x2b1b2e){return new BPromise(function(_0x3dd14d,_0x267eca){var _0x33fe20=_0x2b1b2e||client;return _0x33fe20['request'](_0x3dbe0b,_0x2669bf)['then'](function(_0x1c3ed5){logger[_0xcc14('0x22')](_0xcc14('0x23'),_0x175c29,'request\x20sent');logger[_0xcc14('0x24')](_0xcc14('0x25'),_0x175c29,_0xcc14('0x26'),JSON['stringify'](_0x1c3ed5));if(_0x1c3ed5[_0xcc14('0x27')]){if(_0x1c3ed5[_0xcc14('0x27')][_0xcc14('0x28')]===0x1f4){logger[_0xcc14('0x27')]('SmsAccount,\x20%s,\x20%s',_0x175c29,_0x1c3ed5[_0xcc14('0x27')][_0xcc14('0x29')]);return _0x267eca(_0x1c3ed5['error'][_0xcc14('0x29')]);}logger[_0xcc14('0x27')](_0xcc14('0x23'),_0x175c29,_0x1c3ed5[_0xcc14('0x27')][_0xcc14('0x29')]);return _0x3dd14d(_0x1c3ed5[_0xcc14('0x27')][_0xcc14('0x29')]);}else{logger[_0xcc14('0x22')](_0xcc14('0x23'),_0x175c29,_0xcc14('0x26'));_0x3dd14d(_0x1c3ed5[_0xcc14('0x2a')][_0xcc14('0x29')]);}})[_0xcc14('0x2b')](function(_0x215995){logger['error']('SmsAccount,\x20%s,\x20%s',_0x175c29,_0x215995);_0x267eca(_0x215995);});});}function respondWithStatusCode(_0x124b0c,_0x20cb83){_0x20cb83=_0x20cb83||0xcc;return function(_0x246fe6){if(_0x246fe6){return _0x124b0c[_0xcc14('0x2c')](_0x20cb83);}return _0x124b0c[_0xcc14('0x2d')](_0x20cb83)['end']();};}function respondWithResult(_0x8ba9c5,_0x28aad1){_0x28aad1=_0x28aad1||0xc8;return function(_0x2b38c5){if(_0x2b38c5){return _0x8ba9c5[_0xcc14('0x2d')](_0x28aad1)[_0xcc14('0x2e')](_0x2b38c5);}};}function respondWithFilteredResult(_0x56391d,_0x1c1e06){return function(_0x20e8d1){if(_0x20e8d1){var _0x3bc39a=_0x20e8d1[_0xcc14('0x2f')],_0x29c9e2=_0x1c1e06[_0xcc14('0x30')],_0x39f169=_0x1c1e06['offset']+_0x1c1e06[_0xcc14('0x31')],_0x2e032e;if(_0x39f169>=_0x3bc39a){_0x39f169=_0x3bc39a;_0x2e032e=0xc8;}else{_0x2e032e=0xce;}_0x56391d[_0xcc14('0x2d')](_0x2e032e);return _0x56391d['set']('Content-Range',_0x29c9e2+'-'+_0x39f169+'/'+_0x3bc39a)[_0xcc14('0x2e')](_0x20e8d1);}return null;};}function patchUpdates(_0x411e24){return function(_0x285e5d){try{jsonpatch['apply'](_0x285e5d,_0x411e24,!![]);}catch(_0x49aaa7){return BPromise[_0xcc14('0x32')](_0x49aaa7);}return _0x285e5d[_0xcc14('0x33')]();};}function saveUpdates(_0x54ab3d,_0x20593f){return function(_0x59cb63){if(_0x59cb63){return _0x59cb63[_0xcc14('0x34')](_0x54ab3d)[_0xcc14('0x35')](function(_0x2c5b9d){return _0x2c5b9d;});}return null;};}function removeEntity(_0x2eb4bc,_0x55024e){return function(_0x178d2e){if(_0x178d2e){return _0x178d2e[_0xcc14('0x36')]()[_0xcc14('0x35')](function(){var _0x3bcdae=_0x178d2e[_0xcc14('0x37')]({'plain':!![]});var _0x3d2fde=_0xcc14('0x38');return db[_0xcc14('0x39')][_0xcc14('0x36')]({'where':{'type':_0x3d2fde,'resourceId':_0x3bcdae['id']}})[_0xcc14('0x35')](function(){return _0x178d2e;});})['then'](function(){_0x2eb4bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x574cb9,_0x3b1381){return function(_0x423bb){if(!_0x423bb){_0x574cb9[_0xcc14('0x2c')](0x194);}return _0x423bb;};}function handleError(_0x2a6f0b,_0x5e79e0){_0x5e79e0=_0x5e79e0||0x1f4;return function(_0x560f4c){logger[_0xcc14('0x27')](_0x560f4c['stack']);if(_0x560f4c[_0xcc14('0x3a')]){delete _0x560f4c['name'];}_0x2a6f0b[_0xcc14('0x2d')](_0x5e79e0)[_0xcc14('0x3b')](_0x560f4c);};}exports[_0xcc14('0x3c')]=function(_0xcb3667,_0x1d4537){var _0x493f5a={'include':[{'model':db['Pause'],'as':_0xcc14('0x3d')}]},_0x552ca8={},_0x12b06c={'count':0x0,'rows':[]};var _0x5542ef=db[_0xcc14('0x3e')]['rawAttributes'];_0x552ca8['model']=_[_0xcc14('0x3f')](_0x5542ef);_0x552ca8[_0xcc14('0x40')]=_[_0xcc14('0x3f')](_0xcb3667[_0xcc14('0x40')]);_0x552ca8['filters']=_[_0xcc14('0x41')](_0x552ca8[_0xcc14('0x42')],_0x552ca8[_0xcc14('0x40')]);_0x493f5a['attributes']=_[_0xcc14('0x41')](_0x552ca8[_0xcc14('0x42')],qs[_0xcc14('0x43')](_0xcb3667['query'][_0xcc14('0x43')]));_0x493f5a[_0xcc14('0x44')]=_0x493f5a[_0xcc14('0x44')]['length']?_0x493f5a[_0xcc14('0x44')]:_0x552ca8[_0xcc14('0x42')];if(!_0xcb3667[_0xcc14('0x40')]['hasOwnProperty'](_0xcc14('0x45'))){_0x493f5a['limit']=qs[_0xcc14('0x31')](_0xcb3667[_0xcc14('0x40')][_0xcc14('0x31')]);_0x493f5a[_0xcc14('0x30')]=qs['offset'](_0xcb3667[_0xcc14('0x40')][_0xcc14('0x30')]);}_0x493f5a[_0xcc14('0x46')]=qs['sort'](_0xcb3667[_0xcc14('0x40')][_0xcc14('0x47')]);_0x493f5a[_0xcc14('0x48')]=qs[_0xcc14('0x49')](_[_0xcc14('0x4a')](_0xcb3667[_0xcc14('0x40')],_0x552ca8[_0xcc14('0x49')]));if(_0xcb3667[_0xcc14('0x40')][_0xcc14('0x4b')]){_0x493f5a[_0xcc14('0x48')]=_[_0xcc14('0x4c')](_0x493f5a[_0xcc14('0x48')],{'$or':_[_0xcc14('0x4d')](_0x5542ef,function(_0xf760fb){if(_0xf760fb[_0xcc14('0x4e')][_0xcc14('0x4f')]!==_0xcc14('0x50')){var _0x3d7fbc={};_0x3d7fbc[_0xf760fb[_0xcc14('0x51')]]={'$like':'%'+_0xcb3667[_0xcc14('0x40')][_0xcc14('0x4b')]+'%'};return _0x3d7fbc;}})});}_0x493f5a=_[_0xcc14('0x4c')]({},_0x493f5a,_0xcb3667[_0xcc14('0x52')]);var _0x5dae7f={'where':_0x493f5a[_0xcc14('0x48')]};return db[_0xcc14('0x3e')][_0xcc14('0x2f')](_0x5dae7f)[_0xcc14('0x35')](function(_0x53ce8f){_0x12b06c[_0xcc14('0x2f')]=_0x53ce8f;if(_0xcb3667['query'][_0xcc14('0x53')]){_0x493f5a['include']=[{'all':!![]}];}return db[_0xcc14('0x3e')]['findAll'](_0x493f5a);})['then'](function(_0x17ad94){_0x12b06c[_0xcc14('0x54')]=_0x17ad94;return _0x12b06c;})['then'](respondWithFilteredResult(_0x1d4537,_0x493f5a))[_0xcc14('0x2b')](handleError(_0x1d4537,null));};exports['show']=function(_0x54c6c8,_0x3c01a8){var _0x147ad3={'raw':![],'where':{'id':_0x54c6c8[_0xcc14('0x55')]['id']},'include':[{'model':db[_0xcc14('0x56')],'as':_0xcc14('0x3d')}]},_0x27725c={};_0x27725c[_0xcc14('0x42')]=_[_0xcc14('0x3f')](db[_0xcc14('0x3e')][_0xcc14('0x57')]);_0x27725c[_0xcc14('0x40')]=_[_0xcc14('0x3f')](_0x54c6c8['query']);_0x27725c['filters']=_[_0xcc14('0x41')](_0x27725c['model'],_0x27725c[_0xcc14('0x40')]);_0x147ad3[_0xcc14('0x44')]=_[_0xcc14('0x41')](_0x27725c[_0xcc14('0x42')],qs[_0xcc14('0x43')](_0x54c6c8[_0xcc14('0x40')][_0xcc14('0x43')]));_0x147ad3[_0xcc14('0x44')]=_0x147ad3[_0xcc14('0x44')][_0xcc14('0x58')]?_0x147ad3['attributes']:_0x27725c['model'];if(_0x54c6c8[_0xcc14('0x40')][_0xcc14('0x53')]){_0x147ad3[_0xcc14('0x59')]=[{'all':!![]}];}_0x147ad3=_[_0xcc14('0x4c')]({},_0x147ad3,_0x54c6c8[_0xcc14('0x52')]);return db[_0xcc14('0x3e')][_0xcc14('0x5a')](_0x147ad3)[_0xcc14('0x35')](handleEntityNotFound(_0x3c01a8,null))[_0xcc14('0x35')](respondWithResult(_0x3c01a8,null))[_0xcc14('0x2b')](handleError(_0x3c01a8,null));};exports[_0xcc14('0x5b')]=function(_0x50db7a,_0x5ed09c){return db['SmsAccount'][_0xcc14('0x5b')](_0x50db7a[_0xcc14('0x5c')],{})[_0xcc14('0x35')](function(_0x58222f){var _0x421c18=_0x50db7a[_0xcc14('0x5d')]['get']({'plain':!![]});if(!_0x421c18)throw new Error(_0xcc14('0x5e'));if(_0x421c18[_0xcc14('0x5f')]===_0xcc14('0x5d')){var _0xd8a5c9=_0x58222f[_0xcc14('0x37')]({'plain':!![]});var _0x39ee2b=_0xcc14('0x38');return db[_0xcc14('0x60')][_0xcc14('0x5a')]({'where':{'name':_0x39ee2b,'userProfileId':_0x421c18[_0xcc14('0x61')]},'raw':!![]})[_0xcc14('0x35')](function(_0x4202fc){if(_0x4202fc&&_0x4202fc[_0xcc14('0x62')]===0x0){return db[_0xcc14('0x39')]['create']({'name':_0xd8a5c9['name'],'resourceId':_0xd8a5c9['id'],'type':_0x4202fc[_0xcc14('0x3a')],'sectionId':_0x4202fc['id']},{})[_0xcc14('0x35')](function(){return _0x58222f;});}else{return _0x58222f;}})[_0xcc14('0x2b')](function(_0x51cc0b){logger[_0xcc14('0x27')](_0xcc14('0x63'),_0x51cc0b);throw _0x51cc0b;});}return _0x58222f;})[_0xcc14('0x35')](respondWithResult(_0x5ed09c,0xc9))['catch'](handleError(_0x5ed09c,null));};exports[_0xcc14('0x34')]=function(_0x308b5d,_0x2af9d5){if(_0x308b5d[_0xcc14('0x5c')]['id']){delete _0x308b5d[_0xcc14('0x5c')]['id'];}return db[_0xcc14('0x3e')]['find']({'where':{'id':_0x308b5d[_0xcc14('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xcc14('0x3d')}]})[_0xcc14('0x35')](handleEntityNotFound(_0x2af9d5,null))[_0xcc14('0x35')](saveUpdates(_0x308b5d[_0xcc14('0x5c')],null))[_0xcc14('0x35')](respondWithResult(_0x2af9d5,null))[_0xcc14('0x2b')](handleError(_0x2af9d5,null));};exports[_0xcc14('0x36')]=function(_0x28aa2a,_0x3781fd){return db[_0xcc14('0x3e')]['find']({'where':{'id':_0x28aa2a[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x3781fd,null))[_0xcc14('0x35')](removeEntity(_0x3781fd,null))[_0xcc14('0x2b')](handleError(_0x3781fd,null));};exports[_0xcc14('0x64')]=function(_0x464782,_0x213197){return db[_0xcc14('0x3e')][_0xcc14('0x64')]()[_0xcc14('0x35')](respondWithResult(_0x213197,null))[_0xcc14('0x2b')](handleError(_0x213197,null));};exports[_0xcc14('0x65')]=function(_0x47c5e5,_0x219da0,_0x1a9c21){if(_0x47c5e5[_0xcc14('0x5c')]['id']){delete _0x47c5e5[_0xcc14('0x5c')]['id'];}return db[_0xcc14('0x3e')]['find']({'where':{'id':_0x47c5e5[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x219da0,null))['then'](function(_0x51a5c9){if(_0x51a5c9){_0x47c5e5[_0xcc14('0x5c')][_0xcc14('0x66')]=_0x51a5c9['id'];return db[_0xcc14('0x67')][_0xcc14('0x5b')](_0x47c5e5[_0xcc14('0x5c')]);}})['then'](respondWithResult(_0x219da0,null))['catch'](handleError(_0x219da0,null));};exports[_0xcc14('0x68')]=function(_0x394741,_0x364890,_0x226cc0){var _0x45b090={'raw':![],'where':{}};var _0x1e9094={};var _0x1bf03c={'count':0x0,'rows':[]};return db[_0xcc14('0x3e')][_0xcc14('0x69')]({'where':{'id':_0x394741[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x364890,null))[_0xcc14('0x35')](function(_0x44ffd4){if(_0x44ffd4){_0x1e9094['model']=_[_0xcc14('0x3f')](db[_0xcc14('0x67')][_0xcc14('0x57')]);_0x1e9094[_0xcc14('0x40')]=_[_0xcc14('0x3f')](_0x394741[_0xcc14('0x40')]);_0x1e9094['filters']=_[_0xcc14('0x41')](_0x1e9094[_0xcc14('0x42')],_0x1e9094['query']);_0x45b090[_0xcc14('0x44')]=_['intersection'](_0x1e9094[_0xcc14('0x42')],qs[_0xcc14('0x43')](_0x394741['query'][_0xcc14('0x43')]));_0x45b090[_0xcc14('0x44')]=_0x45b090[_0xcc14('0x44')][_0xcc14('0x58')]?_0x45b090[_0xcc14('0x44')]:_0x1e9094[_0xcc14('0x42')];if(!_0x394741[_0xcc14('0x40')][_0xcc14('0x6a')](_0xcc14('0x45'))){_0x45b090[_0xcc14('0x31')]=qs[_0xcc14('0x31')](_0x394741['query'][_0xcc14('0x31')]);_0x45b090[_0xcc14('0x30')]=qs[_0xcc14('0x30')](_0x394741[_0xcc14('0x40')]['offset']);}_0x45b090[_0xcc14('0x46')]=qs[_0xcc14('0x47')](_0x394741['query'][_0xcc14('0x47')]);_0x45b090[_0xcc14('0x48')]=qs[_0xcc14('0x49')](_[_0xcc14('0x4a')](_0x394741['query'],_0x1e9094[_0xcc14('0x49')]));_0x45b090[_0xcc14('0x48')][_0xcc14('0x66')]=_0x44ffd4['id'];if(_0x394741[_0xcc14('0x40')]['filter']){_0x45b090[_0xcc14('0x48')]=_[_0xcc14('0x4c')](_0x45b090[_0xcc14('0x48')],{'$or':_[_0xcc14('0x4d')](_0x45b090['attributes'],function(_0x453cfe){var _0x363bba={};_0x363bba[_0x453cfe]={'$like':'%'+_0x394741[_0xcc14('0x40')][_0xcc14('0x4b')]+'%'};return _0x363bba;})});}_0x45b090=_[_0xcc14('0x4c')]({},_0x45b090,_0x394741[_0xcc14('0x52')]);return db['Disposition'][_0xcc14('0x2f')]({'where':_0x45b090[_0xcc14('0x48')]})['then'](function(_0x2329d1){_0x1bf03c[_0xcc14('0x2f')]=_0x2329d1;if(_0x394741[_0xcc14('0x40')][_0xcc14('0x53')]){_0x45b090[_0xcc14('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x45b090);})['then'](function(_0x5a7e9a){_0x1bf03c[_0xcc14('0x54')]=_0x5a7e9a;return _0x1bf03c;});}})[_0xcc14('0x35')](respondWithFilteredResult(_0x364890,_0x45b090))[_0xcc14('0x2b')](handleError(_0x364890,null));};exports[_0xcc14('0x6b')]=function(_0x2a05c1,_0x179bd7,_0x5ffc35){return db[_0xcc14('0x3e')]['find']({'where':{'id':_0x2a05c1['params']['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x179bd7,null))[_0xcc14('0x35')](function(_0x502bd9){if(_0x502bd9){return _0x502bd9[_0xcc14('0x6b')](_0x2a05c1[_0xcc14('0x40')][_0xcc14('0x6c')]);}})[_0xcc14('0x35')](respondWithStatusCode(_0x179bd7,null))['catch'](handleError(_0x179bd7,null));};exports['addAnswer']=function(_0x13edf5,_0x2050de,_0x34a7ea){if(_0x13edf5['body']['id']){delete _0x13edf5[_0xcc14('0x5c')]['id'];}return db['SmsAccount'][_0xcc14('0x5a')]({'where':{'id':_0x13edf5[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x2050de,null))['then'](function(_0x4745c4){if(_0x4745c4){_0x13edf5['body']['SmsAccountId']=_0x4745c4['id'];return db[_0xcc14('0x6d')]['create'](_0x13edf5[_0xcc14('0x5c')]);}})['then'](respondWithResult(_0x2050de,null))['catch'](handleError(_0x2050de,null));};exports[_0xcc14('0x6e')]=function(_0x12cf9b,_0xb14da3,_0x229987){var _0x35b2e8={'raw':![],'where':{}};var _0x2fd519={};var _0x1dc9f5={'count':0x0,'rows':[]};return db[_0xcc14('0x3e')][_0xcc14('0x69')]({'where':{'id':_0x12cf9b[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0xb14da3,null))[_0xcc14('0x35')](function(_0x51e962){if(_0x51e962){_0x2fd519['model']=_['keys'](db['CannedAnswer'][_0xcc14('0x57')]);_0x2fd519[_0xcc14('0x40')]=_[_0xcc14('0x3f')](_0x12cf9b[_0xcc14('0x40')]);_0x2fd519[_0xcc14('0x49')]=_['intersection'](_0x2fd519['model'],_0x2fd519['query']);_0x35b2e8[_0xcc14('0x44')]=_[_0xcc14('0x41')](_0x2fd519[_0xcc14('0x42')],qs[_0xcc14('0x43')](_0x12cf9b[_0xcc14('0x40')][_0xcc14('0x43')]));_0x35b2e8[_0xcc14('0x44')]=_0x35b2e8[_0xcc14('0x44')][_0xcc14('0x58')]?_0x35b2e8[_0xcc14('0x44')]:_0x2fd519['model'];if(!_0x12cf9b['query'][_0xcc14('0x6a')](_0xcc14('0x45'))){_0x35b2e8[_0xcc14('0x31')]=qs[_0xcc14('0x31')](_0x12cf9b[_0xcc14('0x40')]['limit']);_0x35b2e8['offset']=qs[_0xcc14('0x30')](_0x12cf9b[_0xcc14('0x40')][_0xcc14('0x30')]);}_0x35b2e8[_0xcc14('0x46')]=qs[_0xcc14('0x47')](_0x12cf9b[_0xcc14('0x40')][_0xcc14('0x47')]);_0x35b2e8[_0xcc14('0x48')]=qs[_0xcc14('0x49')](_[_0xcc14('0x4a')](_0x12cf9b[_0xcc14('0x40')],_0x2fd519[_0xcc14('0x49')]));_0x35b2e8[_0xcc14('0x48')]['SmsAccountId']=_0x51e962['id'];if(_0x12cf9b[_0xcc14('0x40')][_0xcc14('0x4b')]){_0x35b2e8[_0xcc14('0x48')]=_[_0xcc14('0x4c')](_0x35b2e8['where'],{'$or':_[_0xcc14('0x4d')](_0x35b2e8[_0xcc14('0x44')],function(_0x395b9a){var _0x569b4c={};_0x569b4c[_0x395b9a]={'$like':'%'+_0x12cf9b[_0xcc14('0x40')][_0xcc14('0x4b')]+'%'};return _0x569b4c;})});}_0x35b2e8=_[_0xcc14('0x4c')]({},_0x35b2e8,_0x12cf9b[_0xcc14('0x52')]);return db[_0xcc14('0x6d')][_0xcc14('0x2f')]({'where':_0x35b2e8['where']})[_0xcc14('0x35')](function(_0x55d702){_0x1dc9f5['count']=_0x55d702;if(_0x12cf9b[_0xcc14('0x40')][_0xcc14('0x53')]){_0x35b2e8[_0xcc14('0x59')]=[{'all':!![]}];}return db[_0xcc14('0x6d')][_0xcc14('0x6f')](_0x35b2e8);})['then'](function(_0x5cc76f){_0x1dc9f5[_0xcc14('0x54')]=_0x5cc76f;return _0x1dc9f5;});}})['then'](respondWithFilteredResult(_0xb14da3,_0x35b2e8))['catch'](handleError(_0xb14da3,null));};exports[_0xcc14('0x70')]=function(_0xd8f0f8,_0x43fc12,_0xd01f40){return db[_0xcc14('0x3e')]['find']({'where':{'id':_0xd8f0f8['params']['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x43fc12,null))['then'](function(_0x2b3a48){if(_0x2b3a48){return _0x2b3a48[_0xcc14('0x70')](_0xd8f0f8[_0xcc14('0x40')][_0xcc14('0x6c')]);}})['then'](respondWithStatusCode(_0x43fc12,null))[_0xcc14('0x2b')](handleError(_0x43fc12,null));};exports['notify']=function(_0x3202e8,_0x2b9a85,_0x25e56c){var _0x2552a1={'channel':_0xcc14('0x71')};var _0xe492fe=[];var _0x305352=[];var _0x48efdf={};return db[_0xcc14('0x3e')][_0xcc14('0x5a')]({'where':{'id':_0x3202e8['params']['id']},'include':[{'model':db[_0xcc14('0x72')],'as':_0xcc14('0x73')}]})[_0xcc14('0x35')](handleEntityNotFound(_0x2b9a85,null))[_0xcc14('0x35')](function(_0x569849){_0x2552a1[_0xcc14('0x74')]=_0x569849;_0x2552a1['applications']=_[_0xcc14('0x75')](_0x569849[_0xcc14('0x73')],['priority'],[_0xcc14('0x76')]);if(_0x2552a1[_0xcc14('0x74')][_0xcc14('0x73')]){delete _0x2552a1[_0xcc14('0x74')][_0xcc14('0x73')];}return db[_0xcc14('0x77')][_0xcc14('0x64')]();})['then'](function(_0x49daec){if(!_0x49daec){throw new db['Sequelize'][(_0xcc14('0x78'))](_0xcc14('0x79'));}_0xe492fe=_[_0xcc14('0x7a')](_[_0xcc14('0x3f')](_0x49daec),[_0xcc14('0x7b'),'updatedAt']);_0x305352=_[_0xcc14('0x7a')](_['keys'](_0x49daec),[_0xcc14('0x7b'),_0xcc14('0x7c'),_0xcc14('0x7d'),_0xcc14('0x7e')]);_0x2552a1[_0xcc14('0x5c')]={'mapKey':'mobile'};if(_0x2552a1['account'][_0xcc14('0x4e')]){switch(_0x2552a1['account']['type']){case _0xcc14('0x7f'):_0x2552a1['body'][_0xcc14('0x80')]=_0x3202e8[_0xcc14('0x5c')]['From'];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x81')];_0x2552a1['body'][_0xcc14('0x82')]=_0x3202e8[_0xcc14('0x5c')]['MessageSid'];break;case _0xcc14('0x83'):_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')]='+'+_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x84')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x85')];break;case'connectel':_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x80')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8['body'][_0xcc14('0x29')];break;case _0xcc14('0x86'):_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x80')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x5c')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x82')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x87')];break;case _0xcc14('0x88'):_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x89')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8[_0xcc14('0x5c')]['Text'];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x82')]=_0x3202e8['body'][_0xcc14('0x8a')];break;case _0xcc14('0x8b'):_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')]='+'+_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x8c')][0x0]['from'];_0x2552a1['body'][_0xcc14('0x5c')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x8c')][0x0][_0xcc14('0x85')];_0x2552a1['body'][_0xcc14('0x82')]=_0x3202e8[_0xcc14('0x5c')]['results'][0x0][_0xcc14('0x82')];break;case _0xcc14('0x8d'):_0x2552a1[_0xcc14('0x5c')]['from']=_0x3202e8['body'][_0xcc14('0x8e')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8['body'][_0xcc14('0x8f')]['message'];break;case'clickatell':_0x2552a1['body']['from']=_0x3202e8[_0xcc14('0x5c')]['fromNumber'];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8['body']['text'];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x82')]=_0x3202e8['body']['replyMessageId'];break;case _0xcc14('0x90'):_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x80')];_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]=_0x3202e8[_0xcc14('0x5c')][_0xcc14('0x29')];_0x2552a1['body'][_0xcc14('0x82')]=_0x3202e8['body'][_0xcc14('0x91')];break;}}if(_0x2552a1['body']['id']){delete _0x2552a1[_0xcc14('0x5c')]['id'];}if(_[_0xcc14('0x92')](_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')])){throw new db[(_0xcc14('0x93'))][(_0xcc14('0x78'))](_0xcc14('0x94'));}if(_[_0xcc14('0x92')](_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')])||_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x5c')]===''){throw new db[(_0xcc14('0x93'))][(_0xcc14('0x78'))](_0xcc14('0x95'));}if(_[_0xcc14('0x92')](_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x96')])){throw new db['Sequelize']['ValidationError'](_0xcc14('0x97')+_0x305352);}if(!_[_0xcc14('0x98')](_0x305352,_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x96')])){throw new db[(_0xcc14('0x93'))][(_0xcc14('0x78'))](_0xcc14('0x99')+_0x305352);}_0x48efdf[_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x96')]]=_0x2552a1[_0xcc14('0x5c')]['from'];return db[_0xcc14('0x9a')][_0xcc14('0x5a')]({'where':{'id':_0x2552a1[_0xcc14('0x74')]['ListId']},'include':[{'model':db['CmContact'],'as':_0xcc14('0x9b'),'where':_0x48efdf,'limit':0x1,'order':[[_0xcc14('0x7c'),_0xcc14('0x9c')]]}]});})[_0xcc14('0x35')](handleEntityNotFound(_0x2b9a85,null))['then'](function(_0x233c43){if(_0x233c43){_0x2552a1[_0xcc14('0x9d')]=_[_0xcc14('0x9e')](_0x233c43,[_0xcc14('0x9b')]);if(_0x233c43[_0xcc14('0x9b')][_0xcc14('0x58')]){return _0x233c43[_0xcc14('0x9b')][0x0];}var _0x11b10f=_[_0xcc14('0x9f')](_0x2552a1[_0xcc14('0x5c')],{'firstName':_0x2552a1['body'][_0xcc14('0x80')],'ListId':_0x233c43['id']});_0x11b10f[_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x96')]]=_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')];return db[_0xcc14('0x77')][_0xcc14('0x5b')](_0x11b10f,{'fields':_0xe492fe,'raw':!![]});}})[_0xcc14('0x35')](handleEntityNotFound(_0x2b9a85,null))[_0xcc14('0x35')](function(_0xf0d31e){if(_0xf0d31e){_0x2552a1[_0xcc14('0xa0')]=_0xf0d31e;var _0x58895d={'ContactId':_0xf0d31e['id'],'phone':_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')],'SmsAccountId':_0x3202e8[_0xcc14('0x55')]['id']};var _0x223487={'ContactId':_0xf0d31e['id'],'SmsAccountId':_0x3202e8[_0xcc14('0x55')]['id'],'closed':![]};return db[_0xcc14('0xa1')][_0xcc14('0x5a')]({'where':_0x223487})[_0xcc14('0x35')](function(_0x59ca8b){if(_0x59ca8b){return[_0x59ca8b,![]];}return db[_0xcc14('0xa1')][_0xcc14('0x5b')](_0x58895d)['then'](function(_0x5b4652){return[_0x5b4652,!![]];});});}})[_0xcc14('0xa2')](function(_0x3d3a05,_0x1da5dd){_0x2552a1['interaction']=_0x3d3a05['get']({'plain':!![]});_0x2552a1[_0xcc14('0xa3')][_0xcc14('0xa4')]=![];if(_0x1da5dd){if(_0x2552a1[_0xcc14('0x74')]['autoclose']){_0x2552a1[_0xcc14('0xa5')][_0xcc14('0xa6')]({'id':0x0,'priority':_0x2552a1[_0xcc14('0xa5')][_0xcc14('0x58')]+0x1,'app':_0xcc14('0xa7'),'appdata':_0xcc14('0xa8'),'interval':_0xcc14('0xa9')});}_0x2552a1[_0xcc14('0xa3')]['created']=!![];}return db[_0xcc14('0xaa')][_0xcc14('0x5b')]({'phone':_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x80')],'messageId':_0x2552a1[_0xcc14('0x5c')][_0xcc14('0x82')],'body':_0x2552a1['body'][_0xcc14('0x5c')],'SmsAccountId':_0x3202e8[_0xcc14('0x55')]['id'],'SmsInteractionId':_0x3d3a05['id'],'direction':'in','ContactId':_0x3d3a05[_0xcc14('0xab')],'AttachmentId':_0x2552a1[_0xcc14('0x5c')][_0xcc14('0xac')]});})[_0xcc14('0x35')](function(_0x2ed1bd){_0x2552a1[_0xcc14('0x29')]=_0x2ed1bd;if(_0x2552a1[_0xcc14('0xa3')]['UserId']){return db['User'][_0xcc14('0x5a')]({'attributes':['id',_0xcc14('0x3a')],'where':{'id':_0x2552a1[_0xcc14('0xa3')][_0xcc14('0xad')]}})[_0xcc14('0x35')](function(_0x2d07a9){if(_0x2d07a9){_0x2552a1['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xcc14('0xae'),'appdata':_0x2d07a9['name']+','+(_0x2552a1[_0xcc14('0x74')][_0xcc14('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcc14('0xb0'),_0xcc14('0xb1'),_0x2552a1);});}return respondWithRpcPromise(_0xcc14('0xb0'),_0xcc14('0xb1'),_0x2552a1);})[_0xcc14('0x35')](function(_0x1da336){if(_0x1da336){var _0x3f69c3=0xc8;var _0x45f0a1=_0xcc14('0xb2');logger[_0xcc14('0x22')](_0xcc14('0x25'),_0x45f0a1,_0x3f69c3,_0xcc14('0xb3'));logger[_0xcc14('0x24')](_0xcc14('0xb4'),_0x45f0a1,_0x3f69c3,_0xcc14('0xb3'),JSON[_0xcc14('0xb5')](_0x1da336));if(_0x2552a1[_0xcc14('0x74')][_0xcc14('0x4e')]===_0xcc14('0x7f')){return _0x2b9a85[_0xcc14('0x2d')](_0x3f69c3)[_0xcc14('0xb6')](_0xcc14('0xb7'),_0xcc14('0xb8'))[_0xcc14('0x3b')](_0xcc14('0xb9'));}else{return _0x2b9a85[_0xcc14('0x2d')](_0x3f69c3)[_0xcc14('0x2e')](_0x1da336);}}})[_0xcc14('0x2b')](handleError(_0x2b9a85,null));};exports['addApplications']=function(_0x5b61c9,_0x4a299b,_0x28f1fa){return db[_0xcc14('0x3e')][_0xcc14('0x69')]({'where':{'id':_0x5b61c9[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x4a299b,null))['then'](function(_0x18bb00){if(_0x18bb00){return db['sequelize'][_0xcc14('0xba')](function(_0x15ae73){return db[_0xcc14('0x72')][_0xcc14('0x36')]({'where':{'SmsAccountId':_0x5b61c9[_0xcc14('0x55')]['id']},'transaction':_0x15ae73})[_0xcc14('0x35')](function(_0x54996c){var _0x4dd5c0=_['map'](_0x5b61c9[_0xcc14('0x5c')],function(_0x39d62b){_0x39d62b[_0xcc14('0x66')]=_0x5b61c9[_0xcc14('0x55')]['id'];return _0x39d62b;});return db[_0xcc14('0x72')][_0xcc14('0xbb')](_0x4dd5c0,{'transaction':_0x15ae73});});})[_0xcc14('0x35')](function(){return db[_0xcc14('0x72')]['findAndCountAll']({'where':{'SmsAccountId':_0x5b61c9[_0xcc14('0x55')]['id']},'order':_0xcc14('0xbc')});});}})['then'](respondWithResult(_0x4a299b,null))[_0xcc14('0x2b')](handleError(_0x4a299b,null));};exports['getApplications']=function(_0x4ab740,_0x8bfab3,_0x509927){var _0x2d2446={};var _0x543469={};var _0x5dd8db;var _0x1c61a1;return db['SmsAccount']['findOne']({'where':{'id':_0x4ab740[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x8bfab3,null))[_0xcc14('0x35')](function(_0x413edd){if(_0x413edd){_0x5dd8db=_0x413edd;_0x543469[_0xcc14('0x42')]=_[_0xcc14('0x3f')](db[_0xcc14('0x72')][_0xcc14('0x57')]);_0x543469['query']=_[_0xcc14('0x3f')](_0x4ab740[_0xcc14('0x40')]);_0x543469[_0xcc14('0x49')]=_['intersection'](_0x543469['model'],_0x543469[_0xcc14('0x40')]);_0x2d2446[_0xcc14('0x44')]=_[_0xcc14('0x41')](_0x543469[_0xcc14('0x42')],qs[_0xcc14('0x43')](_0x4ab740[_0xcc14('0x40')][_0xcc14('0x43')]));_0x2d2446[_0xcc14('0x44')]=_0x2d2446[_0xcc14('0x44')][_0xcc14('0x58')]?_0x2d2446[_0xcc14('0x44')]:_0x543469[_0xcc14('0x42')];_0x2d2446[_0xcc14('0x46')]=qs[_0xcc14('0x47')](_0x4ab740[_0xcc14('0x40')][_0xcc14('0x47')]);_0x2d2446[_0xcc14('0x48')]=qs['filters'](_[_0xcc14('0x4a')](_0x4ab740['query'],_0x543469['filters']));if(_0x4ab740[_0xcc14('0x40')][_0xcc14('0x4b')]){_0x2d2446[_0xcc14('0x48')]=_[_0xcc14('0x4c')](_0x2d2446[_0xcc14('0x48')],{'$or':_[_0xcc14('0x4d')](_0x2d2446[_0xcc14('0x44')],function(_0x54c525){var _0x2db52c={};_0x2db52c[_0x54c525]={'$like':'%'+_0x4ab740[_0xcc14('0x40')][_0xcc14('0x4b')]+'%'};return _0x2db52c;})});}_0x2d2446=_[_0xcc14('0x4c')]({},_0x2d2446,_0x4ab740['options']);return _0x5dd8db[_0xcc14('0xbd')](_0x2d2446);}})['then'](function(_0x3ebe7c){if(_0x3ebe7c){_0x1c61a1=_0x3ebe7c[_0xcc14('0x58')];if(!_0x4ab740['query'][_0xcc14('0x6a')](_0xcc14('0x45'))){_0x2d2446[_0xcc14('0x31')]=qs['limit'](_0x4ab740[_0xcc14('0x40')][_0xcc14('0x31')]);_0x2d2446[_0xcc14('0x30')]=qs['offset'](_0x4ab740[_0xcc14('0x40')][_0xcc14('0x30')]);}return _0x5dd8db[_0xcc14('0xbd')](_0x2d2446);}})[_0xcc14('0x35')](function(_0x17b8bb){if(_0x17b8bb){return _0x17b8bb?{'count':_0x1c61a1,'rows':_0x17b8bb}:null;}})[_0xcc14('0x35')](respondWithResult(_0x8bfab3,null))[_0xcc14('0x2b')](handleError(_0x8bfab3,null));};exports[_0xcc14('0xbe')]=function(_0x1c7001,_0x590f7b,_0x40bbaf){var _0x208edc={'raw':![],'where':{}};var _0x402d9c={};var _0x524883={'count':0x0,'rows':[]};return db[_0xcc14('0x3e')]['findOne']({'where':{'id':_0x1c7001[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x590f7b,null))[_0xcc14('0x35')](function(_0x3660d1){if(_0x3660d1){_0x402d9c[_0xcc14('0x42')]=_[_0xcc14('0x3f')](db[_0xcc14('0xa1')][_0xcc14('0x57')]);_0x402d9c['query']=_[_0xcc14('0x3f')](_0x1c7001['query']);_0x402d9c[_0xcc14('0x49')]=_[_0xcc14('0x41')](_0x402d9c[_0xcc14('0x42')],_0x402d9c[_0xcc14('0x40')]);_0x208edc[_0xcc14('0x44')]=_[_0xcc14('0x41')](_0x402d9c[_0xcc14('0x42')],qs['fields'](_0x1c7001[_0xcc14('0x40')][_0xcc14('0x43')]));_0x208edc[_0xcc14('0x44')]=_0x208edc['attributes'][_0xcc14('0x58')]?_0x208edc['attributes']:_0x402d9c[_0xcc14('0x42')];if(!_0x1c7001[_0xcc14('0x40')]['hasOwnProperty']('nolimit')){_0x208edc[_0xcc14('0x31')]=qs[_0xcc14('0x31')](_0x1c7001[_0xcc14('0x40')][_0xcc14('0x31')]);_0x208edc['offset']=qs['offset'](_0x1c7001[_0xcc14('0x40')][_0xcc14('0x30')]);}_0x208edc[_0xcc14('0x46')]=qs[_0xcc14('0x47')](_0x1c7001[_0xcc14('0x40')]['sort']);_0x208edc[_0xcc14('0x48')]=qs[_0xcc14('0x49')](_[_0xcc14('0x4a')](_0x1c7001[_0xcc14('0x40')],_0x402d9c['filters']));_0x208edc[_0xcc14('0x48')][_0xcc14('0x66')]=_0x3660d1['id'];if(_0x1c7001['query'][_0xcc14('0x4b')]){_0x208edc[_0xcc14('0x48')]=_[_0xcc14('0x4c')](_0x208edc[_0xcc14('0x48')],{'$or':_[_0xcc14('0x4d')](_0x208edc[_0xcc14('0x44')],function(_0x263ec5){var _0x4df53a={};_0x4df53a[_0x263ec5]={'$like':'%'+_0x1c7001['query'][_0xcc14('0x4b')]+'%'};return _0x4df53a;})});}_0x208edc=_[_0xcc14('0x4c')]({},_0x208edc,_0x1c7001[_0xcc14('0x52')]);return db[_0xcc14('0xa1')][_0xcc14('0x2f')]({'where':_0x208edc[_0xcc14('0x48')]})[_0xcc14('0x35')](function(_0xdd7aff){_0x524883['count']=_0xdd7aff;if(_0x1c7001[_0xcc14('0x40')][_0xcc14('0x53')]){_0x208edc[_0xcc14('0x59')]=[{'model':db[_0xcc14('0x77')],'as':_0xcc14('0xbf'),'required':![]},{'model':db[_0xcc14('0xc0')],'as':_0xcc14('0xc1'),'attributes':[_0xcc14('0x3a'),_0xcc14('0xc2'),_0xcc14('0xc3')],'required':![]},{'model':db['Tag'],'as':_0xcc14('0xc4'),'attributes':['id','name','color'],'where':_0x1c7001[_0xcc14('0x40')][_0xcc14('0xc5')]?{'id':_0x1c7001[_0xcc14('0x40')][_0xcc14('0xc5')]}:undefined,'required':_0x1c7001[_0xcc14('0x40')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0xcc14('0x6f')](_0x208edc);})[_0xcc14('0x35')](function(_0x1f8192){_0x524883['rows']=_0x1f8192;return _0x524883;});}})[_0xcc14('0x35')](respondWithFilteredResult(_0x590f7b,_0x208edc))[_0xcc14('0x2b')](handleError(_0x590f7b,null));};exports[_0xcc14('0x3b')]=function(_0x5193ab,_0x1bd855,_0x403481){var _0x2ec95c,_0x260cce,_0x9ad46;if(_[_0xcc14('0x92')](_0x5193ab[_0xcc14('0x5c')][_0xcc14('0x5c')])||_0x5193ab[_0xcc14('0x5c')][_0xcc14('0x5c')]===''){throw new db[(_0xcc14('0x93'))][(_0xcc14('0x78'))](_0xcc14('0x95'));}if(_[_0xcc14('0x92')](_0x5193ab[_0xcc14('0x5c')]['to'])){throw new db[(_0xcc14('0x93'))][(_0xcc14('0x78'))](_0xcc14('0xc6'));}_0x2ec95c=_0x5193ab[_0xcc14('0x5c')]['to'];return db[_0xcc14('0x3e')][_0xcc14('0x5a')]({'where':{'id':_0x5193ab[_0xcc14('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xcc14('0xc7'),'include':[{'model':db[_0xcc14('0x77')],'as':_0xcc14('0x9b'),'where':{'mobile':_0x2ec95c},'limit':0x1,'order':[[_0xcc14('0x7c'),'DESC']]}]}]})[_0xcc14('0x35')](handleEntityNotFound(_0x1bd855,null))[_0xcc14('0x35')](function(_0x4e0b15){if(_0x4e0b15&&_0x4e0b15[_0xcc14('0xc7')]){_0x260cce=_0x4e0b15['get']({'plain':!![]});if(_0x260cce[_0xcc14('0xc7')]&&_0x260cce[_0xcc14('0xc7')][_0xcc14('0x9b')][_0xcc14('0x58')]){return _0x260cce[_0xcc14('0xc7')][_0xcc14('0x9b')][0x0];}return db[_0xcc14('0x77')]['create'](_[_0xcc14('0x9f')](_0x5193ab['body'],{'firstName':_0x2ec95c,'mobile':_0x2ec95c,'phone':_0x2ec95c,'ListId':_0x260cce[_0xcc14('0x7e')]}));}})[_0xcc14('0x35')](handleEntityNotFound(_0x1bd855,null))[_0xcc14('0x35')](function(_0x34e544){if(_0x34e544){_0x9ad46=_0x34e544;return db[_0xcc14('0xa1')][_0xcc14('0x5a')]({'where':{'ContactId':_0x9ad46['id'],'closed':![],'SmsAccountId':_0x260cce['id']}})['then'](function(_0x49aa21){if(_0x49aa21){return[_0x49aa21,![]];}return db[_0xcc14('0xa1')]['create']({'UserId':_0x5193ab[_0xcc14('0x5d')]['id'],'ContactId':_0x9ad46['id'],'SmsAccountId':_0x260cce['id'],'phone':_0x2ec95c,'firstMsgDirection':_0xcc14('0xc8'),'Messages':[_['merge'](_0x5193ab[_0xcc14('0x5c')],{'read':![],'body':_0x5193ab['body'][_0xcc14('0x5c')],'phone':_0x2ec95c,'SmsAccountId':_0x260cce['id'],'UserId':_0x5193ab['user']['id'],'ContactId':_0x9ad46['id']})]},{'include':[{'model':db[_0xcc14('0xaa')],'as':_0xcc14('0xc9')}]})[_0xcc14('0x35')](function(_0x2ea0b0){return[_0x2ea0b0,!![]];});});}})[_0xcc14('0xa2')](function(_0x235a50,_0x26ba2){if(_0x26ba2){return _0x235a50;}return db[_0xcc14('0xaa')]['create'](_[_0xcc14('0x4c')](_0x5193ab[_0xcc14('0x5c')],{'read':![],'body':_0x5193ab['body']['body'],'phone':_0x2ec95c,'SmsAccountId':_0x260cce['id'],'SmsInteractionId':_0x235a50['id'],'UserId':_0x5193ab[_0xcc14('0x5d')]['id'],'ContactId':_0x9ad46['id']}))[_0xcc14('0x35')](function(_0x15b604){_0x235a50['dataValues'][_0xcc14('0xc9')]=[];_0x235a50[_0xcc14('0xca')][_0xcc14('0xc9')][_0xcc14('0xa6')](_0x15b604[_0xcc14('0xca')]);return _0x235a50;});})[_0xcc14('0x35')](respondWithResult(_0x1bd855,null))[_0xcc14('0x2b')](handleError(_0x1bd855,null));};exports[_0xcc14('0x2d')]=function(_0x233f40,_0x30d50a,_0x59ad2a){if(_0x233f40[_0xcc14('0x5c')]['id']){delete _0x233f40[_0xcc14('0x5c')]['id'];}console[_0xcc14('0xcb')](_0xcc14('0xcc'),_0x233f40['body']);var _0x54e225,_0x5ccfe4,_0x2ed1f0;return db['SmsAccount'][_0xcc14('0x5a')]({'where':{'id':_0x233f40[_0xcc14('0x55')]['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x30d50a,null))['then'](function(_0x1749cc){if(_0x1749cc){_0x2ed1f0=_0x1749cc;logger[_0xcc14('0x24')](_0xcc14('0x25'),_0xcc14('0x2d'),_0xcc14('0xcd'),_0x1749cc[_0xcc14('0x4e')],util[_0xcc14('0xce')](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1749cc[_0xcc14('0x4e')]){case _0xcc14('0x83'):if(_0x233f40[_0xcc14('0x5c')][_0xcc14('0xcf')]&&_0x233f40[_0xcc14('0x5c')][_0xcc14('0x2d')]){_0x5ccfe4=_0x233f40[_0xcc14('0x5c')]['status'];return db[_0xcc14('0xaa')][_0xcc14('0x5a')]({'where':{'messageId':_0x233f40[_0xcc14('0x5c')][_0xcc14('0xcf')]}});}break;case _0xcc14('0xd0'):if(_0x233f40[_0xcc14('0x5c')][_0xcc14('0xd1')]&&_0x233f40[_0xcc14('0x5c')][_0xcc14('0xd2')]){_0x5ccfe4=_0x233f40[_0xcc14('0x5c')]['statusInt'];return db[_0xcc14('0xaa')][_0xcc14('0x5a')]({'where':{'messageId':_0x233f40['body']['requestid']}});}break;case _0xcc14('0x86'):if(_0x233f40[_0xcc14('0x5c')][_0xcc14('0x87')]&&_0x233f40['body']['status_code']){_0x5ccfe4=_0x233f40[_0xcc14('0x5c')]['status_code'];return db['SmsMessage'][_0xcc14('0x5a')]({'where':{'messageId':_0x233f40[_0xcc14('0x5c')][_0xcc14('0x87')]}});}break;case _0xcc14('0x8b'):var _0x313f7b=_0x233f40[_0xcc14('0x5c')]['results'][0x0];if(_0x313f7b['messageId']&&_0x313f7b['status'][_0xcc14('0xd3')]===_0xcc14('0xd4')){_0x5ccfe4=_0x313f7b['status']['groupName'];return db['SmsMessage']['find']({'where':{'messageId':_0x313f7b[_0xcc14('0x82')]}});}break;case _0xcc14('0xd5'):if(_0x233f40[_0xcc14('0x5c')][_0xcc14('0x82')]&&_0x233f40[_0xcc14('0x5c')][_0xcc14('0x2d')]){_0x5ccfe4=_0x233f40[_0xcc14('0x5c')][_0xcc14('0x2d')];return db[_0xcc14('0xaa')][_0xcc14('0x5a')]({'where':{'messageId':_0x233f40['body'][_0xcc14('0x82')]}});}break;case _0xcc14('0x90'):if(_0x233f40[_0xcc14('0x5c')][_0xcc14('0xd6')]&&_0x233f40['body'][_0xcc14('0x2d')]){_0x5ccfe4=_0x233f40[_0xcc14('0x5c')][_0xcc14('0x2d')];return db['SmsMessage'][_0xcc14('0x5a')]({'where':{'messageId':_0x233f40[_0xcc14('0x5c')][_0xcc14('0xd6')]}});}break;}}})[_0xcc14('0x35')](handleEntityNotFound(_0x30d50a,null))[_0xcc14('0x35')](function(_0x2ceb9d){if(_0x2ceb9d){_0x54e225=_0x2ceb9d;switch(_0x2ed1f0[_0xcc14('0x4e')]){case'skebby':if(_0x5ccfe4==='DELIVERED'){return _0x54e225[_0xcc14('0x34')]({'read':!![]});}else{logger['error'](_0xcc14('0x25'),'status',_0xcc14('0x83'),util[_0xcc14('0xce')](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xcc14('0xd0'):if(_0x5ccfe4==='1'){return _0x54e225[_0xcc14('0x34')]({'read':!![]});}else{logger[_0xcc14('0x27')](_0xcc14('0x25'),_0xcc14('0x2d'),_0xcc14('0x83'),util['inspect'](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x233f40[_0xcc14('0x5c')]['error_code']&&_0x5ccfe4>=0xc8&&_0x5ccfe4<=0xce){return _0x54e225[_0xcc14('0x34')]({'read':!![]});}else{logger[_0xcc14('0x27')](_0xcc14('0x25'),_0xcc14('0x2d'),_0xcc14('0x86'),util[_0xcc14('0xce')](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xcc14('0x8b'):var _0xc4ad1e=_0x233f40[_0xcc14('0x5c')][_0xcc14('0x8c')][0x0];if(_0xc4ad1e[_0xcc14('0x2d')]['groupName']===_0xcc14('0xd4')){return _0x54e225['update']({'read':!![]});}else{logger[_0xcc14('0x27')](_0xcc14('0x25'),_0xcc14('0x2d'),_0xcc14('0x8b'),util[_0xcc14('0xce')](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xcc14('0xd5'):if(_0x5ccfe4=='DELIVERED_TO_GATEWAY'||_0x5ccfe4==_0xcc14('0xd7')){return _0x54e225['update']({'read':!![]});}else{logger[_0xcc14('0x27')](_0xcc14('0x25'),_0xcc14('0x2d'),_0xcc14('0xd5'),util[_0xcc14('0xce')](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xcc14('0x90'):if(_0x5ccfe4==='DELIVRD'||_0x5ccfe4===_0xcc14('0xd8')){return _0x54e225[_0xcc14('0x34')]({'read':!![]});}else{logger[_0xcc14('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0xcc14('0xce')](_0x233f40[_0xcc14('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x54e225;}})[_0xcc14('0x35')](respondWithResult(_0x30d50a,null))['catch'](handleError(_0x30d50a,null));};exports[_0xcc14('0xd9')]=function(_0x24321e,_0x4389f5,_0x10499d){var _0x3ed928,_0x5f530b,_0x2cd659;return db[_0xcc14('0x3e')][_0xcc14('0x5a')]({'where':{'id':_0x24321e['params']['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x4389f5,null))[_0xcc14('0x35')](function(_0x166257){if(_0x166257){_0x2cd659=_0x166257;logger[_0xcc14('0x24')](_0xcc14('0x25'),'status','received\x20delivery\x20report\x20from',_0x166257['type'],util[_0xcc14('0xce')](_0x24321e[_0xcc14('0x40')],{'showHidden':![],'depth':null}));switch(_0x166257[_0xcc14('0x4e')]){case'csc':if(_0x24321e[_0xcc14('0x40')][_0xcc14('0xda')]&&_0x24321e['query'][_0xcc14('0xdb')]){_0x5f530b=_0x24321e[_0xcc14('0x40')][_0xcc14('0xdb')];return db[_0xcc14('0xaa')][_0xcc14('0x5a')]({'where':{'messageId':_0x24321e['query'][_0xcc14('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x4389f5,null))[_0xcc14('0x35')](function(_0x48facb){if(_0x48facb){_0x3ed928=_0x48facb;switch(_0x2cd659[_0xcc14('0x4e')]){case _0xcc14('0x8d'):if(_0x5f530b==='2'||_0x5f530b==='6'){return _0x3ed928[_0xcc14('0x34')]({'read':!![]});}else{logger[_0xcc14('0x27')](_0xcc14('0x25'),_0xcc14('0x2d'),_0xcc14('0x8d'),util[_0xcc14('0xce')](_0x24321e[_0xcc14('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x3ed928;}})[_0xcc14('0x35')](respondWithResult(_0x4389f5,null))[_0xcc14('0x2b')](handleError(_0x4389f5,null));};exports[_0xcc14('0xdc')]=function(_0x4cdd87,_0x459700,_0x581516){return db[_0xcc14('0x3e')][_0xcc14('0x5a')]({'where':{'id':_0x4cdd87['params']['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x459700,null))[_0xcc14('0x35')](function(_0x197f38){if(_0x197f38){return _0x197f38[_0xcc14('0xdc')](_0x4cdd87[_0xcc14('0x5c')][_0xcc14('0x6c')],_[_0xcc14('0x9e')](_0x4cdd87[_0xcc14('0x5c')],[_0xcc14('0x6c'),'id'])||{})[_0xcc14('0xa2')](function(_0x2bb3eb){for(var _0x1077eb=0x0;_0x1077eb<_0x4cdd87['body'][_0xcc14('0x6c')][_0xcc14('0x58')];_0x1077eb+=0x1){socket[_0xcc14('0xdd')](_0xcc14('0xde'),{'UserId':_0x4cdd87[_0xcc14('0x5c')][_0xcc14('0x6c')][_0x1077eb],'SmsAccountId':_0x4cdd87[_0xcc14('0x55')]['id']});}return _0x2bb3eb;});}})[_0xcc14('0x35')](respondWithResult(_0x459700,null))[_0xcc14('0x2b')](handleError(_0x459700,null));};exports[_0xcc14('0xdf')]=function(_0x12ae06,_0x5b86d5,_0x1934cd){return db[_0xcc14('0x3e')]['find']({'where':{'id':_0x12ae06['params']['id']}})[_0xcc14('0x35')](handleEntityNotFound(_0x5b86d5,null))[_0xcc14('0x35')](function(_0x260b93){if(_0x260b93){return _0x260b93[_0xcc14('0xdf')](_0x12ae06[_0xcc14('0x40')][_0xcc14('0x6c')])[_0xcc14('0x35')](function(){if(_[_0xcc14('0xe0')](_0x12ae06[_0xcc14('0x40')][_0xcc14('0x6c')])){for(var _0x3cb0ad=0x0;_0x3cb0ad<_0x12ae06['query'][_0xcc14('0x6c')][_0xcc14('0x58')];_0x3cb0ad+=0x1){socket[_0xcc14('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x12ae06[_0xcc14('0x40')][_0xcc14('0x6c')][_0x3cb0ad]),'SmsAccountId':Number(_0x12ae06[_0xcc14('0x55')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x12ae06[_0xcc14('0x40')][_0xcc14('0x6c')]),'SmsAccountId':Number(_0x12ae06['params']['id'])});}});}})[_0xcc14('0x35')](respondWithStatusCode(_0x5b86d5,null))['catch'](handleError(_0x5b86d5,null));};exports[_0xcc14('0xe1')]=function(_0x320b27,_0x1abc30,_0x1d9531){var _0x439fbf={};var _0x3061a8={};var _0x3ad8c6;var _0x2905bf;return db[_0xcc14('0x3e')][_0xcc14('0x69')]({'where':{'id':_0x320b27[_0xcc14('0x55')]['id']}})['then'](handleEntityNotFound(_0x1abc30,null))[_0xcc14('0x35')](function(_0x634249){if(_0x634249){_0x3ad8c6=_0x634249;_0x3061a8[_0xcc14('0x42')]=_['keys'](db[_0xcc14('0xc0')][_0xcc14('0x57')]);_0x3061a8[_0xcc14('0x40')]=_[_0xcc14('0x3f')](_0x320b27[_0xcc14('0x40')]);_0x3061a8[_0xcc14('0x49')]=_[_0xcc14('0x41')](_0x3061a8[_0xcc14('0x42')],_0x3061a8[_0xcc14('0x40')]);_0x439fbf['attributes']=_['intersection'](_0x3061a8[_0xcc14('0x42')],qs['fields'](_0x320b27['query']['fields']));_0x439fbf[_0xcc14('0x44')]=_0x439fbf[_0xcc14('0x44')][_0xcc14('0x58')]?_0x439fbf[_0xcc14('0x44')]:_0x3061a8[_0xcc14('0x42')];_0x439fbf[_0xcc14('0x46')]=qs['sort'](_0x320b27['query'][_0xcc14('0x47')]);_0x439fbf[_0xcc14('0x48')]=qs[_0xcc14('0x49')](_[_0xcc14('0x4a')](_0x320b27[_0xcc14('0x40')],_0x3061a8[_0xcc14('0x49')]));if(_0x320b27['query'][_0xcc14('0x4b')]){_0x439fbf[_0xcc14('0x48')]=_[_0xcc14('0x4c')](_0x439fbf[_0xcc14('0x48')],{'$or':_[_0xcc14('0x4d')](_0x439fbf['attributes'],function(_0x2c39c7){var _0x342a91={};_0x342a91[_0x2c39c7]={'$like':'%'+_0x320b27[_0xcc14('0x40')]['filter']+'%'};return _0x342a91;})});}_0x439fbf=_[_0xcc14('0x4c')]({},_0x439fbf,_0x320b27[_0xcc14('0x52')]);return _0x3ad8c6[_0xcc14('0xe1')](_0x439fbf);}})[_0xcc14('0x35')](function(_0xd19156){if(_0xd19156){_0x2905bf=_0xd19156[_0xcc14('0x58')];if(!_0x320b27[_0xcc14('0x40')][_0xcc14('0x6a')]('nolimit')){_0x439fbf[_0xcc14('0x31')]=qs[_0xcc14('0x31')](_0x320b27['query']['limit']);_0x439fbf[_0xcc14('0x30')]=qs[_0xcc14('0x30')](_0x320b27[_0xcc14('0x40')]['offset']);}return _0x3ad8c6[_0xcc14('0xe1')](_0x439fbf);}})[_0xcc14('0x35')](function(_0x576db7){if(_0x576db7){return _0x576db7?{'count':_0x2905bf,'rows':_0x576db7}:null;}})[_0xcc14('0x35')](respondWithResult(_0x1abc30,null))[_0xcc14('0x2b')](handleError(_0x1abc30,null));}; \ No newline at end of file +var _0x42cc=['VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','SmsAccountId','Disposition','getDispositions','rawAttributes','merge','removeDispositions','ids','addAnswer','CannedAnswer','findOne','notify','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','From','skebby','sender','text','messageId','plivo','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','SmsInteraction','interaction','created','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','sequelize','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','clicksend','message_id','DELIVERED','groupName','redif','connectel','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','csc','state','message-id','addAgents','spread','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','get','SmsAccounts','destroy','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','map','key'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x42cc,0x8d));var _0xc42c=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x42cc[_0x5e8eae];return _0xdd09cd;};'use strict';var pdf=require(_0xc42c('0x0'));var emlformat=require(_0xc42c('0x1'));var rimraf=require(_0xc42c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc42c('0x3'));var rp=require('request-promise');var moment=require(_0xc42c('0x4'));var BPromise=require(_0xc42c('0x5'));var Mustache=require(_0xc42c('0x6'));var util=require(_0xc42c('0x7'));var path=require('path');var sox=require(_0xc42c('0x8'));var csv=require('to-csv');var ejs=require(_0xc42c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc42c('0xa'));var crypto=require(_0xc42c('0xb'));var jsforce=require(_0xc42c('0xc'));var deskjs=require(_0xc42c('0xd'));var toCsv=require(_0xc42c('0xe'));var querystring=require(_0xc42c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc42c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc42c('0x11'));var db=require('../../mysqldb')['db'];config[_0xc42c('0x12')]=_[_0xc42c('0x13')](config[_0xc42c('0x12')],{'host':_0xc42c('0x14'),'port':0x18eb});var socket=require(_0xc42c('0x15'))(new Redis(config[_0xc42c('0x12')]));require(_0xc42c('0x16'))[_0xc42c('0x17')](socket);var jayson=require(_0xc42c('0x18'));var client=jayson['client']['http']({'port':0x232c});function checkPasswordPattern(_0x4459e0,_0x5741ba,_0x44b641){if(_0x44b641){var _0x2ad36c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ad36c['test'](_0x5741ba)){return _0x4459e0;}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 _0x4459e0;}}function respondWithRpcPromise(_0x1877e1,_0x12e9d5,_0x10d1ad,_0xed66d3){return new BPromise(function(_0x3b5321,_0x41eed4){var _0x5ce54d=_0xed66d3||client;return _0x5ce54d[_0xc42c('0x19')](_0x1877e1,_0x10d1ad)[_0xc42c('0x1a')](function(_0x495740){logger[_0xc42c('0x1b')](_0xc42c('0x1c'),_0x12e9d5,_0xc42c('0x1d'));logger[_0xc42c('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x12e9d5,'request\x20sent',JSON[_0xc42c('0x1f')](_0x495740));if(_0x495740[_0xc42c('0x20')]){if(_0x495740['error'][_0xc42c('0x21')]===0x1f4){logger[_0xc42c('0x20')](_0xc42c('0x1c'),_0x12e9d5,_0x495740['error'][_0xc42c('0x22')]);return _0x41eed4(_0x495740[_0xc42c('0x20')][_0xc42c('0x22')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x12e9d5,_0x495740['error'][_0xc42c('0x22')]);return _0x3b5321(_0x495740[_0xc42c('0x20')][_0xc42c('0x22')]);}else{logger[_0xc42c('0x1b')](_0xc42c('0x1c'),_0x12e9d5,_0xc42c('0x1d'));_0x3b5321(_0x495740['result'][_0xc42c('0x22')]);}})['catch'](function(_0x37227){logger[_0xc42c('0x20')](_0xc42c('0x1c'),_0x12e9d5,_0x37227);_0x41eed4(_0x37227);});});}function respondWithStatusCode(_0x4b5e6d,_0x1141bf){_0x1141bf=_0x1141bf||0xcc;return function(_0x584cd4){if(_0x584cd4){return _0x4b5e6d[_0xc42c('0x23')](_0x1141bf);}return _0x4b5e6d['status'](_0x1141bf)[_0xc42c('0x24')]();};}function respondWithResult(_0x4433e0,_0x4dba6e){_0x4dba6e=_0x4dba6e||0xc8;return function(_0x89dce5){if(_0x89dce5){return _0x4433e0[_0xc42c('0x25')](_0x4dba6e)[_0xc42c('0x26')](_0x89dce5);}};}function respondWithFilteredResult(_0x51ad84,_0x570e07){return function(_0xf89f2b){if(_0xf89f2b){var _0x170aa4=_0xf89f2b[_0xc42c('0x27')],_0x330ab5=_0x570e07['offset'],_0x5596f6=_0x570e07[_0xc42c('0x28')]+_0x570e07['limit'],_0x1ad36b;if(_0x5596f6>=_0x170aa4){_0x5596f6=_0x170aa4;_0x1ad36b=0xc8;}else{_0x1ad36b=0xce;}_0x51ad84[_0xc42c('0x25')](_0x1ad36b);return _0x51ad84[_0xc42c('0x29')](_0xc42c('0x2a'),_0x330ab5+'-'+_0x5596f6+'/'+_0x170aa4)[_0xc42c('0x26')](_0xf89f2b);}return null;};}function patchUpdates(_0x378c0f){return function(_0x39c6a7){try{jsonpatch['apply'](_0x39c6a7,_0x378c0f,!![]);}catch(_0x223c09){return BPromise[_0xc42c('0x2b')](_0x223c09);}return _0x39c6a7[_0xc42c('0x2c')]();};}function saveUpdates(_0xb45196,_0x50a806){return function(_0x26c24e){if(_0x26c24e){return _0x26c24e[_0xc42c('0x2d')](_0xb45196)[_0xc42c('0x1a')](function(_0x3600ac){return _0x3600ac;});}return null;};}function removeEntity(_0xbc77df,_0x232904){return function(_0xe69676){if(_0xe69676){return _0xe69676['destroy']()[_0xc42c('0x1a')](function(){var _0x42967e=_0xe69676[_0xc42c('0x2e')]({'plain':!![]});var _0x4e3475=_0xc42c('0x2f');return db['UserProfileResource'][_0xc42c('0x30')]({'where':{'type':_0x4e3475,'resourceId':_0x42967e['id']}})[_0xc42c('0x1a')](function(){return _0xe69676;});})['then'](function(){_0xbc77df[_0xc42c('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44082f,_0x2f1644){return function(_0x4c58ac){if(!_0x4c58ac){_0x44082f[_0xc42c('0x23')](0x194);}return _0x4c58ac;};}function handleError(_0x45d8c7,_0x1b3eb9){_0x1b3eb9=_0x1b3eb9||0x1f4;return function(_0x2f7a7d){logger[_0xc42c('0x20')](_0x2f7a7d[_0xc42c('0x31')]);if(_0x2f7a7d[_0xc42c('0x32')]){delete _0x2f7a7d['name'];}_0x45d8c7[_0xc42c('0x25')](_0x1b3eb9)['send'](_0x2f7a7d);};}exports[_0xc42c('0x33')]=function(_0x146593,_0x59740c){var _0x55549b={'include':[{'model':db[_0xc42c('0x34')],'as':_0xc42c('0x35')}]},_0x2bc337={},_0x4b77d4={'count':0x0,'rows':[]};var _0x263d68=db[_0xc42c('0x36')]['rawAttributes'];_0x2bc337[_0xc42c('0x37')]=_[_0xc42c('0x38')](_0x263d68);_0x2bc337[_0xc42c('0x39')]=_[_0xc42c('0x38')](_0x146593['query']);_0x2bc337[_0xc42c('0x3a')]=_[_0xc42c('0x3b')](_0x2bc337['model'],_0x2bc337[_0xc42c('0x39')]);_0x55549b['attributes']=_[_0xc42c('0x3b')](_0x2bc337[_0xc42c('0x37')],qs[_0xc42c('0x3c')](_0x146593[_0xc42c('0x39')][_0xc42c('0x3c')]));_0x55549b[_0xc42c('0x3d')]=_0x55549b[_0xc42c('0x3d')]['length']?_0x55549b[_0xc42c('0x3d')]:_0x2bc337[_0xc42c('0x37')];if(!_0x146593[_0xc42c('0x39')][_0xc42c('0x3e')](_0xc42c('0x3f'))){_0x55549b[_0xc42c('0x40')]=qs['limit'](_0x146593[_0xc42c('0x39')]['limit']);_0x55549b['offset']=qs[_0xc42c('0x28')](_0x146593[_0xc42c('0x39')][_0xc42c('0x28')]);}_0x55549b[_0xc42c('0x41')]=qs[_0xc42c('0x42')](_0x146593[_0xc42c('0x39')][_0xc42c('0x42')]);_0x55549b['where']=qs[_0xc42c('0x3a')](_[_0xc42c('0x43')](_0x146593[_0xc42c('0x39')],_0x2bc337['filters']));if(_0x146593['query'][_0xc42c('0x44')]){_0x55549b['where']=_['merge'](_0x55549b[_0xc42c('0x45')],{'$or':_[_0xc42c('0x46')](_0x263d68,function(_0x2e9eb0){if(_0x2e9eb0['type'][_0xc42c('0x47')]!==_0xc42c('0x48')){var _0x388175={};_0x388175[_0x2e9eb0[_0xc42c('0x49')]]={'$like':'%'+_0x146593['query'][_0xc42c('0x44')]+'%'};return _0x388175;}})});}_0x55549b=_['merge']({},_0x55549b,_0x146593[_0xc42c('0x4a')]);var _0x12c319={'where':_0x55549b[_0xc42c('0x45')]};return db['SmsAccount'][_0xc42c('0x27')](_0x12c319)[_0xc42c('0x1a')](function(_0x221df3){_0x4b77d4['count']=_0x221df3;if(_0x146593[_0xc42c('0x39')][_0xc42c('0x4b')]){_0x55549b[_0xc42c('0x4c')]=[{'all':!![]}];}return db['SmsAccount'][_0xc42c('0x4d')](_0x55549b);})[_0xc42c('0x1a')](function(_0x5ed332){_0x4b77d4[_0xc42c('0x4e')]=_0x5ed332;return _0x4b77d4;})[_0xc42c('0x1a')](respondWithFilteredResult(_0x59740c,_0x55549b))[_0xc42c('0x4f')](handleError(_0x59740c,null));};exports[_0xc42c('0x50')]=function(_0x1449bc,_0x4865b2){var _0x190b12={'raw':![],'where':{'id':_0x1449bc[_0xc42c('0x51')]['id']},'include':[{'model':db[_0xc42c('0x34')],'as':_0xc42c('0x35')}]},_0x5e35da={};_0x5e35da[_0xc42c('0x37')]=_[_0xc42c('0x38')](db['SmsAccount']['rawAttributes']);_0x5e35da[_0xc42c('0x39')]=_[_0xc42c('0x38')](_0x1449bc[_0xc42c('0x39')]);_0x5e35da[_0xc42c('0x3a')]=_[_0xc42c('0x3b')](_0x5e35da[_0xc42c('0x37')],_0x5e35da[_0xc42c('0x39')]);_0x190b12['attributes']=_[_0xc42c('0x3b')](_0x5e35da[_0xc42c('0x37')],qs[_0xc42c('0x3c')](_0x1449bc[_0xc42c('0x39')]['fields']));_0x190b12[_0xc42c('0x3d')]=_0x190b12[_0xc42c('0x3d')][_0xc42c('0x52')]?_0x190b12[_0xc42c('0x3d')]:_0x5e35da[_0xc42c('0x37')];if(_0x1449bc['query'][_0xc42c('0x4b')]){_0x190b12[_0xc42c('0x4c')]=[{'all':!![]}];}_0x190b12=_['merge']({},_0x190b12,_0x1449bc[_0xc42c('0x4a')]);return db[_0xc42c('0x36')]['find'](_0x190b12)[_0xc42c('0x1a')](handleEntityNotFound(_0x4865b2,null))[_0xc42c('0x1a')](respondWithResult(_0x4865b2,null))[_0xc42c('0x4f')](handleError(_0x4865b2,null));};exports[_0xc42c('0x53')]=function(_0x7baaee,_0x28292a){return db[_0xc42c('0x36')]['create'](_0x7baaee[_0xc42c('0x54')],{})[_0xc42c('0x1a')](function(_0x4e91fd){var _0x7be98b=_0x7baaee[_0xc42c('0x55')][_0xc42c('0x2e')]({'plain':!![]});if(!_0x7be98b)throw new Error(_0xc42c('0x56'));if(_0x7be98b[_0xc42c('0x57')]===_0xc42c('0x55')){var _0x3277de=_0x4e91fd['get']({'plain':!![]});var _0x857bff='SmsAccounts';return db[_0xc42c('0x58')]['find']({'where':{'name':_0x857bff,'userProfileId':_0x7be98b[_0xc42c('0x59')]},'raw':!![]})[_0xc42c('0x1a')](function(_0x2f50ca){if(_0x2f50ca&&_0x2f50ca[_0xc42c('0x5a')]===0x0){return db[_0xc42c('0x5b')][_0xc42c('0x53')]({'name':_0x3277de['name'],'resourceId':_0x3277de['id'],'type':_0x2f50ca[_0xc42c('0x32')],'sectionId':_0x2f50ca['id']},{})[_0xc42c('0x1a')](function(){return _0x4e91fd;});}else{return _0x4e91fd;}})['catch'](function(_0x243418){logger[_0xc42c('0x20')](_0xc42c('0x5c'),_0x243418);throw _0x243418;});}return _0x4e91fd;})[_0xc42c('0x1a')](respondWithResult(_0x28292a,0xc9))[_0xc42c('0x4f')](handleError(_0x28292a,null));};exports[_0xc42c('0x2d')]=function(_0x3db584,_0x1b8584){if(_0x3db584[_0xc42c('0x54')]['id']){delete _0x3db584['body']['id'];}return db[_0xc42c('0x36')]['find']({'where':{'id':_0x3db584['params']['id']},'include':[{'model':db[_0xc42c('0x34')],'as':_0xc42c('0x35')}]})[_0xc42c('0x1a')](handleEntityNotFound(_0x1b8584,null))[_0xc42c('0x1a')](saveUpdates(_0x3db584[_0xc42c('0x54')],null))[_0xc42c('0x1a')](respondWithResult(_0x1b8584,null))[_0xc42c('0x4f')](handleError(_0x1b8584,null));};exports['destroy']=function(_0x1e96e0,_0x5be875){return db['SmsAccount'][_0xc42c('0x5d')]({'where':{'id':_0x1e96e0[_0xc42c('0x51')]['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x5be875,null))[_0xc42c('0x1a')](removeEntity(_0x5be875,null))['catch'](handleError(_0x5be875,null));};exports[_0xc42c('0x5e')]=function(_0x4f8ced,_0x25b46f){return db[_0xc42c('0x36')][_0xc42c('0x5e')]()[_0xc42c('0x1a')](respondWithResult(_0x25b46f,null))[_0xc42c('0x4f')](handleError(_0x25b46f,null));};exports['addDisposition']=function(_0x3d0787,_0x163c9f,_0x26d66b){if(_0x3d0787[_0xc42c('0x54')]['id']){delete _0x3d0787[_0xc42c('0x54')]['id'];}return db[_0xc42c('0x36')]['find']({'where':{'id':_0x3d0787['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x163c9f,null))[_0xc42c('0x1a')](function(_0x3fa330){if(_0x3fa330){_0x3d0787[_0xc42c('0x54')][_0xc42c('0x5f')]=_0x3fa330['id'];return db[_0xc42c('0x60')][_0xc42c('0x53')](_0x3d0787[_0xc42c('0x54')]);}})['then'](respondWithResult(_0x163c9f,null))[_0xc42c('0x4f')](handleError(_0x163c9f,null));};exports[_0xc42c('0x61')]=function(_0x98a08e,_0x5bdca7,_0x44fd79){var _0x319be3={'raw':![],'where':{}};var _0x230996={};var _0x1d5647={'count':0x0,'rows':[]};return db[_0xc42c('0x36')]['findOne']({'where':{'id':_0x98a08e['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x5bdca7,null))['then'](function(_0x197cfb){if(_0x197cfb){_0x230996['model']=_['keys'](db[_0xc42c('0x60')][_0xc42c('0x62')]);_0x230996['query']=_[_0xc42c('0x38')](_0x98a08e[_0xc42c('0x39')]);_0x230996[_0xc42c('0x3a')]=_[_0xc42c('0x3b')](_0x230996['model'],_0x230996[_0xc42c('0x39')]);_0x319be3[_0xc42c('0x3d')]=_['intersection'](_0x230996[_0xc42c('0x37')],qs[_0xc42c('0x3c')](_0x98a08e['query'][_0xc42c('0x3c')]));_0x319be3[_0xc42c('0x3d')]=_0x319be3[_0xc42c('0x3d')][_0xc42c('0x52')]?_0x319be3[_0xc42c('0x3d')]:_0x230996[_0xc42c('0x37')];if(!_0x98a08e[_0xc42c('0x39')][_0xc42c('0x3e')](_0xc42c('0x3f'))){_0x319be3[_0xc42c('0x40')]=qs['limit'](_0x98a08e[_0xc42c('0x39')][_0xc42c('0x40')]);_0x319be3[_0xc42c('0x28')]=qs['offset'](_0x98a08e[_0xc42c('0x39')]['offset']);}_0x319be3[_0xc42c('0x41')]=qs[_0xc42c('0x42')](_0x98a08e[_0xc42c('0x39')][_0xc42c('0x42')]);_0x319be3[_0xc42c('0x45')]=qs[_0xc42c('0x3a')](_[_0xc42c('0x43')](_0x98a08e[_0xc42c('0x39')],_0x230996[_0xc42c('0x3a')]));_0x319be3[_0xc42c('0x45')][_0xc42c('0x5f')]=_0x197cfb['id'];if(_0x98a08e[_0xc42c('0x39')]['filter']){_0x319be3[_0xc42c('0x45')]=_[_0xc42c('0x63')](_0x319be3[_0xc42c('0x45')],{'$or':_['map'](_0x319be3[_0xc42c('0x3d')],function(_0x3a74f6){var _0x233bbd={};_0x233bbd[_0x3a74f6]={'$like':'%'+_0x98a08e[_0xc42c('0x39')]['filter']+'%'};return _0x233bbd;})});}_0x319be3=_[_0xc42c('0x63')]({},_0x319be3,_0x98a08e[_0xc42c('0x4a')]);return db['Disposition']['count']({'where':_0x319be3[_0xc42c('0x45')]})['then'](function(_0x1cd126){_0x1d5647['count']=_0x1cd126;if(_0x98a08e[_0xc42c('0x39')]['includeAll']){_0x319be3['include']=[{'all':!![]}];}return db[_0xc42c('0x60')][_0xc42c('0x4d')](_0x319be3);})[_0xc42c('0x1a')](function(_0x7d788){_0x1d5647[_0xc42c('0x4e')]=_0x7d788;return _0x1d5647;});}})[_0xc42c('0x1a')](respondWithFilteredResult(_0x5bdca7,_0x319be3))[_0xc42c('0x4f')](handleError(_0x5bdca7,null));};exports[_0xc42c('0x64')]=function(_0x5a0ad5,_0x595874,_0x3a5880){return db['SmsAccount'][_0xc42c('0x5d')]({'where':{'id':_0x5a0ad5[_0xc42c('0x51')]['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x595874,null))[_0xc42c('0x1a')](function(_0x3d027b){if(_0x3d027b){return _0x3d027b[_0xc42c('0x64')](_0x5a0ad5[_0xc42c('0x39')][_0xc42c('0x65')]);}})[_0xc42c('0x1a')](respondWithStatusCode(_0x595874,null))[_0xc42c('0x4f')](handleError(_0x595874,null));};exports[_0xc42c('0x66')]=function(_0x3e09a7,_0x47ecca,_0x3d9770){if(_0x3e09a7['body']['id']){delete _0x3e09a7[_0xc42c('0x54')]['id'];}return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0x3e09a7['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x47ecca,null))[_0xc42c('0x1a')](function(_0x46f5c9){if(_0x46f5c9){_0x3e09a7['body'][_0xc42c('0x5f')]=_0x46f5c9['id'];return db[_0xc42c('0x67')][_0xc42c('0x53')](_0x3e09a7[_0xc42c('0x54')]);}})[_0xc42c('0x1a')](respondWithResult(_0x47ecca,null))['catch'](handleError(_0x47ecca,null));};exports['getAnswers']=function(_0x24bd19,_0x264c54,_0x473d84){var _0x3437c2={'raw':![],'where':{}};var _0x57e745={};var _0x48e8ea={'count':0x0,'rows':[]};return db[_0xc42c('0x36')][_0xc42c('0x68')]({'where':{'id':_0x24bd19['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x264c54,null))[_0xc42c('0x1a')](function(_0x1647f2){if(_0x1647f2){_0x57e745[_0xc42c('0x37')]=_[_0xc42c('0x38')](db['CannedAnswer'][_0xc42c('0x62')]);_0x57e745[_0xc42c('0x39')]=_[_0xc42c('0x38')](_0x24bd19['query']);_0x57e745['filters']=_[_0xc42c('0x3b')](_0x57e745[_0xc42c('0x37')],_0x57e745[_0xc42c('0x39')]);_0x3437c2['attributes']=_['intersection'](_0x57e745['model'],qs['fields'](_0x24bd19[_0xc42c('0x39')][_0xc42c('0x3c')]));_0x3437c2[_0xc42c('0x3d')]=_0x3437c2['attributes'][_0xc42c('0x52')]?_0x3437c2[_0xc42c('0x3d')]:_0x57e745[_0xc42c('0x37')];if(!_0x24bd19[_0xc42c('0x39')][_0xc42c('0x3e')](_0xc42c('0x3f'))){_0x3437c2[_0xc42c('0x40')]=qs[_0xc42c('0x40')](_0x24bd19[_0xc42c('0x39')][_0xc42c('0x40')]);_0x3437c2[_0xc42c('0x28')]=qs[_0xc42c('0x28')](_0x24bd19[_0xc42c('0x39')]['offset']);}_0x3437c2['order']=qs[_0xc42c('0x42')](_0x24bd19[_0xc42c('0x39')][_0xc42c('0x42')]);_0x3437c2[_0xc42c('0x45')]=qs[_0xc42c('0x3a')](_[_0xc42c('0x43')](_0x24bd19[_0xc42c('0x39')],_0x57e745['filters']));_0x3437c2['where'][_0xc42c('0x5f')]=_0x1647f2['id'];if(_0x24bd19['query']['filter']){_0x3437c2[_0xc42c('0x45')]=_['merge'](_0x3437c2[_0xc42c('0x45')],{'$or':_[_0xc42c('0x46')](_0x3437c2[_0xc42c('0x3d')],function(_0x576ac1){var _0x1774b7={};_0x1774b7[_0x576ac1]={'$like':'%'+_0x24bd19[_0xc42c('0x39')]['filter']+'%'};return _0x1774b7;})});}_0x3437c2=_[_0xc42c('0x63')]({},_0x3437c2,_0x24bd19[_0xc42c('0x4a')]);return db[_0xc42c('0x67')]['count']({'where':_0x3437c2['where']})['then'](function(_0x1f7b04){_0x48e8ea[_0xc42c('0x27')]=_0x1f7b04;if(_0x24bd19[_0xc42c('0x39')]['includeAll']){_0x3437c2[_0xc42c('0x4c')]=[{'all':!![]}];}return db[_0xc42c('0x67')][_0xc42c('0x4d')](_0x3437c2);})[_0xc42c('0x1a')](function(_0x28b8ec){_0x48e8ea['rows']=_0x28b8ec;return _0x48e8ea;});}})[_0xc42c('0x1a')](respondWithFilteredResult(_0x264c54,_0x3437c2))[_0xc42c('0x4f')](handleError(_0x264c54,null));};exports['removeAnswers']=function(_0xf40b9a,_0x485d4d,_0xf5630){return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0xf40b9a['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x485d4d,null))[_0xc42c('0x1a')](function(_0x41f26f){if(_0x41f26f){return _0x41f26f['removeAnswers'](_0xf40b9a['query'][_0xc42c('0x65')]);}})['then'](respondWithStatusCode(_0x485d4d,null))[_0xc42c('0x4f')](handleError(_0x485d4d,null));};exports[_0xc42c('0x69')]=function(_0x292b89,_0x476c20,_0x422b9a){var _0x1d5f6d={'channel':'sms'};var _0x27efc7=[];var _0x350946=[];var _0x246e30={};return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0x292b89['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xc42c('0x6a')}]})['then'](handleEntityNotFound(_0x476c20,null))[_0xc42c('0x1a')](function(_0x3183cd){_0x1d5f6d[_0xc42c('0x6b')]=_0x3183cd;_0x1d5f6d[_0xc42c('0x6c')]=_['orderBy'](_0x3183cd['Applications'],['priority'],[_0xc42c('0x6d')]);if(_0x1d5f6d[_0xc42c('0x6b')][_0xc42c('0x6a')]){delete _0x1d5f6d[_0xc42c('0x6b')][_0xc42c('0x6a')];}return db[_0xc42c('0x6e')]['describe']();})['then'](function(_0x6ae1e6){if(!_0x6ae1e6){throw new db[(_0xc42c('0x6f'))][(_0xc42c('0x70'))](_0xc42c('0x71'));}_0x27efc7=_[_0xc42c('0x72')](_['keys'](_0x6ae1e6),[_0xc42c('0x73'),'updatedAt']);_0x350946=_[_0xc42c('0x72')](_[_0xc42c('0x38')](_0x6ae1e6),[_0xc42c('0x73'),_0xc42c('0x74'),_0xc42c('0x75'),_0xc42c('0x76')]);_0x1d5f6d[_0xc42c('0x54')]={'mapKey':_0xc42c('0x77')};if(_0x1d5f6d[_0xc42c('0x6b')][_0xc42c('0x78')]){switch(_0x1d5f6d[_0xc42c('0x6b')][_0xc42c('0x78')]){case _0xc42c('0x79'):_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')]=_0x292b89['body'][_0xc42c('0x7b')];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')]['Body'];_0x1d5f6d['body']['messageId']=_0x292b89['body']['MessageSid'];break;case _0xc42c('0x7c'):_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')]='+'+_0x292b89[_0xc42c('0x54')][_0xc42c('0x7d')];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x7e')];break;case'connectel':_0x1d5f6d[_0xc42c('0x54')]['from']=_0x292b89[_0xc42c('0x54')][_0xc42c('0x7a')];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')]['message'];break;case'clicksend':_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x7a')];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')]['body'];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7f')]=_0x292b89[_0xc42c('0x54')]['message_id'];break;case _0xc42c('0x80'):_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x7b')];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')]['Text'];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7f')]=_0x292b89['body'][_0xc42c('0x81')];break;case _0xc42c('0x82'):_0x1d5f6d['body'][_0xc42c('0x7a')]='+'+_0x292b89['body'][_0xc42c('0x83')][0x0]['from'];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')]['results'][0x0][_0xc42c('0x7e')];_0x1d5f6d['body'][_0xc42c('0x7f')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x83')][0x0][_0xc42c('0x7f')];break;case'csc':_0x1d5f6d[_0xc42c('0x54')]['from']=_0x292b89[_0xc42c('0x54')][_0xc42c('0x84')];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x85')][_0xc42c('0x22')];break;case _0xc42c('0x86'):_0x1d5f6d['body'][_0xc42c('0x7a')]=_0x292b89[_0xc42c('0x54')]['fromNumber'];_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x7e')];_0x1d5f6d[_0xc42c('0x54')]['messageId']=_0x292b89['body'][_0xc42c('0x87')];break;case _0xc42c('0x88'):_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x7a')];_0x1d5f6d['body'][_0xc42c('0x54')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x22')];_0x1d5f6d['body'][_0xc42c('0x7f')]=_0x292b89[_0xc42c('0x54')][_0xc42c('0x89')];break;}}if(_0x1d5f6d['body']['id']){delete _0x1d5f6d[_0xc42c('0x54')]['id'];}if(_[_0xc42c('0x8a')](_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')])){throw new db[(_0xc42c('0x6f'))][(_0xc42c('0x70'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')])||_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')]===''){throw new db[(_0xc42c('0x6f'))][(_0xc42c('0x70'))](_0xc42c('0x8b'));}if(_[_0xc42c('0x8a')](_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x8c')])){throw new db['Sequelize'][(_0xc42c('0x70'))](_0xc42c('0x8d')+_0x350946);}if(!_[_0xc42c('0x8e')](_0x350946,_0x1d5f6d['body'][_0xc42c('0x8c')])){throw new db[(_0xc42c('0x6f'))][(_0xc42c('0x70'))](_0xc42c('0x8f')+_0x350946);}_0x246e30[_0x1d5f6d['body'][_0xc42c('0x8c')]]=_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')];return db[_0xc42c('0x90')]['find']({'where':{'id':_0x1d5f6d[_0xc42c('0x6b')][_0xc42c('0x76')]},'include':[{'model':db[_0xc42c('0x6e')],'as':_0xc42c('0x91'),'where':_0x246e30,'limit':0x1,'order':[[_0xc42c('0x74'),'DESC']]}]});})[_0xc42c('0x1a')](handleEntityNotFound(_0x476c20,null))['then'](function(_0x3e370f){if(_0x3e370f){_0x1d5f6d[_0xc42c('0x92')]=_['omit'](_0x3e370f,['Contacts']);if(_0x3e370f['Contacts']['length']){return _0x3e370f[_0xc42c('0x91')][0x0];}var _0x2d77c1=_[_0xc42c('0x13')](_0x1d5f6d[_0xc42c('0x54')],{'firstName':_0x1d5f6d['body']['from'],'ListId':_0x3e370f['id']});_0x2d77c1[_0x1d5f6d['body'][_0xc42c('0x8c')]]=_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7a')];return db[_0xc42c('0x6e')][_0xc42c('0x53')](_0x2d77c1,{'fields':_0x27efc7,'raw':!![]});}})[_0xc42c('0x1a')](handleEntityNotFound(_0x476c20,null))[_0xc42c('0x1a')](function(_0x187a53){if(_0x187a53){_0x1d5f6d[_0xc42c('0x93')]=_0x187a53;var _0x33af33={'ContactId':_0x187a53['id'],'phone':_0x1d5f6d['body'][_0xc42c('0x7a')],'SmsAccountId':_0x292b89[_0xc42c('0x51')]['id']};var _0x525ace={'ContactId':_0x187a53['id'],'SmsAccountId':_0x292b89['params']['id'],'closed':![]};return db[_0xc42c('0x94')]['find']({'where':_0x525ace})['then'](function(_0x17cee3){if(_0x17cee3){return[_0x17cee3,![]];}return db[_0xc42c('0x94')][_0xc42c('0x53')](_0x33af33)['then'](function(_0x4d2b0d){return[_0x4d2b0d,!![]];});});}})['spread'](function(_0x52b524,_0x4ea69f){_0x1d5f6d[_0xc42c('0x95')]=_0x52b524[_0xc42c('0x2e')]({'plain':!![]});_0x1d5f6d[_0xc42c('0x95')][_0xc42c('0x96')]=![];if(_0x4ea69f){if(_0x1d5f6d[_0xc42c('0x6b')]['autoclose']){_0x1d5f6d[_0xc42c('0x6c')]['push']({'id':0x0,'priority':_0x1d5f6d[_0xc42c('0x6c')][_0xc42c('0x52')]+0x1,'app':_0xc42c('0x97'),'appdata':'unmanaged','interval':_0xc42c('0x98')});}_0x1d5f6d[_0xc42c('0x95')][_0xc42c('0x96')]=!![];}return db[_0xc42c('0x99')]['create']({'phone':_0x1d5f6d['body']['from'],'messageId':_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x7f')],'body':_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x54')],'SmsAccountId':_0x292b89[_0xc42c('0x51')]['id'],'SmsInteractionId':_0x52b524['id'],'direction':'in','ContactId':_0x52b524[_0xc42c('0x9a')],'AttachmentId':_0x1d5f6d[_0xc42c('0x54')][_0xc42c('0x9b')]});})[_0xc42c('0x1a')](function(_0x2f3ac5){_0x1d5f6d[_0xc42c('0x22')]=_0x2f3ac5;if(_0x1d5f6d[_0xc42c('0x95')]['UserId']){return db[_0xc42c('0x9c')][_0xc42c('0x5d')]({'attributes':['id',_0xc42c('0x32')],'where':{'id':_0x1d5f6d[_0xc42c('0x95')][_0xc42c('0x9d')]}})[_0xc42c('0x1a')](function(_0x414bcb){if(_0x414bcb){_0x1d5f6d[_0xc42c('0x6c')][_0xc42c('0x9e')]({'id':0x0,'priority':0x0,'app':_0xc42c('0x9f'),'appdata':_0x414bcb['name']+','+(_0x1d5f6d[_0xc42c('0x6b')][_0xc42c('0xa0')]||0xa),'interval':_0xc42c('0x98')});}return respondWithRpcPromise(_0xc42c('0xa1'),_0xc42c('0xa2'),_0x1d5f6d);});}return respondWithRpcPromise('Start',_0xc42c('0xa2'),_0x1d5f6d);})[_0xc42c('0x1a')](function(_0x446c2a){if(_0x446c2a){var _0x3ea55f=0xc8;var _0x5ba20d=_0xc42c('0xa3');logger[_0xc42c('0x1b')](_0xc42c('0xa4'),_0x5ba20d,_0x3ea55f,'entity\x20found');logger[_0xc42c('0x1e')](_0xc42c('0xa5'),_0x5ba20d,_0x3ea55f,'entity\x20found',JSON['stringify'](_0x446c2a));if(_0x1d5f6d[_0xc42c('0x6b')]['type']===_0xc42c('0x79')){return _0x476c20[_0xc42c('0x25')](_0x3ea55f)['set'](_0xc42c('0xa6'),_0xc42c('0xa7'))[_0xc42c('0xa8')]('\x0a');}else{return _0x476c20['status'](_0x3ea55f)[_0xc42c('0x26')](_0x446c2a);}}})[_0xc42c('0x4f')](handleError(_0x476c20,null));};exports['addApplications']=function(_0x8c1fa0,_0xfdbc26,_0xf2c11e){return db['SmsAccount'][_0xc42c('0x68')]({'where':{'id':_0x8c1fa0[_0xc42c('0x51')]['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0xfdbc26,null))[_0xc42c('0x1a')](function(_0x2d88fd){if(_0x2d88fd){return db[_0xc42c('0xa9')]['transaction'](function(_0xc6b147){return db['SmsApplication'][_0xc42c('0x30')]({'where':{'SmsAccountId':_0x8c1fa0['params']['id']},'transaction':_0xc6b147})['then'](function(_0x5c32b4){var _0x985c2f=_['map'](_0x8c1fa0[_0xc42c('0x54')],function(_0x5f5032){_0x5f5032[_0xc42c('0x5f')]=_0x8c1fa0[_0xc42c('0x51')]['id'];return _0x5f5032;});return db[_0xc42c('0xaa')][_0xc42c('0xab')](_0x985c2f,{'transaction':_0xc6b147});});})[_0xc42c('0x1a')](function(){return db[_0xc42c('0xaa')][_0xc42c('0xac')]({'where':{'SmsAccountId':_0x8c1fa0[_0xc42c('0x51')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0xfdbc26,null))[_0xc42c('0x4f')](handleError(_0xfdbc26,null));};exports[_0xc42c('0xad')]=function(_0x23fcb9,_0x142cbe,_0x56a74b){var _0x48b721={};var _0x18966c={};var _0x37e55f;var _0x3625bf;return db['SmsAccount'][_0xc42c('0x68')]({'where':{'id':_0x23fcb9['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x142cbe,null))[_0xc42c('0x1a')](function(_0x295af0){if(_0x295af0){_0x37e55f=_0x295af0;_0x18966c['model']=_[_0xc42c('0x38')](db[_0xc42c('0xaa')][_0xc42c('0x62')]);_0x18966c[_0xc42c('0x39')]=_['keys'](_0x23fcb9[_0xc42c('0x39')]);_0x18966c[_0xc42c('0x3a')]=_[_0xc42c('0x3b')](_0x18966c[_0xc42c('0x37')],_0x18966c[_0xc42c('0x39')]);_0x48b721['attributes']=_[_0xc42c('0x3b')](_0x18966c[_0xc42c('0x37')],qs['fields'](_0x23fcb9[_0xc42c('0x39')][_0xc42c('0x3c')]));_0x48b721[_0xc42c('0x3d')]=_0x48b721[_0xc42c('0x3d')][_0xc42c('0x52')]?_0x48b721['attributes']:_0x18966c['model'];_0x48b721[_0xc42c('0x41')]=qs[_0xc42c('0x42')](_0x23fcb9[_0xc42c('0x39')][_0xc42c('0x42')]);_0x48b721[_0xc42c('0x45')]=qs[_0xc42c('0x3a')](_[_0xc42c('0x43')](_0x23fcb9[_0xc42c('0x39')],_0x18966c[_0xc42c('0x3a')]));if(_0x23fcb9[_0xc42c('0x39')][_0xc42c('0x44')]){_0x48b721[_0xc42c('0x45')]=_[_0xc42c('0x63')](_0x48b721['where'],{'$or':_[_0xc42c('0x46')](_0x48b721['attributes'],function(_0x4b1ab7){var _0x557d85={};_0x557d85[_0x4b1ab7]={'$like':'%'+_0x23fcb9[_0xc42c('0x39')][_0xc42c('0x44')]+'%'};return _0x557d85;})});}_0x48b721=_[_0xc42c('0x63')]({},_0x48b721,_0x23fcb9[_0xc42c('0x4a')]);return _0x37e55f['getApplications'](_0x48b721);}})['then'](function(_0x413da5){if(_0x413da5){_0x3625bf=_0x413da5[_0xc42c('0x52')];if(!_0x23fcb9['query'][_0xc42c('0x3e')]('nolimit')){_0x48b721[_0xc42c('0x40')]=qs[_0xc42c('0x40')](_0x23fcb9[_0xc42c('0x39')][_0xc42c('0x40')]);_0x48b721['offset']=qs[_0xc42c('0x28')](_0x23fcb9['query'][_0xc42c('0x28')]);}return _0x37e55f['getApplications'](_0x48b721);}})['then'](function(_0x310480){if(_0x310480){return _0x310480?{'count':_0x3625bf,'rows':_0x310480}:null;}})[_0xc42c('0x1a')](respondWithResult(_0x142cbe,null))[_0xc42c('0x4f')](handleError(_0x142cbe,null));};exports[_0xc42c('0xae')]=function(_0x553c0f,_0x5f605,_0xb00cdc){var _0x59bdfd={'raw':![],'where':{}};var _0x5847cd={};var _0x2b1d94={'count':0x0,'rows':[]};return db[_0xc42c('0x36')][_0xc42c('0x68')]({'where':{'id':_0x553c0f['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x5f605,null))[_0xc42c('0x1a')](function(_0x506e71){if(_0x506e71){_0x5847cd[_0xc42c('0x37')]=_[_0xc42c('0x38')](db[_0xc42c('0x94')][_0xc42c('0x62')]);_0x5847cd[_0xc42c('0x39')]=_['keys'](_0x553c0f[_0xc42c('0x39')]);_0x5847cd[_0xc42c('0x3a')]=_[_0xc42c('0x3b')](_0x5847cd[_0xc42c('0x37')],_0x5847cd[_0xc42c('0x39')]);_0x59bdfd['attributes']=_[_0xc42c('0x3b')](_0x5847cd[_0xc42c('0x37')],qs[_0xc42c('0x3c')](_0x553c0f[_0xc42c('0x39')][_0xc42c('0x3c')]));_0x59bdfd[_0xc42c('0x3d')]=_0x59bdfd[_0xc42c('0x3d')]['length']?_0x59bdfd[_0xc42c('0x3d')]:_0x5847cd[_0xc42c('0x37')];if(!_0x553c0f[_0xc42c('0x39')]['hasOwnProperty'](_0xc42c('0x3f'))){_0x59bdfd[_0xc42c('0x40')]=qs[_0xc42c('0x40')](_0x553c0f[_0xc42c('0x39')][_0xc42c('0x40')]);_0x59bdfd[_0xc42c('0x28')]=qs['offset'](_0x553c0f[_0xc42c('0x39')][_0xc42c('0x28')]);}_0x59bdfd[_0xc42c('0x41')]=qs[_0xc42c('0x42')](_0x553c0f['query'][_0xc42c('0x42')]);_0x59bdfd['where']=qs['filters'](_[_0xc42c('0x43')](_0x553c0f[_0xc42c('0x39')],_0x5847cd[_0xc42c('0x3a')]));_0x59bdfd[_0xc42c('0x45')][_0xc42c('0x5f')]=_0x506e71['id'];if(_0x553c0f[_0xc42c('0x39')][_0xc42c('0x44')]){_0x59bdfd[_0xc42c('0x45')]=_[_0xc42c('0x63')](_0x59bdfd['where'],{'$or':_[_0xc42c('0x46')](_0x59bdfd[_0xc42c('0x3d')],function(_0x1f6c00){var _0x32d8db={};_0x32d8db[_0x1f6c00]={'$like':'%'+_0x553c0f[_0xc42c('0x39')][_0xc42c('0x44')]+'%'};return _0x32d8db;})});}_0x59bdfd=_[_0xc42c('0x63')]({},_0x59bdfd,_0x553c0f['options']);return db[_0xc42c('0x94')][_0xc42c('0x27')]({'where':_0x59bdfd['where']})[_0xc42c('0x1a')](function(_0x5b70bb){_0x2b1d94[_0xc42c('0x27')]=_0x5b70bb;if(_0x553c0f[_0xc42c('0x39')][_0xc42c('0x4b')]){_0x59bdfd[_0xc42c('0x4c')]=[{'model':db[_0xc42c('0x6e')],'as':_0xc42c('0xaf'),'required':![]},{'model':db['User'],'as':_0xc42c('0xb0'),'attributes':['name',_0xc42c('0xb1'),_0xc42c('0xb2')],'required':![]},{'model':db[_0xc42c('0xb3')],'as':'Tags','attributes':['id','name',_0xc42c('0xb4')],'where':_0x553c0f[_0xc42c('0x39')][_0xc42c('0xb5')]?{'id':_0x553c0f[_0xc42c('0x39')][_0xc42c('0xb5')]}:undefined,'required':_0x553c0f['query'][_0xc42c('0xb5')]?!![]:![]}];}return db[_0xc42c('0x94')][_0xc42c('0x4d')](_0x59bdfd);})[_0xc42c('0x1a')](function(_0x5626df){_0x2b1d94[_0xc42c('0x4e')]=_0x5626df;return _0x2b1d94;});}})['then'](respondWithFilteredResult(_0x5f605,_0x59bdfd))[_0xc42c('0x4f')](handleError(_0x5f605,null));};exports[_0xc42c('0xa8')]=function(_0x1f720d,_0x4b9be2,_0x309133){var _0x2ab725,_0x71a13c,_0x1cd499;if(_[_0xc42c('0x8a')](_0x1f720d['body'][_0xc42c('0x54')])||_0x1f720d[_0xc42c('0x54')][_0xc42c('0x54')]===''){throw new db[(_0xc42c('0x6f'))][(_0xc42c('0x70'))](_0xc42c('0x8b'));}if(_[_0xc42c('0x8a')](_0x1f720d[_0xc42c('0x54')]['to'])){throw new db['Sequelize'][(_0xc42c('0x70'))](_0xc42c('0xb6'));}_0x2ab725=_0x1f720d[_0xc42c('0x54')]['to'];return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0x1f720d[_0xc42c('0x51')]['id']},'include':[{'model':db[_0xc42c('0x90')],'as':_0xc42c('0xb7'),'include':[{'model':db['CmContact'],'as':_0xc42c('0x91'),'where':{'mobile':_0x2ab725},'limit':0x1,'order':[['updatedAt',_0xc42c('0xb8')]]}]}]})[_0xc42c('0x1a')](handleEntityNotFound(_0x4b9be2,null))['then'](function(_0x1b4f59){if(_0x1b4f59&&_0x1b4f59['List']){_0x71a13c=_0x1b4f59[_0xc42c('0x2e')]({'plain':!![]});if(_0x71a13c['List']&&_0x71a13c[_0xc42c('0xb7')][_0xc42c('0x91')][_0xc42c('0x52')]){return _0x71a13c[_0xc42c('0xb7')][_0xc42c('0x91')][0x0];}return db[_0xc42c('0x6e')][_0xc42c('0x53')](_[_0xc42c('0x13')](_0x1f720d['body'],{'firstName':_0x2ab725,'mobile':_0x2ab725,'phone':_0x2ab725,'ListId':_0x71a13c['ListId']}));}})[_0xc42c('0x1a')](handleEntityNotFound(_0x4b9be2,null))[_0xc42c('0x1a')](function(_0x436137){if(_0x436137){_0x1cd499=_0x436137;return db[_0xc42c('0x94')]['find']({'where':{'ContactId':_0x1cd499['id'],'closed':![],'SmsAccountId':_0x71a13c['id']}})['then'](function(_0x393585){if(_0x393585){return[_0x393585,![]];}return db['SmsInteraction'][_0xc42c('0x53')]({'UserId':_0x1f720d[_0xc42c('0x55')]['id'],'ContactId':_0x1cd499['id'],'SmsAccountId':_0x71a13c['id'],'phone':_0x2ab725,'firstMsgDirection':_0xc42c('0xb9'),'Messages':[_['merge'](_0x1f720d['body'],{'read':![],'body':_0x1f720d['body'][_0xc42c('0x54')],'phone':_0x2ab725,'SmsAccountId':_0x71a13c['id'],'UserId':_0x1f720d[_0xc42c('0x55')]['id'],'ContactId':_0x1cd499['id']})]},{'include':[{'model':db[_0xc42c('0x99')],'as':'Messages'}]})[_0xc42c('0x1a')](function(_0x533fad){return[_0x533fad,!![]];});});}})['spread'](function(_0x35c6c1,_0x3bc594){if(_0x3bc594){return _0x35c6c1;}return db[_0xc42c('0x99')][_0xc42c('0x53')](_[_0xc42c('0x63')](_0x1f720d[_0xc42c('0x54')],{'read':![],'body':_0x1f720d[_0xc42c('0x54')][_0xc42c('0x54')],'phone':_0x2ab725,'SmsAccountId':_0x71a13c['id'],'SmsInteractionId':_0x35c6c1['id'],'UserId':_0x1f720d[_0xc42c('0x55')]['id'],'ContactId':_0x1cd499['id']}))[_0xc42c('0x1a')](function(_0x346538){_0x35c6c1['dataValues'][_0xc42c('0xba')]=[];_0x35c6c1['dataValues'][_0xc42c('0xba')]['push'](_0x346538[_0xc42c('0xbb')]);return _0x35c6c1;});})[_0xc42c('0x1a')](respondWithResult(_0x4b9be2,null))['catch'](handleError(_0x4b9be2,null));};exports['status']=function(_0x3c29eb,_0x3f788c,_0x468600){if(_0x3c29eb[_0xc42c('0x54')]['id']){delete _0x3c29eb[_0xc42c('0x54')]['id'];}console[_0xc42c('0xbc')](_0xc42c('0xbd'),_0x3c29eb[_0xc42c('0x54')]);var _0x45a76a,_0x3bfde8,_0x1fb859;return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0x3c29eb['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x3f788c,null))['then'](function(_0x450a79){if(_0x450a79){_0x1fb859=_0x450a79;logger['debug'](_0xc42c('0xa4'),'status',_0xc42c('0xbe'),_0x450a79['type'],util[_0xc42c('0xbf')](_0x3c29eb[_0xc42c('0x54')],{'showHidden':![],'depth':null}));switch(_0x450a79[_0xc42c('0x78')]){case _0xc42c('0x7c'):if(_0x3c29eb[_0xc42c('0x54')][_0xc42c('0xc0')]&&_0x3c29eb['body'][_0xc42c('0x25')]){_0x3bfde8=_0x3c29eb['body'][_0xc42c('0x25')];return db['SmsMessage'][_0xc42c('0x5d')]({'where':{'messageId':_0x3c29eb[_0xc42c('0x54')][_0xc42c('0xc0')]}});}break;case'connectel':if(_0x3c29eb[_0xc42c('0x54')]['requestid']&&_0x3c29eb['body']['statusInt']){_0x3bfde8=_0x3c29eb[_0xc42c('0x54')][_0xc42c('0xc1')];return db[_0xc42c('0x99')][_0xc42c('0x5d')]({'where':{'messageId':_0x3c29eb['body']['requestid']}});}break;case _0xc42c('0xc2'):if(_0x3c29eb[_0xc42c('0x54')][_0xc42c('0xc3')]&&_0x3c29eb[_0xc42c('0x54')]['status_code']){_0x3bfde8=_0x3c29eb['body']['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x3c29eb[_0xc42c('0x54')][_0xc42c('0xc3')]}});}break;case _0xc42c('0x82'):var _0x57df0c=_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x83')][0x0];if(_0x57df0c[_0xc42c('0x7f')]&&_0x57df0c['status']['groupName']===_0xc42c('0xc4')){_0x3bfde8=_0x57df0c[_0xc42c('0x25')][_0xc42c('0xc5')];return db['SmsMessage'][_0xc42c('0x5d')]({'where':{'messageId':_0x57df0c[_0xc42c('0x7f')]}});}break;case _0xc42c('0x86'):if(_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x7f')]&&_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x25')]){_0x3bfde8=_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x25')];return db[_0xc42c('0x99')]['find']({'where':{'messageId':_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x7f')]}});}break;case _0xc42c('0x88'):if(_0x3c29eb[_0xc42c('0x54')]['redif']&&_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x25')]){_0x3bfde8=_0x3c29eb[_0xc42c('0x54')][_0xc42c('0x25')];return db[_0xc42c('0x99')][_0xc42c('0x5d')]({'where':{'messageId':_0x3c29eb[_0xc42c('0x54')][_0xc42c('0xc6')]}});}break;}}})[_0xc42c('0x1a')](handleEntityNotFound(_0x3f788c,null))[_0xc42c('0x1a')](function(_0xc91259){if(_0xc91259){_0x45a76a=_0xc91259;switch(_0x1fb859[_0xc42c('0x78')]){case _0xc42c('0x7c'):if(_0x3bfde8===_0xc42c('0xc4')){return _0x45a76a[_0xc42c('0x2d')]({'read':!![]});}else{logger[_0xc42c('0x20')](_0xc42c('0xa4'),_0xc42c('0x25'),_0xc42c('0x7c'),util[_0xc42c('0xbf')](_0x3c29eb['body'],{'showHidden':![],'depth':null}));}break;case _0xc42c('0xc7'):if(_0x3bfde8==='1'){return _0x45a76a[_0xc42c('0x2d')]({'read':!![]});}else{logger[_0xc42c('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc42c('0x25'),_0xc42c('0x7c'),util['inspect'](_0x3c29eb['body'],{'showHidden':![],'depth':null}));}break;case _0xc42c('0xc2'):if(!_0x3c29eb[_0xc42c('0x54')]['error_code']&&_0x3bfde8>=0xc8&&_0x3bfde8<=0xce){return _0x45a76a[_0xc42c('0x2d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xc42c('0xc2'),util[_0xc42c('0xbf')](_0x3c29eb['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1b1d84=_0x3c29eb[_0xc42c('0x54')]['results'][0x0];if(_0x1b1d84['status'][_0xc42c('0xc5')]===_0xc42c('0xc4')){return _0x45a76a[_0xc42c('0x2d')]({'read':!![]});}else{logger['error'](_0xc42c('0xa4'),_0xc42c('0x25'),'infobip',util[_0xc42c('0xbf')](_0x3c29eb['body'],{'showHidden':![],'depth':null}));}break;case _0xc42c('0x86'):if(_0x3bfde8==_0xc42c('0xc8')||_0x3bfde8==_0xc42c('0xc9')){return _0x45a76a[_0xc42c('0x2d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc42c('0x25'),_0xc42c('0x86'),util[_0xc42c('0xbf')](_0x3c29eb[_0xc42c('0x54')],{'showHidden':![],'depth':null}));}break;case _0xc42c('0x88'):if(_0x3bfde8===_0xc42c('0xca')||_0x3bfde8==='ACCEPTD'){return _0x45a76a['update']({'read':!![]});}else{logger[_0xc42c('0x20')](_0xc42c('0xa4'),_0xc42c('0x25'),_0xc42c('0x88'),util[_0xc42c('0xbf')](_0x3c29eb[_0xc42c('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x45a76a;}})[_0xc42c('0x1a')](respondWithResult(_0x3f788c,null))[_0xc42c('0x4f')](handleError(_0x3f788c,null));};exports[_0xc42c('0xcb')]=function(_0x44c574,_0x240e8b,_0x5f2dac){var _0x5056e1,_0x5a7df0,_0x4776cd;return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0x44c574[_0xc42c('0x51')]['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x240e8b,null))[_0xc42c('0x1a')](function(_0x17c353){if(_0x17c353){_0x4776cd=_0x17c353;logger[_0xc42c('0x1e')](_0xc42c('0xa4'),_0xc42c('0x25'),_0xc42c('0xbe'),_0x17c353['type'],util[_0xc42c('0xbf')](_0x44c574[_0xc42c('0x39')],{'showHidden':![],'depth':null}));switch(_0x17c353[_0xc42c('0x78')]){case _0xc42c('0xcc'):if(_0x44c574[_0xc42c('0x39')]['message-id']&&_0x44c574[_0xc42c('0x39')][_0xc42c('0xcd')]){_0x5a7df0=_0x44c574['query'][_0xc42c('0xcd')];return db[_0xc42c('0x99')][_0xc42c('0x5d')]({'where':{'messageId':_0x44c574[_0xc42c('0x39')][_0xc42c('0xce')]}});}break;}}})[_0xc42c('0x1a')](handleEntityNotFound(_0x240e8b,null))['then'](function(_0xfa0542){if(_0xfa0542){_0x5056e1=_0xfa0542;switch(_0x4776cd[_0xc42c('0x78')]){case _0xc42c('0xcc'):if(_0x5a7df0==='2'||_0x5a7df0==='6'){return _0x5056e1[_0xc42c('0x2d')]({'read':!![]});}else{logger[_0xc42c('0x20')](_0xc42c('0xa4'),'status',_0xc42c('0xcc'),util['inspect'](_0x44c574['query'],{'showHidden':![],'depth':null}));};break;}return _0x5056e1;}})['then'](respondWithResult(_0x240e8b,null))[_0xc42c('0x4f')](handleError(_0x240e8b,null));};exports[_0xc42c('0xcf')]=function(_0x3b9add,_0x5d771c,_0x499f4a){return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0x3b9add[_0xc42c('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d771c,null))[_0xc42c('0x1a')](function(_0x4fe20c){if(_0x4fe20c){return _0x4fe20c[_0xc42c('0xcf')](_0x3b9add[_0xc42c('0x54')][_0xc42c('0x65')],_['omit'](_0x3b9add['body'],[_0xc42c('0x65'),'id'])||{})[_0xc42c('0xd0')](function(_0xd2df0d){for(var _0x432a24=0x0;_0x432a24<_0x3b9add[_0xc42c('0x54')][_0xc42c('0x65')]['length'];_0x432a24+=0x1){socket[_0xc42c('0xd1')]('userSmsAccount:save',{'UserId':_0x3b9add[_0xc42c('0x54')][_0xc42c('0x65')][_0x432a24],'SmsAccountId':_0x3b9add[_0xc42c('0x51')]['id']});}return _0xd2df0d;});}})['then'](respondWithResult(_0x5d771c,null))[_0xc42c('0x4f')](handleError(_0x5d771c,null));};exports[_0xc42c('0xd2')]=function(_0xfe2d12,_0x2e0818,_0x27b75e){return db[_0xc42c('0x36')][_0xc42c('0x5d')]({'where':{'id':_0xfe2d12[_0xc42c('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e0818,null))[_0xc42c('0x1a')](function(_0x5896eb){if(_0x5896eb){return _0x5896eb[_0xc42c('0xd2')](_0xfe2d12[_0xc42c('0x39')][_0xc42c('0x65')])['then'](function(){if(_['isArray'](_0xfe2d12[_0xc42c('0x39')]['ids'])){for(var _0x216f6b=0x0;_0x216f6b<_0xfe2d12[_0xc42c('0x39')][_0xc42c('0x65')][_0xc42c('0x52')];_0x216f6b+=0x1){socket['emit'](_0xc42c('0xd3'),{'UserId':Number(_0xfe2d12[_0xc42c('0x39')][_0xc42c('0x65')][_0x216f6b]),'SmsAccountId':Number(_0xfe2d12['params']['id'])});}}else{socket[_0xc42c('0xd1')](_0xc42c('0xd3'),{'UserId':Number(_0xfe2d12['query'][_0xc42c('0x65')]),'SmsAccountId':Number(_0xfe2d12[_0xc42c('0x51')]['id'])});}});}})[_0xc42c('0x1a')](respondWithStatusCode(_0x2e0818,null))[_0xc42c('0x4f')](handleError(_0x2e0818,null));};exports[_0xc42c('0xd4')]=function(_0x3e8174,_0x178701,_0xe39f70){var _0x56879d={};var _0x3e1395={};var _0x5711c9;var _0x3f0a0a;return db[_0xc42c('0x36')]['findOne']({'where':{'id':_0x3e8174['params']['id']}})[_0xc42c('0x1a')](handleEntityNotFound(_0x178701,null))['then'](function(_0x539630){if(_0x539630){_0x5711c9=_0x539630;_0x3e1395[_0xc42c('0x37')]=_[_0xc42c('0x38')](db[_0xc42c('0x9c')][_0xc42c('0x62')]);_0x3e1395['query']=_[_0xc42c('0x38')](_0x3e8174[_0xc42c('0x39')]);_0x3e1395['filters']=_[_0xc42c('0x3b')](_0x3e1395[_0xc42c('0x37')],_0x3e1395['query']);_0x56879d[_0xc42c('0x3d')]=_[_0xc42c('0x3b')](_0x3e1395[_0xc42c('0x37')],qs[_0xc42c('0x3c')](_0x3e8174[_0xc42c('0x39')][_0xc42c('0x3c')]));_0x56879d[_0xc42c('0x3d')]=_0x56879d[_0xc42c('0x3d')][_0xc42c('0x52')]?_0x56879d[_0xc42c('0x3d')]:_0x3e1395[_0xc42c('0x37')];_0x56879d[_0xc42c('0x41')]=qs[_0xc42c('0x42')](_0x3e8174[_0xc42c('0x39')][_0xc42c('0x42')]);_0x56879d['where']=qs[_0xc42c('0x3a')](_[_0xc42c('0x43')](_0x3e8174[_0xc42c('0x39')],_0x3e1395[_0xc42c('0x3a')]));if(_0x3e8174[_0xc42c('0x39')][_0xc42c('0x44')]){_0x56879d[_0xc42c('0x45')]=_['merge'](_0x56879d[_0xc42c('0x45')],{'$or':_['map'](_0x56879d[_0xc42c('0x3d')],function(_0x8f5a2f){var _0x2f1fda={};_0x2f1fda[_0x8f5a2f]={'$like':'%'+_0x3e8174[_0xc42c('0x39')][_0xc42c('0x44')]+'%'};return _0x2f1fda;})});}_0x56879d=_[_0xc42c('0x63')]({},_0x56879d,_0x3e8174[_0xc42c('0x4a')]);return _0x5711c9[_0xc42c('0xd4')](_0x56879d);}})[_0xc42c('0x1a')](function(_0x55a57c){if(_0x55a57c){_0x3f0a0a=_0x55a57c[_0xc42c('0x52')];if(!_0x3e8174['query'][_0xc42c('0x3e')](_0xc42c('0x3f'))){_0x56879d[_0xc42c('0x40')]=qs[_0xc42c('0x40')](_0x3e8174[_0xc42c('0x39')][_0xc42c('0x40')]);_0x56879d['offset']=qs[_0xc42c('0x28')](_0x3e8174['query']['offset']);}return _0x5711c9['getAgents'](_0x56879d);}})[_0xc42c('0x1a')](function(_0x5bbfc7){if(_0x5bbfc7){return _0x5bbfc7?{'count':_0x3f0a0a,'rows':_0x5bbfc7}:null;}})[_0xc42c('0x1a')](respondWithResult(_0x178701,null))[_0xc42c('0x4f')](handleError(_0x178701,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 7400782..006fac0 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 _0x4a25=['remove','emit','hasOwnProperty','exports','events','SmsAccount','save','update'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4a25,0x1d4));var _0x54a2=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x4a25[_0x2ab365];return _0x49fef3;};'use strict';var EventEmitter=require(_0x54a2('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x54a2('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54a2('0x2'),'afterUpdate':_0x54a2('0x3'),'afterDestroy':_0x54a2('0x4')};function emitEvent(_0x3e5d5b){return function(_0x5c6c1f,_0x3031e9,_0x15f81b){SmsAccountEvents[_0x54a2('0x5')](_0x3e5d5b+':'+_0x5c6c1f['id'],_0x5c6c1f);SmsAccountEvents[_0x54a2('0x5')](_0x3e5d5b,_0x5c6c1f);_0x15f81b(null);};}for(var e in events){if(events[_0x54a2('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x54a2('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x0845=['setMaxListeners','save','update','remove','emit','events'];(function(_0x49c576,_0x724bf){var _0x2627f2=function(_0x1ff24d){while(--_0x1ff24d){_0x49c576['push'](_0x49c576['shift']());}};_0x2627f2(++_0x724bf);}(_0x0845,0x125));var _0x5084=function(_0x644d7b,_0xad365c){_0x644d7b=_0x644d7b-0x0;var _0x2d5f44=_0x0845[_0x644d7b];return _0x2d5f44;};'use strict';var EventEmitter=require(_0x5084('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5084('0x1')](0x0);var events={'afterCreate':_0x5084('0x2'),'afterUpdate':_0x5084('0x3'),'afterDestroy':_0x5084('0x4')};function emitEvent(_0x41255e){return function(_0x26a738,_0x4ec3e3,_0xd1319d){SmsAccountEvents[_0x5084('0x5')](_0x41255e+':'+_0x26a738['id'],_0x26a738);SmsAccountEvents[_0x5084('0x5')](_0x41255e,_0x26a738);_0xd1319d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3c806c0..cdac6ae 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 _0x0cc3=['rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x0cc3,0x1f4));var _0x30cc=function(_0x2c5d04,_0x529e8f){_0x2c5d04=_0x2c5d04-0x0;var _0x15f29c=_0x0cc3[_0x2c5d04];return _0x15f29c;};'use strict';var _=require(_0x30cc('0x0'));var util=require(_0x30cc('0x1'));var logger=require(_0x30cc('0x2'))(_0x30cc('0x3'));var moment=require(_0x30cc('0x4'));var BPromise=require(_0x30cc('0x5'));var rp=require(_0x30cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30cc('0x7'));var config=require(_0x30cc('0x8'));var attributes=require(_0x30cc('0x9'));module[_0x30cc('0xa')]=function(_0x4e658d,_0x3eabb1){return _0x4e658d['define'](_0x30cc('0xb'),attributes,{'tableName':_0x30cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd63=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts'];(function(_0x4c88ed,_0x36e3ba){var _0x5025cf=function(_0x2a7ba5){while(--_0x2a7ba5){_0x4c88ed['push'](_0x4c88ed['shift']());}};_0x5025cf(++_0x36e3ba);}(_0xfd63,0x1ad));var _0x3fd6=function(_0x2f5b5b,_0x751295){_0x2f5b5b=_0x2f5b5b-0x0;var _0x5eb968=_0xfd63[_0x2f5b5b];return _0x5eb968;};'use strict';var _=require(_0x3fd6('0x0'));var util=require(_0x3fd6('0x1'));var logger=require('../../config/logger')(_0x3fd6('0x2'));var moment=require(_0x3fd6('0x3'));var BPromise=require(_0x3fd6('0x4'));var rp=require(_0x3fd6('0x5'));var fs=require('fs');var path=require(_0x3fd6('0x6'));var rimraf=require(_0x3fd6('0x7'));var config=require(_0x3fd6('0x8'));var attributes=require(_0x3fd6('0x9'));module[_0x3fd6('0xa')]=function(_0x1999f9,_0x531a5b){return _0x1999f9[_0x3fd6('0xb')]('SmsAccount',attributes,{'tableName':_0x3fd6('0xc'),'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 5a12c56..02ba74d 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 _0xb56a=['error','code','message','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','map','include','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b5c38,_0x2c7022){var _0x442ebd=function(_0x738ed7){while(--_0x738ed7){_0x3b5c38['push'](_0x3b5c38['shift']());}};_0x442ebd(++_0x2c7022);}(_0xb56a,0x18a));var _0xab56=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xb56a[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require('lodash');var util=require(_0xab56('0x0'));var moment=require(_0xab56('0x1'));var BPromise=require(_0xab56('0x2'));var rs=require(_0xab56('0x3'));var fs=require('fs');var Redis=require(_0xab56('0x4'));var db=require(_0xab56('0x5'))['db'];var utils=require(_0xab56('0x6'));var logger=require(_0xab56('0x7'))(_0xab56('0x8'));var config=require(_0xab56('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xab56('0xa')][_0xab56('0xb')]({'port':0x232a});config[_0xab56('0xc')]=_[_0xab56('0xd')](config[_0xab56('0xc')],{'host':_0xab56('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab56('0xc')]));require('./smsAccount.socket')[_0xab56('0xf')](socket);function respondWithRpcPromise(_0x5f1f38,_0x168181,_0x3c64f0){return new BPromise(function(_0x1f4681,_0x2c9ab6){return client[_0xab56('0x10')](_0x5f1f38,_0x3c64f0)[_0xab56('0x11')](function(_0x555819){logger[_0xab56('0x12')](_0xab56('0x13'),_0x168181,_0xab56('0x14'));logger[_0xab56('0x15')](_0xab56('0x16'),_0x168181,_0xab56('0x14'),JSON[_0xab56('0x17')](_0x555819));if(_0x555819[_0xab56('0x18')]){if(_0x555819[_0xab56('0x18')][_0xab56('0x19')]===0x1f4){logger[_0xab56('0x18')](_0xab56('0x13'),_0x168181,_0x555819['error']['message']);return _0x2c9ab6(_0x555819[_0xab56('0x18')][_0xab56('0x1a')]);}logger[_0xab56('0x18')](_0xab56('0x13'),_0x168181,_0x555819[_0xab56('0x18')][_0xab56('0x1a')]);return _0x1f4681(_0x555819[_0xab56('0x18')][_0xab56('0x1a')]);}else{logger['info'](_0xab56('0x13'),_0x168181,'request\x20sent');_0x1f4681(_0x555819['result'][_0xab56('0x1a')]);}})[_0xab56('0x1b')](function(_0x3a1e45){logger[_0xab56('0x18')]('SmsAccount,\x20%s,\x20%s',_0x168181,_0x3a1e45);_0x2c9ab6(_0x3a1e45);});});}exports[_0xab56('0x1c')]=function(_0x446946){var _0x35813d=this;return new Promise(function(_0x43c21b,_0x5643c0){return db[_0xab56('0x1d')][_0xab56('0x1e')]({'raw':_0x446946['options']?_0x446946['options'][_0xab56('0x1f')]===undefined?!![]:![]:!![],'where':_0x446946[_0xab56('0x20')]?_0x446946[_0xab56('0x20')][_0xab56('0x21')]||null:null,'attributes':_0x446946[_0xab56('0x20')]?_0x446946[_0xab56('0x20')][_0xab56('0x22')]||null:null,'include':_0x446946[_0xab56('0x20')]?_0x446946[_0xab56('0x20')]['include']?_[_0xab56('0x23')](_0x446946['options'][_0xab56('0x24')],function(_0x336b96){return{'model':db[_0x336b96[_0xab56('0x25')]],'as':_0x336b96['as'],'attributes':_0x336b96[_0xab56('0x22')],'include':_0x336b96['include']?_['map'](_0x336b96['include'],function(_0x1bda1c){return{'model':db[_0x1bda1c['model']],'as':_0x1bda1c['as'],'attributes':_0x1bda1c[_0xab56('0x22')],'include':_0x1bda1c[_0xab56('0x24')]?_[_0xab56('0x23')](_0x1bda1c[_0xab56('0x24')],function(_0x3d9044){return{'model':db[_0x3d9044['model']],'as':_0x3d9044['as'],'attributes':_0x3d9044['attributes']};}):[]};}):[]};}):[]:[]})[_0xab56('0x11')](function(_0x16fc29){logger['info'](_0xab56('0x1c'),_0x446946);logger['debug'](_0xab56('0x1c'),_0x446946,JSON['stringify'](_0x16fc29));_0x43c21b(_0x16fc29);})[_0xab56('0x1b')](function(_0x490333){logger[_0xab56('0x18')](_0xab56('0x1c'),_0x490333[_0xab56('0x1a')],_0x446946);_0x5643c0(_0x35813d[_0xab56('0x18')](0x1f4,_0x490333['message']));});});}; \ No newline at end of file +var _0x2c14=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','request','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','SmsAccount','find','options','raw','attributes','include','map','model','then','ShowSmsAccount','util','bluebird'];(function(_0x362399,_0x27b8d5){var _0x201db5=function(_0x3c82e8){while(--_0x3c82e8){_0x362399['push'](_0x362399['shift']());}};_0x201db5(++_0x27b8d5);}(_0x2c14,0xf3));var _0x42c1=function(_0x4e32d1,_0x1f1b9a){_0x4e32d1=_0x4e32d1-0x0;var _0x5e99cf=_0x2c14[_0x4e32d1];return _0x5e99cf;};'use strict';var _=require('lodash');var util=require(_0x42c1('0x0'));var moment=require('moment');var BPromise=require(_0x42c1('0x1'));var rs=require(_0x42c1('0x2'));var fs=require('fs');var Redis=require(_0x42c1('0x3'));var db=require(_0x42c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42c1('0x5'));var config=require(_0x42c1('0x6'));var jayson=require(_0x42c1('0x7'));var client=jayson[_0x42c1('0x8')][_0x42c1('0x9')]({'port':0x232a});config['redis']=_[_0x42c1('0xa')](config['redis'],{'host':_0x42c1('0xb'),'port':0x18eb});var socket=require(_0x42c1('0xc'))(new Redis(config[_0x42c1('0xd')]));require(_0x42c1('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e79c3,_0x5b8366,_0x3dd021){return new BPromise(function(_0x1aadda,_0x884c69){return client[_0x42c1('0xf')](_0x1e79c3,_0x3dd021)['then'](function(_0x34f619){logger[_0x42c1('0x10')]('SmsAccount,\x20%s,\x20%s',_0x5b8366,_0x42c1('0x11'));logger[_0x42c1('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b8366,'request\x20sent',JSON[_0x42c1('0x13')](_0x34f619));if(_0x34f619[_0x42c1('0x14')]){if(_0x34f619[_0x42c1('0x14')][_0x42c1('0x15')]===0x1f4){logger[_0x42c1('0x14')](_0x42c1('0x16'),_0x5b8366,_0x34f619[_0x42c1('0x14')]['message']);return _0x884c69(_0x34f619[_0x42c1('0x14')][_0x42c1('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b8366,_0x34f619[_0x42c1('0x14')][_0x42c1('0x17')]);return _0x1aadda(_0x34f619[_0x42c1('0x14')][_0x42c1('0x17')]);}else{logger[_0x42c1('0x10')](_0x42c1('0x16'),_0x5b8366,_0x42c1('0x11'));_0x1aadda(_0x34f619['result'][_0x42c1('0x17')]);}})[_0x42c1('0x18')](function(_0x253216){logger[_0x42c1('0x14')](_0x42c1('0x16'),_0x5b8366,_0x253216);_0x884c69(_0x253216);});});}exports['ShowSmsAccount']=function(_0x439a95){var _0x44fbf9=this;return new Promise(function(_0x138b48,_0x4b1b5f){return db[_0x42c1('0x19')][_0x42c1('0x1a')]({'raw':_0x439a95[_0x42c1('0x1b')]?_0x439a95['options'][_0x42c1('0x1c')]===undefined?!![]:![]:!![],'where':_0x439a95[_0x42c1('0x1b')]?_0x439a95['options']['where']||null:null,'attributes':_0x439a95[_0x42c1('0x1b')]?_0x439a95[_0x42c1('0x1b')][_0x42c1('0x1d')]||null:null,'include':_0x439a95['options']?_0x439a95['options'][_0x42c1('0x1e')]?_[_0x42c1('0x1f')](_0x439a95['options']['include'],function(_0x41fbb6){return{'model':db[_0x41fbb6[_0x42c1('0x20')]],'as':_0x41fbb6['as'],'attributes':_0x41fbb6[_0x42c1('0x1d')],'include':_0x41fbb6[_0x42c1('0x1e')]?_[_0x42c1('0x1f')](_0x41fbb6[_0x42c1('0x1e')],function(_0x2a0538){return{'model':db[_0x2a0538[_0x42c1('0x20')]],'as':_0x2a0538['as'],'attributes':_0x2a0538[_0x42c1('0x1d')],'include':_0x2a0538[_0x42c1('0x1e')]?_['map'](_0x2a0538[_0x42c1('0x1e')],function(_0x1e3953){return{'model':db[_0x1e3953[_0x42c1('0x20')]],'as':_0x1e3953['as'],'attributes':_0x1e3953[_0x42c1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x42c1('0x21')](function(_0x5204f2){logger[_0x42c1('0x10')](_0x42c1('0x22'),_0x439a95);logger[_0x42c1('0x12')](_0x42c1('0x22'),_0x439a95,JSON[_0x42c1('0x13')](_0x5204f2));_0x138b48(_0x5204f2);})[_0x42c1('0x18')](function(_0x3e2dbb){logger[_0x42c1('0x14')]('ShowSmsAccount',_0x3e2dbb[_0x42c1('0x17')],_0x439a95);_0x4b1b5f(_0x44fbf9[_0x42c1('0x14')](0x1f4,_0x3e2dbb[_0x42c1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 98ca7ed..2a440c5 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 _0xa2d8=['update','emit','removeListener','register','length','smsAccount:','save','remove'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa2d8,0xb6));var _0x8a2d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa2d8[_0x6131cd];return _0x47e916;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x8a2d('0x0'),_0x8a2d('0x1'),_0x8a2d('0x2')];function createListener(_0x283072,_0x882e8e){return function(_0x17b556){_0x882e8e[_0x8a2d('0x3')](_0x283072,_0x17b556);};}function removeListener(_0x3f9944,_0x254c9d){return function(){SmsAccountEvents[_0x8a2d('0x4')](_0x3f9944,_0x254c9d);};}exports[_0x8a2d('0x5')]=function(_0x3ed806){for(var _0x29baa0=0x0,_0x44e696=events[_0x8a2d('0x6')];_0x29baa0<_0x44e696;_0x29baa0++){var _0xe9daa2=events[_0x29baa0];var _0x5f41ae=createListener(_0x8a2d('0x7')+_0xe9daa2,_0x3ed806);SmsAccountEvents['on'](_0xe9daa2,_0x5f41ae);}}; \ No newline at end of file +var _0xec53=['update','emit','removeListener','register','length','./smsAccount.events','save','remove'];(function(_0x2fcefe,_0x2052db){var _0x112031=function(_0x2e849e){while(--_0x2e849e){_0x2fcefe['push'](_0x2fcefe['shift']());}};_0x112031(++_0x2052db);}(_0xec53,0xed));var _0x3ec5=function(_0x1ea66c,_0x52c9b6){_0x1ea66c=_0x1ea66c-0x0;var _0xe6317a=_0xec53[_0x1ea66c];return _0xe6317a;};'use strict';var SmsAccountEvents=require(_0x3ec5('0x0'));var events=[_0x3ec5('0x1'),_0x3ec5('0x2'),_0x3ec5('0x3')];function createListener(_0x49c6bc,_0x7cf2cb){return function(_0x2831db){_0x7cf2cb[_0x3ec5('0x4')](_0x49c6bc,_0x2831db);};}function removeListener(_0x21eb50,_0x493e35){return function(){SmsAccountEvents[_0x3ec5('0x5')](_0x21eb50,_0x493e35);};}exports[_0x3ec5('0x6')]=function(_0x569bdb){for(var _0x29e659=0x0,_0x3b4619=events[_0x3ec5('0x7')];_0x29e659<_0x3b4619;_0x29e659++){var _0x161827=events[_0x29e659];var _0x31aa28=createListener('smsAccount:'+_0x161827,_0x569bdb);SmsAccountEvents['on'](_0x161827,_0x31aa28);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 8a38ea4..e291359 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 _0x106c=['express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','post','create','update','delete','path'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x106c,0x12b));var _0xc106=function(_0x255e03,_0xee23cc){_0x255e03=_0x255e03-0x0;var _0x74fa02=_0x106c[_0x255e03];return _0x74fa02;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc106('0x0'));var timeout=require('connect-timeout');var express=require(_0xc106('0x1'));var router=express[_0xc106('0x2')]();var auth=require(_0xc106('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsApplication.controller');router[_0xc106('0x4')]('/',auth[_0xc106('0x5')](),controller[_0xc106('0x6')]);router[_0xc106('0x4')](_0xc106('0x7'),auth[_0xc106('0x5')](),controller['show']);router[_0xc106('0x8')]('/',auth['isAuthenticated'](),controller[_0xc106('0x9')]);router['put'](_0xc106('0x7'),auth[_0xc106('0x5')](),controller[_0xc106('0xa')]);router[_0xc106('0xb')](_0xc106('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb85f=['delete','exports','multer','util','path','Router','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0xb85f,0xc2));var _0xfb85=function(_0x5be52d,_0x31f79f){_0x5be52d=_0x5be52d-0x0;var _0x1c0454=_0xb85f[_0x5be52d];return _0x1c0454;};'use strict';var multer=require(_0xfb85('0x0'));var util=require(_0xfb85('0x1'));var path=require(_0xfb85('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfb85('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfb85('0x4'));var controller=require(_0xfb85('0x5'));router[_0xfb85('0x6')]('/',auth[_0xfb85('0x7')](),controller[_0xfb85('0x8')]);router[_0xfb85('0x6')]('/:id',auth[_0xfb85('0x7')](),controller[_0xfb85('0x9')]);router[_0xfb85('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb85('0xb')](_0xfb85('0xc'),auth[_0xfb85('0x7')](),controller[_0xfb85('0xd')]);router[_0xfb85('0xe')](_0xfb85('0xc'),auth[_0xfb85('0x7')](),controller['destroy']);module[_0xfb85('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index bb0594b..f8d1070 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 _0x2b59=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b59,0x1de));var _0x92b5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2b59[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x92b5('0x0'));module[_0x92b5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x92b5('0x2')},'appdata':{'type':Sequelize[_0x92b5('0x3')]()},'description':{'type':Sequelize[_0x92b5('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x92b5('0x5')}}; \ No newline at end of file +var _0x8fcd=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x4e518c,_0x23682c){var _0x13ca1c=function(_0x176f93){while(--_0x176f93){_0x4e518c['push'](_0x4e518c['shift']());}};_0x13ca1c(++_0x23682c);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x29a82f,_0x7c0932){_0x29a82f=_0x29a82f-0x0;var _0x36d82d=_0x8fcd[_0x29a82f];return _0x36d82d;};'use strict';var Sequelize=require(_0xd8fc('0x0'));module[_0xd8fc('0x1')]={'priority':{'type':Sequelize[_0xd8fc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd8fc('0x3')],'allowNull':![],'defaultValue':_0xd8fc('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':_0xd8fc('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e6dab71..01deefe 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 _0x9a9a=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','send','index','SmsApplication','rawAttributes','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','rows','params','intersection','create','body','catch','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x534617,_0x41a7ba){var _0x516e6a=function(_0x2cbb81){while(--_0x2cbb81){_0x534617['push'](_0x534617['shift']());}};_0x516e6a(++_0x41a7ba);}(_0x9a9a,0x11d));var _0xa9a9=function(_0x5de13b,_0x3411b4){_0x5de13b=_0x5de13b-0x0;var _0x245c50=_0x9a9a[_0x5de13b];return _0x245c50;};'use strict';var pdf=require(_0xa9a9('0x0'));var emlformat=require(_0xa9a9('0x1'));var rimraf=require(_0xa9a9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9a9('0x3'));var rp=require('request-promise');var moment=require(_0xa9a9('0x4'));var BPromise=require(_0xa9a9('0x5'));var Mustache=require(_0xa9a9('0x6'));var util=require('util');var path=require(_0xa9a9('0x7'));var sox=require(_0xa9a9('0x8'));var csv=require(_0xa9a9('0x9'));var ejs=require(_0xa9a9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa9a9('0xb'));var crypto=require(_0xa9a9('0xc'));var jsforce=require(_0xa9a9('0xd'));var deskjs=require(_0xa9a9('0xe'));var toCsv=require(_0xa9a9('0x9'));var querystring=require(_0xa9a9('0xf'));var Papa=require(_0xa9a9('0x10'));var Redis=require(_0xa9a9('0x11'));var authService=require(_0xa9a9('0x12'));var qs=require(_0xa9a9('0x13'));var hardwareService=require(_0xa9a9('0x14'));var logger=require(_0xa9a9('0x15'))(_0xa9a9('0x16'));var utils=require(_0xa9a9('0x17'));var config=require(_0xa9a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x774d81,_0x56fd26){_0x56fd26=_0x56fd26||0xcc;return function(_0x2b286f){if(_0x2b286f){return _0x774d81[_0xa9a9('0x19')](_0x56fd26);}return _0x774d81[_0xa9a9('0x1a')](_0x56fd26)[_0xa9a9('0x1b')]();};}function respondWithResult(_0x151543,_0x4ec317){_0x4ec317=_0x4ec317||0xc8;return function(_0x3822e4){if(_0x3822e4){return _0x151543[_0xa9a9('0x1a')](_0x4ec317)[_0xa9a9('0x1c')](_0x3822e4);}};}function respondWithFilteredResult(_0x198814,_0x1aae5a){return function(_0x4a403a){if(_0x4a403a){var _0x12d717=_0x4a403a[_0xa9a9('0x1d')],_0x34bf04=_0x1aae5a[_0xa9a9('0x1e')],_0x4d2e13=_0x1aae5a['offset']+_0x1aae5a[_0xa9a9('0x1f')],_0x584fee;if(_0x4d2e13>=_0x12d717){_0x4d2e13=_0x12d717;_0x584fee=0xc8;}else{_0x584fee=0xce;}_0x198814['status'](_0x584fee);return _0x198814[_0xa9a9('0x20')](_0xa9a9('0x21'),_0x34bf04+'-'+_0x4d2e13+'/'+_0x12d717)[_0xa9a9('0x1c')](_0x4a403a);}return null;};}function patchUpdates(_0x4e4a8a){return function(_0x287444){try{jsonpatch[_0xa9a9('0x22')](_0x287444,_0x4e4a8a,!![]);}catch(_0x4cdd6e){return BPromise[_0xa9a9('0x23')](_0x4cdd6e);}return _0x287444['save']();};}function saveUpdates(_0x5c0810,_0x315e08){return function(_0xc16f91){if(_0xc16f91){return _0xc16f91[_0xa9a9('0x24')](_0x5c0810)[_0xa9a9('0x25')](function(_0x4dc99a){return _0x4dc99a;});}return null;};}function removeEntity(_0x551926,_0x2d5e58){return function(_0x20e2e6){if(_0x20e2e6){return _0x20e2e6['destroy']()[_0xa9a9('0x25')](function(){_0x551926['status'](0xcc)[_0xa9a9('0x1b')]();});}};}function handleEntityNotFound(_0x563e8c,_0x1cd709){return function(_0x4dcd29){if(!_0x4dcd29){_0x563e8c[_0xa9a9('0x19')](0x194);}return _0x4dcd29;};}function handleError(_0x187d5d,_0x342093){_0x342093=_0x342093||0x1f4;return function(_0x42bd9d){logger[_0xa9a9('0x26')](_0x42bd9d[_0xa9a9('0x27')]);if(_0x42bd9d['name']){delete _0x42bd9d['name'];}_0x187d5d['status'](_0x342093)[_0xa9a9('0x28')](_0x42bd9d);};}exports[_0xa9a9('0x29')]=function(_0x5db3e2,_0x20115e){var _0x2883ea={},_0x2106c3={},_0x3d59a3={'count':0x0,'rows':[]};var _0x16bddc=db[_0xa9a9('0x2a')][_0xa9a9('0x2b')];_0x2106c3[_0xa9a9('0x2c')]=_[_0xa9a9('0x2d')](_0x16bddc);_0x2106c3[_0xa9a9('0x2e')]=_[_0xa9a9('0x2d')](_0x5db3e2[_0xa9a9('0x2e')]);_0x2106c3[_0xa9a9('0x2f')]=_['intersection'](_0x2106c3['model'],_0x2106c3[_0xa9a9('0x2e')]);_0x2883ea['attributes']=_['intersection'](_0x2106c3['model'],qs[_0xa9a9('0x30')](_0x5db3e2[_0xa9a9('0x2e')]['fields']));_0x2883ea[_0xa9a9('0x31')]=_0x2883ea[_0xa9a9('0x31')][_0xa9a9('0x32')]?_0x2883ea[_0xa9a9('0x31')]:_0x2106c3[_0xa9a9('0x2c')];if(!_0x5db3e2['query'][_0xa9a9('0x33')](_0xa9a9('0x34'))){_0x2883ea[_0xa9a9('0x1f')]=qs[_0xa9a9('0x1f')](_0x5db3e2['query']['limit']);_0x2883ea[_0xa9a9('0x1e')]=qs[_0xa9a9('0x1e')](_0x5db3e2['query'][_0xa9a9('0x1e')]);}_0x2883ea[_0xa9a9('0x35')]=qs['sort'](_0x5db3e2[_0xa9a9('0x2e')]['sort']);_0x2883ea[_0xa9a9('0x36')]=qs[_0xa9a9('0x2f')](_[_0xa9a9('0x37')](_0x5db3e2[_0xa9a9('0x2e')],_0x2106c3[_0xa9a9('0x2f')]));if(_0x5db3e2[_0xa9a9('0x2e')][_0xa9a9('0x38')]){_0x2883ea['where']=_[_0xa9a9('0x39')](_0x2883ea[_0xa9a9('0x36')],{'$or':_[_0xa9a9('0x3a')](_0x16bddc,function(_0x1183dc){if(_0x1183dc[_0xa9a9('0x3b')][_0xa9a9('0x3c')]!==_0xa9a9('0x3d')){var _0xab185a={};_0xab185a[_0x1183dc[_0xa9a9('0x3e')]]={'$like':'%'+_0x5db3e2[_0xa9a9('0x2e')]['filter']+'%'};return _0xab185a;}})});}_0x2883ea=_['merge']({},_0x2883ea,_0x5db3e2[_0xa9a9('0x3f')]);var _0x573613={'where':_0x2883ea[_0xa9a9('0x36')]};return db[_0xa9a9('0x2a')][_0xa9a9('0x1d')](_0x573613)['then'](function(_0x3536a4){_0x3d59a3[_0xa9a9('0x1d')]=_0x3536a4;if(_0x5db3e2['query'][_0xa9a9('0x40')]){_0x2883ea[_0xa9a9('0x41')]=[{'all':!![]}];}return db[_0xa9a9('0x2a')]['findAll'](_0x2883ea);})[_0xa9a9('0x25')](function(_0x28ebe5){_0x3d59a3[_0xa9a9('0x42')]=_0x28ebe5;return _0x3d59a3;})[_0xa9a9('0x25')](respondWithFilteredResult(_0x20115e,_0x2883ea))['catch'](handleError(_0x20115e,null));};exports['show']=function(_0x283ad3,_0x4369d3){var _0x49109a={'raw':!![],'where':{'id':_0x283ad3[_0xa9a9('0x43')]['id']}},_0x53abca={};_0x53abca[_0xa9a9('0x2c')]=_[_0xa9a9('0x2d')](db[_0xa9a9('0x2a')][_0xa9a9('0x2b')]);_0x53abca['query']=_[_0xa9a9('0x2d')](_0x283ad3[_0xa9a9('0x2e')]);_0x53abca[_0xa9a9('0x2f')]=_[_0xa9a9('0x44')](_0x53abca[_0xa9a9('0x2c')],_0x53abca[_0xa9a9('0x2e')]);_0x49109a[_0xa9a9('0x31')]=_[_0xa9a9('0x44')](_0x53abca[_0xa9a9('0x2c')],qs[_0xa9a9('0x30')](_0x283ad3[_0xa9a9('0x2e')]['fields']));_0x49109a['attributes']=_0x49109a[_0xa9a9('0x31')][_0xa9a9('0x32')]?_0x49109a['attributes']:_0x53abca[_0xa9a9('0x2c')];if(_0x283ad3['query'][_0xa9a9('0x40')]){_0x49109a['include']=[{'all':!![]}];}_0x49109a=_['merge']({},_0x49109a,_0x283ad3[_0xa9a9('0x3f')]);return db['SmsApplication']['find'](_0x49109a)[_0xa9a9('0x25')](handleEntityNotFound(_0x4369d3,null))[_0xa9a9('0x25')](respondWithResult(_0x4369d3,null))['catch'](handleError(_0x4369d3,null));};exports[_0xa9a9('0x45')]=function(_0x64739f,_0x1b6555){return db['SmsApplication']['create'](_0x64739f[_0xa9a9('0x46')],{})['then'](respondWithResult(_0x1b6555,0xc9))[_0xa9a9('0x47')](handleError(_0x1b6555,null));};exports[_0xa9a9('0x24')]=function(_0xdb9177,_0x2b60b5){if(_0xdb9177[_0xa9a9('0x46')]['id']){delete _0xdb9177[_0xa9a9('0x46')]['id'];}return db[_0xa9a9('0x2a')][_0xa9a9('0x48')]({'where':{'id':_0xdb9177[_0xa9a9('0x43')]['id']}})[_0xa9a9('0x25')](handleEntityNotFound(_0x2b60b5,null))[_0xa9a9('0x25')](saveUpdates(_0xdb9177[_0xa9a9('0x46')],null))['then'](respondWithResult(_0x2b60b5,null))[_0xa9a9('0x47')](handleError(_0x2b60b5,null));};exports['destroy']=function(_0x39854a,_0x1fbaa9){return db['SmsApplication'][_0xa9a9('0x48')]({'where':{'id':_0x39854a[_0xa9a9('0x43')]['id']}})[_0xa9a9('0x25')](handleEntityNotFound(_0x1fbaa9,null))[_0xa9a9('0x25')](removeEntity(_0x1fbaa9,null))[_0xa9a9('0x47')](handleError(_0x1fbaa9,null));}; \ No newline at end of file +var _0x4fe0=['limit','set','Content-Range','save','update','then','destroy','stack','name','send','index','SmsApplication','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','map','key','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x5d732b,_0x1a60c2){var _0x3538c7=function(_0x2804fd){while(--_0x2804fd){_0x5d732b['push'](_0x5d732b['shift']());}};_0x3538c7(++_0x1a60c2);}(_0x4fe0,0x74));var _0x04fe=function(_0x26a9e0,_0x535544){_0x26a9e0=_0x26a9e0-0x0;var _0x4aa13d=_0x4fe0[_0x26a9e0];return _0x4aa13d;};'use strict';var pdf=require(_0x04fe('0x0'));var emlformat=require(_0x04fe('0x1'));var rimraf=require(_0x04fe('0x2'));var zipdir=require(_0x04fe('0x3'));var jsonpatch=require(_0x04fe('0x4'));var rp=require(_0x04fe('0x5'));var moment=require(_0x04fe('0x6'));var BPromise=require(_0x04fe('0x7'));var Mustache=require('mustache');var util=require(_0x04fe('0x8'));var path=require(_0x04fe('0x9'));var sox=require(_0x04fe('0xa'));var csv=require(_0x04fe('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x04fe('0xc'));var squel=require(_0x04fe('0xd'));var crypto=require(_0x04fe('0xe'));var jsforce=require(_0x04fe('0xf'));var deskjs=require(_0x04fe('0x10'));var toCsv=require(_0x04fe('0xb'));var querystring=require('querystring');var Papa=require(_0x04fe('0x11'));var Redis=require(_0x04fe('0x12'));var authService=require(_0x04fe('0x13'));var qs=require(_0x04fe('0x14'));var hardwareService=require(_0x04fe('0x15'));var logger=require(_0x04fe('0x16'))(_0x04fe('0x17'));var utils=require(_0x04fe('0x18'));var config=require(_0x04fe('0x19'));var db=require(_0x04fe('0x1a'))['db'];function respondWithStatusCode(_0x345e67,_0x39386f){_0x39386f=_0x39386f||0xcc;return function(_0xfe0f30){if(_0xfe0f30){return _0x345e67[_0x04fe('0x1b')](_0x39386f);}return _0x345e67['status'](_0x39386f)['end']();};}function respondWithResult(_0x235fd8,_0x17f67c){_0x17f67c=_0x17f67c||0xc8;return function(_0x4d4b50){if(_0x4d4b50){return _0x235fd8[_0x04fe('0x1c')](_0x17f67c)[_0x04fe('0x1d')](_0x4d4b50);}};}function respondWithFilteredResult(_0xa12d24,_0x5226d0){return function(_0x3bdc1a){if(_0x3bdc1a){var _0xea5b65=_0x3bdc1a[_0x04fe('0x1e')],_0x25fd43=_0x5226d0[_0x04fe('0x1f')],_0x1644fe=_0x5226d0[_0x04fe('0x1f')]+_0x5226d0[_0x04fe('0x20')],_0x1cf5b1;if(_0x1644fe>=_0xea5b65){_0x1644fe=_0xea5b65;_0x1cf5b1=0xc8;}else{_0x1cf5b1=0xce;}_0xa12d24[_0x04fe('0x1c')](_0x1cf5b1);return _0xa12d24[_0x04fe('0x21')](_0x04fe('0x22'),_0x25fd43+'-'+_0x1644fe+'/'+_0xea5b65)[_0x04fe('0x1d')](_0x3bdc1a);}return null;};}function patchUpdates(_0x43a7c8){return function(_0x3d1c6a){try{jsonpatch['apply'](_0x3d1c6a,_0x43a7c8,!![]);}catch(_0x26b3f5){return BPromise['reject'](_0x26b3f5);}return _0x3d1c6a[_0x04fe('0x23')]();};}function saveUpdates(_0x114680,_0x5c92d3){return function(_0x5e39c3){if(_0x5e39c3){return _0x5e39c3[_0x04fe('0x24')](_0x114680)[_0x04fe('0x25')](function(_0x2ce60a){return _0x2ce60a;});}return null;};}function removeEntity(_0x2ca909,_0x4e768a){return function(_0x5a7b88){if(_0x5a7b88){return _0x5a7b88[_0x04fe('0x26')]()[_0x04fe('0x25')](function(){_0x2ca909[_0x04fe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1247a6,_0x59fc59){return function(_0x3ed87d){if(!_0x3ed87d){_0x1247a6['sendStatus'](0x194);}return _0x3ed87d;};}function handleError(_0x397968,_0x1ca968){_0x1ca968=_0x1ca968||0x1f4;return function(_0x33dbbf){logger['error'](_0x33dbbf[_0x04fe('0x27')]);if(_0x33dbbf[_0x04fe('0x28')]){delete _0x33dbbf[_0x04fe('0x28')];}_0x397968[_0x04fe('0x1c')](_0x1ca968)[_0x04fe('0x29')](_0x33dbbf);};}exports[_0x04fe('0x2a')]=function(_0x2ae0fe,_0x1a36cb){var _0x41733b={},_0x29dd56={},_0x3b87c5={'count':0x0,'rows':[]};var _0x447608=db[_0x04fe('0x2b')]['rawAttributes'];_0x29dd56[_0x04fe('0x2c')]=_['keys'](_0x447608);_0x29dd56[_0x04fe('0x2d')]=_[_0x04fe('0x2e')](_0x2ae0fe[_0x04fe('0x2d')]);_0x29dd56['filters']=_['intersection'](_0x29dd56['model'],_0x29dd56[_0x04fe('0x2d')]);_0x41733b[_0x04fe('0x2f')]=_[_0x04fe('0x30')](_0x29dd56[_0x04fe('0x2c')],qs[_0x04fe('0x31')](_0x2ae0fe[_0x04fe('0x2d')]['fields']));_0x41733b[_0x04fe('0x2f')]=_0x41733b['attributes'][_0x04fe('0x32')]?_0x41733b['attributes']:_0x29dd56['model'];if(!_0x2ae0fe[_0x04fe('0x2d')][_0x04fe('0x33')](_0x04fe('0x34'))){_0x41733b['limit']=qs[_0x04fe('0x20')](_0x2ae0fe[_0x04fe('0x2d')][_0x04fe('0x20')]);_0x41733b['offset']=qs[_0x04fe('0x1f')](_0x2ae0fe[_0x04fe('0x2d')]['offset']);}_0x41733b[_0x04fe('0x35')]=qs[_0x04fe('0x36')](_0x2ae0fe[_0x04fe('0x2d')][_0x04fe('0x36')]);_0x41733b['where']=qs[_0x04fe('0x37')](_['pick'](_0x2ae0fe[_0x04fe('0x2d')],_0x29dd56['filters']));if(_0x2ae0fe[_0x04fe('0x2d')]['filter']){_0x41733b['where']=_[_0x04fe('0x38')](_0x41733b['where'],{'$or':_[_0x04fe('0x39')](_0x447608,function(_0xd858ec){if(_0xd858ec['type'][_0x04fe('0x3a')]!==_0x04fe('0x3b')){var _0x502070={};_0x502070[_0xd858ec['field']]={'$like':'%'+_0x2ae0fe['query'][_0x04fe('0x3c')]+'%'};return _0x502070;}})});}_0x41733b=_[_0x04fe('0x38')]({},_0x41733b,_0x2ae0fe[_0x04fe('0x3d')]);var _0x500e9a={'where':_0x41733b[_0x04fe('0x3e')]};return db[_0x04fe('0x2b')][_0x04fe('0x1e')](_0x500e9a)[_0x04fe('0x25')](function(_0x1a1cc8){_0x3b87c5[_0x04fe('0x1e')]=_0x1a1cc8;if(_0x2ae0fe['query'][_0x04fe('0x3f')]){_0x41733b[_0x04fe('0x40')]=[{'all':!![]}];}return db[_0x04fe('0x2b')][_0x04fe('0x41')](_0x41733b);})[_0x04fe('0x25')](function(_0x476cca){_0x3b87c5[_0x04fe('0x42')]=_0x476cca;return _0x3b87c5;})[_0x04fe('0x25')](respondWithFilteredResult(_0x1a36cb,_0x41733b))[_0x04fe('0x43')](handleError(_0x1a36cb,null));};exports[_0x04fe('0x44')]=function(_0x2a32db,_0x4b3fda){var _0x277de0={'raw':!![],'where':{'id':_0x2a32db['params']['id']}},_0x1755d1={};_0x1755d1[_0x04fe('0x2c')]=_[_0x04fe('0x2e')](db['SmsApplication'][_0x04fe('0x45')]);_0x1755d1['query']=_[_0x04fe('0x2e')](_0x2a32db[_0x04fe('0x2d')]);_0x1755d1[_0x04fe('0x37')]=_[_0x04fe('0x30')](_0x1755d1['model'],_0x1755d1['query']);_0x277de0[_0x04fe('0x2f')]=_[_0x04fe('0x30')](_0x1755d1['model'],qs[_0x04fe('0x31')](_0x2a32db['query'][_0x04fe('0x31')]));_0x277de0[_0x04fe('0x2f')]=_0x277de0[_0x04fe('0x2f')][_0x04fe('0x32')]?_0x277de0['attributes']:_0x1755d1[_0x04fe('0x2c')];if(_0x2a32db[_0x04fe('0x2d')][_0x04fe('0x3f')]){_0x277de0['include']=[{'all':!![]}];}_0x277de0=_['merge']({},_0x277de0,_0x2a32db[_0x04fe('0x3d')]);return db[_0x04fe('0x2b')][_0x04fe('0x46')](_0x277de0)[_0x04fe('0x25')](handleEntityNotFound(_0x4b3fda,null))['then'](respondWithResult(_0x4b3fda,null))['catch'](handleError(_0x4b3fda,null));};exports[_0x04fe('0x47')]=function(_0x4f2d5c,_0x579937){return db[_0x04fe('0x2b')][_0x04fe('0x47')](_0x4f2d5c['body'],{})[_0x04fe('0x25')](respondWithResult(_0x579937,0xc9))[_0x04fe('0x43')](handleError(_0x579937,null));};exports[_0x04fe('0x24')]=function(_0x2ce575,_0x4347a4){if(_0x2ce575[_0x04fe('0x48')]['id']){delete _0x2ce575[_0x04fe('0x48')]['id'];}return db[_0x04fe('0x2b')][_0x04fe('0x46')]({'where':{'id':_0x2ce575[_0x04fe('0x49')]['id']}})[_0x04fe('0x25')](handleEntityNotFound(_0x4347a4,null))['then'](saveUpdates(_0x2ce575[_0x04fe('0x48')],null))[_0x04fe('0x25')](respondWithResult(_0x4347a4,null))[_0x04fe('0x43')](handleError(_0x4347a4,null));};exports[_0x04fe('0x26')]=function(_0x3db089,_0x3eab37){return db['SmsApplication'][_0x04fe('0x46')]({'where':{'id':_0x3db089[_0x04fe('0x49')]['id']}})[_0x04fe('0x25')](handleEntityNotFound(_0x3eab37,null))[_0x04fe('0x25')](removeEntity(_0x3eab37,null))[_0x04fe('0x43')](handleError(_0x3eab37,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a136073..e06eb56 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 _0x1967=['rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23c23c,_0x3152b0){var _0x31b58c=function(_0x3290b3){while(--_0x3290b3){_0x23c23c['push'](_0x23c23c['shift']());}};_0x31b58c(++_0x3152b0);}(_0x1967,0x173));var _0x7196=function(_0x52cbab,_0x391f63){_0x52cbab=_0x52cbab-0x0;var _0x2170a2=_0x1967[_0x52cbab];return _0x2170a2;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7196('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x57ca=['define','SmsApplication','sms_applications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports'];(function(_0x12418c,_0x5c4995){var _0x237b99=function(_0x5524a8){while(--_0x5524a8){_0x12418c['push'](_0x12418c['shift']());}};_0x237b99(++_0x5c4995);}(_0x57ca,0x108));var _0xa57c=function(_0x38a61f,_0x462afe){_0x38a61f=_0x38a61f-0x0;var _0x5b0e6a=_0x57ca[_0x38a61f];return _0x5b0e6a;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa57c('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3857c69..a7cfa44 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 _0x59b1=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59b1,0xa0));var _0x159b=function(_0x4bcc46,_0x4fd024){_0x4bcc46=_0x4bcc46-0x0;var _0x2d2082=_0x59b1[_0x4bcc46];return _0x2d2082;};'use strict';var _=require(_0x159b('0x0'));var util=require(_0x159b('0x1'));var moment=require(_0x159b('0x2'));var BPromise=require(_0x159b('0x3'));var rs=require(_0x159b('0x4'));var fs=require('fs');var Redis=require(_0x159b('0x5'));var db=require(_0x159b('0x6'))['db'];var utils=require(_0x159b('0x7'));var logger=require(_0x159b('0x8'))(_0x159b('0x9'));var config=require(_0x159b('0xa'));var jayson=require(_0x159b('0xb'));var client=jayson[_0x159b('0xc')][_0x159b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4cd260,_0x3bfcf5,_0x1cc367){return new BPromise(function(_0x3d2f7f,_0x11a10e){return client['request'](_0x4cd260,_0x1cc367)[_0x159b('0xe')](function(_0xed9ea0){logger[_0x159b('0xf')](_0x159b('0x10'),_0x3bfcf5,_0x159b('0x11'));logger[_0x159b('0x12')](_0x159b('0x13'),_0x3bfcf5,_0x159b('0x11'),JSON[_0x159b('0x14')](_0xed9ea0));if(_0xed9ea0[_0x159b('0x15')]){if(_0xed9ea0[_0x159b('0x15')][_0x159b('0x16')]===0x1f4){logger[_0x159b('0x15')](_0x159b('0x10'),_0x3bfcf5,_0xed9ea0[_0x159b('0x15')][_0x159b('0x17')]);return _0x11a10e(_0xed9ea0[_0x159b('0x15')]['message']);}logger[_0x159b('0x15')](_0x159b('0x10'),_0x3bfcf5,_0xed9ea0[_0x159b('0x15')]['message']);return _0x3d2f7f(_0xed9ea0[_0x159b('0x15')][_0x159b('0x17')]);}else{logger[_0x159b('0xf')](_0x159b('0x10'),_0x3bfcf5,_0x159b('0x11'));_0x3d2f7f(_0xed9ea0[_0x159b('0x18')][_0x159b('0x17')]);}})[_0x159b('0x19')](function(_0x367713){logger['error'](_0x159b('0x10'),_0x3bfcf5,_0x367713);_0x11a10e(_0x367713);});});} \ No newline at end of file +var _0x30bc=['../../config/logger','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e8556,_0x2919a6){var _0xa6d570=function(_0x14915b){while(--_0x14915b){_0x1e8556['push'](_0x1e8556['shift']());}};_0xa6d570(++_0x2919a6);}(_0x30bc,0x19b));var _0xc30b=function(_0x3d8776,_0x5305dc){_0x3d8776=_0x3d8776-0x0;var _0x51d331=_0x30bc[_0x3d8776];return _0x51d331;};'use strict';var _=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var moment=require('moment');var BPromise=require(_0xc30b('0x2'));var rs=require(_0xc30b('0x3'));var fs=require('fs');var Redis=require(_0xc30b('0x4'));var db=require(_0xc30b('0x5'))['db'];var utils=require(_0xc30b('0x6'));var logger=require(_0xc30b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc30b('0x8'));var client=jayson[_0xc30b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e41e9,_0x296723,_0x41d370){return new BPromise(function(_0x45e258,_0x3f746d){return client[_0xc30b('0xa')](_0x2e41e9,_0x41d370)[_0xc30b('0xb')](function(_0x1f326c){logger[_0xc30b('0xc')](_0xc30b('0xd'),_0x296723,_0xc30b('0xe'));logger['debug'](_0xc30b('0xf'),_0x296723,'request\x20sent',JSON[_0xc30b('0x10')](_0x1f326c));if(_0x1f326c['error']){if(_0x1f326c['error'][_0xc30b('0x11')]===0x1f4){logger['error'](_0xc30b('0xd'),_0x296723,_0x1f326c[_0xc30b('0x12')]['message']);return _0x3f746d(_0x1f326c['error'][_0xc30b('0x13')]);}logger[_0xc30b('0x12')](_0xc30b('0xd'),_0x296723,_0x1f326c[_0xc30b('0x12')][_0xc30b('0x13')]);return _0x45e258(_0x1f326c[_0xc30b('0x12')]['message']);}else{logger[_0xc30b('0xc')](_0xc30b('0xd'),_0x296723,_0xc30b('0xe'));_0x45e258(_0x1f326c[_0xc30b('0x14')][_0xc30b('0x13')]);}})[_0xc30b('0x15')](function(_0x38e2a4){logger[_0xc30b('0x12')](_0xc30b('0xd'),_0x296723,_0x38e2a4);_0x3f746d(_0x38e2a4);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e9517ef..ad6beec 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 _0x9c96=['index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3b1a8a,_0x3c4177){var _0x4f8b9e=function(_0x128031){while(--_0x128031){_0x3b1a8a['push'](_0x3b1a8a['shift']());}};_0x4f8b9e(++_0x3c4177);}(_0x9c96,0x198));var _0x69c9=function(_0x46ec58,_0x2df1ec){_0x46ec58=_0x46ec58-0x0;var _0x1fafa2=_0x9c96[_0x46ec58];return _0x1fafa2;};'use strict';var multer=require(_0x69c9('0x0'));var util=require(_0x69c9('0x1'));var path=require(_0x69c9('0x2'));var timeout=require(_0x69c9('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x69c9('0x4'));var interaction=require(_0x69c9('0x5'));var config=require('../../config/environment');var controller=require(_0x69c9('0x6'));router[_0x69c9('0x7')]('/',auth['isAuthenticated'](),controller[_0x69c9('0x8')]);router[_0x69c9('0x7')](_0x69c9('0x9'),auth[_0x69c9('0xa')](),controller[_0x69c9('0xb')]);router[_0x69c9('0x7')](_0x69c9('0xc'),auth[_0x69c9('0xa')](),controller['show']);router[_0x69c9('0x7')](_0x69c9('0xd'),auth[_0x69c9('0xa')](),controller[_0x69c9('0xe')]);router[_0x69c9('0x7')](_0x69c9('0xf'),auth[_0x69c9('0xa')](),controller[_0x69c9('0x10')]);router['post']('/',auth[_0x69c9('0xa')](),controller[_0x69c9('0x11')]);router[_0x69c9('0x12')](_0x69c9('0xd'),auth['isAuthenticated'](),controller[_0x69c9('0x13')]);router['post'](_0x69c9('0x14'),auth[_0x69c9('0xa')](),interaction[_0x69c9('0x15')](_0x69c9('0x16'),_0x69c9('0x17')),controller['addTags']);router[_0x69c9('0x18')](_0x69c9('0xc'),auth['isAuthenticated'](),interaction[_0x69c9('0x15')](_0x69c9('0x16'),_0x69c9('0x19')),controller[_0x69c9('0x1a')]);router[_0x69c9('0x1b')](_0x69c9('0xc'),auth[_0x69c9('0xa')](),interaction[_0x69c9('0x15')](_0x69c9('0x16'),_0x69c9('0x1c')),controller[_0x69c9('0x1d')]);router[_0x69c9('0x1b')](_0x69c9('0x14'),auth['isAuthenticated'](),controller[_0x69c9('0x1e')]);module[_0x69c9('0x1f')]=router; \ No newline at end of file +var _0xdfec=['./smsInteraction.controller','isAuthenticated','/describe','describe','show','get','/:id/messages','create','addMessage','post','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xdfec,0x161));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcdfe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcdfe('0x1'));var express=require(_0xcdfe('0x2'));var router=express[_0xcdfe('0x3')]();var auth=require(_0xcdfe('0x4'));var interaction=require(_0xcdfe('0x5'));var config=require(_0xcdfe('0x6'));var controller=require(_0xcdfe('0x7'));router['get']('/',auth[_0xcdfe('0x8')](),controller['index']);router['get'](_0xcdfe('0x9'),auth['isAuthenticated'](),controller[_0xcdfe('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcdfe('0xb')]);router[_0xcdfe('0xc')](_0xcdfe('0xd'),auth[_0xcdfe('0x8')](),controller['getMessages']);router[_0xcdfe('0xc')]('/:id/download',auth[_0xcdfe('0x8')](),controller['download']);router['post']('/',auth[_0xcdfe('0x8')](),controller[_0xcdfe('0xe')]);router['post'](_0xcdfe('0xd'),auth[_0xcdfe('0x8')](),controller[_0xcdfe('0xf')]);router[_0xcdfe('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xcdfe('0x11')](_0xcdfe('0x12'),_0xcdfe('0x13')),controller[_0xcdfe('0x14')]);router[_0xcdfe('0x15')](_0xcdfe('0x16'),auth[_0xcdfe('0x8')](),interaction[_0xcdfe('0x11')](_0xcdfe('0x12'),_0xcdfe('0x17')),controller['update']);router['delete'](_0xcdfe('0x16'),auth[_0xcdfe('0x8')](),interaction['tracked']('sms',_0xcdfe('0x18')),controller[_0xcdfe('0x19')]);router[_0xcdfe('0x1a')](_0xcdfe('0x1b'),auth[_0xcdfe('0x8')](),controller[_0xcdfe('0x1c')]);module[_0xcdfe('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index b22f889..f9b2d00 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 _0xf675=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0xc66af2,_0x14f6d8){var _0x38d439=function(_0x544ab8){while(--_0x544ab8){_0xc66af2['push'](_0xc66af2['shift']());}};_0x38d439(++_0x14f6d8);}(_0xf675,0x1bf));var _0x5f67=function(_0x4ba3c4,_0x24842d){_0x4ba3c4=_0x4ba3c4-0x0;var _0x2b6605=_0xf675[_0x4ba3c4];return _0x2b6605;};'use strict';var Sequelize=require(_0x5f67('0x0'));var moment=require(_0x5f67('0x1'));module[_0x5f67('0x2')]={'closed':{'type':Sequelize[_0x5f67('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5f67('0x4')]},'disposition':{'type':Sequelize[_0x5f67('0x5')]},'note':{'type':Sequelize[_0x5f67('0x5')]},'phone':{'type':Sequelize[_0x5f67('0x5')]},'read1stAt':{'type':Sequelize[_0x5f67('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5f67('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5f67('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5f67('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x11e3=['ENUM','out','DATE','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x3f71df,_0xf4b3a7){var _0x2bcd00=function(_0x3a305b){while(--_0x3a305b){_0x3f71df['push'](_0x3f71df['shift']());}};_0x2bcd00(++_0xf4b3a7);}(_0x11e3,0x17b));var _0x311e=function(_0x1386d7,_0x29b82c){_0x1386d7=_0x1386d7-0x0;var _0x5b3972=_0x11e3[_0x1386d7];return _0x5b3972;};'use strict';var Sequelize=require(_0x311e('0x0'));var moment=require(_0x311e('0x1'));module[_0x311e('0x2')]={'closed':{'type':Sequelize[_0x311e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x311e('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x311e('0x5')]('in',_0x311e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x311e('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x311e('0x5')]('in','out'),'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 75e6d46..ff25e61 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 _0x3efd=['path','sox','ejs','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','Content-Range','json','reject','save','update','then','error','stack','name','closed','unreadMessages','SmsMessage','count','map','TagIds','Tags','split','forEach','push','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','from','tools_tags','select','COUNT(*)','sms_messages','me.SmsInteractionId\x20=\x20i.id','me.direction\x20=\x20\x27in\x27','me.read\x20=\x20false','u.id','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','expr','advancedFilter','parse','value','startOf','utc','format','day','and','isArray','condition','TagId','Messages.count','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','ContactId','c.firstName','\x20LIKE\x20?','c.lastName','c.email','\x20>\x20?','\x20<\x20?','filter','isNil','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','toString','join','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','DESC','Sequelize','QueryTypes','SELECT','read','%s\x20=\x200','having','`Messages.count`\x20=\x200','`Messages.count`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','mail_interaction_has_tags','%s\x20>\x200','sequelize','keyBy','Account.key','Contact.firstName','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','show','SmsInteraction','merge','find','create','body','params','describe','addMessage','omit','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','setTags','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','files','tmp','server','attachments','transcript-%d-%s.zip','Messages','direction','secret','User','Contact','firstName','SmsAccount','Owner','get','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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','fullname','N.A.','closedAt','out','System','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util'];(function(_0xe93dca,_0x13f538){var _0x1d5a25=function(_0x154012){while(--_0x154012){_0xe93dca['push'](_0xe93dca['shift']());}};_0x1d5a25(++_0x13f538);}(_0x3efd,0xcc));var _0xd3ef=function(_0x1ddeb2,_0x3cf4d2){_0x1ddeb2=_0x1ddeb2-0x0;var _0x3b2185=_0x3efd[_0x1ddeb2];return _0x3b2185;};'use strict';var pdf=require(_0xd3ef('0x0'));var emlformat=require(_0xd3ef('0x1'));var rimraf=require(_0xd3ef('0x2'));var zipdir=require(_0xd3ef('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3ef('0x4'));var moment=require('moment');var BPromise=require(_0xd3ef('0x5'));var Mustache=require(_0xd3ef('0x6'));var util=require(_0xd3ef('0x7'));var path=require(_0xd3ef('0x8'));var sox=require(_0xd3ef('0x9'));var csv=require('to-csv');var ejs=require(_0xd3ef('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd3ef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd3ef('0xc'));var querystring=require('querystring');var Papa=require(_0xd3ef('0xd'));var Redis=require(_0xd3ef('0xe'));var authService=require(_0xd3ef('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd3ef('0x10'));var config=require(_0xd3ef('0x11'));var db=require(_0xd3ef('0x12'))['db'];config[_0xd3ef('0x13')]=_[_0xd3ef('0x14')](config[_0xd3ef('0x13')],{'host':_0xd3ef('0x15'),'port':0x18eb});var socket=require(_0xd3ef('0x16'))(new Redis(config[_0xd3ef('0x13')]));require(_0xd3ef('0x17'))[_0xd3ef('0x18')](socket);function respondWithStatusCode(_0xfa7511,_0x4cd54d){_0x4cd54d=_0x4cd54d||0xcc;return function(_0xf943f8){if(_0xf943f8){return _0xfa7511[_0xd3ef('0x19')](_0x4cd54d);}return _0xfa7511[_0xd3ef('0x1a')](_0x4cd54d)['end']();};}function respondWithResult(_0x4bfc6e,_0x23d437){_0x23d437=_0x23d437||0xc8;return function(_0x2507c2){if(_0x2507c2){return _0x4bfc6e[_0xd3ef('0x1a')](_0x23d437)['json'](_0x2507c2);}};}function respondWithFilteredResult(_0x10eae8,_0x2d7a4c){return function(_0x137803){if(_0x137803){var _0x53c2fb=_0x137803['count'],_0x5db4a8=_0x2d7a4c[_0xd3ef('0x1b')],_0x5a22ac=_0x2d7a4c[_0xd3ef('0x1b')]+_0x2d7a4c['limit'],_0x5db00f;if(_0x5a22ac>=_0x53c2fb){_0x5a22ac=_0x53c2fb;_0x5db00f=0xc8;}else{_0x5db00f=0xce;}_0x10eae8[_0xd3ef('0x1a')](_0x5db00f);return _0x10eae8['set'](_0xd3ef('0x1c'),_0x5db4a8+'-'+_0x5a22ac+'/'+_0x53c2fb)[_0xd3ef('0x1d')](_0x137803);}return null;};}function patchUpdates(_0x2deb3f){return function(_0x2ce525){try{jsonpatch['apply'](_0x2ce525,_0x2deb3f,!![]);}catch(_0x2767f0){return BPromise[_0xd3ef('0x1e')](_0x2767f0);}return _0x2ce525[_0xd3ef('0x1f')]();};}function saveUpdates(_0x20a94c,_0x57f15e){return function(_0x21b10d){if(_0x21b10d){return _0x21b10d[_0xd3ef('0x20')](_0x20a94c)[_0xd3ef('0x21')](function(_0x308ddd){return _0x308ddd;});}return null;};}function removeEntity(_0xdc129f,_0x5588db){return function(_0x1084f3){if(_0x1084f3){return _0x1084f3['destroy']()['then'](function(){_0xdc129f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23b7a4,_0x31dd7a){return function(_0x325687){if(!_0x325687){_0x23b7a4[_0xd3ef('0x19')](0x194);}return _0x325687;};}function handleError(_0xbbbddc,_0x3229a9){_0x3229a9=_0x3229a9||0x1f4;return function(_0x5b6729){logger[_0xd3ef('0x22')](_0x5b6729[_0xd3ef('0x23')]);if(_0x5b6729[_0xd3ef('0x24')]){delete _0x5b6729[_0xd3ef('0x24')];}_0xbbbddc[_0xd3ef('0x1a')](_0x3229a9)['send'](_0x5b6729);};}function getInteractionUnreadMessages(_0x3897b7){return new BPromise(function(_0x33c3fe,_0x28894e){try{if(_0x3897b7[_0xd3ef('0x25')]){_0x3897b7[_0xd3ef('0x26')]=0x0;_0x33c3fe(_0x3897b7);}else{return db[_0xd3ef('0x27')][_0xd3ef('0x28')]({'where':{'SmsInteractionId':_0x3897b7['id'],'direction':'in','read':![]}})[_0xd3ef('0x21')](function(_0x50866b){_0x3897b7[_0xd3ef('0x26')]=_0x50866b;_0x33c3fe(_0x3897b7);});}}catch(_0x3e8a9b){_0x28894e(_0x3e8a9b);}});}function getInteractionUsers(_0x16b757,_0x3d6d2c){return new BPromise(function(_0x1f66ec,_0x3fb5d0){try{if(_0x3d6d2c[_0x16b757['id']]){_0x16b757['Users']=_[_0xd3ef('0x29')](_0x3d6d2c[_0x16b757['id']],function(_0x54da5b){return{'id':_0x54da5b['id']};});}}catch(_0x288953){_0x3fb5d0(_0x288953);}_0x1f66ec(_0x16b757);});}function getInteractionTags(_0x6dc190,_0x462a73){return new BPromise(function(_0x518e22,_0x41238a){try{if(_0x6dc190[_0xd3ef('0x2a')]){_0x6dc190[_0xd3ef('0x2b')]=[];_0x6dc190[_0xd3ef('0x2a')][_0xd3ef('0x2c')](',')[_0xd3ef('0x2d')](function(_0x67a2a1){_0x6dc190[_0xd3ef('0x2b')][_0xd3ef('0x2e')](_0x462a73[_0x67a2a1]);});}delete _0x6dc190[_0xd3ef('0x2a')];}catch(_0x2c718c){_0x41238a(_0x2c718c);}_0x518e22(_0x6dc190);});}function updateSmsInteraction(_0x1d7c2f,_0x52d07d,_0x37f34e){return new BPromise(function(_0x4ece17,_0x23dc8f){return getInteractionUnreadMessages(_0x1d7c2f)['then'](function(_0x3e7957){return getInteractionUsers(_0x3e7957,_0x37f34e);})['then'](function(_0x5c388c){return getInteractionTags(_0x5c388c,_0x52d07d);})[_0xd3ef('0x21')](function(_0x2f809d){_0x4ece17(_0x2f809d);})['catch'](function(_0x4f60a9){_0x23dc8f(_0x4f60a9);});});}exports['index']=function(_0x2674ba,_0x2f420b){var _0x285ad0={},_0x17b852={},_0x2cf40a={'count':0x0,'rows':[]};var _0x378782=db['SmsInteraction'][_0xd3ef('0x2f')];_0x17b852[_0xd3ef('0x30')]=_[_0xd3ef('0x31')](_0x378782);_0x17b852[_0xd3ef('0x32')]=_['keys'](_0x2674ba[_0xd3ef('0x32')]);_0x17b852[_0xd3ef('0x33')]=_['intersection'](_0x17b852[_0xd3ef('0x30')],_0x17b852[_0xd3ef('0x32')]);_0x285ad0[_0xd3ef('0x34')]=_[_0xd3ef('0x35')](_0x17b852[_0xd3ef('0x30')],qs['fields'](_0x2674ba[_0xd3ef('0x32')][_0xd3ef('0x36')]));_0x285ad0[_0xd3ef('0x34')]=_0x285ad0[_0xd3ef('0x34')][_0xd3ef('0x37')]?_0x285ad0[_0xd3ef('0x34')]:_0x17b852[_0xd3ef('0x30')];if(!_0x2674ba['query'][_0xd3ef('0x38')](_0xd3ef('0x39'))){_0x285ad0['limit']=qs[_0xd3ef('0x3a')](_0x2674ba[_0xd3ef('0x32')][_0xd3ef('0x3a')]);_0x285ad0[_0xd3ef('0x1b')]=qs[_0xd3ef('0x1b')](_0x2674ba[_0xd3ef('0x32')][_0xd3ef('0x1b')]);}_0x285ad0[_0xd3ef('0x3b')]=qs[_0xd3ef('0x3c')](_0x2674ba[_0xd3ef('0x32')]['sort']);_0x285ad0[_0xd3ef('0x3d')]=qs[_0xd3ef('0x33')](_[_0xd3ef('0x3e')](_0x2674ba[_0xd3ef('0x32')],_0x17b852[_0xd3ef('0x33')]));var _0x2d8449=[];var _0xe6b2c6=squel['select']()[_0xd3ef('0x3f')]('id')[_0xd3ef('0x3f')]('name')['field']('color')[_0xd3ef('0x40')](_0xd3ef('0x41'));var _0x4192e0=squel[_0xd3ef('0x42')]()['field'](_0xd3ef('0x43'))['from'](_0xd3ef('0x44'),'me')[_0xd3ef('0x3d')](_0xd3ef('0x45'))[_0xd3ef('0x3d')](_0xd3ef('0x46'))[_0xd3ef('0x3d')](_0xd3ef('0x47'));var _0x3433c5=squel[_0xd3ef('0x42')]()[_0xd3ef('0x3f')](_0xd3ef('0x48'))[_0xd3ef('0x3f')]('ui.SmsInteractionId')['from']('user_has_sms_interactions','ui')[_0xd3ef('0x49')](_0xd3ef('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x2e18a3=squel['select']()[_0xd3ef('0x40')]('sms_interactions','i')['left_join']('cm_contacts','c',_0xd3ef('0x4b'))[_0xd3ef('0x49')](_0xd3ef('0x4a'),'o',_0xd3ef('0x4c'))[_0xd3ef('0x49')]('sms_accounts','a',_0xd3ef('0x4d'))['left_join']('sms_messages','me',_0xd3ef('0x45'));var _0x4fb34e=squel[_0xd3ef('0x4e')]();if(_0x2674ba['query'][_0xd3ef('0x4f')]){var _0x1fd98c=JSON[_0xd3ef('0x50')](_0x2674ba[_0xd3ef('0x32')]['advancedFilter']);_['keys'](_0x1fd98c)[_0xd3ef('0x2d')](function(_0x409076){var _0x554192=_0x1fd98c[_0x409076];if(_0x409076==='createdAt'){var _0x56bcdb=moment(_0x554192[_0xd3ef('0x51')]['dateStart'])[_0xd3ef('0x52')]('day')[_0xd3ef('0x53')]()[_0xd3ef('0x54')]();var _0x5a4249=moment(_0x5a4249)[_0xd3ef('0x53')]()['endOf'](_0xd3ef('0x55'))[_0xd3ef('0x54')]();_0x4fb34e[_0xd3ef('0x56')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x56bcdb,_0x5a4249);}else{if(_[_0xd3ef('0x57')](_0x554192[_0xd3ef('0x58')])){_0x554192[_0xd3ef('0x58')][_0xd3ef('0x2d')](function(_0x51071b){switch(_0x554192[_0xd3ef('0x58')][_0xd3ef('0x51')]){case'IS':if(_0x409076!==_0xd3ef('0x59')&&_0x409076!==_0xd3ef('0x5a')){if(_[_0xd3ef('0x57')](_0x554192[_0xd3ef('0x51')])&&_0x554192['value']['length']>0x1){_0x4fb34e[_0xd3ef('0x56')](_0x554192[_0xd3ef('0x5b')]+'.'+_0x409076+_0xd3ef('0x5c'),_0x554192[_0xd3ef('0x51')]);}else{_0x4fb34e[_0xd3ef('0x56')](_0x554192['tableAlias']+'.'+_0x409076+_0xd3ef('0x5d'),_0x554192[_0xd3ef('0x51')][0x0]);}}break;case'=':_0x4fb34e[_0xd3ef('0x56')](_0x554192['tableAlias']+'.'+_0x409076+'\x20=\x20?',_0x554192[_0xd3ef('0x51')]);break;case _0xd3ef('0x5e'):if(_0x409076===_0xd3ef('0x5f')){_0x4fb34e['and'](_0xd3ef('0x60')+_0xd3ef('0x61'),'%'+_0x554192[_0xd3ef('0x51')]+'%');_0x4fb34e['or'](_0xd3ef('0x62')+'\x20LIKE\x20?','%'+_0x554192[_0xd3ef('0x51')]+'%');_0x4fb34e['or'](_0xd3ef('0x63')+_0xd3ef('0x61'),'%'+_0x554192[_0xd3ef('0x51')]+'%');}else{_0x4fb34e[_0xd3ef('0x56')](_0x554192[_0xd3ef('0x5b')]+'.'+_0x409076+_0xd3ef('0x61'),'%'+_0x554192[_0xd3ef('0x51')]+'%');}break;case'>':_0x4fb34e['and'](_0x554192['tableAlias']+'.'+_0x409076+_0xd3ef('0x64'),_0x554192[_0xd3ef('0x51')]);break;case'<':_0x4fb34e['and'](_0x554192[_0xd3ef('0x5b')]+'.'+_0x409076+_0xd3ef('0x65'),_0x554192[_0xd3ef('0x51')]);break;}});}else{switch(_0x554192[_0xd3ef('0x58')][_0xd3ef('0x51')]){case'IS':if(_0x409076!=='TagId'&&_0x409076!==_0xd3ef('0x5a')){if(_['isArray'](_0x554192[_0xd3ef('0x51')])&&_0x554192[_0xd3ef('0x51')][_0xd3ef('0x37')]>0x1){_0x4fb34e['and'](_0x554192['tableAlias']+'.'+_0x409076+_0xd3ef('0x5c'),_0x554192[_0xd3ef('0x51')]);}else{_0x4fb34e[_0xd3ef('0x56')](_0x554192[_0xd3ef('0x5b')]+'.'+_0x409076+'\x20=\x20?',_0x554192[_0xd3ef('0x51')][0x0]);}}break;case'=':_0x4fb34e['and'](_0x554192[_0xd3ef('0x5b')]+'.'+_0x409076+'\x20=\x20?',_0x554192[_0xd3ef('0x51')]);break;case _0xd3ef('0x5e'):if(_0x409076===_0xd3ef('0x5f')){_0x4fb34e[_0xd3ef('0x56')](_0xd3ef('0x60')+_0xd3ef('0x61'),'%'+_0x554192[_0xd3ef('0x51')]+'%');_0x4fb34e['or']('c.lastName'+_0xd3ef('0x61'),'%'+_0x554192[_0xd3ef('0x51')]+'%');_0x4fb34e['or'](_0xd3ef('0x63')+_0xd3ef('0x61'),'%'+_0x554192['value']+'%');}else{_0x4fb34e[_0xd3ef('0x56')](_0x554192['tableAlias']+'.'+_0x409076+_0xd3ef('0x61'),'%'+_0x554192[_0xd3ef('0x51')]+'%');}break;case'>':_0x4fb34e[_0xd3ef('0x56')](_0x554192[_0xd3ef('0x5b')]+'.'+_0x409076+_0xd3ef('0x64'),_0x554192[_0xd3ef('0x51')]);break;case'<':_0x4fb34e['and'](_0x554192['tableAlias']+'.'+_0x409076+_0xd3ef('0x65'),_0x554192[_0xd3ef('0x51')]);break;}}}});}else{var _0x416eb0=_(Object[_0xd3ef('0x31')](_0x2674ba[_0xd3ef('0x32')]))[_0xd3ef('0x29')](function(_0x9aaccb){return _0x378782['hasOwnProperty'](_0x9aaccb)?_0x9aaccb:undefined;})[_0xd3ef('0x66')](function(_0x211972){return!_[_0xd3ef('0x67')](_0x211972);})[_0xd3ef('0x51')]();if(!_['isEmpty'](_0x416eb0)){_0x416eb0[_0xd3ef('0x2d')](function(_0x1c7af6){if(_0x1c7af6===_0xd3ef('0x68')){_0x2e18a3[_0xd3ef('0x3d')](_0xd3ef('0x69'),[][_0xd3ef('0x6a')](_0x2674ba[_0xd3ef('0x32')][_0x1c7af6]));}else if(_0x1c7af6===_0xd3ef('0x6b')){var _0x4fd876=JSON[_0xd3ef('0x50')](_0x2674ba[_0xd3ef('0x32')][_0x1c7af6])[_0xd3ef('0x6c')];var _0x398a41=JSON[_0xd3ef('0x50')](_0x2674ba[_0xd3ef('0x32')][_0x1c7af6])[_0xd3ef('0x6d')];_0x2e18a3[_0xd3ef('0x3d')](_0xd3ef('0x6e'),_0x4fd876,_0x398a41);}else{if(_0x2674ba['query'][_0x1c7af6]==='null'){_0x2e18a3[_0xd3ef('0x3d')]('i.'+_0x1c7af6+_0xd3ef('0x6f'));}else{_0x2e18a3[_0xd3ef('0x3d')]('i.'+_0x1c7af6+_0xd3ef('0x5d'),_0x2674ba[_0xd3ef('0x32')][_0x1c7af6]);}}});}if(_0x2674ba[_0xd3ef('0x32')][_0xd3ef('0x66')]){var _0x44020b=_0x2674ba['query'][_0xd3ef('0x66')][_0xd3ef('0x70')]('\x5c','\x5c\x5c')[_0xd3ef('0x70')]('\x27\x27',_0xd3ef('0x71'));if(qs[_0xd3ef('0x72')](_0x44020b)){_0x4fb34e['or'](_0xd3ef('0x73'),_0x44020b+'%')['or'](_0xd3ef('0x74'),_0x44020b+'%');}else{var _0x456134=[];_0x44020b[_0xd3ef('0x2c')]('\x20')[_0xd3ef('0x2d')](function(_0x4ab050){_0x456134[_0xd3ef('0x2e')]('+'+_0x4ab050[_0xd3ef('0x75')]());});var _0x2ac2fa=_0x456134[_0xd3ef('0x76')]('\x20');_0x4fb34e['or'](_0xd3ef('0x77'),_0x2ac2fa)['or'](_0xd3ef('0x78'),_0x44020b+'%');}}}_0x2e18a3['where'](_0x4fb34e);if(_0x285ad0[_0xd3ef('0x3b')]){_0x285ad0['order'][_0xd3ef('0x2d')](function(_0x4ad677){_0x2e18a3[_0xd3ef('0x3b')]('i.'+_0x4ad677[0x0],_0x4ad677[0x1]===_0xd3ef('0x79')?![]:!![]);});}_0x2e18a3['group']('i.id');var _0x3ed42b={'type':db[_0xd3ef('0x7a')][_0xd3ef('0x7b')][_0xd3ef('0x7c')],'raw':!![]};var _0x3c3d76=_0x2e18a3['clone']()['field'](_0xd3ef('0x43'));if(!_0x2674ba['query'][_0xd3ef('0x4f')]){if(_0x2674ba[_0xd3ef('0x32')]['read']){if(_0x2674ba[_0xd3ef('0x32')][_0xd3ef('0x7d')]==0x1){_0x3c3d76[_0xd3ef('0x3d')](util['format'](_0xd3ef('0x7e'),_0x4192e0['toString']()));_0x2e18a3[_0xd3ef('0x7f')](_0xd3ef('0x80'));}else{_0x3c3d76[_0xd3ef('0x3d')](util[_0xd3ef('0x54')]('%s\x20>\x200',_0x4192e0[_0xd3ef('0x75')]()));_0x2e18a3[_0xd3ef('0x7f')](_0xd3ef('0x81'));}}if(_0x2674ba[_0xd3ef('0x32')]['tag']){var _0x2c1afe=_[_0xd3ef('0x57')](_0x2674ba[_0xd3ef('0x32')]['tag'])?_0x2674ba[_0xd3ef('0x32')][_0xd3ef('0x82')]:new Array(_0x2674ba[_0xd3ef('0x32')]['tag']);var _0x5131dd=squel[_0xd3ef('0x4e')]();_0x2c1afe[_0xd3ef('0x2d')](function(_0x39aabf){_0x5131dd['or'](_0xd3ef('0x83'),'%,'+_0x39aabf+',%');});_0x2e18a3[_0xd3ef('0x7f')](_0x5131dd);_0x3c3d76[_0xd3ef('0x49')](_0xd3ef('0x84'),'it',_0xd3ef('0x85'));_0x3c3d76['left_join'](_0xd3ef('0x41'),'t',_0xd3ef('0x86'));_0x3c3d76[_0xd3ef('0x3d')](_0xd3ef('0x87'),_0x2c1afe);}}else{var _0x1fd98c=JSON['parse'](_0x2674ba[_0xd3ef('0x32')]['advancedFilter']);_[_0xd3ef('0x31')](_0x1fd98c)[_0xd3ef('0x2d')](function(_0x214c3){var _0x4a3c37=_0x1fd98c[_0x214c3];if(_0x214c3===_0xd3ef('0x59')){var _0x44d10d=_0x4a3c37[_0xd3ef('0x51')];var _0x125e42=squel[_0xd3ef('0x4e')]();_0x44d10d[_0xd3ef('0x2d')](function(_0x28c290){_0x125e42['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28c290+',%');});_0x2e18a3[_0xd3ef('0x7f')](_0x125e42);_0x3c3d76[_0xd3ef('0x49')](_0xd3ef('0x88'),'it','it.MailInteractionId\x20=\x20i.id');_0x3c3d76[_0xd3ef('0x49')](_0xd3ef('0x41'),'t','t.id\x20=\x20it.TagId');_0x3c3d76['where'](_0xd3ef('0x87'),_0x44d10d);}else if(_0x214c3===_0xd3ef('0x5a')){if(_0x4a3c37[_0xd3ef('0x51')][_0xd3ef('0x37')]===0x1){if(_0x4a3c37[_0xd3ef('0x51')][0x0]===0x1){_0x3c3d76['where'](util[_0xd3ef('0x54')]('%s\x20=\x200',_0x4192e0[_0xd3ef('0x75')]()));_0x2e18a3[_0xd3ef('0x7f')](_0xd3ef('0x80'));}else{_0x3c3d76['where'](util[_0xd3ef('0x54')](_0xd3ef('0x89'),_0x4192e0[_0xd3ef('0x75')]()));_0x2e18a3[_0xd3ef('0x7f')](_0xd3ef('0x81'));}}}});}db[_0xd3ef('0x8a')][_0xd3ef('0x32')](_0x3c3d76[_0xd3ef('0x75')](),_0x3ed42b)[_0xd3ef('0x21')](function(_0x432ea0){_0x2cf40a[_0xd3ef('0x28')]=_0x432ea0[_0xd3ef('0x37')];if(_0x2cf40a[_0xd3ef('0x28')]===0x0)return[];return db[_0xd3ef('0x8a')][_0xd3ef('0x32')](_0xe6b2c6[_0xd3ef('0x75')](),_0x3ed42b)['then'](function(_0x3a407b){_0x2d8449=_[_0xd3ef('0x8b')](_0x3a407b,'id');_0x3ed42b=_['merge'](_0x3ed42b,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});_0x2e18a3[_0xd3ef('0x3f')]('a.key',_0xd3ef('0x8c'));_0x2e18a3['field']('i.*');_0x2e18a3[_0xd3ef('0x3f')](_0xd3ef('0x60'),_0xd3ef('0x8d'));_0x2e18a3[_0xd3ef('0x3f')](_0xd3ef('0x62'),'Contact.lastName');_0x2e18a3[_0xd3ef('0x3f')](_0xd3ef('0x63'),'Contact.email');_0x2e18a3[_0xd3ef('0x3f')]('c.phone',_0xd3ef('0x8e'));_0x2e18a3['field'](_0xd3ef('0x8f'),_0xd3ef('0x90'));_0x2e18a3[_0xd3ef('0x3f')](_0xd3ef('0x91'),_0xd3ef('0x92'));_0x2e18a3[_0xd3ef('0x3f')](_0xd3ef('0x93'),_0xd3ef('0x2a'));_0x2e18a3['left_join'](_0xd3ef('0x84'),'it','it.SmsInteractionId\x20=\x20i.id');_0x2e18a3[_0xd3ef('0x49')](_0xd3ef('0x41'),'t',_0xd3ef('0x86'));_0x2e18a3['limit'](_0x285ad0['limit']);_0x2e18a3[_0xd3ef('0x1b')](_0x285ad0[_0xd3ef('0x1b')]);return db[_0xd3ef('0x8a')]['query'](_0x2e18a3[_0xd3ef('0x75')](),_0x3ed42b);})[_0xd3ef('0x21')](function(_0x483e2a){_0x3433c5[_0xd3ef('0x3d')](_0xd3ef('0x94'),_[_0xd3ef('0x29')](_0x483e2a,'id'));return db['sequelize'][_0xd3ef('0x32')](_0x3433c5[_0xd3ef('0x75')](),_0x3ed42b)[_0xd3ef('0x21')](function(_0x4bdf26){var _0x35dad2=_[_0xd3ef('0x95')](_0x4bdf26,_0xd3ef('0x96'));var _0xc216fa=[];_0x483e2a['forEach'](function(_0x1fab3b){_0xc216fa['push'](updateSmsInteraction(_0x1fab3b,_0x2d8449,_0x35dad2));});return BPromise[_0xd3ef('0x97')](_0xc216fa);});});})['then'](function(_0x1aa7a4){_0x2cf40a[_0xd3ef('0x98')]=_0x1aa7a4;return _0x2cf40a;})[_0xd3ef('0x21')](respondWithFilteredResult(_0x2f420b,_0x285ad0))[_0xd3ef('0x99')](handleError(_0x2f420b,null));};exports[_0xd3ef('0x9a')]=function(_0x325fb2,_0xf0dca7){var _0x255563={'raw':![],'where':{'id':_0x325fb2['params']['id']}},_0x5da04a={};_0x5da04a['model']=_[_0xd3ef('0x31')](db[_0xd3ef('0x9b')][_0xd3ef('0x2f')]);_0x5da04a[_0xd3ef('0x32')]=_[_0xd3ef('0x31')](_0x325fb2[_0xd3ef('0x32')]);_0x5da04a[_0xd3ef('0x33')]=_['intersection'](_0x5da04a[_0xd3ef('0x30')],_0x5da04a['query']);_0x255563['attributes']=_[_0xd3ef('0x35')](_0x5da04a[_0xd3ef('0x30')],qs[_0xd3ef('0x36')](_0x325fb2['query']['fields']));_0x255563[_0xd3ef('0x34')]=_0x255563[_0xd3ef('0x34')][_0xd3ef('0x37')]?_0x255563[_0xd3ef('0x34')]:_0x5da04a['model'];if(_0x325fb2[_0xd3ef('0x32')]['includeAll']){_0x255563['include']=[{'all':!![]}];}_0x255563=_[_0xd3ef('0x9c')]({},_0x255563,_0x325fb2['options']);return db[_0xd3ef('0x9b')][_0xd3ef('0x9d')](_0x255563)[_0xd3ef('0x21')](handleEntityNotFound(_0xf0dca7,null))[_0xd3ef('0x21')](respondWithResult(_0xf0dca7,null))['catch'](handleError(_0xf0dca7,null));};exports['create']=function(_0x16e331,_0x332f5e){return db[_0xd3ef('0x9b')][_0xd3ef('0x9e')](_0x16e331[_0xd3ef('0x9f')],{})[_0xd3ef('0x21')](respondWithResult(_0x332f5e,0xc9))[_0xd3ef('0x99')](handleError(_0x332f5e,null));};exports[_0xd3ef('0x20')]=function(_0x109d3c,_0x4609f6){if(_0x109d3c[_0xd3ef('0x9f')]['id']){delete _0x109d3c[_0xd3ef('0x9f')]['id'];}return db[_0xd3ef('0x9b')][_0xd3ef('0x9d')]({'where':{'id':_0x109d3c[_0xd3ef('0xa0')]['id']}})[_0xd3ef('0x21')](handleEntityNotFound(_0x4609f6,null))[_0xd3ef('0x21')](saveUpdates(_0x109d3c[_0xd3ef('0x9f')],null))[_0xd3ef('0x21')](respondWithResult(_0x4609f6,null))[_0xd3ef('0x99')](handleError(_0x4609f6,null));};exports['destroy']=function(_0x343832,_0x2f2434){return db['SmsInteraction'][_0xd3ef('0x9d')]({'where':{'id':_0x343832[_0xd3ef('0xa0')]['id']}})[_0xd3ef('0x21')](handleEntityNotFound(_0x2f2434,null))[_0xd3ef('0x21')](removeEntity(_0x2f2434,null))['catch'](handleError(_0x2f2434,null));};exports[_0xd3ef('0xa1')]=function(_0x5d8e18,_0x12166b){return db[_0xd3ef('0x9b')][_0xd3ef('0xa1')]()[_0xd3ef('0x21')](respondWithResult(_0x12166b,null))['catch'](handleError(_0x12166b,null));};exports[_0xd3ef('0xa2')]=function(_0x4ad8e9,_0x4cbe35,_0x38f1e9){return db[_0xd3ef('0x27')]['find']({'where':{'id':_0x4ad8e9['params']['id']}})['then'](handleEntityNotFound(_0x4cbe35,null))[_0xd3ef('0x21')](function(_0x2db545){if(_0x2db545){return _0x2db545['addMessage'](_0x4ad8e9[_0xd3ef('0x9f')]['ids'],_[_0xd3ef('0xa3')](_0x4ad8e9['body'],[_0xd3ef('0xa4'),'id'])||{});}})[_0xd3ef('0x21')](respondWithResult(_0x4cbe35,null))[_0xd3ef('0x99')](handleError(_0x4cbe35,null));};exports['getMessages']=function(_0x3b0d75,_0x1eda48,_0x26fe3d){var _0x2e7335={'raw':![],'where':{}};var _0x2309c3={};var _0x2c1bb1={'count':0x0,'rows':[]};return db[_0xd3ef('0x9b')][_0xd3ef('0xa5')]({'where':{'id':_0x3b0d75[_0xd3ef('0xa0')]['id']}})[_0xd3ef('0x21')](handleEntityNotFound(_0x1eda48,null))['then'](function(_0x1e3898){if(_0x1e3898){_0x2309c3[_0xd3ef('0x30')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x2309c3[_0xd3ef('0x32')]=_[_0xd3ef('0x31')](_0x3b0d75['query']);_0x2309c3['filters']=_[_0xd3ef('0x35')](_0x2309c3['model'],_0x2309c3[_0xd3ef('0x32')]);_0x2e7335[_0xd3ef('0x34')]=_[_0xd3ef('0x35')](_0x2309c3[_0xd3ef('0x30')],qs[_0xd3ef('0x36')](_0x3b0d75['query'][_0xd3ef('0x36')]));_0x2e7335[_0xd3ef('0x34')]=_0x2e7335[_0xd3ef('0x34')][_0xd3ef('0x37')]?_0x2e7335[_0xd3ef('0x34')]:_0x2309c3[_0xd3ef('0x30')];if(!_0x3b0d75['query'][_0xd3ef('0x38')](_0xd3ef('0x39'))){_0x2e7335[_0xd3ef('0x3a')]=qs['limit'](_0x3b0d75['query'][_0xd3ef('0x3a')]);_0x2e7335['offset']=qs[_0xd3ef('0x1b')](_0x3b0d75[_0xd3ef('0x32')]['offset']);}_0x2e7335[_0xd3ef('0x3b')]=qs[_0xd3ef('0x3c')](_0x3b0d75[_0xd3ef('0x32')]['sort']);_0x2e7335[_0xd3ef('0x3d')]=qs[_0xd3ef('0x33')](_[_0xd3ef('0x3e')](_0x3b0d75[_0xd3ef('0x32')],_0x2309c3[_0xd3ef('0x33')]));_0x2e7335[_0xd3ef('0x3d')][_0xd3ef('0x96')]=_0x1e3898['id'];if(_0x3b0d75[_0xd3ef('0x32')]['filter']){_0x2e7335['where']=_[_0xd3ef('0x9c')](_0x2e7335[_0xd3ef('0x3d')],{'$or':_['map'](_0x2e7335[_0xd3ef('0x34')],function(_0x2b5118){var _0x276391={};_0x276391[_0x2b5118]={'$like':'%'+_0x3b0d75['query']['filter']+'%'};return _0x276391;})});}if(_0x3b0d75[_0xd3ef('0x32')][_0xd3ef('0x6c')]){var _0x3fc9db=_0x3b0d75[_0xd3ef('0x32')][_0xd3ef('0x6c')][_0xd3ef('0x2c')](',');var _0x57dad5={};_0x57dad5[_0x3fc9db[0x0]]={'$gte':moment(_0x3fc9db[0x1])['format'](_0xd3ef('0xa6'))};_0x2e7335[_0xd3ef('0x3d')]=_['merge'](_0x2e7335[_0xd3ef('0x3d')],_0x57dad5);}_0x2e7335=_[_0xd3ef('0x9c')]({},_0x2e7335,_0x3b0d75[_0xd3ef('0xa7')]);return db[_0xd3ef('0x27')][_0xd3ef('0x28')]({'where':_0x2e7335[_0xd3ef('0x3d')]})[_0xd3ef('0x21')](function(_0x5b1d42){_0x2c1bb1[_0xd3ef('0x28')]=_0x5b1d42;if(_0x3b0d75[_0xd3ef('0x32')]['includeAll']){_0x2e7335[_0xd3ef('0xa8')]=[{'all':!![]}];}return db['SmsMessage'][_0xd3ef('0xa9')](_0x2e7335);})[_0xd3ef('0x21')](function(_0x4bd01d){_0x2c1bb1[_0xd3ef('0x98')]=_0x4bd01d;return _0x2c1bb1;});}})[_0xd3ef('0x21')](respondWithFilteredResult(_0x1eda48,_0x2e7335))[_0xd3ef('0x99')](handleError(_0x1eda48,null));};exports['addTags']=function(_0x40e2a6,_0x1828f3,_0xfdcab6){return db[_0xd3ef('0x9b')][_0xd3ef('0x9d')]({'where':{'id':_0x40e2a6[_0xd3ef('0xa0')]['id']}})['then'](handleEntityNotFound(_0x1828f3,null))['then'](function(_0x31bf73){if(_0x31bf73){return _0x31bf73[_0xd3ef('0xaa')](_0x40e2a6[_0xd3ef('0x9f')][_0xd3ef('0xa4')],_[_0xd3ef('0xa3')](_0x40e2a6[_0xd3ef('0x9f')],[_0xd3ef('0xa4'),'id'])||{})['spread'](function(){return db[_0xd3ef('0xab')]['findAll']({'attributes':['id',_0xd3ef('0x24'),'color'],'where':{'id':_0x40e2a6[_0xd3ef('0x9f')][_0xd3ef('0xa4')]}});})[_0xd3ef('0x21')](function(_0x98d823){socket[_0xd3ef('0xac')](_0xd3ef('0xad'),{'id':Number(_0x40e2a6[_0xd3ef('0xa0')]['id']),'tags':_0x98d823||[]});return{'id':Number(_0x40e2a6[_0xd3ef('0xa0')]['id']),'tags':_0x98d823||[]};});}})[_0xd3ef('0x21')](respondWithResult(_0x1828f3,null))[_0xd3ef('0x99')](handleError(_0x1828f3,null));};exports[_0xd3ef('0xae')]=function(_0x2fc48f,_0xa6654d,_0x5e9596){return db[_0xd3ef('0x9b')][_0xd3ef('0x9d')]({'where':{'id':_0x2fc48f[_0xd3ef('0xa0')]['id']}})[_0xd3ef('0x21')](handleEntityNotFound(_0xa6654d,null))['then'](function(_0x63c4ea){if(_0x63c4ea){return _0x63c4ea['removeTags'](_0x2fc48f[_0xd3ef('0x32')][_0xd3ef('0xa4')]);}})[_0xd3ef('0x21')](respondWithStatusCode(_0xa6654d,null))[_0xd3ef('0x99')](handleError(_0xa6654d,null));};exports[_0xd3ef('0xaf')]=function(_0x8342ac,_0x34ba67){var _0xad485a=moment()[_0xd3ef('0xb0')]()[_0xd3ef('0x75')]();var _0xac1f38=path['join'](config[_0xd3ef('0xb1')],'server',_0xd3ef('0xb2'),_0xd3ef('0xb3'));var _0x45c8f4=path[_0xd3ef('0x76')](config['root'],_0xd3ef('0xb4'),_0xd3ef('0xb2'),_0xd3ef('0xb5'));var _0x57c2a3=path[_0xd3ef('0x76')](_0xac1f38,_0xad485a);var _0x304208=util[_0xd3ef('0x54')](_0xd3ef('0xb6'),_0x8342ac[_0xd3ef('0xa0')]['id'],_0xad485a);var _0x126eea=path[_0xd3ef('0x76')](_0xac1f38,_0x304208);var _0x28283f=![];return db[_0xd3ef('0x9b')][_0xd3ef('0x9d')]({'where':{'id':_0x8342ac[_0xd3ef('0xa0')]['id']},'include':[{'model':db['SmsMessage'],'as':_0xd3ef('0xb7'),'attributes':['id',_0xd3ef('0x9f'),_0xd3ef('0x6b'),_0xd3ef('0xb8'),_0xd3ef('0xb9')],'include':[{'model':db[_0xd3ef('0xba')],'as':_0xd3ef('0xba'),'attributes':['id','fullname'],'raw':!![]},{'model':db['CmContact'],'as':_0xd3ef('0xbb'),'attributes':['id',_0xd3ef('0xbc'),'lastName'],'raw':!![]}]},{'model':db[_0xd3ef('0xbd')],'as':'Account','attributes':['id',_0xd3ef('0x24')]},{'model':db[_0xd3ef('0xba')],'as':_0xd3ef('0xbe'),'attributes':['id','fullname']}]})[_0xd3ef('0x21')](handleEntityNotFound(_0x34ba67,null))[_0xd3ef('0x21')](function(_0x4bcf1a){if(_0x4bcf1a){var _0x23fb9a=_0x4bcf1a[_0xd3ef('0xbf')]({'plain':!![]});_0x28283f=!![];var _0x412fc7={'format':'A4','border':'10px','header':{'height':_0xd3ef('0xc0'),'contents':{'first':_0xd3ef('0xc1')}},'footer':{'height':_0xd3ef('0xc2'),'contents':{'default':util[_0xd3ef('0x54')](_0xd3ef('0xc3'),util['format'](_0xd3ef('0xc4'),_0xd3ef('0xc5'),_0x23fb9a['id']),moment()[_0xd3ef('0x54')](_0xd3ef('0xc6'))[_0xd3ef('0x75')]())}}};fs['mkdirSync'](_0x57c2a3);var _0x301306={'channel':_0xd3ef('0xc5'),'account':_0x23fb9a['Account']['name'],'agent':_0x23fb9a['Owner']?_0x23fb9a[_0xd3ef('0xbe')][_0xd3ef('0xc7')]:_0xd3ef('0xc8'),'createdAt':moment(_0x23fb9a[_0xd3ef('0x6b')])[_0xd3ef('0x54')](_0xd3ef('0xa6'))[_0xd3ef('0x75')](),'closedAt':_0x23fb9a[_0xd3ef('0x25')]?moment(_0x23fb9a[_0xd3ef('0xc9')])[_0xd3ef('0x54')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd3ef('0x75')]():'','disposition':_0x23fb9a['disposition'],'messages':_(_0x23fb9a[_0xd3ef('0xb7')])[_0xd3ef('0x66')]({'secret':![]})[_0xd3ef('0x29')](function(_0x496b86){return{'date':moment(_0x496b86[_0xd3ef('0x6b')])['format'](_0xd3ef('0xa6'))[_0xd3ef('0x75')](),'sender':_0x496b86[_0xd3ef('0xb8')]===_0xd3ef('0xca')?_0x496b86['User']?_0x496b86[_0xd3ef('0xba')]['fullname']:_0xd3ef('0xcb'):_0x496b86[_0xd3ef('0xbb')]['firstName']+(_0x496b86[_0xd3ef('0xbb')][_0xd3ef('0xcc')]?'\x20'+_0x496b86[_0xd3ef('0xbb')]['lastName']:''),'body':_0x496b86['body'],'direction':_0x496b86['direction']===_0xd3ef('0xca')?'A':'C','secret':_0x496b86[_0xd3ef('0xb9')]};})['value']()};return ejs[_0xd3ef('0xcd')](path[_0xd3ef('0x76')](config[_0xd3ef('0xb1')],_0xd3ef('0xb4'),_0xd3ef('0xce'),_0xd3ef('0xcf')),{'interaction':_0x301306})['then'](function(_0x4681e6){return new BPromise(function(_0xc17a32,_0x33911b){pdf[_0xd3ef('0x9e')](_0x4681e6,_0x412fc7)['toFile'](path['join'](_0x57c2a3,_0xd3ef('0xd0')+_0x23fb9a['id']+'-'+_0xad485a+_0xd3ef('0xd1')),function(_0xee6717,_0x4c4fd1){if(_0xee6717)return _0x33911b(_0xee6717);_0xc17a32(_0x4c4fd1);});});});}})[_0xd3ef('0x21')](function(){if(_0x28283f){return new BPromise(function(_0x43d1eb,_0x318731){zipdir(_0x57c2a3,{'saveTo':_0x126eea},function(_0x3573ae,_0x2eca06){if(_0x3573ae)return _0x318731(_0x3573ae);return _0x43d1eb(_0x2eca06);});})[_0xd3ef('0x21')](function(){return new BPromise(function(_0x195402,_0x581269){rimraf(_0x57c2a3,function(_0x13386a){if(_0x13386a)_0x581269(_0x13386a);return _0x195402();});});})['then'](function(){return _0x34ba67[_0xd3ef('0xaf')](_0x126eea,_0x304208,function(_0x183b5){if(_0x183b5){console['log'](_0xd3ef('0xd2'),_0x183b5);}else{fs[_0xd3ef('0xd3')](_0x126eea);}});});}else{return _0x34ba67[_0xd3ef('0x19')](0xc8);}})[_0xd3ef('0x99')](handleError(_0x34ba67,null));}; \ No newline at end of file +var _0x5155=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','unreadMessages','SmsMessage','map','TagIds','split','forEach','push','catch','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','COUNT(*)','from','sms_messages','me.SmsInteractionId\x20=\x20i.id','me.read\x20=\x20false','u.id','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','expr','parse','advancedFilter','startOf','utc','format','endOf','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','condition','value','TagId','Messages.count','tableAlias','\x20IN\x20?','\x20=\x20?','LIKE','ContactId','\x20LIKE\x20?','c.lastName','\x20>\x20?','isArray','c.firstName','c.email','\x20<\x20?','filter','isNil','isEmpty','SmsAccountId','concat','createdAt','$gte','$lte','\x20IS\x20NULL','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','toString','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','DESC','group','i.id','Sequelize','QueryTypes','SELECT','read','%s\x20=\x200','having','%s\x20>\x200','`Messages.count`\x20>\x200','tag','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','t.id\x20IN\x20?','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','`Messages.count`\x20=\x200','sequelize','keyBy','merge','a.key','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','show','params','SmsInteraction','options','find','create','body','describe','addMessage','omit','ids','getMessages','findOne','SmsInteractionId','includeAll','include','findAll','rows','addTags','setTags','spread','smsInteractionTags:save','removeTags','join','server','files','tmp','root','transcript-%d-%s.zip','Messages','direction','secret','User','fullname','CmContact','Contact','lastName','SmsAccount','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Sms','YYYY-MM-DD','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end'];(function(_0x260d17,_0x41db16){var _0x11dc8d=function(_0x1f0492){while(--_0x1f0492){_0x260d17['push'](_0x260d17['shift']());}};_0x11dc8d(++_0x41db16);}(_0x5155,0xc5));var _0x5515=function(_0x4e0403,_0x23bb0a){_0x4e0403=_0x4e0403-0x0;var _0xb4ab4f=_0x5155[_0x4e0403];return _0xb4ab4f;};'use strict';var pdf=require(_0x5515('0x0'));var emlformat=require(_0x5515('0x1'));var rimraf=require(_0x5515('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5515('0x3'));var rp=require(_0x5515('0x4'));var moment=require(_0x5515('0x5'));var BPromise=require(_0x5515('0x6'));var Mustache=require(_0x5515('0x7'));var util=require(_0x5515('0x8'));var path=require(_0x5515('0x9'));var sox=require(_0x5515('0xa'));var csv=require(_0x5515('0xb'));var ejs=require(_0x5515('0xc'));var fs=require('fs');var _=require(_0x5515('0xd'));var squel=require('squel');var crypto=require(_0x5515('0xe'));var jsforce=require(_0x5515('0xf'));var deskjs=require(_0x5515('0x10'));var toCsv=require(_0x5515('0xb'));var querystring=require('querystring');var Papa=require(_0x5515('0x11'));var Redis=require('ioredis');var authService=require(_0x5515('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5515('0x13'))(_0x5515('0x14'));var utils=require(_0x5515('0x15'));var config=require(_0x5515('0x16'));var db=require('../../mysqldb')['db'];config[_0x5515('0x17')]=_[_0x5515('0x18')](config['redis'],{'host':_0x5515('0x19'),'port':0x18eb});var socket=require(_0x5515('0x1a'))(new Redis(config['redis']));require(_0x5515('0x1b'))[_0x5515('0x1c')](socket);function respondWithStatusCode(_0x174ef7,_0x4a9fc6){_0x4a9fc6=_0x4a9fc6||0xcc;return function(_0x475c89){if(_0x475c89){return _0x174ef7[_0x5515('0x1d')](_0x4a9fc6);}return _0x174ef7[_0x5515('0x1e')](_0x4a9fc6)[_0x5515('0x1f')]();};}function respondWithResult(_0x2fc817,_0x218ffe){_0x218ffe=_0x218ffe||0xc8;return function(_0x88cb54){if(_0x88cb54){return _0x2fc817[_0x5515('0x1e')](_0x218ffe)[_0x5515('0x20')](_0x88cb54);}};}function respondWithFilteredResult(_0x2d3189,_0xad5bc2){return function(_0x9cfc77){if(_0x9cfc77){var _0x545c19=_0x9cfc77[_0x5515('0x21')],_0x360da1=_0xad5bc2[_0x5515('0x22')],_0x29392d=_0xad5bc2['offset']+_0xad5bc2[_0x5515('0x23')],_0x48b450;if(_0x29392d>=_0x545c19){_0x29392d=_0x545c19;_0x48b450=0xc8;}else{_0x48b450=0xce;}_0x2d3189[_0x5515('0x1e')](_0x48b450);return _0x2d3189[_0x5515('0x24')](_0x5515('0x25'),_0x360da1+'-'+_0x29392d+'/'+_0x545c19)[_0x5515('0x20')](_0x9cfc77);}return null;};}function patchUpdates(_0x30ef0b){return function(_0x3a55fd){try{jsonpatch[_0x5515('0x26')](_0x3a55fd,_0x30ef0b,!![]);}catch(_0x139e0f){return BPromise[_0x5515('0x27')](_0x139e0f);}return _0x3a55fd[_0x5515('0x28')]();};}function saveUpdates(_0xb6dd15,_0x2eb47c){return function(_0x5955b6){if(_0x5955b6){return _0x5955b6[_0x5515('0x29')](_0xb6dd15)['then'](function(_0x225bec){return _0x225bec;});}return null;};}function removeEntity(_0x157fa9,_0x3e45b6){return function(_0xf54b4b){if(_0xf54b4b){return _0xf54b4b[_0x5515('0x2a')]()[_0x5515('0x2b')](function(){_0x157fa9[_0x5515('0x1e')](0xcc)[_0x5515('0x1f')]();});}};}function handleEntityNotFound(_0x1885db,_0x1beaf7){return function(_0x49a30e){if(!_0x49a30e){_0x1885db[_0x5515('0x1d')](0x194);}return _0x49a30e;};}function handleError(_0x1ce532,_0x2c5e32){_0x2c5e32=_0x2c5e32||0x1f4;return function(_0x48654a){logger[_0x5515('0x2c')](_0x48654a[_0x5515('0x2d')]);if(_0x48654a[_0x5515('0x2e')]){delete _0x48654a[_0x5515('0x2e')];}_0x1ce532[_0x5515('0x1e')](_0x2c5e32)[_0x5515('0x2f')](_0x48654a);};}function getInteractionUnreadMessages(_0x598d19){return new BPromise(function(_0x1f5b6,_0x145271){try{if(_0x598d19['closed']){_0x598d19[_0x5515('0x30')]=0x0;_0x1f5b6(_0x598d19);}else{return db[_0x5515('0x31')][_0x5515('0x21')]({'where':{'SmsInteractionId':_0x598d19['id'],'direction':'in','read':![]}})['then'](function(_0xd9308){_0x598d19[_0x5515('0x30')]=_0xd9308;_0x1f5b6(_0x598d19);});}}catch(_0x486890){_0x145271(_0x486890);}});}function getInteractionUsers(_0x4a7ea4,_0x48fd68){return new BPromise(function(_0x322e28,_0x2780c5){try{if(_0x48fd68[_0x4a7ea4['id']]){_0x4a7ea4['Users']=_[_0x5515('0x32')](_0x48fd68[_0x4a7ea4['id']],function(_0x1d258b){return{'id':_0x1d258b['id']};});}}catch(_0x2a88c5){_0x2780c5(_0x2a88c5);}_0x322e28(_0x4a7ea4);});}function getInteractionTags(_0x13b816,_0xe44b54){return new BPromise(function(_0x540b96,_0x447b18){try{if(_0x13b816[_0x5515('0x33')]){_0x13b816['Tags']=[];_0x13b816[_0x5515('0x33')][_0x5515('0x34')](',')[_0x5515('0x35')](function(_0x5981c4){_0x13b816['Tags'][_0x5515('0x36')](_0xe44b54[_0x5981c4]);});}delete _0x13b816[_0x5515('0x33')];}catch(_0x8e5b69){_0x447b18(_0x8e5b69);}_0x540b96(_0x13b816);});}function updateSmsInteraction(_0x2705ec,_0x4d9430,_0x41cb06){return new BPromise(function(_0x2d9584,_0x244087){return getInteractionUnreadMessages(_0x2705ec)[_0x5515('0x2b')](function(_0x352c67){return getInteractionUsers(_0x352c67,_0x41cb06);})[_0x5515('0x2b')](function(_0x139932){return getInteractionTags(_0x139932,_0x4d9430);})['then'](function(_0x41a568){_0x2d9584(_0x41a568);})[_0x5515('0x37')](function(_0x3a96dd){_0x244087(_0x3a96dd);});});}exports['index']=function(_0x5021e0,_0x53f720){var _0x5a4312={},_0x7bbc07={},_0x3ab475={'count':0x0,'rows':[]};var _0x80d15d=db['SmsInteraction'][_0x5515('0x38')];_0x7bbc07[_0x5515('0x39')]=_[_0x5515('0x3a')](_0x80d15d);_0x7bbc07['query']=_['keys'](_0x5021e0[_0x5515('0x3b')]);_0x7bbc07[_0x5515('0x3c')]=_['intersection'](_0x7bbc07[_0x5515('0x39')],_0x7bbc07[_0x5515('0x3b')]);_0x5a4312[_0x5515('0x3d')]=_[_0x5515('0x3e')](_0x7bbc07[_0x5515('0x39')],qs[_0x5515('0x3f')](_0x5021e0[_0x5515('0x3b')]['fields']));_0x5a4312[_0x5515('0x3d')]=_0x5a4312[_0x5515('0x3d')][_0x5515('0x40')]?_0x5a4312['attributes']:_0x7bbc07[_0x5515('0x39')];if(!_0x5021e0[_0x5515('0x3b')][_0x5515('0x41')](_0x5515('0x42'))){_0x5a4312['limit']=qs[_0x5515('0x23')](_0x5021e0[_0x5515('0x3b')][_0x5515('0x23')]);_0x5a4312[_0x5515('0x22')]=qs[_0x5515('0x22')](_0x5021e0['query']['offset']);}_0x5a4312[_0x5515('0x43')]=qs[_0x5515('0x44')](_0x5021e0['query']['sort']);_0x5a4312[_0x5515('0x45')]=qs['filters'](_[_0x5515('0x46')](_0x5021e0[_0x5515('0x3b')],_0x7bbc07['filters']));var _0x509db3=[];var _0x5212d3=squel[_0x5515('0x47')]()[_0x5515('0x48')]('id')[_0x5515('0x48')](_0x5515('0x2e'))[_0x5515('0x48')](_0x5515('0x49'))['from'](_0x5515('0x4a'));var _0x3dfda5=squel[_0x5515('0x47')]()[_0x5515('0x48')](_0x5515('0x4b'))[_0x5515('0x4c')](_0x5515('0x4d'),'me')['where'](_0x5515('0x4e'))[_0x5515('0x45')]('me.direction\x20=\x20\x27in\x27')[_0x5515('0x45')](_0x5515('0x4f'));var _0x297921=squel['select']()[_0x5515('0x48')](_0x5515('0x50'))[_0x5515('0x48')](_0x5515('0x51'))[_0x5515('0x4c')](_0x5515('0x52'),'ui')['left_join'](_0x5515('0x53'),'u',_0x5515('0x54'));var _0x3aa869=squel[_0x5515('0x47')]()[_0x5515('0x4c')]('sms_interactions','i')[_0x5515('0x55')](_0x5515('0x56'),'c',_0x5515('0x57'))[_0x5515('0x55')]('users','o',_0x5515('0x58'))['left_join'](_0x5515('0x59'),'a',_0x5515('0x5a'))[_0x5515('0x55')](_0x5515('0x4d'),'me',_0x5515('0x4e'));var _0xbd47d3=squel[_0x5515('0x5b')]();if(_0x5021e0[_0x5515('0x3b')]['advancedFilter']){var _0x2eaebf=JSON[_0x5515('0x5c')](_0x5021e0[_0x5515('0x3b')][_0x5515('0x5d')]);_[_0x5515('0x3a')](_0x2eaebf)[_0x5515('0x35')](function(_0x24de4d){var _0x425c87=_0x2eaebf[_0x24de4d];if(_0x24de4d==='createdAt'){var _0x2b93af=moment(_0x425c87['value']['dateStart'])[_0x5515('0x5e')]('day')[_0x5515('0x5f')]()[_0x5515('0x60')]();var _0x367cbb=moment(_0x367cbb)[_0x5515('0x5f')]()[_0x5515('0x61')]('day')[_0x5515('0x60')]();_0xbd47d3[_0x5515('0x62')](_0x5515('0x63'),_0x2b93af,_0x367cbb);}else{if(_['isArray'](_0x425c87[_0x5515('0x64')])){_0x425c87[_0x5515('0x64')][_0x5515('0x35')](function(_0x5ef19b){switch(_0x425c87[_0x5515('0x64')][_0x5515('0x65')]){case'IS':if(_0x24de4d!==_0x5515('0x66')&&_0x24de4d!==_0x5515('0x67')){if(_['isArray'](_0x425c87[_0x5515('0x65')])&&_0x425c87[_0x5515('0x65')][_0x5515('0x40')]>0x1){_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x69'),_0x425c87['value']);}else{_0xbd47d3['and'](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x6a'),_0x425c87['value'][0x0]);}}break;case'=':_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x6a'),_0x425c87[_0x5515('0x65')]);break;case _0x5515('0x6b'):if(_0x24de4d===_0x5515('0x6c')){_0xbd47d3[_0x5515('0x62')]('c.firstName'+_0x5515('0x6d'),'%'+_0x425c87[_0x5515('0x65')]+'%');_0xbd47d3['or'](_0x5515('0x6e')+_0x5515('0x6d'),'%'+_0x425c87[_0x5515('0x65')]+'%');_0xbd47d3['or']('c.email'+_0x5515('0x6d'),'%'+_0x425c87[_0x5515('0x65')]+'%');}else{_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x6d'),'%'+_0x425c87[_0x5515('0x65')]+'%');}break;case'>':_0xbd47d3[_0x5515('0x62')](_0x425c87['tableAlias']+'.'+_0x24de4d+_0x5515('0x6f'),_0x425c87[_0x5515('0x65')]);break;case'<':_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+'\x20<\x20?',_0x425c87[_0x5515('0x65')]);break;}});}else{switch(_0x425c87[_0x5515('0x64')][_0x5515('0x65')]){case'IS':if(_0x24de4d!==_0x5515('0x66')&&_0x24de4d!==_0x5515('0x67')){if(_[_0x5515('0x70')](_0x425c87['value'])&&_0x425c87['value'][_0x5515('0x40')]>0x1){_0xbd47d3['and'](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x69'),_0x425c87['value']);}else{_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x6a'),_0x425c87[_0x5515('0x65')][0x0]);}}break;case'=':_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x6a'),_0x425c87['value']);break;case'LIKE':if(_0x24de4d===_0x5515('0x6c')){_0xbd47d3[_0x5515('0x62')](_0x5515('0x71')+_0x5515('0x6d'),'%'+_0x425c87[_0x5515('0x65')]+'%');_0xbd47d3['or'](_0x5515('0x6e')+'\x20LIKE\x20?','%'+_0x425c87['value']+'%');_0xbd47d3['or'](_0x5515('0x72')+'\x20LIKE\x20?','%'+_0x425c87[_0x5515('0x65')]+'%');}else{_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+'\x20LIKE\x20?','%'+_0x425c87[_0x5515('0x65')]+'%');}break;case'>':_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x6f'),_0x425c87['value']);break;case'<':_0xbd47d3[_0x5515('0x62')](_0x425c87[_0x5515('0x68')]+'.'+_0x24de4d+_0x5515('0x73'),_0x425c87['value']);break;}}}});}else{var _0x465749=_(Object['keys'](_0x5021e0['query']))[_0x5515('0x32')](function(_0x3e6642){return _0x80d15d['hasOwnProperty'](_0x3e6642)?_0x3e6642:undefined;})[_0x5515('0x74')](function(_0x36cd41){return!_[_0x5515('0x75')](_0x36cd41);})[_0x5515('0x65')]();if(!_[_0x5515('0x76')](_0x465749)){_0x465749[_0x5515('0x35')](function(_0x11f1a5){if(_0x11f1a5===_0x5515('0x77')){_0x3aa869[_0x5515('0x45')]('i.SmsAccountId\x20IN\x20?',[][_0x5515('0x78')](_0x5021e0[_0x5515('0x3b')][_0x11f1a5]));}else if(_0x11f1a5===_0x5515('0x79')){var _0x3704e3=JSON['parse'](_0x5021e0[_0x5515('0x3b')][_0x11f1a5])[_0x5515('0x7a')];var _0x30792b=JSON[_0x5515('0x5c')](_0x5021e0['query'][_0x11f1a5])[_0x5515('0x7b')];_0x3aa869[_0x5515('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3704e3,_0x30792b);}else{if(_0x5021e0['query'][_0x11f1a5]==='null'){_0x3aa869[_0x5515('0x45')]('i.'+_0x11f1a5+_0x5515('0x7c'));}else{_0x3aa869['where']('i.'+_0x11f1a5+'\x20=\x20?',_0x5021e0[_0x5515('0x3b')][_0x11f1a5]);}}});}if(_0x5021e0[_0x5515('0x3b')][_0x5515('0x74')]){var _0x43bb03=_0x5021e0[_0x5515('0x3b')][_0x5515('0x74')][_0x5515('0x7d')]('\x5c','\x5c\x5c')[_0x5515('0x7d')]('\x27\x27',_0x5515('0x7e'));if(qs[_0x5515('0x7f')](_0x43bb03)){_0xbd47d3['or'](_0x5515('0x80'),_0x43bb03+'%')['or'](_0x5515('0x81'),_0x43bb03+'%');}else{var _0x38a361=[];_0x43bb03[_0x5515('0x34')]('\x20')[_0x5515('0x35')](function(_0x107cc6){_0x38a361['push']('+'+_0x107cc6[_0x5515('0x82')]());});var _0x13ceb8=_0x38a361['join']('\x20');_0xbd47d3['or'](_0x5515('0x83'),_0x13ceb8)['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x43bb03+'%');}}}_0x3aa869['where'](_0xbd47d3);if(_0x5a4312[_0x5515('0x43')]){_0x5a4312[_0x5515('0x43')]['forEach'](function(_0x159336){_0x3aa869[_0x5515('0x43')]('i.'+_0x159336[0x0],_0x159336[0x1]===_0x5515('0x84')?![]:!![]);});}_0x3aa869[_0x5515('0x85')](_0x5515('0x86'));var _0x32f614={'type':db[_0x5515('0x87')][_0x5515('0x88')][_0x5515('0x89')],'raw':!![]};var _0x515376=_0x3aa869['clone']()[_0x5515('0x48')](_0x5515('0x4b'));if(!_0x5021e0[_0x5515('0x3b')][_0x5515('0x5d')]){if(_0x5021e0[_0x5515('0x3b')][_0x5515('0x8a')]){if(_0x5021e0[_0x5515('0x3b')][_0x5515('0x8a')]==0x1){_0x515376[_0x5515('0x45')](util[_0x5515('0x60')](_0x5515('0x8b'),_0x3dfda5[_0x5515('0x82')]()));_0x3aa869[_0x5515('0x8c')]('`Messages.count`\x20=\x200');}else{_0x515376['where'](util['format'](_0x5515('0x8d'),_0x3dfda5[_0x5515('0x82')]()));_0x3aa869[_0x5515('0x8c')](_0x5515('0x8e'));}}if(_0x5021e0[_0x5515('0x3b')][_0x5515('0x8f')]){var _0xdeff96=_[_0x5515('0x70')](_0x5021e0[_0x5515('0x3b')]['tag'])?_0x5021e0[_0x5515('0x3b')][_0x5515('0x8f')]:new Array(_0x5021e0['query'][_0x5515('0x8f')]);var _0x4a4f29=squel[_0x5515('0x5b')]();_0xdeff96[_0x5515('0x35')](function(_0x45a912){_0x4a4f29['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x45a912+',%');});_0x3aa869[_0x5515('0x8c')](_0x4a4f29);_0x515376[_0x5515('0x55')](_0x5515('0x90'),'it',_0x5515('0x91'));_0x515376[_0x5515('0x55')](_0x5515('0x4a'),'t',_0x5515('0x92'));_0x515376['where'](_0x5515('0x93'),_0xdeff96);}}else{var _0x2eaebf=JSON['parse'](_0x5021e0[_0x5515('0x3b')][_0x5515('0x5d')]);_[_0x5515('0x3a')](_0x2eaebf)[_0x5515('0x35')](function(_0x1896fc){var _0x329d12=_0x2eaebf[_0x1896fc];if(_0x1896fc===_0x5515('0x66')){var _0x75afce=_0x329d12[_0x5515('0x65')];var _0x1d68c3=squel['expr']();_0x75afce[_0x5515('0x35')](function(_0x58b612){_0x1d68c3['or'](_0x5515('0x94'),'%,'+_0x58b612+',%');});_0x3aa869[_0x5515('0x8c')](_0x1d68c3);_0x515376[_0x5515('0x55')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id');_0x515376[_0x5515('0x55')](_0x5515('0x4a'),'t',_0x5515('0x92'));_0x515376[_0x5515('0x45')](_0x5515('0x93'),_0x75afce);}else if(_0x1896fc===_0x5515('0x67')){if(_0x329d12[_0x5515('0x65')][_0x5515('0x40')]===0x1){if(_0x329d12[_0x5515('0x65')][0x0]===0x1){_0x515376[_0x5515('0x45')](util[_0x5515('0x60')](_0x5515('0x8b'),_0x3dfda5[_0x5515('0x82')]()));_0x3aa869[_0x5515('0x8c')](_0x5515('0x95'));}else{_0x515376['where'](util[_0x5515('0x60')](_0x5515('0x8d'),_0x3dfda5['toString']()));_0x3aa869[_0x5515('0x8c')]('`Messages.count`\x20>\x200');}}}});}db[_0x5515('0x96')][_0x5515('0x3b')](_0x515376[_0x5515('0x82')](),_0x32f614)[_0x5515('0x2b')](function(_0x5ed7a3){_0x3ab475['count']=_0x5ed7a3[_0x5515('0x40')];if(_0x3ab475[_0x5515('0x21')]===0x0)return[];return db[_0x5515('0x96')][_0x5515('0x3b')](_0x5212d3['toString'](),_0x32f614)['then'](function(_0x180931){_0x509db3=_[_0x5515('0x97')](_0x180931,'id');_0x32f614=_[_0x5515('0x98')](_0x32f614,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});_0x3aa869[_0x5515('0x48')](_0x5515('0x99'),'Account.key');_0x3aa869[_0x5515('0x48')]('i.*');_0x3aa869[_0x5515('0x48')]('c.firstName',_0x5515('0x9a'));_0x3aa869[_0x5515('0x48')](_0x5515('0x6e'),_0x5515('0x9b'));_0x3aa869[_0x5515('0x48')](_0x5515('0x72'),_0x5515('0x9c'));_0x3aa869['field'](_0x5515('0x9d'),_0x5515('0x9e'));_0x3aa869[_0x5515('0x48')](_0x5515('0x9f'),_0x5515('0xa0'));_0x3aa869[_0x5515('0x48')](_0x5515('0xa1'),_0x5515('0xa2'));_0x3aa869[_0x5515('0x48')](_0x5515('0xa3'),_0x5515('0x33'));_0x3aa869[_0x5515('0x55')](_0x5515('0x90'),'it',_0x5515('0x91'));_0x3aa869['left_join'](_0x5515('0x4a'),'t','t.id\x20=\x20it.TagId');_0x3aa869[_0x5515('0x23')](_0x5a4312[_0x5515('0x23')]);_0x3aa869[_0x5515('0x22')](_0x5a4312[_0x5515('0x22')]);return db[_0x5515('0x96')][_0x5515('0x3b')](_0x3aa869['toString'](),_0x32f614);})[_0x5515('0x2b')](function(_0x1c75c4){_0x297921['where'](_0x5515('0xa4'),_['map'](_0x1c75c4,'id'));return db['sequelize'][_0x5515('0x3b')](_0x297921[_0x5515('0x82')](),_0x32f614)[_0x5515('0x2b')](function(_0x1cb070){var _0x33aeff=_['groupBy'](_0x1cb070,'SmsInteractionId');var _0x1a1515=[];_0x1c75c4[_0x5515('0x35')](function(_0x334b1a){_0x1a1515[_0x5515('0x36')](updateSmsInteraction(_0x334b1a,_0x509db3,_0x33aeff));});return BPromise[_0x5515('0xa5')](_0x1a1515);});});})[_0x5515('0x2b')](function(_0x35dbac){_0x3ab475['rows']=_0x35dbac;return _0x3ab475;})[_0x5515('0x2b')](respondWithFilteredResult(_0x53f720,_0x5a4312))[_0x5515('0x37')](handleError(_0x53f720,null));};exports[_0x5515('0xa6')]=function(_0x2369a6,_0x598de7){var _0x301842={'raw':![],'where':{'id':_0x2369a6[_0x5515('0xa7')]['id']}},_0x158475={};_0x158475[_0x5515('0x39')]=_[_0x5515('0x3a')](db[_0x5515('0xa8')][_0x5515('0x38')]);_0x158475[_0x5515('0x3b')]=_[_0x5515('0x3a')](_0x2369a6[_0x5515('0x3b')]);_0x158475[_0x5515('0x3c')]=_[_0x5515('0x3e')](_0x158475['model'],_0x158475[_0x5515('0x3b')]);_0x301842[_0x5515('0x3d')]=_[_0x5515('0x3e')](_0x158475[_0x5515('0x39')],qs[_0x5515('0x3f')](_0x2369a6[_0x5515('0x3b')]['fields']));_0x301842[_0x5515('0x3d')]=_0x301842[_0x5515('0x3d')][_0x5515('0x40')]?_0x301842[_0x5515('0x3d')]:_0x158475['model'];if(_0x2369a6[_0x5515('0x3b')]['includeAll']){_0x301842['include']=[{'all':!![]}];}_0x301842=_['merge']({},_0x301842,_0x2369a6[_0x5515('0xa9')]);return db[_0x5515('0xa8')][_0x5515('0xaa')](_0x301842)['then'](handleEntityNotFound(_0x598de7,null))[_0x5515('0x2b')](respondWithResult(_0x598de7,null))[_0x5515('0x37')](handleError(_0x598de7,null));};exports[_0x5515('0xab')]=function(_0x116ae3,_0x1a76ad){return db[_0x5515('0xa8')]['create'](_0x116ae3['body'],{})['then'](respondWithResult(_0x1a76ad,0xc9))[_0x5515('0x37')](handleError(_0x1a76ad,null));};exports['update']=function(_0x51cff0,_0x926280){if(_0x51cff0['body']['id']){delete _0x51cff0[_0x5515('0xac')]['id'];}return db['SmsInteraction'][_0x5515('0xaa')]({'where':{'id':_0x51cff0['params']['id']}})[_0x5515('0x2b')](handleEntityNotFound(_0x926280,null))[_0x5515('0x2b')](saveUpdates(_0x51cff0[_0x5515('0xac')],null))[_0x5515('0x2b')](respondWithResult(_0x926280,null))['catch'](handleError(_0x926280,null));};exports['destroy']=function(_0x153ce3,_0x59fd22){return db[_0x5515('0xa8')]['find']({'where':{'id':_0x153ce3[_0x5515('0xa7')]['id']}})[_0x5515('0x2b')](handleEntityNotFound(_0x59fd22,null))['then'](removeEntity(_0x59fd22,null))['catch'](handleError(_0x59fd22,null));};exports[_0x5515('0xad')]=function(_0x3ec494,_0x23821f){return db[_0x5515('0xa8')][_0x5515('0xad')]()['then'](respondWithResult(_0x23821f,null))[_0x5515('0x37')](handleError(_0x23821f,null));};exports[_0x5515('0xae')]=function(_0x401cbe,_0x2d6aa1,_0x2db6cb){return db[_0x5515('0x31')]['find']({'where':{'id':_0x401cbe[_0x5515('0xa7')]['id']}})['then'](handleEntityNotFound(_0x2d6aa1,null))[_0x5515('0x2b')](function(_0x45fdf4){if(_0x45fdf4){return _0x45fdf4[_0x5515('0xae')](_0x401cbe[_0x5515('0xac')]['ids'],_[_0x5515('0xaf')](_0x401cbe[_0x5515('0xac')],[_0x5515('0xb0'),'id'])||{});}})[_0x5515('0x2b')](respondWithResult(_0x2d6aa1,null))[_0x5515('0x37')](handleError(_0x2d6aa1,null));};exports[_0x5515('0xb1')]=function(_0x2d66ff,_0x1795ca,_0x14d480){var _0x4873ac={'raw':![],'where':{}};var _0x4f4db8={};var _0x32755e={'count':0x0,'rows':[]};return db[_0x5515('0xa8')][_0x5515('0xb2')]({'where':{'id':_0x2d66ff[_0x5515('0xa7')]['id']}})[_0x5515('0x2b')](handleEntityNotFound(_0x1795ca,null))[_0x5515('0x2b')](function(_0x2893e3){if(_0x2893e3){_0x4f4db8['model']=_['keys'](db[_0x5515('0x31')][_0x5515('0x38')]);_0x4f4db8[_0x5515('0x3b')]=_[_0x5515('0x3a')](_0x2d66ff['query']);_0x4f4db8['filters']=_[_0x5515('0x3e')](_0x4f4db8[_0x5515('0x39')],_0x4f4db8[_0x5515('0x3b')]);_0x4873ac[_0x5515('0x3d')]=_[_0x5515('0x3e')](_0x4f4db8[_0x5515('0x39')],qs[_0x5515('0x3f')](_0x2d66ff['query'][_0x5515('0x3f')]));_0x4873ac[_0x5515('0x3d')]=_0x4873ac['attributes'][_0x5515('0x40')]?_0x4873ac[_0x5515('0x3d')]:_0x4f4db8['model'];if(!_0x2d66ff[_0x5515('0x3b')][_0x5515('0x41')](_0x5515('0x42'))){_0x4873ac[_0x5515('0x23')]=qs[_0x5515('0x23')](_0x2d66ff[_0x5515('0x3b')]['limit']);_0x4873ac[_0x5515('0x22')]=qs[_0x5515('0x22')](_0x2d66ff['query']['offset']);}_0x4873ac[_0x5515('0x43')]=qs[_0x5515('0x44')](_0x2d66ff['query'][_0x5515('0x44')]);_0x4873ac[_0x5515('0x45')]=qs['filters'](_[_0x5515('0x46')](_0x2d66ff['query'],_0x4f4db8[_0x5515('0x3c')]));_0x4873ac[_0x5515('0x45')][_0x5515('0xb3')]=_0x2893e3['id'];if(_0x2d66ff['query'][_0x5515('0x74')]){_0x4873ac['where']=_[_0x5515('0x98')](_0x4873ac[_0x5515('0x45')],{'$or':_[_0x5515('0x32')](_0x4873ac[_0x5515('0x3d')],function(_0x5f5d13){var _0x59d656={};_0x59d656[_0x5f5d13]={'$like':'%'+_0x2d66ff['query'][_0x5515('0x74')]+'%'};return _0x59d656;})});}if(_0x2d66ff[_0x5515('0x3b')][_0x5515('0x7a')]){var _0x9a301f=_0x2d66ff[_0x5515('0x3b')][_0x5515('0x7a')][_0x5515('0x34')](',');var _0x28d79b={};_0x28d79b[_0x9a301f[0x0]]={'$gte':moment(_0x9a301f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4873ac['where']=_['merge'](_0x4873ac['where'],_0x28d79b);}_0x4873ac=_[_0x5515('0x98')]({},_0x4873ac,_0x2d66ff[_0x5515('0xa9')]);return db[_0x5515('0x31')][_0x5515('0x21')]({'where':_0x4873ac[_0x5515('0x45')]})[_0x5515('0x2b')](function(_0x26d88d){_0x32755e['count']=_0x26d88d;if(_0x2d66ff['query'][_0x5515('0xb4')]){_0x4873ac[_0x5515('0xb5')]=[{'all':!![]}];}return db[_0x5515('0x31')][_0x5515('0xb6')](_0x4873ac);})['then'](function(_0x4b2b1c){_0x32755e[_0x5515('0xb7')]=_0x4b2b1c;return _0x32755e;});}})['then'](respondWithFilteredResult(_0x1795ca,_0x4873ac))[_0x5515('0x37')](handleError(_0x1795ca,null));};exports[_0x5515('0xb8')]=function(_0x5c96a1,_0x27af17,_0x2c7b83){return db[_0x5515('0xa8')]['find']({'where':{'id':_0x5c96a1[_0x5515('0xa7')]['id']}})[_0x5515('0x2b')](handleEntityNotFound(_0x27af17,null))['then'](function(_0x25e57b){if(_0x25e57b){return _0x25e57b[_0x5515('0xb9')](_0x5c96a1[_0x5515('0xac')][_0x5515('0xb0')],_['omit'](_0x5c96a1['body'],[_0x5515('0xb0'),'id'])||{})[_0x5515('0xba')](function(){return db['Tag'][_0x5515('0xb6')]({'attributes':['id',_0x5515('0x2e'),_0x5515('0x49')],'where':{'id':_0x5c96a1[_0x5515('0xac')][_0x5515('0xb0')]}});})[_0x5515('0x2b')](function(_0x40fcdf){socket['emit'](_0x5515('0xbb'),{'id':Number(_0x5c96a1[_0x5515('0xa7')]['id']),'tags':_0x40fcdf||[]});return{'id':Number(_0x5c96a1[_0x5515('0xa7')]['id']),'tags':_0x40fcdf||[]};});}})['then'](respondWithResult(_0x27af17,null))['catch'](handleError(_0x27af17,null));};exports[_0x5515('0xbc')]=function(_0x2b228f,_0x46c82b,_0x104830){return db['SmsInteraction'][_0x5515('0xaa')]({'where':{'id':_0x2b228f[_0x5515('0xa7')]['id']}})[_0x5515('0x2b')](handleEntityNotFound(_0x46c82b,null))[_0x5515('0x2b')](function(_0x23594d){if(_0x23594d){return _0x23594d[_0x5515('0xbc')](_0x2b228f[_0x5515('0x3b')]['ids']);}})[_0x5515('0x2b')](respondWithStatusCode(_0x46c82b,null))['catch'](handleError(_0x46c82b,null));};exports['download']=function(_0x9316f5,_0x3a68f9){var _0x1d14f3=moment()['unix']()[_0x5515('0x82')]();var _0x27a2c3=path[_0x5515('0xbd')](config['root'],_0x5515('0xbe'),_0x5515('0xbf'),_0x5515('0xc0'));var _0x5c026c=path['join'](config[_0x5515('0xc1')],'server',_0x5515('0xbf'),'attachments');var _0x421f22=path['join'](_0x27a2c3,_0x1d14f3);var _0x2da84b=util['format'](_0x5515('0xc2'),_0x9316f5[_0x5515('0xa7')]['id'],_0x1d14f3);var _0x3d1492=path['join'](_0x27a2c3,_0x2da84b);var _0x2104c4=![];return db[_0x5515('0xa8')][_0x5515('0xaa')]({'where':{'id':_0x9316f5[_0x5515('0xa7')]['id']},'include':[{'model':db['SmsMessage'],'as':_0x5515('0xc3'),'attributes':['id',_0x5515('0xac'),_0x5515('0x79'),_0x5515('0xc4'),_0x5515('0xc5')],'include':[{'model':db[_0x5515('0xc6')],'as':_0x5515('0xc6'),'attributes':['id',_0x5515('0xc7')],'raw':!![]},{'model':db[_0x5515('0xc8')],'as':_0x5515('0xc9'),'attributes':['id','firstName',_0x5515('0xca')],'raw':!![]}]},{'model':db[_0x5515('0xcb')],'as':_0x5515('0xcc'),'attributes':['id',_0x5515('0x2e')]},{'model':db[_0x5515('0xc6')],'as':'Owner','attributes':['id',_0x5515('0xc7')]}]})['then'](handleEntityNotFound(_0x3a68f9,null))['then'](function(_0x2625b4){if(_0x2625b4){var _0x5922aa=_0x2625b4[_0x5515('0xcd')]({'plain':!![]});_0x2104c4=!![];var _0x4534c7={'format':'A4','border':_0x5515('0xce'),'header':{'height':_0x5515('0xcf'),'contents':{'first':_0x5515('0xd0')}},'footer':{'height':_0x5515('0xd1'),'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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\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'](_0x5515('0xd2'),_0x5515('0xd3'),_0x5922aa['id']),moment()[_0x5515('0x60')](_0x5515('0xd4'))[_0x5515('0x82')]())}}};fs['mkdirSync'](_0x421f22);var _0x1d9314={'channel':'Sms','account':_0x5922aa[_0x5515('0xcc')][_0x5515('0x2e')],'agent':_0x5922aa[_0x5515('0xd5')]?_0x5922aa['Owner'][_0x5515('0xc7')]:_0x5515('0xd6'),'createdAt':moment(_0x5922aa['createdAt'])[_0x5515('0x60')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5515('0x82')](),'closedAt':_0x5922aa['closed']?moment(_0x5922aa['closedAt'])[_0x5515('0x60')](_0x5515('0xd7'))[_0x5515('0x82')]():'','disposition':_0x5922aa[_0x5515('0xd8')],'messages':_(_0x5922aa[_0x5515('0xc3')])[_0x5515('0x74')]({'secret':![]})[_0x5515('0x32')](function(_0x419978){return{'date':moment(_0x419978[_0x5515('0x79')])[_0x5515('0x60')](_0x5515('0xd7'))[_0x5515('0x82')](),'sender':_0x419978[_0x5515('0xc4')]===_0x5515('0xd9')?_0x419978[_0x5515('0xc6')]?_0x419978[_0x5515('0xc6')][_0x5515('0xc7')]:_0x5515('0xda'):_0x419978[_0x5515('0xc9')]['firstName']+(_0x419978[_0x5515('0xc9')][_0x5515('0xca')]?'\x20'+_0x419978['Contact'][_0x5515('0xca')]:''),'body':_0x419978[_0x5515('0xac')],'direction':_0x419978[_0x5515('0xc4')]===_0x5515('0xd9')?'A':'C','secret':_0x419978['secret']};})[_0x5515('0x65')]()};return ejs[_0x5515('0xdb')](path[_0x5515('0xbd')](config[_0x5515('0xc1')],_0x5515('0xbe'),_0x5515('0xdc'),_0x5515('0xdd')),{'interaction':_0x1d9314})['then'](function(_0x494d9f){return new BPromise(function(_0x4ff037,_0x1b1b81){pdf[_0x5515('0xab')](_0x494d9f,_0x4534c7)[_0x5515('0xde')](path[_0x5515('0xbd')](_0x421f22,_0x5515('0xdf')+_0x5922aa['id']+'-'+_0x1d14f3+_0x5515('0xe0')),function(_0x43833d,_0x4b66df){if(_0x43833d)return _0x1b1b81(_0x43833d);_0x4ff037(_0x4b66df);});});});}})[_0x5515('0x2b')](function(){if(_0x2104c4){return new BPromise(function(_0x25123f,_0x3d1751){zipdir(_0x421f22,{'saveTo':_0x3d1492},function(_0x3a76c1,_0x1c8a47){if(_0x3a76c1)return _0x3d1751(_0x3a76c1);return _0x25123f(_0x1c8a47);});})[_0x5515('0x2b')](function(){return new BPromise(function(_0x31e16e,_0x484d15){rimraf(_0x421f22,function(_0x4d1cfa){if(_0x4d1cfa)_0x484d15(_0x4d1cfa);return _0x31e16e();});});})[_0x5515('0x2b')](function(){return _0x3a68f9[_0x5515('0xe1')](_0x3d1492,_0x2da84b,function(_0x33ed24){if(_0x33ed24){console[_0x5515('0xe2')](_0x5515('0xe3'),_0x33ed24);}else{fs[_0x5515('0xe4')](_0x3d1492);}});});}else{return _0x3a68f9[_0x5515('0x1d')](0xc8);}})[_0x5515('0x37')](handleError(_0x3a68f9,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6d9b8c3..86bee66 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 _0xbe9e=['hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0xbe9e,0x1b1));var _0xebe9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xbe9e[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0xebe9('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xebe9('0x1')];var SmsMessage=require(_0xebe9('0x2'))['db'][_0xebe9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xebe9('0x4')](0x0);var events={'afterCreate':_0xebe9('0x5'),'afterUpdate':_0xebe9('0x6'),'afterDestroy':_0xebe9('0x7')};function emitEvent(_0x3adfcc){return function(_0x31f49d,_0x1fac88,_0x1d06b4){_0x31f49d[_0xebe9('0x8')]({'attributes':['id'],'raw':!![]})[_0xebe9('0x9')](function(_0xe5cbef){_0x31f49d['setDataValue'](_0xebe9('0xa'),_0xe5cbef['map'](function(_0x1bd4e8){return{'id':_0x1bd4e8['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x31f49d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xebe9('0x9')](function(_0x3444fe){_0x31f49d[_0xebe9('0xb')](_0xebe9('0xc'),_0x3444fe[_0xebe9('0xd')]);SmsInteractionEvents[_0xebe9('0xe')](_0x3adfcc+':'+_0x31f49d['id'],_0x31f49d);SmsInteractionEvents[_0xebe9('0xe')](_0x3adfcc,_0x31f49d);_0x1d06b4(null);})[_0xebe9('0xf')](_0x1d06b4(null));};}for(var e in events){if(events[_0xebe9('0x10')](e)){var event=events[e];SmsInteraction[_0xebe9('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xcf8f=['exports','events','../../mysqldb','SmsInteraction','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x492e92,_0x2296d2){var _0x5c133f=function(_0x5a8b0d){while(--_0x5a8b0d){_0x492e92['push'](_0x492e92['shift']());}};_0x5c133f(++_0x2296d2);}(_0xcf8f,0x19f));var _0xfcf8=function(_0x1007b6,_0x4b4607){_0x1007b6=_0x1007b6-0x0;var _0x37b6ed=_0xcf8f[_0x1007b6];return _0x37b6ed;};'use strict';var EventEmitter=require(_0xfcf8('0x0'));var SmsInteraction=require(_0xfcf8('0x1'))['db'][_0xfcf8('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf8('0x3'),'afterUpdate':_0xfcf8('0x4'),'afterDestroy':_0xfcf8('0x5')};function emitEvent(_0x28c812){return function(_0x5e5115,_0x165026,_0x196ccd){_0x5e5115[_0xfcf8('0x6')]({'attributes':['id'],'raw':!![]})[_0xfcf8('0x7')](function(_0x238158){_0x5e5115[_0xfcf8('0x8')](_0xfcf8('0x9'),_0x238158[_0xfcf8('0xa')](function(_0x157e03){return{'id':_0x157e03['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5e5115['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5dfed9){_0x5e5115[_0xfcf8('0x8')](_0xfcf8('0xb'),_0x5dfed9[_0xfcf8('0xc')]);SmsInteractionEvents[_0xfcf8('0xd')](_0x28c812+':'+_0x5e5115['id'],_0x5e5115);SmsInteractionEvents[_0xfcf8('0xd')](_0x28c812,_0x5e5115);_0x196ccd(null);})[_0xfcf8('0xe')](_0x196ccd(null));};}for(var e in events){if(events[_0xfcf8('0xf')](e)){var event=events[e];SmsInteraction[_0xfcf8('0x10')](e,emitEvent(event));}}module[_0xfcf8('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b5100ef..beedd30 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 _0xe01f=['util','api','moment','bluebird','request-promise','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x301486,_0x27b799){var _0x418d16=function(_0x5f0d58){while(--_0x5f0d58){_0x301486['push'](_0x301486['shift']());}};_0x418d16(++_0x27b799);}(_0xe01f,0x95));var _0xfe01=function(_0xa9a5d9,_0x26d3bf){_0xa9a5d9=_0xa9a5d9-0x0;var _0x404d53=_0xe01f[_0xa9a5d9];return _0x404d53;};'use strict';var _=require(_0xfe01('0x0'));var util=require(_0xfe01('0x1'));var logger=require('../../config/logger')(_0xfe01('0x2'));var moment=require(_0xfe01('0x3'));var BPromise=require(_0xfe01('0x4'));var rp=require(_0xfe01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe01('0x6'));module[_0xfe01('0x7')]=function(_0x1323c9,_0x3ebaf2){return _0x1323c9[_0xfe01('0x8')](_0xfe01('0x9'),attributes,{'tableName':_0xfe01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x65bafd,_0x4838d1,_0x530849){if(_0x65bafd['changed'](_0xfe01('0xb'))){_0x65bafd[_0xfe01('0xc')]=moment()[_0xfe01('0xd')](_0xfe01('0xe'));}_0x530849(null,_0x65bafd);}}});}; \ No newline at end of file +var _0x57fc=['SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','rimraf','./smsInteraction.attributes','exports'];(function(_0x49488e,_0x3cb4b8){var _0x205de0=function(_0x261f0e){while(--_0x261f0e){_0x49488e['push'](_0x49488e['shift']());}};_0x205de0(++_0x3cb4b8);}(_0x57fc,0x1c0));var _0xc57f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57fc[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc57f('0x0'));var moment=require(_0xc57f('0x1'));var BPromise=require(_0xc57f('0x2'));var rp=require(_0xc57f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc57f('0x4'));var config=require('../../config/environment');var attributes=require(_0xc57f('0x5'));module[_0xc57f('0x6')]=function(_0x32982d,_0x5ea2bc){return _0x32982d['define'](_0xc57f('0x7'),attributes,{'tableName':_0xc57f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34a5a6,_0x526e64,_0x3050f3){if(_0x34a5a6['changed'](_0xc57f('0x9'))){_0x34a5a6[_0xc57f('0xa')]=moment()[_0xc57f('0xb')](_0xc57f('0xc'));}_0x3050f3(null,_0x34a5a6);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 1505ddd..6fb4bd9 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 _0x05b2=['lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','omit','ids','spread','AddTags'];(function(_0xfda8c2,_0x13df42){var _0x198a9a=function(_0x5efe8e){while(--_0x5efe8e){_0xfda8c2['push'](_0xfda8c2['shift']());}};_0x198a9a(++_0x13df42);}(_0x05b2,0x10a));var _0x205b=function(_0xa270a0,_0x1f1ba5){_0xa270a0=_0xa270a0-0x0;var _0x29d4da=_0x05b2[_0xa270a0];return _0x29d4da;};'use strict';var _=require(_0x205b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x205b('0x1'));var fs=require('fs');var Redis=require(_0x205b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x205b('0x3'))(_0x205b('0x4'));var config=require(_0x205b('0x5'));var jayson=require(_0x205b('0x6'));var client=jayson['client'][_0x205b('0x7')]({'port':0x232a});config[_0x205b('0x8')]=_[_0x205b('0x9')](config[_0x205b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x205b('0xa'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x205b('0xb')](socket);function respondWithRpcPromise(_0x2f7dc0,_0x13fdc4,_0x471c75){return new BPromise(function(_0x2f207d,_0x158512){return client[_0x205b('0xc')](_0x2f7dc0,_0x471c75)[_0x205b('0xd')](function(_0x34d114){logger[_0x205b('0xe')](_0x205b('0xf'),_0x13fdc4,_0x205b('0x10'));logger[_0x205b('0x11')](_0x205b('0x12'),_0x13fdc4,_0x205b('0x10'),JSON[_0x205b('0x13')](_0x34d114));if(_0x34d114[_0x205b('0x14')]){if(_0x34d114[_0x205b('0x14')]['code']===0x1f4){logger['error'](_0x205b('0xf'),_0x13fdc4,_0x34d114[_0x205b('0x14')][_0x205b('0x15')]);return _0x158512(_0x34d114['error'][_0x205b('0x15')]);}logger[_0x205b('0x14')](_0x205b('0xf'),_0x13fdc4,_0x34d114['error']['message']);return _0x2f207d(_0x34d114[_0x205b('0x14')][_0x205b('0x15')]);}else{logger[_0x205b('0xe')](_0x205b('0xf'),_0x13fdc4,'request\x20sent');_0x2f207d(_0x34d114['result'][_0x205b('0x15')]);}})[_0x205b('0x16')](function(_0x2cf72e){logger[_0x205b('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x13fdc4,_0x2cf72e);_0x158512(_0x2cf72e);});});}exports[_0x205b('0x17')]=function(_0x57963f){var _0x5ef965=this;return new Promise(function(_0xf63415,_0x13ecab){return db[_0x205b('0x18')][_0x205b('0x19')](_0x57963f[_0x205b('0x1a')],{'raw':_0x57963f[_0x205b('0x1b')]?_0x57963f['options'][_0x205b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57963f[_0x205b('0x1b')]?_0x57963f[_0x205b('0x1b')][_0x205b('0x1d')]||null:null,'attributes':_0x57963f['options']?_0x57963f['options'][_0x205b('0x1e')]||null:null,'limit':_0x57963f[_0x205b('0x1b')]?_0x57963f[_0x205b('0x1b')][_0x205b('0x1f')]||null:null})['then'](function(_0x46e608){logger[_0x205b('0xe')](_0x205b('0x17'),_0x57963f);logger['debug'](_0x205b('0x17'),_0x57963f,JSON['stringify'](_0x46e608));_0xf63415(_0x46e608);})[_0x205b('0x16')](function(_0x36011b){logger[_0x205b('0x14')](_0x205b('0x17'),_0x36011b[_0x205b('0x15')],_0x57963f);_0x13ecab(_0x5ef965[_0x205b('0x14')](0x1f4,_0x36011b[_0x205b('0x15')]));});});};exports[_0x205b('0x20')]=function(_0x1f2f60){return new Promise(function(_0x1402ec,_0x394c13){return db[_0x205b('0x18')][_0x205b('0x21')]({'where':_0x1f2f60[_0x205b('0x1b')]?_0x1f2f60[_0x205b('0x1b')]['where']||null:null})[_0x205b('0xd')](function(_0x40e11a){if(_0x40e11a){return _0x40e11a['addTags'](_0x1f2f60[_0x205b('0x1a')]['ids'],_[_0x205b('0x22')](_0x1f2f60['body'],[_0x205b('0x23'),'id'])||{});}})[_0x205b('0x24')](function(_0x289f1b){logger[_0x205b('0xe')](_0x205b('0x25'),_0x1f2f60);logger[_0x205b('0x11')](_0x205b('0x25'),_0x1f2f60,JSON[_0x205b('0x13')](_0x289f1b));_0x1402ec(_0x289f1b);})[_0x205b('0x16')](function(_0xf5e040){logger[_0x205b('0x14')](_0x205b('0x25'),_0xf5e040[_0x205b('0x15')],_0x1f2f60);_0x394c13(_this[_0x205b('0x14')](0x1f4,_0xf5e040[_0x205b('0x15')]));});});}; \ No newline at end of file +var _0x119b=['lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','socket.io-emitter','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','update','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','body','ids','spread','AddTags'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x119b,0x172));var _0xb119=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x119b[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0xb119('0x0'));var util=require(_0xb119('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb119('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb119('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb119('0x4'))('rpc');var config=require(_0xb119('0x5'));var jayson=require(_0xb119('0x6'));var client=jayson['client'][_0xb119('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb119('0x8'))(new Redis(config[_0xb119('0x9')]));require(_0xb119('0xa'))[_0xb119('0xb')](socket);function respondWithRpcPromise(_0x4307ff,_0x5ab15f,_0x1a1898){return new BPromise(function(_0x54a6e4,_0x549108){return client[_0xb119('0xc')](_0x4307ff,_0x1a1898)[_0xb119('0xd')](function(_0x27dec5){logger[_0xb119('0xe')](_0xb119('0xf'),_0x5ab15f,'request\x20sent');logger[_0xb119('0x10')](_0xb119('0x11'),_0x5ab15f,'request\x20sent',JSON[_0xb119('0x12')](_0x27dec5));if(_0x27dec5['error']){if(_0x27dec5[_0xb119('0x13')][_0xb119('0x14')]===0x1f4){logger[_0xb119('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x5ab15f,_0x27dec5['error'][_0xb119('0x15')]);return _0x549108(_0x27dec5['error'][_0xb119('0x15')]);}logger[_0xb119('0x13')](_0xb119('0xf'),_0x5ab15f,_0x27dec5[_0xb119('0x13')][_0xb119('0x15')]);return _0x54a6e4(_0x27dec5['error']['message']);}else{logger[_0xb119('0xe')](_0xb119('0xf'),_0x5ab15f,'request\x20sent');_0x54a6e4(_0x27dec5[_0xb119('0x16')][_0xb119('0x15')]);}})[_0xb119('0x17')](function(_0x583901){logger[_0xb119('0x13')](_0xb119('0xf'),_0x5ab15f,_0x583901);_0x549108(_0x583901);});});}exports['UpdateSmsInteraction']=function(_0x2f94b7){var _0x2bae3c=this;return new Promise(function(_0x277dff,_0x2fac65){return db[_0xb119('0x18')][_0xb119('0x19')](_0x2f94b7['body'],{'raw':_0x2f94b7[_0xb119('0x1a')]?_0x2f94b7[_0xb119('0x1a')][_0xb119('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f94b7[_0xb119('0x1a')]?_0x2f94b7[_0xb119('0x1a')][_0xb119('0x1c')]||null:null,'attributes':_0x2f94b7['options']?_0x2f94b7[_0xb119('0x1a')]['attributes']||null:null,'limit':_0x2f94b7[_0xb119('0x1a')]?_0x2f94b7[_0xb119('0x1a')][_0xb119('0x1d')]||null:null})[_0xb119('0xd')](function(_0x1f2950){logger[_0xb119('0xe')](_0xb119('0x1e'),_0x2f94b7);logger[_0xb119('0x10')](_0xb119('0x1e'),_0x2f94b7,JSON[_0xb119('0x12')](_0x1f2950));_0x277dff(_0x1f2950);})[_0xb119('0x17')](function(_0x40ec47){logger[_0xb119('0x13')](_0xb119('0x1e'),_0x40ec47[_0xb119('0x15')],_0x2f94b7);_0x2fac65(_0x2bae3c[_0xb119('0x13')](0x1f4,_0x40ec47['message']));});});};exports[_0xb119('0x1f')]=function(_0x5e746f){return new Promise(function(_0x3dc48e,_0x4cf716){return db[_0xb119('0x18')][_0xb119('0x20')]({'where':_0x5e746f[_0xb119('0x1a')]?_0x5e746f[_0xb119('0x1a')][_0xb119('0x1c')]||null:null})[_0xb119('0xd')](function(_0x18e65d){if(_0x18e65d){return _0x18e65d['addTags'](_0x5e746f[_0xb119('0x21')][_0xb119('0x22')],_['omit'](_0x5e746f['body'],[_0xb119('0x22'),'id'])||{});}})[_0xb119('0x23')](function(_0x2b345d){logger[_0xb119('0xe')](_0xb119('0x24'),_0x5e746f);logger[_0xb119('0x10')](_0xb119('0x24'),_0x5e746f,JSON[_0xb119('0x12')](_0x2b345d));_0x3dc48e(_0x2b345d);})[_0xb119('0x17')](function(_0x559921){logger[_0xb119('0x13')]('AddTags',_0x559921[_0xb119('0x15')],_0x5e746f);_0x4cf716(_this[_0xb119('0x13')](0x1f4,_0x559921[_0xb119('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 16ada61..1751e86 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 _0x3b87=['save','remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x1b8857,_0x16396c){var _0x3cf41b=function(_0x1ccd4d){while(--_0x1ccd4d){_0x1b8857['push'](_0x1b8857['shift']());}};_0x3cf41b(++_0x16396c);}(_0x3b87,0x7d));var _0x73b8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3b87[_0x3bf83f];return _0x22c4a9;};'use strict';var SmsInteractionEvents=require(_0x73b8('0x0'));var events=[_0x73b8('0x1'),_0x73b8('0x2'),_0x73b8('0x3')];function createListener(_0x406e40,_0x55b460){return function(_0x278659){_0x55b460[_0x73b8('0x4')](_0x406e40,_0x278659);};}function removeListener(_0x5ee07e,_0xc3e453){return function(){SmsInteractionEvents[_0x73b8('0x5')](_0x5ee07e,_0xc3e453);};}exports[_0x73b8('0x6')]=function(_0x218df6){for(var _0x228de6=0x0,_0x14fd1f=events[_0x73b8('0x7')];_0x228de6<_0x14fd1f;_0x228de6++){var _0x2295f1=events[_0x228de6];var _0x3cfcf7=createListener(_0x73b8('0x8')+_0x2295f1,_0x218df6);SmsInteractionEvents['on'](_0x2295f1,_0x3cfcf7);}}; \ No newline at end of file +var _0x3896=['./smsInteraction.events','save','remove','update','emit','register','length','smsInteraction:'];(function(_0x3a0be9,_0x214ee4){var _0xc1ec3e=function(_0x4e04ad){while(--_0x4e04ad){_0x3a0be9['push'](_0x3a0be9['shift']());}};_0xc1ec3e(++_0x214ee4);}(_0x3896,0x198));var _0x6389=function(_0x455d3f,_0x56af34){_0x455d3f=_0x455d3f-0x0;var _0x4d20bc=_0x3896[_0x455d3f];return _0x4d20bc;};'use strict';var SmsInteractionEvents=require(_0x6389('0x0'));var events=[_0x6389('0x1'),_0x6389('0x2'),_0x6389('0x3')];function createListener(_0x5e35a8,_0x8a17f7){return function(_0x38c7b1){_0x8a17f7[_0x6389('0x4')](_0x5e35a8,_0x38c7b1);};}function removeListener(_0x13c4e6,_0x38bc51){return function(){SmsInteractionEvents['removeListener'](_0x13c4e6,_0x38bc51);};}exports[_0x6389('0x5')]=function(_0x4c0c5a){for(var _0x173c14=0x0,_0xa42885=events[_0x6389('0x6')];_0x173c14<_0xa42885;_0x173c14++){var _0x5384eb=events[_0x173c14];var _0x1058b4=createListener(_0x6389('0x7')+_0x5384eb,_0x4c0c5a);SmsInteractionEvents['on'](_0x5384eb,_0x1058b4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2130b8a..60a25ac 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 _0x3856=['../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x47b3da,_0x125846){var _0x6f42fb=function(_0x98fb9e){while(--_0x98fb9e){_0x47b3da['push'](_0x47b3da['shift']());}};_0x6f42fb(++_0x125846);}(_0x3856,0x1cb));var _0x6385=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x3856[_0x5519a9];return _0x32f2cc;};'use strict';var multer=require(_0x6385('0x0'));var util=require(_0x6385('0x1'));var path=require(_0x6385('0x2'));var timeout=require('connect-timeout');var express=require(_0x6385('0x3'));var router=express[_0x6385('0x4')]();var auth=require(_0x6385('0x5'));var interaction=require(_0x6385('0x6'));var config=require(_0x6385('0x7'));var controller=require(_0x6385('0x8'));router[_0x6385('0x9')]('/',auth['isAuthenticated'](),controller[_0x6385('0xa')]);router['get'](_0x6385('0xb'),auth[_0x6385('0xc')](),controller['describe']);router['get'](_0x6385('0xd'),auth[_0x6385('0xc')](),controller[_0x6385('0xe')]);router[_0x6385('0xf')]('/',auth['isAuthenticated'](),interaction[_0x6385('0x10')](_0x6385('0x11'),_0x6385('0x12')),controller[_0x6385('0x13')]);router[_0x6385('0xf')](_0x6385('0x14'),controller[_0x6385('0x15')]);router['put'](_0x6385('0xd'),auth[_0x6385('0xc')](),controller[_0x6385('0x16')]);router[_0x6385('0x17')](_0x6385('0x18'),auth[_0x6385('0xc')](),controller[_0x6385('0x19')]);router['put'](_0x6385('0x1a'),auth[_0x6385('0xc')](),controller[_0x6385('0x1b')]);router[_0x6385('0x1c')](_0x6385('0xd'),auth[_0x6385('0xc')](),controller[_0x6385('0x1d')]);module[_0x6385('0x1e')]=router; \ No newline at end of file +var _0x98ad=['describe','/:id','show','tracked','sms','smsmessage:create','create','/:id/status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x98ad,0x1c1));var _0xd98a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x98ad[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xd98a('0x0'));var util=require('util');var path=require(_0xd98a('0x1'));var timeout=require('connect-timeout');var express=require(_0xd98a('0x2'));var router=express[_0xd98a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd98a('0x4'));var config=require(_0xd98a('0x5'));var controller=require(_0xd98a('0x6'));router[_0xd98a('0x7')]('/',auth[_0xd98a('0x8')](),controller['index']);router[_0xd98a('0x7')](_0xd98a('0x9'),auth[_0xd98a('0x8')](),controller[_0xd98a('0xa')]);router['get'](_0xd98a('0xb'),auth['isAuthenticated'](),controller[_0xd98a('0xc')]);router['post']('/',auth[_0xd98a('0x8')](),interaction[_0xd98a('0xd')](_0xd98a('0xe'),_0xd98a('0xf')),controller[_0xd98a('0x10')]);router['post'](_0xd98a('0x11'),controller['status']);router['put'](_0xd98a('0xb'),auth[_0xd98a('0x8')](),controller[_0xd98a('0x12')]);router['put'](_0xd98a('0x13'),auth[_0xd98a('0x8')](),controller[_0xd98a('0x14')]);router[_0xd98a('0x15')](_0xd98a('0x16'),auth['isAuthenticated'](),controller[_0xd98a('0x17')]);router[_0xd98a('0x18')](_0xd98a('0xb'),auth['isAuthenticated'](),controller[_0xd98a('0x19')]);module[_0xd98a('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 71ea9af..c46950a 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 _0xe0c1=['TEXT','medium','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x2c2cad,_0x34d3d7){var _0xc80aae=function(_0x325ee1){while(--_0x325ee1){_0x2c2cad['push'](_0x2c2cad['shift']());}};_0xc80aae(++_0x34d3d7);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x48ce21,_0x17f576){_0x48ce21=_0x48ce21-0x0;var _0x20503b=_0xe0c1[_0x48ce21];return _0x20503b;};'use strict';var Sequelize=require(_0x1e0c('0x0'));module[_0x1e0c('0x1')]={'body':{'type':Sequelize[_0x1e0c('0x2')](_0x1e0c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1e0c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1e0c('0x5')]('in',_0x1e0c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xea31=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x776377,_0x30b9ee){var _0x4c8fe8=function(_0x55e8f1){while(--_0x55e8f1){_0x776377['push'](_0x776377['shift']());}};_0x4c8fe8(++_0x30b9ee);}(_0xea31,0x6b));var _0x1ea3=function(_0x450ebd,_0x415fb7){_0x450ebd=_0x450ebd-0x0;var _0x3c56c2=_0xea31[_0x450ebd];return _0x3c56c2;};'use strict';var Sequelize=require(_0x1ea3('0x0'));module['exports']={'body':{'type':Sequelize[_0x1ea3('0x1')](_0x1ea3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1ea3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ea3('0x4')]('in',_0x1ea3('0x5')),'defaultValue':_0x1ea3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1ea3('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1ea3('0x7')]},'secret':{'type':Sequelize[_0x1ea3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c451749..db35801 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 _0x70e8=['interface','channel','event','EventManager','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','results','DELIVERED','infobip','inspect','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','destroy','end','name','send','index','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','SmsMessage','includeAll','include','show','params','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','manual'];(function(_0x2e7ed6,_0x4e7a3f){var _0x21e7ab=function(_0x188465){while(--_0x188465){_0x2e7ed6['push'](_0x2e7ed6['shift']());}};_0x21e7ab(++_0x4e7a3f);}(_0x70e8,0xa2));var _0x870e=function(_0x45d046,_0x53f6da){_0x45d046=_0x45d046-0x0;var _0x2fda23=_0x70e8[_0x45d046];return _0x2fda23;};'use strict';var pdf=require(_0x870e('0x0'));var emlformat=require(_0x870e('0x1'));var rimraf=require(_0x870e('0x2'));var zipdir=require(_0x870e('0x3'));var jsonpatch=require(_0x870e('0x4'));var rp=require(_0x870e('0x5'));var moment=require('moment');var BPromise=require(_0x870e('0x6'));var Mustache=require(_0x870e('0x7'));var util=require(_0x870e('0x8'));var path=require(_0x870e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x870e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x870e('0xb'));var toCsv=require(_0x870e('0xc'));var querystring=require('querystring');var Papa=require(_0x870e('0xd'));var Redis=require(_0x870e('0xe'));var authService=require(_0x870e('0xf'));var qs=require(_0x870e('0x10'));var hardwareService=require(_0x870e('0x11'));var logger=require(_0x870e('0x12'))(_0x870e('0x13'));var utils=require('../../config/utils');var config=require(_0x870e('0x14'));var db=require('../../mysqldb')['db'];config[_0x870e('0x15')]=_['defaults'](config['redis'],{'host':_0x870e('0x16'),'port':0x18eb});var socket=require(_0x870e('0x17'))(new Redis(config[_0x870e('0x15')]));require(_0x870e('0x18'))[_0x870e('0x19')](socket);var jayson=require(_0x870e('0x1a'));var client=jayson[_0x870e('0x1b')][_0x870e('0x1c')]({'port':0x232c});var client9002=jayson[_0x870e('0x1b')][_0x870e('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1bb257,_0x4af6da,_0x44c7e2){if(_0x44c7e2){var _0xf3420d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf3420d[_0x870e('0x1d')](_0x4af6da)){return _0x1bb257;}else{throw new Error(_0x870e('0x1e'));}}else{return _0x1bb257;}}function respondWithRpcPromise(_0x365cdf,_0xa32db5,_0x363895,_0x5a148f){return new BPromise(function(_0xcd329c,_0x223d8f){var _0x17dbc1=_0x5a148f||client;return _0x17dbc1[_0x870e('0x1f')](_0x365cdf,_0x363895)[_0x870e('0x20')](function(_0x5c6ca8){logger[_0x870e('0x21')](_0x870e('0x22'),_0xa32db5,_0x870e('0x23'));logger[_0x870e('0x24')](_0x870e('0x25'),_0xa32db5,_0x870e('0x23'),JSON[_0x870e('0x26')](_0x5c6ca8));if(_0x5c6ca8[_0x870e('0x27')]){if(_0x5c6ca8[_0x870e('0x27')][_0x870e('0x28')]===0x1f4){logger[_0x870e('0x27')](_0x870e('0x22'),_0xa32db5,_0x5c6ca8['error'][_0x870e('0x29')]);return _0x223d8f(_0x5c6ca8['error'][_0x870e('0x29')]);}logger[_0x870e('0x27')](_0x870e('0x22'),_0xa32db5,_0x5c6ca8[_0x870e('0x27')][_0x870e('0x29')]);return _0xcd329c(_0x5c6ca8[_0x870e('0x27')][_0x870e('0x29')]);}else{logger[_0x870e('0x21')](_0x870e('0x22'),_0xa32db5,_0x870e('0x23'));_0xcd329c(_0x5c6ca8[_0x870e('0x2a')][_0x870e('0x29')]);}})[_0x870e('0x2b')](function(_0x44b747){logger[_0x870e('0x27')](_0x870e('0x22'),_0xa32db5,_0x44b747);_0x223d8f(_0x44b747);});});}function respondWithStatusCode(_0x1a0b61,_0x146ecd){_0x146ecd=_0x146ecd||0xcc;return function(_0x257c11){if(_0x257c11){return _0x1a0b61[_0x870e('0x2c')](_0x146ecd);}return _0x1a0b61[_0x870e('0x2d')](_0x146ecd)['end']();};}function respondWithResult(_0x4dc761,_0x395105){_0x395105=_0x395105||0xc8;return function(_0x359850){if(_0x359850){return _0x4dc761[_0x870e('0x2d')](_0x395105)[_0x870e('0x2e')](_0x359850);}};}function respondWithFilteredResult(_0x4bba98,_0x286894){return function(_0x29fb67){if(_0x29fb67){var _0x304acb=_0x29fb67[_0x870e('0x2f')],_0x395549=_0x286894[_0x870e('0x30')],_0x1c8fb5=_0x286894['offset']+_0x286894['limit'],_0x3f20e7;if(_0x1c8fb5>=_0x304acb){_0x1c8fb5=_0x304acb;_0x3f20e7=0xc8;}else{_0x3f20e7=0xce;}_0x4bba98[_0x870e('0x2d')](_0x3f20e7);return _0x4bba98['set'](_0x870e('0x31'),_0x395549+'-'+_0x1c8fb5+'/'+_0x304acb)[_0x870e('0x2e')](_0x29fb67);}return null;};}function patchUpdates(_0x585cff){return function(_0x56b77e){try{jsonpatch[_0x870e('0x32')](_0x56b77e,_0x585cff,!![]);}catch(_0x5b978e){return BPromise[_0x870e('0x33')](_0x5b978e);}return _0x56b77e['save']();};}function saveUpdates(_0x170dd8,_0x11e9e6){return function(_0x15157e){if(_0x15157e){return _0x15157e[_0x870e('0x34')](_0x170dd8)[_0x870e('0x20')](function(_0x574cd0){return _0x574cd0;});}return null;};}function removeEntity(_0x4797c4,_0x292c2a){return function(_0x2a6a8b){if(_0x2a6a8b){return _0x2a6a8b[_0x870e('0x35')]()[_0x870e('0x20')](function(){_0x4797c4[_0x870e('0x2d')](0xcc)[_0x870e('0x36')]();});}};}function handleEntityNotFound(_0x4c9e92,_0x19a27e){return function(_0x1514af){if(!_0x1514af){_0x4c9e92['sendStatus'](0x194);}return _0x1514af;};}function handleError(_0x1e9b95,_0xe8dcd3){_0xe8dcd3=_0xe8dcd3||0x1f4;return function(_0x4872e2){logger[_0x870e('0x27')](_0x4872e2['stack']);if(_0x4872e2[_0x870e('0x37')]){delete _0x4872e2[_0x870e('0x37')];}_0x1e9b95[_0x870e('0x2d')](_0xe8dcd3)[_0x870e('0x38')](_0x4872e2);};}exports[_0x870e('0x39')]=function(_0x5ce10c,_0x560413){var _0x3c8395={},_0x29e3b6={},_0x316b52={'count':0x0,'rows':[]};var _0x12b2eb=db['SmsMessage'][_0x870e('0x3a')];_0x29e3b6[_0x870e('0x3b')]=_['keys'](_0x12b2eb);_0x29e3b6[_0x870e('0x3c')]=_[_0x870e('0x3d')](_0x5ce10c[_0x870e('0x3c')]);_0x29e3b6['filters']=_[_0x870e('0x3e')](_0x29e3b6['model'],_0x29e3b6[_0x870e('0x3c')]);_0x3c8395['attributes']=_[_0x870e('0x3e')](_0x29e3b6['model'],qs[_0x870e('0x3f')](_0x5ce10c['query'][_0x870e('0x3f')]));_0x3c8395['attributes']=_0x3c8395[_0x870e('0x40')][_0x870e('0x41')]?_0x3c8395[_0x870e('0x40')]:_0x29e3b6[_0x870e('0x3b')];if(!_0x5ce10c[_0x870e('0x3c')][_0x870e('0x42')]('nolimit')){_0x3c8395['limit']=qs[_0x870e('0x43')](_0x5ce10c[_0x870e('0x3c')][_0x870e('0x43')]);_0x3c8395['offset']=qs[_0x870e('0x30')](_0x5ce10c['query']['offset']);}_0x3c8395[_0x870e('0x44')]=qs['sort'](_0x5ce10c['query'][_0x870e('0x45')]);_0x3c8395[_0x870e('0x46')]=qs[_0x870e('0x47')](_['pick'](_0x5ce10c[_0x870e('0x3c')],_0x29e3b6['filters']));if(_0x5ce10c[_0x870e('0x3c')][_0x870e('0x48')]){_0x3c8395[_0x870e('0x46')]=_[_0x870e('0x49')](_0x3c8395[_0x870e('0x46')],{'$or':_[_0x870e('0x4a')](_0x12b2eb,function(_0x4ec4fd){if(_0x4ec4fd[_0x870e('0x4b')][_0x870e('0x4c')]!==_0x870e('0x4d')){var _0x1a71b4={};_0x1a71b4[_0x4ec4fd['field']]={'$like':'%'+_0x5ce10c['query'][_0x870e('0x48')]+'%'};return _0x1a71b4;}})});}_0x3c8395=_[_0x870e('0x49')]({},_0x3c8395,_0x5ce10c['options']);var _0x505375={'where':_0x3c8395[_0x870e('0x46')]};return db[_0x870e('0x4e')][_0x870e('0x2f')](_0x505375)[_0x870e('0x20')](function(_0x41d64d){_0x316b52['count']=_0x41d64d;if(_0x5ce10c[_0x870e('0x3c')][_0x870e('0x4f')]){_0x3c8395[_0x870e('0x50')]=[{'all':!![]}];}return db[_0x870e('0x4e')]['findAll'](_0x3c8395);})[_0x870e('0x20')](function(_0x4994e9){_0x316b52['rows']=_0x4994e9;return _0x316b52;})[_0x870e('0x20')](respondWithFilteredResult(_0x560413,_0x3c8395))['catch'](handleError(_0x560413,null));};exports[_0x870e('0x51')]=function(_0x5091bd,_0x48748c){var _0x3907a0={'raw':!![],'where':{'id':_0x5091bd[_0x870e('0x52')]['id']}},_0x3faf16={};_0x3faf16['model']=_[_0x870e('0x3d')](db['SmsMessage'][_0x870e('0x3a')]);_0x3faf16[_0x870e('0x3c')]=_[_0x870e('0x3d')](_0x5091bd['query']);_0x3faf16[_0x870e('0x47')]=_[_0x870e('0x3e')](_0x3faf16[_0x870e('0x3b')],_0x3faf16[_0x870e('0x3c')]);_0x3907a0[_0x870e('0x40')]=_[_0x870e('0x3e')](_0x3faf16[_0x870e('0x3b')],qs[_0x870e('0x3f')](_0x5091bd[_0x870e('0x3c')][_0x870e('0x3f')]));_0x3907a0[_0x870e('0x40')]=_0x3907a0['attributes']['length']?_0x3907a0[_0x870e('0x40')]:_0x3faf16[_0x870e('0x3b')];if(_0x5091bd[_0x870e('0x3c')][_0x870e('0x4f')]){_0x3907a0[_0x870e('0x50')]=[{'all':!![]}];}_0x3907a0=_[_0x870e('0x49')]({},_0x3907a0,_0x5091bd[_0x870e('0x53')]);return db[_0x870e('0x4e')][_0x870e('0x54')](_0x3907a0)[_0x870e('0x20')](handleEntityNotFound(_0x48748c,null))[_0x870e('0x20')](respondWithResult(_0x48748c,null))[_0x870e('0x2b')](handleError(_0x48748c,null));};exports[_0x870e('0x55')]=function(_0x1bf3dc,_0x330fb4){return db[_0x870e('0x4e')][_0x870e('0x55')](_0x1bf3dc[_0x870e('0x56')],{})['then'](respondWithResult(_0x330fb4,0xc9))[_0x870e('0x2b')](handleError(_0x330fb4,null));};exports['update']=function(_0x5721f0,_0x5000f9){if(_0x5721f0[_0x870e('0x56')]['id']){delete _0x5721f0['body']['id'];}return db[_0x870e('0x4e')]['find']({'where':{'id':_0x5721f0[_0x870e('0x52')]['id']}})[_0x870e('0x20')](handleEntityNotFound(_0x5000f9,null))[_0x870e('0x20')](saveUpdates(_0x5721f0[_0x870e('0x56')],null))[_0x870e('0x20')](respondWithResult(_0x5000f9,null))['catch'](handleError(_0x5000f9,null));};exports['destroy']=function(_0x318ace,_0xb011ad){return db[_0x870e('0x4e')][_0x870e('0x54')]({'where':{'id':_0x318ace['params']['id']}})[_0x870e('0x20')](handleEntityNotFound(_0xb011ad,null))[_0x870e('0x20')](removeEntity(_0xb011ad,null))['catch'](handleError(_0xb011ad,null));};exports[_0x870e('0x57')]=function(_0x42596f,_0x212a73){return db['SmsMessage']['describe']()[_0x870e('0x20')](respondWithResult(_0x212a73,null))[_0x870e('0x2b')](handleError(_0x212a73,null));};var interaction_log=require(_0x870e('0x12'))(_0x870e('0x58'));exports[_0x870e('0x59')]=function(_0xa23e65,_0x1cb731,_0x2b542a){var _0x15ed9c={'channel':_0x870e('0x5a')};if(_0xa23e65[_0x870e('0x56')]['id']){delete _0xa23e65[_0x870e('0x56')]['id'];}_0xa23e65[_0x870e('0x56')][_0x870e('0x5b')]=!![];_0xa23e65[_0x870e('0x56')][_0x870e('0x5c')]=moment()['format'](_0x870e('0x5d'));_0xa23e65[_0x870e('0x56')][_0x870e('0x5e')]=_0xa23e65[_0x870e('0x56')]['UserId']||_0xa23e65['user']['id'];return db['SmsMessage'][_0x870e('0x54')]({'where':{'id':_0xa23e65[_0x870e('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x870e('0x5f')],'as':_0x870e('0x60')}]})[_0x870e('0x20')](handleEntityNotFound(_0x1cb731,null))[_0x870e('0x20')](saveUpdates(_0xa23e65[_0x870e('0x56')],null))[_0x870e('0x20')](function(_0x21b129){if(_0x21b129){_0x15ed9c[_0x870e('0x29')]=_0x21b129[_0x870e('0x61')]({'plain':!![]});return db[_0x870e('0x62')][_0x870e('0x54')]({'where':{'id':_0x21b129[_0x870e('0x63')]}});}return null;})[_0x870e('0x20')](handleEntityNotFound(_0x1cb731,null))[_0x870e('0x20')](function(_0xd4c779){if(_0xd4c779){return _0xd4c779['update']({'UserId':_0xa23e65[_0x870e('0x56')][_0x870e('0x5e')],'read1stAt':_[_0x870e('0x64')](_0xd4c779[_0x870e('0x65')])?moment()[_0x870e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x870e('0x20')](function(_0x1f3804){if(_0x1f3804){_0x15ed9c['interaction']=_0x1f3804[_0x870e('0x61')]({'plain':!![]});interaction_log[_0x870e('0x21')](_0x870e('0x67'),_0xa23e65['user']['id'],_0xa23e65['user'][_0x870e('0x37')],_0xa23e65[_0x870e('0x68')][_0x870e('0x69')],_0x15ed9c[_0x870e('0x6a')]['id'],_0xa23e65[_0x870e('0x56')]?JSON[_0x870e('0x26')](_0xa23e65[_0x870e('0x56')]):_0x870e('0x6b'));return respondWithRpcPromise(_0x870e('0x6c'),'acceptMessage',_0x15ed9c);}return null;})[_0x870e('0x20')](function(_0x409bef){if(_0x409bef){if(_0xa23e65[_0x870e('0x56')][_0x870e('0x6d')]){_0x15ed9c[_0x870e('0x29')][_0x870e('0x6e')]=util[_0x870e('0x66')]('SIP/%s',_0xa23e65[_0x870e('0x68')][_0x870e('0x37')]);_0x15ed9c['message'][_0x870e('0x6f')]=_0x15ed9c[_0x870e('0x6f')];_0x15ed9c[_0x870e('0x29')][_0x870e('0x70')]=_0x870e('0x59');return respondWithRpcPromise(_0x870e('0x71'),'EventManager',{'event':'acceptmessage','message':_0x15ed9c[_0x870e('0x29')]},client9002)['then'](function(){return _0x15ed9c;});}return _0x15ed9c;}return null;})[_0x870e('0x20')](respondWithResult(_0x1cb731,null))['catch'](handleError(_0x1cb731,null));};var interaction_log=require('../../config/logger')(_0x870e('0x58'));exports[_0x870e('0x33')]=function(_0x4de552,_0x29dac8,_0x421c61){var _0x5dde1e={'agent':{},'channel':_0x870e('0x5a')};if(_0x4de552[_0x870e('0x56')]['id']){delete _0x4de552[_0x870e('0x56')]['id'];}_0x4de552[_0x870e('0x56')]['UserId']=_0x4de552[_0x870e('0x56')][_0x870e('0x5e')]||_0x4de552[_0x870e('0x68')]['id'];_0x5dde1e[_0x870e('0x72')]['id']=_0x4de552[_0x870e('0x56')][_0x870e('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x4de552[_0x870e('0x52')]['id'],'UserId':null}})[_0x870e('0x20')](handleEntityNotFound(_0x29dac8,null))[_0x870e('0x20')](function(_0x4ac715){if(_0x4ac715){_0x5dde1e[_0x870e('0x29')]=_0x4ac715[_0x870e('0x61')]({'plain':!![]});return db[_0x870e('0x62')][_0x870e('0x54')]({'where':{'id':_0x4ac715['SmsInteractionId']}});}return null;})[_0x870e('0x20')](handleEntityNotFound(_0x29dac8,null))[_0x870e('0x20')](function(_0x74a91f){if(_0x74a91f){_0x5dde1e['interaction']=_0x74a91f['get']({'plain':!![]});interaction_log[_0x870e('0x21')](_0x870e('0x73'),_0x4de552[_0x870e('0x68')]['id'],_0x4de552[_0x870e('0x68')][_0x870e('0x37')],_0x4de552[_0x870e('0x68')]['role'],_0x5dde1e[_0x870e('0x6a')]['id'],_0x4de552[_0x870e('0x56')]?JSON[_0x870e('0x26')](_0x4de552[_0x870e('0x56')]):_0x870e('0x6b'));return respondWithRpcPromise(_0x870e('0x74'),_0x870e('0x75'),_0x5dde1e);}return null;})[_0x870e('0x20')](function(_0x5deebc){if(_0x5deebc){_0x5deebc[_0x870e('0x29')][_0x870e('0x6e')]=util['format'](_0x870e('0x76'),_0x4de552[_0x870e('0x68')]['name']);_0x5deebc[_0x870e('0x29')][_0x870e('0x6f')]=_0x5dde1e[_0x870e('0x6f')];_0x5deebc[_0x870e('0x29')][_0x870e('0x70')]=_0x870e('0x33');respondWithRpcPromise(_0x870e('0x71'),_0x870e('0x71'),{'event':'rejectmessage','message':_0x5deebc[_0x870e('0x29')]},client9002);return _0x5dde1e;}return null;})['then'](respondWithResult(_0x29dac8,null))['catch'](handleError(_0x29dac8,null));};exports[_0x870e('0x2d')]=function(_0x177ffc,_0x1ea9b2,_0xaf69a7){if(_0x177ffc['body']['id']){delete _0x177ffc[_0x870e('0x56')]['id'];}var _0x3dacc3;return db[_0x870e('0x4e')][_0x870e('0x54')]({'where':{'id':_0x177ffc['params']['id']}})[_0x870e('0x20')](handleEntityNotFound(_0x1ea9b2,null))[_0x870e('0x20')](function(_0x2441dc){if(_0x2441dc){_0x3dacc3=_0x2441dc;return db[_0x870e('0x77')]['find']({'where':{'id':_0x2441dc[_0x870e('0x78')]}});}})[_0x870e('0x20')](handleEntityNotFound(_0x1ea9b2,null))[_0x870e('0x20')](function(_0x668968){if(_0x668968){logger[_0x870e('0x24')](_0x870e('0x25'),'status',_0x870e('0x79'),_0x668968[_0x870e('0x4b')],util['inspect'](_0x177ffc[_0x870e('0x56')],{'showHidden':![],'depth':null}));switch(_0x668968[_0x870e('0x4b')]){case _0x870e('0x7a'):if(_0x177ffc[_0x870e('0x56')][_0x870e('0x7b')]&&_0x177ffc['body']['MessageSid']===_0x3dacc3[_0x870e('0x7c')]){return _0x3dacc3['update']({'read':!![]});}else{logger[_0x870e('0x27')](_0x870e('0x7d'),_0x870e('0x2d'),_0x870e('0x7a'),util['inspect'](_0x177ffc[_0x870e('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x177ffc[_0x870e('0x56')]['MessageUUID']&&_0x177ffc[_0x870e('0x56')][_0x870e('0x7e')]===_0x3dacc3[_0x870e('0x7c')]&&_[_0x870e('0x7f')]([_0x870e('0x80'),_0x870e('0x81')],_0x177ffc[_0x870e('0x56')][_0x870e('0x82')])>=0x0){return _0x3dacc3['update']({'read':!![]});}else{logger[_0x870e('0x27')](_0x870e('0x7d'),_0x870e('0x2d'),_0x870e('0x83'),util['inspect'](_0x177ffc[_0x870e('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x115223=_0x177ffc[_0x870e('0x56')][_0x870e('0x84')][0x0];if(_0x115223[_0x870e('0x2d')]['groupName']===_0x870e('0x85')){return _0x3dacc3[_0x870e('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x870e('0x2d'),_0x870e('0x86'),util[_0x870e('0x87')](_0x177ffc[_0x870e('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3dacc3;}})['then'](respondWithResult(_0x1ea9b2,null))['catch'](handleError(_0x1ea9b2,null));}; \ No newline at end of file +var _0x24fd=['twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','results','groupName','DELIVERED','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','./smsMessage.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','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','key','VIRTUAL','options','SmsMessage','count','includeAll','include','findAll','find','create','body','update','params','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','RejectMessage','rejectMessage','interface','SmsAccount','SmsAccountId','inspect'];(function(_0x4ee89a,_0x56d642){var _0x42aca9=function(_0xa1f425){while(--_0xa1f425){_0x4ee89a['push'](_0x4ee89a['shift']());}};_0x42aca9(++_0x56d642);}(_0x24fd,0x117));var _0xd24f=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x24fd[_0xc67528];return _0x38e26d;};'use strict';var pdf=require(_0xd24f('0x0'));var emlformat=require(_0xd24f('0x1'));var rimraf=require(_0xd24f('0x2'));var zipdir=require(_0xd24f('0x3'));var jsonpatch=require(_0xd24f('0x4'));var rp=require(_0xd24f('0x5'));var moment=require(_0xd24f('0x6'));var BPromise=require(_0xd24f('0x7'));var Mustache=require(_0xd24f('0x8'));var util=require(_0xd24f('0x9'));var path=require(_0xd24f('0xa'));var sox=require(_0xd24f('0xb'));var csv=require(_0xd24f('0xc'));var ejs=require(_0xd24f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd24f('0xe'));var crypto=require(_0xd24f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd24f('0x10'));var toCsv=require(_0xd24f('0xc'));var querystring=require('querystring');var Papa=require(_0xd24f('0x11'));var Redis=require(_0xd24f('0x12'));var authService=require(_0xd24f('0x13'));var qs=require(_0xd24f('0x14'));var hardwareService=require(_0xd24f('0x15'));var logger=require(_0xd24f('0x16'))(_0xd24f('0x17'));var utils=require(_0xd24f('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd24f('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd24f('0x19')]));require(_0xd24f('0x1a'))[_0xd24f('0x1b')](socket);var jayson=require(_0xd24f('0x1c'));var client=jayson[_0xd24f('0x1d')][_0xd24f('0x1e')]({'port':0x232c});var client9002=jayson[_0xd24f('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x202480,_0x1f4391,_0x485a7c){if(_0x485a7c){var _0x86dfce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x86dfce[_0xd24f('0x1f')](_0x1f4391)){return _0x202480;}else{throw new Error(_0xd24f('0x20'));}}else{return _0x202480;}}function respondWithRpcPromise(_0x147449,_0x30e22d,_0xc3c467,_0x176de){return new BPromise(function(_0x54c402,_0x2254b2){var _0x3aa1f9=_0x176de||client;return _0x3aa1f9['request'](_0x147449,_0xc3c467)[_0xd24f('0x21')](function(_0x6746f8){logger[_0xd24f('0x22')](_0xd24f('0x23'),_0x30e22d,_0xd24f('0x24'));logger['debug'](_0xd24f('0x25'),_0x30e22d,_0xd24f('0x24'),JSON[_0xd24f('0x26')](_0x6746f8));if(_0x6746f8[_0xd24f('0x27')]){if(_0x6746f8[_0xd24f('0x27')]['code']===0x1f4){logger[_0xd24f('0x27')](_0xd24f('0x23'),_0x30e22d,_0x6746f8[_0xd24f('0x27')]['message']);return _0x2254b2(_0x6746f8[_0xd24f('0x27')][_0xd24f('0x28')]);}logger['error'](_0xd24f('0x23'),_0x30e22d,_0x6746f8[_0xd24f('0x27')][_0xd24f('0x28')]);return _0x54c402(_0x6746f8[_0xd24f('0x27')][_0xd24f('0x28')]);}else{logger[_0xd24f('0x22')](_0xd24f('0x23'),_0x30e22d,_0xd24f('0x24'));_0x54c402(_0x6746f8[_0xd24f('0x29')][_0xd24f('0x28')]);}})[_0xd24f('0x2a')](function(_0x12703b){logger['error']('SmsMessage,\x20%s,\x20%s',_0x30e22d,_0x12703b);_0x2254b2(_0x12703b);});});}function respondWithStatusCode(_0x3332b3,_0x46ae46){_0x46ae46=_0x46ae46||0xcc;return function(_0x401ed4){if(_0x401ed4){return _0x3332b3[_0xd24f('0x2b')](_0x46ae46);}return _0x3332b3[_0xd24f('0x2c')](_0x46ae46)[_0xd24f('0x2d')]();};}function respondWithResult(_0x191542,_0x1ae4fc){_0x1ae4fc=_0x1ae4fc||0xc8;return function(_0x1a8c7d){if(_0x1a8c7d){return _0x191542[_0xd24f('0x2c')](_0x1ae4fc)[_0xd24f('0x2e')](_0x1a8c7d);}};}function respondWithFilteredResult(_0xc61700,_0x2ca76c){return function(_0x39b44b){if(_0x39b44b){var _0x64f62c=_0x39b44b['count'],_0x3067e6=_0x2ca76c[_0xd24f('0x2f')],_0x671fe7=_0x2ca76c['offset']+_0x2ca76c[_0xd24f('0x30')],_0x3c0311;if(_0x671fe7>=_0x64f62c){_0x671fe7=_0x64f62c;_0x3c0311=0xc8;}else{_0x3c0311=0xce;}_0xc61700[_0xd24f('0x2c')](_0x3c0311);return _0xc61700[_0xd24f('0x31')](_0xd24f('0x32'),_0x3067e6+'-'+_0x671fe7+'/'+_0x64f62c)[_0xd24f('0x2e')](_0x39b44b);}return null;};}function patchUpdates(_0x4c49a4){return function(_0x55ab5d){try{jsonpatch[_0xd24f('0x33')](_0x55ab5d,_0x4c49a4,!![]);}catch(_0x45c587){return BPromise['reject'](_0x45c587);}return _0x55ab5d[_0xd24f('0x34')]();};}function saveUpdates(_0x258759,_0x23e410){return function(_0x59969d){if(_0x59969d){return _0x59969d['update'](_0x258759)['then'](function(_0x1a8a57){return _0x1a8a57;});}return null;};}function removeEntity(_0x559d90,_0x728815){return function(_0x397c29){if(_0x397c29){return _0x397c29[_0xd24f('0x35')]()[_0xd24f('0x21')](function(){_0x559d90[_0xd24f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42b259,_0x38d607){return function(_0x25cc45){if(!_0x25cc45){_0x42b259[_0xd24f('0x2b')](0x194);}return _0x25cc45;};}function handleError(_0x50d6b4,_0x50feae){_0x50feae=_0x50feae||0x1f4;return function(_0x41b117){logger[_0xd24f('0x27')](_0x41b117[_0xd24f('0x36')]);if(_0x41b117[_0xd24f('0x37')]){delete _0x41b117[_0xd24f('0x37')];}_0x50d6b4[_0xd24f('0x2c')](_0x50feae)[_0xd24f('0x38')](_0x41b117);};}exports[_0xd24f('0x39')]=function(_0x65618e,_0x30c2bc){var _0x3bf2b0={},_0x2b68bb={},_0x4c7e63={'count':0x0,'rows':[]};var _0x5bb610=db['SmsMessage'][_0xd24f('0x3a')];_0x2b68bb[_0xd24f('0x3b')]=_[_0xd24f('0x3c')](_0x5bb610);_0x2b68bb['query']=_[_0xd24f('0x3c')](_0x65618e[_0xd24f('0x3d')]);_0x2b68bb[_0xd24f('0x3e')]=_[_0xd24f('0x3f')](_0x2b68bb[_0xd24f('0x3b')],_0x2b68bb[_0xd24f('0x3d')]);_0x3bf2b0[_0xd24f('0x40')]=_[_0xd24f('0x3f')](_0x2b68bb[_0xd24f('0x3b')],qs['fields'](_0x65618e['query'][_0xd24f('0x41')]));_0x3bf2b0[_0xd24f('0x40')]=_0x3bf2b0[_0xd24f('0x40')][_0xd24f('0x42')]?_0x3bf2b0['attributes']:_0x2b68bb[_0xd24f('0x3b')];if(!_0x65618e[_0xd24f('0x3d')][_0xd24f('0x43')]('nolimit')){_0x3bf2b0[_0xd24f('0x30')]=qs['limit'](_0x65618e[_0xd24f('0x3d')][_0xd24f('0x30')]);_0x3bf2b0[_0xd24f('0x2f')]=qs['offset'](_0x65618e['query'][_0xd24f('0x2f')]);}_0x3bf2b0[_0xd24f('0x44')]=qs[_0xd24f('0x45')](_0x65618e['query'][_0xd24f('0x45')]);_0x3bf2b0[_0xd24f('0x46')]=qs[_0xd24f('0x3e')](_[_0xd24f('0x47')](_0x65618e[_0xd24f('0x3d')],_0x2b68bb[_0xd24f('0x3e')]));if(_0x65618e['query'][_0xd24f('0x48')]){_0x3bf2b0[_0xd24f('0x46')]=_[_0xd24f('0x49')](_0x3bf2b0[_0xd24f('0x46')],{'$or':_[_0xd24f('0x4a')](_0x5bb610,function(_0x33352f){if(_0x33352f['type'][_0xd24f('0x4b')]!==_0xd24f('0x4c')){var _0x405a5c={};_0x405a5c[_0x33352f['field']]={'$like':'%'+_0x65618e[_0xd24f('0x3d')]['filter']+'%'};return _0x405a5c;}})});}_0x3bf2b0=_[_0xd24f('0x49')]({},_0x3bf2b0,_0x65618e[_0xd24f('0x4d')]);var _0xbdda0a={'where':_0x3bf2b0[_0xd24f('0x46')]};return db[_0xd24f('0x4e')]['count'](_0xbdda0a)[_0xd24f('0x21')](function(_0x40e19b){_0x4c7e63[_0xd24f('0x4f')]=_0x40e19b;if(_0x65618e[_0xd24f('0x3d')][_0xd24f('0x50')]){_0x3bf2b0[_0xd24f('0x51')]=[{'all':!![]}];}return db[_0xd24f('0x4e')][_0xd24f('0x52')](_0x3bf2b0);})[_0xd24f('0x21')](function(_0x328932){_0x4c7e63['rows']=_0x328932;return _0x4c7e63;})[_0xd24f('0x21')](respondWithFilteredResult(_0x30c2bc,_0x3bf2b0))[_0xd24f('0x2a')](handleError(_0x30c2bc,null));};exports['show']=function(_0x2ae295,_0x23a37b){var _0x245792={'raw':!![],'where':{'id':_0x2ae295['params']['id']}},_0x363b7e={};_0x363b7e['model']=_['keys'](db['SmsMessage'][_0xd24f('0x3a')]);_0x363b7e['query']=_[_0xd24f('0x3c')](_0x2ae295[_0xd24f('0x3d')]);_0x363b7e['filters']=_[_0xd24f('0x3f')](_0x363b7e[_0xd24f('0x3b')],_0x363b7e['query']);_0x245792['attributes']=_['intersection'](_0x363b7e[_0xd24f('0x3b')],qs[_0xd24f('0x41')](_0x2ae295[_0xd24f('0x3d')][_0xd24f('0x41')]));_0x245792[_0xd24f('0x40')]=_0x245792['attributes'][_0xd24f('0x42')]?_0x245792[_0xd24f('0x40')]:_0x363b7e[_0xd24f('0x3b')];if(_0x2ae295[_0xd24f('0x3d')][_0xd24f('0x50')]){_0x245792['include']=[{'all':!![]}];}_0x245792=_[_0xd24f('0x49')]({},_0x245792,_0x2ae295[_0xd24f('0x4d')]);return db['SmsMessage'][_0xd24f('0x53')](_0x245792)[_0xd24f('0x21')](handleEntityNotFound(_0x23a37b,null))[_0xd24f('0x21')](respondWithResult(_0x23a37b,null))['catch'](handleError(_0x23a37b,null));};exports['create']=function(_0x3d581a,_0x5065f8){return db[_0xd24f('0x4e')][_0xd24f('0x54')](_0x3d581a[_0xd24f('0x55')],{})['then'](respondWithResult(_0x5065f8,0xc9))[_0xd24f('0x2a')](handleError(_0x5065f8,null));};exports[_0xd24f('0x56')]=function(_0x26af8a,_0x251073){if(_0x26af8a[_0xd24f('0x55')]['id']){delete _0x26af8a[_0xd24f('0x55')]['id'];}return db[_0xd24f('0x4e')][_0xd24f('0x53')]({'where':{'id':_0x26af8a[_0xd24f('0x57')]['id']}})[_0xd24f('0x21')](handleEntityNotFound(_0x251073,null))[_0xd24f('0x21')](saveUpdates(_0x26af8a['body'],null))[_0xd24f('0x21')](respondWithResult(_0x251073,null))['catch'](handleError(_0x251073,null));};exports[_0xd24f('0x35')]=function(_0xccab82,_0x3a4716){return db['SmsMessage'][_0xd24f('0x53')]({'where':{'id':_0xccab82['params']['id']}})[_0xd24f('0x21')](handleEntityNotFound(_0x3a4716,null))[_0xd24f('0x21')](removeEntity(_0x3a4716,null))[_0xd24f('0x2a')](handleError(_0x3a4716,null));};exports[_0xd24f('0x58')]=function(_0x1aee39,_0x44631a){return db['SmsMessage'][_0xd24f('0x58')]()[_0xd24f('0x21')](respondWithResult(_0x44631a,null))[_0xd24f('0x2a')](handleError(_0x44631a,null));};var interaction_log=require(_0xd24f('0x16'))(_0xd24f('0x59'));exports[_0xd24f('0x5a')]=function(_0x25dc54,_0x355358,_0x3d17c1){var _0x38ce12={'channel':_0xd24f('0x5b')};if(_0x25dc54[_0xd24f('0x55')]['id']){delete _0x25dc54['body']['id'];}_0x25dc54[_0xd24f('0x55')]['read']=!![];_0x25dc54[_0xd24f('0x55')][_0xd24f('0x5c')]=moment()[_0xd24f('0x5d')](_0xd24f('0x5e'));_0x25dc54['body'][_0xd24f('0x5f')]=_0x25dc54[_0xd24f('0x55')][_0xd24f('0x5f')]||_0x25dc54[_0xd24f('0x60')]['id'];return db[_0xd24f('0x4e')][_0xd24f('0x53')]({'where':{'id':_0x25dc54['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd24f('0x61')}]})[_0xd24f('0x21')](handleEntityNotFound(_0x355358,null))[_0xd24f('0x21')](saveUpdates(_0x25dc54[_0xd24f('0x55')],null))[_0xd24f('0x21')](function(_0x2c45c5){if(_0x2c45c5){_0x38ce12[_0xd24f('0x28')]=_0x2c45c5[_0xd24f('0x62')]({'plain':!![]});return db[_0xd24f('0x63')][_0xd24f('0x53')]({'where':{'id':_0x2c45c5[_0xd24f('0x64')]}});}return null;})[_0xd24f('0x21')](handleEntityNotFound(_0x355358,null))[_0xd24f('0x21')](function(_0x54d7e0){if(_0x54d7e0){return _0x54d7e0[_0xd24f('0x56')]({'UserId':_0x25dc54[_0xd24f('0x55')][_0xd24f('0x5f')],'read1stAt':_['isNil'](_0x54d7e0[_0xd24f('0x65')])?moment()[_0xd24f('0x5d')](_0xd24f('0x5e')):undefined});}return null;})[_0xd24f('0x21')](function(_0x2e1a12){if(_0x2e1a12){_0x38ce12[_0xd24f('0x66')]=_0x2e1a12[_0xd24f('0x62')]({'plain':!![]});interaction_log[_0xd24f('0x22')](_0xd24f('0x67'),_0x25dc54[_0xd24f('0x60')]['id'],_0x25dc54[_0xd24f('0x60')][_0xd24f('0x37')],_0x25dc54[_0xd24f('0x60')][_0xd24f('0x68')],_0x38ce12[_0xd24f('0x66')]['id'],_0x25dc54['body']?JSON['stringify'](_0x25dc54[_0xd24f('0x55')]):_0xd24f('0x69'));return respondWithRpcPromise('AcceptMessage',_0xd24f('0x6a'),_0x38ce12);}return null;})['then'](function(_0x16bdf4){if(_0x16bdf4){if(_0x25dc54[_0xd24f('0x55')]['manual']){_0x38ce12[_0xd24f('0x28')]['interface']=util[_0xd24f('0x5d')](_0xd24f('0x6b'),_0x25dc54[_0xd24f('0x60')]['name']);_0x38ce12[_0xd24f('0x28')][_0xd24f('0x6c')]=_0x38ce12[_0xd24f('0x6c')];_0x38ce12[_0xd24f('0x28')][_0xd24f('0x6d')]='accept';return respondWithRpcPromise(_0xd24f('0x6e'),'EventManager',{'event':_0xd24f('0x6f'),'message':_0x38ce12[_0xd24f('0x28')]},client9002)['then'](function(){return _0x38ce12;});}return _0x38ce12;}return null;})[_0xd24f('0x21')](respondWithResult(_0x355358,null))[_0xd24f('0x2a')](handleError(_0x355358,null));};var interaction_log=require(_0xd24f('0x16'))(_0xd24f('0x59'));exports[_0xd24f('0x70')]=function(_0x2814c2,_0xa5e4a1,_0x187dec){var _0x3c085d={'agent':{},'channel':'sms'};if(_0x2814c2[_0xd24f('0x55')]['id']){delete _0x2814c2['body']['id'];}_0x2814c2[_0xd24f('0x55')][_0xd24f('0x5f')]=_0x2814c2[_0xd24f('0x55')][_0xd24f('0x5f')]||_0x2814c2[_0xd24f('0x60')]['id'];_0x3c085d[_0xd24f('0x71')]['id']=_0x2814c2[_0xd24f('0x55')]['UserId'];return db[_0xd24f('0x4e')][_0xd24f('0x53')]({'where':{'id':_0x2814c2[_0xd24f('0x57')]['id'],'UserId':null}})[_0xd24f('0x21')](handleEntityNotFound(_0xa5e4a1,null))[_0xd24f('0x21')](function(_0x14784d){if(_0x14784d){_0x3c085d[_0xd24f('0x28')]=_0x14784d[_0xd24f('0x62')]({'plain':!![]});return db[_0xd24f('0x63')]['find']({'where':{'id':_0x14784d['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xa5e4a1,null))['then'](function(_0x3ec527){if(_0x3ec527){_0x3c085d[_0xd24f('0x66')]=_0x3ec527[_0xd24f('0x62')]({'plain':!![]});interaction_log[_0xd24f('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2814c2['user']['id'],_0x2814c2[_0xd24f('0x60')]['name'],_0x2814c2[_0xd24f('0x60')]['role'],_0x3c085d[_0xd24f('0x66')]['id'],_0x2814c2[_0xd24f('0x55')]?JSON[_0xd24f('0x26')](_0x2814c2[_0xd24f('0x55')]):'null');return respondWithRpcPromise(_0xd24f('0x72'),_0xd24f('0x73'),_0x3c085d);}return null;})[_0xd24f('0x21')](function(_0x2a7b5e){if(_0x2a7b5e){_0x2a7b5e[_0xd24f('0x28')][_0xd24f('0x74')]=util[_0xd24f('0x5d')](_0xd24f('0x6b'),_0x2814c2[_0xd24f('0x60')]['name']);_0x2a7b5e[_0xd24f('0x28')][_0xd24f('0x6c')]=_0x3c085d[_0xd24f('0x6c')];_0x2a7b5e[_0xd24f('0x28')][_0xd24f('0x6d')]=_0xd24f('0x70');respondWithRpcPromise(_0xd24f('0x6e'),'EventManager',{'event':'rejectmessage','message':_0x2a7b5e[_0xd24f('0x28')]},client9002);return _0x3c085d;}return null;})[_0xd24f('0x21')](respondWithResult(_0xa5e4a1,null))[_0xd24f('0x2a')](handleError(_0xa5e4a1,null));};exports['status']=function(_0x181f4f,_0x3d5f3b,_0x5ed89b){if(_0x181f4f[_0xd24f('0x55')]['id']){delete _0x181f4f[_0xd24f('0x55')]['id'];}var _0x3875d6;return db[_0xd24f('0x4e')]['find']({'where':{'id':_0x181f4f[_0xd24f('0x57')]['id']}})[_0xd24f('0x21')](handleEntityNotFound(_0x3d5f3b,null))[_0xd24f('0x21')](function(_0x430f76){if(_0x430f76){_0x3875d6=_0x430f76;return db[_0xd24f('0x75')]['find']({'where':{'id':_0x430f76[_0xd24f('0x76')]}});}})['then'](handleEntityNotFound(_0x3d5f3b,null))[_0xd24f('0x21')](function(_0x5297ff){if(_0x5297ff){logger['debug'](_0xd24f('0x25'),_0xd24f('0x2c'),'received\x20delivery\x20report\x20from',_0x5297ff['type'],util[_0xd24f('0x77')](_0x181f4f[_0xd24f('0x55')],{'showHidden':![],'depth':null}));switch(_0x5297ff['type']){case _0xd24f('0x78'):if(_0x181f4f['body'][_0xd24f('0x79')]&&_0x181f4f['body']['MessageSid']===_0x3875d6[_0xd24f('0x7a')]){return _0x3875d6[_0xd24f('0x56')]({'read':!![]});}else{logger[_0xd24f('0x27')](_0xd24f('0x7b'),_0xd24f('0x2c'),_0xd24f('0x78'),util['inspect'](_0x181f4f[_0xd24f('0x55')],{'showHidden':![],'depth':null}));}break;case _0xd24f('0x7c'):if(_0x181f4f[_0xd24f('0x55')][_0xd24f('0x7d')]&&_0x181f4f[_0xd24f('0x55')][_0xd24f('0x7d')]===_0x3875d6[_0xd24f('0x7a')]&&_[_0xd24f('0x7e')](['sent',_0xd24f('0x7f')],_0x181f4f[_0xd24f('0x55')][_0xd24f('0x80')])>=0x0){return _0x3875d6[_0xd24f('0x56')]({'read':!![]});}else{logger[_0xd24f('0x27')](_0xd24f('0x7b'),'status',_0xd24f('0x81'),util[_0xd24f('0x77')](_0x181f4f[_0xd24f('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x10ce17=_0x181f4f['body'][_0xd24f('0x82')][0x0];if(_0x10ce17[_0xd24f('0x2c')][_0xd24f('0x83')]===_0xd24f('0x84')){return _0x3875d6[_0xd24f('0x56')]({'read':!![]});}else{logger[_0xd24f('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0xd24f('0x77')](_0x181f4f[_0xd24f('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x3875d6;}})[_0xd24f('0x21')](respondWithResult(_0x3d5f3b,null))['catch'](handleError(_0x3d5f3b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 96eeb29..4d54b75 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 _0x80ed=['remove','emit','hasOwnProperty','exports','events','SmsMessage','setMaxListeners','save'];(function(_0x361513,_0x1914a0){var _0x579adb=function(_0x37221b){while(--_0x37221b){_0x361513['push'](_0x361513['shift']());}};_0x579adb(++_0x1914a0);}(_0x80ed,0x11c));var _0xd80e=function(_0x34a3ea,_0xc5a4e9){_0x34a3ea=_0x34a3ea-0x0;var _0x1200b6=_0x80ed[_0x34a3ea];return _0x1200b6;};'use strict';var EventEmitter=require(_0xd80e('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xd80e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd80e('0x2')](0x0);var events={'afterCreate':_0xd80e('0x3'),'afterUpdate':'update','afterDestroy':_0xd80e('0x4')};function emitEvent(_0x46876f){return function(_0x2b742b,_0x3413d4,_0x5ae6c6){SmsMessageEvents[_0xd80e('0x5')](_0x46876f+':'+_0x2b742b['id'],_0x2b742b);SmsMessageEvents[_0xd80e('0x5')](_0x46876f,_0x2b742b);_0x5ae6c6(null);};}for(var e in events){if(events[_0xd80e('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xd80e('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x4213=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x41376e,_0x3b1ae6){var _0x2a5c67=function(_0x403074){while(--_0x403074){_0x41376e['push'](_0x41376e['shift']());}};_0x2a5c67(++_0x3b1ae6);}(_0x4213,0x77));var _0x3421=function(_0x2f04fa,_0x291fd0){_0x2f04fa=_0x2f04fa-0x0;var _0x404717=_0x4213[_0x2f04fa];return _0x404717;};'use strict';var EventEmitter=require(_0x3421('0x0'));var SmsMessage=require(_0x3421('0x1'))['db'][_0x3421('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3421('0x3')](0x0);var events={'afterCreate':_0x3421('0x4'),'afterUpdate':_0x3421('0x5'),'afterDestroy':_0x3421('0x6')};function emitEvent(_0x5a303d){return function(_0xdbd54e,_0x5c3719,_0x459c5e){SmsMessageEvents[_0x3421('0x7')](_0x5a303d+':'+_0xdbd54e['id'],_0xdbd54e);SmsMessageEvents[_0x3421('0x7')](_0x5a303d,_0xdbd54e);_0x459c5e(null);};}for(var e in events){if(events[_0x3421('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x3421('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2b2a83f..91ff72c 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 _0x179e=['message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','secret','SmsAccount','find','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','GET','POST','user_key','session_key','total_sent','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','clicksend','password','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','csc','crypto','apiKey','login','text','timestamp','createHash','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code'];(function(_0x2ffb4c,_0x2a1ab0){var _0x56635b=function(_0xeed64e){while(--_0xeed64e){_0x2ffb4c['push'](_0x2ffb4c['shift']());}};_0x56635b(++_0x2a1ab0);}(_0x179e,0x164));var _0xe179=function(_0x3cdd83,_0x4c9216){_0x3cdd83=_0x3cdd83-0x0;var _0x139a73=_0x179e[_0x3cdd83];return _0x139a73;};'use strict';var _=require('lodash');var util=require(_0xe179('0x0'));var logger=require(_0xe179('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe179('0x2'));var rp=require(_0xe179('0x3'));var fs=require('fs');var path=require(_0xe179('0x4'));var rimraf=require(_0xe179('0x5'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xe179('0x6')]=function(_0x254970,_0x4b8a44){return _0x254970[_0xe179('0x7')](_0xe179('0x8'),attributes,{'tableName':_0xe179('0x9'),'paranoid':![],'indexes':[{'name':_0xe179('0xa'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xe179('0xb')],'type':_0xe179('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x343c53,_0x23d810,_0x453cb6){var _0x4a2027=_0x254970[_0xe179('0xd')];var _0x5b0d60=_0x343c53[_0xe179('0xe')]({'plain':!![]});if(_0x5b0d60['direction'][_0xe179('0xf')]()==='in'||_0x5b0d60[_0xe179('0x10')][_0xe179('0xf')]()===_0xe179('0x11')&&!_0x5b0d60['secret']&&!_[_0xe179('0x12')](_0x5b0d60[_0xe179('0x13')])){_0x4a2027[_0xe179('0x14')][_0xe179('0x15')]({'where':{'id':_0x5b0d60[_0xe179('0x16')]}})[_0xe179('0x17')](function(_0x27070a){if(_0x27070a){_0x27070a[_0xe179('0x18')]({'lastMsgAt':_0x5b0d60[_0xe179('0x19')],'lastMsgDirection':_0x5b0d60[_0xe179('0x10')][_0xe179('0xf')]()});}})[_0xe179('0x1a')](function(_0x1b2ab0){console[_0xe179('0x1b')](_0x1b2ab0);});}if(_0x5b0d60[_0xe179('0x10')]===_0xe179('0x11')&&!_0x5b0d60[_0xe179('0x1c')]){var _0x4b35d2;_0x4a2027[_0xe179('0x1d')][_0xe179('0x1e')]({'where':{'id':_0x5b0d60['SmsAccountId']},'raw':!![]})[_0xe179('0x17')](function(_0x3f4b8e){_0x4b35d2=_0x3f4b8e;if(_0x4b35d2&&_0x4b35d2['type']){switch(_0x4b35d2[_0xe179('0x1f')]){case _0xe179('0x20'):var _0x4f21ea=require(_0xe179('0x20'));if(_0x4b35d2['accountSid']&&_0x4b35d2[_0xe179('0x21')]&&_0x4b35d2[_0xe179('0x22')]){var _0x5baf9e=new _0x4f21ea(_0x4b35d2[_0xe179('0x23')],_0x4b35d2[_0xe179('0x21')]);_0x5baf9e[_0xe179('0x24')][_0xe179('0x25')]({'body':_0x5b0d60[_0xe179('0xb')],'to':_0x5b0d60[_0xe179('0x22')],'from':_0x4b35d2[_0xe179('0x22')],'statusCallback':_0x4b35d2[_0xe179('0x26')]+_0xe179('0x27')+_0x5b0d60['id']+_0xe179('0x28')+_0x4b35d2[_0xe179('0x29')]})[_0xe179('0x17')](function(_0x3f0ecb){if(_0x3f0ecb[_0xe179('0x2a')]){return _0x343c53[_0xe179('0x18')]({'messageId':_0x3f0ecb[_0xe179('0x2a')]});}})[_0xe179('0x1a')](function(_0x36926e){logger['error'](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x20'),util[_0xe179('0x2d')](_0x36926e,{'showHidden':![],'depth':null}));});}else{logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x20'),_0xe179('0x2e'));}break;case'skebby':var _0x23adef=_0xe179('0x2f');if(_0x4b35d2[_0xe179('0x30')]&&_0x4b35d2['password']){var _0x35cbf4={'recipient':[_0x5b0d60[_0xe179('0x22')]],'message':_0x5b0d60[_0xe179('0xb')],'message_type':_0x4b35d2['smsMethod']};if(_0x4b35d2[_0xe179('0x31')]&&_0x4b35d2[_0xe179('0x31')]!=='SI'){_0x35cbf4[_0xe179('0x32')]=_0x4b35d2['phone'];}var _0x58c200={'url':_0x23adef+_0xe179('0x33')+_0x4b35d2[_0xe179('0x30')]+'&password='+_0x4b35d2['password'],'method':_0xe179('0x34')};rp(_0x58c200)[_0xe179('0x17')](function(_0x505a58){var _0x8b73b4=_0x505a58['split'](';');var _0x7e4d7b={'user_key':_0x8b73b4[0x0],'session_key':_0x8b73b4[0x1]};_0x58c200={'url':_0x23adef+'sms','method':_0xe179('0x35'),'headers':{'user_key':_0x7e4d7b[_0xe179('0x36')],'Session_key':_0x7e4d7b[_0xe179('0x37')]},'json':!![],'body':_0x35cbf4};return rp(_0x58c200);})['then'](function(_0x428323){if(_0x428323[_0xe179('0x38')]>=0x1){var _0x4dd864={'messageId':_0x428323['internal_order_id']};if(_0x4b35d2[_0xe179('0x31')]!=='GP'||!_0x4b35d2['deliveryReport']){_0x4dd864[_0xe179('0x39')]=!![];}return _0x343c53['update'](_0x4dd864);}else{return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x3a'),util['inspect'](_0x428323,{'showHidden':![],'depth':null}));}})[_0xe179('0x1a')](function(_0x11dee6){return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x3a'),util[_0xe179('0x2d')](_0x11dee6,{'showHidden':![],'depth':null}));});}else{logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),'skebby',_0xe179('0x3b'));}break;case _0xe179('0x3c'):if(_0x4b35d2['authToken']){var _0xde8830={'recipient':_0x5b0d60['phone'],'message':_0x5b0d60['body'],'sender':_0x4b35d2[_0xe179('0x3d')]||_0x4b35d2['phone'],'authorization':_0x4b35d2[_0xe179('0x21')]};var _0x23d810={'method':'POST','uri':'https://smsapi.connectel.se/api/send/','body':_0xde8830,'json':!![]};rp(_0x23d810)[_0xe179('0x17')](function(_0x37ecf2){var _0x1d21cf={'messageId':_0x37ecf2['requestid']};if(!_0x4b35d2['deliveryReport']){_0x1d21cf[_0xe179('0x39')]=!![];}return _0x343c53[_0xe179('0x18')](_0x1d21cf);})[_0xe179('0x1a')](function(_0x10a8d4){logger['error'](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x3c'),util['inspect'](_0x10a8d4,{'showHidden':![],'depth':null}));});}else{logger[_0xe179('0x1b')](_0xe179('0x2b'),'afterCreate',_0xe179('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0xe179('0x3e'):if(_0x4b35d2[_0xe179('0x30')]&&_0x4b35d2[_0xe179('0x3f')]){var _0xde8830={'messages':[{'source':_0xe179('0x40'),'to':_0x5b0d60[_0xe179('0x22')],'body':_0x5b0d60[_0xe179('0xb')],'from':_0x4b35d2[_0xe179('0x3d')]||_0x4b35d2['phone']}]};var _0x3ccb2a=util[_0xe179('0x41')]('%s:%s',_0x4b35d2['username'],_0x4b35d2[_0xe179('0x3f')]);var _0x23d810={'method':_0xe179('0x35'),'uri':_0xe179('0x42'),'body':_0xde8830,'headers':{'Authorization':util[_0xe179('0x41')](_0xe179('0x43'),new Buffer(_0x3ccb2a)[_0xe179('0x44')]('base64'))},'json':!![]};rp(_0x23d810)[_0xe179('0x17')](function(_0x341f6a){if(_0x341f6a[_0xe179('0x45')]>=0xc8&&_0x341f6a[_0xe179('0x45')]<=0xce){if(_0x341f6a[_0xe179('0x46')]&&_0x341f6a[_0xe179('0x46')][_0xe179('0x47')]>0x0){var _0x19022f=_[_0xe179('0x48')](_0x341f6a[_0xe179('0x46')][_0xe179('0x24')]);var _0x259aaf={'messageId':_0x19022f[_0xe179('0x49')]};if(!_0x4b35d2[_0xe179('0x4a')]){_0x259aaf['read']=!![];}return _0x343c53[_0xe179('0x18')](_0x259aaf);}else{logger['error'](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x4b'),util['inspect'](_0x341f6a,{'showHidden':![],'depth':null}));}}else{logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x4b'),util[_0xe179('0x2d')](_0x341f6a,{'showHidden':![],'depth':null}));}})[_0xe179('0x1a')](function(_0xef994c){logger[_0xe179('0x1b')](_0xe179('0x2b'),'afterCreate',_0xe179('0x4b'),util['inspect'](_0xef994c,{'showHidden':![],'depth':null}));});}else{logger[_0xe179('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0xe179('0x3b'));}break;case _0xe179('0x4c'):if(_0x4b35d2[_0xe179('0x4d')]&&_0x4b35d2['authToken']){var _0xde8830={'dst':_0x5b0d60[_0xe179('0x22')],'text':_0x5b0d60[_0xe179('0xb')],'src':_0x4b35d2[_0xe179('0x3d')]||_0x4b35d2['phone'],'url':_0x4b35d2['remote']+_0xe179('0x27')+_0x5b0d60['id']+_0xe179('0x28')+_0x4b35d2[_0xe179('0x29')]};var _0x3ccb2a=util[_0xe179('0x41')]('%s:%s',_0x4b35d2[_0xe179('0x4d')],_0x4b35d2[_0xe179('0x21')]);var _0x23d810={'method':_0xe179('0x35'),'uri':util[_0xe179('0x41')](_0xe179('0x4e'),_0x4b35d2['authId']),'body':_0xde8830,'headers':{'Authorization':util['format'](_0xe179('0x43'),new Buffer(_0x3ccb2a)[_0xe179('0x44')]('base64'))},'json':!![]};rp(_0x23d810)[_0xe179('0x17')](function(_0x3b9dd1){var _0x288a2b={'messageId':_0x3b9dd1[_0xe179('0x4f')][0x0]};return _0x343c53[_0xe179('0x18')](_0x288a2b);})['catch'](function(_0x49c752){logger[_0xe179('0x1b')](_0xe179('0x2b'),'afterCreate',_0xe179('0x4c'),util['inspect'](_0x49c752,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x4c'),_0xe179('0x50'));}break;case'infobip':if(_0x4b35d2[_0xe179('0x30')]&&_0x4b35d2['password']){if(_0x4b35d2[_0xe179('0x51')]){var _0x5ab96b={'method':_0xe179('0x35'),'uri':_0x4b35d2[_0xe179('0x51')]+_0xe179('0x52'),'body':{'username':_0x4b35d2['username'],'password':_0x4b35d2[_0xe179('0x3f')]},'json':!![]};return rp(_0x5ab96b)['then'](function(_0x44d322){var _0x553ce6={'method':'POST','uri':_0x4b35d2[_0xe179('0x51')]+_0xe179('0x53'),'body':{'messages':[{'from':_0x4b35d2['phone'],'destinations':[{'to':_0x5b0d60['phone']}],'text':_0x5b0d60[_0xe179('0xb')],'notifyUrl':_0x4b35d2[_0xe179('0x26')]+_0xe179('0x27')+_0x5b0d60['id']+_0xe179('0x28')+_0x4b35d2[_0xe179('0x29')],'notifyContentType':'application/json','callbackData':_0x4b35d2[_0xe179('0x22')]+';'+_0x5b0d60[_0xe179('0xb')]}]},'headers':{'Authorization':_0xe179('0x54')+_0x44d322['token']},'json':!![]};return rp(_0x553ce6)['then'](function(_0x4805d8){if(_0x4805d8[_0xe179('0x24')]){var _0x2b9577={'messageId':_0x4805d8[_0xe179('0x24')][0x0][_0xe179('0xa')]};if(!_0x4b35d2[_0xe179('0x4a')]){_0x2b9577[_0xe179('0x39')]=!![];}return _0x343c53[_0xe179('0x18')](_0x2b9577);}else{return logger[_0xe179('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe179('0x2c'),_0xe179('0x55'),util['inspect'](_0x4805d8,{'showHidden':![],'depth':null}));}});})[_0xe179('0x1a')](function(_0xf068a4){return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),'infobip',util[_0xe179('0x2d')](_0xf068a4,{'showHidden':![],'depth':null}));});}else{logger[_0xe179('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe179('0x56'):var _0xcd33a2=require(_0xe179('0x57'));if(_0x4b35d2[_0xe179('0x58')]){var _0x152e76={};_0x152e76[_0xe179('0x59')]=_0x4b35d2['username'];_0x152e76[_0xe179('0x22')]=_0x5b0d60[_0xe179('0x22')];_0x152e76[_0xe179('0x32')]=_0x4b35d2['phone'];_0x152e76[_0xe179('0x5a')]=_0x5b0d60[_0xe179('0xb')];_0x152e76[_0xe179('0x5b')]=+new Date();var _0x4a9909='';var _0x345419='';var _0x59f1ee=Object['keys'](_0x152e76);_0x59f1ee['sort']();for(var _0x108085=0x0;_0x108085<_0x59f1ee['length'];_0x108085++){if(_0x4a9909!=''){_0x4a9909+='&';}_0x4a9909+=_0x59f1ee[_0x108085]+'='+encodeURIComponent(_0x152e76[_0x59f1ee[_0x108085]]);_0x345419+=_0x152e76[_0x59f1ee[_0x108085]];}_0x345419+=_0x4b35d2[_0xe179('0x58')];_0x345419=_0xcd33a2[_0xe179('0x5c')]('md5')[_0xe179('0x18')](_0x345419)[_0xe179('0x5d')](_0xe179('0x5e'));if(_0x4a9909!==''){_0x4a9909+='&';}_0x4a9909+=_0xe179('0x5f')+_0x345419;var _0x58c200={'method':_0xe179('0x34'),'uri':'https://sms.csc.lv/external/get/send.php?'+_0x4a9909,'json':!![]};return rp(_0x58c200)[_0xe179('0x17')](function(_0x96818e){var _0x398f2c=Object[_0xe179('0x60')](_0x96818e);if(_0x96818e[_0x398f2c[0x0]][_0xe179('0x1b')]&&parseInt(_0x96818e[_0x398f2c[0x0]]['error'])===0x0){var _0x3ccbce={'messageId':_0x96818e[_0x398f2c[0x0]][_0xe179('0x61')]};if(!_0x4b35d2[_0xe179('0x4a')]){_0x3ccbce[_0xe179('0x39')]=!![];}return _0x343c53[_0xe179('0x18')](_0x3ccbce);}else{return logger[_0xe179('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe179('0x2c'),_0xe179('0x56'),util['inspect'](_0x96818e[_0xe179('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5d6cff){return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),'csc',util[_0xe179('0x2d')](_0x5d6cff,{'showHidden':![],'depth':null}));});}else{logger[_0xe179('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe179('0x2c'),_0xe179('0x56'),_0xe179('0x62'));}break;case _0xe179('0x63'):if(_0x4b35d2['apiKey']){var _0x29a658={'method':_0xe179('0x35'),'uri':_0xe179('0x64'),'headers':{'Authorization':_0x4b35d2['apiKey']},'body':{'content':_0x5b0d60[_0xe179('0xb')],'to':[_0x5b0d60[_0xe179('0x22')]],'from':_0x4b35d2[_0xe179('0x22')],'binary':![],'clientMessageId':_0xe179('0x65'),'charset':_0xe179('0x66')},'json':!![]};rp(_0x29a658)[_0xe179('0x17')](function(_0x3ea8ae){if(!_0x3ea8ae['error']){var _0x264616={'messageId':_0x3ea8ae[_0xe179('0x24')][0x0][_0xe179('0x67')]};if(!_0x4b35d2[_0xe179('0x4a')]){_0x264616[_0xe179('0x39')]=!![];}return _0x343c53[_0xe179('0x18')](_0x264616);}else{return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x63'),util[_0xe179('0x2d')](_0x3ea8ae[_0xe179('0x1b')],{'showHidden':![],'depth':null}));}})[_0xe179('0x1a')](function(_0x4465e4){return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x63'),util[_0xe179('0x2d')](_0x4465e4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x63'),_0xe179('0x62'));}break;case'intelepeer':if(_0x4b35d2[_0xe179('0x58')]){var _0x358ace={};var _0x58c200={'method':_0xe179('0x35'),'uri':_0xe179('0x68'),'headers':{'Authorization':_0xe179('0x69')+_0x4b35d2['apiKey'],'Content-Type':_0xe179('0x6a')},'body':{'from':_0x4b35d2[_0xe179('0x22')],'to':_0x5b0d60[_0xe179('0x22')],'text':_0x5b0d60[_0xe179('0xb')]},'json':!![]};return rp(_0x58c200)[_0xe179('0x17')](function(_0x49b0b9){if(_0x49b0b9[_0xe179('0x6b')]==0xca){_0x358ace[_0xe179('0x6c')]=_0x49b0b9;var _0x34fb02={'method':_0xe179('0x35'),'uri':_0xe179('0x6d'),'headers':{'Authorization':_0xe179('0x69')+_0x4b35d2[_0xe179('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x358ace[_0xe179('0x6c')][_0xe179('0x6e')]},'json':!![]};return rp(_0x34fb02)['then'](function(_0x2e9436){_0x358ace[_0xe179('0x6f')]=_0x2e9436;var _0x11c497={'messageId':_0x358ace[_0xe179('0x6c')][_0xe179('0x6e')],'read':!![]};return _0x343c53[_0xe179('0x18')](_0x11c497);});}else{return logger[_0xe179('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe179('0x2c'),_0xe179('0x70'),util[_0xe179('0x2d')](_0x49b0b9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5184fc){return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x70'),util[_0xe179('0x2d')](_0x5184fc,{'showHidden':![],'depth':null}));});}else{return logger[_0xe179('0x1b')](_0xe179('0x2b'),_0xe179('0x2c'),_0xe179('0x70'),'Token\x20not\x20received');}break;}}})[_0xe179('0x71')](function(){_0x453cb6();});}else{_0x453cb6();}}},'charset':_0xe179('0x72'),'collate':_0xe179('0x73')});}; \ No newline at end of file +var _0xa12a=['models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','then','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','Basic\x20%s','http_code','data','queued_count','head','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','md5','hex','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT'];(function(_0xa4b885,_0x1e725a){var _0x2be448=function(_0x57cacb){while(--_0x57cacb){_0xa4b885['push'](_0xa4b885['shift']());}};_0x2be448(++_0x1e725a);}(_0xa12a,0x147));var _0xaa12=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa12a[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xaa12('0x0'));var util=require(_0xaa12('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaa12('0x2'));var BPromise=require(_0xaa12('0x3'));var rp=require(_0xaa12('0x4'));var fs=require('fs');var path=require(_0xaa12('0x5'));var rimraf=require(_0xaa12('0x6'));var config=require(_0xaa12('0x7'));var attributes=require(_0xaa12('0x8'));module['exports']=function(_0x385c61,_0x32bdc3){return _0x385c61[_0xaa12('0x9')](_0xaa12('0xa'),attributes,{'tableName':_0xaa12('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xaa12('0xc')]},{'name':_0xaa12('0xd'),'fields':['body'],'type':_0xaa12('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4db38e,_0x1d27f8,_0x113952){var _0x5394ee=_0x385c61[_0xaa12('0xf')];var _0x3e437f=_0x4db38e[_0xaa12('0x10')]({'plain':!![]});if(_0x3e437f[_0xaa12('0x11')]['toLowerCase']()==='in'||_0x3e437f['direction'][_0xaa12('0x12')]()==='out'&&!_0x3e437f[_0xaa12('0x13')]&&!_[_0xaa12('0x14')](_0x3e437f[_0xaa12('0x15')])){_0x5394ee[_0xaa12('0x16')]['findOne']({'where':{'id':_0x3e437f['SmsInteractionId']}})[_0xaa12('0x17')](function(_0x2b0b0d){if(_0x2b0b0d){_0x2b0b0d['update']({'lastMsgAt':_0x3e437f[_0xaa12('0x18')],'lastMsgDirection':_0x3e437f[_0xaa12('0x11')][_0xaa12('0x12')]()});}})['catch'](function(_0x39e7ff){console[_0xaa12('0x19')](_0x39e7ff);});}if(_0x3e437f[_0xaa12('0x11')]==='out'&&!_0x3e437f[_0xaa12('0x13')]){var _0xd36092;_0x5394ee[_0xaa12('0x1a')][_0xaa12('0x1b')]({'where':{'id':_0x3e437f[_0xaa12('0x1c')]},'raw':!![]})['then'](function(_0x3e87d5){_0xd36092=_0x3e87d5;if(_0xd36092&&_0xd36092[_0xaa12('0x1d')]){switch(_0xd36092[_0xaa12('0x1d')]){case _0xaa12('0x1e'):var _0x371310=require(_0xaa12('0x1e'));if(_0xd36092[_0xaa12('0x1f')]&&_0xd36092[_0xaa12('0x20')]&&_0xd36092[_0xaa12('0x21')]){var _0x37ce0c=new _0x371310(_0xd36092[_0xaa12('0x1f')],_0xd36092[_0xaa12('0x20')]);_0x37ce0c[_0xaa12('0x22')][_0xaa12('0x23')]({'body':_0x3e437f[_0xaa12('0x24')],'to':_0x3e437f[_0xaa12('0x21')],'from':_0xd36092['phone'],'statusCallback':_0xd36092['remote']+_0xaa12('0x25')+_0x3e437f['id']+_0xaa12('0x26')+_0xd36092[_0xaa12('0x27')]})['then'](function(_0x415e04){if(_0x415e04[_0xaa12('0x28')]){return _0x4db38e[_0xaa12('0x29')]({'messageId':_0x415e04['sid']});}})[_0xaa12('0x2a')](function(_0x952b7d){logger['error'](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x1e'),util['inspect'](_0x952b7d,{'showHidden':![],'depth':null}));});}else{logger[_0xaa12('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa12('0x2c'),_0xaa12('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xaa12('0x2d'):var _0x1738d5=_0xaa12('0x2e');if(_0xd36092[_0xaa12('0x2f')]&&_0xd36092[_0xaa12('0x30')]){var _0x44e0e9={'recipient':[_0x3e437f[_0xaa12('0x21')]],'message':_0x3e437f[_0xaa12('0x24')],'message_type':_0xd36092[_0xaa12('0x31')]};if(_0xd36092[_0xaa12('0x31')]&&_0xd36092['smsMethod']!=='SI'){_0x44e0e9[_0xaa12('0x32')]=_0xd36092[_0xaa12('0x21')];}var _0x3b4081={'url':_0x1738d5+'login?username='+_0xd36092[_0xaa12('0x2f')]+'&password='+_0xd36092[_0xaa12('0x30')],'method':'GET'};rp(_0x3b4081)['then'](function(_0xbf0747){var _0x2c2f1c=_0xbf0747[_0xaa12('0x33')](';');var _0x5be384={'user_key':_0x2c2f1c[0x0],'session_key':_0x2c2f1c[0x1]};_0x3b4081={'url':_0x1738d5+_0xaa12('0x34'),'method':'POST','headers':{'user_key':_0x5be384[_0xaa12('0x35')],'Session_key':_0x5be384[_0xaa12('0x36')]},'json':!![],'body':_0x44e0e9};return rp(_0x3b4081);})['then'](function(_0x5c5e5a){if(_0x5c5e5a[_0xaa12('0x37')]>=0x1){var _0x1df954={'messageId':_0x5c5e5a[_0xaa12('0x38')]};if(_0xd36092[_0xaa12('0x31')]!=='GP'||!_0xd36092[_0xaa12('0x39')]){_0x1df954['read']=!![];}return _0x4db38e['update'](_0x1df954);}else{return logger[_0xaa12('0x19')](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x2d'),util[_0xaa12('0x3a')](_0x5c5e5a,{'showHidden':![],'depth':null}));}})[_0xaa12('0x2a')](function(_0x3c4988){return logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x2d'),util['inspect'](_0x3c4988,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x2d'),_0xaa12('0x3b'));}break;case _0xaa12('0x3c'):if(_0xd36092[_0xaa12('0x20')]){var _0x15a542={'recipient':_0x3e437f[_0xaa12('0x21')],'message':_0x3e437f[_0xaa12('0x24')],'sender':_0xd36092[_0xaa12('0x3d')]||_0xd36092[_0xaa12('0x21')],'authorization':_0xd36092['authToken']};var _0x1d27f8={'method':_0xaa12('0x3e'),'uri':_0xaa12('0x3f'),'body':_0x15a542,'json':!![]};rp(_0x1d27f8)[_0xaa12('0x17')](function(_0x1caa39){var _0x50eb5c={'messageId':_0x1caa39[_0xaa12('0x40')]};if(!_0xd36092[_0xaa12('0x39')]){_0x50eb5c[_0xaa12('0x41')]=!![];}return _0x4db38e[_0xaa12('0x29')](_0x50eb5c);})[_0xaa12('0x2a')](function(_0x4c5cdf){logger[_0xaa12('0x19')](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x3c'),util[_0xaa12('0x3a')](_0x4c5cdf,{'showHidden':![],'depth':null}));});}else{logger[_0xaa12('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaa12('0x3c'),_0xaa12('0x42'));}break;case _0xaa12('0x43'):if(_0xd36092[_0xaa12('0x2f')]&&_0xd36092[_0xaa12('0x30')]){var _0x15a542={'messages':[{'source':'xCALLY\x20Motion','to':_0x3e437f['phone'],'body':_0x3e437f[_0xaa12('0x24')],'from':_0xd36092[_0xaa12('0x3d')]||_0xd36092[_0xaa12('0x21')]}]};var _0x34320a=util[_0xaa12('0x44')](_0xaa12('0x45'),_0xd36092[_0xaa12('0x2f')],_0xd36092[_0xaa12('0x30')]);var _0x1d27f8={'method':_0xaa12('0x3e'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x15a542,'headers':{'Authorization':util[_0xaa12('0x44')](_0xaa12('0x46'),new Buffer(_0x34320a)['toString']('base64'))},'json':!![]};rp(_0x1d27f8)[_0xaa12('0x17')](function(_0x2b4471){if(_0x2b4471[_0xaa12('0x47')]>=0xc8&&_0x2b4471['http_code']<=0xce){if(_0x2b4471[_0xaa12('0x48')]&&_0x2b4471[_0xaa12('0x48')][_0xaa12('0x49')]>0x0){var _0x3fa94d=_[_0xaa12('0x4a')](_0x2b4471[_0xaa12('0x48')][_0xaa12('0x22')]);var _0x574a0f={'messageId':_0x3fa94d['message_id']};if(!_0xd36092[_0xaa12('0x39')]){_0x574a0f['read']=!![];}return _0x4db38e[_0xaa12('0x29')](_0x574a0f);}else{logger[_0xaa12('0x19')](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x4b'),util[_0xaa12('0x3a')](_0x2b4471,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa12('0x2c'),_0xaa12('0x4b'),util[_0xaa12('0x3a')](_0x2b4471,{'showHidden':![],'depth':null}));}})[_0xaa12('0x2a')](function(_0x34a179){logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),'clickSend',util[_0xaa12('0x3a')](_0x34a179,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x4b'),_0xaa12('0x3b'));}break;case'plivo':if(_0xd36092[_0xaa12('0x4c')]&&_0xd36092[_0xaa12('0x20')]){var _0x15a542={'dst':_0x3e437f['phone'],'text':_0x3e437f[_0xaa12('0x24')],'src':_0xd36092[_0xaa12('0x3d')]||_0xd36092[_0xaa12('0x21')],'url':_0xd36092['remote']+_0xaa12('0x25')+_0x3e437f['id']+'/status?token='+_0xd36092['token']};var _0x34320a=util[_0xaa12('0x44')](_0xaa12('0x45'),_0xd36092[_0xaa12('0x4c')],_0xd36092['authToken']);var _0x1d27f8={'method':_0xaa12('0x3e'),'uri':util['format'](_0xaa12('0x4d'),_0xd36092[_0xaa12('0x4c')]),'body':_0x15a542,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x34320a)[_0xaa12('0x4e')]('base64'))},'json':!![]};rp(_0x1d27f8)[_0xaa12('0x17')](function(_0x4d73f7){var _0x521b3e={'messageId':_0x4d73f7[_0xaa12('0x4f')][0x0]};return _0x4db38e[_0xaa12('0x29')](_0x521b3e);})['catch'](function(_0x5cdd0a){logger[_0xaa12('0x19')](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x50'),util['inspect'](_0x5cdd0a,{'showHidden':![],'depth':null}));});}else{logger[_0xaa12('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa12('0x2c'),_0xaa12('0x50'),_0xaa12('0x51'));}break;case _0xaa12('0x52'):if(_0xd36092[_0xaa12('0x2f')]&&_0xd36092[_0xaa12('0x30')]){if(_0xd36092[_0xaa12('0x53')]){var _0x11b3d5={'method':_0xaa12('0x3e'),'uri':_0xd36092[_0xaa12('0x53')]+_0xaa12('0x54'),'body':{'username':_0xd36092[_0xaa12('0x2f')],'password':_0xd36092['password']},'json':!![]};return rp(_0x11b3d5)[_0xaa12('0x17')](function(_0x55e9a4){var _0x58e89d={'method':_0xaa12('0x3e'),'uri':_0xd36092[_0xaa12('0x53')]+_0xaa12('0x55'),'body':{'messages':[{'from':_0xd36092[_0xaa12('0x21')],'destinations':[{'to':_0x3e437f[_0xaa12('0x21')]}],'text':_0x3e437f[_0xaa12('0x24')],'notifyUrl':_0xd36092['remote']+_0xaa12('0x25')+_0x3e437f['id']+_0xaa12('0x26')+_0xd36092['token'],'notifyContentType':_0xaa12('0x56'),'callbackData':_0xd36092[_0xaa12('0x21')]+';'+_0x3e437f[_0xaa12('0x24')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x55e9a4[_0xaa12('0x27')]},'json':!![]};return rp(_0x58e89d)[_0xaa12('0x17')](function(_0x4ae895){if(_0x4ae895[_0xaa12('0x22')]){var _0x4dae9a={'messageId':_0x4ae895[_0xaa12('0x22')][0x0][_0xaa12('0xc')]};if(!_0xd36092[_0xaa12('0x39')]){_0x4dae9a[_0xaa12('0x41')]=!![];}return _0x4db38e[_0xaa12('0x29')](_0x4dae9a);}else{return logger[_0xaa12('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaa12('0x52'),util[_0xaa12('0x3a')](_0x4ae895,{'showHidden':![],'depth':null}));}});})[_0xaa12('0x2a')](function(_0x30beb3){return logger['error'](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x52'),util[_0xaa12('0x3a')](_0x30beb3,{'showHidden':![],'depth':null}));});}else{logger[_0xaa12('0x19')](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x52'),_0xaa12('0x57'));}}else{logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x52'),_0xaa12('0x3b'));}break;case _0xaa12('0x58'):var _0x4a148f=require(_0xaa12('0x59'));if(_0xd36092[_0xaa12('0x5a')]){var _0x533470={};_0x533470[_0xaa12('0x5b')]=_0xd36092[_0xaa12('0x2f')];_0x533470[_0xaa12('0x21')]=_0x3e437f[_0xaa12('0x21')];_0x533470['sender']=_0xd36092[_0xaa12('0x21')];_0x533470[_0xaa12('0x5c')]=_0x3e437f[_0xaa12('0x24')];_0x533470[_0xaa12('0x5d')]=+new Date();var _0x19327a='';var _0x39aedd='';var _0x554377=Object[_0xaa12('0x5e')](_0x533470);_0x554377['sort']();for(var _0x3d7204=0x0;_0x3d7204<_0x554377[_0xaa12('0x5f')];_0x3d7204++){if(_0x19327a!=''){_0x19327a+='&';}_0x19327a+=_0x554377[_0x3d7204]+'='+encodeURIComponent(_0x533470[_0x554377[_0x3d7204]]);_0x39aedd+=_0x533470[_0x554377[_0x3d7204]];}_0x39aedd+=_0xd36092[_0xaa12('0x5a')];_0x39aedd=_0x4a148f['createHash'](_0xaa12('0x60'))['update'](_0x39aedd)['digest'](_0xaa12('0x61'));if(_0x19327a!==''){_0x19327a+='&';}_0x19327a+=_0xaa12('0x62')+_0x39aedd;var _0x3b4081={'method':_0xaa12('0x63'),'uri':'https://sms.csc.lv/external/get/send.php?'+_0x19327a,'json':!![]};return rp(_0x3b4081)[_0xaa12('0x17')](function(_0x5ae204){var _0x1ef0ca=Object[_0xaa12('0x5e')](_0x5ae204);if(_0x5ae204[_0x1ef0ca[0x0]][_0xaa12('0x19')]&&parseInt(_0x5ae204[_0x1ef0ca[0x0]][_0xaa12('0x19')])===0x0){var _0x23aed7={'messageId':_0x5ae204[_0x1ef0ca[0x0]][_0xaa12('0x64')]};if(!_0xd36092['deliveryReport']){_0x23aed7[_0xaa12('0x41')]=!![];}return _0x4db38e[_0xaa12('0x29')](_0x23aed7);}else{return logger['error'](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x58'),util[_0xaa12('0x3a')](_0x5ae204[_0xaa12('0x19')],{'showHidden':![],'depth':null}));}})[_0xaa12('0x2a')](function(_0x5e30de){return logger[_0xaa12('0x19')](_0xaa12('0x2b'),'afterCreate',_0xaa12('0x58'),util[_0xaa12('0x3a')](_0x5e30de,{'showHidden':![],'depth':null}));});}else{logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x58'),_0xaa12('0x65'));}break;case _0xaa12('0x66'):if(_0xd36092['apiKey']){var _0x2ae714={'method':_0xaa12('0x3e'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xd36092[_0xaa12('0x5a')]},'body':{'content':_0x3e437f[_0xaa12('0x24')],'to':[_0x3e437f[_0xaa12('0x21')]],'from':_0xd36092[_0xaa12('0x21')],'binary':![],'clientMessageId':_0xaa12('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x2ae714)[_0xaa12('0x17')](function(_0x44d4f7){if(!_0x44d4f7[_0xaa12('0x19')]){var _0x219ff2={'messageId':_0x44d4f7[_0xaa12('0x22')][0x0]['apiMessageId']};if(!_0xd36092[_0xaa12('0x39')]){_0x219ff2[_0xaa12('0x41')]=!![];}return _0x4db38e[_0xaa12('0x29')](_0x219ff2);}else{return logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),'clickatell',util[_0xaa12('0x3a')](_0x44d4f7[_0xaa12('0x19')],{'showHidden':![],'depth':null}));}})[_0xaa12('0x2a')](function(_0x2f9b5b){return logger['error'](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x66'),util[_0xaa12('0x3a')](_0x2f9b5b,{'showHidden':![],'depth':null}));});}else{logger[_0xaa12('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa12('0x2c'),'clickatell',_0xaa12('0x65'));}break;case _0xaa12('0x68'):if(_0xd36092[_0xaa12('0x5a')]){var _0x51c3a5={};var _0x3b4081={'method':_0xaa12('0x3e'),'uri':_0xaa12('0x69'),'headers':{'Authorization':_0xaa12('0x6a')+_0xd36092[_0xaa12('0x5a')],'Content-Type':_0xaa12('0x56')},'body':{'from':_0xd36092[_0xaa12('0x21')],'to':_0x3e437f[_0xaa12('0x21')],'text':_0x3e437f[_0xaa12('0x24')]},'json':!![]};return rp(_0x3b4081)[_0xaa12('0x17')](function(_0x24abe9){if(_0x24abe9['code']==0xca){_0x51c3a5[_0xaa12('0x6b')]=_0x24abe9;var _0x102091={'method':_0xaa12('0x3e'),'uri':_0xaa12('0x6c'),'headers':{'Authorization':_0xaa12('0x6a')+_0xd36092[_0xaa12('0x5a')],'Content-Type':_0xaa12('0x56')},'body':{'refid':_0x51c3a5[_0xaa12('0x6b')][_0xaa12('0x6d')]},'json':!![]};return rp(_0x102091)[_0xaa12('0x17')](function(_0x387498){_0x51c3a5[_0xaa12('0x6e')]=_0x387498;var _0x2378e0={'messageId':_0x51c3a5[_0xaa12('0x6b')][_0xaa12('0x6d')],'read':!![]};return _0x4db38e[_0xaa12('0x29')](_0x2378e0);});}else{return logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x68'),util[_0xaa12('0x3a')](_0x24abe9,{'showHidden':![],'depth':null}));}})[_0xaa12('0x2a')](function(_0x28e773){return logger[_0xaa12('0x19')](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x68'),util[_0xaa12('0x3a')](_0x28e773,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xaa12('0x2b'),_0xaa12('0x2c'),_0xaa12('0x68'),_0xaa12('0x6f'));}break;}}})[_0xaa12('0x70')](function(){_0x113952();});}else{_0x113952();}}},'charset':'utf8mb4','collate':_0xaa12('0x71')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 8a141eb..a2a9e56 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 _0x99fa=['SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17eaff,_0x48d358){var _0x46b8af=function(_0x262815){while(--_0x262815){_0x17eaff['push'](_0x17eaff['shift']());}};_0x46b8af(++_0x48d358);}(_0x99fa,0x176));var _0xa99f=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0x99fa[_0x3f042c];return _0x280d2e;};'use strict';var _=require(_0xa99f('0x0'));var util=require(_0xa99f('0x1'));var moment=require(_0xa99f('0x2'));var BPromise=require(_0xa99f('0x3'));var rs=require(_0xa99f('0x4'));var fs=require('fs');var Redis=require(_0xa99f('0x5'));var db=require(_0xa99f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa99f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa99f('0x8'));var client=jayson[_0xa99f('0x9')][_0xa99f('0xa')]({'port':0x232a});config['redis']=_[_0xa99f('0xb')](config[_0xa99f('0xc')],{'host':_0xa99f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa99f('0xc')]));require(_0xa99f('0xe'))[_0xa99f('0xf')](socket);function respondWithRpcPromise(_0x4d405b,_0x529d12,_0x6e0fb3){return new BPromise(function(_0x2364a9,_0x3209cf){return client[_0xa99f('0x10')](_0x4d405b,_0x6e0fb3)[_0xa99f('0x11')](function(_0x3a7397){logger[_0xa99f('0x12')](_0xa99f('0x13'),_0x529d12,_0xa99f('0x14'));logger[_0xa99f('0x15')](_0xa99f('0x16'),_0x529d12,_0xa99f('0x14'),JSON['stringify'](_0x3a7397));if(_0x3a7397[_0xa99f('0x17')]){if(_0x3a7397[_0xa99f('0x17')]['code']===0x1f4){logger[_0xa99f('0x17')](_0xa99f('0x13'),_0x529d12,_0x3a7397[_0xa99f('0x17')][_0xa99f('0x18')]);return _0x3209cf(_0x3a7397[_0xa99f('0x17')]['message']);}logger['error'](_0xa99f('0x13'),_0x529d12,_0x3a7397[_0xa99f('0x17')]['message']);return _0x2364a9(_0x3a7397[_0xa99f('0x17')][_0xa99f('0x18')]);}else{logger[_0xa99f('0x12')](_0xa99f('0x13'),_0x529d12,_0xa99f('0x14'));_0x2364a9(_0x3a7397[_0xa99f('0x19')][_0xa99f('0x18')]);}})[_0xa99f('0x1a')](function(_0x15d567){logger['error'](_0xa99f('0x13'),_0x529d12,_0x15d567);_0x3209cf(_0x15d567);});});}exports[_0xa99f('0x1b')]=function(_0x432a48){var _0x2d7bca=this;return new Promise(function(_0x55881b,_0x4df956){return db[_0xa99f('0x1c')][_0xa99f('0x1d')](_0x432a48[_0xa99f('0x1e')],{'raw':_0x432a48[_0xa99f('0x1f')]?_0x432a48[_0xa99f('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa99f('0x11')](function(_0x1e766a){logger[_0xa99f('0x12')](_0xa99f('0x1b'),_0x432a48);logger[_0xa99f('0x15')](_0xa99f('0x1b'),_0x432a48,JSON[_0xa99f('0x20')](_0x1e766a));_0x55881b(_0x1e766a);})['catch'](function(_0x511104){logger['error']('CreateSmsMessage',_0x511104[_0xa99f('0x18')],_0x432a48);_0x4df956(_0x2d7bca[_0xa99f('0x17')](0x1f4,_0x511104['message']));});});}; \ No newline at end of file +var _0xae2e=['defaults','redis','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateSmsMessage','SmsMessage','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xcd8769,_0x2887d7){var _0x19e231=function(_0x384c1b){while(--_0x384c1b){_0xcd8769['push'](_0xcd8769['shift']());}};_0x19e231(++_0x2887d7);}(_0xae2e,0x17a));var _0xeae2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xae2e[_0x432682];return _0x463d05;};'use strict';var _=require(_0xeae2('0x0'));var util=require(_0xeae2('0x1'));var moment=require(_0xeae2('0x2'));var BPromise=require('bluebird');var rs=require(_0xeae2('0x3'));var fs=require('fs');var Redis=require(_0xeae2('0x4'));var db=require(_0xeae2('0x5'))['db'];var utils=require(_0xeae2('0x6'));var logger=require(_0xeae2('0x7'))(_0xeae2('0x8'));var config=require(_0xeae2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeae2('0xa')][_0xeae2('0xb')]({'port':0x232a});config['redis']=_[_0xeae2('0xc')](config[_0xeae2('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeae2('0xe'))['register'](socket);function respondWithRpcPromise(_0x4eccbc,_0x4a8795,_0x383abe){return new BPromise(function(_0x1fbc26,_0x5ecf5b){return client[_0xeae2('0xf')](_0x4eccbc,_0x383abe)[_0xeae2('0x10')](function(_0x572726){logger[_0xeae2('0x11')](_0xeae2('0x12'),_0x4a8795,'request\x20sent');logger[_0xeae2('0x13')](_0xeae2('0x14'),_0x4a8795,'request\x20sent',JSON[_0xeae2('0x15')](_0x572726));if(_0x572726['error']){if(_0x572726['error']['code']===0x1f4){logger[_0xeae2('0x16')](_0xeae2('0x12'),_0x4a8795,_0x572726[_0xeae2('0x16')][_0xeae2('0x17')]);return _0x5ecf5b(_0x572726['error'][_0xeae2('0x17')]);}logger[_0xeae2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4a8795,_0x572726[_0xeae2('0x16')][_0xeae2('0x17')]);return _0x1fbc26(_0x572726[_0xeae2('0x16')][_0xeae2('0x17')]);}else{logger['info'](_0xeae2('0x12'),_0x4a8795,_0xeae2('0x18'));_0x1fbc26(_0x572726[_0xeae2('0x19')][_0xeae2('0x17')]);}})[_0xeae2('0x1a')](function(_0x3f94d2){logger[_0xeae2('0x16')](_0xeae2('0x12'),_0x4a8795,_0x3f94d2);_0x5ecf5b(_0x3f94d2);});});}exports[_0xeae2('0x1b')]=function(_0x3e0216){var _0xc34477=this;return new Promise(function(_0x37329e,_0x239852){return db[_0xeae2('0x1c')]['create'](_0x3e0216['body'],{'raw':_0x3e0216['options']?_0x3e0216[_0xeae2('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xeae2('0x10')](function(_0x1abfe2){logger[_0xeae2('0x11')](_0xeae2('0x1b'),_0x3e0216);logger[_0xeae2('0x13')](_0xeae2('0x1b'),_0x3e0216,JSON[_0xeae2('0x15')](_0x1abfe2));_0x37329e(_0x1abfe2);})[_0xeae2('0x1a')](function(_0x488f7c){logger['error'](_0xeae2('0x1b'),_0x488f7c[_0xeae2('0x17')],_0x3e0216);_0x239852(_0xc34477[_0xeae2('0x16')](0x1f4,_0x488f7c[_0xeae2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e9330fd..9295371 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 _0x2736=['length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x2736,0x175));var _0x6273=function(_0x42b02c,_0x5c7b99){_0x42b02c=_0x42b02c-0x0;var _0x105518=_0x2736[_0x42b02c];return _0x105518;};'use strict';var SmsMessageEvents=require(_0x6273('0x0'));var events=[_0x6273('0x1'),_0x6273('0x2'),'update'];function createListener(_0x359f23,_0x84d45d){return function(_0x4b30ec){_0x84d45d[_0x6273('0x3')](_0x359f23,_0x4b30ec);};}function removeListener(_0x31e0bb,_0x424efc){return function(){SmsMessageEvents[_0x6273('0x4')](_0x31e0bb,_0x424efc);};}exports['register']=function(_0x46e883){for(var _0x10ab47=0x0,_0x47f1fa=events[_0x6273('0x5')];_0x10ab47<_0x47f1fa;_0x10ab47++){var _0x1ca9bb=events[_0x10ab47];var _0x3daa04=createListener(_0x6273('0x6')+_0x1ca9bb,_0x46e883);SmsMessageEvents['on'](_0x1ca9bb,_0x3daa04);}}; \ No newline at end of file +var _0xecd2=['length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x7642c,_0x2ec4b0){var _0x5412fd=function(_0xffc8e3){while(--_0xffc8e3){_0x7642c['push'](_0x7642c['shift']());}};_0x5412fd(++_0x2ec4b0);}(_0xecd2,0xe6));var _0x2ecd=function(_0x403b12,_0x656d9e){_0x403b12=_0x403b12-0x0;var _0x4f9ee6=_0xecd2[_0x403b12];return _0x4f9ee6;};'use strict';var SmsMessageEvents=require(_0x2ecd('0x0'));var events=[_0x2ecd('0x1'),_0x2ecd('0x2'),'update'];function createListener(_0x24dda8,_0x7e37f6){return function(_0x2e714c){_0x7e37f6[_0x2ecd('0x3')](_0x24dda8,_0x2e714c);};}function removeListener(_0xcff50,_0x1e1388){return function(){SmsMessageEvents['removeListener'](_0xcff50,_0x1e1388);};}exports['register']=function(_0x3fc634){for(var _0x1bc519=0x0,_0x3fc063=events[_0x2ecd('0x4')];_0x1bc519<_0x3fc063;_0x1bc519++){var _0x5532ec=events[_0x1bc519];var _0x28e7ba=createListener(_0x2ecd('0x5')+_0x5532ec,_0x3fc634);SmsMessageEvents['on'](_0x5532ec,_0x28e7ba);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 20bdb9f..034e7d3 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 _0xb240=['create','addTeams','update','delete','removeTeams','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x3c1d56,_0xd7a04){var _0x52a025=function(_0x34dccc){while(--_0x34dccc){_0x3c1d56['push'](_0x3c1d56['shift']());}};_0x52a025(++_0xd7a04);}(_0xb240,0xdd));var _0x0b24=function(_0x455fe0,_0x5d9f91){_0x455fe0=_0x455fe0-0x0;var _0x16a792=_0xb240[_0x455fe0];return _0x16a792;};'use strict';var multer=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var path=require(_0x0b24('0x2'));var timeout=require(_0x0b24('0x3'));var express=require(_0x0b24('0x4'));var router=express[_0x0b24('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0b24('0x6'));var controller=require(_0x0b24('0x7'));router[_0x0b24('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x0b24('0x9')](),controller[_0x0b24('0xa')]);router[_0x0b24('0x8')](_0x0b24('0xb'),auth[_0x0b24('0x9')](),controller[_0x0b24('0xc')]);router[_0x0b24('0x8')](_0x0b24('0xd'),auth[_0x0b24('0x9')](),controller[_0x0b24('0xe')]);router['get'](_0x0b24('0xf'),auth[_0x0b24('0x9')](),controller[_0x0b24('0x10')]);router[_0x0b24('0x8')](_0x0b24('0x11'),auth[_0x0b24('0x9')](),controller['getAgents']);router[_0x0b24('0x12')]('/',auth[_0x0b24('0x9')](),controller[_0x0b24('0x13')]);router[_0x0b24('0x12')](_0x0b24('0xf'),auth[_0x0b24('0x9')](),controller[_0x0b24('0x14')]);router[_0x0b24('0x12')]('/:id/users',auth[_0x0b24('0x9')](),controller['addAgents']);router['put'](_0x0b24('0xb'),auth[_0x0b24('0x9')](),controller[_0x0b24('0x15')]);router['delete']('/:id',auth[_0x0b24('0x9')](),controller['destroy']);router[_0x0b24('0x16')](_0x0b24('0xf'),auth['isAuthenticated'](),controller[_0x0b24('0x17')]);router[_0x0b24('0x16')]('/:id/users',auth[_0x0b24('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x2375=['removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../config/environment','./smsQueue.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams','addAgents','update','destroy','delete'];(function(_0x1ed779,_0x30c297){var _0x1d2375=function(_0x6d5ab5){while(--_0x6d5ab5){_0x1ed779['push'](_0x1ed779['shift']());}};_0x1d2375(++_0x30c297);}(_0x2375,0x1ac));var _0x5237=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x2375[_0x243b59];return _0x3e1676;};'use strict';var multer=require('multer');var util=require(_0x5237('0x0'));var path=require(_0x5237('0x1'));var timeout=require(_0x5237('0x2'));var express=require('express');var router=express[_0x5237('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5237('0x4'));var controller=require(_0x5237('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5237('0x6')]);router[_0x5237('0x7')](_0x5237('0x8'),auth[_0x5237('0x9')](),controller['describe']);router['get'](_0x5237('0xa'),auth[_0x5237('0x9')](),controller[_0x5237('0xb')]);router[_0x5237('0x7')](_0x5237('0xc'),auth[_0x5237('0x9')](),controller[_0x5237('0xd')]);router[_0x5237('0x7')](_0x5237('0xe'),auth[_0x5237('0x9')](),controller[_0x5237('0xf')]);router[_0x5237('0x7')](_0x5237('0x10'),auth[_0x5237('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x5237('0x11')]);router['post']('/:id/users',auth[_0x5237('0x9')](),controller[_0x5237('0x12')]);router['put'](_0x5237('0xa'),auth[_0x5237('0x9')](),controller[_0x5237('0x13')]);router['delete'](_0x5237('0xa'),auth['isAuthenticated'](),controller[_0x5237('0x14')]);router[_0x5237('0x15')](_0x5237('0xe'),auth['isAuthenticated'](),controller[_0x5237('0x16')]);router[_0x5237('0x15')](_0x5237('0x10'),auth[_0x5237('0x9')](),controller[_0x5237('0x17')]);module[_0x5237('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4e531f6..ecc8bce 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 _0xb274=['roundrobin','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0xb274,0xe8));var _0x4b27=function(_0x16f239,_0x443414){_0x16f239=_0x16f239-0x0;var _0x22d209=_0xb274[_0x16f239];return _0x22d209;};'use strict';var Sequelize=require('sequelize');module[_0x4b27('0x0')]={'name':{'type':Sequelize[_0x4b27('0x1')],'unique':_0x4b27('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4b27('0x1')]},'timeout':{'type':Sequelize[_0x4b27('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4b27('0x4')]('rrmemory',_0x4b27('0x5'),_0x4b27('0x6'))}}; \ No newline at end of file +var _0x66cb=['STRING','name','INTEGER','ENUM','beepall','sequelize','exports'];(function(_0x2db3d1,_0x836e3){var _0x1754b7=function(_0x1a62e9){while(--_0x1a62e9){_0x2db3d1['push'](_0x2db3d1['shift']());}};_0x1754b7(++_0x836e3);}(_0x66cb,0xa6));var _0xb66c=function(_0x4c2b1a,_0x194add){_0x4c2b1a=_0x4c2b1a-0x0;var _0x234a8d=_0x66cb[_0x4c2b1a];return _0x234a8d;};'use strict';var Sequelize=require(_0xb66c('0x0'));module[_0xb66c('0x1')]={'name':{'type':Sequelize[_0xb66c('0x2')],'unique':_0xb66c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb66c('0x2')]},'timeout':{'type':Sequelize[_0xb66c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb66c('0x5')]('rrmemory',_0xb66c('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 79d828c..60495ed 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 _0xe4b8=['index','SmsQueue','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','key','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','sequelize','transaction','each','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','emit','addAgents','omit','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','stack','name','send'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xe4b8,0x179));var _0x8e4b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xe4b8[_0x49b207];return _0x2dc8fa;};'use strict';var pdf=require(_0x8e4b('0x0'));var emlformat=require(_0x8e4b('0x1'));var rimraf=require(_0x8e4b('0x2'));var zipdir=require(_0x8e4b('0x3'));var jsonpatch=require(_0x8e4b('0x4'));var rp=require(_0x8e4b('0x5'));var moment=require(_0x8e4b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8e4b('0x7'));var path=require(_0x8e4b('0x8'));var sox=require(_0x8e4b('0x9'));var csv=require('to-csv');var ejs=require(_0x8e4b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8e4b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e4b('0xc'));var Redis=require('ioredis');var authService=require(_0x8e4b('0xd'));var qs=require(_0x8e4b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e4b('0xf'))(_0x8e4b('0x10'));var utils=require(_0x8e4b('0x11'));var config=require('../../config/environment');var db=require(_0x8e4b('0x12'))['db'];config[_0x8e4b('0x13')]=_[_0x8e4b('0x14')](config[_0x8e4b('0x13')],{'host':_0x8e4b('0x15'),'port':0x18eb});var socket=require(_0x8e4b('0x16'))(new Redis(config[_0x8e4b('0x13')]));require(_0x8e4b('0x17'))['register'](socket);function respondWithStatusCode(_0x5f56fb,_0x2e8e71){_0x2e8e71=_0x2e8e71||0xcc;return function(_0x261e76){if(_0x261e76){return _0x5f56fb[_0x8e4b('0x18')](_0x2e8e71);}return _0x5f56fb[_0x8e4b('0x19')](_0x2e8e71)[_0x8e4b('0x1a')]();};}function respondWithResult(_0x4d10fd,_0x4b0197){_0x4b0197=_0x4b0197||0xc8;return function(_0xfff6b){if(_0xfff6b){return _0x4d10fd['status'](_0x4b0197)['json'](_0xfff6b);}};}function respondWithFilteredResult(_0x417e71,_0x572c0f){return function(_0x38cbf5){if(_0x38cbf5){var _0x512c2a=_0x38cbf5['count'],_0x444c19=_0x572c0f[_0x8e4b('0x1b')],_0x139118=_0x572c0f[_0x8e4b('0x1b')]+_0x572c0f[_0x8e4b('0x1c')],_0x4b2458;if(_0x139118>=_0x512c2a){_0x139118=_0x512c2a;_0x4b2458=0xc8;}else{_0x4b2458=0xce;}_0x417e71[_0x8e4b('0x19')](_0x4b2458);return _0x417e71[_0x8e4b('0x1d')](_0x8e4b('0x1e'),_0x444c19+'-'+_0x139118+'/'+_0x512c2a)[_0x8e4b('0x1f')](_0x38cbf5);}return null;};}function patchUpdates(_0x27f816){return function(_0x9eeb68){try{jsonpatch[_0x8e4b('0x20')](_0x9eeb68,_0x27f816,!![]);}catch(_0x123017){return BPromise[_0x8e4b('0x21')](_0x123017);}return _0x9eeb68['save']();};}function saveUpdates(_0xa4c5ad,_0x16ff18){return function(_0x5f3043){if(_0x5f3043){return _0x5f3043[_0x8e4b('0x22')](_0xa4c5ad)[_0x8e4b('0x23')](function(_0x54b17e){return _0x54b17e;});}return null;};}function removeEntity(_0x2bd4e7,_0x719300){return function(_0x5e8915){if(_0x5e8915){return _0x5e8915[_0x8e4b('0x24')]()[_0x8e4b('0x23')](function(){var _0x56597d=_0x5e8915[_0x8e4b('0x25')]({'plain':!![]});var _0x2b29a4=_0x8e4b('0x26');return db[_0x8e4b('0x27')][_0x8e4b('0x24')]({'where':{'type':_0x2b29a4,'resourceId':_0x56597d['id']}})[_0x8e4b('0x23')](function(){return _0x5e8915;});})['then'](function(){_0x2bd4e7[_0x8e4b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7126,_0x1f9aba){return function(_0x10e08c){if(!_0x10e08c){_0x4f7126['sendStatus'](0x194);}return _0x10e08c;};}function handleError(_0x1f1aa2,_0x546133){_0x546133=_0x546133||0x1f4;return function(_0x6d7fbd){logger['error'](_0x6d7fbd[_0x8e4b('0x28')]);if(_0x6d7fbd[_0x8e4b('0x29')]){delete _0x6d7fbd[_0x8e4b('0x29')];}_0x1f1aa2[_0x8e4b('0x19')](_0x546133)[_0x8e4b('0x2a')](_0x6d7fbd);};}exports[_0x8e4b('0x2b')]=function(_0x2924c1,_0x3573d8){var _0x4f823c={},_0x5d1b05={},_0x2661f7={'count':0x0,'rows':[]};var _0x309dc0=db[_0x8e4b('0x2c')][_0x8e4b('0x2d')];_0x5d1b05[_0x8e4b('0x2e')]=_[_0x8e4b('0x2f')](_0x309dc0);_0x5d1b05[_0x8e4b('0x30')]=_[_0x8e4b('0x2f')](_0x2924c1['query']);_0x5d1b05[_0x8e4b('0x31')]=_[_0x8e4b('0x32')](_0x5d1b05[_0x8e4b('0x2e')],_0x5d1b05[_0x8e4b('0x30')]);_0x4f823c[_0x8e4b('0x33')]=_['intersection'](_0x5d1b05[_0x8e4b('0x2e')],qs[_0x8e4b('0x34')](_0x2924c1[_0x8e4b('0x30')][_0x8e4b('0x34')]));_0x4f823c[_0x8e4b('0x33')]=_0x4f823c[_0x8e4b('0x33')][_0x8e4b('0x35')]?_0x4f823c[_0x8e4b('0x33')]:_0x5d1b05['model'];if(!_0x2924c1[_0x8e4b('0x30')][_0x8e4b('0x36')](_0x8e4b('0x37'))){_0x4f823c[_0x8e4b('0x1c')]=qs[_0x8e4b('0x1c')](_0x2924c1[_0x8e4b('0x30')][_0x8e4b('0x1c')]);_0x4f823c[_0x8e4b('0x1b')]=qs[_0x8e4b('0x1b')](_0x2924c1[_0x8e4b('0x30')][_0x8e4b('0x1b')]);}_0x4f823c[_0x8e4b('0x38')]=qs[_0x8e4b('0x39')](_0x2924c1['query'][_0x8e4b('0x39')]);_0x4f823c['where']=qs[_0x8e4b('0x31')](_[_0x8e4b('0x3a')](_0x2924c1['query'],_0x5d1b05[_0x8e4b('0x31')]));if(_0x2924c1['query'][_0x8e4b('0x3b')]){_0x4f823c[_0x8e4b('0x3c')]=_[_0x8e4b('0x3d')](_0x4f823c[_0x8e4b('0x3c')],{'$or':_[_0x8e4b('0x3e')](_0x309dc0,function(_0x48f96a){if(_0x48f96a['type'][_0x8e4b('0x3f')]!==_0x8e4b('0x40')){var _0xa89e8={};_0xa89e8[_0x48f96a[_0x8e4b('0x41')]]={'$like':'%'+_0x2924c1[_0x8e4b('0x30')][_0x8e4b('0x3b')]+'%'};return _0xa89e8;}})});}_0x4f823c=_[_0x8e4b('0x3d')]({},_0x4f823c,_0x2924c1['options']);var _0x34870d={'where':_0x4f823c['where']};return db[_0x8e4b('0x2c')]['count'](_0x34870d)[_0x8e4b('0x23')](function(_0x504ece){_0x2661f7[_0x8e4b('0x42')]=_0x504ece;if(_0x2924c1['query'][_0x8e4b('0x43')]){_0x4f823c[_0x8e4b('0x44')]=[{'all':!![]}];}return db[_0x8e4b('0x2c')][_0x8e4b('0x45')](_0x4f823c);})['then'](function(_0x13d68c){_0x2661f7[_0x8e4b('0x46')]=_0x13d68c;return _0x2661f7;})[_0x8e4b('0x23')](respondWithFilteredResult(_0x3573d8,_0x4f823c))[_0x8e4b('0x47')](handleError(_0x3573d8,null));};exports[_0x8e4b('0x48')]=function(_0x2a850f,_0x1b8493){var _0x3115e1={'raw':!![],'where':{'id':_0x2a850f[_0x8e4b('0x49')]['id']}},_0x456e1d={};_0x456e1d[_0x8e4b('0x2e')]=_['keys'](db[_0x8e4b('0x2c')][_0x8e4b('0x2d')]);_0x456e1d[_0x8e4b('0x30')]=_[_0x8e4b('0x2f')](_0x2a850f[_0x8e4b('0x30')]);_0x456e1d[_0x8e4b('0x31')]=_[_0x8e4b('0x32')](_0x456e1d['model'],_0x456e1d[_0x8e4b('0x30')]);_0x3115e1[_0x8e4b('0x33')]=_[_0x8e4b('0x32')](_0x456e1d[_0x8e4b('0x2e')],qs[_0x8e4b('0x34')](_0x2a850f[_0x8e4b('0x30')][_0x8e4b('0x34')]));_0x3115e1[_0x8e4b('0x33')]=_0x3115e1[_0x8e4b('0x33')][_0x8e4b('0x35')]?_0x3115e1[_0x8e4b('0x33')]:_0x456e1d[_0x8e4b('0x2e')];if(_0x2a850f[_0x8e4b('0x30')][_0x8e4b('0x43')]){_0x3115e1[_0x8e4b('0x44')]=[{'all':!![]}];}_0x3115e1=_[_0x8e4b('0x3d')]({},_0x3115e1,_0x2a850f[_0x8e4b('0x4a')]);return db[_0x8e4b('0x2c')][_0x8e4b('0x4b')](_0x3115e1)[_0x8e4b('0x23')](handleEntityNotFound(_0x1b8493,null))[_0x8e4b('0x23')](respondWithResult(_0x1b8493,null))[_0x8e4b('0x47')](handleError(_0x1b8493,null));};exports['create']=function(_0x2c56bb,_0x282ad4){return db[_0x8e4b('0x2c')][_0x8e4b('0x4c')](_0x2c56bb[_0x8e4b('0x4d')],{})[_0x8e4b('0x23')](function(_0x3b7447){var _0x36a554=_0x2c56bb[_0x8e4b('0x4e')][_0x8e4b('0x25')]({'plain':!![]});if(!_0x36a554)throw new Error(_0x8e4b('0x4f'));if(_0x36a554[_0x8e4b('0x50')]==='user'){var _0x3cd943=_0x3b7447[_0x8e4b('0x25')]({'plain':!![]});var _0x163bfc=_0x8e4b('0x26');return db['UserProfileSection'][_0x8e4b('0x4b')]({'where':{'name':_0x163bfc,'userProfileId':_0x36a554[_0x8e4b('0x51')]},'raw':!![]})[_0x8e4b('0x23')](function(_0x589a3e){if(_0x589a3e&&_0x589a3e[_0x8e4b('0x52')]===0x0){return db[_0x8e4b('0x27')][_0x8e4b('0x4c')]({'name':_0x3cd943[_0x8e4b('0x29')],'resourceId':_0x3cd943['id'],'type':_0x589a3e[_0x8e4b('0x29')],'sectionId':_0x589a3e['id']},{})[_0x8e4b('0x23')](function(){return _0x3b7447;});}else{return _0x3b7447;}})[_0x8e4b('0x47')](function(_0x5eea7c){logger[_0x8e4b('0x53')](_0x8e4b('0x54'),_0x5eea7c);throw _0x5eea7c;});}return _0x3b7447;})[_0x8e4b('0x23')](respondWithResult(_0x282ad4,0xc9))[_0x8e4b('0x47')](handleError(_0x282ad4,null));};exports[_0x8e4b('0x22')]=function(_0x3ec0c8,_0x46315f){if(_0x3ec0c8['body']['id']){delete _0x3ec0c8[_0x8e4b('0x4d')]['id'];}return db[_0x8e4b('0x2c')][_0x8e4b('0x4b')]({'where':{'id':_0x3ec0c8[_0x8e4b('0x49')]['id']}})[_0x8e4b('0x23')](handleEntityNotFound(_0x46315f,null))[_0x8e4b('0x23')](saveUpdates(_0x3ec0c8['body'],null))['then'](respondWithResult(_0x46315f,null))['catch'](handleError(_0x46315f,null));};exports['destroy']=function(_0x3d2434,_0x210a97){return db[_0x8e4b('0x2c')][_0x8e4b('0x4b')]({'where':{'id':_0x3d2434['params']['id']}})['then'](handleEntityNotFound(_0x210a97,null))[_0x8e4b('0x23')](removeEntity(_0x210a97,null))[_0x8e4b('0x47')](handleError(_0x210a97,null));};exports[_0x8e4b('0x55')]=function(_0x118f7c,_0x3e4096){return db['SmsQueue'][_0x8e4b('0x55')]()['then'](respondWithResult(_0x3e4096,null))['catch'](handleError(_0x3e4096,null));};exports['getMembers']=function(_0x59209e,_0x2d29ad,_0x439386){var _0x2cb445={'raw':!![],'where':{}},_0x2d1410={},_0x185b62;return db['SmsQueue'][_0x8e4b('0x56')]({'where':{'id':_0x59209e['params']['id']}})[_0x8e4b('0x23')](handleEntityNotFound(_0x2d29ad,null))[_0x8e4b('0x23')](function(_0x592836){if(_0x592836){_0x185b62=_0x592836[_0x8e4b('0x25')]({'plain':!![]});_0x2d1410['model']=_['keys'](db[_0x8e4b('0x57')]['rawAttributes']);_0x2d1410[_0x8e4b('0x30')]=_[_0x8e4b('0x2f')](_0x59209e['query']);_0x2d1410[_0x8e4b('0x31')]=_[_0x8e4b('0x32')](_0x2d1410[_0x8e4b('0x2e')],_0x2d1410[_0x8e4b('0x30')]);_0x2cb445[_0x8e4b('0x33')]=_[_0x8e4b('0x32')](_0x2d1410[_0x8e4b('0x2e')],qs[_0x8e4b('0x34')](_0x59209e[_0x8e4b('0x30')][_0x8e4b('0x34')]));_0x2cb445[_0x8e4b('0x33')]=_0x2cb445[_0x8e4b('0x33')]['length']?_0x2cb445[_0x8e4b('0x33')]:_0x2d1410['model'];if(!_0x59209e['query'][_0x8e4b('0x36')]('nolimit')){_0x2cb445['limit']=qs[_0x8e4b('0x1c')](_0x59209e['query'][_0x8e4b('0x1c')]);_0x2cb445[_0x8e4b('0x1b')]=qs[_0x8e4b('0x1b')](_0x59209e[_0x8e4b('0x30')][_0x8e4b('0x1b')]);}_0x2cb445['order']=qs['sort'](_0x59209e[_0x8e4b('0x30')][_0x8e4b('0x39')]);_0x2cb445['where']=qs[_0x8e4b('0x31')](_[_0x8e4b('0x3a')](_0x59209e[_0x8e4b('0x30')],_0x2d1410['filters']));_0x2cb445[_0x8e4b('0x3c')][_0x8e4b('0x58')]=_0x592836['id'];if(_0x59209e['query'][_0x8e4b('0x3b')]){_0x2cb445[_0x8e4b('0x3c')]=_[_0x8e4b('0x3d')](_0x2cb445[_0x8e4b('0x3c')],{'$or':_[_0x8e4b('0x3e')](_0x2cb445['attributes'],function(_0x4b8a97){var _0xc987bf={};_0xc987bf[_0x4b8a97]={'$like':'%'+_0x59209e['query'][_0x8e4b('0x3b')]+'%'};return _0xc987bf;})});}_0x2cb445=_['merge']({},_0x2cb445,_0x59209e[_0x8e4b('0x4a')]);return db['UserSmsQueue'][_0x8e4b('0x45')](_0x2cb445);}})[_0x8e4b('0x23')](function(_0xdb82d7){if(_0xdb82d7){return db['User'][_0x8e4b('0x59')]({'where':{'id':_[_0x8e4b('0x3e')](_0xdb82d7,_0x8e4b('0x5a')),'role':_0x8e4b('0x5b')},'attributes':['id',_0x8e4b('0x29'),_0x8e4b('0x5c'),_0x8e4b('0x5d'),_0x8e4b('0x5e')]});}})[_0x8e4b('0x23')](function(_0x43b805){if(_0x43b805){return{'count':_0x43b805[_0x8e4b('0x42')],'rows':_[_0x8e4b('0x3e')](_0x43b805['rows'],function(_0x53d08f){return{'membername':_0x53d08f['name'],'UserId':_0x53d08f['id'],'queue_name':_0x185b62[_0x8e4b('0x29')],'SmsQueueId':_0x185b62['id'],'interface':util[_0x8e4b('0x5f')](_0x8e4b('0x60'),_0x8e4b('0x61'),_0x53d08f[_0x8e4b('0x29')]),'penalty':0x0,'paused':_0x53d08f[_0x8e4b('0x5c')],'createdAt':_0x53d08f[_0x8e4b('0x5e')],'updatedAt':_0x53d08f[_0x8e4b('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d29ad,_0x2cb445))[_0x8e4b('0x47')](handleError(_0x2d29ad,null));};exports[_0x8e4b('0x62')]=function(_0x58558e,_0x5d350b,_0x4abb5c){var _0x180dec={};var _0x59bf37={};var _0x5e0365;var _0x47ef4b;return db[_0x8e4b('0x2c')]['findOne']({'where':{'id':_0x58558e['params']['id']}})[_0x8e4b('0x23')](handleEntityNotFound(_0x5d350b,null))[_0x8e4b('0x23')](function(_0x5e20c9){if(_0x5e20c9){_0x5e0365=_0x5e20c9;_0x59bf37[_0x8e4b('0x2e')]=_[_0x8e4b('0x2f')](db[_0x8e4b('0x63')][_0x8e4b('0x2d')]);_0x59bf37[_0x8e4b('0x30')]=_[_0x8e4b('0x2f')](_0x58558e['query']);_0x59bf37[_0x8e4b('0x31')]=_['intersection'](_0x59bf37[_0x8e4b('0x2e')],_0x59bf37[_0x8e4b('0x30')]);_0x180dec[_0x8e4b('0x33')]=_[_0x8e4b('0x32')](_0x59bf37['model'],qs[_0x8e4b('0x34')](_0x58558e['query']['fields']));_0x180dec[_0x8e4b('0x33')]=_0x180dec[_0x8e4b('0x33')][_0x8e4b('0x35')]?_0x180dec[_0x8e4b('0x33')]:_0x59bf37[_0x8e4b('0x2e')];_0x180dec[_0x8e4b('0x38')]=qs[_0x8e4b('0x39')](_0x58558e[_0x8e4b('0x30')][_0x8e4b('0x39')]);_0x180dec['where']=qs[_0x8e4b('0x31')](_[_0x8e4b('0x3a')](_0x58558e['query'],_0x59bf37[_0x8e4b('0x31')]));if(_0x58558e[_0x8e4b('0x30')]['filter']){_0x180dec['where']=_[_0x8e4b('0x3d')](_0x180dec[_0x8e4b('0x3c')],{'$or':_[_0x8e4b('0x3e')](_0x180dec[_0x8e4b('0x33')],function(_0x1aaeef){var _0x2d02dd={};_0x2d02dd[_0x1aaeef]={'$like':'%'+_0x58558e[_0x8e4b('0x30')]['filter']+'%'};return _0x2d02dd;})});}_0x180dec=_[_0x8e4b('0x3d')]({},_0x180dec,_0x58558e[_0x8e4b('0x4a')]);return _0x5e0365[_0x8e4b('0x62')](_0x180dec);}})[_0x8e4b('0x23')](function(_0x97e25c){if(_0x97e25c){_0x47ef4b=_0x97e25c['length'];if(!_0x58558e[_0x8e4b('0x30')][_0x8e4b('0x36')]('nolimit')){_0x180dec[_0x8e4b('0x1c')]=qs[_0x8e4b('0x1c')](_0x58558e[_0x8e4b('0x30')]['limit']);_0x180dec[_0x8e4b('0x1b')]=qs[_0x8e4b('0x1b')](_0x58558e[_0x8e4b('0x30')][_0x8e4b('0x1b')]);}return _0x5e0365[_0x8e4b('0x62')](_0x180dec);}})[_0x8e4b('0x23')](function(_0x5946ba){if(_0x5946ba){return _0x5946ba?{'count':_0x47ef4b,'rows':_0x5946ba}:null;}})['then'](respondWithResult(_0x5d350b,null))[_0x8e4b('0x47')](handleError(_0x5d350b,null));};exports[_0x8e4b('0x64')]=function(_0x46234e,_0x370b41,_0x5c3796){var _0xc72f9e=_0x46234e['body'][_0x8e4b('0x65')];return db[_0x8e4b('0x63')][_0x8e4b('0x45')]({'where':{'id':_['map'](_0xc72f9e,'id')},'attributes':['id'],'include':[{'model':db[_0x8e4b('0x66')],'as':_0x8e4b('0x67'),'attributes':['id',_0x8e4b('0x29'),_0x8e4b('0x68'),_0x8e4b('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x56bb90){if(_0x56bb90){var _0x51494a=_['flatMap'](_0x56bb90,function(_0x3fef59){var _0x2e4d5d=_0x3fef59[_0x8e4b('0x25')]({'plain':!![]});return _0x2e4d5d[_0x8e4b('0x67')];});return db[_0x8e4b('0x2c')][_0x8e4b('0x4b')]({'where':{'id':_0x46234e[_0x8e4b('0x49')]['id']}})['then'](function(_0x171bb2){return db[_0x8e4b('0x6a')][_0x8e4b('0x6b')](function(_0x1b0465){return _0x171bb2[_0x8e4b('0x64')](_[_0x8e4b('0x3e')](_0xc72f9e,'id'),{'transaction':_0x1b0465})[_0x8e4b('0x23')](function(){return BPromise[_0x8e4b('0x6c')](_0x51494a,function(_0x7f3911){return db[_0x8e4b('0x57')]['findOrCreate']({'where':{'UserId':_0x7f3911['id'],'SmsQueueId':_0x46234e[_0x8e4b('0x49')]['id']},'transaction':_0x1b0465});});})[_0x8e4b('0x23')](function(){_0x51494a['forEach'](function(_0x47c53c){socket['emit'](_0x8e4b('0x6d'),{'UserId':_0x47c53c['id'],'SmsQueueId':_0x171bb2['id']});});});});});}})[_0x8e4b('0x23')](respondWithStatusCode(_0x370b41,null))[_0x8e4b('0x47')](handleError(_0x370b41,null));};exports[_0x8e4b('0x6e')]=function(_0x533df4,_0x3d157f,_0x3cccbc){return db[_0x8e4b('0x63')][_0x8e4b('0x45')]({'where':{'id':_0x533df4[_0x8e4b('0x30')][_0x8e4b('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x8e4b('0x66')],'as':_0x8e4b('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d157f,null))[_0x8e4b('0x23')](function(_0x5e271a){var _0x4cfdac=_[_0x8e4b('0x3e')](_0x5e271a,'id');var _0x31a75b=[];var _0x4e2f8c=[];var _0x90f1d5=squel[_0x8e4b('0x70')]();_0x90f1d5[_0x8e4b('0x41')](_0x8e4b('0x71'))[_0x8e4b('0x72')](_0x8e4b('0x73'),'tq')[_0x8e4b('0x74')](_0x8e4b('0x75'),'ut',_0x8e4b('0x76'))[_0x8e4b('0x3c')](_0x8e4b('0x77'),_0x533df4['params']['id']);for(var _0x2bc6ef=0x0;_0x2bc6ef<_0x5e271a[_0x8e4b('0x35')];_0x2bc6ef+=0x1){let _0x55a766=_0x5e271a[_0x2bc6ef];for(var _0x480075=0x0;_0x480075<_0x55a766['Agents'][_0x8e4b('0x35')];_0x480075+=0x1){let _0x3816e5=_0x55a766[_0x8e4b('0x67')][_0x480075];var _0x1296bb=_0x90f1d5[_0x8e4b('0x78')]();_0x1296bb[_0x8e4b('0x3c')]('ut.UserId\x20=\x20?',_0x3816e5['id']);_0x4e2f8c[_0x8e4b('0x79')](db['sequelize']['query'](_0x1296bb[_0x8e4b('0x7a')](),{'type':db[_0x8e4b('0x6a')][_0x8e4b('0x7b')][_0x8e4b('0x7c')]})['then'](function(_0x1377e9){if(_0x1377e9[_0x8e4b('0x35')]===0x1){return _0x3816e5['id'];}else{var _0x13a646=_[_0x8e4b('0x7d')](_['map'](_0x1377e9,_0x8e4b('0x7e')),function(_0x2c1932){return _[_0x8e4b('0x7f')](_0x4cfdac,_0x2c1932);});if(_0x13a646){return _0x3816e5['id'];}}}));}}return BPromise['all'](_0x4e2f8c)[_0x8e4b('0x23')](function(_0x154c77){_0x31a75b=_(_0x31a75b)[_0x8e4b('0x80')](_0x154c77)[_0x8e4b('0x81')]()[_0x8e4b('0x82')]();return db[_0x8e4b('0x2c')]['find']({'where':{'id':_0x533df4[_0x8e4b('0x49')]['id']}})[_0x8e4b('0x23')](function(_0xd534c0){return db[_0x8e4b('0x6a')][_0x8e4b('0x6b')](function(_0x29e558){return _0xd534c0[_0x8e4b('0x6e')](_0x533df4['query'][_0x8e4b('0x6f')],{'transaction':_0x29e558})[_0x8e4b('0x23')](function(){if(!_[_0x8e4b('0x83')](_0x31a75b)){return _0xd534c0[_0x8e4b('0x84')](_0x31a75b,{'transaction':_0x29e558});}})[_0x8e4b('0x23')](function(){_0x31a75b[_0x8e4b('0x85')](function(_0x27bcf5){socket[_0x8e4b('0x86')]('userSmsQueue:remove',{'UserId':_0x27bcf5,'SmsQueueId':_0xd534c0['id']});});});});});});})[_0x8e4b('0x23')](respondWithStatusCode(_0x3d157f,null))[_0x8e4b('0x47')](handleError(_0x3d157f,null));};exports[_0x8e4b('0x87')]=function(_0x4521bf,_0x311970,_0x39249f){return db[_0x8e4b('0x2c')][_0x8e4b('0x4b')]({'where':{'id':_0x4521bf[_0x8e4b('0x49')]['id']}})[_0x8e4b('0x23')](handleEntityNotFound(_0x311970,null))[_0x8e4b('0x23')](function(_0x27bb6f){if(_0x27bb6f){return _0x27bb6f[_0x8e4b('0x87')](_0x4521bf['body'][_0x8e4b('0x6f')],_[_0x8e4b('0x88')](_0x4521bf[_0x8e4b('0x4d')],['ids','id'])||{})['spread'](function(_0x24d517){for(var _0xdc0210=0x0;_0xdc0210<_0x4521bf[_0x8e4b('0x4d')][_0x8e4b('0x6f')][_0x8e4b('0x35')];_0xdc0210+=0x1){socket[_0x8e4b('0x86')](_0x8e4b('0x6d'),{'UserId':_0x4521bf[_0x8e4b('0x4d')][_0x8e4b('0x6f')][_0xdc0210],'SmsQueueId':_0x4521bf[_0x8e4b('0x49')]['id']});}return _0x24d517;});}})[_0x8e4b('0x23')](respondWithResult(_0x311970,null))['catch'](handleError(_0x311970,null));};exports[_0x8e4b('0x84')]=function(_0x572d46,_0x456247,_0xff5ba1){return db[_0x8e4b('0x2c')][_0x8e4b('0x4b')]({'where':{'id':_0x572d46[_0x8e4b('0x49')]['id']}})['then'](handleEntityNotFound(_0x456247,null))['then'](function(_0x20f67b){if(_0x20f67b){return _0x20f67b[_0x8e4b('0x84')](_0x572d46[_0x8e4b('0x30')][_0x8e4b('0x6f')])[_0x8e4b('0x23')](function(){if(_[_0x8e4b('0x89')](_0x572d46[_0x8e4b('0x30')]['ids'])){for(var _0x58a5f6=0x0;_0x58a5f6<_0x572d46[_0x8e4b('0x30')]['ids'][_0x8e4b('0x35')];_0x58a5f6+=0x1){socket['emit'](_0x8e4b('0x8a'),{'UserId':Number(_0x572d46[_0x8e4b('0x30')]['ids'][_0x58a5f6]),'SmsQueueId':Number(_0x572d46[_0x8e4b('0x49')]['id'])});}}else{socket['emit'](_0x8e4b('0x8a'),{'UserId':Number(_0x572d46['query'][_0x8e4b('0x6f')]),'SmsQueueId':Number(_0x572d46[_0x8e4b('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x456247,null))[_0x8e4b('0x47')](handleError(_0x456247,null));};exports[_0x8e4b('0x8b')]=function(_0x2e8e24,_0x21af88,_0x4670b2){var _0x3b9cae={};var _0x3fd459={};var _0x271c8a;var _0x28d5d2;return db['SmsQueue'][_0x8e4b('0x56')]({'where':{'id':_0x2e8e24['params']['id']}})['then'](handleEntityNotFound(_0x21af88,null))[_0x8e4b('0x23')](function(_0x5bd89d){if(_0x5bd89d){_0x271c8a=_0x5bd89d;_0x3fd459[_0x8e4b('0x2e')]=_[_0x8e4b('0x2f')](db['User'][_0x8e4b('0x2d')]);_0x3fd459[_0x8e4b('0x30')]=_['keys'](_0x2e8e24[_0x8e4b('0x30')]);_0x3fd459[_0x8e4b('0x31')]=_[_0x8e4b('0x32')](_0x3fd459[_0x8e4b('0x2e')],_0x3fd459['query']);_0x3b9cae['attributes']=_[_0x8e4b('0x32')](_0x3fd459[_0x8e4b('0x2e')],qs[_0x8e4b('0x34')](_0x2e8e24['query']['fields']));_0x3b9cae[_0x8e4b('0x33')]=_0x3b9cae[_0x8e4b('0x33')][_0x8e4b('0x35')]?_0x3b9cae[_0x8e4b('0x33')]:_0x3fd459[_0x8e4b('0x2e')];_0x3b9cae[_0x8e4b('0x38')]=qs[_0x8e4b('0x39')](_0x2e8e24[_0x8e4b('0x30')][_0x8e4b('0x39')]);_0x3b9cae['where']=qs[_0x8e4b('0x31')](_[_0x8e4b('0x3a')](_0x2e8e24['query'],_0x3fd459[_0x8e4b('0x31')]));if(_0x2e8e24['query'][_0x8e4b('0x3b')]){_0x3b9cae[_0x8e4b('0x3c')]=_['merge'](_0x3b9cae[_0x8e4b('0x3c')],{'$or':_[_0x8e4b('0x3e')](_0x3b9cae[_0x8e4b('0x33')],function(_0x10d149){var _0xa7e796={};_0xa7e796[_0x10d149]={'$like':'%'+_0x2e8e24[_0x8e4b('0x30')]['filter']+'%'};return _0xa7e796;})});}_0x3b9cae=_['merge']({},_0x3b9cae,_0x2e8e24[_0x8e4b('0x4a')]);return _0x271c8a[_0x8e4b('0x8b')](_0x3b9cae);}})[_0x8e4b('0x23')](function(_0x76df15){if(_0x76df15){_0x28d5d2=_0x76df15['length'];if(!_0x2e8e24['query'][_0x8e4b('0x36')](_0x8e4b('0x37'))){_0x3b9cae[_0x8e4b('0x1c')]=qs[_0x8e4b('0x1c')](_0x2e8e24['query'][_0x8e4b('0x1c')]);_0x3b9cae[_0x8e4b('0x1b')]=qs[_0x8e4b('0x1b')](_0x2e8e24[_0x8e4b('0x30')]['offset']);}return _0x271c8a['getAgents'](_0x3b9cae);}})[_0x8e4b('0x23')](function(_0x8bb5a9){if(_0x8bb5a9){return _0x8bb5a9?{'count':_0x28d5d2,'rows':_0x8bb5a9}:null;}})[_0x8e4b('0x23')](respondWithResult(_0x21af88,null))[_0x8e4b('0x47')](handleError(_0x21af88,null));}; \ No newline at end of file +var _0xff16=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','status','end','count','offset','limit','set','json','apply','reject','save','then','destroy','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','map','key','VIRTUAL','options','SmsQueue','findAll','rows','catch','params','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','nolimit','User','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','teams','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','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','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xff16,0x7f));var _0x6ff1=function(_0x191381,_0x4e0396){_0x191381=_0x191381-0x0;var _0x1e0221=_0xff16[_0x191381];return _0x1e0221;};'use strict';var pdf=require(_0x6ff1('0x0'));var emlformat=require(_0x6ff1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ff1('0x2'));var jsonpatch=require(_0x6ff1('0x3'));var rp=require(_0x6ff1('0x4'));var moment=require(_0x6ff1('0x5'));var BPromise=require(_0x6ff1('0x6'));var Mustache=require(_0x6ff1('0x7'));var util=require(_0x6ff1('0x8'));var path=require(_0x6ff1('0x9'));var sox=require('sox');var csv=require(_0x6ff1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ff1('0xb'));var squel=require(_0x6ff1('0xc'));var crypto=require(_0x6ff1('0xd'));var jsforce=require(_0x6ff1('0xe'));var deskjs=require(_0x6ff1('0xf'));var toCsv=require(_0x6ff1('0xa'));var querystring=require(_0x6ff1('0x10'));var Papa=require(_0x6ff1('0x11'));var Redis=require('ioredis');var authService=require(_0x6ff1('0x12'));var qs=require(_0x6ff1('0x13'));var hardwareService=require(_0x6ff1('0x14'));var logger=require(_0x6ff1('0x15'))(_0x6ff1('0x16'));var utils=require(_0x6ff1('0x17'));var config=require(_0x6ff1('0x18'));var db=require(_0x6ff1('0x19'))['db'];config[_0x6ff1('0x1a')]=_[_0x6ff1('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ff1('0x1c'))(new Redis(config['redis']));require(_0x6ff1('0x1d'))[_0x6ff1('0x1e')](socket);function respondWithStatusCode(_0x1451af,_0x543e07){_0x543e07=_0x543e07||0xcc;return function(_0x58952d){if(_0x58952d){return _0x1451af['sendStatus'](_0x543e07);}return _0x1451af[_0x6ff1('0x1f')](_0x543e07)[_0x6ff1('0x20')]();};}function respondWithResult(_0x23112d,_0x29e6c7){_0x29e6c7=_0x29e6c7||0xc8;return function(_0x36fa15){if(_0x36fa15){return _0x23112d[_0x6ff1('0x1f')](_0x29e6c7)['json'](_0x36fa15);}};}function respondWithFilteredResult(_0x155d26,_0x2b4142){return function(_0x4751b9){if(_0x4751b9){var _0x146c75=_0x4751b9[_0x6ff1('0x21')],_0xe5d26e=_0x2b4142[_0x6ff1('0x22')],_0x3ac8f8=_0x2b4142[_0x6ff1('0x22')]+_0x2b4142[_0x6ff1('0x23')],_0x5041d7;if(_0x3ac8f8>=_0x146c75){_0x3ac8f8=_0x146c75;_0x5041d7=0xc8;}else{_0x5041d7=0xce;}_0x155d26[_0x6ff1('0x1f')](_0x5041d7);return _0x155d26[_0x6ff1('0x24')]('Content-Range',_0xe5d26e+'-'+_0x3ac8f8+'/'+_0x146c75)[_0x6ff1('0x25')](_0x4751b9);}return null;};}function patchUpdates(_0x54c961){return function(_0x328325){try{jsonpatch[_0x6ff1('0x26')](_0x328325,_0x54c961,!![]);}catch(_0x2d3131){return BPromise[_0x6ff1('0x27')](_0x2d3131);}return _0x328325[_0x6ff1('0x28')]();};}function saveUpdates(_0x47fd1f,_0x56027f){return function(_0x561bcd){if(_0x561bcd){return _0x561bcd['update'](_0x47fd1f)[_0x6ff1('0x29')](function(_0xbdd73e){return _0xbdd73e;});}return null;};}function removeEntity(_0x4b3d22,_0x41b160){return function(_0x1ec4f1){if(_0x1ec4f1){return _0x1ec4f1[_0x6ff1('0x2a')]()[_0x6ff1('0x29')](function(){var _0x35f395=_0x1ec4f1['get']({'plain':!![]});var _0x13acb3=_0x6ff1('0x2b');return db[_0x6ff1('0x2c')]['destroy']({'where':{'type':_0x13acb3,'resourceId':_0x35f395['id']}})['then'](function(){return _0x1ec4f1;});})[_0x6ff1('0x29')](function(){_0x4b3d22[_0x6ff1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfda3d8,_0xc46904){return function(_0x5cc00f){if(!_0x5cc00f){_0xfda3d8[_0x6ff1('0x2d')](0x194);}return _0x5cc00f;};}function handleError(_0x3b9d53,_0x492973){_0x492973=_0x492973||0x1f4;return function(_0x3cc69e){logger[_0x6ff1('0x2e')](_0x3cc69e[_0x6ff1('0x2f')]);if(_0x3cc69e[_0x6ff1('0x30')]){delete _0x3cc69e['name'];}_0x3b9d53[_0x6ff1('0x1f')](_0x492973)[_0x6ff1('0x31')](_0x3cc69e);};}exports[_0x6ff1('0x32')]=function(_0x4683c6,_0x224967){var _0x597278={},_0xfd1863={},_0x28cfd8={'count':0x0,'rows':[]};var _0x105a27=db['SmsQueue'][_0x6ff1('0x33')];_0xfd1863['model']=_[_0x6ff1('0x34')](_0x105a27);_0xfd1863[_0x6ff1('0x35')]=_[_0x6ff1('0x34')](_0x4683c6[_0x6ff1('0x35')]);_0xfd1863[_0x6ff1('0x36')]=_[_0x6ff1('0x37')](_0xfd1863[_0x6ff1('0x38')],_0xfd1863['query']);_0x597278['attributes']=_[_0x6ff1('0x37')](_0xfd1863[_0x6ff1('0x38')],qs[_0x6ff1('0x39')](_0x4683c6[_0x6ff1('0x35')][_0x6ff1('0x39')]));_0x597278[_0x6ff1('0x3a')]=_0x597278['attributes'][_0x6ff1('0x3b')]?_0x597278[_0x6ff1('0x3a')]:_0xfd1863[_0x6ff1('0x38')];if(!_0x4683c6['query'][_0x6ff1('0x3c')]('nolimit')){_0x597278[_0x6ff1('0x23')]=qs['limit'](_0x4683c6[_0x6ff1('0x35')][_0x6ff1('0x23')]);_0x597278['offset']=qs['offset'](_0x4683c6['query'][_0x6ff1('0x22')]);}_0x597278[_0x6ff1('0x3d')]=qs[_0x6ff1('0x3e')](_0x4683c6[_0x6ff1('0x35')][_0x6ff1('0x3e')]);_0x597278['where']=qs[_0x6ff1('0x36')](_['pick'](_0x4683c6[_0x6ff1('0x35')],_0xfd1863['filters']));if(_0x4683c6['query'][_0x6ff1('0x3f')]){_0x597278[_0x6ff1('0x40')]=_[_0x6ff1('0x41')](_0x597278[_0x6ff1('0x40')],{'$or':_[_0x6ff1('0x42')](_0x105a27,function(_0x136d08){if(_0x136d08['type'][_0x6ff1('0x43')]!==_0x6ff1('0x44')){var _0x589890={};_0x589890[_0x136d08['field']]={'$like':'%'+_0x4683c6[_0x6ff1('0x35')]['filter']+'%'};return _0x589890;}})});}_0x597278=_[_0x6ff1('0x41')]({},_0x597278,_0x4683c6[_0x6ff1('0x45')]);var _0x44bf61={'where':_0x597278[_0x6ff1('0x40')]};return db[_0x6ff1('0x46')][_0x6ff1('0x21')](_0x44bf61)['then'](function(_0x4979a5){_0x28cfd8[_0x6ff1('0x21')]=_0x4979a5;if(_0x4683c6['query']['includeAll']){_0x597278['include']=[{'all':!![]}];}return db[_0x6ff1('0x46')][_0x6ff1('0x47')](_0x597278);})[_0x6ff1('0x29')](function(_0x5f7999){_0x28cfd8[_0x6ff1('0x48')]=_0x5f7999;return _0x28cfd8;})[_0x6ff1('0x29')](respondWithFilteredResult(_0x224967,_0x597278))[_0x6ff1('0x49')](handleError(_0x224967,null));};exports['show']=function(_0x3f76c6,_0x2a2df6){var _0x1d8793={'raw':!![],'where':{'id':_0x3f76c6[_0x6ff1('0x4a')]['id']}},_0x30d281={};_0x30d281['model']=_[_0x6ff1('0x34')](db[_0x6ff1('0x46')][_0x6ff1('0x33')]);_0x30d281[_0x6ff1('0x35')]=_[_0x6ff1('0x34')](_0x3f76c6[_0x6ff1('0x35')]);_0x30d281['filters']=_[_0x6ff1('0x37')](_0x30d281[_0x6ff1('0x38')],_0x30d281['query']);_0x1d8793[_0x6ff1('0x3a')]=_['intersection'](_0x30d281[_0x6ff1('0x38')],qs[_0x6ff1('0x39')](_0x3f76c6[_0x6ff1('0x35')][_0x6ff1('0x39')]));_0x1d8793['attributes']=_0x1d8793['attributes'][_0x6ff1('0x3b')]?_0x1d8793['attributes']:_0x30d281[_0x6ff1('0x38')];if(_0x3f76c6['query']['includeAll']){_0x1d8793[_0x6ff1('0x4b')]=[{'all':!![]}];}_0x1d8793=_[_0x6ff1('0x41')]({},_0x1d8793,_0x3f76c6[_0x6ff1('0x45')]);return db[_0x6ff1('0x46')]['find'](_0x1d8793)[_0x6ff1('0x29')](handleEntityNotFound(_0x2a2df6,null))['then'](respondWithResult(_0x2a2df6,null))['catch'](handleError(_0x2a2df6,null));};exports[_0x6ff1('0x4c')]=function(_0x2da127,_0x46cc46){return db[_0x6ff1('0x46')][_0x6ff1('0x4c')](_0x2da127[_0x6ff1('0x4d')],{})['then'](function(_0x143492){var _0x4dc16a=_0x2da127[_0x6ff1('0x4e')][_0x6ff1('0x4f')]({'plain':!![]});if(!_0x4dc16a)throw new Error(_0x6ff1('0x50'));if(_0x4dc16a[_0x6ff1('0x51')]==='user'){var _0x5e1b95=_0x143492['get']({'plain':!![]});var _0x32f757=_0x6ff1('0x2b');return db[_0x6ff1('0x52')][_0x6ff1('0x53')]({'where':{'name':_0x32f757,'userProfileId':_0x4dc16a[_0x6ff1('0x54')]},'raw':!![]})[_0x6ff1('0x29')](function(_0x5a2768){if(_0x5a2768&&_0x5a2768['autoAssociation']===0x0){return db['UserProfileResource'][_0x6ff1('0x4c')]({'name':_0x5e1b95[_0x6ff1('0x30')],'resourceId':_0x5e1b95['id'],'type':_0x5a2768[_0x6ff1('0x30')],'sectionId':_0x5a2768['id']},{})[_0x6ff1('0x29')](function(){return _0x143492;});}else{return _0x143492;}})['catch'](function(_0x2275ff){logger[_0x6ff1('0x2e')](_0x6ff1('0x55'),_0x2275ff);throw _0x2275ff;});}return _0x143492;})['then'](respondWithResult(_0x46cc46,0xc9))[_0x6ff1('0x49')](handleError(_0x46cc46,null));};exports[_0x6ff1('0x56')]=function(_0x51a663,_0xd8bd64){if(_0x51a663[_0x6ff1('0x4d')]['id']){delete _0x51a663['body']['id'];}return db[_0x6ff1('0x46')]['find']({'where':{'id':_0x51a663[_0x6ff1('0x4a')]['id']}})[_0x6ff1('0x29')](handleEntityNotFound(_0xd8bd64,null))['then'](saveUpdates(_0x51a663['body'],null))[_0x6ff1('0x29')](respondWithResult(_0xd8bd64,null))[_0x6ff1('0x49')](handleError(_0xd8bd64,null));};exports['destroy']=function(_0x7faf2a,_0x5d10be){return db[_0x6ff1('0x46')][_0x6ff1('0x53')]({'where':{'id':_0x7faf2a[_0x6ff1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d10be,null))[_0x6ff1('0x29')](removeEntity(_0x5d10be,null))[_0x6ff1('0x49')](handleError(_0x5d10be,null));};exports[_0x6ff1('0x57')]=function(_0x36ed1b,_0x46c49c){return db['SmsQueue'][_0x6ff1('0x57')]()[_0x6ff1('0x29')](respondWithResult(_0x46c49c,null))[_0x6ff1('0x49')](handleError(_0x46c49c,null));};exports[_0x6ff1('0x58')]=function(_0x18cd26,_0x175567,_0x588b49){var _0x4dac7a={'raw':!![],'where':{}},_0x5a991a={},_0x4a13be;return db[_0x6ff1('0x46')][_0x6ff1('0x59')]({'where':{'id':_0x18cd26[_0x6ff1('0x4a')]['id']}})[_0x6ff1('0x29')](handleEntityNotFound(_0x175567,null))['then'](function(_0x4a3038){if(_0x4a3038){_0x4a13be=_0x4a3038[_0x6ff1('0x4f')]({'plain':!![]});_0x5a991a[_0x6ff1('0x38')]=_[_0x6ff1('0x34')](db[_0x6ff1('0x5a')][_0x6ff1('0x33')]);_0x5a991a[_0x6ff1('0x35')]=_[_0x6ff1('0x34')](_0x18cd26['query']);_0x5a991a[_0x6ff1('0x36')]=_['intersection'](_0x5a991a[_0x6ff1('0x38')],_0x5a991a[_0x6ff1('0x35')]);_0x4dac7a['attributes']=_[_0x6ff1('0x37')](_0x5a991a['model'],qs[_0x6ff1('0x39')](_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x39')]));_0x4dac7a['attributes']=_0x4dac7a[_0x6ff1('0x3a')][_0x6ff1('0x3b')]?_0x4dac7a[_0x6ff1('0x3a')]:_0x5a991a[_0x6ff1('0x38')];if(!_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x3c')](_0x6ff1('0x5b'))){_0x4dac7a[_0x6ff1('0x23')]=qs['limit'](_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x23')]);_0x4dac7a[_0x6ff1('0x22')]=qs[_0x6ff1('0x22')](_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x22')]);}_0x4dac7a[_0x6ff1('0x3d')]=qs[_0x6ff1('0x3e')](_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x3e')]);_0x4dac7a['where']=qs[_0x6ff1('0x36')](_['pick'](_0x18cd26[_0x6ff1('0x35')],_0x5a991a[_0x6ff1('0x36')]));_0x4dac7a['where']['SmsQueueId']=_0x4a3038['id'];if(_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x3f')]){_0x4dac7a[_0x6ff1('0x40')]=_[_0x6ff1('0x41')](_0x4dac7a[_0x6ff1('0x40')],{'$or':_[_0x6ff1('0x42')](_0x4dac7a[_0x6ff1('0x3a')],function(_0x59d6e2){var _0x3b0807={};_0x3b0807[_0x59d6e2]={'$like':'%'+_0x18cd26[_0x6ff1('0x35')][_0x6ff1('0x3f')]+'%'};return _0x3b0807;})});}_0x4dac7a=_[_0x6ff1('0x41')]({},_0x4dac7a,_0x18cd26['options']);return db[_0x6ff1('0x5a')][_0x6ff1('0x47')](_0x4dac7a);}})['then'](function(_0x4d88b0){if(_0x4d88b0){return db[_0x6ff1('0x5c')]['findAndCountAll']({'where':{'id':_[_0x6ff1('0x42')](_0x4d88b0,_0x6ff1('0x5d')),'role':_0x6ff1('0x5e')},'attributes':['id',_0x6ff1('0x30'),_0x6ff1('0x5f'),'updatedAt',_0x6ff1('0x60')]});}})[_0x6ff1('0x29')](function(_0x35eee9){if(_0x35eee9){return{'count':_0x35eee9['count'],'rows':_[_0x6ff1('0x42')](_0x35eee9['rows'],function(_0xa920b5){return{'membername':_0xa920b5[_0x6ff1('0x30')],'UserId':_0xa920b5['id'],'queue_name':_0x4a13be['name'],'SmsQueueId':_0x4a13be['id'],'interface':util[_0x6ff1('0x61')](_0x6ff1('0x62'),_0x6ff1('0x63'),_0xa920b5['name']),'penalty':0x0,'paused':_0xa920b5[_0x6ff1('0x5f')],'createdAt':_0xa920b5[_0x6ff1('0x60')],'updatedAt':_0xa920b5[_0x6ff1('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ff1('0x29')](respondWithFilteredResult(_0x175567,_0x4dac7a))[_0x6ff1('0x49')](handleError(_0x175567,null));};exports['getTeams']=function(_0x12f3f2,_0x26e4d4,_0x4fd838){var _0x52e4fb={};var _0x4190fe={};var _0x249575;var _0x2c800b;return db[_0x6ff1('0x46')][_0x6ff1('0x59')]({'where':{'id':_0x12f3f2['params']['id']}})[_0x6ff1('0x29')](handleEntityNotFound(_0x26e4d4,null))[_0x6ff1('0x29')](function(_0x3ece3f){if(_0x3ece3f){_0x249575=_0x3ece3f;_0x4190fe[_0x6ff1('0x38')]=_['keys'](db[_0x6ff1('0x65')]['rawAttributes']);_0x4190fe[_0x6ff1('0x35')]=_['keys'](_0x12f3f2[_0x6ff1('0x35')]);_0x4190fe[_0x6ff1('0x36')]=_[_0x6ff1('0x37')](_0x4190fe['model'],_0x4190fe[_0x6ff1('0x35')]);_0x52e4fb[_0x6ff1('0x3a')]=_[_0x6ff1('0x37')](_0x4190fe[_0x6ff1('0x38')],qs[_0x6ff1('0x39')](_0x12f3f2['query'][_0x6ff1('0x39')]));_0x52e4fb['attributes']=_0x52e4fb[_0x6ff1('0x3a')][_0x6ff1('0x3b')]?_0x52e4fb['attributes']:_0x4190fe[_0x6ff1('0x38')];_0x52e4fb[_0x6ff1('0x3d')]=qs[_0x6ff1('0x3e')](_0x12f3f2[_0x6ff1('0x35')]['sort']);_0x52e4fb[_0x6ff1('0x40')]=qs[_0x6ff1('0x36')](_['pick'](_0x12f3f2[_0x6ff1('0x35')],_0x4190fe[_0x6ff1('0x36')]));if(_0x12f3f2[_0x6ff1('0x35')][_0x6ff1('0x3f')]){_0x52e4fb[_0x6ff1('0x40')]=_[_0x6ff1('0x41')](_0x52e4fb[_0x6ff1('0x40')],{'$or':_[_0x6ff1('0x42')](_0x52e4fb[_0x6ff1('0x3a')],function(_0x23eb8b){var _0x3a94fe={};_0x3a94fe[_0x23eb8b]={'$like':'%'+_0x12f3f2[_0x6ff1('0x35')][_0x6ff1('0x3f')]+'%'};return _0x3a94fe;})});}_0x52e4fb=_[_0x6ff1('0x41')]({},_0x52e4fb,_0x12f3f2[_0x6ff1('0x45')]);return _0x249575[_0x6ff1('0x66')](_0x52e4fb);}})[_0x6ff1('0x29')](function(_0x264470){if(_0x264470){_0x2c800b=_0x264470[_0x6ff1('0x3b')];if(!_0x12f3f2['query'][_0x6ff1('0x3c')](_0x6ff1('0x5b'))){_0x52e4fb[_0x6ff1('0x23')]=qs[_0x6ff1('0x23')](_0x12f3f2[_0x6ff1('0x35')][_0x6ff1('0x23')]);_0x52e4fb[_0x6ff1('0x22')]=qs[_0x6ff1('0x22')](_0x12f3f2[_0x6ff1('0x35')][_0x6ff1('0x22')]);}return _0x249575[_0x6ff1('0x66')](_0x52e4fb);}})[_0x6ff1('0x29')](function(_0x36e9db){if(_0x36e9db){return _0x36e9db?{'count':_0x2c800b,'rows':_0x36e9db}:null;}})['then'](respondWithResult(_0x26e4d4,null))[_0x6ff1('0x49')](handleError(_0x26e4d4,null));};exports[_0x6ff1('0x67')]=function(_0xcca2f,_0x489949,_0x195a00){var _0x492eaf=_0xcca2f[_0x6ff1('0x4d')][_0x6ff1('0x68')];return db[_0x6ff1('0x65')][_0x6ff1('0x47')]({'where':{'id':_[_0x6ff1('0x42')](_0x492eaf,'id')},'attributes':['id'],'include':[{'model':db[_0x6ff1('0x5c')],'as':_0x6ff1('0x69'),'attributes':['id',_0x6ff1('0x30'),'online','voicePause','interface'],'raw':!![]}]})[_0x6ff1('0x29')](function(_0xc2670b){if(_0xc2670b){var _0x275d4c=_['flatMap'](_0xc2670b,function(_0xf6e70c){var _0xa3fb06=_0xf6e70c[_0x6ff1('0x4f')]({'plain':!![]});return _0xa3fb06['Agents'];});return db[_0x6ff1('0x46')][_0x6ff1('0x53')]({'where':{'id':_0xcca2f['params']['id']}})[_0x6ff1('0x29')](function(_0x58e16f){return db[_0x6ff1('0x6a')][_0x6ff1('0x6b')](function(_0x9fbb19){return _0x58e16f['addTeams'](_[_0x6ff1('0x42')](_0x492eaf,'id'),{'transaction':_0x9fbb19})[_0x6ff1('0x29')](function(){return BPromise[_0x6ff1('0x6c')](_0x275d4c,function(_0x5b6e20){return db[_0x6ff1('0x5a')][_0x6ff1('0x6d')]({'where':{'UserId':_0x5b6e20['id'],'SmsQueueId':_0xcca2f['params']['id']},'transaction':_0x9fbb19});});})[_0x6ff1('0x29')](function(){_0x275d4c[_0x6ff1('0x6e')](function(_0xadfbb7){socket[_0x6ff1('0x6f')](_0x6ff1('0x70'),{'UserId':_0xadfbb7['id'],'SmsQueueId':_0x58e16f['id']});});});});});}})[_0x6ff1('0x29')](respondWithStatusCode(_0x489949,null))[_0x6ff1('0x49')](handleError(_0x489949,null));};exports[_0x6ff1('0x71')]=function(_0x2ec134,_0x9f9d10,_0x40403e){return db[_0x6ff1('0x65')]['findAll']({'where':{'id':_0x2ec134[_0x6ff1('0x35')][_0x6ff1('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6ff1('0x5c')],'as':_0x6ff1('0x69'),'attributes':['id'],'raw':!![]}]})[_0x6ff1('0x29')](handleEntityNotFound(_0x9f9d10,null))['then'](function(_0x33cb97){var _0x154b70=_[_0x6ff1('0x42')](_0x33cb97,'id');var _0x3ef704=[];var _0x5b9c22=[];var _0x545f1c=squel[_0x6ff1('0x73')]();_0x545f1c[_0x6ff1('0x74')](_0x6ff1('0x75'))[_0x6ff1('0x76')](_0x6ff1('0x77'),'tq')[_0x6ff1('0x78')](_0x6ff1('0x79'),'ut',_0x6ff1('0x7a'))[_0x6ff1('0x40')](_0x6ff1('0x7b'),_0x2ec134[_0x6ff1('0x4a')]['id']);for(var _0x86c419=0x0;_0x86c419<_0x33cb97[_0x6ff1('0x3b')];_0x86c419+=0x1){let _0x155c29=_0x33cb97[_0x86c419];for(var _0x2930ce=0x0;_0x2930ce<_0x155c29[_0x6ff1('0x69')][_0x6ff1('0x3b')];_0x2930ce+=0x1){let _0x156e81=_0x155c29[_0x6ff1('0x69')][_0x2930ce];var _0x2e6e07=_0x545f1c[_0x6ff1('0x7c')]();_0x2e6e07[_0x6ff1('0x40')](_0x6ff1('0x7d'),_0x156e81['id']);_0x5b9c22[_0x6ff1('0x7e')](db[_0x6ff1('0x6a')][_0x6ff1('0x35')](_0x2e6e07[_0x6ff1('0x7f')](),{'type':db['sequelize'][_0x6ff1('0x80')][_0x6ff1('0x81')]})[_0x6ff1('0x29')](function(_0x2ec593){if(_0x2ec593['length']===0x1){return _0x156e81['id'];}else{var _0x114102=_['every'](_[_0x6ff1('0x42')](_0x2ec593,'TeamId'),function(_0x3a1208){return _[_0x6ff1('0x82')](_0x154b70,_0x3a1208);});if(_0x114102){return _0x156e81['id'];}}}));}}return BPromise[_0x6ff1('0x83')](_0x5b9c22)[_0x6ff1('0x29')](function(_0x8b470e){_0x3ef704=_(_0x3ef704)[_0x6ff1('0x84')](_0x8b470e)[_0x6ff1('0x85')]()[_0x6ff1('0x86')]();return db[_0x6ff1('0x46')][_0x6ff1('0x53')]({'where':{'id':_0x2ec134[_0x6ff1('0x4a')]['id']}})['then'](function(_0xc8768f){return db[_0x6ff1('0x6a')][_0x6ff1('0x6b')](function(_0x11e0a5){return _0xc8768f[_0x6ff1('0x71')](_0x2ec134[_0x6ff1('0x35')][_0x6ff1('0x72')],{'transaction':_0x11e0a5})[_0x6ff1('0x29')](function(){if(!_[_0x6ff1('0x87')](_0x3ef704)){return _0xc8768f[_0x6ff1('0x88')](_0x3ef704,{'transaction':_0x11e0a5});}})[_0x6ff1('0x29')](function(){_0x3ef704['forEach'](function(_0x1f4852){socket[_0x6ff1('0x6f')](_0x6ff1('0x89'),{'UserId':_0x1f4852,'SmsQueueId':_0xc8768f['id']});});});});});});})[_0x6ff1('0x29')](respondWithStatusCode(_0x9f9d10,null))['catch'](handleError(_0x9f9d10,null));};exports['addAgents']=function(_0x28d900,_0x4fec75,_0x1a5cfd){return db[_0x6ff1('0x46')][_0x6ff1('0x53')]({'where':{'id':_0x28d900[_0x6ff1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fec75,null))[_0x6ff1('0x29')](function(_0x215108){if(_0x215108){return _0x215108[_0x6ff1('0x8a')](_0x28d900[_0x6ff1('0x4d')][_0x6ff1('0x72')],_[_0x6ff1('0x8b')](_0x28d900['body'],[_0x6ff1('0x72'),'id'])||{})[_0x6ff1('0x8c')](function(_0x281ad8){for(var _0x55d5ab=0x0;_0x55d5ab<_0x28d900[_0x6ff1('0x4d')][_0x6ff1('0x72')]['length'];_0x55d5ab+=0x1){socket[_0x6ff1('0x6f')]('userSmsQueue:save',{'UserId':_0x28d900[_0x6ff1('0x4d')][_0x6ff1('0x72')][_0x55d5ab],'SmsQueueId':_0x28d900[_0x6ff1('0x4a')]['id']});}return _0x281ad8;});}})[_0x6ff1('0x29')](respondWithResult(_0x4fec75,null))['catch'](handleError(_0x4fec75,null));};exports[_0x6ff1('0x88')]=function(_0x31600e,_0x507fc3,_0x351700){return db[_0x6ff1('0x46')][_0x6ff1('0x53')]({'where':{'id':_0x31600e[_0x6ff1('0x4a')]['id']}})[_0x6ff1('0x29')](handleEntityNotFound(_0x507fc3,null))[_0x6ff1('0x29')](function(_0x2f1011){if(_0x2f1011){return _0x2f1011['removeAgents'](_0x31600e[_0x6ff1('0x35')][_0x6ff1('0x72')])[_0x6ff1('0x29')](function(){if(_[_0x6ff1('0x8d')](_0x31600e[_0x6ff1('0x35')][_0x6ff1('0x72')])){for(var _0x4125d2=0x0;_0x4125d2<_0x31600e[_0x6ff1('0x35')][_0x6ff1('0x72')]['length'];_0x4125d2+=0x1){socket[_0x6ff1('0x6f')](_0x6ff1('0x89'),{'UserId':Number(_0x31600e[_0x6ff1('0x35')][_0x6ff1('0x72')][_0x4125d2]),'SmsQueueId':Number(_0x31600e[_0x6ff1('0x4a')]['id'])});}}else{socket[_0x6ff1('0x6f')](_0x6ff1('0x89'),{'UserId':Number(_0x31600e[_0x6ff1('0x35')][_0x6ff1('0x72')]),'SmsQueueId':Number(_0x31600e['params']['id'])});}});}})[_0x6ff1('0x29')](respondWithStatusCode(_0x507fc3,null))['catch'](handleError(_0x507fc3,null));};exports[_0x6ff1('0x8e')]=function(_0x314c9d,_0x44d4fc,_0x4ae4ef){var _0x2c79ee={};var _0x5b97e6={};var _0x36bcc7;var _0x145017;return db[_0x6ff1('0x46')][_0x6ff1('0x59')]({'where':{'id':_0x314c9d[_0x6ff1('0x4a')]['id']}})[_0x6ff1('0x29')](handleEntityNotFound(_0x44d4fc,null))[_0x6ff1('0x29')](function(_0x47beee){if(_0x47beee){_0x36bcc7=_0x47beee;_0x5b97e6[_0x6ff1('0x38')]=_[_0x6ff1('0x34')](db[_0x6ff1('0x5c')][_0x6ff1('0x33')]);_0x5b97e6[_0x6ff1('0x35')]=_[_0x6ff1('0x34')](_0x314c9d[_0x6ff1('0x35')]);_0x5b97e6['filters']=_['intersection'](_0x5b97e6['model'],_0x5b97e6[_0x6ff1('0x35')]);_0x2c79ee[_0x6ff1('0x3a')]=_[_0x6ff1('0x37')](_0x5b97e6[_0x6ff1('0x38')],qs[_0x6ff1('0x39')](_0x314c9d[_0x6ff1('0x35')][_0x6ff1('0x39')]));_0x2c79ee[_0x6ff1('0x3a')]=_0x2c79ee['attributes'][_0x6ff1('0x3b')]?_0x2c79ee[_0x6ff1('0x3a')]:_0x5b97e6[_0x6ff1('0x38')];_0x2c79ee[_0x6ff1('0x3d')]=qs[_0x6ff1('0x3e')](_0x314c9d[_0x6ff1('0x35')][_0x6ff1('0x3e')]);_0x2c79ee['where']=qs[_0x6ff1('0x36')](_[_0x6ff1('0x8f')](_0x314c9d[_0x6ff1('0x35')],_0x5b97e6[_0x6ff1('0x36')]));if(_0x314c9d['query']['filter']){_0x2c79ee[_0x6ff1('0x40')]=_[_0x6ff1('0x41')](_0x2c79ee['where'],{'$or':_[_0x6ff1('0x42')](_0x2c79ee['attributes'],function(_0x9e5e5b){var _0x11b9f0={};_0x11b9f0[_0x9e5e5b]={'$like':'%'+_0x314c9d[_0x6ff1('0x35')]['filter']+'%'};return _0x11b9f0;})});}_0x2c79ee=_[_0x6ff1('0x41')]({},_0x2c79ee,_0x314c9d['options']);return _0x36bcc7['getAgents'](_0x2c79ee);}})[_0x6ff1('0x29')](function(_0x3aaa98){if(_0x3aaa98){_0x145017=_0x3aaa98[_0x6ff1('0x3b')];if(!_0x314c9d['query'][_0x6ff1('0x3c')](_0x6ff1('0x5b'))){_0x2c79ee[_0x6ff1('0x23')]=qs[_0x6ff1('0x23')](_0x314c9d['query'][_0x6ff1('0x23')]);_0x2c79ee['offset']=qs['offset'](_0x314c9d[_0x6ff1('0x35')][_0x6ff1('0x22')]);}return _0x36bcc7[_0x6ff1('0x8e')](_0x2c79ee);}})[_0x6ff1('0x29')](function(_0x2a7600){if(_0x2a7600){return _0x2a7600?{'count':_0x145017,'rows':_0x2a7600}:null;}})[_0x6ff1('0x29')](respondWithResult(_0x44d4fc,null))['catch'](handleError(_0x44d4fc,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index cdf0217..3af913d 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 _0x69fb=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x42230a,_0xaf3b5b){var _0x592f15=function(_0x248031){while(--_0x248031){_0x42230a['push'](_0x42230a['shift']());}};_0x592f15(++_0xaf3b5b);}(_0x69fb,0x71));var _0xb69f=function(_0x1907d0,_0x1618eb){_0x1907d0=_0x1907d0-0x0;var _0x2327e5=_0x69fb[_0x1907d0];return _0x2327e5;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb69f('0x0'))['db'][_0xb69f('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb69f('0x2')](0x0);var events={'afterCreate':_0xb69f('0x3'),'afterUpdate':_0xb69f('0x4'),'afterDestroy':_0xb69f('0x5')};function emitEvent(_0x1f7d1a){return function(_0x53b220,_0xfda67a,_0x20f62b){SmsQueueEvents['emit'](_0x1f7d1a+':'+_0x53b220['id'],_0x53b220);SmsQueueEvents[_0xb69f('0x6')](_0x1f7d1a,_0x53b220);_0x20f62b(null);};}for(var e in events){if(events[_0xb69f('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb69f('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x39c7=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x39c7,0x1e5));var _0x739c=function(_0x23651b,_0x5741ae){_0x23651b=_0x23651b-0x0;var _0xd5c714=_0x39c7[_0x23651b];return _0xd5c714;};'use strict';var EventEmitter=require(_0x739c('0x0'));var SmsQueue=require(_0x739c('0x1'))['db'][_0x739c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x739c('0x3')](0x0);var events={'afterCreate':_0x739c('0x4'),'afterUpdate':_0x739c('0x5'),'afterDestroy':_0x739c('0x6')};function emitEvent(_0x276a7d){return function(_0x2042ec,_0x575ab3,_0x31ad64){SmsQueueEvents[_0x739c('0x7')](_0x276a7d+':'+_0x2042ec['id'],_0x2042ec);SmsQueueEvents[_0x739c('0x7')](_0x276a7d,_0x2042ec);_0x31ad64(null);};}for(var e in events){if(events[_0x739c('0x8')](e)){var event=events[e];SmsQueue[_0x739c('0x9')](e,emitEvent(event));}}module[_0x739c('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f9089e6..008305e 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 _0xffd6=['path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xffd6,0x97));var _0x6ffd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xffd6[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06ae=['path','rimraf','../../config/environment','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5de83e,_0x58dc33){var _0x20559a=function(_0x15af49){while(--_0x15af49){_0x5de83e['push'](_0x5de83e['shift']());}};_0x20559a(++_0x58dc33);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var logger=require(_0xe06a('0x1'))(_0xe06a('0x2'));var moment=require(_0xe06a('0x3'));var BPromise=require(_0xe06a('0x4'));var rp=require(_0xe06a('0x5'));var fs=require('fs');var path=require(_0xe06a('0x6'));var rimraf=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x50e6cf,_0x1df79f){return _0x50e6cf[_0xe06a('0x9')](_0xe06a('0xa'),attributes,{'tableName':_0xe06a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 03581bd..07d200a 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 _0xc7ac=['message','result','catch','options','raw','where','limit','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xc7ac,0xc2));var _0xcc7a=function(_0x49e73f,_0x3a40f8){_0x49e73f=_0x49e73f-0x0;var _0x2ce18c=_0xc7ac[_0x49e73f];return _0x2ce18c;};'use strict';var _=require(_0xcc7a('0x0'));var util=require(_0xcc7a('0x1'));var moment=require('moment');var BPromise=require(_0xcc7a('0x2'));var rs=require(_0xcc7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc7a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc7a('0x5'))(_0xcc7a('0x6'));var config=require(_0xcc7a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcc7a('0x8')][_0xcc7a('0x9')]({'port':0x232a});config[_0xcc7a('0xa')]=_[_0xcc7a('0xb')](config[_0xcc7a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc7a('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x387269,_0x532e6d,_0x50fd3e){return new BPromise(function(_0x4c5ad7,_0x16670d){return client[_0xcc7a('0xd')](_0x387269,_0x50fd3e)[_0xcc7a('0xe')](function(_0x4ed314){logger[_0xcc7a('0xf')](_0xcc7a('0x10'),_0x532e6d,'request\x20sent');logger[_0xcc7a('0x11')](_0xcc7a('0x12'),_0x532e6d,_0xcc7a('0x13'),JSON[_0xcc7a('0x14')](_0x4ed314));if(_0x4ed314[_0xcc7a('0x15')]){if(_0x4ed314[_0xcc7a('0x15')]['code']===0x1f4){logger[_0xcc7a('0x15')](_0xcc7a('0x10'),_0x532e6d,_0x4ed314[_0xcc7a('0x15')][_0xcc7a('0x16')]);return _0x16670d(_0x4ed314[_0xcc7a('0x15')][_0xcc7a('0x16')]);}logger[_0xcc7a('0x15')]('SmsQueue,\x20%s,\x20%s',_0x532e6d,_0x4ed314[_0xcc7a('0x15')][_0xcc7a('0x16')]);return _0x4c5ad7(_0x4ed314[_0xcc7a('0x15')][_0xcc7a('0x16')]);}else{logger[_0xcc7a('0xf')](_0xcc7a('0x10'),_0x532e6d,'request\x20sent');_0x4c5ad7(_0x4ed314[_0xcc7a('0x17')]['message']);}})[_0xcc7a('0x18')](function(_0x534798){logger['error'](_0xcc7a('0x10'),_0x532e6d,_0x534798);_0x16670d(_0x534798);});});}exports['GetSmsQueue']=function(_0x27284e){var _0x1f8fc2=this;return new Promise(function(_0x1cb8db,_0x56a267){return db['SmsQueue']['findAll']({'raw':_0x27284e[_0xcc7a('0x19')]?_0x27284e[_0xcc7a('0x19')][_0xcc7a('0x1a')]===undefined?!![]:![]:!![],'where':_0x27284e['options']?_0x27284e['options'][_0xcc7a('0x1b')]||null:null,'attributes':_0x27284e[_0xcc7a('0x19')]?_0x27284e[_0xcc7a('0x19')]['attributes']||null:null,'limit':_0x27284e['options']?_0x27284e[_0xcc7a('0x19')][_0xcc7a('0x1c')]||null:null,'include':_0x27284e[_0xcc7a('0x19')]?_0x27284e[_0xcc7a('0x19')][_0xcc7a('0x1d')]?_[_0xcc7a('0x1e')](_0x27284e['options']['include'],function(_0x2055a1){return{'model':db[_0x2055a1[_0xcc7a('0x1f')]],'as':_0x2055a1['as'],'attributes':_0x2055a1[_0xcc7a('0x20')],'include':_0x2055a1[_0xcc7a('0x1d')]?_[_0xcc7a('0x1e')](_0x2055a1[_0xcc7a('0x1d')],function(_0x3b4e8b){return{'model':db[_0x3b4e8b[_0xcc7a('0x1f')]],'as':_0x3b4e8b['as'],'attributes':_0x3b4e8b[_0xcc7a('0x20')],'include':_0x3b4e8b[_0xcc7a('0x1d')]?_['map'](_0x3b4e8b['include'],function(_0x22870e){return{'model':db[_0x22870e['model']],'as':_0x22870e['as'],'attributes':_0x22870e[_0xcc7a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcc7a('0xe')](function(_0x5b33f7){logger[_0xcc7a('0xf')](_0xcc7a('0x21'),_0x27284e);logger[_0xcc7a('0x11')](_0xcc7a('0x21'),_0x27284e,JSON[_0xcc7a('0x14')](_0x5b33f7));_0x1cb8db(_0x5b33f7);})[_0xcc7a('0x18')](function(_0x115b6a){logger['error'](_0xcc7a('0x21'),_0x115b6a[_0xcc7a('0x16')],_0x27284e);_0x56a267(_0x1f8fc2[_0xcc7a('0x15')](0x1f4,_0x115b6a[_0xcc7a('0x16')]));});});};exports[_0xcc7a('0x22')]=function(_0xf1d3b3){var _0x2a0729=this;return new Promise(function(_0x183c69,_0x4cada7){return db['SmsQueue'][_0xcc7a('0x23')]({'raw':_0xf1d3b3['options']?_0xf1d3b3[_0xcc7a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf1d3b3[_0xcc7a('0x19')]?_0xf1d3b3['options'][_0xcc7a('0x1b')]||null:null,'attributes':_0xf1d3b3['options']?_0xf1d3b3[_0xcc7a('0x19')][_0xcc7a('0x20')]||null:null,'include':_0xf1d3b3[_0xcc7a('0x19')]?_0xf1d3b3[_0xcc7a('0x19')][_0xcc7a('0x1d')]?_[_0xcc7a('0x1e')](_0xf1d3b3[_0xcc7a('0x19')][_0xcc7a('0x1d')],function(_0x535d7d){return{'model':db[_0x535d7d['model']],'as':_0x535d7d['as'],'attributes':_0x535d7d[_0xcc7a('0x20')],'include':_0x535d7d['include']?_[_0xcc7a('0x1e')](_0x535d7d[_0xcc7a('0x1d')],function(_0x13be3a){return{'model':db[_0x13be3a[_0xcc7a('0x1f')]],'as':_0x13be3a['as'],'attributes':_0x13be3a[_0xcc7a('0x20')],'include':_0x13be3a['include']?_[_0xcc7a('0x1e')](_0x13be3a[_0xcc7a('0x1d')],function(_0x2a2a47){return{'model':db[_0x2a2a47['model']],'as':_0x2a2a47['as'],'attributes':_0x2a2a47[_0xcc7a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x237c5a){logger[_0xcc7a('0xf')](_0xcc7a('0x22'),_0xf1d3b3);logger[_0xcc7a('0x11')](_0xcc7a('0x22'),_0xf1d3b3,JSON[_0xcc7a('0x14')](_0x237c5a));_0x183c69(_0x237c5a);})[_0xcc7a('0x18')](function(_0x2c0026){logger[_0xcc7a('0x15')]('ShowSmsQueue',_0x2c0026[_0xcc7a('0x16')],_0xf1d3b3);_0x4cada7(_0x2a0729[_0xcc7a('0x15')](0x1f4,_0x2c0026[_0xcc7a('0x16')]));});});}; \ No newline at end of file +var _0xe43d=['find','model','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','ShowSmsQueue'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe43d,0x75));var _0xde43=function(_0x49ee70,_0x115b1e){_0x49ee70=_0x49ee70-0x0;var _0x3a7254=_0xe43d[_0x49ee70];return _0x3a7254;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde43('0x0'));var BPromise=require(_0xde43('0x1'));var rs=require(_0xde43('0x2'));var fs=require('fs');var Redis=require(_0xde43('0x3'));var db=require(_0xde43('0x4'))['db'];var utils=require(_0xde43('0x5'));var logger=require(_0xde43('0x6'))(_0xde43('0x7'));var config=require(_0xde43('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xde43('0x9')]=_[_0xde43('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xde43('0xb'))(new Redis(config['redis']));require(_0xde43('0xc'))['register'](socket);function respondWithRpcPromise(_0x5967ee,_0x2061ca,_0x19c642){return new BPromise(function(_0x327652,_0x1aeea9){return client[_0xde43('0xd')](_0x5967ee,_0x19c642)[_0xde43('0xe')](function(_0x55333b){logger[_0xde43('0xf')](_0xde43('0x10'),_0x2061ca,_0xde43('0x11'));logger[_0xde43('0x12')](_0xde43('0x13'),_0x2061ca,'request\x20sent',JSON['stringify'](_0x55333b));if(_0x55333b[_0xde43('0x14')]){if(_0x55333b['error'][_0xde43('0x15')]===0x1f4){logger[_0xde43('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2061ca,_0x55333b[_0xde43('0x14')][_0xde43('0x16')]);return _0x1aeea9(_0x55333b[_0xde43('0x14')]['message']);}logger[_0xde43('0x14')](_0xde43('0x10'),_0x2061ca,_0x55333b[_0xde43('0x14')][_0xde43('0x16')]);return _0x327652(_0x55333b[_0xde43('0x14')][_0xde43('0x16')]);}else{logger[_0xde43('0xf')](_0xde43('0x10'),_0x2061ca,_0xde43('0x11'));_0x327652(_0x55333b[_0xde43('0x17')]['message']);}})[_0xde43('0x18')](function(_0x11f642){logger[_0xde43('0x14')](_0xde43('0x10'),_0x2061ca,_0x11f642);_0x1aeea9(_0x11f642);});});}exports[_0xde43('0x19')]=function(_0xa44ed2){var _0x3934e5=this;return new Promise(function(_0x5c36c3,_0x40c11c){return db[_0xde43('0x1a')][_0xde43('0x1b')]({'raw':_0xa44ed2[_0xde43('0x1c')]?_0xa44ed2[_0xde43('0x1c')][_0xde43('0x1d')]===undefined?!![]:![]:!![],'where':_0xa44ed2[_0xde43('0x1c')]?_0xa44ed2['options'][_0xde43('0x1e')]||null:null,'attributes':_0xa44ed2['options']?_0xa44ed2[_0xde43('0x1c')][_0xde43('0x1f')]||null:null,'limit':_0xa44ed2[_0xde43('0x1c')]?_0xa44ed2[_0xde43('0x1c')]['limit']||null:null,'include':_0xa44ed2[_0xde43('0x1c')]?_0xa44ed2[_0xde43('0x1c')][_0xde43('0x20')]?_[_0xde43('0x21')](_0xa44ed2[_0xde43('0x1c')][_0xde43('0x20')],function(_0x3cc6f9){return{'model':db[_0x3cc6f9['model']],'as':_0x3cc6f9['as'],'attributes':_0x3cc6f9[_0xde43('0x1f')],'include':_0x3cc6f9['include']?_[_0xde43('0x21')](_0x3cc6f9[_0xde43('0x20')],function(_0x2dbe79){return{'model':db[_0x2dbe79['model']],'as':_0x2dbe79['as'],'attributes':_0x2dbe79['attributes'],'include':_0x2dbe79[_0xde43('0x20')]?_['map'](_0x2dbe79[_0xde43('0x20')],function(_0x298496){return{'model':db[_0x298496['model']],'as':_0x298496['as'],'attributes':_0x298496[_0xde43('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xde43('0xe')](function(_0x5b57f2){logger[_0xde43('0xf')]('GetSmsQueue',_0xa44ed2);logger[_0xde43('0x12')](_0xde43('0x19'),_0xa44ed2,JSON['stringify'](_0x5b57f2));_0x5c36c3(_0x5b57f2);})[_0xde43('0x18')](function(_0x126715){logger[_0xde43('0x14')](_0xde43('0x19'),_0x126715[_0xde43('0x16')],_0xa44ed2);_0x40c11c(_0x3934e5[_0xde43('0x14')](0x1f4,_0x126715['message']));});});};exports[_0xde43('0x22')]=function(_0x222a8f){var _0x5040dc=this;return new Promise(function(_0x15863d,_0x295a88){return db[_0xde43('0x1a')][_0xde43('0x23')]({'raw':_0x222a8f[_0xde43('0x1c')]?_0x222a8f[_0xde43('0x1c')][_0xde43('0x1d')]===undefined?!![]:![]:!![],'where':_0x222a8f[_0xde43('0x1c')]?_0x222a8f[_0xde43('0x1c')]['where']||null:null,'attributes':_0x222a8f[_0xde43('0x1c')]?_0x222a8f[_0xde43('0x1c')][_0xde43('0x1f')]||null:null,'include':_0x222a8f[_0xde43('0x1c')]?_0x222a8f[_0xde43('0x1c')][_0xde43('0x20')]?_[_0xde43('0x21')](_0x222a8f[_0xde43('0x1c')]['include'],function(_0x218a69){return{'model':db[_0x218a69['model']],'as':_0x218a69['as'],'attributes':_0x218a69[_0xde43('0x1f')],'include':_0x218a69[_0xde43('0x20')]?_[_0xde43('0x21')](_0x218a69[_0xde43('0x20')],function(_0x678dfd){return{'model':db[_0x678dfd[_0xde43('0x24')]],'as':_0x678dfd['as'],'attributes':_0x678dfd[_0xde43('0x1f')],'include':_0x678dfd[_0xde43('0x20')]?_['map'](_0x678dfd[_0xde43('0x20')],function(_0x21cf0c){return{'model':db[_0x21cf0c[_0xde43('0x24')]],'as':_0x21cf0c['as'],'attributes':_0x21cf0c[_0xde43('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xde43('0xe')](function(_0x56562a){logger['info']('ShowSmsQueue',_0x222a8f);logger[_0xde43('0x12')](_0xde43('0x22'),_0x222a8f,JSON[_0xde43('0x25')](_0x56562a));_0x15863d(_0x56562a);})['catch'](function(_0x5233e0){logger[_0xde43('0x14')](_0xde43('0x22'),_0x5233e0[_0xde43('0x16')],_0x222a8f);_0x295a88(_0x5040dc[_0xde43('0x14')](0x1f4,_0x5233e0[_0xde43('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ad448ce..c22ea18 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 _0x5655=['./smsQueue.events','save','remove','update','removeListener','register','smsQueue:'];(function(_0x1bd96e,_0x59be63){var _0x44b480=function(_0x41529b){while(--_0x41529b){_0x1bd96e['push'](_0x1bd96e['shift']());}};_0x44b480(++_0x59be63);}(_0x5655,0x15e));var _0x5565=function(_0x57d103,_0x313a46){_0x57d103=_0x57d103-0x0;var _0x51782b=_0x5655[_0x57d103];return _0x51782b;};'use strict';var SmsQueueEvents=require(_0x5565('0x0'));var events=[_0x5565('0x1'),_0x5565('0x2'),_0x5565('0x3')];function createListener(_0x42be35,_0x243782){return function(_0x5b1b44){_0x243782['emit'](_0x42be35,_0x5b1b44);};}function removeListener(_0x307c01,_0x58e4f5){return function(){SmsQueueEvents[_0x5565('0x4')](_0x307c01,_0x58e4f5);};}exports[_0x5565('0x5')]=function(_0x37954f){for(var _0x93a8e5=0x0,_0x106d59=events['length'];_0x93a8e5<_0x106d59;_0x93a8e5++){var _0xc88d42=events[_0x93a8e5];var _0x2980c9=createListener(_0x5565('0x6')+_0xc88d42,_0x37954f);SmsQueueEvents['on'](_0xc88d42,_0x2980c9);}}; \ No newline at end of file +var _0xa23f=['save','emit','register','smsQueue:','./smsQueue.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa23f,0x7c));var _0xfa23=function(_0x4cb222,_0x1cef20){_0x4cb222=_0x4cb222-0x0;var _0x4936cb=_0xa23f[_0x4cb222];return _0x4936cb;};'use strict';var SmsQueueEvents=require(_0xfa23('0x0'));var events=[_0xfa23('0x1'),'remove','update'];function createListener(_0xb81edf,_0x3f714c){return function(_0x1c85a9){_0x3f714c[_0xfa23('0x2')](_0xb81edf,_0x1c85a9);};}function removeListener(_0x5643b1,_0x86778e){return function(){SmsQueueEvents['removeListener'](_0x5643b1,_0x86778e);};}exports[_0xfa23('0x3')]=function(_0x2df2f5){for(var _0x4c3f4=0x0,_0x3696ef=events['length'];_0x4c3f4<_0x3696ef;_0x4c3f4++){var _0x5a7882=events[_0x4c3f4];var _0x59d53e=createListener(_0xfa23('0x4')+_0x5a7882,_0x2df2f5);SmsQueueEvents['on'](_0x5a7882,_0x59d53e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 23f6f50..dd7c3c9 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 _0x78e0=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x267ed1,_0x4ed0b9){var _0x1f072c=function(_0x229707){while(--_0x229707){_0x267ed1['push'](_0x267ed1['shift']());}};_0x1f072c(++_0x4ed0b9);}(_0x78e0,0x13e));var _0x078e=function(_0x3076ed,_0x23db8a){_0x3076ed=_0x3076ed-0x0;var _0x25a6a9=_0x78e0[_0x3076ed];return _0x25a6a9;};'use strict';var multer=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var path=require(_0x078e('0x2'));var timeout=require(_0x078e('0x3'));var express=require(_0x078e('0x4'));var router=express[_0x078e('0x5')]();var auth=require(_0x078e('0x6'));var interaction=require(_0x078e('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x078e('0x8')]('/',auth[_0x078e('0x9')](),controller[_0x078e('0xa')]);router[_0x078e('0x8')](_0x078e('0xb'),auth['isAuthenticated'](),controller[_0x078e('0xc')]);router[_0x078e('0x8')](_0x078e('0xd'),auth[_0x078e('0x9')](),controller[_0x078e('0xe')]);router[_0x078e('0xf')]('/',auth[_0x078e('0x9')](),controller['create']);router[_0x078e('0x10')](_0x078e('0xd'),auth[_0x078e('0x9')](),controller[_0x078e('0x11')]);router[_0x078e('0x12')](_0x078e('0xd'),auth[_0x078e('0x9')](),controller[_0x078e('0x13')]);module[_0x078e('0x14')]=router; \ No newline at end of file +var _0xe7de=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x1d80c0,_0x5d3b74){var _0x197c50=function(_0xb2f812){while(--_0xb2f812){_0x1d80c0['push'](_0x1d80c0['shift']());}};_0x197c50(++_0x5d3b74);}(_0xe7de,0x165));var _0xee7d=function(_0x851c30,_0x5bb969){_0x851c30=_0x851c30-0x0;var _0x1aad45=_0xe7de[_0x851c30];return _0x1aad45;};'use strict';var multer=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var path=require(_0xee7d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee7d('0x3')]();var auth=require(_0xee7d('0x4'));var interaction=require(_0xee7d('0x5'));var config=require(_0xee7d('0x6'));var controller=require(_0xee7d('0x7'));router[_0xee7d('0x8')]('/',auth[_0xee7d('0x9')](),controller[_0xee7d('0xa')]);router[_0xee7d('0x8')](_0xee7d('0xb'),auth[_0xee7d('0x9')](),controller[_0xee7d('0xc')]);router[_0xee7d('0x8')](_0xee7d('0xd'),auth['isAuthenticated'](),controller[_0xee7d('0xe')]);router[_0xee7d('0xf')]('/',auth[_0xee7d('0x9')](),controller[_0xee7d('0x10')]);router[_0xee7d('0x11')](_0xee7d('0xd'),auth['isAuthenticated'](),controller[_0xee7d('0x12')]);router['delete'](_0xee7d('0xd'),auth[_0xee7d('0x9')](),controller[_0xee7d('0x13')]);module[_0xee7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 490a429..0679ce8 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 _0x2cde=['exports','STRING','DATE','moment','sequelize'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x2cde,0x1bb));var _0xe2cd=function(_0x2e4aad,_0x21207a){_0x2e4aad=_0x2e4aad-0x0;var _0x3d9252=_0x2cde[_0x2e4aad];return _0x3d9252;};'use strict';var moment=require(_0xe2cd('0x0'));var Sequelize=require(_0xe2cd('0x1'));module[_0xe2cd('0x2')]={'uniqueid':{'type':Sequelize[_0xe2cd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe2cd('0x3')]},'joinAt':{'type':Sequelize[_0xe2cd('0x4')]},'leaveAt':{'type':Sequelize[_0xe2cd('0x4')]},'acceptAt':{'type':Sequelize[_0xe2cd('0x4')]},'exitAt':{'type':Sequelize[_0xe2cd('0x4')]},'reason':{'type':Sequelize[_0xe2cd('0x3')]}}; \ No newline at end of file +var _0xd1a1=['moment','sequelize','exports','STRING','DATE'];(function(_0x45dbd6,_0x28f307){var _0x29d2c8=function(_0x27b00e){while(--_0x27b00e){_0x45dbd6['push'](_0x45dbd6['shift']());}};_0x29d2c8(++_0x28f307);}(_0xd1a1,0x181));var _0x1d1a=function(_0xd4c31e,_0x4d2703){_0xd4c31e=_0xd4c31e-0x0;var _0x224d47=_0xd1a1[_0xd4c31e];return _0x224d47;};'use strict';var moment=require(_0x1d1a('0x0'));var Sequelize=require(_0x1d1a('0x1'));module[_0x1d1a('0x2')]={'uniqueid':{'type':Sequelize[_0x1d1a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1d1a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1d1a('0x4')]},'acceptAt':{'type':Sequelize[_0x1d1a('0x4')]},'exitAt':{'type':Sequelize[_0x1d1a('0x4')]},'reason':{'type':Sequelize[_0x1d1a('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cbf4a69..b2000bc 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 _0x6c7b=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','index','SmsQueueReport','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','key','VIRTUAL','field','options','includeAll','findAll','rows','show','keys','find','create','body','update','params','describe','catch','html-pdf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x57cf96,_0x187376){var _0x130ad=function(_0x50c8ac){while(--_0x50c8ac){_0x57cf96['push'](_0x57cf96['shift']());}};_0x130ad(++_0x187376);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x1e504a,_0x5d3e34){_0x1e504a=_0x1e504a-0x0;var _0x15ac53=_0x6c7b[_0x1e504a];return _0x15ac53;};'use strict';var pdf=require(_0xb6c7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6c7('0x1'));var rp=require('request-promise');var moment=require(_0xb6c7('0x2'));var BPromise=require(_0xb6c7('0x3'));var Mustache=require(_0xb6c7('0x4'));var util=require('util');var path=require(_0xb6c7('0x5'));var sox=require(_0xb6c7('0x6'));var csv=require(_0xb6c7('0x7'));var ejs=require(_0xb6c7('0x8'));var fs=require('fs');var _=require(_0xb6c7('0x9'));var squel=require('squel');var crypto=require(_0xb6c7('0xa'));var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x7'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6c7('0x11'))(_0xb6c7('0x12'));var utils=require(_0xb6c7('0x13'));var config=require(_0xb6c7('0x14'));var db=require(_0xb6c7('0x15'))['db'];function respondWithStatusCode(_0x30fc73,_0x1b5199){_0x1b5199=_0x1b5199||0xcc;return function(_0x50c2de){if(_0x50c2de){return _0x30fc73[_0xb6c7('0x16')](_0x1b5199);}return _0x30fc73[_0xb6c7('0x17')](_0x1b5199)[_0xb6c7('0x18')]();};}function respondWithResult(_0xd6fb50,_0x4086a1){_0x4086a1=_0x4086a1||0xc8;return function(_0x383ac5){if(_0x383ac5){return _0xd6fb50[_0xb6c7('0x17')](_0x4086a1)['json'](_0x383ac5);}};}function respondWithFilteredResult(_0x3c7ff4,_0x4e4c3f){return function(_0x480d9a){if(_0x480d9a){var _0x5d5428=_0x480d9a[_0xb6c7('0x19')],_0x19c145=_0x4e4c3f[_0xb6c7('0x1a')],_0x48b7ec=_0x4e4c3f[_0xb6c7('0x1a')]+_0x4e4c3f[_0xb6c7('0x1b')],_0x45f1a3;if(_0x48b7ec>=_0x5d5428){_0x48b7ec=_0x5d5428;_0x45f1a3=0xc8;}else{_0x45f1a3=0xce;}_0x3c7ff4[_0xb6c7('0x17')](_0x45f1a3);return _0x3c7ff4[_0xb6c7('0x1c')](_0xb6c7('0x1d'),_0x19c145+'-'+_0x48b7ec+'/'+_0x5d5428)[_0xb6c7('0x1e')](_0x480d9a);}return null;};}function patchUpdates(_0xd0434e){return function(_0xef5eb1){try{jsonpatch[_0xb6c7('0x1f')](_0xef5eb1,_0xd0434e,!![]);}catch(_0x3beafa){return BPromise['reject'](_0x3beafa);}return _0xef5eb1[_0xb6c7('0x20')]();};}function saveUpdates(_0x1cbcc8,_0x599b49){return function(_0x25ca5d){if(_0x25ca5d){return _0x25ca5d['update'](_0x1cbcc8)[_0xb6c7('0x21')](function(_0x5b7ebf){return _0x5b7ebf;});}return null;};}function removeEntity(_0x141db2,_0x4f2960){return function(_0x24c0b3){if(_0x24c0b3){return _0x24c0b3[_0xb6c7('0x22')]()['then'](function(){_0x141db2[_0xb6c7('0x17')](0xcc)[_0xb6c7('0x18')]();});}};}function handleEntityNotFound(_0x2081a6,_0x4232b6){return function(_0xd33675){if(!_0xd33675){_0x2081a6[_0xb6c7('0x16')](0x194);}return _0xd33675;};}function handleError(_0x54a2ff,_0x4109c3){_0x4109c3=_0x4109c3||0x1f4;return function(_0x1f4e06){logger[_0xb6c7('0x23')](_0x1f4e06[_0xb6c7('0x24')]);if(_0x1f4e06['name']){delete _0x1f4e06[_0xb6c7('0x25')];}_0x54a2ff[_0xb6c7('0x17')](_0x4109c3)['send'](_0x1f4e06);};}exports[_0xb6c7('0x26')]=function(_0x164801,_0x1de00f){var _0x32cd6b={},_0x4fb79f={},_0x30eeb4={'count':0x0,'rows':[]};var _0x54373f=db[_0xb6c7('0x27')][_0xb6c7('0x28')];_0x4fb79f[_0xb6c7('0x29')]=_['keys'](_0x54373f);_0x4fb79f['query']=_['keys'](_0x164801[_0xb6c7('0x2a')]);_0x4fb79f[_0xb6c7('0x2b')]=_[_0xb6c7('0x2c')](_0x4fb79f[_0xb6c7('0x29')],_0x4fb79f[_0xb6c7('0x2a')]);_0x32cd6b[_0xb6c7('0x2d')]=_[_0xb6c7('0x2c')](_0x4fb79f[_0xb6c7('0x29')],qs[_0xb6c7('0x2e')](_0x164801[_0xb6c7('0x2a')]['fields']));_0x32cd6b[_0xb6c7('0x2d')]=_0x32cd6b['attributes'][_0xb6c7('0x2f')]?_0x32cd6b[_0xb6c7('0x2d')]:_0x4fb79f[_0xb6c7('0x29')];if(!_0x164801[_0xb6c7('0x2a')][_0xb6c7('0x30')]('nolimit')){_0x32cd6b['limit']=qs['limit'](_0x164801[_0xb6c7('0x2a')][_0xb6c7('0x1b')]);_0x32cd6b['offset']=qs[_0xb6c7('0x1a')](_0x164801[_0xb6c7('0x2a')]['offset']);}_0x32cd6b[_0xb6c7('0x31')]=qs[_0xb6c7('0x32')](_0x164801[_0xb6c7('0x2a')][_0xb6c7('0x32')]);_0x32cd6b[_0xb6c7('0x33')]=qs[_0xb6c7('0x2b')](_['pick'](_0x164801[_0xb6c7('0x2a')],_0x4fb79f[_0xb6c7('0x2b')]));if(_0x164801[_0xb6c7('0x2a')][_0xb6c7('0x34')]){_0x32cd6b[_0xb6c7('0x33')]=_[_0xb6c7('0x35')](_0x32cd6b[_0xb6c7('0x33')],{'$or':_['map'](_0x54373f,function(_0x4b7b88){if(_0x4b7b88[_0xb6c7('0x36')][_0xb6c7('0x37')]!==_0xb6c7('0x38')){var _0x3bbc90={};_0x3bbc90[_0x4b7b88[_0xb6c7('0x39')]]={'$like':'%'+_0x164801[_0xb6c7('0x2a')][_0xb6c7('0x34')]+'%'};return _0x3bbc90;}})});}_0x32cd6b=_[_0xb6c7('0x35')]({},_0x32cd6b,_0x164801[_0xb6c7('0x3a')]);var _0x2f6193={'where':_0x32cd6b['where']};return db[_0xb6c7('0x27')]['count'](_0x2f6193)['then'](function(_0x78e5b1){_0x30eeb4['count']=_0x78e5b1;if(_0x164801[_0xb6c7('0x2a')][_0xb6c7('0x3b')]){_0x32cd6b['include']=[{'all':!![]}];}return db[_0xb6c7('0x27')][_0xb6c7('0x3c')](_0x32cd6b);})[_0xb6c7('0x21')](function(_0x84861f){_0x30eeb4[_0xb6c7('0x3d')]=_0x84861f;return _0x30eeb4;})['then'](respondWithFilteredResult(_0x1de00f,_0x32cd6b))['catch'](handleError(_0x1de00f,null));};exports[_0xb6c7('0x3e')]=function(_0xb575,_0xb7f85b){var _0x184af6={'raw':!![],'where':{'id':_0xb575['params']['id']}},_0x5836e5={};_0x5836e5[_0xb6c7('0x29')]=_[_0xb6c7('0x3f')](db[_0xb6c7('0x27')][_0xb6c7('0x28')]);_0x5836e5[_0xb6c7('0x2a')]=_['keys'](_0xb575['query']);_0x5836e5['filters']=_[_0xb6c7('0x2c')](_0x5836e5[_0xb6c7('0x29')],_0x5836e5[_0xb6c7('0x2a')]);_0x184af6['attributes']=_[_0xb6c7('0x2c')](_0x5836e5[_0xb6c7('0x29')],qs['fields'](_0xb575[_0xb6c7('0x2a')][_0xb6c7('0x2e')]));_0x184af6[_0xb6c7('0x2d')]=_0x184af6[_0xb6c7('0x2d')][_0xb6c7('0x2f')]?_0x184af6['attributes']:_0x5836e5[_0xb6c7('0x29')];if(_0xb575[_0xb6c7('0x2a')][_0xb6c7('0x3b')]){_0x184af6['include']=[{'all':!![]}];}_0x184af6=_['merge']({},_0x184af6,_0xb575[_0xb6c7('0x3a')]);return db[_0xb6c7('0x27')][_0xb6c7('0x40')](_0x184af6)['then'](handleEntityNotFound(_0xb7f85b,null))['then'](respondWithResult(_0xb7f85b,null))['catch'](handleError(_0xb7f85b,null));};exports[_0xb6c7('0x41')]=function(_0x1d0ba6,_0x211584){return db[_0xb6c7('0x27')][_0xb6c7('0x41')](_0x1d0ba6[_0xb6c7('0x42')],{})[_0xb6c7('0x21')](respondWithResult(_0x211584,0xc9))['catch'](handleError(_0x211584,null));};exports[_0xb6c7('0x43')]=function(_0x412f52,_0x3f14e8){if(_0x412f52[_0xb6c7('0x42')]['id']){delete _0x412f52[_0xb6c7('0x42')]['id'];}return db['SmsQueueReport'][_0xb6c7('0x40')]({'where':{'id':_0x412f52[_0xb6c7('0x44')]['id']}})[_0xb6c7('0x21')](handleEntityNotFound(_0x3f14e8,null))[_0xb6c7('0x21')](saveUpdates(_0x412f52[_0xb6c7('0x42')],null))[_0xb6c7('0x21')](respondWithResult(_0x3f14e8,null))['catch'](handleError(_0x3f14e8,null));};exports[_0xb6c7('0x22')]=function(_0x141cd5,_0x2116cb){return db[_0xb6c7('0x27')][_0xb6c7('0x40')]({'where':{'id':_0x141cd5[_0xb6c7('0x44')]['id']}})[_0xb6c7('0x21')](handleEntityNotFound(_0x2116cb,null))['then'](removeEntity(_0x2116cb,null))['catch'](handleError(_0x2116cb,null));};exports['describe']=function(_0xbf1903,_0x22e7a1){return db[_0xb6c7('0x27')][_0xb6c7('0x45')]()[_0xb6c7('0x21')](respondWithResult(_0x22e7a1,null))[_0xb6c7('0x46')](handleError(_0x22e7a1,null));}; \ No newline at end of file +var _0xeecc=['SmsQueueReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','key','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index'];(function(_0x36ee37,_0x23f939){var _0x285864=function(_0x54ffef){while(--_0x54ffef){_0x36ee37['push'](_0x36ee37['shift']());}};_0x285864(++_0x23f939);}(_0xeecc,0x12d));var _0xceec=function(_0x45652a,_0x4c5850){_0x45652a=_0x45652a-0x0;var _0x134929=_0xeecc[_0x45652a];return _0x134929;};'use strict';var pdf=require(_0xceec('0x0'));var emlformat=require(_0xceec('0x1'));var rimraf=require(_0xceec('0x2'));var zipdir=require(_0xceec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xceec('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xceec('0x5'));var path=require(_0xceec('0x6'));var sox=require(_0xceec('0x7'));var csv=require(_0xceec('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xceec('0x9'));var squel=require('squel');var crypto=require(_0xceec('0xa'));var jsforce=require(_0xceec('0xb'));var deskjs=require(_0xceec('0xc'));var toCsv=require(_0xceec('0x8'));var querystring=require(_0xceec('0xd'));var Papa=require(_0xceec('0xe'));var Redis=require(_0xceec('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xceec('0x10'));var hardwareService=require(_0xceec('0x11'));var logger=require(_0xceec('0x12'))(_0xceec('0x13'));var utils=require(_0xceec('0x14'));var config=require('../../config/environment');var db=require(_0xceec('0x15'))['db'];function respondWithStatusCode(_0x299583,_0x37ce83){_0x37ce83=_0x37ce83||0xcc;return function(_0x417594){if(_0x417594){return _0x299583[_0xceec('0x16')](_0x37ce83);}return _0x299583['status'](_0x37ce83)[_0xceec('0x17')]();};}function respondWithResult(_0x5b8216,_0x1df290){_0x1df290=_0x1df290||0xc8;return function(_0x11b183){if(_0x11b183){return _0x5b8216[_0xceec('0x18')](_0x1df290)['json'](_0x11b183);}};}function respondWithFilteredResult(_0x578e51,_0x119110){return function(_0x51f24d){if(_0x51f24d){var _0x303ab3=_0x51f24d[_0xceec('0x19')],_0x228629=_0x119110[_0xceec('0x1a')],_0x14566b=_0x119110[_0xceec('0x1a')]+_0x119110[_0xceec('0x1b')],_0x4206de;if(_0x14566b>=_0x303ab3){_0x14566b=_0x303ab3;_0x4206de=0xc8;}else{_0x4206de=0xce;}_0x578e51[_0xceec('0x18')](_0x4206de);return _0x578e51[_0xceec('0x1c')](_0xceec('0x1d'),_0x228629+'-'+_0x14566b+'/'+_0x303ab3)['json'](_0x51f24d);}return null;};}function patchUpdates(_0x19696){return function(_0x1c0cfc){try{jsonpatch[_0xceec('0x1e')](_0x1c0cfc,_0x19696,!![]);}catch(_0x47162c){return BPromise[_0xceec('0x1f')](_0x47162c);}return _0x1c0cfc[_0xceec('0x20')]();};}function saveUpdates(_0x230c88,_0x422e25){return function(_0x32778b){if(_0x32778b){return _0x32778b[_0xceec('0x21')](_0x230c88)['then'](function(_0xd2a397){return _0xd2a397;});}return null;};}function removeEntity(_0x59922b,_0x2b8fd5){return function(_0x3d628f){if(_0x3d628f){return _0x3d628f['destroy']()[_0xceec('0x22')](function(){_0x59922b['status'](0xcc)[_0xceec('0x17')]();});}};}function handleEntityNotFound(_0x133a83,_0x3600cb){return function(_0x1a7fd){if(!_0x1a7fd){_0x133a83[_0xceec('0x16')](0x194);}return _0x1a7fd;};}function handleError(_0x217c72,_0x35ce70){_0x35ce70=_0x35ce70||0x1f4;return function(_0x505b99){logger[_0xceec('0x23')](_0x505b99['stack']);if(_0x505b99[_0xceec('0x24')]){delete _0x505b99[_0xceec('0x24')];}_0x217c72[_0xceec('0x18')](_0x35ce70)[_0xceec('0x25')](_0x505b99);};}exports[_0xceec('0x26')]=function(_0x2cb07d,_0x591fe2){var _0x2cebb0={},_0x55506f={},_0x1eddcc={'count':0x0,'rows':[]};var _0x3b3923=db[_0xceec('0x27')][_0xceec('0x28')];_0x55506f[_0xceec('0x29')]=_[_0xceec('0x2a')](_0x3b3923);_0x55506f[_0xceec('0x2b')]=_[_0xceec('0x2a')](_0x2cb07d[_0xceec('0x2b')]);_0x55506f['filters']=_[_0xceec('0x2c')](_0x55506f[_0xceec('0x29')],_0x55506f[_0xceec('0x2b')]);_0x2cebb0[_0xceec('0x2d')]=_[_0xceec('0x2c')](_0x55506f[_0xceec('0x29')],qs[_0xceec('0x2e')](_0x2cb07d[_0xceec('0x2b')]['fields']));_0x2cebb0[_0xceec('0x2d')]=_0x2cebb0[_0xceec('0x2d')][_0xceec('0x2f')]?_0x2cebb0['attributes']:_0x55506f['model'];if(!_0x2cb07d[_0xceec('0x2b')]['hasOwnProperty'](_0xceec('0x30'))){_0x2cebb0['limit']=qs[_0xceec('0x1b')](_0x2cb07d[_0xceec('0x2b')][_0xceec('0x1b')]);_0x2cebb0[_0xceec('0x1a')]=qs['offset'](_0x2cb07d['query'][_0xceec('0x1a')]);}_0x2cebb0[_0xceec('0x31')]=qs['sort'](_0x2cb07d['query'][_0xceec('0x32')]);_0x2cebb0[_0xceec('0x33')]=qs[_0xceec('0x34')](_['pick'](_0x2cb07d[_0xceec('0x2b')],_0x55506f['filters']));if(_0x2cb07d['query'][_0xceec('0x35')]){_0x2cebb0['where']=_[_0xceec('0x36')](_0x2cebb0[_0xceec('0x33')],{'$or':_['map'](_0x3b3923,function(_0x783cf7){if(_0x783cf7['type'][_0xceec('0x37')]!==_0xceec('0x38')){var _0x54ae24={};_0x54ae24[_0x783cf7['field']]={'$like':'%'+_0x2cb07d[_0xceec('0x2b')][_0xceec('0x35')]+'%'};return _0x54ae24;}})});}_0x2cebb0=_[_0xceec('0x36')]({},_0x2cebb0,_0x2cb07d[_0xceec('0x39')]);var _0x50ca22={'where':_0x2cebb0[_0xceec('0x33')]};return db[_0xceec('0x27')][_0xceec('0x19')](_0x50ca22)[_0xceec('0x22')](function(_0x308d37){_0x1eddcc[_0xceec('0x19')]=_0x308d37;if(_0x2cb07d[_0xceec('0x2b')][_0xceec('0x3a')]){_0x2cebb0['include']=[{'all':!![]}];}return db[_0xceec('0x27')]['findAll'](_0x2cebb0);})['then'](function(_0x479178){_0x1eddcc[_0xceec('0x3b')]=_0x479178;return _0x1eddcc;})[_0xceec('0x22')](respondWithFilteredResult(_0x591fe2,_0x2cebb0))[_0xceec('0x3c')](handleError(_0x591fe2,null));};exports[_0xceec('0x3d')]=function(_0xcd3c9c,_0x42036d){var _0x231b39={'raw':!![],'where':{'id':_0xcd3c9c[_0xceec('0x3e')]['id']}},_0x5f26eb={};_0x5f26eb[_0xceec('0x29')]=_[_0xceec('0x2a')](db[_0xceec('0x27')][_0xceec('0x28')]);_0x5f26eb[_0xceec('0x2b')]=_[_0xceec('0x2a')](_0xcd3c9c['query']);_0x5f26eb[_0xceec('0x34')]=_[_0xceec('0x2c')](_0x5f26eb['model'],_0x5f26eb[_0xceec('0x2b')]);_0x231b39[_0xceec('0x2d')]=_[_0xceec('0x2c')](_0x5f26eb[_0xceec('0x29')],qs[_0xceec('0x2e')](_0xcd3c9c[_0xceec('0x2b')][_0xceec('0x2e')]));_0x231b39[_0xceec('0x2d')]=_0x231b39[_0xceec('0x2d')][_0xceec('0x2f')]?_0x231b39[_0xceec('0x2d')]:_0x5f26eb[_0xceec('0x29')];if(_0xcd3c9c['query']['includeAll']){_0x231b39[_0xceec('0x3f')]=[{'all':!![]}];}_0x231b39=_['merge']({},_0x231b39,_0xcd3c9c[_0xceec('0x39')]);return db['SmsQueueReport'][_0xceec('0x40')](_0x231b39)[_0xceec('0x22')](handleEntityNotFound(_0x42036d,null))[_0xceec('0x22')](respondWithResult(_0x42036d,null))[_0xceec('0x3c')](handleError(_0x42036d,null));};exports['create']=function(_0x2dccdb,_0x24aa6f){return db[_0xceec('0x27')]['create'](_0x2dccdb[_0xceec('0x41')],{})[_0xceec('0x22')](respondWithResult(_0x24aa6f,0xc9))[_0xceec('0x3c')](handleError(_0x24aa6f,null));};exports[_0xceec('0x21')]=function(_0x30dad2,_0x53f9ab){if(_0x30dad2[_0xceec('0x41')]['id']){delete _0x30dad2[_0xceec('0x41')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x30dad2[_0xceec('0x3e')]['id']}})[_0xceec('0x22')](handleEntityNotFound(_0x53f9ab,null))['then'](saveUpdates(_0x30dad2[_0xceec('0x41')],null))['then'](respondWithResult(_0x53f9ab,null))[_0xceec('0x3c')](handleError(_0x53f9ab,null));};exports[_0xceec('0x42')]=function(_0x3b9206,_0x42811b){return db[_0xceec('0x27')][_0xceec('0x40')]({'where':{'id':_0x3b9206[_0xceec('0x3e')]['id']}})[_0xceec('0x22')](handleEntityNotFound(_0x42811b,null))[_0xceec('0x22')](removeEntity(_0x42811b,null))[_0xceec('0x3c')](handleError(_0x42811b,null));};exports[_0xceec('0x43')]=function(_0x15f0e4,_0x3b690a){return db[_0xceec('0x27')]['describe']()[_0xceec('0x22')](respondWithResult(_0x3b690a,null))[_0xceec('0x3c')](handleError(_0x3b690a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2eed376..287bd29 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 _0x055a=['path','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x550d1b,_0x32e763){var _0x2a35be=function(_0x5e4c18){while(--_0x5e4c18){_0x550d1b['push'](_0x550d1b['shift']());}};_0x2a35be(++_0x32e763);}(_0x055a,0xae));var _0xa055=function(_0x72e297,_0x4ec504){_0x72e297=_0x72e297-0x0;var _0x37f261=_0x055a[_0x72e297];return _0x37f261;};'use strict';var _=require(_0xa055('0x0'));var util=require('util');var logger=require(_0xa055('0x1'))(_0xa055('0x2'));var moment=require(_0xa055('0x3'));var BPromise=require(_0xa055('0x4'));var rp=require(_0xa055('0x5'));var fs=require('fs');var path=require(_0xa055('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa055('0x7'));module[_0xa055('0x8')]=function(_0x8d110e,_0x4e063d){return _0x8d110e[_0xa055('0x9')]('SmsQueueReport',attributes,{'tableName':_0xa055('0xa'),'paranoid':![],'indexes':[{'name':_0xa055('0xb'),'fields':[_0xa055('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd371=['define','SmsQueueReport','report_sms_queue','uniqueid','moment','path','rimraf'];(function(_0x43139e,_0x762629){var _0x2bc838=function(_0x593ec3){while(--_0x593ec3){_0x43139e['push'](_0x43139e['shift']());}};_0x2bc838(++_0x762629);}(_0xd371,0x1d2));var _0x1d37=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0xd371[_0x544072];return _0x590bf6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1d37('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d37('0x1'));var rimraf=require(_0x1d37('0x2'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x14c2db,_0x4b3df0){return _0x14c2db[_0x1d37('0x3')](_0x1d37('0x4'),attributes,{'tableName':_0x1d37('0x5'),'paranoid':![],'indexes':[{'name':_0x1d37('0x6'),'fields':[_0x1d37('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 971a816..139dc15 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 _0x1a5d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','message','SmsQueueReport,\x20%s,\x20%s','CreateSmsQueueReport','create','options','then','UpdateSmsQueueReport','attributes','stringify','catch'];(function(_0x33925b,_0x95cfc6){var _0x375e21=function(_0x57c759){while(--_0x57c759){_0x33925b['push'](_0x33925b['shift']());}};_0x375e21(++_0x95cfc6);}(_0x1a5d,0xe0));var _0xd1a5=function(_0x1156bc,_0x39f479){_0x1156bc=_0x1156bc-0x0;var _0x2e0a54=_0x1a5d[_0x1156bc];return _0x2e0a54;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd1a5('0x0'));var BPromise=require(_0xd1a5('0x1'));var rs=require(_0xd1a5('0x2'));var fs=require('fs');var Redis=require(_0xd1a5('0x3'));var db=require(_0xd1a5('0x4'))['db'];var utils=require(_0xd1a5('0x5'));var logger=require(_0xd1a5('0x6'))(_0xd1a5('0x7'));var config=require(_0xd1a5('0x8'));var jayson=require(_0xd1a5('0x9'));var client=jayson[_0xd1a5('0xa')][_0xd1a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc45a,_0x1c21d8,_0x1d2e27){return new BPromise(function(_0xf5a00a,_0x2ba236){return client[_0xd1a5('0xc')](_0x5dc45a,_0x1d2e27)['then'](function(_0x576554){logger[_0xd1a5('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x1c21d8,_0xd1a5('0xe'));logger[_0xd1a5('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1c21d8,_0xd1a5('0xe'),JSON['stringify'](_0x576554));if(_0x576554[_0xd1a5('0x10')]){if(_0x576554[_0xd1a5('0x10')][_0xd1a5('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1c21d8,_0x576554['error']['message']);return _0x2ba236(_0x576554[_0xd1a5('0x10')][_0xd1a5('0x12')]);}logger[_0xd1a5('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x1c21d8,_0x576554[_0xd1a5('0x10')][_0xd1a5('0x12')]);return _0xf5a00a(_0x576554[_0xd1a5('0x10')][_0xd1a5('0x12')]);}else{logger[_0xd1a5('0xd')](_0xd1a5('0x13'),_0x1c21d8,_0xd1a5('0xe'));_0xf5a00a(_0x576554['result']['message']);}})['catch'](function(_0x406582){logger[_0xd1a5('0x10')](_0xd1a5('0x13'),_0x1c21d8,_0x406582);_0x2ba236(_0x406582);});});}exports[_0xd1a5('0x14')]=function(_0x5f249f){var _0x349675=this;return new Promise(function(_0x2bbc33,_0x1a4dda){return db['SmsQueueReport'][_0xd1a5('0x15')](_0x5f249f['body'],{'raw':_0x5f249f[_0xd1a5('0x16')]?_0x5f249f['options']['raw']===undefined?!![]:![]:!![]})[_0xd1a5('0x17')](function(_0x2df839){logger['info'](_0xd1a5('0x14'),_0x5f249f);logger['debug'](_0xd1a5('0x14'),_0x5f249f,JSON['stringify'](_0x2df839));_0x2bbc33(_0x2df839);})['catch'](function(_0x92a680){logger[_0xd1a5('0x10')](_0xd1a5('0x14'),_0x92a680[_0xd1a5('0x12')],_0x5f249f);_0x1a4dda(_0x349675['error'](0x1f4,_0x92a680[_0xd1a5('0x12')]));});});};exports[_0xd1a5('0x18')]=function(_0x555c27){var _0x3c8297=this;return new Promise(function(_0x5e6a25,_0x15afe7){return db['SmsQueueReport']['update'](_0x555c27['body'],{'raw':_0x555c27[_0xd1a5('0x16')]?_0x555c27['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555c27[_0xd1a5('0x16')]?_0x555c27['options']['where']||null:null,'attributes':_0x555c27['options']?_0x555c27[_0xd1a5('0x16')][_0xd1a5('0x19')]||null:null,'limit':_0x555c27['options']?_0x555c27[_0xd1a5('0x16')]['limit']||null:null})[_0xd1a5('0x17')](function(_0x43f55c){logger[_0xd1a5('0xd')](_0xd1a5('0x18'),_0x555c27);logger['debug'](_0xd1a5('0x18'),_0x555c27,JSON[_0xd1a5('0x1a')](_0x43f55c));_0x5e6a25(_0x43f55c);})[_0xd1a5('0x1b')](function(_0x213486){logger[_0xd1a5('0x10')](_0xd1a5('0x18'),_0x213486[_0xd1a5('0x12')],_0x555c27);_0x15afe7(_0x3c8297[_0xd1a5('0x10')](0x1f4,_0x213486[_0xd1a5('0x12')]));});});}; \ No newline at end of file +var _0xc604=['SmsQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','CreateSmsQueueReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc604,0x113));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c60('0x0'));var util=require(_0x4c60('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c60('0x2'));var fs=require('fs');var Redis=require(_0x4c60('0x3'));var db=require(_0x4c60('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c60('0x5'))(_0x4c60('0x6'));var config=require(_0x4c60('0x7'));var jayson=require(_0x4c60('0x8'));var client=jayson[_0x4c60('0x9')][_0x4c60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e429f,_0x335c62,_0x16d5bf){return new BPromise(function(_0x526f6b,_0x361a9a){return client[_0x4c60('0xb')](_0x4e429f,_0x16d5bf)[_0x4c60('0xc')](function(_0x3f70f9){logger[_0x4c60('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x335c62,'request\x20sent');logger[_0x4c60('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x335c62,'request\x20sent',JSON[_0x4c60('0xf')](_0x3f70f9));if(_0x3f70f9[_0x4c60('0x10')]){if(_0x3f70f9[_0x4c60('0x10')][_0x4c60('0x11')]===0x1f4){logger[_0x4c60('0x10')](_0x4c60('0x12'),_0x335c62,_0x3f70f9[_0x4c60('0x10')]['message']);return _0x361a9a(_0x3f70f9[_0x4c60('0x10')]['message']);}logger[_0x4c60('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x335c62,_0x3f70f9['error'][_0x4c60('0x13')]);return _0x526f6b(_0x3f70f9[_0x4c60('0x10')][_0x4c60('0x13')]);}else{logger[_0x4c60('0xd')](_0x4c60('0x12'),_0x335c62,_0x4c60('0x14'));_0x526f6b(_0x3f70f9['result'][_0x4c60('0x13')]);}})['catch'](function(_0x2daf3c){logger[_0x4c60('0x10')](_0x4c60('0x12'),_0x335c62,_0x2daf3c);_0x361a9a(_0x2daf3c);});});}exports[_0x4c60('0x15')]=function(_0x52feb7){var _0x1413e9=this;return new Promise(function(_0x5c5852,_0x1867fd){return db[_0x4c60('0x16')][_0x4c60('0x17')](_0x52feb7[_0x4c60('0x18')],{'raw':_0x52feb7[_0x4c60('0x19')]?_0x52feb7['options'][_0x4c60('0x1a')]===undefined?!![]:![]:!![]})[_0x4c60('0xc')](function(_0x400dac){logger[_0x4c60('0xd')]('CreateSmsQueueReport',_0x52feb7);logger['debug'](_0x4c60('0x15'),_0x52feb7,JSON[_0x4c60('0xf')](_0x400dac));_0x5c5852(_0x400dac);})['catch'](function(_0x13dfbe){logger[_0x4c60('0x10')](_0x4c60('0x15'),_0x13dfbe[_0x4c60('0x13')],_0x52feb7);_0x1867fd(_0x1413e9[_0x4c60('0x10')](0x1f4,_0x13dfbe[_0x4c60('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x57017c){var _0x6506c4=this;return new Promise(function(_0x7ac4e8,_0x4894b3){return db['SmsQueueReport'][_0x4c60('0x1b')](_0x57017c['body'],{'raw':_0x57017c[_0x4c60('0x19')]?_0x57017c[_0x4c60('0x19')][_0x4c60('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57017c[_0x4c60('0x19')]?_0x57017c[_0x4c60('0x19')][_0x4c60('0x1c')]||null:null,'attributes':_0x57017c[_0x4c60('0x19')]?_0x57017c[_0x4c60('0x19')][_0x4c60('0x1d')]||null:null,'limit':_0x57017c[_0x4c60('0x19')]?_0x57017c['options'][_0x4c60('0x1e')]||null:null})['then'](function(_0x106588){logger[_0x4c60('0xd')](_0x4c60('0x1f'),_0x57017c);logger[_0x4c60('0xe')](_0x4c60('0x1f'),_0x57017c,JSON[_0x4c60('0xf')](_0x106588));_0x7ac4e8(_0x106588);})[_0x4c60('0x20')](function(_0x36185c){logger[_0x4c60('0x10')](_0x4c60('0x1f'),_0x36185c[_0x4c60('0x13')],_0x57017c);_0x4894b3(_0x6506c4[_0x4c60('0x10')](0x1f4,_0x36185c[_0x4c60('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 34f51ab..e6c29d6 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 _0x640a=['exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','get','/describe','isAuthenticated','/:id','post','create','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x640a,0x133));var _0xa640=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x640a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xa640('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa640('0x1'));var express=require(_0xa640('0x2'));var router=express['Router']();var auth=require(_0xa640('0x3'));var interaction=require(_0xa640('0x4'));var config=require(_0xa640('0x5'));var controller=require(_0xa640('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa640('0x7')]);router[_0xa640('0x8')](_0xa640('0x9'),auth[_0xa640('0xa')](),controller['describe']);router[_0xa640('0x8')](_0xa640('0xb'),auth[_0xa640('0xa')](),controller['show']);router[_0xa640('0xc')]('/',auth[_0xa640('0xa')](),controller[_0xa640('0xd')]);router['put'](_0xa640('0xb'),auth[_0xa640('0xa')](),controller[_0xa640('0xe')]);router['delete'](_0xa640('0xb'),auth[_0xa640('0xa')](),controller[_0xa640('0xf')]);module[_0xa640('0x10')]=router; \ No newline at end of file +var _0xc546=['isAuthenticated','index','/describe','describe','show','create','/:id','update','delete','exports','path','connect-timeout','express','Router','../../config/environment','get'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0xc546,0x6a));var _0x6c54=function(_0x138024,_0x181ed6){_0x138024=_0x138024-0x0;var _0x247bcd=_0xc546[_0x138024];return _0x247bcd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c54('0x0'));var timeout=require(_0x6c54('0x1'));var express=require(_0x6c54('0x2'));var router=express[_0x6c54('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c54('0x4'));var controller=require('./smsTransferReport.controller');router[_0x6c54('0x5')]('/',auth[_0x6c54('0x6')](),controller[_0x6c54('0x7')]);router[_0x6c54('0x5')](_0x6c54('0x8'),auth[_0x6c54('0x6')](),controller[_0x6c54('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6c54('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c54('0xb')]);router['put'](_0x6c54('0xc'),auth[_0x6c54('0x6')](),controller[_0x6c54('0xd')]);router[_0x6c54('0xe')](_0x6c54('0xc'),auth[_0x6c54('0x6')](),controller['destroy']);module[_0x6c54('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index b79f580..bab46d2 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 _0x63fa=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x63fa,0x6b));var _0xa63f=function(_0x343f3a,_0x1eeb60){_0x343f3a=_0x343f3a-0x0;var _0x492e66=_0x63fa[_0x343f3a];return _0x492e66;};'use strict';var moment=require(_0xa63f('0x0'));var Sequelize=require('sequelize');module[_0xa63f('0x1')]={'uniqueid':{'type':Sequelize[_0xa63f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa63f('0x3')](_0xa63f('0x4'),_0xa63f('0x5'),_0xa63f('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa63f('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa63f('0x8')]}}; \ No newline at end of file +var _0x9b9a=['account','agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0x18d872,_0x36a840){var _0x1f4a8a=function(_0x1e8841){while(--_0x1e8841){_0x18d872['push'](_0x18d872['shift']());}};_0x1f4a8a(++_0x36a840);}(_0x9b9a,0x125));var _0xa9b9=function(_0xde2e2e,_0x5000c3){_0xde2e2e=_0xde2e2e-0x0;var _0x7be9b4=_0x9b9a[_0xde2e2e];return _0x7be9b4;};'use strict';var moment=require('moment');var Sequelize=require(_0xa9b9('0x0'));module[_0xa9b9('0x1')]={'uniqueid':{'type':Sequelize[_0xa9b9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa9b9('0x3')](_0xa9b9('0x4'),_0xa9b9('0x5'),_0xa9b9('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa9b9('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa9b9('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 9158335..f02ff19 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 _0x2978=['fields','attributes','length','hasOwnProperty','pick','filters','filter','where','type','key','VIRTUAL','field','merge','includeAll','include','SmsTransferReport','rows','catch','show','options','create','body','find','params','describe','html-pdf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','name','send','rawAttributes','model','keys','query','intersection'];(function(_0x3c65ba,_0xd4ca16){var _0x4d256c=function(_0x691ece){while(--_0x691ece){_0x3c65ba['push'](_0x3c65ba['shift']());}};_0x4d256c(++_0xd4ca16);}(_0x2978,0x18d));var _0x8297=function(_0x4f9544,_0x34fab3){_0x4f9544=_0x4f9544-0x0;var _0x3680b4=_0x2978[_0x4f9544];return _0x3680b4;};'use strict';var pdf=require(_0x8297('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8297('0x1'));var rp=require(_0x8297('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8297('0x3'));var util=require(_0x8297('0x4'));var path=require(_0x8297('0x5'));var sox=require(_0x8297('0x6'));var csv=require(_0x8297('0x7'));var ejs=require(_0x8297('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8297('0x9'));var jsforce=require(_0x8297('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8297('0x7'));var querystring=require('querystring');var Papa=require(_0x8297('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8297('0xc'));var hardwareService=require(_0x8297('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x8297('0xe'));var config=require(_0x8297('0xf'));var db=require(_0x8297('0x10'))['db'];function respondWithStatusCode(_0x3e1425,_0xe6f3b3){_0xe6f3b3=_0xe6f3b3||0xcc;return function(_0x2b829f){if(_0x2b829f){return _0x3e1425[_0x8297('0x11')](_0xe6f3b3);}return _0x3e1425[_0x8297('0x12')](_0xe6f3b3)[_0x8297('0x13')]();};}function respondWithResult(_0x3add22,_0x4d6b5a){_0x4d6b5a=_0x4d6b5a||0xc8;return function(_0x18f588){if(_0x18f588){return _0x3add22[_0x8297('0x12')](_0x4d6b5a)[_0x8297('0x14')](_0x18f588);}};}function respondWithFilteredResult(_0x343789,_0x5e5b3d){return function(_0x441a80){if(_0x441a80){var _0x3ab155=_0x441a80[_0x8297('0x15')],_0x3dd7cc=_0x5e5b3d[_0x8297('0x16')],_0x193368=_0x5e5b3d['offset']+_0x5e5b3d['limit'],_0x1952da;if(_0x193368>=_0x3ab155){_0x193368=_0x3ab155;_0x1952da=0xc8;}else{_0x1952da=0xce;}_0x343789[_0x8297('0x12')](_0x1952da);return _0x343789[_0x8297('0x17')](_0x8297('0x18'),_0x3dd7cc+'-'+_0x193368+'/'+_0x3ab155)['json'](_0x441a80);}return null;};}function patchUpdates(_0x9ac2fe){return function(_0x4d95ea){try{jsonpatch['apply'](_0x4d95ea,_0x9ac2fe,!![]);}catch(_0x37f91d){return BPromise[_0x8297('0x19')](_0x37f91d);}return _0x4d95ea[_0x8297('0x1a')]();};}function saveUpdates(_0x41eaf1,_0x3a848a){return function(_0x3d9b5d){if(_0x3d9b5d){return _0x3d9b5d[_0x8297('0x1b')](_0x41eaf1)['then'](function(_0x112f53){return _0x112f53;});}return null;};}function removeEntity(_0x530f43,_0x368765){return function(_0x43950e){if(_0x43950e){return _0x43950e['destroy']()[_0x8297('0x1c')](function(){_0x530f43[_0x8297('0x12')](0xcc)[_0x8297('0x13')]();});}};}function handleEntityNotFound(_0x329f04,_0x425dc8){return function(_0x551c43){if(!_0x551c43){_0x329f04[_0x8297('0x11')](0x194);}return _0x551c43;};}function handleError(_0x2e53d5,_0x44e726){_0x44e726=_0x44e726||0x1f4;return function(_0x9dcce9){logger[_0x8297('0x1d')](_0x9dcce9['stack']);if(_0x9dcce9[_0x8297('0x1e')]){delete _0x9dcce9[_0x8297('0x1e')];}_0x2e53d5[_0x8297('0x12')](_0x44e726)[_0x8297('0x1f')](_0x9dcce9);};}exports['index']=function(_0x469754,_0x3f6567){var _0x28470f={},_0x37a1fa={},_0x5e506a={'count':0x0,'rows':[]};var _0x5bcf2b=db['SmsTransferReport'][_0x8297('0x20')];_0x37a1fa[_0x8297('0x21')]=_[_0x8297('0x22')](_0x5bcf2b);_0x37a1fa[_0x8297('0x23')]=_['keys'](_0x469754['query']);_0x37a1fa['filters']=_['intersection'](_0x37a1fa[_0x8297('0x21')],_0x37a1fa['query']);_0x28470f['attributes']=_[_0x8297('0x24')](_0x37a1fa['model'],qs[_0x8297('0x25')](_0x469754[_0x8297('0x23')]['fields']));_0x28470f[_0x8297('0x26')]=_0x28470f[_0x8297('0x26')][_0x8297('0x27')]?_0x28470f[_0x8297('0x26')]:_0x37a1fa[_0x8297('0x21')];if(!_0x469754[_0x8297('0x23')][_0x8297('0x28')]('nolimit')){_0x28470f['limit']=qs['limit'](_0x469754[_0x8297('0x23')]['limit']);_0x28470f[_0x8297('0x16')]=qs[_0x8297('0x16')](_0x469754[_0x8297('0x23')][_0x8297('0x16')]);}_0x28470f['order']=qs['sort'](_0x469754[_0x8297('0x23')]['sort']);_0x28470f['where']=qs['filters'](_[_0x8297('0x29')](_0x469754['query'],_0x37a1fa[_0x8297('0x2a')]));if(_0x469754[_0x8297('0x23')][_0x8297('0x2b')]){_0x28470f[_0x8297('0x2c')]=_['merge'](_0x28470f['where'],{'$or':_['map'](_0x5bcf2b,function(_0x270299){if(_0x270299[_0x8297('0x2d')][_0x8297('0x2e')]!==_0x8297('0x2f')){var _0x31bb04={};_0x31bb04[_0x270299[_0x8297('0x30')]]={'$like':'%'+_0x469754[_0x8297('0x23')][_0x8297('0x2b')]+'%'};return _0x31bb04;}})});}_0x28470f=_[_0x8297('0x31')]({},_0x28470f,_0x469754['options']);var _0xd58162={'where':_0x28470f['where']};return db['SmsTransferReport']['count'](_0xd58162)['then'](function(_0x4e8e49){_0x5e506a[_0x8297('0x15')]=_0x4e8e49;if(_0x469754[_0x8297('0x23')][_0x8297('0x32')]){_0x28470f[_0x8297('0x33')]=[{'all':!![]}];}return db[_0x8297('0x34')]['findAll'](_0x28470f);})[_0x8297('0x1c')](function(_0x53bfef){_0x5e506a[_0x8297('0x35')]=_0x53bfef;return _0x5e506a;})[_0x8297('0x1c')](respondWithFilteredResult(_0x3f6567,_0x28470f))[_0x8297('0x36')](handleError(_0x3f6567,null));};exports[_0x8297('0x37')]=function(_0x399631,_0x10c802){var _0x2625e1={'raw':!![],'where':{'id':_0x399631['params']['id']}},_0x4a4ee8={};_0x4a4ee8['model']=_[_0x8297('0x22')](db[_0x8297('0x34')][_0x8297('0x20')]);_0x4a4ee8[_0x8297('0x23')]=_[_0x8297('0x22')](_0x399631[_0x8297('0x23')]);_0x4a4ee8['filters']=_['intersection'](_0x4a4ee8[_0x8297('0x21')],_0x4a4ee8[_0x8297('0x23')]);_0x2625e1[_0x8297('0x26')]=_[_0x8297('0x24')](_0x4a4ee8[_0x8297('0x21')],qs[_0x8297('0x25')](_0x399631[_0x8297('0x23')]['fields']));_0x2625e1['attributes']=_0x2625e1[_0x8297('0x26')][_0x8297('0x27')]?_0x2625e1[_0x8297('0x26')]:_0x4a4ee8[_0x8297('0x21')];if(_0x399631['query'][_0x8297('0x32')]){_0x2625e1[_0x8297('0x33')]=[{'all':!![]}];}_0x2625e1=_[_0x8297('0x31')]({},_0x2625e1,_0x399631[_0x8297('0x38')]);return db[_0x8297('0x34')]['find'](_0x2625e1)[_0x8297('0x1c')](handleEntityNotFound(_0x10c802,null))[_0x8297('0x1c')](respondWithResult(_0x10c802,null))[_0x8297('0x36')](handleError(_0x10c802,null));};exports[_0x8297('0x39')]=function(_0x4f356c,_0x56b156){return db[_0x8297('0x34')][_0x8297('0x39')](_0x4f356c[_0x8297('0x3a')],{})[_0x8297('0x1c')](respondWithResult(_0x56b156,0xc9))[_0x8297('0x36')](handleError(_0x56b156,null));};exports[_0x8297('0x1b')]=function(_0x4bad0b,_0x4788fd){if(_0x4bad0b[_0x8297('0x3a')]['id']){delete _0x4bad0b['body']['id'];}return db[_0x8297('0x34')][_0x8297('0x3b')]({'where':{'id':_0x4bad0b[_0x8297('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4788fd,null))[_0x8297('0x1c')](saveUpdates(_0x4bad0b[_0x8297('0x3a')],null))[_0x8297('0x1c')](respondWithResult(_0x4788fd,null))[_0x8297('0x36')](handleError(_0x4788fd,null));};exports['destroy']=function(_0x128dc0,_0xc17143){return db[_0x8297('0x34')][_0x8297('0x3b')]({'where':{'id':_0x128dc0[_0x8297('0x3c')]['id']}})[_0x8297('0x1c')](handleEntityNotFound(_0xc17143,null))['then'](removeEntity(_0xc17143,null))['catch'](handleError(_0xc17143,null));};exports[_0x8297('0x3d')]=function(_0x5dad7a,_0x53ee04){return db[_0x8297('0x34')][_0x8297('0x3d')]()['then'](respondWithResult(_0x53ee04,null))[_0x8297('0x36')](handleError(_0x53ee04,null));}; \ No newline at end of file +var _0x322d=['key','VIRTUAL','field','SmsTransferReport','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','error','name','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','type'];(function(_0x14431e,_0xa070f9){var _0x5ebc5b=function(_0x3c65e8){while(--_0x3c65e8){_0x14431e['push'](_0x14431e['shift']());}};_0x5ebc5b(++_0xa070f9);}(_0x322d,0x175));var _0xd322=function(_0x1edf39,_0x34dd64){_0x1edf39=_0x1edf39-0x0;var _0x5c842b=_0x322d[_0x1edf39];return _0x5c842b;};'use strict';var pdf=require(_0xd322('0x0'));var emlformat=require(_0xd322('0x1'));var rimraf=require(_0xd322('0x2'));var zipdir=require(_0xd322('0x3'));var jsonpatch=require(_0xd322('0x4'));var rp=require(_0xd322('0x5'));var moment=require(_0xd322('0x6'));var BPromise=require(_0xd322('0x7'));var Mustache=require(_0xd322('0x8'));var util=require(_0xd322('0x9'));var path=require(_0xd322('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd322('0xb'));var fs=require('fs');var _=require(_0xd322('0xc'));var squel=require(_0xd322('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd322('0xe'));var toCsv=require(_0xd322('0xf'));var querystring=require(_0xd322('0x10'));var Papa=require('papaparse');var Redis=require(_0xd322('0x11'));var authService=require(_0xd322('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd322('0x13'));var logger=require('../../config/logger')(_0xd322('0x14'));var utils=require(_0xd322('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14f2d8,_0x9fdc8e){_0x9fdc8e=_0x9fdc8e||0xcc;return function(_0x57d662){if(_0x57d662){return _0x14f2d8[_0xd322('0x16')](_0x9fdc8e);}return _0x14f2d8[_0xd322('0x17')](_0x9fdc8e)[_0xd322('0x18')]();};}function respondWithResult(_0x11ef01,_0x57edc8){_0x57edc8=_0x57edc8||0xc8;return function(_0x36d297){if(_0x36d297){return _0x11ef01[_0xd322('0x17')](_0x57edc8)['json'](_0x36d297);}};}function respondWithFilteredResult(_0x50a536,_0x1386af){return function(_0x19877f){if(_0x19877f){var _0x8031e2=_0x19877f[_0xd322('0x19')],_0x35fe9d=_0x1386af[_0xd322('0x1a')],_0x23238e=_0x1386af[_0xd322('0x1a')]+_0x1386af[_0xd322('0x1b')],_0x52fc55;if(_0x23238e>=_0x8031e2){_0x23238e=_0x8031e2;_0x52fc55=0xc8;}else{_0x52fc55=0xce;}_0x50a536[_0xd322('0x17')](_0x52fc55);return _0x50a536[_0xd322('0x1c')](_0xd322('0x1d'),_0x35fe9d+'-'+_0x23238e+'/'+_0x8031e2)[_0xd322('0x1e')](_0x19877f);}return null;};}function patchUpdates(_0x5eba7d){return function(_0x26a8c6){try{jsonpatch['apply'](_0x26a8c6,_0x5eba7d,!![]);}catch(_0x498a21){return BPromise['reject'](_0x498a21);}return _0x26a8c6[_0xd322('0x1f')]();};}function saveUpdates(_0x1cf37c,_0x186a2a){return function(_0x2f5434){if(_0x2f5434){return _0x2f5434['update'](_0x1cf37c)[_0xd322('0x20')](function(_0x11722d){return _0x11722d;});}return null;};}function removeEntity(_0x1dd4da,_0x2eaa2a){return function(_0x3a59a6){if(_0x3a59a6){return _0x3a59a6['destroy']()[_0xd322('0x20')](function(){_0x1dd4da[_0xd322('0x17')](0xcc)[_0xd322('0x18')]();});}};}function handleEntityNotFound(_0x48b6d6,_0x985920){return function(_0x1a4157){if(!_0x1a4157){_0x48b6d6[_0xd322('0x16')](0x194);}return _0x1a4157;};}function handleError(_0x105955,_0x71c6ef){_0x71c6ef=_0x71c6ef||0x1f4;return function(_0x4c30c7){logger[_0xd322('0x21')](_0x4c30c7['stack']);if(_0x4c30c7['name']){delete _0x4c30c7[_0xd322('0x22')];}_0x105955['status'](_0x71c6ef)['send'](_0x4c30c7);};}exports['index']=function(_0x1f1ade,_0x4d8e06){var _0x4165ec={},_0x3c1b22={},_0x197a0d={'count':0x0,'rows':[]};var _0x2b70f5=db['SmsTransferReport'][_0xd322('0x23')];_0x3c1b22['model']=_[_0xd322('0x24')](_0x2b70f5);_0x3c1b22[_0xd322('0x25')]=_[_0xd322('0x24')](_0x1f1ade[_0xd322('0x25')]);_0x3c1b22[_0xd322('0x26')]=_[_0xd322('0x27')](_0x3c1b22['model'],_0x3c1b22['query']);_0x4165ec['attributes']=_[_0xd322('0x27')](_0x3c1b22[_0xd322('0x28')],qs['fields'](_0x1f1ade[_0xd322('0x25')][_0xd322('0x29')]));_0x4165ec[_0xd322('0x2a')]=_0x4165ec[_0xd322('0x2a')][_0xd322('0x2b')]?_0x4165ec[_0xd322('0x2a')]:_0x3c1b22[_0xd322('0x28')];if(!_0x1f1ade['query']['hasOwnProperty'](_0xd322('0x2c'))){_0x4165ec[_0xd322('0x1b')]=qs[_0xd322('0x1b')](_0x1f1ade[_0xd322('0x25')]['limit']);_0x4165ec[_0xd322('0x1a')]=qs[_0xd322('0x1a')](_0x1f1ade[_0xd322('0x25')]['offset']);}_0x4165ec[_0xd322('0x2d')]=qs['sort'](_0x1f1ade['query'][_0xd322('0x2e')]);_0x4165ec[_0xd322('0x2f')]=qs[_0xd322('0x26')](_[_0xd322('0x30')](_0x1f1ade[_0xd322('0x25')],_0x3c1b22[_0xd322('0x26')]));if(_0x1f1ade[_0xd322('0x25')][_0xd322('0x31')]){_0x4165ec[_0xd322('0x2f')]=_[_0xd322('0x32')](_0x4165ec[_0xd322('0x2f')],{'$or':_[_0xd322('0x33')](_0x2b70f5,function(_0x37e0fc){if(_0x37e0fc[_0xd322('0x34')][_0xd322('0x35')]!==_0xd322('0x36')){var _0xfaaa7={};_0xfaaa7[_0x37e0fc[_0xd322('0x37')]]={'$like':'%'+_0x1f1ade[_0xd322('0x25')]['filter']+'%'};return _0xfaaa7;}})});}_0x4165ec=_[_0xd322('0x32')]({},_0x4165ec,_0x1f1ade['options']);var _0x23abde={'where':_0x4165ec['where']};return db[_0xd322('0x38')][_0xd322('0x19')](_0x23abde)[_0xd322('0x20')](function(_0x452ef2){_0x197a0d[_0xd322('0x19')]=_0x452ef2;if(_0x1f1ade[_0xd322('0x25')][_0xd322('0x39')]){_0x4165ec[_0xd322('0x3a')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xd322('0x3b')](_0x4165ec);})[_0xd322('0x20')](function(_0x38f0b4){_0x197a0d[_0xd322('0x3c')]=_0x38f0b4;return _0x197a0d;})['then'](respondWithFilteredResult(_0x4d8e06,_0x4165ec))[_0xd322('0x3d')](handleError(_0x4d8e06,null));};exports[_0xd322('0x3e')]=function(_0x237bbe,_0x44e91c){var _0x97ca72={'raw':!![],'where':{'id':_0x237bbe['params']['id']}},_0x47a200={};_0x47a200[_0xd322('0x28')]=_[_0xd322('0x24')](db[_0xd322('0x38')][_0xd322('0x23')]);_0x47a200[_0xd322('0x25')]=_[_0xd322('0x24')](_0x237bbe[_0xd322('0x25')]);_0x47a200['filters']=_[_0xd322('0x27')](_0x47a200[_0xd322('0x28')],_0x47a200[_0xd322('0x25')]);_0x97ca72[_0xd322('0x2a')]=_[_0xd322('0x27')](_0x47a200[_0xd322('0x28')],qs[_0xd322('0x29')](_0x237bbe[_0xd322('0x25')]['fields']));_0x97ca72[_0xd322('0x2a')]=_0x97ca72[_0xd322('0x2a')][_0xd322('0x2b')]?_0x97ca72['attributes']:_0x47a200[_0xd322('0x28')];if(_0x237bbe[_0xd322('0x25')][_0xd322('0x39')]){_0x97ca72['include']=[{'all':!![]}];}_0x97ca72=_[_0xd322('0x32')]({},_0x97ca72,_0x237bbe[_0xd322('0x3f')]);return db[_0xd322('0x38')][_0xd322('0x40')](_0x97ca72)[_0xd322('0x20')](handleEntityNotFound(_0x44e91c,null))[_0xd322('0x20')](respondWithResult(_0x44e91c,null))[_0xd322('0x3d')](handleError(_0x44e91c,null));};exports[_0xd322('0x41')]=function(_0x19f399,_0x481043){return db[_0xd322('0x38')][_0xd322('0x41')](_0x19f399[_0xd322('0x42')],{})['then'](respondWithResult(_0x481043,0xc9))[_0xd322('0x3d')](handleError(_0x481043,null));};exports[_0xd322('0x43')]=function(_0x38cb5b,_0x1d0ccb){if(_0x38cb5b[_0xd322('0x42')]['id']){delete _0x38cb5b[_0xd322('0x42')]['id'];}return db[_0xd322('0x38')]['find']({'where':{'id':_0x38cb5b[_0xd322('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d0ccb,null))['then'](saveUpdates(_0x38cb5b[_0xd322('0x42')],null))[_0xd322('0x20')](respondWithResult(_0x1d0ccb,null))['catch'](handleError(_0x1d0ccb,null));};exports[_0xd322('0x45')]=function(_0x153e4e,_0x4915e9){return db[_0xd322('0x38')][_0xd322('0x40')]({'where':{'id':_0x153e4e[_0xd322('0x44')]['id']}})[_0xd322('0x20')](handleEntityNotFound(_0x4915e9,null))[_0xd322('0x20')](removeEntity(_0x4915e9,null))[_0xd322('0x3d')](handleError(_0x4915e9,null));};exports[_0xd322('0x46')]=function(_0x3cf605,_0x4b0e15){return db[_0xd322('0x38')]['describe']()[_0xd322('0x20')](respondWithResult(_0x4b0e15,null))[_0xd322('0x3d')](handleError(_0x4b0e15,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 510c882..2f06534 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 _0x1311=['../../config/environment','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x5cf585,_0x12b407){var _0x546b77=function(_0x25dadc){while(--_0x25dadc){_0x5cf585['push'](_0x5cf585['shift']());}};_0x546b77(++_0x12b407);}(_0x1311,0x19c));var _0x1131=function(_0x346b1d,_0x246ffa){_0x346b1d=_0x346b1d-0x0;var _0xe38a91=_0x1311[_0x346b1d];return _0xe38a91;};'use strict';var _=require(_0x1131('0x0'));var util=require(_0x1131('0x1'));var logger=require(_0x1131('0x2'))('api');var moment=require(_0x1131('0x3'));var BPromise=require(_0x1131('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1131('0x5'));var rimraf=require('rimraf');var config=require(_0x1131('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x1131('0x7')]=function(_0x7d9a84,_0xb4a281){return _0x7d9a84['define'](_0x1131('0x8'),attributes,{'tableName':_0x1131('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1131('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58b7=['path','rimraf','../../config/environment','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x22f20e,_0x41a707){var _0x2215ea=function(_0x321944){while(--_0x321944){_0x22f20e['push'](_0x22f20e['shift']());}};_0x2215ea(++_0x41a707);}(_0x58b7,0x162));var _0x758b=function(_0x40e3f1,_0x15444d){_0x40e3f1=_0x40e3f1-0x0;var _0x542631=_0x58b7[_0x40e3f1];return _0x542631;};'use strict';var _=require(_0x758b('0x0'));var util=require(_0x758b('0x1'));var logger=require(_0x758b('0x2'))(_0x758b('0x3'));var moment=require(_0x758b('0x4'));var BPromise=require(_0x758b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x758b('0x6'));var rimraf=require(_0x758b('0x7'));var config=require(_0x758b('0x8'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x4a6436,_0x86ed5){return _0x4a6436[_0x758b('0x9')](_0x758b('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x758b('0xb'),'fields':[_0x758b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5176b53..59e895e 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 _0x7a12=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x7a12,0xe8));var _0x27a1=function(_0x275895,_0x1e268c){_0x275895=_0x275895-0x0;var _0x34e8ce=_0x7a12[_0x275895];return _0x34e8ce;};'use strict';var _=require(_0x27a1('0x0'));var util=require(_0x27a1('0x1'));var moment=require(_0x27a1('0x2'));var BPromise=require(_0x27a1('0x3'));var rs=require(_0x27a1('0x4'));var fs=require('fs');var Redis=require(_0x27a1('0x5'));var db=require(_0x27a1('0x6'))['db'];var utils=require(_0x27a1('0x7'));var logger=require('../../config/logger')(_0x27a1('0x8'));var config=require(_0x27a1('0x9'));var jayson=require(_0x27a1('0xa'));var client=jayson[_0x27a1('0xb')][_0x27a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xed784f,_0x4a4e2c,_0x3f0bbd){return new BPromise(function(_0x34efbb,_0x5431f4){return client[_0x27a1('0xd')](_0xed784f,_0x3f0bbd)[_0x27a1('0xe')](function(_0x586984){logger[_0x27a1('0xf')](_0x27a1('0x10'),_0x4a4e2c,_0x27a1('0x11'));logger['debug'](_0x27a1('0x12'),_0x4a4e2c,_0x27a1('0x11'),JSON[_0x27a1('0x13')](_0x586984));if(_0x586984[_0x27a1('0x14')]){if(_0x586984[_0x27a1('0x14')][_0x27a1('0x15')]===0x1f4){logger[_0x27a1('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4a4e2c,_0x586984[_0x27a1('0x14')][_0x27a1('0x16')]);return _0x5431f4(_0x586984[_0x27a1('0x14')][_0x27a1('0x16')]);}logger['error'](_0x27a1('0x10'),_0x4a4e2c,_0x586984[_0x27a1('0x14')]['message']);return _0x34efbb(_0x586984['error'][_0x27a1('0x16')]);}else{logger[_0x27a1('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x4a4e2c,_0x27a1('0x11'));_0x34efbb(_0x586984[_0x27a1('0x17')]['message']);}})[_0x27a1('0x18')](function(_0x3efeff){logger[_0x27a1('0x14')](_0x27a1('0x10'),_0x4a4e2c,_0x3efeff);_0x5431f4(_0x3efeff);});});} \ No newline at end of file +var _0x3f96=['request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x3f96,0x1d3));var _0x63f9=function(_0x55f111,_0x555a0e){_0x55f111=_0x55f111-0x0;var _0xbc1b14=_0x3f96[_0x55f111];return _0xbc1b14;};'use strict';var _=require(_0x63f9('0x0'));var util=require(_0x63f9('0x1'));var moment=require(_0x63f9('0x2'));var BPromise=require(_0x63f9('0x3'));var rs=require(_0x63f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63f9('0x5'))['db'];var utils=require(_0x63f9('0x6'));var logger=require(_0x63f9('0x7'))(_0x63f9('0x8'));var config=require(_0x63f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x63f9('0xa')][_0x63f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ca178,_0x3819ad,_0x494484){return new BPromise(function(_0x131280,_0x258200){return client[_0x63f9('0xc')](_0x1ca178,_0x494484)[_0x63f9('0xd')](function(_0x45cb1f){logger[_0x63f9('0xe')](_0x63f9('0xf'),_0x3819ad,_0x63f9('0x10'));logger['debug'](_0x63f9('0x11'),_0x3819ad,_0x63f9('0x10'),JSON['stringify'](_0x45cb1f));if(_0x45cb1f[_0x63f9('0x12')]){if(_0x45cb1f[_0x63f9('0x12')][_0x63f9('0x13')]===0x1f4){logger['error'](_0x63f9('0xf'),_0x3819ad,_0x45cb1f[_0x63f9('0x12')][_0x63f9('0x14')]);return _0x258200(_0x45cb1f[_0x63f9('0x12')][_0x63f9('0x14')]);}logger[_0x63f9('0x12')](_0x63f9('0xf'),_0x3819ad,_0x45cb1f['error'][_0x63f9('0x14')]);return _0x131280(_0x45cb1f['error'][_0x63f9('0x14')]);}else{logger['info'](_0x63f9('0xf'),_0x3819ad,_0x63f9('0x10'));_0x131280(_0x45cb1f[_0x63f9('0x15')][_0x63f9('0x14')]);}})[_0x63f9('0x16')](function(_0x1da33e){logger[_0x63f9('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x3819ad,_0x1da33e);_0x258200(_0x1da33e);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4c0102b..c241e20 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 _0x8213=['create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','join','root','originalname','replace','format','basename','extname','now','post','file'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x8213,0xa1));var _0x3821=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x8213[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0x3821('0x0'));var util=require(_0x3821('0x1'));var path=require(_0x3821('0x2'));var timeout=require(_0x3821('0x3'));var express=require(_0x3821('0x4'));var router=express[_0x3821('0x5')]();var auth=require(_0x3821('0x6'));var interaction=require(_0x3821('0x7'));var config=require('../../config/environment');var controller=require(_0x3821('0x8'));router[_0x3821('0x9')]('/',auth[_0x3821('0xa')](),controller[_0x3821('0xb')]);router['get']('/:id',auth[_0x3821('0xa')](),controller[_0x3821('0xc')]);router[_0x3821('0x9')](_0x3821('0xd'),auth[_0x3821('0xa')](),controller[_0x3821('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ad1d0,_0x5c76d3,_0x1accfb){_0x1accfb(null,path[_0x3821('0xf')](config[_0x3821('0x10')],'server/files/sounds/original/'));},'filename':function(_0x1d4b02,_0x4477fd,_0x41e3bb){_0x4477fd[_0x3821('0x11')]=_0x4477fd[_0x3821('0x11')][_0x3821('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41e3bb(null,util[_0x3821('0x13')]('%s-%s%s',path[_0x3821('0x14')](_0x4477fd[_0x3821('0x11')],path[_0x3821('0x15')](_0x4477fd[_0x3821('0x11')])),Date[_0x3821('0x16')](),path[_0x3821('0x15')](_0x4477fd[_0x3821('0x11')])));}})});router[_0x3821('0x17')]('/',upload['single'](_0x3821('0x18')),controller[_0x3821('0x19')]);router[_0x3821('0x1a')](_0x3821('0x1b'),auth[_0x3821('0xa')](),controller[_0x3821('0x1c')]);router[_0x3821('0x1d')](_0x3821('0x1b'),auth[_0x3821('0xa')](),controller['delete']);module[_0x3821('0x1e')]=router; \ No newline at end of file +var _0x7dea=['index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated'];(function(_0x51a123,_0x4df9f4){var _0x8b201a=function(_0x1e895b){while(--_0x1e895b){_0x51a123['push'](_0x51a123['shift']());}};_0x8b201a(++_0x4df9f4);}(_0x7dea,0x71));var _0xa7de=function(_0x1df899,_0x4f3cf6){_0x1df899=_0x1df899-0x0;var _0x3dd147=_0x7dea[_0x1df899];return _0x3dd147;};'use strict';var multer=require(_0xa7de('0x0'));var util=require('util');var path=require(_0xa7de('0x1'));var timeout=require(_0xa7de('0x2'));var express=require(_0xa7de('0x3'));var router=express[_0xa7de('0x4')]();var auth=require(_0xa7de('0x5'));var interaction=require(_0xa7de('0x6'));var config=require(_0xa7de('0x7'));var controller=require(_0xa7de('0x8'));router[_0xa7de('0x9')]('/',auth[_0xa7de('0xa')](),controller[_0xa7de('0xb')]);router[_0xa7de('0x9')](_0xa7de('0xc'),auth['isAuthenticated'](),controller[_0xa7de('0xd')]);router[_0xa7de('0x9')](_0xa7de('0xe'),auth[_0xa7de('0xa')](),controller[_0xa7de('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f5f0f,_0x4350b2,_0x50bba6){_0x50bba6(null,path[_0xa7de('0x10')](config[_0xa7de('0x11')],_0xa7de('0x12')));},'filename':function(_0x58ee69,_0x578594,_0x29f2ca){_0x578594[_0xa7de('0x13')]=_0x578594[_0xa7de('0x13')][_0xa7de('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29f2ca(null,util[_0xa7de('0x15')](_0xa7de('0x16'),path[_0xa7de('0x17')](_0x578594[_0xa7de('0x13')],path[_0xa7de('0x18')](_0x578594[_0xa7de('0x13')])),Date[_0xa7de('0x19')](),path['extname'](_0x578594['originalname'])));}})});router[_0xa7de('0x1a')]('/',upload['single']('file'),controller['create']);router[_0xa7de('0x1b')](_0xa7de('0xc'),auth[_0xa7de('0xa')](),controller[_0xa7de('0x1c')]);router[_0xa7de('0x1d')](_0xa7de('0xc'),auth[_0xa7de('0xa')](),controller[_0xa7de('0x1d')]);module[_0xa7de('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d5d381e..2667408 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 _0x7b5c=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x323f99,_0x906add){var _0x35eb59=function(_0x21162d){while(--_0x21162d){_0x323f99['push'](_0x323f99['shift']());}};_0x35eb59(++_0x906add);}(_0x7b5c,0x97));var _0xc7b5=function(_0x44f4c5,_0x60cd8b){_0x44f4c5=_0x44f4c5-0x0;var _0x35cf6a=_0x7b5c[_0x44f4c5];return _0x35cf6a;};'use strict';var Sequelize=require(_0xc7b5('0x0'));module[_0xc7b5('0x1')]={'name':{'type':Sequelize[_0xc7b5('0x2')],'unique':_0xc7b5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc7b5('0x2')]},'display_name':{'type':Sequelize[_0xc7b5('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xc7b5('0x2')]},'original_format':{'type':Sequelize[_0xc7b5('0x2')]},'original_duration':{'type':Sequelize[_0xc7b5('0x4')]},'original_sampleCount':{'type':Sequelize[_0xc7b5('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xc7b5('0x5')]},'original_sampleRate':{'type':Sequelize[_0xc7b5('0x6')]},'converted_format':{'type':Sequelize[_0xc7b5('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xc7b5('0x5')]},'converted_channelCount':{'type':Sequelize[_0xc7b5('0x6')]},'converted_bitRate':{'type':Sequelize[_0xc7b5('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xc7b5('0x6')]}}; \ No newline at end of file +var _0x8064=['INTEGER','name','STRING','FLOAT','BIGINT'];(function(_0x52d231,_0x37bc71){var _0x550ac5=function(_0x5215c2){while(--_0x5215c2){_0x52d231['push'](_0x52d231['shift']());}};_0x550ac5(++_0x37bc71);}(_0x8064,0x6a));var _0x4806=function(_0x189156,_0x3fdc0e){_0x189156=_0x189156-0x0;var _0x2924be=_0x8064[_0x189156];return _0x2924be;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4806('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4806('0x1')]},'display_name':{'type':Sequelize[_0x4806('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4806('0x1')]},'original_format':{'type':Sequelize[_0x4806('0x1')]},'original_duration':{'type':Sequelize[_0x4806('0x2')]},'original_sampleCount':{'type':Sequelize[_0x4806('0x3')]},'original_channelCount':{'type':Sequelize[_0x4806('0x4')]},'original_bitRate':{'type':Sequelize[_0x4806('0x3')]},'original_sampleRate':{'type':Sequelize[_0x4806('0x4')]},'converted_format':{'type':Sequelize[_0x4806('0x1')]},'converted_duration':{'type':Sequelize[_0x4806('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4806('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index f38fedc..aa945bf 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 _0xc03e=['filename','substring','wav','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','chmodSync','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','userProfileId','start','pick','delete','server/files/sounds/original','original_format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','end','sendStatus','stack','name','index','Sound','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','field','options','includeAll','findAll','rows','catch','params','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','originalname','extname','file'];(function(_0x4d8c7b,_0x20b79b){var _0x5d4b8c=function(_0xf1123f){while(--_0xf1123f){_0x4d8c7b['push'](_0x4d8c7b['shift']());}};_0x5d4b8c(++_0x20b79b);}(_0xc03e,0x120));var _0xec03=function(_0x5c6a78,_0x5c0503){_0x5c6a78=_0x5c6a78-0x0;var _0x236c5e=_0xc03e[_0x5c6a78];return _0x236c5e;};'use strict';var pdf=require(_0xec03('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec03('0x1'));var zipdir=require(_0xec03('0x2'));var jsonpatch=require(_0xec03('0x3'));var rp=require(_0xec03('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec03('0x5'));var util=require(_0xec03('0x6'));var path=require('path');var sox=require(_0xec03('0x7'));var csv=require(_0xec03('0x8'));var ejs=require(_0xec03('0x9'));var fs=require('fs');var _=require(_0xec03('0xa'));var squel=require(_0xec03('0xb'));var crypto=require(_0xec03('0xc'));var jsforce=require(_0xec03('0xd'));var deskjs=require(_0xec03('0xe'));var toCsv=require(_0xec03('0x8'));var querystring=require(_0xec03('0xf'));var Papa=require(_0xec03('0x10'));var Redis=require(_0xec03('0x11'));var authService=require(_0xec03('0x12'));var qs=require(_0xec03('0x13'));var hardwareService=require(_0xec03('0x14'));var logger=require(_0xec03('0x15'))(_0xec03('0x16'));var utils=require(_0xec03('0x17'));var config=require('../../config/environment');var db=require(_0xec03('0x18'))['db'];function respondWithStatusCode(_0xd5265c,_0x168871){_0x168871=_0x168871||0xcc;return function(_0x32c18b){if(_0x32c18b){return _0xd5265c['sendStatus'](_0x168871);}return _0xd5265c[_0xec03('0x19')](_0x168871)['end']();};}function respondWithResult(_0xb1c356,_0x466d6a){_0x466d6a=_0x466d6a||0xc8;return function(_0x2103b5){if(_0x2103b5){return _0xb1c356[_0xec03('0x19')](_0x466d6a)['json'](_0x2103b5);}};}function respondWithFilteredResult(_0x5e8d5a,_0x320237){return function(_0x1156b1){if(_0x1156b1){var _0x1fddc2=_0x1156b1[_0xec03('0x1a')],_0xb4962d=_0x320237[_0xec03('0x1b')],_0x454799=_0x320237[_0xec03('0x1b')]+_0x320237[_0xec03('0x1c')],_0x2708b7;if(_0x454799>=_0x1fddc2){_0x454799=_0x1fddc2;_0x2708b7=0xc8;}else{_0x2708b7=0xce;}_0x5e8d5a['status'](_0x2708b7);return _0x5e8d5a[_0xec03('0x1d')](_0xec03('0x1e'),_0xb4962d+'-'+_0x454799+'/'+_0x1fddc2)[_0xec03('0x1f')](_0x1156b1);}return null;};}function patchUpdates(_0x3dee3d){return function(_0x10e193){try{jsonpatch[_0xec03('0x20')](_0x10e193,_0x3dee3d,!![]);}catch(_0xb5afb4){return BPromise[_0xec03('0x21')](_0xb5afb4);}return _0x10e193[_0xec03('0x22')]();};}function saveUpdates(_0x3d3c15,_0x40cf5a){return function(_0x537885){if(_0x537885){return _0x537885[_0xec03('0x23')](_0x3d3c15)['then'](function(_0x2a09bc){return _0x2a09bc;});}return null;};}function removeEntity(_0x135391,_0x5af357){return function(_0xdaff46){if(_0xdaff46){return _0xdaff46[_0xec03('0x24')]()[_0xec03('0x25')](function(){var _0x1dbfc6=_0xdaff46[_0xec03('0x26')]({'plain':!![]});var _0x106122='Sounds';return db[_0xec03('0x27')][_0xec03('0x24')]({'where':{'type':_0x106122,'resourceId':_0x1dbfc6['id']}})[_0xec03('0x25')](function(){return _0xdaff46;});})['then'](function(){_0x135391[_0xec03('0x19')](0xcc)[_0xec03('0x28')]();});}};}function handleEntityNotFound(_0x27fd12,_0x3ac3ec){return function(_0x4c2b51){if(!_0x4c2b51){_0x27fd12[_0xec03('0x29')](0x194);}return _0x4c2b51;};}function handleError(_0x28ae81,_0x5ce2ce){_0x5ce2ce=_0x5ce2ce||0x1f4;return function(_0xa9df89){logger['error'](_0xa9df89[_0xec03('0x2a')]);if(_0xa9df89[_0xec03('0x2b')]){delete _0xa9df89[_0xec03('0x2b')];}_0x28ae81[_0xec03('0x19')](_0x5ce2ce)['send'](_0xa9df89);};}exports[_0xec03('0x2c')]=function(_0x465656,_0xd05ee3){var _0x31b809={},_0x552c58={},_0x1c4937={'count':0x0,'rows':[]};var _0xf615f1=db[_0xec03('0x2d')][_0xec03('0x2e')];_0x552c58[_0xec03('0x2f')]=_[_0xec03('0x30')](_0xf615f1);_0x552c58[_0xec03('0x31')]=_[_0xec03('0x30')](_0x465656[_0xec03('0x31')]);_0x552c58[_0xec03('0x32')]=_[_0xec03('0x33')](_0x552c58[_0xec03('0x2f')],_0x552c58[_0xec03('0x31')]);_0x31b809[_0xec03('0x34')]=_[_0xec03('0x33')](_0x552c58['model'],qs['fields'](_0x465656[_0xec03('0x31')][_0xec03('0x35')]));_0x31b809[_0xec03('0x34')]=_0x31b809[_0xec03('0x34')][_0xec03('0x36')]?_0x31b809[_0xec03('0x34')]:_0x552c58[_0xec03('0x2f')];if(!_0x465656[_0xec03('0x31')][_0xec03('0x37')](_0xec03('0x38'))){_0x31b809[_0xec03('0x1c')]=qs[_0xec03('0x1c')](_0x465656['query']['limit']);_0x31b809[_0xec03('0x1b')]=qs[_0xec03('0x1b')](_0x465656[_0xec03('0x31')]['offset']);}_0x31b809[_0xec03('0x39')]=qs[_0xec03('0x3a')](_0x465656[_0xec03('0x31')]['sort']);_0x31b809[_0xec03('0x3b')]=qs[_0xec03('0x32')](_['pick'](_0x465656[_0xec03('0x31')],_0x552c58[_0xec03('0x32')]));if(_0x465656[_0xec03('0x31')][_0xec03('0x3c')]){_0x31b809[_0xec03('0x3b')]=_[_0xec03('0x3d')](_0x31b809[_0xec03('0x3b')],{'$or':_['map'](_0xf615f1,function(_0x363230){if(_0x363230[_0xec03('0x3e')][_0xec03('0x3f')]!=='VIRTUAL'){var _0x2c8584={};_0x2c8584[_0x363230[_0xec03('0x40')]]={'$like':'%'+_0x465656['query'][_0xec03('0x3c')]+'%'};return _0x2c8584;}})});}_0x31b809=_[_0xec03('0x3d')]({},_0x31b809,_0x465656[_0xec03('0x41')]);var _0x599b3c={'where':_0x31b809[_0xec03('0x3b')]};return db['Sound']['count'](_0x599b3c)[_0xec03('0x25')](function(_0x293062){_0x1c4937[_0xec03('0x1a')]=_0x293062;if(_0x465656[_0xec03('0x31')][_0xec03('0x42')]){_0x31b809['include']=[{'all':!![]}];}return db[_0xec03('0x2d')][_0xec03('0x43')](_0x31b809);})[_0xec03('0x25')](function(_0x484f18){_0x1c4937[_0xec03('0x44')]=_0x484f18;return _0x1c4937;})['then'](respondWithFilteredResult(_0xd05ee3,_0x31b809))[_0xec03('0x45')](handleError(_0xd05ee3,null));};exports['show']=function(_0x2605bb,_0x4faabb){var _0x4184ae={'raw':!![],'where':{'id':_0x2605bb[_0xec03('0x46')]['id']}},_0x25bf6d={};_0x25bf6d[_0xec03('0x2f')]=_[_0xec03('0x30')](db[_0xec03('0x2d')]['rawAttributes']);_0x25bf6d[_0xec03('0x31')]=_[_0xec03('0x30')](_0x2605bb[_0xec03('0x31')]);_0x25bf6d['filters']=_[_0xec03('0x33')](_0x25bf6d[_0xec03('0x2f')],_0x25bf6d['query']);_0x4184ae['attributes']=_[_0xec03('0x33')](_0x25bf6d['model'],qs[_0xec03('0x35')](_0x2605bb['query']['fields']));_0x4184ae['attributes']=_0x4184ae[_0xec03('0x34')][_0xec03('0x36')]?_0x4184ae[_0xec03('0x34')]:_0x25bf6d[_0xec03('0x2f')];if(_0x2605bb[_0xec03('0x31')][_0xec03('0x42')]){_0x4184ae['include']=[{'all':!![]}];}_0x4184ae=_[_0xec03('0x3d')]({},_0x4184ae,_0x2605bb[_0xec03('0x41')]);return db[_0xec03('0x2d')]['find'](_0x4184ae)[_0xec03('0x25')](handleEntityNotFound(_0x4faabb,null))['then'](respondWithResult(_0x4faabb,null))[_0xec03('0x45')](handleError(_0x4faabb,null));};exports['download']=function(_0x16eb2a,_0x124646,_0x39ea97){return db['Sound'][_0xec03('0x47')]({'where':{'id':_0x16eb2a[_0xec03('0x46')]['id']},'attributes':[_0xec03('0x2b'),_0xec03('0x48'),_0xec03('0x49')],'raw':!![]})[_0xec03('0x25')](handleEntityNotFound(_0x124646,null))[_0xec03('0x25')](function(_0x1cda82){if(_0x1cda82){if(!fs[_0xec03('0x4a')](path[_0xec03('0x4b')](config[_0xec03('0x4c')],_0xec03('0x4d'),_0x1cda82[_0xec03('0x48')]+'.'+_0x1cda82['converted_format']))){throw new db['Sequelize'][(_0xec03('0x4e'))](_0xec03('0x4f'));}return _0x124646[_0xec03('0x50')](path['join'](config['root'],_0xec03('0x4d'),util[_0xec03('0x51')](_0xec03('0x52'),_0x1cda82[_0xec03('0x48')],_0x1cda82[_0xec03('0x49')])),util[_0xec03('0x51')](_0xec03('0x52'),_0x1cda82[_0xec03('0x2b')],_0x1cda82['converted_format']));}return null;})[_0xec03('0x45')](handleError(_0x124646,null));};exports[_0xec03('0x53')]=function(_0x30e2e4,_0x27f5ae,_0x11e8a8){var _0x3931fd={'name':path['basename'](_0x30e2e4['file'][_0xec03('0x54')],path[_0xec03('0x55')](_0x30e2e4[_0xec03('0x56')]['originalname'])),'save_name':path['basename'](_0x30e2e4[_0xec03('0x56')][_0xec03('0x57')],path['extname'](_0x30e2e4[_0xec03('0x56')]['filename'])),'original_format':path[_0xec03('0x55')](_0x30e2e4['file'][_0xec03('0x54')])[_0xec03('0x58')](0x1),'converted_format':_0xec03('0x59')};var _0x1b7367=path[_0xec03('0x4b')](config[_0xec03('0x4c')],'server/files/sounds/original',_0x30e2e4[_0xec03('0x56')]['filename']);var _0x462bd5=path[_0xec03('0x4b')](config[_0xec03('0x4c')],_0xec03('0x4d'),util['format']('%s.%s',path[_0xec03('0x5a')](_0x30e2e4[_0xec03('0x56')][_0xec03('0x57')],path[_0xec03('0x55')](_0x30e2e4[_0xec03('0x56')][_0xec03('0x57')])),_0x3931fd['converted_format']));logger[_0xec03('0x5b')](_0xec03('0x5c'),_0x1b7367);logger[_0xec03('0x5b')](_0xec03('0x5d'),_0x462bd5);try{fs['chmodSync'](_0x1b7367,parseInt(_0xec03('0x5e'),0x8));var _0x46ff09=sox[_0xec03('0x5f')](_0x1b7367,_0x462bd5,{'sampleRate':0x1f40,'format':_0xec03('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x46ff09['on'](_0xec03('0x60'),function(_0x309376){fs[_0xec03('0x61')](_0x1b7367);_0x27f5ae[_0xec03('0x19')](0x1f4)[_0xec03('0x62')](_0x309376);});_0x46ff09['on'](_0xec03('0x63'),function(_0x4e6e14){_0x3931fd[_0xec03('0x64')]=isNaN(_0x4e6e14[_0xec03('0x65')])?null:_0x4e6e14[_0xec03('0x65')]*0x3e8;_0x3931fd[_0xec03('0x66')]=isNaN(_0x4e6e14[_0xec03('0x67')])?null:_0x4e6e14['sampleCount'];_0x3931fd[_0xec03('0x68')]=isNaN(_0x4e6e14[_0xec03('0x69')])?null:_0x4e6e14['channelCount'];_0x3931fd[_0xec03('0x6a')]=isNaN(_0x4e6e14[_0xec03('0x6b')])?null:_0x4e6e14['bitRate'];_0x3931fd[_0xec03('0x6c')]=isNaN(_0x4e6e14[_0xec03('0x6d')])?null:_0x4e6e14[_0xec03('0x6d')];});_0x46ff09['on'](_0xec03('0x6e'),function(_0x268141){_0x3931fd[_0xec03('0x6f')]=isNaN(_0x268141[_0xec03('0x65')])?null:_0x268141[_0xec03('0x65')]*0x3e8;_0x3931fd['converted_sampleCount']=isNaN(_0x268141[_0xec03('0x67')])?null:_0x268141[_0xec03('0x67')];_0x3931fd[_0xec03('0x70')]=isNaN(_0x268141[_0xec03('0x69')])?null:_0x268141[_0xec03('0x69')];_0x3931fd['converted_bitRate']=isNaN(_0x268141[_0xec03('0x6b')])?null:_0x268141[_0xec03('0x6b')];_0x3931fd['converted_sampleRate']=isNaN(_0x268141['sampleRate'])?null:_0x268141[_0xec03('0x6d')];});_0x46ff09['on']('end',function(){fs[_0xec03('0x71')](_0x462bd5,parseInt(_0xec03('0x5e'),0x8));return db[_0xec03('0x2d')][_0xec03('0x53')](_0x3931fd)[_0xec03('0x25')](function(_0x5d383c){var _0x55db80={'role':_0x30e2e4[_0xec03('0x72')][_0xec03('0x73')],'userProfileId':_0x30e2e4['body']['userProfileId']};if(!_0x55db80)throw new Error(_0xec03('0x74'));if(_0x55db80[_0xec03('0x73')]==='user'){var _0x4049a7=_0x5d383c[_0xec03('0x26')]({'plain':!![]});return db[_0xec03('0x75')][_0xec03('0x47')]({'where':{'name':_0xec03('0x76'),'userProfileId':_0x55db80[_0xec03('0x77')]},'raw':!![]})['then'](function(_0x190c20){if(_0x190c20&&_0x190c20['autoAssociation']===0x0){return db[_0xec03('0x27')]['create']({'name':_0x4049a7['name'],'resourceId':_0x4049a7['id'],'type':_0x190c20[_0xec03('0x2b')],'sectionId':_0x190c20['id']},{})[_0xec03('0x25')](function(){return _0x5d383c;});}else{return _0x5d383c;}})[_0xec03('0x45')](function(_0x2d17be){logger[_0xec03('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d17be);throw _0x2d17be;});}return _0x5d383c;})[_0xec03('0x25')](respondWithResult(_0x27f5ae,null))[_0xec03('0x45')](handleError(_0x27f5ae,null));});_0x46ff09[_0xec03('0x78')]();}catch(_0x2b5216){_0x27f5ae[_0xec03('0x19')](0x1f4)[_0xec03('0x62')](_0x2b5216);}};exports['update']=function(_0x5a2e51,_0xc246c,_0xb8c2d3){return db[_0xec03('0x2d')][_0xec03('0x47')]({'where':{'id':_0x5a2e51[_0xec03('0x46')]['id']}})[_0xec03('0x25')](handleEntityNotFound(_0xc246c,null))[_0xec03('0x25')](saveUpdates(_[_0xec03('0x79')](_0x5a2e51[_0xec03('0x72')],[_0xec03('0x2b'),'description']),null))[_0xec03('0x25')](respondWithResult(_0xc246c,null))['catch'](handleError(_0xc246c,null));};exports[_0xec03('0x7a')]=function(_0x357929,_0x5a961d,_0x33ff6c){return db['Sound'][_0xec03('0x47')]({'where':{'id':_0x357929['params']['id']}})['then'](function(_0x259908){if(_0x259908){return _0x259908[_0xec03('0x24')]();}})[_0xec03('0x25')](function(_0x18a24f){var _0x134afa=path[_0xec03('0x4b')](config[_0xec03('0x4c')],_0xec03('0x7b'),util[_0xec03('0x51')]('%s.%s',_0x18a24f[_0xec03('0x48')],_0x18a24f[_0xec03('0x7c')]));var _0x51c9a0=path[_0xec03('0x4b')](config[_0xec03('0x4c')],_0xec03('0x4d'),util['format'](_0xec03('0x52'),_0x18a24f[_0xec03('0x48')],_0x18a24f[_0xec03('0x49')]));fs[_0xec03('0x61')](_0x134afa);fs[_0xec03('0x61')](_0x51c9a0);return _0x18a24f;})[_0xec03('0x25')](function(_0x43d85c){if(_0x43d85c){return _0x5a961d[_0xec03('0x19')](0xcc)[_0xec03('0x28')]();}})['then'](handleEntityNotFound(_0x5a961d,null))[_0xec03('0x45')](handleError(_0x5a961d,null));}; \ No newline at end of file +var _0x9b89=['find','save_name','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','root','%s.%s','converted_format','format','create','file','basename','filename','extname','originalname','wav','join','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','Sound','rawAttributes','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','field','merge','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x1ac58e,_0xe0cb6c){var _0x50065e=function(_0x2d246a){while(--_0x2d246a){_0x1ac58e['push'](_0x1ac58e['shift']());}};_0x50065e(++_0xe0cb6c);}(_0x9b89,0xa6));var _0x99b8=function(_0x5964e0,_0x2957ee){_0x5964e0=_0x5964e0-0x0;var _0x3266e5=_0x9b89[_0x5964e0];return _0x3266e5;};'use strict';var pdf=require(_0x99b8('0x0'));var emlformat=require(_0x99b8('0x1'));var rimraf=require(_0x99b8('0x2'));var zipdir=require(_0x99b8('0x3'));var jsonpatch=require(_0x99b8('0x4'));var rp=require(_0x99b8('0x5'));var moment=require('moment');var BPromise=require(_0x99b8('0x6'));var Mustache=require(_0x99b8('0x7'));var util=require('util');var path=require(_0x99b8('0x8'));var sox=require(_0x99b8('0x9'));var csv=require('to-csv');var ejs=require(_0x99b8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99b8('0xb'));var crypto=require(_0x99b8('0xc'));var jsforce=require(_0x99b8('0xd'));var deskjs=require(_0x99b8('0xe'));var toCsv=require(_0x99b8('0xf'));var querystring=require('querystring');var Papa=require(_0x99b8('0x10'));var Redis=require('ioredis');var authService=require(_0x99b8('0x11'));var qs=require(_0x99b8('0x12'));var hardwareService=require(_0x99b8('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x99b8('0x14'));var db=require(_0x99b8('0x15'))['db'];function respondWithStatusCode(_0x5c6d4a,_0x44c4a7){_0x44c4a7=_0x44c4a7||0xcc;return function(_0x421e6d){if(_0x421e6d){return _0x5c6d4a[_0x99b8('0x16')](_0x44c4a7);}return _0x5c6d4a[_0x99b8('0x17')](_0x44c4a7)[_0x99b8('0x18')]();};}function respondWithResult(_0x618bf3,_0x4eb6ff){_0x4eb6ff=_0x4eb6ff||0xc8;return function(_0x4221bd){if(_0x4221bd){return _0x618bf3['status'](_0x4eb6ff)[_0x99b8('0x19')](_0x4221bd);}};}function respondWithFilteredResult(_0x18a23b,_0x286007){return function(_0x4df845){if(_0x4df845){var _0x22ceec=_0x4df845[_0x99b8('0x1a')],_0x22e060=_0x286007['offset'],_0x4c5a70=_0x286007[_0x99b8('0x1b')]+_0x286007[_0x99b8('0x1c')],_0x468458;if(_0x4c5a70>=_0x22ceec){_0x4c5a70=_0x22ceec;_0x468458=0xc8;}else{_0x468458=0xce;}_0x18a23b[_0x99b8('0x17')](_0x468458);return _0x18a23b[_0x99b8('0x1d')](_0x99b8('0x1e'),_0x22e060+'-'+_0x4c5a70+'/'+_0x22ceec)[_0x99b8('0x19')](_0x4df845);}return null;};}function patchUpdates(_0x2bf41){return function(_0x7eec93){try{jsonpatch[_0x99b8('0x1f')](_0x7eec93,_0x2bf41,!![]);}catch(_0x2ec89c){return BPromise[_0x99b8('0x20')](_0x2ec89c);}return _0x7eec93[_0x99b8('0x21')]();};}function saveUpdates(_0x13b88a,_0x420bdb){return function(_0x1fc34a){if(_0x1fc34a){return _0x1fc34a[_0x99b8('0x22')](_0x13b88a)[_0x99b8('0x23')](function(_0x3792cd){return _0x3792cd;});}return null;};}function removeEntity(_0x69645,_0x4be416){return function(_0x376e20){if(_0x376e20){return _0x376e20[_0x99b8('0x24')]()[_0x99b8('0x23')](function(){var _0x91343b=_0x376e20['get']({'plain':!![]});var _0x1fac13=_0x99b8('0x25');return db[_0x99b8('0x26')][_0x99b8('0x24')]({'where':{'type':_0x1fac13,'resourceId':_0x91343b['id']}})[_0x99b8('0x23')](function(){return _0x376e20;});})[_0x99b8('0x23')](function(){_0x69645['status'](0xcc)[_0x99b8('0x18')]();});}};}function handleEntityNotFound(_0x1773ac,_0x32fc60){return function(_0x1ef246){if(!_0x1ef246){_0x1773ac['sendStatus'](0x194);}return _0x1ef246;};}function handleError(_0x575378,_0x4d41ff){_0x4d41ff=_0x4d41ff||0x1f4;return function(_0x505726){logger[_0x99b8('0x27')](_0x505726[_0x99b8('0x28')]);if(_0x505726[_0x99b8('0x29')]){delete _0x505726[_0x99b8('0x29')];}_0x575378[_0x99b8('0x17')](_0x4d41ff)[_0x99b8('0x2a')](_0x505726);};}exports['index']=function(_0xa6cefe,_0x117a14){var _0x137a05={},_0x23d0c5={},_0x89cd72={'count':0x0,'rows':[]};var _0x3b2b7b=db[_0x99b8('0x2b')][_0x99b8('0x2c')];_0x23d0c5['model']=_[_0x99b8('0x2d')](_0x3b2b7b);_0x23d0c5[_0x99b8('0x2e')]=_['keys'](_0xa6cefe[_0x99b8('0x2e')]);_0x23d0c5['filters']=_[_0x99b8('0x2f')](_0x23d0c5[_0x99b8('0x30')],_0x23d0c5[_0x99b8('0x2e')]);_0x137a05[_0x99b8('0x31')]=_[_0x99b8('0x2f')](_0x23d0c5['model'],qs[_0x99b8('0x32')](_0xa6cefe[_0x99b8('0x2e')][_0x99b8('0x32')]));_0x137a05[_0x99b8('0x31')]=_0x137a05[_0x99b8('0x31')]['length']?_0x137a05[_0x99b8('0x31')]:_0x23d0c5[_0x99b8('0x30')];if(!_0xa6cefe[_0x99b8('0x2e')][_0x99b8('0x33')](_0x99b8('0x34'))){_0x137a05[_0x99b8('0x1c')]=qs[_0x99b8('0x1c')](_0xa6cefe[_0x99b8('0x2e')]['limit']);_0x137a05['offset']=qs[_0x99b8('0x1b')](_0xa6cefe[_0x99b8('0x2e')]['offset']);}_0x137a05[_0x99b8('0x35')]=qs[_0x99b8('0x36')](_0xa6cefe[_0x99b8('0x2e')]['sort']);_0x137a05[_0x99b8('0x37')]=qs['filters'](_['pick'](_0xa6cefe[_0x99b8('0x2e')],_0x23d0c5[_0x99b8('0x38')]));if(_0xa6cefe[_0x99b8('0x2e')][_0x99b8('0x39')]){_0x137a05['where']=_['merge'](_0x137a05[_0x99b8('0x37')],{'$or':_['map'](_0x3b2b7b,function(_0x456c8f){if(_0x456c8f[_0x99b8('0x3a')]['key']!=='VIRTUAL'){var _0x374110={};_0x374110[_0x456c8f[_0x99b8('0x3b')]]={'$like':'%'+_0xa6cefe['query'][_0x99b8('0x39')]+'%'};return _0x374110;}})});}_0x137a05=_[_0x99b8('0x3c')]({},_0x137a05,_0xa6cefe[_0x99b8('0x3d')]);var _0x4f8f27={'where':_0x137a05[_0x99b8('0x37')]};return db['Sound'][_0x99b8('0x1a')](_0x4f8f27)[_0x99b8('0x23')](function(_0x1296dd){_0x89cd72[_0x99b8('0x1a')]=_0x1296dd;if(_0xa6cefe[_0x99b8('0x2e')][_0x99b8('0x3e')]){_0x137a05[_0x99b8('0x3f')]=[{'all':!![]}];}return db[_0x99b8('0x2b')][_0x99b8('0x40')](_0x137a05);})[_0x99b8('0x23')](function(_0x11429d){_0x89cd72[_0x99b8('0x41')]=_0x11429d;return _0x89cd72;})[_0x99b8('0x23')](respondWithFilteredResult(_0x117a14,_0x137a05))[_0x99b8('0x42')](handleError(_0x117a14,null));};exports[_0x99b8('0x43')]=function(_0x56bc03,_0x2fa3ba){var _0x577dd2={'raw':!![],'where':{'id':_0x56bc03[_0x99b8('0x44')]['id']}},_0x54309c={};_0x54309c['model']=_[_0x99b8('0x2d')](db['Sound'][_0x99b8('0x2c')]);_0x54309c['query']=_[_0x99b8('0x2d')](_0x56bc03[_0x99b8('0x2e')]);_0x54309c[_0x99b8('0x38')]=_['intersection'](_0x54309c[_0x99b8('0x30')],_0x54309c[_0x99b8('0x2e')]);_0x577dd2[_0x99b8('0x31')]=_['intersection'](_0x54309c[_0x99b8('0x30')],qs[_0x99b8('0x32')](_0x56bc03[_0x99b8('0x2e')]['fields']));_0x577dd2[_0x99b8('0x31')]=_0x577dd2[_0x99b8('0x31')][_0x99b8('0x45')]?_0x577dd2[_0x99b8('0x31')]:_0x54309c[_0x99b8('0x30')];if(_0x56bc03[_0x99b8('0x2e')][_0x99b8('0x3e')]){_0x577dd2['include']=[{'all':!![]}];}_0x577dd2=_['merge']({},_0x577dd2,_0x56bc03['options']);return db[_0x99b8('0x2b')]['find'](_0x577dd2)[_0x99b8('0x23')](handleEntityNotFound(_0x2fa3ba,null))[_0x99b8('0x23')](respondWithResult(_0x2fa3ba,null))[_0x99b8('0x42')](handleError(_0x2fa3ba,null));};exports['download']=function(_0x229642,_0x11b45a,_0x26af29){return db[_0x99b8('0x2b')][_0x99b8('0x46')]({'where':{'id':_0x229642['params']['id']},'attributes':['name',_0x99b8('0x47'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x11b45a,null))[_0x99b8('0x23')](function(_0x47f13a){if(_0x47f13a){if(!fs['existsSync'](path['join'](config['root'],_0x99b8('0x48'),_0x47f13a[_0x99b8('0x47')]+'.'+_0x47f13a['converted_format']))){throw new db[(_0x99b8('0x49'))]['ValidationError'](_0x99b8('0x4a'));}return _0x11b45a[_0x99b8('0x4b')](path['join'](config[_0x99b8('0x4c')],_0x99b8('0x48'),util['format'](_0x99b8('0x4d'),_0x47f13a['save_name'],_0x47f13a[_0x99b8('0x4e')])),util[_0x99b8('0x4f')](_0x99b8('0x4d'),_0x47f13a[_0x99b8('0x29')],_0x47f13a[_0x99b8('0x4e')]));}return null;})['catch'](handleError(_0x11b45a,null));};exports[_0x99b8('0x50')]=function(_0x16bcd1,_0x555b1e,_0x3cbd8d){var _0x4f6291={'name':path['basename'](_0x16bcd1[_0x99b8('0x51')]['originalname'],path['extname'](_0x16bcd1[_0x99b8('0x51')]['originalname'])),'save_name':path[_0x99b8('0x52')](_0x16bcd1[_0x99b8('0x51')][_0x99b8('0x53')],path[_0x99b8('0x54')](_0x16bcd1[_0x99b8('0x51')]['filename'])),'original_format':path[_0x99b8('0x54')](_0x16bcd1[_0x99b8('0x51')][_0x99b8('0x55')])['substring'](0x1),'converted_format':_0x99b8('0x56')};var _0x24bba2=path[_0x99b8('0x57')](config[_0x99b8('0x4c')],_0x99b8('0x58'),_0x16bcd1['file'][_0x99b8('0x53')]);var _0x17b267=path[_0x99b8('0x57')](config[_0x99b8('0x4c')],'server/files/sounds/converted',util[_0x99b8('0x4f')](_0x99b8('0x4d'),path[_0x99b8('0x52')](_0x16bcd1[_0x99b8('0x51')][_0x99b8('0x53')],path[_0x99b8('0x54')](_0x16bcd1[_0x99b8('0x51')][_0x99b8('0x53')])),_0x4f6291['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x24bba2);logger[_0x99b8('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x17b267);try{fs[_0x99b8('0x5a')](_0x24bba2,parseInt(_0x99b8('0x5b'),0x8));var _0x3355ed=sox[_0x99b8('0x5c')](_0x24bba2,_0x17b267,{'sampleRate':0x1f40,'format':_0x99b8('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3355ed['on'](_0x99b8('0x27'),function(_0x42e0f0){fs[_0x99b8('0x5d')](_0x24bba2);_0x555b1e[_0x99b8('0x17')](0x1f4)[_0x99b8('0x2a')](_0x42e0f0);});_0x3355ed['on'](_0x99b8('0x5e'),function(_0x5724cc){_0x4f6291['original_duration']=isNaN(_0x5724cc[_0x99b8('0x5f')])?null:_0x5724cc[_0x99b8('0x5f')]*0x3e8;_0x4f6291['original_sampleCount']=isNaN(_0x5724cc[_0x99b8('0x60')])?null:_0x5724cc[_0x99b8('0x60')];_0x4f6291[_0x99b8('0x61')]=isNaN(_0x5724cc[_0x99b8('0x62')])?null:_0x5724cc[_0x99b8('0x62')];_0x4f6291[_0x99b8('0x63')]=isNaN(_0x5724cc['bitRate'])?null:_0x5724cc['bitRate'];_0x4f6291[_0x99b8('0x64')]=isNaN(_0x5724cc[_0x99b8('0x65')])?null:_0x5724cc['sampleRate'];});_0x3355ed['on']('dest',function(_0x1ad90c){_0x4f6291[_0x99b8('0x66')]=isNaN(_0x1ad90c[_0x99b8('0x5f')])?null:_0x1ad90c[_0x99b8('0x5f')]*0x3e8;_0x4f6291[_0x99b8('0x67')]=isNaN(_0x1ad90c['sampleCount'])?null:_0x1ad90c[_0x99b8('0x60')];_0x4f6291[_0x99b8('0x68')]=isNaN(_0x1ad90c['channelCount'])?null:_0x1ad90c[_0x99b8('0x62')];_0x4f6291[_0x99b8('0x69')]=isNaN(_0x1ad90c[_0x99b8('0x6a')])?null:_0x1ad90c[_0x99b8('0x6a')];_0x4f6291[_0x99b8('0x6b')]=isNaN(_0x1ad90c[_0x99b8('0x65')])?null:_0x1ad90c['sampleRate'];});_0x3355ed['on'](_0x99b8('0x18'),function(){fs[_0x99b8('0x5a')](_0x17b267,parseInt(_0x99b8('0x5b'),0x8));return db[_0x99b8('0x2b')][_0x99b8('0x50')](_0x4f6291)[_0x99b8('0x23')](function(_0x5efeb7){var _0x1761cd={'role':_0x16bcd1[_0x99b8('0x6c')][_0x99b8('0x6d')],'userProfileId':_0x16bcd1['body']['userProfileId']};if(!_0x1761cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1761cd[_0x99b8('0x6d')]===_0x99b8('0x6e')){var _0x5add7f=_0x5efeb7['get']({'plain':!![]});return db[_0x99b8('0x6f')]['find']({'where':{'name':'Sounds','userProfileId':_0x1761cd[_0x99b8('0x70')]},'raw':!![]})[_0x99b8('0x23')](function(_0x286bab){if(_0x286bab&&_0x286bab[_0x99b8('0x71')]===0x0){return db[_0x99b8('0x26')]['create']({'name':_0x5add7f[_0x99b8('0x29')],'resourceId':_0x5add7f['id'],'type':_0x286bab[_0x99b8('0x29')],'sectionId':_0x286bab['id']},{})[_0x99b8('0x23')](function(){return _0x5efeb7;});}else{return _0x5efeb7;}})['catch'](function(_0x551161){logger[_0x99b8('0x27')](_0x99b8('0x72'),_0x551161);throw _0x551161;});}return _0x5efeb7;})[_0x99b8('0x23')](respondWithResult(_0x555b1e,null))[_0x99b8('0x42')](handleError(_0x555b1e,null));});_0x3355ed[_0x99b8('0x73')]();}catch(_0xc28d3){_0x555b1e[_0x99b8('0x17')](0x1f4)[_0x99b8('0x2a')](_0xc28d3);}};exports[_0x99b8('0x22')]=function(_0x371378,_0x3c3c7a,_0xc07d7a){return db[_0x99b8('0x2b')][_0x99b8('0x46')]({'where':{'id':_0x371378[_0x99b8('0x44')]['id']}})[_0x99b8('0x23')](handleEntityNotFound(_0x3c3c7a,null))[_0x99b8('0x23')](saveUpdates(_['pick'](_0x371378['body'],[_0x99b8('0x29'),_0x99b8('0x74')]),null))['then'](respondWithResult(_0x3c3c7a,null))[_0x99b8('0x42')](handleError(_0x3c3c7a,null));};exports['delete']=function(_0x4e407f,_0x46a9d0,_0x240b62){return db['Sound'][_0x99b8('0x46')]({'where':{'id':_0x4e407f[_0x99b8('0x44')]['id']}})[_0x99b8('0x23')](function(_0x4f9381){if(_0x4f9381){return _0x4f9381[_0x99b8('0x24')]();}})['then'](function(_0x41d624){var _0x4feb1f=path[_0x99b8('0x57')](config[_0x99b8('0x4c')],'server/files/sounds/original',util[_0x99b8('0x4f')](_0x99b8('0x4d'),_0x41d624[_0x99b8('0x47')],_0x41d624[_0x99b8('0x75')]));var _0x11b8d5=path[_0x99b8('0x57')](config[_0x99b8('0x4c')],_0x99b8('0x48'),util[_0x99b8('0x4f')]('%s.%s',_0x41d624['save_name'],_0x41d624[_0x99b8('0x4e')]));fs[_0x99b8('0x5d')](_0x4feb1f);fs[_0x99b8('0x5d')](_0x11b8d5);return _0x41d624;})[_0x99b8('0x23')](function(_0x193295){if(_0x193295){return _0x46a9d0[_0x99b8('0x17')](0xcc)['end']();}})[_0x99b8('0x23')](handleEntityNotFound(_0x46a9d0,null))[_0x99b8('0x42')](handleError(_0x46a9d0,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3fecdd3..2501c42 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 _0x65d4=['tools_sounds','lodash','util','moment','request-promise','path','define','Sound'];(function(_0x437fad,_0xd9fee5){var _0x8f92c6=function(_0xbe05a7){while(--_0xbe05a7){_0x437fad['push'](_0x437fad['shift']());}};_0x8f92c6(++_0xd9fee5);}(_0x65d4,0x1b9));var _0x465d=function(_0x5ac516,_0x3b6378){_0x5ac516=_0x5ac516-0x0;var _0x267559=_0x65d4[_0x5ac516];return _0x267559;};'use strict';var _=require(_0x465d('0x0'));var util=require(_0x465d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x465d('0x2'));var BPromise=require('bluebird');var rp=require(_0x465d('0x3'));var fs=require('fs');var path=require(_0x465d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x188556,_0x1de1fd){return _0x188556[_0x465d('0x5')](_0x465d('0x6'),attributes,{'tableName':_0x465d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea66=['tools_sounds','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x57810c,_0x45b5c4){var _0x4762e0=function(_0x37ec49){while(--_0x37ec49){_0x57810c['push'](_0x57810c['shift']());}};_0x4762e0(++_0x45b5c4);}(_0xea66,0x83));var _0x6ea6=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xea66[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require(_0x6ea6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ea6('0x1'));var moment=require(_0x6ea6('0x2'));var BPromise=require(_0x6ea6('0x3'));var rp=require(_0x6ea6('0x4'));var fs=require('fs');var path=require(_0x6ea6('0x5'));var rimraf=require(_0x6ea6('0x6'));var config=require(_0x6ea6('0x7'));var attributes=require(_0x6ea6('0x8'));module[_0x6ea6('0x9')]=function(_0x4c1978,_0x1c579e){return _0x4c1978[_0x6ea6('0xa')](_0x6ea6('0xb'),attributes,{'tableName':_0x6ea6('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 16a4b48..a2b224c 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 _0xd8b0=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','include','model','attributes','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x151f39,_0x2693b2){var _0x5da6a0=function(_0x1ae903){while(--_0x1ae903){_0x151f39['push'](_0x151f39['shift']());}};_0x5da6a0(++_0x2693b2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['find']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'include':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['include']?_['map'](_0x5fecbd['options'][_0x0d8b('0x1b')],function(_0x2b924f){return{'model':db[_0x2b924f[_0x0d8b('0x1c')]],'as':_0x2b924f['as'],'attributes':_0x2b924f[_0x0d8b('0x1d')],'include':_0x2b924f[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x2b924f[_0x0d8b('0x1b')],function(_0x4562cb){return{'model':db[_0x4562cb[_0x0d8b('0x1c')]],'as':_0x4562cb['as'],'attributes':_0x4562cb['attributes'],'include':_0x4562cb[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x4562cb['include'],function(_0xe1ef20){return{'model':db[_0xe1ef20['model']],'as':_0xe1ef20['as'],'attributes':_0xe1ef20[_0x0d8b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0xa2af02){logger['info']('ShowSound',_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON['stringify'](_0xa2af02));_0x18dd2d(_0xa2af02);})[_0x0d8b('0x15')](function(_0x59aa83){logger[_0x0d8b('0x11')]('ShowSound',_0x59aa83[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674['error'](0x1f4,_0x59aa83[_0x0d8b('0x13')]));});});}; \ No newline at end of file +var _0xa9e0=['then','stringify','ShowSound','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','Sound','find','options','raw','where','attributes','include','model','map'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['ShowSound']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['include']?_['map'](_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')],function(_0x38e7c4){return{'model':db[_0x38e7c4[_0x0a9e('0x1b')]],'as':_0x38e7c4['as'],'attributes':_0x38e7c4['attributes'],'include':_0x38e7c4[_0x0a9e('0x1a')]?_[_0x0a9e('0x1c')](_0x38e7c4[_0x0a9e('0x1a')],function(_0x4d00e6){return{'model':db[_0x4d00e6[_0x0a9e('0x1b')]],'as':_0x4d00e6['as'],'attributes':_0x4d00e6[_0x0a9e('0x19')],'include':_0x4d00e6[_0x0a9e('0x1a')]?_['map'](_0x4d00e6['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x1b')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x1d')](function(_0x526cf3){logger[_0x0a9e('0xa')]('ShowSound',_0x459eb1);logger[_0x0a9e('0xd')]('ShowSound',_0x459eb1,JSON[_0x0a9e('0x1e')](_0x526cf3));_0x106033(_0x526cf3);})[_0x0a9e('0x13')](function(_0x25fba9){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x25fba9[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x25fba9[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 77bc21b..6e23761 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 _0x4b0f=['delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x4a96ec,_0x4d309a){var _0x35dfda=function(_0x632791){while(--_0x632791){_0x4a96ec['push'](_0x4a96ec['shift']());}};_0x35dfda(++_0x4d309a);}(_0x4b0f,0xa3));var _0xf4b0=function(_0xd3a823,_0x4ad32e){_0xd3a823=_0xd3a823-0x0;var _0x54b98a=_0x4b0f[_0xd3a823];return _0x54b98a;};'use strict';var multer=require('multer');var util=require(_0xf4b0('0x0'));var path=require(_0xf4b0('0x1'));var timeout=require(_0xf4b0('0x2'));var express=require('express');var router=express[_0xf4b0('0x3')]();var auth=require(_0xf4b0('0x4'));var interaction=require(_0xf4b0('0x5'));var config=require(_0xf4b0('0x6'));var controller=require(_0xf4b0('0x7'));router[_0xf4b0('0x8')]('/',auth[_0xf4b0('0x9')](),controller[_0xf4b0('0xa')]);router[_0xf4b0('0x8')](_0xf4b0('0xb'),auth[_0xf4b0('0x9')](),controller[_0xf4b0('0xc')]);router[_0xf4b0('0xd')]('/',auth[_0xf4b0('0x9')](),controller[_0xf4b0('0xe')]);router[_0xf4b0('0xf')]('/:id',auth[_0xf4b0('0x9')](),controller[_0xf4b0('0x10')]);router[_0xf4b0('0x11')](_0xf4b0('0xb'),auth[_0xf4b0('0x9')](),controller[_0xf4b0('0x12')]);module[_0xf4b0('0x13')]=router; \ No newline at end of file +var _0x9d11=['get','index','isAuthenticated','show','post','/:id','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller'];(function(_0x5d813a,_0x2989db){var _0x4a7f61=function(_0x3da61b){while(--_0x3da61b){_0x5d813a['push'](_0x5d813a['shift']());}};_0x4a7f61(++_0x2989db);}(_0x9d11,0xb7));var _0x19d1=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x9d11[_0x35b7d4];return _0x4e8cee;};'use strict';var multer=require(_0x19d1('0x0'));var util=require(_0x19d1('0x1'));var path=require(_0x19d1('0x2'));var timeout=require(_0x19d1('0x3'));var express=require('express');var router=express[_0x19d1('0x4')]();var auth=require(_0x19d1('0x5'));var interaction=require(_0x19d1('0x6'));var config=require(_0x19d1('0x7'));var controller=require(_0x19d1('0x8'));router[_0x19d1('0x9')]('/',auth['isAuthenticated'](),controller[_0x19d1('0xa')]);router[_0x19d1('0x9')]('/:id',auth[_0x19d1('0xb')](),controller[_0x19d1('0xc')]);router[_0x19d1('0xd')]('/',auth[_0x19d1('0xb')](),controller['create']);router['put'](_0x19d1('0xe'),auth[_0x19d1('0xb')](),controller['update']);router[_0x19d1('0xf')](_0x19d1('0xe'),auth[_0x19d1('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 689145a..c634cc9 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 _0x26ea=['ENUM','out','sequelize','exports','TEXT'];(function(_0x2560a8,_0x4e470a){var _0x3669e1=function(_0x1f8123){while(--_0x1f8123){_0x2560a8['push'](_0x2560a8['shift']());}};_0x3669e1(++_0x4e470a);}(_0x26ea,0x9d));var _0xa26e=function(_0x1b4670,_0x2edc98){_0x1b4670=_0x1b4670-0x0;var _0xd116bc=_0x26ea[_0x1b4670];return _0xd116bc;};'use strict';var Sequelize=require(_0xa26e('0x0'));module[_0xa26e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xa26e('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xa26e('0x3')]('in',_0xa26e('0x4')),'defaultValue':_0xa26e('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xcbea=['sequelize','ENUM','out'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0xcbea,0x189));var _0xacbe=function(_0x39bfb1,_0x2183d5){_0x39bfb1=_0x39bfb1-0x0;var _0x3e8a55=_0xcbea[_0x39bfb1];return _0x3e8a55;};'use strict';var Sequelize=require(_0xacbe('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xacbe('0x1')]('in',_0xacbe('0x2')),'defaultValue':_0xacbe('0x2'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2e23c10..84d5bbf 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 _0xbdb7=['name','send','index','SquareMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','map','type','key','VIRTUAL','field','include','findAll','rows','catch','show','includeAll','options','create','body','update','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x23724f,_0x19e182){_0x23724f=_0x23724f-0x0;var _0x17c793=_0xbdb7[_0x23724f];return _0x17c793;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var hardwareService=require(_0x7bdb('0x12'));var logger=require(_0x7bdb('0x13'))(_0x7bdb('0x14'));var utils=require(_0x7bdb('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b9b9,_0x3053d0){_0x3053d0=_0x3053d0||0xcc;return function(_0x25e3cb){if(_0x25e3cb){return _0x52b9b9['sendStatus'](_0x3053d0);}return _0x52b9b9[_0x7bdb('0x16')](_0x3053d0)['end']();};}function respondWithResult(_0x5898c1,_0x2abca6){_0x2abca6=_0x2abca6||0xc8;return function(_0x46dd4a){if(_0x46dd4a){return _0x5898c1['status'](_0x2abca6)['json'](_0x46dd4a);}};}function respondWithFilteredResult(_0x4e98f7,_0x4476ff){return function(_0x195b2e){if(_0x195b2e){var _0xe9919f=_0x195b2e[_0x7bdb('0x17')],_0x25d417=_0x4476ff[_0x7bdb('0x18')],_0x31c909=_0x4476ff['offset']+_0x4476ff[_0x7bdb('0x19')],_0xbde12a;if(_0x31c909>=_0xe9919f){_0x31c909=_0xe9919f;_0xbde12a=0xc8;}else{_0xbde12a=0xce;}_0x4e98f7[_0x7bdb('0x16')](_0xbde12a);return _0x4e98f7[_0x7bdb('0x1a')](_0x7bdb('0x1b'),_0x25d417+'-'+_0x31c909+'/'+_0xe9919f)['json'](_0x195b2e);}return null;};}function patchUpdates(_0x41f540){return function(_0x23e9eb){try{jsonpatch['apply'](_0x23e9eb,_0x41f540,!![]);}catch(_0x3e5f8e){return BPromise[_0x7bdb('0x1c')](_0x3e5f8e);}return _0x23e9eb[_0x7bdb('0x1d')]();};}function saveUpdates(_0x45d552,_0x112793){return function(_0x5bfc35){if(_0x5bfc35){return _0x5bfc35['update'](_0x45d552)[_0x7bdb('0x1e')](function(_0xcb25f2){return _0xcb25f2;});}return null;};}function removeEntity(_0x5daea4,_0x341fe4){return function(_0x118ea1){if(_0x118ea1){return _0x118ea1[_0x7bdb('0x1f')]()[_0x7bdb('0x1e')](function(){_0x5daea4[_0x7bdb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d37ac,_0xdad53d){return function(_0x40c447){if(!_0x40c447){_0x1d37ac[_0x7bdb('0x20')](0x194);}return _0x40c447;};}function handleError(_0x481f4b,_0x4d6e44){_0x4d6e44=_0x4d6e44||0x1f4;return function(_0x3c423f){logger['error'](_0x3c423f['stack']);if(_0x3c423f['name']){delete _0x3c423f[_0x7bdb('0x21')];}_0x481f4b['status'](_0x4d6e44)[_0x7bdb('0x22')](_0x3c423f);};}exports[_0x7bdb('0x23')]=function(_0x3ec129,_0x7c09cf){var _0x2a494e={},_0x523869={},_0x10e818={'count':0x0,'rows':[]};var _0x32242d=db[_0x7bdb('0x24')][_0x7bdb('0x25')];_0x523869[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](_0x32242d);_0x523869[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x3ec129[_0x7bdb('0x28')]);_0x523869[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],_0x523869['query']);_0x2a494e[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],qs[_0x7bdb('0x2c')](_0x3ec129[_0x7bdb('0x28')]['fields']));_0x2a494e[_0x7bdb('0x2b')]=_0x2a494e[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2a494e[_0x7bdb('0x2b')]:_0x523869['model'];if(!_0x3ec129['query']['hasOwnProperty'](_0x7bdb('0x2e'))){_0x2a494e['limit']=qs[_0x7bdb('0x19')](_0x3ec129['query'][_0x7bdb('0x19')]);_0x2a494e[_0x7bdb('0x18')]=qs[_0x7bdb('0x18')](_0x3ec129['query'][_0x7bdb('0x18')]);}_0x2a494e['order']=qs['sort'](_0x3ec129[_0x7bdb('0x28')]['sort']);_0x2a494e[_0x7bdb('0x2f')]=qs['filters'](_['pick'](_0x3ec129[_0x7bdb('0x28')],_0x523869[_0x7bdb('0x29')]));if(_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]){_0x2a494e[_0x7bdb('0x2f')]=_[_0x7bdb('0x31')](_0x2a494e['where'],{'$or':_[_0x7bdb('0x32')](_0x32242d,function(_0x464fde){if(_0x464fde[_0x7bdb('0x33')][_0x7bdb('0x34')]!==_0x7bdb('0x35')){var _0x14c522={};_0x14c522[_0x464fde[_0x7bdb('0x36')]]={'$like':'%'+_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]+'%'};return _0x14c522;}})});}_0x2a494e=_['merge']({},_0x2a494e,_0x3ec129['options']);var _0x19c237={'where':_0x2a494e[_0x7bdb('0x2f')]};return db[_0x7bdb('0x24')][_0x7bdb('0x17')](_0x19c237)[_0x7bdb('0x1e')](function(_0x509e90){_0x10e818['count']=_0x509e90;if(_0x3ec129[_0x7bdb('0x28')]['includeAll']){_0x2a494e[_0x7bdb('0x37')]=[{'all':!![]}];}return db['SquareMessage'][_0x7bdb('0x38')](_0x2a494e);})['then'](function(_0x4cf3fa){_0x10e818[_0x7bdb('0x39')]=_0x4cf3fa;return _0x10e818;})[_0x7bdb('0x1e')](respondWithFilteredResult(_0x7c09cf,_0x2a494e))[_0x7bdb('0x3a')](handleError(_0x7c09cf,null));};exports[_0x7bdb('0x3b')]=function(_0x43c7d3,_0x2b4829){var _0x2e10f3={'raw':!![],'where':{'id':_0x43c7d3['params']['id']}},_0x501aff={};_0x501aff[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](db[_0x7bdb('0x24')][_0x7bdb('0x25')]);_0x501aff[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x43c7d3[_0x7bdb('0x28')]);_0x501aff['filters']=_['intersection'](_0x501aff[_0x7bdb('0x26')],_0x501aff[_0x7bdb('0x28')]);_0x2e10f3[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x501aff['model'],qs[_0x7bdb('0x2c')](_0x43c7d3['query'][_0x7bdb('0x2c')]));_0x2e10f3[_0x7bdb('0x2b')]=_0x2e10f3[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2e10f3[_0x7bdb('0x2b')]:_0x501aff[_0x7bdb('0x26')];if(_0x43c7d3[_0x7bdb('0x28')][_0x7bdb('0x3c')]){_0x2e10f3[_0x7bdb('0x37')]=[{'all':!![]}];}_0x2e10f3=_['merge']({},_0x2e10f3,_0x43c7d3[_0x7bdb('0x3d')]);return db[_0x7bdb('0x24')]['find'](_0x2e10f3)[_0x7bdb('0x1e')](handleEntityNotFound(_0x2b4829,null))['then'](respondWithResult(_0x2b4829,null))[_0x7bdb('0x3a')](handleError(_0x2b4829,null));};exports[_0x7bdb('0x3e')]=function(_0x122beb,_0x3a8415){return db[_0x7bdb('0x24')]['create'](_0x122beb[_0x7bdb('0x3f')],{})[_0x7bdb('0x1e')](respondWithResult(_0x3a8415,0xc9))[_0x7bdb('0x3a')](handleError(_0x3a8415,null));};exports[_0x7bdb('0x40')]=function(_0x31244f,_0x5021cd){if(_0x31244f[_0x7bdb('0x3f')]['id']){delete _0x31244f[_0x7bdb('0x3f')]['id'];}return db[_0x7bdb('0x24')][_0x7bdb('0x41')]({'where':{'id':_0x31244f[_0x7bdb('0x42')]['id']}})[_0x7bdb('0x1e')](handleEntityNotFound(_0x5021cd,null))[_0x7bdb('0x1e')](saveUpdates(_0x31244f[_0x7bdb('0x3f')],null))[_0x7bdb('0x1e')](respondWithResult(_0x5021cd,null))[_0x7bdb('0x3a')](handleError(_0x5021cd,null));};exports['destroy']=function(_0x189cf8,_0x58c4bc){return db['SquareMessage'][_0x7bdb('0x41')]({'where':{'id':_0x189cf8[_0x7bdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x58c4bc,null))[_0x7bdb('0x1e')](removeEntity(_0x58c4bc,null))[_0x7bdb('0x3a')](handleError(_0x58c4bc,null));}; \ No newline at end of file +var _0x84a0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','SquareMessage','includeAll','include','findAll','rows','show','params','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','query','filters','intersection','attributes'];(function(_0x2a9be2,_0xc7c386){var _0x160b91=function(_0x45eb0a){while(--_0x45eb0a){_0x2a9be2['push'](_0x2a9be2['shift']());}};_0x160b91(++_0xc7c386);}(_0x84a0,0x66));var _0x084a=function(_0x1dc34f,_0x7de556){_0x1dc34f=_0x1dc34f-0x0;var _0x3d906c=_0x84a0[_0x1dc34f];return _0x3d906c;};'use strict';var pdf=require(_0x084a('0x0'));var emlformat=require(_0x084a('0x1'));var rimraf=require(_0x084a('0x2'));var zipdir=require(_0x084a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x084a('0x4'));var moment=require(_0x084a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x084a('0x6'));var path=require(_0x084a('0x7'));var sox=require('sox');var csv=require(_0x084a('0x8'));var ejs=require(_0x084a('0x9'));var fs=require('fs');var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0x8'));var querystring=require(_0x084a('0xe'));var Papa=require(_0x084a('0xf'));var Redis=require(_0x084a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x084a('0x11'));var logger=require(_0x084a('0x12'))(_0x084a('0x13'));var utils=require(_0x084a('0x14'));var config=require(_0x084a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ef41f,_0xc451b1){_0xc451b1=_0xc451b1||0xcc;return function(_0x3ca72f){if(_0x3ca72f){return _0x4ef41f[_0x084a('0x16')](_0xc451b1);}return _0x4ef41f[_0x084a('0x17')](_0xc451b1)[_0x084a('0x18')]();};}function respondWithResult(_0x414b05,_0x3ff351){_0x3ff351=_0x3ff351||0xc8;return function(_0x3a76d1){if(_0x3a76d1){return _0x414b05['status'](_0x3ff351)[_0x084a('0x19')](_0x3a76d1);}};}function respondWithFilteredResult(_0x4b9cc5,_0x225de0){return function(_0x3ccaca){if(_0x3ccaca){var _0x366624=_0x3ccaca[_0x084a('0x1a')],_0x2d35b8=_0x225de0['offset'],_0xd20527=_0x225de0[_0x084a('0x1b')]+_0x225de0[_0x084a('0x1c')],_0x4cbd16;if(_0xd20527>=_0x366624){_0xd20527=_0x366624;_0x4cbd16=0xc8;}else{_0x4cbd16=0xce;}_0x4b9cc5['status'](_0x4cbd16);return _0x4b9cc5[_0x084a('0x1d')](_0x084a('0x1e'),_0x2d35b8+'-'+_0xd20527+'/'+_0x366624)[_0x084a('0x19')](_0x3ccaca);}return null;};}function patchUpdates(_0x14bb19){return function(_0x33d3a6){try{jsonpatch[_0x084a('0x1f')](_0x33d3a6,_0x14bb19,!![]);}catch(_0x447a19){return BPromise[_0x084a('0x20')](_0x447a19);}return _0x33d3a6[_0x084a('0x21')]();};}function saveUpdates(_0xcb5356,_0x3c7fd6){return function(_0x279e25){if(_0x279e25){return _0x279e25[_0x084a('0x22')](_0xcb5356)[_0x084a('0x23')](function(_0xf0dd98){return _0xf0dd98;});}return null;};}function removeEntity(_0x506f71,_0x343c5c){return function(_0x1ad257){if(_0x1ad257){return _0x1ad257[_0x084a('0x24')]()[_0x084a('0x23')](function(){_0x506f71[_0x084a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x755c24,_0x288e9e){return function(_0x6346a5){if(!_0x6346a5){_0x755c24[_0x084a('0x16')](0x194);}return _0x6346a5;};}function handleError(_0x18b43d,_0x3cdc1e){_0x3cdc1e=_0x3cdc1e||0x1f4;return function(_0x5be167){logger[_0x084a('0x25')](_0x5be167[_0x084a('0x26')]);if(_0x5be167[_0x084a('0x27')]){delete _0x5be167['name'];}_0x18b43d[_0x084a('0x17')](_0x3cdc1e)[_0x084a('0x28')](_0x5be167);};}exports[_0x084a('0x29')]=function(_0x4c5658,_0x5596ac){var _0x4874fe={},_0x52227a={},_0x33b88f={'count':0x0,'rows':[]};var _0x5c5efb=db['SquareMessage']['rawAttributes'];_0x52227a[_0x084a('0x2a')]=_[_0x084a('0x2b')](_0x5c5efb);_0x52227a[_0x084a('0x2c')]=_[_0x084a('0x2b')](_0x4c5658[_0x084a('0x2c')]);_0x52227a[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x52227a[_0x084a('0x2a')],_0x52227a['query']);_0x4874fe[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x52227a['model'],qs[_0x084a('0x30')](_0x4c5658[_0x084a('0x2c')][_0x084a('0x30')]));_0x4874fe[_0x084a('0x2f')]=_0x4874fe[_0x084a('0x2f')][_0x084a('0x31')]?_0x4874fe[_0x084a('0x2f')]:_0x52227a[_0x084a('0x2a')];if(!_0x4c5658[_0x084a('0x2c')][_0x084a('0x32')](_0x084a('0x33'))){_0x4874fe[_0x084a('0x1c')]=qs[_0x084a('0x1c')](_0x4c5658['query']['limit']);_0x4874fe[_0x084a('0x1b')]=qs[_0x084a('0x1b')](_0x4c5658[_0x084a('0x2c')][_0x084a('0x1b')]);}_0x4874fe[_0x084a('0x34')]=qs['sort'](_0x4c5658[_0x084a('0x2c')][_0x084a('0x35')]);_0x4874fe[_0x084a('0x36')]=qs['filters'](_[_0x084a('0x37')](_0x4c5658[_0x084a('0x2c')],_0x52227a[_0x084a('0x2d')]));if(_0x4c5658['query']['filter']){_0x4874fe['where']=_[_0x084a('0x38')](_0x4874fe[_0x084a('0x36')],{'$or':_[_0x084a('0x39')](_0x5c5efb,function(_0x4e594f){if(_0x4e594f[_0x084a('0x3a')][_0x084a('0x3b')]!==_0x084a('0x3c')){var _0x28b199={};_0x28b199[_0x4e594f[_0x084a('0x3d')]]={'$like':'%'+_0x4c5658[_0x084a('0x2c')][_0x084a('0x3e')]+'%'};return _0x28b199;}})});}_0x4874fe=_[_0x084a('0x38')]({},_0x4874fe,_0x4c5658[_0x084a('0x3f')]);var _0x44490d={'where':_0x4874fe[_0x084a('0x36')]};return db[_0x084a('0x40')][_0x084a('0x1a')](_0x44490d)[_0x084a('0x23')](function(_0x10983f){_0x33b88f['count']=_0x10983f;if(_0x4c5658[_0x084a('0x2c')][_0x084a('0x41')]){_0x4874fe[_0x084a('0x42')]=[{'all':!![]}];}return db[_0x084a('0x40')][_0x084a('0x43')](_0x4874fe);})[_0x084a('0x23')](function(_0xa7b652){_0x33b88f[_0x084a('0x44')]=_0xa7b652;return _0x33b88f;})[_0x084a('0x23')](respondWithFilteredResult(_0x5596ac,_0x4874fe))['catch'](handleError(_0x5596ac,null));};exports[_0x084a('0x45')]=function(_0x3d1aa5,_0x25a081){var _0x432eb7={'raw':!![],'where':{'id':_0x3d1aa5[_0x084a('0x46')]['id']}},_0x256008={};_0x256008['model']=_[_0x084a('0x2b')](db[_0x084a('0x40')]['rawAttributes']);_0x256008[_0x084a('0x2c')]=_[_0x084a('0x2b')](_0x3d1aa5[_0x084a('0x2c')]);_0x256008['filters']=_[_0x084a('0x2e')](_0x256008[_0x084a('0x2a')],_0x256008['query']);_0x432eb7[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x256008['model'],qs['fields'](_0x3d1aa5[_0x084a('0x2c')][_0x084a('0x30')]));_0x432eb7[_0x084a('0x2f')]=_0x432eb7[_0x084a('0x2f')][_0x084a('0x31')]?_0x432eb7[_0x084a('0x2f')]:_0x256008[_0x084a('0x2a')];if(_0x3d1aa5[_0x084a('0x2c')][_0x084a('0x41')]){_0x432eb7[_0x084a('0x42')]=[{'all':!![]}];}_0x432eb7=_[_0x084a('0x38')]({},_0x432eb7,_0x3d1aa5['options']);return db['SquareMessage'][_0x084a('0x47')](_0x432eb7)[_0x084a('0x23')](handleEntityNotFound(_0x25a081,null))[_0x084a('0x23')](respondWithResult(_0x25a081,null))['catch'](handleError(_0x25a081,null));};exports[_0x084a('0x48')]=function(_0x1598c4,_0x3092ea){return db[_0x084a('0x40')][_0x084a('0x48')](_0x1598c4['body'],{})[_0x084a('0x23')](respondWithResult(_0x3092ea,0xc9))['catch'](handleError(_0x3092ea,null));};exports[_0x084a('0x22')]=function(_0x4f98c6,_0x1ffd20){if(_0x4f98c6['body']['id']){delete _0x4f98c6['body']['id'];}return db[_0x084a('0x40')][_0x084a('0x47')]({'where':{'id':_0x4f98c6['params']['id']}})[_0x084a('0x23')](handleEntityNotFound(_0x1ffd20,null))[_0x084a('0x23')](saveUpdates(_0x4f98c6[_0x084a('0x49')],null))[_0x084a('0x23')](respondWithResult(_0x1ffd20,null))['catch'](handleError(_0x1ffd20,null));};exports[_0x084a('0x24')]=function(_0x865368,_0x31677b){return db[_0x084a('0x40')]['find']({'where':{'id':_0x865368[_0x084a('0x46')]['id']}})[_0x084a('0x23')](handleEntityNotFound(_0x31677b,null))[_0x084a('0x23')](removeEntity(_0x31677b,null))[_0x084a('0x4a')](handleError(_0x31677b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d0c982a..ced8a4d 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 _0x2847=['request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x57d45b,_0x4651d5){var _0x4ceefb=function(_0x1cb65f){while(--_0x1cb65f){_0x57d45b['push'](_0x57d45b['shift']());}};_0x4ceefb(++_0x4651d5);}(_0x2847,0x1c2));var _0x7284=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2847[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7284('0x0'));var util=require(_0x7284('0x1'));var logger=require(_0x7284('0x2'))(_0x7284('0x3'));var moment=require(_0x7284('0x4'));var BPromise=require('bluebird');var rp=require(_0x7284('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7284('0x6'));var config=require(_0x7284('0x7'));var attributes=require(_0x7284('0x8'));module[_0x7284('0x9')]=function(_0x230715,_0x36d7f5){return _0x230715[_0x7284('0xa')](_0x7284('0xb'),attributes,{'tableName':_0x7284('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x830e=['path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','util','moment','bluebird','request-promise'];(function(_0x539105,_0x4792d5){var _0xacc9a3=function(_0x571ed3){while(--_0x571ed3){_0x539105['push'](_0x539105['shift']());}};_0xacc9a3(++_0x4792d5);}(_0x830e,0xf8));var _0xe830=function(_0x3adec7,_0xca7db9){_0x3adec7=_0x3adec7-0x0;var _0x2b080c=_0x830e[_0x3adec7];return _0x2b080c;};'use strict';var _=require(_0xe830('0x0'));var util=require(_0xe830('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe830('0x2'));var BPromise=require(_0xe830('0x3'));var rp=require(_0xe830('0x4'));var fs=require('fs');var path=require(_0xe830('0x5'));var rimraf=require(_0xe830('0x6'));var config=require(_0xe830('0x7'));var attributes=require(_0xe830('0x8'));module['exports']=function(_0x1eb4e6,_0x208f1b){return _0x1eb4e6[_0xe830('0x9')](_0xe830('0xa'),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 aad291b..80c12a7 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 _0x4188=['CreateSquareMessage','SquareMessage','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x302b7b,_0x37b0f9){var _0x3d287a=function(_0x54d4b6){while(--_0x54d4b6){_0x302b7b['push'](_0x302b7b['shift']());}};_0x3d287a(++_0x37b0f9);}(_0x4188,0x8c));var _0x8418=function(_0xe2e740,_0x347455){_0xe2e740=_0xe2e740-0x0;var _0x4345be=_0x4188[_0xe2e740];return _0x4345be;};'use strict';var _=require(_0x8418('0x0'));var util=require(_0x8418('0x1'));var moment=require('moment');var BPromise=require(_0x8418('0x2'));var rs=require(_0x8418('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8418('0x4'))['db'];var utils=require(_0x8418('0x5'));var logger=require(_0x8418('0x6'))(_0x8418('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8418('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x242f7c,_0x12db0f,_0x80ab45){return new BPromise(function(_0x3a2382,_0x335135){return client[_0x8418('0x9')](_0x242f7c,_0x80ab45)[_0x8418('0xa')](function(_0x17e441){logger[_0x8418('0xb')](_0x8418('0xc'),_0x12db0f,'request\x20sent');logger[_0x8418('0xd')](_0x8418('0xe'),_0x12db0f,_0x8418('0xf'),JSON[_0x8418('0x10')](_0x17e441));if(_0x17e441['error']){if(_0x17e441['error'][_0x8418('0x11')]===0x1f4){logger[_0x8418('0x12')](_0x8418('0xc'),_0x12db0f,_0x17e441[_0x8418('0x12')][_0x8418('0x13')]);return _0x335135(_0x17e441[_0x8418('0x12')][_0x8418('0x13')]);}logger[_0x8418('0x12')](_0x8418('0xc'),_0x12db0f,_0x17e441[_0x8418('0x12')]['message']);return _0x3a2382(_0x17e441[_0x8418('0x12')][_0x8418('0x13')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x12db0f,_0x8418('0xf'));_0x3a2382(_0x17e441[_0x8418('0x14')][_0x8418('0x13')]);}})[_0x8418('0x15')](function(_0x5487ef){logger['error'](_0x8418('0xc'),_0x12db0f,_0x5487ef);_0x335135(_0x5487ef);});});}exports[_0x8418('0x16')]=function(_0x5eca7d){var _0x17673b=this;return new Promise(function(_0x2f8cb3,_0x2e0857){return db[_0x8418('0x17')]['create'](_0x5eca7d[_0x8418('0x18')],{'raw':_0x5eca7d[_0x8418('0x19')]?_0x5eca7d['options'][_0x8418('0x1a')]===undefined?!![]:![]:!![]})[_0x8418('0xa')](function(_0x288310){logger[_0x8418('0xb')]('CreateSquareMessage',_0x5eca7d);logger['debug'](_0x8418('0x16'),_0x5eca7d,JSON[_0x8418('0x10')](_0x288310));_0x2f8cb3(_0x288310);})[_0x8418('0x15')](function(_0x102ed6){logger[_0x8418('0x12')]('CreateSquareMessage',_0x102ed6[_0x8418('0x13')],_0x5eca7d);_0x2e0857(_0x17673b[_0x8418('0x12')](0x1f4,_0x102ed6[_0x8418('0x13')]));});});}; \ No newline at end of file +var _0x083f=['message','result','CreateSquareMessage','SquareMessage','create','body','options','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x13ad16,_0x54be96){var _0x232358=function(_0x517849){while(--_0x517849){_0x13ad16['push'](_0x13ad16['shift']());}};_0x232358(++_0x54be96);}(_0x083f,0xf2));var _0xf083=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x083f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf083('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf083('0x2'));var db=require(_0xf083('0x3'))['db'];var utils=require(_0xf083('0x4'));var logger=require('../../config/logger')(_0xf083('0x5'));var config=require(_0xf083('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf083('0x7')][_0xf083('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x413bc1,_0x5667cb,_0x51378f){return new BPromise(function(_0x5182d6,_0x51915e){return client[_0xf083('0x9')](_0x413bc1,_0x51378f)[_0xf083('0xa')](function(_0x27ec09){logger[_0xf083('0xb')](_0xf083('0xc'),_0x5667cb,_0xf083('0xd'));logger[_0xf083('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5667cb,_0xf083('0xd'),JSON[_0xf083('0xf')](_0x27ec09));if(_0x27ec09[_0xf083('0x10')]){if(_0x27ec09[_0xf083('0x10')][_0xf083('0x11')]===0x1f4){logger[_0xf083('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5667cb,_0x27ec09['error'][_0xf083('0x12')]);return _0x51915e(_0x27ec09['error'][_0xf083('0x12')]);}logger[_0xf083('0x10')](_0xf083('0xc'),_0x5667cb,_0x27ec09['error'][_0xf083('0x12')]);return _0x5182d6(_0x27ec09['error'][_0xf083('0x12')]);}else{logger['info'](_0xf083('0xc'),_0x5667cb,'request\x20sent');_0x5182d6(_0x27ec09[_0xf083('0x13')][_0xf083('0x12')]);}})['catch'](function(_0x21ed0a){logger[_0xf083('0x10')](_0xf083('0xc'),_0x5667cb,_0x21ed0a);_0x51915e(_0x21ed0a);});});}exports[_0xf083('0x14')]=function(_0x3d9521){var _0xe4f58a=this;return new Promise(function(_0x4b52b0,_0x23c7c2){return db[_0xf083('0x15')][_0xf083('0x16')](_0x3d9521[_0xf083('0x17')],{'raw':_0x3d9521['options']?_0x3d9521[_0xf083('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf083('0xa')](function(_0x3f374e){logger[_0xf083('0xb')](_0xf083('0x14'),_0x3d9521);logger['debug'](_0xf083('0x14'),_0x3d9521,JSON['stringify'](_0x3f374e));_0x4b52b0(_0x3f374e);})[_0xf083('0x19')](function(_0x23ced2){logger[_0xf083('0x10')](_0xf083('0x14'),_0x23ced2[_0xf083('0x12')],_0x3d9521);_0x23c7c2(_0xe4f58a[_0xf083('0x10')](0x1f4,_0x23ced2[_0xf083('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4faeda4..63576ed 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 _0x6822=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4036da,_0x4618b4){var _0x3f8a93=function(_0x3c106a){while(--_0x3c106a){_0x4036da['push'](_0x4036da['shift']());}};_0x3f8a93(++_0x4618b4);}(_0x6822,0x18c));var _0x2682=function(_0x201704,_0x558ca8){_0x201704=_0x201704-0x0;var _0x9057bc=_0x6822[_0x201704];return _0x9057bc;};'use strict';var multer=require('multer');var util=require(_0x2682('0x0'));var path=require(_0x2682('0x1'));var timeout=require(_0x2682('0x2'));var express=require(_0x2682('0x3'));var router=express['Router']();var auth=require(_0x2682('0x4'));var interaction=require(_0x2682('0x5'));var config=require(_0x2682('0x6'));var controller=require(_0x2682('0x7'));router[_0x2682('0x8')]('/',auth[_0x2682('0x9')](),controller[_0x2682('0xa')]);router[_0x2682('0x8')](_0x2682('0xb'),auth[_0x2682('0x9')](),controller[_0x2682('0xc')]);router[_0x2682('0x8')](_0x2682('0xd'),auth[_0x2682('0x9')](),timeout('15s'),controller[_0x2682('0xe')]);router[_0x2682('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2682('0xb'),auth[_0x2682('0x9')](),controller['update']);router[_0x2682('0x10')](_0x2682('0xb'),auth['isAuthenticated'](),controller[_0x2682('0x11')]);module[_0x2682('0x12')]=router; \ No newline at end of file +var _0x93e7=['15s','test','post','create','update','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/test','isAuthenticated'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x93e7,0x9e));var _0x793e=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0x93e7[_0x1ce9ea];return _0x2a95b9;};'use strict';var multer=require(_0x793e('0x0'));var util=require('util');var path=require(_0x793e('0x1'));var timeout=require(_0x793e('0x2'));var express=require('express');var router=express[_0x793e('0x3')]();var auth=require(_0x793e('0x4'));var interaction=require(_0x793e('0x5'));var config=require(_0x793e('0x6'));var controller=require('./squareOdbc.controller');router[_0x793e('0x7')]('/',auth['isAuthenticated'](),controller[_0x793e('0x8')]);router['get'](_0x793e('0x9'),auth['isAuthenticated'](),controller[_0x793e('0xa')]);router[_0x793e('0x7')](_0x793e('0xb'),auth[_0x793e('0xc')](),timeout(_0x793e('0xd')),controller[_0x793e('0xe')]);router[_0x793e('0xf')]('/',auth[_0x793e('0xc')](),controller[_0x793e('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x793e('0x11')]);router['delete']('/:id',auth[_0x793e('0xc')](),controller[_0x793e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 7f23000..5516b53 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 _0x3bd6=['STRING','sequelize','exports'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x3bd6,0x1ed));var _0x63bd=function(_0x1cd68a,_0x2a9872){_0x1cd68a=_0x1cd68a-0x0;var _0x485afe=_0x3bd6[_0x1cd68a];return _0x485afe;};'use strict';var Sequelize=require(_0x63bd('0x0'));module[_0x63bd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x63bd('0x2')]},'description':{'type':Sequelize[_0x63bd('0x2')]}}; \ No newline at end of file +var _0xd70a=['name','sequelize','exports','STRING'];(function(_0x12cd87,_0x4a9fbc){var _0x4ee7b9=function(_0x374d9a){while(--_0x374d9a){_0x12cd87['push'](_0x12cd87['shift']());}};_0x4ee7b9(++_0x4a9fbc);}(_0xd70a,0x89));var _0xad70=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xd70a[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0xad70('0x0'));module[_0xad70('0x1')]={'name':{'type':Sequelize[_0xad70('0x2')],'unique':_0xad70('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 91de66f..cf2773c 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 _0xa9e0=['limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','includeAll','include','SquareOdbc','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','test','dsn','openSync','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','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset'];(function(_0x293911,_0x286ed6){var _0x1b42f0=function(_0x137904){while(--_0x137904){_0x293911['push'](_0x293911['shift']());}};_0x1b42f0(++_0x286ed6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){var _0x432e56=_0x5a09ef[_0x0a9e('0x20')]({'plain':!![]});var _0x30bae6='ODBC';return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'type':_0x30bae6,'resourceId':_0x432e56['id']}})[_0x0a9e('0x1f')](function(){return _0x5a09ef;});})[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x13')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x23')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x24')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x25')](_0x33161b);};}exports[_0x0a9e('0x26')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=db['SquareOdbc'][_0x0a9e('0x27')];_0x1538a4[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](_0x14de77);_0x1538a4[_0x0a9e('0x2a')]=_['keys'](_0x25fba9[_0x0a9e('0x2a')]);_0x1538a4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],_0x1538a4[_0x0a9e('0x2a')]);_0x140511[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x25fba9['query'][_0x0a9e('0x2e')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x140511[_0x0a9e('0x2d')]:_0x1538a4[_0x0a9e('0x28')];if(!_0x25fba9[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x140511[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x140511[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x25fba9[_0x0a9e('0x2a')]['offset']);}_0x140511[_0x0a9e('0x31')]=qs['sort'](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x140511[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_['pick'](_0x25fba9[_0x0a9e('0x2a')],_0x1538a4[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]){_0x140511['where']=_['merge'](_0x140511[_0x0a9e('0x33')],{'$or':_['map'](_0x14de77,function(_0x24936a){if(_0x24936a[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4f41ae={};_0x4f41ae[_0x24936a[_0x0a9e('0x38')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]+'%'};return _0x4f41ae;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x39')]);var _0x1a180b={'where':_0x140511[_0x0a9e('0x33')]};return db['SquareOdbc']['count'](_0x1a180b)[_0x0a9e('0x1f')](function(_0x40d766){_0x11c3b6['count']=_0x40d766;if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x140511[_0x0a9e('0x3b')]=[{'all':!![]}];}return db[_0x0a9e('0x3c')]['findAll'](_0x140511);})['then'](function(_0x15e37d){_0x11c3b6[_0x0a9e('0x3d')]=_0x15e37d;return _0x11c3b6;})['then'](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x3e')](handleError(_0x14433c,null));};exports[_0x0a9e('0x3f')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x40')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](db[_0x0a9e('0x3c')][_0x0a9e('0x27')]);_0x2cfea9[_0x0a9e('0x2a')]=_[_0x0a9e('0x29')](_0x1459bb[_0x0a9e('0x2a')]);_0x2cfea9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x2cfea9[_0x0a9e('0x28')],_0x2cfea9[_0x0a9e('0x2a')]);_0x316c8f[_0x0a9e('0x2d')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x2e')](_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x316c8f[_0x0a9e('0x2d')]=_0x316c8f[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x316c8f[_0x0a9e('0x2d')]:_0x2cfea9[_0x0a9e('0x28')];if(_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x316c8f[_0x0a9e('0x3b')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x41')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x316c8f)[_0x0a9e('0x1f')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x1f')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x3e')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x43')]=function(_0x21eb86,_0x44dd99){return db['SquareOdbc'][_0x0a9e('0x43')](_0x21eb86['body'],{})[_0x0a9e('0x1f')](function(_0x476688){var _0x8d6dd1=_0x21eb86['user'][_0x0a9e('0x20')]({'plain':!![]});if(!_0x8d6dd1)throw new Error(_0x0a9e('0x44'));if(_0x8d6dd1[_0x0a9e('0x45')]===_0x0a9e('0x46')){var _0x45c845=_0x476688[_0x0a9e('0x20')]({'plain':!![]});var _0x45bf7f='ODBC';return db[_0x0a9e('0x47')][_0x0a9e('0x42')]({'where':{'name':_0x45bf7f,'userProfileId':_0x8d6dd1[_0x0a9e('0x48')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x409789){if(_0x409789&&_0x409789[_0x0a9e('0x49')]===0x0){return db[_0x0a9e('0x21')][_0x0a9e('0x43')]({'name':_0x45c845[_0x0a9e('0x24')],'resourceId':_0x45c845['id'],'type':_0x409789['name'],'sectionId':_0x409789['id']},{})[_0x0a9e('0x1f')](function(){return _0x476688;});}else{return _0x476688;}})[_0x0a9e('0x3e')](function(_0x4f7240){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7240);throw _0x4f7240;});}return _0x476688;})[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x3e')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x11545a,_0x61bb17){if(_0x11545a[_0x0a9e('0x4b')]['id']){delete _0x11545a[_0x0a9e('0x4b')]['id'];}return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x11545a['params']['id']}})['then'](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x1f')](saveUpdates(_0x11545a[_0x0a9e('0x4b')],null))[_0x0a9e('0x1f')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};exports[_0x0a9e('0x22')]=function(_0x161aa7,_0x53d113){return db['SquareOdbc'][_0x0a9e('0x42')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53d113,null))['then'](removeEntity(_0x53d113,null))[_0x0a9e('0x3e')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4c')]=function(_0x439340,_0x53613a,_0x2f82da){var _0x1bf38a;return db['SquareOdbc']['find']({'where':{'id':_0x439340[_0x0a9e('0x40')]['id']},'attributes':['id',_0x0a9e('0x4d')]})['then'](handleEntityNotFound(_0x53613a,null))[_0x0a9e('0x1f')](function(_0x5ce9ac){if(_0x5ce9ac){var _0x211ef9=require('odbc')();_0x211ef9[_0x0a9e('0x4e')](_0x5ce9ac['dsn']);_0x211ef9['closeSync']();return _0x5ce9ac;}})['then'](respondWithResult(_0x53613a,null))[_0x0a9e('0x3e')](handleError(_0x53613a,null));}; \ No newline at end of file +var _0xa9e0=['limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','includeAll','include','SquareOdbc','rows','catch','show','params','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','test','dsn','openSync','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','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset'];(function(_0x1a50b6,_0x38927c){var _0x2ca6bb=function(_0x5d1e30){while(--_0x5d1e30){_0x1a50b6['push'](_0x1a50b6['shift']());}};_0x2ca6bb(++_0x38927c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 hardwareService=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){var _0x432e56=_0x5a09ef[_0x0a9e('0x20')]({'plain':!![]});var _0x30bae6='ODBC';return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'type':_0x30bae6,'resourceId':_0x432e56['id']}})[_0x0a9e('0x1f')](function(){return _0x5a09ef;});})[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x13')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x23')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x24')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x25')](_0x33161b);};}exports[_0x0a9e('0x26')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=db['SquareOdbc'][_0x0a9e('0x27')];_0x1538a4[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](_0x14de77);_0x1538a4[_0x0a9e('0x2a')]=_['keys'](_0x25fba9[_0x0a9e('0x2a')]);_0x1538a4[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],_0x1538a4[_0x0a9e('0x2a')]);_0x140511[_0x0a9e('0x2d')]=_[_0x0a9e('0x2c')](_0x1538a4[_0x0a9e('0x28')],qs[_0x0a9e('0x2e')](_0x25fba9['query'][_0x0a9e('0x2e')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x140511[_0x0a9e('0x2d')]:_0x1538a4[_0x0a9e('0x28')];if(!_0x25fba9[_0x0a9e('0x2a')]['hasOwnProperty'](_0x0a9e('0x30'))){_0x140511[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x19')]);_0x140511[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x25fba9[_0x0a9e('0x2a')]['offset']);}_0x140511[_0x0a9e('0x31')]=qs['sort'](_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x32')]);_0x140511[_0x0a9e('0x33')]=qs[_0x0a9e('0x2b')](_['pick'](_0x25fba9[_0x0a9e('0x2a')],_0x1538a4[_0x0a9e('0x2b')]));if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]){_0x140511['where']=_['merge'](_0x140511[_0x0a9e('0x33')],{'$or':_['map'](_0x14de77,function(_0x24936a){if(_0x24936a[_0x0a9e('0x35')][_0x0a9e('0x36')]!==_0x0a9e('0x37')){var _0x4f41ae={};_0x4f41ae[_0x24936a[_0x0a9e('0x38')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x34')]+'%'};return _0x4f41ae;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x39')]);var _0x1a180b={'where':_0x140511[_0x0a9e('0x33')]};return db['SquareOdbc']['count'](_0x1a180b)[_0x0a9e('0x1f')](function(_0x40d766){_0x11c3b6['count']=_0x40d766;if(_0x25fba9[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x140511[_0x0a9e('0x3b')]=[{'all':!![]}];}return db[_0x0a9e('0x3c')]['findAll'](_0x140511);})['then'](function(_0x15e37d){_0x11c3b6[_0x0a9e('0x3d')]=_0x15e37d;return _0x11c3b6;})['then'](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x3e')](handleError(_0x14433c,null));};exports[_0x0a9e('0x3f')]=function(_0x1459bb,_0x5b4f5e){var _0x316c8f={'raw':!![],'where':{'id':_0x1459bb[_0x0a9e('0x40')]['id']}},_0x2cfea9={};_0x2cfea9[_0x0a9e('0x28')]=_[_0x0a9e('0x29')](db[_0x0a9e('0x3c')][_0x0a9e('0x27')]);_0x2cfea9[_0x0a9e('0x2a')]=_[_0x0a9e('0x29')](_0x1459bb[_0x0a9e('0x2a')]);_0x2cfea9[_0x0a9e('0x2b')]=_[_0x0a9e('0x2c')](_0x2cfea9[_0x0a9e('0x28')],_0x2cfea9[_0x0a9e('0x2a')]);_0x316c8f[_0x0a9e('0x2d')]=_['intersection'](_0x2cfea9['model'],qs[_0x0a9e('0x2e')](_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x316c8f[_0x0a9e('0x2d')]=_0x316c8f[_0x0a9e('0x2d')][_0x0a9e('0x2f')]?_0x316c8f[_0x0a9e('0x2d')]:_0x2cfea9[_0x0a9e('0x28')];if(_0x1459bb[_0x0a9e('0x2a')][_0x0a9e('0x3a')]){_0x316c8f[_0x0a9e('0x3b')]=[{'all':!![]}];}_0x316c8f=_[_0x0a9e('0x41')]({},_0x316c8f,_0x1459bb['options']);return db[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x316c8f)[_0x0a9e('0x1f')](handleEntityNotFound(_0x5b4f5e,null))[_0x0a9e('0x1f')](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0x3e')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x43')]=function(_0x21eb86,_0x44dd99){return db['SquareOdbc'][_0x0a9e('0x43')](_0x21eb86['body'],{})[_0x0a9e('0x1f')](function(_0x476688){var _0x8d6dd1=_0x21eb86['user'][_0x0a9e('0x20')]({'plain':!![]});if(!_0x8d6dd1)throw new Error(_0x0a9e('0x44'));if(_0x8d6dd1[_0x0a9e('0x45')]===_0x0a9e('0x46')){var _0x45c845=_0x476688[_0x0a9e('0x20')]({'plain':!![]});var _0x45bf7f='ODBC';return db[_0x0a9e('0x47')][_0x0a9e('0x42')]({'where':{'name':_0x45bf7f,'userProfileId':_0x8d6dd1[_0x0a9e('0x48')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x409789){if(_0x409789&&_0x409789[_0x0a9e('0x49')]===0x0){return db[_0x0a9e('0x21')][_0x0a9e('0x43')]({'name':_0x45c845[_0x0a9e('0x24')],'resourceId':_0x45c845['id'],'type':_0x409789['name'],'sectionId':_0x409789['id']},{})[_0x0a9e('0x1f')](function(){return _0x476688;});}else{return _0x476688;}})[_0x0a9e('0x3e')](function(_0x4f7240){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7240);throw _0x4f7240;});}return _0x476688;})[_0x0a9e('0x1f')](respondWithResult(_0x44dd99,0xc9))[_0x0a9e('0x3e')](handleError(_0x44dd99,null));};exports[_0x0a9e('0x4a')]=function(_0x11545a,_0x61bb17){if(_0x11545a[_0x0a9e('0x4b')]['id']){delete _0x11545a[_0x0a9e('0x4b')]['id'];}return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x11545a['params']['id']}})['then'](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x1f')](saveUpdates(_0x11545a[_0x0a9e('0x4b')],null))[_0x0a9e('0x1f')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};exports[_0x0a9e('0x22')]=function(_0x161aa7,_0x53d113){return db['SquareOdbc'][_0x0a9e('0x42')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x53d113,null))['then'](removeEntity(_0x53d113,null))[_0x0a9e('0x3e')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4c')]=function(_0x439340,_0x53613a,_0x2f82da){var _0x1bf38a;return db['SquareOdbc']['find']({'where':{'id':_0x439340[_0x0a9e('0x40')]['id']},'attributes':['id',_0x0a9e('0x4d')]})['then'](handleEntityNotFound(_0x53613a,null))[_0x0a9e('0x1f')](function(_0x5ce9ac){if(_0x5ce9ac){var _0x211ef9=require('odbc')();_0x211ef9[_0x0a9e('0x4e')](_0x5ce9ac['dsn']);_0x211ef9['closeSync']();return _0x5ce9ac;}})['then'](respondWithResult(_0x53613a,null))[_0x0a9e('0x3e')](handleError(_0x53613a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 492055f..cd3f5fe 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 _0xfe7b=['./squareOdbc.attributes','define','SquareOdbc','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23f564,_0x48d2ba){var _0x47582b=function(_0x3a8876){while(--_0x3a8876){_0x23f564['push'](_0x23f564['shift']());}};_0x47582b(++_0x48d2ba);}(_0xfe7b,0x1e7));var _0xbfe7=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0xfe7b[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0xbfe7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbfe7('0x1'));var moment=require(_0xbfe7('0x2'));var BPromise=require(_0xbfe7('0x3'));var rp=require(_0xbfe7('0x4'));var fs=require('fs');var path=require(_0xbfe7('0x5'));var rimraf=require(_0xbfe7('0x6'));var config=require(_0xbfe7('0x7'));var attributes=require(_0xbfe7('0x8'));module['exports']=function(_0x32a95d,_0xe5cca2){return _0x32a95d[_0xbfe7('0x9')](_0xbfe7('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07fe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api'];(function(_0x1f1d95,_0x270481){var _0x1b1b82=function(_0x99e490){while(--_0x99e490){_0x1f1d95['push'](_0x1f1d95['shift']());}};_0x1b1b82(++_0x270481);}(_0x07fe,0x177));var _0xe07f=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x07fe[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0xe07f('0x0'));var util=require(_0xe07f('0x1'));var logger=require('../../config/logger')(_0xe07f('0x2'));var moment=require(_0xe07f('0x3'));var BPromise=require(_0xe07f('0x4'));var rp=require(_0xe07f('0x5'));var fs=require('fs');var path=require(_0xe07f('0x6'));var rimraf=require(_0xe07f('0x7'));var config=require(_0xe07f('0x8'));var attributes=require(_0xe07f('0x9'));module[_0xe07f('0xa')]=function(_0xc05328,_0x280c7c){return _0xc05328[_0xe07f('0xb')](_0xe07f('0xc'),attributes,{'tableName':_0xe07f('0xd'),'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 2fd2e07..4c9b6b2 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 _0x836d=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model'];(function(_0x5866aa,_0x294bce){var _0x241540=function(_0x1d960b){while(--_0x1d960b){_0x5866aa['push'](_0x5866aa['shift']());}};_0x241540(++_0x294bce);}(_0x836d,0xe0));var _0xd836=function(_0x2055a7,_0x415a4c){_0x2055a7=_0x2055a7-0x0;var _0x42a14d=_0x836d[_0x2055a7];return _0x42a14d;};'use strict';var _=require(_0xd836('0x0'));var util=require(_0xd836('0x1'));var moment=require(_0xd836('0x2'));var BPromise=require(_0xd836('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd836('0x4'))['db'];var utils=require(_0xd836('0x5'));var logger=require(_0xd836('0x6'))(_0xd836('0x7'));var config=require(_0xd836('0x8'));var jayson=require(_0xd836('0x9'));var client=jayson[_0xd836('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x216533,_0x207cde,_0x3574a9){return new BPromise(function(_0x1ef50e,_0x469df5){return client[_0xd836('0xb')](_0x216533,_0x3574a9)[_0xd836('0xc')](function(_0x792295){logger[_0xd836('0xd')](_0xd836('0xe'),_0x207cde,_0xd836('0xf'));logger[_0xd836('0x10')](_0xd836('0x11'),_0x207cde,_0xd836('0xf'),JSON[_0xd836('0x12')](_0x792295));if(_0x792295['error']){if(_0x792295['error'][_0xd836('0x13')]===0x1f4){logger[_0xd836('0x14')](_0xd836('0xe'),_0x207cde,_0x792295[_0xd836('0x14')]['message']);return _0x469df5(_0x792295['error'][_0xd836('0x15')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x207cde,_0x792295[_0xd836('0x14')][_0xd836('0x15')]);return _0x1ef50e(_0x792295[_0xd836('0x14')]['message']);}else{logger[_0xd836('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x207cde,_0xd836('0xf'));_0x1ef50e(_0x792295['result'][_0xd836('0x15')]);}})[_0xd836('0x16')](function(_0x12cf4a){logger['error'](_0xd836('0xe'),_0x207cde,_0x12cf4a);_0x469df5(_0x12cf4a);});});}exports[_0xd836('0x17')]=function(_0x15682e){var _0x27b31b=this;return new Promise(function(_0x846673,_0x53f4a9){return db[_0xd836('0x18')][_0xd836('0x19')]({'raw':_0x15682e[_0xd836('0x1a')]?_0x15682e[_0xd836('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x15682e[_0xd836('0x1a')]?_0x15682e[_0xd836('0x1a')][_0xd836('0x1b')]||null:null,'attributes':_0x15682e[_0xd836('0x1a')]?_0x15682e['options'][_0xd836('0x1c')]||null:null,'include':_0x15682e[_0xd836('0x1a')]?_0x15682e['options'][_0xd836('0x1d')]?_[_0xd836('0x1e')](_0x15682e[_0xd836('0x1a')][_0xd836('0x1d')],function(_0x595d39){return{'model':db[_0x595d39[_0xd836('0x1f')]],'as':_0x595d39['as'],'attributes':_0x595d39[_0xd836('0x1c')],'include':_0x595d39['include']?_['map'](_0x595d39[_0xd836('0x1d')],function(_0x9c2b65){return{'model':db[_0x9c2b65['model']],'as':_0x9c2b65['as'],'attributes':_0x9c2b65[_0xd836('0x1c')],'include':_0x9c2b65[_0xd836('0x1d')]?_[_0xd836('0x1e')](_0x9c2b65[_0xd836('0x1d')],function(_0xe6bac4){return{'model':db[_0xe6bac4[_0xd836('0x1f')]],'as':_0xe6bac4['as'],'attributes':_0xe6bac4[_0xd836('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd836('0xc')](function(_0x3f8848){logger[_0xd836('0xd')](_0xd836('0x17'),_0x15682e);logger['debug']('ShowSquareOdbc',_0x15682e,JSON[_0xd836('0x12')](_0x3f8848));_0x846673(_0x3f8848);})['catch'](function(_0x421518){logger['error'](_0xd836('0x17'),_0x421518[_0xd836('0x15')],_0x15682e);_0x53f4a9(_0x27b31b[_0xd836('0x14')](0x1f4,_0x421518[_0xd836('0x15')]));});});}; \ No newline at end of file +var _0xd1d6=['jayson/promise','client','http','request','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x52e021,_0x2d3b29){var _0x42c0cf=function(_0x38fb10){while(--_0x38fb10){_0x52e021['push'](_0x52e021['shift']());}};_0x42c0cf(++_0x2d3b29);}(_0xd1d6,0xa4));var _0x6d1d=function(_0x523aca,_0x3badd1){_0x523aca=_0x523aca-0x0;var _0x33e844=_0xd1d6[_0x523aca];return _0x33e844;};'use strict';var _=require(_0x6d1d('0x0'));var util=require(_0x6d1d('0x1'));var moment=require(_0x6d1d('0x2'));var BPromise=require(_0x6d1d('0x3'));var rs=require(_0x6d1d('0x4'));var fs=require('fs');var Redis=require(_0x6d1d('0x5'));var db=require(_0x6d1d('0x6'))['db'];var utils=require(_0x6d1d('0x7'));var logger=require(_0x6d1d('0x8'))(_0x6d1d('0x9'));var config=require(_0x6d1d('0xa'));var jayson=require(_0x6d1d('0xb'));var client=jayson[_0x6d1d('0xc')][_0x6d1d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xabed77,_0x5593eb,_0x47e41a){return new BPromise(function(_0x1250ee,_0x10459d){return client[_0x6d1d('0xe')](_0xabed77,_0x47e41a)[_0x6d1d('0xf')](function(_0x2ca98a){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x5593eb,_0x6d1d('0x10'));logger[_0x6d1d('0x11')](_0x6d1d('0x12'),_0x5593eb,'request\x20sent',JSON[_0x6d1d('0x13')](_0x2ca98a));if(_0x2ca98a[_0x6d1d('0x14')]){if(_0x2ca98a[_0x6d1d('0x14')][_0x6d1d('0x15')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5593eb,_0x2ca98a[_0x6d1d('0x14')][_0x6d1d('0x16')]);return _0x10459d(_0x2ca98a[_0x6d1d('0x14')]['message']);}logger[_0x6d1d('0x14')](_0x6d1d('0x17'),_0x5593eb,_0x2ca98a['error'][_0x6d1d('0x16')]);return _0x1250ee(_0x2ca98a[_0x6d1d('0x14')]['message']);}else{logger['info'](_0x6d1d('0x17'),_0x5593eb,'request\x20sent');_0x1250ee(_0x2ca98a[_0x6d1d('0x18')][_0x6d1d('0x16')]);}})[_0x6d1d('0x19')](function(_0x21aef7){logger[_0x6d1d('0x14')](_0x6d1d('0x17'),_0x5593eb,_0x21aef7);_0x10459d(_0x21aef7);});});}exports[_0x6d1d('0x1a')]=function(_0x302a9e){var _0x224690=this;return new Promise(function(_0x1a7ebc,_0x3fe3a2){return db[_0x6d1d('0x1b')]['find']({'raw':_0x302a9e[_0x6d1d('0x1c')]?_0x302a9e['options'][_0x6d1d('0x1d')]===undefined?!![]:![]:!![],'where':_0x302a9e[_0x6d1d('0x1c')]?_0x302a9e[_0x6d1d('0x1c')][_0x6d1d('0x1e')]||null:null,'attributes':_0x302a9e[_0x6d1d('0x1c')]?_0x302a9e[_0x6d1d('0x1c')][_0x6d1d('0x1f')]||null:null,'include':_0x302a9e[_0x6d1d('0x1c')]?_0x302a9e[_0x6d1d('0x1c')]['include']?_[_0x6d1d('0x20')](_0x302a9e[_0x6d1d('0x1c')][_0x6d1d('0x21')],function(_0x4927d1){return{'model':db[_0x4927d1['model']],'as':_0x4927d1['as'],'attributes':_0x4927d1[_0x6d1d('0x1f')],'include':_0x4927d1[_0x6d1d('0x21')]?_['map'](_0x4927d1[_0x6d1d('0x21')],function(_0x56f4c4){return{'model':db[_0x56f4c4[_0x6d1d('0x22')]],'as':_0x56f4c4['as'],'attributes':_0x56f4c4['attributes'],'include':_0x56f4c4['include']?_[_0x6d1d('0x20')](_0x56f4c4[_0x6d1d('0x21')],function(_0x1a77c9){return{'model':db[_0x1a77c9['model']],'as':_0x1a77c9['as'],'attributes':_0x1a77c9[_0x6d1d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d1d('0xf')](function(_0x1d2784){logger['info'](_0x6d1d('0x1a'),_0x302a9e);logger['debug'](_0x6d1d('0x1a'),_0x302a9e,JSON[_0x6d1d('0x13')](_0x1d2784));_0x1a7ebc(_0x1d2784);})[_0x6d1d('0x19')](function(_0x576513){logger['error'](_0x6d1d('0x1a'),_0x576513['message'],_0x302a9e);_0x3fe3a2(_0x224690['error'](0x1f4,_0x576513[_0x6d1d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4a5cfdb..94d0269 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 _0xffc4=['isAuthenticated','index','/:id','show','/:id/users','post','create','addUsers','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffc4,0x84));var _0x4ffc=function(_0x307070,_0x34ce6c){_0x307070=_0x307070-0x0;var _0x33cccb=_0xffc4[_0x307070];return _0x33cccb;};'use strict';var multer=require(_0x4ffc('0x0'));var util=require(_0x4ffc('0x1'));var path=require(_0x4ffc('0x2'));var timeout=require(_0x4ffc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4ffc('0x4'));var interaction=require(_0x4ffc('0x5'));var config=require(_0x4ffc('0x6'));var controller=require('./squareProject.controller');router[_0x4ffc('0x7')]('/',auth[_0x4ffc('0x8')](),controller[_0x4ffc('0x9')]);router['get'](_0x4ffc('0xa'),auth['isAuthenticated'](),controller[_0x4ffc('0xb')]);router[_0x4ffc('0x7')](_0x4ffc('0xc'),auth[_0x4ffc('0x8')](),controller['getUsers']);router[_0x4ffc('0xd')]('/',auth[_0x4ffc('0x8')](),controller[_0x4ffc('0xe')]);router[_0x4ffc('0xd')](_0x4ffc('0xc'),auth[_0x4ffc('0x8')](),controller[_0x4ffc('0xf')]);router[_0x4ffc('0x10')](_0x4ffc('0xa'),auth[_0x4ffc('0x8')](),controller[_0x4ffc('0x11')]);router[_0x4ffc('0x12')]('/:id',auth[_0x4ffc('0x8')](),controller['destroy']);router['delete'](_0x4ffc('0xc'),auth[_0x4ffc('0x8')](),controller['removeUsers']);module[_0x4ffc('0x13')]=router; \ No newline at end of file +var _0x3180=['get','/:id','isAuthenticated','getUsers','create','post','/:id/users','put','update','delete','destroy','removeUsers','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x3180,0x19b));var _0x0318=function(_0x27466a,_0x4c0b5b){_0x27466a=_0x27466a-0x0;var _0x5c2d64=_0x3180[_0x27466a];return _0x5c2d64;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0318('0x0'));var timeout=require(_0x0318('0x1'));var express=require(_0x0318('0x2'));var router=express['Router']();var auth=require(_0x0318('0x3'));var interaction=require(_0x0318('0x4'));var config=require(_0x0318('0x5'));var controller=require(_0x0318('0x6'));router[_0x0318('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0318('0x8'),auth[_0x0318('0x9')](),controller['show']);router[_0x0318('0x7')]('/:id/users',auth[_0x0318('0x9')](),controller[_0x0318('0xa')]);router['post']('/',auth[_0x0318('0x9')](),controller[_0x0318('0xb')]);router[_0x0318('0xc')](_0x0318('0xd'),auth['isAuthenticated'](),controller['addUsers']);router[_0x0318('0xe')](_0x0318('0x8'),auth[_0x0318('0x9')](),controller[_0x0318('0xf')]);router[_0x0318('0x10')]('/:id',auth[_0x0318('0x9')](),controller[_0x0318('0x11')]);router['delete'](_0x0318('0xd'),auth[_0x0318('0x9')](),controller[_0x0318('0x12')]);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 2924920..4b74004 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 _0x91c6=['BLOB','long','preproduction','getDataValue','toString','utf8','production','sequelize','name','STRING','TEXT'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x91c6,0xf9));var _0x691c=function(_0x532583,_0xbe8f92){_0x532583=_0x532583-0x0;var _0x2a8306=_0x91c6[_0x532583];return _0x2a8306;};'use strict';var Sequelize=require(_0x691c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x691c('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x691c('0x2')]},'notes':{'type':Sequelize[_0x691c('0x3')]},'preproduction':{'type':Sequelize[_0x691c('0x4')](_0x691c('0x5')),'get':function(){if(this['getDataValue'](_0x691c('0x6'))){return this[_0x691c('0x7')](_0x691c('0x6'))[_0x691c('0x8')](_0x691c('0x9'));}}},'production':{'type':Sequelize[_0x691c('0x4')]('long'),'get':function(){if(this[_0x691c('0x7')](_0x691c('0xa'))){return this[_0x691c('0x7')](_0x691c('0xa'))['toString'](_0x691c('0x9'));}}}}; \ No newline at end of file +var _0xa992=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0xc3f66b,_0x436c69){var _0x40715f=function(_0x112577){while(--_0x112577){_0xc3f66b['push'](_0xc3f66b['shift']());}};_0x40715f(++_0x436c69);}(_0xa992,0x18c));var _0x2a99=function(_0x3521e7,_0x2981d7){_0x3521e7=_0x3521e7-0x0;var _0x29f64a=_0xa992[_0x3521e7];return _0x29f64a;};'use strict';var Sequelize=require(_0x2a99('0x0'));module[_0x2a99('0x1')]={'name':{'type':Sequelize[_0x2a99('0x2')],'unique':_0x2a99('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x2a99('0x4')]},'preproduction':{'type':Sequelize[_0x2a99('0x5')](_0x2a99('0x6')),'get':function(){if(this[_0x2a99('0x7')](_0x2a99('0x8'))){return this[_0x2a99('0x7')](_0x2a99('0x8'))[_0x2a99('0x9')](_0x2a99('0xa'));}}},'production':{'type':Sequelize[_0x2a99('0x5')]('long'),'get':function(){if(this[_0x2a99('0x7')](_0x2a99('0xb'))){return this[_0x2a99('0x7')](_0x2a99('0xb'))[_0x2a99('0x9')](_0x2a99('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 760ea50..9dc77c8 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 _0xe909=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','pick','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','count','offset','set','Content-Range','json','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','SquareProject','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','map','type','key','VIRTUAL','filter','options','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x256a10,_0x1e30ae){var _0x597116=function(_0x1122ae){while(--_0x1122ae){_0x256a10['push'](_0x256a10['shift']());}};_0x597116(++_0x1e30ae);}(_0xe909,0xc7));var _0x9e90=function(_0x2a1dd1,_0x3794df){_0x2a1dd1=_0x2a1dd1-0x0;var _0x132c45=_0xe909[_0x2a1dd1];return _0x132c45;};'use strict';var pdf=require(_0x9e90('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9e90('0x1'));var zipdir=require(_0x9e90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e90('0x3'));var moment=require(_0x9e90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e90('0x5'));var util=require(_0x9e90('0x6'));var path=require(_0x9e90('0x7'));var sox=require(_0x9e90('0x8'));var csv=require(_0x9e90('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e90('0xa'));var squel=require(_0x9e90('0xb'));var crypto=require(_0x9e90('0xc'));var jsforce=require(_0x9e90('0xd'));var deskjs=require(_0x9e90('0xe'));var toCsv=require(_0x9e90('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e90('0xf'));var authService=require(_0x9e90('0x10'));var qs=require(_0x9e90('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e90('0x12'))(_0x9e90('0x13'));var utils=require(_0x9e90('0x14'));var config=require(_0x9e90('0x15'));var db=require(_0x9e90('0x16'))['db'];config[_0x9e90('0x17')]=_[_0x9e90('0x18')](config[_0x9e90('0x17')],{'host':_0x9e90('0x19'),'port':0x18eb});var socket=require(_0x9e90('0x1a'))(new Redis(config[_0x9e90('0x17')]));require('./squareProject.socket')[_0x9e90('0x1b')](socket);function respondWithStatusCode(_0x2104bc,_0x5c21ce){_0x5c21ce=_0x5c21ce||0xcc;return function(_0x41fe9e){if(_0x41fe9e){return _0x2104bc['sendStatus'](_0x5c21ce);}return _0x2104bc[_0x9e90('0x1c')](_0x5c21ce)[_0x9e90('0x1d')]();};}function respondWithResult(_0x1c8db4,_0x541166){_0x541166=_0x541166||0xc8;return function(_0x2f3604){if(_0x2f3604){return _0x1c8db4[_0x9e90('0x1c')](_0x541166)['json'](_0x2f3604);}};}function respondWithFilteredResult(_0x39fc89,_0xe1e61f){return function(_0x210ab5){if(_0x210ab5){var _0x5b5c66=_0x210ab5[_0x9e90('0x1e')],_0x48f2a9=_0xe1e61f[_0x9e90('0x1f')],_0x10f3ed=_0xe1e61f[_0x9e90('0x1f')]+_0xe1e61f['limit'],_0x2dde0a;if(_0x10f3ed>=_0x5b5c66){_0x10f3ed=_0x5b5c66;_0x2dde0a=0xc8;}else{_0x2dde0a=0xce;}_0x39fc89['status'](_0x2dde0a);return _0x39fc89[_0x9e90('0x20')](_0x9e90('0x21'),_0x48f2a9+'-'+_0x10f3ed+'/'+_0x5b5c66)[_0x9e90('0x22')](_0x210ab5);}return null;};}function patchUpdates(_0x486982){return function(_0xfbf364){try{jsonpatch[_0x9e90('0x23')](_0xfbf364,_0x486982,!![]);}catch(_0xb5f163){return BPromise['reject'](_0xb5f163);}return _0xfbf364[_0x9e90('0x24')]();};}function saveUpdates(_0x4c1f46,_0xfcdb7d){return function(_0x165ae7){if(_0x165ae7){return _0x165ae7[_0x9e90('0x25')](_0x4c1f46)[_0x9e90('0x26')](function(_0x1d0bbd){return _0x1d0bbd;});}return null;};}function removeEntity(_0x5f450d,_0x7dd348){return function(_0x44df27){if(_0x44df27){return _0x44df27['destroy']()[_0x9e90('0x26')](function(){var _0x40a256=_0x44df27[_0x9e90('0x27')]({'plain':!![]});var _0x2ff187='SquareProjects';return db[_0x9e90('0x28')][_0x9e90('0x29')]({'where':{'type':_0x2ff187,'resourceId':_0x40a256['id']}})[_0x9e90('0x26')](function(){return _0x44df27;});})[_0x9e90('0x26')](function(){_0x5f450d[_0x9e90('0x1c')](0xcc)[_0x9e90('0x1d')]();});}};}function handleEntityNotFound(_0x3722bc,_0x36c6dc){return function(_0x5aef66){if(!_0x5aef66){_0x3722bc['sendStatus'](0x194);}return _0x5aef66;};}function handleError(_0x21475a,_0x2ea054){_0x2ea054=_0x2ea054||0x1f4;return function(_0x11e0ae){logger[_0x9e90('0x2a')](_0x11e0ae[_0x9e90('0x2b')]);if(_0x11e0ae[_0x9e90('0x2c')]){delete _0x11e0ae[_0x9e90('0x2c')];}_0x21475a[_0x9e90('0x1c')](_0x2ea054)[_0x9e90('0x2d')](_0x11e0ae);};}exports['index']=function(_0x562a78,_0x3c8163){var _0x2e0e37={},_0x417e2b={},_0x19a635={'count':0x0,'rows':[]};var _0x2a98ef=db[_0x9e90('0x2e')][_0x9e90('0x2f')];_0x417e2b[_0x9e90('0x30')]=_[_0x9e90('0x31')](_0x2a98ef);_0x417e2b[_0x9e90('0x32')]=_['keys'](_0x562a78[_0x9e90('0x32')]);_0x417e2b[_0x9e90('0x33')]=_['intersection'](_0x417e2b['model'],_0x417e2b['query']);_0x2e0e37[_0x9e90('0x34')]=_[_0x9e90('0x35')](_0x417e2b['model'],qs['fields'](_0x562a78[_0x9e90('0x32')][_0x9e90('0x36')]));_0x2e0e37['attributes']=_0x2e0e37[_0x9e90('0x34')][_0x9e90('0x37')]?_0x2e0e37[_0x9e90('0x34')]:_0x417e2b['model'];if(!_0x562a78['query'][_0x9e90('0x38')](_0x9e90('0x39'))){_0x2e0e37[_0x9e90('0x3a')]=qs[_0x9e90('0x3a')](_0x562a78[_0x9e90('0x32')]['limit']);_0x2e0e37[_0x9e90('0x1f')]=qs['offset'](_0x562a78[_0x9e90('0x32')][_0x9e90('0x1f')]);}_0x2e0e37[_0x9e90('0x3b')]=qs['sort'](_0x562a78[_0x9e90('0x32')][_0x9e90('0x3c')]);_0x2e0e37[_0x9e90('0x3d')]=qs[_0x9e90('0x33')](_['pick'](_0x562a78[_0x9e90('0x32')],_0x417e2b[_0x9e90('0x33')]));if(_0x562a78[_0x9e90('0x32')]['filter']){_0x2e0e37[_0x9e90('0x3d')]=_[_0x9e90('0x3e')](_0x2e0e37[_0x9e90('0x3d')],{'$or':_[_0x9e90('0x3f')](_0x2a98ef,function(_0x3eef3b){if(_0x3eef3b[_0x9e90('0x40')][_0x9e90('0x41')]!==_0x9e90('0x42')){var _0x15922f={};_0x15922f[_0x3eef3b['field']]={'$like':'%'+_0x562a78['query'][_0x9e90('0x43')]+'%'};return _0x15922f;}})});}_0x2e0e37=_[_0x9e90('0x3e')]({},_0x2e0e37,_0x562a78[_0x9e90('0x44')]);var _0x49db69={'where':_0x2e0e37[_0x9e90('0x3d')]};return db['SquareProject'][_0x9e90('0x1e')](_0x49db69)['then'](function(_0x1c4f92){_0x19a635[_0x9e90('0x1e')]=_0x1c4f92;if(_0x562a78[_0x9e90('0x32')]['includeAll']){_0x2e0e37[_0x9e90('0x45')]=[{'all':!![]}];}return db[_0x9e90('0x2e')][_0x9e90('0x46')](_0x2e0e37);})[_0x9e90('0x26')](function(_0x207871){_0x19a635['rows']=_0x207871;return _0x19a635;})[_0x9e90('0x26')](respondWithFilteredResult(_0x3c8163,_0x2e0e37))[_0x9e90('0x47')](handleError(_0x3c8163,null));};exports[_0x9e90('0x48')]=function(_0x4cd395,_0xcf5716){var _0x1965c1={'raw':![],'where':{'id':_0x4cd395[_0x9e90('0x49')]['id']}},_0x43a41d={};_0x43a41d['model']=_[_0x9e90('0x31')](db['SquareProject'][_0x9e90('0x2f')]);_0x43a41d[_0x9e90('0x32')]=_[_0x9e90('0x31')](_0x4cd395[_0x9e90('0x32')]);_0x43a41d[_0x9e90('0x33')]=_[_0x9e90('0x35')](_0x43a41d[_0x9e90('0x30')],_0x43a41d[_0x9e90('0x32')]);_0x1965c1[_0x9e90('0x34')]=_['intersection'](_0x43a41d[_0x9e90('0x30')],qs[_0x9e90('0x36')](_0x4cd395['query'][_0x9e90('0x36')]));_0x1965c1['attributes']=_0x1965c1['attributes'][_0x9e90('0x37')]?_0x1965c1['attributes']:_0x43a41d[_0x9e90('0x30')];if(_0x4cd395['query']['includeAll']){_0x1965c1[_0x9e90('0x45')]=[{'all':!![]}];}_0x1965c1=_[_0x9e90('0x3e')]({},_0x1965c1,_0x4cd395[_0x9e90('0x44')]);return db[_0x9e90('0x2e')]['find'](_0x1965c1)[_0x9e90('0x26')](handleEntityNotFound(_0xcf5716,null))['then'](respondWithResult(_0xcf5716,null))[_0x9e90('0x47')](handleError(_0xcf5716,null));};exports[_0x9e90('0x4a')]=function(_0x2ff945,_0x27484e){return db[_0x9e90('0x2e')]['create'](_0x2ff945[_0x9e90('0x4b')],{})[_0x9e90('0x26')](function(_0x590ca9){var _0x285ec0=_0x2ff945[_0x9e90('0x4c')][_0x9e90('0x27')]({'plain':!![]});if(!_0x285ec0)throw new Error(_0x9e90('0x4d'));if(_0x285ec0[_0x9e90('0x4e')]==='user'){var _0x1c3ebf=_0x590ca9[_0x9e90('0x27')]({'plain':!![]});var _0x146ea6='SquareProjects';return db[_0x9e90('0x4f')][_0x9e90('0x50')]({'where':{'name':_0x146ea6,'userProfileId':_0x285ec0[_0x9e90('0x51')]},'raw':!![]})['then'](function(_0x20beec){if(_0x20beec&&_0x20beec[_0x9e90('0x52')]===0x0){return db[_0x9e90('0x28')]['create']({'name':_0x1c3ebf[_0x9e90('0x2c')],'resourceId':_0x1c3ebf['id'],'type':_0x20beec['name'],'sectionId':_0x20beec['id']},{})['then'](function(){return _0x590ca9;});}else{return _0x590ca9;}})[_0x9e90('0x47')](function(_0x32c765){logger['error'](_0x9e90('0x53'),_0x32c765);throw _0x32c765;});}return _0x590ca9;})[_0x9e90('0x26')](respondWithResult(_0x27484e,0xc9))[_0x9e90('0x47')](handleError(_0x27484e,null));};exports[_0x9e90('0x25')]=function(_0x1d3867,_0x5da9fc){if(_0x1d3867[_0x9e90('0x4b')]['id']){delete _0x1d3867[_0x9e90('0x4b')]['id'];}return db[_0x9e90('0x2e')][_0x9e90('0x50')]({'where':{'id':_0x1d3867[_0x9e90('0x49')]['id']}})[_0x9e90('0x26')](handleEntityNotFound(_0x5da9fc,null))[_0x9e90('0x26')](saveUpdates(_0x1d3867[_0x9e90('0x4b')],null))[_0x9e90('0x26')](respondWithResult(_0x5da9fc,null))[_0x9e90('0x47')](handleError(_0x5da9fc,null));};exports[_0x9e90('0x29')]=function(_0x5cc2b6,_0x580f2e){return db[_0x9e90('0x2e')][_0x9e90('0x50')]({'where':{'id':_0x5cc2b6[_0x9e90('0x49')]['id']}})['then'](handleEntityNotFound(_0x580f2e,null))['then'](removeEntity(_0x580f2e,null))['catch'](handleError(_0x580f2e,null));};exports['addUsers']=function(_0xe45444,_0x360fc3,_0xfde7b3){return db[_0x9e90('0x2e')][_0x9e90('0x50')]({'where':{'id':_0xe45444[_0x9e90('0x49')]['id']}})[_0x9e90('0x26')](handleEntityNotFound(_0x360fc3,null))[_0x9e90('0x26')](function(_0x5f511e){if(_0x5f511e){return _0x5f511e[_0x9e90('0x54')](_0xe45444[_0x9e90('0x4b')][_0x9e90('0x55')],_[_0x9e90('0x56')](_0xe45444[_0x9e90('0x4b')],['ids','id'])||{});}})[_0x9e90('0x26')](respondWithResult(_0x360fc3,null))[_0x9e90('0x47')](handleError(_0x360fc3,null));};exports[_0x9e90('0x57')]=function(_0x107057,_0x536386,_0x17035d){return db[_0x9e90('0x2e')][_0x9e90('0x50')]({'where':{'id':_0x107057[_0x9e90('0x49')]['id']}})['then'](handleEntityNotFound(_0x536386,null))[_0x9e90('0x26')](function(_0x26e707){if(_0x26e707){return _0x26e707[_0x9e90('0x57')](_0x107057[_0x9e90('0x32')][_0x9e90('0x55')])['then'](function(){if(_['isArray'](_0x107057['query'][_0x9e90('0x55')])){for(var _0x2fe1da=0x0;_0x2fe1da<_0x107057[_0x9e90('0x32')]['ids'][_0x9e90('0x37')];_0x2fe1da+=0x1){socket[_0x9e90('0x58')](_0x9e90('0x59'),{'UserId':Number(_0x107057[_0x9e90('0x32')][_0x9e90('0x55')][_0x2fe1da]),'SquareProjectId':Number(_0x107057[_0x9e90('0x49')]['id'])});}}else{socket['emit'](_0x9e90('0x59'),{'UserId':Number(_0x107057[_0x9e90('0x32')][_0x9e90('0x55')]),'SquareProjectId':Number(_0x107057[_0x9e90('0x49')]['id'])});}});}})[_0x9e90('0x26')](respondWithStatusCode(_0x536386,null))[_0x9e90('0x47')](handleError(_0x536386,null));};exports[_0x9e90('0x5a')]=function(_0x125ee2,_0x48d9db,_0xc3c7d4){var _0x393301={};var _0x11fbd7={};var _0x8e6094;var _0x50750b;return db[_0x9e90('0x2e')][_0x9e90('0x5b')]({'where':{'id':_0x125ee2[_0x9e90('0x49')]['id']}})[_0x9e90('0x26')](handleEntityNotFound(_0x48d9db,null))[_0x9e90('0x26')](function(_0x152160){if(_0x152160){_0x8e6094=_0x152160;_0x11fbd7['model']=_[_0x9e90('0x31')](db['User'][_0x9e90('0x2f')]);_0x11fbd7[_0x9e90('0x32')]=_[_0x9e90('0x31')](_0x125ee2[_0x9e90('0x32')]);_0x11fbd7[_0x9e90('0x33')]=_[_0x9e90('0x35')](_0x11fbd7['model'],_0x11fbd7[_0x9e90('0x32')]);_0x393301[_0x9e90('0x34')]=_[_0x9e90('0x35')](_0x11fbd7[_0x9e90('0x30')],qs['fields'](_0x125ee2['query']['fields']));_0x393301['attributes']=_0x393301[_0x9e90('0x34')]['length']?_0x393301[_0x9e90('0x34')]:_0x11fbd7[_0x9e90('0x30')];_0x393301[_0x9e90('0x3b')]=qs[_0x9e90('0x3c')](_0x125ee2[_0x9e90('0x32')]['sort']);_0x393301[_0x9e90('0x3d')]=qs[_0x9e90('0x33')](_[_0x9e90('0x5c')](_0x125ee2['query'],_0x11fbd7[_0x9e90('0x33')]));if(_0x125ee2[_0x9e90('0x32')][_0x9e90('0x43')]){_0x393301['where']=_[_0x9e90('0x3e')](_0x393301[_0x9e90('0x3d')],{'$or':_['map'](_0x393301[_0x9e90('0x34')],function(_0x580ec8){var _0x367295={};_0x367295[_0x580ec8]={'$like':'%'+_0x125ee2[_0x9e90('0x32')]['filter']+'%'};return _0x367295;})});}_0x393301=_[_0x9e90('0x3e')]({},_0x393301,_0x125ee2[_0x9e90('0x44')]);return _0x8e6094[_0x9e90('0x5a')](_0x393301);}})[_0x9e90('0x26')](function(_0x5bb768){if(_0x5bb768){_0x50750b=_0x5bb768[_0x9e90('0x37')];if(!_0x125ee2[_0x9e90('0x32')][_0x9e90('0x38')](_0x9e90('0x39'))){_0x393301[_0x9e90('0x3a')]=qs[_0x9e90('0x3a')](_0x125ee2['query'][_0x9e90('0x3a')]);_0x393301[_0x9e90('0x1f')]=qs['offset'](_0x125ee2[_0x9e90('0x32')][_0x9e90('0x1f')]);}return _0x8e6094[_0x9e90('0x5a')](_0x393301);}})[_0x9e90('0x26')](function(_0x47752e){if(_0x47752e){return _0x47752e?{'count':_0x50750b,'rows':_0x47752e}:null;}})['then'](respondWithResult(_0x48d9db,null))['catch'](handleError(_0x48d9db,null));}; \ No newline at end of file +var _0x1f75=['fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','key','VIRTUAL','field','filter','options','SquareProject','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','json','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','keys','query','intersection','attributes','model'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x1f75,0x1c1));var _0x51f7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1f75[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x51f7('0x0'));var emlformat=require(_0x51f7('0x1'));var rimraf=require(_0x51f7('0x2'));var zipdir=require(_0x51f7('0x3'));var jsonpatch=require(_0x51f7('0x4'));var rp=require(_0x51f7('0x5'));var moment=require(_0x51f7('0x6'));var BPromise=require(_0x51f7('0x7'));var Mustache=require(_0x51f7('0x8'));var util=require(_0x51f7('0x9'));var path=require(_0x51f7('0xa'));var sox=require(_0x51f7('0xb'));var csv=require(_0x51f7('0xc'));var ejs=require(_0x51f7('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51f7('0xe'));var crypto=require(_0x51f7('0xf'));var jsforce=require(_0x51f7('0x10'));var deskjs=require(_0x51f7('0x11'));var toCsv=require(_0x51f7('0xc'));var querystring=require(_0x51f7('0x12'));var Papa=require(_0x51f7('0x13'));var Redis=require(_0x51f7('0x14'));var authService=require(_0x51f7('0x15'));var qs=require(_0x51f7('0x16'));var hardwareService=require(_0x51f7('0x17'));var logger=require(_0x51f7('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x51f7('0x19'))['db'];config[_0x51f7('0x1a')]=_[_0x51f7('0x1b')](config['redis'],{'host':_0x51f7('0x1c'),'port':0x18eb});var socket=require(_0x51f7('0x1d'))(new Redis(config[_0x51f7('0x1a')]));require(_0x51f7('0x1e'))[_0x51f7('0x1f')](socket);function respondWithStatusCode(_0x1405a4,_0x49cf77){_0x49cf77=_0x49cf77||0xcc;return function(_0xb3d0b1){if(_0xb3d0b1){return _0x1405a4[_0x51f7('0x20')](_0x49cf77);}return _0x1405a4[_0x51f7('0x21')](_0x49cf77)[_0x51f7('0x22')]();};}function respondWithResult(_0x1dd987,_0xc5062f){_0xc5062f=_0xc5062f||0xc8;return function(_0x13680f){if(_0x13680f){return _0x1dd987[_0x51f7('0x21')](_0xc5062f)['json'](_0x13680f);}};}function respondWithFilteredResult(_0x42a46e,_0x42af97){return function(_0x3906b0){if(_0x3906b0){var _0x40e8ca=_0x3906b0[_0x51f7('0x23')],_0x5468a0=_0x42af97[_0x51f7('0x24')],_0x442697=_0x42af97[_0x51f7('0x24')]+_0x42af97[_0x51f7('0x25')],_0x12b0cd;if(_0x442697>=_0x40e8ca){_0x442697=_0x40e8ca;_0x12b0cd=0xc8;}else{_0x12b0cd=0xce;}_0x42a46e[_0x51f7('0x21')](_0x12b0cd);return _0x42a46e[_0x51f7('0x26')]('Content-Range',_0x5468a0+'-'+_0x442697+'/'+_0x40e8ca)[_0x51f7('0x27')](_0x3906b0);}return null;};}function patchUpdates(_0x1ecc20){return function(_0x14cd24){try{jsonpatch['apply'](_0x14cd24,_0x1ecc20,!![]);}catch(_0x2e4ace){return BPromise[_0x51f7('0x28')](_0x2e4ace);}return _0x14cd24['save']();};}function saveUpdates(_0x2794c3,_0x1da3b3){return function(_0x29d673){if(_0x29d673){return _0x29d673[_0x51f7('0x29')](_0x2794c3)[_0x51f7('0x2a')](function(_0x4dbc21){return _0x4dbc21;});}return null;};}function removeEntity(_0x454abc,_0x1db1b2){return function(_0x28bd02){if(_0x28bd02){return _0x28bd02[_0x51f7('0x2b')]()['then'](function(){var _0x57c03d=_0x28bd02[_0x51f7('0x2c')]({'plain':!![]});var _0x5bcd87='SquareProjects';return db[_0x51f7('0x2d')]['destroy']({'where':{'type':_0x5bcd87,'resourceId':_0x57c03d['id']}})[_0x51f7('0x2a')](function(){return _0x28bd02;});})[_0x51f7('0x2a')](function(){_0x454abc[_0x51f7('0x21')](0xcc)[_0x51f7('0x22')]();});}};}function handleEntityNotFound(_0x3a879d,_0x11763d){return function(_0x383aaa){if(!_0x383aaa){_0x3a879d[_0x51f7('0x20')](0x194);}return _0x383aaa;};}function handleError(_0x3a3801,_0x1819fc){_0x1819fc=_0x1819fc||0x1f4;return function(_0x592bf4){logger[_0x51f7('0x2e')](_0x592bf4[_0x51f7('0x2f')]);if(_0x592bf4[_0x51f7('0x30')]){delete _0x592bf4[_0x51f7('0x30')];}_0x3a3801[_0x51f7('0x21')](_0x1819fc)[_0x51f7('0x31')](_0x592bf4);};}exports[_0x51f7('0x32')]=function(_0x408a29,_0x2ffb8c){var _0x3a51a1={},_0x2baf86={},_0x373b23={'count':0x0,'rows':[]};var _0x40a1bc=db['SquareProject']['rawAttributes'];_0x2baf86['model']=_[_0x51f7('0x33')](_0x40a1bc);_0x2baf86[_0x51f7('0x34')]=_[_0x51f7('0x33')](_0x408a29['query']);_0x2baf86['filters']=_[_0x51f7('0x35')](_0x2baf86['model'],_0x2baf86['query']);_0x3a51a1[_0x51f7('0x36')]=_[_0x51f7('0x35')](_0x2baf86[_0x51f7('0x37')],qs[_0x51f7('0x38')](_0x408a29[_0x51f7('0x34')]['fields']));_0x3a51a1[_0x51f7('0x36')]=_0x3a51a1['attributes']['length']?_0x3a51a1[_0x51f7('0x36')]:_0x2baf86[_0x51f7('0x37')];if(!_0x408a29['query'][_0x51f7('0x39')](_0x51f7('0x3a'))){_0x3a51a1[_0x51f7('0x25')]=qs[_0x51f7('0x25')](_0x408a29[_0x51f7('0x34')]['limit']);_0x3a51a1[_0x51f7('0x24')]=qs['offset'](_0x408a29['query']['offset']);}_0x3a51a1['order']=qs['sort'](_0x408a29['query'][_0x51f7('0x3b')]);_0x3a51a1[_0x51f7('0x3c')]=qs[_0x51f7('0x3d')](_[_0x51f7('0x3e')](_0x408a29[_0x51f7('0x34')],_0x2baf86[_0x51f7('0x3d')]));if(_0x408a29[_0x51f7('0x34')]['filter']){_0x3a51a1[_0x51f7('0x3c')]=_[_0x51f7('0x3f')](_0x3a51a1['where'],{'$or':_['map'](_0x40a1bc,function(_0x494e88){if(_0x494e88[_0x51f7('0x40')][_0x51f7('0x41')]!==_0x51f7('0x42')){var _0x4a1dba={};_0x4a1dba[_0x494e88[_0x51f7('0x43')]]={'$like':'%'+_0x408a29[_0x51f7('0x34')][_0x51f7('0x44')]+'%'};return _0x4a1dba;}})});}_0x3a51a1=_['merge']({},_0x3a51a1,_0x408a29[_0x51f7('0x45')]);var _0x2b0e18={'where':_0x3a51a1[_0x51f7('0x3c')]};return db[_0x51f7('0x46')][_0x51f7('0x23')](_0x2b0e18)[_0x51f7('0x2a')](function(_0x2bbf96){_0x373b23['count']=_0x2bbf96;if(_0x408a29['query']['includeAll']){_0x3a51a1['include']=[{'all':!![]}];}return db[_0x51f7('0x46')][_0x51f7('0x47')](_0x3a51a1);})[_0x51f7('0x2a')](function(_0x365a42){_0x373b23[_0x51f7('0x48')]=_0x365a42;return _0x373b23;})[_0x51f7('0x2a')](respondWithFilteredResult(_0x2ffb8c,_0x3a51a1))[_0x51f7('0x49')](handleError(_0x2ffb8c,null));};exports[_0x51f7('0x4a')]=function(_0x259dd1,_0x437e94){var _0x57050b={'raw':![],'where':{'id':_0x259dd1[_0x51f7('0x4b')]['id']}},_0xe73071={};_0xe73071['model']=_[_0x51f7('0x33')](db[_0x51f7('0x46')][_0x51f7('0x4c')]);_0xe73071['query']=_['keys'](_0x259dd1['query']);_0xe73071['filters']=_[_0x51f7('0x35')](_0xe73071['model'],_0xe73071['query']);_0x57050b[_0x51f7('0x36')]=_['intersection'](_0xe73071[_0x51f7('0x37')],qs[_0x51f7('0x38')](_0x259dd1[_0x51f7('0x34')][_0x51f7('0x38')]));_0x57050b[_0x51f7('0x36')]=_0x57050b[_0x51f7('0x36')][_0x51f7('0x4d')]?_0x57050b[_0x51f7('0x36')]:_0xe73071['model'];if(_0x259dd1[_0x51f7('0x34')]['includeAll']){_0x57050b[_0x51f7('0x4e')]=[{'all':!![]}];}_0x57050b=_[_0x51f7('0x3f')]({},_0x57050b,_0x259dd1['options']);return db[_0x51f7('0x46')][_0x51f7('0x4f')](_0x57050b)[_0x51f7('0x2a')](handleEntityNotFound(_0x437e94,null))[_0x51f7('0x2a')](respondWithResult(_0x437e94,null))['catch'](handleError(_0x437e94,null));};exports[_0x51f7('0x50')]=function(_0x255231,_0x10bb33){return db[_0x51f7('0x46')][_0x51f7('0x50')](_0x255231[_0x51f7('0x51')],{})['then'](function(_0x525854){var _0x4db19a=_0x255231[_0x51f7('0x52')][_0x51f7('0x2c')]({'plain':!![]});if(!_0x4db19a)throw new Error(_0x51f7('0x53'));if(_0x4db19a[_0x51f7('0x54')]===_0x51f7('0x52')){var _0x33ec27=_0x525854[_0x51f7('0x2c')]({'plain':!![]});var _0x3c83e9=_0x51f7('0x55');return db[_0x51f7('0x56')]['find']({'where':{'name':_0x3c83e9,'userProfileId':_0x4db19a[_0x51f7('0x57')]},'raw':!![]})[_0x51f7('0x2a')](function(_0x210b9e){if(_0x210b9e&&_0x210b9e[_0x51f7('0x58')]===0x0){return db[_0x51f7('0x2d')][_0x51f7('0x50')]({'name':_0x33ec27[_0x51f7('0x30')],'resourceId':_0x33ec27['id'],'type':_0x210b9e[_0x51f7('0x30')],'sectionId':_0x210b9e['id']},{})[_0x51f7('0x2a')](function(){return _0x525854;});}else{return _0x525854;}})[_0x51f7('0x49')](function(_0x3f9d67){logger[_0x51f7('0x2e')](_0x51f7('0x59'),_0x3f9d67);throw _0x3f9d67;});}return _0x525854;})[_0x51f7('0x2a')](respondWithResult(_0x10bb33,0xc9))[_0x51f7('0x49')](handleError(_0x10bb33,null));};exports[_0x51f7('0x29')]=function(_0x306eb9,_0x4279e4){if(_0x306eb9[_0x51f7('0x51')]['id']){delete _0x306eb9[_0x51f7('0x51')]['id'];}return db[_0x51f7('0x46')][_0x51f7('0x4f')]({'where':{'id':_0x306eb9['params']['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x4279e4,null))[_0x51f7('0x2a')](saveUpdates(_0x306eb9[_0x51f7('0x51')],null))[_0x51f7('0x2a')](respondWithResult(_0x4279e4,null))[_0x51f7('0x49')](handleError(_0x4279e4,null));};exports[_0x51f7('0x2b')]=function(_0x62554c,_0x12fec0){return db[_0x51f7('0x46')][_0x51f7('0x4f')]({'where':{'id':_0x62554c[_0x51f7('0x4b')]['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x12fec0,null))[_0x51f7('0x2a')](removeEntity(_0x12fec0,null))[_0x51f7('0x49')](handleError(_0x12fec0,null));};exports['addUsers']=function(_0x9b22e0,_0x33c4d8,_0x3c6f49){return db[_0x51f7('0x46')][_0x51f7('0x4f')]({'where':{'id':_0x9b22e0[_0x51f7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33c4d8,null))[_0x51f7('0x2a')](function(_0x56dc2c){if(_0x56dc2c){return _0x56dc2c[_0x51f7('0x5a')](_0x9b22e0[_0x51f7('0x51')][_0x51f7('0x5b')],_[_0x51f7('0x5c')](_0x9b22e0[_0x51f7('0x51')],[_0x51f7('0x5b'),'id'])||{});}})[_0x51f7('0x2a')](respondWithResult(_0x33c4d8,null))[_0x51f7('0x49')](handleError(_0x33c4d8,null));};exports[_0x51f7('0x5d')]=function(_0x2e69e1,_0x51ce2f,_0x142b15){return db['SquareProject']['find']({'where':{'id':_0x2e69e1[_0x51f7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51ce2f,null))[_0x51f7('0x2a')](function(_0x5409b5){if(_0x5409b5){return _0x5409b5[_0x51f7('0x5d')](_0x2e69e1[_0x51f7('0x34')][_0x51f7('0x5b')])[_0x51f7('0x2a')](function(){if(_[_0x51f7('0x5e')](_0x2e69e1[_0x51f7('0x34')]['ids'])){for(var _0x1241fc=0x0;_0x1241fc<_0x2e69e1[_0x51f7('0x34')][_0x51f7('0x5b')][_0x51f7('0x4d')];_0x1241fc+=0x1){socket[_0x51f7('0x5f')](_0x51f7('0x60'),{'UserId':Number(_0x2e69e1[_0x51f7('0x34')][_0x51f7('0x5b')][_0x1241fc]),'SquareProjectId':Number(_0x2e69e1[_0x51f7('0x4b')]['id'])});}}else{socket[_0x51f7('0x5f')]('userSquareProject:remove',{'UserId':Number(_0x2e69e1[_0x51f7('0x34')][_0x51f7('0x5b')]),'SquareProjectId':Number(_0x2e69e1[_0x51f7('0x4b')]['id'])});}});}})[_0x51f7('0x2a')](respondWithStatusCode(_0x51ce2f,null))['catch'](handleError(_0x51ce2f,null));};exports[_0x51f7('0x61')]=function(_0x30f46c,_0x44dae2,_0x297b28){var _0x3448b4={};var _0x2234d4={};var _0x139be2;var _0x4683a0;return db[_0x51f7('0x46')][_0x51f7('0x62')]({'where':{'id':_0x30f46c['params']['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x44dae2,null))[_0x51f7('0x2a')](function(_0x119bb2){if(_0x119bb2){_0x139be2=_0x119bb2;_0x2234d4['model']=_['keys'](db['User'][_0x51f7('0x4c')]);_0x2234d4['query']=_[_0x51f7('0x33')](_0x30f46c[_0x51f7('0x34')]);_0x2234d4[_0x51f7('0x3d')]=_['intersection'](_0x2234d4[_0x51f7('0x37')],_0x2234d4['query']);_0x3448b4[_0x51f7('0x36')]=_[_0x51f7('0x35')](_0x2234d4[_0x51f7('0x37')],qs[_0x51f7('0x38')](_0x30f46c[_0x51f7('0x34')][_0x51f7('0x38')]));_0x3448b4[_0x51f7('0x36')]=_0x3448b4[_0x51f7('0x36')]['length']?_0x3448b4[_0x51f7('0x36')]:_0x2234d4['model'];_0x3448b4[_0x51f7('0x63')]=qs[_0x51f7('0x3b')](_0x30f46c[_0x51f7('0x34')][_0x51f7('0x3b')]);_0x3448b4[_0x51f7('0x3c')]=qs[_0x51f7('0x3d')](_[_0x51f7('0x3e')](_0x30f46c['query'],_0x2234d4['filters']));if(_0x30f46c[_0x51f7('0x34')][_0x51f7('0x44')]){_0x3448b4[_0x51f7('0x3c')]=_[_0x51f7('0x3f')](_0x3448b4[_0x51f7('0x3c')],{'$or':_[_0x51f7('0x64')](_0x3448b4[_0x51f7('0x36')],function(_0x2c40ae){var _0x3d954b={};_0x3d954b[_0x2c40ae]={'$like':'%'+_0x30f46c[_0x51f7('0x34')]['filter']+'%'};return _0x3d954b;})});}_0x3448b4=_[_0x51f7('0x3f')]({},_0x3448b4,_0x30f46c[_0x51f7('0x45')]);return _0x139be2[_0x51f7('0x61')](_0x3448b4);}})[_0x51f7('0x2a')](function(_0x10f885){if(_0x10f885){_0x4683a0=_0x10f885[_0x51f7('0x4d')];if(!_0x30f46c[_0x51f7('0x34')][_0x51f7('0x39')](_0x51f7('0x3a'))){_0x3448b4['limit']=qs[_0x51f7('0x25')](_0x30f46c[_0x51f7('0x34')][_0x51f7('0x25')]);_0x3448b4[_0x51f7('0x24')]=qs[_0x51f7('0x24')](_0x30f46c['query'][_0x51f7('0x24')]);}return _0x139be2[_0x51f7('0x61')](_0x3448b4);}})[_0x51f7('0x2a')](function(_0x16fd88){if(_0x16fd88){return _0x16fd88?{'count':_0x4683a0,'rows':_0x16fd88}:null;}})[_0x51f7('0x2a')](respondWithResult(_0x44dae2,null))[_0x51f7('0x49')](handleError(_0x44dae2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b0ae081..68ae155 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 _0x83fa=['../../mysqldb','SquareProject','setMaxListeners','remove','hasOwnProperty','exports'];(function(_0x49f3ea,_0x399a85){var _0x3ca709=function(_0x1051f8){while(--_0x1051f8){_0x49f3ea['push'](_0x49f3ea['shift']());}};_0x3ca709(++_0x399a85);}(_0x83fa,0xcc));var _0xa83f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x83fa[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xa83f('0x0'))['db'][_0xa83f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa83f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa83f('0x3')};function emitEvent(_0x2e3eab){return function(_0x1ccb3d,_0x418b18,_0x11aa6b){SquareProjectEvents['emit'](_0x2e3eab+':'+_0x1ccb3d['id'],_0x1ccb3d);SquareProjectEvents['emit'](_0x2e3eab,_0x1ccb3d);_0x11aa6b(null);};}for(var e in events){if(events[_0xa83f('0x4')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa83f('0x5')]=SquareProjectEvents; \ No newline at end of file +var _0xee6d=['exports','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x13e64b,_0x458b05){var _0x58855c=function(_0x3b6b66){while(--_0x3b6b66){_0x13e64b['push'](_0x13e64b['shift']());}};_0x58855c(++_0x458b05);}(_0xee6d,0x1d6));var _0xdee6=function(_0x5bc293,_0x120044){_0x5bc293=_0x5bc293-0x0;var _0x13a373=_0xee6d[_0x5bc293];return _0x13a373;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xdee6('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdee6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdee6('0x2')};function emitEvent(_0x7e3ca7){return function(_0x389ab5,_0x59ed77,_0xb08950){SquareProjectEvents[_0xdee6('0x3')](_0x7e3ca7+':'+_0x389ab5['id'],_0x389ab5);SquareProjectEvents[_0xdee6('0x3')](_0x7e3ca7,_0x389ab5);_0xb08950(null);};}for(var e in events){if(events[_0xdee6('0x4')](e)){var event=events[e];SquareProject[_0xdee6('0x5')](e,emitEvent(event));}}module[_0xdee6('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b43ddf5..47070e4 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 _0xcc19=['request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','util','../../config/logger','api','moment','bluebird'];(function(_0x3e36d5,_0x3c0359){var _0x3ebbff=function(_0x764547){while(--_0x764547){_0x3e36d5['push'](_0x3e36d5['shift']());}};_0x3ebbff(++_0x3c0359);}(_0xcc19,0x74));var _0x9cc1=function(_0xbd1f60,_0x470e77){_0xbd1f60=_0xbd1f60-0x0;var _0x25802f=_0xcc19[_0xbd1f60];return _0x25802f;};'use strict';var _=require('lodash');var util=require(_0x9cc1('0x0'));var logger=require(_0x9cc1('0x1'))(_0x9cc1('0x2'));var moment=require(_0x9cc1('0x3'));var BPromise=require(_0x9cc1('0x4'));var rp=require(_0x9cc1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cc1('0x6'));var config=require(_0x9cc1('0x7'));var attributes=require(_0x9cc1('0x8'));module[_0x9cc1('0x9')]=function(_0x30f17f,_0x6b1256){return _0x30f17f[_0x9cc1('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe37d=['exports','SquareProject','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x358aa5,_0x30e661){var _0x398506=function(_0x40eb42){while(--_0x40eb42){_0x358aa5['push'](_0x358aa5['shift']());}};_0x398506(++_0x30e661);}(_0xe37d,0x106));var _0xde37=function(_0x5614e8,_0x30aa3e){_0x5614e8=_0x5614e8-0x0;var _0x522ee3=_0xe37d[_0x5614e8];return _0x522ee3;};'use strict';var _=require(_0xde37('0x0'));var util=require(_0xde37('0x1'));var logger=require(_0xde37('0x2'))('api');var moment=require(_0xde37('0x3'));var BPromise=require('bluebird');var rp=require(_0xde37('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde37('0x5'));var config=require(_0xde37('0x6'));var attributes=require(_0xde37('0x7'));module[_0xde37('0x8')]=function(_0x4d2782,_0x4c7407){return _0x4d2782['define'](_0xde37('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3857739..1c2a27d 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 _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4c4681,_0x3f0984){var _0x592309=function(_0x2794c2){while(--_0x2794c2){_0x4c4681['push'](_0x4c4681['shift']());}};_0x592309(++_0x3f0984);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1783b0,_0x3cc23c){var _0xbc205a=function(_0x53a294){while(--_0x53a294){_0x1783b0['push'](_0x1783b0['shift']());}};_0xbc205a(++_0x3cc23c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 90d9e68..f09f819 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 _0x61a1=['remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x53fae1,_0x4bb8b0){var _0x3dd2cd=function(_0x21b0fd){while(--_0x21b0fd){_0x53fae1['push'](_0x53fae1['shift']());}};_0x3dd2cd(++_0x4bb8b0);}(_0x61a1,0x127));var _0x161a=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x61a1[_0x2d61b2];return _0x12df89;};'use strict';var SquareProjectEvents=require(_0x161a('0x0'));var events=[_0x161a('0x1'),_0x161a('0x2'),_0x161a('0x3')];function createListener(_0x180d9a,_0x4fd537){return function(_0x16162f){_0x4fd537[_0x161a('0x4')](_0x180d9a,_0x16162f);};}function removeListener(_0x52aadb,_0x1775e8){return function(){SquareProjectEvents[_0x161a('0x5')](_0x52aadb,_0x1775e8);};}exports[_0x161a('0x6')]=function(_0x1442cf){for(var _0x1bb0ac=0x0,_0x45b1e8=events[_0x161a('0x7')];_0x1bb0ac<_0x45b1e8;_0x1bb0ac++){var _0x182e6c=events[_0x1bb0ac];var _0x3e07e5=createListener(_0x161a('0x8')+_0x182e6c,_0x1442cf);SquareProjectEvents['on'](_0x182e6c,_0x3e07e5);}}; \ No newline at end of file +var _0x5455=['remove','update','emit','removeListener','register','length','squareProject:','save'];(function(_0x582809,_0x2ccb6c){var _0x5300b0=function(_0x4a93dc){while(--_0x4a93dc){_0x582809['push'](_0x582809['shift']());}};_0x5300b0(++_0x2ccb6c);}(_0x5455,0x197));var _0x5545=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5455[_0x2641f9];return _0x585741;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x5545('0x0'),_0x5545('0x1'),_0x5545('0x2')];function createListener(_0x414d1c,_0xba68b3){return function(_0x38b608){_0xba68b3[_0x5545('0x3')](_0x414d1c,_0x38b608);};}function removeListener(_0x4cd466,_0x48fce5){return function(){SquareProjectEvents[_0x5545('0x4')](_0x4cd466,_0x48fce5);};}exports[_0x5545('0x5')]=function(_0x5c22f1){for(var _0x5a6ac7=0x0,_0x2ea57f=events[_0x5545('0x6')];_0x5a6ac7<_0x2ea57f;_0x5a6ac7++){var _0x5c2476=events[_0x5a6ac7];var _0x9cbb0d=createListener(_0x5545('0x7')+_0x5c2476,_0x5c22f1);SquareProjectEvents['on'](_0x5c2476,_0x9cbb0d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 41f8bcc..f9396b7 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 _0x2955=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get','/:id','isAuthenticated','/:id/download','post','create','put','update'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2955,0xc6));var _0x5295=function(_0x9247d7,_0x44932a){_0x9247d7=_0x9247d7-0x0;var _0xfaa72f=_0x2955[_0x9247d7];return _0xfaa72f;};'use strict';var multer=require('multer');var util=require(_0x5295('0x0'));var path=require(_0x5295('0x1'));var timeout=require(_0x5295('0x2'));var express=require(_0x5295('0x3'));var router=express[_0x5295('0x4')]();var auth=require(_0x5295('0x5'));var interaction=require(_0x5295('0x6'));var config=require(_0x5295('0x7'));var controller=require(_0x5295('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5295('0x9')]);router[_0x5295('0xa')](_0x5295('0xb'),auth[_0x5295('0xc')](),controller['show']);router[_0x5295('0xa')](_0x5295('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x5295('0xe')]('/',auth[_0x5295('0xc')](),controller[_0x5295('0xf')]);router[_0x5295('0x10')](_0x5295('0xb'),auth[_0x5295('0xc')](),controller[_0x5295('0x11')]);router['delete'](_0x5295('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa7d8=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','create','update','delete','exports','multer','path','express','Router','../../components/interaction/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa7d8,0x94));var _0x8a7d=function(_0x595368,_0x11ef02){_0x595368=_0x595368-0x0;var _0x325015=_0xa7d8[_0x595368];return _0x325015;};'use strict';var multer=require(_0x8a7d('0x0'));var util=require('util');var path=require(_0x8a7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a7d('0x2'));var router=express[_0x8a7d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a7d('0x4'));var config=require(_0x8a7d('0x5'));var controller=require(_0x8a7d('0x6'));router[_0x8a7d('0x7')]('/',auth[_0x8a7d('0x8')](),controller[_0x8a7d('0x9')]);router['get'](_0x8a7d('0xa'),auth[_0x8a7d('0x8')](),controller['show']);router[_0x8a7d('0x7')]('/:id/download',auth[_0x8a7d('0x8')](),controller[_0x8a7d('0xb')]);router[_0x8a7d('0xc')]('/',auth[_0x8a7d('0x8')](),controller[_0x8a7d('0xd')]);router['put'](_0x8a7d('0xa'),auth['isAuthenticated'](),controller[_0x8a7d('0xe')]);router[_0x8a7d('0xf')](_0x8a7d('0xa'),auth[_0x8a7d('0x8')](),controller['destroy']);module[_0x8a7d('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index c6b112c..0f69c1f 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 _0xdbdc=['STRING','sequelize'];(function(_0x2813a4,_0x215957){var _0x3915f1=function(_0x3c9c85){while(--_0x3c9c85){_0x2813a4['push'](_0x2813a4['shift']());}};_0x3915f1(++_0x215957);}(_0xdbdc,0xa5));var _0xcdbd=function(_0x5aa798,_0x179c12){_0x5aa798=_0x5aa798-0x0;var _0x5ee588=_0xdbdc[_0x5aa798];return _0x5ee588;};'use strict';var Sequelize=require(_0xcdbd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xcdbd('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcdbd('0x1')]},'extension':{'type':Sequelize[_0xcdbd('0x1')]},'priority':{'type':Sequelize[_0xcdbd('0x1')]},'accountcode':{'type':Sequelize[_0xcdbd('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xcdbd('0x1')]},'saveName':{'type':Sequelize[_0xcdbd('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd285=['exports','STRING','sequelize'];(function(_0x593baf,_0x1d8428){var _0x4787dd=function(_0x1522c9){while(--_0x1522c9){_0x593baf['push'](_0x593baf['shift']());}};_0x4787dd(++_0x1d8428);}(_0xd285,0x18b));var _0x5d28=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xd285[_0x349148];return _0x2f2b0f;};'use strict';var Sequelize=require(_0x5d28('0x0'));module[_0x5d28('0x1')]={'uniqueid':{'type':Sequelize[_0x5d28('0x2')]},'callerid':{'type':Sequelize[_0x5d28('0x2')]},'calleridname':{'type':Sequelize[_0x5d28('0x2')]},'context':{'type':Sequelize[_0x5d28('0x2')]},'extension':{'type':Sequelize[_0x5d28('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5d28('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5d28('0x2')]},'saveName':{'type':Sequelize[_0x5d28('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x5d28('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8399b21..3bad4f7 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 _0xde56=['set','Content-Range','update','then','error','stack','name','send','SquareRecording','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','map','type','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','include','options','create','body','params','destroy','find','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit'];(function(_0x30e7f9,_0x14d4cf){var _0x57cbf5=function(_0x46a266){while(--_0x46a266){_0x30e7f9['push'](_0x30e7f9['shift']());}};_0x57cbf5(++_0x14d4cf);}(_0xde56,0x144));var _0x6de5=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xde56[_0x2ade6c];return _0x2cb372;};'use strict';var pdf=require(_0x6de5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6de5('0x1'));var zipdir=require(_0x6de5('0x2'));var jsonpatch=require(_0x6de5('0x3'));var rp=require(_0x6de5('0x4'));var moment=require(_0x6de5('0x5'));var BPromise=require(_0x6de5('0x6'));var Mustache=require(_0x6de5('0x7'));var util=require(_0x6de5('0x8'));var path=require(_0x6de5('0x9'));var sox=require(_0x6de5('0xa'));var csv=require('to-csv');var ejs=require(_0x6de5('0xb'));var fs=require('fs');var _=require(_0x6de5('0xc'));var squel=require(_0x6de5('0xd'));var crypto=require(_0x6de5('0xe'));var jsforce=require(_0x6de5('0xf'));var deskjs=require(_0x6de5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6de5('0x11'));var Redis=require(_0x6de5('0x12'));var authService=require(_0x6de5('0x13'));var qs=require(_0x6de5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6de5('0x15'))(_0x6de5('0x16'));var utils=require(_0x6de5('0x17'));var config=require(_0x6de5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a0699,_0x3009f0){_0x3009f0=_0x3009f0||0xcc;return function(_0x550496){if(_0x550496){return _0x1a0699[_0x6de5('0x19')](_0x3009f0);}return _0x1a0699[_0x6de5('0x1a')](_0x3009f0)[_0x6de5('0x1b')]();};}function respondWithResult(_0x3b30e8,_0x549d5f){_0x549d5f=_0x549d5f||0xc8;return function(_0x39a96f){if(_0x39a96f){return _0x3b30e8[_0x6de5('0x1a')](_0x549d5f)[_0x6de5('0x1c')](_0x39a96f);}};}function respondWithFilteredResult(_0x155b46,_0x526c66){return function(_0x2d370d){if(_0x2d370d){var _0x1a6cab=_0x2d370d[_0x6de5('0x1d')],_0x11fcdb=_0x526c66[_0x6de5('0x1e')],_0x2e61ca=_0x526c66[_0x6de5('0x1e')]+_0x526c66[_0x6de5('0x1f')],_0x5afd3c;if(_0x2e61ca>=_0x1a6cab){_0x2e61ca=_0x1a6cab;_0x5afd3c=0xc8;}else{_0x5afd3c=0xce;}_0x155b46['status'](_0x5afd3c);return _0x155b46[_0x6de5('0x20')](_0x6de5('0x21'),_0x11fcdb+'-'+_0x2e61ca+'/'+_0x1a6cab)[_0x6de5('0x1c')](_0x2d370d);}return null;};}function patchUpdates(_0x344bbb){return function(_0x50f80c){try{jsonpatch['apply'](_0x50f80c,_0x344bbb,!![]);}catch(_0x36c782){return BPromise['reject'](_0x36c782);}return _0x50f80c['save']();};}function saveUpdates(_0x2c5af0,_0x53fec2){return function(_0x37a64d){if(_0x37a64d){return _0x37a64d[_0x6de5('0x22')](_0x2c5af0)[_0x6de5('0x23')](function(_0x5d7351){return _0x5d7351;});}return null;};}function removeEntity(_0x4020bd,_0x4f5d39){return function(_0x5ebeb4){if(_0x5ebeb4){return _0x5ebeb4['destroy']()['then'](function(){_0x4020bd[_0x6de5('0x1a')](0xcc)[_0x6de5('0x1b')]();});}};}function handleEntityNotFound(_0x3b1096,_0x26c9d6){return function(_0x2272dc){if(!_0x2272dc){_0x3b1096[_0x6de5('0x19')](0x194);}return _0x2272dc;};}function handleError(_0x65617e,_0x564f5a){_0x564f5a=_0x564f5a||0x1f4;return function(_0x5b24b3){logger[_0x6de5('0x24')](_0x5b24b3[_0x6de5('0x25')]);if(_0x5b24b3['name']){delete _0x5b24b3[_0x6de5('0x26')];}_0x65617e[_0x6de5('0x1a')](_0x564f5a)[_0x6de5('0x27')](_0x5b24b3);};}exports['index']=function(_0x31ec12,_0x4a21a2){var _0xc0ed40={},_0x19bd91={},_0x17cf0d={'count':0x0,'rows':[]};var _0x399f8b=db[_0x6de5('0x28')][_0x6de5('0x29')];_0x19bd91[_0x6de5('0x2a')]=_['keys'](_0x399f8b);_0x19bd91[_0x6de5('0x2b')]=_[_0x6de5('0x2c')](_0x31ec12[_0x6de5('0x2b')]);_0x19bd91[_0x6de5('0x2d')]=_[_0x6de5('0x2e')](_0x19bd91['model'],_0x19bd91['query']);_0xc0ed40['attributes']=_[_0x6de5('0x2e')](_0x19bd91[_0x6de5('0x2a')],qs['fields'](_0x31ec12[_0x6de5('0x2b')][_0x6de5('0x2f')]));_0xc0ed40[_0x6de5('0x30')]=_0xc0ed40[_0x6de5('0x30')][_0x6de5('0x31')]?_0xc0ed40[_0x6de5('0x30')]:_0x19bd91[_0x6de5('0x2a')];if(!_0x31ec12['query'][_0x6de5('0x32')](_0x6de5('0x33'))){_0xc0ed40['limit']=qs[_0x6de5('0x1f')](_0x31ec12[_0x6de5('0x2b')][_0x6de5('0x1f')]);_0xc0ed40[_0x6de5('0x1e')]=qs[_0x6de5('0x1e')](_0x31ec12[_0x6de5('0x2b')][_0x6de5('0x1e')]);}_0xc0ed40[_0x6de5('0x34')]=qs[_0x6de5('0x35')](_0x31ec12[_0x6de5('0x2b')][_0x6de5('0x35')]);_0xc0ed40[_0x6de5('0x36')]=qs['filters'](_[_0x6de5('0x37')](_0x31ec12[_0x6de5('0x2b')],_0x19bd91[_0x6de5('0x2d')]));if(_0x31ec12[_0x6de5('0x2b')]['filter']){_0xc0ed40['where']=_['merge'](_0xc0ed40[_0x6de5('0x36')],{'$or':_[_0x6de5('0x38')](_0x399f8b,function(_0x2247b0){if(_0x2247b0[_0x6de5('0x39')]['key']!==_0x6de5('0x3a')){var _0x49037f={};_0x49037f[_0x2247b0['field']]={'$like':'%'+_0x31ec12['query'][_0x6de5('0x3b')]+'%'};return _0x49037f;}})});}_0xc0ed40=_[_0x6de5('0x3c')]({},_0xc0ed40,_0x31ec12['options']);var _0x5cb989={'where':_0xc0ed40[_0x6de5('0x36')]};return db[_0x6de5('0x28')][_0x6de5('0x1d')](_0x5cb989)[_0x6de5('0x23')](function(_0x5f0eb6){_0x17cf0d[_0x6de5('0x1d')]=_0x5f0eb6;if(_0x31ec12['query'][_0x6de5('0x3d')]){_0xc0ed40['include']=[{'all':!![]}];}return db[_0x6de5('0x28')][_0x6de5('0x3e')](_0xc0ed40);})['then'](function(_0x331a8f){_0x17cf0d[_0x6de5('0x3f')]=_0x331a8f;return _0x17cf0d;})['then'](respondWithFilteredResult(_0x4a21a2,_0xc0ed40))[_0x6de5('0x40')](handleError(_0x4a21a2,null));};exports[_0x6de5('0x41')]=function(_0x1840e4,_0x43c508){var _0x39421f={'raw':!![],'where':{'id':_0x1840e4['params']['id']}},_0x1783d0={};_0x1783d0[_0x6de5('0x2a')]=_['keys'](db['SquareRecording']['rawAttributes']);_0x1783d0[_0x6de5('0x2b')]=_['keys'](_0x1840e4[_0x6de5('0x2b')]);_0x1783d0['filters']=_[_0x6de5('0x2e')](_0x1783d0[_0x6de5('0x2a')],_0x1783d0[_0x6de5('0x2b')]);_0x39421f[_0x6de5('0x30')]=_[_0x6de5('0x2e')](_0x1783d0[_0x6de5('0x2a')],qs[_0x6de5('0x2f')](_0x1840e4['query'][_0x6de5('0x2f')]));_0x39421f[_0x6de5('0x30')]=_0x39421f[_0x6de5('0x30')][_0x6de5('0x31')]?_0x39421f[_0x6de5('0x30')]:_0x1783d0[_0x6de5('0x2a')];if(_0x1840e4['query'][_0x6de5('0x3d')]){_0x39421f[_0x6de5('0x42')]=[{'all':!![]}];}_0x39421f=_[_0x6de5('0x3c')]({},_0x39421f,_0x1840e4[_0x6de5('0x43')]);return db['SquareRecording']['find'](_0x39421f)[_0x6de5('0x23')](handleEntityNotFound(_0x43c508,null))[_0x6de5('0x23')](respondWithResult(_0x43c508,null))[_0x6de5('0x40')](handleError(_0x43c508,null));};exports['create']=function(_0x3443e1,_0x35d689){return db[_0x6de5('0x28')][_0x6de5('0x44')](_0x3443e1[_0x6de5('0x45')],{})[_0x6de5('0x23')](respondWithResult(_0x35d689,0xc9))[_0x6de5('0x40')](handleError(_0x35d689,null));};exports[_0x6de5('0x22')]=function(_0x1a3d80,_0x5b6495){if(_0x1a3d80[_0x6de5('0x45')]['id']){delete _0x1a3d80[_0x6de5('0x45')]['id'];}return db[_0x6de5('0x28')]['find']({'where':{'id':_0x1a3d80[_0x6de5('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b6495,null))['then'](saveUpdates(_0x1a3d80[_0x6de5('0x45')],null))['then'](respondWithResult(_0x5b6495,null))[_0x6de5('0x40')](handleError(_0x5b6495,null));};exports[_0x6de5('0x47')]=function(_0xb21944,_0xb55785){return db[_0x6de5('0x28')][_0x6de5('0x48')]({'where':{'id':_0xb21944[_0x6de5('0x46')]['id']}})[_0x6de5('0x23')](handleEntityNotFound(_0xb55785,null))[_0x6de5('0x23')](removeEntity(_0xb55785,null))[_0x6de5('0x40')](handleError(_0xb55785,null));};exports['download']=function(_0x5724d9,_0x5bb3e7,_0x40e739){var _0xf6d656=require(_0x6de5('0x49'));var _0x5b2572=![];var _0x4ef8a7={};if(_0x5724d9[_0x6de5('0x2b')][_0x6de5('0x39')]&&_0x5724d9[_0x6de5('0x2b')][_0x6de5('0x39')]===_0x6de5('0x4a')){_0x4ef8a7[_0x6de5('0x4a')]=_0x5724d9[_0x6de5('0x46')]['id'];}else{_0x4ef8a7['id']=_0x5724d9[_0x6de5('0x46')]['id'];}return db[_0x6de5('0x28')][_0x6de5('0x48')]({'where':_0x4ef8a7,'attributes':['id','savePath',_0x6de5('0x4b')],'raw':!![]})[_0x6de5('0x23')](handleEntityNotFound(_0x5bb3e7,null))[_0x6de5('0x23')](function(_0x1ace8c){if(_0x1ace8c){var _0x3b8890=_0x1ace8c[_0x6de5('0x4c')];var _0x333fb1=util[_0x6de5('0x4d')](_0x6de5('0x4e'),_0x3b8890);if(fs[_0x6de5('0x4f')](_0x333fb1)){_0x5b2572=!![];return _0xf6d656['decryptFile'](_0x333fb1,_0x3b8890,config[_0x6de5('0x50')]['recording'])['then'](function(){return _0x1ace8c;});}return _0x1ace8c;}})['then'](function(_0x27a8d7){if(_0x27a8d7){var _0x30197e=_0x27a8d7[_0x6de5('0x4c')];if(!fs[_0x6de5('0x4f')](_0x30197e)){throw new db[(_0x6de5('0x51'))][(_0x6de5('0x52'))](_0x6de5('0x53'));}if(_0x27a8d7['filename']){return _0x5bb3e7[_0x6de5('0x54')](_0x30197e,_0x27a8d7['filename']+path[_0x6de5('0x55')](_0x30197e),function(){if(_0x5b2572){fs[_0x6de5('0x56')](_0x30197e);}});}else{return _0x5bb3e7['download'](_0x30197e,function(_0x30907a){if(_0x5b2572){fs[_0x6de5('0x56')](_0x30197e);}});}}})[_0x6de5('0x40')](function(_0x12f3f9){if(_0x12f3f9[_0x6de5('0x57')]==='SquareRecording\x20not\x20found'){_0x5bb3e7['status'](0x194)['send'](_0x6de5('0x58'));}else{return handleError(_0x5bb3e7,null);}});}; \ No newline at end of file +var _0x37b4=['util','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','update','error','stack','name','send','index','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','then','SquareRecording','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','catch','destroy','download','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','recording','existsSync','Sequelize','extname','message','SquareRecording\x20not\x20found','Not\x20found','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x37b4,0xef));var _0x437b=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0x37b4[_0x53d0f2];return _0x4039fe;};'use strict';var pdf=require(_0x437b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x437b('0x1'));var zipdir=require(_0x437b('0x2'));var jsonpatch=require(_0x437b('0x3'));var rp=require('request-promise');var moment=require(_0x437b('0x4'));var BPromise=require(_0x437b('0x5'));var Mustache=require(_0x437b('0x6'));var util=require(_0x437b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x437b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x437b('0x9'));var squel=require('squel');var crypto=require(_0x437b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x437b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x437b('0xc'));var Redis=require(_0x437b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x437b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x437b('0xf'));var utils=require(_0x437b('0x10'));var config=require(_0x437b('0x11'));var db=require(_0x437b('0x12'))['db'];function respondWithStatusCode(_0x5eb5b4,_0x472b80){_0x472b80=_0x472b80||0xcc;return function(_0x36ffa7){if(_0x36ffa7){return _0x5eb5b4[_0x437b('0x13')](_0x472b80);}return _0x5eb5b4['status'](_0x472b80)[_0x437b('0x14')]();};}function respondWithResult(_0x40c6ee,_0x42bcf9){_0x42bcf9=_0x42bcf9||0xc8;return function(_0x4d72ec){if(_0x4d72ec){return _0x40c6ee[_0x437b('0x15')](_0x42bcf9)['json'](_0x4d72ec);}};}function respondWithFilteredResult(_0x368067,_0x2ddbe0){return function(_0x3cea79){if(_0x3cea79){var _0x5f328b=_0x3cea79[_0x437b('0x16')],_0x287886=_0x2ddbe0[_0x437b('0x17')],_0x159076=_0x2ddbe0[_0x437b('0x17')]+_0x2ddbe0['limit'],_0x466ace;if(_0x159076>=_0x5f328b){_0x159076=_0x5f328b;_0x466ace=0xc8;}else{_0x466ace=0xce;}_0x368067[_0x437b('0x15')](_0x466ace);return _0x368067['set'](_0x437b('0x18'),_0x287886+'-'+_0x159076+'/'+_0x5f328b)[_0x437b('0x19')](_0x3cea79);}return null;};}function patchUpdates(_0x1c91bc){return function(_0x3958df){try{jsonpatch['apply'](_0x3958df,_0x1c91bc,!![]);}catch(_0x504c9c){return BPromise['reject'](_0x504c9c);}return _0x3958df['save']();};}function saveUpdates(_0x1ea596,_0x14abab){return function(_0x4a5eac){if(_0x4a5eac){return _0x4a5eac[_0x437b('0x1a')](_0x1ea596)['then'](function(_0x434899){return _0x434899;});}return null;};}function removeEntity(_0x2f232c,_0x31418b){return function(_0x549a04){if(_0x549a04){return _0x549a04['destroy']()['then'](function(){_0x2f232c[_0x437b('0x15')](0xcc)[_0x437b('0x14')]();});}};}function handleEntityNotFound(_0x2f6d5f,_0x4440e6){return function(_0x8c5852){if(!_0x8c5852){_0x2f6d5f[_0x437b('0x13')](0x194);}return _0x8c5852;};}function handleError(_0x249a02,_0x18869f){_0x18869f=_0x18869f||0x1f4;return function(_0x25c242){logger[_0x437b('0x1b')](_0x25c242[_0x437b('0x1c')]);if(_0x25c242['name']){delete _0x25c242[_0x437b('0x1d')];}_0x249a02[_0x437b('0x15')](_0x18869f)[_0x437b('0x1e')](_0x25c242);};}exports[_0x437b('0x1f')]=function(_0x17092c,_0x586df9){var _0x14f755={},_0x2dbeb6={},_0x4a7d0b={'count':0x0,'rows':[]};var _0x70078f=db['SquareRecording']['rawAttributes'];_0x2dbeb6['model']=_[_0x437b('0x20')](_0x70078f);_0x2dbeb6['query']=_[_0x437b('0x20')](_0x17092c[_0x437b('0x21')]);_0x2dbeb6[_0x437b('0x22')]=_['intersection'](_0x2dbeb6['model'],_0x2dbeb6[_0x437b('0x21')]);_0x14f755[_0x437b('0x23')]=_[_0x437b('0x24')](_0x2dbeb6[_0x437b('0x25')],qs[_0x437b('0x26')](_0x17092c[_0x437b('0x21')][_0x437b('0x26')]));_0x14f755[_0x437b('0x23')]=_0x14f755[_0x437b('0x23')][_0x437b('0x27')]?_0x14f755[_0x437b('0x23')]:_0x2dbeb6['model'];if(!_0x17092c[_0x437b('0x21')][_0x437b('0x28')](_0x437b('0x29'))){_0x14f755['limit']=qs[_0x437b('0x2a')](_0x17092c[_0x437b('0x21')][_0x437b('0x2a')]);_0x14f755['offset']=qs[_0x437b('0x17')](_0x17092c['query'][_0x437b('0x17')]);}_0x14f755[_0x437b('0x2b')]=qs[_0x437b('0x2c')](_0x17092c[_0x437b('0x21')][_0x437b('0x2c')]);_0x14f755[_0x437b('0x2d')]=qs['filters'](_[_0x437b('0x2e')](_0x17092c[_0x437b('0x21')],_0x2dbeb6[_0x437b('0x22')]));if(_0x17092c[_0x437b('0x21')][_0x437b('0x2f')]){_0x14f755[_0x437b('0x2d')]=_[_0x437b('0x30')](_0x14f755[_0x437b('0x2d')],{'$or':_[_0x437b('0x31')](_0x70078f,function(_0x1690f7){if(_0x1690f7[_0x437b('0x32')]['key']!==_0x437b('0x33')){var _0x4e48f2={};_0x4e48f2[_0x1690f7[_0x437b('0x34')]]={'$like':'%'+_0x17092c['query']['filter']+'%'};return _0x4e48f2;}})});}_0x14f755=_[_0x437b('0x30')]({},_0x14f755,_0x17092c[_0x437b('0x35')]);var _0x3c1615={'where':_0x14f755[_0x437b('0x2d')]};return db['SquareRecording'][_0x437b('0x16')](_0x3c1615)[_0x437b('0x36')](function(_0xf81e6a){_0x4a7d0b[_0x437b('0x16')]=_0xf81e6a;if(_0x17092c['query']['includeAll']){_0x14f755['include']=[{'all':!![]}];}return db[_0x437b('0x37')][_0x437b('0x38')](_0x14f755);})[_0x437b('0x36')](function(_0x282d73){_0x4a7d0b[_0x437b('0x39')]=_0x282d73;return _0x4a7d0b;})[_0x437b('0x36')](respondWithFilteredResult(_0x586df9,_0x14f755))['catch'](handleError(_0x586df9,null));};exports[_0x437b('0x3a')]=function(_0x14fe18,_0x339de6){var _0x588efa={'raw':!![],'where':{'id':_0x14fe18[_0x437b('0x3b')]['id']}},_0x34aee7={};_0x34aee7['model']=_['keys'](db['SquareRecording'][_0x437b('0x3c')]);_0x34aee7[_0x437b('0x21')]=_['keys'](_0x14fe18['query']);_0x34aee7[_0x437b('0x22')]=_['intersection'](_0x34aee7[_0x437b('0x25')],_0x34aee7['query']);_0x588efa['attributes']=_[_0x437b('0x24')](_0x34aee7[_0x437b('0x25')],qs['fields'](_0x14fe18[_0x437b('0x21')]['fields']));_0x588efa[_0x437b('0x23')]=_0x588efa[_0x437b('0x23')]['length']?_0x588efa[_0x437b('0x23')]:_0x34aee7[_0x437b('0x25')];if(_0x14fe18['query'][_0x437b('0x3d')]){_0x588efa[_0x437b('0x3e')]=[{'all':!![]}];}_0x588efa=_[_0x437b('0x30')]({},_0x588efa,_0x14fe18[_0x437b('0x35')]);return db['SquareRecording'][_0x437b('0x3f')](_0x588efa)[_0x437b('0x36')](handleEntityNotFound(_0x339de6,null))[_0x437b('0x36')](respondWithResult(_0x339de6,null))['catch'](handleError(_0x339de6,null));};exports['create']=function(_0x457997,_0x52f6e2){return db['SquareRecording'][_0x437b('0x40')](_0x457997[_0x437b('0x41')],{})[_0x437b('0x36')](respondWithResult(_0x52f6e2,0xc9))[_0x437b('0x42')](handleError(_0x52f6e2,null));};exports[_0x437b('0x1a')]=function(_0x49b019,_0x1b5c71){if(_0x49b019[_0x437b('0x41')]['id']){delete _0x49b019[_0x437b('0x41')]['id'];}return db[_0x437b('0x37')][_0x437b('0x3f')]({'where':{'id':_0x49b019[_0x437b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1b5c71,null))['then'](saveUpdates(_0x49b019[_0x437b('0x41')],null))['then'](respondWithResult(_0x1b5c71,null))[_0x437b('0x42')](handleError(_0x1b5c71,null));};exports[_0x437b('0x43')]=function(_0x4f8f76,_0x1aa7e1){return db[_0x437b('0x37')]['find']({'where':{'id':_0x4f8f76[_0x437b('0x3b')]['id']}})[_0x437b('0x36')](handleEntityNotFound(_0x1aa7e1,null))[_0x437b('0x36')](removeEntity(_0x1aa7e1,null))[_0x437b('0x42')](handleError(_0x1aa7e1,null));};exports[_0x437b('0x44')]=function(_0x484827,_0x22abaa,_0xd832ec){var _0x5c0cbe=require(_0x437b('0x45'));var _0x2b5d80=![];var _0x4a6153={};if(_0x484827['query'][_0x437b('0x32')]&&_0x484827[_0x437b('0x21')][_0x437b('0x32')]===_0x437b('0x46')){_0x4a6153['uniqueid']=_0x484827[_0x437b('0x3b')]['id'];}else{_0x4a6153['id']=_0x484827[_0x437b('0x3b')]['id'];}return db[_0x437b('0x37')][_0x437b('0x3f')]({'where':_0x4a6153,'attributes':['id',_0x437b('0x47'),_0x437b('0x48')],'raw':!![]})[_0x437b('0x36')](handleEntityNotFound(_0x22abaa,null))['then'](function(_0x361bde){if(_0x361bde){var _0x1aea4a=_0x361bde['savePath'];var _0x3b93bc=util[_0x437b('0x49')]('%s.cypher',_0x1aea4a);if(fs['existsSync'](_0x3b93bc)){_0x2b5d80=!![];return _0x5c0cbe[_0x437b('0x4a')](_0x3b93bc,_0x1aea4a,config['secrets'][_0x437b('0x4b')])['then'](function(){return _0x361bde;});}return _0x361bde;}})['then'](function(_0x49652e){if(_0x49652e){var _0x10b7d4=_0x49652e[_0x437b('0x47')];if(!fs[_0x437b('0x4c')](_0x10b7d4)){throw new db[(_0x437b('0x4d'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x49652e[_0x437b('0x48')]){return _0x22abaa['download'](_0x10b7d4,_0x49652e[_0x437b('0x48')]+path[_0x437b('0x4e')](_0x10b7d4),function(){if(_0x2b5d80){fs['unlink'](_0x10b7d4);}});}else{return _0x22abaa['download'](_0x10b7d4,function(_0x138b41){if(_0x2b5d80){fs['unlink'](_0x10b7d4);}});}}})[_0x437b('0x42')](function(_0x3b065e){if(_0x3b065e[_0x437b('0x4f')]===_0x437b('0x50')){_0x22abaa[_0x437b('0x15')](0x194)[_0x437b('0x1e')](_0x437b('0x51'));}else{return handleError(_0x22abaa,null);}});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3a423eb..3bb5725 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 _0x3159=['exports','define','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x5b58ff,_0x5910f){var _0x3d869e=function(_0x4c50fc){while(--_0x4c50fc){_0x5b58ff['push'](_0x5b58ff['shift']());}};_0x3d869e(++_0x5910f);}(_0x3159,0xc6));var _0x9315=function(_0x48d218,_0x38ae7b){_0x48d218=_0x48d218-0x0;var _0x5d86c7=_0x3159[_0x48d218];return _0x5d86c7;};'use strict';var _=require(_0x9315('0x0'));var util=require(_0x9315('0x1'));var logger=require(_0x9315('0x2'))('api');var moment=require(_0x9315('0x3'));var BPromise=require(_0x9315('0x4'));var rp=require(_0x9315('0x5'));var fs=require('fs');var path=require(_0x9315('0x6'));var rimraf=require(_0x9315('0x7'));var config=require(_0x9315('0x8'));var attributes=require(_0x9315('0x9'));module[_0x9315('0xa')]=function(_0x403422,_0x41d3c9){return _0x403422[_0x9315('0xb')]('SquareRecording',attributes,{'tableName':_0x9315('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b1b=['path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10e4c1,_0x273149){var _0x2c074b=function(_0x7fff7d){while(--_0x7fff7d){_0x10e4c1['push'](_0x10e4c1['shift']());}};_0x2c074b(++_0x273149);}(_0x1b1b,0x180));var _0xb1b1=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0x1b1b[_0x289874];return _0x2f8bbb;};'use strict';var _=require(_0xb1b1('0x0'));var util=require(_0xb1b1('0x1'));var logger=require(_0xb1b1('0x2'))(_0xb1b1('0x3'));var moment=require(_0xb1b1('0x4'));var BPromise=require(_0xb1b1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1b1('0x6'));var rimraf=require('rimraf');var config=require(_0xb1b1('0x7'));var attributes=require(_0xb1b1('0x8'));module[_0xb1b1('0x9')]=function(_0x4064d9,_0xe5e50b){return _0x4064d9[_0xb1b1('0xa')](_0xb1b1('0xb'),attributes,{'tableName':_0xb1b1('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 b6de8ed..b5989b0 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 _0x79e4=['lodash','bluebird','ioredis','../../config/logger','../../config/environment','request','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','create','options','then','debug','CreateSquareRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79e4,0x1cc));var _0x479e=function(_0x1cd58f,_0xe366fa){_0x1cd58f=_0x1cd58f-0x0;var _0x173af6=_0x79e4[_0x1cd58f];return _0x173af6;};'use strict';var _=require(_0x479e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x479e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x479e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x479e('0x3'))('rpc');var config=require(_0x479e('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c92b9,_0x444138,_0xa7da97){return new BPromise(function(_0x4f66a5,_0x12525d){return client[_0x479e('0x5')](_0x3c92b9,_0xa7da97)['then'](function(_0x58e4f5){logger['info'](_0x479e('0x6'),_0x444138,_0x479e('0x7'));logger['debug'](_0x479e('0x8'),_0x444138,'request\x20sent',JSON[_0x479e('0x9')](_0x58e4f5));if(_0x58e4f5[_0x479e('0xa')]){if(_0x58e4f5['error'][_0x479e('0xb')]===0x1f4){logger[_0x479e('0xa')](_0x479e('0x6'),_0x444138,_0x58e4f5[_0x479e('0xa')][_0x479e('0xc')]);return _0x12525d(_0x58e4f5[_0x479e('0xa')][_0x479e('0xc')]);}logger[_0x479e('0xa')](_0x479e('0x6'),_0x444138,_0x58e4f5[_0x479e('0xa')][_0x479e('0xc')]);return _0x4f66a5(_0x58e4f5['error']['message']);}else{logger[_0x479e('0xd')](_0x479e('0x6'),_0x444138,_0x479e('0x7'));_0x4f66a5(_0x58e4f5[_0x479e('0xe')][_0x479e('0xc')]);}})['catch'](function(_0x74a9d7){logger[_0x479e('0xa')]('SquareRecording,\x20%s,\x20%s',_0x444138,_0x74a9d7);_0x12525d(_0x74a9d7);});});}exports['CreateSquareRecording']=function(_0x26688a){var _0x3968d6=this;return new Promise(function(_0x3af31f,_0x4a87d3){return db['SquareRecording'][_0x479e('0xf')](_0x26688a['body'],{'raw':_0x26688a[_0x479e('0x10')]?_0x26688a['options']['raw']===undefined?!![]:![]:!![]})[_0x479e('0x11')](function(_0xeea4f9){logger[_0x479e('0xd')]('CreateSquareRecording',_0x26688a);logger[_0x479e('0x12')]('CreateSquareRecording',_0x26688a,JSON[_0x479e('0x9')](_0xeea4f9));_0x3af31f(_0xeea4f9);})['catch'](function(_0x33a377){logger[_0x479e('0xa')](_0x479e('0x13'),_0x33a377[_0x479e('0xc')],_0x26688a);_0x4a87d3(_0x3968d6[_0x479e('0xa')](0x1f4,_0x33a377['message']));});});}; \ No newline at end of file +var _0x0d34=['jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x2cdb23,_0x51e932){var _0x2bc82a=function(_0x3a3439){while(--_0x3a3439){_0x2cdb23['push'](_0x2cdb23['shift']());}};_0x2bc82a(++_0x51e932);}(_0x0d34,0x13d));var _0x40d3=function(_0x34c775,_0x5e3806){_0x34c775=_0x34c775-0x0;var _0x31b59c=_0x0d34[_0x34c775];return _0x31b59c;};'use strict';var _=require(_0x40d3('0x0'));var util=require(_0x40d3('0x1'));var moment=require(_0x40d3('0x2'));var BPromise=require(_0x40d3('0x3'));var rs=require(_0x40d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x40d3('0x6'));var config=require('../../config/environment');var jayson=require(_0x40d3('0x7'));var client=jayson[_0x40d3('0x8')][_0x40d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x234bdd,_0x313afd,_0x50eee8){return new BPromise(function(_0x480085,_0x397ac7){return client[_0x40d3('0xa')](_0x234bdd,_0x50eee8)[_0x40d3('0xb')](function(_0x3a9965){logger[_0x40d3('0xc')](_0x40d3('0xd'),_0x313afd,_0x40d3('0xe'));logger[_0x40d3('0xf')](_0x40d3('0x10'),_0x313afd,_0x40d3('0xe'),JSON[_0x40d3('0x11')](_0x3a9965));if(_0x3a9965[_0x40d3('0x12')]){if(_0x3a9965[_0x40d3('0x12')][_0x40d3('0x13')]===0x1f4){logger[_0x40d3('0x12')](_0x40d3('0xd'),_0x313afd,_0x3a9965[_0x40d3('0x12')]['message']);return _0x397ac7(_0x3a9965[_0x40d3('0x12')][_0x40d3('0x14')]);}logger['error'](_0x40d3('0xd'),_0x313afd,_0x3a9965['error'][_0x40d3('0x14')]);return _0x480085(_0x3a9965[_0x40d3('0x12')]['message']);}else{logger[_0x40d3('0xc')](_0x40d3('0xd'),_0x313afd,_0x40d3('0xe'));_0x480085(_0x3a9965['result']['message']);}})[_0x40d3('0x15')](function(_0x12972d){logger[_0x40d3('0x12')]('SquareRecording,\x20%s,\x20%s',_0x313afd,_0x12972d);_0x397ac7(_0x12972d);});});}exports[_0x40d3('0x16')]=function(_0x49ec0f){var _0x3ace41=this;return new Promise(function(_0x12cc65,_0x4d5f99){return db[_0x40d3('0x17')][_0x40d3('0x18')](_0x49ec0f['body'],{'raw':_0x49ec0f[_0x40d3('0x19')]?_0x49ec0f[_0x40d3('0x19')][_0x40d3('0x1a')]===undefined?!![]:![]:!![]})[_0x40d3('0xb')](function(_0x2c827d){logger['info'](_0x40d3('0x16'),_0x49ec0f);logger['debug'](_0x40d3('0x16'),_0x49ec0f,JSON['stringify'](_0x2c827d));_0x12cc65(_0x2c827d);})[_0x40d3('0x15')](function(_0x21d4bf){logger[_0x40d3('0x12')](_0x40d3('0x16'),_0x21d4bf[_0x40d3('0x14')],_0x49ec0f);_0x4d5f99(_0x3ace41[_0x40d3('0x12')](0x1f4,_0x21d4bf[_0x40d3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f6f09cb..67b0a17 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 _0xb5da=['isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller'];(function(_0x34f942,_0x491219){var _0x436530=function(_0x1beb96){while(--_0x1beb96){_0x34f942['push'](_0x34f942['shift']());}};_0x436530(++_0x491219);}(_0xb5da,0xbe));var _0xab5d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb5da[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xab5d('0x0'));var util=require(_0xab5d('0x1'));var path=require(_0xab5d('0x2'));var timeout=require('connect-timeout');var express=require(_0xab5d('0x3'));var router=express['Router']();var auth=require(_0xab5d('0x4'));var interaction=require(_0xab5d('0x5'));var config=require(_0xab5d('0x6'));var controller=require(_0xab5d('0x7'));router['get']('/',auth[_0xab5d('0x8')](),controller[_0xab5d('0x9')]);router['get'](_0xab5d('0xa'),auth['isAuthenticated'](),controller[_0xab5d('0xb')]);router[_0xab5d('0xc')](_0xab5d('0xd'),auth[_0xab5d('0x8')](),controller[_0xab5d('0xe')]);router[_0xab5d('0xf')]('/',auth[_0xab5d('0x8')](),controller[_0xab5d('0x10')]);router[_0xab5d('0x11')](_0xab5d('0xd'),auth['isAuthenticated'](),controller[_0xab5d('0x12')]);router[_0xab5d('0x13')]('/:id',auth[_0xab5d('0x8')](),controller[_0xab5d('0x14')]);module[_0xab5d('0x15')]=router; \ No newline at end of file +var _0x5498=['describe','/:id','show','post','create','update','delete','exports','multer','util','express','Router','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','index','/describe'];(function(_0xa9438f,_0x1fa056){var _0x3fb0e5=function(_0x152e40){while(--_0x152e40){_0xa9438f['push'](_0xa9438f['shift']());}};_0x3fb0e5(++_0x1fa056);}(_0x5498,0x98));var _0x8549=function(_0x2470fe,_0x412eec){_0x2470fe=_0x2470fe-0x0;var _0x3c933b=_0x5498[_0x2470fe];return _0x3c933b;};'use strict';var multer=require(_0x8549('0x0'));var util=require(_0x8549('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8549('0x2'));var router=express[_0x8549('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8549('0x4'));var config=require('../../config/environment');var controller=require(_0x8549('0x5'));router[_0x8549('0x6')]('/',auth[_0x8549('0x7')](),controller[_0x8549('0x8')]);router['get'](_0x8549('0x9'),auth[_0x8549('0x7')](),controller[_0x8549('0xa')]);router['get'](_0x8549('0xb'),auth[_0x8549('0x7')](),controller[_0x8549('0xc')]);router[_0x8549('0xd')]('/',auth[_0x8549('0x7')](),controller[_0x8549('0xe')]);router['put'](_0x8549('0xb'),auth[_0x8549('0x7')](),controller[_0x8549('0xf')]);router[_0x8549('0x10')](_0x8549('0xb'),auth[_0x8549('0x7')](),controller['destroy']);module[_0x8549('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d9489e5..a1f2f65 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 _0x5712=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x6de23e,_0x3ba0e7){var _0x14203f=function(_0x55a814){while(--_0x55a814){_0x6de23e['push'](_0x6de23e['shift']());}};_0x14203f(++_0x3ba0e7);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x2571('0x0'));module[_0x2571('0x1')]={'network':{'type':Sequelize[_0x2571('0x2')]},'network_script':{'type':Sequelize[_0x2571('0x2')]},'request':{'type':Sequelize[_0x2571('0x2')]},'channel':{'type':Sequelize[_0x2571('0x2')]},'language':{'type':Sequelize[_0x2571('0x2')]},'type':{'type':Sequelize[_0x2571('0x2')]},'uniqueid':{'type':Sequelize[_0x2571('0x2')]},'version':{'type':Sequelize[_0x2571('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x2571('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x2571('0x2')]},'callingtns':{'type':Sequelize[_0x2571('0x2')]},'dnid':{'type':Sequelize[_0x2571('0x2')]},'rdnis':{'type':Sequelize[_0x2571('0x2')]},'context':{'type':Sequelize[_0x2571('0x2')]},'extension':{'type':Sequelize[_0x2571('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x2571('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x2571('0x2')]},'project_name':{'type':Sequelize[_0x2571('0x2')]},'joinAt':{'type':Sequelize[_0x2571('0x3')]},'leaveAt':{'type':Sequelize[_0x2571('0x3')]},'bot':{'type':Sequelize[_0x2571('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa739=['DATE','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa739,0x1e1));var _0x9a73=function(_0x5787c2,_0x4b561d){_0x5787c2=_0x5787c2-0x0;var _0x4d7724=_0xa739[_0x5787c2];return _0x4d7724;};'use strict';var Sequelize=require('sequelize');module[_0x9a73('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x9a73('0x1')]},'request':{'type':Sequelize[_0x9a73('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9a73('0x1')]},'type':{'type':Sequelize[_0x9a73('0x1')]},'uniqueid':{'type':Sequelize[_0x9a73('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9a73('0x1')]},'calleridname':{'type':Sequelize[_0x9a73('0x1')]},'callingpres':{'type':Sequelize[_0x9a73('0x1')]},'callingani2':{'type':Sequelize[_0x9a73('0x1')]},'callington':{'type':Sequelize[_0x9a73('0x1')]},'callingtns':{'type':Sequelize[_0x9a73('0x1')]},'dnid':{'type':Sequelize[_0x9a73('0x1')]},'rdnis':{'type':Sequelize[_0x9a73('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9a73('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x9a73('0x1')]},'accountcode':{'type':Sequelize[_0x9a73('0x1')]},'threadid':{'type':Sequelize[_0x9a73('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9a73('0x2')]},'leaveAt':{'type':Sequelize[_0x9a73('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 7bd8434..418ab31 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 _0x914f=['key','VIRTUAL','field','filter','options','SquareReport','count','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge'];(function(_0x2b338b,_0x4a06ba){var _0x256f66=function(_0x13c9c4){while(--_0x13c9c4){_0x2b338b['push'](_0x2b338b['shift']());}};_0x256f66(++_0x4a06ba);}(_0x914f,0x11e));var _0xf914=function(_0x1a80da,_0x1b532b){_0x1a80da=_0x1a80da-0x0;var _0x1c1df0=_0x914f[_0x1a80da];return _0x1c1df0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf914('0x0'));var rp=require(_0xf914('0x1'));var moment=require(_0xf914('0x2'));var BPromise=require(_0xf914('0x3'));var Mustache=require('mustache');var util=require(_0xf914('0x4'));var path=require(_0xf914('0x5'));var sox=require('sox');var csv=require(_0xf914('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf914('0x7'));var squel=require(_0xf914('0x8'));var crypto=require(_0xf914('0x9'));var jsforce=require(_0xf914('0xa'));var deskjs=require(_0xf914('0xb'));var toCsv=require(_0xf914('0x6'));var querystring=require('querystring');var Papa=require(_0xf914('0xc'));var Redis=require(_0xf914('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf914('0xe'));var hardwareService=require(_0xf914('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf914('0x10'));var db=require(_0xf914('0x11'))['db'];function respondWithStatusCode(_0x3e9fc7,_0x1d36d3){_0x1d36d3=_0x1d36d3||0xcc;return function(_0x43f97e){if(_0x43f97e){return _0x3e9fc7[_0xf914('0x12')](_0x1d36d3);}return _0x3e9fc7[_0xf914('0x13')](_0x1d36d3)[_0xf914('0x14')]();};}function respondWithResult(_0x3da875,_0x2e1475){_0x2e1475=_0x2e1475||0xc8;return function(_0x1c4278){if(_0x1c4278){return _0x3da875[_0xf914('0x13')](_0x2e1475)[_0xf914('0x15')](_0x1c4278);}};}function respondWithFilteredResult(_0x22a284,_0x484009){return function(_0x585424){if(_0x585424){var _0x43e331=_0x585424['count'],_0x1759e5=_0x484009['offset'],_0x47c1ac=_0x484009['offset']+_0x484009[_0xf914('0x16')],_0x4b1980;if(_0x47c1ac>=_0x43e331){_0x47c1ac=_0x43e331;_0x4b1980=0xc8;}else{_0x4b1980=0xce;}_0x22a284[_0xf914('0x13')](_0x4b1980);return _0x22a284[_0xf914('0x17')](_0xf914('0x18'),_0x1759e5+'-'+_0x47c1ac+'/'+_0x43e331)[_0xf914('0x15')](_0x585424);}return null;};}function patchUpdates(_0xb4077a){return function(_0x41154b){try{jsonpatch['apply'](_0x41154b,_0xb4077a,!![]);}catch(_0x4fb7af){return BPromise[_0xf914('0x19')](_0x4fb7af);}return _0x41154b['save']();};}function saveUpdates(_0x504439,_0x5e9c5c){return function(_0x11546e){if(_0x11546e){return _0x11546e[_0xf914('0x1a')](_0x504439)[_0xf914('0x1b')](function(_0x19a16a){return _0x19a16a;});}return null;};}function removeEntity(_0x153736,_0x269d5a){return function(_0x36a0bb){if(_0x36a0bb){return _0x36a0bb['destroy']()[_0xf914('0x1b')](function(){_0x153736[_0xf914('0x13')](0xcc)[_0xf914('0x14')]();});}};}function handleEntityNotFound(_0xe24d89,_0x183463){return function(_0x1615e8){if(!_0x1615e8){_0xe24d89[_0xf914('0x12')](0x194);}return _0x1615e8;};}function handleError(_0x59984e,_0x1356d3){_0x1356d3=_0x1356d3||0x1f4;return function(_0x52f1b3){logger[_0xf914('0x1c')](_0x52f1b3[_0xf914('0x1d')]);if(_0x52f1b3[_0xf914('0x1e')]){delete _0x52f1b3['name'];}_0x59984e[_0xf914('0x13')](_0x1356d3)[_0xf914('0x1f')](_0x52f1b3);};}exports[_0xf914('0x20')]=function(_0x58307a,_0x51ef95){var _0x451deb={},_0x29b0f0={},_0x4cff26={'count':0x0,'rows':[]};var _0x425b6e=db['SquareReport']['rawAttributes'];_0x29b0f0['model']=_[_0xf914('0x21')](_0x425b6e);_0x29b0f0[_0xf914('0x22')]=_[_0xf914('0x21')](_0x58307a[_0xf914('0x22')]);_0x29b0f0[_0xf914('0x23')]=_[_0xf914('0x24')](_0x29b0f0[_0xf914('0x25')],_0x29b0f0[_0xf914('0x22')]);_0x451deb[_0xf914('0x26')]=_[_0xf914('0x24')](_0x29b0f0[_0xf914('0x25')],qs[_0xf914('0x27')](_0x58307a[_0xf914('0x22')][_0xf914('0x27')]));_0x451deb[_0xf914('0x26')]=_0x451deb['attributes'][_0xf914('0x28')]?_0x451deb[_0xf914('0x26')]:_0x29b0f0[_0xf914('0x25')];if(!_0x58307a[_0xf914('0x22')][_0xf914('0x29')](_0xf914('0x2a'))){_0x451deb['limit']=qs[_0xf914('0x16')](_0x58307a[_0xf914('0x22')][_0xf914('0x16')]);_0x451deb[_0xf914('0x2b')]=qs[_0xf914('0x2b')](_0x58307a[_0xf914('0x22')][_0xf914('0x2b')]);}_0x451deb[_0xf914('0x2c')]=qs[_0xf914('0x2d')](_0x58307a[_0xf914('0x22')][_0xf914('0x2d')]);_0x451deb[_0xf914('0x2e')]=qs['filters'](_[_0xf914('0x2f')](_0x58307a['query'],_0x29b0f0['filters']));if(_0x58307a[_0xf914('0x22')]['filter']){_0x451deb['where']=_[_0xf914('0x30')](_0x451deb[_0xf914('0x2e')],{'$or':_['map'](_0x425b6e,function(_0x46185a){if(_0x46185a['type'][_0xf914('0x31')]!==_0xf914('0x32')){var _0x59f5a6={};_0x59f5a6[_0x46185a[_0xf914('0x33')]]={'$like':'%'+_0x58307a[_0xf914('0x22')][_0xf914('0x34')]+'%'};return _0x59f5a6;}})});}_0x451deb=_[_0xf914('0x30')]({},_0x451deb,_0x58307a[_0xf914('0x35')]);var _0x1cadbd={'where':_0x451deb[_0xf914('0x2e')]};return db[_0xf914('0x36')][_0xf914('0x37')](_0x1cadbd)[_0xf914('0x1b')](function(_0x357c97){_0x4cff26['count']=_0x357c97;if(_0x58307a[_0xf914('0x22')]['includeAll']){_0x451deb[_0xf914('0x38')]=[{'all':!![]}];}return db[_0xf914('0x36')]['findAll'](_0x451deb);})[_0xf914('0x1b')](function(_0x63ce42){_0x4cff26[_0xf914('0x39')]=_0x63ce42;return _0x4cff26;})[_0xf914('0x1b')](respondWithFilteredResult(_0x51ef95,_0x451deb))[_0xf914('0x3a')](handleError(_0x51ef95,null));};exports[_0xf914('0x3b')]=function(_0x1a84c1,_0x44ff04){var _0x249b0d={'raw':!![],'where':{'id':_0x1a84c1[_0xf914('0x3c')]['id']}},_0x43ef89={};_0x43ef89[_0xf914('0x25')]=_[_0xf914('0x21')](db[_0xf914('0x36')][_0xf914('0x3d')]);_0x43ef89[_0xf914('0x22')]=_[_0xf914('0x21')](_0x1a84c1[_0xf914('0x22')]);_0x43ef89[_0xf914('0x23')]=_['intersection'](_0x43ef89[_0xf914('0x25')],_0x43ef89['query']);_0x249b0d[_0xf914('0x26')]=_[_0xf914('0x24')](_0x43ef89[_0xf914('0x25')],qs[_0xf914('0x27')](_0x1a84c1[_0xf914('0x22')][_0xf914('0x27')]));_0x249b0d[_0xf914('0x26')]=_0x249b0d['attributes']['length']?_0x249b0d[_0xf914('0x26')]:_0x43ef89[_0xf914('0x25')];if(_0x1a84c1['query'][_0xf914('0x3e')]){_0x249b0d[_0xf914('0x38')]=[{'all':!![]}];}_0x249b0d=_['merge']({},_0x249b0d,_0x1a84c1[_0xf914('0x35')]);return db[_0xf914('0x36')]['find'](_0x249b0d)[_0xf914('0x1b')](handleEntityNotFound(_0x44ff04,null))[_0xf914('0x1b')](respondWithResult(_0x44ff04,null))[_0xf914('0x3a')](handleError(_0x44ff04,null));};exports[_0xf914('0x3f')]=function(_0x448f73,_0x143e39){return db[_0xf914('0x36')][_0xf914('0x3f')](_0x448f73[_0xf914('0x40')],{})[_0xf914('0x1b')](respondWithResult(_0x143e39,0xc9))[_0xf914('0x3a')](handleError(_0x143e39,null));};exports['update']=function(_0x404d09,_0x24c9e1){if(_0x404d09[_0xf914('0x40')]['id']){delete _0x404d09[_0xf914('0x40')]['id'];}return db[_0xf914('0x36')][_0xf914('0x41')]({'where':{'id':_0x404d09[_0xf914('0x3c')]['id']}})['then'](handleEntityNotFound(_0x24c9e1,null))[_0xf914('0x1b')](saveUpdates(_0x404d09[_0xf914('0x40')],null))[_0xf914('0x1b')](respondWithResult(_0x24c9e1,null))[_0xf914('0x3a')](handleError(_0x24c9e1,null));};exports['destroy']=function(_0x5cf93c,_0x5633c1){return db['SquareReport']['find']({'where':{'id':_0x5cf93c[_0xf914('0x3c')]['id']}})[_0xf914('0x1b')](handleEntityNotFound(_0x5633c1,null))[_0xf914('0x1b')](removeEntity(_0x5633c1,null))['catch'](handleError(_0x5633c1,null));};exports[_0xf914('0x42')]=function(_0x4296a0,_0x25e34d){return db[_0xf914('0x36')][_0xf914('0x42')]()[_0xf914('0x1b')](respondWithResult(_0x25e34d,null))['catch'](handleError(_0x25e34d,null));}; \ No newline at end of file +var _0x0055=['merge','map','key','VIRTUAL','field','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','SquareReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','limit','order','sort','where'];(function(_0x4093c0,_0x1d3754){var _0x3668c9=function(_0x3f6ce5){while(--_0x3f6ce5){_0x4093c0['push'](_0x4093c0['shift']());}};_0x3668c9(++_0x1d3754);}(_0x0055,0x16b));var _0x5005=function(_0x347372,_0x40590c){_0x347372=_0x347372-0x0;var _0x2f365c=_0x0055[_0x347372];return _0x2f365c;};'use strict';var pdf=require(_0x5005('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5005('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5005('0x2'));var moment=require(_0x5005('0x3'));var BPromise=require(_0x5005('0x4'));var Mustache=require('mustache');var util=require(_0x5005('0x5'));var path=require(_0x5005('0x6'));var sox=require(_0x5005('0x7'));var csv=require('to-csv');var ejs=require(_0x5005('0x8'));var fs=require('fs');var _=require(_0x5005('0x9'));var squel=require(_0x5005('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5005('0xb'));var toCsv=require(_0x5005('0xc'));var querystring=require(_0x5005('0xd'));var Papa=require('papaparse');var Redis=require(_0x5005('0xe'));var authService=require(_0x5005('0xf'));var qs=require(_0x5005('0x10'));var hardwareService=require(_0x5005('0x11'));var logger=require('../../config/logger')(_0x5005('0x12'));var utils=require('../../config/utils');var config=require(_0x5005('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db009,_0x5a9b9f){_0x5a9b9f=_0x5a9b9f||0xcc;return function(_0x36c444){if(_0x36c444){return _0x4db009['sendStatus'](_0x5a9b9f);}return _0x4db009[_0x5005('0x14')](_0x5a9b9f)[_0x5005('0x15')]();};}function respondWithResult(_0x5177d8,_0x422dfc){_0x422dfc=_0x422dfc||0xc8;return function(_0x412abf){if(_0x412abf){return _0x5177d8['status'](_0x422dfc)['json'](_0x412abf);}};}function respondWithFilteredResult(_0x1d9268,_0x98c5fb){return function(_0x3848f8){if(_0x3848f8){var _0x2cb683=_0x3848f8[_0x5005('0x16')],_0x341db6=_0x98c5fb[_0x5005('0x17')],_0x331436=_0x98c5fb[_0x5005('0x17')]+_0x98c5fb['limit'],_0x5f4651;if(_0x331436>=_0x2cb683){_0x331436=_0x2cb683;_0x5f4651=0xc8;}else{_0x5f4651=0xce;}_0x1d9268[_0x5005('0x14')](_0x5f4651);return _0x1d9268[_0x5005('0x18')](_0x5005('0x19'),_0x341db6+'-'+_0x331436+'/'+_0x2cb683)[_0x5005('0x1a')](_0x3848f8);}return null;};}function patchUpdates(_0x5891d0){return function(_0x59ee79){try{jsonpatch[_0x5005('0x1b')](_0x59ee79,_0x5891d0,!![]);}catch(_0x209d97){return BPromise[_0x5005('0x1c')](_0x209d97);}return _0x59ee79[_0x5005('0x1d')]();};}function saveUpdates(_0x4272c9,_0x2303ce){return function(_0x4de397){if(_0x4de397){return _0x4de397[_0x5005('0x1e')](_0x4272c9)[_0x5005('0x1f')](function(_0x375bda){return _0x375bda;});}return null;};}function removeEntity(_0x264e6f,_0x144bc9){return function(_0x3d2dc2){if(_0x3d2dc2){return _0x3d2dc2['destroy']()[_0x5005('0x1f')](function(){_0x264e6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af54b,_0x4ad201){return function(_0x3d7fde){if(!_0x3d7fde){_0x3af54b[_0x5005('0x20')](0x194);}return _0x3d7fde;};}function handleError(_0x3fb282,_0x241018){_0x241018=_0x241018||0x1f4;return function(_0x597454){logger[_0x5005('0x21')](_0x597454[_0x5005('0x22')]);if(_0x597454[_0x5005('0x23')]){delete _0x597454[_0x5005('0x23')];}_0x3fb282[_0x5005('0x14')](_0x241018)['send'](_0x597454);};}exports[_0x5005('0x24')]=function(_0x20f886,_0x919995){var _0x245da1={},_0x112f57={},_0x3a00ce={'count':0x0,'rows':[]};var _0x361dfe=db[_0x5005('0x25')][_0x5005('0x26')];_0x112f57[_0x5005('0x27')]=_[_0x5005('0x28')](_0x361dfe);_0x112f57['query']=_[_0x5005('0x28')](_0x20f886[_0x5005('0x29')]);_0x112f57[_0x5005('0x2a')]=_['intersection'](_0x112f57[_0x5005('0x27')],_0x112f57[_0x5005('0x29')]);_0x245da1[_0x5005('0x2b')]=_[_0x5005('0x2c')](_0x112f57[_0x5005('0x27')],qs[_0x5005('0x2d')](_0x20f886['query']['fields']));_0x245da1['attributes']=_0x245da1[_0x5005('0x2b')][_0x5005('0x2e')]?_0x245da1[_0x5005('0x2b')]:_0x112f57[_0x5005('0x27')];if(!_0x20f886[_0x5005('0x29')]['hasOwnProperty']('nolimit')){_0x245da1[_0x5005('0x2f')]=qs[_0x5005('0x2f')](_0x20f886['query'][_0x5005('0x2f')]);_0x245da1[_0x5005('0x17')]=qs[_0x5005('0x17')](_0x20f886[_0x5005('0x29')]['offset']);}_0x245da1[_0x5005('0x30')]=qs[_0x5005('0x31')](_0x20f886[_0x5005('0x29')][_0x5005('0x31')]);_0x245da1[_0x5005('0x32')]=qs[_0x5005('0x2a')](_['pick'](_0x20f886['query'],_0x112f57[_0x5005('0x2a')]));if(_0x20f886['query']['filter']){_0x245da1['where']=_[_0x5005('0x33')](_0x245da1[_0x5005('0x32')],{'$or':_[_0x5005('0x34')](_0x361dfe,function(_0x58d937){if(_0x58d937['type'][_0x5005('0x35')]!==_0x5005('0x36')){var _0x2febb3={};_0x2febb3[_0x58d937[_0x5005('0x37')]]={'$like':'%'+_0x20f886['query'][_0x5005('0x38')]+'%'};return _0x2febb3;}})});}_0x245da1=_[_0x5005('0x33')]({},_0x245da1,_0x20f886['options']);var _0x453de1={'where':_0x245da1[_0x5005('0x32')]};return db['SquareReport'][_0x5005('0x16')](_0x453de1)[_0x5005('0x1f')](function(_0x19b201){_0x3a00ce['count']=_0x19b201;if(_0x20f886[_0x5005('0x29')][_0x5005('0x39')]){_0x245da1[_0x5005('0x3a')]=[{'all':!![]}];}return db['SquareReport'][_0x5005('0x3b')](_0x245da1);})['then'](function(_0xf3f8c0){_0x3a00ce[_0x5005('0x3c')]=_0xf3f8c0;return _0x3a00ce;})[_0x5005('0x1f')](respondWithFilteredResult(_0x919995,_0x245da1))[_0x5005('0x3d')](handleError(_0x919995,null));};exports[_0x5005('0x3e')]=function(_0x6a03c2,_0x2e9163){var _0x3b3335={'raw':!![],'where':{'id':_0x6a03c2[_0x5005('0x3f')]['id']}},_0x180425={};_0x180425[_0x5005('0x27')]=_[_0x5005('0x28')](db[_0x5005('0x25')]['rawAttributes']);_0x180425[_0x5005('0x29')]=_[_0x5005('0x28')](_0x6a03c2[_0x5005('0x29')]);_0x180425[_0x5005('0x2a')]=_[_0x5005('0x2c')](_0x180425[_0x5005('0x27')],_0x180425[_0x5005('0x29')]);_0x3b3335['attributes']=_[_0x5005('0x2c')](_0x180425[_0x5005('0x27')],qs[_0x5005('0x2d')](_0x6a03c2[_0x5005('0x29')][_0x5005('0x2d')]));_0x3b3335[_0x5005('0x2b')]=_0x3b3335[_0x5005('0x2b')][_0x5005('0x2e')]?_0x3b3335[_0x5005('0x2b')]:_0x180425[_0x5005('0x27')];if(_0x6a03c2[_0x5005('0x29')][_0x5005('0x39')]){_0x3b3335['include']=[{'all':!![]}];}_0x3b3335=_[_0x5005('0x33')]({},_0x3b3335,_0x6a03c2[_0x5005('0x40')]);return db['SquareReport'][_0x5005('0x41')](_0x3b3335)['then'](handleEntityNotFound(_0x2e9163,null))['then'](respondWithResult(_0x2e9163,null))[_0x5005('0x3d')](handleError(_0x2e9163,null));};exports[_0x5005('0x42')]=function(_0x569971,_0x177f41){return db[_0x5005('0x25')][_0x5005('0x42')](_0x569971['body'],{})[_0x5005('0x1f')](respondWithResult(_0x177f41,0xc9))['catch'](handleError(_0x177f41,null));};exports['update']=function(_0x430e6e,_0x231af8){if(_0x430e6e[_0x5005('0x43')]['id']){delete _0x430e6e['body']['id'];}return db[_0x5005('0x25')]['find']({'where':{'id':_0x430e6e['params']['id']}})[_0x5005('0x1f')](handleEntityNotFound(_0x231af8,null))[_0x5005('0x1f')](saveUpdates(_0x430e6e[_0x5005('0x43')],null))['then'](respondWithResult(_0x231af8,null))[_0x5005('0x3d')](handleError(_0x231af8,null));};exports['destroy']=function(_0x3502fa,_0xa277af){return db[_0x5005('0x25')][_0x5005('0x41')]({'where':{'id':_0x3502fa[_0x5005('0x3f')]['id']}})[_0x5005('0x1f')](handleEntityNotFound(_0xa277af,null))[_0x5005('0x1f')](removeEntity(_0xa277af,null))[_0x5005('0x3d')](handleError(_0xa277af,null));};exports[_0x5005('0x44')]=function(_0x21143a,_0x489e19){return db['SquareReport'][_0x5005('0x44')]()[_0x5005('0x1f')](respondWithResult(_0x489e19,null))[_0x5005('0x3d')](handleError(_0x489e19,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c55ffcb..9e4e7b6 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 _0x9957=['api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger'];(function(_0x34ac20,_0x266864){var _0x374125=function(_0x145300){while(--_0x145300){_0x34ac20['push'](_0x34ac20['shift']());}};_0x374125(++_0x266864);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'project_name']},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger'];(function(_0x59cbc9,_0x41d483){var _0x985dfe=function(_0x57b347){while(--_0x57b347){_0x59cbc9['push'](_0x59cbc9['shift']());}};_0x985dfe(++_0x41d483);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'project_name']},{'name':_0x7995('0xe'),'fields':[_0x7995('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 24ba7f9..dad348f 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 _0x09db=['catch','CreateSquareReport','create','body','options','raw','debug','SquareReport','update','where','attributes','limit','UpdateSquareReport','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x257471,_0x4d1b50){var _0x3141f4=function(_0x18d44a){while(--_0x18d44a){_0x257471['push'](_0x257471['shift']());}};_0x3141f4(++_0x4d1b50);}(_0x09db,0x178));var _0xb09d=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x09db[_0x9df060];return _0x338dfe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb09d('0x0'));var BPromise=require('bluebird');var rs=require(_0xb09d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb09d('0x2'))['db'];var utils=require(_0xb09d('0x3'));var logger=require('../../config/logger')(_0xb09d('0x4'));var config=require(_0xb09d('0x5'));var jayson=require(_0xb09d('0x6'));var client=jayson[_0xb09d('0x7')][_0xb09d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b4959,_0x1a07a6,_0x75eb70){return new BPromise(function(_0x458aab,_0x446ac5){return client[_0xb09d('0x9')](_0x3b4959,_0x75eb70)[_0xb09d('0xa')](function(_0x30352b){logger[_0xb09d('0xb')](_0xb09d('0xc'),_0x1a07a6,_0xb09d('0xd'));logger['debug'](_0xb09d('0xe'),_0x1a07a6,'request\x20sent',JSON[_0xb09d('0xf')](_0x30352b));if(_0x30352b['error']){if(_0x30352b[_0xb09d('0x10')][_0xb09d('0x11')]===0x1f4){logger[_0xb09d('0x10')](_0xb09d('0xc'),_0x1a07a6,_0x30352b[_0xb09d('0x10')]['message']);return _0x446ac5(_0x30352b[_0xb09d('0x10')]['message']);}logger[_0xb09d('0x10')](_0xb09d('0xc'),_0x1a07a6,_0x30352b[_0xb09d('0x10')][_0xb09d('0x12')]);return _0x458aab(_0x30352b[_0xb09d('0x10')][_0xb09d('0x12')]);}else{logger[_0xb09d('0xb')](_0xb09d('0xc'),_0x1a07a6,_0xb09d('0xd'));_0x458aab(_0x30352b[_0xb09d('0x13')][_0xb09d('0x12')]);}})[_0xb09d('0x14')](function(_0x3c76e){logger[_0xb09d('0x10')](_0xb09d('0xc'),_0x1a07a6,_0x3c76e);_0x446ac5(_0x3c76e);});});}exports[_0xb09d('0x15')]=function(_0x339e8d){var _0x24038c=this;return new Promise(function(_0x12f7da,_0x3fe89f){return db['SquareReport'][_0xb09d('0x16')](_0x339e8d[_0xb09d('0x17')],{'raw':_0x339e8d[_0xb09d('0x18')]?_0x339e8d[_0xb09d('0x18')][_0xb09d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3a275e){logger[_0xb09d('0xb')](_0xb09d('0x15'),_0x339e8d);logger[_0xb09d('0x1a')]('CreateSquareReport',_0x339e8d,JSON[_0xb09d('0xf')](_0x3a275e));_0x12f7da(_0x3a275e);})[_0xb09d('0x14')](function(_0x43b6c6){logger[_0xb09d('0x10')]('CreateSquareReport',_0x43b6c6[_0xb09d('0x12')],_0x339e8d);_0x3fe89f(_0x24038c[_0xb09d('0x10')](0x1f4,_0x43b6c6[_0xb09d('0x12')]));});});};exports['UpdateSquareReport']=function(_0x1c8ee9){var _0x164785=this;return new Promise(function(_0x3522be,_0x2093b4){return db[_0xb09d('0x1b')][_0xb09d('0x1c')](_0x1c8ee9[_0xb09d('0x17')],{'raw':_0x1c8ee9[_0xb09d('0x18')]?_0x1c8ee9['options'][_0xb09d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c8ee9[_0xb09d('0x18')]?_0x1c8ee9[_0xb09d('0x18')][_0xb09d('0x1d')]||null:null,'attributes':_0x1c8ee9['options']?_0x1c8ee9[_0xb09d('0x18')][_0xb09d('0x1e')]||null:null,'limit':_0x1c8ee9[_0xb09d('0x18')]?_0x1c8ee9[_0xb09d('0x18')][_0xb09d('0x1f')]||null:null})[_0xb09d('0xa')](function(_0x2f6389){logger[_0xb09d('0xb')](_0xb09d('0x20'),_0x1c8ee9);logger[_0xb09d('0x1a')](_0xb09d('0x20'),_0x1c8ee9,JSON['stringify'](_0x2f6389));_0x3522be(_0x2f6389);})[_0xb09d('0x14')](function(_0x3522d1){logger[_0xb09d('0x10')](_0xb09d('0x20'),_0x3522d1[_0xb09d('0x12')],_0x1c8ee9);_0x2093b4(_0x164785[_0xb09d('0x10')](0x1f4,_0x3522d1[_0xb09d('0x12')]));});});}; \ No newline at end of file +var _0x0055=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','create','body','options','raw','debug','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util'];(function(_0x3267cb,_0x126cc9){var _0x200925=function(_0x2d96e3){while(--_0x2d96e3){_0x3267cb['push'](_0x3267cb['shift']());}};_0x200925(++_0x126cc9);}(_0x0055,0x1ed));var _0x5005=function(_0x7fb279,_0x4e333a){_0x7fb279=_0x7fb279-0x0;var _0x4344de=_0x0055[_0x7fb279];return _0x4344de;};'use strict';var _=require(_0x5005('0x0'));var util=require(_0x5005('0x1'));var moment=require('moment');var BPromise=require(_0x5005('0x2'));var rs=require(_0x5005('0x3'));var fs=require('fs');var Redis=require(_0x5005('0x4'));var db=require(_0x5005('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5005('0x6'))(_0x5005('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5005('0x8')][_0x5005('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdf0e49,_0x5aa804,_0x36a3d9){return new BPromise(function(_0x5e79b3,_0x556097){return client[_0x5005('0xa')](_0xdf0e49,_0x36a3d9)[_0x5005('0xb')](function(_0x11e575){logger[_0x5005('0xc')](_0x5005('0xd'),_0x5aa804,_0x5005('0xe'));logger['debug'](_0x5005('0xf'),_0x5aa804,'request\x20sent',JSON[_0x5005('0x10')](_0x11e575));if(_0x11e575[_0x5005('0x11')]){if(_0x11e575['error']['code']===0x1f4){logger[_0x5005('0x11')](_0x5005('0xd'),_0x5aa804,_0x11e575[_0x5005('0x11')][_0x5005('0x12')]);return _0x556097(_0x11e575['error'][_0x5005('0x12')]);}logger[_0x5005('0x11')](_0x5005('0xd'),_0x5aa804,_0x11e575[_0x5005('0x11')]['message']);return _0x5e79b3(_0x11e575['error'][_0x5005('0x12')]);}else{logger[_0x5005('0xc')]('SquareReport,\x20%s,\x20%s',_0x5aa804,_0x5005('0xe'));_0x5e79b3(_0x11e575[_0x5005('0x13')][_0x5005('0x12')]);}})[_0x5005('0x14')](function(_0x510bab){logger[_0x5005('0x11')](_0x5005('0xd'),_0x5aa804,_0x510bab);_0x556097(_0x510bab);});});}exports[_0x5005('0x15')]=function(_0x1ac578){var _0x6e11be=this;return new Promise(function(_0x5bc486,_0x1b42e4){return db['SquareReport'][_0x5005('0x16')](_0x1ac578[_0x5005('0x17')],{'raw':_0x1ac578[_0x5005('0x18')]?_0x1ac578[_0x5005('0x18')][_0x5005('0x19')]===undefined?!![]:![]:!![]})[_0x5005('0xb')](function(_0x473648){logger['info'](_0x5005('0x15'),_0x1ac578);logger[_0x5005('0x1a')](_0x5005('0x15'),_0x1ac578,JSON[_0x5005('0x10')](_0x473648));_0x5bc486(_0x473648);})[_0x5005('0x14')](function(_0x47d65a){logger[_0x5005('0x11')](_0x5005('0x15'),_0x47d65a[_0x5005('0x12')],_0x1ac578);_0x1b42e4(_0x6e11be[_0x5005('0x11')](0x1f4,_0x47d65a['message']));});});};exports[_0x5005('0x1b')]=function(_0x5333be){var _0x365097=this;return new Promise(function(_0x15eb7f,_0x47d287){return db[_0x5005('0x1c')][_0x5005('0x1d')](_0x5333be[_0x5005('0x17')],{'raw':_0x5333be['options']?_0x5333be['options'][_0x5005('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5333be[_0x5005('0x18')]?_0x5333be['options'][_0x5005('0x1e')]||null:null,'attributes':_0x5333be[_0x5005('0x18')]?_0x5333be['options'][_0x5005('0x1f')]||null:null,'limit':_0x5333be[_0x5005('0x18')]?_0x5333be['options'][_0x5005('0x20')]||null:null})['then'](function(_0x1f820c){logger[_0x5005('0xc')](_0x5005('0x1b'),_0x5333be);logger[_0x5005('0x1a')]('UpdateSquareReport',_0x5333be,JSON[_0x5005('0x10')](_0x1f820c));_0x15eb7f(_0x1f820c);})[_0x5005('0x14')](function(_0x382cb0){logger[_0x5005('0x11')](_0x5005('0x1b'),_0x382cb0['message'],_0x5333be);_0x47d287(_0x365097[_0x5005('0x11')](0x1f4,_0x382cb0[_0x5005('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a24830c..dd19dd5 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 _0xdbaa=['post','create','put','update','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x41ac93,_0x320728){var _0x3c8c88=function(_0x21b277){while(--_0x21b277){_0x41ac93['push'](_0x41ac93['shift']());}};_0x3c8c88(++_0x320728);}(_0xdbaa,0x1a9));var _0xadba=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xdbaa[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0xadba('0x0'));var util=require(_0xadba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xadba('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xadba('0x3'));var config=require(_0xadba('0x4'));var controller=require(_0xadba('0x5'));router['get']('/',auth[_0xadba('0x6')](),controller[_0xadba('0x7')]);router[_0xadba('0x8')]('/describe',auth[_0xadba('0x6')](),controller[_0xadba('0x9')]);router[_0xadba('0x8')](_0xadba('0xa'),auth[_0xadba('0x6')](),controller[_0xadba('0xb')]);router[_0xadba('0xc')]('/',auth[_0xadba('0x6')](),controller[_0xadba('0xd')]);router[_0xadba('0xe')]('/:id',auth[_0xadba('0x6')](),controller[_0xadba('0xf')]);router[_0xadba('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xadba('0x11')]);module[_0xadba('0x12')]=router; \ No newline at end of file +var _0x5205=['isAuthenticated','put','/:id','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','index','/describe','describe','show','post'];(function(_0x37182c,_0x33ea12){var _0x31c5f9=function(_0x2e62fb){while(--_0x2e62fb){_0x37182c['push'](_0x37182c['shift']());}};_0x31c5f9(++_0x33ea12);}(_0x5205,0x1e0));var _0x5520=function(_0xdc9365,_0x12d294){_0xdc9365=_0xdc9365-0x0;var _0xe9a138=_0x5205[_0xdc9365];return _0xe9a138;};'use strict';var multer=require(_0x5520('0x0'));var util=require(_0x5520('0x1'));var path=require(_0x5520('0x2'));var timeout=require(_0x5520('0x3'));var express=require('express');var router=express[_0x5520('0x4')]();var auth=require(_0x5520('0x5'));var interaction=require(_0x5520('0x6'));var config=require('../../config/environment');var controller=require(_0x5520('0x7'));router[_0x5520('0x8')]('/',auth['isAuthenticated'](),controller[_0x5520('0x9')]);router[_0x5520('0x8')](_0x5520('0xa'),auth['isAuthenticated'](),controller[_0x5520('0xb')]);router[_0x5520('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5520('0xc')]);router[_0x5520('0xd')]('/',auth[_0x5520('0xe')](),controller['create']);router[_0x5520('0xf')](_0x5520('0x10'),auth[_0x5520('0xe')](),controller[_0x5520('0x11')]);router['delete'](_0x5520('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x5520('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3a546c3..72497d4 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 _0x62b8=['TEXT','sequelize','STRING'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x62b8,0x115));var _0x862b=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x62b8[_0x305b20];return _0x26d64a;};'use strict';var Sequelize=require(_0x862b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x862b('0x1')]},'node':{'type':Sequelize[_0x862b('0x1')]},'application':{'type':Sequelize[_0x862b('0x1')]},'data':{'type':Sequelize[_0x862b('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x862b('0x1')]}}; \ No newline at end of file +var _0xa176=['STRING','exports'];(function(_0x2ac22e,_0x53fed4){var _0x5c8c38=function(_0x191916){while(--_0x191916){_0x2ac22e['push'](_0x2ac22e['shift']());}};_0x5c8c38(++_0x53fed4);}(_0xa176,0x113));var _0x6a17=function(_0x4c1f85,_0x57bbfb){_0x4c1f85=_0x4c1f85-0x0;var _0x4a2b60=_0xa176[_0x4c1f85];return _0x4a2b60;};'use strict';var Sequelize=require('sequelize');module[_0x6a17('0x0')]={'uniqueid':{'type':Sequelize[_0x6a17('0x1')]},'node':{'type':Sequelize[_0x6a17('0x1')]},'application':{'type':Sequelize[_0x6a17('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x6a17('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 145f2a4..70ccf43 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 _0x77eb=['moment','mustache','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','field','options','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1bbb71,_0x41de70){var _0x57d0dc=function(_0x126d5f){while(--_0x126d5f){_0x1bbb71['push'](_0x1bbb71['shift']());}};_0x57d0dc(++_0x41de70);}(_0x77eb,0x87));var _0xb77e=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x77eb[_0x1044e5];return _0x5ad0dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb77e('0x0'));var rimraf=require(_0xb77e('0x1'));var zipdir=require(_0xb77e('0x2'));var jsonpatch=require(_0xb77e('0x3'));var rp=require(_0xb77e('0x4'));var moment=require(_0xb77e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb77e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb77e('0x7'));var csv=require('to-csv');var ejs=require(_0xb77e('0x8'));var fs=require('fs');var _=require(_0xb77e('0x9'));var squel=require('squel');var crypto=require(_0xb77e('0xa'));var jsforce=require(_0xb77e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb77e('0xc'));var querystring=require(_0xb77e('0xd'));var Papa=require(_0xb77e('0xe'));var Redis=require('ioredis');var authService=require(_0xb77e('0xf'));var qs=require(_0xb77e('0x10'));var hardwareService=require(_0xb77e('0x11'));var logger=require(_0xb77e('0x12'))(_0xb77e('0x13'));var utils=require(_0xb77e('0x14'));var config=require(_0xb77e('0x15'));var db=require(_0xb77e('0x16'))['db'];function respondWithStatusCode(_0xd8372d,_0x23a4e0){_0x23a4e0=_0x23a4e0||0xcc;return function(_0x247df0){if(_0x247df0){return _0xd8372d[_0xb77e('0x17')](_0x23a4e0);}return _0xd8372d[_0xb77e('0x18')](_0x23a4e0)['end']();};}function respondWithResult(_0x5e6fa4,_0x2ad7d8){_0x2ad7d8=_0x2ad7d8||0xc8;return function(_0x4f43ad){if(_0x4f43ad){return _0x5e6fa4[_0xb77e('0x18')](_0x2ad7d8)[_0xb77e('0x19')](_0x4f43ad);}};}function respondWithFilteredResult(_0x46c7a0,_0x171229){return function(_0x28b5a6){if(_0x28b5a6){var _0x3b21bf=_0x28b5a6[_0xb77e('0x1a')],_0x1c1714=_0x171229[_0xb77e('0x1b')],_0x2efe33=_0x171229[_0xb77e('0x1b')]+_0x171229[_0xb77e('0x1c')],_0x5b6003;if(_0x2efe33>=_0x3b21bf){_0x2efe33=_0x3b21bf;_0x5b6003=0xc8;}else{_0x5b6003=0xce;}_0x46c7a0[_0xb77e('0x18')](_0x5b6003);return _0x46c7a0[_0xb77e('0x1d')](_0xb77e('0x1e'),_0x1c1714+'-'+_0x2efe33+'/'+_0x3b21bf)['json'](_0x28b5a6);}return null;};}function patchUpdates(_0x42ac53){return function(_0x347811){try{jsonpatch[_0xb77e('0x1f')](_0x347811,_0x42ac53,!![]);}catch(_0x719a0d){return BPromise['reject'](_0x719a0d);}return _0x347811[_0xb77e('0x20')]();};}function saveUpdates(_0x3c84e3,_0x570e76){return function(_0x50e39d){if(_0x50e39d){return _0x50e39d[_0xb77e('0x21')](_0x3c84e3)[_0xb77e('0x22')](function(_0x56aa50){return _0x56aa50;});}return null;};}function removeEntity(_0x1014ab,_0x5cd264){return function(_0x91691f){if(_0x91691f){return _0x91691f[_0xb77e('0x23')]()[_0xb77e('0x22')](function(){_0x1014ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162877,_0x1b12a3){return function(_0x157c5b){if(!_0x157c5b){_0x162877[_0xb77e('0x17')](0x194);}return _0x157c5b;};}function handleError(_0xf63c4,_0x44fa73){_0x44fa73=_0x44fa73||0x1f4;return function(_0x5530e9){logger[_0xb77e('0x24')](_0x5530e9[_0xb77e('0x25')]);if(_0x5530e9[_0xb77e('0x26')]){delete _0x5530e9[_0xb77e('0x26')];}_0xf63c4[_0xb77e('0x18')](_0x44fa73)[_0xb77e('0x27')](_0x5530e9);};}exports[_0xb77e('0x28')]=function(_0x452b94,_0x206db8){var _0x5b332b={},_0x388211={},_0x5f0d1e={'count':0x0,'rows':[]};var _0x1c7fc8=db[_0xb77e('0x29')]['rawAttributes'];_0x388211['model']=_[_0xb77e('0x2a')](_0x1c7fc8);_0x388211['query']=_[_0xb77e('0x2a')](_0x452b94[_0xb77e('0x2b')]);_0x388211[_0xb77e('0x2c')]=_['intersection'](_0x388211[_0xb77e('0x2d')],_0x388211[_0xb77e('0x2b')]);_0x5b332b[_0xb77e('0x2e')]=_[_0xb77e('0x2f')](_0x388211[_0xb77e('0x2d')],qs[_0xb77e('0x30')](_0x452b94[_0xb77e('0x2b')]['fields']));_0x5b332b[_0xb77e('0x2e')]=_0x5b332b[_0xb77e('0x2e')][_0xb77e('0x31')]?_0x5b332b[_0xb77e('0x2e')]:_0x388211['model'];if(!_0x452b94[_0xb77e('0x2b')][_0xb77e('0x32')](_0xb77e('0x33'))){_0x5b332b['limit']=qs[_0xb77e('0x1c')](_0x452b94[_0xb77e('0x2b')][_0xb77e('0x1c')]);_0x5b332b[_0xb77e('0x1b')]=qs[_0xb77e('0x1b')](_0x452b94[_0xb77e('0x2b')][_0xb77e('0x1b')]);}_0x5b332b[_0xb77e('0x34')]=qs[_0xb77e('0x35')](_0x452b94[_0xb77e('0x2b')][_0xb77e('0x35')]);_0x5b332b[_0xb77e('0x36')]=qs[_0xb77e('0x2c')](_['pick'](_0x452b94[_0xb77e('0x2b')],_0x388211['filters']));if(_0x452b94[_0xb77e('0x2b')][_0xb77e('0x37')]){_0x5b332b[_0xb77e('0x36')]=_[_0xb77e('0x38')](_0x5b332b['where'],{'$or':_['map'](_0x1c7fc8,function(_0x29dddc){if(_0x29dddc[_0xb77e('0x39')]['key']!=='VIRTUAL'){var _0x5c39cd={};_0x5c39cd[_0x29dddc[_0xb77e('0x3a')]]={'$like':'%'+_0x452b94[_0xb77e('0x2b')][_0xb77e('0x37')]+'%'};return _0x5c39cd;}})});}_0x5b332b=_[_0xb77e('0x38')]({},_0x5b332b,_0x452b94[_0xb77e('0x3b')]);var _0x211639={'where':_0x5b332b['where']};return db[_0xb77e('0x29')][_0xb77e('0x1a')](_0x211639)['then'](function(_0x4fc8d2){_0x5f0d1e[_0xb77e('0x1a')]=_0x4fc8d2;if(_0x452b94[_0xb77e('0x2b')]['includeAll']){_0x5b332b[_0xb77e('0x3c')]=[{'all':!![]}];}return db[_0xb77e('0x29')][_0xb77e('0x3d')](_0x5b332b);})[_0xb77e('0x22')](function(_0x482b9f){_0x5f0d1e['rows']=_0x482b9f;return _0x5f0d1e;})[_0xb77e('0x22')](respondWithFilteredResult(_0x206db8,_0x5b332b))['catch'](handleError(_0x206db8,null));};exports[_0xb77e('0x3e')]=function(_0x270a68,_0x484540){var _0x323a3c={'raw':!![],'where':{'id':_0x270a68[_0xb77e('0x3f')]['id']}},_0x4bc6a0={};_0x4bc6a0[_0xb77e('0x2d')]=_[_0xb77e('0x2a')](db['SquareDetailsReport'][_0xb77e('0x40')]);_0x4bc6a0[_0xb77e('0x2b')]=_[_0xb77e('0x2a')](_0x270a68[_0xb77e('0x2b')]);_0x4bc6a0[_0xb77e('0x2c')]=_[_0xb77e('0x2f')](_0x4bc6a0['model'],_0x4bc6a0[_0xb77e('0x2b')]);_0x323a3c[_0xb77e('0x2e')]=_['intersection'](_0x4bc6a0['model'],qs[_0xb77e('0x30')](_0x270a68[_0xb77e('0x2b')][_0xb77e('0x30')]));_0x323a3c['attributes']=_0x323a3c[_0xb77e('0x2e')]['length']?_0x323a3c[_0xb77e('0x2e')]:_0x4bc6a0[_0xb77e('0x2d')];if(_0x270a68[_0xb77e('0x2b')]['includeAll']){_0x323a3c['include']=[{'all':!![]}];}_0x323a3c=_[_0xb77e('0x38')]({},_0x323a3c,_0x270a68['options']);return db[_0xb77e('0x29')][_0xb77e('0x41')](_0x323a3c)[_0xb77e('0x22')](handleEntityNotFound(_0x484540,null))[_0xb77e('0x22')](respondWithResult(_0x484540,null))[_0xb77e('0x42')](handleError(_0x484540,null));};exports[_0xb77e('0x43')]=function(_0x19460e,_0x271355){return db['SquareDetailsReport'][_0xb77e('0x43')](_0x19460e[_0xb77e('0x44')],{})[_0xb77e('0x22')](respondWithResult(_0x271355,0xc9))['catch'](handleError(_0x271355,null));};exports['update']=function(_0x2b3159,_0x30ee29){if(_0x2b3159[_0xb77e('0x44')]['id']){delete _0x2b3159[_0xb77e('0x44')]['id'];}return db['SquareDetailsReport'][_0xb77e('0x41')]({'where':{'id':_0x2b3159[_0xb77e('0x3f')]['id']}})[_0xb77e('0x22')](handleEntityNotFound(_0x30ee29,null))[_0xb77e('0x22')](saveUpdates(_0x2b3159[_0xb77e('0x44')],null))[_0xb77e('0x22')](respondWithResult(_0x30ee29,null))[_0xb77e('0x42')](handleError(_0x30ee29,null));};exports[_0xb77e('0x23')]=function(_0x266e40,_0x503118){return db[_0xb77e('0x29')][_0xb77e('0x41')]({'where':{'id':_0x266e40['params']['id']}})[_0xb77e('0x22')](handleEntityNotFound(_0x503118,null))[_0xb77e('0x22')](removeEntity(_0x503118,null))[_0xb77e('0x42')](handleError(_0x503118,null));};exports[_0xb77e('0x45')]=function(_0x4acd0e,_0x4f3cb9){return db[_0xb77e('0x29')][_0xb77e('0x45')]()[_0xb77e('0x22')](respondWithResult(_0x4f3cb9,null))[_0xb77e('0x42')](handleError(_0x4f3cb9,null));}; \ No newline at end of file +var _0x64a1=['length','nolimit','limit','sort','pick','where','merge','map','key','field','filter','options','count','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','SquareDetailsReport','rawAttributes','keys','query','filters','intersection','attributes','model','fields'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0x64a1,0x12f));var _0x164a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x64a1[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x164a('0x0'));var rimraf=require(_0x164a('0x1'));var zipdir=require(_0x164a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x164a('0x3'));var moment=require(_0x164a('0x4'));var BPromise=require(_0x164a('0x5'));var Mustache=require(_0x164a('0x6'));var util=require(_0x164a('0x7'));var path=require(_0x164a('0x8'));var sox=require(_0x164a('0x9'));var csv=require(_0x164a('0xa'));var ejs=require(_0x164a('0xb'));var fs=require('fs');var _=require(_0x164a('0xc'));var squel=require(_0x164a('0xd'));var crypto=require(_0x164a('0xe'));var jsforce=require(_0x164a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x164a('0xa'));var querystring=require('querystring');var Papa=require(_0x164a('0x10'));var Redis=require(_0x164a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x164a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x164a('0x13'))(_0x164a('0x14'));var utils=require(_0x164a('0x15'));var config=require(_0x164a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e1bab,_0x4233c2){_0x4233c2=_0x4233c2||0xcc;return function(_0x637544){if(_0x637544){return _0x2e1bab[_0x164a('0x17')](_0x4233c2);}return _0x2e1bab[_0x164a('0x18')](_0x4233c2)[_0x164a('0x19')]();};}function respondWithResult(_0x161f94,_0x2e7f29){_0x2e7f29=_0x2e7f29||0xc8;return function(_0x5919e6){if(_0x5919e6){return _0x161f94['status'](_0x2e7f29)['json'](_0x5919e6);}};}function respondWithFilteredResult(_0x4f11b6,_0x2cd859){return function(_0xe9740){if(_0xe9740){var _0x464322=_0xe9740['count'],_0x443054=_0x2cd859[_0x164a('0x1a')],_0x2cb545=_0x2cd859[_0x164a('0x1a')]+_0x2cd859['limit'],_0x40e74f;if(_0x2cb545>=_0x464322){_0x2cb545=_0x464322;_0x40e74f=0xc8;}else{_0x40e74f=0xce;}_0x4f11b6[_0x164a('0x18')](_0x40e74f);return _0x4f11b6['set'](_0x164a('0x1b'),_0x443054+'-'+_0x2cb545+'/'+_0x464322)[_0x164a('0x1c')](_0xe9740);}return null;};}function patchUpdates(_0x49d7a7){return function(_0x4820d6){try{jsonpatch[_0x164a('0x1d')](_0x4820d6,_0x49d7a7,!![]);}catch(_0x469407){return BPromise[_0x164a('0x1e')](_0x469407);}return _0x4820d6[_0x164a('0x1f')]();};}function saveUpdates(_0x38fd0c,_0x3cd9cb){return function(_0x376573){if(_0x376573){return _0x376573['update'](_0x38fd0c)[_0x164a('0x20')](function(_0x39c93a){return _0x39c93a;});}return null;};}function removeEntity(_0x50ec36,_0x1bc093){return function(_0x24e2bf){if(_0x24e2bf){return _0x24e2bf[_0x164a('0x21')]()['then'](function(){_0x50ec36[_0x164a('0x18')](0xcc)[_0x164a('0x19')]();});}};}function handleEntityNotFound(_0x2aec7b,_0x4a5f25){return function(_0x1a6c19){if(!_0x1a6c19){_0x2aec7b['sendStatus'](0x194);}return _0x1a6c19;};}function handleError(_0x148159,_0x40ccd2){_0x40ccd2=_0x40ccd2||0x1f4;return function(_0x4616a4){logger[_0x164a('0x22')](_0x4616a4[_0x164a('0x23')]);if(_0x4616a4[_0x164a('0x24')]){delete _0x4616a4['name'];}_0x148159[_0x164a('0x18')](_0x40ccd2)['send'](_0x4616a4);};}exports[_0x164a('0x25')]=function(_0x21e7f7,_0x30721c){var _0x48be04={},_0x26d73e={},_0x2d5d7b={'count':0x0,'rows':[]};var _0x573f43=db[_0x164a('0x26')][_0x164a('0x27')];_0x26d73e['model']=_[_0x164a('0x28')](_0x573f43);_0x26d73e[_0x164a('0x29')]=_['keys'](_0x21e7f7[_0x164a('0x29')]);_0x26d73e[_0x164a('0x2a')]=_[_0x164a('0x2b')](_0x26d73e['model'],_0x26d73e[_0x164a('0x29')]);_0x48be04[_0x164a('0x2c')]=_['intersection'](_0x26d73e[_0x164a('0x2d')],qs['fields'](_0x21e7f7['query'][_0x164a('0x2e')]));_0x48be04[_0x164a('0x2c')]=_0x48be04[_0x164a('0x2c')][_0x164a('0x2f')]?_0x48be04[_0x164a('0x2c')]:_0x26d73e[_0x164a('0x2d')];if(!_0x21e7f7[_0x164a('0x29')]['hasOwnProperty'](_0x164a('0x30'))){_0x48be04[_0x164a('0x31')]=qs[_0x164a('0x31')](_0x21e7f7['query'][_0x164a('0x31')]);_0x48be04['offset']=qs[_0x164a('0x1a')](_0x21e7f7[_0x164a('0x29')][_0x164a('0x1a')]);}_0x48be04['order']=qs[_0x164a('0x32')](_0x21e7f7[_0x164a('0x29')][_0x164a('0x32')]);_0x48be04['where']=qs[_0x164a('0x2a')](_[_0x164a('0x33')](_0x21e7f7[_0x164a('0x29')],_0x26d73e[_0x164a('0x2a')]));if(_0x21e7f7['query']['filter']){_0x48be04[_0x164a('0x34')]=_[_0x164a('0x35')](_0x48be04[_0x164a('0x34')],{'$or':_[_0x164a('0x36')](_0x573f43,function(_0x43a350){if(_0x43a350['type'][_0x164a('0x37')]!=='VIRTUAL'){var _0x1bcbad={};_0x1bcbad[_0x43a350[_0x164a('0x38')]]={'$like':'%'+_0x21e7f7[_0x164a('0x29')][_0x164a('0x39')]+'%'};return _0x1bcbad;}})});}_0x48be04=_[_0x164a('0x35')]({},_0x48be04,_0x21e7f7[_0x164a('0x3a')]);var _0x170951={'where':_0x48be04[_0x164a('0x34')]};return db[_0x164a('0x26')][_0x164a('0x3b')](_0x170951)[_0x164a('0x20')](function(_0xa2ce7b){_0x2d5d7b[_0x164a('0x3b')]=_0xa2ce7b;if(_0x21e7f7['query'][_0x164a('0x3c')]){_0x48be04[_0x164a('0x3d')]=[{'all':!![]}];}return db[_0x164a('0x26')][_0x164a('0x3e')](_0x48be04);})[_0x164a('0x20')](function(_0x3637cc){_0x2d5d7b['rows']=_0x3637cc;return _0x2d5d7b;})[_0x164a('0x20')](respondWithFilteredResult(_0x30721c,_0x48be04))[_0x164a('0x3f')](handleError(_0x30721c,null));};exports['show']=function(_0x27f9c1,_0x38416e){var _0xa0b984={'raw':!![],'where':{'id':_0x27f9c1[_0x164a('0x40')]['id']}},_0x13efe6={};_0x13efe6[_0x164a('0x2d')]=_[_0x164a('0x28')](db[_0x164a('0x26')][_0x164a('0x27')]);_0x13efe6[_0x164a('0x29')]=_[_0x164a('0x28')](_0x27f9c1[_0x164a('0x29')]);_0x13efe6[_0x164a('0x2a')]=_[_0x164a('0x2b')](_0x13efe6[_0x164a('0x2d')],_0x13efe6[_0x164a('0x29')]);_0xa0b984[_0x164a('0x2c')]=_['intersection'](_0x13efe6[_0x164a('0x2d')],qs[_0x164a('0x2e')](_0x27f9c1[_0x164a('0x29')][_0x164a('0x2e')]));_0xa0b984[_0x164a('0x2c')]=_0xa0b984['attributes'][_0x164a('0x2f')]?_0xa0b984[_0x164a('0x2c')]:_0x13efe6[_0x164a('0x2d')];if(_0x27f9c1['query'][_0x164a('0x3c')]){_0xa0b984[_0x164a('0x3d')]=[{'all':!![]}];}_0xa0b984=_['merge']({},_0xa0b984,_0x27f9c1[_0x164a('0x3a')]);return db['SquareDetailsReport'][_0x164a('0x41')](_0xa0b984)[_0x164a('0x20')](handleEntityNotFound(_0x38416e,null))[_0x164a('0x20')](respondWithResult(_0x38416e,null))['catch'](handleError(_0x38416e,null));};exports[_0x164a('0x42')]=function(_0x2f587c,_0x568148){return db[_0x164a('0x26')][_0x164a('0x42')](_0x2f587c[_0x164a('0x43')],{})[_0x164a('0x20')](respondWithResult(_0x568148,0xc9))['catch'](handleError(_0x568148,null));};exports[_0x164a('0x44')]=function(_0x760134,_0x54ac8e){if(_0x760134['body']['id']){delete _0x760134[_0x164a('0x43')]['id'];}return db[_0x164a('0x26')]['find']({'where':{'id':_0x760134[_0x164a('0x40')]['id']}})['then'](handleEntityNotFound(_0x54ac8e,null))[_0x164a('0x20')](saveUpdates(_0x760134[_0x164a('0x43')],null))[_0x164a('0x20')](respondWithResult(_0x54ac8e,null))[_0x164a('0x3f')](handleError(_0x54ac8e,null));};exports[_0x164a('0x21')]=function(_0x3e7368,_0x484328){return db[_0x164a('0x26')][_0x164a('0x41')]({'where':{'id':_0x3e7368[_0x164a('0x40')]['id']}})[_0x164a('0x20')](handleEntityNotFound(_0x484328,null))[_0x164a('0x20')](removeEntity(_0x484328,null))[_0x164a('0x3f')](handleError(_0x484328,null));};exports[_0x164a('0x45')]=function(_0x435e7c,_0x4aba22){return db[_0x164a('0x26')]['describe']()[_0x164a('0x20')](respondWithResult(_0x4aba22,null))[_0x164a('0x3f')](handleError(_0x4aba22,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 26518b3..c787a5b 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 _0xbd0a=['report_square_details','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xbd0a,0x1b9));var _0xabd0=function(_0xe8cdde,_0x5c9d47){_0xe8cdde=_0xe8cdde-0x0;var _0x4628cd=_0xbd0a[_0xe8cdde];return _0x4628cd;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('SquareDetailsReport',attributes,{'tableName':_0xabd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9576=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x9576,0x182));var _0x6957=function(_0x193847,_0x45c099){_0x193847=_0x193847-0x0;var _0x57b948=_0x9576[_0x193847];return _0x57b948;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var logger=require(_0x6957('0x2'))(_0x6957('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6957('0x4'));var fs=require('fs');var path=require(_0x6957('0x5'));var rimraf=require(_0x6957('0x6'));var config=require(_0x6957('0x7'));var attributes=require(_0x6957('0x8'));module[_0x6957('0x9')]=function(_0x2eb79e,_0x49e08a){return _0x2eb79e[_0x6957('0xa')](_0x6957('0xb'),attributes,{'tableName':_0x6957('0xc'),'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 a70be5e..e608182 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 _0xdc59=['error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0xdc59,0x12c));var _0x9dc5=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xdc59[_0x597484];return _0x218e64;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48beee,_0x42941b,_0x10b268){return new BPromise(function(_0x202a8a,_0x3729b6){return client[_0x9dc5('0xc')](_0x48beee,_0x10b268)[_0x9dc5('0xd')](function(_0x174835){logger[_0x9dc5('0xe')](_0x9dc5('0xf'),_0x42941b,_0x9dc5('0x10'));logger['debug'](_0x9dc5('0x11'),_0x42941b,_0x9dc5('0x10'),JSON[_0x9dc5('0x12')](_0x174835));if(_0x174835[_0x9dc5('0x13')]){if(_0x174835['error'][_0x9dc5('0x14')]===0x1f4){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835['error'][_0x9dc5('0x15')]);return _0x3729b6(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);return _0x202a8a(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}else{logger[_0x9dc5('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x42941b,_0x9dc5('0x10'));_0x202a8a(_0x174835['result'][_0x9dc5('0x15')]);}})[_0x9dc5('0x16')](function(_0x5a9ffb){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x5a9ffb);_0x3729b6(_0x5a9ffb);});});}exports[_0x9dc5('0x17')]=function(_0x16fca8){var _0x4e1529=this;return new Promise(function(_0x4493c7,_0xa65c51){return db[_0x9dc5('0x18')][_0x9dc5('0x19')](_0x16fca8[_0x9dc5('0x1a')],{'raw':_0x16fca8['options']?_0x16fca8[_0x9dc5('0x1b')][_0x9dc5('0x1c')]===undefined?!![]:![]:!![]})[_0x9dc5('0xd')](function(_0x4e6388){logger['info'](_0x9dc5('0x17'),_0x16fca8);logger['debug'](_0x9dc5('0x17'),_0x16fca8,JSON['stringify'](_0x4e6388));_0x4493c7(_0x4e6388);})[_0x9dc5('0x16')](function(_0x5c8956){logger[_0x9dc5('0x13')]('CreateSquareDetailsReport',_0x5c8956[_0x9dc5('0x15')],_0x16fca8);_0xa65c51(_0x4e1529[_0x9dc5('0x13')](0x1f4,_0x5c8956[_0x9dc5('0x15')]));});});}; \ No newline at end of file +var _0x5183=['../../config/logger','jayson/promise','client','http','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SquareDetailsReport','create','body','options','raw','info','CreateSquareDetailsReport','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0x5183,0x13e));var _0x3518=function(_0x38cb51,_0x27ed8f){_0x38cb51=_0x38cb51-0x0;var _0x8f951b=_0x5183[_0x38cb51];return _0x8f951b;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var moment=require(_0x3518('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3518('0x3'));var db=require(_0x3518('0x4'))['db'];var utils=require(_0x3518('0x5'));var logger=require(_0x3518('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3518('0x7'));var client=jayson[_0x3518('0x8')][_0x3518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482b2d,_0x5cd139,_0x488c52){return new BPromise(function(_0x147b59,_0x33e66c){return client[_0x3518('0xa')](_0x482b2d,_0x488c52)['then'](function(_0x12530b){logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));logger[_0x3518('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5cd139,_0x3518('0xc'),JSON[_0x3518('0xe')](_0x12530b));if(_0x12530b['error']){if(_0x12530b[_0x3518('0xf')][_0x3518('0x10')]===0x1f4){logger[_0x3518('0xf')](_0x3518('0xb'),_0x5cd139,_0x12530b['error']['message']);return _0x33e66c(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}logger[_0x3518('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x5cd139,_0x12530b['error'][_0x3518('0x11')]);return _0x147b59(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}else{logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));_0x147b59(_0x12530b[_0x3518('0x12')][_0x3518('0x11')]);}})['catch'](function(_0xc7f658){logger['error'](_0x3518('0xb'),_0x5cd139,_0xc7f658);_0x33e66c(_0xc7f658);});});}exports['CreateSquareDetailsReport']=function(_0x3f67b6){var _0x1cefa7=this;return new Promise(function(_0x4b9a06,_0x3df948){return db[_0x3518('0x13')][_0x3518('0x14')](_0x3f67b6[_0x3518('0x15')],{'raw':_0x3f67b6[_0x3518('0x16')]?_0x3f67b6['options'][_0x3518('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x29e696){logger[_0x3518('0x18')](_0x3518('0x19'),_0x3f67b6);logger['debug'](_0x3518('0x19'),_0x3f67b6,JSON[_0x3518('0xe')](_0x29e696));_0x4b9a06(_0x29e696);})[_0x3518('0x1a')](function(_0x1e25a9){logger[_0x3518('0xf')]('CreateSquareDetailsReport',_0x1e25a9[_0x3518('0x11')],_0x3f67b6);_0x3df948(_0x1cefa7[_0x3518('0xf')](0x1f4,_0x1e25a9[_0x3518('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 6a614da..71a174e 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 _0x3086=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x3086,0x141));var _0x6308=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x3086[_0x1a36a5];return _0x746243;};'use strict';var express=require(_0x6308('0x0'));var router=express[_0x6308('0x1')]();var auth=require(_0x6308('0x2'));var controller=require(_0x6308('0x3'));router[_0x6308('0x4')]('/',auth[_0x6308('0x5')](),controller[_0x6308('0x6')]);router[_0x6308('0x4')](_0x6308('0x7'),auth['isAuthenticated'](),controller[_0x6308('0x8')]);module['exports']=router; \ No newline at end of file +var _0xc1f4=['../../components/auth/service','index','/process/:pid/kill','isAuthenticated','exports','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1f4,0x137));var _0x4c1f=function(_0x402eff,_0x2525f2){_0x402eff=_0x402eff-0x0;var _0x2eb371=_0xc1f4[_0x402eff];return _0x2eb371;};'use strict';var express=require(_0x4c1f('0x0'));var router=express['Router']();var auth=require(_0x4c1f('0x1'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4c1f('0x2')]);router['get'](_0x4c1f('0x3'),auth[_0x4c1f('0x4')](),controller['killProcess']);module[_0x4c1f('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5f71aa0..5121214 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 _0x3834=['catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json'];(function(_0x5b5b6f,_0x48b120){var _0x21675a=function(_0x1d3056){while(--_0x1d3056){_0x5b5b6f['push'](_0x5b5b6f['shift']());}};_0x21675a(++_0x48b120);}(_0x3834,0x73));var _0x4383=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3834[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x4383('0x0'));var exec=require(_0x4383('0x1'))[_0x4383('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x4383('0x3'));var BPromise=require(_0x4383('0x4'));var _=require(_0x4383('0x5'));function handleError(_0x397e3d,_0x47f360,_0x11eeba){_0x47f360=_0x47f360||0x1f4;return function(_0x144ea9){logger['error'](_0x4383('0x6'),_0x11eeba,_0x47f360,util[_0x4383('0x7')](_0x144ea9,{'showHidden':![],'depth':null}));delete _0x144ea9[_0x4383('0x8')];_0x397e3d[_0x4383('0x9')](_0x47f360)[_0x4383('0xa')](_0x144ea9);};}exports[_0x4383('0xb')]=function(_0x43ee11,_0x10e88d){return info[_0x4383('0xc')]()[_0x4383('0xd')](function(_0x384483){return _0x10e88d[_0x4383('0x9')](0xc8)[_0x4383('0xe')](_0x384483);})[_0x4383('0xf')](function(_0x4691f7){return _0x10e88d['status'](0x1f4)['json'](_0x4691f7);});};exports[_0x4383('0x10')]=function(_0x354e6b,_0x4d4129){var _0x3235fb=['components/import/cm'];return new BPromise(function(_0x4b4767,_0xcba71e){return exec(util[_0x4383('0x11')](_0x4383('0x12'),_0x354e6b[_0x4383('0x13')][_0x4383('0x14')]),function(_0x1b68d2,_0x4b8d25,_0x3dca5c){if(_0x1b68d2){return _0xcba71e(_0x1b68d2);}return _0x4b4767(_0x4b8d25);});})[_0x4383('0xd')](function(_0x27e337){var _0xd51dac=![];var _0x21b263=_0x27e337[_0x4383('0x15')](/\n/);for(var _0x5d753d=0x0,_0x71a5d2=_0x3235fb[_0x4383('0x16')];_0x5d753d<_0x71a5d2,_0xd51dac===![];_0x5d753d+=0x1){if(_0x27e337['indexOf'](_0x3235fb[_0x5d753d])>=0x0){_0xd51dac=!![];}}if(!_0xd51dac){throw new Error(util[_0x4383('0x11')](_0x4383('0x17'),_0x354e6b[_0x4383('0x13')][_0x4383('0x14')]));}process['kill'](_0x354e6b[_0x4383('0x13')][_0x4383('0x14')],_0x4383('0x18'));return _0x4d4129['status'](0xc8)['json']({'message':util[_0x4383('0x11')](_0x4383('0x19'),_0x354e6b[_0x4383('0x13')]['pid'])});})[_0x4383('0xf')](handleError(_0x4d4129,null,_0x4383('0x10')));}; \ No newline at end of file +var _0xf538=['api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','json','killProcess','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','systeminformation','exec'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf538,0xc6));var _0x8f53=function(_0x1fd6cd,_0x67b90f){_0x1fd6cd=_0x1fd6cd-0x0;var _0x1b85a7=_0xf538[_0x1fd6cd];return _0x1b85a7;};'use strict';var info=require(_0x8f53('0x0'));var exec=require('child_process')[_0x8f53('0x1')];var logger=require('../../config/logger')(_0x8f53('0x2'));var util=require(_0x8f53('0x3'));var BPromise=require(_0x8f53('0x4'));var _=require('lodash');function handleError(_0x5af047,_0x793b4e,_0x1634c8){_0x793b4e=_0x793b4e||0x1f4;return function(_0x4ce55f){logger[_0x8f53('0x5')](_0x8f53('0x6'),_0x1634c8,_0x793b4e,util[_0x8f53('0x7')](_0x4ce55f,{'showHidden':![],'depth':null}));delete _0x4ce55f[_0x8f53('0x8')];_0x5af047[_0x8f53('0x9')](_0x793b4e)[_0x8f53('0xa')](_0x4ce55f);};}exports[_0x8f53('0xb')]=function(_0x4c62ca,_0x2bb755){return info[_0x8f53('0xc')]()[_0x8f53('0xd')](function(_0x12415e){return _0x2bb755[_0x8f53('0x9')](0xc8)['json'](_0x12415e);})[_0x8f53('0xe')](function(_0x3ddf37){return _0x2bb755['status'](0x1f4)[_0x8f53('0xf')](_0x3ddf37);});};exports[_0x8f53('0x10')]=function(_0x1a8701,_0x39ce87){var _0xa61944=['components/import/cm'];return new BPromise(function(_0x3e03ce,_0x2dfd5a){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1a8701['params'][_0x8f53('0x11')]),function(_0xbb087b,_0x3798de,_0xf23849){if(_0xbb087b){return _0x2dfd5a(_0xbb087b);}return _0x3e03ce(_0x3798de);});})['then'](function(_0x3d2de5){var _0x4839c8=![];var _0x15aea5=_0x3d2de5[_0x8f53('0x12')](/\n/);for(var _0x43da1c=0x0,_0xda90f0=_0xa61944[_0x8f53('0x13')];_0x43da1c<_0xda90f0,_0x4839c8===![];_0x43da1c+=0x1){if(_0x3d2de5[_0x8f53('0x14')](_0xa61944[_0x43da1c])>=0x0){_0x4839c8=!![];}}if(!_0x4839c8){throw new Error(util[_0x8f53('0x15')](_0x8f53('0x16'),_0x1a8701[_0x8f53('0x17')]['pid']));}process[_0x8f53('0x18')](_0x1a8701['params']['pid'],'SIGINT');return _0x39ce87[_0x8f53('0x9')](0xc8)[_0x8f53('0xf')]({'message':util[_0x8f53('0x15')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1a8701[_0x8f53('0x17')][_0x8f53('0x11')])});})[_0x8f53('0xe')](handleError(_0x39ce87,null,_0x8f53('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a95aaf8..ed9f299 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 _0x1a85=['express','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','show','/:id','update','delete','destroy','exports','path','connect-timeout'];(function(_0x2bbfee,_0x5e0631){var _0xdfa3a=function(_0x2cbeb9){while(--_0x2cbeb9){_0x2bbfee['push'](_0x2bbfee['shift']());}};_0xdfa3a(++_0x5e0631);}(_0x1a85,0x178));var _0x51a8=function(_0x53618a,_0x3ce1c8){_0x53618a=_0x53618a-0x0;var _0x588ddb=_0x1a85[_0x53618a];return _0x588ddb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var controller=require(_0x51a8('0x5'));router['get']('/',auth[_0x51a8('0x6')](),controller['index']);router[_0x51a8('0x7')]('/:id',auth[_0x51a8('0x6')](),controller[_0x51a8('0x8')]);router['post']('/',auth[_0x51a8('0x6')](),controller['create']);router['put'](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')](_0x51a8('0x9'),auth[_0x51a8('0x6')](),controller[_0x51a8('0xc')]);module[_0x51a8('0xd')]=router; \ No newline at end of file +var _0x9ffd=['/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get','index'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4bddb3,_0x484288){_0x4bddb3=_0x4bddb3-0x0;var _0x155bf8=_0x9ffd[_0x4bddb3];return _0x155bf8;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0xd')]('/',auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router[_0xd9ff('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x10')]);module[_0xd9ff('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 21cc011..e11acbe 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 _0x19b4=['#0091EA','sequelize','STRING','name'];(function(_0x4a03f8,_0x530e9e){var _0x3ed26a=function(_0x2cac8d){while(--_0x2cac8d){_0x4a03f8['push'](_0x4a03f8['shift']());}};_0x3ed26a(++_0x530e9e);}(_0x19b4,0x175));var _0x419b=function(_0x26d372,_0x2a1433){_0x26d372=_0x26d372-0x0;var _0x1c2a93=_0x19b4[_0x26d372];return _0x1c2a93;};'use strict';var Sequelize=require(_0x419b('0x0'));module['exports']={'name':{'type':Sequelize[_0x419b('0x1')],'unique':_0x419b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x419b('0x3')},'description':{'type':Sequelize[_0x419b('0x1')]}}; \ No newline at end of file +var _0x6f8b=['name','#0091EA','sequelize','exports','STRING'];(function(_0x94c1c5,_0x405600){var _0x25e40f=function(_0xd02b2f){while(--_0xd02b2f){_0x94c1c5['push'](_0x94c1c5['shift']());}};_0x25e40f(++_0x405600);}(_0x6f8b,0xa7));var _0xb6f8=function(_0x110397,_0x56c16e){_0x110397=_0x110397-0x0;var _0x388d9c=_0x6f8b[_0x110397];return _0x388d9c;};'use strict';var Sequelize=require(_0xb6f8('0x0'));module[_0xb6f8('0x1')]={'name':{'type':Sequelize[_0xb6f8('0x2')],'unique':_0xb6f8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb6f8('0x2')],'defaultValue':_0xb6f8('0x4')},'description':{'type':Sequelize[_0xb6f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 6dbdca7..4eb846b 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 _0xf963=['get','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','Tag','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy'];(function(_0x44c845,_0x4e8b84){var _0x8e6fc2=function(_0x1ab2db){while(--_0x1ab2db){_0x44c845['push'](_0x44c845['shift']());}};_0x8e6fc2(++_0x4e8b84);}(_0xf963,0x11f));var _0x3f96=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf963[_0x50a0c2];return _0x5ebadd;};'use strict';var pdf=require(_0x3f96('0x0'));var emlformat=require(_0x3f96('0x1'));var rimraf=require(_0x3f96('0x2'));var zipdir=require(_0x3f96('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3f96('0x4'));var BPromise=require(_0x3f96('0x5'));var Mustache=require(_0x3f96('0x6'));var util=require('util');var path=require(_0x3f96('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f96('0x8'));var squel=require(_0x3f96('0x9'));var crypto=require(_0x3f96('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3f96('0xb'));var toCsv=require(_0x3f96('0xc'));var querystring=require(_0x3f96('0xd'));var Papa=require('papaparse');var Redis=require(_0x3f96('0xe'));var authService=require(_0x3f96('0xf'));var qs=require(_0x3f96('0x10'));var hardwareService=require(_0x3f96('0x11'));var logger=require(_0x3f96('0x12'))(_0x3f96('0x13'));var utils=require(_0x3f96('0x14'));var config=require(_0x3f96('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6d0835,_0x1da92e){_0x1da92e=_0x1da92e||0xcc;return function(_0x138c61){if(_0x138c61){return _0x6d0835['sendStatus'](_0x1da92e);}return _0x6d0835[_0x3f96('0x16')](_0x1da92e)[_0x3f96('0x17')]();};}function respondWithResult(_0x2b4188,_0x55d9b1){_0x55d9b1=_0x55d9b1||0xc8;return function(_0x3b06af){if(_0x3b06af){return _0x2b4188[_0x3f96('0x16')](_0x55d9b1)[_0x3f96('0x18')](_0x3b06af);}};}function respondWithFilteredResult(_0x72386d,_0x7f8f10){return function(_0x379b21){if(_0x379b21){var _0x5066c2=_0x379b21[_0x3f96('0x19')],_0x333e4a=_0x7f8f10[_0x3f96('0x1a')],_0x1e8554=_0x7f8f10[_0x3f96('0x1a')]+_0x7f8f10['limit'],_0x3178e8;if(_0x1e8554>=_0x5066c2){_0x1e8554=_0x5066c2;_0x3178e8=0xc8;}else{_0x3178e8=0xce;}_0x72386d[_0x3f96('0x16')](_0x3178e8);return _0x72386d['set'](_0x3f96('0x1b'),_0x333e4a+'-'+_0x1e8554+'/'+_0x5066c2)[_0x3f96('0x18')](_0x379b21);}return null;};}function patchUpdates(_0x249ee9){return function(_0x3bb38d){try{jsonpatch['apply'](_0x3bb38d,_0x249ee9,!![]);}catch(_0x59517d){return BPromise[_0x3f96('0x1c')](_0x59517d);}return _0x3bb38d[_0x3f96('0x1d')]();};}function saveUpdates(_0x14ad25,_0x151031){return function(_0x419dc3){if(_0x419dc3){return _0x419dc3[_0x3f96('0x1e')](_0x14ad25)[_0x3f96('0x1f')](function(_0x4a4e2d){return _0x4a4e2d;});}return null;};}function removeEntity(_0x41d231,_0x5a4edf){return function(_0x1c9d64){if(_0x1c9d64){return _0x1c9d64[_0x3f96('0x20')]()[_0x3f96('0x1f')](function(){var _0x7694c8=_0x1c9d64[_0x3f96('0x21')]({'plain':!![]});var _0x476b78=_0x3f96('0x22');return db[_0x3f96('0x23')]['destroy']({'where':{'type':_0x476b78,'resourceId':_0x7694c8['id']}})[_0x3f96('0x1f')](function(){return _0x1c9d64;});})['then'](function(){_0x41d231['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7cac,_0x27cdd9){return function(_0x7e7f26){if(!_0x7e7f26){_0x3d7cac[_0x3f96('0x24')](0x194);}return _0x7e7f26;};}function handleError(_0x3d1978,_0x2e9f12){_0x2e9f12=_0x2e9f12||0x1f4;return function(_0x4e3b3f){logger[_0x3f96('0x25')](_0x4e3b3f[_0x3f96('0x26')]);if(_0x4e3b3f[_0x3f96('0x27')]){delete _0x4e3b3f[_0x3f96('0x27')];}_0x3d1978[_0x3f96('0x16')](_0x2e9f12)[_0x3f96('0x28')](_0x4e3b3f);};}exports[_0x3f96('0x29')]=function(_0xd7468c,_0x31550a){var _0x34bc88={},_0x378794={},_0x2864f9={'count':0x0,'rows':[]};var _0x3639de=db[_0x3f96('0x2a')][_0x3f96('0x2b')];_0x378794[_0x3f96('0x2c')]=_[_0x3f96('0x2d')](_0x3639de);_0x378794[_0x3f96('0x2e')]=_[_0x3f96('0x2d')](_0xd7468c[_0x3f96('0x2e')]);_0x378794[_0x3f96('0x2f')]=_[_0x3f96('0x30')](_0x378794[_0x3f96('0x2c')],_0x378794[_0x3f96('0x2e')]);_0x34bc88[_0x3f96('0x31')]=_[_0x3f96('0x30')](_0x378794['model'],qs['fields'](_0xd7468c[_0x3f96('0x2e')][_0x3f96('0x32')]));_0x34bc88[_0x3f96('0x31')]=_0x34bc88[_0x3f96('0x31')][_0x3f96('0x33')]?_0x34bc88['attributes']:_0x378794['model'];if(!_0xd7468c['query'][_0x3f96('0x34')]('nolimit')){_0x34bc88[_0x3f96('0x35')]=qs[_0x3f96('0x35')](_0xd7468c[_0x3f96('0x2e')]['limit']);_0x34bc88[_0x3f96('0x1a')]=qs[_0x3f96('0x1a')](_0xd7468c[_0x3f96('0x2e')]['offset']);}_0x34bc88[_0x3f96('0x36')]=qs[_0x3f96('0x37')](_0xd7468c[_0x3f96('0x2e')][_0x3f96('0x37')]);_0x34bc88[_0x3f96('0x38')]=qs[_0x3f96('0x2f')](_[_0x3f96('0x39')](_0xd7468c[_0x3f96('0x2e')],_0x378794[_0x3f96('0x2f')]));if(_0xd7468c[_0x3f96('0x2e')][_0x3f96('0x3a')]){_0x34bc88[_0x3f96('0x38')]=_[_0x3f96('0x3b')](_0x34bc88['where'],{'$or':_['map'](_0x3639de,function(_0x332b6a){if(_0x332b6a[_0x3f96('0x3c')][_0x3f96('0x3d')]!==_0x3f96('0x3e')){var _0x1e5a83={};_0x1e5a83[_0x332b6a[_0x3f96('0x3f')]]={'$like':'%'+_0xd7468c[_0x3f96('0x2e')][_0x3f96('0x3a')]+'%'};return _0x1e5a83;}})});}_0x34bc88=_[_0x3f96('0x3b')]({},_0x34bc88,_0xd7468c[_0x3f96('0x40')]);var _0x20be82={'where':_0x34bc88[_0x3f96('0x38')]};return db['Tag'][_0x3f96('0x19')](_0x20be82)[_0x3f96('0x1f')](function(_0x16e33e){_0x2864f9[_0x3f96('0x19')]=_0x16e33e;if(_0xd7468c[_0x3f96('0x2e')][_0x3f96('0x41')]){_0x34bc88[_0x3f96('0x42')]=[{'all':!![]}];}return db['Tag'][_0x3f96('0x43')](_0x34bc88);})[_0x3f96('0x1f')](function(_0x1a19b4){_0x2864f9[_0x3f96('0x44')]=_0x1a19b4;return _0x2864f9;})[_0x3f96('0x1f')](respondWithFilteredResult(_0x31550a,_0x34bc88))['catch'](handleError(_0x31550a,null));};exports['show']=function(_0x1d2814,_0x29c5ab){var _0x5020db={'raw':!![],'where':{'id':_0x1d2814[_0x3f96('0x45')]['id']}},_0x10ac00={};_0x10ac00[_0x3f96('0x2c')]=_[_0x3f96('0x2d')](db['Tag'][_0x3f96('0x2b')]);_0x10ac00[_0x3f96('0x2e')]=_[_0x3f96('0x2d')](_0x1d2814[_0x3f96('0x2e')]);_0x10ac00[_0x3f96('0x2f')]=_[_0x3f96('0x30')](_0x10ac00[_0x3f96('0x2c')],_0x10ac00['query']);_0x5020db[_0x3f96('0x31')]=_['intersection'](_0x10ac00[_0x3f96('0x2c')],qs[_0x3f96('0x32')](_0x1d2814['query'][_0x3f96('0x32')]));_0x5020db['attributes']=_0x5020db[_0x3f96('0x31')][_0x3f96('0x33')]?_0x5020db[_0x3f96('0x31')]:_0x10ac00[_0x3f96('0x2c')];if(_0x1d2814['query'][_0x3f96('0x41')]){_0x5020db[_0x3f96('0x42')]=[{'all':!![]}];}_0x5020db=_[_0x3f96('0x3b')]({},_0x5020db,_0x1d2814['options']);return db[_0x3f96('0x2a')]['find'](_0x5020db)[_0x3f96('0x1f')](handleEntityNotFound(_0x29c5ab,null))[_0x3f96('0x1f')](respondWithResult(_0x29c5ab,null))[_0x3f96('0x46')](handleError(_0x29c5ab,null));};exports[_0x3f96('0x47')]=function(_0x5e96ec,_0x4fb162){return db[_0x3f96('0x2a')][_0x3f96('0x47')](_0x5e96ec[_0x3f96('0x48')],{})[_0x3f96('0x1f')](function(_0x3513fa){var _0x21cfc3=_0x5e96ec[_0x3f96('0x49')][_0x3f96('0x21')]({'plain':!![]});if(!_0x21cfc3)throw new Error(_0x3f96('0x4a'));if(_0x21cfc3[_0x3f96('0x4b')]===_0x3f96('0x49')){var _0x4eab15=_0x3513fa[_0x3f96('0x21')]({'plain':!![]});var _0xb2377c=_0x3f96('0x22');return db['UserProfileSection'][_0x3f96('0x4c')]({'where':{'name':_0xb2377c,'userProfileId':_0x21cfc3[_0x3f96('0x4d')]},'raw':!![]})[_0x3f96('0x1f')](function(_0x25b356){if(_0x25b356&&_0x25b356[_0x3f96('0x4e')]===0x0){return db[_0x3f96('0x23')][_0x3f96('0x47')]({'name':_0x4eab15[_0x3f96('0x27')],'resourceId':_0x4eab15['id'],'type':_0x25b356[_0x3f96('0x27')],'sectionId':_0x25b356['id']},{})[_0x3f96('0x1f')](function(){return _0x3513fa;});}else{return _0x3513fa;}})[_0x3f96('0x46')](function(_0xb4df94){logger[_0x3f96('0x25')](_0x3f96('0x4f'),_0xb4df94);throw _0xb4df94;});}return _0x3513fa;})[_0x3f96('0x1f')](respondWithResult(_0x4fb162,0xc9))[_0x3f96('0x46')](handleError(_0x4fb162,null));};exports[_0x3f96('0x1e')]=function(_0x27f766,_0x6a9d31){if(_0x27f766[_0x3f96('0x48')]['id']){delete _0x27f766[_0x3f96('0x48')]['id'];}return db['Tag'][_0x3f96('0x4c')]({'where':{'id':_0x27f766[_0x3f96('0x45')]['id']}})[_0x3f96('0x1f')](handleEntityNotFound(_0x6a9d31,null))['then'](saveUpdates(_0x27f766[_0x3f96('0x48')],null))[_0x3f96('0x1f')](respondWithResult(_0x6a9d31,null))[_0x3f96('0x46')](handleError(_0x6a9d31,null));};exports['destroy']=function(_0x406fab,_0x4ef5f2){return db[_0x3f96('0x2a')][_0x3f96('0x4c')]({'where':{'id':_0x406fab['params']['id']}})[_0x3f96('0x1f')](handleEntityNotFound(_0x4ef5f2,null))[_0x3f96('0x1f')](removeEntity(_0x4ef5f2,null))[_0x3f96('0x46')](handleError(_0x4ef5f2,null));}; \ No newline at end of file +var _0x8756=['filters','pick','filter','where','merge','map','type','VIRTUAL','field','options','includeAll','include','Tag','findAll','rows','catch','params','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','then','get','Tags','UserProfileResource','destroy','sendStatus','error','name','send','index','rawAttributes','model','keys','query','attributes','intersection','fields','nolimit','order','sort'];(function(_0x410ba1,_0xd00a96){var _0x2a425e=function(_0x190622){while(--_0x190622){_0x410ba1['push'](_0x410ba1['shift']());}};_0x2a425e(++_0xd00a96);}(_0x8756,0xc2));var _0x6875=function(_0x5a8dcb,_0x3d8c69){_0x5a8dcb=_0x5a8dcb-0x0;var _0x4ed049=_0x8756[_0x5a8dcb];return _0x4ed049;};'use strict';var pdf=require(_0x6875('0x0'));var emlformat=require(_0x6875('0x1'));var rimraf=require(_0x6875('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6875('0x3'));var rp=require(_0x6875('0x4'));var moment=require(_0x6875('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6875('0x6'));var util=require(_0x6875('0x7'));var path=require(_0x6875('0x8'));var sox=require(_0x6875('0x9'));var csv=require(_0x6875('0xa'));var ejs=require(_0x6875('0xb'));var fs=require('fs');var _=require(_0x6875('0xc'));var squel=require(_0x6875('0xd'));var crypto=require(_0x6875('0xe'));var jsforce=require(_0x6875('0xf'));var deskjs=require(_0x6875('0x10'));var toCsv=require(_0x6875('0xa'));var querystring=require(_0x6875('0x11'));var Papa=require(_0x6875('0x12'));var Redis=require(_0x6875('0x13'));var authService=require(_0x6875('0x14'));var qs=require(_0x6875('0x15'));var hardwareService=require(_0x6875('0x16'));var logger=require(_0x6875('0x17'))(_0x6875('0x18'));var utils=require(_0x6875('0x19'));var config=require(_0x6875('0x1a'));var db=require(_0x6875('0x1b'))['db'];function respondWithStatusCode(_0x143717,_0x5b6520){_0x5b6520=_0x5b6520||0xcc;return function(_0x3ce663){if(_0x3ce663){return _0x143717['sendStatus'](_0x5b6520);}return _0x143717[_0x6875('0x1c')](_0x5b6520)[_0x6875('0x1d')]();};}function respondWithResult(_0x28e55a,_0x428c65){_0x428c65=_0x428c65||0xc8;return function(_0x4e1792){if(_0x4e1792){return _0x28e55a['status'](_0x428c65)[_0x6875('0x1e')](_0x4e1792);}};}function respondWithFilteredResult(_0x26db6d,_0x46b519){return function(_0x2e8b32){if(_0x2e8b32){var _0x56474d=_0x2e8b32[_0x6875('0x1f')],_0x5473db=_0x46b519[_0x6875('0x20')],_0xade476=_0x46b519[_0x6875('0x20')]+_0x46b519[_0x6875('0x21')],_0xf38915;if(_0xade476>=_0x56474d){_0xade476=_0x56474d;_0xf38915=0xc8;}else{_0xf38915=0xce;}_0x26db6d[_0x6875('0x1c')](_0xf38915);return _0x26db6d[_0x6875('0x22')]('Content-Range',_0x5473db+'-'+_0xade476+'/'+_0x56474d)[_0x6875('0x1e')](_0x2e8b32);}return null;};}function patchUpdates(_0x2b7ba){return function(_0x405c95){try{jsonpatch[_0x6875('0x23')](_0x405c95,_0x2b7ba,!![]);}catch(_0x5d32a5){return BPromise[_0x6875('0x24')](_0x5d32a5);}return _0x405c95['save']();};}function saveUpdates(_0x26fb03,_0x4cf88c){return function(_0x4d298f){if(_0x4d298f){return _0x4d298f[_0x6875('0x25')](_0x26fb03)[_0x6875('0x26')](function(_0x5bb6d0){return _0x5bb6d0;});}return null;};}function removeEntity(_0x404526,_0x264bc5){return function(_0x34a550){if(_0x34a550){return _0x34a550['destroy']()[_0x6875('0x26')](function(){var _0x2c2af1=_0x34a550[_0x6875('0x27')]({'plain':!![]});var _0x3e3699=_0x6875('0x28');return db[_0x6875('0x29')][_0x6875('0x2a')]({'where':{'type':_0x3e3699,'resourceId':_0x2c2af1['id']}})[_0x6875('0x26')](function(){return _0x34a550;});})[_0x6875('0x26')](function(){_0x404526['status'](0xcc)[_0x6875('0x1d')]();});}};}function handleEntityNotFound(_0x49ca2f,_0xed604e){return function(_0x211fab){if(!_0x211fab){_0x49ca2f[_0x6875('0x2b')](0x194);}return _0x211fab;};}function handleError(_0x352024,_0x39c586){_0x39c586=_0x39c586||0x1f4;return function(_0x1c9cbf){logger[_0x6875('0x2c')](_0x1c9cbf['stack']);if(_0x1c9cbf['name']){delete _0x1c9cbf[_0x6875('0x2d')];}_0x352024[_0x6875('0x1c')](_0x39c586)[_0x6875('0x2e')](_0x1c9cbf);};}exports[_0x6875('0x2f')]=function(_0x32dfd6,_0x277ce3){var _0x4dfa14={},_0x37b2c1={},_0x3d41d1={'count':0x0,'rows':[]};var _0x49b7a0=db['Tag'][_0x6875('0x30')];_0x37b2c1[_0x6875('0x31')]=_[_0x6875('0x32')](_0x49b7a0);_0x37b2c1['query']=_[_0x6875('0x32')](_0x32dfd6['query']);_0x37b2c1['filters']=_['intersection'](_0x37b2c1[_0x6875('0x31')],_0x37b2c1[_0x6875('0x33')]);_0x4dfa14[_0x6875('0x34')]=_[_0x6875('0x35')](_0x37b2c1[_0x6875('0x31')],qs[_0x6875('0x36')](_0x32dfd6['query'][_0x6875('0x36')]));_0x4dfa14['attributes']=_0x4dfa14[_0x6875('0x34')]['length']?_0x4dfa14[_0x6875('0x34')]:_0x37b2c1['model'];if(!_0x32dfd6[_0x6875('0x33')]['hasOwnProperty'](_0x6875('0x37'))){_0x4dfa14[_0x6875('0x21')]=qs[_0x6875('0x21')](_0x32dfd6[_0x6875('0x33')][_0x6875('0x21')]);_0x4dfa14[_0x6875('0x20')]=qs[_0x6875('0x20')](_0x32dfd6[_0x6875('0x33')]['offset']);}_0x4dfa14[_0x6875('0x38')]=qs[_0x6875('0x39')](_0x32dfd6[_0x6875('0x33')][_0x6875('0x39')]);_0x4dfa14['where']=qs[_0x6875('0x3a')](_[_0x6875('0x3b')](_0x32dfd6['query'],_0x37b2c1[_0x6875('0x3a')]));if(_0x32dfd6[_0x6875('0x33')][_0x6875('0x3c')]){_0x4dfa14[_0x6875('0x3d')]=_[_0x6875('0x3e')](_0x4dfa14[_0x6875('0x3d')],{'$or':_[_0x6875('0x3f')](_0x49b7a0,function(_0x1eac59){if(_0x1eac59[_0x6875('0x40')]['key']!==_0x6875('0x41')){var _0x5775ea={};_0x5775ea[_0x1eac59[_0x6875('0x42')]]={'$like':'%'+_0x32dfd6[_0x6875('0x33')]['filter']+'%'};return _0x5775ea;}})});}_0x4dfa14=_[_0x6875('0x3e')]({},_0x4dfa14,_0x32dfd6[_0x6875('0x43')]);var _0x55d750={'where':_0x4dfa14[_0x6875('0x3d')]};return db['Tag']['count'](_0x55d750)[_0x6875('0x26')](function(_0x32cff0){_0x3d41d1[_0x6875('0x1f')]=_0x32cff0;if(_0x32dfd6[_0x6875('0x33')][_0x6875('0x44')]){_0x4dfa14[_0x6875('0x45')]=[{'all':!![]}];}return db[_0x6875('0x46')][_0x6875('0x47')](_0x4dfa14);})['then'](function(_0x2b02dd){_0x3d41d1[_0x6875('0x48')]=_0x2b02dd;return _0x3d41d1;})[_0x6875('0x26')](respondWithFilteredResult(_0x277ce3,_0x4dfa14))[_0x6875('0x49')](handleError(_0x277ce3,null));};exports['show']=function(_0x4ce06d,_0x562d91){var _0x576c32={'raw':!![],'where':{'id':_0x4ce06d[_0x6875('0x4a')]['id']}},_0x531e93={};_0x531e93[_0x6875('0x31')]=_[_0x6875('0x32')](db[_0x6875('0x46')][_0x6875('0x30')]);_0x531e93[_0x6875('0x33')]=_['keys'](_0x4ce06d[_0x6875('0x33')]);_0x531e93[_0x6875('0x3a')]=_[_0x6875('0x35')](_0x531e93['model'],_0x531e93[_0x6875('0x33')]);_0x576c32[_0x6875('0x34')]=_[_0x6875('0x35')](_0x531e93[_0x6875('0x31')],qs['fields'](_0x4ce06d['query'][_0x6875('0x36')]));_0x576c32[_0x6875('0x34')]=_0x576c32[_0x6875('0x34')][_0x6875('0x4b')]?_0x576c32[_0x6875('0x34')]:_0x531e93[_0x6875('0x31')];if(_0x4ce06d[_0x6875('0x33')][_0x6875('0x44')]){_0x576c32[_0x6875('0x45')]=[{'all':!![]}];}_0x576c32=_[_0x6875('0x3e')]({},_0x576c32,_0x4ce06d[_0x6875('0x43')]);return db['Tag'][_0x6875('0x4c')](_0x576c32)[_0x6875('0x26')](handleEntityNotFound(_0x562d91,null))[_0x6875('0x26')](respondWithResult(_0x562d91,null))[_0x6875('0x49')](handleError(_0x562d91,null));};exports[_0x6875('0x4d')]=function(_0x1b522c,_0x4a5de3){return db['Tag'][_0x6875('0x4d')](_0x1b522c['body'],{})[_0x6875('0x26')](function(_0x3acbc8){var _0x30d340=_0x1b522c[_0x6875('0x4e')][_0x6875('0x27')]({'plain':!![]});if(!_0x30d340)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30d340[_0x6875('0x4f')]===_0x6875('0x4e')){var _0x29c147=_0x3acbc8[_0x6875('0x27')]({'plain':!![]});var _0x303542=_0x6875('0x28');return db[_0x6875('0x50')][_0x6875('0x4c')]({'where':{'name':_0x303542,'userProfileId':_0x30d340[_0x6875('0x51')]},'raw':!![]})[_0x6875('0x26')](function(_0x21566c){if(_0x21566c&&_0x21566c[_0x6875('0x52')]===0x0){return db['UserProfileResource'][_0x6875('0x4d')]({'name':_0x29c147[_0x6875('0x2d')],'resourceId':_0x29c147['id'],'type':_0x21566c['name'],'sectionId':_0x21566c['id']},{})[_0x6875('0x26')](function(){return _0x3acbc8;});}else{return _0x3acbc8;}})[_0x6875('0x49')](function(_0x15665e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15665e);throw _0x15665e;});}return _0x3acbc8;})[_0x6875('0x26')](respondWithResult(_0x4a5de3,0xc9))['catch'](handleError(_0x4a5de3,null));};exports[_0x6875('0x25')]=function(_0x6113bf,_0x422b3e){if(_0x6113bf['body']['id']){delete _0x6113bf[_0x6875('0x53')]['id'];}return db[_0x6875('0x46')][_0x6875('0x4c')]({'where':{'id':_0x6113bf[_0x6875('0x4a')]['id']}})[_0x6875('0x26')](handleEntityNotFound(_0x422b3e,null))[_0x6875('0x26')](saveUpdates(_0x6113bf[_0x6875('0x53')],null))['then'](respondWithResult(_0x422b3e,null))[_0x6875('0x49')](handleError(_0x422b3e,null));};exports[_0x6875('0x2a')]=function(_0x918325,_0x2121a4){return db[_0x6875('0x46')]['find']({'where':{'id':_0x918325[_0x6875('0x4a')]['id']}})[_0x6875('0x26')](handleEntityNotFound(_0x2121a4,null))['then'](removeEntity(_0x2121a4,null))[_0x6875('0x49')](handleError(_0x2121a4,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8cbadc9..19d54cb 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 _0x27f4=['lodash','../../config/logger','moment','request-promise','path','../../config/environment','./tag.attributes','exports','define','tools_tags'];(function(_0x57f633,_0x5e4ad4){var _0x52efa4=function(_0x70495b){while(--_0x70495b){_0x57f633['push'](_0x57f633['shift']());}};_0x52efa4(++_0x5e4ad4);}(_0x27f4,0x1b8));var _0x427f=function(_0x135d2a,_0x546cd1){_0x135d2a=_0x135d2a-0x0;var _0xae488=_0x27f4[_0x135d2a];return _0xae488;};'use strict';var _=require(_0x427f('0x0'));var util=require('util');var logger=require(_0x427f('0x1'))('api');var moment=require(_0x427f('0x2'));var BPromise=require('bluebird');var rp=require(_0x427f('0x3'));var fs=require('fs');var path=require(_0x427f('0x4'));var rimraf=require('rimraf');var config=require(_0x427f('0x5'));var attributes=require(_0x427f('0x6'));module[_0x427f('0x7')]=function(_0x418b8e,_0x3193b8){return _0x418b8e[_0x427f('0x8')]('Tag',attributes,{'tableName':_0x427f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4074=['tools_tags','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Tag'];(function(_0x26da12,_0xbe7135){var _0x8d1bb1=function(_0x203b89){while(--_0x203b89){_0x26da12['push'](_0x26da12['shift']());}};_0x8d1bb1(++_0xbe7135);}(_0x4074,0x1a5));var _0x4407=function(_0x25828d,_0xdda70e){_0x25828d=_0x25828d-0x0;var _0x2288ff=_0x4074[_0x25828d];return _0x2288ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4407('0x0'))(_0x4407('0x1'));var moment=require(_0x4407('0x2'));var BPromise=require('bluebird');var rp=require(_0x4407('0x3'));var fs=require('fs');var path=require(_0x4407('0x4'));var rimraf=require(_0x4407('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x4407('0x6')]=function(_0x542ee3,_0x3b8331){return _0x542ee3[_0x4407('0x7')](_0x4407('0x8'),attributes,{'tableName':_0x4407('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index fe136c8..9b73a0c 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 _0x6de6=['error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x307430,_0x327d0c){var _0x1d3033=function(_0x5065b1){while(--_0x5065b1){_0x307430['push'](_0x307430['shift']());}};_0x1d3033(++_0x327d0c);}(_0x6de6,0x1d2));var _0x66de=function(_0x183a19,_0x36dace){_0x183a19=_0x183a19-0x0;var _0x5e2ba3=_0x6de6[_0x183a19];return _0x5e2ba3;};'use strict';var _=require(_0x66de('0x0'));var util=require(_0x66de('0x1'));var moment=require(_0x66de('0x2'));var BPromise=require(_0x66de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66de('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x66de('0x5'));var jayson=require(_0x66de('0x6'));var client=jayson[_0x66de('0x7')][_0x66de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57ad9d,_0x535f04,_0x341c59){return new BPromise(function(_0x244e6e,_0xdfa192){return client['request'](_0x57ad9d,_0x341c59)[_0x66de('0x9')](function(_0x10ce67){logger[_0x66de('0xa')]('Tag,\x20%s,\x20%s',_0x535f04,_0x66de('0xb'));logger['debug'](_0x66de('0xc'),_0x535f04,'request\x20sent',JSON[_0x66de('0xd')](_0x10ce67));if(_0x10ce67['error']){if(_0x10ce67[_0x66de('0xe')][_0x66de('0xf')]===0x1f4){logger[_0x66de('0xe')](_0x66de('0x10'),_0x535f04,_0x10ce67[_0x66de('0xe')][_0x66de('0x11')]);return _0xdfa192(_0x10ce67[_0x66de('0xe')][_0x66de('0x11')]);}logger[_0x66de('0xe')](_0x66de('0x10'),_0x535f04,_0x10ce67[_0x66de('0xe')]['message']);return _0x244e6e(_0x10ce67['error'][_0x66de('0x11')]);}else{logger[_0x66de('0xa')](_0x66de('0x10'),_0x535f04,_0x66de('0xb'));_0x244e6e(_0x10ce67[_0x66de('0x12')][_0x66de('0x11')]);}})[_0x66de('0x13')](function(_0x3a4585){logger[_0x66de('0xe')](_0x66de('0x10'),_0x535f04,_0x3a4585);_0xdfa192(_0x3a4585);});});} \ No newline at end of file +var _0x9ec6=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Tag,\x20%s,\x20%s,\x20%s','error','message','Tag,\x20%s,\x20%s','request\x20sent','result','catch','bluebird','randomstring'];(function(_0x3a7941,_0x55edac){var _0x1aa996=function(_0x3a3d50){while(--_0x3a3d50){_0x3a7941['push'](_0x3a7941['shift']());}};_0x1aa996(++_0x55edac);}(_0x9ec6,0x1c0));var _0x69ec=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x9ec6[_0x3a6efd];return _0x487b9a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x69ec('0x0'));var rs=require(_0x69ec('0x1'));var fs=require('fs');var Redis=require(_0x69ec('0x2'));var db=require(_0x69ec('0x3'))['db'];var utils=require(_0x69ec('0x4'));var logger=require('../../config/logger')(_0x69ec('0x5'));var config=require(_0x69ec('0x6'));var jayson=require(_0x69ec('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44a4fa,_0x573da6,_0xcd71fe){return new BPromise(function(_0x4e9b7b,_0x5cdba9){return client[_0x69ec('0x8')](_0x44a4fa,_0xcd71fe)[_0x69ec('0x9')](function(_0x34238a){logger[_0x69ec('0xa')]('Tag,\x20%s,\x20%s',_0x573da6,'request\x20sent');logger['debug'](_0x69ec('0xb'),_0x573da6,'request\x20sent',JSON['stringify'](_0x34238a));if(_0x34238a[_0x69ec('0xc')]){if(_0x34238a[_0x69ec('0xc')]['code']===0x1f4){logger[_0x69ec('0xc')]('Tag,\x20%s,\x20%s',_0x573da6,_0x34238a['error'][_0x69ec('0xd')]);return _0x5cdba9(_0x34238a[_0x69ec('0xc')][_0x69ec('0xd')]);}logger[_0x69ec('0xc')]('Tag,\x20%s,\x20%s',_0x573da6,_0x34238a[_0x69ec('0xc')][_0x69ec('0xd')]);return _0x4e9b7b(_0x34238a[_0x69ec('0xc')][_0x69ec('0xd')]);}else{logger[_0x69ec('0xa')](_0x69ec('0xe'),_0x573da6,_0x69ec('0xf'));_0x4e9b7b(_0x34238a[_0x69ec('0x10')][_0x69ec('0xd')]);}})[_0x69ec('0x11')](function(_0x250124){logger[_0x69ec('0xc')](_0x69ec('0xe'),_0x573da6,_0x250124);_0x5cdba9(_0x250124);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 989d13a..8df3e35 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 _0xfb47=['create','addQueues','/:id/users','addAgents','update','destroy','delete','removeQueues','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./team.controller','index','/:id','isAuthenticated','show','get','/:id/queues','getQueues','getAgents','post'];(function(_0x3b0b34,_0xe6a14f){var _0x5f5496=function(_0x24fda6){while(--_0x24fda6){_0x3b0b34['push'](_0x3b0b34['shift']());}};_0x5f5496(++_0xe6a14f);}(_0xfb47,0x15c));var _0x7fb4=function(_0x67a7a,_0x380215){_0x67a7a=_0x67a7a-0x0;var _0x2c8b40=_0xfb47[_0x67a7a];return _0x2c8b40;};'use strict';var multer=require('multer');var util=require(_0x7fb4('0x0'));var path=require(_0x7fb4('0x1'));var timeout=require(_0x7fb4('0x2'));var express=require(_0x7fb4('0x3'));var router=express['Router']();var auth=require(_0x7fb4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7fb4('0x5'));var controller=require(_0x7fb4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7fb4('0x7')]);router['get'](_0x7fb4('0x8'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0xa')]);router[_0x7fb4('0xb')](_0x7fb4('0xc'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0xd')]);router[_0x7fb4('0xb')]('/:id/users',auth[_0x7fb4('0x9')](),controller[_0x7fb4('0xe')]);router[_0x7fb4('0xf')]('/',auth[_0x7fb4('0x9')](),controller[_0x7fb4('0x10')]);router[_0x7fb4('0xf')](_0x7fb4('0xc'),auth['isAuthenticated'](),controller[_0x7fb4('0x11')]);router[_0x7fb4('0xf')](_0x7fb4('0x12'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0x13')]);router['put'](_0x7fb4('0x8'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0x14')]);router['delete'](_0x7fb4('0x8'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0x15')]);router[_0x7fb4('0x16')](_0x7fb4('0xc'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0x17')]);router[_0x7fb4('0x16')](_0x7fb4('0x12'),auth[_0x7fb4('0x9')](),controller[_0x7fb4('0x18')]);module[_0x7fb4('0x19')]=router; \ No newline at end of file +var _0x2c65=['addQueues','addAgents','put','/:id','destroy','delete','removeAgents','multer','util','path','Router','../../components/interaction/service','../../config/environment','./team.controller','get','index','show','/:id/queues','isAuthenticated','/:id/users','getAgents','post'];(function(_0x58af6f,_0x58eb00){var _0x1ff163=function(_0x26190e){while(--_0x26190e){_0x58af6f['push'](_0x58af6f['shift']());}};_0x1ff163(++_0x58eb00);}(_0x2c65,0x1a9));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x52c6('0x0'));var util=require(_0x52c6('0x1'));var path=require(_0x52c6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52c6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x52c6('0x4'));var config=require(_0x52c6('0x5'));var controller=require(_0x52c6('0x6'));router[_0x52c6('0x7')]('/',auth['isAuthenticated'](),controller[_0x52c6('0x8')]);router[_0x52c6('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x52c6('0x9')]);router[_0x52c6('0x7')](_0x52c6('0xa'),auth[_0x52c6('0xb')](),controller['getQueues']);router[_0x52c6('0x7')](_0x52c6('0xc'),auth[_0x52c6('0xb')](),controller[_0x52c6('0xd')]);router[_0x52c6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x52c6('0xe')]('/:id/queues',auth[_0x52c6('0xb')](),controller[_0x52c6('0xf')]);router[_0x52c6('0xe')](_0x52c6('0xc'),auth['isAuthenticated'](),controller[_0x52c6('0x10')]);router[_0x52c6('0x11')](_0x52c6('0x12'),auth[_0x52c6('0xb')](),controller['update']);router['delete']('/:id',auth[_0x52c6('0xb')](),controller[_0x52c6('0x13')]);router[_0x52c6('0x14')](_0x52c6('0xa'),auth[_0x52c6('0xb')](),controller['removeQueues']);router[_0x52c6('0x14')](_0x52c6('0xc'),auth['isAuthenticated'](),controller[_0x52c6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 50d178e..53ce426 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 _0xd9c2=['sequelize','STRING','name'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0xd9c2,0x12c));var _0x2d9c=function(_0xd2811e,_0x168a67){_0xd2811e=_0xd2811e-0x0;var _0x9a2a53=_0xd9c2[_0xd2811e];return _0x9a2a53;};'use strict';var Sequelize=require(_0x2d9c('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d9c('0x1')],'allowNull':![],'unique':_0x2d9c('0x2')},'description':{'type':Sequelize[_0x2d9c('0x1')]}}; \ No newline at end of file +var _0xf009=['name','sequelize','exports','STRING'];(function(_0x3e152b,_0x1979db){var _0x9b78ab=function(_0x2d7d08){while(--_0x2d7d08){_0x3e152b['push'](_0x3e152b['shift']());}};_0x9b78ab(++_0x1979db);}(_0xf009,0xed));var _0x9f00=function(_0xb96f50,_0xa21d9b){_0xb96f50=_0xb96f50-0x0;var _0x1caf5d=_0xf009[_0xb96f50];return _0x1caf5d;};'use strict';var Sequelize=require(_0x9f00('0x0'));module[_0x9f00('0x1')]={'name':{'type':Sequelize[_0x9f00('0x2')],'allowNull':![],'unique':_0x9f00('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 47139db..d0ab86c 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 _0x75b7=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Teams','UserProfileResource','then','sendStatus','error','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','Team','rows','catch','show','params','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','isValidChannel','add','ids','addAgents','Voice','Mail','Sms','Fax','Openchannel','each','findAll','online','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause','omit','spread','emit','removeAgents','voice','chat','mail','sms','fax','openchannel','userTeam:remove','getAgents','User','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse'];(function(_0x1aa049,_0x9ae13c){var _0x357f29=function(_0xfd2f83){while(--_0xfd2f83){_0x1aa049['push'](_0x1aa049['shift']());}};_0x357f29(++_0x9ae13c);}(_0x75b7,0x71));var _0x775b=function(_0x3331ef,_0x3fe438){_0x3331ef=_0x3331ef-0x0;var _0x5c4138=_0x75b7[_0x3331ef];return _0x5c4138;};'use strict';var pdf=require(_0x775b('0x0'));var emlformat=require(_0x775b('0x1'));var rimraf=require(_0x775b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x775b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x775b('0x4'));var util=require(_0x775b('0x5'));var path=require(_0x775b('0x6'));var sox=require('sox');var csv=require(_0x775b('0x7'));var ejs=require(_0x775b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x775b('0x9'));var jsforce=require(_0x775b('0xa'));var deskjs=require(_0x775b('0xb'));var toCsv=require(_0x775b('0x7'));var querystring=require('querystring');var Papa=require(_0x775b('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x775b('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x775b('0xe'))(_0x775b('0xf'));var utils=require(_0x775b('0x10'));var config=require(_0x775b('0x11'));var db=require(_0x775b('0x12'))['db'];config[_0x775b('0x13')]=_['defaults'](config[_0x775b('0x13')],{'host':_0x775b('0x14'),'port':0x18eb});var socket=require(_0x775b('0x15'))(new Redis(config[_0x775b('0x13')]));require(_0x775b('0x16'))[_0x775b('0x17')](socket);function respondWithStatusCode(_0x17b75c,_0x4eff02){_0x4eff02=_0x4eff02||0xcc;return function(_0x16d852){if(_0x16d852){return _0x17b75c['sendStatus'](_0x4eff02);}return _0x17b75c[_0x775b('0x18')](_0x4eff02)[_0x775b('0x19')]();};}function respondWithResult(_0x2f4d10,_0xe1ad39){_0xe1ad39=_0xe1ad39||0xc8;return function(_0xac9223){if(_0xac9223){return _0x2f4d10[_0x775b('0x18')](_0xe1ad39)[_0x775b('0x1a')](_0xac9223);}};}function respondWithFilteredResult(_0x12dd53,_0x1f7f67){return function(_0x29ed7e){if(_0x29ed7e){var _0x211f98=_0x29ed7e[_0x775b('0x1b')],_0xb31cf4=_0x1f7f67[_0x775b('0x1c')],_0x1abab2=_0x1f7f67[_0x775b('0x1c')]+_0x1f7f67[_0x775b('0x1d')],_0x24dd1d;if(_0x1abab2>=_0x211f98){_0x1abab2=_0x211f98;_0x24dd1d=0xc8;}else{_0x24dd1d=0xce;}_0x12dd53['status'](_0x24dd1d);return _0x12dd53[_0x775b('0x1e')](_0x775b('0x1f'),_0xb31cf4+'-'+_0x1abab2+'/'+_0x211f98)[_0x775b('0x1a')](_0x29ed7e);}return null;};}function patchUpdates(_0x57287f){return function(_0x46c0ba){try{jsonpatch[_0x775b('0x20')](_0x46c0ba,_0x57287f,!![]);}catch(_0x6658c3){return BPromise[_0x775b('0x21')](_0x6658c3);}return _0x46c0ba[_0x775b('0x22')]();};}function saveUpdates(_0x59956c,_0x75eb19){return function(_0x2ae998){if(_0x2ae998){return _0x2ae998[_0x775b('0x23')](_0x59956c)['then'](function(_0x385de3){return _0x385de3;});}return null;};}function removeEntity(_0x11b471,_0x451ba1){return function(_0x5b77fc){if(_0x5b77fc){return _0x5b77fc[_0x775b('0x24')]()['then'](function(){var _0x4e5424=_0x5b77fc[_0x775b('0x25')]({'plain':!![]});var _0x4a7476=_0x775b('0x26');return db[_0x775b('0x27')][_0x775b('0x24')]({'where':{'type':_0x4a7476,'resourceId':_0x4e5424['id']}})[_0x775b('0x28')](function(){return _0x5b77fc;});})[_0x775b('0x28')](function(){_0x11b471['status'](0xcc)[_0x775b('0x19')]();});}};}function handleEntityNotFound(_0x42ea62,_0x8b708f){return function(_0x454e50){if(!_0x454e50){_0x42ea62[_0x775b('0x29')](0x194);}return _0x454e50;};}function handleError(_0xe8e8a4,_0x594633){_0x594633=_0x594633||0x1f4;return function(_0x420b6f){logger[_0x775b('0x2a')](_0x420b6f['stack']);if(_0x420b6f[_0x775b('0x2b')]){delete _0x420b6f[_0x775b('0x2b')];}_0xe8e8a4[_0x775b('0x18')](_0x594633)[_0x775b('0x2c')](_0x420b6f);};}exports['index']=function(_0x18f26b,_0x26a0b5){var _0x2c2ab5={},_0x245b71={},_0x5e1dc3={'count':0x0,'rows':[]};var _0xe6fa9d=db['Team'][_0x775b('0x2d')];_0x245b71[_0x775b('0x2e')]=_[_0x775b('0x2f')](_0xe6fa9d);_0x245b71[_0x775b('0x30')]=_[_0x775b('0x2f')](_0x18f26b[_0x775b('0x30')]);_0x245b71[_0x775b('0x31')]=_[_0x775b('0x32')](_0x245b71[_0x775b('0x2e')],_0x245b71[_0x775b('0x30')]);_0x2c2ab5[_0x775b('0x33')]=_[_0x775b('0x32')](_0x245b71[_0x775b('0x2e')],qs[_0x775b('0x34')](_0x18f26b['query'][_0x775b('0x34')]));_0x2c2ab5[_0x775b('0x33')]=_0x2c2ab5[_0x775b('0x33')][_0x775b('0x35')]?_0x2c2ab5[_0x775b('0x33')]:_0x245b71[_0x775b('0x2e')];if(!_0x18f26b['query']['hasOwnProperty'](_0x775b('0x36'))){_0x2c2ab5[_0x775b('0x1d')]=qs[_0x775b('0x1d')](_0x18f26b['query'][_0x775b('0x1d')]);_0x2c2ab5['offset']=qs[_0x775b('0x1c')](_0x18f26b['query'][_0x775b('0x1c')]);}_0x2c2ab5[_0x775b('0x37')]=qs['sort'](_0x18f26b[_0x775b('0x30')][_0x775b('0x38')]);_0x2c2ab5[_0x775b('0x39')]=qs['filters'](_[_0x775b('0x3a')](_0x18f26b[_0x775b('0x30')],_0x245b71[_0x775b('0x31')]));if(_0x18f26b[_0x775b('0x30')][_0x775b('0x3b')]){_0x2c2ab5[_0x775b('0x39')]=_[_0x775b('0x3c')](_0x2c2ab5[_0x775b('0x39')],{'$or':_[_0x775b('0x3d')](_0xe6fa9d,function(_0x183107){if(_0x183107[_0x775b('0x3e')][_0x775b('0x3f')]!==_0x775b('0x40')){var _0x1dc6a7={};_0x1dc6a7[_0x183107[_0x775b('0x41')]]={'$like':'%'+_0x18f26b[_0x775b('0x30')][_0x775b('0x3b')]+'%'};return _0x1dc6a7;}})});}_0x2c2ab5=_[_0x775b('0x3c')]({},_0x2c2ab5,_0x18f26b['options']);var _0x2a7dde={'where':_0x2c2ab5['where']};return db['Team']['count'](_0x2a7dde)[_0x775b('0x28')](function(_0x32a7f8){_0x5e1dc3['count']=_0x32a7f8;if(_0x18f26b[_0x775b('0x30')][_0x775b('0x42')]){_0x2c2ab5['include']=[{'all':!![]}];}return db[_0x775b('0x43')]['findAll'](_0x2c2ab5);})['then'](function(_0x4957cc){_0x5e1dc3[_0x775b('0x44')]=_0x4957cc;return _0x5e1dc3;})[_0x775b('0x28')](respondWithFilteredResult(_0x26a0b5,_0x2c2ab5))[_0x775b('0x45')](handleError(_0x26a0b5,null));};exports[_0x775b('0x46')]=function(_0x8a7af9,_0x16d6f1){var _0x2e4b0e={'raw':![],'where':{'id':_0x8a7af9[_0x775b('0x47')]['id']}},_0x11f2a1={};_0x11f2a1[_0x775b('0x2e')]=_[_0x775b('0x2f')](db[_0x775b('0x43')]['rawAttributes']);_0x11f2a1['query']=_[_0x775b('0x2f')](_0x8a7af9['query']);_0x11f2a1[_0x775b('0x31')]=_['intersection'](_0x11f2a1['model'],_0x11f2a1['query']);_0x2e4b0e['attributes']=_[_0x775b('0x32')](_0x11f2a1[_0x775b('0x2e')],qs[_0x775b('0x34')](_0x8a7af9[_0x775b('0x30')][_0x775b('0x34')]));_0x2e4b0e[_0x775b('0x33')]=_0x2e4b0e[_0x775b('0x33')]['length']?_0x2e4b0e[_0x775b('0x33')]:_0x11f2a1['model'];if(_0x8a7af9[_0x775b('0x30')][_0x775b('0x42')]){_0x2e4b0e[_0x775b('0x48')]=[{'all':!![]}];}_0x2e4b0e=_[_0x775b('0x3c')]({},_0x2e4b0e,_0x8a7af9[_0x775b('0x49')]);return db[_0x775b('0x43')][_0x775b('0x4a')](_0x2e4b0e)['then'](handleEntityNotFound(_0x16d6f1,null))[_0x775b('0x28')](respondWithResult(_0x16d6f1,null))[_0x775b('0x45')](handleError(_0x16d6f1,null));};exports[_0x775b('0x4b')]=function(_0x5f047f,_0x506f6b){return db['Team'][_0x775b('0x4b')](_0x5f047f['body'],{})[_0x775b('0x28')](function(_0x1dd7f0){var _0x50a469=_0x5f047f['user']['get']({'plain':!![]});if(!_0x50a469)throw new Error(_0x775b('0x4c'));if(_0x50a469[_0x775b('0x4d')]===_0x775b('0x4e')){var _0x17e00f=_0x1dd7f0[_0x775b('0x25')]({'plain':!![]});var _0x38156b='Teams';return db[_0x775b('0x4f')][_0x775b('0x4a')]({'where':{'name':_0x38156b,'userProfileId':_0x50a469[_0x775b('0x50')]},'raw':!![]})['then'](function(_0x37be8f){if(_0x37be8f&&_0x37be8f[_0x775b('0x51')]===0x0){return db[_0x775b('0x27')][_0x775b('0x4b')]({'name':_0x17e00f['name'],'resourceId':_0x17e00f['id'],'type':_0x37be8f[_0x775b('0x2b')],'sectionId':_0x37be8f['id']},{})[_0x775b('0x28')](function(){return _0x1dd7f0;});}else{return _0x1dd7f0;}})[_0x775b('0x45')](function(_0x58874d){logger[_0x775b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58874d);throw _0x58874d;});}return _0x1dd7f0;})[_0x775b('0x28')](respondWithResult(_0x506f6b,0xc9))[_0x775b('0x45')](handleError(_0x506f6b,null));};exports[_0x775b('0x23')]=function(_0x5eec8d,_0x2b3e40){if(_0x5eec8d[_0x775b('0x52')]['id']){delete _0x5eec8d['body']['id'];}return db[_0x775b('0x43')][_0x775b('0x4a')]({'where':{'id':_0x5eec8d['params']['id']}})[_0x775b('0x28')](handleEntityNotFound(_0x2b3e40,null))[_0x775b('0x28')](saveUpdates(_0x5eec8d[_0x775b('0x52')],null))[_0x775b('0x28')](respondWithResult(_0x2b3e40,null))[_0x775b('0x45')](handleError(_0x2b3e40,null));};exports['destroy']=function(_0x15c98a,_0x4025c7){return db[_0x775b('0x43')][_0x775b('0x4a')]({'where':{'id':_0x15c98a[_0x775b('0x47')]['id']}})[_0x775b('0x28')](handleEntityNotFound(_0x4025c7,null))[_0x775b('0x28')](removeEntity(_0x4025c7,null))[_0x775b('0x45')](handleError(_0x4025c7,null));};exports['getQueues']=function(_0x3c2da0,_0x574a4d,_0x25f53c){return db[_0x775b('0x43')][_0x775b('0x53')]({'where':{'id':_0x3c2da0[_0x775b('0x47')]['id']}})['then'](handleEntityNotFound(_0x574a4d,null))[_0x775b('0x28')](function(_0x186140){if(!_0x3c2da0[_0x775b('0x30')]['channel']||!utils['isValidChannel'](_0x3c2da0[_0x775b('0x30')][_0x775b('0x54')])){throw new db[(_0x775b('0x55'))][(_0x775b('0x56'))](_0x775b('0x57'));}var _0x849cd8={};var _0x36a94a={};_0x36a94a['model']=_[_0x775b('0x2f')](db[_[_0x775b('0x58')](_0x3c2da0['query'][_0x775b('0x54')]['toLowerCase']())+_0x775b('0x59')]['rawAttributes']);_0x36a94a['query']=_['keys'](_0x3c2da0[_0x775b('0x30')]);_0x36a94a[_0x775b('0x31')]=_[_0x775b('0x32')](_0x36a94a['model'],_0x36a94a[_0x775b('0x30')]);_0x849cd8[_0x775b('0x33')]=_['intersection'](_0x36a94a[_0x775b('0x2e')],qs[_0x775b('0x34')](_0x3c2da0[_0x775b('0x30')]['fields']));_0x849cd8['attributes']=_0x849cd8[_0x775b('0x33')][_0x775b('0x35')]?_0x849cd8['attributes']:_0x36a94a[_0x775b('0x2e')];_0x849cd8['limit']=qs['limit'](_0x3c2da0[_0x775b('0x30')][_0x775b('0x1d')]);_0x849cd8[_0x775b('0x1c')]=qs['offset'](_0x3c2da0['query'][_0x775b('0x1c')]);_0x849cd8[_0x775b('0x37')]=qs[_0x775b('0x38')](_0x3c2da0[_0x775b('0x30')][_0x775b('0x38')]);_0x849cd8['where']=qs[_0x775b('0x31')](_[_0x775b('0x3a')](_0x3c2da0['query'],_0x36a94a[_0x775b('0x31')]));_0x849cd8=_[_0x775b('0x3c')]({},_0x849cd8,_0x3c2da0[_0x775b('0x49')]);return _0x186140['get'+_[_0x775b('0x58')](_0x3c2da0[_0x775b('0x30')]['channel'][_0x775b('0x5a')]())+_0x775b('0x5b')](_0x849cd8);})[_0x775b('0x28')](respondWithResult(_0x574a4d,null))['catch'](handleError(_0x574a4d,null));};exports[_0x775b('0x5c')]=function(_0xd585a,_0x74b69a,_0x15a0f7){return db[_0x775b('0x43')]['findOne']({'where':{'id':_0xd585a[_0x775b('0x47')]['id']}})[_0x775b('0x28')](function(_0x50cd29){if(_0x50cd29){if(!_0xd585a[_0x775b('0x52')]['channel']||!utils[_0x775b('0x5d')](_0xd585a[_0x775b('0x52')][_0x775b('0x54')])){throw new db[(_0x775b('0x55'))][(_0x775b('0x56'))](_0x775b('0x57'));}return _0x50cd29[_0x775b('0x5e')+_[_0x775b('0x58')](_0xd585a[_0x775b('0x52')][_0x775b('0x54')]['toLowerCase']())+'Queues'](_0xd585a['body'][_0x775b('0x5f')]);}return null;})[_0x775b('0x28')](handleEntityNotFound(_0x74b69a,null))[_0x775b('0x28')](respondWithStatusCode(_0x74b69a,null))[_0x775b('0x45')](handleError(_0x74b69a,null));};exports['removeQueues']=function(_0x55942f,_0x30eb12,_0x40a432){return db[_0x775b('0x43')][_0x775b('0x53')]({'where':{'id':_0x55942f[_0x775b('0x47')]['id']}})[_0x775b('0x28')](function(_0x52689e){if(_0x52689e){if(!_0x55942f[_0x775b('0x30')]['channel']||!utils[_0x775b('0x5d')](_0x55942f['query']['channel'])){throw new db[(_0x775b('0x55'))]['ValidationError'](_0x775b('0x57'));}return _0x52689e['remove'+_[_0x775b('0x58')](_0x55942f[_0x775b('0x30')]['channel'][_0x775b('0x5a')]())+_0x775b('0x5b')](_0x55942f['query'][_0x775b('0x5f')]);}return null;})[_0x775b('0x28')](handleEntityNotFound(_0x30eb12,null))[_0x775b('0x28')](respondWithStatusCode(_0x30eb12,null))[_0x775b('0x45')](handleError(_0x30eb12,null));};exports[_0x775b('0x60')]=function(_0x2035dd,_0xd9e4eb,_0x3b45fb){return db['Team']['find']({'where':{'id':_0x2035dd[_0x775b('0x47')]['id']}})[_0x775b('0x28')](handleEntityNotFound(_0xd9e4eb,null))[_0x775b('0x28')](function(_0xa53ed5){if(_0xa53ed5){var _0x112d09=[_0x775b('0x61'),'Chat',_0x775b('0x62'),_0x775b('0x63'),_0x775b('0x64'),_0x775b('0x65')];return BPromise[_0x775b('0x66')](_0x112d09,function(_0x635fb2){return _0xa53ed5['get'+_0x635fb2+_0x775b('0x5b')]({'attributes':['id','name']})['then'](function(_0x14e49b){return BPromise[_0x775b('0x66')](_0x14e49b,function(_0x34ef22){return _0x34ef22['addAgents'](_0x2035dd[_0x775b('0x52')][_0x775b('0x5f')])['then'](function(){if(_0x635fb2===_0x775b('0x61')){return db['User'][_0x775b('0x67')]({'where':{'id':_0x2035dd[_0x775b('0x52')][_0x775b('0x5f')]},'attributes':['id',_0x775b('0x2b'),_0x775b('0x68'),'voicePause','interface'],'raw':!![]})[_0x775b('0x28')](function(_0x41e0cb){return BPromise['each'](_[_0x775b('0x3b')](_0x41e0cb,{'online':0x1}),function(_0x3e4d39){return db[_0x775b('0x69')][_0x775b('0x6a')]({'membername':_0x3e4d39[_0x775b('0x2b')],'UserId':_0x3e4d39['id'],'queue_name':_0x34ef22[_0x775b('0x2b')],'VoiceQueueId':_0x34ef22['id'],'interface':_[_0x775b('0x6b')](_0x3e4d39[_0x775b('0x6c')])?util[_0x775b('0x6d')](_0x775b('0x6e'),_0x3e4d39[_0x775b('0x2b')]):_0x3e4d39['interface'],'paused':_0x3e4d39[_0x775b('0x6f')]||![],'penalty':0x0});});});}});});})[_0x775b('0x28')](function(){return _0xa53ed5;});})[_0x775b('0x28')](function(){return _0xa53ed5;});}})[_0x775b('0x28')](function(_0x35da20){if(_0x35da20){return _0x35da20[_0x775b('0x60')](_0x2035dd[_0x775b('0x52')][_0x775b('0x5f')],_[_0x775b('0x70')](_0x2035dd[_0x775b('0x52')],[_0x775b('0x5f'),'id'])||{})[_0x775b('0x71')](function(_0x138455){for(var _0x50e0f5=0x0;_0x50e0f5<_0x2035dd['body'][_0x775b('0x5f')][_0x775b('0x35')];_0x50e0f5+=0x1){socket[_0x775b('0x72')]('userTeam:save',{'UserId':_0x2035dd[_0x775b('0x52')][_0x775b('0x5f')][_0x50e0f5],'TeamId':_0x2035dd[_0x775b('0x47')]['id']});}return _0x138455;});}})[_0x775b('0x28')](respondWithResult(_0xd9e4eb,null))['catch'](handleError(_0xd9e4eb,null));};exports[_0x775b('0x73')]=function(_0x33942e,_0x3068a1,_0x43accf){return db['Team'][_0x775b('0x4a')]({'where':{'id':_0x33942e[_0x775b('0x47')]['id']}})[_0x775b('0x28')](handleEntityNotFound(_0x3068a1,null))[_0x775b('0x28')](function(_0x5b27a4){if(_0x5b27a4){return BPromise['each']([_0x775b('0x74'),_0x775b('0x75'),_0x775b('0x76'),_0x775b('0x77'),_0x775b('0x78'),_0x775b('0x79')],function(_0x45bc71){return _0x5b27a4['get'+_['capitalize'](_0x45bc71)+_0x775b('0x5b')]({'attributes':['id',_0x775b('0x2b')]})['then'](function(_0x4b85aa){return BPromise[_0x775b('0x66')](_0x4b85aa,function(_0x5aea64){return _0x5aea64[_0x775b('0x73')](_0x33942e['query'][_0x775b('0x5f')])[_0x775b('0x28')](function(){if(_0x45bc71===_0x775b('0x74')){return db['UserVoiceQueueRt'][_0x775b('0x24')]({'where':{'VoiceQueueId':_0x5aea64['id'],'UserId':_0x33942e[_0x775b('0x30')][_0x775b('0x5f')]}});}});});})[_0x775b('0x28')](function(){return _0x5b27a4;});})['then'](function(){return _0x5b27a4;});}})['then'](function(_0x18f8bb){if(_0x18f8bb){return _0x18f8bb[_0x775b('0x73')](_0x33942e[_0x775b('0x30')][_0x775b('0x5f')])[_0x775b('0x28')](function(){if(_['isArray'](_0x33942e[_0x775b('0x30')][_0x775b('0x5f')])){for(var _0x410895=0x0;_0x410895<_0x33942e[_0x775b('0x30')][_0x775b('0x5f')][_0x775b('0x35')];_0x410895+=0x1){socket[_0x775b('0x72')](_0x775b('0x7a'),{'UserId':Number(_0x33942e[_0x775b('0x30')][_0x775b('0x5f')][_0x410895]),'TeamId':Number(_0x33942e['params']['id'])});}}else{socket['emit'](_0x775b('0x7a'),{'UserId':Number(_0x33942e[_0x775b('0x30')][_0x775b('0x5f')]),'TeamId':Number(_0x33942e[_0x775b('0x47')]['id'])});}});}})[_0x775b('0x28')](respondWithStatusCode(_0x3068a1,null))[_0x775b('0x45')](handleError(_0x3068a1,null));};exports[_0x775b('0x7b')]=function(_0x1cbe4f,_0x47c1c3,_0x125dbd){var _0x22e576={};var _0x2d21f7={};var _0x5a3241;var _0x1ce92b;return db[_0x775b('0x43')][_0x775b('0x53')]({'where':{'id':_0x1cbe4f['params']['id']}})[_0x775b('0x28')](handleEntityNotFound(_0x47c1c3,null))[_0x775b('0x28')](function(_0x441e96){if(_0x441e96){_0x5a3241=_0x441e96;_0x2d21f7[_0x775b('0x2e')]=_['keys'](db[_0x775b('0x7c')]['rawAttributes']);_0x2d21f7['query']=_[_0x775b('0x2f')](_0x1cbe4f['query']);_0x2d21f7[_0x775b('0x31')]=_[_0x775b('0x32')](_0x2d21f7[_0x775b('0x2e')],_0x2d21f7[_0x775b('0x30')]);_0x22e576['attributes']=_[_0x775b('0x32')](_0x2d21f7[_0x775b('0x2e')],qs[_0x775b('0x34')](_0x1cbe4f['query'][_0x775b('0x34')]));_0x22e576[_0x775b('0x33')]=_0x22e576[_0x775b('0x33')][_0x775b('0x35')]?_0x22e576[_0x775b('0x33')]:_0x2d21f7[_0x775b('0x2e')];_0x22e576[_0x775b('0x37')]=qs[_0x775b('0x38')](_0x1cbe4f[_0x775b('0x30')][_0x775b('0x38')]);_0x22e576[_0x775b('0x39')]=qs[_0x775b('0x31')](_['pick'](_0x1cbe4f['query'],_0x2d21f7[_0x775b('0x31')]));if(_0x1cbe4f[_0x775b('0x30')]['filter']){_0x22e576[_0x775b('0x39')]=_[_0x775b('0x3c')](_0x22e576[_0x775b('0x39')],{'$or':_[_0x775b('0x3d')](_0x22e576[_0x775b('0x33')],function(_0xc826b2){var _0x12a373={};_0x12a373[_0xc826b2]={'$like':'%'+_0x1cbe4f[_0x775b('0x30')][_0x775b('0x3b')]+'%'};return _0x12a373;})});}_0x22e576=_[_0x775b('0x3c')]({},_0x22e576,_0x1cbe4f['options']);return _0x5a3241[_0x775b('0x7b')](_0x22e576);}})[_0x775b('0x28')](function(_0x2f6fb6){if(_0x2f6fb6){_0x1ce92b=_0x2f6fb6[_0x775b('0x35')];if(!_0x1cbe4f[_0x775b('0x30')][_0x775b('0x7d')]('nolimit')){_0x22e576[_0x775b('0x1d')]=qs['limit'](_0x1cbe4f['query']['limit']);_0x22e576['offset']=qs[_0x775b('0x1c')](_0x1cbe4f[_0x775b('0x30')][_0x775b('0x1c')]);}return _0x5a3241[_0x775b('0x7b')](_0x22e576);}})['then'](function(_0x59be03){if(_0x59be03){return _0x59be03?{'count':_0x1ce92b,'rows':_0x59be03}:null;}})[_0x775b('0x28')](respondWithResult(_0x47c1c3,null))['catch'](handleError(_0x47c1c3,null));}; \ No newline at end of file +var _0xedb8=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','name','send','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','catch','show','params','filters','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','length','pick','toLowerCase','Queues','addQueues','isValidChannel','Sequelize','ids','removeQueues','remove','addAgents','Mail','Sms','Fax','Openchannel','User','interface','each','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','omit','spread','userTeam:save','removeAgents','voice','chat','mail','sms','fax','isArray','userTeam:remove','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x37f957,_0x3e70a0){var _0x34d611=function(_0x17e159){while(--_0x17e159){_0x37f957['push'](_0x37f957['shift']());}};_0x34d611(++_0x3e70a0);}(_0xedb8,0x104));var _0x8edb=function(_0x2e997e,_0x4edf31){_0x2e997e=_0x2e997e-0x0;var _0x5a6cb1=_0xedb8[_0x2e997e];return _0x5a6cb1;};'use strict';var pdf=require(_0x8edb('0x0'));var emlformat=require(_0x8edb('0x1'));var rimraf=require(_0x8edb('0x2'));var zipdir=require(_0x8edb('0x3'));var jsonpatch=require(_0x8edb('0x4'));var rp=require(_0x8edb('0x5'));var moment=require(_0x8edb('0x6'));var BPromise=require(_0x8edb('0x7'));var Mustache=require(_0x8edb('0x8'));var util=require(_0x8edb('0x9'));var path=require(_0x8edb('0xa'));var sox=require(_0x8edb('0xb'));var csv=require('to-csv');var ejs=require(_0x8edb('0xc'));var fs=require('fs');var _=require(_0x8edb('0xd'));var squel=require(_0x8edb('0xe'));var crypto=require(_0x8edb('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8edb('0x10'));var toCsv=require(_0x8edb('0x11'));var querystring=require('querystring');var Papa=require(_0x8edb('0x12'));var Redis=require(_0x8edb('0x13'));var authService=require(_0x8edb('0x14'));var qs=require(_0x8edb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8edb('0x16'))(_0x8edb('0x17'));var utils=require('../../config/utils');var config=require(_0x8edb('0x18'));var db=require(_0x8edb('0x19'))['db'];config[_0x8edb('0x1a')]=_[_0x8edb('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8edb('0x1c'))(new Redis(config[_0x8edb('0x1a')]));require(_0x8edb('0x1d'))[_0x8edb('0x1e')](socket);function respondWithStatusCode(_0x43ee82,_0x51470b){_0x51470b=_0x51470b||0xcc;return function(_0x32c1f8){if(_0x32c1f8){return _0x43ee82[_0x8edb('0x1f')](_0x51470b);}return _0x43ee82[_0x8edb('0x20')](_0x51470b)[_0x8edb('0x21')]();};}function respondWithResult(_0x10da48,_0x5241dc){_0x5241dc=_0x5241dc||0xc8;return function(_0x4d3fb6){if(_0x4d3fb6){return _0x10da48['status'](_0x5241dc)['json'](_0x4d3fb6);}};}function respondWithFilteredResult(_0x1a7cd1,_0x1767e5){return function(_0xbe7669){if(_0xbe7669){var _0x3ebc43=_0xbe7669[_0x8edb('0x22')],_0xd06a32=_0x1767e5[_0x8edb('0x23')],_0x8c374d=_0x1767e5[_0x8edb('0x23')]+_0x1767e5['limit'],_0x31adb8;if(_0x8c374d>=_0x3ebc43){_0x8c374d=_0x3ebc43;_0x31adb8=0xc8;}else{_0x31adb8=0xce;}_0x1a7cd1[_0x8edb('0x20')](_0x31adb8);return _0x1a7cd1[_0x8edb('0x24')](_0x8edb('0x25'),_0xd06a32+'-'+_0x8c374d+'/'+_0x3ebc43)[_0x8edb('0x26')](_0xbe7669);}return null;};}function patchUpdates(_0x23cca6){return function(_0x1db587){try{jsonpatch[_0x8edb('0x27')](_0x1db587,_0x23cca6,!![]);}catch(_0x2e6d32){return BPromise[_0x8edb('0x28')](_0x2e6d32);}return _0x1db587[_0x8edb('0x29')]();};}function saveUpdates(_0xc87639,_0x2809c8){return function(_0x448b39){if(_0x448b39){return _0x448b39[_0x8edb('0x2a')](_0xc87639)[_0x8edb('0x2b')](function(_0xb66fa2){return _0xb66fa2;});}return null;};}function removeEntity(_0x481631,_0x44a023){return function(_0x54366a){if(_0x54366a){return _0x54366a[_0x8edb('0x2c')]()['then'](function(){var _0x44155f=_0x54366a[_0x8edb('0x2d')]({'plain':!![]});var _0x55ce18=_0x8edb('0x2e');return db[_0x8edb('0x2f')]['destroy']({'where':{'type':_0x55ce18,'resourceId':_0x44155f['id']}})[_0x8edb('0x2b')](function(){return _0x54366a;});})[_0x8edb('0x2b')](function(){_0x481631[_0x8edb('0x20')](0xcc)[_0x8edb('0x21')]();});}};}function handleEntityNotFound(_0x49fd32,_0x12782f){return function(_0x1fe063){if(!_0x1fe063){_0x49fd32[_0x8edb('0x1f')](0x194);}return _0x1fe063;};}function handleError(_0x5f66e3,_0x30ede2){_0x30ede2=_0x30ede2||0x1f4;return function(_0x144368){logger[_0x8edb('0x30')](_0x144368['stack']);if(_0x144368['name']){delete _0x144368[_0x8edb('0x31')];}_0x5f66e3[_0x8edb('0x20')](_0x30ede2)[_0x8edb('0x32')](_0x144368);};}exports[_0x8edb('0x33')]=function(_0x582ed7,_0xe6ac3){var _0x2bf607={},_0x574ebf={},_0x18b109={'count':0x0,'rows':[]};var _0x5ca797=db[_0x8edb('0x34')][_0x8edb('0x35')];_0x574ebf[_0x8edb('0x36')]=_[_0x8edb('0x37')](_0x5ca797);_0x574ebf[_0x8edb('0x38')]=_[_0x8edb('0x37')](_0x582ed7[_0x8edb('0x38')]);_0x574ebf['filters']=_[_0x8edb('0x39')](_0x574ebf[_0x8edb('0x36')],_0x574ebf[_0x8edb('0x38')]);_0x2bf607[_0x8edb('0x3a')]=_['intersection'](_0x574ebf[_0x8edb('0x36')],qs[_0x8edb('0x3b')](_0x582ed7[_0x8edb('0x38')][_0x8edb('0x3b')]));_0x2bf607[_0x8edb('0x3a')]=_0x2bf607[_0x8edb('0x3a')]['length']?_0x2bf607['attributes']:_0x574ebf['model'];if(!_0x582ed7[_0x8edb('0x38')][_0x8edb('0x3c')](_0x8edb('0x3d'))){_0x2bf607[_0x8edb('0x3e')]=qs[_0x8edb('0x3e')](_0x582ed7['query'][_0x8edb('0x3e')]);_0x2bf607[_0x8edb('0x23')]=qs[_0x8edb('0x23')](_0x582ed7['query'][_0x8edb('0x23')]);}_0x2bf607[_0x8edb('0x3f')]=qs['sort'](_0x582ed7[_0x8edb('0x38')][_0x8edb('0x40')]);_0x2bf607[_0x8edb('0x41')]=qs['filters'](_['pick'](_0x582ed7[_0x8edb('0x38')],_0x574ebf['filters']));if(_0x582ed7[_0x8edb('0x38')][_0x8edb('0x42')]){_0x2bf607[_0x8edb('0x41')]=_[_0x8edb('0x43')](_0x2bf607[_0x8edb('0x41')],{'$or':_[_0x8edb('0x44')](_0x5ca797,function(_0x443350){if(_0x443350[_0x8edb('0x45')][_0x8edb('0x46')]!==_0x8edb('0x47')){var _0x5e3b1f={};_0x5e3b1f[_0x443350[_0x8edb('0x48')]]={'$like':'%'+_0x582ed7[_0x8edb('0x38')][_0x8edb('0x42')]+'%'};return _0x5e3b1f;}})});}_0x2bf607=_[_0x8edb('0x43')]({},_0x2bf607,_0x582ed7[_0x8edb('0x49')]);var _0x3eb929={'where':_0x2bf607['where']};return db[_0x8edb('0x34')][_0x8edb('0x22')](_0x3eb929)[_0x8edb('0x2b')](function(_0x89b2ef){_0x18b109[_0x8edb('0x22')]=_0x89b2ef;if(_0x582ed7['query'][_0x8edb('0x4a')]){_0x2bf607['include']=[{'all':!![]}];}return db[_0x8edb('0x34')][_0x8edb('0x4b')](_0x2bf607);})[_0x8edb('0x2b')](function(_0x2fc9b4){_0x18b109['rows']=_0x2fc9b4;return _0x18b109;})[_0x8edb('0x2b')](respondWithFilteredResult(_0xe6ac3,_0x2bf607))[_0x8edb('0x4c')](handleError(_0xe6ac3,null));};exports[_0x8edb('0x4d')]=function(_0x5115bf,_0x14ba04){var _0x399e8a={'raw':![],'where':{'id':_0x5115bf[_0x8edb('0x4e')]['id']}},_0x562b95={};_0x562b95[_0x8edb('0x36')]=_['keys'](db[_0x8edb('0x34')]['rawAttributes']);_0x562b95[_0x8edb('0x38')]=_[_0x8edb('0x37')](_0x5115bf[_0x8edb('0x38')]);_0x562b95[_0x8edb('0x4f')]=_[_0x8edb('0x39')](_0x562b95[_0x8edb('0x36')],_0x562b95[_0x8edb('0x38')]);_0x399e8a[_0x8edb('0x3a')]=_['intersection'](_0x562b95[_0x8edb('0x36')],qs['fields'](_0x5115bf['query'][_0x8edb('0x3b')]));_0x399e8a[_0x8edb('0x3a')]=_0x399e8a[_0x8edb('0x3a')]['length']?_0x399e8a[_0x8edb('0x3a')]:_0x562b95[_0x8edb('0x36')];if(_0x5115bf[_0x8edb('0x38')][_0x8edb('0x4a')]){_0x399e8a[_0x8edb('0x50')]=[{'all':!![]}];}_0x399e8a=_[_0x8edb('0x43')]({},_0x399e8a,_0x5115bf[_0x8edb('0x49')]);return db[_0x8edb('0x34')]['find'](_0x399e8a)[_0x8edb('0x2b')](handleEntityNotFound(_0x14ba04,null))[_0x8edb('0x2b')](respondWithResult(_0x14ba04,null))[_0x8edb('0x4c')](handleError(_0x14ba04,null));};exports[_0x8edb('0x51')]=function(_0x36cc08,_0x2b4033){return db['Team'][_0x8edb('0x51')](_0x36cc08[_0x8edb('0x52')],{})[_0x8edb('0x2b')](function(_0x23d5eb){var _0x322792=_0x36cc08[_0x8edb('0x53')][_0x8edb('0x2d')]({'plain':!![]});if(!_0x322792)throw new Error(_0x8edb('0x54'));if(_0x322792[_0x8edb('0x55')]===_0x8edb('0x53')){var _0x5a1f82=_0x23d5eb[_0x8edb('0x2d')]({'plain':!![]});var _0x3baa92=_0x8edb('0x2e');return db[_0x8edb('0x56')][_0x8edb('0x57')]({'where':{'name':_0x3baa92,'userProfileId':_0x322792[_0x8edb('0x58')]},'raw':!![]})[_0x8edb('0x2b')](function(_0x54c542){if(_0x54c542&&_0x54c542['autoAssociation']===0x0){return db[_0x8edb('0x2f')][_0x8edb('0x51')]({'name':_0x5a1f82[_0x8edb('0x31')],'resourceId':_0x5a1f82['id'],'type':_0x54c542[_0x8edb('0x31')],'sectionId':_0x54c542['id']},{})[_0x8edb('0x2b')](function(){return _0x23d5eb;});}else{return _0x23d5eb;}})[_0x8edb('0x4c')](function(_0x1d1485){logger['error'](_0x8edb('0x59'),_0x1d1485);throw _0x1d1485;});}return _0x23d5eb;})['then'](respondWithResult(_0x2b4033,0xc9))['catch'](handleError(_0x2b4033,null));};exports[_0x8edb('0x2a')]=function(_0x36fa29,_0x3b33ac){if(_0x36fa29[_0x8edb('0x52')]['id']){delete _0x36fa29[_0x8edb('0x52')]['id'];}return db[_0x8edb('0x34')][_0x8edb('0x57')]({'where':{'id':_0x36fa29['params']['id']}})[_0x8edb('0x2b')](handleEntityNotFound(_0x3b33ac,null))[_0x8edb('0x2b')](saveUpdates(_0x36fa29[_0x8edb('0x52')],null))[_0x8edb('0x2b')](respondWithResult(_0x3b33ac,null))[_0x8edb('0x4c')](handleError(_0x3b33ac,null));};exports[_0x8edb('0x2c')]=function(_0x341e61,_0x4cbeb0){return db['Team']['find']({'where':{'id':_0x341e61[_0x8edb('0x4e')]['id']}})[_0x8edb('0x2b')](handleEntityNotFound(_0x4cbeb0,null))[_0x8edb('0x2b')](removeEntity(_0x4cbeb0,null))[_0x8edb('0x4c')](handleError(_0x4cbeb0,null));};exports[_0x8edb('0x5a')]=function(_0x23e758,_0x1bdafe,_0x3fc11b){return db[_0x8edb('0x34')][_0x8edb('0x5b')]({'where':{'id':_0x23e758[_0x8edb('0x4e')]['id']}})[_0x8edb('0x2b')](handleEntityNotFound(_0x1bdafe,null))['then'](function(_0x1b8bea){if(!_0x23e758[_0x8edb('0x38')][_0x8edb('0x5c')]||!utils['isValidChannel'](_0x23e758[_0x8edb('0x38')]['channel'])){throw new db['Sequelize'][(_0x8edb('0x5d'))](_0x8edb('0x5e'));}var _0x69c518={};var _0x2d3855={};_0x2d3855[_0x8edb('0x36')]=_[_0x8edb('0x37')](db[_[_0x8edb('0x5f')](_0x23e758[_0x8edb('0x38')]['channel']['toLowerCase']())+'Queue'][_0x8edb('0x35')]);_0x2d3855[_0x8edb('0x38')]=_['keys'](_0x23e758[_0x8edb('0x38')]);_0x2d3855[_0x8edb('0x4f')]=_['intersection'](_0x2d3855[_0x8edb('0x36')],_0x2d3855[_0x8edb('0x38')]);_0x69c518[_0x8edb('0x3a')]=_[_0x8edb('0x39')](_0x2d3855['model'],qs[_0x8edb('0x3b')](_0x23e758[_0x8edb('0x38')][_0x8edb('0x3b')]));_0x69c518[_0x8edb('0x3a')]=_0x69c518[_0x8edb('0x3a')][_0x8edb('0x60')]?_0x69c518[_0x8edb('0x3a')]:_0x2d3855['model'];_0x69c518[_0x8edb('0x3e')]=qs[_0x8edb('0x3e')](_0x23e758[_0x8edb('0x38')]['limit']);_0x69c518[_0x8edb('0x23')]=qs['offset'](_0x23e758[_0x8edb('0x38')]['offset']);_0x69c518[_0x8edb('0x3f')]=qs[_0x8edb('0x40')](_0x23e758['query'][_0x8edb('0x40')]);_0x69c518[_0x8edb('0x41')]=qs[_0x8edb('0x4f')](_[_0x8edb('0x61')](_0x23e758[_0x8edb('0x38')],_0x2d3855[_0x8edb('0x4f')]));_0x69c518=_['merge']({},_0x69c518,_0x23e758[_0x8edb('0x49')]);return _0x1b8bea[_0x8edb('0x2d')+_[_0x8edb('0x5f')](_0x23e758[_0x8edb('0x38')][_0x8edb('0x5c')][_0x8edb('0x62')]())+_0x8edb('0x63')](_0x69c518);})['then'](respondWithResult(_0x1bdafe,null))[_0x8edb('0x4c')](handleError(_0x1bdafe,null));};exports[_0x8edb('0x64')]=function(_0x198b97,_0x149b8a,_0x37a034){return db['Team']['findOne']({'where':{'id':_0x198b97[_0x8edb('0x4e')]['id']}})[_0x8edb('0x2b')](function(_0x314c31){if(_0x314c31){if(!_0x198b97[_0x8edb('0x52')][_0x8edb('0x5c')]||!utils[_0x8edb('0x65')](_0x198b97[_0x8edb('0x52')]['channel'])){throw new db[(_0x8edb('0x66'))]['ValidationError'](_0x8edb('0x5e'));}return _0x314c31['add'+_['capitalize'](_0x198b97[_0x8edb('0x52')][_0x8edb('0x5c')][_0x8edb('0x62')]())+_0x8edb('0x63')](_0x198b97[_0x8edb('0x52')][_0x8edb('0x67')]);}return null;})[_0x8edb('0x2b')](handleEntityNotFound(_0x149b8a,null))['then'](respondWithStatusCode(_0x149b8a,null))[_0x8edb('0x4c')](handleError(_0x149b8a,null));};exports[_0x8edb('0x68')]=function(_0x433669,_0x1649d9,_0x143bf0){return db[_0x8edb('0x34')][_0x8edb('0x5b')]({'where':{'id':_0x433669[_0x8edb('0x4e')]['id']}})[_0x8edb('0x2b')](function(_0x27ea32){if(_0x27ea32){if(!_0x433669[_0x8edb('0x38')]['channel']||!utils['isValidChannel'](_0x433669[_0x8edb('0x38')][_0x8edb('0x5c')])){throw new db[(_0x8edb('0x66'))][(_0x8edb('0x5d'))](_0x8edb('0x5e'));}return _0x27ea32[_0x8edb('0x69')+_[_0x8edb('0x5f')](_0x433669[_0x8edb('0x38')]['channel'][_0x8edb('0x62')]())+_0x8edb('0x63')](_0x433669[_0x8edb('0x38')][_0x8edb('0x67')]);}return null;})['then'](handleEntityNotFound(_0x1649d9,null))[_0x8edb('0x2b')](respondWithStatusCode(_0x1649d9,null))[_0x8edb('0x4c')](handleError(_0x1649d9,null));};exports[_0x8edb('0x6a')]=function(_0x41a4c5,_0x59b893,_0x9fa836){return db[_0x8edb('0x34')][_0x8edb('0x57')]({'where':{'id':_0x41a4c5[_0x8edb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59b893,null))[_0x8edb('0x2b')](function(_0x4d8b5e){if(_0x4d8b5e){var _0x35e511=['Voice','Chat',_0x8edb('0x6b'),_0x8edb('0x6c'),_0x8edb('0x6d'),_0x8edb('0x6e')];return BPromise['each'](_0x35e511,function(_0x5531ab){return _0x4d8b5e[_0x8edb('0x2d')+_0x5531ab+_0x8edb('0x63')]({'attributes':['id',_0x8edb('0x31')]})['then'](function(_0x397313){return BPromise['each'](_0x397313,function(_0x5e5837){return _0x5e5837[_0x8edb('0x6a')](_0x41a4c5[_0x8edb('0x52')][_0x8edb('0x67')])[_0x8edb('0x2b')](function(){if(_0x5531ab==='Voice'){return db[_0x8edb('0x6f')][_0x8edb('0x4b')]({'where':{'id':_0x41a4c5[_0x8edb('0x52')]['ids']},'attributes':['id',_0x8edb('0x31'),'online','voicePause',_0x8edb('0x70')],'raw':!![]})[_0x8edb('0x2b')](function(_0x2855a7){return BPromise[_0x8edb('0x71')](_[_0x8edb('0x42')](_0x2855a7,{'online':0x1}),function(_0x30c16d){return db[_0x8edb('0x72')]['upsert']({'membername':_0x30c16d[_0x8edb('0x31')],'UserId':_0x30c16d['id'],'queue_name':_0x5e5837[_0x8edb('0x31')],'VoiceQueueId':_0x5e5837['id'],'interface':_[_0x8edb('0x73')](_0x30c16d[_0x8edb('0x70')])?util[_0x8edb('0x74')](_0x8edb('0x75'),_0x30c16d[_0x8edb('0x31')]):_0x30c16d[_0x8edb('0x70')],'paused':_0x30c16d[_0x8edb('0x76')]||![],'penalty':0x0});});});}});});})[_0x8edb('0x2b')](function(){return _0x4d8b5e;});})[_0x8edb('0x2b')](function(){return _0x4d8b5e;});}})['then'](function(_0x484f8f){if(_0x484f8f){return _0x484f8f['addAgents'](_0x41a4c5[_0x8edb('0x52')][_0x8edb('0x67')],_[_0x8edb('0x77')](_0x41a4c5['body'],[_0x8edb('0x67'),'id'])||{})[_0x8edb('0x78')](function(_0x43efff){for(var _0x3cee70=0x0;_0x3cee70<_0x41a4c5['body']['ids']['length'];_0x3cee70+=0x1){socket['emit'](_0x8edb('0x79'),{'UserId':_0x41a4c5[_0x8edb('0x52')][_0x8edb('0x67')][_0x3cee70],'TeamId':_0x41a4c5[_0x8edb('0x4e')]['id']});}return _0x43efff;});}})['then'](respondWithResult(_0x59b893,null))['catch'](handleError(_0x59b893,null));};exports[_0x8edb('0x7a')]=function(_0x2f767f,_0x15a152,_0x260c6e){return db[_0x8edb('0x34')][_0x8edb('0x57')]({'where':{'id':_0x2f767f[_0x8edb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15a152,null))['then'](function(_0x9b0f7a){if(_0x9b0f7a){return BPromise[_0x8edb('0x71')]([_0x8edb('0x7b'),_0x8edb('0x7c'),_0x8edb('0x7d'),_0x8edb('0x7e'),_0x8edb('0x7f'),'openchannel'],function(_0x4501e7){return _0x9b0f7a[_0x8edb('0x2d')+_[_0x8edb('0x5f')](_0x4501e7)+_0x8edb('0x63')]({'attributes':['id',_0x8edb('0x31')]})[_0x8edb('0x2b')](function(_0x2bd706){return BPromise['each'](_0x2bd706,function(_0x30b3a5){return _0x30b3a5[_0x8edb('0x7a')](_0x2f767f[_0x8edb('0x38')][_0x8edb('0x67')])[_0x8edb('0x2b')](function(){if(_0x4501e7==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x30b3a5['id'],'UserId':_0x2f767f[_0x8edb('0x38')][_0x8edb('0x67')]}});}});});})[_0x8edb('0x2b')](function(){return _0x9b0f7a;});})[_0x8edb('0x2b')](function(){return _0x9b0f7a;});}})[_0x8edb('0x2b')](function(_0x4d51e8){if(_0x4d51e8){return _0x4d51e8[_0x8edb('0x7a')](_0x2f767f['query'][_0x8edb('0x67')])[_0x8edb('0x2b')](function(){if(_[_0x8edb('0x80')](_0x2f767f['query'][_0x8edb('0x67')])){for(var _0x16b512=0x0;_0x16b512<_0x2f767f[_0x8edb('0x38')][_0x8edb('0x67')][_0x8edb('0x60')];_0x16b512+=0x1){socket['emit'](_0x8edb('0x81'),{'UserId':Number(_0x2f767f[_0x8edb('0x38')][_0x8edb('0x67')][_0x16b512]),'TeamId':Number(_0x2f767f[_0x8edb('0x4e')]['id'])});}}else{socket[_0x8edb('0x82')](_0x8edb('0x81'),{'UserId':Number(_0x2f767f['query'][_0x8edb('0x67')]),'TeamId':Number(_0x2f767f['params']['id'])});}});}})[_0x8edb('0x2b')](respondWithStatusCode(_0x15a152,null))['catch'](handleError(_0x15a152,null));};exports[_0x8edb('0x83')]=function(_0x3c2f84,_0x39b0a5,_0x1e4873){var _0x42d4a9={};var _0x51ab31={};var _0x29645e;var _0x3d65ea;return db[_0x8edb('0x34')]['findOne']({'where':{'id':_0x3c2f84['params']['id']}})[_0x8edb('0x2b')](handleEntityNotFound(_0x39b0a5,null))[_0x8edb('0x2b')](function(_0x59a6f9){if(_0x59a6f9){_0x29645e=_0x59a6f9;_0x51ab31['model']=_['keys'](db['User'][_0x8edb('0x35')]);_0x51ab31['query']=_[_0x8edb('0x37')](_0x3c2f84['query']);_0x51ab31[_0x8edb('0x4f')]=_['intersection'](_0x51ab31['model'],_0x51ab31[_0x8edb('0x38')]);_0x42d4a9[_0x8edb('0x3a')]=_[_0x8edb('0x39')](_0x51ab31[_0x8edb('0x36')],qs[_0x8edb('0x3b')](_0x3c2f84[_0x8edb('0x38')][_0x8edb('0x3b')]));_0x42d4a9['attributes']=_0x42d4a9[_0x8edb('0x3a')][_0x8edb('0x60')]?_0x42d4a9[_0x8edb('0x3a')]:_0x51ab31[_0x8edb('0x36')];_0x42d4a9[_0x8edb('0x3f')]=qs[_0x8edb('0x40')](_0x3c2f84['query']['sort']);_0x42d4a9['where']=qs[_0x8edb('0x4f')](_['pick'](_0x3c2f84[_0x8edb('0x38')],_0x51ab31['filters']));if(_0x3c2f84['query'][_0x8edb('0x42')]){_0x42d4a9[_0x8edb('0x41')]=_[_0x8edb('0x43')](_0x42d4a9[_0x8edb('0x41')],{'$or':_['map'](_0x42d4a9[_0x8edb('0x3a')],function(_0x1c8eca){var _0x131dd4={};_0x131dd4[_0x1c8eca]={'$like':'%'+_0x3c2f84[_0x8edb('0x38')][_0x8edb('0x42')]+'%'};return _0x131dd4;})});}_0x42d4a9=_[_0x8edb('0x43')]({},_0x42d4a9,_0x3c2f84[_0x8edb('0x49')]);return _0x29645e['getAgents'](_0x42d4a9);}})[_0x8edb('0x2b')](function(_0x15e831){if(_0x15e831){_0x3d65ea=_0x15e831[_0x8edb('0x60')];if(!_0x3c2f84[_0x8edb('0x38')]['hasOwnProperty'](_0x8edb('0x3d'))){_0x42d4a9[_0x8edb('0x3e')]=qs[_0x8edb('0x3e')](_0x3c2f84[_0x8edb('0x38')][_0x8edb('0x3e')]);_0x42d4a9[_0x8edb('0x23')]=qs[_0x8edb('0x23')](_0x3c2f84[_0x8edb('0x38')][_0x8edb('0x23')]);}return _0x29645e[_0x8edb('0x83')](_0x42d4a9);}})[_0x8edb('0x2b')](function(_0x3a3a44){if(_0x3a3a44){return _0x3a3a44?{'count':_0x3d65ea,'rows':_0x3a3a44}:null;}})[_0x8edb('0x2b')](respondWithResult(_0x39b0a5,null))[_0x8edb('0x4c')](handleError(_0x39b0a5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index db23b1e..6c86b12 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 _0x53ec=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x53ec[_0x3d00db];return _0x41f115;};'use strict';var EventEmitter=require(_0xc53e('0x0'));var Team=require(_0xc53e('0x1'))['db'][_0xc53e('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xc53e('0x3')](0x0);var events={'afterCreate':_0xc53e('0x4'),'afterUpdate':_0xc53e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x266c42){return function(_0x4e954a,_0x2b90f6,_0x38033d){TeamEvents['emit'](_0x266c42+':'+_0x4e954a['id'],_0x4e954a);TeamEvents[_0xc53e('0x6')](_0x266c42,_0x4e954a);_0x38033d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xc53e('0x7')](e,emitEvent(event));}}module[_0xc53e('0x8')]=TeamEvents; \ No newline at end of file +var _0x964b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1232b4,_0x59f94b){var _0x2263cf=function(_0x216413){while(--_0x216413){_0x1232b4['push'](_0x1232b4['shift']());}};_0x2263cf(++_0x59f94b);}(_0x964b,0x112));var _0xb964=function(_0x577250,_0x112d13){_0x577250=_0x577250-0x0;var _0x37c3ca=_0x964b[_0x577250];return _0x37c3ca;};'use strict';var EventEmitter=require(_0xb964('0x0'));var Team=require(_0xb964('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xb964('0x2')](0x0);var events={'afterCreate':_0xb964('0x3'),'afterUpdate':_0xb964('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c4f01){return function(_0x2c4686,_0x48b771,_0x4760b2){TeamEvents[_0xb964('0x5')](_0x5c4f01+':'+_0x2c4686['id'],_0x2c4686);TeamEvents[_0xb964('0x5')](_0x5c4f01,_0x2c4686);_0x4760b2(null);};}for(var e in events){if(events[_0xb964('0x6')](e)){var event=events[e];Team[_0xb964('0x7')](e,emitEvent(event));}}module[_0xb964('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c70025e..47e6c53 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 _0xf30a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','Team','teams','lodash','util'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0xf30a,0x1ab));var _0xaf30=function(_0x37e6be,_0x487361){_0x37e6be=_0x37e6be-0x0;var _0x16e105=_0xf30a[_0x37e6be];return _0x16e105;};'use strict';var _=require(_0xaf30('0x0'));var util=require(_0xaf30('0x1'));var logger=require(_0xaf30('0x2'))('api');var moment=require(_0xaf30('0x3'));var BPromise=require(_0xaf30('0x4'));var rp=require(_0xaf30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf30('0x6'));var config=require(_0xaf30('0x7'));var attributes=require('./team.attributes');module[_0xaf30('0x8')]=function(_0x52a9ef,_0x1f4c07){return _0x52a9ef['define'](_0xaf30('0x9'),attributes,{'tableName':_0xaf30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb197=['exports','define','Team','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xf273f9,_0x486198){var _0xb4abcc=function(_0x2f9418){while(--_0x2f9418){_0xf273f9['push'](_0xf273f9['shift']());}};_0xb4abcc(++_0x486198);}(_0xb197,0xa3));var _0x7b19=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xb197[_0x29ae80];return _0x5d6d71;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7b19('0x0'));var BPromise=require(_0x7b19('0x1'));var rp=require(_0x7b19('0x2'));var fs=require('fs');var path=require(_0x7b19('0x3'));var rimraf=require('rimraf');var config=require(_0x7b19('0x4'));var attributes=require('./team.attributes');module[_0x7b19('0x5')]=function(_0xcea5ac,_0x591eed){return _0xcea5ac[_0x7b19('0x6')](_0x7b19('0x7'),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 3c6903e..8c90028 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 _0x0611=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x147d10,_0x5aa133){var _0xd1219b=function(_0x1c3e86){while(--_0x1c3e86){_0x147d10['push'](_0x147d10['shift']());}};_0xd1219b(++_0x5aa133);}(_0x0611,0x1ac));var _0x1061=function(_0xe247ba,_0x3dc091){_0xe247ba=_0xe247ba-0x0;var _0xbf4bea=_0x0611[_0xe247ba];return _0xbf4bea;};'use strict';var _=require(_0x1061('0x0'));var util=require(_0x1061('0x1'));var moment=require(_0x1061('0x2'));var BPromise=require(_0x1061('0x3'));var rs=require(_0x1061('0x4'));var fs=require('fs');var Redis=require(_0x1061('0x5'));var db=require(_0x1061('0x6'))['db'];var utils=require(_0x1061('0x7'));var logger=require('../../config/logger')(_0x1061('0x8'));var config=require(_0x1061('0x9'));var jayson=require(_0x1061('0xa'));var client=jayson['client'][_0x1061('0xb')]({'port':0x232a});config[_0x1061('0xc')]=_[_0x1061('0xd')](config[_0x1061('0xc')],{'host':_0x1061('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1061('0xf'))[_0x1061('0x10')](socket);function respondWithRpcPromise(_0x46574c,_0x5c809f,_0x5ec709){return new BPromise(function(_0x385baf,_0x2e8147){return client['request'](_0x46574c,_0x5ec709)[_0x1061('0x11')](function(_0xf76eac){logger[_0x1061('0x12')](_0x1061('0x13'),_0x5c809f,_0x1061('0x14'));logger['debug'](_0x1061('0x15'),_0x5c809f,_0x1061('0x14'),JSON[_0x1061('0x16')](_0xf76eac));if(_0xf76eac[_0x1061('0x17')]){if(_0xf76eac[_0x1061('0x17')][_0x1061('0x18')]===0x1f4){logger[_0x1061('0x17')](_0x1061('0x13'),_0x5c809f,_0xf76eac[_0x1061('0x17')][_0x1061('0x19')]);return _0x2e8147(_0xf76eac['error'][_0x1061('0x19')]);}logger[_0x1061('0x17')](_0x1061('0x13'),_0x5c809f,_0xf76eac[_0x1061('0x17')][_0x1061('0x19')]);return _0x385baf(_0xf76eac[_0x1061('0x17')]['message']);}else{logger['info'](_0x1061('0x13'),_0x5c809f,_0x1061('0x14'));_0x385baf(_0xf76eac[_0x1061('0x1a')][_0x1061('0x19')]);}})['catch'](function(_0x1f282d){logger['error']('Team,\x20%s,\x20%s',_0x5c809f,_0x1f282d);_0x2e8147(_0x1f282d);});});} \ No newline at end of file +var _0xc1a8=['defaults','socket.io-emitter','./team.socket','register','request','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0xaa19aa,_0x517fc5){var _0x5ad07b=function(_0x716a67){while(--_0x716a67){_0xaa19aa['push'](_0xaa19aa['shift']());}};_0x5ad07b(++_0x517fc5);}(_0xc1a8,0x189));var _0x8c1a=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0xc1a8[_0x1f83a5];return _0x45edf0;};'use strict';var _=require('lodash');var util=require(_0x8c1a('0x0'));var moment=require(_0x8c1a('0x1'));var BPromise=require(_0x8c1a('0x2'));var rs=require(_0x8c1a('0x3'));var fs=require('fs');var Redis=require(_0x8c1a('0x4'));var db=require(_0x8c1a('0x5'))['db'];var utils=require(_0x8c1a('0x6'));var logger=require('../../config/logger')(_0x8c1a('0x7'));var config=require(_0x8c1a('0x8'));var jayson=require(_0x8c1a('0x9'));var client=jayson['client'][_0x8c1a('0xa')]({'port':0x232a});config[_0x8c1a('0xb')]=_[_0x8c1a('0xc')](config[_0x8c1a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c1a('0xd'))(new Redis(config[_0x8c1a('0xb')]));require(_0x8c1a('0xe'))[_0x8c1a('0xf')](socket);function respondWithRpcPromise(_0x5b93ba,_0x31a88a,_0x1e1b85){return new BPromise(function(_0x105f49,_0x5cf701){return client[_0x8c1a('0x10')](_0x5b93ba,_0x1e1b85)['then'](function(_0x2d8436){logger[_0x8c1a('0x11')]('Team,\x20%s,\x20%s',_0x31a88a,'request\x20sent');logger[_0x8c1a('0x12')](_0x8c1a('0x13'),_0x31a88a,_0x8c1a('0x14'),JSON[_0x8c1a('0x15')](_0x2d8436));if(_0x2d8436[_0x8c1a('0x16')]){if(_0x2d8436['error'][_0x8c1a('0x17')]===0x1f4){logger[_0x8c1a('0x16')](_0x8c1a('0x18'),_0x31a88a,_0x2d8436[_0x8c1a('0x16')][_0x8c1a('0x19')]);return _0x5cf701(_0x2d8436[_0x8c1a('0x16')][_0x8c1a('0x19')]);}logger['error'](_0x8c1a('0x18'),_0x31a88a,_0x2d8436[_0x8c1a('0x16')][_0x8c1a('0x19')]);return _0x105f49(_0x2d8436[_0x8c1a('0x16')][_0x8c1a('0x19')]);}else{logger[_0x8c1a('0x11')](_0x8c1a('0x18'),_0x31a88a,_0x8c1a('0x14'));_0x105f49(_0x2d8436['result']['message']);}})[_0x8c1a('0x1a')](function(_0x22e2a8){logger['error'](_0x8c1a('0x18'),_0x31a88a,_0x22e2a8);_0x5cf701(_0x22e2a8);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 68e3dee..799fc48 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 _0xd6af=['length','save','remove','emit','removeListener','register'];(function(_0x25b787,_0x468fab){var _0x3ece92=function(_0x4dd16b){while(--_0x4dd16b){_0x25b787['push'](_0x25b787['shift']());}};_0x3ece92(++_0x468fab);}(_0xd6af,0x187));var _0xfd6a=function(_0x3954f0,_0x38ff5f){_0x3954f0=_0x3954f0-0x0;var _0x41fc13=_0xd6af[_0x3954f0];return _0x41fc13;};'use strict';var TeamEvents=require('./team.events');var events=[_0xfd6a('0x0'),_0xfd6a('0x1'),'update'];function createListener(_0x2b2e63,_0x3ca23f){return function(_0xdcf8fd){_0x3ca23f[_0xfd6a('0x2')](_0x2b2e63,_0xdcf8fd);};}function removeListener(_0x115409,_0x3eb3fe){return function(){TeamEvents[_0xfd6a('0x3')](_0x115409,_0x3eb3fe);};}exports[_0xfd6a('0x4')]=function(_0x36b1df){for(var _0x88b597=0x0,_0x25b566=events[_0xfd6a('0x5')];_0x88b597<_0x25b566;_0x88b597++){var _0x35b6aa=events[_0x88b597];var _0x79ac9d=createListener('team:'+_0x35b6aa,_0x36b1df);TeamEvents['on'](_0x35b6aa,_0x79ac9d);}}; \ No newline at end of file +var _0x2e56=['save','remove','update','emit','removeListener','length','./team.events'];(function(_0xc4743b,_0x5d8f4e){var _0x317924=function(_0x24c82a){while(--_0x24c82a){_0xc4743b['push'](_0xc4743b['shift']());}};_0x317924(++_0x5d8f4e);}(_0x2e56,0x109));var _0x62e5=function(_0x27c3f0,_0x198aa2){_0x27c3f0=_0x27c3f0-0x0;var _0x11e51c=_0x2e56[_0x27c3f0];return _0x11e51c;};'use strict';var TeamEvents=require(_0x62e5('0x0'));var events=[_0x62e5('0x1'),_0x62e5('0x2'),_0x62e5('0x3')];function createListener(_0x275d3d,_0x298c4a){return function(_0x42bae7){_0x298c4a[_0x62e5('0x4')](_0x275d3d,_0x42bae7);};}function removeListener(_0x46850e,_0x3e4e34){return function(){TeamEvents[_0x62e5('0x5')](_0x46850e,_0x3e4e34);};}exports['register']=function(_0x643079){for(var _0x5ac729=0x0,_0x2987a4=events[_0x62e5('0x6')];_0x5ac729<_0x2987a4;_0x5ac729++){var _0x417151=events[_0x5ac729];var _0x2b9c85=createListener('team:'+_0x417151,_0x643079);TeamEvents['on'](_0x417151,_0x2b9c85);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 316a33e..e49d085 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 _0xbfdf=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0xbfdf,0x107));var _0xfbfd=function(_0x4bf6c7,_0x182941){_0x4bf6c7=_0x4bf6c7-0x0;var _0x52903a=_0xbfdf[_0x4bf6c7];return _0x52903a;};'use strict';var multer=require(_0xfbfd('0x0'));var util=require('util');var path=require(_0xfbfd('0x1'));var timeout=require(_0xfbfd('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xfbfd('0x3'));var interaction=require(_0xfbfd('0x4'));var config=require(_0xfbfd('0x5'));var controller=require(_0xfbfd('0x6'));router[_0xfbfd('0x7')]('/',auth[_0xfbfd('0x8')](),controller[_0xfbfd('0x9')]);router['get'](_0xfbfd('0xa'),auth['isAuthenticated'](),controller[_0xfbfd('0xb')]);router[_0xfbfd('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfbfd('0xd')](_0xfbfd('0xa'),auth['isAuthenticated'](),controller[_0xfbfd('0xe')]);router[_0xfbfd('0xf')](_0xfbfd('0xa'),auth['isAuthenticated'](),controller[_0xfbfd('0x10')]);module[_0xfbfd('0x11')]=router; \ No newline at end of file +var _0x6083=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x137787,_0x34e148){var _0x29a645=function(_0x376f49){while(--_0x376f49){_0x137787['push'](_0x137787['shift']());}};_0x29a645(++_0x34e148);}(_0x6083,0x1ea));var _0x3608=function(_0x36530f,_0x167770){_0x36530f=_0x36530f-0x0;var _0x11745a=_0x6083[_0x36530f];return _0x11745a;};'use strict';var multer=require('multer');var util=require(_0x3608('0x0'));var path=require(_0x3608('0x1'));var timeout=require(_0x3608('0x2'));var express=require('express');var router=express[_0x3608('0x3')]();var auth=require(_0x3608('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3608('0x5'));var controller=require('./template.controller');router[_0x3608('0x6')]('/',auth[_0x3608('0x7')](),controller[_0x3608('0x8')]);router['get'](_0x3608('0x9'),auth['isAuthenticated'](),controller[_0x3608('0xa')]);router[_0x3608('0xb')]('/',auth[_0x3608('0x7')](),controller[_0x3608('0xc')]);router[_0x3608('0xd')](_0x3608('0x9'),auth[_0x3608('0x7')](),controller['update']);router['delete'](_0x3608('0x9'),auth[_0x3608('0x7')](),controller[_0x3608('0xe')]);module[_0x3608('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c78ac4f..ad72299 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 _0xa725=['STRING','sequelize','exports'];(function(_0x17ccf6,_0x8b3475){var _0x1a0f1d=function(_0x29d092){while(--_0x29d092){_0x17ccf6['push'](_0x17ccf6['shift']());}};_0x1a0f1d(++_0x8b3475);}(_0xa725,0x112));var _0x5a72=function(_0x56dd6f,_0x4552c0){_0x56dd6f=_0x56dd6f-0x0;var _0x300568=_0xa725[_0x56dd6f];return _0x300568;};'use strict';var Sequelize=require(_0x5a72('0x0'));module[_0x5a72('0x1')]={'name':{'type':Sequelize[_0x5a72('0x2')]},'description':{'type':Sequelize[_0x5a72('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x93a6=['TEXT','sequelize','exports','STRING'];(function(_0x118ec3,_0x50d8a6){var _0x542fa6=function(_0x176f12){while(--_0x176f12){_0x118ec3['push'](_0x118ec3['shift']());}};_0x542fa6(++_0x50d8a6);}(_0x93a6,0x6d));var _0x693a=function(_0x3d6785,_0x492ea3){_0x3d6785=_0x3d6785-0x0;var _0x39a624=_0x93a6[_0x3d6785];return _0x39a624;};'use strict';var Sequelize=require(_0x693a('0x0'));module[_0x693a('0x1')]={'name':{'type':Sequelize[_0x693a('0x2')]},'description':{'type':Sequelize[_0x693a('0x2')]},'html':{'type':Sequelize[_0x693a('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index cc2d4d7..5c5e12d 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 _0x0cd6=['destroy','get','UserProfileResource','error','name','send','index','Template','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Templates','UserProfileSection','find','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then'];(function(_0x14d3b0,_0x15ae4a){var _0x296d17=function(_0x40ff2b){while(--_0x40ff2b){_0x14d3b0['push'](_0x14d3b0['shift']());}};_0x296d17(++_0x15ae4a);}(_0x0cd6,0x113));var _0x60cd=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x0cd6[_0x5bf420];return _0x1c5255;};'use strict';var pdf=require(_0x60cd('0x0'));var emlformat=require(_0x60cd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x60cd('0x2'));var jsonpatch=require(_0x60cd('0x3'));var rp=require('request-promise');var moment=require(_0x60cd('0x4'));var BPromise=require(_0x60cd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x60cd('0x6'));var sox=require(_0x60cd('0x7'));var csv=require(_0x60cd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x60cd('0x9'));var squel=require('squel');var crypto=require(_0x60cd('0xa'));var jsforce=require(_0x60cd('0xb'));var deskjs=require(_0x60cd('0xc'));var toCsv=require(_0x60cd('0x8'));var querystring=require(_0x60cd('0xd'));var Papa=require(_0x60cd('0xe'));var Redis=require(_0x60cd('0xf'));var authService=require(_0x60cd('0x10'));var qs=require(_0x60cd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x60cd('0x12'))(_0x60cd('0x13'));var utils=require('../../config/utils');var config=require(_0x60cd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38a0ee,_0x3cd9dd){_0x3cd9dd=_0x3cd9dd||0xcc;return function(_0x526b5b){if(_0x526b5b){return _0x38a0ee[_0x60cd('0x15')](_0x3cd9dd);}return _0x38a0ee[_0x60cd('0x16')](_0x3cd9dd)[_0x60cd('0x17')]();};}function respondWithResult(_0x59810e,_0x14076c){_0x14076c=_0x14076c||0xc8;return function(_0x23db86){if(_0x23db86){return _0x59810e['status'](_0x14076c)[_0x60cd('0x18')](_0x23db86);}};}function respondWithFilteredResult(_0x5492cc,_0x1ce3b8){return function(_0x41cc6b){if(_0x41cc6b){var _0x4b4aad=_0x41cc6b[_0x60cd('0x19')],_0x501940=_0x1ce3b8['offset'],_0x3c4446=_0x1ce3b8[_0x60cd('0x1a')]+_0x1ce3b8[_0x60cd('0x1b')],_0x209dde;if(_0x3c4446>=_0x4b4aad){_0x3c4446=_0x4b4aad;_0x209dde=0xc8;}else{_0x209dde=0xce;}_0x5492cc[_0x60cd('0x16')](_0x209dde);return _0x5492cc[_0x60cd('0x1c')](_0x60cd('0x1d'),_0x501940+'-'+_0x3c4446+'/'+_0x4b4aad)[_0x60cd('0x18')](_0x41cc6b);}return null;};}function patchUpdates(_0x131e08){return function(_0x1e5ed5){try{jsonpatch[_0x60cd('0x1e')](_0x1e5ed5,_0x131e08,!![]);}catch(_0x585ad8){return BPromise[_0x60cd('0x1f')](_0x585ad8);}return _0x1e5ed5['save']();};}function saveUpdates(_0x4e4478,_0x298eeb){return function(_0x3d9434){if(_0x3d9434){return _0x3d9434['update'](_0x4e4478)[_0x60cd('0x20')](function(_0x13e5cc){return _0x13e5cc;});}return null;};}function removeEntity(_0x4984e4,_0x41642b){return function(_0x4b0f8a){if(_0x4b0f8a){return _0x4b0f8a[_0x60cd('0x21')]()[_0x60cd('0x20')](function(){var _0x5debba=_0x4b0f8a[_0x60cd('0x22')]({'plain':!![]});var _0x5f2a13='Templates';return db[_0x60cd('0x23')]['destroy']({'where':{'type':_0x5f2a13,'resourceId':_0x5debba['id']}})[_0x60cd('0x20')](function(){return _0x4b0f8a;});})[_0x60cd('0x20')](function(){_0x4984e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fee65,_0x2f05b5){return function(_0x2175c9){if(!_0x2175c9){_0x3fee65['sendStatus'](0x194);}return _0x2175c9;};}function handleError(_0x469a64,_0x15dd39){_0x15dd39=_0x15dd39||0x1f4;return function(_0x2af8f3){logger[_0x60cd('0x24')](_0x2af8f3['stack']);if(_0x2af8f3[_0x60cd('0x25')]){delete _0x2af8f3[_0x60cd('0x25')];}_0x469a64[_0x60cd('0x16')](_0x15dd39)[_0x60cd('0x26')](_0x2af8f3);};}exports[_0x60cd('0x27')]=function(_0x4173f7,_0x5925fc){var _0x1f4812={},_0x215b8d={},_0x2efb93={'count':0x0,'rows':[]};var _0x55b207=db[_0x60cd('0x28')]['rawAttributes'];_0x215b8d[_0x60cd('0x29')]=_[_0x60cd('0x2a')](_0x55b207);_0x215b8d['query']=_['keys'](_0x4173f7[_0x60cd('0x2b')]);_0x215b8d[_0x60cd('0x2c')]=_[_0x60cd('0x2d')](_0x215b8d['model'],_0x215b8d[_0x60cd('0x2b')]);_0x1f4812[_0x60cd('0x2e')]=_[_0x60cd('0x2d')](_0x215b8d[_0x60cd('0x29')],qs[_0x60cd('0x2f')](_0x4173f7[_0x60cd('0x2b')][_0x60cd('0x2f')]));_0x1f4812['attributes']=_0x1f4812[_0x60cd('0x2e')][_0x60cd('0x30')]?_0x1f4812[_0x60cd('0x2e')]:_0x215b8d[_0x60cd('0x29')];if(!_0x4173f7[_0x60cd('0x2b')][_0x60cd('0x31')]('nolimit')){_0x1f4812['limit']=qs['limit'](_0x4173f7[_0x60cd('0x2b')][_0x60cd('0x1b')]);_0x1f4812[_0x60cd('0x1a')]=qs[_0x60cd('0x1a')](_0x4173f7[_0x60cd('0x2b')][_0x60cd('0x1a')]);}_0x1f4812[_0x60cd('0x32')]=qs['sort'](_0x4173f7[_0x60cd('0x2b')][_0x60cd('0x33')]);_0x1f4812[_0x60cd('0x34')]=qs[_0x60cd('0x2c')](_[_0x60cd('0x35')](_0x4173f7[_0x60cd('0x2b')],_0x215b8d[_0x60cd('0x2c')]));if(_0x4173f7[_0x60cd('0x2b')][_0x60cd('0x36')]){_0x1f4812['where']=_[_0x60cd('0x37')](_0x1f4812[_0x60cd('0x34')],{'$or':_['map'](_0x55b207,function(_0x5e505a){if(_0x5e505a[_0x60cd('0x38')][_0x60cd('0x39')]!==_0x60cd('0x3a')){var _0x182f8e={};_0x182f8e[_0x5e505a[_0x60cd('0x3b')]]={'$like':'%'+_0x4173f7['query'][_0x60cd('0x36')]+'%'};return _0x182f8e;}})});}_0x1f4812=_[_0x60cd('0x37')]({},_0x1f4812,_0x4173f7['options']);var _0x5ac59e={'where':_0x1f4812[_0x60cd('0x34')]};return db[_0x60cd('0x28')][_0x60cd('0x19')](_0x5ac59e)[_0x60cd('0x20')](function(_0x6703e){_0x2efb93[_0x60cd('0x19')]=_0x6703e;if(_0x4173f7['query'][_0x60cd('0x3c')]){_0x1f4812[_0x60cd('0x3d')]=[{'all':!![]}];}return db[_0x60cd('0x28')][_0x60cd('0x3e')](_0x1f4812);})[_0x60cd('0x20')](function(_0x44e286){_0x2efb93[_0x60cd('0x3f')]=_0x44e286;return _0x2efb93;})[_0x60cd('0x20')](respondWithFilteredResult(_0x5925fc,_0x1f4812))[_0x60cd('0x40')](handleError(_0x5925fc,null));};exports['show']=function(_0x4e4d92,_0x594a84){var _0x226a28={'raw':!![],'where':{'id':_0x4e4d92[_0x60cd('0x41')]['id']}},_0x284f73={};_0x284f73['model']=_['keys'](db['Template']['rawAttributes']);_0x284f73[_0x60cd('0x2b')]=_[_0x60cd('0x2a')](_0x4e4d92['query']);_0x284f73['filters']=_['intersection'](_0x284f73[_0x60cd('0x29')],_0x284f73[_0x60cd('0x2b')]);_0x226a28[_0x60cd('0x2e')]=_[_0x60cd('0x2d')](_0x284f73['model'],qs[_0x60cd('0x2f')](_0x4e4d92[_0x60cd('0x2b')]['fields']));_0x226a28[_0x60cd('0x2e')]=_0x226a28[_0x60cd('0x2e')][_0x60cd('0x30')]?_0x226a28[_0x60cd('0x2e')]:_0x284f73[_0x60cd('0x29')];if(_0x4e4d92['query'][_0x60cd('0x3c')]){_0x226a28['include']=[{'all':!![]}];}_0x226a28=_[_0x60cd('0x37')]({},_0x226a28,_0x4e4d92[_0x60cd('0x42')]);return db['Template']['find'](_0x226a28)[_0x60cd('0x20')](handleEntityNotFound(_0x594a84,null))[_0x60cd('0x20')](respondWithResult(_0x594a84,null))[_0x60cd('0x40')](handleError(_0x594a84,null));};exports[_0x60cd('0x43')]=function(_0x731d0c,_0x3bf846){return db[_0x60cd('0x28')][_0x60cd('0x43')](_0x731d0c[_0x60cd('0x44')],{})[_0x60cd('0x20')](function(_0x40c66a){var _0x4bc6a6=_0x731d0c['user']['get']({'plain':!![]});if(!_0x4bc6a6)throw new Error(_0x60cd('0x45'));if(_0x4bc6a6[_0x60cd('0x46')]===_0x60cd('0x47')){var _0x36489b=_0x40c66a[_0x60cd('0x22')]({'plain':!![]});var _0x9bb774=_0x60cd('0x48');return db[_0x60cd('0x49')][_0x60cd('0x4a')]({'where':{'name':_0x9bb774,'userProfileId':_0x4bc6a6[_0x60cd('0x4b')]},'raw':!![]})['then'](function(_0x439b8a){if(_0x439b8a&&_0x439b8a[_0x60cd('0x4c')]===0x0){return db[_0x60cd('0x23')]['create']({'name':_0x36489b[_0x60cd('0x25')],'resourceId':_0x36489b['id'],'type':_0x439b8a[_0x60cd('0x25')],'sectionId':_0x439b8a['id']},{})[_0x60cd('0x20')](function(){return _0x40c66a;});}else{return _0x40c66a;}})[_0x60cd('0x40')](function(_0xf474bc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf474bc);throw _0xf474bc;});}return _0x40c66a;})['then'](respondWithResult(_0x3bf846,0xc9))[_0x60cd('0x40')](handleError(_0x3bf846,null));};exports['update']=function(_0x4c8c94,_0x264fca){if(_0x4c8c94['body']['id']){delete _0x4c8c94[_0x60cd('0x44')]['id'];}return db[_0x60cd('0x28')][_0x60cd('0x4a')]({'where':{'id':_0x4c8c94[_0x60cd('0x41')]['id']}})[_0x60cd('0x20')](handleEntityNotFound(_0x264fca,null))['then'](saveUpdates(_0x4c8c94[_0x60cd('0x44')],null))['then'](respondWithResult(_0x264fca,null))[_0x60cd('0x40')](handleError(_0x264fca,null));};exports[_0x60cd('0x21')]=function(_0x4e9c0b,_0x174475){return db[_0x60cd('0x28')][_0x60cd('0x4a')]({'where':{'id':_0x4e9c0b['params']['id']}})[_0x60cd('0x20')](handleEntityNotFound(_0x174475,null))['then'](removeEntity(_0x174475,null))[_0x60cd('0x40')](handleError(_0x174475,null));}; \ No newline at end of file +var _0x7a3e=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','name','send','index','Template','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','map','type','key','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','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','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x445d20,_0x39643f){var _0x26e5f2=function(_0x1f1e53){while(--_0x1f1e53){_0x445d20['push'](_0x445d20['shift']());}};_0x26e5f2(++_0x39643f);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x51c4a8,_0x2a9ace){_0x51c4a8=_0x51c4a8-0x0;var _0x427d2b=_0x7a3e[_0x51c4a8];return _0x427d2b;};'use strict';var pdf=require(_0xe7a3('0x0'));var emlformat=require(_0xe7a3('0x1'));var rimraf=require(_0xe7a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7a3('0x3'));var rp=require(_0xe7a3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe7a3('0x5'));var util=require(_0xe7a3('0x6'));var path=require(_0xe7a3('0x7'));var sox=require('sox');var csv=require(_0xe7a3('0x8'));var ejs=require(_0xe7a3('0x9'));var fs=require('fs');var _=require(_0xe7a3('0xa'));var squel=require(_0xe7a3('0xb'));var crypto=require(_0xe7a3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe7a3('0xd'));var toCsv=require(_0xe7a3('0x8'));var querystring=require(_0xe7a3('0xe'));var Papa=require(_0xe7a3('0xf'));var Redis=require('ioredis');var authService=require(_0xe7a3('0x10'));var qs=require(_0xe7a3('0x11'));var hardwareService=require(_0xe7a3('0x12'));var logger=require(_0xe7a3('0x13'))(_0xe7a3('0x14'));var utils=require(_0xe7a3('0x15'));var config=require(_0xe7a3('0x16'));var db=require(_0xe7a3('0x17'))['db'];function respondWithStatusCode(_0x1193c4,_0x2fcb86){_0x2fcb86=_0x2fcb86||0xcc;return function(_0x355a0e){if(_0x355a0e){return _0x1193c4[_0xe7a3('0x18')](_0x2fcb86);}return _0x1193c4['status'](_0x2fcb86)[_0xe7a3('0x19')]();};}function respondWithResult(_0x591a5b,_0x407791){_0x407791=_0x407791||0xc8;return function(_0x12798a){if(_0x12798a){return _0x591a5b['status'](_0x407791)['json'](_0x12798a);}};}function respondWithFilteredResult(_0x1eba8f,_0x100a2b){return function(_0x3b7ac6){if(_0x3b7ac6){var _0x194c34=_0x3b7ac6[_0xe7a3('0x1a')],_0xb53629=_0x100a2b[_0xe7a3('0x1b')],_0x2c8d77=_0x100a2b[_0xe7a3('0x1b')]+_0x100a2b['limit'],_0x3da8ba;if(_0x2c8d77>=_0x194c34){_0x2c8d77=_0x194c34;_0x3da8ba=0xc8;}else{_0x3da8ba=0xce;}_0x1eba8f[_0xe7a3('0x1c')](_0x3da8ba);return _0x1eba8f['set']('Content-Range',_0xb53629+'-'+_0x2c8d77+'/'+_0x194c34)[_0xe7a3('0x1d')](_0x3b7ac6);}return null;};}function patchUpdates(_0x535f0c){return function(_0x1795e3){try{jsonpatch[_0xe7a3('0x1e')](_0x1795e3,_0x535f0c,!![]);}catch(_0x486b53){return BPromise[_0xe7a3('0x1f')](_0x486b53);}return _0x1795e3[_0xe7a3('0x20')]();};}function saveUpdates(_0x4713a6,_0x59de24){return function(_0x2db060){if(_0x2db060){return _0x2db060[_0xe7a3('0x21')](_0x4713a6)[_0xe7a3('0x22')](function(_0x47a934){return _0x47a934;});}return null;};}function removeEntity(_0x17ed4b,_0x558e24){return function(_0x1ca41b){if(_0x1ca41b){return _0x1ca41b[_0xe7a3('0x23')]()[_0xe7a3('0x22')](function(){var _0x2d7e5e=_0x1ca41b[_0xe7a3('0x24')]({'plain':!![]});var _0x3917a1=_0xe7a3('0x25');return db[_0xe7a3('0x26')]['destroy']({'where':{'type':_0x3917a1,'resourceId':_0x2d7e5e['id']}})[_0xe7a3('0x22')](function(){return _0x1ca41b;});})[_0xe7a3('0x22')](function(){_0x17ed4b[_0xe7a3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1afeaf,_0x2d7cd2){return function(_0x4535ed){if(!_0x4535ed){_0x1afeaf[_0xe7a3('0x18')](0x194);}return _0x4535ed;};}function handleError(_0x31e27c,_0x58e43b){_0x58e43b=_0x58e43b||0x1f4;return function(_0x27a96e){logger[_0xe7a3('0x27')](_0x27a96e['stack']);if(_0x27a96e[_0xe7a3('0x28')]){delete _0x27a96e['name'];}_0x31e27c[_0xe7a3('0x1c')](_0x58e43b)[_0xe7a3('0x29')](_0x27a96e);};}exports[_0xe7a3('0x2a')]=function(_0xf952e5,_0x54cfbc){var _0x385b38={},_0x36fa2e={},_0x1456ee={'count':0x0,'rows':[]};var _0x3a4253=db[_0xe7a3('0x2b')][_0xe7a3('0x2c')];_0x36fa2e[_0xe7a3('0x2d')]=_[_0xe7a3('0x2e')](_0x3a4253);_0x36fa2e[_0xe7a3('0x2f')]=_[_0xe7a3('0x2e')](_0xf952e5[_0xe7a3('0x2f')]);_0x36fa2e[_0xe7a3('0x30')]=_['intersection'](_0x36fa2e[_0xe7a3('0x2d')],_0x36fa2e[_0xe7a3('0x2f')]);_0x385b38['attributes']=_[_0xe7a3('0x31')](_0x36fa2e['model'],qs['fields'](_0xf952e5['query'][_0xe7a3('0x32')]));_0x385b38[_0xe7a3('0x33')]=_0x385b38[_0xe7a3('0x33')][_0xe7a3('0x34')]?_0x385b38['attributes']:_0x36fa2e[_0xe7a3('0x2d')];if(!_0xf952e5[_0xe7a3('0x2f')][_0xe7a3('0x35')](_0xe7a3('0x36'))){_0x385b38['limit']=qs[_0xe7a3('0x37')](_0xf952e5[_0xe7a3('0x2f')][_0xe7a3('0x37')]);_0x385b38[_0xe7a3('0x1b')]=qs['offset'](_0xf952e5[_0xe7a3('0x2f')][_0xe7a3('0x1b')]);}_0x385b38['order']=qs[_0xe7a3('0x38')](_0xf952e5[_0xe7a3('0x2f')][_0xe7a3('0x38')]);_0x385b38[_0xe7a3('0x39')]=qs[_0xe7a3('0x30')](_[_0xe7a3('0x3a')](_0xf952e5[_0xe7a3('0x2f')],_0x36fa2e[_0xe7a3('0x30')]));if(_0xf952e5[_0xe7a3('0x2f')]['filter']){_0x385b38[_0xe7a3('0x39')]=_[_0xe7a3('0x3b')](_0x385b38[_0xe7a3('0x39')],{'$or':_[_0xe7a3('0x3c')](_0x3a4253,function(_0x5b89c0){if(_0x5b89c0[_0xe7a3('0x3d')][_0xe7a3('0x3e')]!==_0xe7a3('0x3f')){var _0x5e3085={};_0x5e3085[_0x5b89c0['field']]={'$like':'%'+_0xf952e5[_0xe7a3('0x2f')][_0xe7a3('0x40')]+'%'};return _0x5e3085;}})});}_0x385b38=_[_0xe7a3('0x3b')]({},_0x385b38,_0xf952e5[_0xe7a3('0x41')]);var _0x1875e3={'where':_0x385b38[_0xe7a3('0x39')]};return db[_0xe7a3('0x2b')][_0xe7a3('0x1a')](_0x1875e3)[_0xe7a3('0x22')](function(_0x483b59){_0x1456ee[_0xe7a3('0x1a')]=_0x483b59;if(_0xf952e5[_0xe7a3('0x2f')]['includeAll']){_0x385b38[_0xe7a3('0x42')]=[{'all':!![]}];}return db[_0xe7a3('0x2b')][_0xe7a3('0x43')](_0x385b38);})[_0xe7a3('0x22')](function(_0x5161bf){_0x1456ee[_0xe7a3('0x44')]=_0x5161bf;return _0x1456ee;})[_0xe7a3('0x22')](respondWithFilteredResult(_0x54cfbc,_0x385b38))[_0xe7a3('0x45')](handleError(_0x54cfbc,null));};exports[_0xe7a3('0x46')]=function(_0x3d7bca,_0x261820){var _0x246320={'raw':!![],'where':{'id':_0x3d7bca[_0xe7a3('0x47')]['id']}},_0x56251f={};_0x56251f['model']=_[_0xe7a3('0x2e')](db[_0xe7a3('0x2b')][_0xe7a3('0x2c')]);_0x56251f[_0xe7a3('0x2f')]=_[_0xe7a3('0x2e')](_0x3d7bca[_0xe7a3('0x2f')]);_0x56251f['filters']=_[_0xe7a3('0x31')](_0x56251f['model'],_0x56251f[_0xe7a3('0x2f')]);_0x246320[_0xe7a3('0x33')]=_[_0xe7a3('0x31')](_0x56251f['model'],qs[_0xe7a3('0x32')](_0x3d7bca['query']['fields']));_0x246320['attributes']=_0x246320[_0xe7a3('0x33')][_0xe7a3('0x34')]?_0x246320[_0xe7a3('0x33')]:_0x56251f[_0xe7a3('0x2d')];if(_0x3d7bca[_0xe7a3('0x2f')][_0xe7a3('0x48')]){_0x246320[_0xe7a3('0x42')]=[{'all':!![]}];}_0x246320=_[_0xe7a3('0x3b')]({},_0x246320,_0x3d7bca['options']);return db[_0xe7a3('0x2b')][_0xe7a3('0x49')](_0x246320)[_0xe7a3('0x22')](handleEntityNotFound(_0x261820,null))['then'](respondWithResult(_0x261820,null))[_0xe7a3('0x45')](handleError(_0x261820,null));};exports[_0xe7a3('0x4a')]=function(_0x3fb9e1,_0x26de65){return db[_0xe7a3('0x2b')][_0xe7a3('0x4a')](_0x3fb9e1[_0xe7a3('0x4b')],{})['then'](function(_0x561f5b){var _0x1887a5=_0x3fb9e1[_0xe7a3('0x4c')][_0xe7a3('0x24')]({'plain':!![]});if(!_0x1887a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1887a5[_0xe7a3('0x4d')]==='user'){var _0x1bcd17=_0x561f5b[_0xe7a3('0x24')]({'plain':!![]});var _0x13594c='Templates';return db[_0xe7a3('0x4e')][_0xe7a3('0x49')]({'where':{'name':_0x13594c,'userProfileId':_0x1887a5[_0xe7a3('0x4f')]},'raw':!![]})[_0xe7a3('0x22')](function(_0x4d170c){if(_0x4d170c&&_0x4d170c[_0xe7a3('0x50')]===0x0){return db[_0xe7a3('0x26')][_0xe7a3('0x4a')]({'name':_0x1bcd17[_0xe7a3('0x28')],'resourceId':_0x1bcd17['id'],'type':_0x4d170c[_0xe7a3('0x28')],'sectionId':_0x4d170c['id']},{})['then'](function(){return _0x561f5b;});}else{return _0x561f5b;}})[_0xe7a3('0x45')](function(_0x1da55f){logger[_0xe7a3('0x27')](_0xe7a3('0x51'),_0x1da55f);throw _0x1da55f;});}return _0x561f5b;})[_0xe7a3('0x22')](respondWithResult(_0x26de65,0xc9))[_0xe7a3('0x45')](handleError(_0x26de65,null));};exports[_0xe7a3('0x21')]=function(_0x5357a9,_0x1fcd78){if(_0x5357a9[_0xe7a3('0x4b')]['id']){delete _0x5357a9['body']['id'];}return db[_0xe7a3('0x2b')]['find']({'where':{'id':_0x5357a9[_0xe7a3('0x47')]['id']}})[_0xe7a3('0x22')](handleEntityNotFound(_0x1fcd78,null))['then'](saveUpdates(_0x5357a9[_0xe7a3('0x4b')],null))[_0xe7a3('0x22')](respondWithResult(_0x1fcd78,null))[_0xe7a3('0x45')](handleError(_0x1fcd78,null));};exports[_0xe7a3('0x23')]=function(_0x1f2643,_0x57a394){return db[_0xe7a3('0x2b')][_0xe7a3('0x49')]({'where':{'id':_0x1f2643['params']['id']}})[_0xe7a3('0x22')](handleEntityNotFound(_0x57a394,null))[_0xe7a3('0x22')](removeEntity(_0x57a394,null))[_0xe7a3('0x45')](handleError(_0x57a394,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9db600b..d4731fa 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 _0x9c00=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9c00,0x1a0));var _0x09c0=function(_0x222b3f,_0x133be7){_0x222b3f=_0x222b3f-0x0;var _0x20b57a=_0x9c00[_0x222b3f];return _0x20b57a;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3423=['Template','tools_templates','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x1383ff,_0x7c6f31){var _0x2edd17=function(_0x44ed17){while(--_0x44ed17){_0x1383ff['push'](_0x1383ff['shift']());}};_0x2edd17(++_0x7c6f31);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'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 18375e4..abedfbf 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 _0x1934=['raw','attributes','limit','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','Template','findAll','options'];(function(_0x1b2800,_0x44a0c0){var _0x49f467=function(_0x484565){while(--_0x484565){_0x1b2800['push'](_0x1b2800['shift']());}};_0x49f467(++_0x44a0c0);}(_0x1934,0x142));var _0x4193=function(_0x414297,_0x18578e){_0x414297=_0x414297-0x0;var _0x51ea47=_0x1934[_0x414297];return _0x51ea47;};'use strict';var _=require(_0x4193('0x0'));var util=require(_0x4193('0x1'));var moment=require('moment');var BPromise=require(_0x4193('0x2'));var rs=require(_0x4193('0x3'));var fs=require('fs');var Redis=require(_0x4193('0x4'));var db=require(_0x4193('0x5'))['db'];var utils=require(_0x4193('0x6'));var logger=require(_0x4193('0x7'))(_0x4193('0x8'));var config=require('../../config/environment');var jayson=require(_0x4193('0x9'));var client=jayson[_0x4193('0xa')][_0x4193('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c5744,_0x1c8f06,_0x1ce0db){return new BPromise(function(_0x3c6b15,_0x37c88c){return client[_0x4193('0xc')](_0x5c5744,_0x1ce0db)[_0x4193('0xd')](function(_0x134e6f){logger[_0x4193('0xe')](_0x4193('0xf'),_0x1c8f06,_0x4193('0x10'));logger[_0x4193('0x11')](_0x4193('0x12'),_0x1c8f06,'request\x20sent',JSON[_0x4193('0x13')](_0x134e6f));if(_0x134e6f[_0x4193('0x14')]){if(_0x134e6f['error'][_0x4193('0x15')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x1c8f06,_0x134e6f[_0x4193('0x14')][_0x4193('0x16')]);return _0x37c88c(_0x134e6f[_0x4193('0x14')][_0x4193('0x16')]);}logger[_0x4193('0x14')]('Template,\x20%s,\x20%s',_0x1c8f06,_0x134e6f[_0x4193('0x14')]['message']);return _0x3c6b15(_0x134e6f[_0x4193('0x14')][_0x4193('0x16')]);}else{logger[_0x4193('0xe')](_0x4193('0xf'),_0x1c8f06,_0x4193('0x10'));_0x3c6b15(_0x134e6f[_0x4193('0x17')][_0x4193('0x16')]);}})['catch'](function(_0x51ba1a){logger[_0x4193('0x14')]('Template,\x20%s,\x20%s',_0x1c8f06,_0x51ba1a);_0x37c88c(_0x51ba1a);});});}exports[_0x4193('0x18')]=function(_0x10ddae){var _0x3b8d63=this;return new Promise(function(_0x584a79,_0x24dee4){return db[_0x4193('0x19')][_0x4193('0x1a')]({'raw':_0x10ddae[_0x4193('0x1b')]?_0x10ddae['options'][_0x4193('0x1c')]===undefined?!![]:![]:!![],'where':_0x10ddae[_0x4193('0x1b')]?_0x10ddae[_0x4193('0x1b')]['where']||null:null,'attributes':_0x10ddae[_0x4193('0x1b')]?_0x10ddae['options'][_0x4193('0x1d')]||null:null,'limit':_0x10ddae[_0x4193('0x1b')]?_0x10ddae[_0x4193('0x1b')][_0x4193('0x1e')]||null:null,'include':_0x10ddae[_0x4193('0x1b')]?_0x10ddae[_0x4193('0x1b')][_0x4193('0x1f')]?_[_0x4193('0x20')](_0x10ddae[_0x4193('0x1b')]['include'],function(_0x12d750){return{'model':db[_0x12d750[_0x4193('0x21')]],'as':_0x12d750['as'],'attributes':_0x12d750[_0x4193('0x1d')],'include':_0x12d750[_0x4193('0x1f')]?_[_0x4193('0x20')](_0x12d750[_0x4193('0x1f')],function(_0x34bb07){return{'model':db[_0x34bb07[_0x4193('0x21')]],'as':_0x34bb07['as'],'attributes':_0x34bb07[_0x4193('0x1d')],'include':_0x34bb07[_0x4193('0x1f')]?_['map'](_0x34bb07[_0x4193('0x1f')],function(_0x13416d){return{'model':db[_0x13416d[_0x4193('0x21')]],'as':_0x13416d['as'],'attributes':_0x13416d[_0x4193('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4193('0xd')](function(_0x3f2194){logger[_0x4193('0xe')](_0x4193('0x18'),_0x10ddae);logger[_0x4193('0x11')]('GetTemplate',_0x10ddae,JSON[_0x4193('0x13')](_0x3f2194));_0x584a79(_0x3f2194);})[_0x4193('0x22')](function(_0x120681){logger[_0x4193('0x14')]('GetTemplate',_0x120681[_0x4193('0x16')],_0x10ddae);_0x24dee4(_0x3b8d63[_0x4193('0x14')](0x1f4,_0x120681['message']));});});}; \ No newline at end of file +var _0x92ff=['catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92ff,0x11b));var _0xf92f=function(_0x987ca1,_0x25b789){_0x987ca1=_0x987ca1-0x0;var _0x1467ff=_0x92ff[_0x987ca1];return _0x1467ff;};'use strict';var _=require(_0xf92f('0x0'));var util=require('util');var moment=require(_0xf92f('0x1'));var BPromise=require(_0xf92f('0x2'));var rs=require(_0xf92f('0x3'));var fs=require('fs');var Redis=require(_0xf92f('0x4'));var db=require(_0xf92f('0x5'))['db'];var utils=require(_0xf92f('0x6'));var logger=require(_0xf92f('0x7'))(_0xf92f('0x8'));var config=require(_0xf92f('0x9'));var jayson=require(_0xf92f('0xa'));var client=jayson['client'][_0xf92f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49731d,_0x5751c0,_0x4945e9){return new BPromise(function(_0x281d4e,_0x23217b){return client[_0xf92f('0xc')](_0x49731d,_0x4945e9)[_0xf92f('0xd')](function(_0xc76840){logger[_0xf92f('0xe')](_0xf92f('0xf'),_0x5751c0,_0xf92f('0x10'));logger[_0xf92f('0x11')](_0xf92f('0x12'),_0x5751c0,'request\x20sent',JSON['stringify'](_0xc76840));if(_0xc76840['error']){if(_0xc76840['error'][_0xf92f('0x13')]===0x1f4){logger[_0xf92f('0x14')]('Template,\x20%s,\x20%s',_0x5751c0,_0xc76840[_0xf92f('0x14')][_0xf92f('0x15')]);return _0x23217b(_0xc76840[_0xf92f('0x14')][_0xf92f('0x15')]);}logger['error'](_0xf92f('0xf'),_0x5751c0,_0xc76840[_0xf92f('0x14')]['message']);return _0x281d4e(_0xc76840[_0xf92f('0x14')][_0xf92f('0x15')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x5751c0,_0xf92f('0x10'));_0x281d4e(_0xc76840[_0xf92f('0x16')][_0xf92f('0x15')]);}})[_0xf92f('0x17')](function(_0x2519c1){logger[_0xf92f('0x14')](_0xf92f('0xf'),_0x5751c0,_0x2519c1);_0x23217b(_0x2519c1);});});}exports[_0xf92f('0x18')]=function(_0x37b07a){var _0x48ac44=this;return new Promise(function(_0x4aaa3e,_0x4b357d){return db['Template'][_0xf92f('0x19')]({'raw':_0x37b07a[_0xf92f('0x1a')]?_0x37b07a[_0xf92f('0x1a')][_0xf92f('0x1b')]===undefined?!![]:![]:!![],'where':_0x37b07a[_0xf92f('0x1a')]?_0x37b07a['options'][_0xf92f('0x1c')]||null:null,'attributes':_0x37b07a[_0xf92f('0x1a')]?_0x37b07a[_0xf92f('0x1a')][_0xf92f('0x1d')]||null:null,'limit':_0x37b07a[_0xf92f('0x1a')]?_0x37b07a[_0xf92f('0x1a')][_0xf92f('0x1e')]||null:null,'include':_0x37b07a[_0xf92f('0x1a')]?_0x37b07a[_0xf92f('0x1a')][_0xf92f('0x1f')]?_[_0xf92f('0x20')](_0x37b07a[_0xf92f('0x1a')][_0xf92f('0x1f')],function(_0x1a23d3){return{'model':db[_0x1a23d3['model']],'as':_0x1a23d3['as'],'attributes':_0x1a23d3[_0xf92f('0x1d')],'include':_0x1a23d3['include']?_[_0xf92f('0x20')](_0x1a23d3[_0xf92f('0x1f')],function(_0x298612){return{'model':db[_0x298612[_0xf92f('0x21')]],'as':_0x298612['as'],'attributes':_0x298612[_0xf92f('0x1d')],'include':_0x298612[_0xf92f('0x1f')]?_[_0xf92f('0x20')](_0x298612['include'],function(_0xb963d1){return{'model':db[_0xb963d1[_0xf92f('0x21')]],'as':_0xb963d1['as'],'attributes':_0xb963d1[_0xf92f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf92f('0xd')](function(_0x20bf71){logger[_0xf92f('0xe')](_0xf92f('0x18'),_0x37b07a);logger[_0xf92f('0x11')](_0xf92f('0x18'),_0x37b07a,JSON['stringify'](_0x20bf71));_0x4aaa3e(_0x20bf71);})[_0xf92f('0x17')](function(_0x248ef9){logger[_0xf92f('0x14')](_0xf92f('0x18'),_0x248ef9[_0xf92f('0x15')],_0x37b07a);_0x4b357d(_0x48ac44['error'](0x1f4,_0x248ef9[_0xf92f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 34a2eb6..2388827 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 _0xa9e0=['Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','update','exports','multer','util','path'];(function(_0x5eb5d3,_0x3d23dd){var _0x446ed4=function(_0x342427){while(--_0x342427){_0x5eb5d3['push'](_0x5eb5d3['shift']());}};_0x446ed4(++_0x3d23dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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['getAllConditions']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')]('/:id/any_conditions',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0xf')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router['put'](_0x0a9e('0x9'),auth['isAuthenticated'](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','update','exports','multer','util','path'];(function(_0x2f3cb3,_0x6315c3){var _0x2ec620=function(_0x5c1bf6){while(--_0x5c1bf6){_0x2f3cb3['push'](_0x2f3cb3['shift']());}};_0x2ec620(++_0x6315c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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['getAllConditions']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')]('/:id/any_conditions',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0xf')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router['put'](_0x0a9e('0x9'),auth['isAuthenticated'](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6b3e0ec..299bd2a 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 _0x3b53=['exports','STRING','BOOLEAN'];(function(_0x42f725,_0x505826){var _0x42c86c=function(_0x27e1a8){while(--_0x27e1a8){_0x42f725['push'](_0x42f725['shift']());}};_0x42c86c(++_0x505826);}(_0x3b53,0xf3));var _0x33b5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3b53[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x33b5('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x33b5('0x1')]},'description':{'type':Sequelize[_0x33b5('0x1')]},'status':{'type':Sequelize[_0x33b5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd800=['exports','STRING','sequelize'];(function(_0x5cc5b2,_0xc7635e){var _0x16fff8=function(_0x6a7890){while(--_0x6a7890){_0x5cc5b2['push'](_0x5cc5b2['shift']());}};_0x16fff8(++_0xc7635e);}(_0xd800,0x1be));var _0x0d80=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xd800[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x0d80('0x0'));module[_0x0d80('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0d80('0x2')]},'description':{'type':Sequelize[_0x0d80('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d7919d9..b37e8a4 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 _0xcdfb=['TriggerId','getActions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','Trigger','keys','query','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','options','include','rows','catch','show','params','rawAttributes','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','hasOwnProperty'];(function(_0x475a83,_0x44135e){var _0x1a866b=function(_0x20eb6c){while(--_0x20eb6c){_0x475a83['push'](_0x475a83['shift']());}};_0x1a866b(++_0x44135e);}(_0xcdfb,0x15e));var _0xbcdf=function(_0x346964,_0x51a7d9){_0x346964=_0x346964-0x0;var _0x49c238=_0xcdfb[_0x346964];return _0x49c238;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbcdf('0x0'));var rimraf=require(_0xbcdf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcdf('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcdf('0x3'));var Mustache=require(_0xbcdf('0x4'));var util=require(_0xbcdf('0x5'));var path=require(_0xbcdf('0x6'));var sox=require(_0xbcdf('0x7'));var csv=require('to-csv');var ejs=require(_0xbcdf('0x8'));var fs=require('fs');var _=require(_0xbcdf('0x9'));var squel=require(_0xbcdf('0xa'));var crypto=require(_0xbcdf('0xb'));var jsforce=require(_0xbcdf('0xc'));var deskjs=require(_0xbcdf('0xd'));var toCsv=require(_0xbcdf('0xe'));var querystring=require(_0xbcdf('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbcdf('0x10'));var qs=require(_0xbcdf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcdf('0x12'))('api');var utils=require(_0xbcdf('0x13'));var config=require(_0xbcdf('0x14'));var db=require(_0xbcdf('0x15'))['db'];function respondWithStatusCode(_0x560b33,_0x273eae){_0x273eae=_0x273eae||0xcc;return function(_0x38fd4c){if(_0x38fd4c){return _0x560b33['sendStatus'](_0x273eae);}return _0x560b33['status'](_0x273eae)[_0xbcdf('0x16')]();};}function respondWithResult(_0x28d78a,_0x34238e){_0x34238e=_0x34238e||0xc8;return function(_0xd5709b){if(_0xd5709b){return _0x28d78a[_0xbcdf('0x17')](_0x34238e)[_0xbcdf('0x18')](_0xd5709b);}};}function respondWithFilteredResult(_0x978c64,_0x18fb90){return function(_0x34ceb7){if(_0x34ceb7){var _0x4a19e8=_0x34ceb7[_0xbcdf('0x19')],_0x24a157=_0x18fb90['offset'],_0x21347c=_0x18fb90[_0xbcdf('0x1a')]+_0x18fb90[_0xbcdf('0x1b')],_0x3fe15e;if(_0x21347c>=_0x4a19e8){_0x21347c=_0x4a19e8;_0x3fe15e=0xc8;}else{_0x3fe15e=0xce;}_0x978c64['status'](_0x3fe15e);return _0x978c64[_0xbcdf('0x1c')]('Content-Range',_0x24a157+'-'+_0x21347c+'/'+_0x4a19e8)[_0xbcdf('0x18')](_0x34ceb7);}return null;};}function patchUpdates(_0x1757c8){return function(_0x2330b1){try{jsonpatch[_0xbcdf('0x1d')](_0x2330b1,_0x1757c8,!![]);}catch(_0x1cbe89){return BPromise[_0xbcdf('0x1e')](_0x1cbe89);}return _0x2330b1[_0xbcdf('0x1f')]();};}function saveUpdates(_0x1aeb4c,_0x4d36e0){return function(_0x148a5e){if(_0x148a5e){return _0x148a5e[_0xbcdf('0x20')](_0x1aeb4c)['then'](function(_0x1c3435){return _0x1c3435;});}return null;};}function removeEntity(_0x4a1513,_0xd51f08){return function(_0x1e38ac){if(_0x1e38ac){return _0x1e38ac['destroy']()[_0xbcdf('0x21')](function(){var _0xf92970=_0x1e38ac[_0xbcdf('0x22')]({'plain':!![]});var _0x422567='Triggers';return db[_0xbcdf('0x23')][_0xbcdf('0x24')]({'where':{'type':_0x422567,'resourceId':_0xf92970['id']}})[_0xbcdf('0x21')](function(){return _0x1e38ac;});})[_0xbcdf('0x21')](function(){_0x4a1513[_0xbcdf('0x17')](0xcc)[_0xbcdf('0x16')]();});}};}function handleEntityNotFound(_0x5f5d15,_0x1991e3){return function(_0x388ba2){if(!_0x388ba2){_0x5f5d15['sendStatus'](0x194);}return _0x388ba2;};}function handleError(_0x10b65d,_0x5802b3){_0x5802b3=_0x5802b3||0x1f4;return function(_0x35fda5){logger[_0xbcdf('0x25')](_0x35fda5['stack']);if(_0x35fda5[_0xbcdf('0x26')]){delete _0x35fda5[_0xbcdf('0x26')];}_0x10b65d['status'](_0x5802b3)[_0xbcdf('0x27')](_0x35fda5);};}exports[_0xbcdf('0x28')]=function(_0x404667,_0x1c5e72){var _0xbb94d4={},_0x174acb={},_0x878105={'count':0x0,'rows':[]};var _0x11947b=db[_0xbcdf('0x29')]['rawAttributes'];_0x174acb['model']=_[_0xbcdf('0x2a')](_0x11947b);_0x174acb[_0xbcdf('0x2b')]=_[_0xbcdf('0x2a')](_0x404667[_0xbcdf('0x2b')]);_0x174acb['filters']=_[_0xbcdf('0x2c')](_0x174acb[_0xbcdf('0x2d')],_0x174acb[_0xbcdf('0x2b')]);_0xbb94d4[_0xbcdf('0x2e')]=_[_0xbcdf('0x2c')](_0x174acb[_0xbcdf('0x2d')],qs[_0xbcdf('0x2f')](_0x404667[_0xbcdf('0x2b')]['fields']));_0xbb94d4['attributes']=_0xbb94d4[_0xbcdf('0x2e')]['length']?_0xbb94d4[_0xbcdf('0x2e')]:_0x174acb[_0xbcdf('0x2d')];if(!_0x404667[_0xbcdf('0x2b')]['hasOwnProperty'](_0xbcdf('0x30'))){_0xbb94d4['limit']=qs[_0xbcdf('0x1b')](_0x404667[_0xbcdf('0x2b')]['limit']);_0xbb94d4[_0xbcdf('0x1a')]=qs[_0xbcdf('0x1a')](_0x404667[_0xbcdf('0x2b')][_0xbcdf('0x1a')]);}_0xbb94d4[_0xbcdf('0x31')]=qs['sort'](_0x404667[_0xbcdf('0x2b')][_0xbcdf('0x32')]);_0xbb94d4[_0xbcdf('0x33')]=qs[_0xbcdf('0x34')](_[_0xbcdf('0x35')](_0x404667[_0xbcdf('0x2b')],_0x174acb['filters']));if(_0x404667[_0xbcdf('0x2b')][_0xbcdf('0x36')]){_0xbb94d4[_0xbcdf('0x33')]=_[_0xbcdf('0x37')](_0xbb94d4[_0xbcdf('0x33')],{'$or':_[_0xbcdf('0x38')](_0x11947b,function(_0x5cdc10){if(_0x5cdc10[_0xbcdf('0x39')][_0xbcdf('0x3a')]!=='VIRTUAL'){var _0x5b79e3={};_0x5b79e3[_0x5cdc10['field']]={'$like':'%'+_0x404667[_0xbcdf('0x2b')][_0xbcdf('0x36')]+'%'};return _0x5b79e3;}})});}_0xbb94d4=_[_0xbcdf('0x37')]({},_0xbb94d4,_0x404667[_0xbcdf('0x3b')]);var _0x2f6691={'where':_0xbb94d4[_0xbcdf('0x33')]};return db[_0xbcdf('0x29')][_0xbcdf('0x19')](_0x2f6691)[_0xbcdf('0x21')](function(_0x3ab1d1){_0x878105[_0xbcdf('0x19')]=_0x3ab1d1;if(_0x404667[_0xbcdf('0x2b')]['includeAll']){_0xbb94d4[_0xbcdf('0x3c')]=[{'all':!![]}];}return db[_0xbcdf('0x29')]['findAll'](_0xbb94d4);})[_0xbcdf('0x21')](function(_0x1f3f66){_0x878105[_0xbcdf('0x3d')]=_0x1f3f66;return _0x878105;})[_0xbcdf('0x21')](respondWithFilteredResult(_0x1c5e72,_0xbb94d4))[_0xbcdf('0x3e')](handleError(_0x1c5e72,null));};exports[_0xbcdf('0x3f')]=function(_0x472cf8,_0x144f48){var _0x2e968d={'raw':![],'where':{'id':_0x472cf8[_0xbcdf('0x40')]['id']}},_0x359447={};_0x359447[_0xbcdf('0x2d')]=_['keys'](db[_0xbcdf('0x29')][_0xbcdf('0x41')]);_0x359447['query']=_[_0xbcdf('0x2a')](_0x472cf8[_0xbcdf('0x2b')]);_0x359447[_0xbcdf('0x34')]=_['intersection'](_0x359447[_0xbcdf('0x2d')],_0x359447[_0xbcdf('0x2b')]);_0x2e968d[_0xbcdf('0x2e')]=_[_0xbcdf('0x2c')](_0x359447['model'],qs[_0xbcdf('0x2f')](_0x472cf8[_0xbcdf('0x2b')][_0xbcdf('0x2f')]));_0x2e968d['attributes']=_0x2e968d[_0xbcdf('0x2e')][_0xbcdf('0x42')]?_0x2e968d[_0xbcdf('0x2e')]:_0x359447[_0xbcdf('0x2d')];if(_0x472cf8[_0xbcdf('0x2b')]['includeAll']){_0x2e968d[_0xbcdf('0x3c')]=[{'all':!![]}];}_0x2e968d=_[_0xbcdf('0x37')]({},_0x2e968d,_0x472cf8[_0xbcdf('0x3b')]);return db[_0xbcdf('0x29')]['find'](_0x2e968d)[_0xbcdf('0x21')](handleEntityNotFound(_0x144f48,null))[_0xbcdf('0x21')](respondWithResult(_0x144f48,null))[_0xbcdf('0x3e')](handleError(_0x144f48,null));};exports[_0xbcdf('0x43')]=function(_0x5882b9,_0x1d2703){return db[_0xbcdf('0x29')][_0xbcdf('0x43')](_0x5882b9[_0xbcdf('0x44')],{})[_0xbcdf('0x21')](function(_0x3cb557){var _0x4b036e=_0x5882b9[_0xbcdf('0x45')][_0xbcdf('0x22')]({'plain':!![]});if(!_0x4b036e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b036e[_0xbcdf('0x46')]===_0xbcdf('0x45')){var _0x1449a3=_0x3cb557[_0xbcdf('0x22')]({'plain':!![]});var _0x227f1e='Triggers';return db[_0xbcdf('0x47')][_0xbcdf('0x48')]({'where':{'name':_0x227f1e,'userProfileId':_0x4b036e[_0xbcdf('0x49')]},'raw':!![]})[_0xbcdf('0x21')](function(_0x34d727){if(_0x34d727&&_0x34d727[_0xbcdf('0x4a')]===0x0){return db[_0xbcdf('0x23')][_0xbcdf('0x43')]({'name':_0x1449a3[_0xbcdf('0x26')],'resourceId':_0x1449a3['id'],'type':_0x34d727[_0xbcdf('0x26')],'sectionId':_0x34d727['id']},{})['then'](function(){return _0x3cb557;});}else{return _0x3cb557;}})[_0xbcdf('0x3e')](function(_0x1c03cf){logger[_0xbcdf('0x25')](_0xbcdf('0x4b'),_0x1c03cf);throw _0x1c03cf;});}return _0x3cb557;})[_0xbcdf('0x21')](respondWithResult(_0x1d2703,0xc9))['catch'](handleError(_0x1d2703,null));};exports[_0xbcdf('0x20')]=function(_0x30ca1c,_0x5323b9){if(_0x30ca1c[_0xbcdf('0x44')]['id']){delete _0x30ca1c[_0xbcdf('0x44')]['id'];}return db[_0xbcdf('0x29')][_0xbcdf('0x48')]({'where':{'id':_0x30ca1c[_0xbcdf('0x40')]['id']}})['then'](handleEntityNotFound(_0x5323b9,null))['then'](saveUpdates(_0x30ca1c[_0xbcdf('0x44')],null))[_0xbcdf('0x21')](respondWithResult(_0x5323b9,null))[_0xbcdf('0x3e')](handleError(_0x5323b9,null));};exports[_0xbcdf('0x24')]=function(_0x35be64,_0x2db8a9){return db[_0xbcdf('0x29')][_0xbcdf('0x48')]({'where':{'id':_0x35be64[_0xbcdf('0x40')]['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x2db8a9,null))[_0xbcdf('0x21')](removeEntity(_0x2db8a9,null))['catch'](handleError(_0x2db8a9,null));};exports[_0xbcdf('0x4c')]=function(_0x205745,_0x26d860,_0x310974){if(_0x205745['body']['id']){delete _0x205745[_0xbcdf('0x44')]['id'];}return db[_0xbcdf('0x29')][_0xbcdf('0x48')]({'where':{'id':_0x205745[_0xbcdf('0x40')]['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x26d860,null))[_0xbcdf('0x21')](function(_0x1da7ad){if(_0x1da7ad){_0x205745[_0xbcdf('0x44')][_0xbcdf('0x4d')]=_0x1da7ad['id'];return db['Condition'][_0xbcdf('0x43')](_0x205745[_0xbcdf('0x44')]);}})[_0xbcdf('0x21')](respondWithResult(_0x26d860,null))[_0xbcdf('0x3e')](handleError(_0x26d860,null));};exports[_0xbcdf('0x4e')]=function(_0x270105,_0x456164,_0x3eb6f3){if(_0x270105[_0xbcdf('0x44')]['id']){delete _0x270105[_0xbcdf('0x44')]['id'];}return db[_0xbcdf('0x29')][_0xbcdf('0x48')]({'where':{'id':_0x270105['params']['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x456164,null))['then'](function(_0x71cd7e){if(_0x71cd7e){_0x270105[_0xbcdf('0x44')][_0xbcdf('0x4f')]=_0x71cd7e['id'];return db[_0xbcdf('0x50')][_0xbcdf('0x43')](_0x270105['body']);}})[_0xbcdf('0x21')](respondWithResult(_0x456164,null))[_0xbcdf('0x3e')](handleError(_0x456164,null));};exports[_0xbcdf('0x51')]=function(_0x1b3a6d,_0x202847,_0xc98ea){var _0x5a83be={};var _0x583669={};var _0xd2aa5f;var _0x1c5bf6;return db['Trigger']['findOne']({'where':{'id':_0x1b3a6d[_0xbcdf('0x40')]['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x202847,null))[_0xbcdf('0x21')](function(_0x36fce4){if(_0x36fce4){_0xd2aa5f=_0x36fce4;_0x583669[_0xbcdf('0x2d')]=_[_0xbcdf('0x2a')](db[_0xbcdf('0x50')][_0xbcdf('0x41')]);_0x583669['query']=_[_0xbcdf('0x2a')](_0x1b3a6d[_0xbcdf('0x2b')]);_0x583669[_0xbcdf('0x34')]=_[_0xbcdf('0x2c')](_0x583669[_0xbcdf('0x2d')],_0x583669[_0xbcdf('0x2b')]);_0x5a83be[_0xbcdf('0x2e')]=_['intersection'](_0x583669[_0xbcdf('0x2d')],qs['fields'](_0x1b3a6d['query'][_0xbcdf('0x2f')]));_0x5a83be['attributes']=_0x5a83be[_0xbcdf('0x2e')][_0xbcdf('0x42')]?_0x5a83be['attributes']:_0x583669['model'];_0x5a83be['order']=qs['sort'](_0x1b3a6d[_0xbcdf('0x2b')][_0xbcdf('0x32')]);_0x5a83be[_0xbcdf('0x33')]=qs[_0xbcdf('0x34')](_['pick'](_0x1b3a6d[_0xbcdf('0x2b')],_0x583669['filters']));if(_0x1b3a6d[_0xbcdf('0x2b')][_0xbcdf('0x36')]){_0x5a83be[_0xbcdf('0x33')]=_[_0xbcdf('0x37')](_0x5a83be[_0xbcdf('0x33')],{'$or':_['map'](_0x5a83be[_0xbcdf('0x2e')],function(_0x16b13f){var _0x35c5d7={};_0x35c5d7[_0x16b13f]={'$like':'%'+_0x1b3a6d['query'][_0xbcdf('0x36')]+'%'};return _0x35c5d7;})});}_0x5a83be=_[_0xbcdf('0x37')]({},_0x5a83be,_0x1b3a6d[_0xbcdf('0x3b')]);return _0xd2aa5f['getAllConditions'](_0x5a83be);}})['then'](function(_0x44aeb5){if(_0x44aeb5){_0x1c5bf6=_0x44aeb5[_0xbcdf('0x42')];if(!_0x1b3a6d['query']['hasOwnProperty'](_0xbcdf('0x30'))){_0x5a83be['limit']=qs['limit'](_0x1b3a6d[_0xbcdf('0x2b')][_0xbcdf('0x1b')]);_0x5a83be[_0xbcdf('0x1a')]=qs[_0xbcdf('0x1a')](_0x1b3a6d['query']['offset']);}return _0xd2aa5f['getAllConditions'](_0x5a83be);}})[_0xbcdf('0x21')](function(_0x13e943){if(_0x13e943){return _0x13e943?{'count':_0x1c5bf6,'rows':_0x13e943}:null;}})['then'](respondWithResult(_0x202847,null))[_0xbcdf('0x3e')](handleError(_0x202847,null));};exports[_0xbcdf('0x52')]=function(_0x2ec976,_0x4a5316,_0x249120){var _0x4b9e75={};var _0x7c554c={};var _0x5ada4c;var _0x225a37;return db[_0xbcdf('0x29')][_0xbcdf('0x53')]({'where':{'id':_0x2ec976['params']['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x4a5316,null))['then'](function(_0xf5708){if(_0xf5708){_0x5ada4c=_0xf5708;_0x7c554c[_0xbcdf('0x2d')]=_[_0xbcdf('0x2a')](db[_0xbcdf('0x50')][_0xbcdf('0x41')]);_0x7c554c[_0xbcdf('0x2b')]=_[_0xbcdf('0x2a')](_0x2ec976[_0xbcdf('0x2b')]);_0x7c554c[_0xbcdf('0x34')]=_[_0xbcdf('0x2c')](_0x7c554c[_0xbcdf('0x2d')],_0x7c554c[_0xbcdf('0x2b')]);_0x4b9e75['attributes']=_['intersection'](_0x7c554c['model'],qs[_0xbcdf('0x2f')](_0x2ec976[_0xbcdf('0x2b')][_0xbcdf('0x2f')]));_0x4b9e75['attributes']=_0x4b9e75[_0xbcdf('0x2e')][_0xbcdf('0x42')]?_0x4b9e75[_0xbcdf('0x2e')]:_0x7c554c[_0xbcdf('0x2d')];_0x4b9e75[_0xbcdf('0x31')]=qs[_0xbcdf('0x32')](_0x2ec976['query'][_0xbcdf('0x32')]);_0x4b9e75[_0xbcdf('0x33')]=qs[_0xbcdf('0x34')](_[_0xbcdf('0x35')](_0x2ec976['query'],_0x7c554c[_0xbcdf('0x34')]));if(_0x2ec976[_0xbcdf('0x2b')][_0xbcdf('0x36')]){_0x4b9e75[_0xbcdf('0x33')]=_[_0xbcdf('0x37')](_0x4b9e75[_0xbcdf('0x33')],{'$or':_[_0xbcdf('0x38')](_0x4b9e75['attributes'],function(_0x2a9bba){var _0x27d916={};_0x27d916[_0x2a9bba]={'$like':'%'+_0x2ec976[_0xbcdf('0x2b')][_0xbcdf('0x36')]+'%'};return _0x27d916;})});}_0x4b9e75=_[_0xbcdf('0x37')]({},_0x4b9e75,_0x2ec976['options']);return _0x5ada4c[_0xbcdf('0x52')](_0x4b9e75);}})['then'](function(_0x370b84){if(_0x370b84){_0x225a37=_0x370b84[_0xbcdf('0x42')];if(!_0x2ec976[_0xbcdf('0x2b')][_0xbcdf('0x54')](_0xbcdf('0x30'))){_0x4b9e75[_0xbcdf('0x1b')]=qs[_0xbcdf('0x1b')](_0x2ec976[_0xbcdf('0x2b')]['limit']);_0x4b9e75['offset']=qs[_0xbcdf('0x1a')](_0x2ec976[_0xbcdf('0x2b')]['offset']);}return _0x5ada4c[_0xbcdf('0x52')](_0x4b9e75);}})[_0xbcdf('0x21')](function(_0x14caef){if(_0x14caef){return _0x14caef?{'count':_0x225a37,'rows':_0x14caef}:null;}})['then'](respondWithResult(_0x4a5316,null))['catch'](handleError(_0x4a5316,null));};exports['addAction']=function(_0x57955d,_0x487450,_0x5e459e){if(_0x57955d[_0xbcdf('0x44')]['id']){delete _0x57955d[_0xbcdf('0x44')]['id'];}return db['Trigger'][_0xbcdf('0x48')]({'where':{'id':_0x57955d[_0xbcdf('0x40')]['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x487450,null))['then'](function(_0x3a0636){if(_0x3a0636){_0x57955d['body'][_0xbcdf('0x55')]=_0x3a0636['id'];return db['Action'][_0xbcdf('0x43')](_0x57955d[_0xbcdf('0x44')]);}})[_0xbcdf('0x21')](respondWithResult(_0x487450,null))[_0xbcdf('0x3e')](handleError(_0x487450,null));};exports['getActions']=function(_0x525cf3,_0x493347,_0x3ad185){var _0x53f779={};var _0x317689={};var _0x5db6ef;var _0x8ead4f;return db['Trigger'][_0xbcdf('0x53')]({'where':{'id':_0x525cf3['params']['id']}})[_0xbcdf('0x21')](handleEntityNotFound(_0x493347,null))[_0xbcdf('0x21')](function(_0x3e5359){if(_0x3e5359){_0x5db6ef=_0x3e5359;_0x317689[_0xbcdf('0x2d')]=_['keys'](db['Action'][_0xbcdf('0x41')]);_0x317689[_0xbcdf('0x2b')]=_['keys'](_0x525cf3[_0xbcdf('0x2b')]);_0x317689[_0xbcdf('0x34')]=_[_0xbcdf('0x2c')](_0x317689[_0xbcdf('0x2d')],_0x317689[_0xbcdf('0x2b')]);_0x53f779[_0xbcdf('0x2e')]=_[_0xbcdf('0x2c')](_0x317689['model'],qs[_0xbcdf('0x2f')](_0x525cf3['query'][_0xbcdf('0x2f')]));_0x53f779[_0xbcdf('0x2e')]=_0x53f779[_0xbcdf('0x2e')][_0xbcdf('0x42')]?_0x53f779[_0xbcdf('0x2e')]:_0x317689[_0xbcdf('0x2d')];_0x53f779[_0xbcdf('0x31')]=qs[_0xbcdf('0x32')](_0x525cf3[_0xbcdf('0x2b')]['sort']);_0x53f779['where']=qs[_0xbcdf('0x34')](_[_0xbcdf('0x35')](_0x525cf3[_0xbcdf('0x2b')],_0x317689[_0xbcdf('0x34')]));if(_0x525cf3[_0xbcdf('0x2b')]['filter']){_0x53f779[_0xbcdf('0x33')]=_['merge'](_0x53f779[_0xbcdf('0x33')],{'$or':_[_0xbcdf('0x38')](_0x53f779['attributes'],function(_0xd37c30){var _0x3e41e3={};_0x3e41e3[_0xd37c30]={'$like':'%'+_0x525cf3['query'][_0xbcdf('0x36')]+'%'};return _0x3e41e3;})});}_0x53f779=_[_0xbcdf('0x37')]({},_0x53f779,_0x525cf3[_0xbcdf('0x3b')]);return _0x5db6ef[_0xbcdf('0x56')](_0x53f779);}})['then'](function(_0x382be5){if(_0x382be5){_0x8ead4f=_0x382be5[_0xbcdf('0x42')];if(!_0x525cf3[_0xbcdf('0x2b')][_0xbcdf('0x54')](_0xbcdf('0x30'))){_0x53f779[_0xbcdf('0x1b')]=qs[_0xbcdf('0x1b')](_0x525cf3[_0xbcdf('0x2b')]['limit']);_0x53f779[_0xbcdf('0x1a')]=qs[_0xbcdf('0x1a')](_0x525cf3['query'][_0xbcdf('0x1a')]);}return _0x5db6ef[_0xbcdf('0x56')](_0x53f779);}})[_0xbcdf('0x21')](function(_0x1b13e3){if(_0x1b13e3){return _0x1b13e3?{'count':_0x8ead4f,'rows':_0x1b13e3}:null;}})[_0xbcdf('0x21')](respondWithResult(_0x493347,null))['catch'](handleError(_0x493347,null));}; \ No newline at end of file +var _0x74dd=['status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','error','stack','send','index','Trigger','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','includeAll','findAll','rows','show','include','find','catch','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','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','hasOwnProperty','nolimit','getAnyConditions','findOne','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x12e645,_0x4455fc){var _0x346ea0=function(_0x56053d){while(--_0x56053d){_0x12e645['push'](_0x12e645['shift']());}};_0x346ea0(++_0x4455fc);}(_0x74dd,0x154));var _0xd74d=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0x74dd[_0x294b6];return _0x38bb97;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd74d('0x0'));var zipdir=require(_0xd74d('0x1'));var jsonpatch=require(_0xd74d('0x2'));var rp=require(_0xd74d('0x3'));var moment=require('moment');var BPromise=require(_0xd74d('0x4'));var Mustache=require(_0xd74d('0x5'));var util=require('util');var path=require(_0xd74d('0x6'));var sox=require(_0xd74d('0x7'));var csv=require(_0xd74d('0x8'));var ejs=require(_0xd74d('0x9'));var fs=require('fs');var _=require(_0xd74d('0xa'));var squel=require('squel');var crypto=require(_0xd74d('0xb'));var jsforce=require(_0xd74d('0xc'));var deskjs=require(_0xd74d('0xd'));var toCsv=require(_0xd74d('0x8'));var querystring=require('querystring');var Papa=require(_0xd74d('0xe'));var Redis=require(_0xd74d('0xf'));var authService=require(_0xd74d('0x10'));var qs=require(_0xd74d('0x11'));var hardwareService=require(_0xd74d('0x12'));var logger=require('../../config/logger')(_0xd74d('0x13'));var utils=require(_0xd74d('0x14'));var config=require(_0xd74d('0x15'));var db=require(_0xd74d('0x16'))['db'];function respondWithStatusCode(_0x254e4a,_0x162b95){_0x162b95=_0x162b95||0xcc;return function(_0x21f7e3){if(_0x21f7e3){return _0x254e4a[_0xd74d('0x17')](_0x162b95);}return _0x254e4a[_0xd74d('0x18')](_0x162b95)['end']();};}function respondWithResult(_0xb7a6fa,_0x39d899){_0x39d899=_0x39d899||0xc8;return function(_0x53331c){if(_0x53331c){return _0xb7a6fa[_0xd74d('0x18')](_0x39d899)[_0xd74d('0x19')](_0x53331c);}};}function respondWithFilteredResult(_0x515820,_0x4a296b){return function(_0x263de2){if(_0x263de2){var _0x290ed5=_0x263de2[_0xd74d('0x1a')],_0x145d3f=_0x4a296b[_0xd74d('0x1b')],_0x259a0d=_0x4a296b[_0xd74d('0x1b')]+_0x4a296b[_0xd74d('0x1c')],_0xd32649;if(_0x259a0d>=_0x290ed5){_0x259a0d=_0x290ed5;_0xd32649=0xc8;}else{_0xd32649=0xce;}_0x515820[_0xd74d('0x18')](_0xd32649);return _0x515820[_0xd74d('0x1d')]('Content-Range',_0x145d3f+'-'+_0x259a0d+'/'+_0x290ed5)[_0xd74d('0x19')](_0x263de2);}return null;};}function patchUpdates(_0x55621d){return function(_0x8cbacb){try{jsonpatch[_0xd74d('0x1e')](_0x8cbacb,_0x55621d,!![]);}catch(_0x7e2ad1){return BPromise[_0xd74d('0x1f')](_0x7e2ad1);}return _0x8cbacb[_0xd74d('0x20')]();};}function saveUpdates(_0x4fdd73,_0x5a757d){return function(_0x10a825){if(_0x10a825){return _0x10a825[_0xd74d('0x21')](_0x4fdd73)[_0xd74d('0x22')](function(_0x1fc3cb){return _0x1fc3cb;});}return null;};}function removeEntity(_0x4aa084,_0x1b4be9){return function(_0x109c81){if(_0x109c81){return _0x109c81[_0xd74d('0x23')]()[_0xd74d('0x22')](function(){var _0x21197a=_0x109c81[_0xd74d('0x24')]({'plain':!![]});var _0x4c5528='Triggers';return db['UserProfileResource'][_0xd74d('0x23')]({'where':{'type':_0x4c5528,'resourceId':_0x21197a['id']}})[_0xd74d('0x22')](function(){return _0x109c81;});})['then'](function(){_0x4aa084[_0xd74d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x558760,_0x3db974){return function(_0x17f2ed){if(!_0x17f2ed){_0x558760[_0xd74d('0x17')](0x194);}return _0x17f2ed;};}function handleError(_0x3353f2,_0x1aa671){_0x1aa671=_0x1aa671||0x1f4;return function(_0x3920bc){logger[_0xd74d('0x25')](_0x3920bc[_0xd74d('0x26')]);if(_0x3920bc['name']){delete _0x3920bc['name'];}_0x3353f2[_0xd74d('0x18')](_0x1aa671)[_0xd74d('0x27')](_0x3920bc);};}exports[_0xd74d('0x28')]=function(_0x32fbca,_0x3b86c3){var _0x57b14b={},_0x43d03b={},_0x1c6931={'count':0x0,'rows':[]};var _0x17c0d5=db[_0xd74d('0x29')][_0xd74d('0x2a')];_0x43d03b[_0xd74d('0x2b')]=_[_0xd74d('0x2c')](_0x17c0d5);_0x43d03b['query']=_[_0xd74d('0x2c')](_0x32fbca[_0xd74d('0x2d')]);_0x43d03b[_0xd74d('0x2e')]=_[_0xd74d('0x2f')](_0x43d03b['model'],_0x43d03b[_0xd74d('0x2d')]);_0x57b14b[_0xd74d('0x30')]=_[_0xd74d('0x2f')](_0x43d03b['model'],qs[_0xd74d('0x31')](_0x32fbca[_0xd74d('0x2d')][_0xd74d('0x31')]));_0x57b14b[_0xd74d('0x30')]=_0x57b14b[_0xd74d('0x30')][_0xd74d('0x32')]?_0x57b14b[_0xd74d('0x30')]:_0x43d03b[_0xd74d('0x2b')];if(!_0x32fbca[_0xd74d('0x2d')]['hasOwnProperty']('nolimit')){_0x57b14b[_0xd74d('0x1c')]=qs[_0xd74d('0x1c')](_0x32fbca[_0xd74d('0x2d')][_0xd74d('0x1c')]);_0x57b14b[_0xd74d('0x1b')]=qs[_0xd74d('0x1b')](_0x32fbca['query']['offset']);}_0x57b14b[_0xd74d('0x33')]=qs[_0xd74d('0x34')](_0x32fbca[_0xd74d('0x2d')][_0xd74d('0x34')]);_0x57b14b['where']=qs[_0xd74d('0x2e')](_[_0xd74d('0x35')](_0x32fbca['query'],_0x43d03b[_0xd74d('0x2e')]));if(_0x32fbca[_0xd74d('0x2d')][_0xd74d('0x36')]){_0x57b14b[_0xd74d('0x37')]=_[_0xd74d('0x38')](_0x57b14b[_0xd74d('0x37')],{'$or':_[_0xd74d('0x39')](_0x17c0d5,function(_0x2add7d){if(_0x2add7d[_0xd74d('0x3a')]['key']!==_0xd74d('0x3b')){var _0x3b7eb4={};_0x3b7eb4[_0x2add7d[_0xd74d('0x3c')]]={'$like':'%'+_0x32fbca[_0xd74d('0x2d')][_0xd74d('0x36')]+'%'};return _0x3b7eb4;}})});}_0x57b14b=_[_0xd74d('0x38')]({},_0x57b14b,_0x32fbca[_0xd74d('0x3d')]);var _0x1cce05={'where':_0x57b14b[_0xd74d('0x37')]};return db[_0xd74d('0x29')]['count'](_0x1cce05)[_0xd74d('0x22')](function(_0x23ecfd){_0x1c6931[_0xd74d('0x1a')]=_0x23ecfd;if(_0x32fbca[_0xd74d('0x2d')][_0xd74d('0x3e')]){_0x57b14b['include']=[{'all':!![]}];}return db[_0xd74d('0x29')][_0xd74d('0x3f')](_0x57b14b);})[_0xd74d('0x22')](function(_0x344273){_0x1c6931[_0xd74d('0x40')]=_0x344273;return _0x1c6931;})[_0xd74d('0x22')](respondWithFilteredResult(_0x3b86c3,_0x57b14b))['catch'](handleError(_0x3b86c3,null));};exports[_0xd74d('0x41')]=function(_0x1b5096,_0x40722b){var _0x46f1e6={'raw':![],'where':{'id':_0x1b5096['params']['id']}},_0x74cca3={};_0x74cca3[_0xd74d('0x2b')]=_['keys'](db[_0xd74d('0x29')][_0xd74d('0x2a')]);_0x74cca3[_0xd74d('0x2d')]=_[_0xd74d('0x2c')](_0x1b5096[_0xd74d('0x2d')]);_0x74cca3['filters']=_['intersection'](_0x74cca3[_0xd74d('0x2b')],_0x74cca3[_0xd74d('0x2d')]);_0x46f1e6[_0xd74d('0x30')]=_[_0xd74d('0x2f')](_0x74cca3[_0xd74d('0x2b')],qs[_0xd74d('0x31')](_0x1b5096['query']['fields']));_0x46f1e6[_0xd74d('0x30')]=_0x46f1e6[_0xd74d('0x30')]['length']?_0x46f1e6['attributes']:_0x74cca3['model'];if(_0x1b5096[_0xd74d('0x2d')][_0xd74d('0x3e')]){_0x46f1e6[_0xd74d('0x42')]=[{'all':!![]}];}_0x46f1e6=_['merge']({},_0x46f1e6,_0x1b5096[_0xd74d('0x3d')]);return db[_0xd74d('0x29')][_0xd74d('0x43')](_0x46f1e6)['then'](handleEntityNotFound(_0x40722b,null))[_0xd74d('0x22')](respondWithResult(_0x40722b,null))[_0xd74d('0x44')](handleError(_0x40722b,null));};exports[_0xd74d('0x45')]=function(_0x16cf05,_0x5e9ffd){return db[_0xd74d('0x29')][_0xd74d('0x45')](_0x16cf05[_0xd74d('0x46')],{})[_0xd74d('0x22')](function(_0x43f97b){var _0x5cc21d=_0x16cf05[_0xd74d('0x47')][_0xd74d('0x24')]({'plain':!![]});if(!_0x5cc21d)throw new Error(_0xd74d('0x48'));if(_0x5cc21d[_0xd74d('0x49')]===_0xd74d('0x47')){var _0x57898c=_0x43f97b['get']({'plain':!![]});var _0x5bedfa='Triggers';return db[_0xd74d('0x4a')][_0xd74d('0x43')]({'where':{'name':_0x5bedfa,'userProfileId':_0x5cc21d['userProfileId']},'raw':!![]})['then'](function(_0x4178c3){if(_0x4178c3&&_0x4178c3[_0xd74d('0x4b')]===0x0){return db[_0xd74d('0x4c')][_0xd74d('0x45')]({'name':_0x57898c['name'],'resourceId':_0x57898c['id'],'type':_0x4178c3['name'],'sectionId':_0x4178c3['id']},{})[_0xd74d('0x22')](function(){return _0x43f97b;});}else{return _0x43f97b;}})[_0xd74d('0x44')](function(_0x260c65){logger['error'](_0xd74d('0x4d'),_0x260c65);throw _0x260c65;});}return _0x43f97b;})['then'](respondWithResult(_0x5e9ffd,0xc9))[_0xd74d('0x44')](handleError(_0x5e9ffd,null));};exports[_0xd74d('0x21')]=function(_0x5e4342,_0x4b84ef){if(_0x5e4342[_0xd74d('0x46')]['id']){delete _0x5e4342[_0xd74d('0x46')]['id'];}return db[_0xd74d('0x29')]['find']({'where':{'id':_0x5e4342[_0xd74d('0x4e')]['id']}})[_0xd74d('0x22')](handleEntityNotFound(_0x4b84ef,null))[_0xd74d('0x22')](saveUpdates(_0x5e4342[_0xd74d('0x46')],null))['then'](respondWithResult(_0x4b84ef,null))['catch'](handleError(_0x4b84ef,null));};exports[_0xd74d('0x23')]=function(_0x292ec0,_0x244737){return db[_0xd74d('0x29')]['find']({'where':{'id':_0x292ec0[_0xd74d('0x4e')]['id']}})[_0xd74d('0x22')](handleEntityNotFound(_0x244737,null))[_0xd74d('0x22')](removeEntity(_0x244737,null))['catch'](handleError(_0x244737,null));};exports[_0xd74d('0x4f')]=function(_0x3024bf,_0xd70120,_0x382498){if(_0x3024bf[_0xd74d('0x46')]['id']){delete _0x3024bf[_0xd74d('0x46')]['id'];}return db['Trigger'][_0xd74d('0x43')]({'where':{'id':_0x3024bf[_0xd74d('0x4e')]['id']}})[_0xd74d('0x22')](handleEntityNotFound(_0xd70120,null))[_0xd74d('0x22')](function(_0x66ba59){if(_0x66ba59){_0x3024bf['body'][_0xd74d('0x50')]=_0x66ba59['id'];return db[_0xd74d('0x51')][_0xd74d('0x45')](_0x3024bf[_0xd74d('0x46')]);}})[_0xd74d('0x22')](respondWithResult(_0xd70120,null))[_0xd74d('0x44')](handleError(_0xd70120,null));};exports[_0xd74d('0x52')]=function(_0x22df42,_0xf04357,_0x36e455){if(_0x22df42['body']['id']){delete _0x22df42[_0xd74d('0x46')]['id'];}return db[_0xd74d('0x29')]['find']({'where':{'id':_0x22df42[_0xd74d('0x4e')]['id']}})[_0xd74d('0x22')](handleEntityNotFound(_0xf04357,null))['then'](function(_0x3664dd){if(_0x3664dd){_0x22df42[_0xd74d('0x46')][_0xd74d('0x53')]=_0x3664dd['id'];return db[_0xd74d('0x51')][_0xd74d('0x45')](_0x22df42[_0xd74d('0x46')]);}})[_0xd74d('0x22')](respondWithResult(_0xf04357,null))[_0xd74d('0x44')](handleError(_0xf04357,null));};exports['getAllConditions']=function(_0x31086d,_0x2f4ea3,_0x51276c){var _0x43b7a4={};var _0x355a11={};var _0x2e61a2;var _0x30befc;return db['Trigger']['findOne']({'where':{'id':_0x31086d[_0xd74d('0x4e')]['id']}})[_0xd74d('0x22')](handleEntityNotFound(_0x2f4ea3,null))[_0xd74d('0x22')](function(_0xc5b7b2){if(_0xc5b7b2){_0x2e61a2=_0xc5b7b2;_0x355a11['model']=_['keys'](db[_0xd74d('0x51')]['rawAttributes']);_0x355a11[_0xd74d('0x2d')]=_[_0xd74d('0x2c')](_0x31086d[_0xd74d('0x2d')]);_0x355a11[_0xd74d('0x2e')]=_[_0xd74d('0x2f')](_0x355a11[_0xd74d('0x2b')],_0x355a11[_0xd74d('0x2d')]);_0x43b7a4[_0xd74d('0x30')]=_['intersection'](_0x355a11[_0xd74d('0x2b')],qs['fields'](_0x31086d['query'][_0xd74d('0x31')]));_0x43b7a4[_0xd74d('0x30')]=_0x43b7a4[_0xd74d('0x30')][_0xd74d('0x32')]?_0x43b7a4['attributes']:_0x355a11[_0xd74d('0x2b')];_0x43b7a4[_0xd74d('0x33')]=qs[_0xd74d('0x34')](_0x31086d[_0xd74d('0x2d')]['sort']);_0x43b7a4[_0xd74d('0x37')]=qs['filters'](_['pick'](_0x31086d['query'],_0x355a11['filters']));if(_0x31086d[_0xd74d('0x2d')][_0xd74d('0x36')]){_0x43b7a4[_0xd74d('0x37')]=_[_0xd74d('0x38')](_0x43b7a4[_0xd74d('0x37')],{'$or':_[_0xd74d('0x39')](_0x43b7a4[_0xd74d('0x30')],function(_0x3f33ab){var _0x28a45a={};_0x28a45a[_0x3f33ab]={'$like':'%'+_0x31086d[_0xd74d('0x2d')][_0xd74d('0x36')]+'%'};return _0x28a45a;})});}_0x43b7a4=_[_0xd74d('0x38')]({},_0x43b7a4,_0x31086d['options']);return _0x2e61a2['getAllConditions'](_0x43b7a4);}})['then'](function(_0x15cb68){if(_0x15cb68){_0x30befc=_0x15cb68[_0xd74d('0x32')];if(!_0x31086d[_0xd74d('0x2d')][_0xd74d('0x54')](_0xd74d('0x55'))){_0x43b7a4['limit']=qs[_0xd74d('0x1c')](_0x31086d['query']['limit']);_0x43b7a4['offset']=qs[_0xd74d('0x1b')](_0x31086d['query'][_0xd74d('0x1b')]);}return _0x2e61a2['getAllConditions'](_0x43b7a4);}})[_0xd74d('0x22')](function(_0x1c19a7){if(_0x1c19a7){return _0x1c19a7?{'count':_0x30befc,'rows':_0x1c19a7}:null;}})[_0xd74d('0x22')](respondWithResult(_0x2f4ea3,null))[_0xd74d('0x44')](handleError(_0x2f4ea3,null));};exports[_0xd74d('0x56')]=function(_0x2c325d,_0x36603d,_0x2caa2d){var _0x55354d={};var _0x4b8e21={};var _0x4805ea;var _0x2a61e7;return db[_0xd74d('0x29')][_0xd74d('0x57')]({'where':{'id':_0x2c325d[_0xd74d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36603d,null))[_0xd74d('0x22')](function(_0x219caa){if(_0x219caa){_0x4805ea=_0x219caa;_0x4b8e21['model']=_[_0xd74d('0x2c')](db[_0xd74d('0x51')]['rawAttributes']);_0x4b8e21[_0xd74d('0x2d')]=_[_0xd74d('0x2c')](_0x2c325d[_0xd74d('0x2d')]);_0x4b8e21['filters']=_[_0xd74d('0x2f')](_0x4b8e21[_0xd74d('0x2b')],_0x4b8e21[_0xd74d('0x2d')]);_0x55354d[_0xd74d('0x30')]=_['intersection'](_0x4b8e21[_0xd74d('0x2b')],qs[_0xd74d('0x31')](_0x2c325d[_0xd74d('0x2d')]['fields']));_0x55354d[_0xd74d('0x30')]=_0x55354d['attributes'][_0xd74d('0x32')]?_0x55354d[_0xd74d('0x30')]:_0x4b8e21[_0xd74d('0x2b')];_0x55354d['order']=qs[_0xd74d('0x34')](_0x2c325d[_0xd74d('0x2d')][_0xd74d('0x34')]);_0x55354d[_0xd74d('0x37')]=qs[_0xd74d('0x2e')](_[_0xd74d('0x35')](_0x2c325d[_0xd74d('0x2d')],_0x4b8e21[_0xd74d('0x2e')]));if(_0x2c325d[_0xd74d('0x2d')][_0xd74d('0x36')]){_0x55354d[_0xd74d('0x37')]=_['merge'](_0x55354d[_0xd74d('0x37')],{'$or':_[_0xd74d('0x39')](_0x55354d[_0xd74d('0x30')],function(_0x39d31c){var _0x224d54={};_0x224d54[_0x39d31c]={'$like':'%'+_0x2c325d[_0xd74d('0x2d')]['filter']+'%'};return _0x224d54;})});}_0x55354d=_['merge']({},_0x55354d,_0x2c325d[_0xd74d('0x3d')]);return _0x4805ea[_0xd74d('0x56')](_0x55354d);}})[_0xd74d('0x22')](function(_0x2ed275){if(_0x2ed275){_0x2a61e7=_0x2ed275[_0xd74d('0x32')];if(!_0x2c325d[_0xd74d('0x2d')][_0xd74d('0x54')]('nolimit')){_0x55354d[_0xd74d('0x1c')]=qs[_0xd74d('0x1c')](_0x2c325d[_0xd74d('0x2d')][_0xd74d('0x1c')]);_0x55354d[_0xd74d('0x1b')]=qs['offset'](_0x2c325d[_0xd74d('0x2d')]['offset']);}return _0x4805ea['getAnyConditions'](_0x55354d);}})[_0xd74d('0x22')](function(_0x242510){if(_0x242510){return _0x242510?{'count':_0x2a61e7,'rows':_0x242510}:null;}})[_0xd74d('0x22')](respondWithResult(_0x36603d,null))[_0xd74d('0x44')](handleError(_0x36603d,null));};exports[_0xd74d('0x58')]=function(_0x3cc08c,_0x5448f7,_0x44e55f){if(_0x3cc08c[_0xd74d('0x46')]['id']){delete _0x3cc08c[_0xd74d('0x46')]['id'];}return db[_0xd74d('0x29')]['find']({'where':{'id':_0x3cc08c[_0xd74d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5448f7,null))['then'](function(_0x44bcfc){if(_0x44bcfc){_0x3cc08c['body']['TriggerId']=_0x44bcfc['id'];return db[_0xd74d('0x59')][_0xd74d('0x45')](_0x3cc08c[_0xd74d('0x46')]);}})['then'](respondWithResult(_0x5448f7,null))[_0xd74d('0x44')](handleError(_0x5448f7,null));};exports[_0xd74d('0x5a')]=function(_0x54568e,_0x9153cc,_0x1e930a){var _0x15e98a={};var _0x21a108={};var _0x4c67e8;var _0x2f5170;return db[_0xd74d('0x29')][_0xd74d('0x57')]({'where':{'id':_0x54568e[_0xd74d('0x4e')]['id']}})[_0xd74d('0x22')](handleEntityNotFound(_0x9153cc,null))[_0xd74d('0x22')](function(_0x171716){if(_0x171716){_0x4c67e8=_0x171716;_0x21a108['model']=_[_0xd74d('0x2c')](db[_0xd74d('0x59')][_0xd74d('0x2a')]);_0x21a108['query']=_[_0xd74d('0x2c')](_0x54568e[_0xd74d('0x2d')]);_0x21a108[_0xd74d('0x2e')]=_['intersection'](_0x21a108[_0xd74d('0x2b')],_0x21a108[_0xd74d('0x2d')]);_0x15e98a['attributes']=_[_0xd74d('0x2f')](_0x21a108[_0xd74d('0x2b')],qs[_0xd74d('0x31')](_0x54568e[_0xd74d('0x2d')][_0xd74d('0x31')]));_0x15e98a[_0xd74d('0x30')]=_0x15e98a[_0xd74d('0x30')]['length']?_0x15e98a[_0xd74d('0x30')]:_0x21a108[_0xd74d('0x2b')];_0x15e98a[_0xd74d('0x33')]=qs['sort'](_0x54568e['query'][_0xd74d('0x34')]);_0x15e98a[_0xd74d('0x37')]=qs['filters'](_['pick'](_0x54568e[_0xd74d('0x2d')],_0x21a108[_0xd74d('0x2e')]));if(_0x54568e[_0xd74d('0x2d')][_0xd74d('0x36')]){_0x15e98a['where']=_['merge'](_0x15e98a[_0xd74d('0x37')],{'$or':_[_0xd74d('0x39')](_0x15e98a[_0xd74d('0x30')],function(_0x1cdd52){var _0x33f4a4={};_0x33f4a4[_0x1cdd52]={'$like':'%'+_0x54568e['query'][_0xd74d('0x36')]+'%'};return _0x33f4a4;})});}_0x15e98a=_[_0xd74d('0x38')]({},_0x15e98a,_0x54568e[_0xd74d('0x3d')]);return _0x4c67e8[_0xd74d('0x5a')](_0x15e98a);}})[_0xd74d('0x22')](function(_0x56c5aa){if(_0x56c5aa){_0x2f5170=_0x56c5aa['length'];if(!_0x54568e['query'][_0xd74d('0x54')]('nolimit')){_0x15e98a[_0xd74d('0x1c')]=qs[_0xd74d('0x1c')](_0x54568e[_0xd74d('0x2d')][_0xd74d('0x1c')]);_0x15e98a[_0xd74d('0x1b')]=qs['offset'](_0x54568e[_0xd74d('0x2d')][_0xd74d('0x1b')]);}return _0x4c67e8[_0xd74d('0x5a')](_0x15e98a);}})['then'](function(_0x3f9dc7){if(_0x3f9dc7){return _0x3f9dc7?{'count':_0x2f5170,'rows':_0x3f9dc7}:null;}})[_0xd74d('0x22')](respondWithResult(_0x9153cc,null))[_0xd74d('0x44')](handleError(_0x9153cc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index af067a5..757eb35 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','../../config/logger','api'];(function(_0x29bbd4,_0x2ce30b){var _0xc129b=function(_0x4dc0b0){while(--_0x4dc0b0){_0x29bbd4['push'](_0x29bbd4['shift']());}};_0xc129b(++_0x2ce30b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1c0522,_0x3b909b){var _0x343256=function(_0x173601){while(--_0x173601){_0x1c0522['push'](_0x1c0522['shift']());}};_0x343256(++_0x3b909b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 43c89ea..d8a00e9 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 _0x31d8=['then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x31d8,0x1ba));var _0x831d=function(_0x19a257,_0x42b509){_0x19a257=_0x19a257-0x0;var _0x4b6e49=_0x31d8[_0x19a257];return _0x4b6e49;};'use strict';var _=require('lodash');var util=require(_0x831d('0x0'));var moment=require(_0x831d('0x1'));var BPromise=require(_0x831d('0x2'));var rs=require(_0x831d('0x3'));var fs=require('fs');var Redis=require(_0x831d('0x4'));var db=require(_0x831d('0x5'))['db'];var utils=require(_0x831d('0x6'));var logger=require(_0x831d('0x7'))(_0x831d('0x8'));var config=require(_0x831d('0x9'));var jayson=require(_0x831d('0xa'));var client=jayson[_0x831d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e671e,_0x36d816,_0x55934a){return new BPromise(function(_0x2f3ea7,_0x3b4a08){return client[_0x831d('0xc')](_0x2e671e,_0x55934a)[_0x831d('0xd')](function(_0x1f3bd9){logger['info'](_0x831d('0xe'),_0x36d816,_0x831d('0xf'));logger[_0x831d('0x10')](_0x831d('0x11'),_0x36d816,'request\x20sent',JSON[_0x831d('0x12')](_0x1f3bd9));if(_0x1f3bd9[_0x831d('0x13')]){if(_0x1f3bd9['error'][_0x831d('0x14')]===0x1f4){logger['error'](_0x831d('0xe'),_0x36d816,_0x1f3bd9['error'][_0x831d('0x15')]);return _0x3b4a08(_0x1f3bd9['error'][_0x831d('0x15')]);}logger[_0x831d('0x13')](_0x831d('0xe'),_0x36d816,_0x1f3bd9[_0x831d('0x13')][_0x831d('0x15')]);return _0x2f3ea7(_0x1f3bd9['error']['message']);}else{logger[_0x831d('0x16')](_0x831d('0xe'),_0x36d816,_0x831d('0xf'));_0x2f3ea7(_0x1f3bd9['result'][_0x831d('0x15')]);}})[_0x831d('0x17')](function(_0x2a572f){logger[_0x831d('0x13')](_0x831d('0xe'),_0x36d816,_0x2a572f);_0x3b4a08(_0x2a572f);});});}exports[_0x831d('0x18')]=function(_0x2b3562){var _0x1c59f0=this;return new Promise(function(_0x169b65,_0x431c2f){return db[_0x831d('0x19')][_0x831d('0x1a')]({'raw':_0x2b3562[_0x831d('0x1b')]?_0x2b3562[_0x831d('0x1b')][_0x831d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b3562['options']?_0x2b3562[_0x831d('0x1b')][_0x831d('0x1d')]||null:null,'attributes':_0x2b3562['options']?_0x2b3562[_0x831d('0x1b')][_0x831d('0x1e')]||null:null,'limit':_0x2b3562[_0x831d('0x1b')]?_0x2b3562['options']['limit']||null:null,'include':_0x2b3562[_0x831d('0x1b')]?_0x2b3562['options'][_0x831d('0x1f')]?_[_0x831d('0x20')](_0x2b3562[_0x831d('0x1b')][_0x831d('0x1f')],function(_0x28ccc4){return{'model':db[_0x28ccc4[_0x831d('0x21')]],'as':_0x28ccc4['as'],'attributes':_0x28ccc4['attributes'],'include':_0x28ccc4[_0x831d('0x1f')]?_['map'](_0x28ccc4[_0x831d('0x1f')],function(_0x1acd14){return{'model':db[_0x1acd14['model']],'as':_0x1acd14['as'],'attributes':_0x1acd14['attributes'],'include':_0x1acd14[_0x831d('0x1f')]?_[_0x831d('0x20')](_0x1acd14[_0x831d('0x1f')],function(_0x50fad8){return{'model':db[_0x50fad8[_0x831d('0x21')]],'as':_0x50fad8['as'],'attributes':_0x50fad8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xdfa823){logger[_0x831d('0x16')](_0x831d('0x18'),_0x2b3562);logger[_0x831d('0x10')]('GetTrigger',_0x2b3562,JSON[_0x831d('0x12')](_0xdfa823));_0x169b65(_0xdfa823);})['catch'](function(_0x21366a){logger[_0x831d('0x13')](_0x831d('0x18'),_0x21366a[_0x831d('0x15')],_0x2b3562);_0x431c2f(_0x1c59f0[_0x831d('0x13')](0x1f4,_0x21366a['message']));});});};exports['ShowTrigger']=function(_0x3759bf){var _0x363322=this;return new Promise(function(_0x4d24db,_0x3b711f){return db[_0x831d('0x19')]['find']({'raw':_0x3759bf['options']?_0x3759bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3759bf[_0x831d('0x1b')]?_0x3759bf['options']['where']||null:null,'attributes':_0x3759bf[_0x831d('0x1b')]?_0x3759bf[_0x831d('0x1b')]['attributes']||null:null,'include':_0x3759bf[_0x831d('0x1b')]?_0x3759bf['options'][_0x831d('0x1f')]?_[_0x831d('0x20')](_0x3759bf[_0x831d('0x1b')][_0x831d('0x1f')],function(_0x28cc86){return{'model':db[_0x28cc86[_0x831d('0x21')]],'as':_0x28cc86['as'],'attributes':_0x28cc86[_0x831d('0x1e')],'include':_0x28cc86['include']?_['map'](_0x28cc86['include'],function(_0x4b8a87){return{'model':db[_0x4b8a87[_0x831d('0x21')]],'as':_0x4b8a87['as'],'attributes':_0x4b8a87[_0x831d('0x1e')],'include':_0x4b8a87[_0x831d('0x1f')]?_[_0x831d('0x20')](_0x4b8a87[_0x831d('0x1f')],function(_0x4850e1){return{'model':db[_0x4850e1['model']],'as':_0x4850e1['as'],'attributes':_0x4850e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb78ad2){logger['info'](_0x831d('0x22'),_0x3759bf);logger['debug'](_0x831d('0x22'),_0x3759bf,JSON[_0x831d('0x12')](_0xb78ad2));_0x4d24db(_0xb78ad2);})['catch'](function(_0x58aa99){logger['error'](_0x831d('0x22'),_0x58aa99[_0x831d('0x15')],_0x3759bf);_0x3b711f(_0x363322[_0x831d('0x13')](0x1f4,_0x58aa99['message']));});});}; \ No newline at end of file +var _0x16c6=['Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','attributes','limit','include','model','map','ShowTrigger','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24487f,_0x9b3ea0){var _0x456456=function(_0x2ba373){while(--_0x2ba373){_0x24487f['push'](_0x24487f['shift']());}};_0x456456(++_0x9b3ea0);}(_0x16c6,0xa2));var _0x616c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x16c6[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x616c('0x0'));var moment=require(_0x616c('0x1'));var BPromise=require(_0x616c('0x2'));var rs=require(_0x616c('0x3'));var fs=require('fs');var Redis=require(_0x616c('0x4'));var db=require(_0x616c('0x5'))['db'];var utils=require(_0x616c('0x6'));var logger=require(_0x616c('0x7'))(_0x616c('0x8'));var config=require(_0x616c('0x9'));var jayson=require(_0x616c('0xa'));var client=jayson[_0x616c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xce7548,_0x4c3546,_0x38eddd){return new BPromise(function(_0x34f41d,_0x1976ff){return client[_0x616c('0xc')](_0xce7548,_0x38eddd)[_0x616c('0xd')](function(_0x5146b8){logger[_0x616c('0xe')](_0x616c('0xf'),_0x4c3546,_0x616c('0x10'));logger[_0x616c('0x11')](_0x616c('0x12'),_0x4c3546,_0x616c('0x10'),JSON[_0x616c('0x13')](_0x5146b8));if(_0x5146b8[_0x616c('0x14')]){if(_0x5146b8[_0x616c('0x14')]['code']===0x1f4){logger[_0x616c('0x14')]('Trigger,\x20%s,\x20%s',_0x4c3546,_0x5146b8['error']['message']);return _0x1976ff(_0x5146b8[_0x616c('0x14')]['message']);}logger[_0x616c('0x14')](_0x616c('0xf'),_0x4c3546,_0x5146b8[_0x616c('0x14')][_0x616c('0x15')]);return _0x34f41d(_0x5146b8[_0x616c('0x14')]['message']);}else{logger['info'](_0x616c('0xf'),_0x4c3546,_0x616c('0x10'));_0x34f41d(_0x5146b8[_0x616c('0x16')]['message']);}})[_0x616c('0x17')](function(_0xfc8e1a){logger[_0x616c('0x14')](_0x616c('0xf'),_0x4c3546,_0xfc8e1a);_0x1976ff(_0xfc8e1a);});});}exports[_0x616c('0x18')]=function(_0x202de7){var _0x94655a=this;return new Promise(function(_0x349f01,_0x1fef11){return db[_0x616c('0x19')][_0x616c('0x1a')]({'raw':_0x202de7[_0x616c('0x1b')]?_0x202de7[_0x616c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x202de7['options']?_0x202de7[_0x616c('0x1b')]['where']||null:null,'attributes':_0x202de7[_0x616c('0x1b')]?_0x202de7[_0x616c('0x1b')][_0x616c('0x1c')]||null:null,'limit':_0x202de7[_0x616c('0x1b')]?_0x202de7['options'][_0x616c('0x1d')]||null:null,'include':_0x202de7['options']?_0x202de7[_0x616c('0x1b')][_0x616c('0x1e')]?_['map'](_0x202de7['options'][_0x616c('0x1e')],function(_0x3322cb){return{'model':db[_0x3322cb[_0x616c('0x1f')]],'as':_0x3322cb['as'],'attributes':_0x3322cb[_0x616c('0x1c')],'include':_0x3322cb[_0x616c('0x1e')]?_[_0x616c('0x20')](_0x3322cb['include'],function(_0x2c00c9){return{'model':db[_0x2c00c9[_0x616c('0x1f')]],'as':_0x2c00c9['as'],'attributes':_0x2c00c9['attributes'],'include':_0x2c00c9['include']?_[_0x616c('0x20')](_0x2c00c9[_0x616c('0x1e')],function(_0x6beba9){return{'model':db[_0x6beba9[_0x616c('0x1f')]],'as':_0x6beba9['as'],'attributes':_0x6beba9['attributes']};}):[]};}):[]};}):[]:[]})[_0x616c('0xd')](function(_0x24607b){logger[_0x616c('0xe')]('GetTrigger',_0x202de7);logger[_0x616c('0x11')](_0x616c('0x18'),_0x202de7,JSON[_0x616c('0x13')](_0x24607b));_0x349f01(_0x24607b);})[_0x616c('0x17')](function(_0x5cb994){logger[_0x616c('0x14')]('GetTrigger',_0x5cb994['message'],_0x202de7);_0x1fef11(_0x94655a[_0x616c('0x14')](0x1f4,_0x5cb994[_0x616c('0x15')]));});});};exports[_0x616c('0x21')]=function(_0x5d3584){var _0x406dc9=this;return new Promise(function(_0x170901,_0x1de4a8){return db[_0x616c('0x19')][_0x616c('0x22')]({'raw':_0x5d3584[_0x616c('0x1b')]?_0x5d3584['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d3584[_0x616c('0x1b')]?_0x5d3584[_0x616c('0x1b')][_0x616c('0x23')]||null:null,'attributes':_0x5d3584[_0x616c('0x1b')]?_0x5d3584[_0x616c('0x1b')][_0x616c('0x1c')]||null:null,'include':_0x5d3584['options']?_0x5d3584['options'][_0x616c('0x1e')]?_[_0x616c('0x20')](_0x5d3584[_0x616c('0x1b')][_0x616c('0x1e')],function(_0x5871f9){return{'model':db[_0x5871f9[_0x616c('0x1f')]],'as':_0x5871f9['as'],'attributes':_0x5871f9[_0x616c('0x1c')],'include':_0x5871f9[_0x616c('0x1e')]?_[_0x616c('0x20')](_0x5871f9[_0x616c('0x1e')],function(_0x24e8f5){return{'model':db[_0x24e8f5[_0x616c('0x1f')]],'as':_0x24e8f5['as'],'attributes':_0x24e8f5[_0x616c('0x1c')],'include':_0x24e8f5['include']?_[_0x616c('0x20')](_0x24e8f5[_0x616c('0x1e')],function(_0x31ad1e){return{'model':db[_0x31ad1e[_0x616c('0x1f')]],'as':_0x31ad1e['as'],'attributes':_0x31ad1e[_0x616c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x616c('0xd')](function(_0x75456){logger['info'](_0x616c('0x21'),_0x5d3584);logger[_0x616c('0x11')](_0x616c('0x21'),_0x5d3584,JSON[_0x616c('0x13')](_0x75456));_0x170901(_0x75456);})[_0x616c('0x17')](function(_0x151379){logger[_0x616c('0x14')](_0x616c('0x21'),_0x151379[_0x616c('0x15')],_0x5d3584);_0x1de4a8(_0x406dc9['error'](0x1f4,_0x151379['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 82e0e7f..d997e33 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 _0x206b=['put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./trunk.controller','isAuthenticated','/:id','show','post','/:id/clone'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x206b,0x84));var _0xb206=function(_0x48f80a,_0x3bb5d4){_0x48f80a=_0x48f80a-0x0;var _0x1327fb=_0x206b[_0x48f80a];return _0x1327fb;};'use strict';var multer=require(_0xb206('0x0'));var util=require(_0xb206('0x1'));var path=require('path');var timeout=require(_0xb206('0x2'));var express=require(_0xb206('0x3'));var router=express[_0xb206('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb206('0x5'));var config=require('../../config/environment');var controller=require(_0xb206('0x6'));router['get']('/',auth[_0xb206('0x7')](),controller['index']);router['get'](_0xb206('0x8'),auth[_0xb206('0x7')](),controller[_0xb206('0x9')]);router[_0xb206('0xa')](_0xb206('0xb'),auth[_0xb206('0x7')](),controller['clone']);router['post']('/',auth[_0xb206('0x7')](),controller['create']);router[_0xb206('0xc')](_0xb206('0x8'),auth[_0xb206('0x7')](),controller[_0xb206('0xd')]);router[_0xb206('0xe')](_0xb206('0x8'),auth[_0xb206('0x7')](),controller['destroy']);module[_0xb206('0xf')]=router; \ No newline at end of file +var _0xa5ac=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x12b28f,_0x66f087){var _0x2d1bc8=function(_0x4e9f6a){while(--_0x4e9f6a){_0x12b28f['push'](_0x12b28f['shift']());}};_0x2d1bc8(++_0x66f087);}(_0xa5ac,0x87));var _0xca5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ac[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xca5a('0x0'));var util=require(_0xca5a('0x1'));var path=require(_0xca5a('0x2'));var timeout=require(_0xca5a('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xca5a('0x4'));var interaction=require(_0xca5a('0x5'));var config=require(_0xca5a('0x6'));var controller=require(_0xca5a('0x7'));router[_0xca5a('0x8')]('/',auth[_0xca5a('0x9')](),controller[_0xca5a('0xa')]);router[_0xca5a('0x8')](_0xca5a('0xb'),auth[_0xca5a('0x9')](),controller['show']);router[_0xca5a('0xc')](_0xca5a('0xd'),auth[_0xca5a('0x9')](),controller[_0xca5a('0xe')]);router[_0xca5a('0xc')]('/',auth['isAuthenticated'](),controller[_0xca5a('0xf')]);router[_0xca5a('0x10')]('/:id',auth[_0xca5a('0x9')](),controller[_0xca5a('0x11')]);router[_0xca5a('0x12')](_0xca5a('0xb'),auth[_0xca5a('0x9')](),controller['destroy']);module[_0xca5a('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 921c2ad..4d1de86 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 _0xd8b0=['update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','originate','uac','uas','pai','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband','auto','yes','nonat'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_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')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0d8b('0x2'),_0x0d8b('0x3'),_0x0d8b('0x4')),'allowNull':![],'defaultValue':_0x0d8b('0x2')},'context':{'type':Sequelize[_0x0d8b('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x0d8b('0x6'),_0x0d8b('0x7'),_0x0d8b('0x8'),'ALLOWED',_0x0d8b('0x9'),_0x0d8b('0xa'),'PROHIB_FAILED_SCREEN',_0x0d8b('0xb'))},'deny':{'type':Sequelize[_0x0d8b('0x5')]},'permit':{'type':Sequelize[_0x0d8b('0x5')]},'secret':{'type':Sequelize[_0x0d8b('0x5')]},'md5secret':{'type':Sequelize[_0x0d8b('0x5')]},'remotesecret':{'type':Sequelize[_0x0d8b('0x5')]},'transport':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':_0x0d8b('0xc'),'set':function(_0x48fa16){this[_0x0d8b('0xd')]('transport',_0x48fa16?_0x48fa16[_0x0d8b('0xe')](','):null);},'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'))?this[_0x0d8b('0xf')](_0x0d8b('0x10'))[_0x0d8b('0x11')](','):null;},'comment':_0x0d8b('0x12')},'dtmfmode':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15'),_0x0d8b('0x16'),_0x0d8b('0x17'),_0x0d8b('0x18')),'defaultValue':_0x0d8b('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no',_0x0d8b('0x1a'),_0x0d8b('0x1b'),_0x0d8b('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0d8b('0x13')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0d8b('0x5')]},'directmediadeny':{'type':Sequelize[_0x0d8b('0x5')]},'nat':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':_0x0d8b('0x1d'),'set':function(_0x333674){this[_0x0d8b('0xd')](_0x0d8b('0x1e'),_0x333674?_0x333674[_0x0d8b('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x0d8b('0x1e'))?this[_0x0d8b('0xf')](_0x0d8b('0x1e'))[_0x0d8b('0x11')](','):null;},'comment':_0x0d8b('0x1f')},'callgroup':{'type':Sequelize[_0x0d8b('0x5')]},'namedcallgroup':{'type':Sequelize[_0x0d8b('0x5')]},'pickupgroup':{'type':Sequelize[_0x0d8b('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0d8b('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0d8b('0x20'),'set':function(_0x2b924f){this[_0x0d8b('0xd')](_0x0d8b('0x21'),_0x2b924f?_0x2b924f[_0x0d8b('0xe')](';'):_0x0d8b('0x20'));},'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x21'))?this[_0x0d8b('0xf')]('allow')[_0x0d8b('0x11')](';'):null;},'comment':_0x0d8b('0x22')},'autoframing':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x23'),'set':function(_0x234bdd){this[_0x0d8b('0xd')]('insecure',_0x234bdd?_0x234bdd['join'](','):null);},'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x24'))?this['getDataValue'](_0x0d8b('0x24'))['split'](','):null;},'comment':_0x0d8b('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x0d8b('0x13')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x0d8b('0x5')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x0d8b('0x19')},'busylevel':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x0d8b('0x5')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no',_0x0d8b('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'mailbox':{'type':Sequelize[_0x0d8b('0x5')]},'session_timers':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x28'),'refuse',_0x0d8b('0x29'))},'session_expires':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x2a'),_0x0d8b('0x2b')),'defaultValue':_0x0d8b('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x0d8b('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x0d8b('0x5')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no'),'defaultValue':_0x0d8b('0x19')},'keepalive':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x0d8b('0x5')]},'defaultuser':{'type':Sequelize[_0x0d8b('0x5')]},'rtptimeout':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no',_0x0d8b('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0d8b('0x5')]},'callbackextension':{'type':Sequelize[_0x0d8b('0x5')]},'timert1':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x0d8b('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x0d8b('0x5')]},'contactdeny':{'type':Sequelize[_0x0d8b('0x5')]},'contactacl':{'type':Sequelize[_0x0d8b('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0d8b('0x5')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'force_avp':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'icesupport':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x0d8b('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x0d8b('0x5')]},'dtlscipher':{'type':Sequelize[_0x0d8b('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x0d8b('0x13')](_0x0d8b('0x2d'),_0x0d8b('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0d8b('0x5')]},'usereqphone':{'type':Sequelize[_0x0d8b('0x13')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x0d8b('0x5')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0d8b('0x13')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0d8b('0x19'),'no')},'vmexten':{'type':Sequelize[_0x0d8b('0x5')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':_0x0d8b('0x2f')},'canreinvite':{'type':Sequelize[_0x0d8b('0x13')]('yes','no',_0x0d8b('0x1a'),_0x0d8b('0x1b'),_0x0d8b('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0d8b('0x5')]},'otherFields':{'type':Sequelize[_0x0d8b('0x5')]},'active':{'type':Sequelize[_0x0d8b('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0d8b('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0b0e=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','insecure','yes','never','\x22\x22\x20<>','INTEGER','always','accept','originate','uac','uas','pai','fingerprint','active','passive','dynamic','BOOLEAN','sequelize','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x11b8ae,_0x485fa8){var _0x35a448=function(_0x188a5b){while(--_0x188a5b){_0x11b8ae['push'](_0x11b8ae['shift']());}};_0x35a448(++_0x485fa8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0x0b0e[_0x4d093a];return _0x5d7227;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5')),'allowNull':![],'defaultValue':_0xe0b0('0x3')},'context':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![],'defaultValue':_0xe0b0('0x6')},'callingpres':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'))},'deny':{'type':Sequelize[_0xe0b0('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xe0b0('0x1')]},'md5secret':{'type':Sequelize[_0xe0b0('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':_0xe0b0('0xd'),'set':function(_0x574d96){this[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x574d96?_0x574d96[_0xe0b0('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xe0b0('0xf'))?this[_0xe0b0('0x11')](_0xe0b0('0xf'))[_0xe0b0('0x12')](','):null;},'comment':_0xe0b0('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe0b0('0x14'),_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),_0xe0b0('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xe0b0('0x2')]('yes','no',_0xe0b0('0x19'),_0xe0b0('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe0b0('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe0b0('0x1')]},'directmediadeny':{'type':Sequelize[_0xe0b0('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x46bb44){this['setDataValue']('nat',_0x46bb44?_0x46bb44['join'](','):null);},'get':function(){return this[_0xe0b0('0x11')]('nat')?this['getDataValue'](_0xe0b0('0x1b'))['split'](','):null;},'comment':_0xe0b0('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xe0b0('0x1')]},'pickupgroup':{'type':Sequelize[_0xe0b0('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xe0b0('0x1')]},'language':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x12b260){this[_0xe0b0('0xe')]('allow',_0x12b260?_0x12b260[_0xe0b0('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe0b0('0x11')]('allow')?this[_0xe0b0('0x11')]('allow')[_0xe0b0('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe0b0('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':'port,invite','set':function(_0x362aba){this[_0xe0b0('0xe')](_0xe0b0('0x1d'),_0x362aba?_0x362aba[_0xe0b0('0x10')](','):null);},'get':function(){return this[_0xe0b0('0x11')](_0xe0b0('0x1d'))?this['getDataValue'](_0xe0b0('0x1d'))[_0xe0b0('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no',_0xe0b0('0x1f'))},'promiscredir':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no')},'useclientcode':{'type':Sequelize[_0xe0b0('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xe0b0('0x1')]},'callerid':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':_0xe0b0('0x20')},'amaflags':{'type':Sequelize[_0xe0b0('0x1')]},'callcounter':{'type':Sequelize[_0xe0b0('0x2')]('yes','no'),'defaultValue':_0xe0b0('0x1e')},'busylevel':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'allowsubscribe':{'type':Sequelize[_0xe0b0('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'subscribecontext':{'type':Sequelize[_0xe0b0('0x1')]},'template':{'type':Sequelize[_0xe0b0('0x1')]},'videosupport':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no',_0xe0b0('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'mailbox':{'type':Sequelize[_0xe0b0('0x1')]},'session_timers':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x23'),'refuse',_0xe0b0('0x24'))},'session_expires':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'session_minse':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x25'),_0xe0b0('0x26')),'defaultValue':_0xe0b0('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe0b0('0x21')](0x5)},'qualify':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xe0b0('0x1')]},'defaultuser':{'type':Sequelize[_0xe0b0('0x1')]},'rtptimeout':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no',_0xe0b0('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe0b0('0x1')]},'callbackextension':{'type':Sequelize[_0xe0b0('0x1')]},'timert1':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'timerb':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xe0b0('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xe0b0('0x1')]},'use_q850_reason':{'type':Sequelize[_0xe0b0('0x1')]},'maxforwards':{'type':Sequelize[_0xe0b0('0x21')](0xb)},'encryption':{'type':Sequelize[_0xe0b0('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'force_avp':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'icesupport':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'dtlsenable':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no',_0xe0b0('0x28'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xe0b0('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xe0b0('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe0b0('0x1')]},'dtlscapath':{'type':Sequelize[_0xe0b0('0x1')]},'dtlssetup':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x29'),_0xe0b0('0x2a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe0b0('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xe0b0('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'subscribemwi':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x1e'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xe0b0('0x1')]},'parkinglot':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize[_0xe0b0('0x1')]},'host':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':_0xe0b0('0x2b')},'canreinvite':{'type':Sequelize['ENUM'](_0xe0b0('0x1e'),'no',_0xe0b0('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe0b0('0x1')]},'active':{'type':Sequelize[_0xe0b0('0x2c')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe0b0('0x1')],'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 45a55e3..072fa60 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 _0xf5c3=['request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','stack','name','send','Trunk','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','clone','rawAttributes','get','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','readFileSync','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Trunks','Reload','server/files/templates/registry.ejs','chan_sip.so','html-pdf','zip-dir','fast-json-patch'];(function(_0x5016e2,_0x5544ef){var _0x220225=function(_0x298b3e){while(--_0x298b3e){_0x5016e2['push'](_0x5016e2['shift']());}};_0x220225(++_0x5544ef);}(_0xf5c3,0xdb));var _0x3f5c=function(_0x4f6093,_0xe0a3d0){_0x4f6093=_0x4f6093-0x0;var _0x4eeddd=_0xf5c3[_0x4f6093];return _0x4eeddd;};'use strict';var pdf=require(_0x3f5c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f5c('0x1'));var jsonpatch=require(_0x3f5c('0x2'));var rp=require(_0x3f5c('0x3'));var moment=require('moment');var BPromise=require(_0x3f5c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f5c('0x5'));var sox=require(_0x3f5c('0x6'));var csv=require('to-csv');var ejs=require(_0x3f5c('0x7'));var fs=require('fs');var _=require(_0x3f5c('0x8'));var squel=require(_0x3f5c('0x9'));var crypto=require(_0x3f5c('0xa'));var jsforce=require(_0x3f5c('0xb'));var deskjs=require(_0x3f5c('0xc'));var toCsv=require(_0x3f5c('0xd'));var querystring=require(_0x3f5c('0xe'));var Papa=require(_0x3f5c('0xf'));var Redis=require(_0x3f5c('0x10'));var authService=require(_0x3f5c('0x11'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x3f5c('0x12'));var logger=require('../../config/logger')(_0x3f5c('0x13'));var utils=require(_0x3f5c('0x14'));var config=require(_0x3f5c('0x15'));var db=require(_0x3f5c('0x16'))['db'];var jayson=require(_0x3f5c('0x17'));var client=jayson[_0x3f5c('0x18')][_0x3f5c('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2db82a,_0x428744,_0x4fe667){if(_0x4fe667){var _0x27efc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27efc8[_0x3f5c('0x1a')](_0x428744)){return _0x2db82a;}else{throw new Error(_0x3f5c('0x1b'));}}else{return _0x2db82a;}}function respondWithRpcPromise(_0x51fd30,_0x5360e2,_0xd6a904,_0x4c6c51){return new BPromise(function(_0x399b0b,_0x520693){var _0xb02692=_0x4c6c51||client;return _0xb02692[_0x3f5c('0x1c')](_0x51fd30,_0xd6a904)['then'](function(_0x33dc60){logger[_0x3f5c('0x1d')]('Trunk,\x20%s,\x20%s',_0x5360e2,'request\x20sent');logger[_0x3f5c('0x1e')](_0x3f5c('0x1f'),_0x5360e2,_0x3f5c('0x20'),JSON[_0x3f5c('0x21')](_0x33dc60));if(_0x33dc60['error']){if(_0x33dc60[_0x3f5c('0x22')][_0x3f5c('0x23')]===0x1f4){logger[_0x3f5c('0x22')](_0x3f5c('0x24'),_0x5360e2,_0x33dc60[_0x3f5c('0x22')][_0x3f5c('0x25')]);return _0x520693(_0x33dc60[_0x3f5c('0x22')][_0x3f5c('0x25')]);}logger[_0x3f5c('0x22')](_0x3f5c('0x24'),_0x5360e2,_0x33dc60[_0x3f5c('0x22')][_0x3f5c('0x25')]);return _0x399b0b(_0x33dc60[_0x3f5c('0x22')][_0x3f5c('0x25')]);}else{logger[_0x3f5c('0x1d')](_0x3f5c('0x24'),_0x5360e2,_0x3f5c('0x20'));_0x399b0b(_0x33dc60[_0x3f5c('0x26')]['message']);}})['catch'](function(_0x426eae){logger['error'](_0x3f5c('0x24'),_0x5360e2,_0x426eae);_0x520693(_0x426eae);});});}function respondWithStatusCode(_0x225efc,_0x56c117){_0x56c117=_0x56c117||0xcc;return function(_0xdf5a62){if(_0xdf5a62){return _0x225efc[_0x3f5c('0x27')](_0x56c117);}return _0x225efc[_0x3f5c('0x28')](_0x56c117)[_0x3f5c('0x29')]();};}function respondWithResult(_0x3e56c2,_0xf6cf2c){_0xf6cf2c=_0xf6cf2c||0xc8;return function(_0x59d4aa){if(_0x59d4aa){return _0x3e56c2['status'](_0xf6cf2c)['json'](_0x59d4aa);}};}function respondWithFilteredResult(_0x102461,_0x1d12c3){return function(_0x206934){if(_0x206934){var _0x1faaa3=_0x206934[_0x3f5c('0x2a')],_0x8c7c10=_0x1d12c3[_0x3f5c('0x2b')],_0x3b4782=_0x1d12c3[_0x3f5c('0x2b')]+_0x1d12c3[_0x3f5c('0x2c')],_0x262275;if(_0x3b4782>=_0x1faaa3){_0x3b4782=_0x1faaa3;_0x262275=0xc8;}else{_0x262275=0xce;}_0x102461['status'](_0x262275);return _0x102461[_0x3f5c('0x2d')](_0x3f5c('0x2e'),_0x8c7c10+'-'+_0x3b4782+'/'+_0x1faaa3)[_0x3f5c('0x2f')](_0x206934);}return null;};}function patchUpdates(_0x50ef7f){return function(_0x3bb51e){try{jsonpatch[_0x3f5c('0x30')](_0x3bb51e,_0x50ef7f,!![]);}catch(_0x16fbcb){return BPromise['reject'](_0x16fbcb);}return _0x3bb51e[_0x3f5c('0x31')]();};}function saveUpdates(_0x339a1d,_0x216037){return function(_0x24d5f2){if(_0x24d5f2){return _0x24d5f2[_0x3f5c('0x32')](_0x339a1d)[_0x3f5c('0x33')](function(_0x3ea85a){return _0x3ea85a;});}return null;};}function removeEntity(_0x38794a,_0x23fb75){return function(_0x1eac4d){if(_0x1eac4d){return _0x1eac4d[_0x3f5c('0x34')]()[_0x3f5c('0x33')](function(){var _0x3f44a3=_0x1eac4d['get']({'plain':!![]});var _0x297c8d='Trunks';return db[_0x3f5c('0x35')][_0x3f5c('0x34')]({'where':{'type':_0x297c8d,'resourceId':_0x3f44a3['id']}})[_0x3f5c('0x33')](function(){return _0x1eac4d;});})[_0x3f5c('0x33')](function(){_0x38794a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x313c5f,_0x1c0083){return function(_0x4343db){if(!_0x4343db){_0x313c5f[_0x3f5c('0x27')](0x194);}return _0x4343db;};}function handleError(_0x27e970,_0x3f4167){_0x3f4167=_0x3f4167||0x1f4;return function(_0x547b93){logger['error'](_0x547b93[_0x3f5c('0x36')]);if(_0x547b93[_0x3f5c('0x37')]){delete _0x547b93[_0x3f5c('0x37')];}_0x27e970[_0x3f5c('0x28')](_0x3f4167)[_0x3f5c('0x38')](_0x547b93);};}exports['index']=function(_0x1e23f8,_0x2e8bab){var _0x49a5c6={},_0x3cabfb={},_0x502238={'count':0x0,'rows':[]};var _0x12169b=db[_0x3f5c('0x39')]['rawAttributes'];_0x3cabfb[_0x3f5c('0x3a')]=_[_0x3f5c('0x3b')](_0x12169b);_0x3cabfb[_0x3f5c('0x3c')]=_[_0x3f5c('0x3b')](_0x1e23f8[_0x3f5c('0x3c')]);_0x3cabfb[_0x3f5c('0x3d')]=_[_0x3f5c('0x3e')](_0x3cabfb[_0x3f5c('0x3a')],_0x3cabfb['query']);_0x49a5c6[_0x3f5c('0x3f')]=_[_0x3f5c('0x3e')](_0x3cabfb[_0x3f5c('0x3a')],qs['fields'](_0x1e23f8[_0x3f5c('0x3c')][_0x3f5c('0x40')]));_0x49a5c6[_0x3f5c('0x3f')]=_0x49a5c6[_0x3f5c('0x3f')][_0x3f5c('0x41')]?_0x49a5c6[_0x3f5c('0x3f')]:_0x3cabfb[_0x3f5c('0x3a')];if(!_0x1e23f8['query'][_0x3f5c('0x42')](_0x3f5c('0x43'))){_0x49a5c6[_0x3f5c('0x2c')]=qs[_0x3f5c('0x2c')](_0x1e23f8['query'][_0x3f5c('0x2c')]);_0x49a5c6[_0x3f5c('0x2b')]=qs['offset'](_0x1e23f8[_0x3f5c('0x3c')][_0x3f5c('0x2b')]);}_0x49a5c6[_0x3f5c('0x44')]=qs[_0x3f5c('0x45')](_0x1e23f8[_0x3f5c('0x3c')][_0x3f5c('0x45')]);_0x49a5c6[_0x3f5c('0x46')]=qs[_0x3f5c('0x3d')](_[_0x3f5c('0x47')](_0x1e23f8['query'],_0x3cabfb['filters']));if(_0x1e23f8['query'][_0x3f5c('0x48')]){_0x49a5c6[_0x3f5c('0x46')]=_[_0x3f5c('0x49')](_0x49a5c6[_0x3f5c('0x46')],{'$or':_[_0x3f5c('0x4a')](_0x12169b,function(_0x42aea3){if(_0x42aea3['type']['key']!==_0x3f5c('0x4b')){var _0x3501db={};_0x3501db[_0x42aea3['field']]={'$like':'%'+_0x1e23f8['query'][_0x3f5c('0x48')]+'%'};return _0x3501db;}})});}_0x49a5c6=_[_0x3f5c('0x49')]({},_0x49a5c6,_0x1e23f8[_0x3f5c('0x4c')]);var _0x3f6962={'where':_0x49a5c6[_0x3f5c('0x46')]};return db['Trunk']['count'](_0x3f6962)[_0x3f5c('0x33')](function(_0x27ab68){_0x502238[_0x3f5c('0x2a')]=_0x27ab68;if(_0x1e23f8[_0x3f5c('0x3c')]['includeAll']){_0x49a5c6[_0x3f5c('0x4d')]=[{'all':!![]}];}return db[_0x3f5c('0x39')][_0x3f5c('0x4e')](_0x49a5c6);})[_0x3f5c('0x33')](function(_0x20a316){_0x502238[_0x3f5c('0x4f')]=_0x20a316;return _0x502238;})[_0x3f5c('0x33')](respondWithFilteredResult(_0x2e8bab,_0x49a5c6))['catch'](handleError(_0x2e8bab,null));};exports[_0x3f5c('0x50')]=function(_0x4cb316,_0x195206){var _0x42f94e={'raw':![],'where':{'id':_0x4cb316[_0x3f5c('0x51')]['id']}},_0x3726a5={};_0x3726a5[_0x3f5c('0x3a')]=_[_0x3f5c('0x3b')](db[_0x3f5c('0x39')]['rawAttributes']);_0x3726a5['query']=_['keys'](_0x4cb316[_0x3f5c('0x3c')]);_0x3726a5['filters']=_['intersection'](_0x3726a5[_0x3f5c('0x3a')],_0x3726a5[_0x3f5c('0x3c')]);_0x42f94e['attributes']=_[_0x3f5c('0x3e')](_0x3726a5['model'],qs[_0x3f5c('0x40')](_0x4cb316[_0x3f5c('0x3c')][_0x3f5c('0x40')]));_0x42f94e[_0x3f5c('0x3f')]=_0x42f94e[_0x3f5c('0x3f')][_0x3f5c('0x41')]?_0x42f94e['attributes']:_0x3726a5['model'];if(_0x4cb316['query'][_0x3f5c('0x52')]){_0x42f94e[_0x3f5c('0x4d')]=[{'all':!![]}];}_0x42f94e=_['merge']({},_0x42f94e,_0x4cb316[_0x3f5c('0x4c')]);return db[_0x3f5c('0x39')][_0x3f5c('0x53')](_0x42f94e)[_0x3f5c('0x33')](handleEntityNotFound(_0x195206,null))['then'](respondWithResult(_0x195206,null))[_0x3f5c('0x54')](handleError(_0x195206,null));};exports[_0x3f5c('0x55')]=function(_0x38bbdf,_0x4e95e4){var _0x6c2e89={'raw':![],'where':{'id':_0x38bbdf[_0x3f5c('0x51')]['id']}},_0x6031d4={};_0x6031d4[_0x3f5c('0x3a')]=_[_0x3f5c('0x3b')](db[_0x3f5c('0x39')][_0x3f5c('0x56')]);_0x6c2e89[_0x3f5c('0x3f')]=_['intersection'](_0x6031d4[_0x3f5c('0x3a')],qs[_0x3f5c('0x40')](_0x38bbdf[_0x3f5c('0x3c')][_0x3f5c('0x40')]));_0x6c2e89[_0x3f5c('0x3f')]=_0x6c2e89[_0x3f5c('0x3f')]['length']?_0x6c2e89[_0x3f5c('0x3f')]:_0x6031d4[_0x3f5c('0x3a')];if(_0x38bbdf[_0x3f5c('0x3c')][_0x3f5c('0x52')]){_0x6c2e89['include']=[{'all':!![]}];}_0x6c2e89=_[_0x3f5c('0x49')]({},_0x6c2e89,_0x38bbdf[_0x3f5c('0x4c')]);return db[_0x3f5c('0x39')][_0x3f5c('0x53')](_0x6c2e89)[_0x3f5c('0x33')](handleEntityNotFound(_0x4e95e4,null))[_0x3f5c('0x33')](function(_0x75d875){if(_0x75d875){var _0x2ef44c=_0x75d875[_0x3f5c('0x57')]({'plain':!![]});_0x2ef44c=qs['omit'](_0x2ef44c,['id',_0x3f5c('0x58'),'updatedAt']);_0x38bbdf[_0x3f5c('0x59')]=_['omit'](_0x38bbdf['body'],['id',_0x3f5c('0x58'),'updatedAt']);return db[_0x3f5c('0x39')][_0x3f5c('0x5a')](_[_0x3f5c('0x49')](_0x2ef44c,_0x38bbdf['body']),{'include':_0x38bbdf['query'][_0x3f5c('0x52')]?[{'all':!![]}]:undefined})[_0x3f5c('0x33')](function(_0x578553){var _0x118bc7=_0x38bbdf[_0x3f5c('0x5b')][_0x3f5c('0x57')]({'plain':!![]});if(!_0x118bc7)throw new Error(_0x3f5c('0x5c'));if(_0x118bc7[_0x3f5c('0x5d')]===_0x3f5c('0x5b')){var _0x1d2212=_0x578553[_0x3f5c('0x57')]({'plain':!![]});var _0x5d62aa='Trunks';return db[_0x3f5c('0x5e')][_0x3f5c('0x53')]({'where':{'name':_0x5d62aa,'userProfileId':_0x118bc7[_0x3f5c('0x5f')]},'raw':!![]})[_0x3f5c('0x33')](function(_0x5961d0){if(_0x5961d0&&_0x5961d0['autoAssociation']===0x0){return db[_0x3f5c('0x35')][_0x3f5c('0x5a')]({'name':_0x1d2212[_0x3f5c('0x37')],'resourceId':_0x1d2212['id'],'type':_0x5961d0[_0x3f5c('0x37')],'sectionId':_0x5961d0['id']},{})[_0x3f5c('0x33')](function(){return _0x578553;});}else{return _0x578553;}})[_0x3f5c('0x54')](function(_0x1a26cd){logger[_0x3f5c('0x22')](_0x3f5c('0x60'),_0x1a26cd);throw _0x1a26cd;});}return _0x578553;});}})[_0x3f5c('0x33')](respondWithResult(_0x4e95e4,0xc9))[_0x3f5c('0x54')](handleError(_0x4e95e4,null));};exports[_0x3f5c('0x5a')]=function(_0xc4248f,_0x2b3008,_0x2b4977){var _0x1e2d51;return db['Trunk']['create'](_0xc4248f[_0x3f5c('0x59')],{'raw':!![]})[_0x3f5c('0x33')](function(_0x5bee23){_0x1e2d51=_0x5bee23;return db[_0x3f5c('0x39')]['findAll']({'raw':!![]});})['then'](function(_0x5945ab){var _0x41d835=fs['readFileSync'](path[_0x3f5c('0x61')](config[_0x3f5c('0x62')],_0x3f5c('0x63')),'utf8');var _0xdcc4a7=fs[_0x3f5c('0x64')](path[_0x3f5c('0x61')](config[_0x3f5c('0x62')],'server/files/templates/registry.ejs'),_0x3f5c('0x65'));var _0x253820=ejs['render'](_0x41d835,{'trunks':_0x5945ab||[]});fs[_0x3f5c('0x66')](_0x3f5c('0x67'),_0x253820);if(_0x1e2d51[_0x3f5c('0x68')]){var _0x2e315b=ejs[_0x3f5c('0x69')](_0xdcc4a7,{'trunks':_0x5945ab||[]});fs[_0x3f5c('0x66')](_0x3f5c('0x6a'),_0x2e315b);}})[_0x3f5c('0x33')](function(){return respondWithRpcPromise('Reload',_0x3f5c('0x5a'),{'module':'chan_sip.so'});})[_0x3f5c('0x33')](function(){var _0x5bb3f3=_0xc4248f[_0x3f5c('0x5b')][_0x3f5c('0x57')]({'plain':!![]});if(!_0x5bb3f3)throw new Error(_0x3f5c('0x5c'));if(_0x5bb3f3['role']===_0x3f5c('0x5b')){var _0x422a50=_0x1e2d51['get']({'plain':!![]});return db[_0x3f5c('0x5e')]['find']({'where':{'name':_0x3f5c('0x6b'),'userProfileId':_0x5bb3f3[_0x3f5c('0x5f')]},'raw':!![]})[_0x3f5c('0x33')](function(_0x4ee33b){if(_0x4ee33b&&_0x4ee33b['autoAssociation']===0x0){return db[_0x3f5c('0x35')]['create']({'name':_0x422a50[_0x3f5c('0x37')],'resourceId':_0x422a50['id'],'type':_0x4ee33b[_0x3f5c('0x37')],'sectionId':_0x4ee33b['id']},{})[_0x3f5c('0x33')](function(){return _0x1e2d51;});}else{return _0x1e2d51;}})[_0x3f5c('0x54')](function(_0x4ca7a2){logger[_0x3f5c('0x22')](_0x3f5c('0x60'),_0x4ca7a2);throw _0x4ca7a2;});}return _0x1e2d51;})[_0x3f5c('0x33')](respondWithResult(_0x2b3008,0xc9))[_0x3f5c('0x54')](handleError(_0x2b3008,null));};exports[_0x3f5c('0x32')]=function(_0x1f67f9,_0x3d5eae,_0x5bd824){var _0x2c2a08;return db[_0x3f5c('0x39')][_0x3f5c('0x53')]({'where':{'id':_0x1f67f9[_0x3f5c('0x51')]['id']}})[_0x3f5c('0x33')](handleEntityNotFound(_0x3d5eae,null))[_0x3f5c('0x33')](saveUpdates(_0x1f67f9[_0x3f5c('0x59')],null))[_0x3f5c('0x33')](function(_0x25a8a4){if(_0x25a8a4){_0x2c2a08=_0x25a8a4;return db[_0x3f5c('0x39')]['findAll']({'raw':!![]});}})[_0x3f5c('0x33')](function(_0x41df70){if(_0x41df70){var _0x31929c=fs[_0x3f5c('0x64')](path[_0x3f5c('0x61')](config[_0x3f5c('0x62')],_0x3f5c('0x63')),_0x3f5c('0x65'));var _0x40c686=fs[_0x3f5c('0x64')](path[_0x3f5c('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x3f5c('0x65'));var _0x35e8e3=ejs['render'](_0x31929c,{'trunks':_0x41df70||[]});fs[_0x3f5c('0x66')](_0x3f5c('0x67'),_0x35e8e3);var _0x3ec3cd=ejs[_0x3f5c('0x69')](_0x40c686,{'trunks':_0x41df70||[]});fs['writeFileSync'](_0x3f5c('0x6a'),_0x3ec3cd);return respondWithRpcPromise(_0x3f5c('0x6c'),'update',{'module':'chan_sip.so'});}return null;})['then'](function(_0xf3695){if(_0xf3695){return _0x2c2a08;}})[_0x3f5c('0x33')](respondWithResult(_0x3d5eae,null))[_0x3f5c('0x54')](handleError(_0x3d5eae,null));};exports[_0x3f5c('0x34')]=function(_0x1239bb,_0xdc86f4,_0x4afb88){var _0x16cadd;return db[_0x3f5c('0x39')][_0x3f5c('0x53')]({'where':{'id':_0x1239bb[_0x3f5c('0x51')]['id']}})['then'](handleEntityNotFound(_0xdc86f4,null))['then'](removeEntity(_0xdc86f4,null))['then'](function(){return db['Trunk'][_0x3f5c('0x4e')]({'raw':!![]});})['then'](function(_0x3912a2){var _0x318534=fs[_0x3f5c('0x64')](path[_0x3f5c('0x61')](config[_0x3f5c('0x62')],_0x3f5c('0x63')),'utf8');var _0x1261aa=fs['readFileSync'](path['join'](config['root'],_0x3f5c('0x6d')),_0x3f5c('0x65'));var _0x15cd5b=ejs[_0x3f5c('0x69')](_0x318534,{'trunks':_0x3912a2});var _0x5b54ca=ejs[_0x3f5c('0x69')](_0x1261aa,{'trunks':_0x3912a2});fs[_0x3f5c('0x66')](_0x3f5c('0x67'),_0x15cd5b);fs['writeFileSync'](_0x3f5c('0x6a'),_0x5b54ca);return respondWithRpcPromise('Reload',_0x3f5c('0x34'),{'module':_0x3f5c('0x6e')});})[_0x3f5c('0x54')](handleError(_0xdc86f4,null));}; \ No newline at end of file +var _0x274d=['autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','key','VIRTUAL','field','includeAll','include','rows','show','params','options','find','clone','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x583771,_0x3778c5){var _0x2d7251=function(_0x2052d4){while(--_0x2052d4){_0x583771['push'](_0x583771['shift']());}};_0x2d7251(++_0x3778c5);}(_0x274d,0x1e4));var _0xd274=function(_0x1d46f7,_0x2dc752){_0x1d46f7=_0x1d46f7-0x0;var _0x51118f=_0x274d[_0x1d46f7];return _0x51118f;};'use strict';var pdf=require(_0xd274('0x0'));var emlformat=require(_0xd274('0x1'));var rimraf=require(_0xd274('0x2'));var zipdir=require(_0xd274('0x3'));var jsonpatch=require(_0xd274('0x4'));var rp=require(_0xd274('0x5'));var moment=require(_0xd274('0x6'));var BPromise=require(_0xd274('0x7'));var Mustache=require(_0xd274('0x8'));var util=require(_0xd274('0x9'));var path=require(_0xd274('0xa'));var sox=require('sox');var csv=require(_0xd274('0xb'));var ejs=require(_0xd274('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd274('0xd'));var crypto=require(_0xd274('0xe'));var jsforce=require(_0xd274('0xf'));var deskjs=require(_0xd274('0x10'));var toCsv=require(_0xd274('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd274('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd274('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd274('0x13'))('api');var utils=require(_0xd274('0x14'));var config=require('../../config/environment');var db=require(_0xd274('0x15'))['db'];var jayson=require(_0xd274('0x16'));var client=jayson[_0xd274('0x17')][_0xd274('0x18')]({'port':0x232a});function checkPasswordPattern(_0x157c25,_0x146812,_0x492f7f){if(_0x492f7f){var _0x55316e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55316e[_0xd274('0x19')](_0x146812)){return _0x157c25;}else{throw new Error(_0xd274('0x1a'));}}else{return _0x157c25;}}function respondWithRpcPromise(_0x5a39c1,_0x322e1c,_0xb1ac20,_0x41dd81){return new BPromise(function(_0x5a6d5e,_0xe64505){var _0x3e9eac=_0x41dd81||client;return _0x3e9eac[_0xd274('0x1b')](_0x5a39c1,_0xb1ac20)[_0xd274('0x1c')](function(_0x2ca6d4){logger[_0xd274('0x1d')](_0xd274('0x1e'),_0x322e1c,'request\x20sent');logger[_0xd274('0x1f')](_0xd274('0x20'),_0x322e1c,_0xd274('0x21'),JSON[_0xd274('0x22')](_0x2ca6d4));if(_0x2ca6d4['error']){if(_0x2ca6d4[_0xd274('0x23')][_0xd274('0x24')]===0x1f4){logger[_0xd274('0x23')](_0xd274('0x1e'),_0x322e1c,_0x2ca6d4['error'][_0xd274('0x25')]);return _0xe64505(_0x2ca6d4[_0xd274('0x23')]['message']);}logger[_0xd274('0x23')](_0xd274('0x1e'),_0x322e1c,_0x2ca6d4[_0xd274('0x23')][_0xd274('0x25')]);return _0x5a6d5e(_0x2ca6d4['error'][_0xd274('0x25')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x322e1c,'request\x20sent');_0x5a6d5e(_0x2ca6d4[_0xd274('0x26')]['message']);}})[_0xd274('0x27')](function(_0x3de6c5){logger[_0xd274('0x23')](_0xd274('0x1e'),_0x322e1c,_0x3de6c5);_0xe64505(_0x3de6c5);});});}function respondWithStatusCode(_0x5b6fd6,_0x3697ea){_0x3697ea=_0x3697ea||0xcc;return function(_0x667bbb){if(_0x667bbb){return _0x5b6fd6[_0xd274('0x28')](_0x3697ea);}return _0x5b6fd6[_0xd274('0x29')](_0x3697ea)[_0xd274('0x2a')]();};}function respondWithResult(_0x36fb36,_0x2467c8){_0x2467c8=_0x2467c8||0xc8;return function(_0x41cf20){if(_0x41cf20){return _0x36fb36[_0xd274('0x29')](_0x2467c8)['json'](_0x41cf20);}};}function respondWithFilteredResult(_0x430201,_0x91506){return function(_0xf6e73f){if(_0xf6e73f){var _0x10303a=_0xf6e73f[_0xd274('0x2b')],_0x341231=_0x91506[_0xd274('0x2c')],_0x5e21e9=_0x91506['offset']+_0x91506[_0xd274('0x2d')],_0x2a5e67;if(_0x5e21e9>=_0x10303a){_0x5e21e9=_0x10303a;_0x2a5e67=0xc8;}else{_0x2a5e67=0xce;}_0x430201[_0xd274('0x29')](_0x2a5e67);return _0x430201[_0xd274('0x2e')](_0xd274('0x2f'),_0x341231+'-'+_0x5e21e9+'/'+_0x10303a)[_0xd274('0x30')](_0xf6e73f);}return null;};}function patchUpdates(_0x4ebfcd){return function(_0xf9bc93){try{jsonpatch[_0xd274('0x31')](_0xf9bc93,_0x4ebfcd,!![]);}catch(_0x95e109){return BPromise[_0xd274('0x32')](_0x95e109);}return _0xf9bc93[_0xd274('0x33')]();};}function saveUpdates(_0x3f741f,_0x19bbd3){return function(_0x4cb96b){if(_0x4cb96b){return _0x4cb96b[_0xd274('0x34')](_0x3f741f)[_0xd274('0x1c')](function(_0x2957a1){return _0x2957a1;});}return null;};}function removeEntity(_0x2acdff,_0x157036){return function(_0x48ea02){if(_0x48ea02){return _0x48ea02[_0xd274('0x35')]()[_0xd274('0x1c')](function(){var _0xd105e1=_0x48ea02[_0xd274('0x36')]({'plain':!![]});var _0x54b387=_0xd274('0x37');return db[_0xd274('0x38')][_0xd274('0x35')]({'where':{'type':_0x54b387,'resourceId':_0xd105e1['id']}})['then'](function(){return _0x48ea02;});})[_0xd274('0x1c')](function(){_0x2acdff[_0xd274('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28bf9a,_0xa9a6eb){return function(_0x34247e){if(!_0x34247e){_0x28bf9a[_0xd274('0x28')](0x194);}return _0x34247e;};}function handleError(_0x35a6ea,_0xa1a1b1){_0xa1a1b1=_0xa1a1b1||0x1f4;return function(_0x5ec484){logger['error'](_0x5ec484[_0xd274('0x39')]);if(_0x5ec484[_0xd274('0x3a')]){delete _0x5ec484[_0xd274('0x3a')];}_0x35a6ea[_0xd274('0x29')](_0xa1a1b1)[_0xd274('0x3b')](_0x5ec484);};}exports[_0xd274('0x3c')]=function(_0x4cbeb4,_0x5f5cd0){var _0x1fbce2={},_0x4c1ca0={},_0x448891={'count':0x0,'rows':[]};var _0xb746a=db[_0xd274('0x3d')][_0xd274('0x3e')];_0x4c1ca0[_0xd274('0x3f')]=_[_0xd274('0x40')](_0xb746a);_0x4c1ca0[_0xd274('0x41')]=_[_0xd274('0x40')](_0x4cbeb4[_0xd274('0x41')]);_0x4c1ca0['filters']=_[_0xd274('0x42')](_0x4c1ca0['model'],_0x4c1ca0[_0xd274('0x41')]);_0x1fbce2[_0xd274('0x43')]=_['intersection'](_0x4c1ca0[_0xd274('0x3f')],qs[_0xd274('0x44')](_0x4cbeb4[_0xd274('0x41')][_0xd274('0x44')]));_0x1fbce2[_0xd274('0x43')]=_0x1fbce2[_0xd274('0x43')][_0xd274('0x45')]?_0x1fbce2[_0xd274('0x43')]:_0x4c1ca0[_0xd274('0x3f')];if(!_0x4cbeb4[_0xd274('0x41')][_0xd274('0x46')](_0xd274('0x47'))){_0x1fbce2['limit']=qs[_0xd274('0x2d')](_0x4cbeb4[_0xd274('0x41')][_0xd274('0x2d')]);_0x1fbce2[_0xd274('0x2c')]=qs[_0xd274('0x2c')](_0x4cbeb4['query'][_0xd274('0x2c')]);}_0x1fbce2[_0xd274('0x48')]=qs['sort'](_0x4cbeb4[_0xd274('0x41')][_0xd274('0x49')]);_0x1fbce2[_0xd274('0x4a')]=qs[_0xd274('0x4b')](_[_0xd274('0x4c')](_0x4cbeb4[_0xd274('0x41')],_0x4c1ca0['filters']));if(_0x4cbeb4[_0xd274('0x41')][_0xd274('0x4d')]){_0x1fbce2[_0xd274('0x4a')]=_[_0xd274('0x4e')](_0x1fbce2['where'],{'$or':_['map'](_0xb746a,function(_0x4759a2){if(_0x4759a2[_0xd274('0x4f')][_0xd274('0x50')]!==_0xd274('0x51')){var _0x2d9a2f={};_0x2d9a2f[_0x4759a2[_0xd274('0x52')]]={'$like':'%'+_0x4cbeb4['query'][_0xd274('0x4d')]+'%'};return _0x2d9a2f;}})});}_0x1fbce2=_[_0xd274('0x4e')]({},_0x1fbce2,_0x4cbeb4['options']);var _0x49da0a={'where':_0x1fbce2[_0xd274('0x4a')]};return db[_0xd274('0x3d')][_0xd274('0x2b')](_0x49da0a)[_0xd274('0x1c')](function(_0x66a4d1){_0x448891[_0xd274('0x2b')]=_0x66a4d1;if(_0x4cbeb4[_0xd274('0x41')][_0xd274('0x53')]){_0x1fbce2[_0xd274('0x54')]=[{'all':!![]}];}return db[_0xd274('0x3d')]['findAll'](_0x1fbce2);})['then'](function(_0x157f20){_0x448891[_0xd274('0x55')]=_0x157f20;return _0x448891;})[_0xd274('0x1c')](respondWithFilteredResult(_0x5f5cd0,_0x1fbce2))[_0xd274('0x27')](handleError(_0x5f5cd0,null));};exports[_0xd274('0x56')]=function(_0x5086ff,_0xad5ced){var _0x40681e={'raw':![],'where':{'id':_0x5086ff[_0xd274('0x57')]['id']}},_0x5d5764={};_0x5d5764[_0xd274('0x3f')]=_[_0xd274('0x40')](db[_0xd274('0x3d')]['rawAttributes']);_0x5d5764[_0xd274('0x41')]=_[_0xd274('0x40')](_0x5086ff[_0xd274('0x41')]);_0x5d5764[_0xd274('0x4b')]=_['intersection'](_0x5d5764[_0xd274('0x3f')],_0x5d5764[_0xd274('0x41')]);_0x40681e[_0xd274('0x43')]=_[_0xd274('0x42')](_0x5d5764['model'],qs['fields'](_0x5086ff['query'][_0xd274('0x44')]));_0x40681e[_0xd274('0x43')]=_0x40681e[_0xd274('0x43')][_0xd274('0x45')]?_0x40681e[_0xd274('0x43')]:_0x5d5764[_0xd274('0x3f')];if(_0x5086ff[_0xd274('0x41')][_0xd274('0x53')]){_0x40681e['include']=[{'all':!![]}];}_0x40681e=_['merge']({},_0x40681e,_0x5086ff[_0xd274('0x58')]);return db['Trunk'][_0xd274('0x59')](_0x40681e)['then'](handleEntityNotFound(_0xad5ced,null))[_0xd274('0x1c')](respondWithResult(_0xad5ced,null))[_0xd274('0x27')](handleError(_0xad5ced,null));};exports[_0xd274('0x5a')]=function(_0x2ab3cb,_0x58f9cd){var _0x2323bd={'raw':![],'where':{'id':_0x2ab3cb[_0xd274('0x57')]['id']}},_0x47d4b6={};_0x47d4b6[_0xd274('0x3f')]=_[_0xd274('0x40')](db[_0xd274('0x3d')][_0xd274('0x3e')]);_0x2323bd[_0xd274('0x43')]=_[_0xd274('0x42')](_0x47d4b6[_0xd274('0x3f')],qs[_0xd274('0x44')](_0x2ab3cb['query'][_0xd274('0x44')]));_0x2323bd[_0xd274('0x43')]=_0x2323bd[_0xd274('0x43')]['length']?_0x2323bd[_0xd274('0x43')]:_0x47d4b6[_0xd274('0x3f')];if(_0x2ab3cb['query'][_0xd274('0x53')]){_0x2323bd[_0xd274('0x54')]=[{'all':!![]}];}_0x2323bd=_['merge']({},_0x2323bd,_0x2ab3cb['options']);return db[_0xd274('0x3d')][_0xd274('0x59')](_0x2323bd)[_0xd274('0x1c')](handleEntityNotFound(_0x58f9cd,null))[_0xd274('0x1c')](function(_0x1f1f56){if(_0x1f1f56){var _0xd75e53=_0x1f1f56[_0xd274('0x36')]({'plain':!![]});_0xd75e53=qs[_0xd274('0x5b')](_0xd75e53,['id',_0xd274('0x5c'),'updatedAt']);_0x2ab3cb[_0xd274('0x5d')]=_[_0xd274('0x5b')](_0x2ab3cb[_0xd274('0x5d')],['id',_0xd274('0x5c'),_0xd274('0x5e')]);return db[_0xd274('0x3d')][_0xd274('0x5f')](_['merge'](_0xd75e53,_0x2ab3cb[_0xd274('0x5d')]),{'include':_0x2ab3cb['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd274('0x1c')](function(_0x313925){var _0x425210=_0x2ab3cb[_0xd274('0x60')][_0xd274('0x36')]({'plain':!![]});if(!_0x425210)throw new Error(_0xd274('0x61'));if(_0x425210[_0xd274('0x62')]===_0xd274('0x60')){var _0x216d68=_0x313925[_0xd274('0x36')]({'plain':!![]});var _0x382387='Trunks';return db[_0xd274('0x63')][_0xd274('0x59')]({'where':{'name':_0x382387,'userProfileId':_0x425210[_0xd274('0x64')]},'raw':!![]})[_0xd274('0x1c')](function(_0x4c2c48){if(_0x4c2c48&&_0x4c2c48[_0xd274('0x65')]===0x0){return db[_0xd274('0x38')][_0xd274('0x5f')]({'name':_0x216d68['name'],'resourceId':_0x216d68['id'],'type':_0x4c2c48[_0xd274('0x3a')],'sectionId':_0x4c2c48['id']},{})['then'](function(){return _0x313925;});}else{return _0x313925;}})[_0xd274('0x27')](function(_0x547694){logger[_0xd274('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x547694);throw _0x547694;});}return _0x313925;});}})[_0xd274('0x1c')](respondWithResult(_0x58f9cd,0xc9))[_0xd274('0x27')](handleError(_0x58f9cd,null));};exports['create']=function(_0xf1c756,_0x11ba6a,_0x52dcf9){var _0x590135;return db['Trunk'][_0xd274('0x5f')](_0xf1c756[_0xd274('0x5d')],{'raw':!![]})[_0xd274('0x1c')](function(_0x23426b){_0x590135=_0x23426b;return db[_0xd274('0x3d')][_0xd274('0x66')]({'raw':!![]});})['then'](function(_0x93f8ad){var _0x3df0b3=fs[_0xd274('0x67')](path['join'](config[_0xd274('0x68')],_0xd274('0x69')),_0xd274('0x6a'));var _0x2da0f8=fs[_0xd274('0x67')](path[_0xd274('0x6b')](config['root'],_0xd274('0x6c')),_0xd274('0x6a'));var _0x15dd4a=ejs[_0xd274('0x6d')](_0x3df0b3,{'trunks':_0x93f8ad||[]});fs['writeFileSync'](_0xd274('0x6e'),_0x15dd4a);if(_0x590135[_0xd274('0x6f')]){var _0x1ad8f2=ejs[_0xd274('0x6d')](_0x2da0f8,{'trunks':_0x93f8ad||[]});fs[_0xd274('0x70')]('/etc/asterisk/sip_xcally_registers.conf',_0x1ad8f2);}})[_0xd274('0x1c')](function(){return respondWithRpcPromise(_0xd274('0x71'),'create',{'module':_0xd274('0x72')});})[_0xd274('0x1c')](function(){var _0x35a413=_0xf1c756['user'][_0xd274('0x36')]({'plain':!![]});if(!_0x35a413)throw new Error(_0xd274('0x61'));if(_0x35a413[_0xd274('0x62')]===_0xd274('0x60')){var _0x1d0e49=_0x590135['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xd274('0x37'),'userProfileId':_0x35a413[_0xd274('0x64')]},'raw':!![]})['then'](function(_0xdce3d1){if(_0xdce3d1&&_0xdce3d1[_0xd274('0x65')]===0x0){return db[_0xd274('0x38')][_0xd274('0x5f')]({'name':_0x1d0e49[_0xd274('0x3a')],'resourceId':_0x1d0e49['id'],'type':_0xdce3d1[_0xd274('0x3a')],'sectionId':_0xdce3d1['id']},{})['then'](function(){return _0x590135;});}else{return _0x590135;}})[_0xd274('0x27')](function(_0x5d7e33){logger[_0xd274('0x23')](_0xd274('0x73'),_0x5d7e33);throw _0x5d7e33;});}return _0x590135;})[_0xd274('0x1c')](respondWithResult(_0x11ba6a,0xc9))[_0xd274('0x27')](handleError(_0x11ba6a,null));};exports[_0xd274('0x34')]=function(_0x2e4148,_0x13a628,_0x3c513d){var _0x1cd540;return db[_0xd274('0x3d')][_0xd274('0x59')]({'where':{'id':_0x2e4148['params']['id']}})[_0xd274('0x1c')](handleEntityNotFound(_0x13a628,null))[_0xd274('0x1c')](saveUpdates(_0x2e4148[_0xd274('0x5d')],null))['then'](function(_0x15a47d){if(_0x15a47d){_0x1cd540=_0x15a47d;return db['Trunk'][_0xd274('0x66')]({'raw':!![]});}})[_0xd274('0x1c')](function(_0x5866dd){if(_0x5866dd){var _0x3c30e4=fs[_0xd274('0x67')](path[_0xd274('0x6b')](config['root'],_0xd274('0x69')),_0xd274('0x6a'));var _0x40fef3=fs[_0xd274('0x67')](path[_0xd274('0x6b')](config[_0xd274('0x68')],'server/files/templates/registry.ejs'),'utf8');var _0x16f81b=ejs[_0xd274('0x6d')](_0x3c30e4,{'trunks':_0x5866dd||[]});fs[_0xd274('0x70')](_0xd274('0x6e'),_0x16f81b);var _0x3fa6dd=ejs[_0xd274('0x6d')](_0x40fef3,{'trunks':_0x5866dd||[]});fs['writeFileSync'](_0xd274('0x74'),_0x3fa6dd);return respondWithRpcPromise(_0xd274('0x71'),_0xd274('0x34'),{'module':_0xd274('0x72')});}return null;})[_0xd274('0x1c')](function(_0x5ec3f1){if(_0x5ec3f1){return _0x1cd540;}})['then'](respondWithResult(_0x13a628,null))[_0xd274('0x27')](handleError(_0x13a628,null));};exports[_0xd274('0x35')]=function(_0xde7baf,_0x34e4d8,_0x29b8cc){var _0x167a4d;return db['Trunk'][_0xd274('0x59')]({'where':{'id':_0xde7baf[_0xd274('0x57')]['id']}})['then'](handleEntityNotFound(_0x34e4d8,null))[_0xd274('0x1c')](removeEntity(_0x34e4d8,null))[_0xd274('0x1c')](function(){return db['Trunk'][_0xd274('0x66')]({'raw':!![]});})[_0xd274('0x1c')](function(_0x29fe8e){var _0x185709=fs[_0xd274('0x67')](path['join'](config[_0xd274('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x55fc52=fs[_0xd274('0x67')](path['join'](config['root'],_0xd274('0x6c')),'utf8');var _0x262b87=ejs[_0xd274('0x6d')](_0x185709,{'trunks':_0x29fe8e});var _0x1ffeb6=ejs[_0xd274('0x6d')](_0x55fc52,{'trunks':_0x29fe8e});fs[_0xd274('0x70')](_0xd274('0x6e'),_0x262b87);fs[_0xd274('0x70')](_0xd274('0x74'),_0x1ffeb6);return respondWithRpcPromise(_0xd274('0x71'),'destroy',{'module':_0xd274('0x72')});})['catch'](handleError(_0x34e4d8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7f74cb1..9c4eb8f 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 _0x032e=['exports','define','Trunk','tools_trunks','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x032e,0x124));var _0xe032=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x032e[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x950a=['../../config/logger','api','bluebird','request-promise','path','rimraf','./trunk.attributes','exports','define','lodash','util'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x950a,0x111));var _0xa950=function(_0x5a61e5,_0x504666){_0x5a61e5=_0x5a61e5-0x0;var _0x45b29e=_0x950a[_0x5a61e5];return _0x45b29e;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('Trunk',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 7bce18c..e10575f 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 _0xecbf=['rpc','../../config/environment','http','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetTrunk','Trunk','options','raw','where','attributes','include','map','model','ShowTrunk','lodash','util','randomstring','ioredis','../../config/logger'];(function(_0xbdd090,_0xbde27d){var _0x51b5d5=function(_0x3009b0){while(--_0x3009b0){_0xbdd090['push'](_0xbdd090['shift']());}};_0x51b5d5(++_0xbde27d);}(_0xecbf,0x113));var _0xfecb=function(_0x37fbbf,_0x4a9e30){_0x37fbbf=_0x37fbbf-0x0;var _0x178a13=_0xecbf[_0x37fbbf];return _0x178a13;};'use strict';var _=require(_0xfecb('0x0'));var util=require(_0xfecb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfecb('0x2'));var fs=require('fs');var Redis=require(_0xfecb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfecb('0x4'))(_0xfecb('0x5'));var config=require(_0xfecb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfecb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a6593,_0x329ecb,_0x29662d){return new BPromise(function(_0x444069,_0x25102b){return client['request'](_0x5a6593,_0x29662d)[_0xfecb('0x8')](function(_0x51b292){logger[_0xfecb('0x9')](_0xfecb('0xa'),_0x329ecb,'request\x20sent');logger[_0xfecb('0xb')](_0xfecb('0xc'),_0x329ecb,_0xfecb('0xd'),JSON[_0xfecb('0xe')](_0x51b292));if(_0x51b292[_0xfecb('0xf')]){if(_0x51b292[_0xfecb('0xf')]['code']===0x1f4){logger[_0xfecb('0xf')](_0xfecb('0xa'),_0x329ecb,_0x51b292['error'][_0xfecb('0x10')]);return _0x25102b(_0x51b292['error'][_0xfecb('0x10')]);}logger['error'](_0xfecb('0xa'),_0x329ecb,_0x51b292['error'][_0xfecb('0x10')]);return _0x444069(_0x51b292['error'][_0xfecb('0x10')]);}else{logger[_0xfecb('0x9')](_0xfecb('0xa'),_0x329ecb,_0xfecb('0xd'));_0x444069(_0x51b292['result'][_0xfecb('0x10')]);}})[_0xfecb('0x11')](function(_0x19d1cf){logger['error'](_0xfecb('0xa'),_0x329ecb,_0x19d1cf);_0x25102b(_0x19d1cf);});});}exports[_0xfecb('0x12')]=function(_0x56fa15){var _0x11c4bc=this;return new Promise(function(_0x20e667,_0x4b680e){return db[_0xfecb('0x13')]['findAll']({'raw':_0x56fa15[_0xfecb('0x14')]?_0x56fa15[_0xfecb('0x14')][_0xfecb('0x15')]===undefined?!![]:![]:!![],'where':_0x56fa15[_0xfecb('0x14')]?_0x56fa15[_0xfecb('0x14')][_0xfecb('0x16')]||null:null,'attributes':_0x56fa15[_0xfecb('0x14')]?_0x56fa15[_0xfecb('0x14')][_0xfecb('0x17')]||null:null,'limit':_0x56fa15[_0xfecb('0x14')]?_0x56fa15['options']['limit']||null:null,'include':_0x56fa15['options']?_0x56fa15[_0xfecb('0x14')][_0xfecb('0x18')]?_[_0xfecb('0x19')](_0x56fa15['options'][_0xfecb('0x18')],function(_0x42b74c){return{'model':db[_0x42b74c['model']],'as':_0x42b74c['as'],'attributes':_0x42b74c['attributes'],'include':_0x42b74c[_0xfecb('0x18')]?_[_0xfecb('0x19')](_0x42b74c[_0xfecb('0x18')],function(_0x18aa0a){return{'model':db[_0x18aa0a[_0xfecb('0x1a')]],'as':_0x18aa0a['as'],'attributes':_0x18aa0a['attributes'],'include':_0x18aa0a[_0xfecb('0x18')]?_[_0xfecb('0x19')](_0x18aa0a['include'],function(_0x4035f7){return{'model':db[_0x4035f7[_0xfecb('0x1a')]],'as':_0x4035f7['as'],'attributes':_0x4035f7[_0xfecb('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfecb('0x8')](function(_0x53670a){logger[_0xfecb('0x9')](_0xfecb('0x12'),_0x56fa15);logger[_0xfecb('0xb')](_0xfecb('0x12'),_0x56fa15,JSON[_0xfecb('0xe')](_0x53670a));_0x20e667(_0x53670a);})[_0xfecb('0x11')](function(_0x530b99){logger['error'](_0xfecb('0x12'),_0x530b99[_0xfecb('0x10')],_0x56fa15);_0x4b680e(_0x11c4bc[_0xfecb('0xf')](0x1f4,_0x530b99['message']));});});};exports['ShowTrunk']=function(_0x4ab0d1){var _0x14c803=this;return new Promise(function(_0x4143b8,_0x15aa71){return db[_0xfecb('0x13')]['find']({'raw':_0x4ab0d1['options']?_0x4ab0d1[_0xfecb('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab0d1[_0xfecb('0x14')]?_0x4ab0d1[_0xfecb('0x14')]['where']||null:null,'attributes':_0x4ab0d1['options']?_0x4ab0d1[_0xfecb('0x14')][_0xfecb('0x17')]||null:null,'include':_0x4ab0d1['options']?_0x4ab0d1[_0xfecb('0x14')][_0xfecb('0x18')]?_['map'](_0x4ab0d1[_0xfecb('0x14')]['include'],function(_0x8c0498){return{'model':db[_0x8c0498[_0xfecb('0x1a')]],'as':_0x8c0498['as'],'attributes':_0x8c0498[_0xfecb('0x17')],'include':_0x8c0498['include']?_['map'](_0x8c0498[_0xfecb('0x18')],function(_0x588771){return{'model':db[_0x588771[_0xfecb('0x1a')]],'as':_0x588771['as'],'attributes':_0x588771[_0xfecb('0x17')],'include':_0x588771[_0xfecb('0x18')]?_[_0xfecb('0x19')](_0x588771['include'],function(_0x3a24dc){return{'model':db[_0x3a24dc[_0xfecb('0x1a')]],'as':_0x3a24dc['as'],'attributes':_0x3a24dc[_0xfecb('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x344359){logger[_0xfecb('0x9')](_0xfecb('0x1b'),_0x4ab0d1);logger['debug'](_0xfecb('0x1b'),_0x4ab0d1,JSON[_0xfecb('0xe')](_0x344359));_0x4143b8(_0x344359);})['catch'](function(_0x35035c){logger[_0xfecb('0xf')]('ShowTrunk',_0x35035c[_0xfecb('0x10')],_0x4ab0d1);_0x15aa71(_0x14c803['error'](0x1f4,_0x35035c['message']));});});}; \ No newline at end of file +var _0xe7c8=['debug','GetTrunk','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk','options','raw','attributes','include','map','model'];(function(_0x16435a,_0x594b8d){var _0x3ad31d=function(_0x57975c){while(--_0x57975c){_0x16435a['push'](_0x16435a['shift']());}};_0x3ad31d(++_0x594b8d);}(_0xe7c8,0x8c));var _0x8e7c=function(_0x101cd1,_0x9e28ef){_0x101cd1=_0x101cd1-0x0;var _0x2e50b0=_0xe7c8[_0x101cd1];return _0x2e50b0;};'use strict';var _=require(_0x8e7c('0x0'));var util=require(_0x8e7c('0x1'));var moment=require(_0x8e7c('0x2'));var BPromise=require(_0x8e7c('0x3'));var rs=require(_0x8e7c('0x4'));var fs=require('fs');var Redis=require(_0x8e7c('0x5'));var db=require(_0x8e7c('0x6'))['db'];var utils=require(_0x8e7c('0x7'));var logger=require('../../config/logger')(_0x8e7c('0x8'));var config=require(_0x8e7c('0x9'));var jayson=require(_0x8e7c('0xa'));var client=jayson[_0x8e7c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x366dd4,_0x5456a4,_0x394600){return new BPromise(function(_0x27a583,_0x1f0f67){return client[_0x8e7c('0xc')](_0x366dd4,_0x394600)[_0x8e7c('0xd')](function(_0x4f88a8){logger[_0x8e7c('0xe')](_0x8e7c('0xf'),_0x5456a4,_0x8e7c('0x10'));logger['debug'](_0x8e7c('0x11'),_0x5456a4,_0x8e7c('0x10'),JSON[_0x8e7c('0x12')](_0x4f88a8));if(_0x4f88a8[_0x8e7c('0x13')]){if(_0x4f88a8['error']['code']===0x1f4){logger[_0x8e7c('0x13')](_0x8e7c('0xf'),_0x5456a4,_0x4f88a8['error'][_0x8e7c('0x14')]);return _0x1f0f67(_0x4f88a8[_0x8e7c('0x13')][_0x8e7c('0x14')]);}logger[_0x8e7c('0x13')](_0x8e7c('0xf'),_0x5456a4,_0x4f88a8[_0x8e7c('0x13')][_0x8e7c('0x14')]);return _0x27a583(_0x4f88a8[_0x8e7c('0x13')][_0x8e7c('0x14')]);}else{logger['info'](_0x8e7c('0xf'),_0x5456a4,_0x8e7c('0x10'));_0x27a583(_0x4f88a8[_0x8e7c('0x15')][_0x8e7c('0x14')]);}})[_0x8e7c('0x16')](function(_0x1210f5){logger[_0x8e7c('0x13')](_0x8e7c('0xf'),_0x5456a4,_0x1210f5);_0x1f0f67(_0x1210f5);});});}exports['GetTrunk']=function(_0x8f17b9){var _0x188644=this;return new Promise(function(_0x5a0f7e,_0x4b6888){return db[_0x8e7c('0x17')]['findAll']({'raw':_0x8f17b9[_0x8e7c('0x18')]?_0x8f17b9[_0x8e7c('0x18')][_0x8e7c('0x19')]===undefined?!![]:![]:!![],'where':_0x8f17b9[_0x8e7c('0x18')]?_0x8f17b9[_0x8e7c('0x18')]['where']||null:null,'attributes':_0x8f17b9['options']?_0x8f17b9[_0x8e7c('0x18')][_0x8e7c('0x1a')]||null:null,'limit':_0x8f17b9['options']?_0x8f17b9[_0x8e7c('0x18')]['limit']||null:null,'include':_0x8f17b9[_0x8e7c('0x18')]?_0x8f17b9[_0x8e7c('0x18')][_0x8e7c('0x1b')]?_[_0x8e7c('0x1c')](_0x8f17b9[_0x8e7c('0x18')][_0x8e7c('0x1b')],function(_0x51f41d){return{'model':db[_0x51f41d[_0x8e7c('0x1d')]],'as':_0x51f41d['as'],'attributes':_0x51f41d[_0x8e7c('0x1a')],'include':_0x51f41d[_0x8e7c('0x1b')]?_[_0x8e7c('0x1c')](_0x51f41d[_0x8e7c('0x1b')],function(_0x249e2d){return{'model':db[_0x249e2d[_0x8e7c('0x1d')]],'as':_0x249e2d['as'],'attributes':_0x249e2d[_0x8e7c('0x1a')],'include':_0x249e2d[_0x8e7c('0x1b')]?_[_0x8e7c('0x1c')](_0x249e2d[_0x8e7c('0x1b')],function(_0x2807f2){return{'model':db[_0x2807f2[_0x8e7c('0x1d')]],'as':_0x2807f2['as'],'attributes':_0x2807f2[_0x8e7c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54fbba){logger[_0x8e7c('0xe')]('GetTrunk',_0x8f17b9);logger[_0x8e7c('0x1e')](_0x8e7c('0x1f'),_0x8f17b9,JSON['stringify'](_0x54fbba));_0x5a0f7e(_0x54fbba);})['catch'](function(_0x4d8551){logger[_0x8e7c('0x13')]('GetTrunk',_0x4d8551[_0x8e7c('0x14')],_0x8f17b9);_0x4b6888(_0x188644[_0x8e7c('0x13')](0x1f4,_0x4d8551[_0x8e7c('0x14')]));});});};exports[_0x8e7c('0x20')]=function(_0x258782){var _0x5b39fd=this;return new Promise(function(_0x300ac8,_0x3061d9){return db[_0x8e7c('0x17')]['find']({'raw':_0x258782['options']?_0x258782[_0x8e7c('0x18')][_0x8e7c('0x19')]===undefined?!![]:![]:!![],'where':_0x258782[_0x8e7c('0x18')]?_0x258782[_0x8e7c('0x18')][_0x8e7c('0x21')]||null:null,'attributes':_0x258782['options']?_0x258782[_0x8e7c('0x18')][_0x8e7c('0x1a')]||null:null,'include':_0x258782[_0x8e7c('0x18')]?_0x258782[_0x8e7c('0x18')][_0x8e7c('0x1b')]?_[_0x8e7c('0x1c')](_0x258782[_0x8e7c('0x18')][_0x8e7c('0x1b')],function(_0x41ae8e){return{'model':db[_0x41ae8e[_0x8e7c('0x1d')]],'as':_0x41ae8e['as'],'attributes':_0x41ae8e['attributes'],'include':_0x41ae8e[_0x8e7c('0x1b')]?_[_0x8e7c('0x1c')](_0x41ae8e[_0x8e7c('0x1b')],function(_0x1e943c){return{'model':db[_0x1e943c['model']],'as':_0x1e943c['as'],'attributes':_0x1e943c[_0x8e7c('0x1a')],'include':_0x1e943c[_0x8e7c('0x1b')]?_[_0x8e7c('0x1c')](_0x1e943c[_0x8e7c('0x1b')],function(_0x3377eb){return{'model':db[_0x3377eb[_0x8e7c('0x1d')]],'as':_0x3377eb['as'],'attributes':_0x3377eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e7c('0xd')](function(_0x24d3b0){logger[_0x8e7c('0xe')](_0x8e7c('0x20'),_0x258782);logger[_0x8e7c('0x1e')](_0x8e7c('0x20'),_0x258782,JSON[_0x8e7c('0x12')](_0x24d3b0));_0x300ac8(_0x24d3b0);})[_0x8e7c('0x16')](function(_0x43ffe1){logger[_0x8e7c('0x13')](_0x8e7c('0x20'),_0x43ffe1[_0x8e7c('0x14')],_0x258782);_0x3061d9(_0x5b39fd[_0x8e7c('0x13')](0x1f4,_0x43ffe1[_0x8e7c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c90fa3e..f4ded73 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 _0x5f25=['getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','getChatWebsites','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','bulkCreate','post','addContacts','diskStorage','join','root','server/files/images/','format','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeChatInteractions','removeFaxInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./user.controller','get','isAuthenticated','index','describe','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts'];(function(_0x3c0e15,_0x395438){var _0x4ac7ff=function(_0x67beae){while(--_0x67beae){_0x3c0e15['push'](_0x3c0e15['shift']());}};_0x4ac7ff(++_0x395438);}(_0x5f25,0x1cb));var _0x55f2=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x5f25[_0x265e0e];return _0x518157;};'use strict';var multer=require(_0x55f2('0x0'));var util=require(_0x55f2('0x1'));var path=require(_0x55f2('0x2'));var timeout=require(_0x55f2('0x3'));var express=require(_0x55f2('0x4'));var router=express[_0x55f2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x55f2('0x6'));var config=require('../../config/environment');var controller=require(_0x55f2('0x7'));router[_0x55f2('0x8')]('/',auth[_0x55f2('0x9')](),controller[_0x55f2('0xa')]);router[_0x55f2('0x8')]('/describe',auth[_0x55f2('0x9')](),controller[_0x55f2('0xb')]);router['get'](_0x55f2('0xc'),auth[_0x55f2('0x9')](),controller['show']);router[_0x55f2('0x8')](_0x55f2('0xd'),controller[_0x55f2('0xe')]);router[_0x55f2('0x8')](_0x55f2('0xf'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x10')]);router['get'](_0x55f2('0x11'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x12')]);router[_0x55f2('0x8')](_0x55f2('0x13'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x14')]);router['get'](_0x55f2('0x15'),auth['isAuthenticated'](),controller[_0x55f2('0x16')]);router[_0x55f2('0x8')](_0x55f2('0x17'),auth[_0x55f2('0x9')](),controller['getRecordings']);router[_0x55f2('0x8')]('/:id/screen_recordings',auth[_0x55f2('0x9')](),controller[_0x55f2('0x18')]);router[_0x55f2('0x8')](_0x55f2('0x19'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x1a')]);router[_0x55f2('0x8')](_0x55f2('0x1b'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x55f2('0x8')](_0x55f2('0x1c'),auth['isAuthenticated'](),controller[_0x55f2('0x1d')]);router['get'](_0x55f2('0x1e'),auth['isAuthenticated'](),controller[_0x55f2('0x1f')]);router[_0x55f2('0x8')](_0x55f2('0x20'),auth['isAuthenticated'](),controller[_0x55f2('0x21')]);router['get'](_0x55f2('0x22'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x23')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x55f2('0x24')]);router[_0x55f2('0x8')](_0x55f2('0x25'),auth['isAuthenticated'](),controller[_0x55f2('0x26')]);router['get'](_0x55f2('0x27'),auth[_0x55f2('0x9')](),controller['getVoicePrefixes']);router[_0x55f2('0x8')](_0x55f2('0x28'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x29')]);router[_0x55f2('0x8')](_0x55f2('0x2a'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x2b')]);router['get'](_0x55f2('0x2c'),auth[_0x55f2('0x9')](),controller['getOpenchannelAccounts']);router[_0x55f2('0x8')]('/:id/sms_accounts',auth[_0x55f2('0x9')](),controller[_0x55f2('0x2d')]);router[_0x55f2('0x8')]('/:id/chat_websites',auth[_0x55f2('0x9')](),controller[_0x55f2('0x2e')]);router[_0x55f2('0x8')](_0x55f2('0x2f'),auth[_0x55f2('0x9')](),controller['getSquareProjects']);router[_0x55f2('0x8')](_0x55f2('0x30'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x31')]);router[_0x55f2('0x8')]('/:id/api_key',auth[_0x55f2('0x9')](),controller[_0x55f2('0x32')]);router['post']('/create_many',auth[_0x55f2('0x9')](),controller[_0x55f2('0x33')]);router[_0x55f2('0x34')](_0x55f2('0xf'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x35')]);router[_0x55f2('0x34')]('/',auth[_0x55f2('0x9')](),controller['create']);router[_0x55f2('0x34')](_0x55f2('0x11'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x55f2('0x36')]({'destination':function(_0x3c9c1a,_0x1491d6,_0x4b8cca){_0x4b8cca(null,path[_0x55f2('0x37')](config[_0x55f2('0x38')],_0x55f2('0x39')));},'filename':function(_0x56ac4a,_0x4de21d,_0x1944d3){_0x1944d3(null,util[_0x55f2('0x3a')]('%s-%s',Date['now'](),_0x4de21d[_0x55f2('0x3b')]));}})});router['post'](_0x55f2('0xd'),upload[_0x55f2('0x3c')](_0x55f2('0x3d')),controller[_0x55f2('0x3e')]);router[_0x55f2('0x34')](_0x55f2('0x3f'),auth['isAuthenticated'](),controller[_0x55f2('0x40')]);router[_0x55f2('0x34')](_0x55f2('0x41'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x42')]);router['post']('/:id/pause',auth[_0x55f2('0x9')](),controller[_0x55f2('0x43')]);router[_0x55f2('0x34')](_0x55f2('0x44'),auth['isAuthenticated'](),controller['unpause']);router[_0x55f2('0x34')](_0x55f2('0x22'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x45')]);router[_0x55f2('0x34')]('/:id/chat_interactions',auth[_0x55f2('0x9')](),controller[_0x55f2('0x46')]);router['post']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x55f2('0x47')]);router[_0x55f2('0x34')](_0x55f2('0x48'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x49')]);router['post'](_0x55f2('0x4a'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x4b')]);router[_0x55f2('0x34')](_0x55f2('0x4c'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x4d')]);router['post'](_0x55f2('0x28'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x4e')]);router[_0x55f2('0x34')](_0x55f2('0x2a'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x4f')]);router[_0x55f2('0x34')](_0x55f2('0x2c'),auth['isAuthenticated'](),controller[_0x55f2('0x50')]);router[_0x55f2('0x34')](_0x55f2('0x51'),auth[_0x55f2('0x9')](),controller['addSmsAccounts']);router[_0x55f2('0x34')](_0x55f2('0x52'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x53')]);router['post']('/:id/square_projects',auth['isAuthenticated'](),controller[_0x55f2('0x54')]);router['post'](_0x55f2('0x55'),auth['isAuthenticated'](),controller[_0x55f2('0x56')]);router[_0x55f2('0x57')](_0x55f2('0xc'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x58')]);router[_0x55f2('0x57')](_0x55f2('0x59'),auth['isAuthenticated'](),controller[_0x55f2('0x5a')]);router[_0x55f2('0x5b')](_0x55f2('0x11'),auth[_0x55f2('0x9')](),controller['removeQueues']);router[_0x55f2('0x5b')]('/:id/teams',auth[_0x55f2('0x9')](),controller['removeTeams']);router[_0x55f2('0x5b')]('/:id',auth[_0x55f2('0x9')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0x55f2('0x9')](),controller[_0x55f2('0x5c')]);router['delete']('/:id/mail_interactions',auth[_0x55f2('0x9')](),controller['removeMailInteractions']);router[_0x55f2('0x5b')](_0x55f2('0x48'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x5d')]);router[_0x55f2('0x5b')](_0x55f2('0x4a'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0x55f2('0x4c'),auth[_0x55f2('0x9')](),controller['removeOpenchannelInteractions']);router[_0x55f2('0x5b')]('/:id/fax_accounts',auth[_0x55f2('0x9')](),controller[_0x55f2('0x5e')]);router[_0x55f2('0x5b')](_0x55f2('0x2a'),auth[_0x55f2('0x9')](),controller[_0x55f2('0x5f')]);router[_0x55f2('0x5b')](_0x55f2('0x2c'),auth[_0x55f2('0x9')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x55f2('0x60')]);router[_0x55f2('0x5b')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x55f2('0x61')]);router[_0x55f2('0x5b')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x55f2('0x62')]);router[_0x55f2('0x5b')](_0x55f2('0x55'),auth['isAuthenticated'](),controller[_0x55f2('0x63')]);module['exports']=router; \ No newline at end of file +var _0xc547=['/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','addQueues','join','root','server/files/images/','%s-%s','originalname','addAvatar','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','util','connect-timeout','Router','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/:id','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc547,0x153));var _0x7c54=function(_0x582538,_0x561bc6){_0x582538=_0x582538-0x0;var _0x84d3ee=_0xc547[_0x582538];return _0x84d3ee;};'use strict';var multer=require('multer');var util=require(_0x7c54('0x0'));var path=require('path');var timeout=require(_0x7c54('0x1'));var express=require('express');var router=express[_0x7c54('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7c54('0x3'));var controller=require(_0x7c54('0x4'));router[_0x7c54('0x5')]('/',auth[_0x7c54('0x6')](),controller[_0x7c54('0x7')]);router['get']('/describe',auth[_0x7c54('0x6')](),controller[_0x7c54('0x8')]);router[_0x7c54('0x5')](_0x7c54('0x9'),auth['isAuthenticated'](),controller[_0x7c54('0xa')]);router['get'](_0x7c54('0xb'),controller['getAvatar']);router[_0x7c54('0x5')](_0x7c54('0xc'),auth[_0x7c54('0x6')](),controller[_0x7c54('0xd')]);router['get'](_0x7c54('0xe'),auth[_0x7c54('0x6')](),controller['getQueues']);router['get'](_0x7c54('0xf'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x10')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0x7c54('0x11')]);router['get'](_0x7c54('0x12'),auth['isAuthenticated'](),controller[_0x7c54('0x13')]);router['get']('/:id/screen_recordings',auth[_0x7c54('0x6')](),controller['getScreenRecordings']);router[_0x7c54('0x5')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x7c54('0x14')]);router[_0x7c54('0x5')](_0x7c54('0x15'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x16')]);router[_0x7c54('0x5')](_0x7c54('0x17'),auth['isAuthenticated'](),controller[_0x7c54('0x18')]);router['get']('/:id/sms/interactions',auth[_0x7c54('0x6')](),controller[_0x7c54('0x19')]);router[_0x7c54('0x5')](_0x7c54('0x1a'),auth['isAuthenticated'](),controller[_0x7c54('0x1b')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x7c54('0x1c')]);router[_0x7c54('0x5')](_0x7c54('0x1d'),auth['isAuthenticated'](),controller[_0x7c54('0x1e')]);router[_0x7c54('0x5')](_0x7c54('0x1f'),auth[_0x7c54('0x6')](),controller['getAgents']);router['get'](_0x7c54('0x20'),auth[_0x7c54('0x6')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x7c54('0x21')]);router['get'](_0x7c54('0x22'),auth['isAuthenticated'](),controller[_0x7c54('0x23')]);router['get'](_0x7c54('0x24'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x25')]);router[_0x7c54('0x5')](_0x7c54('0x26'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x27')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x7c54('0x5')](_0x7c54('0x28'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x29')]);router[_0x7c54('0x5')]('/:id/scheduled_calls',auth[_0x7c54('0x6')](),controller[_0x7c54('0x2a')]);router[_0x7c54('0x5')](_0x7c54('0x2b'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x2c')]);router[_0x7c54('0x2d')](_0x7c54('0x2e'),auth['isAuthenticated'](),controller[_0x7c54('0x2f')]);router[_0x7c54('0x2d')](_0x7c54('0xc'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x30')]);router[_0x7c54('0x2d')]('/',auth[_0x7c54('0x6')](),controller['create']);router[_0x7c54('0x2d')](_0x7c54('0xe'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4acb3b,_0xaf989e,_0x261287){_0x261287(null,path[_0x7c54('0x32')](config[_0x7c54('0x33')],_0x7c54('0x34')));},'filename':function(_0x5b9916,_0x1400c8,_0x2d70b5){_0x2d70b5(null,util['format'](_0x7c54('0x35'),Date['now'](),_0x1400c8[_0x7c54('0x36')]));}})});router[_0x7c54('0x2d')](_0x7c54('0xb'),upload['single']('file'),controller[_0x7c54('0x37')]);router[_0x7c54('0x2d')]('/:id/login',auth['isAuthenticated'](),controller[_0x7c54('0x38')]);router[_0x7c54('0x2d')]('/:id/logout',auth['isAuthenticated'](),controller[_0x7c54('0x39')]);router[_0x7c54('0x2d')](_0x7c54('0x3a'),auth['isAuthenticated'](),controller[_0x7c54('0x3b')]);router['post'](_0x7c54('0x3c'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x3d')]);router[_0x7c54('0x2d')](_0x7c54('0x3e'),auth[_0x7c54('0x6')](),controller['addTeams']);router[_0x7c54('0x2d')](_0x7c54('0x3f'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x40')]);router[_0x7c54('0x2d')](_0x7c54('0x41'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x42')]);router['post']('/:id/fax_interactions',auth[_0x7c54('0x6')](),controller['addFaxInteractions']);router[_0x7c54('0x2d')](_0x7c54('0x43'),auth['isAuthenticated'](),controller[_0x7c54('0x44')]);router['post']('/:id/openchannel_interactions',auth[_0x7c54('0x6')](),controller['addOpenchannelInteractions']);router[_0x7c54('0x2d')](_0x7c54('0x45'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x46')]);router[_0x7c54('0x2d')](_0x7c54('0x22'),auth['isAuthenticated'](),controller[_0x7c54('0x47')]);router[_0x7c54('0x2d')](_0x7c54('0x24'),auth[_0x7c54('0x6')](),controller['addOpenchannelAccounts']);router['post'](_0x7c54('0x26'),auth[_0x7c54('0x6')](),controller['addSmsAccounts']);router[_0x7c54('0x2d')](_0x7c54('0x48'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x49')]);router[_0x7c54('0x2d')](_0x7c54('0x28'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x4a')]);router['post']('/:id/api_key',auth[_0x7c54('0x6')](),controller[_0x7c54('0x4b')]);router[_0x7c54('0x4c')]('/:id',auth[_0x7c54('0x6')](),controller[_0x7c54('0x4d')]);router['put'](_0x7c54('0x4e'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x4f')]);router[_0x7c54('0x50')](_0x7c54('0xe'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x51')]);router[_0x7c54('0x50')](_0x7c54('0x3e'),auth[_0x7c54('0x6')](),controller['removeTeams']);router['delete'](_0x7c54('0x9'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x52')]);router[_0x7c54('0x50')](_0x7c54('0x3f'),auth[_0x7c54('0x6')](),controller['removeChatInteractions']);router[_0x7c54('0x50')](_0x7c54('0x41'),auth[_0x7c54('0x6')](),controller['removeMailInteractions']);router[_0x7c54('0x50')](_0x7c54('0x53'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x54')]);router[_0x7c54('0x50')]('/:id/sms_interactions',auth[_0x7c54('0x6')](),controller[_0x7c54('0x55')]);router[_0x7c54('0x50')]('/:id/openchannel_interactions',auth[_0x7c54('0x6')](),controller['removeOpenchannelInteractions']);router[_0x7c54('0x50')](_0x7c54('0x45'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x56')]);router[_0x7c54('0x50')](_0x7c54('0x22'),auth[_0x7c54('0x6')](),controller['removeMailAccounts']);router['delete'](_0x7c54('0x24'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x57')]);router[_0x7c54('0x50')](_0x7c54('0x26'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x58')]);router[_0x7c54('0x50')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x7c54('0x59')]);router[_0x7c54('0x50')](_0x7c54('0x28'),auth['isAuthenticated'](),controller[_0x7c54('0x5a')]);router[_0x7c54('0x50')](_0x7c54('0x2b'),auth[_0x7c54('0x6')](),controller[_0x7c54('0x5b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 318a380..17443b8 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 _0xe706=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','get','isArray','wss','avpf','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe706,0xa3));var _0x6e70=function(_0x1b2d57,_0x4fccb7){_0x1b2d57=_0x1b2d57-0x0;var _0x5d46dd=_0xe706[_0x1b2d57];return _0x5d46dd;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var _=require('lodash');module[_0x6e70('0x3')]={'name':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7dfbc3){this[_0x6e70('0x6')](_0x6e70('0x5'),_0x7dfbc3);this[_0x6e70('0x6')](_0x6e70('0x7'),_0x7dfbc3);},'comment':_0x6e70('0x8')},'fullname':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'set':function(_0x36357b){this[_0x6e70('0x6')](_0x6e70('0x9'),_0x36357b);this[_0x6e70('0x6')](_0x6e70('0xa'),util[_0x6e70('0xb')](_0x6e70('0xc'),_0x36357b,this[_0x6e70('0xd')](_0x6e70('0xe'))));}},'alias':{'type':Sequelize[_0x6e70('0x4')]},'email':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0xf'),'validate':{'isEmail':!![]},'set':function(_0x37b3e0){if(_0x37b3e0){this[_0x6e70('0x6')]('email',_0x37b3e0['toLowerCase']());}}},'role':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x11'),_0x6e70('0x12'),_0x6e70('0x13'),_0x6e70('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x48bc72){this[_0x6e70('0x6')]('internal',_0x48bc72);this['setDataValue'](_0x6e70('0x16'),_0x48bc72);this[_0x6e70('0x6')]('callerid',util[_0x6e70('0xb')]('\x22%s\x22\x20<%s>',this[_0x6e70('0xd')](_0x6e70('0x9')),_0x48bc72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6e70('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6e70('0x4')]},'userpic':{'type':Sequelize[_0x6e70('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6e70('0x18')]},'voicePause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6e70('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x6e70('0x1a')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1c'),_0x6e70('0x12'),_0x6e70('0x1d')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1e')},'callingpres':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1f'),_0x6e70('0x20'),_0x6e70('0x21'),_0x6e70('0x22'),_0x6e70('0x23'),_0x6e70('0x24'),_0x6e70('0x25'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x26'),'set':function(_0x56f6f7){this[_0x6e70('0x6')](_0x6e70('0x27'),_0x56f6f7?_0x56f6f7['join'](','):null);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x27'))?this['getDataValue'](_0x6e70('0x27'))[_0x6e70('0x28')](','):null;},'comment':_0x6e70('0x29')},'dtmfmode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2a'),_0x6e70('0x2b'),_0x6e70('0x2c'),_0x6e70('0x2d'),_0x6e70('0x2e')),'allowNull':!![],'defaultValue':_0x6e70('0x2a')},'directmedia':{'type':Sequelize['ENUM'](_0x6e70('0x2f'),'no','nonat',_0x6e70('0x30'),_0x6e70('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x32'),'set':function(_0x80bebb){this[_0x6e70('0x6')](_0x6e70('0x33'),_0x80bebb?_0x80bebb[_0x6e70('0x34')](','):null);},'get':function(){return this[_0x6e70('0xd')]('nat')?this['getDataValue']('nat')[_0x6e70('0x28')](','):null;},'comment':_0x6e70('0x35')},'callgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6e70('0x4')]},'pickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6e70('0x4')]},'disallow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x36')},'allow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x37'),'set':function(_0x37bf46){this[_0x6e70('0x6')](_0x6e70('0x38'),_0x37bf46?_0x37bf46['join'](';'):_0x6e70('0x37'));},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x38'))?this[_0x6e70('0xd')](_0x6e70('0x38'))[_0x6e70('0x28')](';'):null;},'comment':_0x6e70('0x39')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x154e0c){this[_0x6e70('0x6')](_0x6e70('0x3a'),_0x154e0c?_0x154e0c[_0x6e70('0x34')](','):null);},'get':function(){return this[_0x6e70('0xd')]('insecure')?this[_0x6e70('0xd')](_0x6e70('0x3a'))[_0x6e70('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no',_0x6e70('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x3c')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2f')},'busylevel':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6e70('0x10')]('yes','no',_0x6e70('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x6e70('0x3e'),_0x6e70('0x3f'),_0x6e70('0x40')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x41'),_0x6e70('0x42')),'allowNull':!![],'defaultValue':_0x6e70('0x42')},'t38pt_usertpsource':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2f')},'keepalive':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6e70('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x6e70('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no',_0x6e70('0x43'),_0x6e70('0x44')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x45'),_0x6e70('0x46'),_0x6e70('0x47')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6e70('0x1a')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no',_0x6e70('0x48'),_0x6e70('0x30'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6e70('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0,'set':function(_0x692205){this[_0x6e70('0x6')]('showWebBar',_0x692205);var _0x51f268=this[_0x6e70('0x49')]({'plain':!![]});switch(_0x692205){case 0x0:case 0x1:var _0xd6bccd=_0x51f268[_0x6e70('0x27')]?_[_0x6e70('0x4a')](_0x51f268[_0x6e70('0x27')])?_0x51f268[_0x6e70('0x27')][_0x6e70('0x34')]():_0x51f268['transport']:'udp';if(_0xd6bccd===_0x6e70('0x4b')){_0xd6bccd=_0x6e70('0x26');}this[_0x6e70('0x6')](_0x6e70('0x27'),_0xd6bccd);this['setDataValue']('encryption','no');this[_0x6e70('0x6')](_0x6e70('0x4c'),null);this['setDataValue']('force_avp',null);this[_0x6e70('0x6')]('icesupport',null);this[_0x6e70('0x6')](_0x6e70('0x4d'),null);this[_0x6e70('0x6')](_0x6e70('0x4e'),null);this[_0x6e70('0x6')](_0x6e70('0x4f'),null);this[_0x6e70('0x6')](_0x6e70('0x50'),null);this['setDataValue'](_0x6e70('0x51'),null);this[_0x6e70('0x6')](_0x6e70('0x52'),'no');break;case 0x2:this[_0x6e70('0x6')](_0x6e70('0x27'),'wss');this['setDataValue']('encryption',_0x6e70('0x2f'));this[_0x6e70('0x6')](_0x6e70('0x4c'),'yes');this['setDataValue'](_0x6e70('0x53'),_0x6e70('0x2f'));this[_0x6e70('0x6')](_0x6e70('0x54'),_0x6e70('0x2f'));this[_0x6e70('0x6')]('dtlsenable',_0x6e70('0x2f'));this[_0x6e70('0x6')](_0x6e70('0x4e'),'no');this[_0x6e70('0x6')]('dtlssetup',_0x6e70('0x47'));this['setDataValue']('dtlscertfile',_0x51f268[_0x6e70('0x50')]||_0x6e70('0x55'));this[_0x6e70('0x6')](_0x6e70('0x51'),_0x51f268[_0x6e70('0x51')]||_0x6e70('0x56'));this['setDataValue'](_0x6e70('0x52'),_0x6e70('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x6e70('0x57')],'set':function(_0x18e64c){this[_0x6e70('0x6')](_0x6e70('0x58'),_0x18e64c?_0x18e64c[_0x6e70('0x34')](','):[]);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x58'))?_[_0x6e70('0x59')](this['getDataValue'](_0x6e70('0x58'))[_0x6e70('0x28')](','),function(_0x577c3b){return parseInt(_0x577c3b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6e70('0x4')]},'passwordResetAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6e70('0x5a')],'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x5b'))?this[_0x6e70('0xd')](_0x6e70('0x5b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5b5471){if(typeof _0x5b5471===_0x6e70('0x5c')){var _0x48e04b=_0x5b5471==='1'?!![]:_0x5b5471==='0'?![]:_0x5b5471==='true'?!![]:_0x5b5471===_0x6e70('0x5d')?![]:![];this[_0x6e70('0x6')](_0x6e70('0x5e'),_0x48e04b);}else{this['setDataValue']('screenrecording',_0x5b5471);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3e7be7){this['setDataValue'](_0x6e70('0x5f'),_0x3e7be7);if(_0x3e7be7===!![]){this[_0x6e70('0x6')](_0x6e70('0x60'),moment());this[_0x6e70('0x6')](_0x6e70('0x61'),0x0);}else{this[_0x6e70('0x6')](_0x6e70('0x60'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6e70('0x1a')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xbaf0=['wss','encryption','avpf','icesupport','dtlsenable','rtcp_mux','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','showWebBar','get'];(function(_0x42f0f7,_0x15cd68){var _0x56daf4=function(_0x16c42f){while(--_0x16c42f){_0x42f0f7['push'](_0x42f0f7['shift']());}};_0x56daf4(++_0x15cd68);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var _=require(_0x0baf('0x2'));module[_0x0baf('0x3')]={'name':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'unique':_0x0baf('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5a3e42){this[_0x0baf('0x6')](_0x0baf('0x5'),_0x5a3e42);this[_0x0baf('0x6')](_0x0baf('0x7'),_0x5a3e42);},'comment':_0x0baf('0x8')},'fullname':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'set':function(_0x1a10b1){this[_0x0baf('0x6')](_0x0baf('0x9'),_0x1a10b1);this['setDataValue'](_0x0baf('0xa'),util['format'](_0x0baf('0xb'),_0x1a10b1,this[_0x0baf('0xc')](_0x0baf('0xd'))));}},'alias':{'type':Sequelize[_0x0baf('0x4')]},'email':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'unique':_0x0baf('0xe'),'validate':{'isEmail':!![]},'set':function(_0x41cead){if(_0x41cead){this[_0x0baf('0x6')](_0x0baf('0xe'),_0x41cead[_0x0baf('0xf')]());}}},'role':{'type':Sequelize[_0x0baf('0x10')]('admin','user',_0x0baf('0x11'),_0x0baf('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1c76a8){this[_0x0baf('0x6')](_0x0baf('0xd'),_0x1c76a8);this[_0x0baf('0x6')](_0x0baf('0x14'),_0x1c76a8);this[_0x0baf('0x6')]('callerid',util['format'](_0x0baf('0xb'),this[_0x0baf('0xc')](_0x0baf('0x9')),_0x1c76a8));}},'salt':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize[_0x0baf('0x4')]},'mobile':{'type':Sequelize[_0x0baf('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x0baf('0x4')]},'userpic':{'type':Sequelize[_0x0baf('0x4')]},'city':{'type':Sequelize[_0x0baf('0x4')]},'country':{'type':Sequelize[_0x0baf('0x4')]},'online':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0baf('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':_0x0baf('0x17')},'lastPauseAt':{'type':Sequelize[_0x0baf('0x16')]},'chatCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x0baf('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0baf('0x10')]('friend',_0x0baf('0x19'),_0x0baf('0x1a')),'allowNull':!![],'defaultValue':_0x0baf('0x1b')},'context':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x1c'),'ALLOWED_PASSED_SCREEN',_0x0baf('0x1d'),_0x0baf('0x1e'),_0x0baf('0x1f'),_0x0baf('0x20'),_0x0baf('0x21'),_0x0baf('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x23'),'set':function(_0x275ea1){this[_0x0baf('0x6')](_0x0baf('0x24'),_0x275ea1?_0x275ea1[_0x0baf('0x25')](','):null);},'get':function(){return this[_0x0baf('0xc')](_0x0baf('0x24'))?this[_0x0baf('0xc')](_0x0baf('0x24'))[_0x0baf('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0baf('0x10')]('rfc2833',_0x0baf('0x27'),_0x0baf('0x28'),_0x0baf('0x29'),_0x0baf('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no','nonat',_0x0baf('0x2c'),_0x0baf('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x2e'),'set':function(_0x4aa6ed){this[_0x0baf('0x6')](_0x0baf('0x2f'),_0x4aa6ed?_0x4aa6ed['join'](','):null);},'get':function(){return this[_0x0baf('0xc')]('nat')?this['getDataValue'](_0x0baf('0x2f'))[_0x0baf('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x0baf('0x4')]},'pickupgroup':{'type':Sequelize[_0x0baf('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x0baf('0x4')]},'language':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0baf('0x4')]},'disallow':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'defaultValue':_0x0baf('0x30')},'allow':{'type':Sequelize[_0x0baf('0x4')],'allowNull':![],'defaultValue':_0x0baf('0x31'),'set':function(_0x36c6d2){this[_0x0baf('0x6')](_0x0baf('0x32'),_0x36c6d2?_0x36c6d2[_0x0baf('0x25')](';'):_0x0baf('0x31'));},'get':function(){return this['getDataValue'](_0x0baf('0x32'))?this[_0x0baf('0xc')]('allow')[_0x0baf('0x26')](';'):null;},'comment':_0x0baf('0x33')},'autoframing':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'set':function(_0x456d0b){this['setDataValue'](_0x0baf('0x34'),_0x456d0b?_0x456d0b[_0x0baf('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x0baf('0x34'))?this[_0x0baf('0xc')](_0x0baf('0x34'))[_0x0baf('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no',_0x0baf('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![],'defaultValue':_0x0baf('0x36')},'amaflags':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x0baf('0x2b')},'busylevel':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no',_0x0baf('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x3b'),_0x0baf('0x3c')),'allowNull':!![],'defaultValue':_0x0baf('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x0baf('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0baf('0x10')]('yes','no',_0x0baf('0x3d'),_0x0baf('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x3f'),_0x0baf('0x40'),_0x0baf('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x0baf('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x0baf('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0baf('0x10')](_0x0baf('0x2b'),'no',_0x0baf('0x42'),_0x0baf('0x2c'),_0x0baf('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0baf('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0,'set':function(_0x27f580){this[_0x0baf('0x6')](_0x0baf('0x44'),_0x27f580);var _0x1c7d88=this[_0x0baf('0x45')]({'plain':!![]});switch(_0x27f580){case 0x0:case 0x1:var _0x14e6d0=_0x1c7d88[_0x0baf('0x24')]?_['isArray'](_0x1c7d88[_0x0baf('0x24')])?_0x1c7d88['transport'][_0x0baf('0x25')]():_0x1c7d88['transport']:'udp';if(_0x14e6d0===_0x0baf('0x46')){_0x14e6d0='udp';}this[_0x0baf('0x6')](_0x0baf('0x24'),_0x14e6d0);this['setDataValue'](_0x0baf('0x47'),'no');this[_0x0baf('0x6')](_0x0baf('0x48'),null);this['setDataValue']('force_avp',null);this[_0x0baf('0x6')](_0x0baf('0x49'),null);this[_0x0baf('0x6')](_0x0baf('0x4a'),null);this[_0x0baf('0x6')]('dtlsverify',null);this[_0x0baf('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x0baf('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x0baf('0x4b'),'no');break;case 0x2:this[_0x0baf('0x6')](_0x0baf('0x24'),_0x0baf('0x46'));this[_0x0baf('0x6')](_0x0baf('0x47'),'yes');this[_0x0baf('0x6')](_0x0baf('0x48'),_0x0baf('0x2b'));this[_0x0baf('0x6')](_0x0baf('0x4c'),_0x0baf('0x2b'));this['setDataValue'](_0x0baf('0x49'),_0x0baf('0x2b'));this[_0x0baf('0x6')]('dtlsenable',_0x0baf('0x2b'));this[_0x0baf('0x6')](_0x0baf('0x4d'),'no');this[_0x0baf('0x6')](_0x0baf('0x4e'),_0x0baf('0x41'));this[_0x0baf('0x6')]('dtlscertfile',_0x1c7d88['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x0baf('0x6')](_0x0baf('0x4f'),_0x1c7d88[_0x0baf('0x4f')]||_0x0baf('0x50'));this[_0x0baf('0x6')](_0x0baf('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x34c1f4){this['setDataValue'](_0x0baf('0x51'),_0x34c1f4?_0x34c1f4[_0x0baf('0x25')](','):[]);},'get':function(){return this['getDataValue'](_0x0baf('0x51'))?_[_0x0baf('0x52')](this[_0x0baf('0xc')](_0x0baf('0x51'))[_0x0baf('0x26')](','),function(_0x33a5af){return parseInt(_0x33a5af,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0baf('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0baf('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0baf('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x0baf('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0baf('0x53')],'get':function(){return this[_0x0baf('0xc')](_0x0baf('0x54'))?this[_0x0baf('0xc')](_0x0baf('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0baf('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x97d385){if(typeof _0x97d385===_0x0baf('0x55')){var _0x421ca0=_0x97d385==='1'?!![]:_0x97d385==='0'?![]:_0x97d385===_0x0baf('0x56')?!![]:_0x97d385===_0x0baf('0x57')?![]:![];this['setDataValue']('screenrecording',_0x421ca0);}else{this[_0x0baf('0x6')](_0x0baf('0x58'),_0x97d385);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x28bc1c){this[_0x0baf('0x6')](_0x0baf('0x59'),_0x28bc1c);if(_0x28bc1c===!![]){this['setDataValue'](_0x0baf('0x5a'),moment());this[_0x0baf('0x6')](_0x0baf('0x5b'),0x0);}else{this['setDataValue'](_0x0baf('0x5a'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0baf('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0baf('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 513acc1..830fea1 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 _0xcf5e=['isValidChannel','add','capitalize','toLowerCase','penalty','QueueId','emit','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','Queue:remove','userpic','file','filename','getAvatar','root','download','join','server/files/images/','getContacts','CmContact','filter','CmList','Tag','Tags','color','tag','getQueues','rawAttributes','Queue','Queues','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','login','phone','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','socket','remoteAddress','connection','getVoiceQueues','push','UserVoiceQueue.penalty','each','MemberReport','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','QueuePause','pause','DEFAULT\x20PAUSE','faxPause','openchannelPause','lastPauseAt','unpause','manual','mail','fax','openchannel','%s%s','getTeams','Team','addTeams','removeTeams','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','json','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','apiKeyNonce','apiKeyIat','removeApiKey','API\x20key\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Users','user','agent','Telephones','ignore','map','value','includes','role','UserProfileResource','end','stack','name','send','model','differenceBy','keys','password','salt','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','type','sequelize','lower','col','field','User','includeAll','include','findAll','rows','show','options','find','bulkCreate','body','update','describe','addContacts','params','ids','omit','agent\x20role','telephone','../../config/license/util','getLicense','users','isNil','count\x20%s:\x20%s','create','internal','Setting','securePassword','min_internal','QueryTypes','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','104','105','106','107','108','109','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','oldPassword','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20one','Sequelize','ValidationError','authenticate','Wrong\x20credentials','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','addQueues','channel','loginInPause','voicePause'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xcf5e,0xaf));var _0xecf5=function(_0x1dbdbc,_0x1f5625){_0x1dbdbc=_0x1dbdbc-0x0;var _0x440c1c=_0xcf5e[_0x1dbdbc];return _0x440c1c;};'use strict';var pdf=require(_0xecf5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xecf5('0x1'));var zipdir=require(_0xecf5('0x2'));var jsonpatch=require(_0xecf5('0x3'));var rp=require(_0xecf5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecf5('0x5'));var util=require(_0xecf5('0x6'));var path=require(_0xecf5('0x7'));var sox=require(_0xecf5('0x8'));var csv=require(_0xecf5('0x9'));var ejs=require(_0xecf5('0xa'));var fs=require('fs');var _=require(_0xecf5('0xb'));var squel=require(_0xecf5('0xc'));var crypto=require(_0xecf5('0xd'));var jsforce=require(_0xecf5('0xe'));var deskjs=require(_0xecf5('0xf'));var toCsv=require(_0xecf5('0x9'));var querystring=require(_0xecf5('0x10'));var Papa=require(_0xecf5('0x11'));var Redis=require(_0xecf5('0x12'));var authService=require(_0xecf5('0x13'));var qs=require(_0xecf5('0x14'));var hardwareService=require(_0xecf5('0x15'));var logger=require(_0xecf5('0x16'))('api');var utils=require(_0xecf5('0x17'));var config=require(_0xecf5('0x18'));var db=require(_0xecf5('0x19'))['db'];config[_0xecf5('0x1a')]=_['defaults'](config['redis'],{'host':_0xecf5('0x1b'),'port':0x18eb});var socket=require(_0xecf5('0x1c'))(new Redis(config[_0xecf5('0x1a')]));require('./user.socket')[_0xecf5('0x1d')](socket);var jayson=require(_0xecf5('0x1e'));var client=jayson[_0xecf5('0x1f')][_0xecf5('0x20')]({'port':0x232a});function checkPasswordPattern(_0x20aa09,_0x226989,_0x40375a){if(_0x40375a){var _0x39e49b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39e49b[_0xecf5('0x21')](_0x226989)){return _0x20aa09;}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 _0x20aa09;}}function respondWithRpcPromise(_0x2f844a,_0xbc3d14,_0x587328,_0x2cee87){return new BPromise(function(_0x340341,_0x4d43f6){var _0x31178e=_0x2cee87||client;return _0x31178e[_0xecf5('0x22')](_0x2f844a,_0x587328)[_0xecf5('0x23')](function(_0x4fdfaf){logger[_0xecf5('0x24')](_0xecf5('0x25'),_0xbc3d14,_0xecf5('0x26'));logger[_0xecf5('0x27')](_0xecf5('0x28'),_0xbc3d14,_0xecf5('0x26'),JSON[_0xecf5('0x29')](_0x4fdfaf));if(_0x4fdfaf[_0xecf5('0x2a')]){if(_0x4fdfaf[_0xecf5('0x2a')]['code']===0x1f4){logger[_0xecf5('0x2a')](_0xecf5('0x25'),_0xbc3d14,_0x4fdfaf[_0xecf5('0x2a')][_0xecf5('0x2b')]);return _0x4d43f6(_0x4fdfaf[_0xecf5('0x2a')][_0xecf5('0x2b')]);}logger['error'](_0xecf5('0x25'),_0xbc3d14,_0x4fdfaf[_0xecf5('0x2a')][_0xecf5('0x2b')]);return _0x340341(_0x4fdfaf[_0xecf5('0x2a')]['message']);}else{logger[_0xecf5('0x24')](_0xecf5('0x25'),_0xbc3d14,_0xecf5('0x26'));_0x340341(_0x4fdfaf['result'][_0xecf5('0x2b')]);}})[_0xecf5('0x2c')](function(_0x583a16){logger[_0xecf5('0x2a')](_0xecf5('0x25'),_0xbc3d14,_0x583a16);_0x4d43f6(_0x583a16);});});}function respondWithStatusCode(_0x3aaa40,_0x2cd421){_0x2cd421=_0x2cd421||0xcc;return function(_0x5d12b9){if(_0x5d12b9){return _0x3aaa40[_0xecf5('0x2d')](_0x2cd421);}return _0x3aaa40[_0xecf5('0x2e')](_0x2cd421)['end']();};}function respondWithResult(_0x24c633,_0x4d447c){_0x4d447c=_0x4d447c||0xc8;return function(_0x5295ca){if(_0x5295ca){return _0x24c633['status'](_0x4d447c)['json'](_0x5295ca);}};}function respondWithFilteredResult(_0x7244fb,_0x1115c8){return function(_0x2d460b){if(_0x2d460b){var _0x1acc0d=_0x2d460b[_0xecf5('0x2f')],_0x151113=_0x1115c8['offset'],_0x1e3ce2=_0x1115c8[_0xecf5('0x30')]+_0x1115c8[_0xecf5('0x31')],_0x58ce28;if(_0x1e3ce2>=_0x1acc0d){_0x1e3ce2=_0x1acc0d;_0x58ce28=0xc8;}else{_0x58ce28=0xce;}_0x7244fb[_0xecf5('0x2e')](_0x58ce28);return _0x7244fb[_0xecf5('0x32')](_0xecf5('0x33'),_0x151113+'-'+_0x1e3ce2+'/'+_0x1acc0d)['json'](_0x2d460b);}return null;};}function patchUpdates(_0x1b016f){return function(_0x59d053){try{jsonpatch[_0xecf5('0x34')](_0x59d053,_0x1b016f,!![]);}catch(_0x7f6815){return BPromise[_0xecf5('0x35')](_0x7f6815);}return _0x59d053[_0xecf5('0x36')]();};}function saveUpdates(_0x30e6a7,_0xc41874){return function(_0x829cf2){if(_0x829cf2){return _0x829cf2['update'](_0x30e6a7)['then'](function(_0x529522){return _0x529522;});}return null;};}function removeEntity(_0x1f74e7,_0x34642c){return function(_0x3a9acb){if(_0x3a9acb){return _0x3a9acb[_0xecf5('0x37')]()[_0xecf5('0x23')](function(){var _0x50905a=_0x3a9acb[_0xecf5('0x38')]({'plain':!![]});var _0x35bdc1=[{'name':_0xecf5('0x39'),'value':_0xecf5('0x3a'),'ignore':!![]},{'name':'Agents','value':_0xecf5('0x3b'),'ignore':![]},{'name':_0xecf5('0x3c'),'value':'telephone','ignore':![]}];var _0x2e358c=_(_0x35bdc1)['filter'](_0xecf5('0x3d'))[_0xecf5('0x3e')]('value')[_0xecf5('0x3f')]();if(_[_0xecf5('0x40')](_0x2e358c,_0x50905a['role'])){return;}var _0xc91b6=_['find'](_0x35bdc1,['value',_0x50905a[_0xecf5('0x41')]])['name'];return db[_0xecf5('0x42')][_0xecf5('0x37')]({'where':{'type':_0xc91b6,'resourceId':_0x50905a['id']}})[_0xecf5('0x23')](function(){return _0x3a9acb;});})['then'](function(){_0x1f74e7[_0xecf5('0x2e')](0xcc)[_0xecf5('0x43')]();});}};}function handleEntityNotFound(_0x2f21d2,_0x4c28ce){return function(_0x4d0b4a){if(!_0x4d0b4a){_0x2f21d2[_0xecf5('0x2d')](0x194);}return _0x4d0b4a;};}function handleError(_0x595959,_0x5b88f9){_0x5b88f9=_0x5b88f9||0x1f4;return function(_0x4dde52){logger[_0xecf5('0x2a')](_0x4dde52[_0xecf5('0x44')]);if(_0x4dde52[_0xecf5('0x45')]){delete _0x4dde52[_0xecf5('0x45')];}_0x595959[_0xecf5('0x2e')](_0x5b88f9)[_0xecf5('0x46')](_0x4dde52);};}exports['index']=function(_0x544971,_0x38115a){var _0x3135bb={},_0x1e176f={},_0x1d0485={'count':0x0,'rows':[]};var _0x3f5fd2=db['User']['rawAttributes'];_0x1e176f[_0xecf5('0x47')]=_[_0xecf5('0x48')](_[_0xecf5('0x49')](_0x3f5fd2),[_0xecf5('0x4a'),_0xecf5('0x4b')]);_0x1e176f[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x544971[_0xecf5('0x4c')]);_0x1e176f['filters']=_[_0xecf5('0x4d')](_0x1e176f[_0xecf5('0x47')],_0x1e176f[_0xecf5('0x4c')]);_0x3135bb[_0xecf5('0x4e')]=_['intersection'](_0x1e176f[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x544971['query'][_0xecf5('0x4f')]));_0x3135bb[_0xecf5('0x4e')]=_0x3135bb['attributes'][_0xecf5('0x50')]?_0x3135bb[_0xecf5('0x4e')]:_0x1e176f[_0xecf5('0x47')];if(!_0x544971[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x3135bb[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x544971[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x3135bb['offset']=qs['offset'](_0x544971[_0xecf5('0x4c')][_0xecf5('0x30')]);}_0x3135bb[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x544971[_0xecf5('0x4c')][_0xecf5('0x54')]);_0x3135bb['where']=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x544971[_0xecf5('0x4c')],_0x1e176f['filters']));if(_0x544971[_0xecf5('0x4c')]['filter']){_0x3135bb['where']=_[_0xecf5('0x57')](_0x3135bb[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x3f5fd2,function(_0x44c5c3){if(_0x44c5c3[_0xecf5('0x59')]['key']!=='VIRTUAL'){return db['sequelize'][_0xecf5('0x58')](db[_0xecf5('0x5a')]['fn'](_0xecf5('0x5b'),db['sequelize'][_0xecf5('0x5c')](_0x44c5c3[_0xecf5('0x5d')])),{'$like':db[_0xecf5('0x5a')]['fn'](_0xecf5('0x5b'),'%'+_0x544971[_0xecf5('0x4c')]['filter']+'%')});}})});}_0x3135bb=_[_0xecf5('0x57')]({},_0x3135bb,_0x544971['options']);var _0x3d7073={'where':_0x3135bb[_0xecf5('0x58')]};return db[_0xecf5('0x5e')]['count'](_0x3d7073)['then'](function(_0x2c371b){_0x1d0485['count']=_0x2c371b;if(_0x544971[_0xecf5('0x4c')][_0xecf5('0x5f')]){_0x3135bb[_0xecf5('0x60')]=[{'all':!![]}];}return db[_0xecf5('0x5e')][_0xecf5('0x61')](_0x3135bb);})['then'](function(_0x3f7d3f){_0x1d0485[_0xecf5('0x62')]=_0x3f7d3f;return _0x1d0485;})[_0xecf5('0x23')](respondWithFilteredResult(_0x38115a,_0x3135bb))['catch'](handleError(_0x38115a,null));};exports[_0xecf5('0x63')]=function(_0x37ae37,_0x232378){var _0x1a26af={'raw':![],'where':{'id':_0x37ae37['params']['id']}},_0x486412={};_0x486412['model']=_['differenceBy'](_['keys'](db['User']['rawAttributes']),[_0xecf5('0x4a'),_0xecf5('0x4b')]);_0x486412[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x37ae37['query']);_0x486412[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x486412[_0xecf5('0x47')],_0x486412[_0xecf5('0x4c')]);_0x1a26af['attributes']=_[_0xecf5('0x4d')](_0x486412['model'],qs[_0xecf5('0x4f')](_0x37ae37[_0xecf5('0x4c')]['fields']));_0x1a26af['attributes']=_0x1a26af[_0xecf5('0x4e')]['length']?_0x1a26af[_0xecf5('0x4e')]:_0x486412['model'];if(_0x37ae37[_0xecf5('0x4c')]['includeAll']){_0x1a26af[_0xecf5('0x60')]=[{'all':!![]}];}_0x1a26af=_['merge']({},_0x1a26af,_0x37ae37[_0xecf5('0x64')]);return db[_0xecf5('0x5e')][_0xecf5('0x65')](_0x1a26af)[_0xecf5('0x23')](handleEntityNotFound(_0x232378,null))[_0xecf5('0x23')](respondWithResult(_0x232378,null))[_0xecf5('0x2c')](handleError(_0x232378,null));};exports[_0xecf5('0x66')]=function(_0x4afb36,_0x5d811a){return db[_0xecf5('0x5e')][_0xecf5('0x66')](_0x4afb36[_0xecf5('0x67')],{'raw':![],'individualHooks':!![]})[_0xecf5('0x23')](respondWithResult(_0x5d811a,0xc9))['catch'](handleError(_0x5d811a,null));};exports[_0xecf5('0x68')]=function(_0x447593,_0x41f98c){if(_0x447593[_0xecf5('0x67')]['id']){delete _0x447593[_0xecf5('0x67')]['id'];}delete _0x447593[_0xecf5('0x67')][_0xecf5('0x41')];return db[_0xecf5('0x5e')]['find']({'where':{'id':_0x447593['params']['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x41f98c,null))[_0xecf5('0x23')](saveUpdates(_0x447593[_0xecf5('0x67')],null))['then'](respondWithResult(_0x41f98c,null))[_0xecf5('0x2c')](handleError(_0x41f98c,null));};exports['describe']=function(_0x1f797d,_0x5a0fff){return db[_0xecf5('0x5e')][_0xecf5('0x69')]()[_0xecf5('0x23')](respondWithResult(_0x5a0fff,null))['catch'](handleError(_0x5a0fff,null));};exports[_0xecf5('0x6a')]=function(_0xeda14a,_0x773f6c,_0x411a7b){return db[_0xecf5('0x5e')][_0xecf5('0x65')]({'where':{'id':_0xeda14a[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x773f6c,null))[_0xecf5('0x23')](function(_0x142e27){if(_0x142e27){return _0x142e27[_0xecf5('0x6a')](_0xeda14a[_0xecf5('0x67')][_0xecf5('0x6c')],_[_0xecf5('0x6d')](_0xeda14a[_0xecf5('0x67')],[_0xecf5('0x6c'),'id'])||{});}})[_0xecf5('0x23')](respondWithResult(_0x773f6c,null))['catch'](handleError(_0x773f6c,null));};var getLicense=function(_0x30dc54){return new BPromise(function(_0x389f7e,_0x1f8837){var _0x1aae68=0x0;_0x30dc54[_0xecf5('0x67')][_0xecf5('0x41')]===_0xecf5('0x3b')&&_0x389f7e(_0xecf5('0x6e'));return db[_0xecf5('0x5e')]['count']({'where':{'$or':[{'role':_0x30dc54[_0xecf5('0x67')]['role']==='telephone'?_0xecf5('0x6f'):['admin',_0xecf5('0x3a')]}]}})[_0xecf5('0x23')](function(_0x13cdbd){_0x1aae68=_0x13cdbd;return require(_0xecf5('0x70'))[_0xecf5('0x71')]();})[_0xecf5('0x23')](function(_0x408324){var _0x2e253f=_0x30dc54[_0xecf5('0x67')][_0xecf5('0x41')]===_0xecf5('0x6f')?'telephones':_0xecf5('0x72');if(!_[_0xecf5('0x73')](_0x408324[_0x2e253f])&&_0x1aae68>=_0x408324[_0x2e253f]){return _0x1f8837({'message':'License\x20limit\x20reached'});}return _0x389f7e(util['format'](_0xecf5('0x74'),_0x2e253f,_0x1aae68));})[_0xecf5('0x2c')](function(_0x6f8a72){return _0x1f8837(_0x6f8a72);});});};exports[_0xecf5('0x75')]=function(_0x32ba44,_0xd59b4a){return getLicense(_0x32ba44)['then'](function(_0x139ac1){if(!_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')]){var _0x3a31d;return db[_0xecf5('0x77')]['findById'](0x1)[_0xecf5('0x23')](function(_0x2bd6d7){_0x2bd6d7[_0xecf5('0x78')]=!![];return checkPasswordPattern(_0x2bd6d7,_0x32ba44[_0xecf5('0x67')]['password'],_0x2bd6d7[_0xecf5('0x78')]);})[_0xecf5('0x23')](function(_0x28802b){_0x3a31d=_0x28802b[_0xecf5('0x79')];return db[_0xecf5('0x5e')]['max']('internal');})[_0xecf5('0x23')](function(_0x5488b7){if(_[_0xecf5('0x73')](_0x5488b7)){if(_0x3a31d){_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')]=_0x3a31d;}else{_0x32ba44['body']['internal']=0x1;}}else{if(_[_0xecf5('0x73')](_0x3a31d)||_0x3a31d==_0x5488b7){_0x32ba44['body'][_0xecf5('0x76')]=_0x5488b7+0x1;}else if(_0x3a31d>_0x5488b7){_0x32ba44['body'][_0xecf5('0x76')]=_0x3a31d;}else{return db[_0xecf5('0x5a')][_0xecf5('0x4c')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xecf5('0x5a')][_0xecf5('0x7a')]['SELECT']})[_0xecf5('0x23')](function(_0x138fe0){if(_0x138fe0&&_0x138fe0['length']){for(var _0x3a84ec=0x0,_0xe4dc0a=_0x138fe0[_0xecf5('0x50')];_0x3a84ec<_0xe4dc0a&&_[_0xecf5('0x73')](_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')]);_0x3a84ec++){if(_0x3a31d<=_0x138fe0[_0x3a84ec][_0xecf5('0x7b')]){_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')]=_0x138fe0[_0x3a84ec][_0xecf5('0x7b')];}else if(_0x3a31d>_0x138fe0[_0x3a84ec][_0xecf5('0x7b')]&&_0x3a31d<=_0x138fe0[_0x3a84ec]['to']){_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')]=_0x3a31d;}}}if(_[_0xecf5('0x73')](_0x32ba44['body']['internal'])){_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')]=_0x5488b7+0x1;}});}}});}})[_0xecf5('0x23')](function(){if(_0x32ba44[_0xecf5('0x67')][_0xecf5('0x7c')]){_0x32ba44[_0xecf5('0x67')][_0xecf5('0x7d')]=_0x32ba44['body'][_0xecf5('0x76')];_0x32ba44[_0xecf5('0x67')][_0xecf5('0x7e')]={'mailbox':_0x32ba44[_0xecf5('0x67')][_0xecf5('0x76')],'password':_0x32ba44[_0xecf5('0x67')][_0xecf5('0x4a')],'fullname':_0x32ba44['body']['fullname'],'email':_0x32ba44[_0xecf5('0x67')][_0xecf5('0x7f')]};}if(_0x32ba44[_0xecf5('0x67')]&&_0x32ba44['body'][_0xecf5('0x41')]===_0xecf5('0x3b')){_0x32ba44[_0xecf5('0x67')][_0xecf5('0x80')]=[_0xecf5('0x81'),_0xecf5('0x82'),_0xecf5('0x83'),'110',_0xecf5('0x84'),_0xecf5('0x85'),_0xecf5('0x86'),_0xecf5('0x87'),_0xecf5('0x88'),_0xecf5('0x89'),_0xecf5('0x8a'),_0xecf5('0x8b')];}return db[_0xecf5('0x5e')][_0xecf5('0x75')](_0x32ba44[_0xecf5('0x67')],{'include':[{'model':db[_0xecf5('0x7e')],'as':'VoiceMail'}]});})[_0xecf5('0x23')](function(_0x72a6c8){if(_0x32ba44[_0xecf5('0x67')][_0xecf5('0x41')]===_0xecf5('0x3a'))return _0x72a6c8;var _0x3b882b=_0x32ba44['user'][_0xecf5('0x38')]({'plain':!![]});if(!_0x3b882b)throw new Error(_0xecf5('0x8c'));if(_0x3b882b[_0xecf5('0x41')]==='user'){var _0x26ab8d=_0x72a6c8[_0xecf5('0x38')]({'plain':!![]});var _0x3c9976=[{'name':_0xecf5('0x8d'),'value':_0xecf5('0x3b')},{'name':_0xecf5('0x3c'),'value':_0xecf5('0x6f')}];var _0x144090=_[_0xecf5('0x65')](_0x3c9976,[_0xecf5('0x3f'),_0x26ab8d[_0xecf5('0x41')]])[_0xecf5('0x45')];return db[_0xecf5('0x8e')][_0xecf5('0x65')]({'where':{'name':_0x144090,'userProfileId':_0x3b882b['userProfileId']},'raw':!![]})[_0xecf5('0x23')](function(_0x45755d){if(_0x45755d&&_0x45755d[_0xecf5('0x8f')]===0x0){return db[_0xecf5('0x42')]['create']({'name':_0x26ab8d[_0xecf5('0x45')],'resourceId':_0x26ab8d['id'],'type':_0x45755d[_0xecf5('0x45')],'sectionId':_0x45755d['id']},{})[_0xecf5('0x23')](function(){return _0x72a6c8;});}else{return _0x72a6c8;}})[_0xecf5('0x2c')](function(_0x48b489){logger[_0xecf5('0x2a')](_0xecf5('0x90'),_0x48b489);throw _0x48b489;});}return _0x72a6c8;})['then'](respondWithResult(_0xd59b4a,0xc9))[_0xecf5('0x2c')](handleError(_0xd59b4a,null));};exports[_0xecf5('0x91')]=function(_0x5d5962,_0x44b1df,_0x488412){var _0x5e0348=![];if(_0x5d5962[_0xecf5('0x67')]['id']){delete _0x5d5962[_0xecf5('0x67')]['id'];}if(!_['isNil'](_0x5d5962[_0xecf5('0x67')][_0xecf5('0x92')])){if(_0x5d5962[_0xecf5('0x67')][_0xecf5('0x92')]===_0x5d5962['body'][_0xecf5('0x93')]){throw new Error(_0xecf5('0x94'));}}return db['User'][_0xecf5('0x65')]({'where':{'id':_0x5d5962['params']['id']}})[_0xecf5('0x23')](function(_0x411aaf){if(_0x411aaf){if(_0x411aaf['id']==_0x5d5962[_0xecf5('0x3a')]['id']){if(!_0x5d5962[_0xecf5('0x67')]['oldPassword']||!_0x5d5962['body'][_0xecf5('0x93')]){throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x411aaf[_0xecf5('0x97')](_0x5d5962[_0xecf5('0x67')]['oldPassword'])){throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))](_0xecf5('0x98'));}if(_0x5d5962[_0xecf5('0x67')][_0xecf5('0x92')]==_0x5d5962[_0xecf5('0x67')][_0xecf5('0x93')]){throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x411aaf;}else if(_0x5d5962['user'][_0xecf5('0x41')]==_0xecf5('0x99')){if(!_0x5d5962[_0xecf5('0x67')][_0xecf5('0x93')]){throw new db[(_0xecf5('0x95'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x411aaf;}else if(_0x5d5962['user']['role']==_0xecf5('0x3a')){if(!_0x5d5962[_0xecf5('0x67')][_0xecf5('0x93')]){throw new db['Sequelize'][(_0xecf5('0x96'))](_0xecf5('0x9a'));}if(_0x411aaf[_0xecf5('0x41')]!='agent'){throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))](_0xecf5('0x9b'));}return _0x411aaf;}else{throw new db['Sequelize'][(_0xecf5('0x96'))](_0xecf5('0x9b'));}}return null;})[_0xecf5('0x23')](handleEntityNotFound(_0x44b1df,null))[_0xecf5('0x23')](function(_0x541202){return db[_0xecf5('0x77')][_0xecf5('0x9c')]({'attributes':['id',_0xecf5('0x78')]})[_0xecf5('0x23')](function(_0x595132){_0x5e0348=_0x595132['securePassword'];return checkPasswordPattern(_0x541202,_0x5d5962[_0xecf5('0x67')][_0xecf5('0x93')],_0x5e0348);});})[_0xecf5('0x23')](saveUpdates({'password':_0x5d5962[_0xecf5('0x67')][_0xecf5('0x93')],'passwordResetAt':_0x5d5962[_0xecf5('0x3a')]['id']==_0x5d5962[_0xecf5('0x6b')]['id']?moment():null},null))[_0xecf5('0x23')](respondWithResult(_0x44b1df,null))[_0xecf5('0x2c')](handleError(_0x44b1df,null));};exports[_0xecf5('0x9d')]=function(_0x77dca,_0x5180fa,_0x1575bf){var _0x24510d=_0x77dca[_0xecf5('0x67')][_0xecf5('0x9e')];return db['User']['find']({'where':{'id':_0x77dca['params']['id']},'attributes':['id','name',_0xecf5('0x41'),'online',_0xecf5('0x9f'),_0xecf5('0xa0'),'interface']})[_0xecf5('0x23')](handleEntityNotFound(_0x5180fa,null))[_0xecf5('0x23')](function(_0x398955){if(_0x398955){if(!utils[_0xecf5('0xa1')](_0x24510d)){throw new db[(_0xecf5('0x95'))]['ValidationError']('Unknown\x20channel');}return _0x398955[_0xecf5('0xa2')+_[_0xecf5('0xa3')](_0x24510d[_0xecf5('0xa4')]())+'Queues'](_0x77dca[_0xecf5('0x67')]['ids'],{'penalty':_0x77dca['body'][_0xecf5('0xa5')]||0x0})['spread'](function(_0x5f2be7){for(var _0xebe23b=0x0;_0xebe23b<_0x77dca[_0xecf5('0x67')][_0xecf5('0x6c')][_0xecf5('0x50')];_0xebe23b+=0x1){var _0x1c4583={'UserId':_0x77dca['params']['id']};_0x1c4583[_[_0xecf5('0xa3')](_0x24510d[_0xecf5('0xa4')]())+_0xecf5('0xa6')]=_0x77dca['body']['ids'][_0xebe23b];socket[_0xecf5('0xa7')]('user'+_['capitalize'](_0x24510d['toLowerCase']())+_0xecf5('0xa8'),_0x1c4583);}return _0x5f2be7;})[_0xecf5('0x23')](function(){if(_0x24510d===_0xecf5('0xa9')){return db[_0xecf5('0xaa')]['findAll']({'where':{'id':_0x77dca[_0xecf5('0x67')][_0xecf5('0x6c')]||[]},'raw':!![],'attributes':['id',_0xecf5('0x45')]});}})['then'](function(_0x415584){var _0x2cf515=_0x398955['get']({'plain':!![]});var _0x2f05f5=[];if(_0x24510d===_0xecf5('0xa9')&&_0x2cf515[_0xecf5('0x41')]===_0xecf5('0x3b')&&_0x2cf515['online']){for(var _0x4ff116=0x0;_0x4ff116<_0x415584[_0xecf5('0x50')];_0x4ff116+=0x1){_0x2f05f5['push']({'membername':_0x2cf515[_0xecf5('0x45')],'UserId':_0x2cf515['id'],'queue_name':_0x415584[_0x4ff116]['name'],'VoiceQueueId':_0x415584[_0x4ff116]['id'],'interface':_[_0xecf5('0x73')](_0x2cf515[_0xecf5('0xab')])?util[_0xecf5('0xac')](_0xecf5('0xad'),_0x2cf515['name']):_0x2cf515[_0xecf5('0xab')],'paused':_0x2cf515[_0xecf5('0xa0')]||![],'penalty':_0x77dca[_0xecf5('0x67')]['penalty']||0x0});}return BPromise['each'](_0x2f05f5,function(_0xad2abf){return db[_0xecf5('0xae')][_0xecf5('0xaf')](_0xad2abf);});}return _0x398955;});}})[_0xecf5('0x23')](respondWithStatusCode(_0x5180fa,null))[_0xecf5('0x2c')](handleError(_0x5180fa,null));};exports[_0xecf5('0xb0')]=function(_0x10ca22,_0x1e1cf6,_0x1df00c){var _0x4c2b1b;return db['User'][_0xecf5('0x65')]({'where':{'id':_0x10ca22[_0xecf5('0x6b')]['id']},'attributes':['id',_0xecf5('0x45'),_0xecf5('0x41')]})['then'](handleEntityNotFound(_0x1e1cf6,null))['then'](function(_0x5ae470){if(_0x5ae470){_0x4c2b1b=_0x5ae470;if(!_0x10ca22[_0xecf5('0x4c')]['channel']||!utils['isValidChannel'](_0x10ca22[_0xecf5('0x4c')]['channel'])){throw new db[(_0xecf5('0x95'))]['ValidationError'](_0xecf5('0xb1'));}return _0x5ae470[_0xecf5('0xb2')+_[_0xecf5('0xa3')](_0x10ca22[_0xecf5('0x4c')]['channel']['toLowerCase']())+'Queues'](_0x10ca22[_0xecf5('0x4c')][_0xecf5('0x6c')]);}})[_0xecf5('0x23')](function(_0x15e4b2){for(var _0x257ea8=0x0;_0x257ea8<_0x10ca22['query'][_0xecf5('0x6c')][_0xecf5('0x50')];_0x257ea8+=0x1){var _0xe9b408={'UserId':_0x10ca22[_0xecf5('0x6b')]['id']};_0xe9b408[_[_0xecf5('0xa3')](_0x10ca22[_0xecf5('0x4c')][_0xecf5('0x9e')]['toLowerCase']())+_0xecf5('0xa6')]=_0x10ca22[_0xecf5('0x4c')][_0xecf5('0x6c')][_0x257ea8];socket[_0xecf5('0xa7')](_0xecf5('0x3a')+_[_0xecf5('0xa3')](_0x10ca22[_0xecf5('0x4c')][_0xecf5('0x9e')]['toLowerCase']())+_0xecf5('0xb3'),_0xe9b408);}return _0x15e4b2;})[_0xecf5('0x23')](function(){if(_0x10ca22[_0xecf5('0x4c')][_0xecf5('0x9e')]===_0xecf5('0xa9')){return db[_0xecf5('0xae')]['destroy']({'where':{'UserId':_0x10ca22[_0xecf5('0x6b')]['id'],'VoiceQueueId':_0x10ca22[_0xecf5('0x4c')]['ids']},'individualHooks':!![]})['then'](function(){return _0x4c2b1b;});}return _0x4c2b1b;})['then'](respondWithStatusCode(_0x1e1cf6,null))[_0xecf5('0x2c')](handleError(_0x1e1cf6,null));};exports['addAvatar']=function(_0x23a6fc,_0x4e93fd,_0x15ce06){_0x23a6fc[_0xecf5('0x67')][_0xecf5('0xb4')]=_0x23a6fc[_0xecf5('0xb5')][_0xecf5('0xb6')];return db[_0xecf5('0x5e')][_0xecf5('0x65')]({'where':{'id':_0x23a6fc[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x4e93fd,null))[_0xecf5('0x23')](saveUpdates(_0x23a6fc['body'],null))['then'](respondWithResult(_0x4e93fd,null))[_0xecf5('0x2c')](handleError(_0x4e93fd,null));};exports[_0xecf5('0xb7')]=function(_0xa8d96a,_0x8764b0,_0x20fb76){var _0x80994=path['join'](config[_0xecf5('0xb8')],'server/files/images/logos/default_profile.png');return db[_0xecf5('0x5e')]['find']({'where':{'id':_0xa8d96a[_0xecf5('0x6b')]['id']},'attributes':['id',_0xecf5('0xb4')],'raw':!![]})[_0xecf5('0x23')](handleEntityNotFound(_0x8764b0,null))[_0xecf5('0x23')](function(_0x51acfc){if(_0x51acfc){if(_[_0xecf5('0x73')](_0x51acfc['userpic'])){return _0x8764b0[_0xecf5('0xb9')](_0x80994);}else{if(!fs['existsSync'](path[_0xecf5('0xba')](config['root'],'server/files/images/',_0x51acfc[_0xecf5('0xb4')]))){return _0x8764b0[_0xecf5('0xb9')](_0x80994);}return _0x8764b0[_0xecf5('0xb9')](path[_0xecf5('0xba')](config[_0xecf5('0xb8')],_0xecf5('0xbb'),_0x51acfc['userpic']));}}})[_0xecf5('0x2c')](handleError(_0x8764b0,null));};exports[_0xecf5('0xbc')]=function(_0x142aff,_0x41507b,_0x3ea9f1){var _0x96bfd6={};var _0xbe6616={};var _0x532b53;var _0x2bd556;return db[_0xecf5('0x5e')]['findOne']({'where':{'id':_0x142aff[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x41507b,null))[_0xecf5('0x23')](function(_0x1a6e99){if(_0x1a6e99){_0x532b53=_0x1a6e99;_0xbe6616[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0xbd')]['rawAttributes']);_0xbe6616['query']=_[_0xecf5('0x49')](_0x142aff[_0xecf5('0x4c')]);_0xbe6616['filters']=_[_0xecf5('0x4d')](_0xbe6616[_0xecf5('0x47')],_0xbe6616[_0xecf5('0x4c')]);_0x96bfd6[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0xbe6616[_0xecf5('0x47')],qs['fields'](_0x142aff['query'][_0xecf5('0x4f')]));_0x96bfd6[_0xecf5('0x4e')]=_0x96bfd6['attributes'][_0xecf5('0x50')]?_0x96bfd6[_0xecf5('0x4e')]:_0xbe6616[_0xecf5('0x47')];_0x96bfd6[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x142aff[_0xecf5('0x4c')][_0xecf5('0x54')]);_0x96bfd6[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_['pick'](_0x142aff[_0xecf5('0x4c')],_0xbe6616[_0xecf5('0x55')]));if(_0x142aff[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x96bfd6[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x96bfd6[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x96bfd6[_0xecf5('0x4e')],function(_0x67c394){var _0x532d75={};_0x532d75[_0x67c394]={'$like':'%'+_0x142aff[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x532d75;})});}_0x96bfd6=_['merge']({},_0x96bfd6,_0x142aff['options']);return _0x532b53['getContacts'](_0x96bfd6);}})[_0xecf5('0x23')](function(_0x42b0f6){if(_0x42b0f6){_0x2bd556=_0x42b0f6['length'];if(_0x142aff[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x5f'))){_0x96bfd6['include']=[{'model':db[_0xecf5('0xbf')],'as':'List','required':![]},{'model':db[_0xecf5('0xc0')],'as':_0xecf5('0xc1'),'attributes':['id','name',_0xecf5('0xc2')],'where':_0x142aff[_0xecf5('0x4c')][_0xecf5('0xc3')]?{'id':_0x142aff[_0xecf5('0x4c')][_0xecf5('0xc3')]}:undefined,'required':_0x142aff['query'][_0xecf5('0xc3')]?!![]:![]}];}if(!_0x142aff[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x96bfd6[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x142aff[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x96bfd6['offset']=qs[_0xecf5('0x30')](_0x142aff['query'][_0xecf5('0x30')]);}return _0x532b53[_0xecf5('0xbc')](_0x96bfd6);}})['then'](function(_0x2f4835){if(_0x2f4835){return _0x2f4835?{'count':_0x2bd556,'rows':_0x2f4835}:null;}})[_0xecf5('0x23')](respondWithResult(_0x41507b,null))[_0xecf5('0x2c')](handleError(_0x41507b,null));};exports[_0xecf5('0xc4')]=function(_0x4b1aed,_0x5e2408,_0x6569ad){var _0x43a382;var _0x329158;var _0x775be1={};var _0x5a7a5;return db['User'][_0xecf5('0x9c')]({'where':{'id':_0x4b1aed[_0xecf5('0x6b')]['id']},'attributes':['id',_0xecf5('0x45'),_0xecf5('0x41')]})['then'](handleEntityNotFound(_0x5e2408,null))['then'](function(_0x539334){if(!utils[_0xecf5('0xa1')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x9e')])){throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))](_0xecf5('0xb1'));}_0x43a382=_0x539334;var _0x3121f7={};_0x3121f7[_0xecf5('0x47')]=_['keys'](db[_[_0xecf5('0xa3')](_0x4b1aed['query'][_0xecf5('0x9e')])+'Queue'][_0xecf5('0xc5')]);_0x3121f7[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x4b1aed['query']);_0x3121f7[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x3121f7[_0xecf5('0x47')],_0x3121f7['query']);_0x775be1[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x3121f7[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x4b1aed['query'][_0xecf5('0x4f')]));_0x775be1[_0xecf5('0x4e')]=_0x775be1['attributes'][_0xecf5('0x50')]?_0x775be1['attributes']:_0x3121f7[_0xecf5('0x47')];_0x775be1[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x54')]);_0x775be1[_0xecf5('0x58')]=qs['filters'](_[_0xecf5('0x56')](_0x4b1aed[_0xecf5('0x4c')],_0x3121f7['filters']));if(_0x4b1aed['query'][_0xecf5('0xbe')]){_0x775be1[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x775be1['where'],{'$or':_[_0xecf5('0x3e')](_0x775be1['attributes'],function(_0x163a31){var _0x59a155={};_0x59a155[_0x163a31]={'$like':'%'+_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x59a155;})});}_0x775be1=_[_0xecf5('0x57')]({},_0x775be1,_0x4b1aed[_0xecf5('0x64')]);switch(_0x43a382[_0xecf5('0x41')]){case'admin':return db[_[_0xecf5('0xa3')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x9e')])+_0xecf5('0xc6')]['findAll'](_0x775be1);case _0xecf5('0x3a'):case _0xecf5('0x3b'):return _0x43a382[_0xecf5('0x38')+_[_0xecf5('0xa3')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x9e')])+_0xecf5('0xc7')](_0x775be1);default:throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))](_0xecf5('0xc8'));}})[_0xecf5('0x23')](function(_0x478fe4){_0x5a7a5=_0x478fe4[_0xecf5('0x50')];if(!_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x775be1['limit']=qs[_0xecf5('0x31')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x775be1[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x30')]);}switch(_0x43a382[_0xecf5('0x41')]){case _0xecf5('0x99'):return db[_[_0xecf5('0xa3')](_0x4b1aed[_0xecf5('0x4c')]['channel'])+_0xecf5('0xc6')][_0xecf5('0x61')](_0x775be1);case _0xecf5('0x3a'):case _0xecf5('0x3b'):return _0x43a382[_0xecf5('0x38')+_[_0xecf5('0xa3')](_0x4b1aed[_0xecf5('0x4c')][_0xecf5('0x9e')])+_0xecf5('0xc7')](_0x775be1);}})['then'](function(_0x14ff58){return{'count':_0x5a7a5,'rows':_0x14ff58};})[_0xecf5('0x23')](respondWithResult(_0x5e2408,null))[_0xecf5('0x2c')](handleError(_0x5e2408,null));};exports[_0xecf5('0xc9')]=function(_0x240e1b,_0x1eed91,_0x2be83e){var _0x3e29d1={};var _0x4889b2={};var _0x2fa362;var _0x5cf2e1;return db[_0xecf5('0x5e')][_0xecf5('0x9c')]({'where':{'id':_0x240e1b[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x1eed91,null))[_0xecf5('0x23')](function(_0x3487de){if(_0x3487de){_0x2fa362=_0x3487de;_0x4889b2[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0xae')]['rawAttributes']);_0x4889b2['query']=_['keys'](_0x240e1b[_0xecf5('0x4c')]);_0x4889b2['filters']=_['intersection'](_0x4889b2[_0xecf5('0x47')],_0x4889b2[_0xecf5('0x4c')]);_0x3e29d1[_0xecf5('0x4e')]=_['intersection'](_0x4889b2['model'],qs[_0xecf5('0x4f')](_0x240e1b[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x3e29d1[_0xecf5('0x4e')]=_0x3e29d1[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x3e29d1[_0xecf5('0x4e')]:_0x4889b2[_0xecf5('0x47')];_0x3e29d1[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x240e1b[_0xecf5('0x4c')][_0xecf5('0x54')]);_0x3e29d1['where']=qs[_0xecf5('0x55')](_['pick'](_0x240e1b[_0xecf5('0x4c')],_0x4889b2['filters']));if(_0x240e1b[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x3e29d1[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x3e29d1[_0xecf5('0x58')],{'$or':_['map'](_0x3e29d1[_0xecf5('0x4e')],function(_0x36ba57){var _0x36d72c={};_0x36d72c[_0x36ba57]={'$like':'%'+_0x240e1b[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x36d72c;})});}_0x3e29d1=_['merge']({},_0x3e29d1,_0x240e1b[_0xecf5('0x64')]);return _0x2fa362[_0xecf5('0xc9')](_0x3e29d1);}})[_0xecf5('0x23')](function(_0x38776e){if(_0x38776e){_0x5cf2e1=_0x38776e['length'];if(!_0x240e1b[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x3e29d1['limit']=qs['limit'](_0x240e1b[_0xecf5('0x4c')]['limit']);_0x3e29d1['offset']=qs[_0xecf5('0x30')](_0x240e1b[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x2fa362[_0xecf5('0xc9')](_0x3e29d1);}})['then'](function(_0x2ee7f1){if(_0x2ee7f1){return _0x2ee7f1?{'count':_0x5cf2e1,'rows':_0x2ee7f1}:null;}})[_0xecf5('0x23')](respondWithResult(_0x1eed91,null))[_0xecf5('0x2c')](handleError(_0x1eed91,null));};exports['getGroups']=function(_0x407e13,_0x4de960,_0x230f08){var _0x1f54dc={};var _0x3a11db={};var _0x2b8dc8;var _0x15ac23;return db[_0xecf5('0x5e')][_0xecf5('0x9c')]({'where':{'id':_0x407e13['params']['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x4de960,null))['then'](function(_0x2550aa){if(_0x2550aa){_0x2b8dc8=_0x2550aa;_0x3a11db[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0xca')][_0xecf5('0xc5')]);_0x3a11db[_0xecf5('0x4c')]=_['keys'](_0x407e13[_0xecf5('0x4c')]);_0x3a11db[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x3a11db[_0xecf5('0x47')],_0x3a11db[_0xecf5('0x4c')]);_0x1f54dc[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x3a11db[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x407e13['query'][_0xecf5('0x4f')]));_0x1f54dc['attributes']=_0x1f54dc[_0xecf5('0x4e')]['length']?_0x1f54dc[_0xecf5('0x4e')]:_0x3a11db[_0xecf5('0x47')];_0x1f54dc[_0xecf5('0x53')]=qs['sort'](_0x407e13[_0xecf5('0x4c')]['sort']);_0x1f54dc['where']=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x407e13[_0xecf5('0x4c')],_0x3a11db[_0xecf5('0x55')]));if(_0x407e13[_0xecf5('0x4c')]['filter']){_0x1f54dc[_0xecf5('0x58')]=_['merge'](_0x1f54dc[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x1f54dc[_0xecf5('0x4e')],function(_0x33413d){var _0x1eec48={};_0x1eec48[_0x33413d]={'$like':'%'+_0x407e13[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x1eec48;})});}_0x1f54dc=_[_0xecf5('0x57')]({},_0x1f54dc,_0x407e13[_0xecf5('0x64')]);return _0x2b8dc8[_0xecf5('0xcb')](_0x1f54dc);}})[_0xecf5('0x23')](function(_0x3c5e5b){if(_0x3c5e5b){_0x15ac23=_0x3c5e5b[_0xecf5('0x50')];if(!_0x407e13[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x1f54dc[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x407e13[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x1f54dc[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x407e13[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x2b8dc8['getGroups'](_0x1f54dc);}})['then'](function(_0x4b1d37){if(_0x4b1d37){return _0x4b1d37?{'count':_0x15ac23,'rows':_0x4b1d37}:null;}})[_0xecf5('0x23')](respondWithResult(_0x4de960,null))[_0xecf5('0x2c')](handleError(_0x4de960,null));};exports[_0xecf5('0xcc')]=function(_0x3ba4f8,_0xb8dd76,_0x46d246){var _0x1bd4c1={'raw':!![],'where':{}};var _0x2b9a2c={};var _0x4cdfc1={'count':0x0,'rows':[]};return db['User'][_0xecf5('0x9c')]({'where':{'id':_0x3ba4f8[_0xecf5('0x6b')]['id']}})['then'](handleEntityNotFound(_0xb8dd76,null))[_0xecf5('0x23')](function(_0x27a15c){if(_0x27a15c){_0x2b9a2c[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0xcd')][_0xecf5('0xc5')]);_0x2b9a2c[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x3ba4f8[_0xecf5('0x4c')]);_0x2b9a2c[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x2b9a2c['model'],_0x2b9a2c['query']);_0x1bd4c1[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x2b9a2c[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x3ba4f8[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x1bd4c1['attributes']=_0x1bd4c1[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x1bd4c1['attributes']:_0x2b9a2c[_0xecf5('0x47')];if(!_0x3ba4f8['query'][_0xecf5('0x51')](_0xecf5('0x52'))){_0x1bd4c1[_0xecf5('0x31')]=qs['limit'](_0x3ba4f8[_0xecf5('0x4c')]['limit']);_0x1bd4c1[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x3ba4f8[_0xecf5('0x4c')][_0xecf5('0x30')]);}_0x1bd4c1[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x3ba4f8[_0xecf5('0x4c')]['sort']);_0x1bd4c1[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x3ba4f8[_0xecf5('0x4c')],_0x2b9a2c[_0xecf5('0x55')]));_0x1bd4c1[_0xecf5('0x58')][_0xecf5('0xce')]=_0x27a15c['id'];if(_0x3ba4f8[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x1bd4c1['where']=_['merge'](_0x1bd4c1[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x1bd4c1['attributes'],function(_0x144b83){var _0x3e51c2={};_0x3e51c2[_0x144b83]={'$like':'%'+_0x3ba4f8['query'][_0xecf5('0xbe')]+'%'};return _0x3e51c2;})});}_0x1bd4c1=_[_0xecf5('0x57')]({},_0x1bd4c1,_0x3ba4f8[_0xecf5('0x64')]);return db[_0xecf5('0xcd')]['count']({'where':_0x1bd4c1[_0xecf5('0x58')]})[_0xecf5('0x23')](function(_0x5c0421){_0x4cdfc1[_0xecf5('0x2f')]=_0x5c0421;if(_0x3ba4f8[_0xecf5('0x4c')][_0xecf5('0x5f')]){_0x1bd4c1['include']=[{'all':!![]}];}return db[_0xecf5('0xcd')][_0xecf5('0x61')](_0x1bd4c1);})[_0xecf5('0x23')](function(_0x1c2955){_0x4cdfc1[_0xecf5('0x62')]=_0x1c2955;return _0x4cdfc1;});}})['then'](respondWithFilteredResult(_0xb8dd76,_0x1bd4c1))['catch'](handleError(_0xb8dd76,null));};exports[_0xecf5('0xcf')]=function(_0x3d80cf,_0x41c369,_0x5ad89e){var _0x123110={'raw':!![],'where':{}};var _0x31f654={};var _0x55a625={'count':0x0,'rows':[]};return db['User'][_0xecf5('0x9c')]({'where':{'id':_0x3d80cf[_0xecf5('0x6b')]['id']}})['then'](handleEntityNotFound(_0x41c369,null))[_0xecf5('0x23')](function(_0x5ac4a9){if(_0x5ac4a9){_0x31f654[_0xecf5('0x47')]=_['keys'](db[_0xecf5('0xd0')][_0xecf5('0xc5')]);_0x31f654[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x3d80cf['query']);_0x31f654[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x31f654[_0xecf5('0x47')],_0x31f654[_0xecf5('0x4c')]);_0x123110[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x31f654[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x3d80cf[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x123110[_0xecf5('0x4e')]=_0x123110[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x123110['attributes']:_0x31f654[_0xecf5('0x47')];if(!_0x3d80cf[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x123110['limit']=qs[_0xecf5('0x31')](_0x3d80cf[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x123110[_0xecf5('0x30')]=qs['offset'](_0x3d80cf['query']['offset']);}_0x123110[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x3d80cf[_0xecf5('0x4c')]['sort']);_0x123110[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_['pick'](_0x3d80cf[_0xecf5('0x4c')],_0x31f654['filters']));_0x123110[_0xecf5('0x58')][_0xecf5('0xce')]=_0x5ac4a9['id'];if(_0x3d80cf[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x123110[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x123110['where'],{'$or':_[_0xecf5('0x3e')](_0x123110[_0xecf5('0x4e')],function(_0x414269){var _0x47ec22={};_0x47ec22[_0x414269]={'$like':'%'+_0x3d80cf[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x47ec22;})});}_0x123110=_['merge']({},_0x123110,_0x3d80cf['options']);return db[_0xecf5('0xd0')][_0xecf5('0x2f')]({'where':_0x123110[_0xecf5('0x58')]})[_0xecf5('0x23')](function(_0x3af2d7){_0x55a625[_0xecf5('0x2f')]=_0x3af2d7;if(_0x3d80cf[_0xecf5('0x4c')][_0xecf5('0x5f')]){_0x123110[_0xecf5('0x60')]=[{'all':!![]}];}return db[_0xecf5('0xd0')]['findAll'](_0x123110);})['then'](function(_0x4e2381){_0x55a625[_0xecf5('0x62')]=_0x4e2381;return _0x55a625;});}})[_0xecf5('0x23')](respondWithFilteredResult(_0x41c369,_0x123110))[_0xecf5('0x2c')](handleError(_0x41c369,null));};exports['getChatInteractions']=function(_0x46d1c9,_0x3df9bc,_0x23e4ae){var _0x3765e0={};var _0x1bd1b1={};var _0x25ab8c;var _0x3fd75f;return db[_0xecf5('0x5e')]['findOne']({'where':{'id':_0x46d1c9[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x3df9bc,null))[_0xecf5('0x23')](function(_0x3b5d67){if(_0x3b5d67){_0x25ab8c=_0x3b5d67;_0x1bd1b1['model']=_[_0xecf5('0x49')](db['ChatInteraction'][_0xecf5('0xc5')]);_0x1bd1b1[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x46d1c9[_0xecf5('0x4c')]);_0x1bd1b1[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x1bd1b1[_0xecf5('0x47')],_0x1bd1b1[_0xecf5('0x4c')]);_0x3765e0[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x1bd1b1[_0xecf5('0x47')],qs['fields'](_0x46d1c9[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x3765e0['attributes']=_0x3765e0[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x3765e0['attributes']:_0x1bd1b1['model'];_0x3765e0['order']=qs['sort'](_0x46d1c9['query'][_0xecf5('0x54')]);_0x3765e0['where']=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x46d1c9[_0xecf5('0x4c')],_0x1bd1b1[_0xecf5('0x55')]));if(_0x46d1c9[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x3765e0[_0xecf5('0x58')]=_['merge'](_0x3765e0[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x3765e0['attributes'],function(_0x5df896){var _0x415235={};_0x415235[_0x5df896]={'$like':'%'+_0x46d1c9[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x415235;})});}_0x3765e0=_[_0xecf5('0x57')]({},_0x3765e0,_0x46d1c9[_0xecf5('0x64')]);return _0x25ab8c[_0xecf5('0xd1')](_0x3765e0);}})[_0xecf5('0x23')](function(_0x1b9e1c){if(_0x1b9e1c){_0x3fd75f=_0x1b9e1c[_0xecf5('0x50')];if(!_0x46d1c9[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x3765e0[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x46d1c9[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x3765e0[_0xecf5('0x30')]=qs['offset'](_0x46d1c9[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x25ab8c[_0xecf5('0xd1')](_0x3765e0);}})[_0xecf5('0x23')](function(_0x22297e){if(_0x22297e){return _0x22297e?{'count':_0x3fd75f,'rows':_0x22297e}:null;}})['then'](respondWithResult(_0x3df9bc,null))[_0xecf5('0x2c')](handleError(_0x3df9bc,null));};exports[_0xecf5('0xd2')]=function(_0x5295f3,_0xea8dfa,_0x4adc91){var _0x274e78={};var _0x1e51ae={};var _0x2e4f81;var _0x22556a;return db[_0xecf5('0x5e')][_0xecf5('0x9c')]({'where':{'id':_0x5295f3['params']['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0xea8dfa,null))[_0xecf5('0x23')](function(_0x3b0196){if(_0x3b0196){_0x2e4f81=_0x3b0196;_0x1e51ae['model']=_['keys'](db[_0xecf5('0xd3')][_0xecf5('0xc5')]);_0x1e51ae[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x5295f3[_0xecf5('0x4c')]);_0x1e51ae['filters']=_['intersection'](_0x1e51ae[_0xecf5('0x47')],_0x1e51ae[_0xecf5('0x4c')]);_0x274e78[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x1e51ae[_0xecf5('0x47')],qs['fields'](_0x5295f3[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x274e78[_0xecf5('0x4e')]=_0x274e78[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x274e78[_0xecf5('0x4e')]:_0x1e51ae[_0xecf5('0x47')];_0x274e78[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x5295f3['query'][_0xecf5('0x54')]);_0x274e78[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x5295f3['query'],_0x1e51ae[_0xecf5('0x55')]));if(_0x5295f3[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x274e78[_0xecf5('0x58')]=_['merge'](_0x274e78[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x274e78[_0xecf5('0x4e')],function(_0x26edd5){var _0x519219={};_0x519219[_0x26edd5]={'$like':'%'+_0x5295f3['query'][_0xecf5('0xbe')]+'%'};return _0x519219;})});}_0x274e78=_[_0xecf5('0x57')]({},_0x274e78,_0x5295f3[_0xecf5('0x64')]);return _0x2e4f81[_0xecf5('0xd2')](_0x274e78);}})[_0xecf5('0x23')](function(_0x21238f){if(_0x21238f){_0x22556a=_0x21238f[_0xecf5('0x50')];if(!_0x5295f3[_0xecf5('0x4c')]['hasOwnProperty'](_0xecf5('0x52'))){_0x274e78[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x5295f3['query'][_0xecf5('0x31')]);_0x274e78[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x5295f3[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x2e4f81[_0xecf5('0xd2')](_0x274e78);}})[_0xecf5('0x23')](function(_0x28b2c4){if(_0x28b2c4){return _0x28b2c4?{'count':_0x22556a,'rows':_0x28b2c4}:null;}})[_0xecf5('0x23')](respondWithResult(_0xea8dfa,null))[_0xecf5('0x2c')](handleError(_0xea8dfa,null));};exports[_0xecf5('0xd4')]=function(_0x367458,_0xa69a68,_0x46f73c){var _0x42f9e4={'raw':!![],'where':{}};var _0x8ac25={};var _0x488bb3={'count':0x0,'rows':[]};return db[_0xecf5('0x5e')]['findOne']({'where':{'id':_0x367458[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0xa69a68,null))[_0xecf5('0x23')](function(_0x2ff389){if(_0x2ff389){_0x8ac25[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0xd5')]['rawAttributes']);_0x8ac25[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x367458[_0xecf5('0x4c')]);_0x8ac25[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x8ac25[_0xecf5('0x47')],_0x8ac25[_0xecf5('0x4c')]);_0x42f9e4['attributes']=_[_0xecf5('0x4d')](_0x8ac25[_0xecf5('0x47')],qs['fields'](_0x367458[_0xecf5('0x4c')]['fields']));_0x42f9e4[_0xecf5('0x4e')]=_0x42f9e4[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x42f9e4[_0xecf5('0x4e')]:_0x8ac25[_0xecf5('0x47')];if(!_0x367458[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x42f9e4[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x367458[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x42f9e4[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x367458['query'][_0xecf5('0x30')]);}_0x42f9e4['order']=qs[_0xecf5('0x54')](_0x367458['query'][_0xecf5('0x54')]);_0x42f9e4[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x367458[_0xecf5('0x4c')],_0x8ac25['filters']));_0x42f9e4[_0xecf5('0x58')]['UserId']=_0x2ff389['id'];if(_0x367458[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x42f9e4[_0xecf5('0x58')]=_['merge'](_0x42f9e4[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x42f9e4[_0xecf5('0x4e')],function(_0x8b7e9a){var _0xf48afc={};_0xf48afc[_0x8b7e9a]={'$like':'%'+_0x367458[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0xf48afc;})});}_0x42f9e4=_[_0xecf5('0x57')]({},_0x42f9e4,_0x367458[_0xecf5('0x64')]);return db['MailInteraction'][_0xecf5('0x2f')]({'where':_0x42f9e4[_0xecf5('0x58')]})[_0xecf5('0x23')](function(_0x11cbd4){_0x488bb3[_0xecf5('0x2f')]=_0x11cbd4;if(_0x367458['query'][_0xecf5('0x5f')]){_0x42f9e4[_0xecf5('0x60')]=[{'all':!![]}];}return db[_0xecf5('0xd5')][_0xecf5('0x61')](_0x42f9e4);})[_0xecf5('0x23')](function(_0x515abf){_0x488bb3[_0xecf5('0x62')]=_0x515abf;return _0x488bb3;});}})[_0xecf5('0x23')](respondWithFilteredResult(_0xa69a68,_0x42f9e4))[_0xecf5('0x2c')](handleError(_0xa69a68,null));};exports[_0xecf5('0xd6')]=function(_0x1fc603,_0x458280,_0x48ca02){var _0x5a5b4d={};var _0x22b153={};var _0x58bf8f;var _0x45a51d;return db[_0xecf5('0x5e')]['findOne']({'where':{'id':_0x1fc603[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x458280,null))[_0xecf5('0x23')](function(_0x2d9aa6){if(_0x2d9aa6){_0x58bf8f=_0x2d9aa6;_0x22b153['model']=_[_0xecf5('0x49')](db['SmsInteraction'][_0xecf5('0xc5')]);_0x22b153[_0xecf5('0x4c')]=_['keys'](_0x1fc603['query']);_0x22b153[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x22b153[_0xecf5('0x47')],_0x22b153[_0xecf5('0x4c')]);_0x5a5b4d[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x22b153['model'],qs[_0xecf5('0x4f')](_0x1fc603[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x5a5b4d[_0xecf5('0x4e')]=_0x5a5b4d[_0xecf5('0x4e')]['length']?_0x5a5b4d['attributes']:_0x22b153[_0xecf5('0x47')];_0x5a5b4d[_0xecf5('0x53')]=qs['sort'](_0x1fc603[_0xecf5('0x4c')]['sort']);_0x5a5b4d['where']=qs['filters'](_[_0xecf5('0x56')](_0x1fc603[_0xecf5('0x4c')],_0x22b153['filters']));if(_0x1fc603[_0xecf5('0x4c')]['filter']){_0x5a5b4d[_0xecf5('0x58')]=_['merge'](_0x5a5b4d[_0xecf5('0x58')],{'$or':_['map'](_0x5a5b4d['attributes'],function(_0x30f598){var _0x187d57={};_0x187d57[_0x30f598]={'$like':'%'+_0x1fc603[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x187d57;})});}_0x5a5b4d=_[_0xecf5('0x57')]({},_0x5a5b4d,_0x1fc603[_0xecf5('0x64')]);return _0x58bf8f['getSmsInteractions'](_0x5a5b4d);}})[_0xecf5('0x23')](function(_0x9c17d0){if(_0x9c17d0){_0x45a51d=_0x9c17d0['length'];if(!_0x1fc603[_0xecf5('0x4c')][_0xecf5('0x51')](_0xecf5('0x52'))){_0x5a5b4d['limit']=qs[_0xecf5('0x31')](_0x1fc603[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x5a5b4d[_0xecf5('0x30')]=qs['offset'](_0x1fc603['query'][_0xecf5('0x30')]);}return _0x58bf8f[_0xecf5('0xd6')](_0x5a5b4d);}})[_0xecf5('0x23')](function(_0xb94e9c){if(_0xb94e9c){return _0xb94e9c?{'count':_0x45a51d,'rows':_0xb94e9c}:null;}})['then'](respondWithResult(_0x458280,null))[_0xecf5('0x2c')](handleError(_0x458280,null));};exports[_0xecf5('0xd7')]=function(_0x44cc3a,_0x8bcc2e,_0x24a680){var _0x15698a={};var _0x35d7da={};var _0x394591;var _0x5ec0e8;return db[_0xecf5('0x5e')][_0xecf5('0x9c')]({'where':{'id':_0x44cc3a[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x8bcc2e,null))['then'](function(_0x2330d4){if(_0x2330d4){_0x394591=_0x2330d4;_0x35d7da[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0xd8')]['rawAttributes']);_0x35d7da[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x44cc3a['query']);_0x35d7da['filters']=_[_0xecf5('0x4d')](_0x35d7da[_0xecf5('0x47')],_0x35d7da['query']);_0x15698a[_0xecf5('0x4e')]=_['intersection'](_0x35d7da[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x44cc3a['query'][_0xecf5('0x4f')]));_0x15698a[_0xecf5('0x4e')]=_0x15698a[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x15698a[_0xecf5('0x4e')]:_0x35d7da[_0xecf5('0x47')];_0x15698a['order']=qs[_0xecf5('0x54')](_0x44cc3a[_0xecf5('0x4c')][_0xecf5('0x54')]);_0x15698a[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_['pick'](_0x44cc3a[_0xecf5('0x4c')],_0x35d7da[_0xecf5('0x55')]));if(_0x44cc3a[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x15698a[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x15698a['where'],{'$or':_[_0xecf5('0x3e')](_0x15698a[_0xecf5('0x4e')],function(_0x36c047){var _0x576e21={};_0x576e21[_0x36c047]={'$like':'%'+_0x44cc3a[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x576e21;})});}_0x15698a=_['merge']({},_0x15698a,_0x44cc3a[_0xecf5('0x64')]);return _0x394591[_0xecf5('0xd7')](_0x15698a);}})[_0xecf5('0x23')](function(_0x576eb2){if(_0x576eb2){_0x5ec0e8=_0x576eb2[_0xecf5('0x50')];if(!_0x44cc3a[_0xecf5('0x4c')][_0xecf5('0x51')]('nolimit')){_0x15698a[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x44cc3a[_0xecf5('0x4c')]['limit']);_0x15698a[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x44cc3a[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x394591[_0xecf5('0xd7')](_0x15698a);}})[_0xecf5('0x23')](function(_0x234603){if(_0x234603){return _0x234603?{'count':_0x5ec0e8,'rows':_0x234603}:null;}})[_0xecf5('0x23')](respondWithResult(_0x8bcc2e,null))['catch'](handleError(_0x8bcc2e,null));};exports[_0xecf5('0xd9')]=function(_0xed74a4,_0x396a73,_0x44e2f5){var _0x1baabe;var _0x5008d8;var _0xaf7da0;var _0x27ab36=!_[_0xecf5('0x73')](_0xed74a4[_0xecf5('0x6b')]['id'])?_0xed74a4[_0xecf5('0x6b')]['id']:!_['isNil'](_0xed74a4['user']['id'])?_0xed74a4[_0xecf5('0x3a')]['id']:null;return db[_0xecf5('0x5e')][_0xecf5('0x65')]({'where':{'id':_0x27ab36,'role':_0xecf5('0x3b')},'attributes':['id',_0xecf5('0x45'),_0xecf5('0xda'),'mobile',_0xecf5('0x41'),_0xecf5('0x76'),_0xecf5('0x9f')]})[_0xecf5('0x23')](handleEntityNotFound(_0x396a73,null))[_0xecf5('0x23')](function(_0x18574e){if(_0x18574e){_0x1baabe=_0x18574e;if(_0xed74a4[_0xecf5('0x67')][_0xecf5('0xab')]){_0xaf7da0=util[_0xecf5('0xac')]('LOCAL/%s@from-sip/n',_0x1baabe[_0xed74a4['body']['interface']]);}else if(_0xed74a4[_0xecf5('0x67')][_0xecf5('0xdb')]){_0xaf7da0=util['format']('SIP/%s',_0xed74a4[_0xecf5('0x67')][_0xecf5('0xdb')]);}else{_0xaf7da0=util[_0xecf5('0xac')](_0xecf5('0xad'),_0x1baabe[_0xecf5('0x45')]);}socket['to'](util['format'](_0xecf5('0xdc'),_0x1baabe[_0xecf5('0x45')]))[_0xecf5('0xa7')](_0xecf5('0xdd'),{'ip':_0xed74a4[_0xecf5('0xde')][_0xecf5('0xdf')]||_0xed74a4['connection']['remoteAddress']||_0xed74a4[_0xecf5('0xe0')][_0xecf5('0xe1')]||_0xed74a4[_0xecf5('0xe2')][_0xecf5('0xe0')][_0xecf5('0xe1')]});return db[_0xecf5('0xae')][_0xecf5('0x37')]({'where':{'membername':_0x1baabe['name']},'individualHooks':!![]});}})[_0xecf5('0x23')](function(_0x3e504c){if(_0x1baabe){return _0x1baabe[_0xecf5('0xe3')]({'raw':!![]});}})[_0xecf5('0x23')](function(_0x3e20aa){var _0x6fc64d=[];if(_0x3e20aa){_0x5008d8=_0x3e20aa;if(_0x5008d8['length']){for(var _0x99d017=0x0;_0x99d017<_0x5008d8[_0xecf5('0x50')];_0x99d017++){_0x6fc64d[_0xecf5('0xe4')]({'membername':_0x1baabe[_0xecf5('0x45')],'UserId':_0x1baabe['id'],'queue_name':_0x5008d8[_0x99d017]['name'],'VoiceQueueId':_0x5008d8[_0x99d017]['id'],'interface':_0xaf7da0,'paused':_0x1baabe[_0xecf5('0x9f')]||![],'penalty':_0x5008d8[_0x99d017][_0xecf5('0xe5')]||0x0});}return BPromise[_0xecf5('0xe6')](_0x6fc64d,function(_0x48a752){return db[_0xecf5('0xae')][_0xecf5('0xaf')](_0x48a752);});}}})['then'](function(){return db[_0xecf5('0xe7')][_0xecf5('0x61')]({'where':{'membername':_0x1baabe[_0xecf5('0x45')],'exitAt':null}});})[_0xecf5('0x23')](function(_0x5e66e4){var _0x176e32=[];_0x5e66e4['forEach'](function(_0x3fad73){_0x176e32['push'](_0x3fad73[_0xecf5('0x68')]({'exitAt':moment()['format'](_0xecf5('0xe8'))}));});return BPromise[_0xecf5('0xe9')](_0x176e32);})[_0xecf5('0x23')](function(){var _0x2fd33e=[];var _0x4f3355=[];var _0x2ac028=utils[_0xecf5('0xea')]();var _0x5af5b1={'membername':_0x1baabe[_0xecf5('0x45')],'interface':_0xaf7da0,'enterAt':moment()[_0xecf5('0xac')](_0xecf5('0xe8')),'role':_0x1baabe[_0xecf5('0x41')],'internal':_0x1baabe[_0xecf5('0x76')]};_0x2ac028[_0xecf5('0xeb')](function(_0x38a510){_0x2fd33e['push'](_[_0xecf5('0x57')]({'channel':_0x38a510,'type':_0xecf5('0xec'),'data1':_0xed74a4[_0xecf5('0x67')][_0xecf5('0xed')],'data2':_0xaf7da0},_0x5af5b1));if(_0x1baabe[_0xecf5('0x9f')]){_0x4f3355[_0xecf5('0xe4')](_[_0xecf5('0x57')]({'channel':_0x38a510,'type':_0xecf5('0xee'),'data1':_0xecf5('0xef')},_0x5af5b1));}});return db[_0xecf5('0xe7')][_0xecf5('0x66')](_0x2fd33e[_0xecf5('0xf0')](_0x4f3355),{'individualHooks':!![]});})['then'](function(){return _0x1baabe[_0xecf5('0x68')]({'online':!![],'lastLoginAt':moment()[_0xecf5('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1baabe[_0xecf5('0x9f')]||![],'mailPause':_0x1baabe[_0xecf5('0x9f')]||![],'chatPause':_0x1baabe[_0xecf5('0x9f')]||![],'faxPause':_0x1baabe[_0xecf5('0x9f')]||![],'smsPause':_0x1baabe[_0xecf5('0x9f')]||![],'openchannelPause':_0x1baabe['loginInPause']||![],'pauseType':_0x1baabe['loginInPause']?_0xecf5('0xef'):null,'interface':_0xaf7da0,'lastPauseAt':moment()[_0xecf5('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](function(_0xabb41c){if(_0xed74a4[_0xecf5('0xf1')]){return _0x44e2f5();}else{return BPromise[_0xecf5('0xf2')](_0xabb41c)['then'](respondWithResult(_0x396a73,null));}})[_0xecf5('0x2c')](handleError(_0x396a73,null));};exports[_0xecf5('0xf3')]=function(_0x5d66df,_0x4307c4,_0x57cb07){var _0x231bd8;return db['User'][_0xecf5('0x65')]({'where':{'id':_0x5d66df[_0xecf5('0x6b')]['id'],'role':_0xecf5('0x3b')},'attributes':['id','name',_0xecf5('0x41')]})[_0xecf5('0x23')](handleEntityNotFound(_0x4307c4,null))[_0xecf5('0x23')](function(_0x59ad5b){if(_0x59ad5b){_0x231bd8=_0x59ad5b;return db[_0xecf5('0xae')][_0xecf5('0x37')]({'where':{'membername':_0x231bd8[_0xecf5('0x45')]},'individualHooks':!![]});}})[_0xecf5('0x23')](function(){return db[_0xecf5('0xe7')][_0xecf5('0x61')]({'where':{'membername':_0x231bd8[_0xecf5('0x45')],'exitAt':null}});})['then'](function(_0x1de9a1){var _0x1c99c4=[];_0x1de9a1[_0xecf5('0xeb')](function(_0x4f8eb3){_0x1c99c4['push'](_0x4f8eb3[_0xecf5('0x68')]({'exitAt':moment()['format'](_0xecf5('0xe8'))}));});return BPromise['all'](_0x1c99c4);})[_0xecf5('0x23')](function(){return _0x231bd8['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x4307c4,null))[_0xecf5('0x2c')](handleError(_0x4307c4,null));};exports['pause']=function(_0x2c7676,_0x596db7,_0x227366){var _0x2eba7c;return db[_0xecf5('0xae')][_0xecf5('0x68')]({'paused':0x1},{'where':{'UserId':_0x2c7676[_0xecf5('0x6b')]['id']},'individualHooks':!![]})[_0xecf5('0x23')](function(){return db[_0xecf5('0x5e')][_0xecf5('0x65')]({'where':{'id':_0x2c7676[_0xecf5('0x6b')]['id'],'role':_0xecf5('0x3b')},'attributes':['id',_0xecf5('0x45'),_0xecf5('0x41'),'internal',_0xecf5('0xab')]});})[_0xecf5('0x23')](handleEntityNotFound(_0x596db7,null))['then'](function(_0x3ce5ee){if(_0x3ce5ee){_0x2eba7c=_0x3ce5ee;return respondWithRpcPromise(_0xecf5('0xf4'),_0xecf5('0xf5'),{'id':_0x2eba7c['id'],'name':_0x2eba7c[_0xecf5('0x45')],'pause':!![]});}})[_0xecf5('0x23')](function(){if(_0x2eba7c){return db[_0xecf5('0xe7')][_0xecf5('0x61')]({'where':{'membername':_0x2eba7c[_0xecf5('0x45')],'type':_0xecf5('0xee'),'exitAt':null}});}})[_0xecf5('0x23')](function(_0x4db53e){if(_0x4db53e[_0xecf5('0x50')]){var _0x28b943=moment()[_0xecf5('0xac')](_0xecf5('0xe8'));for(var _0x59152b=0x0,_0x5b3fee=_0x4db53e[_0xecf5('0x50')];_0x59152b<_0x5b3fee;_0x59152b++){_0x4db53e[_0x59152b]['updateAttributes']({'exitAt':_0x28b943});}}})['then'](function(){var _0x2abb88=[];var _0x9e2e4b=utils[_0xecf5('0xea')]();_0x9e2e4b[_0xecf5('0xeb')](function(_0x15ff99){_0x2abb88[_0xecf5('0xe4')]({'channel':_0x15ff99,'membername':_0x2eba7c[_0xecf5('0x45')],'interface':_[_0xecf5('0x73')](_0x2eba7c[_0xecf5('0xab')])?util[_0xecf5('0xac')]('SIP/%s',_0x2eba7c[_0xecf5('0x45')]):_0x2eba7c[_0xecf5('0xab')],'type':_0xecf5('0xee'),'enterAt':moment()[_0xecf5('0xac')](_0xecf5('0xe8')),'data1':_0x2c7676['body'][_0xecf5('0x59')]||_0xecf5('0xf6'),'role':_0x2eba7c[_0xecf5('0x41')],'internal':_0x2eba7c[_0xecf5('0x76')]});});return db[_0xecf5('0xe7')][_0xecf5('0x66')](_0x2abb88,{'individualHooks':!![]});})[_0xecf5('0x23')](function(){return _0x2eba7c[_0xecf5('0x68')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2c7676['body'][_0xecf5('0x59')]||_0xecf5('0xf6'),'lastPauseAt':moment()[_0xecf5('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xecf5('0x23')](respondWithResult(_0x596db7,null))[_0xecf5('0x2c')](handleError(_0x596db7,null));};exports['unpause']=function(_0x25f2e7,_0x5eaa2a,_0x24f677){var _0x331c01;return db[_0xecf5('0x5e')][_0xecf5('0x65')]({'where':{'id':_0x25f2e7['params']['id']},'attributes':['id',_0xecf5('0x45'),_0xecf5('0x41'),_0xecf5('0xa0'),'mailPause','chatPause',_0xecf5('0xf7'),_0xecf5('0xf8'),'smsPause','pauseType',_0xecf5('0xf9')]})[_0xecf5('0x23')](handleEntityNotFound(_0x5eaa2a,null))[_0xecf5('0x23')](function(_0x1cbb18){if(_0x1cbb18){_0x331c01=_0x1cbb18;if(_0x25f2e7['body'][_0xecf5('0x9e')]&&!utils['isValidChannel'](_0x25f2e7[_0xecf5('0x67')][_0xecf5('0x9e')])){throw new db[(_0xecf5('0x95'))][(_0xecf5('0x96'))](_0xecf5('0xb1'));}switch(_0x25f2e7[_0xecf5('0x67')]['channel']){case _0xecf5('0xa9'):return respondWithRpcPromise(_0xecf5('0xf4'),_0xecf5('0xfa'),{'id':_0x331c01['id'],'name':_0x331c01[_0xecf5('0x45')],'pause':![]})[_0xecf5('0x23')](function(){return db[_0xecf5('0xae')][_0xecf5('0x68')]({'paused':0x0},{'where':{'UserId':_0x331c01['id']},'individualHooks':!![]});})[_0xecf5('0x23')](function(){return db[_0xecf5('0xe7')][_0xecf5('0x65')]({'where':{'channel':_0x25f2e7[_0xecf5('0x67')][_0xecf5('0x9e')],'membername':_0x331c01[_0xecf5('0x45')],'type':_0xecf5('0xee'),'exitAt':null}});})['then'](function(_0x484467){if(_0x484467){return _0x484467[_0xecf5('0x68')]({'exitAt':moment()[_0xecf5('0xac')](_0xecf5('0xe8')),'data2':_0xecf5('0xfb')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x331c01[_0xecf5('0x68')]({'voicePause':![]});});case _0xecf5('0xfc'):case'chat':case _0xecf5('0xfd'):case'sms':case _0xecf5('0xfe'):return db[_0xecf5('0xe7')]['find']({'where':{'channel':_0x25f2e7['body'][_0xecf5('0x9e')],'membername':_0x331c01['name'],'type':_0xecf5('0xee'),'exitAt':null}})[_0xecf5('0x23')](function(_0xf23b63){if(_0xf23b63){return _0xf23b63[_0xecf5('0x68')]({'exitAt':moment()['format'](_0xecf5('0xe8')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x4e03ba={};_[_0xecf5('0x32')](_0x4e03ba,util[_0xecf5('0xac')](_0xecf5('0xff'),_0x25f2e7[_0xecf5('0x67')][_0xecf5('0x9e')],'Pause'),![]);return _0x331c01['update'](_0x4e03ba);});default:return respondWithRpcPromise(_0xecf5('0xf4'),_0xecf5('0xfa'),{'id':_0x331c01['id'],'name':_0x331c01['name'],'pause':![]})[_0xecf5('0x23')](function(){return db[_0xecf5('0xae')][_0xecf5('0x68')]({'paused':0x0},{'where':{'UserId':_0x331c01['id']}});})[_0xecf5('0x23')](function(){return db[_0xecf5('0xe7')][_0xecf5('0x61')]({'where':{'membername':_0x331c01[_0xecf5('0x45')],'type':_0xecf5('0xee'),'exitAt':null}});})[_0xecf5('0x23')](function(_0x4246d4){var _0x2aff7c=[];_0x4246d4[_0xecf5('0xeb')](function(_0x5287ce){_0x2aff7c[_0xecf5('0xe4')](_0x5287ce[_0xecf5('0x68')]({'exitAt':moment()[_0xecf5('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xecf5('0xfb')}));});return BPromise[_0xecf5('0xe9')](_0x2aff7c);})['then'](function(){return _0x331c01[_0xecf5('0x68')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xecf5('0x23')](respondWithResult(_0x5eaa2a,null))['catch'](handleError(_0x5eaa2a,null));};exports[_0xecf5('0x100')]=function(_0x5630a7,_0x510c95,_0x5180c9){var _0x4c25f1={};var _0x3db5cb={};var _0x4fba23;var _0x3dddb6;return db['User'][_0xecf5('0x9c')]({'where':{'id':_0x5630a7[_0xecf5('0x6b')]['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x510c95,null))['then'](function(_0x1097ee){if(_0x1097ee){_0x4fba23=_0x1097ee;_0x3db5cb[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0x101')][_0xecf5('0xc5')]);_0x3db5cb['query']=_['keys'](_0x5630a7[_0xecf5('0x4c')]);_0x3db5cb[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x3db5cb[_0xecf5('0x47')],_0x3db5cb[_0xecf5('0x4c')]);_0x4c25f1[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x3db5cb[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x5630a7[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x4c25f1[_0xecf5('0x4e')]=_0x4c25f1[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x4c25f1['attributes']:_0x3db5cb[_0xecf5('0x47')];_0x4c25f1[_0xecf5('0x53')]=qs['sort'](_0x5630a7[_0xecf5('0x4c')]['sort']);_0x4c25f1['where']=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x5630a7[_0xecf5('0x4c')],_0x3db5cb[_0xecf5('0x55')]));if(_0x5630a7[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x4c25f1['where']=_[_0xecf5('0x57')](_0x4c25f1[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x4c25f1[_0xecf5('0x4e')],function(_0x1a662f){var _0x10c889={};_0x10c889[_0x1a662f]={'$like':'%'+_0x5630a7[_0xecf5('0x4c')]['filter']+'%'};return _0x10c889;})});}_0x4c25f1=_[_0xecf5('0x57')]({},_0x4c25f1,_0x5630a7[_0xecf5('0x64')]);return _0x4fba23[_0xecf5('0x100')](_0x4c25f1);}})[_0xecf5('0x23')](function(_0x41b5bd){if(_0x41b5bd){_0x3dddb6=_0x41b5bd['length'];if(!_0x5630a7['query']['hasOwnProperty'](_0xecf5('0x52'))){_0x4c25f1[_0xecf5('0x31')]=qs[_0xecf5('0x31')](_0x5630a7[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x4c25f1['offset']=qs['offset'](_0x5630a7[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x4fba23[_0xecf5('0x100')](_0x4c25f1);}})[_0xecf5('0x23')](function(_0x158132){if(_0x158132){return _0x158132?{'count':_0x3dddb6,'rows':_0x158132}:null;}})[_0xecf5('0x23')](respondWithResult(_0x510c95,null))[_0xecf5('0x2c')](handleError(_0x510c95,null));};exports[_0xecf5('0x102')]=function(_0x59bc70,_0x3a402d,_0x102b36){return db['User'][_0xecf5('0x65')]({'where':{'id':_0x59bc70['params']['id']}})[_0xecf5('0x23')](handleEntityNotFound(_0x3a402d,null))['then'](function(_0x51e16e){if(_0x51e16e){return _0x51e16e['addTeams'](_0x59bc70['body'][_0xecf5('0x6c')],_[_0xecf5('0x6d')](_0x59bc70['body'],['ids','id'])||{});}})[_0xecf5('0x23')](respondWithResult(_0x3a402d,null))['catch'](handleError(_0x3a402d,null));};exports[_0xecf5('0x103')]=function(_0x5a0e0d,_0x37113b,_0xc219ad){return db[_0xecf5('0x5e')]['find']({'where':{'id':_0x5a0e0d[_0xecf5('0x6b')]['id']}})['then'](handleEntityNotFound(_0x37113b,null))[_0xecf5('0x23')](function(_0x269cdd){if(_0x269cdd){return _0x269cdd['removeTeams'](_0x5a0e0d['query'][_0xecf5('0x6c')]);}})['then'](respondWithStatusCode(_0x37113b,null))[_0xecf5('0x2c')](handleError(_0x37113b,null));};exports[_0xecf5('0x104')]=function(_0x221976,_0x366fb2,_0x2f6c9b){var _0x4c1f50={};var _0x2b32d6={};var _0x32f65c;var _0x36e053;return db[_0xecf5('0x5e')][_0xecf5('0x9c')]({'where':{'id':_0x221976[_0xecf5('0x6b')]['id']}})['then'](handleEntityNotFound(_0x366fb2,null))[_0xecf5('0x23')](function(_0x8fde52){if(_0x8fde52){_0x32f65c=_0x8fde52;_0x2b32d6['model']=_['keys'](db[_0xecf5('0xbf')][_0xecf5('0xc5')]);_0x2b32d6[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x221976[_0xecf5('0x4c')]);_0x2b32d6[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x2b32d6[_0xecf5('0x47')],_0x2b32d6[_0xecf5('0x4c')]);_0x4c1f50[_0xecf5('0x4e')]=_[_0xecf5('0x4d')](_0x2b32d6[_0xecf5('0x47')],qs[_0xecf5('0x4f')](_0x221976['query'][_0xecf5('0x4f')]));_0x4c1f50['attributes']=_0x4c1f50[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x4c1f50[_0xecf5('0x4e')]:_0x2b32d6['model'];_0x4c1f50[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x221976['query'][_0xecf5('0x54')]);_0x4c1f50[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x221976[_0xecf5('0x4c')],_0x2b32d6[_0xecf5('0x55')]));if(_0x221976[_0xecf5('0x4c')][_0xecf5('0xbe')]){_0x4c1f50[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x4c1f50[_0xecf5('0x58')],{'$or':_[_0xecf5('0x3e')](_0x4c1f50[_0xecf5('0x4e')],function(_0x205639){var _0x5cb520={};_0x5cb520[_0x205639]={'$like':'%'+_0x221976['query'][_0xecf5('0xbe')]+'%'};return _0x5cb520;})});}_0x4c1f50=_[_0xecf5('0x57')]({},_0x4c1f50,_0x221976[_0xecf5('0x64')]);return _0x32f65c[_0xecf5('0x104')](_0x4c1f50);}})[_0xecf5('0x23')](function(_0x5d612f){if(_0x5d612f){_0x36e053=_0x5d612f[_0xecf5('0x50')];if(!_0x221976['query'][_0xecf5('0x51')](_0xecf5('0x52'))){_0x4c1f50['limit']=qs[_0xecf5('0x31')](_0x221976[_0xecf5('0x4c')][_0xecf5('0x31')]);_0x4c1f50[_0xecf5('0x30')]=qs[_0xecf5('0x30')](_0x221976[_0xecf5('0x4c')][_0xecf5('0x30')]);}return _0x32f65c['getLists'](_0x4c1f50);}})[_0xecf5('0x23')](function(_0x3f3cea){if(_0x3f3cea){return _0x3f3cea?{'count':_0x36e053,'rows':_0x3f3cea}:null;}})['then'](respondWithResult(_0x366fb2,null))[_0xecf5('0x2c')](handleError(_0x366fb2,null));};exports[_0xecf5('0x105')]=function(_0x4f54ab,_0x4cf836,_0x1d53c9){var _0x5e7542={};var _0x10e156={};var _0x578023;var _0x574831;return db[_0xecf5('0x5e')][_0xecf5('0x9c')]({'where':{'id':_0x4f54ab['params']['id']}})['then'](handleEntityNotFound(_0x4cf836,null))[_0xecf5('0x23')](function(_0x4388ab){if(_0x4388ab){_0x578023=_0x4388ab;_0x10e156[_0xecf5('0x47')]=_[_0xecf5('0x49')](db[_0xecf5('0x5e')]['rawAttributes']);_0x10e156[_0xecf5('0x4c')]=_[_0xecf5('0x49')](_0x4f54ab['query']);_0x10e156[_0xecf5('0x55')]=_[_0xecf5('0x4d')](_0x10e156[_0xecf5('0x47')],_0x10e156[_0xecf5('0x4c')]);_0x5e7542[_0xecf5('0x4e')]=_['intersection'](_0x10e156[_0xecf5('0x47')],qs['fields'](_0x4f54ab[_0xecf5('0x4c')][_0xecf5('0x4f')]));_0x5e7542[_0xecf5('0x4e')]=_0x5e7542[_0xecf5('0x4e')][_0xecf5('0x50')]?_0x5e7542[_0xecf5('0x4e')]:_0x10e156['model'];_0x5e7542[_0xecf5('0x53')]=qs[_0xecf5('0x54')](_0x4f54ab[_0xecf5('0x4c')][_0xecf5('0x54')]);_0x5e7542[_0xecf5('0x58')]=qs[_0xecf5('0x55')](_[_0xecf5('0x56')](_0x4f54ab['query'],_0x10e156[_0xecf5('0x55')]));if(_0x4f54ab[_0xecf5('0x4c')]['filter']){_0x5e7542[_0xecf5('0x58')]=_[_0xecf5('0x57')](_0x5e7542['where'],{'$or':_[_0xecf5('0x3e')](_0x5e7542[_0xecf5('0x4e')],function(_0x483c15){var _0x5026ae={};_0x5026ae[_0x483c15]={'$like':'%'+_0x4f54ab[_0xecf5('0x4c')][_0xecf5('0xbe')]+'%'};return _0x5026ae;})});}_0x5e7542['model']=db[_0xecf5('0x5e')];_0x5e7542['as']=_0xecf5('0x8d');_0x5e7542=_[_0xecf5('0x57')]({},_0x5e7542,_0x4f54ab[_0xecf5('0x64')]);return _0x578023['getVoiceQueues']({'include':[_0x5e7542]});}})[_0xecf5('0x23')](function(_0x554ba9){if(_0x554ba9){var _0x3e7b0a={},_0x387510=[],_0x460688=0x0;for(var _0x424c91=0x0;_0x424c91<_0x554ba9['length'];_0x424c91+=0x1){for(var _0x1ad266=0x0,_0x4b1769;_0x1ad266<_0x554ba9[_0x424c91][_0xecf5('0x8d')][_0xecf5('0x50')];_0x1ad266+=0x1){_0x4b1769=_0x554ba9[_0x424c91][_0xecf5('0x8d')][_0x1ad266][_0xecf5('0x38')]({'plain':!![]});_0x3e7b0a[_0x4b1769['id']]=_0x4b1769;}}_0x3e7b0a=_[_0xecf5('0x106')](_0x3e7b0a);for(var _0x355bf6=qs[_0xecf5('0x30')](_0x4f54ab['query'][_0xecf5('0x30')]);_0x355bf6<_0x3e7b0a['length']&&_0x387510[_0xecf5('0x50')]=_0x4d317e){_0x52533b=_0x4d317e;_0x3f5102=0xc8;}else{_0x3f5102=0xce;}_0x2dfb78[_0x100c('0x26')](_0x3f5102);return _0x2dfb78['set'](_0x100c('0x2a'),_0x4fa6da+'-'+_0x52533b+'/'+_0x4d317e)[_0x100c('0x2b')](_0x437d88);}return null;};}function patchUpdates(_0x5f5b40){return function(_0x2f579d){try{jsonpatch['apply'](_0x2f579d,_0x5f5b40,!![]);}catch(_0xce69fb){return BPromise[_0x100c('0x2c')](_0xce69fb);}return _0x2f579d['save']();};}function saveUpdates(_0x2cb211,_0x53dde4){return function(_0x7b5487){if(_0x7b5487){return _0x7b5487[_0x100c('0x2d')](_0x2cb211)[_0x100c('0x1b')](function(_0x19321d){return _0x19321d;});}return null;};}function removeEntity(_0x566922,_0x40808c){return function(_0x165ab3){if(_0x165ab3){return _0x165ab3[_0x100c('0x2e')]()[_0x100c('0x1b')](function(){var _0x312b74=_0x165ab3['get']({'plain':!![]});var _0x12416e=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x100c('0x2f'),'value':_0x100c('0x30'),'ignore':![]},{'name':_0x100c('0x31'),'value':_0x100c('0x32'),'ignore':![]}];var _0x1c106e=_(_0x12416e)[_0x100c('0x33')](_0x100c('0x34'))[_0x100c('0x35')](_0x100c('0x36'))['value']();if(_['includes'](_0x1c106e,_0x312b74['role'])){return;}var _0x3c509c=_['find'](_0x12416e,[_0x100c('0x36'),_0x312b74['role']])[_0x100c('0x37')];return db[_0x100c('0x38')][_0x100c('0x2e')]({'where':{'type':_0x3c509c,'resourceId':_0x312b74['id']}})['then'](function(){return _0x165ab3;});})[_0x100c('0x1b')](function(){_0x566922['status'](0xcc)[_0x100c('0x25')]();});}};}function handleEntityNotFound(_0x51ab00,_0xb1f2c7){return function(_0x16c4e9){if(!_0x16c4e9){_0x51ab00[_0x100c('0x24')](0x194);}return _0x16c4e9;};}function handleError(_0x3774c0,_0x479a01){_0x479a01=_0x479a01||0x1f4;return function(_0xf9e64a){logger[_0x100c('0x20')](_0xf9e64a['stack']);if(_0xf9e64a['name']){delete _0xf9e64a[_0x100c('0x37')];}_0x3774c0['status'](_0x479a01)['send'](_0xf9e64a);};}exports['index']=function(_0x4a3f43,_0x26926d){var _0x940457={},_0x2a9a12={},_0x98f649={'count':0x0,'rows':[]};var _0x151ac8=db[_0x100c('0x39')]['rawAttributes'];_0x2a9a12[_0x100c('0x3a')]=_[_0x100c('0x3b')](_[_0x100c('0x3c')](_0x151ac8),['password',_0x100c('0x3d')]);_0x2a9a12['query']=_[_0x100c('0x3c')](_0x4a3f43[_0x100c('0x3e')]);_0x2a9a12[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x2a9a12[_0x100c('0x3a')],_0x2a9a12[_0x100c('0x3e')]);_0x940457['attributes']=_[_0x100c('0x40')](_0x2a9a12[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x4a3f43[_0x100c('0x3e')][_0x100c('0x41')]));_0x940457[_0x100c('0x42')]=_0x940457['attributes'][_0x100c('0x43')]?_0x940457['attributes']:_0x2a9a12['model'];if(!_0x4a3f43[_0x100c('0x3e')]['hasOwnProperty'](_0x100c('0x44'))){_0x940457[_0x100c('0x29')]=qs[_0x100c('0x29')](_0x4a3f43[_0x100c('0x3e')][_0x100c('0x29')]);_0x940457[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x4a3f43[_0x100c('0x3e')][_0x100c('0x28')]);}_0x940457[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x4a3f43[_0x100c('0x3e')][_0x100c('0x46')]);_0x940457[_0x100c('0x47')]=qs[_0x100c('0x3f')](_[_0x100c('0x48')](_0x4a3f43['query'],_0x2a9a12[_0x100c('0x3f')]));if(_0x4a3f43[_0x100c('0x3e')][_0x100c('0x33')]){_0x940457[_0x100c('0x47')]=_[_0x100c('0x49')](_0x940457['where'],{'$or':_[_0x100c('0x35')](_0x151ac8,function(_0x1f8739){if(_0x1f8739['type'][_0x100c('0x4a')]!==_0x100c('0x4b')){return db[_0x100c('0x4c')][_0x100c('0x47')](db['sequelize']['fn'](_0x100c('0x4d'),db['sequelize']['col'](_0x1f8739[_0x100c('0x4e')])),{'$like':db[_0x100c('0x4c')]['fn'](_0x100c('0x4d'),'%'+_0x4a3f43[_0x100c('0x3e')]['filter']+'%')});}})});}_0x940457=_[_0x100c('0x49')]({},_0x940457,_0x4a3f43[_0x100c('0x4f')]);var _0x2874ae={'where':_0x940457[_0x100c('0x47')]};return db['User'][_0x100c('0x27')](_0x2874ae)[_0x100c('0x1b')](function(_0x3c9e88){_0x98f649[_0x100c('0x27')]=_0x3c9e88;if(_0x4a3f43['query']['includeAll']){_0x940457[_0x100c('0x50')]=[{'all':!![]}];}return db[_0x100c('0x39')]['findAll'](_0x940457);})['then'](function(_0x34dc06){_0x98f649['rows']=_0x34dc06;return _0x98f649;})[_0x100c('0x1b')](respondWithFilteredResult(_0x26926d,_0x940457))['catch'](handleError(_0x26926d,null));};exports[_0x100c('0x51')]=function(_0x2c34ea,_0x2f2939){var _0x11817f={'raw':![],'where':{'id':_0x2c34ea['params']['id']}},_0x370d50={};_0x370d50[_0x100c('0x3a')]=_['differenceBy'](_[_0x100c('0x3c')](db[_0x100c('0x39')][_0x100c('0x52')]),[_0x100c('0x53'),_0x100c('0x3d')]);_0x370d50[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x2c34ea['query']);_0x370d50[_0x100c('0x3f')]=_['intersection'](_0x370d50[_0x100c('0x3a')],_0x370d50['query']);_0x11817f[_0x100c('0x42')]=_['intersection'](_0x370d50[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x2c34ea[_0x100c('0x3e')][_0x100c('0x41')]));_0x11817f[_0x100c('0x42')]=_0x11817f[_0x100c('0x42')][_0x100c('0x43')]?_0x11817f[_0x100c('0x42')]:_0x370d50['model'];if(_0x2c34ea[_0x100c('0x3e')][_0x100c('0x54')]){_0x11817f[_0x100c('0x50')]=[{'all':!![]}];}_0x11817f=_['merge']({},_0x11817f,_0x2c34ea[_0x100c('0x4f')]);return db[_0x100c('0x39')][_0x100c('0x55')](_0x11817f)[_0x100c('0x1b')](handleEntityNotFound(_0x2f2939,null))[_0x100c('0x1b')](respondWithResult(_0x2f2939,null))[_0x100c('0x23')](handleError(_0x2f2939,null));};exports[_0x100c('0x56')]=function(_0x5b9dc5,_0x2bc802){return db[_0x100c('0x39')]['bulkCreate'](_0x5b9dc5[_0x100c('0x57')],{'raw':![],'individualHooks':!![]})[_0x100c('0x1b')](respondWithResult(_0x2bc802,0xc9))['catch'](handleError(_0x2bc802,null));};exports[_0x100c('0x2d')]=function(_0x57f8f2,_0x3d450a){if(_0x57f8f2['body']['id']){delete _0x57f8f2[_0x100c('0x57')]['id'];}delete _0x57f8f2[_0x100c('0x57')][_0x100c('0x58')];return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x57f8f2[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x3d450a,null))[_0x100c('0x1b')](saveUpdates(_0x57f8f2[_0x100c('0x57')],null))['then'](respondWithResult(_0x3d450a,null))[_0x100c('0x23')](handleError(_0x3d450a,null));};exports[_0x100c('0x5a')]=function(_0x5a97f7,_0x2819c3){return db[_0x100c('0x39')][_0x100c('0x5a')]()[_0x100c('0x1b')](respondWithResult(_0x2819c3,null))[_0x100c('0x23')](handleError(_0x2819c3,null));};exports[_0x100c('0x5b')]=function(_0x52c226,_0x17edf9,_0x3fd2a6){return db['User']['find']({'where':{'id':_0x52c226[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x17edf9,null))[_0x100c('0x1b')](function(_0x132243){if(_0x132243){return _0x132243[_0x100c('0x5b')](_0x52c226[_0x100c('0x57')][_0x100c('0x5c')],_[_0x100c('0x5d')](_0x52c226[_0x100c('0x57')],[_0x100c('0x5c'),'id'])||{});}})[_0x100c('0x1b')](respondWithResult(_0x17edf9,null))[_0x100c('0x23')](handleError(_0x17edf9,null));};var getLicense=function(_0x147b9e){return new BPromise(function(_0x4abc66,_0x5c00cc){var _0x3d53c7=0x0;_0x147b9e[_0x100c('0x57')][_0x100c('0x58')]===_0x100c('0x30')&&_0x4abc66(_0x100c('0x5e'));return db[_0x100c('0x39')][_0x100c('0x27')]({'where':{'$or':[{'role':_0x147b9e[_0x100c('0x57')][_0x100c('0x58')]===_0x100c('0x32')?_0x100c('0x32'):['admin',_0x100c('0x5f')]}]}})[_0x100c('0x1b')](function(_0xa80240){_0x3d53c7=_0xa80240;return require(_0x100c('0x60'))['getLicense']();})[_0x100c('0x1b')](function(_0x211c03){var _0x599935=_0x147b9e[_0x100c('0x57')][_0x100c('0x58')]===_0x100c('0x32')?'telephones':_0x100c('0x61');if(!_[_0x100c('0x62')](_0x211c03[_0x599935])&&_0x3d53c7>=_0x211c03[_0x599935]){return _0x5c00cc({'message':'License\x20limit\x20reached'});}return _0x4abc66(util[_0x100c('0x63')](_0x100c('0x64'),_0x599935,_0x3d53c7));})[_0x100c('0x23')](function(_0x170919){return _0x5c00cc(_0x170919);});});};exports[_0x100c('0x65')]=function(_0x499df2,_0x3e5b69){return getLicense(_0x499df2)['then'](function(_0xd94509){if(!_0x499df2[_0x100c('0x57')][_0x100c('0x66')]){var _0x5afcef;return db['Setting']['findById'](0x1)[_0x100c('0x1b')](function(_0x544a9e){_0x544a9e[_0x100c('0x67')]=!![];return checkPasswordPattern(_0x544a9e,_0x499df2['body'][_0x100c('0x53')],_0x544a9e[_0x100c('0x67')]);})[_0x100c('0x1b')](function(_0x37a31d){_0x5afcef=_0x37a31d[_0x100c('0x68')];return db['User'][_0x100c('0x69')]('internal');})[_0x100c('0x1b')](function(_0x2f4865){if(_[_0x100c('0x62')](_0x2f4865)){if(_0x5afcef){_0x499df2[_0x100c('0x57')][_0x100c('0x66')]=_0x5afcef;}else{_0x499df2[_0x100c('0x57')]['internal']=0x1;}}else{if(_['isNil'](_0x5afcef)||_0x5afcef==_0x2f4865){_0x499df2[_0x100c('0x57')][_0x100c('0x66')]=_0x2f4865+0x1;}else if(_0x5afcef>_0x2f4865){_0x499df2[_0x100c('0x57')]['internal']=_0x5afcef;}else{return db['sequelize'][_0x100c('0x3e')](_0x100c('0x6a'),{'type':db[_0x100c('0x4c')]['QueryTypes'][_0x100c('0x6b')]})['then'](function(_0x247392){if(_0x247392&&_0x247392[_0x100c('0x43')]){for(var _0x17c436=0x0,_0x2664f2=_0x247392[_0x100c('0x43')];_0x17c436<_0x2664f2&&_[_0x100c('0x62')](_0x499df2[_0x100c('0x57')][_0x100c('0x66')]);_0x17c436++){if(_0x5afcef<=_0x247392[_0x17c436][_0x100c('0x6c')]){_0x499df2[_0x100c('0x57')]['internal']=_0x247392[_0x17c436][_0x100c('0x6c')];}else if(_0x5afcef>_0x247392[_0x17c436][_0x100c('0x6c')]&&_0x5afcef<=_0x247392[_0x17c436]['to']){_0x499df2['body'][_0x100c('0x66')]=_0x5afcef;}}}if(_[_0x100c('0x62')](_0x499df2[_0x100c('0x57')]['internal'])){_0x499df2['body'][_0x100c('0x66')]=_0x2f4865+0x1;}});}}});}})[_0x100c('0x1b')](function(){if(_0x499df2[_0x100c('0x57')][_0x100c('0x6d')]){_0x499df2[_0x100c('0x57')]['mailbox']=_0x499df2['body'][_0x100c('0x66')];_0x499df2[_0x100c('0x57')]['VoiceMail']={'mailbox':_0x499df2[_0x100c('0x57')][_0x100c('0x66')],'password':_0x499df2['body'][_0x100c('0x53')],'fullname':_0x499df2[_0x100c('0x57')]['fullname'],'email':_0x499df2[_0x100c('0x57')][_0x100c('0x6e')]};}if(_0x499df2[_0x100c('0x57')]&&_0x499df2[_0x100c('0x57')][_0x100c('0x58')]===_0x100c('0x30')){_0x499df2[_0x100c('0x57')][_0x100c('0x6f')]=['101','102',_0x100c('0x70'),'110',_0x100c('0x71'),_0x100c('0x72'),_0x100c('0x73'),_0x100c('0x74'),_0x100c('0x75'),_0x100c('0x76'),_0x100c('0x77'),'111'];}return db[_0x100c('0x39')][_0x100c('0x65')](_0x499df2[_0x100c('0x57')],{'include':[{'model':db[_0x100c('0x78')],'as':_0x100c('0x78')}]});})[_0x100c('0x1b')](function(_0x43c1ca){if(_0x499df2['body']['role']===_0x100c('0x5f'))return _0x43c1ca;var _0x4813d7=_0x499df2[_0x100c('0x5f')][_0x100c('0x79')]({'plain':!![]});if(!_0x4813d7)throw new Error(_0x100c('0x7a'));if(_0x4813d7['role']===_0x100c('0x5f')){var _0x180aec=_0x43c1ca[_0x100c('0x79')]({'plain':!![]});var _0x1cc1aa=[{'name':_0x100c('0x2f'),'value':_0x100c('0x30')},{'name':'Telephones','value':_0x100c('0x32')}];var _0x150032=_['find'](_0x1cc1aa,[_0x100c('0x36'),_0x180aec[_0x100c('0x58')]])[_0x100c('0x37')];return db[_0x100c('0x7b')][_0x100c('0x55')]({'where':{'name':_0x150032,'userProfileId':_0x4813d7[_0x100c('0x7c')]},'raw':!![]})[_0x100c('0x1b')](function(_0x52604e){if(_0x52604e&&_0x52604e[_0x100c('0x7d')]===0x0){return db[_0x100c('0x38')]['create']({'name':_0x180aec[_0x100c('0x37')],'resourceId':_0x180aec['id'],'type':_0x52604e[_0x100c('0x37')],'sectionId':_0x52604e['id']},{})[_0x100c('0x1b')](function(){return _0x43c1ca;});}else{return _0x43c1ca;}})[_0x100c('0x23')](function(_0x287856){logger[_0x100c('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x287856);throw _0x287856;});}return _0x43c1ca;})['then'](respondWithResult(_0x3e5b69,0xc9))[_0x100c('0x23')](handleError(_0x3e5b69,null));};exports['changePassword']=function(_0x2da240,_0x511f8e,_0x2890c7){var _0x2e7b10=![];if(_0x2da240[_0x100c('0x57')]['id']){delete _0x2da240['body']['id'];}if(!_['isNil'](_0x2da240[_0x100c('0x57')]['oldPassword'])){if(_0x2da240[_0x100c('0x57')][_0x100c('0x7e')]===_0x2da240[_0x100c('0x57')][_0x100c('0x7f')]){throw new Error(_0x100c('0x80'));}}return db[_0x100c('0x39')]['find']({'where':{'id':_0x2da240[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](function(_0x28531c){if(_0x28531c){if(_0x28531c['id']==_0x2da240['user']['id']){if(!_0x2da240[_0x100c('0x57')][_0x100c('0x7e')]||!_0x2da240[_0x100c('0x57')][_0x100c('0x7f')]){throw new db[(_0x100c('0x81'))]['ValidationError'](_0x100c('0x82'));}if(!_0x28531c['authenticate'](_0x2da240[_0x100c('0x57')][_0x100c('0x7e')])){throw new db[(_0x100c('0x81'))][(_0x100c('0x83'))](_0x100c('0x84'));}if(_0x2da240[_0x100c('0x57')][_0x100c('0x7e')]==_0x2da240[_0x100c('0x57')]['newPassword']){throw new db[(_0x100c('0x81'))][(_0x100c('0x83'))](_0x100c('0x85'));}return _0x28531c;}else if(_0x2da240[_0x100c('0x5f')]['role']==_0x100c('0x86')){if(!_0x2da240[_0x100c('0x57')][_0x100c('0x7f')]){throw new db['Sequelize'][(_0x100c('0x83'))](_0x100c('0x87'));}return _0x28531c;}else if(_0x2da240[_0x100c('0x5f')]['role']==_0x100c('0x5f')){if(!_0x2da240[_0x100c('0x57')][_0x100c('0x7f')]){throw new db[(_0x100c('0x81'))][(_0x100c('0x83'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x28531c['role']!=_0x100c('0x30')){throw new db['Sequelize'][(_0x100c('0x83'))]('Unauthorized');}return _0x28531c;}else{throw new db['Sequelize'][(_0x100c('0x83'))](_0x100c('0x88'));}}return null;})[_0x100c('0x1b')](handleEntityNotFound(_0x511f8e,null))['then'](function(_0x466b7a){return db[_0x100c('0x89')][_0x100c('0x8a')]({'attributes':['id',_0x100c('0x67')]})[_0x100c('0x1b')](function(_0x227fb8){_0x2e7b10=_0x227fb8[_0x100c('0x67')];return checkPasswordPattern(_0x466b7a,_0x2da240[_0x100c('0x57')][_0x100c('0x7f')],_0x2e7b10);});})['then'](saveUpdates({'password':_0x2da240[_0x100c('0x57')][_0x100c('0x7f')],'passwordResetAt':_0x2da240[_0x100c('0x5f')]['id']==_0x2da240[_0x100c('0x59')]['id']?moment():null},null))[_0x100c('0x1b')](respondWithResult(_0x511f8e,null))['catch'](handleError(_0x511f8e,null));};exports[_0x100c('0x8b')]=function(_0x1d202d,_0x39415b,_0x28027d){var _0xaae08e=_0x1d202d[_0x100c('0x57')]['channel'];return db[_0x100c('0x39')]['find']({'where':{'id':_0x1d202d[_0x100c('0x59')]['id']},'attributes':['id','name',_0x100c('0x58'),_0x100c('0x8c'),_0x100c('0x8d'),'voicePause',_0x100c('0x8e')]})[_0x100c('0x1b')](handleEntityNotFound(_0x39415b,null))[_0x100c('0x1b')](function(_0x1f8b63){if(_0x1f8b63){if(!utils[_0x100c('0x8f')](_0xaae08e)){throw new db[(_0x100c('0x81'))][(_0x100c('0x83'))](_0x100c('0x90'));}return _0x1f8b63['add'+_[_0x100c('0x91')](_0xaae08e['toLowerCase']())+_0x100c('0x92')](_0x1d202d['body']['ids'],{'penalty':_0x1d202d[_0x100c('0x57')][_0x100c('0x93')]||0x0})[_0x100c('0x94')](function(_0x385e56){for(var _0xd51b5=0x0;_0xd51b5<_0x1d202d[_0x100c('0x57')][_0x100c('0x5c')]['length'];_0xd51b5+=0x1){var _0x298c29={'UserId':_0x1d202d['params']['id']};_0x298c29[_[_0x100c('0x91')](_0xaae08e[_0x100c('0x95')]())+_0x100c('0x96')]=_0x1d202d[_0x100c('0x57')][_0x100c('0x5c')][_0xd51b5];socket[_0x100c('0x97')](_0x100c('0x5f')+_[_0x100c('0x91')](_0xaae08e[_0x100c('0x95')]())+_0x100c('0x98'),_0x298c29);}return _0x385e56;})[_0x100c('0x1b')](function(){if(_0xaae08e==='voice'){return db['VoiceQueue'][_0x100c('0x99')]({'where':{'id':_0x1d202d[_0x100c('0x57')][_0x100c('0x5c')]||[]},'raw':!![],'attributes':['id',_0x100c('0x37')]});}})[_0x100c('0x1b')](function(_0x4f6972){var _0x4eefca=_0x1f8b63['get']({'plain':!![]});var _0x1f44ee=[];if(_0xaae08e==='voice'&&_0x4eefca[_0x100c('0x58')]===_0x100c('0x30')&&_0x4eefca[_0x100c('0x8c')]){for(var _0x489649=0x0;_0x489649<_0x4f6972[_0x100c('0x43')];_0x489649+=0x1){_0x1f44ee['push']({'membername':_0x4eefca[_0x100c('0x37')],'UserId':_0x4eefca['id'],'queue_name':_0x4f6972[_0x489649][_0x100c('0x37')],'VoiceQueueId':_0x4f6972[_0x489649]['id'],'interface':_[_0x100c('0x62')](_0x4eefca['interface'])?util[_0x100c('0x63')](_0x100c('0x9a'),_0x4eefca[_0x100c('0x37')]):_0x4eefca[_0x100c('0x8e')],'paused':_0x4eefca[_0x100c('0x9b')]||![],'penalty':_0x1d202d[_0x100c('0x57')][_0x100c('0x93')]||0x0});}return BPromise[_0x100c('0x9c')](_0x1f44ee,function(_0x202ef0){return db[_0x100c('0x9d')]['upsert'](_0x202ef0);});}return _0x1f8b63;});}})[_0x100c('0x1b')](respondWithStatusCode(_0x39415b,null))[_0x100c('0x23')](handleError(_0x39415b,null));};exports[_0x100c('0x9e')]=function(_0x5ce450,_0x2a48f3,_0x179cb1){var _0x31a95d;return db[_0x100c('0x39')]['find']({'where':{'id':_0x5ce450['params']['id']},'attributes':['id','name',_0x100c('0x58')]})[_0x100c('0x1b')](handleEntityNotFound(_0x2a48f3,null))[_0x100c('0x1b')](function(_0x35fd08){if(_0x35fd08){_0x31a95d=_0x35fd08;if(!_0x5ce450[_0x100c('0x3e')][_0x100c('0x9f')]||!utils[_0x100c('0x8f')](_0x5ce450[_0x100c('0x3e')][_0x100c('0x9f')])){throw new db['Sequelize']['ValidationError'](_0x100c('0x90'));}return _0x35fd08[_0x100c('0xa0')+_[_0x100c('0x91')](_0x5ce450['query'][_0x100c('0x9f')][_0x100c('0x95')]())+_0x100c('0x92')](_0x5ce450[_0x100c('0x3e')]['ids']);}})[_0x100c('0x1b')](function(_0x1151fb){for(var _0x4b99d0=0x0;_0x4b99d0<_0x5ce450[_0x100c('0x3e')][_0x100c('0x5c')][_0x100c('0x43')];_0x4b99d0+=0x1){var _0x5774fc={'UserId':_0x5ce450['params']['id']};_0x5774fc[_[_0x100c('0x91')](_0x5ce450['query']['channel'][_0x100c('0x95')]())+_0x100c('0x96')]=_0x5ce450[_0x100c('0x3e')]['ids'][_0x4b99d0];socket[_0x100c('0x97')]('user'+_[_0x100c('0x91')](_0x5ce450[_0x100c('0x3e')][_0x100c('0x9f')]['toLowerCase']())+_0x100c('0xa1'),_0x5774fc);}return _0x1151fb;})[_0x100c('0x1b')](function(){if(_0x5ce450[_0x100c('0x3e')][_0x100c('0x9f')]===_0x100c('0xa2')){return db[_0x100c('0x9d')][_0x100c('0x2e')]({'where':{'UserId':_0x5ce450[_0x100c('0x59')]['id'],'VoiceQueueId':_0x5ce450[_0x100c('0x3e')][_0x100c('0x5c')]},'individualHooks':!![]})[_0x100c('0x1b')](function(){return _0x31a95d;});}return _0x31a95d;})[_0x100c('0x1b')](respondWithStatusCode(_0x2a48f3,null))['catch'](handleError(_0x2a48f3,null));};exports[_0x100c('0xa3')]=function(_0x154ced,_0x3b3659,_0x2694b2){_0x154ced['body']['userpic']=_0x154ced[_0x100c('0xa4')]['filename'];return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x154ced['params']['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x3b3659,null))[_0x100c('0x1b')](saveUpdates(_0x154ced[_0x100c('0x57')],null))[_0x100c('0x1b')](respondWithResult(_0x3b3659,null))[_0x100c('0x23')](handleError(_0x3b3659,null));};exports[_0x100c('0xa5')]=function(_0x4a45de,_0x25d207,_0x28e83d){var _0x3a94e3=path[_0x100c('0xa6')](config[_0x100c('0xa7')],_0x100c('0xa8'));return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x4a45de[_0x100c('0x59')]['id']},'attributes':['id',_0x100c('0xa9')],'raw':!![]})['then'](handleEntityNotFound(_0x25d207,null))[_0x100c('0x1b')](function(_0x32b4bd){if(_0x32b4bd){if(_[_0x100c('0x62')](_0x32b4bd[_0x100c('0xa9')])){return _0x25d207[_0x100c('0xaa')](_0x3a94e3);}else{if(!fs[_0x100c('0xab')](path['join'](config[_0x100c('0xa7')],_0x100c('0xac'),_0x32b4bd['userpic']))){return _0x25d207[_0x100c('0xaa')](_0x3a94e3);}return _0x25d207[_0x100c('0xaa')](path[_0x100c('0xa6')](config[_0x100c('0xa7')],_0x100c('0xac'),_0x32b4bd[_0x100c('0xa9')]));}}})['catch'](handleError(_0x25d207,null));};exports[_0x100c('0xad')]=function(_0x45e799,_0x5c15ab,_0x19b4f5){var _0x1d4dd9={};var _0x31b96f={};var _0x3fd4c3;var _0x12a422;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x45e799['params']['id']}})['then'](handleEntityNotFound(_0x5c15ab,null))['then'](function(_0x2e45e2){if(_0x2e45e2){_0x3fd4c3=_0x2e45e2;_0x31b96f[_0x100c('0x3a')]=_[_0x100c('0x3c')](db[_0x100c('0xae')][_0x100c('0x52')]);_0x31b96f['query']=_[_0x100c('0x3c')](_0x45e799[_0x100c('0x3e')]);_0x31b96f[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x31b96f['model'],_0x31b96f['query']);_0x1d4dd9[_0x100c('0x42')]=_[_0x100c('0x40')](_0x31b96f['model'],qs[_0x100c('0x41')](_0x45e799[_0x100c('0x3e')]['fields']));_0x1d4dd9[_0x100c('0x42')]=_0x1d4dd9[_0x100c('0x42')][_0x100c('0x43')]?_0x1d4dd9[_0x100c('0x42')]:_0x31b96f[_0x100c('0x3a')];_0x1d4dd9[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x45e799[_0x100c('0x3e')][_0x100c('0x46')]);_0x1d4dd9[_0x100c('0x47')]=qs[_0x100c('0x3f')](_['pick'](_0x45e799[_0x100c('0x3e')],_0x31b96f['filters']));if(_0x45e799[_0x100c('0x3e')][_0x100c('0x33')]){_0x1d4dd9[_0x100c('0x47')]=_[_0x100c('0x49')](_0x1d4dd9[_0x100c('0x47')],{'$or':_['map'](_0x1d4dd9[_0x100c('0x42')],function(_0x414839){var _0xdd9b4f={};_0xdd9b4f[_0x414839]={'$like':'%'+_0x45e799[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0xdd9b4f;})});}_0x1d4dd9=_[_0x100c('0x49')]({},_0x1d4dd9,_0x45e799[_0x100c('0x4f')]);return _0x3fd4c3['getContacts'](_0x1d4dd9);}})['then'](function(_0x47eb26){if(_0x47eb26){_0x12a422=_0x47eb26[_0x100c('0x43')];if(_0x45e799['query'][_0x100c('0xaf')]('includeAll')){_0x1d4dd9[_0x100c('0x50')]=[{'model':db[_0x100c('0xb0')],'as':_0x100c('0xb1'),'required':![]},{'model':db['Tag'],'as':_0x100c('0xb2'),'attributes':['id',_0x100c('0x37'),_0x100c('0xb3')],'where':_0x45e799[_0x100c('0x3e')][_0x100c('0xb4')]?{'id':_0x45e799[_0x100c('0x3e')]['tag']}:undefined,'required':_0x45e799[_0x100c('0x3e')][_0x100c('0xb4')]?!![]:![]}];}if(!_0x45e799[_0x100c('0x3e')][_0x100c('0xaf')](_0x100c('0x44'))){_0x1d4dd9[_0x100c('0x29')]=qs['limit'](_0x45e799[_0x100c('0x3e')][_0x100c('0x29')]);_0x1d4dd9[_0x100c('0x28')]=qs['offset'](_0x45e799[_0x100c('0x3e')][_0x100c('0x28')]);}return _0x3fd4c3[_0x100c('0xad')](_0x1d4dd9);}})[_0x100c('0x1b')](function(_0x3c20f4){if(_0x3c20f4){return _0x3c20f4?{'count':_0x12a422,'rows':_0x3c20f4}:null;}})[_0x100c('0x1b')](respondWithResult(_0x5c15ab,null))['catch'](handleError(_0x5c15ab,null));};exports[_0x100c('0xb5')]=function(_0x3554ef,_0xa17a2d,_0x5c3fff){var _0x7e6876;var _0xcd6c19;var _0x1cd544={};var _0x5cb58f;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x3554ef[_0x100c('0x59')]['id']},'attributes':['id',_0x100c('0x37'),_0x100c('0x58')]})[_0x100c('0x1b')](handleEntityNotFound(_0xa17a2d,null))['then'](function(_0x4566f5){if(!utils[_0x100c('0x8f')](_0x3554ef[_0x100c('0x3e')]['channel'])){throw new db[(_0x100c('0x81'))][(_0x100c('0x83'))](_0x100c('0x90'));}_0x7e6876=_0x4566f5;var _0x3f04ba={};_0x3f04ba['model']=_[_0x100c('0x3c')](db[_['capitalize'](_0x3554ef[_0x100c('0x3e')]['channel'])+_0x100c('0xb6')]['rawAttributes']);_0x3f04ba[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x3554ef[_0x100c('0x3e')]);_0x3f04ba['filters']=_[_0x100c('0x40')](_0x3f04ba[_0x100c('0x3a')],_0x3f04ba[_0x100c('0x3e')]);_0x1cd544[_0x100c('0x42')]=_['intersection'](_0x3f04ba[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x3554ef[_0x100c('0x3e')][_0x100c('0x41')]));_0x1cd544[_0x100c('0x42')]=_0x1cd544[_0x100c('0x42')][_0x100c('0x43')]?_0x1cd544[_0x100c('0x42')]:_0x3f04ba[_0x100c('0x3a')];_0x1cd544[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x3554ef[_0x100c('0x3e')]['sort']);_0x1cd544[_0x100c('0x47')]=qs[_0x100c('0x3f')](_[_0x100c('0x48')](_0x3554ef[_0x100c('0x3e')],_0x3f04ba['filters']));if(_0x3554ef['query'][_0x100c('0x33')]){_0x1cd544[_0x100c('0x47')]=_[_0x100c('0x49')](_0x1cd544['where'],{'$or':_[_0x100c('0x35')](_0x1cd544[_0x100c('0x42')],function(_0x25c321){var _0x4b1641={};_0x4b1641[_0x25c321]={'$like':'%'+_0x3554ef['query'][_0x100c('0x33')]+'%'};return _0x4b1641;})});}_0x1cd544=_[_0x100c('0x49')]({},_0x1cd544,_0x3554ef[_0x100c('0x4f')]);switch(_0x7e6876[_0x100c('0x58')]){case'admin':return db[_[_0x100c('0x91')](_0x3554ef[_0x100c('0x3e')][_0x100c('0x9f')])+_0x100c('0xb6')]['findAll'](_0x1cd544);case _0x100c('0x5f'):case _0x100c('0x30'):return _0x7e6876['get'+_['capitalize'](_0x3554ef[_0x100c('0x3e')][_0x100c('0x9f')])+'Queues'](_0x1cd544);default:throw new db['Sequelize']['ValidationError'](_0x100c('0xb7'));}})[_0x100c('0x1b')](function(_0xa50626){_0x5cb58f=_0xa50626['length'];if(!_0x3554ef['query']['hasOwnProperty'](_0x100c('0x44'))){_0x1cd544[_0x100c('0x29')]=qs['limit'](_0x3554ef[_0x100c('0x3e')][_0x100c('0x29')]);_0x1cd544[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x3554ef[_0x100c('0x3e')][_0x100c('0x28')]);}switch(_0x7e6876['role']){case _0x100c('0x86'):return db[_[_0x100c('0x91')](_0x3554ef[_0x100c('0x3e')][_0x100c('0x9f')])+_0x100c('0xb6')]['findAll'](_0x1cd544);case'user':case _0x100c('0x30'):return _0x7e6876[_0x100c('0x79')+_[_0x100c('0x91')](_0x3554ef['query'][_0x100c('0x9f')])+'Queues'](_0x1cd544);}})[_0x100c('0x1b')](function(_0x3f0611){return{'count':_0x5cb58f,'rows':_0x3f0611};})[_0x100c('0x1b')](respondWithResult(_0xa17a2d,null))[_0x100c('0x23')](handleError(_0xa17a2d,null));};exports[_0x100c('0xb8')]=function(_0x1bc5b4,_0xcf06cd,_0x49d9fd){var _0x738d7f={};var _0x5d93d8={};var _0x57a8bf;var _0x48060c;return db['User'][_0x100c('0x8a')]({'where':{'id':_0x1bc5b4['params']['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0xcf06cd,null))[_0x100c('0x1b')](function(_0x58877a){if(_0x58877a){_0x57a8bf=_0x58877a;_0x5d93d8[_0x100c('0x3a')]=_['keys'](db[_0x100c('0x9d')]['rawAttributes']);_0x5d93d8[_0x100c('0x3e')]=_['keys'](_0x1bc5b4[_0x100c('0x3e')]);_0x5d93d8[_0x100c('0x3f')]=_['intersection'](_0x5d93d8[_0x100c('0x3a')],_0x5d93d8['query']);_0x738d7f[_0x100c('0x42')]=_[_0x100c('0x40')](_0x5d93d8[_0x100c('0x3a')],qs['fields'](_0x1bc5b4[_0x100c('0x3e')][_0x100c('0x41')]));_0x738d7f[_0x100c('0x42')]=_0x738d7f['attributes'][_0x100c('0x43')]?_0x738d7f[_0x100c('0x42')]:_0x5d93d8[_0x100c('0x3a')];_0x738d7f[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x1bc5b4[_0x100c('0x3e')]['sort']);_0x738d7f['where']=qs['filters'](_[_0x100c('0x48')](_0x1bc5b4[_0x100c('0x3e')],_0x5d93d8['filters']));if(_0x1bc5b4[_0x100c('0x3e')]['filter']){_0x738d7f[_0x100c('0x47')]=_[_0x100c('0x49')](_0x738d7f[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x738d7f[_0x100c('0x42')],function(_0x1ec969){var _0x1c2117={};_0x1c2117[_0x1ec969]={'$like':'%'+_0x1bc5b4['query'][_0x100c('0x33')]+'%'};return _0x1c2117;})});}_0x738d7f=_['merge']({},_0x738d7f,_0x1bc5b4[_0x100c('0x4f')]);return _0x57a8bf[_0x100c('0xb8')](_0x738d7f);}})[_0x100c('0x1b')](function(_0x200901){if(_0x200901){_0x48060c=_0x200901[_0x100c('0x43')];if(!_0x1bc5b4[_0x100c('0x3e')]['hasOwnProperty'](_0x100c('0x44'))){_0x738d7f[_0x100c('0x29')]=qs[_0x100c('0x29')](_0x1bc5b4[_0x100c('0x3e')]['limit']);_0x738d7f[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x1bc5b4[_0x100c('0x3e')][_0x100c('0x28')]);}return _0x57a8bf[_0x100c('0xb8')](_0x738d7f);}})[_0x100c('0x1b')](function(_0x487350){if(_0x487350){return _0x487350?{'count':_0x48060c,'rows':_0x487350}:null;}})[_0x100c('0x1b')](respondWithResult(_0xcf06cd,null))['catch'](handleError(_0xcf06cd,null));};exports[_0x100c('0xb9')]=function(_0x430bce,_0x3d6a92,_0x243531){var _0x40f9cb={};var _0x58c190={};var _0x101c34;var _0xe46bd;return db[_0x100c('0x39')]['findOne']({'where':{'id':_0x430bce[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x3d6a92,null))[_0x100c('0x1b')](function(_0x31c77c){if(_0x31c77c){_0x101c34=_0x31c77c;_0x58c190[_0x100c('0x3a')]=_['keys'](db['ChatGroup'][_0x100c('0x52')]);_0x58c190[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x430bce['query']);_0x58c190[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x58c190[_0x100c('0x3a')],_0x58c190['query']);_0x40f9cb['attributes']=_[_0x100c('0x40')](_0x58c190[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x430bce[_0x100c('0x3e')][_0x100c('0x41')]));_0x40f9cb[_0x100c('0x42')]=_0x40f9cb[_0x100c('0x42')][_0x100c('0x43')]?_0x40f9cb[_0x100c('0x42')]:_0x58c190[_0x100c('0x3a')];_0x40f9cb['order']=qs[_0x100c('0x46')](_0x430bce[_0x100c('0x3e')][_0x100c('0x46')]);_0x40f9cb[_0x100c('0x47')]=qs['filters'](_[_0x100c('0x48')](_0x430bce['query'],_0x58c190[_0x100c('0x3f')]));if(_0x430bce[_0x100c('0x3e')][_0x100c('0x33')]){_0x40f9cb[_0x100c('0x47')]=_[_0x100c('0x49')](_0x40f9cb[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x40f9cb[_0x100c('0x42')],function(_0x399497){var _0x50f40a={};_0x50f40a[_0x399497]={'$like':'%'+_0x430bce[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x50f40a;})});}_0x40f9cb=_[_0x100c('0x49')]({},_0x40f9cb,_0x430bce[_0x100c('0x4f')]);return _0x101c34[_0x100c('0xb9')](_0x40f9cb);}})['then'](function(_0x50ed02){if(_0x50ed02){_0xe46bd=_0x50ed02['length'];if(!_0x430bce[_0x100c('0x3e')][_0x100c('0xaf')]('nolimit')){_0x40f9cb[_0x100c('0x29')]=qs[_0x100c('0x29')](_0x430bce[_0x100c('0x3e')][_0x100c('0x29')]);_0x40f9cb['offset']=qs[_0x100c('0x28')](_0x430bce[_0x100c('0x3e')]['offset']);}return _0x101c34[_0x100c('0xb9')](_0x40f9cb);}})[_0x100c('0x1b')](function(_0x2c47aa){if(_0x2c47aa){return _0x2c47aa?{'count':_0xe46bd,'rows':_0x2c47aa}:null;}})[_0x100c('0x1b')](respondWithResult(_0x3d6a92,null))[_0x100c('0x23')](handleError(_0x3d6a92,null));};exports[_0x100c('0xba')]=function(_0x2e65c7,_0x48ba06,_0x5d0a5d){var _0xe2b6f5={'raw':!![],'where':{}};var _0x18b4c8={};var _0x2a9d05={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x2e65c7['params']['id']}})['then'](handleEntityNotFound(_0x48ba06,null))['then'](function(_0x204ae8){if(_0x204ae8){_0x18b4c8[_0x100c('0x3a')]=_['keys'](db['VoiceRecording'][_0x100c('0x52')]);_0x18b4c8[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x2e65c7['query']);_0x18b4c8['filters']=_['intersection'](_0x18b4c8[_0x100c('0x3a')],_0x18b4c8[_0x100c('0x3e')]);_0xe2b6f5[_0x100c('0x42')]=_[_0x100c('0x40')](_0x18b4c8[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x2e65c7[_0x100c('0x3e')][_0x100c('0x41')]));_0xe2b6f5['attributes']=_0xe2b6f5[_0x100c('0x42')][_0x100c('0x43')]?_0xe2b6f5[_0x100c('0x42')]:_0x18b4c8[_0x100c('0x3a')];if(!_0x2e65c7[_0x100c('0x3e')]['hasOwnProperty'](_0x100c('0x44'))){_0xe2b6f5['limit']=qs[_0x100c('0x29')](_0x2e65c7[_0x100c('0x3e')][_0x100c('0x29')]);_0xe2b6f5[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x2e65c7[_0x100c('0x3e')]['offset']);}_0xe2b6f5[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x2e65c7[_0x100c('0x3e')][_0x100c('0x46')]);_0xe2b6f5['where']=qs[_0x100c('0x3f')](_[_0x100c('0x48')](_0x2e65c7[_0x100c('0x3e')],_0x18b4c8[_0x100c('0x3f')]));_0xe2b6f5[_0x100c('0x47')][_0x100c('0xbb')]=_0x204ae8['id'];if(_0x2e65c7[_0x100c('0x3e')]['filter']){_0xe2b6f5[_0x100c('0x47')]=_[_0x100c('0x49')](_0xe2b6f5[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0xe2b6f5['attributes'],function(_0xc42f41){var _0x344c01={};_0x344c01[_0xc42f41]={'$like':'%'+_0x2e65c7[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x344c01;})});}_0xe2b6f5=_[_0x100c('0x49')]({},_0xe2b6f5,_0x2e65c7[_0x100c('0x4f')]);return db['VoiceRecording'][_0x100c('0x27')]({'where':_0xe2b6f5[_0x100c('0x47')]})['then'](function(_0x434a3a){_0x2a9d05[_0x100c('0x27')]=_0x434a3a;if(_0x2e65c7[_0x100c('0x3e')][_0x100c('0x54')]){_0xe2b6f5['include']=[{'all':!![]}];}return db[_0x100c('0xbc')]['findAll'](_0xe2b6f5);})[_0x100c('0x1b')](function(_0x24540a){_0x2a9d05[_0x100c('0xbd')]=_0x24540a;return _0x2a9d05;});}})[_0x100c('0x1b')](respondWithFilteredResult(_0x48ba06,_0xe2b6f5))[_0x100c('0x23')](handleError(_0x48ba06,null));};exports[_0x100c('0xbe')]=function(_0x2709db,_0x1a97d1,_0x425e1a){var _0x984d69={'raw':!![],'where':{}};var _0x4fb1ba={};var _0x2a5f51={'count':0x0,'rows':[]};return db[_0x100c('0x39')]['findOne']({'where':{'id':_0x2709db[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x1a97d1,null))[_0x100c('0x1b')](function(_0x228d15){if(_0x228d15){_0x4fb1ba[_0x100c('0x3a')]=_[_0x100c('0x3c')](db[_0x100c('0xbf')][_0x100c('0x52')]);_0x4fb1ba[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x2709db[_0x100c('0x3e')]);_0x4fb1ba[_0x100c('0x3f')]=_['intersection'](_0x4fb1ba['model'],_0x4fb1ba[_0x100c('0x3e')]);_0x984d69[_0x100c('0x42')]=_['intersection'](_0x4fb1ba[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x2709db[_0x100c('0x3e')][_0x100c('0x41')]));_0x984d69[_0x100c('0x42')]=_0x984d69['attributes']['length']?_0x984d69[_0x100c('0x42')]:_0x4fb1ba[_0x100c('0x3a')];if(!_0x2709db[_0x100c('0x3e')][_0x100c('0xaf')]('nolimit')){_0x984d69[_0x100c('0x29')]=qs['limit'](_0x2709db[_0x100c('0x3e')]['limit']);_0x984d69[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x2709db[_0x100c('0x3e')][_0x100c('0x28')]);}_0x984d69[_0x100c('0x45')]=qs['sort'](_0x2709db[_0x100c('0x3e')][_0x100c('0x46')]);_0x984d69[_0x100c('0x47')]=qs['filters'](_[_0x100c('0x48')](_0x2709db[_0x100c('0x3e')],_0x4fb1ba[_0x100c('0x3f')]));_0x984d69[_0x100c('0x47')]['UserId']=_0x228d15['id'];if(_0x2709db['query'][_0x100c('0x33')]){_0x984d69['where']=_[_0x100c('0x49')](_0x984d69[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x984d69[_0x100c('0x42')],function(_0x4a9bcf){var _0x5c0c14={};_0x5c0c14[_0x4a9bcf]={'$like':'%'+_0x2709db[_0x100c('0x3e')]['filter']+'%'};return _0x5c0c14;})});}_0x984d69=_[_0x100c('0x49')]({},_0x984d69,_0x2709db['options']);return db['ScreenRecording'][_0x100c('0x27')]({'where':_0x984d69[_0x100c('0x47')]})[_0x100c('0x1b')](function(_0x113573){_0x2a5f51[_0x100c('0x27')]=_0x113573;if(_0x2709db[_0x100c('0x3e')][_0x100c('0x54')]){_0x984d69[_0x100c('0x50')]=[{'all':!![]}];}return db[_0x100c('0xbf')]['findAll'](_0x984d69);})[_0x100c('0x1b')](function(_0x28d480){_0x2a5f51['rows']=_0x28d480;return _0x2a5f51;});}})[_0x100c('0x1b')](respondWithFilteredResult(_0x1a97d1,_0x984d69))[_0x100c('0x23')](handleError(_0x1a97d1,null));};exports[_0x100c('0xc0')]=function(_0x2eb5ef,_0x9c047e,_0x4ef262){var _0x5610dc={};var _0x1cb7b8={};var _0x2c0e8c;var _0x956766;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x2eb5ef[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x9c047e,null))[_0x100c('0x1b')](function(_0x4dc84a){if(_0x4dc84a){_0x2c0e8c=_0x4dc84a;_0x1cb7b8[_0x100c('0x3a')]=_['keys'](db[_0x100c('0xc1')]['rawAttributes']);_0x1cb7b8['query']=_['keys'](_0x2eb5ef[_0x100c('0x3e')]);_0x1cb7b8[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x1cb7b8[_0x100c('0x3a')],_0x1cb7b8[_0x100c('0x3e')]);_0x5610dc[_0x100c('0x42')]=_[_0x100c('0x40')](_0x1cb7b8[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x2eb5ef[_0x100c('0x3e')]['fields']));_0x5610dc[_0x100c('0x42')]=_0x5610dc[_0x100c('0x42')]['length']?_0x5610dc[_0x100c('0x42')]:_0x1cb7b8[_0x100c('0x3a')];_0x5610dc[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x2eb5ef['query'][_0x100c('0x46')]);_0x5610dc[_0x100c('0x47')]=qs['filters'](_[_0x100c('0x48')](_0x2eb5ef[_0x100c('0x3e')],_0x1cb7b8[_0x100c('0x3f')]));if(_0x2eb5ef[_0x100c('0x3e')][_0x100c('0x33')]){_0x5610dc[_0x100c('0x47')]=_[_0x100c('0x49')](_0x5610dc[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x5610dc['attributes'],function(_0x28a3d0){var _0x21570f={};_0x21570f[_0x28a3d0]={'$like':'%'+_0x2eb5ef[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x21570f;})});}_0x5610dc=_['merge']({},_0x5610dc,_0x2eb5ef[_0x100c('0x4f')]);return _0x2c0e8c[_0x100c('0xc0')](_0x5610dc);}})[_0x100c('0x1b')](function(_0x47c032){if(_0x47c032){_0x956766=_0x47c032[_0x100c('0x43')];if(!_0x2eb5ef[_0x100c('0x3e')][_0x100c('0xaf')](_0x100c('0x44'))){_0x5610dc['limit']=qs['limit'](_0x2eb5ef[_0x100c('0x3e')][_0x100c('0x29')]);_0x5610dc['offset']=qs[_0x100c('0x28')](_0x2eb5ef['query']['offset']);}return _0x2c0e8c[_0x100c('0xc0')](_0x5610dc);}})[_0x100c('0x1b')](function(_0x2b3d96){if(_0x2b3d96){return _0x2b3d96?{'count':_0x956766,'rows':_0x2b3d96}:null;}})['then'](respondWithResult(_0x9c047e,null))['catch'](handleError(_0x9c047e,null));};exports[_0x100c('0xc2')]=function(_0x546652,_0x288e38,_0x347d79){var _0x4ccf1e={};var _0xd34c28={};var _0x43a047;var _0x2c7c49;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x546652[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x288e38,null))[_0x100c('0x1b')](function(_0x3d8474){if(_0x3d8474){_0x43a047=_0x3d8474;_0xd34c28[_0x100c('0x3a')]=_[_0x100c('0x3c')](db[_0x100c('0xc3')][_0x100c('0x52')]);_0xd34c28[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x546652[_0x100c('0x3e')]);_0xd34c28[_0x100c('0x3f')]=_[_0x100c('0x40')](_0xd34c28[_0x100c('0x3a')],_0xd34c28[_0x100c('0x3e')]);_0x4ccf1e[_0x100c('0x42')]=_['intersection'](_0xd34c28[_0x100c('0x3a')],qs['fields'](_0x546652[_0x100c('0x3e')][_0x100c('0x41')]));_0x4ccf1e[_0x100c('0x42')]=_0x4ccf1e['attributes'][_0x100c('0x43')]?_0x4ccf1e[_0x100c('0x42')]:_0xd34c28[_0x100c('0x3a')];_0x4ccf1e['order']=qs['sort'](_0x546652['query']['sort']);_0x4ccf1e[_0x100c('0x47')]=qs[_0x100c('0x3f')](_['pick'](_0x546652[_0x100c('0x3e')],_0xd34c28['filters']));if(_0x546652[_0x100c('0x3e')][_0x100c('0x33')]){_0x4ccf1e[_0x100c('0x47')]=_[_0x100c('0x49')](_0x4ccf1e[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x4ccf1e['attributes'],function(_0x572e6a){var _0x1a9f0b={};_0x1a9f0b[_0x572e6a]={'$like':'%'+_0x546652[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x1a9f0b;})});}_0x4ccf1e=_[_0x100c('0x49')]({},_0x4ccf1e,_0x546652[_0x100c('0x4f')]);return _0x43a047[_0x100c('0xc2')](_0x4ccf1e);}})['then'](function(_0x3f9ed1){if(_0x3f9ed1){_0x2c7c49=_0x3f9ed1['length'];if(!_0x546652[_0x100c('0x3e')][_0x100c('0xaf')](_0x100c('0x44'))){_0x4ccf1e['limit']=qs[_0x100c('0x29')](_0x546652[_0x100c('0x3e')]['limit']);_0x4ccf1e[_0x100c('0x28')]=qs['offset'](_0x546652[_0x100c('0x3e')]['offset']);}return _0x43a047['getOpenchannelInteractions'](_0x4ccf1e);}})[_0x100c('0x1b')](function(_0x1b52c4){if(_0x1b52c4){return _0x1b52c4?{'count':_0x2c7c49,'rows':_0x1b52c4}:null;}})[_0x100c('0x1b')](respondWithResult(_0x288e38,null))['catch'](handleError(_0x288e38,null));};exports['getMailInteractions']=function(_0x2b49ad,_0x4f0a49,_0x2579c9){var _0xdac980={'raw':!![],'where':{}};var _0x5a0dd5={};var _0x1ac4f9={'count':0x0,'rows':[]};return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x2b49ad[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x4f0a49,null))[_0x100c('0x1b')](function(_0x31e881){if(_0x31e881){_0x5a0dd5[_0x100c('0x3a')]=_[_0x100c('0x3c')](db['MailInteraction'][_0x100c('0x52')]);_0x5a0dd5[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x2b49ad[_0x100c('0x3e')]);_0x5a0dd5[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x5a0dd5[_0x100c('0x3a')],_0x5a0dd5[_0x100c('0x3e')]);_0xdac980['attributes']=_[_0x100c('0x40')](_0x5a0dd5['model'],qs[_0x100c('0x41')](_0x2b49ad[_0x100c('0x3e')][_0x100c('0x41')]));_0xdac980[_0x100c('0x42')]=_0xdac980['attributes']['length']?_0xdac980['attributes']:_0x5a0dd5[_0x100c('0x3a')];if(!_0x2b49ad[_0x100c('0x3e')][_0x100c('0xaf')](_0x100c('0x44'))){_0xdac980[_0x100c('0x29')]=qs[_0x100c('0x29')](_0x2b49ad[_0x100c('0x3e')][_0x100c('0x29')]);_0xdac980[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x2b49ad[_0x100c('0x3e')][_0x100c('0x28')]);}_0xdac980[_0x100c('0x45')]=qs['sort'](_0x2b49ad['query']['sort']);_0xdac980[_0x100c('0x47')]=qs['filters'](_['pick'](_0x2b49ad[_0x100c('0x3e')],_0x5a0dd5[_0x100c('0x3f')]));_0xdac980[_0x100c('0x47')][_0x100c('0xbb')]=_0x31e881['id'];if(_0x2b49ad[_0x100c('0x3e')][_0x100c('0x33')]){_0xdac980[_0x100c('0x47')]=_[_0x100c('0x49')](_0xdac980[_0x100c('0x47')],{'$or':_['map'](_0xdac980[_0x100c('0x42')],function(_0x1cfacf){var _0x703e78={};_0x703e78[_0x1cfacf]={'$like':'%'+_0x2b49ad['query'][_0x100c('0x33')]+'%'};return _0x703e78;})});}_0xdac980=_[_0x100c('0x49')]({},_0xdac980,_0x2b49ad[_0x100c('0x4f')]);return db['MailInteraction'][_0x100c('0x27')]({'where':_0xdac980[_0x100c('0x47')]})[_0x100c('0x1b')](function(_0x22f720){_0x1ac4f9[_0x100c('0x27')]=_0x22f720;if(_0x2b49ad[_0x100c('0x3e')][_0x100c('0x54')]){_0xdac980[_0x100c('0x50')]=[{'all':!![]}];}return db[_0x100c('0xc4')]['findAll'](_0xdac980);})[_0x100c('0x1b')](function(_0x4890b6){_0x1ac4f9[_0x100c('0xbd')]=_0x4890b6;return _0x1ac4f9;});}})[_0x100c('0x1b')](respondWithFilteredResult(_0x4f0a49,_0xdac980))['catch'](handleError(_0x4f0a49,null));};exports['getSmsInteractions']=function(_0x45d5ae,_0x13d2c1,_0x536924){var _0x34c4a3={};var _0x3b7f6d={};var _0x510b99;var _0x2097ab;return db[_0x100c('0x39')]['findOne']({'where':{'id':_0x45d5ae[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x13d2c1,null))[_0x100c('0x1b')](function(_0x4c5aa1){if(_0x4c5aa1){_0x510b99=_0x4c5aa1;_0x3b7f6d[_0x100c('0x3a')]=_[_0x100c('0x3c')](db[_0x100c('0xc5')][_0x100c('0x52')]);_0x3b7f6d['query']=_[_0x100c('0x3c')](_0x45d5ae[_0x100c('0x3e')]);_0x3b7f6d[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x3b7f6d[_0x100c('0x3a')],_0x3b7f6d[_0x100c('0x3e')]);_0x34c4a3[_0x100c('0x42')]=_[_0x100c('0x40')](_0x3b7f6d[_0x100c('0x3a')],qs['fields'](_0x45d5ae[_0x100c('0x3e')][_0x100c('0x41')]));_0x34c4a3[_0x100c('0x42')]=_0x34c4a3[_0x100c('0x42')][_0x100c('0x43')]?_0x34c4a3[_0x100c('0x42')]:_0x3b7f6d[_0x100c('0x3a')];_0x34c4a3['order']=qs['sort'](_0x45d5ae[_0x100c('0x3e')][_0x100c('0x46')]);_0x34c4a3[_0x100c('0x47')]=qs['filters'](_['pick'](_0x45d5ae[_0x100c('0x3e')],_0x3b7f6d['filters']));if(_0x45d5ae['query'][_0x100c('0x33')]){_0x34c4a3[_0x100c('0x47')]=_[_0x100c('0x49')](_0x34c4a3[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x34c4a3[_0x100c('0x42')],function(_0x618a33){var _0x38be43={};_0x38be43[_0x618a33]={'$like':'%'+_0x45d5ae[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x38be43;})});}_0x34c4a3=_[_0x100c('0x49')]({},_0x34c4a3,_0x45d5ae[_0x100c('0x4f')]);return _0x510b99[_0x100c('0xc6')](_0x34c4a3);}})[_0x100c('0x1b')](function(_0x4eb616){if(_0x4eb616){_0x2097ab=_0x4eb616['length'];if(!_0x45d5ae[_0x100c('0x3e')][_0x100c('0xaf')](_0x100c('0x44'))){_0x34c4a3['limit']=qs[_0x100c('0x29')](_0x45d5ae[_0x100c('0x3e')]['limit']);_0x34c4a3[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x45d5ae[_0x100c('0x3e')]['offset']);}return _0x510b99[_0x100c('0xc6')](_0x34c4a3);}})[_0x100c('0x1b')](function(_0x359044){if(_0x359044){return _0x359044?{'count':_0x2097ab,'rows':_0x359044}:null;}})[_0x100c('0x1b')](respondWithResult(_0x13d2c1,null))['catch'](handleError(_0x13d2c1,null));};exports[_0x100c('0xc7')]=function(_0x582c9f,_0x1fd7c0,_0xa84cb7){var _0xb9bf60={};var _0x41d105={};var _0x497d86;var _0x4734ce;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x582c9f[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x1fd7c0,null))[_0x100c('0x1b')](function(_0x18f3d0){if(_0x18f3d0){_0x497d86=_0x18f3d0;_0x41d105[_0x100c('0x3a')]=_[_0x100c('0x3c')](db[_0x100c('0xc8')][_0x100c('0x52')]);_0x41d105[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x582c9f['query']);_0x41d105['filters']=_[_0x100c('0x40')](_0x41d105[_0x100c('0x3a')],_0x41d105[_0x100c('0x3e')]);_0xb9bf60['attributes']=_[_0x100c('0x40')](_0x41d105[_0x100c('0x3a')],qs['fields'](_0x582c9f[_0x100c('0x3e')][_0x100c('0x41')]));_0xb9bf60[_0x100c('0x42')]=_0xb9bf60[_0x100c('0x42')]['length']?_0xb9bf60[_0x100c('0x42')]:_0x41d105['model'];_0xb9bf60[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x582c9f[_0x100c('0x3e')]['sort']);_0xb9bf60['where']=qs[_0x100c('0x3f')](_[_0x100c('0x48')](_0x582c9f[_0x100c('0x3e')],_0x41d105[_0x100c('0x3f')]));if(_0x582c9f[_0x100c('0x3e')][_0x100c('0x33')]){_0xb9bf60[_0x100c('0x47')]=_['merge'](_0xb9bf60['where'],{'$or':_[_0x100c('0x35')](_0xb9bf60[_0x100c('0x42')],function(_0x1a4f73){var _0x3104b5={};_0x3104b5[_0x1a4f73]={'$like':'%'+_0x582c9f['query'][_0x100c('0x33')]+'%'};return _0x3104b5;})});}_0xb9bf60=_[_0x100c('0x49')]({},_0xb9bf60,_0x582c9f[_0x100c('0x4f')]);return _0x497d86['getFaxInteractions'](_0xb9bf60);}})[_0x100c('0x1b')](function(_0x16ad71){if(_0x16ad71){_0x4734ce=_0x16ad71[_0x100c('0x43')];if(!_0x582c9f[_0x100c('0x3e')]['hasOwnProperty'](_0x100c('0x44'))){_0xb9bf60[_0x100c('0x29')]=qs['limit'](_0x582c9f[_0x100c('0x3e')][_0x100c('0x29')]);_0xb9bf60[_0x100c('0x28')]=qs['offset'](_0x582c9f['query']['offset']);}return _0x497d86['getFaxInteractions'](_0xb9bf60);}})[_0x100c('0x1b')](function(_0x436ca0){if(_0x436ca0){return _0x436ca0?{'count':_0x4734ce,'rows':_0x436ca0}:null;}})[_0x100c('0x1b')](respondWithResult(_0x1fd7c0,null))[_0x100c('0x23')](handleError(_0x1fd7c0,null));};exports[_0x100c('0xc9')]=function(_0x213aaa,_0x277329,_0x54f23c){var _0x4c4e2b;var _0x3e8291;var _0x12b169;var _0x170478=!_[_0x100c('0x62')](_0x213aaa['params']['id'])?_0x213aaa[_0x100c('0x59')]['id']:!_[_0x100c('0x62')](_0x213aaa[_0x100c('0x5f')]['id'])?_0x213aaa[_0x100c('0x5f')]['id']:null;return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x170478,'role':_0x100c('0x30')},'attributes':['id',_0x100c('0x37'),_0x100c('0xca'),_0x100c('0xcb'),_0x100c('0x58'),_0x100c('0x66'),_0x100c('0x8d')]})['then'](handleEntityNotFound(_0x277329,null))['then'](function(_0x5d4dda){if(_0x5d4dda){_0x4c4e2b=_0x5d4dda;if(_0x213aaa[_0x100c('0x57')][_0x100c('0x8e')]){_0x12b169=util[_0x100c('0x63')]('LOCAL/%s@from-sip/n',_0x4c4e2b[_0x213aaa[_0x100c('0x57')]['interface']]);}else if(_0x213aaa['body'][_0x100c('0xcc')]){_0x12b169=util[_0x100c('0x63')]('SIP/%s',_0x213aaa[_0x100c('0x57')][_0x100c('0xcc')]);}else{_0x12b169=util[_0x100c('0x63')](_0x100c('0x9a'),_0x4c4e2b['name']);}socket['to'](util[_0x100c('0x63')](_0x100c('0xcd'),_0x4c4e2b[_0x100c('0x37')]))['emit'](_0x100c('0xce'),{'ip':_0x213aaa[_0x100c('0xcf')][_0x100c('0xd0')]||_0x213aaa[_0x100c('0xd1')][_0x100c('0xd2')]||_0x213aaa[_0x100c('0xd3')][_0x100c('0xd2')]||_0x213aaa[_0x100c('0xd1')][_0x100c('0xd3')]['remoteAddress']});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x4c4e2b[_0x100c('0x37')]},'individualHooks':!![]});}})[_0x100c('0x1b')](function(_0x15725d){if(_0x4c4e2b){return _0x4c4e2b['getVoiceQueues']({'raw':!![]});}})[_0x100c('0x1b')](function(_0x35018f){var _0x508d9b=[];if(_0x35018f){_0x3e8291=_0x35018f;if(_0x3e8291[_0x100c('0x43')]){for(var _0x168cbe=0x0;_0x168cbe<_0x3e8291[_0x100c('0x43')];_0x168cbe++){_0x508d9b[_0x100c('0xd4')]({'membername':_0x4c4e2b['name'],'UserId':_0x4c4e2b['id'],'queue_name':_0x3e8291[_0x168cbe][_0x100c('0x37')],'VoiceQueueId':_0x3e8291[_0x168cbe]['id'],'interface':_0x12b169,'paused':_0x4c4e2b[_0x100c('0x8d')]||![],'penalty':_0x3e8291[_0x168cbe][_0x100c('0xd5')]||0x0});}return BPromise[_0x100c('0x9c')](_0x508d9b,function(_0x294596){return db[_0x100c('0x9d')][_0x100c('0xd6')](_0x294596);});}}})[_0x100c('0x1b')](function(){return db[_0x100c('0xd7')][_0x100c('0x99')]({'where':{'membername':_0x4c4e2b['name'],'exitAt':null}});})['then'](function(_0x556f6e){var _0x5898d4=[];_0x556f6e[_0x100c('0xd8')](function(_0x511687){_0x5898d4[_0x100c('0xd4')](_0x511687['update']({'exitAt':moment()[_0x100c('0x63')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x100c('0xd9')](_0x5898d4);})[_0x100c('0x1b')](function(){var _0x51aa6e=[];var _0x1f66e5=[];var _0xbe5792=utils[_0x100c('0xda')]();var _0x1b1bf6={'membername':_0x4c4e2b[_0x100c('0x37')],'interface':_0x12b169,'enterAt':moment()[_0x100c('0x63')](_0x100c('0xdb')),'role':_0x4c4e2b[_0x100c('0x58')],'internal':_0x4c4e2b[_0x100c('0x66')]};_0xbe5792[_0x100c('0xd8')](function(_0x3644d1){_0x51aa6e[_0x100c('0xd4')](_[_0x100c('0x49')]({'channel':_0x3644d1,'type':'LOGIN','data1':_0x213aaa[_0x100c('0x57')][_0x100c('0xdc')],'data2':_0x12b169},_0x1b1bf6));if(_0x4c4e2b[_0x100c('0x8d')]){_0x1f66e5[_0x100c('0xd4')](_['merge']({'channel':_0x3644d1,'type':'PAUSE','data1':_0x100c('0xdd')},_0x1b1bf6));}});return db[_0x100c('0xd7')]['bulkCreate'](_0x51aa6e[_0x100c('0xde')](_0x1f66e5),{'individualHooks':!![]});})[_0x100c('0x1b')](function(){return _0x4c4e2b[_0x100c('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x100c('0x63')](_0x100c('0xdb')),'voicePause':_0x4c4e2b['loginInPause']||![],'mailPause':_0x4c4e2b[_0x100c('0x8d')]||![],'chatPause':_0x4c4e2b[_0x100c('0x8d')]||![],'faxPause':_0x4c4e2b[_0x100c('0x8d')]||![],'smsPause':_0x4c4e2b[_0x100c('0x8d')]||![],'openchannelPause':_0x4c4e2b['loginInPause']||![],'pauseType':_0x4c4e2b[_0x100c('0x8d')]?_0x100c('0xdd'):null,'interface':_0x12b169,'lastPauseAt':moment()['format'](_0x100c('0xdb'))});})['then'](function(_0x424601){if(_0x213aaa[_0x100c('0xdf')]){return _0x54f23c();}else{return BPromise[_0x100c('0xe0')](_0x424601)[_0x100c('0x1b')](respondWithResult(_0x277329,null));}})[_0x100c('0x23')](handleError(_0x277329,null));};exports[_0x100c('0xe1')]=function(_0x1878ed,_0x4f55b,_0x2d4831){var _0x3c1bbb;return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x1878ed[_0x100c('0x59')]['id'],'role':'agent'},'attributes':['id',_0x100c('0x37'),_0x100c('0x58')]})[_0x100c('0x1b')](handleEntityNotFound(_0x4f55b,null))[_0x100c('0x1b')](function(_0x48a507){if(_0x48a507){_0x3c1bbb=_0x48a507;return db[_0x100c('0x9d')]['destroy']({'where':{'membername':_0x3c1bbb[_0x100c('0x37')]},'individualHooks':!![]});}})[_0x100c('0x1b')](function(){return db['MemberReport'][_0x100c('0x99')]({'where':{'membername':_0x3c1bbb[_0x100c('0x37')],'exitAt':null}});})[_0x100c('0x1b')](function(_0x266e30){var _0x1fb99b=[];_0x266e30['forEach'](function(_0x5a2190){_0x1fb99b[_0x100c('0xd4')](_0x5a2190[_0x100c('0x2d')]({'exitAt':moment()[_0x100c('0x63')](_0x100c('0xdb'))}));});return BPromise[_0x100c('0xd9')](_0x1fb99b);})[_0x100c('0x1b')](function(){return _0x3c1bbb[_0x100c('0x2d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x100c('0x1b')](respondWithResult(_0x4f55b,null))['catch'](handleError(_0x4f55b,null));};exports[_0x100c('0xe2')]=function(_0x2fd44f,_0x1480ba,_0x27220c){var _0x425499;return db[_0x100c('0x9d')][_0x100c('0x2d')]({'paused':0x1},{'where':{'UserId':_0x2fd44f[_0x100c('0x59')]['id']},'individualHooks':!![]})[_0x100c('0x1b')](function(){return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x2fd44f[_0x100c('0x59')]['id'],'role':'agent'},'attributes':['id','name',_0x100c('0x58'),'internal',_0x100c('0x8e')]});})['then'](handleEntityNotFound(_0x1480ba,null))[_0x100c('0x1b')](function(_0x46bd11){if(_0x46bd11){_0x425499=_0x46bd11;return respondWithRpcPromise(_0x100c('0xe3'),_0x100c('0xe2'),{'id':_0x425499['id'],'name':_0x425499['name'],'pause':!![]});}})[_0x100c('0x1b')](function(){if(_0x425499){return db['MemberReport'][_0x100c('0x99')]({'where':{'membername':_0x425499['name'],'type':_0x100c('0xe4'),'exitAt':null}});}})[_0x100c('0x1b')](function(_0x158ff1){if(_0x158ff1[_0x100c('0x43')]){var _0x160559=moment()[_0x100c('0x63')](_0x100c('0xdb'));for(var _0x5c4335=0x0,_0x441b04=_0x158ff1['length'];_0x5c4335<_0x441b04;_0x5c4335++){_0x158ff1[_0x5c4335][_0x100c('0xe5')]({'exitAt':_0x160559});}}})[_0x100c('0x1b')](function(){var _0x4658dd=[];var _0x354e3e=utils['getChannels']();_0x354e3e[_0x100c('0xd8')](function(_0x3b5625){_0x4658dd[_0x100c('0xd4')]({'channel':_0x3b5625,'membername':_0x425499[_0x100c('0x37')],'interface':_[_0x100c('0x62')](_0x425499[_0x100c('0x8e')])?util[_0x100c('0x63')](_0x100c('0x9a'),_0x425499[_0x100c('0x37')]):_0x425499[_0x100c('0x8e')],'type':_0x100c('0xe4'),'enterAt':moment()[_0x100c('0x63')](_0x100c('0xdb')),'data1':_0x2fd44f[_0x100c('0x57')][_0x100c('0xe6')]||'DEFAULT\x20PAUSE','role':_0x425499[_0x100c('0x58')],'internal':_0x425499[_0x100c('0x66')]});});return db['MemberReport'][_0x100c('0x56')](_0x4658dd,{'individualHooks':!![]});})[_0x100c('0x1b')](function(){return _0x425499['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2fd44f[_0x100c('0x57')][_0x100c('0xe6')]||_0x100c('0xe7'),'lastPauseAt':moment()[_0x100c('0x63')](_0x100c('0xdb'))});})[_0x100c('0x1b')](respondWithResult(_0x1480ba,null))['catch'](handleError(_0x1480ba,null));};exports[_0x100c('0xe8')]=function(_0x255e96,_0x10b59d,_0x3600f8){var _0x2bc554;return db['User'][_0x100c('0x55')]({'where':{'id':_0x255e96['params']['id']},'attributes':['id','name',_0x100c('0x58'),_0x100c('0x9b'),_0x100c('0xe9'),_0x100c('0xea'),'faxPause',_0x100c('0xeb'),'smsPause','pauseType',_0x100c('0xec')]})['then'](handleEntityNotFound(_0x10b59d,null))[_0x100c('0x1b')](function(_0x1653d8){if(_0x1653d8){_0x2bc554=_0x1653d8;if(_0x255e96[_0x100c('0x57')]['channel']&&!utils[_0x100c('0x8f')](_0x255e96[_0x100c('0x57')][_0x100c('0x9f')])){throw new db[(_0x100c('0x81'))][(_0x100c('0x83'))](_0x100c('0x90'));}switch(_0x255e96['body'][_0x100c('0x9f')]){case _0x100c('0xa2'):return respondWithRpcPromise(_0x100c('0xe3'),_0x100c('0xe8'),{'id':_0x2bc554['id'],'name':_0x2bc554['name'],'pause':![]})[_0x100c('0x1b')](function(){return db['UserVoiceQueueRt'][_0x100c('0x2d')]({'paused':0x0},{'where':{'UserId':_0x2bc554['id']},'individualHooks':!![]});})[_0x100c('0x1b')](function(){return db[_0x100c('0xd7')][_0x100c('0x55')]({'where':{'channel':_0x255e96[_0x100c('0x57')][_0x100c('0x9f')],'membername':_0x2bc554[_0x100c('0x37')],'type':_0x100c('0xe4'),'exitAt':null}});})[_0x100c('0x1b')](function(_0xc989a9){if(_0xc989a9){return _0xc989a9[_0x100c('0x2d')]({'exitAt':moment()[_0x100c('0x63')](_0x100c('0xdb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x100c('0x1b')](function(){return _0x2bc554[_0x100c('0x2d')]({'voicePause':![]});});case _0x100c('0xed'):case _0x100c('0xee'):case'fax':case _0x100c('0xef'):case'openchannel':return db[_0x100c('0xd7')]['find']({'where':{'channel':_0x255e96['body'][_0x100c('0x9f')],'membername':_0x2bc554[_0x100c('0x37')],'type':_0x100c('0xe4'),'exitAt':null}})[_0x100c('0x1b')](function(_0x47f617){if(_0x47f617){return _0x47f617['update']({'exitAt':moment()[_0x100c('0x63')](_0x100c('0xdb')),'data2':_0x100c('0xf0')},{'individualHooks':!![]});}return null;})[_0x100c('0x1b')](function(){var _0x18beb0={};_[_0x100c('0xf1')](_0x18beb0,util[_0x100c('0x63')](_0x100c('0xf2'),_0x255e96['body']['channel'],_0x100c('0xf3')),![]);return _0x2bc554['update'](_0x18beb0);});default:return respondWithRpcPromise(_0x100c('0xe3'),_0x100c('0xe8'),{'id':_0x2bc554['id'],'name':_0x2bc554[_0x100c('0x37')],'pause':![]})[_0x100c('0x1b')](function(){return db[_0x100c('0x9d')]['update']({'paused':0x0},{'where':{'UserId':_0x2bc554['id']}});})[_0x100c('0x1b')](function(){return db[_0x100c('0xd7')]['findAll']({'where':{'membername':_0x2bc554[_0x100c('0x37')],'type':_0x100c('0xe4'),'exitAt':null}});})[_0x100c('0x1b')](function(_0x1bb9e2){var _0x26eac1=[];_0x1bb9e2[_0x100c('0xd8')](function(_0x117d03){_0x26eac1[_0x100c('0xd4')](_0x117d03[_0x100c('0x2d')]({'exitAt':moment()[_0x100c('0x63')](_0x100c('0xdb')),'data2':_0x100c('0xf0')}));});return BPromise[_0x100c('0xd9')](_0x26eac1);})['then'](function(){return _0x2bc554[_0x100c('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x100c('0x1b')](respondWithResult(_0x10b59d,null))[_0x100c('0x23')](handleError(_0x10b59d,null));};exports[_0x100c('0xf4')]=function(_0x36381d,_0xa1f756,_0x137901){var _0x366da8={};var _0x17a8ae={};var _0x3e651c;var _0x456385;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x36381d[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0xa1f756,null))['then'](function(_0x5a6d5c){if(_0x5a6d5c){_0x3e651c=_0x5a6d5c;_0x17a8ae[_0x100c('0x3a')]=_[_0x100c('0x3c')](db['Team'][_0x100c('0x52')]);_0x17a8ae[_0x100c('0x3e')]=_['keys'](_0x36381d[_0x100c('0x3e')]);_0x17a8ae[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x17a8ae[_0x100c('0x3a')],_0x17a8ae[_0x100c('0x3e')]);_0x366da8['attributes']=_[_0x100c('0x40')](_0x17a8ae[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x36381d[_0x100c('0x3e')][_0x100c('0x41')]));_0x366da8[_0x100c('0x42')]=_0x366da8[_0x100c('0x42')][_0x100c('0x43')]?_0x366da8[_0x100c('0x42')]:_0x17a8ae[_0x100c('0x3a')];_0x366da8['order']=qs[_0x100c('0x46')](_0x36381d[_0x100c('0x3e')][_0x100c('0x46')]);_0x366da8[_0x100c('0x47')]=qs['filters'](_[_0x100c('0x48')](_0x36381d[_0x100c('0x3e')],_0x17a8ae[_0x100c('0x3f')]));if(_0x36381d[_0x100c('0x3e')][_0x100c('0x33')]){_0x366da8[_0x100c('0x47')]=_[_0x100c('0x49')](_0x366da8['where'],{'$or':_[_0x100c('0x35')](_0x366da8[_0x100c('0x42')],function(_0x2800db){var _0x586493={};_0x586493[_0x2800db]={'$like':'%'+_0x36381d[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x586493;})});}_0x366da8=_[_0x100c('0x49')]({},_0x366da8,_0x36381d[_0x100c('0x4f')]);return _0x3e651c[_0x100c('0xf4')](_0x366da8);}})[_0x100c('0x1b')](function(_0x5d16d2){if(_0x5d16d2){_0x456385=_0x5d16d2[_0x100c('0x43')];if(!_0x36381d['query'][_0x100c('0xaf')]('nolimit')){_0x366da8[_0x100c('0x29')]=qs[_0x100c('0x29')](_0x36381d[_0x100c('0x3e')][_0x100c('0x29')]);_0x366da8[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x36381d[_0x100c('0x3e')][_0x100c('0x28')]);}return _0x3e651c['getTeams'](_0x366da8);}})[_0x100c('0x1b')](function(_0x39edf3){if(_0x39edf3){return _0x39edf3?{'count':_0x456385,'rows':_0x39edf3}:null;}})['then'](respondWithResult(_0xa1f756,null))[_0x100c('0x23')](handleError(_0xa1f756,null));};exports[_0x100c('0xf5')]=function(_0x30e3bf,_0x551bc0,_0x41f830){return db[_0x100c('0x39')]['find']({'where':{'id':_0x30e3bf['params']['id']}})['then'](handleEntityNotFound(_0x551bc0,null))['then'](function(_0x430918){if(_0x430918){return _0x430918[_0x100c('0xf5')](_0x30e3bf[_0x100c('0x57')][_0x100c('0x5c')],_[_0x100c('0x5d')](_0x30e3bf[_0x100c('0x57')],[_0x100c('0x5c'),'id'])||{});}})[_0x100c('0x1b')](respondWithResult(_0x551bc0,null))['catch'](handleError(_0x551bc0,null));};exports['removeTeams']=function(_0x3b937f,_0x30918b,_0x285f17){return db[_0x100c('0x39')][_0x100c('0x55')]({'where':{'id':_0x3b937f[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x30918b,null))[_0x100c('0x1b')](function(_0x25caae){if(_0x25caae){return _0x25caae[_0x100c('0xf6')](_0x3b937f['query'][_0x100c('0x5c')]);}})['then'](respondWithStatusCode(_0x30918b,null))[_0x100c('0x23')](handleError(_0x30918b,null));};exports[_0x100c('0xf7')]=function(_0x1da0e0,_0x30a232,_0x5c0291){var _0x2368ff={};var _0x359e4e={};var _0x31c2ef;var _0x198c47;return db[_0x100c('0x39')][_0x100c('0x8a')]({'where':{'id':_0x1da0e0[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x30a232,null))[_0x100c('0x1b')](function(_0x30bde7){if(_0x30bde7){_0x31c2ef=_0x30bde7;_0x359e4e[_0x100c('0x3a')]=_[_0x100c('0x3c')](db['CmList'][_0x100c('0x52')]);_0x359e4e[_0x100c('0x3e')]=_[_0x100c('0x3c')](_0x1da0e0[_0x100c('0x3e')]);_0x359e4e[_0x100c('0x3f')]=_[_0x100c('0x40')](_0x359e4e[_0x100c('0x3a')],_0x359e4e['query']);_0x2368ff[_0x100c('0x42')]=_[_0x100c('0x40')](_0x359e4e[_0x100c('0x3a')],qs[_0x100c('0x41')](_0x1da0e0[_0x100c('0x3e')][_0x100c('0x41')]));_0x2368ff['attributes']=_0x2368ff[_0x100c('0x42')][_0x100c('0x43')]?_0x2368ff[_0x100c('0x42')]:_0x359e4e['model'];_0x2368ff[_0x100c('0x45')]=qs[_0x100c('0x46')](_0x1da0e0[_0x100c('0x3e')]['sort']);_0x2368ff['where']=qs['filters'](_[_0x100c('0x48')](_0x1da0e0[_0x100c('0x3e')],_0x359e4e['filters']));if(_0x1da0e0[_0x100c('0x3e')][_0x100c('0x33')]){_0x2368ff[_0x100c('0x47')]=_[_0x100c('0x49')](_0x2368ff[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x2368ff[_0x100c('0x42')],function(_0x1550a0){var _0x38fd7a={};_0x38fd7a[_0x1550a0]={'$like':'%'+_0x1da0e0[_0x100c('0x3e')][_0x100c('0x33')]+'%'};return _0x38fd7a;})});}_0x2368ff=_[_0x100c('0x49')]({},_0x2368ff,_0x1da0e0[_0x100c('0x4f')]);return _0x31c2ef[_0x100c('0xf7')](_0x2368ff);}})[_0x100c('0x1b')](function(_0x32fe53){if(_0x32fe53){_0x198c47=_0x32fe53[_0x100c('0x43')];if(!_0x1da0e0['query'][_0x100c('0xaf')](_0x100c('0x44'))){_0x2368ff[_0x100c('0x29')]=qs[_0x100c('0x29')](_0x1da0e0[_0x100c('0x3e')][_0x100c('0x29')]);_0x2368ff[_0x100c('0x28')]=qs[_0x100c('0x28')](_0x1da0e0[_0x100c('0x3e')][_0x100c('0x28')]);}return _0x31c2ef['getLists'](_0x2368ff);}})[_0x100c('0x1b')](function(_0x5ce87b){if(_0x5ce87b){return _0x5ce87b?{'count':_0x198c47,'rows':_0x5ce87b}:null;}})['then'](respondWithResult(_0x30a232,null))[_0x100c('0x23')](handleError(_0x30a232,null));};exports['getAgents']=function(_0x588aee,_0x1254f4,_0x588120){var _0x475f14={};var _0x2c71ce={};var _0xe9cfaa;var _0xd9bf8e;return db['User'][_0x100c('0x8a')]({'where':{'id':_0x588aee[_0x100c('0x59')]['id']}})[_0x100c('0x1b')](handleEntityNotFound(_0x1254f4,null))[_0x100c('0x1b')](function(_0x2e2ad6){if(_0x2e2ad6){_0xe9cfaa=_0x2e2ad6;_0x2c71ce[_0x100c('0x3a')]=_['keys'](db[_0x100c('0x39')][_0x100c('0x52')]);_0x2c71ce['query']=_['keys'](_0x588aee['query']);_0x2c71ce[_0x100c('0x3f')]=_['intersection'](_0x2c71ce['model'],_0x2c71ce[_0x100c('0x3e')]);_0x475f14[_0x100c('0x42')]=_['intersection'](_0x2c71ce['model'],qs[_0x100c('0x41')](_0x588aee[_0x100c('0x3e')]['fields']));_0x475f14[_0x100c('0x42')]=_0x475f14[_0x100c('0x42')][_0x100c('0x43')]?_0x475f14[_0x100c('0x42')]:_0x2c71ce[_0x100c('0x3a')];_0x475f14[_0x100c('0x45')]=qs['sort'](_0x588aee[_0x100c('0x3e')][_0x100c('0x46')]);_0x475f14[_0x100c('0x47')]=qs[_0x100c('0x3f')](_['pick'](_0x588aee[_0x100c('0x3e')],_0x2c71ce['filters']));if(_0x588aee['query'][_0x100c('0x33')]){_0x475f14[_0x100c('0x47')]=_[_0x100c('0x49')](_0x475f14[_0x100c('0x47')],{'$or':_[_0x100c('0x35')](_0x475f14['attributes'],function(_0xb50213){var _0x487c96={};_0x487c96[_0xb50213]={'$like':'%'+_0x588aee['query']['filter']+'%'};return _0x487c96;})});}_0x475f14[_0x100c('0x3a')]=db[_0x100c('0x39')];_0x475f14['as']=_0x100c('0x2f');_0x475f14=_['merge']({},_0x475f14,_0x588aee[_0x100c('0x4f')]);return _0xe9cfaa[_0x100c('0xf8')]({'include':[_0x475f14]});}})['then'](function(_0x5a844b){if(_0x5a844b){var _0x58a9a1={},_0x45e706=[],_0x24214f=0x0;for(var _0x476b06=0x0;_0x476b06<_0x5a844b[_0x100c('0x43')];_0x476b06+=0x1){for(var _0x6e268d=0x0,_0x45bfa2;_0x6e268d<_0x5a844b[_0x476b06]['Agents'][_0x100c('0x43')];_0x6e268d+=0x1){_0x45bfa2=_0x5a844b[_0x476b06][_0x100c('0x2f')][_0x6e268d]['get']({'plain':!![]});_0x58a9a1[_0x45bfa2['id']]=_0x45bfa2;}}_0x58a9a1=_['values'](_0x58a9a1);for(var _0x2d3821=qs[_0x100c('0x28')](_0x588aee['query'][_0x100c('0x28')]);_0x2d3821<_0x58a9a1[_0x100c('0x43')]&&_0x45e706['length']=_0x24f75[_0x0d8b('0x4e')]){throw new Error(_0x0d8b('0x4f'));}})[_0x0d8b('0xd')](function(){if(_0x156859){return db[_0x0d8b('0x2b')]['destroy']({'where':{'membername':_0x156859[_0x0d8b('0x27')]},'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x156859){return _0x156859['getVoiceQueues']({'raw':!![]});}})[_0x0d8b('0xd')](function(_0x105df9){if(_0x156859){if(_0x105df9){var _0x303d6=[];_0x40d265=_0x105df9;if(_0x40d265[_0x0d8b('0x2d')]){for(var _0x16141a=0x0;_0x16141a<_0x40d265[_0x0d8b('0x2d')];_0x16141a++){_0x303d6[_0x0d8b('0x2f')](db[_0x0d8b('0x2b')][_0x0d8b('0x50')]({'membername':_0x156859[_0x0d8b('0x27')],'UserId':_0x156859['id'],'queue_name':_0x40d265[_0x16141a][_0x0d8b('0x27')],'VoiceQueueId':_0x40d265[_0x16141a]['id'],'interface':_0x1ca60c,'paused':_0x156859[_0x0d8b('0x4a')]||![],'penalty':_0x40d265[_0x16141a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x0d8b('0x47')](_0x303d6);}}}})[_0x0d8b('0xd')](function(){if(_0x156859){return db[_0x0d8b('0x35')]['findAll']({'where':{'membername':_0x156859['name'],'exitAt':null}});}})[_0x0d8b('0xd')](function(_0x3aeb45){if(_0x156859){if(_0x3aeb45&&_0x3aeb45[_0x0d8b('0x2d')]){var _0x5b76af=[];_0x3aeb45['forEach'](function(_0x42de18){_0x5b76af[_0x0d8b('0x2f')](_0x42de18[_0x0d8b('0x2c')]({'exitAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31'))}));});return BPromise[_0x0d8b('0x47')](_0x5b76af);}}})[_0x0d8b('0xd')](function(_0x2c826b){if(_0x156859){var _0x20a3dd=[];var _0x3a5aea=[];var _0x195901=utils[_0x0d8b('0x51')]();var _0x3b060e={'membername':_0x156859['name'],'interface':_0x1ca60c,'enterAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'role':_0x156859['role'],'internal':_0x156859['internal']};_0x195901[_0x0d8b('0x2e')](function(_0x1dad9f){_0x20a3dd[_0x0d8b('0x2f')](_[_0x0d8b('0x52')]({'channel':_0x1dad9f,'type':_0x0d8b('0x53'),'data1':_0x0d8b('0x54'),'data2':_0x1ca60c},_0x3b060e));if(_0x156859['loginInPause']){_0x3a5aea['push'](_['merge']({'channel':_0x1dad9f,'type':_0x0d8b('0x44'),'data1':_0x0d8b('0x55')},_0x3b060e));}});return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x20a3dd[_0x0d8b('0x56')](_0x3a5aea),{'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x156859){return _0x156859['update']({'online':!![],'lastLoginAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'voicePause':_0x156859['loginInPause']||![],'mailPause':_0x156859[_0x0d8b('0x4a')]||![],'chatPause':_0x156859['loginInPause']||![],'faxPause':_0x156859[_0x0d8b('0x4a')]||![],'smsPause':_0x156859[_0x0d8b('0x4a')]||![],'openchannelPause':_0x156859[_0x0d8b('0x4a')]||![],'pauseType':_0x156859[_0x0d8b('0x4a')]?_0x0d8b('0x55'):null,'lastPauseAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'interface':_0x1ca60c});}})[_0x0d8b('0xd')](function(_0x391121){_0x435090(_0x391121);})[_0x0d8b('0x18')](function(_0x276558){_0x2ab72b(_0x70e4b2[_0x0d8b('0x14')](0x1f4,_0x276558['message']));});});}; \ No newline at end of file +var _0xb10b=['destroy','length','LoginUser','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','options','where','attributes','limit','include','map','model','ShowUser','find','raw','PauseUser','name','role','interface','UserVoiceQueueRt','MemberReport','findAll','format','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','update','system','chat','fax','sms','openchannel','set','Pause','all','LogoutUser'];(function(_0x3d51d1,_0x274138){var _0x11ad16=function(_0x832d39){while(--_0x832d39){_0x3d51d1['push'](_0x3d51d1['shift']());}};_0x11ad16(++_0x274138);}(_0xb10b,0x12a));var _0xbb10=function(_0x53ba30,_0x210d1e){_0x53ba30=_0x53ba30-0x0;var _0x46e47a=_0xb10b[_0x53ba30];return _0x46e47a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('User,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('User,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['findAll']({'raw':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x19f48d['options']?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x20')]||null:null,'attributes':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x21')]||null:null,'limit':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x22')]||null:null,'include':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x19f48d['options']['include'],function(_0x4fb5e0){return{'model':db[_0x4fb5e0[_0xbb10('0x25')]],'as':_0x4fb5e0['as'],'attributes':_0x4fb5e0[_0xbb10('0x21')],'include':_0x4fb5e0[_0xbb10('0x23')]?_['map'](_0x4fb5e0[_0xbb10('0x23')],function(_0x24d586){return{'model':db[_0x24d586[_0xbb10('0x25')]],'as':_0x24d586['as'],'attributes':_0x24d586[_0xbb10('0x21')],'include':_0x24d586[_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x24d586[_0xbb10('0x23')],function(_0x4aabb9){return{'model':db[_0x4aabb9[_0xbb10('0x25')]],'as':_0x4aabb9['as'],'attributes':_0x4aabb9[_0xbb10('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0x11')](function(_0x2e0249){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger['debug'](_0xbb10('0x1d'),_0x19f48d,JSON['stringify'](_0x2e0249));_0x109908(_0x2e0249);})[_0xbb10('0x1c')](function(_0x56f2da){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x56f2da[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x56f2da['message']));});});};exports[_0xbb10('0x26')]=function(_0x34f65e){var _0x4f590d=this;return new Promise(function(_0x359ad4,_0x37dde7){return db[_0xbb10('0x1e')][_0xbb10('0x27')]({'raw':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x28')]===undefined?!![]:![]:!![],'where':_0x34f65e['options']?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x20')]||null:null,'attributes':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x21')]||null:null,'include':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x34f65e['options'][_0xbb10('0x23')],function(_0x150107){return{'model':db[_0x150107[_0xbb10('0x25')]],'as':_0x150107['as'],'attributes':_0x150107[_0xbb10('0x21')],'include':_0x150107['include']?_[_0xbb10('0x24')](_0x150107['include'],function(_0x4e2754){return{'model':db[_0x4e2754[_0xbb10('0x25')]],'as':_0x4e2754['as'],'attributes':_0x4e2754[_0xbb10('0x21')],'include':_0x4e2754[_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x4e2754[_0xbb10('0x23')],function(_0x29d11a){return{'model':db[_0x29d11a['model']],'as':_0x29d11a['as'],'attributes':_0x29d11a[_0xbb10('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0x11')](function(_0x52de31){logger['info']('ShowUser',_0x34f65e);logger[_0xbb10('0x14')](_0xbb10('0x26'),_0x34f65e,JSON[_0xbb10('0x16')](_0x52de31));_0x359ad4(_0x52de31);})['catch'](function(_0x3c0cd7){logger[_0xbb10('0x17')](_0xbb10('0x26'),_0x3c0cd7['message'],_0x34f65e);_0x37dde7(_0x4f590d[_0xbb10('0x17')](0x1f4,_0x3c0cd7[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x29')]=function(_0x446f49){var _0x4f1cdd=this;return new Promise(function(_0xd238e9,_0x110eb5){var _0x5835fd;return db[_0xbb10('0x1e')][_0xbb10('0x27')]({'where':_0x446f49[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a'),_0xbb10('0x2b'),'internal',_0xbb10('0x2c')]})[_0xbb10('0x11')](function(_0x3e7b4c){if(_0x3e7b4c){_0x5835fd=_0x3e7b4c;return db[_0xbb10('0x2d')]['update']({'paused':0x1},{'where':{'UserId':_0x5835fd['id']},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0x5835fd){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x5835fd[_0xbb10('0x2a')],'type':'PAUSE','exitAt':null}});}})[_0xbb10('0x11')](function(_0x202c60){if(_0x5835fd){if(_0x202c60&&_0x202c60['length']){var _0x5d9a4f=moment()[_0xbb10('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x318984=0x0,_0x180933=_0x202c60['length'];_0x318984<_0x180933;_0x318984++){_0x202c60[_0x318984][_0xbb10('0x31')]({'exitAt':_0x5d9a4f});}}}})[_0xbb10('0x11')](function(){if(_0x5835fd){var _0x474e99=[];var _0x5cf4f8=utils[_0xbb10('0x32')]();_0x5cf4f8[_0xbb10('0x33')](function(_0x3b9fdf){_0x474e99[_0xbb10('0x34')]({'channel':_0x3b9fdf,'membername':_0x5835fd[_0xbb10('0x2a')],'interface':_[_0xbb10('0x35')](_0x5835fd[_0xbb10('0x2c')])?util[_0xbb10('0x30')](_0xbb10('0x36'),_0x5835fd[_0xbb10('0x2a')]):_0x5835fd[_0xbb10('0x2c')],'type':_0xbb10('0x37'),'enterAt':moment()['format'](_0xbb10('0x38')),'data1':_0x446f49[_0xbb10('0x39')]['type']||_0xbb10('0x3a'),'role':_0x5835fd[_0xbb10('0x2b')],'internal':_0x5835fd[_0xbb10('0x3b')],'uniqueid':_0x446f49[_0xbb10('0x39')][_0xbb10('0x3c')]||null});});return db[_0xbb10('0x2e')][_0xbb10('0x3d')](_0x474e99,{'individualHooks':!![]});}})['then'](function(){if(_0x5835fd){return _0x5835fd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x446f49[_0xbb10('0x39')][_0xbb10('0x3e')]||_0xbb10('0x3a'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbb10('0x11')](function(_0x34cf4e){_0xd238e9(_0x34cf4e);})[_0xbb10('0x1c')](function(_0xf820fe){_0x110eb5(_0x4f1cdd[_0xbb10('0x17')](0x1f4,_0xf820fe[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x3f')]=function(_0x460788){var _0x2626d8=this;return new Promise(function(_0x3d7e7e,_0x550111){var _0x5eafac;return db[_0xbb10('0x1e')][_0xbb10('0x40')]({'where':_0x460788[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a')]})[_0xbb10('0x11')](function(_0x358e7e){if(_0x358e7e){_0x5eafac=_0x358e7e;if(_0x460788[_0xbb10('0x39')][_0xbb10('0x41')]&&!utils[_0xbb10('0x42')](_0x460788[_0xbb10('0x39')][_0xbb10('0x41')])){throw new Error(_0xbb10('0x43'));}switch(_0x460788[_0xbb10('0x39')][_0xbb10('0x41')]){case'voice':return db[_0xbb10('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5eafac['id']}})[_0xbb10('0x11')](function(){return db[_0xbb10('0x2e')][_0xbb10('0x27')]({'where':{'channel':_0x460788[_0xbb10('0x39')][_0xbb10('0x41')],'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}});})[_0xbb10('0x11')](function(_0x180400){if(_0x180400){return _0x180400[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'data2':_0xbb10('0x45')},{'individualHooks':!![]});}return null;})[_0xbb10('0x11')](function(){return _0x5eafac[_0xbb10('0x44')]({'voicePause':![]});});case'mail':case _0xbb10('0x46'):case _0xbb10('0x47'):case _0xbb10('0x48'):case _0xbb10('0x49'):return db[_0xbb10('0x2e')][_0xbb10('0x27')]({'where':{'channel':_0x460788['body'][_0xbb10('0x41')],'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}})[_0xbb10('0x11')](function(_0x432728){return _0x432728[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'data2':_0xbb10('0x45')},{'individualHooks':!![]});})[_0xbb10('0x11')](function(){var _0x2eb05a={};_[_0xbb10('0x4a')](_0x2eb05a,util[_0xbb10('0x30')]('%s%s',_0x460788['body'][_0xbb10('0x41')],_0xbb10('0x4b')),![]);return _0x5eafac[_0xbb10('0x44')](_0x2eb05a);});default:return db[_0xbb10('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5eafac['id']}})['then'](function(){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}});})[_0xbb10('0x11')](function(_0x3e9753){var _0x45c0dc=[];_0x3e9753['forEach'](function(_0x117e84){_0x45c0dc[_0xbb10('0x34')](_0x117e84['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xbb10('0x45')}));});return BPromise[_0xbb10('0x4c')](_0x45c0dc);})[_0xbb10('0x11')](function(){return _0x5eafac['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x5846d1){_0x3d7e7e(_0x5846d1);})[_0xbb10('0x1c')](function(_0x249b33){_0x550111(_0x2626d8[_0xbb10('0x17')](0x1f4,_0x249b33['message']));});});};exports[_0xbb10('0x4d')]=function(_0x13131c){var _0x5a6538=this;return new Promise(function(_0x4a560c,_0x27d7b9){var _0x308896;return db[_0xbb10('0x1e')][_0xbb10('0x40')]({'where':_0x13131c['options'][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a')]})[_0xbb10('0x11')](function(_0x5202d7){if(_0x5202d7){_0x308896=_0x5202d7;return db[_0xbb10('0x2d')][_0xbb10('0x4e')]({'where':{'membername':_0x308896[_0xbb10('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x308896){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x308896[_0xbb10('0x2a')],'exitAt':null}});}})[_0xbb10('0x11')](function(_0x5e4a6e){if(_0x308896){if(_0x5e4a6e&&_0x5e4a6e[_0xbb10('0x4f')]){var _0x258e55=[];_0x5e4a6e[_0xbb10('0x33')](function(_0x2d0f4b){_0x258e55['push'](_0x2d0f4b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x258e55);}}})[_0xbb10('0x11')](function(){if(_0x308896){return _0x308896[_0xbb10('0x44')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbb10('0x11')](function(_0x4a30c5){_0x4a560c(_0x4a30c5);})['catch'](function(_0x5acd5e){_0x27d7b9(_0x5a6538[_0xbb10('0x17')](0x1f4,_0x5acd5e[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x50')]=function(_0x5c9afc){var _0x5cd089=this;return new Promise(function(_0x46f462,_0x1b11c0){var _0xd9e743;var _0x3a9677;var _0x260e06;var _0x1ad2ed;return db['User'][_0xbb10('0x40')]({'where':_0x5c9afc[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a'),_0xbb10('0x2b'),'mobile','phone','internal',_0xbb10('0x51'),_0xbb10('0x2c')]})[_0xbb10('0x11')](function(_0x21459e){if(_0x21459e){_0xd9e743=_0x21459e;_0x1ad2ed=_0x5c9afc[_0xbb10('0x39')][_0xbb10('0x2c')]?_0x5c9afc['body'][_0xbb10('0x2c')]:util['format']('SIP/%s',_0xd9e743['name']);return db[_0xbb10('0x1e')][_0xbb10('0x52')]({'where':{'role':_0xbb10('0x53'),'online':!![],'id':{'$ne':_0xd9e743['id']}}});}})[_0xbb10('0x11')](function(_0x5ce94f){if(_0x5ce94f){_0x260e06=_0x5ce94f;return require(_0xbb10('0x54'))['getLicense']();}})['then'](function(_0x165fe9){if(_0x165fe9&&_0x165fe9[_0xbb10('0x55')]&&_0x260e06>=_0x165fe9[_0xbb10('0x55')]){throw new Error(_0xbb10('0x56'));}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db['UserVoiceQueueRt'][_0xbb10('0x4e')]({'where':{'membername':_0xd9e743[_0xbb10('0x2a')]},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743[_0xbb10('0x57')]({'raw':!![]});}})[_0xbb10('0x11')](function(_0x27f42f){if(_0xd9e743){if(_0x27f42f){var _0x174395=[];_0x3a9677=_0x27f42f;if(_0x3a9677['length']){for(var _0x387b10=0x0;_0x387b10<_0x3a9677[_0xbb10('0x4f')];_0x387b10++){_0x174395[_0xbb10('0x34')](db[_0xbb10('0x2d')][_0xbb10('0x58')]({'membername':_0xd9e743[_0xbb10('0x2a')],'UserId':_0xd9e743['id'],'queue_name':_0x3a9677[_0x387b10][_0xbb10('0x2a')],'VoiceQueueId':_0x3a9677[_0x387b10]['id'],'interface':_0x1ad2ed,'paused':_0xd9e743[_0xbb10('0x51')]||![],'penalty':_0x3a9677[_0x387b10]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xbb10('0x4c')](_0x174395);}}}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db[_0xbb10('0x2e')]['findAll']({'where':{'membername':_0xd9e743['name'],'exitAt':null}});}})['then'](function(_0x23286d){if(_0xd9e743){if(_0x23286d&&_0x23286d['length']){var _0x4e3d6a=[];_0x23286d[_0xbb10('0x33')](function(_0x3ee56b){_0x4e3d6a[_0xbb10('0x34')](_0x3ee56b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x4e3d6a);}}})[_0xbb10('0x11')](function(_0x188b97){if(_0xd9e743){var _0x5206e1=[];var _0x318a14=[];var _0x1351eb=utils[_0xbb10('0x32')]();var _0x35b811={'membername':_0xd9e743['name'],'interface':_0x1ad2ed,'enterAt':moment()['format'](_0xbb10('0x38')),'role':_0xd9e743[_0xbb10('0x2b')],'internal':_0xd9e743[_0xbb10('0x3b')]};_0x1351eb[_0xbb10('0x33')](function(_0x5ee705){_0x5206e1[_0xbb10('0x34')](_[_0xbb10('0x59')]({'channel':_0x5ee705,'type':_0xbb10('0x5a'),'data1':_0xbb10('0x5b'),'data2':_0x1ad2ed},_0x35b811));if(_0xd9e743[_0xbb10('0x51')]){_0x318a14['push'](_['merge']({'channel':_0x5ee705,'type':_0xbb10('0x37'),'data1':_0xbb10('0x5c')},_0x35b811));}});return db[_0xbb10('0x2e')]['bulkCreate'](_0x5206e1[_0xbb10('0x5d')](_0x318a14),{'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743['update']({'online':!![],'lastLoginAt':moment()['format'](_0xbb10('0x38')),'voicePause':_0xd9e743[_0xbb10('0x51')]||![],'mailPause':_0xd9e743[_0xbb10('0x51')]||![],'chatPause':_0xd9e743['loginInPause']||![],'faxPause':_0xd9e743[_0xbb10('0x51')]||![],'smsPause':_0xd9e743[_0xbb10('0x51')]||![],'openchannelPause':_0xd9e743[_0xbb10('0x51')]||![],'pauseType':_0xd9e743[_0xbb10('0x51')]?_0xbb10('0x5c'):null,'lastPauseAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'interface':_0x1ad2ed});}})[_0xbb10('0x11')](function(_0x3e6246){_0x46f462(_0x3e6246);})['catch'](function(_0x3367d4){_0x1b11c0(_0x5cd089[_0xbb10('0x17')](0x1f4,_0x3367d4[_0xbb10('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7b0af97..fee6b04 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 _0x5032=['remove','update','emit','register','user:','./user.events'];(function(_0x529752,_0x8fc979){var _0x225252=function(_0x5f046a){while(--_0x5f046a){_0x529752['push'](_0x529752['shift']());}};_0x225252(++_0x8fc979);}(_0x5032,0x7d));var _0x2503=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5032[_0x3bf83f];return _0x22c4a9;};'use strict';var UserEvents=require(_0x2503('0x0'));var events=['save',_0x2503('0x1'),_0x2503('0x2')];function createListener(_0x32a167,_0xbff00d){return function(_0x325cb8){_0xbff00d[_0x2503('0x3')](_0x32a167,_0x325cb8);};}function removeListener(_0x18fff4,_0x4b9c0e){return function(){UserEvents['removeListener'](_0x18fff4,_0x4b9c0e);};}exports[_0x2503('0x4')]=function(_0x3c5614){for(var _0x308b22=0x0,_0x4c2ba8=events['length'];_0x308b22<_0x4c2ba8;_0x308b22++){var _0x84793=events[_0x308b22];var _0x46eae8=createListener(_0x2503('0x5')+_0x84793,_0x3c5614);UserEvents['on'](_0x84793,_0x46eae8);}}; \ No newline at end of file +var _0x800f=['user:','./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x20ed00,_0x2232cc){var _0x3053da=function(_0x489b5b){while(--_0x489b5b){_0x20ed00['push'](_0x20ed00['shift']());}};_0x3053da(++_0x2232cc);}(_0x800f,0x12a));var _0xf800=function(_0x56f20a,_0x6caa6a){_0x56f20a=_0x56f20a-0x0;var _0x55e98a=_0x800f[_0x56f20a];return _0x55e98a;};'use strict';var UserEvents=require(_0xf800('0x0'));var events=[_0xf800('0x1'),_0xf800('0x2'),_0xf800('0x3')];function createListener(_0x43c65c,_0x451167){return function(_0x28ecf6){_0x451167[_0xf800('0x4')](_0x43c65c,_0x28ecf6);};}function removeListener(_0x5c7027,_0x35f000){return function(){UserEvents[_0xf800('0x5')](_0x5c7027,_0x35f000);};}exports[_0xf800('0x6')]=function(_0xa388e8){for(var _0x36d640=0x0,_0x1345a4=events[_0xf800('0x7')];_0x36d640<_0x1345a4;_0x36d640++){var _0x2330b2=events[_0x36d640];var _0x47f16c=createListener(_0xf800('0x8')+_0x2330b2,_0xa388e8);UserEvents['on'](_0x2330b2,_0x47f16c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9193623..99f9154 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 _0x7c1a=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x185a5a,_0x19442b){var _0x39bd2d=function(_0xfe0213){while(--_0xfe0213){_0x185a5a['push'](_0x185a5a['shift']());}};_0x39bd2d(++_0x19442b);}(_0x7c1a,0x159));var _0xa7c1=function(_0x46cb7e,_0x4818ad){_0x46cb7e=_0x46cb7e-0x0;var _0x47cfe7=_0x7c1a[_0x46cb7e];return _0x47cfe7;};'use strict';var multer=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var path=require(_0xa7c1('0x2'));var timeout=require(_0xa7c1('0x3'));var express=require(_0xa7c1('0x4'));var router=express[_0xa7c1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7c1('0x6'));var config=require(_0xa7c1('0x7'));module['exports']=router; \ No newline at end of file +var _0x8ace=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x188650,_0xc40d8){_0x188650=_0x188650-0x0;var _0x4db216=_0x8ace[_0x188650];return _0x4db216;};'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'));module[_0xe8ac('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ef9e687..6ba5a33 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 _0xbc74=['exports','sequelize'];(function(_0x1a1d4a,_0x48ef2b){var _0x44fda1=function(_0x1c68b9){while(--_0x1c68b9){_0x1a1d4a['push'](_0x1a1d4a['shift']());}};_0x44fda1(++_0x48ef2b);}(_0xbc74,0xe3));var _0x4bc7=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xbc74[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0x4bc7('0x0'));module[_0x4bc7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd26a=['exports'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xd26a,0x164));var _0xad26=function(_0x55c31d,_0x343c9c){_0x55c31d=_0x55c31d-0x0;var _0x4315a5=_0xd26a[_0x55c31d];return _0x4315a5;};'use strict';var Sequelize=require('sequelize');module[_0xad26('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 17ab628..a560320 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 _0x08cb=['api','bluebird','request-promise','path','rimraf','../../config/environment','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x318a79,_0x3ae74e){var _0x1ba6a9=function(_0x5e7c32){while(--_0x5e7c32){_0x318a79['push'](_0x318a79['shift']());}};_0x1ba6a9(++_0x3ae74e);}(_0x08cb,0x166));var _0xb08c=function(_0x35358b,_0x35d6a2){_0x35358b=_0x35358b-0x0;var _0x27bbbf=_0x08cb[_0x35358b];return _0x27bbbf;};'use strict';var _=require(_0xb08c('0x0'));var util=require(_0xb08c('0x1'));var logger=require('../../config/logger')(_0xb08c('0x2'));var moment=require('moment');var BPromise=require(_0xb08c('0x3'));var rp=require(_0xb08c('0x4'));var fs=require('fs');var path=require(_0xb08c('0x5'));var rimraf=require(_0xb08c('0x6'));var config=require(_0xb08c('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x5e48ae,_0x93c040){return _0x5e48ae['define'](_0xb08c('0x8'),attributes,{'tableName':_0xb08c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e04=['request-promise','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','../../config/logger','api','bluebird'];(function(_0x548912,_0x53ecdc){var _0x535454=function(_0x1fab63){while(--_0x1fab63){_0x548912['push'](_0x548912['shift']());}};_0x535454(++_0x53ecdc);}(_0x8e04,0x1e3));var _0x48e0=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x8e04[_0x2bc8e0];return _0xca8f97;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x48e0('0x0'))(_0x48e0('0x1'));var moment=require('moment');var BPromise=require(_0x48e0('0x2'));var rp=require(_0x48e0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48e0('0x4'));var config=require('../../config/environment');var attributes=require(_0x48e0('0x5'));module['exports']=function(_0x2c15fa,_0x3a898c){return _0x2c15fa[_0x48e0('0x6')](_0x48e0('0x7'),attributes,{'tableName':_0x48e0('0x8'),'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 5599da6..0e70d73 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 _0xba92=['client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xba92,0xe9));var _0x2ba9=function(_0x1a0e49,_0xce6d18){_0x1a0e49=_0x1a0e49-0x0;var _0x3e3a4b=_0xba92[_0x1a0e49];return _0x3e3a4b;};'use strict';var _=require(_0x2ba9('0x0'));var util=require(_0x2ba9('0x1'));var moment=require(_0x2ba9('0x2'));var BPromise=require(_0x2ba9('0x3'));var rs=require(_0x2ba9('0x4'));var fs=require('fs');var Redis=require(_0x2ba9('0x5'));var db=require(_0x2ba9('0x6'))['db'];var utils=require(_0x2ba9('0x7'));var logger=require('../../config/logger')(_0x2ba9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2ba9('0x9')][_0x2ba9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2816ed,_0x14f923,_0x489ed7){return new BPromise(function(_0x12d624,_0x350479){return client[_0x2ba9('0xb')](_0x2816ed,_0x489ed7)[_0x2ba9('0xc')](function(_0xfb4241){logger[_0x2ba9('0xd')](_0x2ba9('0xe'),_0x14f923,_0x2ba9('0xf'));logger[_0x2ba9('0x10')](_0x2ba9('0x11'),_0x14f923,_0x2ba9('0xf'),JSON[_0x2ba9('0x12')](_0xfb4241));if(_0xfb4241[_0x2ba9('0x13')]){if(_0xfb4241['error']['code']===0x1f4){logger['error'](_0x2ba9('0xe'),_0x14f923,_0xfb4241[_0x2ba9('0x13')][_0x2ba9('0x14')]);return _0x350479(_0xfb4241[_0x2ba9('0x13')]['message']);}logger[_0x2ba9('0x13')](_0x2ba9('0xe'),_0x14f923,_0xfb4241[_0x2ba9('0x13')][_0x2ba9('0x14')]);return _0x12d624(_0xfb4241[_0x2ba9('0x13')][_0x2ba9('0x14')]);}else{logger[_0x2ba9('0xd')](_0x2ba9('0xe'),_0x14f923,_0x2ba9('0xf'));_0x12d624(_0xfb4241['result'][_0x2ba9('0x14')]);}})[_0x2ba9('0x15')](function(_0x3c8edc){logger[_0x2ba9('0x13')](_0x2ba9('0xe'),_0x14f923,_0x3c8edc);_0x350479(_0x3c8edc);});});} \ No newline at end of file +var _0x25d5=['../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','debug','error','message','info','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2f4408,_0x317c92){var _0x394be0=function(_0x2207a5){while(--_0x2207a5){_0x2f4408['push'](_0x2f4408['shift']());}};_0x394be0(++_0x317c92);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x525d('0x0'));var util=require('util');var moment=require(_0x525d('0x1'));var BPromise=require('bluebird');var rs=require(_0x525d('0x2'));var fs=require('fs');var Redis=require(_0x525d('0x3'));var db=require(_0x525d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x525d('0x5'))(_0x525d('0x6'));var config=require(_0x525d('0x7'));var jayson=require(_0x525d('0x8'));var client=jayson['client'][_0x525d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x273141,_0x1a0233,_0x260f76){return new BPromise(function(_0x289b02,_0x119257){return client[_0x525d('0xa')](_0x273141,_0x260f76)[_0x525d('0xb')](function(_0x127ecf){logger['info'](_0x525d('0xc'),_0x1a0233,'request\x20sent');logger[_0x525d('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1a0233,'request\x20sent',JSON['stringify'](_0x127ecf));if(_0x127ecf[_0x525d('0xe')]){if(_0x127ecf[_0x525d('0xe')]['code']===0x1f4){logger[_0x525d('0xe')](_0x525d('0xc'),_0x1a0233,_0x127ecf[_0x525d('0xe')]['message']);return _0x119257(_0x127ecf[_0x525d('0xe')][_0x525d('0xf')]);}logger[_0x525d('0xe')](_0x525d('0xc'),_0x1a0233,_0x127ecf['error'][_0x525d('0xf')]);return _0x289b02(_0x127ecf[_0x525d('0xe')][_0x525d('0xf')]);}else{logger[_0x525d('0x10')](_0x525d('0xc'),_0x1a0233,_0x525d('0x11'));_0x289b02(_0x127ecf[_0x525d('0x12')][_0x525d('0xf')]);}})['catch'](function(_0x51dfca){logger[_0x525d('0xe')](_0x525d('0xc'),_0x1a0233,_0x51dfca);_0x119257(_0x51dfca);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0af94e3..553b47d 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 _0x002d=['../../config/environment','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x252d7e,_0x20a71c){var _0x2afaba=function(_0x56422a){while(--_0x56422a){_0x252d7e['push'](_0x252d7e['shift']());}};_0x2afaba(++_0x20a71c);}(_0x002d,0xca));var _0xd002=function(_0x2c1611,_0x538f07){_0x2c1611=_0x2c1611-0x0;var _0x2b8dc7=_0x002d[_0x2c1611];return _0x2b8dc7;};'use strict';var multer=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var path=require(_0xd002('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd002('0x3')]();var auth=require(_0xd002('0x4'));var interaction=require(_0xd002('0x5'));var config=require(_0xd002('0x6'));module[_0xd002('0x7')]=router; \ No newline at end of file +var _0xe9e7=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42c2f7,_0x16bbdd){var _0x55c3ae=function(_0x24502f){while(--_0x24502f){_0x42c2f7['push'](_0x42c2f7['shift']());}};_0x55c3ae(++_0x16bbdd);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x4d74fd,_0x2f27d0){_0x4d74fd=_0x4d74fd-0x0;var _0x4fb861=_0xe9e7[_0x4d74fd];return _0x4fb861;};'use strict';var multer=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var path=require(_0x7e9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e9e('0x3'));var router=express[_0x7e9e('0x4')]();var auth=require(_0x7e9e('0x5'));var interaction=require(_0x7e9e('0x6'));var config=require(_0x7e9e('0x7'));module[_0x7e9e('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d81b4dc..c4c6c37 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 _0xbf73=['sequelize','exports','INTEGER','STRING'];(function(_0x5aa223,_0x2ca37d){var _0x5265a4=function(_0x3d155d){while(--_0x3d155d){_0x5aa223['push'](_0x5aa223['shift']());}};_0x5265a4(++_0x2ca37d);}(_0xbf73,0xa0));var _0x3bf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf73[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3bf7('0x0'));module[_0x3bf7('0x1')]={'penalty':{'type':Sequelize[_0x3bf7('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3bf7('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3bf7('0x3')]}}; \ No newline at end of file +var _0xb8dc=['sequelize','exports','INTEGER'];(function(_0x1f2488,_0x2ff33b){var _0x2434ac=function(_0x2e92ba){while(--_0x2e92ba){_0x1f2488['push'](_0x1f2488['shift']());}};_0x2434ac(++_0x2ff33b);}(_0xb8dc,0x159));var _0xcb8d=function(_0x5869dc,_0x3fa849){_0x5869dc=_0x5869dc-0x0;var _0x98ce9c=_0xb8dc[_0x5869dc];return _0x98ce9c;};'use strict';var Sequelize=require(_0xcb8d('0x0'));module[_0xcb8d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb8d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c13b195..62c73d6 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 _0x4160=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','path','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x44db58,_0x4656b8){var _0x33ffc4=function(_0x450bdb){while(--_0x450bdb){_0x44db58['push'](_0x44db58['shift']());}};_0x33ffc4(++_0x4656b8);}(_0x4160,0x1cf));var _0x0416=function(_0x146e94,_0x4c9e0d){_0x146e94=_0x146e94-0x0;var _0x2fe8ef=_0x4160[_0x146e94];return _0x2fe8ef;};'use strict';var _=require(_0x0416('0x0'));var util=require(_0x0416('0x1'));var logger=require(_0x0416('0x2'))(_0x0416('0x3'));var moment=require(_0x0416('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0416('0x5'));var rimraf=require('rimraf');var config=require(_0x0416('0x6'));var attributes=require(_0x0416('0x7'));module[_0x0416('0x8')]=function(_0x129fea,_0x14710d){return _0x129fea[_0x0416('0x9')]('UserFaxQueue',attributes,{'tableName':_0x0416('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5326=['exports','UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x5326,0x1d6));var _0x6532=function(_0x16b55f,_0x301c6c){_0x16b55f=_0x16b55f-0x0;var _0x391c2f=_0x5326[_0x16b55f];return _0x391c2f;};'use strict';var _=require(_0x6532('0x0'));var util=require(_0x6532('0x1'));var logger=require(_0x6532('0x2'))(_0x6532('0x3'));var moment=require(_0x6532('0x4'));var BPromise=require(_0x6532('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6532('0x6'));var rimraf=require(_0x6532('0x7'));var config=require(_0x6532('0x8'));var attributes=require(_0x6532('0x9'));module[_0x6532('0xa')]=function(_0x3cd199,_0x15ec5c){return _0x3cd199['define'](_0x6532('0xb'),attributes,{'tableName':'user_has_fax_queues','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 fb95e90..7bf3151 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 _0x24c5=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x48be7d,_0x2781f3){var _0x331ba1=function(_0x481213){while(--_0x481213){_0x48be7d['push'](_0x48be7d['shift']());}};_0x331ba1(++_0x2781f3);}(_0x24c5,0xf7));var _0x524c=function(_0x1e4822,_0x2b64eb){_0x1e4822=_0x1e4822-0x0;var _0x3a2814=_0x24c5[_0x1e4822];return _0x3a2814;};'use strict';var _=require(_0x524c('0x0'));var util=require(_0x524c('0x1'));var moment=require(_0x524c('0x2'));var BPromise=require(_0x524c('0x3'));var rs=require(_0x524c('0x4'));var fs=require('fs');var Redis=require(_0x524c('0x5'));var db=require(_0x524c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x524c('0x7'))(_0x524c('0x8'));var config=require('../../config/environment');var jayson=require(_0x524c('0x9'));var client=jayson[_0x524c('0xa')][_0x524c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d81f,_0x55855e,_0x4ede6b){return new BPromise(function(_0x4e44ab,_0x16f5dc){return client[_0x524c('0xc')](_0x17d81f,_0x4ede6b)[_0x524c('0xd')](function(_0x18ee49){logger[_0x524c('0xe')](_0x524c('0xf'),_0x55855e,_0x524c('0x10'));logger[_0x524c('0x11')](_0x524c('0x12'),_0x55855e,'request\x20sent',JSON['stringify'](_0x18ee49));if(_0x18ee49['error']){if(_0x18ee49['error'][_0x524c('0x13')]===0x1f4){logger['error'](_0x524c('0xf'),_0x55855e,_0x18ee49[_0x524c('0x14')][_0x524c('0x15')]);return _0x16f5dc(_0x18ee49[_0x524c('0x14')][_0x524c('0x15')]);}logger[_0x524c('0x14')](_0x524c('0xf'),_0x55855e,_0x18ee49['error'][_0x524c('0x15')]);return _0x4e44ab(_0x18ee49['error'][_0x524c('0x15')]);}else{logger[_0x524c('0xe')](_0x524c('0xf'),_0x55855e,'request\x20sent');_0x4e44ab(_0x18ee49['result'][_0x524c('0x15')]);}})[_0x524c('0x16')](function(_0xc94681){logger[_0x524c('0x14')](_0x524c('0xf'),_0x55855e,_0xc94681);_0x16f5dc(_0xc94681);});});} \ No newline at end of file +var _0x9952=['UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0xca8132,_0xeffaf9){var _0x5ceee0=function(_0x1b9f23){while(--_0x1b9f23){_0xca8132['push'](_0xca8132['shift']());}};_0x5ceee0(++_0xeffaf9);}(_0x9952,0x11c));var _0x2995=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x9952[_0x5a1a51];return _0x47edd7;};'use strict';var _=require(_0x2995('0x0'));var util=require(_0x2995('0x1'));var moment=require(_0x2995('0x2'));var BPromise=require(_0x2995('0x3'));var rs=require(_0x2995('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2995('0x5'))['db'];var utils=require(_0x2995('0x6'));var logger=require(_0x2995('0x7'))(_0x2995('0x8'));var config=require(_0x2995('0x9'));var jayson=require(_0x2995('0xa'));var client=jayson[_0x2995('0xb')][_0x2995('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x355d73,_0x32de11,_0x28863d){return new BPromise(function(_0x1ac14a,_0x12ba0f){return client['request'](_0x355d73,_0x28863d)[_0x2995('0xd')](function(_0xff8244){logger[_0x2995('0xe')](_0x2995('0xf'),_0x32de11,'request\x20sent');logger[_0x2995('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x32de11,'request\x20sent',JSON[_0x2995('0x11')](_0xff8244));if(_0xff8244[_0x2995('0x12')]){if(_0xff8244[_0x2995('0x12')]['code']===0x1f4){logger[_0x2995('0x12')](_0x2995('0xf'),_0x32de11,_0xff8244[_0x2995('0x12')][_0x2995('0x13')]);return _0x12ba0f(_0xff8244['error'][_0x2995('0x13')]);}logger[_0x2995('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x32de11,_0xff8244[_0x2995('0x12')][_0x2995('0x13')]);return _0x1ac14a(_0xff8244[_0x2995('0x12')]['message']);}else{logger[_0x2995('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x32de11,_0x2995('0x14'));_0x1ac14a(_0xff8244[_0x2995('0x15')][_0x2995('0x13')]);}})[_0x2995('0x16')](function(_0xf7c818){logger[_0x2995('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x32de11,_0xf7c818);_0x12ba0f(_0xf7c818);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0bcf093..8c7d654 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 _0xeda8=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1dd76a,_0x133a8a){var _0x2ed375=function(_0x598135){while(--_0x598135){_0x1dd76a['push'](_0x1dd76a['shift']());}};_0x2ed375(++_0x133a8a);}(_0xeda8,0x104));var _0x8eda=function(_0x3095be,_0x2dd50f){_0x3095be=_0x3095be-0x0;var _0x5f3c02=_0xeda8[_0x3095be];return _0x5f3c02;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));module[_0x8eda('0x8')]=router; \ No newline at end of file +var _0x84e7=['../../components/interaction/service','../../config/environment','exports','util','path','express','Router'];(function(_0x259264,_0xfe2f1f){var _0x333ff4=function(_0x366e5c){while(--_0x366e5c){_0x259264['push'](_0x259264['shift']());}};_0x333ff4(++_0xfe2f1f);}(_0x84e7,0x122));var _0x784e=function(_0xccbd69,_0x500cc0){_0xccbd69=_0xccbd69-0x0;var _0x2791bd=_0x84e7[_0xccbd69];return _0x2791bd;};'use strict';var multer=require('multer');var util=require(_0x784e('0x0'));var path=require(_0x784e('0x1'));var timeout=require('connect-timeout');var express=require(_0x784e('0x2'));var router=express[_0x784e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x784e('0x4'));var config=require(_0x784e('0x5'));module[_0x784e('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index b161a1d..74d9e0f 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 _0xd090=['exports','INTEGER'];(function(_0x27b8fc,_0x204258){var _0x3e3787=function(_0x52c408){while(--_0x52c408){_0x27b8fc['push'](_0x27b8fc['shift']());}};_0x3e3787(++_0x204258);}(_0xd090,0x158));var _0x0d09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd090[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x0d09('0x0')]={'penalty':{'type':Sequelize[_0x0d09('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcbb0=['exports','INTEGER','sequelize'];(function(_0x5238b0,_0x318fc5){var _0x44ba69=function(_0x4e3306){while(--_0x4e3306){_0x5238b0['push'](_0x5238b0['shift']());}};_0x44ba69(++_0x318fc5);}(_0xcbb0,0x86));var _0x0cbb=function(_0x108349,_0x3029c2){_0x108349=_0x108349-0x0;var _0x450e2d=_0xcbb0[_0x108349];return _0x450e2d;};'use strict';var Sequelize=require(_0x0cbb('0x0'));module[_0x0cbb('0x1')]={'penalty':{'type':Sequelize[_0x0cbb('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 9c36d79..1460170 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 _0x7096=['exports','define','UserMailQueue','user_has_mail_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0x7096,0x10c));var _0x6709=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7096[_0x397e5f];return _0x5302b8;};'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':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x30dba7,_0x2fb710){var _0x1a9a83=function(_0x1a2043){while(--_0x1a2043){_0x30dba7['push'](_0x30dba7['shift']());}};_0x1a9a83(++_0x2fb710);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xbd6700,_0x554bf1){_0xbd6700=_0xbd6700-0x0;var _0x533f02=_0xc1c6[_0xbd6700];return _0x533f02;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 986c043..8c806dd 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 _0x0f05=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x0f05,0x7d));var _0x50f0=function(_0x1703c9,_0x60fb3c){_0x1703c9=_0x1703c9-0x0;var _0x300cf7=_0x0f05[_0x1703c9];return _0x300cf7;};'use strict';var _=require(_0x50f0('0x0'));var util=require('util');var moment=require(_0x50f0('0x1'));var BPromise=require(_0x50f0('0x2'));var rs=require(_0x50f0('0x3'));var fs=require('fs');var Redis=require(_0x50f0('0x4'));var db=require(_0x50f0('0x5'))['db'];var utils=require(_0x50f0('0x6'));var logger=require(_0x50f0('0x7'))(_0x50f0('0x8'));var config=require(_0x50f0('0x9'));var jayson=require(_0x50f0('0xa'));var client=jayson[_0x50f0('0xb')][_0x50f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x510af2,_0x3d2bfa,_0x5bf267){return new BPromise(function(_0xf36c8d,_0x389438){return client[_0x50f0('0xd')](_0x510af2,_0x5bf267)[_0x50f0('0xe')](function(_0x1f0007){logger[_0x50f0('0xf')](_0x50f0('0x10'),_0x3d2bfa,'request\x20sent');logger[_0x50f0('0x11')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x3d2bfa,'request\x20sent',JSON[_0x50f0('0x12')](_0x1f0007));if(_0x1f0007[_0x50f0('0x13')]){if(_0x1f0007[_0x50f0('0x13')][_0x50f0('0x14')]===0x1f4){logger[_0x50f0('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x3d2bfa,_0x1f0007[_0x50f0('0x13')][_0x50f0('0x15')]);return _0x389438(_0x1f0007['error'][_0x50f0('0x15')]);}logger['error'](_0x50f0('0x10'),_0x3d2bfa,_0x1f0007[_0x50f0('0x13')][_0x50f0('0x15')]);return _0xf36c8d(_0x1f0007['error']['message']);}else{logger['info'](_0x50f0('0x10'),_0x3d2bfa,_0x50f0('0x16'));_0xf36c8d(_0x1f0007[_0x50f0('0x17')][_0x50f0('0x15')]);}})[_0x50f0('0x18')](function(_0x584348){logger[_0x50f0('0x13')](_0x50f0('0x10'),_0x3d2bfa,_0x584348);_0x389438(_0x584348);});});} \ No newline at end of file +var _0x23ab=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x23ab,0x141));var _0xb23a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x23ab[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xb23a('0x0'));var util=require(_0xb23a('0x1'));var moment=require(_0xb23a('0x2'));var BPromise=require(_0xb23a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb23a('0x4'));var db=require(_0xb23a('0x5'))['db'];var utils=require(_0xb23a('0x6'));var logger=require('../../config/logger')(_0xb23a('0x7'));var config=require(_0xb23a('0x8'));var jayson=require(_0xb23a('0x9'));var client=jayson[_0xb23a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a68e6,_0x4e9ffd,_0xf11b8){return new BPromise(function(_0x5d120b,_0x59559e){return client[_0xb23a('0xb')](_0x4a68e6,_0xf11b8)['then'](function(_0x3bfcde){logger[_0xb23a('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4e9ffd,_0xb23a('0xd'));logger[_0xb23a('0xe')](_0xb23a('0xf'),_0x4e9ffd,_0xb23a('0xd'),JSON[_0xb23a('0x10')](_0x3bfcde));if(_0x3bfcde[_0xb23a('0x11')]){if(_0x3bfcde[_0xb23a('0x11')][_0xb23a('0x12')]===0x1f4){logger[_0xb23a('0x11')](_0xb23a('0x13'),_0x4e9ffd,_0x3bfcde[_0xb23a('0x11')][_0xb23a('0x14')]);return _0x59559e(_0x3bfcde[_0xb23a('0x11')]['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x4e9ffd,_0x3bfcde[_0xb23a('0x11')][_0xb23a('0x14')]);return _0x5d120b(_0x3bfcde[_0xb23a('0x11')]['message']);}else{logger[_0xb23a('0xc')](_0xb23a('0x13'),_0x4e9ffd,_0xb23a('0xd'));_0x5d120b(_0x3bfcde[_0xb23a('0x15')][_0xb23a('0x14')]);}})[_0xb23a('0x16')](function(_0x1d70ce){logger[_0xb23a('0x11')](_0xb23a('0x13'),_0x4e9ffd,_0x1d70ce);_0x59559e(_0x1d70ce);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 92d7fa9..276d92e 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 _0x6eec=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var path=require(_0xc6ee('0x2'));var timeout=require(_0xc6ee('0x3'));var express=require('express');var router=express[_0xc6ee('0x4')]();var auth=require(_0xc6ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6ee('0x6'));module[_0xc6ee('0x7')]=router; \ No newline at end of file +var _0x5785=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0x5785,0x119));var _0x5578=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x5785[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require(_0x5578('0x4'));var router=express['Router']();var auth=require(_0x5578('0x5'));var interaction=require(_0x5578('0x6'));var config=require(_0x5578('0x7'));module[_0x5578('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 21def62..7a5d5f0 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 _0x18cb=['INTEGER','exports'];(function(_0x2105ce,_0x247be1){var _0x2a8959=function(_0x32af2e){while(--_0x32af2e){_0x2105ce['push'](_0x2105ce['shift']());}};_0x2a8959(++_0x247be1);}(_0x18cb,0x69));var _0xb18c=function(_0x4d01bb,_0x2ba1f6){_0x4d01bb=_0x4d01bb-0x0;var _0x256bc7=_0x18cb[_0x4d01bb];return _0x256bc7;};'use strict';var Sequelize=require('sequelize');module[_0xb18c('0x0')]={'penalty':{'type':Sequelize[_0xb18c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x29e1=['sequelize','INTEGER'];(function(_0x4e46e5,_0x1a9f55){var _0x1ec9ab=function(_0x1cf81b){while(--_0x1cf81b){_0x4e46e5['push'](_0x4e46e5['shift']());}};_0x1ec9ab(++_0x1a9f55);}(_0x29e1,0x104));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x129e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x129e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4378b0b..d9bbb2e 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 _0x924f=['define','UserOpenchannelQueue','user_has_openchannel_queues','api','bluebird','rimraf','../../config/environment'];(function(_0x40ddcd,_0x18afb1){var _0x36ca16=function(_0x49f70b){while(--_0x49f70b){_0x40ddcd['push'](_0x40ddcd['shift']());}};_0x36ca16(++_0x18afb1);}(_0x924f,0x145));var _0xf924=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x924f[_0x4c05da];return _0x1614db;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf924('0x0'));var moment=require('moment');var BPromise=require(_0xf924('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf924('0x2'));var config=require(_0xf924('0x3'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x5214c4,_0x5eb43d){return _0x5214c4[_0xf924('0x4')](_0xf924('0x5'),attributes,{'tableName':_0xf924('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37ce=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x58c50e,_0x573495){var _0x4a8199=function(_0x2f237c){while(--_0x2f237c){_0x58c50e['push'](_0x58c50e['shift']());}};_0x4a8199(++_0x573495);}(_0x37ce,0xae));var _0xe37c=function(_0xefa698,_0x6d9541){_0xefa698=_0xefa698-0x0;var _0x11a62f=_0x37ce[_0xefa698];return _0x11a62f;};'use strict';var _=require(_0xe37c('0x0'));var util=require(_0xe37c('0x1'));var logger=require(_0xe37c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe37c('0x3'));var rp=require(_0xe37c('0x4'));var fs=require('fs');var path=require(_0xe37c('0x5'));var rimraf=require(_0xe37c('0x6'));var config=require(_0xe37c('0x7'));var attributes=require(_0xe37c('0x8'));module['exports']=function(_0x36c9d2,_0xceef3a){return _0x36c9d2[_0xe37c('0x9')](_0xe37c('0xa'),attributes,{'tableName':_0xe37c('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 a57db20..8ba3ddd 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 _0x3ebb=['../../config/utils','../../config/logger','rpc','../../config/environment','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ebb,0x160));var _0xb3eb=function(_0x48a673,_0x211cba){_0x48a673=_0x48a673-0x0;var _0x3fb987=_0x3ebb[_0x48a673];return _0x3fb987;};'use strict';var _=require(_0xb3eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3eb('0x1'));var rs=require(_0xb3eb('0x2'));var fs=require('fs');var Redis=require(_0xb3eb('0x3'));var db=require(_0xb3eb('0x4'))['db'];var utils=require(_0xb3eb('0x5'));var logger=require(_0xb3eb('0x6'))(_0xb3eb('0x7'));var config=require(_0xb3eb('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x91bfc5,_0x44a89f,_0x2d6fec){return new BPromise(function(_0x27fb2c,_0x1b2df3){return client['request'](_0x91bfc5,_0x2d6fec)[_0xb3eb('0x9')](function(_0x248e1d){logger[_0xb3eb('0xa')](_0xb3eb('0xb'),_0x44a89f,_0xb3eb('0xc'));logger[_0xb3eb('0xd')](_0xb3eb('0xe'),_0x44a89f,_0xb3eb('0xc'),JSON[_0xb3eb('0xf')](_0x248e1d));if(_0x248e1d[_0xb3eb('0x10')]){if(_0x248e1d['error'][_0xb3eb('0x11')]===0x1f4){logger['error'](_0xb3eb('0xb'),_0x44a89f,_0x248e1d[_0xb3eb('0x10')][_0xb3eb('0x12')]);return _0x1b2df3(_0x248e1d[_0xb3eb('0x10')]['message']);}logger[_0xb3eb('0x10')](_0xb3eb('0xb'),_0x44a89f,_0x248e1d[_0xb3eb('0x10')][_0xb3eb('0x12')]);return _0x27fb2c(_0x248e1d[_0xb3eb('0x10')][_0xb3eb('0x12')]);}else{logger[_0xb3eb('0xa')](_0xb3eb('0xb'),_0x44a89f,_0xb3eb('0xc'));_0x27fb2c(_0x248e1d[_0xb3eb('0x13')][_0xb3eb('0x12')]);}})[_0xb3eb('0x14')](function(_0x14319f){logger['error'](_0xb3eb('0xb'),_0x44a89f,_0x14319f);_0x1b2df3(_0x14319f);});});} \ No newline at end of file +var _0xcffe=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0xcffe,0x65));var _0xecff=function(_0x4f7fc6,_0x554d2f){_0x4f7fc6=_0x4f7fc6-0x0;var _0x235170=_0xcffe[_0x4f7fc6];return _0x235170;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require('moment');var BPromise=require(_0xecff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecff('0x3'));var db=require(_0xecff('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xecff('0x5'));var config=require(_0xecff('0x6'));var jayson=require(_0xecff('0x7'));var client=jayson[_0xecff('0x8')][_0xecff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a660a,_0x543a97,_0x10c795){return new BPromise(function(_0x4ca6b8,_0x468887){return client[_0xecff('0xa')](_0x2a660a,_0x10c795)[_0xecff('0xb')](function(_0x463705){logger[_0xecff('0xc')](_0xecff('0xd'),_0x543a97,'request\x20sent');logger[_0xecff('0xe')](_0xecff('0xf'),_0x543a97,_0xecff('0x10'),JSON[_0xecff('0x11')](_0x463705));if(_0x463705['error']){if(_0x463705[_0xecff('0x12')][_0xecff('0x13')]===0x1f4){logger['error'](_0xecff('0xd'),_0x543a97,_0x463705[_0xecff('0x12')]['message']);return _0x468887(_0x463705[_0xecff('0x12')]['message']);}logger['error'](_0xecff('0xd'),_0x543a97,_0x463705['error']['message']);return _0x4ca6b8(_0x463705[_0xecff('0x12')][_0xecff('0x14')]);}else{logger[_0xecff('0xc')](_0xecff('0xd'),_0x543a97,'request\x20sent');_0x4ca6b8(_0x463705['result'][_0xecff('0x14')]);}})[_0xecff('0x15')](function(_0x20ffbe){logger[_0xecff('0x12')](_0xecff('0xd'),_0x543a97,_0x20ffbe);_0x468887(_0x20ffbe);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 2574591..270d66e 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 _0xc293=['post','/:id/clone','clone','/:id/sections','addSections','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/:id/resources','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc293,0x1ef));var _0x3c29=function(_0x2bafde,_0x39326c){_0x2bafde=_0x2bafde-0x0;var _0x5733dc=_0xc293[_0x2bafde];return _0x5733dc;};'use strict';var multer=require('multer');var util=require(_0x3c29('0x0'));var path=require(_0x3c29('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3c29('0x2'));var config=require(_0x3c29('0x3'));var controller=require(_0x3c29('0x4'));router[_0x3c29('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x3c29('0x6')](),controller['describe']);router[_0x3c29('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3c29('0x5')](_0x3c29('0x7'),auth[_0x3c29('0x6')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0x3c29('0x8')]);router[_0x3c29('0x9')](_0x3c29('0xa'),auth['isAuthenticated'](),controller[_0x3c29('0xb')]);router[_0x3c29('0x9')](_0x3c29('0xc'),auth[_0x3c29('0x6')](),controller[_0x3c29('0xd')]);router[_0x3c29('0x9')]('/:id/resources',auth['isAuthenticated'](),controller['addResources']);router['put'](_0x3c29('0xe'),auth[_0x3c29('0x6')](),controller[_0x3c29('0xf')]);router[_0x3c29('0x10')]('/:id',auth[_0x3c29('0x6')](),controller[_0x3c29('0x11')]);router[_0x3c29('0x10')](_0x3c29('0xc'),auth[_0x3c29('0x6')](),controller[_0x3c29('0x12')]);router['delete'](_0x3c29('0x7'),auth[_0x3c29('0x6')](),controller[_0x3c29('0x13')]);module[_0x3c29('0x14')]=router; \ No newline at end of file +var _0x62f1=['/describe','/:id','show','/:id/resources','post','create','clone','addSections','addResources','put','update','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','./userProfile.controller','get','isAuthenticated','index'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x62f1,0x1c1));var _0x162f=function(_0x236a4a,_0x1bf351){_0x236a4a=_0x236a4a-0x0;var _0x5a2b58=_0x62f1[_0x236a4a];return _0x5a2b58;};'use strict';var multer=require(_0x162f('0x0'));var util=require(_0x162f('0x1'));var path=require(_0x162f('0x2'));var timeout=require(_0x162f('0x3'));var express=require(_0x162f('0x4'));var router=express[_0x162f('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x162f('0x6'));router[_0x162f('0x7')]('/',auth[_0x162f('0x8')](),controller[_0x162f('0x9')]);router[_0x162f('0x7')](_0x162f('0xa'),auth[_0x162f('0x8')](),controller['describe']);router[_0x162f('0x7')](_0x162f('0xb'),auth['isAuthenticated'](),controller[_0x162f('0xc')]);router[_0x162f('0x7')](_0x162f('0xd'),auth[_0x162f('0x8')](),controller['getResources']);router[_0x162f('0xe')]('/',auth[_0x162f('0x8')](),controller[_0x162f('0xf')]);router[_0x162f('0xe')]('/:id/clone',auth[_0x162f('0x8')](),controller[_0x162f('0x10')]);router[_0x162f('0xe')]('/:id/sections',auth['isAuthenticated'](),controller[_0x162f('0x11')]);router['post'](_0x162f('0xd'),auth[_0x162f('0x8')](),controller[_0x162f('0x12')]);router[_0x162f('0x13')](_0x162f('0xb'),auth[_0x162f('0x8')](),controller[_0x162f('0x14')]);router[_0x162f('0x15')](_0x162f('0xb'),auth['isAuthenticated'](),controller[_0x162f('0x16')]);router[_0x162f('0x15')](_0x162f('0x17'),auth[_0x162f('0x8')](),controller[_0x162f('0x18')]);router['delete']('/:id/resources',auth[_0x162f('0x8')](),controller[_0x162f('0x19')]);module[_0x162f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b3f8d83..cd6b20a 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 _0x768e=['join','getDataValue','crudPermissions','STRING','exports'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x768e,0xae));var _0xe768=function(_0x19355c,_0x43ea14){_0x19355c=_0x19355c-0x0;var _0x1e9f6=_0x768e[_0x19355c];return _0x1e9f6;};'use strict';var Sequelize=require('sequelize');module[_0xe768('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x21ae9f){this['setDataValue']('crudPermissions',_0x21ae9f?_0x21ae9f[_0xe768('0x1')](''):[]);},'get':function(){return this[_0xe768('0x2')]('crudPermissions')?this[_0xe768('0x2')](_0xe768('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe768('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x29a0=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x29a0,0xf2));var _0x029a=function(_0x1eee8a,_0x287f65){_0x1eee8a=_0x1eee8a-0x0;var _0x3b9381=_0x29a0[_0x1eee8a];return _0x3b9381;};'use strict';var Sequelize=require(_0x029a('0x0'));module[_0x029a('0x1')]={'name':{'type':Sequelize[_0x029a('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x029a('0x2')],'set':function(_0x4a74fd){this[_0x029a('0x3')](_0x029a('0x4'),_0x4a74fd?_0x4a74fd[_0x029a('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x029a('0x4'))?this[_0x029a('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x029a('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 0b8b6b0..ceea163 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 _0x4156=['Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./userProfile.socket','register','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','sendStatus','stack','name','UserProfile','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','map','type','key','field','includeAll','include','findAll','rows','catch','show','params','find','create','clone','options','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','destroy','push','removeSections','ids','addResources','bulkCreate','removeResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','order','VIRTUAL','AnalyticExtractedReport','foreignKey','associatedResources','forEach','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','resourceId','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','Team','QueueCampaigns','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','DeskAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','templates','Template','triggers'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x4156,0xf1));var _0x6415=function(_0x4d077c,_0x4c5ac5){_0x4d077c=_0x4d077c-0x0;var _0x9697bf=_0x4156[_0x4d077c];return _0x9697bf;};'use strict';var pdf=require(_0x6415('0x0'));var emlformat=require(_0x6415('0x1'));var rimraf=require(_0x6415('0x2'));var zipdir=require(_0x6415('0x3'));var jsonpatch=require(_0x6415('0x4'));var rp=require('request-promise');var moment=require(_0x6415('0x5'));var BPromise=require(_0x6415('0x6'));var Mustache=require(_0x6415('0x7'));var util=require(_0x6415('0x8'));var path=require(_0x6415('0x9'));var sox=require(_0x6415('0xa'));var csv=require(_0x6415('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6415('0xc'));var squel=require('squel');var crypto=require(_0x6415('0xd'));var jsforce=require(_0x6415('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6415('0xb'));var querystring=require(_0x6415('0xf'));var Papa=require(_0x6415('0x10'));var Redis=require(_0x6415('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6415('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6415('0x13'));var utils=require(_0x6415('0x14'));var config=require(_0x6415('0x15'));var db=require(_0x6415('0x16'))['db'];config[_0x6415('0x17')]=_[_0x6415('0x18')](config[_0x6415('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6415('0x17')]));require(_0x6415('0x19'))[_0x6415('0x1a')](socket);function respondWithStatusCode(_0xf75bec,_0x21ae74){_0x21ae74=_0x21ae74||0xcc;return function(_0x5b2a26){if(_0x5b2a26){return _0xf75bec['sendStatus'](_0x21ae74);}return _0xf75bec[_0x6415('0x1b')](_0x21ae74)[_0x6415('0x1c')]();};}function respondWithResult(_0x48017d,_0x1d540c){_0x1d540c=_0x1d540c||0xc8;return function(_0x41f9b0){if(_0x41f9b0){return _0x48017d['status'](_0x1d540c)['json'](_0x41f9b0);}};}function respondWithFilteredResult(_0x352a04,_0x4216c8){return function(_0x3f739d){if(_0x3f739d){var _0xe513fe=_0x3f739d[_0x6415('0x1d')],_0x2ef73b=_0x4216c8[_0x6415('0x1e')],_0xa3d00a=_0x4216c8['offset']+_0x4216c8['limit'],_0x2c74c6;if(_0xa3d00a>=_0xe513fe){_0xa3d00a=_0xe513fe;_0x2c74c6=0xc8;}else{_0x2c74c6=0xce;}_0x352a04['status'](_0x2c74c6);return _0x352a04[_0x6415('0x1f')](_0x6415('0x20'),_0x2ef73b+'-'+_0xa3d00a+'/'+_0xe513fe)[_0x6415('0x21')](_0x3f739d);}return null;};}function patchUpdates(_0x1e58f2){return function(_0x551632){try{jsonpatch[_0x6415('0x22')](_0x551632,_0x1e58f2,!![]);}catch(_0x3f4400){return BPromise[_0x6415('0x23')](_0x3f4400);}return _0x551632['save']();};}function saveUpdates(_0x287ac9,_0x266f97){return function(_0x7c567f){if(_0x7c567f){return _0x7c567f[_0x6415('0x24')](_0x287ac9)[_0x6415('0x25')](function(_0x3e33d3){return _0x3e33d3;});}return null;};}function removeEntity(_0x339c50,_0x41c266){return function(_0x1496c1){if(_0x1496c1){return _0x1496c1['destroy']()[_0x6415('0x25')](function(){_0x339c50[_0x6415('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15be31,_0x2b202c){return function(_0x2a936f){if(!_0x2a936f){_0x15be31[_0x6415('0x26')](0x194);}return _0x2a936f;};}function handleError(_0x31dabc,_0x5b5f39){_0x5b5f39=_0x5b5f39||0x1f4;return function(_0x30d857){logger['error'](_0x30d857[_0x6415('0x27')]);if(_0x30d857[_0x6415('0x28')]){delete _0x30d857[_0x6415('0x28')];}_0x31dabc['status'](_0x5b5f39)['send'](_0x30d857);};}exports['index']=function(_0x61e827,_0x31f717){var _0x581bc7={},_0x5bf08d={},_0xf3e415={'count':0x0,'rows':[]};var _0x4426ed=db[_0x6415('0x29')][_0x6415('0x2a')];_0x5bf08d[_0x6415('0x2b')]=_[_0x6415('0x2c')](_0x4426ed);_0x5bf08d['query']=_[_0x6415('0x2c')](_0x61e827[_0x6415('0x2d')]);_0x5bf08d[_0x6415('0x2e')]=_[_0x6415('0x2f')](_0x5bf08d['model'],_0x5bf08d['query']);_0x581bc7['attributes']=_[_0x6415('0x2f')](_0x5bf08d['model'],qs[_0x6415('0x30')](_0x61e827['query'][_0x6415('0x30')]));_0x581bc7[_0x6415('0x31')]=_0x581bc7[_0x6415('0x31')][_0x6415('0x32')]?_0x581bc7['attributes']:_0x5bf08d['model'];if(!_0x61e827[_0x6415('0x2d')][_0x6415('0x33')](_0x6415('0x34'))){_0x581bc7[_0x6415('0x35')]=qs[_0x6415('0x35')](_0x61e827[_0x6415('0x2d')]['limit']);_0x581bc7[_0x6415('0x1e')]=qs['offset'](_0x61e827['query']['offset']);}_0x581bc7['order']=qs[_0x6415('0x36')](_0x61e827[_0x6415('0x2d')][_0x6415('0x36')]);_0x581bc7['where']=qs[_0x6415('0x2e')](_[_0x6415('0x37')](_0x61e827['query'],_0x5bf08d[_0x6415('0x2e')]));if(_0x61e827[_0x6415('0x2d')][_0x6415('0x38')]){_0x581bc7[_0x6415('0x39')]=_[_0x6415('0x3a')](_0x581bc7['where'],{'$or':_[_0x6415('0x3b')](_0x4426ed,function(_0x5773a6){if(_0x5773a6[_0x6415('0x3c')][_0x6415('0x3d')]!=='VIRTUAL'){var _0xfcfdde={};_0xfcfdde[_0x5773a6[_0x6415('0x3e')]]={'$like':'%'+_0x61e827['query']['filter']+'%'};return _0xfcfdde;}})});}_0x581bc7=_[_0x6415('0x3a')]({},_0x581bc7,_0x61e827['options']);var _0x2f2b7d={'where':_0x581bc7['where']};return db[_0x6415('0x29')][_0x6415('0x1d')](_0x2f2b7d)['then'](function(_0x3dddfb){_0xf3e415['count']=_0x3dddfb;if(_0x61e827[_0x6415('0x2d')][_0x6415('0x3f')]){_0x581bc7[_0x6415('0x40')]=[{'all':!![]}];}return db[_0x6415('0x29')][_0x6415('0x41')](_0x581bc7);})[_0x6415('0x25')](function(_0x366b4d){_0xf3e415[_0x6415('0x42')]=_0x366b4d;return _0xf3e415;})[_0x6415('0x25')](respondWithFilteredResult(_0x31f717,_0x581bc7))[_0x6415('0x43')](handleError(_0x31f717,null));};exports[_0x6415('0x44')]=function(_0x35b203,_0x71178e){var _0x196992={'raw':![],'where':{'id':_0x35b203[_0x6415('0x45')]['id']}},_0x16b1e2={};_0x16b1e2[_0x6415('0x2b')]=_[_0x6415('0x2c')](db[_0x6415('0x29')]['rawAttributes']);_0x16b1e2[_0x6415('0x2d')]=_['keys'](_0x35b203[_0x6415('0x2d')]);_0x16b1e2[_0x6415('0x2e')]=_['intersection'](_0x16b1e2[_0x6415('0x2b')],_0x16b1e2[_0x6415('0x2d')]);_0x196992[_0x6415('0x31')]=_[_0x6415('0x2f')](_0x16b1e2['model'],qs['fields'](_0x35b203[_0x6415('0x2d')]['fields']));_0x196992[_0x6415('0x31')]=_0x196992['attributes'][_0x6415('0x32')]?_0x196992[_0x6415('0x31')]:_0x16b1e2[_0x6415('0x2b')];if(_0x35b203[_0x6415('0x2d')][_0x6415('0x3f')]){_0x196992[_0x6415('0x40')]=[{'all':!![]}];}_0x196992=_[_0x6415('0x3a')]({},_0x196992,_0x35b203['options']);return db[_0x6415('0x29')][_0x6415('0x46')](_0x196992)['then'](handleEntityNotFound(_0x71178e,null))[_0x6415('0x25')](respondWithResult(_0x71178e,null))['catch'](handleError(_0x71178e,null));};exports[_0x6415('0x47')]=function(_0xf14291,_0x42715d){return db[_0x6415('0x29')][_0x6415('0x47')](_0xf14291['body'],{})[_0x6415('0x25')](respondWithResult(_0x42715d,0xc9))['catch'](handleError(_0x42715d,null));};exports[_0x6415('0x48')]=function(_0x462348,_0x325c5f){var _0x263c11={'raw':![],'where':{'id':_0x462348[_0x6415('0x45')]['id']}},_0x5ec8dd={};_0x5ec8dd['model']=_[_0x6415('0x2c')](db[_0x6415('0x29')]['rawAttributes']);_0x263c11[_0x6415('0x31')]=_[_0x6415('0x2f')](_0x5ec8dd[_0x6415('0x2b')],qs['fields'](_0x462348[_0x6415('0x2d')][_0x6415('0x30')]));_0x263c11[_0x6415('0x31')]=_0x263c11[_0x6415('0x31')][_0x6415('0x32')]?_0x263c11[_0x6415('0x31')]:_0x5ec8dd[_0x6415('0x2b')];if(_0x462348[_0x6415('0x2d')]['includeAll']){_0x263c11[_0x6415('0x40')]=[{'all':!![]}];}_0x263c11=_[_0x6415('0x3a')]({},_0x263c11,_0x462348[_0x6415('0x49')]);return db[_0x6415('0x29')][_0x6415('0x46')](_0x263c11)['then'](handleEntityNotFound(_0x325c5f,null))[_0x6415('0x25')](function(_0x395a09){if(_0x395a09){var _0x167190=_0x395a09[_0x6415('0x4a')]({'plain':!![]});_0x167190=qs[_0x6415('0x4b')](_0x167190,['id',_0x6415('0x4c'),_0x6415('0x4d'),_0x6415('0x4e')]);_0x462348[_0x6415('0x4f')]=_[_0x6415('0x4b')](_0x462348['body'],['id',_0x6415('0x4c'),_0x6415('0x4d')]);return db[_0x6415('0x50')][_0x6415('0x51')](function(_0x2ccaf3){return db['UserProfile'][_0x6415('0x47')](_[_0x6415('0x3a')](_0x167190,_0x462348[_0x6415('0x4f')]),{'include':_0x462348['query'][_0x6415('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x2ccaf3})[_0x6415('0x25')](function(_0xa96b02){var _0x1bf7d3=_0xa96b02[_0x6415('0x4a')]({'plain':!![]});return db[_0x6415('0x52')]['findAll']({'where':{'userProfileId':_0x462348[_0x6415('0x45')]['id']},'raw':!![]})['then'](function(_0x2cc41c){if(_0x2cc41c){return BPromise[_0x6415('0x53')](_0x2cc41c,function(_0x5b982b){return new BPromise(function(_0x2feaef,_0x3857b5){if(_0x5b982b[_0x6415('0x54')]===null||_0x5b982b[_0x6415('0x54')]===0x1)_0x2feaef(null);return db[_0x6415('0x55')][_0x6415('0x41')]({'where':{'sectionId':_0x5b982b['id']},'raw':!![]})['then'](function(_0x461f58){var _0x2837e7=_[_0x6415('0x3b')](_0x461f58,function(_0x411927){return qs[_0x6415('0x4b')](_0x411927,['id',_0x6415('0x4c'),_0x6415('0x4d'),_0x6415('0x56')]);});_0x2feaef(_0x2837e7);})[_0x6415('0x43')](function(_0x5f4d04){_0x3857b5(_0x5f4d04);});})['then'](function(_0x241594){var _0x26f0cf=qs['omit'](_0x5b982b,['id',_0x6415('0x4c'),_0x6415('0x4d')]);_0x26f0cf[_0x6415('0x57')]=_0x1bf7d3['id'];if(_0x241594)_0x26f0cf[_0x6415('0x58')]=_0x241594;return _0x26f0cf;})[_0x6415('0x25')](function(_0x4c9005){return db[_0x6415('0x52')]['create'](_0x4c9005,{'include':[{'model':db[_0x6415('0x55')],'as':_0x6415('0x58')}],'raw':!![],'transaction':_0x2ccaf3});});})['then'](function(){return _0x1bf7d3;});}});});});}})[_0x6415('0x25')](respondWithResult(_0x325c5f,0xc9))[_0x6415('0x43')](handleError(_0x325c5f,null));};exports[_0x6415('0x24')]=function(_0x46c4c9,_0x402ecb){if(_0x46c4c9[_0x6415('0x4f')]['id']){delete _0x46c4c9[_0x6415('0x4f')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x46c4c9[_0x6415('0x45')]['id']}})[_0x6415('0x25')](handleEntityNotFound(_0x402ecb,null))[_0x6415('0x25')](saveUpdates(_0x46c4c9[_0x6415('0x4f')],null))['then'](respondWithResult(_0x402ecb,null))[_0x6415('0x43')](handleError(_0x402ecb,null));};exports['destroy']=function(_0x13dfcd,_0x441186){return db[_0x6415('0x29')][_0x6415('0x46')]({'where':{'id':_0x13dfcd[_0x6415('0x45')]['id']}})[_0x6415('0x25')](handleEntityNotFound(_0x441186,null))[_0x6415('0x25')](removeEntity(_0x441186,null))[_0x6415('0x43')](handleError(_0x441186,null));};exports[_0x6415('0x59')]=function(_0x40829f,_0x350e5a){return db[_0x6415('0x29')][_0x6415('0x59')]()[_0x6415('0x25')](respondWithResult(_0x350e5a,null))[_0x6415('0x43')](handleError(_0x350e5a,null));};exports[_0x6415('0x5a')]=function(_0x348bdb,_0x27105b){var _0x158759=_0x348bdb[_0x6415('0x4f')];return db[_0x6415('0x29')][_0x6415('0x46')]({'where':{'id':_0x348bdb[_0x6415('0x45')]['id']}})['then'](handleEntityNotFound(_0x27105b,null))[_0x6415('0x25')](function(_0x5c0dd5){if(_0x5c0dd5){return db['sequelize'][_0x6415('0x51')](function(_0x54d12f){return db['UserProfileSection'][_0x6415('0x5b')]({'where':{'userProfileId':_0x348bdb[_0x6415('0x45')]['id'],'sectionId':_[_0x6415('0x3b')](_0x158759,function(_0x5f3ce9){return _0x5f3ce9[_0x6415('0x56')];})},'transaction':_0x54d12f})[_0x6415('0x25')](function(){var _0x2e0a91=_['map'](_0x158759,function(_0x4ba6ee){_0x4ba6ee['userProfileId']=_0x348bdb['params']['id'];return _0x4ba6ee;});var _0x22ff9e=[];return BPromise[_0x6415('0x53')](_0x2e0a91,function(_0x4684eb){return db['UserProfileSection']['create'](_0x4684eb,{'include':[{'model':db[_0x6415('0x55')],'as':_0x6415('0x58')}],'raw':!![],'transaction':_0x54d12f})[_0x6415('0x25')](function(_0x179561){_0x22ff9e[_0x6415('0x5c')](_0x179561[_0x6415('0x4a')]({'plain':!![]}));});})['then'](function(){return _0x22ff9e;});});});}})[_0x6415('0x25')](function(_0x2b1688){return _0x2b1688;})['then'](respondWithResult(_0x27105b,null))['catch'](handleError(_0x27105b,null));};exports[_0x6415('0x5d')]=function(_0x3963b0,_0x474a81){var _0x5ab657;return db[_0x6415('0x29')][_0x6415('0x46')]({'where':{'id':_0x3963b0[_0x6415('0x45')]['id']},'attributes':['id',_0x6415('0x28')]})['then'](handleEntityNotFound(_0x474a81,null))['then'](function(_0x33002a){if(_0x33002a){_0x5ab657=_0x33002a;return db['UserProfileSection'][_0x6415('0x5b')]({'where':{'userProfileId':_0x3963b0[_0x6415('0x45')]['id'],'sectionId':_0x3963b0[_0x6415('0x2d')][_0x6415('0x5e')]}});}})['then'](function(){return _0x5ab657;})['then'](respondWithStatusCode(_0x474a81,null))[_0x6415('0x43')](handleError(_0x474a81,null));};exports[_0x6415('0x5f')]=function(_0x17dd8b,_0x4ef667){return db[_0x6415('0x29')][_0x6415('0x46')]({'where':{'id':_0x17dd8b['params']['id']}})[_0x6415('0x25')](handleEntityNotFound(_0x4ef667,null))[_0x6415('0x25')](function(_0x5e2e49){if(_0x5e2e49){return db[_0x6415('0x50')][_0x6415('0x51')](function(_0x37cea4){return db['UserProfileSection'][_0x6415('0x41')]({'where':{'userProfileId':_0x17dd8b[_0x6415('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x178936){if(_0x178936){return db[_0x6415('0x52')][_0x6415('0x5b')]({'where':{'userProfileId':_0x17dd8b['params']['id'],'id':_[_0x6415('0x3b')](_0x178936,function(_0x3e04ac){return _0x3e04ac['id'];})},'transaction':_0x37cea4});}})[_0x6415('0x25')](function(_0x163673){var _0x1fd5ce=_[_0x6415('0x3b')](_0x17dd8b[_0x6415('0x4f')],function(_0x115894){_0x115894[_0x6415('0x57')]=_0x17dd8b['params']['id'];return _0x115894;});return db[_0x6415('0x52')][_0x6415('0x60')](_0x1fd5ce,{'raw':!![],'transaction':_0x37cea4});})[_0x6415('0x25')](function(_0x11ff75){var _0x1ea02b=_[_0x6415('0x38')](_[_0x6415('0x3b')](_0x11ff75,function(_0x206e92){return _0x206e92[_0x6415('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ea02b){return db['UserProfileSection'][_0x6415('0x41')]({'where':{'userProfileId':_0x17dd8b[_0x6415('0x45')]['id'],'sectionId':_[_0x6415('0x3b')](_0x1ea02b,function(_0x3f7f3b){return _0x3f7f3b[_0x6415('0x56')];})},'attributes':['id',_0x6415('0x56')],'raw':!![]})[_0x6415('0x25')](function(_0x4085e8){var _0x31c725=_[_0x6415('0x3b')](_0x17dd8b[_0x6415('0x4f')],function(_0x555a55){_0x555a55['userProfileId']=_0x17dd8b[_0x6415('0x45')]['id'];return _0x555a55;});return db[_0x6415('0x55')][_0x6415('0x60')](_0x31c725,{'raw':!![],'transaction':_0x37cea4});});}})[_0x6415('0x43')](handleError(_0x4ef667,null));});}})[_0x6415('0x25')](function(_0x1f555e){var _0x1f7427=_['map'](_0x1f555e,function(_0x2ca7d4){return _0x2ca7d4['get']({'plain':!![]});});})['then'](respondWithResult(_0x4ef667,null))[_0x6415('0x43')](handleError(_0x4ef667,null));};exports[_0x6415('0x61')]=function(_0x3b3a94,_0x1d85a8,_0x531b33){return db['UserProfile']['find']({'where':{'id':_0x3b3a94[_0x6415('0x45')]['id']}})[_0x6415('0x25')](handleEntityNotFound(_0x1d85a8,null))[_0x6415('0x25')](function(_0xdcdde0){if(_0xdcdde0){return _0xdcdde0['removeResources'](_0x3b3a94[_0x6415('0x2d')][_0x6415('0x5e')]);}})['then'](respondWithStatusCode(_0x1d85a8,null))['catch'](handleError(_0x1d85a8,null));};exports['getResources']=function(_0x1aa163,_0x46e3a6){var _0x36b625={'raw':![],'where':{}};var _0x2fd023={};var _0x5427a4={'count':0x0,'rows':[]};var _0x171dff=_0x1aa163[_0x6415('0x2d')][_0x6415('0x62')];if(typeof _0x171dff==='undefined'){throw new db[(_0x6415('0x63'))][(_0x6415('0x64'))](_0x6415('0x65'));}var _0x4f7d8e=_0x1aa163[_0x6415('0x2d')][_0x6415('0x66')]||![];var _0x309512=getQueryModels(_0x171dff,_0x4f7d8e);if(typeof _0x309512[_0x6415('0x67')]==='undefined'){throw new db[(_0x6415('0x63'))][(_0x6415('0x64'))](_0x6415('0x68')+_0x171dff+'\x27');}var _0x418957=[];if(!_[_0x6415('0x69')](_0x309512[_0x6415('0x6a')])){_0x418957=_0x309512[_0x6415('0x6a')];}else{_0x418957=[{'name':_0x171dff}];}return db['UserProfile'][_0x6415('0x6b')]({'where':{'id':_0x1aa163[_0x6415('0x45')]['id']}})['then'](handleEntityNotFound(_0x46e3a6,null))[_0x6415('0x25')](function(_0x61893c){if(_0x61893c){var _0x8de8f2=[];for(var _0x10020f=0x0;_0x10020f<_0x418957[_0x6415('0x32')];_0x10020f++){_0x8de8f2[_0x6415('0x5c')](db[_0x6415('0x52')][_0x6415('0x6b')]({'where':{'userProfileId':_0x61893c['id'],'name':_0x418957[_0x10020f]['name']},'raw':!![]}));}return BPromise[_0x6415('0x6c')](_0x8de8f2);}})[_0x6415('0x25')](function(_0x3c3464){var _0x489d80=_[_0x6415('0x38')](_0x3c3464,function(_0x474857){return _0x474857?_0x474857:undefined;});var _0x3a99e4=_[_0x6415('0x38')](_0x418957,[_0x6415('0x6d'),!![]]);var _0x361776=_[_0x6415('0x69')](_0x489d80)&&_[_0x6415('0x69')](_0x3a99e4)?null:_['union'](_0x3a99e4,_0x489d80);if(_0x361776){var _0x1a0c3e=[];for(var _0x3e01fc=0x0;_0x3e01fc<_0x361776[_0x6415('0x32')];_0x3e01fc++){var _0x4f1070=_[_0x6415('0x46')](_0x418957,function(_0x5c929b){return _0x361776[_0x3e01fc]?_0x5c929b[_0x6415('0x28')]===_0x361776[_0x3e01fc][_0x6415('0x28')]:null;});if(_0x4f1070){if(_0x361776[_0x3e01fc][_0x6415('0x6d')]){_0x1a0c3e[_0x6415('0x5c')](getAllResources(_0x309512[_0x6415('0x67')],_0x361776[_0x3e01fc]));}else{if(!_0x361776[_0x3e01fc]['autoAssociation']){_0x1a0c3e[_0x6415('0x5c')](getAllowedResources(_0x4f1070,_0x361776[_0x3e01fc],_0x309512['childModel']));}else{if(_0x4f1070[_0x6415('0x2b')]){_0x1a0c3e[_0x6415('0x5c')](getAllFilteredResources(_0x4f1070,_0x361776[_0x3e01fc]));}}}}}return BPromise['all'](_0x1a0c3e);}else{return null;}})[_0x6415('0x25')](function(_0x5db1fd){var _0x10ef6b=_0x5db1fd;var _0x1e0240=null;if(_0x10ef6b){_0x1e0240=_0x10ef6b['length']===0x1?_0x10ef6b[0x0]:null;}if(_0x1e0240||_0x10ef6b){var _0xc56192=db[_0x309512[_0x6415('0x67')]][_0x6415('0x2a')];_0x2fd023[_0x6415('0x2b')]=_['keys'](_0xc56192);_0x2fd023[_0x6415('0x2d')]=_['keys'](_0x1aa163[_0x6415('0x2d')]);_0x2fd023[_0x6415('0x2e')]=_['intersection'](_0x2fd023[_0x6415('0x2b')],_0x2fd023[_0x6415('0x2d')]);_0x36b625[_0x6415('0x31')]=_[_0x6415('0x2f')](_0x2fd023[_0x6415('0x2b')],qs[_0x6415('0x30')](_0x1aa163['query']['fields']));_0x36b625['attributes']=_0x36b625['attributes'][_0x6415('0x32')]?_0x36b625[_0x6415('0x31')]:_0x2fd023[_0x6415('0x2b')];if(!_0x1aa163[_0x6415('0x2d')][_0x6415('0x33')](_0x6415('0x34'))){_0x36b625[_0x6415('0x35')]=qs['limit'](_0x1aa163[_0x6415('0x2d')][_0x6415('0x35')]);_0x36b625[_0x6415('0x1e')]=qs[_0x6415('0x1e')](_0x1aa163[_0x6415('0x2d')]['offset']);}_0x36b625[_0x6415('0x6e')]=qs['sort'](_0x1aa163[_0x6415('0x2d')][_0x6415('0x36')]);_0x36b625[_0x6415('0x39')]=qs[_0x6415('0x2e')](_['pick'](_0x1aa163[_0x6415('0x2d')],_0x2fd023[_0x6415('0x2e')]));if(_0x1aa163['query']['filter']){_0x36b625[_0x6415('0x39')]=_[_0x6415('0x3a')](_0x36b625[_0x6415('0x39')],{'$or':_['map'](_0xc56192,function(_0x3c73c2){if(_0x3c73c2['type'][_0x6415('0x3d')]!==_0x6415('0x6f')){var _0x445a44={};_0x445a44[_0x3c73c2['field']]={'$like':'%'+_0x1aa163[_0x6415('0x2d')][_0x6415('0x38')]+'%'};return _0x445a44;}})});}var _0x1094d3=[];if(_0x1e0240){var _0x49a995=_[_0x6415('0x46')](_0x418957,['name',_0x1e0240[_0x6415('0x28')]]);if(_0x49a995[_0x6415('0x3e')]){var _0x27d0eb={};if(_0x309512['childModel']===_0x6415('0x70')){_0x27d0eb[_0x49a995[_0x6415('0x71')]]=_[_0x6415('0x3b')](_0x1e0240[_0x6415('0x72')],'id');}else{_0x27d0eb[_0x49a995[_0x6415('0x71')]]=_0x1e0240[_0x6415('0x72')];}_0x1094d3[_0x6415('0x5c')](_0x27d0eb);}else{_0x36b625[_0x6415('0x39')]['id']=_0x1e0240[_0x6415('0x72')];}}else{for(var _0x4aeb0d=0x0;_0x4aeb0d<_0x10ef6b[_0x6415('0x32')];_0x4aeb0d++){var _0x49a995=_[_0x6415('0x46')](_0x418957,[_0x6415('0x28'),_0x10ef6b[_0x4aeb0d][_0x6415('0x28')]]);if(_0x49a995[_0x6415('0x3e')]){var _0x27d0eb={};_0x27d0eb[_0x49a995[_0x6415('0x71')]]=_0x10ef6b[_0x4aeb0d][_0x6415('0x72')];_0x1094d3[_0x6415('0x5c')](_0x27d0eb);}else{if(!_0x36b625['where']['id'])_0x36b625['where']['id']=[];_0x10ef6b[_0x4aeb0d][_0x6415('0x72')][_0x6415('0x73')](function(_0x25c097){_0x36b625[_0x6415('0x39')]['id'][_0x6415('0x5c')](_0x25c097);});}}}if(!_[_0x6415('0x69')](_0x1094d3)){_0x36b625[_0x6415('0x39')]=_[_0x6415('0x3a')](_0x36b625[_0x6415('0x39')],{'$and':{'$or':_0x1094d3}});}_0x36b625=_[_0x6415('0x3a')]({},_0x36b625,_0x1aa163[_0x6415('0x49')]);if(_0x1e0240&&!_0x1e0240['autoAssociation']&&_0x309512[_0x6415('0x67')]===_0x6415('0x70')){if(_0x1aa163['query'][_0x6415('0x3f')]){_0x36b625[_0x6415('0x40')]=[{'all':!![]}];}return db[_0x309512[_0x6415('0x67')]][_0x6415('0x41')](_0x36b625)[_0x6415('0x25')](function(_0x1c2cfa){var _0x18c278=[];_0x1c2cfa[_0x6415('0x73')](function(_0x4e5496){var _0x12d48e;switch(_0x4e5496['reportType']){case _0x6415('0x74'):_0x12d48e=_['find'](_0x1e0240[_0x6415('0x72')],function(_0x3f0400){return _0x3f0400['id']===_0x4e5496[_0x6415('0x75')]&&_0x3f0400[_0x6415('0x3c')]===_0x6415('0x76');});break;case _0x6415('0x77'):_0x12d48e=_[_0x6415('0x46')](_0x1e0240['associatedResources'],function(_0x212a83){return _0x212a83['id']===_0x4e5496[_0x6415('0x75')]&&_0x212a83['type']===_0x6415('0x78');});break;}if(_0x12d48e)_0x18c278[_0x6415('0x5c')](_0x4e5496);});_0x5427a4['count']=_0x18c278[_0x6415('0x32')];_0x5427a4['rows']=_0x18c278;return _0x5427a4;});}else{return db[_0x309512[_0x6415('0x67')]]['count']({'where':_0x36b625[_0x6415('0x39')]})[_0x6415('0x25')](function(_0x48094c){_0x5427a4[_0x6415('0x1d')]=_0x48094c;if(_0x1aa163[_0x6415('0x2d')][_0x6415('0x3f')]){if(_0x309512['childModel']===_0x6415('0x79')){_0x36b625[_0x6415('0x40')]=[{'model':db[_0x6415('0x7a')],'as':_0x6415('0x7b'),'attributes':['id',_0x6415('0x28'),_0x6415('0x7c')],'required':_0x1aa163[_0x6415('0x2d')][_0x6415('0x7d')]?!![]:![]},{'model':db[_0x6415('0x7a')],'as':_0x6415('0x7e'),'attributes':['id',_0x6415('0x28'),_0x6415('0x7c')],'through':_0x1aa163[_0x6415('0x2d')]['tag']?{'attributes':[],'where':{'TagId':_0x1aa163[_0x6415('0x2d')][_0x6415('0x7d')]||undefined}}:{},'required':_0x1aa163['query'][_0x6415('0x7d')]?!![]:![]}];}else{_0x36b625[_0x6415('0x40')]=[{'all':!![]}];}}return db[_0x309512['childModel']][_0x6415('0x41')](_0x36b625);})[_0x6415('0x25')](function(_0x142bff){_0x5427a4['rows']=_0x142bff;return _0x5427a4;});}}else{return _0x5427a4;}})[_0x6415('0x25')](respondWithFilteredResult(_0x46e3a6,_0x36b625))['catch'](handleError(_0x46e3a6,null));};function getAllResources(_0x401687,_0x17701b){return new BPromise(function(_0x2b2215,_0x12d43c){if(_0x17701b){var _0x30bbec=_0x17701b[_0x6415('0x38')]?{[_0x17701b[_0x6415('0x38')][_0x6415('0x3e')]]:_0x17701b[_0x6415('0x38')]['value']}:undefined;return db[_0x401687]['findAll']({'where':_0x30bbec,'raw':!![]})[_0x6415('0x25')](function(_0x4d6544){_0x17701b[_0x6415('0x72')]=_[_0x6415('0x3b')](_0x4d6544,'id');_0x2b2215(_0x17701b);})[_0x6415('0x43')](function(_0x3495a5){_0x12d43c(_0x3495a5);});}else{_0x2b2215(null);}});}function getAllFilteredResources(_0x232579,_0x3bf29f){return new BPromise(function(_0x189fed,_0x5c0586){var _0x5c4afc=_0x232579['filter']?{[_0x232579[_0x6415('0x38')][_0x6415('0x3e')]]:_0x232579[_0x6415('0x38')][_0x6415('0x7f')]}:undefined;return db[_0x232579[_0x6415('0x2b')]][_0x6415('0x41')]({'where':_0x5c4afc,'raw':!![]})[_0x6415('0x25')](function(_0x278a69){_0x3bf29f[_0x6415('0x72')]=_[_0x6415('0x3b')](_0x278a69,function(_0x867110){return _0x867110[_0x6415('0x28')];});_0x189fed(_0x3bf29f);})[_0x6415('0x43')](function(_0x26edb1){_0x5c0586(_0x26edb1);});});}function getAllowedResources(_0x278f51,_0xa71f24,_0x4714ed){return new BPromise(function(_0x44fd72,_0x169779){if(_0xa71f24){return db['UserProfileResource'][_0x6415('0x41')]({'where':{'sectionId':_0xa71f24['id']},'raw':!![]})['then'](function(_0x28791f){if(_0x278f51[_0x6415('0x3e')]&&_0x278f51[_0x6415('0x3e')]!=='id'){_0xa71f24[_0x6415('0x72')]=_[_0x6415('0x3b')](_0x28791f,function(_0x362b4a){return _0x362b4a[_0x278f51[_0x6415('0x3e')]];});}else{if(_0x4714ed==='AnalyticExtractedReport'){_0xa71f24[_0x6415('0x72')]=_[_0x6415('0x3b')](_0x28791f,function(_0x2899c9){return{'id':_0x2899c9[_0x6415('0x80')],'type':_0x2899c9[_0x6415('0x3c')]};});}else{_0xa71f24[_0x6415('0x72')]=_[_0x6415('0x3b')](_0x28791f,function(_0x232653){return _0x232653[_0x6415('0x80')];});}}_0x44fd72(_0xa71f24);})[_0x6415('0x43')](function(_0x52d188){_0x169779(_0x52d188);});}else{_0x44fd72(null);}});}function getQueryModels(_0x217579,_0x460bd8){var _0x3a42e1=_0x217579['toLowerCase']();var _0xf8e296={'childModel':undefined,'parentSections':[]};switch(_0x3a42e1){case'squareprojects':_0xf8e296['childModel']=_0x6415('0x81');break;case _0x6415('0x82'):_0xf8e296['childModel']=_0x6415('0x83');break;case _0x6415('0x84'):_0xf8e296[_0x6415('0x67')]=_0x6415('0x85');_0xf8e296[_0x6415('0x6a')]=[{'name':_0x6415('0x86'),'field':_0x6415('0x28'),'foreignKey':_0x6415('0x87')}];break;case _0x6415('0x88'):_0xf8e296[_0x6415('0x67')]=_0x6415('0x89');break;case _0x6415('0x8a'):_0xf8e296['childModel']=_0x6415('0x79');_0xf8e296['parentSections']=[{'name':_0x6415('0x8b'),'field':'id','foreignKey':_0x6415('0x8c')}];break;case'lists':_0xf8e296[_0x6415('0x67')]=_0x6415('0x8d');break;case _0x6415('0x8e'):_0xf8e296[_0x6415('0x67')]=_0x6415('0x8f');break;case _0x6415('0x90'):_0xf8e296['childModel']=_0x6415('0x91');break;case'chatqueues':_0xf8e296[_0x6415('0x67')]=_0x6415('0x92');break;case _0x6415('0x93'):_0xf8e296['childModel']=_0x6415('0x94');break;case _0x6415('0x95'):_0xf8e296[_0x6415('0x67')]=_0x6415('0x96');break;case _0x6415('0x97'):_0xf8e296['childModel']='FaxAccount';break;case _0x6415('0x98'):case _0x6415('0x99'):case'outboundroutes':_0xf8e296['childModel']=_0x6415('0x9a');break;case _0x6415('0x9b'):_0xf8e296['childModel']='VoiceContext';break;case _0x6415('0x9c'):_0xf8e296[_0x6415('0x67')]=_0x6415('0x9d');break;case _0x6415('0x9e'):_0xf8e296[_0x6415('0x67')]='VoiceRecording';_0xf8e296[_0x6415('0x6a')]=[{'name':_0x6415('0x9f'),'field':_0x6415('0x28'),'foreignKey':_0x6415('0xa0'),'model':_0x6415('0xa1'),'filter':{'field':_0x6415('0xa2'),'value':[_0x6415('0xa3')]}},{'name':_0x6415('0xa4'),'field':_0x6415('0x28'),'foreignKey':_0x6415('0xa0'),'model':_0x6415('0xa1'),'filter':{'field':_0x6415('0xa2'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x6415('0x28'),'foreignKey':_0x6415('0xa5'),'model':_0x6415('0xa6'),'filter':{'field':_0x6415('0x3c'),'value':[_0x6415('0xa7')]}},{'name':'QueueCampaigns','field':_0x6415('0x28'),'foreignKey':_0x6415('0xa5'),'model':_0x6415('0xa6'),'filter':{'field':_0x6415('0x3c'),'value':[_0x6415('0xa8')]}}];break;case _0x6415('0xa9'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xaa');break;case'chanspies':_0xf8e296[_0x6415('0x67')]=_0x6415('0xab');break;case _0x6415('0xac'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xad');break;case _0x6415('0xae'):_0xf8e296[_0x6415('0x67')]='Campaign';break;case _0x6415('0xaf'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xb0');break;case _0x6415('0xb1'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xb2');break;case _0x6415('0xb3'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xb4');break;case _0x6415('0xb5'):_0xf8e296['childModel']=_0x6415('0xb6');break;case _0x6415('0xb7'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xb8');break;case _0x6415('0xb9'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xba');break;case _0x6415('0xbb'):_0xf8e296['childModel']=_0x6415('0xbc');break;case _0x6415('0xbd'):_0xf8e296['childModel']=_0x6415('0xbe');break;case'voicequeues':case'queuecampaigns':_0xf8e296[_0x6415('0x67')]=_0x6415('0xa6');if(_0x460bd8){_0xf8e296['parentSections']=[{'name':'VoiceQueues'},{'name':_0x6415('0xbf')}];}break;case _0x6415('0xc0'):case'agents':case _0x6415('0xc1'):_0xf8e296[_0x6415('0x67')]='User';if(_0x460bd8){_0xf8e296['parentSections']=[{'name':_0x6415('0xc2'),'filter':{'field':'role','value':[_0x6415('0xc3'),_0x6415('0xc4')]},'ignore':!![]},{'name':_0x6415('0x9f')},{'name':'Telephones'}];}break;case _0x6415('0xc5'):_0xf8e296['childModel']=_0x6415('0xc6');break;case _0x6415('0xc7'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xc8');break;case'freshdeskaccounts':_0xf8e296['childModel']=_0x6415('0xc9');break;case'sugarcrmaccounts':_0xf8e296[_0x6415('0x67')]=_0x6415('0xca');break;case'deskaccounts':_0xf8e296[_0x6415('0x67')]=_0x6415('0xcb');break;case'zohoaccounts':_0xf8e296[_0x6415('0x67')]='ZohoAccount';break;case'vtigeraccounts':_0xf8e296[_0x6415('0x67')]=_0x6415('0xa1');break;case _0x6415('0xcc'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xcd');break;case _0x6415('0xce'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xcf');break;case _0x6415('0xd0'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xd1');break;case _0x6415('0xd2'):_0xf8e296['childModel']=_0x6415('0xd3');break;case _0x6415('0xd4'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xd5');break;case'scheduler':_0xf8e296['childModel']=_0x6415('0xd6');break;case _0x6415('0xd7'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xd8');break;case _0x6415('0xd9'):_0xf8e296[_0x6415('0x67')]=_0x6415('0x7a');break;case _0x6415('0xda'):_0xf8e296['childModel']=_0x6415('0xdb');break;case _0x6415('0xdc'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xdd');break;case _0x6415('0xde'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xdf');break;case _0x6415('0xe0'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xe1');break;case _0x6415('0xe2'):_0xf8e296[_0x6415('0x67')]=_0x6415('0xe3');break;case _0x6415('0xe4'):_0xf8e296['childModel']=_0x6415('0x70');_0xf8e296['parentSections']=[{'name':_0x6415('0xe5'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0xf8e296[_0x6415('0x67')]=_0x6415('0xe6');break;default:return _0xf8e296;}return _0xf8e296;} \ No newline at end of file +var _0xcd4e=['then','stack','name','index','UserProfile','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','key','field','count','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','map','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','ids','addResources','sequelize','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','ignore','union','nolimit','pick','VIRTUAL','AnalyticExtractedReport','foreignKey','associatedResources','forEach','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tags','color','Tag','ThroughTags','tag','value','resourceId','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','contacts','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','chatwebsites','faxqueues','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsaccounts','teams','Team','voicequeues','VoiceQueues','users','telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','CannedAnswer','Disposition','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','templates','triggers','Trigger','trunks','Variable','plugins','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0xcd4e,0x187));var _0xecd4=function(_0x514ae5,_0x13e1cc){_0x514ae5=_0x514ae5-0x0;var _0x13ee2b=_0xcd4e[_0x514ae5];return _0x13ee2b;};'use strict';var pdf=require(_0xecd4('0x0'));var emlformat=require(_0xecd4('0x1'));var rimraf=require(_0xecd4('0x2'));var zipdir=require(_0xecd4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xecd4('0x4'));var BPromise=require(_0xecd4('0x5'));var Mustache=require('mustache');var util=require(_0xecd4('0x6'));var path=require('path');var sox=require(_0xecd4('0x7'));var csv=require('to-csv');var ejs=require(_0xecd4('0x8'));var fs=require('fs');var _=require(_0xecd4('0x9'));var squel=require(_0xecd4('0xa'));var crypto=require(_0xecd4('0xb'));var jsforce=require(_0xecd4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecd4('0xd'));var querystring=require(_0xecd4('0xe'));var Papa=require('papaparse');var Redis=require(_0xecd4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xecd4('0x10'));var hardwareService=require(_0xecd4('0x11'));var logger=require(_0xecd4('0x12'))('api');var utils=require(_0xecd4('0x13'));var config=require(_0xecd4('0x14'));var db=require('../../mysqldb')['db'];config[_0xecd4('0x15')]=_['defaults'](config[_0xecd4('0x15')],{'host':_0xecd4('0x16'),'port':0x18eb});var socket=require(_0xecd4('0x17'))(new Redis(config[_0xecd4('0x15')]));require(_0xecd4('0x18'))['register'](socket);function respondWithStatusCode(_0x3645d1,_0x21cb7b){_0x21cb7b=_0x21cb7b||0xcc;return function(_0x15dddc){if(_0x15dddc){return _0x3645d1[_0xecd4('0x19')](_0x21cb7b);}return _0x3645d1[_0xecd4('0x1a')](_0x21cb7b)[_0xecd4('0x1b')]();};}function respondWithResult(_0x2add6f,_0x39d681){_0x39d681=_0x39d681||0xc8;return function(_0x1fb460){if(_0x1fb460){return _0x2add6f['status'](_0x39d681)[_0xecd4('0x1c')](_0x1fb460);}};}function respondWithFilteredResult(_0x10d1e7,_0x41d3c6){return function(_0x2b542c){if(_0x2b542c){var _0x3eb6d0=_0x2b542c['count'],_0x2470ec=_0x41d3c6[_0xecd4('0x1d')],_0x4e11f3=_0x41d3c6[_0xecd4('0x1d')]+_0x41d3c6[_0xecd4('0x1e')],_0x703bb4;if(_0x4e11f3>=_0x3eb6d0){_0x4e11f3=_0x3eb6d0;_0x703bb4=0xc8;}else{_0x703bb4=0xce;}_0x10d1e7[_0xecd4('0x1a')](_0x703bb4);return _0x10d1e7[_0xecd4('0x1f')](_0xecd4('0x20'),_0x2470ec+'-'+_0x4e11f3+'/'+_0x3eb6d0)[_0xecd4('0x1c')](_0x2b542c);}return null;};}function patchUpdates(_0x26bb76){return function(_0x21d7d1){try{jsonpatch[_0xecd4('0x21')](_0x21d7d1,_0x26bb76,!![]);}catch(_0x14d24c){return BPromise['reject'](_0x14d24c);}return _0x21d7d1[_0xecd4('0x22')]();};}function saveUpdates(_0x353f13,_0x269451){return function(_0x588f0b){if(_0x588f0b){return _0x588f0b[_0xecd4('0x23')](_0x353f13)['then'](function(_0x57ae55){return _0x57ae55;});}return null;};}function removeEntity(_0x2e5a0a,_0x11c791){return function(_0x104507){if(_0x104507){return _0x104507[_0xecd4('0x24')]()[_0xecd4('0x25')](function(){_0x2e5a0a[_0xecd4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2910e1,_0x38b6da){return function(_0x1b76d7){if(!_0x1b76d7){_0x2910e1['sendStatus'](0x194);}return _0x1b76d7;};}function handleError(_0x2d0a43,_0x3941d4){_0x3941d4=_0x3941d4||0x1f4;return function(_0x3ccb67){logger['error'](_0x3ccb67[_0xecd4('0x26')]);if(_0x3ccb67[_0xecd4('0x27')]){delete _0x3ccb67['name'];}_0x2d0a43[_0xecd4('0x1a')](_0x3941d4)['send'](_0x3ccb67);};}exports[_0xecd4('0x28')]=function(_0x40b76f,_0x40d0a2){var _0x5e509a={},_0x3b1ef0={},_0x48e059={'count':0x0,'rows':[]};var _0x220ec5=db[_0xecd4('0x29')]['rawAttributes'];_0x3b1ef0[_0xecd4('0x2a')]=_[_0xecd4('0x2b')](_0x220ec5);_0x3b1ef0[_0xecd4('0x2c')]=_[_0xecd4('0x2b')](_0x40b76f[_0xecd4('0x2c')]);_0x3b1ef0[_0xecd4('0x2d')]=_['intersection'](_0x3b1ef0[_0xecd4('0x2a')],_0x3b1ef0[_0xecd4('0x2c')]);_0x5e509a['attributes']=_[_0xecd4('0x2e')](_0x3b1ef0[_0xecd4('0x2a')],qs['fields'](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x2f')]));_0x5e509a[_0xecd4('0x30')]=_0x5e509a[_0xecd4('0x30')][_0xecd4('0x31')]?_0x5e509a[_0xecd4('0x30')]:_0x3b1ef0[_0xecd4('0x2a')];if(!_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x32')]('nolimit')){_0x5e509a[_0xecd4('0x1e')]=qs[_0xecd4('0x1e')](_0x40b76f[_0xecd4('0x2c')]['limit']);_0x5e509a[_0xecd4('0x1d')]=qs[_0xecd4('0x1d')](_0x40b76f['query']['offset']);}_0x5e509a[_0xecd4('0x33')]=qs['sort'](_0x40b76f['query'][_0xecd4('0x34')]);_0x5e509a[_0xecd4('0x35')]=qs[_0xecd4('0x2d')](_['pick'](_0x40b76f['query'],_0x3b1ef0[_0xecd4('0x2d')]));if(_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x36')]){_0x5e509a[_0xecd4('0x35')]=_[_0xecd4('0x37')](_0x5e509a[_0xecd4('0x35')],{'$or':_['map'](_0x220ec5,function(_0x4a648f){if(_0x4a648f[_0xecd4('0x38')][_0xecd4('0x39')]!=='VIRTUAL'){var _0x2cc276={};_0x2cc276[_0x4a648f[_0xecd4('0x3a')]]={'$like':'%'+_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x36')]+'%'};return _0x2cc276;}})});}_0x5e509a=_['merge']({},_0x5e509a,_0x40b76f['options']);var _0xd8a55b={'where':_0x5e509a[_0xecd4('0x35')]};return db[_0xecd4('0x29')][_0xecd4('0x3b')](_0xd8a55b)[_0xecd4('0x25')](function(_0x32c1db){_0x48e059['count']=_0x32c1db;if(_0x40b76f['query']['includeAll']){_0x5e509a[_0xecd4('0x3c')]=[{'all':!![]}];}return db['UserProfile'][_0xecd4('0x3d')](_0x5e509a);})['then'](function(_0x3a30b4){_0x48e059[_0xecd4('0x3e')]=_0x3a30b4;return _0x48e059;})['then'](respondWithFilteredResult(_0x40d0a2,_0x5e509a))['catch'](handleError(_0x40d0a2,null));};exports[_0xecd4('0x3f')]=function(_0x107dcb,_0x38da48){var _0x4dad07={'raw':![],'where':{'id':_0x107dcb[_0xecd4('0x40')]['id']}},_0x127feb={};_0x127feb[_0xecd4('0x2a')]=_['keys'](db[_0xecd4('0x29')][_0xecd4('0x41')]);_0x127feb[_0xecd4('0x2c')]=_[_0xecd4('0x2b')](_0x107dcb[_0xecd4('0x2c')]);_0x127feb[_0xecd4('0x2d')]=_['intersection'](_0x127feb[_0xecd4('0x2a')],_0x127feb[_0xecd4('0x2c')]);_0x4dad07[_0xecd4('0x30')]=_['intersection'](_0x127feb[_0xecd4('0x2a')],qs[_0xecd4('0x2f')](_0x107dcb['query'][_0xecd4('0x2f')]));_0x4dad07['attributes']=_0x4dad07[_0xecd4('0x30')][_0xecd4('0x31')]?_0x4dad07[_0xecd4('0x30')]:_0x127feb[_0xecd4('0x2a')];if(_0x107dcb[_0xecd4('0x2c')][_0xecd4('0x42')]){_0x4dad07[_0xecd4('0x3c')]=[{'all':!![]}];}_0x4dad07=_[_0xecd4('0x37')]({},_0x4dad07,_0x107dcb['options']);return db['UserProfile'][_0xecd4('0x43')](_0x4dad07)[_0xecd4('0x25')](handleEntityNotFound(_0x38da48,null))[_0xecd4('0x25')](respondWithResult(_0x38da48,null))[_0xecd4('0x44')](handleError(_0x38da48,null));};exports[_0xecd4('0x45')]=function(_0x3df41d,_0x580bd2){return db[_0xecd4('0x29')][_0xecd4('0x45')](_0x3df41d[_0xecd4('0x46')],{})[_0xecd4('0x25')](respondWithResult(_0x580bd2,0xc9))[_0xecd4('0x44')](handleError(_0x580bd2,null));};exports['clone']=function(_0x483483,_0x35888c){var _0x3074a8={'raw':![],'where':{'id':_0x483483[_0xecd4('0x40')]['id']}},_0x52baf3={};_0x52baf3[_0xecd4('0x2a')]=_[_0xecd4('0x2b')](db[_0xecd4('0x29')][_0xecd4('0x41')]);_0x3074a8[_0xecd4('0x30')]=_['intersection'](_0x52baf3['model'],qs[_0xecd4('0x2f')](_0x483483[_0xecd4('0x2c')][_0xecd4('0x2f')]));_0x3074a8[_0xecd4('0x30')]=_0x3074a8[_0xecd4('0x30')]['length']?_0x3074a8[_0xecd4('0x30')]:_0x52baf3[_0xecd4('0x2a')];if(_0x483483[_0xecd4('0x2c')][_0xecd4('0x42')]){_0x3074a8[_0xecd4('0x3c')]=[{'all':!![]}];}_0x3074a8=_['merge']({},_0x3074a8,_0x483483['options']);return db['UserProfile']['find'](_0x3074a8)[_0xecd4('0x25')](handleEntityNotFound(_0x35888c,null))['then'](function(_0x1af2ab){if(_0x1af2ab){var _0xb17fee=_0x1af2ab[_0xecd4('0x47')]({'plain':!![]});_0xb17fee=qs[_0xecd4('0x48')](_0xb17fee,['id','createdAt',_0xecd4('0x49'),_0xecd4('0x4a')]);_0x483483[_0xecd4('0x46')]=_[_0xecd4('0x48')](_0x483483[_0xecd4('0x46')],['id',_0xecd4('0x4b'),_0xecd4('0x49')]);return db['sequelize'][_0xecd4('0x4c')](function(_0x547688){return db['UserProfile'][_0xecd4('0x45')](_[_0xecd4('0x37')](_0xb17fee,_0x483483[_0xecd4('0x46')]),{'include':_0x483483['query'][_0xecd4('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x547688})['then'](function(_0xca6077){var _0x5f0ff3=_0xca6077[_0xecd4('0x47')]({'plain':!![]});return db[_0xecd4('0x4d')]['findAll']({'where':{'userProfileId':_0x483483['params']['id']},'raw':!![]})[_0xecd4('0x25')](function(_0x4914f2){if(_0x4914f2){return BPromise[_0xecd4('0x4e')](_0x4914f2,function(_0x332877){return new BPromise(function(_0x389c51,_0x52ca85){if(_0x332877[_0xecd4('0x4f')]===null||_0x332877[_0xecd4('0x4f')]===0x1)_0x389c51(null);return db[_0xecd4('0x50')][_0xecd4('0x3d')]({'where':{'sectionId':_0x332877['id']},'raw':!![]})['then'](function(_0x354de9){var _0x106a2a=_[_0xecd4('0x51')](_0x354de9,function(_0x2e87f1){return qs['omit'](_0x2e87f1,['id',_0xecd4('0x4b'),'updatedAt',_0xecd4('0x52')]);});_0x389c51(_0x106a2a);})[_0xecd4('0x44')](function(_0x508c07){_0x52ca85(_0x508c07);});})[_0xecd4('0x25')](function(_0x12852e){var _0xb59285=qs[_0xecd4('0x48')](_0x332877,['id','createdAt',_0xecd4('0x49')]);_0xb59285[_0xecd4('0x53')]=_0x5f0ff3['id'];if(_0x12852e)_0xb59285['Resources']=_0x12852e;return _0xb59285;})[_0xecd4('0x25')](function(_0x2c95cc){return db[_0xecd4('0x4d')][_0xecd4('0x45')](_0x2c95cc,{'include':[{'model':db[_0xecd4('0x50')],'as':_0xecd4('0x54')}],'raw':!![],'transaction':_0x547688});});})[_0xecd4('0x25')](function(){return _0x5f0ff3;});}});});});}})[_0xecd4('0x25')](respondWithResult(_0x35888c,0xc9))[_0xecd4('0x44')](handleError(_0x35888c,null));};exports[_0xecd4('0x23')]=function(_0x3352ae,_0x26263c){if(_0x3352ae[_0xecd4('0x46')]['id']){delete _0x3352ae['body']['id'];}return db['UserProfile'][_0xecd4('0x43')]({'where':{'id':_0x3352ae[_0xecd4('0x40')]['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x26263c,null))['then'](saveUpdates(_0x3352ae[_0xecd4('0x46')],null))[_0xecd4('0x25')](respondWithResult(_0x26263c,null))['catch'](handleError(_0x26263c,null));};exports['destroy']=function(_0x295eb4,_0x4188b8){return db[_0xecd4('0x29')][_0xecd4('0x43')]({'where':{'id':_0x295eb4['params']['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x4188b8,null))[_0xecd4('0x25')](removeEntity(_0x4188b8,null))[_0xecd4('0x44')](handleError(_0x4188b8,null));};exports[_0xecd4('0x55')]=function(_0x1fe33a,_0xc813dc){return db['UserProfile'][_0xecd4('0x55')]()[_0xecd4('0x25')](respondWithResult(_0xc813dc,null))[_0xecd4('0x44')](handleError(_0xc813dc,null));};exports[_0xecd4('0x56')]=function(_0x12b840,_0x363f8c){var _0x1f5622=_0x12b840[_0xecd4('0x46')];return db['UserProfile'][_0xecd4('0x43')]({'where':{'id':_0x12b840[_0xecd4('0x40')]['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x363f8c,null))[_0xecd4('0x25')](function(_0x53479c){if(_0x53479c){return db['sequelize']['transaction'](function(_0x6553f5){return db[_0xecd4('0x4d')][_0xecd4('0x24')]({'where':{'userProfileId':_0x12b840['params']['id'],'sectionId':_[_0xecd4('0x51')](_0x1f5622,function(_0x15ae5e){return _0x15ae5e[_0xecd4('0x52')];})},'transaction':_0x6553f5})[_0xecd4('0x25')](function(){var _0x56777b=_[_0xecd4('0x51')](_0x1f5622,function(_0x1c5fbf){_0x1c5fbf[_0xecd4('0x53')]=_0x12b840[_0xecd4('0x40')]['id'];return _0x1c5fbf;});var _0x176952=[];return BPromise['each'](_0x56777b,function(_0x561cff){return db[_0xecd4('0x4d')]['create'](_0x561cff,{'include':[{'model':db[_0xecd4('0x50')],'as':'Resources'}],'raw':!![],'transaction':_0x6553f5})[_0xecd4('0x25')](function(_0x31f4fa){_0x176952[_0xecd4('0x57')](_0x31f4fa[_0xecd4('0x47')]({'plain':!![]}));});})[_0xecd4('0x25')](function(){return _0x176952;});});});}})[_0xecd4('0x25')](function(_0x48f1d5){return _0x48f1d5;})[_0xecd4('0x25')](respondWithResult(_0x363f8c,null))[_0xecd4('0x44')](handleError(_0x363f8c,null));};exports[_0xecd4('0x58')]=function(_0x154a43,_0x2ca8d7){var _0x21624b;return db['UserProfile'][_0xecd4('0x43')]({'where':{'id':_0x154a43[_0xecd4('0x40')]['id']},'attributes':['id',_0xecd4('0x27')]})['then'](handleEntityNotFound(_0x2ca8d7,null))[_0xecd4('0x25')](function(_0x2ed5be){if(_0x2ed5be){_0x21624b=_0x2ed5be;return db[_0xecd4('0x4d')][_0xecd4('0x24')]({'where':{'userProfileId':_0x154a43[_0xecd4('0x40')]['id'],'sectionId':_0x154a43[_0xecd4('0x2c')][_0xecd4('0x59')]}});}})[_0xecd4('0x25')](function(){return _0x21624b;})[_0xecd4('0x25')](respondWithStatusCode(_0x2ca8d7,null))[_0xecd4('0x44')](handleError(_0x2ca8d7,null));};exports[_0xecd4('0x5a')]=function(_0x339bf3,_0x3a654a){return db[_0xecd4('0x29')][_0xecd4('0x43')]({'where':{'id':_0x339bf3[_0xecd4('0x40')]['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x3a654a,null))[_0xecd4('0x25')](function(_0x19bc17){if(_0x19bc17){return db[_0xecd4('0x5b')][_0xecd4('0x4c')](function(_0x1ad74c){return db[_0xecd4('0x4d')]['findAll']({'where':{'userProfileId':_0x339bf3[_0xecd4('0x40')]['id']},'attributes':['id'],'raw':!![]})[_0xecd4('0x25')](function(_0x32e6df){if(_0x32e6df){return db[_0xecd4('0x4d')][_0xecd4('0x24')]({'where':{'userProfileId':_0x339bf3[_0xecd4('0x40')]['id'],'id':_['map'](_0x32e6df,function(_0x51b6a2){return _0x51b6a2['id'];})},'transaction':_0x1ad74c});}})[_0xecd4('0x25')](function(_0x3a6aa3){var _0x46060d=_[_0xecd4('0x51')](_0x339bf3[_0xecd4('0x46')],function(_0x5b3a6c){_0x5b3a6c[_0xecd4('0x53')]=_0x339bf3[_0xecd4('0x40')]['id'];return _0x5b3a6c;});return db[_0xecd4('0x4d')]['bulkCreate'](_0x46060d,{'raw':!![],'transaction':_0x1ad74c});})['then'](function(_0x4842f8){var _0x57c9ce=_[_0xecd4('0x36')](_['map'](_0x4842f8,function(_0x216bc6){return _0x216bc6[_0xecd4('0x47')]({'plain':!![]});}),{'includeAll':![]});if(_0x57c9ce){return db[_0xecd4('0x4d')]['findAll']({'where':{'userProfileId':_0x339bf3[_0xecd4('0x40')]['id'],'sectionId':_[_0xecd4('0x51')](_0x57c9ce,function(_0x838c6e){return _0x838c6e[_0xecd4('0x52')];})},'attributes':['id',_0xecd4('0x52')],'raw':!![]})[_0xecd4('0x25')](function(_0x47ade6){var _0x4b1345=_[_0xecd4('0x51')](_0x339bf3['body'],function(_0x104e6a){_0x104e6a[_0xecd4('0x53')]=_0x339bf3[_0xecd4('0x40')]['id'];return _0x104e6a;});return db[_0xecd4('0x50')][_0xecd4('0x5c')](_0x4b1345,{'raw':!![],'transaction':_0x1ad74c});});}})[_0xecd4('0x44')](handleError(_0x3a654a,null));});}})[_0xecd4('0x25')](function(_0x5590bc){var _0x31391b=_[_0xecd4('0x51')](_0x5590bc,function(_0x20ee7e){return _0x20ee7e[_0xecd4('0x47')]({'plain':!![]});});})[_0xecd4('0x25')](respondWithResult(_0x3a654a,null))[_0xecd4('0x44')](handleError(_0x3a654a,null));};exports[_0xecd4('0x5d')]=function(_0x56362e,_0x8b3961,_0xd89f38){return db[_0xecd4('0x29')]['find']({'where':{'id':_0x56362e[_0xecd4('0x40')]['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x8b3961,null))[_0xecd4('0x25')](function(_0x692bbf){if(_0x692bbf){return _0x692bbf[_0xecd4('0x5d')](_0x56362e['query'][_0xecd4('0x59')]);}})[_0xecd4('0x25')](respondWithStatusCode(_0x8b3961,null))[_0xecd4('0x44')](handleError(_0x8b3961,null));};exports[_0xecd4('0x5e')]=function(_0x833d47,_0x2235b0){var _0x44309f={'raw':![],'where':{}};var _0x489697={};var _0x5c263c={'count':0x0,'rows':[]};var _0x13461c=_0x833d47['query']['section'];if(typeof _0x13461c===_0xecd4('0x5f')){throw new db[(_0xecd4('0x60'))][(_0xecd4('0x61'))]('Unknown\x20section');}var _0x534456=_0x833d47[_0xecd4('0x2c')][_0xecd4('0x62')]||![];var _0x32a599=getQueryModels(_0x13461c,_0x534456);if(typeof _0x32a599[_0xecd4('0x63')]===_0xecd4('0x5f')){throw new db[(_0xecd4('0x60'))][(_0xecd4('0x61'))](_0xecd4('0x64')+_0x13461c+'\x27');}var _0x3d75af=[];if(!_[_0xecd4('0x65')](_0x32a599['parentSections'])){_0x3d75af=_0x32a599[_0xecd4('0x66')];}else{_0x3d75af=[{'name':_0x13461c}];}return db[_0xecd4('0x29')][_0xecd4('0x67')]({'where':{'id':_0x833d47[_0xecd4('0x40')]['id']}})[_0xecd4('0x25')](handleEntityNotFound(_0x2235b0,null))[_0xecd4('0x25')](function(_0x50e99c){if(_0x50e99c){var _0x17ca9a=[];for(var _0x45cc14=0x0;_0x45cc14<_0x3d75af['length'];_0x45cc14++){_0x17ca9a['push'](db[_0xecd4('0x4d')][_0xecd4('0x67')]({'where':{'userProfileId':_0x50e99c['id'],'name':_0x3d75af[_0x45cc14]['name']},'raw':!![]}));}return BPromise['all'](_0x17ca9a);}})[_0xecd4('0x25')](function(_0x18888e){var _0x327c0f=_[_0xecd4('0x36')](_0x18888e,function(_0x4240ad){return _0x4240ad?_0x4240ad:undefined;});var _0x54daba=_[_0xecd4('0x36')](_0x3d75af,[_0xecd4('0x68'),!![]]);var _0x28d8e2=_[_0xecd4('0x65')](_0x327c0f)&&_[_0xecd4('0x65')](_0x54daba)?null:_[_0xecd4('0x69')](_0x54daba,_0x327c0f);if(_0x28d8e2){var _0xbefb6a=[];for(var _0x4d727d=0x0;_0x4d727d<_0x28d8e2[_0xecd4('0x31')];_0x4d727d++){var _0x5a5e91=_[_0xecd4('0x43')](_0x3d75af,function(_0x4e6459){return _0x28d8e2[_0x4d727d]?_0x4e6459[_0xecd4('0x27')]===_0x28d8e2[_0x4d727d]['name']:null;});if(_0x5a5e91){if(_0x28d8e2[_0x4d727d]['ignore']){_0xbefb6a[_0xecd4('0x57')](getAllResources(_0x32a599['childModel'],_0x28d8e2[_0x4d727d]));}else{if(!_0x28d8e2[_0x4d727d][_0xecd4('0x4f')]){_0xbefb6a[_0xecd4('0x57')](getAllowedResources(_0x5a5e91,_0x28d8e2[_0x4d727d],_0x32a599[_0xecd4('0x63')]));}else{if(_0x5a5e91[_0xecd4('0x2a')]){_0xbefb6a['push'](getAllFilteredResources(_0x5a5e91,_0x28d8e2[_0x4d727d]));}}}}}return BPromise['all'](_0xbefb6a);}else{return null;}})[_0xecd4('0x25')](function(_0x1c9e12){var _0x445b28=_0x1c9e12;var _0xe61df0=null;if(_0x445b28){_0xe61df0=_0x445b28[_0xecd4('0x31')]===0x1?_0x445b28[0x0]:null;}if(_0xe61df0||_0x445b28){var _0x2ab325=db[_0x32a599[_0xecd4('0x63')]]['rawAttributes'];_0x489697[_0xecd4('0x2a')]=_[_0xecd4('0x2b')](_0x2ab325);_0x489697[_0xecd4('0x2c')]=_['keys'](_0x833d47[_0xecd4('0x2c')]);_0x489697[_0xecd4('0x2d')]=_[_0xecd4('0x2e')](_0x489697[_0xecd4('0x2a')],_0x489697['query']);_0x44309f[_0xecd4('0x30')]=_[_0xecd4('0x2e')](_0x489697[_0xecd4('0x2a')],qs[_0xecd4('0x2f')](_0x833d47[_0xecd4('0x2c')][_0xecd4('0x2f')]));_0x44309f[_0xecd4('0x30')]=_0x44309f[_0xecd4('0x30')][_0xecd4('0x31')]?_0x44309f['attributes']:_0x489697['model'];if(!_0x833d47['query'][_0xecd4('0x32')](_0xecd4('0x6a'))){_0x44309f[_0xecd4('0x1e')]=qs[_0xecd4('0x1e')](_0x833d47[_0xecd4('0x2c')][_0xecd4('0x1e')]);_0x44309f[_0xecd4('0x1d')]=qs['offset'](_0x833d47[_0xecd4('0x2c')]['offset']);}_0x44309f[_0xecd4('0x33')]=qs[_0xecd4('0x34')](_0x833d47[_0xecd4('0x2c')][_0xecd4('0x34')]);_0x44309f[_0xecd4('0x35')]=qs[_0xecd4('0x2d')](_[_0xecd4('0x6b')](_0x833d47[_0xecd4('0x2c')],_0x489697['filters']));if(_0x833d47['query'][_0xecd4('0x36')]){_0x44309f[_0xecd4('0x35')]=_['merge'](_0x44309f[_0xecd4('0x35')],{'$or':_[_0xecd4('0x51')](_0x2ab325,function(_0xc6082){if(_0xc6082[_0xecd4('0x38')]['key']!==_0xecd4('0x6c')){var _0x453ef1={};_0x453ef1[_0xc6082['field']]={'$like':'%'+_0x833d47[_0xecd4('0x2c')][_0xecd4('0x36')]+'%'};return _0x453ef1;}})});}var _0x63bb54=[];if(_0xe61df0){var _0x1f6920=_[_0xecd4('0x43')](_0x3d75af,['name',_0xe61df0[_0xecd4('0x27')]]);if(_0x1f6920[_0xecd4('0x3a')]){var _0x10336e={};if(_0x32a599[_0xecd4('0x63')]===_0xecd4('0x6d')){_0x10336e[_0x1f6920['foreignKey']]=_[_0xecd4('0x51')](_0xe61df0['associatedResources'],'id');}else{_0x10336e[_0x1f6920[_0xecd4('0x6e')]]=_0xe61df0[_0xecd4('0x6f')];}_0x63bb54[_0xecd4('0x57')](_0x10336e);}else{_0x44309f['where']['id']=_0xe61df0[_0xecd4('0x6f')];}}else{for(var _0x13ba21=0x0;_0x13ba21<_0x445b28[_0xecd4('0x31')];_0x13ba21++){var _0x1f6920=_[_0xecd4('0x43')](_0x3d75af,[_0xecd4('0x27'),_0x445b28[_0x13ba21][_0xecd4('0x27')]]);if(_0x1f6920[_0xecd4('0x3a')]){var _0x10336e={};_0x10336e[_0x1f6920[_0xecd4('0x6e')]]=_0x445b28[_0x13ba21][_0xecd4('0x6f')];_0x63bb54[_0xecd4('0x57')](_0x10336e);}else{if(!_0x44309f[_0xecd4('0x35')]['id'])_0x44309f[_0xecd4('0x35')]['id']=[];_0x445b28[_0x13ba21][_0xecd4('0x6f')][_0xecd4('0x70')](function(_0x30f56c){_0x44309f['where']['id'][_0xecd4('0x57')](_0x30f56c);});}}}if(!_[_0xecd4('0x65')](_0x63bb54)){_0x44309f[_0xecd4('0x35')]=_[_0xecd4('0x37')](_0x44309f[_0xecd4('0x35')],{'$and':{'$or':_0x63bb54}});}_0x44309f=_[_0xecd4('0x37')]({},_0x44309f,_0x833d47['options']);if(_0xe61df0&&!_0xe61df0['autoAssociation']&&_0x32a599[_0xecd4('0x63')]===_0xecd4('0x6d')){if(_0x833d47['query']['includeAll']){_0x44309f[_0xecd4('0x3c')]=[{'all':!![]}];}return db[_0x32a599[_0xecd4('0x63')]][_0xecd4('0x3d')](_0x44309f)['then'](function(_0x546dfd){var _0x44453d=[];_0x546dfd[_0xecd4('0x70')](function(_0xb2fde6){var _0xeca94;switch(_0xb2fde6[_0xecd4('0x71')]){case _0xecd4('0x72'):_0xeca94=_[_0xecd4('0x43')](_0xe61df0['associatedResources'],function(_0x3f64be){return _0x3f64be['id']===_0xb2fde6[_0xecd4('0x73')]&&_0x3f64be[_0xecd4('0x38')]===_0xecd4('0x74');});break;case'custom':_0xeca94=_[_0xecd4('0x43')](_0xe61df0[_0xecd4('0x6f')],function(_0x3c8714){return _0x3c8714['id']===_0xb2fde6[_0xecd4('0x73')]&&_0x3c8714[_0xecd4('0x38')]===_0xecd4('0x75');});break;}if(_0xeca94)_0x44453d[_0xecd4('0x57')](_0xb2fde6);});_0x5c263c[_0xecd4('0x3b')]=_0x44453d[_0xecd4('0x31')];_0x5c263c['rows']=_0x44453d;return _0x5c263c;});}else{return db[_0x32a599[_0xecd4('0x63')]]['count']({'where':_0x44309f[_0xecd4('0x35')]})['then'](function(_0x5bd35a){_0x5c263c['count']=_0x5bd35a;if(_0x833d47[_0xecd4('0x2c')][_0xecd4('0x42')]){if(_0x32a599[_0xecd4('0x63')]===_0xecd4('0x76')){_0x44309f[_0xecd4('0x3c')]=[{'model':db['Tag'],'as':_0xecd4('0x77'),'attributes':['id',_0xecd4('0x27'),_0xecd4('0x78')],'required':_0x833d47[_0xecd4('0x2c')]['tag']?!![]:![]},{'model':db[_0xecd4('0x79')],'as':_0xecd4('0x7a'),'attributes':['id',_0xecd4('0x27'),_0xecd4('0x78')],'through':_0x833d47[_0xecd4('0x2c')][_0xecd4('0x7b')]?{'attributes':[],'where':{'TagId':_0x833d47[_0xecd4('0x2c')][_0xecd4('0x7b')]||undefined}}:{},'required':_0x833d47[_0xecd4('0x2c')][_0xecd4('0x7b')]?!![]:![]}];}else{_0x44309f['include']=[{'all':!![]}];}}return db[_0x32a599['childModel']]['findAll'](_0x44309f);})[_0xecd4('0x25')](function(_0x2c81ba){_0x5c263c[_0xecd4('0x3e')]=_0x2c81ba;return _0x5c263c;});}}else{return _0x5c263c;}})[_0xecd4('0x25')](respondWithFilteredResult(_0x2235b0,_0x44309f))[_0xecd4('0x44')](handleError(_0x2235b0,null));};function getAllResources(_0x3dac1f,_0x50fb56){return new BPromise(function(_0x2b4abf,_0xb5dbbd){if(_0x50fb56){var _0x2249ea=_0x50fb56[_0xecd4('0x36')]?{[_0x50fb56['filter'][_0xecd4('0x3a')]]:_0x50fb56[_0xecd4('0x36')][_0xecd4('0x7c')]}:undefined;return db[_0x3dac1f]['findAll']({'where':_0x2249ea,'raw':!![]})[_0xecd4('0x25')](function(_0x4e81d2){_0x50fb56[_0xecd4('0x6f')]=_[_0xecd4('0x51')](_0x4e81d2,'id');_0x2b4abf(_0x50fb56);})['catch'](function(_0x123716){_0xb5dbbd(_0x123716);});}else{_0x2b4abf(null);}});}function getAllFilteredResources(_0x4cadc7,_0x439cea){return new BPromise(function(_0x559f79,_0x5c1b54){var _0x733128=_0x4cadc7[_0xecd4('0x36')]?{[_0x4cadc7[_0xecd4('0x36')][_0xecd4('0x3a')]]:_0x4cadc7[_0xecd4('0x36')][_0xecd4('0x7c')]}:undefined;return db[_0x4cadc7[_0xecd4('0x2a')]][_0xecd4('0x3d')]({'where':_0x733128,'raw':!![]})[_0xecd4('0x25')](function(_0x2a2ccf){_0x439cea['associatedResources']=_[_0xecd4('0x51')](_0x2a2ccf,function(_0x52daac){return _0x52daac[_0xecd4('0x27')];});_0x559f79(_0x439cea);})['catch'](function(_0x209b78){_0x5c1b54(_0x209b78);});});}function getAllowedResources(_0x22d750,_0x275c02,_0x3002c5){return new BPromise(function(_0x2e320e,_0x262bbc){if(_0x275c02){return db[_0xecd4('0x50')][_0xecd4('0x3d')]({'where':{'sectionId':_0x275c02['id']},'raw':!![]})[_0xecd4('0x25')](function(_0x32946e){if(_0x22d750[_0xecd4('0x3a')]&&_0x22d750[_0xecd4('0x3a')]!=='id'){_0x275c02[_0xecd4('0x6f')]=_['map'](_0x32946e,function(_0x2ccad3){return _0x2ccad3[_0x22d750[_0xecd4('0x3a')]];});}else{if(_0x3002c5===_0xecd4('0x6d')){_0x275c02[_0xecd4('0x6f')]=_[_0xecd4('0x51')](_0x32946e,function(_0x3f16fc){return{'id':_0x3f16fc[_0xecd4('0x7d')],'type':_0x3f16fc['type']};});}else{_0x275c02[_0xecd4('0x6f')]=_[_0xecd4('0x51')](_0x32946e,function(_0x2b124f){return _0x2b124f[_0xecd4('0x7d')];});}}_0x2e320e(_0x275c02);})[_0xecd4('0x44')](function(_0x4e0927){_0x262bbc(_0x4e0927);});}else{_0x2e320e(null);}});}function getQueryModels(_0x11da8c,_0x4bed69){var _0x37c5d7=_0x11da8c[_0xecd4('0x7e')]();var _0x23f549={'childModel':undefined,'parentSections':[]};switch(_0x37c5d7){case'squareprojects':_0x23f549[_0xecd4('0x63')]=_0xecd4('0x7f');break;case _0xecd4('0x80'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x81');break;case _0xecd4('0x82'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x83');_0x23f549[_0xecd4('0x66')]=[{'name':_0xecd4('0x84'),'field':_0xecd4('0x27'),'foreignKey':'projectName'}];break;case _0xecd4('0x85'):_0x23f549[_0xecd4('0x63')]='JscriptyProject';break;case _0xecd4('0x86'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x76');_0x23f549['parentSections']=[{'name':_0xecd4('0x87'),'field':'id','foreignKey':_0xecd4('0x88')}];break;case _0xecd4('0x89'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x8a');break;case _0xecd4('0x8b'):_0x23f549[_0xecd4('0x63')]='CmCompany';break;case _0xecd4('0x8c'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x8d');break;case _0xecd4('0x8e'):_0x23f549[_0xecd4('0x63')]='ChatQueue';break;case _0xecd4('0x8f'):_0x23f549[_0xecd4('0x63')]='ChatWebsite';break;case _0xecd4('0x90'):_0x23f549[_0xecd4('0x63')]='FaxQueue';break;case'faxaccounts':_0x23f549['childModel']='FaxAccount';break;case _0xecd4('0x91'):case _0xecd4('0x92'):case _0xecd4('0x93'):_0x23f549['childModel']=_0xecd4('0x94');break;case _0xecd4('0x95'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x96');break;case _0xecd4('0x97'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0x98');break;case _0xecd4('0x99'):_0x23f549['childModel']=_0xecd4('0x9a');_0x23f549['parentSections']=[{'name':_0xecd4('0x9b'),'field':_0xecd4('0x27'),'foreignKey':_0xecd4('0x9c'),'model':_0xecd4('0x9d'),'filter':{'field':_0xecd4('0x9e'),'value':[_0xecd4('0x9f')]}},{'name':_0xecd4('0xa0'),'field':_0xecd4('0x27'),'foreignKey':_0xecd4('0x9c'),'model':'User','filter':{'field':_0xecd4('0x9e'),'value':['telephone']}},{'name':'VoiceQueues','field':_0xecd4('0x27'),'foreignKey':_0xecd4('0xa1'),'model':_0xecd4('0xa2'),'filter':{'field':_0xecd4('0x38'),'value':[_0xecd4('0xa3')]}},{'name':'QueueCampaigns','field':_0xecd4('0x27'),'foreignKey':'queue','model':_0xecd4('0xa2'),'filter':{'field':'type','value':[_0xecd4('0xa4')]}}];break;case _0xecd4('0xa5'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xa6');break;case _0xecd4('0xa7'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xa8');break;case _0xecd4('0xa9'):_0x23f549[_0xecd4('0x63')]='VoicePrefix';break;case _0xecd4('0xaa'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xab');break;case'mailqueues':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xac');break;case _0xecd4('0xad'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xae');break;case'mailsubstatuses':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xaf');break;case _0xecd4('0xb0'):_0x23f549['childModel']='OpenchannelQueue';break;case _0xecd4('0xb1'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xb2');break;case'smsqueues':_0x23f549[_0xecd4('0x63')]='SmsQueue';break;case _0xecd4('0xb3'):_0x23f549[_0xecd4('0x63')]='SmsAccount';break;case _0xecd4('0xb4'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xb5');break;case _0xecd4('0xb6'):case'queuecampaigns':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xa2');if(_0x4bed69){_0x23f549[_0xecd4('0x66')]=[{'name':_0xecd4('0xb7')},{'name':'QueueCampaigns'}];}break;case _0xecd4('0xb8'):case'agents':case _0xecd4('0xb9'):_0x23f549[_0xecd4('0x63')]='User';if(_0x4bed69){_0x23f549['parentSections']=[{'name':'Users','filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xecd4('0xba'):_0x23f549['childModel']=_0xecd4('0xbb');break;case _0xecd4('0xbc'):_0x23f549['childModel']=_0xecd4('0xbd');break;case'freshdeskaccounts':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xbe');break;case _0xecd4('0xbf'):_0x23f549['childModel']=_0xecd4('0xc0');break;case'deskaccounts':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xc1');break;case _0xecd4('0xc2'):_0x23f549[_0xecd4('0x63')]='ZohoAccount';break;case'vtigeraccounts':_0x23f549['childModel']='User';break;case'cannedanswers':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xc3');break;case'dispositions':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xc4');break;case _0xecd4('0xc5'):_0x23f549[_0xecd4('0x63')]='Dashboard';break;case'intervals':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xc6');break;case _0xecd4('0xc7'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xc8');break;case _0xecd4('0xc9'):_0x23f549['childModel']=_0xecd4('0xca');break;case _0xecd4('0xcb'):_0x23f549[_0xecd4('0x63')]='Sound';break;case _0xecd4('0xcc'):_0x23f549['childModel']=_0xecd4('0x79');break;case _0xecd4('0xcd'):_0x23f549[_0xecd4('0x63')]='Template';break;case _0xecd4('0xce'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xcf');break;case _0xecd4('0xd0'):_0x23f549[_0xecd4('0x63')]='Trunk';break;case'variables':_0x23f549[_0xecd4('0x63')]=_0xecd4('0xd1');break;case _0xecd4('0xd2'):_0x23f549[_0xecd4('0x63')]='Plugin';break;case'extractedreports':_0x23f549[_0xecd4('0x63')]=_0xecd4('0x6d');_0x23f549[_0xecd4('0x66')]=[{'name':_0xecd4('0xd3'),'field':'id','foreignKey':'reportId'}];break;case _0xecd4('0xd4'):_0x23f549[_0xecd4('0x63')]=_0xecd4('0xd5');break;default:return _0x23f549;}return _0x23f549;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3a296fe..d874a1f 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 _0x2cb6=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x2cb6,0xe6));var _0x62cb=function(_0x1b7219,_0x526de0){_0x1b7219=_0x1b7219-0x0;var _0x4cd8c0=_0x2cb6[_0x1b7219];return _0x4cd8c0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x62cb('0x0'))['db'][_0x62cb('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x62cb('0x2')](0x0);var events={'afterCreate':_0x62cb('0x3'),'afterUpdate':_0x62cb('0x4'),'afterDestroy':_0x62cb('0x5')};function emitEvent(_0x43310e){return function(_0x540ed5,_0x1f2ca5,_0x2ad7a6){UserProfileEvents[_0x62cb('0x6')](_0x43310e+':'+_0x540ed5['id'],_0x540ed5);UserProfileEvents[_0x62cb('0x6')](_0x43310e,_0x540ed5);_0x2ad7a6(null);};}for(var e in events){if(events[_0x62cb('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x62cb('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','UserProfile','setMaxListeners'];(function(_0x13561d,_0x279aab){var _0x5c2031=function(_0x3e7668){while(--_0x3e7668){_0x13561d['push'](_0x13561d['shift']());}};_0x5c2031(++_0x279aab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xcb91[_0x2ff762];return _0x158b02;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x1cb9('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){UserProfileEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);UserProfileEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];UserProfile[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e2f8715..e699929 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 _0x2899=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile'];(function(_0x5bb1d4,_0x2487d4){var _0x3ad63f=function(_0x3067af){while(--_0x3067af){_0x5bb1d4['push'](_0x5bb1d4['shift']());}};_0x3ad63f(++_0x2487d4);}(_0x2899,0x1b8));var _0x9289=function(_0x1c9f57,_0x2adb85){_0x1c9f57=_0x1c9f57-0x0;var _0x812908=_0x2899[_0x1c9f57];return _0x812908;};'use strict';var _=require(_0x9289('0x0'));var util=require('util');var logger=require(_0x9289('0x1'))(_0x9289('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9289('0x3'));var fs=require('fs');var path=require(_0x9289('0x4'));var rimraf=require(_0x9289('0x5'));var config=require(_0x9289('0x6'));var attributes=require(_0x9289('0x7'));module[_0x9289('0x8')]=function(_0x5af914,_0x319c84){return _0x5af914[_0x9289('0x9')](_0x9289('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88f2=['../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x26f97b,_0x64602f){var _0x29c0a8=function(_0x14b520){while(--_0x14b520){_0x26f97b['push'](_0x26f97b['shift']());}};_0x29c0a8(++_0x64602f);}(_0x88f2,0x10a));var _0x288f=function(_0x36128b,_0x5665f3){_0x36128b=_0x36128b-0x0;var _0x2f0ab9=_0x88f2[_0x36128b];return _0x2f0ab9;};'use strict';var _=require(_0x288f('0x0'));var util=require(_0x288f('0x1'));var logger=require(_0x288f('0x2'))(_0x288f('0x3'));var moment=require('moment');var BPromise=require(_0x288f('0x4'));var rp=require(_0x288f('0x5'));var fs=require('fs');var path=require(_0x288f('0x6'));var rimraf=require('rimraf');var config=require(_0x288f('0x7'));var attributes=require(_0x288f('0x8'));module[_0x288f('0x9')]=function(_0x41e6df,_0x1c7da9){return _0x41e6df[_0x288f('0xa')](_0x288f('0xb'),attributes,{'tableName':_0x288f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 16f8006..1651db2 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 _0x7d1b=['info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\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','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x3fa4e3,_0x3f133b){var _0xa18d5d=function(_0xe911cc){while(--_0xe911cc){_0x3fa4e3['push'](_0x3fa4e3['shift']());}};_0xa18d5d(++_0x3f133b);}(_0x7d1b,0x159));var _0xb7d1=function(_0x509859,_0x3bd8af){_0x509859=_0x509859-0x0;var _0x548fbd=_0x7d1b[_0x509859];return _0x548fbd;};'use strict';var _=require(_0xb7d1('0x0'));var util=require(_0xb7d1('0x1'));var moment=require(_0xb7d1('0x2'));var BPromise=require(_0xb7d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7d1('0x4'));var db=require(_0xb7d1('0x5'))['db'];var utils=require(_0xb7d1('0x6'));var logger=require(_0xb7d1('0x7'))(_0xb7d1('0x8'));var config=require('../../config/environment');var jayson=require(_0xb7d1('0x9'));var client=jayson[_0xb7d1('0xa')][_0xb7d1('0xb')]({'port':0x232a});config[_0xb7d1('0xc')]=_[_0xb7d1('0xd')](config[_0xb7d1('0xc')],{'host':_0xb7d1('0xe'),'port':0x18eb});var socket=require(_0xb7d1('0xf'))(new Redis(config[_0xb7d1('0xc')]));require(_0xb7d1('0x10'))[_0xb7d1('0x11')](socket);function respondWithRpcPromise(_0x3256a2,_0x559e3f,_0x24a14d){return new BPromise(function(_0x574266,_0x269d02){return client[_0xb7d1('0x12')](_0x3256a2,_0x24a14d)['then'](function(_0x15813c){logger[_0xb7d1('0x13')](_0xb7d1('0x14'),_0x559e3f,_0xb7d1('0x15'));logger['debug'](_0xb7d1('0x16'),_0x559e3f,_0xb7d1('0x15'),JSON[_0xb7d1('0x17')](_0x15813c));if(_0x15813c[_0xb7d1('0x18')]){if(_0x15813c[_0xb7d1('0x18')][_0xb7d1('0x19')]===0x1f4){logger[_0xb7d1('0x18')](_0xb7d1('0x14'),_0x559e3f,_0x15813c[_0xb7d1('0x18')][_0xb7d1('0x1a')]);return _0x269d02(_0x15813c[_0xb7d1('0x18')][_0xb7d1('0x1a')]);}logger[_0xb7d1('0x18')](_0xb7d1('0x14'),_0x559e3f,_0x15813c[_0xb7d1('0x18')][_0xb7d1('0x1a')]);return _0x574266(_0x15813c[_0xb7d1('0x18')][_0xb7d1('0x1a')]);}else{logger[_0xb7d1('0x13')](_0xb7d1('0x14'),_0x559e3f,'request\x20sent');_0x574266(_0x15813c[_0xb7d1('0x1b')][_0xb7d1('0x1a')]);}})['catch'](function(_0x4baf3d){logger[_0xb7d1('0x18')]('UserProfile,\x20%s,\x20%s',_0x559e3f,_0x4baf3d);_0x269d02(_0x4baf3d);});});} \ No newline at end of file +var _0x7bf7=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','./userProfile.socket','register','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xb8a1de,_0x35ff0d){var _0x2b1ad8=function(_0x4cbbe9){while(--_0x4cbbe9){_0xb8a1de['push'](_0xb8a1de['shift']());}};_0x2b1ad8(++_0x35ff0d);}(_0x7bf7,0x16c));var _0x77bf=function(_0x245e2c,_0x1042cb){_0x245e2c=_0x245e2c-0x0;var _0x19fddd=_0x7bf7[_0x245e2c];return _0x19fddd;};'use strict';var _=require(_0x77bf('0x0'));var util=require(_0x77bf('0x1'));var moment=require(_0x77bf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77bf('0x3'));var db=require(_0x77bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77bf('0x5'))(_0x77bf('0x6'));var config=require(_0x77bf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77bf('0x8')]['http']({'port':0x232a});config[_0x77bf('0x9')]=_[_0x77bf('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77bf('0x9')]));require(_0x77bf('0xb'))[_0x77bf('0xc')](socket);function respondWithRpcPromise(_0xf6caf0,_0x36e363,_0x10aad8){return new BPromise(function(_0x58cbf3,_0x170b63){return client['request'](_0xf6caf0,_0x10aad8)['then'](function(_0x45fc33){logger[_0x77bf('0xd')](_0x77bf('0xe'),_0x36e363,'request\x20sent');logger[_0x77bf('0xf')](_0x77bf('0x10'),_0x36e363,_0x77bf('0x11'),JSON[_0x77bf('0x12')](_0x45fc33));if(_0x45fc33[_0x77bf('0x13')]){if(_0x45fc33[_0x77bf('0x13')][_0x77bf('0x14')]===0x1f4){logger['error'](_0x77bf('0xe'),_0x36e363,_0x45fc33[_0x77bf('0x13')][_0x77bf('0x15')]);return _0x170b63(_0x45fc33[_0x77bf('0x13')][_0x77bf('0x15')]);}logger[_0x77bf('0x13')]('UserProfile,\x20%s,\x20%s',_0x36e363,_0x45fc33[_0x77bf('0x13')][_0x77bf('0x15')]);return _0x58cbf3(_0x45fc33[_0x77bf('0x13')][_0x77bf('0x15')]);}else{logger[_0x77bf('0xd')](_0x77bf('0xe'),_0x36e363,_0x77bf('0x11'));_0x58cbf3(_0x45fc33[_0x77bf('0x16')][_0x77bf('0x15')]);}})[_0x77bf('0x17')](function(_0x5b962c){logger[_0x77bf('0x13')](_0x77bf('0xe'),_0x36e363,_0x5b962c);_0x170b63(_0x5b962c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f84eb99..7f43f08 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 _0x04f1=['length','userProfile:','./userProfile.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04f1,0x92));var _0x104f=function(_0x3ef273,_0x835720){_0x3ef273=_0x3ef273-0x0;var _0x164c48=_0x04f1[_0x3ef273];return _0x164c48;};'use strict';var UserProfileEvents=require(_0x104f('0x0'));var events=[_0x104f('0x1'),_0x104f('0x2'),'update'];function createListener(_0x49868f,_0x1c9941){return function(_0x442b5d){_0x1c9941[_0x104f('0x3')](_0x49868f,_0x442b5d);};}function removeListener(_0x55c56e,_0x4b4197){return function(){UserProfileEvents['removeListener'](_0x55c56e,_0x4b4197);};}exports['register']=function(_0x4e767b){for(var _0x20a746=0x0,_0x289bb8=events[_0x104f('0x4')];_0x20a746<_0x289bb8;_0x20a746++){var _0x1d5651=events[_0x20a746];var _0x57acf5=createListener(_0x104f('0x5')+_0x1d5651,_0x4e767b);UserProfileEvents['on'](_0x1d5651,_0x57acf5);}}; \ No newline at end of file +var _0xb4e6=['./userProfile.events','save','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x959177,_0x4998ba){var _0x486342=function(_0x3a0561){while(--_0x3a0561){_0x959177['push'](_0x959177['shift']());}};_0x486342(++_0x4998ba);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0xb4e6[_0x401ccd];return _0x5a57ad;};'use strict';var UserProfileEvents=require(_0x6b4e('0x0'));var events=[_0x6b4e('0x1'),_0x6b4e('0x2'),_0x6b4e('0x3')];function createListener(_0x15d7bb,_0x16b379){return function(_0x567f47){_0x16b379[_0x6b4e('0x4')](_0x15d7bb,_0x567f47);};}function removeListener(_0x55df8c,_0x1f75ee){return function(){UserProfileEvents[_0x6b4e('0x5')](_0x55df8c,_0x1f75ee);};}exports[_0x6b4e('0x6')]=function(_0x431dde){for(var _0x5ad54e=0x0,_0x4091d6=events[_0x6b4e('0x7')];_0x5ad54e<_0x4091d6;_0x5ad54e++){var _0x471c1e=events[_0x5ad54e];var _0x187c7d=createListener(_0x6b4e('0x8')+_0x471c1e,_0x431dde);UserProfileEvents['on'](_0x471c1e,_0x187c7d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fe6bb19..7aeb4da 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 _0x3445=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete'];(function(_0x3a5f75,_0x16cc54){var _0x3c2b12=function(_0x2793e1){while(--_0x2793e1){_0x3a5f75['push'](_0x3a5f75['shift']());}};_0x3c2b12(++_0x16cc54);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var path=require(_0x5344('0x2'));var timeout=require(_0x5344('0x3'));var express=require(_0x5344('0x4'));var router=express[_0x5344('0x5')]();var auth=require(_0x5344('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5344('0x7'));router[_0x5344('0x8')]('/',auth[_0x5344('0x9')](),controller[_0x5344('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5344('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5344('0xb')]);router[_0x5344('0xc')]('/',auth[_0x5344('0x9')](),controller['create']);router[_0x5344('0xd')](_0x5344('0xe'),auth[_0x5344('0x9')](),controller[_0x5344('0xf')]);router[_0x5344('0x10')](_0x5344('0xe'),auth['isAuthenticated'](),controller[_0x5344('0x11')]);module[_0x5344('0x12')]=router; \ No newline at end of file +var _0x42f4=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0x42f4,0x19d));var _0x442f=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x42f4[_0x36de10];return _0x58100f;};'use strict';var multer=require(_0x442f('0x0'));var util=require('util');var path=require(_0x442f('0x1'));var timeout=require(_0x442f('0x2'));var express=require(_0x442f('0x3'));var router=express[_0x442f('0x4')]();var auth=require(_0x442f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x442f('0x6')]('/',auth[_0x442f('0x7')](),controller['index']);router[_0x442f('0x6')](_0x442f('0x8'),auth[_0x442f('0x7')](),controller[_0x442f('0x9')]);router[_0x442f('0x6')](_0x442f('0xa'),auth['isAuthenticated'](),controller[_0x442f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x442f('0xc')](_0x442f('0xa'),auth[_0x442f('0x7')](),controller[_0x442f('0xd')]);router[_0x442f('0xe')](_0x442f('0xa'),auth[_0x442f('0x7')](),controller[_0x442f('0xf')]);module[_0x442f('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7f6d087..cb81e03 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 _0xf6a6=['STRING','INTEGER','sequelize'];(function(_0xcae060,_0x37769d){var _0x55a565=function(_0x1ea7c9){while(--_0x1ea7c9){_0xcae060['push'](_0xcae060['shift']());}};_0x55a565(++_0x37769d);}(_0xf6a6,0xe0));var _0x6f6a=function(_0x1393e6,_0x50f790){_0x1393e6=_0x1393e6-0x0;var _0x4a9f7e=_0xf6a6[_0x1393e6];return _0x4a9f7e;};'use strict';var Sequelize=require(_0x6f6a('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f6a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6f6a('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa43b=['STRING','INTEGER'];(function(_0x4527d8,_0x59e349){var _0x1ec91d=function(_0x1ec598){while(--_0x1ec598){_0x4527d8['push'](_0x4527d8['shift']());}};_0x1ec91d(++_0x59e349);}(_0xa43b,0x66));var _0xba43=function(_0x2bdf00,_0x494ed2){_0x2bdf00=_0x2bdf00-0x0;var _0x39752e=_0xa43b[_0x2bdf00];return _0x39752e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xba43('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xba43('0x1')],'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 2c12e32..8b6933b 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 _0x3511=['sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','UserProfileResource','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','key','field','options','count','include','findAll','rows','catch','params','rawAttributes','includeAll','find','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0x3511,0x141));var _0x1351=function(_0x589d2f,_0xc49372){_0x589d2f=_0x589d2f-0x0;var _0x1db27c=_0x3511[_0x589d2f];return _0x1db27c;};'use strict';var pdf=require(_0x1351('0x0'));var emlformat=require(_0x1351('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1351('0x2'));var jsonpatch=require(_0x1351('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1351('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1351('0x5'));var sox=require(_0x1351('0x6'));var csv=require(_0x1351('0x7'));var ejs=require(_0x1351('0x8'));var fs=require('fs');var _=require(_0x1351('0x9'));var squel=require(_0x1351('0xa'));var crypto=require(_0x1351('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1351('0x7'));var querystring=require(_0x1351('0xc'));var Papa=require(_0x1351('0xd'));var Redis=require('ioredis');var authService=require(_0x1351('0xe'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1351('0xf'))('api');var utils=require(_0x1351('0x10'));var config=require(_0x1351('0x11'));var db=require(_0x1351('0x12'))['db'];function respondWithStatusCode(_0x343b9e,_0x9d6d99){_0x9d6d99=_0x9d6d99||0xcc;return function(_0x383ad6){if(_0x383ad6){return _0x343b9e[_0x1351('0x13')](_0x9d6d99);}return _0x343b9e[_0x1351('0x14')](_0x9d6d99)[_0x1351('0x15')]();};}function respondWithResult(_0x3a5197,_0x44c909){_0x44c909=_0x44c909||0xc8;return function(_0x3f3816){if(_0x3f3816){return _0x3a5197[_0x1351('0x14')](_0x44c909)[_0x1351('0x16')](_0x3f3816);}};}function respondWithFilteredResult(_0x51bbf0,_0xe5fd0a){return function(_0x5ddff5){if(_0x5ddff5){var _0xd205ce=_0x5ddff5['count'],_0x16b507=_0xe5fd0a[_0x1351('0x17')],_0x190dc2=_0xe5fd0a[_0x1351('0x17')]+_0xe5fd0a['limit'],_0x516423;if(_0x190dc2>=_0xd205ce){_0x190dc2=_0xd205ce;_0x516423=0xc8;}else{_0x516423=0xce;}_0x51bbf0[_0x1351('0x14')](_0x516423);return _0x51bbf0[_0x1351('0x18')](_0x1351('0x19'),_0x16b507+'-'+_0x190dc2+'/'+_0xd205ce)['json'](_0x5ddff5);}return null;};}function patchUpdates(_0x6a2a5a){return function(_0x5ac057){try{jsonpatch['apply'](_0x5ac057,_0x6a2a5a,!![]);}catch(_0x4bf6e7){return BPromise[_0x1351('0x1a')](_0x4bf6e7);}return _0x5ac057[_0x1351('0x1b')]();};}function saveUpdates(_0x2103f2,_0xbeb846){return function(_0x415d02){if(_0x415d02){return _0x415d02[_0x1351('0x1c')](_0x2103f2)[_0x1351('0x1d')](function(_0x7d1f38){return _0x7d1f38;});}return null;};}function removeEntity(_0x3f403e,_0x5c5f8f){return function(_0x18caea){if(_0x18caea){return _0x18caea['destroy']()[_0x1351('0x1d')](function(){_0x3f403e[_0x1351('0x14')](0xcc)[_0x1351('0x15')]();});}};}function handleEntityNotFound(_0x314b33,_0x2bfbf3){return function(_0x1e19d3){if(!_0x1e19d3){_0x314b33[_0x1351('0x13')](0x194);}return _0x1e19d3;};}function handleError(_0x176312,_0x27e68a){_0x27e68a=_0x27e68a||0x1f4;return function(_0x232b12){logger[_0x1351('0x1e')](_0x232b12[_0x1351('0x1f')]);if(_0x232b12[_0x1351('0x20')]){delete _0x232b12['name'];}_0x176312[_0x1351('0x14')](_0x27e68a)[_0x1351('0x21')](_0x232b12);};}exports[_0x1351('0x22')]=function(_0xaf9a50,_0x4fe4d3){var _0x52296c={},_0x30da71={},_0x543910={'count':0x0,'rows':[]};var _0x143b2c=db[_0x1351('0x23')]['rawAttributes'];_0x30da71['model']=_['keys'](_0x143b2c);_0x30da71['query']=_[_0x1351('0x24')](_0xaf9a50[_0x1351('0x25')]);_0x30da71[_0x1351('0x26')]=_[_0x1351('0x27')](_0x30da71[_0x1351('0x28')],_0x30da71['query']);_0x52296c[_0x1351('0x29')]=_['intersection'](_0x30da71[_0x1351('0x28')],qs[_0x1351('0x2a')](_0xaf9a50[_0x1351('0x25')][_0x1351('0x2a')]));_0x52296c['attributes']=_0x52296c[_0x1351('0x29')][_0x1351('0x2b')]?_0x52296c['attributes']:_0x30da71[_0x1351('0x28')];if(!_0xaf9a50[_0x1351('0x25')][_0x1351('0x2c')](_0x1351('0x2d'))){_0x52296c['limit']=qs['limit'](_0xaf9a50[_0x1351('0x25')][_0x1351('0x2e')]);_0x52296c[_0x1351('0x17')]=qs[_0x1351('0x17')](_0xaf9a50[_0x1351('0x25')][_0x1351('0x17')]);}_0x52296c[_0x1351('0x2f')]=qs[_0x1351('0x30')](_0xaf9a50['query'][_0x1351('0x30')]);_0x52296c[_0x1351('0x31')]=qs[_0x1351('0x26')](_[_0x1351('0x32')](_0xaf9a50['query'],_0x30da71[_0x1351('0x26')]));if(_0xaf9a50[_0x1351('0x25')]['filter']){_0x52296c[_0x1351('0x31')]=_[_0x1351('0x33')](_0x52296c[_0x1351('0x31')],{'$or':_['map'](_0x143b2c,function(_0x3a6887){if(_0x3a6887[_0x1351('0x34')][_0x1351('0x35')]!=='VIRTUAL'){var _0x4f8259={};_0x4f8259[_0x3a6887[_0x1351('0x36')]]={'$like':'%'+_0xaf9a50[_0x1351('0x25')]['filter']+'%'};return _0x4f8259;}})});}_0x52296c=_[_0x1351('0x33')]({},_0x52296c,_0xaf9a50[_0x1351('0x37')]);var _0x5249c2={'where':_0x52296c[_0x1351('0x31')]};return db[_0x1351('0x23')][_0x1351('0x38')](_0x5249c2)['then'](function(_0xa21451){_0x543910[_0x1351('0x38')]=_0xa21451;if(_0xaf9a50[_0x1351('0x25')]['includeAll']){_0x52296c[_0x1351('0x39')]=[{'all':!![]}];}return db[_0x1351('0x23')][_0x1351('0x3a')](_0x52296c);})[_0x1351('0x1d')](function(_0x1d8307){_0x543910[_0x1351('0x3b')]=_0x1d8307;return _0x543910;})['then'](respondWithFilteredResult(_0x4fe4d3,_0x52296c))[_0x1351('0x3c')](handleError(_0x4fe4d3,null));};exports['show']=function(_0xeb3f9d,_0x54b57c){var _0x254583={'raw':![],'where':{'id':_0xeb3f9d[_0x1351('0x3d')]['id']}},_0x5799a2={};_0x5799a2[_0x1351('0x28')]=_['keys'](db[_0x1351('0x23')][_0x1351('0x3e')]);_0x5799a2['query']=_[_0x1351('0x24')](_0xeb3f9d['query']);_0x5799a2['filters']=_['intersection'](_0x5799a2[_0x1351('0x28')],_0x5799a2[_0x1351('0x25')]);_0x254583[_0x1351('0x29')]=_[_0x1351('0x27')](_0x5799a2['model'],qs[_0x1351('0x2a')](_0xeb3f9d[_0x1351('0x25')]['fields']));_0x254583[_0x1351('0x29')]=_0x254583[_0x1351('0x29')][_0x1351('0x2b')]?_0x254583['attributes']:_0x5799a2[_0x1351('0x28')];if(_0xeb3f9d[_0x1351('0x25')][_0x1351('0x3f')]){_0x254583[_0x1351('0x39')]=[{'all':!![]}];}_0x254583=_['merge']({},_0x254583,_0xeb3f9d[_0x1351('0x37')]);return db[_0x1351('0x23')][_0x1351('0x40')](_0x254583)[_0x1351('0x1d')](handleEntityNotFound(_0x54b57c,null))[_0x1351('0x1d')](respondWithResult(_0x54b57c,null))['catch'](handleError(_0x54b57c,null));};exports['create']=function(_0x15a084,_0x5de8f0){return db[_0x1351('0x23')]['create'](_0x15a084[_0x1351('0x41')],{})[_0x1351('0x1d')](respondWithResult(_0x5de8f0,0xc9))[_0x1351('0x3c')](handleError(_0x5de8f0,null));};exports['update']=function(_0x4da352,_0x2b87b7){if(_0x4da352[_0x1351('0x41')]['id']){delete _0x4da352[_0x1351('0x41')]['id'];}return db['UserProfileResource'][_0x1351('0x40')]({'where':{'id':_0x4da352[_0x1351('0x3d')]['id']}})[_0x1351('0x1d')](handleEntityNotFound(_0x2b87b7,null))[_0x1351('0x1d')](saveUpdates(_0x4da352[_0x1351('0x41')],null))['then'](respondWithResult(_0x2b87b7,null))[_0x1351('0x3c')](handleError(_0x2b87b7,null));};exports[_0x1351('0x42')]=function(_0x5021b4,_0x1252f7){return db['UserProfileResource'][_0x1351('0x40')]({'where':{'id':_0x5021b4[_0x1351('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1252f7,null))['then'](removeEntity(_0x1252f7,null))[_0x1351('0x3c')](handleError(_0x1252f7,null));};exports['describe']=function(_0x44953e,_0x5f2779){return db['UserProfileResource'][_0x1351('0x43')]()[_0x1351('0x1d')](respondWithResult(_0x5f2779,null))[_0x1351('0x3c')](handleError(_0x5f2779,null));}; \ No newline at end of file +var _0x3679=['ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','field','count','include','UserProfileResource','findAll','rows','catch','params','length','includeAll','options','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','querystring','papaparse'];(function(_0x569f7f,_0x36dc49){var _0x4973d9=function(_0x41db7f){while(--_0x41db7f){_0x569f7f['push'](_0x569f7f['shift']());}};_0x4973d9(++_0x36dc49);}(_0x3679,0x7b));var _0x9367=function(_0x2e39d2,_0x5c8c74){_0x2e39d2=_0x2e39d2-0x0;var _0x22941e=_0x3679[_0x2e39d2];return _0x22941e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9367('0x0'));var rimraf=require(_0x9367('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9367('0x2'));var moment=require(_0x9367('0x3'));var BPromise=require(_0x9367('0x4'));var Mustache=require(_0x9367('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9367('0x6'));var csv=require(_0x9367('0x7'));var ejs=require(_0x9367('0x8'));var fs=require('fs');var _=require(_0x9367('0x9'));var squel=require(_0x9367('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9367('0x7'));var querystring=require(_0x9367('0xb'));var Papa=require(_0x9367('0xc'));var Redis=require(_0x9367('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9367('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9367('0xf'));var utils=require('../../config/utils');var config=require(_0x9367('0x10'));var db=require(_0x9367('0x11'))['db'];function respondWithStatusCode(_0x572bd2,_0x2d6445){_0x2d6445=_0x2d6445||0xcc;return function(_0x2e2923){if(_0x2e2923){return _0x572bd2[_0x9367('0x12')](_0x2d6445);}return _0x572bd2[_0x9367('0x13')](_0x2d6445)[_0x9367('0x14')]();};}function respondWithResult(_0x490a72,_0x41e469){_0x41e469=_0x41e469||0xc8;return function(_0x4fe26c){if(_0x4fe26c){return _0x490a72[_0x9367('0x13')](_0x41e469)[_0x9367('0x15')](_0x4fe26c);}};}function respondWithFilteredResult(_0x79b710,_0x2054a2){return function(_0xd8b291){if(_0xd8b291){var _0x5edc9b=_0xd8b291['count'],_0x5a7347=_0x2054a2[_0x9367('0x16')],_0x366d9b=_0x2054a2[_0x9367('0x16')]+_0x2054a2[_0x9367('0x17')],_0x37e15d;if(_0x366d9b>=_0x5edc9b){_0x366d9b=_0x5edc9b;_0x37e15d=0xc8;}else{_0x37e15d=0xce;}_0x79b710[_0x9367('0x13')](_0x37e15d);return _0x79b710[_0x9367('0x18')](_0x9367('0x19'),_0x5a7347+'-'+_0x366d9b+'/'+_0x5edc9b)[_0x9367('0x15')](_0xd8b291);}return null;};}function patchUpdates(_0x479ddb){return function(_0x1198be){try{jsonpatch[_0x9367('0x1a')](_0x1198be,_0x479ddb,!![]);}catch(_0x896b7c){return BPromise[_0x9367('0x1b')](_0x896b7c);}return _0x1198be['save']();};}function saveUpdates(_0x3aa5c9,_0x4a616f){return function(_0x163182){if(_0x163182){return _0x163182[_0x9367('0x1c')](_0x3aa5c9)[_0x9367('0x1d')](function(_0x214c69){return _0x214c69;});}return null;};}function removeEntity(_0x1f8632,_0x26c43d){return function(_0x12de3b){if(_0x12de3b){return _0x12de3b[_0x9367('0x1e')]()[_0x9367('0x1d')](function(){_0x1f8632[_0x9367('0x13')](0xcc)[_0x9367('0x14')]();});}};}function handleEntityNotFound(_0x50d1bc,_0x16e895){return function(_0x50f0f0){if(!_0x50f0f0){_0x50d1bc[_0x9367('0x12')](0x194);}return _0x50f0f0;};}function handleError(_0x2b4423,_0x11bff3){_0x11bff3=_0x11bff3||0x1f4;return function(_0x275797){logger['error'](_0x275797[_0x9367('0x1f')]);if(_0x275797[_0x9367('0x20')]){delete _0x275797[_0x9367('0x20')];}_0x2b4423[_0x9367('0x13')](_0x11bff3)[_0x9367('0x21')](_0x275797);};}exports[_0x9367('0x22')]=function(_0x1e5176,_0x9f00a3){var _0x1be331={},_0x241a24={},_0x49a395={'count':0x0,'rows':[]};var _0x371329=db['UserProfileResource'][_0x9367('0x23')];_0x241a24['model']=_[_0x9367('0x24')](_0x371329);_0x241a24[_0x9367('0x25')]=_[_0x9367('0x24')](_0x1e5176[_0x9367('0x25')]);_0x241a24['filters']=_[_0x9367('0x26')](_0x241a24[_0x9367('0x27')],_0x241a24[_0x9367('0x25')]);_0x1be331[_0x9367('0x28')]=_[_0x9367('0x26')](_0x241a24[_0x9367('0x27')],qs[_0x9367('0x29')](_0x1e5176[_0x9367('0x25')][_0x9367('0x29')]));_0x1be331['attributes']=_0x1be331[_0x9367('0x28')]['length']?_0x1be331[_0x9367('0x28')]:_0x241a24[_0x9367('0x27')];if(!_0x1e5176[_0x9367('0x25')][_0x9367('0x2a')](_0x9367('0x2b'))){_0x1be331[_0x9367('0x17')]=qs[_0x9367('0x17')](_0x1e5176[_0x9367('0x25')][_0x9367('0x17')]);_0x1be331[_0x9367('0x16')]=qs['offset'](_0x1e5176[_0x9367('0x25')]['offset']);}_0x1be331[_0x9367('0x2c')]=qs[_0x9367('0x2d')](_0x1e5176[_0x9367('0x25')][_0x9367('0x2d')]);_0x1be331[_0x9367('0x2e')]=qs[_0x9367('0x2f')](_[_0x9367('0x30')](_0x1e5176[_0x9367('0x25')],_0x241a24[_0x9367('0x2f')]));if(_0x1e5176['query'][_0x9367('0x31')]){_0x1be331[_0x9367('0x2e')]=_[_0x9367('0x32')](_0x1be331['where'],{'$or':_['map'](_0x371329,function(_0x291cfb){if(_0x291cfb[_0x9367('0x33')]['key']!==_0x9367('0x34')){var _0x241e6a={};_0x241e6a[_0x291cfb[_0x9367('0x35')]]={'$like':'%'+_0x1e5176[_0x9367('0x25')][_0x9367('0x31')]+'%'};return _0x241e6a;}})});}_0x1be331=_[_0x9367('0x32')]({},_0x1be331,_0x1e5176['options']);var _0x35894a={'where':_0x1be331['where']};return db['UserProfileResource'][_0x9367('0x36')](_0x35894a)[_0x9367('0x1d')](function(_0x21780c){_0x49a395[_0x9367('0x36')]=_0x21780c;if(_0x1e5176[_0x9367('0x25')]['includeAll']){_0x1be331[_0x9367('0x37')]=[{'all':!![]}];}return db[_0x9367('0x38')][_0x9367('0x39')](_0x1be331);})['then'](function(_0xc65776){_0x49a395[_0x9367('0x3a')]=_0xc65776;return _0x49a395;})[_0x9367('0x1d')](respondWithFilteredResult(_0x9f00a3,_0x1be331))[_0x9367('0x3b')](handleError(_0x9f00a3,null));};exports['show']=function(_0xbab77b,_0x126007){var _0x16c70e={'raw':![],'where':{'id':_0xbab77b[_0x9367('0x3c')]['id']}},_0x1a2fee={};_0x1a2fee[_0x9367('0x27')]=_[_0x9367('0x24')](db['UserProfileResource'][_0x9367('0x23')]);_0x1a2fee[_0x9367('0x25')]=_[_0x9367('0x24')](_0xbab77b[_0x9367('0x25')]);_0x1a2fee[_0x9367('0x2f')]=_[_0x9367('0x26')](_0x1a2fee['model'],_0x1a2fee[_0x9367('0x25')]);_0x16c70e['attributes']=_[_0x9367('0x26')](_0x1a2fee['model'],qs['fields'](_0xbab77b[_0x9367('0x25')]['fields']));_0x16c70e['attributes']=_0x16c70e[_0x9367('0x28')][_0x9367('0x3d')]?_0x16c70e[_0x9367('0x28')]:_0x1a2fee[_0x9367('0x27')];if(_0xbab77b[_0x9367('0x25')][_0x9367('0x3e')]){_0x16c70e[_0x9367('0x37')]=[{'all':!![]}];}_0x16c70e=_[_0x9367('0x32')]({},_0x16c70e,_0xbab77b[_0x9367('0x3f')]);return db[_0x9367('0x38')]['find'](_0x16c70e)[_0x9367('0x1d')](handleEntityNotFound(_0x126007,null))[_0x9367('0x1d')](respondWithResult(_0x126007,null))[_0x9367('0x3b')](handleError(_0x126007,null));};exports[_0x9367('0x40')]=function(_0x1a5613,_0x277a86){return db[_0x9367('0x38')][_0x9367('0x40')](_0x1a5613[_0x9367('0x41')],{})[_0x9367('0x1d')](respondWithResult(_0x277a86,0xc9))[_0x9367('0x3b')](handleError(_0x277a86,null));};exports[_0x9367('0x1c')]=function(_0x17ca5d,_0x3e8449){if(_0x17ca5d[_0x9367('0x41')]['id']){delete _0x17ca5d[_0x9367('0x41')]['id'];}return db['UserProfileResource'][_0x9367('0x42')]({'where':{'id':_0x17ca5d[_0x9367('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3e8449,null))['then'](saveUpdates(_0x17ca5d[_0x9367('0x41')],null))[_0x9367('0x1d')](respondWithResult(_0x3e8449,null))[_0x9367('0x3b')](handleError(_0x3e8449,null));};exports[_0x9367('0x1e')]=function(_0x4852fb,_0x452926){return db[_0x9367('0x38')][_0x9367('0x42')]({'where':{'id':_0x4852fb[_0x9367('0x3c')]['id']}})[_0x9367('0x1d')](handleEntityNotFound(_0x452926,null))[_0x9367('0x1d')](removeEntity(_0x452926,null))['catch'](handleError(_0x452926,null));};exports[_0x9367('0x43')]=function(_0x1b034c,_0x1a17a2){return db['UserProfileResource'][_0x9367('0x43')]()['then'](respondWithResult(_0x1a17a2,null))[_0x9367('0x3b')](handleError(_0x1a17a2,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e70c594..0805406 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 _0x7fdd=['UserProfileResource','resourceId','util','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define'];(function(_0x4801a0,_0x252c24){var _0x338e26=function(_0x1599c2){while(--_0x1599c2){_0x4801a0['push'](_0x4801a0['shift']());}};_0x338e26(++_0x252c24);}(_0x7fdd,0xf4));var _0xd7fd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7fdd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xd7fd('0x0'));var logger=require('../../config/logger')(_0xd7fd('0x1'));var moment=require(_0xd7fd('0x2'));var BPromise=require(_0xd7fd('0x3'));var rp=require(_0xd7fd('0x4'));var fs=require('fs');var path=require(_0xd7fd('0x5'));var rimraf=require(_0xd7fd('0x6'));var config=require('../../config/environment');var attributes=require(_0xd7fd('0x7'));module['exports']=function(_0x51fcb7,_0x1547f2){return _0x51fcb7[_0xd7fd('0x8')](_0xd7fd('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd7fd('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb287=['resourceId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources'];(function(_0x4a0ecf,_0x49d5bc){var _0x24057e=function(_0x54267b){while(--_0x54267b){_0x4a0ecf['push'](_0x4a0ecf['shift']());}};_0x24057e(++_0x49d5bc);}(_0xb287,0x69));var _0x7b28=function(_0x407130,_0x3f1939){_0x407130=_0x407130-0x0;var _0x53fc27=_0xb287[_0x407130];return _0x53fc27;};'use strict';var _=require(_0x7b28('0x0'));var util=require('util');var logger=require(_0x7b28('0x1'))('api');var moment=require(_0x7b28('0x2'));var BPromise=require(_0x7b28('0x3'));var rp=require(_0x7b28('0x4'));var fs=require('fs');var path=require(_0x7b28('0x5'));var rimraf=require(_0x7b28('0x6'));var config=require(_0x7b28('0x7'));var attributes=require(_0x7b28('0x8'));module[_0x7b28('0x9')]=function(_0x187655,_0x4851dd){return _0x187655['define'](_0x7b28('0xa'),attributes,{'tableName':_0x7b28('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7b28('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8bc9bde..2741306 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 _0x6050=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then'];(function(_0x58d790,_0x5776c8){var _0x5e913f=function(_0x4f2d53){while(--_0x4f2d53){_0x58d790['push'](_0x58d790['shift']());}};_0x5e913f(++_0x5776c8);}(_0x6050,0x196));var _0x0605=function(_0x8ff4c0,_0x466cb5){_0x8ff4c0=_0x8ff4c0-0x0;var _0x5dbc04=_0x6050[_0x8ff4c0];return _0x5dbc04;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});} \ No newline at end of file +var _0xef17=['client','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2282e1,_0x1f26b4){var _0x16ffcd=function(_0x45771e){while(--_0x45771e){_0x2282e1['push'](_0x2282e1['shift']());}};_0x16ffcd(++_0x1f26b4);}(_0xef17,0x136));var _0x7ef1=function(_0x54b3fb,_0x521358){_0x54b3fb=_0x54b3fb-0x0;var _0x114c6e=_0xef17[_0x54b3fb];return _0x114c6e;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var moment=require(_0x7ef1('0x2'));var BPromise=require(_0x7ef1('0x3'));var rs=require(_0x7ef1('0x4'));var fs=require('fs');var Redis=require(_0x7ef1('0x5'));var db=require(_0x7ef1('0x6'))['db'];var utils=require(_0x7ef1('0x7'));var logger=require(_0x7ef1('0x8'))('rpc');var config=require(_0x7ef1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ef1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a040,_0x4ba2f0,_0x5aec63){return new BPromise(function(_0x10c896,_0x3398a6){return client['request'](_0x34a040,_0x5aec63)[_0x7ef1('0xb')](function(_0x1d5b33){logger[_0x7ef1('0xc')](_0x7ef1('0xd'),_0x4ba2f0,_0x7ef1('0xe'));logger[_0x7ef1('0xf')](_0x7ef1('0x10'),_0x4ba2f0,'request\x20sent',JSON['stringify'](_0x1d5b33));if(_0x1d5b33[_0x7ef1('0x11')]){if(_0x1d5b33['error']['code']===0x1f4){logger['error'](_0x7ef1('0xd'),_0x4ba2f0,_0x1d5b33['error'][_0x7ef1('0x12')]);return _0x3398a6(_0x1d5b33[_0x7ef1('0x11')][_0x7ef1('0x12')]);}logger[_0x7ef1('0x11')](_0x7ef1('0xd'),_0x4ba2f0,_0x1d5b33[_0x7ef1('0x11')][_0x7ef1('0x12')]);return _0x10c896(_0x1d5b33[_0x7ef1('0x11')]['message']);}else{logger['info'](_0x7ef1('0xd'),_0x4ba2f0,'request\x20sent');_0x10c896(_0x1d5b33[_0x7ef1('0x13')][_0x7ef1('0x12')]);}})['catch'](function(_0x4e26d1){logger['error'](_0x7ef1('0xd'),_0x4ba2f0,_0x4e26d1);_0x3398a6(_0x4e26d1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index bd7aa7e..f560b5e 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 _0xc320=['./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','post','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x49372d,_0x21e0bf){var _0x4cccf9=function(_0x2084c0){while(--_0x2084c0){_0x49372d['push'](_0x49372d['shift']());}};_0x4cccf9(++_0x21e0bf);}(_0xc320,0x98));var _0x0c32=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc320[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x0c32('0x0'));var util=require(_0x0c32('0x1'));var path=require(_0x0c32('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c32('0x3'));var router=express[_0x0c32('0x4')]();var auth=require(_0x0c32('0x5'));var interaction=require(_0x0c32('0x6'));var config=require(_0x0c32('0x7'));var controller=require(_0x0c32('0x8'));router[_0x0c32('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c32('0xa')]);router[_0x0c32('0x9')](_0x0c32('0xb'),auth[_0x0c32('0xc')](),controller[_0x0c32('0xd')]);router[_0x0c32('0x9')](_0x0c32('0xe'),auth[_0x0c32('0xc')](),controller['show']);router[_0x0c32('0xf')]('/',auth[_0x0c32('0xc')](),controller['create']);router[_0x0c32('0x10')](_0x0c32('0xe'),auth[_0x0c32('0xc')](),controller[_0x0c32('0x11')]);router[_0x0c32('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0c32('0x13')]=router; \ No newline at end of file +var _0x0de9=['show','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x1c4e14,_0x39b95e){var _0x18f7a3=function(_0x1cf5a2){while(--_0x1cf5a2){_0x1c4e14['push'](_0x1c4e14['shift']());}};_0x18f7a3(++_0x39b95e);}(_0x0de9,0x182));var _0x90de=function(_0x1a3978,_0x1f20ff){_0x1a3978=_0x1a3978-0x0;var _0x1a1ef5=_0x0de9[_0x1a3978];return _0x1a1ef5;};'use strict';var multer=require(_0x90de('0x0'));var util=require(_0x90de('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x90de('0x2')]();var auth=require(_0x90de('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x90de('0x4'));router[_0x90de('0x5')]('/',auth[_0x90de('0x6')](),controller[_0x90de('0x7')]);router['get'](_0x90de('0x8'),auth[_0x90de('0x6')](),controller['describe']);router[_0x90de('0x5')](_0x90de('0x9'),auth[_0x90de('0x6')](),controller[_0x90de('0xa')]);router[_0x90de('0xb')]('/',auth[_0x90de('0x6')](),controller[_0x90de('0xc')]);router[_0x90de('0xd')]('/:id',auth[_0x90de('0x6')](),controller[_0x90de('0xe')]);router[_0x90de('0xf')](_0x90de('0x9'),auth['isAuthenticated'](),controller[_0x90de('0x10')]);module[_0x90de('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7a9d96c..74a6b08 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 _0x34e8=['setDataValue','crudPermissions','join','split','sequelize','exports','STRING','BOOLEAN'];(function(_0x341752,_0x4aca85){var _0x4b1d0f=function(_0x11b616){while(--_0x11b616){_0x341752['push'](_0x341752['shift']());}};_0x4b1d0f(++_0x4aca85);}(_0x34e8,0x12c));var _0x834e=function(_0x1e1461,_0xc73928){_0x1e1461=_0x1e1461-0x0;var _0x340ee5=_0x34e8[_0x1e1461];return _0x340ee5;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x834e('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x834e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x834e('0x2')],'set':function(_0x31bf20){this[_0x834e('0x4')](_0x834e('0x5'),_0x31bf20?_0x31bf20[_0x834e('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x834e('0x5'))?this['getDataValue'](_0x834e('0x5'))[_0x834e('0x7')](''):[];}}}; \ No newline at end of file +var _0xa9e0=['crudPermissions','join','getDataValue','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0x25d39a,_0x641da8){var _0x25d1e6=function(_0x1bb3bf){while(--_0x1bb3bf){_0x25d39a['push'](_0x25d39a['shift']());}};_0x25d1e6(++_0x641da8);}(_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')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0a9e('0x2')],'set':function(_0x432180){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x432180?_0x432180[_0x0a9e('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0a9e('0x5'))?this[_0x0a9e('0x7')](_0x0a9e('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 391096e..7bae7c6 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 _0x5f2f=['json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','key','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','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','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x54040a,_0x44bbf8){var _0x1ed5db=function(_0x26225b){while(--_0x26225b){_0x54040a['push'](_0x54040a['shift']());}};_0x1ed5db(++_0x44bbf8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b932c,_0x13e10b){_0x5b932c=_0x5b932c-0x0;var _0x253ff9=_0x5f2f[_0x5b932c];return _0x253ff9;};'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 hardwareService=require(_0xf5f2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf5f2('0x14'));var config=require(_0xf5f2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x336f6b,_0x14b51f){_0x14b51f=_0x14b51f||0xcc;return function(_0x331482){if(_0x331482){return _0x336f6b[_0xf5f2('0x16')](_0x14b51f);}return _0x336f6b[_0xf5f2('0x17')](_0x14b51f)[_0xf5f2('0x18')]();};}function respondWithResult(_0x5c01b8,_0x5850f4){_0x5850f4=_0x5850f4||0xc8;return function(_0xea612c){if(_0xea612c){return _0x5c01b8[_0xf5f2('0x17')](_0x5850f4)[_0xf5f2('0x19')](_0xea612c);}};}function respondWithFilteredResult(_0x422b55,_0x4d97fc){return function(_0xafe430){if(_0xafe430){var _0x286197=_0xafe430[_0xf5f2('0x1a')],_0x17d656=_0x4d97fc[_0xf5f2('0x1b')],_0x1b6dd2=_0x4d97fc[_0xf5f2('0x1b')]+_0x4d97fc[_0xf5f2('0x1c')],_0x23e23a;if(_0x1b6dd2>=_0x286197){_0x1b6dd2=_0x286197;_0x23e23a=0xc8;}else{_0x23e23a=0xce;}_0x422b55[_0xf5f2('0x17')](_0x23e23a);return _0x422b55[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x17d656+'-'+_0x1b6dd2+'/'+_0x286197)[_0xf5f2('0x19')](_0xafe430);}return null;};}function patchUpdates(_0x3ee69){return function(_0x3cf5ea){try{jsonpatch[_0xf5f2('0x1f')](_0x3cf5ea,_0x3ee69,!![]);}catch(_0x1bf655){return BPromise['reject'](_0x1bf655);}return _0x3cf5ea[_0xf5f2('0x20')]();};}function saveUpdates(_0x47101e,_0x49dac2){return function(_0x47acfc){if(_0x47acfc){return _0x47acfc[_0xf5f2('0x21')](_0x47101e)[_0xf5f2('0x22')](function(_0x4ae323){return _0x4ae323;});}return null;};}function removeEntity(_0x45b74f,_0x170042){return function(_0x39e44a){if(_0x39e44a){return _0x39e44a[_0xf5f2('0x23')]()[_0xf5f2('0x22')](function(){_0x45b74f['status'](0xcc)[_0xf5f2('0x18')]();});}};}function handleEntityNotFound(_0x4669a6,_0x4e8bda){return function(_0x2833fe){if(!_0x2833fe){_0x4669a6[_0xf5f2('0x16')](0x194);}return _0x2833fe;};}function handleError(_0x5bdf4a,_0x529f07){_0x529f07=_0x529f07||0x1f4;return function(_0x5f1124){logger[_0xf5f2('0x24')](_0x5f1124[_0xf5f2('0x25')]);if(_0x5f1124[_0xf5f2('0x26')]){delete _0x5f1124[_0xf5f2('0x26')];}_0x5bdf4a[_0xf5f2('0x17')](_0x529f07)[_0xf5f2('0x27')](_0x5f1124);};}exports[_0xf5f2('0x28')]=function(_0x294414,_0x4ab014){var _0xaa2602={},_0x102449={},_0x375ca8={'count':0x0,'rows':[]};var _0x31bfcb=db[_0xf5f2('0x29')][_0xf5f2('0x2a')];_0x102449['model']=_['keys'](_0x31bfcb);_0x102449[_0xf5f2('0x2b')]=_[_0xf5f2('0x2c')](_0x294414[_0xf5f2('0x2b')]);_0x102449['filters']=_['intersection'](_0x102449[_0xf5f2('0x2d')],_0x102449[_0xf5f2('0x2b')]);_0xaa2602[_0xf5f2('0x2e')]=_[_0xf5f2('0x2f')](_0x102449[_0xf5f2('0x2d')],qs['fields'](_0x294414['query'][_0xf5f2('0x30')]));_0xaa2602['attributes']=_0xaa2602[_0xf5f2('0x2e')]['length']?_0xaa2602[_0xf5f2('0x2e')]:_0x102449[_0xf5f2('0x2d')];if(!_0x294414[_0xf5f2('0x2b')][_0xf5f2('0x31')](_0xf5f2('0x32'))){_0xaa2602[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x294414[_0xf5f2('0x2b')]['limit']);_0xaa2602[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x294414[_0xf5f2('0x2b')][_0xf5f2('0x1b')]);}_0xaa2602[_0xf5f2('0x33')]=qs[_0xf5f2('0x34')](_0x294414[_0xf5f2('0x2b')]['sort']);_0xaa2602[_0xf5f2('0x35')]=qs[_0xf5f2('0x36')](_['pick'](_0x294414[_0xf5f2('0x2b')],_0x102449['filters']));if(_0x294414[_0xf5f2('0x2b')][_0xf5f2('0x37')]){_0xaa2602[_0xf5f2('0x35')]=_[_0xf5f2('0x38')](_0xaa2602['where'],{'$or':_['map'](_0x31bfcb,function(_0x41088b){if(_0x41088b[_0xf5f2('0x39')][_0xf5f2('0x3a')]!=='VIRTUAL'){var _0x41447f={};_0x41447f[_0x41088b['field']]={'$like':'%'+_0x294414[_0xf5f2('0x2b')]['filter']+'%'};return _0x41447f;}})});}_0xaa2602=_[_0xf5f2('0x38')]({},_0xaa2602,_0x294414[_0xf5f2('0x3b')]);var _0x5337a6={'where':_0xaa2602[_0xf5f2('0x35')]};return db[_0xf5f2('0x29')][_0xf5f2('0x1a')](_0x5337a6)[_0xf5f2('0x22')](function(_0x542cd6){_0x375ca8['count']=_0x542cd6;if(_0x294414[_0xf5f2('0x2b')][_0xf5f2('0x3c')]){_0xaa2602[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0xaa2602);})[_0xf5f2('0x22')](function(_0x2bc20e){_0x375ca8['rows']=_0x2bc20e;return _0x375ca8;})[_0xf5f2('0x22')](respondWithFilteredResult(_0x4ab014,_0xaa2602))[_0xf5f2('0x3f')](handleError(_0x4ab014,null));};exports['show']=function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'raw':![],'where':{'id':_0xc6a1ae[_0xf5f2('0x40')]['id']}},_0x85b6d0={};_0x85b6d0[_0xf5f2('0x2d')]=_[_0xf5f2('0x2c')](db[_0xf5f2('0x29')]['rawAttributes']);_0x85b6d0[_0xf5f2('0x2b')]=_[_0xf5f2('0x2c')](_0xc6a1ae[_0xf5f2('0x2b')]);_0x85b6d0['filters']=_['intersection'](_0x85b6d0['model'],_0x85b6d0[_0xf5f2('0x2b')]);_0x71b0e7[_0xf5f2('0x2e')]=_['intersection'](_0x85b6d0[_0xf5f2('0x2d')],qs[_0xf5f2('0x30')](_0xc6a1ae[_0xf5f2('0x2b')][_0xf5f2('0x30')]));_0x71b0e7[_0xf5f2('0x2e')]=_0x71b0e7[_0xf5f2('0x2e')][_0xf5f2('0x41')]?_0x71b0e7[_0xf5f2('0x2e')]:_0x85b6d0[_0xf5f2('0x2d')];if(_0xc6a1ae[_0xf5f2('0x2b')][_0xf5f2('0x3c')]){_0x71b0e7[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x71b0e7=_[_0xf5f2('0x38')]({},_0x71b0e7,_0xc6a1ae[_0xf5f2('0x3b')]);return db['UserProfileSection'][_0xf5f2('0x42')](_0x71b0e7)['then'](handleEntityNotFound(_0x3f3895,null))[_0xf5f2('0x22')](respondWithResult(_0x3f3895,null))[_0xf5f2('0x3f')](handleError(_0x3f3895,null));};exports[_0xf5f2('0x43')]=function(_0x36a4b0,_0x31bf0e){return db[_0xf5f2('0x29')]['create'](_0x36a4b0[_0xf5f2('0x44')],{})[_0xf5f2('0x22')](respondWithResult(_0x31bf0e,0xc9))[_0xf5f2('0x3f')](handleError(_0x31bf0e,null));};exports[_0xf5f2('0x21')]=function(_0x12124d,_0x10753a){if(_0x12124d[_0xf5f2('0x44')]['id']){delete _0x12124d[_0xf5f2('0x44')]['id'];}return db['UserProfileSection'][_0xf5f2('0x42')]({'where':{'id':_0x12124d[_0xf5f2('0x40')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x10753a,null))['then'](saveUpdates(_0x12124d[_0xf5f2('0x44')],null))[_0xf5f2('0x22')](respondWithResult(_0x10753a,null))[_0xf5f2('0x3f')](handleError(_0x10753a,null));};exports['destroy']=function(_0x57a7cb,_0x7bb942){return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x40')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x22')](removeEntity(_0x7bb942,null))['catch'](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x5d9120,_0x2d9017){return db[_0xf5f2('0x29')][_0xf5f2('0x45')]()[_0xf5f2('0x22')](respondWithResult(_0x2d9017,null))['catch'](handleError(_0x2d9017,null));}; \ No newline at end of file +var _0xadb5=['then','sendStatus','error','name','send','index','UserProfileSection','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','nolimit','where','pick','filter','merge','type','VIRTUAL','field','options','includeAll','include','findAll','show','params','find','create','body','catch','describe','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','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy'];(function(_0x4a7dea,_0x20570b){var _0x163953=function(_0x456c9d){while(--_0x456c9d){_0x4a7dea['push'](_0x4a7dea['shift']());}};_0x163953(++_0x20570b);}(_0xadb5,0xad));var _0x5adb=function(_0x281913,_0x3de353){_0x281913=_0x281913-0x0;var _0x3d92d3=_0xadb5[_0x281913];return _0x3d92d3;};'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 hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5adb('0x14'));var utils=require(_0x5adb('0x15'));var config=require(_0x5adb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f0d5,_0x56012f){_0x56012f=_0x56012f||0xcc;return function(_0x2a0b70){if(_0x2a0b70){return _0x29f0d5['sendStatus'](_0x56012f);}return _0x29f0d5[_0x5adb('0x17')](_0x56012f)[_0x5adb('0x18')]();};}function respondWithResult(_0x44abe3,_0x5c929a){_0x5c929a=_0x5c929a||0xc8;return function(_0x2a545b){if(_0x2a545b){return _0x44abe3[_0x5adb('0x17')](_0x5c929a)[_0x5adb('0x19')](_0x2a545b);}};}function respondWithFilteredResult(_0x5263ec,_0x2312de){return function(_0x518823){if(_0x518823){var _0x367d82=_0x518823[_0x5adb('0x1a')],_0x42a482=_0x2312de[_0x5adb('0x1b')],_0x30614e=_0x2312de[_0x5adb('0x1b')]+_0x2312de[_0x5adb('0x1c')],_0x304784;if(_0x30614e>=_0x367d82){_0x30614e=_0x367d82;_0x304784=0xc8;}else{_0x304784=0xce;}_0x5263ec[_0x5adb('0x17')](_0x304784);return _0x5263ec['set'](_0x5adb('0x1d'),_0x42a482+'-'+_0x30614e+'/'+_0x367d82)['json'](_0x518823);}return null;};}function patchUpdates(_0x1d9e86){return function(_0x558f76){try{jsonpatch[_0x5adb('0x1e')](_0x558f76,_0x1d9e86,!![]);}catch(_0x50e84f){return BPromise['reject'](_0x50e84f);}return _0x558f76[_0x5adb('0x1f')]();};}function saveUpdates(_0x1bed20,_0x438671){return function(_0x1fd4a7){if(_0x1fd4a7){return _0x1fd4a7[_0x5adb('0x20')](_0x1bed20)['then'](function(_0x3255b3){return _0x3255b3;});}return null;};}function removeEntity(_0x5c296e,_0x4e9f16){return function(_0x3754cc){if(_0x3754cc){return _0x3754cc[_0x5adb('0x21')]()[_0x5adb('0x22')](function(){_0x5c296e[_0x5adb('0x17')](0xcc)[_0x5adb('0x18')]();});}};}function handleEntityNotFound(_0x413911,_0xfd9bb9){return function(_0x4ca150){if(!_0x4ca150){_0x413911[_0x5adb('0x23')](0x194);}return _0x4ca150;};}function handleError(_0x373cc3,_0x3220cd){_0x3220cd=_0x3220cd||0x1f4;return function(_0x3839fb){logger[_0x5adb('0x24')](_0x3839fb['stack']);if(_0x3839fb[_0x5adb('0x25')]){delete _0x3839fb[_0x5adb('0x25')];}_0x373cc3['status'](_0x3220cd)[_0x5adb('0x26')](_0x3839fb);};}exports[_0x5adb('0x27')]=function(_0x1a0acd,_0x55b40a){var _0x13ad1d={},_0xbe21b1={},_0x3a4fca={'count':0x0,'rows':[]};var _0x2c64a3=db[_0x5adb('0x28')][_0x5adb('0x29')];_0xbe21b1['model']=_['keys'](_0x2c64a3);_0xbe21b1['query']=_[_0x5adb('0x2a')](_0x1a0acd[_0x5adb('0x2b')]);_0xbe21b1[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0xbe21b1[_0x5adb('0x2e')],_0xbe21b1['query']);_0x13ad1d[_0x5adb('0x2f')]=_[_0x5adb('0x2d')](_0xbe21b1[_0x5adb('0x2e')],qs[_0x5adb('0x30')](_0x1a0acd[_0x5adb('0x2b')][_0x5adb('0x30')]));_0x13ad1d[_0x5adb('0x2f')]=_0x13ad1d[_0x5adb('0x2f')][_0x5adb('0x31')]?_0x13ad1d[_0x5adb('0x2f')]:_0xbe21b1['model'];if(!_0x1a0acd[_0x5adb('0x2b')]['hasOwnProperty'](_0x5adb('0x32'))){_0x13ad1d[_0x5adb('0x1c')]=qs['limit'](_0x1a0acd[_0x5adb('0x2b')][_0x5adb('0x1c')]);_0x13ad1d[_0x5adb('0x1b')]=qs['offset'](_0x1a0acd[_0x5adb('0x2b')][_0x5adb('0x1b')]);}_0x13ad1d['order']=qs['sort'](_0x1a0acd[_0x5adb('0x2b')]['sort']);_0x13ad1d[_0x5adb('0x33')]=qs[_0x5adb('0x2c')](_[_0x5adb('0x34')](_0x1a0acd[_0x5adb('0x2b')],_0xbe21b1[_0x5adb('0x2c')]));if(_0x1a0acd['query'][_0x5adb('0x35')]){_0x13ad1d[_0x5adb('0x33')]=_[_0x5adb('0x36')](_0x13ad1d['where'],{'$or':_['map'](_0x2c64a3,function(_0x32eb69){if(_0x32eb69[_0x5adb('0x37')]['key']!==_0x5adb('0x38')){var _0x4a4260={};_0x4a4260[_0x32eb69[_0x5adb('0x39')]]={'$like':'%'+_0x1a0acd['query'][_0x5adb('0x35')]+'%'};return _0x4a4260;}})});}_0x13ad1d=_['merge']({},_0x13ad1d,_0x1a0acd[_0x5adb('0x3a')]);var _0x23a1db={'where':_0x13ad1d['where']};return db[_0x5adb('0x28')]['count'](_0x23a1db)[_0x5adb('0x22')](function(_0x34e828){_0x3a4fca[_0x5adb('0x1a')]=_0x34e828;if(_0x1a0acd['query'][_0x5adb('0x3b')]){_0x13ad1d[_0x5adb('0x3c')]=[{'all':!![]}];}return db[_0x5adb('0x28')][_0x5adb('0x3d')](_0x13ad1d);})[_0x5adb('0x22')](function(_0x52d74f){_0x3a4fca['rows']=_0x52d74f;return _0x3a4fca;})['then'](respondWithFilteredResult(_0x55b40a,_0x13ad1d))['catch'](handleError(_0x55b40a,null));};exports[_0x5adb('0x3e')]=function(_0x2fbe14,_0x3a104a){var _0x399489={'raw':![],'where':{'id':_0x2fbe14[_0x5adb('0x3f')]['id']}},_0x130e18={};_0x130e18[_0x5adb('0x2e')]=_[_0x5adb('0x2a')](db['UserProfileSection']['rawAttributes']);_0x130e18[_0x5adb('0x2b')]=_['keys'](_0x2fbe14[_0x5adb('0x2b')]);_0x130e18[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x130e18[_0x5adb('0x2e')],_0x130e18[_0x5adb('0x2b')]);_0x399489['attributes']=_[_0x5adb('0x2d')](_0x130e18[_0x5adb('0x2e')],qs['fields'](_0x2fbe14[_0x5adb('0x2b')][_0x5adb('0x30')]));_0x399489['attributes']=_0x399489[_0x5adb('0x2f')][_0x5adb('0x31')]?_0x399489[_0x5adb('0x2f')]:_0x130e18[_0x5adb('0x2e')];if(_0x2fbe14[_0x5adb('0x2b')][_0x5adb('0x3b')]){_0x399489[_0x5adb('0x3c')]=[{'all':!![]}];}_0x399489=_['merge']({},_0x399489,_0x2fbe14['options']);return db[_0x5adb('0x28')][_0x5adb('0x40')](_0x399489)[_0x5adb('0x22')](handleEntityNotFound(_0x3a104a,null))[_0x5adb('0x22')](respondWithResult(_0x3a104a,null))['catch'](handleError(_0x3a104a,null));};exports['create']=function(_0xaa32e4,_0x4d7d86){return db[_0x5adb('0x28')][_0x5adb('0x41')](_0xaa32e4[_0x5adb('0x42')],{})['then'](respondWithResult(_0x4d7d86,0xc9))[_0x5adb('0x43')](handleError(_0x4d7d86,null));};exports[_0x5adb('0x20')]=function(_0x5b574c,_0x7786c4){if(_0x5b574c[_0x5adb('0x42')]['id']){delete _0x5b574c[_0x5adb('0x42')]['id'];}return db[_0x5adb('0x28')][_0x5adb('0x40')]({'where':{'id':_0x5b574c[_0x5adb('0x3f')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x7786c4,null))[_0x5adb('0x22')](saveUpdates(_0x5b574c['body'],null))[_0x5adb('0x22')](respondWithResult(_0x7786c4,null))['catch'](handleError(_0x7786c4,null));};exports['destroy']=function(_0x5015ee,_0x3cd211){return db[_0x5adb('0x28')][_0x5adb('0x40')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))['then'](removeEntity(_0x3cd211,null))[_0x5adb('0x43')](handleError(_0x3cd211,null));};exports[_0x5adb('0x44')]=function(_0x3f9dc7,_0x541537){return db[_0x5adb('0x28')]['describe']()[_0x5adb('0x22')](respondWithResult(_0x541537,null))[_0x5adb('0x43')](handleError(_0x541537,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c3513b8..558c199 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 _0xe2cd=['bluebird','request-promise','rimraf','../../config/environment','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x43cbed,_0x119e4c){var _0x12a0a5=function(_0x4855a1){while(--_0x4855a1){_0x43cbed['push'](_0x43cbed['shift']());}};_0x12a0a5(++_0x119e4c);}(_0xe2cd,0x64));var _0xde2c=function(_0x248a18,_0x349b6e){_0x248a18=_0x248a18-0x0;var _0x311213=_0xe2cd[_0x248a18];return _0x311213;};'use strict';var _=require(_0xde2c('0x0'));var util=require(_0xde2c('0x1'));var logger=require(_0xde2c('0x2'))(_0xde2c('0x3'));var moment=require(_0xde2c('0x4'));var BPromise=require(_0xde2c('0x5'));var rp=require(_0xde2c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde2c('0x7'));var config=require(_0xde2c('0x8'));var attributes=require('./userProfileSection.attributes');module[_0xde2c('0x9')]=function(_0x2195fc,_0x191eb1){return _0x2195fc[_0xde2c('0xa')]('UserProfileSection',attributes,{'tableName':_0xde2c('0xb'),'paranoid':![],'indexes':[{'name':_0xde2c('0xc'),'fields':[_0xde2c('0xd'),_0xde2c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26be=['util','api','moment','bluebird','rimraf','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x26be,0x108));var _0xe26b=function(_0x58466c,_0x56d428){_0x58466c=_0x58466c-0x0;var _0x6f27a8=_0x26be[_0x58466c];return _0x6f27a8;};'use strict';var _=require('lodash');var util=require(_0xe26b('0x0'));var logger=require('../../config/logger')(_0xe26b('0x1'));var moment=require(_0xe26b('0x2'));var BPromise=require(_0xe26b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe26b('0x4'));var config=require(_0xe26b('0x5'));var attributes=require(_0xe26b('0x6'));module['exports']=function(_0x398ce5,_0x22bf26){return _0x398ce5[_0xe26b('0x7')]('UserProfileSection',attributes,{'tableName':_0xe26b('0x8'),'paranoid':![],'indexes':[{'name':_0xe26b('0x9'),'fields':[_0xe26b('0xa'),_0xe26b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 5b2431f..8c10e0e 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 _0x9cd6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x194d17,_0x30dbc1){var _0x8f7313=function(_0x2106ae){while(--_0x2106ae){_0x194d17['push'](_0x194d17['shift']());}};_0x8f7313(++_0x30dbc1);}(_0x9cd6,0x16a));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x69cd('0x0'));var moment=require('moment');var BPromise=require(_0x69cd('0x1'));var rs=require(_0x69cd('0x2'));var fs=require('fs');var Redis=require(_0x69cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x69cd('0x4'));var logger=require(_0x69cd('0x5'))(_0x69cd('0x6'));var config=require(_0x69cd('0x7'));var jayson=require(_0x69cd('0x8'));var client=jayson[_0x69cd('0x9')][_0x69cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x146011,_0xe10826,_0x4c5501){return new BPromise(function(_0x342fe5,_0x32ff71){return client[_0x69cd('0xb')](_0x146011,_0x4c5501)[_0x69cd('0xc')](function(_0x4aa063){logger[_0x69cd('0xd')](_0x69cd('0xe'),_0xe10826,_0x69cd('0xf'));logger[_0x69cd('0x10')](_0x69cd('0x11'),_0xe10826,_0x69cd('0xf'),JSON[_0x69cd('0x12')](_0x4aa063));if(_0x4aa063[_0x69cd('0x13')]){if(_0x4aa063[_0x69cd('0x13')]['code']===0x1f4){logger[_0x69cd('0x13')](_0x69cd('0xe'),_0xe10826,_0x4aa063[_0x69cd('0x13')][_0x69cd('0x14')]);return _0x32ff71(_0x4aa063[_0x69cd('0x13')][_0x69cd('0x14')]);}logger['error'](_0x69cd('0xe'),_0xe10826,_0x4aa063[_0x69cd('0x13')][_0x69cd('0x14')]);return _0x342fe5(_0x4aa063['error']['message']);}else{logger['info'](_0x69cd('0xe'),_0xe10826,'request\x20sent');_0x342fe5(_0x4aa063[_0x69cd('0x15')]['message']);}})[_0x69cd('0x16')](function(_0x31d67b){logger[_0x69cd('0x13')](_0x69cd('0xe'),_0xe10826,_0x31d67b);_0x32ff71(_0x31d67b);});});} \ No newline at end of file +var _0x565e=['stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x3ad634,_0x57aa61){var _0x2c5a32=function(_0x24a546){while(--_0x24a546){_0x3ad634['push'](_0x3ad634['shift']());}};_0x2c5a32(++_0x57aa61);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a9d48,_0x470daf,_0x359a05){return new BPromise(function(_0x1204c8,_0x14f3df){return client[_0xe565('0xb')](_0x1a9d48,_0x359a05)[_0xe565('0xc')](function(_0x1d3d48){logger[_0xe565('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x470daf,_0xe565('0xe'));logger[_0xe565('0xf')](_0xe565('0x10'),_0x470daf,'request\x20sent',JSON[_0xe565('0x11')](_0x1d3d48));if(_0x1d3d48[_0xe565('0x12')]){if(_0x1d3d48[_0xe565('0x12')][_0xe565('0x13')]===0x1f4){logger['error'](_0xe565('0x14'),_0x470daf,_0x1d3d48['error'][_0xe565('0x15')]);return _0x14f3df(_0x1d3d48['error'][_0xe565('0x15')]);}logger[_0xe565('0x12')](_0xe565('0x14'),_0x470daf,_0x1d3d48['error'][_0xe565('0x15')]);return _0x1204c8(_0x1d3d48[_0xe565('0x12')][_0xe565('0x15')]);}else{logger[_0xe565('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x470daf,_0xe565('0xe'));_0x1204c8(_0x1d3d48[_0xe565('0x16')][_0xe565('0x15')]);}})[_0xe565('0x17')](function(_0x3899de){logger[_0xe565('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x470daf,_0x3899de);_0x14f3df(_0x3899de);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b6058fb..88512b9 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 _0x5226=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x3c27bf,_0x454968){var _0x3c7733=function(_0x21a9c5){while(--_0x21a9c5){_0x3c27bf['push'](_0x3c27bf['shift']());}};_0x3c7733(++_0x454968);}(_0x5226,0x137));var _0x6522=function(_0x18e6f5,_0x2dda7a){_0x18e6f5=_0x18e6f5-0x0;var _0x3db621=_0x5226[_0x18e6f5];return _0x3db621;};'use strict';var multer=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var path=require(_0x6522('0x2'));var timeout=require(_0x6522('0x3'));var express=require(_0x6522('0x4'));var router=express['Router']();var auth=require(_0x6522('0x5'));var interaction=require(_0x6522('0x6'));var config=require(_0x6522('0x7'));module['exports']=router; \ No newline at end of file +var _0x0ec6=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x572f29,_0x440636){var _0x5d170b=function(_0x48dc71){while(--_0x48dc71){_0x572f29['push'](_0x572f29['shift']());}};_0x5d170b(++_0x440636);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x18d9c4,_0x21a8cd){_0x18d9c4=_0x18d9c4-0x0;var _0x2b7ca6=_0x0ec6[_0x18d9c4];return _0x2b7ca6;};'use strict';var multer=require(_0x60ec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x60ec('0x1'));var express=require(_0x60ec('0x2'));var router=express[_0x60ec('0x3')]();var auth=require(_0x60ec('0x4'));var interaction=require(_0x60ec('0x5'));var config=require(_0x60ec('0x6'));module[_0x60ec('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c21a63c..4020cac 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 _0xcc6b=['sequelize','INTEGER'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0xcc6b,0x1e6));var _0xbcc6=function(_0x2b30bc,_0x449110){_0x2b30bc=_0x2b30bc-0x0;var _0x6444b2=_0xcc6b[_0x2b30bc];return _0x6444b2;};'use strict';var Sequelize=require(_0xbcc6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbcc6('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2160=['INTEGER','sequelize','exports'];(function(_0xee209,_0x4858f4){var _0x48cd8c=function(_0x5e3eda){while(--_0x5e3eda){_0xee209['push'](_0xee209['shift']());}};_0x48cd8c(++_0x4858f4);}(_0x2160,0xf4));var _0x0216=function(_0x419d52,_0x22c8b2){_0x419d52=_0x419d52-0x0;var _0x546335=_0x2160[_0x419d52];return _0x546335;};'use strict';var Sequelize=require(_0x0216('0x0'));module[_0x0216('0x1')]={'penalty':{'type':Sequelize[_0x0216('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 989bd6a..2494272 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 _0xa76e=['UserSmsQueue','user_has_sms_queues','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xa76e,0xfe));var _0xea76=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xa76e[_0xd816e2];return _0x1f5924;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var logger=require(_0xea76('0x1'))('api');var moment=require('moment');var BPromise=require(_0xea76('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea76('0x3'));var rimraf=require(_0xea76('0x4'));var config=require(_0xea76('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0xea76('0x6')]=function(_0x48ff4f,_0x337097){return _0x48ff4f['define'](_0xea76('0x7'),attributes,{'tableName':_0xea76('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0xacfe5e,_0x326d83){var _0x1f5861=function(_0x54f7e4){while(--_0x54f7e4){_0xacfe5e['push'](_0xacfe5e['shift']());}};_0x1f5861(++_0x326d83);}(_0xd8fb,0x99));var _0xbd8f=function(_0x257db0,_0x184c03){_0x257db0=_0x257db0-0x0;var _0xbe54ab=_0xd8fb[_0x257db0];return _0xbe54ab;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c82575f..69d7e8d 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 _0x174a=['code','error','message','UserSmsQueue,\x20%s,\x20%s','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x52b58a,_0x1a0858){var _0x39aee7=function(_0xebc743){while(--_0xebc743){_0x52b58a['push'](_0x52b58a['shift']());}};_0x39aee7(++_0x1a0858);}(_0x174a,0x142));var _0xa174=function(_0x2fc8da,_0x4943a2){_0x2fc8da=_0x2fc8da-0x0;var _0x4fb3b9=_0x174a[_0x2fc8da];return _0x4fb3b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa174('0x0'));var BPromise=require(_0xa174('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa174('0x2'));var db=require(_0xa174('0x3'))['db'];var utils=require(_0xa174('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa174('0x5'));var jayson=require(_0xa174('0x6'));var client=jayson[_0xa174('0x7')][_0xa174('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf815ad,_0x2fdec4,_0x4c2c83){return new BPromise(function(_0xf3d6cd,_0x420021){return client['request'](_0xf815ad,_0x4c2c83)[_0xa174('0x9')](function(_0x1641b8){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2fdec4,_0xa174('0xa'));logger[_0xa174('0xb')](_0xa174('0xc'),_0x2fdec4,_0xa174('0xa'),JSON[_0xa174('0xd')](_0x1641b8));if(_0x1641b8['error']){if(_0x1641b8['error'][_0xa174('0xe')]===0x1f4){logger[_0xa174('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x2fdec4,_0x1641b8['error']['message']);return _0x420021(_0x1641b8[_0xa174('0xf')][_0xa174('0x10')]);}logger[_0xa174('0xf')](_0xa174('0x11'),_0x2fdec4,_0x1641b8['error']['message']);return _0xf3d6cd(_0x1641b8[_0xa174('0xf')][_0xa174('0x10')]);}else{logger[_0xa174('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x2fdec4,_0xa174('0xa'));_0xf3d6cd(_0x1641b8[_0xa174('0x13')][_0xa174('0x10')]);}})[_0xa174('0x14')](function(_0x3be4ca){logger[_0xa174('0xf')](_0xa174('0x11'),_0x2fdec4,_0x3be4ca);_0x420021(_0x3be4ca);});});} \ No newline at end of file +var _0xf7e6=['bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x5dd7ef,_0x32d4a1){var _0x1d04dc=function(_0x1a1f1f){while(--_0x1a1f1f){_0x5dd7ef['push'](_0x5dd7ef['shift']());}};_0x1d04dc(++_0x32d4a1);}(_0xf7e6,0x13d));var _0x6f7e=function(_0x5f2742,_0x27b605){_0x5f2742=_0x5f2742-0x0;var _0x60104d=_0xf7e6[_0x5f2742];return _0x60104d;};'use strict';var _=require(_0x6f7e('0x0'));var util=require(_0x6f7e('0x1'));var moment=require(_0x6f7e('0x2'));var BPromise=require(_0x6f7e('0x3'));var rs=require(_0x6f7e('0x4'));var fs=require('fs');var Redis=require(_0x6f7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6f7e('0x6'));var jayson=require(_0x6f7e('0x7'));var client=jayson[_0x6f7e('0x8')][_0x6f7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2069c7,_0x5d298c,_0x3aa18c){return new BPromise(function(_0x867343,_0x378b50){return client[_0x6f7e('0xa')](_0x2069c7,_0x3aa18c)[_0x6f7e('0xb')](function(_0x543214){logger[_0x6f7e('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x5d298c,'request\x20sent');logger['debug'](_0x6f7e('0xd'),_0x5d298c,_0x6f7e('0xe'),JSON[_0x6f7e('0xf')](_0x543214));if(_0x543214[_0x6f7e('0x10')]){if(_0x543214['error']['code']===0x1f4){logger[_0x6f7e('0x10')](_0x6f7e('0x11'),_0x5d298c,_0x543214[_0x6f7e('0x10')][_0x6f7e('0x12')]);return _0x378b50(_0x543214[_0x6f7e('0x10')][_0x6f7e('0x12')]);}logger[_0x6f7e('0x10')](_0x6f7e('0x11'),_0x5d298c,_0x543214[_0x6f7e('0x10')]['message']);return _0x867343(_0x543214[_0x6f7e('0x10')][_0x6f7e('0x12')]);}else{logger['info'](_0x6f7e('0x11'),_0x5d298c,_0x6f7e('0xe'));_0x867343(_0x543214['result'][_0x6f7e('0x12')]);}})[_0x6f7e('0x13')](function(_0x5c1953){logger['error'](_0x6f7e('0x11'),_0x5d298c,_0x5c1953);_0x378b50(_0x5c1953);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index fd86f55..4ba76b6 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 _0x9264=['connect-timeout','../../components/auth/service','exports','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var path=require(_0x4926('0x2'));var timeout=require(_0x4926('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4926('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4926('0x5')]=router; \ No newline at end of file +var _0x5e0e=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x5e0e,0x89));var _0xe5e0=function(_0x8269ae,_0xcd8119){_0x8269ae=_0x8269ae-0x0;var _0x1e733d=_0x5e0e[_0x8269ae];return _0x1e733d;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var auth=require(_0xe5e0('0x5'));var interaction=require(_0xe5e0('0x6'));var config=require('../../config/environment');module[_0xe5e0('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index d705c76..45e0327 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 _0x0be1=['exports','INTEGER','sequelize'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x0be1,0x13a));var _0x10be=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x0be1[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0x10be('0x0'));module[_0x10be('0x1')]={'penalty':{'type':Sequelize[_0x10be('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x64ee=['sequelize','INTEGER'];(function(_0x5e95c,_0x5d0943){var _0x3ff5b8=function(_0x389c15){while(--_0x389c15){_0x5e95c['push'](_0x5e95c['shift']());}};_0x3ff5b8(++_0x5d0943);}(_0x64ee,0x14a));var _0xe64e=function(_0x3f3a6a,_0x3020d5){_0x3f3a6a=_0x3f3a6a-0x0;var _0x507c7b=_0x64ee[_0x3f3a6a];return _0x507c7b;};'use strict';var Sequelize=require(_0xe64e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe64e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 32e3805..b2a5628 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 _0xca09=['lodash','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x36209d,_0xc20ef3){var _0x467290=function(_0x51b2ba){while(--_0x51b2ba){_0x36209d['push'](_0x36209d['shift']());}};_0x467290(++_0xc20ef3);}(_0xca09,0x108));var _0x9ca0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca09[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9ca0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9ca0('0x1'));var BPromise=require(_0x9ca0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ca0('0x3'));var rimraf=require(_0x9ca0('0x4'));var config=require(_0x9ca0('0x5'));var attributes=require(_0x9ca0('0x6'));module[_0x9ca0('0x7')]=function(_0xb417c,_0x5a23a2){return _0xb417c[_0x9ca0('0x8')](_0x9ca0('0x9'),attributes,{'tableName':_0x9ca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x603f=['../../config/logger','api','moment','request-promise','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','util'];(function(_0x344eb8,_0x12a8a5){var _0x3f197c=function(_0x21fa6e){while(--_0x21fa6e){_0x344eb8['push'](_0x344eb8['shift']());}};_0x3f197c(++_0x12a8a5);}(_0x603f,0x8b));var _0xf603=function(_0x28d3f4,_0x2a26f3){_0x28d3f4=_0x28d3f4-0x0;var _0x43596c=_0x603f[_0x28d3f4];return _0x43596c;};'use strict';var _=require('lodash');var util=require(_0xf603('0x0'));var logger=require(_0xf603('0x1'))(_0xf603('0x2'));var moment=require(_0xf603('0x3'));var BPromise=require('bluebird');var rp=require(_0xf603('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf603('0x5'));var attributes=require(_0xf603('0x6'));module['exports']=function(_0x1710a3,_0x54eb52){return _0x1710a3[_0xf603('0x7')](_0xf603('0x8'),attributes,{'tableName':_0xf603('0x9'),'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 f5bf37d..7bfd4b6 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 _0xd5ec=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','util','moment','bluebird','randomstring'];(function(_0x42f3e4,_0x2646fd){var _0x1d7aa6=function(_0x4a721d){while(--_0x4a721d){_0x42f3e4['push'](_0x42f3e4['shift']());}};_0x1d7aa6(++_0x2646fd);}(_0xd5ec,0x150));var _0xcd5e=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xd5ec[_0x330723];return _0x60c546;};'use strict';var _=require('lodash');var util=require(_0xcd5e('0x0'));var moment=require(_0xcd5e('0x1'));var BPromise=require(_0xcd5e('0x2'));var rs=require(_0xcd5e('0x3'));var fs=require('fs');var Redis=require(_0xcd5e('0x4'));var db=require(_0xcd5e('0x5'))['db'];var utils=require(_0xcd5e('0x6'));var logger=require('../../config/logger')(_0xcd5e('0x7'));var config=require(_0xcd5e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcbecb0,_0x173554,_0x5b927c){return new BPromise(function(_0xfb1333,_0x241308){return client[_0xcd5e('0x9')](_0xcbecb0,_0x5b927c)['then'](function(_0x3dc027){logger[_0xcd5e('0xa')](_0xcd5e('0xb'),_0x173554,'request\x20sent');logger[_0xcd5e('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x173554,_0xcd5e('0xd'),JSON['stringify'](_0x3dc027));if(_0x3dc027[_0xcd5e('0xe')]){if(_0x3dc027[_0xcd5e('0xe')]['code']===0x1f4){logger[_0xcd5e('0xe')](_0xcd5e('0xb'),_0x173554,_0x3dc027[_0xcd5e('0xe')][_0xcd5e('0xf')]);return _0x241308(_0x3dc027[_0xcd5e('0xe')][_0xcd5e('0xf')]);}logger[_0xcd5e('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x173554,_0x3dc027['error'][_0xcd5e('0xf')]);return _0xfb1333(_0x3dc027[_0xcd5e('0xe')][_0xcd5e('0xf')]);}else{logger[_0xcd5e('0xa')](_0xcd5e('0xb'),_0x173554,_0xcd5e('0xd'));_0xfb1333(_0x3dc027[_0xcd5e('0x10')][_0xcd5e('0xf')]);}})['catch'](function(_0x229694){logger[_0xcd5e('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x173554,_0x229694);_0x241308(_0x229694);});});} \ No newline at end of file +var _0x2d55=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e84c0,_0x2dfdd8){var _0x3a07be=function(_0x33e496){while(--_0x33e496){_0x2e84c0['push'](_0x2e84c0['shift']());}};_0x3a07be(++_0x2dfdd8);}(_0x2d55,0xa8));var _0x52d5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2d55[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x52d5('0x0'));var util=require(_0x52d5('0x1'));var moment=require(_0x52d5('0x2'));var BPromise=require(_0x52d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52d5('0x4'));var db=require(_0x52d5('0x5'))['db'];var utils=require(_0x52d5('0x6'));var logger=require(_0x52d5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x52d5('0x8'));var client=jayson[_0x52d5('0x9')][_0x52d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c008d,_0x190c1f,_0xfb8ea8){return new BPromise(function(_0x4f9154,_0x2b7694){return client[_0x52d5('0xb')](_0x3c008d,_0xfb8ea8)[_0x52d5('0xc')](function(_0xd2efa2){logger['info'](_0x52d5('0xd'),_0x190c1f,_0x52d5('0xe'));logger[_0x52d5('0xf')](_0x52d5('0x10'),_0x190c1f,_0x52d5('0xe'),JSON[_0x52d5('0x11')](_0xd2efa2));if(_0xd2efa2['error']){if(_0xd2efa2[_0x52d5('0x12')]['code']===0x1f4){logger[_0x52d5('0x12')](_0x52d5('0xd'),_0x190c1f,_0xd2efa2[_0x52d5('0x12')][_0x52d5('0x13')]);return _0x2b7694(_0xd2efa2['error'][_0x52d5('0x13')]);}logger[_0x52d5('0x12')](_0x52d5('0xd'),_0x190c1f,_0xd2efa2['error'][_0x52d5('0x13')]);return _0x4f9154(_0xd2efa2[_0x52d5('0x12')][_0x52d5('0x13')]);}else{logger[_0x52d5('0x14')](_0x52d5('0xd'),_0x190c1f,_0x52d5('0xe'));_0x4f9154(_0xd2efa2[_0x52d5('0x15')][_0x52d5('0x13')]);}})[_0x52d5('0x16')](function(_0x313fa1){logger[_0x52d5('0x12')](_0x52d5('0xd'),_0x190c1f,_0x313fa1);_0x2b7694(_0x313fa1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ddc722b..e442f90 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 _0x0960=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x0960,0xc2));var _0x0096=function(_0x658e2f,_0x2c0060){_0x658e2f=_0x658e2f-0x0;var _0x4d8b6a=_0x0960[_0x658e2f];return _0x4d8b6a;};'use strict';var multer=require(_0x0096('0x0'));var util=require(_0x0096('0x1'));var path=require('path');var timeout=require(_0x0096('0x2'));var express=require(_0x0096('0x3'));var router=express[_0x0096('0x4')]();var auth=require(_0x0096('0x5'));var interaction=require(_0x0096('0x6'));var config=require(_0x0096('0x7'));module[_0x0096('0x8')]=router; \ No newline at end of file +var _0x5d17=['../../components/auth/service','../../config/environment','exports','multer','util','express','Router'];(function(_0x1fd4a7,_0x4fec53){var _0x456e64=function(_0x76aa3c){while(--_0x76aa3c){_0x1fd4a7['push'](_0x1fd4a7['shift']());}};_0x456e64(++_0x4fec53);}(_0x5d17,0x114));var _0x75d1=function(_0x3050b5,_0x182c6a){_0x3050b5=_0x3050b5-0x0;var _0x37cceb=_0x5d17[_0x3050b5];return _0x37cceb;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));module[_0x75d1('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index cdf0f86..e3acff3 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 _0xc0ac=['INTEGER','sequelize','exports','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xc0ac,0xaf));var _0xcc0a=function(_0x4b061f,_0xe1c55e){_0x4b061f=_0x4b061f-0x0;var _0x4c69c5=_0xc0ac[_0x4b061f];return _0x4c69c5;};'use strict';var Sequelize=require(_0xcc0a('0x0'));module[_0xcc0a('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xcc0a('0x2')},'membername':{'type':Sequelize[_0xcc0a('0x3')],'allowNull':![],'comment':_0xcc0a('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcc0a('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xcc0a('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0xcc0a('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xcc0a('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xcc0a('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xcc0a('0x2')}}; \ No newline at end of file +var _0x7fe2=['sequelize','exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface'];(function(_0x43ea2c,_0x458e54){var _0x4bcd5d=function(_0x2d82e5){while(--_0x2d82e5){_0x43ea2c['push'](_0x43ea2c['shift']());}};_0x4bcd5d(++_0x458e54);}(_0x7fe2,0x84));var _0x27fe=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x7fe2[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require(_0x27fe('0x0'));module[_0x27fe('0x1')]={'uniqueid':{'type':Sequelize[_0x27fe('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x27fe('0x3')],'allowNull':![],'comment':_0x27fe('0x4')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x27fe('0x3')],'allowNull':![],'unique':_0x27fe('0x5'),'comment':_0x27fe('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x27fe('0x3')],'allowNull':![],'unique':_0x27fe('0x5'),'comment':_0x27fe('0x4')},'penalty':{'type':Sequelize[_0x27fe('0x2')](0xb),'defaultValue':0x0,'comment':_0x27fe('0x4')},'paused':{'type':Sequelize[_0x27fe('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1efe157..6664d37 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){UserVoiceQueueRtEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);UserVoiceQueueRtEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0abf=['hook','events','UserVoiceQueueRt','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x4f1d63,_0x2b395d){var _0x2a5699=function(_0x233377){while(--_0x233377){_0x4f1d63['push'](_0x4f1d63['shift']());}};_0x2a5699(++_0x2b395d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xf0ab('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xf0ab('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf0ab('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf0ab('0x3')};function emitEvent(_0x4889fb){return function(_0x7ea4e0,_0x3be05e,_0x2efe43){UserVoiceQueueRtEvents[_0xf0ab('0x4')](_0x4889fb+':'+_0x7ea4e0['id'],_0x7ea4e0);UserVoiceQueueRtEvents[_0xf0ab('0x4')](_0x4889fb,_0x7ea4e0);_0x2efe43(null);};}for(var e in events){if(events[_0xf0ab('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xf0ab('0x6')](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 184ae6d..4ef42c8 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 _0x8841=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x39fe65,_0x37f209){var _0x32fdc3=function(_0x260618){while(--_0x260618){_0x39fe65['push'](_0x39fe65['shift']());}};_0x32fdc3(++_0x37f209);}(_0x8841,0x173));var _0x1884=function(_0x597084,_0x43851e){_0x597084=_0x597084-0x0;var _0x219ab5=_0x8841[_0x597084];return _0x219ab5;};'use strict';var _=require(_0x1884('0x0'));var util=require(_0x1884('0x1'));var logger=require(_0x1884('0x2'))(_0x1884('0x3'));var moment=require('moment');var BPromise=require(_0x1884('0x4'));var rp=require(_0x1884('0x5'));var fs=require('fs');var path=require(_0x1884('0x6'));var rimraf=require(_0x1884('0x7'));var config=require(_0x1884('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x4c545c,_0x2bec0e){return _0x4c545c[_0x1884('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x1884('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8fb=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x2375eb,_0x279c89){var _0x883d24=function(_0x11a31c){while(--_0x11a31c){_0x2375eb['push'](_0x2375eb['shift']());}};_0x883d24(++_0x279c89);}(_0xb8fb,0x135));var _0xbb8f=function(_0x3a912a,_0x37b8a1){_0x3a912a=_0x3a912a-0x0;var _0x30b5ba=_0xb8fb[_0x3a912a];return _0x30b5ba;};'use strict';var _=require(_0xbb8f('0x0'));var util=require(_0xbb8f('0x1'));var logger=require(_0xbb8f('0x2'))(_0xbb8f('0x3'));var moment=require(_0xbb8f('0x4'));var BPromise=require(_0xbb8f('0x5'));var rp=require(_0xbb8f('0x6'));var fs=require('fs');var path=require(_0xbb8f('0x7'));var rimraf=require(_0xbb8f('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb8f('0x9'));module[_0xbb8f('0xa')]=function(_0x11d322,_0x50ed8e){return _0x11d322[_0xbb8f('0xb')](_0xbb8f('0xc'),attributes,{'tableName':_0xbb8f('0xd'),'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 546a1b2..3c61107 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 _0xfa80=['GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','request','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch'];(function(_0x1defb2,_0x429099){var _0xad8973=function(_0xe26c42){while(--_0xe26c42){_0x1defb2['push'](_0x1defb2['shift']());}};_0xad8973(++_0x429099);}(_0xfa80,0x1a8));var _0x0fa8=function(_0x1170c4,_0x4b6c63){_0x1170c4=_0x1170c4-0x0;var _0x48e305=_0xfa80[_0x1170c4];return _0x48e305;};'use strict';var _=require('lodash');var util=require(_0x0fa8('0x0'));var moment=require(_0x0fa8('0x1'));var BPromise=require('bluebird');var rs=require(_0x0fa8('0x2'));var fs=require('fs');var Redis=require(_0x0fa8('0x3'));var db=require(_0x0fa8('0x4'))['db'];var utils=require(_0x0fa8('0x5'));var logger=require(_0x0fa8('0x6'))(_0x0fa8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0fa8('0x8')]({'port':0x232a});config[_0x0fa8('0x9')]=_['defaults'](config[_0x0fa8('0x9')],{'host':_0x0fa8('0xa'),'port':0x18eb});var socket=require(_0x0fa8('0xb'))(new Redis(config[_0x0fa8('0x9')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x154806,_0x1e22b4,_0x15543a){return new BPromise(function(_0x5a2d4d,_0x1cc56a){return client[_0x0fa8('0xc')](_0x154806,_0x15543a)['then'](function(_0x2d8447){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1e22b4,_0x0fa8('0xd'));logger[_0x0fa8('0xe')](_0x0fa8('0xf'),_0x1e22b4,_0x0fa8('0xd'),JSON[_0x0fa8('0x10')](_0x2d8447));if(_0x2d8447[_0x0fa8('0x11')]){if(_0x2d8447[_0x0fa8('0x11')][_0x0fa8('0x12')]===0x1f4){logger['error'](_0x0fa8('0x13'),_0x1e22b4,_0x2d8447[_0x0fa8('0x11')][_0x0fa8('0x14')]);return _0x1cc56a(_0x2d8447[_0x0fa8('0x11')][_0x0fa8('0x14')]);}logger[_0x0fa8('0x11')](_0x0fa8('0x13'),_0x1e22b4,_0x2d8447[_0x0fa8('0x11')][_0x0fa8('0x14')]);return _0x5a2d4d(_0x2d8447[_0x0fa8('0x11')][_0x0fa8('0x14')]);}else{logger[_0x0fa8('0x15')](_0x0fa8('0x13'),_0x1e22b4,_0x0fa8('0xd'));_0x5a2d4d(_0x2d8447[_0x0fa8('0x16')][_0x0fa8('0x14')]);}})[_0x0fa8('0x17')](function(_0x4f0fb6){logger[_0x0fa8('0x11')](_0x0fa8('0x13'),_0x1e22b4,_0x4f0fb6);_0x1cc56a(_0x4f0fb6);});});}exports[_0x0fa8('0x18')]=function(_0x2f0fdf){var _0x316004=this;return new Promise(function(_0x587085,_0x2b7878){return db[_0x0fa8('0x19')][_0x0fa8('0x1a')]({'raw':_0x2f0fdf[_0x0fa8('0x1b')]?_0x2f0fdf[_0x0fa8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2f0fdf[_0x0fa8('0x1b')]?_0x2f0fdf['options']['where']||null:null,'attributes':[[db[_0x0fa8('0x1c')]['fn'](_0x0fa8('0x1d'),db[_0x0fa8('0x1c')]['fn']('IF',db[_0x0fa8('0x1c')]['literal'](_0x0fa8('0x1e')))),_0x0fa8('0x1f')]]})['then'](function(_0x33a390){logger['info'](_0x0fa8('0x18'),_0x2f0fdf);logger[_0x0fa8('0xe')](_0x0fa8('0x18'),_0x2f0fdf,JSON[_0x0fa8('0x10')](_0x33a390));_0x587085(_0x33a390);})[_0x0fa8('0x17')](function(_0x5d9102){logger[_0x0fa8('0x11')](_0x0fa8('0x18'),_0x5d9102[_0x0fa8('0x14')],_0x2f0fdf);_0x2b7878(_0x316004[_0x0fa8('0x11')](0x1f4,_0x5d9102[_0x0fa8('0x14')]));});});}; \ No newline at end of file +var _0xf094=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','./userVoiceQueueRt.socket','register','request','info','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug','util','moment','bluebird','randomstring','ioredis'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xf094,0x187));var _0x4f09=function(_0x12e73c,_0x2cbe1d){_0x12e73c=_0x12e73c-0x0;var _0x4c41cb=_0xf094[_0x12e73c];return _0x4c41cb;};'use strict';var _=require('lodash');var util=require(_0x4f09('0x0'));var moment=require(_0x4f09('0x1'));var BPromise=require(_0x4f09('0x2'));var rs=require(_0x4f09('0x3'));var fs=require('fs');var Redis=require(_0x4f09('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f09('0x5'));var logger=require('../../config/logger')(_0x4f09('0x6'));var config=require(_0x4f09('0x7'));var jayson=require(_0x4f09('0x8'));var client=jayson['client'][_0x4f09('0x9')]({'port':0x232a});config[_0x4f09('0xa')]=_[_0x4f09('0xb')](config[_0x4f09('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f09('0xa')]));require(_0x4f09('0xc'))[_0x4f09('0xd')](socket);function respondWithRpcPromise(_0x558b3f,_0x5227f5,_0x3d9e71){return new BPromise(function(_0x246dac,_0x391c54){return client[_0x4f09('0xe')](_0x558b3f,_0x3d9e71)['then'](function(_0x3e86df){logger[_0x4f09('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5227f5,_0x4f09('0x10'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5227f5,_0x4f09('0x10'),JSON[_0x4f09('0x11')](_0x3e86df));if(_0x3e86df[_0x4f09('0x12')]){if(_0x3e86df[_0x4f09('0x12')][_0x4f09('0x13')]===0x1f4){logger[_0x4f09('0x12')](_0x4f09('0x14'),_0x5227f5,_0x3e86df[_0x4f09('0x12')]['message']);return _0x391c54(_0x3e86df[_0x4f09('0x12')][_0x4f09('0x15')]);}logger['error'](_0x4f09('0x14'),_0x5227f5,_0x3e86df['error'][_0x4f09('0x15')]);return _0x246dac(_0x3e86df[_0x4f09('0x12')][_0x4f09('0x15')]);}else{logger[_0x4f09('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5227f5,_0x4f09('0x10'));_0x246dac(_0x3e86df[_0x4f09('0x16')][_0x4f09('0x15')]);}})[_0x4f09('0x17')](function(_0x3abed2){logger[_0x4f09('0x12')](_0x4f09('0x14'),_0x5227f5,_0x3abed2);_0x391c54(_0x3abed2);});});}exports[_0x4f09('0x18')]=function(_0x145ed7){var _0x330d45=this;return new Promise(function(_0x32cd08,_0xc2724f){return db[_0x4f09('0x19')][_0x4f09('0x1a')]({'raw':_0x145ed7[_0x4f09('0x1b')]?_0x145ed7['options']['raw']===undefined?!![]:![]:!![],'where':_0x145ed7[_0x4f09('0x1b')]?_0x145ed7[_0x4f09('0x1b')][_0x4f09('0x1c')]||null:null,'attributes':[[db[_0x4f09('0x1d')]['fn'](_0x4f09('0x1e'),db[_0x4f09('0x1d')]['fn']('IF',db[_0x4f09('0x1d')][_0x4f09('0x1f')](_0x4f09('0x20')))),_0x4f09('0x21')]]})[_0x4f09('0x22')](function(_0x29503d){logger[_0x4f09('0xf')](_0x4f09('0x18'),_0x145ed7);logger[_0x4f09('0x23')](_0x4f09('0x18'),_0x145ed7,JSON[_0x4f09('0x11')](_0x29503d));_0x32cd08(_0x29503d);})[_0x4f09('0x17')](function(_0x5c27d7){logger[_0x4f09('0x12')](_0x4f09('0x18'),_0x5c27d7[_0x4f09('0x15')],_0x145ed7);_0xc2724f(_0x330d45[_0x4f09('0x12')](0x1f4,_0x5c27d7[_0x4f09('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 12f5137..28599da 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 _0x3435=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','register'];(function(_0x21e8f1,_0x31d79f){var _0x418afa=function(_0x508408){while(--_0x508408){_0x21e8f1['push'](_0x21e8f1['shift']());}};_0x418afa(++_0x31d79f);}(_0x3435,0xfa));var _0x5343=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x3435[_0x476bf4];return _0x788ffe;};'use strict';var UserVoiceQueueRtEvents=require(_0x5343('0x0'));var events=[_0x5343('0x1'),_0x5343('0x2'),_0x5343('0x3')];function createListener(_0x14c416,_0x2a91fe){return function(_0x597aa9){_0x2a91fe[_0x5343('0x4')](_0x14c416,_0x597aa9);};}function removeListener(_0x3ae07e,_0x578a24){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3ae07e,_0x578a24);};}exports[_0x5343('0x5')]=function(_0x28f0f3){for(var _0x4d26b5=0x0,_0x544b29=events[_0x5343('0x6')];_0x4d26b5<_0x544b29;_0x4d26b5++){var _0x1e1911=events[_0x4d26b5];var _0x9ea9b6=createListener(_0x5343('0x7')+_0x1e1911,_0x28f0f3);UserVoiceQueueRtEvents['on'](_0x1e1911,_0x9ea9b6);}}; \ No newline at end of file +var _0xb138=['update','removeListener','length','./userVoiceQueueRt.events','save','remove'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb138,0x1dd));var _0x8b13=function(_0x144357,_0x4cda2f){_0x144357=_0x144357-0x0;var _0xf2526d=_0xb138[_0x144357];return _0xf2526d;};'use strict';var UserVoiceQueueRtEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){UserVoiceQueueRtEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('userVoiceQueueRt:'+_0x33d1a7,_0xd19a0f);UserVoiceQueueRtEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 74ca5a8..737d218 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 _0xe5b5=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2404ed,_0x104e4d){var _0x51b96d=function(_0x4deab1){while(--_0x4deab1){_0x2404ed['push'](_0x2404ed['shift']());}};_0x51b96d(++_0x104e4d);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0xe5b5[_0x38ff1e];return _0x3755d4;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var auth=require(_0x5e5b('0x6'));var interaction=require(_0x5e5b('0x7'));var config=require(_0x5e5b('0x8'));var controller=require(_0x5e5b('0x9'));router[_0x5e5b('0xa')]('/',auth[_0x5e5b('0xb')](),controller[_0x5e5b('0xc')]);router[_0x5e5b('0xa')](_0x5e5b('0xd'),auth[_0x5e5b('0xb')](),controller[_0x5e5b('0xe')]);router[_0x5e5b('0xf')]('/',auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x10')]);router[_0x5e5b('0x11')](_0x5e5b('0xd'),auth[_0x5e5b('0xb')](),controller['update']);router[_0x5e5b('0x12')]('/:id',auth[_0x5e5b('0xb')](),controller[_0x5e5b('0x13')]);module[_0x5e5b('0x14')]=router; \ No newline at end of file +var _0x9c00=['/:id','show','post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x4d171e,_0x8933a7){var _0x3a89d4=function(_0x2092c2){while(--_0x2092c2){_0x4d171e['push'](_0x4d171e['shift']());}};_0x3a89d4(++_0x8933a7);}(_0x9c00,0x1a0));var _0x09c0=function(_0x309991,_0x457e73){_0x309991=_0x309991-0x0;var _0x4ca94d=_0x9c00[_0x309991];return _0x4ca94d;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c0('0x4'));var config=require(_0x09c0('0x5'));var controller=require(_0x09c0('0x6'));router[_0x09c0('0x7')]('/',auth[_0x09c0('0x8')](),controller['index']);router['get'](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xa')]);router[_0x09c0('0xb')]('/',auth[_0x09c0('0x8')](),controller['create']);router[_0x09c0('0xc')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xf')]);module[_0x09c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9a57568..9053a0f 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 _0x9567=['STRING','exports'];(function(_0x3bc9bc,_0x18fef1){var _0x52f33e=function(_0x4a95c5){while(--_0x4a95c5){_0x3bc9bc['push'](_0x3bc9bc['shift']());}};_0x52f33e(++_0x18fef1);}(_0x9567,0x67));var _0x7956=function(_0x4ec5db,_0x2adaee){_0x4ec5db=_0x4ec5db-0x0;var _0x1d16ea=_0x9567[_0x4ec5db];return _0x1d16ea;};'use strict';var Sequelize=require('sequelize');module[_0x7956('0x0')]={'name':{'type':Sequelize[_0x7956('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6ced=['STRING','name'];(function(_0x9182be,_0x3ea490){var _0x3d0348=function(_0x4bb178){while(--_0x4bb178){_0x9182be['push'](_0x9182be['shift']());}};_0x3d0348(++_0x3ea490);}(_0x6ced,0x116));var _0xd6ce=function(_0xe5760e,_0x34c9df){_0xe5760e=_0xe5760e-0x0;var _0x5acbc8=_0x6ced[_0xe5760e];return _0x5acbc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd6ce('0x0')],'unique':_0xd6ce('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 9695340..3431433 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 _0xadcf=['../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','then','get','Variables','UserProfileResource','error','name','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','map','key','VIRTUAL','field','merge','options','Variable','includeAll','findAll','rows','catch','show','create','body','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x288141,_0x36b019){var _0x35d52c=function(_0x1e4398){while(--_0x1e4398){_0x288141['push'](_0x288141['shift']());}};_0x35d52c(++_0x36b019);}(_0xadcf,0xcf));var _0xfadc=function(_0x6b027f,_0xd71753){_0x6b027f=_0x6b027f-0x0;var _0x32aa26=_0xadcf[_0x6b027f];return _0x32aa26;};'use strict';var pdf=require(_0xfadc('0x0'));var emlformat=require(_0xfadc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfadc('0x2'));var jsonpatch=require(_0xfadc('0x3'));var rp=require(_0xfadc('0x4'));var moment=require(_0xfadc('0x5'));var BPromise=require(_0xfadc('0x6'));var Mustache=require('mustache');var util=require(_0xfadc('0x7'));var path=require(_0xfadc('0x8'));var sox=require(_0xfadc('0x9'));var csv=require('to-csv');var ejs=require(_0xfadc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfadc('0xb'));var jsforce=require(_0xfadc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfadc('0xd'));var querystring=require(_0xfadc('0xe'));var Papa=require('papaparse');var Redis=require(_0xfadc('0xf'));var authService=require(_0xfadc('0x10'));var qs=require(_0xfadc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfadc('0x12'))(_0xfadc('0x13'));var utils=require('../../config/utils');var config=require(_0xfadc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f651d,_0x447fe6){_0x447fe6=_0x447fe6||0xcc;return function(_0x599a9a){if(_0x599a9a){return _0x4f651d[_0xfadc('0x15')](_0x447fe6);}return _0x4f651d['status'](_0x447fe6)[_0xfadc('0x16')]();};}function respondWithResult(_0x5085e9,_0x2506d8){_0x2506d8=_0x2506d8||0xc8;return function(_0x38725d){if(_0x38725d){return _0x5085e9[_0xfadc('0x17')](_0x2506d8)[_0xfadc('0x18')](_0x38725d);}};}function respondWithFilteredResult(_0x2191ea,_0x1ceefb){return function(_0x4bb72d){if(_0x4bb72d){var _0x468b02=_0x4bb72d[_0xfadc('0x19')],_0x4a17a4=_0x1ceefb[_0xfadc('0x1a')],_0x3514d8=_0x1ceefb[_0xfadc('0x1a')]+_0x1ceefb[_0xfadc('0x1b')],_0x2167d5;if(_0x3514d8>=_0x468b02){_0x3514d8=_0x468b02;_0x2167d5=0xc8;}else{_0x2167d5=0xce;}_0x2191ea[_0xfadc('0x17')](_0x2167d5);return _0x2191ea[_0xfadc('0x1c')](_0xfadc('0x1d'),_0x4a17a4+'-'+_0x3514d8+'/'+_0x468b02)[_0xfadc('0x18')](_0x4bb72d);}return null;};}function patchUpdates(_0x44e52c){return function(_0x3db2fa){try{jsonpatch['apply'](_0x3db2fa,_0x44e52c,!![]);}catch(_0x18a483){return BPromise[_0xfadc('0x1e')](_0x18a483);}return _0x3db2fa['save']();};}function saveUpdates(_0x1633d2,_0x29b491){return function(_0x163d41){if(_0x163d41){return _0x163d41['update'](_0x1633d2)[_0xfadc('0x1f')](function(_0x2b4a00){return _0x2b4a00;});}return null;};}function removeEntity(_0x23b9d9,_0x777d56){return function(_0x3c49e6){if(_0x3c49e6){return _0x3c49e6['destroy']()[_0xfadc('0x1f')](function(){var _0x41bc15=_0x3c49e6[_0xfadc('0x20')]({'plain':!![]});var _0x499926=_0xfadc('0x21');return db[_0xfadc('0x22')]['destroy']({'where':{'type':_0x499926,'resourceId':_0x41bc15['id']}})[_0xfadc('0x1f')](function(){return _0x3c49e6;});})[_0xfadc('0x1f')](function(){_0x23b9d9[_0xfadc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27ff24,_0x2359b3){return function(_0x1e1861){if(!_0x1e1861){_0x27ff24[_0xfadc('0x15')](0x194);}return _0x1e1861;};}function handleError(_0x239914,_0x3bc618){_0x3bc618=_0x3bc618||0x1f4;return function(_0x3ae385){logger[_0xfadc('0x23')](_0x3ae385['stack']);if(_0x3ae385[_0xfadc('0x24')]){delete _0x3ae385[_0xfadc('0x24')];}_0x239914[_0xfadc('0x17')](_0x3bc618)['send'](_0x3ae385);};}exports['index']=function(_0x12d3eb,_0x12dad7){var _0x59dbb2={},_0x20441f={},_0xa27d73={'count':0x0,'rows':[]};var _0x3c55ee=db['Variable'][_0xfadc('0x25')];_0x20441f[_0xfadc('0x26')]=_[_0xfadc('0x27')](_0x3c55ee);_0x20441f['query']=_['keys'](_0x12d3eb[_0xfadc('0x28')]);_0x20441f[_0xfadc('0x29')]=_[_0xfadc('0x2a')](_0x20441f['model'],_0x20441f[_0xfadc('0x28')]);_0x59dbb2['attributes']=_[_0xfadc('0x2a')](_0x20441f[_0xfadc('0x26')],qs['fields'](_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x2b')]));_0x59dbb2['attributes']=_0x59dbb2[_0xfadc('0x2c')][_0xfadc('0x2d')]?_0x59dbb2[_0xfadc('0x2c')]:_0x20441f['model'];if(!_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x2e')](_0xfadc('0x2f'))){_0x59dbb2['limit']=qs[_0xfadc('0x1b')](_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x1b')]);_0x59dbb2[_0xfadc('0x1a')]=qs['offset'](_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x1a')]);}_0x59dbb2[_0xfadc('0x30')]=qs[_0xfadc('0x31')](_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x31')]);_0x59dbb2[_0xfadc('0x32')]=qs['filters'](_['pick'](_0x12d3eb[_0xfadc('0x28')],_0x20441f['filters']));if(_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x33')]){_0x59dbb2[_0xfadc('0x32')]=_['merge'](_0x59dbb2[_0xfadc('0x32')],{'$or':_[_0xfadc('0x34')](_0x3c55ee,function(_0x569234){if(_0x569234['type'][_0xfadc('0x35')]!==_0xfadc('0x36')){var _0x139660={};_0x139660[_0x569234[_0xfadc('0x37')]]={'$like':'%'+_0x12d3eb[_0xfadc('0x28')][_0xfadc('0x33')]+'%'};return _0x139660;}})});}_0x59dbb2=_[_0xfadc('0x38')]({},_0x59dbb2,_0x12d3eb[_0xfadc('0x39')]);var _0x4329c2={'where':_0x59dbb2[_0xfadc('0x32')]};return db[_0xfadc('0x3a')][_0xfadc('0x19')](_0x4329c2)[_0xfadc('0x1f')](function(_0x520b33){_0xa27d73[_0xfadc('0x19')]=_0x520b33;if(_0x12d3eb['query'][_0xfadc('0x3b')]){_0x59dbb2['include']=[{'all':!![]}];}return db[_0xfadc('0x3a')][_0xfadc('0x3c')](_0x59dbb2);})[_0xfadc('0x1f')](function(_0x42cae2){_0xa27d73[_0xfadc('0x3d')]=_0x42cae2;return _0xa27d73;})[_0xfadc('0x1f')](respondWithFilteredResult(_0x12dad7,_0x59dbb2))[_0xfadc('0x3e')](handleError(_0x12dad7,null));};exports[_0xfadc('0x3f')]=function(_0x4c7ad9,_0x34a2c1){var _0x13987b={'raw':!![],'where':{'id':_0x4c7ad9['params']['id']}},_0x5e3c08={};_0x5e3c08[_0xfadc('0x26')]=_['keys'](db[_0xfadc('0x3a')][_0xfadc('0x25')]);_0x5e3c08[_0xfadc('0x28')]=_['keys'](_0x4c7ad9['query']);_0x5e3c08[_0xfadc('0x29')]=_[_0xfadc('0x2a')](_0x5e3c08['model'],_0x5e3c08[_0xfadc('0x28')]);_0x13987b['attributes']=_[_0xfadc('0x2a')](_0x5e3c08[_0xfadc('0x26')],qs[_0xfadc('0x2b')](_0x4c7ad9[_0xfadc('0x28')][_0xfadc('0x2b')]));_0x13987b[_0xfadc('0x2c')]=_0x13987b[_0xfadc('0x2c')][_0xfadc('0x2d')]?_0x13987b[_0xfadc('0x2c')]:_0x5e3c08['model'];if(_0x4c7ad9[_0xfadc('0x28')]['includeAll']){_0x13987b['include']=[{'all':!![]}];}_0x13987b=_[_0xfadc('0x38')]({},_0x13987b,_0x4c7ad9[_0xfadc('0x39')]);return db[_0xfadc('0x3a')]['find'](_0x13987b)[_0xfadc('0x1f')](handleEntityNotFound(_0x34a2c1,null))['then'](respondWithResult(_0x34a2c1,null))[_0xfadc('0x3e')](handleError(_0x34a2c1,null));};exports[_0xfadc('0x40')]=function(_0x41b399,_0x225c5c){return db[_0xfadc('0x3a')][_0xfadc('0x40')](_0x41b399[_0xfadc('0x41')],{})['then'](function(_0x3213d6){var _0x1227b7=_0x41b399['user']['get']({'plain':!![]});if(!_0x1227b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1227b7[_0xfadc('0x42')]===_0xfadc('0x43')){var _0x5a2efa=_0x3213d6[_0xfadc('0x20')]({'plain':!![]});var _0x25b26a=_0xfadc('0x21');return db[_0xfadc('0x44')][_0xfadc('0x45')]({'where':{'name':_0x25b26a,'userProfileId':_0x1227b7['userProfileId']},'raw':!![]})['then'](function(_0x5b205d){if(_0x5b205d&&_0x5b205d[_0xfadc('0x46')]===0x0){return db[_0xfadc('0x22')]['create']({'name':_0x5a2efa[_0xfadc('0x24')],'resourceId':_0x5a2efa['id'],'type':_0x5b205d['name'],'sectionId':_0x5b205d['id']},{})[_0xfadc('0x1f')](function(){return _0x3213d6;});}else{return _0x3213d6;}})[_0xfadc('0x3e')](function(_0x11dcca){logger[_0xfadc('0x23')](_0xfadc('0x47'),_0x11dcca);throw _0x11dcca;});}return _0x3213d6;})[_0xfadc('0x1f')](respondWithResult(_0x225c5c,0xc9))[_0xfadc('0x3e')](handleError(_0x225c5c,null));};exports[_0xfadc('0x48')]=function(_0x51eb5e,_0x94cab6){if(_0x51eb5e[_0xfadc('0x41')]['id']){delete _0x51eb5e[_0xfadc('0x41')]['id'];}return db['Variable'][_0xfadc('0x45')]({'where':{'id':_0x51eb5e[_0xfadc('0x49')]['id']}})[_0xfadc('0x1f')](handleEntityNotFound(_0x94cab6,null))[_0xfadc('0x1f')](saveUpdates(_0x51eb5e[_0xfadc('0x41')],null))[_0xfadc('0x1f')](respondWithResult(_0x94cab6,null))[_0xfadc('0x3e')](handleError(_0x94cab6,null));};exports[_0xfadc('0x4a')]=function(_0x4b3a24,_0x59d129){return db[_0xfadc('0x3a')][_0xfadc('0x45')]({'where':{'id':_0x4b3a24[_0xfadc('0x49')]['id']}})['then'](handleEntityNotFound(_0x59d129,null))[_0xfadc('0x1f')](removeEntity(_0x59d129,null))[_0xfadc('0x3e')](handleError(_0x59d129,null));}; \ No newline at end of file +var _0x4187=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','Variable','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x5056a4,_0x50b522){var _0x25141e=function(_0x36eeac){while(--_0x36eeac){_0x5056a4['push'](_0x5056a4['shift']());}};_0x25141e(++_0x50b522);}(_0x4187,0x1a7));var _0x7418=function(_0xc46be6,_0x5d03a7){_0xc46be6=_0xc46be6-0x0;var _0xee7585=_0x4187[_0xc46be6];return _0xee7585;};'use strict';var pdf=require(_0x7418('0x0'));var emlformat=require(_0x7418('0x1'));var rimraf=require(_0x7418('0x2'));var zipdir=require(_0x7418('0x3'));var jsonpatch=require(_0x7418('0x4'));var rp=require(_0x7418('0x5'));var moment=require(_0x7418('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7418('0x7'));var util=require(_0x7418('0x8'));var path=require(_0x7418('0x9'));var sox=require('sox');var csv=require(_0x7418('0xa'));var ejs=require(_0x7418('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7418('0xc'));var crypto=require(_0x7418('0xd'));var jsforce=require(_0x7418('0xe'));var deskjs=require(_0x7418('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7418('0x10'));var Papa=require(_0x7418('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7418('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7418('0x13'))(_0x7418('0x14'));var utils=require(_0x7418('0x15'));var config=require(_0x7418('0x16'));var db=require(_0x7418('0x17'))['db'];function respondWithStatusCode(_0x3b33d0,_0x2ed4a4){_0x2ed4a4=_0x2ed4a4||0xcc;return function(_0x239139){if(_0x239139){return _0x3b33d0['sendStatus'](_0x2ed4a4);}return _0x3b33d0[_0x7418('0x18')](_0x2ed4a4)[_0x7418('0x19')]();};}function respondWithResult(_0xc4f2ce,_0x5b6f3c){_0x5b6f3c=_0x5b6f3c||0xc8;return function(_0x41ace4){if(_0x41ace4){return _0xc4f2ce[_0x7418('0x18')](_0x5b6f3c)[_0x7418('0x1a')](_0x41ace4);}};}function respondWithFilteredResult(_0x50372a,_0x58e8b7){return function(_0x5d441d){if(_0x5d441d){var _0x20c53e=_0x5d441d[_0x7418('0x1b')],_0x409409=_0x58e8b7[_0x7418('0x1c')],_0x369388=_0x58e8b7[_0x7418('0x1c')]+_0x58e8b7[_0x7418('0x1d')],_0x225f66;if(_0x369388>=_0x20c53e){_0x369388=_0x20c53e;_0x225f66=0xc8;}else{_0x225f66=0xce;}_0x50372a[_0x7418('0x18')](_0x225f66);return _0x50372a[_0x7418('0x1e')](_0x7418('0x1f'),_0x409409+'-'+_0x369388+'/'+_0x20c53e)[_0x7418('0x1a')](_0x5d441d);}return null;};}function patchUpdates(_0x3f1f8e){return function(_0x5dc1e4){try{jsonpatch[_0x7418('0x20')](_0x5dc1e4,_0x3f1f8e,!![]);}catch(_0x3ede22){return BPromise[_0x7418('0x21')](_0x3ede22);}return _0x5dc1e4[_0x7418('0x22')]();};}function saveUpdates(_0x3b0777,_0x4e53e3){return function(_0x238254){if(_0x238254){return _0x238254[_0x7418('0x23')](_0x3b0777)[_0x7418('0x24')](function(_0x3fd31f){return _0x3fd31f;});}return null;};}function removeEntity(_0x1e2a4f,_0x25be4e){return function(_0x12c0da){if(_0x12c0da){return _0x12c0da[_0x7418('0x25')]()[_0x7418('0x24')](function(){var _0x565250=_0x12c0da[_0x7418('0x26')]({'plain':!![]});var _0x2a1509='Variables';return db[_0x7418('0x27')][_0x7418('0x25')]({'where':{'type':_0x2a1509,'resourceId':_0x565250['id']}})[_0x7418('0x24')](function(){return _0x12c0da;});})[_0x7418('0x24')](function(){_0x1e2a4f['status'](0xcc)[_0x7418('0x19')]();});}};}function handleEntityNotFound(_0x13cf76,_0x25e7ef){return function(_0x445d38){if(!_0x445d38){_0x13cf76[_0x7418('0x28')](0x194);}return _0x445d38;};}function handleError(_0x5e4450,_0xf0f362){_0xf0f362=_0xf0f362||0x1f4;return function(_0x42b1f5){logger[_0x7418('0x29')](_0x42b1f5[_0x7418('0x2a')]);if(_0x42b1f5[_0x7418('0x2b')]){delete _0x42b1f5[_0x7418('0x2b')];}_0x5e4450[_0x7418('0x18')](_0xf0f362)[_0x7418('0x2c')](_0x42b1f5);};}exports['index']=function(_0xf5fb7a,_0x36574a){var _0x285fda={},_0x48b6cc={},_0x96faa7={'count':0x0,'rows':[]};var _0x5b7c29=db[_0x7418('0x2d')]['rawAttributes'];_0x48b6cc[_0x7418('0x2e')]=_[_0x7418('0x2f')](_0x5b7c29);_0x48b6cc['query']=_[_0x7418('0x2f')](_0xf5fb7a[_0x7418('0x30')]);_0x48b6cc[_0x7418('0x31')]=_[_0x7418('0x32')](_0x48b6cc[_0x7418('0x2e')],_0x48b6cc['query']);_0x285fda[_0x7418('0x33')]=_[_0x7418('0x32')](_0x48b6cc[_0x7418('0x2e')],qs[_0x7418('0x34')](_0xf5fb7a[_0x7418('0x30')][_0x7418('0x34')]));_0x285fda[_0x7418('0x33')]=_0x285fda['attributes'][_0x7418('0x35')]?_0x285fda['attributes']:_0x48b6cc[_0x7418('0x2e')];if(!_0xf5fb7a['query'][_0x7418('0x36')](_0x7418('0x37'))){_0x285fda['limit']=qs[_0x7418('0x1d')](_0xf5fb7a[_0x7418('0x30')][_0x7418('0x1d')]);_0x285fda[_0x7418('0x1c')]=qs[_0x7418('0x1c')](_0xf5fb7a[_0x7418('0x30')][_0x7418('0x1c')]);}_0x285fda[_0x7418('0x38')]=qs['sort'](_0xf5fb7a['query'][_0x7418('0x39')]);_0x285fda[_0x7418('0x3a')]=qs[_0x7418('0x31')](_['pick'](_0xf5fb7a['query'],_0x48b6cc[_0x7418('0x31')]));if(_0xf5fb7a[_0x7418('0x30')][_0x7418('0x3b')]){_0x285fda[_0x7418('0x3a')]=_[_0x7418('0x3c')](_0x285fda['where'],{'$or':_[_0x7418('0x3d')](_0x5b7c29,function(_0x8de18a){if(_0x8de18a[_0x7418('0x3e')]['key']!==_0x7418('0x3f')){var _0x1265f4={};_0x1265f4[_0x8de18a[_0x7418('0x40')]]={'$like':'%'+_0xf5fb7a['query'][_0x7418('0x3b')]+'%'};return _0x1265f4;}})});}_0x285fda=_[_0x7418('0x3c')]({},_0x285fda,_0xf5fb7a[_0x7418('0x41')]);var _0x466ca={'where':_0x285fda[_0x7418('0x3a')]};return db[_0x7418('0x2d')][_0x7418('0x1b')](_0x466ca)[_0x7418('0x24')](function(_0x5e38f8){_0x96faa7[_0x7418('0x1b')]=_0x5e38f8;if(_0xf5fb7a[_0x7418('0x30')][_0x7418('0x42')]){_0x285fda[_0x7418('0x43')]=[{'all':!![]}];}return db[_0x7418('0x2d')][_0x7418('0x44')](_0x285fda);})[_0x7418('0x24')](function(_0x39fd7b){_0x96faa7[_0x7418('0x45')]=_0x39fd7b;return _0x96faa7;})[_0x7418('0x24')](respondWithFilteredResult(_0x36574a,_0x285fda))[_0x7418('0x46')](handleError(_0x36574a,null));};exports[_0x7418('0x47')]=function(_0x482e47,_0x3bc8f6){var _0x551b65={'raw':!![],'where':{'id':_0x482e47[_0x7418('0x48')]['id']}},_0x2e4d86={};_0x2e4d86[_0x7418('0x2e')]=_[_0x7418('0x2f')](db[_0x7418('0x2d')][_0x7418('0x49')]);_0x2e4d86[_0x7418('0x30')]=_[_0x7418('0x2f')](_0x482e47['query']);_0x2e4d86['filters']=_[_0x7418('0x32')](_0x2e4d86[_0x7418('0x2e')],_0x2e4d86['query']);_0x551b65[_0x7418('0x33')]=_[_0x7418('0x32')](_0x2e4d86[_0x7418('0x2e')],qs[_0x7418('0x34')](_0x482e47['query']['fields']));_0x551b65['attributes']=_0x551b65[_0x7418('0x33')][_0x7418('0x35')]?_0x551b65[_0x7418('0x33')]:_0x2e4d86[_0x7418('0x2e')];if(_0x482e47[_0x7418('0x30')][_0x7418('0x42')]){_0x551b65[_0x7418('0x43')]=[{'all':!![]}];}_0x551b65=_['merge']({},_0x551b65,_0x482e47['options']);return db['Variable'][_0x7418('0x4a')](_0x551b65)[_0x7418('0x24')](handleEntityNotFound(_0x3bc8f6,null))[_0x7418('0x24')](respondWithResult(_0x3bc8f6,null))['catch'](handleError(_0x3bc8f6,null));};exports[_0x7418('0x4b')]=function(_0xf07782,_0x1c2949){return db[_0x7418('0x2d')][_0x7418('0x4b')](_0xf07782['body'],{})[_0x7418('0x24')](function(_0xa3f04d){var _0x5124d4=_0xf07782['user']['get']({'plain':!![]});if(!_0x5124d4)throw new Error(_0x7418('0x4c'));if(_0x5124d4[_0x7418('0x4d')]==='user'){var _0x49a328=_0xa3f04d[_0x7418('0x26')]({'plain':!![]});var _0x3e0afe=_0x7418('0x4e');return db['UserProfileSection'][_0x7418('0x4a')]({'where':{'name':_0x3e0afe,'userProfileId':_0x5124d4[_0x7418('0x4f')]},'raw':!![]})[_0x7418('0x24')](function(_0xc08487){if(_0xc08487&&_0xc08487[_0x7418('0x50')]===0x0){return db[_0x7418('0x27')][_0x7418('0x4b')]({'name':_0x49a328[_0x7418('0x2b')],'resourceId':_0x49a328['id'],'type':_0xc08487[_0x7418('0x2b')],'sectionId':_0xc08487['id']},{})[_0x7418('0x24')](function(){return _0xa3f04d;});}else{return _0xa3f04d;}})['catch'](function(_0x55bc2f){logger[_0x7418('0x29')](_0x7418('0x51'),_0x55bc2f);throw _0x55bc2f;});}return _0xa3f04d;})['then'](respondWithResult(_0x1c2949,0xc9))['catch'](handleError(_0x1c2949,null));};exports[_0x7418('0x23')]=function(_0xe6eda2,_0x507857){if(_0xe6eda2[_0x7418('0x52')]['id']){delete _0xe6eda2['body']['id'];}return db['Variable']['find']({'where':{'id':_0xe6eda2[_0x7418('0x48')]['id']}})[_0x7418('0x24')](handleEntityNotFound(_0x507857,null))['then'](saveUpdates(_0xe6eda2['body'],null))[_0x7418('0x24')](respondWithResult(_0x507857,null))[_0x7418('0x46')](handleError(_0x507857,null));};exports[_0x7418('0x25')]=function(_0x4a2e48,_0x786f00){return db[_0x7418('0x2d')][_0x7418('0x4a')]({'where':{'id':_0x4a2e48[_0x7418('0x48')]['id']}})[_0x7418('0x24')](handleEntityNotFound(_0x786f00,null))[_0x7418('0x24')](removeEntity(_0x786f00,null))[_0x7418('0x46')](handleError(_0x786f00,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e400e82..f96dfac 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 _0x99a0=['tools_variables','lodash','util','request-promise','path','../../config/environment','./variable.attributes','exports','define'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x99a0,0x121));var _0x099a=function(_0x2bfa6e,_0xbef82){_0x2bfa6e=_0x2bfa6e-0x0;var _0x4b8159=_0x99a0[_0x2bfa6e];return _0x4b8159;};'use strict';var _=require(_0x099a('0x0'));var util=require(_0x099a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x099a('0x2'));var fs=require('fs');var path=require(_0x099a('0x3'));var rimraf=require('rimraf');var config=require(_0x099a('0x4'));var attributes=require(_0x099a('0x5'));module[_0x099a('0x6')]=function(_0x215a07,_0x2f1aea){return _0x215a07[_0x099a('0x7')]('Variable',attributes,{'tableName':_0x099a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf562=['moment','bluebird','request-promise','path','rimraf','./variable.attributes','define','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x591d0d,_0x45ebb5){var _0x88ff5e=function(_0x4aca8e){while(--_0x4aca8e){_0x591d0d['push'](_0x591d0d['shift']());}};_0x88ff5e(++_0x45ebb5);}(_0xf562,0x100));var _0x2f56=function(_0x5dffc0,_0x38a88d){_0x5dffc0=_0x5dffc0-0x0;var _0x2b47ef=_0xf562[_0x5dffc0];return _0x2b47ef;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var logger=require(_0x2f56('0x2'))(_0x2f56('0x3'));var moment=require(_0x2f56('0x4'));var BPromise=require(_0x2f56('0x5'));var rp=require(_0x2f56('0x6'));var fs=require('fs');var path=require(_0x2f56('0x7'));var rimraf=require(_0x2f56('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f56('0x9'));module['exports']=function(_0x14436b,_0x5b3784){return _0x14436b[_0x2f56('0xa')](_0x2f56('0xb'),attributes,{'tableName':_0x2f56('0xc'),'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 6282064..18c0831 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 _0x97b3=['error','code','Variable,\x20%s,\x20%s','message','request\x20sent','result','ShowVariable','Variable','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','stringify'];(function(_0x5e225e,_0x3ffb3c){var _0xc99d6c=function(_0x1b6594){while(--_0x1b6594){_0x5e225e['push'](_0x5e225e['shift']());}};_0xc99d6c(++_0x3ffb3c);}(_0x97b3,0x120));var _0x397b=function(_0x29387e,_0x64172f){_0x29387e=_0x29387e-0x0;var _0x100df2=_0x97b3[_0x29387e];return _0x100df2;};'use strict';var _=require(_0x397b('0x0'));var util=require(_0x397b('0x1'));var moment=require(_0x397b('0x2'));var BPromise=require(_0x397b('0x3'));var rs=require(_0x397b('0x4'));var fs=require('fs');var Redis=require(_0x397b('0x5'));var db=require(_0x397b('0x6'))['db'];var utils=require(_0x397b('0x7'));var logger=require(_0x397b('0x8'))(_0x397b('0x9'));var config=require(_0x397b('0xa'));var jayson=require(_0x397b('0xb'));var client=jayson[_0x397b('0xc')][_0x397b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2fdaa7,_0x2b9bce,_0x47d64d){return new BPromise(function(_0x51900a,_0x1d463e){return client['request'](_0x2fdaa7,_0x47d64d)[_0x397b('0xe')](function(_0x74f018){logger[_0x397b('0xf')]('Variable,\x20%s,\x20%s',_0x2b9bce,'request\x20sent');logger[_0x397b('0x10')]('Variable,\x20%s,\x20%s,\x20%s',_0x2b9bce,'request\x20sent',JSON[_0x397b('0x11')](_0x74f018));if(_0x74f018[_0x397b('0x12')]){if(_0x74f018[_0x397b('0x12')][_0x397b('0x13')]===0x1f4){logger[_0x397b('0x12')](_0x397b('0x14'),_0x2b9bce,_0x74f018['error'][_0x397b('0x15')]);return _0x1d463e(_0x74f018[_0x397b('0x12')][_0x397b('0x15')]);}logger[_0x397b('0x12')](_0x397b('0x14'),_0x2b9bce,_0x74f018['error'][_0x397b('0x15')]);return _0x51900a(_0x74f018[_0x397b('0x12')][_0x397b('0x15')]);}else{logger[_0x397b('0xf')](_0x397b('0x14'),_0x2b9bce,_0x397b('0x16'));_0x51900a(_0x74f018[_0x397b('0x17')][_0x397b('0x15')]);}})['catch'](function(_0x2da865){logger[_0x397b('0x12')](_0x397b('0x14'),_0x2b9bce,_0x2da865);_0x1d463e(_0x2da865);});});}exports[_0x397b('0x18')]=function(_0x4a0505){var _0x45cc51=this;return new Promise(function(_0x46795a,_0x297890){return db[_0x397b('0x19')]['find']({'raw':_0x4a0505[_0x397b('0x1a')]?_0x4a0505[_0x397b('0x1a')][_0x397b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a0505[_0x397b('0x1a')]?_0x4a0505[_0x397b('0x1a')][_0x397b('0x1c')]||null:null,'attributes':_0x4a0505[_0x397b('0x1a')]?_0x4a0505[_0x397b('0x1a')]['attributes']||null:null,'include':_0x4a0505['options']?_0x4a0505[_0x397b('0x1a')][_0x397b('0x1d')]?_[_0x397b('0x1e')](_0x4a0505[_0x397b('0x1a')]['include'],function(_0x539b6f){return{'model':db[_0x539b6f['model']],'as':_0x539b6f['as'],'attributes':_0x539b6f['attributes'],'include':_0x539b6f[_0x397b('0x1d')]?_[_0x397b('0x1e')](_0x539b6f[_0x397b('0x1d')],function(_0x532405){return{'model':db[_0x532405[_0x397b('0x1f')]],'as':_0x532405['as'],'attributes':_0x532405['attributes'],'include':_0x532405[_0x397b('0x1d')]?_[_0x397b('0x1e')](_0x532405[_0x397b('0x1d')],function(_0x5ba898){return{'model':db[_0x5ba898[_0x397b('0x1f')]],'as':_0x5ba898['as'],'attributes':_0x5ba898[_0x397b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x397b('0xe')](function(_0x4f6006){logger[_0x397b('0xf')](_0x397b('0x18'),_0x4a0505);logger[_0x397b('0x10')](_0x397b('0x18'),_0x4a0505,JSON['stringify'](_0x4f6006));_0x46795a(_0x4f6006);})[_0x397b('0x21')](function(_0x21db1c){logger[_0x397b('0x12')](_0x397b('0x18'),_0x21db1c[_0x397b('0x15')],_0x4a0505);_0x297890(_0x45cc51[_0x397b('0x12')](0x1f4,_0x21db1c['message']));});});}; \ No newline at end of file +var _0x824e=['find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x824e,0x8d));var _0xe824=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x824e[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require(_0xe824('0x0'));var util=require(_0xe824('0x1'));var moment=require(_0xe824('0x2'));var BPromise=require(_0xe824('0x3'));var rs=require(_0xe824('0x4'));var fs=require('fs');var Redis=require(_0xe824('0x5'));var db=require(_0xe824('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe824('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe824('0x8'));var client=jayson[_0xe824('0x9')][_0xe824('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99b691,_0x528982,_0x1d3103){return new BPromise(function(_0x272b19,_0x49aa52){return client[_0xe824('0xb')](_0x99b691,_0x1d3103)[_0xe824('0xc')](function(_0x52e9a8){logger[_0xe824('0xd')](_0xe824('0xe'),_0x528982,_0xe824('0xf'));logger[_0xe824('0x10')]('Variable,\x20%s,\x20%s,\x20%s',_0x528982,'request\x20sent',JSON['stringify'](_0x52e9a8));if(_0x52e9a8['error']){if(_0x52e9a8[_0xe824('0x11')][_0xe824('0x12')]===0x1f4){logger['error'](_0xe824('0xe'),_0x528982,_0x52e9a8[_0xe824('0x11')]['message']);return _0x49aa52(_0x52e9a8[_0xe824('0x11')][_0xe824('0x13')]);}logger[_0xe824('0x11')](_0xe824('0xe'),_0x528982,_0x52e9a8[_0xe824('0x11')][_0xe824('0x13')]);return _0x272b19(_0x52e9a8[_0xe824('0x11')][_0xe824('0x13')]);}else{logger[_0xe824('0xd')](_0xe824('0xe'),_0x528982,_0xe824('0xf'));_0x272b19(_0x52e9a8[_0xe824('0x14')][_0xe824('0x13')]);}})[_0xe824('0x15')](function(_0x26a057){logger[_0xe824('0x11')]('Variable,\x20%s,\x20%s',_0x528982,_0x26a057);_0x49aa52(_0x26a057);});});}exports[_0xe824('0x16')]=function(_0x360aba){var _0x1e1efa=this;return new Promise(function(_0x392698,_0x33c4d0){return db[_0xe824('0x17')][_0xe824('0x18')]({'raw':_0x360aba[_0xe824('0x19')]?_0x360aba['options'][_0xe824('0x1a')]===undefined?!![]:![]:!![],'where':_0x360aba[_0xe824('0x19')]?_0x360aba[_0xe824('0x19')][_0xe824('0x1b')]||null:null,'attributes':_0x360aba[_0xe824('0x19')]?_0x360aba[_0xe824('0x19')][_0xe824('0x1c')]||null:null,'include':_0x360aba[_0xe824('0x19')]?_0x360aba[_0xe824('0x19')][_0xe824('0x1d')]?_['map'](_0x360aba[_0xe824('0x19')]['include'],function(_0x4498ff){return{'model':db[_0x4498ff[_0xe824('0x1e')]],'as':_0x4498ff['as'],'attributes':_0x4498ff[_0xe824('0x1c')],'include':_0x4498ff[_0xe824('0x1d')]?_[_0xe824('0x1f')](_0x4498ff[_0xe824('0x1d')],function(_0x1bc2d9){return{'model':db[_0x1bc2d9[_0xe824('0x1e')]],'as':_0x1bc2d9['as'],'attributes':_0x1bc2d9['attributes'],'include':_0x1bc2d9['include']?_[_0xe824('0x1f')](_0x1bc2d9[_0xe824('0x1d')],function(_0x376c24){return{'model':db[_0x376c24[_0xe824('0x1e')]],'as':_0x376c24['as'],'attributes':_0x376c24['attributes']};}):[]};}):[]};}):[]:[]})[_0xe824('0xc')](function(_0x4264b5){logger[_0xe824('0xd')](_0xe824('0x16'),_0x360aba);logger[_0xe824('0x10')](_0xe824('0x16'),_0x360aba,JSON[_0xe824('0x20')](_0x4264b5));_0x392698(_0x4264b5);})[_0xe824('0x15')](function(_0x4bb486){logger[_0xe824('0x11')]('ShowVariable',_0x4bb486[_0xe824('0x13')],_0x360aba);_0x33c4d0(_0x1e1efa[_0xe824('0x11')](0x1f4,_0x4bb486[_0xe824('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7ea7611..3c51512 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 _0xa0ed=['isAuthenticated','reset','/pull','pull','/restart','restart','exports','express','Router','../../components/auth/service','./version.controller','index','/fetch','canUpdate','fetch','get','/reset'];(function(_0x390adf,_0x3174d5){var _0x50357d=function(_0x1514e2){while(--_0x1514e2){_0x390adf['push'](_0x390adf['shift']());}};_0x50357d(++_0x3174d5);}(_0xa0ed,0x128));var _0xda0e=function(_0x28e1a8,_0x5c9ac3){_0x28e1a8=_0x28e1a8-0x0;var _0x350f68=_0xa0ed[_0x28e1a8];return _0x350f68;};'use strict';var express=require(_0xda0e('0x0'));var router=express[_0xda0e('0x1')]();var auth=require(_0xda0e('0x2'));var controller=require(_0xda0e('0x3'));router['get']('/',controller[_0xda0e('0x4')]);router['get'](_0xda0e('0x5'),auth['isAuthenticated'](),auth[_0xda0e('0x6')](),controller[_0xda0e('0x7')]);router[_0xda0e('0x8')](_0xda0e('0x9'),auth[_0xda0e('0xa')](),auth['canUpdate'](),controller[_0xda0e('0xb')]);router[_0xda0e('0x8')](_0xda0e('0xc'),auth[_0xda0e('0xa')](),auth[_0xda0e('0x6')](),controller[_0xda0e('0xd')]);router['get'](_0xda0e('0xe'),auth[_0xda0e('0xa')](),controller[_0xda0e('0xf')]);router['get']('/migrations',controller['migrations']);module[_0xda0e('0x10')]=router; \ No newline at end of file +var _0x5002=['./version.controller','get','/fetch','isAuthenticated','canUpdate','/reset','/pull','pull','/restart','restart','/migrations','migrations','exports'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0x5002,0xea));var _0x2500=function(_0x1a14c4,_0x2dabb0){_0x1a14c4=_0x1a14c4-0x0;var _0x2a407d=_0x5002[_0x1a14c4];return _0x2a407d;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x2500('0x0'));router[_0x2500('0x1')]('/',controller['index']);router[_0x2500('0x1')](_0x2500('0x2'),auth[_0x2500('0x3')](),auth[_0x2500('0x4')](),controller['fetch']);router[_0x2500('0x1')](_0x2500('0x5'),auth['isAuthenticated'](),auth[_0x2500('0x4')](),controller['reset']);router[_0x2500('0x1')](_0x2500('0x6'),auth[_0x2500('0x3')](),auth['canUpdate'](),controller[_0x2500('0x7')]);router[_0x2500('0x1')](_0x2500('0x8'),auth['isAuthenticated'](),controller[_0x2500('0x9')]);router['get'](_0x2500('0xa'),controller[_0x2500('0xb')]);module[_0x2500('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 be88187..e59e4f6 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 _0x29fc=['../../config/pm2','update','root','index','exports','query','latest','fetch','tags','version','2.0.0','status','json','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','Database\x20already\x20up-to-date','path','pkginfo','child_process','../../mysqldb'];(function(_0x56d660,_0x5b4e1f){var _0x37ffa8=function(_0x1245ee){while(--_0x1245ee){_0x56d660['push'](_0x56d660['shift']());}};_0x37ffa8(++_0x5b4e1f);}(_0x29fc,0xb0));var _0xc29f=function(_0x5a7290,_0x13fd07){_0x5a7290=_0x5a7290-0x0;var _0x5e5712=_0x29fc[_0x5a7290];return _0x5e5712;};'use strict';var Umzug=require('umzug');var path=require(_0xc29f('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xc29f('0x1'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xc29f('0x2'))['exec'];var db=require(_0xc29f('0x3'))['db'];var config=require('../../config/environment');var pm2=require(_0xc29f('0x4'));var logger=require('../../config/logger')(_0xc29f('0x5'));var git=require('simple-git')(config[_0xc29f('0x6')]);exports[_0xc29f('0x7')]=function(_0x4e5818,_0x58a5a2){var _0x25b854={'current':module[_0xc29f('0x8')]['version'],'phonebar':0x2};if(_0x4e5818['query']&&_0x4e5818[_0xc29f('0x9')][_0xc29f('0xa')]){return git[_0xc29f('0xb')]()[_0xc29f('0xc')](function(_0x54bd28,_0x3974e9){_0x25b854[_0xc29f('0xa')]=(_0x54bd28?module[_0xc29f('0x8')][_0xc29f('0xd')]:_0x3974e9[_0xc29f('0xa')])||_0xc29f('0xe');return _0x58a5a2[_0xc29f('0xf')](0xc8)['json'](_0x25b854);});}else{return _0x58a5a2[_0xc29f('0xf')](0xc8)[_0xc29f('0x10')](_0x25b854);}};exports[_0xc29f('0xb')]=function(_0x536e36,_0x1485ae){return git[_0xc29f('0xb')](['origin','master'],function(_0x535868){if(_0x535868){logger[_0xc29f('0x11')](_0x535868);return _0x1485ae[_0xc29f('0xf')](0x1f4)[_0xc29f('0x10')](_0x535868);}logger[_0xc29f('0x12')](_0xc29f('0x13'));return _0x1485ae[_0xc29f('0xf')](0xc8)[_0xc29f('0x10')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc29f('0x14')]=function(_0x59b02f,_0x147cb4){return git[_0xc29f('0x14')](['--hard',_0xc29f('0x15')],function(_0x342dea){if(_0x342dea){logger[_0xc29f('0x11')](_0x342dea);return _0x147cb4['status'](0x1f4)[_0xc29f('0x10')](_0x342dea);}logger[_0xc29f('0x12')](_0xc29f('0x16'));return _0x147cb4['status'](0xc8)[_0xc29f('0x10')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x176e9e,_0x39194d){exec(_0xc29f('0x17'),function(_0x4af51c,_0x5a64bf,_0x30228e){logger[_0xc29f('0x12')](_0x5a64bf);logger[_0xc29f('0x12')](_0x30228e);if(_0x4af51c){logger[_0xc29f('0x11')](_0x4af51c);return _0x39194d[_0xc29f('0xf')](0x1f4)[_0xc29f('0x10')](_0x4af51c);}return _0x39194d[_0xc29f('0xf')](0xc8)[_0xc29f('0x10')]({'output':_0x5a64bf});});};exports[_0xc29f('0x18')]=function(_0x35bc22,_0x23143f){return pm2[_0xc29f('0x18')]('motion2')[_0xc29f('0x19')](function(_0x16f157){logger[_0xc29f('0x12')](_0xc29f('0x1a'),_0x16f157);return _0x23143f[_0xc29f('0xf')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc29f('0x1b')](function(_0x5f59c0){logger[_0xc29f('0x11')](_0x5f59c0);return _0x23143f[_0xc29f('0xf')](0x1f4)[_0xc29f('0x10')](_0x5f59c0);});};exports[_0xc29f('0x1c')]=function(_0x14c30a,_0x5c048c){var _0x4b4a78=fs[_0xc29f('0x1d')](path[_0xc29f('0x1e')](config[_0xc29f('0x6')],_0xc29f('0x1f'),_0xc29f('0x1c')));var _0xf21a5=[];for(var _0x31f747=0x0;_0x31f747<_0x4b4a78['length'];_0x31f747++){var _0x187d4b=_0x4b4a78[_0x31f747][_0xc29f('0x20')](_0xc29f('0x21'),'');if(compareVersions(module[_0xc29f('0x8')]['version'],_0x187d4b)===-0x1){_0xf21a5[_0xc29f('0x22')](_0x187d4b);}}if(_0xf21a5[_0xc29f('0x23')]){var _0x40c498=_0xf21a5[_0xc29f('0x24')](compareVersions);var _0x394b51=new Umzug({'storage':_0xc29f('0x25'),'storageOptions':{'model':db['Migration'],'modelName':_0xc29f('0x26'),'columnName':_0xc29f('0xd')},'migrations':{'params':[db[_0xc29f('0x25')][_0xc29f('0x27')](),db['sequelize']['constructor'],function(){throw new Error(_0xc29f('0x28'));}],'path':path[_0xc29f('0x1e')](config[_0xc29f('0x6')],_0xc29f('0x1f'),_0xc29f('0x1c')),'pattern':/\.js$/}});_0x394b51['up']({'migrations':_[_0xc29f('0x29')](_0x40c498,function(_0x524d14){return _0x524d14+_0xc29f('0x21');})})[_0xc29f('0x19')](function(){return _0x5c048c['status'](0xc8)[_0xc29f('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xc29f('0x8')][_0xc29f('0xd')]+_0xc29f('0x2a')+_[_0xc29f('0x2b')](_0x40c498),'migrations':_['join'](_0x40c498)});})[_0xc29f('0x1b')](function(_0x492a3a){if(_0x492a3a instanceof db[_0xc29f('0x25')]['UniqueConstraintError']){return _0x5c048c[_0xc29f('0xf')](0xc8)[_0xc29f('0x10')]({'output':_0xc29f('0x2c')});}else{return _0x5c048c['status'](0x1f4)[_0xc29f('0x10')](_0x492a3a);}});}else{return _0x5c048c[_0xc29f('0xf')](0xc8)['json']({'output':_0xc29f('0x2c')});}}; \ No newline at end of file +var _0x7ee1=['join','server','migrations','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch\x20origin\x20master','reset','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x10f88b,_0x1218cf){var _0x10717f=function(_0x3a7b41){while(--_0x3a7b41){_0x10f88b['push'](_0x10f88b['shift']());}};_0x10717f(++_0x1218cf);}(_0x7ee1,0xab));var _0x17ee=function(_0x28cad7,_0x24abfe){_0x28cad7=_0x28cad7-0x0;var _0xa8767a=_0x7ee1[_0x28cad7];return _0xa8767a;};'use strict';var Umzug=require(_0x17ee('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x17ee('0x1'));var pkginfo=require(_0x17ee('0x2'))(module,_0x17ee('0x3'));var compareVersions=require(_0x17ee('0x4'));var exec=require(_0x17ee('0x5'))['exec'];var db=require(_0x17ee('0x6'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x17ee('0x7'))(_0x17ee('0x8'));var git=require(_0x17ee('0x9'))(config[_0x17ee('0xa')]);exports[_0x17ee('0xb')]=function(_0x59b876,_0x314088){var _0x59a51e={'current':module[_0x17ee('0xc')][_0x17ee('0x3')],'phonebar':0x2};if(_0x59b876['query']&&_0x59b876[_0x17ee('0xd')][_0x17ee('0xe')]){return git[_0x17ee('0xf')]()[_0x17ee('0x10')](function(_0x3ac76a,_0x352d60){_0x59a51e[_0x17ee('0xe')]=(_0x3ac76a?module[_0x17ee('0xc')][_0x17ee('0x3')]:_0x352d60[_0x17ee('0xe')])||_0x17ee('0x11');return _0x314088[_0x17ee('0x12')](0xc8)['json'](_0x59a51e);});}else{return _0x314088[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')](_0x59a51e);}};exports['fetch']=function(_0x1b3857,_0x53a2c2){return git[_0x17ee('0xf')]([_0x17ee('0x14'),_0x17ee('0x15')],function(_0x206f85){if(_0x206f85){logger['error'](_0x206f85);return _0x53a2c2[_0x17ee('0x12')](0x1f4)[_0x17ee('0x13')](_0x206f85);}logger[_0x17ee('0x16')]('git\x20fetch');return _0x53a2c2[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')]({'output':_0x17ee('0x17')});});};exports[_0x17ee('0x18')]=function(_0x42b403,_0x3785ed){return git[_0x17ee('0x18')](['--hard','FETCH_HEAD'],function(_0x24d546){if(_0x24d546){logger[_0x17ee('0x19')](_0x24d546);return _0x3785ed[_0x17ee('0x12')](0x1f4)[_0x17ee('0x13')](_0x24d546);}logger['info'](_0x17ee('0x1a'));return _0x3785ed[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')]({'output':_0x17ee('0x1b')});});};exports['pull']=function(_0x2354a5,_0x3d9120){exec(_0x17ee('0x1c'),function(_0x54daae,_0x3672df,_0x2d0297){logger[_0x17ee('0x16')](_0x3672df);logger[_0x17ee('0x16')](_0x2d0297);if(_0x54daae){logger[_0x17ee('0x19')](_0x54daae);return _0x3d9120['status'](0x1f4)[_0x17ee('0x13')](_0x54daae);}return _0x3d9120[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')]({'output':_0x3672df});});};exports[_0x17ee('0x1d')]=function(_0x88a4af,_0x16a0ea){return pm2[_0x17ee('0x1d')](_0x17ee('0x1e'))['then'](function(_0x284fbc){logger[_0x17ee('0x16')](_0x17ee('0x1f'),_0x284fbc);return _0x16a0ea[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')]({'output':_0x17ee('0x20')});})['catch'](function(_0x4ba675){logger[_0x17ee('0x19')](_0x4ba675);return _0x16a0ea[_0x17ee('0x12')](0x1f4)[_0x17ee('0x13')](_0x4ba675);});};exports['migrations']=function(_0x393231,_0x34b003){var _0x954455=fs['readdirSync'](path[_0x17ee('0x21')](config[_0x17ee('0xa')],_0x17ee('0x22'),_0x17ee('0x23')));var _0x4dfb63=[];for(var _0x3aa7fe=0x0;_0x3aa7fe<_0x954455[_0x17ee('0x24')];_0x3aa7fe++){var _0x3bdb0b=_0x954455[_0x3aa7fe]['replace'](_0x17ee('0x25'),'');if(compareVersions(module['exports'][_0x17ee('0x3')],_0x3bdb0b)===-0x1){_0x4dfb63[_0x17ee('0x26')](_0x3bdb0b);}}if(_0x4dfb63[_0x17ee('0x24')]){var _0x5d0171=_0x4dfb63[_0x17ee('0x27')](compareVersions);var _0x48a522=new Umzug({'storage':_0x17ee('0x28'),'storageOptions':{'model':db[_0x17ee('0x29')],'modelName':_0x17ee('0x29'),'columnName':_0x17ee('0x3')},'migrations':{'params':[db['sequelize'][_0x17ee('0x2a')](),db[_0x17ee('0x28')][_0x17ee('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x17ee('0x21')](config[_0x17ee('0xa')],_0x17ee('0x22'),'migrations'),'pattern':/\.js$/}});_0x48a522['up']({'migrations':_[_0x17ee('0x2c')](_0x5d0171,function(_0x387a22){return _0x387a22+_0x17ee('0x25');})})[_0x17ee('0x2d')](function(){return _0x34b003[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')]({'output':_0x17ee('0x2e')+module[_0x17ee('0xc')][_0x17ee('0x3')]+_0x17ee('0x2f')+_['last'](_0x5d0171),'migrations':_[_0x17ee('0x21')](_0x5d0171)});})[_0x17ee('0x30')](function(_0x1614fd){if(_0x1614fd instanceof db[_0x17ee('0x28')][_0x17ee('0x31')]){return _0x34b003[_0x17ee('0x12')](0xc8)[_0x17ee('0x13')]({'output':_0x17ee('0x32')});}else{return _0x34b003[_0x17ee('0x12')](0x1f4)[_0x17ee('0x13')](_0x1614fd);}});}else{return _0x34b003[_0x17ee('0x12')](0xc8)['json']({'output':_0x17ee('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 8476eac..f0ff472 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 _0x9582=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','create','/:id','update','delete'];(function(_0xe98f39,_0x2ddbbf){var _0x508259=function(_0x543561){while(--_0x543561){_0xe98f39['push'](_0xe98f39['shift']());}};_0x508259(++_0x2ddbbf);}(_0x9582,0x95));var _0x2958=function(_0x14bc1e,_0x317b80){_0x14bc1e=_0x14bc1e-0x0;var _0x221fb7=_0x9582[_0x14bc1e];return _0x221fb7;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2958('0x6'));var config=require(_0x2958('0x7'));var controller=require(_0x2958('0x8'));router[_0x2958('0x9')]('/',auth[_0x2958('0xa')](),controller[_0x2958('0xb')]);router[_0x2958('0x9')](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0xd')]);router['get']('/:id',auth[_0x2958('0xa')](),controller['show']);router[_0x2958('0xe')]('/',auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['put'](_0x2958('0x10'),auth[_0x2958('0xa')](),controller[_0x2958('0x11')]);router[_0x2958('0x12')](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x13')]);module[_0x2958('0x14')]=router; \ No newline at end of file +var _0xdf55=['post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0xdf55,0x83));var _0x5df5=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0xdf55[_0x27125a];return _0x391f7a;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var auth=require(_0x5df5('0x4'));var interaction=require(_0x5df5('0x5'));var config=require(_0x5df5('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x5df5('0x7')]('/',auth[_0x5df5('0x8')](),controller[_0x5df5('0x9')]);router[_0x5df5('0x7')](_0x5df5('0xa'),auth[_0x5df5('0x8')](),controller[_0x5df5('0xb')]);router[_0x5df5('0x7')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xc')]);router[_0x5df5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5df5('0xe')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0xf')]);router['delete']('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0x10')]);module[_0x5df5('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5a301ef..df13404 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 _0x39a5=['exports','STRING','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x441fcf,_0x4dbb36){var _0x387b32=function(_0x38c7a7){while(--_0x38c7a7){_0x441fcf['push'](_0x441fcf['shift']());}};_0x387b32(++_0x4dbb36);}(_0x39a5,0x179));var _0x539a=function(_0x20ecf2,_0x6f9ab){_0x20ecf2=_0x20ecf2-0x0;var _0x119204=_0x39a5[_0x20ecf2];return _0x119204;};'use strict';var Sequelize=require(_0x539a('0x0'));module[_0x539a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x539a('0x2')]},'calleridname':{'type':Sequelize[_0x539a('0x2')]},'queue':{'type':Sequelize[_0x539a('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x539a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x539a('0x3')]},'agentcomplete':{'type':Sequelize[_0x539a('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x539a('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x539a('0x3')]},'agentacw':{'type':Sequelize[_0x539a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x539a('0x3')]},'reason':{'type':Sequelize[_0x539a('0x2')]},'lastevent':{'type':Sequelize[_0x539a('0x2')]},'channel':{'type':Sequelize[_0x539a('0x2')]},'channelstate':{'type':Sequelize[_0x539a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x539a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x539a('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x539a('0x2')]},'accountcode':{'type':Sequelize[_0x539a('0x2')]},'context':{'type':Sequelize[_0x539a('0x2')]},'exten':{'type':Sequelize[_0x539a('0x2')]},'priority':{'type':Sequelize[_0x539a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x539a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x539a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x539a('0x2')]},'destcalleridname':{'type':Sequelize[_0x539a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x539a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x539a('0x2')]},'destlanguage':{'type':Sequelize[_0x539a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x539a('0x2')]},'destexten':{'type':Sequelize[_0x539a('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x539a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x539a('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x539a('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x539a('0x2')],'comment':_0x539a('0x5')},'transferexten':{'type':Sequelize[_0x539a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x539a('0x2')]},'agententerreason':{'type':Sequelize[_0x539a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x335f=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1a8cf6,_0x3220ef){var _0x4a786c=function(_0x283964){while(--_0x283964){_0x1a8cf6['push'](_0x1a8cf6['shift']());}};_0x4a786c(++_0x3220ef);}(_0x335f,0x10f));var _0xf335=function(_0x50be80,_0x3615b5){_0x50be80=_0x50be80-0x0;var _0x389403=_0x335f[_0x50be80];return _0x389403;};'use strict';var Sequelize=require(_0xf335('0x0'));module[_0xf335('0x1')]={'type':{'type':Sequelize[_0xf335('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf335('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf335('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf335('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xf335('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf335('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf335('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf335('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf335('0x5')]},'agentacw':{'type':Sequelize[_0xf335('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf335('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xf335('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf335('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf335('0x2')]},'connectedlinename':{'type':Sequelize[_0xf335('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf335('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf335('0x2')]},'priority':{'type':Sequelize[_0xf335('0x2')]},'destchannel':{'type':Sequelize[_0xf335('0x2')]},'destchannelstate':{'type':Sequelize[_0xf335('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xf335('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf335('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf335('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf335('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf335('0x2')]},'destcontext':{'type':Sequelize[_0xf335('0x2')]},'destexten':{'type':Sequelize[_0xf335('0x2')]},'destpriority':{'type':Sequelize[_0xf335('0x2')]},'destuniqueid':{'type':Sequelize[_0xf335('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf335('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xf335('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf335('0x2')],'comment':_0xf335('0x6')},'transferexten':{'type':Sequelize[_0xf335('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf335('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index d6e7307..7353146 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 _0x6a79=['where','pick','filter','merge','map','key','VIRTUAL','field','options','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x160afc,_0x37946a){var _0x2b06c0=function(_0x3c269c){while(--_0x3c269c){_0x160afc['push'](_0x160afc['shift']());}};_0x2b06c0(++_0x37946a);}(_0x6a79,0x1c5));var _0x96a7=function(_0x54b749,_0x45913f){_0x54b749=_0x54b749-0x0;var _0x5a1b77=_0x6a79[_0x54b749];return _0x5a1b77;};'use strict';var pdf=require(_0x96a7('0x0'));var emlformat=require(_0x96a7('0x1'));var rimraf=require(_0x96a7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96a7('0x3'));var rp=require(_0x96a7('0x4'));var moment=require(_0x96a7('0x5'));var BPromise=require(_0x96a7('0x6'));var Mustache=require('mustache');var util=require(_0x96a7('0x7'));var path=require(_0x96a7('0x8'));var sox=require(_0x96a7('0x9'));var csv=require(_0x96a7('0xa'));var ejs=require(_0x96a7('0xb'));var fs=require('fs');var _=require(_0x96a7('0xc'));var squel=require(_0x96a7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x96a7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x96a7('0xf'));var Papa=require(_0x96a7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x96a7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x96a7('0x12'));var utils=require(_0x96a7('0x13'));var config=require(_0x96a7('0x14'));var db=require(_0x96a7('0x15'))['db'];function respondWithStatusCode(_0x353009,_0x293fdf){_0x293fdf=_0x293fdf||0xcc;return function(_0x816435){if(_0x816435){return _0x353009[_0x96a7('0x16')](_0x293fdf);}return _0x353009[_0x96a7('0x17')](_0x293fdf)[_0x96a7('0x18')]();};}function respondWithResult(_0x5cc780,_0x5ea7eb){_0x5ea7eb=_0x5ea7eb||0xc8;return function(_0x340b69){if(_0x340b69){return _0x5cc780[_0x96a7('0x17')](_0x5ea7eb)[_0x96a7('0x19')](_0x340b69);}};}function respondWithFilteredResult(_0x19c5ae,_0x770f43){return function(_0x4ef4b6){if(_0x4ef4b6){var _0x133893=_0x4ef4b6[_0x96a7('0x1a')],_0x2798c1=_0x770f43[_0x96a7('0x1b')],_0x5c68c7=_0x770f43[_0x96a7('0x1b')]+_0x770f43[_0x96a7('0x1c')],_0x2f366b;if(_0x5c68c7>=_0x133893){_0x5c68c7=_0x133893;_0x2f366b=0xc8;}else{_0x2f366b=0xce;}_0x19c5ae[_0x96a7('0x17')](_0x2f366b);return _0x19c5ae[_0x96a7('0x1d')](_0x96a7('0x1e'),_0x2798c1+'-'+_0x5c68c7+'/'+_0x133893)[_0x96a7('0x19')](_0x4ef4b6);}return null;};}function patchUpdates(_0x57283d){return function(_0x44502a){try{jsonpatch[_0x96a7('0x1f')](_0x44502a,_0x57283d,!![]);}catch(_0x26ecff){return BPromise[_0x96a7('0x20')](_0x26ecff);}return _0x44502a[_0x96a7('0x21')]();};}function saveUpdates(_0x1f120a,_0x5e70ee){return function(_0x4aa448){if(_0x4aa448){return _0x4aa448[_0x96a7('0x22')](_0x1f120a)[_0x96a7('0x23')](function(_0xa862f4){return _0xa862f4;});}return null;};}function removeEntity(_0x3a4f14,_0x4ac80f){return function(_0x42a5f3){if(_0x42a5f3){return _0x42a5f3['destroy']()[_0x96a7('0x23')](function(){_0x3a4f14[_0x96a7('0x17')](0xcc)[_0x96a7('0x18')]();});}};}function handleEntityNotFound(_0x261696,_0xf79dbc){return function(_0x5eeaf3){if(!_0x5eeaf3){_0x261696[_0x96a7('0x16')](0x194);}return _0x5eeaf3;};}function handleError(_0x203529,_0x46da94){_0x46da94=_0x46da94||0x1f4;return function(_0x2a8629){logger[_0x96a7('0x24')](_0x2a8629[_0x96a7('0x25')]);if(_0x2a8629[_0x96a7('0x26')]){delete _0x2a8629[_0x96a7('0x26')];}_0x203529[_0x96a7('0x17')](_0x46da94)[_0x96a7('0x27')](_0x2a8629);};}exports[_0x96a7('0x28')]=function(_0x38ed37,_0x2c7011){var _0x4aa45a={},_0x342a00={},_0xccb1ca={'count':0x0,'rows':[]};var _0xd42ef=db['VoiceAgentReport'][_0x96a7('0x29')];_0x342a00[_0x96a7('0x2a')]=_[_0x96a7('0x2b')](_0xd42ef);_0x342a00[_0x96a7('0x2c')]=_[_0x96a7('0x2b')](_0x38ed37[_0x96a7('0x2c')]);_0x342a00[_0x96a7('0x2d')]=_[_0x96a7('0x2e')](_0x342a00[_0x96a7('0x2a')],_0x342a00[_0x96a7('0x2c')]);_0x4aa45a[_0x96a7('0x2f')]=_[_0x96a7('0x2e')](_0x342a00[_0x96a7('0x2a')],qs[_0x96a7('0x30')](_0x38ed37[_0x96a7('0x2c')][_0x96a7('0x30')]));_0x4aa45a[_0x96a7('0x2f')]=_0x4aa45a[_0x96a7('0x2f')]['length']?_0x4aa45a['attributes']:_0x342a00[_0x96a7('0x2a')];if(!_0x38ed37['query'][_0x96a7('0x31')]('nolimit')){_0x4aa45a[_0x96a7('0x1c')]=qs[_0x96a7('0x1c')](_0x38ed37['query']['limit']);_0x4aa45a[_0x96a7('0x1b')]=qs[_0x96a7('0x1b')](_0x38ed37[_0x96a7('0x2c')][_0x96a7('0x1b')]);}_0x4aa45a[_0x96a7('0x32')]=qs['sort'](_0x38ed37[_0x96a7('0x2c')]['sort']);_0x4aa45a[_0x96a7('0x33')]=qs[_0x96a7('0x2d')](_[_0x96a7('0x34')](_0x38ed37['query'],_0x342a00['filters']));if(_0x38ed37['query'][_0x96a7('0x35')]){_0x4aa45a[_0x96a7('0x33')]=_[_0x96a7('0x36')](_0x4aa45a[_0x96a7('0x33')],{'$or':_[_0x96a7('0x37')](_0xd42ef,function(_0x5f070f){if(_0x5f070f['type'][_0x96a7('0x38')]!==_0x96a7('0x39')){var _0x514313={};_0x514313[_0x5f070f[_0x96a7('0x3a')]]={'$like':'%'+_0x38ed37[_0x96a7('0x2c')][_0x96a7('0x35')]+'%'};return _0x514313;}})});}_0x4aa45a=_[_0x96a7('0x36')]({},_0x4aa45a,_0x38ed37[_0x96a7('0x3b')]);var _0x2322d1={'where':_0x4aa45a[_0x96a7('0x33')]};return db[_0x96a7('0x3c')][_0x96a7('0x1a')](_0x2322d1)['then'](function(_0x11ebf4){_0xccb1ca[_0x96a7('0x1a')]=_0x11ebf4;if(_0x38ed37['query'][_0x96a7('0x3d')]){_0x4aa45a[_0x96a7('0x3e')]=[{'all':!![]}];}return db[_0x96a7('0x3c')][_0x96a7('0x3f')](_0x4aa45a);})[_0x96a7('0x23')](function(_0x43f092){_0xccb1ca[_0x96a7('0x40')]=_0x43f092;return _0xccb1ca;})[_0x96a7('0x23')](respondWithFilteredResult(_0x2c7011,_0x4aa45a))[_0x96a7('0x41')](handleError(_0x2c7011,null));};exports[_0x96a7('0x42')]=function(_0x17a0ad,_0x45c127){var _0x19f88b={'raw':![],'where':{'id':_0x17a0ad[_0x96a7('0x43')]['id']}},_0x599a9f={};_0x599a9f['model']=_['keys'](db[_0x96a7('0x3c')][_0x96a7('0x29')]);_0x599a9f[_0x96a7('0x2c')]=_['keys'](_0x17a0ad[_0x96a7('0x2c')]);_0x599a9f[_0x96a7('0x2d')]=_['intersection'](_0x599a9f[_0x96a7('0x2a')],_0x599a9f[_0x96a7('0x2c')]);_0x19f88b[_0x96a7('0x2f')]=_[_0x96a7('0x2e')](_0x599a9f[_0x96a7('0x2a')],qs[_0x96a7('0x30')](_0x17a0ad[_0x96a7('0x2c')]['fields']));_0x19f88b['attributes']=_0x19f88b[_0x96a7('0x2f')]['length']?_0x19f88b[_0x96a7('0x2f')]:_0x599a9f[_0x96a7('0x2a')];if(_0x17a0ad[_0x96a7('0x2c')][_0x96a7('0x3d')]){_0x19f88b[_0x96a7('0x3e')]=[{'all':!![]}];}_0x19f88b=_['merge']({},_0x19f88b,_0x17a0ad[_0x96a7('0x3b')]);return db[_0x96a7('0x3c')][_0x96a7('0x44')](_0x19f88b)[_0x96a7('0x23')](handleEntityNotFound(_0x45c127,null))['then'](respondWithResult(_0x45c127,null))[_0x96a7('0x41')](handleError(_0x45c127,null));};exports[_0x96a7('0x45')]=function(_0x1d9d02,_0x50c163){return db[_0x96a7('0x3c')]['create'](_0x1d9d02['body'],{})[_0x96a7('0x23')](respondWithResult(_0x50c163,0xc9))[_0x96a7('0x41')](handleError(_0x50c163,null));};exports[_0x96a7('0x22')]=function(_0x1391f8,_0x54d190){if(_0x1391f8['body']['id']){delete _0x1391f8[_0x96a7('0x46')]['id'];}return db['VoiceAgentReport'][_0x96a7('0x44')]({'where':{'id':_0x1391f8[_0x96a7('0x43')]['id']}})['then'](handleEntityNotFound(_0x54d190,null))['then'](saveUpdates(_0x1391f8[_0x96a7('0x46')],null))[_0x96a7('0x23')](respondWithResult(_0x54d190,null))[_0x96a7('0x41')](handleError(_0x54d190,null));};exports[_0x96a7('0x47')]=function(_0x5cbfb1,_0xaaa9a9){return db[_0x96a7('0x3c')]['find']({'where':{'id':_0x5cbfb1[_0x96a7('0x43')]['id']}})[_0x96a7('0x23')](handleEntityNotFound(_0xaaa9a9,null))[_0x96a7('0x23')](removeEntity(_0xaaa9a9,null))[_0x96a7('0x41')](handleError(_0xaaa9a9,null));};exports['describe']=function(_0xa0f6b8,_0x231237){return db['VoiceAgentReport']['describe']()[_0x96a7('0x23')](respondWithResult(_0x231237,null))[_0x96a7('0x41')](handleError(_0x231237,null));}; \ No newline at end of file +var _0x52a2=['bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceAgentReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','update','find','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x5d503a,_0x564d74){var _0x4e9a13=function(_0x2ae833){while(--_0x2ae833){_0x5d503a['push'](_0x5d503a['shift']());}};_0x4e9a13(++_0x564d74);}(_0x52a2,0x1de));var _0x252a=function(_0x126121,_0x35e290){_0x126121=_0x126121-0x0;var _0x57d413=_0x52a2[_0x126121];return _0x57d413;};'use strict';var pdf=require(_0x252a('0x0'));var emlformat=require(_0x252a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x252a('0x2'));var rp=require(_0x252a('0x3'));var moment=require(_0x252a('0x4'));var BPromise=require(_0x252a('0x5'));var Mustache=require('mustache');var util=require(_0x252a('0x6'));var path=require(_0x252a('0x7'));var sox=require(_0x252a('0x8'));var csv=require(_0x252a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x252a('0xa'));var crypto=require(_0x252a('0xb'));var jsforce=require(_0x252a('0xc'));var deskjs=require(_0x252a('0xd'));var toCsv=require(_0x252a('0x9'));var querystring=require(_0x252a('0xe'));var Papa=require(_0x252a('0xf'));var Redis=require('ioredis');var authService=require(_0x252a('0x10'));var qs=require(_0x252a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x252a('0x12'));var db=require(_0x252a('0x13'))['db'];function respondWithStatusCode(_0x5692b6,_0x5d11cb){_0x5d11cb=_0x5d11cb||0xcc;return function(_0x23b634){if(_0x23b634){return _0x5692b6[_0x252a('0x14')](_0x5d11cb);}return _0x5692b6[_0x252a('0x15')](_0x5d11cb)[_0x252a('0x16')]();};}function respondWithResult(_0x27c809,_0x46ce78){_0x46ce78=_0x46ce78||0xc8;return function(_0x3c142c){if(_0x3c142c){return _0x27c809[_0x252a('0x15')](_0x46ce78)[_0x252a('0x17')](_0x3c142c);}};}function respondWithFilteredResult(_0x3d5a22,_0x511878){return function(_0x5d6443){if(_0x5d6443){var _0x346542=_0x5d6443[_0x252a('0x18')],_0x166c18=_0x511878[_0x252a('0x19')],_0x50692e=_0x511878[_0x252a('0x19')]+_0x511878[_0x252a('0x1a')],_0x151a53;if(_0x50692e>=_0x346542){_0x50692e=_0x346542;_0x151a53=0xc8;}else{_0x151a53=0xce;}_0x3d5a22[_0x252a('0x15')](_0x151a53);return _0x3d5a22[_0x252a('0x1b')]('Content-Range',_0x166c18+'-'+_0x50692e+'/'+_0x346542)['json'](_0x5d6443);}return null;};}function patchUpdates(_0x3d9f67){return function(_0x4447f8){try{jsonpatch[_0x252a('0x1c')](_0x4447f8,_0x3d9f67,!![]);}catch(_0x21fcd5){return BPromise[_0x252a('0x1d')](_0x21fcd5);}return _0x4447f8[_0x252a('0x1e')]();};}function saveUpdates(_0x17c809,_0x57e80b){return function(_0x20df75){if(_0x20df75){return _0x20df75['update'](_0x17c809)[_0x252a('0x1f')](function(_0x2535f1){return _0x2535f1;});}return null;};}function removeEntity(_0x66ce9f,_0x3135fa){return function(_0x2b6a13){if(_0x2b6a13){return _0x2b6a13[_0x252a('0x20')]()[_0x252a('0x1f')](function(){_0x66ce9f[_0x252a('0x15')](0xcc)[_0x252a('0x16')]();});}};}function handleEntityNotFound(_0x5948ef,_0x30296c){return function(_0x4fd320){if(!_0x4fd320){_0x5948ef['sendStatus'](0x194);}return _0x4fd320;};}function handleError(_0x2be448,_0x412063){_0x412063=_0x412063||0x1f4;return function(_0x4f0863){logger[_0x252a('0x21')](_0x4f0863[_0x252a('0x22')]);if(_0x4f0863[_0x252a('0x23')]){delete _0x4f0863[_0x252a('0x23')];}_0x2be448[_0x252a('0x15')](_0x412063)[_0x252a('0x24')](_0x4f0863);};}exports[_0x252a('0x25')]=function(_0x48e687,_0x176830){var _0x5d4d42={},_0x3473d4={},_0x2b7aa8={'count':0x0,'rows':[]};var _0x3f0f82=db[_0x252a('0x26')][_0x252a('0x27')];_0x3473d4[_0x252a('0x28')]=_[_0x252a('0x29')](_0x3f0f82);_0x3473d4[_0x252a('0x2a')]=_[_0x252a('0x29')](_0x48e687[_0x252a('0x2a')]);_0x3473d4[_0x252a('0x2b')]=_[_0x252a('0x2c')](_0x3473d4[_0x252a('0x28')],_0x3473d4['query']);_0x5d4d42[_0x252a('0x2d')]=_['intersection'](_0x3473d4[_0x252a('0x28')],qs['fields'](_0x48e687['query'][_0x252a('0x2e')]));_0x5d4d42[_0x252a('0x2d')]=_0x5d4d42['attributes']['length']?_0x5d4d42[_0x252a('0x2d')]:_0x3473d4[_0x252a('0x28')];if(!_0x48e687[_0x252a('0x2a')][_0x252a('0x2f')](_0x252a('0x30'))){_0x5d4d42[_0x252a('0x1a')]=qs['limit'](_0x48e687[_0x252a('0x2a')][_0x252a('0x1a')]);_0x5d4d42[_0x252a('0x19')]=qs[_0x252a('0x19')](_0x48e687[_0x252a('0x2a')][_0x252a('0x19')]);}_0x5d4d42[_0x252a('0x31')]=qs[_0x252a('0x32')](_0x48e687[_0x252a('0x2a')][_0x252a('0x32')]);_0x5d4d42['where']=qs[_0x252a('0x2b')](_['pick'](_0x48e687[_0x252a('0x2a')],_0x3473d4[_0x252a('0x2b')]));if(_0x48e687[_0x252a('0x2a')]['filter']){_0x5d4d42[_0x252a('0x33')]=_['merge'](_0x5d4d42[_0x252a('0x33')],{'$or':_[_0x252a('0x34')](_0x3f0f82,function(_0x4bd97d){if(_0x4bd97d[_0x252a('0x35')]['key']!==_0x252a('0x36')){var _0x10aea5={};_0x10aea5[_0x4bd97d['field']]={'$like':'%'+_0x48e687[_0x252a('0x2a')]['filter']+'%'};return _0x10aea5;}})});}_0x5d4d42=_['merge']({},_0x5d4d42,_0x48e687[_0x252a('0x37')]);var _0x2ad6d9={'where':_0x5d4d42['where']};return db['VoiceAgentReport'][_0x252a('0x18')](_0x2ad6d9)[_0x252a('0x1f')](function(_0x24d9df){_0x2b7aa8['count']=_0x24d9df;if(_0x48e687['query'][_0x252a('0x38')]){_0x5d4d42[_0x252a('0x39')]=[{'all':!![]}];}return db[_0x252a('0x26')][_0x252a('0x3a')](_0x5d4d42);})[_0x252a('0x1f')](function(_0x24f947){_0x2b7aa8[_0x252a('0x3b')]=_0x24f947;return _0x2b7aa8;})[_0x252a('0x1f')](respondWithFilteredResult(_0x176830,_0x5d4d42))[_0x252a('0x3c')](handleError(_0x176830,null));};exports[_0x252a('0x3d')]=function(_0x4c8c8f,_0xd3c4b1){var _0x107142={'raw':![],'where':{'id':_0x4c8c8f[_0x252a('0x3e')]['id']}},_0x1367f8={};_0x1367f8[_0x252a('0x28')]=_[_0x252a('0x29')](db['VoiceAgentReport']['rawAttributes']);_0x1367f8[_0x252a('0x2a')]=_[_0x252a('0x29')](_0x4c8c8f[_0x252a('0x2a')]);_0x1367f8[_0x252a('0x2b')]=_[_0x252a('0x2c')](_0x1367f8[_0x252a('0x28')],_0x1367f8['query']);_0x107142['attributes']=_[_0x252a('0x2c')](_0x1367f8[_0x252a('0x28')],qs[_0x252a('0x2e')](_0x4c8c8f[_0x252a('0x2a')][_0x252a('0x2e')]));_0x107142['attributes']=_0x107142['attributes']['length']?_0x107142[_0x252a('0x2d')]:_0x1367f8[_0x252a('0x28')];if(_0x4c8c8f[_0x252a('0x2a')][_0x252a('0x38')]){_0x107142[_0x252a('0x39')]=[{'all':!![]}];}_0x107142=_[_0x252a('0x3f')]({},_0x107142,_0x4c8c8f[_0x252a('0x37')]);return db[_0x252a('0x26')]['find'](_0x107142)['then'](handleEntityNotFound(_0xd3c4b1,null))[_0x252a('0x1f')](respondWithResult(_0xd3c4b1,null))['catch'](handleError(_0xd3c4b1,null));};exports[_0x252a('0x40')]=function(_0x5087c9,_0x2c6305){return db['VoiceAgentReport']['create'](_0x5087c9[_0x252a('0x41')],{})[_0x252a('0x1f')](respondWithResult(_0x2c6305,0xc9))[_0x252a('0x3c')](handleError(_0x2c6305,null));};exports[_0x252a('0x42')]=function(_0x4158f6,_0x58f9fd){if(_0x4158f6['body']['id']){delete _0x4158f6[_0x252a('0x41')]['id'];}return db['VoiceAgentReport'][_0x252a('0x43')]({'where':{'id':_0x4158f6[_0x252a('0x3e')]['id']}})[_0x252a('0x1f')](handleEntityNotFound(_0x58f9fd,null))[_0x252a('0x1f')](saveUpdates(_0x4158f6[_0x252a('0x41')],null))[_0x252a('0x1f')](respondWithResult(_0x58f9fd,null))['catch'](handleError(_0x58f9fd,null));};exports[_0x252a('0x20')]=function(_0x5084a2,_0x1bb70c){return db[_0x252a('0x26')][_0x252a('0x43')]({'where':{'id':_0x5084a2[_0x252a('0x3e')]['id']}})[_0x252a('0x1f')](handleEntityNotFound(_0x1bb70c,null))['then'](removeEntity(_0x1bb70c,null))['catch'](handleError(_0x1bb70c,null));};exports[_0x252a('0x44')]=function(_0x51e821,_0x1a26fc){return db['VoiceAgentReport']['describe']()[_0x252a('0x1f')](respondWithResult(_0x1a26fc,null))[_0x252a('0x3c')](handleError(_0x1a26fc,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 19aeb21..f7c4cee 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 _0xfab2=['define','VoiceAgentReport','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfab2,0x6c));var _0x2fab=function(_0x1d7d65,_0x1242db){_0x1d7d65=_0x1d7d65-0x0;var _0x31679f=_0xfab2[_0x1d7d65];return _0x31679f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2fab('0x0'))(_0x2fab('0x1'));var moment=require(_0x2fab('0x2'));var BPromise=require(_0x2fab('0x3'));var rp=require(_0x2fab('0x4'));var fs=require('fs');var path=require(_0x2fab('0x5'));var rimraf=require(_0x2fab('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fab('0x7'));module[_0x2fab('0x8')]=function(_0x104960,_0x1d10d8){return _0x104960[_0x2fab('0x9')](_0x2fab('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2fab('0xb'),_0x2fab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8568=['request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1cc47a,_0x16bbe2){var _0x41b8ec=function(_0x1da1e3){while(--_0x1da1e3){_0x1cc47a['push'](_0x1cc47a['shift']());}};_0x41b8ec(++_0x16bbe2);}(_0x8568,0x1e5));var _0x8856=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x8568[_0x237da8];return _0x558825;};'use strict';var _=require(_0x8856('0x0'));var util=require('util');var logger=require(_0x8856('0x1'))(_0x8856('0x2'));var moment=require(_0x8856('0x3'));var BPromise=require(_0x8856('0x4'));var rp=require(_0x8856('0x5'));var fs=require('fs');var path=require(_0x8856('0x6'));var rimraf=require('rimraf');var config=require(_0x8856('0x7'));var attributes=require(_0x8856('0x8'));module[_0x8856('0x9')]=function(_0x3a1d58,_0x36376b){return _0x3a1d58[_0x8856('0xa')](_0x8856('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x8856('0xc'),_0x8856('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 29e4343..abb7725 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','then','lodash','util'];(function(_0x111c43,_0x1b21d6){var _0x554707=function(_0x522746){while(--_0x522746){_0x111c43['push'](_0x111c43['shift']());}};_0x554707(++_0x1b21d6);}(_0x7a54,0x106));var _0x47a5=function(_0xe6ff16,_0xf3c787){_0xe6ff16=_0xe6ff16-0x0;var _0x3895a9=_0x7a54[_0xe6ff16];return _0x3895a9;};'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')]('VoiceAgentReport,\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['CreateVoiceAgentReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateVoiceAgentReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','body','raw','stringify','VoiceAgentReport','update','options','where','attributes','limit','UpdateVoiceAgentReport','lodash','util'];(function(_0x5173b3,_0x26273d){var _0x16d4d7=function(_0x205197){while(--_0x205197){_0x5173b3['push'](_0x5173b3['shift']());}};_0x16d4d7(++_0x26273d);}(_0x814b,0x1a2));var _0xb814=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x814b[_0x347399];return _0x24e7be;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['VoiceAgentReport']['create'](_0x55ba16[_0xb814('0x19')],{'raw':_0x55ba16['options']?_0x55ba16['options'][_0xb814('0x1a')]===undefined?!![]:![]:!![]})[_0xb814('0xd')](function(_0x25b6b6){logger['info'](_0xb814('0x18'),_0x55ba16);logger['debug'](_0xb814('0x18'),_0x55ba16,JSON[_0xb814('0x1b')](_0x25b6b6));_0xfac75b(_0x25b6b6);})[_0xb814('0x17')](function(_0x470e81){logger[_0xb814('0x13')](_0xb814('0x18'),_0x470e81[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x470e81[_0xb814('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3f81d0){var _0x457dac=this;return new Promise(function(_0x31c7ec,_0x208927){return db[_0xb814('0x1c')][_0xb814('0x1d')](_0x3f81d0[_0xb814('0x19')],{'raw':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1f')]||null:null,'attributes':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x20')]||null:null,'limit':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x21')]||null:null})['then'](function(_0x9008b2){logger[_0xb814('0xe')](_0xb814('0x22'),_0x3f81d0);logger['debug'](_0xb814('0x22'),_0x3f81d0,JSON[_0xb814('0x1b')](_0x9008b2));_0x31c7ec(_0x9008b2);})['catch'](function(_0x338a28){logger['error'](_0xb814('0x22'),_0x338a28['message'],_0x3f81d0);_0x208927(_0x457dac['error'](0x1f4,_0x338a28[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 673490d..feffae9 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 _0xa712=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x237827,_0x2ef6d8){var _0x445523=function(_0x19724c){while(--_0x19724c){_0x237827['push'](_0x237827['shift']());}};_0x445523(++_0x2ef6d8);}(_0xa712,0x90));var _0x2a71=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xa712[_0x3f3f06];return _0x140feb;};'use strict';var multer=require(_0x2a71('0x0'));var util=require(_0x2a71('0x1'));var path=require(_0x2a71('0x2'));var timeout=require(_0x2a71('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2a71('0x4'));var interaction=require(_0x2a71('0x5'));var config=require(_0x2a71('0x6'));var controller=require(_0x2a71('0x7'));router[_0x2a71('0x8')]('/',auth[_0x2a71('0x9')](),controller[_0x2a71('0xa')]);router[_0x2a71('0x8')](_0x2a71('0xb'),auth[_0x2a71('0x9')](),controller[_0x2a71('0xc')]);router[_0x2a71('0x8')](_0x2a71('0xd'),auth[_0x2a71('0x9')](),controller[_0x2a71('0xe')]);router[_0x2a71('0xf')]('/',auth[_0x2a71('0x9')](),controller[_0x2a71('0x10')]);router[_0x2a71('0x11')](_0x2a71('0xd'),auth[_0x2a71('0x9')](),controller['update']);router[_0x2a71('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2a71('0x13')]);module[_0x2a71('0x14')]=router; \ No newline at end of file +var _0x3afc=['update','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','/:id'];(function(_0x578465,_0x1a7e5e){var _0x5eaa8e=function(_0x3ba95d){while(--_0x3ba95d){_0x578465['push'](_0x578465['shift']());}};_0x5eaa8e(++_0x1a7e5e);}(_0x3afc,0x1dd));var _0xc3af=function(_0x1f3b8d,_0x527c76){_0x1f3b8d=_0x1f3b8d-0x0;var _0x35b42c=_0x3afc[_0x1f3b8d];return _0x35b42c;};'use strict';var multer=require(_0xc3af('0x0'));var util=require(_0xc3af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3af('0x2'));var router=express[_0xc3af('0x3')]();var auth=require(_0xc3af('0x4'));var interaction=require(_0xc3af('0x5'));var config=require(_0xc3af('0x6'));var controller=require('./voiceCallReport.controller');router[_0xc3af('0x7')]('/',auth[_0xc3af('0x8')](),controller[_0xc3af('0x9')]);router[_0xc3af('0x7')](_0xc3af('0xa'),auth[_0xc3af('0x8')](),controller[_0xc3af('0xb')]);router[_0xc3af('0x7')]('/:id',auth[_0xc3af('0x8')](),controller[_0xc3af('0xc')]);router[_0xc3af('0xd')]('/',auth['isAuthenticated'](),controller[_0xc3af('0xe')]);router['put'](_0xc3af('0xf'),auth[_0xc3af('0x8')](),controller[_0xc3af('0x10')]);router['delete'](_0xc3af('0xf'),auth[_0xc3af('0x8')](),controller['destroy']);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 bb7ef4c..bfa0b48 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 _0xed18=['sequelize','exports','ENUM','inbound','inbound-fax','outbound-fax','STRING','DATE','INTEGER'];(function(_0x2e9748,_0x445256){var _0x5c86f5=function(_0x49ff25){while(--_0x49ff25){_0x2e9748['push'](_0x2e9748['shift']());}};_0x5c86f5(++_0x445256);}(_0xed18,0x75));var _0x8ed1=function(_0xf26e77,_0x429091){_0xf26e77=_0xf26e77-0x0;var _0x3256fe=_0xed18[_0xf26e77];return _0x3256fe;};'use strict';var Sequelize=require(_0x8ed1('0x0'));module[_0x8ed1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8ed1('0x2')](_0x8ed1('0x3'),'internal','outbound',_0x8ed1('0x4'),_0x8ed1('0x5'),'dialer')},'tag':{'type':Sequelize[_0x8ed1('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x8ed1('0x6')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8ed1('0x6')]},'channel':{'type':Sequelize[_0x8ed1('0x6')]},'destinationchannel':{'type':Sequelize[_0x8ed1('0x6')]},'lastapplication':{'type':Sequelize[_0x8ed1('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x8ed1('0x7')]},'systemanswertime':{'type':Sequelize[_0x8ed1('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8ed1('0x7')]},'duration':{'type':Sequelize[_0x8ed1('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x8ed1('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x8ed1('0x6')]},'userfield':{'type':Sequelize[_0x8ed1('0x6')]},'userDisposition':{'type':Sequelize[_0x8ed1('0x6')]},'note':{'type':Sequelize[_0x8ed1('0x6')]},'prefix':{'type':Sequelize[_0x8ed1('0x6')]},'routeid':{'type':Sequelize[_0x8ed1('0x8')]},'sipcallid':{'type':Sequelize[_0x8ed1('0x6')]}}; \ No newline at end of file +var _0x2b27=['inbound','internal','outbound','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b27,0x125));var _0x72b2=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x2b27[_0x1ae4a9];return _0x54d0b0;};'use strict';var Sequelize=require(_0x72b2('0x0'));module[_0x72b2('0x1')]={'uniqueid':{'type':Sequelize[_0x72b2('0x2')]},'type':{'type':Sequelize[_0x72b2('0x3')](_0x72b2('0x4'),_0x72b2('0x5'),_0x72b2('0x6'),'inbound-fax','outbound-fax',_0x72b2('0x7'))},'tag':{'type':Sequelize[_0x72b2('0x2')]},'accountcode':{'type':Sequelize[_0x72b2('0x2')]},'source':{'type':Sequelize[_0x72b2('0x2')]},'destination':{'type':Sequelize[_0x72b2('0x2')]},'destinationcontext':{'type':Sequelize[_0x72b2('0x2')]},'callerid':{'type':Sequelize[_0x72b2('0x2')]},'channel':{'type':Sequelize[_0x72b2('0x2')]},'destinationchannel':{'type':Sequelize[_0x72b2('0x2')]},'lastapplication':{'type':Sequelize[_0x72b2('0x2')]},'lastdata':{'type':Sequelize[_0x72b2('0x8')]},'starttime':{'type':Sequelize[_0x72b2('0x9')]},'systemanswertime':{'type':Sequelize[_0x72b2('0x9')]},'answertime':{'type':Sequelize[_0x72b2('0x9')]},'endtime':{'type':Sequelize[_0x72b2('0x9')]},'duration':{'type':Sequelize[_0x72b2('0xa')]},'billableseconds':{'type':Sequelize[_0x72b2('0xa')]},'mohtime':{'type':Sequelize[_0x72b2('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x72b2('0x2')]},'amaflags':{'type':Sequelize[_0x72b2('0x2')]},'userfield':{'type':Sequelize[_0x72b2('0x2')]},'userDisposition':{'type':Sequelize[_0x72b2('0x2')]},'note':{'type':Sequelize[_0x72b2('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x72b2('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b2e926b..b973425 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 _0x62fe=['length','nolimit','limit','offset','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','User','findAll','catch','show','params','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','Content-Range','apply','save','update','destroy','then','error','stack','name','send','VoiceCallReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields'];(function(_0x337212,_0x1e8e7a){var _0xcaab7a=function(_0x3c4bfe){while(--_0x3c4bfe){_0x337212['push'](_0x337212['shift']());}};_0xcaab7a(++_0x1e8e7a);}(_0x62fe,0xba));var _0xe62f=function(_0x58f152,_0x1caafc){_0x58f152=_0x58f152-0x0;var _0x57a773=_0x62fe[_0x58f152];return _0x57a773;};'use strict';var pdf=require(_0xe62f('0x0'));var emlformat=require(_0xe62f('0x1'));var rimraf=require(_0xe62f('0x2'));var zipdir=require(_0xe62f('0x3'));var jsonpatch=require(_0xe62f('0x4'));var rp=require(_0xe62f('0x5'));var moment=require(_0xe62f('0x6'));var BPromise=require(_0xe62f('0x7'));var Mustache=require(_0xe62f('0x8'));var util=require(_0xe62f('0x9'));var path=require(_0xe62f('0xa'));var sox=require(_0xe62f('0xb'));var csv=require(_0xe62f('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe62f('0xd'));var squel=require(_0xe62f('0xe'));var crypto=require(_0xe62f('0xf'));var jsforce=require(_0xe62f('0x10'));var deskjs=require(_0xe62f('0x11'));var toCsv=require(_0xe62f('0xc'));var querystring=require(_0xe62f('0x12'));var Papa=require(_0xe62f('0x13'));var Redis=require(_0xe62f('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe62f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe62f('0x16'))(_0xe62f('0x17'));var utils=require(_0xe62f('0x18'));var config=require(_0xe62f('0x19'));var db=require(_0xe62f('0x1a'))['db'];function respondWithStatusCode(_0x91670d,_0x296bbe){_0x296bbe=_0x296bbe||0xcc;return function(_0x1e0bfb){if(_0x1e0bfb){return _0x91670d[_0xe62f('0x1b')](_0x296bbe);}return _0x91670d[_0xe62f('0x1c')](_0x296bbe)[_0xe62f('0x1d')]();};}function respondWithResult(_0x49bc64,_0x33e3d7){_0x33e3d7=_0x33e3d7||0xc8;return function(_0x558110){if(_0x558110){return _0x49bc64[_0xe62f('0x1c')](_0x33e3d7)[_0xe62f('0x1e')](_0x558110);}};}function respondWithFilteredResult(_0x166f74,_0x26e7ac){return function(_0x4d9916){if(_0x4d9916){var _0xaf9aca=_0x4d9916[_0xe62f('0x1f')],_0x255aff=_0x26e7ac['offset'],_0x47d79b=_0x26e7ac['offset']+_0x26e7ac['limit'],_0x5ba2c3;if(_0x47d79b>=_0xaf9aca){_0x47d79b=_0xaf9aca;_0x5ba2c3=0xc8;}else{_0x5ba2c3=0xce;}_0x166f74[_0xe62f('0x1c')](_0x5ba2c3);return _0x166f74['set'](_0xe62f('0x20'),_0x255aff+'-'+_0x47d79b+'/'+_0xaf9aca)['json'](_0x4d9916);}return null;};}function patchUpdates(_0xcd0ce3){return function(_0x155959){try{jsonpatch[_0xe62f('0x21')](_0x155959,_0xcd0ce3,!![]);}catch(_0x3abd7c){return BPromise['reject'](_0x3abd7c);}return _0x155959[_0xe62f('0x22')]();};}function saveUpdates(_0x51fcd5,_0x5cee1a){return function(_0x3ae7be){if(_0x3ae7be){return _0x3ae7be[_0xe62f('0x23')](_0x51fcd5)['then'](function(_0x11e138){return _0x11e138;});}return null;};}function removeEntity(_0x54a68e,_0x327ba5){return function(_0x4b4e5b){if(_0x4b4e5b){return _0x4b4e5b[_0xe62f('0x24')]()[_0xe62f('0x25')](function(){_0x54a68e[_0xe62f('0x1c')](0xcc)[_0xe62f('0x1d')]();});}};}function handleEntityNotFound(_0x33bc3a,_0x403799){return function(_0x439653){if(!_0x439653){_0x33bc3a[_0xe62f('0x1b')](0x194);}return _0x439653;};}function handleError(_0x38b9a7,_0x7743b4){_0x7743b4=_0x7743b4||0x1f4;return function(_0x3aa9aa){logger[_0xe62f('0x26')](_0x3aa9aa[_0xe62f('0x27')]);if(_0x3aa9aa[_0xe62f('0x28')]){delete _0x3aa9aa[_0xe62f('0x28')];}_0x38b9a7[_0xe62f('0x1c')](_0x7743b4)[_0xe62f('0x29')](_0x3aa9aa);};}exports['index']=function(_0x5b11a4,_0x3177b9){var _0x3956e7={},_0x43c82d={},_0x3b2fe3={'count':0x0,'rows':[]};var _0x395e4a=db[_0xe62f('0x2a')][_0xe62f('0x2b')];_0x43c82d['model']=_[_0xe62f('0x2c')](_0x395e4a);_0x43c82d[_0xe62f('0x2d')]=_[_0xe62f('0x2c')](_0x5b11a4[_0xe62f('0x2d')]);_0x43c82d[_0xe62f('0x2e')]=_[_0xe62f('0x2f')](_0x43c82d[_0xe62f('0x30')],_0x43c82d[_0xe62f('0x2d')]);_0x3956e7[_0xe62f('0x31')]=_[_0xe62f('0x2f')](_0x43c82d[_0xe62f('0x30')],qs['fields'](_0x5b11a4['query'][_0xe62f('0x32')]));_0x3956e7[_0xe62f('0x31')]=_0x3956e7[_0xe62f('0x31')][_0xe62f('0x33')]?_0x3956e7[_0xe62f('0x31')]:_0x43c82d[_0xe62f('0x30')];if(!_0x5b11a4[_0xe62f('0x2d')]['hasOwnProperty'](_0xe62f('0x34'))){_0x3956e7[_0xe62f('0x35')]=qs[_0xe62f('0x35')](_0x5b11a4[_0xe62f('0x2d')]['limit']);_0x3956e7[_0xe62f('0x36')]=qs[_0xe62f('0x36')](_0x5b11a4[_0xe62f('0x2d')]['offset']);}_0x3956e7['order']=qs[_0xe62f('0x37')](_0x5b11a4[_0xe62f('0x2d')][_0xe62f('0x37')]);_0x3956e7[_0xe62f('0x38')]=qs['filters'](_[_0xe62f('0x39')](_0x5b11a4[_0xe62f('0x2d')],_0x43c82d[_0xe62f('0x2e')]));if(_0x5b11a4['query'][_0xe62f('0x3a')]){_0x3956e7[_0xe62f('0x38')]=_[_0xe62f('0x3b')](_0x3956e7['where'],{'$or':_[_0xe62f('0x3c')](_0x395e4a,function(_0x51f9cc){if(_0x51f9cc[_0xe62f('0x3d')][_0xe62f('0x3e')]!==_0xe62f('0x3f')){var _0x21c559={};_0x21c559[_0x51f9cc[_0xe62f('0x40')]]={'$like':'%'+_0x5b11a4['query'][_0xe62f('0x3a')]+'%'};return _0x21c559;}})});}_0x3956e7=_['merge']({},_0x3956e7,_0x5b11a4[_0xe62f('0x41')]);var _0x574d1e={'where':_0x3956e7['where']};return db[_0xe62f('0x2a')]['count'](_0x574d1e)[_0xe62f('0x25')](function(_0x2c03de){_0x3b2fe3[_0xe62f('0x1f')]=_0x2c03de;if(_0x5b11a4[_0xe62f('0x2d')][_0xe62f('0x42')]){_0x3956e7[_0xe62f('0x43')]=[{'attributes':['id',_0xe62f('0x28'),'fullname','alias'],'model':db[_0xe62f('0x44')],'as':_0xe62f('0x44')}];}return db['VoiceCallReport'][_0xe62f('0x45')](_0x3956e7);})[_0xe62f('0x25')](function(_0x877361){_0x3b2fe3['rows']=_0x877361;return _0x3b2fe3;})['then'](respondWithFilteredResult(_0x3177b9,_0x3956e7))[_0xe62f('0x46')](handleError(_0x3177b9,null));};exports[_0xe62f('0x47')]=function(_0x5f36d3,_0x27a35d){var _0x41c728={'raw':!![],'where':{'id':_0x5f36d3[_0xe62f('0x48')]['id']}},_0x2160f5={};_0x2160f5[_0xe62f('0x30')]=_[_0xe62f('0x2c')](db[_0xe62f('0x2a')]['rawAttributes']);_0x2160f5[_0xe62f('0x2d')]=_['keys'](_0x5f36d3[_0xe62f('0x2d')]);_0x2160f5['filters']=_[_0xe62f('0x2f')](_0x2160f5[_0xe62f('0x30')],_0x2160f5['query']);_0x41c728[_0xe62f('0x31')]=_[_0xe62f('0x2f')](_0x2160f5['model'],qs[_0xe62f('0x32')](_0x5f36d3['query'][_0xe62f('0x32')]));_0x41c728[_0xe62f('0x31')]=_0x41c728[_0xe62f('0x31')][_0xe62f('0x33')]?_0x41c728['attributes']:_0x2160f5['model'];if(_0x5f36d3['query']['includeAll']){_0x41c728[_0xe62f('0x43')]=[{'all':!![]}];}_0x41c728=_[_0xe62f('0x3b')]({},_0x41c728,_0x5f36d3[_0xe62f('0x41')]);return db[_0xe62f('0x2a')][_0xe62f('0x49')](_0x41c728)[_0xe62f('0x25')](handleEntityNotFound(_0x27a35d,null))[_0xe62f('0x25')](respondWithResult(_0x27a35d,null))[_0xe62f('0x46')](handleError(_0x27a35d,null));};exports[_0xe62f('0x4a')]=function(_0x589335,_0x473345){return db[_0xe62f('0x2a')][_0xe62f('0x4a')](_0x589335[_0xe62f('0x4b')],{})[_0xe62f('0x25')](respondWithResult(_0x473345,0xc9))[_0xe62f('0x46')](handleError(_0x473345,null));};exports[_0xe62f('0x24')]=function(_0x25d739,_0x2fb4ac){return db[_0xe62f('0x2a')][_0xe62f('0x49')]({'where':{'id':_0x25d739['params']['id']}})[_0xe62f('0x25')](handleEntityNotFound(_0x2fb4ac,null))[_0xe62f('0x25')](removeEntity(_0x2fb4ac,null))[_0xe62f('0x46')](handleError(_0x2fb4ac,null));};exports[_0xe62f('0x4c')]=function(_0x4961d1,_0x3a04fd){return db[_0xe62f('0x2a')][_0xe62f('0x4c')]()[_0xe62f('0x25')](respondWithResult(_0x3a04fd,null))[_0xe62f('0x46')](handleError(_0x3a04fd,null));};exports[_0xe62f('0x23')]=function(_0x5ad3c7,_0x49323e){if(_0x5ad3c7[_0xe62f('0x4b')]['uniqueid']){delete _0x5ad3c7[_0xe62f('0x4b')][_0xe62f('0x4d')];}return db[_0xe62f('0x2a')][_0xe62f('0x49')]({'where':{'uniqueid':_0x5ad3c7[_0xe62f('0x48')]['id'],'UserId':{'$or':[null,_0x5ad3c7[_0xe62f('0x4e')]['id']]}}})[_0xe62f('0x25')](handleEntityNotFound(_0x49323e,null))[_0xe62f('0x25')](saveUpdates(_0x5ad3c7[_0xe62f('0x4b')],null))['then'](respondWithResult(_0x49323e,null))[_0xe62f('0x46')](handleError(_0x49323e,null));}; \ No newline at end of file +var _0x174d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceCallReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','type','VIRTUAL','options','count','includeAll','include','fullname','alias','findAll','rows','catch','show','find','create','body','params','describe','uniqueid','user','eml-format'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0x174d,0x9b));var _0xd174=function(_0x31bcb2,_0x23cc0e){_0x31bcb2=_0x31bcb2-0x0;var _0x3f150c=_0x174d[_0x31bcb2];return _0x3f150c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd174('0x0'));var rimraf=require(_0xd174('0x1'));var zipdir=require(_0xd174('0x2'));var jsonpatch=require(_0xd174('0x3'));var rp=require(_0xd174('0x4'));var moment=require(_0xd174('0x5'));var BPromise=require(_0xd174('0x6'));var Mustache=require(_0xd174('0x7'));var util=require(_0xd174('0x8'));var path=require(_0xd174('0x9'));var sox=require(_0xd174('0xa'));var csv=require(_0xd174('0xb'));var ejs=require(_0xd174('0xc'));var fs=require('fs');var _=require(_0xd174('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd174('0xe'));var deskjs=require(_0xd174('0xf'));var toCsv=require(_0xd174('0xb'));var querystring=require('querystring');var Papa=require(_0xd174('0x10'));var Redis=require(_0xd174('0x11'));var authService=require(_0xd174('0x12'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0xd174('0x13'));var logger=require(_0xd174('0x14'))('api');var utils=require(_0xd174('0x15'));var config=require(_0xd174('0x16'));var db=require(_0xd174('0x17'))['db'];function respondWithStatusCode(_0x238710,_0x46d3bd){_0x46d3bd=_0x46d3bd||0xcc;return function(_0x2a6f02){if(_0x2a6f02){return _0x238710[_0xd174('0x18')](_0x46d3bd);}return _0x238710[_0xd174('0x19')](_0x46d3bd)[_0xd174('0x1a')]();};}function respondWithResult(_0xd29b17,_0x310826){_0x310826=_0x310826||0xc8;return function(_0x3cbc9f){if(_0x3cbc9f){return _0xd29b17[_0xd174('0x19')](_0x310826)[_0xd174('0x1b')](_0x3cbc9f);}};}function respondWithFilteredResult(_0x141a52,_0x59ebd8){return function(_0x54c380){if(_0x54c380){var _0x3f88ed=_0x54c380['count'],_0x29a58b=_0x59ebd8['offset'],_0x5d8c9e=_0x59ebd8[_0xd174('0x1c')]+_0x59ebd8[_0xd174('0x1d')],_0x499f5f;if(_0x5d8c9e>=_0x3f88ed){_0x5d8c9e=_0x3f88ed;_0x499f5f=0xc8;}else{_0x499f5f=0xce;}_0x141a52[_0xd174('0x19')](_0x499f5f);return _0x141a52[_0xd174('0x1e')](_0xd174('0x1f'),_0x29a58b+'-'+_0x5d8c9e+'/'+_0x3f88ed)['json'](_0x54c380);}return null;};}function patchUpdates(_0x11c49d){return function(_0xe998d7){try{jsonpatch[_0xd174('0x20')](_0xe998d7,_0x11c49d,!![]);}catch(_0x2138eb){return BPromise[_0xd174('0x21')](_0x2138eb);}return _0xe998d7[_0xd174('0x22')]();};}function saveUpdates(_0x2b75ba,_0x1a7d4c){return function(_0x474943){if(_0x474943){return _0x474943['update'](_0x2b75ba)[_0xd174('0x23')](function(_0x740419){return _0x740419;});}return null;};}function removeEntity(_0xccb613,_0x328b89){return function(_0x1dbe43){if(_0x1dbe43){return _0x1dbe43[_0xd174('0x24')]()['then'](function(){_0xccb613[_0xd174('0x19')](0xcc)[_0xd174('0x1a')]();});}};}function handleEntityNotFound(_0x4f8308,_0x35d68f){return function(_0xcf83a3){if(!_0xcf83a3){_0x4f8308[_0xd174('0x18')](0x194);}return _0xcf83a3;};}function handleError(_0x10ab7f,_0x2796c8){_0x2796c8=_0x2796c8||0x1f4;return function(_0x3ae043){logger[_0xd174('0x25')](_0x3ae043[_0xd174('0x26')]);if(_0x3ae043[_0xd174('0x27')]){delete _0x3ae043[_0xd174('0x27')];}_0x10ab7f[_0xd174('0x19')](_0x2796c8)[_0xd174('0x28')](_0x3ae043);};}exports[_0xd174('0x29')]=function(_0x3b11d7,_0x44d91b){var _0x1325c2={},_0x1c696d={},_0x260b9d={'count':0x0,'rows':[]};var _0x12837d=db[_0xd174('0x2a')][_0xd174('0x2b')];_0x1c696d[_0xd174('0x2c')]=_[_0xd174('0x2d')](_0x12837d);_0x1c696d['query']=_[_0xd174('0x2d')](_0x3b11d7[_0xd174('0x2e')]);_0x1c696d[_0xd174('0x2f')]=_[_0xd174('0x30')](_0x1c696d['model'],_0x1c696d[_0xd174('0x2e')]);_0x1325c2[_0xd174('0x31')]=_[_0xd174('0x30')](_0x1c696d['model'],qs['fields'](_0x3b11d7[_0xd174('0x2e')][_0xd174('0x32')]));_0x1325c2[_0xd174('0x31')]=_0x1325c2[_0xd174('0x31')][_0xd174('0x33')]?_0x1325c2['attributes']:_0x1c696d[_0xd174('0x2c')];if(!_0x3b11d7[_0xd174('0x2e')][_0xd174('0x34')]('nolimit')){_0x1325c2['limit']=qs[_0xd174('0x1d')](_0x3b11d7[_0xd174('0x2e')][_0xd174('0x1d')]);_0x1325c2[_0xd174('0x1c')]=qs['offset'](_0x3b11d7['query'][_0xd174('0x1c')]);}_0x1325c2[_0xd174('0x35')]=qs[_0xd174('0x36')](_0x3b11d7['query'][_0xd174('0x36')]);_0x1325c2[_0xd174('0x37')]=qs[_0xd174('0x2f')](_['pick'](_0x3b11d7['query'],_0x1c696d['filters']));if(_0x3b11d7['query'][_0xd174('0x38')]){_0x1325c2['where']=_[_0xd174('0x39')](_0x1325c2[_0xd174('0x37')],{'$or':_[_0xd174('0x3a')](_0x12837d,function(_0x1736f8){if(_0x1736f8[_0xd174('0x3b')]['key']!==_0xd174('0x3c')){var _0x9cbb34={};_0x9cbb34[_0x1736f8['field']]={'$like':'%'+_0x3b11d7['query']['filter']+'%'};return _0x9cbb34;}})});}_0x1325c2=_['merge']({},_0x1325c2,_0x3b11d7[_0xd174('0x3d')]);var _0x44fab7={'where':_0x1325c2[_0xd174('0x37')]};return db['VoiceCallReport'][_0xd174('0x3e')](_0x44fab7)[_0xd174('0x23')](function(_0x17bfc0){_0x260b9d[_0xd174('0x3e')]=_0x17bfc0;if(_0x3b11d7[_0xd174('0x2e')][_0xd174('0x3f')]){_0x1325c2[_0xd174('0x40')]=[{'attributes':['id',_0xd174('0x27'),_0xd174('0x41'),_0xd174('0x42')],'model':db['User'],'as':'User'}];}return db[_0xd174('0x2a')][_0xd174('0x43')](_0x1325c2);})[_0xd174('0x23')](function(_0x2b7481){_0x260b9d[_0xd174('0x44')]=_0x2b7481;return _0x260b9d;})[_0xd174('0x23')](respondWithFilteredResult(_0x44d91b,_0x1325c2))[_0xd174('0x45')](handleError(_0x44d91b,null));};exports[_0xd174('0x46')]=function(_0x321f51,_0x3d7a5e){var _0x2849c3={'raw':!![],'where':{'id':_0x321f51['params']['id']}},_0x3998d0={};_0x3998d0[_0xd174('0x2c')]=_[_0xd174('0x2d')](db['VoiceCallReport'][_0xd174('0x2b')]);_0x3998d0['query']=_[_0xd174('0x2d')](_0x321f51['query']);_0x3998d0[_0xd174('0x2f')]=_[_0xd174('0x30')](_0x3998d0[_0xd174('0x2c')],_0x3998d0[_0xd174('0x2e')]);_0x2849c3[_0xd174('0x31')]=_['intersection'](_0x3998d0['model'],qs['fields'](_0x321f51['query'][_0xd174('0x32')]));_0x2849c3['attributes']=_0x2849c3[_0xd174('0x31')][_0xd174('0x33')]?_0x2849c3[_0xd174('0x31')]:_0x3998d0[_0xd174('0x2c')];if(_0x321f51[_0xd174('0x2e')][_0xd174('0x3f')]){_0x2849c3[_0xd174('0x40')]=[{'all':!![]}];}_0x2849c3=_['merge']({},_0x2849c3,_0x321f51['options']);return db[_0xd174('0x2a')][_0xd174('0x47')](_0x2849c3)[_0xd174('0x23')](handleEntityNotFound(_0x3d7a5e,null))['then'](respondWithResult(_0x3d7a5e,null))[_0xd174('0x45')](handleError(_0x3d7a5e,null));};exports[_0xd174('0x48')]=function(_0x2fbda9,_0x256386){return db['VoiceCallReport'][_0xd174('0x48')](_0x2fbda9[_0xd174('0x49')],{})['then'](respondWithResult(_0x256386,0xc9))[_0xd174('0x45')](handleError(_0x256386,null));};exports[_0xd174('0x24')]=function(_0x21bd5f,_0x19fbc5){return db[_0xd174('0x2a')][_0xd174('0x47')]({'where':{'id':_0x21bd5f[_0xd174('0x4a')]['id']}})[_0xd174('0x23')](handleEntityNotFound(_0x19fbc5,null))[_0xd174('0x23')](removeEntity(_0x19fbc5,null))[_0xd174('0x45')](handleError(_0x19fbc5,null));};exports[_0xd174('0x4b')]=function(_0x2164cd,_0x1a16d8){return db['VoiceCallReport']['describe']()['then'](respondWithResult(_0x1a16d8,null))['catch'](handleError(_0x1a16d8,null));};exports['update']=function(_0x395c05,_0x532445){if(_0x395c05[_0xd174('0x49')][_0xd174('0x4c')]){delete _0x395c05[_0xd174('0x49')][_0xd174('0x4c')];}return db['VoiceCallReport'][_0xd174('0x47')]({'where':{'uniqueid':_0x395c05[_0xd174('0x4a')]['id'],'UserId':{'$or':[null,_0x395c05[_0xd174('0x4d')]['id']]}}})[_0xd174('0x23')](handleEntityNotFound(_0x532445,null))[_0xd174('0x23')](saveUpdates(_0x395c05[_0xd174('0x49')],null))[_0xd174('0x23')](respondWithResult(_0x532445,null))['catch'](handleError(_0x532445,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 789a5bf..fbaae6f 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 _0x2777=['exports','define','VoiceCallReport','report_call','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cfec9,_0x3d65e4){var _0x3dd620=function(_0x210b69){while(--_0x210b69){_0x4cfec9['push'](_0x4cfec9['shift']());}};_0x3dd620(++_0x3d65e4);}(_0x2777,0x130));var _0x7277=function(_0x548832,_0x5e5e1e){_0x548832=_0x548832-0x0;var _0x539979=_0x2777[_0x548832];return _0x539979;};'use strict';var _=require(_0x7277('0x0'));var util=require('util');var logger=require(_0x7277('0x1'))(_0x7277('0x2'));var moment=require(_0x7277('0x3'));var BPromise=require(_0x7277('0x4'));var rp=require(_0x7277('0x5'));var fs=require('fs');var path=require(_0x7277('0x6'));var rimraf=require(_0x7277('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x7277('0x8')]=function(_0x5c2294,_0x1c6397){return _0x5c2294[_0x7277('0x9')](_0x7277('0xa'),attributes,{'tableName':_0x7277('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b1a=['define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x16dacd,_0x4d8722){var _0x1f8166=function(_0x539d5a){while(--_0x539d5a){_0x16dacd['push'](_0x16dacd['shift']());}};_0x1f8166(++_0x4d8722);}(_0x3b1a,0x79));var _0xa3b1=function(_0x13b70f,_0x5c1116){_0x13b70f=_0x13b70f-0x0;var _0x51427c=_0x3b1a[_0x13b70f];return _0x51427c;};'use strict';var _=require(_0xa3b1('0x0'));var util=require('util');var logger=require(_0xa3b1('0x1'))('api');var moment=require(_0xa3b1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa3b1('0x3'));var fs=require('fs');var path=require(_0xa3b1('0x4'));var rimraf=require(_0xa3b1('0x5'));var config=require(_0xa3b1('0x6'));var attributes=require(_0xa3b1('0x7'));module[_0xa3b1('0x8')]=function(_0x444be0,_0x18f249){return _0x444be0[_0xa3b1('0x9')](_0xa3b1('0xa'),attributes,{'tableName':_0xa3b1('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa3b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5711121..db60514 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 _0x54bf=['request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','options','attributes','limit','include','model','map','GetVoiceCallReport','VoiceCallReport','create','body','raw','CreateVoiceCallReport','update','where','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x54bf,0x106));var _0xf54b=function(_0x42f58d,_0x44a5a3){_0x42f58d=_0x42f58d-0x0;var _0x3207f5=_0x54bf[_0x42f58d];return _0x3207f5;};'use strict';var _=require(_0xf54b('0x0'));var util=require(_0xf54b('0x1'));var moment=require(_0xf54b('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54b('0x3'));var fs=require('fs');var Redis=require(_0xf54b('0x4'));var db=require(_0xf54b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf54b('0x6'))(_0xf54b('0x7'));var config=require(_0xf54b('0x8'));var jayson=require(_0xf54b('0x9'));var client=jayson['client'][_0xf54b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c9b9d,_0x235757,_0x15a436){return new BPromise(function(_0x1f1c68,_0x39e144){return client[_0xf54b('0xb')](_0x2c9b9d,_0x15a436)[_0xf54b('0xc')](function(_0x1d9994){logger[_0xf54b('0xd')](_0xf54b('0xe'),_0x235757,'request\x20sent');logger[_0xf54b('0xf')](_0xf54b('0x10'),_0x235757,'request\x20sent',JSON[_0xf54b('0x11')](_0x1d9994));if(_0x1d9994[_0xf54b('0x12')]){if(_0x1d9994[_0xf54b('0x12')][_0xf54b('0x13')]===0x1f4){logger[_0xf54b('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x235757,_0x1d9994['error'][_0xf54b('0x14')]);return _0x39e144(_0x1d9994['error']['message']);}logger[_0xf54b('0x12')](_0xf54b('0xe'),_0x235757,_0x1d9994['error'][_0xf54b('0x14')]);return _0x1f1c68(_0x1d9994['error'][_0xf54b('0x14')]);}else{logger[_0xf54b('0xd')](_0xf54b('0xe'),_0x235757,_0xf54b('0x15'));_0x1f1c68(_0x1d9994[_0xf54b('0x16')]['message']);}})[_0xf54b('0x17')](function(_0x45c530){logger[_0xf54b('0x12')](_0xf54b('0xe'),_0x235757,_0x45c530);_0x39e144(_0x45c530);});});}exports['GetVoiceCallReport']=function(_0x5229c7){var _0x5c5f75=this;return new Promise(function(_0x412a89,_0x466971){return db['VoiceCallReport']['findAll']({'raw':_0x5229c7[_0xf54b('0x18')]?_0x5229c7[_0xf54b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5229c7[_0xf54b('0x18')]?_0x5229c7[_0xf54b('0x18')]['where']||null:null,'attributes':_0x5229c7[_0xf54b('0x18')]?_0x5229c7[_0xf54b('0x18')][_0xf54b('0x19')]||null:null,'limit':_0x5229c7[_0xf54b('0x18')]?_0x5229c7['options'][_0xf54b('0x1a')]||null:null,'include':_0x5229c7[_0xf54b('0x18')]?_0x5229c7[_0xf54b('0x18')][_0xf54b('0x1b')]?_['map'](_0x5229c7[_0xf54b('0x18')][_0xf54b('0x1b')],function(_0x5f2f51){return{'model':db[_0x5f2f51[_0xf54b('0x1c')]],'as':_0x5f2f51['as'],'attributes':_0x5f2f51['attributes'],'include':_0x5f2f51[_0xf54b('0x1b')]?_[_0xf54b('0x1d')](_0x5f2f51[_0xf54b('0x1b')],function(_0x37d601){return{'model':db[_0x37d601[_0xf54b('0x1c')]],'as':_0x37d601['as'],'attributes':_0x37d601[_0xf54b('0x19')],'include':_0x37d601[_0xf54b('0x1b')]?_['map'](_0x37d601[_0xf54b('0x1b')],function(_0x2a070d){return{'model':db[_0x2a070d['model']],'as':_0x2a070d['as'],'attributes':_0x2a070d[_0xf54b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf54b('0xc')](function(_0x51e21f){logger[_0xf54b('0xd')](_0xf54b('0x1e'),_0x5229c7);logger[_0xf54b('0xf')](_0xf54b('0x1e'),_0x5229c7,JSON[_0xf54b('0x11')](_0x51e21f));_0x412a89(_0x51e21f);})['catch'](function(_0x8044c0){logger[_0xf54b('0x12')](_0xf54b('0x1e'),_0x8044c0['message'],_0x5229c7);_0x466971(_0x5c5f75[_0xf54b('0x12')](0x1f4,_0x8044c0[_0xf54b('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x215ba6){var _0x3d4af4=this;return new Promise(function(_0x44c684,_0x372c22){return db[_0xf54b('0x1f')][_0xf54b('0x20')](_0x215ba6[_0xf54b('0x21')],{'raw':_0x215ba6['options']?_0x215ba6[_0xf54b('0x18')][_0xf54b('0x22')]===undefined?!![]:![]:!![]})[_0xf54b('0xc')](function(_0x39c302){logger[_0xf54b('0xd')](_0xf54b('0x23'),_0x215ba6);logger[_0xf54b('0xf')](_0xf54b('0x23'),_0x215ba6,JSON[_0xf54b('0x11')](_0x39c302));_0x44c684(_0x39c302);})[_0xf54b('0x17')](function(_0x725d8e){logger['error']('CreateVoiceCallReport',_0x725d8e[_0xf54b('0x14')],_0x215ba6);_0x372c22(_0x3d4af4[_0xf54b('0x12')](0x1f4,_0x725d8e[_0xf54b('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x5c572b){var _0x275893=this;return new Promise(function(_0x2ac7ee,_0x1800ad){return db[_0xf54b('0x1f')][_0xf54b('0x24')](_0x5c572b[_0xf54b('0x21')],{'raw':_0x5c572b['options']?_0x5c572b['options'][_0xf54b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c572b['options']?_0x5c572b['options'][_0xf54b('0x25')]||null:null,'attributes':_0x5c572b['options']?_0x5c572b[_0xf54b('0x18')][_0xf54b('0x19')]||null:null,'limit':_0x5c572b[_0xf54b('0x18')]?_0x5c572b[_0xf54b('0x18')][_0xf54b('0x1a')]||null:null})[_0xf54b('0xc')](function(_0x56722e){logger[_0xf54b('0xd')](_0xf54b('0x26'),_0x5c572b);logger[_0xf54b('0xf')]('UpdateVoiceCallReport',_0x5c572b,JSON[_0xf54b('0x11')](_0x56722e));_0x2ac7ee(_0x56722e);})[_0xf54b('0x17')](function(_0x582931){logger['error'](_0xf54b('0x26'),_0x582931['message'],_0x5c572b);_0x1800ad(_0x275893['error'](0x1f4,_0x582931[_0xf54b('0x14')]));});});}; \ No newline at end of file +var _0xcc51=['catch','VoiceCallReport','options','where','attributes','limit','include','model','map','GetVoiceCallReport','stringify','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','VoiceCallReport,\x20%s,\x20%s','message'];(function(_0x24bc80,_0x288946){var _0x29cc74=function(_0x5d136e){while(--_0x5d136e){_0x24bc80['push'](_0x24bc80['shift']());}};_0x29cc74(++_0x288946);}(_0xcc51,0x98));var _0x1cc5=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xcc51[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x1cc5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1cc5('0x1'));var rs=require(_0x1cc5('0x2'));var fs=require('fs');var Redis=require(_0x1cc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cc5('0x4'));var logger=require(_0x1cc5('0x5'))(_0x1cc5('0x6'));var config=require('../../config/environment');var jayson=require(_0x1cc5('0x7'));var client=jayson[_0x1cc5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9b1e,_0x5c2cf3,_0xd2c87f){return new BPromise(function(_0x27dee2,_0x5d1a28){return client['request'](_0x4c9b1e,_0xd2c87f)[_0x1cc5('0x9')](function(_0x3c763d){logger[_0x1cc5('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x5c2cf3,_0x1cc5('0xb'));logger[_0x1cc5('0xc')](_0x1cc5('0xd'),_0x5c2cf3,_0x1cc5('0xb'),JSON['stringify'](_0x3c763d));if(_0x3c763d[_0x1cc5('0xe')]){if(_0x3c763d[_0x1cc5('0xe')][_0x1cc5('0xf')]===0x1f4){logger[_0x1cc5('0xe')](_0x1cc5('0x10'),_0x5c2cf3,_0x3c763d[_0x1cc5('0xe')]['message']);return _0x5d1a28(_0x3c763d['error']['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5c2cf3,_0x3c763d[_0x1cc5('0xe')]['message']);return _0x27dee2(_0x3c763d[_0x1cc5('0xe')][_0x1cc5('0x11')]);}else{logger[_0x1cc5('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x5c2cf3,_0x1cc5('0xb'));_0x27dee2(_0x3c763d['result']['message']);}})[_0x1cc5('0x12')](function(_0x561a66){logger[_0x1cc5('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x5c2cf3,_0x561a66);_0x5d1a28(_0x561a66);});});}exports['GetVoiceCallReport']=function(_0x4c5f97){var _0xd2d766=this;return new Promise(function(_0x3f099a,_0x2bc67a){return db[_0x1cc5('0x13')]['findAll']({'raw':_0x4c5f97[_0x1cc5('0x14')]?_0x4c5f97['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c5f97[_0x1cc5('0x14')]?_0x4c5f97['options'][_0x1cc5('0x15')]||null:null,'attributes':_0x4c5f97['options']?_0x4c5f97['options'][_0x1cc5('0x16')]||null:null,'limit':_0x4c5f97[_0x1cc5('0x14')]?_0x4c5f97[_0x1cc5('0x14')][_0x1cc5('0x17')]||null:null,'include':_0x4c5f97[_0x1cc5('0x14')]?_0x4c5f97[_0x1cc5('0x14')][_0x1cc5('0x18')]?_['map'](_0x4c5f97[_0x1cc5('0x14')][_0x1cc5('0x18')],function(_0x1b25d9){return{'model':db[_0x1b25d9[_0x1cc5('0x19')]],'as':_0x1b25d9['as'],'attributes':_0x1b25d9[_0x1cc5('0x16')],'include':_0x1b25d9[_0x1cc5('0x18')]?_[_0x1cc5('0x1a')](_0x1b25d9[_0x1cc5('0x18')],function(_0x92f672){return{'model':db[_0x92f672['model']],'as':_0x92f672['as'],'attributes':_0x92f672['attributes'],'include':_0x92f672[_0x1cc5('0x18')]?_[_0x1cc5('0x1a')](_0x92f672[_0x1cc5('0x18')],function(_0x4b1aed){return{'model':db[_0x4b1aed[_0x1cc5('0x19')]],'as':_0x4b1aed['as'],'attributes':_0x4b1aed[_0x1cc5('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7966){logger[_0x1cc5('0xa')](_0x1cc5('0x1b'),_0x4c5f97);logger['debug'](_0x1cc5('0x1b'),_0x4c5f97,JSON[_0x1cc5('0x1c')](_0x5d7966));_0x3f099a(_0x5d7966);})[_0x1cc5('0x12')](function(_0x1f8ace){logger[_0x1cc5('0xe')](_0x1cc5('0x1b'),_0x1f8ace[_0x1cc5('0x11')],_0x4c5f97);_0x2bc67a(_0xd2d766[_0x1cc5('0xe')](0x1f4,_0x1f8ace['message']));});});};exports[_0x1cc5('0x1d')]=function(_0x1ce515){var _0x210779=this;return new Promise(function(_0x1d9c8e,_0x339fdc){return db[_0x1cc5('0x13')][_0x1cc5('0x1e')](_0x1ce515[_0x1cc5('0x1f')],{'raw':_0x1ce515[_0x1cc5('0x14')]?_0x1ce515[_0x1cc5('0x14')][_0x1cc5('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1f632c){logger['info'](_0x1cc5('0x1d'),_0x1ce515);logger[_0x1cc5('0xc')](_0x1cc5('0x1d'),_0x1ce515,JSON[_0x1cc5('0x1c')](_0x1f632c));_0x1d9c8e(_0x1f632c);})[_0x1cc5('0x12')](function(_0x5c0026){logger[_0x1cc5('0xe')](_0x1cc5('0x1d'),_0x5c0026['message'],_0x1ce515);_0x339fdc(_0x210779[_0x1cc5('0xe')](0x1f4,_0x5c0026['message']));});});};exports[_0x1cc5('0x21')]=function(_0x7e7e69){var _0x27f258=this;return new Promise(function(_0x17f1b2,_0x52efe6){return db[_0x1cc5('0x13')]['update'](_0x7e7e69['body'],{'raw':_0x7e7e69['options']?_0x7e7e69[_0x1cc5('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7e7e69[_0x1cc5('0x14')]?_0x7e7e69['options'][_0x1cc5('0x15')]||null:null,'attributes':_0x7e7e69['options']?_0x7e7e69[_0x1cc5('0x14')][_0x1cc5('0x16')]||null:null,'limit':_0x7e7e69['options']?_0x7e7e69['options'][_0x1cc5('0x17')]||null:null})[_0x1cc5('0x9')](function(_0x2aa662){logger['info'](_0x1cc5('0x21'),_0x7e7e69);logger[_0x1cc5('0xc')](_0x1cc5('0x21'),_0x7e7e69,JSON[_0x1cc5('0x1c')](_0x2aa662));_0x17f1b2(_0x2aa662);})[_0x1cc5('0x12')](function(_0x3629fc){logger[_0x1cc5('0xe')]('UpdateVoiceCallReport',_0x3629fc['message'],_0x7e7e69);_0x52efe6(_0x27f258['error'](0x1f4,_0x3629fc[_0x1cc5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index fe10b0d..d936c24 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 _0x8c85=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','exports','util','path','connect-timeout'];(function(_0x4dccfb,_0x5c9f92){var _0x20bc89=function(_0x1719cf){while(--_0x1719cf){_0x4dccfb['push'](_0x4dccfb['shift']());}};_0x20bc89(++_0x5c9f92);}(_0x8c85,0xd5));var _0x58c8=function(_0x39cda4,_0x54c367){_0x39cda4=_0x39cda4-0x0;var _0x4794db=_0x8c85[_0x39cda4];return _0x4794db;};'use strict';var multer=require('multer');var util=require(_0x58c8('0x0'));var path=require(_0x58c8('0x1'));var timeout=require(_0x58c8('0x2'));var express=require(_0x58c8('0x3'));var router=express[_0x58c8('0x4')]();var auth=require(_0x58c8('0x5'));var interaction=require(_0x58c8('0x6'));var config=require(_0x58c8('0x7'));var controller=require(_0x58c8('0x8'));router[_0x58c8('0x9')]('/',auth[_0x58c8('0xa')](),controller[_0x58c8('0xb')]);router['get'](_0x58c8('0xc'),auth['isAuthenticated'](),controller[_0x58c8('0xd')]);router[_0x58c8('0xe')]('/',auth[_0x58c8('0xa')](),controller[_0x58c8('0xf')]);router['put']('/:id',auth[_0x58c8('0xa')](),controller[_0x58c8('0x10')]);router['delete'](_0x58c8('0xc'),auth[_0x58c8('0xa')](),controller['destroy']);module[_0x58c8('0x11')]=router; \ No newline at end of file +var _0xc369=['isAuthenticated','show','create','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id'];(function(_0x500944,_0xcb4f26){var _0x2ba81a=function(_0x517afb){while(--_0x517afb){_0x500944['push'](_0x500944['shift']());}};_0x2ba81a(++_0xcb4f26);}(_0xc369,0x140));var _0x9c36=function(_0x1a8a11,_0x2fc864){_0x1a8a11=_0x1a8a11-0x0;var _0x41f1e0=_0xc369[_0x1a8a11];return _0x41f1e0;};'use strict';var multer=require(_0x9c36('0x0'));var util=require('util');var path=require(_0x9c36('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c36('0x2'));var router=express[_0x9c36('0x3')]();var auth=require(_0x9c36('0x4'));var interaction=require(_0x9c36('0x5'));var config=require(_0x9c36('0x6'));var controller=require(_0x9c36('0x7'));router[_0x9c36('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9c36('0x8')](_0x9c36('0x9'),auth[_0x9c36('0xa')](),controller[_0x9c36('0xb')]);router['post']('/',auth[_0x9c36('0xa')](),controller[_0x9c36('0xc')]);router['put'](_0x9c36('0x9'),auth[_0x9c36('0xa')](),controller[_0x9c36('0xd')]);router['delete'](_0x9c36('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9c36('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1372300..0f55ef5 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 _0xec0b=['split','BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x1b8a9b,_0x193033){var _0x47a529=function(_0x235b55){while(--_0x235b55){_0x1b8a9b['push'](_0x1b8a9b['shift']());}};_0x47a529(++_0x193033);}(_0xec0b,0x9b));var _0xbec0=function(_0x36eb2f,_0x111069){_0x36eb2f=_0x36eb2f-0x0;var _0xb51f26=_0xec0b[_0x36eb2f];return _0xb51f26;};'use strict';var Sequelize=require(_0xbec0('0x0'));module['exports']={'name':{'type':Sequelize[_0xbec0('0x1')]},'prefix':{'type':Sequelize[_0xbec0('0x1')],'unique':_0xbec0('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xbec0('0x1')],'set':function(_0x3c9d07){this[_0xbec0('0x3')](_0xbec0('0x4'),_0x3c9d07?_0x3c9d07[_0xbec0('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xbec0('0x4'))?this[_0xbec0('0x6')](_0xbec0('0x4'))[_0xbec0('0x7')](''):[];}},'auth':{'type':Sequelize[_0xbec0('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xbec0('0x1')]},'record':{'type':Sequelize[_0xbec0('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbec0('0x1')]},'description':{'type':Sequelize[_0xbec0('0x1')]}}; \ No newline at end of file +var _0x22a0=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x22a0,0x17b));var _0x022a=function(_0x112489,_0x1049a7){_0x112489=_0x112489-0x0;var _0x3aa08c=_0x22a0[_0x112489];return _0x3aa08c;};'use strict';var Sequelize=require(_0x022a('0x0'));module[_0x022a('0x1')]={'name':{'type':Sequelize[_0x022a('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x022a('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x022a('0x2')],'set':function(_0xc22291){this[_0x022a('0x4')](_0x022a('0x5'),_0xc22291?_0xc22291[_0x022a('0x6')](''):[]);},'get':function(){return this[_0x022a('0x7')]('options')?this[_0x022a('0x7')](_0x022a('0x5'))[_0x022a('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x022a('0x2')]},'record':{'type':Sequelize[_0x022a('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x022a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6c7ad53..020fc56 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 _0xb9f9=['attributes','nolimit','order','where','key','VIRTUAL','field','options','includeAll','include','rows','catch','show','params','fields','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','html-pdf','fast-json-patch','request-promise','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','model','keys','query','filters','intersection'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb9f9,0x13e));var _0x9b9f=function(_0x3252a4,_0x46ea1a){_0x3252a4=_0x3252a4-0x0;var _0x3628c9=_0xb9f9[_0x3252a4];return _0x3628c9;};'use strict';var pdf=require(_0x9b9f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b9f('0x1'));var rp=require(_0x9b9f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b9f('0x3'));var util=require('util');var path=require('path');var sox=require(_0x9b9f('0x4'));var csv=require('to-csv');var ejs=require(_0x9b9f('0x5'));var fs=require('fs');var _=require(_0x9b9f('0x6'));var squel=require(_0x9b9f('0x7'));var crypto=require('crypto');var jsforce=require(_0x9b9f('0x8'));var deskjs=require(_0x9b9f('0x9'));var toCsv=require(_0x9b9f('0xa'));var querystring=require(_0x9b9f('0xb'));var Papa=require(_0x9b9f('0xc'));var Redis=require(_0x9b9f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9b9f('0xe'));var hardwareService=require(_0x9b9f('0xf'));var logger=require('../../config/logger')(_0x9b9f('0x10'));var utils=require(_0x9b9f('0x11'));var config=require(_0x9b9f('0x12'));var db=require(_0x9b9f('0x13'))['db'];function respondWithStatusCode(_0x105df4,_0x55fd4f){_0x55fd4f=_0x55fd4f||0xcc;return function(_0x21eb71){if(_0x21eb71){return _0x105df4['sendStatus'](_0x55fd4f);}return _0x105df4['status'](_0x55fd4f)[_0x9b9f('0x14')]();};}function respondWithResult(_0x33673d,_0x1f33de){_0x1f33de=_0x1f33de||0xc8;return function(_0x151685){if(_0x151685){return _0x33673d[_0x9b9f('0x15')](_0x1f33de)[_0x9b9f('0x16')](_0x151685);}};}function respondWithFilteredResult(_0x2823a3,_0x24f64d){return function(_0x2e683a){if(_0x2e683a){var _0x2ce15f=_0x2e683a[_0x9b9f('0x17')],_0x4eced7=_0x24f64d[_0x9b9f('0x18')],_0x3f87a1=_0x24f64d[_0x9b9f('0x18')]+_0x24f64d[_0x9b9f('0x19')],_0x5908ed;if(_0x3f87a1>=_0x2ce15f){_0x3f87a1=_0x2ce15f;_0x5908ed=0xc8;}else{_0x5908ed=0xce;}_0x2823a3[_0x9b9f('0x15')](_0x5908ed);return _0x2823a3['set'](_0x9b9f('0x1a'),_0x4eced7+'-'+_0x3f87a1+'/'+_0x2ce15f)[_0x9b9f('0x16')](_0x2e683a);}return null;};}function patchUpdates(_0x48da57){return function(_0x383520){try{jsonpatch[_0x9b9f('0x1b')](_0x383520,_0x48da57,!![]);}catch(_0x2516ad){return BPromise[_0x9b9f('0x1c')](_0x2516ad);}return _0x383520[_0x9b9f('0x1d')]();};}function saveUpdates(_0x3716e5,_0xa1331){return function(_0x4f1352){if(_0x4f1352){return _0x4f1352[_0x9b9f('0x1e')](_0x3716e5)[_0x9b9f('0x1f')](function(_0x55a60d){return _0x55a60d;});}return null;};}function removeEntity(_0xdb9e1b,_0x20174f){return function(_0x1de6da){if(_0x1de6da){return _0x1de6da[_0x9b9f('0x20')]()[_0x9b9f('0x1f')](function(){var _0xbd5af3=_0x1de6da[_0x9b9f('0x21')]({'plain':!![]});var _0x19633c='ChanSpies';return db['UserProfileResource'][_0x9b9f('0x20')]({'where':{'type':_0x19633c,'resourceId':_0xbd5af3['id']}})[_0x9b9f('0x1f')](function(){return _0x1de6da;});})[_0x9b9f('0x1f')](function(){_0xdb9e1b['status'](0xcc)[_0x9b9f('0x14')]();});}};}function handleEntityNotFound(_0x313d44,_0x146a4c){return function(_0x585573){if(!_0x585573){_0x313d44[_0x9b9f('0x22')](0x194);}return _0x585573;};}function handleError(_0x32c0d0,_0x498545){_0x498545=_0x498545||0x1f4;return function(_0xdaacda){logger[_0x9b9f('0x23')](_0xdaacda[_0x9b9f('0x24')]);if(_0xdaacda[_0x9b9f('0x25')]){delete _0xdaacda[_0x9b9f('0x25')];}_0x32c0d0[_0x9b9f('0x15')](_0x498545)[_0x9b9f('0x26')](_0xdaacda);};}exports[_0x9b9f('0x27')]=function(_0x4a0f82,_0x455dd4){var _0x16936b={},_0x198101={},_0x3e86b8={'count':0x0,'rows':[]};var _0x1387fb=db[_0x9b9f('0x28')][_0x9b9f('0x29')];_0x198101[_0x9b9f('0x2a')]=_[_0x9b9f('0x2b')](_0x1387fb);_0x198101['query']=_[_0x9b9f('0x2b')](_0x4a0f82[_0x9b9f('0x2c')]);_0x198101[_0x9b9f('0x2d')]=_['intersection'](_0x198101[_0x9b9f('0x2a')],_0x198101[_0x9b9f('0x2c')]);_0x16936b['attributes']=_[_0x9b9f('0x2e')](_0x198101[_0x9b9f('0x2a')],qs['fields'](_0x4a0f82[_0x9b9f('0x2c')]['fields']));_0x16936b['attributes']=_0x16936b['attributes']['length']?_0x16936b[_0x9b9f('0x2f')]:_0x198101[_0x9b9f('0x2a')];if(!_0x4a0f82[_0x9b9f('0x2c')]['hasOwnProperty'](_0x9b9f('0x30'))){_0x16936b[_0x9b9f('0x19')]=qs[_0x9b9f('0x19')](_0x4a0f82['query'][_0x9b9f('0x19')]);_0x16936b[_0x9b9f('0x18')]=qs[_0x9b9f('0x18')](_0x4a0f82['query'][_0x9b9f('0x18')]);}_0x16936b[_0x9b9f('0x31')]=qs['sort'](_0x4a0f82[_0x9b9f('0x2c')]['sort']);_0x16936b[_0x9b9f('0x32')]=qs[_0x9b9f('0x2d')](_['pick'](_0x4a0f82[_0x9b9f('0x2c')],_0x198101['filters']));if(_0x4a0f82[_0x9b9f('0x2c')]['filter']){_0x16936b[_0x9b9f('0x32')]=_['merge'](_0x16936b[_0x9b9f('0x32')],{'$or':_['map'](_0x1387fb,function(_0x46c656){if(_0x46c656['type'][_0x9b9f('0x33')]!==_0x9b9f('0x34')){var _0x14d4d6={};_0x14d4d6[_0x46c656[_0x9b9f('0x35')]]={'$like':'%'+_0x4a0f82[_0x9b9f('0x2c')]['filter']+'%'};return _0x14d4d6;}})});}_0x16936b=_['merge']({},_0x16936b,_0x4a0f82[_0x9b9f('0x36')]);var _0x4fb5ea={'where':_0x16936b['where']};return db[_0x9b9f('0x28')]['count'](_0x4fb5ea)[_0x9b9f('0x1f')](function(_0x4ae6f5){_0x3e86b8[_0x9b9f('0x17')]=_0x4ae6f5;if(_0x4a0f82['query'][_0x9b9f('0x37')]){_0x16936b[_0x9b9f('0x38')]=[{'all':!![]}];}return db[_0x9b9f('0x28')]['findAll'](_0x16936b);})[_0x9b9f('0x1f')](function(_0x270709){_0x3e86b8[_0x9b9f('0x39')]=_0x270709;return _0x3e86b8;})['then'](respondWithFilteredResult(_0x455dd4,_0x16936b))[_0x9b9f('0x3a')](handleError(_0x455dd4,null));};exports[_0x9b9f('0x3b')]=function(_0x4b4c14,_0x1b6be2){var _0x137273={'raw':![],'where':{'id':_0x4b4c14[_0x9b9f('0x3c')]['id']}},_0x2a7a52={};_0x2a7a52[_0x9b9f('0x2a')]=_['keys'](db['VoiceChanSpy'][_0x9b9f('0x29')]);_0x2a7a52['query']=_['keys'](_0x4b4c14['query']);_0x2a7a52['filters']=_[_0x9b9f('0x2e')](_0x2a7a52[_0x9b9f('0x2a')],_0x2a7a52['query']);_0x137273[_0x9b9f('0x2f')]=_[_0x9b9f('0x2e')](_0x2a7a52[_0x9b9f('0x2a')],qs[_0x9b9f('0x3d')](_0x4b4c14[_0x9b9f('0x2c')][_0x9b9f('0x3d')]));_0x137273[_0x9b9f('0x2f')]=_0x137273['attributes'][_0x9b9f('0x3e')]?_0x137273[_0x9b9f('0x2f')]:_0x2a7a52[_0x9b9f('0x2a')];if(_0x4b4c14['query'][_0x9b9f('0x37')]){_0x137273[_0x9b9f('0x38')]=[{'all':!![]}];}_0x137273=_[_0x9b9f('0x3f')]({},_0x137273,_0x4b4c14[_0x9b9f('0x36')]);return db[_0x9b9f('0x28')][_0x9b9f('0x40')](_0x137273)[_0x9b9f('0x1f')](handleEntityNotFound(_0x1b6be2,null))[_0x9b9f('0x1f')](respondWithResult(_0x1b6be2,null))[_0x9b9f('0x3a')](handleError(_0x1b6be2,null));};exports[_0x9b9f('0x41')]=function(_0x467d53,_0x1f425f){return db[_0x9b9f('0x28')][_0x9b9f('0x41')](_0x467d53[_0x9b9f('0x42')],{})[_0x9b9f('0x1f')](function(_0x2650db){var _0x3a5590=_0x467d53[_0x9b9f('0x43')][_0x9b9f('0x21')]({'plain':!![]});if(!_0x3a5590)throw new Error(_0x9b9f('0x44'));if(_0x3a5590[_0x9b9f('0x45')]==='user'){var _0x476644=_0x2650db[_0x9b9f('0x21')]({'plain':!![]});var _0x1115db='ChanSpies';return db['UserProfileSection'][_0x9b9f('0x40')]({'where':{'name':_0x1115db,'userProfileId':_0x3a5590[_0x9b9f('0x46')]},'raw':!![]})[_0x9b9f('0x1f')](function(_0x29b6fe){if(_0x29b6fe&&_0x29b6fe[_0x9b9f('0x47')]===0x0){return db[_0x9b9f('0x48')][_0x9b9f('0x41')]({'name':_0x476644[_0x9b9f('0x25')],'resourceId':_0x476644['id'],'type':_0x29b6fe[_0x9b9f('0x25')],'sectionId':_0x29b6fe['id']},{})['then'](function(){return _0x2650db;});}else{return _0x2650db;}})[_0x9b9f('0x3a')](function(_0x2dfdde){logger[_0x9b9f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dfdde);throw _0x2dfdde;});}return _0x2650db;})[_0x9b9f('0x1f')](respondWithResult(_0x1f425f,0xc9))[_0x9b9f('0x3a')](handleError(_0x1f425f,null));};exports[_0x9b9f('0x1e')]=function(_0x4b5cba,_0x50e9b7){if(_0x4b5cba['body']['id']){delete _0x4b5cba[_0x9b9f('0x42')]['id'];}return db['VoiceChanSpy'][_0x9b9f('0x40')]({'where':{'id':_0x4b5cba['params']['id']}})['then'](handleEntityNotFound(_0x50e9b7,null))['then'](saveUpdates(_0x4b5cba[_0x9b9f('0x42')],null))[_0x9b9f('0x1f')](respondWithResult(_0x50e9b7,null))['catch'](handleError(_0x50e9b7,null));};exports['destroy']=function(_0x3795a7,_0x2f420b){return db[_0x9b9f('0x28')][_0x9b9f('0x40')]({'where':{'id':_0x3795a7[_0x9b9f('0x3c')]['id']}})[_0x9b9f('0x1f')](handleEntityNotFound(_0x2f420b,null))['then'](removeEntity(_0x2f420b,null))[_0x9b9f('0x3a')](handleError(_0x2f420b,null));}; \ No newline at end of file +var _0xcc14=['update','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','ChanSpies','error','name','send','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','field','VoiceChanSpy','includeAll','include','findAll','catch','show','params','keys','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1465b3,_0x3c99f2){var _0x5484e4=function(_0x53fbd4){while(--_0x53fbd4){_0x1465b3['push'](_0x1465b3['shift']());}};_0x5484e4(++_0x3c99f2);}(_0xcc14,0x1c4));var _0x4cc1=function(_0x164993,_0xeaec8a){_0x164993=_0x164993-0x0;var _0x4feb96=_0xcc14[_0x164993];return _0x4feb96;};'use strict';var pdf=require(_0x4cc1('0x0'));var emlformat=require(_0x4cc1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4cc1('0x2'));var jsonpatch=require(_0x4cc1('0x3'));var rp=require(_0x4cc1('0x4'));var moment=require(_0x4cc1('0x5'));var BPromise=require(_0x4cc1('0x6'));var Mustache=require(_0x4cc1('0x7'));var util=require(_0x4cc1('0x8'));var path=require(_0x4cc1('0x9'));var sox=require(_0x4cc1('0xa'));var csv=require(_0x4cc1('0xb'));var ejs=require(_0x4cc1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4cc1('0xd'));var jsforce=require(_0x4cc1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4cc1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4cc1('0xf'));var authService=require(_0x4cc1('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x4cc1('0x11'));var logger=require(_0x4cc1('0x12'))(_0x4cc1('0x13'));var utils=require('../../config/utils');var config=require(_0x4cc1('0x14'));var db=require(_0x4cc1('0x15'))['db'];function respondWithStatusCode(_0xf76709,_0x39a345){_0x39a345=_0x39a345||0xcc;return function(_0x46bfd0){if(_0x46bfd0){return _0xf76709[_0x4cc1('0x16')](_0x39a345);}return _0xf76709[_0x4cc1('0x17')](_0x39a345)[_0x4cc1('0x18')]();};}function respondWithResult(_0x3dd9d2,_0x2042bc){_0x2042bc=_0x2042bc||0xc8;return function(_0x550cfb){if(_0x550cfb){return _0x3dd9d2[_0x4cc1('0x17')](_0x2042bc)['json'](_0x550cfb);}};}function respondWithFilteredResult(_0x70fc23,_0x40c1fb){return function(_0xc7f300){if(_0xc7f300){var _0x293178=_0xc7f300[_0x4cc1('0x19')],_0x37a763=_0x40c1fb['offset'],_0x26f70c=_0x40c1fb[_0x4cc1('0x1a')]+_0x40c1fb[_0x4cc1('0x1b')],_0x415b3e;if(_0x26f70c>=_0x293178){_0x26f70c=_0x293178;_0x415b3e=0xc8;}else{_0x415b3e=0xce;}_0x70fc23['status'](_0x415b3e);return _0x70fc23[_0x4cc1('0x1c')](_0x4cc1('0x1d'),_0x37a763+'-'+_0x26f70c+'/'+_0x293178)['json'](_0xc7f300);}return null;};}function patchUpdates(_0x58e52a){return function(_0x1bb4bd){try{jsonpatch['apply'](_0x1bb4bd,_0x58e52a,!![]);}catch(_0x25ef24){return BPromise[_0x4cc1('0x1e')](_0x25ef24);}return _0x1bb4bd[_0x4cc1('0x1f')]();};}function saveUpdates(_0x3fa1a2,_0x2f211d){return function(_0x2e233c){if(_0x2e233c){return _0x2e233c['update'](_0x3fa1a2)[_0x4cc1('0x20')](function(_0x4babff){return _0x4babff;});}return null;};}function removeEntity(_0xdf5795,_0x400839){return function(_0x9f57bb){if(_0x9f57bb){return _0x9f57bb[_0x4cc1('0x21')]()['then'](function(){var _0x50d3e3=_0x9f57bb[_0x4cc1('0x22')]({'plain':!![]});var _0x5699e0=_0x4cc1('0x23');return db['UserProfileResource'][_0x4cc1('0x21')]({'where':{'type':_0x5699e0,'resourceId':_0x50d3e3['id']}})[_0x4cc1('0x20')](function(){return _0x9f57bb;});})[_0x4cc1('0x20')](function(){_0xdf5795[_0x4cc1('0x17')](0xcc)[_0x4cc1('0x18')]();});}};}function handleEntityNotFound(_0x1954eb,_0x2aa5a7){return function(_0x4d6c95){if(!_0x4d6c95){_0x1954eb[_0x4cc1('0x16')](0x194);}return _0x4d6c95;};}function handleError(_0x4bd1c9,_0x285e2f){_0x285e2f=_0x285e2f||0x1f4;return function(_0x13befd){logger[_0x4cc1('0x24')](_0x13befd['stack']);if(_0x13befd[_0x4cc1('0x25')]){delete _0x13befd['name'];}_0x4bd1c9['status'](_0x285e2f)[_0x4cc1('0x26')](_0x13befd);};}exports['index']=function(_0x57e7d8,_0x46057c){var _0x3b27b1={},_0x1a192b={},_0x5a2bef={'count':0x0,'rows':[]};var _0x382563=db['VoiceChanSpy']['rawAttributes'];_0x1a192b['model']=_['keys'](_0x382563);_0x1a192b[_0x4cc1('0x27')]=_['keys'](_0x57e7d8[_0x4cc1('0x27')]);_0x1a192b[_0x4cc1('0x28')]=_['intersection'](_0x1a192b[_0x4cc1('0x29')],_0x1a192b[_0x4cc1('0x27')]);_0x3b27b1[_0x4cc1('0x2a')]=_[_0x4cc1('0x2b')](_0x1a192b[_0x4cc1('0x29')],qs[_0x4cc1('0x2c')](_0x57e7d8['query']['fields']));_0x3b27b1[_0x4cc1('0x2a')]=_0x3b27b1[_0x4cc1('0x2a')][_0x4cc1('0x2d')]?_0x3b27b1[_0x4cc1('0x2a')]:_0x1a192b[_0x4cc1('0x29')];if(!_0x57e7d8[_0x4cc1('0x27')]['hasOwnProperty'](_0x4cc1('0x2e'))){_0x3b27b1[_0x4cc1('0x1b')]=qs['limit'](_0x57e7d8[_0x4cc1('0x27')]['limit']);_0x3b27b1[_0x4cc1('0x1a')]=qs['offset'](_0x57e7d8[_0x4cc1('0x27')]['offset']);}_0x3b27b1['order']=qs['sort'](_0x57e7d8[_0x4cc1('0x27')][_0x4cc1('0x2f')]);_0x3b27b1[_0x4cc1('0x30')]=qs['filters'](_[_0x4cc1('0x31')](_0x57e7d8[_0x4cc1('0x27')],_0x1a192b['filters']));if(_0x57e7d8[_0x4cc1('0x27')][_0x4cc1('0x32')]){_0x3b27b1[_0x4cc1('0x30')]=_[_0x4cc1('0x33')](_0x3b27b1[_0x4cc1('0x30')],{'$or':_['map'](_0x382563,function(_0x3b7382){if(_0x3b7382[_0x4cc1('0x34')]['key']!=='VIRTUAL'){var _0xdf67d2={};_0xdf67d2[_0x3b7382[_0x4cc1('0x35')]]={'$like':'%'+_0x57e7d8['query'][_0x4cc1('0x32')]+'%'};return _0xdf67d2;}})});}_0x3b27b1=_[_0x4cc1('0x33')]({},_0x3b27b1,_0x57e7d8['options']);var _0xb5ffcb={'where':_0x3b27b1[_0x4cc1('0x30')]};return db[_0x4cc1('0x36')][_0x4cc1('0x19')](_0xb5ffcb)[_0x4cc1('0x20')](function(_0x158b99){_0x5a2bef['count']=_0x158b99;if(_0x57e7d8[_0x4cc1('0x27')][_0x4cc1('0x37')]){_0x3b27b1[_0x4cc1('0x38')]=[{'all':!![]}];}return db[_0x4cc1('0x36')][_0x4cc1('0x39')](_0x3b27b1);})[_0x4cc1('0x20')](function(_0x3e9296){_0x5a2bef['rows']=_0x3e9296;return _0x5a2bef;})[_0x4cc1('0x20')](respondWithFilteredResult(_0x46057c,_0x3b27b1))[_0x4cc1('0x3a')](handleError(_0x46057c,null));};exports[_0x4cc1('0x3b')]=function(_0x3e45d1,_0x4daeb7){var _0x24f854={'raw':![],'where':{'id':_0x3e45d1[_0x4cc1('0x3c')]['id']}},_0x430c04={};_0x430c04[_0x4cc1('0x29')]=_[_0x4cc1('0x3d')](db[_0x4cc1('0x36')][_0x4cc1('0x3e')]);_0x430c04['query']=_['keys'](_0x3e45d1[_0x4cc1('0x27')]);_0x430c04['filters']=_['intersection'](_0x430c04[_0x4cc1('0x29')],_0x430c04[_0x4cc1('0x27')]);_0x24f854['attributes']=_[_0x4cc1('0x2b')](_0x430c04[_0x4cc1('0x29')],qs[_0x4cc1('0x2c')](_0x3e45d1[_0x4cc1('0x27')]['fields']));_0x24f854[_0x4cc1('0x2a')]=_0x24f854['attributes'][_0x4cc1('0x2d')]?_0x24f854['attributes']:_0x430c04['model'];if(_0x3e45d1[_0x4cc1('0x27')][_0x4cc1('0x37')]){_0x24f854['include']=[{'all':!![]}];}_0x24f854=_[_0x4cc1('0x33')]({},_0x24f854,_0x3e45d1[_0x4cc1('0x3f')]);return db['VoiceChanSpy']['find'](_0x24f854)[_0x4cc1('0x20')](handleEntityNotFound(_0x4daeb7,null))['then'](respondWithResult(_0x4daeb7,null))[_0x4cc1('0x3a')](handleError(_0x4daeb7,null));};exports[_0x4cc1('0x40')]=function(_0xedfa97,_0x52c76b){return db[_0x4cc1('0x36')]['create'](_0xedfa97[_0x4cc1('0x41')],{})[_0x4cc1('0x20')](function(_0x4f46be){var _0x4c3131=_0xedfa97['user'][_0x4cc1('0x22')]({'plain':!![]});if(!_0x4c3131)throw new Error(_0x4cc1('0x42'));if(_0x4c3131[_0x4cc1('0x43')]===_0x4cc1('0x44')){var _0x485f40=_0x4f46be[_0x4cc1('0x22')]({'plain':!![]});var _0x1e26de=_0x4cc1('0x23');return db[_0x4cc1('0x45')]['find']({'where':{'name':_0x1e26de,'userProfileId':_0x4c3131['userProfileId']},'raw':!![]})[_0x4cc1('0x20')](function(_0x3d1c8f){if(_0x3d1c8f&&_0x3d1c8f[_0x4cc1('0x46')]===0x0){return db[_0x4cc1('0x47')][_0x4cc1('0x40')]({'name':_0x485f40[_0x4cc1('0x25')],'resourceId':_0x485f40['id'],'type':_0x3d1c8f[_0x4cc1('0x25')],'sectionId':_0x3d1c8f['id']},{})[_0x4cc1('0x20')](function(){return _0x4f46be;});}else{return _0x4f46be;}})[_0x4cc1('0x3a')](function(_0x4f236f){logger[_0x4cc1('0x24')](_0x4cc1('0x48'),_0x4f236f);throw _0x4f236f;});}return _0x4f46be;})[_0x4cc1('0x20')](respondWithResult(_0x52c76b,0xc9))[_0x4cc1('0x3a')](handleError(_0x52c76b,null));};exports[_0x4cc1('0x49')]=function(_0x2f759b,_0x33b4d6){if(_0x2f759b[_0x4cc1('0x41')]['id']){delete _0x2f759b['body']['id'];}return db['VoiceChanSpy'][_0x4cc1('0x4a')]({'where':{'id':_0x2f759b[_0x4cc1('0x3c')]['id']}})[_0x4cc1('0x20')](handleEntityNotFound(_0x33b4d6,null))[_0x4cc1('0x20')](saveUpdates(_0x2f759b['body'],null))['then'](respondWithResult(_0x33b4d6,null))[_0x4cc1('0x3a')](handleError(_0x33b4d6,null));};exports[_0x4cc1('0x21')]=function(_0x2792ee,_0xe7c78c){return db[_0x4cc1('0x36')][_0x4cc1('0x4a')]({'where':{'id':_0x2792ee[_0x4cc1('0x3c')]['id']}})[_0x4cc1('0x20')](handleEntityNotFound(_0xe7c78c,null))[_0x4cc1('0x20')](removeEntity(_0xe7c78c,null))[_0x4cc1('0x3a')](handleError(_0xe7c78c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 86330e6..c02dc77 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 _0x5d6c=['auth','Authenticate','password','ChanSpy','name','options','StopMixMonitor','length','internal','findAll','agent','then','catch','exports','models','VoiceChanSpy','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','merge','MixMonitor','recordingFormat'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x5d6c,0x100));var _0xc5d6=function(_0x458197,_0x53e1d9){_0x458197=_0x458197-0x0;var _0x2b4c27=_0x5d6c[_0x458197];return _0x2b4c27;};'use strict';var _=require(_0xc5d6('0x0'));var util=require('util');var BPromise=require(_0xc5d6('0x1'));var attributes=require(_0xc5d6('0x2'));var getUserApplications=function(_0xfd0112,_0x316f9e,_0x58c35a){var _0x5f11ad=0x1;var _0x229cb8=[];var _0x176e1d={'context':_0x316f9e[_0xc5d6('0x3')]||_0xc5d6('0x4'),'exten':util[_0xc5d6('0x5')](_0xc5d6('0x6'),_0xfd0112[_0xc5d6('0x7')],_0x58c35a),'type':_0xc5d6('0x8'),'isApp':![],'ChanSpyId':_0xfd0112['id'],'UserId':_0x316f9e['id']};_0x229cb8[_0xc5d6('0x9')](_['merge']({'app':_0xc5d6('0xa'),'appdata':util[_0xc5d6('0x5')](_0xc5d6('0xb'),'chanspy'),'priority':_0x5f11ad++},_0x176e1d));if(_0xfd0112[_0xc5d6('0xc')]){_0x229cb8[_0xc5d6('0x9')](_[_0xc5d6('0xd')]({'app':_0xc5d6('0xe'),'appdata':util[_0xc5d6('0x5')]('${UNIQUEID}.%s,ab',_0xfd0112[_0xc5d6('0xf')]),'priority':_0x5f11ad++},_0x176e1d));}if(_0xfd0112[_0xc5d6('0x10')]){_0x229cb8[_0xc5d6('0x9')](_[_0xc5d6('0xd')]({'app':_0xc5d6('0x11'),'appdata':_0xfd0112[_0xc5d6('0x12')],'priority':_0x5f11ad++},_0x176e1d));}_0x229cb8[_0xc5d6('0x9')](_['merge']({'app':_0xc5d6('0x13'),'appdata':util['format']('SIP/%s,%s',_0x316f9e[_0xc5d6('0x14')],_0xfd0112[_0xc5d6('0x15')]?_0xfd0112[_0xc5d6('0x15')]['join'](''):''),'priority':_0x5f11ad++},_0x176e1d));if(_0xfd0112[_0xc5d6('0xc')]){_0x229cb8[_0xc5d6('0x9')](_[_0xc5d6('0xd')]({'app':_0xc5d6('0x16'),'priority':_0x5f11ad++},_0x176e1d));}return _0x229cb8;};var getChanSpyApplications=function(_0x92585,_0x17fdbf){var _0x3b0155=[];for(var _0x40b2a1=0x0,_0x343814=0x1;_0x40b2a1<_0x17fdbf[_0xc5d6('0x17')];_0x40b2a1++,_0x343814=0x1){_0x3b0155=_0x3b0155['concat'](getUserApplications(_0x92585,_0x17fdbf[_0x40b2a1],_0x17fdbf[_0x40b2a1][_0xc5d6('0x18')]));if(_0x17fdbf[_0x40b2a1][_0xc5d6('0x18')]!=_0x17fdbf[_0x40b2a1][_0xc5d6('0x14')]){_0x3b0155=_0x3b0155['concat'](getUserApplications(_0x92585,_0x17fdbf[_0x40b2a1],_0x17fdbf[_0x40b2a1]['name']));}}return _0x3b0155;};var getChanSpyPromise=function(_0x57953b,_0x55806c){return new BPromise(function(_0x2d58ff,_0x137a8b){return _0x57953b['User'][_0xc5d6('0x19')]({'attributes':['id',_0xc5d6('0x14'),_0xc5d6('0x18')],'where':{'role':_0xc5d6('0x1a'),'chanspy':!![]},'raw':!![]})[_0xc5d6('0x1b')](function(_0x1afab1){if(_0x1afab1){return _0x2d58ff(getChanSpyApplications(_0x55806c,_0x1afab1));}return _0x2d58ff([]);})[_0xc5d6('0x1c')](function(_0x4e67ab){_0x137a8b(_0x4e67ab);});});};module[_0xc5d6('0x1d')]=function(_0x2bbee8,_0x386e9c){var _0x4e9f82=_0x2bbee8[_0xc5d6('0x1e')];return _0x2bbee8['define'](_0xc5d6('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eaac,_0x5b8623,_0x450ab8){return getChanSpyPromise(_0x4e9f82,_0x3eaac)[_0xc5d6('0x1b')](function(_0x3fa5a8){if(_0x3fa5a8&&_0x3fa5a8[_0xc5d6('0x17')]){return _0x4e9f82['VoiceExtension']['bulkCreate'](_0x3fa5a8);}})[_0xc5d6('0x1b')](function(){_0x450ab8();})[_0xc5d6('0x1c')](function(_0x2fcc2a){_0x450ab8(_0x2fcc2a);});},'afterUpdate':function(_0x5895e2,_0x20574b,_0x28aa6c){return _0x4e9f82[_0xc5d6('0x20')]['destroy']({'where':{'ChanSpyId':_0x5895e2['id']}})[_0xc5d6('0x1b')](function(){return getChanSpyPromise(_0x4e9f82,_0x5895e2);})['then'](function(_0x3fe5cf){if(_0x3fe5cf&&_0x3fe5cf[_0xc5d6('0x17')]){return _0x4e9f82[_0xc5d6('0x20')]['bulkCreate'](_0x3fe5cf);}})[_0xc5d6('0x1b')](function(){_0x28aa6c();})[_0xc5d6('0x1c')](function(_0x56c1d5){_0x28aa6c(_0x56c1d5);});},'afterDestroy':function(_0x4eaf6c,_0x4fba20,_0x1b0076){return _0x4e9f82[_0xc5d6('0x20')][_0xc5d6('0x21')]({'where':{'ChanSpyId':_0x4eaf6c['id']}})[_0xc5d6('0x1b')](function(){_0x1b0076();})[_0xc5d6('0x1c')](function(_0xb7de9){_0x1b0076(_0xb7de9);});}}});}; \ No newline at end of file +var _0xbcbe=['chanspy','record','merge','MixMonitor','recordingFormat','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','Set','CDR(type)=%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbcbe,0x1bd));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xebcb('0x0'));var util=require(_0xebcb('0x1'));var BPromise=require(_0xebcb('0x2'));var attributes=require(_0xebcb('0x3'));var getUserApplications=function(_0x40b2ad,_0x9f1e7,_0x48a20a){var _0x508cb8=0x1;var _0x1d11cc=[];var _0x287f02={'context':_0x9f1e7['context']||'from-sip','exten':util[_0xebcb('0x4')](_0xebcb('0x5'),_0x40b2ad[_0xebcb('0x6')],_0x48a20a),'type':_0xebcb('0x7'),'isApp':![],'ChanSpyId':_0x40b2ad['id'],'UserId':_0x9f1e7['id']};_0x1d11cc[_0xebcb('0x8')](_['merge']({'app':_0xebcb('0x9'),'appdata':util[_0xebcb('0x4')](_0xebcb('0xa'),_0xebcb('0xb')),'priority':_0x508cb8++},_0x287f02));if(_0x40b2ad[_0xebcb('0xc')]){_0x1d11cc[_0xebcb('0x8')](_[_0xebcb('0xd')]({'app':_0xebcb('0xe'),'appdata':util[_0xebcb('0x4')]('${UNIQUEID}.%s,ab',_0x40b2ad[_0xebcb('0xf')]),'priority':_0x508cb8++},_0x287f02));}if(_0x40b2ad['auth']){_0x1d11cc[_0xebcb('0x8')](_[_0xebcb('0xd')]({'app':'Authenticate','appdata':_0x40b2ad[_0xebcb('0x10')],'priority':_0x508cb8++},_0x287f02));}_0x1d11cc[_0xebcb('0x8')](_['merge']({'app':_0xebcb('0x11'),'appdata':util[_0xebcb('0x4')](_0xebcb('0x12'),_0x9f1e7[_0xebcb('0x13')],_0x40b2ad[_0xebcb('0x14')]?_0x40b2ad[_0xebcb('0x14')][_0xebcb('0x15')](''):''),'priority':_0x508cb8++},_0x287f02));if(_0x40b2ad[_0xebcb('0xc')]){_0x1d11cc[_0xebcb('0x8')](_[_0xebcb('0xd')]({'app':_0xebcb('0x16'),'priority':_0x508cb8++},_0x287f02));}return _0x1d11cc;};var getChanSpyApplications=function(_0x180158,_0xbacc6c){var _0x3f3ccb=[];for(var _0x287292=0x0,_0x2e9761=0x1;_0x287292<_0xbacc6c['length'];_0x287292++,_0x2e9761=0x1){_0x3f3ccb=_0x3f3ccb[_0xebcb('0x17')](getUserApplications(_0x180158,_0xbacc6c[_0x287292],_0xbacc6c[_0x287292][_0xebcb('0x18')]));if(_0xbacc6c[_0x287292][_0xebcb('0x18')]!=_0xbacc6c[_0x287292]['name']){_0x3f3ccb=_0x3f3ccb[_0xebcb('0x17')](getUserApplications(_0x180158,_0xbacc6c[_0x287292],_0xbacc6c[_0x287292][_0xebcb('0x13')]));}}return _0x3f3ccb;};var getChanSpyPromise=function(_0x45b3cb,_0x2046e8){return new BPromise(function(_0x1e7e92,_0x3b5e00){return _0x45b3cb[_0xebcb('0x19')][_0xebcb('0x1a')]({'attributes':['id',_0xebcb('0x13'),_0xebcb('0x18')],'where':{'role':_0xebcb('0x1b'),'chanspy':!![]},'raw':!![]})[_0xebcb('0x1c')](function(_0x18b3d6){if(_0x18b3d6){return _0x1e7e92(getChanSpyApplications(_0x2046e8,_0x18b3d6));}return _0x1e7e92([]);})[_0xebcb('0x1d')](function(_0x2a229d){_0x3b5e00(_0x2a229d);});});};module[_0xebcb('0x1e')]=function(_0x52951b,_0x253bd0){var _0x2f81e4=_0x52951b[_0xebcb('0x1f')];return _0x52951b['define'](_0xebcb('0x20'),attributes,{'tableName':_0xebcb('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x247738,_0x2f92a3,_0xcd0dac){return getChanSpyPromise(_0x2f81e4,_0x247738)[_0xebcb('0x1c')](function(_0x3804dd){if(_0x3804dd&&_0x3804dd[_0xebcb('0x22')]){return _0x2f81e4[_0xebcb('0x23')]['bulkCreate'](_0x3804dd);}})[_0xebcb('0x1c')](function(){_0xcd0dac();})['catch'](function(_0xd84aad){_0xcd0dac(_0xd84aad);});},'afterUpdate':function(_0x133b8f,_0x4bad3c,_0x2a8ef8){return _0x2f81e4[_0xebcb('0x23')][_0xebcb('0x24')]({'where':{'ChanSpyId':_0x133b8f['id']}})[_0xebcb('0x1c')](function(){return getChanSpyPromise(_0x2f81e4,_0x133b8f);})[_0xebcb('0x1c')](function(_0x4e835c){if(_0x4e835c&&_0x4e835c[_0xebcb('0x22')]){return _0x2f81e4[_0xebcb('0x23')][_0xebcb('0x25')](_0x4e835c);}})[_0xebcb('0x1c')](function(){_0x2a8ef8();})[_0xebcb('0x1d')](function(_0x1d351f){_0x2a8ef8(_0x1d351f);});},'afterDestroy':function(_0x426d15,_0x15356b,_0x1a2707){return _0x2f81e4[_0xebcb('0x23')]['destroy']({'where':{'ChanSpyId':_0x426d15['id']}})[_0xebcb('0x1c')](function(){_0x1a2707();})['catch'](function(_0x29e73e){_0x1a2707(_0x29e73e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 10ea8fd..78b06ac 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 _0xb941=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','stringify','code','error','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xb941,0x1ec));var _0x1b94=function(_0x1476a4,_0x382d8f){_0x1476a4=_0x1476a4-0x0;var _0x47ff87=_0xb941[_0x1476a4];return _0x47ff87;};'use strict';var _=require(_0x1b94('0x0'));var util=require(_0x1b94('0x1'));var moment=require('moment');var BPromise=require(_0x1b94('0x2'));var rs=require(_0x1b94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b94('0x4'))['db'];var utils=require(_0x1b94('0x5'));var logger=require(_0x1b94('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1b94('0x7')][_0x1b94('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x152ac8,_0x11e377,_0x47de06){return new BPromise(function(_0x33b924,_0x458bb7){return client[_0x1b94('0x9')](_0x152ac8,_0x47de06)[_0x1b94('0xa')](function(_0x2428d1){logger[_0x1b94('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x11e377,_0x1b94('0xc'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x11e377,_0x1b94('0xc'),JSON[_0x1b94('0xd')](_0x2428d1));if(_0x2428d1['error']){if(_0x2428d1['error'][_0x1b94('0xe')]===0x1f4){logger[_0x1b94('0xf')](_0x1b94('0x10'),_0x11e377,_0x2428d1[_0x1b94('0xf')][_0x1b94('0x11')]);return _0x458bb7(_0x2428d1[_0x1b94('0xf')][_0x1b94('0x11')]);}logger[_0x1b94('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x11e377,_0x2428d1['error'][_0x1b94('0x11')]);return _0x33b924(_0x2428d1['error'][_0x1b94('0x11')]);}else{logger['info'](_0x1b94('0x10'),_0x11e377,_0x1b94('0xc'));_0x33b924(_0x2428d1['result'][_0x1b94('0x11')]);}})[_0x1b94('0x12')](function(_0x36e4a0){logger[_0x1b94('0xf')](_0x1b94('0x10'),_0x11e377,_0x36e4a0);_0x458bb7(_0x36e4a0);});});} \ No newline at end of file +var _0x81e9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x81e9,0x104));var _0x981e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x81e9[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x981e('0x0'));var util=require(_0x981e('0x1'));var moment=require(_0x981e('0x2'));var BPromise=require(_0x981e('0x3'));var rs=require(_0x981e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x981e('0x5'))['db'];var utils=require(_0x981e('0x6'));var logger=require(_0x981e('0x7'))(_0x981e('0x8'));var config=require(_0x981e('0x9'));var jayson=require(_0x981e('0xa'));var client=jayson[_0x981e('0xb')][_0x981e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1df03f,_0x11dad0,_0x265834){return new BPromise(function(_0x3b97e5,_0x43164e){return client['request'](_0x1df03f,_0x265834)[_0x981e('0xd')](function(_0x19f347){logger[_0x981e('0xe')](_0x981e('0xf'),_0x11dad0,_0x981e('0x10'));logger[_0x981e('0x11')](_0x981e('0x12'),_0x11dad0,_0x981e('0x10'),JSON[_0x981e('0x13')](_0x19f347));if(_0x19f347[_0x981e('0x14')]){if(_0x19f347[_0x981e('0x14')]['code']===0x1f4){logger[_0x981e('0x14')](_0x981e('0xf'),_0x11dad0,_0x19f347[_0x981e('0x14')][_0x981e('0x15')]);return _0x43164e(_0x19f347['error']['message']);}logger[_0x981e('0x14')](_0x981e('0xf'),_0x11dad0,_0x19f347[_0x981e('0x14')][_0x981e('0x15')]);return _0x3b97e5(_0x19f347[_0x981e('0x14')][_0x981e('0x15')]);}else{logger[_0x981e('0xe')](_0x981e('0xf'),_0x11dad0,_0x981e('0x10'));_0x3b97e5(_0x19f347[_0x981e('0x16')]['message']);}})[_0x981e('0x17')](function(_0x2c962e){logger[_0x981e('0x14')](_0x981e('0xf'),_0x11dad0,_0x2c962e);_0x43164e(_0x2c962e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4e0471f..beb570a 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 _0x5454=['index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','connect-timeout','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x5216e2,_0x45a440){var _0x29ec83=function(_0x3ff8d9){while(--_0x3ff8d9){_0x5216e2['push'](_0x5216e2['shift']());}};_0x29ec83(++_0x45a440);}(_0x5454,0x15b));var _0x4545=function(_0x541ef4,_0x3c5081){_0x541ef4=_0x541ef4-0x0;var _0x35f405=_0x5454[_0x541ef4];return _0x35f405;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4545('0x0'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4545('0x1'));var config=require(_0x4545('0x2'));var controller=require(_0x4545('0x3'));router[_0x4545('0x4')]('/',auth['isAuthenticated'](),controller[_0x4545('0x5')]);router[_0x4545('0x4')](_0x4545('0x6'),auth[_0x4545('0x7')](),controller[_0x4545('0x8')]);router[_0x4545('0x9')]('/',auth[_0x4545('0x7')](),controller[_0x4545('0xa')]);router[_0x4545('0xb')](_0x4545('0x6'),auth[_0x4545('0x7')](),controller[_0x4545('0xc')]);router[_0x4545('0xd')]('/:id',auth[_0x4545('0x7')](),controller[_0x4545('0xe')]);module[_0x4545('0xf')]=router; \ No newline at end of file +var _0xdeb3=['get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x2bbe1a,_0x180994){var _0x57714b=function(_0x4656f9){while(--_0x4656f9){_0x2bbe1a['push'](_0x2bbe1a['shift']());}};_0x57714b(++_0x180994);}(_0xdeb3,0xb7));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x3deb('0x0'));var path=require(_0x3deb('0x1'));var timeout=require(_0x3deb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3deb('0x3'));var interaction=require(_0x3deb('0x4'));var config=require(_0x3deb('0x5'));var controller=require(_0x3deb('0x6'));router[_0x3deb('0x7')]('/',auth['isAuthenticated'](),controller[_0x3deb('0x8')]);router['get'](_0x3deb('0x9'),auth['isAuthenticated'](),controller[_0x3deb('0xa')]);router[_0x3deb('0xb')]('/',auth[_0x3deb('0xc')](),controller[_0x3deb('0xd')]);router[_0x3deb('0xe')](_0x3deb('0x9'),auth[_0x3deb('0xc')](),controller[_0x3deb('0xf')]);router[_0x3deb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3deb('0x11')]);module[_0x3deb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index bc2a29f..10a88cc 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 _0xf4ef=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xf4ef,0x188));var _0xff4e=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xf4ef[_0x15876a];return _0xbd900f;};'use strict';var Sequelize=require(_0xff4e('0x0'));module[_0xff4e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xff4e('0x2')},'description':{'type':Sequelize[_0xff4e('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xff4e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x059a=['name','BOOLEAN','sequelize','exports'];(function(_0x13161e,_0x5f34ff){var _0x360d68=function(_0x57111d){while(--_0x57111d){_0x13161e['push'](_0x13161e['shift']());}};_0x360d68(++_0x5f34ff);}(_0x059a,0x126));var _0xa059=function(_0x375c0b,_0x567d67){_0x375c0b=_0x375c0b-0x0;var _0x4c4bec=_0x059a[_0x375c0b];return _0x4c4bec;};'use strict';var Sequelize=require(_0xa059('0x0'));module[_0xa059('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa059('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa059('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 a8b3628..912f874 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 _0xafb9=['render','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','message','result','status','end','count','offset','set','Content-Range','reject','save','update','then','destroy','get','sendStatus','stack','name','send','VoiceContext','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','map','type','VIRTUAL','field','merge','options','includeAll','findAll','rows','catch','show','length','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join'];(function(_0x1df0a3,_0x5ed4e8){var _0x388db8=function(_0x3be3c7){while(--_0x3be3c7){_0x1df0a3['push'](_0x1df0a3['shift']());}};_0x388db8(++_0x5ed4e8);}(_0xafb9,0x68));var _0x9afb=function(_0x1c71c4,_0x53ab22){_0x1c71c4=_0x1c71c4-0x0;var _0x154d94=_0xafb9[_0x1c71c4];return _0x154d94;};'use strict';var pdf=require(_0x9afb('0x0'));var emlformat=require(_0x9afb('0x1'));var rimraf=require(_0x9afb('0x2'));var zipdir=require(_0x9afb('0x3'));var jsonpatch=require(_0x9afb('0x4'));var rp=require(_0x9afb('0x5'));var moment=require(_0x9afb('0x6'));var BPromise=require(_0x9afb('0x7'));var Mustache=require(_0x9afb('0x8'));var util=require('util');var path=require('path');var sox=require(_0x9afb('0x9'));var csv=require('to-csv');var ejs=require(_0x9afb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9afb('0xb'));var jsforce=require(_0x9afb('0xc'));var deskjs=require(_0x9afb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9afb('0xe'));var Papa=require(_0x9afb('0xf'));var Redis=require(_0x9afb('0x10'));var authService=require(_0x9afb('0x11'));var qs=require(_0x9afb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9afb('0x13'));var utils=require(_0x9afb('0x14'));var config=require(_0x9afb('0x15'));var db=require(_0x9afb('0x16'))['db'];var jayson=require(_0x9afb('0x17'));var client=jayson[_0x9afb('0x18')][_0x9afb('0x19')]({'port':0x232a});function checkPasswordPattern(_0x34e849,_0x464462,_0x10602b){if(_0x10602b){var _0x47a804=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47a804[_0x9afb('0x1a')](_0x464462)){return _0x34e849;}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 _0x34e849;}}function respondWithRpcPromise(_0x59fd82,_0x2f286f,_0x3e40c1,_0x3c8d2e){return new BPromise(function(_0x2d664d,_0x46b16f){var _0x39cdf1=_0x3c8d2e||client;return _0x39cdf1[_0x9afb('0x1b')](_0x59fd82,_0x3e40c1)['then'](function(_0x18505a){logger[_0x9afb('0x1c')](_0x9afb('0x1d'),_0x2f286f,_0x9afb('0x1e'));logger[_0x9afb('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2f286f,_0x9afb('0x1e'),JSON['stringify'](_0x18505a));if(_0x18505a[_0x9afb('0x20')]){if(_0x18505a[_0x9afb('0x20')]['code']===0x1f4){logger['error'](_0x9afb('0x1d'),_0x2f286f,_0x18505a[_0x9afb('0x20')][_0x9afb('0x21')]);return _0x46b16f(_0x18505a[_0x9afb('0x20')][_0x9afb('0x21')]);}logger['error'](_0x9afb('0x1d'),_0x2f286f,_0x18505a['error']['message']);return _0x2d664d(_0x18505a[_0x9afb('0x20')][_0x9afb('0x21')]);}else{logger[_0x9afb('0x1c')](_0x9afb('0x1d'),_0x2f286f,'request\x20sent');_0x2d664d(_0x18505a[_0x9afb('0x22')][_0x9afb('0x21')]);}})['catch'](function(_0x571bd9){logger['error'](_0x9afb('0x1d'),_0x2f286f,_0x571bd9);_0x46b16f(_0x571bd9);});});}function respondWithStatusCode(_0x4fbe61,_0x387379){_0x387379=_0x387379||0xcc;return function(_0x123510){if(_0x123510){return _0x4fbe61['sendStatus'](_0x387379);}return _0x4fbe61[_0x9afb('0x23')](_0x387379)[_0x9afb('0x24')]();};}function respondWithResult(_0x1bdf48,_0x337d81){_0x337d81=_0x337d81||0xc8;return function(_0x530fbe){if(_0x530fbe){return _0x1bdf48[_0x9afb('0x23')](_0x337d81)['json'](_0x530fbe);}};}function respondWithFilteredResult(_0x29e092,_0x4ad975){return function(_0x5692fa){if(_0x5692fa){var _0x1e6100=_0x5692fa[_0x9afb('0x25')],_0x304104=_0x4ad975[_0x9afb('0x26')],_0x30af1b=_0x4ad975[_0x9afb('0x26')]+_0x4ad975['limit'],_0x13a33e;if(_0x30af1b>=_0x1e6100){_0x30af1b=_0x1e6100;_0x13a33e=0xc8;}else{_0x13a33e=0xce;}_0x29e092['status'](_0x13a33e);return _0x29e092[_0x9afb('0x27')](_0x9afb('0x28'),_0x304104+'-'+_0x30af1b+'/'+_0x1e6100)['json'](_0x5692fa);}return null;};}function patchUpdates(_0x1d0bed){return function(_0x2f388c){try{jsonpatch['apply'](_0x2f388c,_0x1d0bed,!![]);}catch(_0x1b9f18){return BPromise[_0x9afb('0x29')](_0x1b9f18);}return _0x2f388c[_0x9afb('0x2a')]();};}function saveUpdates(_0x3dec39,_0x467cdf){return function(_0x131204){if(_0x131204){return _0x131204[_0x9afb('0x2b')](_0x3dec39)[_0x9afb('0x2c')](function(_0x57fcc5){return _0x57fcc5;});}return null;};}function removeEntity(_0x488a35,_0xd9ed22){return function(_0x1e377c){if(_0x1e377c){return _0x1e377c[_0x9afb('0x2d')]()[_0x9afb('0x2c')](function(){var _0x1a8d78=_0x1e377c[_0x9afb('0x2e')]({'plain':!![]});var _0x2f92e4='Contexts';return db['UserProfileResource'][_0x9afb('0x2d')]({'where':{'type':_0x2f92e4,'resourceId':_0x1a8d78['id']}})[_0x9afb('0x2c')](function(){return _0x1e377c;});})['then'](function(){_0x488a35[_0x9afb('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f736b,_0xc59d55){return function(_0x5bc548){if(!_0x5bc548){_0x2f736b[_0x9afb('0x2f')](0x194);}return _0x5bc548;};}function handleError(_0x51c8a9,_0x199756){_0x199756=_0x199756||0x1f4;return function(_0x2e8e87){logger[_0x9afb('0x20')](_0x2e8e87[_0x9afb('0x30')]);if(_0x2e8e87[_0x9afb('0x31')]){delete _0x2e8e87[_0x9afb('0x31')];}_0x51c8a9[_0x9afb('0x23')](_0x199756)[_0x9afb('0x32')](_0x2e8e87);};}exports['index']=function(_0x3790fd,_0x52748b){var _0x44b2d1={},_0x6ac20f={},_0x3c5231={'count':0x0,'rows':[]};var _0x306287=db[_0x9afb('0x33')][_0x9afb('0x34')];_0x6ac20f[_0x9afb('0x35')]=_[_0x9afb('0x36')](_0x306287);_0x6ac20f[_0x9afb('0x37')]=_['keys'](_0x3790fd[_0x9afb('0x37')]);_0x6ac20f['filters']=_[_0x9afb('0x38')](_0x6ac20f[_0x9afb('0x35')],_0x6ac20f[_0x9afb('0x37')]);_0x44b2d1['attributes']=_[_0x9afb('0x38')](_0x6ac20f[_0x9afb('0x35')],qs[_0x9afb('0x39')](_0x3790fd[_0x9afb('0x37')][_0x9afb('0x39')]));_0x44b2d1[_0x9afb('0x3a')]=_0x44b2d1[_0x9afb('0x3a')]['length']?_0x44b2d1[_0x9afb('0x3a')]:_0x6ac20f[_0x9afb('0x35')];if(!_0x3790fd[_0x9afb('0x37')][_0x9afb('0x3b')](_0x9afb('0x3c'))){_0x44b2d1[_0x9afb('0x3d')]=qs[_0x9afb('0x3d')](_0x3790fd[_0x9afb('0x37')]['limit']);_0x44b2d1[_0x9afb('0x26')]=qs['offset'](_0x3790fd['query']['offset']);}_0x44b2d1[_0x9afb('0x3e')]=qs[_0x9afb('0x3f')](_0x3790fd['query'][_0x9afb('0x3f')]);_0x44b2d1[_0x9afb('0x40')]=qs[_0x9afb('0x41')](_[_0x9afb('0x42')](_0x3790fd[_0x9afb('0x37')],_0x6ac20f[_0x9afb('0x41')]));if(_0x3790fd[_0x9afb('0x37')][_0x9afb('0x43')]){_0x44b2d1[_0x9afb('0x40')]=_['merge'](_0x44b2d1[_0x9afb('0x40')],{'$or':_[_0x9afb('0x44')](_0x306287,function(_0x164fa4){if(_0x164fa4[_0x9afb('0x45')]['key']!==_0x9afb('0x46')){var _0x381033={};_0x381033[_0x164fa4[_0x9afb('0x47')]]={'$like':'%'+_0x3790fd['query'][_0x9afb('0x43')]+'%'};return _0x381033;}})});}_0x44b2d1=_[_0x9afb('0x48')]({},_0x44b2d1,_0x3790fd[_0x9afb('0x49')]);var _0x12eddf={'where':_0x44b2d1[_0x9afb('0x40')]};return db[_0x9afb('0x33')][_0x9afb('0x25')](_0x12eddf)['then'](function(_0x5a36e4){_0x3c5231['count']=_0x5a36e4;if(_0x3790fd[_0x9afb('0x37')][_0x9afb('0x4a')]){_0x44b2d1['include']=[{'all':!![]}];}return db[_0x9afb('0x33')][_0x9afb('0x4b')](_0x44b2d1);})[_0x9afb('0x2c')](function(_0x3b2c71){_0x3c5231[_0x9afb('0x4c')]=_0x3b2c71;return _0x3c5231;})[_0x9afb('0x2c')](respondWithFilteredResult(_0x52748b,_0x44b2d1))[_0x9afb('0x4d')](handleError(_0x52748b,null));};exports[_0x9afb('0x4e')]=function(_0x20abe4,_0x215764){var _0x12594c={'raw':![],'where':{'id':_0x20abe4['params']['id']}},_0x47df73={};_0x47df73[_0x9afb('0x35')]=_['keys'](db[_0x9afb('0x33')][_0x9afb('0x34')]);_0x47df73[_0x9afb('0x37')]=_[_0x9afb('0x36')](_0x20abe4[_0x9afb('0x37')]);_0x47df73['filters']=_[_0x9afb('0x38')](_0x47df73['model'],_0x47df73[_0x9afb('0x37')]);_0x12594c[_0x9afb('0x3a')]=_[_0x9afb('0x38')](_0x47df73[_0x9afb('0x35')],qs[_0x9afb('0x39')](_0x20abe4[_0x9afb('0x37')][_0x9afb('0x39')]));_0x12594c['attributes']=_0x12594c[_0x9afb('0x3a')][_0x9afb('0x4f')]?_0x12594c[_0x9afb('0x3a')]:_0x47df73['model'];if(_0x20abe4[_0x9afb('0x37')][_0x9afb('0x4a')]){_0x12594c['include']=[{'all':!![]}];}_0x12594c=_[_0x9afb('0x48')]({},_0x12594c,_0x20abe4[_0x9afb('0x49')]);return db[_0x9afb('0x33')]['find'](_0x12594c)[_0x9afb('0x2c')](handleEntityNotFound(_0x215764,null))[_0x9afb('0x2c')](respondWithResult(_0x215764,null))['catch'](handleError(_0x215764,null));};exports['create']=function(_0x54d3ba,_0x1ddab6,_0x4be509){var _0xce2e33;return db['VoiceContext'][_0x9afb('0x50')](_0x54d3ba[_0x9afb('0x51')],{'raw':!![]})[_0x9afb('0x2c')](function(_0x52a9cd){_0xce2e33=_0x52a9cd;return db[_0x9afb('0x33')][_0x9afb('0x4b')]({'raw':!![]});})[_0x9afb('0x2c')](function(_0x2933dc){var _0x3aae71=fs[_0x9afb('0x52')](path['join'](config[_0x9afb('0x53')],_0x9afb('0x54')),_0x9afb('0x55'));var _0x1e8f7c=ejs['render'](_0x3aae71,{'contexts':_0x2933dc||[]});fs[_0x9afb('0x56')](_0x9afb('0x57'),_0x1e8f7c);})['then'](function(){return respondWithRpcPromise(_0x9afb('0x58'),_0x9afb('0x50'),{'module':_0x9afb('0x59')});})['then'](function(){var _0x347ce8=_0x54d3ba[_0x9afb('0x5a')][_0x9afb('0x2e')]({'plain':!![]});if(!_0x347ce8)throw new Error(_0x9afb('0x5b'));if(_0x347ce8[_0x9afb('0x5c')]===_0x9afb('0x5a')){var _0x19bd41=_0xce2e33[_0x9afb('0x2e')]({'plain':!![]});return db[_0x9afb('0x5d')][_0x9afb('0x5e')]({'where':{'name':_0x9afb('0x5f'),'userProfileId':_0x347ce8[_0x9afb('0x60')]},'raw':!![]})[_0x9afb('0x2c')](function(_0x5b2014){if(_0x5b2014&&_0x5b2014[_0x9afb('0x61')]===0x0){return db[_0x9afb('0x62')]['create']({'name':_0x19bd41[_0x9afb('0x31')],'resourceId':_0x19bd41['id'],'type':_0x5b2014[_0x9afb('0x31')],'sectionId':_0x5b2014['id']},{})['then'](function(){return _0xce2e33;});}else{return _0xce2e33;}})['catch'](function(_0xb1c5db){logger[_0x9afb('0x20')](_0x9afb('0x63'),_0xb1c5db);throw _0xb1c5db;});}return _0xce2e33;})[_0x9afb('0x2c')](respondWithResult(_0x1ddab6,0xc9))[_0x9afb('0x4d')](handleError(_0x1ddab6,null));};exports['update']=function(_0x29e409,_0x1ecde6,_0x1bcdf4){var _0x620c09;return db[_0x9afb('0x33')][_0x9afb('0x5e')]({'where':{'id':_0x29e409[_0x9afb('0x64')]['id']}})[_0x9afb('0x2c')](handleEntityNotFound(_0x1ecde6,null))['then'](saveUpdates(_0x29e409[_0x9afb('0x51')],null))['then'](function(_0x17aabc){if(_0x17aabc){_0x620c09=_0x17aabc;return db[_0x9afb('0x33')][_0x9afb('0x4b')]({'raw':!![]});}})[_0x9afb('0x2c')](function(_0x20b9d4){var _0x5dd4ee=fs['readFileSync'](path[_0x9afb('0x65')](config[_0x9afb('0x53')],_0x9afb('0x54')),_0x9afb('0x55'));var _0x1ecbd1=ejs['render'](_0x5dd4ee,{'contexts':_0x20b9d4||[]});fs[_0x9afb('0x56')](_0x9afb('0x57'),_0x1ecbd1);})['then'](function(){return respondWithRpcPromise(_0x9afb('0x58'),_0x9afb('0x2b'),{'module':'chan_sip.so'});})[_0x9afb('0x2c')](function(){return _0x620c09;})[_0x9afb('0x2c')](respondWithResult(_0x1ecde6,null))['catch'](handleError(_0x1ecde6,null));};exports[_0x9afb('0x2d')]=function(_0x5d4578,_0x2ba7c6,_0x112359){var _0x5d71a3;return db[_0x9afb('0x33')][_0x9afb('0x5e')]({'where':{'id':_0x5d4578['params']['id']}})['then'](handleEntityNotFound(_0x2ba7c6,null))[_0x9afb('0x2c')](removeEntity(_0x2ba7c6,null))[_0x9afb('0x2c')](function(){return db[_0x9afb('0x33')]['findAll']({'raw':!![]});})[_0x9afb('0x2c')](function(_0x33060b){var _0x277bc0=fs[_0x9afb('0x52')](path[_0x9afb('0x65')](config[_0x9afb('0x53')],_0x9afb('0x54')),_0x9afb('0x55'));var _0x1c2350=ejs[_0x9afb('0x66')](_0x277bc0,{'contexts':_0x33060b});fs['writeFileSync'](_0x9afb('0x57'),_0x1c2350);return respondWithRpcPromise('Reload',_0x9afb('0x2d'),{'module':_0x9afb('0x59')});})[_0x9afb('0x4d')](handleError(_0x2ba7c6,null));}; \ No newline at end of file +var _0x1883=['offset','limit','set','json','apply','reject','save','update','destroy','get','Contexts','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','VoiceContext','includeAll','include','findAll','rows','show','params','find','create','readFileSync','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','writeFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x1883,0xab));var _0x3188=function(_0xd0a593,_0x3b2721){_0xd0a593=_0xd0a593-0x0;var _0x35eefc=_0x1883[_0xd0a593];return _0x35eefc;};'use strict';var pdf=require(_0x3188('0x0'));var emlformat=require(_0x3188('0x1'));var rimraf=require(_0x3188('0x2'));var zipdir=require(_0x3188('0x3'));var jsonpatch=require(_0x3188('0x4'));var rp=require(_0x3188('0x5'));var moment=require(_0x3188('0x6'));var BPromise=require(_0x3188('0x7'));var Mustache=require(_0x3188('0x8'));var util=require(_0x3188('0x9'));var path=require(_0x3188('0xa'));var sox=require(_0x3188('0xb'));var csv=require(_0x3188('0xc'));var ejs=require(_0x3188('0xd'));var fs=require('fs');var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xc'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var hardwareService=require(_0x3188('0x15'));var logger=require(_0x3188('0x16'))('api');var utils=require(_0x3188('0x17'));var config=require(_0x3188('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3188('0x19')][_0x3188('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x20fef6,_0x3ae228,_0x4bb424){if(_0x4bb424){var _0xc01ce6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc01ce6['test'](_0x3ae228)){return _0x20fef6;}else{throw new Error(_0x3188('0x1b'));}}else{return _0x20fef6;}}function respondWithRpcPromise(_0x5e0044,_0x4a2f36,_0x1b8a18,_0x53668b){return new BPromise(function(_0x54a87f,_0x32c239){var _0x1beead=_0x53668b||client;return _0x1beead[_0x3188('0x1c')](_0x5e0044,_0x1b8a18)[_0x3188('0x1d')](function(_0x145293){logger[_0x3188('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4a2f36,_0x3188('0x1f'));logger[_0x3188('0x20')](_0x3188('0x21'),_0x4a2f36,_0x3188('0x1f'),JSON[_0x3188('0x22')](_0x145293));if(_0x145293[_0x3188('0x23')]){if(_0x145293[_0x3188('0x23')][_0x3188('0x24')]===0x1f4){logger['error'](_0x3188('0x25'),_0x4a2f36,_0x145293[_0x3188('0x23')]['message']);return _0x32c239(_0x145293['error']['message']);}logger[_0x3188('0x23')](_0x3188('0x25'),_0x4a2f36,_0x145293[_0x3188('0x23')]['message']);return _0x54a87f(_0x145293['error'][_0x3188('0x26')]);}else{logger[_0x3188('0x1e')](_0x3188('0x25'),_0x4a2f36,_0x3188('0x1f'));_0x54a87f(_0x145293[_0x3188('0x27')]['message']);}})[_0x3188('0x28')](function(_0x33f882){logger['error'](_0x3188('0x25'),_0x4a2f36,_0x33f882);_0x32c239(_0x33f882);});});}function respondWithStatusCode(_0x4be6c3,_0x5c69be){_0x5c69be=_0x5c69be||0xcc;return function(_0x45ae2f){if(_0x45ae2f){return _0x4be6c3[_0x3188('0x29')](_0x5c69be);}return _0x4be6c3[_0x3188('0x2a')](_0x5c69be)[_0x3188('0x2b')]();};}function respondWithResult(_0x336be5,_0x2cd060){_0x2cd060=_0x2cd060||0xc8;return function(_0xe57f73){if(_0xe57f73){return _0x336be5[_0x3188('0x2a')](_0x2cd060)['json'](_0xe57f73);}};}function respondWithFilteredResult(_0x2cc5d9,_0x2d000a){return function(_0x52bb13){if(_0x52bb13){var _0xd3ee40=_0x52bb13[_0x3188('0x2c')],_0x14299b=_0x2d000a[_0x3188('0x2d')],_0x43399d=_0x2d000a[_0x3188('0x2d')]+_0x2d000a[_0x3188('0x2e')],_0x44db9a;if(_0x43399d>=_0xd3ee40){_0x43399d=_0xd3ee40;_0x44db9a=0xc8;}else{_0x44db9a=0xce;}_0x2cc5d9['status'](_0x44db9a);return _0x2cc5d9[_0x3188('0x2f')]('Content-Range',_0x14299b+'-'+_0x43399d+'/'+_0xd3ee40)[_0x3188('0x30')](_0x52bb13);}return null;};}function patchUpdates(_0x5623f1){return function(_0x3f82ce){try{jsonpatch[_0x3188('0x31')](_0x3f82ce,_0x5623f1,!![]);}catch(_0x3be4f7){return BPromise[_0x3188('0x32')](_0x3be4f7);}return _0x3f82ce[_0x3188('0x33')]();};}function saveUpdates(_0x263892,_0x2461e2){return function(_0x279069){if(_0x279069){return _0x279069[_0x3188('0x34')](_0x263892)[_0x3188('0x1d')](function(_0x7c23b1){return _0x7c23b1;});}return null;};}function removeEntity(_0x2d86fa,_0x2c1d68){return function(_0x461c3d){if(_0x461c3d){return _0x461c3d[_0x3188('0x35')]()[_0x3188('0x1d')](function(){var _0x244f58=_0x461c3d[_0x3188('0x36')]({'plain':!![]});var _0x5866bd=_0x3188('0x37');return db['UserProfileResource'][_0x3188('0x35')]({'where':{'type':_0x5866bd,'resourceId':_0x244f58['id']}})[_0x3188('0x1d')](function(){return _0x461c3d;});})['then'](function(){_0x2d86fa[_0x3188('0x2a')](0xcc)[_0x3188('0x2b')]();});}};}function handleEntityNotFound(_0x1d5695,_0x6d503d){return function(_0xa14c93){if(!_0xa14c93){_0x1d5695[_0x3188('0x29')](0x194);}return _0xa14c93;};}function handleError(_0x2bef8e,_0x51b7a9){_0x51b7a9=_0x51b7a9||0x1f4;return function(_0x4e4710){logger[_0x3188('0x23')](_0x4e4710[_0x3188('0x38')]);if(_0x4e4710[_0x3188('0x39')]){delete _0x4e4710[_0x3188('0x39')];}_0x2bef8e['status'](_0x51b7a9)[_0x3188('0x3a')](_0x4e4710);};}exports[_0x3188('0x3b')]=function(_0x25ad4c,_0x2dc80b){var _0x4fbc25={},_0x201ef2={},_0x4a290f={'count':0x0,'rows':[]};var _0x130e73=db['VoiceContext'][_0x3188('0x3c')];_0x201ef2[_0x3188('0x3d')]=_[_0x3188('0x3e')](_0x130e73);_0x201ef2[_0x3188('0x3f')]=_[_0x3188('0x3e')](_0x25ad4c[_0x3188('0x3f')]);_0x201ef2[_0x3188('0x40')]=_[_0x3188('0x41')](_0x201ef2[_0x3188('0x3d')],_0x201ef2[_0x3188('0x3f')]);_0x4fbc25['attributes']=_[_0x3188('0x41')](_0x201ef2[_0x3188('0x3d')],qs[_0x3188('0x42')](_0x25ad4c[_0x3188('0x3f')][_0x3188('0x42')]));_0x4fbc25[_0x3188('0x43')]=_0x4fbc25['attributes'][_0x3188('0x44')]?_0x4fbc25['attributes']:_0x201ef2[_0x3188('0x3d')];if(!_0x25ad4c[_0x3188('0x3f')][_0x3188('0x45')](_0x3188('0x46'))){_0x4fbc25[_0x3188('0x2e')]=qs['limit'](_0x25ad4c['query']['limit']);_0x4fbc25['offset']=qs['offset'](_0x25ad4c[_0x3188('0x3f')][_0x3188('0x2d')]);}_0x4fbc25[_0x3188('0x47')]=qs[_0x3188('0x48')](_0x25ad4c[_0x3188('0x3f')]['sort']);_0x4fbc25[_0x3188('0x49')]=qs['filters'](_[_0x3188('0x4a')](_0x25ad4c[_0x3188('0x3f')],_0x201ef2[_0x3188('0x40')]));if(_0x25ad4c[_0x3188('0x3f')]['filter']){_0x4fbc25[_0x3188('0x49')]=_[_0x3188('0x4b')](_0x4fbc25[_0x3188('0x49')],{'$or':_[_0x3188('0x4c')](_0x130e73,function(_0x42d365){if(_0x42d365['type']['key']!==_0x3188('0x4d')){var _0x24bc8a={};_0x24bc8a[_0x42d365['field']]={'$like':'%'+_0x25ad4c[_0x3188('0x3f')][_0x3188('0x4e')]+'%'};return _0x24bc8a;}})});}_0x4fbc25=_['merge']({},_0x4fbc25,_0x25ad4c[_0x3188('0x4f')]);var _0x16a9d3={'where':_0x4fbc25[_0x3188('0x49')]};return db[_0x3188('0x50')][_0x3188('0x2c')](_0x16a9d3)['then'](function(_0x467ead){_0x4a290f['count']=_0x467ead;if(_0x25ad4c[_0x3188('0x3f')][_0x3188('0x51')]){_0x4fbc25[_0x3188('0x52')]=[{'all':!![]}];}return db[_0x3188('0x50')][_0x3188('0x53')](_0x4fbc25);})[_0x3188('0x1d')](function(_0x2aa232){_0x4a290f[_0x3188('0x54')]=_0x2aa232;return _0x4a290f;})[_0x3188('0x1d')](respondWithFilteredResult(_0x2dc80b,_0x4fbc25))[_0x3188('0x28')](handleError(_0x2dc80b,null));};exports[_0x3188('0x55')]=function(_0x50c08d,_0x50fd56){var _0x1b012d={'raw':![],'where':{'id':_0x50c08d[_0x3188('0x56')]['id']}},_0x494c60={};_0x494c60[_0x3188('0x3d')]=_['keys'](db[_0x3188('0x50')][_0x3188('0x3c')]);_0x494c60[_0x3188('0x3f')]=_[_0x3188('0x3e')](_0x50c08d[_0x3188('0x3f')]);_0x494c60[_0x3188('0x40')]=_[_0x3188('0x41')](_0x494c60[_0x3188('0x3d')],_0x494c60['query']);_0x1b012d[_0x3188('0x43')]=_[_0x3188('0x41')](_0x494c60['model'],qs[_0x3188('0x42')](_0x50c08d['query'][_0x3188('0x42')]));_0x1b012d[_0x3188('0x43')]=_0x1b012d[_0x3188('0x43')]['length']?_0x1b012d['attributes']:_0x494c60['model'];if(_0x50c08d['query']['includeAll']){_0x1b012d[_0x3188('0x52')]=[{'all':!![]}];}_0x1b012d=_[_0x3188('0x4b')]({},_0x1b012d,_0x50c08d['options']);return db[_0x3188('0x50')][_0x3188('0x57')](_0x1b012d)['then'](handleEntityNotFound(_0x50fd56,null))['then'](respondWithResult(_0x50fd56,null))['catch'](handleError(_0x50fd56,null));};exports['create']=function(_0x502c42,_0x28717a,_0x4763a5){var _0x9860ab;return db[_0x3188('0x50')][_0x3188('0x58')](_0x502c42['body'],{'raw':!![]})[_0x3188('0x1d')](function(_0x2363bf){_0x9860ab=_0x2363bf;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x176da0){var _0x4168fe=fs[_0x3188('0x59')](path['join'](config[_0x3188('0x5a')],_0x3188('0x5b')),_0x3188('0x5c'));var _0x1dfdbf=ejs[_0x3188('0x5d')](_0x4168fe,{'contexts':_0x176da0||[]});fs['writeFileSync'](_0x3188('0x5e'),_0x1dfdbf);})[_0x3188('0x1d')](function(){return respondWithRpcPromise(_0x3188('0x5f'),'create',{'module':_0x3188('0x60')});})[_0x3188('0x1d')](function(){var _0x29eb0d=_0x502c42[_0x3188('0x61')]['get']({'plain':!![]});if(!_0x29eb0d)throw new Error(_0x3188('0x62'));if(_0x29eb0d[_0x3188('0x63')]===_0x3188('0x61')){var _0x19a36b=_0x9860ab[_0x3188('0x36')]({'plain':!![]});return db[_0x3188('0x64')][_0x3188('0x57')]({'where':{'name':'Contexts','userProfileId':_0x29eb0d[_0x3188('0x65')]},'raw':!![]})[_0x3188('0x1d')](function(_0x24eb76){if(_0x24eb76&&_0x24eb76[_0x3188('0x66')]===0x0){return db[_0x3188('0x67')][_0x3188('0x58')]({'name':_0x19a36b[_0x3188('0x39')],'resourceId':_0x19a36b['id'],'type':_0x24eb76['name'],'sectionId':_0x24eb76['id']},{})[_0x3188('0x1d')](function(){return _0x9860ab;});}else{return _0x9860ab;}})[_0x3188('0x28')](function(_0xc4a8c9){logger[_0x3188('0x23')](_0x3188('0x68'),_0xc4a8c9);throw _0xc4a8c9;});}return _0x9860ab;})['then'](respondWithResult(_0x28717a,0xc9))[_0x3188('0x28')](handleError(_0x28717a,null));};exports[_0x3188('0x34')]=function(_0x51a541,_0x4e4d50,_0xe888de){var _0x3631ec;return db[_0x3188('0x50')][_0x3188('0x57')]({'where':{'id':_0x51a541[_0x3188('0x56')]['id']}})[_0x3188('0x1d')](handleEntityNotFound(_0x4e4d50,null))[_0x3188('0x1d')](saveUpdates(_0x51a541[_0x3188('0x69')],null))[_0x3188('0x1d')](function(_0x248fce){if(_0x248fce){_0x3631ec=_0x248fce;return db['VoiceContext'][_0x3188('0x53')]({'raw':!![]});}})['then'](function(_0x4c90ff){var _0x4ad2c6=fs['readFileSync'](path[_0x3188('0x6a')](config[_0x3188('0x5a')],_0x3188('0x5b')),_0x3188('0x5c'));var _0x1aebe7=ejs[_0x3188('0x5d')](_0x4ad2c6,{'contexts':_0x4c90ff||[]});fs['writeFileSync'](_0x3188('0x5e'),_0x1aebe7);})[_0x3188('0x1d')](function(){return respondWithRpcPromise('Reload',_0x3188('0x34'),{'module':_0x3188('0x60')});})[_0x3188('0x1d')](function(){return _0x3631ec;})[_0x3188('0x1d')](respondWithResult(_0x4e4d50,null))[_0x3188('0x28')](handleError(_0x4e4d50,null));};exports[_0x3188('0x35')]=function(_0x54f790,_0x1ac95b,_0xf0b9eb){var _0x57bb84;return db[_0x3188('0x50')][_0x3188('0x57')]({'where':{'id':_0x54f790[_0x3188('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ac95b,null))[_0x3188('0x1d')](removeEntity(_0x1ac95b,null))[_0x3188('0x1d')](function(){return db[_0x3188('0x50')][_0x3188('0x53')]({'raw':!![]});})[_0x3188('0x1d')](function(_0x1bfd9b){var _0x192874=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0x3188('0x5c'));var _0x693395=ejs[_0x3188('0x5d')](_0x192874,{'contexts':_0x1bfd9b});fs[_0x3188('0x6b')](_0x3188('0x5e'),_0x693395);return respondWithRpcPromise('Reload',_0x3188('0x35'),{'module':'chan_sip.so'});})[_0x3188('0x28')](handleError(_0x1ac95b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 63ccbbe..6b57344 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 _0xd7b2=['bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0xc5784b,_0x273194){var _0x5abb33=function(_0x1ce0c1){while(--_0x1ce0c1){_0xc5784b['push'](_0xc5784b['shift']());}};_0x5abb33(++_0x273194);}(_0xd7b2,0x126));var _0x2d7b=function(_0x25bd73,_0x54ec91){_0x25bd73=_0x25bd73-0x0;var _0x425e8c=_0xd7b2[_0x25bd73];return _0x425e8c;};'use strict';var _=require(_0x2d7b('0x0'));var util=require(_0x2d7b('0x1'));var logger=require(_0x2d7b('0x2'))(_0x2d7b('0x3'));var moment=require(_0x2d7b('0x4'));var BPromise=require(_0x2d7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d7b('0x6'));var rimraf=require(_0x2d7b('0x7'));var config=require(_0x2d7b('0x8'));var attributes=require(_0x2d7b('0x9'));module[_0x2d7b('0xa')]=function(_0x2973cf,_0x5de475){return _0x2973cf['define'](_0x2d7b('0xb'),attributes,{'tableName':_0x2d7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc052=['bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','voice_contexts','lodash','util','../../config/logger','moment'];(function(_0x5093c2,_0x438dc8){var _0x8bf2f9=function(_0xb0189d){while(--_0xb0189d){_0x5093c2['push'](_0x5093c2['shift']());}};_0x8bf2f9(++_0x438dc8);}(_0xc052,0x15c));var _0x2c05=function(_0x362e0b,_0x12b2ec){_0x362e0b=_0x362e0b-0x0;var _0x5b593a=_0xc052[_0x362e0b];return _0x5b593a;};'use strict';var _=require(_0x2c05('0x0'));var util=require(_0x2c05('0x1'));var logger=require(_0x2c05('0x2'))('api');var moment=require(_0x2c05('0x3'));var BPromise=require(_0x2c05('0x4'));var rp=require(_0x2c05('0x5'));var fs=require('fs');var path=require(_0x2c05('0x6'));var rimraf=require('rimraf');var config=require(_0x2c05('0x7'));var attributes=require(_0x2c05('0x8'));module[_0x2c05('0x9')]=function(_0x4b1506,_0x4fb93e){return _0x4b1506['define']('VoiceContext',attributes,{'tableName':_0x2c05('0xa'),'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 1ebb615..bba76f1 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 _0x33d9=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x1faf01,_0x16d097){var _0xf8e389=function(_0x58a3df){while(--_0x58a3df){_0x1faf01['push'](_0x1faf01['shift']());}};_0xf8e389(++_0x16d097);}(_0x33d9,0x161));var _0x933d=function(_0x1282a0,_0x58b2f9){_0x1282a0=_0x1282a0-0x0;var _0x18af0c=_0x33d9[_0x1282a0];return _0x18af0c;};'use strict';var _=require('lodash');var util=require(_0x933d('0x0'));var moment=require(_0x933d('0x1'));var BPromise=require(_0x933d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x933d('0x3'));var db=require(_0x933d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x933d('0x5'))(_0x933d('0x6'));var config=require(_0x933d('0x7'));var jayson=require(_0x933d('0x8'));var client=jayson[_0x933d('0x9')][_0x933d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ffcbd,_0x4d1594,_0x3b7afd){return new BPromise(function(_0x1a3843,_0x150a60){return client[_0x933d('0xb')](_0x2ffcbd,_0x3b7afd)[_0x933d('0xc')](function(_0xafaa32){logger[_0x933d('0xd')](_0x933d('0xe'),_0x4d1594,_0x933d('0xf'));logger[_0x933d('0x10')](_0x933d('0x11'),_0x4d1594,_0x933d('0xf'),JSON[_0x933d('0x12')](_0xafaa32));if(_0xafaa32[_0x933d('0x13')]){if(_0xafaa32[_0x933d('0x13')][_0x933d('0x14')]===0x1f4){logger[_0x933d('0x13')](_0x933d('0xe'),_0x4d1594,_0xafaa32[_0x933d('0x13')][_0x933d('0x15')]);return _0x150a60(_0xafaa32[_0x933d('0x13')][_0x933d('0x15')]);}logger[_0x933d('0x13')]('VoiceContext,\x20%s,\x20%s',_0x4d1594,_0xafaa32[_0x933d('0x13')][_0x933d('0x15')]);return _0x1a3843(_0xafaa32[_0x933d('0x13')][_0x933d('0x15')]);}else{logger[_0x933d('0xd')](_0x933d('0xe'),_0x4d1594,_0x933d('0xf'));_0x1a3843(_0xafaa32['result'][_0x933d('0x15')]);}})[_0x933d('0x16')](function(_0x168207){logger[_0x933d('0x13')](_0x933d('0xe'),_0x4d1594,_0x168207);_0x150a60(_0x168207);});});} \ No newline at end of file +var _0x8066=['http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0xaeff8a,_0x506724){var _0x8a6ce3=function(_0x237855){while(--_0x237855){_0xaeff8a['push'](_0xaeff8a['shift']());}};_0x8a6ce3(++_0x506724);}(_0x8066,0x1c4));var _0x6806=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x8066[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6806('0x0'));var util=require(_0x6806('0x1'));var moment=require(_0x6806('0x2'));var BPromise=require(_0x6806('0x3'));var rs=require(_0x6806('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6806('0x5'))['db'];var utils=require(_0x6806('0x6'));var logger=require('../../config/logger')(_0x6806('0x7'));var config=require(_0x6806('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6806('0x9')][_0x6806('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213473,_0x274943,_0x49450c){return new BPromise(function(_0x2efee8,_0x2d19b3){return client[_0x6806('0xb')](_0x213473,_0x49450c)['then'](function(_0x16232a){logger[_0x6806('0xc')](_0x6806('0xd'),_0x274943,_0x6806('0xe'));logger[_0x6806('0xf')](_0x6806('0x10'),_0x274943,_0x6806('0xe'),JSON[_0x6806('0x11')](_0x16232a));if(_0x16232a[_0x6806('0x12')]){if(_0x16232a[_0x6806('0x12')][_0x6806('0x13')]===0x1f4){logger[_0x6806('0x12')]('VoiceContext,\x20%s,\x20%s',_0x274943,_0x16232a['error'][_0x6806('0x14')]);return _0x2d19b3(_0x16232a['error'][_0x6806('0x14')]);}logger['error'](_0x6806('0xd'),_0x274943,_0x16232a[_0x6806('0x12')]['message']);return _0x2efee8(_0x16232a['error'][_0x6806('0x14')]);}else{logger['info'](_0x6806('0xd'),_0x274943,_0x6806('0xe'));_0x2efee8(_0x16232a['result'][_0x6806('0x14')]);}})[_0x6806('0x15')](function(_0x4d57cf){logger['error'](_0x6806('0xd'),_0x274943,_0x4d57cf);_0x2d19b3(_0x4d57cf);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f937421..a16e7eb 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 _0xc744=['put','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc744,0x168));var _0x4c74=function(_0x579e93,_0x576cf6){_0x579e93=_0x579e93-0x0;var _0x43a06b=_0xc744[_0x579e93];return _0x43a06b;};'use strict';var multer=require(_0x4c74('0x0'));var util=require(_0x4c74('0x1'));var path=require(_0x4c74('0x2'));var timeout=require(_0x4c74('0x3'));var express=require('express');var router=express[_0x4c74('0x4')]();var auth=require(_0x4c74('0x5'));var interaction=require(_0x4c74('0x6'));var config=require(_0x4c74('0x7'));var controller=require(_0x4c74('0x8'));router[_0x4c74('0x9')]('/',auth['isAuthenticated'](),controller[_0x4c74('0xa')]);router['get'](_0x4c74('0xb'),auth[_0x4c74('0xc')](),controller[_0x4c74('0xd')]);router[_0x4c74('0x9')](_0x4c74('0xe'),auth[_0x4c74('0xc')](),controller[_0x4c74('0xf')]);router[_0x4c74('0x10')]('/',auth[_0x4c74('0xc')](),controller[_0x4c74('0x11')]);router[_0x4c74('0x12')](_0x4c74('0xe'),auth[_0x4c74('0xc')](),controller['update']);router['delete'](_0x4c74('0xe'),auth['isAuthenticated'](),controller[_0x4c74('0x13')]);module[_0x4c74('0x14')]=router; \ No newline at end of file +var _0x7e79=['destroy','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete'];(function(_0x57e18a,_0x199383){var _0x1181c7=function(_0x2503e8){while(--_0x2503e8){_0x57e18a['push'](_0x57e18a['shift']());}};_0x1181c7(++_0x199383);}(_0x7e79,0x1ee));var _0x97e7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7e79[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x97e7('0x0'));var util=require(_0x97e7('0x1'));var path=require('path');var timeout=require(_0x97e7('0x2'));var express=require(_0x97e7('0x3'));var router=express[_0x97e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x97e7('0x5'));var controller=require('./voiceDialReport.controller');router[_0x97e7('0x6')]('/',auth[_0x97e7('0x7')](),controller[_0x97e7('0x8')]);router[_0x97e7('0x6')](_0x97e7('0x9'),auth[_0x97e7('0x7')](),controller[_0x97e7('0xa')]);router['get']('/:id',auth[_0x97e7('0x7')](),controller['show']);router['post']('/',auth[_0x97e7('0x7')](),controller[_0x97e7('0xb')]);router[_0x97e7('0xc')](_0x97e7('0xd'),auth[_0x97e7('0x7')](),controller[_0x97e7('0xe')]);router[_0x97e7('0xf')](_0x97e7('0xd'),auth[_0x97e7('0x7')](),controller[_0x97e7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 756ad2a..b772bc7 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 _0x3217=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x166ee4,_0x20efa7){var _0x334b5c=function(_0x269d99){while(--_0x269d99){_0x166ee4['push'](_0x166ee4['shift']());}};_0x334b5c(++_0x20efa7);}(_0x3217,0x17c));var _0x7321=function(_0x1b9b48,_0x58a7d0){_0x1b9b48=_0x1b9b48-0x0;var _0x581e68=_0x3217[_0x1b9b48];return _0x581e68;};'use strict';var Sequelize=require(_0x7321('0x0'));module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7321('0x1')]},'channelstate':{'type':Sequelize[_0x7321('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7321('0x1')]},'calleridnum':{'type':Sequelize[_0x7321('0x1')]},'calleridname':{'type':Sequelize[_0x7321('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7321('0x1')]},'connectedlinename':{'type':Sequelize[_0x7321('0x1')]},'language':{'type':Sequelize[_0x7321('0x1')]},'accountcode':{'type':Sequelize[_0x7321('0x1')]},'context':{'type':Sequelize[_0x7321('0x1')]},'exten':{'type':Sequelize[_0x7321('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x7321('0x1')]},'linkedid':{'type':Sequelize[_0x7321('0x1')]},'destchannel':{'type':Sequelize[_0x7321('0x1')]},'destchannelstate':{'type':Sequelize[_0x7321('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x7321('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7321('0x1')]},'destcalleridname':{'type':Sequelize[_0x7321('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7321('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7321('0x1')]},'destlanguage':{'type':Sequelize[_0x7321('0x1')]},'destaccountcode':{'type':Sequelize[_0x7321('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7321('0x1')]},'destpriority':{'type':Sequelize[_0x7321('0x2')]},'destuniqueid':{'type':Sequelize[_0x7321('0x1')]},'destlinkedid':{'type':Sequelize[_0x7321('0x1')]},'dialstring':{'type':Sequelize[_0x7321('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7321('0x3')]},'answertime':{'type':Sequelize[_0x7321('0x3')]},'endtime':{'type':Sequelize[_0x7321('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x7321('0x4')},'routeId':{'type':Sequelize[_0x7321('0x2')]},'duration':{'type':Sequelize[_0x7321('0x2')]},'holdtime':{'type':Sequelize[_0x7321('0x2')]},'billableseconds':{'type':Sequelize[_0x7321('0x2')]}}; \ No newline at end of file +var _0xad94=['called,connect,complete','STRING','INTEGER','DATE'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0xad94,0x99));var _0x4ad9=function(_0x3f7004,_0x41fd2f){_0x3f7004=_0x3f7004-0x0;var _0x2529b0=_0xad94[_0x3f7004];return _0x2529b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x4ad9('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4ad9('0x1')]},'channelstatedesc':{'type':Sequelize[_0x4ad9('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4ad9('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4ad9('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4ad9('0x0')]},'exten':{'type':Sequelize[_0x4ad9('0x0')]},'priority':{'type':Sequelize[_0x4ad9('0x1')]},'uniqueid':{'type':Sequelize[_0x4ad9('0x0')]},'linkedid':{'type':Sequelize[_0x4ad9('0x0')]},'destchannel':{'type':Sequelize[_0x4ad9('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4ad9('0x0')]},'destcalleridnum':{'type':Sequelize[_0x4ad9('0x0')]},'destcalleridname':{'type':Sequelize[_0x4ad9('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x4ad9('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x4ad9('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4ad9('0x0')]},'destcontext':{'type':Sequelize[_0x4ad9('0x0')]},'destexten':{'type':Sequelize[_0x4ad9('0x0')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x4ad9('0x0')]},'destlinkedid':{'type':Sequelize[_0x4ad9('0x0')]},'dialstring':{'type':Sequelize[_0x4ad9('0x0')]},'dialstatus':{'type':Sequelize[_0x4ad9('0x0')]},'starttime':{'type':Sequelize[_0x4ad9('0x2')]},'answertime':{'type':Sequelize[_0x4ad9('0x2')]},'endtime':{'type':Sequelize[_0x4ad9('0x2')]},'lastevent':{'type':Sequelize[_0x4ad9('0x0')],'comment':_0x4ad9('0x3')},'routeId':{'type':Sequelize[_0x4ad9('0x1')]},'duration':{'type':Sequelize[_0x4ad9('0x1')]},'holdtime':{'type':Sequelize[_0x4ad9('0x1')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 08624c1..dad365d 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 _0xc3fd=['sort','where','filters','filter','map','type','key','VIRTUAL','field','merge','options','include','findAll','rows','catch','show','params','fields','length','includeAll','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','query','attributes','intersection','hasOwnProperty','nolimit','order'];(function(_0x19025e,_0x35f1a0){var _0x3b1a8b=function(_0xae4885){while(--_0xae4885){_0x19025e['push'](_0x19025e['shift']());}};_0x3b1a8b(++_0x35f1a0);}(_0xc3fd,0x1e1));var _0xdc3f=function(_0x294315,_0x178b45){_0x294315=_0x294315-0x0;var _0x468087=_0xc3fd[_0x294315];return _0x468087;};'use strict';var pdf=require(_0xdc3f('0x0'));var emlformat=require(_0xdc3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdc3f('0x2'));var jsonpatch=require(_0xdc3f('0x3'));var rp=require(_0xdc3f('0x4'));var moment=require(_0xdc3f('0x5'));var BPromise=require(_0xdc3f('0x6'));var Mustache=require('mustache');var util=require(_0xdc3f('0x7'));var path=require(_0xdc3f('0x8'));var sox=require(_0xdc3f('0x9'));var csv=require(_0xdc3f('0xa'));var ejs=require(_0xdc3f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc3f('0xc'));var jsforce=require(_0xdc3f('0xd'));var deskjs=require(_0xdc3f('0xe'));var toCsv=require(_0xdc3f('0xa'));var querystring=require(_0xdc3f('0xf'));var Papa=require(_0xdc3f('0x10'));var Redis=require(_0xdc3f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xdc3f('0x12'));var logger=require(_0xdc3f('0x13'))(_0xdc3f('0x14'));var utils=require('../../config/utils');var config=require(_0xdc3f('0x15'));var db=require(_0xdc3f('0x16'))['db'];function respondWithStatusCode(_0x57ccdd,_0x3eaeb9){_0x3eaeb9=_0x3eaeb9||0xcc;return function(_0xba446){if(_0xba446){return _0x57ccdd[_0xdc3f('0x17')](_0x3eaeb9);}return _0x57ccdd[_0xdc3f('0x18')](_0x3eaeb9)['end']();};}function respondWithResult(_0x38fdb2,_0x56bb1f){_0x56bb1f=_0x56bb1f||0xc8;return function(_0x4fc745){if(_0x4fc745){return _0x38fdb2[_0xdc3f('0x18')](_0x56bb1f)[_0xdc3f('0x19')](_0x4fc745);}};}function respondWithFilteredResult(_0x5d6a95,_0x5efab5){return function(_0x3b03ea){if(_0x3b03ea){var _0x265f8f=_0x3b03ea[_0xdc3f('0x1a')],_0x396fd6=_0x5efab5[_0xdc3f('0x1b')],_0x567b50=_0x5efab5[_0xdc3f('0x1b')]+_0x5efab5[_0xdc3f('0x1c')],_0x587986;if(_0x567b50>=_0x265f8f){_0x567b50=_0x265f8f;_0x587986=0xc8;}else{_0x587986=0xce;}_0x5d6a95[_0xdc3f('0x18')](_0x587986);return _0x5d6a95[_0xdc3f('0x1d')](_0xdc3f('0x1e'),_0x396fd6+'-'+_0x567b50+'/'+_0x265f8f)[_0xdc3f('0x19')](_0x3b03ea);}return null;};}function patchUpdates(_0x273de5){return function(_0x2c1430){try{jsonpatch[_0xdc3f('0x1f')](_0x2c1430,_0x273de5,!![]);}catch(_0x46cc0f){return BPromise[_0xdc3f('0x20')](_0x46cc0f);}return _0x2c1430['save']();};}function saveUpdates(_0x2c174d,_0x2897af){return function(_0x43f2c9){if(_0x43f2c9){return _0x43f2c9['update'](_0x2c174d)[_0xdc3f('0x21')](function(_0x15f672){return _0x15f672;});}return null;};}function removeEntity(_0x4344bc,_0x36cabb){return function(_0x4cb595){if(_0x4cb595){return _0x4cb595[_0xdc3f('0x22')]()[_0xdc3f('0x21')](function(){_0x4344bc[_0xdc3f('0x18')](0xcc)[_0xdc3f('0x23')]();});}};}function handleEntityNotFound(_0x47312a,_0x1ad40a){return function(_0x380ec7){if(!_0x380ec7){_0x47312a['sendStatus'](0x194);}return _0x380ec7;};}function handleError(_0x407c3b,_0x28048c){_0x28048c=_0x28048c||0x1f4;return function(_0x4ede82){logger[_0xdc3f('0x24')](_0x4ede82[_0xdc3f('0x25')]);if(_0x4ede82[_0xdc3f('0x26')]){delete _0x4ede82[_0xdc3f('0x26')];}_0x407c3b[_0xdc3f('0x18')](_0x28048c)[_0xdc3f('0x27')](_0x4ede82);};}exports[_0xdc3f('0x28')]=function(_0x10c81a,_0x12057d){var _0x508094={},_0x529da5={},_0x407024={'count':0x0,'rows':[]};var _0x25397a=db[_0xdc3f('0x29')][_0xdc3f('0x2a')];_0x529da5[_0xdc3f('0x2b')]=_[_0xdc3f('0x2c')](_0x25397a);_0x529da5[_0xdc3f('0x2d')]=_[_0xdc3f('0x2c')](_0x10c81a[_0xdc3f('0x2d')]);_0x529da5['filters']=_['intersection'](_0x529da5[_0xdc3f('0x2b')],_0x529da5['query']);_0x508094[_0xdc3f('0x2e')]=_[_0xdc3f('0x2f')](_0x529da5[_0xdc3f('0x2b')],qs['fields'](_0x10c81a[_0xdc3f('0x2d')]['fields']));_0x508094['attributes']=_0x508094[_0xdc3f('0x2e')]['length']?_0x508094['attributes']:_0x529da5[_0xdc3f('0x2b')];if(!_0x10c81a[_0xdc3f('0x2d')][_0xdc3f('0x30')](_0xdc3f('0x31'))){_0x508094['limit']=qs[_0xdc3f('0x1c')](_0x10c81a[_0xdc3f('0x2d')]['limit']);_0x508094[_0xdc3f('0x1b')]=qs[_0xdc3f('0x1b')](_0x10c81a[_0xdc3f('0x2d')][_0xdc3f('0x1b')]);}_0x508094[_0xdc3f('0x32')]=qs[_0xdc3f('0x33')](_0x10c81a[_0xdc3f('0x2d')]['sort']);_0x508094[_0xdc3f('0x34')]=qs[_0xdc3f('0x35')](_['pick'](_0x10c81a[_0xdc3f('0x2d')],_0x529da5['filters']));if(_0x10c81a['query'][_0xdc3f('0x36')]){_0x508094[_0xdc3f('0x34')]=_['merge'](_0x508094['where'],{'$or':_[_0xdc3f('0x37')](_0x25397a,function(_0x3bd386){if(_0x3bd386[_0xdc3f('0x38')][_0xdc3f('0x39')]!==_0xdc3f('0x3a')){var _0x4cfa99={};_0x4cfa99[_0x3bd386[_0xdc3f('0x3b')]]={'$like':'%'+_0x10c81a['query'][_0xdc3f('0x36')]+'%'};return _0x4cfa99;}})});}_0x508094=_[_0xdc3f('0x3c')]({},_0x508094,_0x10c81a[_0xdc3f('0x3d')]);var _0x3b3fbb={'where':_0x508094[_0xdc3f('0x34')]};return db[_0xdc3f('0x29')][_0xdc3f('0x1a')](_0x3b3fbb)[_0xdc3f('0x21')](function(_0x3ac2ed){_0x407024[_0xdc3f('0x1a')]=_0x3ac2ed;if(_0x10c81a[_0xdc3f('0x2d')]['includeAll']){_0x508094[_0xdc3f('0x3e')]=[{'all':!![]}];}return db[_0xdc3f('0x29')][_0xdc3f('0x3f')](_0x508094);})[_0xdc3f('0x21')](function(_0x4fec2d){_0x407024[_0xdc3f('0x40')]=_0x4fec2d;return _0x407024;})[_0xdc3f('0x21')](respondWithFilteredResult(_0x12057d,_0x508094))[_0xdc3f('0x41')](handleError(_0x12057d,null));};exports[_0xdc3f('0x42')]=function(_0x28361a,_0xb7e283){var _0x350757={'raw':!![],'where':{'id':_0x28361a[_0xdc3f('0x43')]['id']}},_0x3fb289={};_0x3fb289[_0xdc3f('0x2b')]=_[_0xdc3f('0x2c')](db[_0xdc3f('0x29')][_0xdc3f('0x2a')]);_0x3fb289[_0xdc3f('0x2d')]=_[_0xdc3f('0x2c')](_0x28361a[_0xdc3f('0x2d')]);_0x3fb289[_0xdc3f('0x35')]=_['intersection'](_0x3fb289[_0xdc3f('0x2b')],_0x3fb289[_0xdc3f('0x2d')]);_0x350757[_0xdc3f('0x2e')]=_[_0xdc3f('0x2f')](_0x3fb289[_0xdc3f('0x2b')],qs[_0xdc3f('0x44')](_0x28361a[_0xdc3f('0x2d')]['fields']));_0x350757[_0xdc3f('0x2e')]=_0x350757[_0xdc3f('0x2e')][_0xdc3f('0x45')]?_0x350757[_0xdc3f('0x2e')]:_0x3fb289[_0xdc3f('0x2b')];if(_0x28361a[_0xdc3f('0x2d')][_0xdc3f('0x46')]){_0x350757[_0xdc3f('0x3e')]=[{'all':!![]}];}_0x350757=_[_0xdc3f('0x3c')]({},_0x350757,_0x28361a['options']);return db[_0xdc3f('0x29')][_0xdc3f('0x47')](_0x350757)[_0xdc3f('0x21')](handleEntityNotFound(_0xb7e283,null))['then'](respondWithResult(_0xb7e283,null))[_0xdc3f('0x41')](handleError(_0xb7e283,null));};exports[_0xdc3f('0x48')]=function(_0x20e692,_0x32386c){return db[_0xdc3f('0x29')][_0xdc3f('0x48')](_0x20e692[_0xdc3f('0x49')],{})[_0xdc3f('0x21')](respondWithResult(_0x32386c,0xc9))[_0xdc3f('0x41')](handleError(_0x32386c,null));};exports[_0xdc3f('0x4a')]=function(_0x181911,_0x55ba71){if(_0x181911[_0xdc3f('0x49')]['id']){delete _0x181911['body']['id'];}return db['VoiceDialReport'][_0xdc3f('0x47')]({'where':{'id':_0x181911[_0xdc3f('0x43')]['id']}})[_0xdc3f('0x21')](handleEntityNotFound(_0x55ba71,null))[_0xdc3f('0x21')](saveUpdates(_0x181911[_0xdc3f('0x49')],null))[_0xdc3f('0x21')](respondWithResult(_0x55ba71,null))['catch'](handleError(_0x55ba71,null));};exports[_0xdc3f('0x22')]=function(_0x5d02eb,_0x2b7cd2){return db[_0xdc3f('0x29')][_0xdc3f('0x47')]({'where':{'id':_0x5d02eb[_0xdc3f('0x43')]['id']}})[_0xdc3f('0x21')](handleEntityNotFound(_0x2b7cd2,null))[_0xdc3f('0x21')](removeEntity(_0x2b7cd2,null))[_0xdc3f('0x41')](handleError(_0x2b7cd2,null));};exports[_0xdc3f('0x4b')]=function(_0x16bdde,_0x414134){return db['VoiceDialReport'][_0xdc3f('0x4b')]()[_0xdc3f('0x21')](respondWithResult(_0x414134,null))['catch'](handleError(_0x414134,null));}; \ No newline at end of file +var _0x5430=['include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','VoiceDialReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','params'];(function(_0x4aabf3,_0x1047c8){var _0x74ae71=function(_0x236ea7){while(--_0x236ea7){_0x4aabf3['push'](_0x4aabf3['shift']());}};_0x74ae71(++_0x1047c8);}(_0x5430,0x12e));var _0x0543=function(_0x3c6e3a,_0x5d8ec3){_0x3c6e3a=_0x3c6e3a-0x0;var _0x38c558=_0x5430[_0x3c6e3a];return _0x38c558;};'use strict';var pdf=require(_0x0543('0x0'));var emlformat=require(_0x0543('0x1'));var rimraf=require(_0x0543('0x2'));var zipdir=require(_0x0543('0x3'));var jsonpatch=require(_0x0543('0x4'));var rp=require(_0x0543('0x5'));var moment=require(_0x0543('0x6'));var BPromise=require(_0x0543('0x7'));var Mustache=require(_0x0543('0x8'));var util=require(_0x0543('0x9'));var path=require(_0x0543('0xa'));var sox=require(_0x0543('0xb'));var csv=require(_0x0543('0xc'));var ejs=require(_0x0543('0xd'));var fs=require('fs');var _=require(_0x0543('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0543('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0543('0x10'));var Papa=require(_0x0543('0x11'));var Redis=require(_0x0543('0x12'));var authService=require(_0x0543('0x13'));var qs=require(_0x0543('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x15'))(_0x0543('0x16'));var utils=require(_0x0543('0x17'));var config=require(_0x0543('0x18'));var db=require(_0x0543('0x19'))['db'];function respondWithStatusCode(_0x30a558,_0x1a2925){_0x1a2925=_0x1a2925||0xcc;return function(_0x461469){if(_0x461469){return _0x30a558[_0x0543('0x1a')](_0x1a2925);}return _0x30a558[_0x0543('0x1b')](_0x1a2925)[_0x0543('0x1c')]();};}function respondWithResult(_0x41b475,_0x10f32b){_0x10f32b=_0x10f32b||0xc8;return function(_0x3ca4ca){if(_0x3ca4ca){return _0x41b475[_0x0543('0x1b')](_0x10f32b)[_0x0543('0x1d')](_0x3ca4ca);}};}function respondWithFilteredResult(_0x2f47c2,_0x53c00c){return function(_0x1dd93f){if(_0x1dd93f){var _0x1c4d74=_0x1dd93f[_0x0543('0x1e')],_0x151ae8=_0x53c00c[_0x0543('0x1f')],_0x55eac7=_0x53c00c[_0x0543('0x1f')]+_0x53c00c[_0x0543('0x20')],_0x2a2ef5;if(_0x55eac7>=_0x1c4d74){_0x55eac7=_0x1c4d74;_0x2a2ef5=0xc8;}else{_0x2a2ef5=0xce;}_0x2f47c2[_0x0543('0x1b')](_0x2a2ef5);return _0x2f47c2['set'](_0x0543('0x21'),_0x151ae8+'-'+_0x55eac7+'/'+_0x1c4d74)[_0x0543('0x1d')](_0x1dd93f);}return null;};}function patchUpdates(_0x44f6a4){return function(_0x157c69){try{jsonpatch[_0x0543('0x22')](_0x157c69,_0x44f6a4,!![]);}catch(_0x4655a0){return BPromise[_0x0543('0x23')](_0x4655a0);}return _0x157c69[_0x0543('0x24')]();};}function saveUpdates(_0x5d73a6,_0x350966){return function(_0x5a7562){if(_0x5a7562){return _0x5a7562[_0x0543('0x25')](_0x5d73a6)[_0x0543('0x26')](function(_0x232be5){return _0x232be5;});}return null;};}function removeEntity(_0x3614b2,_0x432f72){return function(_0x405753){if(_0x405753){return _0x405753['destroy']()[_0x0543('0x26')](function(){_0x3614b2[_0x0543('0x1b')](0xcc)[_0x0543('0x1c')]();});}};}function handleEntityNotFound(_0x2d8078,_0xb0bde7){return function(_0x5031c6){if(!_0x5031c6){_0x2d8078[_0x0543('0x1a')](0x194);}return _0x5031c6;};}function handleError(_0x3497f6,_0x2c7c7d){_0x2c7c7d=_0x2c7c7d||0x1f4;return function(_0x9fe7ab){logger[_0x0543('0x27')](_0x9fe7ab[_0x0543('0x28')]);if(_0x9fe7ab[_0x0543('0x29')]){delete _0x9fe7ab[_0x0543('0x29')];}_0x3497f6['status'](_0x2c7c7d)['send'](_0x9fe7ab);};}exports[_0x0543('0x2a')]=function(_0xb6e427,_0x3882a1){var _0x5bb709={},_0x8bf5b7={},_0x2cdcf6={'count':0x0,'rows':[]};var _0x208451=db[_0x0543('0x2b')]['rawAttributes'];_0x8bf5b7[_0x0543('0x2c')]=_[_0x0543('0x2d')](_0x208451);_0x8bf5b7['query']=_[_0x0543('0x2d')](_0xb6e427[_0x0543('0x2e')]);_0x8bf5b7[_0x0543('0x2f')]=_[_0x0543('0x30')](_0x8bf5b7['model'],_0x8bf5b7[_0x0543('0x2e')]);_0x5bb709[_0x0543('0x31')]=_[_0x0543('0x30')](_0x8bf5b7[_0x0543('0x2c')],qs[_0x0543('0x32')](_0xb6e427[_0x0543('0x2e')][_0x0543('0x32')]));_0x5bb709[_0x0543('0x31')]=_0x5bb709['attributes'][_0x0543('0x33')]?_0x5bb709[_0x0543('0x31')]:_0x8bf5b7['model'];if(!_0xb6e427[_0x0543('0x2e')][_0x0543('0x34')](_0x0543('0x35'))){_0x5bb709[_0x0543('0x20')]=qs[_0x0543('0x20')](_0xb6e427['query'][_0x0543('0x20')]);_0x5bb709[_0x0543('0x1f')]=qs[_0x0543('0x1f')](_0xb6e427['query'][_0x0543('0x1f')]);}_0x5bb709['order']=qs[_0x0543('0x36')](_0xb6e427['query'][_0x0543('0x36')]);_0x5bb709[_0x0543('0x37')]=qs[_0x0543('0x2f')](_[_0x0543('0x38')](_0xb6e427[_0x0543('0x2e')],_0x8bf5b7[_0x0543('0x2f')]));if(_0xb6e427[_0x0543('0x2e')][_0x0543('0x39')]){_0x5bb709[_0x0543('0x37')]=_[_0x0543('0x3a')](_0x5bb709['where'],{'$or':_[_0x0543('0x3b')](_0x208451,function(_0x3fe107){if(_0x3fe107[_0x0543('0x3c')]['key']!==_0x0543('0x3d')){var _0x5a015d={};_0x5a015d[_0x3fe107['field']]={'$like':'%'+_0xb6e427['query'][_0x0543('0x39')]+'%'};return _0x5a015d;}})});}_0x5bb709=_[_0x0543('0x3a')]({},_0x5bb709,_0xb6e427[_0x0543('0x3e')]);var _0x44fdbe={'where':_0x5bb709[_0x0543('0x37')]};return db[_0x0543('0x2b')][_0x0543('0x1e')](_0x44fdbe)['then'](function(_0x31eb62){_0x2cdcf6['count']=_0x31eb62;if(_0xb6e427[_0x0543('0x2e')][_0x0543('0x3f')]){_0x5bb709['include']=[{'all':!![]}];}return db[_0x0543('0x2b')][_0x0543('0x40')](_0x5bb709);})['then'](function(_0x558b22){_0x2cdcf6[_0x0543('0x41')]=_0x558b22;return _0x2cdcf6;})['then'](respondWithFilteredResult(_0x3882a1,_0x5bb709))[_0x0543('0x42')](handleError(_0x3882a1,null));};exports['show']=function(_0x564213,_0x53a8c4){var _0x1fb6a9={'raw':!![],'where':{'id':_0x564213[_0x0543('0x43')]['id']}},_0x5637d5={};_0x5637d5['model']=_[_0x0543('0x2d')](db[_0x0543('0x2b')]['rawAttributes']);_0x5637d5[_0x0543('0x2e')]=_['keys'](_0x564213[_0x0543('0x2e')]);_0x5637d5[_0x0543('0x2f')]=_[_0x0543('0x30')](_0x5637d5[_0x0543('0x2c')],_0x5637d5['query']);_0x1fb6a9['attributes']=_['intersection'](_0x5637d5[_0x0543('0x2c')],qs[_0x0543('0x32')](_0x564213['query']['fields']));_0x1fb6a9[_0x0543('0x31')]=_0x1fb6a9[_0x0543('0x31')][_0x0543('0x33')]?_0x1fb6a9['attributes']:_0x5637d5[_0x0543('0x2c')];if(_0x564213[_0x0543('0x2e')][_0x0543('0x3f')]){_0x1fb6a9[_0x0543('0x44')]=[{'all':!![]}];}_0x1fb6a9=_[_0x0543('0x3a')]({},_0x1fb6a9,_0x564213[_0x0543('0x3e')]);return db[_0x0543('0x2b')][_0x0543('0x45')](_0x1fb6a9)[_0x0543('0x26')](handleEntityNotFound(_0x53a8c4,null))[_0x0543('0x26')](respondWithResult(_0x53a8c4,null))['catch'](handleError(_0x53a8c4,null));};exports['create']=function(_0x1bf3e8,_0x4b1f43){return db[_0x0543('0x2b')][_0x0543('0x46')](_0x1bf3e8[_0x0543('0x47')],{})['then'](respondWithResult(_0x4b1f43,0xc9))['catch'](handleError(_0x4b1f43,null));};exports[_0x0543('0x25')]=function(_0x503e01,_0x497477){if(_0x503e01[_0x0543('0x47')]['id']){delete _0x503e01['body']['id'];}return db[_0x0543('0x2b')][_0x0543('0x45')]({'where':{'id':_0x503e01[_0x0543('0x43')]['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x497477,null))[_0x0543('0x26')](saveUpdates(_0x503e01[_0x0543('0x47')],null))[_0x0543('0x26')](respondWithResult(_0x497477,null))[_0x0543('0x42')](handleError(_0x497477,null));};exports[_0x0543('0x48')]=function(_0x3d41fd,_0x48c26e){return db['VoiceDialReport'][_0x0543('0x45')]({'where':{'id':_0x3d41fd['params']['id']}})[_0x0543('0x26')](handleEntityNotFound(_0x48c26e,null))[_0x0543('0x26')](removeEntity(_0x48c26e,null))[_0x0543('0x42')](handleError(_0x48c26e,null));};exports[_0x0543('0x49')]=function(_0x47806a,_0x2f0fb0){return db[_0x0543('0x2b')][_0x0543('0x49')]()[_0x0543('0x26')](respondWithResult(_0x2f0fb0,null))['catch'](handleError(_0x2f0fb0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 370381e..c759446 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 _0xfb71=['define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0xe45a4c,_0x20e5d8){var _0x8a2011=function(_0x1be742){while(--_0x1be742){_0xe45a4c['push'](_0xe45a4c['shift']());}};_0x8a2011(++_0x20e5d8);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x157a5c,_0x36b5c1){_0x157a5c=_0x157a5c-0x0;var _0x2588d9=_0xfb71[_0x157a5c];return _0x2588d9;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var logger=require(_0x1fb7('0x2'))(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb7('0x5'));var rimraf=require(_0x1fb7('0x6'));var config=require(_0x1fb7('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x1fb7('0x8')]=function(_0x29532a,_0x2babe0){return _0x29532a[_0x1fb7('0x9')](_0x1fb7('0xa'),attributes,{'tableName':_0x1fb7('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0439=['rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd2a556,_0x4064bc){var _0x3121ce=function(_0x2b5c33){while(--_0x2b5c33){_0xd2a556['push'](_0xd2a556['shift']());}};_0x3121ce(++_0x4064bc);}(_0x0439,0xdd));var _0x9043=function(_0x6cdb11,_0x24489f){_0x6cdb11=_0x6cdb11-0x0;var _0x17f70a=_0x0439[_0x6cdb11];return _0x17f70a;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var logger=require(_0x9043('0x2'))(_0x9043('0x3'));var moment=require(_0x9043('0x4'));var BPromise=require(_0x9043('0x5'));var rp=require(_0x9043('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9043('0x7'));var config=require(_0x9043('0x8'));var attributes=require(_0x9043('0x9'));module['exports']=function(_0x3a1c0e,_0x5ea31e){return _0x3a1c0e['define'](_0x9043('0xa'),attributes,{'tableName':_0x9043('0xb'),'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 3c6e909..9711cbe 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 _0x80d9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','where','attributes','debug','lodash','moment','bluebird','randomstring'];(function(_0xf9b669,_0x17dc98){var _0x5ebc2e=function(_0x49ec0f){while(--_0x49ec0f){_0xf9b669['push'](_0xf9b669['shift']());}};_0x5ebc2e(++_0x17dc98);}(_0x80d9,0x15c));var _0x980d=function(_0x17cb6c,_0x52e741){_0x17cb6c=_0x17cb6c-0x0;var _0x50c485=_0x80d9[_0x17cb6c];return _0x50c485;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var moment=require(_0x980d('0x1'));var BPromise=require(_0x980d('0x2'));var rs=require(_0x980d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x980d('0x4'))['db'];var utils=require(_0x980d('0x5'));var logger=require(_0x980d('0x6'))(_0x980d('0x7'));var config=require(_0x980d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x980d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50854e,_0x5d9eb0,_0x7e96f7){return new BPromise(function(_0x758fc3,_0x2b8e2c){return client[_0x980d('0xa')](_0x50854e,_0x7e96f7)[_0x980d('0xb')](function(_0xef5778){logger[_0x980d('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x5d9eb0,'request\x20sent');logger['debug'](_0x980d('0xd'),_0x5d9eb0,_0x980d('0xe'),JSON['stringify'](_0xef5778));if(_0xef5778[_0x980d('0xf')]){if(_0xef5778['error'][_0x980d('0x10')]===0x1f4){logger['error'](_0x980d('0x11'),_0x5d9eb0,_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);return _0x2b8e2c(_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);}logger[_0x980d('0xf')](_0x980d('0x11'),_0x5d9eb0,_0xef5778[_0x980d('0xf')]['message']);return _0x758fc3(_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);}else{logger[_0x980d('0xc')](_0x980d('0x11'),_0x5d9eb0,_0x980d('0xe'));_0x758fc3(_0xef5778[_0x980d('0x13')]['message']);}})[_0x980d('0x14')](function(_0x393ae2){logger['error'](_0x980d('0x11'),_0x5d9eb0,_0x393ae2);_0x2b8e2c(_0x393ae2);});});}exports['CreateVoiceDialReport']=function(_0x23f64c){var _0x1bc7e4=this;return new Promise(function(_0x39192b,_0x3c06c5){return db[_0x980d('0x15')][_0x980d('0x16')](_0x23f64c[_0x980d('0x17')],{'raw':_0x23f64c[_0x980d('0x18')]?_0x23f64c[_0x980d('0x18')][_0x980d('0x19')]===undefined?!![]:![]:!![]})[_0x980d('0xb')](function(_0x550741){logger['info'](_0x980d('0x1a'),_0x23f64c);logger['debug']('CreateVoiceDialReport',_0x23f64c,JSON[_0x980d('0x1b')](_0x550741));_0x39192b(_0x550741);})[_0x980d('0x14')](function(_0x45d698){logger[_0x980d('0xf')]('CreateVoiceDialReport',_0x45d698['message'],_0x23f64c);_0x3c06c5(_0x1bc7e4[_0x980d('0xf')](0x1f4,_0x45d698['message']));});});};exports[_0x980d('0x1c')]=function(_0x20cea1){var _0x4da06c=this;return new Promise(function(_0x23ca08,_0x4798d7){return db['VoiceDialReport']['update'](_0x20cea1[_0x980d('0x17')],{'raw':_0x20cea1[_0x980d('0x18')]?_0x20cea1[_0x980d('0x18')][_0x980d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20cea1['options']?_0x20cea1['options'][_0x980d('0x1d')]||null:null,'attributes':_0x20cea1[_0x980d('0x18')]?_0x20cea1[_0x980d('0x18')][_0x980d('0x1e')]||null:null,'limit':_0x20cea1[_0x980d('0x18')]?_0x20cea1['options']['limit']||null:null})[_0x980d('0xb')](function(_0x1fb508){logger[_0x980d('0xc')](_0x980d('0x1c'),_0x20cea1);logger[_0x980d('0x1f')](_0x980d('0x1c'),_0x20cea1,JSON['stringify'](_0x1fb508));_0x23ca08(_0x1fb508);})[_0x980d('0x14')](function(_0x471f52){logger[_0x980d('0xf')](_0x980d('0x1c'),_0x471f52[_0x980d('0x12')],_0x20cea1);_0x4798d7(_0x4da06c[_0x980d('0xf')](0x1f4,_0x471f52[_0x980d('0x12')]));});});}; \ No newline at end of file +var _0xc999=['moment','bluebird','../../config/logger','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateVoiceDialReport','options','raw','catch','UpdateVoiceDialReport','body','where','util'];(function(_0x53d7a7,_0x4b5bcc){var _0x12f81c=function(_0x4b6486){while(--_0x4b6486){_0x53d7a7['push'](_0x53d7a7['shift']());}};_0x12f81c(++_0x4b5bcc);}(_0xc999,0x176));var _0x9c99=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xc999[_0xd0cd0b];return _0x59cced;};'use strict';var _=require('lodash');var util=require(_0x9c99('0x0'));var moment=require(_0x9c99('0x1'));var BPromise=require(_0x9c99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c99('0x3'))('rpc');var config=require(_0x9c99('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9c99('0x5')][_0x9c99('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xe80252,_0x47bfaa,_0xfa25e1){return new BPromise(function(_0x323317,_0x326099){return client[_0x9c99('0x7')](_0xe80252,_0xfa25e1)[_0x9c99('0x8')](function(_0xfe5788){logger['info'](_0x9c99('0x9'),_0x47bfaa,_0x9c99('0xa'));logger[_0x9c99('0xb')](_0x9c99('0xc'),_0x47bfaa,'request\x20sent',JSON[_0x9c99('0xd')](_0xfe5788));if(_0xfe5788[_0x9c99('0xe')]){if(_0xfe5788[_0x9c99('0xe')]['code']===0x1f4){logger[_0x9c99('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x47bfaa,_0xfe5788['error'][_0x9c99('0xf')]);return _0x326099(_0xfe5788[_0x9c99('0xe')][_0x9c99('0xf')]);}logger[_0x9c99('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x47bfaa,_0xfe5788[_0x9c99('0xe')]['message']);return _0x323317(_0xfe5788['error']['message']);}else{logger[_0x9c99('0x10')](_0x9c99('0x9'),_0x47bfaa,'request\x20sent');_0x323317(_0xfe5788[_0x9c99('0x11')]['message']);}})['catch'](function(_0x413965){logger[_0x9c99('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x47bfaa,_0x413965);_0x326099(_0x413965);});});}exports[_0x9c99('0x12')]=function(_0x436e43){var _0x5eaa11=this;return new Promise(function(_0x1a6f0e,_0x1cc5ea){return db['VoiceDialReport']['create'](_0x436e43['body'],{'raw':_0x436e43['options']?_0x436e43[_0x9c99('0x13')][_0x9c99('0x14')]===undefined?!![]:![]:!![]})[_0x9c99('0x8')](function(_0x45b1da){logger[_0x9c99('0x10')](_0x9c99('0x12'),_0x436e43);logger['debug'](_0x9c99('0x12'),_0x436e43,JSON[_0x9c99('0xd')](_0x45b1da));_0x1a6f0e(_0x45b1da);})[_0x9c99('0x15')](function(_0x2c299e){logger[_0x9c99('0xe')](_0x9c99('0x12'),_0x2c299e[_0x9c99('0xf')],_0x436e43);_0x1cc5ea(_0x5eaa11[_0x9c99('0xe')](0x1f4,_0x2c299e[_0x9c99('0xf')]));});});};exports[_0x9c99('0x16')]=function(_0x358b43){var _0x10c771=this;return new Promise(function(_0x2688f8,_0x264dfe){return db['VoiceDialReport']['update'](_0x358b43[_0x9c99('0x17')],{'raw':_0x358b43['options']?_0x358b43[_0x9c99('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358b43[_0x9c99('0x13')]?_0x358b43[_0x9c99('0x13')][_0x9c99('0x18')]||null:null,'attributes':_0x358b43[_0x9c99('0x13')]?_0x358b43[_0x9c99('0x13')]['attributes']||null:null,'limit':_0x358b43[_0x9c99('0x13')]?_0x358b43['options']['limit']||null:null})[_0x9c99('0x8')](function(_0xfe5d3a){logger[_0x9c99('0x10')](_0x9c99('0x16'),_0x358b43);logger[_0x9c99('0xb')](_0x9c99('0x16'),_0x358b43,JSON['stringify'](_0xfe5d3a));_0x2688f8(_0xfe5d3a);})[_0x9c99('0x15')](function(_0x53ca44){logger[_0x9c99('0xe')]('UpdateVoiceDialReport',_0x53ca44[_0x9c99('0xf')],_0x358b43);_0x264dfe(_0x10c771[_0x9c99('0xe')](0x1f4,_0x53ca44[_0x9c99('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8f7d999..a3b6e57 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 _0x9d5b=['express','Router','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put','update','delete','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x7a2a94,_0x326021){var _0x24bccb=function(_0x36a32f){while(--_0x36a32f){_0x7a2a94['push'](_0x7a2a94['shift']());}};_0x24bccb(++_0x326021);}(_0x9d5b,0x14d));var _0xb9d5=function(_0xcbe02c,_0x34617f){_0xcbe02c=_0xcbe02c-0x0;var _0x2e2bd4=_0x9d5b[_0xcbe02c];return _0x2e2bd4;};'use strict';var multer=require('multer');var util=require(_0xb9d5('0x0'));var path=require(_0xb9d5('0x1'));var timeout=require(_0xb9d5('0x2'));var express=require(_0xb9d5('0x3'));var router=express[_0xb9d5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9d5('0x5'));var config=require('../../config/environment');var controller=require(_0xb9d5('0x6'));router[_0xb9d5('0x7')]('/',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x9')]);router[_0xb9d5('0x7')]('/:id',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xa')]);router['post']('/',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xb')]);router[_0xb9d5('0xc')](_0xb9d5('0xd'),auth['isAuthenticated'](),controller[_0xb9d5('0xe')]);router[_0xb9d5('0xf')]('/:id',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x10')]);router[_0xb9d5('0x11')](_0xb9d5('0x12'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x13')]);module[_0xb9d5('0x14')]=router; \ No newline at end of file +var _0xd4dc=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','addApplications','/:id'];(function(_0x3666dc,_0x18701a){var _0x31c942=function(_0x315164){while(--_0x315164){_0x3666dc['push'](_0x3666dc['shift']());}};_0x31c942(++_0x18701a);}(_0xd4dc,0xff));var _0xcd4d=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xd4dc[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0xcd4d('0x0'));var util=require('util');var path=require(_0xcd4d('0x1'));var timeout=require(_0xcd4d('0x2'));var express=require(_0xcd4d('0x3'));var router=express[_0xcd4d('0x4')]();var auth=require(_0xcd4d('0x5'));var interaction=require(_0xcd4d('0x6'));var config=require(_0xcd4d('0x7'));var controller=require('./voiceExtension.controller');router[_0xcd4d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd4d('0x8')]('/:id',auth[_0xcd4d('0x9')](),controller[_0xcd4d('0xa')]);router[_0xcd4d('0xb')]('/',auth[_0xcd4d('0x9')](),controller[_0xcd4d('0xc')]);router['post']('/:id/applications',auth[_0xcd4d('0x9')](),controller[_0xcd4d('0xd')]);router['put'](_0xcd4d('0xe'),auth[_0xcd4d('0x9')](),controller[_0xcd4d('0xf')]);router['delete'](_0xcd4d('0xe'),auth['isAuthenticated'](),controller[_0xcd4d('0x10')]);module[_0xcd4d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 471ad6e..6258265 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 _0x9bde=['getDataValue','exports','compositeIndex','STRING','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','wav','VIRTUAL'];(function(_0x6021ef,_0x55d6ae){var _0x2a547d=function(_0xd7ccd2){while(--_0xd7ccd2){_0x6021ef['push'](_0x6021ef['shift']());}};_0x2a547d(++_0x55d6ae);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4e7959,_0x509243){_0x4e7959=_0x4e7959-0x0;var _0x346c84=_0x9bde[_0x4e7959];return _0x346c84;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9bd('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9bd('0x1')},'priority':{'type':Sequelize[_0xe9bd('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xe9bd('0x1')},'tag':{'type':Sequelize[_0xe9bd('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe9bd('0x2')],'allowNull':![],'defaultValue':_0xe9bd('0x3')},'appdata':{'type':Sequelize[_0xe9bd('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x4'),_0xe9bd('0x5'),_0xe9bd('0x6'),_0xe9bd('0x7'),_0xe9bd('0x8'),_0xe9bd('0x9'),_0xe9bd('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xe9bd('0x2')]},'interval':{'type':Sequelize[_0xe9bd('0x2')],'allowNull':![],'defaultValue':_0xe9bd('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe9bd('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe9bd('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xe9bd('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xe9bd('0x2')],'defaultValue':_0xe9bd('0xd')},'answer':{'type':Sequelize[_0xe9bd('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe9bd('0xe')],'get':function(_0x5e022a){return this[_0xe9bd('0xf')]('exten');}}}; \ No newline at end of file +var _0xb7e7=['BOOLEAN','wav','VIRTUAL','exten','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x3ceca6,_0x295de9){var _0x208855=function(_0x164ae9){while(--_0x164ae9){_0x3ceca6['push'](_0x3ceca6['shift']());}};_0x208855(++_0x295de9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb7e7[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(_0xaadda){return this['getDataValue'](_0x7b7e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f0d126d..6232b74 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 _0xa359=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','limit','set','json','apply','reject','update','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','key','field','options','count','includeAll','include','findAll','rows','params','length','catch','create','body','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','cutdigits','mandatoryDisposition','addApplications','sequelize','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xa359,0x12c));var _0x9a35=function(_0x465a64,_0x3f688e){_0x465a64=_0x465a64-0x0;var _0x56f6ab=_0xa359[_0x465a64];return _0x56f6ab;};'use strict';var pdf=require(_0x9a35('0x0'));var emlformat=require(_0x9a35('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9a35('0x2'));var jsonpatch=require(_0x9a35('0x3'));var rp=require(_0x9a35('0x4'));var moment=require(_0x9a35('0x5'));var BPromise=require(_0x9a35('0x6'));var Mustache=require(_0x9a35('0x7'));var util=require(_0x9a35('0x8'));var path=require(_0x9a35('0x9'));var sox=require(_0x9a35('0xa'));var csv=require(_0x9a35('0xb'));var ejs=require(_0x9a35('0xc'));var fs=require('fs');var _=require(_0x9a35('0xd'));var squel=require('squel');var crypto=require(_0x9a35('0xe'));var jsforce=require(_0x9a35('0xf'));var deskjs=require(_0x9a35('0x10'));var toCsv=require(_0x9a35('0xb'));var querystring=require(_0x9a35('0x11'));var Papa=require(_0x9a35('0x12'));var Redis=require(_0x9a35('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9a35('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a35('0x15'))(_0x9a35('0x16'));var utils=require(_0x9a35('0x17'));var config=require(_0x9a35('0x18'));var db=require(_0x9a35('0x19'))['db'];config['redis']=_['defaults'](config[_0x9a35('0x1a')],{'host':_0x9a35('0x1b'),'port':0x18eb});var socket=require(_0x9a35('0x1c'))(new Redis(config['redis']));require(_0x9a35('0x1d'))[_0x9a35('0x1e')](socket);function respondWithStatusCode(_0x36d199,_0xe7797e){_0xe7797e=_0xe7797e||0xcc;return function(_0x40e70b){if(_0x40e70b){return _0x36d199[_0x9a35('0x1f')](_0xe7797e);}return _0x36d199[_0x9a35('0x20')](_0xe7797e)[_0x9a35('0x21')]();};}function respondWithResult(_0x1458d1,_0x1a028f){_0x1a028f=_0x1a028f||0xc8;return function(_0x550439){if(_0x550439){return _0x1458d1[_0x9a35('0x20')](_0x1a028f)['json'](_0x550439);}};}function respondWithFilteredResult(_0x59ac3f,_0x45f4ce){return function(_0x3a55d0){if(_0x3a55d0){var _0x9a8a30=_0x3a55d0['count'],_0x591975=_0x45f4ce[_0x9a35('0x22')],_0x5e124c=_0x45f4ce['offset']+_0x45f4ce[_0x9a35('0x23')],_0x920a18;if(_0x5e124c>=_0x9a8a30){_0x5e124c=_0x9a8a30;_0x920a18=0xc8;}else{_0x920a18=0xce;}_0x59ac3f[_0x9a35('0x20')](_0x920a18);return _0x59ac3f[_0x9a35('0x24')]('Content-Range',_0x591975+'-'+_0x5e124c+'/'+_0x9a8a30)[_0x9a35('0x25')](_0x3a55d0);}return null;};}function patchUpdates(_0xa6f489){return function(_0x2023c9){try{jsonpatch[_0x9a35('0x26')](_0x2023c9,_0xa6f489,!![]);}catch(_0x104976){return BPromise[_0x9a35('0x27')](_0x104976);}return _0x2023c9['save']();};}function saveUpdates(_0x1094bc,_0x3ccaa2){return function(_0x5c286b){if(_0x5c286b){return _0x5c286b[_0x9a35('0x28')](_0x1094bc)[_0x9a35('0x29')](function(_0x26c689){return _0x26c689;});}return null;};}function removeEntity(_0x5a8e64,_0x1687cc){return function(_0x3e0db3){if(_0x3e0db3){return _0x3e0db3[_0x9a35('0x2a')]()[_0x9a35('0x29')](function(){var _0x4763db=_0x3e0db3['get']({'plain':!![]});var _0x537eba=[{'name':_0x9a35('0x2b'),'value':_0x9a35('0x2c'),'ignore':![]},{'name':_0x9a35('0x2d'),'value':_0x9a35('0x2e'),'ignore':![]},{'name':_0x9a35('0x2f'),'value':_0x9a35('0x30'),'ignore':![]}];var _0x2c6bc3=_(_0x537eba)[_0x9a35('0x31')](_0x9a35('0x32'))[_0x9a35('0x33')](_0x9a35('0x34'))['value']();if(_['includes'](_0x2c6bc3,_0x4763db[_0x9a35('0x35')])){return;}var _0x1eb216=_[_0x9a35('0x36')](_0x537eba,['value',_0x4763db['type']])[_0x9a35('0x37')];return db[_0x9a35('0x38')][_0x9a35('0x2a')]({'where':{'type':_0x1eb216,'resourceId':_0x4763db['id']}})[_0x9a35('0x29')](function(){return _0x3e0db3;});})[_0x9a35('0x29')](function(){_0x5a8e64[_0x9a35('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x102f45,_0x565f67){return function(_0x383019){if(!_0x383019){_0x102f45[_0x9a35('0x1f')](0x194);}return _0x383019;};}function handleError(_0x3290d0,_0xfb8168){_0xfb8168=_0xfb8168||0x1f4;return function(_0x420003){logger[_0x9a35('0x39')](_0x420003[_0x9a35('0x3a')]);if(_0x420003['name']){delete _0x420003[_0x9a35('0x37')];}_0x3290d0[_0x9a35('0x20')](_0xfb8168)[_0x9a35('0x3b')](_0x420003);};}exports[_0x9a35('0x3c')]=function(_0x139a08,_0x4495f0){var _0x120426={},_0x2b8a98={},_0x5b1569={'count':0x0,'rows':[]};var _0x278e1b=db[_0x9a35('0x3d')][_0x9a35('0x3e')];_0x2b8a98[_0x9a35('0x3f')]=_['keys'](_0x278e1b);_0x2b8a98[_0x9a35('0x40')]=_[_0x9a35('0x41')](_0x139a08[_0x9a35('0x40')]);_0x2b8a98[_0x9a35('0x42')]=_[_0x9a35('0x43')](_0x2b8a98['model'],_0x2b8a98[_0x9a35('0x40')]);_0x120426['attributes']=_[_0x9a35('0x43')](_0x2b8a98[_0x9a35('0x3f')],qs[_0x9a35('0x44')](_0x139a08[_0x9a35('0x40')]['fields']));_0x120426[_0x9a35('0x45')]=_0x120426[_0x9a35('0x45')]['length']?_0x120426['attributes']:_0x2b8a98[_0x9a35('0x3f')];if(!_0x139a08[_0x9a35('0x40')][_0x9a35('0x46')](_0x9a35('0x47'))){_0x120426['limit']=qs[_0x9a35('0x23')](_0x139a08[_0x9a35('0x40')][_0x9a35('0x23')]);_0x120426[_0x9a35('0x22')]=qs['offset'](_0x139a08['query'][_0x9a35('0x22')]);}_0x120426['order']=qs[_0x9a35('0x48')](_0x139a08[_0x9a35('0x40')][_0x9a35('0x48')]);_0x120426[_0x9a35('0x49')]=qs[_0x9a35('0x42')](_[_0x9a35('0x4a')](_0x139a08[_0x9a35('0x40')],_0x2b8a98[_0x9a35('0x42')]));if(_0x139a08[_0x9a35('0x40')][_0x9a35('0x31')]){_0x120426[_0x9a35('0x49')]=_[_0x9a35('0x4b')](_0x120426[_0x9a35('0x49')],{'$or':_[_0x9a35('0x33')](_0x278e1b,function(_0xe47d63){if(_0xe47d63[_0x9a35('0x35')][_0x9a35('0x4c')]!=='VIRTUAL'){var _0x13535b={};_0x13535b[_0xe47d63[_0x9a35('0x4d')]]={'$like':'%'+_0x139a08['query']['filter']+'%'};return _0x13535b;}})});}_0x120426=_[_0x9a35('0x4b')]({},_0x120426,_0x139a08[_0x9a35('0x4e')]);var _0x2b3034={'where':_0x120426[_0x9a35('0x49')]};return db[_0x9a35('0x3d')][_0x9a35('0x4f')](_0x2b3034)[_0x9a35('0x29')](function(_0x170338){_0x5b1569[_0x9a35('0x4f')]=_0x170338;if(_0x139a08['query'][_0x9a35('0x50')]){_0x120426[_0x9a35('0x51')]=[{'all':!![]}];}return db[_0x9a35('0x3d')][_0x9a35('0x52')](_0x120426);})['then'](function(_0x59aa47){_0x5b1569[_0x9a35('0x53')]=_0x59aa47;return _0x5b1569;})['then'](respondWithFilteredResult(_0x4495f0,_0x120426))['catch'](handleError(_0x4495f0,null));};exports['show']=function(_0x4457e5,_0x2fb289){var _0x4c1d0c={'raw':![],'where':{'id':_0x4457e5[_0x9a35('0x54')]['id']}},_0x5c7968={};_0x5c7968[_0x9a35('0x3f')]=_['keys'](db[_0x9a35('0x3d')][_0x9a35('0x3e')]);_0x5c7968[_0x9a35('0x40')]=_[_0x9a35('0x41')](_0x4457e5['query']);_0x5c7968[_0x9a35('0x42')]=_[_0x9a35('0x43')](_0x5c7968[_0x9a35('0x3f')],_0x5c7968[_0x9a35('0x40')]);_0x4c1d0c[_0x9a35('0x45')]=_[_0x9a35('0x43')](_0x5c7968[_0x9a35('0x3f')],qs[_0x9a35('0x44')](_0x4457e5['query'][_0x9a35('0x44')]));_0x4c1d0c['attributes']=_0x4c1d0c['attributes'][_0x9a35('0x55')]?_0x4c1d0c['attributes']:_0x5c7968[_0x9a35('0x3f')];if(_0x4457e5[_0x9a35('0x40')][_0x9a35('0x50')]){_0x4c1d0c[_0x9a35('0x51')]=[{'all':!![]}];}_0x4c1d0c=_[_0x9a35('0x4b')]({},_0x4c1d0c,_0x4457e5[_0x9a35('0x4e')]);return db['VoiceExtension'][_0x9a35('0x36')](_0x4c1d0c)['then'](handleEntityNotFound(_0x2fb289,null))[_0x9a35('0x29')](respondWithResult(_0x2fb289,null))[_0x9a35('0x56')](handleError(_0x2fb289,null));};exports['destroy']=function(_0x18fb2e,_0x2b15c2){return db[_0x9a35('0x3d')][_0x9a35('0x36')]({'where':{'id':_0x18fb2e[_0x9a35('0x54')]['id']}})[_0x9a35('0x29')](handleEntityNotFound(_0x2b15c2,null))[_0x9a35('0x29')](removeEntity(_0x2b15c2,null))[_0x9a35('0x56')](handleError(_0x2b15c2,null));};exports[_0x9a35('0x57')]=function(_0x458630,_0x2e76d5){if(_0x458630[_0x9a35('0x58')][_0x9a35('0x35')]===_0x9a35('0x2e')&&!_[_0x9a35('0x59')](_0x458630[_0x9a35('0x58')][_0x9a35('0x5a')],'_')){_0x458630['body'][_0x9a35('0x5a')]='_'[_0x9a35('0x5b')](_0x458630[_0x9a35('0x58')]['exten']);}return db[_0x9a35('0x3d')]['create'](_0x458630[_0x9a35('0x58')],{'raw':![]})[_0x9a35('0x29')](function(_0x3406fb){var _0xbbedfb=_0x458630['user'][_0x9a35('0x5c')]({'plain':!![]});if(!_0xbbedfb)throw new Error(_0x9a35('0x5d'));if(_0xbbedfb[_0x9a35('0x5e')]===_0x9a35('0x5f')){var _0x2afbe9=_0x3406fb[_0x9a35('0x5c')]({'plain':!![]});var _0x3045c4=[{'name':'InboundRoutes','value':_0x9a35('0x2c')},{'name':_0x9a35('0x2d'),'value':_0x9a35('0x2e')},{'name':_0x9a35('0x2f'),'value':_0x9a35('0x30')}];var _0x7284c6=_[_0x9a35('0x36')](_0x3045c4,[_0x9a35('0x34'),_0x2afbe9[_0x9a35('0x35')]])[_0x9a35('0x37')];return db[_0x9a35('0x60')][_0x9a35('0x36')]({'where':{'name':_0x7284c6,'userProfileId':_0xbbedfb[_0x9a35('0x61')]},'raw':!![]})[_0x9a35('0x29')](function(_0x3f2984){if(_0x3f2984&&_0x3f2984[_0x9a35('0x62')]===0x0){return db[_0x9a35('0x38')][_0x9a35('0x57')]({'name':_0x2afbe9['name'],'resourceId':_0x2afbe9['id'],'type':_0x3f2984[_0x9a35('0x37')],'sectionId':_0x3f2984['id']},{})[_0x9a35('0x29')](function(){return _0x3406fb;});}else{return _0x3406fb;}})['catch'](function(_0x4307b0){logger['error'](_0x9a35('0x63'),_0x4307b0);throw _0x4307b0;});}return _0x3406fb;})[_0x9a35('0x29')](respondWithResult(_0x2e76d5,0xc9))[_0x9a35('0x56')](handleError(_0x2e76d5,null));};exports[_0x9a35('0x28')]=function(_0x3f9f0b,_0xbfb2c9){if(_0x3f9f0b[_0x9a35('0x58')]['id']){delete _0x3f9f0b[_0x9a35('0x58')]['id'];}return db[_0x9a35('0x3d')]['find']({'where':{'id':_0x3f9f0b[_0x9a35('0x54')]['id']}})[_0x9a35('0x29')](handleEntityNotFound(_0xbfb2c9,null))['then'](function(_0x25974a){if(_0x25974a){return db[_0x9a35('0x3d')][_0x9a35('0x28')](_[_0x9a35('0x4a')](_0x3f9f0b[_0x9a35('0x58')],['exten',_0x9a35('0x64'),'description','recordingFormat',_0x9a35('0x65'),_0x9a35('0x66')]),{'where':{'context':_0x25974a[_0x9a35('0x64')],'exten':_0x25974a[_0x9a35('0x5a')]},'individualHooks':!![]})['then'](function(_0xdc9f5c){return _0xdc9f5c;});}return null;})[_0x9a35('0x29')](respondWithStatusCode(_0xbfb2c9,null))[_0x9a35('0x56')](handleError(_0xbfb2c9,null));};exports[_0x9a35('0x67')]=function(_0xb9ef81,_0x20ed5f,_0x4f87f4){return db[_0x9a35('0x3d')]['findOne']({'where':{'id':_0xb9ef81[_0x9a35('0x54')]['id']}})['then'](handleEntityNotFound(_0x20ed5f,null))[_0x9a35('0x29')](function(_0x53f613){if(_0x53f613){return db[_0x9a35('0x68')]['transaction'](function(_0xf4a746){return db[_0x9a35('0x3d')]['destroy']({'where':{'VoiceExtensionId':_0xb9ef81[_0x9a35('0x54')]['id']},'transaction':_0xf4a746})[_0x9a35('0x29')](function(_0x247750){var _0x1fb5f2=_[_0x9a35('0x33')](_0xb9ef81['body'],function(_0x5915f4){_0x5915f4['VoiceExtensionId']=_0xb9ef81['params']['id'];return _0x5915f4;});return db[_0x9a35('0x3d')][_0x9a35('0x69')](_0x1fb5f2,{'transaction':_0xf4a746});});})[_0x9a35('0x29')](function(){return db[_0x9a35('0x3d')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xb9ef81[_0x9a35('0x54')]['id']},'order':_0x9a35('0x6a')});});}})[_0x9a35('0x29')](respondWithResult(_0x20ed5f,null))['catch'](handleError(_0x20ed5f,null));}; \ No newline at end of file +var _0xde03=['transaction','VoiceExtensionId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','ignore','map','value','type','find','name','UserProfileResource','sendStatus','stack','send','index','VoiceExtension','model','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','key','field','filter','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','internal','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','params','sequelize'];(function(_0x3975cc,_0x911199){var _0x10dc27=function(_0x47c0fc){while(--_0x47c0fc){_0x3975cc['push'](_0x3975cc['shift']());}};_0x10dc27(++_0x911199);}(_0xde03,0x1a2));var _0x3de0=function(_0xdefc9a,_0xda2293){_0xdefc9a=_0xdefc9a-0x0;var _0x199e77=_0xde03[_0xdefc9a];return _0x199e77;};'use strict';var pdf=require(_0x3de0('0x0'));var emlformat=require(_0x3de0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3de0('0x2'));var jsonpatch=require(_0x3de0('0x3'));var rp=require(_0x3de0('0x4'));var moment=require(_0x3de0('0x5'));var BPromise=require(_0x3de0('0x6'));var Mustache=require(_0x3de0('0x7'));var util=require(_0x3de0('0x8'));var path=require(_0x3de0('0x9'));var sox=require(_0x3de0('0xa'));var csv=require(_0x3de0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3de0('0xc'));var squel=require('squel');var crypto=require(_0x3de0('0xd'));var jsforce=require(_0x3de0('0xe'));var deskjs=require(_0x3de0('0xf'));var toCsv=require(_0x3de0('0xb'));var querystring=require(_0x3de0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3de0('0x11'));var hardwareService=require(_0x3de0('0x12'));var logger=require(_0x3de0('0x13'))(_0x3de0('0x14'));var utils=require(_0x3de0('0x15'));var config=require('../../config/environment');var db=require(_0x3de0('0x16'))['db'];config[_0x3de0('0x17')]=_[_0x3de0('0x18')](config[_0x3de0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3de0('0x19'))(new Redis(config['redis']));require(_0x3de0('0x1a'))['register'](socket);function respondWithStatusCode(_0x365fd5,_0xfd9f13){_0xfd9f13=_0xfd9f13||0xcc;return function(_0x3555ac){if(_0x3555ac){return _0x365fd5['sendStatus'](_0xfd9f13);}return _0x365fd5[_0x3de0('0x1b')](_0xfd9f13)['end']();};}function respondWithResult(_0x3f0cc1,_0x21ded5){_0x21ded5=_0x21ded5||0xc8;return function(_0x3ed388){if(_0x3ed388){return _0x3f0cc1[_0x3de0('0x1b')](_0x21ded5)[_0x3de0('0x1c')](_0x3ed388);}};}function respondWithFilteredResult(_0x57e06a,_0x4baf93){return function(_0x143465){if(_0x143465){var _0x480607=_0x143465[_0x3de0('0x1d')],_0x184209=_0x4baf93['offset'],_0x1b0f69=_0x4baf93[_0x3de0('0x1e')]+_0x4baf93[_0x3de0('0x1f')],_0x3edc4;if(_0x1b0f69>=_0x480607){_0x1b0f69=_0x480607;_0x3edc4=0xc8;}else{_0x3edc4=0xce;}_0x57e06a[_0x3de0('0x1b')](_0x3edc4);return _0x57e06a[_0x3de0('0x20')](_0x3de0('0x21'),_0x184209+'-'+_0x1b0f69+'/'+_0x480607)[_0x3de0('0x1c')](_0x143465);}return null;};}function patchUpdates(_0x128bdf){return function(_0x2e8d03){try{jsonpatch[_0x3de0('0x22')](_0x2e8d03,_0x128bdf,!![]);}catch(_0x3a290d){return BPromise[_0x3de0('0x23')](_0x3a290d);}return _0x2e8d03[_0x3de0('0x24')]();};}function saveUpdates(_0x24d81c,_0x228234){return function(_0x574693){if(_0x574693){return _0x574693['update'](_0x24d81c)['then'](function(_0x13b425){return _0x13b425;});}return null;};}function removeEntity(_0x5598c4,_0x20c0d0){return function(_0x2ed4e4){if(_0x2ed4e4){return _0x2ed4e4[_0x3de0('0x25')]()[_0x3de0('0x26')](function(){var _0x1685ff=_0x2ed4e4[_0x3de0('0x27')]({'plain':!![]});var _0x4a1478=[{'name':_0x3de0('0x28'),'value':_0x3de0('0x29'),'ignore':![]},{'name':'OutboundRoutes','value':_0x3de0('0x2a'),'ignore':![]},{'name':_0x3de0('0x2b'),'value':'internal','ignore':![]}];var _0x37fd81=_(_0x4a1478)['filter'](_0x3de0('0x2c'))[_0x3de0('0x2d')](_0x3de0('0x2e'))[_0x3de0('0x2e')]();if(_['includes'](_0x37fd81,_0x1685ff[_0x3de0('0x2f')])){return;}var _0x55319e=_[_0x3de0('0x30')](_0x4a1478,[_0x3de0('0x2e'),_0x1685ff[_0x3de0('0x2f')]])[_0x3de0('0x31')];return db[_0x3de0('0x32')]['destroy']({'where':{'type':_0x55319e,'resourceId':_0x1685ff['id']}})[_0x3de0('0x26')](function(){return _0x2ed4e4;});})[_0x3de0('0x26')](function(){_0x5598c4[_0x3de0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125f53,_0x22efd6){return function(_0x4cc0dc){if(!_0x4cc0dc){_0x125f53[_0x3de0('0x33')](0x194);}return _0x4cc0dc;};}function handleError(_0x5f0571,_0xa84b48){_0xa84b48=_0xa84b48||0x1f4;return function(_0x3aa8df){logger['error'](_0x3aa8df[_0x3de0('0x34')]);if(_0x3aa8df[_0x3de0('0x31')]){delete _0x3aa8df[_0x3de0('0x31')];}_0x5f0571[_0x3de0('0x1b')](_0xa84b48)[_0x3de0('0x35')](_0x3aa8df);};}exports[_0x3de0('0x36')]=function(_0x4bc431,_0x27ad63){var _0x1c871f={},_0x297f09={},_0x3ec7ff={'count':0x0,'rows':[]};var _0x41c5c4=db[_0x3de0('0x37')]['rawAttributes'];_0x297f09[_0x3de0('0x38')]=_['keys'](_0x41c5c4);_0x297f09['query']=_['keys'](_0x4bc431['query']);_0x297f09[_0x3de0('0x39')]=_[_0x3de0('0x3a')](_0x297f09[_0x3de0('0x38')],_0x297f09['query']);_0x1c871f['attributes']=_[_0x3de0('0x3a')](_0x297f09['model'],qs[_0x3de0('0x3b')](_0x4bc431[_0x3de0('0x3c')][_0x3de0('0x3b')]));_0x1c871f[_0x3de0('0x3d')]=_0x1c871f[_0x3de0('0x3d')]['length']?_0x1c871f[_0x3de0('0x3d')]:_0x297f09['model'];if(!_0x4bc431[_0x3de0('0x3c')][_0x3de0('0x3e')](_0x3de0('0x3f'))){_0x1c871f[_0x3de0('0x1f')]=qs['limit'](_0x4bc431[_0x3de0('0x3c')][_0x3de0('0x1f')]);_0x1c871f[_0x3de0('0x1e')]=qs[_0x3de0('0x1e')](_0x4bc431['query'][_0x3de0('0x1e')]);}_0x1c871f['order']=qs[_0x3de0('0x40')](_0x4bc431[_0x3de0('0x3c')][_0x3de0('0x40')]);_0x1c871f[_0x3de0('0x41')]=qs['filters'](_[_0x3de0('0x42')](_0x4bc431[_0x3de0('0x3c')],_0x297f09['filters']));if(_0x4bc431[_0x3de0('0x3c')]['filter']){_0x1c871f[_0x3de0('0x41')]=_[_0x3de0('0x43')](_0x1c871f[_0x3de0('0x41')],{'$or':_[_0x3de0('0x2d')](_0x41c5c4,function(_0x18031f){if(_0x18031f[_0x3de0('0x2f')][_0x3de0('0x44')]!=='VIRTUAL'){var _0x1c3dc0={};_0x1c3dc0[_0x18031f[_0x3de0('0x45')]]={'$like':'%'+_0x4bc431[_0x3de0('0x3c')][_0x3de0('0x46')]+'%'};return _0x1c3dc0;}})});}_0x1c871f=_[_0x3de0('0x43')]({},_0x1c871f,_0x4bc431['options']);var _0x57f0f6={'where':_0x1c871f[_0x3de0('0x41')]};return db[_0x3de0('0x37')][_0x3de0('0x1d')](_0x57f0f6)[_0x3de0('0x26')](function(_0x5c95b0){_0x3ec7ff[_0x3de0('0x1d')]=_0x5c95b0;if(_0x4bc431['query'][_0x3de0('0x47')]){_0x1c871f[_0x3de0('0x48')]=[{'all':!![]}];}return db[_0x3de0('0x37')][_0x3de0('0x49')](_0x1c871f);})[_0x3de0('0x26')](function(_0x28f7a3){_0x3ec7ff[_0x3de0('0x4a')]=_0x28f7a3;return _0x3ec7ff;})[_0x3de0('0x26')](respondWithFilteredResult(_0x27ad63,_0x1c871f))[_0x3de0('0x4b')](handleError(_0x27ad63,null));};exports[_0x3de0('0x4c')]=function(_0x5a734c,_0x9b5adb){var _0x46a993={'raw':![],'where':{'id':_0x5a734c['params']['id']}},_0x1958c1={};_0x1958c1['model']=_[_0x3de0('0x4d')](db[_0x3de0('0x37')][_0x3de0('0x4e')]);_0x1958c1[_0x3de0('0x3c')]=_[_0x3de0('0x4d')](_0x5a734c[_0x3de0('0x3c')]);_0x1958c1['filters']=_['intersection'](_0x1958c1[_0x3de0('0x38')],_0x1958c1[_0x3de0('0x3c')]);_0x46a993[_0x3de0('0x3d')]=_['intersection'](_0x1958c1[_0x3de0('0x38')],qs[_0x3de0('0x3b')](_0x5a734c[_0x3de0('0x3c')][_0x3de0('0x3b')]));_0x46a993['attributes']=_0x46a993[_0x3de0('0x3d')][_0x3de0('0x4f')]?_0x46a993['attributes']:_0x1958c1[_0x3de0('0x38')];if(_0x5a734c['query'][_0x3de0('0x47')]){_0x46a993[_0x3de0('0x48')]=[{'all':!![]}];}_0x46a993=_[_0x3de0('0x43')]({},_0x46a993,_0x5a734c['options']);return db[_0x3de0('0x37')][_0x3de0('0x30')](_0x46a993)[_0x3de0('0x26')](handleEntityNotFound(_0x9b5adb,null))[_0x3de0('0x26')](respondWithResult(_0x9b5adb,null))[_0x3de0('0x4b')](handleError(_0x9b5adb,null));};exports[_0x3de0('0x25')]=function(_0x4677ac,_0x31e5f2){return db[_0x3de0('0x37')]['find']({'where':{'id':_0x4677ac['params']['id']}})[_0x3de0('0x26')](handleEntityNotFound(_0x31e5f2,null))[_0x3de0('0x26')](removeEntity(_0x31e5f2,null))[_0x3de0('0x4b')](handleError(_0x31e5f2,null));};exports[_0x3de0('0x50')]=function(_0x367f3b,_0x4f2a12){if(_0x367f3b[_0x3de0('0x51')]['type']==='outbound'&&!_['startsWith'](_0x367f3b['body'][_0x3de0('0x52')],'_')){_0x367f3b[_0x3de0('0x51')][_0x3de0('0x52')]='_'[_0x3de0('0x53')](_0x367f3b[_0x3de0('0x51')][_0x3de0('0x52')]);}return db[_0x3de0('0x37')][_0x3de0('0x50')](_0x367f3b[_0x3de0('0x51')],{'raw':![]})[_0x3de0('0x26')](function(_0x25832c){var _0x807c2c=_0x367f3b[_0x3de0('0x54')][_0x3de0('0x27')]({'plain':!![]});if(!_0x807c2c)throw new Error(_0x3de0('0x55'));if(_0x807c2c[_0x3de0('0x56')]==='user'){var _0x4e1206=_0x25832c[_0x3de0('0x27')]({'plain':!![]});var _0x180770=[{'name':'InboundRoutes','value':_0x3de0('0x29')},{'name':_0x3de0('0x57'),'value':'outbound'},{'name':_0x3de0('0x2b'),'value':_0x3de0('0x58')}];var _0xf6f874=_[_0x3de0('0x30')](_0x180770,[_0x3de0('0x2e'),_0x4e1206[_0x3de0('0x2f')]])[_0x3de0('0x31')];return db['UserProfileSection'][_0x3de0('0x30')]({'where':{'name':_0xf6f874,'userProfileId':_0x807c2c[_0x3de0('0x59')]},'raw':!![]})[_0x3de0('0x26')](function(_0x4e6d19){if(_0x4e6d19&&_0x4e6d19['autoAssociation']===0x0){return db['UserProfileResource'][_0x3de0('0x50')]({'name':_0x4e1206[_0x3de0('0x31')],'resourceId':_0x4e1206['id'],'type':_0x4e6d19[_0x3de0('0x31')],'sectionId':_0x4e6d19['id']},{})[_0x3de0('0x26')](function(){return _0x25832c;});}else{return _0x25832c;}})[_0x3de0('0x4b')](function(_0x4a5190){logger[_0x3de0('0x5a')](_0x3de0('0x5b'),_0x4a5190);throw _0x4a5190;});}return _0x25832c;})[_0x3de0('0x26')](respondWithResult(_0x4f2a12,0xc9))[_0x3de0('0x4b')](handleError(_0x4f2a12,null));};exports[_0x3de0('0x5c')]=function(_0x301d54,_0x259db2){if(_0x301d54[_0x3de0('0x51')]['id']){delete _0x301d54[_0x3de0('0x51')]['id'];}return db[_0x3de0('0x37')][_0x3de0('0x30')]({'where':{'id':_0x301d54['params']['id']}})['then'](handleEntityNotFound(_0x259db2,null))[_0x3de0('0x26')](function(_0x15285c){if(_0x15285c){return db[_0x3de0('0x37')][_0x3de0('0x5c')](_[_0x3de0('0x42')](_0x301d54[_0x3de0('0x51')],[_0x3de0('0x52'),_0x3de0('0x5d'),_0x3de0('0x5e'),_0x3de0('0x5f'),_0x3de0('0x60'),_0x3de0('0x61')]),{'where':{'context':_0x15285c[_0x3de0('0x5d')],'exten':_0x15285c['exten']},'individualHooks':!![]})['then'](function(_0x29bdec){return _0x29bdec;});}return null;})[_0x3de0('0x26')](respondWithStatusCode(_0x259db2,null))['catch'](handleError(_0x259db2,null));};exports[_0x3de0('0x62')]=function(_0x2c1b0f,_0x1c2d2c,_0x1da616){return db[_0x3de0('0x37')][_0x3de0('0x63')]({'where':{'id':_0x2c1b0f[_0x3de0('0x64')]['id']}})[_0x3de0('0x26')](handleEntityNotFound(_0x1c2d2c,null))[_0x3de0('0x26')](function(_0x204b0a){if(_0x204b0a){return db[_0x3de0('0x65')][_0x3de0('0x66')](function(_0x4127a8){return db[_0x3de0('0x37')][_0x3de0('0x25')]({'where':{'VoiceExtensionId':_0x2c1b0f[_0x3de0('0x64')]['id']},'transaction':_0x4127a8})[_0x3de0('0x26')](function(_0x47e8da){var _0x171dab=_[_0x3de0('0x2d')](_0x2c1b0f['body'],function(_0x3791ff){_0x3791ff[_0x3de0('0x67')]=_0x2c1b0f[_0x3de0('0x64')]['id'];return _0x3791ff;});return db[_0x3de0('0x37')]['bulkCreate'](_0x171dab,{'transaction':_0x4127a8});});})[_0x3de0('0x26')](function(){return db[_0x3de0('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2c1b0f[_0x3de0('0x64')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x3de0('0x26')](respondWithResult(_0x1c2d2c,null))['catch'](handleError(_0x1c2d2c,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 2f3410b..d795ca4 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners'];(function(_0x2ba478,_0x39c8ac){var _0xbe88d0=function(_0x158933){while(--_0x158933){_0x2ba478['push'](_0x2ba478['shift']());}};_0xbe88d0(++_0x39c8ac);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoiceExtensionEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoiceExtensionEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoiceExtension[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x55ca,0x126));var _0xa55c=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x55ca[_0x64aff8];return _0x5488a3;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var VoiceExtension=require(_0xa55c('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){VoiceExtensionEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);VoiceExtensionEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];VoiceExtension[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index cd965d8..c3fac58 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 _0xeb10=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','voice_extensions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeb10,0x1e4));var _0x0eb1=function(_0x16a5f2,_0x3a65cb){_0x16a5f2=_0x16a5f2-0x0;var _0x29a4e2=_0xeb10[_0x16a5f2];return _0x29a4e2;};'use strict';var _=require(_0x0eb1('0x0'));var util=require(_0x0eb1('0x1'));var logger=require(_0x0eb1('0x2'))(_0x0eb1('0x3'));var moment=require('moment');var BPromise=require(_0x0eb1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0eb1('0x5'));var rimraf=require(_0x0eb1('0x6'));var config=require(_0x0eb1('0x7'));var attributes=require('./voiceExtension.attributes');module[_0x0eb1('0x8')]=function(_0x28f232,_0x42ecff){return _0x28f232[_0x0eb1('0x9')]('VoiceExtension',attributes,{'tableName':_0x0eb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dac=['exports','define','lodash','util','../../config/logger','api','bluebird','../../config/environment','./voiceExtension.attributes'];(function(_0x15f069,_0x439837){var _0x364f3a=function(_0x4f6751){while(--_0x4f6751){_0x15f069['push'](_0x15f069['shift']());}};_0x364f3a(++_0x439837);}(_0x9dac,0x1a0));var _0xc9da=function(_0x2a5daf,_0x35ca15){_0x2a5daf=_0x2a5daf-0x0;var _0x311681=_0x9dac[_0x2a5daf];return _0x311681;};'use strict';var _=require(_0xc9da('0x0'));var util=require(_0xc9da('0x1'));var logger=require(_0xc9da('0x2'))(_0xc9da('0x3'));var moment=require('moment');var BPromise=require(_0xc9da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc9da('0x5'));var attributes=require(_0xc9da('0x6'));module[_0xc9da('0x7')]=function(_0x5df72f,_0xf29be8){return _0x5df72f[_0xc9da('0x8')]('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 48481ae..fbc5c4d 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 _0xaa88=['where','limit','include','map','model','attributes','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceExtension,\x20%s,\x20%s','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0xeb2a31,_0x526ef4){var _0x5b5c07=function(_0x3ffc03){while(--_0x3ffc03){_0xeb2a31['push'](_0xeb2a31['shift']());}};_0x5b5c07(++_0x526ef4);}(_0xaa88,0x137));var _0x8aa8=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0xaa88[_0x102881];return _0x5c63d0;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});config['redis']=_[_0x8aa8('0xb')](config[_0x8aa8('0xc')],{'host':_0x8aa8('0xd'),'port':0x18eb});var socket=require(_0x8aa8('0xe'))(new Redis(config['redis']));require(_0x8aa8('0xf'))[_0x8aa8('0x10')](socket);function respondWithRpcPromise(_0x224f25,_0x5c94d4,_0x4702ab){return new BPromise(function(_0x9f78f5,_0x357e05){return client[_0x8aa8('0x11')](_0x224f25,_0x4702ab)['then'](function(_0x3f8100){logger[_0x8aa8('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5c94d4,_0x8aa8('0x13'));logger[_0x8aa8('0x14')](_0x8aa8('0x15'),_0x5c94d4,'request\x20sent',JSON[_0x8aa8('0x16')](_0x3f8100));if(_0x3f8100[_0x8aa8('0x17')]){if(_0x3f8100[_0x8aa8('0x17')]['code']===0x1f4){logger[_0x8aa8('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5c94d4,_0x3f8100['error'][_0x8aa8('0x18')]);return _0x357e05(_0x3f8100[_0x8aa8('0x17')][_0x8aa8('0x18')]);}logger[_0x8aa8('0x17')](_0x8aa8('0x19'),_0x5c94d4,_0x3f8100[_0x8aa8('0x17')][_0x8aa8('0x18')]);return _0x9f78f5(_0x3f8100[_0x8aa8('0x17')][_0x8aa8('0x18')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x5c94d4,_0x8aa8('0x13'));_0x9f78f5(_0x3f8100['result']['message']);}})[_0x8aa8('0x1a')](function(_0x5ac0d9){logger[_0x8aa8('0x17')](_0x8aa8('0x19'),_0x5c94d4,_0x5ac0d9);_0x357e05(_0x5ac0d9);});});}exports[_0x8aa8('0x1b')]=function(_0x2d5c1b){var _0x502547=this;return new Promise(function(_0xcc2c19,_0x36c445){return db[_0x8aa8('0x1c')][_0x8aa8('0x1d')]({'raw':_0x2d5c1b[_0x8aa8('0x1e')]?_0x2d5c1b[_0x8aa8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2d5c1b[_0x8aa8('0x1e')]?_0x2d5c1b['options'][_0x8aa8('0x1f')]||null:null,'attributes':_0x2d5c1b['options']?_0x2d5c1b[_0x8aa8('0x1e')]['attributes']||null:null,'limit':_0x2d5c1b[_0x8aa8('0x1e')]?_0x2d5c1b[_0x8aa8('0x1e')][_0x8aa8('0x20')]||null:null,'include':_0x2d5c1b['options']?_0x2d5c1b[_0x8aa8('0x1e')][_0x8aa8('0x21')]?_[_0x8aa8('0x22')](_0x2d5c1b['options']['include'],function(_0x2d1508){return{'model':db[_0x2d1508[_0x8aa8('0x23')]],'as':_0x2d1508['as'],'attributes':_0x2d1508[_0x8aa8('0x24')],'include':_0x2d1508[_0x8aa8('0x21')]?_[_0x8aa8('0x22')](_0x2d1508['include'],function(_0x2bc34a){return{'model':db[_0x2bc34a['model']],'as':_0x2bc34a['as'],'attributes':_0x2bc34a[_0x8aa8('0x24')],'include':_0x2bc34a[_0x8aa8('0x21')]?_[_0x8aa8('0x22')](_0x2bc34a['include'],function(_0x4c5c5c){return{'model':db[_0x4c5c5c[_0x8aa8('0x23')]],'as':_0x4c5c5c['as'],'attributes':_0x4c5c5c['attributes']};}):[]};}):[]};}):[]:[]})[_0x8aa8('0x25')](function(_0x14be8b){logger[_0x8aa8('0x12')](_0x8aa8('0x1b'),_0x2d5c1b);logger[_0x8aa8('0x14')]('GetVoiceExtension',_0x2d5c1b,JSON[_0x8aa8('0x16')](_0x14be8b));_0xcc2c19(_0x14be8b);})[_0x8aa8('0x1a')](function(_0x4b67f5){logger[_0x8aa8('0x17')](_0x8aa8('0x1b'),_0x4b67f5[_0x8aa8('0x18')],_0x2d5c1b);_0x36c445(_0x502547['error'](0x1f4,_0x4b67f5[_0x8aa8('0x18')]));});});}; \ No newline at end of file +var _0x087b=['map','model','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x087b,0x11a));var _0xb087=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x087b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});config[_0xb087('0xb')]=_[_0xb087('0xc')](config[_0xb087('0xb')],{'host':_0xb087('0xd'),'port':0x18eb});var socket=require(_0xb087('0xe'))(new Redis(config[_0xb087('0xb')]));require(_0xb087('0xf'))[_0xb087('0x10')](socket);function respondWithRpcPromise(_0x379041,_0x583d25,_0x244abc){return new BPromise(function(_0x108451,_0x903a16){return client[_0xb087('0x11')](_0x379041,_0x244abc)[_0xb087('0x12')](function(_0x2f43e9){logger[_0xb087('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));logger[_0xb087('0x15')](_0xb087('0x16'),_0x583d25,'request\x20sent',JSON[_0xb087('0x17')](_0x2f43e9));if(_0x2f43e9[_0xb087('0x18')]){if(_0x2f43e9[_0xb087('0x18')][_0xb087('0x19')]===0x1f4){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);return _0x903a16(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}logger['error'](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')]['message']);return _0x108451(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}else{logger[_0xb087('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));_0x108451(_0x2f43e9[_0xb087('0x1c')][_0xb087('0x1b')]);}})[_0xb087('0x1d')](function(_0x4e333b){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x4e333b);_0x903a16(_0x4e333b);});});}exports[_0xb087('0x1e')]=function(_0x23c1b6){var _0x5b4ef0=this;return new Promise(function(_0x5aeab1,_0x5ea3dc){return db['VoiceExtension'][_0xb087('0x1f')]({'raw':_0x23c1b6[_0xb087('0x20')]?_0x23c1b6[_0xb087('0x20')][_0xb087('0x21')]===undefined?!![]:![]:!![],'where':_0x23c1b6[_0xb087('0x20')]?_0x23c1b6[_0xb087('0x20')][_0xb087('0x22')]||null:null,'attributes':_0x23c1b6['options']?_0x23c1b6[_0xb087('0x20')][_0xb087('0x23')]||null:null,'limit':_0x23c1b6[_0xb087('0x20')]?_0x23c1b6[_0xb087('0x20')][_0xb087('0x24')]||null:null,'include':_0x23c1b6['options']?_0x23c1b6[_0xb087('0x20')][_0xb087('0x25')]?_['map'](_0x23c1b6['options']['include'],function(_0x598b99){return{'model':db[_0x598b99['model']],'as':_0x598b99['as'],'attributes':_0x598b99[_0xb087('0x23')],'include':_0x598b99[_0xb087('0x25')]?_[_0xb087('0x26')](_0x598b99[_0xb087('0x25')],function(_0xd9ec66){return{'model':db[_0xd9ec66[_0xb087('0x27')]],'as':_0xd9ec66['as'],'attributes':_0xd9ec66[_0xb087('0x23')],'include':_0xd9ec66[_0xb087('0x25')]?_[_0xb087('0x26')](_0xd9ec66[_0xb087('0x25')],function(_0x18058c){return{'model':db[_0x18058c[_0xb087('0x27')]],'as':_0x18058c['as'],'attributes':_0x18058c[_0xb087('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb087('0x12')](function(_0x593b78){logger[_0xb087('0x13')](_0xb087('0x1e'),_0x23c1b6);logger[_0xb087('0x15')](_0xb087('0x1e'),_0x23c1b6,JSON[_0xb087('0x17')](_0x593b78));_0x5aeab1(_0x593b78);})[_0xb087('0x1d')](function(_0x2e1c57){logger[_0xb087('0x18')]('GetVoiceExtension',_0x2e1c57['message'],_0x23c1b6);_0x5ea3dc(_0x5b4ef0[_0xb087('0x18')](0x1f4,_0x2e1c57[_0xb087('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 213d3c4..b78e14c 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 _0x52c8=['emit','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x393d1c,_0x516a02){var _0x1de9b2=function(_0x485a68){while(--_0x485a68){_0x393d1c['push'](_0x393d1c['shift']());}};_0x1de9b2(++_0x516a02);}(_0x52c8,0x70));var _0x852c=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x52c8[_0x3d73ba];return _0x47e406;};'use strict';var VoiceExtensionEvents=require(_0x852c('0x0'));var events=[_0x852c('0x1'),'remove','update'];function createListener(_0x46d818,_0x5a5df7){return function(_0x73efe9){_0x5a5df7[_0x852c('0x2')](_0x46d818,_0x73efe9);};}function removeListener(_0x48ad61,_0x516097){return function(){VoiceExtensionEvents['removeListener'](_0x48ad61,_0x516097);};}exports[_0x852c('0x3')]=function(_0x3b28d9){for(var _0x4bb867=0x0,_0x34cd40=events[_0x852c('0x4')];_0x4bb867<_0x34cd40;_0x4bb867++){var _0x111eeb=events[_0x4bb867];var _0x1e4528=createListener(_0x852c('0x5')+_0x111eeb,_0x3b28d9);VoiceExtensionEvents['on'](_0x111eeb,_0x1e4528);}}; \ No newline at end of file +var _0x031f=['./voiceExtension.events','save','remove','update','removeListener','length','voiceExtension:'];(function(_0x76e13f,_0x5c3b98){var _0x4ec18c=function(_0x16db71){while(--_0x16db71){_0x76e13f['push'](_0x76e13f['shift']());}};_0x4ec18c(++_0x5c3b98);}(_0x031f,0x173));var _0xf031=function(_0x56169b,_0x2d0b88){_0x56169b=_0x56169b-0x0;var _0x37a851=_0x031f[_0x56169b];return _0x37a851;};'use strict';var VoiceExtensionEvents=require(_0xf031('0x0'));var events=[_0xf031('0x1'),_0xf031('0x2'),_0xf031('0x3')];function createListener(_0x3c7cd0,_0x13ae8a){return function(_0x53f261){_0x13ae8a['emit'](_0x3c7cd0,_0x53f261);};}function removeListener(_0x53f6dc,_0x4052c5){return function(){VoiceExtensionEvents[_0xf031('0x4')](_0x53f6dc,_0x4052c5);};}exports['register']=function(_0x31747f){for(var _0x1e4bdd=0x0,_0x21e857=events[_0xf031('0x5')];_0x1e4bdd<_0x21e857;_0x1e4bdd++){var _0x5e3d02=events[_0x1e4bdd];var _0x1f2738=createListener(_0xf031('0x6')+_0x5e3d02,_0x31747f);VoiceExtensionEvents['on'](_0x5e3d02,_0x1f2738);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index b132d57..8ed63cb 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 _0x460b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2c5d10,_0x170feb){var _0x35e632=function(_0x12b3d1){while(--_0x12b3d1){_0x2c5d10['push'](_0x2c5d10['shift']());}};_0x35e632(++_0x170feb);}(_0x460b,0x1b3));var _0xb460=function(_0x5e9d1f,_0x37c578){_0x5e9d1f=_0x5e9d1f-0x0;var _0x895bea=_0x460b[_0x5e9d1f];return _0x895bea;};'use strict';var multer=require(_0xb460('0x0'));var util=require(_0xb460('0x1'));var path=require(_0xb460('0x2'));var timeout=require(_0xb460('0x3'));var express=require(_0xb460('0x4'));var router=express[_0xb460('0x5')]();var auth=require(_0xb460('0x6'));var interaction=require(_0xb460('0x7'));var config=require(_0xb460('0x8'));var controller=require('./voiceMail.controller');router[_0xb460('0x9')]('/',auth[_0xb460('0xa')](),controller['index']);router[_0xb460('0x9')](_0xb460('0xb'),auth[_0xb460('0xa')](),controller[_0xb460('0xc')]);router[_0xb460('0x9')](_0xb460('0xd'),auth['isAuthenticated'](),controller[_0xb460('0xe')]);router[_0xb460('0xf')]('/',auth[_0xb460('0xa')](),controller[_0xb460('0x10')]);router[_0xb460('0x11')](_0xb460('0xb'),auth['isAuthenticated'](),controller[_0xb460('0x12')]);router[_0xb460('0x13')](_0xb460('0xb'),auth['isAuthenticated'](),controller[_0xb460('0x14')]);module[_0xb460('0x15')]=router; \ No newline at end of file +var _0x1468=['./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages','getMessages','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x1468,0x139));var _0x8146=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x1468[_0x144b30];return _0x1bb7bc;};'use strict';var multer=require(_0x8146('0x0'));var util=require(_0x8146('0x1'));var path=require(_0x8146('0x2'));var timeout=require(_0x8146('0x3'));var express=require(_0x8146('0x4'));var router=express[_0x8146('0x5')]();var auth=require(_0x8146('0x6'));var interaction=require(_0x8146('0x7'));var config=require(_0x8146('0x8'));var controller=require(_0x8146('0x9'));router['get']('/',auth[_0x8146('0xa')](),controller[_0x8146('0xb')]);router[_0x8146('0xc')]('/:id',auth[_0x8146('0xa')](),controller[_0x8146('0xd')]);router[_0x8146('0xc')](_0x8146('0xe'),auth['isAuthenticated'](),controller[_0x8146('0xf')]);router['post']('/',auth[_0x8146('0xa')](),controller[_0x8146('0x10')]);router[_0x8146('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8146('0x12')]);router[_0x8146('0x13')](_0x8146('0x14'),auth[_0x8146('0xa')](),controller[_0x8146('0x15')]);module[_0x8146('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 537e54b..3219cdc 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 _0x2d49=['\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','fullname'];(function(_0x2f0a1c,_0x11c65a){var _0x27b279=function(_0x5bcd9b){while(--_0x5bcd9b){_0x2f0a1c['push'](_0x2f0a1c['shift']());}};_0x27b279(++_0x11c65a);}(_0x2d49,0x112));var _0x92d4=function(_0x38ae8c,_0x2e3f73){_0x38ae8c=_0x38ae8c-0x0;var _0x11832b=_0x2d49[_0x38ae8c];return _0x11832b;};'use strict';var Sequelize=require('sequelize');module[_0x92d4('0x0')]={'customer_id':{'type':Sequelize[_0x92d4('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x92d4('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x92d4('0x1')],'defaultValue':'','allowNull':![],'unique':_0x92d4('0x3')},'password':{'type':Sequelize[_0x92d4('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x92d4('0x1')],'validate':{'isEmail':!![]},'set':function(_0x28ca6c){this[_0x92d4('0x4')](_0x92d4('0x5'),typeof _0x28ca6c===_0x92d4('0x6')&&_0x28ca6c['trim']()?_0x28ca6c['trim']():null);}},'pager':{'type':Sequelize[_0x92d4('0x1')]},'tz':{'type':Sequelize[_0x92d4('0x1')],'defaultValue':_0x92d4('0x7')},'attach':{'type':Sequelize[_0x92d4('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x92d4('0x9'),'no'),'defaultValue':_0x92d4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x92d4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x92d4('0x8')](_0x92d4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x92d4('0x8')](_0x92d4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x92d4('0x8')](_0x92d4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x92d4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x92d4('0x8')](_0x92d4('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x92d4('0x8')](_0x92d4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x92d4('0x8')](_0x92d4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x92d4('0x8')]('yes','no'),'defaultValue':_0x92d4('0x9'),'allowNull':![]},'stamp':{'type':_0x92d4('0xa')},'emailsubject':{'type':Sequelize[_0x92d4('0x1')]},'emailbody':{'type':Sequelize[_0x92d4('0x1')]},'maxsecs':{'type':Sequelize[_0x92d4('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x92d4('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x92d4('0xc')],'get':function(){return this['getDataValue'](_0x92d4('0xd'))+_0x92d4('0xe')+this['getDataValue'](_0x92d4('0xf'));}}}; \ No newline at end of file +var _0xb4f4=['INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x156995,_0x3e4030){var _0x195cf3=function(_0x318652){while(--_0x318652){_0x156995['push'](_0x156995['shift']());}};_0x195cf3(++_0x3e4030);}(_0xb4f4,0x16e));var _0x4b4f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xb4f4[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'customer_id':{'type':Sequelize[_0x4b4f('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x4b4f('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x4b4f('0x2')],'defaultValue':'','allowNull':![],'unique':_0x4b4f('0x4')},'password':{'type':Sequelize[_0x4b4f('0x2')]},'fullname':{'type':Sequelize[_0x4b4f('0x2')]},'email':{'type':Sequelize[_0x4b4f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x29d44f){this[_0x4b4f('0x5')](_0x4b4f('0x6'),typeof _0x29d44f===_0x4b4f('0x7')&&_0x29d44f[_0x4b4f('0x8')]()?_0x29d44f['trim']():null);}},'pager':{'type':Sequelize[_0x4b4f('0x2')]},'tz':{'type':Sequelize[_0x4b4f('0x2')],'defaultValue':_0x4b4f('0x9')},'attach':{'type':Sequelize[_0x4b4f('0xa')]('yes','no'),'defaultValue':_0x4b4f('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4b4f('0xa')]('yes','no'),'defaultValue':_0x4b4f('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4b4f('0x2')]},'callback':{'type':Sequelize[_0x4b4f('0x2')]},'review':{'type':Sequelize[_0x4b4f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4b4f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4b4f('0xa')](_0x4b4f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4b4f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4b4f('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4b4f('0xa')](_0x4b4f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4b4f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4b4f('0xa')](_0x4b4f('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x4b4f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x4b4f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x4b4f('0xb'),'no'),'defaultValue':_0x4b4f('0xb'),'allowNull':![]},'stamp':{'type':_0x4b4f('0xd')},'emailsubject':{'type':Sequelize[_0x4b4f('0x2')]},'emailbody':{'type':Sequelize[_0x4b4f('0x2')]},'maxsecs':{'type':Sequelize[_0x4b4f('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4b4f('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4b4f('0xf')],'get':function(){return this[_0x4b4f('0x10')]('fullname')+_0x4b4f('0x11')+this[_0x4b4f('0x10')](_0x4b4f('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2368c1f..bc8e323 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 _0x1066=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','stack','name','send','VoiceMail','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','key','VIRTUAL','options','include','findAll','catch','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','nolimit','map','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x43dae5,_0x5ed4a6){var _0x106898=function(_0x4047d7){while(--_0x4047d7){_0x43dae5['push'](_0x43dae5['shift']());}};_0x106898(++_0x5ed4a6);}(_0x1066,0xee));var _0x6106=function(_0x1f238e,_0x408ab5){_0x1f238e=_0x1f238e-0x0;var _0x1c6f74=_0x1066[_0x1f238e];return _0x1c6f74;};'use strict';var pdf=require(_0x6106('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6106('0x1'));var zipdir=require(_0x6106('0x2'));var jsonpatch=require(_0x6106('0x3'));var rp=require(_0x6106('0x4'));var moment=require(_0x6106('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6106('0x6'));var path=require('path');var sox=require(_0x6106('0x7'));var csv=require('to-csv');var ejs=require(_0x6106('0x8'));var fs=require('fs');var _=require(_0x6106('0x9'));var squel=require(_0x6106('0xa'));var crypto=require(_0x6106('0xb'));var jsforce=require(_0x6106('0xc'));var deskjs=require(_0x6106('0xd'));var toCsv=require(_0x6106('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6106('0xf'));var authService=require(_0x6106('0x10'));var qs=require(_0x6106('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6106('0x12'))(_0x6106('0x13'));var utils=require(_0x6106('0x14'));var config=require(_0x6106('0x15'));var db=require(_0x6106('0x16'))['db'];function respondWithStatusCode(_0x1d57d6,_0x2afe9a){_0x2afe9a=_0x2afe9a||0xcc;return function(_0x4e650b){if(_0x4e650b){return _0x1d57d6[_0x6106('0x17')](_0x2afe9a);}return _0x1d57d6[_0x6106('0x18')](_0x2afe9a)[_0x6106('0x19')]();};}function respondWithResult(_0x301442,_0x4c11f7){_0x4c11f7=_0x4c11f7||0xc8;return function(_0x29f4bd){if(_0x29f4bd){return _0x301442[_0x6106('0x18')](_0x4c11f7)[_0x6106('0x1a')](_0x29f4bd);}};}function respondWithFilteredResult(_0x4019f0,_0x50cf95){return function(_0x20f13b){if(_0x20f13b){var _0x15ba61=_0x20f13b[_0x6106('0x1b')],_0x2e6cc5=_0x50cf95[_0x6106('0x1c')],_0x1a57e3=_0x50cf95[_0x6106('0x1c')]+_0x50cf95[_0x6106('0x1d')],_0x1af549;if(_0x1a57e3>=_0x15ba61){_0x1a57e3=_0x15ba61;_0x1af549=0xc8;}else{_0x1af549=0xce;}_0x4019f0['status'](_0x1af549);return _0x4019f0[_0x6106('0x1e')](_0x6106('0x1f'),_0x2e6cc5+'-'+_0x1a57e3+'/'+_0x15ba61)[_0x6106('0x1a')](_0x20f13b);}return null;};}function patchUpdates(_0x14c835){return function(_0x19feec){try{jsonpatch[_0x6106('0x20')](_0x19feec,_0x14c835,!![]);}catch(_0x50c62d){return BPromise[_0x6106('0x21')](_0x50c62d);}return _0x19feec[_0x6106('0x22')]();};}function saveUpdates(_0xa00a2b,_0xff0df3){return function(_0xaf974d){if(_0xaf974d){return _0xaf974d[_0x6106('0x23')](_0xa00a2b)[_0x6106('0x24')](function(_0x3ec9eb){return _0x3ec9eb;});}return null;};}function removeEntity(_0x5b40b4,_0x3a09a9){return function(_0x2b7e81){if(_0x2b7e81){return _0x2b7e81['destroy']()[_0x6106('0x24')](function(){var _0x254982=_0x2b7e81[_0x6106('0x25')]({'plain':!![]});var _0x58fdab=_0x6106('0x26');return db[_0x6106('0x27')][_0x6106('0x28')]({'where':{'type':_0x58fdab,'resourceId':_0x254982['id']}})['then'](function(){return _0x2b7e81;});})[_0x6106('0x24')](function(){_0x5b40b4[_0x6106('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b065,_0x2ab50e){return function(_0x13dfb9){if(!_0x13dfb9){_0x19b065[_0x6106('0x17')](0x194);}return _0x13dfb9;};}function handleError(_0x47db71,_0x225410){_0x225410=_0x225410||0x1f4;return function(_0x1530f3){logger['error'](_0x1530f3[_0x6106('0x29')]);if(_0x1530f3[_0x6106('0x2a')]){delete _0x1530f3[_0x6106('0x2a')];}_0x47db71[_0x6106('0x18')](_0x225410)[_0x6106('0x2b')](_0x1530f3);};}exports['index']=function(_0x40461b,_0x5e0368){var _0x3e53c4={},_0x440c35={},_0x277a32={'count':0x0,'rows':[]};var _0x1723da=db[_0x6106('0x2c')]['rawAttributes'];_0x440c35[_0x6106('0x2d')]=_[_0x6106('0x2e')](_0x1723da);_0x440c35[_0x6106('0x2f')]=_[_0x6106('0x2e')](_0x40461b[_0x6106('0x2f')]);_0x440c35[_0x6106('0x30')]=_[_0x6106('0x31')](_0x440c35[_0x6106('0x2d')],_0x440c35[_0x6106('0x2f')]);_0x3e53c4['attributes']=_[_0x6106('0x31')](_0x440c35['model'],qs[_0x6106('0x32')](_0x40461b['query'][_0x6106('0x32')]));_0x3e53c4['attributes']=_0x3e53c4[_0x6106('0x33')]['length']?_0x3e53c4[_0x6106('0x33')]:_0x440c35[_0x6106('0x2d')];if(!_0x40461b[_0x6106('0x2f')][_0x6106('0x34')]('nolimit')){_0x3e53c4[_0x6106('0x1d')]=qs[_0x6106('0x1d')](_0x40461b[_0x6106('0x2f')][_0x6106('0x1d')]);_0x3e53c4[_0x6106('0x1c')]=qs[_0x6106('0x1c')](_0x40461b[_0x6106('0x2f')][_0x6106('0x1c')]);}_0x3e53c4[_0x6106('0x35')]=qs[_0x6106('0x36')](_0x40461b[_0x6106('0x2f')]['sort']);_0x3e53c4['where']=qs[_0x6106('0x30')](_[_0x6106('0x37')](_0x40461b[_0x6106('0x2f')],_0x440c35[_0x6106('0x30')]));if(_0x40461b['query'][_0x6106('0x38')]){_0x3e53c4[_0x6106('0x39')]=_[_0x6106('0x3a')](_0x3e53c4[_0x6106('0x39')],{'$or':_['map'](_0x1723da,function(_0x41f6b3){if(_0x41f6b3[_0x6106('0x3b')][_0x6106('0x3c')]!==_0x6106('0x3d')){var _0x521231={};_0x521231[_0x41f6b3['field']]={'$like':'%'+_0x40461b[_0x6106('0x2f')]['filter']+'%'};return _0x521231;}})});}_0x3e53c4=_['merge']({},_0x3e53c4,_0x40461b[_0x6106('0x3e')]);var _0x5bfa97={'where':_0x3e53c4['where']};return db[_0x6106('0x2c')]['count'](_0x5bfa97)[_0x6106('0x24')](function(_0x27c98c){_0x277a32[_0x6106('0x1b')]=_0x27c98c;if(_0x40461b['query']['includeAll']){_0x3e53c4[_0x6106('0x3f')]=[{'all':!![]}];}return db['VoiceMail'][_0x6106('0x40')](_0x3e53c4);})[_0x6106('0x24')](function(_0x10bd9f){_0x277a32['rows']=_0x10bd9f;return _0x277a32;})['then'](respondWithFilteredResult(_0x5e0368,_0x3e53c4))[_0x6106('0x41')](handleError(_0x5e0368,null));};exports['show']=function(_0x4a87b1,_0x51046f){var _0x4a3ade={'raw':!![],'where':{'id':_0x4a87b1[_0x6106('0x42')]['id']}},_0x461ac8={};_0x461ac8[_0x6106('0x2d')]=_[_0x6106('0x2e')](db[_0x6106('0x2c')][_0x6106('0x43')]);_0x461ac8[_0x6106('0x2f')]=_[_0x6106('0x2e')](_0x4a87b1[_0x6106('0x2f')]);_0x461ac8['filters']=_[_0x6106('0x31')](_0x461ac8[_0x6106('0x2d')],_0x461ac8[_0x6106('0x2f')]);_0x4a3ade[_0x6106('0x33')]=_[_0x6106('0x31')](_0x461ac8[_0x6106('0x2d')],qs[_0x6106('0x32')](_0x4a87b1[_0x6106('0x2f')][_0x6106('0x32')]));_0x4a3ade[_0x6106('0x33')]=_0x4a3ade[_0x6106('0x33')][_0x6106('0x44')]?_0x4a3ade['attributes']:_0x461ac8[_0x6106('0x2d')];if(_0x4a87b1[_0x6106('0x2f')]['includeAll']){_0x4a3ade[_0x6106('0x3f')]=[{'all':!![]}];}_0x4a3ade=_[_0x6106('0x3a')]({},_0x4a3ade,_0x4a87b1[_0x6106('0x3e')]);return db['VoiceMail'][_0x6106('0x45')](_0x4a3ade)[_0x6106('0x24')](handleEntityNotFound(_0x51046f,null))[_0x6106('0x24')](respondWithResult(_0x51046f,null))[_0x6106('0x41')](handleError(_0x51046f,null));};exports['create']=function(_0x219a89,_0x184305){return db[_0x6106('0x2c')][_0x6106('0x46')](_0x219a89['body'],{})[_0x6106('0x24')](function(_0x3850b5){var _0x1c578a=_0x219a89[_0x6106('0x47')]['get']({'plain':!![]});if(!_0x1c578a)throw new Error(_0x6106('0x48'));if(_0x1c578a['role']===_0x6106('0x47')){var _0x1b6618=_0x3850b5['get']({'plain':!![]});var _0x412e29=_0x6106('0x26');return db[_0x6106('0x49')]['find']({'where':{'name':_0x412e29,'userProfileId':_0x1c578a[_0x6106('0x4a')]},'raw':!![]})[_0x6106('0x24')](function(_0x3ee557){if(_0x3ee557&&_0x3ee557[_0x6106('0x4b')]===0x0){return db[_0x6106('0x27')][_0x6106('0x46')]({'name':_0x1b6618['name'],'resourceId':_0x1b6618['id'],'type':_0x3ee557[_0x6106('0x2a')],'sectionId':_0x3ee557['id']},{})['then'](function(){return _0x3850b5;});}else{return _0x3850b5;}})[_0x6106('0x41')](function(_0x49c2ea){logger[_0x6106('0x4c')](_0x6106('0x4d'),_0x49c2ea);throw _0x49c2ea;});}return _0x3850b5;})[_0x6106('0x24')](respondWithResult(_0x184305,0xc9))[_0x6106('0x41')](handleError(_0x184305,null));};exports['update']=function(_0x1bb145,_0x56bdd2){if(_0x1bb145['body']['id']){delete _0x1bb145[_0x6106('0x4e')]['id'];}return db[_0x6106('0x2c')][_0x6106('0x45')]({'where':{'id':_0x1bb145[_0x6106('0x42')]['id']}})[_0x6106('0x24')](handleEntityNotFound(_0x56bdd2,null))[_0x6106('0x24')](saveUpdates(_0x1bb145[_0x6106('0x4e')],null))[_0x6106('0x24')](respondWithResult(_0x56bdd2,null))[_0x6106('0x41')](handleError(_0x56bdd2,null));};exports[_0x6106('0x28')]=function(_0x3bc581,_0x498048){return db[_0x6106('0x2c')][_0x6106('0x45')]({'where':{'id':_0x3bc581['params']['id']}})[_0x6106('0x24')](handleEntityNotFound(_0x498048,null))[_0x6106('0x24')](removeEntity(_0x498048,null))[_0x6106('0x41')](handleError(_0x498048,null));};exports[_0x6106('0x4f')]=function(_0x2e0d59,_0x2e94b,_0x3d37ae){return db[_0x6106('0x2c')][_0x6106('0x50')]({'where':{'id':_0x2e0d59['params']['id']}})[_0x6106('0x24')](handleEntityNotFound(_0x2e94b,null))[_0x6106('0x24')](function(_0x238ec5){var _0x32bb58;var _0x495519={},_0xd287d0={};_0xd287d0['model']=_[_0x6106('0x2e')](db['VoiceMailMessage']['rawAttributes']);_0xd287d0[_0x6106('0x2f')]=_[_0x6106('0x2e')](_0x2e0d59[_0x6106('0x2f')]);_0xd287d0[_0x6106('0x30')]=_['intersection'](_0xd287d0[_0x6106('0x2d')],_0xd287d0['query']);_0x495519['attributes']=_[_0x6106('0x31')](_0xd287d0[_0x6106('0x2d')],qs[_0x6106('0x32')](_0x2e0d59['query'][_0x6106('0x32')]));_0x495519[_0x6106('0x33')]=_0x495519[_0x6106('0x33')][_0x6106('0x44')]?_0x495519[_0x6106('0x33')]:_0xd287d0[_0x6106('0x2d')];if(!_0x2e0d59[_0x6106('0x2f')][_0x6106('0x34')](_0x6106('0x51'))){_0x495519['limit']=qs['limit'](_0x2e0d59[_0x6106('0x2f')]['limit']);_0x495519[_0x6106('0x1c')]=qs[_0x6106('0x1c')](_0x2e0d59[_0x6106('0x2f')][_0x6106('0x1c')]);}_0x495519['order']=qs['sort'](_0x2e0d59[_0x6106('0x2f')]['sort']);_0x495519[_0x6106('0x39')]=qs[_0x6106('0x30')](_[_0x6106('0x37')](_0x2e0d59[_0x6106('0x2f')],_0xd287d0[_0x6106('0x30')]));if(_0x2e0d59[_0x6106('0x2f')][_0x6106('0x38')]){_0x495519[_0x6106('0x39')]=_[_0x6106('0x3a')](_0x495519[_0x6106('0x39')],{'$or':_[_0x6106('0x52')](_0x495519['attributes'],function(_0x1fe14d){var _0xbf06d2={};_0xbf06d2[_0x1fe14d]={'$like':'%'+_0x2e0d59[_0x6106('0x2f')][_0x6106('0x38')]+'%'};return _0xbf06d2;})});}_0x495519[_0x6106('0x39')]=_[_0x6106('0x3a')](_0x495519['where'],{'mailboxuser':_0x238ec5[_0x6106('0x53')]});_0x495519=_[_0x6106('0x3a')]({},_0x495519,_0x2e0d59['options']);return db[_0x6106('0x54')][_0x6106('0x55')](_0x495519)[_0x6106('0x24')](respondWithFilteredResult(_0x2e94b,_0x495519));})[_0x6106('0x41')](handleError(_0x2e94b,null));}; \ No newline at end of file +var _0x8af4=['../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','index','VoiceMail','rawAttributes','keys','query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x5df523,_0x6d61d0){var _0x7ad07c=function(_0x525d32){while(--_0x525d32){_0x5df523['push'](_0x5df523['shift']());}};_0x7ad07c(++_0x6d61d0);}(_0x8af4,0xe6));var _0x48af=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0x8af4[_0x22b70f];return _0x100985;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x48af('0x0'));var zipdir=require(_0x48af('0x1'));var jsonpatch=require(_0x48af('0x2'));var rp=require(_0x48af('0x3'));var moment=require(_0x48af('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48af('0x5'));var path=require(_0x48af('0x6'));var sox=require('sox');var csv=require(_0x48af('0x7'));var ejs=require(_0x48af('0x8'));var fs=require('fs');var _=require(_0x48af('0x9'));var squel=require(_0x48af('0xa'));var crypto=require(_0x48af('0xb'));var jsforce=require(_0x48af('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x48af('0x7'));var querystring=require(_0x48af('0xd'));var Papa=require(_0x48af('0xe'));var Redis=require(_0x48af('0xf'));var authService=require(_0x48af('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x48af('0x11'));var logger=require('../../config/logger')(_0x48af('0x12'));var utils=require(_0x48af('0x13'));var config=require(_0x48af('0x14'));var db=require(_0x48af('0x15'))['db'];function respondWithStatusCode(_0x2383e6,_0xa518dd){_0xa518dd=_0xa518dd||0xcc;return function(_0x509461){if(_0x509461){return _0x2383e6['sendStatus'](_0xa518dd);}return _0x2383e6[_0x48af('0x16')](_0xa518dd)['end']();};}function respondWithResult(_0x433710,_0x4f877f){_0x4f877f=_0x4f877f||0xc8;return function(_0x5f5b83){if(_0x5f5b83){return _0x433710[_0x48af('0x16')](_0x4f877f)['json'](_0x5f5b83);}};}function respondWithFilteredResult(_0x2bc8e4,_0x335bc4){return function(_0x1d72d1){if(_0x1d72d1){var _0x2f6518=_0x1d72d1[_0x48af('0x17')],_0x183b0b=_0x335bc4['offset'],_0x20e1fc=_0x335bc4[_0x48af('0x18')]+_0x335bc4[_0x48af('0x19')],_0x290e97;if(_0x20e1fc>=_0x2f6518){_0x20e1fc=_0x2f6518;_0x290e97=0xc8;}else{_0x290e97=0xce;}_0x2bc8e4[_0x48af('0x16')](_0x290e97);return _0x2bc8e4['set'](_0x48af('0x1a'),_0x183b0b+'-'+_0x20e1fc+'/'+_0x2f6518)[_0x48af('0x1b')](_0x1d72d1);}return null;};}function patchUpdates(_0x1230e8){return function(_0x318b3b){try{jsonpatch[_0x48af('0x1c')](_0x318b3b,_0x1230e8,!![]);}catch(_0x27a83a){return BPromise[_0x48af('0x1d')](_0x27a83a);}return _0x318b3b[_0x48af('0x1e')]();};}function saveUpdates(_0xe59c81,_0x203545){return function(_0x716a9){if(_0x716a9){return _0x716a9[_0x48af('0x1f')](_0xe59c81)[_0x48af('0x20')](function(_0x24d130){return _0x24d130;});}return null;};}function removeEntity(_0x1dc76d,_0x478787){return function(_0x2a46df){if(_0x2a46df){return _0x2a46df[_0x48af('0x21')]()[_0x48af('0x20')](function(){var _0x8d8e18=_0x2a46df[_0x48af('0x22')]({'plain':!![]});var _0x3a8f11=_0x48af('0x23');return db[_0x48af('0x24')][_0x48af('0x21')]({'where':{'type':_0x3a8f11,'resourceId':_0x8d8e18['id']}})[_0x48af('0x20')](function(){return _0x2a46df;});})[_0x48af('0x20')](function(){_0x1dc76d[_0x48af('0x16')](0xcc)[_0x48af('0x25')]();});}};}function handleEntityNotFound(_0x837ad,_0x205c89){return function(_0x18a729){if(!_0x18a729){_0x837ad['sendStatus'](0x194);}return _0x18a729;};}function handleError(_0x2764e3,_0x48dd0a){_0x48dd0a=_0x48dd0a||0x1f4;return function(_0x4552a9){logger[_0x48af('0x26')](_0x4552a9[_0x48af('0x27')]);if(_0x4552a9[_0x48af('0x28')]){delete _0x4552a9[_0x48af('0x28')];}_0x2764e3['status'](_0x48dd0a)[_0x48af('0x29')](_0x4552a9);};}exports[_0x48af('0x2a')]=function(_0x307a76,_0x3c36c4){var _0x2057cc={},_0x2aefec={},_0x3b1d62={'count':0x0,'rows':[]};var _0x4c432d=db[_0x48af('0x2b')][_0x48af('0x2c')];_0x2aefec['model']=_[_0x48af('0x2d')](_0x4c432d);_0x2aefec[_0x48af('0x2e')]=_[_0x48af('0x2d')](_0x307a76[_0x48af('0x2e')]);_0x2aefec[_0x48af('0x2f')]=_[_0x48af('0x30')](_0x2aefec['model'],_0x2aefec[_0x48af('0x2e')]);_0x2057cc[_0x48af('0x31')]=_[_0x48af('0x30')](_0x2aefec['model'],qs[_0x48af('0x32')](_0x307a76[_0x48af('0x2e')]['fields']));_0x2057cc[_0x48af('0x31')]=_0x2057cc[_0x48af('0x31')]['length']?_0x2057cc['attributes']:_0x2aefec[_0x48af('0x33')];if(!_0x307a76[_0x48af('0x2e')][_0x48af('0x34')](_0x48af('0x35'))){_0x2057cc[_0x48af('0x19')]=qs['limit'](_0x307a76[_0x48af('0x2e')]['limit']);_0x2057cc[_0x48af('0x18')]=qs[_0x48af('0x18')](_0x307a76['query'][_0x48af('0x18')]);}_0x2057cc[_0x48af('0x36')]=qs[_0x48af('0x37')](_0x307a76[_0x48af('0x2e')]['sort']);_0x2057cc[_0x48af('0x38')]=qs[_0x48af('0x2f')](_[_0x48af('0x39')](_0x307a76[_0x48af('0x2e')],_0x2aefec[_0x48af('0x2f')]));if(_0x307a76[_0x48af('0x2e')][_0x48af('0x3a')]){_0x2057cc[_0x48af('0x38')]=_[_0x48af('0x3b')](_0x2057cc['where'],{'$or':_['map'](_0x4c432d,function(_0x425c51){if(_0x425c51[_0x48af('0x3c')]['key']!==_0x48af('0x3d')){var _0x320c58={};_0x320c58[_0x425c51[_0x48af('0x3e')]]={'$like':'%'+_0x307a76['query']['filter']+'%'};return _0x320c58;}})});}_0x2057cc=_[_0x48af('0x3b')]({},_0x2057cc,_0x307a76[_0x48af('0x3f')]);var _0x5cecf6={'where':_0x2057cc[_0x48af('0x38')]};return db[_0x48af('0x2b')][_0x48af('0x17')](_0x5cecf6)[_0x48af('0x20')](function(_0x3d4983){_0x3b1d62[_0x48af('0x17')]=_0x3d4983;if(_0x307a76[_0x48af('0x2e')][_0x48af('0x40')]){_0x2057cc[_0x48af('0x41')]=[{'all':!![]}];}return db['VoiceMail'][_0x48af('0x42')](_0x2057cc);})['then'](function(_0x21b1ea){_0x3b1d62[_0x48af('0x43')]=_0x21b1ea;return _0x3b1d62;})[_0x48af('0x20')](respondWithFilteredResult(_0x3c36c4,_0x2057cc))[_0x48af('0x44')](handleError(_0x3c36c4,null));};exports['show']=function(_0x51ca3d,_0x14dfe1){var _0x1e3f03={'raw':!![],'where':{'id':_0x51ca3d['params']['id']}},_0x150c48={};_0x150c48[_0x48af('0x33')]=_['keys'](db['VoiceMail'][_0x48af('0x2c')]);_0x150c48['query']=_['keys'](_0x51ca3d['query']);_0x150c48[_0x48af('0x2f')]=_[_0x48af('0x30')](_0x150c48['model'],_0x150c48['query']);_0x1e3f03[_0x48af('0x31')]=_[_0x48af('0x30')](_0x150c48[_0x48af('0x33')],qs['fields'](_0x51ca3d['query'][_0x48af('0x32')]));_0x1e3f03['attributes']=_0x1e3f03['attributes'][_0x48af('0x45')]?_0x1e3f03[_0x48af('0x31')]:_0x150c48[_0x48af('0x33')];if(_0x51ca3d[_0x48af('0x2e')][_0x48af('0x40')]){_0x1e3f03[_0x48af('0x41')]=[{'all':!![]}];}_0x1e3f03=_[_0x48af('0x3b')]({},_0x1e3f03,_0x51ca3d[_0x48af('0x3f')]);return db[_0x48af('0x2b')]['find'](_0x1e3f03)[_0x48af('0x20')](handleEntityNotFound(_0x14dfe1,null))[_0x48af('0x20')](respondWithResult(_0x14dfe1,null))[_0x48af('0x44')](handleError(_0x14dfe1,null));};exports[_0x48af('0x46')]=function(_0x36a952,_0x2a3237){return db[_0x48af('0x2b')][_0x48af('0x46')](_0x36a952[_0x48af('0x47')],{})[_0x48af('0x20')](function(_0x4b67fa){var _0x303b56=_0x36a952[_0x48af('0x48')][_0x48af('0x22')]({'plain':!![]});if(!_0x303b56)throw new Error(_0x48af('0x49'));if(_0x303b56['role']==='user'){var _0x538743=_0x4b67fa[_0x48af('0x22')]({'plain':!![]});var _0x3597f1=_0x48af('0x23');return db[_0x48af('0x4a')][_0x48af('0x4b')]({'where':{'name':_0x3597f1,'userProfileId':_0x303b56[_0x48af('0x4c')]},'raw':!![]})['then'](function(_0xb7bcf9){if(_0xb7bcf9&&_0xb7bcf9[_0x48af('0x4d')]===0x0){return db['UserProfileResource'][_0x48af('0x46')]({'name':_0x538743[_0x48af('0x28')],'resourceId':_0x538743['id'],'type':_0xb7bcf9[_0x48af('0x28')],'sectionId':_0xb7bcf9['id']},{})[_0x48af('0x20')](function(){return _0x4b67fa;});}else{return _0x4b67fa;}})[_0x48af('0x44')](function(_0x4e05e0){logger[_0x48af('0x26')](_0x48af('0x4e'),_0x4e05e0);throw _0x4e05e0;});}return _0x4b67fa;})['then'](respondWithResult(_0x2a3237,0xc9))[_0x48af('0x44')](handleError(_0x2a3237,null));};exports[_0x48af('0x1f')]=function(_0x352710,_0x4a32a5){if(_0x352710[_0x48af('0x47')]['id']){delete _0x352710['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x352710[_0x48af('0x4f')]['id']}})[_0x48af('0x20')](handleEntityNotFound(_0x4a32a5,null))['then'](saveUpdates(_0x352710[_0x48af('0x47')],null))[_0x48af('0x20')](respondWithResult(_0x4a32a5,null))[_0x48af('0x44')](handleError(_0x4a32a5,null));};exports[_0x48af('0x21')]=function(_0x19c3e1,_0x1a62bc){return db[_0x48af('0x2b')][_0x48af('0x4b')]({'where':{'id':_0x19c3e1[_0x48af('0x4f')]['id']}})[_0x48af('0x20')](handleEntityNotFound(_0x1a62bc,null))[_0x48af('0x20')](removeEntity(_0x1a62bc,null))[_0x48af('0x44')](handleError(_0x1a62bc,null));};exports['getMessages']=function(_0xe5ea4e,_0x2d7d47,_0x4b6185){return db[_0x48af('0x2b')]['findOne']({'where':{'id':_0xe5ea4e['params']['id']}})['then'](handleEntityNotFound(_0x2d7d47,null))['then'](function(_0x4cacae){var _0x3bdc92;var _0x54d162={},_0x31becf={};_0x31becf[_0x48af('0x33')]=_['keys'](db[_0x48af('0x50')][_0x48af('0x2c')]);_0x31becf[_0x48af('0x2e')]=_[_0x48af('0x2d')](_0xe5ea4e[_0x48af('0x2e')]);_0x31becf[_0x48af('0x2f')]=_[_0x48af('0x30')](_0x31becf[_0x48af('0x33')],_0x31becf['query']);_0x54d162[_0x48af('0x31')]=_[_0x48af('0x30')](_0x31becf[_0x48af('0x33')],qs[_0x48af('0x32')](_0xe5ea4e[_0x48af('0x2e')]['fields']));_0x54d162[_0x48af('0x31')]=_0x54d162[_0x48af('0x31')][_0x48af('0x45')]?_0x54d162['attributes']:_0x31becf[_0x48af('0x33')];if(!_0xe5ea4e[_0x48af('0x2e')][_0x48af('0x34')](_0x48af('0x35'))){_0x54d162[_0x48af('0x19')]=qs[_0x48af('0x19')](_0xe5ea4e[_0x48af('0x2e')]['limit']);_0x54d162['offset']=qs[_0x48af('0x18')](_0xe5ea4e[_0x48af('0x2e')][_0x48af('0x18')]);}_0x54d162['order']=qs['sort'](_0xe5ea4e[_0x48af('0x2e')]['sort']);_0x54d162[_0x48af('0x38')]=qs[_0x48af('0x2f')](_[_0x48af('0x39')](_0xe5ea4e['query'],_0x31becf[_0x48af('0x2f')]));if(_0xe5ea4e[_0x48af('0x2e')][_0x48af('0x3a')]){_0x54d162[_0x48af('0x38')]=_['merge'](_0x54d162['where'],{'$or':_['map'](_0x54d162[_0x48af('0x31')],function(_0x48f3f1){var _0x26b90c={};_0x26b90c[_0x48f3f1]={'$like':'%'+_0xe5ea4e[_0x48af('0x2e')]['filter']+'%'};return _0x26b90c;})});}_0x54d162[_0x48af('0x38')]=_[_0x48af('0x3b')](_0x54d162[_0x48af('0x38')],{'mailboxuser':_0x4cacae[_0x48af('0x51')]});_0x54d162=_[_0x48af('0x3b')]({},_0x54d162,_0xe5ea4e[_0x48af('0x3f')]);return db['VoiceMailMessage'][_0x48af('0x52')](_0x54d162)['then'](respondWithFilteredResult(_0x2d7d47,_0x54d162));})['catch'](handleError(_0x2d7d47,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2f36cfe..82f3839 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 _0x879c=['voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','define','VoiceMail'];(function(_0x1dc65f,_0x32e8b8){var _0x364b13=function(_0x9f8136){while(--_0x9f8136){_0x1dc65f['push'](_0x1dc65f['shift']());}};_0x364b13(++_0x32e8b8);}(_0x879c,0x177));var _0xc879=function(_0x410ce7,_0x9e3095){_0x410ce7=_0x410ce7-0x0;var _0xee25ec=_0x879c[_0x410ce7];return _0xee25ec;};'use strict';var _=require(_0xc879('0x0'));var util=require(_0xc879('0x1'));var logger=require(_0xc879('0x2'))(_0xc879('0x3'));var moment=require('moment');var BPromise=require(_0xc879('0x4'));var rp=require(_0xc879('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc879('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module['exports']=function(_0x372a12,_0x453ef3){return _0x372a12[_0xc879('0x7')](_0xc879('0x8'),attributes,{'tableName':_0xc879('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xc879('0xa'),_0xc879('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd31=['lodash','util','api','moment','path','../../config/environment','./voiceMail.attributes','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x53c208,_0x2e925c){var _0x4426b1=function(_0x545355){while(--_0x545355){_0x53c208['push'](_0x53c208['shift']());}};_0x4426b1(++_0x2e925c);}(_0xcd31,0x79));var _0x1cd3=function(_0x2b9f6f,_0x132d97){_0x2b9f6f=_0x2b9f6f-0x0;var _0x2bc9f8=_0xcd31[_0x2b9f6f];return _0x2bc9f8;};'use strict';var _=require(_0x1cd3('0x0'));var util=require(_0x1cd3('0x1'));var logger=require('../../config/logger')(_0x1cd3('0x2'));var moment=require(_0x1cd3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cd3('0x4'));var rimraf=require('rimraf');var config=require(_0x1cd3('0x5'));var attributes=require(_0x1cd3('0x6'));module['exports']=function(_0x557bdc,_0x3ad629){return _0x557bdc['define']('VoiceMail',attributes,{'tableName':_0x1cd3('0x7'),'paranoid':![],'indexes':[{'name':_0x1cd3('0x8'),'fields':[_0x1cd3('0x9'),_0x1cd3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 368ee5e..b59e214 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 _0x37c6=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3ba236,_0x1095aa){var _0x408fd5=function(_0x142c7c){while(--_0x142c7c){_0x3ba236['push'](_0x3ba236['shift']());}};_0x408fd5(++_0x1095aa);}(_0x37c6,0x1ec));var _0x637c=function(_0x1c0d92,_0x147743){_0x1c0d92=_0x1c0d92-0x0;var _0x540ea8=_0x37c6[_0x1c0d92];return _0x540ea8;};'use strict';var _=require(_0x637c('0x0'));var util=require(_0x637c('0x1'));var moment=require(_0x637c('0x2'));var BPromise=require(_0x637c('0x3'));var rs=require(_0x637c('0x4'));var fs=require('fs');var Redis=require(_0x637c('0x5'));var db=require(_0x637c('0x6'))['db'];var utils=require(_0x637c('0x7'));var logger=require('../../config/logger')(_0x637c('0x8'));var config=require(_0x637c('0x9'));var jayson=require(_0x637c('0xa'));var client=jayson['client'][_0x637c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa4e6d8,_0x461c72,_0x147c68){return new BPromise(function(_0x18be05,_0x37ce29){return client[_0x637c('0xc')](_0xa4e6d8,_0x147c68)[_0x637c('0xd')](function(_0x384b0d){logger[_0x637c('0xe')](_0x637c('0xf'),_0x461c72,_0x637c('0x10'));logger[_0x637c('0x11')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x461c72,_0x637c('0x10'),JSON[_0x637c('0x12')](_0x384b0d));if(_0x384b0d['error']){if(_0x384b0d['error'][_0x637c('0x13')]===0x1f4){logger[_0x637c('0x14')](_0x637c('0xf'),_0x461c72,_0x384b0d[_0x637c('0x14')]['message']);return _0x37ce29(_0x384b0d[_0x637c('0x14')][_0x637c('0x15')]);}logger[_0x637c('0x14')](_0x637c('0xf'),_0x461c72,_0x384b0d['error'][_0x637c('0x15')]);return _0x18be05(_0x384b0d[_0x637c('0x14')][_0x637c('0x15')]);}else{logger[_0x637c('0xe')](_0x637c('0xf'),_0x461c72,'request\x20sent');_0x18be05(_0x384b0d[_0x637c('0x16')][_0x637c('0x15')]);}})['catch'](function(_0x2024fd){logger[_0x637c('0x14')](_0x637c('0xf'),_0x461c72,_0x2024fd);_0x37ce29(_0x2024fd);});});} \ No newline at end of file +var _0x54b4=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch'];(function(_0x171ba8,_0x570344){var _0x51e64f=function(_0x1e8d31){while(--_0x1e8d31){_0x171ba8['push'](_0x171ba8['shift']());}};_0x51e64f(++_0x570344);}(_0x54b4,0x111));var _0x454b=function(_0x22e8bb,_0x34fb3e){_0x22e8bb=_0x22e8bb-0x0;var _0x270dca=_0x54b4[_0x22e8bb];return _0x270dca;};'use strict';var _=require(_0x454b('0x0'));var util=require('util');var moment=require(_0x454b('0x1'));var BPromise=require(_0x454b('0x2'));var rs=require(_0x454b('0x3'));var fs=require('fs');var Redis=require(_0x454b('0x4'));var db=require(_0x454b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x454b('0x6'))('rpc');var config=require(_0x454b('0x7'));var jayson=require(_0x454b('0x8'));var client=jayson[_0x454b('0x9')][_0x454b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575f97,_0x234a83,_0x2e7ea6){return new BPromise(function(_0x2e8132,_0x487d98){return client[_0x454b('0xb')](_0x575f97,_0x2e7ea6)['then'](function(_0x321f07){logger[_0x454b('0xc')](_0x454b('0xd'),_0x234a83,'request\x20sent');logger[_0x454b('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x234a83,_0x454b('0xf'),JSON[_0x454b('0x10')](_0x321f07));if(_0x321f07[_0x454b('0x11')]){if(_0x321f07[_0x454b('0x11')][_0x454b('0x12')]===0x1f4){logger[_0x454b('0x11')](_0x454b('0xd'),_0x234a83,_0x321f07[_0x454b('0x11')][_0x454b('0x13')]);return _0x487d98(_0x321f07[_0x454b('0x11')][_0x454b('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x234a83,_0x321f07[_0x454b('0x11')][_0x454b('0x13')]);return _0x2e8132(_0x321f07['error'][_0x454b('0x13')]);}else{logger['info'](_0x454b('0xd'),_0x234a83,_0x454b('0xf'));_0x2e8132(_0x321f07['result']['message']);}})[_0x454b('0x14')](function(_0x44d33f){logger[_0x454b('0x11')](_0x454b('0xd'),_0x234a83,_0x44d33f);_0x487d98(_0x44d33f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6a0ad13..34bf6f0 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 _0xb18e=['isAuthenticated','/:id','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb18e,0xbe));var _0xeb18=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0xb18e[_0x446208];return _0xe49563;};'use strict';var multer=require(_0xeb18('0x0'));var util=require(_0xeb18('0x1'));var path=require(_0xeb18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb18('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xeb18('0x4'));var config=require(_0xeb18('0x5'));var controller=require(_0xeb18('0x6'));router[_0xeb18('0x7')]('/',auth[_0xeb18('0x8')](),controller['index']);router[_0xeb18('0x7')](_0xeb18('0x9'),auth[_0xeb18('0x8')](),controller['show']);router[_0xeb18('0x7')](_0xeb18('0xa'),auth[_0xeb18('0x8')](),controller[_0xeb18('0xb')]);router[_0xeb18('0xc')]('/',auth[_0xeb18('0x8')](),controller['create']);router[_0xeb18('0xd')](_0xeb18('0x9'),auth[_0xeb18('0x8')](),controller[_0xeb18('0xe')]);router[_0xeb18('0xf')](_0xeb18('0x9'),auth[_0xeb18('0x8')](),controller[_0xeb18('0x10')]);module[_0xeb18('0x11')]=router; \ No newline at end of file +var _0x9cba=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','put','update','delete'];(function(_0x972692,_0x2a1c56){var _0x542e84=function(_0xe63f21){while(--_0xe63f21){_0x972692['push'](_0x972692['shift']());}};_0x542e84(++_0x2a1c56);}(_0x9cba,0x10a));var _0xa9cb=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9cba[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xa9cb('0x0'));var util=require(_0xa9cb('0x1'));var path=require(_0xa9cb('0x2'));var timeout=require(_0xa9cb('0x3'));var express=require(_0xa9cb('0x4'));var router=express[_0xa9cb('0x5')]();var auth=require(_0xa9cb('0x6'));var interaction=require(_0xa9cb('0x7'));var config=require(_0xa9cb('0x8'));var controller=require(_0xa9cb('0x9'));router[_0xa9cb('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9cb('0xb')]);router[_0xa9cb('0xa')](_0xa9cb('0xc'),auth[_0xa9cb('0xd')](),controller[_0xa9cb('0xe')]);router[_0xa9cb('0xa')](_0xa9cb('0xf'),auth[_0xa9cb('0xd')](),controller[_0xa9cb('0x10')]);router['post']('/',auth[_0xa9cb('0xd')](),controller['create']);router[_0xa9cb('0x11')](_0xa9cb('0xc'),auth[_0xa9cb('0xd')](),controller[_0xa9cb('0x12')]);router[_0xa9cb('0x13')](_0xa9cb('0xc'),auth[_0xa9cb('0xd')](),controller[_0xa9cb('0x14')]);module[_0xa9cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 50e916d..3d16ae2 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 _0x8ba6=['long','TIMESTAMP','sequelize','exports','VIRTUAL','STRING'];(function(_0x32364b,_0x40cce5){var _0x5448de=function(_0x303554){while(--_0x303554){_0x32364b['push'](_0x32364b['shift']());}};_0x5448de(++_0x40cce5);}(_0x8ba6,0x164));var _0x68ba=function(_0x1255eb,_0x1eac28){_0x1255eb=_0x1255eb-0x0;var _0x55fc2a=_0x8ba6[_0x1255eb];return _0x55fc2a;};'use strict';var Sequelize=require(_0x68ba('0x0'));module[_0x68ba('0x1')]={'name':{'type':Sequelize[_0x68ba('0x2')],'get':function(_0x3fdbb0){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x68ba('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x68ba('0x3')],'defaultValue':''},'stamp':{'type':_0x68ba('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0xe6c8=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x283865,_0x495c7f){var _0x4d2713=function(_0x32db6b){while(--_0x32db6b){_0x283865['push'](_0x283865['shift']());}};_0x4d2713(++_0x495c7f);}(_0xe6c8,0x1cc));var _0x8e6c=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xe6c8[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x8e6c('0x0'));module[_0x8e6c('0x1')]={'name':{'type':Sequelize[_0x8e6c('0x2')],'get':function(_0x4ffa8b){return this[_0x8e6c('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x8e6c('0x5')](_0x8e6c('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x8e6c('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8e6c('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ee704ff..264d6e4 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 _0xcc40=['msg_id','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','update','then','error','stack','name','send','index','rawAttributes','model','differenceBy','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','VoiceMailMessage','find','catch','create','body','destroy','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22'];(function(_0x5c21b4,_0x32a80d){var _0x452bea=function(_0x39c97c){while(--_0x39c97c){_0x5c21b4['push'](_0x5c21b4['shift']());}};_0x452bea(++_0x32a80d);}(_0xcc40,0x97));var _0x0cc4=function(_0x2e4cf0,_0x16f2b0){_0x2e4cf0=_0x2e4cf0-0x0;var _0x356ddb=_0xcc40[_0x2e4cf0];return _0x356ddb;};'use strict';var pdf=require(_0x0cc4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cc4('0x1'));var jsonpatch=require(_0x0cc4('0x2'));var rp=require('request-promise');var moment=require(_0x0cc4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0cc4('0x4'));var util=require(_0x0cc4('0x5'));var path=require('path');var sox=require(_0x0cc4('0x6'));var csv=require('to-csv');var ejs=require(_0x0cc4('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0cc4('0x8'));var jsforce=require(_0x0cc4('0x9'));var deskjs=require(_0x0cc4('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cc4('0xb'));var Redis=require(_0x0cc4('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0x0cc4('0xd'));var logger=require(_0x0cc4('0xe'))(_0x0cc4('0xf'));var utils=require(_0x0cc4('0x10'));var config=require(_0x0cc4('0x11'));var db=require(_0x0cc4('0x12'))['db'];function respondWithStatusCode(_0x464113,_0x62d68a){_0x62d68a=_0x62d68a||0xcc;return function(_0x2bdfe8){if(_0x2bdfe8){return _0x464113[_0x0cc4('0x13')](_0x62d68a);}return _0x464113[_0x0cc4('0x14')](_0x62d68a)[_0x0cc4('0x15')]();};}function respondWithResult(_0x1b307c,_0x1e3b89){_0x1e3b89=_0x1e3b89||0xc8;return function(_0x10ba91){if(_0x10ba91){return _0x1b307c['status'](_0x1e3b89)[_0x0cc4('0x16')](_0x10ba91);}};}function respondWithFilteredResult(_0x454e9f,_0x25a579){return function(_0x18a332){if(_0x18a332){var _0x161fca=_0x18a332[_0x0cc4('0x17')],_0x498947=_0x25a579[_0x0cc4('0x18')],_0x20a979=_0x25a579['offset']+_0x25a579[_0x0cc4('0x19')],_0x1dca5e;if(_0x20a979>=_0x161fca){_0x20a979=_0x161fca;_0x1dca5e=0xc8;}else{_0x1dca5e=0xce;}_0x454e9f[_0x0cc4('0x14')](_0x1dca5e);return _0x454e9f[_0x0cc4('0x1a')]('Content-Range',_0x498947+'-'+_0x20a979+'/'+_0x161fca)[_0x0cc4('0x16')](_0x18a332);}return null;};}function patchUpdates(_0x1d70a2){return function(_0x3b3f83){try{jsonpatch['apply'](_0x3b3f83,_0x1d70a2,!![]);}catch(_0x28ba50){return BPromise['reject'](_0x28ba50);}return _0x3b3f83['save']();};}function saveUpdates(_0x3b9b96,_0x5c8a6e){return function(_0x20a35f){if(_0x20a35f){return _0x20a35f[_0x0cc4('0x1b')](_0x3b9b96)[_0x0cc4('0x1c')](function(_0xd7527a){return _0xd7527a;});}return null;};}function removeEntity(_0xece40c,_0x319db7){return function(_0x2978f3){if(_0x2978f3){return _0x2978f3['destroy']()[_0x0cc4('0x1c')](function(){_0xece40c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x363f31,_0x169afe){return function(_0x18177b){if(!_0x18177b){_0x363f31['sendStatus'](0x194);}return _0x18177b;};}function handleError(_0x5f3aeb,_0x37b515){_0x37b515=_0x37b515||0x1f4;return function(_0x406e05){logger[_0x0cc4('0x1d')](_0x406e05[_0x0cc4('0x1e')]);if(_0x406e05['name']){delete _0x406e05[_0x0cc4('0x1f')];}_0x5f3aeb['status'](_0x37b515)[_0x0cc4('0x20')](_0x406e05);};}exports[_0x0cc4('0x21')]=function(_0x3b32f0,_0x20c904){var _0x209d17={},_0x1a8119={},_0x45a605={'count':0x0,'rows':[]};var _0x5f5a22=db['VoiceMailMessage'][_0x0cc4('0x22')];_0x1a8119[_0x0cc4('0x23')]=_[_0x0cc4('0x24')](_[_0x0cc4('0x25')](_0x5f5a22),[_0x0cc4('0x1f')]);_0x1a8119[_0x0cc4('0x26')]=_[_0x0cc4('0x25')](_0x3b32f0['query']);_0x1a8119['filters']=_[_0x0cc4('0x27')](_0x1a8119[_0x0cc4('0x23')],_0x1a8119[_0x0cc4('0x26')]);_0x209d17[_0x0cc4('0x28')]=_['intersection'](_0x1a8119[_0x0cc4('0x23')],qs['fields'](_0x3b32f0['query'][_0x0cc4('0x29')]));_0x209d17['attributes']=_0x209d17[_0x0cc4('0x28')][_0x0cc4('0x2a')]?_0x209d17['attributes']:_0x1a8119['model'];if(!_0x3b32f0[_0x0cc4('0x26')]['hasOwnProperty']('nolimit')){_0x209d17[_0x0cc4('0x19')]=qs[_0x0cc4('0x19')](_0x3b32f0[_0x0cc4('0x26')][_0x0cc4('0x19')]);_0x209d17[_0x0cc4('0x18')]=qs[_0x0cc4('0x18')](_0x3b32f0[_0x0cc4('0x26')]['offset']);}_0x209d17[_0x0cc4('0x2b')]=qs[_0x0cc4('0x2c')](_0x3b32f0[_0x0cc4('0x26')][_0x0cc4('0x2c')]);_0x209d17[_0x0cc4('0x2d')]=qs[_0x0cc4('0x2e')](_[_0x0cc4('0x2f')](_0x3b32f0[_0x0cc4('0x26')],_0x1a8119['filters']));if(_0x3b32f0[_0x0cc4('0x26')][_0x0cc4('0x30')]){_0x209d17[_0x0cc4('0x2d')]=_[_0x0cc4('0x31')](_0x209d17['where'],{'$or':_[_0x0cc4('0x32')](_0x5f5a22,function(_0x4ebd23){if(_0x4ebd23['type'][_0x0cc4('0x33')]!==_0x0cc4('0x34')){var _0x2f0c82={};_0x2f0c82[_0x4ebd23[_0x0cc4('0x35')]]={'$like':'%'+_0x3b32f0[_0x0cc4('0x26')][_0x0cc4('0x30')]+'%'};return _0x2f0c82;}})});}_0x209d17=_[_0x0cc4('0x31')]({},_0x209d17,_0x3b32f0[_0x0cc4('0x36')]);var _0x4057a2={'where':_0x209d17[_0x0cc4('0x2d')]};return db['VoiceMailMessage'][_0x0cc4('0x17')](_0x4057a2)[_0x0cc4('0x1c')](function(_0x4aad56){_0x45a605[_0x0cc4('0x17')]=_0x4aad56;if(_0x3b32f0[_0x0cc4('0x26')][_0x0cc4('0x37')]){_0x209d17[_0x0cc4('0x38')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x0cc4('0x39')](_0x209d17);})['then'](function(_0x477554){_0x45a605[_0x0cc4('0x3a')]=_0x477554;return _0x45a605;})[_0x0cc4('0x1c')](respondWithFilteredResult(_0x20c904,_0x209d17))['catch'](handleError(_0x20c904,null));};exports[_0x0cc4('0x3b')]=function(_0x36d358,_0x5c4596){var _0x29cd4b={'raw':!![],'where':{'id':_0x36d358[_0x0cc4('0x3c')]['id']}},_0x1d54f2={};_0x1d54f2[_0x0cc4('0x23')]=_[_0x0cc4('0x25')](db[_0x0cc4('0x3d')][_0x0cc4('0x22')]);_0x1d54f2[_0x0cc4('0x26')]=_[_0x0cc4('0x25')](_0x36d358['query']);_0x1d54f2[_0x0cc4('0x2e')]=_[_0x0cc4('0x27')](_0x1d54f2[_0x0cc4('0x23')],_0x1d54f2[_0x0cc4('0x26')]);_0x29cd4b[_0x0cc4('0x28')]=_['intersection'](_0x1d54f2['model'],qs[_0x0cc4('0x29')](_0x36d358[_0x0cc4('0x26')][_0x0cc4('0x29')]));_0x29cd4b['attributes']=_0x29cd4b[_0x0cc4('0x28')][_0x0cc4('0x2a')]?_0x29cd4b['attributes']:_0x1d54f2[_0x0cc4('0x23')];if(_0x36d358['query'][_0x0cc4('0x37')]){_0x29cd4b[_0x0cc4('0x38')]=[{'all':!![]}];}_0x29cd4b=_['merge']({},_0x29cd4b,_0x36d358[_0x0cc4('0x36')]);return db['VoiceMailMessage'][_0x0cc4('0x3e')](_0x29cd4b)[_0x0cc4('0x1c')](handleEntityNotFound(_0x5c4596,null))[_0x0cc4('0x1c')](respondWithResult(_0x5c4596,null))[_0x0cc4('0x3f')](handleError(_0x5c4596,null));};exports[_0x0cc4('0x40')]=function(_0xae961d,_0x2bbda2){return db[_0x0cc4('0x3d')]['create'](_0xae961d['body'],{})['then'](respondWithResult(_0x2bbda2,0xc9))[_0x0cc4('0x3f')](handleError(_0x2bbda2,null));};exports[_0x0cc4('0x1b')]=function(_0x3f3706,_0x5d9871){if(_0x3f3706[_0x0cc4('0x41')]['id']){delete _0x3f3706[_0x0cc4('0x41')]['id'];}return db['VoiceMailMessage'][_0x0cc4('0x3e')]({'where':{'id':_0x3f3706[_0x0cc4('0x3c')]['id']}})[_0x0cc4('0x1c')](handleEntityNotFound(_0x5d9871,null))[_0x0cc4('0x1c')](saveUpdates(_0x3f3706[_0x0cc4('0x41')],null))[_0x0cc4('0x1c')](respondWithResult(_0x5d9871,null))[_0x0cc4('0x3f')](handleError(_0x5d9871,null));};exports[_0x0cc4('0x42')]=function(_0x11cda6,_0x391480){return db[_0x0cc4('0x3d')][_0x0cc4('0x3e')]({'where':{'id':_0x11cda6[_0x0cc4('0x3c')]['id']}})[_0x0cc4('0x1c')](handleEntityNotFound(_0x391480,null))[_0x0cc4('0x1c')](removeEntity(_0x391480,null))[_0x0cc4('0x3f')](handleError(_0x391480,null));};exports['download']=function(_0x23ae64,_0x221a2f,_0x175c9d){return db[_0x0cc4('0x3d')]['find']({'where':{'id':_0x23ae64['params']['id']},'attributes':['id','recording','msg_id']})[_0x0cc4('0x1c')](handleEntityNotFound(_0x221a2f,null))[_0x0cc4('0x1c')](function(_0x2e2b69){if(_0x2e2b69){if(!_0x2e2b69[_0x0cc4('0x43')]){throw new db[(_0x0cc4('0x44'))]['ValidationError'](_0x0cc4('0x45'));}var _0x15024c={'Content-Type':_0x0cc4('0x46'),'Content-Disposition':_0x0cc4('0x47')};if(_0x2e2b69['msg_id']){_0x15024c[_0x0cc4('0x48')]=_0x0cc4('0x49')+_0x2e2b69[_0x0cc4('0x4a')]+'.wav\x22';}_0x221a2f[_0x0cc4('0x1a')](_0x15024c);return _0x221a2f['send'](new Buffer(_0x2e2b69[_0x0cc4('0x43')]));}})[_0x0cc4('0x3f')](handleError(_0x221a2f,null));}; \ No newline at end of file +var _0x9429=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','then','includeAll','findAll','rows','catch','show','params','fields','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','rimraf'];(function(_0x133f69,_0x2d4632){var _0x3b67bb=function(_0x203583){while(--_0x203583){_0x133f69['push'](_0x133f69['shift']());}};_0x3b67bb(++_0x2d4632);}(_0x9429,0xa4));var _0x9942=function(_0x520bfe,_0x3fb339){_0x520bfe=_0x520bfe-0x0;var _0x5831d6=_0x9429[_0x520bfe];return _0x5831d6;};'use strict';var pdf=require(_0x9942('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9942('0x1'));var zipdir=require(_0x9942('0x2'));var jsonpatch=require(_0x9942('0x3'));var rp=require(_0x9942('0x4'));var moment=require(_0x9942('0x5'));var BPromise=require(_0x9942('0x6'));var Mustache=require(_0x9942('0x7'));var util=require(_0x9942('0x8'));var path=require(_0x9942('0x9'));var sox=require('sox');var csv=require(_0x9942('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9942('0xb'));var squel=require(_0x9942('0xc'));var crypto=require(_0x9942('0xd'));var jsforce=require(_0x9942('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9942('0xa'));var querystring=require('querystring');var Papa=require(_0x9942('0xf'));var Redis=require(_0x9942('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9942('0x11'));var hardwareService=require(_0x9942('0x12'));var logger=require(_0x9942('0x13'))(_0x9942('0x14'));var utils=require(_0x9942('0x15'));var config=require(_0x9942('0x16'));var db=require(_0x9942('0x17'))['db'];function respondWithStatusCode(_0x5ce830,_0x524242){_0x524242=_0x524242||0xcc;return function(_0x1c13d0){if(_0x1c13d0){return _0x5ce830[_0x9942('0x18')](_0x524242);}return _0x5ce830[_0x9942('0x19')](_0x524242)[_0x9942('0x1a')]();};}function respondWithResult(_0x2803f6,_0x5ed725){_0x5ed725=_0x5ed725||0xc8;return function(_0x3b3646){if(_0x3b3646){return _0x2803f6[_0x9942('0x19')](_0x5ed725)[_0x9942('0x1b')](_0x3b3646);}};}function respondWithFilteredResult(_0x50e7ee,_0x1924b4){return function(_0x453cc4){if(_0x453cc4){var _0x10e1b0=_0x453cc4['count'],_0x6284af=_0x1924b4[_0x9942('0x1c')],_0x39f448=_0x1924b4['offset']+_0x1924b4[_0x9942('0x1d')],_0x4a4407;if(_0x39f448>=_0x10e1b0){_0x39f448=_0x10e1b0;_0x4a4407=0xc8;}else{_0x4a4407=0xce;}_0x50e7ee['status'](_0x4a4407);return _0x50e7ee['set'](_0x9942('0x1e'),_0x6284af+'-'+_0x39f448+'/'+_0x10e1b0)['json'](_0x453cc4);}return null;};}function patchUpdates(_0x44a29a){return function(_0x103017){try{jsonpatch[_0x9942('0x1f')](_0x103017,_0x44a29a,!![]);}catch(_0x170f6b){return BPromise[_0x9942('0x20')](_0x170f6b);}return _0x103017[_0x9942('0x21')]();};}function saveUpdates(_0x19455d,_0x4226c4){return function(_0x19e35a){if(_0x19e35a){return _0x19e35a[_0x9942('0x22')](_0x19455d)['then'](function(_0xb54294){return _0xb54294;});}return null;};}function removeEntity(_0x3f1ee4,_0x263371){return function(_0x146e0c){if(_0x146e0c){return _0x146e0c[_0x9942('0x23')]()['then'](function(){_0x3f1ee4[_0x9942('0x19')](0xcc)[_0x9942('0x1a')]();});}};}function handleEntityNotFound(_0xb31ee5,_0x8a8283){return function(_0xf785ce){if(!_0xf785ce){_0xb31ee5[_0x9942('0x18')](0x194);}return _0xf785ce;};}function handleError(_0x3d0512,_0x3ebd15){_0x3ebd15=_0x3ebd15||0x1f4;return function(_0xaa793e){logger['error'](_0xaa793e[_0x9942('0x24')]);if(_0xaa793e['name']){delete _0xaa793e['name'];}_0x3d0512[_0x9942('0x19')](_0x3ebd15)[_0x9942('0x25')](_0xaa793e);};}exports[_0x9942('0x26')]=function(_0x5cf1fd,_0x3699bf){var _0x407869={},_0x4a0852={},_0x33a1db={'count':0x0,'rows':[]};var _0x1ad138=db[_0x9942('0x27')][_0x9942('0x28')];_0x4a0852[_0x9942('0x29')]=_[_0x9942('0x2a')](_['keys'](_0x1ad138),['name']);_0x4a0852[_0x9942('0x2b')]=_[_0x9942('0x2c')](_0x5cf1fd[_0x9942('0x2b')]);_0x4a0852[_0x9942('0x2d')]=_[_0x9942('0x2e')](_0x4a0852['model'],_0x4a0852[_0x9942('0x2b')]);_0x407869[_0x9942('0x2f')]=_[_0x9942('0x2e')](_0x4a0852[_0x9942('0x29')],qs['fields'](_0x5cf1fd[_0x9942('0x2b')]['fields']));_0x407869[_0x9942('0x2f')]=_0x407869[_0x9942('0x2f')][_0x9942('0x30')]?_0x407869['attributes']:_0x4a0852[_0x9942('0x29')];if(!_0x5cf1fd[_0x9942('0x2b')][_0x9942('0x31')]('nolimit')){_0x407869[_0x9942('0x1d')]=qs['limit'](_0x5cf1fd[_0x9942('0x2b')][_0x9942('0x1d')]);_0x407869[_0x9942('0x1c')]=qs[_0x9942('0x1c')](_0x5cf1fd['query'][_0x9942('0x1c')]);}_0x407869[_0x9942('0x32')]=qs[_0x9942('0x33')](_0x5cf1fd['query'][_0x9942('0x33')]);_0x407869[_0x9942('0x34')]=qs[_0x9942('0x2d')](_[_0x9942('0x35')](_0x5cf1fd['query'],_0x4a0852[_0x9942('0x2d')]));if(_0x5cf1fd['query'][_0x9942('0x36')]){_0x407869['where']=_[_0x9942('0x37')](_0x407869[_0x9942('0x34')],{'$or':_[_0x9942('0x38')](_0x1ad138,function(_0x2ae12a){if(_0x2ae12a[_0x9942('0x39')]['key']!==_0x9942('0x3a')){var _0x476e48={};_0x476e48[_0x2ae12a[_0x9942('0x3b')]]={'$like':'%'+_0x5cf1fd[_0x9942('0x2b')][_0x9942('0x36')]+'%'};return _0x476e48;}})});}_0x407869=_[_0x9942('0x37')]({},_0x407869,_0x5cf1fd[_0x9942('0x3c')]);var _0x21da73={'where':_0x407869[_0x9942('0x34')]};return db[_0x9942('0x27')][_0x9942('0x3d')](_0x21da73)[_0x9942('0x3e')](function(_0x85bada){_0x33a1db[_0x9942('0x3d')]=_0x85bada;if(_0x5cf1fd[_0x9942('0x2b')][_0x9942('0x3f')]){_0x407869['include']=[{'all':!![]}];}return db[_0x9942('0x27')][_0x9942('0x40')](_0x407869);})['then'](function(_0xa2794){_0x33a1db[_0x9942('0x41')]=_0xa2794;return _0x33a1db;})[_0x9942('0x3e')](respondWithFilteredResult(_0x3699bf,_0x407869))[_0x9942('0x42')](handleError(_0x3699bf,null));};exports[_0x9942('0x43')]=function(_0x293567,_0x220fb3){var _0x4581f3={'raw':!![],'where':{'id':_0x293567[_0x9942('0x44')]['id']}},_0x19b0a4={};_0x19b0a4['model']=_['keys'](db[_0x9942('0x27')][_0x9942('0x28')]);_0x19b0a4['query']=_['keys'](_0x293567[_0x9942('0x2b')]);_0x19b0a4[_0x9942('0x2d')]=_[_0x9942('0x2e')](_0x19b0a4[_0x9942('0x29')],_0x19b0a4[_0x9942('0x2b')]);_0x4581f3[_0x9942('0x2f')]=_[_0x9942('0x2e')](_0x19b0a4[_0x9942('0x29')],qs[_0x9942('0x45')](_0x293567[_0x9942('0x2b')][_0x9942('0x45')]));_0x4581f3['attributes']=_0x4581f3['attributes'][_0x9942('0x30')]?_0x4581f3['attributes']:_0x19b0a4[_0x9942('0x29')];if(_0x293567[_0x9942('0x2b')][_0x9942('0x3f')]){_0x4581f3['include']=[{'all':!![]}];}_0x4581f3=_['merge']({},_0x4581f3,_0x293567['options']);return db['VoiceMailMessage'][_0x9942('0x46')](_0x4581f3)[_0x9942('0x3e')](handleEntityNotFound(_0x220fb3,null))[_0x9942('0x3e')](respondWithResult(_0x220fb3,null))[_0x9942('0x42')](handleError(_0x220fb3,null));};exports[_0x9942('0x47')]=function(_0x2c64a7,_0x444c9f){return db[_0x9942('0x27')][_0x9942('0x47')](_0x2c64a7[_0x9942('0x48')],{})['then'](respondWithResult(_0x444c9f,0xc9))[_0x9942('0x42')](handleError(_0x444c9f,null));};exports[_0x9942('0x22')]=function(_0x1356f4,_0x48a2ca){if(_0x1356f4['body']['id']){delete _0x1356f4['body']['id'];}return db[_0x9942('0x27')][_0x9942('0x46')]({'where':{'id':_0x1356f4[_0x9942('0x44')]['id']}})[_0x9942('0x3e')](handleEntityNotFound(_0x48a2ca,null))[_0x9942('0x3e')](saveUpdates(_0x1356f4[_0x9942('0x48')],null))[_0x9942('0x3e')](respondWithResult(_0x48a2ca,null))[_0x9942('0x42')](handleError(_0x48a2ca,null));};exports[_0x9942('0x23')]=function(_0x4132f8,_0x5131cf){return db[_0x9942('0x27')][_0x9942('0x46')]({'where':{'id':_0x4132f8[_0x9942('0x44')]['id']}})[_0x9942('0x3e')](handleEntityNotFound(_0x5131cf,null))[_0x9942('0x3e')](removeEntity(_0x5131cf,null))['catch'](handleError(_0x5131cf,null));};exports[_0x9942('0x49')]=function(_0x59560d,_0x1bc0e5,_0x373dd6){return db[_0x9942('0x27')][_0x9942('0x46')]({'where':{'id':_0x59560d['params']['id']},'attributes':['id',_0x9942('0x4a'),_0x9942('0x4b')]})[_0x9942('0x3e')](handleEntityNotFound(_0x1bc0e5,null))['then'](function(_0x3e05f8){if(_0x3e05f8){if(!_0x3e05f8[_0x9942('0x4a')]){throw new db['Sequelize'][(_0x9942('0x4c'))](_0x9942('0x4d'));}var _0x3869ff={'Content-Type':_0x9942('0x4e'),'Content-Disposition':_0x9942('0x4f')};if(_0x3e05f8[_0x9942('0x4b')]){_0x3869ff[_0x9942('0x50')]=_0x9942('0x51')+_0x3e05f8[_0x9942('0x4b')]+_0x9942('0x52');}_0x1bc0e5['set'](_0x3869ff);return _0x1bc0e5[_0x9942('0x25')](new Buffer(_0x3e05f8[_0x9942('0x4a')]));}})['catch'](handleError(_0x1bc0e5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 15b764d..10c2dfd 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 _0x7d9d=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','path'];(function(_0x3d0b5e,_0x42c004){var _0x274e50=function(_0x1a5630){while(--_0x1a5630){_0x3d0b5e['push'](_0x3d0b5e['shift']());}};_0x274e50(++_0x42c004);}(_0x7d9d,0xd3));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7d9('0x0'));var util=require(_0xd7d9('0x1'));var logger=require(_0xd7d9('0x2'))(_0xd7d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7d9('0x4'));var rimraf=require(_0xd7d9('0x5'));var config=require(_0xd7d9('0x6'));var attributes=require(_0xd7d9('0x7'));module[_0xd7d9('0x8')]=function(_0x3be4b6,_0x45097f){return _0x3be4b6[_0xd7d9('0x9')]('VoiceMailMessage',attributes,{'tableName':_0xd7d9('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xd7d9('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x55b3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir'];(function(_0x144114,_0x5f0b0d){var _0x2d84f5=function(_0x2a71c8){while(--_0x2a71c8){_0x144114['push'](_0x144114['shift']());}};_0x2d84f5(++_0x5f0b0d);}(_0x55b3,0x179));var _0x355b=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x55b3[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x355b('0x0'));var util=require(_0x355b('0x1'));var logger=require('../../config/logger')(_0x355b('0x2'));var moment=require(_0x355b('0x3'));var BPromise=require(_0x355b('0x4'));var rp=require(_0x355b('0x5'));var fs=require('fs');var path=require(_0x355b('0x6'));var rimraf=require(_0x355b('0x7'));var config=require('../../config/environment');var attributes=require(_0x355b('0x8'));module[_0x355b('0x9')]=function(_0x5a744b,_0x8cf0dc){return _0x5a744b[_0x355b('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x355b('0xb'),'paranoid':![],'indexes':[{'name':_0x355b('0xc'),'fields':[_0x355b('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ef2250c..b349eb0 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 _0xac3a=['client','http','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1127a7,_0x5112a9){var _0x319e11=function(_0x46ce0f){while(--_0x46ce0f){_0x1127a7['push'](_0x1127a7['shift']());}};_0x319e11(++_0x5112a9);}(_0xac3a,0xf2));var _0xaac3=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xac3a[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xaac3('0x0'));var util=require(_0xaac3('0x1'));var moment=require('moment');var BPromise=require(_0xaac3('0x2'));var rs=require(_0xaac3('0x3'));var fs=require('fs');var Redis=require(_0xaac3('0x4'));var db=require(_0xaac3('0x5'))['db'];var utils=require(_0xaac3('0x6'));var logger=require(_0xaac3('0x7'))('rpc');var config=require(_0xaac3('0x8'));var jayson=require(_0xaac3('0x9'));var client=jayson[_0xaac3('0xa')][_0xaac3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x272725,_0x171196,_0x6dd9a){return new BPromise(function(_0x3ace52,_0x231919){return client['request'](_0x272725,_0x6dd9a)['then'](function(_0x5eb64e){logger['info'](_0xaac3('0xc'),_0x171196,_0xaac3('0xd'));logger[_0xaac3('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x171196,_0xaac3('0xd'),JSON[_0xaac3('0xf')](_0x5eb64e));if(_0x5eb64e[_0xaac3('0x10')]){if(_0x5eb64e['error']['code']===0x1f4){logger[_0xaac3('0x10')](_0xaac3('0xc'),_0x171196,_0x5eb64e['error'][_0xaac3('0x11')]);return _0x231919(_0x5eb64e[_0xaac3('0x10')]['message']);}logger[_0xaac3('0x10')](_0xaac3('0xc'),_0x171196,_0x5eb64e[_0xaac3('0x10')][_0xaac3('0x11')]);return _0x3ace52(_0x5eb64e[_0xaac3('0x10')][_0xaac3('0x11')]);}else{logger[_0xaac3('0x12')](_0xaac3('0xc'),_0x171196,_0xaac3('0xd'));_0x3ace52(_0x5eb64e[_0xaac3('0x13')][_0xaac3('0x11')]);}})[_0xaac3('0x14')](function(_0x4c5ca5){logger[_0xaac3('0x10')](_0xaac3('0xc'),_0x171196,_0x4c5ca5);_0x231919(_0x4c5ca5);});});} \ No newline at end of file +var _0x1a65=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result'];(function(_0x2100d6,_0x55362c){var _0x298ddd=function(_0x7435e8){while(--_0x7435e8){_0x2100d6['push'](_0x2100d6['shift']());}};_0x298ddd(++_0x55362c);}(_0x1a65,0x112));var _0x51a6=function(_0x3386e9,_0x256e43){_0x3386e9=_0x3386e9-0x0;var _0x374d1b=_0x1a65[_0x3386e9];return _0x374d1b;};'use strict';var _=require(_0x51a6('0x0'));var util=require('util');var moment=require(_0x51a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x51a6('0x2'));var fs=require('fs');var Redis=require(_0x51a6('0x3'));var db=require(_0x51a6('0x4'))['db'];var utils=require(_0x51a6('0x5'));var logger=require(_0x51a6('0x6'))('rpc');var config=require(_0x51a6('0x7'));var jayson=require(_0x51a6('0x8'));var client=jayson['client'][_0x51a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x108cf7,_0x48201f,_0x3a386e){return new BPromise(function(_0x31f134,_0x5467f7){return client['request'](_0x108cf7,_0x3a386e)[_0x51a6('0xa')](function(_0x4c51b7){logger[_0x51a6('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x48201f,_0x51a6('0xc'));logger['debug'](_0x51a6('0xd'),_0x48201f,_0x51a6('0xc'),JSON[_0x51a6('0xe')](_0x4c51b7));if(_0x4c51b7[_0x51a6('0xf')]){if(_0x4c51b7[_0x51a6('0xf')][_0x51a6('0x10')]===0x1f4){logger['error'](_0x51a6('0x11'),_0x48201f,_0x4c51b7[_0x51a6('0xf')][_0x51a6('0x12')]);return _0x5467f7(_0x4c51b7[_0x51a6('0xf')][_0x51a6('0x12')]);}logger[_0x51a6('0xf')](_0x51a6('0x11'),_0x48201f,_0x4c51b7[_0x51a6('0xf')][_0x51a6('0x12')]);return _0x31f134(_0x4c51b7[_0x51a6('0xf')]['message']);}else{logger[_0x51a6('0xb')](_0x51a6('0x11'),_0x48201f,'request\x20sent');_0x31f134(_0x4c51b7[_0x51a6('0x13')][_0x51a6('0x12')]);}})[_0x51a6('0x14')](function(_0x4da360){logger[_0x51a6('0xf')](_0x51a6('0x11'),_0x48201f,_0x4da360);_0x5467f7(_0x4da360);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 09ae1e9..c728b09 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 _0xc6d8=['put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','path','express','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','create','addSound'];(function(_0x39255f,_0x331ff4){var _0x503d17=function(_0x205f61){while(--_0x205f61){_0x39255f['push'](_0x39255f['shift']());}};_0x503d17(++_0x331ff4);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0xc6d8[_0x38037a];return _0x1a1246;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var auth=require(_0x8c6d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c6d('0x4'));router[_0x8c6d('0x5')]('/',auth[_0x8c6d('0x6')](),controller[_0x8c6d('0x7')]);router[_0x8c6d('0x5')](_0x8c6d('0x8'),auth[_0x8c6d('0x6')](),controller['show']);router[_0x8c6d('0x5')](_0x8c6d('0x9'),auth[_0x8c6d('0x6')](),controller['getSounds']);router[_0x8c6d('0xa')]('/',auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xb')]);router[_0x8c6d('0xa')](_0x8c6d('0x9'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0xd')]('/:id',auth[_0x8c6d('0x6')](),controller['update']);router['delete'](_0x8c6d('0x8'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')](_0x8c6d('0x10'),auth[_0x8c6d('0x6')](),controller[_0x8c6d('0x11')]);module[_0x8c6d('0x12')]=router; \ No newline at end of file +var _0x2f68=['./voiceMusicOnHold.controller','isAuthenticated','index','/:id/sounds','getSounds','create','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x2c2054,_0x166eb5){var _0x142cb0=function(_0x3aa67a){while(--_0x3aa67a){_0x2c2054['push'](_0x2c2054['shift']());}};_0x142cb0(++_0x166eb5);}(_0x2f68,0x9a));var _0x82f6=function(_0x150b41,_0x209b14){_0x150b41=_0x150b41-0x0;var _0x10556f=_0x2f68[_0x150b41];return _0x10556f;};'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']('/',auth[_0x82f6('0x7')](),controller[_0x82f6('0x8')]);router['get']('/:id',auth[_0x82f6('0x7')](),controller['show']);router['get'](_0x82f6('0x9'),auth[_0x82f6('0x7')](),controller[_0x82f6('0xa')]);router['post']('/',auth[_0x82f6('0x7')](),controller[_0x82f6('0xb')]);router['post'](_0x82f6('0x9'),auth[_0x82f6('0x7')](),controller[_0x82f6('0xc')]);router[_0x82f6('0xd')](_0x82f6('0xe'),auth[_0x82f6('0x7')](),controller['update']);router[_0x82f6('0xf')](_0x82f6('0xe'),auth['isAuthenticated'](),controller[_0x82f6('0x10')]);router[_0x82f6('0xf')](_0x82f6('0x11'),auth[_0x82f6('0x7')](),controller[_0x82f6('0x12')]);module[_0x82f6('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 3f7bcc7..83c2911 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 _0x5088=['ENUM','files','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x1e7d32,_0x5220f6){var _0x1e8c96=function(_0x119441){while(--_0x119441){_0x1e7d32['push'](_0x1e7d32['shift']());}};_0x1e8c96(++_0x5220f6);}(_0x5088,0x125));var _0x8508=function(_0x3e3c73,_0x2c8583){_0x3e3c73=_0x3e3c73-0x0;var _0x5d4cb4=_0x5088[_0x3e3c73];return _0x5d4cb4;};'use strict';var Sequelize=require(_0x8508('0x0'));module[_0x8508('0x1')]={'name':{'type':Sequelize[_0x8508('0x2')],'allowNull':![],'unique':_0x8508('0x3')},'mode':{'type':Sequelize[_0x8508('0x4')]('custom',_0x8508('0x5'),'mp3nb','quietmp3nb',_0x8508('0x6'),_0x8508('0x7')),'allowNull':!![],'defaultValue':_0x8508('0x5')},'directory':{'type':Sequelize[_0x8508('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8508('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8508('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8508('0x2')],'allowNull':!![],'defaultValue':_0x8508('0x8')},'format':{'type':Sequelize[_0x8508('0x2')],'allowNull':!![]},'stamp':{'type':_0x8508('0x9')},'defaultEntry':{'type':Sequelize[_0x8508('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4604=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','quietmp3','files','alpha','TIMESTAMP'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4604,0x1e1));var _0x4460=function(_0x2318b1,_0x1ed479){_0x2318b1=_0x2318b1-0x0;var _0x569724=_0x4604[_0x2318b1];return _0x569724;};'use strict';var Sequelize=require(_0x4460('0x0'));module[_0x4460('0x1')]={'name':{'type':Sequelize[_0x4460('0x2')],'allowNull':![],'unique':_0x4460('0x3')},'mode':{'type':Sequelize[_0x4460('0x4')](_0x4460('0x5'),'files','mp3nb',_0x4460('0x6'),_0x4460('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x4460('0x8')},'directory':{'type':Sequelize[_0x4460('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x4460('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4460('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4460('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4460('0xa')},'defaultEntry':{'type':Sequelize[_0x4460('0xb')],'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 ac6326a..6707e6d 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 _0x9bde=['getSounds','Sound','pick','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','save','update','then','get','MusicOnHolds','UserProfileResource','error','name','send','index','VoiceMusicOnHold','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','key','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','body','catch','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','removeSound','id2','unlinkSync','message'];(function(_0x34fd8f,_0x1f490b){var _0x5f2057=function(_0x57c210){while(--_0x57c210){_0x34fd8f['push'](_0x34fd8f['shift']());}};_0x5f2057(++_0x1f490b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x38cf83,_0x4173d1){_0x38cf83=_0x38cf83-0x0;var _0x5769d3=_0x9bde[_0x38cf83];return _0x5769d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))(_0xe9bd('0x15'));var utils=require('../../config/utils');var config=require(_0xe9bd('0x16'));var db=require(_0xe9bd('0x17'))['db'];function respondWithStatusCode(_0x3339f9,_0x141587){_0x141587=_0x141587||0xcc;return function(_0x5e022a){if(_0x5e022a){return _0x3339f9[_0xe9bd('0x18')](_0x141587);}return _0x3339f9['status'](_0x141587)[_0xe9bd('0x19')]();};}function respondWithResult(_0x429e88,_0x3435b4){_0x3435b4=_0x3435b4||0xc8;return function(_0x51109f){if(_0x51109f){return _0x429e88['status'](_0x3435b4)[_0xe9bd('0x1a')](_0x51109f);}};}function respondWithFilteredResult(_0x248818,_0x3a9e5f){return function(_0x46a59b){if(_0x46a59b){var _0x3360bd=_0x46a59b[_0xe9bd('0x1b')],_0x389e7b=_0x3a9e5f[_0xe9bd('0x1c')],_0x45a9f2=_0x3a9e5f[_0xe9bd('0x1c')]+_0x3a9e5f['limit'],_0x573350;if(_0x45a9f2>=_0x3360bd){_0x45a9f2=_0x3360bd;_0x573350=0xc8;}else{_0x573350=0xce;}_0x248818[_0xe9bd('0x1d')](_0x573350);return _0x248818[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x389e7b+'-'+_0x45a9f2+'/'+_0x3360bd)[_0xe9bd('0x1a')](_0x46a59b);}return null;};}function patchUpdates(_0x5cf674){return function(_0x20ec32){try{jsonpatch['apply'](_0x20ec32,_0x5cf674,!![]);}catch(_0xc6b661){return BPromise['reject'](_0xc6b661);}return _0x20ec32[_0xe9bd('0x20')]();};}function saveUpdates(_0x417113,_0x134c4e){return function(_0x3dda13){if(_0x3dda13){return _0x3dda13[_0xe9bd('0x21')](_0x417113)[_0xe9bd('0x22')](function(_0x6593ce){return _0x6593ce;});}return null;};}function removeEntity(_0x49165b,_0x133318){return function(_0x28cd17){if(_0x28cd17){return _0x28cd17['destroy']()[_0xe9bd('0x22')](function(){var _0x505c23=_0x28cd17[_0xe9bd('0x23')]({'plain':!![]});var _0x1b9cc9=_0xe9bd('0x24');return db[_0xe9bd('0x25')]['destroy']({'where':{'type':_0x1b9cc9,'resourceId':_0x505c23['id']}})[_0xe9bd('0x22')](function(){return _0x28cd17;});})[_0xe9bd('0x22')](function(){_0x49165b[_0xe9bd('0x1d')](0xcc)[_0xe9bd('0x19')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x18')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x26')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x27')]){delete _0x3c211a[_0xe9bd('0x27')];}_0x1ae889[_0xe9bd('0x1d')](_0x5987af)[_0xe9bd('0x28')](_0x3c211a);};}exports[_0xe9bd('0x29')]=function(_0x183601,_0x519f48){var _0x5b7f1d={},_0x1de54c={},_0x56e409={'count':0x0,'rows':[]};var _0xa45eb0=db[_0xe9bd('0x2a')][_0xe9bd('0x2b')];_0x1de54c[_0xe9bd('0x2c')]=_[_0xe9bd('0x2d')](_0xa45eb0);_0x1de54c['query']=_['keys'](_0x183601[_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_[_0xe9bd('0x30')](_0x1de54c[_0xe9bd('0x2c')],_0x1de54c[_0xe9bd('0x2e')]);_0x5b7f1d[_0xe9bd('0x31')]=_[_0xe9bd('0x30')](_0x1de54c[_0xe9bd('0x2c')],qs[_0xe9bd('0x32')](_0x183601['query'][_0xe9bd('0x32')]));_0x5b7f1d[_0xe9bd('0x31')]=_0x5b7f1d[_0xe9bd('0x31')]['length']?_0x5b7f1d['attributes']:_0x1de54c[_0xe9bd('0x2c')];if(!_0x183601[_0xe9bd('0x2e')][_0xe9bd('0x33')](_0xe9bd('0x34'))){_0x5b7f1d[_0xe9bd('0x35')]=qs[_0xe9bd('0x35')](_0x183601[_0xe9bd('0x2e')][_0xe9bd('0x35')]);_0x5b7f1d[_0xe9bd('0x1c')]=qs[_0xe9bd('0x1c')](_0x183601[_0xe9bd('0x2e')][_0xe9bd('0x1c')]);}_0x5b7f1d[_0xe9bd('0x36')]=qs[_0xe9bd('0x37')](_0x183601[_0xe9bd('0x2e')][_0xe9bd('0x37')]);_0x5b7f1d[_0xe9bd('0x38')]=qs[_0xe9bd('0x2f')](_['pick'](_0x183601[_0xe9bd('0x2e')],_0x1de54c[_0xe9bd('0x2f')]));if(_0x183601['query'][_0xe9bd('0x39')]){_0x5b7f1d[_0xe9bd('0x38')]=_['merge'](_0x5b7f1d['where'],{'$or':_[_0xe9bd('0x3a')](_0xa45eb0,function(_0xdf43b9){if(_0xdf43b9['type'][_0xe9bd('0x3b')]!==_0xe9bd('0x3c')){var _0x14927c={};_0x14927c[_0xdf43b9['field']]={'$like':'%'+_0x183601[_0xe9bd('0x2e')]['filter']+'%'};return _0x14927c;}})});}_0x5b7f1d=_[_0xe9bd('0x3d')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x3e')]);var _0x63d67c={'where':_0x5b7f1d[_0xe9bd('0x38')]};return db['VoiceMusicOnHold'][_0xe9bd('0x1b')](_0x63d67c)[_0xe9bd('0x22')](function(_0x327e1a){_0x56e409[_0xe9bd('0x1b')]=_0x327e1a;if(_0x183601[_0xe9bd('0x2e')][_0xe9bd('0x3f')]){_0x5b7f1d[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2a')][_0xe9bd('0x41')](_0x5b7f1d);})[_0xe9bd('0x22')](function(_0x4e8565){_0x56e409['rows']=_0x4e8565;return _0x56e409;})[_0xe9bd('0x22')](respondWithFilteredResult(_0x519f48,_0x5b7f1d))['catch'](handleError(_0x519f48,null));};exports[_0xe9bd('0x42')]=function(_0x340819,_0x41881a){var _0x480797={'raw':![],'where':{'id':_0x340819[_0xe9bd('0x43')]['id']}},_0x1ba613={};_0x1ba613[_0xe9bd('0x2c')]=_['keys'](db[_0xe9bd('0x2a')][_0xe9bd('0x2b')]);_0x1ba613[_0xe9bd('0x2e')]=_[_0xe9bd('0x2d')](_0x340819[_0xe9bd('0x2e')]);_0x1ba613[_0xe9bd('0x2f')]=_[_0xe9bd('0x30')](_0x1ba613[_0xe9bd('0x2c')],_0x1ba613[_0xe9bd('0x2e')]);_0x480797[_0xe9bd('0x31')]=_[_0xe9bd('0x30')](_0x1ba613[_0xe9bd('0x2c')],qs[_0xe9bd('0x32')](_0x340819[_0xe9bd('0x2e')][_0xe9bd('0x32')]));_0x480797['attributes']=_0x480797['attributes'][_0xe9bd('0x44')]?_0x480797[_0xe9bd('0x31')]:_0x1ba613[_0xe9bd('0x2c')];if(_0x340819['query']['includeAll']){_0x480797[_0xe9bd('0x40')]=[{'all':!![]}];}_0x480797=_[_0xe9bd('0x3d')]({},_0x480797,_0x340819[_0xe9bd('0x3e')]);return db[_0xe9bd('0x2a')][_0xe9bd('0x45')](_0x480797)[_0xe9bd('0x22')](handleEntityNotFound(_0x41881a,null))[_0xe9bd('0x22')](respondWithResult(_0x41881a,null))['catch'](handleError(_0x41881a,null));};exports[_0xe9bd('0x21')]=function(_0x4cc146,_0x36726e){if(_0x4cc146[_0xe9bd('0x46')]['id']){delete _0x4cc146[_0xe9bd('0x46')]['id'];}return db[_0xe9bd('0x2a')][_0xe9bd('0x45')]({'where':{'id':_0x4cc146['params']['id']}})[_0xe9bd('0x22')](handleEntityNotFound(_0x36726e,null))[_0xe9bd('0x22')](saveUpdates(_0x4cc146[_0xe9bd('0x46')],null))['then'](respondWithResult(_0x36726e,null))[_0xe9bd('0x47')](handleError(_0x36726e,null));};exports[_0xe9bd('0x48')]=function(_0x34f787,_0x5a466b,_0x28d2ea){return db[_0xe9bd('0x49')][_0xe9bd('0x4a')](function(_0x10ec29){if(_0x34f787[_0xe9bd('0x46')]['mode']===_0xe9bd('0x4b')){_0x34f787['body'][_0xe9bd('0x4c')]=path[_0xe9bd('0x4d')](config[_0xe9bd('0x4e')],_0xe9bd('0x4f'),_0x34f787[_0xe9bd('0x46')]['name']);}return db[_0xe9bd('0x2a')]['create'](_0x34f787[_0xe9bd('0x46')],{'transaction':_0x10ec29})[_0xe9bd('0x22')](function(_0x5e08ae){if(_0x34f787['body'][_0xe9bd('0x50')]==='files'){fs[_0xe9bd('0x51')](_0x5e08ae['directory'],parseInt(_0xe9bd('0x52'),0x8));}var _0x1cf7be=_0x34f787['user'][_0xe9bd('0x23')]({'plain':!![]});if(!_0x1cf7be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cf7be[_0xe9bd('0x53')]===_0xe9bd('0x54')){var _0x321050=_0x5e08ae['get']({'plain':!![]});return db[_0xe9bd('0x55')][_0xe9bd('0x45')]({'where':{'name':_0xe9bd('0x24'),'userProfileId':_0x1cf7be[_0xe9bd('0x56')]},'raw':!![]})['then'](function(_0x56362e){if(_0x56362e&&_0x56362e[_0xe9bd('0x57')]===0x0){return db['UserProfileResource'][_0xe9bd('0x48')]({'name':_0x321050[_0xe9bd('0x27')],'resourceId':_0x321050['id'],'type':_0x56362e[_0xe9bd('0x27')],'sectionId':_0x56362e['id']},{})[_0xe9bd('0x22')](function(){return _0x5e08ae;});}else{return _0x5e08ae;}})[_0xe9bd('0x47')](function(_0x145ea3){logger[_0xe9bd('0x26')](_0xe9bd('0x58'),_0x145ea3);});}return _0x5e08ae;});})[_0xe9bd('0x22')](respondWithResult(_0x5a466b,0xc9))[_0xe9bd('0x47')](handleError(_0x5a466b,null));};exports[_0xe9bd('0x59')]=function(_0x78fab0,_0x51500d,_0x596a7d){var _0x566dd8;return db[_0xe9bd('0x2a')]['find']({'where':{'id':_0x78fab0[_0xe9bd('0x43')]['id']}})[_0xe9bd('0x22')](function(_0x90db01){if(_0x90db01){return db[_0xe9bd('0x49')][_0xe9bd('0x4a')](function(_0xaf6ffd){return _0x90db01[_0xe9bd('0x59')]({'transaction':_0xaf6ffd,'raw':!![]})[_0xe9bd('0x22')](function(_0x61b691){if(_0x61b691['directory']){fs[_0xe9bd('0x5a')](_0x61b691[_0xe9bd('0x4c')])[_0xe9bd('0x5b')](function(_0x3f848d){fs['unlinkSync'](path[_0xe9bd('0x4d')](_0x61b691[_0xe9bd('0x4c')],_0x3f848d));});fs[_0xe9bd('0x5c')](_0x61b691['directory']);}return _0x61b691;});})[_0xe9bd('0x47')](function(_0x204ea9){throw new db[(_0xe9bd('0x5d'))][(_0xe9bd('0x5e'))](_0x204ea9['message']);});}})['then'](handleEntityNotFound(_0x51500d,null))[_0xe9bd('0x22')](removeEntity(_0x51500d,null))[_0xe9bd('0x47')](handleError(_0x51500d,null));};exports[_0xe9bd('0x5f')]=function(_0xf02c5d,_0x52cd0a,_0x49add9){return db[_0xe9bd('0x49')][_0xe9bd('0x4a')](function(_0x3ea0cc){var _0x3ba881;return db[_0xe9bd('0x2a')][_0xe9bd('0x45')]({'where':{'id':_0xf02c5d['params']['id']}})[_0xe9bd('0x22')](function(_0x5681ab){if(_0x5681ab){_0x3ba881=_0x5681ab;return _0x5681ab[_0xe9bd('0x5f')](_0xf02c5d[_0xe9bd('0x46')]['id'],{'transaction':_0x3ea0cc});}})[_0xe9bd('0x22')](function(_0x436983){if(_0x436983){return db['Sound'][_0xe9bd('0x60')]({'where':{'id':_0xf02c5d[_0xe9bd('0x46')]['id']},'attributes':['id',_0xe9bd('0x27'),'save_name',_0xe9bd('0x61'),_0xe9bd('0x62')],'raw':!![]});}})[_0xe9bd('0x22')](function(_0x3e3e05){if(_0x3e3e05){var _0x43dabe=path[_0xe9bd('0x4d')](config[_0xe9bd('0x4e')],_0xe9bd('0x63'),util[_0xe9bd('0x64')](_0xe9bd('0x65'),path[_0xe9bd('0x66')](_0x3e3e05[_0xe9bd('0x67')],path['extname'](_0x3e3e05[_0xe9bd('0x67')])),_0x3e3e05[_0xe9bd('0x61')]));var _0x481368=path[_0xe9bd('0x4d')](config[_0xe9bd('0x4e')],'server/files/moh',_0x3ba881['name'],util[_0xe9bd('0x64')](_0xe9bd('0x65'),_0x3e3e05['name'],_0x3e3e05['converted_format']));fs['symlinkSync'](_0x43dabe,_0x481368);return _0x3e3e05;}})[_0xe9bd('0x47')](function(_0x55cb4b){throw new db['Sequelize']['ValidationError'](_0x55cb4b['message']);});})[_0xe9bd('0x22')](handleEntityNotFound(_0x52cd0a,null))[_0xe9bd('0x22')](respondWithResult(_0x52cd0a,0xc9))[_0xe9bd('0x47')](handleError(_0x52cd0a,null));};exports['removeSound']=function(_0x3d4dd1,_0x250e48,_0x337284){return db[_0xe9bd('0x49')]['transaction'](function(_0x2656e9){var _0x10ef2b;return db[_0xe9bd('0x2a')]['findOne']({'where':{'id':_0x3d4dd1['params']['id']}})[_0xe9bd('0x22')](handleEntityNotFound(_0x250e48,null))[_0xe9bd('0x22')](function(_0x1f41fc){if(_0x1f41fc){_0x10ef2b=_0x1f41fc;return _0x1f41fc[_0xe9bd('0x68')](_0x3d4dd1[_0xe9bd('0x43')][_0xe9bd('0x69')]);}})[_0xe9bd('0x22')](function(_0x22c5ed){if(_0x22c5ed){return db['Sound'][_0xe9bd('0x60')]({'where':{'id':_0x3d4dd1[_0xe9bd('0x43')][_0xe9bd('0x69')]},'attributes':['id',_0xe9bd('0x27'),_0xe9bd('0x67'),'converted_format',_0xe9bd('0x62')],'raw':!![]});}})['then'](function(_0x5c0d19){if(_0x5c0d19){fs[_0xe9bd('0x6a')](path[_0xe9bd('0x4d')](_0x10ef2b['directory'],util[_0xe9bd('0x64')](_0xe9bd('0x65'),_0x5c0d19[_0xe9bd('0x27')],_0x5c0d19[_0xe9bd('0x61')])));return _0x5c0d19;}})['catch'](function(_0x3c1ab9){throw new db[(_0xe9bd('0x5d'))]['ValidationError'](_0x3c1ab9[_0xe9bd('0x6b')]);});})[_0xe9bd('0x22')](handleEntityNotFound(_0x250e48,null))[_0xe9bd('0x22')](respondWithStatusCode(_0x250e48,0xcc))[_0xe9bd('0x47')](handleError(_0x250e48,null));};exports[_0xe9bd('0x6c')]=function(_0x1a36aa,_0x466a89,_0x5e127b){var _0x1b0929={};var _0x179edf={};var _0x178574;var _0x421533;return db[_0xe9bd('0x2a')][_0xe9bd('0x60')]({'where':{'id':_0x1a36aa[_0xe9bd('0x43')]['id']}})[_0xe9bd('0x22')](handleEntityNotFound(_0x466a89,null))[_0xe9bd('0x22')](function(_0x5a7dfd){if(_0x5a7dfd){_0x178574=_0x5a7dfd;_0x179edf[_0xe9bd('0x2c')]=_[_0xe9bd('0x2d')](db[_0xe9bd('0x6d')][_0xe9bd('0x2b')]);_0x179edf[_0xe9bd('0x2e')]=_[_0xe9bd('0x2d')](_0x1a36aa[_0xe9bd('0x2e')]);_0x179edf['filters']=_[_0xe9bd('0x30')](_0x179edf[_0xe9bd('0x2c')],_0x179edf['query']);_0x1b0929[_0xe9bd('0x31')]=_[_0xe9bd('0x30')](_0x179edf[_0xe9bd('0x2c')],qs[_0xe9bd('0x32')](_0x1a36aa[_0xe9bd('0x2e')][_0xe9bd('0x32')]));_0x1b0929[_0xe9bd('0x31')]=_0x1b0929['attributes']['length']?_0x1b0929[_0xe9bd('0x31')]:_0x179edf[_0xe9bd('0x2c')];_0x1b0929[_0xe9bd('0x36')]=qs[_0xe9bd('0x37')](_0x1a36aa[_0xe9bd('0x2e')][_0xe9bd('0x37')]);_0x1b0929[_0xe9bd('0x38')]=qs['filters'](_[_0xe9bd('0x6e')](_0x1a36aa[_0xe9bd('0x2e')],_0x179edf[_0xe9bd('0x2f')]));if(_0x1a36aa[_0xe9bd('0x2e')][_0xe9bd('0x39')]){_0x1b0929[_0xe9bd('0x38')]=_[_0xe9bd('0x3d')](_0x1b0929['where'],{'$or':_['map'](_0x1b0929['attributes'],function(_0x274e83){var _0x539990={};_0x539990[_0x274e83]={'$like':'%'+_0x1a36aa['query']['filter']+'%'};return _0x539990;})});}_0x1b0929=_[_0xe9bd('0x3d')]({},_0x1b0929,_0x1a36aa[_0xe9bd('0x3e')]);return _0x178574[_0xe9bd('0x6c')](_0x1b0929);}})[_0xe9bd('0x22')](function(_0xd8a604){if(_0xd8a604){_0x421533=_0xd8a604[_0xe9bd('0x44')];if(!_0x1a36aa[_0xe9bd('0x2e')][_0xe9bd('0x33')](_0xe9bd('0x34'))){_0x1b0929['limit']=qs[_0xe9bd('0x35')](_0x1a36aa['query'][_0xe9bd('0x35')]);_0x1b0929[_0xe9bd('0x1c')]=qs[_0xe9bd('0x1c')](_0x1a36aa[_0xe9bd('0x2e')][_0xe9bd('0x1c')]);}return _0x178574['getSounds'](_0x1b0929);}})['then'](function(_0x56d4eb){if(_0x56d4eb){return _0x56d4eb?{'count':_0x421533,'rows':_0x56d4eb}:null;}})[_0xe9bd('0x22')](respondWithResult(_0x466a89,null))[_0xe9bd('0x47')](handleError(_0x466a89,null));}; \ No newline at end of file +var _0x9090=['type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','options','find','body','params','create','transaction','mode','files','directory','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','sequelize','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','message','removeSound','createdAt','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','index','VoiceMusicOnHold','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map'];(function(_0x37a698,_0x198a0d){var _0x3bba77=function(_0x320aaf){while(--_0x320aaf){_0x37a698['push'](_0x37a698['shift']());}};_0x3bba77(++_0x198a0d);}(_0x9090,0x17f));var _0x0909=function(_0x2c3969,_0x1b99d8){_0x2c3969=_0x2c3969-0x0;var _0x343f74=_0x9090[_0x2c3969];return _0x343f74;};'use strict';var pdf=require(_0x0909('0x0'));var emlformat=require(_0x0909('0x1'));var rimraf=require(_0x0909('0x2'));var zipdir=require(_0x0909('0x3'));var jsonpatch=require(_0x0909('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0909('0x5'));var Mustache=require(_0x0909('0x6'));var util=require(_0x0909('0x7'));var path=require('path');var sox=require(_0x0909('0x8'));var csv=require(_0x0909('0x9'));var ejs=require(_0x0909('0xa'));var fs=require('fs');var _=require(_0x0909('0xb'));var squel=require(_0x0909('0xc'));var crypto=require(_0x0909('0xd'));var jsforce=require(_0x0909('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0909('0x9'));var querystring=require(_0x0909('0xf'));var Papa=require('papaparse');var Redis=require(_0x0909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0909('0x11'));var hardwareService=require(_0x0909('0x12'));var logger=require(_0x0909('0x13'))(_0x0909('0x14'));var utils=require('../../config/utils');var config=require(_0x0909('0x15'));var db=require(_0x0909('0x16'))['db'];function respondWithStatusCode(_0x335df9,_0x1f92df){_0x1f92df=_0x1f92df||0xcc;return function(_0x4e900a){if(_0x4e900a){return _0x335df9[_0x0909('0x17')](_0x1f92df);}return _0x335df9[_0x0909('0x18')](_0x1f92df)[_0x0909('0x19')]();};}function respondWithResult(_0x2629f5,_0x30a847){_0x30a847=_0x30a847||0xc8;return function(_0xad78e9){if(_0xad78e9){return _0x2629f5[_0x0909('0x18')](_0x30a847)[_0x0909('0x1a')](_0xad78e9);}};}function respondWithFilteredResult(_0x1c56f3,_0x2e9bcf){return function(_0x48ee40){if(_0x48ee40){var _0x2c5892=_0x48ee40[_0x0909('0x1b')],_0x1eb8be=_0x2e9bcf[_0x0909('0x1c')],_0x96edb6=_0x2e9bcf[_0x0909('0x1c')]+_0x2e9bcf[_0x0909('0x1d')],_0x2b4a82;if(_0x96edb6>=_0x2c5892){_0x96edb6=_0x2c5892;_0x2b4a82=0xc8;}else{_0x2b4a82=0xce;}_0x1c56f3['status'](_0x2b4a82);return _0x1c56f3[_0x0909('0x1e')](_0x0909('0x1f'),_0x1eb8be+'-'+_0x96edb6+'/'+_0x2c5892)[_0x0909('0x1a')](_0x48ee40);}return null;};}function patchUpdates(_0x498389){return function(_0x3f7214){try{jsonpatch[_0x0909('0x20')](_0x3f7214,_0x498389,!![]);}catch(_0x11455d){return BPromise['reject'](_0x11455d);}return _0x3f7214['save']();};}function saveUpdates(_0xf61ea1,_0x5bef5b){return function(_0xf0efcb){if(_0xf0efcb){return _0xf0efcb[_0x0909('0x21')](_0xf61ea1)[_0x0909('0x22')](function(_0x3037c1){return _0x3037c1;});}return null;};}function removeEntity(_0x30fbfe,_0x36d573){return function(_0x4eec68){if(_0x4eec68){return _0x4eec68[_0x0909('0x23')]()['then'](function(){var _0x85be47=_0x4eec68[_0x0909('0x24')]({'plain':!![]});var _0x2ea745=_0x0909('0x25');return db[_0x0909('0x26')]['destroy']({'where':{'type':_0x2ea745,'resourceId':_0x85be47['id']}})[_0x0909('0x22')](function(){return _0x4eec68;});})[_0x0909('0x22')](function(){_0x30fbfe[_0x0909('0x18')](0xcc)[_0x0909('0x19')]();});}};}function handleEntityNotFound(_0xc879d8,_0x53d139){return function(_0x17d9a7){if(!_0x17d9a7){_0xc879d8[_0x0909('0x17')](0x194);}return _0x17d9a7;};}function handleError(_0x202b4c,_0x165847){_0x165847=_0x165847||0x1f4;return function(_0x59bee7){logger[_0x0909('0x27')](_0x59bee7['stack']);if(_0x59bee7['name']){delete _0x59bee7[_0x0909('0x28')];}_0x202b4c[_0x0909('0x18')](_0x165847)['send'](_0x59bee7);};}exports[_0x0909('0x29')]=function(_0x33ce47,_0x28daaf){var _0x512d7e={},_0x3c7d32={},_0x2775a4={'count':0x0,'rows':[]};var _0xbc1276=db[_0x0909('0x2a')][_0x0909('0x2b')];_0x3c7d32['model']=_[_0x0909('0x2c')](_0xbc1276);_0x3c7d32['query']=_[_0x0909('0x2c')](_0x33ce47[_0x0909('0x2d')]);_0x3c7d32['filters']=_[_0x0909('0x2e')](_0x3c7d32[_0x0909('0x2f')],_0x3c7d32['query']);_0x512d7e[_0x0909('0x30')]=_[_0x0909('0x2e')](_0x3c7d32[_0x0909('0x2f')],qs[_0x0909('0x31')](_0x33ce47[_0x0909('0x2d')]['fields']));_0x512d7e[_0x0909('0x30')]=_0x512d7e[_0x0909('0x30')][_0x0909('0x32')]?_0x512d7e[_0x0909('0x30')]:_0x3c7d32['model'];if(!_0x33ce47[_0x0909('0x2d')][_0x0909('0x33')](_0x0909('0x34'))){_0x512d7e[_0x0909('0x1d')]=qs[_0x0909('0x1d')](_0x33ce47[_0x0909('0x2d')][_0x0909('0x1d')]);_0x512d7e['offset']=qs['offset'](_0x33ce47[_0x0909('0x2d')][_0x0909('0x1c')]);}_0x512d7e[_0x0909('0x35')]=qs[_0x0909('0x36')](_0x33ce47[_0x0909('0x2d')]['sort']);_0x512d7e[_0x0909('0x37')]=qs['filters'](_[_0x0909('0x38')](_0x33ce47[_0x0909('0x2d')],_0x3c7d32[_0x0909('0x39')]));if(_0x33ce47[_0x0909('0x2d')][_0x0909('0x3a')]){_0x512d7e['where']=_[_0x0909('0x3b')](_0x512d7e['where'],{'$or':_[_0x0909('0x3c')](_0xbc1276,function(_0x3623a1){if(_0x3623a1[_0x0909('0x3d')][_0x0909('0x3e')]!==_0x0909('0x3f')){var _0x3d0897={};_0x3d0897[_0x3623a1[_0x0909('0x40')]]={'$like':'%'+_0x33ce47[_0x0909('0x2d')][_0x0909('0x3a')]+'%'};return _0x3d0897;}})});}_0x512d7e=_[_0x0909('0x3b')]({},_0x512d7e,_0x33ce47['options']);var _0x43155f={'where':_0x512d7e['where']};return db[_0x0909('0x2a')]['count'](_0x43155f)[_0x0909('0x22')](function(_0x31540b){_0x2775a4[_0x0909('0x1b')]=_0x31540b;if(_0x33ce47[_0x0909('0x2d')][_0x0909('0x41')]){_0x512d7e[_0x0909('0x42')]=[{'all':!![]}];}return db[_0x0909('0x2a')][_0x0909('0x43')](_0x512d7e);})[_0x0909('0x22')](function(_0x57f18b){_0x2775a4[_0x0909('0x44')]=_0x57f18b;return _0x2775a4;})['then'](respondWithFilteredResult(_0x28daaf,_0x512d7e))[_0x0909('0x45')](handleError(_0x28daaf,null));};exports['show']=function(_0x347bde,_0x8e3b61){var _0x405a1b={'raw':![],'where':{'id':_0x347bde['params']['id']}},_0x325412={};_0x325412[_0x0909('0x2f')]=_[_0x0909('0x2c')](db[_0x0909('0x2a')][_0x0909('0x2b')]);_0x325412[_0x0909('0x2d')]=_['keys'](_0x347bde[_0x0909('0x2d')]);_0x325412[_0x0909('0x39')]=_['intersection'](_0x325412[_0x0909('0x2f')],_0x325412['query']);_0x405a1b[_0x0909('0x30')]=_['intersection'](_0x325412['model'],qs[_0x0909('0x31')](_0x347bde[_0x0909('0x2d')]['fields']));_0x405a1b['attributes']=_0x405a1b[_0x0909('0x30')]['length']?_0x405a1b[_0x0909('0x30')]:_0x325412[_0x0909('0x2f')];if(_0x347bde['query']['includeAll']){_0x405a1b['include']=[{'all':!![]}];}_0x405a1b=_[_0x0909('0x3b')]({},_0x405a1b,_0x347bde[_0x0909('0x46')]);return db[_0x0909('0x2a')][_0x0909('0x47')](_0x405a1b)['then'](handleEntityNotFound(_0x8e3b61,null))[_0x0909('0x22')](respondWithResult(_0x8e3b61,null))[_0x0909('0x45')](handleError(_0x8e3b61,null));};exports[_0x0909('0x21')]=function(_0x1a40f6,_0x58f5f8){if(_0x1a40f6['body']['id']){delete _0x1a40f6[_0x0909('0x48')]['id'];}return db[_0x0909('0x2a')][_0x0909('0x47')]({'where':{'id':_0x1a40f6[_0x0909('0x49')]['id']}})[_0x0909('0x22')](handleEntityNotFound(_0x58f5f8,null))[_0x0909('0x22')](saveUpdates(_0x1a40f6[_0x0909('0x48')],null))[_0x0909('0x22')](respondWithResult(_0x58f5f8,null))['catch'](handleError(_0x58f5f8,null));};exports[_0x0909('0x4a')]=function(_0x2eaf27,_0x5e8f34,_0x190741){return db['sequelize'][_0x0909('0x4b')](function(_0x3540df){if(_0x2eaf27[_0x0909('0x48')][_0x0909('0x4c')]===_0x0909('0x4d')){_0x2eaf27[_0x0909('0x48')][_0x0909('0x4e')]=path['join'](config[_0x0909('0x4f')],_0x0909('0x50'),_0x2eaf27[_0x0909('0x48')][_0x0909('0x28')]);}return db[_0x0909('0x2a')][_0x0909('0x4a')](_0x2eaf27['body'],{'transaction':_0x3540df})[_0x0909('0x22')](function(_0x578979){if(_0x2eaf27['body']['mode']==='files'){fs[_0x0909('0x51')](_0x578979[_0x0909('0x4e')],parseInt('0777',0x8));}var _0x4e5563=_0x2eaf27[_0x0909('0x52')][_0x0909('0x24')]({'plain':!![]});if(!_0x4e5563)throw new Error(_0x0909('0x53'));if(_0x4e5563[_0x0909('0x54')]===_0x0909('0x52')){var _0x433690=_0x578979[_0x0909('0x24')]({'plain':!![]});return db[_0x0909('0x55')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x4e5563[_0x0909('0x56')]},'raw':!![]})['then'](function(_0x564949){if(_0x564949&&_0x564949[_0x0909('0x57')]===0x0){return db[_0x0909('0x26')][_0x0909('0x4a')]({'name':_0x433690[_0x0909('0x28')],'resourceId':_0x433690['id'],'type':_0x564949[_0x0909('0x28')],'sectionId':_0x564949['id']},{})[_0x0909('0x22')](function(){return _0x578979;});}else{return _0x578979;}})[_0x0909('0x45')](function(_0xe430a2){logger[_0x0909('0x27')](_0x0909('0x58'),_0xe430a2);});}return _0x578979;});})['then'](respondWithResult(_0x5e8f34,0xc9))[_0x0909('0x45')](handleError(_0x5e8f34,null));};exports[_0x0909('0x23')]=function(_0x188114,_0x269fff,_0x4a0e8e){var _0x3a761c;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x188114['params']['id']}})[_0x0909('0x22')](function(_0x16f3cc){if(_0x16f3cc){return db['sequelize']['transaction'](function(_0x5542fd){return _0x16f3cc['destroy']({'transaction':_0x5542fd,'raw':!![]})['then'](function(_0x3a5fb7){if(_0x3a5fb7['directory']){fs[_0x0909('0x59')](_0x3a5fb7[_0x0909('0x4e')])['forEach'](function(_0x4237d8){fs[_0x0909('0x5a')](path[_0x0909('0x5b')](_0x3a5fb7[_0x0909('0x4e')],_0x4237d8));});fs[_0x0909('0x5c')](_0x3a5fb7['directory']);}return _0x3a5fb7;});})[_0x0909('0x45')](function(_0x118dcd){throw new db[(_0x0909('0x5d'))][(_0x0909('0x5e'))](_0x118dcd['message']);});}})[_0x0909('0x22')](handleEntityNotFound(_0x269fff,null))[_0x0909('0x22')](removeEntity(_0x269fff,null))['catch'](handleError(_0x269fff,null));};exports[_0x0909('0x5f')]=function(_0x12c6e9,_0x18ab73,_0x41a018){return db[_0x0909('0x60')][_0x0909('0x4b')](function(_0x4fdca0){var _0x34cf14;return db['VoiceMusicOnHold'][_0x0909('0x47')]({'where':{'id':_0x12c6e9[_0x0909('0x49')]['id']}})['then'](function(_0x30ef54){if(_0x30ef54){_0x34cf14=_0x30ef54;return _0x30ef54['addSound'](_0x12c6e9[_0x0909('0x48')]['id'],{'transaction':_0x4fdca0});}})['then'](function(_0x19c249){if(_0x19c249){return db[_0x0909('0x61')][_0x0909('0x62')]({'where':{'id':_0x12c6e9[_0x0909('0x48')]['id']},'attributes':['id',_0x0909('0x28'),_0x0909('0x63'),_0x0909('0x64'),'createdAt'],'raw':!![]});}})[_0x0909('0x22')](function(_0x4a10b4){if(_0x4a10b4){var _0x20b9b6=path[_0x0909('0x5b')](config['root'],_0x0909('0x65'),util[_0x0909('0x66')]('%s.%s',path[_0x0909('0x67')](_0x4a10b4['save_name'],path[_0x0909('0x68')](_0x4a10b4[_0x0909('0x63')])),_0x4a10b4[_0x0909('0x64')]));var _0x126618=path[_0x0909('0x5b')](config[_0x0909('0x4f')],'server/files/moh',_0x34cf14[_0x0909('0x28')],util['format'](_0x0909('0x69'),_0x4a10b4[_0x0909('0x28')],_0x4a10b4['converted_format']));fs[_0x0909('0x6a')](_0x20b9b6,_0x126618);return _0x4a10b4;}})[_0x0909('0x45')](function(_0x5ea554){throw new db[(_0x0909('0x5d'))][(_0x0909('0x5e'))](_0x5ea554[_0x0909('0x6b')]);});})[_0x0909('0x22')](handleEntityNotFound(_0x18ab73,null))[_0x0909('0x22')](respondWithResult(_0x18ab73,0xc9))[_0x0909('0x45')](handleError(_0x18ab73,null));};exports[_0x0909('0x6c')]=function(_0x3e1e4a,_0xf8890a,_0x1ffc4b){return db['sequelize'][_0x0909('0x4b')](function(_0x3c1d2c){var _0x3bc4ff;return db[_0x0909('0x2a')][_0x0909('0x62')]({'where':{'id':_0x3e1e4a['params']['id']}})[_0x0909('0x22')](handleEntityNotFound(_0xf8890a,null))['then'](function(_0x5272ec){if(_0x5272ec){_0x3bc4ff=_0x5272ec;return _0x5272ec[_0x0909('0x6c')](_0x3e1e4a[_0x0909('0x49')]['id2']);}})[_0x0909('0x22')](function(_0x571ff3){if(_0x571ff3){return db[_0x0909('0x61')]['findOne']({'where':{'id':_0x3e1e4a[_0x0909('0x49')]['id2']},'attributes':['id',_0x0909('0x28'),'save_name',_0x0909('0x64'),_0x0909('0x6d')],'raw':!![]});}})[_0x0909('0x22')](function(_0x20993f){if(_0x20993f){fs[_0x0909('0x5a')](path[_0x0909('0x5b')](_0x3bc4ff['directory'],util[_0x0909('0x66')](_0x0909('0x69'),_0x20993f[_0x0909('0x28')],_0x20993f['converted_format'])));return _0x20993f;}})[_0x0909('0x45')](function(_0x4cd425){throw new db['Sequelize'][(_0x0909('0x5e'))](_0x4cd425['message']);});})[_0x0909('0x22')](handleEntityNotFound(_0xf8890a,null))[_0x0909('0x22')](respondWithStatusCode(_0xf8890a,0xcc))['catch'](handleError(_0xf8890a,null));};exports[_0x0909('0x6e')]=function(_0xa7f6ee,_0x20e17e,_0xb018a4){var _0x149a60={};var _0x2e9013={};var _0x7d8bda;var _0x2301a9;return db['VoiceMusicOnHold'][_0x0909('0x62')]({'where':{'id':_0xa7f6ee[_0x0909('0x49')]['id']}})[_0x0909('0x22')](handleEntityNotFound(_0x20e17e,null))[_0x0909('0x22')](function(_0x1403f8){if(_0x1403f8){_0x7d8bda=_0x1403f8;_0x2e9013['model']=_[_0x0909('0x2c')](db[_0x0909('0x61')][_0x0909('0x2b')]);_0x2e9013[_0x0909('0x2d')]=_[_0x0909('0x2c')](_0xa7f6ee[_0x0909('0x2d')]);_0x2e9013[_0x0909('0x39')]=_[_0x0909('0x2e')](_0x2e9013['model'],_0x2e9013[_0x0909('0x2d')]);_0x149a60['attributes']=_[_0x0909('0x2e')](_0x2e9013[_0x0909('0x2f')],qs[_0x0909('0x31')](_0xa7f6ee[_0x0909('0x2d')][_0x0909('0x31')]));_0x149a60['attributes']=_0x149a60[_0x0909('0x30')][_0x0909('0x32')]?_0x149a60[_0x0909('0x30')]:_0x2e9013[_0x0909('0x2f')];_0x149a60['order']=qs[_0x0909('0x36')](_0xa7f6ee[_0x0909('0x2d')][_0x0909('0x36')]);_0x149a60[_0x0909('0x37')]=qs[_0x0909('0x39')](_[_0x0909('0x38')](_0xa7f6ee[_0x0909('0x2d')],_0x2e9013['filters']));if(_0xa7f6ee[_0x0909('0x2d')]['filter']){_0x149a60[_0x0909('0x37')]=_['merge'](_0x149a60[_0x0909('0x37')],{'$or':_[_0x0909('0x3c')](_0x149a60[_0x0909('0x30')],function(_0x221715){var _0xb81d8={};_0xb81d8[_0x221715]={'$like':'%'+_0xa7f6ee[_0x0909('0x2d')][_0x0909('0x3a')]+'%'};return _0xb81d8;})});}_0x149a60=_[_0x0909('0x3b')]({},_0x149a60,_0xa7f6ee[_0x0909('0x46')]);return _0x7d8bda['getSounds'](_0x149a60);}})[_0x0909('0x22')](function(_0xf66216){if(_0xf66216){_0x2301a9=_0xf66216[_0x0909('0x32')];if(!_0xa7f6ee[_0x0909('0x2d')]['hasOwnProperty'](_0x0909('0x34'))){_0x149a60[_0x0909('0x1d')]=qs[_0x0909('0x1d')](_0xa7f6ee[_0x0909('0x2d')][_0x0909('0x1d')]);_0x149a60[_0x0909('0x1c')]=qs[_0x0909('0x1c')](_0xa7f6ee[_0x0909('0x2d')][_0x0909('0x1c')]);}return _0x7d8bda[_0x0909('0x6e')](_0x149a60);}})[_0x0909('0x22')](function(_0x31e649){if(_0x31e649){return _0x31e649?{'count':_0x2301a9,'rows':_0x31e649}:null;}})[_0x0909('0x22')](respondWithResult(_0x20e17e,null))[_0x0909('0x45')](handleError(_0x20e17e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f53b6d3..bbc727d 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 _0x3630=['request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','lodash','util','bluebird'];(function(_0x385d93,_0x230aed){var _0x570924=function(_0x4cfc76){while(--_0x4cfc76){_0x385d93['push'](_0x385d93['shift']());}};_0x570924(++_0x230aed);}(_0x3630,0x1ed));var _0x0363=function(_0x4a1382,_0x12f7eb){_0x4a1382=_0x4a1382-0x0;var _0x3abfbc=_0x3630[_0x4a1382];return _0x3abfbc;};'use strict';var _=require(_0x0363('0x0'));var util=require(_0x0363('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0363('0x2'));var rp=require(_0x0363('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0363('0x4'));var config=require(_0x0363('0x5'));var attributes=require(_0x0363('0x6'));module[_0x0363('0x7')]=function(_0x4087d9,_0xdef70){return _0x4087d9['define']('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe25f=['bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xe25f,0x1d1));var _0xfe25=function(_0x505124,_0x34c8ea){_0x505124=_0x505124-0x0;var _0x37f08c=_0xe25f[_0x505124];return _0x37f08c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe25('0x0'))(_0xfe25('0x1'));var moment=require(_0xfe25('0x2'));var BPromise=require(_0xfe25('0x3'));var rp=require(_0xfe25('0x4'));var fs=require('fs');var path=require(_0xfe25('0x5'));var rimraf=require(_0xfe25('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe25('0x7'));module[_0xfe25('0x8')]=function(_0x197ee4,_0xa8095c){return _0x197ee4[_0xfe25('0x9')](_0xfe25('0xa'),attributes,{'tableName':_0xfe25('0xb'),'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 3964d16..ec9e4f3 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 _0x28c8=['error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25c835,_0xec4bd5){var _0x16fb02=function(_0x3bf0d1){while(--_0x3bf0d1){_0x25c835['push'](_0x25c835['shift']());}};_0x16fb02(++_0xec4bd5);}(_0x28c8,0x119));var _0x828c=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x28c8[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x828c('0x0'));var BPromise=require(_0x828c('0x1'));var rs=require(_0x828c('0x2'));var fs=require('fs');var Redis=require(_0x828c('0x3'));var db=require(_0x828c('0x4'))['db'];var utils=require(_0x828c('0x5'));var logger=require(_0x828c('0x6'))(_0x828c('0x7'));var config=require(_0x828c('0x8'));var jayson=require(_0x828c('0x9'));var client=jayson[_0x828c('0xa')][_0x828c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a049f,_0xeaefa5,_0x4da02b){return new BPromise(function(_0x27dbcb,_0x3fa5a9){return client[_0x828c('0xc')](_0x1a049f,_0x4da02b)[_0x828c('0xd')](function(_0x39af04){logger['info'](_0x828c('0xe'),_0xeaefa5,_0x828c('0xf'));logger[_0x828c('0x10')](_0x828c('0x11'),_0xeaefa5,'request\x20sent',JSON[_0x828c('0x12')](_0x39af04));if(_0x39af04[_0x828c('0x13')]){if(_0x39af04[_0x828c('0x13')][_0x828c('0x14')]===0x1f4){logger[_0x828c('0x13')](_0x828c('0xe'),_0xeaefa5,_0x39af04['error'][_0x828c('0x15')]);return _0x3fa5a9(_0x39af04[_0x828c('0x13')][_0x828c('0x15')]);}logger[_0x828c('0x13')](_0x828c('0xe'),_0xeaefa5,_0x39af04['error'][_0x828c('0x15')]);return _0x27dbcb(_0x39af04[_0x828c('0x13')][_0x828c('0x15')]);}else{logger[_0x828c('0x16')](_0x828c('0xe'),_0xeaefa5,_0x828c('0xf'));_0x27dbcb(_0x39af04[_0x828c('0x17')]['message']);}})[_0x828c('0x18')](function(_0x6ce9e4){logger[_0x828c('0x13')](_0x828c('0xe'),_0xeaefa5,_0x6ce9e4);_0x3fa5a9(_0x6ce9e4);});});} \ No newline at end of file +var _0x59ec=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x1b665d,_0x2a4946){var _0x3e7e33=function(_0x5f4549){while(--_0x5f4549){_0x1b665d['push'](_0x1b665d['shift']());}};_0x3e7e33(++_0x2a4946);}(_0x59ec,0x192));var _0xc59e=function(_0x1ffa9d,_0x5824f9){_0x1ffa9d=_0x1ffa9d-0x0;var _0x5e704b=_0x59ec[_0x1ffa9d];return _0x5e704b;};'use strict';var _=require(_0xc59e('0x0'));var util=require('util');var moment=require(_0xc59e('0x1'));var BPromise=require(_0xc59e('0x2'));var rs=require(_0xc59e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59e('0x4'))['db'];var utils=require(_0xc59e('0x5'));var logger=require(_0xc59e('0x6'))('rpc');var config=require(_0xc59e('0x7'));var jayson=require(_0xc59e('0x8'));var client=jayson[_0xc59e('0x9')][_0xc59e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32d323,_0x5ad71a,_0x10e758){return new BPromise(function(_0x50580d,_0x394068){return client['request'](_0x32d323,_0x10e758)['then'](function(_0x58c8e1){logger[_0xc59e('0xb')](_0xc59e('0xc'),_0x5ad71a,_0xc59e('0xd'));logger[_0xc59e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5ad71a,'request\x20sent',JSON[_0xc59e('0xf')](_0x58c8e1));if(_0x58c8e1['error']){if(_0x58c8e1['error'][_0xc59e('0x10')]===0x1f4){logger[_0xc59e('0x11')](_0xc59e('0xc'),_0x5ad71a,_0x58c8e1[_0xc59e('0x11')][_0xc59e('0x12')]);return _0x394068(_0x58c8e1[_0xc59e('0x11')][_0xc59e('0x12')]);}logger['error'](_0xc59e('0xc'),_0x5ad71a,_0x58c8e1[_0xc59e('0x11')][_0xc59e('0x12')]);return _0x50580d(_0x58c8e1[_0xc59e('0x11')][_0xc59e('0x12')]);}else{logger[_0xc59e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5ad71a,_0xc59e('0xd'));_0x50580d(_0x58c8e1[_0xc59e('0x13')][_0xc59e('0x12')]);}})[_0xc59e('0x14')](function(_0x49f122){logger[_0xc59e('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5ad71a,_0x49f122);_0x394068(_0x49f122);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7fea4c6..8cb506a 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 _0x0962=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/users','getAgents','post','create','update','delete'];(function(_0x5d9671,_0x2e6af4){var _0x2771f5=function(_0x2d2f2b){while(--_0x2d2f2b){_0x5d9671['push'](_0x5d9671['shift']());}};_0x2771f5(++_0x2e6af4);}(_0x0962,0x116));var _0x2096=function(_0x229db1,_0x4dbcd6){_0x229db1=_0x229db1-0x0;var _0x500b59=_0x0962[_0x229db1];return _0x500b59;};'use strict';var multer=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var path=require(_0x2096('0x2'));var timeout=require(_0x2096('0x3'));var express=require(_0x2096('0x4'));var router=express[_0x2096('0x5')]();var auth=require(_0x2096('0x6'));var interaction=require(_0x2096('0x7'));var config=require('../../config/environment');var controller=require(_0x2096('0x8'));router[_0x2096('0x9')]('/',auth['isAuthenticated'](),controller[_0x2096('0xa')]);router[_0x2096('0x9')](_0x2096('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x2096('0x9')](_0x2096('0xc'),auth[_0x2096('0xd')](),controller[_0x2096('0xe')]);router['get'](_0x2096('0xf'),auth[_0x2096('0xd')](),controller[_0x2096('0x10')]);router[_0x2096('0x11')]('/',auth['isAuthenticated'](),controller[_0x2096('0x12')]);router['post'](_0x2096('0xf'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x2096('0xc'),auth['isAuthenticated'](),controller[_0x2096('0x13')]);router[_0x2096('0x14')](_0x2096('0xc'),auth[_0x2096('0xd')](),controller['destroy']);router['delete'](_0x2096('0xf'),auth[_0x2096('0xd')](),controller[_0x2096('0x15')]);module[_0x2096('0x16')]=router; \ No newline at end of file +var _0xc4e6=['describe','/:id','show','/:id/users','getAgents','post','addAgents','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0xc4e6[_0x5ba74f];return _0x534d79;};'use strict';var multer=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var path=require('path');var timeout=require(_0x6c4e('0x2'));var express=require(_0x6c4e('0x3'));var router=express[_0x6c4e('0x4')]();var auth=require(_0x6c4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c4e('0x6'));var controller=require(_0x6c4e('0x7'));router[_0x6c4e('0x8')]('/',auth['isAuthenticated'](),controller[_0x6c4e('0x9')]);router['get']('/describe',auth[_0x6c4e('0xa')](),controller[_0x6c4e('0xb')]);router[_0x6c4e('0x8')](_0x6c4e('0xc'),auth[_0x6c4e('0xa')](),controller[_0x6c4e('0xd')]);router[_0x6c4e('0x8')](_0x6c4e('0xe'),auth[_0x6c4e('0xa')](),controller[_0x6c4e('0xf')]);router[_0x6c4e('0x10')]('/',auth[_0x6c4e('0xa')](),controller['create']);router['post'](_0x6c4e('0xe'),auth[_0x6c4e('0xa')](),controller[_0x6c4e('0x11')]);router['put'](_0x6c4e('0xc'),auth[_0x6c4e('0xa')](),controller[_0x6c4e('0x12')]);router[_0x6c4e('0x13')]('/:id',auth[_0x6c4e('0xa')](),controller[_0x6c4e('0x14')]);router[_0x6c4e('0x13')](_0x6c4e('0xe'),auth[_0x6c4e('0xa')](),controller['removeAgents']);module[_0x6c4e('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6b5587e..3d1dad9 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 _0x9906=['STRING','INTEGER','sequelize','exports','name','VIRTUAL','system-','getDataValue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9906,0xda));var _0x6990=function(_0x55bb80,_0x31972b){_0x55bb80=_0x55bb80-0x0;var _0x2af7b9=_0x9906[_0x55bb80];return _0x2af7b9;};'use strict';var Sequelize=require(_0x6990('0x0'));module[_0x6990('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6990('0x2')},'prefix':{'type':Sequelize[_0x6990('0x3')],'get':function(_0xe40939){return _0x6990('0x4')+this[_0x6990('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x6990('0x6')]},'callerIdAll':{'type':Sequelize[_0x6990('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0x6990('0x7')]}}; \ No newline at end of file +var _0xbff6=['STRING','name','system-','INTEGER','exports'];(function(_0x3f972c,_0x75509f){var _0x52a826=function(_0x421557){while(--_0x421557){_0x3f972c['push'](_0x3f972c['shift']());}};_0x52a826(++_0x75509f);}(_0xbff6,0x10d));var _0x6bff=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xbff6[_0x1ccbcc];return _0x1e873f;};'use strict';var Sequelize=require('sequelize');module[_0x6bff('0x0')]={'name':{'type':Sequelize[_0x6bff('0x1')],'allowNull':![],'unique':_0x6bff('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x43784c){return _0x6bff('0x3')+this['getDataValue'](_0x6bff('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6bff('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c40a034..5a8418c 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 _0xe14b=['push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','end','json','count','offset','limit','status','set','apply','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','VoicePrefix','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','describe','create','sequelize','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed'];(function(_0x177d45,_0x5ce826){var _0xcd60c4=function(_0x3f7fbe){while(--_0x3f7fbe){_0x177d45['push'](_0x177d45['shift']());}};_0xcd60c4(++_0x5ce826);}(_0xe14b,0x93));var _0xbe14=function(_0x525d42,_0x32f81d){_0x525d42=_0x525d42-0x0;var _0x3b6c72=_0xe14b[_0x525d42];return _0x3b6c72;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe14('0x10'))(_0xbe14('0x11'));var utils=require('../../config/utils');var config=require(_0xbe14('0x12'));var db=require(_0xbe14('0x13'))['db'];config[_0xbe14('0x14')]=_[_0xbe14('0x15')](config[_0xbe14('0x14')],{'host':_0xbe14('0x16'),'port':0x18eb});var socket=require(_0xbe14('0x17'))(new Redis(config[_0xbe14('0x14')]));require(_0xbe14('0x18'))[_0xbe14('0x19')](socket);function respondWithStatusCode(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xcc;return function(_0x813399){if(_0x813399){return _0x1e4826['sendStatus'](_0x33fd54);}return _0x1e4826['status'](_0x33fd54)[_0xbe14('0x1a')]();};}function respondWithResult(_0x3dc4a9,_0xf4ac9){_0xf4ac9=_0xf4ac9||0xc8;return function(_0x37ce4e){if(_0x37ce4e){return _0x3dc4a9['status'](_0xf4ac9)[_0xbe14('0x1b')](_0x37ce4e);}};}function respondWithFilteredResult(_0xe9c3ec,_0xfd7b8f){return function(_0x123ede){if(_0x123ede){var _0x38f1ea=_0x123ede[_0xbe14('0x1c')],_0x29ab73=_0xfd7b8f[_0xbe14('0x1d')],_0x17ae86=_0xfd7b8f[_0xbe14('0x1d')]+_0xfd7b8f[_0xbe14('0x1e')],_0x5ea1f8;if(_0x17ae86>=_0x38f1ea){_0x17ae86=_0x38f1ea;_0x5ea1f8=0xc8;}else{_0x5ea1f8=0xce;}_0xe9c3ec[_0xbe14('0x1f')](_0x5ea1f8);return _0xe9c3ec[_0xbe14('0x20')]('Content-Range',_0x29ab73+'-'+_0x17ae86+'/'+_0x38f1ea)[_0xbe14('0x1b')](_0x123ede);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x21')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x22')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x23')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x24')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x25')]({'plain':!![]});var _0x5fa043=_0xbe14('0x26');return db[_0xbe14('0x27')][_0xbe14('0x28')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x24')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x1f')](0xcc)[_0xbe14('0x1a')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x29')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x2a')](_0x3c3613[_0xbe14('0x2b')]);if(_0x3c3613[_0xbe14('0x2c')]){delete _0x3c3613[_0xbe14('0x2c')];}_0x29fc64[_0xbe14('0x1f')](_0x59bf34)[_0xbe14('0x2d')](_0x3c3613);};}exports[_0xbe14('0x2e')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=db[_0xbe14('0x2f')][_0xbe14('0x30')];_0x3bf43c[_0xbe14('0x31')]=_[_0xbe14('0x32')](_0x10ae36);_0x3bf43c[_0xbe14('0x33')]=_[_0xbe14('0x32')](_0x4168c8['query']);_0x3bf43c[_0xbe14('0x34')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c[_0xbe14('0x33')]);_0x40538f['attributes']=_[_0xbe14('0x35')](_0x3bf43c[_0xbe14('0x31')],qs['fields'](_0x4168c8['query']['fields']));_0x40538f[_0xbe14('0x36')]=_0x40538f[_0xbe14('0x36')]['length']?_0x40538f[_0xbe14('0x36')]:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8[_0xbe14('0x33')][_0xbe14('0x37')](_0xbe14('0x38'))){_0x40538f['limit']=qs['limit'](_0x4168c8[_0xbe14('0x33')]['limit']);_0x40538f['offset']=qs['offset'](_0x4168c8[_0xbe14('0x33')][_0xbe14('0x1d')]);}_0x40538f[_0xbe14('0x39')]=qs[_0xbe14('0x3a')](_0x4168c8[_0xbe14('0x33')][_0xbe14('0x3a')]);_0x40538f[_0xbe14('0x3b')]=qs[_0xbe14('0x34')](_[_0xbe14('0x3c')](_0x4168c8[_0xbe14('0x33')],_0x3bf43c[_0xbe14('0x34')]));if(_0x4168c8[_0xbe14('0x33')]['filter']){_0x40538f['where']=_[_0xbe14('0x3d')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x3e')](_0x10ae36,function(_0x520e09){if(_0x520e09[_0xbe14('0x3f')][_0xbe14('0x40')]!==_0xbe14('0x41')){var _0x45ff31={};_0x45ff31[_0x520e09[_0xbe14('0x42')]]={'$like':'%'+_0x4168c8[_0xbe14('0x33')][_0xbe14('0x43')]+'%'};return _0x45ff31;}})});}_0x40538f=_[_0xbe14('0x3d')]({},_0x40538f,_0x4168c8[_0xbe14('0x44')]);var _0x5255ff={'where':_0x40538f[_0xbe14('0x3b')]};return db[_0xbe14('0x2f')][_0xbe14('0x1c')](_0x5255ff)[_0xbe14('0x24')](function(_0x3287b9){_0x39dc0a[_0xbe14('0x1c')]=_0x3287b9;if(_0x4168c8['query'][_0xbe14('0x45')]){_0x40538f[_0xbe14('0x46')]=[{'all':!![]}];}return db[_0xbe14('0x2f')][_0xbe14('0x47')](_0x40538f);})['then'](function(_0x4bfa96){_0x39dc0a[_0xbe14('0x48')]=_0x4bfa96;return _0x39dc0a;})[_0xbe14('0x24')](respondWithFilteredResult(_0x16a159,_0x40538f))[_0xbe14('0x49')](handleError(_0x16a159,null));};exports['show']=function(_0x5d5318,_0x6b6aa8){var _0x59ae4d={'raw':![],'where':{'id':_0x5d5318[_0xbe14('0x4a')]['id']}},_0x5657fe={};_0x5657fe[_0xbe14('0x31')]=_[_0xbe14('0x32')](db['VoicePrefix']['rawAttributes']);_0x5657fe['query']=_[_0xbe14('0x32')](_0x5d5318[_0xbe14('0x33')]);_0x5657fe[_0xbe14('0x34')]=_['intersection'](_0x5657fe[_0xbe14('0x31')],_0x5657fe[_0xbe14('0x33')]);_0x59ae4d[_0xbe14('0x36')]=_[_0xbe14('0x35')](_0x5657fe['model'],qs['fields'](_0x5d5318[_0xbe14('0x33')][_0xbe14('0x4b')]));_0x59ae4d[_0xbe14('0x36')]=_0x59ae4d[_0xbe14('0x36')][_0xbe14('0x4c')]?_0x59ae4d['attributes']:_0x5657fe['model'];if(_0x5d5318[_0xbe14('0x33')][_0xbe14('0x45')]){_0x59ae4d[_0xbe14('0x46')]=[{'all':!![]}];}_0x59ae4d=_[_0xbe14('0x3d')]({},_0x59ae4d,_0x5d5318['options']);return db[_0xbe14('0x2f')][_0xbe14('0x4d')](_0x59ae4d)['then'](handleEntityNotFound(_0x6b6aa8,null))[_0xbe14('0x24')](respondWithResult(_0x6b6aa8,null))[_0xbe14('0x49')](handleError(_0x6b6aa8,null));};exports[_0xbe14('0x28')]=function(_0x36c20c,_0x589dac){return db['VoicePrefix'][_0xbe14('0x4d')]({'where':{'id':_0x36c20c[_0xbe14('0x4a')]['id']}})['then'](handleEntityNotFound(_0x589dac,null))['then'](removeEntity(_0x589dac,null))[_0xbe14('0x49')](handleError(_0x589dac,null));};exports[_0xbe14('0x4e')]=function(_0x3f7f5b,_0x1a8a3d){return db[_0xbe14('0x2f')][_0xbe14('0x4e')]()[_0xbe14('0x24')](respondWithResult(_0x1a8a3d,null))['catch'](handleError(_0x1a8a3d,null));};exports[_0xbe14('0x4f')]=function(_0x5f22b2,_0x6928f2){var _0x22b1f8;return db[_0xbe14('0x50')]['transaction'](function(_0x3a221b){return db[_0xbe14('0x2f')][_0xbe14('0x4f')](_0x5f22b2[_0xbe14('0x51')],{'transaction':_0x3a221b})[_0xbe14('0x24')](function(_0x2dbeb1){_0x22b1f8=_0x2dbeb1['get']({'plain':!![]});return db['VoiceExtension'][_0xbe14('0x4d')]({'where':{'id':_0x22b1f8[_0xbe14('0x52')]},'raw':!![]})[_0xbe14('0x24')](function(_0x48554a){return createVoicePrefixExtensions(_0x22b1f8,_0x48554a,_0x3a221b);});});})['then'](function(){var _0x44fe0d=_0x5f22b2[_0xbe14('0x53')]['get']({'plain':!![]});if(!_0x44fe0d)throw new Error(_0xbe14('0x54'));if(_0x44fe0d[_0xbe14('0x55')]==='user'){var _0x28f995=_0x22b1f8;return db['UserProfileSection'][_0xbe14('0x4d')]({'where':{'name':_0xbe14('0x26'),'userProfileId':_0x44fe0d[_0xbe14('0x56')]},'raw':!![]})['then'](function(_0x435c8d){if(_0x435c8d&&_0x435c8d[_0xbe14('0x57')]===0x0){return db['UserProfileResource'][_0xbe14('0x4f')]({'name':_0x28f995[_0xbe14('0x2c')],'resourceId':_0x28f995['id'],'type':_0x435c8d[_0xbe14('0x2c')],'sectionId':_0x435c8d['id']},{})[_0xbe14('0x24')](function(){return _0x22b1f8;});}else{return _0x22b1f8;}})[_0xbe14('0x49')](function(_0x4f06a3){logger[_0xbe14('0x2a')](_0xbe14('0x58'),_0x4f06a3);throw _0x4f06a3;});}return _0x22b1f8;})[_0xbe14('0x24')](respondWithResult(_0x6928f2,null))[_0xbe14('0x49')](handleError(_0x6928f2,null));};function Extension(_0x32968f,_0x44084c,_0x1dd6c7,_0x56ab61){this[_0xbe14('0x59')]=_0xbe14('0x5a');this[_0xbe14('0x5b')]=_0x32968f;this[_0xbe14('0x5c')]=_0x1dd6c7;this[_0xbe14('0x3f')]=_0xbe14('0x5d');this[_0xbe14('0x5e')]=_0xbe14('0x5f');this[_0xbe14('0x60')]=_0x44084c;this[_0xbe14('0x61')]=_0x56ab61;}function createVoicePrefixExtensions(_0x358950,_0x4bccfc,_0x56bcd3){return new BPromise(function(_0x58dd79,_0x10c0bc){var _0x1bfcbf=new Extension(formatPrefixName(_0x358950[_0xbe14('0x62')]),0x1,_0xbe14('0x63'),_0xbe14('0x64'));_0x1bfcbf[_0xbe14('0x65')]=_0x358950['id'];return db[_0xbe14('0x66')][_0xbe14('0x4f')](_0x1bfcbf,{'transaction':_0x56bcd3})[_0xbe14('0x24')](function(_0x451b0b){var _0x603816=_0x451b0b[_0xbe14('0x25')]({'plain':!![]});var _0x2088e4=_[_0xbe14('0x3e')](addVoicePrefixExtensions(_0x358950,_0x4bccfc),function(_0x1c831a){_0x1c831a[_0xbe14('0x52')]=_0x603816['id'];_0x1c831a[_0xbe14('0x65')]=_0x358950['id'];return _0x1c831a;});return db[_0xbe14('0x66')][_0xbe14('0x67')](_0x2088e4,{'transaction':_0x56bcd3})[_0xbe14('0x24')](function(_0x5f394c){if(!_0x5f394c){return _0x10c0bc(_0xbe14('0x68'));}else{return _0x58dd79(_0x5f394c);}})[_0xbe14('0x49')](function(_0x2c426d){return _0x10c0bc(_0x2c426d);});});;});};function addVoicePrefixExtensions(_0x46b49c,_0x3ee6b7){var _0x222944=[];var _0x198b55=formatPrefixName(_0x46b49c[_0xbe14('0x62')]);_0x222944[_0xbe14('0x69')](new Extension(_0x198b55,0x2,_0xbe14('0x6a'),'CDR(prefix)='+_0x46b49c[_0xbe14('0x2c')]));if(_0x46b49c[_0xbe14('0x6b')]){_0x222944[_0xbe14('0x69')](new Extension(_0x198b55,0x3,_0xbe14('0x6a'),_0xbe14('0x6c')+_0x46b49c['callerIdAll']));}else{_0x222944[_0xbe14('0x69')](new Extension(_0x198b55,0x3,_0xbe14('0x63'),_0xbe14('0x6d')));}_0x222944[_0xbe14('0x69')](new Extension(_0x198b55,0x4,_0xbe14('0x6e'),_0x3ee6b7['context']+','+_0xbe14('0x6f')+(0x8+_0x46b49c[_0xbe14('0x2c')][_0xbe14('0x4c')])+'}'+','+0x1));return _0x222944;}function formatPrefixName(_0x29bb26){var _0xaebce8='_';for(var _0x289c4d=0x0;_0x289c4d<_0x29bb26[_0xbe14('0x4c')];_0x289c4d++){if(_0x29bb26[_0xbe14('0x70')](_0x289c4d)=='-'){_0xaebce8+=_0x29bb26['charAt'](_0x289c4d);}else{_0xaebce8+='['+_0x29bb26[_0xbe14('0x70')](_0x289c4d)+']';}}_0xaebce8+='.';return _0xaebce8;}exports[_0xbe14('0x23')]=function(_0x2fdf5d,_0x20b12e,_0x5982b7){var _0xa4b2a3=_0x2fdf5d[_0xbe14('0x51')];_0xa4b2a3['prefix']='system-'+_0xa4b2a3[_0xbe14('0x2c')]+'-';return db[_0xbe14('0x50')][_0xbe14('0x71')](function(_0x2510a0){return db[_0xbe14('0x2f')][_0xbe14('0x23')](_0xa4b2a3,{'where':{'id':_0xa4b2a3['id']},'transaction':_0x2510a0})[_0xbe14('0x24')](function(){return db[_0xbe14('0x66')]['destroy']({'where':{'VoicePrefixId':_0xa4b2a3['id']},'transaction':_0x2510a0})['then'](function(){return db[_0xbe14('0x66')][_0xbe14('0x4d')]({'where':{'id':_0xa4b2a3[_0xbe14('0x52')]},'raw':!![]})['then'](function(_0x76e91e){return createVoicePrefixExtensions(_0xa4b2a3,_0x76e91e,_0x2510a0);});});});})[_0xbe14('0x24')](function(){return db[_0xbe14('0x2f')][_0xbe14('0x72')](_0xa4b2a3['id']);})[_0xbe14('0x24')](respondWithResult(_0x20b12e,null))[_0xbe14('0x49')](handleError(_0x20b12e,null));};exports[_0xbe14('0x73')]=function(_0x5b5c37,_0x43b817,_0x3b6ef5){return db[_0xbe14('0x2f')][_0xbe14('0x4d')]({'where':{'id':_0x5b5c37[_0xbe14('0x4a')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x43b817,null))[_0xbe14('0x24')](function(_0x4a20c0){if(_0x4a20c0){return _0x4a20c0[_0xbe14('0x73')](_0x5b5c37[_0xbe14('0x51')][_0xbe14('0x74')],_[_0xbe14('0x75')](_0x5b5c37[_0xbe14('0x51')],[_0xbe14('0x74'),'id'])||{})[_0xbe14('0x76')](function(_0xd756b2){for(var _0x5d064e=0x0;_0x5d064e<_0x5b5c37[_0xbe14('0x51')][_0xbe14('0x74')][_0xbe14('0x4c')];_0x5d064e+=0x1){socket[_0xbe14('0x77')](_0xbe14('0x78'),{'UserId':_0x5b5c37[_0xbe14('0x51')]['ids'][_0x5d064e],'VoicePrefixId':_0x5b5c37[_0xbe14('0x4a')]['id']});}return _0xd756b2;});}})[_0xbe14('0x24')](respondWithResult(_0x43b817,null))[_0xbe14('0x49')](handleError(_0x43b817,null));};exports[_0xbe14('0x79')]=function(_0x508455,_0x7e9e5c,_0x1578b6){return db[_0xbe14('0x2f')][_0xbe14('0x4d')]({'where':{'id':_0x508455[_0xbe14('0x4a')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x7e9e5c,null))[_0xbe14('0x24')](function(_0x55e70f){if(_0x55e70f){return _0x55e70f[_0xbe14('0x79')](_0x508455['query'][_0xbe14('0x74')])['then'](function(){if(_[_0xbe14('0x7a')](_0x508455[_0xbe14('0x33')][_0xbe14('0x74')])){for(var _0x5b7f07=0x0;_0x5b7f07<_0x508455[_0xbe14('0x33')][_0xbe14('0x74')][_0xbe14('0x4c')];_0x5b7f07+=0x1){socket['emit'](_0xbe14('0x7b'),{'UserId':Number(_0x508455[_0xbe14('0x33')][_0xbe14('0x74')][_0x5b7f07]),'VoicePrefixId':Number(_0x508455[_0xbe14('0x4a')]['id'])});}}else{socket['emit'](_0xbe14('0x7b'),{'UserId':Number(_0x508455[_0xbe14('0x33')][_0xbe14('0x74')]),'VoicePrefixId':Number(_0x508455[_0xbe14('0x4a')]['id'])});}});}})[_0xbe14('0x24')](respondWithStatusCode(_0x7e9e5c,null))[_0xbe14('0x49')](handleError(_0x7e9e5c,null));};exports[_0xbe14('0x7c')]=function(_0x5ab298,_0x2ff94c,_0x123f4f){var _0x2137d5={};var _0x5c89a0={};var _0x704c05;var _0x420467;return db[_0xbe14('0x2f')]['findOne']({'where':{'id':_0x5ab298[_0xbe14('0x4a')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x2ff94c,null))['then'](function(_0x2be969){if(_0x2be969){_0x704c05=_0x2be969;_0x5c89a0['model']=_[_0xbe14('0x32')](db[_0xbe14('0x7d')]['rawAttributes']);_0x5c89a0['query']=_[_0xbe14('0x32')](_0x5ab298[_0xbe14('0x33')]);_0x5c89a0[_0xbe14('0x34')]=_['intersection'](_0x5c89a0[_0xbe14('0x31')],_0x5c89a0[_0xbe14('0x33')]);_0x2137d5[_0xbe14('0x36')]=_[_0xbe14('0x35')](_0x5c89a0['model'],qs['fields'](_0x5ab298[_0xbe14('0x33')][_0xbe14('0x4b')]));_0x2137d5[_0xbe14('0x36')]=_0x2137d5[_0xbe14('0x36')][_0xbe14('0x4c')]?_0x2137d5[_0xbe14('0x36')]:_0x5c89a0[_0xbe14('0x31')];_0x2137d5['order']=qs[_0xbe14('0x3a')](_0x5ab298['query'][_0xbe14('0x3a')]);_0x2137d5[_0xbe14('0x3b')]=qs[_0xbe14('0x34')](_[_0xbe14('0x3c')](_0x5ab298['query'],_0x5c89a0[_0xbe14('0x34')]));if(_0x5ab298[_0xbe14('0x33')][_0xbe14('0x43')]){_0x2137d5['where']=_[_0xbe14('0x3d')](_0x2137d5[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x3e')](_0x2137d5[_0xbe14('0x36')],function(_0x26d3ae){var _0x13836b={};_0x13836b[_0x26d3ae]={'$like':'%'+_0x5ab298[_0xbe14('0x33')][_0xbe14('0x43')]+'%'};return _0x13836b;})});}_0x2137d5=_[_0xbe14('0x3d')]({},_0x2137d5,_0x5ab298[_0xbe14('0x44')]);return _0x704c05[_0xbe14('0x7c')](_0x2137d5);}})[_0xbe14('0x24')](function(_0x5af56){if(_0x5af56){_0x420467=_0x5af56[_0xbe14('0x4c')];if(!_0x5ab298[_0xbe14('0x33')][_0xbe14('0x37')](_0xbe14('0x38'))){_0x2137d5[_0xbe14('0x1e')]=qs[_0xbe14('0x1e')](_0x5ab298[_0xbe14('0x33')]['limit']);_0x2137d5[_0xbe14('0x1d')]=qs['offset'](_0x5ab298[_0xbe14('0x33')][_0xbe14('0x1d')]);}return _0x704c05[_0xbe14('0x7c')](_0x2137d5);}})[_0xbe14('0x24')](function(_0x1d7b08){if(_0x1d7b08){return _0x1d7b08?{'count':_0x420467,'rows':_0x1d7b08}:null;}})['then'](respondWithResult(_0x2ff94c,null))['catch'](handleError(_0x2ff94c,null));}; \ No newline at end of file +var _0x55ca=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','describe','create','sequelize','transaction','body','VoiceExtension','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','reject','update','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name','send','index','VoicePrefix','model','keys','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55ca,0x126));var _0xa55c=function(_0x3bca2d,_0x1af8f4){_0x3bca2d=_0x3bca2d-0x0;var _0x144a7c=_0x55ca[_0x3bca2d];return _0x144a7c;};'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 hardwareService=require(_0xa55c('0x10'));var logger=require(_0xa55c('0x11'))(_0xa55c('0x12'));var utils=require(_0xa55c('0x13'));var config=require(_0xa55c('0x14'));var db=require(_0xa55c('0x15'))['db'];config[_0xa55c('0x16')]=_[_0xa55c('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa55c('0x18'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xcc;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x19')](_0x3930e4);}return _0x18ee85[_0xa55c('0x1a')](_0x3930e4)[_0xa55c('0x1b')]();};}function respondWithResult(_0x4e0b2f,_0x3ccf65){_0x3ccf65=_0x3ccf65||0xc8;return function(_0x3dcf4f){if(_0x3dcf4f){return _0x4e0b2f[_0xa55c('0x1a')](_0x3ccf65)[_0xa55c('0x1c')](_0x3dcf4f);}};}function respondWithFilteredResult(_0x1c4cfd,_0x3ae86b){return function(_0x51590e){if(_0x51590e){var _0x2d09d8=_0x51590e[_0xa55c('0x1d')],_0x24783b=_0x3ae86b[_0xa55c('0x1e')],_0x4cee3c=_0x3ae86b[_0xa55c('0x1e')]+_0x3ae86b[_0xa55c('0x1f')],_0x3d4c9e;if(_0x4cee3c>=_0x2d09d8){_0x4cee3c=_0x2d09d8;_0x3d4c9e=0xc8;}else{_0x3d4c9e=0xce;}_0x1c4cfd[_0xa55c('0x1a')](_0x3d4c9e);return _0x1c4cfd['set']('Content-Range',_0x24783b+'-'+_0x4cee3c+'/'+_0x2d09d8)[_0xa55c('0x1c')](_0x51590e);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x20')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x21')](_0x187a87)[_0xa55c('0x22')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x22')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x23')]({'plain':!![]});var _0x190757=_0xa55c('0x24');return db[_0xa55c('0x25')][_0xa55c('0x26')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x22')](function(){return _0x5ba836;});})[_0xa55c('0x22')](function(){_0x1fc828[_0xa55c('0x1a')](0xcc)[_0xa55c('0x1b')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x19')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x1a')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=db[_0xa55c('0x2b')]['rawAttributes'];_0x35c9c2[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_0x1cc53e);_0x35c9c2[_0xa55c('0x2e')]=_[_0xa55c('0x2d')](_0x52d37f[_0xa55c('0x2e')]);_0x35c9c2[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x35c9c2[_0xa55c('0x2c')],_0x35c9c2[_0xa55c('0x2e')]);_0x490b7d[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x35c9c2['model'],qs['fields'](_0x52d37f[_0xa55c('0x2e')][_0xa55c('0x32')]));_0x490b7d['attributes']=_0x490b7d[_0xa55c('0x31')][_0xa55c('0x33')]?_0x490b7d[_0xa55c('0x31')]:_0x35c9c2[_0xa55c('0x2c')];if(!_0x52d37f[_0xa55c('0x2e')][_0xa55c('0x34')](_0xa55c('0x35'))){_0x490b7d[_0xa55c('0x1f')]=qs[_0xa55c('0x1f')](_0x52d37f['query']['limit']);_0x490b7d['offset']=qs[_0xa55c('0x1e')](_0x52d37f[_0xa55c('0x2e')][_0xa55c('0x1e')]);}_0x490b7d['order']=qs[_0xa55c('0x36')](_0x52d37f['query'][_0xa55c('0x36')]);_0x490b7d['where']=qs[_0xa55c('0x2f')](_[_0xa55c('0x37')](_0x52d37f[_0xa55c('0x2e')],_0x35c9c2['filters']));if(_0x52d37f[_0xa55c('0x2e')][_0xa55c('0x38')]){_0x490b7d['where']=_[_0xa55c('0x39')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x3b')]['key']!==_0xa55c('0x3c')){var _0x284bcf={};_0x284bcf[_0x529ff8['field']]={'$like':'%'+_0x52d37f['query']['filter']+'%'};return _0x284bcf;}})});}_0x490b7d=_['merge']({},_0x490b7d,_0x52d37f[_0xa55c('0x3d')]);var _0x45bd15={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x2b')][_0xa55c('0x1d')](_0x45bd15)['then'](function(_0x3d52d8){_0x1d730b[_0xa55c('0x1d')]=_0x3d52d8;if(_0x52d37f[_0xa55c('0x2e')][_0xa55c('0x3e')]){_0x490b7d[_0xa55c('0x3f')]=[{'all':!![]}];}return db[_0xa55c('0x2b')]['findAll'](_0x490b7d);})[_0xa55c('0x22')](function(_0x5ee63d){_0x1d730b['rows']=_0x5ee63d;return _0x1d730b;})[_0xa55c('0x22')](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports['show']=function(_0x2bd98b,_0x508bd3){var _0x5f25f7={'raw':![],'where':{'id':_0x2bd98b[_0xa55c('0x41')]['id']}},_0x2f8449={};_0x2f8449[_0xa55c('0x2c')]=_['keys'](db[_0xa55c('0x2b')][_0xa55c('0x42')]);_0x2f8449['query']=_[_0xa55c('0x2d')](_0x2bd98b['query']);_0x2f8449[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x2f8449['model'],_0x2f8449[_0xa55c('0x2e')]);_0x5f25f7[_0xa55c('0x31')]=_['intersection'](_0x2f8449[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x2bd98b[_0xa55c('0x2e')]['fields']));_0x5f25f7[_0xa55c('0x31')]=_0x5f25f7['attributes'][_0xa55c('0x33')]?_0x5f25f7[_0xa55c('0x31')]:_0x2f8449[_0xa55c('0x2c')];if(_0x2bd98b['query'][_0xa55c('0x3e')]){_0x5f25f7[_0xa55c('0x3f')]=[{'all':!![]}];}_0x5f25f7=_['merge']({},_0x5f25f7,_0x2bd98b[_0xa55c('0x3d')]);return db[_0xa55c('0x2b')]['find'](_0x5f25f7)[_0xa55c('0x22')](handleEntityNotFound(_0x508bd3,null))[_0xa55c('0x22')](respondWithResult(_0x508bd3,null))['catch'](handleError(_0x508bd3,null));};exports[_0xa55c('0x26')]=function(_0x81cee8,_0x219a68){return db[_0xa55c('0x2b')]['find']({'where':{'id':_0x81cee8[_0xa55c('0x41')]['id']}})['then'](handleEntityNotFound(_0x219a68,null))[_0xa55c('0x22')](removeEntity(_0x219a68,null))[_0xa55c('0x40')](handleError(_0x219a68,null));};exports[_0xa55c('0x43')]=function(_0x4a7adc,_0x39bd3d){return db[_0xa55c('0x2b')]['describe']()[_0xa55c('0x22')](respondWithResult(_0x39bd3d,null))[_0xa55c('0x40')](handleError(_0x39bd3d,null));};exports[_0xa55c('0x44')]=function(_0xcd78c5,_0x36b7e9){var _0x1c84d9;return db[_0xa55c('0x45')][_0xa55c('0x46')](function(_0x3c147b){return db[_0xa55c('0x2b')]['create'](_0xcd78c5[_0xa55c('0x47')],{'transaction':_0x3c147b})[_0xa55c('0x22')](function(_0x216de8){_0x1c84d9=_0x216de8['get']({'plain':!![]});return db[_0xa55c('0x48')][_0xa55c('0x49')]({'where':{'id':_0x1c84d9['VoiceExtensionId']},'raw':!![]})[_0xa55c('0x22')](function(_0x4fa412){return createVoicePrefixExtensions(_0x1c84d9,_0x4fa412,_0x3c147b);});});})[_0xa55c('0x22')](function(){var _0x228df4=_0xcd78c5[_0xa55c('0x4a')][_0xa55c('0x23')]({'plain':!![]});if(!_0x228df4)throw new Error(_0xa55c('0x4b'));if(_0x228df4['role']===_0xa55c('0x4a')){var _0x4607ca=_0x1c84d9;return db['UserProfileSection'][_0xa55c('0x49')]({'where':{'name':_0xa55c('0x24'),'userProfileId':_0x228df4[_0xa55c('0x4c')]},'raw':!![]})[_0xa55c('0x22')](function(_0x50176b){if(_0x50176b&&_0x50176b['autoAssociation']===0x0){return db[_0xa55c('0x25')][_0xa55c('0x44')]({'name':_0x4607ca[_0xa55c('0x28')],'resourceId':_0x4607ca['id'],'type':_0x50176b[_0xa55c('0x28')],'sectionId':_0x50176b['id']},{})['then'](function(){return _0x1c84d9;});}else{return _0x1c84d9;}})[_0xa55c('0x40')](function(_0x5ce463){logger[_0xa55c('0x4d')](_0xa55c('0x4e'),_0x5ce463);throw _0x5ce463;});}return _0x1c84d9;})[_0xa55c('0x22')](respondWithResult(_0x36b7e9,null))[_0xa55c('0x40')](handleError(_0x36b7e9,null));};function Extension(_0xec640,_0x53b2f7,_0x1cb73b,_0x54f776){this[_0xa55c('0x4f')]=_0xa55c('0x50');this[_0xa55c('0x51')]=_0xec640;this[_0xa55c('0x52')]=_0x1cb73b;this[_0xa55c('0x3b')]=_0xa55c('0x53');this[_0xa55c('0x54')]='Voice\x20Prefix\x20Extension';this[_0xa55c('0x55')]=_0x53b2f7;this[_0xa55c('0x56')]=_0x54f776;}function createVoicePrefixExtensions(_0x2f2d21,_0x23a30e,_0x3fa00f){return new BPromise(function(_0x5ba2b0,_0xa72718){var _0x3cd40d=new Extension(formatPrefixName(_0x2f2d21[_0xa55c('0x57')]),0x1,_0xa55c('0x58'),_0xa55c('0x59'));_0x3cd40d['VoicePrefixId']=_0x2f2d21['id'];return db[_0xa55c('0x48')][_0xa55c('0x44')](_0x3cd40d,{'transaction':_0x3fa00f})[_0xa55c('0x22')](function(_0x16d9b2){var _0x3ba56d=_0x16d9b2['get']({'plain':!![]});var _0x419fc3=_['map'](addVoicePrefixExtensions(_0x2f2d21,_0x23a30e),function(_0x2e482a){_0x2e482a['VoiceExtensionId']=_0x3ba56d['id'];_0x2e482a[_0xa55c('0x5a')]=_0x2f2d21['id'];return _0x2e482a;});return db['VoiceExtension'][_0xa55c('0x5b')](_0x419fc3,{'transaction':_0x3fa00f})[_0xa55c('0x22')](function(_0x21d6b4){if(!_0x21d6b4){return _0xa72718(_0xa55c('0x5c'));}else{return _0x5ba2b0(_0x21d6b4);}})[_0xa55c('0x40')](function(_0x3a5a52){return _0xa72718(_0x3a5a52);});});;});};function addVoicePrefixExtensions(_0xafaf8c,_0x2f2226){var _0x14b515=[];var _0x1acf50=formatPrefixName(_0xafaf8c['prefix']);_0x14b515[_0xa55c('0x5d')](new Extension(_0x1acf50,0x2,_0xa55c('0x5e'),'CDR(prefix)='+_0xafaf8c[_0xa55c('0x28')]));if(_0xafaf8c[_0xa55c('0x5f')]){_0x14b515[_0xa55c('0x5d')](new Extension(_0x1acf50,0x3,_0xa55c('0x5e'),_0xa55c('0x60')+_0xafaf8c[_0xa55c('0x5f')]));}else{_0x14b515[_0xa55c('0x5d')](new Extension(_0x1acf50,0x3,_0xa55c('0x58'),'No\x20callerid\x20available'));}_0x14b515[_0xa55c('0x5d')](new Extension(_0x1acf50,0x4,_0xa55c('0x61'),_0x2f2226[_0xa55c('0x4f')]+','+_0xa55c('0x62')+(0x8+_0xafaf8c[_0xa55c('0x28')][_0xa55c('0x33')])+'}'+','+0x1));return _0x14b515;}function formatPrefixName(_0x2f1237){var _0x4249c1='_';for(var _0x25d5a1=0x0;_0x25d5a1<_0x2f1237['length'];_0x25d5a1++){if(_0x2f1237[_0xa55c('0x63')](_0x25d5a1)=='-'){_0x4249c1+=_0x2f1237[_0xa55c('0x63')](_0x25d5a1);}else{_0x4249c1+='['+_0x2f1237[_0xa55c('0x63')](_0x25d5a1)+']';}}_0x4249c1+='.';return _0x4249c1;}exports[_0xa55c('0x21')]=function(_0x3a269d,_0x10e711,_0x3ea755){var _0x3606b2=_0x3a269d[_0xa55c('0x47')];_0x3606b2[_0xa55c('0x57')]=_0xa55c('0x64')+_0x3606b2['name']+'-';return db[_0xa55c('0x45')]['transaction'](function(_0x1228a4){return db[_0xa55c('0x2b')][_0xa55c('0x21')](_0x3606b2,{'where':{'id':_0x3606b2['id']},'transaction':_0x1228a4})['then'](function(){return db['VoiceExtension'][_0xa55c('0x26')]({'where':{'VoicePrefixId':_0x3606b2['id']},'transaction':_0x1228a4})[_0xa55c('0x22')](function(){return db[_0xa55c('0x48')][_0xa55c('0x49')]({'where':{'id':_0x3606b2['VoiceExtensionId']},'raw':!![]})[_0xa55c('0x22')](function(_0xd02251){return createVoicePrefixExtensions(_0x3606b2,_0xd02251,_0x1228a4);});});});})[_0xa55c('0x22')](function(){return db[_0xa55c('0x2b')][_0xa55c('0x65')](_0x3606b2['id']);})['then'](respondWithResult(_0x10e711,null))['catch'](handleError(_0x10e711,null));};exports[_0xa55c('0x66')]=function(_0x38689e,_0x3f9d0a,_0x36ee32){return db[_0xa55c('0x2b')]['find']({'where':{'id':_0x38689e[_0xa55c('0x41')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x3f9d0a,null))['then'](function(_0x2ce255){if(_0x2ce255){return _0x2ce255[_0xa55c('0x66')](_0x38689e[_0xa55c('0x47')]['ids'],_[_0xa55c('0x67')](_0x38689e[_0xa55c('0x47')],[_0xa55c('0x68'),'id'])||{})[_0xa55c('0x69')](function(_0x232143){for(var _0x506f74=0x0;_0x506f74<_0x38689e[_0xa55c('0x47')][_0xa55c('0x68')]['length'];_0x506f74+=0x1){socket['emit'](_0xa55c('0x6a'),{'UserId':_0x38689e['body'][_0xa55c('0x68')][_0x506f74],'VoicePrefixId':_0x38689e[_0xa55c('0x41')]['id']});}return _0x232143;});}})[_0xa55c('0x22')](respondWithResult(_0x3f9d0a,null))[_0xa55c('0x40')](handleError(_0x3f9d0a,null));};exports[_0xa55c('0x6b')]=function(_0x3f1132,_0x22b06f,_0xff7b1c){return db[_0xa55c('0x2b')]['find']({'where':{'id':_0x3f1132[_0xa55c('0x41')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x22b06f,null))[_0xa55c('0x22')](function(_0x20ddd0){if(_0x20ddd0){return _0x20ddd0['removeAgents'](_0x3f1132[_0xa55c('0x2e')][_0xa55c('0x68')])[_0xa55c('0x22')](function(){if(_[_0xa55c('0x6c')](_0x3f1132['query']['ids'])){for(var _0x367470=0x0;_0x367470<_0x3f1132[_0xa55c('0x2e')][_0xa55c('0x68')][_0xa55c('0x33')];_0x367470+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3f1132[_0xa55c('0x2e')][_0xa55c('0x68')][_0x367470]),'VoicePrefixId':Number(_0x3f1132[_0xa55c('0x41')]['id'])});}}else{socket[_0xa55c('0x6d')](_0xa55c('0x6e'),{'UserId':Number(_0x3f1132[_0xa55c('0x2e')][_0xa55c('0x68')]),'VoicePrefixId':Number(_0x3f1132['params']['id'])});}});}})[_0xa55c('0x22')](respondWithStatusCode(_0x22b06f,null))['catch'](handleError(_0x22b06f,null));};exports[_0xa55c('0x6f')]=function(_0x4845c3,_0x36ded7,_0x313cdc){var _0x441c11={};var _0xcc187f={};var _0xe3444f;var _0x402f02;return db[_0xa55c('0x2b')][_0xa55c('0x70')]({'where':{'id':_0x4845c3['params']['id']}})['then'](handleEntityNotFound(_0x36ded7,null))[_0xa55c('0x22')](function(_0x2948b1){if(_0x2948b1){_0xe3444f=_0x2948b1;_0xcc187f[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](db[_0xa55c('0x71')][_0xa55c('0x42')]);_0xcc187f['query']=_[_0xa55c('0x2d')](_0x4845c3[_0xa55c('0x2e')]);_0xcc187f[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0xcc187f[_0xa55c('0x2c')],_0xcc187f[_0xa55c('0x2e')]);_0x441c11[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0xcc187f['model'],qs[_0xa55c('0x32')](_0x4845c3[_0xa55c('0x2e')][_0xa55c('0x32')]));_0x441c11[_0xa55c('0x31')]=_0x441c11[_0xa55c('0x31')]['length']?_0x441c11[_0xa55c('0x31')]:_0xcc187f[_0xa55c('0x2c')];_0x441c11['order']=qs['sort'](_0x4845c3[_0xa55c('0x2e')][_0xa55c('0x36')]);_0x441c11['where']=qs['filters'](_['pick'](_0x4845c3['query'],_0xcc187f[_0xa55c('0x2f')]));if(_0x4845c3[_0xa55c('0x2e')][_0xa55c('0x38')]){_0x441c11[_0xa55c('0x3a')]=_[_0xa55c('0x39')](_0x441c11[_0xa55c('0x3a')],{'$or':_['map'](_0x441c11[_0xa55c('0x31')],function(_0x3b6abe){var _0x2c89b1={};_0x2c89b1[_0x3b6abe]={'$like':'%'+_0x4845c3[_0xa55c('0x2e')]['filter']+'%'};return _0x2c89b1;})});}_0x441c11=_[_0xa55c('0x39')]({},_0x441c11,_0x4845c3[_0xa55c('0x3d')]);return _0xe3444f[_0xa55c('0x6f')](_0x441c11);}})['then'](function(_0x3459fd){if(_0x3459fd){_0x402f02=_0x3459fd['length'];if(!_0x4845c3['query'][_0xa55c('0x34')](_0xa55c('0x35'))){_0x441c11[_0xa55c('0x1f')]=qs[_0xa55c('0x1f')](_0x4845c3[_0xa55c('0x2e')][_0xa55c('0x1f')]);_0x441c11[_0xa55c('0x1e')]=qs['offset'](_0x4845c3['query'][_0xa55c('0x1e')]);}return _0xe3444f[_0xa55c('0x6f')](_0x441c11);}})[_0xa55c('0x22')](function(_0x1f4bc8){if(_0x1f4bc8){return _0x1f4bc8?{'count':_0x402f02,'rows':_0x1f4bc8}:null;}})[_0xa55c('0x22')](respondWithResult(_0x36ded7,null))[_0xa55c('0x40')](handleError(_0x36ded7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e390ec8..a45dbed 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 _0xb10b=['hasOwnProperty','hook','events','VoicePrefix','setMaxListeners','save','remove','emit'];(function(_0x42f343,_0x47c172){var _0xd85cd0=function(_0x53857b){while(--_0x53857b){_0x42f343['push'](_0x42f343['shift']());}};_0xd85cd0(++_0x47c172);}(_0xb10b,0x12a));var _0xbb10=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0xb10b[_0x42e495];return _0x595da1;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xbb10('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){VoicePrefixEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);VoicePrefixEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];VoicePrefix[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8422aa6..28d1a80 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 _0xa598=['bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x4952b2,_0x1fda67){var _0x512aef=function(_0x5e9677){while(--_0x5e9677){_0x4952b2['push'](_0x4952b2['shift']());}};_0x512aef(++_0x1fda67);}(_0xa598,0x124));var _0x8a59=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa598[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x8a59('0x0'));var util=require(_0x8a59('0x1'));var logger=require(_0x8a59('0x2'))(_0x8a59('0x3'));var moment=require(_0x8a59('0x4'));var BPromise=require(_0x8a59('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a59('0x6'));var rimraf=require(_0x8a59('0x7'));var config=require(_0x8a59('0x8'));var attributes=require(_0x8a59('0x9'));module['exports']=function(_0x4a629c,_0x5176df){return _0x4a629c[_0x8a59('0xa')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf012=['define','VoicePrefix','voice_prefixes','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x51302c,_0x376113){var _0x20f6c1=function(_0x530cb3){while(--_0x530cb3){_0x51302c['push'](_0x51302c['shift']());}};_0x20f6c1(++_0x376113);}(_0xf012,0x87));var _0x2f01=function(_0x49cf57,_0x428742){_0x49cf57=_0x49cf57-0x0;var _0x15eca3=_0xf012[_0x49cf57];return _0x15eca3;};'use strict';var _=require(_0x2f01('0x0'));var util=require('util');var logger=require(_0x2f01('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2f01('0x2'));var rp=require(_0x2f01('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f01('0x4'));var config=require(_0x2f01('0x5'));var attributes=require(_0x2f01('0x6'));module[_0x2f01('0x7')]=function(_0x119943,_0x2ca58e){return _0x119943[_0x2f01('0x8')](_0x2f01('0x9'),attributes,{'tableName':_0x2f01('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 3ed1795..1777b38 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 _0x87a4=['localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis'];(function(_0x232bb0,_0x397cd4){var _0x3191db=function(_0x212552){while(--_0x212552){_0x232bb0['push'](_0x232bb0['shift']());}};_0x3191db(++_0x397cd4);}(_0x87a4,0x121));var _0x487a=function(_0x14f291,_0x20a0e5){_0x14f291=_0x14f291-0x0;var _0x33f66b=_0x87a4[_0x14f291];return _0x33f66b;};'use strict';var _=require(_0x487a('0x0'));var util=require(_0x487a('0x1'));var moment=require('moment');var BPromise=require(_0x487a('0x2'));var rs=require(_0x487a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x487a('0x4'))['db'];var utils=require(_0x487a('0x5'));var logger=require(_0x487a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x487a('0x7'));var client=jayson[_0x487a('0x8')]['http']({'port':0x232a});config[_0x487a('0x9')]=_['defaults'](config[_0x487a('0x9')],{'host':_0x487a('0xa'),'port':0x18eb});var socket=require(_0x487a('0xb'))(new Redis(config[_0x487a('0x9')]));require(_0x487a('0xc'))[_0x487a('0xd')](socket);function respondWithRpcPromise(_0x3b77e3,_0x3eea13,_0x18cc68){return new BPromise(function(_0x24b356,_0x34a9b7){return client['request'](_0x3b77e3,_0x18cc68)[_0x487a('0xe')](function(_0x1cebbd){logger[_0x487a('0xf')](_0x487a('0x10'),_0x3eea13,_0x487a('0x11'));logger[_0x487a('0x12')](_0x487a('0x13'),_0x3eea13,'request\x20sent',JSON['stringify'](_0x1cebbd));if(_0x1cebbd[_0x487a('0x14')]){if(_0x1cebbd[_0x487a('0x14')]['code']===0x1f4){logger[_0x487a('0x14')](_0x487a('0x10'),_0x3eea13,_0x1cebbd[_0x487a('0x14')]['message']);return _0x34a9b7(_0x1cebbd['error']['message']);}logger[_0x487a('0x14')](_0x487a('0x10'),_0x3eea13,_0x1cebbd[_0x487a('0x14')][_0x487a('0x15')]);return _0x24b356(_0x1cebbd[_0x487a('0x14')][_0x487a('0x15')]);}else{logger[_0x487a('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x3eea13,_0x487a('0x11'));_0x24b356(_0x1cebbd['result'][_0x487a('0x15')]);}})[_0x487a('0x16')](function(_0x5911de){logger[_0x487a('0x14')](_0x487a('0x10'),_0x3eea13,_0x5911de);_0x34a9b7(_0x5911de);});});} \ No newline at end of file +var _0xfa2f=['jayson/promise','client','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xfa2f,0xb9));var _0xffa2=function(_0x17080b,_0x446d6f){_0x17080b=_0x17080b-0x0;var _0x437215=_0xfa2f[_0x17080b];return _0x437215;};'use strict';var _=require(_0xffa2('0x0'));var util=require(_0xffa2('0x1'));var moment=require(_0xffa2('0x2'));var BPromise=require(_0xffa2('0x3'));var rs=require(_0xffa2('0x4'));var fs=require('fs');var Redis=require(_0xffa2('0x5'));var db=require(_0xffa2('0x6'))['db'];var utils=require(_0xffa2('0x7'));var logger=require(_0xffa2('0x8'))(_0xffa2('0x9'));var config=require(_0xffa2('0xa'));var jayson=require(_0xffa2('0xb'));var client=jayson[_0xffa2('0xc')]['http']({'port':0x232a});config[_0xffa2('0xd')]=_['defaults'](config[_0xffa2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xffa2('0xe'))(new Redis(config[_0xffa2('0xd')]));require(_0xffa2('0xf'))[_0xffa2('0x10')](socket);function respondWithRpcPromise(_0x3455a4,_0x56cff5,_0x528e26){return new BPromise(function(_0xc7ffec,_0x2e5e82){return client[_0xffa2('0x11')](_0x3455a4,_0x528e26)[_0xffa2('0x12')](function(_0x111be6){logger[_0xffa2('0x13')](_0xffa2('0x14'),_0x56cff5,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x56cff5,_0xffa2('0x15'),JSON[_0xffa2('0x16')](_0x111be6));if(_0x111be6[_0xffa2('0x17')]){if(_0x111be6[_0xffa2('0x17')][_0xffa2('0x18')]===0x1f4){logger[_0xffa2('0x17')](_0xffa2('0x14'),_0x56cff5,_0x111be6[_0xffa2('0x17')][_0xffa2('0x19')]);return _0x2e5e82(_0x111be6[_0xffa2('0x17')]['message']);}logger[_0xffa2('0x17')](_0xffa2('0x14'),_0x56cff5,_0x111be6['error'][_0xffa2('0x19')]);return _0xc7ffec(_0x111be6[_0xffa2('0x17')][_0xffa2('0x19')]);}else{logger['info'](_0xffa2('0x14'),_0x56cff5,_0xffa2('0x15'));_0xc7ffec(_0x111be6[_0xffa2('0x1a')][_0xffa2('0x19')]);}})[_0xffa2('0x1b')](function(_0x8d8135){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x56cff5,_0x8d8135);_0x2e5e82(_0x8d8135);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index ee091ce..1108d40 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 _0x13a8=['update','emit','removeListener','register','length','voicePrefix:','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x13a8,0x86));var _0x813a=function(_0x3fd0b6,_0x216f79){_0x3fd0b6=_0x3fd0b6-0x0;var _0x445dcd=_0x13a8[_0x3fd0b6];return _0x445dcd;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x813a('0x0'),_0x813a('0x1'),_0x813a('0x2')];function createListener(_0xa0a055,_0x432a8a){return function(_0x1f3c6b){_0x432a8a[_0x813a('0x3')](_0xa0a055,_0x1f3c6b);};}function removeListener(_0x59655a,_0x28d8ff){return function(){VoicePrefixEvents[_0x813a('0x4')](_0x59655a,_0x28d8ff);};}exports[_0x813a('0x5')]=function(_0x361ad6){for(var _0x4feb35=0x0,_0x3b8002=events[_0x813a('0x6')];_0x4feb35<_0x3b8002;_0x4feb35++){var _0x2f85a0=events[_0x4feb35];var _0x15e62b=createListener(_0x813a('0x7')+_0x2f85a0,_0x361ad6);VoicePrefixEvents['on'](_0x2f85a0,_0x15e62b);}}; \ No newline at end of file +var _0xb199=['length','voicePrefix:','./voicePrefix.events','remove','emit','removeListener'];(function(_0x819fdf,_0xe970fe){var _0x550044=function(_0x2ed7ad){while(--_0x2ed7ad){_0x819fdf['push'](_0x819fdf['shift']());}};_0x550044(++_0xe970fe);}(_0xb199,0x140));var _0x9b19=function(_0x5641f1,_0x4d5e14){_0x5641f1=_0x5641f1-0x0;var _0x55b5eb=_0xb199[_0x5641f1];return _0x55b5eb;};'use strict';var VoicePrefixEvents=require(_0x9b19('0x0'));var events=['save',_0x9b19('0x1'),'update'];function createListener(_0x11ab55,_0x5ae7fe){return function(_0x499fad){_0x5ae7fe[_0x9b19('0x2')](_0x11ab55,_0x499fad);};}function removeListener(_0x58f28f,_0x10f2f2){return function(){VoicePrefixEvents[_0x9b19('0x3')](_0x58f28f,_0x10f2f2);};}exports['register']=function(_0x2336f5){for(var _0x4364f2=0x0,_0xee69ff=events[_0x9b19('0x4')];_0x4364f2<_0xee69ff;_0x4364f2++){var _0x3ac3ff=events[_0x4364f2];var _0x24801f=createListener(_0x9b19('0x5')+_0x3ac3ff,_0x2336f5);VoicePrefixEvents['on'](_0x3ac3ff,_0x24801f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6886eda..b40b879 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 _0x3e49=['addTeams','addAgents','/:id/blacklists','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/auth/service','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone'];(function(_0x2a0d33,_0x1fc7a7){var _0x4be3ef=function(_0x22e95f){while(--_0x22e95f){_0x2a0d33['push'](_0x2a0d33['shift']());}};_0x4be3ef(++_0x1fc7a7);}(_0x3e49,0xfb));var _0x93e4=function(_0x1fb337,_0x474393){_0x1fb337=_0x1fb337-0x0;var _0x933003=_0x3e49[_0x1fb337];return _0x933003;};'use strict';var multer=require(_0x93e4('0x0'));var util=require(_0x93e4('0x1'));var path=require(_0x93e4('0x2'));var timeout=require(_0x93e4('0x3'));var express=require('express');var router=express[_0x93e4('0x4')]();var auth=require(_0x93e4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router['get']('/',auth[_0x93e4('0x6')](),controller[_0x93e4('0x7')]);router['get'](_0x93e4('0x8'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x9')]);router[_0x93e4('0xa')](_0x93e4('0xb'),auth[_0x93e4('0x6')](),controller[_0x93e4('0xc')]);router['get'](_0x93e4('0xd'),auth['isAuthenticated'](),controller[_0x93e4('0xe')]);router[_0x93e4('0xa')](_0x93e4('0xf'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x10')]);router['get'](_0x93e4('0x11'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x12')]);router['get'](_0x93e4('0x13'),auth[_0x93e4('0x6')](),controller['getTeams']);router[_0x93e4('0xa')](_0x93e4('0x14'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x15')]);router['get'](_0x93e4('0x16'),auth['isAuthenticated'](),controller['getMembers']);router[_0x93e4('0xa')](_0x93e4('0x17'),auth['isAuthenticated'](),controller[_0x93e4('0x18')]);router[_0x93e4('0xa')]('/:id/blacklists',auth[_0x93e4('0x6')](),controller[_0x93e4('0x19')]);router['post']('/',auth[_0x93e4('0x6')](),controller['create']);router[_0x93e4('0x1a')](_0x93e4('0x1b'),auth['isAuthenticated'](),controller[_0x93e4('0x1c')]);router[_0x93e4('0x1a')](_0x93e4('0x13'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x1d')]);router[_0x93e4('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0x93e4('0x1e')]);router[_0x93e4('0x1a')](_0x93e4('0x17'),auth['isAuthenticated'](),controller['addLists']);router[_0x93e4('0x1a')](_0x93e4('0x1f'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x20')]);router[_0x93e4('0x21')](_0x93e4('0x8'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x22')]);router[_0x93e4('0x23')](_0x93e4('0x8'),auth[_0x93e4('0x6')](),controller['destroy']);router[_0x93e4('0x23')](_0x93e4('0x13'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x24')]);router[_0x93e4('0x23')](_0x93e4('0x14'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x25')]);router[_0x93e4('0x23')]('/:id/lists',auth[_0x93e4('0x6')](),controller[_0x93e4('0x26')]);router['delete'](_0x93e4('0x1f'),auth[_0x93e4('0x6')](),controller[_0x93e4('0x27')]);module['exports']=router; \ No newline at end of file +var _0x98c3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeBlackLists','exports','multer','util','path','connect-timeout','express'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x98c3,0xab));var _0x398c=function(_0x3d4c5a,_0x5139f8){_0x3d4c5a=_0x3d4c5a-0x0;var _0x38f8c3=_0x98c3[_0x3d4c5a];return _0x38f8c3;};'use strict';var multer=require(_0x398c('0x0'));var util=require(_0x398c('0x1'));var path=require(_0x398c('0x2'));var timeout=require(_0x398c('0x3'));var express=require(_0x398c('0x4'));var router=express[_0x398c('0x5')]();var auth=require(_0x398c('0x6'));var interaction=require(_0x398c('0x7'));var config=require(_0x398c('0x8'));var controller=require(_0x398c('0x9'));router[_0x398c('0xa')]('/',auth['isAuthenticated'](),controller[_0x398c('0xb')]);router['get'](_0x398c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x398c('0xa')](_0x398c('0xd'),auth[_0x398c('0xe')](),controller['getHoppers']);router[_0x398c('0xa')](_0x398c('0xf'),auth[_0x398c('0xe')](),controller[_0x398c('0x10')]);router[_0x398c('0xa')](_0x398c('0x11'),auth[_0x398c('0xe')](),controller[_0x398c('0x12')]);router['get'](_0x398c('0x13'),auth[_0x398c('0xe')](),controller[_0x398c('0x14')]);router['get'](_0x398c('0x15'),auth[_0x398c('0xe')](),controller[_0x398c('0x16')]);router[_0x398c('0xa')]('/:id/users',auth[_0x398c('0xe')](),controller[_0x398c('0x17')]);router[_0x398c('0xa')](_0x398c('0x18'),auth[_0x398c('0xe')](),controller['getMembers']);router[_0x398c('0xa')](_0x398c('0x19'),auth['isAuthenticated'](),controller[_0x398c('0x1a')]);router[_0x398c('0xa')](_0x398c('0x1b'),auth[_0x398c('0xe')](),controller[_0x398c('0x1c')]);router[_0x398c('0x1d')]('/',auth['isAuthenticated'](),controller[_0x398c('0x1e')]);router[_0x398c('0x1d')]('/:id/clone',auth[_0x398c('0xe')](),controller[_0x398c('0x1f')]);router[_0x398c('0x1d')](_0x398c('0x15'),auth[_0x398c('0xe')](),controller[_0x398c('0x20')]);router[_0x398c('0x1d')](_0x398c('0x21'),auth['isAuthenticated'](),controller[_0x398c('0x22')]);router['post'](_0x398c('0x19'),auth[_0x398c('0xe')](),controller[_0x398c('0x23')]);router[_0x398c('0x1d')](_0x398c('0x1b'),auth[_0x398c('0xe')](),controller[_0x398c('0x24')]);router[_0x398c('0x25')](_0x398c('0xc'),auth[_0x398c('0xe')](),controller[_0x398c('0x26')]);router[_0x398c('0x27')]('/:id',auth[_0x398c('0xe')](),controller[_0x398c('0x28')]);router[_0x398c('0x27')](_0x398c('0x15'),auth['isAuthenticated'](),controller[_0x398c('0x29')]);router[_0x398c('0x27')](_0x398c('0x21'),auth[_0x398c('0xe')](),controller['removeAgents']);router[_0x398c('0x27')](_0x398c('0x19'),auth['isAuthenticated'](),controller['removeLists']);router[_0x398c('0x27')]('/:id/blacklists',auth[_0x398c('0xe')](),controller[_0x398c('0x2a')]);module[_0x398c('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d8028f0..b6ddc16 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 _0x0a79=['joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join'];(function(_0x339c20,_0x2a5423){var _0x24e86f=function(_0x3a7bfc){while(--_0x3a7bfc){_0x339c20['push'](_0x339c20['shift']());}};_0x24e86f(++_0x2a5423);}(_0x0a79,0x159));var _0x90a7=function(_0x2d60fa,_0x3811e7){_0x2d60fa=_0x2d60fa-0x0;var _0x5d4429=_0x0a79[_0x2d60fa];return _0x5d4429;};'use strict';var Sequelize=require(_0x90a7('0x0'));module[_0x90a7('0x1')]={'name':{'type':Sequelize[_0x90a7('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x90a7('0x3'),_0x90a7('0x4')),'allowNull':![],'defaultValue':_0x90a7('0x3')},'musiconhold':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':_0x90a7('0x5')},'announce':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x90a7('0x6')]('rr',_0x90a7('0x7'),_0x90a7('0x8'),_0x90a7('0x9'),_0x90a7('0xa'),_0x90a7('0xb'),'linear',_0x90a7('0xc'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x2982f5){this[_0x90a7('0xd')](_0x90a7('0xe'),_0x2982f5?_0x2982f5:_0x90a7('0xb'));},'get':function(){var _0x101caf=this[_0x90a7('0xf')](_0x90a7('0x10'));var _0x266caa=this[_0x90a7('0xf')](_0x90a7('0x11'));var _0x1dd14b=this[_0x90a7('0xf')](_0x90a7('0xe'));if(_0x101caf===_0x90a7('0x3')){return _0x1dd14b;}if(_0x266caa===_0x90a7('0x12')&&_0x1dd14b===_0x90a7('0xb')||_0x266caa===_0x90a7('0x12')&&_0x1dd14b===_0x90a7('0x13')){return _0x1dd14b;}if(_0x266caa===_0x90a7('0x14')||_0x266caa===_0x90a7('0x15')||_0x266caa===_0x90a7('0x16')){return _0x1dd14b;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x90a7('0x17')](0xb)},'timeout':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x90a7('0x2')]},'weight':{'type':Sequelize[_0x90a7('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':_0x90a7('0x18')},'autopause':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no',_0x90a7('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x90a7('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x90a7('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x90a7('0x6')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x90a7('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x90a7('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x90a7('0x6')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x90a7('0x6')]('yes','no',_0x90a7('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x90a7('0x6')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x90a7('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x90a7('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x90a7('0x2')]},'queue_quantity1':{'type':Sequelize[_0x90a7('0x2')]},'queue_quantity2':{'type':Sequelize[_0x90a7('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x90a7('0x2')]},'periodic_announce':{'type':Sequelize[_0x90a7('0x1b')],'set':function(_0x2c4a85){this[_0x90a7('0xd')](_0x90a7('0x1c'),_0x2c4a85?_0x2c4a85[_0x90a7('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0x90a7('0x1c'))?this[_0x90a7('0xf')](_0x90a7('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':_0x90a7('0x18'),'set':function(_0x30da10){this[_0x90a7('0xd')](_0x90a7('0x1e'),_0x30da10?_0x30da10[_0x90a7('0x1d')](','):[]);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0x90a7('0x1e'))[_0x90a7('0x1f')](','):[];}},'leavewhenempty':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':'no','set':function(_0x4c2c47){this[_0x90a7('0xd')](_0x90a7('0x20'),_0x4c2c47?_0x4c2c47['join'](','):[]);},'get':function(){return this[_0x90a7('0xf')](_0x90a7('0x20'))?this[_0x90a7('0xf')]('leavewhenempty')[_0x90a7('0x1f')](','):[];}},'reportholdtime':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x90a7('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x90a7('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':0x0,'set':function(_0x58de78){this['setDataValue'](_0x90a7('0x22'),_0x58de78);if(_0x58de78){if(this[_0x90a7('0xf')](_0x90a7('0x23'))<0x2){this[_0x90a7('0xd')](_0x90a7('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x90a7('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':0x0,'comment':_0x90a7('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0x90a7('0x25'),'progressive',_0x90a7('0x16'),_0x90a7('0x15'),_0x90a7('0x12')),'defaultValue':_0x90a7('0x14'),'comment':_0x90a7('0x26')},'dialLimitChannel':{'type':Sequelize[_0x90a7('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x90a7('0x17')](0x4)[_0x90a7('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x90a7('0x28')},'dialPowerLevel':{'type':Sequelize[_0x90a7('0x29')](0x2)[_0x90a7('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x2a'),_0x90a7('0x2b')),'defaultValue':'dropRate','comment':_0x90a7('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x90a7('0x29')](0x2)[_0x90a7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x90a7('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x90a7('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x90a7('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x90a7('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x90a7('0x17')](0x3)[_0x90a7('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90a7('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x90a7('0x2')],'defaultValue':_0x90a7('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x90a7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x90a7('0x2')],'comment':_0x90a7('0x31')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x90a7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90a7('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x90a7('0x17')](0x5)[_0x90a7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90a7('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x90a7('0x17')](0x3)[_0x90a7('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90a7('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x90a7('0x17')](0x5)[_0x90a7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90a7('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x90a7('0x17')](0x3)[_0x90a7('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x90a7('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90a7('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x90a7('0x17')](0x3)[_0x90a7('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x90a7('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x90a7('0x38')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x90a7('0x6')](_0x90a7('0x39'),_0x90a7('0x3a'),_0x90a7('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x90a7('0x17')](0x9)[_0x90a7('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x90a7('0x17')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x90a7('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x90a7('0x17')](0x9)[_0x90a7('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x90a7('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x90a7('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x90a7('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x90a7('0x17')](0x9)[_0x90a7('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x90a7('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x90a7('0x17')](0x9)[_0x90a7('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x90a7('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x90a7('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x90a7('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x90a7('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x90a7('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':0x0,'comment':_0x90a7('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x90a7('0x6')]('DESC',_0x90a7('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x90a7('0x2')],'comment':_0x90a7('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x90a7('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x90a7('0x45')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x90a7('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x90a7('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x90a7('0x17')],'allowNull':!![],'comment':_0x90a7('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x90a7('0x21')],'defaultValue':![],'comment':_0x90a7('0x48'),'set':function(_0x2d9b15){if(!_0x2d9b15)this[_0x90a7('0xd')](_0x90a7('0x49'),null);this[_0x90a7('0xd')](_0x90a7('0x4a'),_0x2d9b15);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x90a7('0x17')](0x3)[_0x90a7('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xc8b8=['Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','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\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#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)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','ENUM','inbound','default','leastrecent','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','roundrobin','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','booked','progressive'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc8b8,0x1db));var _0x8c8b=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0xc8b8[_0x9b3efc];return _0x200f05;};'use strict';var Sequelize=require(_0x8c8b('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c8b('0x1')],'allowNull':![],'unique':_0x8c8b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x8c8b('0x4')},'musiconhold':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':_0x8c8b('0x5')},'announce':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x8c8b('0x6'),'fewestcalls','random',_0x8c8b('0x7'),_0x8c8b('0x8'),_0x8c8b('0x9'),_0x8c8b('0xa')),'allowNull':![],'defaultValue':_0x8c8b('0xb'),'set':function(_0x1c2632){this[_0x8c8b('0xc')](_0x8c8b('0xd'),_0x1c2632?_0x1c2632:_0x8c8b('0x7'));},'get':function(){var _0xa12a9a=this[_0x8c8b('0xe')](_0x8c8b('0xf'));var _0x1a34a3=this['getDataValue'](_0x8c8b('0x10'));var _0x11b002=this[_0x8c8b('0xe')](_0x8c8b('0xd'));if(_0xa12a9a===_0x8c8b('0x4')){return _0x11b002;}if(_0x1a34a3==='booked'&&_0x11b002===_0x8c8b('0x7')||_0x1a34a3==='booked'&&_0x11b002===_0x8c8b('0x11')){return _0x11b002;}if(_0x1a34a3==='progressive'||_0x1a34a3==='predictive'||_0x1a34a3===_0x8c8b('0x12')){return _0x11b002;}return null;}},'servicelevel':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8c8b('0x13')](0xb)},'timeout':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8c8b('0x1')]},'weight':{'type':Sequelize[_0x8c8b('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x8c8b('0x14'),'no'),'defaultValue':_0x8c8b('0x14')},'autopause':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8c8b('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8c8b('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x8c8b('0x3')]('yes','no',_0x8c8b('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x8c8b('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8c8b('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8c8b('0x1')]},'queue_quantity1':{'type':Sequelize[_0x8c8b('0x1')]},'queue_quantity2':{'type':Sequelize[_0x8c8b('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x8c8b('0x1')]},'queue_less_than':{'type':Sequelize[_0x8c8b('0x1')]},'periodic_announce':{'type':Sequelize[_0x8c8b('0x16')],'set':function(_0x2a1a15){this[_0x8c8b('0xc')](_0x8c8b('0x17'),_0x2a1a15?_0x2a1a15[_0x8c8b('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0x8c8b('0x17'))?this[_0x8c8b('0xe')](_0x8c8b('0x17'))[_0x8c8b('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':_0x8c8b('0x14'),'set':function(_0x25a10a){this['setDataValue'](_0x8c8b('0x1a'),_0x25a10a?_0x25a10a[_0x8c8b('0x18')](','):[]);},'get':function(){return this[_0x8c8b('0xe')]('joinempty')?this[_0x8c8b('0xe')](_0x8c8b('0x1a'))['split'](','):[];}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1d1b11){this['setDataValue'](_0x8c8b('0x1b'),_0x1d1b11?_0x1d1b11[_0x8c8b('0x18')](','):[]);},'get':function(){return this[_0x8c8b('0xe')](_0x8c8b('0x1b'))?this[_0x8c8b('0xe')](_0x8c8b('0x1b'))[_0x8c8b('0x19')](','):[];}},'reportholdtime':{'type':Sequelize[_0x8c8b('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8c8b('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c8b('0x1')]},'acw':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':0x0,'set':function(_0x3c9483){this[_0x8c8b('0xc')](_0x8c8b('0x1d'),_0x3c9483);if(_0x3c9483){if(this['getDataValue'](_0x8c8b('0x1e'))<0x2){this['setDataValue'](_0x8c8b('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8c8b('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':0x0,'comment':_0x8c8b('0x1f')},'dialMethod':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x20'),'progressive','power',_0x8c8b('0x21'),_0x8c8b('0x22')),'defaultValue':_0x8c8b('0x23'),'comment':_0x8c8b('0x24')},'dialLimitChannel':{'type':Sequelize[_0x8c8b('0x13')](0x4)[_0x8c8b('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8c8b('0x26')},'dialLimitQueue':{'type':Sequelize[_0x8c8b('0x13')](0x4)[_0x8c8b('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8c8b('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x8c8b('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8c8b('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x8c8b('0x3')](_0x8c8b('0x29'),_0x8c8b('0x2a')),'defaultValue':_0x8c8b('0x2a'),'comment':_0x8c8b('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8c8b('0x2c')](0x2)[_0x8c8b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8c8b('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8c8b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8c8b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c8b('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x8c8b('0x2f'),'comment':_0x8c8b('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c8b('0x31')},'dialQueueProject':{'type':Sequelize[_0x8c8b('0x1')],'comment':_0x8c8b('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c8b('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8c8b('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c8b('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c8b('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8c8b('0x13')](0x5)[_0x8c8b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c8b('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'defaultValue':0x3,'comment':_0x8c8b('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8c8b('0x13')](0x5)[_0x8c8b('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8c8b('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8c8b('0x38')},'dialTimezone':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x8c8b('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8c8b('0x39'),_0x8c8b('0x3a'),_0x8c8b('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':0x0,'comment':_0x8c8b('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8c8b('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x8c8b('0x13')](0x9)[_0x8c8b('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8c8b('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8c8b('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8c8b('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8c8b('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8c8b('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x8c8b('0x13')](0x9)[_0x8c8b('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8c8b('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8c8b('0x13')](0x9)[_0x8c8b('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8c8b('0x13')](0x9)[_0x8c8b('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8c8b('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8c8b('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8c8b('0x13')](0x9)[_0x8c8b('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':0x0,'comment':_0x8c8b('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8c8b('0x3')]('DESC',_0x8c8b('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x8c8b('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8c8b('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8c8b('0x45')},'dialCutDigit':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8c8b('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c8b('0x13')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8c8b('0x1c')],'defaultValue':![],'comment':_0x8c8b('0x47'),'set':function(_0x1bf7fc){if(!_0x1bf7fc)this['setDataValue'](_0x8c8b('0x48'),null);this['setDataValue']('mandatoryDisposition',_0x1bf7fc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8c8b('0x13')](0x3)[_0x8c8b('0x25')],'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 d768aea..707bcae 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 _0x4725=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','pick','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','spread','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','stack','index','VoiceQueue','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','get'];(function(_0x52a45c,_0x331b52){var _0x4ac4be=function(_0x3167dc){while(--_0x3167dc){_0x52a45c['push'](_0x52a45c['shift']());}};_0x4ac4be(++_0x331b52);}(_0x4725,0x1cb));var _0x5472=function(_0x56a604,_0x27f05f){_0x56a604=_0x56a604-0x0;var _0x53ea21=_0x4725[_0x56a604];return _0x53ea21;};'use strict';var pdf=require(_0x5472('0x0'));var emlformat=require(_0x5472('0x1'));var rimraf=require(_0x5472('0x2'));var zipdir=require(_0x5472('0x3'));var jsonpatch=require(_0x5472('0x4'));var rp=require(_0x5472('0x5'));var moment=require(_0x5472('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5472('0x7'));var path=require('path');var sox=require(_0x5472('0x8'));var csv=require('to-csv');var ejs=require(_0x5472('0x9'));var fs=require('fs');var _=require(_0x5472('0xa'));var squel=require(_0x5472('0xb'));var crypto=require(_0x5472('0xc'));var jsforce=require(_0x5472('0xd'));var deskjs=require(_0x5472('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5472('0xf'));var Papa=require(_0x5472('0x10'));var Redis=require('ioredis');var authService=require(_0x5472('0x11'));var qs=require(_0x5472('0x12'));var hardwareService=require(_0x5472('0x13'));var logger=require(_0x5472('0x14'))(_0x5472('0x15'));var utils=require('../../config/utils');var config=require(_0x5472('0x16'));var db=require(_0x5472('0x17'))['db'];config['redis']=_[_0x5472('0x18')](config[_0x5472('0x19')],{'host':_0x5472('0x1a'),'port':0x18eb});var socket=require(_0x5472('0x1b'))(new Redis(config[_0x5472('0x19')]));require(_0x5472('0x1c'))[_0x5472('0x1d')](socket);function respondWithStatusCode(_0x1592d9,_0x5cc432){_0x5cc432=_0x5cc432||0xcc;return function(_0xf70df5){if(_0xf70df5){return _0x1592d9[_0x5472('0x1e')](_0x5cc432);}return _0x1592d9[_0x5472('0x1f')](_0x5cc432)[_0x5472('0x20')]();};}function respondWithResult(_0x54d2a4,_0x13447f){_0x13447f=_0x13447f||0xc8;return function(_0x3ded80){if(_0x3ded80){return _0x54d2a4[_0x5472('0x1f')](_0x13447f)[_0x5472('0x21')](_0x3ded80);}};}function respondWithFilteredResult(_0x4a3024,_0x491288){return function(_0x1d5503){if(_0x1d5503){var _0x29a8de=_0x1d5503[_0x5472('0x22')],_0x12948c=_0x491288[_0x5472('0x23')],_0x33670a=_0x491288[_0x5472('0x23')]+_0x491288['limit'],_0x1d1f16;if(_0x33670a>=_0x29a8de){_0x33670a=_0x29a8de;_0x1d1f16=0xc8;}else{_0x1d1f16=0xce;}_0x4a3024[_0x5472('0x1f')](_0x1d1f16);return _0x4a3024[_0x5472('0x24')](_0x5472('0x25'),_0x12948c+'-'+_0x33670a+'/'+_0x29a8de)[_0x5472('0x21')](_0x1d5503);}return null;};}function patchUpdates(_0x42ee83){return function(_0x4e1cc4){try{jsonpatch['apply'](_0x4e1cc4,_0x42ee83,!![]);}catch(_0x44fbdb){return BPromise[_0x5472('0x26')](_0x44fbdb);}return _0x4e1cc4[_0x5472('0x27')]();};}function saveUpdates(_0x177b42,_0x3a6b7d){return function(_0xcdee70){if(_0xcdee70){return _0xcdee70[_0x5472('0x28')](_0x177b42)[_0x5472('0x29')](function(_0x4fbc49){return _0x4fbc49;});}return null;};}function removeEntity(_0x1c0e77,_0x1dce40){return function(_0x328c05){if(_0x328c05){return _0x328c05[_0x5472('0x2a')]()[_0x5472('0x29')](function(){var _0x2949d1=_0x328c05['get']({'plain':!![]});var _0x20de23=[{'name':_0x5472('0x2b'),'value':_0x5472('0x2c'),'ignore':![]},{'name':_0x5472('0x2d'),'value':_0x5472('0x2e'),'ignore':![]}];var _0xefe84b=_(_0x20de23)[_0x5472('0x2f')](_0x5472('0x30'))[_0x5472('0x31')](_0x5472('0x32'))['value']();if(_[_0x5472('0x33')](_0xefe84b,_0x2949d1['type'])){return;}var _0x2380ed=_['find'](_0x20de23,[_0x5472('0x32'),_0x2949d1[_0x5472('0x34')]])[_0x5472('0x35')];return db[_0x5472('0x36')][_0x5472('0x2a')]({'where':{'type':_0x2380ed,'resourceId':_0x2949d1['id']}})[_0x5472('0x29')](function(){return _0x328c05;});})['then'](function(){_0x1c0e77[_0x5472('0x1f')](0xcc)[_0x5472('0x20')]();});}};}function handleEntityNotFound(_0x22f813,_0x68173){return function(_0x27bf17){if(!_0x27bf17){_0x22f813['sendStatus'](0x194);}return _0x27bf17;};}function handleError(_0x5637fd,_0x55f148){_0x55f148=_0x55f148||0x1f4;return function(_0xce00aa){logger['error'](_0xce00aa[_0x5472('0x37')]);if(_0xce00aa[_0x5472('0x35')]){delete _0xce00aa[_0x5472('0x35')];}_0x5637fd[_0x5472('0x1f')](_0x55f148)['send'](_0xce00aa);};}exports[_0x5472('0x38')]=function(_0x2ae7b3,_0x62041e){var _0x349d15={},_0x3efb80={},_0x2793f4={'count':0x0,'rows':[]};var _0x3ba6dc=db[_0x5472('0x39')][_0x5472('0x3a')];_0x3efb80[_0x5472('0x3b')]=_[_0x5472('0x3c')](_0x3ba6dc);_0x3efb80[_0x5472('0x3d')]=_[_0x5472('0x3c')](_0x2ae7b3[_0x5472('0x3d')]);_0x3efb80[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x3efb80[_0x5472('0x3b')],_0x3efb80['query']);_0x349d15[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x3efb80[_0x5472('0x3b')],qs[_0x5472('0x41')](_0x2ae7b3['query'][_0x5472('0x41')]));_0x349d15[_0x5472('0x40')]=_0x349d15['attributes'][_0x5472('0x42')]?_0x349d15[_0x5472('0x40')]:_0x3efb80['model'];if(!_0x2ae7b3[_0x5472('0x3d')][_0x5472('0x43')](_0x5472('0x44'))){_0x349d15[_0x5472('0x45')]=qs['limit'](_0x2ae7b3[_0x5472('0x3d')][_0x5472('0x45')]);_0x349d15[_0x5472('0x23')]=qs['offset'](_0x2ae7b3[_0x5472('0x3d')][_0x5472('0x23')]);}_0x349d15[_0x5472('0x46')]=qs[_0x5472('0x47')](_0x2ae7b3[_0x5472('0x3d')][_0x5472('0x47')]);_0x349d15[_0x5472('0x48')]=qs[_0x5472('0x3e')](_['pick'](_0x2ae7b3[_0x5472('0x3d')],_0x3efb80[_0x5472('0x3e')]));if(_0x2ae7b3[_0x5472('0x3d')]['filter']){_0x349d15[_0x5472('0x48')]=_['merge'](_0x349d15[_0x5472('0x48')],{'$or':_[_0x5472('0x31')](_0x3ba6dc,function(_0x19d942){if(_0x19d942['type'][_0x5472('0x49')]!==_0x5472('0x4a')){var _0x141d75={};_0x141d75[_0x19d942['field']]={'$like':'%'+_0x2ae7b3['query'][_0x5472('0x2f')]+'%'};return _0x141d75;}})});}_0x349d15=_['merge']({},_0x349d15,_0x2ae7b3[_0x5472('0x4b')]);var _0x22e4b3={'where':_0x349d15[_0x5472('0x48')]};return db[_0x5472('0x39')][_0x5472('0x22')](_0x22e4b3)[_0x5472('0x29')](function(_0x49931b){_0x2793f4[_0x5472('0x22')]=_0x49931b;if(_0x2ae7b3[_0x5472('0x3d')][_0x5472('0x4c')]){_0x349d15[_0x5472('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x5472('0x4e')](_0x349d15);})['then'](function(_0x307fd0){_0x2793f4[_0x5472('0x4f')]=_0x307fd0;return _0x2793f4;})[_0x5472('0x29')](respondWithFilteredResult(_0x62041e,_0x349d15))[_0x5472('0x50')](handleError(_0x62041e,null));};exports['show']=function(_0x24ffc3,_0x3a5cad){var _0x1b1d41={'raw':![],'where':{'id':_0x24ffc3[_0x5472('0x51')]['id']}},_0xb0010e={};_0xb0010e[_0x5472('0x3b')]=_[_0x5472('0x3c')](db[_0x5472('0x39')]['rawAttributes']);_0xb0010e[_0x5472('0x3d')]=_[_0x5472('0x3c')](_0x24ffc3[_0x5472('0x3d')]);_0xb0010e[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0xb0010e[_0x5472('0x3b')],_0xb0010e[_0x5472('0x3d')]);_0x1b1d41[_0x5472('0x40')]=_['intersection'](_0xb0010e[_0x5472('0x3b')],qs[_0x5472('0x41')](_0x24ffc3[_0x5472('0x3d')]['fields']));_0x1b1d41[_0x5472('0x40')]=_0x1b1d41[_0x5472('0x40')][_0x5472('0x42')]?_0x1b1d41['attributes']:_0xb0010e[_0x5472('0x3b')];if(_0x24ffc3['query']['includeAll']){_0x1b1d41[_0x5472('0x4d')]=[{'all':!![]}];}_0x1b1d41=_[_0x5472('0x52')]({},_0x1b1d41,_0x24ffc3['options']);return db[_0x5472('0x39')][_0x5472('0x53')](_0x1b1d41)['then'](handleEntityNotFound(_0x3a5cad,null))[_0x5472('0x29')](respondWithResult(_0x3a5cad,null))[_0x5472('0x50')](handleError(_0x3a5cad,null));};exports[_0x5472('0x54')]=function(_0x1b83bb,_0x7f6c3d){return db[_0x5472('0x39')]['create'](_0x1b83bb[_0x5472('0x55')],{})['then'](function(_0x41c350){var _0xbfdbac=_0x1b83bb['user'][_0x5472('0x56')]({'plain':!![]});if(!_0xbfdbac)throw new Error(_0x5472('0x57'));if(_0xbfdbac[_0x5472('0x58')]===_0x5472('0x59')){var _0x41a8c8=_0x41c350['get']({'plain':!![]});var _0xc7582b=[{'name':_0x5472('0x2b'),'value':'inbound'},{'name':_0x5472('0x2d'),'value':_0x5472('0x2e')}];var _0x3b91e6=_['find'](_0xc7582b,[_0x5472('0x32'),_0x41a8c8[_0x5472('0x34')]])[_0x5472('0x35')];return db[_0x5472('0x5a')][_0x5472('0x53')]({'where':{'name':_0x3b91e6,'userProfileId':_0xbfdbac[_0x5472('0x5b')]},'raw':!![]})[_0x5472('0x29')](function(_0x31bb6b){if(_0x31bb6b&&_0x31bb6b[_0x5472('0x5c')]===0x0){return db[_0x5472('0x36')]['create']({'name':_0x41a8c8['name'],'resourceId':_0x41a8c8['id'],'type':_0x31bb6b[_0x5472('0x35')],'sectionId':_0x31bb6b['id']},{})['then'](function(){return _0x41c350;});}else{return _0x41c350;}})[_0x5472('0x50')](function(_0x245be6){logger['error'](_0x5472('0x5d'),_0x245be6);throw _0x245be6;});}return _0x41c350;})[_0x5472('0x29')](respondWithResult(_0x7f6c3d,0xc9))[_0x5472('0x50')](handleError(_0x7f6c3d,null));};exports[_0x5472('0x5e')]=function(_0x57fc42,_0x3b364d){var _0x440ac0={'raw':![],'where':{'id':_0x57fc42[_0x5472('0x51')]['id']}},_0x2bdd1f={};_0x2bdd1f[_0x5472('0x3b')]=_[_0x5472('0x3c')](db[_0x5472('0x39')][_0x5472('0x3a')]);_0x440ac0[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x2bdd1f['model'],qs[_0x5472('0x41')](_0x57fc42[_0x5472('0x3d')]['fields']));_0x440ac0['attributes']=_0x440ac0[_0x5472('0x40')][_0x5472('0x42')]?_0x440ac0[_0x5472('0x40')]:_0x2bdd1f[_0x5472('0x3b')];if(_0x57fc42[_0x5472('0x3d')][_0x5472('0x4c')]){_0x440ac0[_0x5472('0x4d')]=[{'all':!![]}];}_0x440ac0=_['merge']({},_0x440ac0,_0x57fc42[_0x5472('0x4b')]);return db['VoiceQueue'][_0x5472('0x53')](_0x440ac0)['then'](handleEntityNotFound(_0x3b364d,null))[_0x5472('0x29')](function(_0x1bdb6d){if(_0x1bdb6d){var _0xf356e7=_0x1bdb6d['get']({'plain':!![]});_0xf356e7=qs[_0x5472('0x5f')](_0xf356e7,['id',_0x5472('0x60'),_0x5472('0x61')]);_0x57fc42[_0x5472('0x55')]=_['omit'](_0x57fc42[_0x5472('0x55')],['id','createdAt',_0x5472('0x61')]);return db[_0x5472('0x39')][_0x5472('0x54')](_[_0x5472('0x52')](_0xf356e7,_0x57fc42[_0x5472('0x55')]),{'include':_0x57fc42[_0x5472('0x3d')][_0x5472('0x4c')]?[{'all':!![]}]:undefined})[_0x5472('0x29')](function(_0x146ae9){var _0x138b6b=_0x57fc42['user'][_0x5472('0x56')]({'plain':!![]});if(!_0x138b6b)throw new Error(_0x5472('0x57'));if(_0x138b6b[_0x5472('0x58')]===_0x5472('0x59')){var _0x2823e0=_0x146ae9[_0x5472('0x56')]({'plain':!![]});var _0x1f5d7d=[{'name':_0x5472('0x2b'),'value':_0x5472('0x2c')},{'name':_0x5472('0x2d'),'value':'outbound'}];var _0x438dcd=_[_0x5472('0x53')](_0x1f5d7d,['value',_0x2823e0['type']])['name'];return db[_0x5472('0x5a')][_0x5472('0x53')]({'where':{'name':_0x438dcd,'userProfileId':_0x138b6b['userProfileId']},'raw':!![]})[_0x5472('0x29')](function(_0x317c0a){if(_0x317c0a&&_0x317c0a[_0x5472('0x5c')]===0x0){return db[_0x5472('0x36')][_0x5472('0x54')]({'name':_0x2823e0[_0x5472('0x35')],'resourceId':_0x2823e0['id'],'type':_0x317c0a[_0x5472('0x35')],'sectionId':_0x317c0a['id']},{})[_0x5472('0x29')](function(){return _0x146ae9;});}else{return _0x146ae9;}})[_0x5472('0x50')](function(_0x892c40){logger['error'](_0x5472('0x5d'),_0x892c40);throw _0x892c40;});}return _0x146ae9;});}})[_0x5472('0x29')](respondWithResult(_0x3b364d,0xc9))[_0x5472('0x50')](handleError(_0x3b364d,null));};exports[_0x5472('0x28')]=function(_0x14ea73,_0x2343bb){if(_0x14ea73['body']['id']){delete _0x14ea73[_0x5472('0x55')]['id'];}return db[_0x5472('0x39')][_0x5472('0x53')]({'where':{'id':_0x14ea73[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x2343bb,null))[_0x5472('0x29')](saveUpdates(_0x14ea73[_0x5472('0x55')],null))['then'](respondWithResult(_0x2343bb,null))[_0x5472('0x50')](handleError(_0x2343bb,null));};exports['destroy']=function(_0x4d1f13,_0x1f195e){return db[_0x5472('0x39')]['find']({'where':{'id':_0x4d1f13[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x1f195e,null))['then'](removeEntity(_0x1f195e,null))[_0x5472('0x50')](handleError(_0x1f195e,null));};exports[_0x5472('0x62')]=function(_0x12e925,_0x40d39d,_0x39c530){var _0x48bda3={'raw':![],'where':{}};var _0x372b72={};var _0x2e82fb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5472('0x63')]({'where':{'id':_0x12e925[_0x5472('0x51')]['id']}})['then'](handleEntityNotFound(_0x40d39d,null))['then'](function(_0x2f6f47){if(_0x2f6f47){_0x372b72[_0x5472('0x3b')]=_[_0x5472('0x3c')](db['CmHopper'][_0x5472('0x3a')]);_0x372b72['query']=_[_0x5472('0x3c')](_0x12e925[_0x5472('0x3d')]);_0x372b72[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x372b72[_0x5472('0x3b')],_0x372b72[_0x5472('0x3d')]);_0x48bda3[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x372b72['model'],qs['fields'](_0x12e925[_0x5472('0x3d')][_0x5472('0x41')]));_0x48bda3[_0x5472('0x40')]=_0x48bda3['attributes'][_0x5472('0x42')]?_0x48bda3[_0x5472('0x40')]:_0x372b72[_0x5472('0x3b')];if(!_0x12e925[_0x5472('0x3d')][_0x5472('0x43')](_0x5472('0x44'))){_0x48bda3[_0x5472('0x45')]=qs[_0x5472('0x45')](_0x12e925[_0x5472('0x3d')][_0x5472('0x45')]);_0x48bda3[_0x5472('0x23')]=qs['offset'](_0x12e925[_0x5472('0x3d')][_0x5472('0x23')]);}_0x48bda3[_0x5472('0x46')]=qs[_0x5472('0x47')](_0x12e925[_0x5472('0x3d')][_0x5472('0x47')]);_0x48bda3[_0x5472('0x48')]=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0x12e925[_0x5472('0x3d')],_0x372b72[_0x5472('0x3e')]));_0x48bda3[_0x5472('0x48')]['VoiceQueueId']=_0x2f6f47['id'];if(_0x12e925[_0x5472('0x3d')][_0x5472('0x2f')]){_0x48bda3[_0x5472('0x48')]=_[_0x5472('0x52')](_0x48bda3['where'],{'$or':_['map'](_0x48bda3['attributes'],function(_0x243d5d){var _0x21cc84={};_0x21cc84[_0x243d5d]={'$like':'%'+_0x12e925[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x21cc84;})});}_0x48bda3=_[_0x5472('0x52')]({},_0x48bda3,_0x12e925[_0x5472('0x4b')]);return db[_0x5472('0x65')]['count']({'where':_0x48bda3[_0x5472('0x48')]})[_0x5472('0x29')](function(_0x3c6690){_0x2e82fb[_0x5472('0x22')]=_0x3c6690;if(_0x12e925[_0x5472('0x3d')][_0x5472('0x4c')]){_0x48bda3[_0x5472('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0x5472('0x4e')](_0x48bda3);})[_0x5472('0x29')](function(_0x4dad87){_0x2e82fb['rows']=_0x4dad87;return _0x2e82fb;});}})['then'](respondWithFilteredResult(_0x40d39d,_0x48bda3))[_0x5472('0x50')](handleError(_0x40d39d,null));};exports[_0x5472('0x66')]=function(_0x106adf,_0x31fe6d,_0x4a46c1){var _0xd3d57={'raw':!![],'where':{}};var _0x5989d5={};var _0x129896={'count':0x0,'rows':[]};return db[_0x5472('0x39')]['findOne']({'where':{'id':_0x106adf['params']['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x31fe6d,null))[_0x5472('0x29')](function(_0x52837b){if(_0x52837b){_0x5989d5[_0x5472('0x3b')]=_[_0x5472('0x3c')](db[_0x5472('0x67')][_0x5472('0x3a')]);_0x5989d5[_0x5472('0x3d')]=_['keys'](_0x106adf['query']);_0x5989d5[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x5989d5['model'],_0x5989d5[_0x5472('0x3d')]);_0xd3d57[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x5989d5[_0x5472('0x3b')],qs['fields'](_0x106adf[_0x5472('0x3d')]['fields']));_0xd3d57[_0x5472('0x40')]=_0xd3d57[_0x5472('0x40')][_0x5472('0x42')]?_0xd3d57['attributes']:_0x5989d5['model'];if(!_0x106adf[_0x5472('0x3d')][_0x5472('0x43')](_0x5472('0x44'))){_0xd3d57[_0x5472('0x45')]=qs['limit'](_0x106adf[_0x5472('0x3d')][_0x5472('0x45')]);_0xd3d57[_0x5472('0x23')]=qs['offset'](_0x106adf[_0x5472('0x3d')]['offset']);}_0xd3d57['order']=qs[_0x5472('0x47')](_0x106adf[_0x5472('0x3d')][_0x5472('0x47')]);_0xd3d57[_0x5472('0x48')]=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0x106adf['query'],_0x5989d5[_0x5472('0x3e')]));_0xd3d57[_0x5472('0x48')][_0x5472('0x68')]=_0x52837b['id'];if(_0x106adf[_0x5472('0x3d')][_0x5472('0x2f')]){_0xd3d57[_0x5472('0x48')]=_['merge'](_0xd3d57[_0x5472('0x48')],{'$or':_[_0x5472('0x31')](_0xd3d57[_0x5472('0x40')],function(_0x1d97ad){var _0x1cda8a={};_0x1cda8a[_0x1d97ad]={'$like':'%'+_0x106adf[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x1cda8a;})});}_0xd3d57=_['merge']({},_0xd3d57,_0x106adf[_0x5472('0x4b')]);return db['CmHopperHistory'][_0x5472('0x22')]({'where':_0xd3d57[_0x5472('0x48')]})['then'](function(_0x3f8e9e){_0x129896['count']=_0x3f8e9e;if(_0x106adf[_0x5472('0x3d')][_0x5472('0x4c')]){_0xd3d57['include']=[{'all':!![]}];}return db[_0x5472('0x67')][_0x5472('0x4e')](_0xd3d57);})['then'](function(_0x385419){_0x129896['rows']=_0x385419;return _0x129896;});}})[_0x5472('0x29')](respondWithFilteredResult(_0x31fe6d,_0xd3d57))[_0x5472('0x50')](handleError(_0x31fe6d,null));};exports[_0x5472('0x69')]=function(_0x68e66d,_0x139843,_0x5eef6b){var _0x23f7d7={'raw':!![],'where':{}};var _0x3aee79={};var _0x5d4782={'count':0x0,'rows':[]};return db[_0x5472('0x39')][_0x5472('0x63')]({'where':{'id':_0x68e66d[_0x5472('0x51')]['id']}})['then'](handleEntityNotFound(_0x139843,null))[_0x5472('0x29')](function(_0x3ffcd8){if(_0x3ffcd8){_0x3aee79[_0x5472('0x3b')]=_[_0x5472('0x3c')](db[_0x5472('0x6a')][_0x5472('0x3a')]);_0x3aee79[_0x5472('0x3d')]=_[_0x5472('0x3c')](_0x68e66d[_0x5472('0x3d')]);_0x3aee79[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x3aee79[_0x5472('0x3b')],_0x3aee79[_0x5472('0x3d')]);_0x23f7d7[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x3aee79['model'],qs[_0x5472('0x41')](_0x68e66d['query']['fields']));_0x23f7d7[_0x5472('0x40')]=_0x23f7d7[_0x5472('0x40')][_0x5472('0x42')]?_0x23f7d7['attributes']:_0x3aee79[_0x5472('0x3b')];if(!_0x68e66d[_0x5472('0x3d')][_0x5472('0x43')](_0x5472('0x44'))){_0x23f7d7['limit']=qs[_0x5472('0x45')](_0x68e66d['query'][_0x5472('0x45')]);_0x23f7d7[_0x5472('0x23')]=qs[_0x5472('0x23')](_0x68e66d[_0x5472('0x3d')][_0x5472('0x23')]);}_0x23f7d7['order']=qs['sort'](_0x68e66d[_0x5472('0x3d')][_0x5472('0x47')]);_0x23f7d7[_0x5472('0x48')]=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0x68e66d[_0x5472('0x3d')],_0x3aee79[_0x5472('0x3e')]));_0x23f7d7[_0x5472('0x48')][_0x5472('0x68')]=_0x3ffcd8['id'];if(_0x68e66d[_0x5472('0x3d')][_0x5472('0x2f')]){_0x23f7d7[_0x5472('0x48')]=_[_0x5472('0x52')](_0x23f7d7['where'],{'$or':_[_0x5472('0x31')](_0x23f7d7[_0x5472('0x40')],function(_0x37359b){var _0x10ebbe={};_0x10ebbe[_0x37359b]={'$like':'%'+_0x68e66d[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x10ebbe;})});}_0x23f7d7=_[_0x5472('0x52')]({},_0x23f7d7,_0x68e66d['options']);return db[_0x5472('0x6a')][_0x5472('0x22')]({'where':_0x23f7d7['where']})[_0x5472('0x29')](function(_0x93e4b3){_0x5d4782['count']=_0x93e4b3;if(_0x68e66d['query'][_0x5472('0x4c')]){_0x23f7d7[_0x5472('0x4d')]=[{'all':!![]}];}return db[_0x5472('0x6a')]['findAll'](_0x23f7d7);})[_0x5472('0x29')](function(_0x4aa032){_0x5d4782['rows']=_0x4aa032;return _0x5d4782;});}})['then'](respondWithFilteredResult(_0x139843,_0x23f7d7))['catch'](handleError(_0x139843,null));};exports[_0x5472('0x6b')]=function(_0x3d344c,_0xa721e2,_0x310af7){var _0x4ce758={'raw':!![],'where':{}};var _0x262250={};var _0x2ef924={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3d344c['params']['id']}})[_0x5472('0x29')](handleEntityNotFound(_0xa721e2,null))[_0x5472('0x29')](function(_0x4d94f6){if(_0x4d94f6){_0x262250[_0x5472('0x3b')]=_['keys'](db[_0x5472('0x6c')]['rawAttributes']);_0x262250['query']=_[_0x5472('0x3c')](_0x3d344c[_0x5472('0x3d')]);_0x262250[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x262250[_0x5472('0x3b')],_0x262250[_0x5472('0x3d')]);_0x4ce758['attributes']=_[_0x5472('0x3f')](_0x262250[_0x5472('0x3b')],qs[_0x5472('0x41')](_0x3d344c[_0x5472('0x3d')]['fields']));_0x4ce758[_0x5472('0x40')]=_0x4ce758[_0x5472('0x40')][_0x5472('0x42')]?_0x4ce758['attributes']:_0x262250['model'];if(!_0x3d344c['query'][_0x5472('0x43')]('nolimit')){_0x4ce758[_0x5472('0x45')]=qs[_0x5472('0x45')](_0x3d344c[_0x5472('0x3d')]['limit']);_0x4ce758[_0x5472('0x23')]=qs[_0x5472('0x23')](_0x3d344c['query'][_0x5472('0x23')]);}_0x4ce758['order']=qs[_0x5472('0x47')](_0x3d344c['query'][_0x5472('0x47')]);_0x4ce758[_0x5472('0x48')]=qs[_0x5472('0x3e')](_['pick'](_0x3d344c['query'],_0x262250[_0x5472('0x3e')]));_0x4ce758[_0x5472('0x48')][_0x5472('0x68')]=_0x4d94f6['id'];if(_0x3d344c[_0x5472('0x3d')][_0x5472('0x2f')]){_0x4ce758[_0x5472('0x48')]=_[_0x5472('0x52')](_0x4ce758[_0x5472('0x48')],{'$or':_[_0x5472('0x31')](_0x4ce758[_0x5472('0x40')],function(_0x6140d9){var _0x5584f8={};_0x5584f8[_0x6140d9]={'$like':'%'+_0x3d344c[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x5584f8;})});}_0x4ce758=_['merge']({},_0x4ce758,_0x3d344c[_0x5472('0x4b')]);return db[_0x5472('0x6c')][_0x5472('0x22')]({'where':_0x4ce758[_0x5472('0x48')]})[_0x5472('0x29')](function(_0x480126){_0x2ef924[_0x5472('0x22')]=_0x480126;if(_0x3d344c[_0x5472('0x3d')][_0x5472('0x4c')]){_0x4ce758[_0x5472('0x4d')]=[{'all':!![]}];}return db[_0x5472('0x6c')]['findAll'](_0x4ce758);})[_0x5472('0x29')](function(_0x25ca2c){_0x2ef924[_0x5472('0x4f')]=_0x25ca2c;return _0x2ef924;});}})[_0x5472('0x29')](respondWithFilteredResult(_0xa721e2,_0x4ce758))[_0x5472('0x50')](handleError(_0xa721e2,null));};exports[_0x5472('0x6d')]=function(_0xaec1a3,_0x322a27,_0x31842d){var _0x5280f4={};var _0x58cb5a={};var _0x37dd8e;var _0x2ed1d0;return db[_0x5472('0x39')][_0x5472('0x63')]({'where':{'id':_0xaec1a3['params']['id']}})['then'](handleEntityNotFound(_0x322a27,null))['then'](function(_0x6f5622){if(_0x6f5622){_0x37dd8e=_0x6f5622;_0x58cb5a['model']=_[_0x5472('0x3c')](db['Team'][_0x5472('0x3a')]);_0x58cb5a['query']=_[_0x5472('0x3c')](_0xaec1a3[_0x5472('0x3d')]);_0x58cb5a[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x58cb5a['model'],_0x58cb5a[_0x5472('0x3d')]);_0x5280f4[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x58cb5a['model'],qs[_0x5472('0x41')](_0xaec1a3['query'][_0x5472('0x41')]));_0x5280f4[_0x5472('0x40')]=_0x5280f4[_0x5472('0x40')][_0x5472('0x42')]?_0x5280f4[_0x5472('0x40')]:_0x58cb5a[_0x5472('0x3b')];_0x5280f4[_0x5472('0x46')]=qs[_0x5472('0x47')](_0xaec1a3[_0x5472('0x3d')]['sort']);_0x5280f4[_0x5472('0x48')]=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0xaec1a3[_0x5472('0x3d')],_0x58cb5a[_0x5472('0x3e')]));if(_0xaec1a3[_0x5472('0x3d')][_0x5472('0x2f')]){_0x5280f4[_0x5472('0x48')]=_['merge'](_0x5280f4[_0x5472('0x48')],{'$or':_[_0x5472('0x31')](_0x5280f4[_0x5472('0x40')],function(_0x1635fa){var _0x4b5e86={};_0x4b5e86[_0x1635fa]={'$like':'%'+_0xaec1a3[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x4b5e86;})});}_0x5280f4=_[_0x5472('0x52')]({},_0x5280f4,_0xaec1a3[_0x5472('0x4b')]);return _0x37dd8e[_0x5472('0x6d')](_0x5280f4);}})[_0x5472('0x29')](function(_0x4b11b5){if(_0x4b11b5){_0x2ed1d0=_0x4b11b5['length'];if(!_0xaec1a3[_0x5472('0x3d')][_0x5472('0x43')](_0x5472('0x44'))){_0x5280f4[_0x5472('0x45')]=qs[_0x5472('0x45')](_0xaec1a3[_0x5472('0x3d')]['limit']);_0x5280f4[_0x5472('0x23')]=qs['offset'](_0xaec1a3['query'][_0x5472('0x23')]);}return _0x37dd8e[_0x5472('0x6d')](_0x5280f4);}})[_0x5472('0x29')](function(_0x2b4e17){if(_0x2b4e17){return _0x2b4e17?{'count':_0x2ed1d0,'rows':_0x2b4e17}:null;}})[_0x5472('0x29')](respondWithResult(_0x322a27,null))[_0x5472('0x50')](handleError(_0x322a27,null));};exports[_0x5472('0x6e')]=function(_0x29409f,_0x371ad2,_0x9d2cdb){var _0x3e9caa=_0x29409f['body']['teams'];return db['Team'][_0x5472('0x4e')]({'where':{'id':_[_0x5472('0x31')](_0x3e9caa,'id')},'attributes':['id'],'include':[{'model':db[_0x5472('0x6f')],'as':_0x5472('0x70'),'attributes':['id',_0x5472('0x35'),_0x5472('0x71'),_0x5472('0x72'),_0x5472('0x73')],'raw':!![]}]})[_0x5472('0x29')](function(_0x1a57ee){if(_0x1a57ee){var _0x138e34=_[_0x5472('0x74')](_0x1a57ee,function(_0x447a39){var _0x14f1f3=_0x447a39['get']({'plain':!![]});_0x14f1f3['Agents']['forEach'](function(_0x216af1){_0x216af1[_0x5472('0x75')]=_[_0x5472('0x53')](_0x3e9caa,{'id':_0x14f1f3['id']})[_0x5472('0x75')];});return _0x14f1f3[_0x5472('0x70')];});return db[_0x5472('0x39')][_0x5472('0x53')]({'where':{'id':_0x29409f[_0x5472('0x51')]['id']}})['then'](function(_0x15dd7b){return db[_0x5472('0x76')][_0x5472('0x77')](function(_0x386f4a){return _0x15dd7b[_0x5472('0x6e')](_[_0x5472('0x31')](_0x3e9caa,'id'),{'transaction':_0x386f4a})[_0x5472('0x29')](function(){return BPromise[_0x5472('0x78')](_0x138e34,function(_0x19f879){return db['UserVoiceQueue'][_0x5472('0x79')]({'where':{'UserId':_0x19f879['id'],'VoiceQueueId':_0x29409f[_0x5472('0x51')]['id']},'defaults':{'penalty':_0x19f879[_0x5472('0x75')]},'transaction':_0x386f4a});});})[_0x5472('0x29')](function(){return BPromise['each'](_[_0x5472('0x2f')](_0x138e34,{'online':!![]}),function(_0x5a9122){return db[_0x5472('0x7a')][_0x5472('0x7b')]({'membername':_0x5a9122[_0x5472('0x35')],'UserId':_0x5a9122['id'],'queue_name':_0x15dd7b[_0x5472('0x35')],'VoiceQueueId':_0x15dd7b['id'],'interface':_[_0x5472('0x7c')](_0x5a9122[_0x5472('0x73')])?util[_0x5472('0x7d')](_0x5472('0x7e'),_0x5a9122[_0x5472('0x35')]):_0x5a9122[_0x5472('0x73')],'paused':_0x5a9122[_0x5472('0x72')]||![],'penalty':_0x5a9122['penalty']},{'transaction':_0x386f4a});});})['then'](function(){_0x138e34[_0x5472('0x7f')](function(_0x10d873){socket[_0x5472('0x80')](_0x5472('0x81'),{'UserId':_0x10d873['id'],'VoiceQueueId':_0x15dd7b['id']});});});});});}})[_0x5472('0x29')](respondWithStatusCode(_0x371ad2,null))['catch'](handleError(_0x371ad2,null));};exports[_0x5472('0x82')]=function(_0x572c8d,_0x63bcac,_0x37775b){return db[_0x5472('0x83')][_0x5472('0x4e')]({'where':{'id':_0x572c8d[_0x5472('0x3d')][_0x5472('0x84')]},'attributes':['id'],'include':[{'model':db[_0x5472('0x6f')],'as':_0x5472('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x63bcac,null))[_0x5472('0x29')](function(_0x5dc0f4){var _0x37eecf=_[_0x5472('0x31')](_0x5dc0f4,'id');var _0x80182a=[];var _0x34366a=[];var _0x3935a0=squel[_0x5472('0x85')]();_0x3935a0[_0x5472('0x86')]('tq.TeamId')[_0x5472('0x87')](_0x5472('0x88'),'tq')[_0x5472('0x89')]('user_has_teams','ut',_0x5472('0x8a'))[_0x5472('0x48')](_0x5472('0x8b'),_0x572c8d[_0x5472('0x51')]['id']);for(var _0x478011=0x0;_0x478011<_0x5dc0f4[_0x5472('0x42')];_0x478011+=0x1){let _0x5a231f=_0x5dc0f4[_0x478011];for(var _0x44601c=0x0;_0x44601c<_0x5a231f[_0x5472('0x70')][_0x5472('0x42')];_0x44601c+=0x1){let _0x565215=_0x5a231f[_0x5472('0x70')][_0x44601c];var _0x40654b=_0x3935a0[_0x5472('0x5e')]();_0x40654b[_0x5472('0x48')]('ut.UserId\x20=\x20?',_0x565215['id']);_0x34366a['push'](db[_0x5472('0x76')]['query'](_0x40654b[_0x5472('0x8c')](),{'type':db[_0x5472('0x76')]['QueryTypes'][_0x5472('0x8d')]})[_0x5472('0x29')](function(_0x58c467){if(_0x58c467['length']===0x1){return _0x565215['id'];}else{var _0x5c1429=_[_0x5472('0x8e')](_[_0x5472('0x31')](_0x58c467,_0x5472('0x8f')),function(_0x2c1eba){return _[_0x5472('0x33')](_0x37eecf,_0x2c1eba);});if(_0x5c1429){return _0x565215['id'];}}}));}}return BPromise[_0x5472('0x90')](_0x34366a)[_0x5472('0x29')](function(_0x4f1f04){_0x80182a=_(_0x80182a)[_0x5472('0x91')](_0x4f1f04)[_0x5472('0x92')]()[_0x5472('0x32')]();return db[_0x5472('0x39')][_0x5472('0x53')]({'where':{'id':_0x572c8d['params']['id']}})['then'](function(_0x47932e){return db[_0x5472('0x76')]['transaction'](function(_0x203c04){return _0x47932e[_0x5472('0x82')](_0x572c8d[_0x5472('0x3d')][_0x5472('0x84')],{'transaction':_0x203c04})[_0x5472('0x29')](function(){if(!_[_0x5472('0x93')](_0x80182a)){return _0x47932e[_0x5472('0x94')](_0x80182a,{'transaction':_0x203c04})[_0x5472('0x29')](function(){return db[_0x5472('0x7a')][_0x5472('0x2a')]({'where':{'VoiceQueueId':_0x572c8d[_0x5472('0x51')]['id'],'UserId':_0x80182a},'transaction':_0x203c04});});}})[_0x5472('0x29')](function(){_0x80182a[_0x5472('0x7f')](function(_0x2ccc45){socket['emit']('userVoiceQueue:remove',{'UserId':_0x2ccc45,'VoiceQueueId':_0x47932e['id']});});});});});});})['then'](respondWithStatusCode(_0x63bcac,null))[_0x5472('0x50')](handleError(_0x63bcac,null));};exports[_0x5472('0x95')]=function(_0xcc42a5,_0x1bf032,_0x4e4365){var _0x49bdc8,_0x5969a2;return db['VoiceQueue'][_0x5472('0x53')]({'where':{'id':_0xcc42a5[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x1bf032,null))[_0x5472('0x29')](function(_0x3207bf){if(_0x3207bf){_0x5969a2=_0x3207bf;return _0x3207bf[_0x5472('0x95')](_0xcc42a5[_0x5472('0x55')][_0x5472('0x84')],_[_0x5472('0x5f')](_0xcc42a5[_0x5472('0x55')],[_0x5472('0x84'),'id'])||{})[_0x5472('0x96')](function(_0x25fbb9){for(var _0x307e11=0x0;_0x307e11<_0xcc42a5[_0x5472('0x55')][_0x5472('0x84')][_0x5472('0x42')];_0x307e11+=0x1){socket['emit'](_0x5472('0x81'),{'UserId':_0xcc42a5[_0x5472('0x55')][_0x5472('0x84')][_0x307e11],'VoiceQueueId':_0xcc42a5['params']['id']});}return _0x25fbb9;});}})[_0x5472('0x29')](function(_0x642f52){_0x49bdc8=_0x642f52||[];if(_0x5969a2){return db[_0x5472('0x6f')]['findAll']({'where':{'id':_0xcc42a5[_0x5472('0x55')][_0x5472('0x84')]},'attributes':['id','name',_0x5472('0x71'),_0x5472('0x72'),'interface'],'raw':!![]});}})[_0x5472('0x29')](function(_0x45d9c2){if(!_[_0x5472('0x93')](_0x45d9c2)){var _0x455c37=[];for(var _0x3f2b29=0x0;_0x3f2b29<_0x45d9c2[_0x5472('0x42')];_0x3f2b29++){if(_0x45d9c2[_0x3f2b29]['online']){_0x455c37[_0x5472('0x97')](db[_0x5472('0x7a')][_0x5472('0x7b')]({'membername':_0x45d9c2[_0x3f2b29]['name'],'UserId':_0x45d9c2[_0x3f2b29]['id'],'queue_name':_0x5969a2[_0x5472('0x35')],'VoiceQueueId':_0x5969a2['id'],'interface':_[_0x5472('0x7c')](_0x45d9c2[_0x3f2b29]['interface'])?util['format'](_0x5472('0x7e'),_0x45d9c2[_0x3f2b29][_0x5472('0x35')]):_0x45d9c2[_0x3f2b29][_0x5472('0x73')],'paused':_0x45d9c2[_0x3f2b29][_0x5472('0x72')]||![],'penalty':_0xcc42a5[_0x5472('0x55')]['penalty']||0x0}));}}return BPromise['all'](_0x455c37);}})[_0x5472('0x29')](function(){return _0x49bdc8;})['then'](respondWithResult(_0x1bf032,null))[_0x5472('0x50')](handleError(_0x1bf032,null));};exports[_0x5472('0x94')]=function(_0x43043b,_0x374220,_0x301986){return db[_0x5472('0x39')]['find']({'where':{'id':_0x43043b[_0x5472('0x51')]['id']}})['then'](handleEntityNotFound(_0x374220,null))[_0x5472('0x29')](function(_0x4d1098){if(_0x4d1098){return _0x4d1098[_0x5472('0x94')](_0x43043b['query'][_0x5472('0x84')])['then'](function(){if(_[_0x5472('0x98')](_0x43043b[_0x5472('0x3d')][_0x5472('0x84')])){for(var _0x1f00d1=0x0;_0x1f00d1<_0x43043b[_0x5472('0x3d')]['ids'][_0x5472('0x42')];_0x1f00d1+=0x1){socket[_0x5472('0x80')](_0x5472('0x99'),{'UserId':Number(_0x43043b['query'][_0x5472('0x84')][_0x1f00d1]),'VoiceQueueId':Number(_0x43043b[_0x5472('0x51')]['id'])});}}else{socket['emit'](_0x5472('0x99'),{'UserId':Number(_0x43043b[_0x5472('0x3d')][_0x5472('0x84')]),'VoiceQueueId':Number(_0x43043b[_0x5472('0x51')]['id'])});}});}})[_0x5472('0x29')](function(_0x4c0d98){return db[_0x5472('0x7a')][_0x5472('0x2a')]({'where':{'VoiceQueueId':_0x43043b[_0x5472('0x51')]['id'],'UserId':_0x43043b[_0x5472('0x3d')]['ids']}})[_0x5472('0x29')](function(){return _0x4c0d98;});})['then'](respondWithStatusCode(_0x374220,null))[_0x5472('0x50')](handleError(_0x374220,null));};exports[_0x5472('0x9a')]=function(_0x52adca,_0x58c3eb,_0x111db4){var _0x35f4dd={};var _0x1f1b05={};var _0x2e7d73;var _0x54c24d;return db[_0x5472('0x39')][_0x5472('0x63')]({'where':{'id':_0x52adca[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x58c3eb,null))['then'](function(_0x620f48){if(_0x620f48){_0x2e7d73=_0x620f48;_0x1f1b05[_0x5472('0x3b')]=_[_0x5472('0x3c')](db[_0x5472('0x6f')][_0x5472('0x3a')]);_0x1f1b05['query']=_['keys'](_0x52adca[_0x5472('0x3d')]);_0x1f1b05[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x1f1b05[_0x5472('0x3b')],_0x1f1b05[_0x5472('0x3d')]);_0x35f4dd[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x1f1b05[_0x5472('0x3b')],qs[_0x5472('0x41')](_0x52adca[_0x5472('0x3d')][_0x5472('0x41')]));_0x35f4dd['attributes']=_0x35f4dd['attributes'][_0x5472('0x42')]?_0x35f4dd[_0x5472('0x40')]:_0x1f1b05[_0x5472('0x3b')];_0x35f4dd[_0x5472('0x46')]=qs[_0x5472('0x47')](_0x52adca[_0x5472('0x3d')][_0x5472('0x47')]);_0x35f4dd[_0x5472('0x48')]=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0x52adca['query'],_0x1f1b05[_0x5472('0x3e')]));if(_0x52adca['query']['filter']){_0x35f4dd['where']=_[_0x5472('0x52')](_0x35f4dd[_0x5472('0x48')],{'$or':_[_0x5472('0x31')](_0x35f4dd[_0x5472('0x40')],function(_0x1c08ad){var _0x26d30a={};_0x26d30a[_0x1c08ad]={'$like':'%'+_0x52adca[_0x5472('0x3d')]['filter']+'%'};return _0x26d30a;})});}_0x35f4dd=_[_0x5472('0x52')]({},_0x35f4dd,_0x52adca[_0x5472('0x4b')]);return _0x2e7d73[_0x5472('0x9a')](_0x35f4dd);}})['then'](function(_0x31db04){if(_0x31db04){_0x54c24d=_0x31db04[_0x5472('0x42')];if(!_0x52adca['query'][_0x5472('0x43')](_0x5472('0x44'))){_0x35f4dd[_0x5472('0x45')]=qs[_0x5472('0x45')](_0x52adca[_0x5472('0x3d')][_0x5472('0x45')]);_0x35f4dd[_0x5472('0x23')]=qs['offset'](_0x52adca[_0x5472('0x3d')][_0x5472('0x23')]);}return _0x2e7d73[_0x5472('0x9a')](_0x35f4dd);}})['then'](function(_0x197399){if(_0x197399){return _0x197399?{'count':_0x54c24d,'rows':_0x197399}:null;}})[_0x5472('0x29')](respondWithResult(_0x58c3eb,null))[_0x5472('0x50')](handleError(_0x58c3eb,null));};exports[_0x5472('0x9b')]=function(_0x55c567,_0x1d66f1,_0x15bc6f){var _0x36c645={};var _0x3f8358={};var _0x2897f3;var _0x251ef7;return db[_0x5472('0x39')]['findOne']({'where':{'id':_0x55c567[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x1d66f1,null))[_0x5472('0x29')](function(_0xdbd9d6){if(_0xdbd9d6){_0x2897f3=_0xdbd9d6;_0x3f8358[_0x5472('0x3b')]=_['keys'](db[_0x5472('0x7a')][_0x5472('0x3a')]);_0x3f8358[_0x5472('0x3d')]=_[_0x5472('0x3c')](_0x55c567[_0x5472('0x3d')]);_0x3f8358[_0x5472('0x3e')]=_['intersection'](_0x3f8358[_0x5472('0x3b')],_0x3f8358[_0x5472('0x3d')]);_0x36c645[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x3f8358[_0x5472('0x3b')],qs[_0x5472('0x41')](_0x55c567[_0x5472('0x3d')][_0x5472('0x41')]));_0x36c645['attributes']=_0x36c645[_0x5472('0x40')]['length']?_0x36c645[_0x5472('0x40')]:_0x3f8358[_0x5472('0x3b')];_0x36c645[_0x5472('0x46')]=qs['sort'](_0x55c567[_0x5472('0x3d')][_0x5472('0x47')]);_0x36c645[_0x5472('0x48')]=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0x55c567['query'],_0x3f8358['filters']));if(_0x55c567[_0x5472('0x3d')]['filter']){_0x36c645[_0x5472('0x48')]=_[_0x5472('0x52')](_0x36c645[_0x5472('0x48')],{'$or':_[_0x5472('0x31')](_0x36c645[_0x5472('0x40')],function(_0x16118e){var _0x20b4b1={};_0x20b4b1[_0x16118e]={'$like':'%'+_0x55c567[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x20b4b1;})});}_0x36c645=_[_0x5472('0x52')]({},_0x36c645,_0x55c567[_0x5472('0x4b')]);return _0x2897f3['getMembers'](_0x36c645);}})[_0x5472('0x29')](function(_0x5853ca){if(_0x5853ca){_0x251ef7=_0x5853ca[_0x5472('0x42')];if(!_0x55c567[_0x5472('0x3d')]['hasOwnProperty'](_0x5472('0x44'))){_0x36c645[_0x5472('0x45')]=qs['limit'](_0x55c567[_0x5472('0x3d')][_0x5472('0x45')]);_0x36c645['offset']=qs[_0x5472('0x23')](_0x55c567[_0x5472('0x3d')][_0x5472('0x23')]);}return _0x2897f3[_0x5472('0x9b')](_0x36c645);}})[_0x5472('0x29')](function(_0x55a4bc){return _0x55a4bc?{'count':_0x251ef7,'rows':_0x55a4bc}:null;})[_0x5472('0x29')](respondWithResult(_0x1d66f1,null))[_0x5472('0x50')](handleError(_0x1d66f1,null));};exports[_0x5472('0x9c')]=function(_0x32d8aa,_0x2e8a9f,_0x24f37e){var _0x2812c1={};var _0x2fbc49={};var _0x2487cf;var _0x12a65f;return db[_0x5472('0x39')][_0x5472('0x63')]({'where':{'id':_0x32d8aa['params']['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x2e8a9f,null))[_0x5472('0x29')](function(_0x425cd5){if(_0x425cd5){_0x2487cf=_0x425cd5;_0x2fbc49[_0x5472('0x3b')]=_[_0x5472('0x3c')](db['CmList'][_0x5472('0x3a')]);_0x2fbc49[_0x5472('0x3d')]=_[_0x5472('0x3c')](_0x32d8aa[_0x5472('0x3d')]);_0x2fbc49['filters']=_[_0x5472('0x3f')](_0x2fbc49[_0x5472('0x3b')],_0x2fbc49['query']);_0x2812c1[_0x5472('0x40')]=_[_0x5472('0x3f')](_0x2fbc49[_0x5472('0x3b')],qs['fields'](_0x32d8aa[_0x5472('0x3d')][_0x5472('0x41')]));_0x2812c1[_0x5472('0x40')]=_0x2812c1[_0x5472('0x40')][_0x5472('0x42')]?_0x2812c1[_0x5472('0x40')]:_0x2fbc49[_0x5472('0x3b')];_0x2812c1[_0x5472('0x46')]=qs[_0x5472('0x47')](_0x32d8aa[_0x5472('0x3d')][_0x5472('0x47')]);_0x2812c1[_0x5472('0x48')]=qs[_0x5472('0x3e')](_['pick'](_0x32d8aa[_0x5472('0x3d')],_0x2fbc49[_0x5472('0x3e')]));if(_0x32d8aa[_0x5472('0x3d')][_0x5472('0x2f')]){_0x2812c1[_0x5472('0x48')]=_['merge'](_0x2812c1['where'],{'$or':_[_0x5472('0x31')](_0x2812c1[_0x5472('0x40')],function(_0xda565c){var _0x8b7b2f={};_0x8b7b2f[_0xda565c]={'$like':'%'+_0x32d8aa[_0x5472('0x3d')]['filter']+'%'};return _0x8b7b2f;})});}_0x2812c1=_[_0x5472('0x52')]({},_0x2812c1,_0x32d8aa[_0x5472('0x4b')]);return _0x2487cf[_0x5472('0x9c')](_0x2812c1);}})[_0x5472('0x29')](function(_0x3b4e24){if(_0x3b4e24){_0x12a65f=_0x3b4e24['length'];if(!_0x32d8aa['query'][_0x5472('0x43')](_0x5472('0x44'))){_0x2812c1[_0x5472('0x45')]=qs['limit'](_0x32d8aa[_0x5472('0x3d')][_0x5472('0x45')]);_0x2812c1['offset']=qs[_0x5472('0x23')](_0x32d8aa['query'][_0x5472('0x23')]);}return _0x2487cf['getLists'](_0x2812c1);}})[_0x5472('0x29')](function(_0x162623){if(_0x162623){return _0x162623?{'count':_0x12a65f,'rows':_0x162623}:null;}})[_0x5472('0x29')](respondWithResult(_0x2e8a9f,null))[_0x5472('0x50')](handleError(_0x2e8a9f,null));};exports[_0x5472('0x9d')]=function(_0xa85848,_0x5c7ebd,_0x4e5c10){var _0x216dba,_0x2a1a8b;return db['VoiceQueue']['find']({'where':{'id':_0xa85848[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x5c7ebd,null))[_0x5472('0x29')](function(_0x38253a){if(_0x38253a){_0x2a1a8b=_0x38253a;return _0x38253a['addLists'](_0xa85848['body']['ids'],_['omit'](_0xa85848[_0x5472('0x55')],['ids','id'])||{});}return null;})['spread'](function(_0x21b35d){var _0x3ef5d9;_0x216dba=_0x21b35d||[];var _0x13b025=[];if(_0x21b35d){for(var _0x3bd2af=0x0;_0x3bd2af<_0x21b35d['length'];_0x3bd2af+=0x1){var _0x4e52ad=_0x21b35d[_0x3bd2af]['get']({'plain':!![]});_0x2a1a8b['dialCheckDuplicateType']=_0xa85848[_0x5472('0x55')]['dialCheckDuplicateType']?_0xa85848['body'][_0x5472('0x9e')]:_0x2a1a8b[_0x5472('0x9e')];switch(_0x2a1a8b[_0x5472('0x9e')]){case _0x5472('0x9f'):_0x3ef5d9=squel[_0x5472('0xa0')]()['into'](_0x5472('0xa1'))[_0x5472('0xa2')]([_0x5472('0xa3'),_0x5472('0xa4'),_0x5472('0xa5'),_0x5472('0xa6'),'VoiceQueueId',_0x5472('0x60'),_0x5472('0x61')],squel[_0x5472('0x85')]()[_0x5472('0x86')]('phone','phone')[_0x5472('0x86')](_0x5472('0xa7'),_0x5472('0xa4'))[_0x5472('0x86')]('id',_0x5472('0xa5'))['field'](_0x4e52ad[_0x5472('0xa8')][_0x5472('0x8c')](),_0x5472('0xa6'))[_0x5472('0x86')](_0xa85848['params']['id'][_0x5472('0x8c')](),_0x5472('0x68'))[_0x5472('0x86')]('NOW()',_0x5472('0x60'))['field']('NOW()',_0x5472('0x61'))[_0x5472('0x87')](_0x5472('0xa9'))[_0x5472('0x48')](_0x5472('0xaa'))[_0x5472('0x48')](_0x5472('0xab'),_0x4e52ad[_0x5472('0xa8')][_0x5472('0x8c')]())[_0x5472('0x48')](_0x5472('0xac'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x5472('0x85')]()[_0x5472('0x86')]('COALESCE(calleridnum,\x27\x27)')[_0x5472('0x87')]('cm_hopper_final')[_0x5472('0x48')](_0x5472('0x8b'),_0xa85848[_0x5472('0x51')]['id'][_0x5472('0x8c')]()))[_0x5472('0x48')](_0x5472('0xad'),squel[_0x5472('0x85')]()[_0x5472('0x86')](_0x5472('0xae'))[_0x5472('0x87')]('cm_hopper')['where'](_0x5472('0x8b'),_0xa85848[_0x5472('0x51')]['id']['toString']())))[_0x5472('0x8c')]();break;case _0x5472('0xaf'):_0x3ef5d9=squel[_0x5472('0xa0')]()['into'](_0x5472('0xa1'))[_0x5472('0xa2')]([_0x5472('0xa3'),'scheduledAt',_0x5472('0xa5'),_0x5472('0xa6'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x5472('0x85')]()[_0x5472('0x86')](_0x5472('0xa3'),_0x5472('0xa3'))['field']('NOW()',_0x5472('0xa4'))[_0x5472('0x86')]('id',_0x5472('0xa5'))['field'](_0x4e52ad[_0x5472('0xa8')][_0x5472('0x8c')](),_0x5472('0xa6'))[_0x5472('0x86')](_0xa85848[_0x5472('0x51')]['id']['toString'](),'VoiceQueueId')[_0x5472('0x86')]('NOW()','createdAt')['field']('NOW()',_0x5472('0x61'))[_0x5472('0x87')](_0x5472('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x5472('0x48')](_0x5472('0xab'),_0x4e52ad['CmListId'][_0x5472('0x8c')]())[_0x5472('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x5472('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5472('0x85')]()[_0x5472('0x86')]('COALESCE(phone,\x27\x27)')['from'](_0x5472('0xa1'))['where'](_0x5472('0x8b'),_0xa85848['params']['id'][_0x5472('0x8c')]())))[_0x5472('0x8c')]();break;default:_0x3ef5d9=squel[_0x5472('0xa0')]()[_0x5472('0xb0')](_0x5472('0xa1'))[_0x5472('0xa2')]([_0x5472('0xa3'),'scheduledAt',_0x5472('0xa5'),_0x5472('0xa6'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x5472('0x85')]()[_0x5472('0x86')](_0x5472('0xa3'),_0x5472('0xa3'))[_0x5472('0x86')](_0x5472('0xa7'),_0x5472('0xa4'))[_0x5472('0x86')]('id','ContactId')[_0x5472('0x86')](_0x4e52ad[_0x5472('0xa8')][_0x5472('0x8c')](),_0x5472('0xa6'))['field'](_0xa85848[_0x5472('0x51')]['id'][_0x5472('0x8c')](),_0x5472('0x68'))[_0x5472('0x86')](_0x5472('0xa7'),'createdAt')[_0x5472('0x86')](_0x5472('0xa7'),_0x5472('0x61'))[_0x5472('0x87')](_0x5472('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x5472('0x48')](_0x5472('0xab'),_0x4e52ad[_0x5472('0xa8')][_0x5472('0x8c')]())[_0x5472('0x48')](_0x5472('0xac')))[_0x5472('0x8c')]();}_0x13b025[_0x5472('0x97')](db[_0x5472('0x76')]['query'](_0x3ef5d9));}return BPromise[_0x5472('0x90')](_0x13b025);}})['then'](function(){return _0x216dba;})[_0x5472('0x29')](respondWithResult(_0x5c7ebd,null))[_0x5472('0x50')](handleError(_0x5c7ebd,null));};exports[_0x5472('0xb1')]=function(_0x280957,_0x2e3420,_0x11d931){return db[_0x5472('0x39')][_0x5472('0x53')]({'where':{'id':_0x280957[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x2e3420,null))[_0x5472('0x29')](function(_0x822c2e){if(_0x822c2e){return _0x822c2e[_0x5472('0xb1')](_0x280957[_0x5472('0x3d')][_0x5472('0x84')]);}})[_0x5472('0x29')](function(_0xb89c6e){if(_0xb89c6e){return db[_0x5472('0x65')]['destroy']({'where':{'ListId':_0x280957[_0x5472('0x3d')][_0x5472('0x84')],'VoiceQueueId':_0x280957[_0x5472('0x51')]['id']}})[_0x5472('0x29')](function(){return _0xb89c6e;});}})[_0x5472('0x29')](respondWithStatusCode(_0x2e3420,null))[_0x5472('0x50')](handleError(_0x2e3420,null));};exports[_0x5472('0xb2')]=function(_0x279728,_0x22c144,_0x3bf7b8){var _0x3511a7={};var _0x3b228d={};var _0x28295b;var _0x4b56d6;return db[_0x5472('0x39')]['findOne']({'where':{'id':_0x279728[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x22c144,null))[_0x5472('0x29')](function(_0x5ea60e){if(_0x5ea60e){_0x28295b=_0x5ea60e;_0x3b228d['model']=_['keys'](db[_0x5472('0xb3')][_0x5472('0x3a')]);_0x3b228d['query']=_['keys'](_0x279728['query']);_0x3b228d[_0x5472('0x3e')]=_[_0x5472('0x3f')](_0x3b228d['model'],_0x3b228d['query']);_0x3511a7[_0x5472('0x40')]=_['intersection'](_0x3b228d[_0x5472('0x3b')],qs['fields'](_0x279728[_0x5472('0x3d')][_0x5472('0x41')]));_0x3511a7[_0x5472('0x40')]=_0x3511a7[_0x5472('0x40')]['length']?_0x3511a7[_0x5472('0x40')]:_0x3b228d[_0x5472('0x3b')];_0x3511a7[_0x5472('0x46')]=qs['sort'](_0x279728[_0x5472('0x3d')][_0x5472('0x47')]);_0x3511a7['where']=qs[_0x5472('0x3e')](_[_0x5472('0x64')](_0x279728['query'],_0x3b228d[_0x5472('0x3e')]));if(_0x279728['query'][_0x5472('0x2f')]){_0x3511a7[_0x5472('0x48')]=_['merge'](_0x3511a7[_0x5472('0x48')],{'$or':_['map'](_0x3511a7['attributes'],function(_0xf4e572){var _0x12b451={};_0x12b451[_0xf4e572]={'$like':'%'+_0x279728[_0x5472('0x3d')][_0x5472('0x2f')]+'%'};return _0x12b451;})});}_0x3511a7=_[_0x5472('0x52')]({},_0x3511a7,_0x279728[_0x5472('0x4b')]);return _0x28295b[_0x5472('0xb2')](_0x3511a7);}})[_0x5472('0x29')](function(_0x953c8a){if(_0x953c8a){_0x4b56d6=_0x953c8a[_0x5472('0x42')];if(!_0x279728[_0x5472('0x3d')][_0x5472('0x43')](_0x5472('0x44'))){_0x3511a7[_0x5472('0x45')]=qs[_0x5472('0x45')](_0x279728[_0x5472('0x3d')][_0x5472('0x45')]);_0x3511a7[_0x5472('0x23')]=qs['offset'](_0x279728[_0x5472('0x3d')][_0x5472('0x23')]);}return _0x28295b['getBlackLists'](_0x3511a7);}})[_0x5472('0x29')](function(_0x4a49ea){if(_0x4a49ea){return _0x4a49ea?{'count':_0x4b56d6,'rows':_0x4a49ea}:null;}})[_0x5472('0x29')](respondWithResult(_0x22c144,null))[_0x5472('0x50')](handleError(_0x22c144,null));};exports[_0x5472('0xb4')]=function(_0x1fdfa0,_0x18b966,_0x1f82b9){var _0x1bfc30,_0x2191ba;return db[_0x5472('0x39')][_0x5472('0x53')]({'where':{'id':_0x1fdfa0[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x18b966,null))[_0x5472('0x29')](function(_0x17933a){if(_0x17933a){_0x2191ba=_0x17933a;return _0x17933a[_0x5472('0xb4')](_0x1fdfa0[_0x5472('0x55')]['ids'],_[_0x5472('0x5f')](_0x1fdfa0['body'],[_0x5472('0x84'),'id'])||{});}return null;})[_0x5472('0x96')](function(_0x24d154){var _0x2d9f35;_0x1bfc30=_0x24d154||[];var _0x70dd62=[];if(_0x24d154){for(var _0x2cfff8=0x0;_0x2cfff8<_0x24d154['length'];_0x2cfff8+=0x1){var _0x1f5c68=_0x24d154[_0x2cfff8][_0x5472('0x56')]({'plain':!![]});_0x2d9f35=squel['insert']()[_0x5472('0xb0')]('cm_hopper_black')[_0x5472('0xa2')]([_0x5472('0xa3'),_0x5472('0xa5'),_0x5472('0xa6'),'VoiceQueueId',_0x5472('0x60'),_0x5472('0x61')],squel['select']()['field'](_0x5472('0xa3'),_0x5472('0xa3'))[_0x5472('0x86')]('id',_0x5472('0xa5'))[_0x5472('0x86')](_0x1f5c68['CmListId'][_0x5472('0x8c')](),_0x5472('0xa6'))[_0x5472('0x86')](_0x1fdfa0[_0x5472('0x51')]['id'][_0x5472('0x8c')](),'VoiceQueueId')[_0x5472('0x86')](_0x5472('0xa7'),'createdAt')['field'](_0x5472('0xa7'),_0x5472('0x61'))[_0x5472('0x87')](_0x5472('0xa9'))[_0x5472('0x48')]('deletedAt\x20IS\x20NULL')[_0x5472('0x48')]('ListId\x20=\x20?',_0x1f5c68[_0x5472('0xa8')][_0x5472('0x8c')]())[_0x5472('0x48')](_0x5472('0xac')))[_0x5472('0x8c')]();_0x70dd62[_0x5472('0x97')](db[_0x5472('0x76')]['query'](_0x2d9f35));}return BPromise[_0x5472('0x90')](_0x70dd62);}})[_0x5472('0x29')](function(){return _0x1bfc30;})[_0x5472('0x29')](respondWithResult(_0x18b966,null))[_0x5472('0x50')](handleError(_0x18b966,null));};exports[_0x5472('0xb5')]=function(_0xfebd3c,_0x585028,_0x229806){return db[_0x5472('0x39')][_0x5472('0x53')]({'where':{'id':_0xfebd3c[_0x5472('0x51')]['id']}})[_0x5472('0x29')](handleEntityNotFound(_0x585028,null))['then'](function(_0x5dadfc){if(_0x5dadfc){return _0x5dadfc[_0x5472('0xb5')](_0xfebd3c[_0x5472('0x3d')]['ids']);}})[_0x5472('0x29')](function(_0x3dd699){if(_0x3dd699){return db['CmHopperBlack'][_0x5472('0x2a')]({'where':{'ListId':_0xfebd3c[_0x5472('0x3d')][_0x5472('0x84')],'VoiceQueueId':_0xfebd3c[_0x5472('0x51')]['id']}})[_0x5472('0x29')](function(){return _0x3dd699;});}})[_0x5472('0x29')](respondWithStatusCode(_0x585028,null))[_0x5472('0x50')](handleError(_0x585028,null));}; \ No newline at end of file +var _0xc4d0=['spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','NOW()','scheduledAt','CmListId','ListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','from','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','get','inbound','QueueCampaigns','outbound','filter','ignore','value','type','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','key','includeAll','include','findAll','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','user','UserProfileSection','findOne','CmHopper','rawAttributes','VoiceQueueId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents'];(function(_0x4a1052,_0x222370){var _0x454fa7=function(_0x1f6620){while(--_0x1f6620){_0x4a1052['push'](_0x4a1052['shift']());}};_0x454fa7(++_0x222370);}(_0xc4d0,0x194));var _0x0c4d=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0xc4d0[_0x3f578f];return _0x32c754;};'use strict';var pdf=require(_0x0c4d('0x0'));var emlformat=require(_0x0c4d('0x1'));var rimraf=require(_0x0c4d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c4d('0x3'));var rp=require(_0x0c4d('0x4'));var moment=require(_0x0c4d('0x5'));var BPromise=require(_0x0c4d('0x6'));var Mustache=require(_0x0c4d('0x7'));var util=require(_0x0c4d('0x8'));var path=require(_0x0c4d('0x9'));var sox=require(_0x0c4d('0xa'));var csv=require(_0x0c4d('0xb'));var ejs=require(_0x0c4d('0xc'));var fs=require('fs');var _=require(_0x0c4d('0xd'));var squel=require(_0x0c4d('0xe'));var crypto=require(_0x0c4d('0xf'));var jsforce=require(_0x0c4d('0x10'));var deskjs=require(_0x0c4d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0c4d('0x12'));var Papa=require('papaparse');var Redis=require(_0x0c4d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0c4d('0x14'));var hardwareService=require(_0x0c4d('0x15'));var logger=require(_0x0c4d('0x16'))('api');var utils=require(_0x0c4d('0x17'));var config=require(_0x0c4d('0x18'));var db=require('../../mysqldb')['db'];config[_0x0c4d('0x19')]=_[_0x0c4d('0x1a')](config[_0x0c4d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c4d('0x1b'))(new Redis(config[_0x0c4d('0x19')]));require(_0x0c4d('0x1c'))[_0x0c4d('0x1d')](socket);function respondWithStatusCode(_0x511027,_0x128b6b){_0x128b6b=_0x128b6b||0xcc;return function(_0x585346){if(_0x585346){return _0x511027[_0x0c4d('0x1e')](_0x128b6b);}return _0x511027['status'](_0x128b6b)[_0x0c4d('0x1f')]();};}function respondWithResult(_0x30185a,_0x331346){_0x331346=_0x331346||0xc8;return function(_0x20fe0f){if(_0x20fe0f){return _0x30185a[_0x0c4d('0x20')](_0x331346)[_0x0c4d('0x21')](_0x20fe0f);}};}function respondWithFilteredResult(_0x25af16,_0x3e6487){return function(_0x5a6803){if(_0x5a6803){var _0x46c7c5=_0x5a6803[_0x0c4d('0x22')],_0x424c93=_0x3e6487[_0x0c4d('0x23')],_0x5cfb2d=_0x3e6487[_0x0c4d('0x23')]+_0x3e6487[_0x0c4d('0x24')],_0x430e23;if(_0x5cfb2d>=_0x46c7c5){_0x5cfb2d=_0x46c7c5;_0x430e23=0xc8;}else{_0x430e23=0xce;}_0x25af16[_0x0c4d('0x20')](_0x430e23);return _0x25af16[_0x0c4d('0x25')]('Content-Range',_0x424c93+'-'+_0x5cfb2d+'/'+_0x46c7c5)[_0x0c4d('0x21')](_0x5a6803);}return null;};}function patchUpdates(_0xc21fdd){return function(_0x50f0dc){try{jsonpatch[_0x0c4d('0x26')](_0x50f0dc,_0xc21fdd,!![]);}catch(_0x590bc1){return BPromise['reject'](_0x590bc1);}return _0x50f0dc[_0x0c4d('0x27')]();};}function saveUpdates(_0x5f1b11,_0x192b9a){return function(_0x47ccb9){if(_0x47ccb9){return _0x47ccb9[_0x0c4d('0x28')](_0x5f1b11)['then'](function(_0x1c083a){return _0x1c083a;});}return null;};}function removeEntity(_0x4df1b6,_0xa0c259){return function(_0x5999ea){if(_0x5999ea){return _0x5999ea['destroy']()[_0x0c4d('0x29')](function(){var _0x5efba6=_0x5999ea[_0x0c4d('0x2a')]({'plain':!![]});var _0x3eb8e5=[{'name':'VoiceQueues','value':_0x0c4d('0x2b'),'ignore':![]},{'name':_0x0c4d('0x2c'),'value':_0x0c4d('0x2d'),'ignore':![]}];var _0x1ffa16=_(_0x3eb8e5)[_0x0c4d('0x2e')](_0x0c4d('0x2f'))['map'](_0x0c4d('0x30'))[_0x0c4d('0x30')]();if(_['includes'](_0x1ffa16,_0x5efba6[_0x0c4d('0x31')])){return;}var _0x10845b=_['find'](_0x3eb8e5,[_0x0c4d('0x30'),_0x5efba6['type']])[_0x0c4d('0x32')];return db[_0x0c4d('0x33')][_0x0c4d('0x34')]({'where':{'type':_0x10845b,'resourceId':_0x5efba6['id']}})[_0x0c4d('0x29')](function(){return _0x5999ea;});})[_0x0c4d('0x29')](function(){_0x4df1b6[_0x0c4d('0x20')](0xcc)[_0x0c4d('0x1f')]();});}};}function handleEntityNotFound(_0xbecdcc,_0xd6f937){return function(_0x584903){if(!_0x584903){_0xbecdcc['sendStatus'](0x194);}return _0x584903;};}function handleError(_0x20c09f,_0x49926e){_0x49926e=_0x49926e||0x1f4;return function(_0x268b8f){logger[_0x0c4d('0x35')](_0x268b8f[_0x0c4d('0x36')]);if(_0x268b8f['name']){delete _0x268b8f[_0x0c4d('0x32')];}_0x20c09f['status'](_0x49926e)['send'](_0x268b8f);};}exports[_0x0c4d('0x37')]=function(_0xf8eb0b,_0x36c679){var _0x5f52cf={},_0x5c7fbe={},_0x4ae020={'count':0x0,'rows':[]};var _0xe8dcdf=db[_0x0c4d('0x38')]['rawAttributes'];_0x5c7fbe['model']=_['keys'](_0xe8dcdf);_0x5c7fbe['query']=_[_0x0c4d('0x39')](_0xf8eb0b[_0x0c4d('0x3a')]);_0x5c7fbe['filters']=_[_0x0c4d('0x3b')](_0x5c7fbe['model'],_0x5c7fbe[_0x0c4d('0x3a')]);_0x5f52cf['attributes']=_['intersection'](_0x5c7fbe[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0xf8eb0b[_0x0c4d('0x3a')]['fields']));_0x5f52cf[_0x0c4d('0x3e')]=_0x5f52cf[_0x0c4d('0x3e')][_0x0c4d('0x3f')]?_0x5f52cf[_0x0c4d('0x3e')]:_0x5c7fbe[_0x0c4d('0x3c')];if(!_0xf8eb0b[_0x0c4d('0x3a')][_0x0c4d('0x40')](_0x0c4d('0x41'))){_0x5f52cf[_0x0c4d('0x24')]=qs[_0x0c4d('0x24')](_0xf8eb0b[_0x0c4d('0x3a')][_0x0c4d('0x24')]);_0x5f52cf[_0x0c4d('0x23')]=qs[_0x0c4d('0x23')](_0xf8eb0b[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}_0x5f52cf[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0xf8eb0b[_0x0c4d('0x3a')][_0x0c4d('0x43')]);_0x5f52cf[_0x0c4d('0x44')]=qs[_0x0c4d('0x45')](_[_0x0c4d('0x46')](_0xf8eb0b[_0x0c4d('0x3a')],_0x5c7fbe[_0x0c4d('0x45')]));if(_0xf8eb0b[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x5f52cf[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0x5f52cf[_0x0c4d('0x44')],{'$or':_[_0x0c4d('0x48')](_0xe8dcdf,function(_0x33952a){if(_0x33952a[_0x0c4d('0x31')][_0x0c4d('0x49')]!=='VIRTUAL'){var _0x8aa1f6={};_0x8aa1f6[_0x33952a['field']]={'$like':'%'+_0xf8eb0b[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0x8aa1f6;}})});}_0x5f52cf=_[_0x0c4d('0x47')]({},_0x5f52cf,_0xf8eb0b['options']);var _0x87be19={'where':_0x5f52cf[_0x0c4d('0x44')]};return db[_0x0c4d('0x38')][_0x0c4d('0x22')](_0x87be19)[_0x0c4d('0x29')](function(_0x4b475d){_0x4ae020[_0x0c4d('0x22')]=_0x4b475d;if(_0xf8eb0b['query'][_0x0c4d('0x4a')]){_0x5f52cf[_0x0c4d('0x4b')]=[{'all':!![]}];}return db[_0x0c4d('0x38')][_0x0c4d('0x4c')](_0x5f52cf);})['then'](function(_0x1d5582){_0x4ae020['rows']=_0x1d5582;return _0x4ae020;})[_0x0c4d('0x29')](respondWithFilteredResult(_0x36c679,_0x5f52cf))[_0x0c4d('0x4d')](handleError(_0x36c679,null));};exports[_0x0c4d('0x4e')]=function(_0xa4cff0,_0xeea9b5){var _0x206452={'raw':![],'where':{'id':_0xa4cff0[_0x0c4d('0x4f')]['id']}},_0x1a9ab8={};_0x1a9ab8[_0x0c4d('0x3c')]=_[_0x0c4d('0x39')](db[_0x0c4d('0x38')]['rawAttributes']);_0x1a9ab8[_0x0c4d('0x3a')]=_[_0x0c4d('0x39')](_0xa4cff0['query']);_0x1a9ab8[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x1a9ab8[_0x0c4d('0x3c')],_0x1a9ab8[_0x0c4d('0x3a')]);_0x206452[_0x0c4d('0x3e')]=_[_0x0c4d('0x3b')](_0x1a9ab8[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0xa4cff0[_0x0c4d('0x3a')][_0x0c4d('0x3d')]));_0x206452[_0x0c4d('0x3e')]=_0x206452['attributes'][_0x0c4d('0x3f')]?_0x206452[_0x0c4d('0x3e')]:_0x1a9ab8['model'];if(_0xa4cff0[_0x0c4d('0x3a')][_0x0c4d('0x4a')]){_0x206452[_0x0c4d('0x4b')]=[{'all':!![]}];}_0x206452=_[_0x0c4d('0x47')]({},_0x206452,_0xa4cff0[_0x0c4d('0x50')]);return db[_0x0c4d('0x38')][_0x0c4d('0x51')](_0x206452)['then'](handleEntityNotFound(_0xeea9b5,null))[_0x0c4d('0x29')](respondWithResult(_0xeea9b5,null))[_0x0c4d('0x4d')](handleError(_0xeea9b5,null));};exports['create']=function(_0x4058d7,_0x56869c){return db[_0x0c4d('0x38')][_0x0c4d('0x52')](_0x4058d7[_0x0c4d('0x53')],{})[_0x0c4d('0x29')](function(_0x491f06){var _0x35abb2=_0x4058d7['user'][_0x0c4d('0x2a')]({'plain':!![]});if(!_0x35abb2)throw new Error(_0x0c4d('0x54'));if(_0x35abb2[_0x0c4d('0x55')]==='user'){var _0x5781bc=_0x491f06['get']({'plain':!![]});var _0x11da1c=[{'name':_0x0c4d('0x56'),'value':_0x0c4d('0x2b')},{'name':_0x0c4d('0x2c'),'value':_0x0c4d('0x2d')}];var _0x526042=_['find'](_0x11da1c,[_0x0c4d('0x30'),_0x5781bc['type']])['name'];return db['UserProfileSection'][_0x0c4d('0x51')]({'where':{'name':_0x526042,'userProfileId':_0x35abb2[_0x0c4d('0x57')]},'raw':!![]})[_0x0c4d('0x29')](function(_0x23c4ff){if(_0x23c4ff&&_0x23c4ff[_0x0c4d('0x58')]===0x0){return db['UserProfileResource'][_0x0c4d('0x52')]({'name':_0x5781bc[_0x0c4d('0x32')],'resourceId':_0x5781bc['id'],'type':_0x23c4ff[_0x0c4d('0x32')],'sectionId':_0x23c4ff['id']},{})[_0x0c4d('0x29')](function(){return _0x491f06;});}else{return _0x491f06;}})[_0x0c4d('0x4d')](function(_0x3f4b22){logger[_0x0c4d('0x35')](_0x0c4d('0x59'),_0x3f4b22);throw _0x3f4b22;});}return _0x491f06;})['then'](respondWithResult(_0x56869c,0xc9))['catch'](handleError(_0x56869c,null));};exports[_0x0c4d('0x5a')]=function(_0x295ebf,_0x3b8b5c){var _0x508d6d={'raw':![],'where':{'id':_0x295ebf[_0x0c4d('0x4f')]['id']}},_0x44871a={};_0x44871a['model']=_[_0x0c4d('0x39')](db[_0x0c4d('0x38')]['rawAttributes']);_0x508d6d[_0x0c4d('0x3e')]=_[_0x0c4d('0x3b')](_0x44871a['model'],qs['fields'](_0x295ebf[_0x0c4d('0x3a')][_0x0c4d('0x3d')]));_0x508d6d[_0x0c4d('0x3e')]=_0x508d6d[_0x0c4d('0x3e')]['length']?_0x508d6d['attributes']:_0x44871a[_0x0c4d('0x3c')];if(_0x295ebf['query'][_0x0c4d('0x4a')]){_0x508d6d[_0x0c4d('0x4b')]=[{'all':!![]}];}_0x508d6d=_[_0x0c4d('0x47')]({},_0x508d6d,_0x295ebf[_0x0c4d('0x50')]);return db[_0x0c4d('0x38')][_0x0c4d('0x51')](_0x508d6d)['then'](handleEntityNotFound(_0x3b8b5c,null))[_0x0c4d('0x29')](function(_0x264428){if(_0x264428){var _0x25d245=_0x264428['get']({'plain':!![]});_0x25d245=qs['omit'](_0x25d245,['id',_0x0c4d('0x5b'),_0x0c4d('0x5c')]);_0x295ebf[_0x0c4d('0x53')]=_[_0x0c4d('0x5d')](_0x295ebf['body'],['id','createdAt',_0x0c4d('0x5c')]);return db['VoiceQueue']['create'](_[_0x0c4d('0x47')](_0x25d245,_0x295ebf[_0x0c4d('0x53')]),{'include':_0x295ebf[_0x0c4d('0x3a')][_0x0c4d('0x4a')]?[{'all':!![]}]:undefined})[_0x0c4d('0x29')](function(_0x17c520){var _0x3631a5=_0x295ebf[_0x0c4d('0x5e')]['get']({'plain':!![]});if(!_0x3631a5)throw new Error(_0x0c4d('0x54'));if(_0x3631a5[_0x0c4d('0x55')]===_0x0c4d('0x5e')){var _0x2a4ebb=_0x17c520[_0x0c4d('0x2a')]({'plain':!![]});var _0x2c68a3=[{'name':_0x0c4d('0x56'),'value':_0x0c4d('0x2b')},{'name':_0x0c4d('0x2c'),'value':_0x0c4d('0x2d')}];var _0x4a8995=_[_0x0c4d('0x51')](_0x2c68a3,['value',_0x2a4ebb[_0x0c4d('0x31')]])['name'];return db[_0x0c4d('0x5f')]['find']({'where':{'name':_0x4a8995,'userProfileId':_0x3631a5[_0x0c4d('0x57')]},'raw':!![]})[_0x0c4d('0x29')](function(_0x23596e){if(_0x23596e&&_0x23596e['autoAssociation']===0x0){return db[_0x0c4d('0x33')][_0x0c4d('0x52')]({'name':_0x2a4ebb['name'],'resourceId':_0x2a4ebb['id'],'type':_0x23596e['name'],'sectionId':_0x23596e['id']},{})[_0x0c4d('0x29')](function(){return _0x17c520;});}else{return _0x17c520;}})[_0x0c4d('0x4d')](function(_0x48eb52){logger[_0x0c4d('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48eb52);throw _0x48eb52;});}return _0x17c520;});}})[_0x0c4d('0x29')](respondWithResult(_0x3b8b5c,0xc9))[_0x0c4d('0x4d')](handleError(_0x3b8b5c,null));};exports[_0x0c4d('0x28')]=function(_0x15cf6f,_0x142c65){if(_0x15cf6f[_0x0c4d('0x53')]['id']){delete _0x15cf6f[_0x0c4d('0x53')]['id'];}return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x15cf6f['params']['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x142c65,null))[_0x0c4d('0x29')](saveUpdates(_0x15cf6f[_0x0c4d('0x53')],null))['then'](respondWithResult(_0x142c65,null))['catch'](handleError(_0x142c65,null));};exports[_0x0c4d('0x34')]=function(_0x4d3b6b,_0x2d2280){return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x4d3b6b[_0x0c4d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d2280,null))[_0x0c4d('0x29')](removeEntity(_0x2d2280,null))[_0x0c4d('0x4d')](handleError(_0x2d2280,null));};exports['getHoppers']=function(_0x31ed6f,_0x12d243,_0x36e77b){var _0x5a4275={'raw':![],'where':{}};var _0x314d01={};var _0x2411ac={'count':0x0,'rows':[]};return db[_0x0c4d('0x38')][_0x0c4d('0x60')]({'where':{'id':_0x31ed6f[_0x0c4d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x12d243,null))[_0x0c4d('0x29')](function(_0x2e910d){if(_0x2e910d){_0x314d01['model']=_['keys'](db[_0x0c4d('0x61')][_0x0c4d('0x62')]);_0x314d01[_0x0c4d('0x3a')]=_[_0x0c4d('0x39')](_0x31ed6f['query']);_0x314d01[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x314d01[_0x0c4d('0x3c')],_0x314d01[_0x0c4d('0x3a')]);_0x5a4275['attributes']=_['intersection'](_0x314d01[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x31ed6f[_0x0c4d('0x3a')]['fields']));_0x5a4275[_0x0c4d('0x3e')]=_0x5a4275[_0x0c4d('0x3e')][_0x0c4d('0x3f')]?_0x5a4275[_0x0c4d('0x3e')]:_0x314d01[_0x0c4d('0x3c')];if(!_0x31ed6f['query'][_0x0c4d('0x40')](_0x0c4d('0x41'))){_0x5a4275[_0x0c4d('0x24')]=qs[_0x0c4d('0x24')](_0x31ed6f['query']['limit']);_0x5a4275[_0x0c4d('0x23')]=qs[_0x0c4d('0x23')](_0x31ed6f[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}_0x5a4275[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0x31ed6f['query'][_0x0c4d('0x43')]);_0x5a4275[_0x0c4d('0x44')]=qs[_0x0c4d('0x45')](_['pick'](_0x31ed6f['query'],_0x314d01[_0x0c4d('0x45')]));_0x5a4275['where'][_0x0c4d('0x63')]=_0x2e910d['id'];if(_0x31ed6f[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x5a4275[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0x5a4275['where'],{'$or':_[_0x0c4d('0x48')](_0x5a4275['attributes'],function(_0x2b9f32){var _0x1fb3cf={};_0x1fb3cf[_0x2b9f32]={'$like':'%'+_0x31ed6f[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0x1fb3cf;})});}_0x5a4275=_['merge']({},_0x5a4275,_0x31ed6f['options']);return db[_0x0c4d('0x61')]['count']({'where':_0x5a4275[_0x0c4d('0x44')]})[_0x0c4d('0x29')](function(_0x50e05c){_0x2411ac[_0x0c4d('0x22')]=_0x50e05c;if(_0x31ed6f[_0x0c4d('0x3a')]['includeAll']){_0x5a4275[_0x0c4d('0x4b')]=[{'all':!![]}];}return db[_0x0c4d('0x61')][_0x0c4d('0x4c')](_0x5a4275);})['then'](function(_0x4b2276){_0x2411ac['rows']=_0x4b2276;return _0x2411ac;});}})[_0x0c4d('0x29')](respondWithFilteredResult(_0x12d243,_0x5a4275))[_0x0c4d('0x4d')](handleError(_0x12d243,null));};exports[_0x0c4d('0x64')]=function(_0xdc2caf,_0x1064b0,_0x3fd719){var _0x112783={'raw':!![],'where':{}};var _0x43bd92={};var _0x1cee7f={'count':0x0,'rows':[]};return db[_0x0c4d('0x38')][_0x0c4d('0x60')]({'where':{'id':_0xdc2caf[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x1064b0,null))[_0x0c4d('0x29')](function(_0x15c7f6){if(_0x15c7f6){_0x43bd92[_0x0c4d('0x3c')]=_['keys'](db[_0x0c4d('0x65')][_0x0c4d('0x62')]);_0x43bd92[_0x0c4d('0x3a')]=_[_0x0c4d('0x39')](_0xdc2caf[_0x0c4d('0x3a')]);_0x43bd92[_0x0c4d('0x45')]=_['intersection'](_0x43bd92[_0x0c4d('0x3c')],_0x43bd92[_0x0c4d('0x3a')]);_0x112783[_0x0c4d('0x3e')]=_[_0x0c4d('0x3b')](_0x43bd92['model'],qs[_0x0c4d('0x3d')](_0xdc2caf[_0x0c4d('0x3a')][_0x0c4d('0x3d')]));_0x112783[_0x0c4d('0x3e')]=_0x112783[_0x0c4d('0x3e')]['length']?_0x112783[_0x0c4d('0x3e')]:_0x43bd92[_0x0c4d('0x3c')];if(!_0xdc2caf[_0x0c4d('0x3a')][_0x0c4d('0x40')](_0x0c4d('0x41'))){_0x112783['limit']=qs['limit'](_0xdc2caf[_0x0c4d('0x3a')][_0x0c4d('0x24')]);_0x112783['offset']=qs[_0x0c4d('0x23')](_0xdc2caf[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}_0x112783[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0xdc2caf[_0x0c4d('0x3a')][_0x0c4d('0x43')]);_0x112783['where']=qs[_0x0c4d('0x45')](_['pick'](_0xdc2caf[_0x0c4d('0x3a')],_0x43bd92[_0x0c4d('0x45')]));_0x112783[_0x0c4d('0x44')][_0x0c4d('0x63')]=_0x15c7f6['id'];if(_0xdc2caf[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x112783[_0x0c4d('0x44')]=_['merge'](_0x112783[_0x0c4d('0x44')],{'$or':_[_0x0c4d('0x48')](_0x112783[_0x0c4d('0x3e')],function(_0x1ebde6){var _0x5c7fd0={};_0x5c7fd0[_0x1ebde6]={'$like':'%'+_0xdc2caf['query'][_0x0c4d('0x2e')]+'%'};return _0x5c7fd0;})});}_0x112783=_[_0x0c4d('0x47')]({},_0x112783,_0xdc2caf[_0x0c4d('0x50')]);return db[_0x0c4d('0x65')][_0x0c4d('0x22')]({'where':_0x112783[_0x0c4d('0x44')]})[_0x0c4d('0x29')](function(_0x1caf1c){_0x1cee7f[_0x0c4d('0x22')]=_0x1caf1c;if(_0xdc2caf['query']['includeAll']){_0x112783['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0c4d('0x4c')](_0x112783);})['then'](function(_0x4e1609){_0x1cee7f[_0x0c4d('0x66')]=_0x4e1609;return _0x1cee7f;});}})[_0x0c4d('0x29')](respondWithFilteredResult(_0x1064b0,_0x112783))[_0x0c4d('0x4d')](handleError(_0x1064b0,null));};exports[_0x0c4d('0x67')]=function(_0x47ad5e,_0x337fc9,_0xc3d1be){var _0x20c899={'raw':!![],'where':{}};var _0x136592={};var _0x490531={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0c4d('0x60')]({'where':{'id':_0x47ad5e[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x337fc9,null))[_0x0c4d('0x29')](function(_0x43f7f0){if(_0x43f7f0){_0x136592['model']=_[_0x0c4d('0x39')](db[_0x0c4d('0x68')][_0x0c4d('0x62')]);_0x136592[_0x0c4d('0x3a')]=_['keys'](_0x47ad5e[_0x0c4d('0x3a')]);_0x136592[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x136592[_0x0c4d('0x3c')],_0x136592[_0x0c4d('0x3a')]);_0x20c899['attributes']=_['intersection'](_0x136592[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x47ad5e['query']['fields']));_0x20c899[_0x0c4d('0x3e')]=_0x20c899[_0x0c4d('0x3e')]['length']?_0x20c899[_0x0c4d('0x3e')]:_0x136592[_0x0c4d('0x3c')];if(!_0x47ad5e['query']['hasOwnProperty']('nolimit')){_0x20c899[_0x0c4d('0x24')]=qs[_0x0c4d('0x24')](_0x47ad5e['query'][_0x0c4d('0x24')]);_0x20c899[_0x0c4d('0x23')]=qs[_0x0c4d('0x23')](_0x47ad5e[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}_0x20c899['order']=qs[_0x0c4d('0x43')](_0x47ad5e[_0x0c4d('0x3a')][_0x0c4d('0x43')]);_0x20c899[_0x0c4d('0x44')]=qs[_0x0c4d('0x45')](_[_0x0c4d('0x46')](_0x47ad5e['query'],_0x136592[_0x0c4d('0x45')]));_0x20c899[_0x0c4d('0x44')][_0x0c4d('0x63')]=_0x43f7f0['id'];if(_0x47ad5e[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x20c899[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0x20c899[_0x0c4d('0x44')],{'$or':_[_0x0c4d('0x48')](_0x20c899[_0x0c4d('0x3e')],function(_0x5c28f3){var _0x57b294={};_0x57b294[_0x5c28f3]={'$like':'%'+_0x47ad5e[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0x57b294;})});}_0x20c899=_[_0x0c4d('0x47')]({},_0x20c899,_0x47ad5e[_0x0c4d('0x50')]);return db[_0x0c4d('0x68')][_0x0c4d('0x22')]({'where':_0x20c899[_0x0c4d('0x44')]})['then'](function(_0x37304f){_0x490531['count']=_0x37304f;if(_0x47ad5e[_0x0c4d('0x3a')][_0x0c4d('0x4a')]){_0x20c899[_0x0c4d('0x4b')]=[{'all':!![]}];}return db[_0x0c4d('0x68')]['findAll'](_0x20c899);})[_0x0c4d('0x29')](function(_0x398b16){_0x490531[_0x0c4d('0x66')]=_0x398b16;return _0x490531;});}})['then'](respondWithFilteredResult(_0x337fc9,_0x20c899))[_0x0c4d('0x4d')](handleError(_0x337fc9,null));};exports[_0x0c4d('0x69')]=function(_0x10441e,_0x2b3ded,_0x4f1f47){var _0x1fdd04={'raw':!![],'where':{}};var _0x108f8e={};var _0x22031f={'count':0x0,'rows':[]};return db[_0x0c4d('0x38')][_0x0c4d('0x60')]({'where':{'id':_0x10441e[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x2b3ded,null))[_0x0c4d('0x29')](function(_0x20371a){if(_0x20371a){_0x108f8e[_0x0c4d('0x3c')]=_[_0x0c4d('0x39')](db[_0x0c4d('0x6a')]['rawAttributes']);_0x108f8e['query']=_[_0x0c4d('0x39')](_0x10441e[_0x0c4d('0x3a')]);_0x108f8e[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x108f8e[_0x0c4d('0x3c')],_0x108f8e[_0x0c4d('0x3a')]);_0x1fdd04[_0x0c4d('0x3e')]=_['intersection'](_0x108f8e[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x10441e[_0x0c4d('0x3a')][_0x0c4d('0x3d')]));_0x1fdd04[_0x0c4d('0x3e')]=_0x1fdd04[_0x0c4d('0x3e')][_0x0c4d('0x3f')]?_0x1fdd04[_0x0c4d('0x3e')]:_0x108f8e[_0x0c4d('0x3c')];if(!_0x10441e[_0x0c4d('0x3a')][_0x0c4d('0x40')](_0x0c4d('0x41'))){_0x1fdd04[_0x0c4d('0x24')]=qs['limit'](_0x10441e[_0x0c4d('0x3a')][_0x0c4d('0x24')]);_0x1fdd04['offset']=qs[_0x0c4d('0x23')](_0x10441e[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}_0x1fdd04[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0x10441e[_0x0c4d('0x3a')][_0x0c4d('0x43')]);_0x1fdd04[_0x0c4d('0x44')]=qs[_0x0c4d('0x45')](_[_0x0c4d('0x46')](_0x10441e[_0x0c4d('0x3a')],_0x108f8e[_0x0c4d('0x45')]));_0x1fdd04[_0x0c4d('0x44')][_0x0c4d('0x63')]=_0x20371a['id'];if(_0x10441e['query'][_0x0c4d('0x2e')]){_0x1fdd04[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0x1fdd04['where'],{'$or':_[_0x0c4d('0x48')](_0x1fdd04[_0x0c4d('0x3e')],function(_0x444b3b){var _0x3cc1c6={};_0x3cc1c6[_0x444b3b]={'$like':'%'+_0x10441e[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0x3cc1c6;})});}_0x1fdd04=_['merge']({},_0x1fdd04,_0x10441e[_0x0c4d('0x50')]);return db[_0x0c4d('0x6a')][_0x0c4d('0x22')]({'where':_0x1fdd04[_0x0c4d('0x44')]})[_0x0c4d('0x29')](function(_0x3900c1){_0x22031f[_0x0c4d('0x22')]=_0x3900c1;if(_0x10441e['query'][_0x0c4d('0x4a')]){_0x1fdd04[_0x0c4d('0x4b')]=[{'all':!![]}];}return db[_0x0c4d('0x6a')]['findAll'](_0x1fdd04);})[_0x0c4d('0x29')](function(_0x25316b){_0x22031f[_0x0c4d('0x66')]=_0x25316b;return _0x22031f;});}})[_0x0c4d('0x29')](respondWithFilteredResult(_0x2b3ded,_0x1fdd04))['catch'](handleError(_0x2b3ded,null));};exports[_0x0c4d('0x6b')]=function(_0x473cd6,_0x3d5237,_0x424d20){var _0x12f99e={};var _0x4e7e9c={};var _0x34d0f8;var _0x846e80;return db['VoiceQueue']['findOne']({'where':{'id':_0x473cd6[_0x0c4d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d5237,null))['then'](function(_0x585fba){if(_0x585fba){_0x34d0f8=_0x585fba;_0x4e7e9c[_0x0c4d('0x3c')]=_['keys'](db[_0x0c4d('0x6c')][_0x0c4d('0x62')]);_0x4e7e9c['query']=_[_0x0c4d('0x39')](_0x473cd6['query']);_0x4e7e9c[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x4e7e9c[_0x0c4d('0x3c')],_0x4e7e9c[_0x0c4d('0x3a')]);_0x12f99e[_0x0c4d('0x3e')]=_[_0x0c4d('0x3b')](_0x4e7e9c[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x473cd6['query'][_0x0c4d('0x3d')]));_0x12f99e[_0x0c4d('0x3e')]=_0x12f99e['attributes'][_0x0c4d('0x3f')]?_0x12f99e[_0x0c4d('0x3e')]:_0x4e7e9c[_0x0c4d('0x3c')];_0x12f99e['order']=qs[_0x0c4d('0x43')](_0x473cd6['query'][_0x0c4d('0x43')]);_0x12f99e[_0x0c4d('0x44')]=qs[_0x0c4d('0x45')](_[_0x0c4d('0x46')](_0x473cd6[_0x0c4d('0x3a')],_0x4e7e9c[_0x0c4d('0x45')]));if(_0x473cd6[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x12f99e['where']=_[_0x0c4d('0x47')](_0x12f99e[_0x0c4d('0x44')],{'$or':_[_0x0c4d('0x48')](_0x12f99e['attributes'],function(_0x18b0db){var _0x21e1d7={};_0x21e1d7[_0x18b0db]={'$like':'%'+_0x473cd6[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0x21e1d7;})});}_0x12f99e=_['merge']({},_0x12f99e,_0x473cd6['options']);return _0x34d0f8[_0x0c4d('0x6b')](_0x12f99e);}})[_0x0c4d('0x29')](function(_0x1627bd){if(_0x1627bd){_0x846e80=_0x1627bd[_0x0c4d('0x3f')];if(!_0x473cd6[_0x0c4d('0x3a')][_0x0c4d('0x40')](_0x0c4d('0x41'))){_0x12f99e[_0x0c4d('0x24')]=qs['limit'](_0x473cd6[_0x0c4d('0x3a')][_0x0c4d('0x24')]);_0x12f99e[_0x0c4d('0x23')]=qs[_0x0c4d('0x23')](_0x473cd6[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}return _0x34d0f8[_0x0c4d('0x6b')](_0x12f99e);}})[_0x0c4d('0x29')](function(_0x3bdff6){if(_0x3bdff6){return _0x3bdff6?{'count':_0x846e80,'rows':_0x3bdff6}:null;}})[_0x0c4d('0x29')](respondWithResult(_0x3d5237,null))['catch'](handleError(_0x3d5237,null));};exports[_0x0c4d('0x6d')]=function(_0x338817,_0x358d1b,_0x4bf812){var _0x3bdc6c=_0x338817[_0x0c4d('0x53')]['teams'];return db[_0x0c4d('0x6c')][_0x0c4d('0x4c')]({'where':{'id':_['map'](_0x3bdc6c,'id')},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0c4d('0x6e'),'attributes':['id',_0x0c4d('0x32'),_0x0c4d('0x6f'),_0x0c4d('0x70'),'interface'],'raw':!![]}]})[_0x0c4d('0x29')](function(_0x1957b8){if(_0x1957b8){var _0x48fce4=_[_0x0c4d('0x71')](_0x1957b8,function(_0x5114b5){var _0x3ba070=_0x5114b5[_0x0c4d('0x2a')]({'plain':!![]});_0x3ba070[_0x0c4d('0x6e')][_0x0c4d('0x72')](function(_0x2000f1){_0x2000f1[_0x0c4d('0x73')]=_[_0x0c4d('0x51')](_0x3bdc6c,{'id':_0x3ba070['id']})[_0x0c4d('0x73')];});return _0x3ba070[_0x0c4d('0x6e')];});return db[_0x0c4d('0x38')]['find']({'where':{'id':_0x338817[_0x0c4d('0x4f')]['id']}})['then'](function(_0x57122c){return db[_0x0c4d('0x74')][_0x0c4d('0x75')](function(_0x3ca9de){return _0x57122c[_0x0c4d('0x6d')](_[_0x0c4d('0x48')](_0x3bdc6c,'id'),{'transaction':_0x3ca9de})[_0x0c4d('0x29')](function(){return BPromise[_0x0c4d('0x76')](_0x48fce4,function(_0x5c6913){return db[_0x0c4d('0x77')][_0x0c4d('0x78')]({'where':{'UserId':_0x5c6913['id'],'VoiceQueueId':_0x338817[_0x0c4d('0x4f')]['id']},'defaults':{'penalty':_0x5c6913[_0x0c4d('0x73')]},'transaction':_0x3ca9de});});})[_0x0c4d('0x29')](function(){return BPromise[_0x0c4d('0x76')](_[_0x0c4d('0x2e')](_0x48fce4,{'online':!![]}),function(_0xc27a29){return db[_0x0c4d('0x79')][_0x0c4d('0x7a')]({'membername':_0xc27a29[_0x0c4d('0x32')],'UserId':_0xc27a29['id'],'queue_name':_0x57122c[_0x0c4d('0x32')],'VoiceQueueId':_0x57122c['id'],'interface':_[_0x0c4d('0x7b')](_0xc27a29[_0x0c4d('0x7c')])?util[_0x0c4d('0x7d')](_0x0c4d('0x7e'),_0xc27a29['name']):_0xc27a29[_0x0c4d('0x7c')],'paused':_0xc27a29[_0x0c4d('0x70')]||![],'penalty':_0xc27a29[_0x0c4d('0x73')]},{'transaction':_0x3ca9de});});})[_0x0c4d('0x29')](function(){_0x48fce4[_0x0c4d('0x72')](function(_0x40992e){socket[_0x0c4d('0x7f')](_0x0c4d('0x80'),{'UserId':_0x40992e['id'],'VoiceQueueId':_0x57122c['id']});});});});});}})[_0x0c4d('0x29')](respondWithStatusCode(_0x358d1b,null))[_0x0c4d('0x4d')](handleError(_0x358d1b,null));};exports[_0x0c4d('0x81')]=function(_0x213417,_0x593a20,_0x353c77){return db[_0x0c4d('0x6c')][_0x0c4d('0x4c')]({'where':{'id':_0x213417[_0x0c4d('0x3a')][_0x0c4d('0x82')]},'attributes':['id'],'include':[{'model':db[_0x0c4d('0x83')],'as':_0x0c4d('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x0c4d('0x29')](handleEntityNotFound(_0x593a20,null))[_0x0c4d('0x29')](function(_0x1e57dc){var _0x36ab47=_[_0x0c4d('0x48')](_0x1e57dc,'id');var _0x2ec3ea=[];var _0x418492=[];var _0x428a03=squel[_0x0c4d('0x84')]();_0x428a03[_0x0c4d('0x85')](_0x0c4d('0x86'))['from'](_0x0c4d('0x87'),'tq')[_0x0c4d('0x88')](_0x0c4d('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0c4d('0x8a'),_0x213417[_0x0c4d('0x4f')]['id']);for(var _0x18b6f5=0x0;_0x18b6f5<_0x1e57dc[_0x0c4d('0x3f')];_0x18b6f5+=0x1){let _0x27cc3f=_0x1e57dc[_0x18b6f5];for(var _0x4785b1=0x0;_0x4785b1<_0x27cc3f[_0x0c4d('0x6e')]['length'];_0x4785b1+=0x1){let _0x54f3cd=_0x27cc3f[_0x0c4d('0x6e')][_0x4785b1];var _0x504edd=_0x428a03[_0x0c4d('0x5a')]();_0x504edd[_0x0c4d('0x44')](_0x0c4d('0x8b'),_0x54f3cd['id']);_0x418492[_0x0c4d('0x8c')](db[_0x0c4d('0x74')][_0x0c4d('0x3a')](_0x504edd[_0x0c4d('0x8d')](),{'type':db[_0x0c4d('0x74')][_0x0c4d('0x8e')]['SELECT']})[_0x0c4d('0x29')](function(_0x41caab){if(_0x41caab[_0x0c4d('0x3f')]===0x1){return _0x54f3cd['id'];}else{var _0x3b180c=_[_0x0c4d('0x8f')](_['map'](_0x41caab,_0x0c4d('0x90')),function(_0x225c17){return _[_0x0c4d('0x91')](_0x36ab47,_0x225c17);});if(_0x3b180c){return _0x54f3cd['id'];}}}));}}return BPromise['all'](_0x418492)[_0x0c4d('0x29')](function(_0x2f4ecc){_0x2ec3ea=_(_0x2ec3ea)[_0x0c4d('0x92')](_0x2f4ecc)['compact']()[_0x0c4d('0x30')]();return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x213417[_0x0c4d('0x4f')]['id']}})['then'](function(_0x27eece){return db[_0x0c4d('0x74')][_0x0c4d('0x75')](function(_0x3f069a){return _0x27eece['removeTeams'](_0x213417[_0x0c4d('0x3a')][_0x0c4d('0x82')],{'transaction':_0x3f069a})['then'](function(){if(!_[_0x0c4d('0x93')](_0x2ec3ea)){return _0x27eece[_0x0c4d('0x94')](_0x2ec3ea,{'transaction':_0x3f069a})[_0x0c4d('0x29')](function(){return db[_0x0c4d('0x79')][_0x0c4d('0x34')]({'where':{'VoiceQueueId':_0x213417[_0x0c4d('0x4f')]['id'],'UserId':_0x2ec3ea},'transaction':_0x3f069a});});}})[_0x0c4d('0x29')](function(){_0x2ec3ea['forEach'](function(_0x19923b){socket[_0x0c4d('0x7f')](_0x0c4d('0x95'),{'UserId':_0x19923b,'VoiceQueueId':_0x27eece['id']});});});});});});})[_0x0c4d('0x29')](respondWithStatusCode(_0x593a20,null))[_0x0c4d('0x4d')](handleError(_0x593a20,null));};exports[_0x0c4d('0x96')]=function(_0x6e33a3,_0x50c9b7,_0x1902c3){var _0x29f079,_0x59f1aa;return db[_0x0c4d('0x38')]['find']({'where':{'id':_0x6e33a3[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x50c9b7,null))[_0x0c4d('0x29')](function(_0x47290f){if(_0x47290f){_0x59f1aa=_0x47290f;return _0x47290f[_0x0c4d('0x96')](_0x6e33a3['body'][_0x0c4d('0x82')],_[_0x0c4d('0x5d')](_0x6e33a3[_0x0c4d('0x53')],[_0x0c4d('0x82'),'id'])||{})[_0x0c4d('0x97')](function(_0xbcfbc3){for(var _0x9925b9=0x0;_0x9925b9<_0x6e33a3['body'][_0x0c4d('0x82')][_0x0c4d('0x3f')];_0x9925b9+=0x1){socket[_0x0c4d('0x7f')](_0x0c4d('0x80'),{'UserId':_0x6e33a3[_0x0c4d('0x53')][_0x0c4d('0x82')][_0x9925b9],'VoiceQueueId':_0x6e33a3[_0x0c4d('0x4f')]['id']});}return _0xbcfbc3;});}})[_0x0c4d('0x29')](function(_0x16e595){_0x29f079=_0x16e595||[];if(_0x59f1aa){return db['User'][_0x0c4d('0x4c')]({'where':{'id':_0x6e33a3[_0x0c4d('0x53')][_0x0c4d('0x82')]},'attributes':['id','name',_0x0c4d('0x6f'),'voicePause',_0x0c4d('0x7c')],'raw':!![]});}})['then'](function(_0x2bfb4d){if(!_['isEmpty'](_0x2bfb4d)){var _0x7079f8=[];for(var _0x3d629f=0x0;_0x3d629f<_0x2bfb4d[_0x0c4d('0x3f')];_0x3d629f++){if(_0x2bfb4d[_0x3d629f]['online']){_0x7079f8['push'](db['UserVoiceQueueRt'][_0x0c4d('0x7a')]({'membername':_0x2bfb4d[_0x3d629f][_0x0c4d('0x32')],'UserId':_0x2bfb4d[_0x3d629f]['id'],'queue_name':_0x59f1aa[_0x0c4d('0x32')],'VoiceQueueId':_0x59f1aa['id'],'interface':_['isNil'](_0x2bfb4d[_0x3d629f]['interface'])?util[_0x0c4d('0x7d')](_0x0c4d('0x7e'),_0x2bfb4d[_0x3d629f][_0x0c4d('0x32')]):_0x2bfb4d[_0x3d629f][_0x0c4d('0x7c')],'paused':_0x2bfb4d[_0x3d629f][_0x0c4d('0x70')]||![],'penalty':_0x6e33a3[_0x0c4d('0x53')]['penalty']||0x0}));}}return BPromise['all'](_0x7079f8);}})[_0x0c4d('0x29')](function(){return _0x29f079;})[_0x0c4d('0x29')](respondWithResult(_0x50c9b7,null))['catch'](handleError(_0x50c9b7,null));};exports[_0x0c4d('0x94')]=function(_0x5b0b51,_0x2f9a34,_0x2bd328){return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x5b0b51[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x2f9a34,null))['then'](function(_0xf986b5){if(_0xf986b5){return _0xf986b5[_0x0c4d('0x94')](_0x5b0b51['query']['ids'])['then'](function(){if(_[_0x0c4d('0x98')](_0x5b0b51[_0x0c4d('0x3a')][_0x0c4d('0x82')])){for(var _0x19202d=0x0;_0x19202d<_0x5b0b51['query'][_0x0c4d('0x82')][_0x0c4d('0x3f')];_0x19202d+=0x1){socket[_0x0c4d('0x7f')](_0x0c4d('0x95'),{'UserId':Number(_0x5b0b51[_0x0c4d('0x3a')][_0x0c4d('0x82')][_0x19202d]),'VoiceQueueId':Number(_0x5b0b51[_0x0c4d('0x4f')]['id'])});}}else{socket[_0x0c4d('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x5b0b51[_0x0c4d('0x3a')][_0x0c4d('0x82')]),'VoiceQueueId':Number(_0x5b0b51[_0x0c4d('0x4f')]['id'])});}});}})[_0x0c4d('0x29')](function(_0x4f7234){return db['UserVoiceQueueRt'][_0x0c4d('0x34')]({'where':{'VoiceQueueId':_0x5b0b51['params']['id'],'UserId':_0x5b0b51[_0x0c4d('0x3a')][_0x0c4d('0x82')]}})[_0x0c4d('0x29')](function(){return _0x4f7234;});})[_0x0c4d('0x29')](respondWithStatusCode(_0x2f9a34,null))[_0x0c4d('0x4d')](handleError(_0x2f9a34,null));};exports[_0x0c4d('0x99')]=function(_0x321324,_0x346143,_0x516a78){var _0x534c24={};var _0x408e59={};var _0x5f1937;var _0x7403ff;return db[_0x0c4d('0x38')][_0x0c4d('0x60')]({'where':{'id':_0x321324[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x346143,null))[_0x0c4d('0x29')](function(_0x47c7f8){if(_0x47c7f8){_0x5f1937=_0x47c7f8;_0x408e59[_0x0c4d('0x3c')]=_['keys'](db['User']['rawAttributes']);_0x408e59[_0x0c4d('0x3a')]=_[_0x0c4d('0x39')](_0x321324[_0x0c4d('0x3a')]);_0x408e59['filters']=_['intersection'](_0x408e59[_0x0c4d('0x3c')],_0x408e59['query']);_0x534c24['attributes']=_['intersection'](_0x408e59[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x321324['query'][_0x0c4d('0x3d')]));_0x534c24[_0x0c4d('0x3e')]=_0x534c24[_0x0c4d('0x3e')][_0x0c4d('0x3f')]?_0x534c24[_0x0c4d('0x3e')]:_0x408e59[_0x0c4d('0x3c')];_0x534c24[_0x0c4d('0x42')]=qs['sort'](_0x321324[_0x0c4d('0x3a')][_0x0c4d('0x43')]);_0x534c24['where']=qs['filters'](_[_0x0c4d('0x46')](_0x321324[_0x0c4d('0x3a')],_0x408e59[_0x0c4d('0x45')]));if(_0x321324[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x534c24[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0x534c24['where'],{'$or':_[_0x0c4d('0x48')](_0x534c24['attributes'],function(_0x53ff80){var _0x1ca440={};_0x1ca440[_0x53ff80]={'$like':'%'+_0x321324['query'][_0x0c4d('0x2e')]+'%'};return _0x1ca440;})});}_0x534c24=_['merge']({},_0x534c24,_0x321324[_0x0c4d('0x50')]);return _0x5f1937[_0x0c4d('0x99')](_0x534c24);}})[_0x0c4d('0x29')](function(_0x2eed68){if(_0x2eed68){_0x7403ff=_0x2eed68[_0x0c4d('0x3f')];if(!_0x321324[_0x0c4d('0x3a')]['hasOwnProperty']('nolimit')){_0x534c24[_0x0c4d('0x24')]=qs['limit'](_0x321324[_0x0c4d('0x3a')][_0x0c4d('0x24')]);_0x534c24[_0x0c4d('0x23')]=qs[_0x0c4d('0x23')](_0x321324[_0x0c4d('0x3a')]['offset']);}return _0x5f1937[_0x0c4d('0x99')](_0x534c24);}})['then'](function(_0xce6ca4){if(_0xce6ca4){return _0xce6ca4?{'count':_0x7403ff,'rows':_0xce6ca4}:null;}})['then'](respondWithResult(_0x346143,null))[_0x0c4d('0x4d')](handleError(_0x346143,null));};exports[_0x0c4d('0x9a')]=function(_0x1be386,_0x5c67a2,_0x557476){var _0x1ddbe8={};var _0x3c465f={};var _0x41e272;var _0x47f8bd;return db['VoiceQueue']['findOne']({'where':{'id':_0x1be386[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x5c67a2,null))['then'](function(_0x11b7fd){if(_0x11b7fd){_0x41e272=_0x11b7fd;_0x3c465f[_0x0c4d('0x3c')]=_[_0x0c4d('0x39')](db[_0x0c4d('0x79')][_0x0c4d('0x62')]);_0x3c465f[_0x0c4d('0x3a')]=_[_0x0c4d('0x39')](_0x1be386[_0x0c4d('0x3a')]);_0x3c465f[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x3c465f[_0x0c4d('0x3c')],_0x3c465f[_0x0c4d('0x3a')]);_0x1ddbe8[_0x0c4d('0x3e')]=_[_0x0c4d('0x3b')](_0x3c465f[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x1be386[_0x0c4d('0x3a')]['fields']));_0x1ddbe8[_0x0c4d('0x3e')]=_0x1ddbe8[_0x0c4d('0x3e')][_0x0c4d('0x3f')]?_0x1ddbe8[_0x0c4d('0x3e')]:_0x3c465f[_0x0c4d('0x3c')];_0x1ddbe8[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0x1be386['query'][_0x0c4d('0x43')]);_0x1ddbe8['where']=qs[_0x0c4d('0x45')](_[_0x0c4d('0x46')](_0x1be386[_0x0c4d('0x3a')],_0x3c465f[_0x0c4d('0x45')]));if(_0x1be386[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x1ddbe8[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0x1ddbe8[_0x0c4d('0x44')],{'$or':_[_0x0c4d('0x48')](_0x1ddbe8[_0x0c4d('0x3e')],function(_0x13e7d8){var _0x6b4b04={};_0x6b4b04[_0x13e7d8]={'$like':'%'+_0x1be386['query'][_0x0c4d('0x2e')]+'%'};return _0x6b4b04;})});}_0x1ddbe8=_[_0x0c4d('0x47')]({},_0x1ddbe8,_0x1be386[_0x0c4d('0x50')]);return _0x41e272[_0x0c4d('0x9a')](_0x1ddbe8);}})[_0x0c4d('0x29')](function(_0xd8d0a1){if(_0xd8d0a1){_0x47f8bd=_0xd8d0a1['length'];if(!_0x1be386[_0x0c4d('0x3a')]['hasOwnProperty'](_0x0c4d('0x41'))){_0x1ddbe8[_0x0c4d('0x24')]=qs[_0x0c4d('0x24')](_0x1be386['query']['limit']);_0x1ddbe8[_0x0c4d('0x23')]=qs['offset'](_0x1be386[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}return _0x41e272[_0x0c4d('0x9a')](_0x1ddbe8);}})[_0x0c4d('0x29')](function(_0xac7e15){return _0xac7e15?{'count':_0x47f8bd,'rows':_0xac7e15}:null;})[_0x0c4d('0x29')](respondWithResult(_0x5c67a2,null))[_0x0c4d('0x4d')](handleError(_0x5c67a2,null));};exports[_0x0c4d('0x9b')]=function(_0x510857,_0x303118,_0x1ebfe0){var _0x426477={};var _0x68ef56={};var _0x34e4d4;var _0x3e89c3;return db['VoiceQueue'][_0x0c4d('0x60')]({'where':{'id':_0x510857[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x303118,null))[_0x0c4d('0x29')](function(_0x57c408){if(_0x57c408){_0x34e4d4=_0x57c408;_0x68ef56[_0x0c4d('0x3c')]=_[_0x0c4d('0x39')](db[_0x0c4d('0x9c')][_0x0c4d('0x62')]);_0x68ef56[_0x0c4d('0x3a')]=_['keys'](_0x510857['query']);_0x68ef56['filters']=_['intersection'](_0x68ef56['model'],_0x68ef56[_0x0c4d('0x3a')]);_0x426477['attributes']=_[_0x0c4d('0x3b')](_0x68ef56['model'],qs[_0x0c4d('0x3d')](_0x510857['query'][_0x0c4d('0x3d')]));_0x426477[_0x0c4d('0x3e')]=_0x426477[_0x0c4d('0x3e')]['length']?_0x426477[_0x0c4d('0x3e')]:_0x68ef56[_0x0c4d('0x3c')];_0x426477[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0x510857[_0x0c4d('0x3a')][_0x0c4d('0x43')]);_0x426477[_0x0c4d('0x44')]=qs['filters'](_[_0x0c4d('0x46')](_0x510857['query'],_0x68ef56[_0x0c4d('0x45')]));if(_0x510857[_0x0c4d('0x3a')][_0x0c4d('0x2e')]){_0x426477['where']=_[_0x0c4d('0x47')](_0x426477[_0x0c4d('0x44')],{'$or':_[_0x0c4d('0x48')](_0x426477['attributes'],function(_0x52474c){var _0xcbac85={};_0xcbac85[_0x52474c]={'$like':'%'+_0x510857[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0xcbac85;})});}_0x426477=_['merge']({},_0x426477,_0x510857[_0x0c4d('0x50')]);return _0x34e4d4[_0x0c4d('0x9b')](_0x426477);}})[_0x0c4d('0x29')](function(_0x1752be){if(_0x1752be){_0x3e89c3=_0x1752be[_0x0c4d('0x3f')];if(!_0x510857[_0x0c4d('0x3a')][_0x0c4d('0x40')]('nolimit')){_0x426477['limit']=qs[_0x0c4d('0x24')](_0x510857[_0x0c4d('0x3a')]['limit']);_0x426477['offset']=qs[_0x0c4d('0x23')](_0x510857[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}return _0x34e4d4[_0x0c4d('0x9b')](_0x426477);}})['then'](function(_0x517b60){if(_0x517b60){return _0x517b60?{'count':_0x3e89c3,'rows':_0x517b60}:null;}})[_0x0c4d('0x29')](respondWithResult(_0x303118,null))[_0x0c4d('0x4d')](handleError(_0x303118,null));};exports['addLists']=function(_0x28ce99,_0x5178f4,_0x2f5a57){var _0x3a01a7,_0xf547f9;return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x28ce99[_0x0c4d('0x4f')]['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x5178f4,null))[_0x0c4d('0x29')](function(_0x12e1ec){if(_0x12e1ec){_0xf547f9=_0x12e1ec;return _0x12e1ec[_0x0c4d('0x9d')](_0x28ce99[_0x0c4d('0x53')]['ids'],_[_0x0c4d('0x5d')](_0x28ce99[_0x0c4d('0x53')],['ids','id'])||{});}return null;})[_0x0c4d('0x97')](function(_0x18282f){var _0x2146b7;_0x3a01a7=_0x18282f||[];var _0x4b943f=[];if(_0x18282f){for(var _0x85e1fe=0x0;_0x85e1fe<_0x18282f[_0x0c4d('0x3f')];_0x85e1fe+=0x1){var _0x34483e=_0x18282f[_0x85e1fe][_0x0c4d('0x2a')]({'plain':!![]});_0xf547f9[_0x0c4d('0x9e')]=_0x28ce99[_0x0c4d('0x53')][_0x0c4d('0x9e')]?_0x28ce99[_0x0c4d('0x53')][_0x0c4d('0x9e')]:_0xf547f9['dialCheckDuplicateType'];switch(_0xf547f9['dialCheckDuplicateType']){case'always':_0x2146b7=squel[_0x0c4d('0x9f')]()[_0x0c4d('0xa0')](_0x0c4d('0xa1'))['fromQuery']([_0x0c4d('0xa2'),'scheduledAt',_0x0c4d('0xa3'),'ListId',_0x0c4d('0x63'),'createdAt',_0x0c4d('0x5c')],squel[_0x0c4d('0x84')]()['field'](_0x0c4d('0xa2'),_0x0c4d('0xa2'))['field'](_0x0c4d('0xa4'),_0x0c4d('0xa5'))[_0x0c4d('0x85')]('id',_0x0c4d('0xa3'))[_0x0c4d('0x85')](_0x34483e[_0x0c4d('0xa6')][_0x0c4d('0x8d')](),_0x0c4d('0xa7'))[_0x0c4d('0x85')](_0x28ce99[_0x0c4d('0x4f')]['id'][_0x0c4d('0x8d')](),_0x0c4d('0x63'))[_0x0c4d('0x85')]('NOW()',_0x0c4d('0x5b'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0x5c'))['from'](_0x0c4d('0xa8'))['where']('deletedAt\x20IS\x20NULL')[_0x0c4d('0x44')]('ListId\x20=\x20?',_0x34483e[_0x0c4d('0xa6')]['toString']())[_0x0c4d('0x44')](_0x0c4d('0xa9'))['where'](_0x0c4d('0xaa'),squel[_0x0c4d('0x84')]()[_0x0c4d('0x85')](_0x0c4d('0xab'))['from'](_0x0c4d('0xac'))['where']('VoiceQueueId\x20=\x20?',_0x28ce99[_0x0c4d('0x4f')]['id'][_0x0c4d('0x8d')]()))[_0x0c4d('0x44')](_0x0c4d('0xaa'),squel[_0x0c4d('0x84')]()[_0x0c4d('0x85')](_0x0c4d('0xad'))[_0x0c4d('0xae')](_0x0c4d('0xa1'))['where'](_0x0c4d('0x8a'),_0x28ce99[_0x0c4d('0x4f')]['id'][_0x0c4d('0x8d')]())))['toString']();break;case _0x0c4d('0xaf'):_0x2146b7=squel['insert']()[_0x0c4d('0xa0')](_0x0c4d('0xa1'))[_0x0c4d('0xb0')]([_0x0c4d('0xa2'),_0x0c4d('0xa5'),_0x0c4d('0xa3'),_0x0c4d('0xa7'),'VoiceQueueId',_0x0c4d('0x5b'),_0x0c4d('0x5c')],squel[_0x0c4d('0x84')]()[_0x0c4d('0x85')](_0x0c4d('0xa2'),'phone')['field']('NOW()',_0x0c4d('0xa5'))['field']('id',_0x0c4d('0xa3'))['field'](_0x34483e[_0x0c4d('0xa6')][_0x0c4d('0x8d')](),_0x0c4d('0xa7'))[_0x0c4d('0x85')](_0x28ce99[_0x0c4d('0x4f')]['id'][_0x0c4d('0x8d')](),_0x0c4d('0x63'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0x5b'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0x5c'))[_0x0c4d('0xae')](_0x0c4d('0xa8'))[_0x0c4d('0x44')](_0x0c4d('0xb1'))[_0x0c4d('0x44')](_0x0c4d('0xb2'),_0x34483e['CmListId'][_0x0c4d('0x8d')]())[_0x0c4d('0x44')](_0x0c4d('0xa9'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0c4d('0x84')]()['field']('COALESCE(phone,\x27\x27)')[_0x0c4d('0xae')](_0x0c4d('0xa1'))[_0x0c4d('0x44')]('VoiceQueueId\x20=\x20?',_0x28ce99[_0x0c4d('0x4f')]['id'][_0x0c4d('0x8d')]())))[_0x0c4d('0x8d')]();break;default:_0x2146b7=squel[_0x0c4d('0x9f')]()[_0x0c4d('0xa0')](_0x0c4d('0xa1'))[_0x0c4d('0xb0')](['phone','scheduledAt',_0x0c4d('0xa3'),_0x0c4d('0xa7'),_0x0c4d('0x63'),_0x0c4d('0x5b'),_0x0c4d('0x5c')],squel['select']()[_0x0c4d('0x85')](_0x0c4d('0xa2'),_0x0c4d('0xa2'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0xa5'))[_0x0c4d('0x85')]('id','ContactId')['field'](_0x34483e['CmListId'][_0x0c4d('0x8d')](),_0x0c4d('0xa7'))[_0x0c4d('0x85')](_0x28ce99[_0x0c4d('0x4f')]['id']['toString'](),_0x0c4d('0x63'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),'createdAt')[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0x5c'))['from'](_0x0c4d('0xa8'))[_0x0c4d('0x44')]('deletedAt\x20IS\x20NULL')['where'](_0x0c4d('0xb2'),_0x34483e[_0x0c4d('0xa6')][_0x0c4d('0x8d')]())[_0x0c4d('0x44')](_0x0c4d('0xa9')))[_0x0c4d('0x8d')]();}_0x4b943f[_0x0c4d('0x8c')](db['sequelize'][_0x0c4d('0x3a')](_0x2146b7));}return BPromise[_0x0c4d('0xb3')](_0x4b943f);}})[_0x0c4d('0x29')](function(){return _0x3a01a7;})['then'](respondWithResult(_0x5178f4,null))[_0x0c4d('0x4d')](handleError(_0x5178f4,null));};exports[_0x0c4d('0xb4')]=function(_0x443b11,_0x5a56f6,_0x30919d){return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x443b11['params']['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x5a56f6,null))[_0x0c4d('0x29')](function(_0x4561ac){if(_0x4561ac){return _0x4561ac[_0x0c4d('0xb4')](_0x443b11[_0x0c4d('0x3a')][_0x0c4d('0x82')]);}})[_0x0c4d('0x29')](function(_0xd54549){if(_0xd54549){return db[_0x0c4d('0x61')]['destroy']({'where':{'ListId':_0x443b11[_0x0c4d('0x3a')][_0x0c4d('0x82')],'VoiceQueueId':_0x443b11[_0x0c4d('0x4f')]['id']}})['then'](function(){return _0xd54549;});}})[_0x0c4d('0x29')](respondWithStatusCode(_0x5a56f6,null))[_0x0c4d('0x4d')](handleError(_0x5a56f6,null));};exports[_0x0c4d('0xb5')]=function(_0x12c6dc,_0x4425b5,_0x4062e0){var _0xd591c0={};var _0x590dde={};var _0x17f2b7;var _0x93c601;return db[_0x0c4d('0x38')][_0x0c4d('0x60')]({'where':{'id':_0x12c6dc['params']['id']}})[_0x0c4d('0x29')](handleEntityNotFound(_0x4425b5,null))['then'](function(_0x2b3458){if(_0x2b3458){_0x17f2b7=_0x2b3458;_0x590dde[_0x0c4d('0x3c')]=_[_0x0c4d('0x39')](db[_0x0c4d('0x9c')][_0x0c4d('0x62')]);_0x590dde[_0x0c4d('0x3a')]=_[_0x0c4d('0x39')](_0x12c6dc[_0x0c4d('0x3a')]);_0x590dde[_0x0c4d('0x45')]=_[_0x0c4d('0x3b')](_0x590dde['model'],_0x590dde[_0x0c4d('0x3a')]);_0xd591c0[_0x0c4d('0x3e')]=_[_0x0c4d('0x3b')](_0x590dde[_0x0c4d('0x3c')],qs[_0x0c4d('0x3d')](_0x12c6dc[_0x0c4d('0x3a')][_0x0c4d('0x3d')]));_0xd591c0[_0x0c4d('0x3e')]=_0xd591c0['attributes'][_0x0c4d('0x3f')]?_0xd591c0[_0x0c4d('0x3e')]:_0x590dde[_0x0c4d('0x3c')];_0xd591c0[_0x0c4d('0x42')]=qs[_0x0c4d('0x43')](_0x12c6dc[_0x0c4d('0x3a')]['sort']);_0xd591c0[_0x0c4d('0x44')]=qs[_0x0c4d('0x45')](_['pick'](_0x12c6dc[_0x0c4d('0x3a')],_0x590dde[_0x0c4d('0x45')]));if(_0x12c6dc['query'][_0x0c4d('0x2e')]){_0xd591c0[_0x0c4d('0x44')]=_[_0x0c4d('0x47')](_0xd591c0['where'],{'$or':_[_0x0c4d('0x48')](_0xd591c0['attributes'],function(_0x4e3605){var _0x5e189f={};_0x5e189f[_0x4e3605]={'$like':'%'+_0x12c6dc[_0x0c4d('0x3a')][_0x0c4d('0x2e')]+'%'};return _0x5e189f;})});}_0xd591c0=_[_0x0c4d('0x47')]({},_0xd591c0,_0x12c6dc[_0x0c4d('0x50')]);return _0x17f2b7['getBlackLists'](_0xd591c0);}})['then'](function(_0x40a8fa){if(_0x40a8fa){_0x93c601=_0x40a8fa['length'];if(!_0x12c6dc[_0x0c4d('0x3a')][_0x0c4d('0x40')](_0x0c4d('0x41'))){_0xd591c0[_0x0c4d('0x24')]=qs[_0x0c4d('0x24')](_0x12c6dc[_0x0c4d('0x3a')][_0x0c4d('0x24')]);_0xd591c0[_0x0c4d('0x23')]=qs[_0x0c4d('0x23')](_0x12c6dc[_0x0c4d('0x3a')][_0x0c4d('0x23')]);}return _0x17f2b7[_0x0c4d('0xb5')](_0xd591c0);}})[_0x0c4d('0x29')](function(_0x50d08c){if(_0x50d08c){return _0x50d08c?{'count':_0x93c601,'rows':_0x50d08c}:null;}})[_0x0c4d('0x29')](respondWithResult(_0x4425b5,null))[_0x0c4d('0x4d')](handleError(_0x4425b5,null));};exports[_0x0c4d('0xb6')]=function(_0x58b186,_0x1848ca,_0x564c50){var _0x8c315c,_0x4193fb;return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x58b186['params']['id']}})['then'](handleEntityNotFound(_0x1848ca,null))[_0x0c4d('0x29')](function(_0x2bf8d5){if(_0x2bf8d5){_0x4193fb=_0x2bf8d5;return _0x2bf8d5['addBlackLists'](_0x58b186[_0x0c4d('0x53')][_0x0c4d('0x82')],_[_0x0c4d('0x5d')](_0x58b186['body'],[_0x0c4d('0x82'),'id'])||{});}return null;})[_0x0c4d('0x97')](function(_0x32d233){var _0x32386b;_0x8c315c=_0x32d233||[];var _0x5e92a0=[];if(_0x32d233){for(var _0x946125=0x0;_0x946125<_0x32d233[_0x0c4d('0x3f')];_0x946125+=0x1){var _0x12b818=_0x32d233[_0x946125]['get']({'plain':!![]});_0x32386b=squel['insert']()[_0x0c4d('0xa0')](_0x0c4d('0xb7'))[_0x0c4d('0xb0')](['phone',_0x0c4d('0xa3'),_0x0c4d('0xa7'),_0x0c4d('0x63'),'createdAt','updatedAt'],squel['select']()[_0x0c4d('0x85')](_0x0c4d('0xa2'),_0x0c4d('0xa2'))[_0x0c4d('0x85')]('id','ContactId')[_0x0c4d('0x85')](_0x12b818[_0x0c4d('0xa6')]['toString'](),'ListId')[_0x0c4d('0x85')](_0x58b186['params']['id'][_0x0c4d('0x8d')](),_0x0c4d('0x63'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0x5b'))[_0x0c4d('0x85')](_0x0c4d('0xa4'),_0x0c4d('0x5c'))['from']('cm_contacts')[_0x0c4d('0x44')](_0x0c4d('0xb1'))['where'](_0x0c4d('0xb2'),_0x12b818['CmListId'][_0x0c4d('0x8d')]())[_0x0c4d('0x44')](_0x0c4d('0xa9')))[_0x0c4d('0x8d')]();_0x5e92a0['push'](db['sequelize'][_0x0c4d('0x3a')](_0x32386b));}return BPromise['all'](_0x5e92a0);}})[_0x0c4d('0x29')](function(){return _0x8c315c;})[_0x0c4d('0x29')](respondWithResult(_0x1848ca,null))[_0x0c4d('0x4d')](handleError(_0x1848ca,null));};exports[_0x0c4d('0xb8')]=function(_0x379ca4,_0x36811f,_0x4923cc){return db[_0x0c4d('0x38')][_0x0c4d('0x51')]({'where':{'id':_0x379ca4[_0x0c4d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36811f,null))[_0x0c4d('0x29')](function(_0xae847d){if(_0xae847d){return _0xae847d[_0x0c4d('0xb8')](_0x379ca4[_0x0c4d('0x3a')]['ids']);}})[_0x0c4d('0x29')](function(_0x53030e){if(_0x53030e){return db[_0x0c4d('0x6a')][_0x0c4d('0x34')]({'where':{'ListId':_0x379ca4['query'][_0x0c4d('0x82')],'VoiceQueueId':_0x379ca4['params']['id']}})[_0x0c4d('0x29')](function(){return _0x53030e;});}})['then'](respondWithStatusCode(_0x36811f,null))[_0x0c4d('0x4d')](handleError(_0x36811f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 21731d9..601bad5 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 _0x671c=['exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x36d611,_0xcdac67){var _0x5b47bd=function(_0x1bb43b){while(--_0x1bb43b){_0x36d611['push'](_0x36d611['shift']());}};_0x5b47bd(++_0xcdac67);}(_0x671c,0xbe));var _0xc671=function(_0x44cf27,_0x1ec6db){_0x44cf27=_0x44cf27-0x0;var _0x2d5839=_0x671c[_0x44cf27];return _0x2d5839;};'use strict';var EventEmitter=require(_0xc671('0x0'));var VoiceQueue=require(_0xc671('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc671('0x2'),'afterUpdate':'update','afterDestroy':_0xc671('0x3')};function emitEvent(_0x3b5c94){return function(_0x20df54,_0x3b17d8,_0x34f85c){VoiceQueueEvents['emit'](_0x3b5c94+':'+_0x20df54['id'],_0x20df54);VoiceQueueEvents[_0xc671('0x4')](_0x3b5c94,_0x20df54);_0x34f85c(null);};}for(var e in events){if(events[_0xc671('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xc671('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x9844=['save','update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x4dff81,_0x20a4d1){var _0x2d00a3=function(_0xdc5634){while(--_0xdc5634){_0x4dff81['push'](_0x4dff81['shift']());}};_0x2d00a3(++_0x20a4d1);}(_0x9844,0x9d));var _0x4984=function(_0x3f603b,_0x6c29ba){_0x3f603b=_0x3f603b-0x0;var _0x3f460a=_0x9844[_0x3f603b];return _0x3f460a;};'use strict';var EventEmitter=require(_0x4984('0x0'));var VoiceQueue=require(_0x4984('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4984('0x2')](0x0);var events={'afterCreate':_0x4984('0x3'),'afterUpdate':_0x4984('0x4'),'afterDestroy':_0x4984('0x5')};function emitEvent(_0x4210d1){return function(_0xe4b779,_0x531ffa,_0x5139d3){VoiceQueueEvents[_0x4984('0x6')](_0x4210d1+':'+_0xe4b779['id'],_0xe4b779);VoiceQueueEvents['emit'](_0x4210d1,_0xe4b779);_0x5139d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x4984('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index cca27cb..f87b0ce 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 _0x4024=['define','voice_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x563aad,_0x3eff3a){var _0xc6bb81=function(_0x457f77){while(--_0x457f77){_0x563aad['push'](_0x563aad['shift']());}};_0xc6bb81(++_0x3eff3a);}(_0x4024,0x89));var _0x4402=function(_0x16d6a2,_0x266958){_0x16d6a2=_0x16d6a2-0x0;var _0x681283=_0x4024[_0x16d6a2];return _0x681283;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x17699b,_0x346ddc){return _0x17699b[_0x4402('0x7')]('VoiceQueue',attributes,{'tableName':_0x4402('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9348=['../../config/environment','./voiceQueue.attributes','exports','define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x296f15,_0x331eb5){var _0xd443d2=function(_0x29dc35){while(--_0x29dc35){_0x296f15['push'](_0x296f15['shift']());}};_0xd443d2(++_0x331eb5);}(_0x9348,0x10d));var _0x8934=function(_0x3696b9,_0xdbd0bf){_0x3696b9=_0x3696b9-0x0;var _0x13ee90=_0x9348[_0x3696b9];return _0x13ee90;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('VoiceQueue',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d56e167..fca15e9 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 _0xa9e0=['register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x547478,_0x31f5e1){var _0x109f07=function(_0x47c2ac){while(--_0x47c2ac){_0x547478['push'](_0x547478['shift']());}};_0x109f07(++_0x31f5e1);}(_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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceQueue'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceQueue',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});};exports[_0x0a9e('0x24')]=function(_0x296f41){var _0x2e8759=this;return new Promise(function(_0x1dbde2,_0x540530){return db[_0x0a9e('0x25')]['find']({'raw':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')]['where']||null:null,'attributes':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x296f41[_0x0a9e('0x1b')]['include'],function(_0x44295a){return{'model':db[_0x44295a['model']],'as':_0x44295a['as'],'attributes':_0x44295a[_0x0a9e('0x1e')],'include':_0x44295a[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x44295a[_0x0a9e('0x20')],function(_0x567193){return{'model':db[_0x567193[_0x0a9e('0x22')]],'as':_0x567193['as'],'attributes':_0x567193[_0x0a9e('0x1e')],'include':_0x567193[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x567193['include'],function(_0x54135e){return{'model':db[_0x54135e[_0x0a9e('0x22')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x3d9717){logger[_0x0a9e('0x16')](_0x0a9e('0x24'),_0x296f41);logger['debug'](_0x0a9e('0x24'),_0x296f41,JSON[_0x0a9e('0x12')](_0x3d9717));_0x1dbde2(_0x3d9717);})[_0x0a9e('0x18')](function(_0x533942){logger[_0x0a9e('0x13')](_0x0a9e('0x24'),_0x533942[_0x0a9e('0x15')],_0x296f41);_0x540530(_0x2e8759['error'](0x1f4,_0x533942['message']));});});}; \ No newline at end of file +var _0xa9e0=['register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x306af3,_0x2fb290){var _0x5a237f=function(_0x53a6b6){while(--_0x53a6b6){_0x306af3['push'](_0x306af3['shift']());}};_0x5a237f(++_0x2fb290);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceQueue'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceQueue',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});};exports[_0x0a9e('0x24')]=function(_0x296f41){var _0x2e8759=this;return new Promise(function(_0x1dbde2,_0x540530){return db[_0x0a9e('0x25')]['find']({'raw':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')]['where']||null:null,'attributes':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x296f41[_0x0a9e('0x1b')]['include'],function(_0x44295a){return{'model':db[_0x44295a['model']],'as':_0x44295a['as'],'attributes':_0x44295a[_0x0a9e('0x1e')],'include':_0x44295a[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x44295a[_0x0a9e('0x20')],function(_0x567193){return{'model':db[_0x567193[_0x0a9e('0x22')]],'as':_0x567193['as'],'attributes':_0x567193[_0x0a9e('0x1e')],'include':_0x567193[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x567193['include'],function(_0x54135e){return{'model':db[_0x54135e[_0x0a9e('0x22')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x3d9717){logger[_0x0a9e('0x16')](_0x0a9e('0x24'),_0x296f41);logger['debug'](_0x0a9e('0x24'),_0x296f41,JSON[_0x0a9e('0x12')](_0x3d9717));_0x1dbde2(_0x3d9717);})[_0x0a9e('0x18')](function(_0x533942){logger[_0x0a9e('0x13')](_0x0a9e('0x24'),_0x533942[_0x0a9e('0x15')],_0x296f41);_0x540530(_0x2e8759['error'](0x1f4,_0x533942['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2425f6e..f844dab 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 _0x3d68=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','removeListener'];(function(_0x6aa8a8,_0x473004){var _0x510b6f=function(_0x6058db){while(--_0x6058db){_0x6aa8a8['push'](_0x6aa8a8['shift']());}};_0x510b6f(++_0x473004);}(_0x3d68,0x19b));var _0x83d6=function(_0x278a36,_0x1ae906){_0x278a36=_0x278a36-0x0;var _0x69b6ac=_0x3d68[_0x278a36];return _0x69b6ac;};'use strict';var VoiceQueueEvents=require(_0x83d6('0x0'));var events=[_0x83d6('0x1'),_0x83d6('0x2'),_0x83d6('0x3')];function createListener(_0xc6a9d3,_0x387e4c){return function(_0x5689a4){_0x387e4c['emit'](_0xc6a9d3,_0x5689a4);};}function removeListener(_0x640fe8,_0x4c17b1){return function(){VoiceQueueEvents[_0x83d6('0x4')](_0x640fe8,_0x4c17b1);};}exports[_0x83d6('0x5')]=function(_0x49fb52){for(var _0x599a03=0x0,_0x268294=events[_0x83d6('0x6')];_0x599a03<_0x268294;_0x599a03++){var _0x24db46=events[_0x599a03];var _0x59163a=createListener(_0x83d6('0x7')+_0x24db46,_0x49fb52);VoiceQueueEvents['on'](_0x24db46,_0x59163a);}}; \ No newline at end of file +var _0xb732=['length','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x6f93a4,_0x339a44){var _0x56a021=function(_0x3393a8){while(--_0x3393a8){_0x6f93a4['push'](_0x6f93a4['shift']());}};_0x56a021(++_0x339a44);}(_0xb732,0x1a9));var _0x2b73=function(_0x245c39,_0x849957){_0x245c39=_0x245c39-0x0;var _0x37fd73=_0xb732[_0x245c39];return _0x37fd73;};'use strict';var VoiceQueueEvents=require(_0x2b73('0x0'));var events=[_0x2b73('0x1'),_0x2b73('0x2'),_0x2b73('0x3')];function createListener(_0x26c794,_0x209e07){return function(_0xe31598){_0x209e07[_0x2b73('0x4')](_0x26c794,_0xe31598);};}function removeListener(_0x2ba6c9,_0x1f10e9){return function(){VoiceQueueEvents[_0x2b73('0x5')](_0x2ba6c9,_0x1f10e9);};}exports[_0x2b73('0x6')]=function(_0x2a0c30){for(var _0x58d2b3=0x0,_0x39f7dc=events[_0x2b73('0x7')];_0x58d2b3<_0x39f7dc;_0x58d2b3++){var _0x54b9e8=events[_0x58d2b3];var _0xae17bd=createListener('voiceQueue:'+_0x54b9e8,_0x2a0c30);VoiceQueueEvents['on'](_0x54b9e8,_0xae17bd);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 21d5305..304e3fb 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 _0x004f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x53de91,_0x38e530){var _0x6e3745=function(_0x23fea1){while(--_0x23fea1){_0x53de91['push'](_0x53de91['shift']());}};_0x6e3745(++_0x38e530);}(_0x004f,0xa3));var _0xf004=function(_0x15717d,_0x1a4946){_0x15717d=_0x15717d-0x0;var _0x1876c2=_0x004f[_0x15717d];return _0x1876c2;};'use strict';var multer=require(_0xf004('0x0'));var util=require(_0xf004('0x1'));var path=require(_0xf004('0x2'));var timeout=require(_0xf004('0x3'));var express=require(_0xf004('0x4'));var router=express[_0xf004('0x5')]();var auth=require(_0xf004('0x6'));var interaction=require(_0xf004('0x7'));var config=require(_0xf004('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xf004('0x9')]('/',auth[_0xf004('0xa')](),controller[_0xf004('0xb')]);router[_0xf004('0x9')](_0xf004('0xc'),auth[_0xf004('0xa')](),controller[_0xf004('0xd')]);router[_0xf004('0x9')](_0xf004('0xe'),auth[_0xf004('0xa')](),controller[_0xf004('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf004('0x10')]);router[_0xf004('0x11')]('/',auth[_0xf004('0xa')](),controller[_0xf004('0x12')]);router[_0xf004('0x13')](_0xf004('0x14'),auth[_0xf004('0xa')](),controller[_0xf004('0x15')]);router[_0xf004('0x16')](_0xf004('0x14'),auth[_0xf004('0xa')](),controller[_0xf004('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1c2c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x4e3a92,_0x409fa2){var _0x52d8b9=function(_0x2d8b12){while(--_0x2d8b12){_0x4e3a92['push'](_0x4e3a92['shift']());}};_0x52d8b9(++_0x409fa2);}(_0x1c2c,0x18e));var _0xc1c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c2c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc1c2('0x0'));var util=require('util');var path=require(_0xc1c2('0x1'));var timeout=require(_0xc1c2('0x2'));var express=require(_0xc1c2('0x3'));var router=express[_0xc1c2('0x4')]();var auth=require(_0xc1c2('0x5'));var interaction=require(_0xc1c2('0x6'));var config=require(_0xc1c2('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xc1c2('0x8')](),controller['index']);router[_0xc1c2('0x9')](_0xc1c2('0xa'),auth[_0xc1c2('0x8')](),controller[_0xc1c2('0xb')]);router['get'](_0xc1c2('0xc'),auth['isAuthenticated'](),controller[_0xc1c2('0xd')]);router[_0xc1c2('0x9')](_0xc1c2('0xe'),auth['isAuthenticated'](),controller[_0xc1c2('0xf')]);router[_0xc1c2('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc1c2('0x11')]);router[_0xc1c2('0x12')](_0xc1c2('0xe'),auth[_0xc1c2('0x8')](),controller[_0xc1c2('0x13')]);module[_0xc1c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e91b659..2cd4588 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 _0xf1e6=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x30330d,_0x1f7d3b){var _0x36df4e=function(_0x55c9e9){while(--_0x55c9e9){_0x30330d['push'](_0x30330d['shift']());}};_0x36df4e(++_0x1f7d3b);}(_0xf1e6,0x1bf));var _0x6f1e=function(_0x4d9242,_0x385b6e){_0x4d9242=_0x4d9242-0x0;var _0x59301e=_0xf1e6[_0x4d9242];return _0x59301e;};'use strict';var Sequelize=require(_0x6f1e('0x0'));var moment=require(_0x6f1e('0x1'));module['exports']={'type':{'type':Sequelize[_0x6f1e('0x2')]},'uniqueid':{'type':Sequelize[_0x6f1e('0x2')]},'calleridnum':{'type':Sequelize[_0x6f1e('0x2')]},'calleridname':{'type':Sequelize[_0x6f1e('0x2')]},'queue':{'type':Sequelize[_0x6f1e('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x6f1e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x6f1e('0x3')],'set':function(_0xd48dfc){var _0x22ab16=moment(_0xd48dfc);var _0xc6e29a=moment(this[_0x6f1e('0x4')](_0x6f1e('0x5')))['format'](_0x6f1e('0x6'));var _0x195236=_0x22ab16['diff'](_0xc6e29a,_0x6f1e('0x7'));this[_0x6f1e('0x8')]('queuecallerleaveAt',_0xd48dfc);this[_0x6f1e('0x8')](_0x6f1e('0x9'),_0x195236||null);}},'position':{'type':Sequelize[_0x6f1e('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x6f1e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6f1e('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6f1e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x6f1e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6f1e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x6f1e('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x6f1e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6f1e('0x2')]},'connectedlinename':{'type':Sequelize[_0x6f1e('0x2')]},'accountcode':{'type':Sequelize[_0x6f1e('0x2')]},'context':{'type':Sequelize[_0x6f1e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6f1e('0x2')]},'holdtime':{'type':Sequelize[_0x6f1e('0xa')]},'mohtime':{'type':Sequelize[_0x6f1e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6f1e('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6f1e('0x2')]},'transfer':{'type':Sequelize[_0x6f1e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x6f1e('0xc')},'transferexten':{'type':Sequelize[_0x6f1e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6f1e('0x2')]},'disposition':{'type':Sequelize[_0x6f1e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6f1e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xde8a=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xde8a,0x1d9));var _0xade8=function(_0x41264a,_0xfc747b){_0x41264a=_0x41264a-0x0;var _0x3f52a1=_0xde8a[_0x41264a];return _0x3f52a1;};'use strict';var Sequelize=require(_0xade8('0x0'));var moment=require(_0xade8('0x1'));module[_0xade8('0x2')]={'type':{'type':Sequelize[_0xade8('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xade8('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xade8('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xade8('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xade8('0x4')],'set':function(_0x2979cb){var _0x28645b=moment(_0x2979cb);var _0x3caddf=moment(this[_0xade8('0x5')](_0xade8('0x6')))[_0xade8('0x7')](_0xade8('0x8'));var _0x534ece=_0x28645b[_0xade8('0x9')](_0x3caddf,_0xade8('0xa'));this[_0xade8('0xb')](_0xade8('0xc'),_0x2979cb);this[_0xade8('0xb')](_0xade8('0xd'),_0x534ece||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xade8('0xe')]},'queuecallerabandon':{'type':Sequelize[_0xade8('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xade8('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xade8('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xade8('0x4')]},'queuecallerexit':{'type':Sequelize[_0xade8('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xade8('0x3')],'comment':_0xade8('0x10')},'originalposition':{'type':Sequelize[_0xade8('0xe')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xade8('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xade8('0x3')]},'holdtime':{'type':Sequelize[_0xade8('0xe')]},'mohtime':{'type':Sequelize[_0xade8('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xade8('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xade8('0x3')]},'transfer':{'type':Sequelize[_0xade8('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xade8('0x11')},'transferexten':{'type':Sequelize[_0xade8('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xade8('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xade8('0xe')],'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 403595c..19b67ab 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 _0x32b1=['fields','length','hasOwnProperty','nolimit','order','pick','where','map','type','key','VIRTUAL','field','filter','then','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','describe','getVoiceQueuesReport','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x32b1,0xbc));var _0x132b=function(_0x3de80e,_0x5cabca){_0x3de80e=_0x3de80e-0x0;var _0x5629fd=_0x32b1[_0x3de80e];return _0x5629fd;};'use strict';var pdf=require(_0x132b('0x0'));var emlformat=require(_0x132b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x132b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x132b('0x3'));var moment=require(_0x132b('0x4'));var BPromise=require(_0x132b('0x5'));var Mustache=require('mustache');var util=require(_0x132b('0x6'));var path=require('path');var sox=require(_0x132b('0x7'));var csv=require(_0x132b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x132b('0x9'));var crypto=require(_0x132b('0xa'));var jsforce=require(_0x132b('0xb'));var deskjs=require(_0x132b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x132b('0xd'));var Papa=require(_0x132b('0xe'));var Redis=require(_0x132b('0xf'));var authService=require(_0x132b('0x10'));var qs=require('../../components/parsers/qs');var hardwareService=require(_0x132b('0x11'));var logger=require(_0x132b('0x12'))('api');var utils=require(_0x132b('0x13'));var config=require(_0x132b('0x14'));var db=require('../../mysqldb')['db'];config[_0x132b('0x15')]=_[_0x132b('0x16')](config[_0x132b('0x15')],{'host':_0x132b('0x17'),'port':0x18eb});var socket=require(_0x132b('0x18'))(new Redis(config[_0x132b('0x15')]));require('./voiceQueueReport.socket')[_0x132b('0x19')](socket);function respondWithStatusCode(_0x4b8dd9,_0x436a8c){_0x436a8c=_0x436a8c||0xcc;return function(_0x187c43){if(_0x187c43){return _0x4b8dd9[_0x132b('0x1a')](_0x436a8c);}return _0x4b8dd9[_0x132b('0x1b')](_0x436a8c)[_0x132b('0x1c')]();};}function respondWithResult(_0x9c5ddd,_0x44182f){_0x44182f=_0x44182f||0xc8;return function(_0x4f5d14){if(_0x4f5d14){return _0x9c5ddd[_0x132b('0x1b')](_0x44182f)[_0x132b('0x1d')](_0x4f5d14);}};}function respondWithFilteredResult(_0x4e8a44,_0xa933ef){return function(_0x51a653){if(_0x51a653){var _0x4e7ed7=_0x51a653[_0x132b('0x1e')],_0x17bb29=_0xa933ef[_0x132b('0x1f')],_0x474313=_0xa933ef[_0x132b('0x1f')]+_0xa933ef[_0x132b('0x20')],_0x6772e4;if(_0x474313>=_0x4e7ed7){_0x474313=_0x4e7ed7;_0x6772e4=0xc8;}else{_0x6772e4=0xce;}_0x4e8a44[_0x132b('0x1b')](_0x6772e4);return _0x4e8a44[_0x132b('0x21')](_0x132b('0x22'),_0x17bb29+'-'+_0x474313+'/'+_0x4e7ed7)[_0x132b('0x1d')](_0x51a653);}return null;};}function patchUpdates(_0x18e81a){return function(_0x33f184){try{jsonpatch[_0x132b('0x23')](_0x33f184,_0x18e81a,!![]);}catch(_0x16173b){return BPromise[_0x132b('0x24')](_0x16173b);}return _0x33f184['save']();};}function saveUpdates(_0x79b879,_0x33902a){return function(_0xf66ab9){if(_0xf66ab9){return _0xf66ab9[_0x132b('0x25')](_0x79b879)['then'](function(_0x82b7ef){return _0x82b7ef;});}return null;};}function removeEntity(_0x29238f,_0x290487){return function(_0x65766c){if(_0x65766c){return _0x65766c[_0x132b('0x26')]()['then'](function(){_0x29238f[_0x132b('0x1b')](0xcc)[_0x132b('0x1c')]();});}};}function handleEntityNotFound(_0x11a4d4,_0x57dd1f){return function(_0x5c32ef){if(!_0x5c32ef){_0x11a4d4[_0x132b('0x1a')](0x194);}return _0x5c32ef;};}function handleError(_0x556027,_0x4a870b){_0x4a870b=_0x4a870b||0x1f4;return function(_0x1431ae){logger[_0x132b('0x27')](_0x1431ae[_0x132b('0x28')]);if(_0x1431ae['name']){delete _0x1431ae[_0x132b('0x29')];}_0x556027[_0x132b('0x1b')](_0x4a870b)[_0x132b('0x2a')](_0x1431ae);};}exports[_0x132b('0x2b')]=function(_0x31f06d,_0x36bff8){var _0x19b243={},_0x51a976={},_0x6d4a56={'count':0x0,'rows':[]};var _0x3d3b29=db[_0x132b('0x2c')][_0x132b('0x2d')];_0x51a976[_0x132b('0x2e')]=_[_0x132b('0x2f')](_0x3d3b29);_0x51a976[_0x132b('0x30')]=_[_0x132b('0x2f')](_0x31f06d[_0x132b('0x30')]);_0x51a976[_0x132b('0x31')]=_[_0x132b('0x32')](_0x51a976[_0x132b('0x2e')],_0x51a976[_0x132b('0x30')]);_0x19b243[_0x132b('0x33')]=_[_0x132b('0x32')](_0x51a976[_0x132b('0x2e')],qs['fields'](_0x31f06d[_0x132b('0x30')][_0x132b('0x34')]));_0x19b243[_0x132b('0x33')]=_0x19b243['attributes'][_0x132b('0x35')]?_0x19b243['attributes']:_0x51a976[_0x132b('0x2e')];if(!_0x31f06d[_0x132b('0x30')][_0x132b('0x36')](_0x132b('0x37'))){_0x19b243[_0x132b('0x20')]=qs[_0x132b('0x20')](_0x31f06d[_0x132b('0x30')]['limit']);_0x19b243[_0x132b('0x1f')]=qs[_0x132b('0x1f')](_0x31f06d[_0x132b('0x30')]['offset']);}_0x19b243[_0x132b('0x38')]=qs['sort'](_0x31f06d[_0x132b('0x30')]['sort']);_0x19b243['where']=qs[_0x132b('0x31')](_[_0x132b('0x39')](_0x31f06d[_0x132b('0x30')],_0x51a976[_0x132b('0x31')]));if(_0x31f06d['query']['filter']){_0x19b243[_0x132b('0x3a')]=_['merge'](_0x19b243['where'],{'$or':_[_0x132b('0x3b')](_0x3d3b29,function(_0x28a915){if(_0x28a915[_0x132b('0x3c')][_0x132b('0x3d')]!==_0x132b('0x3e')){var _0x56f619={};_0x56f619[_0x28a915[_0x132b('0x3f')]]={'$like':'%'+_0x31f06d[_0x132b('0x30')][_0x132b('0x40')]+'%'};return _0x56f619;}})});}_0x19b243=_['merge']({},_0x19b243,_0x31f06d['options']);var _0x583566={'where':_0x19b243[_0x132b('0x3a')]};return db['VoiceQueueReport']['count'](_0x583566)[_0x132b('0x41')](function(_0x42560c){_0x6d4a56[_0x132b('0x1e')]=_0x42560c;if(_0x31f06d['query'][_0x132b('0x42')]){_0x19b243[_0x132b('0x43')]=[{'all':!![]}];}return db[_0x132b('0x2c')][_0x132b('0x44')](_0x19b243);})[_0x132b('0x41')](function(_0x20fbd7){_0x6d4a56[_0x132b('0x45')]=_0x20fbd7;return _0x6d4a56;})['then'](respondWithFilteredResult(_0x36bff8,_0x19b243))[_0x132b('0x46')](handleError(_0x36bff8,null));};exports[_0x132b('0x47')]=function(_0x2cb62b,_0x5a2d9b){var _0x22209a={'raw':![],'where':{'id':_0x2cb62b[_0x132b('0x48')]['id']}},_0x45a9f4={};_0x45a9f4['model']=_['keys'](db[_0x132b('0x2c')][_0x132b('0x2d')]);_0x45a9f4['query']=_[_0x132b('0x2f')](_0x2cb62b[_0x132b('0x30')]);_0x45a9f4[_0x132b('0x31')]=_['intersection'](_0x45a9f4['model'],_0x45a9f4[_0x132b('0x30')]);_0x22209a[_0x132b('0x33')]=_[_0x132b('0x32')](_0x45a9f4[_0x132b('0x2e')],qs[_0x132b('0x34')](_0x2cb62b['query']['fields']));_0x22209a[_0x132b('0x33')]=_0x22209a[_0x132b('0x33')][_0x132b('0x35')]?_0x22209a[_0x132b('0x33')]:_0x45a9f4[_0x132b('0x2e')];if(_0x2cb62b['query'][_0x132b('0x42')]){_0x22209a[_0x132b('0x43')]=[{'all':!![]}];}_0x22209a=_[_0x132b('0x49')]({},_0x22209a,_0x2cb62b[_0x132b('0x4a')]);return db[_0x132b('0x2c')][_0x132b('0x4b')](_0x22209a)[_0x132b('0x41')](handleEntityNotFound(_0x5a2d9b,null))[_0x132b('0x41')](respondWithResult(_0x5a2d9b,null))[_0x132b('0x46')](handleError(_0x5a2d9b,null));};exports['create']=function(_0x5eef1a,_0x4d04a6){return db[_0x132b('0x2c')][_0x132b('0x4c')](_0x5eef1a[_0x132b('0x4d')],{})[_0x132b('0x41')](respondWithResult(_0x4d04a6,0xc9))[_0x132b('0x46')](handleError(_0x4d04a6,null));};exports[_0x132b('0x25')]=function(_0x166480,_0x5de310){if(_0x166480['body']['id']){delete _0x166480[_0x132b('0x4d')]['id'];}return db[_0x132b('0x2c')][_0x132b('0x4b')]({'where':{'id':_0x166480[_0x132b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5de310,null))[_0x132b('0x41')](saveUpdates(_0x166480[_0x132b('0x4d')],null))['then'](respondWithResult(_0x5de310,null))[_0x132b('0x46')](handleError(_0x5de310,null));};exports[_0x132b('0x26')]=function(_0x27b5ca,_0x5b1ba9){return db[_0x132b('0x2c')]['find']({'where':{'id':_0x27b5ca[_0x132b('0x48')]['id']}})[_0x132b('0x41')](handleEntityNotFound(_0x5b1ba9,null))['then'](removeEntity(_0x5b1ba9,null))['catch'](handleError(_0x5b1ba9,null));};exports['describe']=function(_0xe04830,_0x4462b5){return db[_0x132b('0x2c')][_0x132b('0x4e')]()[_0x132b('0x41')](respondWithResult(_0x4462b5,null))[_0x132b('0x46')](handleError(_0x4462b5,null));};exports[_0x132b('0x4f')]=function(_0x5ede0f,_0x2517d6){var _0x4584fc={},_0x2844c8={},_0x52fb17={'count':0x0,'rows':[]};_0x2844c8[_0x132b('0x2e')]=_[_0x132b('0x2f')](db['VoiceQueueReport']['rawAttributes']);_0x2844c8['query']=_[_0x132b('0x2f')](_0x5ede0f[_0x132b('0x30')]);_0x2844c8[_0x132b('0x31')]=_[_0x132b('0x32')](_0x2844c8['model'],_0x2844c8[_0x132b('0x30')]);_0x4584fc[_0x132b('0x33')]=_[_0x132b('0x32')](_0x2844c8[_0x132b('0x2e')],qs[_0x132b('0x34')](_0x5ede0f[_0x132b('0x30')][_0x132b('0x34')]));_0x4584fc[_0x132b('0x33')]=_0x4584fc[_0x132b('0x33')][_0x132b('0x35')]?_0x4584fc[_0x132b('0x33')]:_0x2844c8[_0x132b('0x2e')];if(!_0x5ede0f[_0x132b('0x30')][_0x132b('0x36')](_0x132b('0x37'))){_0x4584fc[_0x132b('0x20')]=qs[_0x132b('0x20')](_0x5ede0f[_0x132b('0x30')][_0x132b('0x20')]);_0x4584fc[_0x132b('0x1f')]=qs[_0x132b('0x1f')](_0x5ede0f['query'][_0x132b('0x1f')]);}_0x4584fc[_0x132b('0x38')]=qs['sort'](_0x5ede0f[_0x132b('0x30')]['sort']);_0x4584fc['where']=qs[_0x132b('0x31')](_[_0x132b('0x39')](_0x5ede0f['query'],_0x2844c8[_0x132b('0x31')]));if(_0x5ede0f[_0x132b('0x30')]['filter']){_0x4584fc['where']=_[_0x132b('0x49')](_0x4584fc[_0x132b('0x3a')],{'$or':_[_0x132b('0x3b')](_0x4584fc[_0x132b('0x33')],function(_0x19532b){var _0x3d0874={};_0x3d0874[_0x19532b]={'$like':'%'+_0x5ede0f[_0x132b('0x30')][_0x132b('0x40')]+'%'};return _0x3d0874;})});}_0x4584fc=_['merge']({},_0x4584fc,_0x5ede0f[_0x132b('0x4a')]);var _0x58eee0={'where':_0x4584fc[_0x132b('0x3a')]};return db[_0x132b('0x2c')][_0x132b('0x1e')](_0x58eee0)[_0x132b('0x41')](function(_0x499963){_0x52fb17[_0x132b('0x1e')]=_0x499963;if(_0x5ede0f[_0x132b('0x30')][_0x132b('0x42')]){_0x4584fc['include']=[{'all':!![]}];}return db[_0x132b('0x2c')]['findAll'](_0x4584fc);})[_0x132b('0x41')](function(_0x19f78c){_0x52fb17[_0x132b('0x45')]=_0x19f78c;return _0x52fb17;})[_0x132b('0x41')](respondWithFilteredResult(_0x2517d6,_0x4584fc,'getVoiceQueuesReport'))[_0x132b('0x46')](handleError(_0x2517d6,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x2eb6=['error','stack','name','index','VoiceQueueReport','rawAttributes','model','keys','query','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','map','key','field','options','include','rows','catch','show','params','fields','includeAll','find','body','describe','getVoiceQueuesReport','nolimit','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','redis','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus'];(function(_0xb376de,_0xc6ff08){var _0x73c45a=function(_0x53673c){while(--_0x53673c){_0xb376de['push'](_0xb376de['shift']());}};_0x73c45a(++_0xc6ff08);}(_0x2eb6,0x1ce));var _0x62eb=function(_0x11cf97,_0x1b6768){_0x11cf97=_0x11cf97-0x0;var _0x3743bd=_0x2eb6[_0x11cf97];return _0x3743bd;};'use strict';var pdf=require(_0x62eb('0x0'));var emlformat=require(_0x62eb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x62eb('0x2'));var rp=require(_0x62eb('0x3'));var moment=require(_0x62eb('0x4'));var BPromise=require(_0x62eb('0x5'));var Mustache=require(_0x62eb('0x6'));var util=require('util');var path=require(_0x62eb('0x7'));var sox=require(_0x62eb('0x8'));var csv=require(_0x62eb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62eb('0xa'));var squel=require(_0x62eb('0xb'));var crypto=require(_0x62eb('0xc'));var jsforce=require(_0x62eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x62eb('0x9'));var querystring=require(_0x62eb('0xe'));var Papa=require('papaparse');var Redis=require(_0x62eb('0xf'));var authService=require(_0x62eb('0x10'));var qs=require(_0x62eb('0x11'));var hardwareService=require(_0x62eb('0x12'));var logger=require('../../config/logger')(_0x62eb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x62eb('0x14'))['db'];config[_0x62eb('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62eb('0x15')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x561870,_0x527593){_0x527593=_0x527593||0xcc;return function(_0x48d0dc){if(_0x48d0dc){return _0x561870['sendStatus'](_0x527593);}return _0x561870[_0x62eb('0x16')](_0x527593)['end']();};}function respondWithResult(_0x219126,_0x22046b){_0x22046b=_0x22046b||0xc8;return function(_0x289050){if(_0x289050){return _0x219126[_0x62eb('0x16')](_0x22046b)[_0x62eb('0x17')](_0x289050);}};}function respondWithFilteredResult(_0x100bf7,_0x3a3470){return function(_0x208f3d){if(_0x208f3d){var _0x8de78f=_0x208f3d[_0x62eb('0x18')],_0xf94e8=_0x3a3470[_0x62eb('0x19')],_0x22c0c8=_0x3a3470[_0x62eb('0x19')]+_0x3a3470['limit'],_0x53cace;if(_0x22c0c8>=_0x8de78f){_0x22c0c8=_0x8de78f;_0x53cace=0xc8;}else{_0x53cace=0xce;}_0x100bf7[_0x62eb('0x16')](_0x53cace);return _0x100bf7['set'](_0x62eb('0x1a'),_0xf94e8+'-'+_0x22c0c8+'/'+_0x8de78f)[_0x62eb('0x17')](_0x208f3d);}return null;};}function patchUpdates(_0x4efbee){return function(_0x5b6da5){try{jsonpatch[_0x62eb('0x1b')](_0x5b6da5,_0x4efbee,!![]);}catch(_0x422e83){return BPromise[_0x62eb('0x1c')](_0x422e83);}return _0x5b6da5[_0x62eb('0x1d')]();};}function saveUpdates(_0x161775,_0x39895b){return function(_0x23189b){if(_0x23189b){return _0x23189b[_0x62eb('0x1e')](_0x161775)[_0x62eb('0x1f')](function(_0x30a27f){return _0x30a27f;});}return null;};}function removeEntity(_0x341625,_0x36b4e0){return function(_0x70fd6e){if(_0x70fd6e){return _0x70fd6e[_0x62eb('0x20')]()['then'](function(){_0x341625['status'](0xcc)[_0x62eb('0x21')]();});}};}function handleEntityNotFound(_0x8a1bf8,_0x162132){return function(_0x273221){if(!_0x273221){_0x8a1bf8[_0x62eb('0x22')](0x194);}return _0x273221;};}function handleError(_0x103d5e,_0x4830af){_0x4830af=_0x4830af||0x1f4;return function(_0x27436a){logger[_0x62eb('0x23')](_0x27436a[_0x62eb('0x24')]);if(_0x27436a['name']){delete _0x27436a[_0x62eb('0x25')];}_0x103d5e['status'](_0x4830af)['send'](_0x27436a);};}exports[_0x62eb('0x26')]=function(_0x37fbb5,_0x9131d){var _0x26221c={},_0x49a5b8={},_0x247d4e={'count':0x0,'rows':[]};var _0x44bc7a=db[_0x62eb('0x27')][_0x62eb('0x28')];_0x49a5b8[_0x62eb('0x29')]=_[_0x62eb('0x2a')](_0x44bc7a);_0x49a5b8[_0x62eb('0x2b')]=_[_0x62eb('0x2a')](_0x37fbb5[_0x62eb('0x2b')]);_0x49a5b8['filters']=_[_0x62eb('0x2c')](_0x49a5b8[_0x62eb('0x29')],_0x49a5b8[_0x62eb('0x2b')]);_0x26221c['attributes']=_[_0x62eb('0x2c')](_0x49a5b8['model'],qs['fields'](_0x37fbb5[_0x62eb('0x2b')]['fields']));_0x26221c[_0x62eb('0x2d')]=_0x26221c[_0x62eb('0x2d')][_0x62eb('0x2e')]?_0x26221c[_0x62eb('0x2d')]:_0x49a5b8[_0x62eb('0x29')];if(!_0x37fbb5[_0x62eb('0x2b')][_0x62eb('0x2f')]('nolimit')){_0x26221c['limit']=qs['limit'](_0x37fbb5[_0x62eb('0x2b')][_0x62eb('0x30')]);_0x26221c['offset']=qs[_0x62eb('0x19')](_0x37fbb5[_0x62eb('0x2b')][_0x62eb('0x19')]);}_0x26221c[_0x62eb('0x31')]=qs[_0x62eb('0x32')](_0x37fbb5['query'][_0x62eb('0x32')]);_0x26221c[_0x62eb('0x33')]=qs['filters'](_['pick'](_0x37fbb5['query'],_0x49a5b8[_0x62eb('0x34')]));if(_0x37fbb5[_0x62eb('0x2b')][_0x62eb('0x35')]){_0x26221c[_0x62eb('0x33')]=_[_0x62eb('0x36')](_0x26221c['where'],{'$or':_[_0x62eb('0x37')](_0x44bc7a,function(_0x497445){if(_0x497445['type'][_0x62eb('0x38')]!=='VIRTUAL'){var _0x28388e={};_0x28388e[_0x497445[_0x62eb('0x39')]]={'$like':'%'+_0x37fbb5[_0x62eb('0x2b')][_0x62eb('0x35')]+'%'};return _0x28388e;}})});}_0x26221c=_['merge']({},_0x26221c,_0x37fbb5[_0x62eb('0x3a')]);var _0x477ed9={'where':_0x26221c[_0x62eb('0x33')]};return db[_0x62eb('0x27')]['count'](_0x477ed9)[_0x62eb('0x1f')](function(_0x1aa21f){_0x247d4e['count']=_0x1aa21f;if(_0x37fbb5[_0x62eb('0x2b')]['includeAll']){_0x26221c[_0x62eb('0x3b')]=[{'all':!![]}];}return db[_0x62eb('0x27')]['findAll'](_0x26221c);})[_0x62eb('0x1f')](function(_0x51a973){_0x247d4e[_0x62eb('0x3c')]=_0x51a973;return _0x247d4e;})['then'](respondWithFilteredResult(_0x9131d,_0x26221c))[_0x62eb('0x3d')](handleError(_0x9131d,null));};exports[_0x62eb('0x3e')]=function(_0x2d3282,_0x576879){var _0x3507ee={'raw':![],'where':{'id':_0x2d3282[_0x62eb('0x3f')]['id']}},_0x12ba5d={};_0x12ba5d[_0x62eb('0x29')]=_[_0x62eb('0x2a')](db[_0x62eb('0x27')][_0x62eb('0x28')]);_0x12ba5d[_0x62eb('0x2b')]=_[_0x62eb('0x2a')](_0x2d3282['query']);_0x12ba5d['filters']=_[_0x62eb('0x2c')](_0x12ba5d[_0x62eb('0x29')],_0x12ba5d['query']);_0x3507ee[_0x62eb('0x2d')]=_['intersection'](_0x12ba5d[_0x62eb('0x29')],qs['fields'](_0x2d3282[_0x62eb('0x2b')][_0x62eb('0x40')]));_0x3507ee[_0x62eb('0x2d')]=_0x3507ee[_0x62eb('0x2d')][_0x62eb('0x2e')]?_0x3507ee['attributes']:_0x12ba5d['model'];if(_0x2d3282[_0x62eb('0x2b')][_0x62eb('0x41')]){_0x3507ee[_0x62eb('0x3b')]=[{'all':!![]}];}_0x3507ee=_[_0x62eb('0x36')]({},_0x3507ee,_0x2d3282[_0x62eb('0x3a')]);return db[_0x62eb('0x27')][_0x62eb('0x42')](_0x3507ee)[_0x62eb('0x1f')](handleEntityNotFound(_0x576879,null))['then'](respondWithResult(_0x576879,null))[_0x62eb('0x3d')](handleError(_0x576879,null));};exports['create']=function(_0x538626,_0x93b079){return db['VoiceQueueReport']['create'](_0x538626[_0x62eb('0x43')],{})[_0x62eb('0x1f')](respondWithResult(_0x93b079,0xc9))[_0x62eb('0x3d')](handleError(_0x93b079,null));};exports[_0x62eb('0x1e')]=function(_0x2f3fd4,_0x1a341b){if(_0x2f3fd4[_0x62eb('0x43')]['id']){delete _0x2f3fd4[_0x62eb('0x43')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x2f3fd4[_0x62eb('0x3f')]['id']}})[_0x62eb('0x1f')](handleEntityNotFound(_0x1a341b,null))['then'](saveUpdates(_0x2f3fd4['body'],null))[_0x62eb('0x1f')](respondWithResult(_0x1a341b,null))[_0x62eb('0x3d')](handleError(_0x1a341b,null));};exports['destroy']=function(_0x3cc3ce,_0x1fadcc){return db[_0x62eb('0x27')]['find']({'where':{'id':_0x3cc3ce[_0x62eb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1fadcc,null))['then'](removeEntity(_0x1fadcc,null))[_0x62eb('0x3d')](handleError(_0x1fadcc,null));};exports[_0x62eb('0x44')]=function(_0x3e0440,_0x360d58){return db['VoiceQueueReport'][_0x62eb('0x44')]()[_0x62eb('0x1f')](respondWithResult(_0x360d58,null))[_0x62eb('0x3d')](handleError(_0x360d58,null));};exports[_0x62eb('0x45')]=function(_0x38b1f6,_0x2c7081){var _0x47ae6c={},_0x5f59d9={},_0x4b997d={'count':0x0,'rows':[]};_0x5f59d9[_0x62eb('0x29')]=_[_0x62eb('0x2a')](db[_0x62eb('0x27')]['rawAttributes']);_0x5f59d9[_0x62eb('0x2b')]=_['keys'](_0x38b1f6[_0x62eb('0x2b')]);_0x5f59d9[_0x62eb('0x34')]=_[_0x62eb('0x2c')](_0x5f59d9[_0x62eb('0x29')],_0x5f59d9[_0x62eb('0x2b')]);_0x47ae6c[_0x62eb('0x2d')]=_[_0x62eb('0x2c')](_0x5f59d9[_0x62eb('0x29')],qs[_0x62eb('0x40')](_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x40')]));_0x47ae6c[_0x62eb('0x2d')]=_0x47ae6c[_0x62eb('0x2d')]['length']?_0x47ae6c[_0x62eb('0x2d')]:_0x5f59d9['model'];if(!_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x2f')](_0x62eb('0x46'))){_0x47ae6c[_0x62eb('0x30')]=qs['limit'](_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x30')]);_0x47ae6c['offset']=qs[_0x62eb('0x19')](_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x19')]);}_0x47ae6c[_0x62eb('0x31')]=qs[_0x62eb('0x32')](_0x38b1f6['query'][_0x62eb('0x32')]);_0x47ae6c[_0x62eb('0x33')]=qs[_0x62eb('0x34')](_['pick'](_0x38b1f6[_0x62eb('0x2b')],_0x5f59d9[_0x62eb('0x34')]));if(_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x35')]){_0x47ae6c['where']=_[_0x62eb('0x36')](_0x47ae6c[_0x62eb('0x33')],{'$or':_[_0x62eb('0x37')](_0x47ae6c['attributes'],function(_0x18e862){var _0x30ecf1={};_0x30ecf1[_0x18e862]={'$like':'%'+_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x35')]+'%'};return _0x30ecf1;})});}_0x47ae6c=_[_0x62eb('0x36')]({},_0x47ae6c,_0x38b1f6[_0x62eb('0x3a')]);var _0x188b29={'where':_0x47ae6c[_0x62eb('0x33')]};return db['VoiceQueueReport'][_0x62eb('0x18')](_0x188b29)[_0x62eb('0x1f')](function(_0x3f4211){_0x4b997d['count']=_0x3f4211;if(_0x38b1f6[_0x62eb('0x2b')][_0x62eb('0x41')]){_0x47ae6c['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x47ae6c);})[_0x62eb('0x1f')](function(_0x1ac334){_0x4b997d['rows']=_0x1ac334;return _0x4b997d;})[_0x62eb('0x1f')](respondWithFilteredResult(_0x2c7081,_0x47ae6c,_0x62eb('0x45')))[_0x62eb('0x3d')](handleError(_0x2c7081,null,_0x62eb('0x45')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e12f745..e2e92f9 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 _0x5c09=['VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x49bf98,_0x4fb309){var _0x10f771=function(_0x231838){while(--_0x231838){_0x49bf98['push'](_0x49bf98['shift']());}};_0x10f771(++_0x4fb309);}(_0x5c09,0x19f));var _0x95c0=function(_0xb6ddda,_0x180c4c){_0xb6ddda=_0xb6ddda-0x0;var _0x4760e2=_0x5c09[_0xb6ddda];return _0x4760e2;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x95c0('0x0'))['db'][_0x95c0('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x95c0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95c0('0x3'),'afterDestroy':_0x95c0('0x4')};function emitEvent(_0x58b9d8){return function(_0x1815ba,_0x1b558b,_0x4bfb91){VoiceQueueReportEvents[_0x95c0('0x5')](_0x58b9d8+':'+_0x1815ba['id'],_0x1815ba);VoiceQueueReportEvents[_0x95c0('0x5')](_0x58b9d8,_0x1815ba);_0x4bfb91(null);};}for(var e in events){if(events[_0x95c0('0x6')](e)){var event=events[e];VoiceQueueReport[_0x95c0('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xb8ba=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb8ba,0x6d));var _0xab8b=function(_0x2ed8bc,_0x55206d){_0x2ed8bc=_0x2ed8bc-0x0;var _0x5c090b=_0xb8ba[_0x2ed8bc];return _0x5c090b;};'use strict';var EventEmitter=require(_0xab8b('0x0'));var VoiceQueueReport=require(_0xab8b('0x1'))['db'][_0xab8b('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab8b('0x3'),'afterUpdate':_0xab8b('0x4'),'afterDestroy':_0xab8b('0x5')};function emitEvent(_0x275551){return function(_0x44e775,_0x82247c,_0x1d9664){VoiceQueueReportEvents[_0xab8b('0x6')](_0x275551+':'+_0x44e775['id'],_0x44e775);VoiceQueueReportEvents['emit'](_0x275551,_0x44e775);_0x1d9664(null);};}for(var e in events){if(events[_0xab8b('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xab8b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 583c2bb..2264791 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 _0xaa03=['path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xaa03,0xb1));var _0x3aa0=function(_0x3dc7f0,_0x203010){_0x3dc7f0=_0x3dc7f0-0x0;var _0x4289fc=_0xaa03[_0x3dc7f0];return _0x4289fc;};'use strict';var _=require('lodash');var util=require(_0x3aa0('0x0'));var logger=require(_0x3aa0('0x1'))(_0x3aa0('0x2'));var moment=require('moment');var BPromise=require(_0x3aa0('0x3'));var rp=require(_0x3aa0('0x4'));var fs=require('fs');var path=require(_0x3aa0('0x5'));var rimraf=require(_0x3aa0('0x6'));var config=require('../../config/environment');var attributes=require(_0x3aa0('0x7'));module[_0x3aa0('0x8')]=function(_0x40facd,_0x1d619b){return _0x40facd[_0x3aa0('0x9')](_0x3aa0('0xa'),attributes,{'tableName':_0x3aa0('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3aa0('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x59d9=['../../config/environment','exports','define','report_queue','uniqueid','calleridnum','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c0fcd,_0x18603b){var _0x3daa90=function(_0x264dcd){while(--_0x264dcd){_0x3c0fcd['push'](_0x3c0fcd['shift']());}};_0x3daa90(++_0x18603b);}(_0x59d9,0x88));var _0x959d=function(_0x8665a7,_0x296fa5){_0x8665a7=_0x8665a7-0x0;var _0x77ff17=_0x59d9[_0x8665a7];return _0x77ff17;};'use strict';var _=require(_0x959d('0x0'));var util=require(_0x959d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x959d('0x2'));var BPromise=require(_0x959d('0x3'));var rp=require(_0x959d('0x4'));var fs=require('fs');var path=require(_0x959d('0x5'));var rimraf=require(_0x959d('0x6'));var config=require(_0x959d('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x959d('0x8')]=function(_0x5c8629,_0x10ca35){return _0x5c8629[_0x959d('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x959d('0xa'),'paranoid':![],'indexes':[{'fields':[_0x959d('0xb')]},{'fields':[_0x959d('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 02ec9ad..585915a 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 _0x379d=['update','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','map','model','include','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport'];(function(_0x45682b,_0x22ef44){var _0x28c3cd=function(_0x59047b){while(--_0x59047b){_0x45682b['push'](_0x45682b['shift']());}};_0x28c3cd(++_0x22ef44);}(_0x379d,0x13a));var _0xd379=function(_0x111ff7,_0x4715c1){_0x111ff7=_0x111ff7-0x0;var _0x408ff1=_0x379d[_0x111ff7];return _0x408ff1;};'use strict';var _=require('lodash');var util=require(_0xd379('0x0'));var moment=require('moment');var BPromise=require(_0xd379('0x1'));var rs=require(_0xd379('0x2'));var fs=require('fs');var Redis=require(_0xd379('0x3'));var db=require(_0xd379('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd379('0x5'))(_0xd379('0x6'));var config=require(_0xd379('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd379('0x8')][_0xd379('0x9')]({'port':0x232a});config[_0xd379('0xa')]=_['defaults'](config[_0xd379('0xa')],{'host':_0xd379('0xb'),'port':0x18eb});var socket=require(_0xd379('0xc'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xd379('0xd')](socket);function respondWithRpcPromise(_0x491faa,_0x4cea3a,_0x2656a0){return new BPromise(function(_0x4c7c0b,_0x13ee91){return client[_0xd379('0xe')](_0x491faa,_0x2656a0)[_0xd379('0xf')](function(_0x4bebce){logger[_0xd379('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x4cea3a,_0xd379('0x11'));logger[_0xd379('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x4cea3a,_0xd379('0x11'),JSON[_0xd379('0x13')](_0x4bebce));if(_0x4bebce['error']){if(_0x4bebce[_0xd379('0x14')]['code']===0x1f4){logger[_0xd379('0x14')](_0xd379('0x15'),_0x4cea3a,_0x4bebce[_0xd379('0x14')][_0xd379('0x16')]);return _0x13ee91(_0x4bebce[_0xd379('0x14')][_0xd379('0x16')]);}logger[_0xd379('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4cea3a,_0x4bebce['error'][_0xd379('0x16')]);return _0x4c7c0b(_0x4bebce['error'][_0xd379('0x16')]);}else{logger['info'](_0xd379('0x15'),_0x4cea3a,_0xd379('0x11'));_0x4c7c0b(_0x4bebce['result'][_0xd379('0x16')]);}})[_0xd379('0x17')](function(_0x3204bd){logger[_0xd379('0x14')](_0xd379('0x15'),_0x4cea3a,_0x3204bd);_0x13ee91(_0x3204bd);});});}exports[_0xd379('0x18')]=function(_0x12c708){var _0x4e3df0=this;return new Promise(function(_0x4a376d,_0x31a3c2){return db[_0xd379('0x19')]['findAll']({'raw':_0x12c708[_0xd379('0x1a')]?_0x12c708[_0xd379('0x1a')][_0xd379('0x1b')]===undefined?!![]:![]:!![],'where':_0x12c708[_0xd379('0x1a')]?_0x12c708[_0xd379('0x1a')][_0xd379('0x1c')]||null:null,'attributes':_0x12c708[_0xd379('0x1a')]?_0x12c708[_0xd379('0x1a')][_0xd379('0x1d')]||null:null,'limit':_0x12c708['options']?_0x12c708[_0xd379('0x1a')]['limit']||null:null,'include':_0x12c708[_0xd379('0x1a')]?_0x12c708[_0xd379('0x1a')]['include']?_['map'](_0x12c708['options']['include'],function(_0x2308ae){return{'model':db[_0x2308ae['model']],'as':_0x2308ae['as'],'attributes':_0x2308ae[_0xd379('0x1d')],'include':_0x2308ae['include']?_[_0xd379('0x1e')](_0x2308ae['include'],function(_0x3f3818){return{'model':db[_0x3f3818[_0xd379('0x1f')]],'as':_0x3f3818['as'],'attributes':_0x3f3818[_0xd379('0x1d')],'include':_0x3f3818[_0xd379('0x20')]?_['map'](_0x3f3818['include'],function(_0x54eba3){return{'model':db[_0x54eba3[_0xd379('0x1f')]],'as':_0x54eba3['as'],'attributes':_0x54eba3[_0xd379('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd379('0xf')](function(_0x4ed977){logger[_0xd379('0x10')](_0xd379('0x18'),_0x12c708);logger[_0xd379('0x12')](_0xd379('0x18'),_0x12c708,JSON[_0xd379('0x13')](_0x4ed977));_0x4a376d(_0x4ed977);})[_0xd379('0x17')](function(_0x3726ec){logger['error'](_0xd379('0x18'),_0x3726ec[_0xd379('0x16')],_0x12c708);_0x31a3c2(_0x4e3df0[_0xd379('0x14')](0x1f4,_0x3726ec[_0xd379('0x16')]));});});};exports[_0xd379('0x21')]=function(_0x2d0b77){var _0x11de8b=this;return new Promise(function(_0x4df663,_0x53f89d){return db[_0xd379('0x19')][_0xd379('0x22')](_0x2d0b77[_0xd379('0x23')],{'raw':_0x2d0b77['options']?_0x2d0b77['options'][_0xd379('0x1b')]===undefined?!![]:![]:!![]})[_0xd379('0xf')](function(_0x3038fd){logger['info'](_0xd379('0x21'),_0x2d0b77);logger[_0xd379('0x12')](_0xd379('0x21'),_0x2d0b77,JSON[_0xd379('0x13')](_0x3038fd));_0x4df663(_0x3038fd);})[_0xd379('0x17')](function(_0x4dc8ed){logger[_0xd379('0x14')](_0xd379('0x21'),_0x4dc8ed[_0xd379('0x16')],_0x2d0b77);_0x53f89d(_0x11de8b[_0xd379('0x14')](0x1f4,_0x4dc8ed[_0xd379('0x16')]));});});};exports[_0xd379('0x24')]=function(_0x20da2d){var _0x3bf6dd=this;return new Promise(function(_0x16c122,_0x434d4c){return db[_0xd379('0x19')][_0xd379('0x25')](_0x20da2d[_0xd379('0x23')],{'raw':_0x20da2d[_0xd379('0x1a')]?_0x20da2d[_0xd379('0x1a')][_0xd379('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20da2d[_0xd379('0x1a')]?_0x20da2d[_0xd379('0x1a')][_0xd379('0x1c')]||null:null,'attributes':_0x20da2d[_0xd379('0x1a')]?_0x20da2d[_0xd379('0x1a')][_0xd379('0x1d')]||null:null,'limit':_0x20da2d[_0xd379('0x1a')]?_0x20da2d[_0xd379('0x1a')][_0xd379('0x26')]||null:null})['then'](function(_0x504d61){logger['info']('UpdateVoiceQueueReport',_0x20da2d);logger['debug'](_0xd379('0x24'),_0x20da2d,JSON['stringify'](_0x504d61));_0x16c122(_0x504d61);})[_0xd379('0x17')](function(_0x4a7b37){logger['error'](_0xd379('0x24'),_0x4a7b37['message'],_0x20da2d);_0x434d4c(_0x3bf6dd[_0xd379('0x14')](0x1f4,_0x4a7b37[_0xd379('0x16')]));});});}; \ No newline at end of file +var _0xb46a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','debug','stringify','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2b02bd,_0x52d304){var _0x3208b3=function(_0x24e68a){while(--_0x24e68a){_0x2b02bd['push'](_0x2b02bd['shift']());}};_0x3208b3(++_0x52d304);}(_0xb46a,0x81));var _0xab46=function(_0x332699,_0x1e2129){_0x332699=_0x332699-0x0;var _0x47ecf9=_0xb46a[_0x332699];return _0x47ecf9;};'use strict';var _=require(_0xab46('0x0'));var util=require(_0xab46('0x1'));var moment=require(_0xab46('0x2'));var BPromise=require(_0xab46('0x3'));var rs=require(_0xab46('0x4'));var fs=require('fs');var Redis=require(_0xab46('0x5'));var db=require(_0xab46('0x6'))['db'];var utils=require(_0xab46('0x7'));var logger=require(_0xab46('0x8'))('rpc');var config=require(_0xab46('0x9'));var jayson=require(_0xab46('0xa'));var client=jayson[_0xab46('0xb')][_0xab46('0xc')]({'port':0x232a});config[_0xab46('0xd')]=_['defaults'](config['redis'],{'host':_0xab46('0xe'),'port':0x18eb});var socket=require(_0xab46('0xf'))(new Redis(config[_0xab46('0xd')]));require(_0xab46('0x10'))['register'](socket);function respondWithRpcPromise(_0x272b84,_0x36bd4f,_0x12e6e5){return new BPromise(function(_0x35b348,_0x4574e0){return client[_0xab46('0x11')](_0x272b84,_0x12e6e5)[_0xab46('0x12')](function(_0x25f273){logger[_0xab46('0x13')](_0xab46('0x14'),_0x36bd4f,_0xab46('0x15'));logger['debug'](_0xab46('0x16'),_0x36bd4f,_0xab46('0x15'),JSON['stringify'](_0x25f273));if(_0x25f273[_0xab46('0x17')]){if(_0x25f273['error'][_0xab46('0x18')]===0x1f4){logger[_0xab46('0x17')](_0xab46('0x14'),_0x36bd4f,_0x25f273[_0xab46('0x17')]['message']);return _0x4574e0(_0x25f273[_0xab46('0x17')][_0xab46('0x19')]);}logger[_0xab46('0x17')](_0xab46('0x14'),_0x36bd4f,_0x25f273['error'][_0xab46('0x19')]);return _0x35b348(_0x25f273[_0xab46('0x17')][_0xab46('0x19')]);}else{logger[_0xab46('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x36bd4f,_0xab46('0x15'));_0x35b348(_0x25f273[_0xab46('0x1a')][_0xab46('0x19')]);}})['catch'](function(_0x5ba347){logger[_0xab46('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x36bd4f,_0x5ba347);_0x4574e0(_0x5ba347);});});}exports[_0xab46('0x1b')]=function(_0x29124c){var _0x256b12=this;return new Promise(function(_0x3b6b2e,_0x2c9b0a){return db[_0xab46('0x1c')][_0xab46('0x1d')]({'raw':_0x29124c['options']?_0x29124c[_0xab46('0x1e')][_0xab46('0x1f')]===undefined?!![]:![]:!![],'where':_0x29124c[_0xab46('0x1e')]?_0x29124c[_0xab46('0x1e')][_0xab46('0x20')]||null:null,'attributes':_0x29124c[_0xab46('0x1e')]?_0x29124c[_0xab46('0x1e')][_0xab46('0x21')]||null:null,'limit':_0x29124c['options']?_0x29124c['options'][_0xab46('0x22')]||null:null,'include':_0x29124c[_0xab46('0x1e')]?_0x29124c[_0xab46('0x1e')][_0xab46('0x23')]?_['map'](_0x29124c[_0xab46('0x1e')]['include'],function(_0x10eaf6){return{'model':db[_0x10eaf6[_0xab46('0x24')]],'as':_0x10eaf6['as'],'attributes':_0x10eaf6['attributes'],'include':_0x10eaf6['include']?_[_0xab46('0x25')](_0x10eaf6[_0xab46('0x23')],function(_0x52537f){return{'model':db[_0x52537f['model']],'as':_0x52537f['as'],'attributes':_0x52537f[_0xab46('0x21')],'include':_0x52537f[_0xab46('0x23')]?_[_0xab46('0x25')](_0x52537f['include'],function(_0x5073c2){return{'model':db[_0x5073c2[_0xab46('0x24')]],'as':_0x5073c2['as'],'attributes':_0x5073c2[_0xab46('0x21')]};}):[]};}):[]};}):[]:[]})[_0xab46('0x12')](function(_0x14c161){logger['info']('GetVoiceQueueReport',_0x29124c);logger[_0xab46('0x26')]('GetVoiceQueueReport',_0x29124c,JSON[_0xab46('0x27')](_0x14c161));_0x3b6b2e(_0x14c161);})[_0xab46('0x28')](function(_0x5898de){logger[_0xab46('0x17')](_0xab46('0x1b'),_0x5898de[_0xab46('0x19')],_0x29124c);_0x2c9b0a(_0x256b12[_0xab46('0x17')](0x1f4,_0x5898de[_0xab46('0x19')]));});});};exports[_0xab46('0x29')]=function(_0x5d7f0c){var _0x3af832=this;return new Promise(function(_0x25618f,_0x13edeb){return db['VoiceQueueReport'][_0xab46('0x2a')](_0x5d7f0c[_0xab46('0x2b')],{'raw':_0x5d7f0c[_0xab46('0x1e')]?_0x5d7f0c[_0xab46('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xab46('0x12')](function(_0x169aa9){logger[_0xab46('0x13')]('CreateVoiceQueueReport',_0x5d7f0c);logger[_0xab46('0x26')](_0xab46('0x29'),_0x5d7f0c,JSON[_0xab46('0x27')](_0x169aa9));_0x25618f(_0x169aa9);})[_0xab46('0x28')](function(_0xa9d0b1){logger[_0xab46('0x17')](_0xab46('0x29'),_0xa9d0b1[_0xab46('0x19')],_0x5d7f0c);_0x13edeb(_0x3af832['error'](0x1f4,_0xa9d0b1[_0xab46('0x19')]));});});};exports[_0xab46('0x2c')]=function(_0x10ca8f){var _0x2706a8=this;return new Promise(function(_0x5b6628,_0x1ea4b8){return db[_0xab46('0x1c')]['update'](_0x10ca8f[_0xab46('0x2b')],{'raw':_0x10ca8f[_0xab46('0x1e')]?_0x10ca8f[_0xab46('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ca8f[_0xab46('0x1e')]?_0x10ca8f[_0xab46('0x1e')][_0xab46('0x20')]||null:null,'attributes':_0x10ca8f['options']?_0x10ca8f[_0xab46('0x1e')][_0xab46('0x21')]||null:null,'limit':_0x10ca8f[_0xab46('0x1e')]?_0x10ca8f[_0xab46('0x1e')][_0xab46('0x22')]||null:null})[_0xab46('0x12')](function(_0x38adb1){logger[_0xab46('0x13')](_0xab46('0x2c'),_0x10ca8f);logger[_0xab46('0x26')](_0xab46('0x2c'),_0x10ca8f,JSON['stringify'](_0x38adb1));_0x5b6628(_0x38adb1);})['catch'](function(_0x4794c0){logger['error'](_0xab46('0x2c'),_0x4794c0['message'],_0x10ca8f);_0x1ea4b8(_0x2706a8[_0xab46('0x17')](0x1f4,_0x4794c0[_0xab46('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index cdb1ce6..973f43c 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 _0xd592=['./voiceQueueReport.events','save','remove','removeListener','register','length'];(function(_0x4fd1ac,_0x308ff3){var _0x3638f1=function(_0x1e846a){while(--_0x1e846a){_0x4fd1ac['push'](_0x4fd1ac['shift']());}};_0x3638f1(++_0x308ff3);}(_0xd592,0x1ec));var _0x2d59=function(_0x25c811,_0x2fba7f){_0x25c811=_0x25c811-0x0;var _0x2165d5=_0xd592[_0x25c811];return _0x2165d5;};'use strict';var VoiceQueueReportEvents=require(_0x2d59('0x0'));var events=[_0x2d59('0x1'),_0x2d59('0x2'),'update'];function createListener(_0x584ee6,_0x1d2997){return function(_0x215ae8){_0x1d2997['emit'](_0x584ee6,_0x215ae8);};}function removeListener(_0x2e5452,_0x82ae3){return function(){VoiceQueueReportEvents[_0x2d59('0x3')](_0x2e5452,_0x82ae3);};}exports[_0x2d59('0x4')]=function(_0xc80050){for(var _0x209f0c=0x0,_0x38d58e=events[_0x2d59('0x5')];_0x209f0c<_0x38d58e;_0x209f0c++){var _0x31b09d=events[_0x209f0c];var _0xf9b664=createListener('voiceQueueReport:'+_0x31b09d,_0xc80050);VoiceQueueReportEvents['on'](_0x31b09d,_0xf9b664);}}; \ No newline at end of file +var _0xa50f=['./voiceQueueReport.events','update','emit','register','length','voiceQueueReport:'];(function(_0x4d4019,_0x550a3b){var _0x494d15=function(_0x47059c){while(--_0x47059c){_0x4d4019['push'](_0x4d4019['shift']());}};_0x494d15(++_0x550a3b);}(_0xa50f,0x7e));var _0xfa50=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa50f[_0x126558];return _0x1f6d14;};'use strict';var VoiceQueueReportEvents=require(_0xfa50('0x0'));var events=['save','remove',_0xfa50('0x1')];function createListener(_0x210e80,_0x14e94e){return function(_0x66125c){_0x14e94e[_0xfa50('0x2')](_0x210e80,_0x66125c);};}function removeListener(_0x546be7,_0x462161){return function(){VoiceQueueReportEvents['removeListener'](_0x546be7,_0x462161);};}exports[_0xfa50('0x3')]=function(_0x3a48ad){for(var _0xd0d5b9=0x0,_0x1a0dde=events[_0xfa50('0x4')];_0xd0d5b9<_0x1a0dde;_0xd0d5b9++){var _0x5d85a4=events[_0xd0d5b9];var _0x51e8c4=createListener(_0xfa50('0x5')+_0x5d85a4,_0x3a48ad);VoiceQueueReportEvents['on'](_0x5d85a4,_0x51e8c4);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0f422e5..57aface 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 _0x3646=['isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x112afe,_0x12af50){var _0x4901a0=function(_0x2a381f){while(--_0x2a381f){_0x112afe['push'](_0x112afe['shift']());}};_0x4901a0(++_0x12af50);}(_0x3646,0x15f));var _0x6364=function(_0x352930,_0x5a0e30){_0x352930=_0x352930-0x0;var _0x54e5da=_0x3646[_0x352930];return _0x54e5da;};'use strict';var multer=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var path=require(_0x6364('0x2'));var timeout=require(_0x6364('0x3'));var express=require('express');var router=express[_0x6364('0x4')]();var auth=require(_0x6364('0x5'));var interaction=require(_0x6364('0x6'));var config=require(_0x6364('0x7'));var controller=require(_0x6364('0x8'));router[_0x6364('0x9')]('/',auth[_0x6364('0xa')](),controller[_0x6364('0xb')]);router[_0x6364('0x9')](_0x6364('0xc'),auth[_0x6364('0xa')](),controller['show']);router[_0x6364('0xd')]('/',auth[_0x6364('0xa')](),controller[_0x6364('0xe')]);router[_0x6364('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6364('0x10')](_0x6364('0xc'),auth[_0x6364('0xa')](),controller[_0x6364('0x11')]);module[_0x6364('0x12')]=router; \ No newline at end of file +var _0x29b7=['/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4305d8,_0x475bc0){var _0x4247ae=function(_0x1b6f12){while(--_0x1b6f12){_0x4305d8['push'](_0x4305d8['shift']());}};_0x4247ae(++_0x475bc0);}(_0x29b7,0x17d));var _0x729b=function(_0x3c9f1c,_0x14a163){_0x3c9f1c=_0x3c9f1c-0x0;var _0x5c0a5d=_0x29b7[_0x3c9f1c];return _0x5c0a5d;};'use strict';var multer=require('multer');var util=require(_0x729b('0x0'));var path=require(_0x729b('0x1'));var timeout=require(_0x729b('0x2'));var express=require(_0x729b('0x3'));var router=express[_0x729b('0x4')]();var auth=require(_0x729b('0x5'));var interaction=require(_0x729b('0x6'));var config=require(_0x729b('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x729b('0x8')]('/',auth[_0x729b('0x9')](),controller['index']);router[_0x729b('0x8')](_0x729b('0xa'),auth[_0x729b('0x9')](),controller[_0x729b('0xb')]);router['post']('/',auth[_0x729b('0x9')](),controller[_0x729b('0xc')]);router[_0x729b('0xd')](_0x729b('0xa'),auth[_0x729b('0x9')](),controller[_0x729b('0xe')]);router['delete'](_0x729b('0xa'),auth['isAuthenticated'](),controller[_0x729b('0xf')]);module[_0x729b('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 28c0372..7c3e4bb 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 _0x24ca=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x29f150,_0x1e32b9){var _0x4861fe=function(_0x2139f6){while(--_0x2139f6){_0x29f150['push'](_0x29f150['shift']());}};_0x4861fe(++_0x1e32b9);}(_0x24ca,0x1bc));var _0xa24c=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x24ca[_0x533110];return _0xc3c866;};'use strict';var Sequelize=require(_0xa24c('0x0'));var moment=require('moment');module[_0xa24c('0x1')]={'time':{'type':Sequelize[_0xa24c('0x2')]},'callid':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa24c('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa24c('0x3')],'allowNull':![],'defaultValue':moment()[_0xa24c('0x4')](_0xa24c('0x5'))}}; \ No newline at end of file +var _0xa630=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x507b32,_0x580116){_0x507b32=_0x507b32-0x0;var _0x54d149=_0xa630[_0x507b32];return _0x54d149;};'use strict';var Sequelize=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0a63('0x3')],'allowNull':![],'defaultValue':moment()[_0x0a63('0x4')](_0x0a63('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a8a2a21..bea5792 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 _0x352e=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','destroy','end','error','stack','name','send','VoiceQueuesLog','rawAttributes','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','key','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x3e3b78,_0x287bbd){var _0x5bccdc=function(_0x587a9a){while(--_0x587a9a){_0x3e3b78['push'](_0x3e3b78['shift']());}};_0x5bccdc(++_0x287bbd);}(_0x352e,0x1a6));var _0xe352=function(_0x2ee3b4,_0x4d90e3){_0x2ee3b4=_0x2ee3b4-0x0;var _0x30b70b=_0x352e[_0x2ee3b4];return _0x30b70b;};'use strict';var pdf=require(_0xe352('0x0'));var emlformat=require(_0xe352('0x1'));var rimraf=require(_0xe352('0x2'));var zipdir=require(_0xe352('0x3'));var jsonpatch=require(_0xe352('0x4'));var rp=require(_0xe352('0x5'));var moment=require(_0xe352('0x6'));var BPromise=require(_0xe352('0x7'));var Mustache=require('mustache');var util=require(_0xe352('0x8'));var path=require(_0xe352('0x9'));var sox=require('sox');var csv=require(_0xe352('0xa'));var ejs=require(_0xe352('0xb'));var fs=require('fs');var _=require(_0xe352('0xc'));var squel=require(_0xe352('0xd'));var crypto=require('crypto');var jsforce=require(_0xe352('0xe'));var deskjs=require(_0xe352('0xf'));var toCsv=require(_0xe352('0xa'));var querystring=require(_0xe352('0x10'));var Papa=require('papaparse');var Redis=require(_0xe352('0x11'));var authService=require(_0xe352('0x12'));var qs=require(_0xe352('0x13'));var hardwareService=require(_0xe352('0x14'));var logger=require(_0xe352('0x15'))(_0xe352('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe352('0x17'))['db'];function respondWithStatusCode(_0x101208,_0x2b1695){_0x2b1695=_0x2b1695||0xcc;return function(_0x45a7cb){if(_0x45a7cb){return _0x101208[_0xe352('0x18')](_0x2b1695);}return _0x101208[_0xe352('0x19')](_0x2b1695)['end']();};}function respondWithResult(_0x368f8d,_0x2d167b){_0x2d167b=_0x2d167b||0xc8;return function(_0x56fc3f){if(_0x56fc3f){return _0x368f8d[_0xe352('0x19')](_0x2d167b)[_0xe352('0x1a')](_0x56fc3f);}};}function respondWithFilteredResult(_0x56afa0,_0x3d8c66){return function(_0x2e8845){if(_0x2e8845){var _0x1a2e52=_0x2e8845[_0xe352('0x1b')],_0x9095af=_0x3d8c66[_0xe352('0x1c')],_0xc7b5c1=_0x3d8c66['offset']+_0x3d8c66[_0xe352('0x1d')],_0xa00062;if(_0xc7b5c1>=_0x1a2e52){_0xc7b5c1=_0x1a2e52;_0xa00062=0xc8;}else{_0xa00062=0xce;}_0x56afa0['status'](_0xa00062);return _0x56afa0['set'](_0xe352('0x1e'),_0x9095af+'-'+_0xc7b5c1+'/'+_0x1a2e52)[_0xe352('0x1a')](_0x2e8845);}return null;};}function patchUpdates(_0x5b38ea){return function(_0x4bfe52){try{jsonpatch[_0xe352('0x1f')](_0x4bfe52,_0x5b38ea,!![]);}catch(_0x1bf2db){return BPromise[_0xe352('0x20')](_0x1bf2db);}return _0x4bfe52['save']();};}function saveUpdates(_0x2687c4,_0x36a427){return function(_0xa70d53){if(_0xa70d53){return _0xa70d53['update'](_0x2687c4)['then'](function(_0x5b1021){return _0x5b1021;});}return null;};}function removeEntity(_0x39961f,_0x269954){return function(_0x12490e){if(_0x12490e){return _0x12490e[_0xe352('0x21')]()['then'](function(){_0x39961f[_0xe352('0x19')](0xcc)[_0xe352('0x22')]();});}};}function handleEntityNotFound(_0xfb9641,_0x3b23ce){return function(_0x52795f){if(!_0x52795f){_0xfb9641[_0xe352('0x18')](0x194);}return _0x52795f;};}function handleError(_0x53cf17,_0x3cc4f7){_0x3cc4f7=_0x3cc4f7||0x1f4;return function(_0x55ff39){logger[_0xe352('0x23')](_0x55ff39[_0xe352('0x24')]);if(_0x55ff39[_0xe352('0x25')]){delete _0x55ff39[_0xe352('0x25')];}_0x53cf17[_0xe352('0x19')](_0x3cc4f7)[_0xe352('0x26')](_0x55ff39);};}exports['index']=function(_0x4987c0,_0x5becfb){var _0x2aa94a={},_0x55347e={},_0x37f1cf={'count':0x0,'rows':[]};var _0x168327=db[_0xe352('0x27')][_0xe352('0x28')];_0x55347e[_0xe352('0x29')]=_[_0xe352('0x2a')](_0x168327);_0x55347e[_0xe352('0x2b')]=_[_0xe352('0x2a')](_0x4987c0[_0xe352('0x2b')]);_0x55347e[_0xe352('0x2c')]=_[_0xe352('0x2d')](_0x55347e['model'],_0x55347e[_0xe352('0x2b')]);_0x2aa94a['attributes']=_['intersection'](_0x55347e[_0xe352('0x29')],qs[_0xe352('0x2e')](_0x4987c0['query']['fields']));_0x2aa94a['attributes']=_0x2aa94a['attributes'][_0xe352('0x2f')]?_0x2aa94a[_0xe352('0x30')]:_0x55347e[_0xe352('0x29')];if(!_0x4987c0[_0xe352('0x2b')][_0xe352('0x31')](_0xe352('0x32'))){_0x2aa94a['limit']=qs[_0xe352('0x1d')](_0x4987c0[_0xe352('0x2b')][_0xe352('0x1d')]);_0x2aa94a[_0xe352('0x1c')]=qs[_0xe352('0x1c')](_0x4987c0[_0xe352('0x2b')][_0xe352('0x1c')]);}_0x2aa94a[_0xe352('0x33')]=qs['sort'](_0x4987c0[_0xe352('0x2b')][_0xe352('0x34')]);_0x2aa94a['where']=qs['filters'](_[_0xe352('0x35')](_0x4987c0['query'],_0x55347e[_0xe352('0x2c')]));if(_0x4987c0[_0xe352('0x2b')][_0xe352('0x36')]){_0x2aa94a[_0xe352('0x37')]=_[_0xe352('0x38')](_0x2aa94a[_0xe352('0x37')],{'$or':_['map'](_0x168327,function(_0x3d173a){if(_0x3d173a['type'][_0xe352('0x39')]!==_0xe352('0x3a')){var _0x54513d={};_0x54513d[_0x3d173a['field']]={'$like':'%'+_0x4987c0[_0xe352('0x2b')][_0xe352('0x36')]+'%'};return _0x54513d;}})});}_0x2aa94a=_[_0xe352('0x38')]({},_0x2aa94a,_0x4987c0[_0xe352('0x3b')]);var _0x2051b3={'where':_0x2aa94a[_0xe352('0x37')]};return db['VoiceQueuesLog'][_0xe352('0x1b')](_0x2051b3)[_0xe352('0x3c')](function(_0x311fa0){_0x37f1cf[_0xe352('0x1b')]=_0x311fa0;if(_0x4987c0[_0xe352('0x2b')][_0xe352('0x3d')]){_0x2aa94a[_0xe352('0x3e')]=[{'all':!![]}];}return db[_0xe352('0x27')][_0xe352('0x3f')](_0x2aa94a);})[_0xe352('0x3c')](function(_0x368f0d){_0x37f1cf[_0xe352('0x40')]=_0x368f0d;return _0x37f1cf;})['then'](respondWithFilteredResult(_0x5becfb,_0x2aa94a))[_0xe352('0x41')](handleError(_0x5becfb,null));};exports[_0xe352('0x42')]=function(_0xcc473a,_0x370c9c){var _0x84a319={'raw':!![],'where':{'id':_0xcc473a[_0xe352('0x43')]['id']}},_0x5c34b7={};_0x5c34b7[_0xe352('0x29')]=_[_0xe352('0x2a')](db[_0xe352('0x27')][_0xe352('0x28')]);_0x5c34b7[_0xe352('0x2b')]=_['keys'](_0xcc473a[_0xe352('0x2b')]);_0x5c34b7['filters']=_[_0xe352('0x2d')](_0x5c34b7['model'],_0x5c34b7[_0xe352('0x2b')]);_0x84a319[_0xe352('0x30')]=_[_0xe352('0x2d')](_0x5c34b7['model'],qs['fields'](_0xcc473a[_0xe352('0x2b')][_0xe352('0x2e')]));_0x84a319['attributes']=_0x84a319[_0xe352('0x30')][_0xe352('0x2f')]?_0x84a319[_0xe352('0x30')]:_0x5c34b7[_0xe352('0x29')];if(_0xcc473a[_0xe352('0x2b')]['includeAll']){_0x84a319['include']=[{'all':!![]}];}_0x84a319=_[_0xe352('0x38')]({},_0x84a319,_0xcc473a[_0xe352('0x3b')]);return db[_0xe352('0x27')][_0xe352('0x44')](_0x84a319)[_0xe352('0x3c')](handleEntityNotFound(_0x370c9c,null))[_0xe352('0x3c')](respondWithResult(_0x370c9c,null))[_0xe352('0x41')](handleError(_0x370c9c,null));};exports[_0xe352('0x45')]=function(_0x121eb0,_0x59918b){return db[_0xe352('0x27')]['create'](_0x121eb0[_0xe352('0x46')],{})[_0xe352('0x3c')](respondWithResult(_0x59918b,0xc9))['catch'](handleError(_0x59918b,null));};exports[_0xe352('0x47')]=function(_0x105ec9,_0x45bc54){if(_0x105ec9[_0xe352('0x46')]['id']){delete _0x105ec9['body']['id'];}return db[_0xe352('0x27')][_0xe352('0x44')]({'where':{'id':_0x105ec9[_0xe352('0x43')]['id']}})['then'](handleEntityNotFound(_0x45bc54,null))[_0xe352('0x3c')](saveUpdates(_0x105ec9[_0xe352('0x46')],null))[_0xe352('0x3c')](respondWithResult(_0x45bc54,null))[_0xe352('0x41')](handleError(_0x45bc54,null));};exports[_0xe352('0x21')]=function(_0x31a5c9,_0x9efb84){return db[_0xe352('0x27')][_0xe352('0x44')]({'where':{'id':_0x31a5c9['params']['id']}})['then'](handleEntityNotFound(_0x9efb84,null))[_0xe352('0x3c')](removeEntity(_0x9efb84,null))[_0xe352('0x41')](handleError(_0x9efb84,null));}; \ No newline at end of file +var _0xcf3d=['status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','rawAttributes','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','rows','show','length','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x346e6b,_0x5dfcd7){var _0x59131d=function(_0x254ba5){while(--_0x254ba5){_0x346e6b['push'](_0x346e6b['shift']());}};_0x59131d(++_0x5dfcd7);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x13f402,_0x531c5e){_0x13f402=_0x13f402-0x0;var _0x269eaf=_0xcf3d[_0x13f402];return _0x269eaf;};'use strict';var pdf=require(_0xdcf3('0x0'));var emlformat=require(_0xdcf3('0x1'));var rimraf=require(_0xdcf3('0x2'));var zipdir=require(_0xdcf3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcf3('0x4'));var moment=require('moment');var BPromise=require(_0xdcf3('0x5'));var Mustache=require(_0xdcf3('0x6'));var util=require(_0xdcf3('0x7'));var path=require(_0xdcf3('0x8'));var sox=require(_0xdcf3('0x9'));var csv=require(_0xdcf3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdcf3('0xb'));var squel=require('squel');var crypto=require(_0xdcf3('0xc'));var jsforce=require(_0xdcf3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdcf3('0xe'));var Redis=require(_0xdcf3('0xf'));var authService=require(_0xdcf3('0x10'));var qs=require(_0xdcf3('0x11'));var hardwareService=require(_0xdcf3('0x12'));var logger=require(_0xdcf3('0x13'))(_0xdcf3('0x14'));var utils=require(_0xdcf3('0x15'));var config=require(_0xdcf3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47d006,_0xd1b670){_0xd1b670=_0xd1b670||0xcc;return function(_0x4b1623){if(_0x4b1623){return _0x47d006[_0xdcf3('0x17')](_0xd1b670);}return _0x47d006[_0xdcf3('0x18')](_0xd1b670)[_0xdcf3('0x19')]();};}function respondWithResult(_0xb16991,_0x5c2da7){_0x5c2da7=_0x5c2da7||0xc8;return function(_0x2d0bc2){if(_0x2d0bc2){return _0xb16991[_0xdcf3('0x18')](_0x5c2da7)['json'](_0x2d0bc2);}};}function respondWithFilteredResult(_0x32eb38,_0x4b622c){return function(_0x1b34b4){if(_0x1b34b4){var _0x2ebc69=_0x1b34b4[_0xdcf3('0x1a')],_0x1af727=_0x4b622c[_0xdcf3('0x1b')],_0x2c5436=_0x4b622c['offset']+_0x4b622c[_0xdcf3('0x1c')],_0x5d6a28;if(_0x2c5436>=_0x2ebc69){_0x2c5436=_0x2ebc69;_0x5d6a28=0xc8;}else{_0x5d6a28=0xce;}_0x32eb38[_0xdcf3('0x18')](_0x5d6a28);return _0x32eb38[_0xdcf3('0x1d')](_0xdcf3('0x1e'),_0x1af727+'-'+_0x2c5436+'/'+_0x2ebc69)[_0xdcf3('0x1f')](_0x1b34b4);}return null;};}function patchUpdates(_0x67d338){return function(_0x28844a){try{jsonpatch[_0xdcf3('0x20')](_0x28844a,_0x67d338,!![]);}catch(_0x27a958){return BPromise[_0xdcf3('0x21')](_0x27a958);}return _0x28844a[_0xdcf3('0x22')]();};}function saveUpdates(_0x4bec24,_0x5609d7){return function(_0x3a4512){if(_0x3a4512){return _0x3a4512[_0xdcf3('0x23')](_0x4bec24)['then'](function(_0x4e3e41){return _0x4e3e41;});}return null;};}function removeEntity(_0x43e082,_0x528a88){return function(_0x5622de){if(_0x5622de){return _0x5622de[_0xdcf3('0x24')]()[_0xdcf3('0x25')](function(){_0x43e082[_0xdcf3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b9f1,_0x4d340a){return function(_0x2cc3ce){if(!_0x2cc3ce){_0x40b9f1['sendStatus'](0x194);}return _0x2cc3ce;};}function handleError(_0x72c260,_0x3bfc7f){_0x3bfc7f=_0x3bfc7f||0x1f4;return function(_0x1b600a){logger[_0xdcf3('0x26')](_0x1b600a['stack']);if(_0x1b600a[_0xdcf3('0x27')]){delete _0x1b600a['name'];}_0x72c260[_0xdcf3('0x18')](_0x3bfc7f)[_0xdcf3('0x28')](_0x1b600a);};}exports[_0xdcf3('0x29')]=function(_0x4c7412,_0x53fc07){var _0x115d7f={},_0x5d9320={},_0x5c3ad7={'count':0x0,'rows':[]};var _0x47efc8=db['VoiceQueuesLog'][_0xdcf3('0x2a')];_0x5d9320['model']=_[_0xdcf3('0x2b')](_0x47efc8);_0x5d9320['query']=_[_0xdcf3('0x2b')](_0x4c7412['query']);_0x5d9320[_0xdcf3('0x2c')]=_[_0xdcf3('0x2d')](_0x5d9320[_0xdcf3('0x2e')],_0x5d9320[_0xdcf3('0x2f')]);_0x115d7f[_0xdcf3('0x30')]=_[_0xdcf3('0x2d')](_0x5d9320[_0xdcf3('0x2e')],qs[_0xdcf3('0x31')](_0x4c7412[_0xdcf3('0x2f')][_0xdcf3('0x31')]));_0x115d7f[_0xdcf3('0x30')]=_0x115d7f[_0xdcf3('0x30')]['length']?_0x115d7f[_0xdcf3('0x30')]:_0x5d9320[_0xdcf3('0x2e')];if(!_0x4c7412[_0xdcf3('0x2f')][_0xdcf3('0x32')](_0xdcf3('0x33'))){_0x115d7f[_0xdcf3('0x1c')]=qs[_0xdcf3('0x1c')](_0x4c7412[_0xdcf3('0x2f')][_0xdcf3('0x1c')]);_0x115d7f['offset']=qs[_0xdcf3('0x1b')](_0x4c7412['query'][_0xdcf3('0x1b')]);}_0x115d7f[_0xdcf3('0x34')]=qs[_0xdcf3('0x35')](_0x4c7412[_0xdcf3('0x2f')][_0xdcf3('0x35')]);_0x115d7f[_0xdcf3('0x36')]=qs['filters'](_[_0xdcf3('0x37')](_0x4c7412[_0xdcf3('0x2f')],_0x5d9320['filters']));if(_0x4c7412[_0xdcf3('0x2f')][_0xdcf3('0x38')]){_0x115d7f['where']=_[_0xdcf3('0x39')](_0x115d7f[_0xdcf3('0x36')],{'$or':_[_0xdcf3('0x3a')](_0x47efc8,function(_0x406d65){if(_0x406d65['type'][_0xdcf3('0x3b')]!==_0xdcf3('0x3c')){var _0x56b97d={};_0x56b97d[_0x406d65['field']]={'$like':'%'+_0x4c7412['query'][_0xdcf3('0x38')]+'%'};return _0x56b97d;}})});}_0x115d7f=_[_0xdcf3('0x39')]({},_0x115d7f,_0x4c7412[_0xdcf3('0x3d')]);var _0x477c61={'where':_0x115d7f[_0xdcf3('0x36')]};return db[_0xdcf3('0x3e')][_0xdcf3('0x1a')](_0x477c61)[_0xdcf3('0x25')](function(_0x259a86){_0x5c3ad7['count']=_0x259a86;if(_0x4c7412['query'][_0xdcf3('0x3f')]){_0x115d7f['include']=[{'all':!![]}];}return db[_0xdcf3('0x3e')][_0xdcf3('0x40')](_0x115d7f);})['then'](function(_0x5ba362){_0x5c3ad7[_0xdcf3('0x41')]=_0x5ba362;return _0x5c3ad7;})['then'](respondWithFilteredResult(_0x53fc07,_0x115d7f))['catch'](handleError(_0x53fc07,null));};exports[_0xdcf3('0x42')]=function(_0x5b472c,_0x318669){var _0x67b0bf={'raw':!![],'where':{'id':_0x5b472c['params']['id']}},_0x625212={};_0x625212[_0xdcf3('0x2e')]=_[_0xdcf3('0x2b')](db[_0xdcf3('0x3e')][_0xdcf3('0x2a')]);_0x625212[_0xdcf3('0x2f')]=_[_0xdcf3('0x2b')](_0x5b472c[_0xdcf3('0x2f')]);_0x625212['filters']=_[_0xdcf3('0x2d')](_0x625212[_0xdcf3('0x2e')],_0x625212[_0xdcf3('0x2f')]);_0x67b0bf['attributes']=_[_0xdcf3('0x2d')](_0x625212[_0xdcf3('0x2e')],qs['fields'](_0x5b472c[_0xdcf3('0x2f')][_0xdcf3('0x31')]));_0x67b0bf['attributes']=_0x67b0bf[_0xdcf3('0x30')][_0xdcf3('0x43')]?_0x67b0bf[_0xdcf3('0x30')]:_0x625212[_0xdcf3('0x2e')];if(_0x5b472c['query'][_0xdcf3('0x3f')]){_0x67b0bf['include']=[{'all':!![]}];}_0x67b0bf=_[_0xdcf3('0x39')]({},_0x67b0bf,_0x5b472c[_0xdcf3('0x3d')]);return db[_0xdcf3('0x3e')][_0xdcf3('0x44')](_0x67b0bf)[_0xdcf3('0x25')](handleEntityNotFound(_0x318669,null))[_0xdcf3('0x25')](respondWithResult(_0x318669,null))[_0xdcf3('0x45')](handleError(_0x318669,null));};exports[_0xdcf3('0x46')]=function(_0x4e6f44,_0x4a4bae){return db[_0xdcf3('0x3e')][_0xdcf3('0x46')](_0x4e6f44['body'],{})['then'](respondWithResult(_0x4a4bae,0xc9))[_0xdcf3('0x45')](handleError(_0x4a4bae,null));};exports[_0xdcf3('0x23')]=function(_0x162111,_0x2baefa){if(_0x162111[_0xdcf3('0x47')]['id']){delete _0x162111['body']['id'];}return db[_0xdcf3('0x3e')]['find']({'where':{'id':_0x162111['params']['id']}})[_0xdcf3('0x25')](handleEntityNotFound(_0x2baefa,null))[_0xdcf3('0x25')](saveUpdates(_0x162111[_0xdcf3('0x47')],null))[_0xdcf3('0x25')](respondWithResult(_0x2baefa,null))[_0xdcf3('0x45')](handleError(_0x2baefa,null));};exports[_0xdcf3('0x24')]=function(_0x48abd5,_0x1ebf31){return db[_0xdcf3('0x3e')][_0xdcf3('0x44')]({'where':{'id':_0x48abd5[_0xdcf3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ebf31,null))[_0xdcf3('0x25')](removeEntity(_0x1ebf31,null))[_0xdcf3('0x45')](handleError(_0x1ebf31,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e0956fd..fe9eab4 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 _0xf657=['moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xf657,0x1cb));var _0x7f65=function(_0x15382e,_0x3f5dc9){_0x15382e=_0x15382e-0x0;var _0xc6a7f3=_0xf657[_0x15382e];return _0xc6a7f3;};'use strict';var _=require(_0x7f65('0x0'));var util=require('util');var logger=require(_0x7f65('0x1'))(_0x7f65('0x2'));var moment=require(_0x7f65('0x3'));var BPromise=require(_0x7f65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f65('0x5'));var rimraf=require('rimraf');var config=require(_0x7f65('0x6'));var attributes=require(_0x7f65('0x7'));module[_0x7f65('0x8')]=function(_0x53dbdd,_0x341064){return _0x53dbdd['define'](_0x7f65('0x9'),attributes,{'tableName':_0x7f65('0xa'),'paranoid':![],'indexes':[{'name':_0x7f65('0xb'),'fields':[_0x7f65('0xc'),_0x7f65('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4347=['VoiceQueuesLog','voice_queues_log','event_dtm','event','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x204e08,_0x36ca59){var _0x4dd55e=function(_0x57a456){while(--_0x57a456){_0x204e08['push'](_0x204e08['shift']());}};_0x4dd55e(++_0x36ca59);}(_0x4347,0xe4));var _0x7434=function(_0x3af017,_0x6b7516){_0x3af017=_0x3af017-0x0;var _0x104228=_0x4347[_0x3af017];return _0x104228;};'use strict';var _=require('lodash');var util=require(_0x7434('0x0'));var logger=require(_0x7434('0x1'))(_0x7434('0x2'));var moment=require(_0x7434('0x3'));var BPromise=require(_0x7434('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7434('0x5'));var config=require(_0x7434('0x6'));var attributes=require(_0x7434('0x7'));module[_0x7434('0x8')]=function(_0x5dab9f,_0x56fd68){return _0x5dab9f[_0x7434('0x9')](_0x7434('0xa'),attributes,{'tableName':_0x7434('0xb'),'paranoid':![],'indexes':[{'name':_0x7434('0xc'),'fields':[_0x7434('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fea216d..2edb4d1 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 _0xcf3d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3053f7,_0xc27fcf){var _0x19ca9b=function(_0x5e1896){while(--_0x5e1896){_0x3053f7['push'](_0x3053f7['shift']());}};_0x19ca9b(++_0xc27fcf);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x5cf8da,_0x15f1df){_0x5cf8da=_0x5cf8da-0x0;var _0x517446=_0xcf3d[_0x5cf8da];return _0x517446;};'use strict';var _=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var moment=require(_0xdcf3('0x2'));var BPromise=require(_0xdcf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcf3('0x5'));var logger=require(_0xdcf3('0x6'))(_0xdcf3('0x7'));var config=require(_0xdcf3('0x8'));var jayson=require(_0xdcf3('0x9'));var client=jayson[_0xdcf3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f8d5,_0x47dde8,_0x2cd0af){return new BPromise(function(_0x45c5bd,_0x55fe3a){return client['request'](_0x43f8d5,_0x2cd0af)['then'](function(_0x4515a2){logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));logger[_0xdcf3('0xe')](_0xdcf3('0xf'),_0x47dde8,_0xdcf3('0xd'),JSON[_0xdcf3('0x10')](_0x4515a2));if(_0x4515a2[_0xdcf3('0x11')]){if(_0x4515a2['error'][_0xdcf3('0x12')]===0x1f4){logger[_0xdcf3('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x47dde8,_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);return _0x55fe3a(_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);}logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x4515a2[_0xdcf3('0x11')]['message']);return _0x45c5bd(_0x4515a2[_0xdcf3('0x11')]['message']);}else{logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));_0x45c5bd(_0x4515a2[_0xdcf3('0x14')]['message']);}})[_0xdcf3('0x15')](function(_0x24cce5){logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x24cce5);_0x55fe3a(_0x24cce5);});});} \ No newline at end of file +var _0xa006=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0xf50fb9,_0x1a0fc9){var _0x2d287e=function(_0x3a28f2){while(--_0x3a28f2){_0xf50fb9['push'](_0xf50fb9['shift']());}};_0x2d287e(++_0x1a0fc9);}(_0xa006,0x17a));var _0x6a00=function(_0x257f29,_0x1bbb2a){_0x257f29=_0x257f29-0x0;var _0x5919a3=_0xa006[_0x257f29];return _0x5919a3;};'use strict';var _=require(_0x6a00('0x0'));var util=require(_0x6a00('0x1'));var moment=require(_0x6a00('0x2'));var BPromise=require(_0x6a00('0x3'));var rs=require(_0x6a00('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a00('0x6'))(_0x6a00('0x7'));var config=require(_0x6a00('0x8'));var jayson=require(_0x6a00('0x9'));var client=jayson[_0x6a00('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16d45e,_0x2bba9c,_0x27939a){return new BPromise(function(_0x199af7,_0x497c08){return client[_0x6a00('0xb')](_0x16d45e,_0x27939a)[_0x6a00('0xc')](function(_0x227857){logger['info'](_0x6a00('0xd'),_0x2bba9c,_0x6a00('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2bba9c,'request\x20sent',JSON['stringify'](_0x227857));if(_0x227857[_0x6a00('0xf')]){if(_0x227857[_0x6a00('0xf')][_0x6a00('0x10')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2bba9c,_0x227857[_0x6a00('0xf')][_0x6a00('0x11')]);return _0x497c08(_0x227857[_0x6a00('0xf')][_0x6a00('0x11')]);}logger[_0x6a00('0xf')](_0x6a00('0xd'),_0x2bba9c,_0x227857[_0x6a00('0xf')][_0x6a00('0x11')]);return _0x199af7(_0x227857[_0x6a00('0xf')][_0x6a00('0x11')]);}else{logger['info'](_0x6a00('0xd'),_0x2bba9c,_0x6a00('0xe'));_0x199af7(_0x227857[_0x6a00('0x12')][_0x6a00('0x11')]);}})['catch'](function(_0x1e105e){logger[_0x6a00('0xf')](_0x6a00('0xd'),_0x2bba9c,_0x1e105e);_0x497c08(_0x1e105e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6d1ad26..2fcf5b7 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 _0x80df=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','post','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0x5a058a,_0x2efadf){var _0x3e85b0=function(_0x4021be){while(--_0x4021be){_0x5a058a['push'](_0x5a058a['shift']());}};_0x3e85b0(++_0x2efadf);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var path=require(_0xf80d('0x2'));var timeout=require(_0xf80d('0x3'));var express=require('express');var router=express[_0xf80d('0x4')]();var auth=require(_0xf80d('0x5'));var interaction=require(_0xf80d('0x6'));var config=require(_0xf80d('0x7'));var controller=require(_0xf80d('0x8'));router[_0xf80d('0x9')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xb')]);router[_0xf80d('0x9')](_0xf80d('0xc'),auth['isAuthenticated'](),controller[_0xf80d('0xd')]);router[_0xf80d('0x9')](_0xf80d('0xe'),auth[_0xf80d('0xa')](),controller[_0xf80d('0xf')]);router[_0xf80d('0x9')](_0xf80d('0x10'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x11')]);router[_0xf80d('0x9')](_0xf80d('0x12'),controller[_0xf80d('0x13')]);router[_0xf80d('0x14')]('/',auth[_0xf80d('0xa')](),controller['create']);router['put'](_0xf80d('0xe'),auth[_0xf80d('0xa')](),controller['update']);router[_0xf80d('0x15')]('/:id',auth[_0xf80d('0xa')](),controller['destroy']);module[_0xf80d('0x16')]=router; \ No newline at end of file +var _0x2121=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/download','download','downloads','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2121,0x1b4));var _0x1212=function(_0x55f4ed,_0x3eb495){_0x55f4ed=_0x55f4ed-0x0;var _0x51e5dd=_0x2121[_0x55f4ed];return _0x51e5dd;};'use strict';var multer=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1212('0x2'));var router=express[_0x1212('0x3')]();var auth=require(_0x1212('0x4'));var interaction=require(_0x1212('0x5'));var config=require(_0x1212('0x6'));var controller=require('./voiceRecording.controller');router[_0x1212('0x7')]('/',auth['isAuthenticated'](),controller[_0x1212('0x8')]);router[_0x1212('0x7')](_0x1212('0x9'),auth[_0x1212('0xa')](),controller[_0x1212('0xb')]);router[_0x1212('0x7')]('/:id',auth[_0x1212('0xa')](),controller[_0x1212('0xc')]);router[_0x1212('0x7')](_0x1212('0xd'),auth[_0x1212('0xa')](),controller[_0x1212('0xe')]);router['get']('/:id/downloads',controller[_0x1212('0xf')]);router[_0x1212('0x10')]('/',auth[_0x1212('0xa')](),controller[_0x1212('0x11')]);router['put'](_0x1212('0x12'),auth[_0x1212('0xa')](),controller[_0x1212('0x13')]);router[_0x1212('0x14')](_0x1212('0x12'),auth[_0x1212('0xa')](),controller[_0x1212('0x15')]);module[_0x1212('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 7a19e3f..c0f2458 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 _0x89b5=['value','extname','STRING','setDataValue','channel','membername','split','INTEGER','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue'];(function(_0x2d0c4f,_0x3036a2){var _0x212036=function(_0x3e39e7){while(--_0x3e39e7){_0x2d0c4f['push'](_0x2d0c4f['shift']());}};_0x212036(++_0x3036a2);}(_0x89b5,0x6c));var _0x589b=function(_0xa1795d,_0x4184d2){_0xa1795d=_0xa1795d-0x0;var _0x462779=_0x89b5[_0xa1795d];return _0x462779;};'use strict';var Sequelize=require(_0x589b('0x0'));var moment=require(_0x589b('0x1'));var path=require(_0x589b('0x2'));module[_0x589b('0x3')]={'format':{'type':Sequelize[_0x589b('0x4')],'get':function(){return this[_0x589b('0x5')](_0x589b('0x6'))?path[_0x589b('0x7')](this[_0x589b('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x589b('0x8')]},'channel':{'type':Sequelize[_0x589b('0x8')],'set':function(_0x373d83){if(_0x373d83){this[_0x589b('0x9')](_0x589b('0xa'),_0x373d83);this['setDataValue'](_0x589b('0xb'),_0x373d83[_0x589b('0xc')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x589b('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x589b('0x8')]},'connectedlinenum':{'type':Sequelize[_0x589b('0x8')]},'connectedlinename':{'type':Sequelize[_0x589b('0x8')]},'accountcode':{'type':Sequelize[_0x589b('0x8')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x589b('0x8')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x589b('0xd')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x589b('0x8')]},'userDisposition':{'type':Sequelize[_0x589b('0x8')]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x589b('0x5')]('createdAt'))[_0x589b('0xe')](_0x589b('0xf'))[_0x589b('0x10')]();}},'updatedAt':{'type':Sequelize[_0x589b('0x11')],'get':function(){return moment(this[_0x589b('0x5')](_0x589b('0x12')))[_0x589b('0xe')](_0x589b('0xf'))[_0x589b('0x10')]();}}}; \ No newline at end of file +var _0x78d4=['DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value','extname','STRING','setDataValue','membername','INTEGER'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x78d4,0x138));var _0x478d=function(_0x31c4ac,_0x153d2c){_0x31c4ac=_0x31c4ac-0x0;var _0x1e1228=_0x78d4[_0x31c4ac];return _0x1e1228;};'use strict';var Sequelize=require(_0x478d('0x0'));var moment=require(_0x478d('0x1'));var path=require(_0x478d('0x2'));module[_0x478d('0x3')]={'format':{'type':Sequelize[_0x478d('0x4')],'get':function(){return this['getDataValue'](_0x478d('0x5'))?path[_0x478d('0x6')](this['getDataValue'](_0x478d('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x478d('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x254cf2){if(_0x254cf2){this[_0x478d('0x8')]('channel',_0x254cf2);this[_0x478d('0x8')](_0x478d('0x9'),_0x254cf2['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x478d('0x7')]},'calleridnum':{'type':Sequelize[_0x478d('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x478d('0x7')]},'connectedlinename':{'type':Sequelize[_0x478d('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x478d('0x7')]},'exten':{'type':Sequelize[_0x478d('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x478d('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x478d('0x7')]},'userDisposition':{'type':Sequelize[_0x478d('0x7')]},'createdAt':{'type':Sequelize[_0x478d('0xb')],'get':function(){return moment(this[_0x478d('0xc')]('createdAt'))[_0x478d('0xd')](_0x478d('0xe'))[_0x478d('0xf')]();}},'updatedAt':{'type':Sequelize[_0x478d('0xb')],'get':function(){return moment(this[_0x478d('0xc')](_0x478d('0x10')))[_0x478d('0xd')](_0x478d('0xe'))[_0x478d('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 776cf44..b1f3904 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 _0x0e01=['set','apply','reject','save','update','then','destroy','end','error','stack','name','index','VoiceRecording','model','differenceBy','keys','format','query','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','filter','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','$and','push','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x50a74f,_0x4a4f58){var _0x522add=function(_0x4af504){while(--_0x4af504){_0x50a74f['push'](_0x50a74f['shift']());}};_0x522add(++_0x4a4f58);}(_0x0e01,0x1d0));var _0x10e0=function(_0x1146f7,_0x475356){_0x1146f7=_0x1146f7-0x0;var _0x2e5725=_0x0e01[_0x1146f7];return _0x2e5725;};'use strict';var pdf=require(_0x10e0('0x0'));var emlformat=require(_0x10e0('0x1'));var rimraf=require(_0x10e0('0x2'));var zipdir=require(_0x10e0('0x3'));var jsonpatch=require(_0x10e0('0x4'));var rp=require(_0x10e0('0x5'));var moment=require(_0x10e0('0x6'));var BPromise=require(_0x10e0('0x7'));var Mustache=require(_0x10e0('0x8'));var util=require(_0x10e0('0x9'));var path=require(_0x10e0('0xa'));var sox=require('sox');var csv=require(_0x10e0('0xb'));var ejs=require(_0x10e0('0xc'));var fs=require('fs');var _=require(_0x10e0('0xd'));var squel=require(_0x10e0('0xe'));var crypto=require(_0x10e0('0xf'));var jsforce=require(_0x10e0('0x10'));var deskjs=require(_0x10e0('0x11'));var toCsv=require(_0x10e0('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10e0('0x12'));var authService=require(_0x10e0('0x13'));var qs=require(_0x10e0('0x14'));var hardwareService=require(_0x10e0('0x15'));var logger=require('../../config/logger')(_0x10e0('0x16'));var utils=require(_0x10e0('0x17'));var config=require(_0x10e0('0x18'));var db=require(_0x10e0('0x19'))['db'];function respondWithStatusCode(_0x1e58f8,_0x36a1ca){_0x36a1ca=_0x36a1ca||0xcc;return function(_0x5a0d1a){if(_0x5a0d1a){return _0x1e58f8[_0x10e0('0x1a')](_0x36a1ca);}return _0x1e58f8[_0x10e0('0x1b')](_0x36a1ca)['end']();};}function respondWithResult(_0x5c450d,_0x271b31){_0x271b31=_0x271b31||0xc8;return function(_0x2dde66){if(_0x2dde66){return _0x5c450d[_0x10e0('0x1b')](_0x271b31)[_0x10e0('0x1c')](_0x2dde66);}};}function respondWithFilteredResult(_0x18531b,_0x530ce2){return function(_0x54c580){if(_0x54c580){var _0x2dc2e0=_0x54c580[_0x10e0('0x1d')],_0x436717=_0x530ce2['offset'],_0x3b9410=_0x530ce2[_0x10e0('0x1e')]+_0x530ce2['limit'],_0x282564;if(_0x3b9410>=_0x2dc2e0){_0x3b9410=_0x2dc2e0;_0x282564=0xc8;}else{_0x282564=0xce;}_0x18531b['status'](_0x282564);return _0x18531b[_0x10e0('0x1f')]('Content-Range',_0x436717+'-'+_0x3b9410+'/'+_0x2dc2e0)[_0x10e0('0x1c')](_0x54c580);}return null;};}function patchUpdates(_0x43e6fe){return function(_0x19ac11){try{jsonpatch[_0x10e0('0x20')](_0x19ac11,_0x43e6fe,!![]);}catch(_0x44666f){return BPromise[_0x10e0('0x21')](_0x44666f);}return _0x19ac11[_0x10e0('0x22')]();};}function saveUpdates(_0x11af49,_0x2de644){return function(_0x73fe54){if(_0x73fe54){return _0x73fe54[_0x10e0('0x23')](_0x11af49)[_0x10e0('0x24')](function(_0x1f5eda){return _0x1f5eda;});}return null;};}function removeEntity(_0x483817,_0x507b3a){return function(_0x573385){if(_0x573385){return _0x573385[_0x10e0('0x25')]()[_0x10e0('0x24')](function(){_0x483817[_0x10e0('0x1b')](0xcc)[_0x10e0('0x26')]();});}};}function handleEntityNotFound(_0x5ac6dd,_0x59fdaf){return function(_0x504fbc){if(!_0x504fbc){_0x5ac6dd['sendStatus'](0x194);}return _0x504fbc;};}function handleError(_0x273e64,_0x40fbd3){_0x40fbd3=_0x40fbd3||0x1f4;return function(_0x3e4a89){logger[_0x10e0('0x27')](_0x3e4a89[_0x10e0('0x28')]);if(_0x3e4a89[_0x10e0('0x29')]){delete _0x3e4a89[_0x10e0('0x29')];}_0x273e64[_0x10e0('0x1b')](_0x40fbd3)['send'](_0x3e4a89);};}exports[_0x10e0('0x2a')]=function(_0x3ec557,_0x28ff84){var _0x33f0f5={},_0x50e377={},_0x329da8={'count':0x0,'rows':[]};var _0x1c13fa=db[_0x10e0('0x2b')]['rawAttributes'];_0x50e377[_0x10e0('0x2c')]=_[_0x10e0('0x2d')](_[_0x10e0('0x2e')](_0x1c13fa),[_0x10e0('0x2f')]);_0x50e377[_0x10e0('0x30')]=_[_0x10e0('0x2e')](_0x3ec557[_0x10e0('0x30')]);_0x50e377['filters']=_[_0x10e0('0x31')](_0x50e377['model'],_0x50e377['query']);_0x33f0f5[_0x10e0('0x32')]=_[_0x10e0('0x31')](_0x50e377[_0x10e0('0x2c')],qs['fields'](_0x3ec557[_0x10e0('0x30')][_0x10e0('0x33')]));_0x33f0f5['attributes']=_0x33f0f5[_0x10e0('0x32')]['length']?_0x33f0f5[_0x10e0('0x32')]:_0x50e377['model'];if(!_0x3ec557[_0x10e0('0x30')]['hasOwnProperty'](_0x10e0('0x34'))){_0x33f0f5[_0x10e0('0x35')]=qs[_0x10e0('0x35')](_0x3ec557['query'][_0x10e0('0x35')]);_0x33f0f5[_0x10e0('0x1e')]=qs[_0x10e0('0x1e')](_0x3ec557[_0x10e0('0x30')]['offset']);}_0x33f0f5[_0x10e0('0x36')]=qs['sort'](_0x3ec557[_0x10e0('0x30')][_0x10e0('0x37')]);_0x33f0f5[_0x10e0('0x38')]=qs['filters'](_['pick'](_0x3ec557[_0x10e0('0x30')],_0x50e377[_0x10e0('0x39')]));if(_0x3ec557['query'][_0x10e0('0x3a')]){_0x33f0f5[_0x10e0('0x38')]=_['merge'](_0x33f0f5[_0x10e0('0x38')],{'$or':_[_0x10e0('0x3b')](_0x1c13fa,function(_0x155e86){if(_0x155e86[_0x10e0('0x3c')][_0x10e0('0x3d')]!==_0x10e0('0x3e')){var _0x209345={};_0x209345[_0x155e86['field']]={'$like':'%'+_0x3ec557['query'][_0x10e0('0x3a')]+'%'};return _0x209345;}})});}_0x33f0f5=_['merge']({},_0x33f0f5,_0x3ec557[_0x10e0('0x3f')]);var _0x12a85c={'where':_0x33f0f5[_0x10e0('0x38')]};return db[_0x10e0('0x2b')][_0x10e0('0x1d')](_0x12a85c)[_0x10e0('0x24')](function(_0x358a3f){_0x329da8[_0x10e0('0x1d')]=_0x358a3f;if(_0x3ec557[_0x10e0('0x30')][_0x10e0('0x40')]){_0x33f0f5[_0x10e0('0x41')]=[{'all':!![]}];}return db[_0x10e0('0x2b')][_0x10e0('0x42')](_0x33f0f5);})['then'](function(_0x108555){_0x329da8[_0x10e0('0x43')]=_0x108555;return _0x329da8;})[_0x10e0('0x24')](respondWithFilteredResult(_0x28ff84,_0x33f0f5))[_0x10e0('0x44')](handleError(_0x28ff84,null));};exports[_0x10e0('0x45')]=function(_0x5c510f,_0x5d2d3a){var _0x466bdf={'raw':![],'where':{'id':_0x5c510f[_0x10e0('0x46')]['id']}},_0x48bc2e={};_0x48bc2e[_0x10e0('0x2c')]=_[_0x10e0('0x2e')](db[_0x10e0('0x2b')][_0x10e0('0x47')]);_0x48bc2e[_0x10e0('0x30')]=_[_0x10e0('0x2e')](_0x5c510f[_0x10e0('0x30')]);_0x48bc2e[_0x10e0('0x39')]=_[_0x10e0('0x31')](_0x48bc2e['model'],_0x48bc2e[_0x10e0('0x30')]);_0x466bdf[_0x10e0('0x32')]=_[_0x10e0('0x31')](_0x48bc2e[_0x10e0('0x2c')],qs[_0x10e0('0x33')](_0x5c510f['query'][_0x10e0('0x33')]));_0x466bdf['attributes']=_0x466bdf['attributes'][_0x10e0('0x48')]?_0x466bdf[_0x10e0('0x32')]:_0x48bc2e[_0x10e0('0x2c')];if(_0x5c510f['query'][_0x10e0('0x40')]){_0x466bdf['include']=[{'all':!![]}];}_0x466bdf=_[_0x10e0('0x49')]({},_0x466bdf,_0x5c510f[_0x10e0('0x3f')]);return db[_0x10e0('0x2b')]['find'](_0x466bdf)[_0x10e0('0x24')](handleEntityNotFound(_0x5d2d3a,null))[_0x10e0('0x24')](respondWithResult(_0x5d2d3a,null))[_0x10e0('0x44')](handleError(_0x5d2d3a,null));};exports[_0x10e0('0x4a')]=function(_0x3cb39f,_0x11b4ad){return db['VoiceRecording'][_0x10e0('0x4a')](_0x3cb39f['body'],{})[_0x10e0('0x24')](respondWithResult(_0x11b4ad,0xc9))[_0x10e0('0x44')](handleError(_0x11b4ad,null));};exports[_0x10e0('0x23')]=function(_0xc5c9f,_0x328274){if(_0xc5c9f[_0x10e0('0x4b')]['id']){delete _0xc5c9f['body']['id'];}return db[_0x10e0('0x2b')][_0x10e0('0x4c')]({'where':{'id':_0xc5c9f[_0x10e0('0x46')]['id']}})[_0x10e0('0x24')](handleEntityNotFound(_0x328274,null))[_0x10e0('0x24')](saveUpdates(_0xc5c9f['body'],null))[_0x10e0('0x24')](respondWithResult(_0x328274,null))[_0x10e0('0x44')](handleError(_0x328274,null));};exports[_0x10e0('0x25')]=function(_0x57024d,_0x4ddd79){return db[_0x10e0('0x2b')][_0x10e0('0x4c')]({'where':{'id':_0x57024d[_0x10e0('0x46')]['id']}})[_0x10e0('0x24')](handleEntityNotFound(_0x4ddd79,null))[_0x10e0('0x24')](removeEntity(_0x4ddd79,null))[_0x10e0('0x44')](handleError(_0x4ddd79,null));};exports[_0x10e0('0x4d')]=function(_0x4cffd9,_0x5d9eda){return db[_0x10e0('0x2b')][_0x10e0('0x4d')]()[_0x10e0('0x24')](respondWithResult(_0x5d9eda,null))['catch'](handleError(_0x5d9eda,null));};exports[_0x10e0('0x4e')]=function(_0x2d456f,_0x4e4a26,_0x47f5b9){var _0x315c59=require(_0x10e0('0x4f'));var _0x1b8099=![];var _0x41c383={};if(_0x2d456f[_0x10e0('0x30')]['type']&&_0x2d456f[_0x10e0('0x30')][_0x10e0('0x3c')]===_0x10e0('0x50')){_0x41c383['uniqueid']=_0x2d456f[_0x10e0('0x46')]['id'];}else{_0x41c383['id']=_0x2d456f[_0x10e0('0x46')]['id'];}return db[_0x10e0('0x2b')][_0x10e0('0x4c')]({'where':_0x41c383,'attributes':['id',_0x10e0('0x51')],'raw':!![]})[_0x10e0('0x24')](handleEntityNotFound(_0x4e4a26,null))[_0x10e0('0x24')](function(_0x56769a){if(_0x56769a){var _0x47b70c=_0x56769a[_0x10e0('0x51')];var _0x69f8f8=util[_0x10e0('0x2f')](_0x10e0('0x52'),_0x47b70c);if(fs[_0x10e0('0x53')](_0x69f8f8)){_0x1b8099=!![];return _0x315c59[_0x10e0('0x54')](_0x69f8f8,_0x47b70c,config['secrets'][_0x10e0('0x55')])[_0x10e0('0x24')](function(){return _0x56769a;});}return _0x56769a;}})[_0x10e0('0x24')](function(_0x13b3c4){if(_0x13b3c4){var _0x1df617=_0x13b3c4[_0x10e0('0x51')];if(!fs[_0x10e0('0x53')](_0x1df617)){throw new db[(_0x10e0('0x56'))][(_0x10e0('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x13b3c4[_0x10e0('0x58')]){return _0x4e4a26[_0x10e0('0x4e')](_0x1df617,_0x13b3c4[_0x10e0('0x58')]+path['extname'](_0x1df617),function(){if(_0x1b8099){fs[_0x10e0('0x59')](_0x1df617);}});}else{return _0x4e4a26[_0x10e0('0x4e')](_0x1df617,function(_0x51cadc){if(_0x1b8099){fs['unlink'](_0x1df617);}});}}})['catch'](function(_0x489879){if(_0x489879['message']===_0x10e0('0x5a')){_0x4e4a26[_0x10e0('0x1b')](0x194)[_0x10e0('0x5b')](_0x10e0('0x5c'));}else{return handleError(_0x4e4a26,null);}});};exports[_0x10e0('0x5d')]=function(_0x57ac38,_0x441091,_0xd3a8a6){var _0x1574da=require(_0x10e0('0x4f'));var _0x19f87f=![];var _0x3bd4c1={'$and':[db['sequelize'][_0x10e0('0x38')](db[_0x10e0('0x5e')]['fn'](_0x10e0('0x5f'),db[_0x10e0('0x5e')][_0x10e0('0x60')](_0x10e0('0x50'))),_0x57ac38[_0x10e0('0x30')]['token'])]};if(_0x57ac38['query'][_0x10e0('0x3c')]&&_0x57ac38['query'][_0x10e0('0x3c')]==='uniqueid'){_0x3bd4c1[_0x10e0('0x61')]['push']({'uniqueid':_0x57ac38[_0x10e0('0x46')]['id']});}else{_0x3bd4c1[_0x10e0('0x61')][_0x10e0('0x62')]({'id':_0x57ac38['params']['id']});}return db['VoiceRecording'][_0x10e0('0x4c')]({'where':_0x3bd4c1,'attributes':['id',_0x10e0('0x51')],'raw':!![]})[_0x10e0('0x24')](handleEntityNotFound(_0x441091,null))[_0x10e0('0x24')](function(_0x5b98ed){if(_0x5b98ed){var _0x90d031=util[_0x10e0('0x2f')](_0x10e0('0x52'),_0x5b98ed[_0x10e0('0x51')]);if(fs[_0x10e0('0x53')](_0x90d031)){_0x19f87f=!![];return _0x1574da[_0x10e0('0x54')](_0x90d031,_0x5b98ed['value'],config['secrets'][_0x10e0('0x55')])[_0x10e0('0x24')](function(){return _0x5b98ed;});}return _0x5b98ed;}})[_0x10e0('0x24')](function(_0x133de4){if(_0x133de4){if(!fs[_0x10e0('0x53')](_0x133de4[_0x10e0('0x51')])){throw new db[(_0x10e0('0x56'))][(_0x10e0('0x57'))](_0x10e0('0x5a'));}if(_0x133de4['filename']){return _0x441091[_0x10e0('0x4e')](_0x133de4[_0x10e0('0x51')],_0x133de4[_0x10e0('0x58')]+path['extname'](_0x133de4[_0x10e0('0x51')]),function(){if(_0x19f87f){fs['unlink'](_0x133de4[_0x10e0('0x51')]);}});}else{return _0x441091[_0x10e0('0x4e')](_0x133de4['value'],function(_0x4e28e6){if(_0x19f87f){fs[_0x10e0('0x59')](_0x133de4[_0x10e0('0x51')]);}});}}})['catch'](handleError(_0x441091,null));}; \ No newline at end of file +var _0x5507=['findAll','rows','catch','show','params','find','create','body','describe','download','uniqueid','value','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','secrets','recording','extname','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','VoiceRecording','rawAttributes','model','keys','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','options','includeAll','include'];(function(_0x448fd7,_0x3fcefb){var _0x53a94d=function(_0x44a926){while(--_0x44a926){_0x448fd7['push'](_0x448fd7['shift']());}};_0x53a94d(++_0x3fcefb);}(_0x5507,0x1f0));var _0x7550=function(_0x4754fb,_0x47fdd1){_0x4754fb=_0x4754fb-0x0;var _0x48b29d=_0x5507[_0x4754fb];return _0x48b29d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7550('0x0'));var rimraf=require(_0x7550('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7550('0x2'));var rp=require(_0x7550('0x3'));var moment=require(_0x7550('0x4'));var BPromise=require(_0x7550('0x5'));var Mustache=require(_0x7550('0x6'));var util=require(_0x7550('0x7'));var path=require(_0x7550('0x8'));var sox=require('sox');var csv=require(_0x7550('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7550('0xa'));var squel=require(_0x7550('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7550('0x9'));var querystring=require('querystring');var Papa=require(_0x7550('0xc'));var Redis=require(_0x7550('0xd'));var authService=require(_0x7550('0xe'));var qs=require(_0x7550('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7550('0x10'));var utils=require(_0x7550('0x11'));var config=require(_0x7550('0x12'));var db=require(_0x7550('0x13'))['db'];function respondWithStatusCode(_0x44315a,_0x453509){_0x453509=_0x453509||0xcc;return function(_0xbacf35){if(_0xbacf35){return _0x44315a[_0x7550('0x14')](_0x453509);}return _0x44315a['status'](_0x453509)[_0x7550('0x15')]();};}function respondWithResult(_0x5ed2e1,_0x4b3d71){_0x4b3d71=_0x4b3d71||0xc8;return function(_0x4cdcc4){if(_0x4cdcc4){return _0x5ed2e1[_0x7550('0x16')](_0x4b3d71)[_0x7550('0x17')](_0x4cdcc4);}};}function respondWithFilteredResult(_0x211a79,_0x376dcd){return function(_0x46dcde){if(_0x46dcde){var _0x409fa1=_0x46dcde[_0x7550('0x18')],_0x3b62f6=_0x376dcd[_0x7550('0x19')],_0x2ea608=_0x376dcd[_0x7550('0x19')]+_0x376dcd[_0x7550('0x1a')],_0x4b1360;if(_0x2ea608>=_0x409fa1){_0x2ea608=_0x409fa1;_0x4b1360=0xc8;}else{_0x4b1360=0xce;}_0x211a79[_0x7550('0x16')](_0x4b1360);return _0x211a79['set'](_0x7550('0x1b'),_0x3b62f6+'-'+_0x2ea608+'/'+_0x409fa1)['json'](_0x46dcde);}return null;};}function patchUpdates(_0x18a1df){return function(_0x5bfe9f){try{jsonpatch[_0x7550('0x1c')](_0x5bfe9f,_0x18a1df,!![]);}catch(_0x69935){return BPromise[_0x7550('0x1d')](_0x69935);}return _0x5bfe9f[_0x7550('0x1e')]();};}function saveUpdates(_0x3c7f7c,_0x47e504){return function(_0x58087b){if(_0x58087b){return _0x58087b[_0x7550('0x1f')](_0x3c7f7c)[_0x7550('0x20')](function(_0x2be31b){return _0x2be31b;});}return null;};}function removeEntity(_0x1187f2,_0x253c5b){return function(_0x1466f0){if(_0x1466f0){return _0x1466f0[_0x7550('0x21')]()[_0x7550('0x20')](function(){_0x1187f2[_0x7550('0x16')](0xcc)[_0x7550('0x15')]();});}};}function handleEntityNotFound(_0x2a43ab,_0x15aa62){return function(_0x4de6ed){if(!_0x4de6ed){_0x2a43ab[_0x7550('0x14')](0x194);}return _0x4de6ed;};}function handleError(_0x3d1d27,_0xe264a2){_0xe264a2=_0xe264a2||0x1f4;return function(_0x95058b){logger[_0x7550('0x22')](_0x95058b[_0x7550('0x23')]);if(_0x95058b['name']){delete _0x95058b['name'];}_0x3d1d27[_0x7550('0x16')](_0xe264a2)[_0x7550('0x24')](_0x95058b);};}exports[_0x7550('0x25')]=function(_0x3caa69,_0x47cb41){var _0x3c18db={},_0x341f38={},_0x182fba={'count':0x0,'rows':[]};var _0x5c9df1=db[_0x7550('0x26')][_0x7550('0x27')];_0x341f38[_0x7550('0x28')]=_['differenceBy'](_[_0x7550('0x29')](_0x5c9df1),[_0x7550('0x2a')]);_0x341f38[_0x7550('0x2b')]=_[_0x7550('0x29')](_0x3caa69[_0x7550('0x2b')]);_0x341f38[_0x7550('0x2c')]=_[_0x7550('0x2d')](_0x341f38[_0x7550('0x28')],_0x341f38[_0x7550('0x2b')]);_0x3c18db['attributes']=_[_0x7550('0x2d')](_0x341f38[_0x7550('0x28')],qs[_0x7550('0x2e')](_0x3caa69[_0x7550('0x2b')]['fields']));_0x3c18db[_0x7550('0x2f')]=_0x3c18db[_0x7550('0x2f')][_0x7550('0x30')]?_0x3c18db[_0x7550('0x2f')]:_0x341f38['model'];if(!_0x3caa69['query'][_0x7550('0x31')](_0x7550('0x32'))){_0x3c18db['limit']=qs[_0x7550('0x1a')](_0x3caa69[_0x7550('0x2b')][_0x7550('0x1a')]);_0x3c18db[_0x7550('0x19')]=qs[_0x7550('0x19')](_0x3caa69[_0x7550('0x2b')][_0x7550('0x19')]);}_0x3c18db[_0x7550('0x33')]=qs[_0x7550('0x34')](_0x3caa69[_0x7550('0x2b')][_0x7550('0x34')]);_0x3c18db[_0x7550('0x35')]=qs['filters'](_['pick'](_0x3caa69[_0x7550('0x2b')],_0x341f38[_0x7550('0x2c')]));if(_0x3caa69[_0x7550('0x2b')][_0x7550('0x36')]){_0x3c18db[_0x7550('0x35')]=_[_0x7550('0x37')](_0x3c18db[_0x7550('0x35')],{'$or':_['map'](_0x5c9df1,function(_0x367d6c){if(_0x367d6c[_0x7550('0x38')][_0x7550('0x39')]!==_0x7550('0x3a')){var _0x517eec={};_0x517eec[_0x367d6c['field']]={'$like':'%'+_0x3caa69[_0x7550('0x2b')][_0x7550('0x36')]+'%'};return _0x517eec;}})});}_0x3c18db=_[_0x7550('0x37')]({},_0x3c18db,_0x3caa69[_0x7550('0x3b')]);var _0x312555={'where':_0x3c18db['where']};return db['VoiceRecording']['count'](_0x312555)[_0x7550('0x20')](function(_0x5ba1a1){_0x182fba[_0x7550('0x18')]=_0x5ba1a1;if(_0x3caa69['query'][_0x7550('0x3c')]){_0x3c18db[_0x7550('0x3d')]=[{'all':!![]}];}return db[_0x7550('0x26')][_0x7550('0x3e')](_0x3c18db);})['then'](function(_0x22cdcc){_0x182fba[_0x7550('0x3f')]=_0x22cdcc;return _0x182fba;})[_0x7550('0x20')](respondWithFilteredResult(_0x47cb41,_0x3c18db))[_0x7550('0x40')](handleError(_0x47cb41,null));};exports[_0x7550('0x41')]=function(_0xfdaea,_0x473d52){var _0x222a95={'raw':![],'where':{'id':_0xfdaea[_0x7550('0x42')]['id']}},_0x29b941={};_0x29b941[_0x7550('0x28')]=_['keys'](db[_0x7550('0x26')][_0x7550('0x27')]);_0x29b941[_0x7550('0x2b')]=_['keys'](_0xfdaea[_0x7550('0x2b')]);_0x29b941['filters']=_[_0x7550('0x2d')](_0x29b941['model'],_0x29b941[_0x7550('0x2b')]);_0x222a95[_0x7550('0x2f')]=_[_0x7550('0x2d')](_0x29b941[_0x7550('0x28')],qs[_0x7550('0x2e')](_0xfdaea[_0x7550('0x2b')]['fields']));_0x222a95[_0x7550('0x2f')]=_0x222a95['attributes'][_0x7550('0x30')]?_0x222a95[_0x7550('0x2f')]:_0x29b941[_0x7550('0x28')];if(_0xfdaea[_0x7550('0x2b')][_0x7550('0x3c')]){_0x222a95[_0x7550('0x3d')]=[{'all':!![]}];}_0x222a95=_[_0x7550('0x37')]({},_0x222a95,_0xfdaea[_0x7550('0x3b')]);return db['VoiceRecording'][_0x7550('0x43')](_0x222a95)[_0x7550('0x20')](handleEntityNotFound(_0x473d52,null))['then'](respondWithResult(_0x473d52,null))[_0x7550('0x40')](handleError(_0x473d52,null));};exports['create']=function(_0xa6a0cc,_0x2b5462){return db[_0x7550('0x26')][_0x7550('0x44')](_0xa6a0cc['body'],{})[_0x7550('0x20')](respondWithResult(_0x2b5462,0xc9))[_0x7550('0x40')](handleError(_0x2b5462,null));};exports[_0x7550('0x1f')]=function(_0x3f2772,_0x236dc6){if(_0x3f2772[_0x7550('0x45')]['id']){delete _0x3f2772['body']['id'];}return db[_0x7550('0x26')][_0x7550('0x43')]({'where':{'id':_0x3f2772[_0x7550('0x42')]['id']}})[_0x7550('0x20')](handleEntityNotFound(_0x236dc6,null))[_0x7550('0x20')](saveUpdates(_0x3f2772[_0x7550('0x45')],null))[_0x7550('0x20')](respondWithResult(_0x236dc6,null))[_0x7550('0x40')](handleError(_0x236dc6,null));};exports['destroy']=function(_0x53a12e,_0x991591){return db[_0x7550('0x26')][_0x7550('0x43')]({'where':{'id':_0x53a12e[_0x7550('0x42')]['id']}})[_0x7550('0x20')](handleEntityNotFound(_0x991591,null))[_0x7550('0x20')](removeEntity(_0x991591,null))['catch'](handleError(_0x991591,null));};exports[_0x7550('0x46')]=function(_0x1c95e5,_0x16419e){return db[_0x7550('0x26')][_0x7550('0x46')]()[_0x7550('0x20')](respondWithResult(_0x16419e,null))[_0x7550('0x40')](handleError(_0x16419e,null));};exports[_0x7550('0x47')]=function(_0x2ddc3e,_0x37dfee,_0x2ac229){var _0x453001=require('../../components/encryptor');var _0x1de779=![];var _0x2cdf82={};if(_0x2ddc3e['query']['type']&&_0x2ddc3e[_0x7550('0x2b')][_0x7550('0x38')]===_0x7550('0x48')){_0x2cdf82[_0x7550('0x48')]=_0x2ddc3e[_0x7550('0x42')]['id'];}else{_0x2cdf82['id']=_0x2ddc3e['params']['id'];}return db['VoiceRecording'][_0x7550('0x43')]({'where':_0x2cdf82,'attributes':['id',_0x7550('0x49')],'raw':!![]})[_0x7550('0x20')](handleEntityNotFound(_0x37dfee,null))[_0x7550('0x20')](function(_0x2ed793){if(_0x2ed793){var _0x32d456=_0x2ed793[_0x7550('0x49')];var _0x53990c=util['format']('%s.cypher',_0x32d456);if(fs[_0x7550('0x4a')](_0x53990c)){_0x1de779=!![];return _0x453001[_0x7550('0x4b')](_0x53990c,_0x32d456,config['secrets']['recording'])[_0x7550('0x20')](function(){return _0x2ed793;});}return _0x2ed793;}})[_0x7550('0x20')](function(_0x3c0e9a){if(_0x3c0e9a){var _0x968b5d=_0x3c0e9a[_0x7550('0x49')];if(!fs[_0x7550('0x4a')](_0x968b5d)){throw new db[(_0x7550('0x4c'))][(_0x7550('0x4d'))](_0x7550('0x4e'));}if(_0x3c0e9a[_0x7550('0x4f')]){return _0x37dfee[_0x7550('0x47')](_0x968b5d,_0x3c0e9a[_0x7550('0x4f')]+path['extname'](_0x968b5d),function(){if(_0x1de779){fs['unlink'](_0x968b5d);}});}else{return _0x37dfee[_0x7550('0x47')](_0x968b5d,function(_0x212b16){if(_0x1de779){fs['unlink'](_0x968b5d);}});}}})[_0x7550('0x40')](function(_0x4e60ac){if(_0x4e60ac[_0x7550('0x50')]===_0x7550('0x4e')){_0x37dfee['status'](0x194)[_0x7550('0x24')](_0x7550('0x51'));}else{return handleError(_0x37dfee,null);}});};exports[_0x7550('0x52')]=function(_0x35ff10,_0x505cb3,_0x2eaba5){var _0x321862=require('../../components/encryptor');var _0x4297d8=![];var _0x62e300={'$and':[db[_0x7550('0x53')]['where'](db[_0x7550('0x53')]['fn'](_0x7550('0x54'),db['sequelize'][_0x7550('0x55')]('uniqueid')),_0x35ff10['query'][_0x7550('0x56')])]};if(_0x35ff10[_0x7550('0x2b')]['type']&&_0x35ff10[_0x7550('0x2b')]['type']===_0x7550('0x48')){_0x62e300[_0x7550('0x57')][_0x7550('0x58')]({'uniqueid':_0x35ff10[_0x7550('0x42')]['id']});}else{_0x62e300['$and']['push']({'id':_0x35ff10[_0x7550('0x42')]['id']});}return db[_0x7550('0x26')]['find']({'where':_0x62e300,'attributes':['id','value'],'raw':!![]})[_0x7550('0x20')](handleEntityNotFound(_0x505cb3,null))[_0x7550('0x20')](function(_0x359f17){if(_0x359f17){var _0x8e83cc=util[_0x7550('0x2a')](_0x7550('0x59'),_0x359f17['value']);if(fs[_0x7550('0x4a')](_0x8e83cc)){_0x4297d8=!![];return _0x321862[_0x7550('0x4b')](_0x8e83cc,_0x359f17[_0x7550('0x49')],config[_0x7550('0x5a')][_0x7550('0x5b')])[_0x7550('0x20')](function(){return _0x359f17;});}return _0x359f17;}})[_0x7550('0x20')](function(_0x2efcc1){if(_0x2efcc1){if(!fs[_0x7550('0x4a')](_0x2efcc1[_0x7550('0x49')])){throw new db['Sequelize'][(_0x7550('0x4d'))](_0x7550('0x4e'));}if(_0x2efcc1[_0x7550('0x4f')]){return _0x505cb3[_0x7550('0x47')](_0x2efcc1['value'],_0x2efcc1[_0x7550('0x4f')]+path[_0x7550('0x5c')](_0x2efcc1[_0x7550('0x49')]),function(){if(_0x4297d8){fs['unlink'](_0x2efcc1[_0x7550('0x49')]);}});}else{return _0x505cb3[_0x7550('0x47')](_0x2efcc1['value'],function(_0x20daa4){if(_0x4297d8){fs['unlink'](_0x2efcc1[_0x7550('0x49')]);}});}}})['catch'](handleError(_0x505cb3,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 28b6be2..7af86ff 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 _0xf1ba=['../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','api','bluebird','path'];(function(_0x3aca12,_0x2cac0a){var _0x17d149=function(_0x4720b9){while(--_0x4720b9){_0x3aca12['push'](_0x3aca12['shift']());}};_0x17d149(++_0x2cac0a);}(_0xf1ba,0x138));var _0xaf1b=function(_0x382b2a,_0x4a1f37){_0x382b2a=_0x382b2a-0x0;var _0xf390f5=_0xf1ba[_0x382b2a];return _0xf390f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaf1b('0x0'));var moment=require('moment');var BPromise=require(_0xaf1b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf1b('0x2'));var rimraf=require('rimraf');var config=require(_0xaf1b('0x3'));var attributes=require(_0xaf1b('0x4'));module[_0xaf1b('0x5')]=function(_0x246a6f,_0x3e9295){return _0x246a6f[_0xaf1b('0x6')]('VoiceRecording',attributes,{'tableName':_0xaf1b('0x7'),'paranoid':![],'indexes':[{'name':_0xaf1b('0x8'),'fields':[_0xaf1b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa021=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash'];(function(_0x46c4e7,_0x4f0fc0){var _0xd5f852=function(_0x447c87){while(--_0x447c87){_0x46c4e7['push'](_0x46c4e7['shift']());}};_0xd5f852(++_0x4f0fc0);}(_0xa021,0x1bb));var _0x1a02=function(_0x24f08d,_0x19ae14){_0x24f08d=_0x24f08d-0x0;var _0x1233ed=_0xa021[_0x24f08d];return _0x1233ed;};'use strict';var _=require(_0x1a02('0x0'));var util=require('util');var logger=require(_0x1a02('0x1'))('api');var moment=require(_0x1a02('0x2'));var BPromise=require(_0x1a02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a02('0x4'));var rimraf=require(_0x1a02('0x5'));var config=require(_0x1a02('0x6'));var attributes=require(_0x1a02('0x7'));module[_0x1a02('0x8')]=function(_0x5ebd31,_0x139097){return _0x5ebd31[_0x1a02('0x9')]('VoiceRecording',attributes,{'tableName':_0x1a02('0xa'),'paranoid':![],'indexes':[{'name':_0x1a02('0xb'),'fields':[_0x1a02('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 28e5867..e6a0066 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 _0xd883=['raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceRecording','update','options'];(function(_0x5f4d21,_0x44fd89){var _0x515405=function(_0x5189fa){while(--_0x5189fa){_0x5f4d21['push'](_0x5f4d21['shift']());}};_0x515405(++_0x44fd89);}(_0xd883,0x1e1));var _0x3d88=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd883[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0x3d88('0x0'));var moment=require(_0x3d88('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d88('0x2'));var fs=require('fs');var Redis=require(_0x3d88('0x3'));var db=require(_0x3d88('0x4'))['db'];var utils=require(_0x3d88('0x5'));var logger=require('../../config/logger')(_0x3d88('0x6'));var config=require(_0x3d88('0x7'));var jayson=require(_0x3d88('0x8'));var client=jayson['client'][_0x3d88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x128b54,_0x3e7c8a,_0x5d2190){return new BPromise(function(_0xe114e8,_0x1a184c){return client[_0x3d88('0xa')](_0x128b54,_0x5d2190)[_0x3d88('0xb')](function(_0x29fda3){logger[_0x3d88('0xc')](_0x3d88('0xd'),_0x3e7c8a,_0x3d88('0xe'));logger[_0x3d88('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3e7c8a,'request\x20sent',JSON[_0x3d88('0x10')](_0x29fda3));if(_0x29fda3[_0x3d88('0x11')]){if(_0x29fda3['error'][_0x3d88('0x12')]===0x1f4){logger[_0x3d88('0x11')](_0x3d88('0xd'),_0x3e7c8a,_0x29fda3[_0x3d88('0x11')]['message']);return _0x1a184c(_0x29fda3[_0x3d88('0x11')][_0x3d88('0x13')]);}logger['error'](_0x3d88('0xd'),_0x3e7c8a,_0x29fda3[_0x3d88('0x11')][_0x3d88('0x13')]);return _0xe114e8(_0x29fda3[_0x3d88('0x11')][_0x3d88('0x13')]);}else{logger[_0x3d88('0xc')](_0x3d88('0xd'),_0x3e7c8a,_0x3d88('0xe'));_0xe114e8(_0x29fda3[_0x3d88('0x14')][_0x3d88('0x13')]);}})[_0x3d88('0x15')](function(_0x5d5ded){logger['error'](_0x3d88('0xd'),_0x3e7c8a,_0x5d5ded);_0x1a184c(_0x5d5ded);});});}exports['UpdateVoiceRecording']=function(_0x3ce7d8){var _0x21ba00=this;return new Promise(function(_0x29c7d4,_0x2620a4){return db[_0x3d88('0x16')][_0x3d88('0x17')](_0x3ce7d8['body'],{'raw':_0x3ce7d8[_0x3d88('0x18')]?_0x3ce7d8[_0x3d88('0x18')][_0x3d88('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ce7d8['options']?_0x3ce7d8['options'][_0x3d88('0x1a')]||null:null,'attributes':_0x3ce7d8[_0x3d88('0x18')]?_0x3ce7d8[_0x3d88('0x18')][_0x3d88('0x1b')]||null:null,'limit':_0x3ce7d8[_0x3d88('0x18')]?_0x3ce7d8['options'][_0x3d88('0x1c')]||null:null})[_0x3d88('0xb')](function(_0x3f7aa){logger[_0x3d88('0xc')](_0x3d88('0x1d'),_0x3ce7d8);logger[_0x3d88('0xf')]('UpdateVoiceRecording',_0x3ce7d8,JSON[_0x3d88('0x10')](_0x3f7aa));_0x29c7d4(_0x3f7aa);})[_0x3d88('0x15')](function(_0x1c037f){logger['error'](_0x3d88('0x1d'),_0x1c037f[_0x3d88('0x13')],_0x3ce7d8);_0x2620a4(_0x21ba00['error'](0x1f4,_0x1c037f[_0x3d88('0x13')]));});});};exports[_0x3d88('0x1e')]=function(_0x2cbe3b){var _0x500733=this;return new Promise(function(_0x55d485,_0x169908){var _0x3591de=require(_0x3d88('0x1f'));var _0x4eab49;return db[_0x3d88('0x20')][_0x3d88('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x3d88('0xb')](function(_0x3dfee4){_0x4eab49=_0x3dfee4;return db['VoiceRecording'][_0x3d88('0x22')](_0x2cbe3b[_0x3d88('0x23')]);})[_0x3d88('0xb')](function(_0x5b6f51){if(_0x4eab49[_0x3d88('0x24')]&&fs[_0x3d88('0x25')](_0x5b6f51['value'])){var _0x26cf6c=util[_0x3d88('0x26')](_0x3d88('0x27'),_0x5b6f51[_0x3d88('0x28')]);return _0x3591de[_0x3d88('0x29')](_0x5b6f51[_0x3d88('0x28')],_0x26cf6c,config[_0x3d88('0x2a')][_0x3d88('0x2b')])['then'](function(){fs[_0x3d88('0x2c')](_0x5b6f51[_0x3d88('0x28')]);logger[_0x3d88('0xc')](_0x3d88('0x2d'));return _0x5b6f51;});}return _0x5b6f51;})[_0x3d88('0xb')](function(_0x3f4dad){logger[_0x3d88('0xc')](_0x3d88('0x1e'),_0x2cbe3b);logger[_0x3d88('0xf')](_0x3d88('0x1e'),_0x2cbe3b,JSON['stringify'](_0x3f4dad));_0x55d485(_0x3f4dad);})[_0x3d88('0x15')](function(_0x459faf){logger[_0x3d88('0x11')]('CreateVoiceRecording',_0x459faf[_0x3d88('0x13')],_0x2cbe3b);_0x169908(_0x500733[_0x3d88('0x11')](0x1f4,_0x459faf[_0x3d88('0x13')]));});});}; \ No newline at end of file +var _0xcb50=['randomstring','ioredis','../../config/logger','../../config/environment','client','request','then','request\x20sent','debug','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','VoiceRecording','update','body','options','raw','where','attributes','limit','info','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','unlink','CreateVoiceRecording\x20file\x20encrypted','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb50,0x92));var _0x0cb5=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xcb50[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x0cb5('0x0'));var util=require(_0x0cb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0cb5('0x2'));var fs=require('fs');var Redis=require(_0x0cb5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cb5('0x4'))('rpc');var config=require(_0x0cb5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0cb5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c74d,_0x5a5443,_0x4f2468){return new BPromise(function(_0x3f8a44,_0x1d0443){return client[_0x0cb5('0x7')](_0x55c74d,_0x4f2468)[_0x0cb5('0x8')](function(_0x44d852){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5a5443,_0x0cb5('0x9'));logger[_0x0cb5('0xa')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5a5443,'request\x20sent',JSON[_0x0cb5('0xb')](_0x44d852));if(_0x44d852[_0x0cb5('0xc')]){if(_0x44d852[_0x0cb5('0xc')]['code']===0x1f4){logger[_0x0cb5('0xc')](_0x0cb5('0xd'),_0x5a5443,_0x44d852[_0x0cb5('0xc')][_0x0cb5('0xe')]);return _0x1d0443(_0x44d852[_0x0cb5('0xc')]['message']);}logger[_0x0cb5('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x5a5443,_0x44d852[_0x0cb5('0xc')][_0x0cb5('0xe')]);return _0x3f8a44(_0x44d852[_0x0cb5('0xc')][_0x0cb5('0xe')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5a5443,'request\x20sent');_0x3f8a44(_0x44d852[_0x0cb5('0xf')][_0x0cb5('0xe')]);}})['catch'](function(_0x4f2e51){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5a5443,_0x4f2e51);_0x1d0443(_0x4f2e51);});});}exports['UpdateVoiceRecording']=function(_0x7be4c0){var _0x4446bc=this;return new Promise(function(_0x22c9ba,_0x5aa38d){return db[_0x0cb5('0x10')][_0x0cb5('0x11')](_0x7be4c0[_0x0cb5('0x12')],{'raw':_0x7be4c0[_0x0cb5('0x13')]?_0x7be4c0[_0x0cb5('0x13')][_0x0cb5('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7be4c0[_0x0cb5('0x13')]?_0x7be4c0[_0x0cb5('0x13')][_0x0cb5('0x15')]||null:null,'attributes':_0x7be4c0[_0x0cb5('0x13')]?_0x7be4c0['options'][_0x0cb5('0x16')]||null:null,'limit':_0x7be4c0[_0x0cb5('0x13')]?_0x7be4c0['options'][_0x0cb5('0x17')]||null:null})['then'](function(_0x905b3d){logger[_0x0cb5('0x18')](_0x0cb5('0x19'),_0x7be4c0);logger[_0x0cb5('0xa')](_0x0cb5('0x19'),_0x7be4c0,JSON['stringify'](_0x905b3d));_0x22c9ba(_0x905b3d);})['catch'](function(_0x16313b){logger[_0x0cb5('0xc')](_0x0cb5('0x19'),_0x16313b[_0x0cb5('0xe')],_0x7be4c0);_0x5aa38d(_0x4446bc['error'](0x1f4,_0x16313b[_0x0cb5('0xe')]));});});};exports[_0x0cb5('0x1a')]=function(_0x37b5bc){var _0x5e7f41=this;return new Promise(function(_0x2bef3e,_0x533543){var _0x559d16=require(_0x0cb5('0x1b'));var _0x4ebb1f;return db[_0x0cb5('0x1c')][_0x0cb5('0x1d')]({'attributes':['id',_0x0cb5('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0cb5('0x8')](function(_0x1ea751){_0x4ebb1f=_0x1ea751;return db[_0x0cb5('0x10')][_0x0cb5('0x1f')](_0x37b5bc[_0x0cb5('0x12')]);})[_0x0cb5('0x8')](function(_0x36515e){if(_0x4ebb1f[_0x0cb5('0x1e')]&&fs[_0x0cb5('0x20')](_0x36515e[_0x0cb5('0x21')])){var _0x4d8ab0=util['format']('%s.cypher',_0x36515e['value']);return _0x559d16['encryptFile'](_0x36515e['value'],_0x4d8ab0,config['secrets']['recording'])[_0x0cb5('0x8')](function(){fs[_0x0cb5('0x22')](_0x36515e['value']);logger[_0x0cb5('0x18')](_0x0cb5('0x23'));return _0x36515e;});}return _0x36515e;})[_0x0cb5('0x8')](function(_0x151397){logger[_0x0cb5('0x18')]('CreateVoiceRecording',_0x37b5bc);logger[_0x0cb5('0xa')](_0x0cb5('0x1a'),_0x37b5bc,JSON['stringify'](_0x151397));_0x2bef3e(_0x151397);})[_0x0cb5('0x24')](function(_0x319c08){logger[_0x0cb5('0xc')]('CreateVoiceRecording',_0x319c08[_0x0cb5('0xe')],_0x37b5bc);_0x533543(_0x5e7f41[_0x0cb5('0xc')](0x1f4,_0x319c08[_0x0cb5('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 5fe65ae..d59a131 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 _0x3efd=['put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','show','post','isAuthenticated','create'];(function(_0x24736e,_0x56ef07){var _0x5b6a23=function(_0x53e308){while(--_0x53e308){_0x24736e['push'](_0x24736e['shift']());}};_0x5b6a23(++_0x56ef07);}(_0x3efd,0x132));var _0xd3ef=function(_0x566352,_0x4a936d){_0x566352=_0x566352-0x0;var _0x2a8c38=_0x3efd[_0x566352];return _0x2a8c38;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd3ef('0x0'));var timeout=require(_0xd3ef('0x1'));var express=require(_0xd3ef('0x2'));var router=express[_0xd3ef('0x3')]();var auth=require(_0xd3ef('0x4'));var interaction=require(_0xd3ef('0x5'));var config=require(_0xd3ef('0x6'));var controller=require(_0xd3ef('0x7'));router[_0xd3ef('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3ef('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd3ef('0xa')]);router[_0xd3ef('0xb')]('/',auth[_0xd3ef('0xc')](),controller[_0xd3ef('0xd')]);router[_0xd3ef('0xe')](_0xd3ef('0xf'),auth[_0xd3ef('0xc')](),controller[_0xd3ef('0x10')]);router[_0xd3ef('0x11')](_0xd3ef('0xf'),auth[_0xd3ef('0xc')](),controller[_0xd3ef('0x12')]);module[_0xd3ef('0x13')]=router; \ No newline at end of file +var _0x7e98=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x567293,_0x2ee95){var _0x4c8f9d=function(_0x2477f5){while(--_0x2477f5){_0x567293['push'](_0x567293['shift']());}};_0x4c8f9d(++_0x2ee95);}(_0x7e98,0x1eb));var _0x87e9=function(_0x526997,_0x5905ed){_0x526997=_0x526997-0x0;var _0x1bebdb=_0x7e98[_0x526997];return _0x1bebdb;};'use strict';var multer=require(_0x87e9('0x0'));var util=require(_0x87e9('0x1'));var path=require(_0x87e9('0x2'));var timeout=require(_0x87e9('0x3'));var express=require('express');var router=express[_0x87e9('0x4')]();var auth=require(_0x87e9('0x5'));var interaction=require(_0x87e9('0x6'));var config=require(_0x87e9('0x7'));var controller=require(_0x87e9('0x8'));router[_0x87e9('0x9')]('/',auth[_0x87e9('0xa')](),controller['index']);router[_0x87e9('0x9')](_0x87e9('0xb'),auth['isAuthenticated'](),controller[_0x87e9('0xc')]);router[_0x87e9('0xd')]('/',auth[_0x87e9('0xa')](),controller['create']);router[_0x87e9('0xe')](_0x87e9('0xb'),auth[_0x87e9('0xa')](),controller[_0x87e9('0xf')]);router[_0x87e9('0x10')](_0x87e9('0xb'),auth[_0x87e9('0xa')](),controller[_0x87e9('0x11')]);module[_0x87e9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 272bfa6..195ec0d 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 _0xb63d=['STRING','moment','exports','ENUM','blind','attended'];(function(_0x32613c,_0x3762a1){var _0x908fe9=function(_0x11e197){while(--_0x11e197){_0x32613c['push'](_0x32613c['shift']());}};_0x908fe9(++_0x3762a1);}(_0xb63d,0x16f));var _0xdb63=function(_0x1872bb,_0x1e09d0){_0x1872bb=_0x1872bb-0x0;var _0x2d7cb8=_0xb63d[_0x1872bb];return _0x2d7cb8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdb63('0x0'));module[_0xdb63('0x1')]={'type':{'type':Sequelize[_0xdb63('0x2')](_0xdb63('0x3'),_0xdb63('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xdb63('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdb63('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdb63('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdb63('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xdb63('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xdb63('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xdb63('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xdb63('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xdb63('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xdb63('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xdb63('0x5')]},'transfereecontext':{'type':Sequelize[_0xdb63('0x5')]},'transfereeexten':{'type':Sequelize[_0xdb63('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xdb63('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xdb63('0x5')]},'extension':{'type':Sequelize[_0xdb63('0x5')]}}; \ No newline at end of file +var _0xf183=['exports','ENUM','blind','STRING','Yes','sequelize','moment'];(function(_0x420858,_0x49e074){var _0x57bbad=function(_0x4c984b){while(--_0x4c984b){_0x420858['push'](_0x420858['shift']());}};_0x57bbad(++_0x49e074);}(_0xf183,0xa6));var _0x3f18=function(_0x2c879b,_0x20d6e1){_0x2c879b=_0x2c879b-0x0;var _0x23cf8d=_0xf183[_0x2c879b];return _0x23cf8d;};'use strict';var Sequelize=require(_0x3f18('0x0'));var moment=require(_0x3f18('0x1'));module[_0x3f18('0x2')]={'type':{'type':Sequelize[_0x3f18('0x3')](_0x3f18('0x4'),'attended')},'result':{'type':Sequelize[_0x3f18('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x3f18('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x3f18('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x3f18('0x5')]},'transferercontext':{'type':Sequelize[_0x3f18('0x5')]},'transfererexten':{'type':Sequelize[_0x3f18('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x3f18('0x5')]},'transfereechannel':{'type':Sequelize[_0x3f18('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3f18('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3f18('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3f18('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x3f18('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x3f18('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x3f18('0x5')]},'isexternal':{'type':Sequelize[_0x3f18('0x3')](_0x3f18('0x6'),'No')},'context':{'type':Sequelize[_0x3f18('0x5')]},'extension':{'type':Sequelize[_0x3f18('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8bfac4f..2894eff 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 _0xb246=['moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','error','name','send','VoiceTransferReport','rawAttributes','model','keys','filters','query','attributes','fields','nolimit','order','sort','where','filter','merge','map','key','VIRTUAL','field','options','include','findAll','then','rows','show','params','intersection','length','includeAll','find','catch','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1906ea,_0x4d7df8){var _0x4fc847=function(_0xdcf841){while(--_0xdcf841){_0x1906ea['push'](_0x1906ea['shift']());}};_0x4fc847(++_0x4d7df8);}(_0xb246,0x11c));var _0x6b24=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0xb246[_0x1433df];return _0x49fade;};'use strict';var pdf=require(_0x6b24('0x0'));var emlformat=require(_0x6b24('0x1'));var rimraf=require(_0x6b24('0x2'));var zipdir=require(_0x6b24('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b24('0x4'));var BPromise=require(_0x6b24('0x5'));var Mustache=require(_0x6b24('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6b24('0x7'));var csv=require(_0x6b24('0x8'));var ejs=require(_0x6b24('0x9'));var fs=require('fs');var _=require(_0x6b24('0xa'));var squel=require(_0x6b24('0xb'));var crypto=require(_0x6b24('0xc'));var jsforce=require(_0x6b24('0xd'));var deskjs=require(_0x6b24('0xe'));var toCsv=require(_0x6b24('0x8'));var querystring=require('querystring');var Papa=require(_0x6b24('0xf'));var Redis=require(_0x6b24('0x10'));var authService=require(_0x6b24('0x11'));var qs=require(_0x6b24('0x12'));var hardwareService=require(_0x6b24('0x13'));var logger=require(_0x6b24('0x14'))('api');var utils=require(_0x6b24('0x15'));var config=require(_0x6b24('0x16'));var db=require(_0x6b24('0x17'))['db'];function respondWithStatusCode(_0x1ad5a2,_0x1c004a){_0x1c004a=_0x1c004a||0xcc;return function(_0x279e1c){if(_0x279e1c){return _0x1ad5a2['sendStatus'](_0x1c004a);}return _0x1ad5a2[_0x6b24('0x18')](_0x1c004a)[_0x6b24('0x19')]();};}function respondWithResult(_0x14dcfd,_0x536ab7){_0x536ab7=_0x536ab7||0xc8;return function(_0xf5de46){if(_0xf5de46){return _0x14dcfd['status'](_0x536ab7)[_0x6b24('0x1a')](_0xf5de46);}};}function respondWithFilteredResult(_0x969f7a,_0x1e01da){return function(_0x56e9c5){if(_0x56e9c5){var _0x4bba5b=_0x56e9c5[_0x6b24('0x1b')],_0x1c78cb=_0x1e01da[_0x6b24('0x1c')],_0x1f3b95=_0x1e01da[_0x6b24('0x1c')]+_0x1e01da[_0x6b24('0x1d')],_0x35167b;if(_0x1f3b95>=_0x4bba5b){_0x1f3b95=_0x4bba5b;_0x35167b=0xc8;}else{_0x35167b=0xce;}_0x969f7a['status'](_0x35167b);return _0x969f7a[_0x6b24('0x1e')](_0x6b24('0x1f'),_0x1c78cb+'-'+_0x1f3b95+'/'+_0x4bba5b)[_0x6b24('0x1a')](_0x56e9c5);}return null;};}function patchUpdates(_0x1c8e4e){return function(_0x264444){try{jsonpatch[_0x6b24('0x20')](_0x264444,_0x1c8e4e,!![]);}catch(_0x3a230c){return BPromise[_0x6b24('0x21')](_0x3a230c);}return _0x264444[_0x6b24('0x22')]();};}function saveUpdates(_0x35d954,_0xf19129){return function(_0x3640e6){if(_0x3640e6){return _0x3640e6['update'](_0x35d954)['then'](function(_0x131ba0){return _0x131ba0;});}return null;};}function removeEntity(_0x1cce77,_0x3b4721){return function(_0x140895){if(_0x140895){return _0x140895['destroy']()['then'](function(){_0x1cce77['status'](0xcc)[_0x6b24('0x19')]();});}};}function handleEntityNotFound(_0x422001,_0x36ae3a){return function(_0x108e1b){if(!_0x108e1b){_0x422001['sendStatus'](0x194);}return _0x108e1b;};}function handleError(_0x4e2dc2,_0x41c451){_0x41c451=_0x41c451||0x1f4;return function(_0xa3bb79){logger[_0x6b24('0x23')](_0xa3bb79['stack']);if(_0xa3bb79[_0x6b24('0x24')]){delete _0xa3bb79[_0x6b24('0x24')];}_0x4e2dc2[_0x6b24('0x18')](_0x41c451)[_0x6b24('0x25')](_0xa3bb79);};}exports['index']=function(_0x15bad4,_0x42ba63){var _0x55d3c8={},_0xd8871a={},_0x3a1d5e={'count':0x0,'rows':[]};var _0x58c816=db[_0x6b24('0x26')][_0x6b24('0x27')];_0xd8871a[_0x6b24('0x28')]=_['keys'](_0x58c816);_0xd8871a['query']=_[_0x6b24('0x29')](_0x15bad4['query']);_0xd8871a[_0x6b24('0x2a')]=_['intersection'](_0xd8871a[_0x6b24('0x28')],_0xd8871a[_0x6b24('0x2b')]);_0x55d3c8[_0x6b24('0x2c')]=_['intersection'](_0xd8871a[_0x6b24('0x28')],qs[_0x6b24('0x2d')](_0x15bad4[_0x6b24('0x2b')][_0x6b24('0x2d')]));_0x55d3c8['attributes']=_0x55d3c8[_0x6b24('0x2c')]['length']?_0x55d3c8[_0x6b24('0x2c')]:_0xd8871a[_0x6b24('0x28')];if(!_0x15bad4['query']['hasOwnProperty'](_0x6b24('0x2e'))){_0x55d3c8[_0x6b24('0x1d')]=qs[_0x6b24('0x1d')](_0x15bad4['query'][_0x6b24('0x1d')]);_0x55d3c8['offset']=qs[_0x6b24('0x1c')](_0x15bad4[_0x6b24('0x2b')][_0x6b24('0x1c')]);}_0x55d3c8[_0x6b24('0x2f')]=qs[_0x6b24('0x30')](_0x15bad4[_0x6b24('0x2b')]['sort']);_0x55d3c8[_0x6b24('0x31')]=qs[_0x6b24('0x2a')](_['pick'](_0x15bad4[_0x6b24('0x2b')],_0xd8871a[_0x6b24('0x2a')]));if(_0x15bad4[_0x6b24('0x2b')][_0x6b24('0x32')]){_0x55d3c8[_0x6b24('0x31')]=_[_0x6b24('0x33')](_0x55d3c8['where'],{'$or':_[_0x6b24('0x34')](_0x58c816,function(_0x4e2ef4){if(_0x4e2ef4['type'][_0x6b24('0x35')]!==_0x6b24('0x36')){var _0x4a0878={};_0x4a0878[_0x4e2ef4[_0x6b24('0x37')]]={'$like':'%'+_0x15bad4[_0x6b24('0x2b')][_0x6b24('0x32')]+'%'};return _0x4a0878;}})});}_0x55d3c8=_[_0x6b24('0x33')]({},_0x55d3c8,_0x15bad4[_0x6b24('0x38')]);var _0x431115={'where':_0x55d3c8[_0x6b24('0x31')]};return db[_0x6b24('0x26')][_0x6b24('0x1b')](_0x431115)['then'](function(_0x3eb732){_0x3a1d5e[_0x6b24('0x1b')]=_0x3eb732;if(_0x15bad4[_0x6b24('0x2b')]['includeAll']){_0x55d3c8[_0x6b24('0x39')]=[{'all':!![]}];}return db[_0x6b24('0x26')][_0x6b24('0x3a')](_0x55d3c8);})[_0x6b24('0x3b')](function(_0xc460c6){_0x3a1d5e[_0x6b24('0x3c')]=_0xc460c6;return _0x3a1d5e;})[_0x6b24('0x3b')](respondWithFilteredResult(_0x42ba63,_0x55d3c8))['catch'](handleError(_0x42ba63,null));};exports[_0x6b24('0x3d')]=function(_0x18d390,_0x2d8127){var _0x21778b={'raw':!![],'where':{'id':_0x18d390[_0x6b24('0x3e')]['id']}},_0xbf3d12={};_0xbf3d12[_0x6b24('0x28')]=_[_0x6b24('0x29')](db[_0x6b24('0x26')][_0x6b24('0x27')]);_0xbf3d12['query']=_[_0x6b24('0x29')](_0x18d390['query']);_0xbf3d12[_0x6b24('0x2a')]=_[_0x6b24('0x3f')](_0xbf3d12[_0x6b24('0x28')],_0xbf3d12['query']);_0x21778b[_0x6b24('0x2c')]=_[_0x6b24('0x3f')](_0xbf3d12['model'],qs[_0x6b24('0x2d')](_0x18d390['query'][_0x6b24('0x2d')]));_0x21778b[_0x6b24('0x2c')]=_0x21778b[_0x6b24('0x2c')][_0x6b24('0x40')]?_0x21778b[_0x6b24('0x2c')]:_0xbf3d12[_0x6b24('0x28')];if(_0x18d390[_0x6b24('0x2b')][_0x6b24('0x41')]){_0x21778b['include']=[{'all':!![]}];}_0x21778b=_[_0x6b24('0x33')]({},_0x21778b,_0x18d390[_0x6b24('0x38')]);return db[_0x6b24('0x26')][_0x6b24('0x42')](_0x21778b)[_0x6b24('0x3b')](handleEntityNotFound(_0x2d8127,null))[_0x6b24('0x3b')](respondWithResult(_0x2d8127,null))[_0x6b24('0x43')](handleError(_0x2d8127,null));};exports[_0x6b24('0x44')]=function(_0x501e01,_0x3dc0c1){return db[_0x6b24('0x26')][_0x6b24('0x44')](_0x501e01[_0x6b24('0x45')],{})[_0x6b24('0x3b')](respondWithResult(_0x3dc0c1,0xc9))['catch'](handleError(_0x3dc0c1,null));};exports[_0x6b24('0x46')]=function(_0x315498,_0x4c5e20){if(_0x315498[_0x6b24('0x45')]['id']){delete _0x315498[_0x6b24('0x45')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x315498[_0x6b24('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4c5e20,null))[_0x6b24('0x3b')](saveUpdates(_0x315498[_0x6b24('0x45')],null))[_0x6b24('0x3b')](respondWithResult(_0x4c5e20,null))[_0x6b24('0x43')](handleError(_0x4c5e20,null));};exports[_0x6b24('0x47')]=function(_0x4dda1a,_0x2de181){return db[_0x6b24('0x26')]['find']({'where':{'id':_0x4dda1a[_0x6b24('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2de181,null))[_0x6b24('0x3b')](removeEntity(_0x2de181,null))[_0x6b24('0x43')](handleError(_0x2de181,null));}; \ No newline at end of file +var _0x4c76=['order','sort','where','pick','filter','merge','type','VIRTUAL','field','options','then','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','sendStatus','stack','send','VoiceTransferReport','rawAttributes','model','keys','filters','query','attributes','fields','hasOwnProperty','nolimit'];(function(_0x32509b,_0xcffd0b){var _0x5be917=function(_0x2901ff){while(--_0x2901ff){_0x32509b['push'](_0x32509b['shift']());}};_0x5be917(++_0xcffd0b);}(_0x4c76,0xa4));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x64c7('0x0'));var emlformat=require(_0x64c7('0x1'));var rimraf=require(_0x64c7('0x2'));var zipdir=require(_0x64c7('0x3'));var jsonpatch=require(_0x64c7('0x4'));var rp=require(_0x64c7('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x64c7('0x6'));var util=require('util');var path=require(_0x64c7('0x7'));var sox=require(_0x64c7('0x8'));var csv=require(_0x64c7('0x9'));var ejs=require(_0x64c7('0xa'));var fs=require('fs');var _=require(_0x64c7('0xb'));var squel=require(_0x64c7('0xc'));var crypto=require(_0x64c7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x64c7('0xe'));var toCsv=require(_0x64c7('0x9'));var querystring=require(_0x64c7('0xf'));var Papa=require(_0x64c7('0x10'));var Redis=require(_0x64c7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x64c7('0x12'));var hardwareService=require(_0x64c7('0x13'));var logger=require('../../config/logger')(_0x64c7('0x14'));var utils=require(_0x64c7('0x15'));var config=require('../../config/environment');var db=require(_0x64c7('0x16'))['db'];function respondWithStatusCode(_0x32e102,_0x1500a3){_0x1500a3=_0x1500a3||0xcc;return function(_0x4b88ce){if(_0x4b88ce){return _0x32e102['sendStatus'](_0x1500a3);}return _0x32e102[_0x64c7('0x17')](_0x1500a3)[_0x64c7('0x18')]();};}function respondWithResult(_0x424253,_0xd82153){_0xd82153=_0xd82153||0xc8;return function(_0x4052c5){if(_0x4052c5){return _0x424253[_0x64c7('0x17')](_0xd82153)[_0x64c7('0x19')](_0x4052c5);}};}function respondWithFilteredResult(_0x3a9875,_0x2ec226){return function(_0x10c156){if(_0x10c156){var _0x367533=_0x10c156[_0x64c7('0x1a')],_0x4f3e49=_0x2ec226[_0x64c7('0x1b')],_0x171064=_0x2ec226['offset']+_0x2ec226[_0x64c7('0x1c')],_0x50c65f;if(_0x171064>=_0x367533){_0x171064=_0x367533;_0x50c65f=0xc8;}else{_0x50c65f=0xce;}_0x3a9875[_0x64c7('0x17')](_0x50c65f);return _0x3a9875[_0x64c7('0x1d')]('Content-Range',_0x4f3e49+'-'+_0x171064+'/'+_0x367533)['json'](_0x10c156);}return null;};}function patchUpdates(_0x162499){return function(_0x1297eb){try{jsonpatch['apply'](_0x1297eb,_0x162499,!![]);}catch(_0x495603){return BPromise[_0x64c7('0x1e')](_0x495603);}return _0x1297eb[_0x64c7('0x1f')]();};}function saveUpdates(_0x1ac483,_0x5665a8){return function(_0x2786e8){if(_0x2786e8){return _0x2786e8[_0x64c7('0x20')](_0x1ac483)['then'](function(_0xe9a956){return _0xe9a956;});}return null;};}function removeEntity(_0x3f7928,_0x2a7272){return function(_0x23da64){if(_0x23da64){return _0x23da64['destroy']()['then'](function(){_0x3f7928[_0x64c7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58d213,_0x4589f2){return function(_0x175b37){if(!_0x175b37){_0x58d213[_0x64c7('0x21')](0x194);}return _0x175b37;};}function handleError(_0x1651dd,_0x80fab3){_0x80fab3=_0x80fab3||0x1f4;return function(_0x567174){logger['error'](_0x567174[_0x64c7('0x22')]);if(_0x567174['name']){delete _0x567174['name'];}_0x1651dd['status'](_0x80fab3)[_0x64c7('0x23')](_0x567174);};}exports['index']=function(_0x73cfa5,_0x20c5f8){var _0xb70775={},_0x221797={},_0x46c02f={'count':0x0,'rows':[]};var _0x514f30=db[_0x64c7('0x24')][_0x64c7('0x25')];_0x221797[_0x64c7('0x26')]=_[_0x64c7('0x27')](_0x514f30);_0x221797['query']=_[_0x64c7('0x27')](_0x73cfa5['query']);_0x221797[_0x64c7('0x28')]=_['intersection'](_0x221797[_0x64c7('0x26')],_0x221797[_0x64c7('0x29')]);_0xb70775[_0x64c7('0x2a')]=_['intersection'](_0x221797[_0x64c7('0x26')],qs[_0x64c7('0x2b')](_0x73cfa5[_0x64c7('0x29')][_0x64c7('0x2b')]));_0xb70775[_0x64c7('0x2a')]=_0xb70775[_0x64c7('0x2a')]['length']?_0xb70775['attributes']:_0x221797[_0x64c7('0x26')];if(!_0x73cfa5[_0x64c7('0x29')][_0x64c7('0x2c')](_0x64c7('0x2d'))){_0xb70775[_0x64c7('0x1c')]=qs[_0x64c7('0x1c')](_0x73cfa5['query'][_0x64c7('0x1c')]);_0xb70775[_0x64c7('0x1b')]=qs['offset'](_0x73cfa5[_0x64c7('0x29')][_0x64c7('0x1b')]);}_0xb70775[_0x64c7('0x2e')]=qs[_0x64c7('0x2f')](_0x73cfa5[_0x64c7('0x29')][_0x64c7('0x2f')]);_0xb70775[_0x64c7('0x30')]=qs[_0x64c7('0x28')](_[_0x64c7('0x31')](_0x73cfa5[_0x64c7('0x29')],_0x221797[_0x64c7('0x28')]));if(_0x73cfa5[_0x64c7('0x29')][_0x64c7('0x32')]){_0xb70775['where']=_[_0x64c7('0x33')](_0xb70775[_0x64c7('0x30')],{'$or':_['map'](_0x514f30,function(_0x289d86){if(_0x289d86[_0x64c7('0x34')]['key']!==_0x64c7('0x35')){var _0x1bbb06={};_0x1bbb06[_0x289d86[_0x64c7('0x36')]]={'$like':'%'+_0x73cfa5['query'][_0x64c7('0x32')]+'%'};return _0x1bbb06;}})});}_0xb70775=_['merge']({},_0xb70775,_0x73cfa5[_0x64c7('0x37')]);var _0x5056ed={'where':_0xb70775[_0x64c7('0x30')]};return db[_0x64c7('0x24')][_0x64c7('0x1a')](_0x5056ed)[_0x64c7('0x38')](function(_0x972a36){_0x46c02f[_0x64c7('0x1a')]=_0x972a36;if(_0x73cfa5['query'][_0x64c7('0x39')]){_0xb70775[_0x64c7('0x3a')]=[{'all':!![]}];}return db[_0x64c7('0x24')][_0x64c7('0x3b')](_0xb70775);})[_0x64c7('0x38')](function(_0x4cae90){_0x46c02f[_0x64c7('0x3c')]=_0x4cae90;return _0x46c02f;})['then'](respondWithFilteredResult(_0x20c5f8,_0xb70775))['catch'](handleError(_0x20c5f8,null));};exports[_0x64c7('0x3d')]=function(_0x332165,_0x3e7727){var _0x15d782={'raw':!![],'where':{'id':_0x332165[_0x64c7('0x3e')]['id']}},_0x45f1f6={};_0x45f1f6[_0x64c7('0x26')]=_['keys'](db[_0x64c7('0x24')]['rawAttributes']);_0x45f1f6[_0x64c7('0x29')]=_['keys'](_0x332165[_0x64c7('0x29')]);_0x45f1f6['filters']=_['intersection'](_0x45f1f6[_0x64c7('0x26')],_0x45f1f6['query']);_0x15d782['attributes']=_[_0x64c7('0x3f')](_0x45f1f6[_0x64c7('0x26')],qs[_0x64c7('0x2b')](_0x332165[_0x64c7('0x29')][_0x64c7('0x2b')]));_0x15d782[_0x64c7('0x2a')]=_0x15d782[_0x64c7('0x2a')][_0x64c7('0x40')]?_0x15d782[_0x64c7('0x2a')]:_0x45f1f6[_0x64c7('0x26')];if(_0x332165[_0x64c7('0x29')]['includeAll']){_0x15d782[_0x64c7('0x3a')]=[{'all':!![]}];}_0x15d782=_[_0x64c7('0x33')]({},_0x15d782,_0x332165[_0x64c7('0x37')]);return db['VoiceTransferReport'][_0x64c7('0x41')](_0x15d782)[_0x64c7('0x38')](handleEntityNotFound(_0x3e7727,null))[_0x64c7('0x38')](respondWithResult(_0x3e7727,null))[_0x64c7('0x42')](handleError(_0x3e7727,null));};exports['create']=function(_0x243348,_0x461dfd){return db[_0x64c7('0x24')][_0x64c7('0x43')](_0x243348['body'],{})[_0x64c7('0x38')](respondWithResult(_0x461dfd,0xc9))[_0x64c7('0x42')](handleError(_0x461dfd,null));};exports['update']=function(_0x7da878,_0x28d156){if(_0x7da878[_0x64c7('0x44')]['id']){delete _0x7da878[_0x64c7('0x44')]['id'];}return db['VoiceTransferReport'][_0x64c7('0x41')]({'where':{'id':_0x7da878[_0x64c7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28d156,null))[_0x64c7('0x38')](saveUpdates(_0x7da878['body'],null))[_0x64c7('0x38')](respondWithResult(_0x28d156,null))[_0x64c7('0x42')](handleError(_0x28d156,null));};exports[_0x64c7('0x45')]=function(_0x27da17,_0x3019dc){return db[_0x64c7('0x24')][_0x64c7('0x41')]({'where':{'id':_0x27da17['params']['id']}})[_0x64c7('0x38')](handleEntityNotFound(_0x3019dc,null))[_0x64c7('0x38')](removeEntity(_0x3019dc,null))[_0x64c7('0x42')](handleError(_0x3019dc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f779185..f680e11 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 _0x55d6=['define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x55d6,0x155));var _0x655d=function(_0x170571,_0x3eda7a){_0x170571=_0x170571-0x0;var _0xc20d35=_0x55d6[_0x170571];return _0xc20d35;};'use strict';var _=require(_0x655d('0x0'));var util=require(_0x655d('0x1'));var logger=require('../../config/logger')(_0x655d('0x2'));var moment=require(_0x655d('0x3'));var BPromise=require(_0x655d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x655d('0x5'));var rimraf=require(_0x655d('0x6'));var config=require(_0x655d('0x7'));var attributes=require(_0x655d('0x8'));module[_0x655d('0x9')]=function(_0x2ac004,_0xfd651d){return _0x2ac004[_0x655d('0xa')](_0x655d('0xb'),attributes,{'tableName':_0x655d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b53=['bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api'];(function(_0x460da6,_0x2ba7bd){var _0x445808=function(_0x338dcc){while(--_0x338dcc){_0x460da6['push'](_0x460da6['shift']());}};_0x445808(++_0x2ba7bd);}(_0x6b53,0x105));var _0x36b5=function(_0x40271c,_0x3f60f9){_0x40271c=_0x40271c-0x0;var _0xdcb1e1=_0x6b53[_0x40271c];return _0xdcb1e1;};'use strict';var _=require('lodash');var util=require(_0x36b5('0x0'));var logger=require(_0x36b5('0x1'))(_0x36b5('0x2'));var moment=require('moment');var BPromise=require(_0x36b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36b5('0x4'));var rimraf=require(_0x36b5('0x5'));var config=require(_0x36b5('0x6'));var attributes=require(_0x36b5('0x7'));module[_0x36b5('0x8')]=function(_0x5f5647,_0x383983){return _0x5f5647[_0x36b5('0x9')](_0x36b5('0xa'),attributes,{'tableName':_0x36b5('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 dbba385..310edef 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 _0x7492=['rpc','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','create','body','options','raw','then','CreateVoiceTransferReport','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x21595e,_0x554025){var _0x13a181=function(_0x4e1603){while(--_0x4e1603){_0x21595e['push'](_0x21595e['shift']());}};_0x13a181(++_0x554025);}(_0x7492,0x69));var _0x2749=function(_0x11e1aa,_0x52cfbf){_0x11e1aa=_0x11e1aa-0x0;var _0x43091c=_0x7492[_0x11e1aa];return _0x43091c;};'use strict';var _=require(_0x2749('0x0'));var util=require(_0x2749('0x1'));var moment=require(_0x2749('0x2'));var BPromise=require(_0x2749('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2749('0x4'));var db=require(_0x2749('0x5'))['db'];var utils=require(_0x2749('0x6'));var logger=require('../../config/logger')(_0x2749('0x7'));var config=require('../../config/environment');var jayson=require(_0x2749('0x8'));var client=jayson[_0x2749('0x9')][_0x2749('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33b004,_0x3ecac2,_0x551c4b){return new BPromise(function(_0x70e01c,_0xf61dfc){return client[_0x2749('0xb')](_0x33b004,_0x551c4b)['then'](function(_0x39a0f5){logger[_0x2749('0xc')](_0x2749('0xd'),_0x3ecac2,_0x2749('0xe'));logger[_0x2749('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3ecac2,_0x2749('0xe'),JSON['stringify'](_0x39a0f5));if(_0x39a0f5[_0x2749('0x10')]){if(_0x39a0f5[_0x2749('0x10')][_0x2749('0x11')]===0x1f4){logger[_0x2749('0x10')](_0x2749('0xd'),_0x3ecac2,_0x39a0f5[_0x2749('0x10')]['message']);return _0xf61dfc(_0x39a0f5['error'][_0x2749('0x12')]);}logger['error'](_0x2749('0xd'),_0x3ecac2,_0x39a0f5[_0x2749('0x10')][_0x2749('0x12')]);return _0x70e01c(_0x39a0f5[_0x2749('0x10')][_0x2749('0x12')]);}else{logger[_0x2749('0xc')](_0x2749('0xd'),_0x3ecac2,_0x2749('0xe'));_0x70e01c(_0x39a0f5[_0x2749('0x13')]['message']);}})['catch'](function(_0x3934c7){logger[_0x2749('0x10')](_0x2749('0xd'),_0x3ecac2,_0x3934c7);_0xf61dfc(_0x3934c7);});});}exports['CreateVoiceTransferReport']=function(_0x344064){var _0x3282fe=this;return new Promise(function(_0xf9baa3,_0x3b135a){return db['VoiceTransferReport'][_0x2749('0x14')](_0x344064[_0x2749('0x15')],{'raw':_0x344064['options']?_0x344064[_0x2749('0x16')][_0x2749('0x17')]===undefined?!![]:![]:!![]})[_0x2749('0x18')](function(_0x2867cf){logger['info']('CreateVoiceTransferReport',_0x344064);logger[_0x2749('0xf')](_0x2749('0x19'),_0x344064,JSON[_0x2749('0x1a')](_0x2867cf));_0xf9baa3(_0x2867cf);})[_0x2749('0x1b')](function(_0x1b67b1){logger[_0x2749('0x10')]('CreateVoiceTransferReport',_0x1b67b1[_0x2749('0x12')],_0x344064);_0x3b135a(_0x3282fe[_0x2749('0x10')](0x1f4,_0x1b67b1[_0x2749('0x12')]));});});}; \ No newline at end of file +var _0x3336=['create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateVoiceTransferReport','VoiceTransferReport'];(function(_0x310da2,_0x181858){var _0x12bc21=function(_0x559fe7){while(--_0x559fe7){_0x310da2['push'](_0x310da2['shift']());}};_0x12bc21(++_0x181858);}(_0x3336,0x1a8));var _0x6333=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x3336[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0x6333('0x0'));var util=require(_0x6333('0x1'));var moment=require(_0x6333('0x2'));var BPromise=require(_0x6333('0x3'));var rs=require(_0x6333('0x4'));var fs=require('fs');var Redis=require(_0x6333('0x5'));var db=require(_0x6333('0x6'))['db'];var utils=require(_0x6333('0x7'));var logger=require('../../config/logger')(_0x6333('0x8'));var config=require(_0x6333('0x9'));var jayson=require(_0x6333('0xa'));var client=jayson[_0x6333('0xb')][_0x6333('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36b586,_0x142452,_0x5963e2){return new BPromise(function(_0x322fdd,_0x5d0d62){return client[_0x6333('0xd')](_0x36b586,_0x5963e2)[_0x6333('0xe')](function(_0x56eeed){logger[_0x6333('0xf')](_0x6333('0x10'),_0x142452,'request\x20sent');logger[_0x6333('0x11')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x142452,'request\x20sent',JSON[_0x6333('0x12')](_0x56eeed));if(_0x56eeed[_0x6333('0x13')]){if(_0x56eeed[_0x6333('0x13')][_0x6333('0x14')]===0x1f4){logger[_0x6333('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x142452,_0x56eeed[_0x6333('0x13')][_0x6333('0x15')]);return _0x5d0d62(_0x56eeed[_0x6333('0x13')][_0x6333('0x15')]);}logger['error'](_0x6333('0x10'),_0x142452,_0x56eeed[_0x6333('0x13')][_0x6333('0x15')]);return _0x322fdd(_0x56eeed[_0x6333('0x13')][_0x6333('0x15')]);}else{logger['info'](_0x6333('0x10'),_0x142452,_0x6333('0x16'));_0x322fdd(_0x56eeed[_0x6333('0x17')][_0x6333('0x15')]);}})['catch'](function(_0x534197){logger[_0x6333('0x13')](_0x6333('0x10'),_0x142452,_0x534197);_0x5d0d62(_0x534197);});});}exports[_0x6333('0x18')]=function(_0x274171){var _0x300772=this;return new Promise(function(_0x2300aa,_0x410f4b){return db[_0x6333('0x19')][_0x6333('0x1a')](_0x274171[_0x6333('0x1b')],{'raw':_0x274171[_0x6333('0x1c')]?_0x274171[_0x6333('0x1c')][_0x6333('0x1d')]===undefined?!![]:![]:!![]})[_0x6333('0xe')](function(_0x4e7cec){logger[_0x6333('0xf')](_0x6333('0x18'),_0x274171);logger[_0x6333('0x11')](_0x6333('0x18'),_0x274171,JSON[_0x6333('0x12')](_0x4e7cec));_0x2300aa(_0x4e7cec);})['catch'](function(_0x142b66){logger['error'](_0x6333('0x18'),_0x142b66[_0x6333('0x15')],_0x274171);_0x410f4b(_0x300772[_0x6333('0x13')](0x1f4,_0x142b66[_0x6333('0x15')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8e828ad..159b6b3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd23=['exit','lodash','./config/environment','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0xf9b2a1,_0x35e1bd){var _0x496004=function(_0x2b79d1){while(--_0x2b79d1){_0xf9b2a1['push'](_0xf9b2a1['shift']());}};_0x496004(++_0x35e1bd);}(_0xbd23,0x105));var _0x3bd2=function(_0x36885f,_0x347f43){_0x36885f=_0x36885f-0x0;var _0x16d81a=_0xbd23[_0x36885f];return _0x16d81a;};'use strict';var _=require(_0x3bd2('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0x3bd2('0x1'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0x3bd2('0x2'));var schedule=require(_0x3bd2('0x3'));var chat=require(_0x3bd2('0x4'));function main(){return mysqldb['db'][_0x3bd2('0x5')][_0x3bd2('0x6')]()[_0x3bd2('0x7')](function(){return rpc[_0x3bd2('0x8')]();})['then'](function(_0x10b6ce){logger[_0x3bd2('0x9')](_0x10b6ce);return chat['start']();})[_0x3bd2('0x7')](function(){return schedule[_0x3bd2('0xa')]();})[_0x3bd2('0x7')](function(_0x12c352){logger['info'](_0x12c352);return pm2[_0x3bd2('0xa')](pm2Config);})[_0x3bd2('0x7')](function(_0x4e9f60){logger[_0x3bd2('0x9')](_0x3bd2('0xb'),_[_0x3bd2('0xc')](_[_0x3bd2('0xd')](_0x4e9f60,{'status':_0x3bd2('0xe')}),_0x3bd2('0xf'))[_0x3bd2('0x10')]());logger[_0x3bd2('0x9')](_0x3bd2('0x11'),_['map'](_[_0x3bd2('0xd')](_0x4e9f60,function(_0x3c06b2){return _0x3c06b2[_0x3bd2('0x12')]!==_0x3bd2('0xe');}),'name')[_0x3bd2('0x10')]()||_0x3bd2('0x13'));config[_0x3bd2('0x14')]&&require('./config/seedDB')[_0x3bd2('0x15')]();require(_0x3bd2('0x16'))[_0x3bd2('0x15')]();})[_0x3bd2('0x17')](function(_0x268578){logger['error'](_0x3bd2('0x18'),_0x268578);process[_0x3bd2('0x19')](0x1);});}main(); \ No newline at end of file +var _0xddab=['Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','listen','then','info','start','Online\x20apps:','map','online','name','join'];(function(_0x576e92,_0x165314){var _0x24c32e=function(_0x1648b1){while(--_0x1648b1){_0x576e92['push'](_0x576e92['shift']());}};_0x24c32e(++_0x165314);}(_0xddab,0x1e5));var _0xbdda=function(_0x1a2925,_0x1797f1){_0x1a2925=_0x1a2925-0x0;var _0x49b9f7=_0xddab[_0x1a2925];return _0x49b9f7;};'use strict';var _=require(_0xbdda('0x0'));var mysqldb=require(_0xbdda('0x1'));var rpc=require(_0xbdda('0x2'));var config=require('./config/environment');var logger=require('./config/logger')(_0xbdda('0x3'));var pm2=require(_0xbdda('0x4'));var pm2Config=require(_0xbdda('0x5'));var schedule=require(_0xbdda('0x6'));var chat=require(_0xbdda('0x7'));function main(){return mysqldb['db'][_0xbdda('0x8')][_0xbdda('0x9')]()['then'](function(){return rpc[_0xbdda('0xa')]();})[_0xbdda('0xb')](function(_0x1c2ab1){logger[_0xbdda('0xc')](_0x1c2ab1);return chat[_0xbdda('0xd')]();})[_0xbdda('0xb')](function(){return schedule['start']();})[_0xbdda('0xb')](function(_0x599831){logger[_0xbdda('0xc')](_0x599831);return pm2[_0xbdda('0xd')](pm2Config);})[_0xbdda('0xb')](function(_0x109ffc){logger['info'](_0xbdda('0xe'),_[_0xbdda('0xf')](_['filter'](_0x109ffc,{'status':_0xbdda('0x10')}),_0xbdda('0x11'))[_0xbdda('0x12')]());logger[_0xbdda('0xc')](_0xbdda('0x13'),_['map'](_['filter'](_0x109ffc,function(_0x3ef869){return _0x3ef869[_0xbdda('0x14')]!==_0xbdda('0x10');}),_0xbdda('0x11'))[_0xbdda('0x12')]()||_0xbdda('0x15'));config[_0xbdda('0x16')]&&require(_0xbdda('0x17'))[_0xbdda('0x18')]();require(_0xbdda('0x19'))[_0xbdda('0x18')]();})['catch'](function(_0x136ecf){logger['error'](_0xbdda('0x1a'),_0x136ecf);process[_0xbdda('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a5c2f7c..dddacc2 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 _0xe838=['query','apikey','verify','session','getUuid','User','sub','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','log','Unrecognized\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','isAuthenticated','getLicense','Forbidden','canUpdate','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','pick','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','randomBytes','toString','hex','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','HS512','../../mysqldb','../../config/environment','lodash','express-jwt','composable-middleware','crypto','ipaddr.js','secrets','role','fullname','name','internal','email','chatPause','smsPause','pauseType','phoneBarRemoteControlPort','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','then','status','disposition','unmanaged','json','authorization','startsWith','Basic','find','authenticate','Wrong\x20credentials.','catch','headers','Bearer','Unknown\x20authorization\x20format'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0xe838,0x119));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var db=require(_0x8e83('0x0'))['db'];var config=require(_0x8e83('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0x8e83('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x8e83('0x3'));var compose=require(_0x8e83('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0x8e83('0x5'));var ipaddr=require(_0x8e83('0x6'));var validateJwt=expressJwt({'secret':config[_0x8e83('0x7')]['session']});var userAttributes=['id',_0x8e83('0x8'),_0x8e83('0x9'),_0x8e83('0xa'),_0x8e83('0xb'),_0x8e83('0xc'),'userpic','permissions','voicePause',_0x8e83('0xd'),'mailPause','faxPause',_0x8e83('0xe'),'openchannelPause',_0x8e83('0xf'),'showWebBar',_0x8e83('0x10'),'phoneBarRemoteControl','interface','userProfileId'];exports[_0x8e83('0x11')]=function(){return isAuthenticated(!![])[_0x8e83('0x12')](function(_0x13394c,_0x4288d7,_0x1cfb0d){if(_0x13394c[_0x8e83('0x13')]){_0x1cfb0d();}else{return db[_0x8e83('0x14')][_0x8e83('0x15')]({'where':{'id':_0x13394c[_0x8e83('0x16')]['id']},'attributes':['id',_0x8e83('0x17'),'disposition'],'raw':!![]})[_0x8e83('0x18')](function(_0xaa2c60){if(_0xaa2c60&&_0xaa2c60[_0x8e83('0x17')]){return _0x4288d7[_0x8e83('0x19')](_0xaa2c60[_0x8e83('0x1a')]===_0x8e83('0x1b')?0x195:0x193)[_0x8e83('0x1c')]({'message':_0xaa2c60['disposition']===_0x8e83('0x1b')?'Unmanaged.':'Forbidden.'});}else{_0x1cfb0d();}})['catch'](function(_0x155393){_0x1cfb0d(_0x155393);});}});};function isAuthenticated(_0x5c8dae){return compose()[_0x8e83('0x12')](function(_0xb6d675,_0x3cf733,_0x47ce10){if(_0xb6d675['headers'][_0x8e83('0x1d')]){if(_[_0x8e83('0x1e')](_0xb6d675['headers'][_0x8e83('0x1d')],_0x8e83('0x1f'))){var _0x121cd2=basicAuth(_0xb6d675);db['User'][_0x8e83('0x20')]({'where':{'name':_0x121cd2[_0x8e83('0xa')]}})[_0x8e83('0x18')](function(_0x54908f){if(!_0x54908f||!_0x54908f[_0x8e83('0x21')](_0x121cd2['pass'])){return _0x3cf733['status'](0x191)[_0x8e83('0x1c')]({'message':_0x8e83('0x22')});}_0xb6d675[_0x8e83('0x13')]={'id':_0x54908f['id']};_0x47ce10();})[_0x8e83('0x23')](function(_0x3636c3){_0x47ce10(_0x3636c3);});}else if(_[_0x8e83('0x1e')](_0xb6d675[_0x8e83('0x24')]['authorization'],_0x8e83('0x25'))){validateJwt(_0xb6d675,_0x3cf733,_0x47ce10);}else{if(_0x5c8dae){_0x47ce10();}else{return _0x3cf733['status'](0x193)[_0x8e83('0x1c')]({'message':_0x8e83('0x26')});}}}else if(_0xb6d675[_0x8e83('0x27')][_0x8e83('0x28')]){try{var _0x9042a8=jwt[_0x8e83('0x29')](_0xb6d675['query'][_0x8e83('0x28')],config[_0x8e83('0x7')][_0x8e83('0x2a')],{'audience':hardwareConf[_0x8e83('0x2b')](),'issuer':hardwareConf['getUuid']()});db[_0x8e83('0x2c')]['find']({'where':{'id':_0x9042a8[_0x8e83('0x2d')]}})[_0x8e83('0x18')](function(_0x3ccf9c){if(!_0x3ccf9c||!_[_0x8e83('0x2e')](_0x3ccf9c['apiKeyNonce'],_0x9042a8['nonce'])){return _0x3cf733[_0x8e83('0x19')](0x193)[_0x8e83('0x1c')]({'message':_0x8e83('0x2f')});}_0xb6d675[_0x8e83('0x13')]={'id':_0x3ccf9c['id']};_0x47ce10();})[_0x8e83('0x23')](function(_0x5e1a81){_0x47ce10(_0x5e1a81);});}catch(_0x3cf636){console[_0x8e83('0x30')](_0x3cf636);return _0x3cf733[_0x8e83('0x19')](0x193)[_0x8e83('0x1c')]({'message':_0x8e83('0x31')});}}else if(_0x5c8dae){_0x47ce10();}else{return _0x3cf733[_0x8e83('0x19')](0x193)[_0x8e83('0x1c')]({'message':_0x8e83('0x26')});}})[_0x8e83('0x12')](function(_0x393d6f,_0x3bb13a,_0x56a6a8){if(_0x393d6f[_0x8e83('0x13')]){db['User'][_0x8e83('0x20')]({'where':{'id':_0x393d6f['user']['id']},'attributes':userAttributes})[_0x8e83('0x18')](function(_0x486df1){if(!_0x486df1){return _0x3bb13a[_0x8e83('0x19')](0x194)['json']({'message':_0x8e83('0x32')});}_0x393d6f[_0x8e83('0x13')]=_0x486df1;_0x56a6a8();})[_0x8e83('0x23')](function(_0x53c600){_0x56a6a8(_0x53c600);});}else if(_0x5c8dae){_0x56a6a8();}else{return _0x3bb13a[_0x8e83('0x19')](0x194)['json']({'message':_0x8e83('0x33')});}});}exports[_0x8e83('0x34')]=isAuthenticated;function canUpdate(){return compose()[_0x8e83('0x12')](function(_0x5c6ec7,_0x1a70c9,_0x4a70ef){return require('../../config/license/util')[_0x8e83('0x35')]()['then'](function(_0x1c72e8){if(_0x1c72e8['update']){_0x4a70ef();}else{return _0x1a70c9[_0x8e83('0x19')](0x193)[_0x8e83('0x1c')]({'message':_0x8e83('0x36')});}})[_0x8e83('0x23')](function(_0xbe882e){_0x4a70ef(_0xbe882e);});});}exports[_0x8e83('0x37')]=canUpdate;function signToken(_0x324ebd,_0x583dc){return jwt['sign']({'id':_0x324ebd,'role':_0x583dc},config['secrets']['session'],{'expiresIn':0x15180});}exports[_0x8e83('0x38')]=signToken;exports[_0x8e83('0x39')]=function(_0x4bb795){if(!_0x4bb795){throw new Error(_0x8e83('0x3a'));}return compose()[_0x8e83('0x12')](isAuthenticated())[_0x8e83('0x12')](function meetsRequirements(_0x3b02a9,_0x5ad479,_0x4f7a8d){if(config[_0x8e83('0x3b')][_0x8e83('0x3c')](_0x3b02a9['user'][_0x8e83('0x8')])>=config[_0x8e83('0x3b')][_0x8e83('0x3c')](_0x4bb795)){return _0x4f7a8d();}else{return _0x5ad479[_0x8e83('0x19')](0x193)[_0x8e83('0x1c')]({'message':_0x8e83('0x36')});}});};exports[_0x8e83('0x3d')]=function(_0x3e5a26,_0x1f4908,_0x14c263){_0x3e5a26[_0x8e83('0x3d')]=!![];return _0x14c263();};exports[_0x8e83('0x3e')]=function(_0x1a7333,_0x3a8b11){if(!_0x1a7333[_0x8e83('0x13')]){return _0x3a8b11['status'](0x194)['json']({'message':_0x8e83('0x3f')});}var _0x49094f=signToken(_0x1a7333[_0x8e83('0x13')]['id'],_0x1a7333['user'][_0x8e83('0x8')]);_0x3a8b11['cookie']('motion.token',_0x49094f);_0x3a8b11[_0x8e83('0x40')]('motion.user',JSON['stringify'](_[_0x8e83('0x41')](_0x1a7333['user'],userAttributes)));_0x3a8b11[_0x8e83('0x42')](_0x8e83('0x43'));};exports[_0x8e83('0x44')]=function(_0x5a5d90){if(_[_0x8e83('0x45')](_0x5a5d90['apiKeyNonce'])||_[_0x8e83('0x45')](_0x5a5d90[_0x8e83('0x46')]))return null;else return createJwt(_0x5a5d90);};exports[_0x8e83('0x47')]=function(_0x578eec){_0x578eec['apiKeyNonce']=crypto[_0x8e83('0x48')](0x10)[_0x8e83('0x49')](_0x8e83('0x4a'));_0x578eec['apiKeyIat']=Math['floor'](Date['now']()/0x3e8)[_0x8e83('0x49')]();return createJwt(_0x578eec);};exports[_0x8e83('0x4b')]=function(_0x2bcea3,_0x1049ef){if(_0x2bcea3['query'][_0x8e83('0x28')]){jwt[_0x8e83('0x29')](_0x2bcea3[_0x8e83('0x27')][_0x8e83('0x28')],config['secrets'][_0x8e83('0x2a')],{'nonce':_0x1049ef[_0x8e83('0x4c')],'iat':_0x1049ef[_0x8e83('0x46')],'audience':hardwareConf[_0x8e83('0x2b')](),'issuer':hardwareConf[_0x8e83('0x2b')]()});return generateApiKey(_0x1049ef);}else{throw{'message':_0x8e83('0x4d')};}};function createJwt(_0x110c44){return jwt[_0x8e83('0x4e')]({'iat':_0x110c44['apiKeyIat'],'nonce':_0x110c44[_0x8e83('0x4c')]},config[_0x8e83('0x7')][_0x8e83('0x2a')],{'algorithm':_0x8e83('0x4f'),'subject':_0x110c44['id'][_0x8e83('0x49')](),'issuer':hardwareConf[_0x8e83('0x2b')](),'audience':hardwareConf['getUuid']()});} \ No newline at end of file +var _0x9a51=['sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Unrecognized\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','../../config/license/util','getLicense','update','sign','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','motion.user','pick','isNil','apiKeyIat','generateApiKey','toString','floor','now','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','secrets','role','name','internal','email','userpic','permissions','voicePause','mailPause','faxPause','smsPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','then','status','disposition','unmanaged','Unmanaged.','catch','headers','startsWith','authorization','Basic','User','find','authenticate','json','Wrong\x20credentials.','Bearer','query','apikey','verify','session','getUuid'];(function(_0x19a550,_0x30df50){var _0x18ecef=function(_0x40768b){while(--_0x40768b){_0x19a550['push'](_0x19a550['shift']());}};_0x18ecef(++_0x30df50);}(_0x9a51,0x15f));var _0x19a5=function(_0x466e6b,_0x4053fd){_0x466e6b=_0x466e6b-0x0;var _0x118deb=_0x9a51[_0x466e6b];return _0x118deb;};'use strict';var db=require(_0x19a5('0x0'))['db'];var config=require(_0x19a5('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0x19a5('0x2'));var jwt=require(_0x19a5('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x19a5('0x4'));var basicAuth=require(_0x19a5('0x5'));var crypto=require('crypto');var ipaddr=require('ipaddr.js');var validateJwt=expressJwt({'secret':config[_0x19a5('0x6')]['session']});var userAttributes=['id',_0x19a5('0x7'),'fullname',_0x19a5('0x8'),_0x19a5('0x9'),_0x19a5('0xa'),_0x19a5('0xb'),_0x19a5('0xc'),_0x19a5('0xd'),'chatPause',_0x19a5('0xe'),_0x19a5('0xf'),_0x19a5('0x10'),'openchannelPause',_0x19a5('0x11'),_0x19a5('0x12'),_0x19a5('0x13'),_0x19a5('0x14'),'interface',_0x19a5('0x15')];exports[_0x19a5('0x16')]=function(){return isAuthenticated(!![])[_0x19a5('0x17')](function(_0x23c9ce,_0x26da14,_0x5ab750){if(_0x23c9ce[_0x19a5('0x18')]){_0x5ab750();}else{return db[_0x19a5('0x19')]['findOne']({'where':{'id':_0x23c9ce[_0x19a5('0x1a')]['id']},'attributes':['id',_0x19a5('0x1b'),'disposition'],'raw':!![]})[_0x19a5('0x1c')](function(_0x99ea35){if(_0x99ea35&&_0x99ea35[_0x19a5('0x1b')]){return _0x26da14[_0x19a5('0x1d')](_0x99ea35[_0x19a5('0x1e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x99ea35['disposition']===_0x19a5('0x1f')?_0x19a5('0x20'):'Forbidden.'});}else{_0x5ab750();}})[_0x19a5('0x21')](function(_0x2a1bd5){_0x5ab750(_0x2a1bd5);});}});};function isAuthenticated(_0x147c3b){return compose()[_0x19a5('0x17')](function(_0x37b28d,_0x108aff,_0x2c3c34){if(_0x37b28d[_0x19a5('0x22')]['authorization']){if(_[_0x19a5('0x23')](_0x37b28d[_0x19a5('0x22')][_0x19a5('0x24')],_0x19a5('0x25'))){var _0x69fd78=basicAuth(_0x37b28d);db[_0x19a5('0x26')][_0x19a5('0x27')]({'where':{'name':_0x69fd78[_0x19a5('0x8')]}})[_0x19a5('0x1c')](function(_0x3c27d4){if(!_0x3c27d4||!_0x3c27d4[_0x19a5('0x28')](_0x69fd78['pass'])){return _0x108aff[_0x19a5('0x1d')](0x191)[_0x19a5('0x29')]({'message':_0x19a5('0x2a')});}_0x37b28d['user']={'id':_0x3c27d4['id']};_0x2c3c34();})[_0x19a5('0x21')](function(_0x4195f0){_0x2c3c34(_0x4195f0);});}else if(_[_0x19a5('0x23')](_0x37b28d[_0x19a5('0x22')][_0x19a5('0x24')],_0x19a5('0x2b'))){validateJwt(_0x37b28d,_0x108aff,_0x2c3c34);}else{if(_0x147c3b){_0x2c3c34();}else{return _0x108aff[_0x19a5('0x1d')](0x193)[_0x19a5('0x29')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37b28d[_0x19a5('0x2c')][_0x19a5('0x2d')]){try{var _0x2b016e=jwt[_0x19a5('0x2e')](_0x37b28d['query'][_0x19a5('0x2d')],config['secrets'][_0x19a5('0x2f')],{'audience':hardwareConf[_0x19a5('0x30')](),'issuer':hardwareConf[_0x19a5('0x30')]()});db[_0x19a5('0x26')][_0x19a5('0x27')]({'where':{'id':_0x2b016e[_0x19a5('0x31')]}})[_0x19a5('0x1c')](function(_0x32f3db){if(!_0x32f3db||!_[_0x19a5('0x32')](_0x32f3db[_0x19a5('0x33')],_0x2b016e[_0x19a5('0x34')])){return _0x108aff['status'](0x193)[_0x19a5('0x29')]({'message':_0x19a5('0x35')});}_0x37b28d['user']={'id':_0x32f3db['id']};_0x2c3c34();})[_0x19a5('0x21')](function(_0x25620c){_0x2c3c34(_0x25620c);});}catch(_0x3077c9){console['log'](_0x3077c9);return _0x108aff[_0x19a5('0x1d')](0x193)[_0x19a5('0x29')]({'message':_0x19a5('0x36')});}}else if(_0x147c3b){_0x2c3c34();}else{return _0x108aff[_0x19a5('0x1d')](0x193)[_0x19a5('0x29')]({'message':_0x19a5('0x37')});}})['use'](function(_0x59d90e,_0x1b607a,_0x3cc414){if(_0x59d90e['user']){db[_0x19a5('0x26')][_0x19a5('0x27')]({'where':{'id':_0x59d90e['user']['id']},'attributes':userAttributes})[_0x19a5('0x1c')](function(_0x446f90){if(!_0x446f90){return _0x1b607a[_0x19a5('0x1d')](0x194)[_0x19a5('0x29')]({'message':_0x19a5('0x38')});}_0x59d90e['user']=_0x446f90;_0x3cc414();})[_0x19a5('0x21')](function(_0x81cd3f){_0x3cc414(_0x81cd3f);});}else if(_0x147c3b){_0x3cc414();}else{return _0x1b607a['status'](0x194)[_0x19a5('0x29')]({'message':'User\x20object\x20not\x20found.'});}});}exports['isAuthenticated']=isAuthenticated;function canUpdate(){return compose()['use'](function(_0x20e643,_0x3abed2,_0x4462bd){return require(_0x19a5('0x39'))[_0x19a5('0x3a')]()[_0x19a5('0x1c')](function(_0x47fcbe){if(_0x47fcbe[_0x19a5('0x3b')]){_0x4462bd();}else{return _0x3abed2[_0x19a5('0x1d')](0x193)[_0x19a5('0x29')]({'message':'Forbidden'});}})[_0x19a5('0x21')](function(_0x49ba37){_0x4462bd(_0x49ba37);});});}exports['canUpdate']=canUpdate;function signToken(_0x2c24ac,_0x1e0074){return jwt[_0x19a5('0x3c')]({'id':_0x2c24ac,'role':_0x1e0074},config[_0x19a5('0x6')][_0x19a5('0x2f')],{'expiresIn':0x15180});}exports[_0x19a5('0x3d')]=signToken;exports[_0x19a5('0x3e')]=function(_0x2ce6e6){if(!_0x2ce6e6){throw new Error(_0x19a5('0x3f'));}return compose()['use'](isAuthenticated())[_0x19a5('0x17')](function meetsRequirements(_0x3a814f,_0x51febf,_0x4cf753){if(config[_0x19a5('0x40')][_0x19a5('0x41')](_0x3a814f[_0x19a5('0x18')][_0x19a5('0x7')])>=config[_0x19a5('0x40')][_0x19a5('0x41')](_0x2ce6e6)){return _0x4cf753();}else{return _0x51febf[_0x19a5('0x1d')](0x193)[_0x19a5('0x29')]({'message':'Forbidden'});}});};exports['isMiddleware']=function(_0x1aea97,_0x3ae11d,_0xfa5840){_0x1aea97['isMiddleware']=!![];return _0xfa5840();};exports[_0x19a5('0x42')]=function(_0x28d7ca,_0x36fc8a){if(!_0x28d7ca[_0x19a5('0x18')]){return _0x36fc8a[_0x19a5('0x1d')](0x194)[_0x19a5('0x29')]({'message':_0x19a5('0x43')});}var _0x47f4a7=signToken(_0x28d7ca[_0x19a5('0x18')]['id'],_0x28d7ca[_0x19a5('0x18')][_0x19a5('0x7')]);_0x36fc8a[_0x19a5('0x44')](_0x19a5('0x45'),_0x47f4a7);_0x36fc8a['cookie'](_0x19a5('0x46'),JSON['stringify'](_[_0x19a5('0x47')](_0x28d7ca[_0x19a5('0x18')],userAttributes)));_0x36fc8a['redirect']('/dashboards/general');};exports['retrieveApiKey']=function(_0x284e5b){if(_['isNil'](_0x284e5b[_0x19a5('0x33')])||_[_0x19a5('0x48')](_0x284e5b[_0x19a5('0x49')]))return null;else return createJwt(_0x284e5b);};exports[_0x19a5('0x4a')]=function(_0x5a77fe){_0x5a77fe[_0x19a5('0x33')]=crypto['randomBytes'](0x10)[_0x19a5('0x4b')]('hex');_0x5a77fe[_0x19a5('0x49')]=Math[_0x19a5('0x4c')](Date[_0x19a5('0x4d')]()/0x3e8)[_0x19a5('0x4b')]();return createJwt(_0x5a77fe);};exports[_0x19a5('0x4e')]=function(_0x1c17fa,_0x32383a){if(_0x1c17fa['query'][_0x19a5('0x2d')]){jwt[_0x19a5('0x2e')](_0x1c17fa[_0x19a5('0x2c')][_0x19a5('0x2d')],config['secrets'][_0x19a5('0x2f')],{'nonce':_0x32383a[_0x19a5('0x33')],'iat':_0x32383a['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x19a5('0x30')]()});return generateApiKey(_0x32383a);}else{throw{'message':_0x19a5('0x4f')};}};function createJwt(_0x5429e4){return jwt[_0x19a5('0x3c')]({'iat':_0x5429e4[_0x19a5('0x49')],'nonce':_0x5429e4[_0x19a5('0x33')]},config[_0x19a5('0x6')][_0x19a5('0x2f')],{'algorithm':'HS512','subject':_0x5429e4['id'][_0x19a5('0x4b')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x19a5('0x30')]()});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index a742eb8..7ab2ded 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 _0x37b3=['unlink','decryptFile','createReadStream','createDecipher','data','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm','update','binary','write','end','final','close'];(function(_0x285013,_0x4f3d27){var _0x5162f9=function(_0x1d9d21){while(--_0x1d9d21){_0x285013['push'](_0x285013['shift']());}};_0x5162f9(++_0x4f3d27);}(_0x37b3,0x148));var _0x337b=function(_0x5b697a,_0x280202){_0x5b697a=_0x5b697a-0x0;var _0x5de43b=_0x37b3[_0x5b697a];return _0x5de43b;};'use strict';var crypto=require(_0x337b('0x0'));var fs=require('fs');var BPromise=require(_0x337b('0x1'));var defaultOptions={'algorithm':_0x337b('0x2')};function combineOptions(_0x11d806){var _0x5c46={};for(var _0x5124f0 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x5124f0)){_0x5c46[_0x5124f0]=defaultOptions[_0x5124f0];}}if(_0x11d806){for(var _0x5952fb in _0x11d806){if(_0x11d806[_0x337b('0x3')](_0x5952fb)){_0x5c46[_0x5952fb]=_0x11d806[_0x5952fb];}}}return _0x5c46;}exports[_0x337b('0x4')]=function(_0x1424e7,_0x58a570,_0x35fc37,_0x4c8837){return new BPromise(function(_0x5b399f,_0x9d0fc8){_0x4c8837=combineOptions(_0x4c8837);var _0x4507df=new Buffer(_0x35fc37);var _0x12eba6=fs['createReadStream'](_0x1424e7);var _0x454be0=fs[_0x337b('0x5')](_0x58a570);var _0x54d543=crypto[_0x337b('0x6')](_0x4c8837[_0x337b('0x7')],_0x4507df);_0x12eba6['on']('data',function(_0x24593f){var _0x47c5c0=new Buffer(_0x54d543[_0x337b('0x8')](_0x24593f),_0x337b('0x9'));_0x454be0[_0x337b('0xa')](_0x47c5c0);});_0x12eba6['on'](_0x337b('0xb'),function(){try{var _0x31d855=new Buffer(_0x54d543[_0x337b('0xc')]('binary'),'binary');_0x454be0[_0x337b('0xa')](_0x31d855);_0x454be0[_0x337b('0xb')]();_0x454be0['on'](_0x337b('0xd'),function(){return _0x5b399f(_0x58a570);});}catch(_0x1716da){fs[_0x337b('0xe')](_0x58a570);return _0x9d0fc8(_0x1716da);}});});};exports[_0x337b('0xf')]=function(_0x543925,_0x4feeaa,_0x5f46f6,_0x4b65c1){return new BPromise(function(_0x23956a,_0x49a23f){_0x4b65c1=combineOptions(_0x4b65c1);var _0x4584ee=new Buffer(_0x5f46f6);var _0x554cfc=fs[_0x337b('0x10')](_0x543925);var _0x51ef41=fs[_0x337b('0x5')](_0x4feeaa);var _0x35ecd3=crypto[_0x337b('0x11')](_0x4b65c1[_0x337b('0x7')],_0x4584ee);_0x554cfc['on'](_0x337b('0x12'),function(_0x3840c3){var _0x32593c=new Buffer(_0x35ecd3['update'](_0x3840c3),'binary');_0x51ef41[_0x337b('0xa')](_0x32593c);});_0x554cfc['on'](_0x337b('0xb'),function(){try{var _0x2aa617=new Buffer(_0x35ecd3[_0x337b('0xc')](_0x337b('0x9')),_0x337b('0x9'));_0x51ef41[_0x337b('0xa')](_0x2aa617);_0x51ef41['end']();_0x51ef41['on'](_0x337b('0xd'),function(){return _0x23956a(_0x4feeaa);});}catch(_0x58a676){fs[_0x337b('0xe')](_0x4feeaa);return _0x49a23f(_0x58a676);}});});}; \ No newline at end of file +var _0x99e1=['bluebird','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm','data','update','binary','write','final','end','close','unlink','createReadStream','createDecipher','crypto'];(function(_0x13ae43,_0x2afc17){var _0xfd274b=function(_0x1be881){while(--_0x1be881){_0x13ae43['push'](_0x13ae43['shift']());}};_0xfd274b(++_0x2afc17);}(_0x99e1,0xb3));var _0x199e=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x99e1[_0x43776a];return _0x18eb8f;};'use strict';var crypto=require(_0x199e('0x0'));var fs=require('fs');var BPromise=require(_0x199e('0x1'));var defaultOptions={'algorithm':_0x199e('0x2')};function combineOptions(_0xcbaa67){var _0x56987b={};for(var _0x2b6019 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x2b6019)){_0x56987b[_0x2b6019]=defaultOptions[_0x2b6019];}}if(_0xcbaa67){for(var _0x1b0d35 in _0xcbaa67){if(_0xcbaa67[_0x199e('0x3')](_0x1b0d35)){_0x56987b[_0x1b0d35]=_0xcbaa67[_0x1b0d35];}}}return _0x56987b;}exports[_0x199e('0x4')]=function(_0x5a7e9c,_0x26c47b,_0x27a193,_0x99418f){return new BPromise(function(_0x5a087a,_0x4e38ae){_0x99418f=combineOptions(_0x99418f);var _0x5b553d=new Buffer(_0x27a193);var _0x5913f5=fs['createReadStream'](_0x5a7e9c);var _0x59cede=fs[_0x199e('0x5')](_0x26c47b);var _0x53be50=crypto[_0x199e('0x6')](_0x99418f[_0x199e('0x7')],_0x5b553d);_0x5913f5['on'](_0x199e('0x8'),function(_0x280344){var _0x39ac1f=new Buffer(_0x53be50[_0x199e('0x9')](_0x280344),_0x199e('0xa'));_0x59cede[_0x199e('0xb')](_0x39ac1f);});_0x5913f5['on']('end',function(){try{var _0x3c1b56=new Buffer(_0x53be50[_0x199e('0xc')]('binary'),'binary');_0x59cede[_0x199e('0xb')](_0x3c1b56);_0x59cede[_0x199e('0xd')]();_0x59cede['on'](_0x199e('0xe'),function(){return _0x5a087a(_0x26c47b);});}catch(_0x249249){fs[_0x199e('0xf')](_0x26c47b);return _0x4e38ae(_0x249249);}});});};exports['decryptFile']=function(_0x542cde,_0x573543,_0x245cd7,_0x48cab2){return new BPromise(function(_0xd4540d,_0x44fc27){_0x48cab2=combineOptions(_0x48cab2);var _0x5c2939=new Buffer(_0x245cd7);var _0x29f2f1=fs[_0x199e('0x10')](_0x542cde);var _0x2b3af8=fs[_0x199e('0x5')](_0x573543);var _0x367af7=crypto[_0x199e('0x11')](_0x48cab2['algorithm'],_0x5c2939);_0x29f2f1['on']('data',function(_0x53c218){var _0x17736e=new Buffer(_0x367af7[_0x199e('0x9')](_0x53c218),_0x199e('0xa'));_0x2b3af8[_0x199e('0xb')](_0x17736e);});_0x29f2f1['on'](_0x199e('0xd'),function(){try{var _0x549220=new Buffer(_0x367af7[_0x199e('0xc')](_0x199e('0xa')),'binary');_0x2b3af8[_0x199e('0xb')](_0x549220);_0x2b3af8[_0x199e('0xd')]();_0x2b3af8['on'](_0x199e('0xe'),function(){return _0xd4540d(_0x573543);});}catch(_0x50f997){fs['unlink'](_0x573543);return _0x44fc27(_0x50f997);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 21ee60a..d246436 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 _0xe005=['existsSync','mkdirSync','each','%s%d.%s','join','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename'];(function(_0x249d84,_0xf4dbe7){var _0x3fcd7b=function(_0x411369){while(--_0x411369){_0x249d84['push'](_0x249d84['shift']());}};_0x3fcd7b(++_0xf4dbe7);}(_0xe005,0x96));var _0x5e00=function(_0x11f2de,_0x503df1){_0x11f2de=_0x11f2de-0x0;var _0x458fad=_0xe005[_0x11f2de];return _0x458fad;};'use strict';var util=require('util');var path=require(_0x5e00('0x0'));var _=require(_0x5e00('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x5e00('0x2'));var rimraf=require(_0x5e00('0x3'));var db=require(_0x5e00('0x4'))['db'];var dbH=require(_0x5e00('0x4'))[_0x5e00('0x5')];var logger=require(_0x5e00('0x6'))(_0x5e00('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x5e00('0x8')][0x2]);var QUERY=process[_0x5e00('0x8')][0x3];var PATH=process[_0x5e00('0x8')][0x4];function analyticExtractedReport(_0x3589c0,_0x591dc7){var _0x27370c={'status':_0x3589c0};var _0x2dc3cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x591dc7){_0x27370c[_0x5e00('0x9')]=_0x591dc7;}return db[_0x5e00('0xa')][_0x5e00('0xb')](_0x27370c,_0x2dc3cb);}function main(){var _0x202700=0x1388;var _0xf58985;logger[_0x5e00('0xc')](util[_0x5e00('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5e00('0xe')));return db[_0x5e00('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e00('0x10'),_0x5e00('0x11')]})[_0x5e00('0x12')](function(_0x1d5ba0){if(_0x1d5ba0){_0xf58985=_0x1d5ba0;_0x202700=_0xf58985['splitSizeCsv']||0x1388;}})[_0x5e00('0x12')](function(){return dbH[_0x5e00('0x13')][_0x5e00('0x14')](util[_0x5e00('0xd')](_0x5e00('0x15'),QUERY),{'type':dbH[_0x5e00('0x13')]['QueryTypes'][_0x5e00('0x16')]});})[_0x5e00('0x12')](function(_0xc2b1f){if(!_0xc2b1f[0x0][_0x5e00('0x17')]){return analyticExtractedReport('Empty');}var _0x524400=[];var _0x3294e1=0x0;var _0x1378c7=!![];if(_0xc2b1f&&_0xc2b1f[_0x5e00('0x18')]){var _0x5710bf=_0xc2b1f[0x0][_0x5e00('0x17')]%(_0x3294e1+_0x202700);if(_0xf58985['split']){for(;_0x1378c7;_0x3294e1+=_0x202700,_0x5710bf=_0xc2b1f[0x0]['num']%(_0x3294e1+_0x202700)){if(_0x5710bf==0x0||_0x5710bf==_0xc2b1f[0x0][_0x5e00('0x17')]){_0x1378c7=![];}_0x524400[_0x5e00('0x19')](dbH[_0x5e00('0x13')][_0x5e00('0x14')](util[_0x5e00('0xd')](_0x5e00('0x1a'),QUERY,_0x202700,_0x3294e1),{'type':dbH['sequelize'][_0x5e00('0x1b')][_0x5e00('0x16')]}));}}else{_0x524400[_0x5e00('0x19')](dbH[_0x5e00('0x13')][_0x5e00('0x14')](QUERY,{'type':dbH[_0x5e00('0x13')][_0x5e00('0x1b')]['SELECT']}));}}var _0x6e7b12=path[_0x5e00('0x1c')](PATH);var _0x595119=path[_0x5e00('0x1d')](PATH,'.csv');var _0x6da537=_0xf58985[_0x5e00('0x10')]&&_0x524400[_0x5e00('0x18')]>0x1;var _0x48ec9d=[];if(!fs[_0x5e00('0x1e')](path['join'](_0x6e7b12,_0x595119))&&_0x6da537){fs[_0x5e00('0x1f')](path['join'](_0x6e7b12,_0x595119));}return BPromise[_0x5e00('0x20')](_0x524400,function(_0x205a4d){_0x48ec9d[_0x5e00('0x19')](_0x205a4d);})['then'](function(){for(var _0x21204b=0x0;_0x21204b<_0x48ec9d['length'];_0x21204b+=0x1){var _0x4b12b8;var _0x390332=_0x48ec9d[_0x21204b];if(_0x6da537){_0x4b12b8=path['join'](_0x6e7b12,_0x595119,util[_0x5e00('0xd')](_0x5e00('0x21'),_0x595119,_0x21204b,'csv'));}else{_0x4b12b8=path[_0x5e00('0x22')](_0x6e7b12,util[_0x5e00('0xd')]('%s.%s',_0x595119,'csv'));}fs[_0x5e00('0x23')](_0x4b12b8,csv(_0x390332));}})['then'](function(){if(_0x6da537){zipdir(path[_0x5e00('0x22')](_0x6e7b12,_0x595119),{'saveTo':path[_0x5e00('0x22')](_0x6e7b12,util[_0x5e00('0xd')](_0x5e00('0x24'),_0x595119,_0x5e00('0x25')))},function(_0x56486a,_0x22eaa4){});rimraf(path[_0x5e00('0x22')](_0x6e7b12,_0x595119),function(){});}})[_0x5e00('0x12')](function(){logger[_0x5e00('0xc')](util[_0x5e00('0xd')](_0x5e00('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x5e00('0x27'),_0x6da537?util[_0x5e00('0xd')](_0x5e00('0x24'),_0x595119,_0x6da537?_0x5e00('0x25'):_0x5e00('0x28')):null);});})[_0x5e00('0x29')](function(_0xc29cfb){logger['info'](util['format'](_0x5e00('0x2a'),EXTRACTED_REPORT_ID,'CSV'),util[_0x5e00('0x2b')](_0xc29cfb,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5e00('0x2c'));});}main(); \ No newline at end of file +var _0x4bfb=['CSV','find','split','then','splitSizeCsv','sequelize','query','num','Empty','length','QueryTypes','SELECT','push','dirname','.csv','join','mkdirSync','each','%s.%s','writeFileSync','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','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4bfb,0xdd));var _0xb4bf=function(_0x392be3,_0xf1d603){_0x392be3=_0x392be3-0x0;var _0x1453b2=_0x4bfb[_0x392be3];return _0x1453b2;};'use strict';var util=require('util');var path=require(_0xb4bf('0x0'));var _=require(_0xb4bf('0x1'));var csv=require(_0xb4bf('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xb4bf('0x3'));var db=require(_0xb4bf('0x4'))['db'];var dbH=require('../../mysqldb')[_0xb4bf('0x5')];var logger=require(_0xb4bf('0x6'))(_0xb4bf('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb4bf('0x8')][0x2]);var QUERY=process[_0xb4bf('0x8')][0x3];var PATH=process[_0xb4bf('0x8')][0x4];function analyticExtractedReport(_0x2a3359,_0x297e94){var _0x120f0b={'status':_0x2a3359};var _0x1635d0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x297e94){_0x120f0b['savename']=_0x297e94;}return db[_0xb4bf('0x9')]['update'](_0x120f0b,_0x1635d0);}function main(){var _0x29e9f3=0x1388;var _0x48e63c;logger[_0xb4bf('0xa')](util[_0xb4bf('0xb')](_0xb4bf('0xc'),EXTRACTED_REPORT_ID,_0xb4bf('0xd')));return db['Setting'][_0xb4bf('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb4bf('0xf'),'splitSizeCsv']})[_0xb4bf('0x10')](function(_0xbf7e9){if(_0xbf7e9){_0x48e63c=_0xbf7e9;_0x29e9f3=_0x48e63c[_0xb4bf('0x11')]||0x1388;}})['then'](function(){return dbH[_0xb4bf('0x12')][_0xb4bf('0x13')](util[_0xb4bf('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb4bf('0x12')]['QueryTypes']['SELECT']});})[_0xb4bf('0x10')](function(_0x4a96ff){if(!_0x4a96ff[0x0][_0xb4bf('0x14')]){return analyticExtractedReport(_0xb4bf('0x15'));}var _0x2bd6f5=[];var _0x17f806=0x0;var _0x1636c3=!![];if(_0x4a96ff&&_0x4a96ff[_0xb4bf('0x16')]){var _0x57f760=_0x4a96ff[0x0][_0xb4bf('0x14')]%(_0x17f806+_0x29e9f3);if(_0x48e63c['split']){for(;_0x1636c3;_0x17f806+=_0x29e9f3,_0x57f760=_0x4a96ff[0x0][_0xb4bf('0x14')]%(_0x17f806+_0x29e9f3)){if(_0x57f760==0x0||_0x57f760==_0x4a96ff[0x0][_0xb4bf('0x14')]){_0x1636c3=![];}_0x2bd6f5['push'](dbH[_0xb4bf('0x12')]['query'](util[_0xb4bf('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29e9f3,_0x17f806),{'type':dbH[_0xb4bf('0x12')][_0xb4bf('0x17')][_0xb4bf('0x18')]}));}}else{_0x2bd6f5[_0xb4bf('0x19')](dbH[_0xb4bf('0x12')][_0xb4bf('0x13')](QUERY,{'type':dbH[_0xb4bf('0x12')][_0xb4bf('0x17')][_0xb4bf('0x18')]}));}}var _0xb5bde3=path[_0xb4bf('0x1a')](PATH);var _0x578d37=path['basename'](PATH,_0xb4bf('0x1b'));var _0x209f9f=_0x48e63c[_0xb4bf('0xf')]&&_0x2bd6f5[_0xb4bf('0x16')]>0x1;var _0x218a8f=[];if(!fs['existsSync'](path[_0xb4bf('0x1c')](_0xb5bde3,_0x578d37))&&_0x209f9f){fs[_0xb4bf('0x1d')](path[_0xb4bf('0x1c')](_0xb5bde3,_0x578d37));}return BPromise[_0xb4bf('0x1e')](_0x2bd6f5,function(_0x515693){_0x218a8f[_0xb4bf('0x19')](_0x515693);})['then'](function(){for(var _0x10b651=0x0;_0x10b651<_0x218a8f[_0xb4bf('0x16')];_0x10b651+=0x1){var _0x465704;var _0x5e6a7c=_0x218a8f[_0x10b651];if(_0x209f9f){_0x465704=path[_0xb4bf('0x1c')](_0xb5bde3,_0x578d37,util['format']('%s%d.%s',_0x578d37,_0x10b651,'csv'));}else{_0x465704=path[_0xb4bf('0x1c')](_0xb5bde3,util[_0xb4bf('0xb')](_0xb4bf('0x1f'),_0x578d37,'csv'));}fs[_0xb4bf('0x20')](_0x465704,csv(_0x5e6a7c));}})['then'](function(){if(_0x209f9f){zipdir(path[_0xb4bf('0x1c')](_0xb5bde3,_0x578d37),{'saveTo':path[_0xb4bf('0x1c')](_0xb5bde3,util[_0xb4bf('0xb')]('%s.%s',_0x578d37,_0xb4bf('0x21')))},function(_0x55263f,_0x202150){});rimraf(path[_0xb4bf('0x1c')](_0xb5bde3,_0x578d37),function(){});}})[_0xb4bf('0x10')](function(){logger[_0xb4bf('0xa')](util['format'](_0xb4bf('0x22'),EXTRACTED_REPORT_ID,_0xb4bf('0xd')));return analyticExtractedReport(_0xb4bf('0x23'),_0x209f9f?util['format'](_0xb4bf('0x1f'),_0x578d37,_0x209f9f?_0xb4bf('0x21'):'csv'):null);});})[_0xb4bf('0x24')](function(_0xddec0d){logger['info'](util[_0xb4bf('0xb')](_0xb4bf('0x25'),EXTRACTED_REPORT_ID,_0xb4bf('0xd')),util[_0xb4bf('0x26')](_0xddec0d,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b409e6e..5fd0ccf 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 _0xcecd=['pipe','finish','error','end','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','util','path','pdfmake/src/printer','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','push','num','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','mkdirSync','join','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','landscape','header','body','hasOwnProperty','toString','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','%s%d.%s','%s.%s','pdf'];(function(_0x2305bc,_0x51eb4d){var _0x49cce9=function(_0x700fae){while(--_0x700fae){_0x2305bc['push'](_0x2305bc['shift']());}};_0x49cce9(++_0x51eb4d);}(_0xcecd,0x93));var _0xdcec=function(_0x1e922f,_0x2c9566){_0x1e922f=_0x1e922f-0x0;var _0x3aea7e=_0xcecd[_0x1e922f];return _0x3aea7e;};'use strict';var _=require(_0xdcec('0x0'));var fs=require('fs');var BPromise=require(_0xdcec('0x1'));var util=require(_0xdcec('0x2'));var path=require(_0xdcec('0x3'));var moment=require('moment');var PdfPrinter=require(_0xdcec('0x4'));var zipdir=require(_0xdcec('0x5'));var rimraf=require('rimraf');var db=require(_0xdcec('0x6'))['db'];var dbH=require(_0xdcec('0x6'))[_0xdcec('0x7')];var logger=require(_0xdcec('0x8'))(_0xdcec('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xdcec('0xa')][0x2]);var QUERY=process[_0xdcec('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xdcec('0xa')][0x5];var FORMAT=_0xdcec('0xb');var _extractedReport;function analyticExtractedReport(_0x3e7474,_0x5134fd){var _0x4b01b0={'status':_0x3e7474};var _0x4ad8d9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5134fd){_0x4b01b0[_0xdcec('0xc')]=_0x5134fd;}return db[_0xdcec('0xd')]['update'](_0x4b01b0,_0x4ad8d9);}function getHeader(_0x29b8aa){var _0x453e68=[];for(var _0x2f1855 in _0x29b8aa){if(_0x29b8aa['hasOwnProperty'](_0x2f1855)){_0x453e68[_0xdcec('0xe')]({'text':_0x2f1855,'style':'tableHeader'});}}return _0x453e68;}function extractReport(_0x1f35dc){var _0x110380=0x1388;var _0x16209c;if(!_0x1f35dc[0x0][_0xdcec('0xf')]){return analyticExtractedReport('Empty');}var _0x16726e=[];var _0xb1982b=0x0;var _0x550d2c=!![];var _0x32ef06=path[_0xdcec('0x10')](PATH);var _0x1387d1=path[_0xdcec('0x11')](PATH,_0xdcec('0x12'));var _0x201eb3=![];var _0x277b6c=[];return db[_0xdcec('0x13')][_0xdcec('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdcec('0x15'),_0xdcec('0x16')]})[_0xdcec('0x17')](function(_0x4895cf){if(_0x4895cf){_0x16209c=_0x4895cf;_0x110380=_0x16209c['splitSizePdf']||0x3e8;}})[_0xdcec('0x17')](function(){if(_0x1f35dc&&_0x1f35dc[_0xdcec('0x18')]){var _0xfdc8ce=_0x1f35dc[0x0][_0xdcec('0xf')]%(_0xb1982b+_0x110380);if(_0x16209c[_0xdcec('0x15')]){for(;_0x550d2c;_0xb1982b+=_0x110380,_0xfdc8ce=_0x1f35dc[0x0]['num']%(_0xb1982b+_0x110380)){if(_0xfdc8ce==0x0||_0xfdc8ce==_0x1f35dc[0x0][_0xdcec('0xf')]){_0x550d2c=![];}_0x16726e['push'](dbH[_0xdcec('0x19')][_0xdcec('0x1a')](util[_0xdcec('0x1b')](_0xdcec('0x1c'),QUERY,_0x110380,_0xb1982b),{'type':dbH[_0xdcec('0x19')][_0xdcec('0x1d')]['SELECT']}));}}else{_0x16726e[_0xdcec('0xe')](dbH[_0xdcec('0x19')][_0xdcec('0x1a')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xdcec('0x1e')]}));}}_0x201eb3=_0x16209c['split']&&_0x16726e[_0xdcec('0x18')]>0x1;if(!fs[_0xdcec('0x1f')](path['join'](_0x32ef06,_0x1387d1))&&_0x201eb3){fs[_0xdcec('0x20')](path[_0xdcec('0x21')](_0x32ef06,_0x1387d1));}return BPromise['each'](_0x16726e,function(_0x7a0a){_0x277b6c['push'](_0x7a0a);});})[_0xdcec('0x17')](function(){return BPromise[_0xdcec('0x22')](_0x16726e,function(_0x4e40c4,_0x116070){var _0x46fa54;var _0x28f3ca=util[_0xdcec('0x1b')](_0xdcec('0x23'),NAME,_extractedReport[_0xdcec('0x24')],moment(_extractedReport[_0xdcec('0x25')])['format'](FORMAT),moment(_extractedReport[_0xdcec('0x26')])['format'](FORMAT));var _0x48f253={'pageSize':'A4','pageOrientation':_0xdcec('0x27'),'content':[{'text':_0x28f3ca,'style':_0xdcec('0x28')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x426905={'headerRows':0x1,'body':[]};_0x426905[_0xdcec('0x29')][_0xdcec('0xe')](getHeader(_0x4e40c4[0x0]));var _0x360142;for(var _0x25acba=0x0;_0x25acba<_0x4e40c4[_0xdcec('0x18')];_0x25acba+=0x1){_0x360142=[];for(var _0x397fd3 in _0x4e40c4[_0x25acba]){if(_0x4e40c4[_0x25acba][_0xdcec('0x2a')](_0x397fd3)){_0x360142[_0xdcec('0xe')](_0x4e40c4[_0x25acba][_0x397fd3]?_[_0xdcec('0x2b')](_0x4e40c4[_0x25acba][_0x397fd3]):'');}}_0x426905[_0xdcec('0x29')][_0xdcec('0xe')](_0x360142);}_0x48f253['content'][_0xdcec('0xe')]({'table':_0x426905});return new BPromise(function(_0x342a57,_0x3c6855){var _0x25c15e=new PdfPrinter({'Roboto':{'normal':__dirname+_0xdcec('0x2c'),'bold':__dirname+_0xdcec('0x2d'),'italics':__dirname+_0xdcec('0x2e'),'bolditalics':__dirname+_0xdcec('0x2f')}});var _0x3582cf=_0x25c15e['createPdfKitDocument'](_0x48f253);if(_0x201eb3){_0x46fa54=path[_0xdcec('0x21')](_0x32ef06,_0x1387d1,util['format'](_0xdcec('0x30'),_0x1387d1,_0x116070,'pdf'));}else{_0x46fa54=path[_0xdcec('0x21')](_0x32ef06,util[_0xdcec('0x1b')](_0xdcec('0x31'),_0x1387d1,_0xdcec('0x32')));}var _0xffb50d=_0x3582cf[_0xdcec('0x33')](fs['createWriteStream'](_0x46fa54));_0xffb50d['on'](_0xdcec('0x34'),function(){_0x342a57();});_0xffb50d['on'](_0xdcec('0x35'),function(_0x5bfd30){console['log']('err',_0x5bfd30);_0x3c6855(_0x5bfd30);});_0x3582cf[_0xdcec('0x36')]();});});})[_0xdcec('0x17')](function(){if(_0x201eb3){return new BPromise(function(_0x3d3e34,_0x56f9fa){zipdir(path[_0xdcec('0x21')](_0x32ef06,_0x1387d1),{'saveTo':path[_0xdcec('0x21')](_0x32ef06,util[_0xdcec('0x1b')](_0xdcec('0x31'),_0x1387d1,_0xdcec('0x37')))},function(_0x494297){if(_0x494297){_0x56f9fa(_0x494297);}else{_0x3d3e34();}});});}})[_0xdcec('0x17')](function(){if(_0x201eb3){rimraf(path[_0xdcec('0x21')](_0x32ef06,_0x1387d1),function(){});}})[_0xdcec('0x17')](function(){logger[_0xdcec('0x38')](util[_0xdcec('0x1b')](_0xdcec('0x39'),EXTRACTED_REPORT_ID,_0xdcec('0x3a')));return analyticExtractedReport('Completed',_0x201eb3?util[_0xdcec('0x1b')]('%s.%s',_0x1387d1,_0x201eb3?'zip':'pdf'):null);});}function main(){logger['info'](util[_0xdcec('0x1b')](_0xdcec('0x3b'),EXTRACTED_REPORT_ID,_0xdcec('0x3c')));return db[_0xdcec('0xd')][_0xdcec('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x29ac08){_extractedReport=_0x29ac08;return dbH[_0xdcec('0x19')][_0xdcec('0x1a')](util[_0xdcec('0x1b')](_0xdcec('0x3e'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xdcec('0x1e')]});})[_0xdcec('0x17')](extractReport)['catch'](function(_0x41b318){logger[_0xdcec('0x38')](util[_0xdcec('0x1b')](_0xdcec('0x3f'),EXTRACTED_REPORT_ID,_0xdcec('0x3c')),util[_0xdcec('0x40')](_0x41b318,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xdcec('0x41'));});}main(); \ No newline at end of file +var _0xadf7=['sequelize','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','landscape','header','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s','pipe','createWriteStream','finish','error','log','err','end','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','util','path','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','push','num','Empty','dirname','.pdf','Setting','find','split','splitSizePdf','then','length'];(function(_0x284f91,_0x490971){var _0x9f9987=function(_0x270e8f){while(--_0x270e8f){_0x284f91['push'](_0x284f91['shift']());}};_0x9f9987(++_0x490971);}(_0xadf7,0xfe));var _0x7adf=function(_0x319c3a,_0x359329){_0x319c3a=_0x319c3a-0x0;var _0x102fa3=_0xadf7[_0x319c3a];return _0x102fa3;};'use strict';var _=require(_0x7adf('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0x7adf('0x1'));var path=require(_0x7adf('0x2'));var moment=require('moment');var PdfPrinter=require(_0x7adf('0x3'));var zipdir=require(_0x7adf('0x4'));var rimraf=require(_0x7adf('0x5'));var db=require(_0x7adf('0x6'))['db'];var dbH=require(_0x7adf('0x6'))[_0x7adf('0x7')];var logger=require('../../config/logger')(_0x7adf('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x7adf('0x9')][0x2]);var QUERY=process[_0x7adf('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x7adf('0x9')][0x5];var FORMAT=_0x7adf('0xa');var _extractedReport;function analyticExtractedReport(_0x5ebdb0,_0x2cd69c){var _0x223356={'status':_0x5ebdb0};var _0x4c5bcc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cd69c){_0x223356[_0x7adf('0xb')]=_0x2cd69c;}return db[_0x7adf('0xc')][_0x7adf('0xd')](_0x223356,_0x4c5bcc);}function getHeader(_0x4ebd99){var _0x480e38=[];for(var _0x512d86 in _0x4ebd99){if(_0x4ebd99[_0x7adf('0xe')](_0x512d86)){_0x480e38[_0x7adf('0xf')]({'text':_0x512d86,'style':'tableHeader'});}}return _0x480e38;}function extractReport(_0x47e5fb){var _0x50f6b5=0x1388;var _0x3a2952;if(!_0x47e5fb[0x0][_0x7adf('0x10')]){return analyticExtractedReport(_0x7adf('0x11'));}var _0x5267b5=[];var _0x51838a=0x0;var _0x21b56d=!![];var _0x1a7e49=path[_0x7adf('0x12')](PATH);var _0x1547f7=path['basename'](PATH,_0x7adf('0x13'));var _0x56608f=![];var _0x232cac=[];return db[_0x7adf('0x14')][_0x7adf('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7adf('0x16'),_0x7adf('0x17')]})[_0x7adf('0x18')](function(_0x3a5b3b){if(_0x3a5b3b){_0x3a2952=_0x3a5b3b;_0x50f6b5=_0x3a2952[_0x7adf('0x17')]||0x3e8;}})[_0x7adf('0x18')](function(){if(_0x47e5fb&&_0x47e5fb[_0x7adf('0x19')]){var _0x12bcc4=_0x47e5fb[0x0][_0x7adf('0x10')]%(_0x51838a+_0x50f6b5);if(_0x3a2952[_0x7adf('0x16')]){for(;_0x21b56d;_0x51838a+=_0x50f6b5,_0x12bcc4=_0x47e5fb[0x0][_0x7adf('0x10')]%(_0x51838a+_0x50f6b5)){if(_0x12bcc4==0x0||_0x12bcc4==_0x47e5fb[0x0][_0x7adf('0x10')]){_0x21b56d=![];}_0x5267b5[_0x7adf('0xf')](dbH[_0x7adf('0x1a')]['query'](util[_0x7adf('0x1b')](_0x7adf('0x1c'),QUERY,_0x50f6b5,_0x51838a),{'type':dbH[_0x7adf('0x1a')][_0x7adf('0x1d')][_0x7adf('0x1e')]}));}}else{_0x5267b5['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x7adf('0x1a')]['QueryTypes']['SELECT']}));}}_0x56608f=_0x3a2952[_0x7adf('0x16')]&&_0x5267b5['length']>0x1;if(!fs[_0x7adf('0x1f')](path['join'](_0x1a7e49,_0x1547f7))&&_0x56608f){fs[_0x7adf('0x20')](path['join'](_0x1a7e49,_0x1547f7));}return BPromise[_0x7adf('0x21')](_0x5267b5,function(_0x4c7ab0){_0x232cac['push'](_0x4c7ab0);});})[_0x7adf('0x18')](function(){return BPromise[_0x7adf('0x21')](_0x5267b5,function(_0x40c400,_0x5b0d33){var _0x213fd3;var _0x3c289f=util[_0x7adf('0x1b')](_0x7adf('0x22'),NAME,_extractedReport[_0x7adf('0x23')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport['endDate'])['format'](FORMAT));var _0xc7ebda={'pageSize':'A4','pageOrientation':_0x7adf('0x24'),'content':[{'text':_0x3c289f,'style':_0x7adf('0x25')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x25b6ee={'headerRows':0x1,'body':[]};_0x25b6ee[_0x7adf('0x26')][_0x7adf('0xf')](getHeader(_0x40c400[0x0]));var _0x5e5443;for(var _0x55729d=0x0;_0x55729d<_0x40c400[_0x7adf('0x19')];_0x55729d+=0x1){_0x5e5443=[];for(var _0x54f9f6 in _0x40c400[_0x55729d]){if(_0x40c400[_0x55729d][_0x7adf('0xe')](_0x54f9f6)){_0x5e5443['push'](_0x40c400[_0x55729d][_0x54f9f6]?_[_0x7adf('0x27')](_0x40c400[_0x55729d][_0x54f9f6]):'');}}_0x25b6ee[_0x7adf('0x26')][_0x7adf('0xf')](_0x5e5443);}_0xc7ebda[_0x7adf('0x28')][_0x7adf('0xf')]({'table':_0x25b6ee});return new BPromise(function(_0x2a3dcc,_0x200ee8){var _0x170fbc=new PdfPrinter({'Roboto':{'normal':__dirname+_0x7adf('0x29'),'bold':__dirname+_0x7adf('0x2a'),'italics':__dirname+_0x7adf('0x2b'),'bolditalics':__dirname+_0x7adf('0x2c')}});var _0x1b5fdc=_0x170fbc[_0x7adf('0x2d')](_0xc7ebda);if(_0x56608f){_0x213fd3=path[_0x7adf('0x2e')](_0x1a7e49,_0x1547f7,util['format'](_0x7adf('0x2f'),_0x1547f7,_0x5b0d33,_0x7adf('0x30')));}else{_0x213fd3=path[_0x7adf('0x2e')](_0x1a7e49,util[_0x7adf('0x1b')](_0x7adf('0x31'),_0x1547f7,'pdf'));}var _0x18b237=_0x1b5fdc[_0x7adf('0x32')](fs[_0x7adf('0x33')](_0x213fd3));_0x18b237['on'](_0x7adf('0x34'),function(){_0x2a3dcc();});_0x18b237['on'](_0x7adf('0x35'),function(_0x1fe371){console[_0x7adf('0x36')](_0x7adf('0x37'),_0x1fe371);_0x200ee8(_0x1fe371);});_0x1b5fdc[_0x7adf('0x38')]();});});})[_0x7adf('0x18')](function(){if(_0x56608f){return new BPromise(function(_0x1939ee,_0xbd9462){zipdir(path[_0x7adf('0x2e')](_0x1a7e49,_0x1547f7),{'saveTo':path[_0x7adf('0x2e')](_0x1a7e49,util[_0x7adf('0x1b')](_0x7adf('0x31'),_0x1547f7,_0x7adf('0x39')))},function(_0xd22577){if(_0xd22577){_0xbd9462(_0xd22577);}else{_0x1939ee();}});});}})[_0x7adf('0x18')](function(){if(_0x56608f){rimraf(path['join'](_0x1a7e49,_0x1547f7),function(){});}})[_0x7adf('0x18')](function(){logger[_0x7adf('0x3a')](util[_0x7adf('0x1b')](_0x7adf('0x3b'),EXTRACTED_REPORT_ID,_0x7adf('0x3c')));return analyticExtractedReport(_0x7adf('0x3d'),_0x56608f?util[_0x7adf('0x1b')]('%s.%s',_0x1547f7,_0x56608f?'zip':'pdf'):null);});}function main(){logger[_0x7adf('0x3a')](util[_0x7adf('0x1b')](_0x7adf('0x3e'),EXTRACTED_REPORT_ID,_0x7adf('0x3f')));return db[_0x7adf('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7adf('0x18')](function(_0x1fd96b){_extractedReport=_0x1fd96b;return dbH['sequelize'][_0x7adf('0x40')](util[_0x7adf('0x1b')](_0x7adf('0x41'),QUERY),{'type':dbH[_0x7adf('0x1a')][_0x7adf('0x1d')][_0x7adf('0x1e')]});})[_0x7adf('0x18')](extractReport)[_0x7adf('0x42')](function(_0x12e0b2){logger[_0x7adf('0x3a')](util[_0x7adf('0x1b')](_0x7adf('0x43'),EXTRACTED_REPORT_ID,_0x7adf('0x3f')),util[_0x7adf('0x44')](_0x12e0b2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7adf('0x45'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fe447dc..2cbd9cd 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 _0xf212=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','XLSX','split','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x134c2e,_0x1704d3){var _0x317bbe=function(_0xc1e0b4){while(--_0xc1e0b4){_0x134c2e['push'](_0x134c2e['shift']());}};_0x317bbe(++_0x1704d3);}(_0xf212,0xdc));var _0x2f21=function(_0x1348a1,_0x3e918e){_0x1348a1=_0x1348a1-0x0;var _0x48f062=_0xf212[_0x1348a1];return _0x48f062;};'use strict';var util=require('util');var path=require('path');var _=require(_0x2f21('0x0'));var fs=require('fs');var json2xls=require(_0x2f21('0x1'));var BPromise=require(_0x2f21('0x2'));var zipdir=require(_0x2f21('0x3'));var rimraf=require(_0x2f21('0x4'));var db=require(_0x2f21('0x5'))['db'];var dbH=require('../../mysqldb')[_0x2f21('0x6')];var logger=require(_0x2f21('0x7'))(_0x2f21('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x2f21('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2f21('0x9')][0x4];function analyticExtractedReport(_0x596af5,_0x3b9e04){var _0x2ab6e2={'status':_0x596af5};var _0x1c7dc8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b9e04){_0x2ab6e2[_0x2f21('0xa')]=_0x3b9e04;}return db['AnalyticExtractedReport'][_0x2f21('0xb')](_0x2ab6e2,_0x1c7dc8);}function main(){var _0x1b1a6e=0x1388;var _0x37abc5;logger[_0x2f21('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2f21('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f21('0xe'),'splitSizeXlsx']})[_0x2f21('0xf')](function(_0x5d6766){if(_0x5d6766){_0x37abc5=_0x5d6766;_0x1b1a6e=_0x37abc5[_0x2f21('0x10')]||0x1388;}})[_0x2f21('0xf')](function(){return dbH[_0x2f21('0x11')][_0x2f21('0x12')](util[_0x2f21('0x13')](_0x2f21('0x14'),QUERY),{'type':dbH[_0x2f21('0x11')][_0x2f21('0x15')][_0x2f21('0x16')]});})['then'](function(_0x1c37af){if(!_0x1c37af[0x0][_0x2f21('0x17')]){return analyticExtractedReport(_0x2f21('0x18'));}var _0x241b40=[];var _0x4ae90b=0x0;var _0xcd321c=!![];if(_0x37abc5['split']){if(_0x1c37af&&_0x1c37af['length']){var _0x417638=_0x1c37af[0x0][_0x2f21('0x17')]%(_0x4ae90b+_0x1b1a6e);for(;_0xcd321c;_0x4ae90b+=_0x1b1a6e,_0x417638=_0x1c37af[0x0][_0x2f21('0x17')]%(_0x4ae90b+_0x1b1a6e)){if(_0x417638==0x0||_0x417638==_0x1c37af[0x0][_0x2f21('0x17')]){_0xcd321c=![];}_0x241b40[_0x2f21('0x19')](dbH[_0x2f21('0x11')][_0x2f21('0x12')](util[_0x2f21('0x13')](_0x2f21('0x1a'),QUERY,_0x1b1a6e,_0x4ae90b),{'type':dbH[_0x2f21('0x11')][_0x2f21('0x15')][_0x2f21('0x16')]}));}}}else{_0x241b40[_0x2f21('0x19')](dbH[_0x2f21('0x11')][_0x2f21('0x12')](QUERY,{'type':dbH[_0x2f21('0x11')]['QueryTypes'][_0x2f21('0x16')]}));}var _0x497839=path['dirname'](PATH);var _0x42833e=path[_0x2f21('0x1b')](PATH,_0x2f21('0x1c'));var _0x39a2c3=_0x37abc5['split']&&_0x241b40[_0x2f21('0x1d')]>0x1;var _0x525700=[];if(!fs[_0x2f21('0x1e')](path[_0x2f21('0x1f')](_0x497839,_0x42833e))&&_0x39a2c3){fs[_0x2f21('0x20')](path['join'](_0x497839,_0x42833e));}return BPromise[_0x2f21('0x21')](_0x241b40,function(_0xda687){_0x525700[_0x2f21('0x19')](_0xda687);})[_0x2f21('0xf')](function(){for(var _0x1ac1d1=0x0;_0x1ac1d1<_0x525700[_0x2f21('0x1d')];_0x1ac1d1+=0x1){var _0x1d9f09;var _0x117fde=_0x525700[_0x1ac1d1];if(_0x39a2c3){_0x1d9f09=path[_0x2f21('0x1f')](_0x497839,_0x42833e,util[_0x2f21('0x13')](_0x2f21('0x22'),_0x42833e,_0x1ac1d1,_0x2f21('0x23')));}else{_0x1d9f09=path[_0x2f21('0x1f')](_0x497839,util[_0x2f21('0x13')](_0x2f21('0x24'),_0x42833e,_0x2f21('0x23')));}fs[_0x2f21('0x25')](_0x1d9f09,json2xls(_0x117fde),'binary');}})['then'](function(){if(_0x39a2c3){zipdir(path['join'](_0x497839,_0x42833e),{'saveTo':path['join'](_0x497839,util[_0x2f21('0x13')](_0x2f21('0x24'),_0x42833e,'zip'))},function(_0x53bdbf,_0x5a75fa){});rimraf(path[_0x2f21('0x1f')](_0x497839,_0x42833e),function(){});}})['then'](function(){logger[_0x2f21('0xc')](util['format'](_0x2f21('0x26'),EXTRACTED_REPORT_ID,_0x2f21('0xd')));return analyticExtractedReport(_0x2f21('0x27'),_0x39a2c3?util[_0x2f21('0x13')](_0x2f21('0x24'),_0x42833e,_0x39a2c3?_0x2f21('0x28'):_0x2f21('0x23')):null);});})[_0x2f21('0x29')](function(_0x2cb038){logger[_0x2f21('0xc')](util[_0x2f21('0x13')](_0x2f21('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x2f21('0x2b')](_0x2cb038,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x2f21('0x2c'));});}main(); \ No newline at end of file +var _0xa9ad=['bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','writeFileSync','binary','%s.%s','zip','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash'];(function(_0x580b90,_0x217808){var _0x16c032=function(_0xb7c318){while(--_0xb7c318){_0x580b90['push'](_0x580b90['shift']());}};_0x16c032(++_0x217808);}(_0xa9ad,0x19b));var _0xda9a=function(_0x4fc49d,_0x26f84f){_0x4fc49d=_0x4fc49d-0x0;var _0x1c4263=_0xa9ad[_0x4fc49d];return _0x1c4263;};'use strict';var util=require(_0xda9a('0x0'));var path=require(_0xda9a('0x1'));var _=require(_0xda9a('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xda9a('0x3'));var zipdir=require(_0xda9a('0x4'));var rimraf=require('rimraf');var db=require(_0xda9a('0x5'))['db'];var dbH=require(_0xda9a('0x5'))[_0xda9a('0x6')];var logger=require(_0xda9a('0x7'))(_0xda9a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xda9a('0x9')][0x2]);var QUERY=process[_0xda9a('0x9')][0x3];var PATH=process[_0xda9a('0x9')][0x4];function analyticExtractedReport(_0x5e0434,_0x2758be){var _0x5e914a={'status':_0x5e0434};var _0x35aeb7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2758be){_0x5e914a['savename']=_0x2758be;}return db[_0xda9a('0xa')]['update'](_0x5e914a,_0x35aeb7);}function main(){var _0x561ac0=0x1388;var _0x44d811;logger[_0xda9a('0xb')](util[_0xda9a('0xc')](_0xda9a('0xd'),EXTRACTED_REPORT_ID,_0xda9a('0xe')));return db[_0xda9a('0xf')][_0xda9a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xda9a('0x11'),_0xda9a('0x12')]})[_0xda9a('0x13')](function(_0x3cf0b9){if(_0x3cf0b9){_0x44d811=_0x3cf0b9;_0x561ac0=_0x44d811['splitSizeXlsx']||0x1388;}})[_0xda9a('0x13')](function(){return dbH[_0xda9a('0x14')]['query'](util['format'](_0xda9a('0x15'),QUERY),{'type':dbH[_0xda9a('0x14')][_0xda9a('0x16')][_0xda9a('0x17')]});})['then'](function(_0x1ed2b8){if(!_0x1ed2b8[0x0]['num']){return analyticExtractedReport(_0xda9a('0x18'));}var _0x3bb997=[];var _0x13132a=0x0;var _0x53fdf6=!![];if(_0x44d811[_0xda9a('0x11')]){if(_0x1ed2b8&&_0x1ed2b8[_0xda9a('0x19')]){var _0x57985c=_0x1ed2b8[0x0][_0xda9a('0x1a')]%(_0x13132a+_0x561ac0);for(;_0x53fdf6;_0x13132a+=_0x561ac0,_0x57985c=_0x1ed2b8[0x0][_0xda9a('0x1a')]%(_0x13132a+_0x561ac0)){if(_0x57985c==0x0||_0x57985c==_0x1ed2b8[0x0]['num']){_0x53fdf6=![];}_0x3bb997[_0xda9a('0x1b')](dbH[_0xda9a('0x14')][_0xda9a('0x1c')](util['format'](_0xda9a('0x1d'),QUERY,_0x561ac0,_0x13132a),{'type':dbH[_0xda9a('0x14')][_0xda9a('0x16')][_0xda9a('0x17')]}));}}}else{_0x3bb997['push'](dbH[_0xda9a('0x14')][_0xda9a('0x1c')](QUERY,{'type':dbH[_0xda9a('0x14')][_0xda9a('0x16')]['SELECT']}));}var _0x48093c=path[_0xda9a('0x1e')](PATH);var _0x5cb18f=path[_0xda9a('0x1f')](PATH,_0xda9a('0x20'));var _0x280058=_0x44d811[_0xda9a('0x11')]&&_0x3bb997[_0xda9a('0x19')]>0x1;var _0x53e343=[];if(!fs[_0xda9a('0x21')](path[_0xda9a('0x22')](_0x48093c,_0x5cb18f))&&_0x280058){fs[_0xda9a('0x23')](path[_0xda9a('0x22')](_0x48093c,_0x5cb18f));}return BPromise[_0xda9a('0x24')](_0x3bb997,function(_0x23a659){_0x53e343[_0xda9a('0x1b')](_0x23a659);})['then'](function(){for(var _0x4f555c=0x0;_0x4f555c<_0x53e343[_0xda9a('0x19')];_0x4f555c+=0x1){var _0x461226;var _0x10949f=_0x53e343[_0x4f555c];if(_0x280058){_0x461226=path[_0xda9a('0x22')](_0x48093c,_0x5cb18f,util[_0xda9a('0xc')](_0xda9a('0x25'),_0x5cb18f,_0x4f555c,'xlsx'));}else{_0x461226=path[_0xda9a('0x22')](_0x48093c,util[_0xda9a('0xc')]('%s.%s',_0x5cb18f,'xlsx'));}fs[_0xda9a('0x26')](_0x461226,json2xls(_0x10949f),_0xda9a('0x27'));}})[_0xda9a('0x13')](function(){if(_0x280058){zipdir(path[_0xda9a('0x22')](_0x48093c,_0x5cb18f),{'saveTo':path[_0xda9a('0x22')](_0x48093c,util[_0xda9a('0xc')](_0xda9a('0x28'),_0x5cb18f,_0xda9a('0x29')))},function(_0x5e3fc0,_0x2bcfc0){});rimraf(path['join'](_0x48093c,_0x5cb18f),function(){});}})[_0xda9a('0x13')](function(){logger[_0xda9a('0xb')](util[_0xda9a('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xda9a('0xe')));return analyticExtractedReport('Completed',_0x280058?util[_0xda9a('0xc')]('%s.%s',_0x5cb18f,_0x280058?_0xda9a('0x29'):_0xda9a('0x2a')):null);});})[_0xda9a('0x2b')](function(_0x32b2ad){logger['info'](util[_0xda9a('0xc')](_0xda9a('0x2c'),EXTRACTED_REPORT_ID,_0xda9a('0xe')),util['inspect'](_0x32b2ad,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xda9a('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2d1ff69..6e2bb3a 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 _0xaf85=['extensions','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','callerID','ExecIf','$[${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)','indexOf','app','custom','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','Interval','findAll','then','models','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extension'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf85,0xad));var _0x5af8=function(_0x18dc34,_0x205f71){_0x18dc34=_0x18dc34-0x0;var _0x4ab15b=_0xaf85[_0x18dc34];return _0x4ab15b;};'use strict';var _=require(_0x5af8('0x0'));var util=require(_0x5af8('0x1'));function rewrite(_0x2f96ba,_0x2d3404){var _0x5bbb7b=this;return _0x2f96ba['models'][_0x5af8('0x2')][_0x5af8('0x3')]({'raw':!![]})[_0x5af8('0x4')](function(_0x76d413){_0x5bbb7b['intervals']=_0x76d413;return _0x2f96ba[_0x5af8('0x5')][_0x5af8('0x6')][_0x5af8('0x3')]({'where':{'IntervalId':_0x2d3404[_0x5af8('0x7')]},'raw':!![]});})['then'](function(_0x37e4c9){return _0x2f96ba['models'][_0x5af8('0x6')][_0x5af8('0x3')]({'where':{'exten':{'$in':_[_0x5af8('0x8')](_[_0x5af8('0x9')](_0x37e4c9,'exten'))}},'order':[{'raw':_0x5af8('0xa')}],'raw':!![]});})[_0x5af8('0x4')](function(_0x2a73c4){var _0x322a29=_[_0x5af8('0xb')](_0x2a73c4,{'priority':'1'});var _0x5519e4=_[_0x5af8('0xb')](_0x2a73c4,{'isApp':0x1});var _0x2f1d57=_[_0x5af8('0xc')](_0x5519e4,_0x5af8('0xd'));var _0x32b2a5=[_0x5af8('0xe'),_0x5af8('0xf')];var _0x530a44=[];var _0x10b4b6=[];for(var _0x58b0ba in _0x2f1d57){if(_0x2f1d57[_0x5af8('0x10')](_0x58b0ba)){_0x5bbb7b[_0x5af8('0x11')]=0x2;_0x5bbb7b['extensions']=[];_0x5bbb7b[_0x5af8('0x12')]=_['find'](_0x322a29,{'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')]});_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':_0x5af8('0x16'),'appdata':util['format'](_0x5af8('0x17'),_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')]),'context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});if(_0x2f1d57[_0x58b0ba][0x0]['type']==='outbound'){if(_0x5bbb7b['extension']){_0x5bbb7b['extensions']['push']({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x1a')+(_0x5bbb7b[_0x5af8('0x12')]['cutdigits']?_0x5af8('0x1b')+_0x5bbb7b[_0x5af8('0x12')][_0x5af8('0x1c')]+'}':'${EXTEN}'),'context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});}_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0]['type'],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x1d')+_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')],'context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0]['VoiceExtensionId']});var _0x57b773=_0x5bbb7b[_0x5af8('0x11')]++;_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':'ExecIf','appdata':_0x5af8('0x1e')+(_0x57b773+0x2)+_0x5af8('0x1f')+(_0x57b773+0x1)+')','context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x57b773,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});if(_0x5bbb7b[_0x5af8('0x12')]){_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':_0x5af8('0x16'),'appdata':_0x5bbb7b[_0x5af8('0x12')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x5bbb7b[_0x5af8('0x12')][_0x5af8('0x1c')]+'}':_0x5af8('0x20'),'context':_0x2f1d57[_0x58b0ba][0x0]['context'],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0]['VoiceExtensionId']});}_0x5bbb7b['extensions'][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0]['type'],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x21')+_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')],'context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});if(_0x5bbb7b['extension']&&_0x5bbb7b[_0x5af8('0x12')][_0x5af8('0x10')](_0x5af8('0x22'))&&_0x5bbb7b['extension'][_0x5af8('0x22')]!==_0x5af8('0x23')){_0x5bbb7b['extensions']['push']({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':_0x5af8('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0]['type'],'app':_0x5af8('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5bbb7b[_0x5af8('0x12')][_0x5af8('0x22')]||_0x5af8('0x24'),'context':_0x2f1d57[_0x58b0ba][0x0]['context'],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b['priority']++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0]['VoiceExtensionId']});}}_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0]['type'],'app':_0x5af8('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b[_0x5af8('0x11')]++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0]['type'],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x25'),'context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0]['exten'],'priority':_0x5bbb7b['priority']++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});_0x5bbb7b[_0x5af8('0x13')]['push']({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x26'),'context':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x18')],'exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'priority':_0x5bbb7b['priority']++,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});for(var _0x1b4a9e=0x0,_0x3b7443=0x0;_0x1b4a9e<_0x2f1d57[_0x58b0ba][_0x5af8('0x27')];_0x1b4a9e+=0x1,_0x3b7443=0x0){var _0x4a8a5e=_0x2f1d57[_0x58b0ba][_0x1b4a9e];if(_0x4a8a5e[_0x5af8('0x15')]){_0x4a8a5e['type']=_0x4a8a5e[_0x5af8('0x15')][_0x5af8('0x28')]();}var _0x4dfb78=[];var _0x594415=[];delete _0x4a8a5e['id'];delete _0x4a8a5e['createdAt'];delete _0x4a8a5e[_0x5af8('0x29')];var _0x1bfc77=_0x4a8a5e[_0x5af8('0x2a')]!==_0x5af8('0x2b')?[_0x4a8a5e[_0x5af8('0x2a')]]:_0x4a8a5e['IntervalId']?_[_0x5af8('0x9')](_[_0x5af8('0xb')](_0x5bbb7b['intervals'],{'IntervalId':_0x4a8a5e[_0x5af8('0x7')]}),_0x5af8('0x2a')):[];if(_0x4a8a5e[_0x5af8('0x10')](_0x5af8('0x2c'))){if(_0x4a8a5e[_0x5af8('0x2c')]&&_0x4a8a5e[_0x5af8('0x2c')]!=='--'){_0x4dfb78[_0x5af8('0x14')]({'type':_0x4a8a5e[_0x5af8('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x4a8a5e['tag'],'context':_0x4a8a5e[_0x5af8('0x18')],'exten':_0x4a8a5e[_0x5af8('0xd')],'priority':_0x1bfc77[_0x5af8('0x27')]+_0x5bbb7b[_0x5af8('0x11')]+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e[_0x5af8('0x19')]});}}if(_0x4a8a5e[_0x5af8('0x15')]==='outbound'&&_0x4a8a5e[_0x5af8('0x10')](_0x5af8('0x2d'))){if(_0x4a8a5e['callerID']){_0x4dfb78[_0x5af8('0x14')]({'type':_0x4a8a5e['type'],'app':_0x5af8('0x2e'),'appdata':_0x5af8('0x2f')+_0x4a8a5e[_0x5af8('0x2d')]+')','context':_0x4a8a5e[_0x5af8('0x18')],'exten':_0x4a8a5e[_0x5af8('0xd')],'priority':_0x1bfc77[_0x5af8('0x27')]+_0x5bbb7b[_0x5af8('0x11')]+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e[_0x5af8('0x19')]});}else{_0x4dfb78[_0x5af8('0x14')]({'type':_0x4a8a5e[_0x5af8('0x15')],'app':_0x5af8('0x2e'),'appdata':_0x5af8('0x30'),'context':_0x4a8a5e[_0x5af8('0x18')],'exten':_0x4a8a5e[_0x5af8('0xd')],'priority':_0x1bfc77['length']+_0x5bbb7b['priority']+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e[_0x5af8('0x19')]});}}if(_0x4a8a5e[_0x5af8('0x10')]('answer')){if(_0x32b2a5[_0x5af8('0x31')](_0x4a8a5e[_0x5af8('0x32')][_0x5af8('0x28')]())>=0x0&&_0x4a8a5e['appType']!==_0x5af8('0x33')){if(_0x4a8a5e[_0x5af8('0x34')]){_0x4dfb78['push']({'type':_0x4a8a5e[_0x5af8('0x15')],'app':_0x5af8('0x2e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4a8a5e[_0x5af8('0x18')],'exten':_0x4a8a5e[_0x5af8('0xd')],'priority':_0x1bfc77[_0x5af8('0x27')]+_0x5bbb7b[_0x5af8('0x11')]+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e[_0x5af8('0x19')]});_0x4dfb78[_0x5af8('0x14')]({'type':_0x4a8a5e[_0x5af8('0x15')],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x35'),'context':_0x4a8a5e['context'],'exten':_0x4a8a5e[_0x5af8('0xd')],'priority':_0x1bfc77[_0x5af8('0x27')]+_0x5bbb7b[_0x5af8('0x11')]+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e['VoiceExtensionId']});}else{_0x4dfb78['push']({'type':_0x4a8a5e[_0x5af8('0x15')],'app':_0x5af8('0x2e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4a8a5e[_0x5af8('0x18')],'exten':_0x4a8a5e['exten'],'priority':_0x1bfc77[_0x5af8('0x27')]+_0x5bbb7b[_0x5af8('0x11')]+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e[_0x5af8('0x19')]});_0x4dfb78[_0x5af8('0x14')]({'type':_0x4a8a5e['type'],'app':_0x5af8('0x16'),'appdata':_0x5af8('0x36'),'context':_0x4a8a5e[_0x5af8('0x18')],'exten':_0x4a8a5e['exten'],'priority':_0x1bfc77[_0x5af8('0x27')]+_0x5bbb7b[_0x5af8('0x11')]+_0x3b7443++,'VoiceExtensionId':_0x4a8a5e[_0x5af8('0x19')]});}}}for(var _0x2f8a54=0x0;_0x2f8a54<_0x1bfc77['length'];_0x2f8a54+=0x1){var _0x495eed=_0x5bbb7b[_0x5af8('0x11')]+_0x1bfc77[_0x5af8('0x27')];var _0x153c22=_0x2f8a54===_0x1bfc77[_0x5af8('0x27')]-0x1?_0x5bbb7b[_0x5af8('0x11')]+_0x4dfb78['length']+_0x594415[_0x5af8('0x27')]+0x2:_0x5bbb7b[_0x5af8('0x11')]+_0x2f8a54+0x1;_0x4dfb78['splice'](_0x2f8a54,0x0,{'type':_0x4a8a5e[_0x5af8('0x15')],'app':'GotoIfTime','appdata':_0x1bfc77[_0x2f8a54]+'?'+_0x4a8a5e[_0x5af8('0x18')]+_0x5af8('0x37')+_0x495eed+':'+_0x4a8a5e[_0x5af8('0x18')]+',${EXTEN},'+_0x153c22,'exten':_0x4a8a5e[_0x5af8('0xd')],'context':_0x4a8a5e[_0x5af8('0x18')],'priority':_0x5bbb7b[_0x5af8('0x11')]+_0x2f8a54,'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});}_0x4a8a5e[_0x5af8('0x11')]=_0x4dfb78[_0x5af8('0x27')]?_[_0x5af8('0x38')](_0x4dfb78)[_0x5af8('0x11')]+0x1:_0x5bbb7b['priority'];_0x5bbb7b[_0x5af8('0x11')]=(_0x594415[_0x5af8('0x27')]?_[_0x5af8('0x38')](_0x594415)[_0x5af8('0x11')]:_0x4a8a5e['priority'])+0x1;_0x5bbb7b[_0x5af8('0x13')]=_[_0x5af8('0x39')](_0x5bbb7b[_0x5af8('0x13')],_0x4dfb78,[_0x4a8a5e],_0x594415);}_0x5bbb7b[_0x5af8('0x13')][_0x5af8('0x14')]({'type':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x15')],'app':'Hangup','exten':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0xd')],'context':_0x2f1d57[_0x58b0ba][0x0]['context'],'priority':_0x5bbb7b[_0x5af8('0x11')],'VoiceExtensionId':_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]});_0x530a44['push'](_0x2f1d57[_0x58b0ba][0x0][_0x5af8('0x19')]);_0x10b4b6=_[_0x5af8('0x39')](_0x10b4b6,_0x5bbb7b[_0x5af8('0x13')]);}}return _0x2f96ba[_0x5af8('0x3a')](function(_0x1040ce){return _0x2f96ba[_0x5af8('0x5')][_0x5af8('0x6')][_0x5af8('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x530a44}},'transaction':_0x1040ce})[_0x5af8('0x4')](function(_0x15d6f3){return _0x2f96ba[_0x5af8('0x5')][_0x5af8('0x6')][_0x5af8('0x3c')](_[_0x5af8('0x3d')](_0x10b4b6,'priority'),{'transaction':_0x1040ce});});});})['catch'](function(_0x33bd81){console[_0x5af8('0x3e')](_0x33bd81);});}exports[_0x5af8('0x3f')]=rewrite; \ No newline at end of file +var _0x688a=['recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','length','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','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','error','lodash','util','models','Interval','findAll','VoiceExtension','IntervalId','then','filter','exten','queue','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x688a,0x12f));var _0xa688=function(_0x366b39,_0x88906b){_0x366b39=_0x366b39-0x0;var _0xff0a2e=_0x688a[_0x366b39];return _0xff0a2e;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));function rewrite(_0xacd6d8,_0x45f769){var _0x1ffa1f=this;return _0xacd6d8[_0xa688('0x2')][_0xa688('0x3')][_0xa688('0x4')]({'raw':!![]})['then'](function(_0x3dcfc9){_0x1ffa1f['intervals']=_0x3dcfc9;return _0xacd6d8['models'][_0xa688('0x5')]['findAll']({'where':{'IntervalId':_0x45f769[_0xa688('0x6')]},'raw':!![]});})[_0xa688('0x7')](function(_0x158680){return _0xacd6d8[_0xa688('0x2')][_0xa688('0x5')][_0xa688('0x4')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x158680,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x3955a3){var _0x881e5d=_[_0xa688('0x8')](_0x3955a3,{'priority':'1'});var _0x36a305=_[_0xa688('0x8')](_0x3955a3,{'isApp':0x1});var _0x189346=_['groupBy'](_0x36a305,_0xa688('0x9'));var _0x1f7edc=[_0xa688('0xa'),'playback'];var _0x5539b8=[];var _0x11d8b5=[];for(var _0x3de683 in _0x189346){if(_0x189346['hasOwnProperty'](_0x3de683)){_0x1ffa1f[_0xa688('0xb')]=0x2;_0x1ffa1f['extensions']=[];_0x1ffa1f[_0xa688('0xc')]=_[_0xa688('0xd')](_0x881e5d,{'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')]});_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':_0xa688('0x11'),'appdata':util[_0xa688('0x12')](_0xa688('0x13'),_0x189346[_0x3de683][0x0][_0xa688('0x10')]),'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});if(_0x189346[_0x3de683][0x0]['type']==='outbound'){if(_0x1ffa1f['extension']){_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':_0xa688('0x11'),'appdata':'CDR(destination)='+(_0x1ffa1f[_0xa688('0xc')]['cutdigits']?_0xa688('0x16')+_0x1ffa1f[_0xa688('0xc')]['cutdigits']+'}':_0xa688('0x17')),'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0]['exten'],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});}_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':'Set','appdata':_0xa688('0x18')+_0x189346[_0x3de683][0x0]['VoiceExtensionId'],'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});var _0x3bd584=_0x1ffa1f[_0xa688('0xb')]++;_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':_0xa688('0x19'),'appdata':_0xa688('0x1a')+(_0x3bd584+0x2)+_0xa688('0x1b')+(_0x3bd584+0x1)+')','context':_0x189346[_0x3de683][0x0]['context'],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x3bd584,'VoiceExtensionId':_0x189346[_0x3de683][0x0]['VoiceExtensionId']});if(_0x1ffa1f['extension']){_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':'Set','appdata':_0x1ffa1f['extension'][_0xa688('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x1ffa1f['extension'][_0xa688('0x1c')]+'}':_0xa688('0x1d'),'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0]['exten'],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});}_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':'Set','appdata':_0xa688('0x1e')+_0x189346[_0x3de683][0x0]['VoiceExtensionId'],'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0]['VoiceExtensionId']});if(_0x1ffa1f['extension']&&_0x1ffa1f['extension'][_0xa688('0x1f')](_0xa688('0x20'))&&_0x1ffa1f[_0xa688('0xc')][_0xa688('0x20')]!=='none'){_0x1ffa1f[_0xa688('0xe')]['push']({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':_0xa688('0x11'),'appdata':_0xa688('0x21'),'context':_0x189346[_0x3de683][0x0]['context'],'exten':_0x189346[_0x3de683][0x0]['exten'],'priority':_0x1ffa1f['priority']++,'VoiceExtensionId':_0x189346[_0x3de683][0x0]['VoiceExtensionId']});_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':_0xa688('0x11'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1ffa1f['extension'][_0xa688('0x20')]||_0xa688('0x22'),'context':_0x189346[_0x3de683][0x0]['context'],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});}}_0x1ffa1f[_0xa688('0xe')]['push']({'type':_0x189346[_0x3de683][0x0]['type'],'app':_0xa688('0x11'),'appdata':_0xa688('0x23'),'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0]['type'],'app':_0xa688('0x11'),'appdata':_0xa688('0x24'),'context':_0x189346[_0x3de683][0x0][_0xa688('0x14')],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f['priority']++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});_0x1ffa1f[_0xa688('0xe')][_0xa688('0xf')]({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':'Set','appdata':_0xa688('0x25'),'context':_0x189346[_0x3de683][0x0]['context'],'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'priority':_0x1ffa1f[_0xa688('0xb')]++,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});for(var _0x1a306e=0x0,_0x3b2750=0x0;_0x1a306e<_0x189346[_0x3de683]['length'];_0x1a306e+=0x1,_0x3b2750=0x0){var _0x5b7eef=_0x189346[_0x3de683][_0x1a306e];if(_0x5b7eef[_0xa688('0x10')]){_0x5b7eef['type']=_0x5b7eef[_0xa688('0x10')]['toLowerCase']();}var _0x45dc18=[];var _0x3fe6b2=[];delete _0x5b7eef['id'];delete _0x5b7eef[_0xa688('0x26')];delete _0x5b7eef[_0xa688('0x27')];var _0x2cf624=_0x5b7eef[_0xa688('0x28')]!==_0xa688('0x29')?[_0x5b7eef[_0xa688('0x28')]]:_0x5b7eef[_0xa688('0x6')]?_['map'](_[_0xa688('0x8')](_0x1ffa1f[_0xa688('0x2a')],{'IntervalId':_0x5b7eef[_0xa688('0x6')]}),_0xa688('0x28')):[];if(_0x5b7eef[_0xa688('0x1f')](_0xa688('0x2b'))){if(_0x5b7eef[_0xa688('0x2b')]&&_0x5b7eef[_0xa688('0x2b')]!=='--'){_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef[_0xa688('0x10')],'app':_0xa688('0x11'),'appdata':'CDR(tag)='+_0x5b7eef[_0xa688('0x2b')],'context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef['exten'],'priority':_0x2cf624[_0xa688('0x2c')]+_0x1ffa1f[_0xa688('0xb')]+_0x3b2750++,'VoiceExtensionId':_0x5b7eef['VoiceExtensionId']});}}if(_0x5b7eef[_0xa688('0x10')]==='outbound'&&_0x5b7eef[_0xa688('0x1f')](_0xa688('0x2d'))){if(_0x5b7eef['callerID']){_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef[_0xa688('0x10')],'app':'ExecIf','appdata':_0xa688('0x2e')+_0x5b7eef[_0xa688('0x2d')]+')','context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef[_0xa688('0x9')],'priority':_0x2cf624['length']+_0x1ffa1f[_0xa688('0xb')]+_0x3b2750++,'VoiceExtensionId':_0x5b7eef['VoiceExtensionId']});}else{_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef[_0xa688('0x10')],'app':_0xa688('0x19'),'appdata':_0xa688('0x2f'),'context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef['exten'],'priority':_0x2cf624[_0xa688('0x2c')]+_0x1ffa1f[_0xa688('0xb')]+_0x3b2750++,'VoiceExtensionId':_0x5b7eef[_0xa688('0x15')]});}}if(_0x5b7eef[_0xa688('0x1f')](_0xa688('0x30'))){if(_0x1f7edc[_0xa688('0x31')](_0x5b7eef[_0xa688('0x32')][_0xa688('0x33')]())>=0x0&&_0x5b7eef[_0xa688('0x34')]!==_0xa688('0x35')){if(_0x5b7eef[_0xa688('0x30')]){_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef[_0xa688('0x10')],'app':'ExecIf','appdata':_0xa688('0x36'),'context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef[_0xa688('0x9')],'priority':_0x2cf624[_0xa688('0x2c')]+_0x1ffa1f[_0xa688('0xb')]+_0x3b2750++,'VoiceExtensionId':_0x5b7eef[_0xa688('0x15')]});_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef[_0xa688('0x10')],'app':_0xa688('0x11'),'appdata':_0xa688('0x37'),'context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef[_0xa688('0x9')],'priority':_0x2cf624['length']+_0x1ffa1f['priority']+_0x3b2750++,'VoiceExtensionId':_0x5b7eef[_0xa688('0x15')]});}else{_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef[_0xa688('0x10')],'app':_0xa688('0x19'),'appdata':_0xa688('0x38'),'context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef[_0xa688('0x9')],'priority':_0x2cf624[_0xa688('0x2c')]+_0x1ffa1f[_0xa688('0xb')]+_0x3b2750++,'VoiceExtensionId':_0x5b7eef[_0xa688('0x15')]});_0x45dc18[_0xa688('0xf')]({'type':_0x5b7eef['type'],'app':_0xa688('0x11'),'appdata':_0xa688('0x39'),'context':_0x5b7eef[_0xa688('0x14')],'exten':_0x5b7eef[_0xa688('0x9')],'priority':_0x2cf624[_0xa688('0x2c')]+_0x1ffa1f[_0xa688('0xb')]+_0x3b2750++,'VoiceExtensionId':_0x5b7eef[_0xa688('0x15')]});}}}for(var _0xba3ba9=0x0;_0xba3ba9<_0x2cf624['length'];_0xba3ba9+=0x1){var _0x54ea3f=_0x1ffa1f[_0xa688('0xb')]+_0x2cf624[_0xa688('0x2c')];var _0x1d303c=_0xba3ba9===_0x2cf624[_0xa688('0x2c')]-0x1?_0x1ffa1f['priority']+_0x45dc18['length']+_0x3fe6b2['length']+0x2:_0x1ffa1f[_0xa688('0xb')]+_0xba3ba9+0x1;_0x45dc18[_0xa688('0x3a')](_0xba3ba9,0x0,{'type':_0x5b7eef[_0xa688('0x10')],'app':_0xa688('0x3b'),'appdata':_0x2cf624[_0xba3ba9]+'?'+_0x5b7eef['context']+_0xa688('0x3c')+_0x54ea3f+':'+_0x5b7eef[_0xa688('0x14')]+_0xa688('0x3c')+_0x1d303c,'exten':_0x5b7eef[_0xa688('0x9')],'context':_0x5b7eef[_0xa688('0x14')],'priority':_0x1ffa1f[_0xa688('0xb')]+_0xba3ba9,'VoiceExtensionId':_0x189346[_0x3de683][0x0][_0xa688('0x15')]});}_0x5b7eef['priority']=_0x45dc18[_0xa688('0x2c')]?_[_0xa688('0x3d')](_0x45dc18)[_0xa688('0xb')]+0x1:_0x1ffa1f[_0xa688('0xb')];_0x1ffa1f[_0xa688('0xb')]=(_0x3fe6b2[_0xa688('0x2c')]?_[_0xa688('0x3d')](_0x3fe6b2)[_0xa688('0xb')]:_0x5b7eef[_0xa688('0xb')])+0x1;_0x1ffa1f[_0xa688('0xe')]=_[_0xa688('0x3e')](_0x1ffa1f['extensions'],_0x45dc18,[_0x5b7eef],_0x3fe6b2);}_0x1ffa1f[_0xa688('0xe')]['push']({'type':_0x189346[_0x3de683][0x0][_0xa688('0x10')],'app':_0xa688('0x3f'),'exten':_0x189346[_0x3de683][0x0][_0xa688('0x9')],'context':_0x189346[_0x3de683][0x0]['context'],'priority':_0x1ffa1f[_0xa688('0xb')],'VoiceExtensionId':_0x189346[_0x3de683][0x0]['VoiceExtensionId']});_0x5539b8[_0xa688('0xf')](_0x189346[_0x3de683][0x0][_0xa688('0x15')]);_0x11d8b5=_[_0xa688('0x3e')](_0x11d8b5,_0x1ffa1f[_0xa688('0xe')]);}}return _0xacd6d8[_0xa688('0x40')](function(_0x42ed2f){return _0xacd6d8[_0xa688('0x2')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x5539b8}},'transaction':_0x42ed2f})[_0xa688('0x7')](function(_0x41c18a){return _0xacd6d8[_0xa688('0x2')][_0xa688('0x5')][_0xa688('0x41')](_['sortBy'](_0x11d8b5,_0xa688('0xb')),{'transaction':_0x42ed2f});});});})['catch'](function(_0x17b05b){console[_0xa688('0x42')](_0x17b05b);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7a65ce8..b1dd7c1 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 _0x2f31=['duplicate','Duplicate\x20Contact','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','phone','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','into','cm_contacts','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','cm_hopper_black','outbound','Lists','dialCheckDuplicateType','always','push','onlyIfOpen','sequelize','VoiceQueueId','query','all','findAll','BlackLists','get','CmList','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find'];(function(_0x48bd27,_0x10b71d){var _0x1f4318=function(_0x4f7a4b){while(--_0x4f7a4b){_0x48bd27['push'](_0x48bd27['shift']());}};_0x1f4318(++_0x10b71d);}(_0x2f31,0x11c));var _0x12f3=function(_0x3f68af,_0x32f1a9){_0x3f68af=_0x3f68af-0x0;var _0x4b3c99=_0x2f31[_0x3f68af];return _0x4b3c99;};'use strict';var BPromise=require(_0x12f3('0x0'));var util=require(_0x12f3('0x1'));var _=require(_0x12f3('0x2'));var fs=require('fs');var squel=require(_0x12f3('0x3'));var Papa=require('papaparse');var Redis=require(_0x12f3('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x12f3('0x5'));var logger=require(_0x12f3('0x6'))('api');config['redis']=_[_0x12f3('0x7')](config[_0x12f3('0x8')],{'host':_0x12f3('0x9'),'port':0x18eb});var socket=require(_0x12f3('0xa'))(new Redis(config[_0x12f3('0x8')]));require(_0x12f3('0xb'))['register'](socket);try{if(!process[_0x12f3('0xc')][0x2]||process['argv'][0x2]===_0x12f3('0xd')||process[_0x12f3('0xc')][0x2]===_0x12f3('0xe')){throw new Error(_0x12f3('0xf'));}var FILEPATH=process[_0x12f3('0xc')][0x2];if(!process[_0x12f3('0xc')][0x3]||process[_0x12f3('0xc')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process[_0x12f3('0xc')][0x4]||process[_0x12f3('0xc')][0x4]===_0x12f3('0xd')||process['argv'][0x4]===_0x12f3('0xe')){throw new Error(_0x12f3('0x10'));}var FIELDS=_[_0x12f3('0x11')](process[_0x12f3('0xc')][0x3][_0x12f3('0x12')](','),process['argv'][0x4]['split'](','));if(!process[_0x12f3('0xc')][0x5]||process['argv'][0x5]===_0x12f3('0xd')||process[_0x12f3('0xc')][0x5]===_0x12f3('0xe')){throw new Error(_0x12f3('0x13'));}var LISTID=process[_0x12f3('0xc')][0x5];var COMPANYID=process[_0x12f3('0xc')][0x6]&&process[_0x12f3('0xc')][0x6]!==_0x12f3('0xd')&&process[_0x12f3('0xc')][0x6]!==_0x12f3('0xe')?process[_0x12f3('0xc')][0x6]:null;var DUPLICATES=process[_0x12f3('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x12f3('0xc')][0x7]!==_0x12f3('0xe')?process[_0x12f3('0xc')][0x7]:null;if(!process[_0x12f3('0xc')][0x8]||process[_0x12f3('0xc')][0x8]===_0x12f3('0xd')||process[_0x12f3('0xc')][0x8]===_0x12f3('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x18f0ce){logger['error'](_0x18f0ce);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(_0x171990,_0x4c33aa,_0xb63573,_0x5c660d){var _0xe257bb={'message':_0x4c33aa};_0xe257bb[_0x171990]=!![];if(_0xb63573){_0xe257bb[_0x12f3('0x14')]=_0xb63573;}if(_0x5c660d){_0xe257bb[_0x12f3('0x15')]=_0x5c660d;}return _0xe257bb;}function isEmail(_0x53e06e){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))*$/[_0x12f3('0x16')](_0x53e06e);}function checkRow(_0x8b7f05,_0x543e6b,_0x585a39){return new BPromise(function(_0x19763e,_0x127764){if(_[_0x12f3('0x17')](_0x8b7f05)){return _0x127764(handleCheckRowError(_0x12f3('0x18'),_0x12f3('0x19'),null,_0x585a39));}if(_0x8b7f05[_0x12f3('0x1a')]&&_0x8b7f05['errors']['length']){var _0x6c237d=_[_0x12f3('0x1b')](_0x8b7f05[_0x12f3('0x1a')],_0x12f3('0x1c'))[_0x12f3('0x1d')](';');return _0x127764(handleCheckRowError(_0x12f3('0x18'),_0x6c237d,null,_0x585a39));}var _0x264b62={};for(var _0x2021ac in FIELDS){if(FIELDS[_0x12f3('0x1e')](_0x2021ac)&&FIELDS[_0x2021ac]){_0x264b62[_0x2021ac]=_0x8b7f05['data'][0x0][FIELDS[_0x2021ac]]||_0x8b7f05[_0x12f3('0x1f')][0x0]['\ufeff'+FIELDS[_0x2021ac]];}}if(!_0x264b62[_0x12f3('0x20')]){return _0x127764(handleCheckRowError(_0x12f3('0x18'),_0x12f3('0x21'),null,_0x585a39));}if(!_0x264b62['phone']){return _0x127764(handleCheckRowError('error',_0x12f3('0x22'),null,_0x585a39));}if(_0x264b62['birthDate']){var _0x19bf28=moment(_0x264b62[_0x12f3('0x23')],_0x12f3('0x24'));if(!_0x19bf28[_0x12f3('0x25')]()){return _0x127764(handleCheckRowError(_0x12f3('0x18'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x585a39));}}if(_0x264b62[_0x12f3('0x26')]){if(!isEmail(_0x264b62[_0x12f3('0x26')])){return _0x127764(handleCheckRowError(_0x12f3('0x18'),_0x12f3('0x27'),null,_0x585a39));}}_0x264b62[_0x12f3('0x28')]=LISTID;_0x264b62['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x12f3('0x29')]&&_0x543e6b){var _0x5cf93a={};for(var _0x270c86=0x0,_0x471b9d=DUPLICATES[_0x12f3('0x29')];_0x270c86<_0x471b9d;_0x270c86+=0x1){_0x5cf93a[DUPLICATES[_0x270c86]]=_0x264b62[DUPLICATES[_0x270c86]];}var _0x169736=_[_0x12f3('0x2a')](_0x543e6b,_0x5cf93a);if(_0x169736){return _0x127764(handleCheckRowError(_0x12f3('0x2b'),_0x12f3('0x2c'),_0x169736,_0x585a39));}}return db['CmContact']['create'](_0x264b62,{'raw':!![],'hooks':![],'fields':_['keys'](_0x264b62)})[_0x12f3('0x2d')](function(_0x25de95){if(DUPLICATES&&DUPLICATES[_0x12f3('0x29')]&&_0x543e6b){_0x543e6b['push'](_[_0x12f3('0x2e')](_0x264b62,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x25de95['id'];return _0x19763e();})[_0x12f3('0x2f')](function(_0x2b9b3d){return _0x127764(handleCheckRowError('error',_0x12f3('0x30')+(_0x2b9b3d['message']||JSON[_0x12f3('0x31')](_0x2b9b3d)),null,_0x585a39));});});}function checkHopper(){function _0x4c8f5b(){return function(_0x505b74){logger[_0x12f3('0x18')]('cmContact',_0x12f3('0x32'),util[_0x12f3('0x33')](_0x505b74,{'showHidden':![],'depth':null}));};}var _0x2a6976=function(_0x1a4d4a,_0x48e0bf){var _0x45669a=squel[_0x12f3('0x34')]()['into']('cm_hopper')[_0x12f3('0x35')](['phone',_0x12f3('0x36'),_0x12f3('0x37'),'ListId',_0x48e0bf,_0x12f3('0x38'),_0x12f3('0x39')],squel[_0x12f3('0x3a')]()[_0x12f3('0x3b')](_0x12f3('0x3c'),_0x12f3('0x3c'))[_0x12f3('0x3b')](_0x12f3('0x3d'),_0x12f3('0x36'))[_0x12f3('0x3b')]('id',_0x12f3('0x37'))[_0x12f3('0x3b')](LISTID[_0x12f3('0x3e')](),_0x12f3('0x28'))[_0x12f3('0x3b')](_0x1a4d4a['id'][_0x12f3('0x3e')](),_0x48e0bf)[_0x12f3('0x3b')](_0x12f3('0x3d'),'createdAt')[_0x12f3('0x3b')]('NOW()',_0x12f3('0x39'))[_0x12f3('0x3f')]('cm_contacts')[_0x12f3('0x40')](_0x12f3('0x41'))[_0x12f3('0x40')](_0x12f3('0x42'),LISTID[_0x12f3('0x3e')]())[_0x12f3('0x40')](_0x12f3('0x43'))[_0x12f3('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x12f3('0x3a')]()[_0x12f3('0x3b')](_0x12f3('0x3c'))['from']('cm_hopper')['where'](_0x48e0bf+'\x20=\x20?',_0x1a4d4a['id']['toString']())))[_0x12f3('0x3e')]();return _0x45669a;};var _0x4a6aa2=function(_0x18ea0a,_0x40088a){var _0x4b3acc=squel['insert']()[_0x12f3('0x44')]('cm_hopper')[_0x12f3('0x35')](['phone',_0x12f3('0x36'),'ContactId',_0x12f3('0x28'),_0x40088a,_0x12f3('0x38'),'updatedAt'],squel['select']()[_0x12f3('0x3b')](_0x12f3('0x3c'),_0x12f3('0x3c'))[_0x12f3('0x3b')](_0x12f3('0x3d'),'scheduledAt')['field']('id',_0x12f3('0x37'))[_0x12f3('0x3b')](LISTID[_0x12f3('0x3e')](),_0x12f3('0x28'))['field'](_0x18ea0a['id'][_0x12f3('0x3e')](),_0x40088a)['field'](_0x12f3('0x3d'),_0x12f3('0x38'))[_0x12f3('0x3b')](_0x12f3('0x3d'),_0x12f3('0x39'))[_0x12f3('0x3f')](_0x12f3('0x45'))[_0x12f3('0x40')](_0x12f3('0x41'))['where'](_0x12f3('0x42'),LISTID[_0x12f3('0x3e')]())['where'](_0x12f3('0x46'),squel[_0x12f3('0x47')](hopperContacts))[_0x12f3('0x40')](_0x12f3('0x43'))[_0x12f3('0x40')](_0x12f3('0x48'),squel['select']()[_0x12f3('0x3b')]('calleridnum')[_0x12f3('0x3f')]('cm_hopper_final')[_0x12f3('0x40')](_0x40088a+'\x20=\x20?',_0x18ea0a['id'][_0x12f3('0x3e')]()))[_0x12f3('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x12f3('0x3a')]()[_0x12f3('0x3b')](_0x12f3('0x3c'))[_0x12f3('0x3f')](_0x12f3('0x49'))[_0x12f3('0x40')](_0x40088a+_0x12f3('0x4a'),_0x18ea0a['id']['toString']())))[_0x12f3('0x3e')]();return _0x4b3acc;};function _0x23c115(_0x4fadd3,_0x146078){var _0x106a54=squel[_0x12f3('0x34')]()[_0x12f3('0x44')]('cm_hopper')['fromQuery'](['phone',_0x12f3('0x36'),_0x12f3('0x37'),_0x12f3('0x28'),_0x146078,'createdAt','updatedAt'],squel[_0x12f3('0x3a')]()[_0x12f3('0x3b')](_0x12f3('0x3c'),_0x12f3('0x3c'))[_0x12f3('0x3b')](_0x12f3('0x3d'),'scheduledAt')[_0x12f3('0x3b')]('id',_0x12f3('0x37'))[_0x12f3('0x3b')](LISTID[_0x12f3('0x3e')](),_0x12f3('0x28'))[_0x12f3('0x3b')](_0x4fadd3['id']['toString'](),_0x146078)[_0x12f3('0x3b')]('NOW()',_0x12f3('0x38'))[_0x12f3('0x3b')]('NOW()',_0x12f3('0x39'))[_0x12f3('0x3f')]('cm_contacts')[_0x12f3('0x40')]('deletedAt\x20IS\x20NULL')[_0x12f3('0x40')](_0x12f3('0x42'),LISTID[_0x12f3('0x3e')]())[_0x12f3('0x40')](_0x12f3('0x46'),squel[_0x12f3('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x106a54;}function _0x2b916b(_0x58b05d,_0x41a1cc){var _0x37a42a=squel[_0x12f3('0x34')]()['into'](_0x12f3('0x4b'))[_0x12f3('0x35')](['phone',_0x12f3('0x37'),'ListId',_0x41a1cc,_0x12f3('0x38'),_0x12f3('0x39')],squel[_0x12f3('0x3a')]()[_0x12f3('0x3b')](_0x12f3('0x3c'),_0x12f3('0x3c'))[_0x12f3('0x3b')]('id',_0x12f3('0x37'))[_0x12f3('0x3b')](LISTID[_0x12f3('0x3e')](),_0x12f3('0x28'))[_0x12f3('0x3b')](_0x58b05d['id'][_0x12f3('0x3e')](),_0x41a1cc)[_0x12f3('0x3b')](_0x12f3('0x3d'),'createdAt')[_0x12f3('0x3b')](_0x12f3('0x3d'),_0x12f3('0x39'))[_0x12f3('0x3f')](_0x12f3('0x45'))['where']('deletedAt\x20IS\x20NULL')[_0x12f3('0x40')](_0x12f3('0x42'),LISTID[_0x12f3('0x3e')]())[_0x12f3('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x12f3('0x43')))[_0x12f3('0x3e')]();return _0x37a42a;}return db['VoiceQueue']['findAll']({'where':{'type':_0x12f3('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x12f3('0x4d'),'where':{'id':LISTID}}]})[_0x12f3('0x2d')](function(_0x1350cc){var _0x308e8a=[];if(_0x1350cc){var _0x21c446;for(var _0x372a99=0x0,_0x43fcaf;_0x372a99<_0x1350cc[_0x12f3('0x29')];_0x372a99+=0x1){_0x43fcaf=_0x1350cc[_0x372a99]['get']({'plain':!![]});switch(_0x43fcaf[_0x12f3('0x4e')]){case _0x12f3('0x4f'):_0x308e8a[_0x12f3('0x50')](db['sequelize']['query'](_0x4a6aa2(_0x43fcaf,'VoiceQueueId'))['then'](function(){})['catch'](_0x4c8f5b()));break;case _0x12f3('0x51'):_0x308e8a['push'](db[_0x12f3('0x52')]['query'](_0x2a6976(_0x43fcaf,_0x12f3('0x53')))[_0x12f3('0x2d')](function(){})['catch'](_0x4c8f5b()));break;default:_0x308e8a[_0x12f3('0x50')](db[_0x12f3('0x52')][_0x12f3('0x54')](_0x23c115(_0x43fcaf,'VoiceQueueId'))[_0x12f3('0x2d')](function(){})[_0x12f3('0x2f')](_0x4c8f5b()));}}}return _0x308e8a;})[_0x12f3('0x55')]()[_0x12f3('0x2d')](function(){return db['VoiceQueue'][_0x12f3('0x56')]({'where':{'type':_0x12f3('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x12f3('0x57'),'where':{'id':LISTID}}]})[_0x12f3('0x2d')](function(_0x44fa42){var _0x3f852d=[];if(_0x44fa42){var _0x504535;for(var _0x14ae75=0x0,_0x49cbb7;_0x14ae75<_0x44fa42[_0x12f3('0x29')];_0x14ae75+=0x1){_0x49cbb7=_0x44fa42[_0x14ae75][_0x12f3('0x58')]({'plain':!![]});_0x3f852d[_0x12f3('0x50')](db[_0x12f3('0x52')]['query'](_0x2b916b(_0x49cbb7,'VoiceQueueId'))['then'](function(){})[_0x12f3('0x2f')](_0x4c8f5b()));}}return _0x3f852d;})[_0x12f3('0x55')]();})[_0x12f3('0x2d')](function(){return db['Campaign'][_0x12f3('0x56')]({'attributes':['id',_0x12f3('0x4e')],'include':[{'model':db[_0x12f3('0x59')],'as':_0x12f3('0x4d'),'where':{'id':LISTID}}]})[_0x12f3('0x2d')](function(_0x5ed1c4){var _0x4b505f=[];if(_0x5ed1c4){for(var _0x443f63=0x0,_0x5814cb;_0x443f63<_0x5ed1c4[_0x12f3('0x29')];_0x443f63+=0x1){_0x5814cb=_0x5ed1c4[_0x443f63][_0x12f3('0x58')]({'plain':!![]});switch(_0x5814cb[_0x12f3('0x4e')]){case'always':_0x4b505f['push'](db[_0x12f3('0x52')][_0x12f3('0x54')](_0x4a6aa2(_0x5814cb,_0x12f3('0x5a')))[_0x12f3('0x2d')](function(){})[_0x12f3('0x2f')](_0x4c8f5b()));break;case _0x12f3('0x51'):_0x4b505f[_0x12f3('0x50')](db[_0x12f3('0x52')][_0x12f3('0x54')](_0x2a6976(_0x5814cb,_0x12f3('0x5a')))[_0x12f3('0x2d')](function(){})[_0x12f3('0x2f')](_0x4c8f5b()));break;default:_0x4b505f[_0x12f3('0x50')](db[_0x12f3('0x52')][_0x12f3('0x54')](_0x23c115(_0x5814cb,_0x12f3('0x5a')))[_0x12f3('0x2d')](function(){})[_0x12f3('0x2f')](_0x4c8f5b()));}}}return _0x4b505f;})[_0x12f3('0x55')]();})[_0x12f3('0x2d')](function(){return db[_0x12f3('0x5b')][_0x12f3('0x56')]({'attributes':['id'],'include':[{'model':db[_0x12f3('0x59')],'as':_0x12f3('0x57'),'where':{'id':LISTID}}]})[_0x12f3('0x2d')](function(_0x3690cf){var _0x2cf78e=[];if(_0x3690cf){for(var _0x8a0290=0x0,_0x17de17;_0x8a0290<_0x3690cf[_0x12f3('0x29')];_0x8a0290+=0x1){_0x17de17=_0x3690cf[_0x8a0290][_0x12f3('0x58')]({'plain':!![]});_0x2cf78e[_0x12f3('0x50')](db[_0x12f3('0x52')]['query'](_0x2b916b(_0x17de17,_0x12f3('0x5a')))[_0x12f3('0x2d')](function(){})[_0x12f3('0x2f')](_0x4c8f5b()));}}return _0x2cf78e;})['all']();})[_0x12f3('0x2f')](function(_0x1a0317){logger[_0x12f3('0x18')](_0x12f3('0x5c'),_0x12f3('0x5d'),_0x1a0317[_0x12f3('0x1c')]);});}var processPromises=function(_0x430b99){return BPromise[_0x12f3('0x55')](promises)[_0x12f3('0x2d')](function(_0x2cbd50){})[_0x12f3('0x2f')](function(_0x43a212){logger[_0x12f3('0x18')](_0x12f3('0x5e'),JSON[_0x12f3('0x31')](_0x43a212));})[_0x12f3('0x5f')](function(){socket[_0x12f3('0x60')](_0x12f3('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x430b99){return _0x430b99[_0x12f3('0x62')]();}});};var endCsv=function(){return BPromise[_0x12f3('0x63')]()[_0x12f3('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x12f3('0x60')](_0x12f3('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x12f3('0x64')](FILEPATH);}catch(_0xb47e69){logger[_0x12f3('0x18')](_0x12f3('0x65'),JSON[_0x12f3('0x31')](_0xb47e69));}finally{process[_0x12f3('0x66')](0x0);}});};process['on']('SIGINT',function(){logger[_0x12f3('0x67')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x12f3('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x12f3('0x12')](',');return db['CmContact'][_0x12f3('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x30b5e9){var _0x5ee423=fs[_0x12f3('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x12f3('0x69')](_0x5ee423,{'header':!![],'skipEmptyLines':!![],'step':function(_0x36d928,_0x1168ab){total+=0x1;var _0x2c29ae=total;promises['push'](checkRow(_0x36d928,_0x30b5e9,_0x2c29ae)[_0x12f3('0x2d')](function(){success+=0x1;})['catch'](function(_0x42ac71){if(_0x42ac71[_0x12f3('0x18')]){errors+=0x1;delete _0x42ac71[_0x12f3('0x18')];}else if(_0x42ac71[_0x12f3('0x2b')]){duplicates+=0x1;delete _0x42ac71[_0x12f3('0x2b')];}rows[_0x12f3('0x50')](_0x42ac71);}));if(total%0xc8===0x0){_0x1168ab[_0x12f3('0x6a')]();return processPromises(_0x1168ab);}},'complete':function(){return processPromises()[_0x12f3('0x2d')](function(){logger[_0x12f3('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2a2465,_0xea22fa){logger[_0x12f3('0x67')](_0x12f3('0x6b'),JSON[_0x12f3('0x31')](_0x2a2465));endCsv();}});})[_0x12f3('0x2f')](function(_0x247af0){logger[_0x12f3('0x18')](_0x12f3('0x6c'),JSON[_0x12f3('0x31')](_0x247af0));});}main(); \ No newline at end of file +var _0x6aae=['from','cm_contacts','where','select','\x20=\x20?','deletedAt\x20IS\x20NULL','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','query','onlyIfOpen','sequelize','all','BlackLists','VoiceQueueId','Campaign','Lists','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','squel','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','CompanyId','find','Duplicate\x20Contact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','NOW()','field','toString','updatedAt'];(function(_0x3021b9,_0xdb387c){var _0xd6a1c2=function(_0x2001e5){while(--_0x2001e5){_0x3021b9['push'](_0x3021b9['shift']());}};_0xd6a1c2(++_0xdb387c);}(_0x6aae,0xa0));var _0xe6aa=function(_0x1e4817,_0x4672c9){_0x1e4817=_0x1e4817-0x0;var _0x5a4650=_0x6aae[_0x1e4817];return _0x5a4650;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0xe6aa('0x0'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xe6aa('0x1'));var logger=require(_0xe6aa('0x2'))(_0xe6aa('0x3'));config[_0xe6aa('0x4')]=_[_0xe6aa('0x5')](config[_0xe6aa('0x4')],{'host':_0xe6aa('0x6'),'port':0x18eb});var socket=require(_0xe6aa('0x7'))(new Redis(config[_0xe6aa('0x4')]));require(_0xe6aa('0x8'))[_0xe6aa('0x9')](socket);try{if(!process[_0xe6aa('0xa')][0x2]||process['argv'][0x2]===_0xe6aa('0xb')||process[_0xe6aa('0xa')][0x2]==='null'){throw new Error(_0xe6aa('0xc'));}var FILEPATH=process[_0xe6aa('0xa')][0x2];if(!process['argv'][0x3]||process[_0xe6aa('0xa')][0x3]===_0xe6aa('0xb')||process[_0xe6aa('0xa')][0x3]===_0xe6aa('0xd')||!process[_0xe6aa('0xa')][0x4]||process[_0xe6aa('0xa')][0x4]===_0xe6aa('0xb')||process[_0xe6aa('0xa')][0x4]===_0xe6aa('0xd')){throw new Error(_0xe6aa('0xe'));}var FIELDS=_[_0xe6aa('0xf')](process[_0xe6aa('0xa')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0xe6aa('0xa')][0x5]||process[_0xe6aa('0xa')][0x5]===_0xe6aa('0xb')||process[_0xe6aa('0xa')][0x5]===_0xe6aa('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xe6aa('0xa')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xe6aa('0xa')][0x6]!==_0xe6aa('0xb')&&process['argv'][0x6]!=='null'?process[_0xe6aa('0xa')][0x6]:null;var DUPLICATES=process[_0xe6aa('0xa')][0x7]&&process[_0xe6aa('0xa')][0x7]!==_0xe6aa('0xb')&&process[_0xe6aa('0xa')][0x7]!==_0xe6aa('0xd')?process[_0xe6aa('0xa')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0xe6aa('0xa')][0x8]===_0xe6aa('0xd')){throw new Error(_0xe6aa('0x10'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x5c4438){logger['error'](_0x5c4438);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(_0x273401,_0x58d9fe,_0x4158eb,_0x57017c){var _0x116a5f={'message':_0x58d9fe};_0x116a5f[_0x273401]=!![];if(_0x4158eb){_0x116a5f[_0xe6aa('0x11')]=_0x4158eb;}if(_0x57017c){_0x116a5f[_0xe6aa('0x12')]=_0x57017c;}return _0x116a5f;}function isEmail(_0x2532b6){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))*$/[_0xe6aa('0x13')](_0x2532b6);}function checkRow(_0x3000e5,_0x1bb578,_0x4af73c){return new BPromise(function(_0x9d0dbb,_0xd2945e){if(_[_0xe6aa('0x14')](_0x3000e5)){return _0xd2945e(handleCheckRowError(_0xe6aa('0x15'),_0xe6aa('0x16'),null,_0x4af73c));}if(_0x3000e5['errors']&&_0x3000e5[_0xe6aa('0x17')][_0xe6aa('0x18')]){var _0x183091=_[_0xe6aa('0x19')](_0x3000e5[_0xe6aa('0x17')],_0xe6aa('0x1a'))[_0xe6aa('0x1b')](';');return _0xd2945e(handleCheckRowError(_0xe6aa('0x15'),_0x183091,null,_0x4af73c));}var _0x38f970={};for(var _0x1205cb in FIELDS){if(FIELDS[_0xe6aa('0x1c')](_0x1205cb)&&FIELDS[_0x1205cb]){_0x38f970[_0x1205cb]=_0x3000e5['data'][0x0][FIELDS[_0x1205cb]]||_0x3000e5['data'][0x0]['\ufeff'+FIELDS[_0x1205cb]];}}if(!_0x38f970[_0xe6aa('0x1d')]){return _0xd2945e(handleCheckRowError(_0xe6aa('0x15'),_0xe6aa('0x1e'),null,_0x4af73c));}if(!_0x38f970[_0xe6aa('0x1f')]){return _0xd2945e(handleCheckRowError('error',_0xe6aa('0x20'),null,_0x4af73c));}if(_0x38f970[_0xe6aa('0x21')]){var _0x448d9c=moment(_0x38f970[_0xe6aa('0x21')],_0xe6aa('0x22'));if(!_0x448d9c[_0xe6aa('0x23')]()){return _0xd2945e(handleCheckRowError(_0xe6aa('0x15'),_0xe6aa('0x24'),null,_0x4af73c));}}if(_0x38f970['email']){if(!isEmail(_0x38f970['email'])){return _0xd2945e(handleCheckRowError(_0xe6aa('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x4af73c));}}_0x38f970['ListId']=LISTID;_0x38f970[_0xe6aa('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe6aa('0x18')]&&_0x1bb578){var _0x3efbce={};for(var _0x3e3ec5=0x0,_0x8fab54=DUPLICATES[_0xe6aa('0x18')];_0x3e3ec5<_0x8fab54;_0x3e3ec5+=0x1){_0x3efbce[DUPLICATES[_0x3e3ec5]]=_0x38f970[DUPLICATES[_0x3e3ec5]];}var _0x101acd=_[_0xe6aa('0x26')](_0x1bb578,_0x3efbce);if(_0x101acd){return _0xd2945e(handleCheckRowError('duplicate',_0xe6aa('0x27'),_0x101acd,_0x4af73c));}}return db['CmContact'][_0xe6aa('0x28')](_0x38f970,{'raw':!![],'hooks':![],'fields':_['keys'](_0x38f970)})[_0xe6aa('0x29')](function(_0x5c12c2){if(DUPLICATES&&DUPLICATES[_0xe6aa('0x18')]&&_0x1bb578){_0x1bb578[_0xe6aa('0x2a')](_[_0xe6aa('0x2b')](_0x38f970,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5c12c2['id'];return _0x9d0dbb();})[_0xe6aa('0x2c')](function(_0x495dec){return _0xd2945e(handleCheckRowError(_0xe6aa('0x15'),_0xe6aa('0x2d')+(_0x495dec[_0xe6aa('0x1a')]||JSON['stringify'](_0x495dec)),null,_0x4af73c));});});}function checkHopper(){function _0x2473e5(){return function(_0x490f40){logger[_0xe6aa('0x15')]('cmContact',_0xe6aa('0x2e'),util[_0xe6aa('0x2f')](_0x490f40,{'showHidden':![],'depth':null}));};}var _0x5b47d2=function(_0x51f621,_0x371a6e){var _0x6acc0f=squel[_0xe6aa('0x30')]()[_0xe6aa('0x31')](_0xe6aa('0x32'))[_0xe6aa('0x33')]([_0xe6aa('0x1f'),_0xe6aa('0x34'),_0xe6aa('0x35'),_0xe6aa('0x36'),_0x371a6e,_0xe6aa('0x37'),'updatedAt'],squel['select']()['field'](_0xe6aa('0x1f'),_0xe6aa('0x1f'))['field'](_0xe6aa('0x38'),_0xe6aa('0x34'))[_0xe6aa('0x39')]('id','ContactId')['field'](LISTID['toString'](),_0xe6aa('0x36'))[_0xe6aa('0x39')](_0x51f621['id'][_0xe6aa('0x3a')](),_0x371a6e)[_0xe6aa('0x39')](_0xe6aa('0x38'),'createdAt')[_0xe6aa('0x39')](_0xe6aa('0x38'),_0xe6aa('0x3b'))[_0xe6aa('0x3c')](_0xe6aa('0x3d'))['where']('deletedAt\x20IS\x20NULL')[_0xe6aa('0x3e')]('ListId\x20=\x20?',LISTID[_0xe6aa('0x3a')]())[_0xe6aa('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xe6aa('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe6aa('0x3f')]()[_0xe6aa('0x39')](_0xe6aa('0x1f'))[_0xe6aa('0x3c')](_0xe6aa('0x32'))[_0xe6aa('0x3e')](_0x371a6e+_0xe6aa('0x40'),_0x51f621['id'][_0xe6aa('0x3a')]())))[_0xe6aa('0x3a')]();return _0x6acc0f;};var _0x2bae2d=function(_0xc45135,_0x4cc4d7){var _0x2dc0f9=squel[_0xe6aa('0x30')]()[_0xe6aa('0x31')](_0xe6aa('0x32'))['fromQuery']([_0xe6aa('0x1f'),_0xe6aa('0x34'),_0xe6aa('0x35'),'ListId',_0x4cc4d7,_0xe6aa('0x37'),'updatedAt'],squel['select']()[_0xe6aa('0x39')](_0xe6aa('0x1f'),'phone')[_0xe6aa('0x39')](_0xe6aa('0x38'),'scheduledAt')['field']('id',_0xe6aa('0x35'))[_0xe6aa('0x39')](LISTID['toString'](),_0xe6aa('0x36'))[_0xe6aa('0x39')](_0xc45135['id'][_0xe6aa('0x3a')](),_0x4cc4d7)[_0xe6aa('0x39')]('NOW()',_0xe6aa('0x37'))[_0xe6aa('0x39')](_0xe6aa('0x38'),'updatedAt')[_0xe6aa('0x3c')](_0xe6aa('0x3d'))[_0xe6aa('0x3e')](_0xe6aa('0x41'))[_0xe6aa('0x3e')]('ListId\x20=\x20?',LISTID[_0xe6aa('0x3a')]())[_0xe6aa('0x3e')]('id\x20IN\x20?',squel[_0xe6aa('0x42')](hopperContacts))['where'](_0xe6aa('0x43'))[_0xe6aa('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('calleridnum')[_0xe6aa('0x3c')]('cm_hopper_final')[_0xe6aa('0x3e')](_0x4cc4d7+_0xe6aa('0x40'),_0xc45135['id'][_0xe6aa('0x3a')]()))[_0xe6aa('0x3e')](_0xe6aa('0x44'),squel[_0xe6aa('0x3f')]()[_0xe6aa('0x39')]('phone')[_0xe6aa('0x3c')](_0xe6aa('0x32'))[_0xe6aa('0x3e')](_0x4cc4d7+_0xe6aa('0x40'),_0xc45135['id'][_0xe6aa('0x3a')]())))[_0xe6aa('0x3a')]();return _0x2dc0f9;};function _0x5c4aeb(_0x203971,_0x5883d6){var _0x388015=squel[_0xe6aa('0x30')]()[_0xe6aa('0x31')](_0xe6aa('0x32'))[_0xe6aa('0x33')]([_0xe6aa('0x1f'),_0xe6aa('0x34'),_0xe6aa('0x35'),_0xe6aa('0x36'),_0x5883d6,_0xe6aa('0x37'),_0xe6aa('0x3b')],squel[_0xe6aa('0x3f')]()[_0xe6aa('0x39')](_0xe6aa('0x1f'),_0xe6aa('0x1f'))[_0xe6aa('0x39')](_0xe6aa('0x38'),_0xe6aa('0x34'))[_0xe6aa('0x39')]('id',_0xe6aa('0x35'))[_0xe6aa('0x39')](LISTID[_0xe6aa('0x3a')](),'ListId')[_0xe6aa('0x39')](_0x203971['id'][_0xe6aa('0x3a')](),_0x5883d6)[_0xe6aa('0x39')](_0xe6aa('0x38'),'createdAt')[_0xe6aa('0x39')](_0xe6aa('0x38'),_0xe6aa('0x3b'))[_0xe6aa('0x3c')](_0xe6aa('0x3d'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xe6aa('0x45'),LISTID[_0xe6aa('0x3a')]())[_0xe6aa('0x3e')](_0xe6aa('0x46'),squel[_0xe6aa('0x42')](hopperContacts))['where'](_0xe6aa('0x43')))['toString']();return _0x388015;}function _0x33910b(_0x580fd6,_0x2c4f36){var _0x1f410d=squel[_0xe6aa('0x30')]()['into'](_0xe6aa('0x47'))[_0xe6aa('0x33')]([_0xe6aa('0x1f'),_0xe6aa('0x35'),_0xe6aa('0x36'),_0x2c4f36,'createdAt',_0xe6aa('0x3b')],squel[_0xe6aa('0x3f')]()[_0xe6aa('0x39')]('phone',_0xe6aa('0x1f'))[_0xe6aa('0x39')]('id','ContactId')[_0xe6aa('0x39')](LISTID[_0xe6aa('0x3a')](),_0xe6aa('0x36'))[_0xe6aa('0x39')](_0x580fd6['id'][_0xe6aa('0x3a')](),_0x2c4f36)['field'](_0xe6aa('0x38'),_0xe6aa('0x37'))['field'](_0xe6aa('0x38'),_0xe6aa('0x3b'))[_0xe6aa('0x3c')](_0xe6aa('0x3d'))['where']('deletedAt\x20IS\x20NULL')[_0xe6aa('0x3e')]('ListId\x20=\x20?',LISTID[_0xe6aa('0x3a')]())[_0xe6aa('0x3e')](_0xe6aa('0x46'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xe6aa('0x3a')]();return _0x1f410d;}return db[_0xe6aa('0x48')][_0xe6aa('0x49')]({'where':{'type':_0xe6aa('0x4a')},'attributes':['id',_0xe6aa('0x4b')],'include':[{'model':db[_0xe6aa('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0xe6aa('0x29')](function(_0x241f6c){var _0x5e4ba7=[];if(_0x241f6c){var _0xdefc6d;for(var _0x179236=0x0,_0x39d11a;_0x179236<_0x241f6c[_0xe6aa('0x18')];_0x179236+=0x1){_0x39d11a=_0x241f6c[_0x179236][_0xe6aa('0x4d')]({'plain':!![]});switch(_0x39d11a[_0xe6aa('0x4b')]){case'always':_0x5e4ba7[_0xe6aa('0x2a')](db['sequelize'][_0xe6aa('0x4e')](_0x2bae2d(_0x39d11a,'VoiceQueueId'))['then'](function(){})[_0xe6aa('0x2c')](_0x2473e5()));break;case _0xe6aa('0x4f'):_0x5e4ba7[_0xe6aa('0x2a')](db[_0xe6aa('0x50')][_0xe6aa('0x4e')](_0x5b47d2(_0x39d11a,'VoiceQueueId'))[_0xe6aa('0x29')](function(){})[_0xe6aa('0x2c')](_0x2473e5()));break;default:_0x5e4ba7[_0xe6aa('0x2a')](db[_0xe6aa('0x50')][_0xe6aa('0x4e')](_0x5c4aeb(_0x39d11a,'VoiceQueueId'))[_0xe6aa('0x29')](function(){})[_0xe6aa('0x2c')](_0x2473e5()));}}}return _0x5e4ba7;})[_0xe6aa('0x51')]()[_0xe6aa('0x29')](function(){return db['VoiceQueue'][_0xe6aa('0x49')]({'where':{'type':_0xe6aa('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe6aa('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x504638){var _0x41b8f0=[];if(_0x504638){var _0x307783;for(var _0x26a481=0x0,_0x3b4ffb;_0x26a481<_0x504638[_0xe6aa('0x18')];_0x26a481+=0x1){_0x3b4ffb=_0x504638[_0x26a481][_0xe6aa('0x4d')]({'plain':!![]});_0x41b8f0[_0xe6aa('0x2a')](db['sequelize']['query'](_0x33910b(_0x3b4ffb,_0xe6aa('0x53')))[_0xe6aa('0x29')](function(){})['catch'](_0x2473e5()));}}return _0x41b8f0;})['all']();})['then'](function(){return db[_0xe6aa('0x54')][_0xe6aa('0x49')]({'attributes':['id',_0xe6aa('0x4b')],'include':[{'model':db[_0xe6aa('0x4c')],'as':_0xe6aa('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x37df17){var _0x44ad52=[];if(_0x37df17){for(var _0x41ddb2=0x0,_0x35c3de;_0x41ddb2<_0x37df17[_0xe6aa('0x18')];_0x41ddb2+=0x1){_0x35c3de=_0x37df17[_0x41ddb2][_0xe6aa('0x4d')]({'plain':!![]});switch(_0x35c3de[_0xe6aa('0x4b')]){case _0xe6aa('0x56'):_0x44ad52[_0xe6aa('0x2a')](db[_0xe6aa('0x50')][_0xe6aa('0x4e')](_0x2bae2d(_0x35c3de,_0xe6aa('0x57')))[_0xe6aa('0x29')](function(){})[_0xe6aa('0x2c')](_0x2473e5()));break;case _0xe6aa('0x4f'):_0x44ad52[_0xe6aa('0x2a')](db[_0xe6aa('0x50')]['query'](_0x5b47d2(_0x35c3de,_0xe6aa('0x57')))[_0xe6aa('0x29')](function(){})[_0xe6aa('0x2c')](_0x2473e5()));break;default:_0x44ad52[_0xe6aa('0x2a')](db[_0xe6aa('0x50')]['query'](_0x5c4aeb(_0x35c3de,_0xe6aa('0x57')))[_0xe6aa('0x29')](function(){})[_0xe6aa('0x2c')](_0x2473e5()));}}}return _0x44ad52;})['all']();})[_0xe6aa('0x29')](function(){return db[_0xe6aa('0x54')][_0xe6aa('0x49')]({'attributes':['id'],'include':[{'model':db[_0xe6aa('0x4c')],'as':_0xe6aa('0x52'),'where':{'id':LISTID}}]})[_0xe6aa('0x29')](function(_0x63731e){var _0x1e0025=[];if(_0x63731e){for(var _0x38a18a=0x0,_0x16ece3;_0x38a18a<_0x63731e['length'];_0x38a18a+=0x1){_0x16ece3=_0x63731e[_0x38a18a][_0xe6aa('0x4d')]({'plain':!![]});_0x1e0025[_0xe6aa('0x2a')](db['sequelize'][_0xe6aa('0x4e')](_0x33910b(_0x16ece3,_0xe6aa('0x57')))[_0xe6aa('0x29')](function(){})['catch'](_0x2473e5()));}}return _0x1e0025;})[_0xe6aa('0x51')]();})[_0xe6aa('0x2c')](function(_0x5726f9){logger[_0xe6aa('0x15')](_0xe6aa('0x58'),_0xe6aa('0x59'),_0x5726f9[_0xe6aa('0x1a')]);});}var processPromises=function(_0x40035d){return BPromise[_0xe6aa('0x51')](promises)[_0xe6aa('0x29')](function(_0x48d7b1){})['catch'](function(_0x3743ac){logger[_0xe6aa('0x15')](_0xe6aa('0x5a'),JSON[_0xe6aa('0x5b')](_0x3743ac));})[_0xe6aa('0x5c')](function(){socket['emit'](_0xe6aa('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x40035d){return _0x40035d[_0xe6aa('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xe6aa('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0xe6aa('0x29')](function(){socket[_0xe6aa('0x5f')](_0xe6aa('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe6aa('0x60')](FILEPATH);}catch(_0x4d2196){logger['error'](_0xe6aa('0x61'),JSON[_0xe6aa('0x5b')](_0x4d2196));}finally{process[_0xe6aa('0x62')](0x0);}});};process['on'](_0xe6aa('0x63'),function(){logger['info'](_0xe6aa('0x64'));endCsv();});function main(){return BPromise['resolve']()[_0xe6aa('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe6aa('0x65')](',');return db['CmContact'][_0xe6aa('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2439b9){var _0x4f2f76=fs[_0xe6aa('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe6aa('0x67')](_0x4f2f76,{'header':!![],'skipEmptyLines':!![],'step':function(_0x136700,_0x1c0cab){total+=0x1;var _0x365ee1=total;promises['push'](checkRow(_0x136700,_0x2439b9,_0x365ee1)[_0xe6aa('0x29')](function(){success+=0x1;})[_0xe6aa('0x2c')](function(_0x50cbd6){if(_0x50cbd6['error']){errors+=0x1;delete _0x50cbd6[_0xe6aa('0x15')];}else if(_0x50cbd6[_0xe6aa('0x68')]){duplicates+=0x1;delete _0x50cbd6[_0xe6aa('0x68')];}rows[_0xe6aa('0x2a')](_0x50cbd6);}));if(total%0xc8===0x0){_0x1c0cab[_0xe6aa('0x69')]();return processPromises(_0x1c0cab);}},'complete':function(){return processPromises()[_0xe6aa('0x29')](function(){logger['info'](_0xe6aa('0x6a'));endCsv();});},'error':function(_0x27a09f,_0x130cea){logger[_0xe6aa('0x6b')](_0xe6aa('0x6c'),JSON[_0xe6aa('0x5b')](_0x27a09f));endCsv();}});})[_0xe6aa('0x2c')](function(_0x214a6c){logger[_0xe6aa('0x15')](_0xe6aa('0x6d'),JSON['stringify'](_0x214a6c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 8867dde..f117f0d 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 _0xf67f=['binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','fromQuery','cm_contacts','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','Received\x20SIGINT','error','message','push','info','sequelize','query','spread','catch','stringify','send','start','binding','socket_timestamp','root','.csv','keys','header','writeFileSync','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','each','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','parse'];(function(_0x5eb0c1,_0x423321){var _0x14cbbd=function(_0x5553cb){while(--_0x5553cb){_0x5eb0c1['push'](_0x5eb0c1['shift']());}};_0x14cbbd(++_0x423321);}(_0xf67f,0x191));var _0xff67=function(_0x13b228,_0x348b33){_0x13b228=_0x13b228-0x0;var _0xa6567d=_0xf67f[_0x13b228];return _0xa6567d;};'use strict';var fs=require('fs');var path=require(_0xff67('0x0'));var _=require('lodash');var Papa=require(_0xff67('0x1'));var util=require(_0xff67('0x2'));var BPromise=require(_0xff67('0x3'));var moment=require(_0xff67('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xff67('0x5'));var logger=require(_0xff67('0x6'))('import');config[_0xff67('0x7')]=_[_0xff67('0x8')](config[_0xff67('0x7')],{'host':_0xff67('0x9'),'port':0x18eb});var socket=require(_0xff67('0xa'))(new Redis(config[_0xff67('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xff67('0xb')](_0xff67('0xc'));function isEmail(_0x5d91b7){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))*$/[_0xff67('0xd')](_0x5d91b7);}function selectNotIn(_0x5dffc0,_0x2e63f3,_0x45b7d0,_0x245611,_0x104f81){return squel['select']()[_0xff67('0xe')](_0xff67('0xf'))[_0xff67('0x10')](_0x245611)[_0xff67('0x11')](_0x2e63f3,null,_0x2e63f3+'.id\x20=\x20'+_0x245611+'.'+_0x45b7d0)['where'](_0x245611+'.'+_0x45b7d0+_0xff67('0x12')+_0x5dffc0+'.'+_0x45b7d0)[_0xff67('0x13')](_0x2e63f3+_0xff67('0x14')+_0x104f81['join']()+')');}function insertCmHopper(_0x204bf9,_0x584d7e,_0x251c01,_0x586b0e,_0x2ca190){var _0x5c6a3f=[_0xff67('0x15'),'cm_contacts.scheduledat','cm_contacts.id',_0xff67('0x16'),_0x584d7e+'.'+_0x586b0e,_0xff67('0x17'),_0xff67('0x18'),_0xff67('0x19'),'cm_contacts.UserId','\x22'+_0x2ca190+'\x22'];return squel['insert']()[_0xff67('0x1a')](_0xff67('0x1b'))['fromQuery']([_0xff67('0xf'),_0xff67('0x1c'),_0xff67('0x1d'),'ListId',_0x586b0e,_0xff67('0x1e'),_0xff67('0x1f'),'priority',_0xff67('0x20'),_0xff67('0x21')],squel[_0xff67('0x22')]()[_0xff67('0x23')](_0x5c6a3f)['from'](_0x584d7e)[_0xff67('0x11')]('cm_contacts',null,_0xff67('0x24')+_0x584d7e+'.CmListId')[_0xff67('0x11')](_0x251c01,null,_0x251c01+_0xff67('0x25')+_0x584d7e+'.'+_0x586b0e)[_0xff67('0x13')](_0x584d7e+_0xff67('0x26'),_0x204bf9)[_0xff67('0x13')](_0xff67('0x27'),NOW)[_0xff67('0x13')](_0xff67('0x28'),selectNotIn(_0x584d7e,_0x251c01,_0x586b0e,_0xff67('0x1b'),[_0xff67('0x29'),_0xff67('0x2a')]))[_0xff67('0x13')](_0xff67('0x28'),selectNotIn(_0x584d7e,_0x251c01,_0x586b0e,_0xff67('0x1b'),['\x22always\x22'])))[_0xff67('0x2b')]();}function insertCmHopperBlack(_0x79ee87,_0x71540e,_0xf61f10,_0x323349){var _0x2442c1=[_0xff67('0x15'),'cm_contacts.id',_0xff67('0x16'),_0x71540e+'.'+_0x323349,_0xff67('0x17'),_0xff67('0x18')];return squel[_0xff67('0x2c')]()[_0xff67('0x1a')](_0xff67('0x2d'))[_0xff67('0x2e')]([_0xff67('0xf'),_0xff67('0x1d'),'ListId',_0x323349,_0xff67('0x1e'),_0xff67('0x1f')],squel[_0xff67('0x22')]()[_0xff67('0x23')](_0x2442c1)[_0xff67('0x10')](_0x71540e)[_0xff67('0x11')](_0xff67('0x2f'),null,_0xff67('0x24')+_0x71540e+_0xff67('0x30'))['join'](_0xf61f10,null,_0xf61f10+'.id\x20=\x20'+_0x71540e+'.'+_0x323349)['where'](_0x71540e+_0xff67('0x26'),_0x79ee87)[_0xff67('0x13')](_0xff67('0x27'),NOW)[_0xff67('0x13')](_0xff67('0x28'),squel[_0xff67('0x22')]()[_0xff67('0xe')](_0xff67('0xf'))['from'](_0xff67('0x2d'))[_0xff67('0x13')](_0xff67('0x31'),_0x79ee87)['where'](_0x323349+_0xff67('0x32'),_0x71540e+'.'+_0x323349)))[_0xff67('0x2b')]();}function insertCmContact(_0x420644,_0x5c566f,_0x20dcf6,_0x28286e){var _0x391b4a=_[_0xff67('0x33')](_['keys'](_0x28286e),[_0xff67('0x34'),_0xff67('0x35'),_0xff67('0x1e'),_0xff67('0x1f')]);return squel['insert']()[_0xff67('0x1a')](_0xff67('0x2f'))['fromQuery'](_0x391b4a,squel['select']()[_0xff67('0x23')](_0x391b4a)[_0xff67('0x10')](_0x5c566f)[_0xff67('0x13')]('('+_0x20dcf6[_0xff67('0x11')](',')+_0xff67('0x36'),squel['select']()[_0xff67('0x23')](_0x20dcf6)[_0xff67('0x10')](_0xff67('0x2f'))[_0xff67('0x13')](_0xff67('0x31'),_0x420644))[_0xff67('0x13')](_0xff67('0x37'),squel['select']()[_0xff67('0xe')]('MIN(id)',_0xff67('0x38'))['from'](_0x5c566f)[_0xff67('0x39')](_0x20dcf6[_0xff67('0x11')](','))))[_0xff67('0x2b')]();}function handleStop(){logger['info'](_0xff67('0x3a'));stopped=!![];}function handleUncaughtException(_0x5af91f){logger[_0xff67('0x3b')](_0x5af91f[_0xff67('0x3c')]);process['exit'](0x1);}function handleError(_0x2fcb15,_0xf962bd){stats['errors'][_0xff67('0x3d')]({'name':_0xf962bd['code'],'message':_0xf962bd[_0xff67('0x3c')],'row':_0x2fcb15});}function handleQuery(_0x400938){logger[_0xff67('0x3e')](_0x400938);return db[_0xff67('0x3f')][_0xff67('0x40')](_0x400938)[_0xff67('0x41')](function(_0xf495d1){results[_0xff67('0x3d')](_0xf495d1);})[_0xff67('0x42')](function(_0xdab388){logger[_0xff67('0x3b')](_0xdab388['message']);});}function main(_0x5377c8,_0x5b838c,_0x2b2f8d,_0x2d0671){logger[_0xff67('0x3e')]('main',_0x5377c8,JSON[_0xff67('0x43')](_0x5b838c));process[_0xff67('0x44')](_0xff67('0x45'));var _0x13dc56=_0x5b838c[_0xff67('0x46')];var _0x1d2722=_0x5b838c[_0xff67('0x47')];var _0x52fddc=path['join'](config[_0xff67('0x48')],'server/files/tmp',_0x1d2722+_0xff67('0x49'));var _0x1b8fd3=_[_0xff67('0x4a')](_0x13dc56)[_0xff67('0x11')]();logger['info'](_0xff67('0x4b'),_0x1b8fd3);fs[_0xff67('0x4c')](_0x52fddc,_0x1b8fd3+'\x0a');Papa['parse'](fs[_0xff67('0x4d')](_0x5377c8),{'header':!![],'skipEmptyLines':!![],'step':function(_0xfd4503,_0x4ffe17){try{for(var _0x7037cf=0x0,_0x9f5cb5=[];_0x7037cf<_0xfd4503[_0xff67('0x4e')][_0xff67('0x4f')];_0x7037cf++){stats[_0xff67('0x50')]+=0x1;if(_0xfd4503[_0xff67('0x51')][_0x7037cf]){handleError(_0xfd4503[_0xff67('0x4e')][_0x7037cf],_0xfd4503[_0xff67('0x51')][_0x7037cf]);}else{var _0x1db19b=[];for(var _0x31007d in _0x13dc56){if(_0x13dc56[_0xff67('0x52')](_0x31007d)){if(_0xfd4503['data'][_0x7037cf][_0x13dc56[_0x31007d]]){var _0x4b911f=_[_0xff67('0x53')](_0xfd4503[_0xff67('0x4e')][_0x7037cf][_0x13dc56[_0x31007d]][_0xff67('0x54')](/"/g,'\x27'));switch(_0x31007d){case'scheduledat':var _0x1da223=moment(_0x4b911f,_0xff67('0xc'),!![]);if(_0x1da223['isValid']()){_0x9f5cb5[_0xff67('0x3d')]('\x22'+_0x4b911f+'\x22');}else{_0x1db19b[_0xff67('0x3d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5371f=parseInt(_0x4b911f);_0x4b911f=_[_0xff67('0x55')](_0x5371f)||_0x5371f<0x0||_0x5371f>0x4?_0x2d0671?0x3:0x2:_0x5371f;_0x9f5cb5[_0xff67('0x3d')]('\x22'+_0x4b911f+'\x22');break;case'UserId':var _0x23b4ac=parseInt(_0x4b911f);if(_[_0xff67('0x56')](_0x23b4ac)&&_[_0xff67('0x57')](_0x2b2f8d,_0x23b4ac)){_0x9f5cb5[_0xff67('0x3d')]('\x22'+_0x23b4ac+'\x22');}else{_0x1db19b[_0xff67('0x3d')]('agent\x20not\x20exists');}break;case _0xff67('0x58'):if(isEmail(_0x4b911f)){_0x9f5cb5[_0xff67('0x3d')]('\x22'+_0x4b911f+'\x22');}else{_0x1db19b[_0xff67('0x3d')](_0xff67('0x59'));}break;case _0xff67('0x5a'):var _0x4849bb=moment(_0x4b911f,_0xff67('0x5b'),!![]);if(_0x4849bb[_0xff67('0x5c')]()){_0x9f5cb5[_0xff67('0x3d')]('\x22'+_0x4b911f+'\x22');}else{_0x1db19b[_0xff67('0x3d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x9f5cb5[_0xff67('0x3d')]('\x22'+_0x4b911f+'\x22');}}else{switch(_0x31007d){case _0xff67('0x5d'):case _0xff67('0xf'):_0x1db19b['push'](_0x31007d+_0xff67('0x5e'));break;default:_0x9f5cb5[_0xff67('0x3d')]('\x22\x22');}}}}if(_0x1db19b[_0xff67('0x4f')]){handleError(_0xfd4503[_0xff67('0x4e')][_0x7037cf],{'code':'SystemRow','message':_0x1db19b[_0xff67('0x11')]()});}else{fs[_0xff67('0x5f')](_0x52fddc,_0x9f5cb5[_0xff67('0x11')]()+'\x0a');}_0x9f5cb5=[];}if(!(stats[_0xff67('0x50')]%0xc8)){socket[_0xff67('0x60')](_0xff67('0x61')+_0x1d2722,stats);stats[_0xff67('0x51')]=[];}}if(stopped){logger[_0xff67('0x3e')](_0xff67('0x62'));_0x4ffe17[_0xff67('0x63')]();}}catch(_0x18ea90){handleError(_0xfd4503[_0xff67('0x4e')][_0x7037cf],{'code':'SystemError','message':_0x18ea90[_0xff67('0x3c')]});logger[_0xff67('0x3b')](_0xff67('0x64'),_0x18ea90['message']);}},'complete':function(){try{var _0x488b33=[];var _0x1c1944=_0xff67('0x2f');if(_0x5b838c['duplicates']&&_0x5b838c[_0xff67('0x65')]['length']){_0x1c1944=_0xff67('0x66')+_0x1d2722;_0x488b33['push'](_0xff67('0x67')+_0x1c1944+_0xff67('0x68'));}var _0xf213d=util[_0xff67('0xb')](_0xff67('0x69'),_0x52fddc,_0x1c1944,_0x1b8fd3,_0x5b838c['ListId'],_0x5b838c[_0xff67('0x35')]||null,NOW,NOW);if(_[_0xff67('0x6a')](_0x13dc56['scheduledat'])){_0xf213d+=_0xff67('0x6b');}_0x488b33[_0xff67('0x3d')](_0xf213d);if(_0x5b838c['duplicates']&&_0x5b838c['duplicates'][_0xff67('0x4f')]){_0x488b33['push'](insertCmContact(_0x5b838c[_0xff67('0x34')],_0x1c1944,_0x5b838c[_0xff67('0x65')],_0x13dc56));_0x488b33[_0xff67('0x3d')](_0xff67('0x6c')+_0x1c1944+';');}_0x488b33[_0xff67('0x3d')](insertCmHopper(_0x5b838c['ListId'],'voice_queues_has_cm_lists','voice_queues',_0xff67('0x6d'),_0x2d0671));_0x488b33[_0xff67('0x3d')](insertCmHopperBlack(_0x5b838c[_0xff67('0x34')],_0xff67('0x6e'),'voice_queues','VoiceQueueId'));_0x488b33[_0xff67('0x3d')](insertCmHopper(_0x5b838c[_0xff67('0x34')],_0xff67('0x6f'),'campaigns',_0xff67('0x70'),_0x2d0671));_0x488b33[_0xff67('0x3d')](insertCmHopperBlack(_0x5b838c[_0xff67('0x34')],_0xff67('0x71'),'campaigns',_0xff67('0x70')));BPromise[_0xff67('0x72')](_0x488b33,handleQuery)['then'](function(_0x337370){stats['finish']=!![];stats['affectedRows']=_0x5b838c[_0xff67('0x65')]&&_0x5b838c[_0xff67('0x65')][_0xff67('0x4f')]?results[0x2]['affectedRows']:results[0x0][_0xff67('0x73')];socket[_0xff67('0x60')](_0xff67('0x61')+_0x1d2722,stats);fs[_0xff67('0x74')](_0x5377c8);fs['unlink'](_0x52fddc);process[_0xff67('0x75')](0x0);})[_0xff67('0x42')](function(_0x1f3cad){logger[_0xff67('0x3b')](_0x1f3cad[_0xff67('0x3c')]);process[_0xff67('0x75')](0x1);});}catch(_0xb1a8fc){logger[_0xff67('0x3b')]('complete',_0xb1a8fc[_0xff67('0x3c')]);process[_0xff67('0x75')](0x1);}},'error':function(_0x165d93,_0x1b9d9f,_0x5a076a,_0x336740){throw new Error(_0x336740);}});}function validate(){if(process[_0xff67('0x76')]&&process[_0xff67('0x76')][_0xff67('0x4f')]<0x4){throw new Error(_0xff67('0x77'));}var _0x3b52a2=path[_0xff67('0x11')](config[_0xff67('0x48')],_0xff67('0x78'),process[_0xff67('0x76')][0x2]);if(!fs[_0xff67('0x79')](_0x3b52a2)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x10dcc0={};try{_0x10dcc0=JSON[_0xff67('0x7a')](process[_0xff67('0x76')][0x3]);if(!_0x10dcc0[_0xff67('0x46')]){throw new Error(_0xff67('0x7b'));}if(!_0x10dcc0[_0xff67('0x46')][_0xff67('0xf')]){throw new Error(_0xff67('0x7c'));}if(!_0x10dcc0[_0xff67('0x46')]['firstName']){throw new Error(_0xff67('0x7d'));}var _0x1577dd=0x0;if(_0x10dcc0[_0xff67('0x46')][_0xff67('0x20')]){_0x1577dd=0x1;}if(!_0x10dcc0[_0xff67('0x34')]){throw new Error(_0xff67('0x7e'));}}catch(_0x15e4f1){throw new Error(_0xff67('0x7f'));}var _0x5d2af1=[];try{_0x5d2af1=_[_0xff67('0x80')](JSON[_0xff67('0x7a')](process['argv'][0x4]),'id');}catch(_0x384458){logger[_0xff67('0x3e')](_0xff67('0x81'));}main(_0x3b52a2,_0x10dcc0,_0x5d2af1,_0x1577dd);}validate();process['on']('SIGINT',handleStop);process['on'](_0xff67('0x82'),handleUncaughtException); \ No newline at end of file +var _0x4a77=['.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','createdAt','updatedAt','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','toString','insert','cm_hopper_black','ListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','info','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','start','socket_timestamp','root','.csv','keys','header','parse','createReadStream','data','length','rows','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','argv','server/files/tmp','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','select','field','phone','.id\x20=\x20','where','\x20=\x20'];(function(_0x38bc8e,_0x213121){var _0x5ee5fe=function(_0x28d8dc){while(--_0x28d8dc){_0x38bc8e['push'](_0x38bc8e['shift']());}};_0x5ee5fe(++_0x213121);}(_0x4a77,0x164));var _0x74a7=function(_0x1f73c3,_0x4044af){_0x1f73c3=_0x1f73c3-0x0;var _0xff343a=_0x4a77[_0x1f73c3];return _0xff343a;};'use strict';var fs=require('fs');var path=require(_0x74a7('0x0'));var _=require(_0x74a7('0x1'));var Papa=require(_0x74a7('0x2'));var util=require('util');var BPromise=require(_0x74a7('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x74a7('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x74a7('0x5'));var logger=require(_0x74a7('0x6'))('import');config[_0x74a7('0x7')]=_['defaults'](config[_0x74a7('0x7')],{'host':_0x74a7('0x8'),'port':0x18eb});var socket=require(_0x74a7('0x9'))(new Redis(config[_0x74a7('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2f6984){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x2f6984);}function selectNotIn(_0x5dde60,_0x5b55bc,_0x1adee8,_0x555b37,_0x283b95){return squel[_0x74a7('0xa')]()[_0x74a7('0xb')](_0x74a7('0xc'))['from'](_0x555b37)['join'](_0x5b55bc,null,_0x5b55bc+_0x74a7('0xd')+_0x555b37+'.'+_0x1adee8)[_0x74a7('0xe')](_0x555b37+'.'+_0x1adee8+_0x74a7('0xf')+_0x5dde60+'.'+_0x1adee8)[_0x74a7('0xe')](_0x5b55bc+_0x74a7('0x10')+_0x283b95[_0x74a7('0x11')]()+')');}function insertCmHopper(_0x3bd8ba,_0x43924e,_0x27249c,_0x4d8c7a,_0x1bdea7){var _0x4d2cd1=[_0x74a7('0x12'),_0x74a7('0x13'),_0x74a7('0x14'),_0x74a7('0x15'),_0x43924e+'.'+_0x4d8c7a,_0x74a7('0x16'),_0x74a7('0x17'),_0x74a7('0x18'),_0x74a7('0x19'),'\x22'+_0x1bdea7+'\x22'];return squel['insert']()[_0x74a7('0x1a')]('cm_hopper')[_0x74a7('0x1b')]([_0x74a7('0xc'),_0x74a7('0x1c'),_0x74a7('0x1d'),'ListId',_0x4d8c7a,_0x74a7('0x1e'),_0x74a7('0x1f'),'priority','UserId',_0x74a7('0x20')],squel[_0x74a7('0xa')]()[_0x74a7('0x21')](_0x4d2cd1)[_0x74a7('0x22')](_0x43924e)[_0x74a7('0x11')](_0x74a7('0x23'),null,_0x74a7('0x24')+_0x43924e+_0x74a7('0x25'))['join'](_0x27249c,null,_0x27249c+_0x74a7('0xd')+_0x43924e+'.'+_0x4d8c7a)[_0x74a7('0xe')](_0x43924e+_0x74a7('0x26'),_0x3bd8ba)[_0x74a7('0xe')](_0x74a7('0x27'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x43924e,_0x27249c,_0x4d8c7a,_0x74a7('0x28'),[_0x74a7('0x29'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x43924e,_0x27249c,_0x4d8c7a,'cm_hopper',[_0x74a7('0x29')])))[_0x74a7('0x2a')]();}function insertCmHopperBlack(_0x5eae61,_0x3b9957,_0x3ed4ed,_0x4beea5){var _0x5d109f=[_0x74a7('0x12'),_0x74a7('0x14'),_0x74a7('0x15'),_0x3b9957+'.'+_0x4beea5,_0x74a7('0x16'),_0x74a7('0x17')];return squel[_0x74a7('0x2b')]()[_0x74a7('0x1a')](_0x74a7('0x2c'))[_0x74a7('0x1b')](['phone','ContactId',_0x74a7('0x2d'),_0x4beea5,_0x74a7('0x1e'),_0x74a7('0x1f')],squel[_0x74a7('0xa')]()['fields'](_0x5d109f)[_0x74a7('0x22')](_0x3b9957)[_0x74a7('0x11')](_0x74a7('0x23'),null,_0x74a7('0x24')+_0x3b9957+_0x74a7('0x25'))[_0x74a7('0x11')](_0x3ed4ed,null,_0x3ed4ed+'.id\x20=\x20'+_0x3b9957+'.'+_0x4beea5)[_0x74a7('0xe')](_0x3b9957+_0x74a7('0x26'),_0x5eae61)[_0x74a7('0xe')](_0x74a7('0x27'),NOW)[_0x74a7('0xe')](_0x74a7('0x2e'),squel[_0x74a7('0xa')]()['field']('phone')[_0x74a7('0x22')](_0x74a7('0x2c'))[_0x74a7('0xe')](_0x74a7('0x2f'),_0x5eae61)[_0x74a7('0xe')](_0x4beea5+_0x74a7('0x30'),_0x3b9957+'.'+_0x4beea5)))['toString']();}function insertCmContact(_0x5bc4a4,_0x59f182,_0x2d2a4a,_0x19f8b7){var _0x11ee60=_[_0x74a7('0x31')](_['keys'](_0x19f8b7),[_0x74a7('0x2d'),_0x74a7('0x32'),_0x74a7('0x1e'),'updatedAt']);return squel[_0x74a7('0x2b')]()[_0x74a7('0x1a')](_0x74a7('0x23'))[_0x74a7('0x1b')](_0x11ee60,squel['select']()[_0x74a7('0x21')](_0x11ee60)[_0x74a7('0x22')](_0x59f182)[_0x74a7('0xe')]('('+_0x2d2a4a[_0x74a7('0x11')](',')+_0x74a7('0x33'),squel['select']()['fields'](_0x2d2a4a)[_0x74a7('0x22')](_0x74a7('0x23'))[_0x74a7('0xe')]('ListId\x20=\x20?',_0x5bc4a4))['where']('id\x20IN\x20?',squel[_0x74a7('0xa')]()[_0x74a7('0xb')](_0x74a7('0x34'),_0x74a7('0x35'))[_0x74a7('0x22')](_0x59f182)['group'](_0x2d2a4a[_0x74a7('0x11')](','))))['toString']();}function handleStop(){logger[_0x74a7('0x36')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3beb9f){logger[_0x74a7('0x37')](_0x3beb9f[_0x74a7('0x38')]);process[_0x74a7('0x39')](0x1);}function handleError(_0x3b11db,_0x398e8c){stats[_0x74a7('0x3a')][_0x74a7('0x3b')]({'name':_0x398e8c[_0x74a7('0x3c')],'message':_0x398e8c[_0x74a7('0x38')],'row':_0x3b11db});}function handleQuery(_0x2c8af5){logger[_0x74a7('0x36')](_0x2c8af5);return db[_0x74a7('0x3d')][_0x74a7('0x3e')](_0x2c8af5)[_0x74a7('0x3f')](function(_0x36fc40){results[_0x74a7('0x3b')](_0x36fc40);})[_0x74a7('0x40')](function(_0x2eba47){logger[_0x74a7('0x37')](_0x2eba47[_0x74a7('0x38')]);});}function main(_0x1896e6,_0x3a2b04,_0x29fcf5,_0x87d40f){logger[_0x74a7('0x36')](_0x74a7('0x41'),_0x1896e6,JSON[_0x74a7('0x42')](_0x3a2b04));process['send'](_0x74a7('0x43'));var _0x58a25c=_0x3a2b04['binding'];var _0x43307b=_0x3a2b04[_0x74a7('0x44')];var _0xd6586e=path[_0x74a7('0x11')](config[_0x74a7('0x45')],'server/files/tmp',_0x43307b+_0x74a7('0x46'));var _0x2a2ee7=_[_0x74a7('0x47')](_0x58a25c)[_0x74a7('0x11')]();logger[_0x74a7('0x36')](_0x74a7('0x48'),_0x2a2ee7);fs['writeFileSync'](_0xd6586e,_0x2a2ee7+'\x0a');Papa[_0x74a7('0x49')](fs[_0x74a7('0x4a')](_0x1896e6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4950c2,_0x431d00){try{for(var _0x15fc70=0x0,_0x3c02a3=[];_0x15fc70<_0x4950c2[_0x74a7('0x4b')][_0x74a7('0x4c')];_0x15fc70++){stats[_0x74a7('0x4d')]+=0x1;if(_0x4950c2['errors'][_0x15fc70]){handleError(_0x4950c2[_0x74a7('0x4b')][_0x15fc70],_0x4950c2['errors'][_0x15fc70]);}else{var _0x2688ca=[];for(var _0x5a9ff6 in _0x58a25c){if(_0x58a25c[_0x74a7('0x4e')](_0x5a9ff6)){if(_0x4950c2[_0x74a7('0x4b')][_0x15fc70][_0x58a25c[_0x5a9ff6]]){var _0x5c62f2=_['trim'](_0x4950c2[_0x74a7('0x4b')][_0x15fc70][_0x58a25c[_0x5a9ff6]]['replace'](/"/g,'\x27'));switch(_0x5a9ff6){case _0x74a7('0x1c'):var _0x2107b1=moment(_0x5c62f2,_0x74a7('0x4f'),!![]);if(_0x2107b1[_0x74a7('0x50')]()){_0x3c02a3[_0x74a7('0x3b')]('\x22'+_0x5c62f2+'\x22');}else{_0x2688ca[_0x74a7('0x3b')](_0x74a7('0x51'));}break;case'priority':var _0x4ec3ad=parseInt(_0x5c62f2);_0x5c62f2=_['isNaN'](_0x4ec3ad)||_0x4ec3ad<0x0||_0x4ec3ad>0x4?_0x87d40f?0x3:0x2:_0x4ec3ad;_0x3c02a3[_0x74a7('0x3b')]('\x22'+_0x5c62f2+'\x22');break;case'UserId':var _0x5f4ed6=parseInt(_0x5c62f2);if(_[_0x74a7('0x52')](_0x5f4ed6)&&_[_0x74a7('0x53')](_0x29fcf5,_0x5f4ed6)){_0x3c02a3[_0x74a7('0x3b')]('\x22'+_0x5f4ed6+'\x22');}else{_0x2688ca[_0x74a7('0x3b')](_0x74a7('0x54'));}break;case'email':if(isEmail(_0x5c62f2)){_0x3c02a3[_0x74a7('0x3b')]('\x22'+_0x5c62f2+'\x22');}else{_0x2688ca[_0x74a7('0x3b')](_0x74a7('0x55'));}break;case _0x74a7('0x56'):var _0x4f8315=moment(_0x5c62f2,_0x74a7('0x57'),!![]);if(_0x4f8315['isValid']()){_0x3c02a3[_0x74a7('0x3b')]('\x22'+_0x5c62f2+'\x22');}else{_0x2688ca['push'](_0x74a7('0x58'));}break;default:_0x3c02a3[_0x74a7('0x3b')]('\x22'+_0x5c62f2+'\x22');}}else{switch(_0x5a9ff6){case _0x74a7('0x59'):case'phone':_0x2688ca[_0x74a7('0x3b')](_0x5a9ff6+_0x74a7('0x5a'));break;default:_0x3c02a3[_0x74a7('0x3b')]('\x22\x22');}}}}if(_0x2688ca[_0x74a7('0x4c')]){handleError(_0x4950c2[_0x74a7('0x4b')][_0x15fc70],{'code':_0x74a7('0x5b'),'message':_0x2688ca[_0x74a7('0x11')]()});}else{fs[_0x74a7('0x5c')](_0xd6586e,_0x3c02a3[_0x74a7('0x11')]()+'\x0a');}_0x3c02a3=[];}if(!(stats[_0x74a7('0x4d')]%0xc8)){socket[_0x74a7('0x5d')](_0x74a7('0x5e')+_0x43307b,stats);stats[_0x74a7('0x3a')]=[];}}if(stopped){logger[_0x74a7('0x36')](_0x74a7('0x5f'));_0x431d00[_0x74a7('0x60')]();}}catch(_0x55ea04){handleError(_0x4950c2[_0x74a7('0x4b')][_0x15fc70],{'code':_0x74a7('0x61'),'message':_0x55ea04['message']});logger[_0x74a7('0x37')](_0x74a7('0x62'),_0x55ea04[_0x74a7('0x38')]);}},'complete':function(){try{var _0x23ac69=[];var _0x4daa90=_0x74a7('0x23');if(_0x3a2b04[_0x74a7('0x63')]&&_0x3a2b04[_0x74a7('0x63')][_0x74a7('0x4c')]){_0x4daa90='cm_contacts_'+_0x43307b;_0x23ac69['push'](_0x74a7('0x64')+_0x4daa90+_0x74a7('0x65'));}var _0x156aa8=util['format'](_0x74a7('0x66'),_0xd6586e,_0x4daa90,_0x2a2ee7,_0x3a2b04['ListId'],_0x3a2b04['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x58a25c[_0x74a7('0x1c')])){_0x156aa8+=',\x20scheduledAt\x20=\x20NOW()';}_0x23ac69['push'](_0x156aa8);if(_0x3a2b04[_0x74a7('0x63')]&&_0x3a2b04[_0x74a7('0x63')][_0x74a7('0x4c')]){_0x23ac69[_0x74a7('0x3b')](insertCmContact(_0x3a2b04[_0x74a7('0x2d')],_0x4daa90,_0x3a2b04[_0x74a7('0x63')],_0x58a25c));_0x23ac69[_0x74a7('0x3b')]('DROP\x20TABLE\x20'+_0x4daa90+';');}_0x23ac69[_0x74a7('0x3b')](insertCmHopper(_0x3a2b04[_0x74a7('0x2d')],_0x74a7('0x67'),_0x74a7('0x68'),_0x74a7('0x69'),_0x87d40f));_0x23ac69[_0x74a7('0x3b')](insertCmHopperBlack(_0x3a2b04[_0x74a7('0x2d')],_0x74a7('0x6a'),'voice_queues','VoiceQueueId'));_0x23ac69[_0x74a7('0x3b')](insertCmHopper(_0x3a2b04[_0x74a7('0x2d')],'campaigns_has_cm_lists',_0x74a7('0x6b'),'CampaignId',_0x87d40f));_0x23ac69[_0x74a7('0x3b')](insertCmHopperBlack(_0x3a2b04[_0x74a7('0x2d')],_0x74a7('0x6c'),_0x74a7('0x6b'),_0x74a7('0x6d')));BPromise[_0x74a7('0x6e')](_0x23ac69,handleQuery)[_0x74a7('0x6f')](function(_0x7fe000){stats[_0x74a7('0x70')]=!![];stats['affectedRows']=_0x3a2b04[_0x74a7('0x63')]&&_0x3a2b04['duplicates'][_0x74a7('0x4c')]?results[0x2]['affectedRows']:results[0x0][_0x74a7('0x71')];socket[_0x74a7('0x5d')](_0x74a7('0x5e')+_0x43307b,stats);fs['unlink'](_0x1896e6);fs['unlink'](_0xd6586e);process[_0x74a7('0x39')](0x0);})[_0x74a7('0x40')](function(_0x2d5715){logger[_0x74a7('0x37')](_0x2d5715[_0x74a7('0x38')]);process[_0x74a7('0x39')](0x1);});}catch(_0x5d7cb3){logger['error']('complete',_0x5d7cb3[_0x74a7('0x38')]);process[_0x74a7('0x39')](0x1);}},'error':function(_0x59fa0b,_0x98f18d,_0x5cfe44,_0x276788){throw new Error(_0x276788);}});}function validate(){if(process[_0x74a7('0x72')]&&process[_0x74a7('0x72')][_0x74a7('0x4c')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x21c768=path[_0x74a7('0x11')](config[_0x74a7('0x45')],_0x74a7('0x73'),process[_0x74a7('0x72')][0x2]);if(!fs['existsSync'](_0x21c768)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x11b77b={};try{_0x11b77b=JSON['parse'](process[_0x74a7('0x72')][0x3]);if(!_0x11b77b[_0x74a7('0x74')]){throw new Error(_0x74a7('0x75'));}if(!_0x11b77b[_0x74a7('0x74')][_0x74a7('0xc')]){throw new Error(_0x74a7('0x76'));}if(!_0x11b77b[_0x74a7('0x74')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0xfcea9d=0x0;if(_0x11b77b['binding']['UserId']){_0xfcea9d=0x1;}if(!_0x11b77b['ListId']){throw new Error(_0x74a7('0x77'));}}catch(_0x591e09){throw new Error(_0x74a7('0x78'));}var _0x1d28a5=[];try{_0x1d28a5=_['map'](JSON[_0x74a7('0x49')](process[_0x74a7('0x72')][0x4]),'id');}catch(_0x4a97ae){logger[_0x74a7('0x36')](_0x74a7('0x79'));}main(_0x21c768,_0x11b77b,_0x1d28a5,_0xfcea9d);}validate();process['on'](_0x74a7('0x7a'),handleStop);process['on'](_0x74a7('0x7b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index eabd883..7423dae 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 _0x2032=['Agent\x20Ring','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','destcalleridnum','Member\x20Name','membername','Date','starttime','***\x20Time\x20Info\x20***','answertime','Duration','duration','Billable\x20Time','billableseconds','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','string','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Name','keyValue','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number'];(function(_0x5098cf,_0x2c8c5b){var _0x22d62e=function(_0xb083e6){while(--_0xb083e6){_0x5098cf['push'](_0x5098cf['shift']());}};_0x22d62e(++_0x2c8c5b);}(_0x2032,0xd9));var _0x2203=function(_0xd9dd99,_0x374f33){_0xd9dd99=_0xd9dd99-0x0;var _0x38a1ad=_0x2032[_0xd9dd99];return _0x38a1ad;};'use strict';exports['getSubjects']=function(_0x2c2259,_0x1e103d){var _0xcd892f=[{'type':'string','content':_0x2203('0x0'),'variableName':null}];switch(_0x2c2259[_0x2203('0x1')]()){case'voice':switch(_0x1e103d[_0x2203('0x1')]()){case _0x2203('0x2'):_0xcd892f[_0x2203('0x3')]({'type':_0x2203('0x4'),'content':'','variableName':_0x2203('0x5')});_0xcd892f[_0x2203('0x3')]({'type':_0x2203('0x4'),'content':'','variableName':_0x2203('0x6')});break;case _0x2203('0x7'):_0xcd892f[_0x2203('0x3')]({'type':_0x2203('0x8'),'content':'Outbound\x20Call','variableName':null});_0xcd892f['push']({'type':_0x2203('0x4'),'content':'','variableName':'destcalleridnum'});break;}}return _0xcd892f;};exports[_0x2203('0x9')]=function(_0x2972f3,_0x6339c4){var _0x5b19df=[];switch(_0x2972f3[_0x2203('0x1')]()){case'voice':switch(_0x6339c4[_0x2203('0x1')]()){case'inbound':_0x5b19df=[{'type':_0x2203('0x8'),'content':_0x2203('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':'variable','variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x2203('0xb'),'keyType':'variable','variableName':'calleridname'},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0xd'),'keyType':_0x2203('0x4'),'variableName':_0x2203('0xe')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0xf'),'keyType':_0x2203('0x4'),'variableName':_0x2203('0x5')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0x10'),'keyType':'variable','variableName':_0x2203('0x11')},{'type':_0x2203('0xc'),'content':'','key':'Date','keyType':_0x2203('0x4'),'variableName':_0x2203('0x12')},{'type':'string','content':_0x2203('0x13'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x2203('0x14'),'keyType':_0x2203('0x4'),'variableName':_0x2203('0x15')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0x16'),'keyType':_0x2203('0x4'),'variableName':'destcalleridnum'},{'type':_0x2203('0x8'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x2203('0x17'),'keyType':'variable','variableName':_0x2203('0x12')},{'type':_0x2203('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0x2203('0x4'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x2203('0x18'),'keyType':_0x2203('0x4'),'variableName':_0x2203('0x19')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0x1a'),'keyType':_0x2203('0x4'),'variableName':_0x2203('0x1b')},{'type':_0x2203('0xc'),'content':'','key':'Talk\x20Time','keyType':_0x2203('0x4'),'variableName':_0x2203('0x1c')}];break;case _0x2203('0x7'):_0x5b19df=[{'type':'string','content':_0x2203('0xa'),'variableName':null},{'type':_0x2203('0xc'),'content':'','key':'Called\x20Number','keyType':_0x2203('0x4'),'keyContent':'','variableName':_0x2203('0x1d')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0x1e'),'keyType':_0x2203('0x4'),'keyContent':'','variableName':_0x2203('0x1f')},{'type':_0x2203('0xc'),'content':'','key':'UniqueId','keyType':_0x2203('0x4'),'keyContent':'','variableName':_0x2203('0x11')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0x20'),'keyType':'variable','keyContent':'','variableName':_0x2203('0x21')},{'type':_0x2203('0x8'),'content':_0x2203('0x22')},{'type':_0x2203('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x2203('0x4'),'keyContent':'','variableName':_0x2203('0x23')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0x2203('0x4'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x2203('0x24'),'keyType':_0x2203('0x4'),'keyContent':'','variableName':_0x2203('0x25')},{'type':_0x2203('0xc'),'content':'','key':_0x2203('0x26'),'keyType':'variable','keyContent':'','variableName':_0x2203('0x27')}];break;}}return _0x5b19df;}; \ No newline at end of file +var _0x2ef3=['destexten','queue','UniqueId','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Call\x20To'];(function(_0x54f108,_0x599264){var _0x346d5e=function(_0x172f38){while(--_0x172f38){_0x54f108['push'](_0x54f108['shift']());}};_0x346d5e(++_0x599264);}(_0x2ef3,0xba));var _0x32ef=function(_0x441a26,_0x2809d1){_0x441a26=_0x441a26-0x0;var _0x160d2=_0x2ef3[_0x441a26];return _0x160d2;};'use strict';exports[_0x32ef('0x0')]=function(_0x11c049,_0x47513a){var _0x26e56e=[{'type':_0x32ef('0x1'),'content':_0x32ef('0x2'),'variableName':null}];switch(_0x11c049['toLowerCase']()){case _0x32ef('0x3'):switch(_0x47513a[_0x32ef('0x4')]()){case'inbound':_0x26e56e[_0x32ef('0x5')]({'type':_0x32ef('0x6'),'content':'','variableName':'queue'});_0x26e56e['push']({'type':_0x32ef('0x6'),'content':'','variableName':_0x32ef('0x7')});break;case _0x32ef('0x8'):_0x26e56e[_0x32ef('0x5')]({'type':_0x32ef('0x1'),'content':_0x32ef('0x9'),'variableName':null});_0x26e56e[_0x32ef('0x5')]({'type':_0x32ef('0x6'),'content':'','variableName':_0x32ef('0xa')});break;}}return _0x26e56e;};exports[_0x32ef('0xb')]=function(_0x56eb42,_0x5780e9){var _0x401d0b=[];switch(_0x56eb42[_0x32ef('0x4')]()){case _0x32ef('0x3'):switch(_0x5780e9[_0x32ef('0x4')]()){case'inbound':_0x401d0b=[{'type':_0x32ef('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x32ef('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x32ef('0x6'),'variableName':_0x32ef('0x7')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x32ef('0x6'),'variableName':'calleridname'},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0xd'),'keyType':_0x32ef('0x6'),'variableName':_0x32ef('0xe')},{'type':'keyValue','content':'','key':'Queue','keyType':'variable','variableName':_0x32ef('0xf')},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x10'),'keyType':'variable','variableName':'uniqueid'},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x11'),'keyType':_0x32ef('0x6'),'variableName':'agentcalledAt'},{'type':_0x32ef('0x1'),'content':_0x32ef('0x12'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x32ef('0x13'),'keyType':_0x32ef('0x6'),'variableName':_0x32ef('0x14')},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x15'),'keyType':_0x32ef('0x6'),'variableName':'destcalleridnum'},{'type':_0x32ef('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x16'),'keyType':'variable','variableName':_0x32ef('0x17')},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x18'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x19'),'keyType':_0x32ef('0x6'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x32ef('0x1a'),'keyType':'variable','variableName':'holdtime'},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x1b'),'keyType':_0x32ef('0x6'),'variableName':_0x32ef('0x1c')}];break;case _0x32ef('0x8'):_0x401d0b=[{'type':_0x32ef('0x1'),'content':_0x32ef('0x1d'),'variableName':null},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x1e'),'keyType':_0x32ef('0x6'),'keyContent':'','variableName':_0x32ef('0xa')},{'type':_0x32ef('0xc'),'content':'','key':'Member\x20Name','keyType':_0x32ef('0x6'),'keyContent':'','variableName':_0x32ef('0x1f')},{'type':'keyValue','content':'','key':_0x32ef('0x10'),'keyType':_0x32ef('0x6'),'keyContent':'','variableName':_0x32ef('0x20')},{'type':_0x32ef('0xc'),'content':'','key':'Date','keyType':_0x32ef('0x6'),'keyContent':'','variableName':_0x32ef('0x21')},{'type':_0x32ef('0x1'),'content':_0x32ef('0x22')},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x23'),'keyType':_0x32ef('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0x32ef('0xc'),'content':'','key':'Complete\x20Time','keyType':_0x32ef('0x6'),'keyContent':'','variableName':_0x32ef('0x24')},{'type':'keyValue','content':'','key':_0x32ef('0x25'),'keyType':_0x32ef('0x6'),'keyContent':'','variableName':_0x32ef('0x26')},{'type':_0x32ef('0xc'),'content':'','key':_0x32ef('0x27'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x401d0b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 5f512ab..f859d79 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 _0xa5ad=['Interaction','findOne','update','then','catch','error','tracked','user','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null'];(function(_0x3823d1,_0x17b96f){var _0xe51d0f=function(_0x29f5aa){while(--_0x29f5aa){_0x3823d1['push'](_0x3823d1['shift']());}};_0xe51d0f(++_0x17b96f);}(_0xa5ad,0xa3));var _0xda5a=function(_0x24a01c,_0x1f84fc){_0x24a01c=_0x24a01c-0x0;var _0x2920a8=_0xa5ad[_0x24a01c];return _0x2920a8;};'use strict';var _=require(_0xda5a('0x0'));var db=require(_0xda5a('0x1'))['db'];var loggers={'openchannel':require(_0xda5a('0x2'))(_0xda5a('0x3')),'mail':require(_0xda5a('0x2'))(_0xda5a('0x4')),'fax':require(_0xda5a('0x2'))(_0xda5a('0x5')),'sms':require(_0xda5a('0x2'))(_0xda5a('0x6')),'chat':require(_0xda5a('0x2'))(_0xda5a('0x7'))};function getInteractionId(_0x3ce8b5,_0x5714a0,_0x3b73f9){if(_0x3ce8b5&&_0x3ce8b5[_[_0xda5a('0x8')](_0x3b73f9)+_0xda5a('0x9')]){return _0x3ce8b5[_[_0xda5a('0x8')](_0x3b73f9)+_0xda5a('0x9')];}else if(_0x3ce8b5&&_0x3ce8b5['id']){return _0x3ce8b5['id'];}else if(_0x5714a0&&_0x5714a0['id']){return _0x5714a0['id'];}else{return'unknown';}}function log(_0x1c34e9,_0x3cf731,_0x3810a2,_0x1750df,_0x7c18b9,_0xb0f037){loggers[_0x7c18b9[_0xda5a('0xa')]()][_0x1c34e9](_0xda5a('0xb'),_0xb0f037[_0xda5a('0xc')](),_0x3cf731?_0x3cf731['id']:null,_0x3cf731?_0x3cf731[_0xda5a('0xd')]:null,_0x3cf731?_0x3cf731[_0xda5a('0xe')]:null,getInteractionId(_0x3810a2,_0x1750df,_0x7c18b9),_0x3810a2?JSON[_0xda5a('0xf')](_0x3810a2):_0xda5a('0x10'));}function updateUser(_0x356ae4,_0x128263,_0x11865f,_0x27a590,_0x56032f){db[_['upperFirst'](_0x27a590)+_0xda5a('0x11')][_0xda5a('0x12')]({'where':{'id':getInteractionId(_0x128263,_0x11865f,_0x27a590)}})['then'](function(_0x559578){if(_0x559578){return _0x559578[_0xda5a('0x13')]({'UserId':_0x356ae4?_0x356ae4['id']:null});}})[_0xda5a('0x14')](function(_0x6b9805){if(_0x6b9805){log('info',_0x356ae4,_0x128263,_0x11865f,_0x27a590,_0x56032f);}})[_0xda5a('0x15')](function(){log(_0xda5a('0x16'),_0x356ae4,_0x128263,_0x11865f,_0x27a590,_0x56032f);});}exports[_0xda5a('0x17')]=function(_0x283cca,_0x327d19){return function(_0xcbda07,_0x41bd06,_0x1df692){var _0x117c4b=_0xcbda07[_0xda5a('0x18')];var _0x53a220={};var _0x466eb5=_0xcbda07['query'];if(_0x53a220){_0x53a220=_['clone'](_0xcbda07[_0xda5a('0x19')]);_0x53a220=_[_0xda5a('0x1a')](_0x53a220,['body',_0xda5a('0x1b'),_0xda5a('0x1c'),'fax',_0xda5a('0x1d')]);}updateUser(_0x117c4b,_0x53a220,_0x466eb5,_0x283cca,_0x327d19);_0x1df692(null);};}; \ No newline at end of file +var _0x3f8a=['html','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','Interaction','findOne','then','update','catch','error','tracked','user','query','clone','body','omit'];(function(_0x1c7f36,_0x154f47){var _0x4c1dad=function(_0x2179d8){while(--_0x2179d8){_0x1c7f36['push'](_0x1c7f36['shift']());}};_0x4c1dad(++_0x154f47);}(_0x3f8a,0x1a6));var _0xa3f8=function(_0x150250,_0x2fe1f4){_0x150250=_0x150250-0x0;var _0xc76dcf=_0x3f8a[_0x150250];return _0xc76dcf;};'use strict';var _=require(_0xa3f8('0x0'));var db=require(_0xa3f8('0x1'))['db'];var loggers={'openchannel':require(_0xa3f8('0x2'))(_0xa3f8('0x3')),'mail':require(_0xa3f8('0x2'))(_0xa3f8('0x4')),'fax':require(_0xa3f8('0x2'))(_0xa3f8('0x5')),'sms':require(_0xa3f8('0x2'))(_0xa3f8('0x6')),'chat':require(_0xa3f8('0x2'))(_0xa3f8('0x7'))};function getInteractionId(_0x344f67,_0xf2008a,_0x5e0b7b){if(_0x344f67&&_0x344f67[_['upperFirst'](_0x5e0b7b)+_0xa3f8('0x8')]){return _0x344f67[_['upperFirst'](_0x5e0b7b)+_0xa3f8('0x8')];}else if(_0x344f67&&_0x344f67['id']){return _0x344f67['id'];}else if(_0xf2008a&&_0xf2008a['id']){return _0xf2008a['id'];}else{return _0xa3f8('0x9');}}function log(_0x128704,_0x241732,_0x5684a,_0x2689b2,_0x57d109,_0x5e38c4){loggers[_0x57d109['toLowerCase']()][_0x128704](_0xa3f8('0xa'),_0x5e38c4['toUpperCase'](),_0x241732?_0x241732['id']:null,_0x241732?_0x241732[_0xa3f8('0xb')]:null,_0x241732?_0x241732[_0xa3f8('0xc')]:null,getInteractionId(_0x5684a,_0x2689b2,_0x57d109),_0x5684a?JSON[_0xa3f8('0xd')](_0x5684a):'null');}function updateUser(_0x3464bc,_0x54b7f2,_0x3ed15d,_0x3c46e6,_0x5b26ad){db[_['upperFirst'](_0x3c46e6)+_0xa3f8('0xe')][_0xa3f8('0xf')]({'where':{'id':getInteractionId(_0x54b7f2,_0x3ed15d,_0x3c46e6)}})[_0xa3f8('0x10')](function(_0x1d677f){if(_0x1d677f){return _0x1d677f[_0xa3f8('0x11')]({'UserId':_0x3464bc?_0x3464bc['id']:null});}})[_0xa3f8('0x10')](function(_0x190008){if(_0x190008){log('info',_0x3464bc,_0x54b7f2,_0x3ed15d,_0x3c46e6,_0x5b26ad);}})[_0xa3f8('0x12')](function(){log(_0xa3f8('0x13'),_0x3464bc,_0x54b7f2,_0x3ed15d,_0x3c46e6,_0x5b26ad);});}exports[_0xa3f8('0x14')]=function(_0x33514f,_0x156745){return function(_0xa9c81c,_0x348c4f,_0x17e55e){var _0x5959cb=_0xa9c81c[_0xa3f8('0x15')];var _0x153b60={};var _0x41f10c=_0xa9c81c[_0xa3f8('0x16')];if(_0x153b60){_0x153b60=_[_0xa3f8('0x17')](_0xa9c81c[_0xa3f8('0x18')]);_0x153b60=_[_0xa3f8('0x19')](_0x153b60,[_0xa3f8('0x18'),_0xa3f8('0x1a'),'phone','fax',_0xa3f8('0x1b')]);}updateUser(_0x5959cb,_0x153b60,_0x41f10c,_0x33514f,_0x156745);_0x17e55e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index bad0e54..d500a34 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 _0x2657=['utf8','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','composable-middleware','../../config/environment','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','final'];(function(_0x5632e9,_0x223f32){var _0x29da2e=function(_0x31dfb7){while(--_0x31dfb7){_0x5632e9['push'](_0x5632e9['shift']());}};_0x29da2e(++_0x223f32);}(_0x2657,0xd1));var _0x7265=function(_0x12671d,_0x2f28c4){_0x12671d=_0x12671d-0x0;var _0x111ce5=_0x2657[_0x12671d];return _0x111ce5;};'use strict';var crypto=require(_0x7265('0x0'));var util=require('util');var compose=require(_0x7265('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x7265('0x2'));function getValueFromLicense(_0x5479d9,_0x565ef8){if(_0x5479d9&&_0x565ef8){if(_0x565ef8['data1']&&_0x565ef8[_0x7265('0x3')]){var _0x3b6abf=_0x565ef8['data1'];var _0x3a781e=_0x565ef8[_0x7265('0x3')];var _0x2003ba=_0x3b6abf[_0x7265('0x4')]('-')[0x4];var _0x43820a=_0x3b6abf[_0x7265('0x4')]('-')[0x0];var _0x4ddca6=crypto[_0x7265('0x5')](_0x7265('0x6'),util[_0x7265('0x7')](_0x7265('0x8'),_0x2003ba,_0x3b6abf,_0x43820a));var _0x407564=_0x4ddca6[_0x7265('0x9')](_0x3a781e,'base64','utf8');_0x407564+=_0x4ddca6[_0x7265('0xa')](_0x7265('0xb'));var _0x5c67f2=JSON['parse'](_0x407564);return _0x5c67f2['hasOwnProperty'](_0x5479d9)?_0x5c67f2[_0x5479d9]:null;}}return null;}function isLimit(_0x56a39d,_0xd1f00e,_0x3ee142,_0x14f431){var _0x44ef66=_0xd1f00e;return compose()['use'](function(_0x258e8d,_0x59b84f,_0x2c8b51){return db['License'][_0x7265('0xc')]({'where':{'id':0x1},'raw':!![]})[_0x7265('0xd')](function(_0x37362a){var _0x4d1b61=getValueFromLicense(_0x56a39d,_0x37362a);return _0x4d1b61?_0x4d1b61:_0x44ef66;})[_0x7265('0xd')](function(_0x464915){_0x44ef66=_0x464915;return _0x3ee142['count'](_0x14f431);})['then'](function(_0x523bdc){if(_0x523bdc>=_0x44ef66){return _0x59b84f[_0x7265('0xe')](0x193)[_0x7265('0xf')]({'message':util[_0x7265('0x7')](_0x7265('0x10'),_0x56a39d)});}_0x2c8b51();})[_0x7265('0x11')](function(_0x5e4e0c){_0x2c8b51(_0x5e4e0c);});});}function isUserLimit(){return isLimit(_0x7265('0x12'),0x1,db[_0x7265('0x13')],{'where':{'$or':[{'role':_0x7265('0x14')},{'role':'user'}]}});}exports[_0x7265('0x15')]=isUserLimit; \ No newline at end of file +var _0xbd49=['../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','composable-middleware'];(function(_0x3c8c65,_0x2820fa){var _0x34df05=function(_0x49cae8){while(--_0x49cae8){_0x3c8c65['push'](_0x3c8c65['shift']());}};_0x34df05(++_0x2820fa);}(_0xbd49,0x86));var _0x9bd4=function(_0x4ed806,_0x4e8f42){_0x4ed806=_0x4ed806-0x0;var _0x242479=_0xbd49[_0x4ed806];return _0x242479;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x9bd4('0x0'));var db=require(_0x9bd4('0x1'))['db'];var config=require(_0x9bd4('0x2'));function getValueFromLicense(_0x5871af,_0x51972b){if(_0x5871af&&_0x51972b){if(_0x51972b[_0x9bd4('0x3')]&&_0x51972b[_0x9bd4('0x4')]){var _0x11224e=_0x51972b['data1'];var _0x368f79=_0x51972b[_0x9bd4('0x4')];var _0x25567a=_0x11224e[_0x9bd4('0x5')]('-')[0x4];var _0x3e9191=_0x11224e['split']('-')[0x0];var _0x1fcc9b=crypto[_0x9bd4('0x6')](_0x9bd4('0x7'),util[_0x9bd4('0x8')](_0x9bd4('0x9'),_0x25567a,_0x11224e,_0x3e9191));var _0x51e232=_0x1fcc9b[_0x9bd4('0xa')](_0x368f79,'base64','utf8');_0x51e232+=_0x1fcc9b[_0x9bd4('0xb')](_0x9bd4('0xc'));var _0x4180eb=JSON[_0x9bd4('0xd')](_0x51e232);return _0x4180eb[_0x9bd4('0xe')](_0x5871af)?_0x4180eb[_0x5871af]:null;}}return null;}function isLimit(_0x3d0b27,_0x322101,_0x3baca1,_0x1486b7){var _0x35aff9=_0x322101;return compose()[_0x9bd4('0xf')](function(_0x451c9b,_0x4897f6,_0x303cdc){return db[_0x9bd4('0x10')][_0x9bd4('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x313c67){var _0x15e5f2=getValueFromLicense(_0x3d0b27,_0x313c67);return _0x15e5f2?_0x15e5f2:_0x35aff9;})[_0x9bd4('0x12')](function(_0x25fd07){_0x35aff9=_0x25fd07;return _0x3baca1[_0x9bd4('0x13')](_0x1486b7);})[_0x9bd4('0x12')](function(_0x4d4553){if(_0x4d4553>=_0x35aff9){return _0x4897f6[_0x9bd4('0x14')](0x193)['json']({'message':util[_0x9bd4('0x8')](_0x9bd4('0x15'),_0x3d0b27)});}_0x303cdc();})['catch'](function(_0x4f5463){_0x303cdc(_0x4f5463);});});}function isUserLimit(){return isLimit(_0x9bd4('0x16'),0x1,db[_0x9bd4('0x17')],{'where':{'$or':[{'role':_0x9bd4('0x18')},{'role':_0x9bd4('0x19')}]}});}exports[_0x9bd4('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4a10ef3..b5c5645 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 _0x93f5=['substr','ASC','length','omit','isObject','isArray','unset','hasOwnProperty','isNumeric','match','lodash','moment','sequelize','fields','split','filters','isEmpty','forOwn','parse','limit','indexOf','priority','cast','col','unsigned'];(function(_0x3277ff,_0x4407f4){var _0x36d6d3=function(_0x254c4b){while(--_0x254c4b){_0x3277ff['push'](_0x3277ff['shift']());}};_0x36d6d3(++_0x4407f4);}(_0x93f5,0xa0));var _0x593f=function(_0x5bc9e3,_0xcf2ce8){_0x5bc9e3=_0x5bc9e3-0x0;var _0x35bac1=_0x93f5[_0x5bc9e3];return _0x35bac1;};'use strict';var _=require(_0x593f('0x0'));var moment=require(_0x593f('0x1'));var sequelize=require(_0x593f('0x2'));var LIMIT_VALUE=0xfa;exports[_0x593f('0x3')]=function(_0x5d00e9){var _0x35546e=null;if(_0x5d00e9){_0x35546e=_0x5d00e9[_0x593f('0x4')](',');}return _0x35546e;};exports[_0x593f('0x5')]=function(_0x285a8b){var _0x15fc8a={};if(!_[_0x593f('0x6')](_0x285a8b)){_0x15fc8a={};_[_0x593f('0x7')](_0x285a8b,function(_0x3c465a,_0x581d0a){try{_0x15fc8a[_0x581d0a]=_['isArray'](_0x3c465a)?_0x3c465a:JSON[_0x593f('0x8')](_0x3c465a);}catch(_0x5ef03f){_0x15fc8a[_0x581d0a]=_0x3c465a[_0x593f('0x4')](',');}});}return _0x15fc8a;};exports[_0x593f('0x9')]=function(_0x5bc1f6){_0x5bc1f6=parseInt(_0x5bc1f6,0xa);if(!_0x5bc1f6||_0x5bc1f6<0x0){_0x5bc1f6=LIMIT_VALUE;}return _0x5bc1f6;};exports['offset']=function(_0x34b100){_0x34b100=parseInt(_0x34b100,0xa);if(!_0x34b100||_0x34b100<0x0){_0x34b100=0x0;}return _0x34b100;};exports['sort']=function(_0x362818){var _0x5ca3bf,_0x1a76e8=null;if(_0x362818){_0x5ca3bf=_0x362818[_0x593f('0x4')](',');_0x1a76e8=_['map'](_0x5ca3bf,function(_0x2d3732){if(_0x2d3732[_0x593f('0xa')]('-')===0x0){return[_0x2d3732===_0x593f('0xb')?sequelize[_0x593f('0xc')](sequelize[_0x593f('0xd')]('priority'),_0x593f('0xe')):_0x2d3732[_0x593f('0xf')](0x1),'DESC'];}else{return[_0x2d3732==='priority'?sequelize[_0x593f('0xc')](sequelize['col'](_0x593f('0xb')),'unsigned'):_0x2d3732,_0x593f('0x10')];}});}return _0x1a76e8;};exports['omit']=function(_0x5369ff,_0x3f5b88){if(_[_0x593f('0x6')](_0x5369ff)){return _0x5369ff;}if(_['isArray'](_0x5369ff)){for(var _0x4241a8=0x0;_0x4241a8<_0x5369ff[_0x593f('0x11')];_0x4241a8+=0x1){_0x5369ff[_0x4241a8]=this[_0x593f('0x12')](_0x5369ff[_0x4241a8],_0x3f5b88);}return _0x5369ff;}if(!_[_0x593f('0x13')](_0x5369ff)){return _0x5369ff;}if(_['isString'](_0x3f5b88)){_0x3f5b88=[_0x3f5b88];}if(!_[_0x593f('0x14')](_0x3f5b88)){return _0x5369ff;}for(var _0x25437e=0x0;_0x25437e<_0x3f5b88[_0x593f('0x11')];_0x25437e+=0x1){_[_0x593f('0x15')](_0x5369ff,_0x3f5b88[_0x25437e]);}for(var _0x268eab in _0x5369ff){if(_0x5369ff[_0x593f('0x16')](_0x268eab)){_0x5369ff[_0x268eab]=this[_0x593f('0x12')](_0x5369ff[_0x268eab],_0x3f5b88);}}return _0x5369ff;};exports[_0x593f('0x17')]=function(_0x18a5eb){return _0x18a5eb['match'](RegExp('^[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x1c2355){return _0x1c2355[_0x593f('0x18')](/^\S+@\S+$/)?!![]:![];}; \ No newline at end of file +var _0xd647=['sequelize','fields','split','filters','forOwn','parse','limit','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','isEmpty','isArray','length','isObject','unset','isNumeric','^[0-9]*$','match','lodash','moment'];(function(_0x35047c,_0x12eb2c){var _0x5039a6=function(_0x682687){while(--_0x682687){_0x35047c['push'](_0x35047c['shift']());}};_0x5039a6(++_0x12eb2c);}(_0xd647,0x19e));var _0x7d64=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xd647[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x7d64('0x0'));var moment=require(_0x7d64('0x1'));var sequelize=require(_0x7d64('0x2'));var LIMIT_VALUE=0xfa;exports[_0x7d64('0x3')]=function(_0x2a7f3f){var _0x2f7dcf=null;if(_0x2a7f3f){_0x2f7dcf=_0x2a7f3f[_0x7d64('0x4')](',');}return _0x2f7dcf;};exports[_0x7d64('0x5')]=function(_0x3beaa5){var _0x64c75b={};if(!_['isEmpty'](_0x3beaa5)){_0x64c75b={};_[_0x7d64('0x6')](_0x3beaa5,function(_0x51f1f2,_0x4692f9){try{_0x64c75b[_0x4692f9]=_['isArray'](_0x51f1f2)?_0x51f1f2:JSON[_0x7d64('0x7')](_0x51f1f2);}catch(_0x2ac703){_0x64c75b[_0x4692f9]=_0x51f1f2['split'](',');}});}return _0x64c75b;};exports[_0x7d64('0x8')]=function(_0x38708c){_0x38708c=parseInt(_0x38708c,0xa);if(!_0x38708c||_0x38708c<0x0){_0x38708c=LIMIT_VALUE;}return _0x38708c;};exports['offset']=function(_0x218c95){_0x218c95=parseInt(_0x218c95,0xa);if(!_0x218c95||_0x218c95<0x0){_0x218c95=0x0;}return _0x218c95;};exports['sort']=function(_0x29333e){var _0x10fa5e,_0x208322=null;if(_0x29333e){_0x10fa5e=_0x29333e[_0x7d64('0x4')](',');_0x208322=_[_0x7d64('0x9')](_0x10fa5e,function(_0x4057b5){if(_0x4057b5[_0x7d64('0xa')]('-')===0x0){return[_0x4057b5===_0x7d64('0xb')?sequelize[_0x7d64('0xc')](sequelize[_0x7d64('0xd')](_0x7d64('0xb')),_0x7d64('0xe')):_0x4057b5[_0x7d64('0xf')](0x1),'DESC'];}else{return[_0x4057b5===_0x7d64('0xb')?sequelize[_0x7d64('0xc')](sequelize[_0x7d64('0xd')](_0x7d64('0xb')),_0x7d64('0xe')):_0x4057b5,_0x7d64('0x10')];}});}return _0x208322;};exports[_0x7d64('0x11')]=function(_0x4d9397,_0x2e61cc){if(_[_0x7d64('0x12')](_0x4d9397)){return _0x4d9397;}if(_[_0x7d64('0x13')](_0x4d9397)){for(var _0x252b93=0x0;_0x252b93<_0x4d9397[_0x7d64('0x14')];_0x252b93+=0x1){_0x4d9397[_0x252b93]=this[_0x7d64('0x11')](_0x4d9397[_0x252b93],_0x2e61cc);}return _0x4d9397;}if(!_[_0x7d64('0x15')](_0x4d9397)){return _0x4d9397;}if(_['isString'](_0x2e61cc)){_0x2e61cc=[_0x2e61cc];}if(!_[_0x7d64('0x13')](_0x2e61cc)){return _0x4d9397;}for(var _0x1bca57=0x0;_0x1bca57<_0x2e61cc[_0x7d64('0x14')];_0x1bca57+=0x1){_[_0x7d64('0x16')](_0x4d9397,_0x2e61cc[_0x1bca57]);}for(var _0x21c491 in _0x4d9397){if(_0x4d9397['hasOwnProperty'](_0x21c491)){_0x4d9397[_0x21c491]=this[_0x7d64('0x11')](_0x4d9397[_0x21c491],_0x2e61cc);}}return _0x4d9397;};exports[_0x7d64('0x17')]=function(_0x33ad1b){return _0x33ad1b['match'](RegExp(_0x7d64('0x18')))?!![]:![];};exports['isEmail']=function(_0x157e01){return _0x157e01[_0x7d64('0x19')](/^\S+@\S+$/)?!![]:![];}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 21aedc5..5ae6cba 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['test','client','set','json\x20replacer','split','static','get','views','/server/views','engine','html','renderFile','view\x20engine','json','50mb','initialize','express','serve-favicon','body-parser','errorhandler','path','passport','cors','./environment','default','env','production','use','join','root','public','favicon.ico','development'];(function(_0x8e0b2,_0x4b9375){var _0x25cb00=function(_0x11b5ff){while(--_0x11b5ff){_0x8e0b2['push'](_0x8e0b2['shift']());}};_0x25cb00(++_0x4b9375);}(_0x70e0,0x17b));var _0x070e=function(_0x569e6c,_0x149259){_0x569e6c=_0x569e6c-0x0;var _0x9a5cbb=_0x70e0[_0x569e6c];return _0x9a5cbb;};'use strict';var express=require(_0x070e('0x0'));var favicon=require(_0x070e('0x1'));var bodyParser=require(_0x070e('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x070e('0x3'));var path=require(_0x070e('0x4'));var passport=require(_0x070e('0x5'));var cors=require(_0x070e('0x6'));var moment=require('moment');var config=require(_0x070e('0x7'));var db=require('../mysqldb')['db'];exports[_0x070e('0x8')]=function(_0x4b041d){var _0x56e420=_0x4b041d['get'](_0x070e('0x9'));if(_0x56e420===_0x070e('0xa')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe'),_0x070e('0xf'))));_0x4b041d['set']('appPath',path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe')));}if(_0x56e420===_0x070e('0x10')||_0x56e420===_0x070e('0x11')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0x12'),_0x070e('0xf'))));_0x4b041d[_0x070e('0x13')]('appPath',path['join'](config[_0x070e('0xd')],'client'));_0x4b041d['use'](errorHandler());}_0x4b041d['set'](_0x070e('0x14'),function(_0x14c3fd,_0x51d14d){if(this[_0x14c3fd]instanceof Date){_0x51d14d=this[_0x14c3fd]['toISOString']()[_0x070e('0x15')]('.')[0x0]+'Z';}return _0x51d14d;});_0x4b041d[_0x070e('0xb')](express[_0x070e('0x16')](_0x4b041d[_0x070e('0x17')]('appPath')));_0x4b041d['set'](_0x070e('0x18'),config[_0x070e('0xd')]+_0x070e('0x19'));_0x4b041d[_0x070e('0x1a')](_0x070e('0x1b'),require('ejs')[_0x070e('0x1c')]);_0x4b041d[_0x070e('0x13')](_0x070e('0x1d'),_0x070e('0x1b'));_0x4b041d[_0x070e('0xb')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4b041d['use'](bodyParser[_0x070e('0x1e')]({'limit':_0x070e('0x1f')}));_0x4b041d[_0x070e('0xb')](cors());_0x4b041d['use'](methodOverride());_0x4b041d[_0x070e('0xb')](cookieParser());_0x4b041d['use'](passport[_0x070e('0x20')]());}; \ No newline at end of file +var _0xe706=['toISOString','engine','html','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','use','join','root','public','favicon.ico','set','appPath','client'];(function(_0x90e47a,_0x487ab7){var _0x6c2ea9=function(_0x1db0c0){while(--_0x1db0c0){_0x90e47a['push'](_0x90e47a['shift']());}};_0x6c2ea9(++_0x487ab7);}(_0xe706,0xa3));var _0x6e70=function(_0x15caa5,_0x206c67){_0x15caa5=_0x15caa5-0x0;var _0x1200c7=_0xe706[_0x15caa5];return _0x1200c7;};'use strict';var express=require(_0x6e70('0x0'));var favicon=require(_0x6e70('0x1'));var bodyParser=require(_0x6e70('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x6e70('0x3'));var errorHandler=require(_0x6e70('0x4'));var path=require(_0x6e70('0x5'));var passport=require(_0x6e70('0x6'));var cors=require(_0x6e70('0x7'));var moment=require(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var db=require(_0x6e70('0xa'))['db'];exports[_0x6e70('0xb')]=function(_0x4381d1){var _0x36357b=_0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'));if(_0x36357b===_0x6e70('0xe')){_0x4381d1[_0x6e70('0xf')](favicon(path[_0x6e70('0x10')](config[_0x6e70('0x11')],_0x6e70('0x12'),_0x6e70('0x13'))));_0x4381d1[_0x6e70('0x14')](_0x6e70('0x15'),path[_0x6e70('0x10')](config[_0x6e70('0x11')],_0x6e70('0x12')));}if(_0x36357b==='development'||_0x36357b==='test'){_0x4381d1[_0x6e70('0xf')](favicon(path[_0x6e70('0x10')](config[_0x6e70('0x11')],_0x6e70('0x16'),_0x6e70('0x13'))));_0x4381d1[_0x6e70('0x14')](_0x6e70('0x15'),path[_0x6e70('0x10')](config['root'],'client'));_0x4381d1['use'](errorHandler());}_0x4381d1[_0x6e70('0x14')]('json\x20replacer',function(_0x53aed0,_0x304716){if(this[_0x53aed0]instanceof Date){_0x304716=this[_0x53aed0][_0x6e70('0x17')]()['split']('.')[0x0]+'Z';}return _0x304716;});_0x4381d1[_0x6e70('0xf')](express['static'](_0x4381d1[_0x6e70('0xc')](_0x6e70('0x15'))));_0x4381d1['set']('views',config[_0x6e70('0x11')]+'/server/views');_0x4381d1[_0x6e70('0x18')](_0x6e70('0x19'),require('ejs')['renderFile']);_0x4381d1[_0x6e70('0x14')](_0x6e70('0x1a'),_0x6e70('0x19'));_0x4381d1[_0x6e70('0xf')](bodyParser[_0x6e70('0x1b')]({'limit':_0x6e70('0x1c'),'extended':!![]}));_0x4381d1[_0x6e70('0xf')](bodyParser[_0x6e70('0x1d')]({'limit':_0x6e70('0x1c')}));_0x4381d1[_0x6e70('0xf')](cors());_0x4381d1['use'](methodOverride());_0x4381d1[_0x6e70('0xf')](cookieParser());_0x4381d1[_0x6e70('0xf')](passport[_0x6e70('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 151515a..6989653 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 _0x74cb=['createHash','md5','hex','getUuid','platform','win32','replace','hostname','ipAddress','update','digest','substring','crypto','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','mac','127.0.0.1','getFirstInterface','map','join'];(function(_0x223b71,_0x597bfb){var _0x4131e4=function(_0x411d23){while(--_0x411d23){_0x223b71['push'](_0x223b71['shift']());}};_0x4131e4(++_0x597bfb);}(_0x74cb,0xf6));var _0xb74c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x74cb[_0x3635ce];return _0x97ecd0;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xb74c('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xb74c('0x1')];function getInterfaces(){var _0x57dc=[];var _0x2c8808=os[_0xb74c('0x2')]();var _0xfe6a07=_[_0xb74c('0x3')](_[_0xb74c('0x4')](_0x2c8808));for(var _0x4f68ee=0x0;_0x4f68ee<_0xfe6a07[_0xb74c('0x5')];_0x4f68ee++){var _0x4c4535=_0x2c8808[_0xfe6a07[_0x4f68ee]][_0xb74c('0x6')](function(_0x38010a){return _0x38010a[_0xb74c('0x7')]===_0xb74c('0x8')&&_0x38010a['internal']===![];});_0x57dc=_0x57dc['concat'](_0x4c4535);}return _0x57dc;}function getFirstInterface(){var _0x201247=_['head'](getInterfaces());return{'macAddress':_0x201247&&_0x201247[_0xb74c('0x9')]?_0x201247[_0xb74c('0x9')]:'00:00:00:00:00:00','ipAddress':_0x201247&&_0x201247['address']?_0x201247['address']:_0xb74c('0xa')};}exports[_0xb74c('0xb')]=getFirstInterface;function getCPUhash(){var _0x128765=_[_0xb74c('0x3')](os['cpus']()[_0xb74c('0xc')](function(_0x184ab9){return _0x184ab9['model'];}))[_0xb74c('0xd')](':');return crypto[_0xb74c('0xe')](_0xb74c('0xf'))['update'](_0x128765)['digest'](_0xb74c('0x10'));}exports[_0xb74c('0x11')]=function(){switch(os[_0xb74c('0x12')]()){case _0xb74c('0x13'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xb74c('0x14')]('\x0d\x0a','');default:var _0xb1bac9=getFirstInterface();var _0x551d96=getCPUhash();var _0x395c41=_0x551d96+'|'+os[_0xb74c('0x15')]()+'|'+_0xb1bac9['macAddress']+'|'+_0xb1bac9[_0xb74c('0x16')];var _0x20209a=crypto[_0xb74c('0xe')](_0xb74c('0xf'))[_0xb74c('0x17')](_0x395c41)[_0xb74c('0x18')]('hex');return _0x20209a[_0xb74c('0x19')](0x0,0x8)+'-'+_0x20209a['substring'](0x8,0xc)+'-'+_0x20209a[_0xb74c('0x19')](0xc,0x10)+'-'+_0x20209a[_0xb74c('0x19')](0x10,0x14)+'-'+_0x20209a[_0xb74c('0x19')](0x14);}}; \ No newline at end of file +var _0x36b6=['replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','model','join','createHash','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x36b6,0x1bf));var _0x636b=function(_0x2802c2,_0x3ae05e){_0x2802c2=_0x2802c2-0x0;var _0x466800=_0x36b6[_0x2802c2];return _0x466800;};'use strict';var _=require(_0x636b('0x0'));var os=require('os');var crypto=require(_0x636b('0x1'));var machine=require(_0x636b('0x2'));var exec=require('child_process')[_0x636b('0x3')];function getInterfaces(){var _0x3cae26=[];var _0x220adb=os[_0x636b('0x4')]();var _0x2717c0=_[_0x636b('0x5')](_[_0x636b('0x6')](_0x220adb));for(var _0x49b2e2=0x0;_0x49b2e2<_0x2717c0['length'];_0x49b2e2++){var _0x127745=_0x220adb[_0x2717c0[_0x49b2e2]][_0x636b('0x7')](function(_0x3d749d){return _0x3d749d[_0x636b('0x8')]===_0x636b('0x9')&&_0x3d749d['internal']===![];});_0x3cae26=_0x3cae26[_0x636b('0xa')](_0x127745);}return _0x3cae26;}function getFirstInterface(){var _0x3b7f0b=_[_0x636b('0xb')](getInterfaces());return{'macAddress':_0x3b7f0b&&_0x3b7f0b[_0x636b('0xc')]?_0x3b7f0b[_0x636b('0xc')]:_0x636b('0xd'),'ipAddress':_0x3b7f0b&&_0x3b7f0b[_0x636b('0xe')]?_0x3b7f0b[_0x636b('0xe')]:_0x636b('0xf')};}exports[_0x636b('0x10')]=getFirstInterface;function getCPUhash(){var _0x264ca9=_['orderBy'](os['cpus']()['map'](function(_0x1ec435){return _0x1ec435[_0x636b('0x11')];}))[_0x636b('0x12')](':');return crypto[_0x636b('0x13')](_0x636b('0x14'))[_0x636b('0x15')](_0x264ca9)[_0x636b('0x16')](_0x636b('0x17'));}exports[_0x636b('0x18')]=function(){switch(os[_0x636b('0x19')]()){case _0x636b('0x1a'):return exec(_0x636b('0x1b'),{'encoding':_0x636b('0x1c')})[_0x636b('0x1d')]('\x0d\x0a','');default:var _0x1584c7=getFirstInterface();var _0x3db5c0=getCPUhash();var _0x1eeeab=_0x3db5c0+'|'+os[_0x636b('0x1e')]()+'|'+_0x1584c7[_0x636b('0x1f')]+'|'+_0x1584c7[_0x636b('0x20')];var _0x1124fb=crypto['createHash']('md5')['update'](_0x1eeeab)[_0x636b('0x16')]('hex');return _0x1124fb[_0x636b('0x21')](0x0,0x8)+'-'+_0x1124fb[_0x636b('0x21')](0x8,0xc)+'-'+_0x1124fb[_0x636b('0x21')](0xc,0x10)+'-'+_0x1124fb[_0x636b('0x21')](0x10,0x14)+'-'+_0x1124fb[_0x636b('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index cc63d93..8c77275 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 _0x3fb5=['|name|','|email|','getFirstInterface','openIssue','MOTLICENSE','get','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','../logger','license','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','session','update','utf8','createDecipher','aes-256-ctr','secrets','base64','final','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|uuid|','|machineUuid|'];(function(_0x54671f,_0x24b051){var _0x273293=function(_0x57b952){while(--_0x57b952){_0x54671f['push'](_0x54671f['shift']());}};_0x273293(++_0x24b051);}(_0x3fb5,0x8d));var _0x53fb=function(_0x264a51,_0x33180e){_0x264a51=_0x264a51-0x0;var _0x3e80fa=_0x3fb5[_0x264a51];return _0x3e80fa;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require('moment');var rp=require(_0x53fb('0x0'));var BPromise=require(_0x53fb('0x1'));var pkginfo=require(_0x53fb('0x2'))(module,_0x53fb('0x3'));var db=require(_0x53fb('0x4'))['db'];var config=require(_0x53fb('0x5'));var hardware=require('./hardware');var logger=require(_0x53fb('0x6'))(_0x53fb('0x7'));var jira=require('../../api/jira/jira.controller');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x360285){return new BPromise(function(_0x3c8d4a,_0x15da86){var _0x302cf2=util[_0x53fb('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x360285,module[_0x53fb('0x9')][_0x53fb('0x3')]);if(oldToken){_0x302cf2=util[_0x53fb('0x8')](_0x53fb('0xa'),HOST,_0x360285,module[_0x53fb('0x9')]['version'],oldToken);}var _0x45de8d={'uri':_0x302cf2,'method':_0x53fb('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x45de8d)[_0x53fb('0xc')](function(_0x37678a){_0x3c8d4a(_0x37678a);})['catch'](function(_0x2fc852){_0x15da86(_0x2fc852);});});}function encryptDate(_0x4638b0){var _0x4bd184=crypto[_0x53fb('0xd')]('aes-256-ctr',config['secrets'][_0x53fb('0xe')]);var _0x2cb00e=_0x4bd184[_0x53fb('0xf')](_0x4638b0,_0x53fb('0x10'),'base64');_0x2cb00e+=_0x4bd184['final']('base64');return _0x2cb00e;}function decryptDate(_0x1a34a0){var _0x21014e=crypto[_0x53fb('0x11')](_0x53fb('0x12'),config[_0x53fb('0x13')][_0x53fb('0xe')]);var _0x1ffc10=_0x21014e[_0x53fb('0xf')](_0x1a34a0,_0x53fb('0x14'),_0x53fb('0x10'));_0x1ffc10+=_0x21014e[_0x53fb('0x15')](_0x53fb('0x10'));return _0x1ffc10;}function sendJiraAlert(_0x33fc1c,_0x38ff4d,_0x2df61c){var _0x5b04b9=_0x53fb('0x16');return db[_0x53fb('0x17')][_0x53fb('0x18')]({'where':{'role':_0x53fb('0x19')},'attributes':[_0x53fb('0x1a'),_0x53fb('0x1b')],'raw':!![]})[_0x53fb('0xc')](function(_0x3dec56){ADMIN=_0x3dec56;_0x5b04b9+='|reason|'+_0x2df61c+'|\x0a';_0x5b04b9+=_0x53fb('0x1c')+_0x33fc1c+'|\x0a';_0x5b04b9+=_0x53fb('0x1d')+_0x38ff4d+'|\x0a';_0x5b04b9+=_0x53fb('0x1e')+ADMIN[_0x53fb('0x1a')]+'|\x0a';_0x5b04b9+=_0x53fb('0x1f')+ADMIN['email']+'|\x0a';return _0x5b04b9;})[_0x53fb('0xc')](function(_0x4a1eb5){var _0x2b0187=hardware[_0x53fb('0x20')]()['ipAddress'];return jira[_0x53fb('0x21')]({'key':_0x53fb('0x22'),'summary':'Motion\x20License\x20Alert','description':_0x4a1eb5,'issuetype':'Alert','oldToken':_0x33fc1c,'newToken':_0x38ff4d,'email':ADMIN[_0x53fb('0x1b')],'name':ADMIN[_0x53fb('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x2b0187});});}function manageLicense(_0x2fe33d,_0x7d16ac){var _0x1b68c9=_0x7d16ac[_0x53fb('0x23')]({'plain':!![]});httpRequest(_0x2fe33d)[_0x53fb('0xc')](function(_0x4b5ccb){if(oldToken){oldToken=undefined;}if(_0x4b5ccb['active']){if(!_0x1b68c9['license']&&_0x1b68c9[_0x53fb('0x7')]!=_0x4b5ccb[_0x53fb('0x7')]||_0x1b68c9[_0x53fb('0x7')]&&_0x1b68c9[_0x53fb('0x24')]){logger['info'](_0x53fb('0x25'));}if(_0x1b68c9[_0x53fb('0x7')]&&!_0x1b68c9[_0x53fb('0x24')]&&_0x1b68c9[_0x53fb('0x7')]!=_0x4b5ccb[_0x53fb('0x7')]){logger[_0x53fb('0x26')](_0x53fb('0x27'));}if(_0x1b68c9[_0x53fb('0x7')]&&!_0x1b68c9[_0x53fb('0x24')]&&_0x1b68c9['license']==_0x4b5ccb[_0x53fb('0x7')]){return _0x7d16ac;}return _0x7d16ac['update']({'data1':_0x2fe33d,'data2':null,'license':_0x4b5ccb[_0x53fb('0x7')]});}else{if(_0x4b5ccb['license']||_0x1b68c9[_0x53fb('0x7')]){if(!_0x1b68c9[_0x53fb('0x24')]){if(_0x1b68c9[_0x53fb('0x28')]==_0x2fe33d){GRAY_PERIOD_REASON=_0x53fb('0x29');logger['info'](_0x53fb('0x2a'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x1b68c9['data1'];logger[_0x53fb('0x26')](_0x53fb('0x2b'),_0x1b68c9[_0x53fb('0x28')],_0x2fe33d);}sendJiraAlert(_0x1b68c9[_0x53fb('0x28')],_0x4b5ccb[_0x53fb('0x2c')],GRAY_PERIOD_REASON);logger[_0x53fb('0x26')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x53fb('0x2d')](),moment()['format'](_0x53fb('0x2e')));return _0x7d16ac[_0x53fb('0xf')]({'data2':encryptDate(moment()[_0x53fb('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x53fb('0x2f')](decryptDate(_0x1b68c9['data2']),_0x53fb('0x30'))>DAYS){logger[_0x53fb('0x26')](_0x53fb('0x31'),moment()[_0x53fb('0x8')](_0x53fb('0x2e')));return _0x7d16ac[_0x53fb('0xf')]({'data1':_0x2fe33d,'data2':null,'license':null});}}}else{if(_0x1b68c9[_0x53fb('0x28')]!=_0x2fe33d){logger['info'](_0x53fb('0x2b'),_0x1b68c9[_0x53fb('0x28')],_0x2fe33d);return _0x7d16ac[_0x53fb('0xf')]({'data1':_0x2fe33d,'data2':null,'license':null});}}}return _0x7d16ac;})[_0x53fb('0xc')](function(_0x12ad5a){_0x7d16ac=_0x12ad5a;})['catch'](function(_0x38c92e){logger[_0x53fb('0x32')](_0x38c92e[_0x53fb('0x33')]);})[_0x53fb('0x34')](function(){setTimeout(function(){manageLicense(hardware[_0x53fb('0x35')](),_0x7d16ac);},TIME);});}function defaultLicense(){var _0x10fed7=hardware[_0x53fb('0x35')]();if(_0x10fed7){return db[_0x53fb('0x36')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x10fed7}})['spread'](function(_0x571848,_0x517b44){logger[_0x53fb('0x26')](_0x53fb('0x37'),_0x10fed7);manageLicense(_0x10fed7,_0x571848);})['catch'](function(_0x14bd9b){logger[_0x53fb('0x32')](_0x14bd9b['message']);});}}exports[_0x53fb('0x38')]=defaultLicense; \ No newline at end of file +var _0x4689=['YYYY-MM-DD\x20HH:mm','diff','days','error','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','message','default','util','crypto','moment','request-promise','bluebird','pkginfo','version','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','GET','then','aes-256-ctr','secrets','session','update','base64','createDecipher','utf8','User','findOne','admin','fullname','|reason|','|machineUuid|','|name|','|email|','openIssue','MOTLICENSE','Motion\x20License\x20Alert','email','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','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'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x4689,0x132));var _0x9468=function(_0x3093b1,_0x29b1f9){_0x3093b1=_0x3093b1-0x0;var _0x31e7ad=_0x4689[_0x3093b1];return _0x31e7ad;};'use strict';var util=require(_0x9468('0x0'));var crypto=require(_0x9468('0x1'));var moment=require(_0x9468('0x2'));var rp=require(_0x9468('0x3'));var BPromise=require(_0x9468('0x4'));var pkginfo=require(_0x9468('0x5'))(module,_0x9468('0x6'));var db=require('../../mysqldb')['db'];var config=require('../environment');var hardware=require(_0x9468('0x7'));var logger=require(_0x9468('0x8'))(_0x9468('0x9'));var jira=require(_0x9468('0xa'));var HOST=_0x9468('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x11cd08){return new BPromise(function(_0x4befd,_0x4a67a2){var _0x2c1558=util['format'](_0x9468('0xc'),HOST,_0x11cd08,module['exports'][_0x9468('0x6')]);if(oldToken){_0x2c1558=util[_0x9468('0xd')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x11cd08,module['exports']['version'],oldToken);}var _0x23202a={'uri':_0x2c1558,'method':_0x9468('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x23202a)[_0x9468('0xf')](function(_0x2b8ba8){_0x4befd(_0x2b8ba8);})['catch'](function(_0x28253d){_0x4a67a2(_0x28253d);});});}function encryptDate(_0x54a0de){var _0xb7521c=crypto['createCipher'](_0x9468('0x10'),config[_0x9468('0x11')][_0x9468('0x12')]);var _0x2273fd=_0xb7521c[_0x9468('0x13')](_0x54a0de,'utf8',_0x9468('0x14'));_0x2273fd+=_0xb7521c['final'](_0x9468('0x14'));return _0x2273fd;}function decryptDate(_0x56bd38){var _0x49dce0=crypto[_0x9468('0x15')](_0x9468('0x10'),config[_0x9468('0x11')][_0x9468('0x12')]);var _0x415040=_0x49dce0['update'](_0x56bd38,_0x9468('0x14'),_0x9468('0x16'));_0x415040+=_0x49dce0['final'](_0x9468('0x16'));return _0x415040;}function sendJiraAlert(_0x2538cf,_0x146733,_0x3d3f38){var _0x292042='||FIELD||VALUE||\x0a';return db[_0x9468('0x17')][_0x9468('0x18')]({'where':{'role':_0x9468('0x19')},'attributes':[_0x9468('0x1a'),'email'],'raw':!![]})[_0x9468('0xf')](function(_0x4b5f4d){ADMIN=_0x4b5f4d;_0x292042+=_0x9468('0x1b')+_0x3d3f38+'|\x0a';_0x292042+='|uuid|'+_0x2538cf+'|\x0a';_0x292042+=_0x9468('0x1c')+_0x146733+'|\x0a';_0x292042+=_0x9468('0x1d')+ADMIN[_0x9468('0x1a')]+'|\x0a';_0x292042+=_0x9468('0x1e')+ADMIN['email']+'|\x0a';return _0x292042;})[_0x9468('0xf')](function(_0xa044a9){var _0x30b441=hardware['getFirstInterface']()['ipAddress'];return jira[_0x9468('0x1f')]({'key':_0x9468('0x20'),'summary':_0x9468('0x21'),'description':_0xa044a9,'issuetype':'Alert','oldToken':_0x2538cf,'newToken':_0x146733,'email':ADMIN[_0x9468('0x22')],'name':ADMIN[_0x9468('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x30b441});});}function manageLicense(_0x1267a5,_0x39bc86){var _0xe233c9=_0x39bc86['get']({'plain':!![]});httpRequest(_0x1267a5)[_0x9468('0xf')](function(_0x486558){if(oldToken){oldToken=undefined;}if(_0x486558[_0x9468('0x23')]){if(!_0xe233c9[_0x9468('0x9')]&&_0xe233c9[_0x9468('0x9')]!=_0x486558[_0x9468('0x9')]||_0xe233c9[_0x9468('0x9')]&&_0xe233c9[_0x9468('0x24')]){logger[_0x9468('0x25')](_0x9468('0x26'));}if(_0xe233c9['license']&&!_0xe233c9[_0x9468('0x24')]&&_0xe233c9[_0x9468('0x9')]!=_0x486558[_0x9468('0x9')]){logger[_0x9468('0x25')](_0x9468('0x27'));}if(_0xe233c9[_0x9468('0x9')]&&!_0xe233c9[_0x9468('0x24')]&&_0xe233c9['license']==_0x486558[_0x9468('0x9')]){return _0x39bc86;}return _0x39bc86[_0x9468('0x13')]({'data1':_0x1267a5,'data2':null,'license':_0x486558[_0x9468('0x9')]});}else{if(_0x486558['license']||_0xe233c9['license']){if(!_0xe233c9[_0x9468('0x24')]){if(_0xe233c9[_0x9468('0x28')]==_0x1267a5){GRAY_PERIOD_REASON=_0x9468('0x29');logger[_0x9468('0x25')](_0x9468('0x2a'));}else{GRAY_PERIOD_REASON=_0x9468('0x2b');oldToken=_0xe233c9[_0x9468('0x28')];logger[_0x9468('0x25')](_0x9468('0x2c'),_0xe233c9[_0x9468('0x28')],_0x1267a5);}sendJiraAlert(_0xe233c9[_0x9468('0x28')],_0x486558[_0x9468('0x2d')],GRAY_PERIOD_REASON);logger[_0x9468('0x25')](_0x9468('0x2e'),GRAY_PERIOD_REASON[_0x9468('0x2f')](),moment()[_0x9468('0xd')](_0x9468('0x30')));return _0x39bc86['update']({'data2':encryptDate(moment()['format'](_0x9468('0x30')))});}else{if(moment()[_0x9468('0x31')](decryptDate(_0xe233c9[_0x9468('0x24')]),_0x9468('0x32'))>DAYS){logger[_0x9468('0x25')]('DEMO\x20START\x20AT\x20%s',moment()[_0x9468('0xd')](_0x9468('0x30')));return _0x39bc86['update']({'data1':_0x1267a5,'data2':null,'license':null});}}}else{if(_0xe233c9[_0x9468('0x28')]!=_0x1267a5){logger[_0x9468('0x25')](_0x9468('0x2c'),_0xe233c9['data1'],_0x1267a5);return _0x39bc86['update']({'data1':_0x1267a5,'data2':null,'license':null});}}}return _0x39bc86;})[_0x9468('0xf')](function(_0x4def5a){_0x39bc86=_0x4def5a;})['catch'](function(_0x5c2260){logger[_0x9468('0x33')](_0x5c2260['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x9468('0x34')](),_0x39bc86);},TIME);});}function defaultLicense(){var _0x228e97=hardware['getUuid']();if(_0x228e97){return db[_0x9468('0x35')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x228e97}})[_0x9468('0x36')](function(_0x2df606,_0x2bc950){logger[_0x9468('0x25')](_0x9468('0x37'),_0x228e97);manageLicense(_0x228e97,_0x2df606);})[_0x9468('0x38')](function(_0x1ae7b2){logger[_0x9468('0x33')](_0x1ae7b2[_0x9468('0x39')]);});}}exports[_0x9468('0x3a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ae58004..336d993 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 _0x2055=['secrets','session','deadline','add','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','defaults','then','checkLicense','crypto','util','./hardware','../../mysqldb','isEmpty','data1','data2','split','format','%s:%s:%s','base64','final','utf8','parse','uuid','machineUuid','getUuid','createDecipher'];(function(_0x36cd05,_0x1f6324){var _0x15d52a=function(_0x1a3dfd){while(--_0x1a3dfd){_0x36cd05['push'](_0x36cd05['shift']());}};_0x15d52a(++_0x1f6324);}(_0x2055,0xae));var _0x5205=function(_0x41bb80,_0x52dec9){_0x41bb80=_0x41bb80-0x0;var _0x4945f5=_0x2055[_0x41bb80];return _0x4945f5;};'use strict';var crypto=require(_0x5205('0x0'));var util=require(_0x5205('0x1'));var _=require('lodash');var moment=require('moment');var hardware=require(_0x5205('0x2'));var config=require('../environment');var db=require(_0x5205('0x3'))['db'];function checkLicense(_0x439c0f,_0x28cd0c){if(_0x439c0f){try{var _0x1c37e3=_0x28cd0c||_0x439c0f['license'];if(_[_0x5205('0x4')](_0x1c37e3)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x27eee3=_0x439c0f[_0x5205('0x5')];var _0x32e1fe=_0x439c0f[_0x5205('0x6')];var _0x68e39d=_0x27eee3[_0x5205('0x7')]('-')[0x4];var _0x2e19ed=_0x27eee3['split']('-')[0x0];var _0x162171=crypto['createDecipher']('aes-256-ctr',util[_0x5205('0x8')](_0x5205('0x9'),_0x68e39d,_0x27eee3,_0x2e19ed));var _0xddab13=_0x162171['update'](_0x1c37e3,_0x5205('0xa'),'utf8');_0xddab13+=_0x162171[_0x5205('0xb')](_0x5205('0xc'));var _0x3fccd1=JSON[_0x5205('0xd')](_0xddab13);_0x3fccd1['demo']=![];_0x3fccd1[_0x5205('0xe')]=_0x27eee3;_0x3fccd1[_0x5205('0xf')]=hardware[_0x5205('0x10')]();if(_0x32e1fe){var _0x467ecd=crypto[_0x5205('0x11')]('aes-256-ctr',config[_0x5205('0x12')][_0x5205('0x13')]);var _0x5827dc=_0x467ecd['update'](_0x32e1fe,'base64',_0x5205('0xc'));_0x5827dc+=_0x467ecd['final']('utf8');_0x3fccd1['gray']=_0x5827dc;_0x3fccd1[_0x5205('0x14')]=moment(_0x5827dc)[_0x5205('0x15')](0x7,'days')[_0x5205('0x8')]();_0x3fccd1[_0x5205('0x16')]=_0x3fccd1[_0x5205('0xe')]!=_0x3fccd1[_0x5205('0xf')]?'changed':_0x5205('0x17');}return _0x3fccd1;}catch(_0x1fe0f0){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5205('0x18'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5205('0x19'),'uuid':_0x439c0f['data1'],'machineUuid':hardware[_0x5205('0x10')](),'message':_0x1fe0f0[_0x5205('0x1a')],'virtual':0x0,'voice':!![],'preferred':![],'screenrecording':![],'sales':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5205('0x18'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5205('0x1b'),'uuid':_0x439c0f[_0x5205('0x5')],'machineUuid':hardware[_0x5205('0x10')](),'virtual':0x0,'voice':!![],'preferred':![],'screenrecording':![],'sales':![]};}exports[_0x5205('0x1c')]=function(_0x298e3a){return db['License']['find'](_[_0x5205('0x1d')](_0x298e3a,{'raw':!![],'where':{'id':0x1}}))[_0x5205('0x1e')](function(_0x2fa7c6){return checkLicense(_0x2fa7c6,null);});};exports[_0x5205('0x1f')]=checkLicense; \ No newline at end of file +var _0xa2d1=['license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','uuid','machineUuid','session','gray','deadline','add','days','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getUuid','getLicense','find','defaults','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb'];(function(_0x4d6bae,_0x1bc596){var _0x70b4b8=function(_0x4fd8d3){while(--_0x4fd8d3){_0x4d6bae['push'](_0x4d6bae['shift']());}};_0x70b4b8(++_0x1bc596);}(_0xa2d1,0x1e7));var _0x1a2d=function(_0x48b88f,_0x2e1e94){_0x48b88f=_0x48b88f-0x0;var _0x34d441=_0xa2d1[_0x48b88f];return _0x34d441;};'use strict';var crypto=require(_0x1a2d('0x0'));var util=require(_0x1a2d('0x1'));var _=require(_0x1a2d('0x2'));var moment=require(_0x1a2d('0x3'));var hardware=require(_0x1a2d('0x4'));var config=require(_0x1a2d('0x5'));var db=require(_0x1a2d('0x6'))['db'];function checkLicense(_0x48b5d6,_0x475379){if(_0x48b5d6){try{var _0x3451ee=_0x475379||_0x48b5d6[_0x1a2d('0x7')];if(_[_0x1a2d('0x8')](_0x3451ee)){throw new Error(_0x1a2d('0x9'));}var _0x394d71=_0x48b5d6[_0x1a2d('0xa')];var _0x30a105=_0x48b5d6['data2'];var _0x4f7f43=_0x394d71[_0x1a2d('0xb')]('-')[0x4];var _0x4411c4=_0x394d71[_0x1a2d('0xb')]('-')[0x0];var _0x36b39e=crypto[_0x1a2d('0xc')](_0x1a2d('0xd'),util[_0x1a2d('0xe')]('%s:%s:%s',_0x4f7f43,_0x394d71,_0x4411c4));var _0x2a3e25=_0x36b39e[_0x1a2d('0xf')](_0x3451ee,_0x1a2d('0x10'),_0x1a2d('0x11'));_0x2a3e25+=_0x36b39e[_0x1a2d('0x12')](_0x1a2d('0x11'));var _0x220c7b=JSON[_0x1a2d('0x13')](_0x2a3e25);_0x220c7b['demo']=![];_0x220c7b[_0x1a2d('0x14')]=_0x394d71;_0x220c7b[_0x1a2d('0x15')]=hardware['getUuid']();if(_0x30a105){var _0x349dae=crypto['createDecipher'](_0x1a2d('0xd'),config['secrets'][_0x1a2d('0x16')]);var _0x57458b=_0x349dae['update'](_0x30a105,_0x1a2d('0x10'),_0x1a2d('0x11'));_0x57458b+=_0x349dae[_0x1a2d('0x12')](_0x1a2d('0x11'));_0x220c7b[_0x1a2d('0x17')]=_0x57458b;_0x220c7b[_0x1a2d('0x18')]=moment(_0x57458b)[_0x1a2d('0x19')](0x7,_0x1a2d('0x1a'))[_0x1a2d('0xe')]();_0x220c7b['grayReason']=_0x220c7b[_0x1a2d('0x14')]!=_0x220c7b['machineUuid']?_0x1a2d('0x1b'):_0x1a2d('0x1c');}return _0x220c7b;}catch(_0x49ad47){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1a2d('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1a2d('0x1e'),'uuid':_0x48b5d6[_0x1a2d('0xa')],'machineUuid':hardware['getUuid'](),'message':_0x49ad47[_0x1a2d('0x1f')],'virtual':0x0,'voice':!![],'preferred':![],'screenrecording':![],'sales':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1a2d('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1a2d('0x20'),'uuid':_0x48b5d6[_0x1a2d('0xa')],'machineUuid':hardware[_0x1a2d('0x21')](),'virtual':0x0,'voice':!![],'preferred':![],'screenrecording':![],'sales':![]};}exports[_0x1a2d('0x22')]=function(_0x37724f){return db['License'][_0x1a2d('0x23')](_[_0x1a2d('0x24')](_0x37724f,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x8ceac5){return checkLicense(_0x8ceac5,null);});};exports[_0x1a2d('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index e9b8a79..a7993c2 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 _0x652b=['exports','http://localhost:9000','myappanuglar-secret','secret'];(function(_0x1c8314,_0x512e7e){var _0x4bfc4b=function(_0x2d8410){while(--_0x2d8410){_0x1c8314['push'](_0x1c8314['shift']());}};_0x4bfc4b(++_0x512e7e);}(_0x652b,0x68));var _0xb652=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x652b[_0xbd08b4];return _0x314f1e;};'use strict';module[_0xb652('0x0')]={'DOMAIN':_0xb652('0x1'),'SESSION_SECRET':_0xb652('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xb652('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x1306=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x1306,0x17a));var _0x6130=function(_0x3d0c55,_0x376a70){_0x3d0c55=_0x3d0c55-0x0;var _0x46c6f6=_0x1306[_0x3d0c55];return _0x46c6f6;};'use strict';module[_0x6130('0x0')]={'DOMAIN':_0x6130('0x1'),'SESSION_SECRET':_0x6130('0x2'),'GOOGLE_ID':_0x6130('0x3'),'GOOGLE_SECRET':_0x6130('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3fa91c3..7771da1 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98f8=['util','path','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','exports','Logger','transports','File','error','%s-%s','info','Console','env','debugLevel','moment','winston'];(function(_0x1bab40,_0x52ab30){var _0x483d8e=function(_0x2dc451){while(--_0x2dc451){_0x1bab40['push'](_0x1bab40['shift']());}};_0x483d8e(++_0x52ab30);}(_0x98f8,0x111));var _0x898f=function(_0x366b2a,_0x467bb3){_0x366b2a=_0x366b2a-0x0;var _0x2cc2c9=_0x98f8[_0x366b2a];return _0x2cc2c9;};'use strict';var moment=require(_0x898f('0x0'));var winston=require(_0x898f('0x1'));var util=require(_0x898f('0x2'));var path=require(_0x898f('0x3'));var debugLevel=_0x898f('0x4');function filename(_0x183299,_0x42d3ad){return path[_0x898f('0x5')](_0x898f('0x6'),_0x898f('0x7'),_0x898f('0x8'),util[_0x898f('0x9')](_0x898f('0xa'),_0x183299,_0x42d3ad));}function formatter(_0x582afe,_0x2dfe97){return util[_0x898f('0x9')](_0x898f('0xb'),moment()['format'](_0x898f('0xc')),_0x2dfe97[_0x898f('0xd')]['toUpperCase'](),_0x582afe,_0x2dfe97[_0x898f('0xe')]);}module[_0x898f('0xf')]=function(_0x37d7c9){return new winston[(_0x898f('0x10'))]({'transports':[new winston[(_0x898f('0x11'))][(_0x898f('0x12'))]({'name':util[_0x898f('0x9')]('%s-%s',_0x37d7c9,_0x898f('0x13')),'filename':filename(_0x37d7c9,_0x898f('0x13')),'level':_0x898f('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e38af){return formatter(_0x37d7c9,_0x4e38af);}}),new winston[(_0x898f('0x11'))][(_0x898f('0x12'))]({'name':util[_0x898f('0x9')](_0x898f('0x14'),_0x37d7c9,_0x898f('0x15')),'filename':filename(_0x37d7c9,_0x898f('0x15')),'level':_0x898f('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x46e09f){return formatter(_0x37d7c9,_0x46e09f);}}),new winston[(_0x898f('0x11'))][(_0x898f('0x16'))]({'level':process[_0x898f('0x17')][_0x898f('0x18')]||debugLevel,'json':![],'formatter':function(_0xa3d588){return formatter(_0x37d7c9,_0xa3d588);}})]});}; \ No newline at end of file +var _0xc6cd=['File','%s-%s','error','transports','info','Console','env','debugLevel','moment','winston','util','INFO','/var','log','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports'];(function(_0xb5e37f,_0xc624f1){var _0x23f431=function(_0x3ec670){while(--_0x3ec670){_0xb5e37f['push'](_0xb5e37f['shift']());}};_0x23f431(++_0xc624f1);}(_0xc6cd,0xfa));var _0xdc6c=function(_0x5059b7,_0x20a46e){_0x5059b7=_0x5059b7-0x0;var _0x4864e8=_0xc6cd[_0x5059b7];return _0x4864e8;};'use strict';var moment=require(_0xdc6c('0x0'));var winston=require(_0xdc6c('0x1'));var util=require(_0xdc6c('0x2'));var path=require('path');var debugLevel=_0xdc6c('0x3');function filename(_0x2d21de,_0x41179e){return path['join'](_0xdc6c('0x4'),_0xdc6c('0x5'),'xcally',util['format'](_0xdc6c('0x6'),_0x2d21de,_0x41179e));}function formatter(_0x22403d,_0x670d15){return util['format'](_0xdc6c('0x7'),moment()[_0xdc6c('0x8')](_0xdc6c('0x9')),_0x670d15[_0xdc6c('0xa')][_0xdc6c('0xb')](),_0x22403d,_0x670d15[_0xdc6c('0xc')]);}module[_0xdc6c('0xd')]=function(_0xd9b65a){return new winston['Logger']({'transports':[new winston['transports'][(_0xdc6c('0xe'))]({'name':util[_0xdc6c('0x8')](_0xdc6c('0xf'),_0xd9b65a,_0xdc6c('0x10')),'filename':filename(_0xd9b65a,_0xdc6c('0x10')),'level':_0xdc6c('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5126aa){return formatter(_0xd9b65a,_0x5126aa);}}),new winston[(_0xdc6c('0x11'))][(_0xdc6c('0xe'))]({'name':util[_0xdc6c('0x8')](_0xdc6c('0xf'),_0xd9b65a,_0xdc6c('0x12')),'filename':filename(_0xd9b65a,_0xdc6c('0x12')),'level':_0xdc6c('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x534fc4){return formatter(_0xd9b65a,_0x534fc4);}}),new winston[(_0xdc6c('0x11'))][(_0xdc6c('0x13'))]({'level':process[_0xdc6c('0x14')][_0xdc6c('0x15')]||debugLevel,'json':![],'formatter':function(_0xb98b20){return formatter(_0xd9b65a,_0xb98b20);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b93a4c7..ebfedf3 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 _0x7ea5=['join','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','exports','path','express','../../services/express/index.js','ami'];(function(_0x18d500,_0x58f17d){var _0x49a468=function(_0x38579e){while(--_0x38579e){_0x18d500['push'](_0x18d500['shift']());}};_0x49a468(++_0x58f17d);}(_0x7ea5,0x1a9));var _0x57ea=function(_0x377dea,_0x2deaad){_0x377dea=_0x377dea-0x0;var _0x3b2614=_0x7ea5[_0x377dea];return _0x3b2614;};'use strict';var path=require(_0x57ea('0x0'));var os=require('os');var config={'apps':[{'name':_0x57ea('0x1'),'script':path['join'](__dirname,_0x57ea('0x2'))},{'name':_0x57ea('0x3'),'script':path[_0x57ea('0x4')](__dirname,_0x57ea('0x5'))},{'name':'agi','script':path['join'](__dirname,_0x57ea('0x6'))},{'name':_0x57ea('0x7'),'script':path[_0x57ea('0x4')](__dirname,_0x57ea('0x8'))},{'name':_0x57ea('0x9'),'script':path[_0x57ea('0x4')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x57ea('0x4')](__dirname,'../../services/xdr/index.js')}]};module[_0x57ea('0xa')]=config; \ No newline at end of file +var _0x589e=['agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0xd5f40c,_0x17259d){var _0x3bcf09=function(_0x2e0977){while(--_0x2e0977){_0xd5f40c['push'](_0xd5f40c['shift']());}};_0x3bcf09(++_0x17259d);}(_0x589e,0x127));var _0xe589=function(_0x3d1f3e,_0x1391e5){_0x3d1f3e=_0x3d1f3e-0x0;var _0x17ee42=_0x589e[_0x3d1f3e];return _0x17ee42;};'use strict';var path=require(_0xe589('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xe589('0x1')](__dirname,_0xe589('0x2'))},{'name':_0xe589('0x3'),'script':path['join'](__dirname,_0xe589('0x4'))},{'name':_0xe589('0x5'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xe589('0x6'),'script':path[_0xe589('0x1')](__dirname,_0xe589('0x7'))},{'name':_0xe589('0x8'),'script':path[_0xe589('0x1')](__dirname,_0xe589('0x9'))},{'name':_0xe589('0xa'),'script':path[_0xe589('0x1')](__dirname,_0xe589('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 cd9cd2c..cad6648 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 _0xedd9=['restart','list','describe','delete','saved','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x526c50,_0x3154c7){var _0x14cf04=function(_0x51e53d){while(--_0x51e53d){_0x526c50['push'](_0x526c50['shift']());}};_0x14cf04(++_0x3154c7);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d817f,_0x414fa2){_0x4d817f=_0x4d817f-0x0;var _0x65cfa0=_0xedd9[_0x4d817f];return _0x65cfa0;};'use strict';var pm2=require('pm2');var BPromise=require(_0x9edd('0x0'));var config=require(_0x9edd('0x1'));function connect(){return new BPromise(function(_0x2af857,_0x2c16b8){return pm2[_0x9edd('0x2')](function(_0x127cbe){if(_0x127cbe){return _0x2c16b8(_0x127cbe);}return _0x2af857(_0x9edd('0x3'));});});};exports[_0x9edd('0x4')]=function(_0x5943b3){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x2cd163,_0x268f9e){return pm2[_0x9edd('0x4')](_0x5943b3,function(_0x5319f7,_0xf0b2d8){if(_0x5319f7){return _0x268f9e(_0x5319f7);}pm2['disconnect']();return _0x2cd163(_0xf0b2d8);});});});};exports[_0x9edd('0x6')]=function(_0x190185){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x3280fd,_0x49d5e3){return pm2[_0x9edd('0x6')](_0x190185,function(_0x5d2f90,_0x2076fc){if(_0x5d2f90){return _0x49d5e3(_0x5d2f90);}pm2[_0x9edd('0x7')]();return _0x3280fd(_0x2076fc);});});});};exports['restart']=function(_0xbf9da6){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x5b6c00,_0x30c0d7){return pm2[_0x9edd('0x8')](_0xbf9da6,function(_0x25e64c,_0xfd544a){if(_0x25e64c){return _0x30c0d7(_0x25e64c);}pm2[_0x9edd('0x7')]();return _0x5b6c00(_0xfd544a);});});});};exports[_0x9edd('0x9')]=function(){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0xef5498,_0x47eb64){return pm2[_0x9edd('0x9')](function(_0x44fc7c,_0x891832){if(_0x44fc7c){return _0x47eb64(_0x44fc7c);}pm2[_0x9edd('0x7')]();return _0xef5498(_0x891832);});});});};exports[_0x9edd('0xa')]=function(_0x338f3c){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x75a4ab,_0x4ea60f){return pm2[_0x9edd('0xa')](_0x338f3c,function(_0x448996,_0x449cee){if(_0x448996){return _0x4ea60f(_0x448996);}pm2['disconnect']();return _0x75a4ab(_0x449cee);});});});};exports[_0x9edd('0xb')]=function(_0x35f454){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x4d8f33,_0x43dc70){return pm2['delete'](_0x35f454,function(_0x2cdcef,_0x1083e4){if(_0x2cdcef){return _0x43dc70(_0x2cdcef);}pm2['disconnect']();return _0x4d8f33(_0x1083e4);});});});};exports['dump']=function(){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x50338f,_0x27a95a){return pm2['dump'](function(_0x535f37){if(_0x535f37){return _0x27a95a(_0x535f37);}return _0x50338f(_0x9edd('0xc'));});});});}; \ No newline at end of file +var _0x9957=['stop','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var pm2=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var config=require(_0x7995('0x2'));function connect(){return new BPromise(function(_0x10a05d,_0x5b96eb){return pm2[_0x7995('0x3')](function(_0x3c58eb){if(_0x3c58eb){return _0x5b96eb(_0x3c58eb);}return _0x10a05d(_0x7995('0x4'));});});};exports[_0x7995('0x5')]=function(_0x576d89){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x1a36d8,_0x137b6b){return pm2[_0x7995('0x5')](_0x576d89,function(_0xbda126,_0x326741){if(_0xbda126){return _0x137b6b(_0xbda126);}pm2['disconnect']();return _0x1a36d8(_0x326741);});});});};exports[_0x7995('0x7')]=function(_0x1cad37){return connect()['then'](function(){return new BPromise(function(_0xa2e5f0,_0x3116fb){return pm2[_0x7995('0x7')](_0x1cad37,function(_0x35b5fe,_0x3c1d19){if(_0x35b5fe){return _0x3116fb(_0x35b5fe);}pm2[_0x7995('0x8')]();return _0xa2e5f0(_0x3c1d19);});});});};exports[_0x7995('0x9')]=function(_0x524f7b){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x41c652,_0x581f22){return pm2[_0x7995('0x9')](_0x524f7b,function(_0x2cb37a,_0x19a27e){if(_0x2cb37a){return _0x581f22(_0x2cb37a);}pm2[_0x7995('0x8')]();return _0x41c652(_0x19a27e);});});});};exports[_0x7995('0xa')]=function(){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x2bbe7a,_0x4cc004){return pm2['list'](function(_0x2b4e94,_0x2233dd){if(_0x2b4e94){return _0x4cc004(_0x2b4e94);}pm2[_0x7995('0x8')]();return _0x2bbe7a(_0x2233dd);});});});};exports[_0x7995('0xb')]=function(_0x3f1d3e){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x2202ce,_0x41cbf0){return pm2['describe'](_0x3f1d3e,function(_0x2eeacc,_0x565d97){if(_0x2eeacc){return _0x41cbf0(_0x2eeacc);}pm2[_0x7995('0x8')]();return _0x2202ce(_0x565d97);});});});};exports[_0x7995('0xc')]=function(_0x43d4b8){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x1e1415,_0x37a7d4){return pm2['delete'](_0x43d4b8,function(_0x54c9ae,_0x2536c8){if(_0x54c9ae){return _0x37a7d4(_0x54c9ae);}pm2['disconnect']();return _0x1e1415(_0x2536c8);});});});};exports['dump']=function(){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x3d463e,_0x4cbe10){return pm2[_0x7995('0xd')](function(_0x51f276){if(_0x51f276){return _0x4cbe10(_0x51f276);}return _0x3d463e('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/automaticRenewSubscription.js b/server/config/schedule/automaticRenewSubscription.js index b1ecebb..e6af7c9 100644 --- a/server/config/schedule/automaticRenewSubscription.js +++ b/server/config/schedule/automaticRenewSubscription.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f5e=['../../config/environment','find','chatTimeout','ChatInteraction','findAll','minutes','then','update','system','format','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update','catch','error','startSubscription','lodash','moment','ioredis'];(function(_0x4ecbae,_0x313ac9){var _0x1b9ad6=function(_0x5cbc68){while(--_0x5cbc68){_0x4ecbae['push'](_0x4ecbae['shift']());}};_0x1b9ad6(++_0x313ac9);}(_0x2f5e,0xd9));var _0xe2f5=function(_0x79ec4,_0xa61837){_0x79ec4=_0x79ec4-0x0;var _0x585295=_0x2f5e[_0x79ec4];return _0x585295;};'use strict';var _=require(_0xe2f5('0x0'));var moment=require(_0xe2f5('0x1'));var Redis=require(_0xe2f5('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xe2f5('0x3'));function subscriptionsAutomatic(){var _0x36b771=0x0;var _0x9a63fa=[];return db['Setting'][_0xe2f5('0x4')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x2cbd5e){_0x36b771=_0x2cbd5e[_0xe2f5('0x5')];if(_0x36b771){return db[_0xe2f5('0x6')][_0xe2f5('0x7')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2cbd5e['chatTimeout'],_0xe2f5('0x8'))}}});}else{return[];}})[_0xe2f5('0x9')](function(_0x2f6d13){_0x9a63fa=_0x2f6d13;if(_0x36b771){return db[_0xe2f5('0x6')][_0xe2f5('0xa')]({'closeReason':_0xe2f5('0xb'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xe2f5('0xc')](_0xe2f5('0xd'))},{'where':{'id':_[_0xe2f5('0xe')](_0x9a63fa||[],'id')}});}})[_0xe2f5('0x9')](function(_0x191374){for(var _0x2c605d=0x0;_0x2c605d<_0x9a63fa[_0xe2f5('0xf')];_0x2c605d++){io['emit'](_0xe2f5('0x10'),{'id':_0x9a63fa[_0x2c605d]['id'],'closed':!![]});}})[_0xe2f5('0x11')](function(_0x67ad2c){console[_0xe2f5('0x12')](_0x67ad2c);});}exports[_0xe2f5('0x13')]=function(){setInterval(function(){return subscriptionsAutomatic();},0x3c*0x3e8);return subscriptionsAutomatic();}; \ No newline at end of file +var _0x590a=['chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update','catch','startSubscription','lodash','ioredis','../../mysqldb','../../config/environment','find'];(function(_0x3c1c37,_0x2a1019){var _0x4ca8b6=function(_0x21014e){while(--_0x21014e){_0x3c1c37['push'](_0x3c1c37['shift']());}};_0x4ca8b6(++_0x2a1019);}(_0x590a,0x1db));var _0xa590=function(_0x232254,_0x203f6a){_0x232254=_0x232254-0x0;var _0xffcf9c=_0x590a[_0x232254];return _0xffcf9c;};'use strict';var _=require(_0xa590('0x0'));var moment=require('moment');var Redis=require(_0xa590('0x1'));var db=require(_0xa590('0x2'))['db'];var config=require(_0xa590('0x3'));function subscriptionsAutomatic(){var _0x10f3d9=0x0;var _0x344da2=[];return db['Setting'][_0xa590('0x4')]({'raw':!![],'attributes':['id',_0xa590('0x5')],'where':{'id':0x1}})['then'](function(_0x2815e0){_0x10f3d9=_0x2815e0[_0xa590('0x5')];if(_0x10f3d9){return db[_0xa590('0x6')]['findAll']({'raw':!![],'attributes':['id',_0xa590('0x7')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa590('0x8')](_0x2815e0[_0xa590('0x5')],_0xa590('0x9'))}}});}else{return[];}})[_0xa590('0xa')](function(_0x4cdda4){_0x344da2=_0x4cdda4;if(_0x10f3d9){return db[_0xa590('0x6')]['update']({'closeReason':_0xa590('0xb'),'disposition':_0xa590('0xc'),'closed':!![],'closedAt':moment()[_0xa590('0xd')](_0xa590('0xe'))},{'where':{'id':_[_0xa590('0xf')](_0x344da2||[],'id')}});}})['then'](function(_0x45f817){for(var _0x214ed0=0x0;_0x214ed0<_0x344da2[_0xa590('0x10')];_0x214ed0++){io['emit'](_0xa590('0x11'),{'id':_0x344da2[_0x214ed0]['id'],'closed':!![]});}})[_0xa590('0x12')](function(_0x2c0b9c){console['error'](_0x2c0b9c);});}exports[_0xa590('0x13')]=function(){setInterval(function(){return subscriptionsAutomatic();},0x3c*0x3e8);return subscriptionsAutomatic();}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 15e3e69..cb7de24 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 _0x8029=['length','emit','chatInteraction:update','catch','error','start','lodash','moment','../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','chatTimeout','then','findAll','lastMsgAt','minutes','update','system','timeout','format'];(function(_0x2c3530,_0x591054){var _0x537a16=function(_0xabde4d){while(--_0xabde4d){_0x2c3530['push'](_0x2c3530['shift']());}};_0x537a16(++_0x591054);}(_0x8029,0xf8));var _0x9802=function(_0x4815b1,_0x5e1b16){_0x4815b1=_0x4815b1-0x0;var _0x5d1fcb=_0x8029[_0x4815b1];return _0x5d1fcb;};'use strict';var _=require(_0x9802('0x0'));var moment=require(_0x9802('0x1'));var Redis=require('ioredis');var db=require(_0x9802('0x2'))['db'];var config=require(_0x9802('0x3'));config[_0x9802('0x4')]=_[_0x9802('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9802('0x6'))(new Redis(config[_0x9802('0x4')]));function closeInteractions(){var _0x1f7c3f=0x0;var _0x57faa5=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x9802('0x7')],'where':{'id':0x1}})[_0x9802('0x8')](function(_0x1d1405){_0x1f7c3f=_0x1d1405[_0x9802('0x7')];if(_0x1f7c3f){return db['ChatInteraction'][_0x9802('0x9')]({'raw':!![],'attributes':['id',_0x9802('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x1d1405[_0x9802('0x7')],_0x9802('0xb'))}}});}else{return[];}})['then'](function(_0x4df56e){_0x57faa5=_0x4df56e;if(_0x1f7c3f){return db['ChatInteraction'][_0x9802('0xc')]({'closeReason':_0x9802('0xd'),'disposition':_0x9802('0xe'),'closed':!![],'closedAt':moment()[_0x9802('0xf')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x57faa5||[],'id')}});}})[_0x9802('0x8')](function(_0x288cf1){for(var _0x8341a3=0x0;_0x8341a3<_0x57faa5[_0x9802('0x10')];_0x8341a3++){io[_0x9802('0x11')](_0x9802('0x12'),{'id':_0x57faa5[_0x8341a3]['id'],'closed':!![]});}})[_0x9802('0x13')](function(_0x302581){console[_0x9802('0x14')](_0x302581);});}exports[_0x9802('0x15')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb377=['length','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','then'];(function(_0x4115bf,_0x55702a){var _0x300ee1=function(_0x7b4a82){while(--_0x7b4a82){_0x4115bf['push'](_0x4115bf['shift']());}};_0x300ee1(++_0x55702a);}(_0xb377,0x1b6));var _0x7b37=function(_0x5a7e95,_0x5b7cd6){_0x5a7e95=_0x5a7e95-0x0;var _0x2b9200=_0xb377[_0x5a7e95];return _0x2b9200;};'use strict';var _=require(_0x7b37('0x0'));var moment=require(_0x7b37('0x1'));var Redis=require(_0x7b37('0x2'));var db=require(_0x7b37('0x3'))['db'];var config=require(_0x7b37('0x4'));config[_0x7b37('0x5')]=_[_0x7b37('0x6')](config[_0x7b37('0x5')],{'host':_0x7b37('0x7'),'port':0x18eb});var io=require(_0x7b37('0x8'))(new Redis(config[_0x7b37('0x5')]));function closeInteractions(){var _0x38d1b4=0x0;var _0x58edf9=[];return db['Setting'][_0x7b37('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x3de992){_0x38d1b4=_0x3de992[_0x7b37('0xa')];if(_0x38d1b4){return db[_0x7b37('0xb')][_0x7b37('0xc')]({'raw':!![],'attributes':['id',_0x7b37('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7b37('0xe')](_0x3de992[_0x7b37('0xa')],_0x7b37('0xf'))}}});}else{return[];}})['then'](function(_0x22e0a9){_0x58edf9=_0x22e0a9;if(_0x38d1b4){return db[_0x7b37('0xb')]['update']({'closeReason':'system','disposition':_0x7b37('0x10'),'closed':!![],'closedAt':moment()[_0x7b37('0x11')](_0x7b37('0x12'))},{'where':{'id':_[_0x7b37('0x13')](_0x58edf9||[],'id')}});}})[_0x7b37('0x14')](function(_0x1edd5a){for(var _0x28dd9c=0x0;_0x28dd9c<_0x58edf9[_0x7b37('0x15')];_0x28dd9c++){io[_0x7b37('0x16')](_0x7b37('0x17'),{'id':_0x58edf9[_0x28dd9c]['id'],'closed':!![]});}})[_0x7b37('0x18')](function(_0x19ce67){console[_0x7b37('0x19')](_0x19ce67);});}exports[_0x7b37('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 82be847..c41aa81 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 _0xa9ec=['jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','isBetween','update','update\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','info','email','MailAccount','Smtp','service','host','port','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','join','../../files/reports','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','keys'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xa9ec,0x6c));var _0xca9e=function(_0x5ae1af,_0x3a3c68){_0x5ae1af=_0x5ae1af-0x0;var _0x57769c=_0xa9ec[_0x5ae1af];return _0x57769c;};'use strict';var fs=require('fs');var util=require(_0xca9e('0x0'));var path=require(_0xca9e('0x1'));var _=require(_0xca9e('0x2'));var moment=require(_0xca9e('0x3'));var CronJobManager=require(_0xca9e('0x4'));var jayson=require(_0xca9e('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0xca9e('0x6'));var db=require(_0xca9e('0x7'))['db'];var analyticCustomReportController=require(_0xca9e('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x519d41,_0x19d200){return function(){logger[_0xca9e('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x519d41[_0xca9e('0xa')]);var _0x38dc91=!![];var _0x461313={'tls':{'rejectUnauthorized':![]}};if(_0x519d41[_0xca9e('0xb')]['Smtp']['service']){_0x461313['service']=_0x519d41['MailAccount'][_0xca9e('0xc')][_0xca9e('0xd')];}else{_0x461313[_0xca9e('0xe')]=_0x519d41['MailAccount'][_0xca9e('0xc')][_0xca9e('0xe')];_0x461313[_0xca9e('0xf')]=_0x519d41[_0xca9e('0xb')][_0xca9e('0xc')]['port'];_0x461313['secure']=_0x519d41[_0xca9e('0xb')][_0xca9e('0xc')]['secure'];}if(_0x519d41[_0xca9e('0xb')][_0xca9e('0xc')][_0xca9e('0x10')]){_0x461313[_0xca9e('0x11')]={'user':_0x519d41[_0xca9e('0xb')][_0xca9e('0xc')][_0xca9e('0x12')],'pass':_0x519d41[_0xca9e('0xb')][_0xca9e('0xc')][_0xca9e('0x13')]};}var _0x3388dd={'account':_0x461313,'message':{'from':util[_0xca9e('0x14')](_0xca9e('0x15'),_0x519d41[_0xca9e('0xb')][_0xca9e('0x16')],_0x519d41[_0xca9e('0xb')]['email']||_0x519d41[_0xca9e('0xb')][_0xca9e('0xc')][_0xca9e('0x12')]),'to':_0x519d41[_0xca9e('0xa')],'cc':_0x519d41['cc'],'bcc':_0x519d41[_0xca9e('0x17')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x19d200[_0xca9e('0x16')],_0x519d41[_0xca9e('0x18')],_0x519d41[_0xca9e('0x19')])}};var _0x81a5b9=path[_0xca9e('0x1a')](__dirname,_0xca9e('0x1b'));var _0x5262bc=_0x19d200['savename'];var _0x4428b8=util[_0xca9e('0x14')]('%s.%s',path['basename'](_0x19d200['savename'],path[_0xca9e('0x1c')](_0x19d200['savename'])),_0xca9e('0x1d'));var _0x42e8f5=path[_0xca9e('0x1a')](_0x81a5b9,_0x5262bc);var _0x37dfd5=path[_0xca9e('0x1a')](_0x81a5b9,_0x4428b8);if(fs[_0xca9e('0x1e')](_0x42e8f5)){_0x19d200['status']=_0xca9e('0x1f');_0x3388dd[_0xca9e('0x20')][_0xca9e('0x21')]=[{'filename':_0x5262bc,'path':_0x42e8f5}];_0x3388dd[_0xca9e('0x20')][_0xca9e('0x22')]=util[_0xca9e('0x14')](_0xca9e('0x23'),JSON[_0xca9e('0x24')](_0x19d200,null,0x2));}else if(fs['existsSync'](_0x37dfd5)){_0x19d200['status']=_0xca9e('0x1f');_0x3388dd[_0xca9e('0x20')][_0xca9e('0x21')]=[{'filename':_0x4428b8,'path':_0x37dfd5}];}else{_0x3388dd['message']['text']=_0xca9e('0x25');if(!_0x519d41[_0xca9e('0x26')]){_0x38dc91=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x38dc91){return client['request']('SendMail',_0x3388dd)[_0xca9e('0x27')](function(_0x798920){if(_0x798920['error']){return logger[_0xca9e('0x28')](_0xca9e('0x29'),JSON[_0xca9e('0x24')](_0x798920));}return logger[_0xca9e('0x9')](_0xca9e('0x2a'));})[_0xca9e('0x2b')](function(_0x1c6777){return logger[_0xca9e('0x28')](_0xca9e('0x29'),JSON[_0xca9e('0x24')](_0x1c6777));});}};}function handleError(){return function(_0x4b6946){return logger[_0xca9e('0x28')](JSON['stringify'](_0x4b6946));};}function handleResult(_0xa2f967){return function(_0x336de1){logger[_0xca9e('0x9')](_0xca9e('0x2c'),JSON[_0xca9e('0x24')](_0x336de1));if(_0xa2f967[_0xca9e('0xb')]&&_0xa2f967[_0xca9e('0xb')][_0xca9e('0xc')]&&!_[_0xca9e('0x2d')](_0xa2f967[_0xca9e('0xa')])){setTimeout(handleSendEmail(_0xa2f967,_0x336de1),0x3c*0x3e8);}};}function handleJob(_0x447ae4){return function(){try{if(_[_0xca9e('0x2d')](_0x447ae4[_0xca9e('0x18')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xca9e('0x2d')](_0x447ae4['subtractUnit'])){return logger[_0xca9e('0x9')](_0xca9e('0x2e'));}var _0x191e59={'startDate':moment()[_0xca9e('0x2f')](_0x447ae4['subtractNumber'],_0x447ae4[_0xca9e('0x19')])[_0xca9e('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xca9e('0x14')](_0xca9e('0x30')),'type':_0xca9e('0x31'),'output':_0x447ae4[_0xca9e('0x32')],'name':_0x447ae4[_0xca9e('0x16')]};if(!_[_0xca9e('0x2d')](_0x447ae4[_0xca9e('0x33')])){logger[_0xca9e('0x9')](_0xca9e('0x34'),_0x447ae4['DefaultReportId']);return analyticDefaultReportController[_0xca9e('0x35')]({'id':_0x447ae4[_0xca9e('0x33')]},_0x191e59)[_0xca9e('0x27')](handleResult(_0x447ae4))[_0xca9e('0x2b')](handleError());}if(!_['isNil'](_0x447ae4['CustomReportId'])){logger[_0xca9e('0x9')]('exec\x20custom\x20report\x20id:%s',_0x447ae4[_0xca9e('0x36')]);return analyticCustomReportController['runReport']({'id':_0x447ae4[_0xca9e('0x36')]},_0x191e59)[_0xca9e('0x27')](handleResult(_0x447ae4))[_0xca9e('0x2b')](handleError());}}catch(_0x41cbdd){logger[_0xca9e('0x28')](JSON['stringify'](_0x41cbdd));}return logger['info'](_0xca9e('0x37'));};}function getJobs(_0x4ab1db){var _0x2f1c79={};if(_0x4ab1db){_0x2f1c79['id']=_0x4ab1db;}return db[_0xca9e('0x38')]['findAll']({'where':_0x2f1c79,'include':[{'model':db[_0xca9e('0xb')],'attributes':['id',_0xca9e('0x16'),_0xca9e('0xa')],'include':[{'model':db['MailServerOut'],'as':_0xca9e('0xc')}]}]})[_0xca9e('0x27')](function(_0x3004a0){var _0x4b335a=_[_0xca9e('0x39')](manager[_0xca9e('0x3a')]);var _0x210ffc=_[_0xca9e('0x3b')](_0x3004a0,function(_0x283897){return _0x283897['id'][_0xca9e('0x3c')]();});var _0x50779b=_['keyBy'](_0x3004a0,function(_0x566f1f){return _0x566f1f['id'][_0xca9e('0x3c')]();});var _0x2cea69=_0x4ab1db?_0x210ffc:_[_0xca9e('0x3d')](_0x210ffc,_0x4b335a);var _0x2d6cb7=_[_0xca9e('0x3e')](_0x210ffc,_0x4b335a);var _0x3a58b8=_[_0xca9e('0x3d')](_0x4b335a,_0x210ffc);var _0x109bf7;var _0x136d05;for(_0x109bf7=0x0;_0x109bf7<_0x3a58b8[_0xca9e('0x3f')]&&!_0x4ab1db;_0x109bf7+=0x1){_0x136d05=_0x3a58b8[_0x109bf7][_0xca9e('0x3c')]();if(manager[_0xca9e('0x40')](_0x136d05)){manager[_0xca9e('0x41')](_0x136d05);manager[_0xca9e('0x42')](_0x136d05);logger[_0xca9e('0x9')](_0xca9e('0x43'),_0x136d05);}}logger[_0xca9e('0x9')](_0xca9e('0x44'),JSON['stringify'](_0x2cea69));for(_0x109bf7=0x0;_0x109bf7<_0x2cea69[_0xca9e('0x3f')];_0x109bf7+=0x1){_0x136d05=_0x2cea69[_0x109bf7]['toString']();logger[_0xca9e('0x9')]('index',_0x136d05);if(_0x4ab1db){logger[_0xca9e('0x9')](_0xca9e('0x45'),_0x4ab1db);logger[_0xca9e('0x9')](JSON[_0xca9e('0x24')](_0x50779b[_0x136d05]));BPromise[_0xca9e('0x46')]()[_0xca9e('0x27')](handleJob(_0x50779b[_0x136d05]));logger[_0xca9e('0x9')](_0xca9e('0x47'),_0x50779b[_0x136d05]['name'],_0x50779b[_0x136d05][_0xca9e('0x48')]);}else if(_0x50779b[_0x136d05][_0xca9e('0x48')]&&_0x50779b[_0x136d05][_0xca9e('0x49')]&&moment()['isBetween'](_0x50779b[_0x136d05][_0xca9e('0x4a')],_0x50779b[_0x136d05][_0xca9e('0x4b')])){manager[_0xca9e('0x4c')](_0x136d05,_0x50779b[_0x136d05][_0xca9e('0x48')],handleJob(_0x50779b[_0x136d05]));manager[_0xca9e('0x4d')](_0x136d05);logger[_0xca9e('0x9')](_0xca9e('0x4e'),_0x50779b[_0x136d05][_0xca9e('0x16')],_0x50779b[_0x136d05]['cron']);}else if(manager['exists'](_0x136d05)){manager[_0xca9e('0x41')](_0x136d05);manager[_0xca9e('0x42')](_0x136d05);logger['info'](_0xca9e('0x4f'),_0x50779b[_0x136d05][_0xca9e('0x16')],_0x50779b[_0x136d05]['cron']);}}for(_0x109bf7=0x0,_0x136d05;_0x109bf7<_0x2d6cb7[_0xca9e('0x3f')]&&!_0x4ab1db;_0x109bf7+=0x1){_0x136d05=_0x2d6cb7[_0x109bf7][_0xca9e('0x3c')]();if(manager[_0xca9e('0x40')](_0x136d05)){if(_0x50779b[_0x136d05][_0xca9e('0x48')]&&_0x50779b[_0x136d05]['active']&&moment()[_0xca9e('0x50')](_0x50779b[_0x136d05]['startAt'],_0x50779b[_0x136d05][_0xca9e('0x4b')])){manager[_0xca9e('0x51')](_0x136d05,_0x50779b[_0x136d05][_0xca9e('0x48')],handleJob(_0x50779b[_0x136d05]));logger[_0xca9e('0x9')](_0xca9e('0x52'),_0x50779b[_0x136d05]['name'],_0x50779b[_0x136d05][_0xca9e('0x48')]);}else{manager['stop'](_0x136d05);manager[_0xca9e('0x42')](_0x136d05);logger['info']('stop\x20cron',_0x50779b[_0x136d05]['name'],_0x50779b[_0x136d05]['cron']);}}}})[_0xca9e('0x2b')](function(_0x311214){logger['error'](JSON['stringify'](_0x311214));});}exports['run']=function(_0x354bcc){return getJobs(_0x354bcc);};exports[_0xca9e('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9367=['deleteJob','delete\x20cron','length','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','active','update\x20cron','util','path','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','jobs','toString','keyBy','intersection','exists','stop'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9367,0x167));var _0x7936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9367[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0x7936('0x0'));var path=require(_0x7936('0x1'));var _=require(_0x7936('0x2'));var moment=require(_0x7936('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x7936('0x4'));var BPromise=require('bluebird');var logger=require(_0x7936('0x5'))(_0x7936('0x6'));var db=require(_0x7936('0x7'))['db'];var analyticCustomReportController=require(_0x7936('0x8'));var analyticDefaultReportController=require(_0x7936('0x9'));var client=jayson[_0x7936('0xa')][_0x7936('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1ccd31,_0x5e1027){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x1ccd31['email']);var _0x3c9970=!![];var _0x4c35f3={'tls':{'rejectUnauthorized':![]}};if(_0x1ccd31['MailAccount'][_0x7936('0xc')][_0x7936('0xd')]){_0x4c35f3['service']=_0x1ccd31[_0x7936('0xe')][_0x7936('0xc')][_0x7936('0xd')];}else{_0x4c35f3[_0x7936('0xf')]=_0x1ccd31[_0x7936('0xe')][_0x7936('0xc')][_0x7936('0xf')];_0x4c35f3[_0x7936('0x10')]=_0x1ccd31['MailAccount'][_0x7936('0xc')][_0x7936('0x10')];_0x4c35f3[_0x7936('0x11')]=_0x1ccd31['MailAccount'][_0x7936('0xc')][_0x7936('0x11')];}if(_0x1ccd31['MailAccount']['Smtp'][_0x7936('0x12')]){_0x4c35f3[_0x7936('0x13')]={'user':_0x1ccd31['MailAccount']['Smtp'][_0x7936('0x14')],'pass':_0x1ccd31[_0x7936('0xe')][_0x7936('0xc')][_0x7936('0x15')]};}var _0x17c671={'account':_0x4c35f3,'message':{'from':util[_0x7936('0x16')](_0x7936('0x17'),_0x1ccd31['MailAccount'][_0x7936('0x18')],_0x1ccd31[_0x7936('0xe')][_0x7936('0x19')]||_0x1ccd31['MailAccount']['Smtp'][_0x7936('0x14')]),'to':_0x1ccd31[_0x7936('0x19')],'cc':_0x1ccd31['cc'],'bcc':_0x1ccd31[_0x7936('0x1a')],'subject':util[_0x7936('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x5e1027[_0x7936('0x18')],_0x1ccd31[_0x7936('0x1b')],_0x1ccd31[_0x7936('0x1c')])}};var _0x125032=path[_0x7936('0x1d')](__dirname,_0x7936('0x1e'));var _0x154778=_0x5e1027[_0x7936('0x1f')];var _0x586f05=util['format']('%s.%s',path[_0x7936('0x20')](_0x5e1027[_0x7936('0x1f')],path[_0x7936('0x21')](_0x5e1027[_0x7936('0x1f')])),_0x7936('0x22'));var _0x3232c6=path[_0x7936('0x1d')](_0x125032,_0x154778);var _0x1cbd9b=path['join'](_0x125032,_0x586f05);if(fs[_0x7936('0x23')](_0x3232c6)){_0x5e1027[_0x7936('0x24')]=_0x7936('0x25');_0x17c671[_0x7936('0x26')][_0x7936('0x27')]=[{'filename':_0x154778,'path':_0x3232c6}];_0x17c671[_0x7936('0x26')][_0x7936('0x28')]=util[_0x7936('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x7936('0x29')](_0x5e1027,null,0x2));}else if(fs['existsSync'](_0x1cbd9b)){_0x5e1027['status']=_0x7936('0x25');_0x17c671[_0x7936('0x26')][_0x7936('0x27')]=[{'filename':_0x586f05,'path':_0x1cbd9b}];}else{_0x17c671[_0x7936('0x26')][_0x7936('0x28')]=_0x7936('0x2a');if(!_0x1ccd31[_0x7936('0x2b')]){_0x3c9970=![];logger[_0x7936('0x2c')](_0x7936('0x2d'));}}if(_0x3c9970){return client[_0x7936('0x2e')](_0x7936('0x2f'),_0x17c671)[_0x7936('0x30')](function(_0x28a2fb){if(_0x28a2fb['error']){return logger[_0x7936('0x31')](_0x7936('0x32'),JSON[_0x7936('0x29')](_0x28a2fb));}return logger[_0x7936('0x2c')](_0x7936('0x33'));})[_0x7936('0x34')](function(_0x1c5744){return logger['error'](_0x7936('0x32'),JSON[_0x7936('0x29')](_0x1c5744));});}};}function handleError(){return function(_0x4e20a6){return logger['error'](JSON[_0x7936('0x29')](_0x4e20a6));};}function handleResult(_0x3a2caa){return function(_0x183aa2){logger[_0x7936('0x2c')](_0x7936('0x35'),JSON['stringify'](_0x183aa2));if(_0x3a2caa[_0x7936('0xe')]&&_0x3a2caa[_0x7936('0xe')]['Smtp']&&!_[_0x7936('0x36')](_0x3a2caa[_0x7936('0x19')])){setTimeout(handleSendEmail(_0x3a2caa,_0x183aa2),0x3c*0x3e8);}};}function handleJob(_0x1e56a9){return function(){try{if(_['isNil'](_0x1e56a9[_0x7936('0x1b')])){return logger[_0x7936('0x2c')](_0x7936('0x37'));}if(_[_0x7936('0x36')](_0x1e56a9['subtractUnit'])){return logger[_0x7936('0x2c')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1f2131={'startDate':moment()['subtract'](_0x1e56a9[_0x7936('0x1b')],_0x1e56a9[_0x7936('0x1c')])[_0x7936('0x16')](_0x7936('0x38')),'endDate':moment()['format'](_0x7936('0x38')),'type':'scheduled','output':_0x1e56a9[_0x7936('0x39')],'name':_0x1e56a9[_0x7936('0x18')]};if(!_[_0x7936('0x36')](_0x1e56a9[_0x7936('0x3a')])){logger[_0x7936('0x2c')]('exec\x20defaul\x20report\x20id:%s',_0x1e56a9[_0x7936('0x3a')]);return analyticDefaultReportController[_0x7936('0x3b')]({'id':_0x1e56a9['DefaultReportId']},_0x1f2131)[_0x7936('0x30')](handleResult(_0x1e56a9))['catch'](handleError());}if(!_[_0x7936('0x36')](_0x1e56a9[_0x7936('0x3c')])){logger[_0x7936('0x2c')]('exec\x20custom\x20report\x20id:%s',_0x1e56a9['CustomReportId']);return analyticCustomReportController[_0x7936('0x3b')]({'id':_0x1e56a9[_0x7936('0x3c')]},_0x1f2131)[_0x7936('0x30')](handleResult(_0x1e56a9))[_0x7936('0x34')](handleError());}}catch(_0x827364){logger[_0x7936('0x31')](JSON[_0x7936('0x29')](_0x827364));}return logger[_0x7936('0x2c')](_0x7936('0x3d'));};}function getJobs(_0x2e0da6){var _0x5a0d86={};if(_0x2e0da6){_0x5a0d86['id']=_0x2e0da6;}return db['Schedule'][_0x7936('0x3e')]({'where':_0x5a0d86,'include':[{'model':db[_0x7936('0xe')],'attributes':['id',_0x7936('0x18'),'email'],'include':[{'model':db[_0x7936('0x3f')],'as':_0x7936('0xc')}]}]})[_0x7936('0x30')](function(_0x1a898f){var _0x8abbd6=_[_0x7936('0x40')](manager[_0x7936('0x41')]);var _0x7a042c=_['map'](_0x1a898f,function(_0x1f4409){return _0x1f4409['id'][_0x7936('0x42')]();});var _0x50027e=_[_0x7936('0x43')](_0x1a898f,function(_0x55838d){return _0x55838d['id'][_0x7936('0x42')]();});var _0xc3ec7c=_0x2e0da6?_0x7a042c:_['difference'](_0x7a042c,_0x8abbd6);var _0xb8b11c=_[_0x7936('0x44')](_0x7a042c,_0x8abbd6);var _0xe5a1ce=_['difference'](_0x8abbd6,_0x7a042c);var _0x55a894;var _0x39fd96;for(_0x55a894=0x0;_0x55a894<_0xe5a1ce['length']&&!_0x2e0da6;_0x55a894+=0x1){_0x39fd96=_0xe5a1ce[_0x55a894][_0x7936('0x42')]();if(manager[_0x7936('0x45')](_0x39fd96)){manager[_0x7936('0x46')](_0x39fd96);manager[_0x7936('0x47')](_0x39fd96);logger[_0x7936('0x2c')](_0x7936('0x48'),_0x39fd96);}}logger[_0x7936('0x2c')]('toRun',JSON['stringify'](_0xc3ec7c));for(_0x55a894=0x0;_0x55a894<_0xc3ec7c[_0x7936('0x49')];_0x55a894+=0x1){_0x39fd96=_0xc3ec7c[_0x55a894]['toString']();logger[_0x7936('0x2c')]('index',_0x39fd96);if(_0x2e0da6){logger[_0x7936('0x2c')](_0x7936('0x4a'),_0x2e0da6);logger['info'](JSON[_0x7936('0x29')](_0x50027e[_0x39fd96]));BPromise[_0x7936('0x4b')]()[_0x7936('0x30')](handleJob(_0x50027e[_0x39fd96]));logger['info'](_0x7936('0x4c'),_0x50027e[_0x39fd96][_0x7936('0x18')],_0x50027e[_0x39fd96][_0x7936('0x4d')]);}else if(_0x50027e[_0x39fd96][_0x7936('0x4d')]&&_0x50027e[_0x39fd96]['active']&&moment()[_0x7936('0x4e')](_0x50027e[_0x39fd96][_0x7936('0x4f')],_0x50027e[_0x39fd96][_0x7936('0x50')])){manager['add'](_0x39fd96,_0x50027e[_0x39fd96][_0x7936('0x4d')],handleJob(_0x50027e[_0x39fd96]));manager[_0x7936('0x51')](_0x39fd96);logger[_0x7936('0x2c')](_0x7936('0x52'),_0x50027e[_0x39fd96][_0x7936('0x18')],_0x50027e[_0x39fd96]['cron']);}else if(manager[_0x7936('0x45')](_0x39fd96)){manager['stop'](_0x39fd96);manager[_0x7936('0x47')](_0x39fd96);logger[_0x7936('0x2c')](_0x7936('0x53'),_0x50027e[_0x39fd96]['name'],_0x50027e[_0x39fd96][_0x7936('0x4d')]);}}for(_0x55a894=0x0,_0x39fd96;_0x55a894<_0xb8b11c[_0x7936('0x49')]&&!_0x2e0da6;_0x55a894+=0x1){_0x39fd96=_0xb8b11c[_0x55a894]['toString']();if(manager[_0x7936('0x45')](_0x39fd96)){if(_0x50027e[_0x39fd96][_0x7936('0x4d')]&&_0x50027e[_0x39fd96][_0x7936('0x54')]&&moment()[_0x7936('0x4e')](_0x50027e[_0x39fd96][_0x7936('0x4f')],_0x50027e[_0x39fd96]['endAt'])){manager['update'](_0x39fd96,_0x50027e[_0x39fd96]['cron'],handleJob(_0x50027e[_0x39fd96]));logger['info'](_0x7936('0x55'),_0x50027e[_0x39fd96][_0x7936('0x18')],_0x50027e[_0x39fd96][_0x7936('0x4d')]);}else{manager['stop'](_0x39fd96);manager[_0x7936('0x47')](_0x39fd96);logger[_0x7936('0x2c')](_0x7936('0x53'),_0x50027e[_0x39fd96][_0x7936('0x18')],_0x50027e[_0x39fd96][_0x7936('0x4d')]);}}}})[_0x7936('0x34')](function(_0x851964){logger[_0x7936('0x31')](JSON['stringify'](_0x851964));});}exports['run']=function(_0x104f32){return getJobs(_0x104f32);};exports[_0x7936('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 50f21b3..f5a62b2 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fa0=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x8fa0,0xdb));var _0x08fa=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8fa0[_0x138adb];return _0x1b27f2;};'use strict';var util=require(_0x08fa('0x0'));var db=require(_0x08fa('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x08fa('0x2')]({'id':i,'firstName':_0x08fa('0x3')+i,'lastName':_0x08fa('0x4')+i,'phone':0xf879fb460+i,'email':_0x08fa('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x08fa('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x08fa('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x08fa('0x6')](),'updatedAt':Date[_0x08fa('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x08fa('0x3')+i,'lastName':_0x08fa('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x08fa('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x08fa('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x08fa('0x6')](),'updatedAt':Date[_0x08fa('0x6')]()});}db[_0x08fa('0x8')][_0x08fa('0x9')]({'where':{}})[_0x08fa('0xa')](function(){return db[_0x08fa('0x8')][_0x08fa('0xb')](contacts);})[_0x08fa('0xa')](function(){console[_0x08fa('0xc')](_0x08fa('0xd'),_0x08fa('0xe'));return db[_0x08fa('0xf')]['destroy']({'where':{}});})[_0x08fa('0xa')](function(){return db[_0x08fa('0xf')][_0x08fa('0xb')](hopper);})['then'](function(){console[_0x08fa('0xc')](_0x08fa('0xd'),_0x08fa('0x10'));return db[_0x08fa('0x8')][_0x08fa('0xb')](contacts2);})[_0x08fa('0xa')](function(){console['log'](_0x08fa('0xd'),_0x08fa('0x11'));return db[_0x08fa('0xf')][_0x08fa('0xb')](hopper2);})[_0x08fa('0xa')](function(){console['log'](_0x08fa('0xd'),_0x08fa('0x12'));})[_0x08fa('0x13')](function(_0x3d0a09){console[_0x08fa('0xc')](_0x3d0a09);}); \ No newline at end of file +var _0x36b9=['hopper1','contacts2','hopper2','catch','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating'];(function(_0xe3f1e2,_0x4b8bca){var _0x316d36=function(_0x25c684){while(--_0x25c684){_0xe3f1e2['push'](_0xe3f1e2['shift']());}};_0x316d36(++_0x4b8bca);}(_0x36b9,0x169));var _0x936b=function(_0x2abc23,_0x3520dd){_0x2abc23=_0x2abc23-0x0;var _0x1f52ee=_0x36b9[_0x2abc23];return _0x1f52ee;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x936b('0x0')]({'id':i,'firstName':_0x936b('0x1')+i,'lastName':_0x936b('0x2')+i,'phone':0xf879fb460+i,'email':_0x936b('0x3')+i+_0x936b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x936b('0x5')](),'updatedAt':Date[_0x936b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x936b('0x1')+i,'lastName':_0x936b('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x936b('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x936b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x936b('0x5')](),'updatedAt':Date['now']()});}db[_0x936b('0x6')]['destroy']({'where':{}})[_0x936b('0x7')](function(){return db[_0x936b('0x6')]['bulkCreate'](contacts);})['then'](function(){console[_0x936b('0x8')]('finished\x20populating',_0x936b('0x9'));return db[_0x936b('0xa')]['destroy']({'where':{}});})['then'](function(){return db[_0x936b('0xa')][_0x936b('0xb')](hopper);})['then'](function(){console[_0x936b('0x8')](_0x936b('0xc'),_0x936b('0xd'));return db[_0x936b('0x6')][_0x936b('0xb')](contacts2);})['then'](function(){console['log'](_0x936b('0xc'),_0x936b('0xe'));return db['CmHopper'][_0x936b('0xb')](hopper2);})[_0x936b('0x7')](function(){console[_0x936b('0x8')]('finished\x20populating',_0x936b('0xf'));})[_0x936b('0x10')](function(_0x37e6ca){console['log'](_0x37e6ca);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 13e37a4..d964859 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x245f=['format','agent','%s%s','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push'];(function(_0x57c071,_0x20bb79){var _0x513b4a=function(_0x537425){while(--_0x537425){_0x57c071['push'](_0x57c071['shift']());}};_0x513b4a(++_0x20bb79);}(_0x245f,0xce));var _0xf245=function(_0x5d29f2,_0x510aba){_0x5d29f2=_0x5d29f2-0x0;var _0x431753=_0x245f[_0x5d29f2];return _0x431753;};'use strict';var util=require(_0xf245('0x0'));var db=require(_0xf245('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf245('0x2')]({'name':util[_0xf245('0x3')]('%s%s',_0xf245('0x4'),i),'fullname':util[_0xf245('0x3')](_0xf245('0x5'),_0xf245('0x4'),i),'email':util[_0xf245('0x3')]('%s%s@xcally.com','agent',i),'role':_0xf245('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xf245('0x6'),'ws',_0xf245('0x7')],'disallow':[_0xf245('0x8')],'allow':[_0xf245('0x9')],'defaultuser':util[_0xf245('0x3')]('%s%s',_0xf245('0x4'),i),'encryption':_0xf245('0xa'),'avpf':_0xf245('0xa'),'force_avp':_0xf245('0xa'),'icesupport':_0xf245('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xf245('0xb'),'dtlsprivatekey':_0xf245('0xc'),'dtlssetup':_0xf245('0xd'),'callerid':util[_0xf245('0x3')]('\x22%s\x22\x20<%s>',util[_0xf245('0x3')](_0xf245('0x5'),_0xf245('0x4'),i),0xfa0+i)});}db[_0xf245('0xe')][_0xf245('0xf')](users)['then'](function(){console['log'](_0xf245('0x10'));})[_0xf245('0x11')](function(_0xdefef7){console[_0xf245('0x12')](_0xdefef7);}); \ No newline at end of file +var _0xb69b=['log','add\x20user','catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x40571e,_0x3e6ce8){var _0xcaa958=function(_0x9aaa2e){while(--_0x9aaa2e){_0x40571e['push'](_0x40571e['shift']());}};_0xcaa958(++_0x3e6ce8);}(_0xb69b,0xd4));var _0xbb69=function(_0x3725d7,_0x1ad773){_0x3725d7=_0x3725d7-0x0;var _0x1b85c2=_0xb69b[_0x3725d7];return _0x1b85c2;};'use strict';var util=require('util');var db=require(_0xbb69('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xbb69('0x1')]({'name':util['format'](_0xbb69('0x2'),'agent',i),'fullname':util['format'](_0xbb69('0x2'),_0xbb69('0x3'),i),'email':util[_0xbb69('0x4')](_0xbb69('0x5'),_0xbb69('0x3'),i),'role':_0xbb69('0x3'),'password':_0xbb69('0x6'),'internal':0xfa0+i,'type':_0xbb69('0x7'),'transport':[_0xbb69('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0xbb69('0x9')],'defaultuser':util[_0xbb69('0x4')](_0xbb69('0x2'),_0xbb69('0x3'),i),'encryption':_0xbb69('0xa'),'avpf':_0xbb69('0xa'),'force_avp':_0xbb69('0xa'),'icesupport':_0xbb69('0xa'),'dtlsenable':_0xbb69('0xa'),'dtlsverify':'no','dtlscertfile':_0xbb69('0xb'),'dtlsprivatekey':_0xbb69('0xc'),'dtlssetup':_0xbb69('0xd'),'callerid':util[_0xbb69('0x4')](_0xbb69('0xe'),util[_0xbb69('0x4')](_0xbb69('0x2'),_0xbb69('0x3'),i),0xfa0+i)});}db[_0xbb69('0xf')]['bulkCreate'](users)['then'](function(){console[_0xbb69('0x10')](_0xbb69('0x11'));})[_0xbb69('0x12')](function(_0x1f9245){console[_0xbb69('0x10')](_0x1f9245);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 86d335d..59df388 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75d1=['getMailQueues','getOpenchannelQueues','all','voice','chat','sms','mail','openchannel','trunk:%s','leave','emit','user_has_chat_interactions:remove','map','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','role','type','format','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','voice:inbound','FaxQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getSmsQueues'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x75d1,0x1f2));var _0x175d=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x75d1[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x175d('0x0'));var util=require(_0x175d('0x1'));var BPromise=require(_0x175d('0x2'));var db=require(_0x175d('0x3'))['db'];var config=require(_0x175d('0x4'));var queryQueues={'attributes':['id',_0x175d('0x5')],'include':[{'as':_0x175d('0x6'),'model':db[_0x175d('0x7')],'attributes':['id',_0x175d('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x175d('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x175d('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x175d('0x5')],'where':{'role':_0x175d('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x175d('0x5'),'type'],'where':{'type':_0x175d('0x9')}};function getAssociatedResources(_0x346b75,_0x2903b4,_0x8995f){return db[_0x175d('0xa')][_0x175d('0xb')]({'where':{'name':_0x346b75,'userProfileId':_0x2903b4},'raw':!![]})[_0x175d('0xc')](function(_0x21ab9a){if(_0x21ab9a){if(_0x21ab9a[_0x175d('0xd')]){switch(_0x346b75){case _0x175d('0xe'):case _0x175d('0xf'):case _0x175d('0x10'):case _0x175d('0x11'):case _0x175d('0x12'):case'OpenchannelQueues':return db[_0x8995f][_0x175d('0x13')](queryQueues);case _0x175d('0x14'):return db[_0x8995f][_0x175d('0x13')](queryTelephones);case _0x175d('0x15'):return db[_0x8995f][_0x175d('0x13')](queryTrunks);case _0x175d('0x16'):return db[_0x8995f]['findAll'](queryCampaigns);}}else{return db[_0x175d('0x17')][_0x175d('0x13')]({'attributes':[_0x175d('0x18')],'where':{'sectionId':_0x21ab9a['id']},'raw':!![]})['then'](function(_0x4beea5){if(_0x4beea5){var _0x3c5fa9={'where':{'id':_['map'](_0x4beea5,'resourceId')},'raw':!![]};switch(_0x8995f){case _0x175d('0x7'):_0x3c5fa9['where'][_0x175d('0x19')]='telephone';break;case'Campaign':_0x3c5fa9['where'][_0x175d('0x1a')]=_0x175d('0x9');break;}return db[_0x8995f][_0x175d('0x13')](_0x3c5fa9);}else{return[];}});}}else{return[];}})[_0x175d('0xc')](function(_0x4e4acf){return _0x4e4acf;});}function joinOrLeaveQueues(_0x1fef21,_0x1059d4,_0x74b43d,_0xfe8c7d){_0x1fef21[_0x1059d4](util[_0x175d('0x1b')]('%s:queue:%s',_0x74b43d,_0xfe8c7d[_0x175d('0x5')]));if(_0xfe8c7d[_0x175d('0x6')]){for(var _0xe38cd3=0x0;_0xe38cd3<_0xfe8c7d[_0x175d('0x6')][_0x175d('0x1c')];_0xe38cd3+=0x1){_0x1fef21[_0x1059d4](util[_0x175d('0x1b')](_0x175d('0x1d'),_0xfe8c7d[_0x175d('0x6')][_0xe38cd3]['name']));}}}function joinOrLeave(_0x43a3f6,_0xb22797,_0x3a4148){var _0x257ffd;if(_0x43a3f6[_0x175d('0x1e')][_0x175d('0x1f')]['id']){db[_0x175d('0x7')][_0x175d('0x20')]({'attributes':['id','name',_0x175d('0x19'),_0x175d('0x21')],'where':{'id':_0x43a3f6[_0x175d('0x1e')]['query']['id']},'include':[{'model':db[_0x175d('0x22')],'as':_0x175d('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x175d('0x24')],'as':_0x175d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x175d('0x26')],'as':_0x175d('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x175d('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x175d('0x29'),'attributes':['id'],'raw':!![]}]})[_0x175d('0xc')](function(_0x5b53bd){if(_0x5b53bd){_0x257ffd=_0x5b53bd;_0x43a3f6[_0xb22797](util[_0x175d('0x1b')](_0x175d('0x1d'),_0x5b53bd['name']));var _0x396bf8=[];switch(_0x5b53bd[_0x175d('0x19')]){case'admin':_0x43a3f6[_0xb22797]('voice:inbound');_0x43a3f6[_0xb22797](_0x175d('0x2a'));if(queryQueues[_0x175d('0x2b')](_0x175d('0x2c'))){delete queryQueues[_0x175d('0x2c')];}_0x396bf8[_0x175d('0x2d')](db[_0x175d('0x2e')][_0x175d('0x13')](queryQueues));_0x396bf8['push'](db[_0x175d('0x2f')]['findAll'](queryQueues));_0x396bf8[_0x175d('0x2d')](db['FaxQueue'][_0x175d('0x13')](queryQueues));_0x396bf8['push'](db[_0x175d('0x30')]['findAll'](queryQueues));_0x396bf8[_0x175d('0x2d')](db[_0x175d('0x31')][_0x175d('0x13')](queryQueues));_0x396bf8[_0x175d('0x2d')](db[_0x175d('0x32')][_0x175d('0x13')](queryQueues));_0x396bf8[_0x175d('0x2d')](db[_0x175d('0x7')][_0x175d('0x13')](queryTelephones));_0x396bf8[_0x175d('0x2d')](db[_0x175d('0x33')][_0x175d('0x13')](queryTrunks));_0x396bf8['push'](db[_0x175d('0x34')][_0x175d('0x13')](queryCampaigns));_0x396bf8[_0x175d('0x2d')](db[_0x175d('0x7')][_0x175d('0x13')](queryAgents));break;case _0x175d('0x35'):_0x43a3f6[_0xb22797](_0x175d('0x36'));_0x43a3f6[_0xb22797](_0x175d('0x2a'));_0x396bf8[_0x175d('0x2d')](getAssociatedResources(_0x175d('0xe'),_0x5b53bd[_0x175d('0x21')],_0x175d('0x2e')));_0x396bf8['push'](getAssociatedResources(_0x175d('0xf'),_0x5b53bd[_0x175d('0x21')],_0x175d('0x2f')));_0x396bf8['push'](getAssociatedResources(_0x175d('0x10'),_0x5b53bd[_0x175d('0x21')],_0x175d('0x37')));_0x396bf8[_0x175d('0x2d')](getAssociatedResources('SmsQueues',_0x5b53bd[_0x175d('0x21')],_0x175d('0x30')));_0x396bf8[_0x175d('0x2d')](getAssociatedResources(_0x175d('0x12'),_0x5b53bd[_0x175d('0x21')],'MailQueue'));_0x396bf8[_0x175d('0x2d')](getAssociatedResources(_0x175d('0x38'),_0x5b53bd['userProfileId'],_0x175d('0x32')));_0x396bf8[_0x175d('0x2d')](getAssociatedResources(_0x175d('0x14'),_0x5b53bd[_0x175d('0x21')],_0x175d('0x7')));_0x396bf8[_0x175d('0x2d')](getAssociatedResources('Trunks',_0x5b53bd['userProfileId'],_0x175d('0x33')));_0x396bf8[_0x175d('0x2d')](getAssociatedResources(_0x175d('0x16'),_0x5b53bd[_0x175d('0x21')],_0x175d('0x34')));_0x396bf8['push'](db[_0x175d('0x7')]['findAll'](queryAgents));break;case _0x175d('0x8'):_0x43a3f6[_0xb22797]('voice:inbound');_0x43a3f6[_0xb22797](_0x175d('0x2a'));_0x396bf8[_0x175d('0x2d')](_0x5b53bd[_0x175d('0x39')]({'attributes':['id',_0x175d('0x5')]}));_0x396bf8[_0x175d('0x2d')](_0x5b53bd[_0x175d('0x3a')]({'attributes':['id',_0x175d('0x5')]}));_0x396bf8[_0x175d('0x2d')](_0x5b53bd['getFaxQueues']({'attributes':['id',_0x175d('0x5')]}));_0x396bf8[_0x175d('0x2d')](_0x5b53bd[_0x175d('0x3b')]({'attributes':['id','name']}));_0x396bf8[_0x175d('0x2d')](_0x5b53bd[_0x175d('0x3c')]({'attributes':['id',_0x175d('0x5')]}));_0x396bf8[_0x175d('0x2d')](_0x5b53bd[_0x175d('0x3d')]({'attributes':['id',_0x175d('0x5')]}));break;}return BPromise[_0x175d('0x3e')](_0x396bf8);}})['then'](function(_0x2d0728){if(_0x2d0728&&_0x2d0728[_0x175d('0x1c')]){for(var _0x1a6d8f=0x0;_0x1a6d8f<_0x2d0728[_0x175d('0x1c')];_0x1a6d8f+=0x1){for(var _0x32843d=0x0;_0x32843d<_0x2d0728[_0x1a6d8f][_0x175d('0x1c')];_0x32843d+=0x1){switch(_0x1a6d8f){case 0x0:joinOrLeaveQueues(_0x43a3f6,_0xb22797,_0x175d('0x3f'),_0x2d0728[_0x1a6d8f][_0x32843d]);break;case 0x1:joinOrLeaveQueues(_0x43a3f6,_0xb22797,_0x175d('0x40'),_0x2d0728[_0x1a6d8f][_0x32843d]);break;case 0x2:joinOrLeaveQueues(_0x43a3f6,_0xb22797,'fax',_0x2d0728[_0x1a6d8f][_0x32843d]);break;case 0x3:joinOrLeaveQueues(_0x43a3f6,_0xb22797,_0x175d('0x41'),_0x2d0728[_0x1a6d8f][_0x32843d]);break;case 0x4:joinOrLeaveQueues(_0x43a3f6,_0xb22797,_0x175d('0x42'),_0x2d0728[_0x1a6d8f][_0x32843d]);break;case 0x5:joinOrLeaveQueues(_0x43a3f6,_0xb22797,_0x175d('0x43'),_0x2d0728[_0x1a6d8f][_0x32843d]);break;case 0x6:_0x43a3f6[_0xb22797](util[_0x175d('0x1b')]('telephone:%s',_0x2d0728[_0x1a6d8f][_0x32843d][_0x175d('0x5')]));break;case 0x7:_0x43a3f6[_0xb22797](util[_0x175d('0x1b')](_0x175d('0x44'),_0x2d0728[_0x1a6d8f][_0x32843d][_0x175d('0x5')]));break;case 0x8:_0x43a3f6[_0xb22797](util['format']('campaign:%s:%s',_0x2d0728[_0x1a6d8f][_0x32843d]['type'],_0x2d0728[_0x1a6d8f][_0x32843d]['name']));break;case 0x9:_0x43a3f6[_0xb22797](util[_0x175d('0x1b')](_0x175d('0x1d'),_0x2d0728[_0x1a6d8f][_0x32843d][_0x175d('0x5')]));break;}}}}})[_0x175d('0xc')](function(){if(_0xb22797===_0x175d('0x45')){var _0x4d57cf=_['map'](_0x257ffd['ChatInteractions'],'id');return _0x257ffd['removeChatInteractions'](_0x4d57cf)[_0x175d('0xc')](function(){for(var _0x5320f8=0x0;_0x5320f8<_0x4d57cf[_0x175d('0x1c')];_0x5320f8+=0x1){_0x3a4148[_0x175d('0x46')](_0x175d('0x47'),{'ChatInteractionId':Number(_0x4d57cf[_0x5320f8]),'UserId':Number(_0x257ffd['id'])});}});}})['then'](function(){if(_0xb22797===_0x175d('0x45')){var _0x181b74=_[_0x175d('0x48')](_0x257ffd['MailInteractions'],'id');return _0x257ffd[_0x175d('0x49')](_0x181b74)[_0x175d('0xc')](function(){for(var _0x2404f8=0x0;_0x2404f8<_0x181b74[_0x175d('0x1c')];_0x2404f8+=0x1){_0x3a4148[_0x175d('0x46')](_0x175d('0x4a'),{'MailInteractionId':Number(_0x181b74[_0x2404f8]),'UserId':Number(_0x257ffd['id'])});}});}})['then'](function(){if(_0xb22797==='leave'){var _0x5f09f6=_[_0x175d('0x48')](_0x257ffd[_0x175d('0x27')],'id');return _0x257ffd[_0x175d('0x4b')](_0x5f09f6)[_0x175d('0xc')](function(){for(var _0x12e709=0x0;_0x12e709<_0x5f09f6[_0x175d('0x1c')];_0x12e709+=0x1){_0x3a4148[_0x175d('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5f09f6[_0x12e709]),'UserId':Number(_0x257ffd['id'])});}});}})['then'](function(){if(_0xb22797===_0x175d('0x45')){var _0x1a0cb6=_['map'](_0x257ffd[_0x175d('0x4c')],'id');return _0x257ffd['removeSmsInteractions'](_0x1a0cb6)[_0x175d('0xc')](function(){for(var _0x39ef31=0x0;_0x39ef31<_0x1a0cb6[_0x175d('0x1c')];_0x39ef31+=0x1){_0x3a4148[_0x175d('0x46')](_0x175d('0x4d'),{'SmsInteractionId':Number(_0x1a0cb6[_0x39ef31]),'UserId':Number(_0x257ffd['id'])});}});}})['then'](function(){if(_0xb22797===_0x175d('0x45')){var _0x5d5ce0=_['map'](_0x257ffd['OpenchannelInteractions'],'id');return _0x257ffd[_0x175d('0x4e')](_0x5d5ce0)['then'](function(){for(var _0x4171db=0x0;_0x4171db<_0x5d5ce0[_0x175d('0x1c')];_0x4171db+=0x1){_0x3a4148[_0x175d('0x46')](_0x175d('0x4f'),{'OpenchannelInteractionId':Number(_0x5d5ce0[_0x4171db]),'UserId':Number(_0x257ffd['id'])});}});}})[_0x175d('0x50')](function(_0x2f4b06){_0x43a3f6[_0x175d('0x51')](_0x2f4b06);});}}function onDisconnect(_0x20540a,_0x57508e){joinOrLeave(_0x20540a,_0x175d('0x45'),_0x57508e);}function onConnect(_0x33d8da){joinOrLeave(_0x33d8da,_0x175d('0x52'));}exports['default']=function(_0x475c0f){_0x475c0f['on'](_0x175d('0x53'),function(_0x24fa22){_0x24fa22[_0x175d('0x54')](0x0);_0x24fa22[_0x175d('0x55')]=_0x24fa22[_0x175d('0x56')][_0x175d('0x53')][_0x175d('0x57')]+':'+_0x24fa22['request']['connection'][_0x175d('0x58')];_0x24fa22[_0x175d('0x59')]=new Date();_0x24fa22[_0x175d('0x51')]=function(_0x43d5e8){console[_0x175d('0x51')](_0x175d('0x5a')+_0x24fa22[_0x175d('0x5b')]['name']+'['+_0x24fa22[_0x175d('0x55')]+']',_0x43d5e8);};_0x24fa22['on']('disconnect',function(){onDisconnect(_0x24fa22,_0x475c0f);_0x24fa22[_0x175d('0x51')]('DISCONNECTED');});onConnect(_0x24fa22);_0x24fa22[_0x175d('0x51')](_0x175d('0x5c'));});}; \ No newline at end of file +var _0x2eb4=['emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','ChatQueues','FaxQueues','getChatQueues','getFaxQueues','getSmsQueues','all','chat','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x2eb4,0x193));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x42eb('0x0'));var util=require(_0x42eb('0x1'));var BPromise=require(_0x42eb('0x2'));var db=require(_0x42eb('0x3'))['db'];var config=require(_0x42eb('0x4'));var queryQueues={'attributes':['id',_0x42eb('0x5')],'include':[{'as':'Agents','model':db[_0x42eb('0x6')],'attributes':['id',_0x42eb('0x5'),_0x42eb('0x7')],'raw':!![],'where':{'role':_0x42eb('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x42eb('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x42eb('0x5')],'where':{'role':_0x42eb('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x42eb('0x9')],'where':{'type':_0x42eb('0xa')}};function getAssociatedResources(_0x20bfd3,_0x3239cd,_0x35471e){return db[_0x42eb('0xb')][_0x42eb('0xc')]({'where':{'name':_0x20bfd3,'userProfileId':_0x3239cd},'raw':!![]})[_0x42eb('0xd')](function(_0x28c090){if(_0x28c090){if(_0x28c090[_0x42eb('0xe')]){switch(_0x20bfd3){case _0x42eb('0xf'):case'ChatQueues':case'FaxQueues':case _0x42eb('0x10'):case _0x42eb('0x11'):case _0x42eb('0x12'):return db[_0x35471e][_0x42eb('0x13')](queryQueues);case _0x42eb('0x14'):return db[_0x35471e][_0x42eb('0x13')](queryTelephones);case _0x42eb('0x15'):return db[_0x35471e][_0x42eb('0x13')](queryTrunks);case _0x42eb('0x16'):return db[_0x35471e]['findAll'](queryCampaigns);}}else{return db[_0x42eb('0x17')][_0x42eb('0x13')]({'attributes':[_0x42eb('0x18')],'where':{'sectionId':_0x28c090['id']},'raw':!![]})[_0x42eb('0xd')](function(_0x5ce708){if(_0x5ce708){var _0x388274={'where':{'id':_[_0x42eb('0x19')](_0x5ce708,_0x42eb('0x18'))},'raw':!![]};switch(_0x35471e){case _0x42eb('0x6'):_0x388274[_0x42eb('0x1a')][_0x42eb('0x7')]=_0x42eb('0x1b');break;case _0x42eb('0x1c'):_0x388274['where'][_0x42eb('0x9')]=_0x42eb('0xa');break;}return db[_0x35471e]['findAll'](_0x388274);}else{return[];}});}}else{return[];}})[_0x42eb('0xd')](function(_0xac592c){return _0xac592c;});}function joinOrLeaveQueues(_0x4f2c6a,_0x56dfb9,_0x25c735,_0x3d1c38){_0x4f2c6a[_0x56dfb9](util[_0x42eb('0x1d')](_0x42eb('0x1e'),_0x25c735,_0x3d1c38['name']));if(_0x3d1c38[_0x42eb('0x1f')]){for(var _0x2a6563=0x0;_0x2a6563<_0x3d1c38[_0x42eb('0x1f')][_0x42eb('0x20')];_0x2a6563+=0x1){_0x4f2c6a[_0x56dfb9](util['format'](_0x42eb('0x21'),_0x3d1c38[_0x42eb('0x1f')][_0x2a6563][_0x42eb('0x5')]));}}}function joinOrLeave(_0x3df25b,_0x2e932f,_0x26b24e){var _0x3ed9b3;if(_0x3df25b[_0x42eb('0x22')][_0x42eb('0x23')]['id']){db[_0x42eb('0x6')]['find']({'attributes':['id',_0x42eb('0x5'),_0x42eb('0x7'),_0x42eb('0x24')],'where':{'id':_0x3df25b[_0x42eb('0x22')][_0x42eb('0x23')]['id']},'include':[{'model':db[_0x42eb('0x25')],'as':_0x42eb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x42eb('0x27')],'as':_0x42eb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x42eb('0x29')],'as':_0x42eb('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x42eb('0x2b')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x42eb('0x2c')],'as':_0x42eb('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xf7c7c3){if(_0xf7c7c3){_0x3ed9b3=_0xf7c7c3;_0x3df25b[_0x2e932f](util[_0x42eb('0x1d')]('user:%s',_0xf7c7c3[_0x42eb('0x5')]));var _0x11733a=[];switch(_0xf7c7c3[_0x42eb('0x7')]){case'admin':_0x3df25b[_0x2e932f](_0x42eb('0x2e'));_0x3df25b[_0x2e932f](_0x42eb('0x2f'));if(queryQueues[_0x42eb('0x30')](_0x42eb('0x31'))){delete queryQueues[_0x42eb('0x31')];}_0x11733a['push'](db[_0x42eb('0x32')][_0x42eb('0x13')](queryQueues));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x34')][_0x42eb('0x13')](queryQueues));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x35')][_0x42eb('0x13')](queryQueues));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x36')][_0x42eb('0x13')](queryQueues));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x37')]['findAll'](queryQueues));_0x11733a['push'](db[_0x42eb('0x38')]['findAll'](queryQueues));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x6')][_0x42eb('0x13')](queryTelephones));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x39')][_0x42eb('0x13')](queryTrunks));_0x11733a[_0x42eb('0x33')](db['Campaign'][_0x42eb('0x13')](queryCampaigns));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x6')][_0x42eb('0x13')](queryAgents));break;case _0x42eb('0x3a'):_0x3df25b[_0x2e932f]('voice:inbound');_0x3df25b[_0x2e932f](_0x42eb('0x2f'));_0x11733a[_0x42eb('0x33')](getAssociatedResources(_0x42eb('0xf'),_0xf7c7c3[_0x42eb('0x24')],_0x42eb('0x32')));_0x11733a['push'](getAssociatedResources(_0x42eb('0x3b'),_0xf7c7c3[_0x42eb('0x24')],_0x42eb('0x34')));_0x11733a[_0x42eb('0x33')](getAssociatedResources(_0x42eb('0x3c'),_0xf7c7c3[_0x42eb('0x24')],_0x42eb('0x35')));_0x11733a[_0x42eb('0x33')](getAssociatedResources('SmsQueues',_0xf7c7c3['userProfileId'],_0x42eb('0x36')));_0x11733a[_0x42eb('0x33')](getAssociatedResources(_0x42eb('0x11'),_0xf7c7c3[_0x42eb('0x24')],_0x42eb('0x37')));_0x11733a[_0x42eb('0x33')](getAssociatedResources(_0x42eb('0x12'),_0xf7c7c3['userProfileId'],'OpenchannelQueue'));_0x11733a[_0x42eb('0x33')](getAssociatedResources(_0x42eb('0x14'),_0xf7c7c3[_0x42eb('0x24')],'User'));_0x11733a['push'](getAssociatedResources(_0x42eb('0x15'),_0xf7c7c3[_0x42eb('0x24')],'Trunk'));_0x11733a[_0x42eb('0x33')](getAssociatedResources(_0x42eb('0x16'),_0xf7c7c3[_0x42eb('0x24')],'Campaign'));_0x11733a[_0x42eb('0x33')](db[_0x42eb('0x6')]['findAll'](queryAgents));break;case _0x42eb('0x8'):_0x3df25b[_0x2e932f](_0x42eb('0x2e'));_0x3df25b[_0x2e932f](_0x42eb('0x2f'));_0x11733a[_0x42eb('0x33')](_0xf7c7c3['getVoiceQueues']({'attributes':['id',_0x42eb('0x5')]}));_0x11733a[_0x42eb('0x33')](_0xf7c7c3[_0x42eb('0x3d')]({'attributes':['id','name']}));_0x11733a['push'](_0xf7c7c3[_0x42eb('0x3e')]({'attributes':['id','name']}));_0x11733a[_0x42eb('0x33')](_0xf7c7c3[_0x42eb('0x3f')]({'attributes':['id',_0x42eb('0x5')]}));_0x11733a[_0x42eb('0x33')](_0xf7c7c3['getMailQueues']({'attributes':['id',_0x42eb('0x5')]}));_0x11733a[_0x42eb('0x33')](_0xf7c7c3['getOpenchannelQueues']({'attributes':['id','name']}));break;}return BPromise[_0x42eb('0x40')](_0x11733a);}})['then'](function(_0x1256f4){if(_0x1256f4&&_0x1256f4[_0x42eb('0x20')]){for(var _0x29abfe=0x0;_0x29abfe<_0x1256f4[_0x42eb('0x20')];_0x29abfe+=0x1){for(var _0x3bd9b6=0x0;_0x3bd9b6<_0x1256f4[_0x29abfe][_0x42eb('0x20')];_0x3bd9b6+=0x1){switch(_0x29abfe){case 0x0:joinOrLeaveQueues(_0x3df25b,_0x2e932f,'voice',_0x1256f4[_0x29abfe][_0x3bd9b6]);break;case 0x1:joinOrLeaveQueues(_0x3df25b,_0x2e932f,_0x42eb('0x41'),_0x1256f4[_0x29abfe][_0x3bd9b6]);break;case 0x2:joinOrLeaveQueues(_0x3df25b,_0x2e932f,'fax',_0x1256f4[_0x29abfe][_0x3bd9b6]);break;case 0x3:joinOrLeaveQueues(_0x3df25b,_0x2e932f,'sms',_0x1256f4[_0x29abfe][_0x3bd9b6]);break;case 0x4:joinOrLeaveQueues(_0x3df25b,_0x2e932f,_0x42eb('0x42'),_0x1256f4[_0x29abfe][_0x3bd9b6]);break;case 0x5:joinOrLeaveQueues(_0x3df25b,_0x2e932f,'openchannel',_0x1256f4[_0x29abfe][_0x3bd9b6]);break;case 0x6:_0x3df25b[_0x2e932f](util['format'](_0x42eb('0x43'),_0x1256f4[_0x29abfe][_0x3bd9b6][_0x42eb('0x5')]));break;case 0x7:_0x3df25b[_0x2e932f](util[_0x42eb('0x1d')](_0x42eb('0x44'),_0x1256f4[_0x29abfe][_0x3bd9b6]['name']));break;case 0x8:_0x3df25b[_0x2e932f](util[_0x42eb('0x1d')](_0x42eb('0x45'),_0x1256f4[_0x29abfe][_0x3bd9b6][_0x42eb('0x9')],_0x1256f4[_0x29abfe][_0x3bd9b6]['name']));break;case 0x9:_0x3df25b[_0x2e932f](util['format']('user:%s',_0x1256f4[_0x29abfe][_0x3bd9b6][_0x42eb('0x5')]));break;}}}}})[_0x42eb('0xd')](function(){if(_0x2e932f===_0x42eb('0x46')){var _0x53d4b4=_[_0x42eb('0x19')](_0x3ed9b3[_0x42eb('0x26')],'id');return _0x3ed9b3[_0x42eb('0x47')](_0x53d4b4)[_0x42eb('0xd')](function(){for(var _0x9d6168=0x0;_0x9d6168<_0x53d4b4[_0x42eb('0x20')];_0x9d6168+=0x1){_0x26b24e[_0x42eb('0x48')](_0x42eb('0x49'),{'ChatInteractionId':Number(_0x53d4b4[_0x9d6168]),'UserId':Number(_0x3ed9b3['id'])});}});}})[_0x42eb('0xd')](function(){if(_0x2e932f===_0x42eb('0x46')){var _0x481615=_[_0x42eb('0x19')](_0x3ed9b3[_0x42eb('0x28')],'id');return _0x3ed9b3['removeMailInteractions'](_0x481615)[_0x42eb('0xd')](function(){for(var _0x37bb6a=0x0;_0x37bb6a<_0x481615['length'];_0x37bb6a+=0x1){_0x26b24e['emit'](_0x42eb('0x4a'),{'MailInteractionId':Number(_0x481615[_0x37bb6a]),'UserId':Number(_0x3ed9b3['id'])});}});}})['then'](function(){if(_0x2e932f===_0x42eb('0x46')){var _0x5025d5=_['map'](_0x3ed9b3[_0x42eb('0x2a')],'id');return _0x3ed9b3['removeFaxInteractions'](_0x5025d5)['then'](function(){for(var _0x3baa69=0x0;_0x3baa69<_0x5025d5[_0x42eb('0x20')];_0x3baa69+=0x1){_0x26b24e[_0x42eb('0x48')](_0x42eb('0x4b'),{'FaxInteractionId':Number(_0x5025d5[_0x3baa69]),'UserId':Number(_0x3ed9b3['id'])});}});}})[_0x42eb('0xd')](function(){if(_0x2e932f===_0x42eb('0x46')){var _0x2da129=_[_0x42eb('0x19')](_0x3ed9b3['SmsInteractions'],'id');return _0x3ed9b3[_0x42eb('0x4c')](_0x2da129)[_0x42eb('0xd')](function(){for(var _0x10eb6c=0x0;_0x10eb6c<_0x2da129['length'];_0x10eb6c+=0x1){_0x26b24e[_0x42eb('0x48')](_0x42eb('0x4d'),{'SmsInteractionId':Number(_0x2da129[_0x10eb6c]),'UserId':Number(_0x3ed9b3['id'])});}});}})['then'](function(){if(_0x2e932f===_0x42eb('0x46')){var _0x5e9d85=_[_0x42eb('0x19')](_0x3ed9b3[_0x42eb('0x2d')],'id');return _0x3ed9b3[_0x42eb('0x4e')](_0x5e9d85)[_0x42eb('0xd')](function(){for(var _0x3d9a70=0x0;_0x3d9a70<_0x5e9d85['length'];_0x3d9a70+=0x1){_0x26b24e[_0x42eb('0x48')](_0x42eb('0x4f'),{'OpenchannelInteractionId':Number(_0x5e9d85[_0x3d9a70]),'UserId':Number(_0x3ed9b3['id'])});}});}})[_0x42eb('0x50')](function(_0x517fb2){_0x3df25b[_0x42eb('0x51')](_0x517fb2);});}}function onDisconnect(_0xffc729,_0x55fdc3){joinOrLeave(_0xffc729,_0x42eb('0x46'),_0x55fdc3);}function onConnect(_0x2fe91b){joinOrLeave(_0x2fe91b,_0x42eb('0x52'));}exports['default']=function(_0x4e630a){_0x4e630a['on'](_0x42eb('0x53'),function(_0x586459){_0x586459[_0x42eb('0x54')](0x0);_0x586459['address']=_0x586459[_0x42eb('0x55')][_0x42eb('0x53')][_0x42eb('0x56')]+':'+_0x586459['request'][_0x42eb('0x53')][_0x42eb('0x57')];_0x586459[_0x42eb('0x58')]=new Date();_0x586459[_0x42eb('0x51')]=function(_0x42c162){console[_0x42eb('0x51')](_0x42eb('0x59')+_0x586459[_0x42eb('0x5a')][_0x42eb('0x5')]+'['+_0x586459[_0x42eb('0x5b')]+']',_0x42c162);};_0x586459['on'](_0x42eb('0x5c'),function(){onDisconnect(_0x586459,_0x4e630a);_0x586459['log'](_0x42eb('0x5d'));});onConnect(_0x586459);_0x586459[_0x42eb('0x51')](_0x42eb('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d639ccf..9aa9833 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 _0xde7b=['closed','find','default','length','hasOwnProperty','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','afterUpdate','SmsMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelMessage','request','EventManager','Trigger,\x20%s','error','catch','get','channel','event','direction','UserId','then','interface','format','name','incomingmessage','opened','changed'];(function(_0x453398,_0x56eae9){var _0x1ae894=function(_0x9f925){while(--_0x9f925){_0x453398['push'](_0x453398['shift']());}};_0x1ae894(++_0x56eae9);}(_0xde7b,0x71));var _0xbde7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xde7b[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0xbde7('0x0'));var db=require(_0xbde7('0x1'))['db'];var jayson=require(_0xbde7('0x2'));var logger=require(_0xbde7('0x3'))(_0xbde7('0x4'));var client=jayson[_0xbde7('0x5')][_0xbde7('0x6')]({'port':0x232a});var triggers=[{'channel':_0xbde7('0x7'),'model':_0xbde7('0x8'),'event':_0xbde7('0x9'),'condition':_0xbde7('0xa'),'callback':afterCreate},{'channel':_0xbde7('0x7'),'model':_0xbde7('0x8'),'event':'afterUpdate','condition':_0xbde7('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0xbde7('0xc'),'event':_0xbde7('0x9'),'condition':_0xbde7('0xd'),'callback':afterCreateMessage},{'channel':_0xbde7('0xe'),'model':_0xbde7('0xf'),'event':_0xbde7('0x9'),'condition':_0xbde7('0xa'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0xbde7('0x10'),'condition':_0xbde7('0xb'),'callback':afterUpdate},{'channel':_0xbde7('0xe'),'model':_0xbde7('0x11'),'event':_0xbde7('0x9'),'condition':_0xbde7('0xd'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xbde7('0x12'),'event':'afterCreate','condition':_0xbde7('0xa'),'callback':afterCreate},{'channel':_0xbde7('0x13'),'model':_0xbde7('0x12'),'event':_0xbde7('0x10'),'condition':_0xbde7('0xb'),'callback':afterUpdate},{'channel':_0xbde7('0x13'),'model':_0xbde7('0x14'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbde7('0x15'),'model':_0xbde7('0x16'),'event':'afterCreate','condition':_0xbde7('0xa'),'callback':afterCreate},{'channel':_0xbde7('0x15'),'model':_0xbde7('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbde7('0x15'),'model':_0xbde7('0x17'),'event':_0xbde7('0x9'),'condition':_0xbde7('0xd'),'callback':afterCreateMessage},{'channel':_0xbde7('0x18'),'model':'OpenchannelInteraction','event':_0xbde7('0x9'),'condition':_0xbde7('0xa'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xbde7('0x10'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbde7('0x18'),'model':_0xbde7('0x19'),'event':_0xbde7('0x9'),'condition':_0xbde7('0xd'),'callback':afterCreateMessage}];function request(_0x474d8){return client[_0xbde7('0x1a')](_0xbde7('0x1b'),_0x474d8)['then'](function(_0x2338ab){logger['info'](_0xbde7('0x1c'),_0xbde7('0x1b'),_0x2338ab);if(_0x2338ab[_0xbde7('0x1d')]){if(_0x2338ab[_0xbde7('0x1d')]['code']===0x1f4){logger[_0xbde7('0x1d')](_0xbde7('0x1c'),_0xbde7('0x1b'),_0x2338ab[_0xbde7('0x1d')]);}}})[_0xbde7('0x1e')](function(_0x2e7afd){logger[_0xbde7('0x1d')](_0xbde7('0x1c'),_0xbde7('0x1b'),_0x2e7afd);});}function afterCreateMessage(_0x302a5d,_0x5ab2e3){return function(_0x55bb6a,_0x31658d){_0x55bb6a=_0x55bb6a[_0xbde7('0x1f')]({'plain':!![]});_0x55bb6a[_0xbde7('0x20')]=_0x302a5d;_0x55bb6a[_0xbde7('0x21')]=_0x55bb6a[_0xbde7('0x22')];if(_0x55bb6a[_0xbde7('0x23')]){return db['User']['find']({'where':{'id':_0x55bb6a[_0xbde7('0x23')]},'attributes':['id','name'],'raw':!![]})[_0xbde7('0x24')](function(_0x1b55cd){_0x55bb6a[_0xbde7('0x25')]=util[_0xbde7('0x26')]('SIP/%s',_0x1b55cd[_0xbde7('0x27')]);_0x55bb6a[_0xbde7('0x20')]=_0x302a5d;return request({'event':_0xbde7('0x28'),'message':_0x55bb6a});})[_0xbde7('0x1e')](function(_0x5d2923){console[_0xbde7('0x1d')](_0x5d2923);});}else{return request({'event':'outgoingmessage','message':_0x55bb6a});}};}function afterCreate(_0x50bc48,_0x49c883){return function(_0xfe7407,_0x38c580){_0xfe7407=_0xfe7407['get']({'plain':!![]});_0xfe7407[_0xbde7('0x20')]=_0x50bc48;_0xfe7407[_0xbde7('0x21')]=_0xbde7('0x29');return request({'event':_0x49c883,'message':_0xfe7407});};}function afterUpdate(_0x45bf6e,_0x37fc68){return function(_0x561c12,_0x4f2f2e){if(_0x561c12[_0xbde7('0x2a')](_0xbde7('0x2b'))&&_0x561c12[_0xbde7('0x2b')]){_0x561c12=_0x561c12[_0xbde7('0x1f')]({'plain':!![]});_0x561c12[_0xbde7('0x20')]=_0x45bf6e;_0x561c12[_0xbde7('0x21')]='closed';if(_0x561c12['UserId']){return db['User'][_0xbde7('0x2c')]({'where':{'id':_0x561c12[_0xbde7('0x23')]},'attributes':['id',_0xbde7('0x27')],'raw':!![]})[_0xbde7('0x24')](function(_0x4b2b19){_0x561c12[_0xbde7('0x25')]=util[_0xbde7('0x26')]('SIP/%s',_0x4b2b19[_0xbde7('0x27')]);return request({'event':_0x37fc68,'message':_0x561c12});})[_0xbde7('0x1e')](function(_0x2ab49){console['error'](_0x2ab49);});}else{return request({'event':_0x37fc68,'message':_0x561c12});}}};}exports[_0xbde7('0x2d')]=function(){for(var _0x2ee06d=0x0;_0x2ee06d=_0x58c68f['agents']){throw Error(_0xb50e('0x12'));}_0x3498c8(_0x466b7c);})[_0xb50e('0x13')](function(_0x33206c){_0x31de39(_0x33206c);});});}; \ No newline at end of file +var _0x0df9=['getChannels','isValidChannel','toLowerCase','includes','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','voice','mail','chat','fax'];(function(_0x2e44ff,_0x43b03a){var _0x548f7f=function(_0x3a8b42){while(--_0x3a8b42){_0x2e44ff['push'](_0x2e44ff['shift']());}};_0x548f7f(++_0x43b03a);}(_0x0df9,0x1b1));var _0x90df=function(_0x131bbd,_0x2997f7){_0x131bbd=_0x131bbd-0x0;var _0x25651d=_0x0df9[_0x131bbd];return _0x25651d;};'use strict';var _=require('lodash');var BPromise=require(_0x90df('0x0'));var db=require(_0x90df('0x1'))['db'];var util=require(_0x90df('0x2'));var channels=[_0x90df('0x3'),_0x90df('0x4'),_0x90df('0x5'),_0x90df('0x6'),'sms','openchannel'];exports[_0x90df('0x7')]=function(){return channels;};exports[_0x90df('0x8')]=function(_0x109b05){_0x109b05=_0x109b05[_0x90df('0x9')]();return _[_0x90df('0xa')](channels,_0x109b05);};exports['clearBlockUser']=function(_0x36a046,_0x5c8701,_0x309f52,_0x5860dc){var _0x26ec69={'loginAttempts':_0x5c8701,'blocked':_0x309f52};if(!_['isUndefined'](_0x5860dc)){_0x26ec69[_0x90df('0xb')]=_0x5860dc;}return _0x36a046[_0x90df('0xc')](_0x26ec69);};exports[_0x90df('0xd')]=function(_0x56abd9){return new BPromise(function(_0x409cb6,_0x32ff49){var _0x39817c=0x0;if(_0x56abd9[_0x90df('0xe')]!==_0x90df('0xf')){_0x409cb6(_0x56abd9);}db[_0x90df('0x10')][_0x90df('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x56abd9['id']}}})['then'](function(_0x50c476){_0x39817c=_0x50c476;return util[_0x90df('0xd')]();})[_0x90df('0x12')](function(_0x4fa10e){if(_0x4fa10e&&_0x4fa10e[_0x90df('0x13')]&&_0x39817c>=_0x4fa10e[_0x90df('0x13')]){throw Error(_0x90df('0x14'));}_0x409cb6(_0x56abd9);})[_0x90df('0x15')](function(_0x2945ae){_0x32ff49(_0x2945ae);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 53aa0be..7ee8ad9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3ae=['render','json','send','exports','404','status'];(function(_0x855caa,_0x5624fa){var _0x25488a=function(_0x4407bd){while(--_0x4407bd){_0x855caa['push'](_0x855caa['shift']());}};_0x25488a(++_0x5624fa);}(_0xf3ae,0x105));var _0xef3a=function(_0x54f9b3,_0x1db9da){_0x54f9b3=_0x54f9b3-0x0;var _0x3e8e5c=_0xf3ae[_0x54f9b3];return _0x3e8e5c;};'use strict';module[_0xef3a('0x0')][0x194]=function pageNotFound(_0x562282,_0x49e893){var _0x29edc2=_0xef3a('0x1');var _0x5d9612=0x194;var _0x36be1c={'status':_0x5d9612};_0x49e893[_0xef3a('0x2')](_0x36be1c[_0xef3a('0x2')]);_0x49e893[_0xef3a('0x3')](_0x29edc2,{},function(_0x5509f3,_0x4cedf5){if(_0x5509f3){return _0x49e893['status'](_0x36be1c[_0xef3a('0x2')])[_0xef3a('0x4')](_0x36be1c);}_0x49e893[_0xef3a('0x5')](_0x4cedf5);});}; \ No newline at end of file +var _0x15b5=['status','render','json','exports'];(function(_0x1b5a2d,_0x63c7b){var _0x1a630e=function(_0x2c6a40){while(--_0x2c6a40){_0x1b5a2d['push'](_0x1b5a2d['shift']());}};_0x1a630e(++_0x63c7b);}(_0x15b5,0x9b));var _0x515b=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x15b5[_0x3a6e4b];return _0x36572d;};'use strict';module[_0x515b('0x0')][0x194]=function pageNotFound(_0x5d5b82,_0x58d642){var _0x131bed='404';var _0x2639fd=0x194;var _0x56dfee={'status':_0x2639fd};_0x58d642[_0x515b('0x1')](_0x56dfee[_0x515b('0x1')]);_0x58d642[_0x515b('0x2')](_0x131bed,{},function(_0x2d17ba,_0xbcdf2f){if(_0x2d17ba){return _0x58d642[_0x515b('0x1')](_0x56dfee[_0x515b('0x1')])[_0x515b('0x3')](_0x56dfee);}_0x58d642['send'](_0xbcdf2f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7148ebd..9410f92 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3837=['OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../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','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../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','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/crmNation/crmNation.model','CrmWorkflow','../api/crmWorkflow/crmWorkflow.model','CrmWorkflowStep','../api/crmWorkflowstep/crmWorkflowstep.model','CrmTask','../api/crmTask/crmTask.model','CrmActionsList','../api/crmActionsList/crmActionsList.model','SATypeProduct','../api/saTypeProduct/saTypeProduct.model','SAUnitMeasure','../api/saUnitMeasure/saUnitMeasure.model','SAInvoiceLaw','../api/saInvoiceLaw/saInvoiceLaw.model','SAProduct','../api/saProduct/saProduct.model','SASalesCondition','../api/saSalesCondition/saSalesCondition.model','../api/saPriceList/saPriceList.model','SAProductPricesList','../api/saProductPricesList/saProductPricesList.model','SADossier','../api/saDossier/saDossier.model','SARequest','../api/saRequest/saRequest.model','../api/saQuotation/saQuotation.model','../api/saProductQuotation/saProductQuotation.model','../api/saProforma/saProforma.model','SAInvoice','../api/saInvoice/saInvoice.model','SAAsset','../api/saAsset/saAsset.model','SAInvoiceDetail','../api/saInvoiceDetail/saInvoiceDetail.model','SAProformaDetail','../api/saProformaDetail/saProformaDetail.model','SAPayment','../api/saPayment/saPayment.model','SAPaymentMethod','../api/saPaymentMethod/saPaymentMethod.model','SACreditNote','../api/saCreditNote/saCreditNote.model','SACreditNoteDetail','../api/saCreditNoteDetail/saCreditNoteDetail.model','SAInvoiceNumber','../api/saInvoiceNumber/saInvoiceNumber.model','SACreditNoteNumber','SACompanyType','../api/saCompanyType/saCompanyType.model','SACompanyRelationship','User','hasOne','cascade','hasMany','Recordings','UserId','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','user_has_voice_prefixes','user_has_chat_websites','MailAccounts','user_has_openchannel_accounts','user_has_sms_accounts','SquareProjects','user_has_square_projects','SpiedAgents','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','team_has_voice_queues','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','MailAccountId','Imap','Smtp','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachment','Attachments','Interaction','restrict','IntervalId','TagId','MailQueueReport','Contact','ContactId','Dashboard','Dispositions','FaxAccountId','Applications','Exntensions','mandatoryDispositionPause','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','Users','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelAccount','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueue','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','Website','RelatedCompany','CompanyId','SAPriceList','PriceLists','Dossiers','saPaymentMethod','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','Trigger','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','AnalyticMetric','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','SugarcrmAccount','VariableId','int_desk_configuration_has_tags','ZendeskAccount','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerAccount','int_vtiger_configuration_has_tags','ServicenowAccount','Dynamics365Field','FromId','ToId','SessionId','ProjectId','team_has_chat_queues','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Extensions','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WorkflowId','WorkflowStepId','CrmWorkflowNextStep','crm_workflow_steps_has_crm_workflow_steps','TaskId','TypeProductId','UnitMeasureId','SaleCondition','TypeSalesConditionId','TypeProduct','PriceListId','SAProductQuotation','ProductPriceList','Product','Pricelist','DossierId','SAQuotation','SAOrder','SAProforma','Company','Workflow','Requests','RequestId','QuotationId','Quotations','Dossier','Request','ProductPricesList','ProductPriceListId','Quotation','Proforma','Orders','OrderId','ProformaId','Order','InvoiceId','Details','Payments','Invoice','Companies','CreditNote','CreditNoteId','saCompanyType','saCompanyRelationship','exports','../config/environment','lodash','determine','sequelize','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','xC@LL1234','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../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','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model'];(function(_0x23725f,_0x1f4529){var _0x16b0f6=function(_0x5b8471){while(--_0x5b8471){_0x23725f['push'](_0x23725f['shift']());}};_0x16b0f6(++_0x1f4529);}(_0x3837,0x1d1));var _0x7383=function(_0x186537,_0xa344f1){_0x186537=_0x186537-0x0;var _0x3ec1d4=_0x3837[_0x186537];return _0x3ec1d4;};'use strict';var path=require('path');var config=require(_0x7383('0x0'));var Sequelize=require('sequelize');var _=require(_0x7383('0x1'));var jstz=require('jstz');var timezone=jstz[_0x7383('0x2')]();config[_0x7383('0x3')]=_[_0x7383('0x4')](config[_0x7383('0x3')],{'database':_0x7383('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x7383('0x6'),'port':0xcea,'dialect':_0x7383('0x7'),'dialectOptions':{'charset':_0x7383('0x8')},'logging':![],'timezone':timezone[_0x7383('0x9')](),'define':{'charset':_0x7383('0xa'),'collate':_0x7383('0xb')}}});config[_0x7383('0xc')]=_['defaultsDeep'](config[_0x7383('0xc')],{'database':_0x7383('0x5'),'username':_0x7383('0xd'),'password':_0x7383('0xe'),'options':{'host':_0x7383('0x6'),'port':0xcea,'dialect':_0x7383('0x7'),'dialectOptions':{'charset':_0x7383('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7383('0xa'),'collate':_0x7383('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7383('0x3')][_0x7383('0xf')],config[_0x7383('0x3')][_0x7383('0x10')],config[_0x7383('0x3')][_0x7383('0x11')],config[_0x7383('0x3')][_0x7383('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7383('0xc')]['database'],config[_0x7383('0xc')][_0x7383('0x10')],config[_0x7383('0xc')][_0x7383('0x11')],config['sequelizeHistory']['options'])};db['User']=db['sequelize'][_0x7383('0x13')](_0x7383('0x14'));db[_0x7383('0x15')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x7383('0x16')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x17'));db[_0x7383('0x18')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x19'));db[_0x7383('0x1a')]=db[_0x7383('0x3')]['import'](_0x7383('0x1b'));db[_0x7383('0x1c')]=db[_0x7383('0x3')]['import'](_0x7383('0x1d'));db[_0x7383('0x1e')]=db['sequelize'][_0x7383('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x7383('0x1f')]=db[_0x7383('0x3')]['import'](_0x7383('0x20'));db[_0x7383('0x21')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x22'));db['VoiceMailMessage']=db[_0x7383('0x3')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0x7383('0x23')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x24'));db[_0x7383('0x25')]=db[_0x7383('0x3')]['import'](_0x7383('0x26'));db[_0x7383('0x27')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x28'));db[_0x7383('0x29')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x2a'));db[_0x7383('0x2b')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x2c'));db['Trunk']=db['sequelize']['import'](_0x7383('0x2d'));db[_0x7383('0x2e')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x2f'));db[_0x7383('0x30')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x31'));db[_0x7383('0x32')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x33'));db[_0x7383('0x34')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x35'));db[_0x7383('0x36')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x7383('0x37')]=db[_0x7383('0x3')]['import'](_0x7383('0x38'));db[_0x7383('0x39')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x3a'));db['UserOpenchannelQueue']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x3b'));db[_0x7383('0x3c')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x3d'));db['MailServerOut']=db['sequelize']['import'](_0x7383('0x3e'));db[_0x7383('0x3f')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x40'));db[_0x7383('0x41')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x42'));db['MailSubstatus']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x43'));db[_0x7383('0x44')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x7383('0x45')]=db['sequelize']['import'](_0x7383('0x46'));db[_0x7383('0x47')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x48'));db['MailQueueReport']=db['sequelize'][_0x7383('0x13')](_0x7383('0x49'));db['Dashboard']=db['sequelize'][_0x7383('0x13')](_0x7383('0x4a'));db[_0x7383('0x4b')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x7383('0x4c')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x4d'));db[_0x7383('0x4e')]=db[_0x7383('0x3')]['import'](_0x7383('0x4f'));db[_0x7383('0x50')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x7383('0x51')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x52'));db[_0x7383('0x53')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x54'));db[_0x7383('0x55')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x56'));db[_0x7383('0x57')]=db['sequelize'][_0x7383('0x13')]('../api/smsAccount/smsAccount.model');db[_0x7383('0x58')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/smsApplication/smsApplication.model');db[_0x7383('0x59')]=db[_0x7383('0x3')]['import'](_0x7383('0x5a'));db['SmsMessage']=db[_0x7383('0x3')]['import'](_0x7383('0x5b'));db['SmsQueue']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x5c'));db['OpenchannelAccount']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x5d'));db['OpenchannelApplication']=db['sequelize'][_0x7383('0x13')](_0x7383('0x5e'));db[_0x7383('0x5f')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x60'));db[_0x7383('0x61')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x62'));db['OpenchannelQueue']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x63'));db[_0x7383('0x64')]=db[_0x7383('0x3')]['import'](_0x7383('0x65'));db[_0x7383('0x66')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x67'));db[_0x7383('0x68')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x69'));db[_0x7383('0x6a')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x6b'));db[_0x7383('0x6c')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x6d'));db['ChatOfflineMessage']=db[_0x7383('0x3')]['import'](_0x7383('0x6e'));db[_0x7383('0x6f')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x70'));db[_0x7383('0x71')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x72'));db[_0x7383('0x73')]=db['sequelize'][_0x7383('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x7383('0x74')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x75'));db[_0x7383('0x76')]=db[_0x7383('0x3')]['import'](_0x7383('0x77'));db['CmHopper']=db['sequelize']['import'](_0x7383('0x78'));db[_0x7383('0x79')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x7a'));db[_0x7383('0x7b')]=db[_0x7383('0x3')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x7383('0x7c')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x7d'));db[_0x7383('0x7e')]=db['sequelize']['import'](_0x7383('0x7f'));db[_0x7383('0x80')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x81'));db[_0x7383('0x82')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/action/action.model');db[_0x7383('0x83')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x84'));db[_0x7383('0x85')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x86'));db[_0x7383('0x87')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x88'));db[_0x7383('0x89')]=db[_0x7383('0x3')]['import'](_0x7383('0x8a'));db[_0x7383('0x8b')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x8c'));db[_0x7383('0x8d')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/pause/pause.model');db[_0x7383('0x8e')]=db[_0x7383('0x3')]['import'](_0x7383('0x8f'));db[_0x7383('0x90')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x7383('0x91')]=db[_0x7383('0x3')]['import'](_0x7383('0x92'));db[_0x7383('0x93')]=db[_0x7383('0x3')]['import'](_0x7383('0x94'));db[_0x7383('0x95')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x96'));db[_0x7383('0x97')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x98'));db['Trigger']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x99'));db['Variable']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x9a'));db[_0x7383('0x9b')]=db[_0x7383('0x3')]['import']('../api/integration/integration.model');db['IntegrationReport']=db['sequelize'][_0x7383('0x13')](_0x7383('0x9c'));db[_0x7383('0x9d')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x9e'));db['AnalyticDefaultReport']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x9f'));db[_0x7383('0xa0')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xa1'));db['AnalyticMetric']=db['sequelize']['import'](_0x7383('0xa2'));db[_0x7383('0xa3')]=db[_0x7383('0x3')]['import'](_0x7383('0xa4'));db[_0x7383('0xa5')]=db[_0x7383('0x3')]['import'](_0x7383('0xa6'));db[_0x7383('0xa7')]=db[_0x7383('0x3')]['import'](_0x7383('0xa8'));db[_0x7383('0xa9')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xaa'));db[_0x7383('0xab')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xac'));db['SugarcrmAccount']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x7383('0xad')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xae'));db[_0x7383('0xaf')]=db[_0x7383('0x3')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x7383('0xb0')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xb1'));db[_0x7383('0xb2')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x7383('0xb3')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/intDeskField/intDeskField.model');db[_0x7383('0xb4')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xb5'));db[_0x7383('0xb6')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xb7'));db[_0x7383('0xb8')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xb9'));db['ZendeskAccount']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xba'));db[_0x7383('0xbb')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xbc'));db[_0x7383('0xbd')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xbe'));db['FreshdeskAccount']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xbf'));db['VtigerAccount']=db['sequelize'][_0x7383('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xc0'));db[_0x7383('0xc1')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xc2'));db['ServicenowAccount']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xc3'));db[_0x7383('0xc4')]=db[_0x7383('0x3')]['import'](_0x7383('0xc5'));db[_0x7383('0xc6')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xc7'));db[_0x7383('0xc8')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xc9'));db[_0x7383('0xca')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xcb'));db['Dynamics365Field']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x7383('0x9b')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/integration/integration.model');db['Network']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xcc'));db[_0x7383('0xcd')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xce'));db[_0x7383('0xcf')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xd0'));db[_0x7383('0xd1')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xd2'));db[_0x7383('0xd3')]=db[_0x7383('0x3')]['import'](_0x7383('0xd4'));db['JscriptySessionReport']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xd5'));db[_0x7383('0xd6')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xd7'));db[_0x7383('0xd8')]=db['sequelize'][_0x7383('0x13')]('../api/squareReport/squareReport.model');db[_0x7383('0xd9')]=db[_0x7383('0x3')]['import'](_0x7383('0xda'));db[_0x7383('0xdb')]=db['sequelize']['import'](_0x7383('0xdc'));db[_0x7383('0xdd')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/setting/setting.model');db[_0x7383('0xde')]=db[_0x7383('0x3')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x7383('0xdf')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xe0'));db[_0x7383('0xe1')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0x7383('0x13')](_0x7383('0xe2'));db[_0x7383('0xe3')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xe4'));db[_0x7383('0xe5')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xe6'));db['Campaign']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xe7'));db['Migration']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/attachment/attachment.model');db[_0x7383('0xe8')]=db['sequelize'][_0x7383('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x7383('0x3')]['import'](_0x7383('0xe9'));db[_0x7383('0xea')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xeb'));db['FaxTransferReport']=db[_0x7383('0x3')]['import'](_0x7383('0xec'));db[_0x7383('0xed')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xee'));db[_0x7383('0xef')]=db['sequelize'][_0x7383('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x7383('0xf0')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xf1'));db[_0x7383('0xf2')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xf3'));db[_0x7383('0xf4')]=db['sequelize'][_0x7383('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xf5'));db['UserProfileResource']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xf6'));db['CrmNation']=db['sequelize'][_0x7383('0x13')](_0x7383('0xf7'));db[_0x7383('0xf8')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xf9'));db[_0x7383('0xfa')]=db['sequelize'][_0x7383('0x13')](_0x7383('0xfb'));db[_0x7383('0xfc')]=db[_0x7383('0x3')]['import'](_0x7383('0xfd'));db[_0x7383('0xfe')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0xff'));db[_0x7383('0x100')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x101'));db[_0x7383('0x102')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x103'));db[_0x7383('0x104')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x105'));db[_0x7383('0x106')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x107'));db[_0x7383('0x108')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x109'));db['SAPriceList']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x10a'));db[_0x7383('0x10b')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x10c'));db[_0x7383('0x10d')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x10e'));db[_0x7383('0x10f')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x110'));db['SAQuotation']=db['sequelize'][_0x7383('0x13')](_0x7383('0x111'));db['SAProductQuotation']=db['sequelize'][_0x7383('0x13')](_0x7383('0x112'));db['SAOrder']=db[_0x7383('0x3')][_0x7383('0x13')]('../api/saOrder/saOrder.model');db['SAProforma']=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x113'));db[_0x7383('0x114')]=db[_0x7383('0x3')]['import'](_0x7383('0x115'));db[_0x7383('0x116')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x117'));db[_0x7383('0x118')]=db[_0x7383('0x3')]['import'](_0x7383('0x119'));db[_0x7383('0x11a')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x11b'));db[_0x7383('0x11c')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x11d'));db[_0x7383('0x11e')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x11f'));db[_0x7383('0x120')]=db[_0x7383('0x3')]['import'](_0x7383('0x121'));db[_0x7383('0x122')]=db[_0x7383('0x3')][_0x7383('0x13')](_0x7383('0x123'));db[_0x7383('0x124')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x125'));db[_0x7383('0x126')]=db['sequelize'][_0x7383('0x13')]('../api/saCreditNoteNumber/saCreditNoteNumber.model');db[_0x7383('0x127')]=db['sequelize'][_0x7383('0x13')](_0x7383('0x128'));db[_0x7383('0x129')]=db[_0x7383('0x3')][_0x7383('0x13')]('../api/saCompanyRelationship/saCompanyRelationship.model');db[_0x7383('0x12a')][_0x7383('0x12b')](db[_0x7383('0x21')],{'as':_0x7383('0x21'),'onDelete':_0x7383('0x12c'),'foreignKey':'UserId'});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x1e')],{'as':_0x7383('0x12e'),'foreignKey':_0x7383('0x12f')});db['User']['hasMany'](db[_0x7383('0x30')],{'as':_0x7383('0x130'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x18')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x7b')],{'as':_0x7383('0x131'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')]['hasMany'](db[_0x7383('0x7c')],{'as':_0x7383('0x132'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')][_0x7383('0x12d')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x5f')],{'as':_0x7383('0x133'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x6a')],{'as':_0x7383('0x134'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x59')],{'as':_0x7383('0x135'),'foreignKey':'UserId'});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x50')],{'as':'FaxInteractions','foreignKey':_0x7383('0x12f')});db[_0x7383('0x12a')][_0x7383('0x12d')](db[_0x7383('0x44')],{'as':_0x7383('0x136'),'foreignKey':'UserId'});db[_0x7383('0x12a')][_0x7383('0x137')](db[_0x7383('0xf4')],{'as':_0x7383('0xf4'),'foreignKey':_0x7383('0x138')});db['User'][_0x7383('0x139')](db['ChatGroup'],{'as':_0x7383('0x13a'),'through':_0x7383('0x13b')});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0x76')],{'as':_0x7383('0x13c'),'through':_0x7383('0x13d')});db['User'][_0x7383('0x139')](db['CmList'],{'as':_0x7383('0x13e'),'through':_0x7383('0x13f')});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0xe3')],{'through':_0x7383('0x140')});db['User'][_0x7383('0x139')](db[_0x7383('0x44')],{'as':_0x7383('0x136'),'through':_0x7383('0x141')});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0x6a')],{'as':_0x7383('0x134'),'through':_0x7383('0x142')});db[_0x7383('0x12a')]['belongsToMany'](db[_0x7383('0x50')],{'as':_0x7383('0x143'),'through':_0x7383('0x144')});db['User'][_0x7383('0x139')](db[_0x7383('0x59')],{'as':_0x7383('0x135'),'through':_0x7383('0x145')});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0x5f')],{'as':_0x7383('0x133'),'through':_0x7383('0x146')});db[_0x7383('0x12a')][_0x7383('0x139')](db['VoiceQueue'],{'as':_0x7383('0x147'),'through':'UserVoiceQueue','required':![]});db[_0x7383('0x12a')][_0x7383('0x139')](db['MailQueue'],{'as':_0x7383('0x148'),'through':_0x7383('0x36'),'required':![]});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0x6f')],{'as':_0x7383('0x149'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x7383('0x12a')]['belongsToMany'](db[_0x7383('0x53')],{'as':_0x7383('0x14a'),'through':_0x7383('0x37'),'required':![]});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0x14b')],{'as':_0x7383('0x14c'),'through':'UserSmsQueue','required':![]});db[_0x7383('0x12a')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0x7383('0x14d'),'through':_0x7383('0x14e'),'required':![]});db[_0x7383('0x12a')][_0x7383('0x139')](db[_0x7383('0xf0')],{'through':_0x7383('0x13f')});db[_0x7383('0x12a')]['belongsToMany'](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x7383('0x14f'),'required':![]});db['User'][_0x7383('0x139')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x7383('0x150')});db['User'][_0x7383('0x139')](db[_0x7383('0x4c')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x7383('0x12a')]['belongsToMany'](db[_0x7383('0x3f')],{'as':_0x7383('0x151'),'through':'user_has_mail_accounts'});db[_0x7383('0x12a')][_0x7383('0x139')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x7383('0x152')});db[_0x7383('0x12a')]['belongsToMany'](db[_0x7383('0x57')],{'as':'SmsAccounts','through':_0x7383('0x153')});db['User'][_0x7383('0x139')](db['SquareProject'],{'as':_0x7383('0x154'),'through':_0x7383('0x155')});db[_0x7383('0x15')][_0x7383('0x12d')](db[_0x7383('0x18')],{'as':_0x7383('0x156'),'onDelete':_0x7383('0x12c'),'foreignKey':'ChanSpyId'});db[_0x7383('0x16')][_0x7383('0x12d')](db['VoiceExtension'],{'onDelete':_0x7383('0x12c')});db['VoiceExtension'][_0x7383('0x12d')](db[_0x7383('0x18')],{'as':'Applications','onDelete':_0x7383('0x12c')});db['VoiceMusicOnHold'][_0x7383('0x139')](db[_0x7383('0x93')],{'as':'Sounds','through':_0x7383('0x157')});db[_0x7383('0x1c')][_0x7383('0x12d')](db[_0x7383('0x30')],{'as':_0x7383('0x158'),'foreignKey':_0x7383('0x159')});db[_0x7383('0x1c')]['hasMany'](db[_0x7383('0x15a')],{'as':_0x7383('0x15b'),'foreignKey':_0x7383('0x159')});db['VoiceQueue']['hasMany'](db[_0x7383('0x7b')],{'as':_0x7383('0x131'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7383('0x12d')](db['CmHopperHistory'],{'as':_0x7383('0x15c'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7383('0x12d')](db[_0x7383('0x7e')],{'as':_0x7383('0x7e'),'foreignKey':_0x7383('0x159')});db['VoiceQueue']['hasMany'](db[_0x7383('0x79')],{'as':_0x7383('0x15d'),'foreignKey':'VoiceQueueId'});db[_0x7383('0x1c')][_0x7383('0x12d')](db[_0x7383('0x15e')],{'as':_0x7383('0x15f'),'foreignKey':'VoiceQueueId'});db[_0x7383('0x1c')][_0x7383('0x137')](db[_0x7383('0x160')],{'as':'Trunk','foreignKey':_0x7383('0x161')});db[_0x7383('0x1c')]['belongsTo'](db[_0x7383('0x160')],{'as':_0x7383('0x162'),'foreignKey':_0x7383('0x163')});db[_0x7383('0x1c')][_0x7383('0x137')](db[_0x7383('0x8b')],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue'][_0x7383('0x137')](db[_0x7383('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0x7383('0x164')});db[_0x7383('0x1c')][_0x7383('0x139')](db[_0x7383('0xf0')],{'as':'Lists','through':_0x7383('0x165')});db['VoiceQueue']['belongsToMany'](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x32')});db['VoiceQueue'][_0x7383('0x139')](db['Team'],{'as':'Teams','through':_0x7383('0x167')});db[_0x7383('0x1c')][_0x7383('0x139')](db['CmList'],{'as':'BlackLists','through':_0x7383('0x168')});db[_0x7383('0x1e')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':_0x7383('0x12a'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x1f')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':'User','foreignKey':'UserId'});db[_0x7383('0x21')][_0x7383('0x12d')](db[_0x7383('0x169')],{'as':_0x7383('0x16a'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x16b'),'sourceKey':_0x7383('0x16c')});db[_0x7383('0x169')][_0x7383('0x137')](db['VoiceMail'],{'foreignKey':_0x7383('0x16b'),'targetKey':_0x7383('0x16c')});db[_0x7383('0x23')][_0x7383('0x12d')](db[_0x7383('0x29')],{'as':_0x7383('0x16d'),'foreignKey':_0x7383('0x16e'),'constraints':![]});db[_0x7383('0x23')]['hasMany'](db[_0x7383('0x27')],{'as':_0x7383('0x16f'),'foreignKey':_0x7383('0x16e'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x7383('0x12a')],{'as':_0x7383('0x12a'),'foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db[_0x7383('0x76')],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0x7383('0x137')](db['MailAccount'],{'as':_0x7383('0x3f'),'foreignKey':_0x7383('0x170')});db['MailServerOut'][_0x7383('0x137')](db[_0x7383('0x3f')],{'as':_0x7383('0x3f'),'foreignKey':_0x7383('0x170')});db[_0x7383('0x3f')][_0x7383('0x12b')](db[_0x7383('0x3c')],{'as':_0x7383('0x171'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x3f')]['hasOne'](db['MailServerOut'],{'as':_0x7383('0x172'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x3f')][_0x7383('0x12d')](db[_0x7383('0x87')],{'as':'Dispositions','foreignKey':_0x7383('0x170')});db[_0x7383('0x3f')]['hasMany'](db[_0x7383('0x85')],{'as':_0x7383('0x173'),'foreignKey':'MailAccountId'});db[_0x7383('0x3f')][_0x7383('0x12d')](db[_0x7383('0x45')],{'as':_0x7383('0x16a'),'foreignKey':_0x7383('0x170')});db['MailAccount']['hasMany'](db[_0x7383('0x44')],{'as':_0x7383('0x174')});db[_0x7383('0x3f')][_0x7383('0x12d')](db['MailApplication'],{'as':'Applications'});db['MailAccount'][_0x7383('0x137')](db['CmList'],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0x3f')][_0x7383('0x137')](db['Template'],{'as':_0x7383('0x97'),'foreignKey':_0x7383('0x177')});db[_0x7383('0x3f')]['belongsTo'](db[_0x7383('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7383('0x3f')][_0x7383('0x139')](db['User'],{'as':_0x7383('0x166'),'through':'user_has_mail_accounts'});db[_0x7383('0x41')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':'Agents','through':_0x7383('0x36')});db[_0x7383('0x41')][_0x7383('0x139')](db[_0x7383('0xe3')],{'through':_0x7383('0x178'),'as':_0x7383('0x179')});db['MailInteraction'][_0x7383('0x12d')](db[_0x7383('0x45')],{'as':_0x7383('0x16a'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x17a')});db[_0x7383('0x44')]['belongsTo'](db[_0x7383('0x3f')],{'as':_0x7383('0x17b'),'foreignKey':'MailAccountId'});db[_0x7383('0x44')]['belongsTo'](db[_0x7383('0x76')],{'as':'Contact','foreignKey':'ContactId'});db['MailInteraction'][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':_0x7383('0x17c'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x44')][_0x7383('0x139')](db['Tag'],{'through':_0x7383('0x17d'),'as':_0x7383('0x17e')});db[_0x7383('0x44')][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x17d'),'as':_0x7383('0x17f')});db[_0x7383('0x44')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':'Users','through':_0x7383('0x141'),'foreignKey':'MailInteractionId'});db[_0x7383('0x45')][_0x7383('0x12d')](db[_0x7383('0x180')],{'as':_0x7383('0x181'),'onDelete':'cascade'});db[_0x7383('0x45')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':_0x7383('0x12a')});db[_0x7383('0x45')][_0x7383('0x137')](db[_0x7383('0x76')],{'onDelete':'cascade','as':'Contact'});db[_0x7383('0x45')][_0x7383('0x137')](db['MailInteraction'],{'as':_0x7383('0x182'),'foreignKey':_0x7383('0x17a')});db[_0x7383('0x45')][_0x7383('0x137')](db[_0x7383('0x3f')],{'as':'Account','foreignKey':_0x7383('0x170')});db['MailApplication'][_0x7383('0x137')](db[_0x7383('0x12a')],{'onDelete':'restrict'});db[_0x7383('0x47')][_0x7383('0x137')](db[_0x7383('0x41')],{'onDelete':'restrict'});db[_0x7383('0x47')]['belongsTo'](db[_0x7383('0x3f')],{'onDelete':_0x7383('0x183')});db[_0x7383('0x47')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x7383('0x184')});db['MailApplication'][_0x7383('0x137')](db['Tag'],{'onDelete':_0x7383('0x183'),'foreignKey':_0x7383('0x185')});db['MailQueueReport'][_0x7383('0x137')](db[_0x7383('0x3f')],{});db[_0x7383('0x186')]['belongsTo'](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0x186')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x186')][_0x7383('0x137')](db[_0x7383('0x44')],{});db[_0x7383('0x186')][_0x7383('0x137')](db[_0x7383('0x45')],{});db[_0x7383('0x186')][_0x7383('0x137')](db[_0x7383('0x12a')],{});db['MailQueueReport'][_0x7383('0x137')](db[_0x7383('0x41')],{});db[_0x7383('0x189')][_0x7383('0x12d')](db[_0x7383('0x4b')],{'as':'Items','onDelete':'cascade'});db[_0x7383('0x4c')]['hasMany'](db[_0x7383('0x87')],{'as':_0x7383('0x18a'),'foreignKey':_0x7383('0x18b')});db[_0x7383('0x4c')][_0x7383('0x12d')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x7383('0x4c')][_0x7383('0x12d')](db[_0x7383('0x50')],{'as':_0x7383('0x174')});db[_0x7383('0x4c')][_0x7383('0x12d')](db[_0x7383('0x4e')],{'as':_0x7383('0x18c')});db[_0x7383('0x4c')][_0x7383('0x12d')](db[_0x7383('0x18')],{'as':_0x7383('0x18d'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x4c')][_0x7383('0x12d')](db[_0x7383('0x51')],{'as':_0x7383('0x16a')});db[_0x7383('0x4c')][_0x7383('0x137')](db[_0x7383('0x160')],{'as':_0x7383('0x160')});db[_0x7383('0x4c')][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':'ListId'});db[_0x7383('0x4c')][_0x7383('0x137')](db[_0x7383('0x8d')],{'as':_0x7383('0x18e'),'foreignKey':_0x7383('0x164')});db[_0x7383('0x4c')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x18f')});db[_0x7383('0x4e')][_0x7383('0x137')](db[_0x7383('0x12a')],{'onDelete':_0x7383('0x183')});db[_0x7383('0x4e')]['belongsTo'](db[_0x7383('0x53')],{'onDelete':_0x7383('0x183')});db[_0x7383('0x4e')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x7383('0x183')});db[_0x7383('0x4e')]['belongsTo'](db['Tag'],{'onDelete':_0x7383('0x183'),'foreignKey':_0x7383('0x185')});db[_0x7383('0x50')][_0x7383('0x12d')](db[_0x7383('0x51')],{'as':_0x7383('0x16a'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x190')});db[_0x7383('0x50')][_0x7383('0x137')](db[_0x7383('0x4c')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x18b')});db[_0x7383('0x50')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':'Contact','foreignKey':_0x7383('0x188')});db[_0x7383('0x50')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':'Owner','foreignKey':_0x7383('0x12f')});db[_0x7383('0x50')][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x191'),'as':_0x7383('0x17e')});db['FaxInteraction'][_0x7383('0x139')](db['Tag'],{'through':_0x7383('0x191'),'as':'ThroughTags'});db[_0x7383('0x50')]['belongsToMany'](db[_0x7383('0x12a')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x7383('0x190')});db[_0x7383('0x51')][_0x7383('0x137')](db[_0x7383('0x12a')],{'onDelete':_0x7383('0x12c'),'as':_0x7383('0x12a')});db[_0x7383('0x51')][_0x7383('0x137')](db[_0x7383('0x50')],{'as':_0x7383('0x182'),'foreignKey':_0x7383('0x190')});db[_0x7383('0x51')][_0x7383('0x137')](db['CmContact'],{'onDelete':'cascade','as':_0x7383('0x187')});db[_0x7383('0x51')][_0x7383('0x137')](db['Attachment'],{'as':'Attachment','foreignKey':_0x7383('0x192')});db['FaxMessage'][_0x7383('0x137')](db[_0x7383('0x4c')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x18b')});db[_0x7383('0x53')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x37')});db['FaxQueue'][_0x7383('0x139')](db[_0x7383('0xe3')],{'through':_0x7383('0x193'),'as':'Teams'});db[_0x7383('0x55')]['belongsTo'](db['FaxAccount'],{});db[_0x7383('0x55')][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':'ListId'});db[_0x7383('0x55')][_0x7383('0x137')](db['CmContact'],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x55')][_0x7383('0x137')](db[_0x7383('0x50')],{});db[_0x7383('0x55')]['belongsTo'](db[_0x7383('0x51')],{});db[_0x7383('0x55')][_0x7383('0x137')](db[_0x7383('0x12a')],{});db['FaxQueueReport'][_0x7383('0x137')](db[_0x7383('0x53')],{});db[_0x7383('0x57')][_0x7383('0x12d')](db[_0x7383('0x87')],{'as':'Dispositions','foreignKey':_0x7383('0x194')});db[_0x7383('0x57')][_0x7383('0x12d')](db['CannedAnswer'],{'as':_0x7383('0x173'),'foreignKey':_0x7383('0x194')});db['SmsAccount']['hasMany'](db[_0x7383('0x195')],{'as':_0x7383('0x16a'),'foreignKey':'SmsAccountId'});db[_0x7383('0x57')][_0x7383('0x12d')](db[_0x7383('0x59')],{'as':'Interactions'});db['SmsAccount']['hasMany'](db[_0x7383('0x58')],{'as':'Applications'});db[_0x7383('0x57')][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0x57')][_0x7383('0x137')](db[_0x7383('0x8d')],{'as':_0x7383('0x18e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7383('0x57')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':'user_has_sms_accounts'});db[_0x7383('0x58')][_0x7383('0x137')](db[_0x7383('0x12a')],{'onDelete':'restrict'});db['SmsApplication'][_0x7383('0x137')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x7383('0x58')][_0x7383('0x137')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x7383('0x58')][_0x7383('0x137')](db[_0x7383('0x8b')],{'onDelete':_0x7383('0x183'),'foreignKey':'IntervalId'});db[_0x7383('0x58')][_0x7383('0x137')](db['Tag'],{'onDelete':_0x7383('0x183'),'foreignKey':_0x7383('0x185')});db['SmsInteraction'][_0x7383('0x12d')](db[_0x7383('0x195')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x7383('0x196')});db[_0x7383('0x59')][_0x7383('0x137')](db[_0x7383('0x57')],{'as':'Account','foreignKey':_0x7383('0x194')});db[_0x7383('0x59')]['belongsTo'](db[_0x7383('0x76')],{'as':'Contact','foreignKey':_0x7383('0x188')});db[_0x7383('0x59')][_0x7383('0x137')](db['User'],{'as':_0x7383('0x17c'),'foreignKey':_0x7383('0x12f')});db['SmsInteraction'][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x197'),'as':'Tags'});db[_0x7383('0x59')][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x197'),'as':_0x7383('0x17f')});db[_0x7383('0x59')]['belongsToMany'](db[_0x7383('0x12a')],{'as':_0x7383('0x198'),'through':_0x7383('0x145'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':'User'});db[_0x7383('0x195')][_0x7383('0x137')](db[_0x7383('0x76')],{'onDelete':_0x7383('0x12c'),'as':_0x7383('0x187')});db[_0x7383('0x195')][_0x7383('0x137')](db[_0x7383('0x59')],{'onDelete':_0x7383('0x12c'),'as':'Interaction','foreignKey':_0x7383('0x196')});db[_0x7383('0x195')][_0x7383('0x137')](db[_0x7383('0x57')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x194')});db[_0x7383('0x14b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x7383('0x39'),'foreignKey':_0x7383('0x199')});db[_0x7383('0x14b')][_0x7383('0x139')](db['Team'],{'through':_0x7383('0x19a'),'as':_0x7383('0x179')});db['OpenchannelAccount'][_0x7383('0x12d')](db[_0x7383('0x87')],{'as':'Dispositions','foreignKey':_0x7383('0x19b')});db[_0x7383('0x19c')][_0x7383('0x12d')](db[_0x7383('0x85')],{'as':_0x7383('0x173'),'foreignKey':_0x7383('0x19b')});db[_0x7383('0x19c')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x7383('0x174'),'foreignKey':'OpenchannelAccountId'});db[_0x7383('0x19c')][_0x7383('0x12d')](db[_0x7383('0x61')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x7383('0x19c')][_0x7383('0x12d')](db['OpenchannelApplication'],{'as':_0x7383('0x18c'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0x19c')][_0x7383('0x137')](db[_0x7383('0x8d')],{'as':_0x7383('0x18e'),'foreignKey':_0x7383('0x164')});db[_0x7383('0x19c')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x152')});db[_0x7383('0x19d')]['belongsTo'](db[_0x7383('0x12a')],{'onDelete':_0x7383('0x183')});db[_0x7383('0x19d')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x7383('0x183'),'foreignKey':_0x7383('0x19e')});db[_0x7383('0x19d')][_0x7383('0x137')](db[_0x7383('0x19c')],{'onDelete':'restrict','foreignKey':_0x7383('0x19b')});db[_0x7383('0x19d')]['belongsTo'](db[_0x7383('0x8b')],{'onDelete':_0x7383('0x183'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0x7383('0x95')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x7383('0x5f')][_0x7383('0x12d')](db[_0x7383('0x61')],{'as':_0x7383('0x16a'),'onDelete':'cascade','foreignKey':_0x7383('0x19f')});db[_0x7383('0x5f')][_0x7383('0x137')](db[_0x7383('0x19c')],{'as':_0x7383('0x17b'),'foreignKey':'OpenchannelAccountId'});db[_0x7383('0x5f')]['belongsTo'](db['CmContact'],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x5f')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':'Owner','foreignKey':_0x7383('0x12f')});db[_0x7383('0x5f')][_0x7383('0x139')](db['Tag'],{'through':_0x7383('0x1a0'),'as':_0x7383('0x17e')});db['OpenchannelInteraction'][_0x7383('0x139')](db[_0x7383('0x95')],{'through':'openchannel_interaction_has_tags','as':_0x7383('0x17f')});db[_0x7383('0x5f')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':'Users','through':_0x7383('0x146'),'foreignKey':_0x7383('0x19f')});db['OpenchannelMessage']['belongsTo'](db['User'],{'onDelete':_0x7383('0x12c'),'as':'User'});db[_0x7383('0x61')][_0x7383('0x137')](db['CmContact'],{'onDelete':'cascade','as':_0x7383('0x187')});db[_0x7383('0x61')][_0x7383('0x137')](db['OpenchannelInteraction'],{'onDelete':_0x7383('0x12c'),'as':_0x7383('0x182'),'foreignKey':_0x7383('0x19f')});db[_0x7383('0x61')][_0x7383('0x137')](db[_0x7383('0x180')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x7383('0x61')][_0x7383('0x137')](db[_0x7383('0x19c')],{'as':'Account','foreignKey':_0x7383('0x19b')});db['OpenchannelQueue']['belongsToMany'](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x14e'),'foreignKey':'OpenchannelQueueId'});db[_0x7383('0x1a1')][_0x7383('0x139')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x7383('0x179')});db[_0x7383('0x64')][_0x7383('0x12d')](db[_0x7383('0x87')],{'as':_0x7383('0x18a'),'foreignKey':_0x7383('0x1a2')});db[_0x7383('0x64')]['hasMany'](db[_0x7383('0x85')],{'as':_0x7383('0x173'),'foreignKey':_0x7383('0x1a2')});db[_0x7383('0x64')][_0x7383('0x12d')](db[_0x7383('0x73')],{'as':_0x7383('0x1a3')});db[_0x7383('0x64')]['hasMany'](db[_0x7383('0x6a')],{'as':_0x7383('0x174')});db[_0x7383('0x64')][_0x7383('0x12d')](db[_0x7383('0x68')],{'as':'Applications'});db[_0x7383('0x64')][_0x7383('0x12d')](db[_0x7383('0x6c')],{'as':'Messages'});db[_0x7383('0x64')][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':'List','foreignKey':_0x7383('0x176')});db[_0x7383('0x64')]['belongsTo'](db[_0x7383('0x8b')],{'as':_0x7383('0x8b'),'foreignKey':_0x7383('0x184')});db[_0x7383('0x64')][_0x7383('0x137')](db[_0x7383('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0x7383('0x164')});db['ChatWebsite'][_0x7383('0x139')](db['User'],{'as':_0x7383('0x166'),'through':_0x7383('0x150')});db['OpenchannelQueueReport']['belongsTo'](db[_0x7383('0x19c')],{});db['OpenchannelQueueReport'][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0x66')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db['OpenchannelQueueReport'][_0x7383('0x137')](db[_0x7383('0x5f')],{});db['OpenchannelQueueReport'][_0x7383('0x137')](db[_0x7383('0x61')],{});db[_0x7383('0x66')][_0x7383('0x137')](db[_0x7383('0x12a')],{});db[_0x7383('0x66')][_0x7383('0x137')](db[_0x7383('0x1a1')],{});db[_0x7383('0x68')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':_0x7383('0x1a4'),'foreignKey':'UserId','onDelete':_0x7383('0x183')});db[_0x7383('0x68')][_0x7383('0x137')](db['ChatQueue'],{'as':_0x7383('0x1a5'),'foreignKey':'ChatQueueId','onDelete':_0x7383('0x183')});db[_0x7383('0x68')]['belongsTo'](db[_0x7383('0x64')],{'as':'Website','foreignKey':_0x7383('0x1a2'),'onDelete':'restrict'});db[_0x7383('0x68')][_0x7383('0x137')](db[_0x7383('0x95')],{'onDelete':_0x7383('0x183'),'foreignKey':'TagId'});db[_0x7383('0x6a')]['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1a6')});db[_0x7383('0x6a')][_0x7383('0x137')](db[_0x7383('0x64')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1a2')});db[_0x7383('0x6a')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x6a')]['belongsTo'](db[_0x7383('0x12a')],{'as':_0x7383('0x17c'),'foreignKey':_0x7383('0x12f')});db[_0x7383('0x6a')][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x1a7'),'as':_0x7383('0x17e')});db[_0x7383('0x6a')][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x1a7'),'as':_0x7383('0x17f')});db[_0x7383('0x6a')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x198'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x7383('0x6c')][_0x7383('0x137')](db['User'],{'onDelete':'cascade','as':_0x7383('0x12a')});db[_0x7383('0x6c')][_0x7383('0x137')](db['CmContact'],{'onDelete':_0x7383('0x12c'),'as':_0x7383('0x187'),'foreignKey':'ContactId'});db[_0x7383('0x6c')][_0x7383('0x137')](db[_0x7383('0x6a')],{'onDelete':'cascade','as':_0x7383('0x182'),'foreignKey':_0x7383('0x1a6')});db[_0x7383('0x6c')]['belongsTo'](db[_0x7383('0x180')],{'as':_0x7383('0x180'),'foreignKey':'AttachmentId'});db[_0x7383('0x6c')][_0x7383('0x137')](db[_0x7383('0x64')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1a2')});db['ChatOfflineMessage'][_0x7383('0x137')](db[_0x7383('0x76')],{'onDelete':_0x7383('0x12c'),'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x1a8')]['belongsTo'](db[_0x7383('0x64')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1a2')});db[_0x7383('0x6f')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x34'),'hooks':!![]});db[_0x7383('0x6f')]['belongsToMany'](db[_0x7383('0xe3')],{'through':'team_has_chat_queues','as':_0x7383('0x179')});db['ChatGroup'][_0x7383('0x12d')](db[_0x7383('0xcf')],{'as':_0x7383('0x16a'),'foreignKey':'ChatGroupId','onDelete':_0x7383('0x12c')});db['ChatGroup'][_0x7383('0x139')](db['User'],{'as':_0x7383('0x158'),'through':'chat_group_has_users'});db[_0x7383('0x73')][_0x7383('0x137')](db[_0x7383('0x64')],{'as':_0x7383('0x1a9'),'foreignKey':_0x7383('0x1a2')});db[_0x7383('0x74')]['hasOne'](db['CmCompany'],{'as':_0x7383('0x1aa')});db['CmCompany'][_0x7383('0x12d')](db[_0x7383('0x76')],{'as':_0x7383('0x13c'),'foreignKey':_0x7383('0x1ab')});db[_0x7383('0x74')][_0x7383('0x12d')](db[_0x7383('0x1ac')],{'as':_0x7383('0x1ad'),'foreignKey':'CompanyId'});db[_0x7383('0x74')]['hasMany'](db[_0x7383('0x10d')],{'as':_0x7383('0x1ae'),'foreignKey':_0x7383('0x1ab')});db[_0x7383('0x74')][_0x7383('0x137')](db[_0x7383('0x11e')],{'as':'PaymentMethod','foreignKey':_0x7383('0x1af')});db[_0x7383('0x76')][_0x7383('0x12d')](db[_0x7383('0x15a')],{'as':_0x7383('0x15b'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x76')]['hasMany'](db[_0x7383('0x7b')],{'as':'HopperFinals','foreignKey':_0x7383('0x188')});db[_0x7383('0x76')][_0x7383('0x12d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x7383('0x188')});db[_0x7383('0x76')][_0x7383('0x12d')](db[_0x7383('0x7e')],{'as':_0x7383('0x7e'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x76')][_0x7383('0x12d')](db[_0x7383('0x15e')],{'as':_0x7383('0x15f'),'foreignKey':'ContactId'});db[_0x7383('0x76')][_0x7383('0x12d')](db['OpenchannelInteraction'],{'as':_0x7383('0x133'),'foreignKey':_0x7383('0x188'),'onDelete':'restrict'});db[_0x7383('0x76')][_0x7383('0x12d')](db['ChatInteraction'],{'as':_0x7383('0x134'),'foreignKey':_0x7383('0x188'),'onDelete':_0x7383('0x183')});db[_0x7383('0x76')]['hasMany'](db['SmsInteraction'],{'as':_0x7383('0x135'),'foreignKey':_0x7383('0x188'),'onDelete':'restrict'});db['CmContact'][_0x7383('0x12d')](db[_0x7383('0x50')],{'as':'FaxInteractions','foreignKey':_0x7383('0x188'),'onDelete':_0x7383('0x183')});db[_0x7383('0x76')][_0x7383('0x12d')](db[_0x7383('0x44')],{'as':'MailInteractions','foreignKey':_0x7383('0x188'),'onDelete':'restrict'});db[_0x7383('0x76')][_0x7383('0x12d')](db['SADossier'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x7383('0x183')});db[_0x7383('0x76')][_0x7383('0x137')](db['CmCompany'],{'as':'Company','foreignKey':_0x7383('0x1ab')});db[_0x7383('0x76')][_0x7383('0x137')](db['CmList'],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x76')][_0x7383('0x139')](db[_0x7383('0x12a')],{'as':_0x7383('0x198'),'through':_0x7383('0x13d')});db[_0x7383('0x76')]['belongsToMany'](db['Tag'],{'as':_0x7383('0x17e'),'through':'cm_contact_has_tags'});db[_0x7383('0x76')]['belongsToMany'](db[_0x7383('0x95')],{'through':_0x7383('0x1b0'),'as':'ThroughTags'});db[_0x7383('0x15a')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188'),'onDelete':'cascade'});db[_0x7383('0x15a')][_0x7383('0x137')](db['CmList'],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x15a')][_0x7383('0x137')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x7383('0x15a')][_0x7383('0x137')](db[_0x7383('0x1c')],{'as':_0x7383('0x1a5'),'foreignKey':'VoiceQueueId','onDelete':_0x7383('0x12c')});db[_0x7383('0x15a')][_0x7383('0x137')](db[_0x7383('0x1b1')],{'as':_0x7383('0x1b1'),'foreignKey':_0x7383('0x1b2'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x15a')]['belongsTo'](db[_0x7383('0x12a')],{'as':_0x7383('0x17c'),'foreignKey':_0x7383('0x1b3')});db['CmHopperBlack'][_0x7383('0x137')](db[_0x7383('0x76')],{'as':'Contact','foreignKey':_0x7383('0x188'),'onDelete':'cascade'});db['CmHopperBlack'][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176'),'onDelete':'cascade'});db[_0x7383('0x79')]['belongsTo'](db[_0x7383('0x1c')],{'as':_0x7383('0x1a5'),'foreignKey':_0x7383('0x159'),'onDelete':_0x7383('0x12c')});db[_0x7383('0x79')]['belongsTo'](db['Campaign'],{'as':_0x7383('0x1b1'),'foreignKey':_0x7383('0x1b2'),'onDelete':_0x7383('0x12c')});db['Automation'][_0x7383('0x12d')](db[_0x7383('0x89')],{'as':{'plural':_0x7383('0x1b4'),'singular':_0x7383('0x1b5')},'foreignKey':_0x7383('0x1b6'),'onDelete':_0x7383('0x12c'),'hooks':!![]});db[_0x7383('0x83')][_0x7383('0x12d')](db[_0x7383('0x89')],{'as':{'plural':_0x7383('0x1b7'),'singular':_0x7383('0x1b8')},'foreignKey':_0x7383('0x1b9'),'onDelete':_0x7383('0x12c'),'hooks':!![]});db[_0x7383('0x83')][_0x7383('0x12d')](db[_0x7383('0x82')],{'as':_0x7383('0x1ba'),'foreignKey':'AutomationId','onDelete':_0x7383('0x12c'),'hooks':!![]});db[_0x7383('0x8b')][_0x7383('0x12d')](db[_0x7383('0x8b')],{'as':_0x7383('0x1bb'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x7383('0x8b')][_0x7383('0x12d')](db[_0x7383('0x18')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x7383('0x183')});db[_0x7383('0x8b')][_0x7383('0x12d')](db[_0x7383('0x47')],{'as':_0x7383('0x1bc'),'foreignKey':_0x7383('0x184')});db[_0x7383('0x8b')]['hasMany'](db[_0x7383('0x68')],{'as':_0x7383('0x1bd'),'foreignKey':_0x7383('0x184')});db[_0x7383('0x8b')][_0x7383('0x12d')](db['FaxApplication'],{'as':_0x7383('0x1be'),'foreignKey':_0x7383('0x184')});db[_0x7383('0x8b')][_0x7383('0x12d')](db[_0x7383('0x58')],{'as':_0x7383('0x1bf'),'foreignKey':'IntervalId'});db['Schedule'][_0x7383('0x137')](db[_0x7383('0x3f')],{});db['Schedule'][_0x7383('0x137')](db[_0x7383('0x1c0')],{'foreignKey':_0x7383('0x1c1')});db['Schedule'][_0x7383('0x137')](db['AnalyticCustomReport'],{'foreignKey':_0x7383('0x1c2')});db[_0x7383('0x93')][_0x7383('0x139')](db[_0x7383('0x1a')],{'as':_0x7383('0x1c3'),'through':_0x7383('0x157'),'onDelete':'restrict'});db[_0x7383('0x95')][_0x7383('0x139')](db[_0x7383('0x76')],{'through':_0x7383('0x1b0')});db['Tag'][_0x7383('0x139')](db[_0x7383('0x6a')],{'through':'chat_interaction_has_tags'});db[_0x7383('0x95')][_0x7383('0x139')](db[_0x7383('0x44')],{'through':_0x7383('0x17d')});db['Tag'][_0x7383('0x139')](db[_0x7383('0x59')],{'through':_0x7383('0x197')});db[_0x7383('0x95')][_0x7383('0x139')](db[_0x7383('0x50')],{'through':'fax_interaction_has_tags'});db[_0x7383('0x95')][_0x7383('0x139')](db[_0x7383('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0x7383('0x1c4')][_0x7383('0x12d')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0x7383('0x1c5'),'onDelete':_0x7383('0x12c'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x7383('0x89')],{'as':{'plural':_0x7383('0x1c6'),'singular':_0x7383('0x1c7')},'foreignKey':_0x7383('0x1c8'),'onDelete':_0x7383('0x12c'),'hooks':!![]});db[_0x7383('0x1c4')][_0x7383('0x12d')](db[_0x7383('0x82')],{'as':_0x7383('0x1ba'),'foreignKey':'TriggerId','onDelete':_0x7383('0x12c'),'hooks':!![]});db[_0x7383('0x9d')][_0x7383('0x12d')](db[_0x7383('0xa3')],{'as':_0x7383('0x1c9'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1c2'),'hooks':!![]});db[_0x7383('0x1c0')]['hasMany'](db[_0x7383('0xa3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7383('0x1c1')});db['AnalyticMetric'][_0x7383('0x12d')](db[_0x7383('0xa3')],{'as':_0x7383('0x1c9'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1ca')});db[_0x7383('0xa3')][_0x7383('0x137')](db[_0x7383('0x1cb')],{'foreignKey':'MetricId'});db[_0x7383('0xa7')][_0x7383('0x12d')](db[_0x7383('0xa9')],{'as':_0x7383('0x1cc'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xa9')]['hasMany'](db[_0x7383('0xab')],{'as':_0x7383('0x1ce'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xa9')]['hasMany'](db[_0x7383('0xab')],{'as':_0x7383('0x1d0'),'onDelete':'cascade','foreignKey':_0x7383('0x1d1')});db[_0x7383('0xa9')][_0x7383('0x12d')](db[_0x7383('0xab')],{'as':_0x7383('0x1c9'),'onDelete':'cascade','foreignKey':_0x7383('0x1d2')});db[_0x7383('0xa9')]['belongsTo'](db['SalesforceAccount'],{'as':_0x7383('0x17b'),'foreignKey':'AccountId'});db[_0x7383('0xab')][_0x7383('0x12d')](db[_0x7383('0xab')],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xab')][_0x7383('0x12d')](db['SalesforceField'],{'as':_0x7383('0x1d4'),'foreignKey':_0x7383('0x1d1')});db['SalesforceField']['hasMany'](db[_0x7383('0xab')],{'as':_0x7383('0x1d5'),'foreignKey':'FieldId'});db[_0x7383('0xab')][_0x7383('0x137')](db['Variable'],{'as':_0x7383('0x1d6'),'foreignKey':'VariableId'});db[_0x7383('0x1d7')]['hasMany'](db[_0x7383('0xad')],{'as':_0x7383('0x1cc'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xad')][_0x7383('0x12d')](db[_0x7383('0xaf')],{'as':_0x7383('0x1ce'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xad')][_0x7383('0x12d')](db[_0x7383('0xaf')],{'as':_0x7383('0x1d0'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xad')][_0x7383('0x12d')](db['SugarcrmField'],{'as':_0x7383('0x1c9'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d2')});db['SugarcrmConfiguration']['belongsTo'](db[_0x7383('0x1d7')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xaf')][_0x7383('0x12d')](db[_0x7383('0xaf')],{'as':'Subject','foreignKey':_0x7383('0x1cf')});db[_0x7383('0xaf')][_0x7383('0x12d')](db[_0x7383('0xaf')],{'as':_0x7383('0x1d4'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xaf')][_0x7383('0x12d')](db[_0x7383('0xaf')],{'as':_0x7383('0x1d5'),'foreignKey':_0x7383('0x1d2')});db[_0x7383('0xaf')][_0x7383('0x137')](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':_0x7383('0x1d8')});db[_0x7383('0xb0')][_0x7383('0x12d')](db[_0x7383('0xb2')],{'as':_0x7383('0x1cc'),'onDelete':'cascade','foreignKey':_0x7383('0x1cd')});db[_0x7383('0xb2')][_0x7383('0x12d')](db[_0x7383('0xb3')],{'as':_0x7383('0x1ce'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xb2')]['hasMany'](db['DeskField'],{'as':_0x7383('0x1d0'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xb2')][_0x7383('0x12d')](db[_0x7383('0xb3')],{'as':_0x7383('0x1c9'),'onDelete':_0x7383('0x12c'),'foreignKey':'FieldId'});db[_0x7383('0xb2')]['belongsTo'](db[_0x7383('0xb0')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1cd')});db['DeskConfiguration'][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x1d9')});db[_0x7383('0xb3')][_0x7383('0x12d')](db[_0x7383('0xb3')],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db['DeskField'][_0x7383('0x12d')](db[_0x7383('0xb3')],{'as':_0x7383('0x1d4'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xb3')][_0x7383('0x12d')](db[_0x7383('0xb3')],{'as':_0x7383('0x1d5'),'foreignKey':_0x7383('0x1d2')});db[_0x7383('0xb3')]['belongsTo'](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x7383('0x12d')](db[_0x7383('0xb6')],{'as':_0x7383('0x1cc'),'onDelete':'cascade','foreignKey':_0x7383('0x1cd')});db['ZohoConfiguration'][_0x7383('0x12d')](db['ZohoField'],{'as':_0x7383('0x1ce'),'onDelete':'cascade','foreignKey':_0x7383('0x1cf')});db['ZohoConfiguration'][_0x7383('0x12d')](db[_0x7383('0xb8')],{'as':_0x7383('0x1d0'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xb6')]['hasMany'](db[_0x7383('0xb8')],{'as':_0x7383('0x1c9'),'onDelete':'cascade','foreignKey':_0x7383('0x1d2')});db['ZohoConfiguration']['belongsTo'](db[_0x7383('0xb4')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xb8')][_0x7383('0x12d')](db[_0x7383('0xb8')],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xb8')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0x7383('0x1d1')});db['ZohoField'][_0x7383('0x12d')](db[_0x7383('0xb8')],{'as':_0x7383('0x1d5'),'foreignKey':_0x7383('0x1d2')});db['ZohoField'][_0x7383('0x137')](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':_0x7383('0x1d8')});db['ZendeskAccount'][_0x7383('0x12d')](db[_0x7383('0xbb')],{'as':_0x7383('0x1cc'),'onDelete':'cascade','foreignKey':_0x7383('0x1cd')});db['ZendeskConfiguration'][_0x7383('0x12d')](db[_0x7383('0xbd')],{'as':_0x7383('0x1ce'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xbb')][_0x7383('0x12d')](db[_0x7383('0xbd')],{'as':_0x7383('0x1d0'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x7383('0x12d')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x7383('0xbb')][_0x7383('0x137')](db[_0x7383('0x1da')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xbb')]['belongsToMany'](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x7383('0xbd')]['hasMany'](db[_0x7383('0xbd')],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xbd')][_0x7383('0x12d')](db[_0x7383('0xbd')],{'as':'Description','foreignKey':_0x7383('0x1d1')});db['ZendeskField'][_0x7383('0x12d')](db[_0x7383('0xbd')],{'as':_0x7383('0x1d5'),'foreignKey':_0x7383('0x1d2')});db[_0x7383('0xbd')][_0x7383('0x137')](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':_0x7383('0x1d8')});db[_0x7383('0x1db')][_0x7383('0x12d')](db[_0x7383('0x1dc')],{'as':_0x7383('0x1cc'),'onDelete':'cascade','foreignKey':_0x7383('0x1cd')});db['FreshdeskConfiguration']['hasMany'](db[_0x7383('0x1dd')],{'as':_0x7383('0x1ce'),'onDelete':'cascade','foreignKey':_0x7383('0x1cf')});db[_0x7383('0x1dc')]['hasMany'](db[_0x7383('0x1dd')],{'as':_0x7383('0x1d0'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0x1dc')]['hasMany'](db[_0x7383('0x1dd')],{'as':_0x7383('0x1c9'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x7383('0x1dc')][_0x7383('0x137')](db[_0x7383('0x1db')],{'as':'Account','foreignKey':'AccountId'});db[_0x7383('0x1dc')]['belongsToMany'](db[_0x7383('0x95')],{'through':_0x7383('0x1de')});db[_0x7383('0x1dd')][_0x7383('0x12d')](db[_0x7383('0x1dd')],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0x1dd')][_0x7383('0x12d')](db[_0x7383('0x1dd')],{'as':_0x7383('0x1d4'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x7383('0x12d')](db['FreshdeskField'],{'as':_0x7383('0x1d5'),'foreignKey':_0x7383('0x1d2')});db[_0x7383('0x1dd')][_0x7383('0x137')](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x7383('0x1cc'),'onDelete':'cascade','foreignKey':_0x7383('0x1cd')});db[_0x7383('0x1df')]['hasMany'](db['VtigerField'],{'as':_0x7383('0x1ce'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0x1df')][_0x7383('0x12d')](db[_0x7383('0xc1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x7383('0x1df')][_0x7383('0x12d')](db[_0x7383('0xc1')],{'as':'Fields','foreignKey':_0x7383('0x1d2')});db[_0x7383('0x1df')][_0x7383('0x137')](db[_0x7383('0x1e0')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0x1df')][_0x7383('0x139')](db[_0x7383('0x95')],{'through':_0x7383('0x1e1')});db[_0x7383('0xc1')][_0x7383('0x12d')](db['VtigerField'],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db['VtigerField'][_0x7383('0x12d')](db[_0x7383('0xc1')],{'as':_0x7383('0x1d4'),'foreignKey':_0x7383('0x1d1')});db['VtigerField'][_0x7383('0x12d')](db[_0x7383('0xc1')],{'as':_0x7383('0x1d5'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':_0x7383('0x1d8')});db[_0x7383('0x1e2')][_0x7383('0x12d')](db[_0x7383('0xc4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7383('0x1cd')});db['ServicenowConfiguration']['hasMany'](db[_0x7383('0xc6')],{'as':_0x7383('0x1ce'),'foreignKey':_0x7383('0x1cf')});db['ServicenowConfiguration']['hasMany'](db[_0x7383('0xc6')],{'as':_0x7383('0x1d0'),'foreignKey':_0x7383('0x1d1')});db['ServicenowConfiguration'][_0x7383('0x12d')](db[_0x7383('0xc6')],{'as':_0x7383('0x1c9'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x7383('0x137')](db[_0x7383('0x1e2')],{'as':_0x7383('0x17b'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xc6')][_0x7383('0x12d')](db[_0x7383('0xc6')],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db['ServicenowField'][_0x7383('0x12d')](db[_0x7383('0xc6')],{'as':_0x7383('0x1d4'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xc6')][_0x7383('0x12d')](db['ServicenowField'],{'as':'Field','foreignKey':_0x7383('0x1d2')});db[_0x7383('0xc6')][_0x7383('0x137')](db[_0x7383('0x1d6')],{'as':_0x7383('0x1d6'),'foreignKey':_0x7383('0x1d8')});db['Dynamics365Account'][_0x7383('0x12d')](db[_0x7383('0xca')],{'as':_0x7383('0x1cc'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cd')});db[_0x7383('0xca')][_0x7383('0x12d')](db[_0x7383('0x1e3')],{'as':_0x7383('0x1ce'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1cf')});db[_0x7383('0xca')]['hasMany'](db['Dynamics365Field'],{'as':_0x7383('0x1d0'),'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d1')});db[_0x7383('0xca')]['hasMany'](db[_0x7383('0x1e3')],{'as':'Fields','onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1d2')});db[_0x7383('0xca')][_0x7383('0x137')](db[_0x7383('0xc8')],{'as':_0x7383('0x17b'),'foreignKey':'AccountId'});db[_0x7383('0x1e3')]['hasMany'](db['Dynamics365Field'],{'as':_0x7383('0x1d3'),'foreignKey':_0x7383('0x1cf')});db['Dynamics365Field'][_0x7383('0x12d')](db[_0x7383('0x1e3')],{'as':'Description','foreignKey':_0x7383('0x1d1')});db[_0x7383('0x1e3')][_0x7383('0x12d')](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db[_0x7383('0x1e3')][_0x7383('0x137')](db['Variable'],{'as':_0x7383('0x1d6'),'foreignKey':_0x7383('0x1d8')});db['ChatQueueReport'][_0x7383('0x137')](db[_0x7383('0x64')],{});db[_0x7383('0xcd')][_0x7383('0x137')](db['CmList'],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0xcd')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport'][_0x7383('0x137')](db[_0x7383('0x6a')],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0x7383('0x12a')],{});db['ChatQueueReport'][_0x7383('0x137')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x7383('0x137')](db[_0x7383('0x12a')],{'onDelete':'cascade','foreignKey':_0x7383('0x1e4')});db[_0x7383('0xcf')][_0x7383('0x137')](db['User'],{'onDelete':_0x7383('0x12c'),'foreignKey':_0x7383('0x1e5')});db[_0x7383('0x15e')][_0x7383('0x12d')](db[_0x7383('0xd3')],{'foreignKey':_0x7383('0x1e6'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x7383('0x12d')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x7383('0x12c')});db[_0x7383('0xd6')][_0x7383('0x137')](db[_0x7383('0x57')],{});db[_0x7383('0xd6')][_0x7383('0x137')](db[_0x7383('0xf0')],{'as':_0x7383('0x175'),'foreignKey':_0x7383('0x176')});db[_0x7383('0xd6')]['belongsTo'](db[_0x7383('0x76')],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0xd6')][_0x7383('0x137')](db[_0x7383('0x59')],{});db[_0x7383('0xd6')]['belongsTo'](db[_0x7383('0x195')],{});db[_0x7383('0xd6')][_0x7383('0x137')](db[_0x7383('0x12a')],{});db['SmsQueueReport'][_0x7383('0x137')](db[_0x7383('0x14b')],{});db[_0x7383('0xdb')][_0x7383('0x12d')](db[_0x7383('0x15e')],{'foreignKey':_0x7383('0x1e7')});db[_0x7383('0xdb')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x7383('0x1e7')});db[_0x7383('0xdb')][_0x7383('0x12d')](db[_0x7383('0xd1')],{'foreignKey':_0x7383('0x1e7')});db[_0x7383('0xdf')]['belongsToMany'](db['User'],{'as':_0x7383('0x198'),'through':'user_has_square_projects'});db[_0x7383('0xe3')]['belongsToMany'](db[_0x7383('0x12a')],{'as':_0x7383('0x166'),'through':_0x7383('0x140')});db[_0x7383('0xe3')]['belongsToMany'](db[_0x7383('0x1c')],{'through':'team_has_voice_queues','as':_0x7383('0x147')});db[_0x7383('0xe3')][_0x7383('0x139')](db[_0x7383('0x41')],{'through':_0x7383('0x178'),'as':'MailQueues'});db[_0x7383('0xe3')]['belongsToMany'](db[_0x7383('0x6f')],{'through':_0x7383('0x1e8'),'as':_0x7383('0x149')});db['Team'][_0x7383('0x139')](db['FaxQueue'],{'through':_0x7383('0x193'),'as':_0x7383('0x14a')});db[_0x7383('0xe3')]['belongsToMany'](db[_0x7383('0x14b')],{'through':'team_has_sms_queues','as':_0x7383('0x14c')});db[_0x7383('0xe3')][_0x7383('0x139')](db[_0x7383('0x1a1')],{'through':'team_has_openchannel_queues','as':_0x7383('0x14d')});db[_0x7383('0x1b1')][_0x7383('0x12d')](db[_0x7383('0x15a')],{'as':_0x7383('0x15b'),'foreignKey':_0x7383('0x1b2')});db[_0x7383('0x1b1')]['hasMany'](db['CmHopperFinal'],{'as':_0x7383('0x131'),'foreignKey':_0x7383('0x1b2')});db[_0x7383('0x1b1')][_0x7383('0x12d')](db[_0x7383('0x7c')],{'as':'HopperHistories','foreignKey':'CampaignId'});db['Campaign'][_0x7383('0x12d')](db[_0x7383('0x79')],{'as':_0x7383('0x15d'),'foreignKey':_0x7383('0x1b2')});db['Campaign'][_0x7383('0x137')](db['Trunk'],{'as':_0x7383('0x160'),'foreignKey':_0x7383('0x161')});db[_0x7383('0x1b1')][_0x7383('0x137')](db[_0x7383('0x160')],{'as':_0x7383('0x162'),'foreignKey':_0x7383('0x163')});db[_0x7383('0x1b1')]['belongsTo'](db[_0x7383('0x8b')],{'as':_0x7383('0x8b'),'foreignKey':'IntervalId'});db[_0x7383('0x1b1')][_0x7383('0x137')](db[_0x7383('0xdf')],{'as':_0x7383('0xdf'),'foreignKey':'SquareProjectId'});db[_0x7383('0x1b1')][_0x7383('0x139')](db[_0x7383('0xf0')],{'as':'Lists','through':_0x7383('0x1e9')});db[_0x7383('0x1b1')][_0x7383('0x139')](db['CmList'],{'as':_0x7383('0x1ea'),'through':_0x7383('0x1eb')});db[_0x7383('0x1ec')][_0x7383('0x137')](db[_0x7383('0x45')],{});db[_0x7383('0x1ec')][_0x7383('0x137')](db[_0x7383('0x44')],{});db[_0x7383('0x1ec')][_0x7383('0x137')](db[_0x7383('0x3f')],{'foreignKey':_0x7383('0x1ed'),'as':'FromAccount'});db['MailTransferReport'][_0x7383('0x137')](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1ee'),'as':_0x7383('0x1ef')});db[_0x7383('0x1ec')]['belongsTo'](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1f0'),'as':_0x7383('0x1f1')});db[_0x7383('0x1ec')][_0x7383('0x137')](db[_0x7383('0x41')],{'foreignKey':_0x7383('0x1f2'),'as':_0x7383('0x1f3')});db[_0x7383('0x1ec')][_0x7383('0x137')](db[_0x7383('0x3f')],{'foreignKey':_0x7383('0x1f4'),'as':_0x7383('0x1f5')});db['ChatTransferReport'][_0x7383('0x137')](db[_0x7383('0x6c')],{});db[_0x7383('0xea')][_0x7383('0x137')](db['ChatInteraction'],{});db[_0x7383('0xea')][_0x7383('0x137')](db[_0x7383('0x64')],{'foreignKey':_0x7383('0x1f6'),'as':_0x7383('0x1f7')});db['ChatTransferReport'][_0x7383('0x137')](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1ee'),'as':_0x7383('0x1ef')});db['ChatTransferReport'][_0x7383('0x137')](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1f0'),'as':_0x7383('0x1f1')});db[_0x7383('0xea')]['belongsTo'](db[_0x7383('0x6f')],{'foreignKey':_0x7383('0x1f8'),'as':_0x7383('0x1f3')});db[_0x7383('0xea')][_0x7383('0x137')](db[_0x7383('0x64')],{'foreignKey':_0x7383('0x1f9'),'as':_0x7383('0x1f5')});db['FaxTransferReport'][_0x7383('0x137')](db['FaxMessage'],{});db[_0x7383('0x1fa')][_0x7383('0x137')](db['FaxInteraction'],{});db[_0x7383('0x1fa')]['belongsTo'](db[_0x7383('0x4c')],{'foreignKey':_0x7383('0x1fb'),'as':_0x7383('0x1f7')});db[_0x7383('0x1fa')][_0x7383('0x137')](db['User'],{'foreignKey':_0x7383('0x1ee'),'as':_0x7383('0x1ef')});db['FaxTransferReport'][_0x7383('0x137')](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1f0'),'as':_0x7383('0x1f1')});db[_0x7383('0x1fa')][_0x7383('0x137')](db['FaxQueue'],{'foreignKey':_0x7383('0x1fc'),'as':_0x7383('0x1f3')});db['FaxTransferReport']['belongsTo'](db[_0x7383('0x4c')],{'foreignKey':'ToFaxAccountId','as':_0x7383('0x1f5')});db[_0x7383('0xed')][_0x7383('0x137')](db[_0x7383('0x61')],{});db[_0x7383('0xed')][_0x7383('0x137')](db[_0x7383('0x5f')],{});db[_0x7383('0xed')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x7383('0x1fd'),'as':_0x7383('0x1f7')});db[_0x7383('0xed')]['belongsTo'](db[_0x7383('0x12a')],{'foreignKey':'FromUserId','as':_0x7383('0x1ef')});db[_0x7383('0xed')][_0x7383('0x137')](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1f0'),'as':_0x7383('0x1f1')});db['OpenchannelTransferReport'][_0x7383('0x137')](db[_0x7383('0x1a1')],{'foreignKey':_0x7383('0x1fe'),'as':_0x7383('0x1f3')});db[_0x7383('0xed')][_0x7383('0x137')](db[_0x7383('0x19c')],{'foreignKey':_0x7383('0x1ff'),'as':_0x7383('0x1f5')});db[_0x7383('0xef')][_0x7383('0x137')](db[_0x7383('0x195')],{});db['SmsTransferReport']['belongsTo'](db[_0x7383('0x59')],{});db['SmsTransferReport']['belongsTo'](db[_0x7383('0x57')],{'foreignKey':'FromSmsAccountId','as':_0x7383('0x1f7')});db['SmsTransferReport'][_0x7383('0x137')](db[_0x7383('0x12a')],{'foreignKey':_0x7383('0x1ee'),'as':'FromAgent'});db[_0x7383('0xef')][_0x7383('0x137')](db['User'],{'foreignKey':_0x7383('0x1f0'),'as':_0x7383('0x1f1')});db[_0x7383('0xef')][_0x7383('0x137')](db['SmsQueue'],{'foreignKey':_0x7383('0x200'),'as':_0x7383('0x1f3')});db['SmsTransferReport'][_0x7383('0x137')](db[_0x7383('0x57')],{'foreignKey':_0x7383('0x201'),'as':_0x7383('0x1f5')});db['CmList'][_0x7383('0x12d')](db[_0x7383('0x87')],{'as':_0x7383('0x18a'),'foreignKey':'ListId'});db[_0x7383('0xf0')]['hasMany'](db['CmCustomField'],{'as':_0x7383('0x202'),'foreignKey':'ListId'});db[_0x7383('0xf0')][_0x7383('0x12d')](db[_0x7383('0x76')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x7383('0x176')});db[_0x7383('0xf0')][_0x7383('0x12d')](db[_0x7383('0x7b')],{'as':'HopperFinals','foreignKey':_0x7383('0x176')});db['CmList'][_0x7383('0x12d')](db[_0x7383('0x7c')],{'as':_0x7383('0x132'),'foreignKey':_0x7383('0x176')});db[_0x7383('0xf0')][_0x7383('0x12d')](db[_0x7383('0x7e')],{'as':_0x7383('0x7e'),'foreignKey':_0x7383('0x176')});db['CmList'][_0x7383('0x139')](db['VoiceQueue'],{'as':_0x7383('0x203'),'through':'voice_queues_has_cm_lists'});db[_0x7383('0xf0')][_0x7383('0x139')](db['User'],{'as':'Agents','through':_0x7383('0x13f')});db[_0x7383('0xf2')][_0x7383('0x12d')](db[_0x7383('0x18')],{'as':_0x7383('0x204'),'onDelete':_0x7383('0x183')});db[_0x7383('0xf2')]['belongsToMany'](db['User'],{'as':_0x7383('0x166'),'through':_0x7383('0x14f')});db[_0x7383('0xf4')][_0x7383('0x12d')](db[_0x7383('0x12a')],{'as':'Users','foreignKey':'userProfileId'});db[_0x7383('0xf4')]['hasMany'](db[_0x7383('0x205')],{'as':_0x7383('0x206'),'foreignKey':_0x7383('0x138'),'onDelete':'cascade'});db[_0x7383('0x205')][_0x7383('0x12d')](db[_0x7383('0x207')],{'as':_0x7383('0x208'),'foreignKey':_0x7383('0x209'),'onDelete':_0x7383('0x12c')});db['CrmWorkflow'][_0x7383('0x12d')](db[_0x7383('0xfa')],{'foreignKey':_0x7383('0x20a')});db[_0x7383('0xf8')]['hasMany'](db[_0x7383('0x10d')],{'foreignKey':_0x7383('0x20a')});db['CrmWorkflowStep'][_0x7383('0x12b')](db[_0x7383('0xfc')],{'foreignKey':_0x7383('0x20b')});db[_0x7383('0xfa')]['hasMany'](db[_0x7383('0x10d')],{'foreignKey':_0x7383('0x20b')});db[_0x7383('0xfa')][_0x7383('0x139')](db['CrmWorkflowStep'],{'as':_0x7383('0x20c'),'through':_0x7383('0x20d')});db[_0x7383('0xfc')][_0x7383('0x12d')](db[_0x7383('0xfe')],{'foreignKey':'TaskId'});db[_0x7383('0xfc')]['belongsTo'](db[_0x7383('0xfa')],{'foreignKey':_0x7383('0x20b'),'as':_0x7383('0xfa')});db[_0x7383('0xfe')][_0x7383('0x137')](db[_0x7383('0xfc')],{'foreignKey':_0x7383('0x20e'),'as':_0x7383('0xfc')});db['SATypeProduct'][_0x7383('0x12d')](db[_0x7383('0x106')],{'foreignKey':_0x7383('0x20f')});db[_0x7383('0x102')][_0x7383('0x12d')](db[_0x7383('0x106')],{'foreignKey':_0x7383('0x210')});db[_0x7383('0x106')][_0x7383('0x12d')](db['SAProductPricesList'],{'foreignKey':'ProductId'});db['SAProduct'][_0x7383('0x137')](db['SASalesCondition'],{'as':_0x7383('0x211'),'foreignKey':_0x7383('0x212')});db['SAProduct'][_0x7383('0x137')](db['SAUnitMeasure'],{'as':'UnitMeasure','foreignKey':_0x7383('0x210')});db['SAProduct']['belongsTo'](db[_0x7383('0x100')],{'as':_0x7383('0x213'),'foreignKey':_0x7383('0x20f')});db[_0x7383('0x108')][_0x7383('0x12d')](db[_0x7383('0x106')],{'foreignKey':'TypeSalesConditionId'});db['SAPriceList'][_0x7383('0x12d')](db['SAProductPricesList'],{'foreignKey':_0x7383('0x214')});db['SAProductPricesList'][_0x7383('0x12d')](db[_0x7383('0x215')],{'as':_0x7383('0x216'),'foreignKey':'ProductPriceListId'});db[_0x7383('0x10b')][_0x7383('0x137')](db[_0x7383('0x106')],{'as':_0x7383('0x217'),'foreignKey':'ProductId'});db[_0x7383('0x10b')][_0x7383('0x137')](db[_0x7383('0x1ac')],{'as':_0x7383('0x218'),'foreignKey':'PriceListId'});db[_0x7383('0x10d')][_0x7383('0x12d')](db[_0x7383('0x10f')],{'as':_0x7383('0x1ae'),'foreignKey':_0x7383('0x219')});db['SADossier'][_0x7383('0x12d')](db[_0x7383('0x21a')],{'as':_0x7383('0x1ae'),'foreignKey':_0x7383('0x219')});db[_0x7383('0x10d')][_0x7383('0x12d')](db[_0x7383('0x21b')],{'as':_0x7383('0x1ae'),'foreignKey':_0x7383('0x219')});db[_0x7383('0x10d')][_0x7383('0x12d')](db[_0x7383('0x21c')],{'as':_0x7383('0x1ae'),'foreignKey':_0x7383('0x219')});db['SADossier'][_0x7383('0x137')](db['CmCompany'],{'as':_0x7383('0x21d'),'foreignKey':_0x7383('0x1ab')});db[_0x7383('0x10d')][_0x7383('0x137')](db[_0x7383('0x76')],{'as':_0x7383('0x187'),'foreignKey':_0x7383('0x188')});db[_0x7383('0x10d')][_0x7383('0x137')](db[_0x7383('0xf8')],{'as':_0x7383('0x21e'),'foreignKey':_0x7383('0x20a')});db[_0x7383('0x10d')][_0x7383('0x137')](db[_0x7383('0xfa')],{'as':'WorkflowStep','foreignKey':'WorkflowStepId'});db[_0x7383('0x10d')][_0x7383('0x137')](db[_0x7383('0x12a')],{'as':'User','foreignKey':_0x7383('0x12f')});db[_0x7383('0x10f')][_0x7383('0x12d')](db[_0x7383('0x21a')],{'as':_0x7383('0x21f'),'foreignKey':_0x7383('0x220')});db[_0x7383('0x10f')]['hasMany'](db['SAOrder'],{'as':_0x7383('0x21f'),'foreignKey':'RequestId'});db[_0x7383('0x10f')][_0x7383('0x12d')](db['SAProforma'],{'as':_0x7383('0x21f'),'foreignKey':_0x7383('0x220')});db[_0x7383('0x10f')][_0x7383('0x137')](db[_0x7383('0x10d')],{'as':'Dossier','foreignKey':'DossierId'});db[_0x7383('0x21a')][_0x7383('0x12d')](db[_0x7383('0x215')],{'as':'Quotations','foreignKey':_0x7383('0x221')});db[_0x7383('0x21a')][_0x7383('0x12d')](db[_0x7383('0x21b')],{'as':'Quotations','foreignKey':'QuotationId'});db[_0x7383('0x21a')][_0x7383('0x12d')](db[_0x7383('0x21c')],{'as':_0x7383('0x222'),'foreignKey':_0x7383('0x221')});db[_0x7383('0x21a')][_0x7383('0x137')](db[_0x7383('0x10d')],{'as':_0x7383('0x223'),'foreignKey':_0x7383('0x219')});db[_0x7383('0x21a')][_0x7383('0x137')](db['SARequest'],{'as':_0x7383('0x224'),'foreignKey':_0x7383('0x220')});db[_0x7383('0x215')][_0x7383('0x137')](db[_0x7383('0x10b')],{'as':_0x7383('0x225'),'foreignKey':_0x7383('0x226')});db[_0x7383('0x215')][_0x7383('0x137')](db[_0x7383('0x21a')],{'as':_0x7383('0x227'),'foreignKey':_0x7383('0x221')});db[_0x7383('0x215')][_0x7383('0x137')](db[_0x7383('0x21c')],{'as':_0x7383('0x228'),'foreignKey':'ProformaId'});db[_0x7383('0x215')][_0x7383('0x137')](db[_0x7383('0x114')],{'as':'Invoice','foreignKey':'InvoiceId'});db[_0x7383('0x21b')]['hasMany'](db[_0x7383('0x21c')],{'as':_0x7383('0x229'),'foreignKey':_0x7383('0x22a')});db[_0x7383('0x21b')]['belongsTo'](db['SADossier'],{'as':_0x7383('0x223'),'foreignKey':'DossierId'});db[_0x7383('0x21b')][_0x7383('0x137')](db[_0x7383('0x10f')],{'as':_0x7383('0x224'),'foreignKey':_0x7383('0x220')});db[_0x7383('0x21b')][_0x7383('0x137')](db[_0x7383('0x21a')],{'as':'Quotation','foreignKey':_0x7383('0x221')});db[_0x7383('0x21c')][_0x7383('0x12d')](db[_0x7383('0x114')],{'as':'Proforma','foreignKey':'ProformaId'});db['SAProforma'][_0x7383('0x12d')](db[_0x7383('0x215')],{'as':'Proforma','foreignKey':_0x7383('0x22b')});db[_0x7383('0x21c')]['hasMany'](db[_0x7383('0x11a')],{'as':_0x7383('0x228'),'foreignKey':_0x7383('0x22b')});db['SAProforma'][_0x7383('0x12d')](db[_0x7383('0x11c')],{'as':_0x7383('0x228'),'foreignKey':_0x7383('0x22b')});db[_0x7383('0x21c')][_0x7383('0x137')](db[_0x7383('0x10d')],{'as':'Dossier','foreignKey':'DossierId'});db['SAProforma']['belongsTo'](db['SARequest'],{'as':_0x7383('0x224'),'foreignKey':_0x7383('0x220')});db[_0x7383('0x21c')][_0x7383('0x137')](db[_0x7383('0x21a')],{'as':_0x7383('0x227'),'foreignKey':_0x7383('0x221')});db[_0x7383('0x21c')]['belongsTo'](db[_0x7383('0x21b')],{'as':_0x7383('0x22c'),'foreignKey':'OrderId'});db[_0x7383('0x114')][_0x7383('0x12d')](db[_0x7383('0x215')],{'as':_0x7383('0x222'),'foreignKey':_0x7383('0x22d')});db['SAInvoice'][_0x7383('0x12d')](db[_0x7383('0x118')],{'as':_0x7383('0x22e'),'foreignKey':_0x7383('0x22d')});db[_0x7383('0x114')][_0x7383('0x12d')](db[_0x7383('0x11c')],{'as':_0x7383('0x22f'),'foreignKey':_0x7383('0x22d')});db[_0x7383('0x114')][_0x7383('0x137')](db['SADossier'],{'as':_0x7383('0x223'),'foreignKey':_0x7383('0x219')});db[_0x7383('0x114')][_0x7383('0x137')](db[_0x7383('0x10f')],{'as':_0x7383('0x224'),'foreignKey':_0x7383('0x220')});db[_0x7383('0x114')][_0x7383('0x137')](db[_0x7383('0x21a')],{'as':_0x7383('0x227'),'foreignKey':_0x7383('0x221')});db[_0x7383('0x114')][_0x7383('0x137')](db[_0x7383('0x21b')],{'as':_0x7383('0x22c'),'foreignKey':'OrderId'});db['SAInvoiceDetail'][_0x7383('0x137')](db[_0x7383('0x114')],{'as':_0x7383('0x230'),'foreignKey':_0x7383('0x22d')});db[_0x7383('0x11a')][_0x7383('0x137')](db[_0x7383('0x21c')],{'as':'Proforma','foreignKey':'ProformaId'});db['SAPayment']['belongsTo'](db[_0x7383('0x114')],{'as':_0x7383('0x230'),'foreignKey':_0x7383('0x22d')});db[_0x7383('0x11c')][_0x7383('0x137')](db[_0x7383('0x21c')],{'as':'Proforma','foreignKey':_0x7383('0x22b')});db[_0x7383('0x11e')][_0x7383('0x12d')](db[_0x7383('0x74')],{'as':_0x7383('0x231'),'foreignKey':_0x7383('0x1af')});db['SACreditNoteDetail'][_0x7383('0x137')](db[_0x7383('0x120')],{'as':_0x7383('0x232'),'foreignKey':_0x7383('0x233')});db[_0x7383('0x127')]['hasMany'](db[_0x7383('0x74')],{'as':'CompanyType','foreignKey':_0x7383('0x234')});db[_0x7383('0x129')][_0x7383('0x12d')](db[_0x7383('0x74')],{'as':'CompanyRelationship','foreignKey':_0x7383('0x235')});module[_0x7383('0x236')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xda91=['FaxApplications','SmsApplications','Schedule','AnalyticCustomReport','CustomReportId','Mohs','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Description','DescriptionId','Field','Variable','VariableId','Configurations','int_desk_configuration_has_tags','Subject','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','int_vtiger_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','FromId','ToId','SessionId','ProjectId','user_has_teams','VoiceQueues','MailQueues','team_has_fax_queues','SmsQueues','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatWebsiteId','FromFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','CrmWorkflowStep','WorkflowId','SADossier','WorkflowStepId','CrmWorkflowNextStep','crm_workflow_steps_has_crm_workflow_steps','TaskId','TypeProductId','SAProductPricesList','ProductId','SaleCondition','TypeSalesConditionId','UnitMeasure','UnitMeasureId','TypeProduct','PriceListId','SAProductQuotation','ProductPriceList','ProductPriceListId','Product','Pricelist','DossierId','Workflow','WorkflowStep','RequestId','Requests','SARequest','Dossier','Quotations','QuotationId','Request','Quotation','ProformaId','SAInvoice','Invoice','Orders','OrderId','Proforma','SAProformaDetail','Order','InvoiceId','Details','CreditNote','CreditNoteId','CompanyRelationship','saCompanyRelationship','path','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','defaultsDeep','sequelizeHistory','name','utf8','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/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/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','Integration','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../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','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','CrmNation','../api/crmNation/crmNation.model','CrmWorkflow','../api/crmWorkflow/crmWorkflow.model','../api/crmWorkflowstep/crmWorkflowstep.model','CrmTask','CrmActionsList','SATypeProduct','../api/saTypeProduct/saTypeProduct.model','SAUnitMeasure','SAInvoiceLaw','../api/saInvoiceLaw/saInvoiceLaw.model','SAProduct','SASalesCondition','../api/saSalesCondition/saSalesCondition.model','SAPriceList','../api/saPriceList/saPriceList.model','../api/saProductPricesList/saProductPricesList.model','../api/saRequest/saRequest.model','SAQuotation','../api/saQuotation/saQuotation.model','../api/saProductQuotation/saProductQuotation.model','SAOrder','../api/saOrder/saOrder.model','SAProforma','../api/saInvoice/saInvoice.model','SAAsset','../api/saAsset/saAsset.model','SAInvoiceDetail','../api/saInvoiceDetail/saInvoiceDetail.model','../api/saProformaDetail/saProformaDetail.model','SAPayment','../api/saPayment/saPayment.model','SAPaymentMethod','SACreditNote','../api/saCreditNote/saCreditNote.model','SACreditNoteDetail','../api/saCreditNoteDetail/saCreditNoteDetail.model','SAInvoiceNumber','../api/saInvoiceNumber/saInvoiceNumber.model','SACreditNoteNumber','../api/saCreditNoteNumber/saCreditNoteNumber.model','SACompanyType','../api/saCompanyType/saCompanyType.model','SACompanyRelationship','../api/saCompanyRelationship/saCompanyRelationship.model','hasOne','cascade','UserId','hasMany','Extensions','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueue','ChatQueue','ChatQueues','FaxQueue','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','team_has_voice_queues','CmList','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Answers','List','ListId','Pause','MailQueue','team_has_mail_queues','MailInteractionId','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Account','restrict','TagId','FaxAccountId','Interactions','FaxApplication','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsMessage','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','user_has_sms_interactions','Interaction','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsite','ChatWebsiteId','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Website','RelatedCompany','CompanyId','PriceLists','Dossiers','PaymentMethod','saPaymentMethod','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','AutomationAnyId','Actions','Intervals','MailApplications','ChatApplications'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xda91,0x72));var _0x1da9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xda91[_0x3947c9];return _0x2e7871;};'use strict';var path=require(_0x1da9('0x0'));var config=require('../config/environment');var Sequelize=require(_0x1da9('0x1'));var _=require(_0x1da9('0x2'));var jstz=require(_0x1da9('0x3'));var timezone=jstz[_0x1da9('0x4')]();config['sequelize']=_['defaultsDeep'](config[_0x1da9('0x1')],{'database':_0x1da9('0x5'),'username':_0x1da9('0x6'),'password':_0x1da9('0x7'),'options':{'host':_0x1da9('0x8'),'port':0xcea,'dialect':_0x1da9('0x9'),'dialectOptions':{'charset':_0x1da9('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x1da9('0xb')}}});config['sequelizeHistory']=_[_0x1da9('0xc')](config[_0x1da9('0xd')],{'database':'motion2','username':_0x1da9('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x1da9('0x9'),'dialectOptions':{'charset':_0x1da9('0xa')},'logging':![],'timezone':timezone[_0x1da9('0xe')](),'define':{'charset':_0x1da9('0xf'),'collate':_0x1da9('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1da9('0x1')]['database'],config[_0x1da9('0x1')][_0x1da9('0x10')],config[_0x1da9('0x1')][_0x1da9('0x11')],config[_0x1da9('0x1')][_0x1da9('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1da9('0xd')]['database'],config[_0x1da9('0xd')]['username'],config['sequelizeHistory']['password'],config['sequelizeHistory'][_0x1da9('0x12')])};db[_0x1da9('0x13')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x15'));db[_0x1da9('0x16')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x17'));db[_0x1da9('0x18')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x19'));db[_0x1da9('0x1a')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x1da9('0x1b')]=db['sequelize']['import'](_0x1da9('0x1c'));db['VoiceQueue']=db[_0x1da9('0x1')]['import'](_0x1da9('0x1d'));db[_0x1da9('0x1e')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x1f'));db[_0x1da9('0x20')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db[_0x1da9('0x21')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x22'));db['VoiceCallReport']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x23'));db[_0x1da9('0x24')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x25'));db[_0x1da9('0x26')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1da9('0x27')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x28'));db[_0x1da9('0x29')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x2a'));db[_0x1da9('0x2b')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x2c'));db['VoiceTransferReport']=db[_0x1da9('0x1')]['import'](_0x1da9('0x2d'));db[_0x1da9('0x2e')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x1da9('0x2f')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x30'));db[_0x1da9('0x31')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x32'));db[_0x1da9('0x33')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x34'));db[_0x1da9('0x35')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x36'));db['UserSmsQueue']=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x37'));db['MailServerIn']=db['sequelize'][_0x1da9('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x1da9('0x38')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x39'));db[_0x1da9('0x3a')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x3b'));db['MailQueue']=db[_0x1da9('0x1')]['import'](_0x1da9('0x3c'));db[_0x1da9('0x3d')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x3e'));db[_0x1da9('0x3f')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x40'));db[_0x1da9('0x41')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x42'));db[_0x1da9('0x43')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x44'));db[_0x1da9('0x45')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x1da9('0x46')]=db[_0x1da9('0x1')]['import']('../api/dashboard/dashboard.model');db[_0x1da9('0x47')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x48'));db[_0x1da9('0x49')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x4a'));db['FaxApplication']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x4b'));db[_0x1da9('0x4c')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x1da9('0x4d')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x1da9('0x1')]['import'](_0x1da9('0x4e'));db[_0x1da9('0x4f')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x50'));db[_0x1da9('0x51')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x52'));db[_0x1da9('0x53')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x54'));db[_0x1da9('0x55')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x56'));db['SmsMessage']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x57'));db[_0x1da9('0x58')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x59'));db[_0x1da9('0x5a')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x5b'));db[_0x1da9('0x5c')]=db[_0x1da9('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x1da9('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0x1da9('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0x1da9('0x5d')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x5e'));db['ChatWebsite']=db['sequelize']['import'](_0x1da9('0x5f'));db['OpenchannelQueueReport']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x60'));db[_0x1da9('0x61')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x62'));db[_0x1da9('0x63')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x64'));db[_0x1da9('0x65')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x66'));db[_0x1da9('0x67')]=db[_0x1da9('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x68'));db[_0x1da9('0x69')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x6a'));db[_0x1da9('0x6b')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x6c'));db[_0x1da9('0x6d')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x6e'));db[_0x1da9('0x6f')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x70'));db[_0x1da9('0x71')]=db['sequelize'][_0x1da9('0x14')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x1da9('0x1')]['import'](_0x1da9('0x72'));db[_0x1da9('0x73')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x74'));db[_0x1da9('0x75')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x76'));db[_0x1da9('0x77')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x78'));db['CmCustomField']=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x1da9('0x79')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x7a'));db[_0x1da9('0x7b')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x7c'));db[_0x1da9('0x7d')]=db[_0x1da9('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x1da9('0x7e')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x7f'));db[_0x1da9('0x80')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x81'));db[_0x1da9('0x82')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x83'));db['Pause']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x84'));db[_0x1da9('0x85')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x86'));db[_0x1da9('0x87')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x88'));db['Schedule']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x89'));db[_0x1da9('0x8a')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x8b'));db[_0x1da9('0x8c')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x8d'));db[_0x1da9('0x8e')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x8f'));db[_0x1da9('0x90')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x91'));db['Variable']=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/variable/variable.model');db['Integration']=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/integration/integration.model');db[_0x1da9('0x92')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x93'));db['AnalyticCustomReport']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x94'));db[_0x1da9('0x95')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x96'));db[_0x1da9('0x97')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x98'));db['AnalyticMetric']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x99'));db[_0x1da9('0x9a')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x9b'));db[_0x1da9('0x9c')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x9d'));db[_0x1da9('0x9e')]=db['sequelize']['import'](_0x1da9('0x9f'));db[_0x1da9('0xa0')]=db['sequelize']['import'](_0x1da9('0xa1'));db[_0x1da9('0xa2')]=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xa3'));db[_0x1da9('0xa4')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xa5'));db[_0x1da9('0xa6')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xa7'));db[_0x1da9('0xa8')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xa9'));db[_0x1da9('0xaa')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xab'));db[_0x1da9('0xac')]=db['sequelize']['import']('../api/intDeskField/intDeskField.model');db[_0x1da9('0xad')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1da9('0xae')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xaf'));db[_0x1da9('0xb0')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xb1'));db[_0x1da9('0xb2')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x1da9('0xb3')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xb4'));db[_0x1da9('0xb5')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xb6'));db[_0x1da9('0xb7')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xb8'));db[_0x1da9('0xb9')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x1da9('0xba')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xbb'));db['VtigerAccount']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xbc'));db[_0x1da9('0xbd')]=db['sequelize']['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x1da9('0xbe')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x1da9('0xbf')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xc0'));db['ServicenowConfiguration']=db[_0x1da9('0x1')]['import'](_0x1da9('0xc1'));db[_0x1da9('0xc2')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xc3'));db[_0x1da9('0xc4')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xc5'));db[_0x1da9('0xc6')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x1da9('0xc7')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xc8'));db['Network']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xc9'));db[_0x1da9('0xca')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xcb'));db[_0x1da9('0xcc')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xcd'));db[_0x1da9('0xce')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xcf'));db[_0x1da9('0xd0')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x1da9('0xd1')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xd2'));db[_0x1da9('0xd3')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xd4'));db[_0x1da9('0xd5')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xd6'));db[_0x1da9('0xd7')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x1da9('0xd8')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xd9'));db[_0x1da9('0xda')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/setting/setting.model');db[_0x1da9('0xdb')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xdc'));db['SquareProject']=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xdd'));db[_0x1da9('0xde')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xdf'));db['SquareMessage']=db[_0x1da9('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x1da9('0xe0')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xe1'));db['License']=db[_0x1da9('0x1')]['import'](_0x1da9('0xe2'));db[_0x1da9('0xe3')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xe4'));db[_0x1da9('0xe5')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/migration/migration.model');db[_0x1da9('0xe6')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xe7'));db[_0x1da9('0xe8')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/plugin/plugin.model');db[_0x1da9('0xe9')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xea'));db[_0x1da9('0xeb')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xec'));db[_0x1da9('0xed')]=db[_0x1da9('0x1')]['import'](_0x1da9('0xee'));db[_0x1da9('0xef')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xf0'));db[_0x1da9('0xf1')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xf2'));db['CmList']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xf3'));db[_0x1da9('0xf4')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xf5'));db[_0x1da9('0xf6')]=db['sequelize'][_0x1da9('0x14')]('../api/userProfile/userProfile.model');db[_0x1da9('0xf7')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xf8'));db[_0x1da9('0xf9')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xfa'));db[_0x1da9('0xfb')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0xfc'));db[_0x1da9('0xfd')]=db['sequelize']['import'](_0x1da9('0xfe'));db['CrmWorkflowStep']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0xff'));db[_0x1da9('0x100')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/crmTask/crmTask.model');db[_0x1da9('0x101')]=db[_0x1da9('0x1')]['import']('../api/crmActionsList/crmActionsList.model');db[_0x1da9('0x102')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x103'));db[_0x1da9('0x104')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/saUnitMeasure/saUnitMeasure.model');db[_0x1da9('0x105')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x106'));db[_0x1da9('0x107')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/saProduct/saProduct.model');db[_0x1da9('0x108')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x109'));db[_0x1da9('0x10a')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x10b'));db['SAProductPricesList']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x10c'));db['SADossier']=db[_0x1da9('0x1')]['import']('../api/saDossier/saDossier.model');db['SARequest']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x10d'));db[_0x1da9('0x10e')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x10f'));db['SAProductQuotation']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x110'));db[_0x1da9('0x111')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x112'));db[_0x1da9('0x113')]=db[_0x1da9('0x1')][_0x1da9('0x14')]('../api/saProforma/saProforma.model');db['SAInvoice']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x114'));db[_0x1da9('0x115')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x116'));db[_0x1da9('0x117')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x118'));db['SAProformaDetail']=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x119'));db[_0x1da9('0x11a')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x11b'));db[_0x1da9('0x11c')]=db['sequelize'][_0x1da9('0x14')]('../api/saPaymentMethod/saPaymentMethod.model');db[_0x1da9('0x11d')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x11e'));db[_0x1da9('0x11f')]=db[_0x1da9('0x1')]['import'](_0x1da9('0x120'));db[_0x1da9('0x121')]=db['sequelize'][_0x1da9('0x14')](_0x1da9('0x122'));db[_0x1da9('0x123')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x124'));db[_0x1da9('0x125')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x126'));db[_0x1da9('0x127')]=db[_0x1da9('0x1')][_0x1da9('0x14')](_0x1da9('0x128'));db[_0x1da9('0x13')][_0x1da9('0x129')](db['VoiceMail'],{'as':_0x1da9('0x21'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x1e')],{'as':'Recordings','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x13')]['hasMany'](db[_0x1da9('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x1a')],{'as':_0x1da9('0x12d'),'onDelete':'cascade','hooks':!![]});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x73')],{'as':'HopperFinals','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x75')],{'as':_0x1da9('0x12e'),'foreignKey':'UserId'});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x12f')],{'as':_0x1da9('0x130'),'foreignKey':_0x1da9('0x12b')});db['User'][_0x1da9('0x12c')](db[_0x1da9('0x63')],{'as':_0x1da9('0x131'),'foreignKey':'UserId'});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x55')],{'as':_0x1da9('0x132'),'foreignKey':'UserId'});db[_0x1da9('0x13')][_0x1da9('0x12c')](db[_0x1da9('0x4c')],{'as':_0x1da9('0x133'),'foreignKey':_0x1da9('0x12b')});db['User'][_0x1da9('0x12c')](db[_0x1da9('0x3f')],{'as':_0x1da9('0x134'),'foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x13')][_0x1da9('0x135')](db[_0x1da9('0xf6')],{'as':_0x1da9('0xf6'),'foreignKey':_0x1da9('0x136')});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x69')],{'as':'Groups','through':_0x1da9('0x138')});db['User'][_0x1da9('0x137')](db['CmContact'],{'as':_0x1da9('0x139'),'through':_0x1da9('0x13a')});db[_0x1da9('0x13')][_0x1da9('0x137')](db['CmList'],{'as':_0x1da9('0x13b'),'through':_0x1da9('0x13c')});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0xe0')],{'through':'user_has_teams'});db['User']['belongsToMany'](db[_0x1da9('0x3f')],{'as':_0x1da9('0x134'),'through':_0x1da9('0x13d')});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x63')],{'as':_0x1da9('0x131'),'through':'user_has_chat_interactions'});db[_0x1da9('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':_0x1da9('0x133'),'through':_0x1da9('0x13e')});db[_0x1da9('0x13')]['belongsToMany'](db[_0x1da9('0x55')],{'as':_0x1da9('0x132'),'through':'user_has_sms_interactions'});db[_0x1da9('0x13')][_0x1da9('0x137')](db['OpenchannelInteraction'],{'as':_0x1da9('0x130'),'through':_0x1da9('0x13f')});db[_0x1da9('0x13')]['belongsToMany'](db[_0x1da9('0x140')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x1da9('0x137')](db['MailQueue'],{'as':'MailQueues','through':_0x1da9('0x33'),'required':![]});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x141')],{'as':_0x1da9('0x142'),'through':_0x1da9('0x31'),'required':![],'hooks':!![]});db[_0x1da9('0x13')]['belongsToMany'](db[_0x1da9('0x143')],{'as':'FaxQueues','through':_0x1da9('0x35'),'required':![]});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x58')],{'as':'SmsQueues','through':_0x1da9('0x144'),'required':![]});db['User']['belongsToMany'](db[_0x1da9('0x5d')],{'as':_0x1da9('0x145'),'through':_0x1da9('0x146'),'required':![]});db[_0x1da9('0x13')][_0x1da9('0x137')](db['CmList'],{'through':_0x1da9('0x13c')});db[_0x1da9('0x13')]['belongsToMany'](db[_0x1da9('0xf4')],{'as':'VoicePrefixes','through':_0x1da9('0x147'),'required':![]});db[_0x1da9('0x13')][_0x1da9('0x137')](db['ChatWebsite'],{'as':_0x1da9('0x148'),'through':'user_has_chat_websites'});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x49')],{'as':_0x1da9('0x149'),'through':'user_has_fax_accounts'});db['User'][_0x1da9('0x137')](db[_0x1da9('0x3a')],{'as':'MailAccounts','through':_0x1da9('0x14a')});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x5a')],{'as':_0x1da9('0x14b'),'through':_0x1da9('0x14c')});db['User']['belongsToMany'](db[_0x1da9('0x51')],{'as':_0x1da9('0x14d'),'through':_0x1da9('0x14e')});db[_0x1da9('0x13')][_0x1da9('0x137')](db[_0x1da9('0x14f')],{'as':_0x1da9('0x150'),'through':_0x1da9('0x151')});db[_0x1da9('0x16')]['hasMany'](db[_0x1da9('0x1a')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x1da9('0x152')});db[_0x1da9('0x18')][_0x1da9('0x12c')](db[_0x1da9('0x1a')],{'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x1a')]['hasMany'](db[_0x1da9('0x1a')],{'as':_0x1da9('0x153'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x1b')][_0x1da9('0x137')](db['Sound'],{'as':_0x1da9('0x154'),'through':_0x1da9('0x155')});db[_0x1da9('0x140')][_0x1da9('0x12c')](db[_0x1da9('0x2e')],{'as':_0x1da9('0x156'),'foreignKey':_0x1da9('0x157')});db[_0x1da9('0x140')][_0x1da9('0x12c')](db['CmHopper'],{'as':_0x1da9('0x158'),'foreignKey':_0x1da9('0x157')});db[_0x1da9('0x140')][_0x1da9('0x12c')](db['CmHopperFinal'],{'as':_0x1da9('0x159'),'foreignKey':_0x1da9('0x157')});db[_0x1da9('0x140')]['hasMany'](db[_0x1da9('0x75')],{'as':_0x1da9('0x15a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x1da9('0x77')],{'as':_0x1da9('0x77'),'foreignKey':_0x1da9('0x157')});db[_0x1da9('0x140')][_0x1da9('0x12c')](db[_0x1da9('0x15b')],{'as':_0x1da9('0x15c'),'foreignKey':_0x1da9('0x157')});db[_0x1da9('0x140')][_0x1da9('0x12c')](db[_0x1da9('0xd1')],{'as':_0x1da9('0x15d'),'foreignKey':_0x1da9('0x157')});db[_0x1da9('0x140')][_0x1da9('0x135')](db[_0x1da9('0x2b')],{'as':'Trunk','foreignKey':_0x1da9('0x15e')});db[_0x1da9('0x140')][_0x1da9('0x135')](db[_0x1da9('0x2b')],{'as':'TrunkBackup','foreignKey':_0x1da9('0x15f')});db[_0x1da9('0x140')][_0x1da9('0x135')](db[_0x1da9('0x82')],{'as':'Interval','foreignKey':_0x1da9('0x160')});db[_0x1da9('0x140')][_0x1da9('0x135')](db['Pause'],{'as':_0x1da9('0x161'),'foreignKey':_0x1da9('0x162')});db[_0x1da9('0x140')][_0x1da9('0x137')](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x1da9('0x140')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':'UserVoiceQueue'});db[_0x1da9('0x140')][_0x1da9('0x137')](db['Team'],{'as':_0x1da9('0x164'),'through':_0x1da9('0x165')});db[_0x1da9('0x140')][_0x1da9('0x137')](db[_0x1da9('0x166')],{'as':_0x1da9('0x167'),'through':_0x1da9('0x168')});db[_0x1da9('0x1e')][_0x1da9('0x135')](db['User'],{'as':_0x1da9('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0x1da9('0x135')](db[_0x1da9('0x13')],{'as':_0x1da9('0x13'),'foreignKey':_0x1da9('0x12b')});db['VoiceMail']['hasMany'](db[_0x1da9('0x169')],{'as':_0x1da9('0x16a'),'onDelete':'cascade','foreignKey':_0x1da9('0x16b'),'sourceKey':_0x1da9('0x16c')});db['VoiceMailMessage'][_0x1da9('0x135')](db[_0x1da9('0x21')],{'foreignKey':_0x1da9('0x16b'),'targetKey':'mailbox'});db[_0x1da9('0x16d')][_0x1da9('0x12c')](db[_0x1da9('0x27')],{'as':_0x1da9('0x16e'),'foreignKey':_0x1da9('0x16f'),'constraints':![]});db[_0x1da9('0x16d')][_0x1da9('0x12c')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x1da9('0x16f'),'constraints':![]});db[_0x1da9('0x16d')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x16d')][_0x1da9('0x135')](db['CmContact'],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x172')][_0x1da9('0x135')](db['MailAccount'],{'as':_0x1da9('0x3a'),'foreignKey':_0x1da9('0x173')});db[_0x1da9('0x38')][_0x1da9('0x135')](db[_0x1da9('0x3a')],{'as':_0x1da9('0x3a'),'foreignKey':_0x1da9('0x173')});db['MailAccount'][_0x1da9('0x129')](db[_0x1da9('0x172')],{'as':_0x1da9('0x174'),'onDelete':'cascade'});db['MailAccount'][_0x1da9('0x129')](db[_0x1da9('0x38')],{'as':_0x1da9('0x175'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x3a')][_0x1da9('0x12c')](db['Disposition'],{'as':_0x1da9('0x176'),'foreignKey':_0x1da9('0x173')});db[_0x1da9('0x3a')][_0x1da9('0x12c')](db['CannedAnswer'],{'as':_0x1da9('0x177'),'foreignKey':_0x1da9('0x173')});db[_0x1da9('0x3a')][_0x1da9('0x12c')](db[_0x1da9('0x41')],{'as':_0x1da9('0x16a'),'foreignKey':_0x1da9('0x173')});db['MailAccount']['hasMany'](db[_0x1da9('0x3f')],{'as':'Interactions'});db[_0x1da9('0x3a')][_0x1da9('0x12c')](db[_0x1da9('0x43')],{'as':'Applications'});db[_0x1da9('0x3a')][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179')});db['MailAccount']['belongsTo'](db[_0x1da9('0x8e')],{'as':_0x1da9('0x8e'),'foreignKey':'TemplateId'});db[_0x1da9('0x3a')][_0x1da9('0x135')](db[_0x1da9('0x17a')],{'as':_0x1da9('0x161'),'foreignKey':_0x1da9('0x162')});db[_0x1da9('0x3a')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x14a')});db[_0x1da9('0x17b')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x33')});db[_0x1da9('0x17b')][_0x1da9('0x137')](db['Team'],{'through':_0x1da9('0x17c'),'as':_0x1da9('0x164')});db['MailInteraction'][_0x1da9('0x12c')](db[_0x1da9('0x41')],{'as':_0x1da9('0x16a'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x17d')});db[_0x1da9('0x3f')][_0x1da9('0x135')](db[_0x1da9('0x3a')],{'as':'Account','foreignKey':_0x1da9('0x173')});db[_0x1da9('0x3f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x1da9('0x171')});db['MailInteraction'][_0x1da9('0x135')](db['User'],{'as':'Owner','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x3f')][_0x1da9('0x137')](db['Tag'],{'through':_0x1da9('0x17e'),'as':_0x1da9('0x17f')});db[_0x1da9('0x3f')][_0x1da9('0x137')](db['Tag'],{'through':_0x1da9('0x17e'),'as':_0x1da9('0x180')});db[_0x1da9('0x3f')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x181'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage'][_0x1da9('0x12c')](db[_0x1da9('0xe6')],{'as':_0x1da9('0x182'),'onDelete':_0x1da9('0x12a')});db['MailMessage'][_0x1da9('0x135')](db[_0x1da9('0x13')],{'as':_0x1da9('0x13')});db['MailMessage'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'onDelete':'cascade','as':_0x1da9('0x170')});db[_0x1da9('0x41')][_0x1da9('0x135')](db[_0x1da9('0x3f')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x1da9('0x41')][_0x1da9('0x135')](db['MailAccount'],{'as':_0x1da9('0x183'),'foreignKey':'MailAccountId'});db[_0x1da9('0x43')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':_0x1da9('0x184')});db['MailApplication']['belongsTo'](db['MailQueue'],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x43')][_0x1da9('0x135')](db[_0x1da9('0x3a')],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x43')][_0x1da9('0x135')](db[_0x1da9('0x82')],{'onDelete':'restrict','foreignKey':_0x1da9('0x160')});db['MailApplication'][_0x1da9('0x135')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1da9('0x185')});db[_0x1da9('0x45')][_0x1da9('0x135')](db[_0x1da9('0x3a')],{});db[_0x1da9('0x45')][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179')});db['MailQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x45')]['belongsTo'](db['MailInteraction'],{});db[_0x1da9('0x45')]['belongsTo'](db[_0x1da9('0x41')],{});db[_0x1da9('0x45')]['belongsTo'](db['User'],{});db[_0x1da9('0x45')][_0x1da9('0x135')](db['MailQueue'],{});db[_0x1da9('0x46')][_0x1da9('0x12c')](db[_0x1da9('0x47')],{'as':'Items','onDelete':_0x1da9('0x12a')});db['FaxAccount']['hasMany'](db[_0x1da9('0x7e')],{'as':_0x1da9('0x176'),'foreignKey':_0x1da9('0x186')});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':_0x1da9('0x177'),'foreignKey':_0x1da9('0x186')});db['FaxAccount'][_0x1da9('0x12c')](db[_0x1da9('0x4c')],{'as':_0x1da9('0x187')});db['FaxAccount'][_0x1da9('0x12c')](db[_0x1da9('0x188')],{'as':_0x1da9('0x153')});db[_0x1da9('0x49')][_0x1da9('0x12c')](db[_0x1da9('0x1a')],{'as':'Exntensions','onDelete':'cascade'});db[_0x1da9('0x49')][_0x1da9('0x12c')](db[_0x1da9('0x4d')],{'as':'Messages'});db['FaxAccount'][_0x1da9('0x135')](db['Trunk'],{'as':_0x1da9('0x2b')});db[_0x1da9('0x49')]['belongsTo'](db[_0x1da9('0x166')],{'as':'List','foreignKey':_0x1da9('0x179')});db[_0x1da9('0x49')][_0x1da9('0x135')](db['Pause'],{'as':_0x1da9('0x161'),'foreignKey':_0x1da9('0x162')});db[_0x1da9('0x49')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x189')});db['FaxApplication'][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x188')][_0x1da9('0x135')](db[_0x1da9('0x143')],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x188')][_0x1da9('0x135')](db[_0x1da9('0x49')],{'onDelete':'restrict'});db[_0x1da9('0x188')]['belongsTo'](db[_0x1da9('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db['FaxInteraction'][_0x1da9('0x12c')](db[_0x1da9('0x4d')],{'as':_0x1da9('0x16a'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x18a')});db[_0x1da9('0x4c')][_0x1da9('0x135')](db[_0x1da9('0x49')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x186')});db[_0x1da9('0x4c')][_0x1da9('0x135')](db['CmContact'],{'as':_0x1da9('0x170'),'foreignKey':'ContactId'});db[_0x1da9('0x4c')][_0x1da9('0x135')](db['User'],{'as':'Owner','foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x4c')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':_0x1da9('0x18b'),'as':_0x1da9('0x17f')});db[_0x1da9('0x4c')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':'fax_interaction_has_tags','as':_0x1da9('0x180')});db[_0x1da9('0x4c')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x181'),'through':_0x1da9('0x13e'),'foreignKey':'FaxInteractionId'});db[_0x1da9('0x4d')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':'cascade','as':_0x1da9('0x13')});db['FaxMessage'][_0x1da9('0x135')](db[_0x1da9('0x4c')],{'as':'Interaction','foreignKey':_0x1da9('0x18a')});db[_0x1da9('0x4d')][_0x1da9('0x135')](db['CmContact'],{'onDelete':_0x1da9('0x12a'),'as':_0x1da9('0x170')});db['FaxMessage'][_0x1da9('0x135')](db['Attachment'],{'as':'Attachment','foreignKey':_0x1da9('0x18c')});db[_0x1da9('0x4d')][_0x1da9('0x135')](db[_0x1da9('0x49')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x186')});db['FaxQueue']['belongsToMany'](db[_0x1da9('0x13')],{'as':'Agents','through':_0x1da9('0x35')});db[_0x1da9('0x143')][_0x1da9('0x137')](db[_0x1da9('0xe0')],{'through':'team_has_fax_queues','as':_0x1da9('0x164')});db['FaxQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x49')],{});db[_0x1da9('0x4f')][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x4f')][_0x1da9('0x135')](db['CmContact'],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x4f')][_0x1da9('0x135')](db[_0x1da9('0x4c')],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x13')],{});db[_0x1da9('0x4f')]['belongsTo'](db['FaxQueue'],{});db[_0x1da9('0x51')]['hasMany'](db[_0x1da9('0x7e')],{'as':_0x1da9('0x176'),'foreignKey':'SmsAccountId'});db[_0x1da9('0x51')][_0x1da9('0x12c')](db[_0x1da9('0x7d')],{'as':_0x1da9('0x177'),'foreignKey':'SmsAccountId'});db[_0x1da9('0x51')][_0x1da9('0x12c')](db[_0x1da9('0x18d')],{'as':'Messages','foreignKey':_0x1da9('0x18e')});db['SmsAccount'][_0x1da9('0x12c')](db[_0x1da9('0x55')],{'as':_0x1da9('0x187')});db[_0x1da9('0x51')]['hasMany'](db['SmsApplication'],{'as':_0x1da9('0x153')});db[_0x1da9('0x51')][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':'List','foreignKey':'ListId'});db[_0x1da9('0x51')][_0x1da9('0x135')](db[_0x1da9('0x17a')],{'as':_0x1da9('0x161'),'foreignKey':_0x1da9('0x162')});db[_0x1da9('0x51')]['belongsToMany'](db['User'],{'as':_0x1da9('0x163'),'through':_0x1da9('0x14e')});db[_0x1da9('0x53')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x53')][_0x1da9('0x135')](db[_0x1da9('0x58')],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x53')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x1da9('0x184')});db[_0x1da9('0x53')][_0x1da9('0x135')](db[_0x1da9('0x82')],{'onDelete':_0x1da9('0x184'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0x53')][_0x1da9('0x135')](db[_0x1da9('0x8c')],{'onDelete':_0x1da9('0x184'),'foreignKey':'TagId'});db[_0x1da9('0x55')][_0x1da9('0x12c')](db[_0x1da9('0x18d')],{'as':'Messages','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x18f')});db[_0x1da9('0x55')][_0x1da9('0x135')](db[_0x1da9('0x51')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x18e')});db[_0x1da9('0x55')][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':'Contact','foreignKey':_0x1da9('0x171')});db[_0x1da9('0x55')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'as':_0x1da9('0x190'),'foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x55')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':_0x1da9('0x191'),'as':_0x1da9('0x17f')});db[_0x1da9('0x55')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db['SmsInteraction'][_0x1da9('0x137')](db['User'],{'as':_0x1da9('0x181'),'through':_0x1da9('0x192'),'foreignKey':'SmsInteractionId'});db[_0x1da9('0x18d')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'as':'User'});db[_0x1da9('0x18d')]['belongsTo'](db[_0x1da9('0x6f')],{'onDelete':_0x1da9('0x12a'),'as':_0x1da9('0x170')});db['SmsMessage'][_0x1da9('0x135')](db[_0x1da9('0x55')],{'onDelete':_0x1da9('0x12a'),'as':_0x1da9('0x193'),'foreignKey':_0x1da9('0x18f')});db[_0x1da9('0x18d')][_0x1da9('0x135')](db['SmsAccount'],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x18e')});db[_0x1da9('0x58')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x144'),'foreignKey':_0x1da9('0x194')});db['SmsQueue'][_0x1da9('0x137')](db[_0x1da9('0xe0')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x1da9('0x5a')][_0x1da9('0x12c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x1da9('0x195')});db['OpenchannelAccount'][_0x1da9('0x12c')](db[_0x1da9('0x7d')],{'as':_0x1da9('0x177'),'foreignKey':'OpenchannelAccountId'});db[_0x1da9('0x5a')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x1da9('0x187'),'foreignKey':'OpenchannelAccountId'});db[_0x1da9('0x5a')][_0x1da9('0x12c')](db['OpenchannelMessage'],{'as':_0x1da9('0x16a'),'foreignKey':_0x1da9('0x195')});db[_0x1da9('0x5a')]['hasMany'](db[_0x1da9('0x5c')],{'as':_0x1da9('0x153'),'foreignKey':_0x1da9('0x195')});db[_0x1da9('0x5a')][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x5a')]['belongsTo'](db[_0x1da9('0x17a')],{'as':_0x1da9('0x161'),'foreignKey':_0x1da9('0x162')});db[_0x1da9('0x5a')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':'Agents','through':_0x1da9('0x14c')});db[_0x1da9('0x5c')][_0x1da9('0x135')](db['User'],{'onDelete':'restrict'});db[_0x1da9('0x5c')][_0x1da9('0x135')](db[_0x1da9('0x5d')],{'onDelete':_0x1da9('0x184'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x1da9('0x135')](db[_0x1da9('0x5a')],{'onDelete':_0x1da9('0x184'),'foreignKey':_0x1da9('0x195')});db['OpenchannelApplication'][_0x1da9('0x135')](db[_0x1da9('0x82')],{'onDelete':_0x1da9('0x184'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0x5c')][_0x1da9('0x135')](db[_0x1da9('0x8c')],{'onDelete':_0x1da9('0x184'),'foreignKey':_0x1da9('0x185')});db[_0x1da9('0x12f')]['hasMany'](db[_0x1da9('0x196')],{'as':_0x1da9('0x16a'),'onDelete':'cascade','foreignKey':_0x1da9('0x197')});db['OpenchannelInteraction'][_0x1da9('0x135')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x12f')][_0x1da9('0x135')](db['User'],{'as':_0x1da9('0x190'),'foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x12f')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':_0x1da9('0x198'),'as':_0x1da9('0x17f')});db[_0x1da9('0x12f')][_0x1da9('0x137')](db['Tag'],{'through':_0x1da9('0x198'),'as':_0x1da9('0x180')});db[_0x1da9('0x12f')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x181'),'through':_0x1da9('0x13f'),'foreignKey':_0x1da9('0x197')});db[_0x1da9('0x196')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':_0x1da9('0x12a'),'as':'User'});db[_0x1da9('0x196')][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'onDelete':_0x1da9('0x12a'),'as':'Contact'});db['OpenchannelMessage'][_0x1da9('0x135')](db[_0x1da9('0x12f')],{'onDelete':_0x1da9('0x12a'),'as':'Interaction','foreignKey':_0x1da9('0x197')});db['OpenchannelMessage'][_0x1da9('0x135')](db[_0x1da9('0xe6')],{'as':_0x1da9('0xe6'),'foreignKey':_0x1da9('0x18c')});db[_0x1da9('0x196')][_0x1da9('0x135')](db[_0x1da9('0x5a')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x195')});db[_0x1da9('0x5d')][_0x1da9('0x137')](db['User'],{'as':_0x1da9('0x163'),'through':_0x1da9('0x146'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0x1da9('0xe0')],{'through':_0x1da9('0x199'),'as':'Teams'});db[_0x1da9('0x19a')][_0x1da9('0x12c')](db[_0x1da9('0x7e')],{'as':_0x1da9('0x176'),'foreignKey':_0x1da9('0x19b')});db[_0x1da9('0x19a')][_0x1da9('0x12c')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x1da9('0x19b')});db[_0x1da9('0x19a')][_0x1da9('0x12c')](db[_0x1da9('0x6b')],{'as':_0x1da9('0x19c')});db[_0x1da9('0x19a')]['hasMany'](db['ChatInteraction'],{'as':_0x1da9('0x187')});db['ChatWebsite'][_0x1da9('0x12c')](db[_0x1da9('0x61')],{'as':_0x1da9('0x153')});db[_0x1da9('0x19a')]['hasMany'](db[_0x1da9('0x65')],{'as':'Messages'});db[_0x1da9('0x19a')][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x19a')][_0x1da9('0x135')](db['Interval'],{'as':_0x1da9('0x82'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0x19a')][_0x1da9('0x135')](db['Pause'],{'as':_0x1da9('0x161'),'foreignKey':_0x1da9('0x162')});db['ChatWebsite'][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x19d')});db[_0x1da9('0x19e')][_0x1da9('0x135')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x1da9('0x135')](db['CmList'],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x19e')][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':'Contact','foreignKey':_0x1da9('0x171')});db['OpenchannelQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x12f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1da9('0x196')],{});db[_0x1da9('0x19e')][_0x1da9('0x135')](db['User'],{});db[_0x1da9('0x19e')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x1da9('0x61')][_0x1da9('0x135')](db['User'],{'as':_0x1da9('0x19f'),'foreignKey':_0x1da9('0x12b'),'onDelete':'restrict'});db[_0x1da9('0x61')][_0x1da9('0x135')](db[_0x1da9('0x141')],{'as':_0x1da9('0x1a0'),'foreignKey':'ChatQueueId','onDelete':_0x1da9('0x184')});db[_0x1da9('0x61')][_0x1da9('0x135')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x1da9('0x184')});db[_0x1da9('0x61')][_0x1da9('0x135')](db[_0x1da9('0x8c')],{'onDelete':_0x1da9('0x184'),'foreignKey':_0x1da9('0x185')});db['ChatInteraction'][_0x1da9('0x12c')](db[_0x1da9('0x65')],{'as':_0x1da9('0x16a'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1a1')});db[_0x1da9('0x63')][_0x1da9('0x135')](db[_0x1da9('0x19a')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x19b')});db[_0x1da9('0x63')][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':'Contact','foreignKey':_0x1da9('0x171')});db[_0x1da9('0x63')]['belongsTo'](db[_0x1da9('0x13')],{'as':_0x1da9('0x190'),'foreignKey':_0x1da9('0x12b')});db[_0x1da9('0x63')]['belongsToMany'](db[_0x1da9('0x8c')],{'through':_0x1da9('0x1a2'),'as':_0x1da9('0x17f')});db[_0x1da9('0x63')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':'chat_interaction_has_tags','as':_0x1da9('0x180')});db[_0x1da9('0x63')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':'Users','through':_0x1da9('0x1a3'),'foreignKey':_0x1da9('0x1a1')});db[_0x1da9('0x65')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':'cascade','as':_0x1da9('0x13')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x1da9('0x12a'),'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x65')][_0x1da9('0x135')](db['ChatInteraction'],{'onDelete':_0x1da9('0x12a'),'as':_0x1da9('0x193'),'foreignKey':'ChatInteractionId'});db[_0x1da9('0x65')][_0x1da9('0x135')](db[_0x1da9('0xe6')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x1da9('0x65')][_0x1da9('0x135')](db[_0x1da9('0x19a')],{'as':_0x1da9('0x183'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'onDelete':'cascade','as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x67')][_0x1da9('0x135')](db['ChatWebsite'],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x19b')});db[_0x1da9('0x141')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x1da9('0x31'),'hooks':!![]});db[_0x1da9('0x141')][_0x1da9('0x137')](db[_0x1da9('0xe0')],{'through':_0x1da9('0x1a4'),'as':'Teams'});db[_0x1da9('0x69')][_0x1da9('0x12c')](db[_0x1da9('0xcc')],{'as':_0x1da9('0x16a'),'foreignKey':_0x1da9('0x1a5'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x69')]['belongsToMany'](db[_0x1da9('0x13')],{'as':_0x1da9('0x156'),'through':_0x1da9('0x138')});db[_0x1da9('0x6b')][_0x1da9('0x135')](db['ChatWebsite'],{'as':_0x1da9('0x1a6'),'foreignKey':'ChatWebsiteId'});db[_0x1da9('0x6d')]['hasOne'](db[_0x1da9('0x6d')],{'as':_0x1da9('0x1a7')});db['CmCompany'][_0x1da9('0x12c')](db[_0x1da9('0x6f')],{'as':'Contacts','foreignKey':_0x1da9('0x1a8')});db[_0x1da9('0x6d')][_0x1da9('0x12c')](db[_0x1da9('0x10a')],{'as':_0x1da9('0x1a9'),'foreignKey':_0x1da9('0x1a8')});db['CmCompany']['hasMany'](db['SADossier'],{'as':_0x1da9('0x1aa'),'foreignKey':_0x1da9('0x1a8')});db['CmCompany'][_0x1da9('0x135')](db['SAPaymentMethod'],{'as':_0x1da9('0x1ab'),'foreignKey':_0x1da9('0x1ac')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db[_0x1da9('0x71')],{'as':_0x1da9('0x158'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x1da9('0x171')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x1da9('0x171')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db[_0x1da9('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x1da9('0x171')});db[_0x1da9('0x6f')]['hasMany'](db[_0x1da9('0xd1')],{'as':_0x1da9('0x15d'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db[_0x1da9('0x12f')],{'as':'OpenchannelInteractions','foreignKey':_0x1da9('0x171'),'onDelete':'restrict'});db[_0x1da9('0x6f')]['hasMany'](db[_0x1da9('0x63')],{'as':_0x1da9('0x131'),'foreignKey':_0x1da9('0x171'),'onDelete':'restrict'});db['CmContact'][_0x1da9('0x12c')](db['SmsInteraction'],{'as':_0x1da9('0x132'),'foreignKey':_0x1da9('0x171'),'onDelete':_0x1da9('0x184')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db['FaxInteraction'],{'as':_0x1da9('0x133'),'foreignKey':_0x1da9('0x171'),'onDelete':_0x1da9('0x184')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db[_0x1da9('0x3f')],{'as':_0x1da9('0x134'),'foreignKey':_0x1da9('0x171'),'onDelete':_0x1da9('0x184')});db[_0x1da9('0x6f')][_0x1da9('0x12c')](db['SADossier'],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171'),'onDelete':_0x1da9('0x184')});db['CmContact'][_0x1da9('0x135')](db[_0x1da9('0x6d')],{'as':_0x1da9('0x1ad'),'foreignKey':'CompanyId'});db[_0x1da9('0x6f')]['belongsTo'](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':_0x1da9('0x179'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x6f')]['belongsToMany'](db[_0x1da9('0x13')],{'as':_0x1da9('0x181'),'through':'cm_user_has_contacts'});db[_0x1da9('0x6f')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'as':_0x1da9('0x17f'),'through':_0x1da9('0x1ae')});db['CmContact'][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':_0x1da9('0x1ae'),'as':'ThroughTags'});db['CmHopper'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':_0x1da9('0x170'),'foreignKey':'ContactId','onDelete':_0x1da9('0x12a')});db['CmHopper'][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':'ListId','onDelete':_0x1da9('0x12a')});db[_0x1da9('0x71')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'as':_0x1da9('0x19f'),'foreignKey':'UserId'});db[_0x1da9('0x71')][_0x1da9('0x135')](db[_0x1da9('0x140')],{'as':'Queue','foreignKey':_0x1da9('0x157'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x71')][_0x1da9('0x135')](db[_0x1da9('0xe3')],{'as':_0x1da9('0xe3'),'foreignKey':_0x1da9('0x1af'),'onDelete':'cascade'});db[_0x1da9('0x71')]['belongsTo'](db[_0x1da9('0x13')],{'as':_0x1da9('0x190'),'foreignKey':_0x1da9('0x1b0')});db['CmHopperBlack'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x15b')][_0x1da9('0x135')](db['CmList'],{'as':_0x1da9('0x178'),'foreignKey':'ListId','onDelete':_0x1da9('0x12a')});db[_0x1da9('0x15b')][_0x1da9('0x135')](db['VoiceQueue'],{'as':_0x1da9('0x1a0'),'foreignKey':_0x1da9('0x157'),'onDelete':'cascade'});db[_0x1da9('0x15b')]['belongsTo'](db['Campaign'],{'as':_0x1da9('0xe3'),'foreignKey':_0x1da9('0x1af'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0x7b')][_0x1da9('0x12c')](db[_0x1da9('0x80')],{'as':{'plural':_0x1da9('0x1b1'),'singular':_0x1da9('0x1b2')},'foreignKey':'AutomationAllId','onDelete':_0x1da9('0x12a'),'hooks':!![]});db[_0x1da9('0x7b')]['hasMany'](db[_0x1da9('0x80')],{'as':{'plural':_0x1da9('0x1b3'),'singular':'OneAny'},'foreignKey':_0x1da9('0x1b4'),'onDelete':_0x1da9('0x12a'),'hooks':!![]});db[_0x1da9('0x7b')][_0x1da9('0x12c')](db[_0x1da9('0x79')],{'as':_0x1da9('0x1b5'),'foreignKey':'AutomationId','onDelete':_0x1da9('0x12a'),'hooks':!![]});db[_0x1da9('0x82')][_0x1da9('0x12c')](db[_0x1da9('0x82')],{'as':_0x1da9('0x1b6'),'foreignKey':_0x1da9('0x160'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x1da9('0x12c')](db[_0x1da9('0x1a')],{'as':_0x1da9('0x12d'),'foreignKey':_0x1da9('0x160'),'onDelete':_0x1da9('0x184')});db['Interval']['hasMany'](db['MailApplication'],{'as':_0x1da9('0x1b7'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0x82')]['hasMany'](db[_0x1da9('0x61')],{'as':_0x1da9('0x1b8'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0x82')][_0x1da9('0x12c')](db['FaxApplication'],{'as':_0x1da9('0x1b9'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0x82')][_0x1da9('0x12c')](db[_0x1da9('0x53')],{'as':_0x1da9('0x1ba'),'foreignKey':'IntervalId'});db[_0x1da9('0x1bb')][_0x1da9('0x135')](db['MailAccount'],{});db[_0x1da9('0x1bb')][_0x1da9('0x135')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x1da9('0x1bb')][_0x1da9('0x135')](db[_0x1da9('0x1bc')],{'foreignKey':_0x1da9('0x1bd')});db[_0x1da9('0x8a')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x1da9('0x1be'),'through':_0x1da9('0x155'),'onDelete':'restrict'});db[_0x1da9('0x8c')][_0x1da9('0x137')](db['CmContact'],{'through':'cm_contact_has_tags'});db['Tag'][_0x1da9('0x137')](db[_0x1da9('0x63')],{'through':_0x1da9('0x1a2')});db[_0x1da9('0x8c')][_0x1da9('0x137')](db['MailInteraction'],{'through':_0x1da9('0x17e')});db['Tag'][_0x1da9('0x137')](db['SmsInteraction'],{'through':_0x1da9('0x191')});db[_0x1da9('0x8c')][_0x1da9('0x137')](db[_0x1da9('0x4c')],{'through':_0x1da9('0x18b')});db[_0x1da9('0x8c')][_0x1da9('0x137')](db[_0x1da9('0x12f')],{'through':_0x1da9('0x198')});db['Trigger'][_0x1da9('0x12c')](db[_0x1da9('0x80')],{'as':{'plural':'AllConditions','singular':_0x1da9('0x1bf')},'foreignKey':_0x1da9('0x1c0'),'onDelete':_0x1da9('0x12a'),'hooks':!![]});db[_0x1da9('0x90')]['hasMany'](db[_0x1da9('0x80')],{'as':{'plural':_0x1da9('0x1c1'),'singular':'AnyCondition'},'foreignKey':_0x1da9('0x1c2'),'onDelete':_0x1da9('0x12a'),'hooks':!![]});db[_0x1da9('0x90')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x1da9('0x1c3'),'onDelete':_0x1da9('0x12a'),'hooks':!![]});db['AnalyticCustomReport'][_0x1da9('0x12c')](db[_0x1da9('0x9a')],{'as':_0x1da9('0x1c4'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1bd'),'hooks':!![]});db[_0x1da9('0x95')][_0x1da9('0x12c')](db[_0x1da9('0x9a')],{'as':'Fields','onDelete':_0x1da9('0x12a'),'foreignKey':'DefaultReportId'});db[_0x1da9('0x1c5')][_0x1da9('0x12c')](db['AnalyticFieldReport'],{'as':_0x1da9('0x1c4'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c6')});db['AnalyticFieldReport'][_0x1da9('0x135')](db[_0x1da9('0x1c5')],{'foreignKey':_0x1da9('0x1c6')});db[_0x1da9('0x9e')][_0x1da9('0x12c')](db[_0x1da9('0xa0')],{'as':'Configurations','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xa0')][_0x1da9('0x12c')](db[_0x1da9('0xa2')],{'as':_0x1da9('0x1c8'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xa0')]['hasMany'](db[_0x1da9('0xa2')],{'as':_0x1da9('0x1ca'),'onDelete':_0x1da9('0x12a'),'foreignKey':'DescriptionId'});db[_0x1da9('0xa0')][_0x1da9('0x12c')](db[_0x1da9('0xa2')],{'as':_0x1da9('0x1c4'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1cb')});db['SalesforceConfiguration'][_0x1da9('0x135')](db[_0x1da9('0x9e')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xa2')][_0x1da9('0x12c')](db[_0x1da9('0xa2')],{'as':'Subject','foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xa2')]['hasMany'](db[_0x1da9('0xa2')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db['SalesforceField'][_0x1da9('0x12c')](db[_0x1da9('0xa2')],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0xa2')][_0x1da9('0x135')](db['Variable'],{'as':_0x1da9('0x1cf'),'foreignKey':_0x1da9('0x1d0')});db['SugarcrmAccount'][_0x1da9('0x12c')](db['SugarcrmConfiguration'],{'as':_0x1da9('0x1d1'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xa4')][_0x1da9('0x12c')](db[_0x1da9('0xa6')],{'as':_0x1da9('0x1c8'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xa4')][_0x1da9('0x12c')](db['SugarcrmField'],{'as':_0x1da9('0x1ca'),'onDelete':_0x1da9('0x12a'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x1da9('0x12c')](db[_0x1da9('0xa6')],{'as':_0x1da9('0x1c4'),'onDelete':'cascade','foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0xa4')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xa6')][_0x1da9('0x12c')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xa6')][_0x1da9('0x12c')](db[_0x1da9('0xa6')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xa6')][_0x1da9('0x12c')](db[_0x1da9('0xa6')],{'as':'Field','foreignKey':_0x1da9('0x1cb')});db['SugarcrmField'][_0x1da9('0x135')](db[_0x1da9('0x1cf')],{'as':_0x1da9('0x1cf'),'foreignKey':'VariableId'});db[_0x1da9('0xa8')][_0x1da9('0x12c')](db[_0x1da9('0xaa')],{'as':_0x1da9('0x1d1'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xaa')]['hasMany'](db[_0x1da9('0xac')],{'as':'Subjects','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xaa')][_0x1da9('0x12c')](db[_0x1da9('0xac')],{'as':_0x1da9('0x1ca'),'onDelete':'cascade','foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xaa')]['hasMany'](db[_0x1da9('0xac')],{'as':'Fields','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1cb')});db['DeskConfiguration'][_0x1da9('0x135')](db[_0x1da9('0xa8')],{'as':_0x1da9('0x183'),'foreignKey':'AccountId'});db[_0x1da9('0xaa')][_0x1da9('0x137')](db['Tag'],{'through':_0x1da9('0x1d2')});db[_0x1da9('0xac')][_0x1da9('0x12c')](db[_0x1da9('0xac')],{'as':_0x1da9('0x1d3'),'foreignKey':'SubjectId'});db[_0x1da9('0xac')][_0x1da9('0x12c')](db[_0x1da9('0xac')],{'as':_0x1da9('0x1cc'),'foreignKey':'DescriptionId'});db[_0x1da9('0xac')]['hasMany'](db[_0x1da9('0xac')],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0xac')]['belongsTo'](db[_0x1da9('0x1cf')],{'as':_0x1da9('0x1cf'),'foreignKey':_0x1da9('0x1d0')});db['ZohoAccount'][_0x1da9('0x12c')](db[_0x1da9('0xae')],{'as':_0x1da9('0x1d1'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db['ZohoConfiguration'][_0x1da9('0x12c')](db[_0x1da9('0xb0')],{'as':_0x1da9('0x1c8'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xae')][_0x1da9('0x12c')](db[_0x1da9('0xb0')],{'as':_0x1da9('0x1ca'),'onDelete':_0x1da9('0x12a'),'foreignKey':'DescriptionId'});db[_0x1da9('0xae')]['hasMany'](db[_0x1da9('0xb0')],{'as':_0x1da9('0x1c4'),'onDelete':_0x1da9('0x12a'),'foreignKey':'FieldId'});db[_0x1da9('0xae')]['belongsTo'](db[_0x1da9('0xad')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xb0')][_0x1da9('0x12c')](db[_0x1da9('0xb0')],{'as':_0x1da9('0x1d3'),'foreignKey':_0x1da9('0x1c9')});db['ZohoField']['hasMany'](db[_0x1da9('0xb0')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xb0')][_0x1da9('0x12c')](db['ZohoField'],{'as':'Field','foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0xb0')]['belongsTo'](db[_0x1da9('0x1cf')],{'as':'Variable','foreignKey':_0x1da9('0x1d0')});db[_0x1da9('0xb2')][_0x1da9('0x12c')](db[_0x1da9('0xb3')],{'as':'Configurations','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db['ZendeskConfiguration'][_0x1da9('0x12c')](db[_0x1da9('0xb5')],{'as':_0x1da9('0x1c8'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xb3')][_0x1da9('0x12c')](db['ZendeskField'],{'as':_0x1da9('0x1ca'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xb3')][_0x1da9('0x12c')](db[_0x1da9('0xb5')],{'as':'Fields','foreignKey':_0x1da9('0x1cb')});db['ZendeskConfiguration'][_0x1da9('0x135')](db[_0x1da9('0xb2')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x1c7')});db['ZendeskConfiguration'][_0x1da9('0x137')](db['Tag'],{'through':_0x1da9('0x1d4')});db[_0x1da9('0xb5')][_0x1da9('0x12c')](db[_0x1da9('0xb5')],{'as':'Subject','foreignKey':_0x1da9('0x1c9')});db['ZendeskField'][_0x1da9('0x12c')](db[_0x1da9('0xb5')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xb5')][_0x1da9('0x12c')](db['ZendeskField'],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db['ZendeskField'][_0x1da9('0x135')](db['Variable'],{'as':_0x1da9('0x1cf'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x1da9('0x12c')](db[_0x1da9('0xb9')],{'as':_0x1da9('0x1d1'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xb9')][_0x1da9('0x12c')](db[_0x1da9('0xba')],{'as':_0x1da9('0x1c8'),'onDelete':'cascade','foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xb9')]['hasMany'](db[_0x1da9('0xba')],{'as':_0x1da9('0x1ca'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xb9')][_0x1da9('0x12c')](db['FreshdeskField'],{'as':_0x1da9('0x1c4'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0xb9')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xb9')][_0x1da9('0x137')](db[_0x1da9('0x8c')],{'through':_0x1da9('0x1d5')});db[_0x1da9('0xba')][_0x1da9('0x12c')](db[_0x1da9('0xba')],{'as':_0x1da9('0x1d3'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xba')][_0x1da9('0x12c')](db[_0x1da9('0xba')],{'as':_0x1da9('0x1cc'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x1da9('0x12c')](db['FreshdeskField'],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db['FreshdeskField'][_0x1da9('0x135')](db[_0x1da9('0x1cf')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1da9('0x1d6')][_0x1da9('0x12c')](db[_0x1da9('0xbd')],{'as':'Configurations','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xbd')][_0x1da9('0x12c')](db['VtigerField'],{'as':_0x1da9('0x1c8'),'foreignKey':_0x1da9('0x1c9')});db['VtigerConfiguration'][_0x1da9('0x12c')](db[_0x1da9('0xbe')],{'as':_0x1da9('0x1ca'),'foreignKey':_0x1da9('0x1cd')});db['VtigerConfiguration'][_0x1da9('0x12c')](db[_0x1da9('0xbe')],{'as':_0x1da9('0x1c4'),'foreignKey':'FieldId'});db[_0x1da9('0xbd')]['belongsTo'](db[_0x1da9('0x1d6')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xbd')]['belongsToMany'](db[_0x1da9('0x8c')],{'through':_0x1da9('0x1d7')});db[_0x1da9('0xbe')][_0x1da9('0x12c')](db['VtigerField'],{'as':_0x1da9('0x1d3'),'foreignKey':'SubjectId'});db['VtigerField'][_0x1da9('0x12c')](db[_0x1da9('0xbe')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xbe')]['hasMany'](db[_0x1da9('0xbe')],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db['VtigerField'][_0x1da9('0x135')](db[_0x1da9('0x1cf')],{'as':_0x1da9('0x1cf'),'foreignKey':_0x1da9('0x1d0')});db[_0x1da9('0xbf')][_0x1da9('0x12c')](db[_0x1da9('0x1d8')],{'as':_0x1da9('0x1d1'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0x1d8')]['hasMany'](db[_0x1da9('0xc2')],{'as':_0x1da9('0x1c8'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0x1d8')][_0x1da9('0x12c')](db['ServicenowField'],{'as':_0x1da9('0x1ca'),'foreignKey':'DescriptionId'});db[_0x1da9('0x1d8')][_0x1da9('0x12c')](db[_0x1da9('0xc2')],{'as':'Fields','foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0x1d8')]['belongsTo'](db[_0x1da9('0xbf')],{'as':'Account','foreignKey':_0x1da9('0x1c7')});db['ServicenowField']['hasMany'](db[_0x1da9('0xc2')],{'as':_0x1da9('0x1d3'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xc2')][_0x1da9('0x12c')](db[_0x1da9('0xc2')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db['ServicenowField']['hasMany'](db[_0x1da9('0xc2')],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0xc2')]['belongsTo'](db['Variable'],{'as':_0x1da9('0x1cf'),'foreignKey':'VariableId'});db[_0x1da9('0xc4')][_0x1da9('0x12c')](db['Dynamics365Configuration'],{'as':_0x1da9('0x1d1'),'onDelete':'cascade','foreignKey':'AccountId'});db['Dynamics365Configuration'][_0x1da9('0x12c')](db[_0x1da9('0xc6')],{'as':'Subjects','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1c9')});db['Dynamics365Configuration'][_0x1da9('0x12c')](db['Dynamics365Field'],{'as':_0x1da9('0x1ca'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1cd')});db['Dynamics365Configuration'][_0x1da9('0x12c')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1cb')});db[_0x1da9('0x1d9')][_0x1da9('0x135')](db[_0x1da9('0xc4')],{'as':_0x1da9('0x183'),'foreignKey':_0x1da9('0x1c7')});db[_0x1da9('0xc6')]['hasMany'](db[_0x1da9('0xc6')],{'as':_0x1da9('0x1d3'),'foreignKey':_0x1da9('0x1c9')});db[_0x1da9('0xc6')]['hasMany'](db[_0x1da9('0xc6')],{'as':_0x1da9('0x1cc'),'foreignKey':_0x1da9('0x1cd')});db[_0x1da9('0xc6')][_0x1da9('0x12c')](db['Dynamics365Field'],{'as':_0x1da9('0x1ce'),'foreignKey':_0x1da9('0x1cb')});db['Dynamics365Field']['belongsTo'](db[_0x1da9('0x1cf')],{'as':_0x1da9('0x1cf'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x19a')],{});db['ChatQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x166')],{'as':_0x1da9('0x178'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':_0x1da9('0x170'),'foreignKey':_0x1da9('0x171')});db[_0x1da9('0xca')][_0x1da9('0x135')](db[_0x1da9('0x63')],{});db[_0x1da9('0xca')][_0x1da9('0x135')](db[_0x1da9('0x65')],{});db[_0x1da9('0xca')][_0x1da9('0x135')](db[_0x1da9('0x13')],{});db['ChatQueueReport'][_0x1da9('0x135')](db['ChatQueue'],{});db[_0x1da9('0xcc')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1da')});db[_0x1da9('0xcc')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x1db')});db[_0x1da9('0xd1')][_0x1da9('0x12c')](db['JscriptyQuestionReport'],{'foreignKey':_0x1da9('0x1dc'),'onDelete':'cascade'});db[_0x1da9('0xd1')][_0x1da9('0x12c')](db[_0x1da9('0xce')],{'foreignKey':'SessionId','onDelete':_0x1da9('0x12a')});db[_0x1da9('0xd3')][_0x1da9('0x135')](db['SmsAccount'],{});db['SmsQueueReport'][_0x1da9('0x135')](db['CmList'],{'as':_0x1da9('0x178'),'foreignKey':'ListId'});db[_0x1da9('0xd3')][_0x1da9('0x135')](db[_0x1da9('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1da9('0xd3')][_0x1da9('0x135')](db[_0x1da9('0x55')],{});db[_0x1da9('0xd3')][_0x1da9('0x135')](db[_0x1da9('0x18d')],{});db[_0x1da9('0xd3')][_0x1da9('0x135')](db[_0x1da9('0x13')],{});db[_0x1da9('0xd3')]['belongsTo'](db[_0x1da9('0x58')],{});db[_0x1da9('0xd8')][_0x1da9('0x12c')](db[_0x1da9('0xd1')],{'foreignKey':_0x1da9('0x1dd')});db['JscriptyProject'][_0x1da9('0x12c')](db[_0x1da9('0xd0')],{'foreignKey':_0x1da9('0x1dd')});db[_0x1da9('0xd8')][_0x1da9('0x12c')](db['JscriptyAnswerReport'],{'foreignKey':_0x1da9('0x1dd')});db['SquareProject']['belongsToMany'](db[_0x1da9('0x13')],{'as':_0x1da9('0x181'),'through':_0x1da9('0x151')});db[_0x1da9('0xe0')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x1de')});db[_0x1da9('0xe0')]['belongsToMany'](db['VoiceQueue'],{'through':_0x1da9('0x165'),'as':_0x1da9('0x1df')});db['Team'][_0x1da9('0x137')](db[_0x1da9('0x17b')],{'through':_0x1da9('0x17c'),'as':_0x1da9('0x1e0')});db[_0x1da9('0xe0')]['belongsToMany'](db['ChatQueue'],{'through':_0x1da9('0x1a4'),'as':_0x1da9('0x142')});db[_0x1da9('0xe0')][_0x1da9('0x137')](db[_0x1da9('0x143')],{'through':_0x1da9('0x1e1'),'as':'FaxQueues'});db[_0x1da9('0xe0')][_0x1da9('0x137')](db[_0x1da9('0x58')],{'through':'team_has_sms_queues','as':_0x1da9('0x1e2')});db[_0x1da9('0xe0')][_0x1da9('0x137')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x1da9('0x145')});db[_0x1da9('0xe3')][_0x1da9('0x12c')](db['CmHopper'],{'as':_0x1da9('0x158'),'foreignKey':_0x1da9('0x1af')});db['Campaign'][_0x1da9('0x12c')](db['CmHopperFinal'],{'as':_0x1da9('0x159'),'foreignKey':_0x1da9('0x1af')});db[_0x1da9('0xe3')][_0x1da9('0x12c')](db[_0x1da9('0x75')],{'as':_0x1da9('0x15a'),'foreignKey':_0x1da9('0x1af')});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':_0x1da9('0x15c'),'foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db[_0x1da9('0x2b')],{'as':_0x1da9('0x2b'),'foreignKey':'TrunkId'});db[_0x1da9('0xe3')][_0x1da9('0x135')](db['Trunk'],{'as':_0x1da9('0x1e3'),'foreignKey':_0x1da9('0x15f')});db[_0x1da9('0xe3')][_0x1da9('0x135')](db[_0x1da9('0x82')],{'as':_0x1da9('0x82'),'foreignKey':_0x1da9('0x160')});db[_0x1da9('0xe3')][_0x1da9('0x135')](db['SquareProject'],{'as':_0x1da9('0x14f'),'foreignKey':'SquareProjectId'});db[_0x1da9('0xe3')][_0x1da9('0x137')](db[_0x1da9('0x166')],{'as':'Lists','through':_0x1da9('0x1e4')});db['Campaign'][_0x1da9('0x137')](db[_0x1da9('0x166')],{'as':_0x1da9('0x167'),'through':_0x1da9('0x1e5')});db[_0x1da9('0xe9')][_0x1da9('0x135')](db[_0x1da9('0x41')],{});db[_0x1da9('0xe9')][_0x1da9('0x135')](db['MailInteraction'],{});db[_0x1da9('0xe9')][_0x1da9('0x135')](db['MailAccount'],{'foreignKey':_0x1da9('0x1e6'),'as':_0x1da9('0x1e7')});db[_0x1da9('0xe9')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'foreignKey':_0x1da9('0x1e8'),'as':_0x1da9('0x1e9')});db[_0x1da9('0xe9')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'foreignKey':_0x1da9('0x1ea'),'as':_0x1da9('0x1eb')});db[_0x1da9('0xe9')][_0x1da9('0x135')](db[_0x1da9('0x17b')],{'foreignKey':_0x1da9('0x1ec'),'as':_0x1da9('0x1ed')});db[_0x1da9('0xe9')][_0x1da9('0x135')](db[_0x1da9('0x3a')],{'foreignKey':_0x1da9('0x1ee'),'as':_0x1da9('0x1ef')});db['ChatTransferReport'][_0x1da9('0x135')](db['ChatMessage'],{});db[_0x1da9('0xeb')][_0x1da9('0x135')](db[_0x1da9('0x63')],{});db[_0x1da9('0xeb')][_0x1da9('0x135')](db[_0x1da9('0x19a')],{'foreignKey':'FromChatWebsiteId','as':_0x1da9('0x1e7')});db[_0x1da9('0xeb')]['belongsTo'](db['User'],{'foreignKey':_0x1da9('0x1e8'),'as':'FromAgent'});db[_0x1da9('0xeb')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'foreignKey':_0x1da9('0x1ea'),'as':'ToAgent'});db[_0x1da9('0xeb')][_0x1da9('0x135')](db[_0x1da9('0x141')],{'foreignKey':'ToChatQueueId','as':_0x1da9('0x1ed')});db['ChatTransferReport'][_0x1da9('0x135')](db[_0x1da9('0x19a')],{'foreignKey':_0x1da9('0x1f0'),'as':_0x1da9('0x1ef')});db[_0x1da9('0xed')][_0x1da9('0x135')](db['FaxMessage'],{});db[_0x1da9('0xed')]['belongsTo'](db[_0x1da9('0x4c')],{});db[_0x1da9('0xed')]['belongsTo'](db[_0x1da9('0x49')],{'foreignKey':_0x1da9('0x1f1'),'as':_0x1da9('0x1e7')});db['FaxTransferReport']['belongsTo'](db[_0x1da9('0x13')],{'foreignKey':_0x1da9('0x1e8'),'as':_0x1da9('0x1e9')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x1da9('0x1ea'),'as':_0x1da9('0x1eb')});db['FaxTransferReport']['belongsTo'](db[_0x1da9('0x143')],{'foreignKey':'ToFaxQueueId','as':_0x1da9('0x1ed')});db[_0x1da9('0xed')][_0x1da9('0x135')](db[_0x1da9('0x49')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x1da9('0xef')][_0x1da9('0x135')](db[_0x1da9('0x196')],{});db[_0x1da9('0xef')]['belongsTo'](db[_0x1da9('0x12f')],{});db[_0x1da9('0xef')][_0x1da9('0x135')](db[_0x1da9('0x5a')],{'foreignKey':_0x1da9('0x1f2'),'as':_0x1da9('0x1e7')});db['OpenchannelTransferReport'][_0x1da9('0x135')](db[_0x1da9('0x13')],{'foreignKey':'FromUserId','as':_0x1da9('0x1e9')});db[_0x1da9('0xef')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'foreignKey':_0x1da9('0x1ea'),'as':_0x1da9('0x1eb')});db[_0x1da9('0xef')][_0x1da9('0x135')](db['OpenchannelQueue'],{'foreignKey':_0x1da9('0x1f3'),'as':_0x1da9('0x1ed')});db['OpenchannelTransferReport'][_0x1da9('0x135')](db[_0x1da9('0x5a')],{'foreignKey':_0x1da9('0x1f4'),'as':_0x1da9('0x1ef')});db['SmsTransferReport'][_0x1da9('0x135')](db[_0x1da9('0x18d')],{});db['SmsTransferReport']['belongsTo'](db[_0x1da9('0x55')],{});db['SmsTransferReport'][_0x1da9('0x135')](db[_0x1da9('0x51')],{'foreignKey':_0x1da9('0x1f5'),'as':_0x1da9('0x1e7')});db['SmsTransferReport'][_0x1da9('0x135')](db['User'],{'foreignKey':'FromUserId','as':_0x1da9('0x1e9')});db[_0x1da9('0xf1')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'foreignKey':_0x1da9('0x1ea'),'as':_0x1da9('0x1eb')});db['SmsTransferReport'][_0x1da9('0x135')](db[_0x1da9('0x58')],{'foreignKey':_0x1da9('0x1f6'),'as':_0x1da9('0x1ed')});db[_0x1da9('0xf1')]['belongsTo'](db[_0x1da9('0x51')],{'foreignKey':'ToSmsAccountId','as':_0x1da9('0x1ef')});db[_0x1da9('0x166')][_0x1da9('0x12c')](db[_0x1da9('0x7e')],{'as':_0x1da9('0x176'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x166')][_0x1da9('0x12c')](db['CmCustomField'],{'as':_0x1da9('0x1f7'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x166')][_0x1da9('0x12c')](db['CmContact'],{'as':_0x1da9('0x139'),'onDelete':_0x1da9('0x12a'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x166')]['hasMany'](db[_0x1da9('0x73')],{'as':_0x1da9('0x159'),'foreignKey':'ListId'});db[_0x1da9('0x166')][_0x1da9('0x12c')](db[_0x1da9('0x75')],{'as':_0x1da9('0x12e'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x166')][_0x1da9('0x12c')](db[_0x1da9('0x77')],{'as':_0x1da9('0x77'),'foreignKey':_0x1da9('0x179')});db[_0x1da9('0x166')]['belongsToMany'](db['VoiceQueue'],{'as':_0x1da9('0x1f8'),'through':_0x1da9('0x1f9')});db[_0x1da9('0x166')][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0x1da9('0x1a')],{'as':'Extensions','onDelete':_0x1da9('0x184')});db['VoicePrefix'][_0x1da9('0x137')](db[_0x1da9('0x13')],{'as':_0x1da9('0x163'),'through':_0x1da9('0x147')});db[_0x1da9('0xf6')]['hasMany'](db[_0x1da9('0x13')],{'as':'Users','foreignKey':_0x1da9('0x136')});db[_0x1da9('0xf6')][_0x1da9('0x12c')](db[_0x1da9('0xf7')],{'as':_0x1da9('0x1fa'),'foreignKey':'userProfileId','onDelete':_0x1da9('0x12a')});db[_0x1da9('0xf7')][_0x1da9('0x12c')](db[_0x1da9('0xf9')],{'as':_0x1da9('0x1fb'),'foreignKey':_0x1da9('0x1fc'),'onDelete':_0x1da9('0x12a')});db[_0x1da9('0xfd')][_0x1da9('0x12c')](db[_0x1da9('0x1fd')],{'foreignKey':_0x1da9('0x1fe')});db[_0x1da9('0xfd')][_0x1da9('0x12c')](db[_0x1da9('0x1ff')],{'foreignKey':_0x1da9('0x1fe')});db[_0x1da9('0x1fd')][_0x1da9('0x129')](db[_0x1da9('0x100')],{'foreignKey':_0x1da9('0x200')});db['CrmWorkflowStep'][_0x1da9('0x12c')](db[_0x1da9('0x1ff')],{'foreignKey':_0x1da9('0x200')});db[_0x1da9('0x1fd')]['belongsToMany'](db['CrmWorkflowStep'],{'as':_0x1da9('0x201'),'through':_0x1da9('0x202')});db[_0x1da9('0x100')]['hasMany'](db['CrmActionsList'],{'foreignKey':_0x1da9('0x203')});db['CrmTask']['belongsTo'](db[_0x1da9('0x1fd')],{'foreignKey':_0x1da9('0x200'),'as':_0x1da9('0x1fd')});db[_0x1da9('0x101')][_0x1da9('0x135')](db['CrmTask'],{'foreignKey':'TaskId','as':_0x1da9('0x100')});db[_0x1da9('0x102')][_0x1da9('0x12c')](db[_0x1da9('0x107')],{'foreignKey':_0x1da9('0x204')});db[_0x1da9('0x104')][_0x1da9('0x12c')](db[_0x1da9('0x107')],{'foreignKey':'UnitMeasureId'});db[_0x1da9('0x107')][_0x1da9('0x12c')](db[_0x1da9('0x205')],{'foreignKey':_0x1da9('0x206')});db['SAProduct'][_0x1da9('0x135')](db['SASalesCondition'],{'as':_0x1da9('0x207'),'foreignKey':_0x1da9('0x208')});db[_0x1da9('0x107')][_0x1da9('0x135')](db['SAUnitMeasure'],{'as':_0x1da9('0x209'),'foreignKey':_0x1da9('0x20a')});db[_0x1da9('0x107')][_0x1da9('0x135')](db[_0x1da9('0x102')],{'as':_0x1da9('0x20b'),'foreignKey':'TypeProductId'});db[_0x1da9('0x108')][_0x1da9('0x12c')](db['SAProduct'],{'foreignKey':'TypeSalesConditionId'});db[_0x1da9('0x10a')]['hasMany'](db[_0x1da9('0x205')],{'foreignKey':_0x1da9('0x20c')});db[_0x1da9('0x205')][_0x1da9('0x12c')](db[_0x1da9('0x20d')],{'as':_0x1da9('0x20e'),'foreignKey':_0x1da9('0x20f')});db[_0x1da9('0x205')][_0x1da9('0x135')](db['SAProduct'],{'as':_0x1da9('0x210'),'foreignKey':_0x1da9('0x206')});db[_0x1da9('0x205')][_0x1da9('0x135')](db[_0x1da9('0x10a')],{'as':_0x1da9('0x211'),'foreignKey':_0x1da9('0x20c')});db[_0x1da9('0x1ff')][_0x1da9('0x12c')](db['SARequest'],{'as':_0x1da9('0x1aa'),'foreignKey':_0x1da9('0x212')});db[_0x1da9('0x1ff')]['hasMany'](db[_0x1da9('0x10e')],{'as':_0x1da9('0x1aa'),'foreignKey':_0x1da9('0x212')});db['SADossier'][_0x1da9('0x12c')](db['SAOrder'],{'as':'Dossiers','foreignKey':'DossierId'});db[_0x1da9('0x1ff')][_0x1da9('0x12c')](db[_0x1da9('0x113')],{'as':_0x1da9('0x1aa'),'foreignKey':_0x1da9('0x212')});db[_0x1da9('0x1ff')]['belongsTo'](db[_0x1da9('0x6d')],{'as':_0x1da9('0x1ad'),'foreignKey':_0x1da9('0x1a8')});db[_0x1da9('0x1ff')][_0x1da9('0x135')](db['CmContact'],{'as':'Contact','foreignKey':_0x1da9('0x171')});db[_0x1da9('0x1ff')]['belongsTo'](db[_0x1da9('0xfd')],{'as':_0x1da9('0x213'),'foreignKey':_0x1da9('0x1fe')});db[_0x1da9('0x1ff')][_0x1da9('0x135')](db[_0x1da9('0x1fd')],{'as':_0x1da9('0x214'),'foreignKey':_0x1da9('0x200')});db[_0x1da9('0x1ff')][_0x1da9('0x135')](db[_0x1da9('0x13')],{'as':'User','foreignKey':_0x1da9('0x12b')});db['SARequest'][_0x1da9('0x12c')](db[_0x1da9('0x10e')],{'as':'Requests','foreignKey':_0x1da9('0x215')});db['SARequest'][_0x1da9('0x12c')](db[_0x1da9('0x111')],{'as':_0x1da9('0x216'),'foreignKey':_0x1da9('0x215')});db[_0x1da9('0x217')][_0x1da9('0x12c')](db['SAProforma'],{'as':_0x1da9('0x216'),'foreignKey':_0x1da9('0x215')});db[_0x1da9('0x217')][_0x1da9('0x135')](db['SADossier'],{'as':_0x1da9('0x218'),'foreignKey':_0x1da9('0x212')});db[_0x1da9('0x10e')][_0x1da9('0x12c')](db[_0x1da9('0x20d')],{'as':_0x1da9('0x219'),'foreignKey':'QuotationId'});db['SAQuotation']['hasMany'](db[_0x1da9('0x111')],{'as':_0x1da9('0x219'),'foreignKey':_0x1da9('0x21a')});db['SAQuotation'][_0x1da9('0x12c')](db[_0x1da9('0x113')],{'as':_0x1da9('0x219'),'foreignKey':_0x1da9('0x21a')});db[_0x1da9('0x10e')][_0x1da9('0x135')](db[_0x1da9('0x1ff')],{'as':_0x1da9('0x218'),'foreignKey':_0x1da9('0x212')});db[_0x1da9('0x10e')]['belongsTo'](db[_0x1da9('0x217')],{'as':_0x1da9('0x21b'),'foreignKey':_0x1da9('0x215')});db[_0x1da9('0x20d')]['belongsTo'](db[_0x1da9('0x205')],{'as':'ProductPricesList','foreignKey':_0x1da9('0x20f')});db['SAProductQuotation'][_0x1da9('0x135')](db[_0x1da9('0x10e')],{'as':_0x1da9('0x21c'),'foreignKey':'QuotationId'});db['SAProductQuotation']['belongsTo'](db['SAProforma'],{'as':'Proforma','foreignKey':_0x1da9('0x21d')});db['SAProductQuotation'][_0x1da9('0x135')](db[_0x1da9('0x21e')],{'as':_0x1da9('0x21f'),'foreignKey':'InvoiceId'});db[_0x1da9('0x111')]['hasMany'](db[_0x1da9('0x113')],{'as':_0x1da9('0x220'),'foreignKey':_0x1da9('0x221')});db[_0x1da9('0x111')][_0x1da9('0x135')](db['SADossier'],{'as':_0x1da9('0x218'),'foreignKey':_0x1da9('0x212')});db['SAOrder']['belongsTo'](db[_0x1da9('0x217')],{'as':_0x1da9('0x21b'),'foreignKey':_0x1da9('0x215')});db[_0x1da9('0x111')][_0x1da9('0x135')](db['SAQuotation'],{'as':'Quotation','foreignKey':_0x1da9('0x21a')});db[_0x1da9('0x113')][_0x1da9('0x12c')](db[_0x1da9('0x21e')],{'as':'Proforma','foreignKey':_0x1da9('0x21d')});db['SAProforma']['hasMany'](db[_0x1da9('0x20d')],{'as':_0x1da9('0x222'),'foreignKey':_0x1da9('0x21d')});db[_0x1da9('0x113')]['hasMany'](db[_0x1da9('0x223')],{'as':_0x1da9('0x222'),'foreignKey':'ProformaId'});db[_0x1da9('0x113')][_0x1da9('0x12c')](db[_0x1da9('0x11a')],{'as':_0x1da9('0x222'),'foreignKey':_0x1da9('0x21d')});db['SAProforma']['belongsTo'](db[_0x1da9('0x1ff')],{'as':_0x1da9('0x218'),'foreignKey':'DossierId'});db['SAProforma'][_0x1da9('0x135')](db[_0x1da9('0x217')],{'as':_0x1da9('0x21b'),'foreignKey':_0x1da9('0x215')});db[_0x1da9('0x113')][_0x1da9('0x135')](db[_0x1da9('0x10e')],{'as':_0x1da9('0x21c'),'foreignKey':'QuotationId'});db[_0x1da9('0x113')][_0x1da9('0x135')](db[_0x1da9('0x111')],{'as':_0x1da9('0x224'),'foreignKey':_0x1da9('0x221')});db[_0x1da9('0x21e')][_0x1da9('0x12c')](db[_0x1da9('0x20d')],{'as':_0x1da9('0x219'),'foreignKey':_0x1da9('0x225')});db['SAInvoice'][_0x1da9('0x12c')](db[_0x1da9('0x117')],{'as':_0x1da9('0x226'),'foreignKey':_0x1da9('0x225')});db[_0x1da9('0x21e')][_0x1da9('0x12c')](db[_0x1da9('0x11a')],{'as':'Payments','foreignKey':_0x1da9('0x225')});db[_0x1da9('0x21e')][_0x1da9('0x135')](db[_0x1da9('0x1ff')],{'as':'Dossier','foreignKey':_0x1da9('0x212')});db[_0x1da9('0x21e')]['belongsTo'](db['SARequest'],{'as':'Request','foreignKey':_0x1da9('0x215')});db[_0x1da9('0x21e')]['belongsTo'](db[_0x1da9('0x10e')],{'as':'Quotation','foreignKey':'QuotationId'});db[_0x1da9('0x21e')]['belongsTo'](db[_0x1da9('0x111')],{'as':_0x1da9('0x224'),'foreignKey':_0x1da9('0x221')});db[_0x1da9('0x117')][_0x1da9('0x135')](db['SAInvoice'],{'as':'Invoice','foreignKey':_0x1da9('0x225')});db[_0x1da9('0x223')][_0x1da9('0x135')](db[_0x1da9('0x113')],{'as':_0x1da9('0x222'),'foreignKey':_0x1da9('0x21d')});db[_0x1da9('0x11a')][_0x1da9('0x135')](db[_0x1da9('0x21e')],{'as':_0x1da9('0x21f'),'foreignKey':'InvoiceId'});db[_0x1da9('0x11a')][_0x1da9('0x135')](db[_0x1da9('0x113')],{'as':_0x1da9('0x222'),'foreignKey':_0x1da9('0x21d')});db[_0x1da9('0x11c')][_0x1da9('0x12c')](db[_0x1da9('0x6d')],{'as':'Companies','foreignKey':_0x1da9('0x1ac')});db[_0x1da9('0x11f')][_0x1da9('0x135')](db[_0x1da9('0x11d')],{'as':_0x1da9('0x227'),'foreignKey':_0x1da9('0x228')});db['SACompanyType'][_0x1da9('0x12c')](db[_0x1da9('0x6d')],{'as':'CompanyType','foreignKey':'saCompanyType'});db[_0x1da9('0x127')][_0x1da9('0x12c')](db['CmCompany'],{'as':_0x1da9('0x229'),'foreignKey':_0x1da9('0x22a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3900e20..a713539 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa9f=['/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/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/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/crm/nations','./api/crmNation','./api/crmWorkflow','/api/crm/workflowsteps','./api/crmWorkflowstep','/api/crm/tasks','./api/crmTask','/api/crm/actionslists','./api/crmActionsList','/api/sa/typeproducts','./api/saTypeProduct','/api/sa/unitmeasures','./api/saUnitMeasure','/api/sa/invoicelaws','./api/saInvoiceLaw','/api/sa/products','./api/saProduct','./api/saSalesCondition','/api/sa/pricelists','./api/saPriceList','/api/sa/productpriceslists','./api/saProductPricesList','/api/sa/dossiers','./api/saDossier','/api/sa/requests','./api/saRequest','/api/sa/quotations','./api/saProductQuotation','/api/sa/orders','./api/saOrder','./api/saProforma','/api/sa/invoices','./api/saInvoice','/api/sa/assets','./api/saAsset','/api/sa/invoice_details','./api/saInvoiceDetail','/api/sa/proforma_details','/api/sa/payments','/api/sa/paymentMethods','./api/saPaymentMethod','/api/sa/creditNotes','./api/saCreditNoteDetail','/api/sa/invoice_numberss','./api/saCreditNoteNumber','./api/saCompanyType','/api/sa/company_relationshipes','./api/saCompanyRelationship','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','join','root','/www','static','/snippet','snippet','1.0.14','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','resolve','appPath','path','express','express-winston','util','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','responseTime','user','name','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','statusCode','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xfa9f,0x109));var _0xffa9=function(_0x1a48a0,_0x3c95f5){_0x1a48a0=_0x1a48a0-0x0;var _0x269714=_0xfa9f[_0x1a48a0];return _0x269714;};'use strict';var path=require(_0xffa9('0x0'));var express=require(_0xffa9('0x1'));var ewinston=require(_0xffa9('0x2'));var util=require(_0xffa9('0x3'));var errors=require('./errors');var config=require(_0xffa9('0x4'));var logger=require(_0xffa9('0x5'))(_0xffa9('0x6'));var authLogger=require(_0xffa9('0x5'))(_0xffa9('0x7'));exports[_0xffa9('0x8')]=function(_0x3cb336){_0x3cb336[_0xffa9('0x9')](ewinston[_0xffa9('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5cb132,_0x21588f){return util[_0xffa9('0xb')](_0xffa9('0xc'),_0x5cb132[_0xffa9('0xd')],_0x5cb132[_0xffa9('0xe')]['x-forwarded-for']?_0x5cb132[_0xffa9('0xe')][_0xffa9('0xf')]:_0x5cb132[_0xffa9('0x10')][_0xffa9('0x11')]||_0x5cb132['ip'],_0x5cb132['url'],_0x21588f['statusCode'],_0x21588f[_0xffa9('0x12')],_0x5cb132[_0xffa9('0x13')]?_0x5cb132['user']['id']:null,_0x5cb132[_0xffa9('0x13')]?_0x5cb132[_0xffa9('0x13')][_0xffa9('0x14')]:null,_0x5cb132[_0xffa9('0x13')]?_0x5cb132[_0xffa9('0x13')][_0xffa9('0x15')]:null);}}));_0x3cb336[_0xffa9('0x9')](ewinston[_0xffa9('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5932b4,_0x25ff5b){var _0x37d6cf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5932b4[_0xffa9('0x16')]&&_0x5932b4[_0xffa9('0x16')][_0xffa9('0x17')]&&_0x5932b4[_0xffa9('0x16')][_0xffa9('0x18')]){_0x37d6cf=_0xffa9('0x19');}return util[_0xffa9('0xb')](_0x37d6cf,_0x5932b4[_0xffa9('0xd')],_0x5932b4[_0xffa9('0xe')][_0xffa9('0xf')]?_0x5932b4[_0xffa9('0xe')][_0xffa9('0xf')]:_0x5932b4['connection'][_0xffa9('0x11')]||_0x5932b4['ip'],_0x5932b4[_0xffa9('0x1a')],_0x25ff5b[_0xffa9('0x1b')],_0x25ff5b[_0xffa9('0x12')],_0x5932b4['user']?_0x5932b4['user']['id']:null,_0x5932b4[_0xffa9('0x13')]?_0x5932b4[_0xffa9('0x13')][_0xffa9('0x14')]:null,_0x5932b4[_0xffa9('0x13')]?_0x5932b4[_0xffa9('0x13')][_0xffa9('0x15')]:null,_0x5932b4[_0xffa9('0x16')]&&_0x5932b4[_0xffa9('0x16')][_0xffa9('0x17')]?_0x5932b4[_0xffa9('0x16')][_0xffa9('0x17')]:'other',_0x5932b4[_0xffa9('0x16')]&&_0x5932b4['body'][_0xffa9('0x18')]?_0x5932b4[_0xffa9('0x16')][_0xffa9('0x18')]:'',_0x5932b4['body']&&_0x5932b4[_0xffa9('0x16')][_0xffa9('0x1c')]?_0x5932b4[_0xffa9('0x16')][_0xffa9('0x1c')]:'');},'ignoreRoute':function(_0x5b7d77){var _0x3d8459=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3d8459[_0xffa9('0x1d')](_0x5b7d77[_0xffa9('0x1a')]);}}));_0x3cb336[_0xffa9('0x9')]('/api/users',require('./api/user'));_0x3cb336['use'](_0xffa9('0x1e'),require(_0xffa9('0x1f')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x20'),require(_0xffa9('0x21')));_0x3cb336['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x22'),require(_0xffa9('0x23')));_0x3cb336[_0xffa9('0x9')]('/api/voice/queues',require(_0xffa9('0x24')));_0x3cb336[_0xffa9('0x9')]('/api/voice/recordings',require(_0xffa9('0x25')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x26'),require(_0xffa9('0x27')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x28'),require(_0xffa9('0x29')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x2a'),require(_0xffa9('0x2b')));_0x3cb336['use'](_0xffa9('0x2c'),require(_0xffa9('0x2d')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x2e'),require(_0xffa9('0x2f')));_0x3cb336[_0xffa9('0x9')]('/api/voice/agents/reports',require(_0xffa9('0x30')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x31'),require(_0xffa9('0x32')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x33'),require(_0xffa9('0x34')));_0x3cb336[_0xffa9('0x9')]('/api/trunks',require(_0xffa9('0x35')));_0x3cb336['use'](_0xffa9('0x36'),require('./api/voiceTransferReport'));_0x3cb336[_0xffa9('0x9')]('/api/mail/out_servers',require(_0xffa9('0x37')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x38'),require(_0xffa9('0x39')));_0x3cb336[_0xffa9('0x9')]('/api/mail/queues',require(_0xffa9('0x3a')));_0x3cb336['use']('/api/mail/substatuses',require(_0xffa9('0x3b')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x3c'),require(_0xffa9('0x3d')));_0x3cb336[_0xffa9('0x9')]('/api/mail/messages',require('./api/mailMessage'));_0x3cb336[_0xffa9('0x9')]('/api/mail/applications',require(_0xffa9('0x3e')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x3f'),require('./api/mailQueueReport'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x40'),require(_0xffa9('0x41')));_0x3cb336['use'](_0xffa9('0x42'),require(_0xffa9('0x43')));_0x3cb336['use'](_0xffa9('0x44'),require(_0xffa9('0x45')));_0x3cb336[_0xffa9('0x9')]('/api/fax/applications',require(_0xffa9('0x46')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x47'),require('./api/faxInteraction'));_0x3cb336[_0xffa9('0x9')]('/api/fax/messages',require('./api/faxMessage'));_0x3cb336[_0xffa9('0x9')]('/api/fax/queues',require(_0xffa9('0x48')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x49'),require(_0xffa9('0x4a')));_0x3cb336[_0xffa9('0x9')]('/api/sms/accounts',require('./api/smsAccount'));_0x3cb336['use']('/api/sms/applications',require('./api/smsApplication'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x4b'),require(_0xffa9('0x4c')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x4d'),require('./api/smsMessage'));_0x3cb336[_0xffa9('0x9')]('/api/sms/queues',require(_0xffa9('0x4e')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x4f'),require('./api/openchannelAccount'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x50'),require(_0xffa9('0x51')));_0x3cb336[_0xffa9('0x9')]('/api/openchannel/interactions',require(_0xffa9('0x52')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x53'),require(_0xffa9('0x54')));_0x3cb336['use']('/api/openchannel/queues',require(_0xffa9('0x55')));_0x3cb336['use'](_0xffa9('0x56'),require(_0xffa9('0x57')));_0x3cb336['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x58'),require(_0xffa9('0x59')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x5a'),require(_0xffa9('0x5b')));_0x3cb336['use'](_0xffa9('0x5c'),require(_0xffa9('0x5d')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x5e'),require(_0xffa9('0x5f')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x60'),require(_0xffa9('0x61')));_0x3cb336[_0xffa9('0x9')]('/api/chat/groups',require(_0xffa9('0x62')));_0x3cb336[_0xffa9('0x9')]('/api/chat/proactive_actions',require(_0xffa9('0x63')));_0x3cb336[_0xffa9('0x9')]('/api/cm/companies',require(_0xffa9('0x64')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x65'),require(_0xffa9('0x66')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x67'),require(_0xffa9('0x68')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x69'),require(_0xffa9('0x6a')));_0x3cb336[_0xffa9('0x9')]('/api/cm/hopper_final',require(_0xffa9('0x6b')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x6c'),require('./api/cmHopperHistory'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x6d'),require(_0xffa9('0x6e')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x6f'),require(_0xffa9('0x70')));_0x3cb336['use'](_0xffa9('0x71'),require('./api/automation'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x72'),require(_0xffa9('0x73')));_0x3cb336['use'](_0xffa9('0x74'),require(_0xffa9('0x75')));_0x3cb336[_0xffa9('0x9')]('/api/conditions',require(_0xffa9('0x76')));_0x3cb336['use'](_0xffa9('0x77'),require(_0xffa9('0x78')));_0x3cb336[_0xffa9('0x9')]('/api/pauses',require('./api/pause'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x79'),require('./api/cdr'));_0x3cb336['use'](_0xffa9('0x7a'),require('./api/voiceQueuesLog'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x7b'),require(_0xffa9('0x7c')));_0x3cb336[_0xffa9('0x9')]('/api/sounds',require(_0xffa9('0x7d')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x7e'),require(_0xffa9('0x7f')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x80'),require(_0xffa9('0x81')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x82'),require('./api/trigger'));_0x3cb336[_0xffa9('0x9')]('/api/variables',require('./api/variable'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x83'),require('./api/integration'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x84'),require(_0xffa9('0x85')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x86'),require('./api/analyticCustomReport'));_0x3cb336[_0xffa9('0x9')]('/api/analytics/default_reports',require(_0xffa9('0x87')));_0x3cb336['use'](_0xffa9('0x88'),require(_0xffa9('0x89')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x8a'),require(_0xffa9('0x8b')));_0x3cb336['use'](_0xffa9('0x8c'),require('./api/analyticFieldReport'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x8d'),require(_0xffa9('0x8e')));_0x3cb336[_0xffa9('0x9')]('/api/integrations/salesforce/accounts',require(_0xffa9('0x8f')));_0x3cb336['use'](_0xffa9('0x90'),require('./api/intSalesforceConfiguration'));_0x3cb336['use'](_0xffa9('0x91'),require('./api/intSalesforceField'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x92'),require(_0xffa9('0x93')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x94'),require(_0xffa9('0x95')));_0x3cb336[_0xffa9('0x9')]('/api/integrations/sugarcrm/fields',require(_0xffa9('0x96')));_0x3cb336['use'](_0xffa9('0x97'),require('./api/intDeskAccount'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x98'),require(_0xffa9('0x99')));_0x3cb336['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x9a'),require(_0xffa9('0x9b')));_0x3cb336['use'](_0xffa9('0x9c'),require(_0xffa9('0x9d')));_0x3cb336[_0xffa9('0x9')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x9e'),require(_0xffa9('0x9f')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xa0'),require(_0xffa9('0xa1')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xa2'),require(_0xffa9('0xa3')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xa4'),require(_0xffa9('0xa5')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xa6'),require(_0xffa9('0xa7')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xa8'),require(_0xffa9('0xa9')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xaa'),require(_0xffa9('0xab')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xac'),require('./api/intVtigerConfiguration'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xad'),require(_0xffa9('0xae')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xaf'),require(_0xffa9('0xb0')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xb1'),require(_0xffa9('0xb2')));_0x3cb336['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xb3'),require('./api/intDynamics365Account'));_0x3cb336[_0xffa9('0x9')]('/api/integrations/dynamics365/configurations',require(_0xffa9('0xb4')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xb5'),require(_0xffa9('0xb6')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xb7'),require('./api/network'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xb8'),require(_0xffa9('0xb9')));_0x3cb336[_0xffa9('0x9')]('/api/chat/internal/messages',require(_0xffa9('0xba')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xbb'),require(_0xffa9('0xbc')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xbd'),require(_0xffa9('0xbe')));_0x3cb336[_0xffa9('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x3cb336['use']('/api/sms/reports/queue',require(_0xffa9('0xbf')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xc0'),require(_0xffa9('0xc1')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xc2'),require(_0xffa9('0xc3')));_0x3cb336[_0xffa9('0x9')]('/api/jscripty/projects',require(_0xffa9('0xc4')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xc5'),require(_0xffa9('0xc6')));_0x3cb336[_0xffa9('0x9')]('/api/square/odbc',require(_0xffa9('0xc7')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xc8'),require(_0xffa9('0xc9')));_0x3cb336['use'](_0xffa9('0xca'),require(_0xffa9('0xcb')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xcc'),require('./api/squareMessage'));_0x3cb336['use']('/api/teams',require('./api/team'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xcd'),require(_0xffa9('0xce')));_0x3cb336['use'](_0xffa9('0xcf'),require(_0xffa9('0xd0')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xd1'),require(_0xffa9('0xd2')));_0x3cb336[_0xffa9('0x9')]('/api/attachments',require(_0xffa9('0xd3')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xd4'),require(_0xffa9('0xd5')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xd6'),require('./api/mailTransferReport'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xd7'),require(_0xffa9('0xd8')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xd9'),require(_0xffa9('0xda')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xdb'),require(_0xffa9('0xdc')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xdd'),require(_0xffa9('0xde')));_0x3cb336[_0xffa9('0x9')]('/api/cm/lists',require('./api/cmList'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xdf'),require(_0xffa9('0xe0')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xe1'),require(_0xffa9('0xe2')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xe3'),require('./api/userProfileSection'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xe4'),require(_0xffa9('0xe5')));_0x3cb336['use'](_0xffa9('0xe6'),require(_0xffa9('0xe7')));_0x3cb336[_0xffa9('0x9')]('/api/crm/workflows',require(_0xffa9('0xe8')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xe9'),require(_0xffa9('0xea')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xeb'),require(_0xffa9('0xec')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xed'),require(_0xffa9('0xee')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xef'),require(_0xffa9('0xf0')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xf1'),require(_0xffa9('0xf2')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xf3'),require(_0xffa9('0xf4')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xf5'),require(_0xffa9('0xf6')));_0x3cb336[_0xffa9('0x9')]('/api/sa/salescondions',require(_0xffa9('0xf7')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xf8'),require(_0xffa9('0xf9')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xfa'),require(_0xffa9('0xfb')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xfc'),require(_0xffa9('0xfd')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0xfe'),require(_0xffa9('0xff')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x100'),require('./api/saQuotation'));_0x3cb336['use']('/api/sa/productquotations',require(_0xffa9('0x101')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x102'),require(_0xffa9('0x103')));_0x3cb336[_0xffa9('0x9')]('/api/sa/proformas',require(_0xffa9('0x104')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x105'),require(_0xffa9('0x106')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x107'),require(_0xffa9('0x108')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x109'),require(_0xffa9('0x10a')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x10b'),require('./api/saProformaDetail'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x10c'),require('./api/saPayment'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x10d'),require(_0xffa9('0x10e')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x10f'),require('./api/saCreditNote'));_0x3cb336[_0xffa9('0x9')]('/api/sa/creditNote_details',require(_0xffa9('0x110')));_0x3cb336['use'](_0xffa9('0x111'),require('./api/saInvoiceNumber'));_0x3cb336[_0xffa9('0x9')]('/api/sa/creditNote_numberss',require(_0xffa9('0x112')));_0x3cb336[_0xffa9('0x9')]('/api/sa/company_types',require(_0xffa9('0x113')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x114'),require(_0xffa9('0x115')));_0x3cb336[_0xffa9('0x9')]('/api/auth/local',require('./api/authLocal'));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x116'),require(_0xffa9('0x117')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x118'),require('./api/jira'));_0x3cb336['use'](_0xffa9('0x119'),require(_0xffa9('0x11a')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x11b'),require(_0xffa9('0x11c')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x11d'),require(_0xffa9('0x11e')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x11f'),require(_0xffa9('0x120')));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x121'),express['static'](path[_0xffa9('0x122')](config[_0xffa9('0x123')],_0xffa9('0x121'))));_0x3cb336[_0xffa9('0x9')](_0xffa9('0x124'),express[_0xffa9('0x125')](path[_0xffa9('0x122')](config[_0xffa9('0x123')],_0xffa9('0x124'))));_0x3cb336[_0xffa9('0x9')]('/demo',express[_0xffa9('0x125')](path[_0xffa9('0x122')](config[_0xffa9('0x123')],'/demo')));_0x3cb336['use'](_0xffa9('0x126'),express[_0xffa9('0x125')](path[_0xffa9('0x122')](config[_0xffa9('0x123')],_0xffa9('0x127'),_0xffa9('0x128'))));_0x3cb336['use'](_0xffa9('0x129'),express['static'](path[_0xffa9('0x122')](config[_0xffa9('0x123')],_0xffa9('0x12a'))));_0x3cb336['route'](_0xffa9('0x12b'))['get'](errors[0x194]);_0x3cb336[_0xffa9('0x12c')]('/*')[_0xffa9('0x12d')](function(_0x1b5204,_0x4e0cbb){_0x4e0cbb[_0xffa9('0x12e')](path[_0xffa9('0x12f')](_0x3cb336[_0xffa9('0x12d')](_0xffa9('0x130'))+'/index.html'));});}; \ No newline at end of file +var _0xf933=['/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/campaign','/api/migrations','./api/migration','./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/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/crm/nations','./api/crmNation','/api/crm/workflows','./api/crmWorkflow','/api/crm/workflowsteps','./api/crmWorkflowstep','/api/crm/tasks','./api/crmTask','/api/crm/actionslists','./api/crmActionsList','./api/saTypeProduct','/api/sa/unitmeasures','./api/saUnitMeasure','./api/saInvoiceLaw','./api/saProduct','/api/sa/salescondions','./api/saSalesCondition','/api/sa/pricelists','/api/sa/productpriceslists','./api/saDossier','/api/sa/requests','./api/saRequest','/api/sa/quotations','./api/saQuotation','/api/sa/productquotations','./api/saProductQuotation','/api/sa/orders','./api/saOrder','/api/sa/proformas','./api/saProforma','./api/saInvoice','/api/sa/assets','./api/saAsset','./api/saInvoiceDetail','./api/saProformaDetail','/api/sa/payments','./api/saPayment','/api/sa/paymentMethods','./api/saPaymentMethod','/api/sa/creditNotes','./api/saCreditNote','/api/sa/creditNote_details','./api/saCreditNoteDetail','/api/sa/invoice_numberss','./api/saInvoiceNumber','/api/sa/creditNote_numberss','./api/saCreditNoteNumber','/api/sa/company_types','./api/saCompanyType','/api/sa/company_relationshipes','./api/saCompanyRelationship','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.14','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','path','express','express-winston','util','./errors','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_name','test','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./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/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xf933,0x80));var _0x3f93=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xf933[_0x5ef905];return _0x367808;};'use strict';var path=require(_0x3f93('0x0'));var express=require(_0x3f93('0x1'));var ewinston=require(_0x3f93('0x2'));var util=require(_0x3f93('0x3'));var errors=require(_0x3f93('0x4'));var config=require('./config/environment');var logger=require(_0x3f93('0x5'))(_0x3f93('0x6'));var authLogger=require(_0x3f93('0x5'))(_0x3f93('0x7'));exports[_0x3f93('0x8')]=function(_0x46b6dd){_0x46b6dd['use'](ewinston[_0x3f93('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x231710,_0x257c92){return util['format'](_0x3f93('0xa'),_0x231710[_0x3f93('0xb')],_0x231710[_0x3f93('0xc')][_0x3f93('0xd')]?_0x231710[_0x3f93('0xc')][_0x3f93('0xd')]:_0x231710[_0x3f93('0xe')][_0x3f93('0xf')]||_0x231710['ip'],_0x231710[_0x3f93('0x10')],_0x257c92[_0x3f93('0x11')],_0x257c92[_0x3f93('0x12')],_0x231710[_0x3f93('0x13')]?_0x231710[_0x3f93('0x13')]['id']:null,_0x231710[_0x3f93('0x13')]?_0x231710[_0x3f93('0x13')][_0x3f93('0x14')]:null,_0x231710[_0x3f93('0x13')]?_0x231710[_0x3f93('0x13')][_0x3f93('0x15')]:null);}}));_0x46b6dd[_0x3f93('0x16')](ewinston[_0x3f93('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5362c4,_0x5bd310){var _0x83c0fa=_0x3f93('0x17');if(_0x5362c4[_0x3f93('0x18')]&&_0x5362c4[_0x3f93('0x18')][_0x3f93('0x19')]&&_0x5362c4[_0x3f93('0x18')][_0x3f93('0x1a')]){_0x83c0fa=_0x3f93('0x1b');}return util[_0x3f93('0x1c')](_0x83c0fa,_0x5362c4[_0x3f93('0xb')],_0x5362c4['headers'][_0x3f93('0xd')]?_0x5362c4['headers'][_0x3f93('0xd')]:_0x5362c4[_0x3f93('0xe')][_0x3f93('0xf')]||_0x5362c4['ip'],_0x5362c4[_0x3f93('0x10')],_0x5bd310[_0x3f93('0x11')],_0x5bd310['responseTime'],_0x5362c4[_0x3f93('0x13')]?_0x5362c4[_0x3f93('0x13')]['id']:null,_0x5362c4[_0x3f93('0x13')]?_0x5362c4[_0x3f93('0x13')][_0x3f93('0x14')]:null,_0x5362c4[_0x3f93('0x13')]?_0x5362c4[_0x3f93('0x13')][_0x3f93('0x15')]:null,_0x5362c4[_0x3f93('0x18')]&&_0x5362c4[_0x3f93('0x18')][_0x3f93('0x19')]?_0x5362c4[_0x3f93('0x18')]['device']:_0x3f93('0x1d'),_0x5362c4[_0x3f93('0x18')]&&_0x5362c4[_0x3f93('0x18')]['agent_id']?_0x5362c4[_0x3f93('0x18')][_0x3f93('0x1a')]:'',_0x5362c4[_0x3f93('0x18')]&&_0x5362c4['body'][_0x3f93('0x1e')]?_0x5362c4[_0x3f93('0x18')][_0x3f93('0x1e')]:'');},'ignoreRoute':function(_0x15a1dc){var _0x5e5954=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e5954[_0x3f93('0x1f')](_0x15a1dc[_0x3f93('0x10')]);}}));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x20'),require(_0x3f93('0x21')));_0x46b6dd[_0x3f93('0x16')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x46b6dd['use'](_0x3f93('0x22'),require(_0x3f93('0x23')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x24'),require(_0x3f93('0x25')));_0x46b6dd['use']('/api/voice/mohs',require(_0x3f93('0x26')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x27'),require(_0x3f93('0x28')));_0x46b6dd[_0x3f93('0x16')]('/api/voice/recordings',require(_0x3f93('0x29')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x2a'),require(_0x3f93('0x2b')));_0x46b6dd[_0x3f93('0x16')]('/api/voice/mails',require(_0x3f93('0x2c')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x2d'),require('./api/voiceMailMessage'));_0x46b6dd['use'](_0x3f93('0x2e'),require(_0x3f93('0x2f')));_0x46b6dd[_0x3f93('0x16')]('/api/voice/dials/reports',require(_0x3f93('0x30')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x31'),require(_0x3f93('0x32')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x33'),require(_0x3f93('0x34')));_0x46b6dd['use'](_0x3f93('0x35'),require(_0x3f93('0x36')));_0x46b6dd[_0x3f93('0x16')]('/api/trunks',require('./api/trunk'));_0x46b6dd[_0x3f93('0x16')]('/api/voice/transfers/reports',require(_0x3f93('0x37')));_0x46b6dd['use'](_0x3f93('0x38'),require(_0x3f93('0x39')));_0x46b6dd['use'](_0x3f93('0x3a'),require(_0x3f93('0x3b')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x3c'),require(_0x3f93('0x3d')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x3e'),require(_0x3f93('0x3f')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x40'),require(_0x3f93('0x41')));_0x46b6dd['use'](_0x3f93('0x42'),require(_0x3f93('0x43')));_0x46b6dd['use'](_0x3f93('0x44'),require(_0x3f93('0x45')));_0x46b6dd['use'](_0x3f93('0x46'),require(_0x3f93('0x47')));_0x46b6dd[_0x3f93('0x16')]('/api/dashboards',require(_0x3f93('0x48')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x49'),require(_0x3f93('0x4a')));_0x46b6dd['use'](_0x3f93('0x4b'),require('./api/faxAccount'));_0x46b6dd[_0x3f93('0x16')]('/api/fax/applications',require(_0x3f93('0x4c')));_0x46b6dd['use'](_0x3f93('0x4d'),require(_0x3f93('0x4e')));_0x46b6dd[_0x3f93('0x16')]('/api/fax/messages',require('./api/faxMessage'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x4f'),require(_0x3f93('0x50')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x51'),require('./api/faxQueueReport'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x52'),require(_0x3f93('0x53')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x54'),require(_0x3f93('0x55')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x56'),require('./api/smsInteraction'));_0x46b6dd[_0x3f93('0x16')]('/api/sms/messages',require(_0x3f93('0x57')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x58'),require(_0x3f93('0x59')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x5a'),require(_0x3f93('0x5b')));_0x46b6dd['use']('/api/openchannel/applications',require(_0x3f93('0x5c')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x5d'),require(_0x3f93('0x5e')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x5f'),require(_0x3f93('0x60')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x61'),require(_0x3f93('0x62')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x63'),require('./api/chatWebsite'));_0x46b6dd['use'](_0x3f93('0x64'),require(_0x3f93('0x65')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x66'),require('./api/chatApplication'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x67'),require(_0x3f93('0x68')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x69'),require(_0x3f93('0x6a')));_0x46b6dd['use']('/api/chat/offline_messages',require(_0x3f93('0x6b')));_0x46b6dd[_0x3f93('0x16')]('/api/chat/queues',require('./api/chatQueue'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x6c'),require('./api/chatGroup'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x6d'),require(_0x3f93('0x6e')));_0x46b6dd['use'](_0x3f93('0x6f'),require(_0x3f93('0x70')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x71'),require('./api/cmContact'));_0x46b6dd['use'](_0x3f93('0x72'),require(_0x3f93('0x73')));_0x46b6dd['use']('/api/cm/hopper_black',require(_0x3f93('0x74')));_0x46b6dd[_0x3f93('0x16')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x75'),require(_0x3f93('0x76')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x77'),require('./api/cmCustomField'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x78'),require('./api/action'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x79'),require(_0x3f93('0x7a')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x7b'),require(_0x3f93('0x7c')));_0x46b6dd['use'](_0x3f93('0x7d'),require('./api/disposition'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x7e'),require(_0x3f93('0x7f')));_0x46b6dd['use'](_0x3f93('0x80'),require('./api/interval'));_0x46b6dd['use'](_0x3f93('0x81'),require(_0x3f93('0x82')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x83'),require(_0x3f93('0x84')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x85'),require(_0x3f93('0x86')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x87'),require(_0x3f93('0x88')));_0x46b6dd[_0x3f93('0x16')]('/api/sounds',require(_0x3f93('0x89')));_0x46b6dd['use']('/api/tags',require(_0x3f93('0x8a')));_0x46b6dd[_0x3f93('0x16')]('/api/templates',require(_0x3f93('0x8b')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x8c'),require('./api/trigger'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x8d'),require(_0x3f93('0x8e')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x8f'),require(_0x3f93('0x90')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x91'),require(_0x3f93('0x92')));_0x46b6dd[_0x3f93('0x16')]('/api/analytics/custom_reports',require(_0x3f93('0x93')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x94'),require(_0x3f93('0x95')));_0x46b6dd['use']('/api/analytics/extracted_reports',require(_0x3f93('0x96')));_0x46b6dd[_0x3f93('0x16')]('/api/analytics/metrics',require(_0x3f93('0x97')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x98'),require(_0x3f93('0x99')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x9a'),require(_0x3f93('0x9b')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x9c'),require(_0x3f93('0x9d')));_0x46b6dd['use'](_0x3f93('0x9e'),require(_0x3f93('0x9f')));_0x46b6dd['use'](_0x3f93('0xa0'),require(_0x3f93('0xa1')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xa2'),require('./api/intSugarcrmAccount'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xa3'),require('./api/intSugarcrmConfiguration'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xa4'),require('./api/intSugarcrmField'));_0x46b6dd[_0x3f93('0x16')]('/api/integrations/desk/accounts',require(_0x3f93('0xa5')));_0x46b6dd['use'](_0x3f93('0xa6'),require(_0x3f93('0xa7')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xa8'),require('./api/intDeskField'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xa9'),require(_0x3f93('0xaa')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xab'),require(_0x3f93('0xac')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xad'),require(_0x3f93('0xae')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xaf'),require(_0x3f93('0xb0')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xb1'),require('./api/intZendeskConfiguration'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xb2'),require(_0x3f93('0xb3')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xb4'),require('./api/intFreshdeskAccount'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xb5'),require(_0x3f93('0xb6')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xb7'),require(_0x3f93('0xb8')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xb9'),require(_0x3f93('0xba')));_0x46b6dd[_0x3f93('0x16')]('/api/integrations/vtiger/configurations',require(_0x3f93('0xbb')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xbc'),require('./api/intVtigerField'));_0x46b6dd['use'](_0x3f93('0xbd'),require('./api/intServicenowAccount'));_0x46b6dd[_0x3f93('0x16')]('/api/integrations/servicenow/configurations',require(_0x3f93('0xbe')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xbf'),require('./api/intServicenowField'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xc0'),require(_0x3f93('0xc1')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xc2'),require(_0x3f93('0xc3')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xc4'),require(_0x3f93('0xc5')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xc6'),require(_0x3f93('0xc7')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xc8'),require('./api/chatQueueReport'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xc9'),require(_0x3f93('0xca')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xcb'),require(_0x3f93('0xcc')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xcd'),require(_0x3f93('0xce')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xcf'),require(_0x3f93('0xd0')));_0x46b6dd['use']('/api/sms/reports/queue',require(_0x3f93('0xd1')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xd2'),require(_0x3f93('0xd3')));_0x46b6dd[_0x3f93('0x16')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x46b6dd['use'](_0x3f93('0xd4'),require(_0x3f93('0xd5')));_0x46b6dd['use'](_0x3f93('0xd6'),require(_0x3f93('0xd7')));_0x46b6dd[_0x3f93('0x16')]('/api/square/odbc',require(_0x3f93('0xd8')));_0x46b6dd['use']('/api/square/projects',require(_0x3f93('0xd9')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xda'),require(_0x3f93('0xdb')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xdc'),require(_0x3f93('0xdd')));_0x46b6dd['use'](_0x3f93('0xde'),require(_0x3f93('0xdf')));_0x46b6dd[_0x3f93('0x16')]('/api/license',require('./api/license'));_0x46b6dd['use']('/api/campaigns',require(_0x3f93('0xe0')));_0x46b6dd['use'](_0x3f93('0xe1'),require(_0x3f93('0xe2')));_0x46b6dd['use']('/api/attachments',require(_0x3f93('0xe3')));_0x46b6dd['use'](_0x3f93('0xe4'),require(_0x3f93('0xe5')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xe6'),require(_0x3f93('0xe7')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xe8'),require(_0x3f93('0xe9')));_0x46b6dd['use'](_0x3f93('0xea'),require(_0x3f93('0xeb')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xec'),require('./api/openchannelTransferReport'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xed'),require(_0x3f93('0xee')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xef'),require('./api/cmList'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xf0'),require(_0x3f93('0xf1')));_0x46b6dd['use'](_0x3f93('0xf2'),require(_0x3f93('0xf3')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xf4'),require(_0x3f93('0xf5')));_0x46b6dd[_0x3f93('0x16')]('/api/userProfile/resources',require(_0x3f93('0xf6')));_0x46b6dd['use'](_0x3f93('0xf7'),require(_0x3f93('0xf8')));_0x46b6dd['use'](_0x3f93('0xf9'),require(_0x3f93('0xfa')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xfb'),require(_0x3f93('0xfc')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xfd'),require(_0x3f93('0xfe')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0xff'),require(_0x3f93('0x100')));_0x46b6dd['use']('/api/sa/typeproducts',require(_0x3f93('0x101')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x102'),require(_0x3f93('0x103')));_0x46b6dd[_0x3f93('0x16')]('/api/sa/invoicelaws',require(_0x3f93('0x104')));_0x46b6dd[_0x3f93('0x16')]('/api/sa/products',require(_0x3f93('0x105')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x106'),require(_0x3f93('0x107')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x108'),require('./api/saPriceList'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x109'),require('./api/saProductPricesList'));_0x46b6dd[_0x3f93('0x16')]('/api/sa/dossiers',require(_0x3f93('0x10a')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x10b'),require(_0x3f93('0x10c')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x10d'),require(_0x3f93('0x10e')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x10f'),require(_0x3f93('0x110')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x111'),require(_0x3f93('0x112')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x113'),require(_0x3f93('0x114')));_0x46b6dd[_0x3f93('0x16')]('/api/sa/invoices',require(_0x3f93('0x115')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x116'),require(_0x3f93('0x117')));_0x46b6dd[_0x3f93('0x16')]('/api/sa/invoice_details',require(_0x3f93('0x118')));_0x46b6dd[_0x3f93('0x16')]('/api/sa/proforma_details',require(_0x3f93('0x119')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x11a'),require(_0x3f93('0x11b')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x11c'),require(_0x3f93('0x11d')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x11e'),require(_0x3f93('0x11f')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x120'),require(_0x3f93('0x121')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x122'),require(_0x3f93('0x123')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x124'),require(_0x3f93('0x125')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x126'),require(_0x3f93('0x127')));_0x46b6dd['use'](_0x3f93('0x128'),require(_0x3f93('0x129')));_0x46b6dd['use']('/api/auth/local',require('./api/authLocal'));_0x46b6dd['use'](_0x3f93('0x12a'),require(_0x3f93('0x12b')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x12c'),require('./api/jira'));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x12d'),require(_0x3f93('0x12e')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x12f'),require(_0x3f93('0x130')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x131'),require(_0x3f93('0x132')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x133'),require(_0x3f93('0x134')));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x135'),express[_0x3f93('0x136')](path[_0x3f93('0x137')](config[_0x3f93('0x138')],_0x3f93('0x135'))));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x139'),express['static'](path['join'](config[_0x3f93('0x138')],_0x3f93('0x139'))));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x13a'),express['static'](path[_0x3f93('0x137')](config[_0x3f93('0x138')],_0x3f93('0x13a'))));_0x46b6dd[_0x3f93('0x16')](_0x3f93('0x13b'),express[_0x3f93('0x136')](path['join'](config[_0x3f93('0x138')],_0x3f93('0x13c'),_0x3f93('0x13d'))));_0x46b6dd[_0x3f93('0x16')]('/plugins',express[_0x3f93('0x136')](path[_0x3f93('0x137')](config[_0x3f93('0x138')],_0x3f93('0x13e'))));_0x46b6dd[_0x3f93('0x13f')](_0x3f93('0x140'))[_0x3f93('0x141')](errors[0x194]);_0x46b6dd['route']('/*')[_0x3f93('0x141')](function(_0x300587,_0x2f8c30){_0x2f8c30[_0x3f93('0x142')](path[_0x3f93('0x143')](_0x46b6dd[_0x3f93('0x141')]('appPath')+'/index.html'));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index af85bb4..dc2be14 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x032e=['../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','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/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/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/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x3dab78,_0x309b73){var _0x4ca239=function(_0x478c1e){while(--_0x478c1e){_0x3dab78['push'](_0x3dab78['shift']());}};_0x4ca239(++_0x309b73);}(_0x032e,0x124));var _0xe032=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x032e[_0x6c993a];return _0x27f547;};'use strict';var jayson=require(_0xe032('0x0'));var BPromise=require('bluebird');var _=require(_0xe032('0x1'));var config=require(_0xe032('0x2'));exports['listen']=function(){return new BPromise(function(_0x4afba2,_0x45ab5b){var _0x2ce001={};_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x4')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x5')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x6')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x7')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x8')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x9')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0xa')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0xb')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0xc')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0xd')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0xe')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0xf')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x10')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x11')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/mailQueue/mailQueue.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x12')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x13')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x14')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x15')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x16')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x17')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x18')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x19')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x1a')));_0x2ce001=_['merge'](_0x2ce001,require('../api/smsAccount/smsAccount.rpc'));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x1b')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x1c')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x1d')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x1e')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x1f')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x20')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x21')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x22')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x23')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/chatMessage/chatMessage.rpc'));_0x2ce001=_['merge'](_0x2ce001,require('../api/chatQueue/chatQueue.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x24')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x25')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x26')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x27')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x28')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x29')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x2a')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/pause/pause.rpc'));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x2b')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x2c')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/trigger/trigger.rpc'));_0x2ce001=_['merge'](_0x2ce001,require('../api/variable/variable.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x2d')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x2e')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x2f')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x30')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x31')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x32')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x33')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/squareReport/squareReport.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x34')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x35')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x36')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/squareRecording/squareRecording.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/squareMessage/squareMessage.rpc'));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require(_0xe032('0x37')));_0x2ce001=_['merge'](_0x2ce001,require(_0xe032('0x38')));_0x2ce001=_[_0xe032('0x3')](_0x2ce001,require('../api/plugin/plugin.rpc'));var _0x3efdef=jayson[_0xe032('0x39')](_0x2ce001)[_0xe032('0x3a')]();var _0x3192ec=config[_0xe032('0x3b')][_0xe032('0x3c')]||config[_0xe032('0x3c')]+0x1;var _0x239c58=config[_0xe032('0x3b')]['ip']||_0xe032('0x3d');_0x3efdef['on'](_0xe032('0x3e'),function(_0x432d39){return _0x45ab5b(_0x432d39);});_0x3efdef[_0xe032('0x3f')](_0x3192ec,_0x239c58,function(){console[_0xe032('0x40')](_0xe032('0x41'),_0x239c58,_0x3192ec);require(_0xe032('0x42'))[_0xe032('0x43')]();return _0x4afba2('RPC\x20listening\x20on\x20'+_0x239c58+':'+_0x3192ec);});});}; \ No newline at end of file +var _0xad36=['../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','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.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/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x1c174f,_0x500b61){var _0x426cfa=function(_0x1b92fb){while(--_0x1b92fb){_0x1c174f['push'](_0x1c174f['shift']());}};_0x426cfa(++_0x500b61);}(_0xad36,0x11c));var _0x6ad3=function(_0x4aba5c,_0x32e5f0){_0x4aba5c=_0x4aba5c-0x0;var _0x82ce0b=_0xad36[_0x4aba5c];return _0x82ce0b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6ad3('0x0'));var _=require(_0x6ad3('0x1'));var config=require(_0x6ad3('0x2'));exports[_0x6ad3('0x3')]=function(){return new BPromise(function(_0x32fb2f,_0x35a0ee){var _0xef54ab={};_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x5')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x6')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x7')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/voiceRecording/voiceRecording.rpc'));_0xef54ab=_['merge'](_0xef54ab,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x8')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x9')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0xa')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0xb')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0xc')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0xd')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0xe')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0xf')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x10')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/mailQueue/mailQueue.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/mailInteraction/mailInteraction.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x11')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x12')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x13')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/faxApplication/faxApplication.rpc'));_0xef54ab=_['merge'](_0xef54ab,require('../api/faxInteraction/faxInteraction.rpc'));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x14')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x15')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x16')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x17')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/smsInteraction/smsInteraction.rpc'));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x18')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x19')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x1a')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x1b')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x1c')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x1d')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x1e')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x1f')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/chatMessage/chatMessage.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x20')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/cmContact/cmContact.rpc'));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x21')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x22')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x23')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x24')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/interval/interval.rpc'));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x25')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x26')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/template/template.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x27')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x28')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x29')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x2a')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x2b')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x2c')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x2d')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x2e')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x2f')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x30')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x31')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x32')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x33')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x34')));_0xef54ab=_['merge'](_0xef54ab,require(_0x6ad3('0x35')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x36')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x37')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x38')));_0xef54ab=_[_0x6ad3('0x4')](_0xef54ab,require(_0x6ad3('0x39')));var _0x49ef39=jayson[_0x6ad3('0x3a')](_0xef54ab)[_0x6ad3('0x3b')]();var _0x556915=config[_0x6ad3('0x3c')][_0x6ad3('0x3d')]||config[_0x6ad3('0x3d')]+0x1;var _0x7225f4=config['rpc']['ip']||'localhost';_0x49ef39['on'](_0x6ad3('0x3e'),function(_0x3bae8a){return _0x35a0ee(_0x3bae8a);});_0x49ef39[_0x6ad3('0x3')](_0x556915,_0x7225f4,function(){console[_0x6ad3('0x3f')](_0x6ad3('0x40'),_0x7225f4,_0x556915);require(_0x6ad3('0x41'))[_0x6ad3('0x42')]();return _0x32fb2f('RPC\x20listening\x20on\x20'+_0x7225f4+':'+_0x556915);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 02c00f8..3428e02 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 _0x7d58=['join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s'];(function(_0x219c82,_0xe6f67f){var _0x2195c9=function(_0x333d71){while(--_0x333d71){_0x219c82['push'](_0x219c82['shift']());}};_0x2195c9(++_0xe6f67f);}(_0x7d58,0x6d));var _0x87d5=function(_0x33ceeb,_0x58b863){_0x33ceeb=_0x33ceeb-0x0;var _0x5b6556=_0x7d58[_0x33ceeb];return _0x5b6556;};'use strict';var util=require(_0x87d5('0x0'));var _=require(_0x87d5('0x1'));var EventEmitter=require(_0x87d5('0x2'))[_0x87d5('0x3')];var AGIReply=require(_0x87d5('0x4'));var AGIError=require(_0x87d5('0x5'));function AGIChannel(_0x3ee30d){var _0x1f3c67=this,_0x1df8b2=new AGIReply(),_0x597451=![],_0x4ef026={};EventEmitter[_0x87d5('0x6')](_0x1f3c67);_0x3ee30d[_0x87d5('0x7')](_0x87d5('0x8'));_0x3ee30d[_0x87d5('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1df8b2[_0x87d5('0x7')](_0x87d5('0x8'));_0x1df8b2['on'](_0x87d5('0xa'),function(_0x1e5915){for(var _0x859f93 in _0x1e5915){_0x1f3c67[_0x859f93]=_0x1e5915[_0x859f93];}_0x1f3c67[_0x87d5('0xb')](_0x87d5('0xc'));});_0x1df8b2['on'](_0x87d5('0xd'),function(_0x2697dc){if(_0x2697dc[_0x87d5('0xe')]()==_0x87d5('0xf')){_0x1f3c67[_0x87d5('0xb')](_0x87d5('0xf'));return;}if(_0x2697dc[_0x87d5('0x10')](0x0,0xb)==_0x87d5('0x11')){_0x597451=!![];}if(_0x597451){_0x4ef026['rx']+=_0x2697dc+'\x0a';if(_0x2697dc['search'](_0x87d5('0x12'))!=-0x1){_0x597451=![];}}else{_0x4ef026['rx']=_0x2697dc;}if(_0x597451){return;}if(typeof _0x4ef026['cb']=='function'){var _0x191f94=_0x4ef026['rx'][_0x87d5('0x10')](0x0,0x3),_0x935eac=null,_0x1a59e4=null;_0x191f94=parseInt(_0x191f94);if(isNaN(_0x191f94)){_0x4ef026['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x191f94!=0xc8){_0x4ef026['cb'](null,{'code':_0x191f94,'result':-0x1,'extra':'KO'});return;}_0x935eac=_0x4ef026['rx'][_0x87d5('0x10')](0x4)['replace']('result=','');if(_0x935eac[_0x87d5('0x13')]('\x20')!=-0x1){_0x935eac=_0x935eac[_0x87d5('0x14')](0x0,_0x935eac[_0x87d5('0x13')]('\x20'));}if(_[_0x87d5('0x15')](_0x935eac,'-1')){_0x935eac=parseInt(_0x935eac);}_0x1a59e4=_0x4ef026['rx']['split']('\x20');if(_0x1a59e4['length']==0x3){_0x1a59e4=_0x1a59e4[0x2][_0x87d5('0x10')](0x1,_0x1a59e4[0x2]['length']-0x1);}else if(_0x1a59e4[_0x87d5('0x16')]>0x3){var _0x189d86=/\((.+)\)/;var _0x28e752=_0x4ef026['rx']['match'](_0x189d86);if(_0x28e752){_0x1a59e4=_0x28e752[0x1];}else{_0x1a59e4=null;}}else{_0x1a59e4=null;}_0x4ef026['cb'](null,{'code':_0x191f94,'result':_0x935eac,'extra':_0x1a59e4});}});_0x3ee30d['on'](_0x87d5('0x17'),function(_0x1603ac){_0x1f3c67['emit'](_0x87d5('0x17'),new AGIError(_0x87d5('0x18'),_0x1603ac[_0x87d5('0x19')]));});_0x3ee30d['on'](_0x87d5('0x1a'),function(){_0x1f3c67[_0x87d5('0xb')](_0x87d5('0x1a'),new AGIError(_0x87d5('0x1b')));});_0x3ee30d['on'](_0x87d5('0x1c'),function(){_0x1f3c67['emit'](_0x87d5('0x1c'),new AGIError(_0x87d5('0x1d')));_0x3ee30d[_0x87d5('0x1e')]();});_0x3ee30d[_0x87d5('0x1f')](_0x1df8b2);this[_0x87d5('0x20')]=function(_0xd069e2,_0x3fd55b){var _0xd069e2=_0xd069e2||'',_0x3fd55b=typeof _0x3fd55b==_0x87d5('0x21')?_0x3fd55b:new Function();_0x4ef026={'tx':_0xd069e2,'rx':'','cb':_0x3fd55b};_0x3ee30d[_0x87d5('0x22')](_0xd069e2+'\x0a');},this['close']=function(){_0x3ee30d[_0x87d5('0x1e')]();};}util[_0x87d5('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x87d5('0x24')]=function(_0x232dd3){return this[_0x87d5('0x20')][_0x87d5('0x25')](this,_0x232dd3);};AGIChannel[_0x87d5('0x26')][_0x87d5('0x27')]=function(){return this[_0x87d5('0x24')](_0x87d5('0x28'));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x29')]=function(_0x16939a,_0x122cd8,_0x471777){_0x16939a=_0x16939a===undefined?_0x87d5('0x2a'):_0x16939a;_0x122cd8=_0x122cd8===undefined?'5':_0x122cd8;_0x471777=_0x471777===undefined?'1':_0x471777;return this['sendRequest'](util['format'](_0x87d5('0x2b'),_0x16939a,_0x122cd8*0x3e8,_0x471777));};AGIChannel['prototype']['noop']=function(_0xf2ff3b){_0xf2ff3b=_0xf2ff3b||_0x87d5('0x2c');return this[_0x87d5('0x24')](util[_0x87d5('0x2d')](_0x87d5('0x2e'),_0xf2ff3b));};AGIChannel['prototype']['exec']=function(_0x55ddb8,_0x3eee12){if(_[_0x87d5('0x2f')](_0x3eee12)){return this[_0x87d5('0x24')](util[_0x87d5('0x2d')](_0x87d5('0x30'),_0x55ddb8,_0x3eee12[_0x87d5('0x31')](',')));}return this['sendRequest'](util[_0x87d5('0x2d')](_0x87d5('0x30'),_0x55ddb8,_0x3eee12));};AGIChannel[_0x87d5('0x26')]['setContext']=function(_0x4eb8fb){return this['sendRequest'](util['format'](_0x87d5('0x32'),_0x4eb8fb));};AGIChannel['prototype'][_0x87d5('0x33')]=function(_0x415470){return this[_0x87d5('0x24')](util[_0x87d5('0x2d')](_0x87d5('0x34'),_0x415470));};AGIChannel['prototype']['setPriority']=function(_0x31f101){return this['sendRequest'](util[_0x87d5('0x2d')](_0x87d5('0x35'),_0x31f101));};AGIChannel[_0x87d5('0x26')]['hangup']=function(){return this[_0x87d5('0x24')](_0x87d5('0x36'));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x37')]=function(_0x63b03b,_0x1191e1){return this[_0x87d5('0x24')](util[_0x87d5('0x2d')](_0x87d5('0x38'),_0x63b03b,_0x1191e1?_0x1191e1[_0x87d5('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x3a')]=function(_0x4de16d,_0x312969){return this[_0x87d5('0x24')](util['format'](_0x87d5('0x3b'),_0x4de16d,_0x312969));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x3c')]=function(_0x6b6810,_0x506134){return this[_0x87d5('0x24')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x6b6810,_0x506134));};AGIChannel[_0x87d5('0x26')]['sayPhonetic']=function(_0x57f503,_0x1af57b){return this[_0x87d5('0x24')](util[_0x87d5('0x2d')](_0x87d5('0x3d'),_0x57f503,_0x1af57b));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x3e')]=function(_0x4817e9,_0x12ea3e,_0x527927){_0x12ea3e=_0x12ea3e||this[_0x87d5('0x3f')];_0x527927=_0x527927||0x1;this[_0x87d5('0x40')](_0x4817e9);this[_0x87d5('0x33')](_0x12ea3e);this['setPriority'](_0x527927);return this[_0x87d5('0x41')](util[_0x87d5('0x2d')](_0x87d5('0x42'),_0x4817e9,_0x12ea3e,_0x527927));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x43')]=function(_0x19e3b5){return this[_0x87d5('0x24')](util[_0x87d5('0x2d')](_0x87d5('0x44'),_0x19e3b5));};AGIChannel['prototype'][_0x87d5('0x45')]=function(_0x596a0a,_0x147985,_0x414191,_0x4266c1,_0x3752d7,_0x30275f){_0x147985=_0x147985||'wav';_0x414191=_0x414191||'';_0x4266c1=_0x4266c1===undefined?-0x1:_0x4266c1==='-1'?-0x1:_0x4266c1*0x3e8;_0x3752d7=_0x3752d7===undefined?'':'s='+_0x3752d7;_0x30275f=_0x30275f?'BEEP':'';return this['sendRequest'](util[_0x87d5('0x2d')](_0x87d5('0x46'),_0x596a0a,_0x147985,_0x414191,_0x4266c1,_0x30275f,_0x3752d7));};AGIChannel[_0x87d5('0x26')][_0x87d5('0x47')]=function(_0x3f9638,_0x53075f){_0x53075f=_0x53075f||'';return this['sendRequest'](util[_0x87d5('0x2d')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3f9638,_0x53075f));};AGIChannel['prototype'][_0x87d5('0x48')]=function(_0x307ca6){return this[_0x87d5('0x49')](_0x87d5('0x4a'),_0x307ca6);};AGIChannel['prototype'][_0x87d5('0x4b')]=function(_0x15d6eb){return this['exec'](_0x87d5('0x4c'),_0x15d6eb);};AGIChannel[_0x87d5('0x26')][_0x87d5('0x17')]=function(_0xaad0e7,_0x557628){this[_0x87d5('0x41')](util[_0x87d5('0x2d')](_0x87d5('0x4d'),_0xaad0e7['id'],_0xaad0e7['label'],_0x557628));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x87d5('0x4e')]=AGIChannel; \ No newline at end of file +var _0x07e2=['toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','answer','ANSWER','getData','beep','sendRequest','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','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setContext','setPriority','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','EventEmitter','./reply','call','setTimeout','utf8','emit','ready','line'];(function(_0x6cde88,_0x9fe8d8){var _0x3a4687=function(_0x18b8f8){while(--_0x18b8f8){_0x6cde88['push'](_0x6cde88['shift']());}};_0x3a4687(++_0x9fe8d8);}(_0x07e2,0x1c4));var _0x207e=function(_0x39aef5,_0x1eb474){_0x39aef5=_0x39aef5-0x0;var _0x27b978=_0x07e2[_0x39aef5];return _0x27b978;};'use strict';var util=require(_0x207e('0x0'));var _=require(_0x207e('0x1'));var EventEmitter=require('events')[_0x207e('0x2')];var AGIReply=require(_0x207e('0x3'));var AGIError=require('./error');function AGIChannel(_0x51a6f6){var _0x8f077f=this,_0x2f2db5=new AGIReply(),_0x258b38=![],_0x330a77={};EventEmitter[_0x207e('0x4')](_0x8f077f);_0x51a6f6['setEncoding']('utf8');_0x51a6f6[_0x207e('0x5')](0x8*0x3c*0x3c*0x3e8);_0x2f2db5['setEncoding'](_0x207e('0x6'));_0x2f2db5['on']('headers',function(_0x508502){for(var _0x54c05b in _0x508502){_0x8f077f[_0x54c05b]=_0x508502[_0x54c05b];}_0x8f077f[_0x207e('0x7')](_0x207e('0x8'));});_0x2f2db5['on'](_0x207e('0x9'),function(_0x434fef){if(_0x434fef[_0x207e('0xa')]()==_0x207e('0xb')){_0x8f077f['emit']('hangup');return;}if(_0x434fef[_0x207e('0xc')](0x0,0xb)==_0x207e('0xd')){_0x258b38=!![];}if(_0x258b38){_0x330a77['rx']+=_0x434fef+'\x0a';if(_0x434fef[_0x207e('0xe')](_0x207e('0xf'))!=-0x1){_0x258b38=![];}}else{_0x330a77['rx']=_0x434fef;}if(_0x258b38){return;}if(typeof _0x330a77['cb']==_0x207e('0x10')){var _0x4147b7=_0x330a77['rx'][_0x207e('0xc')](0x0,0x3),_0x4ce99e=null,_0x12952b=null;_0x4147b7=parseInt(_0x4147b7);if(isNaN(_0x4147b7)){_0x330a77['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x207e('0x11')});return;}if(_0x4147b7!=0xc8){_0x330a77['cb'](null,{'code':_0x4147b7,'result':-0x1,'extra':'KO'});return;}_0x4ce99e=_0x330a77['rx'][_0x207e('0xc')](0x4)[_0x207e('0x12')](_0x207e('0x13'),'');if(_0x4ce99e[_0x207e('0x14')]('\x20')!=-0x1){_0x4ce99e=_0x4ce99e[_0x207e('0x15')](0x0,_0x4ce99e[_0x207e('0x14')]('\x20'));}if(_['startsWith'](_0x4ce99e,'-1')){_0x4ce99e=parseInt(_0x4ce99e);}_0x12952b=_0x330a77['rx'][_0x207e('0x16')]('\x20');if(_0x12952b[_0x207e('0x17')]==0x3){_0x12952b=_0x12952b[0x2][_0x207e('0xc')](0x1,_0x12952b[0x2][_0x207e('0x17')]-0x1);}else if(_0x12952b['length']>0x3){var _0x167b2f=/\((.+)\)/;var _0x432531=_0x330a77['rx'][_0x207e('0x18')](_0x167b2f);if(_0x432531){_0x12952b=_0x432531[0x1];}else{_0x12952b=null;}}else{_0x12952b=null;}_0x330a77['cb'](null,{'code':_0x4147b7,'result':_0x4ce99e,'extra':_0x12952b});}});_0x51a6f6['on'](_0x207e('0x19'),function(_0x162c7f){_0x8f077f[_0x207e('0x7')]('error',new AGIError(_0x207e('0x1a'),_0x162c7f[_0x207e('0x1b')]));});_0x51a6f6['on'](_0x207e('0x1c'),function(){_0x8f077f[_0x207e('0x7')](_0x207e('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x51a6f6['on']('timeout',function(){_0x8f077f[_0x207e('0x7')](_0x207e('0x1d'),new AGIError(_0x207e('0x1e')));_0x51a6f6[_0x207e('0x1f')]();});_0x51a6f6['pipe'](_0x2f2db5);this[_0x207e('0x20')]=function(_0x3b6834,_0x14feef){var _0x3b6834=_0x3b6834||'',_0x14feef=typeof _0x14feef==_0x207e('0x10')?_0x14feef:new Function();_0x330a77={'tx':_0x3b6834,'rx':'','cb':_0x14feef};_0x51a6f6[_0x207e('0x21')](_0x3b6834+'\x0a');},this[_0x207e('0x1c')]=function(){_0x51a6f6['destroy']();};}util[_0x207e('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x1b6a98){return this['command']['sync'](this,_0x1b6a98);};AGIChannel[_0x207e('0x23')][_0x207e('0x24')]=function(){return this['sendRequest'](_0x207e('0x25'));};AGIChannel['prototype'][_0x207e('0x26')]=function(_0x4b8e95,_0x765b6b,_0x6f8e2a){_0x4b8e95=_0x4b8e95===undefined?_0x207e('0x27'):_0x4b8e95;_0x765b6b=_0x765b6b===undefined?'5':_0x765b6b;_0x6f8e2a=_0x6f8e2a===undefined?'1':_0x6f8e2a;return this[_0x207e('0x28')](util[_0x207e('0x29')](_0x207e('0x2a'),_0x4b8e95,_0x765b6b*0x3e8,_0x6f8e2a));};AGIChannel['prototype']['noop']=function(_0x2375b8){_0x2375b8=_0x2375b8||_0x207e('0x2b');return this[_0x207e('0x28')](util[_0x207e('0x29')](_0x207e('0x2c'),_0x2375b8));};AGIChannel[_0x207e('0x23')][_0x207e('0x2d')]=function(_0x5f01ed,_0x21666a){if(_[_0x207e('0x2e')](_0x21666a)){return this[_0x207e('0x28')](util['format']('EXEC\x20%s\x20%s',_0x5f01ed,_0x21666a[_0x207e('0x2f')](',')));}return this['sendRequest'](util[_0x207e('0x29')](_0x207e('0x30'),_0x5f01ed,_0x21666a));};AGIChannel['prototype']['setContext']=function(_0x405a7d){return this['sendRequest'](util[_0x207e('0x29')](_0x207e('0x31'),_0x405a7d));};AGIChannel[_0x207e('0x23')][_0x207e('0x32')]=function(_0x2927ae){return this[_0x207e('0x28')](util[_0x207e('0x29')](_0x207e('0x33'),_0x2927ae));};AGIChannel['prototype']['setPriority']=function(_0x24b8ff){return this['sendRequest'](util['format'](_0x207e('0x34'),_0x24b8ff));};AGIChannel[_0x207e('0x23')][_0x207e('0xb')]=function(){return this[_0x207e('0x28')](_0x207e('0x35'));};AGIChannel['prototype'][_0x207e('0x36')]=function(_0xf02e88,_0x43d8d1){return this[_0x207e('0x28')](util[_0x207e('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf02e88,_0x43d8d1?_0x43d8d1[_0x207e('0x37')]()[_0x207e('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x207e('0x23')]['sayNumber']=function(_0xfb7ba0,_0x4607ab){return this['sendRequest'](util[_0x207e('0x29')](_0x207e('0x38'),_0xfb7ba0,_0x4607ab));};AGIChannel[_0x207e('0x23')][_0x207e('0x39')]=function(_0x2e3e50,_0x577d2b){return this['sendRequest'](util['format'](_0x207e('0x3a'),_0x2e3e50,_0x577d2b));};AGIChannel[_0x207e('0x23')][_0x207e('0x3b')]=function(_0x40e19e,_0x528db9){return this[_0x207e('0x28')](util[_0x207e('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x40e19e,_0x528db9));};AGIChannel[_0x207e('0x23')][_0x207e('0x3c')]=function(_0x31f5ff,_0x505e44,_0x2d420d){_0x505e44=_0x505e44||this[_0x207e('0x3d')];_0x2d420d=_0x2d420d||0x1;this[_0x207e('0x3e')](_0x31f5ff);this[_0x207e('0x32')](_0x505e44);this[_0x207e('0x3f')](_0x2d420d);return this[_0x207e('0x40')](util[_0x207e('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x31f5ff,_0x505e44,_0x2d420d));};AGIChannel['prototype'][_0x207e('0x41')]=function(_0x90ab56){return this[_0x207e('0x28')](util['format'](_0x207e('0x42'),_0x90ab56));};AGIChannel[_0x207e('0x23')][_0x207e('0x43')]=function(_0x421fbc,_0x5ae6a2,_0x17e641,_0x24602f,_0x838cbc,_0x45b19a){_0x5ae6a2=_0x5ae6a2||_0x207e('0x44');_0x17e641=_0x17e641||'';_0x24602f=_0x24602f===undefined?-0x1:_0x24602f==='-1'?-0x1:_0x24602f*0x3e8;_0x838cbc=_0x838cbc===undefined?'':'s='+_0x838cbc;_0x45b19a=_0x45b19a?_0x207e('0x45'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x421fbc,_0x5ae6a2,_0x17e641,_0x24602f,_0x45b19a,_0x838cbc));};AGIChannel[_0x207e('0x23')][_0x207e('0x46')]=function(_0x21df8e,_0x25d83d){_0x25d83d=_0x25d83d||'';return this[_0x207e('0x28')](util[_0x207e('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x21df8e,_0x25d83d));};AGIChannel[_0x207e('0x23')][_0x207e('0x47')]=function(_0x27e4e6){return this['exec'](_0x207e('0x48'),_0x27e4e6);};AGIChannel[_0x207e('0x23')][_0x207e('0x49')]=function(_0x54f289){return this[_0x207e('0x2d')](_0x207e('0x4a'),_0x54f289);};AGIChannel[_0x207e('0x23')]['error']=function(_0x2282e2,_0x1eef42){this[_0x207e('0x40')](util['format'](_0x207e('0x4b'),_0x2282e2['id'],_0x2282e2['label'],_0x1eef42));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x207e('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ad34f24..a6d4c7d 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 _0x207f=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x207f,0x1e4));var _0xf207=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x207f[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xf207('0x0'));var error={'E_AGI_UNDEFINED':_0xf207('0x1'),'E_AGI_ARGUMENT_PORT':_0xf207('0x2'),'E_AGI_SERVER_ERROR':_0xf207('0x3'),'E_AGI_SERVER_CLOSE':_0xf207('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xf207('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xf207('0x6'),'E_AGI_SOCKET_ERROR':_0xf207('0x7'),'E_AGI_SOCKET_CLOSE':_0xf207('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xf207('0x9'),'E_AGI_COMMAND_EMPTY':_0xf207('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf207('0xb'),'E_AGI_IVR_ENTRY':_0xf207('0xc')};function AGIError(_0x3bc699){var _0x3bc699=_0x3bc699||null,_0x48a257=_0x48a257||[],_0x454519=0x1,_0x406b70='';if(!error[_0x3bc699]){_0x3bc699=_0xf207('0xd');}_0x48a257[_0xf207('0xe')](error[_0x3bc699]);while(arguments[_0x454519]){_0x48a257[_0xf207('0xe')](arguments[_0x454519]);_0x454519++;}_0x406b70=util[_0xf207('0xf')][_0xf207('0x10')](util,_0x48a257);this['message']=_0x406b70;this[_0xf207('0x11')]=_0x3bc699;}module[_0xf207('0x12')]=AGIError; \ No newline at end of file +var _0x4068=['message','name','exports','util','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x4068,0x1e3));var _0x8406=function(_0x97c41c,_0x124465){_0x97c41c=_0x97c41c-0x0;var _0x369c9c=_0x4068[_0x97c41c];return _0x369c9c;};'use strict';var util=require(_0x8406('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x8406('0x1'),'E_AGI_SOCKET_ERROR':_0x8406('0x2'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x8406('0x3'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x8406('0x4')};function AGIError(_0x5ea392){var _0x5ea392=_0x5ea392||null,_0xfae2dd=_0xfae2dd||[],_0x1627af=0x1,_0x55970a='';if(!error[_0x5ea392]){_0x5ea392=_0x8406('0x5');}_0xfae2dd[_0x8406('0x6')](error[_0x5ea392]);while(arguments[_0x1627af]){_0xfae2dd['push'](arguments[_0x1627af]);_0x1627af++;}_0x55970a=util[_0x8406('0x7')][_0x8406('0x8')](util,_0xfae2dd);this[_0x8406('0x9')]=_0x55970a;this[_0x8406('0xa')]=_0x5ea392;}module[_0x8406('0xb')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 7010053..da987e3 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 _0x0647=['edges','numberOfEdges','size','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','prototype','addVertex'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x0647,0xd0));var _0x7064=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x0647[_0x18d631];return _0x50d708;};'use strict';var _=require(_0x7064('0x0'));var logger=require('../../../config/logger')(_0x7064('0x1'));var verticesWithRetry=[_0x7064('0x2'),_0x7064('0x3'),_0x7064('0x4')];var Graph=function(){this[_0x7064('0x5')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x7064('0x6')][_0x7064('0x7')]=function(_0x31f6a6){this[_0x7064('0x5')][_0x31f6a6['id']]=_0x31f6a6;this[_0x7064('0x8')][_0x31f6a6['id']]=[];};Graph[_0x7064('0x6')]['addEdge']=function(_0x536336,_0x1c85b1,_0x39b7e3){this[_0x7064('0x8')][_0x536336]['push']({'target':_0x1c85b1,'condition':_0x39b7e3});this[_0x7064('0x9')]+=0x1;};Graph[_0x7064('0x6')]['size']=function(){return _[_0x7064('0xa')](this[_0x7064('0x5')]);};Graph[_0x7064('0x6')]['relations']=function(){return this[_0x7064('0x9')];};Graph[_0x7064('0x6')][_0x7064('0xb')]=function(_0x6acdd9){return this['vertices'][_0x6acdd9];};Graph[_0x7064('0x6')][_0x7064('0xc')]=function(_0x268a94,_0x44dcbe){if(!this[_0x7064('0x5')][_0x268a94]){return logger[_0x7064('0xd')](_0x7064('0xe'));}var _0x3badc8=_0x44dcbe(this['vertices'][_0x268a94]);if(!_0x3badc8){return logger['info']('stop\x20traverse');}if(this[_0x7064('0x8')][_0x268a94][_0x7064('0xf')]===0x0){return logger[_0x7064('0xd')]('no\x20edge/s\x20available');}for(var _0x22cd86=0x0,_0x13552d=[],_0x5bb1cc=![];_0x22cd86\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','finally','./server','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','error','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','arg_1','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source'];(function(_0x135573,_0x479526){var _0x13ea56=function(_0x49c990){while(--_0x49c990){_0x135573['push'](_0x135573['shift']());}};_0x13ea56(++_0x479526);}(_0x2494,0x82));var _0x4249=function(_0x3e2318,_0x5e69d8){_0x3e2318=_0x3e2318-0x0;var _0x5227ea=_0x2494[_0x3e2318];return _0x5227ea;};'use strict';var parser=require(_0x4249('0x0'));var _=require('lodash');var syncho=require(_0x4249('0x1'));var util=require(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var config=require(_0x4249('0x4'));var logger=require(_0x4249('0x5'))(_0x4249('0x6'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x4249('0x7'));var Graph=require('./graph');var Vertices=require(_0x4249('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4249('0x6')]=_[_0x4249('0x9')](config['agi'],{'ip':_0x4249('0xa'),'port':0x11dd});function connectionHandler(_0x2b7934){process[_0x4249('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2b7934);agiHandler(_0x2b7934);}catch(_0x58529b){logger['error'](_0x58529b[_0x4249('0xc')]);}});});}function listeningHandler(){console[_0x4249('0xd')](_0x4249('0xe'),config[_0x4249('0x6')][_0x4249('0xf')]);logger[_0x4249('0x10')](util[_0x4249('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x4249('0x6')]['port']));}function errorHandler(_0xc4ae35){if(_0xc4ae35&&_0xc4ae35[_0x4249('0x12')]&&_0xc4ae35['message']){logger[_0x4249('0x13')](util[_0x4249('0x11')]('[%s]\x20%s',_0xc4ae35[_0x4249('0x12')],_0xc4ae35[_0x4249('0x14')]));}else{logger[_0x4249('0x13')](util[_0x4249('0x11')](_0x4249('0x15'),_0xc4ae35[_0x4249('0xc')]));}}function closeHandler(){logger['info'](util[_0x4249('0x11')](_0x4249('0x16'),this['arg_1'],this[_0x4249('0x17')],this['callerid'],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x39a6df){logger[_0x4249('0x13')](_0x39a6df[_0x4249('0xc')]);}}function timeoutHandler(){logger[_0x4249('0x10')](util[_0x4249('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4249('0x17')],this[_0x4249('0x18')],this[_0x4249('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x4249('0x10')](util[_0x4249('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4249('0x1a')],this['calleridname'],this[_0x4249('0x18')],this[_0x4249('0x19')],this[_0x4249('0x1b')]));this[_0x4249('0x1c')]=!![];}function getRoot(_0x42d0d9){return parser[_0x4249('0x1d')](_0x42d0d9,{'object':!![]})[_0x4249('0x1e')][_0x4249('0x1f')];}function addVertex(_0x4032f7,_0x15561d,_0x9da8){_0x15561d[_0x4249('0x20')]=_0x9da8;if(_0x15561d[_0x4249('0x21')](_0x4249('0x22'))){_0x15561d[_0x4249('0x23')]=parseInt(_0x15561d[_0x4249('0x22')],0xa);}_0x4032f7[_0x4249('0x24')](_[_0x4249('0x25')](_0x15561d,_0x4249('0x26')));}function initGraph(_0x357c84,_0x43dc25){var _0x1d4fb9=new Graph();for(var _0x4ce9af in _0x357c84){if(_0x357c84[_0x4249('0x21')](_0x4ce9af)){if(_[_0x4249('0x27')](_0x357c84[_0x4ce9af])){for(var _0x434160=0x0;_0x434160<_0x357c84[_0x4ce9af][_0x4249('0x28')];_0x434160+=0x1){addVertex(_0x1d4fb9,_0x357c84[_0x4ce9af][_0x434160],_0x4ce9af);}}else{addVertex(_0x1d4fb9,_0x357c84[_0x4ce9af],_0x4ce9af);}}}for(var _0x51e8b4=0x0;_0x51e8b4<_0x43dc25[_0x4249('0x28')];_0x51e8b4+=0x1){if(_0x43dc25[_0x51e8b4]['source']&&_0x43dc25[_0x51e8b4][_0x4249('0x29')]){_0x1d4fb9[_0x4249('0x2a')](_0x43dc25[_0x51e8b4][_0x4249('0x2b')],_0x43dc25[_0x51e8b4]['target'],_0x43dc25[_0x51e8b4][_0x4249('0x2c')]);}}return _0x1d4fb9;}function getSquareProject(_0x3b3cb5,_0x5afc2f){rpc[_0x4249('0x2d')](_0x3b3cb5)['then'](function(_0x4e7761){_0x5afc2f(null,_0x4e7761);})['catch'](function(_0x53182d){_0x5afc2f(null,_0x53182d);});}function createSquareReport(_0x2f51c0,_0x46e92a){rpc['createSquareReport'](_0x2f51c0)[_0x4249('0x2e')](function(_0x42d96a){if(_0x46e92a){_0x46e92a(null,_0x42d96a);}})['catch'](function(_0x2f67b2){if(_0x46e92a){_0x46e92a(null,_0x2f67b2);}});}function setChannelVariables(_0x49f975){for(var _0x4aad35 in _0x49f975){if(_0x49f975[_0x4249('0x21')](_0x4aad35)){if(_0x4aad35[_0x4249('0x2f')](_0x4249('0x30'))===0x0){_0x49f975[_0x4aad35['substring'](0x4)]=_0x49f975[_0x4aad35];delete _0x49f975[_0x4aad35];}}}}function getLogFromObject(_0x30db4e){return util['inspect'](_0x30db4e,{'showHidden':![],'depth':null});}function agiHandler(_0x4dde8a){var _0x3e41a8,_0xaf3ba5,_0x563ac0,_0x492e07,_0x461d97;logger[_0x4249('0x31')](_0x4249('0x32'),JSON[_0x4249('0x33')](_0x4dde8a,null,0x2));logger[_0x4249('0x10')](util[_0x4249('0x11')](_0x4249('0x34'),_0x4dde8a[_0x4249('0x1a')],_0x4dde8a[_0x4249('0x17')],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a[_0x4249('0x1b')]));_0x4dde8a['on'](_0x4249('0x13'),errorHandler);_0x4dde8a['on'](_0x4249('0x35'),closeHandler);_0x4dde8a['on'](_0x4249('0x36'),timeoutHandler);_0x4dde8a['evtHangup']=![];_0x4dde8a['on']('hangup',hangupHandler);var _0x289f13=getSquareProject[_0x4249('0x37')](null,_0x4dde8a[_0x4249('0x1a')]);if(_0x289f13){if(_0x289f13[_0x4249('0x38')]){_0x3e41a8=getRoot(_0x289f13['production']);if(_0x3e41a8&&_0x3e41a8[_0x4249('0x39')]){logger[_0x4249('0x31')](_0x4249('0x1f'),JSON[_0x4249('0x33')](_0x3e41a8,null,0x2));_0x4dde8a[_0x4249('0x3a')]=moment()[_0x4249('0x11')](_0x4249('0x3b'));_0xaf3ba5=initGraph(_[_0x4249('0x25')](_0x3e41a8,_0x4249('0x26')),_0x3e41a8[_0x4249('0x26')]);_0x563ac0=new Vertices(_0x4dde8a,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dde8a[_0x4249('0x1a')],_0x4dde8a[_0x4249('0x17')],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a['uniqueid']));_0xaf3ba5[_0x4249('0x3c')](_0x3e41a8['start']['id'],function(_0xd71464){try{_0xd71464=_0x563ac0[_0x4249('0x3d')](_0xd71464);logger['debug'](_0x4249('0x3e'),JSON[_0x4249('0x33')](_0xd71464,null,0x2));if(_0xd71464[_0x4249('0x20')]===_0x4249('0x3f')){logger[_0x4249('0x10')](_0x4249('0x40'));_0x4dde8a[_0x4249('0x41')]=_0xd71464[_0x4249('0x41')]||_0x4dde8a[_0x4249('0x41')];_0x4dde8a[_0x4249('0x42')]=_0xd71464['extension'];_0x4dde8a[_0x4249('0x43')]=_0xd71464[_0x4249('0x43')]?_0xd71464[_0x4249('0x43')]-0x1:0x1;return null;}else if(_0xd71464&&_0x563ac0[_0xd71464[_0x4249('0x20')]]){_0x461d97=_0x563ac0[_0xd71464[_0x4249('0x20')]](_0xd71464);logger[_0x4249('0x10')](_0x4249('0x44'),JSON[_0x4249('0x33')](_0x461d97,null,0x2));if(_0x461d97&&_0x461d97[_0x4249('0x45')]===AGI_CODE_SUCCESS&&_0x461d97[_0x4249('0x46')]!==AGI_RESULT_ERROR&&!_0x4dde8a[_0x4249('0x1c')]){logger['debug'](_0x4249('0x44'),getLogFromObject(_0x461d97));return _[_0x4249('0x47')](_0x461d97[_0x4249('0x46')])?null:_0x461d97[_0x4249('0x46')][_0x4249('0x48')]();}else{logger[_0x4249('0x13')]('response',getLogFromObject(_0x461d97));return null;}}else{logger[_0x4249('0x13')](_0x4249('0x49'));return null;}}catch(_0x4e5651){logger[_0x4249('0x13')](_0x4e5651[_0x4249('0xc')]);return null;}});if(_0x3e41a8['finally']){logger[_0x4249('0x10')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dde8a[_0x4249('0x1a')],_0x4dde8a['calleridname'],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a[_0x4249('0x1b')]));_0xaf3ba5[_0x4249('0x3c')](_0x3e41a8['finally']['id'],function(_0x474d64){try{_0x474d64=_0x563ac0[_0x4249('0x3d')](_0x474d64);logger['debug'](_0x4249('0x3e'),JSON[_0x4249('0x33')](_0x474d64,null,0x2));if(_0x474d64&&_0x563ac0[_0x474d64[_0x4249('0x20')]]){_0x461d97=_0x563ac0[_0x474d64[_0x4249('0x20')]](_0x474d64);if(_0x461d97){logger[_0x4249('0x31')](_0x4249('0x44'),getLogFromObject(_0x461d97));return _[_0x4249('0x47')](_0x461d97[_0x4249('0x46')])?null:_0x461d97[_0x4249('0x46')][_0x4249('0x48')]();}else{logger[_0x4249('0x13')]('response',getLogFromObject(_0x461d97));return null;}}else{logger[_0x4249('0x13')](_0x4249('0x49'));return null;}}catch(_0x1787f6){logger[_0x4249('0x13')](_0x1787f6['stack']);return null;}});}logger['info'](util[_0x4249('0x11')](_0x4249('0x4a'),_0x4dde8a[_0x4249('0x1a')],_0x4dde8a[_0x4249('0x17')],_0x4dde8a[_0x4249('0x18')],_0x4dde8a[_0x4249('0x19')],_0x4dde8a['uniqueid']));logger['info'](util[_0x4249('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4dde8a[_0x4249('0x41')],_0x4dde8a['extension'],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1));_0x4dde8a[_0x4249('0x4b')](_0x4dde8a['context'],_0x4dde8a[_0x4249('0x42')],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1);_0x4dde8a['close']();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x4dde8a[_0x4249('0x1a')]));_0x4dde8a[_0x4249('0x4b')](_0x4dde8a[_0x4249('0x41')],_0x4dde8a[_0x4249('0x42')],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1);_0x4dde8a[_0x4249('0x35')]();}}else{logger[_0x4249('0x13')](util['format'](_0x4249('0x4c'),_0x4dde8a['arg_1']));_0x4dde8a['continueAt'](_0x4dde8a[_0x4249('0x41')],_0x4dde8a['extension'],parseInt(_0x4dde8a[_0x4249('0x43')],0xa)+0x1);_0x4dde8a[_0x4249('0x35')]();}}function main(){var _0x4cc6ab;return utilLicense['getLicense']()[_0x4249('0x2e')](function(_0x76adc2){if(_0x76adc2){if(_0x76adc2[_0x4249('0x4d')]){if(_0x76adc2[_0x4249('0x4e')]&&_0x76adc2[_0x4249('0x4e')]>0x0){logger[_0x4249('0x10')](util[_0x4249('0x11')](_0x4249('0x4f'),_0x76adc2['callysquare']));_0x4cc6ab=_0x76adc2['callysquare'];}else{logger[_0x4249('0x10')](_0x4249('0x50'));}}else{logger[_0x4249('0x10')](_0x4249('0x51'));_0x4cc6ab=-0x1;}}})[_0x4249('0x52')](function(_0x320da5){logger[_0x4249('0x13')](_0x4249('0x53'),_0x320da5[_0x4249('0xc')]);})[_0x4249('0x54')](function(){var _0x46bdc4=require(_0x4249('0x55'))(config[_0x4249('0x6')][_0x4249('0xf')],config['agi']['ip'],_0x4cc6ab);_0x46bdc4['on']('error',errorHandler);_0x46bdc4['on']('listening',listeningHandler);_0x46bdc4['on'](_0x4249('0x56'),connectionHandler);_0x46bdc4['on'](_0x4249('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xd2bb=['[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','getSquareProject','then','createSquareReport','catch','agi_','substring','inspect','variables','stringify','dnid','close','timeout','hangup','sync','production','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc','context','extension','priority','code','result','response','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','error','[%s]\x20%s','message','[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','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x46b4b3,_0xcd494e){var _0x52b326=function(_0x368752){while(--_0x368752){_0x46b4b3['push'](_0x46b4b3['shift']());}};_0x52b326(++_0xcd494e);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x5dccae,_0xa7c7d4){_0x5dccae=_0x5dccae-0x0;var _0x164ce9=_0xd2bb[_0x5dccae];return _0x164ce9;};'use strict';var parser=require('xml2json');var _=require(_0xbd2b('0x0'));var syncho=require('syncho');var util=require(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var config=require(_0xbd2b('0x3'));var logger=require(_0xbd2b('0x4'))(_0xbd2b('0x5'));var utilLicense=require(_0xbd2b('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xbd2b('0x7'));var Graph=require(_0xbd2b('0x8'));var Vertices=require(_0xbd2b('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbd2b('0x5')]=_[_0xbd2b('0xa')](config[_0xbd2b('0x5')],{'ip':_0xbd2b('0xb'),'port':0x11dd});function connectionHandler(_0x30cd3f){process[_0xbd2b('0xc')](function(){syncho(function(){try{setChannelVariables(_0x30cd3f);agiHandler(_0x30cd3f);}catch(_0x3fc39e){logger['error'](_0x3fc39e[_0xbd2b('0xd')]);}});});}function listeningHandler(){console['log'](_0xbd2b('0xe'),config[_0xbd2b('0x5')]['port']);logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x11'),config[_0xbd2b('0x5')]['ip'],config[_0xbd2b('0x5')][_0xbd2b('0x12')]));}function errorHandler(_0x1077b0){if(_0x1077b0&&_0x1077b0[_0xbd2b('0x13')]&&_0x1077b0['message']){logger[_0xbd2b('0x14')](util[_0xbd2b('0x10')](_0xbd2b('0x15'),_0x1077b0[_0xbd2b('0x13')],_0x1077b0[_0xbd2b('0x16')]));}else{logger['error'](util[_0xbd2b('0x10')](_0xbd2b('0x17'),_0x1077b0[_0xbd2b('0xd')]));}}function closeHandler(){logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x18'),this[_0xbd2b('0x19')],this[_0xbd2b('0x1a')],this[_0xbd2b('0x1b')],this['dnid'],this[_0xbd2b('0x1c')]));try{createSquareReport(this);}catch(_0x268025){logger[_0xbd2b('0x14')](_0x268025[_0xbd2b('0xd')]);}}function timeoutHandler(){logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x1d'),this[_0xbd2b('0x19')],this[_0xbd2b('0x1a')],this[_0xbd2b('0x1b')],this['dnid'],this[_0xbd2b('0x1c')]));}function hangupHandler(){logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x1e'),this[_0xbd2b('0x19')],this[_0xbd2b('0x1a')],this[_0xbd2b('0x1b')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2fb14b){return parser['toJson'](_0x2fb14b,{'object':!![]})[_0xbd2b('0x1f')][_0xbd2b('0x20')];}function addVertex(_0x48d06d,_0x5b6b31,_0x1a2b3d){_0x5b6b31[_0xbd2b('0x21')]=_0x1a2b3d;if(_0x5b6b31['hasOwnProperty']('retry')){_0x5b6b31['maxRetry']=parseInt(_0x5b6b31[_0xbd2b('0x22')],0xa);}_0x48d06d[_0xbd2b('0x23')](_[_0xbd2b('0x24')](_0x5b6b31,_0xbd2b('0x25')));}function initGraph(_0x17bb23,_0x21ce4d){var _0x5bf25b=new Graph();for(var _0x51e091 in _0x17bb23){if(_0x17bb23[_0xbd2b('0x26')](_0x51e091)){if(_[_0xbd2b('0x27')](_0x17bb23[_0x51e091])){for(var _0x51b3d5=0x0;_0x51b3d5<_0x17bb23[_0x51e091][_0xbd2b('0x28')];_0x51b3d5+=0x1){addVertex(_0x5bf25b,_0x17bb23[_0x51e091][_0x51b3d5],_0x51e091);}}else{addVertex(_0x5bf25b,_0x17bb23[_0x51e091],_0x51e091);}}}for(var _0x3e4b8c=0x0;_0x3e4b8c<_0x21ce4d[_0xbd2b('0x28')];_0x3e4b8c+=0x1){if(_0x21ce4d[_0x3e4b8c][_0xbd2b('0x29')]&&_0x21ce4d[_0x3e4b8c]['target']){_0x5bf25b[_0xbd2b('0x2a')](_0x21ce4d[_0x3e4b8c]['source'],_0x21ce4d[_0x3e4b8c][_0xbd2b('0x2b')],_0x21ce4d[_0x3e4b8c][_0xbd2b('0x2c')]);}}return _0x5bf25b;}function getSquareProject(_0x32d59c,_0x2e5b0a){rpc[_0xbd2b('0x2d')](_0x32d59c)[_0xbd2b('0x2e')](function(_0x117c1f){_0x2e5b0a(null,_0x117c1f);})['catch'](function(_0x25aaa5){_0x2e5b0a(null,_0x25aaa5);});}function createSquareReport(_0x483951,_0x74726){rpc[_0xbd2b('0x2f')](_0x483951)['then'](function(_0x4d0bf8){if(_0x74726){_0x74726(null,_0x4d0bf8);}})[_0xbd2b('0x30')](function(_0x297aae){if(_0x74726){_0x74726(null,_0x297aae);}});}function setChannelVariables(_0x197696){for(var _0x3741c7 in _0x197696){if(_0x197696[_0xbd2b('0x26')](_0x3741c7)){if(_0x3741c7['indexOf'](_0xbd2b('0x31'))===0x0){_0x197696[_0x3741c7[_0xbd2b('0x32')](0x4)]=_0x197696[_0x3741c7];delete _0x197696[_0x3741c7];}}}}function getLogFromObject(_0x2ead2e){return util[_0xbd2b('0x33')](_0x2ead2e,{'showHidden':![],'depth':null});}function agiHandler(_0x24477c){var _0x87f064,_0x20703c,_0x502da1,_0x4346d2,_0x5c3e4b;logger['debug'](_0xbd2b('0x34'),JSON[_0xbd2b('0x35')](_0x24477c,null,0x2));logger[_0xbd2b('0xf')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x24477c[_0xbd2b('0x19')],_0x24477c[_0xbd2b('0x1a')],_0x24477c[_0xbd2b('0x1b')],_0x24477c[_0xbd2b('0x36')],_0x24477c[_0xbd2b('0x1c')]));_0x24477c['on']('error',errorHandler);_0x24477c['on'](_0xbd2b('0x37'),closeHandler);_0x24477c['on'](_0xbd2b('0x38'),timeoutHandler);_0x24477c['evtHangup']=![];_0x24477c['on'](_0xbd2b('0x39'),hangupHandler);var _0x5e0d58=getSquareProject[_0xbd2b('0x3a')](null,_0x24477c[_0xbd2b('0x19')]);if(_0x5e0d58){if(_0x5e0d58[_0xbd2b('0x3b')]){_0x87f064=getRoot(_0x5e0d58[_0xbd2b('0x3b')]);if(_0x87f064&&_0x87f064['start']){logger[_0xbd2b('0x3c')](_0xbd2b('0x20'),JSON[_0xbd2b('0x35')](_0x87f064,null,0x2));_0x24477c[_0xbd2b('0x3d')]=moment()['format'](_0xbd2b('0x3e'));_0x20703c=initGraph(_['omit'](_0x87f064,_0xbd2b('0x25')),_0x87f064[_0xbd2b('0x25')]);_0x502da1=new Vertices(_0x24477c,rpc,mailRpc);logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x3f'),_0x24477c['arg_1'],_0x24477c[_0xbd2b('0x1a')],_0x24477c[_0xbd2b('0x1b')],_0x24477c[_0xbd2b('0x36')],_0x24477c['uniqueid']));_0x20703c[_0xbd2b('0x40')](_0x87f064[_0xbd2b('0x41')]['id'],function(_0x10ad62){try{_0x10ad62=_0x502da1[_0xbd2b('0x42')](_0x10ad62);logger[_0xbd2b('0x3c')](_0xbd2b('0x43'),JSON['stringify'](_0x10ad62,null,0x2));if(_0x10ad62[_0xbd2b('0x21')]===_0xbd2b('0x44')){logger[_0xbd2b('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x24477c['context']=_0x10ad62['context']||_0x24477c[_0xbd2b('0x45')];_0x24477c[_0xbd2b('0x46')]=_0x10ad62[_0xbd2b('0x46')];_0x24477c[_0xbd2b('0x47')]=_0x10ad62[_0xbd2b('0x47')]?_0x10ad62['priority']-0x1:0x1;return null;}else if(_0x10ad62&&_0x502da1[_0x10ad62[_0xbd2b('0x21')]]){_0x5c3e4b=_0x502da1[_0x10ad62['agicommand']](_0x10ad62);logger[_0xbd2b('0xf')]('response',JSON[_0xbd2b('0x35')](_0x5c3e4b,null,0x2));if(_0x5c3e4b&&_0x5c3e4b[_0xbd2b('0x48')]===AGI_CODE_SUCCESS&&_0x5c3e4b[_0xbd2b('0x49')]!==AGI_RESULT_ERROR&&!_0x24477c['evtHangup']){logger['debug'](_0xbd2b('0x4a'),getLogFromObject(_0x5c3e4b));return _['isUndefined'](_0x5c3e4b[_0xbd2b('0x49')])?null:_0x5c3e4b[_0xbd2b('0x49')][_0xbd2b('0x4b')]();}else{logger[_0xbd2b('0x14')](_0xbd2b('0x4a'),getLogFromObject(_0x5c3e4b));return null;}}else{logger[_0xbd2b('0x14')](_0xbd2b('0x4c'));return null;}}catch(_0x30c0bd){logger['error'](_0x30c0bd[_0xbd2b('0xd')]);return null;}});if(_0x87f064['finally']){logger['info'](util['format'](_0xbd2b('0x4d'),_0x24477c['arg_1'],_0x24477c[_0xbd2b('0x1a')],_0x24477c[_0xbd2b('0x1b')],_0x24477c[_0xbd2b('0x36')],_0x24477c['uniqueid']));_0x20703c[_0xbd2b('0x40')](_0x87f064['finally']['id'],function(_0x18f9f6){try{_0x18f9f6=_0x502da1[_0xbd2b('0x42')](_0x18f9f6);logger[_0xbd2b('0x3c')](_0xbd2b('0x43'),JSON[_0xbd2b('0x35')](_0x18f9f6,null,0x2));if(_0x18f9f6&&_0x502da1[_0x18f9f6[_0xbd2b('0x21')]]){_0x5c3e4b=_0x502da1[_0x18f9f6['agicommand']](_0x18f9f6);if(_0x5c3e4b){logger[_0xbd2b('0x3c')](_0xbd2b('0x4a'),getLogFromObject(_0x5c3e4b));return _[_0xbd2b('0x4e')](_0x5c3e4b[_0xbd2b('0x49')])?null:_0x5c3e4b[_0xbd2b('0x49')][_0xbd2b('0x4b')]();}else{logger[_0xbd2b('0x14')]('response',getLogFromObject(_0x5c3e4b));return null;}}else{logger[_0xbd2b('0x14')]('agicommand\x20not\x20found');return null;}}catch(_0x3d254d){logger[_0xbd2b('0x14')](_0x3d254d[_0xbd2b('0xd')]);return null;}});}logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x4f'),_0x24477c[_0xbd2b('0x19')],_0x24477c[_0xbd2b('0x1a')],_0x24477c[_0xbd2b('0x1b')],_0x24477c[_0xbd2b('0x36')],_0x24477c[_0xbd2b('0x1c')]));logger['info'](util[_0xbd2b('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x24477c[_0xbd2b('0x45')],_0x24477c['extension'],parseInt(_0x24477c[_0xbd2b('0x47')],0xa)+0x1));_0x24477c[_0xbd2b('0x50')](_0x24477c[_0xbd2b('0x45')],_0x24477c[_0xbd2b('0x46')],parseInt(_0x24477c['priority'],0xa)+0x1);_0x24477c[_0xbd2b('0x37')]();}}else{logger[_0xbd2b('0x14')](util[_0xbd2b('0x10')](_0xbd2b('0x51'),_0x24477c[_0xbd2b('0x19')]));_0x24477c[_0xbd2b('0x50')](_0x24477c['context'],_0x24477c['extension'],parseInt(_0x24477c['priority'],0xa)+0x1);_0x24477c[_0xbd2b('0x37')]();}}else{logger[_0xbd2b('0x14')](util['format'](_0xbd2b('0x52'),_0x24477c[_0xbd2b('0x19')]));_0x24477c[_0xbd2b('0x50')](_0x24477c[_0xbd2b('0x45')],_0x24477c['extension'],parseInt(_0x24477c['priority'],0xa)+0x1);_0x24477c[_0xbd2b('0x37')]();}}function main(){var _0x84f4d0;return utilLicense[_0xbd2b('0x53')]()[_0xbd2b('0x2e')](function(_0xdd9ac5){if(_0xdd9ac5){if(_0xdd9ac5['voice']){if(_0xdd9ac5[_0xbd2b('0x54')]&&_0xdd9ac5['callysquare']>0x0){logger[_0xbd2b('0xf')](util[_0xbd2b('0x10')](_0xbd2b('0x55'),_0xdd9ac5[_0xbd2b('0x54')]));_0x84f4d0=_0xdd9ac5[_0xbd2b('0x54')];}else{logger[_0xbd2b('0xf')](_0xbd2b('0x56'));}}else{logger[_0xbd2b('0xf')](_0xbd2b('0x57'));_0x84f4d0=-0x1;}}})[_0xbd2b('0x30')](function(_0x2a72a0){logger[_0xbd2b('0x14')](_0xbd2b('0x58'),_0x2a72a0[_0xbd2b('0xd')]);})[_0xbd2b('0x59')](function(){var _0x5a9c2e=require(_0xbd2b('0x5a'))(config[_0xbd2b('0x5')]['port'],config['agi']['ip'],_0x84f4d0);_0x5a9c2e['on'](_0xbd2b('0x14'),errorHandler);_0x5a9c2e['on'](_0xbd2b('0x5b'),listeningHandler);_0x5a9c2e['on']('connection',connectionHandler);_0x5a9c2e['on'](_0xbd2b('0x37'),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 521d25f..8b76694 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(_0x28eb20,_0x107702){var _0x5a6f00=function(_0x44bfd2){while(--_0x44bfd2){_0x28eb20['push'](_0x28eb20['shift']());}};_0x5a6f00(++_0x107702);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x387306,_0xb8e0a7){var _0x2773ef=function(_0x52389d){while(--_0x52389d){_0x387306['push'](_0x387306['shift']());}};_0x2773ef(++_0xb8e0a7);}(_0x814b,0x1a2));var _0xb814=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x814b[_0x49aa7d];return _0xdd0d26;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index bc0fd9f..6c3c855 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(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bf35e,_0x4ccc17){_0x5bf35e=_0x5bf35e-0x0;var _0x35b3d7=_0xb10b[_0x5bf35e];return _0x35b3d7;};'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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x5b97f0,_0x2ef08c){var _0x2101a8=function(_0xc40452){while(--_0xc40452){_0x5b97f0['push'](_0x5b97f0['shift']());}};_0x2101a8(++_0x2ef08c);}(_0x7a54,0x106));var _0x47a5=function(_0x3e8543,_0x5f59ed){_0x3e8543=_0x3e8543-0x0;var _0x4ae9ba=_0x7a54[_0x3e8543];return _0x4ae9ba;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 688799c..9abeaab 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 _0xd5e5=['ShowVariable','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','util','client','http','request','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd5e5,0x187));var _0x5d5e=function(_0xe2daf1,_0x1fc8da){_0xe2daf1=_0xe2daf1-0x0;var _0x44c61a=_0xd5e5[_0xe2daf1];return _0x44c61a;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5d5e('0x0'));var _=require('lodash');var util=require(_0x5d5e('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x5d5e('0x2')][_0x5d5e('0x3')]({'port':0x2329});function request(_0x3b58c5,_0x4033dd){return new BPromise(function(_0xff3d1,_0x2818ae){return client[_0x5d5e('0x4')](_0x3b58c5,_0x4033dd)['then'](function(_0x38de77){if(_0x38de77[_0x5d5e('0x5')]){return _0x2818ae(_0x38de77[_0x5d5e('0x5')][_0x5d5e('0x6')]);}else{return _0xff3d1(_0x38de77[_0x5d5e('0x7')]);}})[_0x5d5e('0x8')](function(_0x21e55e){return _0x2818ae(_0x21e55e);});});}exports[_0x5d5e('0x9')]=function(_0x35c3f1){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x35c3f1},'attributes':[_0x5d5e('0xa')]}});};exports[_0x5d5e('0xb')]=function(_0x1af62a){return request(_0x5d5e('0xc'),{'options':{'raw':![],'where':{'id':_0x1af62a},'include':[{'model':_0x5d5e('0xd'),'as':_0x5d5e('0xe')}],'attributes':['id',_0x5d5e('0xf'),_0x5d5e('0x10')]}});};exports[_0x5d5e('0x11')]=function(_0xb09e1e){return request(_0x5d5e('0x12'),{'options':{'where':{'id':_0xb09e1e},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x13')]=function(_0x3a7480){return request(_0x5d5e('0x14'),{'options':{'where':{'id':_0x3a7480},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x15')]=function(_0x1eb073){return request(_0x5d5e('0x16'),{'options':{'where':{'id':_0x1eb073},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x2e47f2){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2e47f2},'attributes':['dsn']}});};exports[_0x5d5e('0x17')]=function(_0x4dfac7){return request('ShowUser',{'options':{'where':{'id':_0x4dfac7},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x18')]=function(_0x219d21){return request(_0x5d5e('0x19'),{'options':{'where':{'id':_0x219d21},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x1a')]=function(_0x4e9bbf){return request(_0x5d5e('0x1b'),{'options':{'where':{'id':_0x4e9bbf},'attributes':[_0x5d5e('0x1c')]}});};exports[_0x5d5e('0x1d')]=function(_0x553c79){return request(_0x5d5e('0x1e'),{'options':{'raw':![],'where':{'id':_0x553c79},'include':[{'model':_0x5d5e('0x1f'),'as':_0x5d5e('0x20')}]}});};exports[_0x5d5e('0x21')]=function(_0x439c11){return request(_0x5d5e('0x22'),{'options':{'where':{'id':_0x439c11},'attributes':['id',_0x5d5e('0xf')]}});};exports['createSmsMessage']=function(_0x7eb0d3){return request(_0x5d5e('0x23'),{'body':_0x7eb0d3});};exports[_0x5d5e('0x24')]=function(_0x2261ae){return request(_0x5d5e('0x25'),{'body':_0x2261ae});};exports[_0x5d5e('0x26')]=function(_0x121402){return request(_0x5d5e('0x27'),{'body':_['merge'](_0x121402,{'project_name':_0x121402['arg_1'],'prev_project_name':_0x121402['arg_2']||'','is_subproject':_0x121402[_0x5d5e('0x28')]?!![]:![],'leaveAt':moment()[_0x5d5e('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x2798ec){return request('CreateSquareRecording',{'body':_0x2798ec});};exports[_0x5d5e('0x2a')]=function(_0xdeebc6){return request(_0x5d5e('0x2b'),{'body':_0xdeebc6});};exports[_0x5d5e('0x2c')]=function(_0x5132a4){return request(_0x5d5e('0x2d'),{'options':{'raw':![],'where':{'phone':_0x5132a4[_0x5d5e('0x2e')],'ListId':_0x5132a4[_0x5d5e('0x2f')]}}})[_0x5d5e('0x30')](function(_0x2b76b1){if(_0x2b76b1){return _0x2b76b1;}return request(_0x5d5e('0x31'),{'body':_0x5132a4});});};exports[_0x5d5e('0x32')]=function(_0x352487){return request(_0x5d5e('0x33'),{'options':{'where':{'id':_0x352487},'attributes':[_0x5d5e('0xf')]}});};exports[_0x5d5e('0x34')]=function(_0x41cdfc,_0x265532){return request(_0x5d5e('0x35'),{'body':{'interface':_0x265532},'options':{'where':_0x41cdfc}});};exports[_0x5d5e('0x36')]=function(_0x1d4066,_0x569427,_0x1f0bd9){return request(_0x5d5e('0x37'),{'body':{'type':_0x569427,'uniqueid':_0x1f0bd9},'options':{'where':_0x1d4066}});};exports['agentUnpause']=function(_0x192b07){return request(_0x5d5e('0x38'),{'body':{},'options':{'where':_0x192b07}});};exports[_0x5d5e('0x39')]=function(_0x5328d7){return request(_0x5d5e('0x3a'),{'body':{},'options':{'where':_0x5328d7}});}; \ No newline at end of file +var _0x969d=['getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ListId','then','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','client','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getUserById','ShowUser'];(function(_0x36036b,_0x4a340e){var _0x53d323=function(_0x5e78ad){while(--_0x5e78ad){_0x36036b['push'](_0x36036b['shift']());}};_0x53d323(++_0x4a340e);}(_0x969d,0xf7));var _0xd969=function(_0x1daff3,_0x3288c7){_0x1daff3=_0x1daff3-0x0;var _0x310f88=_0x969d[_0x1daff3];return _0x310f88;};'use strict';var BPromise=require(_0xd969('0x0'));var moment=require(_0xd969('0x1'));var _=require(_0xd969('0x2'));var util=require(_0xd969('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xd969('0x4')]['http']({'port':0x2329});function request(_0x1f13c7,_0x5139f0){return new BPromise(function(_0x5443a2,_0x42f2d2){return client['request'](_0x1f13c7,_0x5139f0)['then'](function(_0x2e1b2a){if(_0x2e1b2a[_0xd969('0x5')]){return _0x42f2d2(_0x2e1b2a['error'][_0xd969('0x6')]);}else{return _0x5443a2(_0x2e1b2a[_0xd969('0x7')]);}})[_0xd969('0x8')](function(_0x31cdc9){return _0x42f2d2(_0x31cdc9);});});}exports[_0xd969('0x9')]=function(_0x10454a){return request(_0xd969('0xa'),{'options':{'raw':![],'where':{'name':_0x10454a},'attributes':[_0xd969('0xb')]}});};exports[_0xd969('0xc')]=function(_0x5ee5c0){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x5ee5c0},'include':[{'model':_0xd969('0xd'),'as':_0xd969('0xe')}],'attributes':['id',_0xd969('0xf'),_0xd969('0x10')]}});};exports[_0xd969('0x11')]=function(_0x546917){return request('ShowSquareProject',{'options':{'where':{'id':_0x546917},'attributes':[_0xd969('0xf')]}});};exports['getVoiceQueueById']=function(_0x2c2eca){return request(_0xd969('0x12'),{'options':{'where':{'id':_0x2c2eca},'attributes':[_0xd969('0xf')]}});};exports[_0xd969('0x13')]=function(_0x4b1fe7){return request(_0xd969('0x14'),{'options':{'where':{'id':_0x4b1fe7},'attributes':[_0xd969('0xf')]}});};exports['getSquareOdbcById']=function(_0x2ad608){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2ad608},'attributes':['dsn']}});};exports[_0xd969('0x15')]=function(_0x4d1e63){return request(_0xd969('0x16'),{'options':{'where':{'id':_0x4d1e63},'attributes':[_0xd969('0xf')]}});};exports[_0xd969('0x17')]=function(_0x2ae511){return request(_0xd969('0x18'),{'options':{'where':{'id':_0x2ae511},'attributes':[_0xd969('0xf')]}});};exports[_0xd969('0x19')]=function(_0x2e5900){return request(_0xd969('0x1a'),{'options':{'where':{'id':_0x2e5900},'attributes':[_0xd969('0x1b')]}});};exports['getIntervalById']=function(_0x20484a){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x20484a},'include':[{'model':_0xd969('0x1c'),'as':_0xd969('0x1d')}]}});};exports['getSmsAccountById']=function(_0x56023d){return request(_0xd969('0x1e'),{'options':{'where':{'id':_0x56023d},'attributes':['id',_0xd969('0xf')]}});};exports[_0xd969('0x1f')]=function(_0x2fa3a5){return request('CreateSmsMessage',{'body':_0x2fa3a5});};exports[_0xd969('0x20')]=function(_0x5b87d6){return request(_0xd969('0x21'),{'body':_0x5b87d6});};exports[_0xd969('0x22')]=function(_0x18c71b){return request(_0xd969('0x23'),{'body':_[_0xd969('0x24')](_0x18c71b,{'project_name':_0x18c71b[_0xd969('0x25')],'prev_project_name':_0x18c71b[_0xd969('0x26')]||'','is_subproject':_0x18c71b[_0xd969('0x26')]?!![]:![],'leaveAt':moment()[_0xd969('0x27')](_0xd969('0x28'))})});};exports[_0xd969('0x29')]=function(_0x5141ac){return request(_0xd969('0x2a'),{'body':_0x5141ac});};exports[_0xd969('0x2b')]=function(_0xc0cda1){return request('CreateSquareMessage',{'body':_0xc0cda1});};exports[_0xd969('0x2c')]=function(_0x55e199){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x55e199['phone'],'ListId':_0x55e199[_0xd969('0x2d')]}}})[_0xd969('0x2e')](function(_0x4167b3){if(_0x4167b3){return _0x4167b3;}return request('CreateCmContact',{'body':_0x55e199});});};exports['getPauseById']=function(_0xaf09ef){return request(_0xd969('0x2f'),{'options':{'where':{'id':_0xaf09ef},'attributes':[_0xd969('0xf')]}});};exports[_0xd969('0x30')]=function(_0xa20a8f,_0x2535bb){return request('LoginUser',{'body':{'interface':_0x2535bb},'options':{'where':_0xa20a8f}});};exports[_0xd969('0x31')]=function(_0x4d4217,_0x637eee,_0x4af0d0){return request(_0xd969('0x32'),{'body':{'type':_0x637eee,'uniqueid':_0x4af0d0},'options':{'where':_0x4d4217}});};exports[_0xd969('0x33')]=function(_0xc1a381){return request(_0xd969('0x34'),{'body':{},'options':{'where':_0xc1a381}});};exports['agentLogout']=function(_0x33bfd7){return request(_0xd969('0x35'),{'body':{},'options':{'where':_0x33bfd7}});}; \ 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 984691f..2b8d424 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 _0x398b=['./lex','./polly'];(function(_0x1b8388,_0x29b46d){var _0x3a3567=function(_0x413214){while(--_0x413214){_0x1b8388['push'](_0x1b8388['shift']());}};_0x3a3567(++_0x29b46d);}(_0x398b,0x103));var _0xb398=function(_0x20076b,_0x4f218e){_0x20076b=_0x20076b-0x0;var _0x1ae3de=_0x398b[_0x20076b];return _0x1ae3de;};var polly=require(_0xb398('0x0'));var lex=require(_0xb398('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xfa26=['./polly','./lex','exports'];(function(_0x2e7aae,_0x5090cb){var _0x512de0=function(_0x4f47bb){while(--_0x4f47bb){_0x2e7aae['push'](_0x2e7aae['shift']());}};_0x512de0(++_0x5090cb);}(_0xfa26,0x17a));var _0x6fa2=function(_0x570b5,_0x173329){_0x570b5=_0x570b5-0x0;var _0x15e771=_0xfa26[_0x570b5];return _0x15e771;};var polly=require(_0x6fa2('0x0'));var lex=require(_0x6fa2('0x1'));module[_0x6fa2('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 516b939..c943612 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 _0xc2cc=['exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc2cc,0x70));var _0xcc2c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc2cc[_0x2c91e9];return _0x13f0ff;};'use strict';var lex=require('./lib/api');module[_0xcc2c('0x0')]=function(_0x1a1db8,_0x2d2c3a,_0x5aad8f,_0x2a1a4a,_0x52a81b,_0x23bd62){return lex(_0x1a1db8,_0x2d2c3a,_0x5aad8f,_0x2a1a4a,_0x52a81b,_0x23bd62);}; \ No newline at end of file +var _0x049e=['./lib/api','exports'];(function(_0x460cd0,_0x557cbf){var _0x49a7c4=function(_0x54609f){while(--_0x54609f){_0x460cd0['push'](_0x460cd0['shift']());}};_0x49a7c4(++_0x557cbf);}(_0x049e,0x16a));var _0xe049=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0x049e[_0x4b4b0e];return _0x4c2d91;};'use strict';var lex=require(_0xe049('0x0'));module[_0xe049('0x1')]=function(_0x5efb24,_0x30ed85,_0x47aa93,_0x155cb3,_0x13cc6a,_0xb492b8){return lex(_0x5efb24,_0x30ed85,_0x47aa93,_0x155cb3,_0x13cc6a,_0xb492b8);}; \ 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 f06590f..0328c33 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 _0x0295=['bluebird','aws-sdk','slots','hasOwnProperty','slot_','LexRuntime','$LATEST'];(function(_0x4229dc,_0x5e27dc){var _0x54a47e=function(_0x329957){while(--_0x329957){_0x4229dc['push'](_0x4229dc['shift']());}};_0x54a47e(++_0x5e27dc);}(_0x0295,0x126));var _0x5029=function(_0x2673a4,_0x4d0b8d){_0x2673a4=_0x2673a4-0x0;var _0x5e3a6a=_0x0295[_0x2673a4];return _0x5e3a6a;};'use strict';var BPromise=require(_0x5029('0x0'));var AWS=require(_0x5029('0x1'));function lexResult(_0x24f567,_0x55fb35){return new BPromise(function(_0x5d9052,_0x2eab25){_0x24f567['postText'](_0x55fb35,function(_0x57beab,_0x3bbeea){if(_0x57beab){_0x2eab25(_0x57beab);}if(_0x3bbeea[_0x5029('0x2')]){for(const _0x1715ae in _0x3bbeea[_0x5029('0x2')]){if(_0x3bbeea['slots'][_0x5029('0x3')](_0x1715ae)){var _0x4c31b7=_0x3bbeea[_0x5029('0x2')][_0x1715ae];_0x3bbeea[_0x5029('0x4')+_0x1715ae]=_0x4c31b7;}}}_0x5d9052(_0x3bbeea);});});}module['exports']=function(_0x17414e,_0x4f2f63,_0x1d8c62,_0x213837,_0x4b5a9f,_0x34b273){var _0x2b6793=new AWS[(_0x5029('0x5'))]({'accessKeyId':_0x4f2f63,'secretAccessKey':_0x1d8c62,'region':_0x213837});var _0x19f3f9={'botAlias':_0x5029('0x6'),'botName':_0x34b273,'inputText':_0x4b5a9f,'userId':_0x17414e};return lexResult(_0x2b6793,_0x19f3f9);}; \ No newline at end of file +var _0x3468=['slots','hasOwnProperty','slot_','exports','bluebird','aws-sdk','postText'];(function(_0x41f2f3,_0x4e87fa){var _0xb77414=function(_0x579c05){while(--_0x579c05){_0x41f2f3['push'](_0x41f2f3['shift']());}};_0xb77414(++_0x4e87fa);}(_0x3468,0x1c4));var _0x8346=function(_0x378527,_0xe25d1a){_0x378527=_0x378527-0x0;var _0x1eb1d6=_0x3468[_0x378527];return _0x1eb1d6;};'use strict';var BPromise=require(_0x8346('0x0'));var AWS=require(_0x8346('0x1'));function lexResult(_0x53849f,_0x532ad5){return new BPromise(function(_0x34133d,_0x7e5a28){_0x53849f[_0x8346('0x2')](_0x532ad5,function(_0x5abf3e,_0x2b4c03){if(_0x5abf3e){_0x7e5a28(_0x5abf3e);}if(_0x2b4c03[_0x8346('0x3')]){for(const _0x1a319f in _0x2b4c03[_0x8346('0x3')]){if(_0x2b4c03[_0x8346('0x3')][_0x8346('0x4')](_0x1a319f)){var _0x5719d6=_0x2b4c03[_0x8346('0x3')][_0x1a319f];_0x2b4c03[_0x8346('0x5')+_0x1a319f]=_0x5719d6;}}}_0x34133d(_0x2b4c03);});});}module[_0x8346('0x6')]=function(_0x172ef0,_0x1baf40,_0x344bdc,_0xdbdde8,_0x44b6bb,_0x1af1ab){var _0x382fd9=new AWS['LexRuntime']({'accessKeyId':_0x1baf40,'secretAccessKey':_0x344bdc,'region':_0xdbdde8});var _0xc31156={'botAlias':'$LATEST','botName':_0x1af1ab,'inputText':_0x44b6bb,'userId':_0x172ef0};return lexResult(_0x382fd9,_0xc31156);}; \ 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 6543e43..7240104 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 _0x1053=['./lib/api','exports'];(function(_0x33670a,_0x55e188){var _0x36ad1d=function(_0x3cacbb){while(--_0x3cacbb){_0x33670a['push'](_0x33670a['shift']());}};_0x36ad1d(++_0x55e188);}(_0x1053,0xfc));var _0x3105=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x1053[_0x23a79e];return _0x3dab57;};'use strict';var polly=require(_0x3105('0x0'));module[_0x3105('0x1')]=function(_0x5dbf72,_0x42e747,_0x444b59,_0x32e90d,_0x4b86ef,_0x46d162,_0x168254){return polly(_0x5dbf72,_0x42e747,_0x444b59,_0x32e90d,_0x4b86ef,_0x46d162,_0x168254);}; \ No newline at end of file +var _0x3d10=['./lib/api'];(function(_0x3004a3,_0xffae32){var _0x14734d=function(_0xd35074){while(--_0xd35074){_0x3004a3['push'](_0x3004a3['shift']());}};_0x14734d(++_0xffae32);}(_0x3d10,0x7b));var _0x03d1=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x3d10[_0x3c2b2e];return _0x27a338;};'use strict';var polly=require(_0x03d1('0x0'));module['exports']=function(_0x178f39,_0x5b80a7,_0xbf33f7,_0x22962c,_0x49b0f9,_0x49f8ba,_0x2f60dd){return polly(_0x178f39,_0x5b80a7,_0xbf33f7,_0x22962c,_0x49b0f9,_0x49f8ba,_0x2f60dd);}; \ 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 198b213..3565f94 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 _0x2c01=['path','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3'];(function(_0x549978,_0x57b49c){var _0x40aad6=function(_0x1e678d){while(--_0x1e678d){_0x549978['push'](_0x549978['shift']());}};_0x40aad6(++_0x57b49c);}(_0x2c01,0x118));var _0x12c0=function(_0x52c021,_0x5eb3bf){_0x52c021=_0x52c021-0x0;var _0x4e50f6=_0x2c01[_0x52c021];return _0x4e50f6;};'use strict';var fs=require('fs');var path=require(_0x12c0('0x0'));var BPromise=require('bluebird');var rs=require(_0x12c0('0x1'));var AWS=require(_0x12c0('0x2'));function pollyResult(_0x23ce47,_0x888add,_0x5014d5){return new BPromise(function(_0x3f4d42,_0x930456){_0x23ce47[_0x12c0('0x3')](_0x888add,function(_0x373592,_0x383b30){if(_0x373592){_0x930456(_0x373592);}else if(_0x383b30){if(_0x383b30['AudioStream']instanceof Buffer){fs[_0x12c0('0x4')](_0x5014d5,_0x383b30[_0x12c0('0x5')],function(_0x104537){if(_0x104537){_0x930456(_0x104537);}else{_0x3f4d42();}});}else{_0x930456(new Error(_0x12c0('0x6')));}}else{_0x930456(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x12c0('0x7')]=function(_0x5caea7,_0x8b1ee2,_0x3ed38a,_0x44651b,_0x3b5807,_0x34bbed,_0x4c1b62){var _0x520d1d=new AWS['Polly']({'accessKeyId':_0x5caea7,'secretAccessKey':_0x8b1ee2,'region':_0x3ed38a});var _0x29e658={'Text':_0x3b5807,'TextType':_0x34bbed||_0x12c0('0x8'),'OutputFormat':_0x12c0('0x9'),'VoiceId':_0x44651b};return pollyResult(_0x520d1d,_0x29e658,_0x4c1b62);}; \ No newline at end of file +var _0x89bc=['exports','Polly','text','mp3','path','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x29ab81,_0x1e54df){var _0x4146e1=function(_0x178445){while(--_0x178445){_0x29ab81['push'](_0x29ab81['shift']());}};_0x4146e1(++_0x1e54df);}(_0x89bc,0xb4));var _0xc89b=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x89bc[_0x8b8564];return _0x360c61;};'use strict';var fs=require('fs');var path=require(_0xc89b('0x0'));var BPromise=require('bluebird');var rs=require(_0xc89b('0x1'));var AWS=require(_0xc89b('0x2'));function pollyResult(_0x201fb8,_0x580c8e,_0x30d037){return new BPromise(function(_0x3bfe52,_0x1bae78){_0x201fb8['synthesizeSpeech'](_0x580c8e,function(_0x282997,_0x32e3bd){if(_0x282997){_0x1bae78(_0x282997);}else if(_0x32e3bd){if(_0x32e3bd[_0xc89b('0x3')]instanceof Buffer){fs[_0xc89b('0x4')](_0x30d037,_0x32e3bd[_0xc89b('0x3')],function(_0x5beaea){if(_0x5beaea){_0x1bae78(_0x5beaea);}else{_0x3bfe52();}});}else{_0x1bae78(new Error(_0xc89b('0x5')));}}else{_0x1bae78(new Error(_0xc89b('0x6')));}});});}module[_0xc89b('0x7')]=function(_0x1ff28e,_0x2dd86d,_0x40f9ea,_0x3d263d,_0x2e58c6,_0x584008,_0x39aaa9){var _0x29e7ae=new AWS[(_0xc89b('0x8'))]({'accessKeyId':_0x1ff28e,'secretAccessKey':_0x2dd86d,'region':_0x40f9ea});var _0x17e4a0={'Text':_0x2e58c6,'TextType':_0x584008||_0xc89b('0x9'),'OutputFormat':_0xc89b('0xa'),'VoiceId':_0x3d263d};return pollyResult(_0x29e7ae,_0x17e4a0,_0x39aaa9);}; \ 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 a994e2c..52031a6 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf3d=['./lib/api','exports'];(function(_0x4f809a,_0x28799f){var _0x23229e=function(_0x22f93d){while(--_0x22f93d){_0x4f809a['push'](_0x4f809a['shift']());}};_0x23229e(++_0x28799f);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x56f6fe,_0x3fe499){_0x56f6fe=_0x56f6fe-0x0;var _0x3f800b=_0xcf3d[_0x56f6fe];return _0x3f800b;};'use strict';var asr=require(_0xdcf3('0x0'));module[_0xdcf3('0x1')]=function(_0x143cc3,_0x918c7e,_0x4d0576,_0x291dd2){return asr(_0x143cc3,_0x918c7e,_0x4d0576);}; \ No newline at end of file +var _0x51c5=['exports','./lib/api'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x51c5,0x8f));var _0x551c=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x51c5[_0xef8146];return _0x5a6cb0;};'use strict';var asr=require(_0x551c('0x0'));module[_0x551c('0x1')]=function(_0x3bdc26,_0x2d6573,_0x3b6f53,_0x2279a3){return asr(_0x3bdc26,_0x2d6573,_0x3b6f53);}; \ 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 a541de0..56fba0d 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 _0xb0b1=['length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x5087b7,_0x117485){var _0x3b4c2b=function(_0x3d25db){while(--_0x3d25db){_0x5087b7['push'](_0x5087b7['shift']());}};_0x3b4c2b(++_0x117485);}(_0xb0b1,0x15c));var _0x1b0b=function(_0x553104,_0x38e4c0){_0x553104=_0x553104-0x0;var _0x4a19ef=_0xb0b1[_0x553104];return _0x4a19ef;};'use strict';var url=require('url');var BPromise=require(_0x1b0b('0x0'));var fs=require('fs');var host=_0x1b0b('0x1');module[_0x1b0b('0x2')]=function(_0x2f0067,_0xae6965,_0x352381){return new BPromise(function(_0x44fa4a,_0x34bcc7){var _0x135371;if(typeof _0x2f0067!==_0x1b0b('0x3')||_0x2f0067[_0x1b0b('0x4')]===0x0){return _0x34bcc7('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xae6965!==_0x1b0b('0x3')||_0xae6965[_0x1b0b('0x4')]===0x0){return _0x34bcc7('key\x20should\x20be\x20a\x20string');}if(typeof _0x352381!==_0x1b0b('0x5')&&(typeof _0x352381!==_0x1b0b('0x3')||_0x352381[_0x1b0b('0x4')]===0x0)){return _0x34bcc7(_0x1b0b('0x6'));}try{_0x135371=fs[_0x1b0b('0x7')](_0x2f0067)['toString']('base64');}catch(_0x312bcc){return _0x34bcc7(_0x312bcc);}return _0x44fa4a({'method':'POST','uri':host+_0x1b0b('0x8')+_0xae6965,'body':{'config':{'encoding':_0x1b0b('0x9'),'sampleRateHertz':_0x1b0b('0xa'),'languageCode':_0x352381},'audio':{'content':_0x135371}},'json':!![]});});}; \ No newline at end of file +var _0x5715=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x5715,0x1b2));var _0x5571=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x5715[_0xc69f39];return _0x93be41;};'use strict';var url=require(_0x5571('0x0'));var BPromise=require(_0x5571('0x1'));var fs=require('fs');var host=_0x5571('0x2');module['exports']=function(_0x2dafa9,_0x581f3f,_0x3ba543){return new BPromise(function(_0x37585d,_0x2e3e22){var _0x2818a4;if(typeof _0x2dafa9!==_0x5571('0x3')||_0x2dafa9['length']===0x0){return _0x2e3e22('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x581f3f!==_0x5571('0x3')||_0x581f3f[_0x5571('0x4')]===0x0){return _0x2e3e22(_0x5571('0x5'));}if(typeof _0x3ba543!==_0x5571('0x6')&&(typeof _0x3ba543!=='string'||_0x3ba543[_0x5571('0x4')]===0x0)){return _0x2e3e22('lang\x20should\x20be\x20a\x20string');}try{_0x2818a4=fs[_0x5571('0x7')](_0x2dafa9)[_0x5571('0x8')](_0x5571('0x9'));}catch(_0x16712e){return _0x2e3e22(_0x16712e);}return _0x37585d({'method':_0x5571('0xa'),'uri':host+_0x5571('0xb')+_0x581f3f,'body':{'config':{'encoding':_0x5571('0xc'),'sampleRateHertz':'8000','languageCode':_0x3ba543},'audio':{'content':_0x2818a4}},'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 e3869e5..56f03a1 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 _0x3e74=['./asr'];(function(_0x2a5306,_0x3789ea){var _0x2c210=function(_0x2dc98e){while(--_0x2dc98e){_0x2a5306['push'](_0x2a5306['shift']());}};_0x2c210(++_0x3789ea);}(_0x3e74,0x175));var _0x43e7=function(_0x55f7e6,_0x3757a1){_0x55f7e6=_0x55f7e6-0x0;var _0x26c753=_0x3e74[_0x55f7e6];return _0x26c753;};var asr=require(_0x43e7('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x70e0=['exports','./asr'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x70e0,0x17b));var _0x070e=function(_0x47c84e,_0xdca33a){_0x47c84e=_0x47c84e-0x0;var _0xd5d9e9=_0x70e0[_0x47c84e];return _0xd5d9e9;};var asr=require(_0x070e('0x0'));module[_0x070e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 1336dd0..6f7cdcb 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 _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x2ec5a1,_0x489308){var _0x1a1881=function(_0x3f8f78){while(--_0x3f8f78){_0x2ec5a1['push'](_0x2ec5a1['shift']());}};_0x1a1881(++_0x489308);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;}; \ No newline at end of file +var _0xb10b=['url','parse','randomstring','sox','request-promise','util','querystring','moment','apiai-promise','md5','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','.wav','base64','then','readFileSync','toString','googleTTS','resolve','generate','.mp3','goggleTTS\x20path','split','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','chmodSync','777','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0xb10b,0x12a));var _0xbb10=function(_0xec919c,_0x45c528){_0xec919c=_0xec919c-0x0;var _0x516869=_0xb10b[_0xec919c];return _0x516869;};'use strict';var fs=require('fs');var path=require(_0xbb10('0x0'));var http=require('http');var https=require(_0xbb10('0x1'));var urlParse=require(_0xbb10('0x2'))[_0xbb10('0x3')];var BPromise=require('bluebird');var rs=require(_0xbb10('0x4'));var sox=require(_0xbb10('0x5'));var rp=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var querystring=require(_0xbb10('0x8'));var moment=require(_0xbb10('0x9'));var tts=require('google-tts-api');var apiai=require(_0xbb10('0xa'));var md5=require(_0xbb10('0xb'));var google=require('./google');var aws=require(_0xbb10('0xc'));var tilde=require(_0xbb10('0xd'));var sestek=require(_0xbb10('0xe'));var logger=require(_0xbb10('0xf'))(_0xbb10('0x10'));var ISPEECH_API=_0xbb10('0x11');function downloadFile(_0x229887,_0xa3adc8){return new BPromise(function(_0x5ab04a,_0x4e47f8){var _0x20bd61=urlParse(_0x229887);var _0x118a74=_0x20bd61[_0xbb10('0x12')]==='https:'?https:http;var _0x408248={'host':_0x20bd61['host'],'path':_0x20bd61[_0xbb10('0x0')],'headers':{'user-agent':_0xbb10('0x13')}};_0x118a74[_0xbb10('0x14')](_0x408248,function(_0x193a27){if(_0x193a27[_0xbb10('0x15')]!==0xc8){logger[_0xbb10('0x16')]('request\x20to\x20'+_0x229887+_0xbb10('0x17')+_0x193a27[_0xbb10('0x15')]+'\x20('+_0x193a27[_0xbb10('0x18')]+')');_0x4e47f8(new Error(_0xbb10('0x19')+_0x229887+_0xbb10('0x17')+_0x193a27[_0xbb10('0x15')]+'\x20('+_0x193a27[_0xbb10('0x18')]+')'));return;}var _0x36b5e8=fs[_0xbb10('0x1a')](_0xa3adc8);_0x36b5e8['on'](_0xbb10('0x1b'),function(){logger['info'](_0xbb10('0x1c'));_0x36b5e8[_0xbb10('0x1d')](_0x5ab04a);});_0x36b5e8['on'](_0xbb10('0x16'),function(_0x42db98){fs[_0xbb10('0x1e')](_0xa3adc8);logger[_0xbb10('0x16')](_0xbb10('0x1f'),_0x42db98);_0x4e47f8(_0x42db98);});_0x193a27[_0xbb10('0x20')](_0x36b5e8);})['on'](_0xbb10('0x16'),function(_0xe1c665){logger['error'](_0xe1c665);_0x4e47f8(_0xe1c665);})[_0xbb10('0x21')]();});}function uploadFile(_0x19f48d){return new BPromise(function(_0x388fab,_0x109908){var _0xdf237d=urlParse(_0x19f48d);var _0x44e563=_0xdf237d['protocol']===_0xbb10('0x22')?https:http;var _0x12ef77={'host':_0xdf237d['host'],'path':_0xdf237d['path'],'headers':{'user-agent':_0xbb10('0x13')}};_0x44e563[_0xbb10('0x14')](_0x12ef77,function(_0x2e911d){if(_0x2e911d[_0xbb10('0x15')]!==0xc8){_0x109908(new Error(_0xbb10('0x19')+_0x19f48d+_0xbb10('0x17')+_0x2e911d[_0xbb10('0x15')]+'\x20('+_0x2e911d[_0xbb10('0x18')]+')'));return;}var _0x7f2377='';_0x2e911d['on'](_0xbb10('0x23'),function(_0x3ba6cd){_0x7f2377+=_0x3ba6cd;});_0x2e911d['on'](_0xbb10('0x21'),function(){_0x388fab(_0x7f2377);});})['on']('error',function(_0x4fedac){_0x109908(_0x4fedac);})['end']();});}function convertFile(_0xc93a04,_0x3c5ae7){return new BPromise(function(_0x2c89b9,_0x4e25ff){var _0x2fdde9=sox[_0xbb10('0x24')](_0xc93a04,_0x3c5ae7,{'sampleRate':0x1f40,'format':_0xbb10('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2fdde9['on'](_0xbb10('0x16'),function(_0x1acce9){logger[_0xbb10('0x16')](_0xbb10('0x26'),_0x1acce9);_0x4e25ff(_0x1acce9);});_0x2fdde9['on']('end',function(){logger[_0xbb10('0x27')](_0xbb10('0x28'));_0x2c89b9();});_0x2fdde9[_0xbb10('0x29')]();});}function base64Decode(_0x2e0249,_0x1d30aa){var _0x2ff4c1=path['resolve'](__dirname,_0xbb10('0x2a'),rs['generate'](0x4)+_0xbb10('0x2b'));fs['writeFileSync'](_0x2ff4c1,_0x2e0249,_0xbb10('0x2c'));return convertFile(_0x2ff4c1,_0x1d30aa)[_0xbb10('0x2d')](function(){try{fs[_0xbb10('0x1e')](_0x2ff4c1);fs['chmodSync'](_0x1d30aa,'777');}catch(_0x4c3744){logger[_0xbb10('0x16')](_0x4c3744);}return _0x1d30aa['split']('.')[0x0];});}function base64Encode(_0x359ad4){var _0x37dde7=fs[_0xbb10('0x2e')](_0x359ad4);return new Buffer(_0x37dde7)[_0xbb10('0x2f')](_0xbb10('0x2c'));}exports[_0xbb10('0x30')]=function(_0xf85197,_0x4975f5){var _0x25acb3,_0x1da9c9;return tts(_0xf85197,_0x4975f5||'en',0x1)[_0xbb10('0x2d')](function(_0x8c1ce6){logger[_0xbb10('0x27')](_0x8c1ce6);_0x25acb3=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x33'));return downloadFile(_0x8c1ce6,_0x25acb3);})['then'](function(){_0x1da9c9=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b'));return convertFile(_0x25acb3,_0x1da9c9);})['then'](function(){try{fs[_0xbb10('0x1e')](_0x25acb3);fs['chmodSync'](_0x1da9c9,'777');}catch(_0x3eb3cc){logger[_0xbb10('0x16')](_0x3eb3cc);}logger[_0xbb10('0x27')](_0xbb10('0x34'),_0x1da9c9[_0xbb10('0x35')]('.')[0x0]);return _0x1da9c9[_0xbb10('0x35')]('.')[0x0];});};exports['googleASR']=function(_0x1e5bbd,_0x25d72f,_0x52de31){return google['asr'](_0x1e5bbd,_0x25d72f,_0x52de31)['then'](function(_0x31bee3){logger[_0xbb10('0x27')](_0x31bee3[_0xbb10('0x36')]);return rp(_0x31bee3);})['then'](function(_0x3c0cd7){var _0x3e8538='';var _0x4345f3=0x0;try{fs['unlink'](_0x1e5bbd);}catch(_0x17b6c5){logger[_0xbb10('0x16')](_0x17b6c5);}if(_0x3c0cd7&&_0x3c0cd7[_0xbb10('0x37')]){_0x3e8538=_0x3c0cd7[_0xbb10('0x37')]['map'](function(_0xd238e9){return _0xd238e9&&_0xd238e9[_0xbb10('0x38')][0x0]&&_0xd238e9['alternatives'][0x0][_0xbb10('0x39')]?_0xd238e9[_0xbb10('0x38')][0x0][_0xbb10('0x39')]:'';})[_0xbb10('0x3a')]('\x0a');_0x4345f3=_0x3c0cd7[_0xbb10('0x37')][_0xbb10('0x3b')](function(_0x5f3d67){return _0x5f3d67&&_0x5f3d67[_0xbb10('0x38')][0x0]&&_0x5f3d67[_0xbb10('0x38')][0x0][_0xbb10('0x3c')]?_0x5f3d67[_0xbb10('0x38')][0x0]['confidence']:0x0;})[_0xbb10('0x3a')]('\x0a');}logger[_0xbb10('0x27')](_0xbb10('0x3d'),_0x3e8538);logger[_0xbb10('0x27')]('googleASR\x20confidence',_0x4345f3);return{'transcript':_0x3e8538,'confidence':_0x4345f3};})[_0xbb10('0x3e')](function(_0x202c60){logger['error']('[%s]\x20%s:%s',_0x202c60[_0xbb10('0x15')],_0x202c60['name'],_0x202c60[_0xbb10('0x3f')]);});};exports[_0xbb10('0x40')]=function(_0x4c66d8,_0x366608,_0x1d82bf,_0x474e99){var _0x5cf4f8=apiai(_0x366608,{'language':_0x474e99||'en'});return _0x5cf4f8[_0xbb10('0x41')](_0x1d82bf,{'sessionId':md5(_0x4c66d8)})[_0xbb10('0x2d')](function(_0x3b9fdf){logger[_0xbb10('0x27')](JSON[_0xbb10('0x42')](_0x3b9fdf));return{'source':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x44')],'resolvedQuery':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x45')],'action':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x46')],'actionIncomplete':_0x3b9fdf[_0xbb10('0x43')]['actionIncomplete'],'speech':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x47')]['speech'],'score':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x48')],'statusCode':_0x3b9fdf[_0xbb10('0x49')][_0xbb10('0x4a')],'endConversation':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x4b')][_0xbb10('0x4c')]||![],'isFallbackIntent':_0x3b9fdf['result']['metadata'][_0xbb10('0x4d')]};});};exports[_0xbb10('0x4e')]=function(_0x2b12bd,_0x57d2c0,_0x5f0c12,_0x3cd6f3){return tilde[_0xbb10('0x4f')](_0x2b12bd,_0x57d2c0,_0x5f0c12,_0x3cd6f3)[_0xbb10('0x2d')](function(_0xf820fe){try{fs[_0xbb10('0x1e')](_0x2b12bd);}catch(_0x22b315){logger[_0xbb10('0x16')](_0x22b315);}logger[_0xbb10('0x27')](_0xbb10('0x50'),_0xf820fe[_0xbb10('0x39')]);logger['info']('Tilde\x20ASR\x20confidence',_0xf820fe[_0xbb10('0x3c')]);return _0xf820fe;});};exports[_0xbb10('0x51')]=function(_0x36ab7d,_0xb014b0,_0x36aa7d,_0x440f9e,_0x358e7e,_0x445870){var _0x1c0d8f=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x33'));var _0x2e6fd9;return aws[_0xbb10('0x52')](_0x36ab7d,_0xb014b0,_0x36aa7d,_0x440f9e,_0x358e7e,_0x445870,_0x1c0d8f)['then'](function(){_0x2e6fd9=path[_0xbb10('0x31')](__dirname,'tmp',rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b'));return convertFile(_0x1c0d8f,_0x2e6fd9);})[_0xbb10('0x2d')](function(){try{fs[_0xbb10('0x1e')](_0x1c0d8f);fs[_0xbb10('0x53')](_0x2e6fd9,_0xbb10('0x54'));}catch(_0x2e3326){logger[_0xbb10('0x16')](_0x2e3326);}return _0x2e6fd9[_0xbb10('0x35')]('.')[0x0];});};exports[_0xbb10('0x55')]=function(_0x44a056,_0x1c2dce,_0x1d49e1,_0x3d7e17,_0x4475e1,_0x5de0cc){return aws[_0xbb10('0x56')](_0x44a056,_0x1c2dce,_0x1d49e1,_0x3d7e17,_0x4475e1,_0x5de0cc)[_0xbb10('0x2d')](function(_0x1b83a9){logger[_0xbb10('0x27')](JSON[_0xbb10('0x42')](_0x1b83a9));return _0x1b83a9;});};exports[_0xbb10('0x57')]=function(_0x4bedd0,_0x120bda,_0x4731ce,_0x2909a1){var _0x14fed3=util[_0xbb10('0x58')](_0xbb10('0x59'),ISPEECH_API,_0x4bedd0,encodeURIComponent(_0x120bda),_0x4731ce,_0x2909a1);var _0x175872=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x33'));var _0x2a1ce1;return downloadFile(_0x14fed3,_0x175872)[_0xbb10('0x2d')](function(){_0x2a1ce1=path['resolve'](__dirname,'tmp',rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b'));return convertFile(_0x175872,_0x2a1ce1);})[_0xbb10('0x2d')](function(){try{fs[_0xbb10('0x1e')](_0x175872);fs['chmodSync'](_0x2a1ce1,'777');}catch(_0x79411e){logger[_0xbb10('0x16')](_0x79411e);}return _0x2a1ce1[_0xbb10('0x35')]('.')[0x0];});};exports[_0xbb10('0x5a')]=function(_0x412f13,_0x3e9753,_0x45c0dc,_0x4a5fb9){var _0x117e84=util[_0xbb10('0x58')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3e9753,_0x45c0dc,base64Encode(_0x412f13),_0x4a5fb9?util['format']('model=%s',encodeURIComponent(_0x4a5fb9)):_0xbb10('0x5b'));return uploadFile(_0x117e84)[_0xbb10('0x2d')](function(_0x155dc5){return querystring['parse'](_0x155dc5);});};exports['sestekNDA']=function(_0x5846d1,_0x3ebc5f){return sestek[_0xbb10('0x5c')](_0x5846d1,_0x3ebc5f)[_0xbb10('0x2d')](function(_0x4e9fbd){logger[_0xbb10('0x27')](JSON[_0xbb10('0x42')](_0x4e9fbd));var _0x5a6538={'speech':_0x4e9fbd['text'],'action':_0x4e9fbd[_0xbb10('0x5d')]?_0x4e9fbd[_0xbb10('0x5d')][_0xbb10('0x5e')]:undefined,'actiondata':_0x4e9fbd[_0xbb10('0x5d')]?_0x4e9fbd['channelData'][_0xbb10('0x5f')]:undefined};if(_0x4e9fbd[_0xbb10('0x5d')]&&_0x4e9fbd[_0xbb10('0x5d')]['AudioFromTts']){return base64Decode(_0x4e9fbd[_0xbb10('0x5d')][_0xbb10('0x60')][_0xbb10('0x61')],path['resolve'](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b')))[_0xbb10('0x2d')](function(_0x5e4a6e){_0x5a6538[_0xbb10('0x62')]=_0x5e4a6e;return _0x5a6538;});}return _0x5a6538;});};exports[_0xbb10('0x63')]=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 53c21f8..92ceabd 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 _0x9075=['exports','./nda'];(function(_0x3a9711,_0x306f9d){var _0x403af3=function(_0x90b88d){while(--_0x90b88d){_0x3a9711['push'](_0x3a9711['shift']());}};_0x403af3(++_0x306f9d);}(_0x9075,0x1d7));var _0x5907=function(_0x5dea35,_0x4403ce){_0x5dea35=_0x5dea35-0x0;var _0x420537=_0x9075[_0x5dea35];return _0x420537;};var nda=require(_0x5907('0x0'));module[_0x5907('0x1')]={'nda':nda}; \ No newline at end of file +var _0x044f=['./nda','exports'];(function(_0x23e5ce,_0x57584d){var _0x2ce19b=function(_0x318e1f){while(--_0x318e1f){_0x23e5ce['push'](_0x23e5ce['shift']());}};_0x2ce19b(++_0x57584d);}(_0x044f,0x9c));var _0xf044=function(_0x2300fa,_0x41c382){_0x2300fa=_0x2300fa-0x0;var _0x11fef0=_0x044f[_0x2300fa];return _0x11fef0;};var nda=require(_0xf044('0x0'));module[_0xf044('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index edbcbf7..290102b 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 _0xbf19=['message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xbf19,0x178));var _0x9bf1=function(_0x148819,_0x659d02){_0x148819=_0x148819-0x0;var _0x46cd45=_0xbf19[_0x148819];return _0x46cd45;};'use strict';var rp=require(_0x9bf1('0x0'));var url=require(_0x9bf1('0x1'));var logger=require(_0x9bf1('0x2'))(_0x9bf1('0x3'));module[_0x9bf1('0x4')]=function(_0x42e78f,_0x431f35){var _0x6bd180={'method':_0x9bf1('0x5'),'uri':url['resolve'](_0x431f35[_0x9bf1('0x6')],_0x9bf1('0x7')),'form':{'grant_type':_0x9bf1('0x8'),'username':_0x431f35['username'],'password':_0x431f35['password']},'json':!![]};return rp(_0x6bd180)[_0x9bf1('0x9')](function(_0x2755e1){var _0x30e833={'method':_0x9bf1('0x5'),'uri':url[_0x9bf1('0xa')](_0x431f35[_0x9bf1('0xb')],_0x9bf1('0xc')),'body':{'type':_0x431f35[_0x9bf1('0xd')]||_0x9bf1('0xe'),'channelId':'Nda','conversation':{'id':_0x42e78f[_0x9bf1('0xf')]},'from':{'id':_0x42e78f[_0x9bf1('0x10')],'name':_0x42e78f[_0x9bf1('0x11')]},'recipient':{'id':_0x42e78f[_0x9bf1('0x12')],'name':_0x42e78f['extension']},'text':_0x431f35[_0x9bf1('0x13')],'channelData':{}},'headers':{'Authorization':_0x9bf1('0x14')+_0x2755e1['access_token']},'json':!![]};if(_0x431f35[_0x9bf1('0x15')]){_0x30e833[_0x9bf1('0x16')][_0x9bf1('0x17')]['ProjectName']=_0x431f35[_0x9bf1('0x15')];}if(_0x431f35[_0x9bf1('0x18')]=='1'){_0x30e833[_0x9bf1('0x16')][_0x9bf1('0x17')][_0x9bf1('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x431f35[_0x9bf1('0x1a')]){_0x30e833[_0x9bf1('0x16')][_0x9bf1('0x17')][_0x9bf1('0x1b')]=_0x431f35['custom_action'];if(_0x431f35['custom_action_data']){_0x30e833[_0x9bf1('0x16')][_0x9bf1('0x17')]['CustomActionData']=_0x431f35['custom_action_data'];}}logger[_0x9bf1('0x1c')](JSON[_0x9bf1('0x1d')](_0x30e833));return rp(_0x30e833);});}; \ No newline at end of file +var _0xd981=['uniqueid','callerid','calleridname','dnid','text','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xd981,0x15a));var _0x1d98=function(_0x3e58a0,_0x554642){_0x3e58a0=_0x3e58a0-0x0;var _0x400909=_0xd981[_0x3e58a0];return _0x400909;};'use strict';var rp=require(_0x1d98('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x1d98('0x1'));module[_0x1d98('0x2')]=function(_0x495121,_0x32cfd4){var _0x42da4d={'method':_0x1d98('0x3'),'uri':url[_0x1d98('0x4')](_0x32cfd4[_0x1d98('0x5')],_0x1d98('0x6')),'form':{'grant_type':_0x1d98('0x7'),'username':_0x32cfd4[_0x1d98('0x8')],'password':_0x32cfd4[_0x1d98('0x7')]},'json':!![]};return rp(_0x42da4d)[_0x1d98('0x9')](function(_0x590b16){var _0x170e92={'method':_0x1d98('0x3'),'uri':url[_0x1d98('0x4')](_0x32cfd4[_0x1d98('0xa')],_0x1d98('0xb')),'body':{'type':_0x32cfd4['ndaactivity_type']||_0x1d98('0xc'),'channelId':_0x1d98('0xd'),'conversation':{'id':_0x495121[_0x1d98('0xe')]},'from':{'id':_0x495121[_0x1d98('0xf')],'name':_0x495121[_0x1d98('0x10')]},'recipient':{'id':_0x495121[_0x1d98('0x11')],'name':_0x495121['extension']},'text':_0x32cfd4[_0x1d98('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x590b16[_0x1d98('0x13')]},'json':!![]};if(_0x32cfd4['project']){_0x170e92[_0x1d98('0x14')][_0x1d98('0x15')]['ProjectName']=_0x32cfd4[_0x1d98('0x16')];}if(_0x32cfd4[_0x1d98('0x17')]=='1'){_0x170e92[_0x1d98('0x14')]['channelData'][_0x1d98('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x32cfd4[_0x1d98('0x19')]){_0x170e92[_0x1d98('0x14')][_0x1d98('0x15')][_0x1d98('0x1a')]=_0x32cfd4[_0x1d98('0x19')];if(_0x32cfd4[_0x1d98('0x1b')]){_0x170e92[_0x1d98('0x14')][_0x1d98('0x15')][_0x1d98('0x1c')]=_0x32cfd4[_0x1d98('0x1b')];}}logger[_0x1d98('0x1d')](JSON['stringify'](_0x170e92));return rp(_0x170e92);});}; \ 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 232758e..05ef2f5 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 _0xe9d9=['exports','./lib/api'];(function(_0x5a5889,_0x5eeb7b){var _0x203ac7=function(_0x28ea29){while(--_0x28ea29){_0x5a5889['push'](_0x5a5889['shift']());}};_0x203ac7(++_0x5eeb7b);}(_0xe9d9,0x9b));var _0x9e9d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9d9[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0x9e9d('0x0'));module[_0x9e9d('0x1')]=function(_0x56eb2c,_0x2e85e2,_0x536abd,_0x58e267){return asr(_0x56eb2c,_0x2e85e2,_0x536abd,_0x58e267);}; \ No newline at end of file +var _0xfdd5=['./lib/api'];(function(_0x190e26,_0x41a027){var _0xacbb69=function(_0x3376a9){while(--_0x3376a9){_0x190e26['push'](_0x190e26['shift']());}};_0xacbb69(++_0x41a027);}(_0xfdd5,0x14a));var _0x5fdd=function(_0x475da1,_0x30ceef){_0x475da1=_0x475da1-0x0;var _0x5c8772=_0xfdd5[_0x475da1];return _0x5c8772;};'use strict';var asr=require(_0x5fdd('0x0'));module['exports']=function(_0xf02fc,_0x2b8de8,_0x1c288f,_0x965ee4){return asr(_0xf02fc,_0x2b8de8,_0x1c288f,_0x965ee4);}; \ 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 27e08df..8dddf20 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 _0x84fe=['digest','info','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','EOS','error','stringify','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','close','bluebird','lodash','moment','crypto','agi','exports','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1'];(function(_0x2af506,_0x18ede1){var _0x43bcae=function(_0x16112c){while(--_0x16112c){_0x2af506['push'](_0x2af506['shift']());}};_0x43bcae(++_0x18ede1);}(_0x84fe,0x1bf));var _0xe84f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84fe[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xe84f('0x0'));var _=require(_0xe84f('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe84f('0x2'));var crypto=require(_0xe84f('0x3'));var logger=require('../../../../../../config/logger')(_0xe84f('0x4'));module[_0xe84f('0x5')]=function(_0x590d17,_0x22e489,_0x39f365,_0x3be3c4){return new BPromise(function(_0x5c9a2a,_0x204334){logger['info']('Tilde\x20URI',_0x3be3c4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2c15c8=new WebSocket(_0x3be3c4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x37f538='';var _0x167c86='0';var _0x485677='1';var _0xbace1c=_0xe84f('0x6');function _0x9e0622(_0x349164){var _0x33464f=crypto[_0xe84f('0x7')](_0xe84f('0x8'));_0x33464f['update'](_0x349164);return _0x33464f[_0xe84f('0x9')]('hex');}function _0x27d757(){try{logger[_0xe84f('0xa')](_0xe84f('0xb'));var _0x3f02c7=moment()[_0xe84f('0xc')]();var _0x3dcf51=_0x9e0622(_0x3f02c7+_0x22e489+_0x39f365);_0x2c15c8[_0xe84f('0xd')](JSON['stringify']({'appID':_0x22e489,'timestamp':_0x3f02c7,'appKey':_0x3dcf51}));var _0x5f4498=fs[_0xe84f('0xe')](_0x590d17);_0x5f4498['on'](_0xe84f('0xf'),function(_0x1b8b17){_0x2c15c8[_0xe84f('0xd')](_0x1b8b17);});_0x5f4498['on']('close',function(){_0x2c15c8[_0xe84f('0xd')](_0xe84f('0x10'));});}catch(_0x3fd766){logger[_0xe84f('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xe84f('0x12')](_0x3fd766));_0x2c15c8['terminate']();}}function _0x1ab0b7(_0x5c2468){try{if(_0x5c2468){var _0x297697=JSON['parse'](_0x5c2468);switch(_0x297697[_0xe84f('0x13')]){case 0x0:if(_0x297697[_0xe84f('0x14')]){if(_0x297697[_0xe84f('0x14')][_0xe84f('0x15')]){logger[_0xe84f('0xa')](_0xe84f('0x16'),JSON[_0xe84f('0x12')](_0x297697[_0xe84f('0x14')][_0xe84f('0x17')]));_0x37f538=_0x297697[_0xe84f('0x14')][_0xe84f('0x17')][0x0][_0xe84f('0x18')];_0x167c86=_0x297697['result'][_0xe84f('0x17')][0x0]['likelihood'];_0x485677='0';_0xbace1c=_0xe84f('0x19');_0x2c15c8[_0xe84f('0x1a')]();}}break;case 0x1:logger['info'](_0xe84f('0x6'));_0x485677='1';_0xbace1c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xe84f('0xa')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x485677='2';_0xbace1c=_0xe84f('0x1b');break;case 0x9:logger[_0xe84f('0xa')](_0xe84f('0x1c'));_0x485677='9';_0xbace1c=_0xe84f('0x1c');break;case 0xa:logger[_0xe84f('0xa')](_0xe84f('0x1d'));_0x485677='10';_0xbace1c='Authentication\x20failed.';break;case 0xb:logger[_0xe84f('0xa')](_0xe84f('0x1e'));_0x485677='11';_0xbace1c=_0xe84f('0x1e');}}}catch(_0x29a0b8){logger[_0xe84f('0x11')](_0xe84f('0x1f'),JSON['stringify'](_0x29a0b8));_0x2c15c8[_0xe84f('0x1a')]();}}function _0x5e0e23(){logger[_0xe84f('0xa')](_0xe84f('0x20'));_0x5c9a2a({'transcript':_0x37f538,'confidence':_0x167c86,'status':_0x485677,'status_message':_0xbace1c});}function _0x834ee3(_0x8f83e6){logger[_0xe84f('0x11')](_0xe84f('0x21'));if(!_[_0xe84f('0x22')](_0x8f83e6)){logger[_0xe84f('0x11')](_['isObject'](_0x8f83e6)?JSON[_0xe84f('0x12')](_0x8f83e6):_0x8f83e6);}}_0x2c15c8['on'](_0xe84f('0x23'),_0x27d757);_0x2c15c8['on'](_0xe84f('0x24'),_0x1ab0b7);_0x2c15c8['on'](_0xe84f('0x25'),_0x5e0e23);_0x2c15c8['on'](_0xe84f('0x11'),_0x834ee3);});}; \ No newline at end of file +var _0xbf0c=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','unix','send','stringify','createReadStream','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.'];(function(_0x45f246,_0x32f963){var _0x569fb2=function(_0x19f346){while(--_0x19f346){_0x45f246['push'](_0x45f246['shift']());}};_0x569fb2(++_0x32f963);}(_0xbf0c,0x14c));var _0xcbf0=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xbf0c[_0x33bc64];return _0x3fdd34;};'use strict';var BPromise=require(_0xcbf0('0x0'));var _=require(_0xcbf0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcbf0('0x2'));var crypto=require('crypto');var logger=require(_0xcbf0('0x3'))(_0xcbf0('0x4'));module[_0xcbf0('0x5')]=function(_0x3c2372,_0x50a7a4,_0x540d9c,_0xf90651){return new BPromise(function(_0x1c746b,_0x520e41){logger[_0xcbf0('0x6')]('Tilde\x20URI',_0xf90651||_0xcbf0('0x7'));var _0x477269=new WebSocket(_0xf90651||_0xcbf0('0x7'),{'perMessageDeflate':![]});var _0x4edbcf='';var _0x4b6361='0';var _0x3bfe33='1';var _0x828e37='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xcc56f9(_0x225892){var _0x222483=crypto[_0xcbf0('0x8')](_0xcbf0('0x9'));_0x222483[_0xcbf0('0xa')](_0x225892);return _0x222483['digest'](_0xcbf0('0xb'));}function _0x539687(){try{logger[_0xcbf0('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x405d80=moment()[_0xcbf0('0xc')]();var _0x13e5e8=_0xcc56f9(_0x405d80+_0x50a7a4+_0x540d9c);_0x477269[_0xcbf0('0xd')](JSON[_0xcbf0('0xe')]({'appID':_0x50a7a4,'timestamp':_0x405d80,'appKey':_0x13e5e8}));var _0x50f98d=fs[_0xcbf0('0xf')](_0x3c2372);_0x50f98d['on']('data',function(_0x37bc99){_0x477269['send'](_0x37bc99);});_0x50f98d['on']('close',function(){_0x477269['send'](_0xcbf0('0x10'));});}catch(_0x3ee841){logger['error'](_0xcbf0('0x11'),JSON['stringify'](_0x3ee841));_0x477269[_0xcbf0('0x12')]();}}function _0x50d5ee(_0x442096){try{if(_0x442096){var _0x262955=JSON[_0xcbf0('0x13')](_0x442096);switch(_0x262955[_0xcbf0('0x14')]){case 0x0:if(_0x262955[_0xcbf0('0x15')]){if(_0x262955[_0xcbf0('0x15')][_0xcbf0('0x16')]){logger[_0xcbf0('0x6')](_0xcbf0('0x17'),JSON['stringify'](_0x262955['result'][_0xcbf0('0x18')]));_0x4edbcf=_0x262955[_0xcbf0('0x15')][_0xcbf0('0x18')][0x0][_0xcbf0('0x19')];_0x4b6361=_0x262955[_0xcbf0('0x15')]['hypotheses'][0x0][_0xcbf0('0x1a')];_0x3bfe33='0';_0x828e37=_0xcbf0('0x1b');_0x477269['terminate']();}}break;case 0x1:logger['info'](_0xcbf0('0x1c'));_0x3bfe33='1';_0x828e37=_0xcbf0('0x1c');break;case 0x2:logger[_0xcbf0('0x6')](_0xcbf0('0x1d'));_0x3bfe33='2';_0x828e37=_0xcbf0('0x1d');break;case 0x9:logger[_0xcbf0('0x6')](_0xcbf0('0x1e'));_0x3bfe33='9';_0x828e37='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xcbf0('0x6')](_0xcbf0('0x1f'));_0x3bfe33='10';_0x828e37=_0xcbf0('0x1f');break;case 0xb:logger['info'](_0xcbf0('0x20'));_0x3bfe33='11';_0x828e37=_0xcbf0('0x20');}}}catch(_0x2792e8){logger[_0xcbf0('0x21')](_0xcbf0('0x22'),JSON[_0xcbf0('0xe')](_0x2792e8));_0x477269[_0xcbf0('0x12')]();}}function _0x34941f(){logger[_0xcbf0('0x6')](_0xcbf0('0x23'));_0x1c746b({'transcript':_0x4edbcf,'confidence':_0x4b6361,'status':_0x3bfe33,'status_message':_0x828e37});}function _0x54ac92(_0x37a418){logger['error'](_0xcbf0('0x24'));if(!_['isNil'](_0x37a418)){logger[_0xcbf0('0x21')](_[_0xcbf0('0x25')](_0x37a418)?JSON[_0xcbf0('0xe')](_0x37a418):_0x37a418);}}_0x477269['on'](_0xcbf0('0x26'),_0x539687);_0x477269['on'](_0xcbf0('0x27'),_0x50d5ee);_0x477269['on']('close',_0x34941f);_0x477269['on'](_0xcbf0('0x21'),_0x54ac92);});}; \ 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 10cb4be..de94133 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xedd9=['exports'];(function(_0x355e70,_0x43cb1c){var _0x1f9122=function(_0x4823a3){while(--_0x4823a3){_0x355e70['push'](_0x355e70['shift']());}};_0x1f9122(++_0x43cb1c);}(_0xedd9,0xfc));var _0x9edd=function(_0xd513cb,_0x5d8397){_0xd513cb=_0xd513cb-0x0;var _0x3f2b4c=_0xedd9[_0xd513cb];return _0x3f2b4c;};var asr=require('./asr');module[_0x9edd('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7d69442..13ed582 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 _0xeb07=['E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./channel','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR'];(function(_0x7905dd,_0x300ff2){var _0x1077b8=function(_0x4aee69){while(--_0x4aee69){_0x7905dd['push'](_0x7905dd['shift']());}};_0x1077b8(++_0x300ff2);}(_0xeb07,0x17e));var _0x7eb0=function(_0x48060e,_0x2804cd){_0x48060e=_0x48060e-0x0;var _0x3ba62f=_0xeb07[_0x48060e];return _0x3ba62f;};'use strict';var util=require(_0x7eb0('0x0'));var net=require(_0x7eb0('0x1'));var EventEmitter=require(_0x7eb0('0x2'))[_0x7eb0('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x7eb0('0x4'));var AGIServer=function(_0x58e64b,_0x48c26c,_0x3e080d){var _0x3085af=this,_0x58e64b=_0x58e64b||0x11dd,_0x48c26c=_0x48c26c||'127.0.0.1',_0x1cac25=null,_0x3f4297=0x0;EventEmitter['call'](_0x3085af);function _0x44def9(){if(!_0x58e64b){_0x3085af['emit'](_0x7eb0('0x5'),new AGIError(_0x7eb0('0x6')));return![];}_0x1cac25=net[_0x7eb0('0x7')]();_0x1cac25[_0x7eb0('0x8')](_0x58e64b,_0x48c26c);_0x1cac25['on'](_0x7eb0('0x9'),function(){_0x3085af[_0x7eb0('0xa')]('listening');});_0x1cac25['on'](_0x7eb0('0xb'),function(_0x2b80bd){_0x1cac25[_0x7eb0('0xc')](function(_0x1bdc4f,_0x4e41e6){if(_0x1bdc4f){_0x3085af[_0x7eb0('0xa')]('error',new AGIError(_0x7eb0('0xd'),_0x1bdc4f));}else if(_0x3e080d&&_0x3e080d<0x0){_0x3085af[_0x7eb0('0xa')](_0x7eb0('0x5'),new AGIError(_0x7eb0('0xe')));_0x2b80bd[_0x7eb0('0xf')]();}else if(_0x3e080d&&_0x3e080d>0x0&&_0x3e080d<_0x4e41e6){_0x3f4297+=0x1;_0x3085af['emit'](_0x7eb0('0x5'),new AGIError(_0x7eb0('0x10'),_0x3f4297));_0x2b80bd['destroy']();}else{var _0x568186=new AGIChannel(_0x2b80bd);_0x568186['on']('ready',function(){_0x3085af[_0x7eb0('0xa')]('connection',_0x568186);});}});});_0x1cac25['on'](_0x7eb0('0x5'),function(_0x289a45){_0x3085af[_0x7eb0('0xa')]('error',new AGIError(_0x7eb0('0xd'),_0x289a45[_0x7eb0('0x11')]));});_0x1cac25['on'](_0x7eb0('0x12'),function(){_0x3085af['emit']('close',new AGIError(_0x7eb0('0x13')));});}process['nextTick'](function(){_0x44def9();});};util[_0x7eb0('0x14')](AGIServer,EventEmitter);module[_0x7eb0('0x15')]=function(_0x2dbe04,_0x32d7a7,_0x26e004){return new AGIServer(_0x2dbe04,_0x32d7a7,_0x26e004);}; \ No newline at end of file +var _0x5923=['emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','E_AGI_SERVER_CLOSE','inherits','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','createServer','listen','listening'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5923,0x1d7));var _0x3592=function(_0x3288ef,_0x5a9865){_0x3288ef=_0x3288ef-0x0;var _0x4e99c3=_0x5923[_0x3288ef];return _0x4e99c3;};'use strict';var util=require(_0x3592('0x0'));var net=require(_0x3592('0x1'));var EventEmitter=require(_0x3592('0x2'))[_0x3592('0x3')];var AGIError=require(_0x3592('0x4'));var AGIChannel=require(_0x3592('0x5'));var AGIServer=function(_0x1df6ba,_0x7e98a3,_0x49c5f8){var _0x177c1a=this,_0x1df6ba=_0x1df6ba||0x11dd,_0x7e98a3=_0x7e98a3||_0x3592('0x6'),_0x358f5f=null,_0x5bde58=0x0;EventEmitter[_0x3592('0x7')](_0x177c1a);function _0x4d2902(){if(!_0x1df6ba){_0x177c1a['emit'](_0x3592('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x358f5f=net[_0x3592('0x9')]();_0x358f5f[_0x3592('0xa')](_0x1df6ba,_0x7e98a3);_0x358f5f['on'](_0x3592('0xb'),function(){_0x177c1a[_0x3592('0xc')](_0x3592('0xb'));});_0x358f5f['on'](_0x3592('0xd'),function(_0x3387f9){_0x358f5f[_0x3592('0xe')](function(_0x237903,_0xbc1dd4){if(_0x237903){_0x177c1a['emit']('error',new AGIError(_0x3592('0xf'),_0x237903));}else if(_0x49c5f8&&_0x49c5f8<0x0){_0x177c1a[_0x3592('0xc')](_0x3592('0x8'),new AGIError(_0x3592('0x10')));_0x3387f9['destroy']();}else if(_0x49c5f8&&_0x49c5f8>0x0&&_0x49c5f8<_0xbc1dd4){_0x5bde58+=0x1;_0x177c1a[_0x3592('0xc')](_0x3592('0x8'),new AGIError(_0x3592('0x11'),_0x5bde58));_0x3387f9[_0x3592('0x12')]();}else{var _0xed635e=new AGIChannel(_0x3387f9);_0xed635e['on'](_0x3592('0x13'),function(){_0x177c1a['emit'](_0x3592('0xd'),_0xed635e);});}});});_0x358f5f['on'](_0x3592('0x8'),function(_0x1921be){_0x177c1a[_0x3592('0xc')]('error',new AGIError(_0x3592('0xf'),_0x1921be[_0x3592('0x14')]));});_0x358f5f['on']('close',function(){_0x177c1a['emit']('close',new AGIError(_0x3592('0x15')));});}process['nextTick'](function(){_0x4d2902();});};util[_0x3592('0x16')](AGIServer,EventEmitter);module['exports']=function(_0x16c89b,_0x3fa4df,_0x4653cf){return new AGIServer(_0x16c89b,_0x3fa4df,_0x4653cf);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bd81f4d..927c224 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 _0x9691=['no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','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','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','host','port','secure','authentication','auth','user','pass','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','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','getQueryOdbc','open','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','trim','replace','googleTTS','google_tts_language','googleDialogflow','key','text','dialogflow_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','uri','clear','includes','clone','isString','replaceAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','options','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','setVariable','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','hasOwnProperty','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','url','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','getData','response','maxdigit','test','stringify','mindigit','hiddendigitsnum','generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9691,0xa0));var _0x1969=function(_0x338b56,_0x9e97be){_0x338b56=_0x338b56-0x0;var _0x74a94f=_0x9691[_0x338b56];return _0x74a94f;};'use strict';var fs=require('fs');var path=require(_0x1969('0x0'));var util=require(_0x1969('0x1'));var _=require(_0x1969('0x2'));var sh=require(_0x1969('0x3'));var odbc=require(_0x1969('0x4'))();var rs=require(_0x1969('0x5'));var moment=require(_0x1969('0x6'));var Mustache=require(_0x1969('0x7'));var logger=require(_0x1969('0x8'))(_0x1969('0x9'));var config=require(_0x1969('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x1969('0xb');var verticesWithRetry=[_0x1969('0xc'),_0x1969('0xd'),'getsecretdigits'];var AGIVertices=function(_0x5a4a61,_0x407a3b,_0x2c436b){this[_0x1969('0xe')]=_0x5a4a61;this[_0x1969('0xf')]=_0x407a3b;this[_0x1969('0x10')]=_0x2c436b;};AGIVertices[_0x1969('0x11')][_0x1969('0x12')]=function(_0x26bf11,_0xf82537){this[_0x1969('0xf')][_0x1969('0x13')](_0x26bf11)[_0x1969('0x14')](function(_0x474f4d){_0xf82537(null,_0x474f4d?_0x474f4d[_0x1969('0x15')]:![]);})[_0x1969('0x16')](function(_0x6fee3d){_0xf82537(_0x6fee3d);});};AGIVertices[_0x1969('0x11')][_0x1969('0x17')]=function(_0x494bb9,_0x53ecaf){this[_0x1969('0xf')][_0x1969('0x18')](_0x494bb9)[_0x1969('0x14')](function(_0xd654da){_0x53ecaf(null,_0xd654da?_0xd654da[_0x1969('0x15')]:![]);})[_0x1969('0x16')](function(_0x26983d){_0x53ecaf(_0x26983d);});};AGIVertices[_0x1969('0x11')][_0x1969('0x19')]=function(_0x5ee146,_0x33a1fd){this['rpc'][_0x1969('0x1a')](_0x5ee146)[_0x1969('0x14')](function(_0x467430){_0x33a1fd(null,_0x467430?_0x467430['name']:![]);})[_0x1969('0x16')](function(_0x4137aa){_0x33a1fd(_0x4137aa);});};AGIVertices[_0x1969('0x11')][_0x1969('0x1b')]=function(_0x4796dd,_0x414c34){this['rpc'][_0x1969('0x1c')](_0x4796dd)['then'](function(_0xe80ceb){_0x414c34(null,_0xe80ceb?_0xe80ceb[_0x1969('0x1d')]:![]);})[_0x1969('0x16')](function(_0x40f51f){_0x414c34(_0x40f51f);});};AGIVertices[_0x1969('0x11')][_0x1969('0x1e')]=function(_0x4515b8,_0x1ac141){this[_0x1969('0xf')][_0x1969('0x1f')](_0x4515b8)['then'](function(_0x2f8c9b){_0x1ac141(null,_0x2f8c9b?_0x2f8c9b[_0x1969('0x15')]:![]);})['catch'](function(_0x309b33){_0x1ac141(_0x309b33);});};AGIVertices['prototype'][_0x1969('0x20')]=function(_0x2b22ab,_0x3abfac){this[_0x1969('0xf')][_0x1969('0x21')](_0x2b22ab)['then'](function(_0x469609){_0x3abfac(null,_0x469609?_0x469609[_0x1969('0x15')]:![]);})['catch'](function(_0x369596){_0x3abfac(_0x369596);});};AGIVertices[_0x1969('0x11')]['getSound']=function(_0x5c0bde,_0x328368){var _0x1923b5=this;this[_0x1969('0xf')][_0x1969('0x22')](_0x5c0bde)[_0x1969('0x14')](function(_0x4a5442){_0x328368(null,_0x4a5442?_0x1923b5[_0x1969('0x23')](_0x4a5442[_0x1969('0x24')]):![]);})[_0x1969('0x16')](function(_0x3d4b63){_0x328368(_0x3d4b63);});};AGIVertices[_0x1969('0x11')]['getMailAccount']=function(_0x486592,_0x21c979){this['rpc'][_0x1969('0x25')](_0x486592)['then'](function(_0x3f409d){_0x21c979(null,_0x3f409d?_0x3f409d:![]);})[_0x1969('0x16')](function(_0x424ede){_0x21c979(_0x424ede);});};AGIVertices[_0x1969('0x11')]['sendMailMessage']=function(_0x165d10,_0x422491,_0x4d59bf){this['mailRpc'][_0x1969('0x26')](_0x165d10,_0x422491)[_0x1969('0x14')](function(){_0x4d59bf(null);})[_0x1969('0x16')](function(_0x58d9cb){_0x4d59bf(_0x58d9cb);});};AGIVertices[_0x1969('0x11')][_0x1969('0x27')]=function(_0x45de75,_0x5ef1f2){this[_0x1969('0xf')][_0x1969('0x28')](_0x45de75)[_0x1969('0x14')](function(_0x37f5de){if(_0x37f5de){if(_0x37f5de['IntervalId']){_0x5ef1f2(null,[_0x37f5de[_0x1969('0x29')]]);}else{_0x5ef1f2(null,_[_0x1969('0x2a')](_0x37f5de[_0x1969('0x2b')],'interval'));}}else{_0x5ef1f2(null,![]);}})['catch'](function(_0x2105eb){_0x5ef1f2(_0x2105eb);});};AGIVertices['prototype'][_0x1969('0x23')]=function(_0x40c795){return util[_0x1969('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x40c795);};AGIVertices[_0x1969('0x11')][_0x1969('0x2d')]=function(_0x41a164,_0x1566bf,_0x3c05dd){odbc[_0x1969('0x2e')](_0x41a164,function(_0x412d86){if(_0x412d86){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x412d86);_0x3c05dd(_0x412d86);}else{logger['info'](_0x1969('0x2f'));odbc[_0x1969('0x30')](_0x1566bf,function(_0x1e2531,_0x3e2265){if(_0x1e2531){logger['info'](_0x1969('0x31'),_0x1566bf);_0x3c05dd(_0x1e2531);}else{logger[_0x1969('0x32')]('Query\x20executed\x20correctly\x20%s',_0x1566bf);odbc[_0x1969('0x33')](function(_0x58c107){if(_0x58c107){logger[_0x1969('0x34')](_0x1969('0x35'),_0x58c107);}_0x3c05dd(null,_0x3e2265);});}});}});};AGIVertices['prototype'][_0x1969('0x36')]=function(_0x5de24b,_0x594008){this['rpc'][_0x1969('0x37')](_0x5de24b)[_0x1969('0x14')](function(_0x334b9a){_0x594008(null,_0x334b9a?_0x334b9a:![]);})[_0x1969('0x16')](function(_0x541354){_0x594008(_0x541354);});};AGIVertices['prototype'][_0x1969('0x38')]=function(_0x228b68,_0x2f3970){this[_0x1969('0xf')][_0x1969('0x38')](_0x228b68)['then'](function(_0x1e21b9){_0x2f3970(null,_0x1e21b9);})[_0x1969('0x16')](function(_0x130d75){_0x2f3970(_0x130d75);});};AGIVertices[_0x1969('0x11')][_0x1969('0x39')]=function(_0x3185c6,_0x3dfa05,_0x387403){this[_0x1969('0xf')][_0x1969('0x39')]({'uniqueid':this[_0x1969('0xe')][_0x1969('0x3a')],'node':_0x3185c6[_0x1969('0x3b')],'application':_0x3185c6[_0x1969('0x3c')],'data':_0x3dfa05||null,'project_name':this[_0x1969('0xe')][_0x1969('0x3d')],'callerid':this[_0x1969('0xe')]['callerid']})['then'](function(_0x40bb1a){if(_0x387403){_0x387403(null,_0x40bb1a);}})[_0x1969('0x16')](function(_0x1944af){if(_0x387403){_0x387403(_0x1944af);}});};AGIVertices['prototype'][_0x1969('0x3e')]=function(_0x8d8d,_0x56c321,_0x4f9b59,_0x34d2e1){this[_0x1969('0xf')][_0x1969('0x3e')]({'uniqueid':this[_0x1969('0xe')]['uniqueid'],'callerid':this['channel'][_0x1969('0x3f')],'calleridname':this[_0x1969('0xe')]['calleridname'],'context':this[_0x1969('0xe')][_0x1969('0x40')],'extension':this[_0x1969('0xe')][_0x1969('0x41')],'priority':this[_0x1969('0xe')]['priority'],'accountcode':this[_0x1969('0xe')]['accountcode'],'dnid':this[_0x1969('0xe')][_0x1969('0x42')],'projectName':this[_0x1969('0xe')]['arg_1'],'saveName':_0x56c321,'filename':_0x8d8d[_0x1969('0x43')]||_0x56c321,'savePath':_0x4f9b59})[_0x1969('0x14')](function(_0x3d8b9b){_0x34d2e1(null,_0x3d8b9b);})[_0x1969('0x16')](function(_0x3a68a1){_0x34d2e1(_0x3a68a1);});};AGIVertices[_0x1969('0x11')][_0x1969('0x44')]=function(_0x160af0,_0x264eb7,_0xc80bed){this[_0x1969('0xf')][_0x1969('0x44')]({'uniqueid':this['channel'][_0x1969('0x3a')],'body':_0x160af0,'direction':_0x264eb7})['then'](function(_0x5680c1){if(_0xc80bed){_0xc80bed(null,_0x5680c1);}})[_0x1969('0x16')](function(_0x1fe8ac){if(_0xc80bed){_0xc80bed(_0x1fe8ac);}});};AGIVertices[_0x1969('0x11')][_0x1969('0x45')]=function(_0x199fda,_0x140615){this['rpc'][_0x1969('0x45')]({'firstName':_[_0x1969('0x46')](_0x199fda['name'])||_[_0x1969('0x47')](_0x199fda[_0x1969('0x15')])?_0x1969('0x48')+Math[_0x1969('0x49')]():_0x199fda['name'],'lastName':_[_0x1969('0x46')](_0x199fda[_0x1969('0x4a')])||_[_0x1969('0x47')](_0x199fda[_0x1969('0x4a')])?null:_0x199fda['lastName'],'phone':_0x199fda[_0x1969('0x4b')],'ListId':_0x199fda[_0x1969('0x4c')],'scheduledAt':_0x199fda[_0x1969('0x4d')],'callbackUniqueid':this[_0x1969('0xe')][_0x1969('0x3a')],'tags':'callback','description':_0x1969('0x4e')+_0x199fda['scheduledAt'][_0x1969('0x4f')](),'priority':_0x199fda[_0x1969('0x50')]})[_0x1969('0x14')](function(_0x5f3697){_0x140615(null,_0x5f3697);})['catch'](function(_0x284551){_0x140615(_0x284551);});};AGIVertices['prototype'][_0x1969('0x51')]=function(_0x3d5835,_0x2822db){this[_0x1969('0xf')][_0x1969('0x52')](_0x3d5835)[_0x1969('0x14')](function(_0x1baffd){_0x2822db(null,_0x1baffd?_0x1baffd[_0x1969('0x15')]:![]);})[_0x1969('0x16')](function(_0x292312){_0x2822db(_0x292312);});};AGIVertices[_0x1969('0x11')]['agentPause']=function(_0x29b4ba,_0x27bef0,_0x101ea5){var _0x10e2ec={'role':_0x1969('0x53')};_0x10e2ec[_0x29b4ba]=this[_0x1969('0xe')]['callerid'];this[_0x1969('0xf')]['agentPause'](_0x10e2ec,_0x27bef0,this[_0x1969('0xe')]['uniqueid'])[_0x1969('0x14')](function(_0x2cdd95){_0x101ea5(null,_['isNil'](_0x2cdd95)?![]:!![]);})['catch'](function(_0x189299){logger['error'](_0x189299);_0x101ea5(null,![]);});};AGIVertices[_0x1969('0x11')][_0x1969('0x54')]=function(_0x237b22,_0x34560e){var _0x266ba1={'role':'agent'};_0x266ba1[_0x237b22]=this['channel'][_0x1969('0x3f')];this['rpc'][_0x1969('0x54')](_0x266ba1)[_0x1969('0x14')](function(_0x48b287){_0x34560e(null,_[_0x1969('0x47')](_0x48b287)?![]:!![]);})[_0x1969('0x16')](function(_0x4c55b6){logger[_0x1969('0x34')](_0x4c55b6);_0x34560e(null,![]);});};AGIVertices[_0x1969('0x11')][_0x1969('0x55')]=function(_0x5239c3,_0x325722){var _0x2386e7={'role':_0x1969('0x53')};_0x2386e7[_0x5239c3]=this[_0x1969('0xe')]['callerid'];this[_0x1969('0xf')][_0x1969('0x55')](_0x2386e7)['then'](function(_0x182119){_0x325722(null,_[_0x1969('0x47')](_0x182119)?![]:!![]);})[_0x1969('0x16')](function(_0x211554){logger['error'](_0x211554);_0x325722(null,![]);});};AGIVertices['prototype'][_0x1969('0x56')]=function(_0x23a2d5,_0x51971a){var _0x14bf05={'role':'agent'};_0x14bf05[_0x23a2d5]=this[_0x1969('0xe')][_0x1969('0x3f')];var _0x404ae7=_0x23a2d5!='internal'?util[_0x1969('0x2c')](_0x1969('0x57'),_0x1969('0x58'),this['channel'][_0x1969('0x3f')]):undefined;this[_0x1969('0xf')]['agentLogin'](_0x14bf05,_0x404ae7)[_0x1969('0x14')](function(_0x2858a1){_0x51971a(null,_[_0x1969('0x47')](_0x2858a1)?![]:!![]);})[_0x1969('0x16')](function(_0x39f53a){logger[_0x1969('0x34')](_0x39f53a);_0x51971a(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x1861c4,_0x4d3860){sh['exec'](_[_0x1969('0x59')](_0x1861c4),function(_0x4f46ab,_0x4c0c16){var _0xee2768=_0x4c0c16[_0x1969('0x5a')](/(\r\n|\n|\r)/gm,'');_0x4d3860(null,_0xee2768);});};AGIVertices[_0x1969('0x11')][_0x1969('0x5b')]=function(_0x1cc08f,_0x2eb993){scripts[_0x1969('0x5b')](_0x1cc08f['text'],_0x1cc08f[_0x1969('0x5c')]||'en',0x1)[_0x1969('0x14')](function(_0xfc6a04){_0x2eb993(null,_0xfc6a04);})['catch'](function(_0x26f23e){_0x2eb993(_0x26f23e);});};AGIVertices[_0x1969('0x11')]['googleDialogflow']=function(_0x4d0197,_0x30e6f6){scripts[_0x1969('0x5d')](this['channel'][_0x1969('0x3a')],_0x4d0197[_0x1969('0x5e')],_0x4d0197[_0x1969('0x5f')],_0x4d0197[_0x1969('0x60')]||'en')['then'](function(_0x21733f){_0x30e6f6(null,_0x21733f);})['catch'](function(_0x2ef499){_0x30e6f6(_0x2ef499);});};AGIVertices['prototype']['sestekNDA']=function(_0x5e1b17,_0x757ba3){scripts[_0x1969('0x61')](this[_0x1969('0xe')],_0x5e1b17)[_0x1969('0x14')](function(_0x43f0a2){_0x757ba3(null,_0x43f0a2);})[_0x1969('0x16')](function(_0x2ca04){_0x757ba3(_0x2ca04);});};AGIVertices[_0x1969('0x11')][_0x1969('0x62')]=function(_0x507653,_0xbcfd7f){scripts[_0x1969('0x62')](_0x507653[_0x1969('0x5e')],_0x507653[_0x1969('0x5f')],_0x507653['ispeech_tts_language']||_0x1969('0x63'),_0x507653[_0x1969('0x64')])[_0x1969('0x14')](function(_0x461d90){_0xbcfd7f(null,_0x461d90);})[_0x1969('0x16')](function(_0x120170){_0xbcfd7f(_0x120170);});};AGIVertices['prototype']['ispeechASR']=function(_0x3b1733,_0x2f83d9,_0x535c0c){scripts[_0x1969('0x65')](_0x2f83d9,_0x3b1733[_0x1969('0x5e')],_0x3b1733[_0x1969('0x66')]||_0x1969('0x63'),this['isConfigured'](_0x3b1733[_0x1969('0x67')])?_0x3b1733[_0x1969('0x67')]:undefined)[_0x1969('0x14')](function(_0x1f44f4){_0x535c0c(null,_0x1f44f4);})[_0x1969('0x16')](function(_0x4d4c26){_0x535c0c(_0x4d4c26);});};AGIVertices['prototype'][_0x1969('0x68')]=function(_0x250d89,_0x2093ec){scripts[_0x1969('0x68')](_0x250d89[_0x1969('0x69')],_0x250d89[_0x1969('0x6a')],_0x250d89[_0x1969('0x6b')],_0x250d89[_0x1969('0x6c')]||_0x1969('0x6d'),_0x250d89['text'],_0x250d89['aws_text_type']||_0x1969('0x5f'))[_0x1969('0x14')](function(_0x408b35){_0x2093ec(null,_0x408b35);})[_0x1969('0x16')](function(_0x182d87){_0x2093ec(_0x182d87);});};AGIVertices['prototype'][_0x1969('0x6e')]=function(_0x46d223,_0x5d19a3){scripts[_0x1969('0x6e')](this[_0x1969('0xe')][_0x1969('0x3a')],_0x46d223[_0x1969('0x69')],_0x46d223['aws_secret_access_key'],_0x46d223['aws_lex_region'],_0x46d223[_0x1969('0x5f')],_0x46d223['aws_bot_name'])[_0x1969('0x14')](function(_0xe8ad83){_0x5d19a3(null,_0xe8ad83);})[_0x1969('0x16')](function(_0x10219c){_0x5d19a3(_0x10219c);});};AGIVertices[_0x1969('0x11')][_0x1969('0x6f')]=function(_0x2ed5e9,_0xe6a4f7,_0x59c170){scripts[_0x1969('0x6f')](_0xe6a4f7,_0x2ed5e9[_0x1969('0x5e')],_0x2ed5e9[_0x1969('0x70')]||_0x1969('0x63'))['then'](function(_0x419581){_0x59c170(null,_0x419581);})[_0x1969('0x16')](function(_0x34e55){_0x59c170(_0x34e55);});};AGIVertices['prototype'][_0x1969('0x71')]=function(_0x3cdab7,_0x1eab1a,_0x297865){scripts[_0x1969('0x71')](_0x1eab1a,_0x3cdab7['appid'],_0x3cdab7['appsecret'],_0x3cdab7[_0x1969('0x72')])[_0x1969('0x14')](function(_0x28dc9c){_0x297865(null,_0x28dc9c);})[_0x1969('0x16')](function(_0x2bca46){_0x297865(_0x2bca46);});};AGIVertices[_0x1969('0x11')][_0x1969('0x73')]=function(_0x369e4b){var _0xe48ac7=_[_0x1969('0x74')](verticesWithRetry,_0x369e4b['agicommand'])?_0x369e4b:_[_0x1969('0x75')](_0x369e4b);for(var _0x12538f in _0xe48ac7){if(_0xe48ac7['hasOwnProperty'](_0x12538f)){if(_0xe48ac7[_0x12538f]&&_[_0x1969('0x76')](_0xe48ac7[_0x12538f])){_0xe48ac7[_0x12538f]=this[_0x1969('0x77')](_0xe48ac7[_0x12538f]);}}}return _0xe48ac7;};AGIVertices[_0x1969('0x11')][_0x1969('0x77')]=function(_0x48c4da){var _0x57c92a=_0x48c4da['split']('{');for(var _0x253e9e=0x1;_0x253e9e<_0x57c92a['length'];_0x253e9e+=0x1){var _0xd206e2=_0x57c92a[_0x253e9e][_0x1969('0x78')]('}');if(_0xd206e2[_0x1969('0x79')]>0x1){_0x48c4da=_0x48c4da[_0x1969('0x7a')]('{'+_0xd206e2[0x0]+'}',this[_0x1969('0xe')][_0x1969('0x12')](_0xd206e2[0x0])[_0x1969('0x7b')]||_0xd206e2[0x0]);}}if(_0x57c92a[_0x1969('0x79')]===0x1){return _0x48c4da['toString']();}return this['replaceAllVariables'](_0x48c4da);};AGIVertices['prototype'][_0x1969('0x7c')]=function(_0x3df779,_0x303899){var _0x3ad767=this[_0x1969('0xe')]['getVariable'](_0x3df779);if(_0x3ad767[_0x1969('0x7d')]===-0x1){return _0x3ad767;}logger['info'](util['format'](_0x1969('0x7e'),_0x303899,_0x3ad767['extra']));return this[_0x1969('0xe')]['setVariable'](_0x303899,_0x3ad767['extra']);};AGIVertices[_0x1969('0x11')][_0x1969('0x7f')]=function(_0x40dec6){return _0x40dec6&&_0x40dec6!=='0'&&_0x40dec6!=='-1'&&_0x40dec6!=='';};AGIVertices[_0x1969('0x11')][_0x1969('0x80')]=function(_0x388374){this[_0x1969('0x39')][_0x1969('0x81')](this,_0x388374,'-');_0x388374[_0x1969('0x82')]=_0x388374[_0x1969('0x80')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1969('0x11')]['agi']=function(_0x1babdd){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x83'),_0x1babdd[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x9')]([_0x1babdd[_0x1969('0x84')],_0x1babdd['args']]);};AGIVertices[_0x1969('0x11')][_0x1969('0x85')]=function(_0x445223){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x86'),_0x445223[_0x1969('0x3b')]));if(this[_0x1969('0x7f')](_0x445223[_0x1969('0x87')])){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x445223[_0x1969('0x87')]));var _0x45155b=this[_0x1969('0xe')][_0x1969('0x88')](_0x445223['timeout']);if(_0x45155b[_0x1969('0x7d')]===-0x1){return _0x45155b;}}return this[_0x1969('0xe')][_0x1969('0x85')]();};AGIVertices[_0x1969('0x11')][_0x1969('0x89')]=function(_0x1108f9){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x8a'),_0x1108f9[_0x1969('0x3b')]));if(!this['isConfigured'](_0x1108f9['list_id'])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x1108f9,_0x1969('0x8b'));}_0x1108f9['scheduledAt']=moment();if(this['isConfigured'](_0x1108f9[_0x1969('0x8c')])){_0x1108f9[_0x1969('0x4d')]=moment()[_0x1969('0x8d')](_0x1108f9[_0x1969('0x8c')],'minutes');}if(!this[_0x1969('0x7f')](_0x1108f9['callback_priority'])){_0x1108f9[_0x1969('0x50')]=0x2;}this[_0x1969('0x45')][_0x1969('0x81')](this,_0x1108f9);return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x8f'),_0x1108f9[_0x1969('0x4b')],_0x1108f9[_0x1969('0x4c')],_0x1108f9[_0x1969('0x4d')]));};AGIVertices['prototype']['custom_app']=function(_0x99d000){logger['info'](util[_0x1969('0x2c')](_0x1969('0x90'),_0x99d000['label']));var _0x474237=this[_0x1969('0xe')][_0x1969('0x91')](_0x99d000['application'],_0x99d000[_0x1969('0x92')]);if(_0x474237[_0x1969('0x7d')]===-0x1){return _0x474237;}return this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x93'),_0x99d000[_0x1969('0x94')],_0x99d000[_0x1969('0x92')]));};AGIVertices[_0x1969('0x11')]['lumenvoxtts']=function(_0x33bbf2){logger[_0x1969('0x32')](util['format'](_0x1969('0x95'),_0x33bbf2[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x33bbf2['text'])){return this[_0x1969('0xe')][_0x1969('0x8e')]('no\x20text\x20configured');}var _0x56fb8e='\x22'+_0x33bbf2[_0x1969('0x5f')]+'\x22';if(this[_0x1969('0x7f')](_0x33bbf2['options'])){_0x56fb8e+=','+_0x33bbf2[_0x1969('0x92')];}var _0x16acc9=this[_0x1969('0xe')]['exec'](_0x1969('0x96'),_0x56fb8e);if(_0x16acc9['result']===-0x1){return _0x16acc9;}return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x56fb8e));};AGIVertices[_0x1969('0x11')][_0x1969('0x97')]=function(_0x57d930){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x57d930[_0x1969('0x3b')]));if(!this['isConfigured'](_0x57d930[_0x1969('0x5f')])){return this['channel'][_0x1969('0x8e')]('no\x20text\x20configured');}var _0x4fbacc='\x22'+_0x57d930[_0x1969('0x5f')]+'\x22';if(this[_0x1969('0x7f')](_0x57d930[_0x1969('0x92')])){_0x4fbacc+=','+_0x57d930[_0x1969('0x92')];}var _0x3c2ba5=this[_0x1969('0xe')][_0x1969('0x91')](_0x1969('0x96'),_0x4fbacc);if(_0x3c2ba5[_0x1969('0x7d')]===-0x1){return _0x3c2ba5;}return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4fbacc));};AGIVertices[_0x1969('0x11')]['lumenvoxasr']=function(_0x49c623){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x98'),_0x49c623[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x49c623[_0x1969('0x99')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0x9a'));}var _0x26fd76=_0x49c623[_0x1969('0x99')];if(this[_0x1969('0x7f')](_0x49c623['options'])){_0x26fd76+=','+_0x49c623[_0x1969('0x92')];}var _0x1c9c31=this[_0x1969('0xe')][_0x1969('0x91')]('MRCPRecog',_0x26fd76);if(_0x1c9c31[_0x1969('0x7d')]===-0x1){return _0x1c9c31;}var _0x332d10=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x1969('0x9b'));if(_0x332d10[_0x1969('0x7d')]===-0x1){return _0x332d10;}var _0x4ab148=this[_0x1969('0x7c')](_0x1969('0x9c'),_0x1969('0x9d'));if(_0x4ab148[_0x1969('0x7d')]===-0x1){return _0x4ab148;}var _0x22201b=this['getAndSetVariable']('RECOG_INSTANCE()',_0x1969('0x9e'));if(_0x22201b[_0x1969('0x7d')]===-0x1){return _0x22201b;}return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x26fd76));};AGIVertices[_0x1969('0x11')][_0x1969('0x9f')]=function(_0x5a60e1){logger['info'](util['format'](_0x1969('0xa0'),_0x5a60e1[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x5a60e1['grammar'])){return this['channel'][_0x1969('0x8e')](_0x1969('0x9a'));}var _0x5b5a45=_0x5a60e1['grammar'];if(this[_0x1969('0x7f')](_0x5a60e1[_0x1969('0x92')])){_0x5b5a45+=','+_0x5a60e1[_0x1969('0x92')];}var _0x4c1129=this['channel'][_0x1969('0x91')](_0x1969('0xa1'),_0x5b5a45);if(_0x4c1129[_0x1969('0x7d')]===-0x1){return _0x4c1129;}var _0x33d7f0=this[_0x1969('0x7c')](_0x1969('0xa2'),_0x1969('0xa3'));if(_0x33d7f0[_0x1969('0x7d')]===-0x1){return _0x33d7f0;}var _0x1ea7c5=this['getAndSetVariable'](_0x1969('0x9c'),_0x1969('0xa4'));if(_0x1ea7c5[_0x1969('0x7d')]===-0x1){return _0x1ea7c5;}var _0x58144b=this[_0x1969('0x7c')](_0x1969('0xa5'),_0x1969('0xa6'));if(_0x58144b[_0x1969('0x7d')]===-0x1){return _0x58144b;}return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0xa7'),_0x5b5a45));};AGIVertices['prototype'][_0x1969('0xa8')]=function(_0x5933e9){logger['info'](util[_0x1969('0x2c')](_0x1969('0xa9'),_0x5933e9['label']));if(!this[_0x1969('0x7f')](_0x5933e9[_0x1969('0xaa')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x5933e9,_0x1969('0xab'));}var _0x555058=this[_0x1969('0x1b')]['sync'](this,_0x5933e9['odbc_id']);if(!_0x555058){return this[_0x1969('0xe')][_0x1969('0x34')](_0x5933e9,'no\x20odbc\x20database\x20found');}if(!this[_0x1969('0x7f')](_0x5933e9[_0x1969('0x30')])){return this['channel']['error'](_0x5933e9,'no\x20query\x20configured');}var _0x30ba53=_0x5933e9[_0x1969('0x30')][_0x1969('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0xac'),_0x30ba53));var _0x31f8ae=this[_0x1969('0x2d')][_0x1969('0x81')](this,_0x555058,_0x30ba53);this[_0x1969('0x39')]['sync'](this,_0x5933e9,_0x30ba53);if(!this[_0x1969('0x7f')](_0x5933e9['variable_id'])){return this['channel'][_0x1969('0x8e')](_0x1969('0xad'));}var _0x129640=this[_0x1969('0x12')][_0x1969('0x81')](this,_0x5933e9[_0x1969('0xae')]);if(!_0x129640){return this[_0x1969('0xe')][_0x1969('0x34')](_0x5933e9,'no\x20variable\x20found');}var _0x2ae043=this;_0x31f8ae[_0x1969('0xaf')](function(_0x1597a2,_0x185e59){Object[_0x1969('0xb0')](_0x1597a2)[_0x1969('0xaf')](function(_0xe1aba3){_0x2ae043['channel'][_0x1969('0xb1')](util['format']('%s[%s][%s]',_0x129640,_0x185e59,_0xe1aba3),_0x1597a2[_0xe1aba3]);});});this[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0xb2'),_0x129640),_0x31f8ae['length']);return this[_0x1969('0xe')][_0x1969('0x8e')](util['format'](_0x1969('0xb3'),_0x129640));};AGIVertices[_0x1969('0x11')]['dial']=function(_0x375739){logger[_0x1969('0xb4')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x375739[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x375739[_0x1969('0xb5')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x375739,_0x1969('0xb6'));}var _0xb6a878=this[_0x1969('0x1e')][_0x1969('0x81')](this,_0x375739[_0x1969('0xb5')]);if(!_0xb6a878){return this[_0x1969('0xe')]['error'](_0x375739,_0x1969('0xb7'));}var _0x41ed37=this['channel'][_0x1969('0x91')]('DIAL',[util[_0x1969('0x2c')](_0x1969('0xb8'),_0xb6a878),_0x375739['timeout'],_0x375739[_0x1969('0xb9')],_0x375739['url']]);if(_0x41ed37[_0x1969('0x7d')]===-0x1){return _0x41ed37;}return this[_0x1969('0xe')][_0x1969('0x8e')](util['format'](_0x1969('0xba'),'DIAL'));};AGIVertices[_0x1969('0x11')][_0x1969('0xbb')]=function(_0x4d2e8c){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4d2e8c['label']));if(!this['isConfigured'](_0x4d2e8c['key'])){return this['channel'][_0x1969('0x8e')](_0x1969('0xbc'));}if(!this[_0x1969('0x7f')](_0x4d2e8c[_0x1969('0x5f')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xbd'));}this[_0x1969('0xe')][_0x1969('0xbe')]=!![];this['createSquareDetailsReport'](_0x4d2e8c);this['createSquareMessage'](_0x4d2e8c[_0x1969('0x5f')],'in');this['channel'][_0x1969('0x8e')](util['format'](_0x1969('0xbf'),_0x4d2e8c[_0x1969('0x5f')]));var _0x195921=this['googleDialogflow'][_0x1969('0x81')](this,_0x4d2e8c);if(_0x195921){for(var _0x2a3734 in _0x195921){if(_0x195921[_0x1969('0xc0')](_0x2a3734)){this[_0x1969('0xe')]['setVariable'](util[_0x1969('0x2c')](_0x1969('0xc1'),_0x2a3734[_0x1969('0xc2')]()),_0x195921[_0x2a3734]);}}this[_0x1969('0x44')](_0x195921[_0x1969('0xc3')],_0x1969('0xc4'));return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0xc5'),_0x195921['speech']));}return this[_0x1969('0xe')][_0x1969('0x34')](_0x4d2e8c,_0x1969('0xc6'));};AGIVertices[_0x1969('0x11')][_0x1969('0xc7')]=function(_0x4f6773){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0xc8'),_0x4f6773[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x4f6773[_0x1969('0xc9')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xca'));}if(!this['isConfigured'](_0x4f6773['username'])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xcb'));}if(!this['isConfigured'](_0x4f6773[_0x1969('0xcc')])){return this[_0x1969('0xe')][_0x1969('0x8e')]('no\x20password\x20configured');}if(!this[_0x1969('0x7f')](_0x4f6773[_0x1969('0xcd')])){return this['channel'][_0x1969('0x8e')](_0x1969('0xbd'));}this[_0x1969('0xe')][_0x1969('0xbe')]=!![];this[_0x1969('0x39')](_0x4f6773);this['createSquareMessage'](_0x4f6773['text'],'in');this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('Trying\x20SestekNDA:\x20%s',_0x4f6773[_0x1969('0x5f')]));var _0x50c0f7=this[_0x1969('0x61')]['sync'](this,_0x4f6773);if(_0x50c0f7){for(var _0x193a0f in _0x50c0f7){if(_0x50c0f7[_0x1969('0xc0')](_0x193a0f)){this[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0xce'),_0x193a0f['toUpperCase']()),_0x50c0f7[_0x193a0f]);}}this['createSquareMessage'](_0x50c0f7[_0x1969('0xc3')],_0x1969('0xc4'));if(_0x50c0f7['audiofile']){this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x50c0f7[_0x1969('0xcf')]));var _0x361a98=this[_0x1969('0xe')][_0x1969('0xd0')](_0x50c0f7['audiofile']);try{fs[_0x1969('0xd1')](_0x50c0f7[_0x1969('0xcf')]+_0x1969('0xd2'));}catch(_0x29802a){logger[_0x1969('0x34')](_0x29802a);}return _0x361a98;}else{return this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0xd3'),_0x50c0f7[_0x1969('0xc3')]));}}return this[_0x1969('0xe')]['error'](_0x4f6773,_0x1969('0xd4'));};AGIVertices[_0x1969('0x11')][_0x1969('0xd5')]=function(_0x4e2d68){logger[_0x1969('0x32')](util['format'](_0x1969('0xd6'),_0x4e2d68[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xd5'));};AGIVertices['prototype'][_0x1969('0xd7')]=function(_0x3afefc){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0xd8'),_0x3afefc[_0x1969('0x3b')]));var _0x4db176='';if(_0x3afefc[_0x1969('0xd9')]){if(!this[_0x1969('0x7f')](_0x3afefc['trunk_id'])){return this['channel'][_0x1969('0x34')](_0x3afefc,_0x1969('0xda'));}else{var _0x28d09b=parseInt(_0x3afefc[_0x1969('0xd9')],0xa);if(isNaN(_0x28d09b)){_0x4db176=_0x3afefc['trunk_id'];}else{_0x4db176=this[_0x1969('0x20')][_0x1969('0x81')](this,_0x3afefc[_0x1969('0xd9')]);if(!_0x4db176){return this['channel'][_0x1969('0x34')](_0x3afefc,_0x1969('0xdb'));}}}}else if(_0x3afefc[_0x1969('0xdc')]){_0x4db176=_0x3afefc['trunk_name'];}else{return this['channel'][_0x1969('0x34')](_0x3afefc,_0x1969('0xda'));}var _0x3e8165=this[_0x1969('0xe')]['exec'](_0x1969('0xdd'),[util[_0x1969('0x2c')](_0x1969('0xde'),_0x4db176,_0x3afefc['phone']),_0x3afefc['timeout'],_0x3afefc['opts'],_0x3afefc[_0x1969('0xdf')]]);if(_0x3e8165[_0x1969('0x7d')]===-0x1){return _0x3e8165;}return this[_0x1969('0xe')][_0x1969('0x8e')](util['format'](_0x1969('0xba'),'DIAL'));};AGIVertices[_0x1969('0x11')]['finally']=function(_0x35492a){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x35492a[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xe0'));};AGIVertices['prototype'][_0x1969('0xd')]=function(_0x6ec9ba){logger['info'](util[_0x1969('0x2c')](_0x1969('0xe1'),_0x6ec9ba[_0x1969('0x3b')]));if(_0x6ec9ba[_0x1969('0x82')]===0x0){return this[_0x1969('0x80')](_0x6ec9ba);}_0x6ec9ba['retry']-=0x1;if(!this[_0x1969('0x7f')](_0x6ec9ba['file_id'])){return this[_0x1969('0xe')]['error'](_0x6ec9ba,_0x1969('0xe2'));}var _0x3ce649=this[_0x1969('0xe3')][_0x1969('0x81')](this,_0x6ec9ba['file_id']);if(!_0x3ce649){return this['channel']['error'](_0x6ec9ba,'no\x20file\x20audio\x20found');}if(!this[_0x1969('0x7f')](_0x6ec9ba['variable_id'])){return this[_0x1969('0xe')]['error'](_0x1969('0xad'));}var _0x3ad9b0=this[_0x1969('0xe')][_0x1969('0xe4')](_0x3ce649,_0x6ec9ba[_0x1969('0xe5')],_0x6ec9ba[_0x1969('0xe6')]);var _0x32668d=_0x3ad9b0[_0x1969('0x7d')]?_0x3ad9b0[_0x1969('0x7d')][_0x1969('0x4f')]():'';logger[_0x1969('0x32')](_0x1969('0xe7'),JSON[_0x1969('0xe8')](_0x3ad9b0));if(_0x3ad9b0['result']===-0x1){this['createSquareDetailsReport'][_0x1969('0x81')](this,_0x6ec9ba,_0x32668d);return _0x3ad9b0;}else if(_0x3ad9b0[_0x1969('0x7b')]==='timeout'){_0x3ad9b0[_0x1969('0x7d')]=_0x32668d[_0x1969('0x79')]>=parseInt(_0x6ec9ba[_0x1969('0xe9')])?'x':'i';}else{_0x3ad9b0[_0x1969('0x7d')]=_0x32668d[_0x1969('0x79')]>=parseInt(_0x6ec9ba[_0x1969('0xe9')])&&_0x32668d[_0x1969('0x79')]<=parseInt(_0x6ec9ba[_0x1969('0xe6')])?'x':'i';}var _0x3da45c=this[_0x1969('0x12')][_0x1969('0x81')](this,_0x6ec9ba[_0x1969('0xae')]);if(!_0x3da45c){return this['channel']['error'](_0x6ec9ba,'no\x20variable\x20found');}this['channel'][_0x1969('0xb1')](_0x3da45c,_0x32668d);if(this['isConfigured'](_0x6ec9ba[_0x1969('0xea')])){var _0xbce88e=parseInt(_0x6ec9ba[_0x1969('0xea')],0xa);var _0x37257f=rs[_0x1969('0xeb')]({'charset':'*','length':_0xbce88e});var _0x52aabd=_0x32668d['length'];if(_0x52aabd>0x0){if(_0x52aabd>_0xbce88e){this[_0x1969('0x39')][_0x1969('0x81')](this,_0x6ec9ba,_0x6ec9ba['hiddendigitspos']==='first'?_0x37257f+_0x32668d[_0x1969('0xec')](_0xbce88e):_0x32668d[_0x1969('0xec')](0x0,_0x52aabd-_0xbce88e)+_0x37257f);}else{this['createSquareDetailsReport'][_0x1969('0x81')](this,_0x6ec9ba,rs[_0x1969('0xeb')]({'charset':'*','length':_0x52aabd}));}}else{this[_0x1969('0x39')][_0x1969('0x81')](this,_0x6ec9ba,'');}}else{this[_0x1969('0x39')][_0x1969('0x81')](this,_0x6ec9ba,_0x32668d);}return _0x3ad9b0;};AGIVertices[_0x1969('0x11')]['getsecretdigits']=function(_0x40e7d8){logger[_0x1969('0x32')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x40e7d8['label']));return this[_0x1969('0xd')](_0x40e7d8);};AGIVertices[_0x1969('0x11')][_0x1969('0xed')]=function(_0x26cc04){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0xee'),_0x26cc04['label']));this[_0x1969('0x39')][_0x1969('0x81')](this,_0x26cc04,_0x26cc04[_0x1969('0xef')]);return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0xf0'),_0x26cc04[_0x1969('0xef')]));};AGIVertices[_0x1969('0x11')][_0x1969('0xf1')]=function(_0x3c125d){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0xf2'),_0x3c125d[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x3c125d['aws_access_key_id'])||!this[_0x1969('0x7f')](_0x3c125d[_0x1969('0x6a')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xf3'));}if(!this[_0x1969('0x7f')](_0x3c125d[_0x1969('0x5f')])){return this[_0x1969('0xe')]['noop'](_0x1969('0xbd'));}this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0xf4'),_0x3c125d[_0x1969('0x5f')]));var _0x156217=this[_0x1969('0x68')]['sync'](this,_0x3c125d);if(_0x156217){this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0xf5'),_0x156217));var _0x2ebed1=this['channel'][_0x1969('0xd0')](_0x156217);try{fs['unlink'](_0x156217+_0x1969('0xd2'));}catch(_0x55f323){logger[_0x1969('0x34')](_0x55f323);}return _0x2ebed1;}return this['channel'][_0x1969('0x34')](_0x3c125d,_0x1969('0xf6'));};AGIVertices[_0x1969('0x11')][_0x1969('0xf7')]=function(_0xef86ff){logger['info'](util[_0x1969('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xef86ff[_0x1969('0x3b')]));if(!this['isConfigured'](_0xef86ff['aws_access_key_id'])||!this['isConfigured'](_0xef86ff[_0x1969('0x6a')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xf3'));}if(!this[_0x1969('0x7f')](_0xef86ff[_0x1969('0xf8')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xf9'));}if(!this[_0x1969('0x7f')](_0xef86ff['text'])){return this['channel'][_0x1969('0x8e')](_0x1969('0xbd'));}this['channel']['bot']=!![];this[_0x1969('0x39')](_0xef86ff);this[_0x1969('0x44')](_0xef86ff[_0x1969('0x5f')],'in');this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0xfa'),_0xef86ff[_0x1969('0x5f')]));var _0x11f372=this['awsLex'][_0x1969('0x81')](this,_0xef86ff);if(_0x11f372){for(var _0x5672e6 in _0x11f372){if(_0x11f372[_0x1969('0xc0')](_0x5672e6)&&_['isString'](_0x11f372[_0x5672e6])){this[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0xfb'),_0x5672e6[_0x1969('0xc2')]()),_0x11f372[_0x5672e6]);}}if(_[_0x1969('0x47')](_0x11f372['message'])){return this[_0x1969('0xe')][_0x1969('0x8e')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x1969('0x44')](_0x11f372['message'],_0x1969('0xc4'));return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0xfc'),_0x11f372['message']));}}return this[_0x1969('0xe')][_0x1969('0x34')](_0xef86ff,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x1969('0x11')][_0x1969('0xfd')]=function(_0x4591f4){logger['info'](util[_0x1969('0x2c')](_0x1969('0xfe'),_0x4591f4[_0x1969('0x3b')],_0x4591f4[_0x1969('0x87')]));if(!this[_0x1969('0x7f')](_0x4591f4[_0x1969('0x5e')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xbc'));}var _0x52a688=_0x1969('0xff');var _0x9ada0a=util[_0x1969('0x2c')](_0x1969('0x100'),FILES_PATH,rs[_0x1969('0xeb')](0x4));var _0x4beece=util['format'](_0x1969('0x101'),_0x9ada0a,_0x52a688);var _0x3e4b55=!![];if(_0x4591f4[_0x1969('0x102')]===_0x1969('0x103')){_0x3e4b55=![];}var _0x7a43f6=this[_0x1969('0xe')][_0x1969('0x104')](_0x9ada0a,_0x52a688,_0x4591f4['intKey'],_0x4591f4['timeout'],undefined,_0x3e4b55);if(_0x7a43f6[_0x1969('0x7d')]!==-0x1){this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('google\x20%s\x20file\x20created',_0x4beece));var _0x18ef58=this[_0x1969('0x6f')][_0x1969('0x81')](this,_0x4591f4,_0x4beece);if(_0x18ef58){for(var _0x430f49 in _0x18ef58){if(_0x18ef58['hasOwnProperty'](_0x430f49)){this[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0x105'),_0x430f49['toUpperCase']()),_0x18ef58[_0x430f49]);}}return this['channel']['noop'](util[_0x1969('0x2c')](_0x1969('0x106'),JSON[_0x1969('0xe8')](_0x18ef58)));}}return _0x7a43f6;};AGIVertices['prototype'][_0x1969('0x107')]=function(_0xd463b1){logger['info'](util[_0x1969('0x2c')](_0x1969('0x108'),_0xd463b1[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0xd463b1[_0x1969('0x109')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0x10a'));}if(!this[_0x1969('0x7f')](_0xd463b1['appsecret'])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0x10b'));}var _0x1046e3='wav';var _0x30da9b=util['format'](_0x1969('0x100'),FILES_PATH,rs[_0x1969('0xeb')](0x4));var _0x2e21fd=util[_0x1969('0x2c')](_0x1969('0x101'),_0x30da9b,_0x1046e3);var _0x2282a6=!![];if(_0xd463b1['beep']===_0x1969('0x103')){_0x2282a6=![];}var _0x418ae0=this['channel']['recordFile'](_0x30da9b,_0x1046e3,_0xd463b1[_0x1969('0x10c')],_0xd463b1[_0x1969('0x87')],undefined,_0x2282a6);if(_0x418ae0[_0x1969('0x7d')]!==-0x1){this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x10d'),_0x2e21fd));var _0x330e18=this[_0x1969('0x71')]['sync'](this,_0xd463b1,_0x2e21fd);if(_0x330e18){for(var _0x2a55f5 in _0x330e18){if(_0x330e18[_0x1969('0xc0')](_0x2a55f5)){this[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0x10e'),_0x2a55f5[_0x1969('0xc2')]()),_0x330e18[_0x2a55f5]);}}return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x10f'),JSON[_0x1969('0xe8')](_0x330e18)));}}return _0x418ae0;};AGIVertices[_0x1969('0x11')]['gotoc']=function(_0xa6fa4b){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0xa6fa4b['label']));return this['channel'][_0x1969('0x110')](_0xa6fa4b[_0x1969('0x40')],_0xa6fa4b[_0x1969('0x41')],_0xa6fa4b[_0x1969('0x111')]);};AGIVertices['prototype']['gotoif']=function(_0x187f27){logger[_0x1969('0x32')](util['format'](_0x1969('0x112'),_0x187f27[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x187f27[_0x1969('0x113')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x187f27,_0x1969('0x114'));}try{var _0x155208=eval(_0x187f27[_0x1969('0x113')])?_0x1969('0x115'):_0x1969('0x116');this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x117'),_0x187f27[_0x1969('0x113')],_0x155208));return{'code':0xc8,'result':_0x155208};}catch(_0x38524f){return{'code':0xc8,'result':_0x1969('0x116')};}};AGIVertices['prototype'][_0x1969('0x118')]=function(_0x464175){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x119'),_0x464175[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x464175[_0x1969('0x11a')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x464175,'no\x20interval\x20configured');}var _0x208bb8=this[_0x1969('0x27')][_0x1969('0x81')](this,_0x464175['interval_id']);if(!_0x208bb8){return this['channel']['error'](_0x464175,'no\x20intervals\x20found');}for(var _0x5ec12f=0x0;_0x5ec12f<_0x208bb8[_0x1969('0x79')];_0x5ec12f+=0x1){var _0x8c58b1=this['channel'][_0x1969('0x12')](util[_0x1969('0x2c')](_0x1969('0x11b'),_0x208bb8[_0x5ec12f]));if(_0x8c58b1[_0x1969('0x7d')]===-0x1){return _0x8c58b1;}logger['info'](util[_0x1969('0x2c')](_0x1969('0x11c'),_0x208bb8[_0x5ec12f],_0x8c58b1[_0x1969('0x7b')]));if(_0x8c58b1[_0x1969('0x7b')]===_0x1969('0x115')){logger['info'](util['format'](_0x1969('0x11c'),_0x208bb8[_0x5ec12f],'true'));this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x11c'),_0x208bb8[_0x5ec12f],_0x1969('0x115')));return{'code':0xc8,'result':_0x1969('0x115')};}else{logger[_0x1969('0x32')](util['format'](_0x1969('0x11c'),_0x208bb8[_0x5ec12f],_0x1969('0x116')));this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0x11c'),_0x208bb8[_0x5ec12f],_0x1969('0x116')));}}return{'code':0xc8,'result':_0x1969('0x116')};};AGIVertices['prototype'][_0x1969('0x11d')]=function(_0x40b8b2){logger['info'](util[_0x1969('0x2c')](_0x1969('0x11e'),_0x40b8b2[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x11d')]();};AGIVertices[_0x1969('0x11')][_0x1969('0x11f')]=function(_0x98c1a9){logger[_0x1969('0x32')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x98c1a9['label']));if(!this['isConfigured'](_0x98c1a9['key'])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xbc'));}var _0x18936c=_0x1969('0xff');var _0x204849=util[_0x1969('0x2c')](_0x1969('0x100'),FILES_PATH,rs[_0x1969('0xeb')](0x4));var _0x41ba66=util[_0x1969('0x2c')]('%s.%s',_0x204849,_0x18936c);var _0x5e0550=!![];if(_0x98c1a9[_0x1969('0x102')]===_0x1969('0x103')){_0x5e0550=![];}var _0x8eaa8d=this['channel'][_0x1969('0x104')](_0x204849,_0x18936c,_0x98c1a9[_0x1969('0x10c')],_0x98c1a9[_0x1969('0x87')],undefined,_0x5e0550);if(_0x8eaa8d[_0x1969('0x7d')]!==-0x1){this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x120'),_0x41ba66));var _0x48c22c=this[_0x1969('0x65')][_0x1969('0x81')](this,_0x98c1a9,_0x41ba66);if(_0x48c22c){for(var _0x20cf5d in _0x48c22c){if(_0x48c22c[_0x1969('0xc0')](_0x20cf5d)){this[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0x121'),_0x20cf5d[_0x1969('0xc2')]()),_0x48c22c[_0x20cf5d]);}}return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0x1969('0xe8')](_0x48c22c)));}}return _0x8eaa8d;};AGIVertices[_0x1969('0x11')]['ispeechtts']=function(_0x25a6d9){logger['info'](util[_0x1969('0x2c')](_0x1969('0x122'),_0x25a6d9['label']));if(!this[_0x1969('0x7f')](_0x25a6d9[_0x1969('0x5e')])){return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xbc'));}if(!this[_0x1969('0x7f')](_0x25a6d9[_0x1969('0x5f')])){return this['channel'][_0x1969('0x8e')](_0x1969('0xbd'));}this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x123'),_0x25a6d9['text']));var _0x462274=this[_0x1969('0x62')][_0x1969('0x81')](this,_0x25a6d9);if(_0x462274){this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x120'),_0x462274));var _0x199bb8=this[_0x1969('0xe')][_0x1969('0xd0')](_0x462274,_0x25a6d9[_0x1969('0x10c')]);try{fs['unlink'](_0x462274+_0x1969('0xd2'));}catch(_0x285d3c){logger['error'](_0x285d3c);}return _0x199bb8;}return this[_0x1969('0xe')][_0x1969('0x34')](_0x25a6d9,_0x1969('0x124'));};AGIVertices[_0x1969('0x11')][_0x1969('0x125')]=function(_0x48d572){logger[_0x1969('0x32')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x48d572['label']));if(!this['isConfigured'](_0x48d572['findBy'])){return this[_0x1969('0xe')]['error'](_0x48d572,_0x1969('0x126'));}logger[_0x1969('0x32')](util['format'](_0x1969('0x127'),this[_0x1969('0xe')]['callerid'],_0x48d572[_0x1969('0x128')]));var _0x2d8e86=this['agentLogin'][_0x1969('0x81')](this,_0x48d572[_0x1969('0x128')]);if(_0x2d8e86){logger[_0x1969('0x32')](util['format'](_0x1969('0x129'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x48d572[_0x1969('0x128')]));this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1969('0xe')][_0x1969('0x3f')],_0x48d572[_0x1969('0x128')]));return{'code':0xc8,'result':_0x1969('0x12a')};}else{logger['info'](util[_0x1969('0x2c')](_0x1969('0x12b'),this['channel'][_0x1969('0x3f')],_0x48d572[_0x1969('0x128')]));this[_0x1969('0xe')][_0x1969('0x8e')](util['format'](_0x1969('0x12b'),this['channel'][_0x1969('0x3f')],_0x48d572[_0x1969('0x128')]));return{'code':0xc8,'result':_0x1969('0x12c')};}};AGIVertices[_0x1969('0x11')][_0x1969('0x12d')]=function(_0x11572e){logger[_0x1969('0x32')](util['format'](_0x1969('0x12e'),_0x11572e[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x11572e[_0x1969('0x128')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x11572e,'no\x20find\x20by\x20configured');}logger['info'](util[_0x1969('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1969('0xe')][_0x1969('0x3f')],_0x11572e[_0x1969('0x128')]));var _0x5d250d=this[_0x1969('0x55')][_0x1969('0x81')](this,_0x11572e[_0x1969('0x128')]);if(_0x5d250d){logger[_0x1969('0x32')](util['format'](_0x1969('0x129'),this[_0x1969('0xe')]['callerid'],_0x11572e[_0x1969('0x128')]));this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x129'),this['channel'][_0x1969('0x3f')],_0x11572e['findBy']));return{'code':0xc8,'result':_0x1969('0x12a')};}else{logger['info'](util[_0x1969('0x2c')](_0x1969('0x12b'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x11572e[_0x1969('0x128')]));this['channel']['noop'](util[_0x1969('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1969('0xe')][_0x1969('0x3f')],_0x11572e[_0x1969('0x128')]));return{'code':0xc8,'result':_0x1969('0x12c')};}};AGIVertices[_0x1969('0x11')][_0x1969('0x12f')]=function(_0x279cd8){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x130'),_0x279cd8['label']));if(!this[_0x1969('0x7f')](_0x279cd8[_0x1969('0x131')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x279cd8,_0x1969('0x132'));}this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x133'),_0x279cd8[_0x1969('0x131')]));var _0xb7c1e7=eval(_0x279cd8[_0x1969('0x131')]);if(!this[_0x1969('0x7f')](_0x279cd8[_0x1969('0xae')])){return this['channel'][_0x1969('0x8e')](_0x1969('0xad'));}var _0x15c0bc=this[_0x1969('0x12')][_0x1969('0x81')](this,_0x279cd8[_0x1969('0xae')]);if(!_0x15c0bc){return this[_0x1969('0xe')][_0x1969('0x34')](_0x279cd8,_0x1969('0x134'));}if(_['isArray'](_0xb7c1e7)){var _0x4c9c4e=this;_0xb7c1e7[_0x1969('0xaf')](function(_0x49e7d5,_0x4cd35e){_0x4c9c4e[_0x1969('0xe')][_0x1969('0xb1')](util[_0x1969('0x2c')](_0x1969('0x135'),_0x15c0bc,_0x4cd35e),_0x49e7d5);});return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0x136'),_0x15c0bc));}else{return this['channel'][_0x1969('0xb1')](_0x15c0bc,_0xb7c1e7);}};AGIVertices['prototype'][_0x1969('0xc')]=function(_0x3f180e){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x137'),_0x3f180e[_0x1969('0x3b')]));if(_0x3f180e['retry']===0x0){return this[_0x1969('0x80')](_0x3f180e);}_0x3f180e[_0x1969('0x82')]-=0x1;if(!this[_0x1969('0x7f')](_0x3f180e['file_id'])){return this[_0x1969('0xe')]['error'](_0x3f180e,_0x1969('0xe2'));}var _0x124a2b=this[_0x1969('0xe3')][_0x1969('0x81')](this,_0x3f180e[_0x1969('0x138')]);if(!_0x124a2b){return this[_0x1969('0xe')][_0x1969('0x34')](_0x3f180e,_0x1969('0x139'));}var _0xd6ce25=this[_0x1969('0xe')][_0x1969('0xe4')](_0x124a2b,_0x3f180e[_0x1969('0xe5')],_0x3f180e[_0x1969('0x13a')]);var _0x5f1dae=_0xd6ce25['result'];if(_0xd6ce25[_0x1969('0x7d')]===-0x1){this[_0x1969('0x39')][_0x1969('0x81')](this,_0x3f180e,'-1');return _0xd6ce25;}else if(_0xd6ce25[_0x1969('0x7b')]===_0x1969('0x87')){_0xd6ce25[_0x1969('0x7d')]=_0xd6ce25['result'][_0x1969('0x79')]>0x0?_0xd6ce25[_0x1969('0x7d')]:'t';}else if(_[_0x1969('0x46')](_0xd6ce25[_0x1969('0x7d')])){_0xd6ce25[_0x1969('0x7d')]='#';_0x5f1dae='#';}if(!this[_0x1969('0x7f')](_0x3f180e[_0x1969('0xae')])){this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0xad'));}else{var _0x30ff4d=this[_0x1969('0x12')][_0x1969('0x81')](this,_0x3f180e['variable_id']);if(!_0x30ff4d){return this[_0x1969('0xe')][_0x1969('0x34')](_0x3f180e,'no\x20variable\x20found');}this['channel'][_0x1969('0xb1')](_0x30ff4d,_0x5f1dae);}this[_0x1969('0x39')]['sync'](this,_0x3f180e,_0x5f1dae);return _0xd6ce25;};AGIVertices[_0x1969('0x11')][_0x1969('0x8e')]=function(_0x226a1b){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x13b'),_0x226a1b[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x8e')](_0x226a1b[_0x1969('0x13c')]||_0x226a1b['label']);};AGIVertices[_0x1969('0x11')][_0x1969('0x13d')]=function(_0x2bb476){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x13e'),_0x2bb476[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x2bb476[_0x1969('0x128')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x2bb476,'no\x20find\x20by\x20configured');}logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x127'),this['channel'][_0x1969('0x3f')],_0x2bb476[_0x1969('0x128')]));var _0x33cf80=this[_0x1969('0x51')][_0x1969('0x81')](this,_0x2bb476[_0x1969('0x13f')]);var _0x6c485a=this[_0x1969('0x140')][_0x1969('0x81')](this,_0x2bb476[_0x1969('0x128')],_0x33cf80);if(_0x6c485a){logger['info'](util[_0x1969('0x2c')](_0x1969('0x129'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x2bb476[_0x1969('0x128')]));this['channel']['noop'](util[_0x1969('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1969('0x3f')],_0x2bb476[_0x1969('0x128')]));return{'code':0xc8,'result':_0x1969('0x12a')};}else{logger['info'](util[_0x1969('0x2c')](_0x1969('0x12b'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x2bb476[_0x1969('0x128')]));this['channel']['noop'](util[_0x1969('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1969('0x3f')],_0x2bb476[_0x1969('0x128')]));return{'code':0xc8,'result':_0x1969('0x12c')};}};AGIVertices[_0x1969('0x11')]['playback']=function(_0xc08447){logger[_0x1969('0x32')](util['format'](_0x1969('0x141'),_0xc08447[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0xc08447[_0x1969('0x138')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0xc08447,_0x1969('0xe2'));}var _0x187c9a=this[_0x1969('0xe3')][_0x1969('0x81')](this,_0xc08447[_0x1969('0x138')]);if(!_0x187c9a){return this[_0x1969('0xe')]['error'](_0xc08447,_0x1969('0x139'));}var _0x48869a=this[_0x1969('0xe')][_0x1969('0x91')]('PLAYBACK',[_0x187c9a,_0xc08447[_0x1969('0xb9')]]);if(_0x48869a[_0x1969('0x7d')]===-0x1){return _0x48869a;}return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0x93'),_0x1969('0x142'),_0x187c9a));};AGIVertices[_0x1969('0x11')][_0x1969('0x143')]=function(_0x10de0d){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x144'),_0x10de0d[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x10de0d[_0x1969('0x145')])){return this[_0x1969('0xe')]['error'](_0x10de0d,_0x1969('0x146'));}var _0x3f90a8='';var _0x5a38e6=parseInt(_0x10de0d[_0x1969('0x145')],0xa);if(isNaN(_0x5a38e6)){_0x3f90a8=_0x10de0d[_0x1969('0x145')];}else{_0x3f90a8=this[_0x1969('0x17')][_0x1969('0x81')](this,_0x10de0d[_0x1969('0x145')]);if(!_0x3f90a8){return this['channel']['error'](_0x10de0d,_0x1969('0x147'));}}var _0x302070='';if(this[_0x1969('0x7f')](_0x10de0d['file_id'])){var _0x53bd54=this['getSound'][_0x1969('0x81')](this,_0x10de0d['file_id']);if(_0x53bd54){_0x302070=_0x53bd54;}}this[_0x1969('0x39')][_0x1969('0x81')](this,_0x10de0d,_0x3f90a8);if(_0x10de0d['opts'][_0x1969('0x148')]('x')<0x0){_0x10de0d[_0x1969('0xb9')]+='x';}if(_0x10de0d[_0x1969('0xb9')][_0x1969('0x148')]('X')<0x0){_0x10de0d[_0x1969('0xb9')]+='X';}this[_0x1969('0xe')][_0x1969('0xb1')](_0x1969('0x149'),_0x3f90a8?_0x3f90a8[_0x1969('0x14a')]():'');var _0x3c0271=this[_0x1969('0xe')]['exec'](_0x1969('0x14b'),[_0x3f90a8,_0x10de0d['opts'],_0x10de0d[_0x1969('0xdf')],_0x302070,_0x10de0d[_0x1969('0x87')],_0x10de0d[_0x1969('0x9')],_0x10de0d[_0x1969('0x14c')],_0x10de0d[_0x1969('0x14d')],'',_0x10de0d['position']]);if(_0x3c0271[_0x1969('0x7d')]===-0x1){return _0x3c0271;}return this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x93'),_0x1969('0x14b'),_0x3f90a8));};AGIVertices[_0x1969('0x11')][_0x1969('0x14e')]=function(_0x38323d){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x14f'),_0x38323d[_0x1969('0x3b')]));var _0x27070f=_0x38323d[_0x1969('0x150')]||'wav';var _0x55c1c0=util[_0x1969('0x2c')](_0x1969('0x151'),this[_0x1969('0xe')][_0x1969('0x3a')],rs[_0x1969('0xeb')](0x5));var _0x55e241=util[_0x1969('0x2c')](_0x1969('0x152'),FILES_PATH,_0x55c1c0,_0x27070f);var _0x1df0e7=util[_0x1969('0x2c')](_0x1969('0x100'),FILES_PATH,_0x55c1c0);this[_0x1969('0x3e')][_0x1969('0x81')](this,_0x38323d,_0x55c1c0,_0x55e241);this['channel'][_0x1969('0xb1')](_0x1969('0x153'),_0x55c1c0);logger[_0x1969('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x1df0e7,_0x27070f,_0x38323d[_0x1969('0x154')],_0x38323d[_0x1969('0x87')]);return this['channel'][_0x1969('0x104')](_0x1df0e7,_0x27070f,_0x38323d[_0x1969('0x154')],_0x38323d[_0x1969('0x87')],undefined,!![]);};AGIVertices[_0x1969('0x11')][_0x1969('0x155')]=function(_0x329aad){logger[_0x1969('0x32')](util['format'](_0x1969('0x156'),_0x329aad[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x157')](_0x329aad[_0x1969('0x158')][_0x1969('0x5a')](/\s+/g,''),_0x329aad[_0x1969('0x154')]);};AGIVertices[_0x1969('0x11')]['saynumber']=function(_0x225ed7){logger[_0x1969('0x32')](util['format'](_0x1969('0x159'),_0x225ed7[_0x1969('0x3b')]));return this[_0x1969('0xe')][_0x1969('0x15a')](_0x225ed7[_0x1969('0x15b')][_0x1969('0x5a')](/\s+/g,''),_0x225ed7[_0x1969('0x154')]);};AGIVertices[_0x1969('0x11')][_0x1969('0x15c')]=function(_0x5057c1){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x15d'),_0x5057c1['label']));return this['channel'][_0x1969('0x15e')](_0x5057c1[_0x1969('0x5f')],_0x5057c1[_0x1969('0x154')]);};AGIVertices[_0x1969('0x11')]['sendMail']=function(_0x5061bd){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x15f'),_0x5061bd['label']));if(!this[_0x1969('0x7f')](_0x5061bd[_0x1969('0x160')])){return this['channel'][_0x1969('0x8e')](_0x1969('0x161'));}var _0x2444db=this[_0x1969('0x162')][_0x1969('0x81')](this,_0x5061bd[_0x1969('0x160')]);if(!_0x2444db||!_0x2444db[_0x1969('0x163')]){return this['channel'][_0x1969('0x34')](_0x5061bd,_0x1969('0x164'));}var _0x5f47c0={'from':util[_0x1969('0x2c')](_0x1969('0x165'),_0x2444db[_0x1969('0x15')],_0x2444db[_0x1969('0x166')]||_0x2444db[_0x1969('0x163')]['user']),'to':_0x5061bd['to']||'','cc':_0x5061bd['cc']||'','bcc':_0x5061bd[_0x1969('0x167')]||'','subject':_0x5061bd[_0x1969('0x168')],'html':_0x5061bd[_0x1969('0x5f')],'text':_0x5061bd[_0x1969('0x5f')]};var _0x54d364={'tls':{'rejectUnauthorized':![]}};if(_0x2444db[_0x1969('0x163')]['service']){_0x54d364['service']=_0x2444db['Smtp']['service'];}else{_0x54d364['host']=_0x2444db[_0x1969('0x163')][_0x1969('0x169')];_0x54d364['port']=_0x2444db[_0x1969('0x163')][_0x1969('0x16a')];_0x54d364[_0x1969('0x16b')]=_0x2444db[_0x1969('0x163')]['secure'];}if(_0x2444db['Smtp'][_0x1969('0x16c')]){_0x54d364[_0x1969('0x16d')]={'user':_0x2444db[_0x1969('0x163')][_0x1969('0x16e')],'pass':_0x2444db[_0x1969('0x163')][_0x1969('0x16f')]};}if(this[_0x1969('0x7f')](_0x5061bd['template_id'])){}logger['debug'](_0x1969('0x170'),JSON['stringify'](_0x5f47c0));this[_0x1969('0x39')][_0x1969('0x81')](this,_0x5061bd,_0x5061bd[_0x1969('0x160')]);this['channel']['noop'](util[_0x1969('0x2c')](_0x1969('0x171'),_0x2444db[_0x1969('0x15')]));this[_0x1969('0x26')][_0x1969('0x81')](this,_0x54d364,_0x5f47c0);return this[_0x1969('0xe')]['noop'](_0x1969('0x172'));};AGIVertices[_0x1969('0x11')][_0x1969('0x173')]=function(_0x37e3e9){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x174'),_0x37e3e9['label']));return this['channel'][_0x1969('0x8e')](_0x1969('0x175'));};AGIVertices[_0x1969('0x11')][_0x1969('0x176')]=function(_0x12d095){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x177'),_0x12d095[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x12d095['sms_account_id'])){return this[_0x1969('0xe')][_0x1969('0x8e')]('no\x20sms\x20account\x20configured');}var _0x529f1a=this[_0x1969('0x36')]['sync'](this,_0x12d095['sms_account_id']);if(!_0x529f1a){return this[_0x1969('0xe')]['error'](_0x12d095,_0x1969('0x178'));}var _0x69ee37={'body':_0x12d095[_0x1969('0x179')],'phone':_0x12d095['to']||'','SmsAccountId':_0x529f1a['id']};logger[_0x1969('0xb4')]('sendSMS\x20message',JSON[_0x1969('0xe8')](_0x69ee37));this[_0x1969('0x39')]['sync'](this,_0x12d095,_0x12d095[_0x1969('0x17a')]);this[_0x1969('0xe')][_0x1969('0x8e')](util['format'](_0x1969('0x17b'),_0x529f1a[_0x1969('0x15')]));this[_0x1969('0x38')][_0x1969('0x81')](this,_0x69ee37);return this[_0x1969('0xe')]['noop'](_0x1969('0x17c'));};AGIVertices[_0x1969('0x11')]['set']=function(_0x26e8c2){logger[_0x1969('0x32')](util['format'](_0x1969('0x17d'),_0x26e8c2[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x26e8c2[_0x1969('0xae')])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x26e8c2,_0x1969('0x17e'));}var _0x1eb6a6=this[_0x1969('0x12')]['sync'](this,_0x26e8c2[_0x1969('0xae')]);if(!_0x1eb6a6){return this[_0x1969('0xe')][_0x1969('0x34')](_0x26e8c2,'no\x20variable\x20found');}return this[_0x1969('0xe')][_0x1969('0xb1')](_0x1eb6a6,_0x26e8c2[_0x1969('0x17f')]);};AGIVertices[_0x1969('0x11')][_0x1969('0x180')]=function(_0x5848ab){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5848ab['label']));this[_0x1969('0xe')][_0x1969('0x8e')]('START\x20CALLY\x20SQUARE');if(_0x5848ab['answer']==='yes'){this['channel'][_0x1969('0x8e')](_0x1969('0x181'));return this[_0x1969('0xe')][_0x1969('0x85')]();}return this[_0x1969('0xe')][_0x1969('0x8e')](_0x1969('0x182'));};AGIVertices[_0x1969('0x11')][_0x1969('0x183')]=function(_0x550f44){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x184'),_0x550f44[_0x1969('0x3b')]));if(!this['isConfigured'](_0x550f44[_0x1969('0x185')])){return this['channel'][_0x1969('0x34')](_0x550f44,_0x1969('0x186'));}var _0x50f678=this['getSquareProject'][_0x1969('0x81')](this,_0x550f44['project_id']);if(!this['isConfigured'](_0x50f678)){return this[_0x1969('0xe')][_0x1969('0x34')](_0x550f44,util[_0x1969('0x2c')](_0x1969('0x187'),_0x550f44[_0x1969('0x185')]));}if(_0x50f678===this[_0x1969('0xe')]['arg_1']){return this[_0x1969('0xe')][_0x1969('0x34')](_0x550f44,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x1969('0x39')]['sync'](this,_0x550f44,_0x50f678);var _0x395d85=this[_0x1969('0xe')]['exec'](_0x1969('0x188'),util[_0x1969('0x2c')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x1969('0x9')][_0x1969('0x169')]||_0x1969('0x189'),_0x50f678,this[_0x1969('0xe')][_0x1969('0x3d')]));if(_0x395d85[_0x1969('0x7d')]===-0x1){return _0x395d85;}return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')](_0x1969('0x93'),'AGI',_0x50f678));};AGIVertices['prototype'][_0x1969('0x18a')]=function(_0x17a536){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x17a536['label']));var _0x41ebb6=this[_0x1969('0x18b')][_0x1969('0x81')](this,_0x17a536['command']);this[_0x1969('0x39')]['sync'](this,_0x17a536,_0x17a536[_0x1969('0x84')]);if(this[_0x1969('0x7f')](_0x17a536[_0x1969('0xae')])){var _0x51132e=this[_0x1969('0x12')][_0x1969('0x81')](this,_0x17a536[_0x1969('0xae')]);if(_0x51132e){this[_0x1969('0xe')][_0x1969('0xb1')](_0x51132e,_0x41ebb6);return this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x18c'),_0x17a536[_0x1969('0x84')],_0x51132e));}}return this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x17a536[_0x1969('0x84')]));};AGIVertices['prototype'][_0x1969('0x18d')]=function(_0x351317){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x18e'),_0x351317['label']));if(!this[_0x1969('0x7f')](_0x351317['text'])){return this[_0x1969('0xe')][_0x1969('0x8e')]('no\x20text\x20configured');}this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x351317[_0x1969('0x5f')]));var _0x5732b5=this[_0x1969('0x5b')][_0x1969('0x81')](this,_0x351317);if(_0x5732b5){this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x18f'),_0x5732b5));var _0x45ec9c=this[_0x1969('0xe')][_0x1969('0xd0')](_0x5732b5);try{fs[_0x1969('0xd1')](_0x5732b5+_0x1969('0xd2'));}catch(_0x13a6ef){logger[_0x1969('0x34')](_0x13a6ef);}return _0x45ec9c;}return this[_0x1969('0xe')][_0x1969('0x34')](_0x351317,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1969('0x11')][_0x1969('0x190')]=function(_0x1b07cf){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x191'),_0x1b07cf[_0x1969('0x3b')]));if(!this[_0x1969('0x7f')](_0x1b07cf['findBy'])){return this[_0x1969('0xe')]['error'](_0x1b07cf,_0x1969('0x126'));}logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x127'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x1b07cf['findBy']));var _0x17d34d=this['agentUnpause'][_0x1969('0x81')](this,_0x1b07cf[_0x1969('0x128')]);if(_0x17d34d){logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x129'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x1b07cf[_0x1969('0x128')]));this['channel'][_0x1969('0x8e')](util[_0x1969('0x2c')](_0x1969('0x129'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x1b07cf['findBy']));return{'code':0xc8,'result':_0x1969('0x12a')};}else{logger[_0x1969('0x32')](util[_0x1969('0x2c')](_0x1969('0x12b'),this[_0x1969('0xe')][_0x1969('0x3f')],_0x1b07cf['findBy']));this[_0x1969('0xe')][_0x1969('0x8e')](util[_0x1969('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x1969('0x3f')],_0x1b07cf[_0x1969('0x128')]));return{'code':0xc8,'result':_0x1969('0x12c')};}};AGIVertices[_0x1969('0x11')][_0x1969('0x192')]=function(_0x549346){logger[_0x1969('0x32')](util[_0x1969('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x549346[_0x1969('0x3b')]));var _0x314ce2=this[_0x1969('0xe')][_0x1969('0x91')](_0x1969('0x193'),[_0x549346[_0x1969('0x194')],_0x549346['options']]);if(_0x314ce2[_0x1969('0x7d')]===-0x1){return _0x314ce2;}return this[_0x1969('0xe')]['noop'](util[_0x1969('0x2c')]('Executed\x20command\x20%s\x20%s',_0x1969('0x193'),_0x549346['mailbox']));};AGIVertices[_0x1969('0x11')][_0x1969('0x195')]=function(_0x17872a){logger['info'](util['format'](_0x1969('0x196'),_0x17872a['label']));if(!this[_0x1969('0x7f')](_0x17872a['variable_id'])){return this[_0x1969('0xe')][_0x1969('0x34')](_0x17872a,'no\x20variable\x20selected');}var _0x455855=this['getVariable']['sync'](this,_0x17872a['variable_id']);if(!_0x455855){return this['channel'][_0x1969('0x34')](_0x17872a,'no\x20variable\x20found');}var _0x3ec7d8=this[_0x1969('0xe')]['getVariable'](_0x455855);return{'code':0xc8,'result':_0x3ec7d8[_0x1969('0x7b')]?_0x3ec7d8['extra']:'-'};};String[_0x1969('0x11')][_0x1969('0x7a')]=function(_0x18f413,_0x199c69){return this['split'](_0x18f413)[_0x1969('0x197')](_0x199c69);};module[_0x1969('0x198')]=AGIVertices; \ No newline at end of file +var _0x42e3=['sync','retry','maxRetry','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','timeout','answer','no\x20list\x20selected','delay','noop','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','options','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','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','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','url','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','stringify','mindigit','getVariable','hiddendigitsnum','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','isString','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','wav','%s/recordings/%s','beep','NOBEEP','recordFile','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s.%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','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\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','randomstring','moment','agi','../../config/environment','/var/opt/motion2/server/files','getdigits','channel','prototype','rpc','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','trim','googleTTS','text','googleDialogflow','key','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','clear','includes','agicommand','clone','hasOwnProperty','replaceAllVariables','length','split','replaceAll','extra','toString','getAndSetVariable','result','setVariable'];(function(_0x378c8e,_0x5ce4e1){var _0x207263=function(_0x40c392){while(--_0x40c392){_0x378c8e['push'](_0x378c8e['shift']());}};_0x207263(++_0x5ce4e1);}(_0x42e3,0x11d));var _0x342e=function(_0x257d0c,_0x21aa6a){_0x257d0c=_0x257d0c-0x0;var _0x45dc77=_0x42e3[_0x257d0c];return _0x45dc77;};'use strict';var fs=require('fs');var path=require(_0x342e('0x0'));var util=require('util');var _=require(_0x342e('0x1'));var sh=require(_0x342e('0x2'));var odbc=require(_0x342e('0x3'))();var rs=require(_0x342e('0x4'));var moment=require(_0x342e('0x5'));var Mustache=require('mustache');var logger=require('../../config/logger')(_0x342e('0x6'));var config=require(_0x342e('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x342e('0x8');var verticesWithRetry=['menu',_0x342e('0x9'),'getsecretdigits'];var AGIVertices=function(_0x2dcb58,_0x57c838,_0x2bdcfe){this[_0x342e('0xa')]=_0x2dcb58;this['rpc']=_0x57c838;this['mailRpc']=_0x2bdcfe;};AGIVertices[_0x342e('0xb')]['getVariable']=function(_0x2cfe71,_0x34bebc){this[_0x342e('0xc')][_0x342e('0xd')](_0x2cfe71)['then'](function(_0x61b62d){_0x34bebc(null,_0x61b62d?_0x61b62d[_0x342e('0xe')]:![]);})[_0x342e('0xf')](function(_0x5d0630){_0x34bebc(_0x5d0630);});};AGIVertices[_0x342e('0xb')][_0x342e('0x10')]=function(_0x448127,_0x4383a0){this[_0x342e('0xc')][_0x342e('0x11')](_0x448127)[_0x342e('0x12')](function(_0x3d69e9){_0x4383a0(null,_0x3d69e9?_0x3d69e9[_0x342e('0xe')]:![]);})['catch'](function(_0x501f86){_0x4383a0(_0x501f86);});};AGIVertices[_0x342e('0xb')]['getSquareProject']=function(_0x499636,_0x16aa5d){this['rpc'][_0x342e('0x13')](_0x499636)['then'](function(_0x18c894){_0x16aa5d(null,_0x18c894?_0x18c894[_0x342e('0xe')]:![]);})['catch'](function(_0x14d1e8){_0x16aa5d(_0x14d1e8);});};AGIVertices[_0x342e('0xb')]['getSquareOdbc']=function(_0xcdb2e3,_0x463442){this['rpc'][_0x342e('0x14')](_0xcdb2e3)[_0x342e('0x12')](function(_0x885d4e){_0x463442(null,_0x885d4e?_0x885d4e[_0x342e('0x15')]:![]);})[_0x342e('0xf')](function(_0x1659e6){_0x463442(_0x1659e6);});};AGIVertices['prototype']['getUser']=function(_0x3d035e,_0x28846b){this[_0x342e('0xc')][_0x342e('0x16')](_0x3d035e)[_0x342e('0x12')](function(_0x50a0dd){_0x28846b(null,_0x50a0dd?_0x50a0dd[_0x342e('0xe')]:![]);})[_0x342e('0xf')](function(_0x1d7a71){_0x28846b(_0x1d7a71);});};AGIVertices[_0x342e('0xb')][_0x342e('0x17')]=function(_0x423faa,_0x36ced0){this[_0x342e('0xc')][_0x342e('0x18')](_0x423faa)[_0x342e('0x12')](function(_0x47eaab){_0x36ced0(null,_0x47eaab?_0x47eaab[_0x342e('0xe')]:![]);})[_0x342e('0xf')](function(_0x16ecd6){_0x36ced0(_0x16ecd6);});};AGIVertices[_0x342e('0xb')][_0x342e('0x19')]=function(_0x3659a5,_0x323829){var _0x3e9772=this;this['rpc'][_0x342e('0x1a')](_0x3659a5)[_0x342e('0x12')](function(_0x3a6178){_0x323829(null,_0x3a6178?_0x3e9772[_0x342e('0x1b')](_0x3a6178[_0x342e('0x1c')]):![]);})[_0x342e('0xf')](function(_0x5104e0){_0x323829(_0x5104e0);});};AGIVertices[_0x342e('0xb')][_0x342e('0x1d')]=function(_0xc3f79d,_0x864ff1){this['rpc'][_0x342e('0x1e')](_0xc3f79d)[_0x342e('0x12')](function(_0x328650){_0x864ff1(null,_0x328650?_0x328650:![]);})[_0x342e('0xf')](function(_0x32367d){_0x864ff1(_0x32367d);});};AGIVertices[_0x342e('0xb')][_0x342e('0x1f')]=function(_0x2ad204,_0x43a128,_0x34bc39){this[_0x342e('0x20')][_0x342e('0x1f')](_0x2ad204,_0x43a128)[_0x342e('0x12')](function(){_0x34bc39(null);})[_0x342e('0xf')](function(_0x233996){_0x34bc39(_0x233996);});};AGIVertices[_0x342e('0xb')][_0x342e('0x21')]=function(_0x2df03c,_0x7a5196){this[_0x342e('0xc')][_0x342e('0x22')](_0x2df03c)[_0x342e('0x12')](function(_0x43601a){if(_0x43601a){if(_0x43601a['IntervalId']){_0x7a5196(null,[_0x43601a[_0x342e('0x23')]]);}else{_0x7a5196(null,_[_0x342e('0x24')](_0x43601a[_0x342e('0x25')],_0x342e('0x23')));}}else{_0x7a5196(null,![]);}})[_0x342e('0xf')](function(_0x194a3e){_0x7a5196(_0x194a3e);});};AGIVertices['prototype'][_0x342e('0x1b')]=function(_0x3af240){return util[_0x342e('0x26')](_0x342e('0x27'),FILES_PATH,_0x3af240);};AGIVertices[_0x342e('0xb')]['getQueryOdbc']=function(_0x365015,_0x30d84a,_0x4fbfee){odbc[_0x342e('0x28')](_0x365015,function(_0x2ddb49){if(_0x2ddb49){logger[_0x342e('0x29')](_0x342e('0x2a'),_0x2ddb49);_0x4fbfee(_0x2ddb49);}else{logger[_0x342e('0x2b')](_0x342e('0x2c'));odbc[_0x342e('0x2d')](_0x30d84a,function(_0x18f985,_0x5affdc){if(_0x18f985){logger[_0x342e('0x2b')](_0x342e('0x2e'),_0x30d84a);_0x4fbfee(_0x18f985);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x30d84a);odbc[_0x342e('0x2f')](function(_0x3f7081){if(_0x3f7081){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3f7081);}_0x4fbfee(null,_0x5affdc);});}});}});};AGIVertices[_0x342e('0xb')][_0x342e('0x30')]=function(_0x3cbeb4,_0x13ef69){this[_0x342e('0xc')][_0x342e('0x31')](_0x3cbeb4)[_0x342e('0x12')](function(_0x4a5e10){_0x13ef69(null,_0x4a5e10?_0x4a5e10:![]);})[_0x342e('0xf')](function(_0x3d7501){_0x13ef69(_0x3d7501);});};AGIVertices[_0x342e('0xb')]['createSmsMessage']=function(_0x7a69af,_0x1bb933){this[_0x342e('0xc')][_0x342e('0x32')](_0x7a69af)[_0x342e('0x12')](function(_0x5112fd){_0x1bb933(null,_0x5112fd);})[_0x342e('0xf')](function(_0x58c682){_0x1bb933(_0x58c682);});};AGIVertices[_0x342e('0xb')]['createSquareDetailsReport']=function(_0x729908,_0xdeba1f,_0x41bc2e){this[_0x342e('0xc')][_0x342e('0x33')]({'uniqueid':this[_0x342e('0xa')][_0x342e('0x34')],'node':_0x729908['label'],'application':_0x729908['agicommand'],'data':_0xdeba1f||null,'project_name':this[_0x342e('0xa')][_0x342e('0x35')],'callerid':this[_0x342e('0xa')][_0x342e('0x36')]})['then'](function(_0xfea3fa){if(_0x41bc2e){_0x41bc2e(null,_0xfea3fa);}})[_0x342e('0xf')](function(_0x4fcf10){if(_0x41bc2e){_0x41bc2e(_0x4fcf10);}});};AGIVertices[_0x342e('0xb')][_0x342e('0x37')]=function(_0x1088b4,_0x10b471,_0x43d016,_0x3adbd0){this[_0x342e('0xc')][_0x342e('0x37')]({'uniqueid':this[_0x342e('0xa')][_0x342e('0x34')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x342e('0x38')],'context':this['channel'][_0x342e('0x39')],'extension':this['channel']['extension'],'priority':this[_0x342e('0xa')][_0x342e('0x3a')],'accountcode':this[_0x342e('0xa')][_0x342e('0x3b')],'dnid':this[_0x342e('0xa')][_0x342e('0x3c')],'projectName':this[_0x342e('0xa')]['arg_1'],'saveName':_0x10b471,'filename':_0x1088b4[_0x342e('0x3d')]||_0x10b471,'savePath':_0x43d016})[_0x342e('0x12')](function(_0x47bb1f){_0x3adbd0(null,_0x47bb1f);})[_0x342e('0xf')](function(_0xab5417){_0x3adbd0(_0xab5417);});};AGIVertices[_0x342e('0xb')][_0x342e('0x3e')]=function(_0x1e659f,_0xb06f47,_0x16b722){this[_0x342e('0xc')][_0x342e('0x3e')]({'uniqueid':this[_0x342e('0xa')][_0x342e('0x34')],'body':_0x1e659f,'direction':_0xb06f47})[_0x342e('0x12')](function(_0x56dc2b){if(_0x16b722){_0x16b722(null,_0x56dc2b);}})[_0x342e('0xf')](function(_0x5c0257){if(_0x16b722){_0x16b722(_0x5c0257);}});};AGIVertices['prototype'][_0x342e('0x3f')]=function(_0x1a7770,_0x578217){this[_0x342e('0xc')][_0x342e('0x3f')]({'firstName':_[_0x342e('0x40')](_0x1a7770[_0x342e('0xe')])||_[_0x342e('0x41')](_0x1a7770['name'])?_0x342e('0x42')+Math[_0x342e('0x43')]():_0x1a7770[_0x342e('0xe')],'lastName':_[_0x342e('0x40')](_0x1a7770['lastName'])||_[_0x342e('0x41')](_0x1a7770['lastName'])?null:_0x1a7770['lastName'],'phone':_0x1a7770[_0x342e('0x44')],'ListId':_0x1a7770['list_id'],'scheduledAt':_0x1a7770[_0x342e('0x45')],'callbackUniqueid':this[_0x342e('0xa')]['uniqueid'],'tags':_0x342e('0x46'),'description':_0x342e('0x47')+_0x1a7770[_0x342e('0x45')]['toString'](),'priority':_0x1a7770['callback_priority']})[_0x342e('0x12')](function(_0x1d4af3){_0x578217(null,_0x1d4af3);})[_0x342e('0xf')](function(_0xfff5f9){_0x578217(_0xfff5f9);});};AGIVertices['prototype'][_0x342e('0x48')]=function(_0x3c3686,_0x1ac129){this['rpc'][_0x342e('0x49')](_0x3c3686)[_0x342e('0x12')](function(_0xf8b6ac){_0x1ac129(null,_0xf8b6ac?_0xf8b6ac[_0x342e('0xe')]:![]);})['catch'](function(_0x1e3edb){_0x1ac129(_0x1e3edb);});};AGIVertices[_0x342e('0xb')]['agentPause']=function(_0x1e9295,_0x22a56a,_0x4ecc82){var _0x7d91f8={'role':_0x342e('0x4a')};_0x7d91f8[_0x1e9295]=this['channel']['callerid'];this[_0x342e('0xc')][_0x342e('0x4b')](_0x7d91f8,_0x22a56a,this[_0x342e('0xa')][_0x342e('0x34')])[_0x342e('0x12')](function(_0x4ef5ae){_0x4ecc82(null,_[_0x342e('0x41')](_0x4ef5ae)?![]:!![]);})[_0x342e('0xf')](function(_0x330b69){logger[_0x342e('0x29')](_0x330b69);_0x4ecc82(null,![]);});};AGIVertices[_0x342e('0xb')][_0x342e('0x4c')]=function(_0x12c10a,_0x1679b4){var _0x6e3b37={'role':_0x342e('0x4a')};_0x6e3b37[_0x12c10a]=this[_0x342e('0xa')][_0x342e('0x36')];this['rpc'][_0x342e('0x4c')](_0x6e3b37)[_0x342e('0x12')](function(_0x3a4c4a){_0x1679b4(null,_[_0x342e('0x41')](_0x3a4c4a)?![]:!![]);})[_0x342e('0xf')](function(_0x195371){logger['error'](_0x195371);_0x1679b4(null,![]);});};AGIVertices[_0x342e('0xb')][_0x342e('0x4d')]=function(_0x7fc1bc,_0x25bf6e){var _0x269f76={'role':'agent'};_0x269f76[_0x7fc1bc]=this['channel'][_0x342e('0x36')];this[_0x342e('0xc')][_0x342e('0x4d')](_0x269f76)[_0x342e('0x12')](function(_0x2a000b){_0x25bf6e(null,_[_0x342e('0x41')](_0x2a000b)?![]:!![]);})['catch'](function(_0x44f49d){logger['error'](_0x44f49d);_0x25bf6e(null,![]);});};AGIVertices[_0x342e('0xb')][_0x342e('0x4e')]=function(_0x1de6a9,_0x40e278){var _0xb28dc5={'role':_0x342e('0x4a')};_0xb28dc5[_0x1de6a9]=this[_0x342e('0xa')][_0x342e('0x36')];var _0x360c86=_0x1de6a9!=_0x342e('0x4f')?util[_0x342e('0x26')](_0x342e('0x50'),'LOCAL',this['channel']['callerid']):undefined;this[_0x342e('0xc')]['agentLogin'](_0xb28dc5,_0x360c86)[_0x342e('0x12')](function(_0x5c24d2){_0x40e278(null,_[_0x342e('0x41')](_0x5c24d2)?![]:!![]);})['catch'](function(_0x2cf5e6){logger[_0x342e('0x29')](_0x2cf5e6);_0x40e278(null,![]);});};AGIVertices[_0x342e('0xb')][_0x342e('0x51')]=function(_0x527a74,_0x1d099b){sh['exec'](_[_0x342e('0x52')](_0x527a74),function(_0x401cd7,_0x5d3cea){var _0x5c6d6b=_0x5d3cea['replace'](/(\r\n|\n|\r)/gm,'');_0x1d099b(null,_0x5c6d6b);});};AGIVertices[_0x342e('0xb')]['googleTTS']=function(_0x11e5b3,_0x23cb74){scripts[_0x342e('0x53')](_0x11e5b3[_0x342e('0x54')],_0x11e5b3['google_tts_language']||'en',0x1)[_0x342e('0x12')](function(_0x5d7746){_0x23cb74(null,_0x5d7746);})['catch'](function(_0x30377c){_0x23cb74(_0x30377c);});};AGIVertices['prototype']['googleDialogflow']=function(_0xe9001e,_0x491c75){scripts[_0x342e('0x55')](this[_0x342e('0xa')][_0x342e('0x34')],_0xe9001e[_0x342e('0x56')],_0xe9001e[_0x342e('0x54')],_0xe9001e['dialogflow_language']||'en')[_0x342e('0x12')](function(_0x5735f8){_0x491c75(null,_0x5735f8);})[_0x342e('0xf')](function(_0x46fc1b){_0x491c75(_0x46fc1b);});};AGIVertices[_0x342e('0xb')][_0x342e('0x57')]=function(_0x41f179,_0xee9dde){scripts[_0x342e('0x57')](this[_0x342e('0xa')],_0x41f179)['then'](function(_0x21e002){_0xee9dde(null,_0x21e002);})[_0x342e('0xf')](function(_0x3609fa){_0xee9dde(_0x3609fa);});};AGIVertices[_0x342e('0xb')][_0x342e('0x58')]=function(_0x5ee1ee,_0x9e65b4){scripts[_0x342e('0x58')](_0x5ee1ee[_0x342e('0x56')],_0x5ee1ee['text'],_0x5ee1ee['ispeech_tts_language']||_0x342e('0x59'),_0x5ee1ee[_0x342e('0x5a')])[_0x342e('0x12')](function(_0x390fc5){_0x9e65b4(null,_0x390fc5);})[_0x342e('0xf')](function(_0x24ac47){_0x9e65b4(_0x24ac47);});};AGIVertices[_0x342e('0xb')][_0x342e('0x5b')]=function(_0x1adfd0,_0xd7bc69,_0x5100a5){scripts[_0x342e('0x5b')](_0xd7bc69,_0x1adfd0['key'],_0x1adfd0[_0x342e('0x5c')]||_0x342e('0x59'),this[_0x342e('0x5d')](_0x1adfd0[_0x342e('0x5e')])?_0x1adfd0['model']:undefined)[_0x342e('0x12')](function(_0x51ca30){_0x5100a5(null,_0x51ca30);})[_0x342e('0xf')](function(_0x14a72d){_0x5100a5(_0x14a72d);});};AGIVertices[_0x342e('0xb')][_0x342e('0x5f')]=function(_0x3cce57,_0x530a96){scripts[_0x342e('0x5f')](_0x3cce57[_0x342e('0x60')],_0x3cce57['aws_secret_access_key'],_0x3cce57[_0x342e('0x61')],_0x3cce57[_0x342e('0x62')]||_0x342e('0x63'),_0x3cce57[_0x342e('0x54')],_0x3cce57[_0x342e('0x64')]||'text')[_0x342e('0x12')](function(_0x1e4fea){_0x530a96(null,_0x1e4fea);})[_0x342e('0xf')](function(_0xede9f8){_0x530a96(_0xede9f8);});};AGIVertices[_0x342e('0xb')][_0x342e('0x65')]=function(_0x4ad65d,_0x3a991c){scripts['awsLex'](this['channel']['uniqueid'],_0x4ad65d[_0x342e('0x60')],_0x4ad65d[_0x342e('0x66')],_0x4ad65d[_0x342e('0x67')],_0x4ad65d[_0x342e('0x54')],_0x4ad65d['aws_bot_name'])[_0x342e('0x12')](function(_0x37a1aa){_0x3a991c(null,_0x37a1aa);})[_0x342e('0xf')](function(_0x1ec21a){_0x3a991c(_0x1ec21a);});};AGIVertices[_0x342e('0xb')][_0x342e('0x68')]=function(_0x1fc2ec,_0x311144,_0x307d0f){scripts['googleASR'](_0x311144,_0x1fc2ec[_0x342e('0x56')],_0x1fc2ec[_0x342e('0x69')]||'en-US')[_0x342e('0x12')](function(_0x45fd1f){_0x307d0f(null,_0x45fd1f);})[_0x342e('0xf')](function(_0xde1e72){_0x307d0f(_0xde1e72);});};AGIVertices['prototype'][_0x342e('0x6a')]=function(_0x35120e,_0x30fb61,_0x4be775){scripts[_0x342e('0x6a')](_0x30fb61,_0x35120e[_0x342e('0x6b')],_0x35120e['appsecret'],_0x35120e['uri'])[_0x342e('0x12')](function(_0x464e7e){_0x4be775(null,_0x464e7e);})['catch'](function(_0x2907e8){_0x4be775(_0x2907e8);});};AGIVertices['prototype'][_0x342e('0x6c')]=function(_0x327e36){var _0x3829f3=_[_0x342e('0x6d')](verticesWithRetry,_0x327e36[_0x342e('0x6e')])?_0x327e36:_[_0x342e('0x6f')](_0x327e36);for(var _0x3d082d in _0x3829f3){if(_0x3829f3[_0x342e('0x70')](_0x3d082d)){if(_0x3829f3[_0x3d082d]&&_['isString'](_0x3829f3[_0x3d082d])){_0x3829f3[_0x3d082d]=this[_0x342e('0x71')](_0x3829f3[_0x3d082d]);}}}return _0x3829f3;};AGIVertices[_0x342e('0xb')][_0x342e('0x71')]=function(_0x98d3eb){var _0xb37e4=_0x98d3eb['split']('{');for(var _0x4252d8=0x1;_0x4252d8<_0xb37e4[_0x342e('0x72')];_0x4252d8+=0x1){var _0x54f004=_0xb37e4[_0x4252d8][_0x342e('0x73')]('}');if(_0x54f004[_0x342e('0x72')]>0x1){_0x98d3eb=_0x98d3eb[_0x342e('0x74')]('{'+_0x54f004[0x0]+'}',this['channel']['getVariable'](_0x54f004[0x0])[_0x342e('0x75')]||_0x54f004[0x0]);}}if(_0xb37e4[_0x342e('0x72')]===0x1){return _0x98d3eb[_0x342e('0x76')]();}return this[_0x342e('0x71')](_0x98d3eb);};AGIVertices[_0x342e('0xb')][_0x342e('0x77')]=function(_0x157172,_0x2eb327){var _0x271f15=this[_0x342e('0xa')]['getVariable'](_0x157172);if(_0x271f15[_0x342e('0x78')]===-0x1){return _0x271f15;}logger[_0x342e('0x2b')](util[_0x342e('0x26')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2eb327,_0x271f15[_0x342e('0x75')]));return this[_0x342e('0xa')][_0x342e('0x79')](_0x2eb327,_0x271f15['extra']);};AGIVertices[_0x342e('0xb')][_0x342e('0x5d')]=function(_0x3878fe){return _0x3878fe&&_0x3878fe!=='0'&&_0x3878fe!=='-1'&&_0x3878fe!=='';};AGIVertices[_0x342e('0xb')]['maxRetry']=function(_0x488ef5){this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x488ef5,'-');_0x488ef5[_0x342e('0x7b')]=_0x488ef5[_0x342e('0x7c')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x342e('0x6')]=function(_0x22f25c){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x7d'),_0x22f25c[_0x342e('0x7e')]));return this['channel'][_0x342e('0x6')]([_0x22f25c[_0x342e('0x7f')],_0x22f25c[_0x342e('0x80')]]);};AGIVertices[_0x342e('0xb')]['answer']=function(_0x2f5833){logger['info'](util[_0x342e('0x26')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2f5833['label']));if(this[_0x342e('0x5d')](_0x2f5833[_0x342e('0x81')])){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2f5833[_0x342e('0x81')]));var _0xb839dd=this['channel']['wait'](_0x2f5833['timeout']);if(_0xb839dd['result']===-0x1){return _0xb839dd;}}return this['channel'][_0x342e('0x82')]();};AGIVertices[_0x342e('0xb')][_0x342e('0x46')]=function(_0xcaf9cc){logger[_0x342e('0x2b')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xcaf9cc[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0xcaf9cc['list_id'])){return this[_0x342e('0xa')][_0x342e('0x29')](_0xcaf9cc,_0x342e('0x83'));}_0xcaf9cc[_0x342e('0x45')]=moment();if(this[_0x342e('0x5d')](_0xcaf9cc['delay'])){_0xcaf9cc[_0x342e('0x45')]=moment()['add'](_0xcaf9cc[_0x342e('0x84')],'minutes');}if(!this['isConfigured'](_0xcaf9cc['callback_priority'])){_0xcaf9cc['callback_priority']=0x2;}this[_0x342e('0x3f')][_0x342e('0x7a')](this,_0xcaf9cc);return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xcaf9cc[_0x342e('0x44')],_0xcaf9cc[_0x342e('0x86')],_0xcaf9cc[_0x342e('0x45')]));};AGIVertices[_0x342e('0xb')][_0x342e('0x87')]=function(_0x341eba){logger[_0x342e('0x2b')](util['format'](_0x342e('0x88'),_0x341eba['label']));var _0x339c6a=this['channel'][_0x342e('0x89')](_0x341eba[_0x342e('0x8a')],_0x341eba[_0x342e('0x8b')]);if(_0x339c6a[_0x342e('0x78')]===-0x1){return _0x339c6a;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x8c'),_0x341eba[_0x342e('0x8a')],_0x341eba[_0x342e('0x8b')]));};AGIVertices[_0x342e('0xb')][_0x342e('0x8d')]=function(_0x4ce940){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x8e'),_0x4ce940[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x4ce940['text'])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x8f'));}var _0x1322a9='\x22'+_0x4ce940[_0x342e('0x54')]+'\x22';if(this[_0x342e('0x5d')](_0x4ce940['options'])){_0x1322a9+=','+_0x4ce940[_0x342e('0x8b')];}var _0xf7d80e=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0x90'),_0x1322a9);if(_0xf7d80e['result']===-0x1){return _0xf7d80e;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x91'),_0x1322a9));};AGIVertices[_0x342e('0xb')][_0x342e('0x92')]=function(_0x120852){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x93'),_0x120852[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x120852['text'])){return this['channel']['noop'](_0x342e('0x8f'));}var _0x377282='\x22'+_0x120852[_0x342e('0x54')]+'\x22';if(this['isConfigured'](_0x120852[_0x342e('0x8b')])){_0x377282+=','+_0x120852['options'];}var _0x362d0c=this[_0x342e('0xa')]['exec']('MRCPSynth',_0x377282);if(_0x362d0c[_0x342e('0x78')]===-0x1){return _0x362d0c;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x377282));};AGIVertices[_0x342e('0xb')][_0x342e('0x94')]=function(_0x2a87e5){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x95'),_0x2a87e5[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x2a87e5[_0x342e('0x96')])){return this[_0x342e('0xa')][_0x342e('0x85')]('no\x20grammar\x20configured');}var _0xc76f85=_0x2a87e5['grammar'];if(this['isConfigured'](_0x2a87e5[_0x342e('0x8b')])){_0xc76f85+=','+_0x2a87e5[_0x342e('0x8b')];}var _0x2a6c2e=this[_0x342e('0xa')][_0x342e('0x89')]('MRCPRecog',_0xc76f85);if(_0x2a6c2e[_0x342e('0x78')]===-0x1){return _0x2a6c2e;}var _0x5ae233=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x342e('0x97'));if(_0x5ae233[_0x342e('0x78')]===-0x1){return _0x5ae233;}var _0x171c9e=this[_0x342e('0x77')]('RECOG_INPUT()',_0x342e('0x98'));if(_0x171c9e['result']===-0x1){return _0x171c9e;}var _0x196583=this[_0x342e('0x77')](_0x342e('0x99'),_0x342e('0x9a'));if(_0x196583['result']===-0x1){return _0x196583;}return this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0x9b'),_0xc76f85));};AGIVertices[_0x342e('0xb')][_0x342e('0x9c')]=function(_0x41cf4a){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x9d'),_0x41cf4a[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x41cf4a[_0x342e('0x96')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x9e'));}var _0x5c93db=_0x41cf4a[_0x342e('0x96')];if(this[_0x342e('0x5d')](_0x41cf4a[_0x342e('0x8b')])){_0x5c93db+=','+_0x41cf4a[_0x342e('0x8b')];}var _0x7110e2=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0x9f'),_0x5c93db);if(_0x7110e2[_0x342e('0x78')]===-0x1){return _0x7110e2;}var _0x45adb3=this[_0x342e('0x77')](_0x342e('0xa0'),_0x342e('0xa1'));if(_0x45adb3[_0x342e('0x78')]===-0x1){return _0x45adb3;}var _0x161d86=this['getAndSetVariable']('RECOG_INPUT()',_0x342e('0xa2'));if(_0x161d86[_0x342e('0x78')]===-0x1){return _0x161d86;}var _0x54e439=this[_0x342e('0x77')](_0x342e('0x99'),_0x342e('0xa3'));if(_0x54e439[_0x342e('0x78')]===-0x1){return _0x54e439;}return this['channel']['noop'](util[_0x342e('0x26')](_0x342e('0x9b'),_0x5c93db));};AGIVertices[_0x342e('0xb')]['database']=function(_0x192cd5){logger[_0x342e('0x2b')](util['format'](_0x342e('0xa4'),_0x192cd5[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x192cd5[_0x342e('0xa5')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x192cd5,_0x342e('0xa6'));}var _0x22ec0b=this[_0x342e('0xa7')][_0x342e('0x7a')](this,_0x192cd5['odbc_id']);if(!_0x22ec0b){return this[_0x342e('0xa')][_0x342e('0x29')](_0x192cd5,_0x342e('0xa8'));}if(!this['isConfigured'](_0x192cd5[_0x342e('0x2d')])){return this[_0x342e('0xa')]['error'](_0x192cd5,_0x342e('0xa9'));}var _0x54a1bf=_0x192cd5[_0x342e('0x2d')][_0x342e('0xaa')](/(\r\n|\n|\r)/gm,'\x20');this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xab'),_0x54a1bf));var _0x5bdcce=this[_0x342e('0xac')][_0x342e('0x7a')](this,_0x22ec0b,_0x54a1bf);this[_0x342e('0x33')]['sync'](this,_0x192cd5,_0x54a1bf);if(!this[_0x342e('0x5d')](_0x192cd5['variable_id'])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xad'));}var _0x1c44a7=this['getVariable'][_0x342e('0x7a')](this,_0x192cd5['variable_id']);if(!_0x1c44a7){return this[_0x342e('0xa')][_0x342e('0x29')](_0x192cd5,_0x342e('0xae'));}var _0x573ab8=this;_0x5bdcce['forEach'](function(_0x22d4b6,_0x34a476){Object['keys'](_0x22d4b6)[_0x342e('0xaf')](function(_0x309015){_0x573ab8[_0x342e('0xa')][_0x342e('0x79')](util[_0x342e('0x26')](_0x342e('0xb0'),_0x1c44a7,_0x34a476,_0x309015),_0x22d4b6[_0x309015]);});});this[_0x342e('0xa')][_0x342e('0x79')](util[_0x342e('0x26')](_0x342e('0xb1'),_0x1c44a7),_0x5bdcce[_0x342e('0x72')]);return this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0xb2'),_0x1c44a7));};AGIVertices['prototype'][_0x342e('0xb3')]=function(_0x319adb){logger[_0x342e('0xb4')](util[_0x342e('0x26')](_0x342e('0xb5'),_0x319adb['label']));if(!this[_0x342e('0x5d')](_0x319adb['sip_id'])){return this[_0x342e('0xa')]['error'](_0x319adb,'no\x20user\x20selected');}var _0x5e15d2=this['getUser'][_0x342e('0x7a')](this,_0x319adb[_0x342e('0xb6')]);if(!_0x5e15d2){return this[_0x342e('0xa')][_0x342e('0x29')](_0x319adb,'no\x20user\x20found');}var _0x4c3466=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0xb7'),[util['format']('SIP/%s',_0x5e15d2),_0x319adb[_0x342e('0x81')],_0x319adb[_0x342e('0xb8')],_0x319adb['url']]);if(_0x4c3466[_0x342e('0x78')]===-0x1){return _0x4c3466;}return this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0xb9'),_0x342e('0xb7')));};AGIVertices['prototype'][_0x342e('0xba')]=function(_0xe737d2){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0xe737d2[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0xe737d2[_0x342e('0x56')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xbb'));}if(!this[_0x342e('0x5d')](_0xe737d2[_0x342e('0x54')])){return this[_0x342e('0xa')][_0x342e('0x85')]('no\x20text\x20configured');}this['channel'][_0x342e('0xbc')]=!![];this[_0x342e('0x33')](_0xe737d2);this['createSquareMessage'](_0xe737d2[_0x342e('0x54')],'in');this[_0x342e('0xa')][_0x342e('0x85')](util['format']('Trying\x20Dialogflow:\x20%s',_0xe737d2[_0x342e('0x54')]));var _0x4b772f=this[_0x342e('0x55')][_0x342e('0x7a')](this,_0xe737d2);if(_0x4b772f){for(var _0x45cc7e in _0x4b772f){if(_0x4b772f['hasOwnProperty'](_0x45cc7e)){this[_0x342e('0xa')][_0x342e('0x79')](util[_0x342e('0x26')](_0x342e('0xbd'),_0x45cc7e[_0x342e('0xbe')]()),_0x4b772f[_0x45cc7e]);}}this[_0x342e('0x3e')](_0x4b772f[_0x342e('0xbf')],'out');return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xc0'),_0x4b772f[_0x342e('0xbf')]));}return this[_0x342e('0xa')][_0x342e('0x29')](_0xe737d2,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x342e('0xb')]['sesteknda']=function(_0x5e8701){logger['info'](util[_0x342e('0x26')](_0x342e('0xc1'),_0x5e8701[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x5e8701[_0x342e('0xc2')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xc3'));}if(!this[_0x342e('0x5d')](_0x5e8701[_0x342e('0xc4')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xc5'));}if(!this['isConfigured'](_0x5e8701[_0x342e('0xc6')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xc7'));}if(!this[_0x342e('0x5d')](_0x5e8701[_0x342e('0xc8')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x8f'));}this[_0x342e('0xa')]['bot']=!![];this[_0x342e('0x33')](_0x5e8701);this[_0x342e('0x3e')](_0x5e8701[_0x342e('0x54')],'in');this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xc9'),_0x5e8701[_0x342e('0x54')]));var _0x4f35e3=this['sestekNDA'][_0x342e('0x7a')](this,_0x5e8701);if(_0x4f35e3){for(var _0x4463e5 in _0x4f35e3){if(_0x4f35e3[_0x342e('0x70')](_0x4463e5)){this['channel'][_0x342e('0x79')](util[_0x342e('0x26')](_0x342e('0xca'),_0x4463e5[_0x342e('0xbe')]()),_0x4f35e3[_0x4463e5]);}}this[_0x342e('0x3e')](_0x4f35e3[_0x342e('0xbf')],_0x342e('0xcb'));if(_0x4f35e3[_0x342e('0xcc')]){this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xcd'),_0x4f35e3['audiofile']));var _0x52b8fa=this[_0x342e('0xa')][_0x342e('0xce')](_0x4f35e3['audiofile']);try{fs[_0x342e('0xcf')](_0x4f35e3['audiofile']+_0x342e('0xd0'));}catch(_0x1dff96){logger[_0x342e('0x29')](_0x1dff96);}return _0x52b8fa;}else{return this['channel']['noop'](util['format'](_0x342e('0xd1'),_0x4f35e3[_0x342e('0xbf')]));}}return this[_0x342e('0xa')][_0x342e('0x29')](_0x5e8701,_0x342e('0xd2'));};AGIVertices[_0x342e('0xb')][_0x342e('0xd3')]=function(_0x52839a){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0xd4'),_0x52839a[_0x342e('0x7e')]));return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xd3'));};AGIVertices['prototype']['ext_dial']=function(_0x1b430e){logger['info'](util[_0x342e('0x26')](_0x342e('0xd5'),_0x1b430e[_0x342e('0x7e')]));var _0x1be171='';if(_0x1b430e[_0x342e('0xd6')]){if(!this['isConfigured'](_0x1b430e[_0x342e('0xd6')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x1b430e,_0x342e('0xd7'));}else{var _0x2c509f=parseInt(_0x1b430e[_0x342e('0xd6')],0xa);if(isNaN(_0x2c509f)){_0x1be171=_0x1b430e[_0x342e('0xd6')];}else{_0x1be171=this[_0x342e('0x17')]['sync'](this,_0x1b430e['trunk_id']);if(!_0x1be171){return this[_0x342e('0xa')][_0x342e('0x29')](_0x1b430e,'no\x20trunk\x20found');}}}}else if(_0x1b430e['trunk_name']){_0x1be171=_0x1b430e[_0x342e('0xd8')];}else{return this[_0x342e('0xa')][_0x342e('0x29')](_0x1b430e,_0x342e('0xd7'));}var _0xc47d6f=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0xb7'),[util[_0x342e('0x26')](_0x342e('0xd9'),_0x1be171,_0x1b430e[_0x342e('0x44')]),_0x1b430e[_0x342e('0x81')],_0x1b430e[_0x342e('0xb8')],_0x1b430e[_0x342e('0xda')]]);if(_0xc47d6f['result']===-0x1){return _0xc47d6f;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xb9'),'DIAL'));};AGIVertices['prototype'][_0x342e('0xdb')]=function(_0x184462){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x184462[_0x342e('0x7e')]));return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xdb'));};AGIVertices[_0x342e('0xb')][_0x342e('0x9')]=function(_0x1ad66a){logger[_0x342e('0x2b')](util['format'](_0x342e('0xdc'),_0x1ad66a[_0x342e('0x7e')]));if(_0x1ad66a[_0x342e('0x7b')]===0x0){return this[_0x342e('0x7c')](_0x1ad66a);}_0x1ad66a[_0x342e('0x7b')]-=0x1;if(!this[_0x342e('0x5d')](_0x1ad66a[_0x342e('0xdd')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x1ad66a,_0x342e('0xde'));}var _0x3277a7=this[_0x342e('0x19')][_0x342e('0x7a')](this,_0x1ad66a[_0x342e('0xdd')]);if(!_0x3277a7){return this[_0x342e('0xa')][_0x342e('0x29')](_0x1ad66a,_0x342e('0xdf'));}if(!this['isConfigured'](_0x1ad66a[_0x342e('0xe0')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x342e('0xad'));}var _0x7163fd=this[_0x342e('0xa')][_0x342e('0xe1')](_0x3277a7,_0x1ad66a[_0x342e('0xe2')],_0x1ad66a[_0x342e('0xe3')]);var _0x58b748=_0x7163fd[_0x342e('0x78')]?_0x7163fd['result'][_0x342e('0x76')]():'';logger['info']('test',JSON[_0x342e('0xe4')](_0x7163fd));if(_0x7163fd[_0x342e('0x78')]===-0x1){this[_0x342e('0x33')]['sync'](this,_0x1ad66a,_0x58b748);return _0x7163fd;}else if(_0x7163fd[_0x342e('0x75')]===_0x342e('0x81')){_0x7163fd['result']=_0x58b748['length']>=parseInt(_0x1ad66a[_0x342e('0xe5')])?'x':'i';}else{_0x7163fd[_0x342e('0x78')]=_0x58b748[_0x342e('0x72')]>=parseInt(_0x1ad66a[_0x342e('0xe5')])&&_0x58b748[_0x342e('0x72')]<=parseInt(_0x1ad66a[_0x342e('0xe3')])?'x':'i';}var _0x1bb53c=this[_0x342e('0xe6')][_0x342e('0x7a')](this,_0x1ad66a[_0x342e('0xe0')]);if(!_0x1bb53c){return this[_0x342e('0xa')][_0x342e('0x29')](_0x1ad66a,_0x342e('0xae'));}this[_0x342e('0xa')][_0x342e('0x79')](_0x1bb53c,_0x58b748);if(this[_0x342e('0x5d')](_0x1ad66a[_0x342e('0xe7')])){var _0x916cb2=parseInt(_0x1ad66a[_0x342e('0xe7')],0xa);var _0x3c4ff4=rs['generate']({'charset':'*','length':_0x916cb2});var _0x3d03f9=_0x58b748['length'];if(_0x3d03f9>0x0){if(_0x3d03f9>_0x916cb2){this['createSquareDetailsReport'][_0x342e('0x7a')](this,_0x1ad66a,_0x1ad66a['hiddendigitspos']==='first'?_0x3c4ff4+_0x58b748[_0x342e('0xe8')](_0x916cb2):_0x58b748[_0x342e('0xe8')](0x0,_0x3d03f9-_0x916cb2)+_0x3c4ff4);}else{this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x1ad66a,rs[_0x342e('0xe9')]({'charset':'*','length':_0x3d03f9}));}}else{this['createSquareDetailsReport']['sync'](this,_0x1ad66a,'');}}else{this[_0x342e('0x33')]['sync'](this,_0x1ad66a,_0x58b748);}return _0x7163fd;};AGIVertices['prototype'][_0x342e('0xea')]=function(_0x81be96){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0xeb'),_0x81be96['label']));return this[_0x342e('0x9')](_0x81be96);};AGIVertices[_0x342e('0xb')][_0x342e('0xec')]=function(_0x2d84b4){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0xed'),_0x2d84b4['label']));this['createSquareDetailsReport'][_0x342e('0x7a')](this,_0x2d84b4,_0x2d84b4[_0x342e('0xee')]);return this['channel']['noop'](util[_0x342e('0x26')](_0x342e('0xef'),_0x2d84b4[_0x342e('0xee')]));};AGIVertices['prototype']['awspolly']=function(_0x256b5f){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x256b5f[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x256b5f[_0x342e('0x60')])||!this[_0x342e('0x5d')](_0x256b5f[_0x342e('0x66')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xf0'));}if(!this[_0x342e('0x5d')](_0x256b5f[_0x342e('0x54')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x8f'));}this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xf1'),_0x256b5f[_0x342e('0x54')]));var _0x9ada04=this[_0x342e('0x5f')]['sync'](this,_0x256b5f);if(_0x9ada04){this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0xf2'),_0x9ada04));var _0x306292=this['channel'][_0x342e('0xce')](_0x9ada04);try{fs[_0x342e('0xcf')](_0x9ada04+_0x342e('0xd0'));}catch(_0x2f5889){logger[_0x342e('0x29')](_0x2f5889);}return _0x306292;}return this['channel'][_0x342e('0x29')](_0x256b5f,_0x342e('0xf3'));};AGIVertices[_0x342e('0xb')][_0x342e('0xf4')]=function(_0x27c01f){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0xf5'),_0x27c01f[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x27c01f['aws_access_key_id'])||!this['isConfigured'](_0x27c01f[_0x342e('0x66')])){return this['channel'][_0x342e('0x85')](_0x342e('0xf0'));}if(!this[_0x342e('0x5d')](_0x27c01f[_0x342e('0xf6')])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x342e('0x5d')](_0x27c01f[_0x342e('0x54')])){return this['channel']['noop'](_0x342e('0x8f'));}this[_0x342e('0xa')][_0x342e('0xbc')]=!![];this['createSquareDetailsReport'](_0x27c01f);this[_0x342e('0x3e')](_0x27c01f[_0x342e('0x54')],'in');this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0xf7'),_0x27c01f[_0x342e('0x54')]));var _0x4cec0a=this[_0x342e('0x65')][_0x342e('0x7a')](this,_0x27c01f);if(_0x4cec0a){for(var _0x4083c0 in _0x4cec0a){if(_0x4cec0a[_0x342e('0x70')](_0x4083c0)&&_[_0x342e('0xf8')](_0x4cec0a[_0x4083c0])){this['channel'][_0x342e('0x79')](util[_0x342e('0x26')](_0x342e('0xf9'),_0x4083c0['toUpperCase']()),_0x4cec0a[_0x4083c0]);}}if(_[_0x342e('0x41')](_0x4cec0a[_0x342e('0xfa')])){return this['channel'][_0x342e('0x85')](_0x342e('0xfb'));}else{this[_0x342e('0x3e')](_0x4cec0a[_0x342e('0xfa')],_0x342e('0xcb'));return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0xfc'),_0x4cec0a['message']));}}return this[_0x342e('0xa')][_0x342e('0x29')](_0x27c01f,_0x342e('0xfd'));};AGIVertices[_0x342e('0xb')][_0x342e('0xfe')]=function(_0x7c5077){logger['info'](util[_0x342e('0x26')](_0x342e('0xff'),_0x7c5077[_0x342e('0x7e')],_0x7c5077[_0x342e('0x81')]));if(!this[_0x342e('0x5d')](_0x7c5077[_0x342e('0x56')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xbb'));}var _0x17af79=_0x342e('0x100');var _0x28cb8c=util[_0x342e('0x26')](_0x342e('0x101'),FILES_PATH,rs[_0x342e('0xe9')](0x4));var _0x324d74=util[_0x342e('0x26')]('%s.%s',_0x28cb8c,_0x17af79);var _0x593b99=!![];if(_0x7c5077[_0x342e('0x102')]===_0x342e('0x103')){_0x593b99=![];}var _0x6cde1d=this[_0x342e('0xa')][_0x342e('0x104')](_0x28cb8c,_0x17af79,_0x7c5077['intKey'],_0x7c5077[_0x342e('0x81')],undefined,_0x593b99);if(_0x6cde1d[_0x342e('0x78')]!==-0x1){this['channel']['noop'](util['format']('google\x20%s\x20file\x20created',_0x324d74));var _0x13a625=this[_0x342e('0x68')][_0x342e('0x7a')](this,_0x7c5077,_0x324d74);if(_0x13a625){for(var _0x194ca0 in _0x13a625){if(_0x13a625[_0x342e('0x70')](_0x194ca0)){this['channel'][_0x342e('0x79')](util[_0x342e('0x26')]('GOOGLE_ASR_%s',_0x194ca0['toUpperCase']()),_0x13a625[_0x194ca0]);}}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0x342e('0xe4')](_0x13a625)));}}return _0x6cde1d;};AGIVertices[_0x342e('0xb')][_0x342e('0x105')]=function(_0x593673){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x106'),_0x593673[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x593673[_0x342e('0x6b')])){return this['channel'][_0x342e('0x85')](_0x342e('0x107'));}if(!this[_0x342e('0x5d')](_0x593673[_0x342e('0x108')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x1e8113='wav';var _0x3b8b74=util['format'](_0x342e('0x101'),FILES_PATH,rs[_0x342e('0xe9')](0x4));var _0x4c72d7=util[_0x342e('0x26')]('%s.%s',_0x3b8b74,_0x1e8113);var _0x2c6363=!![];if(_0x593673[_0x342e('0x102')]===_0x342e('0x103')){_0x2c6363=![];}var _0xff4fd0=this[_0x342e('0xa')][_0x342e('0x104')](_0x3b8b74,_0x1e8113,_0x593673[_0x342e('0x109')],_0x593673[_0x342e('0x81')],undefined,_0x2c6363);if(_0xff4fd0[_0x342e('0x78')]!==-0x1){this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0x10a'),_0x4c72d7));var _0x8e87eb=this['tildeASR'][_0x342e('0x7a')](this,_0x593673,_0x4c72d7);if(_0x8e87eb){for(var _0x2fd0e8 in _0x8e87eb){if(_0x8e87eb[_0x342e('0x70')](_0x2fd0e8)){this[_0x342e('0xa')]['setVariable'](util[_0x342e('0x26')]('TILDE_ASR_%s',_0x2fd0e8[_0x342e('0xbe')]()),_0x8e87eb[_0x2fd0e8]);}}return this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0x10b'),JSON[_0x342e('0xe4')](_0x8e87eb)));}}return _0xff4fd0;};AGIVertices[_0x342e('0xb')][_0x342e('0x10c')]=function(_0x56598f){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x10d'),_0x56598f[_0x342e('0x7e')]));return this['channel']['continueAt'](_0x56598f[_0x342e('0x39')],_0x56598f[_0x342e('0x10e')],_0x56598f[_0x342e('0x3a')]);};AGIVertices[_0x342e('0xb')][_0x342e('0x10f')]=function(_0x5426c4){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x110'),_0x5426c4[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x5426c4[_0x342e('0x111')])){return this['channel'][_0x342e('0x29')](_0x5426c4,_0x342e('0x112'));}try{var _0x22fc15=eval(_0x5426c4[_0x342e('0x111')])?_0x342e('0x113'):_0x342e('0x114');this[_0x342e('0xa')]['noop'](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x5426c4['condition'],_0x22fc15));return{'code':0xc8,'result':_0x22fc15};}catch(_0x4e412d){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x342e('0xb')][_0x342e('0x115')]=function(_0x302833){logger['info'](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x302833[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x302833[_0x342e('0x116')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x302833,'no\x20interval\x20configured');}var _0x3373dc=this[_0x342e('0x21')][_0x342e('0x7a')](this,_0x302833[_0x342e('0x116')]);if(!_0x3373dc){return this[_0x342e('0xa')]['error'](_0x302833,_0x342e('0x117'));}for(var _0x271f14=0x0;_0x271f14<_0x3373dc['length'];_0x271f14+=0x1){var _0x241bc9=this[_0x342e('0xa')]['getVariable'](util[_0x342e('0x26')](_0x342e('0x118'),_0x3373dc[_0x271f14]));if(_0x241bc9['result']===-0x1){return _0x241bc9;}logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x119'),_0x3373dc[_0x271f14],_0x241bc9[_0x342e('0x75')]));if(_0x241bc9[_0x342e('0x75')]===_0x342e('0x113')){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('IFTIME\x20%s\x20%s',_0x3373dc[_0x271f14],_0x342e('0x113')));this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x119'),_0x3373dc[_0x271f14],'true'));return{'code':0xc8,'result':_0x342e('0x113')};}else{logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x119'),_0x3373dc[_0x271f14],_0x342e('0x114')));this[_0x342e('0xa')][_0x342e('0x85')](util['format']('IFTIME\x20%s\x20%s',_0x3373dc[_0x271f14],_0x342e('0x114')));}}return{'code':0xc8,'result':_0x342e('0x114')};};AGIVertices[_0x342e('0xb')][_0x342e('0x11a')]=function(_0x188871){logger[_0x342e('0x2b')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x188871[_0x342e('0x7e')]));return this[_0x342e('0xa')]['hangup']();};AGIVertices['prototype'][_0x342e('0x11b')]=function(_0x358aa1){logger['info'](util[_0x342e('0x26')](_0x342e('0x11c'),_0x358aa1['label']));if(!this[_0x342e('0x5d')](_0x358aa1[_0x342e('0x56')])){return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xbb'));}var _0x308a18=_0x342e('0x100');var _0x5195e0=util['format'](_0x342e('0x101'),FILES_PATH,rs[_0x342e('0xe9')](0x4));var _0x3f4b43=util[_0x342e('0x26')](_0x342e('0x11d'),_0x5195e0,_0x308a18);var _0x5bd9d1=!![];if(_0x358aa1[_0x342e('0x102')]===_0x342e('0x103')){_0x5bd9d1=![];}var _0x1e7fcb=this[_0x342e('0xa')][_0x342e('0x104')](_0x5195e0,_0x308a18,_0x358aa1[_0x342e('0x109')],_0x358aa1['timeout'],undefined,_0x5bd9d1);if(_0x1e7fcb[_0x342e('0x78')]!==-0x1){this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0x11e'),_0x3f4b43));var _0x515a41=this[_0x342e('0x5b')][_0x342e('0x7a')](this,_0x358aa1,_0x3f4b43);if(_0x515a41){for(var _0x26544e in _0x515a41){if(_0x515a41['hasOwnProperty'](_0x26544e)){this[_0x342e('0xa')]['setVariable'](util[_0x342e('0x26')](_0x342e('0x11f'),_0x26544e['toUpperCase']()),_0x515a41[_0x26544e]);}}return this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0x120'),JSON[_0x342e('0xe4')](_0x515a41)));}}return _0x1e7fcb;};AGIVertices[_0x342e('0xb')][_0x342e('0x121')]=function(_0x310b95){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x122'),_0x310b95[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x310b95[_0x342e('0x56')])){return this[_0x342e('0xa')]['noop'](_0x342e('0xbb'));}if(!this['isConfigured'](_0x310b95[_0x342e('0x54')])){return this[_0x342e('0xa')][_0x342e('0x85')]('no\x20text\x20configured');}this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0x123'),_0x310b95['text']));var _0x5795bb=this[_0x342e('0x58')][_0x342e('0x7a')](this,_0x310b95);if(_0x5795bb){this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x11e'),_0x5795bb));var _0x5e4cbd=this[_0x342e('0xa')]['streamFile'](_0x5795bb,_0x310b95[_0x342e('0x109')]);try{fs[_0x342e('0xcf')](_0x5795bb+_0x342e('0xd0'));}catch(_0x4f08db){logger[_0x342e('0x29')](_0x4f08db);}return _0x5e4cbd;}return this[_0x342e('0xa')][_0x342e('0x29')](_0x310b95,_0x342e('0x124'));};AGIVertices[_0x342e('0xb')]['login']=function(_0x43e60b){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x125'),_0x43e60b[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x43e60b[_0x342e('0x126')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x43e60b,'no\x20find\x20by\x20configured');}logger[_0x342e('0x2b')](util['format'](_0x342e('0x127'),this['channel']['callerid'],_0x43e60b[_0x342e('0x126')]));var _0x432def=this[_0x342e('0x4e')][_0x342e('0x7a')](this,_0x43e60b[_0x342e('0x126')]);if(_0x432def){logger[_0x342e('0x2b')](util['format'](_0x342e('0x128'),this[_0x342e('0xa')][_0x342e('0x36')],_0x43e60b[_0x342e('0x126')]));this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x128'),this['channel'][_0x342e('0x36')],_0x43e60b[_0x342e('0x126')]));return{'code':0xc8,'result':_0x342e('0x129')};}else{logger[_0x342e('0x2b')](util['format'](_0x342e('0x12a'),this[_0x342e('0xa')]['callerid'],_0x43e60b[_0x342e('0x126')]));this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x12a'),this['channel']['callerid'],_0x43e60b[_0x342e('0x126')]));return{'code':0xc8,'result':_0x342e('0x12b')};}};AGIVertices['prototype'][_0x342e('0x12c')]=function(_0x169eaf){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x12d'),_0x169eaf[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x169eaf[_0x342e('0x126')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x169eaf,_0x342e('0x12e'));}logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x127'),this[_0x342e('0xa')][_0x342e('0x36')],_0x169eaf[_0x342e('0x126')]));var _0x1c6f2e=this[_0x342e('0x4d')][_0x342e('0x7a')](this,_0x169eaf['findBy']);if(_0x1c6f2e){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x342e('0xa')][_0x342e('0x36')],_0x169eaf[_0x342e('0x126')]));this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0x128'),this['channel'][_0x342e('0x36')],_0x169eaf['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x342e('0x26')](_0x342e('0x12a'),this[_0x342e('0xa')]['callerid'],_0x169eaf[_0x342e('0x126')]));this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x12a'),this[_0x342e('0xa')][_0x342e('0x36')],_0x169eaf['findBy']));return{'code':0xc8,'result':_0x342e('0x12b')};}};AGIVertices['prototype'][_0x342e('0x12f')]=function(_0x3ee8b3){logger['info'](util[_0x342e('0x26')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3ee8b3['label']));if(!this[_0x342e('0x5d')](_0x3ee8b3[_0x342e('0x130')])){return this['channel'][_0x342e('0x29')](_0x3ee8b3,_0x342e('0x131'));}this[_0x342e('0xa')][_0x342e('0x85')](util['format'](_0x342e('0x132'),_0x3ee8b3[_0x342e('0x130')]));var _0x4f3ce4=eval(_0x3ee8b3[_0x342e('0x130')]);if(!this[_0x342e('0x5d')](_0x3ee8b3[_0x342e('0xe0')])){return this[_0x342e('0xa')]['noop'](_0x342e('0xad'));}var _0x4059c5=this[_0x342e('0xe6')][_0x342e('0x7a')](this,_0x3ee8b3[_0x342e('0xe0')]);if(!_0x4059c5){return this[_0x342e('0xa')][_0x342e('0x29')](_0x3ee8b3,_0x342e('0xae'));}if(_[_0x342e('0x133')](_0x4f3ce4)){var _0x2f4c60=this;_0x4f3ce4[_0x342e('0xaf')](function(_0x55d2b6,_0x21b79d){_0x2f4c60[_0x342e('0xa')][_0x342e('0x79')](util[_0x342e('0x26')](_0x342e('0x134'),_0x4059c5,_0x21b79d),_0x55d2b6);});return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('variable\x20%s[key]\x20set',_0x4059c5));}else{return this['channel'][_0x342e('0x79')](_0x4059c5,_0x4f3ce4);}};AGIVertices[_0x342e('0xb')][_0x342e('0x135')]=function(_0x28fe6d){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x136'),_0x28fe6d[_0x342e('0x7e')]));if(_0x28fe6d[_0x342e('0x7b')]===0x0){return this[_0x342e('0x7c')](_0x28fe6d);}_0x28fe6d[_0x342e('0x7b')]-=0x1;if(!this['isConfigured'](_0x28fe6d[_0x342e('0xdd')])){return this[_0x342e('0xa')]['error'](_0x28fe6d,_0x342e('0xde'));}var _0x19ff66=this['getSound'][_0x342e('0x7a')](this,_0x28fe6d[_0x342e('0xdd')]);if(!_0x19ff66){return this[_0x342e('0xa')][_0x342e('0x29')](_0x28fe6d,_0x342e('0xdf'));}var _0x30250c=this[_0x342e('0xa')][_0x342e('0xe1')](_0x19ff66,_0x28fe6d['response'],_0x28fe6d[_0x342e('0x137')]);var _0x464668=_0x30250c[_0x342e('0x78')];if(_0x30250c[_0x342e('0x78')]===-0x1){this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x28fe6d,'-1');return _0x30250c;}else if(_0x30250c[_0x342e('0x75')]===_0x342e('0x81')){_0x30250c[_0x342e('0x78')]=_0x30250c[_0x342e('0x78')][_0x342e('0x72')]>0x0?_0x30250c[_0x342e('0x78')]:'t';}else if(_[_0x342e('0x40')](_0x30250c[_0x342e('0x78')])){_0x30250c[_0x342e('0x78')]='#';_0x464668='#';}if(!this[_0x342e('0x5d')](_0x28fe6d['variable_id'])){this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0xad'));}else{var _0x475b4f=this[_0x342e('0xe6')][_0x342e('0x7a')](this,_0x28fe6d[_0x342e('0xe0')]);if(!_0x475b4f){return this[_0x342e('0xa')]['error'](_0x28fe6d,_0x342e('0xae'));}this[_0x342e('0xa')][_0x342e('0x79')](_0x475b4f,_0x464668);}this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x28fe6d,_0x464668);return _0x30250c;};AGIVertices[_0x342e('0xb')][_0x342e('0x85')]=function(_0x220f63){logger['info'](util[_0x342e('0x26')](_0x342e('0x138'),_0x220f63[_0x342e('0x7e')]));return this[_0x342e('0xa')][_0x342e('0x85')](_0x220f63[_0x342e('0x139')]||_0x220f63[_0x342e('0x7e')]);};AGIVertices[_0x342e('0xb')][_0x342e('0x13a')]=function(_0x577758){logger[_0x342e('0x2b')](util['format'](_0x342e('0x13b'),_0x577758[_0x342e('0x7e')]));if(!this['isConfigured'](_0x577758[_0x342e('0x126')])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x577758,'no\x20find\x20by\x20configured');}logger['info'](util[_0x342e('0x26')](_0x342e('0x127'),this[_0x342e('0xa')][_0x342e('0x36')],_0x577758[_0x342e('0x126')]));var _0x522d87=this[_0x342e('0x48')]['sync'](this,_0x577758[_0x342e('0x13c')]);var _0x3b9622=this[_0x342e('0x4b')][_0x342e('0x7a')](this,_0x577758['findBy'],_0x522d87);if(_0x3b9622){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x128'),this['channel']['callerid'],_0x577758[_0x342e('0x126')]));this['channel'][_0x342e('0x85')](util['format'](_0x342e('0x128'),this['channel'][_0x342e('0x36')],_0x577758[_0x342e('0x126')]));return{'code':0xc8,'result':'success'};}else{logger[_0x342e('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x342e('0x36')],_0x577758[_0x342e('0x126')]));this[_0x342e('0xa')]['noop'](util['format'](_0x342e('0x128'),this[_0x342e('0xa')][_0x342e('0x36')],_0x577758[_0x342e('0x126')]));return{'code':0xc8,'result':_0x342e('0x12b')};}};AGIVertices[_0x342e('0xb')][_0x342e('0x13d')]=function(_0x353ca3){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x13e'),_0x353ca3[_0x342e('0x7e')]));if(!this['isConfigured'](_0x353ca3[_0x342e('0xdd')])){return this[_0x342e('0xa')]['error'](_0x353ca3,_0x342e('0xde'));}var _0x2c06dc=this['getSound'][_0x342e('0x7a')](this,_0x353ca3[_0x342e('0xdd')]);if(!_0x2c06dc){return this[_0x342e('0xa')][_0x342e('0x29')](_0x353ca3,'no\x20file\x20audio\x20found');}var _0x25ceb0=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0x13f'),[_0x2c06dc,_0x353ca3['opts']]);if(_0x25ceb0['result']===-0x1){return _0x25ceb0;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('Executed\x20command\x20%s\x20%s',_0x342e('0x13f'),_0x2c06dc));};AGIVertices['prototype'][_0x342e('0x140')]=function(_0x4f1470){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x141'),_0x4f1470['label']));if(!this[_0x342e('0x5d')](_0x4f1470[_0x342e('0x142')])){return this['channel'][_0x342e('0x29')](_0x4f1470,_0x342e('0x143'));}var _0xde1f9e='';var _0x28a7b1=parseInt(_0x4f1470['queue_id'],0xa);if(isNaN(_0x28a7b1)){_0xde1f9e=_0x4f1470[_0x342e('0x142')];}else{_0xde1f9e=this[_0x342e('0x10')][_0x342e('0x7a')](this,_0x4f1470[_0x342e('0x142')]);if(!_0xde1f9e){return this['channel'][_0x342e('0x29')](_0x4f1470,_0x342e('0x144'));}}var _0x1de8c6='';if(this[_0x342e('0x5d')](_0x4f1470[_0x342e('0xdd')])){var _0x1e2e4f=this[_0x342e('0x19')][_0x342e('0x7a')](this,_0x4f1470[_0x342e('0xdd')]);if(_0x1e2e4f){_0x1de8c6=_0x1e2e4f;}}this['createSquareDetailsReport']['sync'](this,_0x4f1470,_0xde1f9e);if(_0x4f1470[_0x342e('0xb8')][_0x342e('0x145')]('x')<0x0){_0x4f1470[_0x342e('0xb8')]+='x';}if(_0x4f1470[_0x342e('0xb8')]['indexOf']('X')<0x0){_0x4f1470[_0x342e('0xb8')]+='X';}this[_0x342e('0xa')]['setVariable'](_0x342e('0x146'),_0xde1f9e?_0xde1f9e[_0x342e('0x147')]():'');var _0x33015b=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0x148'),[_0xde1f9e,_0x4f1470['opts'],_0x4f1470[_0x342e('0xda')],_0x1de8c6,_0x4f1470[_0x342e('0x81')],_0x4f1470[_0x342e('0x6')],_0x4f1470['macro'],_0x4f1470[_0x342e('0x149')],'',_0x4f1470[_0x342e('0x14a')]]);if(_0x33015b['result']===-0x1){return _0x33015b;}return this['channel'][_0x342e('0x85')](util[_0x342e('0x26')]('Executed\x20command\x20%s\x20%s',_0x342e('0x148'),_0xde1f9e));};AGIVertices[_0x342e('0xb')][_0x342e('0x14b')]=function(_0x3e23db){logger['info'](util[_0x342e('0x26')](_0x342e('0x14c'),_0x3e23db[_0x342e('0x7e')]));var _0x20cbd8=_0x3e23db[_0x342e('0x14d')]||_0x342e('0x100');var _0x32cff=util[_0x342e('0x26')](_0x342e('0x14e'),this[_0x342e('0xa')][_0x342e('0x34')],rs[_0x342e('0xe9')](0x5));var _0x5000e8=util[_0x342e('0x26')](_0x342e('0x14f'),FILES_PATH,_0x32cff,_0x20cbd8);var _0x10b1f=util[_0x342e('0x26')](_0x342e('0x101'),FILES_PATH,_0x32cff);this[_0x342e('0x37')][_0x342e('0x7a')](this,_0x3e23db,_0x32cff,_0x5000e8);this['channel']['setVariable']('RECORDING_SAVENAME',_0x32cff);logger[_0x342e('0x2b')](_0x342e('0x150'),_0x10b1f,_0x20cbd8,_0x3e23db[_0x342e('0x151')],_0x3e23db[_0x342e('0x81')]);return this[_0x342e('0xa')]['recordFile'](_0x10b1f,_0x20cbd8,_0x3e23db[_0x342e('0x151')],_0x3e23db['timeout'],undefined,!![]);};AGIVertices[_0x342e('0xb')][_0x342e('0x152')]=function(_0x1f236e){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x153'),_0x1f236e['label']));return this['channel'][_0x342e('0x154')](_0x1f236e[_0x342e('0x155')]['replace'](/\s+/g,''),_0x1f236e[_0x342e('0x151')]);};AGIVertices[_0x342e('0xb')]['saynumber']=function(_0x22ce0b){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x156'),_0x22ce0b[_0x342e('0x7e')]));return this[_0x342e('0xa')][_0x342e('0x157')](_0x22ce0b[_0x342e('0x158')][_0x342e('0xaa')](/\s+/g,''),_0x22ce0b['escape_digits']);};AGIVertices['prototype'][_0x342e('0x159')]=function(_0xb30df){logger['info'](util[_0x342e('0x26')](_0x342e('0x15a'),_0xb30df[_0x342e('0x7e')]));return this['channel'][_0x342e('0x15b')](_0xb30df[_0x342e('0x54')],_0xb30df[_0x342e('0x151')]);};AGIVertices[_0x342e('0xb')][_0x342e('0x15c')]=function(_0x3203b4){logger['info'](util['format'](_0x342e('0x15d'),_0x3203b4[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x3203b4[_0x342e('0x15e')])){return this[_0x342e('0xa')][_0x342e('0x85')]('no\x20mail\x20account\x20configured');}var _0x599fbc=this[_0x342e('0x1d')]['sync'](this,_0x3203b4[_0x342e('0x15e')]);if(!_0x599fbc||!_0x599fbc[_0x342e('0x15f')]){return this['channel'][_0x342e('0x29')](_0x3203b4,_0x342e('0x160'));}var _0x1bb549={'from':util[_0x342e('0x26')](_0x342e('0x161'),_0x599fbc['name'],_0x599fbc[_0x342e('0x162')]||_0x599fbc['Smtp'][_0x342e('0x163')]),'to':_0x3203b4['to']||'','cc':_0x3203b4['cc']||'','bcc':_0x3203b4[_0x342e('0x164')]||'','subject':_0x3203b4['subject'],'html':_0x3203b4[_0x342e('0x54')],'text':_0x3203b4['text']};var _0x210b1f={'tls':{'rejectUnauthorized':![]}};if(_0x599fbc[_0x342e('0x15f')][_0x342e('0x165')]){_0x210b1f[_0x342e('0x165')]=_0x599fbc['Smtp'][_0x342e('0x165')];}else{_0x210b1f[_0x342e('0x166')]=_0x599fbc['Smtp'][_0x342e('0x166')];_0x210b1f['port']=_0x599fbc['Smtp'][_0x342e('0x167')];_0x210b1f[_0x342e('0x168')]=_0x599fbc[_0x342e('0x15f')]['secure'];}if(_0x599fbc[_0x342e('0x15f')]['authentication']){_0x210b1f[_0x342e('0x169')]={'user':_0x599fbc[_0x342e('0x15f')][_0x342e('0x163')],'pass':_0x599fbc[_0x342e('0x15f')][_0x342e('0x16a')]};}if(this[_0x342e('0x5d')](_0x3203b4[_0x342e('0x16b')])){}logger[_0x342e('0xb4')](_0x342e('0x16c'),JSON[_0x342e('0xe4')](_0x1bb549));this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x3203b4,_0x3203b4['account_id']);this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x16d'),_0x599fbc[_0x342e('0xe')]));this[_0x342e('0x1f')]['sync'](this,_0x210b1f,_0x1bb549);return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x16e'));};AGIVertices['prototype']['sendFax']=function(_0x2aa5a1){logger['info'](util[_0x342e('0x26')](_0x342e('0x16f'),_0x2aa5a1[_0x342e('0x7e')]));return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x170'));};AGIVertices['prototype']['sendSMS']=function(_0x252b3c){logger[_0x342e('0x2b')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x252b3c[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x252b3c[_0x342e('0x171')])){return this[_0x342e('0xa')]['noop'](_0x342e('0x172'));}var _0x2507e4=this[_0x342e('0x30')]['sync'](this,_0x252b3c[_0x342e('0x171')]);if(!_0x2507e4){return this['channel']['error'](_0x252b3c,_0x342e('0x173'));}var _0x2e0b31={'body':_0x252b3c[_0x342e('0x174')],'phone':_0x252b3c['to']||'','SmsAccountId':_0x2507e4['id']};logger[_0x342e('0xb4')](_0x342e('0x175'),JSON['stringify'](_0x2e0b31));this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x252b3c,_0x252b3c[_0x342e('0x171')]);this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x176'),_0x2507e4[_0x342e('0xe')]));this['createSmsMessage'][_0x342e('0x7a')](this,_0x2e0b31);return this[_0x342e('0xa')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x342e('0x177')]=function(_0xf882b){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x178'),_0xf882b[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0xf882b['variable_id'])){return this[_0x342e('0xa')][_0x342e('0x29')](_0xf882b,_0x342e('0x179'));}var _0x302c82=this[_0x342e('0xe6')][_0x342e('0x7a')](this,_0xf882b[_0x342e('0xe0')]);if(!_0x302c82){return this[_0x342e('0xa')][_0x342e('0x29')](_0xf882b,'no\x20variable\x20found');}return this[_0x342e('0xa')][_0x342e('0x79')](_0x302c82,_0xf882b[_0x342e('0x17a')]);};AGIVertices[_0x342e('0xb')][_0x342e('0x17b')]=function(_0x129121){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x17c'),_0x129121[_0x342e('0x7e')]));this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x17d'));if(_0x129121[_0x342e('0x82')]==='yes'){this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x17e'));return this[_0x342e('0xa')][_0x342e('0x82')]();}return this[_0x342e('0xa')][_0x342e('0x85')](_0x342e('0x17f'));};AGIVertices[_0x342e('0xb')][_0x342e('0x180')]=function(_0x27e543){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x181'),_0x27e543[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x27e543[_0x342e('0x182')])){return this['channel']['error'](_0x27e543,_0x342e('0x183'));}var _0x1f3dbc=this[_0x342e('0x184')][_0x342e('0x7a')](this,_0x27e543[_0x342e('0x182')]);if(!this[_0x342e('0x5d')](_0x1f3dbc)){return this[_0x342e('0xa')][_0x342e('0x29')](_0x27e543,util[_0x342e('0x26')](_0x342e('0x185'),_0x27e543['project_id']));}if(_0x1f3dbc===this['channel'][_0x342e('0x35')]){return this[_0x342e('0xa')][_0x342e('0x29')](_0x27e543,_0x342e('0x186'));}this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x27e543,_0x1f3dbc);var _0x371c0a=this['channel'][_0x342e('0x89')](_0x342e('0x187'),util['format'](_0x342e('0x188'),config[_0x342e('0x6')][_0x342e('0x166')]||'127.0.0.1',_0x1f3dbc,this[_0x342e('0xa')]['arg_1']));if(_0x371c0a['result']===-0x1){return _0x371c0a;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('Executed\x20command\x20%s\x20%s',_0x342e('0x187'),_0x1f3dbc));};AGIVertices[_0x342e('0xb')][_0x342e('0x189')]=function(_0x27156d){logger[_0x342e('0x2b')](util['format'](_0x342e('0x18a'),_0x27156d[_0x342e('0x7e')]));var _0x1198de=this[_0x342e('0x51')][_0x342e('0x7a')](this,_0x27156d[_0x342e('0x7f')]);this[_0x342e('0x33')][_0x342e('0x7a')](this,_0x27156d,_0x27156d[_0x342e('0x7f')]);if(this[_0x342e('0x5d')](_0x27156d['variable_id'])){var _0x16a44a=this['getVariable'][_0x342e('0x7a')](this,_0x27156d[_0x342e('0xe0')]);if(_0x16a44a){this[_0x342e('0xa')]['setVariable'](_0x16a44a,_0x1198de);return this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0x18b'),_0x27156d[_0x342e('0x7f')],_0x16a44a));}}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x27156d['command']));};AGIVertices[_0x342e('0xb')][_0x342e('0x18c')]=function(_0x31ddc4){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x18d'),_0x31ddc4[_0x342e('0x7e')]));if(!this['isConfigured'](_0x31ddc4[_0x342e('0x54')])){return this[_0x342e('0xa')][_0x342e('0x85')]('no\x20text\x20configured');}this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')]('Trying\x20Google\x20TTS\x20%s',_0x31ddc4['text']));var _0x3e2e6c=this[_0x342e('0x53')]['sync'](this,_0x31ddc4);if(_0x3e2e6c){this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0x3e2e6c));var _0x348958=this['channel'][_0x342e('0xce')](_0x3e2e6c);try{fs['unlink'](_0x3e2e6c+_0x342e('0xd0'));}catch(_0x55708e){logger['error'](_0x55708e);}return _0x348958;}return this[_0x342e('0xa')][_0x342e('0x29')](_0x31ddc4,_0x342e('0x18e'));};AGIVertices[_0x342e('0xb')][_0x342e('0x18f')]=function(_0x2033cd){logger[_0x342e('0x2b')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2033cd[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x2033cd[_0x342e('0x126')])){return this[_0x342e('0xa')]['error'](_0x2033cd,_0x342e('0x12e'));}logger[_0x342e('0x2b')](util[_0x342e('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x342e('0xa')][_0x342e('0x36')],_0x2033cd[_0x342e('0x126')]));var _0x98633d=this[_0x342e('0x4c')]['sync'](this,_0x2033cd[_0x342e('0x126')]);if(_0x98633d){logger[_0x342e('0x2b')](util[_0x342e('0x26')](_0x342e('0x128'),this[_0x342e('0xa')][_0x342e('0x36')],_0x2033cd[_0x342e('0x126')]));this['channel'][_0x342e('0x85')](util[_0x342e('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x342e('0xa')]['callerid'],_0x2033cd['findBy']));return{'code':0xc8,'result':_0x342e('0x129')};}else{logger[_0x342e('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x342e('0xa')][_0x342e('0x36')],_0x2033cd[_0x342e('0x126')]));this[_0x342e('0xa')]['noop'](util[_0x342e('0x26')](_0x342e('0x12a'),this[_0x342e('0xa')][_0x342e('0x36')],_0x2033cd[_0x342e('0x126')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x342e('0xb')][_0x342e('0x190')]=function(_0x581409){logger[_0x342e('0x2b')](util[_0x342e('0x26')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x581409['label']));var _0xee4b5b=this[_0x342e('0xa')][_0x342e('0x89')](_0x342e('0x191'),[_0x581409[_0x342e('0x192')],_0x581409[_0x342e('0x8b')]]);if(_0xee4b5b['result']===-0x1){return _0xee4b5b;}return this[_0x342e('0xa')][_0x342e('0x85')](util[_0x342e('0x26')](_0x342e('0x8c'),_0x342e('0x191'),_0x581409['mailbox']));};AGIVertices[_0x342e('0xb')][_0x342e('0x193')]=function(_0x25126a){logger[_0x342e('0x2b')](util['format'](_0x342e('0x194'),_0x25126a[_0x342e('0x7e')]));if(!this[_0x342e('0x5d')](_0x25126a['variable_id'])){return this[_0x342e('0xa')][_0x342e('0x29')](_0x25126a,_0x342e('0x179'));}var _0x440ee4=this[_0x342e('0xe6')][_0x342e('0x7a')](this,_0x25126a[_0x342e('0xe0')]);if(!_0x440ee4){return this['channel'][_0x342e('0x29')](_0x25126a,_0x342e('0xae'));}var _0x343cf6=this[_0x342e('0xa')]['getVariable'](_0x440ee4);return{'code':0xc8,'result':_0x343cf6[_0x342e('0x75')]?_0x343cf6[_0x342e('0x75')]:'-'};};String[_0x342e('0xb')][_0x342e('0x74')]=function(_0x2d78fd,_0x489b34){return this[_0x342e('0x73')](_0x2d78fd)[_0x342e('0x195')](_0x489b34);};module[_0x342e('0x196')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6285bbd..f96118b 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 _0x99e9=['transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','startAcw','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]'];(function(_0x54855a,_0x511a1e){var _0x2bc07a=function(_0x29b79e){while(--_0x29b79e){_0x54855a['push'](_0x54855a['shift']());}};_0x2bc07a(++_0x511a1e);}(_0x99e9,0xb4));var _0x999e=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x99e9[_0x1f1e31];return _0x229b56;};'use strict';var util=require('util');var _=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var ami=require(_0x999e('0x2'));var logger=require(_0x999e('0x3'))('acw');var RpcUser=require(_0x999e('0x4'));var RpcVoiceAgentReport=require(_0x999e('0x5'));function Acw(_0x3aac27){this['voiceQueues']=_0x3aac27[_0x999e('0x6')];this['agents']=_0x3aac27[_0x999e('0x7')];this[_0x999e('0x8')]=_0x3aac27[_0x999e('0x8')];this[_0x999e('0x9')]={};ami['on']('agentconnect',this[_0x999e('0xa')][_0x999e('0xb')](this));ami['on'](_0x999e('0xc'),this[_0x999e('0xd')][_0x999e('0xb')](this));ami['on'](_0x999e('0xe'),this[_0x999e('0xf')][_0x999e('0xb')](this));ami['on'](_0x999e('0x10'),this[_0x999e('0x11')][_0x999e('0xb')](this));ami['on'](_0x999e('0x12'),this[_0x999e('0x13')][_0x999e('0xb')](this));ami['on'](_0x999e('0x14'),this[_0x999e('0x15')][_0x999e('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x999e('0x16')]['bind'](this));}function getDiff(_0x3e6f5a){var _0x387924=moment()[_0x999e('0x17')](0x0);var _0x538a92=moment(_0x3e6f5a)[_0x999e('0x17')](0x0);return _0x387924['diff'](_0x538a92,_0x999e('0x18'));}Acw['prototype']['startAcw']=function(_0x1eee64){try{var _0x22feac=this;var _0x2dd5f4=this[_0x999e('0x9')][_0x1eee64][_0x999e('0x19')];var _0x39ce36=this['channels'][_0x1eee64]['queue'];var _0x4fcdfb=this[_0x999e('0x6')][_0x39ce36];var _0x43b09e=![];var _0xc4ef74=_0x999e('0x1a');if(_0x4fcdfb[_0x999e('0x1b')]){if(_0x4fcdfb[_0x999e('0x1c')]['name']){_0x43b09e=!![];_0xc4ef74=_0x4fcdfb['mandatoryDispositionPause'][_0x999e('0x1d')];}}ami[_0x999e('0x1e')]({'action':_0x999e('0x1f'),'interface':_0x2dd5f4,'paused':!![],'reason':_0xc4ef74})['then'](function(_0x351dd7){if(_0x22feac[_0x999e('0x7')][_0x2dd5f4]){return RpcUser[_0x999e('0x20')](_0x22feac[_0x999e('0x7')][_0x2dd5f4]['id'])[_0x999e('0x21')](function(_0x3750a0){if(_0x3750a0&&!_0x3750a0[_0x999e('0x22')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x1eee64,_0x2dd5f4,_0x39ce36);var _0x11a6bf=_0x22feac[_0x999e('0x9')][_0x1eee64]['attended']&&_0x22feac[_0x999e('0x9')][_0x1eee64][_0x999e('0x23')]?_0x22feac[_0x999e('0x9')][_0x1eee64][_0x999e('0x23')]:_0x1eee64;return RpcUser[_0x999e('0x24')](_0x22feac[_0x999e('0x7')][_0x2dd5f4],_0xc4ef74,_0x11a6bf)['then'](function(_0x2e1cc5){if(!_0x43b09e){_0x22feac[_0x999e('0x8')][_0x2dd5f4]={};logger[_0x999e('0x25')](_0x999e('0x26'),_0x1eee64,_0x22feac[_0x999e('0x6')][_0x39ce36][_0x999e('0x27')],_0x2dd5f4,_0x39ce36);_0x22feac[_0x999e('0x8')][_0x2dd5f4]['timer']=setTimeout(_0x22feac[_0x999e('0x28')]['bind'](_0x22feac,_0x2dd5f4),_0x22feac['voiceQueues'][_0x39ce36][_0x999e('0x27')]*0x3e8);_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x29')]=moment()['format'](_0x999e('0x2a'));_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2b')]=_0x1eee64;_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2c')]=_0x39ce36;_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2d')]=function(){var _0x2e9b0e=getDiff(_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x29')]);clearTimeout(_0x22feac['timers'][_0x2dd5f4][_0x999e('0x2e')]);_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2e')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2e9b0e},_0x22feac[_0x999e('0x8')][_0x2dd5f4]['uniqueid'],_0x2dd5f4)['then'](function(_0x28a228){logger[_0x999e('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x1eee64,_0x2e9b0e,_0x28a228);})['catch'](function(_0x5def61){logger[_0x999e('0x2f')](_0x999e('0x30'),_0x1eee64,_0x5def61);});delete _0x22feac[_0x999e('0x8')][_0x2dd5f4];};}});}else{logger['info'](_0x999e('0x31'),_0x1eee64,_0x2dd5f4,_0x39ce36);}});}})[_0x999e('0x32')](function(_0x37f662){logger[_0x999e('0x2f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1eee64,_0x22feac['voiceQueues'][_0x39ce36][_0x999e('0x27')],_0x2dd5f4,_0x39ce36);})['finally'](function(){delete _0x22feac[_0x999e('0x9')][_0x1eee64];});}catch(_0x2fda68){logger[_0x999e('0x2f')](_0x999e('0x33'),_0x2fda68['message']);}};Acw[_0x999e('0x34')][_0x999e('0x28')]=function(_0x5bd468){try{var _0x4808d1=this;if(_0x4808d1[_0x999e('0x8')][_0x5bd468]){_0x4808d1['timers'][_0x5bd468][_0x999e('0x2e')]=![];var _0x5dac45=_0x4808d1['timers'][_0x5bd468]['uniqueid'];var _0x5360a3=_0x4808d1[_0x999e('0x8')][_0x5bd468]['queue'];var _0x1be117=_0x4808d1['voiceQueues'][_0x5360a3]['acwTimeout'];logger['info'](_0x999e('0x35'),_0x5bd468);RpcUser[_0x999e('0x36')](this[_0x999e('0x7')][_0x5bd468]);RpcVoiceAgentReport[_0x999e('0x37')]({'acwtime':_0x1be117,'agentacw':!![]},_0x5dac45,_0x5bd468)[_0x999e('0x21')](function(_0x368183){logger[_0x999e('0x25')](_0x999e('0x38'),_0x5dac45,_0x1be117,_0x368183);})['catch'](function(_0x3ff20a){logger[_0x999e('0x2f')](_0x999e('0x30'),_0x5dac45,_0x3ff20a);});}else{logger[_0x999e('0x2f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5bd468);if(_0x4808d1[_0x999e('0x8')]){logger['info'](_0x999e('0x39'),JSON[_0x999e('0x3a')](_0x4808d1[_0x999e('0x8')]));}}}catch(_0x327c7b){logger['error'](_0x999e('0x3b'),_0x327c7b[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')]['syncAgentConnect']=function(_0x58dfb2){try{if(this[_0x999e('0x6')][_0x58dfb2[_0x999e('0x2c')]]&&(this[_0x999e('0x6')][_0x58dfb2[_0x999e('0x2c')]][_0x999e('0x3d')]||this[_0x999e('0x6')][_0x58dfb2[_0x999e('0x2c')]][_0x999e('0x1b')])){if(this[_0x999e('0x7')][_0x58dfb2[_0x999e('0x19')]]){this['channels'][_0x58dfb2['uniqueid']]={'queue':_0x58dfb2[_0x999e('0x2c')],'interface':_0x58dfb2[_0x999e('0x19')],'destlinkedid':_0x58dfb2[_0x999e('0x23')]};}}}catch(_0xd37b6e){logger[_0x999e('0x2f')](_0x999e('0x3e'),_0xd37b6e['message']);}};Acw[_0x999e('0x34')]['syncAgentConnectPreview']=function(_0x4caf56){try{if(this[_0x999e('0x6')][_0x4caf56['queue']]&&(this['voiceQueues'][_0x4caf56['queue']]['acw']||this[_0x999e('0x6')][_0x4caf56[_0x999e('0x2c')]]['mandatoryDisposition'])){if(this[_0x999e('0x7')][_0x4caf56[_0x999e('0x19')]]){this[_0x999e('0x9')][_0x4caf56['uniqueid']]={'queue':_0x4caf56['queue'],'interface':_0x4caf56[_0x999e('0x19')]};}}}catch(_0x2ebafe){logger[_0x999e('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2ebafe['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x8f1afa){try{if(this['channels'][_0x8f1afa['uniqueid']]&&_[_0x999e('0x3f')](this[_0x999e('0x9')][_0x8f1afa['uniqueid']][_0x999e('0x40')])){logger[_0x999e('0x25')]('[%s][HANGUP:UNIQUEID]',_0x8f1afa[_0x999e('0x2b')]);this['startAcw'](_0x8f1afa[_0x999e('0x2b')]);}else if(this[_0x999e('0x9')][_0x8f1afa['linkedid']]&&_[_0x999e('0x3f')](this[_0x999e('0x9')][_0x8f1afa['linkedid']]['attended'])){logger[_0x999e('0x25')]('[%s][HANGUP:LINKEDID]',_0x8f1afa['linkedid']);this['startAcw'](_0x8f1afa[_0x999e('0x41')]);}}catch(_0x3b2023){logger[_0x999e('0x2f')](_0x999e('0x42'),_0x3b2023[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')]['syncHangup']=function(_0x14f8de){try{if(this[_0x999e('0x9')][_0x14f8de['uniqueid']]&&this[_0x999e('0x9')][_0x14f8de[_0x999e('0x2b')]][_0x999e('0x40')]){logger[_0x999e('0x25')](_0x999e('0x43'),_0x14f8de[_0x999e('0x2b')]);this[_0x999e('0x44')](_0x14f8de[_0x999e('0x2b')]);}else if(this[_0x999e('0x9')][_0x14f8de['linkedid']]&&this[_0x999e('0x9')][_0x14f8de[_0x999e('0x41')]][_0x999e('0x40')]){logger[_0x999e('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x14f8de[_0x999e('0x41')]);this[_0x999e('0x44')](_0x14f8de[_0x999e('0x41')]);}}catch(_0x291b73){logger[_0x999e('0x2f')](_0x999e('0x45'),_0x291b73[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')]['syncAttendedTransfer']=function(_0x56368e){try{if(!_[_0x999e('0x46')](this[_0x999e('0x9')][_0x56368e[_0x999e('0x47')]])){this[_0x999e('0x44')](_0x56368e[_0x999e('0x47')]);if(this[_0x999e('0x9')][_0x56368e[_0x999e('0x48')]]){this['channels'][_0x56368e['secondtransfereruniqueid']][_0x999e('0x40')]=!![];this[_0x999e('0x9')][_0x56368e[_0x999e('0x49')]]=this[_0x999e('0x9')][_0x56368e[_0x999e('0x48')]];delete this['channels'][_0x56368e[_0x999e('0x48')]];}}else if(!_[_0x999e('0x46')](this[_0x999e('0x9')][_0x56368e[_0x999e('0x49')]])){this[_0x999e('0x44')](_0x56368e[_0x999e('0x49')]);if(this[_0x999e('0x9')][_0x56368e['origtransfereruniqueid']]){this[_0x999e('0x9')][_0x56368e['origtransfereruniqueid']][_0x999e('0x40')]=!![];this[_0x999e('0x9')][_0x56368e[_0x999e('0x47')]]=this[_0x999e('0x9')][_0x56368e[_0x999e('0x4a')]];delete this[_0x999e('0x9')][_0x56368e['origtransfereruniqueid']];}}}catch(_0x43bd68){logger[_0x999e('0x2f')](_0x999e('0x4b'),_0x43bd68[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')][_0x999e('0x15')]=function(_0x23fd58){try{if(this[_0x999e('0x9')][_0x23fd58[_0x999e('0x4c')]]){logger[_0x999e('0x25')](_0x999e('0x4d'),JSON[_0x999e('0x3a')](_0x23fd58[_0x999e('0x4c')]));this[_0x999e('0x44')](_0x23fd58[_0x999e('0x4c')]);}else if(this['channels'][_0x23fd58[_0x999e('0x4e')]]){logger[_0x999e('0x25')](_0x999e('0x4f'),JSON[_0x999e('0x3a')](_0x23fd58['transfererlinkedid']));this['startAcw'](_0x23fd58[_0x999e('0x4e')]);}}catch(_0x2d398f){logger[_0x999e('0x2f')](_0x999e('0x50'),_0x2d398f[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')][_0x999e('0x11')]=function(_0x3e75a3){try{if(this[_0x999e('0x6')][_0x3e75a3['queue']]&&this[_0x999e('0x6')][_0x3e75a3['queue']][_0x999e('0x51')]===_0x999e('0x52')){if(this['agents'][_0x3e75a3[_0x999e('0x19')]]){logger[_0x999e('0x25')](_0x999e('0x53'),_0x3e75a3[_0x999e('0x2b')],_0x3e75a3[_0x999e('0x19')],_0x3e75a3['queue']);return RpcUser[_0x999e('0x24')](this[_0x999e('0x7')][_0x3e75a3['interface']],'Auto-Pause',_0x3e75a3['uniqueid']);}}}catch(_0x43ec04){logger[_0x999e('0x2f')](_0x999e('0x54'),_0x43ec04[_0x999e('0x3c')]);}};module[_0x999e('0x55')]=Acw; \ No newline at end of file +var _0x032e=['[ACW][syncAgentConnect]\x20%s','acw','mandatoryDisposition','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0x032e,0x124));var _0xe032=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x032e[_0x29b609];return _0x54c952;};'use strict';var util=require(_0xe032('0x0'));var _=require('lodash');var moment=require(_0xe032('0x1'));var ami=require(_0xe032('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xe032('0x3'));var RpcVoiceAgentReport=require(_0xe032('0x4'));function Acw(_0x2f44f6){this[_0xe032('0x5')]=_0x2f44f6[_0xe032('0x5')];this[_0xe032('0x6')]=_0x2f44f6[_0xe032('0x6')];this[_0xe032('0x7')]=_0x2f44f6[_0xe032('0x7')];this[_0xe032('0x8')]={};ami['on'](_0xe032('0x9'),this[_0xe032('0xa')][_0xe032('0xb')](this));ami['on'](_0xe032('0xc'),this[_0xe032('0xd')][_0xe032('0xb')](this));ami['on'](_0xe032('0xe'),this[_0xe032('0xf')]['bind'](this));ami['on'](_0xe032('0x10'),this[_0xe032('0x11')][_0xe032('0xb')](this));ami['on'](_0xe032('0x12'),this[_0xe032('0x13')][_0xe032('0xb')](this));ami['on'](_0xe032('0x14'),this['syncBlindTransfer'][_0xe032('0xb')](this));ami['on'](_0xe032('0x15'),this[_0xe032('0x16')][_0xe032('0xb')](this));}function getDiff(_0x4aee44){var _0x311592=moment()[_0xe032('0x17')](0x0);var _0x176547=moment(_0x4aee44)[_0xe032('0x17')](0x0);return _0x311592[_0xe032('0x18')](_0x176547,_0xe032('0x19'));}Acw[_0xe032('0x1a')]['startAcw']=function(_0x231c35){try{var _0x749018=this;var _0x36fb7c=this[_0xe032('0x8')][_0x231c35][_0xe032('0x1b')];var _0x208b00=this['channels'][_0x231c35][_0xe032('0x1c')];var _0x25cedb=this[_0xe032('0x5')][_0x208b00];var _0x41d2a5=![];var _0x208c47='ACW';if(_0x25cedb['mandatoryDisposition']){if(_0x25cedb['mandatoryDispositionPause'][_0xe032('0x1d')]){_0x41d2a5=!![];_0x208c47=_0x25cedb['mandatoryDispositionPause'][_0xe032('0x1d')];}}ami[_0xe032('0x1e')]({'action':_0xe032('0x1f'),'interface':_0x36fb7c,'paused':!![],'reason':_0x208c47})[_0xe032('0x20')](function(_0x288d91){if(_0x749018[_0xe032('0x6')][_0x36fb7c]){return RpcUser[_0xe032('0x21')](_0x749018['agents'][_0x36fb7c]['id'])[_0xe032('0x20')](function(_0x866c81){if(_0x866c81&&!_0x866c81[_0xe032('0x22')]){logger[_0xe032('0x23')](_0xe032('0x24'),_0x231c35,_0x36fb7c,_0x208b00);var _0x33d89a=_0x749018[_0xe032('0x8')][_0x231c35][_0xe032('0x25')]&&_0x749018['channels'][_0x231c35]['destlinkedid']?_0x749018['channels'][_0x231c35][_0xe032('0x26')]:_0x231c35;return RpcUser[_0xe032('0x27')](_0x749018[_0xe032('0x6')][_0x36fb7c],_0x208c47,_0x33d89a)[_0xe032('0x20')](function(_0x2bfe8f){if(!_0x41d2a5){_0x749018[_0xe032('0x7')][_0x36fb7c]={};logger[_0xe032('0x23')](_0xe032('0x28'),_0x231c35,_0x749018[_0xe032('0x5')][_0x208b00][_0xe032('0x29')],_0x36fb7c,_0x208b00);_0x749018['timers'][_0x36fb7c][_0xe032('0x2a')]=setTimeout(_0x749018[_0xe032('0x2b')][_0xe032('0xb')](_0x749018,_0x36fb7c),_0x749018[_0xe032('0x5')][_0x208b00]['acwTimeout']*0x3e8);_0x749018['timers'][_0x36fb7c][_0xe032('0x2c')]=moment()[_0xe032('0x2d')](_0xe032('0x2e'));_0x749018[_0xe032('0x7')][_0x36fb7c]['uniqueid']=_0x231c35;_0x749018['timers'][_0x36fb7c]['queue']=_0x208b00;_0x749018[_0xe032('0x7')][_0x36fb7c][_0xe032('0x2f')]=function(){var _0x5518ac=getDiff(_0x749018[_0xe032('0x7')][_0x36fb7c]['lastPauseAt']);clearTimeout(_0x749018[_0xe032('0x7')][_0x36fb7c][_0xe032('0x2a')]);_0x749018[_0xe032('0x7')][_0x36fb7c][_0xe032('0x2a')]=![];RpcVoiceAgentReport[_0xe032('0x30')]({'acwtime':_0x5518ac},_0x749018['timers'][_0x36fb7c][_0xe032('0x31')],_0x36fb7c)[_0xe032('0x20')](function(_0x319a2f){logger[_0xe032('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x231c35,_0x5518ac,_0x319a2f);})[_0xe032('0x32')](function(_0x4c86e9){logger[_0xe032('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x231c35,_0x4c86e9);});delete _0x749018[_0xe032('0x7')][_0x36fb7c];};}});}else{logger['info'](_0xe032('0x34'),_0x231c35,_0x36fb7c,_0x208b00);}});}})['catch'](function(_0x3970e1){logger[_0xe032('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x231c35,_0x749018[_0xe032('0x5')][_0x208b00][_0xe032('0x29')],_0x36fb7c,_0x208b00);})[_0xe032('0x35')](function(){delete _0x749018[_0xe032('0x8')][_0x231c35];});}catch(_0x4e222c){logger[_0xe032('0x33')]('[ACW][START]\x20%s',_0x4e222c[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')]['stopAcw']=function(_0x450ba4){try{var _0x23b790=this;if(_0x23b790['timers'][_0x450ba4]){_0x23b790[_0xe032('0x7')][_0x450ba4][_0xe032('0x2a')]=![];var _0x3cc437=_0x23b790[_0xe032('0x7')][_0x450ba4][_0xe032('0x31')];var _0x42f58a=_0x23b790[_0xe032('0x7')][_0x450ba4][_0xe032('0x1c')];var _0x22651f=_0x23b790[_0xe032('0x5')][_0x42f58a][_0xe032('0x29')];logger[_0xe032('0x23')](_0xe032('0x37'),_0x450ba4);RpcUser[_0xe032('0x38')](this[_0xe032('0x6')][_0x450ba4]);RpcVoiceAgentReport[_0xe032('0x30')]({'acwtime':_0x22651f,'agentacw':!![]},_0x3cc437,_0x450ba4)[_0xe032('0x20')](function(_0x555914){logger[_0xe032('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x3cc437,_0x22651f,_0x555914);})[_0xe032('0x32')](function(_0x2bcfb4){logger[_0xe032('0x33')](_0xe032('0x39'),_0x3cc437,_0x2bcfb4);});}else{logger[_0xe032('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x450ba4);if(_0x23b790[_0xe032('0x7')]){logger['info'](_0xe032('0x3a'),JSON['stringify'](_0x23b790[_0xe032('0x7')]));}}}catch(_0x475355){logger[_0xe032('0x33')](_0xe032('0x3b'),_0x475355['message']);}};Acw[_0xe032('0x1a')]['syncAgentConnect']=function(_0x2b9664){try{if(this[_0xe032('0x5')][_0x2b9664[_0xe032('0x1c')]]&&(this[_0xe032('0x5')][_0x2b9664['queue']]['acw']||this[_0xe032('0x5')][_0x2b9664[_0xe032('0x1c')]]['mandatoryDisposition'])){if(this[_0xe032('0x6')][_0x2b9664[_0xe032('0x1b')]]){this[_0xe032('0x8')][_0x2b9664[_0xe032('0x31')]]={'queue':_0x2b9664[_0xe032('0x1c')],'interface':_0x2b9664['interface'],'destlinkedid':_0x2b9664[_0xe032('0x26')]};}}}catch(_0x7bc08){logger[_0xe032('0x33')](_0xe032('0x3c'),_0x7bc08[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0x16')]=function(_0x318f86){try{if(this['voiceQueues'][_0x318f86['queue']]&&(this[_0xe032('0x5')][_0x318f86['queue']][_0xe032('0x3d')]||this[_0xe032('0x5')][_0x318f86[_0xe032('0x1c')]][_0xe032('0x3e')])){if(this[_0xe032('0x6')][_0x318f86[_0xe032('0x1b')]]){this[_0xe032('0x8')][_0x318f86[_0xe032('0x31')]]={'queue':_0x318f86[_0xe032('0x1c')],'interface':_0x318f86['interface']};}}}catch(_0x1549c){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x1549c[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0xd')]=function(_0x1e54d3){try{if(this['channels'][_0x1e54d3[_0xe032('0x31')]]&&_[_0xe032('0x3f')](this[_0xe032('0x8')][_0x1e54d3[_0xe032('0x31')]][_0xe032('0x25')])){logger[_0xe032('0x23')](_0xe032('0x40'),_0x1e54d3['uniqueid']);this[_0xe032('0x41')](_0x1e54d3[_0xe032('0x31')]);}else if(this['channels'][_0x1e54d3[_0xe032('0x42')]]&&_[_0xe032('0x3f')](this[_0xe032('0x8')][_0x1e54d3[_0xe032('0x42')]][_0xe032('0x25')])){logger[_0xe032('0x23')](_0xe032('0x43'),_0x1e54d3[_0xe032('0x42')]);this[_0xe032('0x41')](_0x1e54d3[_0xe032('0x42')]);}}catch(_0x3a0253){logger[_0xe032('0x33')](_0xe032('0x44'),_0x3a0253[_0xe032('0x36')]);}};Acw['prototype'][_0xe032('0xf')]=function(_0x53c8b2){try{if(this[_0xe032('0x8')][_0x53c8b2[_0xe032('0x31')]]&&this[_0xe032('0x8')][_0x53c8b2[_0xe032('0x31')]][_0xe032('0x25')]){logger[_0xe032('0x23')](_0xe032('0x45'),_0x53c8b2[_0xe032('0x31')]);this[_0xe032('0x41')](_0x53c8b2[_0xe032('0x31')]);}else if(this[_0xe032('0x8')][_0x53c8b2['linkedid']]&&this[_0xe032('0x8')][_0x53c8b2[_0xe032('0x42')]]['attended']){logger[_0xe032('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x53c8b2[_0xe032('0x42')]);this[_0xe032('0x41')](_0x53c8b2[_0xe032('0x42')]);}}catch(_0x414243){logger[_0xe032('0x33')]('[ACW][syncHangup]\x20%s',_0x414243[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0x13')]=function(_0x21a32f){try{if(!_[_0xe032('0x46')](this[_0xe032('0x8')][_0x21a32f[_0xe032('0x47')]])){this['startAcw'](_0x21a32f[_0xe032('0x47')]);if(this[_0xe032('0x8')][_0x21a32f[_0xe032('0x48')]]){this[_0xe032('0x8')][_0x21a32f[_0xe032('0x48')]][_0xe032('0x25')]=!![];this[_0xe032('0x8')][_0x21a32f[_0xe032('0x49')]]=this[_0xe032('0x8')][_0x21a32f['secondtransfereruniqueid']];delete this[_0xe032('0x8')][_0x21a32f[_0xe032('0x48')]];}}else if(!_[_0xe032('0x46')](this['channels'][_0x21a32f[_0xe032('0x49')]])){this[_0xe032('0x41')](_0x21a32f['transfertargetuniqueid']);if(this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]]){this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]][_0xe032('0x25')]=!![];this[_0xe032('0x8')][_0x21a32f[_0xe032('0x47')]]=this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]];delete this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]];}}}catch(_0x505986){logger[_0xe032('0x33')](_0xe032('0x4b'),_0x505986[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0x4c')]=function(_0x4d305b){try{if(this[_0xe032('0x8')][_0x4d305b['transfereruniqueid']]){logger[_0xe032('0x23')](_0xe032('0x4d'),JSON[_0xe032('0x4e')](_0x4d305b[_0xe032('0x4f')]));this[_0xe032('0x41')](_0x4d305b[_0xe032('0x4f')]);}else if(this[_0xe032('0x8')][_0x4d305b[_0xe032('0x50')]]){logger[_0xe032('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x4d305b['transfererlinkedid']));this[_0xe032('0x41')](_0x4d305b[_0xe032('0x50')]);}}catch(_0x889c28){logger[_0xe032('0x33')](_0xe032('0x51'),_0x889c28[_0xe032('0x36')]);}};Acw['prototype'][_0xe032('0x11')]=function(_0x1d66c3){try{if(this[_0xe032('0x5')][_0x1d66c3['queue']]&&this[_0xe032('0x5')][_0x1d66c3['queue']][_0xe032('0x52')]===_0xe032('0x53')){if(this['agents'][_0x1d66c3['interface']]){logger['info'](_0xe032('0x54'),_0x1d66c3['uniqueid'],_0x1d66c3['interface'],_0x1d66c3[_0xe032('0x1c')]);return RpcUser[_0xe032('0x27')](this[_0xe032('0x6')][_0x1d66c3['interface']],_0xe032('0x55'),_0x1d66c3['uniqueid']);}}}catch(_0x2cf342){logger[_0xe032('0x33')](_0xe032('0x56'),_0x2cf342[_0xe032('0x36')]);}};module[_0xe032('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 35fc490..b1c2bde 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 _0xcd3c=['then','actionCoreShowChannels','catch','log','exports','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','port','asterisk','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xcd3c,0x7d));var _0xccd3=function(_0x57a88a,_0x48232f){_0x57a88a=_0x57a88a-0x0;var _0x38ab00=_0xcd3c[_0x57a88a];return _0x38ab00;};'use strict';var Manager=require(_0xccd3('0x0'));var BPromise=require(_0xccd3('0x1'));var moment=require(_0xccd3('0x2'));var util=require(_0xccd3('0x3'));var _=require('lodash');var logger=require(_0xccd3('0x4'))(_0xccd3('0x5'));var config=require(_0xccd3('0x6'));var ami=new Manager(config['asterisk'][_0xccd3('0x7')],config['asterisk']['ip'],config[_0xccd3('0x8')][_0xccd3('0x9')],config[_0xccd3('0x8')][_0xccd3('0xa')],!![]);ami['keepConnected']();ami[_0xccd3('0xb')]=BPromise[_0xccd3('0xc')](ami[_0xccd3('0xd')]);function error(_0x52cd0e){logger[_0xccd3('0xe')](util[_0xccd3('0xf')](_0xccd3('0x10'),config[_0xccd3('0x8')]['username'],config[_0xccd3('0x8')]['ip'],config[_0xccd3('0x8')]['port'],util[_0xccd3('0x11')](_0x52cd0e,![],null)));}function close(){logger['error'](util[_0xccd3('0xf')](_0xccd3('0x12'),config[_0xccd3('0x8')][_0xccd3('0x9')],config[_0xccd3('0x8')]['ip'],config['asterisk'][_0xccd3('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xccd3('0xb')]({'action':_0xccd3('0x13')});};};ami[_0xccd3('0x14')]=function(){return function(){return ami['Action']({'action':_0xccd3('0x15')});};};ami[_0xccd3('0x16')]=function(){return function(){return ami[_0xccd3('0xb')]({'action':_0xccd3('0x17')});};};ami[_0xccd3('0x18')]=function(){return function(){return ami[_0xccd3('0xb')]({'action':_0xccd3('0x19')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xccd3('0xb')]({'action':_0xccd3('0x1a')});};};function connect(_0x412331){logger['info'](util[_0xccd3('0xf')](_0xccd3('0x1b'),config['asterisk']['username'],config[_0xccd3('0x8')]['ip'],config[_0xccd3('0x8')][_0xccd3('0x7')]));ami[_0xccd3('0x1c')](_0xccd3('0xe'),error);ami['once'](_0xccd3('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0xccd3('0x1e'),function(_0x288dcc){logger['info'](util[_0xccd3('0xf')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xccd3('0x8')][_0xccd3('0x9')],config[_0xccd3('0x8')]['ip'],config[_0xccd3('0x8')][_0xccd3('0x7')],util[_0xccd3('0x11')](_0x288dcc,![],null)));});ami['on'](_0xccd3('0x1f'),function(_0x3fd8d3){logger[_0xccd3('0x20')](util['format'](_0xccd3('0x21'),config['asterisk'][_0xccd3('0x9')],config[_0xccd3('0x8')]['ip'],config[_0xccd3('0x8')][_0xccd3('0x7')]));return BPromise[_0xccd3('0x22')]()[_0xccd3('0x23')](ami['actionSipShowRegistry']())[_0xccd3('0x23')](ami[_0xccd3('0x14')]())[_0xccd3('0x23')](ami['actionSipPeerStatus']())[_0xccd3('0x23')](ami[_0xccd3('0x18')]())[_0xccd3('0x23')](ami[_0xccd3('0x24')]())[_0xccd3('0x25')](function(_0x5703d7){console[_0xccd3('0x26')](_0x5703d7);});});ami['once'](_0xccd3('0xe'),error);ami['once'](_0xccd3('0x1d'),close);module[_0xccd3('0x27')]=ami; \ No newline at end of file +var _0x71fb=['actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','log','exports','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','keepConnected','promisify','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','Action','actionSipPeerStatus','sippeerstatus'];(function(_0x40a63b,_0x1c1815){var _0x3bdb16=function(_0x26a0c6){while(--_0x26a0c6){_0x40a63b['push'](_0x40a63b['shift']());}};_0x3bdb16(++_0x1c1815);}(_0x71fb,0x1c1));var _0xb71f=function(_0x55d329,_0x2fb9da){_0x55d329=_0x55d329-0x0;var _0x522e9d=_0x71fb[_0x55d329];return _0x522e9d;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xb71f('0x0'));var moment=require(_0xb71f('0x1'));var util=require(_0xb71f('0x2'));var _=require(_0xb71f('0x3'));var logger=require(_0xb71f('0x4'))('ami');var config=require(_0xb71f('0x5'));var ami=new Manager(config[_0xb71f('0x6')][_0xb71f('0x7')],config['asterisk']['ip'],config[_0xb71f('0x6')][_0xb71f('0x8')],config['asterisk']['password'],!![]);ami[_0xb71f('0x9')]();ami['Action']=BPromise[_0xb71f('0xa')](ami['action']);function error(_0x129a42){logger[_0xb71f('0xb')](util[_0xb71f('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xb71f('0x6')][_0xb71f('0x8')],config[_0xb71f('0x6')]['ip'],config[_0xb71f('0x6')][_0xb71f('0x7')],util['inspect'](_0x129a42,![],null)));}function close(){logger['error'](util[_0xb71f('0xc')](_0xb71f('0xd'),config[_0xb71f('0x6')][_0xb71f('0x8')],config[_0xb71f('0x6')]['ip'],config[_0xb71f('0x6')][_0xb71f('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0xb71f('0xe')});};};ami[_0xb71f('0xf')]=function(){return function(){return ami[_0xb71f('0x10')]({'action':'devicestatelist'});};};ami[_0xb71f('0x11')]=function(){return function(){return ami['Action']({'action':_0xb71f('0x12')});};};ami[_0xb71f('0x13')]=function(){return function(){return ami[_0xb71f('0x10')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xb71f('0x10')]({'action':_0xb71f('0x14')});};};function connect(_0x5bb30b){logger[_0xb71f('0x15')](util[_0xb71f('0xc')](_0xb71f('0x16'),config['asterisk']['username'],config[_0xb71f('0x6')]['ip'],config[_0xb71f('0x6')]['port']));ami[_0xb71f('0x17')](_0xb71f('0xb'),error);ami[_0xb71f('0x17')](_0xb71f('0x18'),close);}ami['on'](_0xb71f('0x19'),connect);ami['on'](_0xb71f('0x1a'),function(_0x2d58e0){logger[_0xb71f('0x15')](util[_0xb71f('0xc')](_0xb71f('0x1b'),config['asterisk']['username'],config[_0xb71f('0x6')]['ip'],config['asterisk'][_0xb71f('0x7')],util['inspect'](_0x2d58e0,![],null)));});ami['on'](_0xb71f('0x1c'),function(_0x2731a9){logger[_0xb71f('0x15')](util[_0xb71f('0xc')](_0xb71f('0x1d'),config['asterisk'][_0xb71f('0x8')],config['asterisk']['ip'],config[_0xb71f('0x6')]['port']));return BPromise[_0xb71f('0x1e')]()['then'](ami['actionSipShowRegistry']())[_0xb71f('0x1f')](ami[_0xb71f('0xf')]())[_0xb71f('0x1f')](ami[_0xb71f('0x11')]())['then'](ami[_0xb71f('0x13')]())['then'](ami[_0xb71f('0x20')]())[_0xb71f('0x21')](function(_0x527e77){console[_0xb71f('0x22')](_0x527e77);});});ami['once'](_0xb71f('0xb'),error);ami[_0xb71f('0x17')](_0xb71f('0x18'),close);module[_0xb71f('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 4f4f631..99149d6 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 _0x92b1=['memberReport','message','result','exports','jayson/promise','bluebird','../../config/logger','http','Request','request','then','debug','rpc','error'];(function(_0x388587,_0x6a00fe){var _0x1ed0c4=function(_0x3d7f78){while(--_0x3d7f78){_0x388587['push'](_0x388587['shift']());}};_0x1ed0c4(++_0x6a00fe);}(_0x92b1,0x162));var _0x192b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x92b1[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0x192b('0x0'));var BPromise=require(_0x192b('0x1'));var logger=require(_0x192b('0x2'))('ami');var client=jayson['client'][_0x192b('0x3')]({'port':0x2329});client[_0x192b('0x4')]=function(_0x14d865,_0xb27b85){return new BPromise(function(_0x1e6588,_0x2397a2){return client[_0x192b('0x5')](_0x14d865,_0xb27b85)[_0x192b('0x6')](function(_0x2698d){logger[_0x192b('0x7')](_0x192b('0x8'),'memberReport',_0x14d865,_0xb27b85,_0x2698d);if(_0x2698d[_0x192b('0x9')]){logger[_0x192b('0x9')](_0x192b('0x8'),_0x192b('0xa'),_0x14d865,_0x2698d[_0x192b('0x9')][_0x192b('0xb')],_0xb27b85);return _0x2397a2(_0x2698d[_0x192b('0x9')][_0x192b('0xb')]);}else{return _0x1e6588(_0x2698d[_0x192b('0xc')]);}})['catch'](function(_0x16c3b2){logger[_0x192b('0x9')]('rpc','memberReport',_0x14d865,_0x16c3b2,_0xb27b85);return _0x2397a2(_0x16c3b2);});});};module[_0x192b('0xd')]=client; \ No newline at end of file +var _0x9acf=['result','exports','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','then','memberReport','rpc','error'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x9acf,0x13a));var _0xf9ac=function(_0x3666e0,_0x5abe33){_0x3666e0=_0x3666e0-0x0;var _0x5e3efd=_0x9acf[_0x3666e0];return _0x5e3efd;};'use strict';var jayson=require(_0xf9ac('0x0'));var BPromise=require(_0xf9ac('0x1'));var logger=require(_0xf9ac('0x2'))(_0xf9ac('0x3'));var client=jayson[_0xf9ac('0x4')][_0xf9ac('0x5')]({'port':0x2329});client[_0xf9ac('0x6')]=function(_0x5d276b,_0x11e233){return new BPromise(function(_0x2a94e1,_0x43d48e){return client['request'](_0x5d276b,_0x11e233)[_0xf9ac('0x7')](function(_0x433094){logger['debug']('rpc',_0xf9ac('0x8'),_0x5d276b,_0x11e233,_0x433094);if(_0x433094['error']){logger['error'](_0xf9ac('0x9'),'memberReport',_0x5d276b,_0x433094[_0xf9ac('0xa')]['message'],_0x11e233);return _0x43d48e(_0x433094[_0xf9ac('0xa')]['message']);}else{return _0x2a94e1(_0x433094[_0xf9ac('0xb')]);}})['catch'](function(_0x401b01){logger[_0xf9ac('0xa')]('rpc',_0xf9ac('0x8'),_0x5d276b,_0x401b01,_0x11e233);return _0x43d48e(_0x401b01);});});};module[_0xf9ac('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9366393..e34cf49 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 _0x8692=['lodash','isNil','string','uniqueid','Contact','phone','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','number','substring','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8692,0xb9));var _0x2869=function(_0x18eaeb,_0x54a198){_0x18eaeb=_0x18eaeb-0x0;var _0x16660d=_0x8692[_0x18eaeb];return _0x16660d;};'use strict';var util=require('util');var _=require(_0x2869('0x0'));var moment=require('moment');function checkNameSurname(_0x361e09,_0x6944df,_0x1bc0d4){var _0x10977f='';if(!_[_0x2869('0x1')](_0x6944df)&&_0x2869('0x2')===typeof _0x6944df){_0x10977f+=_0x6944df;}if(!_[_0x2869('0x1')](_0x1bc0d4)&&_0x2869('0x2')===typeof _0x1bc0d4){_0x10977f+='\x20'+_0x1bc0d4;}if(_0x10977f!==''){return _0x10977f;}return _0x361e09;}function Action(_0x5c9364,_0x3cd903,_0x2ce441){this['voiceQueue']=_0x5c9364;this[_0x2869('0x3')]=_0x2ce441||undefined;this['name']=checkNameSurname(_0x3cd903[_0x2869('0x4')][_0x2869('0x5')],_0x3cd903[_0x2869('0x4')]['firstName'],_0x3cd903['Contact'][_0x2869('0x6')]);this['number']=_0x3cd903['Contact'][_0x2869('0x5')];this[_0x2869('0x7')]=_0x5c9364[_0x2869('0x8')];this[_0x2869('0x9')]=_0x3cd903[_0x2869('0x9')]||![];this[_0x2869('0xa')]=_0x5c9364[_0x2869('0xa')];this['dialQueueTimeout']=_0x5c9364[_0x2869('0xb')]||0x3;this[_0x2869('0xc')]=_0x3cd903[_0x2869('0xc')];this['countbusyretry']=_0x3cd903[_0x2869('0xd')];this['countcongestionretry']=_0x3cd903['countcongestionretry'];this[_0x2869('0xe')]=_0x3cd903[_0x2869('0xe')];this[_0x2869('0xf')]=_0x3cd903['ContactId'];this[_0x2869('0x10')]=_0x3cd903[_0x2869('0x10')];this['UserId']=_0x3cd903[_0x2869('0x11')];this[_0x2869('0x12')]=_0x3cd903[_0x2869('0x12')];this[_0x2869('0x13')]=_0x3cd903[_0x2869('0x13')];this[_0x2869('0x14')]=_0x3cd903['id'];this['ContactFirstName']=_0x3cd903[_0x2869('0x4')][_0x2869('0x15')]||'';this[_0x2869('0x16')]=moment()[_0x2869('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2869('0x18')]=_0x3cd903['callback'];this[_0x2869('0x19')]=_0x3cd903[_0x2869('0x19')];this[_0x2869('0x1a')]=_0x3cd903['callbackat'];this[_0x2869('0x1b')]=_0x3cd903[_0x2869('0x1b')];this[_0x2869('0x1c')]='';this[_0x2869('0x1d')]='';}Action[_0x2869('0x1e')][_0x2869('0x1f')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0x2869('0x20')][_0x2869('0x21')]>0x0?this[_0x2869('0x22')][_0x2869('0x23')](this['voiceQueue'][_0x2869('0x21')]):this[_0x2869('0x22')]);};Action[_0x2869('0x1e')]['getQueue']=function(){return this[_0x2869('0x7')];};module[_0x2869('0x24')]=Action; \ No newline at end of file +var _0xca74=['callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','substring','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x51d539,_0x40d637){var _0x4ae9bd=function(_0x3887d8){while(--_0x3887d8){_0x51d539['push'](_0x51d539['shift']());}};_0x4ae9bd(++_0x40d637);}(_0xca74,0x170));var _0x4ca7=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0xca74[_0x26e727];return _0x563800;};'use strict';var util=require(_0x4ca7('0x0'));var _=require('lodash');var moment=require(_0x4ca7('0x1'));function checkNameSurname(_0x846d96,_0x2ea8d8,_0x2b2093){var _0x41073a='';if(!_[_0x4ca7('0x2')](_0x2ea8d8)&&_0x4ca7('0x3')===typeof _0x2ea8d8){_0x41073a+=_0x2ea8d8;}if(!_[_0x4ca7('0x2')](_0x2b2093)&&_0x4ca7('0x3')===typeof _0x2b2093){_0x41073a+='\x20'+_0x2b2093;}if(_0x41073a!==''){return _0x41073a;}return _0x846d96;}function Action(_0x3beddb,_0x2e950a,_0xab134){this[_0x4ca7('0x4')]=_0x3beddb;this[_0x4ca7('0x5')]=_0xab134||undefined;this[_0x4ca7('0x6')]=checkNameSurname(_0x2e950a['Contact']['phone'],_0x2e950a[_0x4ca7('0x7')][_0x4ca7('0x8')],_0x2e950a[_0x4ca7('0x7')][_0x4ca7('0x9')]);this['number']=_0x2e950a[_0x4ca7('0x7')][_0x4ca7('0xa')];this['queue']=_0x3beddb[_0x4ca7('0x6')];this[_0x4ca7('0xb')]=_0x2e950a['active']||![];this[_0x4ca7('0xc')]=_0x3beddb[_0x4ca7('0xc')];this['dialQueueTimeout']=_0x3beddb[_0x4ca7('0xd')]||0x3;this[_0x4ca7('0xe')]=_0x2e950a[_0x4ca7('0xe')];this['countbusyretry']=_0x2e950a[_0x4ca7('0xf')];this[_0x4ca7('0x10')]=_0x2e950a[_0x4ca7('0x10')];this[_0x4ca7('0x11')]=_0x2e950a[_0x4ca7('0x11')];this['ContactId']=_0x2e950a[_0x4ca7('0x12')];this[_0x4ca7('0x13')]=_0x2e950a['ListId'];this[_0x4ca7('0x14')]=_0x2e950a['UserId'];this[_0x4ca7('0x15')]=_0x2e950a[_0x4ca7('0x15')];this[_0x4ca7('0x16')]=_0x2e950a['CampaignId'];this[_0x4ca7('0x17')]=_0x2e950a['id'];this[_0x4ca7('0x18')]=_0x2e950a[_0x4ca7('0x7')][_0x4ca7('0x8')]||'';this['starttime']=moment()[_0x4ca7('0x19')](_0x4ca7('0x1a'));this[_0x4ca7('0x1b')]=_0x2e950a[_0x4ca7('0x1b')];this['callbackuniqueid']=_0x2e950a['callbackuniqueid'];this[_0x4ca7('0x1c')]=_0x2e950a['callbackat'];this['recallme']=_0x2e950a['recallme'];this[_0x4ca7('0x1d')]='';this[_0x4ca7('0x1e')]='';}Action[_0x4ca7('0x1f')][_0x4ca7('0x20')]=function(){return util[_0x4ca7('0x19')](_0x4ca7('0x21'),this[_0x4ca7('0x6')],this[_0x4ca7('0x4')]['dialCutDigit']>0x0?this[_0x4ca7('0x22')][_0x4ca7('0x23')](this['voiceQueue']['dialCutDigit']):this[_0x4ca7('0x22')]);};Action[_0x4ca7('0x1f')]['getQueue']=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index f74d6a0..de8d0fa 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 _0xc49f=['exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xc49f,0x1af));var _0xfc49=function(_0x212904,_0xf909b){_0x212904=_0x212904-0x0;var _0xb4b800=_0xc49f[_0x212904];return _0xb4b800;};'use strict';var util=require(_0xfc49('0x0'));var _=require(_0xfc49('0x1'));var moment=require(_0xfc49('0x2'));function getSeconds(_0x515a7a,_0x2ed081){var _0x130f87=moment(_0x515a7a)[_0xfc49('0x3')](0x0);var _0x26dbfb=moment(_0x2ed081)[_0xfc49('0x3')](0x0);return _0x130f87[_0xfc49('0x4')](_0x26dbfb,'seconds');}function AgentComplete(_0x1055d4,_0x4c0a77){this[_0xfc49('0x5')]=0x4;this[_0xfc49('0x6')]='Answer';this[_0xfc49('0x7')]=_0x1055d4[_0xfc49('0x7')];this[_0xfc49('0x8')]=_0x1055d4['type'];this[_0xfc49('0x9')]=_0x1055d4[_0xfc49('0x8')]===_0xfc49('0xa')?_0xfc49('0xb'):_0x1055d4[_0xfc49('0x8')];this[_0xfc49('0xc')]=_0x1055d4[_0xfc49('0xc')];this['countcongestionretry']=_0x1055d4[_0xfc49('0xd')];this['countnoanswerretry']=_0x1055d4[_0xfc49('0xe')];this[_0xfc49('0xf')]=_0x1055d4[_0xfc49('0xc')]+_0x1055d4['countcongestionretry']+_0x1055d4[_0xfc49('0xe')];this[_0xfc49('0x10')]=_0x4c0a77[_0xfc49('0x10')];this[_0xfc49('0x11')]=_0x1055d4[_0xfc49('0x12')];this[_0xfc49('0x13')]=_0x1055d4[_0xfc49('0x14')];this[_0xfc49('0x15')]=_0x1055d4[_0xfc49('0x15')];this[_0xfc49('0x16')]=_0x1055d4['responsetime'];this[_0xfc49('0x17')]=_0x1055d4[_0xfc49('0x17')];this[_0xfc49('0x18')]=moment()[_0xfc49('0x19')](_0xfc49('0x1a'));this[_0xfc49('0x1b')]=getSeconds(_0x1055d4[_0xfc49('0x16')],_0x1055d4['starttime']);this[_0xfc49('0x1c')]=getSeconds(_0x1055d4[_0xfc49('0x17')],_0x1055d4[_0xfc49('0x16')]);this[_0xfc49('0x1d')]=getSeconds(this['endtime'],_0x1055d4[_0xfc49('0x17')]);this['queue']=_0x4c0a77[_0xfc49('0xb')];this['membername']=_0x4c0a77[_0xfc49('0x1e')];this[_0xfc49('0x1f')]=_0x4c0a77[_0xfc49('0x1f')];this['callback']=_0x1055d4['callback'];this[_0xfc49('0x20')]=_0x1055d4[_0xfc49('0x20')];this[_0xfc49('0x21')]=_0x1055d4['callbackat'];this[_0xfc49('0x22')]=_0x1055d4['recallme'];this[_0xfc49('0x23')]=_0x1055d4[_0xfc49('0x23')];this['ListId']=_0x1055d4[_0xfc49('0x24')];this[_0xfc49('0x25')]=_0x1055d4[_0xfc49('0x25')];this[_0xfc49('0x26')]=_0x1055d4[_0xfc49('0x26')];this['CampaignId']=_0x1055d4[_0xfc49('0x27')];this[_0xfc49('0x28')]=_0x1055d4['originatecalleridnum']||'';this['originatecalleridname']=_0x1055d4[_0xfc49('0x29')]||'';}module[_0xfc49('0x2a')]=AgentComplete; \ No newline at end of file +var _0xf6c6=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x532a06,_0x12f61c){var _0x3c92dd=function(_0x102839){while(--_0x102839){_0x532a06['push'](_0x532a06['shift']());}};_0x3c92dd(++_0x12f61c);}(_0xf6c6,0x7f));var _0x6f6c=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xf6c6[_0xfa634c];return _0x73e478;};'use strict';var util=require(_0x6f6c('0x0'));var _=require(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));function getSeconds(_0x57e4d3,_0x4dbc60){var _0xd7f2e=moment(_0x57e4d3)[_0x6f6c('0x3')](0x0);var _0x20bb98=moment(_0x4dbc60)['milliseconds'](0x0);return _0xd7f2e[_0x6f6c('0x4')](_0x20bb98,_0x6f6c('0x5'));}function AgentComplete(_0x701e86,_0x158e1f){this[_0x6f6c('0x6')]=0x4;this['statedesc']='Answer';this[_0x6f6c('0x7')]=_0x701e86['scheduledat'];this[_0x6f6c('0x8')]=_0x701e86[_0x6f6c('0x8')];this[_0x6f6c('0x9')]=_0x701e86[_0x6f6c('0x8')]===_0x6f6c('0xa')?_0x6f6c('0xb'):_0x701e86[_0x6f6c('0x8')];this[_0x6f6c('0xc')]=_0x701e86['countbusyretry'];this[_0x6f6c('0xd')]=_0x701e86[_0x6f6c('0xd')];this[_0x6f6c('0xe')]=_0x701e86['countnoanswerretry'];this[_0x6f6c('0xf')]=_0x701e86[_0x6f6c('0xc')]+_0x701e86['countcongestionretry']+_0x701e86[_0x6f6c('0xe')];this[_0x6f6c('0x10')]=_0x158e1f['uniqueid'];this['calleridname']=_0x701e86[_0x6f6c('0x11')];this[_0x6f6c('0x12')]=_0x701e86[_0x6f6c('0x13')];this[_0x6f6c('0x14')]=_0x701e86[_0x6f6c('0x14')];this[_0x6f6c('0x15')]=_0x701e86[_0x6f6c('0x15')];this['answertime']=_0x701e86[_0x6f6c('0x16')];this[_0x6f6c('0x17')]=moment()[_0x6f6c('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6f6c('0x19')]=getSeconds(_0x701e86['responsetime'],_0x701e86['starttime']);this['holdtime']=getSeconds(_0x701e86['answertime'],_0x701e86[_0x6f6c('0x15')]);this[_0x6f6c('0x1a')]=getSeconds(this[_0x6f6c('0x17')],_0x701e86[_0x6f6c('0x16')]);this[_0x6f6c('0xb')]=_0x158e1f['queue'];this[_0x6f6c('0x1b')]=_0x158e1f[_0x6f6c('0x1b')];this['reason']=_0x158e1f[_0x6f6c('0x1c')];this[_0x6f6c('0x1d')]=_0x701e86[_0x6f6c('0x1d')];this[_0x6f6c('0x1e')]=_0x701e86[_0x6f6c('0x1e')];this[_0x6f6c('0x1f')]=_0x701e86[_0x6f6c('0x1f')];this[_0x6f6c('0x20')]=_0x701e86[_0x6f6c('0x20')];this[_0x6f6c('0x21')]=_0x701e86[_0x6f6c('0x21')];this[_0x6f6c('0x22')]=_0x701e86[_0x6f6c('0x22')];this[_0x6f6c('0x23')]=_0x701e86[_0x6f6c('0x23')];this['VoiceQueueId']=_0x701e86[_0x6f6c('0x24')];this[_0x6f6c('0x25')]=_0x701e86[_0x6f6c('0x25')];this['originatecalleridnum']=_0x701e86[_0x6f6c('0x26')]||'';this['originatecalleridname']=_0x701e86[_0x6f6c('0x27')]||'';}module[_0x6f6c('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e0d031e..52516d5 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 _0x1115=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff'];(function(_0x2399bc,_0x475e0d){var _0x3f230a=function(_0x17f6d3){while(--_0x17f6d3){_0x2399bc['push'](_0x2399bc['shift']());}};_0x3f230a(++_0x475e0d);}(_0x1115,0x1b6));var _0x5111=function(_0x55bfde,_0x1ba125){_0x55bfde=_0x55bfde-0x0;var _0x176fcb=_0x1115[_0x55bfde];return _0x176fcb;};'use strict';var util=require('util');var _=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));function getSeconds(_0x352000,_0x20e2ee){var _0x39a422=moment(_0x352000)[_0x5111('0x2')](0x0);var _0x301d43=moment(_0x20e2ee)[_0x5111('0x2')](0x0);return _0x39a422[_0x5111('0x3')](_0x301d43,'seconds');}function Final(_0x5981cb){this[_0x5111('0x4')]=_0x5981cb[_0x5111('0x4')];this['scheduledat']=_0x5981cb[_0x5111('0x5')];this[_0x5111('0x6')]=_0x5981cb['type'];this[_0x5111('0x7')]=_0x5981cb['type']===_0x5111('0x8')?_0x5111('0x9'):_0x5981cb['type'];this['countbusyretry']=_0x5981cb[_0x5111('0xa')];this['countcongestionretry']=_0x5981cb[_0x5111('0xb')];this['countnoanswerretry']=_0x5981cb[_0x5111('0xc')];this[_0x5111('0xd')]=_0x5981cb[_0x5111('0xa')]+_0x5981cb[_0x5111('0xb')]+_0x5981cb[_0x5111('0xc')];this[_0x5111('0x9')]=_0x5981cb[_0x5111('0x9')];this[_0x5111('0xe')]=_0x5981cb[_0x5111('0xe')];this[_0x5111('0xf')]=_0x5981cb[_0x5111('0xf')];this[_0x5111('0x10')]=_0x5981cb[_0x5111('0x10')];this[_0x5111('0x11')]=_0x5981cb[_0x5111('0x11')];this[_0x5111('0x12')]=_0x5981cb[_0x5111('0x11')];this[_0x5111('0x13')]=_0x5981cb['ringtime']||0x0;this[_0x5111('0x14')]=_0x5981cb['holdtime']||0x0;this['talktime']=_0x5981cb[_0x5111('0x15')]||0x0;this[_0x5111('0x16')]=_0x5981cb[_0x5111('0x16')];this['callbackuniqueid']=_0x5981cb[_0x5111('0x17')];this[_0x5111('0x18')]=_0x5981cb['callbackat'];this[_0x5111('0x19')]=_0x5981cb[_0x5111('0x19')];this[_0x5111('0x1a')]=_0x5981cb[_0x5111('0x1a')];this['ListId']=_0x5981cb[_0x5111('0x1b')];this[_0x5111('0x1c')]=_0x5981cb[_0x5111('0x1c')];this[_0x5111('0x1d')]=_0x5981cb[_0x5111('0x1d')];this[_0x5111('0x1e')]=_0x5981cb[_0x5111('0x1e')];this[_0x5111('0x1f')]=_0x5981cb[_0x5111('0x1f')]||'';this[_0x5111('0x20')]=_0x5981cb['originatecalleridname']||'';}module[_0x5111('0x21')]=Final; \ No newline at end of file +var _0x80e0=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','calleridname','calleridnum','endtime','responsetime','holdtime','talktime'];(function(_0x3ccffa,_0x453973){var _0x5c7f83=function(_0x5d4321){while(--_0x5d4321){_0x3ccffa['push'](_0x3ccffa['shift']());}};_0x5c7f83(++_0x453973);}(_0x80e0,0x9d));var _0x080e=function(_0x3cbdf6,_0x31b9f2){_0x3cbdf6=_0x3cbdf6-0x0;var _0x579447=_0x80e0[_0x3cbdf6];return _0x579447;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x080e('0x0'));function getSeconds(_0x29c84f,_0x43e383){var _0x4c3ef9=moment(_0x29c84f)[_0x080e('0x1')](0x0);var _0x1a85e2=moment(_0x43e383)[_0x080e('0x1')](0x0);return _0x4c3ef9['diff'](_0x1a85e2,_0x080e('0x2'));}function Final(_0x1bbe6a){this[_0x080e('0x3')]=_0x1bbe6a['uniqueid'];this['scheduledat']=_0x1bbe6a['scheduledat'];this[_0x080e('0x4')]=_0x1bbe6a['type'];this[_0x080e('0x5')]=_0x1bbe6a['type']===_0x080e('0x6')?_0x080e('0x7'):_0x1bbe6a[_0x080e('0x4')];this[_0x080e('0x8')]=_0x1bbe6a[_0x080e('0x8')];this['countcongestionretry']=_0x1bbe6a['countcongestionretry'];this[_0x080e('0x9')]=_0x1bbe6a[_0x080e('0x9')];this[_0x080e('0xa')]=_0x1bbe6a[_0x080e('0x8')]+_0x1bbe6a['countcongestionretry']+_0x1bbe6a['countnoanswerretry'];this[_0x080e('0x7')]=_0x1bbe6a[_0x080e('0x7')];this[_0x080e('0xb')]=_0x1bbe6a['calleridname'];this[_0x080e('0xc')]=_0x1bbe6a[_0x080e('0xc')];this['starttime']=_0x1bbe6a['starttime'];this['responsetime']=_0x1bbe6a['responsetime'];this[_0x080e('0xd')]=_0x1bbe6a[_0x080e('0xe')];this['ringtime']=_0x1bbe6a['ringtime']||0x0;this[_0x080e('0xf')]=_0x1bbe6a['holdtime']||0x0;this['talktime']=_0x1bbe6a[_0x080e('0x10')]||0x0;this['callback']=_0x1bbe6a[_0x080e('0x11')];this[_0x080e('0x12')]=_0x1bbe6a[_0x080e('0x12')];this[_0x080e('0x13')]=_0x1bbe6a['callbackat'];this[_0x080e('0x14')]=_0x1bbe6a[_0x080e('0x14')];this[_0x080e('0x15')]=_0x1bbe6a['ContactId'];this[_0x080e('0x16')]=_0x1bbe6a[_0x080e('0x16')];this[_0x080e('0x17')]=_0x1bbe6a['UserId'];this[_0x080e('0x18')]=_0x1bbe6a[_0x080e('0x18')];this[_0x080e('0x19')]=_0x1bbe6a['CampaignId'];this[_0x080e('0x1a')]=_0x1bbe6a['originatecalleridnum']||'';this[_0x080e('0x1b')]=_0x1bbe6a[_0x080e('0x1b')]||'';}module[_0x080e('0x1c')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 34a2f30..2fe9af6 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 _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file +var _0x9957=['state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x347eb2,_0x35bea1){var _0x439d89=function(_0x459db7){while(--_0x459db7){_0x347eb2['push'](_0x347eb2['shift']());}};_0x439d89(++_0x35bea1);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));function getSeconds(_0x10a05d,_0x5b96eb){var _0x86c128=moment(_0x10a05d)[_0x7995('0x3')](0x0);var _0x1902b4=moment(_0x5b96eb)[_0x7995('0x3')](0x0);return _0x86c128['diff'](_0x1902b4,_0x7995('0x4'));}function Hangup(_0x1a36d8,_0x137b6b){this[_0x7995('0x5')]=0x4;this[_0x7995('0x6')]=_0x7995('0x7');this['scheduledat']=_0x1a36d8[_0x7995('0x8')];this[_0x7995('0x9')]=_0x1a36d8['type'];this[_0x7995('0xa')]=_0x1a36d8[_0x7995('0x9')]===_0x7995('0xb')?_0x7995('0xc'):_0x1a36d8[_0x7995('0x9')];this[_0x7995('0xd')]=_0x1a36d8[_0x7995('0xd')];this['countcongestionretry']=_0x1a36d8[_0x7995('0xe')];this[_0x7995('0xf')]=_0x1a36d8['countnoanswerretry'];this[_0x7995('0x10')]=_0x1a36d8[_0x7995('0xd')]+_0x1a36d8[_0x7995('0xe')]+_0x1a36d8[_0x7995('0xf')];this[_0x7995('0x11')]=_0x137b6b[_0x7995('0x11')];this[_0x7995('0x12')]=_0x1a36d8['name'];this['calleridnum']=_0x1a36d8[_0x7995('0x13')];this[_0x7995('0x14')]=_0x1a36d8[_0x7995('0x14')];this[_0x7995('0x15')]=_0x1a36d8[_0x7995('0x15')];this[_0x7995('0x16')]=moment()[_0x7995('0x17')](_0x7995('0x18'));this['ringtime']=getSeconds(_0x1a36d8[_0x7995('0x15')],_0x1a36d8['starttime']);this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=getSeconds(this[_0x7995('0x16')],_0x1a36d8[_0x7995('0x15')]);this[_0x7995('0xc')]=_0x1a36d8[_0x7995('0xc')];this['membername']='IVR';this[_0x7995('0x1b')]=_0x137b6b['cause-txt'];this['callback']=_0x1a36d8[_0x7995('0x1c')];this[_0x7995('0x1d')]=_0x1a36d8['callbackuniqueid'];this[_0x7995('0x1e')]=_0x1a36d8['callbackat'];this['recallme']=_0x1a36d8[_0x7995('0x1f')];this[_0x7995('0x20')]=_0x1a36d8[_0x7995('0x20')];this[_0x7995('0x21')]=_0x1a36d8[_0x7995('0x21')];this[_0x7995('0x22')]=_0x1a36d8['UserId'];this[_0x7995('0x23')]=_0x1a36d8[_0x7995('0x23')];this[_0x7995('0x24')]=_0x1a36d8[_0x7995('0x24')];}module[_0x7995('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 2318eb8..4a1d430 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 _0x17ac=['originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','campaigntype','queue','type','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x17ac,0x18f));var _0xc17a=function(_0x6667df,_0x50a27e){_0x6667df=_0x6667df-0x0;var _0x289bc0=_0x17ac[_0x6667df];return _0x289bc0;};'use strict';var util=require('util');var _=require(_0xc17a('0x0'));var moment=require(_0xc17a('0x1'));function getSeconds(_0x4352b6,_0x41a2ea){var _0x30bb50=moment(_0x4352b6)[_0xc17a('0x2')](0x0);var _0xa518ef=moment(_0x41a2ea)[_0xc17a('0x2')](0x0);return _0x30bb50[_0xc17a('0x3')](_0xa518ef,'seconds');}function History(_0x3c2de3){this['uniqueid']=_0x3c2de3['uniqueid'];this[_0xc17a('0x4')]=_0x3c2de3[_0xc17a('0x4')]||undefined;this['type']=_0x3c2de3['type'];this[_0xc17a('0x5')]=_0x3c2de3['type']==='outbound'?_0xc17a('0x6'):_0x3c2de3[_0xc17a('0x7')];this[_0xc17a('0x8')]=_0x3c2de3[_0xc17a('0x8')];this[_0xc17a('0x9')]=_0x3c2de3[_0xc17a('0x9')];this['countnoanswerretry']=_0x3c2de3['countnoanswerretry'];this[_0xc17a('0xa')]=_0x3c2de3[_0xc17a('0x8')]+_0x3c2de3['countcongestionretry']+_0x3c2de3[_0xc17a('0xb')];this['queue']=_0x3c2de3['queue'];this[_0xc17a('0xc')]=_0x3c2de3[_0xc17a('0xd')];this[_0xc17a('0xe')]=_0x3c2de3[_0xc17a('0xf')];this['starttime']=_0x3c2de3[_0xc17a('0x10')];this[_0xc17a('0x11')]=_0x3c2de3[_0xc17a('0x11')];this[_0xc17a('0x12')]=_0x3c2de3['responsetime'];this[_0xc17a('0x13')]=getSeconds(_0x3c2de3[_0xc17a('0x11')],_0x3c2de3['starttime']);this['holdtime']=0x0;this[_0xc17a('0x14')]=0x0;this[_0xc17a('0x15')]=_0x3c2de3[_0xc17a('0x15')];this[_0xc17a('0x16')]=_0x3c2de3[_0xc17a('0x16')];this[_0xc17a('0x17')]=_0x3c2de3[_0xc17a('0x17')];this['recallme']=_0x3c2de3[_0xc17a('0x18')];this[_0xc17a('0x19')]=_0x3c2de3['ContactId'];this[_0xc17a('0x1a')]=_0x3c2de3[_0xc17a('0x1a')];this[_0xc17a('0x1b')]=_0x3c2de3[_0xc17a('0x1b')];this[_0xc17a('0x1c')]=_0x3c2de3[_0xc17a('0x1c')];this[_0xc17a('0x1d')]=_0x3c2de3['CampaignId'];this['originatecalleridnum']=_0x3c2de3[_0xc17a('0x1e')]||'';this['originatecalleridname']=_0x3c2de3[_0xc17a('0x1f')]||'';}module[_0xc17a('0x20')]=History; \ No newline at end of file +var _0x9221=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue'];(function(_0x3c5aa6,_0x4c4f86){var _0x49e397=function(_0x37004d){while(--_0x37004d){_0x3c5aa6['push'](_0x3c5aa6['shift']());}};_0x49e397(++_0x4c4f86);}(_0x9221,0x128));var _0x1922=function(_0x203451,_0x36cdd9){_0x203451=_0x203451-0x0;var _0x23dc34=_0x9221[_0x203451];return _0x23dc34;};'use strict';var util=require(_0x1922('0x0'));var _=require('lodash');var moment=require(_0x1922('0x1'));function getSeconds(_0x3099e9,_0x432c28){var _0xdfa4a4=moment(_0x3099e9)[_0x1922('0x2')](0x0);var _0x344cd0=moment(_0x432c28)['milliseconds'](0x0);return _0xdfa4a4[_0x1922('0x3')](_0x344cd0,_0x1922('0x4'));}function History(_0x5cd920){this['uniqueid']=_0x5cd920['uniqueid'];this['scheduledat']=_0x5cd920[_0x1922('0x5')]||undefined;this[_0x1922('0x6')]=_0x5cd920[_0x1922('0x6')];this[_0x1922('0x7')]=_0x5cd920[_0x1922('0x6')]===_0x1922('0x8')?_0x1922('0x9'):_0x5cd920['type'];this['countbusyretry']=_0x5cd920['countbusyretry'];this[_0x1922('0xa')]=_0x5cd920[_0x1922('0xa')];this[_0x1922('0xb')]=_0x5cd920[_0x1922('0xb')];this[_0x1922('0xc')]=_0x5cd920[_0x1922('0xd')]+_0x5cd920['countcongestionretry']+_0x5cd920['countnoanswerretry'];this[_0x1922('0x9')]=_0x5cd920[_0x1922('0x9')];this['calleridname']=_0x5cd920[_0x1922('0xe')];this[_0x1922('0xf')]=_0x5cd920['number'];this[_0x1922('0x10')]=_0x5cd920[_0x1922('0x10')];this[_0x1922('0x11')]=_0x5cd920[_0x1922('0x11')];this[_0x1922('0x12')]=_0x5cd920[_0x1922('0x11')];this[_0x1922('0x13')]=getSeconds(_0x5cd920[_0x1922('0x11')],_0x5cd920[_0x1922('0x10')]);this[_0x1922('0x14')]=0x0;this[_0x1922('0x15')]=0x0;this['callback']=_0x5cd920[_0x1922('0x16')];this[_0x1922('0x17')]=_0x5cd920[_0x1922('0x17')];this[_0x1922('0x18')]=_0x5cd920['callbackat'];this[_0x1922('0x19')]=_0x5cd920[_0x1922('0x19')];this['ContactId']=_0x5cd920[_0x1922('0x1a')];this[_0x1922('0x1b')]=_0x5cd920[_0x1922('0x1b')];this[_0x1922('0x1c')]=_0x5cd920['UserId'];this['VoiceQueueId']=_0x5cd920[_0x1922('0x1d')];this[_0x1922('0x1e')]=_0x5cd920['CampaignId'];this[_0x1922('0x1f')]=_0x5cd920[_0x1922('0x1f')]||'';this['originatecalleridname']=_0x5cd920[_0x1922('0x20')]||'';}module[_0x1922('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index aeb54b7..5c69cc7 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 _0xb45a=['value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','Abandoned','queueCallerAbandonCreateState','syncQueueMember','actionid','roundrobin','locked','paused','stateinterface','queueBooked','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[booked][RR][finaly]','ContactId','CampaignId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','dialActive','dialTimezone','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','dialOriginateCallerIdNumber','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','starttime','endtime','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','dialGlobalMaxRetry','countnoanswerretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','minutes','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','reason','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','outboundNoAnswerCallsDay','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','countglobal','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','floor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallInQueue','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','ACTIVE','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','emit','type','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','diff','seconds','startProgressive','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','[uniqueid]','clearZombieChannels','[actions]','enqueue','isNil','Action','status','channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','catch','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ListId','UserId','VoiceQueueId','[emptyContact]','Success','isTrunkReachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive'];(function(_0xdd0fc0,_0x2d9f83){var _0x165635=function(_0x3b9545){while(--_0x3b9545){_0xdd0fc0['push'](_0xdd0fc0['shift']());}};_0x165635(++_0x2d9f83);}(_0xb45a,0x11c));var _0xab45=function(_0x97d6d5,_0x4453e7){_0x97d6d5=_0x97d6d5-0x0;var _0x3baaa2=_0xb45a[_0x97d6d5];return _0x3baaa2;};'use strict';var util=require(_0xab45('0x0'));var _=require(_0xab45('0x1'));var BPromise=require(_0xab45('0x2'));var uuid=require(_0xab45('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xab45('0x4'));var Redis=require('ioredis');var config=require(_0xab45('0x5'));var logger=require(_0xab45('0x6'))('dialer');var loggerBooked=require(_0xab45('0x6'))(_0xab45('0x7'));var loggerPredictive=require(_0xab45('0x6'))(_0xab45('0x8'));var loggerPredictiveCalls=require(_0xab45('0x6'))(_0xab45('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xab45('0xa'));var ami=require('../ami');config['redis']=_['defaults'](config[_0xab45('0xb')],{'host':_0xab45('0xc'),'port':0x18eb});var io=require(_0xab45('0xd'))(new Redis(config['redis']));var cmHopper=require(_0xab45('0xe'));var cmHopperFinal=require(_0xab45('0xf'));var cmHopperHistory=require(_0xab45('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xab45('0x11'));var Action=require(_0xab45('0x12'));var History=require(_0xab45('0x13'));var Final=require(_0xab45('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xab45('0x15'));var Hangup=require(_0xab45('0x16'));var ipAgi=process[_0xab45('0x17')][_0xab45('0x18')]||_0xab45('0x19');var strategy={'rrmemory':_0xab45('0x1a'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xab45('0x1b')]['enqueue']=function(_0x2ad0f1){this[_0xab45('0x1c')]=this[_0xab45('0x1c')]?this[_0xab45('0x1c')][_0xab45('0x1d')](_0x2ad0f1):_0x2ad0f1();};function Dialer(_0x282e40,_0xcc3e8f){this[_0xab45('0x1e')]=new Sequence();this['preview']=_0xcc3e8f;this[_0xab45('0x1f')]=_0x282e40[_0xab45('0x1f')];this[_0xab45('0x20')]=_0x282e40[_0xab45('0x20')];this[_0xab45('0x21')]=_0x282e40['agents'];this[_0xab45('0x22')]=_0x282e40['trunks'];this[_0xab45('0x23')]=config[_0xab45('0x23')]||0x2;this[_0xab45('0x24')]={};this[_0xab45('0x25')]={};this['contactsId']={};this[_0xab45('0x26')]={};this[_0xab45('0x27')]={};this[_0xab45('0x28')]={};this['startProgressive']={};this[_0xab45('0x29')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0xab45('0x2a'),this['syncAgentConnect'][_0xab45('0x2b')](this));ami['on'](_0xab45('0x2c'),this[_0xab45('0x2d')][_0xab45('0x2b')](this));ami['on'](_0xab45('0x2e'),this[_0xab45('0x2f')][_0xab45('0x2b')](this));ami['on']('agentcomplete',this[_0xab45('0x30')][_0xab45('0x2b')](this));ami['on'](_0xab45('0x31'),this[_0xab45('0xa')][_0xab45('0x2b')](this));ami['on'](_0xab45('0x32'),this[_0xab45('0x33')][_0xab45('0x2b')](this));ami['on']('newexten',this[_0xab45('0x34')][_0xab45('0x2b')](this));ami['on'](_0xab45('0x35'),this['syncVarSet'][_0xab45('0x2b')](this));ami['on']('queuemember',this['syncQueueMember'][_0xab45('0x2b')](this));ami['on'](_0xab45('0x36'),this[_0xab45('0x37')][_0xab45('0x2b')](this));this[_0xab45('0x38')]();this[_0xab45('0x39')]();}function isNotNull(_0x4a7537){return _0x4a7537!==null&&!_['isUndefined'](_0x4a7537);}function checkIsLoggedIn(_0x17c0f7,_0x1ae515){return function(){if(_0x1ae515<=0x0){_0x17c0f7[_0xab45('0x3a')]=_0xab45('0x3b');throw _0x17c0f7[_0xab45('0x3c')]+_0xab45('0x3d');}};}function isActive(_0x5b8568){return _0x5b8568;}function checkIsActive(_0xb3d09c,_0x351a51){return function(){if(!isActive(_0x351a51)){_0xb3d09c['message']=_0xab45('0x3e');throw _0xb3d09c[_0xab45('0x3c')]+'\x20NOT\x20Active';}};}function checkInterval(_0x5d9d73){return function(){if(!isNotNull(_0x5d9d73[_0xab45('0x3f')])){_0x5d9d73[_0xab45('0x3a')]=_0xab45('0x40');throw _0x5d9d73[_0xab45('0x3c')]+_0xab45('0x41');}if(!isNotNull(_0x5d9d73[_0xab45('0x3f')][_0xab45('0x42')])){_0x5d9d73[_0xab45('0x3a')]=_0xab45('0x40');throw _0x5d9d73['name']+_0xab45('0x41');}if(!isNotNull(_[_0xab45('0x43')](_0x5d9d73['Interval'][_0xab45('0x42')]))){_0x5d9d73[_0xab45('0x3a')]=_0xab45('0x40');throw _0x5d9d73[_0xab45('0x3c')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x103a68,_0x4e274d,_0x233c77){return{'action':_0x103a68,'response':_0x4e274d,'message':_0x233c77,'stack':_0x233c77};}function myreject(_0x1df820){return function(_0xa3b210){return _0x1df820(msgResponse(_0xab45('0x44'),_0xab45('0x45'),JSON[_0xab45('0x46')](_0xa3b210)));};}function getSeconds(_0x2a6704,_0x4139a2){var _0x535e27=moment(_0x2a6704)[_0xab45('0x47')](0x0);var _0x5d6135=moment(_0x4139a2)[_0xab45('0x47')](0x0);return _0x535e27['diff'](_0x5d6135,'seconds');}function emit(_0x26c88f,_0x19b293,_0x9eef7d){io['to'](_0x26c88f)[_0xab45('0x48')](_0x19b293,_0x9eef7d);}function emitVoiceQueueSummary(_0x2cfcd0){if(_0x2cfcd0[_0xab45('0x49')]==='outbound'){var _0x326551={'id':_0x2cfcd0['id'],'name':_0x2cfcd0['name'],'strategy':_0x2cfcd0[_0xab45('0x4a')],'answered':_0x2cfcd0[_0xab45('0x4b')],'available':_0x2cfcd0['available'],'loggedIn':_0x2cfcd0[_0xab45('0x4c')],'pTalking':_0x2cfcd0[_0xab45('0x4d')],'sumBillable':_0x2cfcd0['sumBillable'],'sumDuration':_0x2cfcd0[_0xab45('0x4e')],'sumHoldTime':_0x2cfcd0[_0xab45('0x4f')]||0x0,'talking':_0x2cfcd0['talking'],'total':_0x2cfcd0[_0xab45('0x50')],'type':_0x2cfcd0[_0xab45('0x49')],'unmanaged':_0x2cfcd0[_0xab45('0x51')],'abandoned':_0x2cfcd0[_0xab45('0x52')],'waiting':_0x2cfcd0[_0xab45('0x53')],'loggedInDb':_0x2cfcd0['loggedInDb'],'dialActive':_0x2cfcd0['dialActive'],'dialMethod':_0x2cfcd0[_0xab45('0x54')],'dialOriginateCallerIdName':_0x2cfcd0[_0xab45('0x55')],'dialOriginateCallerIdNumber':_0x2cfcd0['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2cfcd0[_0xab45('0x56')],'dialPrefix':_0x2cfcd0['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2cfcd0['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2cfcd0[_0xab45('0x57')],'outboundBlacklistCallsDay':_0x2cfcd0[_0xab45('0x58')],'outboundBusyCallsDay':_0x2cfcd0[_0xab45('0x59')],'outboundCongestionCallsDay':_0x2cfcd0[_0xab45('0x5a')],'outboundDropCallsDayACS':_0x2cfcd0[_0xab45('0x5b')],'outboundDropCallsDayCallersExit':_0x2cfcd0[_0xab45('0x5c')],'outboundDropCallsDayTimeout':_0x2cfcd0[_0xab45('0x5d')],'outboundNoAnswerCallsDay':_0x2cfcd0['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2cfcd0[_0xab45('0x5e')],'outboundOriginateFailureCallsDay':_0x2cfcd0[_0xab45('0x5f')],'outboundReCallsDay':_0x2cfcd0[_0xab45('0x60')],'outboundRejectCallsDay':_0x2cfcd0[_0xab45('0x61')],'outboundUnknownCallsDay':_0x2cfcd0['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x2cfcd0[_0xab45('0x62')],'predictiveIntervalAvgHoldtime':_0x2cfcd0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2cfcd0[_0xab45('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0x2cfcd0[_0xab45('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x2cfcd0[_0xab45('0x65')],'predictiveIntervalErlangCalls':_0x2cfcd0['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2cfcd0[_0xab45('0x66')],'predictiveIntervalHitRate':_0x2cfcd0[_0xab45('0x67')],'predictiveIntervalMultiplicativeFactor':_0x2cfcd0['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2cfcd0['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2cfcd0['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2cfcd0[_0xab45('0x68')],'message':_0x2cfcd0['message'],'originated':_0x2cfcd0[_0xab45('0x69')],'erlangCalls':_0x2cfcd0[_0xab45('0x6a')],'erlangCallToSecond':_0x2cfcd0[_0xab45('0x6b')],'erlangAbandonmentRate':_0x2cfcd0[_0xab45('0x6c')],'erlangBusyFactor':_0x2cfcd0[_0xab45('0x6d')],'startPredictive':_0x2cfcd0[_0xab45('0x28')],'startProgressive':_0x2cfcd0['startProgressive']};if(_0x2cfcd0['Trunk']){_0x326551[_0xab45('0x6e')]={'id':_0x2cfcd0[_0xab45('0x6e')]['id'],'name':_0x2cfcd0[_0xab45('0x6e')]['name'],'active':_0x2cfcd0[_0xab45('0x6e')][_0xab45('0x6f')],'callerid':_0x2cfcd0[_0xab45('0x6e')]['callerid']};}if(_0x2cfcd0['Interval']){_0x326551[_0xab45('0x3f')]={'id':_0x2cfcd0[_0xab45('0x3f')]['id'],'name':_0x2cfcd0[_0xab45('0x3f')][_0xab45('0x3c')]};}var _0x49c459=md5(JSON['stringify'](_0x326551));if(_0x2cfcd0['md5']!==_0x49c459){_0x2cfcd0[_0xab45('0x4')]=_0x49c459;emit(util[_0xab45('0x70')](_0xab45('0x71'),_0x326551[_0xab45('0x3c')]),_0xab45('0x72'),_0x326551);}}}function emitCampaignSummary(_0x4dbac2){if(_0x4dbac2['type']===_0xab45('0x73')){emit(util[_0xab45('0x70')](_0xab45('0x74'),_0x4dbac2[_0xab45('0x3c')]),_0xab45('0x75'),_0x4dbac2);}}function checkGetDataPredictive(_0x5e58d8){if(isNotNull(_0x5e58d8)){if(!_[_0xab45('0x43')](_0x5e58d8)){loggerPredictive[_0xab45('0x76')](_0xab45('0x77'));loggerPredictive[_0xab45('0x76')](_0xab45('0x78'),_0x5e58d8['predictiveIntervalTotalCalls']);loggerPredictive[_0xab45('0x76')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e58d8[_0xab45('0x62')]);loggerPredictive[_0xab45('0x76')](_0xab45('0x79'),_0x5e58d8[_0xab45('0x65')]);loggerPredictive[_0xab45('0x76')](_0xab45('0x7a'),_0x5e58d8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xab45('0x76')](_0xab45('0x7b'),_0x5e58d8['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xab45('0x76')](_0xab45('0x7c'),_0x5e58d8[_0xab45('0x63')]);loggerPredictive[_0xab45('0x76')]('---------------------------');if(_0x5e58d8[_0xab45('0x68')]>0x0){if(!_[_0xab45('0x7d')](_0x5e58d8[_0xab45('0x63')])&&_0x5e58d8[_0xab45('0x63')]>0x0){return!![];}else{loggerPredictive[_0xab45('0x76')](_0xab45('0x7e'));}if(!_[_0xab45('0x7d')](_0x5e58d8[_0xab45('0x7f')])&&_0x5e58d8[_0xab45('0x7f')]>0x0){return!![];}else{loggerPredictive[_0xab45('0x76')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xab45('0x76')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xab45('0x76')](_0xab45('0x80'));}}else{loggerPredictive[_0xab45('0x76')](_0xab45('0x80'));}return![];}function mergeDataErlangB(_0x1989fd){return function(_0xdaebc7){loggerPredictive[_0xab45('0x76')](_0xab45('0x81'));loggerPredictive[_0xab45('0x76')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdaebc7[_0xab45('0x6a')]);loggerPredictive[_0xab45('0x76')](_0xab45('0x82'),_0xdaebc7[_0xab45('0x6b')]);loggerPredictive['info'](_0xab45('0x83'),_0xdaebc7['erlangAbandonmentRate']);loggerPredictive['info'](_0xab45('0x84'),_0xdaebc7[_0xab45('0x6d')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xdaebc7['erlangAbandonmentRate']);loggerPredictive[_0xab45('0x76')](_0xab45('0x85'));_[_0xab45('0x86')](_0x1989fd,_0xdaebc7);};}function getDiff(_0x254bff){var _0x1a3639=moment()[_0xab45('0x47')](0x0);var _0x547d4e=moment(_0x254bff)['milliseconds'](0x0);return _0x1a3639[_0xab45('0x87')](_0x547d4e,_0xab45('0x88'));}function ifInterval(_0x5891bc,_0x35cf00){if(_[_0xab45('0x7d')](_0x35cf00)){return![];}if(getDiff(_0x35cf00)<_0x5891bc*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4a7bba){if(isNotNull(_0x4a7bba)){if(!_[_0xab45('0x7d')](_0x4a7bba[_0xab45('0x89')])){_0x4a7bba[_0xab45('0x89')]=undefined;loggerPredictive[_0xab45('0x76')](_0x4a7bba[_0xab45('0x3c')],_0xab45('0x8a'));}if(!_[_0xab45('0x7d')](_0x4a7bba[_0xab45('0x28')])){_0x4a7bba[_0xab45('0x28')]=undefined;loggerPredictive[_0xab45('0x76')](_0x4a7bba[_0xab45('0x3c')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xab45('0x7d')](_0x4a7bba[_0xab45('0x8b')])){clearInterval(_0x4a7bba[_0xab45('0x8b')]);_0x4a7bba[_0xab45('0x8b')]=undefined;loggerPredictive[_0xab45('0x76')](_0x4a7bba[_0xab45('0x3c')],_0xab45('0x8c'));}}}function erlangb(_0x49d5f2,_0x56b566){if(_0x56b566===0x0){return 0x0;}var _0x259d6e=0x1;for(var _0x40ec88=0x1;_0x40ec88<=_0x56b566;_0x40ec88+=0x1){_0x259d6e=0x1+_0x259d6e*_0x40ec88/_0x49d5f2;}return 0x1/_0x259d6e;}function isVoiceQueueOutbound(_0x48da30){return _0x48da30==='outbound';}function isNotPreview(_0x2cc54c){return _0x2cc54c!=='preview';}function isCampaignIvr(_0x408182){return _0x408182===_0xab45('0x73');}function getCallerId(_0x55523b,_0x5ce2e9,_0xfefbbc){if(!_['isUndefined'](_0xfefbbc)&&'string'===typeof _0xfefbbc&&!_[_0xab45('0x43')](_0xfefbbc)){if(!_[_0xab45('0x7d')](_0x5ce2e9)&&_0xab45('0x8d')===typeof _0x5ce2e9&&!_['isEmpty'](_0x5ce2e9)){return util[_0xab45('0x70')](_0xab45('0x8e'),_0x5ce2e9,_0xfefbbc);}return util['format'](_0xab45('0x8e'),_0xfefbbc,_0xfefbbc);}if(!_['isUndefined'](_0x55523b)&&_0xab45('0x8d')===typeof _0x55523b&&!_[_0xab45('0x43')](_0x55523b)){return _0x55523b;}return _0xab45('0x8f');}function loggerCatchQueueSummary(_0x432a6a,_0x113750){return function(_0x402478){freeVariablesPredictive(_0x113750);emitVoiceQueueSummary(_0x113750);emitCampaignSummary(_0x113750);loggerSyncQueueSummary['error'](_0x432a6a,util[_0xab45('0x90')](_0x402478,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2cfda3,_0xabc4c9){return function(_0x32efd4){loggerPredictive['error'](_0xabc4c9['name'],_0x2cfda3);loggerPredictive[_0xab45('0x91')](_0x32efd4[_0xab45('0x92')]);freeVariablesPredictive(_0xabc4c9);};}function loggerCatch(_0x4b89c1){return function(_0x49368b){logger['error'](_0x4b89c1,util[_0xab45('0x90')](_0x49368b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d9f72){return _0x3d9f72&&!_[_0xab45('0x7d')](_0x3d9f72)&&_0x3d9f72[_0xab45('0x93')]>0x0;}function decremetOriginate(_0x8818d8){if(!_[_0xab45('0x7d')](_0x8818d8)&&_0x8818d8!==null){if(_0x8818d8[_0xab45('0x94')](_0xab45('0x69'))){if(_0x8818d8[_0xab45('0x69')]>0x0){_0x8818d8[_0xab45('0x69')]-=0x1;}else{logger[_0xab45('0x91')](_0xab45('0x95'));}}}else{logger[_0xab45('0x91')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x37d9e3,_0x4f11f5,_0x2afabd){if(_0x4f11f5>_0x2afabd){for(var _0x34b8c1=0x0;_0x34b8c1<_0x4f11f5-_0x2afabd;_0x34b8c1+=0x1){decremetOriginate(_0x37d9e3);}}}function loggerGetContactDialer(_0x291db8,_0x3920e3,_0xb10b60){return function(_0x23cc2b){checkContactLowerLimitOriginate(_0x3920e3,_0xb10b60,0x0);logger['error'](_0x291db8,util['inspect'](_0x23cc2b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x336769){return function(_0x3e7964){if(isNotNull(_0x3e7964)&&isNotNull(_0x3e7964[0x0])){if(_0x3e7964[0x0]['contactsRescheduled']>0x0){_0x336769[_0xab45('0x3a')]='RESCHEDULED_CONTACTS';logger[_0xab45('0x76')](_0xab45('0x96')+_0x336769[_0xab45('0x3c')],_0x3e7964[0x0][_0xab45('0x97')],_0xab45('0x98'));}else{_0x336769[_0xab45('0x3a')]=_0xab45('0x99');logger['info'](_0xab45('0x9a')+_0x336769[_0xab45('0x3c')]);}}};}function notSendMessagesQueue(_0x29647c){if(_0x29647c[_0xab45('0x9b')]){freeVariablesPredictive(_0x29647c);if(_0x29647c[_0xab45('0x69')]===0x0&&_0x29647c[_0xab45('0x9c')]===0x0&&_0x29647c[_0xab45('0x53')]===0x0&&(_0x29647c['pTalking']||0x0)===0x0){_0x29647c[_0xab45('0x9b')]=![];_0x29647c['available']=0x0;_0x29647c['message']=_0xab45('0x3e');loggerSyncQueueSummary['error'](_0xab45('0x9d'),_0x29647c[_0xab45('0x3c')],_0xab45('0x9e'));}else{_0x29647c[_0xab45('0x3a')]=_0xab45('0x9f');loggerSyncQueueSummary[_0xab45('0x91')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x29647c[_0xab45('0x3c')],_0xab45('0xa0'));}emitVoiceQueueSummary(_0x29647c);}}function notSendMessagesCampaign(_0xdf2dc8){if(_0xdf2dc8[_0xab45('0x9b')]){if(_0xdf2dc8[_0xab45('0x69')]===0x0){_0xdf2dc8[_0xab45('0x9b')]=![];_0xdf2dc8[_0xab45('0x3a')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xab45('0x91')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xdf2dc8['name'],_0xab45('0x9e'));}else{_0xdf2dc8[_0xab45('0x3a')]=_0xab45('0x9f');loggerSyncQueueSummary['error'](_0xab45('0xa1'),_0xdf2dc8[_0xab45('0x3c')],_0xab45('0xa0'));}emitCampaignSummary(_0xdf2dc8);}}function createObjHistory(_0x38cfad,_0x407442,_0x31080b,_0x3fb7b9,_0x2b5fbd){_0x38cfad['message']=_0x31080b;var _0x1965e2=new Action(_0x38cfad,_0x407442);var _0x1fb803=new History(_0x1965e2);_0x1fb803[_0xab45('0xa2')]=_0x3fb7b9;_0x1fb803[_0xab45('0xa3')]=_0x2b5fbd;_0x1fb803['endtime']=_0x1965e2['starttime'];return _0x1fb803;}Dialer[_0xab45('0x1b')]['loopClearZombieChannels']=function(){var _0x43e384=this;setInterval(function(){_0x43e384['clearZombieChannels'](_0x43e384[_0xab45('0x26')],_0xab45('0xa4'));_0x43e384[_0xab45('0xa5')](_0x43e384['actions'],_0xab45('0xa6'));},0x32c8);};Dialer[_0xab45('0x1b')][_0xab45('0xa5')]=function(_0xd0dcde,_0x1eb84b){var _0x24f42c=this;for(var _0x1d1229 in _0xd0dcde){if(_0xd0dcde[_0xab45('0x94')](_0x1d1229)){this[_0xab45('0x1e')][_0xab45('0xa7')](function(){if(!_[_0xab45('0xa8')](_0xd0dcde[_0x1d1229])){return ami[_0xab45('0xa9')]({'action':_0xab45('0xaa'),'channel':_0xd0dcde[_0x1d1229][_0xab45('0xab')]})['catch'](function(_0x4ecc4e){if(_0x4ecc4e[_0xab45('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xd0dcde[_0x1d1229]&&_0xd0dcde[_0x1d1229][_0xab45('0x49')]!==_0xab45('0x73')){_0x24f42c[_0xab45('0xac')](_0x24f42c[_0xab45('0x1f')][_0xd0dcde[_0x1d1229][_0xab45('0xad')]]);logger[_0xab45('0x91')](_0xab45('0xae'),_0x1eb84b,_0x1d1229,_0xd0dcde[_0x1d1229][_0xab45('0xad')]);delete _0xd0dcde[_0x1d1229];}if(_0xd0dcde[_0x1d1229]&&_0xd0dcde[_0x1d1229]['type']===_0xab45('0x73')){_0x24f42c[_0xab45('0xac')](_0x24f42c[_0xab45('0x20')][_0xd0dcde[_0x1d1229]['queue']]);logger[_0xab45('0x91')]('[Dialer][checkChannel][ivr]',_0x1eb84b,_0x1d1229,_0xd0dcde[_0x1d1229][_0xab45('0xad')]);delete _0xd0dcde[_0x1d1229];}},0x2328);}});}});}}};Dialer[_0xab45('0x1b')]['countReScheduled']=function(_0xf8c697){return BPromise[_0xab45('0xaf')]()[_0xab45('0xb0')](cmHopper[_0xab45('0xb1')](_0xf8c697))['catch'](loggerCatch(_0xab45('0xb2')));};Dialer[_0xab45('0x1b')][_0xab45('0xb3')]=function(_0x385e00){return BPromise[_0xab45('0xaf')]()['then'](cmHopperBlack[_0xab45('0xb3')](_0x385e00))[_0xab45('0xb4')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xab45('0x1b')][_0xab45('0xb5')]=function(_0x3fb5d4){return BPromise[_0xab45('0xaf')]()[_0xab45('0xb0')](cmHopperBlack['checkIsBlackListIvr'](_0x3fb5d4))['catch'](loggerCatch(_0xab45('0xb6')));};Dialer[_0xab45('0x1b')]['averageHandleTime']=function(_0x122239){return BPromise['resolve']()[_0xab45('0xb0')](cmHopperHistory[_0xab45('0xb7')](_0x122239))[_0xab45('0xb4')](loggerCatch(_0xab45('0xb8')));};Dialer['prototype']['rescheduleContact']=function(_0x486c41){return BPromise['resolve']()[_0xab45('0xb0')](cmHopper[_0xab45('0xb9')](_0x486c41))[_0xab45('0xb4')](loggerCatch(_0xab45('0xba')));};Dialer[_0xab45('0x1b')]['getContactDialer']=function(_0x1c7e57,_0x1e2b48,_0xcd501,_0x538219){return BPromise[_0xab45('0xaf')]()[_0xab45('0xb0')](cmHopper[_0xab45('0xbb')](_0x1c7e57,_0x1e2b48,_0xcd501,_0x538219))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xab45('0x1b')][_0xab45('0xbc')]=function(_0x4cb02e,_0x1b29fb,_0x4f98ad){return BPromise['resolve']()['then'](cmHopper[_0xab45('0xbc')](_0x4cb02e,_0x1b29fb,_0x4f98ad))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xab45('0x1b')]['getVoiceQueueRtPauses']=function(_0x15be68){return BPromise[_0xab45('0xaf')]()[_0xab45('0xb0')](voiceQueueRt[_0xab45('0xbd')](_0x15be68))[_0xab45('0xb4')](loggerCatch(_0xab45('0xbe')));};Dialer[_0xab45('0x1b')][_0xab45('0xbf')]=function(_0x57a301){return BPromise[_0xab45('0xaf')]()['then'](cmHopper[_0xab45('0xbf')](_0x57a301))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xab45('0x1b')]['createHistory']=function(_0x2dc79){return BPromise[_0xab45('0xaf')]()[_0xab45('0xb0')](cmHopperHistory[_0xab45('0xc0')](_0x2dc79))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xab45('0x1b')][_0xab45('0xac')]=function(_0x202e42){if(!_['isUndefined'](_0x202e42)&&_0x202e42!==null){if(_0x202e42[_0xab45('0x94')](_0xab45('0x69'))){if(_0x202e42[_0xab45('0x69')]>0x0){_0x202e42[_0xab45('0x69')]-=0x1;}else{logger[_0xab45('0x91')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xab45('0x91')](_0xab45('0xc1'));}};Dialer['prototype'][_0xab45('0xc2')]=function(_0x43f3dc,_0x441413){var _0x3ef3a1=this;return function(_0x34efd4){_0x3ef3a1[_0xab45('0xac')](_0x441413);logger[_0xab45('0x91')](_0x43f3dc,util['inspect'](_0x34efd4,{'showHidden':![],'depth':null}));};};Dialer[_0xab45('0x1b')][_0xab45('0xc3')]=function(_0x2a95c6,_0x2024ea,_0x4716f9){var _0x37784a={'state':0x19,'statedesc':'notFound'};this[_0xab45('0xac')](_0x2024ea);this[_0xab45('0xc4')](_[_0xab45('0x86')](_0x37784a,_[_0xab45('0xc5')](_0x4716f9,['ContactId',_0xab45('0xc6'),_0xab45('0xc7'),_0xab45('0xc8'),'CampaignId'])),'[emptyContact][createHistory]',_0xab45('0xc9'));logger[_0xab45('0x91')](_0x2a95c6);};Dialer[_0xab45('0x1b')]['isSuccess']=function(_0x4e0c0d){return _0x4e0c0d===_0xab45('0xca');};Dialer[_0xab45('0x1b')][_0xab45('0xcb')]=function(_0x4c7614){return!_[_0xab45('0x7d')](_0x4c7614)&&_0x4c7614&&!_[_0xab45('0x7d')](_0x4c7614[_0xab45('0x3c')])&&!_[_0xab45('0x7d')](_0x4c7614[_0xab45('0x6f')])&&_0x4c7614[_0xab45('0x6f')]&&(this[_0xab45('0x22')][util['format'](_0xab45('0xcc'),_0x4c7614['name'])]['status']==='reachable'||this[_0xab45('0x22')][util[_0xab45('0x70')](_0xab45('0xcc'),_0x4c7614[_0xab45('0x3c')])][_0xab45('0xaa')]==='unmonitored');};Dialer['prototype'][_0xab45('0xc4')]=function(_0x4b12c4,_0x4f27d3,_0x21ba09){this[_0xab45('0xc0')](_0x4b12c4)[_0xab45('0xb4')](loggerCatch(_0x4f27d3));this['moveContactManagedDialer'](_0x4b12c4)[_0xab45('0xb4')](loggerCatch(_0x21ba09));};Dialer[_0xab45('0x1b')]['syncVarSet']=function(_0xd0f939){var _0x140f57=this['uniqueId'][_0xd0f939[_0xab45('0xcd')]];var _0x4fdaa8;if(!_[_0xab45('0xa8')](_0xd0f939)&&!_[_0xab45('0xa8')](_0xd0f939[_0xab45('0xce')])&&!_[_0xab45('0xa8')](_0xd0f939[_0xab45('0xce')][_0xab45('0xcf')])&&_0xd0f939[_0xab45('0xd0')]===_0xab45('0xd1')&&_0x140f57){if(_0x140f57[_0xab45('0x49')]!==_0xab45('0x73')&&this[_0xab45('0x1f')][_0x140f57[_0xab45('0xad')]][_0xab45('0xd2')]&&_0xd0f939[_0xab45('0xd3')]===_0xab45('0xd4')){delete this['uniqueId'][_0xd0f939['uniqueid']];this[_0xab45('0xac')](this[_0xab45('0x1f')][_0x140f57['queue']]);this[_0xab45('0x1f')][_0x140f57[_0xab45('0xad')]][_0xab45('0x57')]+=0x1;this[_0xab45('0x1f')][_0x140f57[_0xab45('0xad')]][_0xab45('0xd5')]+=0x1;_0x4fdaa8=new Hangup(_0x140f57,_0xd0f939);_0x4fdaa8['state']=0x12;_0x4fdaa8['statedesc']=_0xab45('0xd6');_0x4fdaa8['membername']=_0xab45('0xd7');this[_0xab45('0xc4')](_0x4fdaa8,_0xab45('0xd8'),_0xab45('0xd9'));}if(_0x140f57[_0xab45('0x49')]!==_0xab45('0x73')&&this['voiceQueues'][_0x140f57['queue']]['dialAMDActive']&&_0xd0f939[_0xab45('0xd3')]==='MACHINE'){delete this[_0xab45('0x26')][_0xd0f939[_0xab45('0xcd')]];this['updateOriginated'](this[_0xab45('0x1f')][_0x140f57[_0xab45('0xad')]]);this[_0xab45('0x1f')][_0x140f57[_0xab45('0xad')]][_0xab45('0x57')]+=0x1;this['voiceQueues'][_0x140f57['queue']][_0xab45('0xd5')]+=0x1;_0x4fdaa8=new Hangup(_0x140f57,_0xd0f939);_0x4fdaa8['state']=0x13;_0x4fdaa8[_0xab45('0xa3')]=_0xab45('0xda');_0x4fdaa8[_0xab45('0xdb')]=_0xab45('0xd7');_0x4fdaa8[_0xab45('0xdc')]=!![];this[_0xab45('0xc4')](_0x4fdaa8,'[syncMachine][createHistory]','[syncMachine]');}if(_0x140f57[_0xab45('0x49')]===_0xab45('0x73')&&this[_0xab45('0x20')][_0x140f57['queue']][_0xab45('0xd2')]&&_0xd0f939[_0xab45('0xd3')]===_0xab45('0xd4')){delete this[_0xab45('0x26')][_0xd0f939[_0xab45('0xcd')]];this[_0xab45('0xac')](this['campaigns'][_0x140f57['queue']]);_0x4fdaa8=new Hangup(_0x140f57,_0xd0f939);_0x4fdaa8[_0xab45('0xa2')]=0x12;_0x4fdaa8[_0xab45('0xa3')]=_0xab45('0xd6');_0x4fdaa8[_0xab45('0xdb')]=_0xab45('0xd7');this[_0xab45('0xc4')](_0x4fdaa8,_0xab45('0xdd'),_0xab45('0xde'));}if(_0x140f57['type']==='ivr'&&this[_0xab45('0x20')][_0x140f57[_0xab45('0xad')]][_0xab45('0xd2')]&&_0xd0f939[_0xab45('0xd3')]===_0xab45('0xdf')){delete this[_0xab45('0x26')][_0xd0f939[_0xab45('0xcd')]];this['updateOriginated'](this[_0xab45('0x20')][_0x140f57[_0xab45('0xad')]]);_0x4fdaa8=new Hangup(_0x140f57,_0xd0f939);_0x4fdaa8[_0xab45('0xa2')]=0x13;_0x4fdaa8['statedesc']=_0xab45('0xda');_0x4fdaa8[_0xab45('0xdb')]='AMD';_0x4fdaa8['amd']=!![];this['saveInDb'](_0x4fdaa8,_0xab45('0xe0'),_0xab45('0xe1'));}}};Dialer[_0xab45('0x1b')][_0xab45('0x33')]=function(_0x32ebdd){var _0x51060f=this[_0xab45('0x26')][_0x32ebdd[_0xab45('0xcd')]];var _0x26220d=this;var _0x9bfaaf;if(_0x51060f&&_0x51060f['type']===_0xab45('0x73')){delete this[_0xab45('0x26')][_0x32ebdd[_0xab45('0xcd')]];this[_0xab45('0xac')](this[_0xab45('0x20')][_0x51060f[_0xab45('0xad')]]);this[_0xab45('0x20')][_0x51060f[_0xab45('0xad')]][_0xab45('0xe2')]+=0x1;_0x9bfaaf=new Hangup(_0x51060f,_0x32ebdd);this[_0xab45('0xc0')](_0x9bfaaf)['catch'](loggerCatch(_0xab45('0xe3')));this[_0xab45('0xbf')](_0x9bfaaf)[_0xab45('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x51060f&&_0x51060f[_0xab45('0x49')]!=='ivr'&&isNotNull(this[_0xab45('0x1f')][_0x51060f[_0xab45('0xad')]][_0xab45('0xe4')])){delete this[_0xab45('0x26')][_0x32ebdd[_0xab45('0xcd')]];this[_0xab45('0xac')](this['voiceQueues'][_0x51060f[_0xab45('0xad')]]);this['voiceQueues'][_0x51060f[_0xab45('0xad')]][_0xab45('0x57')]+=0x1;this[_0xab45('0x1f')][_0x51060f['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x9bfaaf=new Hangup(_0x51060f,_0x32ebdd);_0x9bfaaf['state']=0x10;_0x9bfaaf[_0xab45('0xa3')]='AnswerAGI';_0x9bfaaf[_0xab45('0xdb')]=_0xab45('0xe5');this[_0xab45('0xc0')](_0x9bfaaf)[_0xab45('0xb4')](loggerCatch(_0xab45('0xe3')));this['moveContactManagedDialer'](_0x9bfaaf)[_0xab45('0xb4')](loggerCatch(_0xab45('0xe6')));}if(_0x51060f&&_0x51060f[_0xab45('0x49')]!==_0xab45('0x73')&&!isNotNull(this[_0xab45('0x1f')][_0x51060f['queue']]['dialQueueProject'])){delete this[_0xab45('0x26')][_0x32ebdd[_0xab45('0xcd')]];this[_0xab45('0xac')](this['voiceQueues'][_0x51060f[_0xab45('0xad')]]);this['voiceQueues'][_0x51060f[_0xab45('0xad')]][_0xab45('0xe7')]+=0x1;_0x9bfaaf=new Hangup(_0x51060f,_0x32ebdd);_0x9bfaaf['state']=0xc;_0x9bfaaf[_0xab45('0xa3')]=_0x32ebdd[_0xab45('0xe8')];_0x9bfaaf[_0xab45('0xdb')]=_0xab45('0xe9');this['createHistory'](_0x9bfaaf)[_0xab45('0xb4')](loggerCatch(_0xab45('0xe3')));this['moveContactManagedDialer'](_0x9bfaaf)[_0xab45('0xb4')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x3bc2d7){var _0x3cf3d8=this[_0xab45('0x26')][_0x3bc2d7[_0xab45('0xcd')]];var _0xc8fcb9=this;if(this[_0xab45('0x1f')][_0x3bc2d7[_0xab45('0xad')]]){if(_0x3cf3d8&&_0x3cf3d8[_0xab45('0x49')]!==_0xab45('0x73')){delete this[_0xab45('0x26')][_0x3bc2d7[_0xab45('0xcd')]];this[_0xab45('0x1f')][_0x3bc2d7['queue']][_0xab45('0x57')]+=0x1;var _0x31f657=new AgentComplete(_0x3cf3d8,_0x3bc2d7);if(_0x3bc2d7['reason']==='agent'){_0x31f657[_0xab45('0xea')]=this[_0xab45('0x1f')][_0x3bc2d7[_0xab45('0xad')]][_0xab45('0xeb')]&&this[_0xab45('0x1f')][_0x3bc2d7[_0xab45('0xad')]][_0xab45('0xec')]?moment()['format'](_0xab45('0xed')):undefined;}this[_0xab45('0xc0')](_0x31f657)[_0xab45('0xb4')](loggerCatch(_0xab45('0xee')));this[_0xab45('0xbf')](_0x31f657)[_0xab45('0xb4')](loggerCatch(_0xab45('0xef')));}}};Dialer[_0xab45('0x1b')][_0xab45('0xf0')]=function(_0x39ad5d){if(this[_0xab45('0x1f')][_0x39ad5d[_0xab45('0xad')]]){if(this[_0xab45('0x26')][_0x39ad5d[_0xab45('0xcd')]]&&this[_0xab45('0x26')][_0x39ad5d[_0xab45('0xcd')]][_0xab45('0x49')]!==_0xab45('0x73')){this[_0xab45('0xac')](this[_0xab45('0x1f')][_0x39ad5d[_0xab45('0xad')]]);this[_0xab45('0x26')][_0x39ad5d[_0xab45('0xcd')]][_0xab45('0xf1')]=moment()[_0xab45('0x70')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xab45('0x1b')]['queueCallerAbandonCreateState']=function(_0x59079d){this['createHistory'](_0x59079d)[_0xab45('0xb4')](loggerCatch(_0xab45('0xee')));this[_0xab45('0xbf')](_0x59079d)[_0xab45('0xb4')](loggerCatch(_0xab45('0xf2')));};Dialer[_0xab45('0x1b')]['syncQueueCallerAbandon']=function(_0x3db132){var _0x427cc1=this[_0xab45('0x26')][_0x3db132[_0xab45('0xcd')]];var _0x122a11=this;if(this['voiceQueues'][_0x3db132[_0xab45('0xad')]]){if(_0x427cc1&&_0x427cc1[_0xab45('0x49')]!=='ivr'){delete this[_0xab45('0x26')][_0x3db132[_0xab45('0xcd')]];this[_0xab45('0xac')](this[_0xab45('0x1f')][_0x3db132['queue']]);_0x427cc1[_0xab45('0xf3')]=moment()['format'](_0xab45('0xed'));var _0x240648=new QueueCallerAbandon(_0x427cc1,_0x3db132);if(getSeconds(_0x427cc1[_0xab45('0xf3')],_0x427cc1[_0xab45('0xf4')])>=_0x427cc1[_0xab45('0xf5')]){this[_0xab45('0x1f')][_0x3db132['queue']][_0xab45('0x65')]+=0x1;this[_0xab45('0x1f')][_0x3db132[_0xab45('0xad')]][_0xab45('0x5d')]+=0x1;this[_0xab45('0x1f')][_0x3db132['queue']][_0xab45('0x66')]+=0x1;_0x240648['state']=0xa;_0x240648[_0xab45('0xa3')]=_0xab45('0xf6');_0x240648[_0xab45('0xf7')]='TIMEOUT';_0x240648[_0xab45('0xea')]=this[_0xab45('0x1f')][_0x3db132['queue']][_0xab45('0xeb')]?moment()[_0xab45('0x70')](_0xab45('0xed')):undefined;this['queueCallerAbandonCreateState'](_0x240648);}else{this['voiceQueues'][_0x3db132[_0xab45('0xad')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xab45('0x1f')][_0x3db132[_0xab45('0xad')]][_0xab45('0x5c')]+=0x1;_0x240648[_0xab45('0xa2')]=0xb;_0x240648['statedesc']=_0xab45('0xf8');_0x240648[_0xab45('0xf7')]='CALLEREXIT';this[_0xab45('0xf9')](_0x240648);}}}};Dialer[_0xab45('0x1b')][_0xab45('0x34')]=function(_0x1ac7bf){if(this[_0xab45('0x25')][_0x1ac7bf['uniqueid']]){this[_0xab45('0x25')][_0x1ac7bf[_0xab45('0xcd')]]['channel']=_0x1ac7bf[_0xab45('0xab')];}if(this[_0xab45('0x26')][_0x1ac7bf[_0xab45('0xcd')]]){this[_0xab45('0x26')][_0x1ac7bf[_0xab45('0xcd')]][_0xab45('0xab')]=_0x1ac7bf[_0xab45('0xab')];}};Dialer['prototype'][_0xab45('0xfa')]=function(_0x18cb8d){if(strategy[this[_0xab45('0x1f')][this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]][_0xab45('0xad')]]['strategy']]===_0xab45('0xfc')){if(this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]]&&_['isNil'](this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]][_0xab45('0xfd')])&&_0x18cb8d['status']==='1'&&_0x18cb8d[_0xab45('0xfe')]==='0'){if(this['agents'][_0x18cb8d[_0xab45('0xff')]]){if(!this[_0xab45('0x21')][_0x18cb8d[_0xab45('0xff')]][_0xab45('0xfd')]){this[_0xab45('0x21')][_0x18cb8d['stateinterface']][_0xab45('0xfd')]=!![];this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]][_0xab45('0xfd')]=!![];this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]]['stateinterface']=_0x18cb8d[_0xab45('0xff')];}}}}else if((strategy[this['voiceQueues'][this[_0xab45('0x25')][_0x18cb8d['actionid']][_0xab45('0xad')]][_0xab45('0x4a')]]||_0xab45('0x1a'))==='rrmemory'){if(this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]]){if(this[_0xab45('0x21')][_0x18cb8d['stateinterface']]){this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]]['stateinterface']=_0x18cb8d['stateinterface'];if(_[_0xab45('0xa8')](this[_0xab45('0x100')][this[_0xab45('0x25')][_0x18cb8d['actionid']][_0xab45('0xad')]])){this['queueBooked'][this[_0xab45('0x25')][_0x18cb8d['actionid']]['queue']]=[];}this[_0xab45('0x100')][this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]][_0xab45('0xad')]]['push'](_[_0xab45('0x86')](_[_0xab45('0xc5')](this[_0xab45('0x25')][_0x18cb8d[_0xab45('0xfb')]],['idHopper','stateinterface']),{'status':_0x18cb8d['status'],'paused':_0x18cb8d['paused']}));}}}};function unlockQueueStatus(_0x3ec95e,_0x385541){setTimeout(function(){if(_['isUndefined'](_0x3ec95e['queueStatusComplete'])){loggerBooked[_0xab45('0x91')](_0xab45('0x101'),_0x385541);}_0x3ec95e['queueStatusComplete']=!![];loggerBooked[_0xab45('0x76')](_0xab45('0x102'),_0x385541,JSON[_0xab45('0x46')](_['pick'](_0x3ec95e,[_0xab45('0x3c'),_0xab45('0x103')])));},0x1f3);}Dialer[_0xab45('0x1b')][_0xab45('0x37')]=function(_0x2a6b6f){var _0x39e251=this;var _0x2f2b8a=_0x39e251[_0xab45('0x1f')][_0x39e251[_0xab45('0x25')][_0x2a6b6f['actionid']][_0xab45('0xad')]];if(strategy[this[_0xab45('0x1f')][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]][_0xab45('0x4a')]]===_0xab45('0xfc')){if(this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]&&this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xff')]){this[_0xab45('0x104')][_0xab45('0x105')](this['actions'][_0x2a6b6f[_0xab45('0xfb')]]['idHopper'],this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]['stateinterface'])[_0xab45('0xb4')](function(_0x49299f){logger[_0xab45('0x91')](_0xab45('0x106'),util[_0xab45('0x90')](_0x49299f,{'showHidden':![],'depth':null}));})[_0xab45('0x1d')](function(){_0x39e251[_0xab45('0xac')](_0x39e251['voiceQueues'][_0x39e251['actions'][_0x2a6b6f['actionid']][_0xab45('0xad')]]);_0x39e251[_0xab45('0x21')][_0x39e251['actions'][_0x2a6b6f['actionid']][_0xab45('0xff')]][_0xab45('0xfd')]=![];delete _0x39e251[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]];unlockQueueStatus(_0x2f2b8a);});}else{this[_0xab45('0xac')](this[_0xab45('0x1f')][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]]);this[_0xab45('0xb9')]({'active':![],'ContactId':this['actions'][_0x2a6b6f[_0xab45('0xfb')]]['ContactId'],'ListId':this[_0xab45('0x25')][_0x2a6b6f['actionid']][_0xab45('0xc6')],'VoiceQueueId':this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xc8')]||undefined,'CampaignId':this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]['CampaignId']||undefined})[_0xab45('0xb4')](loggerCatch(_0xab45('0x107')));delete this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]];unlockQueueStatus(_0x2f2b8a);}}else if((strategy[this[_0xab45('0x1f')][this['actions'][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]][_0xab45('0x4a')]]||'rrmemory')===_0xab45('0x1a')){var _0x48ac5a;if(this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]&&!_['isEmpty'](this['queueBooked'][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]['queue']])){if(this[_0xab45('0x108')][_0x39e251['actions'][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]]){this['queueBookedRR'][_0x39e251[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]['queue']]=this[_0xab45('0x108')][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]]?this[_0xab45('0x108')][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]]:this['queueBooked'][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]]?this['queueBooked'][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]][_0xab45('0xad')]][_0xab45('0x109')]||0x0:0x0;}this[_0xab45('0x100')][this[_0xab45('0x25')][_0x2a6b6f['actionid']][_0xab45('0xad')]][_0xab45('0x109')]=this[_0xab45('0x108')][this[_0xab45('0x25')][_0x2a6b6f[_0xab45('0xfb')]]['queue']];for(var _0x1899af=0x0;_0x1899af=0x0?!![]:![];})[_0xab45('0xb4')](myreject(_0x1ab67f)));}}else{_0x2a30d4[_0xab45('0x122')](ami[_0xab45('0xa9')]({'action':_0xab45('0x123'),'command':util[_0xab45('0x70')](_0xab45('0x124'),_0x21f6f4,!_[_0xab45('0x7d')](config['timezones'][_0x59958f])?_0x59958f:'')})[_0xab45('0xb0')](function(_0x550bd3){return _0x550bd3['content']['indexOf']('true')>=0x0?!![]:![];})[_0xab45('0xb4')](myreject(_0x1ab67f)));}BPromise[_0xab45('0x128')](_0x2a30d4)[_0xab45('0xb0')](function(_0x4866ac){var _0x159196=_['some'](_0x4866ac);if(_0x159196){return _0x3f4b34(_0x159196);}else{_0x2a267b[_0xab45('0x3a')]=_0x8154a6?_0xab45('0x129'):_0xab45('0x12a');return _0x1ab67f(msgResponse(_0xab45('0x12b'),_0xab45('0x11b'),_0xab45('0x12c')+_0x8154a6+'\x20'+_0x32b814+_0xab45('0x12d')+util['inspect'](_0x21f6f4,{'showHidden':![],'depth':null})+_0xab45('0x12e')+_0x59958f));}})[_0xab45('0xb4')](function(_0x52801e){return _0x1ab67f(msgResponse(_0xab45('0x119'),_0xab45('0x11b'),JSON[_0xab45('0x46')](_0x52801e)));});});};Dialer[_0xab45('0x1b')][_0xab45('0x12f')]=function(_0x52ecff){var _0xf1caa6=this;return function(){switch(_0x52ecff[_0xab45('0x54')]){case _0xab45('0x130'):freeVariablesPredictive(_0x52ecff);_0xf1caa6[_0xab45('0x131')](_0x52ecff,0x1);break;case _0xab45('0x132'):freeVariablesPredictive(_0x52ecff);_0xf1caa6['handlePower'](_0x52ecff,_0x52ecff[_0xab45('0x133')]);break;case'predictive':_0xf1caa6[_0xab45('0x8')](_0x52ecff);break;case _0xab45('0x7'):freeVariablesPredictive(_0x52ecff);_0xf1caa6['handlePower'](_0x52ecff,0x1);break;default:freeVariablesPredictive(_0x52ecff);logger[_0xab45('0x91')]('Queue',_0x52ecff[_0xab45('0x3c')],_0xab45('0x134'));}};};Dialer['prototype'][_0xab45('0x135')]=function(_0x117273){var _0x2c20a2=this;return function(){_0x2c20a2['handleIvr'](_0x117273);};};Dialer[_0xab45('0x1b')][_0xab45('0xa')]=function(_0x158568){var _0xb4865b=this;if(isNotPreview(_0x158568[_0xab45('0x54')])){if(isVoiceQueueOutbound(_0x158568[_0xab45('0x49')])&&isActive(_0x158568[_0xab45('0x136')])){_0x158568[_0xab45('0x9b')]=!![];BPromise[_0xab45('0xaf')]()[_0xab45('0xb0')](checkIsLoggedIn(_0x158568,_0x158568['loggedIn']))['then'](checkIsActive(_0x158568,_0x158568[_0xab45('0x136')]))[_0xab45('0xb0')](checkInterval(_0x158568))[_0xab45('0xb0')](_0xb4865b[_0xab45('0x115')](_0x158568))[_0xab45('0xb0')](_0xb4865b['checkIfTime'](_0x158568['dialGlobalInterval'],_0x158568[_0xab45('0x137')],_0x158568[_0xab45('0x3c')],_0x158568))['then'](_0xb4865b['checkIfTimeIntervals'](_0x158568[_0xab45('0x3f')],_0x158568[_0xab45('0x137')],_0x158568[_0xab45('0x3c')],_0x158568))[_0xab45('0xb0')](_0xb4865b[_0xab45('0x12f')](_0x158568))[_0xab45('0xb4')](loggerCatchQueueSummary(_0xab45('0x138'),_0x158568));}else{notSendMessagesQueue(_0x158568);}}else{freeVariablesPredictive(_0x158568);}};Dialer[_0xab45('0x1b')][_0xab45('0x114')]=function(){var _0x32f36f=this;var _0x1d6eab;for(var _0x3ad1e2 in this[_0xab45('0x20')]){if(this[_0xab45('0x20')][_0xab45('0x94')](_0x3ad1e2)){_0x1d6eab=this[_0xab45('0x20')][_0x3ad1e2];if(isCampaignIvr(_0x1d6eab[_0xab45('0x49')])&&isActive(_0x1d6eab['active'])){_0x1d6eab[_0xab45('0x9b')]=!![];BPromise['resolve']()[_0xab45('0xb0')](checkIsActive(_0x1d6eab,_0x1d6eab[_0xab45('0x6f')]))[_0xab45('0xb0')](checkInterval(_0x1d6eab))['then'](_0x32f36f[_0xab45('0x115')](_0x1d6eab))[_0xab45('0xb0')](_0x32f36f['checkIfTime'](_0x1d6eab[_0xab45('0x139')],_0x1d6eab['dialTimezone'],_0x1d6eab[_0xab45('0x3c')],_0x1d6eab))[_0xab45('0xb0')](_0x32f36f['checkIfTimeIntervals'](_0x1d6eab[_0xab45('0x3f')],_0x1d6eab[_0xab45('0x137')],_0x1d6eab[_0xab45('0x3c')],_0x1d6eab))[_0xab45('0xb0')](_0x32f36f[_0xab45('0x135')](_0x1d6eab))[_0xab45('0xb4')](loggerCatchQueueSummary(_0xab45('0x13a'),_0x1d6eab));}else{notSendMessagesCampaign(_0x1d6eab);}}}};function getCallerIdRandom(_0x4a299b,_0x142e7c){var _0x593514,_0x5c1aef,_0x28af3c;if(_0x142e7c<=0x0){_0x142e7c=0x1;}_0x593514=new RegExp(_0xab45('0x13b')+_0x142e7c+'}$');_0x5c1aef=Math[_0xab45('0x13c')](0xa,_0x142e7c-0x1);_0x28af3c=Math['pow'](0xa,_0x142e7c)-0x1;return util[_0xab45('0x70')]('%s',_[_0xab45('0x13d')](_0x4a299b,_0x593514,_['random'](_0x5c1aef,_0x28af3c)));}function extractCalleridName(_0x3c9fb5){var _0xfb6061=_0x3c9fb5[_0xab45('0x13e')](/"(.*?)"/);return _0xfb6061?_0xfb6061[0x1]:_0x3c9fb5;}function extractCalleridNumber(_0x5ddaf1){var _0x1cb015=_0x5ddaf1[_0xab45('0x13e')](/<(.*?)>/);return _0x1cb015?_0x1cb015[0x1]:_0x5ddaf1;}Dialer['prototype'][_0xab45('0x13f')]=function(_0x4d0a65,_0xd98cc1){var _0x500f27=this;var _0x584182=uuid['v4']();this[_0xab45('0x25')][_0x584182]=new Action(_0x4d0a65,_0xd98cc1,_0x584182);return new BPromise(function(_0x56d101,_0x3a18d9){if(_['isUndefined'](_0x4d0a65)&&_0xab45('0x140')!==typeof _0x4d0a65){return _0x3a18d9(msgResponse(_0xab45('0x141'),_0xab45('0x11b'),_0xab45('0x142')));}if(_[_0xab45('0x7d')](_0xd98cc1[_0xab45('0x143')][_0xab45('0x144')])||_0xd98cc1[_0xab45('0x143')][_0xab45('0x144')]===null){return _0x3a18d9(msgResponse(_0xab45('0x141'),_0xab45('0x11b'),_0xab45('0x145')));}var _0x22c9a3={'XMD-CALLERID':_0x500f27['actions'][_0x584182][_0xab45('0x146')](),'XMD-AGI':_0x4d0a65[_0xab45('0xe4')]?util['format'](_0xab45('0x147'),ipAgi,_0x4d0a65['dialQueueProject']):_0xab45('0x148'),'XMD-AGIAFTER':_0x4d0a65[_0xab45('0xeb')]?util[_0xab45('0x70')](_0xab45('0x147'),ipAgi,_0x4d0a65[_0xab45('0xeb')]):_0xab45('0x148'),'XMD-QUEUE':_0x4d0a65['type']===_0xab45('0x149')?util[_0xab45('0x70')](_0xab45('0x14a'),_0x4d0a65['name'],_0x4d0a65['dialQueueOptions']||'',_0x4d0a65['dialAgiAfterHangupAgent']?'c':'',_0x4d0a65['dialQueueTimeout']||0x3):_0xab45('0x148'),'XMD-CONTACTID':_0xd98cc1[_0xab45('0x110')],'XMD-CDRTYPE':_0xab45('0x14b'),'CALLERID(all)':_0x500f27[_0xab45('0x25')][_0x584182][_0xab45('0x146')](),'XMD-AMD':_0x4d0a65[_0xab45('0xd2')]?'ACTIVE':_0xab45('0x148'),'XMD-DESTINATION':_0xab45('0xd1')};if(_0x4d0a65['dialAMDActive']){_0x22c9a3['XMD-AMDINITIALSILENCE']=_0x4d0a65[_0xab45('0x14c')]||0x9c4;_0x22c9a3[_0xab45('0x14d')]=_0x4d0a65[_0xab45('0x14e')]||0x5dc;_0x22c9a3['XMD-AMDAFTERGREETINGSILENCE']=_0x4d0a65[_0xab45('0x14f')]||0x320;_0x22c9a3[_0xab45('0x150')]=_0x4d0a65['dialAMDTotalAnalysisTime']||0x1388;_0x22c9a3[_0xab45('0x151')]=_0x4d0a65[_0xab45('0x152')]||0x64;_0x22c9a3[_0xab45('0x153')]=_0x4d0a65[_0xab45('0x154')]||0x32;_0x22c9a3[_0xab45('0x155')]=_0x4d0a65[_0xab45('0x156')]||0x3;_0x22c9a3['XMD-AMDSILENCETHRESHOLD']=_0x4d0a65['dialAMDSilenceThreshold']||0x100;_0x22c9a3[_0xab45('0x157')]=_0x4d0a65[_0xab45('0x158')]||0x1388;}if(_0x4d0a65[_0xab45('0x49')]===_0xab45('0x149')){_0x22c9a3[_0xab45('0x159')]=_0xd98cc1['VoiceQueueId'];}else{_0x22c9a3[_0xab45('0x15a')]=_0xd98cc1[_0xab45('0x111')];}for(var _0x1371c6 in _0xd98cc1[_0xab45('0x143')]){if(_0xd98cc1['Contact'][_0xab45('0x94')](_0x1371c6)){if(isNotNull(_0xd98cc1[_0xab45('0x143')][_0x1371c6])&&_0x1371c6!=='id'&&_0x1371c6!==_0xab45('0x15b')&&_0x1371c6!==_0xab45('0x15c')&&_0x1371c6!=='updatedAt'){_0x22c9a3[util[_0xab45('0x70')](_0xab45('0x15d'),_0xab45('0x15e'),_[_0xab45('0x15f')](_0x1371c6))]=_0xd98cc1[_0xab45('0x143')][_0x1371c6];}}}var _0x381d5d=_0x500f27[_0xab45('0xcb')](_0x4d0a65['Trunk'])?getCallerId(_0x4d0a65[_0xab45('0x6e')]['callerid'],_0x4d0a65[_0xab45('0x55')],_0x4d0a65['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4d0a65[_0xab45('0x160')],_0x4d0a65['dialRandomLastDigitCallerIdNumber']):_0x4d0a65[_0xab45('0x160')]):getCallerId(_[_0xab45('0xa8')](_0x4d0a65[_0xab45('0x116')])?_0x4d0a65[_0xab45('0x6e')][_0xab45('0x161')]:_0x4d0a65[_0xab45('0x116')][_0xab45('0x161')],_0x4d0a65['dialOriginateCallerIdName'],_0x4d0a65[_0xab45('0x162')]>0x0?getCallerIdRandom(_0x4d0a65[_0xab45('0x160')],_0x4d0a65[_0xab45('0x162')]):_0x4d0a65[_0xab45('0x160')]);if(_0x381d5d){_0x22c9a3[_0xab45('0x163')]=_0x500f27[_0xab45('0x25')][_0x584182][_0xab45('0x164')]=extractCalleridName(_0x381d5d);_0x22c9a3['XMD-ORIGINATECALLERIDNUM']=_0x500f27['actions'][_0x584182]['originatecalleridnum']=extractCalleridNumber(_0x381d5d);}return ami[_0xab45('0xa9')]({'actionid':_0x584182,'action':_0xab45('0x141'),'channel':_0x500f27[_0xab45('0xcb')](_0x4d0a65['Trunk'])?util[_0xab45('0x70')]('SIP/%s/%s%s',_0x4d0a65[_0xab45('0x6e')][_0xab45('0x3c')],isNotNull(_0x4d0a65[_0xab45('0x165')])?_0x4d0a65[_0xab45('0x165')][_0xab45('0x166')]()||'':'',_0x4d0a65[_0xab45('0x167')]>0x0?_0xd98cc1[_0xab45('0x143')][_0xab45('0x144')][_0xab45('0x168')](_0x4d0a65[_0xab45('0x167')]):_0xd98cc1[_0xab45('0x143')][_0xab45('0x144')]):util[_0xab45('0x70')]('SIP/%s/%s%s',_[_0xab45('0xa8')](_0x4d0a65[_0xab45('0x116')])?_0x4d0a65[_0xab45('0x6e')][_0xab45('0x3c')]:_0x4d0a65[_0xab45('0x116')]['name'],isNotNull(_0x4d0a65[_0xab45('0x165')])?_0x4d0a65[_0xab45('0x165')][_0xab45('0x166')]()||'':'',_0x4d0a65[_0xab45('0x167')]>0x0?_0xd98cc1['Contact'][_0xab45('0x144')][_0xab45('0x168')](_0x4d0a65[_0xab45('0x167')]):_0xd98cc1[_0xab45('0x143')][_0xab45('0x144')]),'callerid':_0x381d5d,'Exten':_0xab45('0xd1'),'Context':'from-sip','Priority':'1','variable':_0x22c9a3,'timeout':(_0x4d0a65[_0xab45('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x584182})['then'](function(_0x4129b7){return _0x56d101(_0x4129b7);})[_0xab45('0xb4')](function(_0x105340){_0x4d0a65['outboundOriginateFailureCallsDay']+=0x1;var _0x3ec059=new History(_0x500f27['actions'][_0x584182]);logger[_0xab45('0x91')](util[_0xab45('0x70')](_0xab45('0x169'),JSON[_0xab45('0x46')](_0x105340)));_0x3ec059[_0xab45('0xa2')]=0xe;_0x3ec059[_0xab45('0xa3')]=_0xab45('0x16a');_0x3ec059[_0xab45('0x16b')]=moment()[_0xab45('0x70')](_0xab45('0xed'));_0x3ec059[_0xab45('0x16c')]=_0x3ec059['starttime'];_0x500f27['createHistory'](_0x3ec059)[_0xab45('0xb4')](loggerCatch('[originate][error]'));_0x500f27[_0xab45('0xbf')](_0x3ec059)[_0xab45('0xb4')](loggerCatch('[originate][error]'))[_0xab45('0x1d')](function(){delete _0x500f27[_0xab45('0x25')][_0x584182];return _0x3a18d9(msgResponse(_0xab45('0x141'),_0xab45('0x45'),_0xab45('0x16d')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x115d42){var _0x40a479=this[_0xab45('0x25')][_0x115d42['actionid']];var _0x2d1113=this;if(_0x40a479){delete this[_0xab45('0x25')][_0x115d42[_0xab45('0xfb')]];_0x40a479[_0xab45('0xf4')]=moment()[_0xab45('0x70')](_0xab45('0xed'));var _0x7604be=_0x40a479[_0xab45('0x49')]===_0xab45('0x73')?this['campaigns'][_0x40a479[_0xab45('0xad')]]:this['voiceQueues'][_0x40a479[_0xab45('0x16e')]()];if(!this[_0xab45('0x16f')](_0x115d42[_0xab45('0x170')])){this[_0xab45('0xac')](_0x7604be);return this[_0xab45('0x171')](_0x40a479,_0x7604be,_0x115d42)['then'](function(_0x4de21c){})[_0xab45('0xb4')](loggerCatch(_0xab45('0x172')));}else{this[_0xab45('0x26')][_0x115d42[_0xab45('0xcd')]]=_0x40a479;}}};Dialer['prototype'][_0xab45('0x173')]=function(_0x57394f,_0x56cd60,_0x350e10){var _0x2c2c90=new History(_0x56cd60);if(_0x2c2c90[_0xab45('0x174')]+_0x2c2c90[_0xab45('0x175')]+_0x2c2c90['countnoanswerretry']>=_0x350e10[_0xab45('0x176')]-0x1){return!![];}switch(_0x57394f){case 0x3:if(_0x2c2c90[_0xab45('0x177')]>=_0x350e10[_0xab45('0x178')]-0x1){return!![];}else{this[_0xab45('0xb9')]({'active':![],'countnoanswerretry':_0x2c2c90[_0xab45('0x177')]+=0x1,'scheduledat':moment()[_0xab45('0x179')](_0x350e10[_0xab45('0x17a')],_0xab45('0x17b'))[_0xab45('0x70')](_0xab45('0xed')),'ContactId':_0x2c2c90['ContactId'],'ListId':_0x2c2c90[_0xab45('0xc6')],'VoiceQueueId':_0x2c2c90[_0xab45('0xc8')]||undefined,'CampaignId':_0x2c2c90[_0xab45('0x111')]||undefined})[_0xab45('0xb4')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x2c2c90[_0xab45('0x174')]>=_0x350e10[_0xab45('0x17c')]-0x1){return!![];}else{this[_0xab45('0xb9')]({'active':![],'countbusyretry':_0x2c2c90[_0xab45('0x174')]+=0x1,'scheduledat':moment()['add'](_0x350e10[_0xab45('0x17d')],_0xab45('0x17b'))[_0xab45('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c2c90[_0xab45('0x110')],'ListId':_0x2c2c90[_0xab45('0xc6')],'VoiceQueueId':_0x2c2c90[_0xab45('0xc8')]||undefined,'CampaignId':_0x2c2c90['CampaignId']||undefined})[_0xab45('0xb4')](loggerCatch(_0xab45('0x17e')));}break;case 0x8:if(_0x2c2c90[_0xab45('0x175')]>=_0x350e10[_0xab45('0x17f')]-0x1){return!![];}else{this[_0xab45('0xb9')]({'active':![],'countcongestionretry':_0x2c2c90[_0xab45('0x175')]+=0x1,'scheduledat':moment()[_0xab45('0x179')](_0x350e10[_0xab45('0x180')],_0xab45('0x17b'))[_0xab45('0x70')](_0xab45('0xed')),'ContactId':_0x2c2c90[_0xab45('0x110')],'ListId':_0x2c2c90[_0xab45('0xc6')],'VoiceQueueId':_0x2c2c90[_0xab45('0xc8')]||undefined,'CampaignId':_0x2c2c90[_0xab45('0x111')]||undefined})[_0xab45('0xb4')](loggerCatch(_0xab45('0x181')));}break;default:return!![];}};Dialer['prototype'][_0xab45('0x171')]=function(_0x167297,_0x2b1539,_0x2ece40){var _0x42957d=this;var _0x2d75f4=new History(_0x167297);return new BPromise(function(_0x470c36,_0x38b554){if(_[_0xab45('0x7d')](_0x2b1539)&&_0xab45('0x140')!==typeof _0x2b1539){return _0x38b554(msgResponse(_0xab45('0x182'),_0xab45('0x11b'),_0xab45('0x183')));}if(_[_0xab45('0x7d')](_0x2ece40)&&_0xab45('0x140')!==typeof _0x2ece40){return _0x38b554(msgResponse(_0xab45('0x182'),_0xab45('0x11b'),'evt\x20is\x20undefine'));}switch(_0x2ece40[_0xab45('0x184')]){case'0':_0x2b1539[_0xab45('0x5e')]+=0x1;_0x2d75f4[_0xab45('0xa2')]=0x0;_0x2d75f4[_0xab45('0xa3')]=_0xab45('0x185');_0x42957d['createHistory'](_0x2d75f4)[_0xab45('0xb4')](loggerCatch(_0xab45('0x186')));if(_0x42957d[_0xab45('0x173')](0x0,_0x167297,_0x2b1539)){if(_0x2d75f4[_0xab45('0x174')]+_0x2d75f4['countcongestionretry']+_0x2d75f4[_0xab45('0x177')]>=_0x2b1539[_0xab45('0x176')]){_0x42957d[_0xab45('0x187')](_0x2d75f4,_0x470c36,_0x38b554,_0xab45('0x188'));}else{_0x42957d[_0xab45('0x189')](_0x2d75f4,_0x470c36,_0x38b554,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2b1539[_0xab45('0x18a')]+=0x1;_0x2d75f4[_0xab45('0xa2')]=0x3;_0x2d75f4[_0xab45('0xa3')]='NoAnswer';_0x2d75f4['countnoanswerretry']+=0x1;_0x2d75f4['countglobal']+=0x1;_0x42957d[_0xab45('0xc0')](_0x2d75f4)['catch'](loggerCatch(_0xab45('0x18b')));if(_0x42957d[_0xab45('0x173')](0x3,_0x167297,_0x2b1539)){if(_0x2d75f4['countnoanswerretry']>=_0x2b1539[_0xab45('0x178')]){_0x42957d[_0xab45('0x189')](_0x2d75f4,_0x470c36,_0x38b554,_0xab45('0x18c'));}else{_0x42957d[_0xab45('0x187')](_0x2d75f4,_0x470c36,_0x38b554,_0xab45('0x18c'));}}break;case'5':_0x2b1539['outboundBusyCallsDay']+=0x1;_0x2d75f4['state']=0x5;_0x2d75f4[_0xab45('0xa3')]=_0xab45('0x18d');_0x2d75f4[_0xab45('0x174')]+=0x1;_0x2d75f4[_0xab45('0x18e')]+=0x1;_0x42957d[_0xab45('0xc0')](_0x2d75f4)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x42957d[_0xab45('0x173')](0x5,_0x167297,_0x2b1539)){if(_0x2d75f4[_0xab45('0x174')]>=_0x2b1539[_0xab45('0x17c')]){_0x42957d[_0xab45('0x189')](_0x2d75f4,_0x470c36,_0x38b554,'reason\x205\x20busy');}else{_0x42957d['stateGlobal'](_0x2d75f4,_0x470c36,_0x38b554,_0xab45('0x18f'));}}break;case'8':_0x2b1539[_0xab45('0x5a')]+=0x1;_0x2d75f4['state']=0x8;_0x2d75f4['statedesc']=_0xab45('0x190');_0x2d75f4['countcongestionretry']+=0x1;_0x2d75f4['countglobal']+=0x1;_0x42957d[_0xab45('0xc0')](_0x2d75f4)[_0xab45('0xb4')](loggerCatch(_0xab45('0x191')));if(_0x42957d[_0xab45('0x173')](0x8,_0x167297,_0x2b1539)){if(_0x2d75f4['countcongestionretry']>=_0x2b1539[_0xab45('0x17f')]){_0x42957d[_0xab45('0x189')](_0x2d75f4,_0x470c36,_0x38b554,_0xab45('0x192'));}else{_0x42957d['stateGlobal'](_0x2d75f4,_0x470c36,_0x38b554,_0xab45('0x192'));}}break;default:_0x2b1539[_0xab45('0xe7')]+=0x1;_0x2d75f4['state']=0xc;_0x2d75f4['statedesc']=_0x2ece40[_0xab45('0x184')];_0x42957d[_0xab45('0xc0')](_0x2d75f4)['catch'](loggerCatch(_0xab45('0x193')));if(_0x42957d[_0xab45('0x173')](_0x2ece40[_0xab45('0x184')],_0x167297,_0x2b1539)){if(_0x2d75f4[_0xab45('0x174')]+_0x2d75f4['countcongestionretry']+_0x2d75f4[_0xab45('0x177')]>=_0x2b1539[_0xab45('0x176')]){_0x42957d[_0xab45('0x187')](_0x2d75f4,_0x470c36,_0x38b554,_0x2ece40[_0xab45('0x184')]);}else{_0x42957d[_0xab45('0x189')](_0x2d75f4,_0x470c36,_0x38b554,_0x2ece40[_0xab45('0x184')]);}}}});};Dialer[_0xab45('0x1b')]['stateGlobal']=function(_0x1a1536,_0x213f70,_0x3a7f43,_0x3228d0){var _0x27f4aa=new Final(_0x1a1536);_0x27f4aa[_0xab45('0xa2')]=0xf;_0x27f4aa[_0xab45('0xa3')]=_0xab45('0x194');this[_0xab45('0x189')](_0x27f4aa,_0x213f70,_0x3a7f43,_0x3228d0);};Dialer[_0xab45('0x1b')]['createStateFinal']=function(_0xf8fb8,_0x3df994,_0x319ea4,_0x5050f4){this[_0xab45('0xbf')](_0xf8fb8)['then'](function(_0x5caee6){return _0x3df994(msgResponse(_0xab45('0x182'),_0xab45('0xca'),_0x5050f4));})['catch'](function(_0x3430c7){return _0x319ea4(msgResponse(_0xab45('0x195'),'Failure',_0xab45('0x196')));});};Dialer[_0xab45('0x1b')][_0xab45('0x8')]=function(_0x44793d){var _0xdbf7c7=this;var _0x304020=_0x44793d[_0xab45('0x197')]/0x64;var _0x82a75a=_0x44793d['outboundDropCallsDayTimeout']/(_0x44793d[_0xab45('0x5d')]+_0x44793d[_0xab45('0x57')]);var _0x416afb=Math['round'](_0x44793d[_0xab45('0x198')]*(_0x44793d[_0xab45('0x199')]/0x64));var _0x149e6e=Math[_0xab45('0x19a')](_0x44793d[_0xab45('0x198')]*(_0x44793d[_0xab45('0x19b')]/0x64));var _0x193630=_0x44793d[_0xab45('0x19c')]+_0x44793d[_0xab45('0x9c')];var _0x24a4d9=Math[_0xab45('0x19d')](_0x44793d[_0xab45('0x6a')]*_0x44793d[_0xab45('0x6c')]*_0x44793d[_0xab45('0x67')]*_0x44793d['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x44793d[_0xab45('0x89')])){if(!_[_0xab45('0x7d')](_0x44793d[_0xab45('0x28')])){_0x44793d[_0xab45('0x28')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xab45('0x19e'));}if(!_[_0xab45('0x7d')](_0x44793d[_0xab45('0x8b')])){loggerPredictive[_0xab45('0x91')]('[startMethodPredictive][StartProgressive]',_0xab45('0x19f'));clearInterval(_0x44793d[_0xab45('0x8b')]);_0x44793d[_0xab45('0x8b')]=undefined;}_0x44793d[_0xab45('0x89')]=moment()[_0xab45('0x70')](_0xab45('0xed'));loggerPredictive[_0xab45('0x76')](_0x44793d[_0xab45('0x3c')],_0xab45('0x1a0'),_0x44793d[_0xab45('0x89')]);this[_0xab45('0x131')](_0x44793d,0x1);}else if(ifInterval(_0x44793d[_0xab45('0x1a1')],_0x44793d[_0xab45('0x89')])){this[_0xab45('0x131')](_0x44793d,0x1);loggerPredictiveCalls[_0xab45('0x76')](_0xab45('0x1a2'),_0x44793d[_0xab45('0x89')],_0x44793d[_0xab45('0x3c')]);_0x44793d[_0xab45('0x6a')]=0x0;_0x44793d['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x304020<_0x82a75a&&_0x44793d['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x44793d);loggerPredictive[_0xab45('0x76')](_0xab45('0x1a3'),_0xab45('0x1a4'),_0x82a75a,'startProgressive',_0x44793d[_0xab45('0x3c')]);}else if(_0x24a4d9<_0x44793d[_0xab45('0x66')]&&_0x44793d[_0xab45('0x1a5')]===_0xab45('0x1a6')){freeVariablesPredictive(_0x44793d);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xab45('0x1a7'),_0x24a4d9,_0xab45('0x1a8'),_0x44793d[_0xab45('0x66')],_0xab45('0x89'),_0x44793d[_0xab45('0x3c')]);}else if(!ifInterval(_0x44793d[_0xab45('0x1a1')],_0x44793d['startProgressive'])&&_[_0xab45('0x7d')](_0x44793d[_0xab45('0x28')])&&!_[_0xab45('0x7d')](_0x44793d[_0xab45('0x89')])){_0x44793d[_0xab45('0x28')]=moment()[_0xab45('0x70')](_0xab45('0xed'));loggerPredictive[_0xab45('0x76')](_0x44793d[_0xab45('0x3c')],'started\x20in\x20predictive\x20at',_0x44793d[_0xab45('0x28')]);this[_0xab45('0x1a9')](_0x44793d[_0xab45('0x1a1')])[_0xab45('0xb0')](this[_0xab45('0x1aa')](_0x44793d))[_0xab45('0xb0')](mergeDataErlangB(_0x44793d))[_0xab45('0xb0')](this[_0xab45('0x1ab')](_0x44793d))[_0xab45('0xb4')](loggerCatchPredictive(_0xab45('0x1ac'),_0x44793d));}else if(!ifInterval(_0x44793d[_0xab45('0x1a1')],_0x44793d[_0xab45('0x28')])){_0x44793d[_0xab45('0x66')]=0x0;_0x44793d[_0xab45('0x28')]=moment()[_0xab45('0x70')](_0xab45('0xed'));loggerPredictive['info'](_0x44793d[_0xab45('0x3c')],_0xab45('0x1ad'),_0x44793d[_0xab45('0x28')]);clearInterval(_0x44793d[_0xab45('0x8b')]);_0x44793d[_0xab45('0x8b')]=undefined;this['averageHandleTime'](_0x44793d[_0xab45('0x1a1')])[_0xab45('0xb0')](this[_0xab45('0x1aa')](_0x44793d))['then'](mergeDataErlangB(_0x44793d))[_0xab45('0xb0')](this[_0xab45('0x1ab')](_0x44793d))[_0xab45('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x44793d));}else if(_0x44793d[_0xab45('0x198')]&&_0x193630<_0x44793d['predictiveIntervalAvailable']-_0x149e6e){freeVariablesPredictive(_0x44793d);loggerPredictive[_0xab45('0x76')](_0x44793d[_0xab45('0x3c')],_0xab45('0x1ae'),_0x193630,_0xab45('0x1af'),_0x44793d[_0xab45('0x198')],'-',_0x149e6e,'=',_0x44793d[_0xab45('0x198')]-_0x149e6e,')');}else if(_0x44793d[_0xab45('0x198')]&&_0x193630>_0x44793d[_0xab45('0x198')]+_0x416afb){freeVariablesPredictive(_0x44793d);loggerPredictive[_0xab45('0x76')](_0x44793d[_0xab45('0x3c')],_0xab45('0x1ae'),_0x193630,_0xab45('0x1b0'),_0x44793d[_0xab45('0x198')],'+',_0x416afb,'=',_0x44793d['predictiveIntervalAvailable']+_0x416afb,')');}};Dialer['prototype'][_0xab45('0x1aa')]=function(_0x7cd81){var _0x1bc24f=this;return function(_0x19dafb){return new BPromise(function(_0x1d8fd7,_0x1c79e7){_[_0xab45('0x86')](_0x7cd81,_0x19dafb[0x0]);if(checkGetDataPredictive(_0x19dafb[0x0])){var _0x44ed9d=_0x7cd81[_0xab45('0x198')]=_0x7cd81[_0xab45('0x9c')]+_0x7cd81[_0xab45('0x19c')];var _0x737f7b=_0x7cd81['dialPredictiveInterval']*0x3c;var _0x34ec84=_0x19dafb[0x0][_0xab45('0x63')]+_0x19dafb[0x0][_0xab45('0x7f')];var _0x2bab3c=(_0x19dafb[0x0][_0xab45('0x62')]+_0x19dafb[0x0][_0xab45('0x65')]+_0x19dafb[0x0][_0xab45('0x64')])/_0x19dafb[0x0]['predictiveIntervalTotalCalls'];_0x7cd81[_0xab45('0x67')]=_0x2bab3c>0x0?_0x2bab3c:0x1;switch(_0x7cd81[_0xab45('0x1a5')]){case'dropRate':var _0x5e9e5e=_0x7cd81[_0xab45('0x197')]/0x64;return _0x1bc24f[_0xab45('0x1b1')](_0x44ed9d,_0x737f7b,_0x34ec84,_0x2bab3c,_0x5e9e5e)[_0xab45('0xb0')](function(_0x1db34c){return _0x1d8fd7(_0x1db34c);});case _0xab45('0x1b2'):var _0x2aa3bd=_0x7cd81[_0xab45('0x197')]/0x64;return _0x1bc24f[_0xab45('0x1b3')](_0x44ed9d,_0x737f7b,_0x34ec84,_0x2bab3c,_0x2aa3bd)['then'](function(_0x4951df){return _0x1d8fd7(_0x4951df);});default:return _0x1c79e7(msgResponse(_0xab45('0x1b4'),_0xab45('0x11b'),_0xab45('0x1b5')));}}else{return _0x1c79e7(msgResponse(_0xab45('0x1b4'),'Failure',_0xab45('0x1b6')));}});};};Dialer[_0xab45('0x1b')][_0xab45('0x1b7')]=function(_0x53ead5){var _0x4a1a51=this;return function(_0x20ffca){return new BPromise(function(_0x162d2f,_0x1e8917){_['merge'](_0x53ead5,_0x20ffca[0x0]);if(checkGetDataPredictive(_0x20ffca[0x0])){loggerPredictive[_0xab45('0x76')](JSON[_0xab45('0x46')](_0x20ffca[0x0]));if(_0x53ead5[_0xab45('0x1a5')]===_0xab45('0x1a6')){return _0x4a1a51[_0xab45('0xbd')](_0x53ead5['id'])[_0xab45('0xb0')](function(_0x37265b){var _0x52c552=_0x53ead5['loggedIn']-_0x37265b[0x0][_0xab45('0x1b8')];var _0x53650a=_0x53ead5['dialPredictiveInterval']*0x3c;var _0x39e582=_0x20ffca[0x0][_0xab45('0x63')]+_0x20ffca[0x0]['predictiveIntervalAvgHoldtime'];var _0x5ab2fa=(_0x20ffca[0x0][_0xab45('0x62')]+_0x20ffca[0x0][_0xab45('0x65')]+_0x20ffca[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x20ffca[0x0]['predictiveIntervalTotalCalls'];var _0xa0a0fb=_0x53ead5[_0xab45('0x197')]/0x64;_0x53ead5[_0xab45('0x1b9')]=_0x37265b[0x0][_0xab45('0x1b8')]||0x0;_0x53ead5['predictiveIntervalHitRate']=_0x5ab2fa>0x0?_0x5ab2fa:0x1;return _0x4a1a51[_0xab45('0x1b1')](_0x52c552,_0x53650a,_0x39e582,_0x5ab2fa,_0xa0a0fb);})[_0xab45('0xb0')](function(_0x3d7055){return _0x162d2f(_0x3d7055);})[_0xab45('0xb4')](function(_0x8357ce){return _0x1e8917(msgResponse(_0xab45('0x1ba'),_0xab45('0x11b'),JSON[_0xab45('0x46')](_0x8357ce)));});}if(_0x53ead5[_0xab45('0x1a5')]===_0xab45('0x1b2')){return _0x4a1a51[_0xab45('0xbd')](_0x53ead5['id'])[_0xab45('0xb0')](function(_0x4bfe9f){var _0x3dfca8=_0x53ead5[_0xab45('0x4c')]-_0x4bfe9f[0x0][_0xab45('0x1b8')];var _0x445cc2=_0x53ead5[_0xab45('0x1a1')]*0x3c;var _0x2fa87f=_0x20ffca[0x0][_0xab45('0x63')]+_0x20ffca[0x0][_0xab45('0x7f')];var _0x323f8c=(_0x20ffca[0x0][_0xab45('0x62')]+_0x20ffca[0x0][_0xab45('0x65')]+_0x20ffca[0x0][_0xab45('0x64')])/_0x20ffca[0x0]['predictiveIntervalTotalCalls'];var _0x55c0d1=_0x53ead5[_0xab45('0x197')]/0x64;_0x53ead5['predictiveIntervalPauses']=_0x4bfe9f[0x0][_0xab45('0x1b8')]||0x0;_0x53ead5[_0xab45('0x67')]=_0x323f8c>0x0?_0x323f8c:0x1;return _0x4a1a51['busyFactor'](_0x3dfca8,_0x445cc2,_0x2fa87f,_0x323f8c,_0x55c0d1);})[_0xab45('0xb0')](function(_0x466659){return _0x162d2f(_0x466659);})['catch'](function(_0x34655b){return _0x1e8917(msgResponse(_0xab45('0x1ba'),_0xab45('0x11b'),JSON[_0xab45('0x46')](_0x34655b)));});}}else{return _0x1e8917(msgResponse(_0xab45('0x1b4'),_0xab45('0x11b'),_0xab45('0x1b6')));}});};};Dialer[_0xab45('0x1b')][_0xab45('0x1ab')]=function(_0x4c3e75){var _0xacd687=this;return function(){var _0x339a2b=0x0;var _0x2a8398=Math['floor'](_0x4c3e75[_0xab45('0x6b')]*0x3e8);if(_0x2a8398>0x0){_0x2a8398=_0x2a8398<0x64?0x64:_0x2a8398;loggerPredictive[_0xab45('0x76')](_0x4c3e75[_0xab45('0x3c')],'one\x20call\x20every:',_0x2a8398,_0xab45('0x47'));_0x4c3e75[_0xab45('0x8b')]=setInterval(function(){_0xacd687['handlePredictive'](_0x4c3e75);loggerPredictiveCalls[_0xab45('0x76')](_0xab45('0x1bb'),_0x339a2b+=0x1);},_0x2a8398);}else{loggerPredictive['info'](_0x4c3e75[_0xab45('0x3c')],_0xab45('0x1bc'));}};};Dialer[_0xab45('0x1b')][_0xab45('0x1bd')]=function(_0x5fed1b,_0xb82f15){var _0x4b3d27=this;return function(_0x33b913){if(_['isEmpty'](_0x33b913)){if(_[_0xab45('0xa8')](_0xb82f15[_0xab45('0xc7')])||!_0xb82f15['recallme']){if(_0x5fed1b[_0xab45('0x54')]===_0xab45('0x7')){_0x5fed1b[_0xab45('0x103')]=_[_0xab45('0x7d')](_0x5fed1b[_0xab45('0x103')])?!![]:_0x5fed1b['queueStatusComplete'];var _0x25ec78=uuid['v4']();_0x4b3d27['actions'][_0x25ec78]=new Action(_0x5fed1b,_0xb82f15,_0x25ec78);loggerBooked[_0xab45('0x76')](_0xab45('0x1be'),_0x25ec78,_0xab45('0x1bf'),JSON[_0xab45('0x46')](_0x5fed1b[_0xab45('0x103')]),_0xab45('0x1c0'),_0x5fed1b[_0xab45('0x3c')]);if(_0x5fed1b[_0xab45('0x103')]){_0x5fed1b[_0xab45('0x103')]=![];_0x4b3d27[_0xab45('0x100')][_0x4b3d27[_0xab45('0x25')][_0x25ec78]['queue']]=[];ami[_0xab45('0xa9')]({'actionid':_0x25ec78,'action':'queuestatus','queue':_0x5fed1b[_0xab45('0x3c')]})[_0xab45('0xb4')](function(_0x39d4d0){_0x4b3d27[_0xab45('0xac')](_0x5fed1b);_0x4b3d27['rescheduleContact']({'active':![],'ContactId':_0x4b3d27[_0xab45('0x25')][_0x25ec78]['ContactId'],'ListId':_0x4b3d27[_0xab45('0x25')][_0x25ec78][_0xab45('0xc6')],'VoiceQueueId':_0x4b3d27['actions'][_0x25ec78][_0xab45('0xc8')]||undefined,'CampaignId':_0x4b3d27[_0xab45('0x25')][_0x25ec78][_0xab45('0x111')]||undefined})[_0xab45('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4b3d27[_0xab45('0x25')][_0x25ec78];});}else{loggerBooked[_0xab45('0x76')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x5fed1b[_0xab45('0x103')]),'Queue:\x20',_0x5fed1b[_0xab45('0x3c')]);_0x4b3d27[_0xab45('0xac')](_0x5fed1b);_0x4b3d27['rescheduleContact']({'active':![],'ContactId':_0x4b3d27[_0xab45('0x25')][_0x25ec78][_0xab45('0x110')],'ListId':_0x4b3d27[_0xab45('0x25')][_0x25ec78]['ListId'],'VoiceQueueId':_0x4b3d27['actions'][_0x25ec78][_0xab45('0xc8')]||undefined,'CampaignId':_0x4b3d27[_0xab45('0x25')][_0x25ec78][_0xab45('0x111')]||undefined})[_0xab45('0xb4')](loggerCatch(_0xab45('0x1c1')));delete _0x4b3d27[_0xab45('0x25')][_0x25ec78];}}else{return _0x4b3d27[_0xab45('0x13f')](_0x5fed1b,_0xb82f15);}}else{if(getDiff(_0xb82f15[_0xab45('0x1c2')])<_0x5fed1b['dialRecallMeTimeout']*0x3c){_0x4b3d27[_0xab45('0x104')][_0xab45('0x105')](_0xb82f15['id'])[_0xab45('0x1d')](function(){_0x4b3d27[_0xab45('0xac')](_0x5fed1b);});}else{_0x5fed1b[_0xab45('0x60')]+=0x1;_0x4b3d27[_0xab45('0xac')](_0x5fed1b);if(_0x5fed1b[_0xab45('0x1c3')]){_0x4b3d27[_0xab45('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb82f15[_0xab45('0x110')],'ListId':_0xb82f15[_0xab45('0xc6')],'VoiceQueueId':_0xb82f15[_0xab45('0xc8')]||undefined,'CampaignId':_0xb82f15[_0xab45('0x111')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x4b3d27[_0xab45('0xc0')](createObjHistory(_0x5fed1b,_0xb82f15,'RECALLINQUEUE',0x17,_0xab45('0x1c4')))[_0xab45('0xb4')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4b3d27['saveInDb'](createObjHistory(_0x5fed1b,_0xb82f15,_0xab45('0x1c5'),0x16,_0xab45('0x1c6')),_0xab45('0x1c7'),_0xab45('0x1c8'));}}}}else{_0x5fed1b[_0xab45('0x58')]+=0x1;_0x4b3d27[_0xab45('0xc4')](createObjHistory(_0x5fed1b,_0xb82f15,_0xab45('0x1c9'),0xd,_0xab45('0x1ca')),_0xab45('0x1cb'),_0xab45('0x1cc'));throw'inBlackList';}};};Dialer['prototype'][_0xab45('0x1cd')]=function(_0x23e244){var _0xf9f154=this;var _0x497aa5=[];var _0x35a242=_0x23e244[_0xab45('0x1ce')]-_0x23e244[_0xab45('0x69')]-_0x23e244['temp'];emitCampaignSummary(_0x23e244);if(_0x35a242>0x0){if(_0x35a242>this['maxNumberOriginate']){_0x35a242=this[_0xab45('0x23')];}_0x23e244[_0xab45('0x1cf')]+=_0x35a242;this[_0xab45('0xbc')](_0x23e244['id'],_0x35a242,_0x23e244[_0xab45('0x1d0')])[_0xab45('0xb0')](function(_0x2676b2){_0x23e244['temp']-=_0x35a242;_0x23e244[_0xab45('0x1cf')]=_0x23e244[_0xab45('0x1cf')]>0x0?_0x23e244[_0xab45('0x1cf')]:0x0;if(!checkContactEmpty(_0x2676b2)){_0x23e244['message']=_0xab45('0x99');logger[_0xab45('0x76')](_0xab45('0x1d1')+_0x23e244[_0xab45('0x3c')]);}else{_0x23e244['originated']+=_0x2676b2['length'];_0x23e244[_0xab45('0x3a')]=_0xab45('0x1d2');for(var _0x5ea886=0x0;_0x5ea886<_0x2676b2['length'];_0x5ea886+=0x1){_0x23e244[_0xab45('0x1d3')]+=0x1;if(_[_0xab45('0xa8')](_0x2676b2[_0x5ea886])||_[_0xab45('0xa8')](_0x2676b2[_0x5ea886][_0xab45('0x143')])||_[_0xab45('0xa8')](_0x2676b2[_0x5ea886][_0xab45('0x143')]['phone'])){_0xf9f154[_0xab45('0xc3')](_0xab45('0x1d4'),_0x23e244,_0x2676b2[_0x5ea886]);}else{_0xf9f154[_0xab45('0xb5')](_[_0xab45('0xc5')](_0x2676b2[_0x5ea886],[_0xab45('0x111'),_0xab45('0x1d5')]))[_0xab45('0xb0')](_0xf9f154[_0xab45('0x1bd')](_0x23e244,_0x2676b2[_0x5ea886]))[_0xab45('0xb4')](_0xf9f154['loggerHandler'](_0xab45('0x1d6'),_0x23e244));}}}})[_0xab45('0xb4')](loggerGetContactDialer(_0xab45('0x1d7'),_0x23e244,_0x35a242));}};Dialer[_0xab45('0x1b')][_0xab45('0x131')]=function(_0x1db025,_0x45449f){var _0x480e06=this;var _0x4466d7=[];var _0x1f0fde=_0x45449f>=0x1?_0x45449f:0x1;var _0x3b926f=[];if(_0x1db025[_0xab45('0x54')]===_0xab45('0x7')){_0x1f0fde=0x1;}var _0x192216=Math[_0xab45('0x19d')](_0x1db025['available']*_0x1f0fde)-_0x1db025['originated']-_0x1db025[_0xab45('0x1cf')];emitVoiceQueueSummary(_0x1db025);if(_0x1db025[_0xab45('0x1d8')]>0x0){var _0x2b0102=_0x1db025[_0xab45('0x1d8')]-_0x1db025[_0xab45('0x69')]-_0x1db025[_0xab45('0x9c')]-_0x1db025[_0xab45('0x1cf')]-_0x1db025[_0xab45('0x4d')];if(_0x192216>_0x2b0102){_0x192216=_0x2b0102;}}if(_0x192216>0x0){if(_0x1db025[_0xab45('0x54')]===_0xab45('0x7')){_0x192216=0x1;}if(_0x192216>this[_0xab45('0x23')]){_0x192216=this[_0xab45('0x23')];}_0x1db025[_0xab45('0x1cf')]+=_0x192216;for(var _0x19c195 in this[_0xab45('0x21')]){if(this[_0xab45('0x21')][_0xab45('0x94')](_0x19c195)){if(this[_0xab45('0x21')][_0x19c195][_0xab45('0xa2')]===_0xab45('0x1d9')&&this[_0xab45('0x21')][_0x19c195]['status']===_0xab45('0x1da')){_0x4466d7[_0xab45('0x122')](this[_0xab45('0x21')][_0x19c195]['id']);}}}this['getContactDialer'](_0x1db025['id'],_0x4466d7,_0x192216,_0x1db025[_0xab45('0x1d0')])[_0xab45('0xb0')](function(_0x316e62){_0x1db025[_0xab45('0x1cf')]-=_0x192216;_0x1db025[_0xab45('0x1cf')]=_0x1db025[_0xab45('0x1cf')]>0x0?_0x1db025['temp']:0x0;if(!checkContactEmpty(_0x316e62)){_0x480e06[_0xab45('0xb1')](_0x1db025)[_0xab45('0xb0')](sendMessageReschedule(_0x1db025))[_0xab45('0xb4')](loggerCatch('[countReScheduled]\x20'));}else{_0x1db025[_0xab45('0x69')]+=_0x316e62[_0xab45('0x93')];_0x1db025['message']=_0x1db025[_0xab45('0x54')]===_0xab45('0x7')?_0xab45('0x1db'):_0xab45('0x1d2');for(var _0x50ef1f=0x0;_0x50ef1f<_0x316e62[_0xab45('0x93')];_0x50ef1f+=0x1){if(_['isNil'](_0x316e62[_0x50ef1f])||_[_0xab45('0xa8')](_0x316e62[_0x50ef1f][_0xab45('0x143')])||_['isNil'](_0x316e62[_0x50ef1f][_0xab45('0x143')][_0xab45('0x144')])){_0x480e06['emptyContact'](_0xab45('0x1d4'),_0x1db025,_0x316e62[_0x50ef1f]);}else{_0x480e06[_0xab45('0xb3')](_[_0xab45('0xc5')](_0x316e62[_0x50ef1f],['VoiceQueueId',_0xab45('0x1d5')]))[_0xab45('0xb0')](_0x480e06['checkContactBlack'](_0x1db025,_0x316e62[_0x50ef1f]))[_0xab45('0xb4')](_0x480e06[_0xab45('0xc2')](_0xab45('0x1d4'),_0x1db025));}}}})[_0xab45('0xb4')](loggerGetContactDialer(_0xab45('0x1dc'),_0x1db025,_0x192216));}};Dialer[_0xab45('0x1b')][_0xab45('0x8b')]=function(_0x209b02){var _0x23f1bb=this;if(_0x209b02[_0xab45('0x1d8')]>0x0){var _0x418794=_0x209b02['dialLimitQueue']-_0x209b02['originated']-_0x209b02['talking'];if(_0x418794>0x0){this['tryOriginatePredictive'](_0x209b02);}else{loggerPredictiveCalls['info'](_0xab45('0x1dd'));}}else{this[_0xab45('0x1de')](_0x209b02);}};Dialer[_0xab45('0x1b')]['tryOriginatePredictive']=function(_0x3be59e){var _0x29d006=this;var _0x5b0e19=[];_0x3be59e[_0xab45('0x69')]+=0x1;for(var _0x32fc47 in this['agents']){if(this['agents']['hasOwnProperty'](_0x32fc47)){if(this['agents'][_0x32fc47]['state']===_0xab45('0x1d9')&&this[_0xab45('0x21')][_0x32fc47][_0xab45('0xaa')]===_0xab45('0x1da')){_0x5b0e19[_0xab45('0x122')](this[_0xab45('0x21')][_0x32fc47]['id']);}}}this[_0xab45('0xbb')](_0x3be59e['id'],_0x5b0e19,0x1,_0x3be59e[_0xab45('0x1d0')])[_0xab45('0xb0')](function(_0x4fbda4){if(!checkContactEmpty(_0x4fbda4)){checkContactLowerLimitOriginate(_0x3be59e,0x1,0x0);_0x29d006[_0xab45('0xb1')](_0x3be59e)[_0xab45('0xb0')](sendMessageReschedule(_0x3be59e))[_0xab45('0xb4')](loggerCatch(_0xab45('0xb2')));}else{_0x3be59e[_0xab45('0x3a')]=_0xab45('0x1d2');if(_[_0xab45('0xa8')](_0x4fbda4[0x0])||_['isNil'](_0x4fbda4[0x0][_0xab45('0x143')])||_[_0xab45('0xa8')](_0x4fbda4[0x0][_0xab45('0x143')][_0xab45('0x144')])){_0x29d006['emptyContact'](_0xab45('0x1d4'),_0x3be59e,_0x4fbda4[0x0]);}else{_0x29d006[_0xab45('0xb3')](_[_0xab45('0xc5')](_0x4fbda4[0x0],[_0xab45('0xc8'),_0xab45('0x1d5')]))[_0xab45('0xb0')](_0x29d006[_0xab45('0x1bd')](_0x3be59e,_0x4fbda4[0x0]))['catch'](_0x29d006['loggerHandler'](_0xab45('0x1df'),_0x3be59e));}}})['catch'](loggerGetContactDialer(_0xab45('0x1e0'),_0x3be59e,0x1));emitVoiceQueueSummary(_0x3be59e);};Dialer['prototype'][_0xab45('0x1b1')]=function(_0x35e905,_0x488fb1,_0x415f07,_0x1b2f30,_0x339d57,_0x4bd97f){loggerPredictive[_0xab45('0x76')](_0xab45('0x1e1'));loggerPredictive['info'](_0xab45('0x1e2'),_0x35e905);loggerPredictive[_0xab45('0x76')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x488fb1);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',_0x415f07);loggerPredictive['info'](_0xab45('0x1e3'),_0x1b2f30);loggerPredictive['info'](_0xab45('0x1e4'),_0x339d57);loggerPredictive['info'](_0xab45('0x85'));return new BPromise(function(_0x1ecf4f,_0x378d00){if(_0x35e905<=0x0||isNaN(_0x35e905)){return _0x378d00(msgResponse(_0xab45('0x1e5'),_0xab45('0x45'),'m\x20=\x20'+_0x35e905));}if(_0x415f07<=0x0||isNaN(_0x415f07)){return _0x378d00(msgResponse('[abandonmentRate]',_0xab45('0x45'),_0xab45('0x1e6')+_0x415f07));}if(_0x1b2f30<=0x0||isNaN(_0x1b2f30)){return _0x378d00(msgResponse(_0xab45('0x1e5'),_0xab45('0x45'),_0xab45('0x1e7')+_0x1b2f30));}if(_0x488fb1<=0x0||isNaN(_0x488fb1)){return _0x378d00(msgResponse('[abandonmentRate]',_0xab45('0x45'),'interval\x20=\x20'+_0x488fb1));}if(_0x339d57<=0x0||isNaN(_0x339d57)){return _0x378d00(msgResponse(_0xab45('0x1e5'),_0xab45('0x45'),_0xab45('0x1e8')+_0x339d57));}_0x4bd97f=_0x4bd97f||0x0;var _0x4d95ec=0x1/_0x415f07;var _0x2f5cc9=0x0;var _0x51889c=0x0;var _0x45f4b9=0x0;var _0x39bb37=0x0;for(var _0x2913b7=0x0;_0x45f4b9<_0x339d57;_0x2913b7+=0x1){_0x51889c=_0x2913b7/_0x488fb1;_0x2f5cc9=(_0x1b2f30*_0x51889c+_0x4bd97f)/_0x4d95ec;_0x45f4b9=erlangb(_0x2f5cc9,_0x35e905);_0x39bb37=_0x2f5cc9/_0x35e905*(0x1-erlangb(_0x2f5cc9,_0x35e905));}return _0x1ecf4f({'erlangCalls':_0x2913b7,'erlangCallToSecond':_0x488fb1/_0x2913b7,'erlangAbandonmentRate':_0x45f4b9,'erlangBusyFactor':_0x39bb37});});};Dialer['prototype'][_0xab45('0x1b3')]=function(_0x5e2c72,_0x50aa7f,_0x5df8da,_0x482f61,_0x642451,_0x2957b8){loggerPredictive[_0xab45('0x76')](_0xab45('0x1e9'));loggerPredictive[_0xab45('0x76')](_0xab45('0x1e2'),_0x5e2c72);loggerPredictive[_0xab45('0x76')](_0xab45('0x1ea'),_0x50aa7f);loggerPredictive[_0xab45('0x76')]('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',_0x5df8da);loggerPredictive[_0xab45('0x76')](_0xab45('0x1e3'),_0x482f61);loggerPredictive[_0xab45('0x76')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x642451);loggerPredictive[_0xab45('0x76')](_0xab45('0x85'));return new BPromise(function(_0x49a8fd,_0x883e35){if(_0x5e2c72<=0x0||isNaN(_0x5e2c72)){return _0x883e35(msgResponse(_0xab45('0x1eb'),'Error','m\x20=\x20'+_0x5e2c72));}if(_0x5df8da<=0x0||isNaN(_0x5df8da)){return _0x883e35(msgResponse(_0xab45('0x1eb'),'Error',_0xab45('0x1e6')+_0x5df8da));}if(_0x482f61<=0x0||isNaN(_0x482f61)){return _0x883e35(msgResponse(_0xab45('0x1eb'),_0xab45('0x45'),'p\x20=\x20'+_0x482f61));}if(_0x50aa7f<=0x0||isNaN(_0x50aa7f)){return _0x883e35(msgResponse(_0xab45('0x1eb'),_0xab45('0x45'),_0xab45('0x1ec')+_0x50aa7f));}if(_0x642451<=0x0||isNaN(_0x642451)){return _0x883e35(msgResponse(_0xab45('0x1eb'),_0xab45('0x45'),_0xab45('0x1ed')+_0x642451));}_0x2957b8=_0x2957b8||0x0;var _0xc4e239=0x1/_0x5df8da;var _0x5856bf=0x0;var _0x4b5527=0x0;var _0x311c0d=0x0;var _0x46c1d9=0x0;for(var _0x52b684=0x0;_0x46c1d9<_0x642451;_0x52b684+=0x1){_0x4b5527=_0x52b684/_0x50aa7f;_0x5856bf=(_0x482f61*_0x4b5527+_0x2957b8)/_0xc4e239;_0x311c0d=erlangb(_0x5856bf,_0x5e2c72);_0x46c1d9=_0x5856bf/_0x5e2c72*(0x1-erlangb(_0x5856bf,_0x5e2c72));}return _0x49a8fd({'erlangCalls':_0x52b684,'erlangCallToSecond':_0x50aa7f/_0x52b684,'erlangAbandonmentRate':_0x311c0d,'erlangBusyFactor':_0x46c1d9});});};module[_0xab45('0x1ee')]=Dialer; \ No newline at end of file +var _0x7564=['emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','reachable','SIP/%s','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','[syncHangupInAMD][createHistory]','MACHINE','AMD','[syncMachine][createHistory]','[syncMachine]','HangupInAMD','[syncHangupInAMDIvr]','Machine','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','Abandoned','CALLEREXIT','actionid','paused','stateinterface','locked','push','queueStatusComplete','idHopper','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','CampaignId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','predictive','Queue','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','phone','Contact','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','getCaller','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridnum','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','dialNoAnswerMaxRetry','add','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','minutes','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','[syncAgentComplete][createHistory][0]','dialGlobalMaxRetry','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','talking','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','bluebird','uuid','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','stringify','format','voice:queue:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','\x22%s\x22\x20<%s>','inspect','error','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','enqueue','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','updateOriginated'];(function(_0x498686,_0xfff2e6){var _0x48889f=function(_0x246496){while(--_0x246496){_0x498686['push'](_0x498686['shift']());}};_0x48889f(++_0xfff2e6);}(_0x7564,0x123));var _0x4756=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7564[_0x45e98e];return _0x374dba;};'use strict';var util=require(_0x4756('0x0'));var _=require('lodash');var BPromise=require(_0x4756('0x1'));var uuid=require(_0x4756('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x4756('0x3'));var Redis=require(_0x4756('0x4'));var config=require(_0x4756('0x5'));var logger=require(_0x4756('0x6'))(_0x4756('0x7'));var loggerBooked=require(_0x4756('0x6'))(_0x4756('0x8'));var loggerPredictive=require(_0x4756('0x6'))('predictive');var loggerPredictiveCalls=require(_0x4756('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x4756('0x6'))(_0x4756('0x9'));var ami=require(_0x4756('0xa'));config[_0x4756('0xb')]=_[_0x4756('0xc')](config[_0x4756('0xb')],{'host':_0x4756('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x4756('0xe'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x4756('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x4756('0x10'));var History=require(_0x4756('0x11'));var Final=require('./final');var AgentComplete=require(_0x4756('0x12'));var QueueCallerAbandon=require(_0x4756('0x13'));var Hangup=require('./hangup');var ipAgi=process[_0x4756('0x14')][_0x4756('0x15')]||_0x4756('0x16');var strategy={'rrmemory':_0x4756('0x17'),'roundrobin':_0x4756('0x18')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x29c109){this[_0x4756('0x19')]=this[_0x4756('0x19')]?this['tail'][_0x4756('0x1a')](_0x29c109):_0x29c109();};function Dialer(_0x1ce6f1,_0x91bbb6){this[_0x4756('0x1b')]=new Sequence();this['preview']=_0x91bbb6;this['voiceQueues']=_0x1ce6f1[_0x4756('0x1c')];this[_0x4756('0x1d')]=_0x1ce6f1['campaigns'];this[_0x4756('0x1e')]=_0x1ce6f1['agents'];this[_0x4756('0x1f')]=_0x1ce6f1[_0x4756('0x1f')];this[_0x4756('0x20')]=config[_0x4756('0x20')]||0x2;this[_0x4756('0x21')]={};this[_0x4756('0x22')]={};this[_0x4756('0x23')]={};this[_0x4756('0x24')]={};this[_0x4756('0x25')]={};this['startPredictive']={};this['startProgressive']={};this[_0x4756('0x26')]={};this[_0x4756('0x27')]={};this['queueBookedRR']={};ami['on'](_0x4756('0x28'),this[_0x4756('0x29')][_0x4756('0x2a')](this));ami['on'](_0x4756('0x2b'),this[_0x4756('0x2c')]['bind'](this));ami['on'](_0x4756('0x2d'),this[_0x4756('0x2e')][_0x4756('0x2a')](this));ami['on']('agentcomplete',this[_0x4756('0x2f')][_0x4756('0x2a')](this));ami['on'](_0x4756('0x30'),this['syncQueueSummary'][_0x4756('0x2a')](this));ami['on'](_0x4756('0x31'),this[_0x4756('0x32')]['bind'](this));ami['on'](_0x4756('0x33'),this[_0x4756('0x34')][_0x4756('0x2a')](this));ami['on'](_0x4756('0x35'),this['syncVarSet'][_0x4756('0x2a')](this));ami['on'](_0x4756('0x36'),this[_0x4756('0x37')][_0x4756('0x2a')](this));ami['on']('queuestatuscomplete',this[_0x4756('0x38')][_0x4756('0x2a')](this));this[_0x4756('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x1ac0fd){return _0x1ac0fd!==null&&!_[_0x4756('0x3a')](_0x1ac0fd);}function checkIsLoggedIn(_0x17c95b,_0x15c37c){return function(){if(_0x15c37c<=0x0){_0x17c95b[_0x4756('0x3b')]=_0x4756('0x3c');throw _0x17c95b[_0x4756('0x3d')]+_0x4756('0x3e');}};}function isActive(_0x2827c1){return _0x2827c1;}function checkIsActive(_0x127e25,_0x1e2292){return function(){if(!isActive(_0x1e2292)){_0x127e25[_0x4756('0x3b')]='NOT_ACTIVE';throw _0x127e25[_0x4756('0x3d')]+_0x4756('0x3f');}};}function checkInterval(_0x8438c4){return function(){if(!isNotNull(_0x8438c4[_0x4756('0x40')])){_0x8438c4[_0x4756('0x3b')]='INTERVAL_IS_NULL';throw _0x8438c4[_0x4756('0x3d')]+_0x4756('0x41');}if(!isNotNull(_0x8438c4[_0x4756('0x40')][_0x4756('0x42')])){_0x8438c4['message']=_0x4756('0x43');throw _0x8438c4[_0x4756('0x3d')]+_0x4756('0x41');}if(!isNotNull(_[_0x4756('0x44')](_0x8438c4[_0x4756('0x40')]['Intervals']))){_0x8438c4[_0x4756('0x3b')]=_0x4756('0x43');throw _0x8438c4[_0x4756('0x3d')]+_0x4756('0x41');}};}function msgResponse(_0x4c3090,_0x482fe7,_0x1610f2){return{'action':_0x4c3090,'response':_0x482fe7,'message':_0x1610f2,'stack':_0x1610f2};}function myreject(_0x38d29e){return function(_0x2d7330){return _0x38d29e(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x2d7330)));};}function getSeconds(_0x3b29cf,_0x15cf00){var _0x2e2d92=moment(_0x3b29cf)['milliseconds'](0x0);var _0x45522d=moment(_0x15cf00)[_0x4756('0x45')](0x0);return _0x2e2d92[_0x4756('0x46')](_0x45522d,_0x4756('0x47'));}function emit(_0x482c04,_0x50573c,_0x4b0027){io['to'](_0x482c04)[_0x4756('0x48')](_0x50573c,_0x4b0027);}function emitVoiceQueueSummary(_0x13de8d){if(_0x13de8d[_0x4756('0x49')]===_0x4756('0x4a')){var _0x3f7a24={'id':_0x13de8d['id'],'name':_0x13de8d['name'],'strategy':_0x13de8d[_0x4756('0x4b')],'answered':_0x13de8d[_0x4756('0x4c')],'available':_0x13de8d[_0x4756('0x4d')],'loggedIn':_0x13de8d[_0x4756('0x4e')],'pTalking':_0x13de8d[_0x4756('0x4f')],'sumBillable':_0x13de8d['sumBillable'],'sumDuration':_0x13de8d['sumDuration'],'sumHoldTime':_0x13de8d[_0x4756('0x50')]||0x0,'talking':_0x13de8d['talking'],'total':_0x13de8d[_0x4756('0x51')],'type':_0x13de8d[_0x4756('0x49')],'unmanaged':_0x13de8d[_0x4756('0x52')],'abandoned':_0x13de8d[_0x4756('0x53')],'waiting':_0x13de8d[_0x4756('0x54')],'loggedInDb':_0x13de8d[_0x4756('0x55')],'dialActive':_0x13de8d['dialActive'],'dialMethod':_0x13de8d['dialMethod'],'dialOriginateCallerIdName':_0x13de8d[_0x4756('0x56')],'dialOriginateCallerIdNumber':_0x13de8d[_0x4756('0x57')],'dialOriginateTimeout':_0x13de8d[_0x4756('0x58')],'dialPrefix':_0x13de8d[_0x4756('0x59')],'outboundAnswerAgiCallsDay':_0x13de8d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x13de8d['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x13de8d[_0x4756('0x5a')],'outboundBusyCallsDay':_0x13de8d[_0x4756('0x5b')],'outboundCongestionCallsDay':_0x13de8d[_0x4756('0x5c')],'outboundDropCallsDayACS':_0x13de8d[_0x4756('0x5d')],'outboundDropCallsDayCallersExit':_0x13de8d[_0x4756('0x5e')],'outboundDropCallsDayTimeout':_0x13de8d['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x13de8d[_0x4756('0x5f')],'outboundNoSuchCallsDay':_0x13de8d['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x13de8d[_0x4756('0x60')],'outboundReCallsDay':_0x13de8d['outboundReCallsDay'],'outboundRejectCallsDay':_0x13de8d[_0x4756('0x61')],'outboundUnknownCallsDay':_0x13de8d[_0x4756('0x62')],'predictiveIntervalAnsweredCalls':_0x13de8d[_0x4756('0x63')],'predictiveIntervalAvgHoldtime':_0x13de8d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x13de8d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x13de8d['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x13de8d[_0x4756('0x64')],'predictiveIntervalErlangCalls':_0x13de8d[_0x4756('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0x13de8d['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x13de8d[_0x4756('0x66')],'predictiveIntervalMultiplicativeFactor':_0x13de8d[_0x4756('0x67')],'predictiveIntervalPauses':_0x13de8d[_0x4756('0x68')],'predictiveIntervalAvailable':_0x13de8d[_0x4756('0x69')],'predictiveIntervalTotalCalls':_0x13de8d[_0x4756('0x6a')],'message':_0x13de8d[_0x4756('0x3b')],'originated':_0x13de8d[_0x4756('0x6b')],'erlangCalls':_0x13de8d[_0x4756('0x6c')],'erlangCallToSecond':_0x13de8d['erlangCallToSecond'],'erlangAbandonmentRate':_0x13de8d[_0x4756('0x6d')],'erlangBusyFactor':_0x13de8d['erlangBusyFactor'],'startPredictive':_0x13de8d[_0x4756('0x6e')],'startProgressive':_0x13de8d['startProgressive']};if(_0x13de8d[_0x4756('0x6f')]){_0x3f7a24[_0x4756('0x6f')]={'id':_0x13de8d[_0x4756('0x6f')]['id'],'name':_0x13de8d[_0x4756('0x6f')]['name'],'active':_0x13de8d[_0x4756('0x6f')][_0x4756('0x70')],'callerid':_0x13de8d[_0x4756('0x6f')][_0x4756('0x71')]};}if(_0x13de8d['Interval']){_0x3f7a24[_0x4756('0x40')]={'id':_0x13de8d['Interval']['id'],'name':_0x13de8d[_0x4756('0x40')][_0x4756('0x3d')]};}var _0x2ad1dc=md5(JSON[_0x4756('0x72')](_0x3f7a24));if(_0x13de8d[_0x4756('0x3')]!==_0x2ad1dc){_0x13de8d[_0x4756('0x3')]=_0x2ad1dc;emit(util[_0x4756('0x73')](_0x4756('0x74'),_0x3f7a24[_0x4756('0x3d')]),'voice_queue:save',_0x3f7a24);}}}function emitCampaignSummary(_0x4b5715){if(_0x4b5715[_0x4756('0x49')]==='ivr'){emit(util[_0x4756('0x73')]('campaign:ivr:%s',_0x4b5715[_0x4756('0x3d')]),_0x4756('0x75'),_0x4b5715);}}function checkGetDataPredictive(_0x1adc74){if(isNotNull(_0x1adc74)){if(!_[_0x4756('0x44')](_0x1adc74)){loggerPredictive[_0x4756('0x76')](_0x4756('0x77'));loggerPredictive[_0x4756('0x76')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1adc74[_0x4756('0x6a')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x78'),_0x1adc74[_0x4756('0x63')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x79'),_0x1adc74[_0x4756('0x64')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x7a'),_0x1adc74[_0x4756('0x7b')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x7c'),_0x1adc74[_0x4756('0x7d')]);loggerPredictive['info'](_0x4756('0x7e'),_0x1adc74[_0x4756('0x7f')]);loggerPredictive['info'](_0x4756('0x80'));if(_0x1adc74[_0x4756('0x6a')]>0x0){if(!_[_0x4756('0x3a')](_0x1adc74[_0x4756('0x7f')])&&_0x1adc74[_0x4756('0x7f')]>0x0){return!![];}else{loggerPredictive[_0x4756('0x76')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x4756('0x3a')](_0x1adc74[_0x4756('0x7d')])&&_0x1adc74[_0x4756('0x7d')]>0x0){return!![];}else{loggerPredictive['info'](_0x4756('0x81'));}}else{loggerPredictive[_0x4756('0x76')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x4756('0x76')](_0x4756('0x82'));}}else{loggerPredictive[_0x4756('0x76')](_0x4756('0x82'));}return![];}function mergeDataErlangB(_0x5e8a88){return function(_0x4be78c){loggerPredictive[_0x4756('0x76')](_0x4756('0x83'));loggerPredictive[_0x4756('0x76')](_0x4756('0x84'),_0x4be78c['erlangCalls']);loggerPredictive[_0x4756('0x76')](_0x4756('0x85'),_0x4be78c[_0x4756('0x86')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x87'),_0x4be78c['erlangAbandonmentRate']);loggerPredictive[_0x4756('0x76')](_0x4756('0x88'),_0x4be78c[_0x4756('0x89')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x87'),_0x4be78c[_0x4756('0x6d')]);loggerPredictive[_0x4756('0x76')](_0x4756('0x80'));_[_0x4756('0x8a')](_0x5e8a88,_0x4be78c);};}function getDiff(_0x1a1e7b){var _0x247e11=moment()['milliseconds'](0x0);var _0x54a519=moment(_0x1a1e7b)[_0x4756('0x45')](0x0);return _0x247e11[_0x4756('0x46')](_0x54a519,_0x4756('0x47'));}function ifInterval(_0x443681,_0x3f179d){if(_[_0x4756('0x3a')](_0x3f179d)){return![];}if(getDiff(_0x3f179d)<_0x443681*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2598e0){if(isNotNull(_0x2598e0)){if(!_[_0x4756('0x3a')](_0x2598e0[_0x4756('0x8b')])){_0x2598e0[_0x4756('0x8b')]=undefined;loggerPredictive[_0x4756('0x76')](_0x2598e0[_0x4756('0x3d')],_0x4756('0x8c'));}if(!_[_0x4756('0x3a')](_0x2598e0[_0x4756('0x6e')])){_0x2598e0['startPredictive']=undefined;loggerPredictive[_0x4756('0x76')](_0x2598e0[_0x4756('0x3d')],_0x4756('0x8d'));}if(!_[_0x4756('0x3a')](_0x2598e0['handlePredictive'])){clearInterval(_0x2598e0['handlePredictive']);_0x2598e0[_0x4756('0x8e')]=undefined;loggerPredictive[_0x4756('0x76')](_0x2598e0[_0x4756('0x3d')],_0x4756('0x8f'));}}}function erlangb(_0x48eaa2,_0x204330){if(_0x204330===0x0){return 0x0;}var _0x4ee94b=0x1;for(var _0x21e2ad=0x1;_0x21e2ad<=_0x204330;_0x21e2ad+=0x1){_0x4ee94b=0x1+_0x4ee94b*_0x21e2ad/_0x48eaa2;}return 0x1/_0x4ee94b;}function isVoiceQueueOutbound(_0x2ac676){return _0x2ac676===_0x4756('0x4a');}function isNotPreview(_0x35626d){return _0x35626d!==_0x4756('0x90');}function isCampaignIvr(_0x55e6da){return _0x55e6da===_0x4756('0x91');}function getCallerId(_0x5c1ea5,_0x58c8bc,_0x42a7da){if(!_[_0x4756('0x3a')](_0x42a7da)&&_0x4756('0x92')===typeof _0x42a7da&&!_[_0x4756('0x44')](_0x42a7da)){if(!_[_0x4756('0x3a')](_0x58c8bc)&&_0x4756('0x92')===typeof _0x58c8bc&&!_[_0x4756('0x44')](_0x58c8bc)){return util['format'](_0x4756('0x93'),_0x58c8bc,_0x42a7da);}return util[_0x4756('0x73')](_0x4756('0x93'),_0x42a7da,_0x42a7da);}if(!_[_0x4756('0x3a')](_0x5c1ea5)&&'string'===typeof _0x5c1ea5&&!_[_0x4756('0x44')](_0x5c1ea5)){return _0x5c1ea5;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x522524,_0xbb6b1b){return function(_0x55c045){freeVariablesPredictive(_0xbb6b1b);emitVoiceQueueSummary(_0xbb6b1b);emitCampaignSummary(_0xbb6b1b);loggerSyncQueueSummary['error'](_0x522524,util[_0x4756('0x94')](_0x55c045,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5bf57d,_0x385f1c){return function(_0x9a2c44){loggerPredictive[_0x4756('0x95')](_0x385f1c['name'],_0x5bf57d);loggerPredictive[_0x4756('0x95')](_0x9a2c44['stack']);freeVariablesPredictive(_0x385f1c);};}function loggerCatch(_0x3bff58){return function(_0x1e95a4){logger[_0x4756('0x95')](_0x3bff58,util['inspect'](_0x1e95a4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x38a205){return _0x38a205&&!_[_0x4756('0x3a')](_0x38a205)&&_0x38a205[_0x4756('0x96')]>0x0;}function decremetOriginate(_0x77f5de){if(!_[_0x4756('0x3a')](_0x77f5de)&&_0x77f5de!==null){if(_0x77f5de[_0x4756('0x97')](_0x4756('0x6b'))){if(_0x77f5de[_0x4756('0x6b')]>0x0){_0x77f5de[_0x4756('0x6b')]-=0x1;}else{logger['error'](_0x4756('0x98'));}}}else{logger[_0x4756('0x95')](_0x4756('0x99'));}}function checkContactLowerLimitOriginate(_0x13a40e,_0x1a0758,_0x2651fc){if(_0x1a0758>_0x2651fc){for(var _0x259be4=0x0;_0x259be4<_0x1a0758-_0x2651fc;_0x259be4+=0x1){decremetOriginate(_0x13a40e);}}}function loggerGetContactDialer(_0x76c23c,_0x299c24,_0x5a641d){return function(_0x4727fa){checkContactLowerLimitOriginate(_0x299c24,_0x5a641d,0x0);logger[_0x4756('0x95')](_0x76c23c,util['inspect'](_0x4727fa,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d93cd){return function(_0x36dfa5){if(isNotNull(_0x36dfa5)&&isNotNull(_0x36dfa5[0x0])){if(_0x36dfa5[0x0][_0x4756('0x9a')]>0x0){_0x1d93cd[_0x4756('0x3b')]='RESCHEDULED_CONTACTS';logger['info'](_0x4756('0x9b')+_0x1d93cd['name'],_0x36dfa5[0x0][_0x4756('0x9a')],'contacts');}else{_0x1d93cd[_0x4756('0x3b')]=_0x4756('0x9c');logger[_0x4756('0x76')]('[getContactDialer2][Empty]'+_0x1d93cd[_0x4756('0x3d')]);}}};}function notSendMessagesQueue(_0x1087bf){if(_0x1087bf[_0x4756('0x9d')]){freeVariablesPredictive(_0x1087bf);if(_0x1087bf[_0x4756('0x6b')]===0x0&&_0x1087bf['talking']===0x0&&_0x1087bf['waiting']===0x0&&(_0x1087bf['pTalking']||0x0)===0x0){_0x1087bf[_0x4756('0x9d')]=![];_0x1087bf[_0x4756('0x4d')]=0x0;_0x1087bf[_0x4756('0x3b')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x4756('0x95')](_0x4756('0x9e'),_0x1087bf[_0x4756('0x3d')],_0x4756('0x9f'));}else{_0x1087bf[_0x4756('0x3b')]=_0x4756('0xa0');loggerSyncQueueSummary[_0x4756('0x95')](_0x4756('0x9e'),_0x1087bf['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x1087bf);}}function notSendMessagesCampaign(_0x410cb6){if(_0x410cb6[_0x4756('0x9d')]){if(_0x410cb6[_0x4756('0x6b')]===0x0){_0x410cb6[_0x4756('0x9d')]=![];_0x410cb6[_0x4756('0x3b')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x4756('0x95')](_0x4756('0xa1'),_0x410cb6[_0x4756('0x3d')],_0x4756('0x9f'));}else{_0x410cb6[_0x4756('0x3b')]=_0x4756('0xa0');loggerSyncQueueSummary[_0x4756('0x95')](_0x4756('0xa1'),_0x410cb6[_0x4756('0x3d')],_0x4756('0xa2'));}emitCampaignSummary(_0x410cb6);}}function createObjHistory(_0x2ed12a,_0x512e7d,_0x5d99ee,_0x1b6249,_0xd8a51a){_0x2ed12a[_0x4756('0x3b')]=_0x5d99ee;var _0x187392=new Action(_0x2ed12a,_0x512e7d);var _0x4d5b76=new History(_0x187392);_0x4d5b76[_0x4756('0xa3')]=_0x1b6249;_0x4d5b76[_0x4756('0xa4')]=_0xd8a51a;_0x4d5b76[_0x4756('0xa5')]=_0x187392[_0x4756('0xa6')];return _0x4d5b76;}Dialer[_0x4756('0xa7')][_0x4756('0xa8')]=function(){var _0x20171c=this;setInterval(function(){_0x20171c[_0x4756('0xa9')](_0x20171c[_0x4756('0x24')],_0x4756('0xaa'));_0x20171c[_0x4756('0xa9')](_0x20171c[_0x4756('0x22')],'[actions]');},0x32c8);};Dialer[_0x4756('0xa7')][_0x4756('0xa9')]=function(_0x2dac42,_0x360683){var _0x13c916=this;for(var _0x5c4e24 in _0x2dac42){if(_0x2dac42[_0x4756('0x97')](_0x5c4e24)){this[_0x4756('0x1b')][_0x4756('0xab')](function(){if(!_['isNil'](_0x2dac42[_0x5c4e24])){return ami[_0x4756('0xac')]({'action':_0x4756('0xad'),'channel':_0x2dac42[_0x5c4e24][_0x4756('0xae')]})[_0x4756('0xaf')](function(_0x3dfaea){if(_0x3dfaea['message']===_0x4756('0xb0')){setTimeout(function(){if(_0x2dac42[_0x5c4e24]&&_0x2dac42[_0x5c4e24][_0x4756('0x49')]!==_0x4756('0x91')){_0x13c916['updateOriginated'](_0x13c916['voiceQueues'][_0x2dac42[_0x5c4e24][_0x4756('0xb1')]]);logger[_0x4756('0x95')](_0x4756('0xb2'),_0x360683,_0x5c4e24,_0x2dac42[_0x5c4e24][_0x4756('0xb1')]);delete _0x2dac42[_0x5c4e24];}if(_0x2dac42[_0x5c4e24]&&_0x2dac42[_0x5c4e24][_0x4756('0x49')]===_0x4756('0x91')){_0x13c916['updateOriginated'](_0x13c916[_0x4756('0x1d')][_0x2dac42[_0x5c4e24][_0x4756('0xb1')]]);logger['error'](_0x4756('0xb3'),_0x360683,_0x5c4e24,_0x2dac42[_0x5c4e24][_0x4756('0xb1')]);delete _0x2dac42[_0x5c4e24];}},0x2328);}});}});}}};Dialer[_0x4756('0xa7')][_0x4756('0xb4')]=function(_0x5df96d){return BPromise[_0x4756('0xb5')]()['then'](cmHopper['countReScheduled'](_0x5df96d))['catch'](loggerCatch(_0x4756('0xb6')));};Dialer[_0x4756('0xa7')][_0x4756('0xb7')]=function(_0x1aa786){return BPromise[_0x4756('0xb5')]()['then'](cmHopperBlack[_0x4756('0xb7')](_0x1aa786))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x4756('0xa7')]['checkIsBlackListIvr']=function(_0x42352a){return BPromise[_0x4756('0xb5')]()[_0x4756('0xb8')](cmHopperBlack[_0x4756('0xb9')](_0x42352a))[_0x4756('0xaf')](loggerCatch(_0x4756('0xba')));};Dialer['prototype'][_0x4756('0xbb')]=function(_0x5d1aaa){return BPromise['resolve']()[_0x4756('0xb8')](cmHopperHistory['avgHandleTime'](_0x5d1aaa))[_0x4756('0xaf')](loggerCatch(_0x4756('0xbc')));};Dialer['prototype'][_0x4756('0xbd')]=function(_0x3eef08){return BPromise[_0x4756('0xb5')]()['then'](cmHopper[_0x4756('0xbd')](_0x3eef08))[_0x4756('0xaf')](loggerCatch(_0x4756('0xbe')));};Dialer['prototype'][_0x4756('0xbf')]=function(_0x295693,_0x39018e,_0x15aa1f,_0x1d4955){return BPromise['resolve']()[_0x4756('0xb8')](cmHopper[_0x4756('0xbf')](_0x295693,_0x39018e,_0x15aa1f,_0x1d4955))[_0x4756('0xaf')](loggerCatch(_0x4756('0xc0')));};Dialer[_0x4756('0xa7')]['getContactDialerIvr']=function(_0x5b8a0a,_0x2c59f2,_0x477ed4){return BPromise[_0x4756('0xb5')]()[_0x4756('0xb8')](cmHopper['getContactDialerIvr'](_0x5b8a0a,_0x2c59f2,_0x477ed4))['catch'](loggerCatch(_0x4756('0xc0')));};Dialer[_0x4756('0xa7')][_0x4756('0xc1')]=function(_0x12aff0){return BPromise['resolve']()[_0x4756('0xb8')](voiceQueueRt[_0x4756('0xc1')](_0x12aff0))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x4756('0xc2')]=function(_0x898ab5){return BPromise[_0x4756('0xb5')]()['then'](cmHopper[_0x4756('0xc2')](_0x898ab5))[_0x4756('0xaf')](loggerCatch(_0x4756('0xc3')));};Dialer['prototype']['createHistory']=function(_0x1008a3){return BPromise[_0x4756('0xb5')]()[_0x4756('0xb8')](cmHopperHistory[_0x4756('0xc4')](_0x1008a3))['catch'](loggerCatch(_0x4756('0xc5')));};Dialer['prototype']['updateOriginated']=function(_0x3dba20){if(!_[_0x4756('0x3a')](_0x3dba20)&&_0x3dba20!==null){if(_0x3dba20[_0x4756('0x97')](_0x4756('0x6b'))){if(_0x3dba20['originated']>0x0){_0x3dba20['originated']-=0x1;}else{logger[_0x4756('0x95')](_0x4756('0xc6'));}}}else{logger[_0x4756('0x95')](_0x4756('0xc7'));}};Dialer['prototype'][_0x4756('0xc8')]=function(_0xe00857,_0x551a35){var _0x2f1374=this;return function(_0x2cf6be){_0x2f1374[_0x4756('0xc9')](_0x551a35);logger[_0x4756('0x95')](_0xe00857,util[_0x4756('0x94')](_0x2cf6be,{'showHidden':![],'depth':null}));};};Dialer[_0x4756('0xa7')][_0x4756('0xca')]=function(_0x31117a,_0x101fd5,_0x27c35f){var _0x2c44c6={'state':0x19,'statedesc':_0x4756('0xcb')};this[_0x4756('0xc9')](_0x101fd5);this[_0x4756('0xcc')](_['merge'](_0x2c44c6,_[_0x4756('0xcd')](_0x27c35f,[_0x4756('0xce'),_0x4756('0xcf'),_0x4756('0xd0'),'VoiceQueueId','CampaignId'])),_0x4756('0xd1'),_0x4756('0xd2'));logger[_0x4756('0x95')](_0x31117a);};Dialer[_0x4756('0xa7')]['isSuccess']=function(_0x1d224a){return _0x1d224a===_0x4756('0xd3');};Dialer[_0x4756('0xa7')][_0x4756('0xd4')]=function(_0x19b705){return!_[_0x4756('0x3a')](_0x19b705)&&_0x19b705&&!_[_0x4756('0x3a')](_0x19b705[_0x4756('0x3d')])&&!_[_0x4756('0x3a')](_0x19b705['active'])&&_0x19b705[_0x4756('0x70')]&&(this['trunks'][util['format']('SIP/%s',_0x19b705[_0x4756('0x3d')])]['status']===_0x4756('0xd5')||this[_0x4756('0x1f')][util[_0x4756('0x73')](_0x4756('0xd6'),_0x19b705[_0x4756('0x3d')])]['status']==='unmonitored');};Dialer[_0x4756('0xa7')][_0x4756('0xcc')]=function(_0x488d4d,_0x26b5ed,_0x47aa49){this[_0x4756('0xc4')](_0x488d4d)['catch'](loggerCatch(_0x26b5ed));this[_0x4756('0xc2')](_0x488d4d)['catch'](loggerCatch(_0x47aa49));};Dialer[_0x4756('0xa7')][_0x4756('0xd7')]=function(_0x190679){var _0x42c866=this['uniqueId'][_0x190679[_0x4756('0xd8')]];var _0xbbcd1;if(!_[_0x4756('0xd9')](_0x190679)&&!_[_0x4756('0xd9')](_0x190679[_0x4756('0xda')])&&!_[_0x4756('0xd9')](_0x190679[_0x4756('0xda')][_0x4756('0xdb')])&&_0x190679[_0x4756('0xdc')]==='xcally-motion-dialer'&&_0x42c866){if(_0x42c866[_0x4756('0x49')]!==_0x4756('0x91')&&this[_0x4756('0x1c')][_0x42c866[_0x4756('0xb1')]][_0x4756('0xdd')]&&_0x190679[_0x4756('0xde')]===_0x4756('0xdf')){delete this[_0x4756('0x24')][_0x190679[_0x4756('0xd8')]];this['updateOriginated'](this[_0x4756('0x1c')][_0x42c866['queue']]);this[_0x4756('0x1c')][_0x42c866[_0x4756('0xb1')]][_0x4756('0xe0')]+=0x1;this[_0x4756('0x1c')][_0x42c866[_0x4756('0xb1')]][_0x4756('0xe1')]+=0x1;_0xbbcd1=new Hangup(_0x42c866,_0x190679);_0xbbcd1['state']=0x12;_0xbbcd1['statedesc']='HangupInAMD';_0xbbcd1[_0x4756('0xe2')]='AMD';this[_0x4756('0xcc')](_0xbbcd1,_0x4756('0xe3'),'[syncHangupInAMD]');}if(_0x42c866[_0x4756('0x49')]!=='ivr'&&this[_0x4756('0x1c')][_0x42c866['queue']][_0x4756('0xdd')]&&_0x190679[_0x4756('0xde')]===_0x4756('0xe4')){delete this['uniqueId'][_0x190679[_0x4756('0xd8')]];this['updateOriginated'](this[_0x4756('0x1c')][_0x42c866[_0x4756('0xb1')]]);this['voiceQueues'][_0x42c866[_0x4756('0xb1')]][_0x4756('0xe0')]+=0x1;this[_0x4756('0x1c')][_0x42c866[_0x4756('0xb1')]][_0x4756('0xe1')]+=0x1;_0xbbcd1=new Hangup(_0x42c866,_0x190679);_0xbbcd1[_0x4756('0xa3')]=0x13;_0xbbcd1[_0x4756('0xa4')]='Machine';_0xbbcd1[_0x4756('0xe2')]=_0x4756('0xe5');_0xbbcd1['amd']=!![];this[_0x4756('0xcc')](_0xbbcd1,_0x4756('0xe6'),_0x4756('0xe7'));}if(_0x42c866[_0x4756('0x49')]===_0x4756('0x91')&&this[_0x4756('0x1d')][_0x42c866['queue']]['dialAMDActive']&&_0x190679['value']==='HANGUP'){delete this[_0x4756('0x24')][_0x190679[_0x4756('0xd8')]];this[_0x4756('0xc9')](this[_0x4756('0x1d')][_0x42c866['queue']]);_0xbbcd1=new Hangup(_0x42c866,_0x190679);_0xbbcd1[_0x4756('0xa3')]=0x12;_0xbbcd1['statedesc']=_0x4756('0xe8');_0xbbcd1[_0x4756('0xe2')]=_0x4756('0xe5');this['saveInDb'](_0xbbcd1,'[syncHangupInAMDIvr][createHistory]',_0x4756('0xe9'));}if(_0x42c866[_0x4756('0x49')]==='ivr'&&this[_0x4756('0x1d')][_0x42c866[_0x4756('0xb1')]][_0x4756('0xdd')]&&_0x190679[_0x4756('0xde')]==='MACHINE'){delete this[_0x4756('0x24')][_0x190679[_0x4756('0xd8')]];this[_0x4756('0xc9')](this['campaigns'][_0x42c866['queue']]);_0xbbcd1=new Hangup(_0x42c866,_0x190679);_0xbbcd1['state']=0x13;_0xbbcd1[_0x4756('0xa4')]=_0x4756('0xea');_0xbbcd1[_0x4756('0xe2')]=_0x4756('0xe5');_0xbbcd1['amd']=!![];this[_0x4756('0xcc')](_0xbbcd1,'[syncMachineIvr][createHistory]',_0x4756('0xeb'));}}};Dialer['prototype'][_0x4756('0x32')]=function(_0xa89f54){var _0x24e4f2=this[_0x4756('0x24')][_0xa89f54[_0x4756('0xd8')]];var _0x36d890=this;var _0x492388;if(_0x24e4f2&&_0x24e4f2[_0x4756('0x49')]===_0x4756('0x91')){delete this[_0x4756('0x24')][_0xa89f54[_0x4756('0xd8')]];this[_0x4756('0xc9')](this[_0x4756('0x1d')][_0x24e4f2[_0x4756('0xb1')]]);this[_0x4756('0x1d')][_0x24e4f2[_0x4756('0xb1')]][_0x4756('0xec')]+=0x1;_0x492388=new Hangup(_0x24e4f2,_0xa89f54);this[_0x4756('0xc4')](_0x492388)[_0x4756('0xaf')](loggerCatch(_0x4756('0xed')));this[_0x4756('0xc2')](_0x492388)[_0x4756('0xaf')](loggerCatch(_0x4756('0xee')));}if(_0x24e4f2&&_0x24e4f2[_0x4756('0x49')]!=='ivr'&&isNotNull(this[_0x4756('0x1c')][_0x24e4f2[_0x4756('0xb1')]][_0x4756('0xef')])){delete this['uniqueId'][_0xa89f54['uniqueid']];this['updateOriginated'](this[_0x4756('0x1c')][_0x24e4f2[_0x4756('0xb1')]]);this[_0x4756('0x1c')][_0x24e4f2['queue']][_0x4756('0xe0')]+=0x1;this[_0x4756('0x1c')][_0x24e4f2[_0x4756('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x492388=new Hangup(_0x24e4f2,_0xa89f54);_0x492388[_0x4756('0xa3')]=0x10;_0x492388[_0x4756('0xa4')]=_0x4756('0xf0');_0x492388[_0x4756('0xe2')]=_0x4756('0xf1');this[_0x4756('0xc4')](_0x492388)[_0x4756('0xaf')](loggerCatch(_0x4756('0xed')));this['moveContactManagedDialer'](_0x492388)[_0x4756('0xaf')](loggerCatch('[syncHangupIvr]'));}if(_0x24e4f2&&_0x24e4f2['type']!==_0x4756('0x91')&&!isNotNull(this['voiceQueues'][_0x24e4f2[_0x4756('0xb1')]][_0x4756('0xef')])){delete this[_0x4756('0x24')][_0xa89f54[_0x4756('0xd8')]];this[_0x4756('0xc9')](this[_0x4756('0x1c')][_0x24e4f2['queue']]);this[_0x4756('0x1c')][_0x24e4f2[_0x4756('0xb1')]][_0x4756('0x62')]+=0x1;_0x492388=new Hangup(_0x24e4f2,_0xa89f54);_0x492388[_0x4756('0xa3')]=0xc;_0x492388['statedesc']=_0xa89f54[_0x4756('0xf2')];_0x492388[_0x4756('0xe2')]=_0x4756('0xf3');this[_0x4756('0xc4')](_0x492388)['catch'](loggerCatch(_0x4756('0xed')));this[_0x4756('0xc2')](_0x492388)[_0x4756('0xaf')](loggerCatch(_0x4756('0xee')));}};Dialer['prototype'][_0x4756('0x2f')]=function(_0xb7123a){var _0x520fbb=this[_0x4756('0x24')][_0xb7123a['uniqueid']];var _0x2acf5b=this;if(this[_0x4756('0x1c')][_0xb7123a[_0x4756('0xb1')]]){if(_0x520fbb&&_0x520fbb[_0x4756('0x49')]!==_0x4756('0x91')){delete this[_0x4756('0x24')][_0xb7123a[_0x4756('0xd8')]];this[_0x4756('0x1c')][_0xb7123a['queue']][_0x4756('0xe0')]+=0x1;var _0xb3f5c2=new AgentComplete(_0x520fbb,_0xb7123a);if(_0xb7123a[_0x4756('0xf4')]===_0x4756('0xf5')){_0xb3f5c2[_0x4756('0xf6')]=this[_0x4756('0x1c')][_0xb7123a[_0x4756('0xb1')]][_0x4756('0xf7')]&&this[_0x4756('0x1c')][_0xb7123a['queue']][_0x4756('0xf8')]?moment()['format'](_0x4756('0xf9')):undefined;}this['createHistory'](_0xb3f5c2)[_0x4756('0xaf')](loggerCatch(_0x4756('0xfa')));this['moveContactManagedDialer'](_0xb3f5c2)[_0x4756('0xaf')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x4756('0xa7')][_0x4756('0x29')]=function(_0x3adf23){if(this[_0x4756('0x1c')][_0x3adf23[_0x4756('0xb1')]]){if(this['uniqueId'][_0x3adf23['uniqueid']]&&this[_0x4756('0x24')][_0x3adf23[_0x4756('0xd8')]][_0x4756('0x49')]!==_0x4756('0x91')){this[_0x4756('0xc9')](this[_0x4756('0x1c')][_0x3adf23[_0x4756('0xb1')]]);this[_0x4756('0x24')][_0x3adf23[_0x4756('0xd8')]][_0x4756('0xfb')]=moment()[_0x4756('0x73')](_0x4756('0xf9'));}}};Dialer[_0x4756('0xa7')][_0x4756('0xfc')]=function(_0x49198e){this[_0x4756('0xc4')](_0x49198e)[_0x4756('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x4756('0xc2')](_0x49198e)['catch'](loggerCatch(_0x4756('0xfd')));};Dialer['prototype'][_0x4756('0x2c')]=function(_0x246161){var _0x1b5ddc=this['uniqueId'][_0x246161[_0x4756('0xd8')]];var _0x81a03f=this;if(this['voiceQueues'][_0x246161[_0x4756('0xb1')]]){if(_0x1b5ddc&&_0x1b5ddc[_0x4756('0x49')]!==_0x4756('0x91')){delete this[_0x4756('0x24')][_0x246161[_0x4756('0xd8')]];this['updateOriginated'](this['voiceQueues'][_0x246161['queue']]);_0x1b5ddc[_0x4756('0xfe')]=moment()['format'](_0x4756('0xf9'));var _0x3453a5=new QueueCallerAbandon(_0x1b5ddc,_0x246161);if(getSeconds(_0x1b5ddc['droptime'],_0x1b5ddc[_0x4756('0xff')])>=_0x1b5ddc[_0x4756('0x100')]){this[_0x4756('0x1c')][_0x246161['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x4756('0x1c')][_0x246161['queue']][_0x4756('0x101')]+=0x1;this[_0x4756('0x1c')][_0x246161[_0x4756('0xb1')]][_0x4756('0x102')]+=0x1;_0x3453a5[_0x4756('0xa3')]=0xa;_0x3453a5['statedesc']='Drop';_0x3453a5[_0x4756('0x103')]='TIMEOUT';_0x3453a5[_0x4756('0xf6')]=this[_0x4756('0x1c')][_0x246161[_0x4756('0xb1')]][_0x4756('0xf7')]?moment()[_0x4756('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;this[_0x4756('0xfc')](_0x3453a5);}else{this[_0x4756('0x1c')][_0x246161['queue']][_0x4756('0x7b')]+=0x1;this['voiceQueues'][_0x246161[_0x4756('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3453a5['state']=0xb;_0x3453a5[_0x4756('0xa4')]=_0x4756('0x104');_0x3453a5[_0x4756('0x103')]=_0x4756('0x105');this[_0x4756('0xfc')](_0x3453a5);}}}};Dialer[_0x4756('0xa7')]['syncNewExten']=function(_0x4987ac){if(this[_0x4756('0x22')][_0x4987ac[_0x4756('0xd8')]]){this['actions'][_0x4987ac[_0x4756('0xd8')]][_0x4756('0xae')]=_0x4987ac[_0x4756('0xae')];}if(this['uniqueId'][_0x4987ac[_0x4756('0xd8')]]){this[_0x4756('0x24')][_0x4987ac[_0x4756('0xd8')]]['channel']=_0x4987ac[_0x4756('0xae')];}};Dialer[_0x4756('0xa7')]['syncQueueMember']=function(_0x19538d){if(strategy[this[_0x4756('0x1c')][this[_0x4756('0x22')][_0x19538d['actionid']][_0x4756('0xb1')]][_0x4756('0x4b')]]===_0x4756('0x18')){if(this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]]&&_['isNil'](this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]]['locked'])&&_0x19538d['status']==='1'&&_0x19538d[_0x4756('0x107')]==='0'){if(this['agents'][_0x19538d['stateinterface']]){if(!this[_0x4756('0x1e')][_0x19538d[_0x4756('0x108')]][_0x4756('0x109')]){this['agents'][_0x19538d['stateinterface']][_0x4756('0x109')]=!![];this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]][_0x4756('0x109')]=!![];this['actions'][_0x19538d[_0x4756('0x106')]][_0x4756('0x108')]=_0x19538d['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x19538d['actionid']]['queue']][_0x4756('0x4b')]]||'rrmemory')===_0x4756('0x17')){if(this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]]){if(this[_0x4756('0x1e')][_0x19538d[_0x4756('0x108')]]){this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]]['stateinterface']=_0x19538d['stateinterface'];if(_[_0x4756('0xd9')](this[_0x4756('0x27')][this[_0x4756('0x22')][_0x19538d['actionid']][_0x4756('0xb1')]])){this[_0x4756('0x27')][this[_0x4756('0x22')][_0x19538d['actionid']][_0x4756('0xb1')]]=[];}this[_0x4756('0x27')][this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]][_0x4756('0xb1')]][_0x4756('0x10a')](_[_0x4756('0x8a')](_[_0x4756('0xcd')](this[_0x4756('0x22')][_0x19538d[_0x4756('0x106')]],['idHopper',_0x4756('0x108')]),{'status':_0x19538d[_0x4756('0xad')],'paused':_0x19538d[_0x4756('0x107')]}));}}}};function unlockQueueStatus(_0x34d294,_0x2d7dfe){setTimeout(function(){if(_[_0x4756('0x3a')](_0x34d294[_0x4756('0x10b')])){loggerBooked[_0x4756('0x95')]('[unlockQueueStatus][undefined]',_0x2d7dfe);}_0x34d294['queueStatusComplete']=!![];loggerBooked[_0x4756('0x76')]('[booked][unlockQueueStatus]',_0x2d7dfe,JSON[_0x4756('0x72')](_[_0x4756('0xcd')](_0x34d294,[_0x4756('0x3d'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x4756('0xa7')]['syncQueueStatusComplete']=function(_0x35e1c5){var _0x339275=this;var _0x246115=_0x339275[_0x4756('0x1c')][_0x339275[_0x4756('0x22')][_0x35e1c5['actionid']][_0x4756('0xb1')]];if(strategy[this[_0x4756('0x1c')][this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]]['queue']][_0x4756('0x4b')]]===_0x4756('0x18')){if(this[_0x4756('0x22')][_0x35e1c5['actionid']]&&this[_0x4756('0x22')][_0x35e1c5['actionid']][_0x4756('0x108')]){this['preview']['run'](this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0x10c')],this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0x108')])['catch'](function(_0x3d148f){logger[_0x4756('0x95')](_0x4756('0x10d'),util['inspect'](_0x3d148f,{'showHidden':![],'depth':null}));})[_0x4756('0x1a')](function(){_0x339275[_0x4756('0xc9')](_0x339275['voiceQueues'][_0x339275[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]]);_0x339275[_0x4756('0x1e')][_0x339275[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]]['stateinterface']][_0x4756('0x109')]=![];delete _0x339275[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]];unlockQueueStatus(_0x246115);});}else{this[_0x4756('0xc9')](this[_0x4756('0x1c')][this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x35e1c5['actionid']][_0x4756('0xce')],'ListId':this[_0x4756('0x22')][_0x35e1c5['actionid']][_0x4756('0xcf')],'VoiceQueueId':this[_0x4756('0x22')][_0x35e1c5['actionid']][_0x4756('0x10e')]||undefined,'CampaignId':this[_0x4756('0x22')][_0x35e1c5['actionid']][_0x4756('0x10f')]||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x110')));delete this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]];unlockQueueStatus(_0x246115);}}else if((strategy[this[_0x4756('0x1c')][this['actions'][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]][_0x4756('0x4b')]]||_0x4756('0x17'))===_0x4756('0x17')){var _0x4bb221;if(this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]]&&!_[_0x4756('0x44')](this[_0x4756('0x27')][this[_0x4756('0x22')][_0x35e1c5['actionid']][_0x4756('0xb1')]])){if(this[_0x4756('0x111')][_0x339275[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]]['queue']]){this[_0x4756('0x111')][_0x339275['actions'][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]]=this['queueBookedRR'][this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]]?this[_0x4756('0x111')][this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]]:this[_0x4756('0x27')][this[_0x4756('0x22')][_0x35e1c5['actionid']]['queue']]?this['queueBooked'][this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]]['queue']][_0x4756('0x112')]||0x0:0x0;}this[_0x4756('0x27')][this[_0x4756('0x22')][_0x35e1c5[_0x4756('0x106')]][_0x4756('0xb1')]]['_rr']=this[_0x4756('0x111')][this['actions'][_0x35e1c5[_0x4756('0x106')]]['queue']];for(var _0x12fd16=0x0;_0x12fd16=0x0?!![]:![];})[_0x4756('0xaf')](myreject(_0x1da2a9)));}}else{_0x4cfe8a[_0x4756('0x10a')](ami[_0x4756('0xac')]({'action':_0x4756('0x12b'),'command':util['format'](_0x4756('0x12c'),_0x20e48a,!_['isUndefined'](config[_0x4756('0x127')][_0x4f36ad])?_0x4f36ad:'')})[_0x4756('0xb8')](function(_0x2743dc){return _0x2743dc['content'][_0x4756('0x12f')](_0x4756('0x130'))>=0x0?!![]:![];})[_0x4756('0xaf')](myreject(_0x1da2a9)));}BPromise[_0x4756('0x131')](_0x4cfe8a)[_0x4756('0xb8')](function(_0x124fc2){var _0x39c8a8=_['some'](_0x124fc2);if(_0x39c8a8){return _0x248ff7(_0x39c8a8);}else{_0x429197[_0x4756('0x3b')]=_0x129e3d?'GLOBAL_INTERVAL_IS_OVERTIME':_0x4756('0x132');return _0x1da2a9(msgResponse(_0x4756('0x133'),_0x4756('0x124'),'Global:\x20'+_0x129e3d+'\x20'+_0x199fbe+_0x4756('0x134')+util[_0x4756('0x94')](_0x20e48a,{'showHidden':![],'depth':null})+_0x4756('0x135')+_0x4f36ad));}})[_0x4756('0xaf')](function(_0x49bca2){return _0x1da2a9(msgResponse(_0x4756('0x123'),_0x4756('0x124'),JSON[_0x4756('0x72')](_0x49bca2)));});});};Dialer[_0x4756('0xa7')][_0x4756('0x136')]=function(_0x59775d){var _0x14009c=this;return function(){switch(_0x59775d[_0x4756('0x137')]){case _0x4756('0x138'):freeVariablesPredictive(_0x59775d);_0x14009c['handlePower'](_0x59775d,0x1);break;case _0x4756('0x139'):freeVariablesPredictive(_0x59775d);_0x14009c[_0x4756('0x13a')](_0x59775d,_0x59775d[_0x4756('0x13b')]);break;case _0x4756('0x13c'):_0x14009c[_0x4756('0x13c')](_0x59775d);break;case'booked':freeVariablesPredictive(_0x59775d);_0x14009c[_0x4756('0x13a')](_0x59775d,0x1);break;default:freeVariablesPredictive(_0x59775d);logger[_0x4756('0x95')](_0x4756('0x13d'),_0x59775d[_0x4756('0x3d')],'method\x20not\x20recognized');}};};Dialer[_0x4756('0xa7')][_0x4756('0x13e')]=function(_0x530f69){var _0x511d96=this;return function(){_0x511d96[_0x4756('0x13f')](_0x530f69);};};Dialer['prototype'][_0x4756('0x9')]=function(_0x1c1a69){var _0x557c0f=this;if(isNotPreview(_0x1c1a69['dialMethod'])){if(isVoiceQueueOutbound(_0x1c1a69[_0x4756('0x49')])&&isActive(_0x1c1a69[_0x4756('0x140')])){_0x1c1a69[_0x4756('0x9d')]=!![];BPromise[_0x4756('0xb5')]()[_0x4756('0xb8')](checkIsLoggedIn(_0x1c1a69,_0x1c1a69[_0x4756('0x4e')]))[_0x4756('0xb8')](checkIsActive(_0x1c1a69,_0x1c1a69[_0x4756('0x140')]))['then'](checkInterval(_0x1c1a69))['then'](_0x557c0f[_0x4756('0x11e')](_0x1c1a69))[_0x4756('0xb8')](_0x557c0f['checkIfTime'](_0x1c1a69[_0x4756('0x141')],_0x1c1a69[_0x4756('0x142')],_0x1c1a69['name'],_0x1c1a69))[_0x4756('0xb8')](_0x557c0f[_0x4756('0x143')](_0x1c1a69[_0x4756('0x40')],_0x1c1a69[_0x4756('0x142')],_0x1c1a69['name'],_0x1c1a69))['then'](_0x557c0f[_0x4756('0x136')](_0x1c1a69))[_0x4756('0xaf')](loggerCatchQueueSummary(_0x4756('0x144'),_0x1c1a69));}else{notSendMessagesQueue(_0x1c1a69);}}else{freeVariablesPredictive(_0x1c1a69);}};Dialer[_0x4756('0xa7')][_0x4756('0x11d')]=function(){var _0x540d52=this;var _0x103774;for(var _0x41d8be in this[_0x4756('0x1d')]){if(this['campaigns'][_0x4756('0x97')](_0x41d8be)){_0x103774=this[_0x4756('0x1d')][_0x41d8be];if(isCampaignIvr(_0x103774[_0x4756('0x49')])&&isActive(_0x103774['active'])){_0x103774[_0x4756('0x9d')]=!![];BPromise[_0x4756('0xb5')]()[_0x4756('0xb8')](checkIsActive(_0x103774,_0x103774[_0x4756('0x70')]))[_0x4756('0xb8')](checkInterval(_0x103774))[_0x4756('0xb8')](_0x540d52[_0x4756('0x11e')](_0x103774))['then'](_0x540d52[_0x4756('0x122')](_0x103774[_0x4756('0x141')],_0x103774[_0x4756('0x142')],_0x103774[_0x4756('0x3d')],_0x103774))[_0x4756('0xb8')](_0x540d52[_0x4756('0x143')](_0x103774[_0x4756('0x40')],_0x103774[_0x4756('0x142')],_0x103774['name'],_0x103774))[_0x4756('0xb8')](_0x540d52[_0x4756('0x13e')](_0x103774))[_0x4756('0xaf')](loggerCatchQueueSummary(_0x4756('0x145'),_0x103774));}else{notSendMessagesCampaign(_0x103774);}}}};function getCallerIdRandom(_0x43fe5a,_0x2d19be){var _0x53ea69,_0x2e3018,_0x3c7d23;if(_0x2d19be<=0x0){_0x2d19be=0x1;}_0x53ea69=new RegExp('\x5cw{0,'+_0x2d19be+'}$');_0x2e3018=Math[_0x4756('0x146')](0xa,_0x2d19be-0x1);_0x3c7d23=Math[_0x4756('0x146')](0xa,_0x2d19be)-0x1;return util[_0x4756('0x73')]('%s',_[_0x4756('0x147')](_0x43fe5a,_0x53ea69,_[_0x4756('0x148')](_0x2e3018,_0x3c7d23)));}function extractCalleridName(_0x570f1d){var _0x313aeb=_0x570f1d['match'](/"(.*?)"/);return _0x313aeb?_0x313aeb[0x1]:_0x570f1d;}function extractCalleridNumber(_0x31aec9){var _0x22fe74=_0x31aec9[_0x4756('0x149')](/<(.*?)>/);return _0x22fe74?_0x22fe74[0x1]:_0x31aec9;}Dialer[_0x4756('0xa7')][_0x4756('0x14a')]=function(_0x576613,_0x43780a){var _0x11388d=this;var _0xd769c4=uuid['v4']();this[_0x4756('0x22')][_0xd769c4]=new Action(_0x576613,_0x43780a,_0xd769c4);return new BPromise(function(_0x5e9d5b,_0x2c158f){if(_[_0x4756('0x3a')](_0x576613)&&_0x4756('0x14b')!==typeof _0x576613){return _0x2c158f(msgResponse(_0x4756('0x14c'),_0x4756('0x124'),'voiceQueue\x20is\x20undefine'));}if(_[_0x4756('0x3a')](_0x43780a['Contact'][_0x4756('0x14d')])||_0x43780a[_0x4756('0x14e')][_0x4756('0x14d')]===null){return _0x2c158f(msgResponse('originate',_0x4756('0x124'),_0x4756('0x14f')));}var _0x152b51={'XMD-CALLERID':_0x11388d['actions'][_0xd769c4]['getCaller'](),'XMD-AGI':_0x576613[_0x4756('0xef')]?util[_0x4756('0x73')](_0x4756('0x150'),ipAgi,_0x576613[_0x4756('0xef')]):_0x4756('0x151'),'XMD-AGIAFTER':_0x576613[_0x4756('0xf7')]?util[_0x4756('0x73')](_0x4756('0x150'),ipAgi,_0x576613[_0x4756('0xf7')]):_0x4756('0x151'),'XMD-QUEUE':_0x576613['type']===_0x4756('0x4a')?util[_0x4756('0x73')]('\x22%s,%s%s,,,%s\x22',_0x576613[_0x4756('0x3d')],_0x576613['dialQueueOptions']||'',_0x576613[_0x4756('0xf8')]?'c':'',_0x576613[_0x4756('0x100')]||0x3):_0x4756('0x151'),'XMD-CONTACTID':_0x43780a[_0x4756('0xce')],'XMD-CDRTYPE':_0x4756('0x7'),'CALLERID(all)':_0x11388d[_0x4756('0x22')][_0xd769c4][_0x4756('0x152')](),'XMD-AMD':_0x576613[_0x4756('0xdd')]?_0x4756('0x153'):_0x4756('0x151'),'XMD-DESTINATION':_0x4756('0x154')};if(_0x576613[_0x4756('0xdd')]){_0x152b51[_0x4756('0x155')]=_0x576613[_0x4756('0x156')]||0x9c4;_0x152b51['XMD-AMDGREETING']=_0x576613['dialAMDGreeting']||0x5dc;_0x152b51['XMD-AMDAFTERGREETINGSILENCE']=_0x576613[_0x4756('0x157')]||0x320;_0x152b51['XMD-AMDTOTALANALYSISTIME']=_0x576613[_0x4756('0x158')]||0x1388;_0x152b51[_0x4756('0x159')]=_0x576613[_0x4756('0x15a')]||0x64;_0x152b51[_0x4756('0x15b')]=_0x576613[_0x4756('0x15c')]||0x32;_0x152b51[_0x4756('0x15d')]=_0x576613[_0x4756('0x15e')]||0x3;_0x152b51['XMD-AMDSILENCETHRESHOLD']=_0x576613[_0x4756('0x15f')]||0x100;_0x152b51[_0x4756('0x160')]=_0x576613[_0x4756('0x161')]||0x1388;}if(_0x576613[_0x4756('0x49')]===_0x4756('0x4a')){_0x152b51[_0x4756('0x162')]=_0x43780a[_0x4756('0x10e')];}else{_0x152b51[_0x4756('0x163')]=_0x43780a['CampaignId'];}for(var _0x1ff276 in _0x43780a[_0x4756('0x14e')]){if(_0x43780a['Contact'][_0x4756('0x97')](_0x1ff276)){if(isNotNull(_0x43780a[_0x4756('0x14e')][_0x1ff276])&&_0x1ff276!=='id'&&_0x1ff276!==_0x4756('0x164')&&_0x1ff276!==_0x4756('0x165')&&_0x1ff276!==_0x4756('0x166')){_0x152b51[util[_0x4756('0x73')](_0x4756('0x167'),_0x4756('0x168'),_[_0x4756('0x169')](_0x1ff276))]=_0x43780a[_0x4756('0x14e')][_0x1ff276];}}}var _0x100c59=_0x11388d[_0x4756('0xd4')](_0x576613[_0x4756('0x6f')])?getCallerId(_0x576613['Trunk'][_0x4756('0x71')],_0x576613[_0x4756('0x56')],_0x576613['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x576613[_0x4756('0x57')],_0x576613[_0x4756('0x16a')]):_0x576613[_0x4756('0x57')]):getCallerId(_[_0x4756('0xd9')](_0x576613[_0x4756('0x11f')])?_0x576613[_0x4756('0x6f')][_0x4756('0x71')]:_0x576613[_0x4756('0x11f')][_0x4756('0x71')],_0x576613[_0x4756('0x56')],_0x576613[_0x4756('0x16a')]>0x0?getCallerIdRandom(_0x576613[_0x4756('0x57')],_0x576613[_0x4756('0x16a')]):_0x576613[_0x4756('0x57')]);if(_0x100c59){_0x152b51[_0x4756('0x16b')]=_0x11388d[_0x4756('0x22')][_0xd769c4]['originatecalleridname']=extractCalleridName(_0x100c59);_0x152b51['XMD-ORIGINATECALLERIDNUM']=_0x11388d[_0x4756('0x22')][_0xd769c4][_0x4756('0x16c')]=extractCalleridNumber(_0x100c59);}return ami[_0x4756('0xac')]({'actionid':_0xd769c4,'action':'originate','channel':_0x11388d[_0x4756('0xd4')](_0x576613[_0x4756('0x6f')])?util[_0x4756('0x73')]('SIP/%s/%s%s',_0x576613['Trunk'][_0x4756('0x3d')],isNotNull(_0x576613[_0x4756('0x59')])?_0x576613['dialPrefix']['trim']()||'':'',_0x576613[_0x4756('0x16d')]>0x0?_0x43780a[_0x4756('0x14e')][_0x4756('0x14d')][_0x4756('0x16e')](_0x576613[_0x4756('0x16d')]):_0x43780a[_0x4756('0x14e')][_0x4756('0x14d')]):util[_0x4756('0x73')](_0x4756('0x16f'),_[_0x4756('0xd9')](_0x576613[_0x4756('0x11f')])?_0x576613[_0x4756('0x6f')][_0x4756('0x3d')]:_0x576613[_0x4756('0x11f')][_0x4756('0x3d')],isNotNull(_0x576613['dialPrefix'])?_0x576613[_0x4756('0x59')][_0x4756('0x170')]()||'':'',_0x576613[_0x4756('0x16d')]>0x0?_0x43780a[_0x4756('0x14e')]['phone'][_0x4756('0x16e')](_0x576613[_0x4756('0x16d')]):_0x43780a[_0x4756('0x14e')]['phone']),'callerid':_0x100c59,'Exten':_0x4756('0x154'),'Context':_0x4756('0x171'),'Priority':'1','variable':_0x152b51,'timeout':(_0x576613[_0x4756('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0xd769c4})[_0x4756('0xb8')](function(_0x12a574){return _0x5e9d5b(_0x12a574);})[_0x4756('0xaf')](function(_0x58e003){_0x576613[_0x4756('0x60')]+=0x1;var _0x39d1b8=new History(_0x11388d['actions'][_0xd769c4]);logger[_0x4756('0x95')](util[_0x4756('0x73')](_0x4756('0x172'),JSON['stringify'](_0x58e003)));_0x39d1b8['state']=0xe;_0x39d1b8['statedesc']=_0x4756('0x173');_0x39d1b8[_0x4756('0xa6')]=moment()[_0x4756('0x73')](_0x4756('0xf9'));_0x39d1b8[_0x4756('0xa5')]=_0x39d1b8['starttime'];_0x11388d[_0x4756('0xc4')](_0x39d1b8)[_0x4756('0xaf')](loggerCatch(_0x4756('0x174')));_0x11388d['moveContactManagedDialer'](_0x39d1b8)[_0x4756('0xaf')](loggerCatch(_0x4756('0x174')))[_0x4756('0x1a')](function(){delete _0x11388d[_0x4756('0x22')][_0xd769c4];return _0x2c158f(msgResponse(_0x4756('0x14c'),'Error',_0x4756('0x175')));});});});};Dialer[_0x4756('0xa7')][_0x4756('0x2e')]=function(_0x3536ce){var _0x329b5d=this[_0x4756('0x22')][_0x3536ce[_0x4756('0x106')]];var _0xa537d2=this;if(_0x329b5d){delete this[_0x4756('0x22')][_0x3536ce[_0x4756('0x106')]];_0x329b5d[_0x4756('0xff')]=moment()[_0x4756('0x73')](_0x4756('0xf9'));var _0x2a65a2=_0x329b5d['type']===_0x4756('0x91')?this[_0x4756('0x1d')][_0x329b5d[_0x4756('0xb1')]]:this[_0x4756('0x1c')][_0x329b5d[_0x4756('0x176')]()];if(!this[_0x4756('0x177')](_0x3536ce[_0x4756('0x178')])){this[_0x4756('0xc9')](_0x2a65a2);return this[_0x4756('0x179')](_0x329b5d,_0x2a65a2,_0x3536ce)[_0x4756('0xb8')](function(_0x159d64){})[_0x4756('0xaf')](loggerCatch(_0x4756('0x17a')));}else{this[_0x4756('0x24')][_0x3536ce[_0x4756('0xd8')]]=_0x329b5d;}}};Dialer['prototype'][_0x4756('0x17b')]=function(_0x28d41b,_0x5bc92a,_0x2ba368){var _0x395e3b=new History(_0x5bc92a);if(_0x395e3b[_0x4756('0x17c')]+_0x395e3b[_0x4756('0x17d')]+_0x395e3b['countnoanswerretry']>=_0x2ba368['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x28d41b){case 0x3:if(_0x395e3b[_0x4756('0x17e')]>=_0x2ba368[_0x4756('0x17f')]-0x1){return!![];}else{this[_0x4756('0xbd')]({'active':![],'countnoanswerretry':_0x395e3b[_0x4756('0x17e')]+=0x1,'scheduledat':moment()[_0x4756('0x180')](_0x2ba368['dialNoAnswerRetryFrequency'],'minutes')[_0x4756('0x73')](_0x4756('0xf9')),'ContactId':_0x395e3b[_0x4756('0xce')],'ListId':_0x395e3b[_0x4756('0xcf')],'VoiceQueueId':_0x395e3b['VoiceQueueId']||undefined,'CampaignId':_0x395e3b[_0x4756('0x10f')]||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x181')));}break;case 0x5:if(_0x395e3b['countbusyretry']>=_0x2ba368['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x4756('0xbd')]({'active':![],'countbusyretry':_0x395e3b[_0x4756('0x17c')]+=0x1,'scheduledat':moment()['add'](_0x2ba368[_0x4756('0x182')],_0x4756('0x183'))[_0x4756('0x73')](_0x4756('0xf9')),'ContactId':_0x395e3b[_0x4756('0xce')],'ListId':_0x395e3b[_0x4756('0xcf')],'VoiceQueueId':_0x395e3b[_0x4756('0x10e')]||undefined,'CampaignId':_0x395e3b[_0x4756('0x10f')]||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x184')));}break;case 0x8:if(_0x395e3b[_0x4756('0x17d')]>=_0x2ba368[_0x4756('0x185')]-0x1){return!![];}else{this[_0x4756('0xbd')]({'active':![],'countcongestionretry':_0x395e3b['countcongestionretry']+=0x1,'scheduledat':moment()[_0x4756('0x180')](_0x2ba368['dialCongestionRetryFrequency'],_0x4756('0x183'))['format'](_0x4756('0xf9')),'ContactId':_0x395e3b['ContactId'],'ListId':_0x395e3b[_0x4756('0xcf')],'VoiceQueueId':_0x395e3b['VoiceQueueId']||undefined,'CampaignId':_0x395e3b['CampaignId']||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x186')));}break;default:return!![];}};Dialer[_0x4756('0xa7')][_0x4756('0x179')]=function(_0x5db023,_0x3f0cc6,_0x4b645a){var _0x3ce9e2=this;var _0x1dc6c1=new History(_0x5db023);return new BPromise(function(_0x18077b,_0x154948){if(_[_0x4756('0x3a')](_0x3f0cc6)&&'object'!==typeof _0x3f0cc6){return _0x154948(msgResponse(_0x4756('0x187'),_0x4756('0x124'),_0x4756('0x188')));}if(_['isUndefined'](_0x4b645a)&&_0x4756('0x14b')!==typeof _0x4b645a){return _0x154948(msgResponse('[callProgressDetecting]',_0x4756('0x124'),_0x4756('0x189')));}switch(_0x4b645a[_0x4756('0xf4')]){case'0':_0x3f0cc6[_0x4756('0x18a')]+=0x1;_0x1dc6c1[_0x4756('0xa3')]=0x0;_0x1dc6c1[_0x4756('0xa4')]='NoSuchNumber';_0x3ce9e2[_0x4756('0xc4')](_0x1dc6c1)[_0x4756('0xaf')](loggerCatch(_0x4756('0x18b')));if(_0x3ce9e2[_0x4756('0x17b')](0x0,_0x5db023,_0x3f0cc6)){if(_0x1dc6c1[_0x4756('0x17c')]+_0x1dc6c1['countcongestionretry']+_0x1dc6c1[_0x4756('0x17e')]>=_0x3f0cc6[_0x4756('0x18c')]){_0x3ce9e2[_0x4756('0x18d')](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x18e'));}else{_0x3ce9e2[_0x4756('0x18f')](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x18e'));}}break;case'3':_0x3f0cc6[_0x4756('0x5f')]+=0x1;_0x1dc6c1[_0x4756('0xa3')]=0x3;_0x1dc6c1['statedesc']=_0x4756('0x190');_0x1dc6c1[_0x4756('0x17e')]+=0x1;_0x1dc6c1[_0x4756('0x191')]+=0x1;_0x3ce9e2['createHistory'](_0x1dc6c1)[_0x4756('0xaf')](loggerCatch(_0x4756('0x192')));if(_0x3ce9e2[_0x4756('0x17b')](0x3,_0x5db023,_0x3f0cc6)){if(_0x1dc6c1['countnoanswerretry']>=_0x3f0cc6['dialNoAnswerMaxRetry']){_0x3ce9e2[_0x4756('0x18f')](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x193'));}else{_0x3ce9e2['stateGlobal'](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x193'));}}break;case'5':_0x3f0cc6[_0x4756('0x5b')]+=0x1;_0x1dc6c1['state']=0x5;_0x1dc6c1[_0x4756('0xa4')]='Busy';_0x1dc6c1[_0x4756('0x17c')]+=0x1;_0x1dc6c1['countglobal']+=0x1;_0x3ce9e2[_0x4756('0xc4')](_0x1dc6c1)['catch'](loggerCatch(_0x4756('0x194')));if(_0x3ce9e2[_0x4756('0x17b')](0x5,_0x5db023,_0x3f0cc6)){if(_0x1dc6c1[_0x4756('0x17c')]>=_0x3f0cc6['dialBusyMaxRetry']){_0x3ce9e2[_0x4756('0x18f')](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x195'));}else{_0x3ce9e2[_0x4756('0x18d')](_0x1dc6c1,_0x18077b,_0x154948,'reason\x205\x20busy');}}break;case'8':_0x3f0cc6[_0x4756('0x5c')]+=0x1;_0x1dc6c1[_0x4756('0xa3')]=0x8;_0x1dc6c1[_0x4756('0xa4')]='Congestion';_0x1dc6c1[_0x4756('0x17d')]+=0x1;_0x1dc6c1[_0x4756('0x191')]+=0x1;_0x3ce9e2[_0x4756('0xc4')](_0x1dc6c1)['catch'](loggerCatch(_0x4756('0x196')));if(_0x3ce9e2[_0x4756('0x17b')](0x8,_0x5db023,_0x3f0cc6)){if(_0x1dc6c1[_0x4756('0x17d')]>=_0x3f0cc6[_0x4756('0x185')]){_0x3ce9e2[_0x4756('0x18f')](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x197'));}else{_0x3ce9e2['stateGlobal'](_0x1dc6c1,_0x18077b,_0x154948,_0x4756('0x197'));}}break;default:_0x3f0cc6[_0x4756('0x62')]+=0x1;_0x1dc6c1[_0x4756('0xa3')]=0xc;_0x1dc6c1['statedesc']=_0x4b645a[_0x4756('0xf4')];_0x3ce9e2[_0x4756('0xc4')](_0x1dc6c1)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3ce9e2[_0x4756('0x17b')](_0x4b645a[_0x4756('0xf4')],_0x5db023,_0x3f0cc6)){if(_0x1dc6c1['countbusyretry']+_0x1dc6c1[_0x4756('0x17d')]+_0x1dc6c1[_0x4756('0x17e')]>=_0x3f0cc6[_0x4756('0x18c')]){_0x3ce9e2[_0x4756('0x18d')](_0x1dc6c1,_0x18077b,_0x154948,_0x4b645a[_0x4756('0xf4')]);}else{_0x3ce9e2[_0x4756('0x18f')](_0x1dc6c1,_0x18077b,_0x154948,_0x4b645a[_0x4756('0xf4')]);}}}});};Dialer['prototype'][_0x4756('0x18d')]=function(_0x1faacd,_0x3c0edd,_0x424a03,_0x4ba3c8){var _0x452494=new Final(_0x1faacd);_0x452494['state']=0xf;_0x452494[_0x4756('0xa4')]='Global';this['createStateFinal'](_0x452494,_0x3c0edd,_0x424a03,_0x4ba3c8);};Dialer[_0x4756('0xa7')]['createStateFinal']=function(_0x42bea5,_0x526ec6,_0x2b9553,_0x74da9b){this[_0x4756('0xc2')](_0x42bea5)[_0x4756('0xb8')](function(_0x4d5ac6){return _0x526ec6(msgResponse(_0x4756('0x187'),'Success',_0x74da9b));})[_0x4756('0xaf')](function(_0x5441e1){return _0x2b9553(msgResponse(_0x4756('0x198'),_0x4756('0x124'),_0x4756('0x199')));});};Dialer['prototype'][_0x4756('0x13c')]=function(_0xd480b5){var _0x22e43e=this;var _0xe19a9b=_0xd480b5['dialPredictiveOptimizationPercentage']/0x64;var _0x37287a=_0xd480b5['outboundDropCallsDayTimeout']/(_0xd480b5[_0x4756('0x101')]+_0xd480b5['outboundAnswerCallsDay']);var _0x431f22=Math[_0x4756('0x19a')](_0xd480b5[_0x4756('0x69')]*(_0xd480b5['predictiveIntervalMaxThreshold']/0x64));var _0xf06e18=Math['round'](_0xd480b5['predictiveIntervalAvailable']*(_0xd480b5[_0x4756('0x19b')]/0x64));var _0x44631f=_0xd480b5[_0x4756('0x4d')]+_0xd480b5[_0x4756('0x19c')];var _0x2fed54=Math[_0x4756('0x19d')](_0xd480b5['erlangCalls']*_0xd480b5[_0x4756('0x6d')]*_0xd480b5[_0x4756('0x66')]*_0xd480b5['predictiveIntervalMultiplicativeFactor']);if(_[_0x4756('0x3a')](_0xd480b5[_0x4756('0x8b')])){if(!_[_0x4756('0x3a')](_0xd480b5[_0x4756('0x6e')])){_0xd480b5[_0x4756('0x6e')]=undefined;loggerPredictive[_0x4756('0x95')](_0x4756('0x19e'),_0x4756('0x19f'));}if(!_[_0x4756('0x3a')](_0xd480b5['handlePredictive'])){loggerPredictive[_0x4756('0x95')](_0x4756('0x19e'),_0x4756('0x1a0'));clearInterval(_0xd480b5[_0x4756('0x8e')]);_0xd480b5[_0x4756('0x8e')]=undefined;}_0xd480b5['startProgressive']=moment()[_0x4756('0x73')](_0x4756('0xf9'));loggerPredictive[_0x4756('0x76')](_0xd480b5['name'],'collection\x20data\x20in\x20progressive\x20at',_0xd480b5[_0x4756('0x8b')]);this['handlePower'](_0xd480b5,0x1);}else if(ifInterval(_0xd480b5[_0x4756('0x1a1')],_0xd480b5[_0x4756('0x8b')])){this[_0x4756('0x13a')](_0xd480b5,0x1);loggerPredictiveCalls[_0x4756('0x76')]('[startMethodPredictive][StartProgressive][Loop]',_0xd480b5[_0x4756('0x8b')],_0xd480b5[_0x4756('0x3d')]);_0xd480b5[_0x4756('0x6c')]=0x0;_0xd480b5[_0x4756('0x102')]=0x0;}else if(_0xe19a9b<_0x37287a&&_0xd480b5[_0x4756('0x1a2')]===_0x4756('0x1a3')){freeVariablesPredictive(_0xd480b5);loggerPredictive[_0x4756('0x76')](_0x4756('0x1a4'),'Dropped\x20calls\x20day',_0x37287a,_0x4756('0x8b'),_0xd480b5[_0x4756('0x3d')]);}else if(_0x2fed54<_0xd480b5[_0x4756('0x102')]&&_0xd480b5[_0x4756('0x1a2')]==='dropRate'){freeVariablesPredictive(_0xd480b5);loggerPredictive[_0x4756('0x76')](_0x4756('0x1a5'),_0x4756('0x1a6'),_0x2fed54,_0x4756('0x1a7'),_0xd480b5['predictiveIntervalErlangCallsDroppedCalls'],_0x4756('0x8b'),_0xd480b5[_0x4756('0x3d')]);}else if(!ifInterval(_0xd480b5[_0x4756('0x1a1')],_0xd480b5[_0x4756('0x8b')])&&_[_0x4756('0x3a')](_0xd480b5[_0x4756('0x6e')])&&!_[_0x4756('0x3a')](_0xd480b5[_0x4756('0x8b')])){_0xd480b5[_0x4756('0x6e')]=moment()['format'](_0x4756('0xf9'));loggerPredictive[_0x4756('0x76')](_0xd480b5['name'],'started\x20in\x20predictive\x20at',_0xd480b5[_0x4756('0x6e')]);this[_0x4756('0xbb')](_0xd480b5[_0x4756('0x1a1')])[_0x4756('0xb8')](this['getDataPredictive'](_0xd480b5))[_0x4756('0xb8')](mergeDataErlangB(_0xd480b5))[_0x4756('0xb8')](this[_0x4756('0x1a8')](_0xd480b5))[_0x4756('0xaf')](loggerCatchPredictive(_0x4756('0x1a9'),_0xd480b5));}else if(!ifInterval(_0xd480b5[_0x4756('0x1a1')],_0xd480b5[_0x4756('0x6e')])){_0xd480b5['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xd480b5[_0x4756('0x6e')]=moment()[_0x4756('0x73')](_0x4756('0xf9'));loggerPredictive[_0x4756('0x76')](_0xd480b5[_0x4756('0x3d')],_0x4756('0x1aa'),_0xd480b5[_0x4756('0x6e')]);clearInterval(_0xd480b5[_0x4756('0x8e')]);_0xd480b5[_0x4756('0x8e')]=undefined;this[_0x4756('0xbb')](_0xd480b5[_0x4756('0x1a1')])['then'](this[_0x4756('0x1ab')](_0xd480b5))[_0x4756('0xb8')](mergeDataErlangB(_0xd480b5))[_0x4756('0xb8')](this['startMethodPredictive'](_0xd480b5))[_0x4756('0xaf')](loggerCatchPredictive(_0x4756('0x1ac'),_0xd480b5));}else if(_0xd480b5[_0x4756('0x69')]&&_0x44631f<_0xd480b5['predictiveIntervalAvailable']-_0xf06e18){freeVariablesPredictive(_0xd480b5);loggerPredictive[_0x4756('0x76')](_0xd480b5[_0x4756('0x3d')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x44631f,_0x4756('0x1ad'),_0xd480b5[_0x4756('0x69')],'-',_0xf06e18,'=',_0xd480b5[_0x4756('0x69')]-_0xf06e18,')');}else if(_0xd480b5[_0x4756('0x69')]&&_0x44631f>_0xd480b5[_0x4756('0x69')]+_0x431f22){freeVariablesPredictive(_0xd480b5);loggerPredictive[_0x4756('0x76')](_0xd480b5[_0x4756('0x3d')],_0x4756('0x1ae'),_0x44631f,')\x20are\x20more\x20than\x20threshold\x20(',_0xd480b5['predictiveIntervalAvailable'],'+',_0x431f22,'=',_0xd480b5['predictiveIntervalAvailable']+_0x431f22,')');}};Dialer[_0x4756('0xa7')]['getDataPredictive']=function(_0x478f12){var _0x1f3992=this;return function(_0x277ca5){return new BPromise(function(_0x59f641,_0x3b893a){_[_0x4756('0x8a')](_0x478f12,_0x277ca5[0x0]);if(checkGetDataPredictive(_0x277ca5[0x0])){var _0x53cbd9=_0x478f12[_0x4756('0x69')]=_0x478f12['talking']+_0x478f12[_0x4756('0x4d')];var _0x25f281=_0x478f12[_0x4756('0x1a1')]*0x3c;var _0x128a79=_0x277ca5[0x0][_0x4756('0x7f')]+_0x277ca5[0x0][_0x4756('0x7d')];var _0x35224d=(_0x277ca5[0x0][_0x4756('0x63')]+_0x277ca5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x277ca5[0x0][_0x4756('0x7b')])/_0x277ca5[0x0][_0x4756('0x6a')];_0x478f12[_0x4756('0x66')]=_0x35224d>0x0?_0x35224d:0x1;switch(_0x478f12['dialPredictiveOptimization']){case _0x4756('0x1a3'):var _0x5ccdee=_0x478f12[_0x4756('0x1af')]/0x64;return _0x1f3992['abandonmentRate'](_0x53cbd9,_0x25f281,_0x128a79,_0x35224d,_0x5ccdee)[_0x4756('0xb8')](function(_0x2657c6){return _0x59f641(_0x2657c6);});case _0x4756('0x1b0'):var _0x836ca1=_0x478f12['dialPredictiveOptimizationPercentage']/0x64;return _0x1f3992[_0x4756('0x1b1')](_0x53cbd9,_0x25f281,_0x128a79,_0x35224d,_0x836ca1)['then'](function(_0x17c839){return _0x59f641(_0x17c839);});default:return _0x3b893a(msgResponse(_0x4756('0x1b2'),'Failure',_0x4756('0x1b3')));}}else{return _0x3b893a(msgResponse(_0x4756('0x1b2'),_0x4756('0x124'),_0x4756('0x1b4')));}});};};Dialer[_0x4756('0xa7')][_0x4756('0x1b5')]=function(_0x16d5c0){var _0x5240f5=this;return function(_0x3edbf4){return new BPromise(function(_0x33335,_0x247003){_['merge'](_0x16d5c0,_0x3edbf4[0x0]);if(checkGetDataPredictive(_0x3edbf4[0x0])){loggerPredictive[_0x4756('0x76')](JSON['stringify'](_0x3edbf4[0x0]));if(_0x16d5c0['dialPredictiveOptimization']===_0x4756('0x1a3')){return _0x5240f5[_0x4756('0xc1')](_0x16d5c0['id'])[_0x4756('0xb8')](function(_0x2c8870){var _0x5cc591=_0x16d5c0[_0x4756('0x4e')]-_0x2c8870[0x0][_0x4756('0x1b6')];var _0xc955ca=_0x16d5c0[_0x4756('0x1a1')]*0x3c;var _0x4df0f9=_0x3edbf4[0x0]['predictiveIntervalAvgTalktime']+_0x3edbf4[0x0][_0x4756('0x7d')];var _0x1f4ab5=(_0x3edbf4[0x0][_0x4756('0x63')]+_0x3edbf4[0x0][_0x4756('0x64')]+_0x3edbf4[0x0][_0x4756('0x7b')])/_0x3edbf4[0x0][_0x4756('0x6a')];var _0x90d992=_0x16d5c0[_0x4756('0x1af')]/0x64;_0x16d5c0['predictiveIntervalPauses']=_0x2c8870[0x0][_0x4756('0x1b6')]||0x0;_0x16d5c0[_0x4756('0x66')]=_0x1f4ab5>0x0?_0x1f4ab5:0x1;return _0x5240f5[_0x4756('0x1b7')](_0x5cc591,_0xc955ca,_0x4df0f9,_0x1f4ab5,_0x90d992);})[_0x4756('0xb8')](function(_0x40f9e0){return _0x33335(_0x40f9e0);})[_0x4756('0xaf')](function(_0x10274e){return _0x247003(msgResponse(_0x4756('0x1b8'),_0x4756('0x124'),JSON[_0x4756('0x72')](_0x10274e)));});}if(_0x16d5c0[_0x4756('0x1a2')]==='agentBusyFactor'){return _0x5240f5[_0x4756('0xc1')](_0x16d5c0['id'])[_0x4756('0xb8')](function(_0x5870b5){var _0x4d156a=_0x16d5c0[_0x4756('0x4e')]-_0x5870b5[0x0][_0x4756('0x1b6')];var _0x20838a=_0x16d5c0[_0x4756('0x1a1')]*0x3c;var _0x3f78bd=_0x3edbf4[0x0][_0x4756('0x7f')]+_0x3edbf4[0x0]['predictiveIntervalAvgHoldtime'];var _0x2affb8=(_0x3edbf4[0x0][_0x4756('0x63')]+_0x3edbf4[0x0][_0x4756('0x64')]+_0x3edbf4[0x0][_0x4756('0x7b')])/_0x3edbf4[0x0]['predictiveIntervalTotalCalls'];var _0x365762=_0x16d5c0[_0x4756('0x1af')]/0x64;_0x16d5c0[_0x4756('0x68')]=_0x5870b5[0x0][_0x4756('0x1b6')]||0x0;_0x16d5c0[_0x4756('0x66')]=_0x2affb8>0x0?_0x2affb8:0x1;return _0x5240f5[_0x4756('0x1b1')](_0x4d156a,_0x20838a,_0x3f78bd,_0x2affb8,_0x365762);})[_0x4756('0xb8')](function(_0x315c2e){return _0x33335(_0x315c2e);})[_0x4756('0xaf')](function(_0x85c372){return _0x247003(msgResponse(_0x4756('0x1b8'),_0x4756('0x124'),JSON[_0x4756('0x72')](_0x85c372)));});}}else{return _0x247003(msgResponse(_0x4756('0x1b2'),_0x4756('0x124'),_0x4756('0x1b4')));}});};};Dialer[_0x4756('0xa7')][_0x4756('0x1a8')]=function(_0x49a838){var _0x44d38d=this;return function(){var _0x1dc913=0x0;var _0x5960dc=Math[_0x4756('0x19d')](_0x49a838[_0x4756('0x86')]*0x3e8);if(_0x5960dc>0x0){_0x5960dc=_0x5960dc<0x64?0x64:_0x5960dc;loggerPredictive['info'](_0x49a838['name'],_0x4756('0x1b9'),_0x5960dc,_0x4756('0x45'));_0x49a838[_0x4756('0x8e')]=setInterval(function(){_0x44d38d[_0x4756('0x8e')](_0x49a838);loggerPredictiveCalls[_0x4756('0x76')](_0x4756('0x1ba'),_0x1dc913+=0x1);},_0x5960dc);}else{loggerPredictive[_0x4756('0x76')](_0x49a838[_0x4756('0x3d')],_0x4756('0x1bb'));}};};Dialer[_0x4756('0xa7')][_0x4756('0x1bc')]=function(_0x1026ed,_0x46b962){var _0x119ad5=this;return function(_0x4532cf){if(_['isEmpty'](_0x4532cf)){if(_[_0x4756('0xd9')](_0x46b962[_0x4756('0xd0')])||!_0x46b962[_0x4756('0x1bd')]){if(_0x1026ed[_0x4756('0x137')]==='booked'){_0x1026ed['queueStatusComplete']=_[_0x4756('0x3a')](_0x1026ed[_0x4756('0x10b')])?!![]:_0x1026ed[_0x4756('0x10b')];var _0x478fe3=uuid['v4']();_0x119ad5['actions'][_0x478fe3]=new Action(_0x1026ed,_0x46b962,_0x478fe3);loggerBooked[_0x4756('0x76')]('[booked][checkContactBlack]',_0x478fe3,_0x4756('0x1be'),JSON['stringify'](_0x1026ed[_0x4756('0x10b')]),_0x4756('0x1bf'),_0x1026ed[_0x4756('0x3d')]);if(_0x1026ed[_0x4756('0x10b')]){_0x1026ed[_0x4756('0x10b')]=![];_0x119ad5['queueBooked'][_0x119ad5[_0x4756('0x22')][_0x478fe3][_0x4756('0xb1')]]=[];ami[_0x4756('0xac')]({'actionid':_0x478fe3,'action':_0x4756('0x1c0'),'queue':_0x1026ed[_0x4756('0x3d')]})[_0x4756('0xaf')](function(_0x82a3bd){_0x119ad5[_0x4756('0xc9')](_0x1026ed);_0x119ad5[_0x4756('0xbd')]({'active':![],'ContactId':_0x119ad5[_0x4756('0x22')][_0x478fe3][_0x4756('0xce')],'ListId':_0x119ad5[_0x4756('0x22')][_0x478fe3]['ListId'],'VoiceQueueId':_0x119ad5[_0x4756('0x22')][_0x478fe3]['VoiceQueueId']||undefined,'CampaignId':_0x119ad5[_0x4756('0x22')][_0x478fe3][_0x4756('0x10f')]||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x1c1')));delete _0x119ad5[_0x4756('0x22')][_0x478fe3];});}else{loggerBooked[_0x4756('0x76')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x1026ed['queueStatusComplete']),_0x4756('0x1bf'),_0x1026ed['name']);_0x119ad5['updateOriginated'](_0x1026ed);_0x119ad5['rescheduleContact']({'active':![],'ContactId':_0x119ad5[_0x4756('0x22')][_0x478fe3][_0x4756('0xce')],'ListId':_0x119ad5[_0x4756('0x22')][_0x478fe3][_0x4756('0xcf')],'VoiceQueueId':_0x119ad5[_0x4756('0x22')][_0x478fe3]['VoiceQueueId']||undefined,'CampaignId':_0x119ad5[_0x4756('0x22')][_0x478fe3][_0x4756('0x10f')]||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x1c1')));delete _0x119ad5['actions'][_0x478fe3];}}else{return _0x119ad5[_0x4756('0x14a')](_0x1026ed,_0x46b962);}}else{if(getDiff(_0x46b962[_0x4756('0x1c2')])<_0x1026ed[_0x4756('0x1c3')]*0x3c){_0x119ad5['preview'][_0x4756('0x116')](_0x46b962['id'])[_0x4756('0x1a')](function(){_0x119ad5['updateOriginated'](_0x1026ed);});}else{_0x1026ed[_0x4756('0x1c4')]+=0x1;_0x119ad5[_0x4756('0xc9')](_0x1026ed);if(_0x1026ed['dialRecallInQueue']){_0x119ad5[_0x4756('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x46b962[_0x4756('0xce')],'ListId':_0x46b962[_0x4756('0xcf')],'VoiceQueueId':_0x46b962[_0x4756('0x10e')]||undefined,'CampaignId':_0x46b962['CampaignId']||undefined})[_0x4756('0xaf')](loggerCatch(_0x4756('0x1c5')));_0x119ad5['createHistory'](createObjHistory(_0x1026ed,_0x46b962,_0x4756('0x1c6'),0x17,_0x4756('0x1c7')))[_0x4756('0xaf')](loggerCatch(_0x4756('0x1c8')));}else{_0x119ad5['saveInDb'](createObjHistory(_0x1026ed,_0x46b962,_0x4756('0x1c9'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x1026ed[_0x4756('0x5a')]+=0x1;_0x119ad5[_0x4756('0xcc')](createObjHistory(_0x1026ed,_0x46b962,'BLACKLIST',0xd,_0x4756('0x1ca')),_0x4756('0x1cb'),'[Originate][MoveBlacklist]');throw _0x4756('0x1cc');}};};Dialer['prototype']['handleIvr']=function(_0x10d9a0){var _0x3aae50=this;var _0x200656=[];var _0x3d1e22=_0x10d9a0[_0x4756('0x1cd')]-_0x10d9a0[_0x4756('0x6b')]-_0x10d9a0[_0x4756('0x1ce')];emitCampaignSummary(_0x10d9a0);if(_0x3d1e22>0x0){if(_0x3d1e22>this['maxNumberOriginate']){_0x3d1e22=this[_0x4756('0x20')];}_0x10d9a0[_0x4756('0x1ce')]+=_0x3d1e22;this[_0x4756('0x1cf')](_0x10d9a0['id'],_0x3d1e22,_0x10d9a0[_0x4756('0x1d0')])[_0x4756('0xb8')](function(_0x3ea214){_0x10d9a0[_0x4756('0x1ce')]-=_0x3d1e22;_0x10d9a0[_0x4756('0x1ce')]=_0x10d9a0[_0x4756('0x1ce')]>0x0?_0x10d9a0[_0x4756('0x1ce')]:0x0;if(!checkContactEmpty(_0x3ea214)){_0x10d9a0[_0x4756('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x4756('0x76')](_0x4756('0x1d1')+_0x10d9a0[_0x4756('0x3d')]);}else{_0x10d9a0[_0x4756('0x6b')]+=_0x3ea214['length'];_0x10d9a0[_0x4756('0x3b')]=_0x4756('0x1d2');for(var _0x3d566d=0x0;_0x3d566d<_0x3ea214[_0x4756('0x96')];_0x3d566d+=0x1){_0x10d9a0[_0x4756('0x1d3')]+=0x1;if(_['isNil'](_0x3ea214[_0x3d566d])||_[_0x4756('0xd9')](_0x3ea214[_0x3d566d]['Contact'])||_[_0x4756('0xd9')](_0x3ea214[_0x3d566d][_0x4756('0x14e')][_0x4756('0x14d')])){_0x3aae50[_0x4756('0xca')](_0x4756('0x1d4'),_0x10d9a0,_0x3ea214[_0x3d566d]);}else{_0x3aae50[_0x4756('0xb9')](_[_0x4756('0xcd')](_0x3ea214[_0x3d566d],['CampaignId',_0x4756('0x1d5')]))[_0x4756('0xb8')](_0x3aae50[_0x4756('0x1bc')](_0x10d9a0,_0x3ea214[_0x3d566d]))[_0x4756('0xaf')](_0x3aae50['loggerHandler'](_0x4756('0x1d6'),_0x10d9a0));}}}})[_0x4756('0xaf')](loggerGetContactDialer(_0x4756('0x1d7'),_0x10d9a0,_0x3d1e22));}};Dialer[_0x4756('0xa7')][_0x4756('0x13a')]=function(_0xfe6a87,_0x2a0020){var _0x4ef280=this;var _0x30af09=[];var _0x165da3=_0x2a0020>=0x1?_0x2a0020:0x1;var _0x5ec5ad=[];if(_0xfe6a87[_0x4756('0x137')]==='booked'){_0x165da3=0x1;}var _0x3e1d5f=Math['floor'](_0xfe6a87[_0x4756('0x4d')]*_0x165da3)-_0xfe6a87[_0x4756('0x6b')]-_0xfe6a87[_0x4756('0x1ce')];emitVoiceQueueSummary(_0xfe6a87);if(_0xfe6a87[_0x4756('0x1d8')]>0x0){var _0x834b9=_0xfe6a87['dialLimitQueue']-_0xfe6a87[_0x4756('0x6b')]-_0xfe6a87[_0x4756('0x19c')]-_0xfe6a87[_0x4756('0x1ce')]-_0xfe6a87[_0x4756('0x4f')];if(_0x3e1d5f>_0x834b9){_0x3e1d5f=_0x834b9;}}if(_0x3e1d5f>0x0){if(_0xfe6a87['dialMethod']===_0x4756('0x8')){_0x3e1d5f=0x1;}if(_0x3e1d5f>this[_0x4756('0x20')]){_0x3e1d5f=this[_0x4756('0x20')];}_0xfe6a87[_0x4756('0x1ce')]+=_0x3e1d5f;for(var _0x264b58 in this[_0x4756('0x1e')]){if(this[_0x4756('0x1e')][_0x4756('0x97')](_0x264b58)){if(this[_0x4756('0x1e')][_0x264b58][_0x4756('0xa3')]===_0x4756('0x1d9')&&this['agents'][_0x264b58]['status']===_0x4756('0xd5')){_0x30af09[_0x4756('0x10a')](this['agents'][_0x264b58]['id']);}}}this[_0x4756('0xbf')](_0xfe6a87['id'],_0x30af09,_0x3e1d5f,_0xfe6a87[_0x4756('0x1d0')])[_0x4756('0xb8')](function(_0x3be557){_0xfe6a87['temp']-=_0x3e1d5f;_0xfe6a87['temp']=_0xfe6a87[_0x4756('0x1ce')]>0x0?_0xfe6a87[_0x4756('0x1ce')]:0x0;if(!checkContactEmpty(_0x3be557)){_0x4ef280[_0x4756('0xb4')](_0xfe6a87)[_0x4756('0xb8')](sendMessageReschedule(_0xfe6a87))[_0x4756('0xaf')](loggerCatch(_0x4756('0xb6')));}else{_0xfe6a87[_0x4756('0x6b')]+=_0x3be557['length'];_0xfe6a87[_0x4756('0x3b')]=_0xfe6a87[_0x4756('0x137')]===_0x4756('0x8')?_0x4756('0x153'):_0x4756('0x1d2');for(var _0x1ea753=0x0;_0x1ea753<_0x3be557[_0x4756('0x96')];_0x1ea753+=0x1){if(_[_0x4756('0xd9')](_0x3be557[_0x1ea753])||_[_0x4756('0xd9')](_0x3be557[_0x1ea753][_0x4756('0x14e')])||_[_0x4756('0xd9')](_0x3be557[_0x1ea753][_0x4756('0x14e')][_0x4756('0x14d')])){_0x4ef280[_0x4756('0xca')](_0x4756('0x1d4'),_0xfe6a87,_0x3be557[_0x1ea753]);}else{_0x4ef280[_0x4756('0xb7')](_[_0x4756('0xcd')](_0x3be557[_0x1ea753],['VoiceQueueId',_0x4756('0x1d5')]))[_0x4756('0xb8')](_0x4ef280[_0x4756('0x1bc')](_0xfe6a87,_0x3be557[_0x1ea753]))[_0x4756('0xaf')](_0x4ef280[_0x4756('0xc8')](_0x4756('0x1d4'),_0xfe6a87));}}}})[_0x4756('0xaf')](loggerGetContactDialer(_0x4756('0x1da'),_0xfe6a87,_0x3e1d5f));}};Dialer[_0x4756('0xa7')][_0x4756('0x8e')]=function(_0x490eda){var _0x38bb3d=this;if(_0x490eda[_0x4756('0x1d8')]>0x0){var _0x445c83=_0x490eda[_0x4756('0x1d8')]-_0x490eda[_0x4756('0x6b')]-_0x490eda[_0x4756('0x19c')];if(_0x445c83>0x0){this[_0x4756('0x1db')](_0x490eda);}else{loggerPredictiveCalls[_0x4756('0x76')]('[handlePredictive][limitChannel]');}}else{this[_0x4756('0x1db')](_0x490eda);}};Dialer[_0x4756('0xa7')][_0x4756('0x1db')]=function(_0x11ca42){var _0x515c78=this;var _0x855bfa=[];_0x11ca42[_0x4756('0x6b')]+=0x1;for(var _0x218486 in this[_0x4756('0x1e')]){if(this['agents'][_0x4756('0x97')](_0x218486)){if(this[_0x4756('0x1e')][_0x218486][_0x4756('0xa3')]===_0x4756('0x1d9')&&this['agents'][_0x218486][_0x4756('0xad')]===_0x4756('0xd5')){_0x855bfa[_0x4756('0x10a')](this[_0x4756('0x1e')][_0x218486]['id']);}}}this['getContactDialer'](_0x11ca42['id'],_0x855bfa,0x1,_0x11ca42['dialOrderByScheduledAt'])[_0x4756('0xb8')](function(_0x444df2){if(!checkContactEmpty(_0x444df2)){checkContactLowerLimitOriginate(_0x11ca42,0x1,0x0);_0x515c78[_0x4756('0xb4')](_0x11ca42)[_0x4756('0xb8')](sendMessageReschedule(_0x11ca42))[_0x4756('0xaf')](loggerCatch(_0x4756('0xb6')));}else{_0x11ca42[_0x4756('0x3b')]='RUNNING';if(_[_0x4756('0xd9')](_0x444df2[0x0])||_[_0x4756('0xd9')](_0x444df2[0x0]['Contact'])||_[_0x4756('0xd9')](_0x444df2[0x0][_0x4756('0x14e')][_0x4756('0x14d')])){_0x515c78['emptyContact'](_0x4756('0x1d4'),_0x11ca42,_0x444df2[0x0]);}else{_0x515c78[_0x4756('0xb7')](_[_0x4756('0xcd')](_0x444df2[0x0],[_0x4756('0x10e'),_0x4756('0x1d5')]))['then'](_0x515c78['checkContactBlack'](_0x11ca42,_0x444df2[0x0]))[_0x4756('0xaf')](_0x515c78[_0x4756('0xc8')]('[actionOriginatePredictive]\x20',_0x11ca42));}}})[_0x4756('0xaf')](loggerGetContactDialer(_0x4756('0x1dc'),_0x11ca42,0x1));emitVoiceQueueSummary(_0x11ca42);};Dialer['prototype'][_0x4756('0x1b7')]=function(_0x5e166e,_0x401f60,_0x2d26af,_0x345197,_0x55bea2,_0x20b433){loggerPredictive[_0x4756('0x76')](_0x4756('0x1dd'));loggerPredictive['info'](_0x4756('0x1de'),_0x5e166e);loggerPredictive['info'](_0x4756('0x1df'),_0x401f60);loggerPredictive['info'](_0x4756('0x1e0'),_0x2d26af);loggerPredictive[_0x4756('0x76')](_0x4756('0x1e1'),_0x345197);loggerPredictive[_0x4756('0x76')](_0x4756('0x1e2'),_0x55bea2);loggerPredictive[_0x4756('0x76')](_0x4756('0x80'));return new BPromise(function(_0x4ac0e5,_0x49e425){if(_0x5e166e<=0x0||isNaN(_0x5e166e)){return _0x49e425(msgResponse(_0x4756('0x1e3'),_0x4756('0x1e4'),'m\x20=\x20'+_0x5e166e));}if(_0x2d26af<=0x0||isNaN(_0x2d26af)){return _0x49e425(msgResponse(_0x4756('0x1e3'),_0x4756('0x1e4'),_0x4756('0x1e5')+_0x2d26af));}if(_0x345197<=0x0||isNaN(_0x345197)){return _0x49e425(msgResponse(_0x4756('0x1e3'),'Error',_0x4756('0x1e6')+_0x345197));}if(_0x401f60<=0x0||isNaN(_0x401f60)){return _0x49e425(msgResponse(_0x4756('0x1e3'),'Error',_0x4756('0x1e7')+_0x401f60));}if(_0x55bea2<=0x0||isNaN(_0x55bea2)){return _0x49e425(msgResponse(_0x4756('0x1e3'),_0x4756('0x1e4'),_0x4756('0x1e8')+_0x55bea2));}_0x20b433=_0x20b433||0x0;var _0x2e2b59=0x1/_0x2d26af;var _0x212f5a=0x0;var _0x4fcb6a=0x0;var _0x16aaf5=0x0;var _0x1389b6=0x0;for(var _0x1cc005=0x0;_0x16aaf5<_0x55bea2;_0x1cc005+=0x1){_0x4fcb6a=_0x1cc005/_0x401f60;_0x212f5a=(_0x345197*_0x4fcb6a+_0x20b433)/_0x2e2b59;_0x16aaf5=erlangb(_0x212f5a,_0x5e166e);_0x1389b6=_0x212f5a/_0x5e166e*(0x1-erlangb(_0x212f5a,_0x5e166e));}return _0x4ac0e5({'erlangCalls':_0x1cc005,'erlangCallToSecond':_0x401f60/_0x1cc005,'erlangAbandonmentRate':_0x16aaf5,'erlangBusyFactor':_0x1389b6});});};Dialer[_0x4756('0xa7')][_0x4756('0x1b1')]=function(_0x1345b7,_0x196c8e,_0x15d552,_0x57e9a6,_0x2e0537,_0x4ff02f){loggerPredictive[_0x4756('0x76')](_0x4756('0x1e9'));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',_0x1345b7);loggerPredictive['info'](_0x4756('0x1df'),_0x196c8e);loggerPredictive['info'](_0x4756('0x1e0'),_0x15d552);loggerPredictive[_0x4756('0x76')](_0x4756('0x1e1'),_0x57e9a6);loggerPredictive['info'](_0x4756('0x1ea'),_0x2e0537);loggerPredictive[_0x4756('0x76')]('---------------------------');return new BPromise(function(_0x152b2a,_0xfb8ed4){if(_0x1345b7<=0x0||isNaN(_0x1345b7)){return _0xfb8ed4(msgResponse('[busyFactor]',_0x4756('0x1e4'),'m\x20=\x20'+_0x1345b7));}if(_0x15d552<=0x0||isNaN(_0x15d552)){return _0xfb8ed4(msgResponse(_0x4756('0x1eb'),_0x4756('0x1e4'),_0x4756('0x1e5')+_0x15d552));}if(_0x57e9a6<=0x0||isNaN(_0x57e9a6)){return _0xfb8ed4(msgResponse(_0x4756('0x1eb'),_0x4756('0x1e4'),_0x4756('0x1e6')+_0x57e9a6));}if(_0x196c8e<=0x0||isNaN(_0x196c8e)){return _0xfb8ed4(msgResponse(_0x4756('0x1eb'),'Error',_0x4756('0x1e7')+_0x196c8e));}if(_0x2e0537<=0x0||isNaN(_0x2e0537)){return _0xfb8ed4(msgResponse('[busyFactor]',_0x4756('0x1e4'),_0x4756('0x1ec')+_0x2e0537));}_0x4ff02f=_0x4ff02f||0x0;var _0x5ad2be=0x1/_0x15d552;var _0x4ebbe8=0x0;var _0x469f37=0x0;var _0x301a48=0x0;var _0x38d942=0x0;for(var _0x420d6c=0x0;_0x38d942<_0x2e0537;_0x420d6c+=0x1){_0x469f37=_0x420d6c/_0x196c8e;_0x4ebbe8=(_0x57e9a6*_0x469f37+_0x4ff02f)/_0x5ad2be;_0x301a48=erlangb(_0x4ebbe8,_0x1345b7);_0x38d942=_0x4ebbe8/_0x1345b7*(0x1-erlangb(_0x4ebbe8,_0x1345b7));}return _0x152b2a({'erlangCalls':_0x420d6c,'erlangCallToSecond':_0x196c8e/_0x420d6c,'erlangAbandonmentRate':_0x301a48,'erlangBusyFactor':_0x38d942});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f3cf097..bb7d4a6 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 _0xa1b9=['countnoanswerretry','countglobal','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa1b9,0xd7));var _0x9a1b=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa1b9[_0x376b45];return _0x2341b3;};'use strict';var util=require(_0x9a1b('0x0'));var _=require(_0x9a1b('0x1'));var moment=require(_0x9a1b('0x2'));function getSeconds(_0x5ec0f,_0x3e6980){var _0x1d4fee=moment(_0x5ec0f)[_0x9a1b('0x3')](0x0);var _0x21d640=moment(_0x3e6980)[_0x9a1b('0x3')](0x0);return _0x1d4fee[_0x9a1b('0x4')](_0x21d640,_0x9a1b('0x5'));}function QueueCallerAbandon(_0x286eff,_0x29dbb3){this[_0x9a1b('0x6')]=_0x286eff[_0x9a1b('0x6')];this['type']=_0x286eff[_0x9a1b('0x7')];this[_0x9a1b('0x8')]=_0x286eff[_0x9a1b('0x7')]===_0x9a1b('0x9')?_0x9a1b('0xa'):_0x286eff[_0x9a1b('0x7')];this[_0x9a1b('0xb')]=_0x286eff[_0x9a1b('0xb')];this[_0x9a1b('0xc')]=_0x286eff[_0x9a1b('0xc')];this['countnoanswerretry']=_0x286eff[_0x9a1b('0xd')];this[_0x9a1b('0xe')]=_0x286eff[_0x9a1b('0xb')]+_0x286eff[_0x9a1b('0xc')]+_0x286eff[_0x9a1b('0xd')];this[_0x9a1b('0xf')]=_0x29dbb3[_0x9a1b('0xf')];this['calleridname']=_0x286eff['name'];this[_0x9a1b('0x10')]=_0x286eff[_0x9a1b('0x11')];this[_0x9a1b('0x12')]=_0x286eff['starttime'];this[_0x9a1b('0x13')]=_0x286eff[_0x9a1b('0x13')];this[_0x9a1b('0x14')]=_0x286eff[_0x9a1b('0x14')];this[_0x9a1b('0x15')]=this[_0x9a1b('0x14')];this[_0x9a1b('0x16')]=getSeconds(_0x286eff['responsetime'],_0x286eff[_0x9a1b('0x12')]);this[_0x9a1b('0x17')]=getSeconds(this[_0x9a1b('0x14')],_0x286eff['responsetime']);this[_0x9a1b('0x18')]=0x0;this[_0x9a1b('0xa')]=_0x29dbb3[_0x9a1b('0xa')];this[_0x9a1b('0x19')]=_0x29dbb3['connectedlinename'];this[_0x9a1b('0x1a')]=_0x29dbb3['reason'];this[_0x9a1b('0x1b')]=_0x286eff[_0x9a1b('0x1b')];this[_0x9a1b('0x1c')]=_0x286eff['callbackuniqueid'];this['callbackat']=_0x286eff['callbackat'];this[_0x9a1b('0x1d')]=_0x286eff[_0x9a1b('0x1d')];this['ContactId']=_0x286eff[_0x9a1b('0x1e')];this[_0x9a1b('0x1f')]=_0x286eff['ListId'];this[_0x9a1b('0x20')]=_0x286eff[_0x9a1b('0x20')];this[_0x9a1b('0x21')]=_0x286eff[_0x9a1b('0x21')];this[_0x9a1b('0x22')]=_0x286eff[_0x9a1b('0x22')];this[_0x9a1b('0x23')]=_0x286eff[_0x9a1b('0x23')]||'';this[_0x9a1b('0x24')]=_0x286eff[_0x9a1b('0x24')]||'';}module[_0x9a1b('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x08ec=['name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname'];(function(_0x24d451,_0x4b5a2d){var _0x5015bd=function(_0x491952){while(--_0x491952){_0x24d451['push'](_0x24d451['shift']());}};_0x5015bd(++_0x4b5a2d);}(_0x08ec,0x1c6));var _0xc08e=function(_0x113118,_0x55cd44){_0x113118=_0x113118-0x0;var _0x20bd49=_0x08ec[_0x113118];return _0x20bd49;};'use strict';var util=require(_0xc08e('0x0'));var _=require(_0xc08e('0x1'));var moment=require(_0xc08e('0x2'));function getSeconds(_0xe7ae16,_0x368090){var _0x24b893=moment(_0xe7ae16)[_0xc08e('0x3')](0x0);var _0x1c3852=moment(_0x368090)[_0xc08e('0x3')](0x0);return _0x24b893['diff'](_0x1c3852,_0xc08e('0x4'));}function QueueCallerAbandon(_0xcb7b3b,_0x25389e){this['scheduledat']=_0xcb7b3b['scheduledat'];this[_0xc08e('0x5')]=_0xcb7b3b[_0xc08e('0x5')];this[_0xc08e('0x6')]=_0xcb7b3b[_0xc08e('0x5')]===_0xc08e('0x7')?'queue':_0xcb7b3b[_0xc08e('0x5')];this[_0xc08e('0x8')]=_0xcb7b3b[_0xc08e('0x8')];this[_0xc08e('0x9')]=_0xcb7b3b['countcongestionretry'];this[_0xc08e('0xa')]=_0xcb7b3b[_0xc08e('0xa')];this[_0xc08e('0xb')]=_0xcb7b3b[_0xc08e('0x8')]+_0xcb7b3b['countcongestionretry']+_0xcb7b3b[_0xc08e('0xa')];this[_0xc08e('0xc')]=_0x25389e['uniqueid'];this[_0xc08e('0xd')]=_0xcb7b3b[_0xc08e('0xe')];this[_0xc08e('0xf')]=_0xcb7b3b['number'];this[_0xc08e('0x10')]=_0xcb7b3b[_0xc08e('0x10')];this[_0xc08e('0x11')]=_0xcb7b3b[_0xc08e('0x11')];this['droptime']=_0xcb7b3b[_0xc08e('0x12')];this[_0xc08e('0x13')]=this['droptime'];this[_0xc08e('0x14')]=getSeconds(_0xcb7b3b['responsetime'],_0xcb7b3b['starttime']);this['holdtime']=getSeconds(this[_0xc08e('0x12')],_0xcb7b3b['responsetime']);this['talktime']=0x0;this[_0xc08e('0x15')]=_0x25389e['queue'];this['membername']=_0x25389e[_0xc08e('0x16')];this[_0xc08e('0x17')]=_0x25389e[_0xc08e('0x17')];this['callback']=_0xcb7b3b[_0xc08e('0x18')];this[_0xc08e('0x19')]=_0xcb7b3b[_0xc08e('0x19')];this[_0xc08e('0x1a')]=_0xcb7b3b[_0xc08e('0x1a')];this[_0xc08e('0x1b')]=_0xcb7b3b[_0xc08e('0x1b')];this[_0xc08e('0x1c')]=_0xcb7b3b[_0xc08e('0x1c')];this[_0xc08e('0x1d')]=_0xcb7b3b[_0xc08e('0x1d')];this[_0xc08e('0x1e')]=_0xcb7b3b[_0xc08e('0x1e')];this['VoiceQueueId']=_0xcb7b3b[_0xc08e('0x1f')];this[_0xc08e('0x20')]=_0xcb7b3b['CampaignId'];this[_0xc08e('0x21')]=_0xcb7b3b[_0xc08e('0x21')]||'';this['originatecalleridname']=_0xcb7b3b[_0xc08e('0x22')]||'';}module[_0xc08e('0x23')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8104f05..bd6a0a2 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 _0x779e=['localstationid','headerinfo','path','AttachmentId','util','moment','uniqueid','channel','format','Trunk','fax'];(function(_0x24eb2f,_0x361426){var _0x231c1b=function(_0x49cc7d){while(--_0x49cc7d){_0x24eb2f['push'](_0x24eb2f['shift']());}};_0x231c1b(++_0x361426);}(_0x779e,0x138));var _0xe779=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x779e[_0xd050c6];return _0x7278a;};'use strict';var util=require(_0xe779('0x0'));var _=require('lodash');var moment=require(_0xe779('0x1'));function Action(_0x285c6f,_0x1983ed,_0x486c28){this[_0xe779('0x2')]=_0x285c6f||undefined;this[_0xe779('0x3')]=util[_0xe779('0x4')]('%s/%s/%s',_0x1983ed['tech'],_0x1983ed[_0xe779('0x5')]['name'],_0x486c28[_0xe779('0x6')]);this[_0xe779('0x7')]=_0x1983ed['localstationid'];this[_0xe779('0x8')]=_0x1983ed[_0xe779('0x8')];this[_0xe779('0x9')]=_0x486c28[_0xe779('0x9')];this[_0xe779('0xa')]=_0x486c28[_0xe779('0xa')];}module['exports']=Action; \ No newline at end of file +var _0x5cc7=['util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x5cc7,0x1a4));var _0x75cc=function(_0x2e304a,_0x3e9e50){_0x2e304a=_0x2e304a-0x0;var _0x275b92=_0x5cc7[_0x2e304a];return _0x275b92;};'use strict';var util=require(_0x75cc('0x0'));var _=require(_0x75cc('0x1'));var moment=require(_0x75cc('0x2'));function Action(_0x3fd82b,_0x58a413,_0x18226a){this['uniqueid']=_0x3fd82b||undefined;this[_0x75cc('0x3')]=util[_0x75cc('0x4')](_0x75cc('0x5'),_0x58a413[_0x75cc('0x6')],_0x58a413[_0x75cc('0x7')][_0x75cc('0x8')],_0x18226a[_0x75cc('0x9')]);this[_0x75cc('0xa')]=_0x58a413[_0x75cc('0xa')];this['headerinfo']=_0x58a413[_0x75cc('0xb')];this[_0x75cc('0xc')]=_0x18226a[_0x75cc('0xc')];this[_0x75cc('0xd')]=_0x18226a[_0x75cc('0xd')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ab0ffd1..3a2edf6 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 _0x72e0=['application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','value','channelstate','channelstatedesc','variable','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x72e0,0x199));var _0x072e=function(_0x4991a6,_0x1a20fc){_0x4991a6=_0x4991a6-0x0;var _0x4209af=_0x72e0[_0x4991a6];return _0x4209af;};'use strict';var util=require('util');var _=require(_0x072e('0x0'));var BPromise=require(_0x072e('0x1'));var uuid=require(_0x072e('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x072e('0x3'));var gs=require(_0x072e('0x4'));var logger=require(_0x072e('0x5'))(_0x072e('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x072e('0x7'));var ut=require('./util/util');var Action=require(_0x072e('0x8'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x072e('0x9'));var faxMessage=require(_0x072e('0xa'));function Fax(_0x1b9b9a){this[_0x072e('0xb')]={};this[_0x072e('0xc')]=_0x1b9b9a['faxAccounts'];this[_0x072e('0xd')]=_0x1b9b9a[_0x072e('0xd')];this[_0x072e('0xe')]={};ami['on'](_0x072e('0xf'),this[_0x072e('0x10')][_0x072e('0x11')](this));ami['on'](_0x072e('0x12'),this[_0x072e('0x13')][_0x072e('0x11')](this));ami['on'](_0x072e('0x14'),this[_0x072e('0x15')][_0x072e('0x11')](this));ami['on'](_0x072e('0x16'),this[_0x072e('0x17')]['bind'](this));ami['on'](_0x072e('0x18'),this['syncFaxStatus'][_0x072e('0x11')](this));ami['on'](_0x072e('0x19'),this[_0x072e('0x1a')][_0x072e('0x11')](this));ami['on'](_0x072e('0x1b'),this[_0x072e('0x1c')][_0x072e('0x11')](this));ami['on'](_0x072e('0x1d'),this[_0x072e('0x1e')]['bind'](this));}Fax[_0x072e('0x1f')][_0x072e('0x10')]=function(_0x833c26){if(_0x833c26[_0x072e('0x20')]==='from-voip-provider'){for(var _0x2e0595 in this['faxAccounts']){if(this[_0x072e('0xc')][_0x072e('0x21')](_0x2e0595)){if(_0x833c26[_0x072e('0x22')]===this['faxAccounts'][_0x2e0595]['localstationid']){this[_0x072e('0xb')][_0x833c26['uniqueid']]={};this[_0x072e('0xb')][_0x833c26[_0x072e('0x23')]][_0x072e('0x24')]=_0x833c26[_0x072e('0x24')];this[_0x072e('0xb')][_0x833c26[_0x072e('0x23')]]['id']=this[_0x072e('0xc')][_0x2e0595]['id'];this[_0x072e('0xb')][_0x833c26['uniqueid']][_0x072e('0x25')]=this[_0x072e('0xc')][_0x2e0595]['name'];logger[_0x072e('0x26')](_0x833c26[_0x072e('0x23')],_0x072e('0x27'));}}}}if(this[_0x072e('0xe')][_0x833c26[_0x072e('0x23')]]){this[_0x072e('0xb')][_0x833c26[_0x072e('0x23')]]={};this[_0x072e('0xb')][_0x833c26[_0x072e('0x23')]]['channel']=_0x833c26[_0x072e('0x24')];logger[_0x072e('0x26')](_0x833c26[_0x072e('0x23')],_0x072e('0x27'));}};Fax[_0x072e('0x1f')]['syncVarSet']=function(_0x8c05c0){if(this['channels'][_0x8c05c0['uniqueid']]){for(var _0x31fc71 in _0x8c05c0['variable']){if(_0x8c05c0['variable'][_0x072e('0x21')](_0x31fc71)){this[_0x072e('0xb')][_0x8c05c0[_0x072e('0x23')]][_0x31fc71]=_0x8c05c0[_0x072e('0x28')];}}}};Fax['prototype']['syncNewState']=function(_0x25a127){if(this[_0x072e('0xb')][_0x25a127[_0x072e('0x23')]]){this[_0x072e('0xb')][_0x25a127['uniqueid']][_0x072e('0x29')]=_0x25a127[_0x072e('0x29')];this['channels'][_0x25a127[_0x072e('0x23')]][_0x072e('0x2a')]=_0x25a127['channelstatedesc'];}};Fax[_0x072e('0x1f')]['syncNewExten']=function(_0x47c1f1){if(this['channels'][_0x47c1f1['uniqueid']]){for(var _0x2fc0d7 in _0x47c1f1[_0x072e('0x2b')]){if(_0x47c1f1[_0x072e('0x2b')][_0x072e('0x21')](_0x2fc0d7)){this[_0x072e('0xb')][_0x47c1f1[_0x072e('0x23')]][_0x2fc0d7]=_0x47c1f1['value'];}}}};Fax[_0x072e('0x1f')][_0x072e('0x2c')]=function(_0x1f8146){if(this[_0x072e('0xb')][_0x1f8146[_0x072e('0x23')]]){this[_0x072e('0xb')][_0x1f8146[_0x072e('0x23')]][_0x072e('0x2d')]=_0x1f8146[_0x072e('0x2d')];this['channels'][_0x1f8146[_0x072e('0x23')]]['status']=_0x1f8146[_0x072e('0x2e')];this['channels'][_0x1f8146[_0x072e('0x23')]][_0x072e('0x2f')]=_0x1f8146['localstationid'];this[_0x072e('0xb')][_0x1f8146['uniqueid']][_0x072e('0x30')]=_0x1f8146[_0x072e('0x30')];logger[_0x072e('0x26')](_0x1f8146[_0x072e('0x23')],_0x072e('0x31'));}};Fax[_0x072e('0x1f')]['syncReceiveFax']=function(_0x3cbd6a){var _0x4b1df0=this;if(this[_0x072e('0xb')][_0x3cbd6a[_0x072e('0x23')]]){var _0x3890f4=this[_0x072e('0xb')][_0x3cbd6a[_0x072e('0x23')]]['id'];this['channels'][_0x3cbd6a['uniqueid']][_0x072e('0x32')]=_0x3cbd6a[_0x072e('0x32')];this['channels'][_0x3cbd6a[_0x072e('0x23')]][_0x072e('0x33')]=_0x3cbd6a['pagestransferred'];this[_0x072e('0xb')][_0x3cbd6a['uniqueid']][_0x072e('0x2f')]=_0x3cbd6a[_0x072e('0x2f')];this[_0x072e('0xb')][_0x3cbd6a[_0x072e('0x23')]][_0x072e('0x34')]=_0x3cbd6a[_0x072e('0x34')];this[_0x072e('0xb')][_0x3cbd6a[_0x072e('0x23')]]['transferrate']=_0x3cbd6a[_0x072e('0x35')];this['channels'][_0x3cbd6a[_0x072e('0x23')]][_0x072e('0x30')]=_0x3cbd6a[_0x072e('0x30')];this[_0x072e('0xb')][_0x3cbd6a[_0x072e('0x23')]]['calleridnum']=_0x3cbd6a['calleridnum'];if(this[_0x072e('0xb')][_0x3cbd6a[_0x072e('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x3cbd6a[_0x072e('0x30')],_0x072e('0x36'),function(_0x52414c){logger[_0x072e('0x26')](_0x3cbd6a['uniqueid'],_0x072e('0x37'),_0x52414c[_0x072e('0x38')]);attachment[_0x072e('0x39')]({'name':path[_0x072e('0x3a')](_0x3cbd6a[_0x072e('0x30')])[_0x072e('0x25')],'basename':path[_0x072e('0x3a')](_0x3cbd6a[_0x072e('0x30')])[_0x072e('0x25')]+'.pdf','type':_0x072e('0x3b')})[_0x072e('0x3c')](function(_0x1ad701){faxAccount[_0x072e('0x3d')](_0x3890f4,{'from':_0x3cbd6a['calleridnum'],'mapKey':_0x072e('0x6'),'body':path[_0x072e('0x3a')](_0x3cbd6a[_0x072e('0x30')])['name']+_0x072e('0x3e'),'AttachmentId':_0x1ad701['id']})[_0x072e('0x3f')](function(_0x73d7bd){logger[_0x072e('0x40')](_0x3cbd6a[_0x072e('0x23')],_0x072e('0x41'),JSON[_0x072e('0x42')](_0x73d7bd));});})['catch'](function(_0x105a76){logger[_0x072e('0x40')](_0x3cbd6a[_0x072e('0x23')],_0x072e('0x43'),JSON[_0x072e('0x42')](_0x105a76));});});}logger[_0x072e('0x26')](_0x3cbd6a['uniqueid'],_0x072e('0x43'));}};Fax[_0x072e('0x1f')]['syncOriginateResponse']=function(_0x5373a0){if(this[_0x072e('0xe')][_0x5373a0[_0x072e('0x23')]]){_['merge'](this['channels'][_0x5373a0[_0x072e('0x23')]],_[_0x072e('0x44')](_0x5373a0,[_0x072e('0x45'),_0x072e('0x46')]));}};function updateStatus(_0x53ac8a){if(_0x53ac8a[_0x072e('0x47')]){faxMessage[_0x072e('0x48')](_0x53ac8a[_0x072e('0x47')],{'failMessage':_0x072e('0x49')})[_0x072e('0x3c')](function(_0x105ed3){ut[_0x072e('0x4a')](_0x072e('0x4b'),_0x105ed3);})['catch'](function(_0x3e15ba){ut['logger'](_0x072e('0x4c'),_0x3e15ba);});}else{ut['logger'](_0x072e('0x4d'));}}Fax[_0x072e('0x1f')][_0x072e('0x4e')]=function(_0x3e3fdd,_0x509d95,_0x50a3ca){var _0x2c2a76=this;var _0x315567={};if(_0x509d95){_0x315567={'read':_0x509d95};}else{_0x315567={'failMessage':_0x50a3ca};}if(this[_0x072e('0xe')][_0x3e3fdd]['AttachmentId']){faxMessage[_0x072e('0x48')](this[_0x072e('0xe')][_0x3e3fdd][_0x072e('0x47')],_0x315567)['then'](function(_0x2dce11){ut[_0x072e('0x4a')](_0x072e('0x4f'),_0x2dce11);})['catch'](function(_0x12ca29){ut[_0x072e('0x4a')]('[Fax][Message][NoUpdate1]',_0x12ca29);})['finally'](function(){delete _0x2c2a76['channels'][_0x3e3fdd];delete _0x2c2a76[_0x072e('0xe')][_0x3e3fdd];});}else{ut[_0x072e('0x4a')](_0x072e('0x50'));delete this[_0x072e('0xb')][_0x3e3fdd];delete this[_0x072e('0xe')][_0x3e3fdd];}};Fax['prototype'][_0x072e('0x1c')]=function(_0x1c2e84){var _0x1f2a54=this;if(this[_0x072e('0xb')][_0x1c2e84['uniqueid']]){if(this[_0x072e('0xe')][_0x1c2e84[_0x072e('0x23')]]){this[_0x072e('0xb')][_0x1c2e84['uniqueid']]['id']=this[_0x072e('0xe')][_0x1c2e84[_0x072e('0x23')]]['id'];this[_0x072e('0xb')][_0x1c2e84['uniqueid']][_0x072e('0x25')]=this['actions'][_0x1c2e84['uniqueid']][_0x072e('0x25')];}logger[_0x072e('0x26')](_0x1c2e84['uniqueid'],this[_0x072e('0xe')][_0x1c2e84[_0x072e('0x23')]]?'\x20hangup\x20sendFile\x20':_0x072e('0x51'),JSON[_0x072e('0x42')](this[_0x072e('0xb')][_0x1c2e84[_0x072e('0x23')]]));if(this[_0x072e('0xe')][_0x1c2e84[_0x072e('0x23')]]){if(this[_0x072e('0xb')][_0x1c2e84[_0x072e('0x23')]][_0x072e('0x52')]>0x0&&this[_0x072e('0xb')][_0x1c2e84[_0x072e('0x23')]][_0x072e('0x18')]===_0x072e('0x53')){this['updateStatus'](_0x1c2e84['uniqueid'],!![]);}else{this[_0x072e('0x4e')](_0x1c2e84[_0x072e('0x23')],![],this[_0x072e('0xb')][_0x1c2e84['uniqueid']][_0x072e('0x54')]?'SENDING\x20FAILED:\x20'+this[_0x072e('0xb')][_0x1c2e84[_0x072e('0x23')]]['faxstatusstring']:_0x072e('0x55'));}}}};Fax[_0x072e('0x1f')][_0x072e('0x56')]=function(_0x576671){var _0x1af275=this;return new BPromise(function(_0x2de9c5,_0xab7d04){_0x1af275[_0x072e('0x57')](_0x576671,_0x1af275[_0x072e('0xc')][_0x576671[_0x072e('0x58')]])['then'](function(_0x3a1f16){ut[_0x072e('0x4a')](_0x072e('0x59'),_0x3a1f16);_0x2de9c5(ut[_0x072e('0x38')](_0x072e('0x5a')));})[_0x072e('0x3f')](function(_0x209573){ut[_0x072e('0x4a')]('[Fax][execOriginate][failure]',_0x209573);updateStatus(_0x576671);_0xab7d04(ut[_0x072e('0x38')](_0x072e('0x5b')));});});};Fax['prototype'][_0x072e('0x5c')]=function(_0x50b9ee){var _0x55d244=this;return new BPromise(function(_0x3ac839,_0x89d88c){var _0x1d1d86=_0x55d244[_0x072e('0x5d')](_0x55d244[_0x072e('0xc')][_0x50b9ee[_0x072e('0x58')]][_0x072e('0x5e')],_0x50b9ee);if(_0x1d1d86[_0x072e('0x5f')]){_0x3ac839(ut['message'](_0x072e('0x60')));}else{_0x89d88c(ut[_0x072e('0x38')](_0x1d1d86[_0x072e('0x38')]));}});};function originate(_0x354435,_0x253ee1,_0x2b3f7b){return new BPromise(function(_0x22e1f2,_0x1d5a63){if(_0x2b3f7b){var _0x471937=util[_0x072e('0x61')](_0x072e('0x62'),path[_0x072e('0x3a')](_0x354435[_0x072e('0x63')])['name'],_0x354435['path']);gs[_0x072e('0x64')](_0x471937)[_0x072e('0x3c')](function(){_0x354435[_0x072e('0x63')]=util[_0x072e('0x61')]('%s/%s.tif',path[_0x072e('0x3a')](_0x354435[_0x072e('0x63')])[_0x072e('0x65')],path[_0x072e('0x3a')](_0x354435[_0x072e('0x63')])['name']);_0x253ee1[_0x072e('0x66')]=_0x354435[_0x072e('0x63')];ut[_0x072e('0x4a')](_0x072e('0x67'),'');ami[_0x072e('0x68')](ut[_0x072e('0x69')](_0x354435,_0x253ee1))[_0x072e('0x3c')](function(_0x3dc901){_0x22e1f2(_0x3dc901);})[_0x072e('0x3f')](function(_0x17a9c3){_0x1d5a63(_0x17a9c3);});})[_0x072e('0x3f')](function(_0x359d10){_0x1d5a63(_0x359d10);});}else{ami[_0x072e('0x68')](ut[_0x072e('0x69')](_0x354435,_0x253ee1))['then'](function(_0x2fa683){_0x22e1f2(_0x2fa683);})[_0x072e('0x3f')](function(_0x1d113c){_0x1d5a63(_0x1d113c);});}});}Fax[_0x072e('0x1f')]['execOriginate']=function(_0x49b3dd,_0x208e28){var _0x44452f=this;return new BPromise(function(_0x43afc7,_0x38ca40){var _0x4729e7=uuid['v4']();var _0x4b6294=ut['addVariables'](_0x49b3dd,_0x208e28);_0x44452f[_0x072e('0xe')][_0x4729e7]=new Action(_0x4729e7,_0x208e28,_0x49b3dd);var _0x2fd48b=_0x44452f[_0x072e('0xe')][_0x4729e7];if(path[_0x072e('0x3a')](_0x49b3dd[_0x072e('0x63')])['ext']==='.pdf'){originate(_0x2fd48b,_0x4b6294,!![])[_0x072e('0x3c')](function(_0xd6e097){_0x43afc7(_0xd6e097);})[_0x072e('0x3f')](function(_0x57e4e1){_0x38ca40(_0x57e4e1);});}else{originate(_0x2fd48b,_0x4b6294,![])[_0x072e('0x3c')](function(_0x4871a3){_0x43afc7(_0x4871a3);})[_0x072e('0x3f')](function(_0x1863d0){_0x38ca40(_0x1863d0);});}});};Fax[_0x072e('0x1f')][_0x072e('0x6a')]=function(_0x5be921){return!_[_0x072e('0x6b')](_0x5be921)&&!_[_0x072e('0x6b')](_0x5be921[_0x072e('0x25')])&&!_[_0x072e('0x6b')](_0x5be921[_0x072e('0x6c')])&&_0x5be921[_0x072e('0x6c')]&&!_[_0x072e('0x6b')](this[_0x072e('0xd')][util['format'](_0x072e('0x6d'),_0x5be921[_0x072e('0x25')])])&&!_[_0x072e('0x6b')](this[_0x072e('0xd')][util['format'](_0x072e('0x6d'),_0x5be921[_0x072e('0x25')])][_0x072e('0x2e')])&&(this[_0x072e('0xd')][util[_0x072e('0x61')](_0x072e('0x6d'),_0x5be921[_0x072e('0x25')])]['status']===_0x072e('0x6e')||this[_0x072e('0xd')][util[_0x072e('0x61')](_0x072e('0x6d'),_0x5be921['name'])][_0x072e('0x2e')]===_0x072e('0x6f'));};Fax[_0x072e('0x1f')]['checkTrunk']=function(_0xb5bbdb,_0x55940f){if(!this[_0x072e('0x6a')](_0xb5bbdb)){ut[_0x072e('0x4a')](_0x072e('0x70'),_[_0x072e('0x6b')](_0xb5bbdb)?'':_0xb5bbdb[_0x072e('0x25')]+_0x072e('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x072e('0x6b')](_0x55940f['fax'])){ut['logger'](_0x072e('0x72'),JSON[_0x072e('0x42')](_0x55940f));return{'isValid':![],'message':_0x072e('0x73')};}if(_[_0x072e('0x6b')](_0x55940f[_0x072e('0x63')])){ut[_0x072e('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x072e('0x42')](_0x55940f));return{'isValid':![],'message':_0x072e('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x4aec=['fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','varset','bind','newstate','syncNewState','newexten','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','exten','localstationid','uniqueid','channel','name','actions','prototype','syncVarSet','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','info','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','Is\x20Valid','exports','lodash','uuid','path','../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4aec,0xe8));var _0xc4ae=function(_0x2b0d79,_0x5b9dec){_0x2b0d79=_0x2b0d79-0x0;var _0x91a806=_0x4aec[_0x2b0d79];return _0x91a806;};'use strict';var util=require('util');var _=require(_0xc4ae('0x0'));var BPromise=require('bluebird');var uuid=require(_0xc4ae('0x1'));var moment=require('moment');var path=require(_0xc4ae('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xc4ae('0x3'))(_0xc4ae('0x4'));var ami=require(_0xc4ae('0x5'));var rpcDb=require(_0xc4ae('0x6'));var Channel=require(_0xc4ae('0x7'));var ut=require(_0xc4ae('0x8'));var Action=require(_0xc4ae('0x9'));var faxAccount=require(_0xc4ae('0xa'));var attachment=require(_0xc4ae('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x56c916){this[_0xc4ae('0xc')]={};this[_0xc4ae('0xd')]=_0x56c916['faxAccounts'];this[_0xc4ae('0xe')]=_0x56c916[_0xc4ae('0xe')];this['actions']={};ami['on'](_0xc4ae('0xf'),this['syncNewchannel']['bind'](this));ami['on'](_0xc4ae('0x10'),this['syncVarSet'][_0xc4ae('0x11')](this));ami['on'](_0xc4ae('0x12'),this[_0xc4ae('0x13')][_0xc4ae('0x11')](this));ami['on'](_0xc4ae('0x14'),this['syncNewExten']['bind'](this));ami['on']('faxstatus',this[_0xc4ae('0x15')][_0xc4ae('0x11')](this));ami['on'](_0xc4ae('0x16'),this['syncReceiveFax'][_0xc4ae('0x11')](this));ami['on'](_0xc4ae('0x17'),this[_0xc4ae('0x18')][_0xc4ae('0x11')](this));ami['on'](_0xc4ae('0x19'),this[_0xc4ae('0x1a')][_0xc4ae('0x11')](this));}Fax['prototype'][_0xc4ae('0x1b')]=function(_0x4f9da4){if(_0x4f9da4[_0xc4ae('0x1c')]==='from-voip-provider'){for(var _0x4192c6 in this[_0xc4ae('0xd')]){if(this[_0xc4ae('0xd')]['hasOwnProperty'](_0x4192c6)){if(_0x4f9da4[_0xc4ae('0x1d')]===this[_0xc4ae('0xd')][_0x4192c6][_0xc4ae('0x1e')]){this[_0xc4ae('0xc')][_0x4f9da4[_0xc4ae('0x1f')]]={};this['channels'][_0x4f9da4['uniqueid']]['channel']=_0x4f9da4[_0xc4ae('0x20')];this['channels'][_0x4f9da4[_0xc4ae('0x1f')]]['id']=this[_0xc4ae('0xd')][_0x4192c6]['id'];this[_0xc4ae('0xc')][_0x4f9da4[_0xc4ae('0x1f')]]['name']=this[_0xc4ae('0xd')][_0x4192c6][_0xc4ae('0x21')];logger['info'](_0x4f9da4['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xc4ae('0x22')][_0x4f9da4[_0xc4ae('0x1f')]]){this[_0xc4ae('0xc')][_0x4f9da4[_0xc4ae('0x1f')]]={};this[_0xc4ae('0xc')][_0x4f9da4['uniqueid']][_0xc4ae('0x20')]=_0x4f9da4[_0xc4ae('0x20')];logger['info'](_0x4f9da4[_0xc4ae('0x1f')],'\x20syncNewchannel\x20');}};Fax[_0xc4ae('0x23')][_0xc4ae('0x24')]=function(_0x17c85e){if(this[_0xc4ae('0xc')][_0x17c85e[_0xc4ae('0x1f')]]){for(var _0x57becd in _0x17c85e[_0xc4ae('0x25')]){if(_0x17c85e[_0xc4ae('0x25')][_0xc4ae('0x26')](_0x57becd)){this[_0xc4ae('0xc')][_0x17c85e['uniqueid']][_0x57becd]=_0x17c85e[_0xc4ae('0x27')];}}}};Fax[_0xc4ae('0x23')][_0xc4ae('0x13')]=function(_0x38d809){if(this[_0xc4ae('0xc')][_0x38d809[_0xc4ae('0x1f')]]){this[_0xc4ae('0xc')][_0x38d809['uniqueid']][_0xc4ae('0x28')]=_0x38d809['channelstate'];this[_0xc4ae('0xc')][_0x38d809['uniqueid']][_0xc4ae('0x29')]=_0x38d809[_0xc4ae('0x29')];}};Fax[_0xc4ae('0x23')][_0xc4ae('0x2a')]=function(_0x27c654){if(this[_0xc4ae('0xc')][_0x27c654[_0xc4ae('0x1f')]]){for(var _0x47d527 in _0x27c654['variable']){if(_0x27c654[_0xc4ae('0x25')]['hasOwnProperty'](_0x47d527)){this[_0xc4ae('0xc')][_0x27c654['uniqueid']][_0x47d527]=_0x27c654[_0xc4ae('0x27')];}}}};Fax['prototype'][_0xc4ae('0x15')]=function(_0x564f49){if(this[_0xc4ae('0xc')][_0x564f49[_0xc4ae('0x1f')]]){this['channels'][_0x564f49['uniqueid']]['operation']=_0x564f49[_0xc4ae('0x2b')];this[_0xc4ae('0xc')][_0x564f49['uniqueid']][_0xc4ae('0x2c')]=_0x564f49[_0xc4ae('0x2c')];this['channels'][_0x564f49[_0xc4ae('0x1f')]][_0xc4ae('0x1e')]=_0x564f49[_0xc4ae('0x1e')];this[_0xc4ae('0xc')][_0x564f49[_0xc4ae('0x1f')]][_0xc4ae('0x2d')]=_0x564f49[_0xc4ae('0x2d')];logger['info'](_0x564f49[_0xc4ae('0x1f')],_0xc4ae('0x2e'));}};Fax[_0xc4ae('0x23')][_0xc4ae('0x2f')]=function(_0x24f97c){var _0x1f96ed=this;if(this[_0xc4ae('0xc')][_0x24f97c[_0xc4ae('0x1f')]]){var _0x1cf441=this[_0xc4ae('0xc')][_0x24f97c['uniqueid']]['id'];this[_0xc4ae('0xc')][_0x24f97c[_0xc4ae('0x1f')]][_0xc4ae('0x30')]=_0x24f97c[_0xc4ae('0x30')];this[_0xc4ae('0xc')][_0x24f97c[_0xc4ae('0x1f')]][_0xc4ae('0x31')]=_0x24f97c['pagestransferred'];this[_0xc4ae('0xc')][_0x24f97c[_0xc4ae('0x1f')]][_0xc4ae('0x1e')]=_0x24f97c[_0xc4ae('0x1e')];this['channels'][_0x24f97c['uniqueid']][_0xc4ae('0x32')]=_0x24f97c['resolution'];this[_0xc4ae('0xc')][_0x24f97c[_0xc4ae('0x1f')]][_0xc4ae('0x33')]=_0x24f97c[_0xc4ae('0x33')];this[_0xc4ae('0xc')][_0x24f97c[_0xc4ae('0x1f')]][_0xc4ae('0x2d')]=_0x24f97c[_0xc4ae('0x2d')];this['channels'][_0x24f97c[_0xc4ae('0x1f')]]['calleridnum']=_0x24f97c[_0xc4ae('0x34')];if(this['channels'][_0x24f97c[_0xc4ae('0x1f')]]['pagestransferred']>0x0){tiff2pdf(_0x24f97c[_0xc4ae('0x2d')],_0xc4ae('0x35'),function(_0x591e0b){logger[_0xc4ae('0x36')](_0x24f97c[_0xc4ae('0x1f')],_0xc4ae('0x37'),_0x591e0b['message']);attachment[_0xc4ae('0x38')]({'name':path[_0xc4ae('0x39')](_0x24f97c[_0xc4ae('0x2d')])[_0xc4ae('0x21')],'basename':path[_0xc4ae('0x39')](_0x24f97c[_0xc4ae('0x2d')])['name']+_0xc4ae('0x3a'),'type':'application/pdf'})[_0xc4ae('0x3b')](function(_0x1642c8){faxAccount[_0xc4ae('0x3c')](_0x1cf441,{'from':_0x24f97c[_0xc4ae('0x34')],'mapKey':'fax','body':path[_0xc4ae('0x39')](_0x24f97c['filename'])['name']+_0xc4ae('0x3a'),'AttachmentId':_0x1642c8['id']})['catch'](function(_0x2518be){logger[_0xc4ae('0x3d')](_0x24f97c['uniqueid'],_0xc4ae('0x3e'),JSON[_0xc4ae('0x3f')](_0x2518be));});})['catch'](function(_0x31d3df){logger[_0xc4ae('0x3d')](_0x24f97c[_0xc4ae('0x1f')],_0xc4ae('0x40'),JSON[_0xc4ae('0x3f')](_0x31d3df));});});}logger['info'](_0x24f97c['uniqueid'],_0xc4ae('0x40'));}};Fax[_0xc4ae('0x23')][_0xc4ae('0x1a')]=function(_0x256818){if(this[_0xc4ae('0x22')][_0x256818['uniqueid']]){_[_0xc4ae('0x41')](this[_0xc4ae('0xc')][_0x256818[_0xc4ae('0x1f')]],_[_0xc4ae('0x42')](_0x256818,[_0xc4ae('0x43'),_0xc4ae('0x44')]));}};function updateStatus(_0x3b3c91){if(_0x3b3c91['AttachmentId']){faxMessage['update'](_0x3b3c91[_0xc4ae('0x45')],{'failMessage':_0xc4ae('0x46')})[_0xc4ae('0x3b')](function(_0xeda86f){ut[_0xc4ae('0x47')](_0xc4ae('0x48'),_0xeda86f);})[_0xc4ae('0x49')](function(_0x58097a){ut[_0xc4ae('0x47')](_0xc4ae('0x4a'),_0x58097a);});}else{ut[_0xc4ae('0x47')](_0xc4ae('0x4b'));}}Fax[_0xc4ae('0x23')][_0xc4ae('0x4c')]=function(_0x29f8dc,_0x23cd14,_0x476165){var _0x803bc=this;var _0x13df9f={};if(_0x23cd14){_0x13df9f={'read':_0x23cd14};}else{_0x13df9f={'failMessage':_0x476165};}if(this[_0xc4ae('0x22')][_0x29f8dc][_0xc4ae('0x45')]){faxMessage[_0xc4ae('0x4d')](this['actions'][_0x29f8dc]['AttachmentId'],_0x13df9f)[_0xc4ae('0x3b')](function(_0x3def28){ut[_0xc4ae('0x47')](_0xc4ae('0x4e'),_0x3def28);})[_0xc4ae('0x49')](function(_0x65abd6){ut[_0xc4ae('0x47')]('[Fax][Message][NoUpdate1]',_0x65abd6);})[_0xc4ae('0x4f')](function(){delete _0x803bc[_0xc4ae('0xc')][_0x29f8dc];delete _0x803bc[_0xc4ae('0x22')][_0x29f8dc];});}else{ut[_0xc4ae('0x47')](_0xc4ae('0x50'));delete this[_0xc4ae('0xc')][_0x29f8dc];delete this[_0xc4ae('0x22')][_0x29f8dc];}};Fax[_0xc4ae('0x23')][_0xc4ae('0x18')]=function(_0x5e44a5){var _0x4865f2=this;if(this[_0xc4ae('0xc')][_0x5e44a5[_0xc4ae('0x1f')]]){if(this['actions'][_0x5e44a5['uniqueid']]){this['channels'][_0x5e44a5[_0xc4ae('0x1f')]]['id']=this[_0xc4ae('0x22')][_0x5e44a5[_0xc4ae('0x1f')]]['id'];this[_0xc4ae('0xc')][_0x5e44a5[_0xc4ae('0x1f')]]['name']=this[_0xc4ae('0x22')][_0x5e44a5[_0xc4ae('0x1f')]]['name'];}logger['info'](_0x5e44a5[_0xc4ae('0x1f')],this['actions'][_0x5e44a5['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xc4ae('0x51'),JSON['stringify'](this['channels'][_0x5e44a5[_0xc4ae('0x1f')]]));if(this[_0xc4ae('0x22')][_0x5e44a5[_0xc4ae('0x1f')]]){if(this[_0xc4ae('0xc')][_0x5e44a5[_0xc4ae('0x1f')]]['faxpages']>0x0&&this[_0xc4ae('0xc')][_0x5e44a5['uniqueid']][_0xc4ae('0x52')]==='SUCCESS'){this[_0xc4ae('0x4c')](_0x5e44a5[_0xc4ae('0x1f')],!![]);}else{this[_0xc4ae('0x4c')](_0x5e44a5[_0xc4ae('0x1f')],![],this[_0xc4ae('0xc')][_0x5e44a5[_0xc4ae('0x1f')]][_0xc4ae('0x53')]?_0xc4ae('0x54')+this[_0xc4ae('0xc')][_0x5e44a5[_0xc4ae('0x1f')]][_0xc4ae('0x53')]:_0xc4ae('0x55'));}}}};Fax['prototype'][_0xc4ae('0x56')]=function(_0x17e2a1){var _0x16e576=this;return new BPromise(function(_0xb0b828,_0x4e6c8f){_0x16e576[_0xc4ae('0x57')](_0x17e2a1,_0x16e576[_0xc4ae('0xd')][_0x17e2a1['FaxAccountId']])[_0xc4ae('0x3b')](function(_0x1fe649){ut['logger'](_0xc4ae('0x58'),_0x1fe649);_0xb0b828(ut[_0xc4ae('0x59')](_0xc4ae('0x5a')));})[_0xc4ae('0x49')](function(_0x2438d6){ut[_0xc4ae('0x47')](_0xc4ae('0x5b'),_0x2438d6);updateStatus(_0x17e2a1);_0x4e6c8f(ut['message'](_0xc4ae('0x5c')));});});};Fax['prototype']['checkAfterSend']=function(_0x73ef49){var _0x2f247f=this;return new BPromise(function(_0x23499c,_0x59dc03){var _0x3e61bd=_0x2f247f[_0xc4ae('0x5d')](_0x2f247f[_0xc4ae('0xd')][_0x73ef49['FaxAccountId']]['Trunk'],_0x73ef49);if(_0x3e61bd['isValid']){_0x23499c(ut[_0xc4ae('0x59')](_0xc4ae('0x5e')));}else{_0x59dc03(ut[_0xc4ae('0x59')](_0x3e61bd[_0xc4ae('0x59')]));}});};function originate(_0x488edc,_0x460d2f,_0x2fad00){return new BPromise(function(_0x34979d,_0x1e257f){if(_0x2fad00){var _0x5dc0bc=util[_0xc4ae('0x5f')](_0xc4ae('0x60'),path[_0xc4ae('0x39')](_0x488edc[_0xc4ae('0x2')])[_0xc4ae('0x21')],_0x488edc['path']);gs[_0xc4ae('0x61')](_0x5dc0bc)[_0xc4ae('0x3b')](function(){_0x488edc['path']=util[_0xc4ae('0x5f')](_0xc4ae('0x62'),path[_0xc4ae('0x39')](_0x488edc['path'])[_0xc4ae('0x63')],path[_0xc4ae('0x39')](_0x488edc[_0xc4ae('0x2')])['name']);_0x460d2f[_0xc4ae('0x64')]=_0x488edc[_0xc4ae('0x2')];ut['logger'](_0xc4ae('0x65'),'');ami[_0xc4ae('0x66')](ut[_0xc4ae('0x67')](_0x488edc,_0x460d2f))[_0xc4ae('0x3b')](function(_0x3a200b){_0x34979d(_0x3a200b);})[_0xc4ae('0x49')](function(_0x1ec70b){_0x1e257f(_0x1ec70b);});})['catch'](function(_0x5c1fd6){_0x1e257f(_0x5c1fd6);});}else{ami['Action'](ut[_0xc4ae('0x67')](_0x488edc,_0x460d2f))['then'](function(_0x50787d){_0x34979d(_0x50787d);})['catch'](function(_0xe435e8){_0x1e257f(_0xe435e8);});}});}Fax['prototype'][_0xc4ae('0x57')]=function(_0x16ab8e,_0x47e646){var _0x59c323=this;return new BPromise(function(_0x1e7907,_0x450849){var _0x5749b5=uuid['v4']();var _0x2b9d40=ut[_0xc4ae('0x68')](_0x16ab8e,_0x47e646);_0x59c323[_0xc4ae('0x22')][_0x5749b5]=new Action(_0x5749b5,_0x47e646,_0x16ab8e);var _0x3efa34=_0x59c323[_0xc4ae('0x22')][_0x5749b5];if(path['parse'](_0x16ab8e[_0xc4ae('0x2')])[_0xc4ae('0x69')]===_0xc4ae('0x3a')){originate(_0x3efa34,_0x2b9d40,!![])['then'](function(_0x5464bf){_0x1e7907(_0x5464bf);})[_0xc4ae('0x49')](function(_0x4cb364){_0x450849(_0x4cb364);});}else{originate(_0x3efa34,_0x2b9d40,![])[_0xc4ae('0x3b')](function(_0x424bfe){_0x1e7907(_0x424bfe);})[_0xc4ae('0x49')](function(_0x18afcd){_0x450849(_0x18afcd);});}});};Fax[_0xc4ae('0x23')][_0xc4ae('0x6a')]=function(_0x12b6db){return!_[_0xc4ae('0x6b')](_0x12b6db)&&!_[_0xc4ae('0x6b')](_0x12b6db[_0xc4ae('0x21')])&&!_['isNil'](_0x12b6db[_0xc4ae('0x6c')])&&_0x12b6db[_0xc4ae('0x6c')]&&!_[_0xc4ae('0x6b')](this['trunks'][util[_0xc4ae('0x5f')](_0xc4ae('0x6d'),_0x12b6db[_0xc4ae('0x21')])])&&!_[_0xc4ae('0x6b')](this[_0xc4ae('0xe')][util[_0xc4ae('0x5f')](_0xc4ae('0x6d'),_0x12b6db[_0xc4ae('0x21')])]['status'])&&(this[_0xc4ae('0xe')][util[_0xc4ae('0x5f')]('SIP/%s',_0x12b6db[_0xc4ae('0x21')])][_0xc4ae('0x2c')]===_0xc4ae('0x6e')||this[_0xc4ae('0xe')][util[_0xc4ae('0x5f')](_0xc4ae('0x6d'),_0x12b6db[_0xc4ae('0x21')])][_0xc4ae('0x2c')]===_0xc4ae('0x6f'));};Fax[_0xc4ae('0x23')][_0xc4ae('0x5d')]=function(_0x31bec0,_0x2449b0){if(!this['isTrunkReachable'](_0x31bec0)){ut['logger'](_0xc4ae('0x70'),_[_0xc4ae('0x6b')](_0x31bec0)?'':_0x31bec0[_0xc4ae('0x21')]+_0xc4ae('0x71'));return{'isValid':![],'message':_0xc4ae('0x72')};}if(_[_0xc4ae('0x6b')](_0x2449b0[_0xc4ae('0x4')])){ut[_0xc4ae('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x2449b0));return{'isValid':![],'message':_0xc4ae('0x73')};}if(_['isNil'](_0x2449b0['path'])){ut[_0xc4ae('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xc4ae('0x3f')](_0x2449b0));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xc4ae('0x74')};};module[_0xc4ae('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3b3e0e0..d03cb9b 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 _0x891b=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify','catch','[Notify]\x20','util'];(function(_0x4d7d41,_0x364db0){var _0x3c0342=function(_0x5108f5){while(--_0x5108f5){_0x4d7d41['push'](_0x4d7d41['shift']());}};_0x3c0342(++_0x364db0);}(_0x891b,0x131));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xb891('0x0'));var BPromise=require(_0xb891('0x1'));var logger=require(_0xb891('0x2'))(_0xb891('0x3'));var _=require('lodash');var faxAccount=require(_0xb891('0x4'));function loggerCatch(_0x5e2484){return function(_0x34c7bd){logger[_0xb891('0x5')](_0x5e2484,util['inspect'](_0x34c7bd,{'showHidden':![],'depth':null}));};}exports[_0xb891('0x6')]=function(_0x15eef8,_0x2dd21a){return BPromise['resolve']()['then'](faxAccount['notify'](_0x15eef8,_0x2dd21a))[_0xb891('0x7')](loggerCatch(_0xb891('0x8')));}; \ No newline at end of file +var _0xb879=['../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','../../../config/logger','preview','lodash'];(function(_0x2d12ee,_0x3245a6){var _0x4feaf5=function(_0x4a55c2){while(--_0x4a55c2){_0x2d12ee['push'](_0x2d12ee['shift']());}};_0x4feaf5(++_0x3245a6);}(_0xb879,0x15d));var _0x9b87=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb879[_0x1035c1];return _0x308d67;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x9b87('0x0'))(_0x9b87('0x1'));var _=require(_0x9b87('0x2'));var faxAccount=require(_0x9b87('0x3'));function loggerCatch(_0x4a3bb5){return function(_0x346826){logger[_0x9b87('0x4')](_0x4a3bb5,util[_0x9b87('0x5')](_0x346826,{'showHidden':![],'depth':null}));};}exports[_0x9b87('0x6')]=function(_0x576964,_0x6eaae){return BPromise[_0x9b87('0x7')]()[_0x9b87('0x8')](faxAccount[_0x9b87('0x6')](_0x576964,_0x6eaae))[_0x9b87('0x9')](loggerCatch(_0x9b87('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 7e6c6f9..348972a 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 _0xafce=['exec','execute','info','Exec\x20gs','inspect','../../../../config/logger','fax','bluebird'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0xafce,0x15d));var _0xeafc=function(_0x537044,_0x4de18f){_0x537044=_0x537044-0x0;var _0x5ba75e=_0xafce[_0x537044];return _0x5ba75e;};'use strict';var util=require('util');var logger=require(_0xeafc('0x0'))(_0xeafc('0x1'));var BPromise=require(_0xeafc('0x2'));var exec=require('child_process')[_0xeafc('0x3')];exports[_0xeafc('0x4')]=function(_0x1b787c){return new BPromise(function(_0x2979f7,_0x3db007){exec(_0x1b787c,function(_0x5c9d0b,_0x37dec2,_0x2c04f4){logger[_0xeafc('0x5')]('Exec\x20gs',_0x37dec2);if(_0x5c9d0b){logger['info'](_0xeafc('0x6'),'\x20Error\x20:',util[_0xeafc('0x7')](_0x5c9d0b,{'showHidden':![],'depth':null}),_0x37dec2,_0x2c04f4);_0x3db007(_0x5c9d0b);}_0x2979f7(_0x37dec2);});});}; \ No newline at end of file +var _0xf00b=['bluebird','child_process','exec','execute','info','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x4e99e0,_0xd87512){var _0x2378d5=function(_0x3abd12){while(--_0x3abd12){_0x4e99e0['push'](_0x4e99e0['shift']());}};_0x2378d5(++_0xd87512);}(_0xf00b,0xa7));var _0xbf00=function(_0x33d379,_0x2db393){_0x33d379=_0x33d379-0x0;var _0x456999=_0xf00b[_0x33d379];return _0x456999;};'use strict';var util=require(_0xbf00('0x0'));var logger=require(_0xbf00('0x1'))(_0xbf00('0x2'));var BPromise=require(_0xbf00('0x3'));var exec=require(_0xbf00('0x4'))[_0xbf00('0x5')];exports[_0xbf00('0x6')]=function(_0x35b846){return new BPromise(function(_0x237ec3,_0x2b538c){exec(_0x35b846,function(_0x3d62ba,_0x211845,_0x1b77ea){logger[_0xbf00('0x7')]('Exec\x20gs',_0x211845);if(_0x3d62ba){logger[_0xbf00('0x7')]('Exec\x20gs',_0xbf00('0x8'),util[_0xbf00('0x9')](_0x3d62ba,{'showHidden':![],'depth':null}),_0x211845,_0x1b77ea);_0x2b538c(_0x3d62ba);}_0x237ec3(_0x211845);});});}; \ 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 a1d3ae5..473193e 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 _0xa57f=['\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa57f,0x69));var _0xfa57=function(_0x58e5bc,_0x3ca296){_0x58e5bc=_0x58e5bc-0x0;var _0x23c40d=_0xa57f[_0x58e5bc];return _0x23c40d;};'use strict';var util=require(_0xfa57('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xfa57('0x1'))(_0xfa57('0x2'));exports['message']=function(_0x258a9b){return{'message':_0x258a9b};};exports[_0xfa57('0x3')]=function(_0x102b68,_0x21bca2){logger[_0xfa57('0x4')](_0x102b68,util[_0xfa57('0x5')](_0x21bca2,{'showHidden':![],'depth':null}));};exports[_0xfa57('0x6')]=function(_0x4301ba,_0x5b1c62){var _0x11dc2a={'XMF-ECM':_0x5b1c62[_0xfa57('0x7')],'XMF-HEADERINFO':_0x5b1c62[_0xfa57('0x8')],'XMF-MINRATE':_0x5b1c62[_0xfa57('0x9')],'XMF-MAXRATE':_0x5b1c62[_0xfa57('0xa')],'XMF-MODEM':util['format'](_0xfa57('0xb'),_0x5b1c62[_0xfa57('0xc')]),'XMF-GATEWAY':_0x5b1c62[_0xfa57('0xd')],'XMF-FAXDETECT':_0x5b1c62[_0xfa57('0xe')],'XMF-T38TIMEOUT':_0x5b1c62[_0xfa57('0xf')],'XMF-LOCALSTATIONID':_0x5b1c62[_0xfa57('0x10')],'XMF-PATH':_0x4301ba[_0xfa57('0x11')]};return _0x11dc2a;};exports[_0xfa57('0x12')]=function(_0x440647,_0x335137){return{'actionid':_0x440647[_0xfa57('0x13')],'action':_0xfa57('0x14'),'channel':_0x440647[_0xfa57('0x15')],'Exten':_0xfa57('0x16'),'Context':_0xfa57('0x17'),'Priority':'1','callerid':util[_0xfa57('0x18')](_0xfa57('0x19'),_0x440647[_0xfa57('0x8')]?_0x440647[_0xfa57('0x8')]:'',_0x440647[_0xfa57('0x10')]),'variable':_0x335137,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x440647[_0xfa57('0x13')]};}; \ No newline at end of file +var _0x224d=['uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','moment','fax','message','logger','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction'];(function(_0x3734cf,_0x4511f8){var _0xff69ce=function(_0x44469a){while(--_0x44469a){_0x3734cf['push'](_0x3734cf['shift']());}};_0xff69ce(++_0x4511f8);}(_0x224d,0x10f));var _0xd224=function(_0x4b7c65,_0x48df1d){_0x4b7c65=_0x4b7c65-0x0;var _0x16a07f=_0x224d[_0x4b7c65];return _0x16a07f;};'use strict';var util=require(_0xd224('0x0'));var _=require(_0xd224('0x1'));var moment=require(_0xd224('0x2'));var logger=require('../../../../config/logger')(_0xd224('0x3'));exports[_0xd224('0x4')]=function(_0x1e56bb){return{'message':_0x1e56bb};};exports[_0xd224('0x5')]=function(_0x59d8ed,_0x19f08b){logger['info'](_0x59d8ed,util['inspect'](_0x19f08b,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x8b6227,_0x416bec){var _0x5c4c7b={'XMF-ECM':_0x416bec[_0xd224('0x6')],'XMF-HEADERINFO':_0x416bec[_0xd224('0x7')],'XMF-MINRATE':_0x416bec[_0xd224('0x8')],'XMF-MAXRATE':_0x416bec[_0xd224('0x9')],'XMF-MODEM':util['format']('\x22%s\x22',_0x416bec[_0xd224('0xa')]),'XMF-GATEWAY':_0x416bec[_0xd224('0xb')],'XMF-FAXDETECT':_0x416bec[_0xd224('0xc')],'XMF-T38TIMEOUT':_0x416bec[_0xd224('0xd')],'XMF-LOCALSTATIONID':_0x416bec[_0xd224('0xe')],'XMF-PATH':_0x8b6227[_0xd224('0xf')]};return _0x5c4c7b;};exports[_0xd224('0x10')]=function(_0x1ad98b,_0x3c8191){return{'actionid':_0x1ad98b[_0xd224('0x11')],'action':_0xd224('0x12'),'channel':_0x1ad98b[_0xd224('0x13')],'Exten':_0xd224('0x14'),'Context':_0xd224('0x15'),'Priority':'1','callerid':util[_0xd224('0x16')](_0xd224('0x17'),_0x1ad98b[_0xd224('0x7')]?_0x1ad98b['headerinfo']:'',_0x1ad98b[_0xd224('0xe')]),'variable':_0x3c8191,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1ad98b[_0xd224('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9ef9ce0..820513c 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 _0xb368=['getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','catch','bluebird','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initTrunks','getVoiceQueues'];(function(_0x35edc6,_0x57edbf){var _0x1366a8=function(_0x530f2d){while(--_0x530f2d){_0x35edc6['push'](_0x35edc6['shift']());}};_0x1366a8(++_0x57edbf);}(_0xb368,0x153));var _0x8b36=function(_0x2292f7,_0x1e47a8){_0x2292f7=_0x2292f7-0x0;var _0x3fed49=_0xb368[_0x2292f7];return _0x3fed49;};'use strict';var BPromise=require(_0x8b36('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x8b36('0x1'));var Realtime=require(_0x8b36('0x2'));var Report=require(_0x8b36('0x3'));var Acw=require(_0x8b36('0x4'));var Trigger=require(_0x8b36('0x5'));var Dialer=require(_0x8b36('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x8b36('0x7'));var voiceQueue=require(_0x8b36('0x8'));var voiceQueueReport=require(_0x8b36('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x8b36('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x8b36('0xb'));var cmHopperHistory=require(_0x8b36('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x8b36('0xd'));var zendesk=require(_0x8b36('0xe'));var salesforce=require(_0x8b36('0xf'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8b36('0x10'));var desk=require(_0x8b36('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x8b36('0x12'));var servicenow=require(_0x8b36('0x13'));var dynamics365=require(_0x8b36('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8b36('0x15')](_0x8b36('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8b36('0x15')](_0x8b36('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x8b36('0x17')](user[_0x8b36('0x18')]())['then'](realtime['initAgents']())[_0x8b36('0x17')](user['getTelephones']())[_0x8b36('0x17')](realtime['initTelephones']())[_0x8b36('0x17')](trunk['getTrunks']())[_0x8b36('0x17')](realtime[_0x8b36('0x19')]())[_0x8b36('0x17')](voiceQueue[_0x8b36('0x1a')]())[_0x8b36('0x17')](realtime['initVoiceQueues']())[_0x8b36('0x17')](trigger[_0x8b36('0x1b')]())[_0x8b36('0x17')](realtime['initTriggers']())[_0x8b36('0x17')](template[_0x8b36('0x1c')]())['then'](realtime[_0x8b36('0x1d')]())['then'](zendesk[_0x8b36('0x1e')]())[_0x8b36('0x17')](realtime[_0x8b36('0x1f')]())[_0x8b36('0x17')](salesforce[_0x8b36('0x20')]())['then'](realtime[_0x8b36('0x21')]())[_0x8b36('0x17')](sugarcrm[_0x8b36('0x22')]())[_0x8b36('0x17')](realtime[_0x8b36('0x23')]())[_0x8b36('0x17')](freshdesk['getFreshdeskAccounts']())[_0x8b36('0x17')](realtime['initFreshdeskAccounts']())[_0x8b36('0x17')](desk[_0x8b36('0x24')]())[_0x8b36('0x17')](realtime[_0x8b36('0x25')]())[_0x8b36('0x17')](zoho[_0x8b36('0x26')]())['then'](realtime[_0x8b36('0x27')]())[_0x8b36('0x17')](vtiger[_0x8b36('0x28')]())['then'](realtime['initVtigerAccounts']())['then'](servicenow[_0x8b36('0x29')]())[_0x8b36('0x17')](realtime[_0x8b36('0x2a')]())[_0x8b36('0x17')](dynamics365[_0x8b36('0x2b')]())[_0x8b36('0x17')](realtime[_0x8b36('0x2c')]())[_0x8b36('0x17')](campaign[_0x8b36('0x2d')]())[_0x8b36('0x17')](realtime[_0x8b36('0x2e')]())['then'](voiceExtension[_0x8b36('0x2f')]())[_0x8b36('0x17')](realtime['initVoiceExtensions']())[_0x8b36('0x17')](faxAccount[_0x8b36('0x30')]())[_0x8b36('0x17')](realtime[_0x8b36('0x31')]())[_0x8b36('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x8b36('0x32')]()[_0x8b36('0x17')](voiceQueueReport[_0x8b36('0x33')]())[_0x8b36('0x17')](realtime[_0x8b36('0x34')]())['then'](cmHopperHistory[_0x8b36('0x35')]())[_0x8b36('0x17')](realtime[_0x8b36('0x36')]())[_0x8b36('0x17')](cmHopperHistory[_0x8b36('0x37')]())[_0x8b36('0x17')](realtime[_0x8b36('0x38')]())[_0x8b36('0x17')](voiceCallReport[_0x8b36('0x39')]())['then'](realtime['initVoiceCallReports']())[_0x8b36('0x17')](function(_0x2d311b){})['catch'](function(_0x3d6196){console[_0x8b36('0x3a')](_0x3d6196);});}function main(){return server[_0x8b36('0x3b')](realtime,preview,fax)['then'](function(_0x548e06){return initRealtime();})[_0x8b36('0x17')](function(){return initParams();})[_0x8b36('0x17')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x8b36('0x3c')](function(_0x1616f4){console['log'](_0x1616f4);});}main(); \ No newline at end of file +var _0x7d24=['initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','initAgents','getTelephones','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7d24,0x115));var _0x47d2=function(_0xf8d4d3,_0x3feff8){_0xf8d4d3=_0xf8d4d3-0x0;var _0x249e9b=_0x7d24[_0xf8d4d3];return _0x249e9b;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0x47d2('0x0'));var server=require(_0x47d2('0x1'));var Realtime=require('./realtime');var Report=require(_0x47d2('0x2'));var Acw=require(_0x47d2('0x3'));var Trigger=require(_0x47d2('0x4'));var Dialer=require(_0x47d2('0x5'));var Preview=require(_0x47d2('0x6'));var Fax=require(_0x47d2('0x7'));var user=require(_0x47d2('0x8'));var voiceQueue=require(_0x47d2('0x9'));var voiceQueueReport=require(_0x47d2('0xa'));var voiceCallReport=require(_0x47d2('0xb'));var trunk=require(_0x47d2('0xc'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x47d2('0xd'));var voiceExtension=require(_0x47d2('0xe'));var faxAccount=require(_0x47d2('0xf'));var zendesk=require(_0x47d2('0x10'));var salesforce=require(_0x47d2('0x11'));var sugarcrm=require(_0x47d2('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x47d2('0x13'));var zoho=require(_0x47d2('0x14'));var vtiger=require(_0x47d2('0x15'));var servicenow=require(_0x47d2('0x16'));var dynamics365=require(_0x47d2('0x17'));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()[_0x47d2('0x18')](_0x47d2('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x47d2('0x18')](_0x47d2('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x47d2('0x1a')](user['getAgents']())[_0x47d2('0x1a')](realtime[_0x47d2('0x1b')]())[_0x47d2('0x1a')](user[_0x47d2('0x1c')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x1d')]())[_0x47d2('0x1a')](trunk['getTrunks']())[_0x47d2('0x1a')](realtime[_0x47d2('0x1e')]())[_0x47d2('0x1a')](voiceQueue['getVoiceQueues']())[_0x47d2('0x1a')](realtime[_0x47d2('0x1f')]())['then'](trigger[_0x47d2('0x20')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x21')]())[_0x47d2('0x1a')](template[_0x47d2('0x22')]())[_0x47d2('0x1a')](realtime['initTemplates']())[_0x47d2('0x1a')](zendesk[_0x47d2('0x23')]())['then'](realtime[_0x47d2('0x24')]())['then'](salesforce[_0x47d2('0x25')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x26')]())[_0x47d2('0x1a')](sugarcrm[_0x47d2('0x27')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x28')]())[_0x47d2('0x1a')](freshdesk[_0x47d2('0x29')]())[_0x47d2('0x1a')](realtime['initFreshdeskAccounts']())['then'](desk[_0x47d2('0x2a')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x2b')]())[_0x47d2('0x1a')](zoho[_0x47d2('0x2c')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x2d')]())[_0x47d2('0x1a')](vtiger[_0x47d2('0x2e')]())[_0x47d2('0x1a')](realtime['initVtigerAccounts']())[_0x47d2('0x1a')](servicenow[_0x47d2('0x2f')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x30')]())['then'](dynamics365['getDynamics365Accounts']())[_0x47d2('0x1a')](realtime[_0x47d2('0x31')]())[_0x47d2('0x1a')](campaign['getCampaigns']())[_0x47d2('0x1a')](realtime['initCampaigns']())[_0x47d2('0x1a')](voiceExtension['getVoiceExtensions']())[_0x47d2('0x1a')](realtime[_0x47d2('0x32')]())['then'](faxAccount[_0x47d2('0x33')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x34')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x47d2('0x35')]()['then'](voiceQueueReport[_0x47d2('0x36')]())[_0x47d2('0x1a')](realtime['initVoiceQueueReports']())[_0x47d2('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x47d2('0x1a')](realtime[_0x47d2('0x37')]())[_0x47d2('0x1a')](cmHopperHistory[_0x47d2('0x38')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x39')]())['then'](voiceCallReport[_0x47d2('0x3a')]())[_0x47d2('0x1a')](realtime[_0x47d2('0x3b')]())[_0x47d2('0x1a')](function(_0xef5c1){})[_0x47d2('0x3c')](function(_0x4148a2){console[_0x47d2('0x3d')](_0x4148a2);});}function main(){return server[_0x47d2('0x3e')](realtime,preview,fax)[_0x47d2('0x1a')](function(_0x14efa8){return initRealtime();})[_0x47d2('0x1a')](function(){return initParams();})[_0x47d2('0x1a')](function(){report[_0x47d2('0x3f')]();setInterval(initRealtime,0x1388);})[_0x47d2('0x3c')](function(_0xb11b6f){console[_0x47d2('0x3d')](_0xb11b6f);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 80937ac..64085ea 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 _0x3a03=['interface','voiceStatusQueue','onhold','prototype','idle','inuse','voiceStatus','statePause','voiceStatusTime','toNumber','format','email','address','online','voiceStatusCallerIdNumber','user:%s','emit','exports','lodash','util','moment','md5','../../../config/environment','redis','socket.io-emitter','name','accountcode','fullname','state','unknown','stateTime','status','phone','mobile'];(function(_0x1eff74,_0x25849a){var _0x2a3194=function(_0x8ac8cf){while(--_0x8ac8cf){_0x1eff74['push'](_0x1eff74['shift']());}};_0x2a3194(++_0x25849a);}(_0x3a03,0xbc));var _0x33a0=function(_0x428704,_0x1c0bc5){_0x428704=_0x428704-0x0;var _0x39eb04=_0x3a03[_0x428704];return _0x39eb04;};'use strict';var _=require(_0x33a0('0x0'));var util=require(_0x33a0('0x1'));var moment=require(_0x33a0('0x2'));var md5=require(_0x33a0('0x3'));var Redis=require('ioredis');var config=require(_0x33a0('0x4'));config[_0x33a0('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x33a0('0x6'))(new Redis(config[_0x33a0('0x5')]));function Agent(_0x386a2d){this['id']=_0x386a2d['id']||0x0;this[_0x33a0('0x7')]=_0x386a2d[_0x33a0('0x7')]||'';this['email']=_0x386a2d['email']||'';this[_0x33a0('0x8')]=_0x386a2d[_0x33a0('0x8')]||'';this[_0x33a0('0x9')]=_0x386a2d[_0x33a0('0x9')]||'';this[_0x33a0('0xa')]=_0x33a0('0xb');this[_0x33a0('0xc')]=0x0;this[_0x33a0('0xd')]=_0x33a0('0xb');this['address']='';this[_0x33a0('0xe')]='';this[_0x33a0('0xf')]='';this[_0x33a0('0x10')]='';this['online']=_0x386a2d['online']||![];this['voiceStatus']=_0x33a0('0xb');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x33a0('0x11')]='';this[_0x33a0('0x12')]=![];this['local']=![];this[_0x33a0('0x3')]='';}Agent[_0x33a0('0x13')]['updateStatusRealtime']=function(_0x1de586){var _0x104abe;if(_0x1de586&&_0x1de586[_0x33a0('0xa')]){_0x104abe=_0x1de586[_0x33a0('0xa')]['toLowerCase']();switch(_0x104abe){case'not_inuse':_0x104abe=_0x33a0('0x14');break;case _0x33a0('0x15'):_0x104abe='talking';break;}}if(_0x104abe&&this[_0x33a0('0x16')]!==_0x104abe||_0x1de586[_0x33a0('0x17')]){this[_0x33a0('0x18')]=_[_0x33a0('0x19')](moment()[_0x33a0('0x1a')]('x'));}if(_0x104abe){this[_0x33a0('0x16')]=_0x104abe;}var _0x181d71={'id':this['id'],'name':this[_0x33a0('0x7')],'email':this[_0x33a0('0x1b')],'accountcode':this[_0x33a0('0x8')],'fullname':this[_0x33a0('0x9')],'state':this[_0x33a0('0xa')],'stateTime':this[_0x33a0('0xc')],'status':this[_0x33a0('0xd')],'address':this[_0x33a0('0x1c')],'online':this[_0x33a0('0x1d')],'voiceStatus':this[_0x33a0('0x16')],'voiceStatusTime':this[_0x33a0('0x18')],'voiceStatusCallerIdNumber':this[_0x33a0('0x1e')],'voiceStatusQueue':this[_0x33a0('0x11')],'interface':this[_0x33a0('0x10')],'onhold':this[_0x33a0('0x12')]};var _0x51513d=md5(JSON['stringify'](_0x181d71));if(this[_0x33a0('0x3')]!==_0x51513d){this['md5']=_0x51513d;io['to'](util[_0x33a0('0x1a')](_0x33a0('0x1f'),_0x181d71[_0x33a0('0x7')]))[_0x33a0('0x20')]('user:save',_0x181d71);}};module[_0x33a0('0x21')]=Agent; \ No newline at end of file +var _0x83a8=['user:%s','emit','user:save','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','state','toLowerCase','not_inuse','idle','voiceStatus','statePause','toNumber','accountcode','interface','stringify','format'];(function(_0x21f783,_0x3d3711){var _0x2c56af=function(_0x1a0efb){while(--_0x1a0efb){_0x21f783['push'](_0x21f783['shift']());}};_0x2c56af(++_0x3d3711);}(_0x83a8,0x1e4));var _0x883a=function(_0x39786e,_0x45deea){_0x39786e=_0x39786e-0x0;var _0x3e3a6e=_0x83a8[_0x39786e];return _0x3e3a6e;};'use strict';var _=require(_0x883a('0x0'));var util=require(_0x883a('0x1'));var moment=require(_0x883a('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x883a('0x3'));config['redis']=_[_0x883a('0x4')](config[_0x883a('0x5')],{'host':_0x883a('0x6'),'port':0x18eb});var io=require(_0x883a('0x7'))(new Redis(config[_0x883a('0x5')]));function Agent(_0x2e7ae0){this['id']=_0x2e7ae0['id']||0x0;this[_0x883a('0x8')]=_0x2e7ae0[_0x883a('0x8')]||'';this['email']=_0x2e7ae0[_0x883a('0x9')]||'';this['accountcode']=_0x2e7ae0['accountcode']||'';this[_0x883a('0xa')]=_0x2e7ae0['fullname']||'';this['state']=_0x883a('0xb');this[_0x883a('0xc')]=0x0;this[_0x883a('0xd')]=_0x883a('0xb');this[_0x883a('0xe')]='';this[_0x883a('0xf')]='';this[_0x883a('0x10')]='';this['interface']='';this[_0x883a('0x11')]=_0x2e7ae0[_0x883a('0x11')]||![];this['voiceStatus']=_0x883a('0xb');this[_0x883a('0x12')]=0x0;this[_0x883a('0x13')]='';this[_0x883a('0x14')]='';this[_0x883a('0x15')]=![];this[_0x883a('0x16')]=![];this[_0x883a('0x17')]='';}Agent[_0x883a('0x18')]['updateStatusRealtime']=function(_0x21a551){var _0x439fc2;if(_0x21a551&&_0x21a551[_0x883a('0x19')]){_0x439fc2=_0x21a551['state'][_0x883a('0x1a')]();switch(_0x439fc2){case _0x883a('0x1b'):_0x439fc2=_0x883a('0x1c');break;case'inuse':_0x439fc2='talking';break;}}if(_0x439fc2&&this[_0x883a('0x1d')]!==_0x439fc2||_0x21a551[_0x883a('0x1e')]){this['voiceStatusTime']=_[_0x883a('0x1f')](moment()['format']('x'));}if(_0x439fc2){this[_0x883a('0x1d')]=_0x439fc2;}var _0x468976={'id':this['id'],'name':this[_0x883a('0x8')],'email':this[_0x883a('0x9')],'accountcode':this[_0x883a('0x20')],'fullname':this[_0x883a('0xa')],'state':this[_0x883a('0x19')],'stateTime':this['stateTime'],'status':this[_0x883a('0xd')],'address':this[_0x883a('0xe')],'online':this['online'],'voiceStatus':this[_0x883a('0x1d')],'voiceStatusTime':this[_0x883a('0x12')],'voiceStatusCallerIdNumber':this[_0x883a('0x13')],'voiceStatusQueue':this[_0x883a('0x14')],'interface':this[_0x883a('0x21')],'onhold':this['onhold']};var _0x4d9d4b=md5(JSON[_0x883a('0x22')](_0x468976));if(this[_0x883a('0x17')]!==_0x4d9d4b){this[_0x883a('0x17')]=_0x4d9d4b;io['to'](util[_0x883a('0x23')](_0x883a('0x24'),_0x468976[_0x883a('0x8')]))[_0x883a('0x25')](_0x883a('0x26'),_0x468976);}};module[_0x883a('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index bf733f4..7fbaccc 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 _0x81d5=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x4d447b,_0x1ee9de){var _0x35af9b=function(_0x2a8462){while(--_0x2a8462){_0x4d447b['push'](_0x4d447b['shift']());}};_0x35af9b(++_0x1ee9de);}(_0x81d5,0x1ab));var _0x581d=function(_0x1ab87b,_0x5645c8){_0x1ab87b=_0x1ab87b-0x0;var _0x489cd0=_0x81d5[_0x1ab87b];return _0x489cd0;};'use strict';function Campaign(_0x1f0361){this['id']=_0x1f0361['id']||0x0;this[_0x581d('0x0')]=_0x1f0361['name']||'';this[_0x581d('0x1')]=_0x1f0361[_0x581d('0x1')]||_0x581d('0x2');this[_0x581d('0x3')]=0x0;this[_0x581d('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x581d('0x5')]='';this[_0x581d('0x6')]=!![];this[_0x581d('0x7')]=_0x1f0361['active'];this[_0x581d('0x8')]=_0x1f0361[_0x581d('0x8')];this[_0x581d('0x9')]=_0x1f0361['dialTimezone']||null;this[_0x581d('0xa')]=_0x1f0361['dialGlobalInterval']?_0x1f0361['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x1f0361[_0x581d('0xb')];this[_0x581d('0xc')]=_0x1f0361[_0x581d('0xc')];this[_0x581d('0xd')]=_0x1f0361[_0x581d('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x1f0361[_0x581d('0xe')];this[_0x581d('0xf')]=_0x1f0361[_0x581d('0xf')];this[_0x581d('0x10')]=_0x1f0361[_0x581d('0x10')];this[_0x581d('0x11')]=_0x1f0361[_0x581d('0x11')];this[_0x581d('0x12')]=_0x1f0361[_0x581d('0x12')];this[_0x581d('0x13')]=_0x1f0361['dialNoAnswerRetryFrequency'];this[_0x581d('0x14')]=_0x1f0361[_0x581d('0x14')];this['dialOrderByScheduledAt']=_0x1f0361['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x1f0361[_0x581d('0x15')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1f0361[_0x581d('0x16')]||undefined;this[_0x581d('0x17')]=_0x1f0361['dialCutDigit']||undefined;this[_0x581d('0x18')]=_0x1f0361['TrunkBackup']?_0x1f0361[_0x581d('0x18')]:undefined;this[_0x581d('0x19')]=_0x1f0361[_0x581d('0x19')]?_0x1f0361[_0x581d('0x19')]:undefined;this[_0x581d('0x1a')]=_0x1f0361[_0x581d('0x1a')]?_0x1f0361[_0x581d('0x1a')]:undefined;this['SquareProject']=_0x1f0361[_0x581d('0x1b')]?_0x1f0361[_0x581d('0x1b')]:undefined;this[_0x581d('0x1c')]=_0x1f0361[_0x581d('0x1b')]?_0x1f0361[_0x581d('0x1b')][_0x581d('0x0')]:undefined;this[_0x581d('0x1d')]=_0x1f0361[_0x581d('0x1d')]||![];this[_0x581d('0x1e')]=_0x1f0361[_0x581d('0x1e')];this[_0x581d('0x1f')]=_0x1f0361[_0x581d('0x1f')];this['dialAMDAfterGreetingSilence']=_0x1f0361[_0x581d('0x20')];this[_0x581d('0x21')]=_0x1f0361[_0x581d('0x21')];this[_0x581d('0x22')]=_0x1f0361[_0x581d('0x22')];this['dialAMDBetweenWordsSilence']=_0x1f0361[_0x581d('0x23')];this[_0x581d('0x24')]=_0x1f0361['dialAMDMaximumNumberOfWords'];this[_0x581d('0x25')]=_0x1f0361[_0x581d('0x25')];this[_0x581d('0x26')]=_0x1f0361['dialAMDMaximumWordLength'];}module[_0x581d('0x27')]=Campaign; \ No newline at end of file +var _0x453b=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated'];(function(_0x3603ee,_0x3b54fc){var _0x2cc814=function(_0x28da84){while(--_0x28da84){_0x3603ee['push'](_0x3603ee['shift']());}};_0x2cc814(++_0x3b54fc);}(_0x453b,0x164));var _0xb453=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x453b[_0x56c70f];return _0x3812ed;};'use strict';function Campaign(_0x264220){this['id']=_0x264220['id']||0x0;this[_0xb453('0x0')]=_0x264220[_0xb453('0x0')]||'';this[_0xb453('0x1')]=_0x264220[_0xb453('0x1')]||_0xb453('0x2');this[_0xb453('0x3')]=0x0;this[_0xb453('0x4')]=0x0;this[_0xb453('0x5')]=0x0;this[_0xb453('0x6')]=0x0;this[_0xb453('0x7')]='';this[_0xb453('0x8')]=!![];this[_0xb453('0x9')]=_0x264220[_0xb453('0x9')];this[_0xb453('0xa')]=_0x264220[_0xb453('0xa')];this['dialTimezone']=_0x264220[_0xb453('0xb')]||null;this[_0xb453('0xc')]=_0x264220['dialGlobalInterval']?_0x264220[_0xb453('0xc')]:null;this['dialOriginateCallerIdName']=_0x264220[_0xb453('0xd')];this[_0xb453('0xe')]=_0x264220[_0xb453('0xe')];this[_0xb453('0xf')]=_0x264220['dialOriginateTimeout']||0x1e;this[_0xb453('0x10')]=_0x264220[_0xb453('0x10')];this[_0xb453('0x11')]=_0x264220[_0xb453('0x11')];this[_0xb453('0x12')]=_0x264220[_0xb453('0x12')];this[_0xb453('0x13')]=_0x264220[_0xb453('0x13')];this[_0xb453('0x14')]=_0x264220['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x264220['dialNoAnswerRetryFrequency'];this[_0xb453('0x15')]=_0x264220['dialGlobalMaxRetry'];this[_0xb453('0x16')]=_0x264220[_0xb453('0x16')]||_0xb453('0x17');this['dialPrefix']=_0x264220['dialPrefix']||undefined;this[_0xb453('0x18')]=_0x264220[_0xb453('0x18')]||undefined;this[_0xb453('0x19')]=_0x264220[_0xb453('0x19')]||undefined;this[_0xb453('0x1a')]=_0x264220[_0xb453('0x1a')]?_0x264220[_0xb453('0x1a')]:undefined;this[_0xb453('0x1b')]=_0x264220[_0xb453('0x1b')]?_0x264220['Trunk']:undefined;this['Interval']=_0x264220['Interval']?_0x264220['Interval']:undefined;this[_0xb453('0x1c')]=_0x264220[_0xb453('0x1c')]?_0x264220[_0xb453('0x1c')]:undefined;this[_0xb453('0x1d')]=_0x264220[_0xb453('0x1c')]?_0x264220[_0xb453('0x1c')]['name']:undefined;this['dialAMDActive']=_0x264220['dialAMDActive']||![];this[_0xb453('0x1e')]=_0x264220['dialAMDInitialSilence'];this[_0xb453('0x1f')]=_0x264220[_0xb453('0x1f')];this[_0xb453('0x20')]=_0x264220[_0xb453('0x20')];this[_0xb453('0x21')]=_0x264220[_0xb453('0x21')];this[_0xb453('0x22')]=_0x264220[_0xb453('0x22')];this[_0xb453('0x23')]=_0x264220['dialAMDBetweenWordsSilence'];this[_0xb453('0x24')]=_0x264220[_0xb453('0x24')];this[_0xb453('0x25')]=_0x264220[_0xb453('0x25')];this[_0xb453('0x26')]=_0x264220[_0xb453('0x26')];}module[_0xb453('0x27')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5ffbc68..1992178 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 _0x8cad=['accountcode','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x3740ad,_0x47af97){var _0x44d0a9=function(_0x539e54){while(--_0x539e54){_0x3740ad['push'](_0x3740ad['shift']());}};_0x44d0a9(++_0x47af97);}(_0x8cad,0xfe));var _0xd8ca=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x8cad[_0x24f31b];return _0x488401;};'use strict';function Channel(){this[_0xd8ca('0x0')]=null;this[_0xd8ca('0x1')]='';this[_0xd8ca('0x2')]='';this[_0xd8ca('0x3')]=0x0;this[_0xd8ca('0x4')]='';this[_0xd8ca('0x5')]=undefined;this[_0xd8ca('0x6')]=undefined;this[_0xd8ca('0x7')]=0x0;this[_0xd8ca('0x8')]='';this[_0xd8ca('0x9')]=0x0;this[_0xd8ca('0xa')]=0x0;this[_0xd8ca('0xb')]=0x0;this[_0xd8ca('0xc')]=![];this[_0xd8ca('0xd')]=null;this['endtime']=null;this[_0xd8ca('0xe')]=![];this[_0xd8ca('0xf')]=![];this[_0xd8ca('0x10')]='';this[_0xd8ca('0x11')]='';this[_0xd8ca('0x12')]=0x0;this['billableseconds']=0x0;this[_0xd8ca('0x13')]=0x0;this['type']=null;this[_0xd8ca('0x14')]=null;this[_0xd8ca('0x15')]=null;this[_0xd8ca('0x16')]=![];this[_0xd8ca('0x17')]=null;this[_0xd8ca('0x18')]=null;this[_0xd8ca('0x19')]=[];this['transfercalleridnum']=undefined;this[_0xd8ca('0x1a')]=undefined;this[_0xd8ca('0x1b')]=0x0;}module[_0xd8ca('0x1c')]=Channel; \ No newline at end of file +var _0x1f92=['abandoned','lastapplication','duration','billableseconds','holdtime','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged'];(function(_0x28621b,_0x12fbbd){var _0x2c4d22=function(_0x324d34){while(--_0x324d34){_0x28621b['push'](_0x28621b['shift']());}};_0x2c4d22(++_0x12fbbd);}(_0x1f92,0x1ad));var _0x21f9=function(_0x4562ef,_0x4fc87d){_0x4562ef=_0x4562ef-0x0;var _0x19886d=_0x1f92[_0x4562ef];return _0x19886d;};'use strict';function Channel(){this[_0x21f9('0x0')]=null;this['channel']='';this[_0x21f9('0x1')]='';this[_0x21f9('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x21f9('0x3')]=undefined;this[_0x21f9('0x4')]=0x0;this[_0x21f9('0x5')]='';this[_0x21f9('0x6')]=0x0;this[_0x21f9('0x7')]=0x0;this[_0x21f9('0x8')]=0x0;this[_0x21f9('0x9')]=![];this[_0x21f9('0xa')]=null;this[_0x21f9('0xb')]=null;this[_0x21f9('0xc')]=![];this[_0x21f9('0xd')]=![];this[_0x21f9('0xe')]='';this['lastdata']='';this[_0x21f9('0xf')]=0x0;this[_0x21f9('0x10')]=0x0;this[_0x21f9('0x11')]=0x0;this['type']=null;this['tag']=null;this[_0x21f9('0x12')]=null;this[_0x21f9('0x13')]=![];this['monitorFilename']=null;this[_0x21f9('0x14')]=null;this[_0x21f9('0x15')]=[];this[_0x21f9('0x16')]=undefined;this[_0x21f9('0x17')]=undefined;this[_0x21f9('0x18')]=0x0;}module[_0x21f9('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d1f5c6d..e8f56ab 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 _0x27c2=['username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x350090,_0x1ba4fc){var _0x436fda=function(_0x513661){while(--_0x513661){_0x350090['push'](_0x350090['shift']());}};_0x436fda(++_0x1ba4fc);}(_0x27c2,0x11f));var _0x227c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x27c2[_0x14add3];return _0x4a174f;};'use strict';function DeskAccount(_0x522666){this['id']=_0x522666['id']||0x0;this[_0x227c('0x0')]=_0x522666[_0x227c('0x0')]||'';this[_0x227c('0x1')]=_0x522666[_0x227c('0x1')]||'';this[_0x227c('0x2')]=_0x522666['remoteUri']||'';this['authType']=_0x522666[_0x227c('0x3')]||'';this['password']=_0x522666[_0x227c('0x4')]||'';this['consumerKey']=_0x522666['consumerKey']||'';this[_0x227c('0x5')]=_0x522666[_0x227c('0x5')]||'';this[_0x227c('0x6')]=_0x522666[_0x227c('0x6')]||'';this[_0x227c('0x7')]=_0x522666[_0x227c('0x7')]||'';this[_0x227c('0x8')]=_0x522666['type']||'';this[_0x227c('0x9')]=_0x522666[_0x227c('0x9')]||'';this[_0x227c('0xa')]=_0x522666[_0x227c('0xa')]||{};}module[_0x227c('0xb')]=DeskAccount; \ No newline at end of file +var _0x6114=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x6114,0x180));var _0x4611=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x6114[_0x23c6f2];return _0x4c270b;};'use strict';function DeskAccount(_0x1515f2){this['id']=_0x1515f2['id']||0x0;this[_0x4611('0x0')]=_0x1515f2[_0x4611('0x0')]||'';this[_0x4611('0x1')]=_0x1515f2[_0x4611('0x1')]||'';this[_0x4611('0x2')]=_0x1515f2[_0x4611('0x2')]||'';this['authType']=_0x1515f2[_0x4611('0x3')]||'';this[_0x4611('0x4')]=_0x1515f2['password']||'';this[_0x4611('0x5')]=_0x1515f2[_0x4611('0x5')]||'';this['consumerSecret']=_0x1515f2[_0x4611('0x6')]||'';this[_0x4611('0x7')]=_0x1515f2[_0x4611('0x7')]||'';this[_0x4611('0x8')]=_0x1515f2[_0x4611('0x8')]||'';this[_0x4611('0x9')]=_0x1515f2[_0x4611('0x9')]||'';this[_0x4611('0xa')]=_0x1515f2[_0x4611('0xa')]||'';this[_0x4611('0xb')]=_0x1515f2['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 57f93e3..ec7341f 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 _0x42b1=['tenantId','clientId','clientSecret','serverUrl','exports','name','username','password','remoteUri'];(function(_0xf9cdbe,_0x1a692c){var _0x47b102=function(_0x5db4f9){while(--_0x5db4f9){_0xf9cdbe['push'](_0xf9cdbe['shift']());}};_0x47b102(++_0x1a692c);}(_0x42b1,0x164));var _0x142b=function(_0x24538e,_0x43c6d8){_0x24538e=_0x24538e-0x0;var _0x3fcdcb=_0x42b1[_0x24538e];return _0x3fcdcb;};'use strict';function Dynamics365Account(_0x9e5eff){this['id']=_0x9e5eff['id']||0x0;this[_0x142b('0x0')]=_0x9e5eff[_0x142b('0x0')]||'';this['username']=_0x9e5eff[_0x142b('0x1')]||'';this['password']=_0x9e5eff[_0x142b('0x2')]||'';this[_0x142b('0x3')]=_0x9e5eff[_0x142b('0x3')]||'';this[_0x142b('0x4')]=_0x9e5eff[_0x142b('0x4')]||'';this[_0x142b('0x5')]=_0x9e5eff[_0x142b('0x5')]||'';this[_0x142b('0x6')]=_0x9e5eff['clientSecret']||{};this[_0x142b('0x7')]=_0x9e5eff[_0x142b('0x7')]||'';this['Configurations']=_0x9e5eff['Configurations']||{};}module[_0x142b('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x1e79=['remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name','username','password'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1e79,0x14a));var _0x91e7=function(_0x18c0ca,_0x1f4c22){_0x18c0ca=_0x18c0ca-0x0;var _0x2e9c71=_0x1e79[_0x18c0ca];return _0x2e9c71;};'use strict';function Dynamics365Account(_0x1345fb){this['id']=_0x1345fb['id']||0x0;this['name']=_0x1345fb[_0x91e7('0x0')]||'';this['username']=_0x1345fb[_0x91e7('0x1')]||'';this['password']=_0x1345fb[_0x91e7('0x2')]||'';this[_0x91e7('0x3')]=_0x1345fb[_0x91e7('0x3')]||'';this[_0x91e7('0x4')]=_0x1345fb[_0x91e7('0x4')]||'';this['clientId']=_0x1345fb[_0x91e7('0x5')]||'';this['clientSecret']=_0x1345fb['clientSecret']||{};this[_0x91e7('0x6')]=_0x1345fb[_0x91e7('0x6')]||'';this['Configurations']=_0x1345fb[_0x91e7('0x7')]||{};}module[_0x91e7('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 17d7581..255a1c1 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 _0x1d2d=['key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x3bf360,_0x13a2e7){_0x3bf360=_0x3bf360-0x0;var _0x187bda=_0x1d2d[_0x3bf360];return _0x187bda;};'use strict';function FaxAccount(_0x4dfd6e){this['id']=_0x4dfd6e['id']||0x0;this[_0xd1d2('0x0')]=_0x4dfd6e[_0xd1d2('0x0')]||'';this[_0xd1d2('0x1')]=_0x4dfd6e[_0xd1d2('0x1')];this['ecm']=_0x4dfd6e[_0xd1d2('0x2')];this['headerinfo']=_0x4dfd6e['headerinfo'];this[_0xd1d2('0x3')]=_0x4dfd6e[_0xd1d2('0x3')];this[_0xd1d2('0x4')]=_0x4dfd6e[_0xd1d2('0x4')]||0x960;this[_0xd1d2('0x5')]=_0x4dfd6e[_0xd1d2('0x5')]||0x3840;this['modem']=_0x4dfd6e[_0xd1d2('0x6')]||_0xd1d2('0x7');this[_0xd1d2('0x8')]=_0x4dfd6e[_0xd1d2('0x8')]||'no';this[_0xd1d2('0x9')]=_0x4dfd6e[_0xd1d2('0x9')]||'no';this[_0xd1d2('0xa')]=_0x4dfd6e[_0xd1d2('0xa')]||0x1388;this[_0xd1d2('0xb')]=_0x4dfd6e[_0xd1d2('0xb')]||_0xd1d2('0xc');this[_0xd1d2('0xd')]=_0x4dfd6e[_0xd1d2('0xd')]?_0x4dfd6e['Trunk']:undefined;this[_0xd1d2('0xe')]=_0x4dfd6e[_0xd1d2('0xe')];this[_0xd1d2('0xf')]=_0x4dfd6e[_0xd1d2('0xf')];}module[_0xd1d2('0x10')]=FaxAccount; \ No newline at end of file +var _0x9bde=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x201bff,_0xb1a023){var _0x385b0f=function(_0x594f16){while(--_0x594f16){_0x201bff['push'](_0x201bff['shift']());}};_0x385b0f(++_0xb1a023);}(_0x9bde,0xe1));var _0xe9bd=function(_0x37cebe,_0x209f63){_0x37cebe=_0x37cebe-0x0;var _0x5e4a32=_0x9bde[_0x37cebe];return _0x5e4a32;};'use strict';function FaxAccount(_0x284147){this['id']=_0x284147['id']||0x0;this[_0xe9bd('0x0')]=_0x284147['name']||'';this[_0xe9bd('0x1')]=_0x284147['description'];this[_0xe9bd('0x2')]=_0x284147[_0xe9bd('0x2')];this[_0xe9bd('0x3')]=_0x284147[_0xe9bd('0x3')];this[_0xe9bd('0x4')]=_0x284147[_0xe9bd('0x4')];this[_0xe9bd('0x5')]=_0x284147['minrate']||0x960;this[_0xe9bd('0x6')]=_0x284147[_0xe9bd('0x6')]||0x3840;this[_0xe9bd('0x7')]=_0x284147[_0xe9bd('0x7')]||_0xe9bd('0x8');this[_0xe9bd('0x9')]=_0x284147[_0xe9bd('0x9')]||'no';this[_0xe9bd('0xa')]=_0x284147[_0xe9bd('0xa')]||'no';this[_0xe9bd('0xb')]=_0x284147['t38timeout']||0x1388;this['tech']=_0x284147[_0xe9bd('0xc')]||_0xe9bd('0xd');this[_0xe9bd('0xe')]=_0x284147['Trunk']?_0x284147[_0xe9bd('0xe')]:undefined;this[_0xe9bd('0xf')]=_0x284147[_0xe9bd('0xf')];this[_0xe9bd('0x10')]=_0x284147['key'];}module[_0xe9bd('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 53d9d6a..3bc3fc0 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 _0x19d6=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x26e161,_0x5ac9f4){var _0x434bcb=function(_0x35272e){while(--_0x35272e){_0x26e161['push'](_0x26e161['shift']());}};_0x434bcb(++_0x5ac9f4);}(_0x19d6,0x161));var _0x619d=function(_0x8a9d26,_0x320038){_0x8a9d26=_0x8a9d26-0x0;var _0x40a037=_0x19d6[_0x8a9d26];return _0x40a037;};'use strict';function FreshdeskAccount(_0x4bba87){this['id']=_0x4bba87['id']||0x0;this[_0x619d('0x0')]=_0x4bba87[_0x619d('0x0')]||'';this[_0x619d('0x1')]=_0x4bba87[_0x619d('0x1')]||'';this[_0x619d('0x2')]=_0x4bba87[_0x619d('0x3')]||'';this[_0x619d('0x4')]=_0x4bba87[_0x619d('0x4')]||'';this['serverUrl']=_0x4bba87[_0x619d('0x5')]||'';this['Configurations']=_0x4bba87[_0x619d('0x6')]||{};}module[_0x619d('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x094b=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x094b,0x184));var _0xb094=function(_0x5ad620,_0x5f3b7b){_0x5ad620=_0x5ad620-0x0;var _0x139ba9=_0x094b[_0x5ad620];return _0x139ba9;};'use strict';function FreshdeskAccount(_0x2e4d79){this['id']=_0x2e4d79['id']||0x0;this['name']=_0x2e4d79[_0xb094('0x0')]||'';this[_0xb094('0x1')]=_0x2e4d79['username']||'';this[_0xb094('0x2')]=_0x2e4d79[_0xb094('0x3')]||'';this[_0xb094('0x4')]=_0x2e4d79[_0xb094('0x4')]||'';this['serverUrl']=_0x2e4d79[_0xb094('0x5')]||'';this[_0xb094('0x6')]=_0x2e4d79[_0xb094('0x6')]||{};}module[_0xb094('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b5e7737..034ea52 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 _0x59fe=['holdtime','lastAssignedTo','mohtime','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','channel','connectedlinenum','connectedlinename','context','priority'];(function(_0x2e2568,_0x3f4818){var _0x58c455=function(_0x272a58){while(--_0x272a58){_0x2e2568['push'](_0x2e2568['shift']());}};_0x58c455(++_0x3f4818);}(_0x59fe,0x146));var _0xe59f=function(_0xdb4af1,_0x7e8499){_0xdb4af1=_0xdb4af1-0x0;var _0x28db30=_0x59fe[_0xdb4af1];return _0x28db30;};'use strict';function QueueReport(){this['type']='inbound';this[_0xe59f('0x0')]='';this[_0xe59f('0x1')]='';this[_0xe59f('0x2')]='';this[_0xe59f('0x3')]='';this[_0xe59f('0x4')]=null;this[_0xe59f('0x5')]=null;this[_0xe59f('0x6')]=0x1;this[_0xe59f('0x7')]=0x1;this[_0xe59f('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xe59f('0x9')]=![];this[_0xe59f('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xe59f('0xb')]='';this[_0xe59f('0xc')]='';this[_0xe59f('0xd')]='';this['accountcode']='';this[_0xe59f('0xe')]='';this['exten']='';this[_0xe59f('0xf')]='';this[_0xe59f('0x10')]=0x0;this['assigned']=![];this[_0xe59f('0x11')]='';this[_0xe59f('0x12')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xb3de=['exports','type','inbound','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','exten','priority','assigned','lastAssignedTo','mohtime','variables'];(function(_0x5f1813,_0x2e4909){var _0x5b3b08=function(_0xad70fd){while(--_0xad70fd){_0x5f1813['push'](_0x5f1813['shift']());}};_0x5b3b08(++_0x2e4909);}(_0xb3de,0x1e4));var _0xeb3d=function(_0x2fd642,_0x460c31){_0x2fd642=_0x2fd642-0x0;var _0x350476=_0xb3de[_0x2fd642];return _0x350476;};'use strict';function QueueReport(){this[_0xeb3d('0x0')]=_0xeb3d('0x1');this[_0xeb3d('0x2')]='';this[_0xeb3d('0x3')]='';this[_0xeb3d('0x4')]='';this[_0xeb3d('0x5')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xeb3d('0x6')]=0x1;this[_0xeb3d('0x7')]=0x1;this[_0xeb3d('0x8')]=![];this[_0xeb3d('0x9')]=null;this[_0xeb3d('0xa')]=![];this['queuecallercompleteAt']=null;this[_0xeb3d('0xb')]=![];this[_0xeb3d('0xc')]=null;this[_0xeb3d('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xeb3d('0xe')]='';this[_0xeb3d('0xf')]='';this['context']='';this[_0xeb3d('0x10')]='';this[_0xeb3d('0x11')]='';this['holdtime']=0x0;this[_0xeb3d('0x12')]=![];this[_0xeb3d('0x13')]='';this[_0xeb3d('0x14')]=0x0;this[_0xeb3d('0x15')]={};}module[_0xeb3d('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3970b4e..de8655d 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 _0x60c7=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0x60c7,0x1d6));var _0x760c=function(_0x977364,_0x5632f7){_0x977364=_0x977364-0x0;var _0x4183ab=_0x60c7[_0x977364];return _0x4183ab;};'use strict';function SalesforceAccount(_0x53af49){this['id']=_0x53af49['id']||0x0;this[_0x760c('0x0')]=_0x53af49[_0x760c('0x0')]||'';this[_0x760c('0x1')]=_0x53af49[_0x760c('0x1')]||'';this[_0x760c('0x2')]=_0x53af49[_0x760c('0x2')]||'';this[_0x760c('0x3')]=_0x53af49[_0x760c('0x3')]||'';this['clientId']=_0x53af49[_0x760c('0x4')]||'';this[_0x760c('0x5')]=_0x53af49[_0x760c('0x5')]||'';this[_0x760c('0x6')]=_0x53af49[_0x760c('0x6')]||'';this[_0x760c('0x7')]=_0x53af49['type']||_0x760c('0x8');this[_0x760c('0x9')]=_0x53af49['serverUrl']||'';this['Configurations']=_0x53af49[_0x760c('0xa')]||{};}module[_0x760c('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x93ab=['Configurations','name','username','remoteUri','password','clientId','clientSecret','type','serverUrl'];(function(_0x352b34,_0xad5796){var _0x4789f5=function(_0x23e1c5){while(--_0x23e1c5){_0x352b34['push'](_0x352b34['shift']());}};_0x4789f5(++_0xad5796);}(_0x93ab,0x172));var _0xb93a=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x93ab[_0x2bbc07];return _0x6879e4;};'use strict';function SalesforceAccount(_0x2bf600){this['id']=_0x2bf600['id']||0x0;this[_0xb93a('0x0')]=_0x2bf600[_0xb93a('0x0')]||'';this[_0xb93a('0x1')]=_0x2bf600[_0xb93a('0x1')]||'';this['remoteUri']=_0x2bf600[_0xb93a('0x2')]||'';this[_0xb93a('0x3')]=_0x2bf600['password']||'';this[_0xb93a('0x4')]=_0x2bf600[_0xb93a('0x4')]||'';this[_0xb93a('0x5')]=_0x2bf600[_0xb93a('0x5')]||'';this['securityToken']=_0x2bf600['securityToken']||'';this[_0xb93a('0x6')]=_0x2bf600[_0xb93a('0x6')]||'integrationTab';this[_0xb93a('0x7')]=_0x2bf600[_0xb93a('0x7')]||'';this[_0xb93a('0x8')]=_0x2bf600[_0xb93a('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e11774d..73f077e 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 _0xaccb=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5a714d,_0xb52bc2){var _0x3687f8=function(_0x2a80dc){while(--_0x2a80dc){_0x5a714d['push'](_0x5a714d['shift']());}};_0x3687f8(++_0xb52bc2);}(_0xaccb,0x19f));var _0xbacc=function(_0x48f977,_0x356c48){_0x48f977=_0x48f977-0x0;var _0x2ff3e0=_0xaccb[_0x48f977];return _0x2ff3e0;};'use strict';function ServicenowAccount(_0x5c66c7){this['id']=_0x5c66c7['id']||0x0;this[_0xbacc('0x0')]=_0x5c66c7[_0xbacc('0x0')]||'';this[_0xbacc('0x1')]=_0x5c66c7[_0xbacc('0x1')]||'';this[_0xbacc('0x2')]=_0x5c66c7['password']||'';this[_0xbacc('0x3')]=_0x5c66c7[_0xbacc('0x3')]||'';this[_0xbacc('0x4')]=_0x5c66c7[_0xbacc('0x4')]||'';this[_0xbacc('0x5')]=_0x5c66c7['Configurations']||{};}module[_0xbacc('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc1ee=['serverUrl','Configurations','exports','name','username','password'];(function(_0x462891,_0x27a139){var _0x1beda6=function(_0x14d847){while(--_0x14d847){_0x462891['push'](_0x462891['shift']());}};_0x1beda6(++_0x27a139);}(_0xc1ee,0x105));var _0xec1e=function(_0x361866,_0x3a953b){_0x361866=_0x361866-0x0;var _0x135111=_0xc1ee[_0x361866];return _0x135111;};'use strict';function ServicenowAccount(_0x216807){this['id']=_0x216807['id']||0x0;this[_0xec1e('0x0')]=_0x216807[_0xec1e('0x0')]||'';this[_0xec1e('0x1')]=_0x216807[_0xec1e('0x1')]||'';this['password']=_0x216807[_0xec1e('0x2')]||'';this['remoteUri']=_0x216807['remoteUri']||'';this['serverUrl']=_0x216807[_0xec1e('0x3')]||'';this[_0xec1e('0x4')]=_0x216807[_0xec1e('0x4')]||{};}module[_0xec1e('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1bcd36f..2eabe60 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 _0xc2bf=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xc2bf,0x1d9));var _0xfc2b=function(_0x1e54a0,_0x4363ff){_0x1e54a0=_0x1e54a0-0x0;var _0x53dc48=_0xc2bf[_0x1e54a0];return _0x53dc48;};'use strict';function SugarcrmAccount(_0x2d4096){this['id']=_0x2d4096['id']||0x0;this['name']=_0x2d4096[_0xfc2b('0x0')]||'';this[_0xfc2b('0x1')]=_0x2d4096[_0xfc2b('0x1')]||'';this[_0xfc2b('0x2')]=_0x2d4096['password']||'';this[_0xfc2b('0x3')]=_0x2d4096[_0xfc2b('0x3')]||'';this['serverUrl']=_0x2d4096[_0xfc2b('0x4')]||'';this[_0xfc2b('0x5')]=_0x2d4096[_0xfc2b('0x5')]||{};}module[_0xfc2b('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0734=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3a72a4,_0x5c9292){var _0x556f7f=function(_0x1da2c6){while(--_0x1da2c6){_0x3a72a4['push'](_0x3a72a4['shift']());}};_0x556f7f(++_0x5c9292);}(_0x0734,0x158));var _0x4073=function(_0x41abd8,_0x52f504){_0x41abd8=_0x41abd8-0x0;var _0xfc036b=_0x0734[_0x41abd8];return _0xfc036b;};'use strict';function SugarcrmAccount(_0x3b8a6a){this['id']=_0x3b8a6a['id']||0x0;this[_0x4073('0x0')]=_0x3b8a6a['name']||'';this[_0x4073('0x1')]=_0x3b8a6a[_0x4073('0x1')]||'';this[_0x4073('0x2')]=_0x3b8a6a['password']||'';this['remoteUri']=_0x3b8a6a[_0x4073('0x3')]||'';this[_0x4073('0x4')]=_0x3b8a6a['serverUrl']||'';this['Configurations']=_0x3b8a6a[_0x4073('0x5')]||{};}module[_0x4073('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4857167..b5e9931 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 _0xb72d=['address','accountcode','state','unknown','status'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb72d,0xba));var _0xdb72=function(_0x28b630,_0x200a17){_0x28b630=_0x28b630-0x0;var _0x55bccb=_0xb72d[_0x28b630];return _0x55bccb;};'use strict';function Telephone(_0x585649){this['id']=_0x585649['id']||0x0;this['name']=_0x585649['name']||'';this[_0xdb72('0x0')]=_0x585649[_0xdb72('0x0')]||'';this[_0xdb72('0x1')]=_0xdb72('0x2');this['stateTime']=0x0;this[_0xdb72('0x3')]=_0xdb72('0x2');this[_0xdb72('0x4')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xb04e=['name','accountcode','state','stateTime','unknown','exports'];(function(_0x1b87a6,_0x4b11a0){var _0x3f2b76=function(_0xb685ec){while(--_0xb685ec){_0x1b87a6['push'](_0x1b87a6['shift']());}};_0x3f2b76(++_0x4b11a0);}(_0xb04e,0x72));var _0xeb04=function(_0x28e854,_0x283f50){_0x28e854=_0x28e854-0x0;var _0x158a4b=_0xb04e[_0x28e854];return _0x158a4b;};'use strict';function Telephone(_0x1b0896){this['id']=_0x1b0896['id']||0x0;this[_0xeb04('0x0')]=_0x1b0896[_0xeb04('0x0')]||'';this[_0xeb04('0x1')]=_0x1b0896[_0xeb04('0x1')]||'';this[_0xeb04('0x2')]='unknown';this[_0xeb04('0x3')]=0x0;this['status']=_0xeb04('0x4');this['address']='';}module[_0xeb04('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 1c83498..9fceef8 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 _0xb821=['exports','name'];(function(_0x12766,_0x3a30e7){var _0x37e731=function(_0x236dcc){while(--_0x236dcc){_0x12766['push'](_0x12766['shift']());}};_0x37e731(++_0x3a30e7);}(_0xb821,0xa7));var _0x1b82=function(_0x30f624,_0x3d9b6f){_0x30f624=_0x30f624-0x0;var _0x507b9a=_0xb821[_0x30f624];return _0x507b9a;};'use strict';function template(_0x4befab){this['id']=_0x4befab['id']||0x0;this[_0x1b82('0x0')]=_0x4befab[_0x1b82('0x0')]||'';this['html']=_0x4befab['html']||'';}module[_0x1b82('0x1')]=template; \ No newline at end of file +var _0xe706=['exports','name','html'];(function(_0x49f52b,_0x3044ae){var _0xd7cfe8=function(_0x478534){while(--_0x478534){_0x49f52b['push'](_0x49f52b['shift']());}};_0xd7cfe8(++_0x3044ae);}(_0xe706,0xa3));var _0x6e70=function(_0x5aea3e,_0x20d237){_0x5aea3e=_0x5aea3e-0x0;var _0x558b7b=_0xe706[_0x5aea3e];return _0x558b7b;};'use strict';function template(_0x454c8f){this['id']=_0x454c8f['id']||0x0;this[_0x6e70('0x0')]=_0x454c8f[_0x6e70('0x0')]||'';this['html']=_0x454c8f[_0x6e70('0x1')]||'';}module[_0x6e70('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5272e7a..7a91860 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 _0xd3c1=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x59797f,_0x4a5541){var _0x23c15=function(_0x265d62){while(--_0x265d62){_0x59797f['push'](_0x59797f['shift']());}};_0x23c15(++_0x4a5541);}(_0xd3c1,0x184));var _0x1d3c=function(_0x53bba2,_0x2312c1){_0x53bba2=_0x53bba2-0x0;var _0x1b43b9=_0xd3c1[_0x53bba2];return _0x1b43b9;};'use strict';function Trigger(_0x2bd8ad){this['id']=_0x2bd8ad['id']||0x0;this[_0x1d3c('0x0')]=_0x2bd8ad[_0x1d3c('0x0')]||'';this[_0x1d3c('0x1')]=_0x2bd8ad[_0x1d3c('0x1')]||_0x1d3c('0x2');this[_0x1d3c('0x3')]=_0x2bd8ad[_0x1d3c('0x3')]||![];this['AllConditions']=_0x2bd8ad['AllConditions']||[];this[_0x1d3c('0x4')]=_0x2bd8ad['AnyConditions']||[];this[_0x1d3c('0x5')]=_0x2bd8ad[_0x1d3c('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xc5d0=['AllConditions','AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0xc5d0,0xac));var _0x0c5d=function(_0x5805a2,_0x3cb76b){_0x5805a2=_0x5805a2-0x0;var _0x542db2=_0xc5d0[_0x5805a2];return _0x542db2;};'use strict';function Trigger(_0x29508e){this['id']=_0x29508e['id']||0x0;this[_0x0c5d('0x0')]=_0x29508e[_0x0c5d('0x0')]||'';this[_0x0c5d('0x1')]=_0x29508e[_0x0c5d('0x1')]||_0x0c5d('0x2');this[_0x0c5d('0x3')]=_0x29508e[_0x0c5d('0x3')]||![];this[_0x0c5d('0x4')]=_0x29508e[_0x0c5d('0x4')]||[];this[_0x0c5d('0x5')]=_0x29508e[_0x0c5d('0x5')]||[];this[_0x0c5d('0x6')]=_0x29508e[_0x0c5d('0x6')]||[];}module[_0x0c5d('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 189546a..e11c423 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 _0x837f=['domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','domain'];(function(_0x9afb29,_0x36c840){var _0xf51bba=function(_0x4edc51){while(--_0x4edc51){_0x9afb29['push'](_0x9afb29['shift']());}};_0xf51bba(++_0x36c840);}(_0x837f,0x127));var _0xf837=function(_0x595fbe,_0x440cbe){_0x595fbe=_0x595fbe-0x0;var _0x135014=_0x837f[_0x595fbe];return _0x135014;};'use strict';function Trunk(_0x3216e0){this['id']=_0x3216e0['id']||0x0;this[_0xf837('0x0')]=_0x3216e0['active']||![];this[_0xf837('0x1')]=_0x3216e0[_0xf837('0x1')]||'';this[_0xf837('0x2')]='unknown';this[_0xf837('0x3')]=0x0;this[_0xf837('0x4')]=_0xf837('0x5');this[_0xf837('0x6')]=_0x3216e0[_0xf837('0x6')]&&_0x3216e0[_0xf837('0x6')][_0xf837('0x7')](':')?_0x3216e0[_0xf837('0x6')][_0xf837('0x8')](':')[0x0]:'';this[_0xf837('0x9')]='';this['port']='';this[_0xf837('0xa')]='';this[_0xf837('0xb')]='';this[_0xf837('0xc')]='';this[_0xf837('0xd')]='unknown';this[_0xf837('0xe')]='';this[_0xf837('0xf')]='';}module[_0xf837('0x10')]=Trunk; \ No newline at end of file +var _0x1fb9=['active','state','unknown','registry','indexOf','split','host','port','domain','domainport','stateRegistry','registrationtime','address','exports'];(function(_0x3c0c3c,_0x11fd1a){var _0x14dc36=function(_0x3f4e5c){while(--_0x3f4e5c){_0x3c0c3c['push'](_0x3c0c3c['shift']());}};_0x14dc36(++_0x11fd1a);}(_0x1fb9,0x134));var _0x91fb=function(_0x17136b,_0x6e4a61){_0x17136b=_0x17136b-0x0;var _0x13842a=_0x1fb9[_0x17136b];return _0x13842a;};'use strict';function Trunk(_0x1952ff){this['id']=_0x1952ff['id']||0x0;this[_0x91fb('0x0')]=_0x1952ff[_0x91fb('0x0')]||![];this['name']=_0x1952ff['name']||'';this[_0x91fb('0x1')]='unknown';this['stateTime']=0x0;this['status']=_0x91fb('0x2');this[_0x91fb('0x3')]=_0x1952ff[_0x91fb('0x3')]&&_0x1952ff[_0x91fb('0x3')][_0x91fb('0x4')](':')?_0x1952ff[_0x91fb('0x3')][_0x91fb('0x5')](':')[0x0]:'';this[_0x91fb('0x6')]='';this[_0x91fb('0x7')]='';this[_0x91fb('0x8')]='';this[_0x91fb('0x9')]='';this['refresh']='';this[_0x91fb('0xa')]=_0x91fb('0x2');this[_0x91fb('0xb')]='';this[_0x91fb('0xc')]='';}module[_0x91fb('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 81d4328..6b7df1c 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 _0x27db=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x2f7824,_0xe4c578){var _0x3fdc0e=function(_0x175ead){while(--_0x175ead){_0x2f7824['push'](_0x2f7824['shift']());}};_0x3fdc0e(++_0xe4c578);}(_0x27db,0x12b));var _0xb27d=function(_0x412ae1,_0x20a4c4){_0x412ae1=_0x412ae1-0x0;var _0x50bea0=_0x27db[_0x412ae1];return _0x50bea0;};'use strict';function voiceExtension(_0x460d39){this['id']=_0x460d39['id']||0x0;this['exten']=_0x460d39[_0xb27d('0x0')]||'';this[_0xb27d('0x1')]=_0x460d39[_0xb27d('0x1')]||_0xb27d('0x2');this[_0xb27d('0x3')]=_0x460d39[_0xb27d('0x3')]||![];}module[_0xb27d('0x4')]=voiceExtension; \ No newline at end of file +var _0x0de4=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x518e15,_0x568735){var _0x3bd658=function(_0x6a579f){while(--_0x6a579f){_0x518e15['push'](_0x518e15['shift']());}};_0x3bd658(++_0x568735);}(_0x0de4,0x6a));var _0x40de=function(_0x4baa52,_0x46ced4){_0x4baa52=_0x4baa52-0x0;var _0x4db836=_0x0de4[_0x4baa52];return _0x4db836;};'use strict';function voiceExtension(_0x1425ac){this['id']=_0x1425ac['id']||0x0;this[_0x40de('0x0')]=_0x1425ac[_0x40de('0x0')]||'';this[_0x40de('0x1')]=_0x1425ac['recordingFormat']||'none';this[_0x40de('0x2')]=_0x1425ac[_0x40de('0x2')]||![];}module[_0x40de('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 8e80c7f..498e268 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 _0xbb3d=['mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','mandatoryDisposition'];(function(_0x1043e6,_0x30f777){var _0x51b684=function(_0x41cd7b){while(--_0x41cd7b){_0x1043e6['push'](_0x1043e6['shift']());}};_0x51b684(++_0x30f777);}(_0xbb3d,0x13d));var _0xdbb3=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xbb3d[_0x510b98];return _0x45e775;};'use strict';var statusDesc=[_0xdbb3('0x0'),_0xdbb3('0x1'),_0xdbb3('0x2'),_0xdbb3('0x3'),_0xdbb3('0x4'),_0xdbb3('0x5'),_0xdbb3('0x6'),_0xdbb3('0x7'),'onhold'];var monitorFormat={'wav':_0xdbb3('0x8'),'wav49':_0xdbb3('0x9'),'gsm':_0xdbb3('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xdbb3('0xb')};function VoiceQueue(_0x2298c7){this['id']=_0x2298c7['id']||0x0;this[_0xdbb3('0xc')]=_0x2298c7['name']||'';this[_0xdbb3('0xd')]=_0x2298c7[_0xdbb3('0xd')]||'';this['type']=_0x2298c7[_0xdbb3('0xe')]||_0xdbb3('0xf');this['waiting']=0x0;this['talking']=0x0;this[_0xdbb3('0x10')]=0x0;this[_0xdbb3('0x11')]=0x0;this[_0xdbb3('0x12')]=0x0;this[_0xdbb3('0x13')]=0x0;this[_0xdbb3('0x14')]=0x0;this[_0xdbb3('0x15')]=0x0;this[_0xdbb3('0x16')]=0x0;this[_0xdbb3('0x17')]=0x0;this[_0xdbb3('0x18')]=0x0;this[_0xdbb3('0x19')]=_0x2298c7[_0xdbb3('0x19')]||![];this['acwTimeout']=_0x2298c7[_0xdbb3('0x1a')]||0xa;this[_0xdbb3('0x1b')]=_0x2298c7[_0xdbb3('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0xdbb3('0x1c')]='';this['originated']=0x0;this[_0xdbb3('0x1d')]=0x0;this[_0xdbb3('0x1e')]=_0x2298c7[_0xdbb3('0x1e')]||null;this[_0xdbb3('0x1f')]=_0x2298c7['dialGlobalInterval']?_0x2298c7[_0xdbb3('0x1f')]:null;this['dialActive']=_0x2298c7[_0xdbb3('0x20')];this[_0xdbb3('0x21')]=_0x2298c7['dialMethod']||'progressive';this[_0xdbb3('0x22')]=_0x2298c7[_0xdbb3('0x22')]||0x0;this[_0xdbb3('0x23')]=_0x2298c7['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x2298c7[_0xdbb3('0x24')]||0x1;this['dialPredictiveOptimization']=_0x2298c7[_0xdbb3('0x25')]||_0xdbb3('0x26');this['dialPredictiveOptimizationPercentage']=_0x2298c7['dialPredictiveOptimizationPercentage']||0.03;this[_0xdbb3('0x27')]=_0x2298c7[_0xdbb3('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x2298c7[_0xdbb3('0x28')]||'anonymous';this[_0xdbb3('0x29')]=_0x2298c7[_0xdbb3('0x29')]||_0xdbb3('0x2a');this['dialOriginateTimeout']=_0x2298c7[_0xdbb3('0x2b')]||0x1e;this[_0xdbb3('0x2c')]=_0x2298c7[_0xdbb3('0x2c')]||_0xdbb3('0x2d');this[_0xdbb3('0x2e')]=_0x2298c7[_0xdbb3('0x2e')]||0x3;this[_0xdbb3('0x2f')]=_0x2298c7[_0xdbb3('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x2298c7[_0xdbb3('0x30')]||0x3;this[_0xdbb3('0x31')]=_0x2298c7[_0xdbb3('0x31')]||0x96;this[_0xdbb3('0x32')]=_0x2298c7['dialBusyMaxRetry']||0x3;this[_0xdbb3('0x33')]=_0x2298c7['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x2298c7[_0xdbb3('0x34')]||0x3;this[_0xdbb3('0x35')]=_0x2298c7[_0xdbb3('0x35')]||0x96;this[_0xdbb3('0x36')]=_0x2298c7['dialGlobalMaxRetry']||0x4;this[_0xdbb3('0x37')]=_0x2298c7[_0xdbb3('0x37')]?_0x2298c7['Trunk']:undefined;this['TrunkBackup']=_0x2298c7[_0xdbb3('0x38')]?_0x2298c7[_0xdbb3('0x38')]:undefined;this['dialPrefix']=_0x2298c7[_0xdbb3('0x39')]||undefined;this[_0xdbb3('0x3a')]=_0x2298c7[_0xdbb3('0x3a')]?_0x2298c7[_0xdbb3('0x3a')]:undefined;this[_0xdbb3('0x3b')]=_0x2298c7[_0xdbb3('0x3b')]||_0xdbb3('0x3c');this['dialRandomLastDigitCallerIdNumber']=_0x2298c7['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xdbb3('0x3d')]=_0x2298c7['dialCutDigit']||undefined;this[_0xdbb3('0x3e')]=strategy[_0x2298c7['strategy']]||_0xdbb3('0x3f');this[_0xdbb3('0x40')]=!![];this[_0xdbb3('0x41')]=_0x2298c7[_0xdbb3('0x41')]||![];this['dialAMDInitialSilence']=_0x2298c7[_0xdbb3('0x42')];this['dialAMDGreeting']=_0x2298c7['dialAMDGreeting'];this[_0xdbb3('0x43')]=_0x2298c7[_0xdbb3('0x43')];this[_0xdbb3('0x44')]=_0x2298c7['dialAMDTotalAnalysisTime'];this[_0xdbb3('0x45')]=_0x2298c7['dialAMDMinWordLength'];this[_0xdbb3('0x46')]=_0x2298c7[_0xdbb3('0x46')];this[_0xdbb3('0x47')]=_0x2298c7[_0xdbb3('0x47')];this['dialAMDSilenceThreshold']=_0x2298c7[_0xdbb3('0x48')];this[_0xdbb3('0x49')]=_0x2298c7[_0xdbb3('0x49')];this[_0xdbb3('0x4a')]=0x0;this[_0xdbb3('0x4b')]=0x0;this[_0xdbb3('0x4c')]=_0x2298c7[_0xdbb3('0x4c')];this['outboundAnswerCallsDay']=0x0;this[_0xdbb3('0x4d')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xdbb3('0x4e')]=0x0;this[_0xdbb3('0x4f')]=0x0;this[_0xdbb3('0x50')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xdbb3('0x51')]=0x0;this[_0xdbb3('0x52')]=0x0;this['outboundReCallsDay']=0x0;this['startProgressive']=undefined;this[_0xdbb3('0x53')]=undefined;this['handlePredictive']=undefined;this[_0xdbb3('0x54')]=1.05;this[_0xdbb3('0x55')]=0x0;this[_0xdbb3('0x56')]=0x0;this[_0xdbb3('0x57')]=0x0;this[_0xdbb3('0x58')]=0x0;this[_0xdbb3('0x59')]=0x0;this[_0xdbb3('0x5a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xdbb3('0x5b')]=0x0;this[_0xdbb3('0x5c')]=_0x2298c7[_0xdbb3('0x5d')]||0x14;this[_0xdbb3('0x5e')]=_0x2298c7[_0xdbb3('0x5d')]||0xa;this[_0xdbb3('0x5f')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xdbb3('0x60')]=0x0;this[_0xdbb3('0x61')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xdbb3('0x62')]=0x0;this[_0xdbb3('0x63')]=_0x2298c7[_0xdbb3('0x63')]||0x1e;this['dialRecallInQueue']=_0x2298c7[_0xdbb3('0x64')]||![];this['dialQueueProject2']=_0x2298c7['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2298c7['dialAgiAfterHangupClient']||![];this[_0xdbb3('0x65')]=_0x2298c7[_0xdbb3('0x65')]||![];this['monitor_format']=monitorFormat[_0x2298c7['monitor_format']]?monitorFormat[_0x2298c7[_0xdbb3('0xd')]]:undefined;this['mandatoryDisposition']=_0x2298c7[_0xdbb3('0x66')]||![];this['mandatoryDispositionPause']=_0x2298c7['mandatoryDispositionPause']?_0x2298c7[_0xdbb3('0x67')]:undefined;}module[_0xdbb3('0x68')]=VoiceQueue; \ No newline at end of file +var _0x2212=['erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x2212,0x13d));var _0x2221=function(_0x44d427,_0x29ffb8){_0x44d427=_0x44d427-0x0;var _0x32b949=_0x2212[_0x44d427];return _0x32b949;};'use strict';var statusDesc=[_0x2221('0x0'),_0x2221('0x1'),'inuse',_0x2221('0x2'),_0x2221('0x3'),_0x2221('0x4'),_0x2221('0x5'),'ringinuse','onhold'];var monitorFormat={'wav':_0x2221('0x6'),'wav49':_0x2221('0x7'),'gsm':_0x2221('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x2221('0x9')};function VoiceQueue(_0x138884){this['id']=_0x138884['id']||0x0;this[_0x2221('0xa')]=_0x138884[_0x2221('0xa')]||'';this['monitor_format']=_0x138884[_0x2221('0xb')]||'';this['type']=_0x138884[_0x2221('0xc')]||_0x2221('0xd');this[_0x2221('0xe')]=0x0;this['talking']=0x0;this[_0x2221('0xf')]=0x0;this[_0x2221('0x10')]=0x0;this[_0x2221('0x11')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x2221('0x12')]=0x0;this[_0x2221('0x13')]=0x0;this['loggedIn']=0x0;this[_0x2221('0x14')]=0x0;this[_0x2221('0x15')]=_0x138884[_0x2221('0x15')]||![];this['acwTimeout']=_0x138884[_0x2221('0x16')]||0xa;this[_0x2221('0x17')]=_0x138884[_0x2221('0x17')]||'no';this[_0x2221('0x18')]=!![];this['message']='';this[_0x2221('0x19')]=0x0;this[_0x2221('0x1a')]=0x0;this[_0x2221('0x1b')]=_0x138884[_0x2221('0x1b')]||null;this[_0x2221('0x1c')]=_0x138884[_0x2221('0x1c')]?_0x138884[_0x2221('0x1c')]:null;this[_0x2221('0x1d')]=_0x138884[_0x2221('0x1d')];this[_0x2221('0x1e')]=_0x138884[_0x2221('0x1e')]||_0x2221('0x1f');this['dialLimitChannel']=_0x138884['dialLimitChannel']||0x0;this[_0x2221('0x20')]=_0x138884[_0x2221('0x20')]||0x0;this[_0x2221('0x21')]=_0x138884[_0x2221('0x21')]||0x1;this[_0x2221('0x22')]=_0x138884['dialPredictiveOptimization']||'dropRate';this[_0x2221('0x23')]=_0x138884[_0x2221('0x23')]||0.03;this[_0x2221('0x24')]=_0x138884[_0x2221('0x24')]||0x258;this[_0x2221('0x25')]=_0x138884[_0x2221('0x25')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x138884[_0x2221('0x26')]||'anonymous';this[_0x2221('0x27')]=_0x138884[_0x2221('0x27')]||0x1e;this['dialQueueOptions']=_0x138884[_0x2221('0x28')]||_0x2221('0x29');this[_0x2221('0x2a')]=_0x138884[_0x2221('0x2a')]||0x3;this[_0x2221('0x2b')]=_0x138884[_0x2221('0x2b')]||undefined;this['dialCongestionMaxRetry']=_0x138884[_0x2221('0x2c')]||0x3;this['dialCongestionRetryFrequency']=_0x138884['dialCongestionRetryFrequency']||0x96;this[_0x2221('0x2d')]=_0x138884[_0x2221('0x2d')]||0x3;this[_0x2221('0x2e')]=_0x138884[_0x2221('0x2e')]||0x96;this[_0x2221('0x2f')]=_0x138884['dialNoAnswerMaxRetry']||0x3;this[_0x2221('0x30')]=_0x138884[_0x2221('0x30')]||0x96;this[_0x2221('0x31')]=_0x138884[_0x2221('0x31')]||0x4;this['Trunk']=_0x138884['Trunk']?_0x138884[_0x2221('0x32')]:undefined;this[_0x2221('0x33')]=_0x138884[_0x2221('0x33')]?_0x138884[_0x2221('0x33')]:undefined;this[_0x2221('0x34')]=_0x138884[_0x2221('0x34')]||undefined;this[_0x2221('0x35')]=_0x138884['Interval']?_0x138884[_0x2221('0x35')]:undefined;this['dialOrderByScheduledAt']=_0x138884['dialOrderByScheduledAt']||'DESC';this[_0x2221('0x36')]=_0x138884[_0x2221('0x36')]||undefined;this['dialCutDigit']=_0x138884[_0x2221('0x37')]||undefined;this[_0x2221('0x38')]=strategy[_0x138884[_0x2221('0x38')]]||_0x2221('0x39');this[_0x2221('0x3a')]=!![];this[_0x2221('0x3b')]=_0x138884[_0x2221('0x3b')]||![];this[_0x2221('0x3c')]=_0x138884[_0x2221('0x3c')];this['dialAMDGreeting']=_0x138884['dialAMDGreeting'];this[_0x2221('0x3d')]=_0x138884[_0x2221('0x3d')];this[_0x2221('0x3e')]=_0x138884[_0x2221('0x3e')];this[_0x2221('0x3f')]=_0x138884[_0x2221('0x3f')];this[_0x2221('0x40')]=_0x138884[_0x2221('0x40')];this['dialAMDMaximumNumberOfWords']=_0x138884[_0x2221('0x41')];this[_0x2221('0x42')]=_0x138884['dialAMDSilenceThreshold'];this[_0x2221('0x43')]=_0x138884[_0x2221('0x43')];this[_0x2221('0x44')]=0x0;this[_0x2221('0x45')]=0x0;this['timeout']=_0x138884[_0x2221('0x46')];this[_0x2221('0x47')]=0x0;this[_0x2221('0x48')]=0x0;this[_0x2221('0x49')]=0x0;this[_0x2221('0x4a')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x2221('0x4b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2221('0x4c')]=0x0;this[_0x2221('0x4d')]=0x0;this[_0x2221('0x4e')]=0x0;this[_0x2221('0x4f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x2221('0x50')]=undefined;this['startPredictive']=undefined;this[_0x2221('0x51')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x2221('0x52')]=0x0;this[_0x2221('0x53')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2221('0x54')]=0x0;this[_0x2221('0x55')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2221('0x56')]=0x0;this['predictiveIntervalMaxThreshold']=_0x138884['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x138884[_0x2221('0x57')]||0xa;this[_0x2221('0x58')]=0x0;this[_0x2221('0x59')]=0x0;this[_0x2221('0x5a')]=0x1;this[_0x2221('0x5b')]=0x0;this[_0x2221('0x5c')]=0x0;this[_0x2221('0x5d')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x138884[_0x2221('0x5e')]||0x1e;this[_0x2221('0x5f')]=_0x138884[_0x2221('0x5f')]||![];this['dialQueueProject2']=_0x138884[_0x2221('0x60')]||undefined;this[_0x2221('0x61')]=_0x138884[_0x2221('0x61')]||![];this[_0x2221('0x62')]=_0x138884[_0x2221('0x62')]||![];this['monitor_format']=monitorFormat[_0x138884[_0x2221('0xb')]]?monitorFormat[_0x138884[_0x2221('0xb')]]:undefined;this[_0x2221('0x63')]=_0x138884['mandatoryDisposition']||![];this[_0x2221('0x64')]=_0x138884[_0x2221('0x64')]?_0x138884['mandatoryDispositionPause']:undefined;}module[_0x2221('0x65')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 94b3005..105ad98 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 _0xdcf3=['accessKey','remoteUri','serverUrl','Configurations','username'];(function(_0x58ac3f,_0x190d30){var _0x327bc0=function(_0x595a8c){while(--_0x595a8c){_0x58ac3f['push'](_0x58ac3f['shift']());}};_0x327bc0(++_0x190d30);}(_0xdcf3,0x149));var _0x3dcf=function(_0x4c7d6e,_0x397075){_0x4c7d6e=_0x4c7d6e-0x0;var _0x563e6c=_0xdcf3[_0x4c7d6e];return _0x563e6c;};'use strict';function VtigerAccount(_0x1a0de8){this['id']=_0x1a0de8['id']||0x0;this['name']=_0x1a0de8['name']||'';this[_0x3dcf('0x0')]=_0x1a0de8['username']||'';this[_0x3dcf('0x1')]=_0x1a0de8[_0x3dcf('0x1')]||'';this[_0x3dcf('0x2')]=_0x1a0de8[_0x3dcf('0x2')]||'';this[_0x3dcf('0x3')]=_0x1a0de8[_0x3dcf('0x3')]||'';this['Configurations']=_0x1a0de8[_0x3dcf('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xa62f=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x21d532,_0x423545){var _0x2d887c=function(_0x4ceb71){while(--_0x4ceb71){_0x21d532['push'](_0x21d532['shift']());}};_0x2d887c(++_0x423545);}(_0xa62f,0x181));var _0xfa62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa62f[_0x2dafbe];return _0x58a45a;};'use strict';function VtigerAccount(_0x39e24b){this['id']=_0x39e24b['id']||0x0;this[_0xfa62('0x0')]=_0x39e24b[_0xfa62('0x0')]||'';this[_0xfa62('0x1')]=_0x39e24b[_0xfa62('0x1')]||'';this[_0xfa62('0x2')]=_0x39e24b['accessKey']||'';this[_0xfa62('0x3')]=_0x39e24b[_0xfa62('0x3')]||'';this[_0xfa62('0x4')]=_0x39e24b[_0xfa62('0x4')]||'';this['Configurations']=_0x39e24b[_0xfa62('0x5')]||{};}module[_0xfa62('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index f2c5b2f..b6d7584 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 _0x865d=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x41dd5e,_0x344a63){var _0x1df9a0=function(_0x7cc2c6){while(--_0x7cc2c6){_0x41dd5e['push'](_0x41dd5e['shift']());}};_0x1df9a0(++_0x344a63);}(_0x865d,0x89));var _0xd865=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x865d[_0x16b9ed];return _0x66b1f8;};'use strict';function ZendeskAccount(_0x41a8d0){this['id']=_0x41a8d0['id']||0x0;this[_0xd865('0x0')]=_0x41a8d0[_0xd865('0x0')]||'';this[_0xd865('0x1')]=_0x41a8d0[_0xd865('0x1')]||'';this['password']=_0x41a8d0[_0xd865('0x2')]||'';this[_0xd865('0x3')]=_0x41a8d0[_0xd865('0x3')]||'';this[_0xd865('0x4')]=_0x41a8d0['remoteUri']||'';this[_0xd865('0x5')]=_0x41a8d0[_0xd865('0x5')]||'';this['type']=_0x41a8d0[_0xd865('0x6')]||_0xd865('0x7');this['serverUrl']=_0x41a8d0[_0xd865('0x8')]||'';this[_0xd865('0x9')]=_0x41a8d0[_0xd865('0x9')]||{};}module[_0xd865('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x9c16=['name','username','token','remoteUri','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x9c16,0x90));var _0x69c1=function(_0x52358c,_0x134ae7){_0x52358c=_0x52358c-0x0;var _0x4244ca=_0x9c16[_0x52358c];return _0x4244ca;};'use strict';function ZendeskAccount(_0xd764){this['id']=_0xd764['id']||0x0;this['name']=_0xd764[_0x69c1('0x0')]||'';this[_0x69c1('0x1')]=_0xd764[_0x69c1('0x1')]||'';this['password']=_0xd764['password']||'';this[_0x69c1('0x2')]=_0xd764[_0x69c1('0x2')]||'';this['remoteUri']=_0xd764[_0x69c1('0x3')]||'';this['authType']=_0xd764['authType']||'';this['type']=_0xd764[_0x69c1('0x4')]||_0x69c1('0x5');this[_0x69c1('0x6')]=_0xd764[_0x69c1('0x6')]||'';this[_0x69c1('0x7')]=_0xd764['Configurations']||{};}module[_0x69c1('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 20400a0..dd47aca 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 _0x2a07=['serverUrl','exports','name','authToken','host','Configurations'];(function(_0x5950c2,_0x7f488e){var _0x2712c2=function(_0x311f45){while(--_0x311f45){_0x5950c2['push'](_0x5950c2['shift']());}};_0x2712c2(++_0x7f488e);}(_0x2a07,0x74));var _0x72a0=function(_0x5b1b07,_0x119df6){_0x5b1b07=_0x5b1b07-0x0;var _0x59fbbc=_0x2a07[_0x5b1b07];return _0x59fbbc;};'use strict';function ZohoAccount(_0x4a09d0){this['id']=_0x4a09d0['id']||0x0;this[_0x72a0('0x0')]=_0x4a09d0[_0x72a0('0x0')]||'';this[_0x72a0('0x1')]=_0x4a09d0[_0x72a0('0x1')]||'';this['host']=_0x4a09d0[_0x72a0('0x2')]||'';this[_0x72a0('0x3')]=_0x4a09d0[_0x72a0('0x3')]||{};this[_0x72a0('0x4')]=_0x4a09d0[_0x72a0('0x4')]||'';}module[_0x72a0('0x5')]=ZohoAccount; \ No newline at end of file +var _0x814b=['host','Configurations','serverUrl','exports','name','authToken'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x814b,0x1a2));var _0xb814=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x814b[_0x9fb081];return _0x43f8b0;};'use strict';function ZohoAccount(_0x451d2a){this['id']=_0x451d2a['id']||0x0;this[_0xb814('0x0')]=_0x451d2a[_0xb814('0x0')]||'';this[_0xb814('0x1')]=_0x451d2a[_0xb814('0x1')]||'';this[_0xb814('0x2')]=_0x451d2a['host']||'';this[_0xb814('0x3')]=_0x451d2a[_0xb814('0x3')]||{};this[_0xb814('0x4')]=_0x451d2a[_0xb814('0x4')]||'';}module[_0xb814('0x5')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index feb463f..7ee0ac2 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 _0x2cb2=['prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x2cb2,0xcc));var _0x22cb=function(_0x34cc23,_0x196637){_0x34cc23=_0x34cc23-0x0;var _0x509fdd=_0x2cb2[_0x34cc23];return _0x509fdd;};'use strict';var util=require(_0x22cb('0x0'));var _=require(_0x22cb('0x1'));var moment=require(_0x22cb('0x2'));function checkNameSurname(_0x7104b1,_0x160dba,_0x279f49){var _0x52b176='';if(!_[_0x22cb('0x3')](_0x160dba)&&_0x22cb('0x4')===typeof _0x160dba){_0x52b176+=_0x160dba;}if(!_['isNil'](_0x279f49)&&_0x22cb('0x4')===typeof _0x279f49){_0x52b176+='\x20'+_0x279f49;}if(_0x52b176!==''){return _0x52b176;}return _0x7104b1;}function Action(_0x1b040c,_0x301e84,_0x4977cb,_0x42e57e,_0x521d8e){this['uniqueid']=_0x4977cb||undefined;this[_0x22cb('0x5')]=_0x1b040c['id'];this[_0x22cb('0x6')]=_0x301e84[_0x22cb('0x7')];this[_0x22cb('0x8')]=_0x301e84[_0x22cb('0x8')];this[_0x22cb('0x9')]=_0x22cb('0x6');this[_0x22cb('0xa')]=![];this[_0x22cb('0xb')]=_[_0x22cb('0x3')](_0x1b040c[_0x22cb('0xc')])?undefined:_0x1b040c['Agent'][_0x22cb('0x7')];this['channelAgent']=this[_0x22cb('0xb')]?util[_0x22cb('0xd')]('SIP/%s',this['membername']):_0x42e57e||undefined;this[_0x22cb('0xe')]=checkNameSurname(_0x1b040c[_0x22cb('0xf')][_0x22cb('0x10')],_0x1b040c['Contact'][_0x22cb('0x11')],_0x1b040c[_0x22cb('0xf')][_0x22cb('0x12')]);this[_0x22cb('0x13')]=_0x1b040c[_0x22cb('0x13')]||![];this[_0x22cb('0x14')]=_0x1b040c[_0x22cb('0xf')][_0x22cb('0x10')];this[_0x22cb('0x15')]=_0x1b040c[_0x22cb('0x15')];this[_0x22cb('0x16')]=_0x1b040c[_0x22cb('0x16')]||0x0;this[_0x22cb('0x17')]=_0x1b040c[_0x22cb('0x17')]||0x0;this[_0x22cb('0x18')]=_0x1b040c[_0x22cb('0x18')]||0x0;this[_0x22cb('0x19')]=(_0x1b040c[_0x22cb('0x16')]||0x0)+(_0x1b040c[_0x22cb('0x17')]||0x0)+(_0x1b040c[_0x22cb('0x18')]||0x0);this[_0x22cb('0x1a')]=_0x1b040c[_0x22cb('0x1a')];this['callbackuniqueid']=_0x1b040c[_0x22cb('0x1b')];this[_0x22cb('0x1c')]=_0x1b040c['callbackat'];this[_0x22cb('0x1d')]=_0x1b040c[_0x22cb('0x1d')];this[_0x22cb('0x1e')]=_0x1b040c[_0x22cb('0x1e')];this[_0x22cb('0x1f')]=_0x1b040c[_0x22cb('0x1f')];this[_0x22cb('0x20')]=_['isNil'](_0x1b040c['Agent'])?_0x1b040c[_0x22cb('0x20')]:_0x1b040c[_0x22cb('0xc')]['id'];this[_0x22cb('0x21')]=_0x1b040c[_0x22cb('0x21')];this[_0x22cb('0x22')]='';this[_0x22cb('0x23')]='';}Action[_0x22cb('0x24')][_0x22cb('0x25')]=function(){return util[_0x22cb('0xd')](_0x22cb('0x26'),this[_0x22cb('0xe')],this['number']);};module[_0x22cb('0x27')]=Action; \ No newline at end of file +var _0xac1c=['lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','firstName'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xac1c,0x127));var _0xcac1=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xac1c[_0x5275b8];return _0x568a9b;};'use strict';var util=require('util');var _=require(_0xcac1('0x0'));var moment=require(_0xcac1('0x1'));function checkNameSurname(_0x17947f,_0x1e50d8,_0x29ed10){var _0x2e8c7a='';if(!_[_0xcac1('0x2')](_0x1e50d8)&&_0xcac1('0x3')===typeof _0x1e50d8){_0x2e8c7a+=_0x1e50d8;}if(!_[_0xcac1('0x2')](_0x29ed10)&&_0xcac1('0x3')===typeof _0x29ed10){_0x2e8c7a+='\x20'+_0x29ed10;}if(_0x2e8c7a!==''){return _0x2e8c7a;}return _0x17947f;}function Action(_0x2e9041,_0x2e5056,_0x579b9a,_0x388af4,_0x4a44eb){this['uniqueid']=_0x579b9a||undefined;this[_0xcac1('0x4')]=_0x2e9041['id'];this[_0xcac1('0x5')]=_0x2e5056[_0xcac1('0x6')];this[_0xcac1('0x7')]=_0x2e5056['type'];this[_0xcac1('0x8')]=_0xcac1('0x5');this[_0xcac1('0x9')]=![];this[_0xcac1('0xa')]=_[_0xcac1('0x2')](_0x2e9041[_0xcac1('0xb')])?undefined:_0x2e9041[_0xcac1('0xb')][_0xcac1('0x6')];this[_0xcac1('0xc')]=this['membername']?util[_0xcac1('0xd')]('SIP/%s',this['membername']):_0x388af4||undefined;this[_0xcac1('0xe')]=checkNameSurname(_0x2e9041[_0xcac1('0xf')]['phone'],_0x2e9041[_0xcac1('0xf')][_0xcac1('0x10')],_0x2e9041[_0xcac1('0xf')][_0xcac1('0x11')]);this[_0xcac1('0x12')]=_0x2e9041['active']||![];this[_0xcac1('0x13')]=_0x2e9041[_0xcac1('0xf')][_0xcac1('0x14')];this['scheduledat']=_0x2e9041[_0xcac1('0x15')];this[_0xcac1('0x16')]=_0x2e9041[_0xcac1('0x16')]||0x0;this[_0xcac1('0x17')]=_0x2e9041['countcongestionretry']||0x0;this[_0xcac1('0x18')]=_0x2e9041[_0xcac1('0x18')]||0x0;this[_0xcac1('0x19')]=(_0x2e9041[_0xcac1('0x16')]||0x0)+(_0x2e9041[_0xcac1('0x17')]||0x0)+(_0x2e9041['countnoanswerretry']||0x0);this[_0xcac1('0x1a')]=_0x2e9041[_0xcac1('0x1a')];this[_0xcac1('0x1b')]=_0x2e9041[_0xcac1('0x1b')];this[_0xcac1('0x1c')]=_0x2e9041['callbackat'];this[_0xcac1('0x1d')]=_0x2e9041[_0xcac1('0x1d')];this[_0xcac1('0x1e')]=_0x2e9041[_0xcac1('0x1e')];this[_0xcac1('0x1f')]=_0x2e9041[_0xcac1('0x1f')];this['UserId']=_[_0xcac1('0x2')](_0x2e9041[_0xcac1('0xb')])?_0x2e9041[_0xcac1('0x20')]:_0x2e9041['Agent']['id'];this[_0xcac1('0x21')]=_0x2e9041[_0xcac1('0x21')];this[_0xcac1('0x22')]='';this[_0xcac1('0x23')]='';}Action[_0xcac1('0x24')]['getCaller']=function(){return util[_0xcac1('0xd')](_0xcac1('0x25'),this['calleridname'],this['number']);};module[_0xcac1('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 086c4ac..e87876a 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 _0x2218=['exports','util','uuid','moment','md5','ioredis','../../../config/environment','preview','./action','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','loggedIn','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','agents','then','isNil','length','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','catch','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','NoSuchNumber','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','cloneAction','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','rescheduleContact','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20work]','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','responsetime','isFailure','response','disableContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destlinkedid','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','transfererlinkedid'];(function(_0x3dae11,_0x33171a){var _0x25ef20=function(_0x3dd970){while(--_0x3dd970){_0x3dae11['push'](_0x3dae11['shift']());}};_0x25ef20(++_0x33171a);}(_0x2218,0x135));var _0x8221=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x2218[_0x29e3ec];return _0x25727e;};'use strict';var util=require(_0x8221('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x8221('0x1'));var moment=require(_0x8221('0x2'));var md5=require(_0x8221('0x3'));var Redis=require(_0x8221('0x4'));var config=require(_0x8221('0x5'));var logger=require('../../../config/logger')(_0x8221('0x6'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0x8221('0x7'));var ut=require('./util/util');config[_0x8221('0x8')]=_[_0x8221('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8221('0xa'))(new Redis(config[_0x8221('0x8')]));var Sequence=function(){};Sequence[_0x8221('0xb')][_0x8221('0xc')]=function(_0x5d17e6){this['tail']=this[_0x8221('0xd')]?this[_0x8221('0xd')][_0x8221('0xe')](_0x5d17e6):_0x5d17e6();};function Preview(_0x4540fb){this[_0x8221('0xf')]=new Sequence();this[_0x8221('0x10')]=_0x4540fb['voiceQueues'];this[_0x8221('0x11')]=_0x4540fb['trunks'];this[_0x8221('0x12')]={};this['agents']=_0x4540fb['agents'];this[_0x8221('0x13')]=0x0;ami['on'](_0x8221('0x14'),this[_0x8221('0x15')][_0x8221('0x16')](this));ami['on'](_0x8221('0x17'),this[_0x8221('0x18')]['bind'](this));ami['on'](_0x8221('0x19'),this['syncHangupRequest']['bind'](this));ami['on'](_0x8221('0x1a'),this['syncDialEnd'][_0x8221('0x16')](this));ami['on'](_0x8221('0x1b'),this['syncNewExten'][_0x8221('0x16')](this));ami['on']('varset',this[_0x8221('0x1c')][_0x8221('0x16')](this));ami['on'](_0x8221('0x1d'),this[_0x8221('0x1e')]['bind'](this));ami['on']('blindtransfer',this[_0x8221('0x1f')][_0x8221('0x16')](this));this[_0x8221('0x20')](this[_0x8221('0x10')]);}function emit(_0x4e4496,_0x6ae55f,_0xb7b603){io['to'](_0x4e4496)[_0x8221('0x21')](_0x6ae55f,_0xb7b603);}function emitCampaignPreview(_0x10ac39){if(_0x10ac39[_0x8221('0x22')]===_0x8221('0x23')){var _0x5ca113={'id':_0x10ac39['id'],'name':_0x10ac39[_0x8221('0x24')],'strategy':_0x10ac39[_0x8221('0x25')],'answered':_0x10ac39['answered'],'available':_0x10ac39[_0x8221('0x26')],'loggedIn':_0x10ac39[_0x8221('0x27')],'pTalking':_0x10ac39['pTalking'],'sumBillable':_0x10ac39[_0x8221('0x28')],'sumDuration':_0x10ac39['sumDuration'],'sumHoldTime':_0x10ac39[_0x8221('0x29')]||0x0,'talking':_0x10ac39[_0x8221('0x2a')],'total':_0x10ac39['total'],'type':_0x10ac39[_0x8221('0x22')],'unmanaged':_0x10ac39[_0x8221('0x2b')],'abandoned':_0x10ac39[_0x8221('0x2c')],'waiting':_0x10ac39[_0x8221('0x2d')],'loggedInDb':_0x10ac39[_0x8221('0x2e')],'dialActive':_0x10ac39[_0x8221('0x2f')],'dialMethod':_0x10ac39[_0x8221('0x30')],'dialOriginateCallerIdName':_0x10ac39[_0x8221('0x31')],'dialOriginateCallerIdNumber':_0x10ac39[_0x8221('0x32')],'dialOriginateTimeout':_0x10ac39['dialOriginateTimeout'],'dialPrefix':_0x10ac39[_0x8221('0x33')],'outboundAnswerAgiCallsDay':_0x10ac39[_0x8221('0x34')],'outboundAnswerCallsDay':_0x10ac39[_0x8221('0x35')],'outboundBlacklistCallsDay':_0x10ac39[_0x8221('0x36')],'outboundBusyCallsDay':_0x10ac39[_0x8221('0x37')],'outboundCongestionCallsDay':_0x10ac39[_0x8221('0x38')],'outboundDropCallsDayACS':_0x10ac39[_0x8221('0x39')],'outboundDropCallsDayCallersExit':_0x10ac39[_0x8221('0x3a')],'outboundDropCallsDayTimeout':_0x10ac39[_0x8221('0x3b')],'outboundNoAnswerCallsDay':_0x10ac39[_0x8221('0x3c')],'outboundNoSuchCallsDay':_0x10ac39[_0x8221('0x3d')],'outboundOriginateFailureCallsDay':_0x10ac39[_0x8221('0x3e')],'outboundReCallsDay':_0x10ac39[_0x8221('0x3f')],'outboundRejectCallsDay':_0x10ac39[_0x8221('0x40')],'outboundUnknownCallsDay':_0x10ac39[_0x8221('0x41')],'predictiveIntervalAnsweredCalls':_0x10ac39[_0x8221('0x42')],'predictiveIntervalAvgHoldtime':_0x10ac39[_0x8221('0x43')],'predictiveIntervalAvgTalktime':_0x10ac39[_0x8221('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x10ac39[_0x8221('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x10ac39[_0x8221('0x46')],'predictiveIntervalErlangCalls':_0x10ac39['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x10ac39[_0x8221('0x47')],'predictiveIntervalHitRate':_0x10ac39[_0x8221('0x48')],'predictiveIntervalMultiplicativeFactor':_0x10ac39[_0x8221('0x49')],'predictiveIntervalPauses':_0x10ac39[_0x8221('0x4a')],'predictiveIntervalAvailable':_0x10ac39[_0x8221('0x4b')],'predictiveIntervalTotalCalls':_0x10ac39[_0x8221('0x4c')],'message':_0x10ac39[_0x8221('0x4d')],'originated':_0x10ac39[_0x8221('0x4e')],'erlangCalls':_0x10ac39[_0x8221('0x4f')],'erlangCallToSecond':_0x10ac39[_0x8221('0x50')],'erlangAbandonmentRate':_0x10ac39[_0x8221('0x51')],'erlangBusyFactor':_0x10ac39[_0x8221('0x52')],'startPredictive':_0x10ac39['startPredictive'],'startProgressive':_0x10ac39[_0x8221('0x53')]};if(_0x10ac39[_0x8221('0x54')]){_0x5ca113[_0x8221('0x54')]={'id':_0x10ac39[_0x8221('0x54')]['id'],'name':_0x10ac39[_0x8221('0x54')][_0x8221('0x24')],'active':_0x10ac39[_0x8221('0x54')][_0x8221('0x55')],'callerid':_0x10ac39[_0x8221('0x54')]['callerid']};}if(_0x10ac39[_0x8221('0x56')]){_0x5ca113[_0x8221('0x56')]={'id':_0x10ac39['Interval']['id'],'name':_0x10ac39[_0x8221('0x56')][_0x8221('0x24')]};}var _0x1f3da7=md5(JSON[_0x8221('0x57')](_0x5ca113));if(_0x10ac39[_0x8221('0x3')]!==_0x1f3da7){_0x10ac39[_0x8221('0x3')]=_0x1f3da7;emit(util[_0x8221('0x58')](_0x8221('0x59'),_0x5ca113['name']),_0x8221('0x5a'),_0x5ca113);}}}function emitVoiceQueueChannelRemove(_0x3902c8){emit(util[_0x8221('0x58')](_0x8221('0x59'),_0x3902c8[_0x8221('0x24')]),_0x8221('0x5b'),_0x3902c8);}function notSendMessagesQueue(_0x191a49){if(_0x191a49[_0x8221('0x5c')]){if(_0x191a49['originated']===0x0&&_0x191a49[_0x8221('0x5d')]===0x0){_0x191a49['sendMessageOneNotActive']=![];_0x191a49[_0x8221('0x26')]=0x0;_0x191a49[_0x8221('0x5e')]=0x0;_0x191a49[_0x8221('0x4d')]=_0x8221('0x5f');ut[_0x8221('0x60')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x191a49[_0x8221('0x24')]+_0x8221('0x61'));}else{_0x191a49[_0x8221('0x4d')]='IS_DISACTIVED';ut[_0x8221('0x60')](_0x8221('0x62'),_0x191a49[_0x8221('0x24')]+_0x8221('0x63'));}emitCampaignPreview(_0x191a49);}}Preview[_0x8221('0xb')]['loopCampaigns']=function(){var _0x24bf0b=this;setInterval(function(){_0x24bf0b[_0x8221('0x64')]();},0x7cf);};Preview[_0x8221('0xb')][_0x8221('0x64')]=function(){var _0x1ac1b0=this['campaignsPreview'];this[_0x8221('0x13')]+=0x1;for(var _0x1e797d in _0x1ac1b0){if(_0x1ac1b0[_0x8221('0x65')](_0x1e797d)&&(_0x1ac1b0[_0x1e797d][_0x8221('0x30')]==='preview'||_0x1ac1b0[_0x1e797d][_0x8221('0x30')]===_0x8221('0x66'))&&_0x1ac1b0[_0x1e797d]['type']===_0x8221('0x23')){if(this['clockClearZombieChannels']>0x7){this[_0x8221('0x13')]=0x0;this[_0x8221('0x67')]();}}if(_0x1ac1b0[_0x8221('0x65')](_0x1e797d)&&_0x1ac1b0[_0x1e797d][_0x8221('0x30')]==='preview'&&_0x1ac1b0[_0x1e797d]['type']===_0x8221('0x23')){if(_0x1ac1b0[_0x1e797d][_0x8221('0x2f')]){this[_0x8221('0x68')](_0x1ac1b0[_0x1e797d]);this[_0x8221('0x69')](_0x1ac1b0[_0x1e797d]);}else{notSendMessagesQueue(_0x1ac1b0[_0x1e797d]);}}}};Preview[_0x8221('0xb')][_0x8221('0x6a')]=function(_0x3c48c5){var _0x1f8c7a=this;this['sequence'][_0x8221('0xc')](function(){if(!_['isNil'](_0x1f8c7a['actions'][_0x3c48c5])){loggerAction[_0x8221('0x6b')](_0x8221('0x6c'),_0x3c48c5,_0x8221('0x6d'),_0x1f8c7a['actions'][_0x3c48c5][_0x8221('0x6e')],_0x8221('0x6f'),JSON[_0x8221('0x57')](_0x1f8c7a[_0x8221('0x10')][_0x1f8c7a[_0x8221('0x12')][_0x3c48c5][_0x8221('0x6e')]][_0x8221('0x4e')]),_0x8221('0x70'),JSON[_0x8221('0x57')](_0x1f8c7a[_0x8221('0x10')][_0x1f8c7a[_0x8221('0x12')][_0x3c48c5]['queue']]['pTalking']),JSON[_0x8221('0x57')](_0x1f8c7a[_0x8221('0x12')][_0x3c48c5][_0x8221('0x71')]),JSON[_0x8221('0x57')](_[_0x8221('0x72')](_0x1f8c7a[_0x8221('0x12')][_0x3c48c5],['contactId','UserId',_0x8221('0x73'),_0x8221('0x74')])));return ami[_0x8221('0x75')]({'action':_0x8221('0x76'),'channel':_0x1f8c7a['actions'][_0x3c48c5][_0x8221('0x77')]})['catch'](function(_0x364c1d){if(_0x364c1d[_0x8221('0x4d')]===_0x8221('0x78')){setTimeout(function(){if(_0x1f8c7a['actions'][_0x3c48c5]){ut['updateOriginated'](_0x1f8c7a['campaignsPreview'][_0x1f8c7a[_0x8221('0x12')][_0x3c48c5][_0x8221('0x6e')]],_0x8221('0x79'));if(_0x1f8c7a[_0x8221('0x12')][_0x3c48c5][_0x8221('0x71')]===!![]){ut[_0x8221('0x7a')](_0x1f8c7a[_0x8221('0x10')][_0x1f8c7a[_0x8221('0x12')][_0x3c48c5]['queue']],_0x8221('0x79'));ut[_0x8221('0x7b')]('[Dialer][checkChannel][pTalking][Preview]'+_0x3c48c5,_0x1f8c7a[_0x8221('0x12')][_0x3c48c5][_0x8221('0x6e')]);}ut[_0x8221('0x7b')](_0x8221('0x7c')+_0x3c48c5,_0x1f8c7a['actions'][_0x3c48c5]['queue']);delete _0x1f8c7a['actions'][_0x3c48c5];}},0x2328);}});}});};Preview[_0x8221('0xb')][_0x8221('0x67')]=function(){var _0x26d619=this;loggerAction[_0x8221('0x6b')](_0x8221('0x7d'),_[_0x8221('0x7e')](this[_0x8221('0x12')]));for(var _0x5ecb24 in this[_0x8221('0x12')]){if(_0x26d619[_0x8221('0x12')]['hasOwnProperty'](_0x5ecb24)){_0x26d619['clearZombieChannel'](_0x5ecb24);}}};Preview[_0x8221('0xb')]['recallMe']=function(_0x536742){var _0xe7ee01=this;rpcDb[_0x8221('0x7f')](_0x536742['id'],ut[_0x8221('0x80')](this[_0x8221('0x81')]))[_0x8221('0x82')](function(_0x9b4760){if(!_[_0x8221('0x83')](_0x9b4760)){for(var _0x3e7edb=0x0;_0x3e7edb<_0x9b4760[_0x8221('0x84')];_0x3e7edb+=0x1){if(ut['getDiff'](_0x9b4760[_0x3e7edb]['scheduledat'])<_0x536742[_0x8221('0x85')]*0x3c){_0xe7ee01[_0x8221('0x86')](_0x9b4760[_0x3e7edb]['id'])[_0x8221('0x82')](ut[_0x8221('0x87')](_0x8221('0x88')))['catch'](ut[_0x8221('0x87')]('[RecallMe]'));}else{var _0x36a6ff=new Action(_0x9b4760[_0x3e7edb],_0x536742);_0x36a6ff[_0x8221('0x89')]=moment()[_0x8221('0x58')](_0x8221('0x8a'));_0x536742['outboundReCallsDay']+=0x1;ut[_0x8221('0x8b')](_0x36a6ff,0x17,_0x8221('0x8c'));if(_0x536742[_0x8221('0x8d')]){rpcDb['rescheduleContactInQueue'](ut[_0x8221('0x8e')](_0x9b4760[_0x3e7edb]));rpcDb[_0x8221('0x8f')](_0x36a6ff,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x8221('0x8b')](_0x36a6ff,0x16,'RecallFailedTimeout');rpcDb[_0x8221('0x8f')](_0x36a6ff,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x36a6ff,_0x8221('0x90'));}}}}})[_0x8221('0x91')](ut[_0x8221('0x87')](_0x8221('0x92')));};Preview[_0x8221('0xb')][_0x8221('0x68')]=function(_0x892a48){_0x892a48['sendMessageOneNotActive']=!![];if(ut[_0x8221('0x93')](_0x892a48[_0x8221('0x27')])){_0x892a48[_0x8221('0x4d')]=_0x8221('0x94');}else if(!ut[_0x8221('0x95')](_0x892a48[_0x8221('0x2f')])){_0x892a48['message']='NOT_ACTIVE';}else if(!this[_0x8221('0x96')](_0x892a48[_0x8221('0x54')])){if(!this['isTrunkReachable'](_0x892a48['TrunkBackup'])){_0x892a48['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x892a48['message']=_0x8221('0x97');}}else{_0x892a48[_0x8221('0x4d')]=_0x8221('0x97');}emitCampaignPreview(_0x892a48);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x3d19c6,_0x3add61,_0x4bb291){var _0x1fc555=this;var _0x5c4d4b=this['actions'][_0x3add61];var _0x3d5142=this[_0x8221('0x10')][_0x5c4d4b[_0x8221('0x6e')]];var _0x10c70a;if(_0x3d5142){switch(_0x4bb291){case'1':_0x3d5142[_0x8221('0x3d')]+=0x1;_0x5c4d4b['countglobal']=ut['totalGlobal'](_0x5c4d4b);ut[_0x8221('0x8b')](_0x5c4d4b,0x0,_0x8221('0x98'));rpcDb[_0x8221('0x8f')](_0x5c4d4b,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x8221('0x99')](_0x5c4d4b)>=_0x3d5142[_0x8221('0x9a')]){_0x10c70a=ut['cloneAction'](_0x5c4d4b,0xf,_0x8221('0x9b'));rpcDb[_0x8221('0x9c')](_0x10c70a,_0x8221('0x9d'));}else{rpcDb[_0x8221('0x9c')](_0x5c4d4b,_0x8221('0x9d'));}delete this[_0x8221('0x12')][_0x3d19c6[_0x8221('0x9e')]];break;case _0x8221('0x9f'):var _0x246303=moment()['format'](_0x8221('0x8a'));_0x5c4d4b['responsetime']=_0x246303;_0x5c4d4b[_0x8221('0xa0')]=_0x246303;_0x5c4d4b['dialAnswer']=!![];_0x3d5142['pTalking']+=0x1;logger[_0x8221('0x6b')](_0x8221('0xa1'),_0x5c4d4b[_0x8221('0xa2')],_0x8221('0xa3'),_0x3d5142[_0x8221('0x24')],_0x8221('0x70'),_0x3d5142[_0x8221('0x5d')]);ami[_0x8221('0x21')](_0x8221('0xa4'),ut[_0x8221('0xa5')](_0x5c4d4b,_0x8221('0xa6')));if(_0x3d5142[_0x8221('0xa7')]){ami[_0x8221('0x21')](_0x8221('0xa8'),ut['buildAcw'](_0x5c4d4b));}break;case'16':ami[_0x8221('0x21')](_0x8221('0xa9'),ut[_0x8221('0xa5')](_0x5c4d4b,_0x8221('0xaa')));emitVoiceQueueChannelRemove(ut[_0x8221('0xa5')](_0x5c4d4b,_0x8221('0xaa')));_0x3d5142[_0x8221('0x35')]+=0x1;_0x3d5142['total']+=0x1;_0x3d5142[_0x8221('0xab')]+=0x1;ut[_0x8221('0x7a')](_0x3d5142,_0x8221('0xac'));_0x5c4d4b[_0x8221('0xad')]=ut[_0x8221('0x99')](_0x5c4d4b);ut[_0x8221('0x8b')](_0x5c4d4b,0x4,_0x8221('0xae'));rpcDb['createCustomerHistory'](_0x5c4d4b,_0x8221('0xaf'));rpcDb[_0x8221('0x9c')](_0x5c4d4b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8221('0xb0')](_0x5c4d4b);_0x3d5142[_0x8221('0xb1')]+=_0x5c4d4b[_0x8221('0xb2')];_0x3d5142['sumBillable']+=_0x5c4d4b[_0x8221('0xb2')];logger[_0x8221('0x6b')](_0x8221('0xb3'),_0x5c4d4b[_0x8221('0xa2')],_0x8221('0xa3'),_0x3d5142[_0x8221('0x24')],_0x8221('0x70'),_0x3d5142[_0x8221('0x5d')]);delete this[_0x8221('0x12')][_0x3d19c6[_0x8221('0x9e')]];break;case'BUSY':_0x3d5142[_0x8221('0x37')]+=0x1;_0x5c4d4b[_0x8221('0xb4')]+=0x1;_0x5c4d4b[_0x8221('0xad')]=ut['totalGlobal'](_0x5c4d4b);ut[_0x8221('0x8b')](_0x5c4d4b,0x5,'Busy');rpcDb[_0x8221('0x8f')](_0x5c4d4b,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8221('0x99')](_0x5c4d4b)>=_0x3d5142[_0x8221('0x9a')]){_0x10c70a=ut[_0x8221('0xb5')](_0x5c4d4b,0xf,_0x8221('0x9b'));rpcDb[_0x8221('0x9c')](_0x10c70a,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5c4d4b['countbusyretry']>=_0x3d5142['dialBusyMaxRetry']){rpcDb[_0x8221('0x9c')](_0x5c4d4b,_0x8221('0xb6'));}else{rpcDb['rescheduleContact'](ut[_0x8221('0xb7')](_0x5c4d4b,_0x8221('0xb4'),_0x3d5142[_0x8221('0xb8')]),_0x5c4d4b[_0x8221('0xb9')],_0x5c4d4b['activeContact']);}}break;case _0x8221('0xba'):_0x3d5142[_0x8221('0x3c')]+=0x1;_0x5c4d4b[_0x8221('0xbb')]+=0x1;_0x5c4d4b[_0x8221('0xad')]=ut[_0x8221('0x99')](_0x5c4d4b);ut['logCustomer'](_0x5c4d4b,0x3,_0x8221('0xbc'));rpcDb[_0x8221('0x8f')](_0x5c4d4b,_0x8221('0xbd'));if(ut['totalGlobal'](_0x5c4d4b)>=_0x3d5142[_0x8221('0x9a')]){_0x10c70a=ut['cloneAction'](_0x5c4d4b,0xf,'Global');rpcDb[_0x8221('0x9c')](_0x10c70a,_0x8221('0xbe'));}else{if(_0x5c4d4b['countnoanswerretry']>=_0x3d5142[_0x8221('0xbf')]){rpcDb[_0x8221('0x9c')](_0x5c4d4b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x8221('0xb7')](_0x5c4d4b,_0x8221('0xbb'),_0x3d5142[_0x8221('0xc0')]),_0x5c4d4b[_0x8221('0xb9')],_0x5c4d4b[_0x8221('0xc1')]);}}break;case _0x8221('0xc2'):_0x3d5142[_0x8221('0x38')]+=0x1;_0x5c4d4b['countcongestionretry']+=0x1;_0x5c4d4b[_0x8221('0xad')]=ut['totalGlobal'](_0x5c4d4b);ut[_0x8221('0x8b')](_0x5c4d4b,0x8,_0x8221('0xc3'));rpcDb[_0x8221('0x8f')](_0x5c4d4b,_0x8221('0xc4'));if(ut[_0x8221('0x99')](_0x5c4d4b)>=_0x3d5142['dialGlobalMaxRetry']){_0x10c70a=ut['cloneAction'](_0x5c4d4b,0xf,_0x8221('0x9b'));rpcDb['createCustomerFinal'](_0x10c70a,_0x8221('0xc5'));}else{if(_0x5c4d4b[_0x8221('0xc6')]>=_0x3d5142['dialCongestionMaxRetry']){rpcDb[_0x8221('0x9c')](_0x5c4d4b,_0x8221('0xc4'));}else{rpcDb[_0x8221('0xc7')](ut[_0x8221('0xb7')](_0x5c4d4b,_0x8221('0xc6'),_0x3d5142[_0x8221('0xb8')]),_0x5c4d4b['unlockAgent'],_0x5c4d4b[_0x8221('0xc1')]);}}break;case _0x8221('0xc8'):_0x3d5142[_0x8221('0x40')]+=0x1;_0x5c4d4b[_0x8221('0xad')]=ut[_0x8221('0x99')](_0x5c4d4b);ut[_0x8221('0x8b')](_0x5c4d4b,0x14,_0x8221('0xc9'));rpcDb[_0x8221('0x8f')](_0x5c4d4b,_0x8221('0xca'));if(_0x5c4d4b[_0x8221('0xb9')]){rpcDb[_0x8221('0xcb')](_0x5c4d4b[_0x8221('0xcc')]);}if(_0x5c4d4b[_0x8221('0xc1')]){rpcDb['disableContact'](_0x5c4d4b['idContact']);}break;default:if(_0x5c4d4b[_0x8221('0x71')]){ut['decrementTalkink'](_0x3d5142,_0x8221('0xcd'));ut[_0x8221('0x7b')](_0x8221('0xce')+_0x3d5142[_0x8221('0x24')],_0x3d19c6);}_0x3d5142[_0x8221('0x41')]+=0x1;_0x5c4d4b['countglobal']=ut[_0x8221('0x99')](_0x5c4d4b);ut['logCustomer'](_0x5c4d4b,0xc,_0x3d19c6[_0x8221('0xcf')]||_0x3d19c6['dialstatus']);rpcDb[_0x8221('0x8f')](_0x5c4d4b,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8221('0x99')](_0x5c4d4b)>=_0x3d5142[_0x8221('0x9a')]){_0x10c70a=ut[_0x8221('0xb5')](_0x5c4d4b,0xf,_0x8221('0x9b'));rpcDb[_0x8221('0x9c')](_0x10c70a,_0x8221('0xd0'));}else{rpcDb[_0x8221('0x9c')](_0x5c4d4b,_0x8221('0xd0'));}delete this[_0x8221('0x12')][_0x3d19c6[_0x8221('0x9e')]];}if(!(_0x5c4d4b['dialAnswer']&&_0x4bb291==='16')){ut['updateOriginated'](_0x3d5142,_0x8221('0xd1'));logger[_0x8221('0x6b')]('[originated][decrement][callProgressDetectingCustomer]',_0x5c4d4b[_0x8221('0xa2')],_0x8221('0xa3'),_0x3d5142[_0x8221('0x24')],'originated:\x20',_0x3d5142[_0x8221('0x4e')]);}if(_0x4bb291!==_0x8221('0x9f')){delete this['actions'][_0x3d19c6[_0x8221('0x9e')]];delete this['actions'][_0x3d19c6['destlinkedid']];}}};Preview[_0x8221('0xb')]['callProgressDetectingAgent']=function(_0x550666,_0x409e7a,_0x1ac40e){if(_[_0x8221('0xd2')](_0x409e7a)&&_0x8221('0xd3')!==typeof _0x409e7a){return;}if(_[_0x8221('0xd2')](_0x1ac40e)&&_0x8221('0xd3')!==typeof _0x1ac40e){return;}switch(_0x1ac40e[_0x8221('0xd4')]){case'0':ut[_0x8221('0xd5')](_0x550666,0x0,_0x8221('0x98'));rpcDb[_0x8221('0xd6')](_0x550666,_0x8221('0xd7'));break;case'3':ut['logAgent'](_0x550666,0x3,_0x8221('0xbc'));rpcDb[_0x8221('0xd6')](_0x550666,_0x8221('0xd8'));break;case'5':ut[_0x8221('0xd5')](_0x550666,0x5,_0x8221('0xd9'));rpcDb[_0x8221('0xd6')](_0x550666,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x8221('0xd5')](_0x550666,0x8,'Congestion');rpcDb[_0x8221('0xd6')](_0x550666,_0x8221('0xda'));break;case'22':ut[_0x8221('0xd5')](_0x550666,0x16,_0x8221('0xdb'));rpcDb['createAgentHistory'](_0x550666,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x8221('0xd5')](_0x550666,0xc,_0x1ac40e[_0x8221('0xd4')]);rpcDb[_0x8221('0xd6')](_0x550666,_0x8221('0xda'));}ut['updateOriginated'](_0x409e7a,_0x8221('0xdc'));logger[_0x8221('0x6b')](_0x8221('0xdd'),_0x550666[_0x8221('0xa2')],'\x20Queue',_0x409e7a['name'],'originated:\x20',_0x409e7a[_0x8221('0x4e')]);delete this[_0x8221('0x12')][_0x550666[_0x8221('0xa2')]];};Preview[_0x8221('0xb')][_0x8221('0xde')]=function(_0x51a284,_0x359be0,_0x3cb33b,_0x208510,_0xea31a2){var _0x1e8069=this;return new BPromise(function(_0x342d93,_0x121957){if(_[_0x8221('0x83')](_0x359be0)||_[_0x8221('0x83')](_0x359be0[_0x8221('0xdf')])||_[_0x8221('0x83')](_0x359be0[_0x8221('0xdf')][_0x8221('0xe0')])||_['isNil'](_0x359be0[_0x8221('0x73')])){_0x121957(ut[_0x8221('0x4d')](_0x8221('0xe1'),_0x208510,_0xea31a2));return;}var _0x1ad765=uuid['v4']();var _0x13304f=_0x1e8069['campaignsPreview'][_0x359be0[_0x8221('0x6d')][_0x8221('0x24')]];var _0x249f93=_0x3cb33b?_0x1e8069[_0x8221('0x81')][_0x3cb33b]['id']:undefined;_0x1e8069[_0x8221('0x12')][_0x1ad765]=new Action(_0x359be0,_0x13304f,_0x1ad765,_0x3cb33b,_0x249f93);var _0x20efd0=_0x1e8069[_0x8221('0x12')][_0x1ad765];_0x20efd0[_0x8221('0xb9')]=_0x208510;_0x20efd0[_0x8221('0xc1')]=_0xea31a2;_0x20efd0[_0x8221('0xe2')]=_0x3cb33b;if(_[_0x8221('0xe3')](_0x51a284)){_0x1e8069['execCall'](_0x20efd0,_0x13304f,_0x359be0,_0x3cb33b)['then'](function(_0x3d356a){logger['info'](_0x8221('0xe4'),_0x8221('0xe5')+_0x20efd0[_0x8221('0x6e')]+_0x8221('0xe6')+_0x20efd0[_0x8221('0xcc')],JSON['stringify'](_0x3d356a));ami[_0x8221('0x21')](_0x8221('0xe7'),ut[_0x8221('0xa5')](_0x20efd0,_0x8221('0xe8')));_0x342d93(ut['message'](_0x8221('0xe9')));})[_0x8221('0x91')](function(_0x565b0b){ut[_0x8221('0x60')]('[Preview][execCall][failure]',_0x565b0b);_0x121957(ut[_0x8221('0x4d')](_0x8221('0xea'),_0x208510,_0xea31a2));});}else{_0x13304f[_0x8221('0x36')]+=0x1;ut[_0x8221('0xeb')](_0x20efd0);rpcDb[_0x8221('0xec')](_0x20efd0,'[Blacklist][error]');delete _0x1e8069[_0x8221('0x12')][_0x1ad765];_0x121957(ut[_0x8221('0x4d')](_0x8221('0xed'),_0x208510,_0xea31a2));}});};Preview[_0x8221('0xb')][_0x8221('0x96')]=function(_0x392595){return!_['isNil'](_0x392595)&&!_['isNil'](_0x392595['name'])&&!_[_0x8221('0x83')](_0x392595[_0x8221('0x55')])&&_0x392595[_0x8221('0x55')]&&!_[_0x8221('0x83')](this[_0x8221('0x11')][util[_0x8221('0x58')](_0x8221('0xee'),_0x392595[_0x8221('0x24')])])&&!_['isNil'](this[_0x8221('0x11')][util[_0x8221('0x58')](_0x8221('0xee'),_0x392595[_0x8221('0x24')])][_0x8221('0x76')])&&(this['trunks'][util[_0x8221('0x58')]('SIP/%s',_0x392595[_0x8221('0x24')])][_0x8221('0x76')]===_0x8221('0xef')||this['trunks'][util[_0x8221('0x58')](_0x8221('0xee'),_0x392595[_0x8221('0x24')])][_0x8221('0x76')]===_0x8221('0xf0'));};Preview[_0x8221('0xb')][_0x8221('0x86')]=function(_0x48278f,_0x19fd0c){var _0x5d6aa2=this;return new BPromise(function(_0x891212,_0x568b5d){_0x5d6aa2[_0x8221('0xf1')](_0x48278f,_0x19fd0c)[_0x8221('0x82')](function(_0x51540e){_0x891212(_[_0x8221('0x72')](_0x51540e,[_0x8221('0x4d')]));})[_0x8221('0x91')](function(_0x601a8e){if(_0x601a8e[_0x8221('0xf2')]){rpcDb['unlockContact'](_0x48278f);}if(_0x601a8e[_0x8221('0x55')]){rpcDb['disableContact'](_0x48278f);}_0x568b5d(_[_0x8221('0x72')](_0x601a8e,[_0x8221('0x4d')]));});});};Preview['prototype']['execRun']=function(_0x2b171a,_0x2e9713){var _0x274c76=this;return new BPromise(function(_0x3d8188,_0x479e2b){var _0x50b6b5,_0x1f2376;rpcDb[_0x8221('0xf3')](_0x2b171a)[_0x8221('0x82')](function(_0xae7174){if(!_[_0x8221('0x83')](_0xae7174[0x0])){_0x1f2376=_0xae7174[0x0][_0x8221('0xf4')]?![]:!![];_0x50b6b5=_0xae7174[0x0][_0x8221('0xf4')]?!![]:![];_0x50b6b5=_0x2e9713?!![]:_0x50b6b5;}var _0xbd01a=_0x274c76[_0x8221('0xf5')](_0xae7174);if(_0xbd01a[_0x8221('0xf6')]){rpcDb['checkIsBlackList'](_[_0x8221('0x72')](_0xae7174[0x0],[_0x8221('0x73'),_0x8221('0xf7')]))[_0x8221('0x82')](function(_0x8eef3a){_0x274c76[_0x8221('0xde')](_0x8eef3a,_0xae7174[0x0],_0x2e9713,_0x1f2376,_0x50b6b5)[_0x8221('0x82')](function(_0x47e37c){_0x3d8188(_0x47e37c);})['catch'](function(_0x32de51){_0x479e2b(_0x32de51);});})[_0x8221('0x91')](function(_0x193de4){ut['logger'](_0x8221('0xf8'),_0x193de4);_0x479e2b(ut[_0x8221('0x4d')](_0x8221('0xf9'),_0x1f2376,_0x50b6b5));});}else{_0x479e2b(ut['message'](_0xbd01a[_0x8221('0x4d')],_0x1f2376,_0x50b6b5));}})[_0x8221('0x91')](function(_0x1e6e3c){ut[_0x8221('0x60')]('[Preview][getContactPreview]',_0x1e6e3c);_0x479e2b(ut[_0x8221('0x4d')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x8221('0xb')][_0x8221('0xf5')]=function(_0x250c67){if(_[_0x8221('0x83')](_0x250c67)||_[_0x8221('0xe3')](_0x250c67)||!_[_0x8221('0x83')](_0x250c67[0x0][_0x8221('0xfa')])&&_[_0x8221('0x83')](_0x250c67[0x0][_0x8221('0xfa')][_0x8221('0x24')])){ut[_0x8221('0x60')](_0x8221('0xfb'),_0x250c67);return{'isValid':![],'message':_0x8221('0xfc')};}var _0x2cce06=this['campaignsPreview'][_0x250c67[0x0][_0x8221('0x6d')][_0x8221('0x24')]];_0x2cce06[_0x8221('0x4d')]=_0x8221('0x97');if(_[_0x8221('0x83')](_0x2cce06)){ut[_0x8221('0x60')]('[Preview][validateContact][Empty\x20Campaign]',_0x2cce06);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x2cce06['Trunk'])){ut[_0x8221('0x60')](_0x8221('0xfd'),'campaign\x20Name:\x20'+_0x2cce06[_0x8221('0x24')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x2cce06[_0x8221('0xfe')])){ut[_0x8221('0x60')](_0x8221('0xfd'),_0x2cce06[_0x8221('0x24')]+_0x8221('0xff'));return{'isValid':![],'message':_0x8221('0x100')};}}if(!ut[_0x8221('0x95')](_0x2cce06['dialActive'])){ut[_0x8221('0x60')](_0x8221('0x101'),_0x2cce06[_0x8221('0x24')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x8221('0x102')+_0x2cce06[_0x8221('0x24')]+_0x8221('0x103')};}return{'isValid':!![],'message':_0x8221('0x104')};};Preview[_0x8221('0xb')][_0x8221('0x105')]=function(_0x523ba8,_0x392453,_0x39b515,_0x4ad451){var _0x4bc214=this;return new BPromise(function(_0x3ba04a,_0x236e61){var _0x1e98ae=_0x523ba8['uniqueid'];var _0x11a2b9=_0x4bc214['isTrunkReachable'](_0x392453[_0x8221('0x54')])?util[_0x8221('0x58')](_0x8221('0x106'),_0x392453[_0x8221('0x54')][_0x8221('0x24')],_[_0x8221('0x83')](_0x392453['dialPrefix'])?'':_0x392453[_0x8221('0x33')][_0x8221('0x107')]()||'',_0x392453[_0x8221('0x108')]>0x0?_0x39b515[_0x8221('0xdf')]['phone'][_0x8221('0x109')](_0x392453[_0x8221('0x108')]):_0x39b515[_0x8221('0xdf')][_0x8221('0xe0')]):util['format'](_0x8221('0x106'),_['isNil'](_0x392453[_0x8221('0xfe')])?_0x392453[_0x8221('0x54')][_0x8221('0x24')]:_0x392453['TrunkBackup'][_0x8221('0x24')],_[_0x8221('0x83')](_0x392453['dialPrefix'])?'':_0x392453[_0x8221('0x33')][_0x8221('0x107')]()||'',_0x392453['dialCutDigit']>0x0?_0x39b515[_0x8221('0xdf')][_0x8221('0xe0')][_0x8221('0x109')](_0x392453[_0x8221('0x108')]):_0x39b515[_0x8221('0xdf')][_0x8221('0xe0')]);var _0x2ea7ce=_0x4bc214['isTrunkReachable'](_0x392453[_0x8221('0x54')])?ut[_0x8221('0x10a')](_0x392453[_0x8221('0x54')][_0x8221('0x10b')],_0x392453[_0x8221('0x31')],_0x392453[_0x8221('0x10c')]>0x0?ut['getCallerIdRandom'](_0x392453[_0x8221('0x32')],_0x392453[_0x8221('0x10c')]):_0x392453[_0x8221('0x32')]):ut['getCallerId'](_[_0x8221('0x83')](_0x392453[_0x8221('0xfe')])?_0x392453[_0x8221('0x54')][_0x8221('0x10b')]:_0x392453[_0x8221('0xfe')]['callerid'],_0x392453[_0x8221('0x31')],_0x392453[_0x8221('0x10c')]>0x0?ut[_0x8221('0x10d')](_0x392453[_0x8221('0x32')],_0x392453[_0x8221('0x10c')]):_0x392453[_0x8221('0x32')]);if(_0x2ea7ce){_0x523ba8[_0x8221('0x10e')]=ut[_0x8221('0x10f')](_0x2ea7ce);_0x523ba8[_0x8221('0x110')]=ut['extractCalleridNumber'](_0x2ea7ce);}var _0x5caae9=ut['addVariables'](_0x392453,_0x39b515,_0x11a2b9,_0x2ea7ce,_0x1e98ae,_0x523ba8);_['merge'](_0x523ba8,ut[_0x8221('0x111')](_0x5caae9));_0x523ba8[_0x8221('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x8221('0x75')](ut[_0x8221('0x112')](_0x523ba8,_0x392453,_0x5caae9,_0x523ba8[_0x8221('0xc1')],_0x4ad451))['then'](function(_0x3710e1){_0x392453[_0x8221('0x4e')]+=0x1;logger[_0x8221('0x6b')](_0x8221('0x113'),_0x1e98ae,_0x8221('0xa3'),_0x392453[_0x8221('0x24')],'originated:\x20',_0x392453['originated']);_0x3ba04a(_0x3710e1);})[_0x8221('0x91')](function(_0xe9faf3){ut[_0x8221('0xd5')](_0x523ba8,0xe,'OriginateError');rpcDb[_0x8221('0xd6')](_0x523ba8,_0x8221('0x114'));_0x236e61(_0xe9faf3);});});};Preview[_0x8221('0xb')][_0x8221('0x115')]=function(_0x1ec0c6){if(this[_0x8221('0x12')][_0x1ec0c6['linkedid']]){this[_0x8221('0x12')][_0x1ec0c6[_0x8221('0x9e')]][_0x8221('0x77')]=_0x1ec0c6[_0x8221('0x77')];}};Preview['prototype'][_0x8221('0x15')]=function(_0x22ac4f){var _0x1f99c8=this;var _0x5ea3db=this[_0x8221('0x12')][_0x22ac4f[_0x8221('0x116')]];if(_0x5ea3db){if(_0x5ea3db[_0x8221('0xe2')]&&this[_0x8221('0x81')][_0x5ea3db['lookAgent']]){ut[_0x8221('0x117')](_0x5ea3db,this[_0x8221('0x81')][_0x5ea3db[_0x8221('0xe2')]][_0x8221('0x24')],this[_0x8221('0x81')][_0x5ea3db[_0x8221('0xe2')]]['id']);}var _0xa309c9=_[_0x8221('0x118')](_0x5ea3db);_0xa309c9[_0x8221('0x119')]=moment()[_0x8221('0x58')](_0x8221('0x8a'));var _0x274cc4=_0x1f99c8['campaignsPreview'][_0x5ea3db[_0x8221('0x6e')]];if(ut[_0x8221('0x11a')](_0x22ac4f[_0x8221('0x11b')])){if(_0x5ea3db[_0x8221('0xb9')]){rpcDb[_0x8221('0xcb')](_0x5ea3db[_0x8221('0xcc')]);}if(_0x5ea3db[_0x8221('0xc1')]){rpcDb[_0x8221('0x11c')](_0x5ea3db['idContact']);}ami[_0x8221('0x21')](_0x8221('0x11d'),ut[_0x8221('0xa5')](_0x5ea3db,'rejected'));this[_0x8221('0x11e')](_0xa309c9,_0x274cc4,_0x22ac4f);}else{_0x5ea3db[_0x8221('0x89')]=moment()[_0x8221('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8221('0xd5')](_0xa309c9,0x4,'Answer');rpcDb[_0x8221('0xd6')](_0xa309c9,_0x8221('0x11f'));}}};Preview[_0x8221('0xb')]['syncHangup']=function(_0x5ccac8){var _0x36504f=this;var _0x3b2692=this[_0x8221('0x12')][_0x5ccac8[_0x8221('0x9e')]];var _0x5f442d;if(_0x3b2692){_0x5f442d=this['campaignsPreview'][_0x3b2692[_0x8221('0x6e')]];logger['info'](_0x8221('0x120'),_0x5ccac8['linkedid'],_0x8221('0xa3'),_0x5f442d['name'],_0x8221('0x70'),_0x5f442d[_0x8221('0x5d')]);}if(this[_0x8221('0x12')][_0x5ccac8[_0x8221('0x9e')]]&&_0x5ccac8[_0x8221('0x9e')]!==_0x5ccac8[_0x8221('0xa2')]){if(_0x5ccac8[_0x8221('0x121')]==='16'&&this['actions'][_0x5ccac8[_0x8221('0x9e')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x5ccac8,_0x5ccac8[_0x8221('0x9e')],_0x5ccac8[_0x8221('0x121')]);}else if(this['actions'][_0x5ccac8[_0x8221('0x9e')]][_0x8221('0x71')]){logger[_0x8221('0x6b')]('[syncHangup][talking][cause]',_0x5ccac8[_0x8221('0x9e')],_0x5ccac8[_0x8221('0x121')],_0x8221('0xa3'),_0x5f442d[_0x8221('0x24')],_0x8221('0x70'),_0x5f442d['pTalking']);this[_0x8221('0x122')](_0x5ccac8,_0x5ccac8[_0x8221('0x9e')],_0x5ccac8['cause']);}}else if(_0x3b2692&&_['isNil'](_0x3b2692[_0x8221('0x123')])&&_0x5f442d[_0x8221('0x124')]&&_0x5ccac8[_0x8221('0x9e')]===_0x5ccac8[_0x8221('0xa2')]&&_['isNil'](_0x5ccac8[_0x8221('0xd4')])&&_0x5ccac8[_0x8221('0x121')]==='16'&&_0x5ccac8['channelstate']==='6'&&_[_0x8221('0xd2')](_0x3b2692[_0x8221('0x125')])){if(_0x3b2692[_0x8221('0xb9')]){rpcDb['unlockContact'](_0x3b2692[_0x8221('0xcc')]);}if(_0x3b2692['activeContact']){rpcDb[_0x8221('0x11c')](_0x3b2692['idContact']);}_0x5ccac8['reason']='22';this[_0x8221('0x11e')](_0x3b2692,_0x5f442d,_0x5ccac8);}else if(_0x3b2692&&_0x3b2692[_0x8221('0x125')]){if(_0x5ccac8[_0x8221('0x121')]==='16'&&this[_0x8221('0x12')][_0x5ccac8[_0x8221('0x9e')]][_0x8221('0x71')]){logger[_0x8221('0x6b')](_0x8221('0x126'),_0x5ccac8[_0x8221('0x9e')],_0x5ccac8[_0x8221('0x121')],_0x8221('0xa3'),_0x5f442d[_0x8221('0x24')],_0x8221('0x70'),_0x5f442d[_0x8221('0x5d')]);this[_0x8221('0x122')](_0x5ccac8,_0x5ccac8[_0x8221('0x9e')],_0x5ccac8['cause']);}else if(this[_0x8221('0x12')][_0x5ccac8[_0x8221('0x9e')]][_0x8221('0x71')]){logger[_0x8221('0x6b')](_0x8221('0x127'),_0x5ccac8[_0x8221('0x9e')],_0x5ccac8[_0x8221('0x121')],_0x8221('0xa3'),_0x5f442d[_0x8221('0x24')],'pTalking:\x20',_0x5f442d['pTalking']);this[_0x8221('0x122')](_0x5ccac8,_0x5ccac8[_0x8221('0x9e')],_0x5ccac8['cause']);}}};Preview['prototype'][_0x8221('0x128')]=function(_0x5bc2e4){if(this['actions'][_0x5bc2e4[_0x8221('0x129')]]&&_0x5bc2e4[_0x8221('0x129')]!==_0x5bc2e4[_0x8221('0x12a')]){this['callProgressDetectingCustomer'](_0x5bc2e4,_0x5bc2e4[_0x8221('0x129')],_0x5bc2e4['dialstatus']);}};Preview['prototype'][_0x8221('0x12b')]=function(_0x3782e9){if(this[_0x8221('0x12')][_0x3782e9['linkedid']]&&_0x3782e9[_0x8221('0x9e')]!==_0x3782e9['uniqueid']&&!this['actions'][_0x3782e9[_0x8221('0x9e')]]['dialAnswer']){if(_0x3782e9[_0x8221('0x121')]==='1'){this[_0x8221('0x122')](_0x3782e9,_0x3782e9[_0x8221('0x9e')],_0x3782e9[_0x8221('0x121')]);}}};Preview[_0x8221('0xb')][_0x8221('0x12c')]=function(_0x213ee1,_0x498933,_0x291c8d){if(this[_0x8221('0x12')][_0x213ee1]){if(_[_0x8221('0x83')](this[_0x8221('0x12')][_0x213ee1][_0x8221('0x12d')])){this[_0x8221('0x12')][_0x213ee1][_0x8221('0x12d')]={};}this['actions'][_0x213ee1][_0x8221('0x12d')][_0x498933]=_0x291c8d;}};Preview[_0x8221('0xb')][_0x8221('0x1c')]=function(_0x92d0b){try{if(!_[_0x8221('0x83')](_0x92d0b)){if(ut[_0x8221('0x12e')](_[_0x8221('0x12f')](_0x92d0b[_0x8221('0x130')])[0x0])){this[_0x8221('0x12c')](_0x92d0b[_0x8221('0xa2')],_[_0x8221('0x12f')](_0x92d0b[_0x8221('0x130')])[0x0],_0x92d0b['value']);}}}catch(_0x409ff8){logger['error'](_0x8221('0x131'),util['inspect'](_0x409ff8,{'showHidden':![],'depth':null}));}};Preview[_0x8221('0xb')][_0x8221('0x1e')]=function(_0x6aac5d){if(_0x6aac5d){if(this[_0x8221('0x12')][_0x6aac5d['transfertargetlinkedid']]){this['actions'][_0x6aac5d['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x8221('0xb')][_0x8221('0x1f')]=function(_0x2cfe0b){if(_0x2cfe0b){if(this[_0x8221('0x12')][_0x2cfe0b[_0x8221('0x132')]]){this[_0x8221('0x12')][_0x2cfe0b['transfererlinkedid']][_0x8221('0x125')]=!![];}}};module[_0x8221('0x133')]=Preview; \ No newline at end of file +var _0x1ce3=['dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','AGENTS_NOT_LOGGED','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','unlockAgent','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','disableContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','Queue:\x20','called','Calling','logger','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','execRun','unlock','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Agent','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','name','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice_queue:save','voice:queue:%s','voice_queue_channel:remove','originated','paused','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','booked','outbound','hasOwnProperty','preview','setMessage','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','status','catch','message','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','scheduledat','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x1ce3,0x1f3));var _0x31ce=function(_0x23a95f,_0x53ef0e){_0x23a95f=_0x23a95f-0x0;var _0xa1ad0b=_0x1ce3[_0x23a95f];return _0xa1ad0b;};'use strict';var util=require(_0x31ce('0x0'));var _=require(_0x31ce('0x1'));var BPromise=require('bluebird');var uuid=require(_0x31ce('0x2'));var moment=require(_0x31ce('0x3'));var md5=require(_0x31ce('0x4'));var Redis=require(_0x31ce('0x5'));var config=require(_0x31ce('0x6'));var logger=require(_0x31ce('0x7'))('preview');var loggerAction=require(_0x31ce('0x7'))('actionPreview');var ami=require(_0x31ce('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x31ce('0x9'));var ut=require(_0x31ce('0xa'));config['redis']=_[_0x31ce('0xb')](config[_0x31ce('0xc')],{'host':_0x31ce('0xd'),'port':0x18eb});var io=require(_0x31ce('0xe'))(new Redis(config[_0x31ce('0xc')]));var Sequence=function(){};Sequence[_0x31ce('0xf')][_0x31ce('0x10')]=function(_0x5128bd){this[_0x31ce('0x11')]=this['tail']?this[_0x31ce('0x11')][_0x31ce('0x12')](_0x5128bd):_0x5128bd();};function Preview(_0x595331){this[_0x31ce('0x13')]=new Sequence();this[_0x31ce('0x14')]=_0x595331[_0x31ce('0x15')];this[_0x31ce('0x16')]=_0x595331['trunks'];this[_0x31ce('0x17')]={};this[_0x31ce('0x18')]=_0x595331[_0x31ce('0x18')];this[_0x31ce('0x19')]=0x0;ami['on'](_0x31ce('0x1a'),this[_0x31ce('0x1b')][_0x31ce('0x1c')](this));ami['on']('hangup',this[_0x31ce('0x1d')][_0x31ce('0x1c')](this));ami['on'](_0x31ce('0x1e'),this['syncHangupRequest'][_0x31ce('0x1c')](this));ami['on'](_0x31ce('0x1f'),this[_0x31ce('0x20')][_0x31ce('0x1c')](this));ami['on'](_0x31ce('0x21'),this[_0x31ce('0x22')][_0x31ce('0x1c')](this));ami['on'](_0x31ce('0x23'),this[_0x31ce('0x24')][_0x31ce('0x1c')](this));ami['on']('attendedtransfer',this[_0x31ce('0x25')]['bind'](this));ami['on'](_0x31ce('0x26'),this[_0x31ce('0x27')]['bind'](this));this['loopCampaigns'](this[_0x31ce('0x14')]);}function emit(_0x3de64e,_0x3078dc,_0x37d733){io['to'](_0x3de64e)[_0x31ce('0x28')](_0x3078dc,_0x37d733);}function emitCampaignPreview(_0x4f96b8){if(_0x4f96b8[_0x31ce('0x29')]==='outbound'){var _0xa5703d={'id':_0x4f96b8['id'],'name':_0x4f96b8[_0x31ce('0x2a')],'strategy':_0x4f96b8['strategy'],'answered':_0x4f96b8['answered'],'available':_0x4f96b8[_0x31ce('0x2b')],'loggedIn':_0x4f96b8[_0x31ce('0x2c')],'pTalking':_0x4f96b8[_0x31ce('0x2d')],'sumBillable':_0x4f96b8[_0x31ce('0x2e')],'sumDuration':_0x4f96b8['sumDuration'],'sumHoldTime':_0x4f96b8[_0x31ce('0x2f')]||0x0,'talking':_0x4f96b8[_0x31ce('0x30')],'total':_0x4f96b8[_0x31ce('0x31')],'type':_0x4f96b8['type'],'unmanaged':_0x4f96b8[_0x31ce('0x32')],'abandoned':_0x4f96b8[_0x31ce('0x33')],'waiting':_0x4f96b8[_0x31ce('0x34')],'loggedInDb':_0x4f96b8[_0x31ce('0x35')],'dialActive':_0x4f96b8[_0x31ce('0x36')],'dialMethod':_0x4f96b8[_0x31ce('0x37')],'dialOriginateCallerIdName':_0x4f96b8[_0x31ce('0x38')],'dialOriginateCallerIdNumber':_0x4f96b8[_0x31ce('0x39')],'dialOriginateTimeout':_0x4f96b8[_0x31ce('0x3a')],'dialPrefix':_0x4f96b8[_0x31ce('0x3b')],'outboundAnswerAgiCallsDay':_0x4f96b8[_0x31ce('0x3c')],'outboundAnswerCallsDay':_0x4f96b8[_0x31ce('0x3d')],'outboundBlacklistCallsDay':_0x4f96b8[_0x31ce('0x3e')],'outboundBusyCallsDay':_0x4f96b8[_0x31ce('0x3f')],'outboundCongestionCallsDay':_0x4f96b8[_0x31ce('0x40')],'outboundDropCallsDayACS':_0x4f96b8[_0x31ce('0x41')],'outboundDropCallsDayCallersExit':_0x4f96b8[_0x31ce('0x42')],'outboundDropCallsDayTimeout':_0x4f96b8[_0x31ce('0x43')],'outboundNoAnswerCallsDay':_0x4f96b8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4f96b8[_0x31ce('0x44')],'outboundOriginateFailureCallsDay':_0x4f96b8[_0x31ce('0x45')],'outboundReCallsDay':_0x4f96b8['outboundReCallsDay'],'outboundRejectCallsDay':_0x4f96b8[_0x31ce('0x46')],'outboundUnknownCallsDay':_0x4f96b8[_0x31ce('0x47')],'predictiveIntervalAnsweredCalls':_0x4f96b8['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4f96b8[_0x31ce('0x48')],'predictiveIntervalAvgTalktime':_0x4f96b8[_0x31ce('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x4f96b8['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4f96b8[_0x31ce('0x4a')],'predictiveIntervalErlangCalls':_0x4f96b8[_0x31ce('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x4f96b8[_0x31ce('0x4c')],'predictiveIntervalHitRate':_0x4f96b8[_0x31ce('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x4f96b8[_0x31ce('0x4e')],'predictiveIntervalPauses':_0x4f96b8[_0x31ce('0x4f')],'predictiveIntervalAvailable':_0x4f96b8[_0x31ce('0x50')],'predictiveIntervalTotalCalls':_0x4f96b8[_0x31ce('0x51')],'message':_0x4f96b8['message'],'originated':_0x4f96b8['originated'],'erlangCalls':_0x4f96b8[_0x31ce('0x52')],'erlangCallToSecond':_0x4f96b8[_0x31ce('0x53')],'erlangAbandonmentRate':_0x4f96b8[_0x31ce('0x54')],'erlangBusyFactor':_0x4f96b8[_0x31ce('0x55')],'startPredictive':_0x4f96b8[_0x31ce('0x56')],'startProgressive':_0x4f96b8[_0x31ce('0x57')]};if(_0x4f96b8[_0x31ce('0x58')]){_0xa5703d[_0x31ce('0x58')]={'id':_0x4f96b8[_0x31ce('0x58')]['id'],'name':_0x4f96b8[_0x31ce('0x58')][_0x31ce('0x2a')],'active':_0x4f96b8['Trunk'][_0x31ce('0x59')],'callerid':_0x4f96b8[_0x31ce('0x58')]['callerid']};}if(_0x4f96b8[_0x31ce('0x5a')]){_0xa5703d[_0x31ce('0x5a')]={'id':_0x4f96b8[_0x31ce('0x5a')]['id'],'name':_0x4f96b8[_0x31ce('0x5a')]['name']};}var _0x28c5f8=md5(JSON[_0x31ce('0x5b')](_0xa5703d));if(_0x4f96b8['md5']!==_0x28c5f8){_0x4f96b8[_0x31ce('0x4')]=_0x28c5f8;emit(util[_0x31ce('0x5c')]('voice:queue:%s',_0xa5703d[_0x31ce('0x2a')]),_0x31ce('0x5d'),_0xa5703d);}}}function emitVoiceQueueChannelRemove(_0x4fe3c6){emit(util[_0x31ce('0x5c')](_0x31ce('0x5e'),_0x4fe3c6[_0x31ce('0x2a')]),_0x31ce('0x5f'),_0x4fe3c6);}function notSendMessagesQueue(_0x14bf6a){if(_0x14bf6a['sendMessageOneNotActive']){if(_0x14bf6a[_0x31ce('0x60')]===0x0&&_0x14bf6a['pTalking']===0x0){_0x14bf6a['sendMessageOneNotActive']=![];_0x14bf6a[_0x31ce('0x2b')]=0x0;_0x14bf6a[_0x31ce('0x61')]=0x0;_0x14bf6a['message']='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x14bf6a[_0x31ce('0x2a')]+_0x31ce('0x62'));}else{_0x14bf6a['message']='IS_DISACTIVED';ut['logger'](_0x31ce('0x63'),_0x14bf6a[_0x31ce('0x2a')]+_0x31ce('0x64'));}emitCampaignPreview(_0x14bf6a);}}Preview[_0x31ce('0xf')][_0x31ce('0x65')]=function(){var _0x7fbba5=this;setInterval(function(){_0x7fbba5[_0x31ce('0x66')]();},0x7cf);};Preview[_0x31ce('0xf')][_0x31ce('0x66')]=function(){var _0x492f70=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x346ea8 in _0x492f70){if(_0x492f70['hasOwnProperty'](_0x346ea8)&&(_0x492f70[_0x346ea8][_0x31ce('0x37')]==='preview'||_0x492f70[_0x346ea8]['dialMethod']===_0x31ce('0x67'))&&_0x492f70[_0x346ea8][_0x31ce('0x29')]===_0x31ce('0x68')){if(this[_0x31ce('0x19')]>0x7){this[_0x31ce('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x492f70[_0x31ce('0x69')](_0x346ea8)&&_0x492f70[_0x346ea8][_0x31ce('0x37')]===_0x31ce('0x6a')&&_0x492f70[_0x346ea8][_0x31ce('0x29')]===_0x31ce('0x68')){if(_0x492f70[_0x346ea8][_0x31ce('0x36')]){this[_0x31ce('0x6b')](_0x492f70[_0x346ea8]);this[_0x31ce('0x6c')](_0x492f70[_0x346ea8]);}else{notSendMessagesQueue(_0x492f70[_0x346ea8]);}}}};Preview['prototype'][_0x31ce('0x6d')]=function(_0x2f33c8){var _0x1676f5=this;this[_0x31ce('0x13')][_0x31ce('0x10')](function(){if(!_['isNil'](_0x1676f5[_0x31ce('0x17')][_0x2f33c8])){loggerAction[_0x31ce('0x6e')](_0x31ce('0x6f'),_0x2f33c8,_0x31ce('0x70'),_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x71')],'originated:\x20',JSON[_0x31ce('0x5b')](_0x1676f5[_0x31ce('0x14')][_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x71')]][_0x31ce('0x60')]),_0x31ce('0x72'),JSON[_0x31ce('0x5b')](_0x1676f5[_0x31ce('0x14')][_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x71')]][_0x31ce('0x2d')]),JSON[_0x31ce('0x5b')](_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x73')]),JSON[_0x31ce('0x5b')](_[_0x31ce('0x74')](_0x1676f5[_0x31ce('0x17')][_0x2f33c8],[_0x31ce('0x75'),_0x31ce('0x76'),'VoiceQueueId',_0x31ce('0x77')])));return ami['Action']({'action':_0x31ce('0x78'),'channel':_0x1676f5[_0x31ce('0x17')][_0x2f33c8]['channel']})[_0x31ce('0x79')](function(_0x3364fc){if(_0x3364fc[_0x31ce('0x7a')]===_0x31ce('0x7b')){setTimeout(function(){if(_0x1676f5[_0x31ce('0x17')][_0x2f33c8]){ut[_0x31ce('0x7c')](_0x1676f5[_0x31ce('0x14')][_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x71')]],_0x31ce('0x7d'));if(_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x73')]===!![]){ut['decrementTalkink'](_0x1676f5['campaignsPreview'][_0x1676f5[_0x31ce('0x17')][_0x2f33c8][_0x31ce('0x71')]],_0x31ce('0x7d'));ut[_0x31ce('0x7e')](_0x31ce('0x7f')+_0x2f33c8,_0x1676f5['actions'][_0x2f33c8][_0x31ce('0x71')]);}ut[_0x31ce('0x7e')](_0x31ce('0x80')+_0x2f33c8,_0x1676f5['actions'][_0x2f33c8][_0x31ce('0x71')]);delete _0x1676f5['actions'][_0x2f33c8];}},0x2328);}});}});};Preview[_0x31ce('0xf')][_0x31ce('0x81')]=function(){var _0x31d46d=this;loggerAction[_0x31ce('0x6e')](_0x31ce('0x82'),_[_0x31ce('0x83')](this[_0x31ce('0x17')]));for(var _0x23b79b in this[_0x31ce('0x17')]){if(_0x31d46d[_0x31ce('0x17')][_0x31ce('0x69')](_0x23b79b)){_0x31d46d[_0x31ce('0x6d')](_0x23b79b);}}};Preview['prototype']['recallMe']=function(_0x5f377b){var _0x5e18c3=this;rpcDb[_0x31ce('0x84')](_0x5f377b['id'],ut[_0x31ce('0x85')](this['agents']))[_0x31ce('0x86')](function(_0x25ae38){if(!_[_0x31ce('0x87')](_0x25ae38)){for(var _0x118e66=0x0;_0x118e66<_0x25ae38[_0x31ce('0x88')];_0x118e66+=0x1){if(ut['getDiff'](_0x25ae38[_0x118e66][_0x31ce('0x89')])<_0x5f377b[_0x31ce('0x8a')]*0x3c){_0x5e18c3[_0x31ce('0x8b')](_0x25ae38[_0x118e66]['id'])['then'](ut[_0x31ce('0x8c')](_0x31ce('0x8d')))[_0x31ce('0x79')](ut[_0x31ce('0x8c')](_0x31ce('0x8d')));}else{var _0x50cfbf=new Action(_0x25ae38[_0x118e66],_0x5f377b);_0x50cfbf[_0x31ce('0x8e')]=moment()[_0x31ce('0x5c')](_0x31ce('0x8f'));_0x5f377b[_0x31ce('0x90')]+=0x1;ut[_0x31ce('0x91')](_0x50cfbf,0x17,_0x31ce('0x92'));if(_0x5f377b[_0x31ce('0x93')]){rpcDb['rescheduleContactInQueue'](ut[_0x31ce('0x94')](_0x25ae38[_0x118e66]));rpcDb['createCustomerHistory'](_0x50cfbf,_0x31ce('0x95'));}else{ut['logCustomer'](_0x50cfbf,0x16,_0x31ce('0x96'));rpcDb[_0x31ce('0x97')](_0x50cfbf,_0x31ce('0x98'));rpcDb[_0x31ce('0x99')](_0x50cfbf,'[HistoryRecallClose]');}}}}})[_0x31ce('0x79')](ut['logger2'](_0x31ce('0x9a')));};Preview[_0x31ce('0xf')][_0x31ce('0x6b')]=function(_0x1f4889){_0x1f4889[_0x31ce('0x9b')]=!![];if(ut[_0x31ce('0x9c')](_0x1f4889['loggedIn'])){_0x1f4889['message']=_0x31ce('0x9d');}else if(!ut['isActive'](_0x1f4889[_0x31ce('0x36')])){_0x1f4889[_0x31ce('0x7a')]=_0x31ce('0x9e');}else if(!this[_0x31ce('0x9f')](_0x1f4889['Trunk'])){if(!this[_0x31ce('0x9f')](_0x1f4889[_0x31ce('0xa0')])){_0x1f4889['message']=_0x31ce('0xa1');}else{_0x1f4889['message']=_0x31ce('0xa2');}}else{_0x1f4889['message']=_0x31ce('0xa2');}emitCampaignPreview(_0x1f4889);};Preview[_0x31ce('0xf')][_0x31ce('0xa3')]=function(_0x22ad5c,_0x5b4905,_0x26b075){var _0x3c30d3=this;var _0x11b0bf=this['actions'][_0x5b4905];var _0x8841ee=this['campaignsPreview'][_0x11b0bf[_0x31ce('0x71')]];var _0x15336f;if(_0x8841ee){switch(_0x26b075){case'1':_0x8841ee[_0x31ce('0x44')]+=0x1;_0x11b0bf[_0x31ce('0xa4')]=ut[_0x31ce('0xa5')](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0x0,_0x31ce('0xa6'));rpcDb[_0x31ce('0x97')](_0x11b0bf,_0x31ce('0xa7'));if(ut[_0x31ce('0xa5')](_0x11b0bf)>=_0x8841ee[_0x31ce('0xa8')]){_0x15336f=ut[_0x31ce('0xa9')](_0x11b0bf,0xf,'Global');rpcDb[_0x31ce('0x99')](_0x15336f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x31ce('0x99')](_0x11b0bf,_0x31ce('0xaa'));}delete this[_0x31ce('0x17')][_0x22ad5c[_0x31ce('0xab')]];break;case _0x31ce('0xac'):var _0xec123=moment()['format'](_0x31ce('0x8f'));_0x11b0bf[_0x31ce('0xad')]=_0xec123;_0x11b0bf[_0x31ce('0xae')]=_0xec123;_0x11b0bf[_0x31ce('0x73')]=!![];_0x8841ee[_0x31ce('0x2d')]+=0x1;logger[_0x31ce('0x6e')](_0x31ce('0xaf'),_0x11b0bf['uniqueid'],_0x31ce('0xb0'),_0x8841ee[_0x31ce('0x2a')],'pTalking:\x20',_0x8841ee['pTalking']);ami['emit'](_0x31ce('0xb1'),ut[_0x31ce('0xb2')](_0x11b0bf,'connect'));if(_0x8841ee[_0x31ce('0xb3')]){ami[_0x31ce('0x28')](_0x31ce('0xb4'),ut[_0x31ce('0xb5')](_0x11b0bf));}break;case'16':ami[_0x31ce('0x28')](_0x31ce('0xb6'),ut[_0x31ce('0xb2')](_0x11b0bf,_0x31ce('0xb7')));emitVoiceQueueChannelRemove(ut[_0x31ce('0xb2')](_0x11b0bf,'complete'));_0x8841ee[_0x31ce('0x3d')]+=0x1;_0x8841ee[_0x31ce('0x31')]+=0x1;_0x8841ee[_0x31ce('0xb8')]+=0x1;ut[_0x31ce('0xb9')](_0x8841ee,_0x31ce('0xba'));_0x11b0bf[_0x31ce('0xa4')]=ut['totalGlobal'](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0x4,_0x31ce('0xbb'));rpcDb[_0x31ce('0x97')](_0x11b0bf,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x31ce('0x99')](_0x11b0bf,_0x31ce('0xbc'));rpcDb['crateCustomerReportQueue'](_0x11b0bf);_0x8841ee[_0x31ce('0xbd')]+=_0x11b0bf[_0x31ce('0xbe')];_0x8841ee[_0x31ce('0x2e')]+=_0x11b0bf[_0x31ce('0xbe')];logger[_0x31ce('0x6e')](_0x31ce('0xbf'),_0x11b0bf['uniqueid'],_0x31ce('0xb0'),_0x8841ee[_0x31ce('0x2a')],_0x31ce('0x72'),_0x8841ee[_0x31ce('0x2d')]);delete this[_0x31ce('0x17')][_0x22ad5c[_0x31ce('0xab')]];break;case'BUSY':_0x8841ee[_0x31ce('0x3f')]+=0x1;_0x11b0bf[_0x31ce('0xc0')]+=0x1;_0x11b0bf[_0x31ce('0xa4')]=ut['totalGlobal'](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0x5,'Busy');rpcDb[_0x31ce('0x97')](_0x11b0bf,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x31ce('0xa5')](_0x11b0bf)>=_0x8841ee[_0x31ce('0xa8')]){_0x15336f=ut['cloneAction'](_0x11b0bf,0xf,_0x31ce('0xc1'));rpcDb[_0x31ce('0x99')](_0x15336f,_0x31ce('0xc2'));}else{if(_0x11b0bf[_0x31ce('0xc0')]>=_0x8841ee[_0x31ce('0xc3')]){rpcDb[_0x31ce('0x99')](_0x11b0bf,_0x31ce('0xc4'));}else{rpcDb[_0x31ce('0xc5')](ut[_0x31ce('0xc6')](_0x11b0bf,'countbusyretry',_0x8841ee[_0x31ce('0xc7')]),_0x11b0bf['unlockAgent'],_0x11b0bf[_0x31ce('0xc8')]);}}break;case _0x31ce('0xc9'):_0x8841ee['outboundNoAnswerCallsDay']+=0x1;_0x11b0bf[_0x31ce('0xca')]+=0x1;_0x11b0bf[_0x31ce('0xa4')]=ut[_0x31ce('0xa5')](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0x3,_0x31ce('0xcb'));rpcDb['createCustomerHistory'](_0x11b0bf,_0x31ce('0xcc'));if(ut[_0x31ce('0xa5')](_0x11b0bf)>=_0x8841ee['dialGlobalMaxRetry']){_0x15336f=ut[_0x31ce('0xa9')](_0x11b0bf,0xf,_0x31ce('0xc1'));rpcDb[_0x31ce('0x99')](_0x15336f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x11b0bf[_0x31ce('0xca')]>=_0x8841ee[_0x31ce('0xcd')]){rpcDb[_0x31ce('0x99')](_0x11b0bf,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x31ce('0xc5')](ut[_0x31ce('0xc6')](_0x11b0bf,_0x31ce('0xca'),_0x8841ee[_0x31ce('0xce')]),_0x11b0bf['unlockAgent'],_0x11b0bf[_0x31ce('0xc8')]);}}break;case _0x31ce('0xcf'):_0x8841ee[_0x31ce('0x40')]+=0x1;_0x11b0bf[_0x31ce('0xd0')]+=0x1;_0x11b0bf[_0x31ce('0xa4')]=ut[_0x31ce('0xa5')](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0x8,_0x31ce('0xd1'));rpcDb[_0x31ce('0x97')](_0x11b0bf,_0x31ce('0xd2'));if(ut[_0x31ce('0xa5')](_0x11b0bf)>=_0x8841ee['dialGlobalMaxRetry']){_0x15336f=ut[_0x31ce('0xa9')](_0x11b0bf,0xf,_0x31ce('0xc1'));rpcDb[_0x31ce('0x99')](_0x15336f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x11b0bf['countcongestionretry']>=_0x8841ee['dialCongestionMaxRetry']){rpcDb[_0x31ce('0x99')](_0x11b0bf,_0x31ce('0xd2'));}else{rpcDb['rescheduleContact'](ut[_0x31ce('0xc6')](_0x11b0bf,_0x31ce('0xd0'),_0x8841ee['dialBusyRetryFrequency']),_0x11b0bf[_0x31ce('0xd3')],_0x11b0bf['activeContact']);}}break;case _0x31ce('0xd4'):_0x8841ee[_0x31ce('0x46')]+=0x1;_0x11b0bf['countglobal']=ut['totalGlobal'](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0x14,_0x31ce('0xd5'));rpcDb[_0x31ce('0x97')](_0x11b0bf,_0x31ce('0xd6'));if(_0x11b0bf[_0x31ce('0xd3')]){rpcDb[_0x31ce('0xd7')](_0x11b0bf['idContact']);}if(_0x11b0bf['activeContact']){rpcDb[_0x31ce('0xd8')](_0x11b0bf[_0x31ce('0xd9')]);}break;default:if(_0x11b0bf[_0x31ce('0x73')]){ut['decrementTalkink'](_0x8841ee,_0x31ce('0xda'));ut[_0x31ce('0x7e')](_0x31ce('0xdb')+_0x8841ee[_0x31ce('0x2a')],_0x22ad5c);}_0x8841ee['outboundUnknownCallsDay']+=0x1;_0x11b0bf['countglobal']=ut[_0x31ce('0xa5')](_0x11b0bf);ut[_0x31ce('0x91')](_0x11b0bf,0xc,_0x22ad5c[_0x31ce('0xdc')]||_0x22ad5c[_0x31ce('0xdd')]);rpcDb[_0x31ce('0x97')](_0x11b0bf,_0x31ce('0xde'));if(ut['totalGlobal'](_0x11b0bf)>=_0x8841ee[_0x31ce('0xa8')]){_0x15336f=ut[_0x31ce('0xa9')](_0x11b0bf,0xf,_0x31ce('0xc1'));rpcDb['createCustomerFinal'](_0x15336f,_0x31ce('0xdf'));}else{rpcDb[_0x31ce('0x99')](_0x11b0bf,_0x31ce('0xdf'));}delete this[_0x31ce('0x17')][_0x22ad5c[_0x31ce('0xab')]];}if(!(_0x11b0bf['dialAnswer']&&_0x26b075==='16')){ut[_0x31ce('0x7c')](_0x8841ee,_0x31ce('0xe0'));logger[_0x31ce('0x6e')](_0x31ce('0xe1'),_0x11b0bf[_0x31ce('0xe2')],'\x20Queue',_0x8841ee[_0x31ce('0x2a')],_0x31ce('0xe3'),_0x8841ee[_0x31ce('0x60')]);}if(_0x26b075!==_0x31ce('0xac')){delete this[_0x31ce('0x17')][_0x22ad5c[_0x31ce('0xab')]];delete this[_0x31ce('0x17')][_0x22ad5c[_0x31ce('0xe4')]];}}};Preview[_0x31ce('0xf')][_0x31ce('0xe5')]=function(_0x3bd9bf,_0x288fc1,_0x43c9e8){if(_[_0x31ce('0xe6')](_0x288fc1)&&_0x31ce('0xe7')!==typeof _0x288fc1){return;}if(_[_0x31ce('0xe6')](_0x43c9e8)&&'object'!==typeof _0x43c9e8){return;}switch(_0x43c9e8[_0x31ce('0xe8')]){case'0':ut[_0x31ce('0xe9')](_0x3bd9bf,0x0,'NoSuchNumber');rpcDb[_0x31ce('0xea')](_0x3bd9bf,_0x31ce('0xeb'));break;case'3':ut[_0x31ce('0xe9')](_0x3bd9bf,0x3,_0x31ce('0xcb'));rpcDb[_0x31ce('0xea')](_0x3bd9bf,_0x31ce('0xec'));break;case'5':ut[_0x31ce('0xe9')](_0x3bd9bf,0x5,'Busy');rpcDb[_0x31ce('0xea')](_0x3bd9bf,_0x31ce('0xed'));break;case'8':ut[_0x31ce('0xe9')](_0x3bd9bf,0x8,_0x31ce('0xd1'));rpcDb[_0x31ce('0xea')](_0x3bd9bf,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x31ce('0xe9')](_0x3bd9bf,0x16,_0x31ce('0xee'));rpcDb[_0x31ce('0xea')](_0x3bd9bf,_0x31ce('0xef'));break;default:ut[_0x31ce('0xe9')](_0x3bd9bf,0xc,_0x43c9e8[_0x31ce('0xe8')]);rpcDb[_0x31ce('0xea')](_0x3bd9bf,'[callProgressDetectingAgent][logCongestion]');}ut[_0x31ce('0x7c')](_0x288fc1,_0x31ce('0xf0'));logger[_0x31ce('0x6e')](_0x31ce('0xf1'),_0x3bd9bf[_0x31ce('0xe2')],_0x31ce('0xb0'),_0x288fc1[_0x31ce('0x2a')],_0x31ce('0xe3'),_0x288fc1[_0x31ce('0x60')]);delete this[_0x31ce('0x17')][_0x3bd9bf[_0x31ce('0xe2')]];};Preview[_0x31ce('0xf')][_0x31ce('0xf2')]=function(_0x4e3cc3,_0x14496d,_0x4d4e3a,_0x17a03b,_0x5b0bb9){var _0x22357c=this;return new BPromise(function(_0x306939,_0x24962e){if(_[_0x31ce('0x87')](_0x14496d)||_[_0x31ce('0x87')](_0x14496d[_0x31ce('0xf3')])||_['isNil'](_0x14496d[_0x31ce('0xf3')][_0x31ce('0xf4')])||_[_0x31ce('0x87')](_0x14496d[_0x31ce('0xf5')])){_0x24962e(ut[_0x31ce('0x7a')](_0x31ce('0xf6'),_0x17a03b,_0x5b0bb9));return;}var _0x58d339=uuid['v4']();var _0x538064=_0x22357c[_0x31ce('0x14')][_0x14496d[_0x31ce('0x70')][_0x31ce('0x2a')]];var _0x2e6246=_0x4d4e3a?_0x22357c[_0x31ce('0x18')][_0x4d4e3a]['id']:undefined;_0x22357c['actions'][_0x58d339]=new Action(_0x14496d,_0x538064,_0x58d339,_0x4d4e3a,_0x2e6246);var _0x147628=_0x22357c[_0x31ce('0x17')][_0x58d339];_0x147628['unlockAgent']=_0x17a03b;_0x147628[_0x31ce('0xc8')]=_0x5b0bb9;_0x147628[_0x31ce('0xf7')]=_0x4d4e3a;if(_['isEmpty'](_0x4e3cc3)){_0x22357c[_0x31ce('0xf8')](_0x147628,_0x538064,_0x14496d,_0x4d4e3a)[_0x31ce('0x86')](function(_0x4f8649){logger[_0x31ce('0x6e')]('[Preview][execCall][success]',_0x31ce('0xf9')+_0x147628['queue']+'\x20IdHopper:\x20'+_0x147628['idContact'],JSON[_0x31ce('0x5b')](_0x4f8649));ami['emit']('custom:agentcalled',ut['buildObj'](_0x147628,_0x31ce('0xfa')));_0x306939(ut[_0x31ce('0x7a')](_0x31ce('0xfb')));})[_0x31ce('0x79')](function(_0x44ef45){ut[_0x31ce('0xfc')]('[Preview][execCall][failure]',_0x44ef45);_0x24962e(ut[_0x31ce('0x7a')](_0x31ce('0xfd'),_0x17a03b,_0x5b0bb9));});}else{_0x538064[_0x31ce('0x3e')]+=0x1;ut[_0x31ce('0xfe')](_0x147628);rpcDb[_0x31ce('0xff')](_0x147628,_0x31ce('0x100'));delete _0x22357c[_0x31ce('0x17')][_0x58d339];_0x24962e(ut[_0x31ce('0x7a')](_0x31ce('0x101'),_0x17a03b,_0x5b0bb9));}});};Preview['prototype'][_0x31ce('0x9f')]=function(_0x3da1fa){return!_[_0x31ce('0x87')](_0x3da1fa)&&!_['isNil'](_0x3da1fa[_0x31ce('0x2a')])&&!_['isNil'](_0x3da1fa[_0x31ce('0x59')])&&_0x3da1fa[_0x31ce('0x59')]&&!_[_0x31ce('0x87')](this[_0x31ce('0x16')][util[_0x31ce('0x5c')](_0x31ce('0x102'),_0x3da1fa[_0x31ce('0x2a')])])&&!_[_0x31ce('0x87')](this[_0x31ce('0x16')][util['format']('SIP/%s',_0x3da1fa[_0x31ce('0x2a')])][_0x31ce('0x78')])&&(this['trunks'][util[_0x31ce('0x5c')]('SIP/%s',_0x3da1fa['name'])]['status']==='reachable'||this[_0x31ce('0x16')][util[_0x31ce('0x5c')](_0x31ce('0x102'),_0x3da1fa[_0x31ce('0x2a')])][_0x31ce('0x78')]==='unmonitored');};Preview['prototype'][_0x31ce('0x8b')]=function(_0x49dd24,_0x5b04b6){var _0x2b0199=this;return new BPromise(function(_0x3b5107,_0x2ee65f){_0x2b0199[_0x31ce('0x103')](_0x49dd24,_0x5b04b6)['then'](function(_0x5cbd60){_0x3b5107(_['pick'](_0x5cbd60,['message']));})[_0x31ce('0x79')](function(_0x25da53){if(_0x25da53[_0x31ce('0x104')]){rpcDb[_0x31ce('0xd7')](_0x49dd24);}if(_0x25da53[_0x31ce('0x59')]){rpcDb['disableContact'](_0x49dd24);}_0x2ee65f(_[_0x31ce('0x74')](_0x25da53,[_0x31ce('0x7a')]));});});};Preview[_0x31ce('0xf')][_0x31ce('0x103')]=function(_0x3c16d3,_0x1313d9){var _0x3b4435=this;return new BPromise(function(_0x25eac5,_0x2b9d7a){var _0x456379,_0x36d6b7;rpcDb['getContactPreview'](_0x3c16d3)[_0x31ce('0x86')](function(_0x3b2b1b){if(!_[_0x31ce('0x87')](_0x3b2b1b[0x0])){_0x36d6b7=_0x3b2b1b[0x0]['recallme']?![]:!![];_0x456379=_0x3b2b1b[0x0]['recallme']?!![]:![];_0x456379=_0x1313d9?!![]:_0x456379;}var _0x570088=_0x3b4435['validateContact'](_0x3b2b1b);if(_0x570088[_0x31ce('0x105')]){rpcDb[_0x31ce('0x106')](_[_0x31ce('0x74')](_0x3b2b1b[0x0],[_0x31ce('0xf5'),'Contact.phone']))[_0x31ce('0x86')](function(_0x4cc378){_0x3b4435[_0x31ce('0xf2')](_0x4cc378,_0x3b2b1b[0x0],_0x1313d9,_0x36d6b7,_0x456379)[_0x31ce('0x86')](function(_0x3d7364){_0x25eac5(_0x3d7364);})[_0x31ce('0x79')](function(_0x20f38e){_0x2b9d7a(_0x20f38e);});})['catch'](function(_0x1d17c0){ut[_0x31ce('0xfc')](_0x31ce('0x107'),_0x1d17c0);_0x2b9d7a(ut['message'](_0x31ce('0x108'),_0x36d6b7,_0x456379));});}else{_0x2b9d7a(ut[_0x31ce('0x7a')](_0x570088[_0x31ce('0x7a')],_0x36d6b7,_0x456379));}})[_0x31ce('0x79')](function(_0x59b9a8){ut[_0x31ce('0xfc')](_0x31ce('0x109'),_0x59b9a8);_0x2b9d7a(ut[_0x31ce('0x7a')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x31ce('0xf')]['validateContact']=function(_0x5c7473){if(_[_0x31ce('0x87')](_0x5c7473)||_[_0x31ce('0x10a')](_0x5c7473)||!_[_0x31ce('0x87')](_0x5c7473[0x0]['Agent'])&&_['isNil'](_0x5c7473[0x0][_0x31ce('0x10b')]['name'])){ut[_0x31ce('0xfc')]('[Preview][validateContact][Empty\x20Contact]',_0x5c7473);return{'isValid':![],'message':_0x31ce('0x10c')};}var _0x45c6d8=this[_0x31ce('0x14')][_0x5c7473[0x0]['Queue']['name']];_0x45c6d8[_0x31ce('0x7a')]=_0x31ce('0xa2');if(_['isNil'](_0x45c6d8)){ut[_0x31ce('0xfc')]('[Preview][validateContact][Empty\x20Campaign]',_0x45c6d8);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x31ce('0x9f')](_0x45c6d8[_0x31ce('0x58')])){ut[_0x31ce('0xfc')](_0x31ce('0x10d'),_0x31ce('0x10e')+_0x45c6d8[_0x31ce('0x2a')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x45c6d8[_0x31ce('0xa0')])){ut[_0x31ce('0xfc')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x45c6d8[_0x31ce('0x2a')]+_0x31ce('0x10f'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x31ce('0x110')](_0x45c6d8[_0x31ce('0x36')])){ut['logger'](_0x31ce('0x111'),_0x45c6d8[_0x31ce('0x2a')]+_0x31ce('0x112'));return{'isValid':![],'message':_0x31ce('0x10e')+_0x45c6d8[_0x31ce('0x2a')]+_0x31ce('0x112')};}return{'isValid':!![],'message':_0x31ce('0x113')};};Preview[_0x31ce('0xf')][_0x31ce('0xf8')]=function(_0x16e75d,_0x48d73f,_0x574d88,_0x2fda8e){var _0x53c54a=this;return new BPromise(function(_0x16e4a5,_0x1e4ca4){var _0x53955d=_0x16e75d['uniqueid'];var _0x4a0594=_0x53c54a[_0x31ce('0x9f')](_0x48d73f[_0x31ce('0x58')])?util[_0x31ce('0x5c')](_0x31ce('0x114'),_0x48d73f[_0x31ce('0x58')]['name'],_['isNil'](_0x48d73f[_0x31ce('0x3b')])?'':_0x48d73f[_0x31ce('0x3b')][_0x31ce('0x115')]()||'',_0x48d73f[_0x31ce('0x116')]>0x0?_0x574d88['Contact'][_0x31ce('0xf4')]['substring'](_0x48d73f[_0x31ce('0x116')]):_0x574d88[_0x31ce('0xf3')][_0x31ce('0xf4')]):util['format'](_0x31ce('0x114'),_[_0x31ce('0x87')](_0x48d73f['TrunkBackup'])?_0x48d73f[_0x31ce('0x58')][_0x31ce('0x2a')]:_0x48d73f['TrunkBackup']['name'],_[_0x31ce('0x87')](_0x48d73f['dialPrefix'])?'':_0x48d73f[_0x31ce('0x3b')][_0x31ce('0x115')]()||'',_0x48d73f[_0x31ce('0x116')]>0x0?_0x574d88['Contact'][_0x31ce('0xf4')][_0x31ce('0x117')](_0x48d73f[_0x31ce('0x116')]):_0x574d88[_0x31ce('0xf3')]['phone']);var _0x252986=_0x53c54a['isTrunkReachable'](_0x48d73f[_0x31ce('0x58')])?ut[_0x31ce('0x118')](_0x48d73f[_0x31ce('0x58')][_0x31ce('0x119')],_0x48d73f['dialOriginateCallerIdName'],_0x48d73f[_0x31ce('0x11a')]>0x0?ut[_0x31ce('0x11b')](_0x48d73f['dialOriginateCallerIdNumber'],_0x48d73f[_0x31ce('0x11a')]):_0x48d73f['dialOriginateCallerIdNumber']):ut[_0x31ce('0x118')](_[_0x31ce('0x87')](_0x48d73f['TrunkBackup'])?_0x48d73f['Trunk'][_0x31ce('0x119')]:_0x48d73f[_0x31ce('0xa0')]['callerid'],_0x48d73f[_0x31ce('0x38')],_0x48d73f['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x31ce('0x11b')](_0x48d73f[_0x31ce('0x39')],_0x48d73f[_0x31ce('0x11a')]):_0x48d73f[_0x31ce('0x39')]);if(_0x252986){_0x16e75d[_0x31ce('0x11c')]=ut[_0x31ce('0x11d')](_0x252986);_0x16e75d[_0x31ce('0x11e')]=ut[_0x31ce('0x11f')](_0x252986);}var _0x2f88d3=ut[_0x31ce('0x120')](_0x48d73f,_0x574d88,_0x4a0594,_0x252986,_0x53955d,_0x16e75d);_[_0x31ce('0x121')](_0x16e75d,ut[_0x31ce('0x122')](_0x2f88d3));_0x16e75d[_0x31ce('0x8e')]=moment()[_0x31ce('0x5c')](_0x31ce('0x8f'));ami[_0x31ce('0x123')](ut[_0x31ce('0x124')](_0x16e75d,_0x48d73f,_0x2f88d3,_0x16e75d['activeContact'],_0x2fda8e))['then'](function(_0x280e45){_0x48d73f[_0x31ce('0x60')]+=0x1;logger['info'](_0x31ce('0x125'),_0x53955d,'\x20Queue',_0x48d73f[_0x31ce('0x2a')],_0x31ce('0xe3'),_0x48d73f['originated']);_0x16e4a5(_0x280e45);})[_0x31ce('0x79')](function(_0x1cd747){ut[_0x31ce('0xe9')](_0x16e75d,0xe,_0x31ce('0x126'));rpcDb[_0x31ce('0xea')](_0x16e75d,_0x31ce('0x127'));_0x1e4ca4(_0x1cd747);});});};Preview[_0x31ce('0xf')][_0x31ce('0x22')]=function(_0x74fcb2){if(this['actions'][_0x74fcb2[_0x31ce('0xab')]]){this['actions'][_0x74fcb2[_0x31ce('0xab')]][_0x31ce('0x128')]=_0x74fcb2['channel'];}};Preview['prototype'][_0x31ce('0x1b')]=function(_0xa31001){var _0x316545=this;var _0x5bb93b=this[_0x31ce('0x17')][_0xa31001['actionid']];if(_0x5bb93b){if(_0x5bb93b[_0x31ce('0xf7')]&&this[_0x31ce('0x18')][_0x5bb93b['lookAgent']]){ut[_0x31ce('0x129')](_0x5bb93b,this['agents'][_0x5bb93b[_0x31ce('0xf7')]]['name'],this[_0x31ce('0x18')][_0x5bb93b['lookAgent']]['id']);}var _0xe087b9=_[_0x31ce('0x12a')](_0x5bb93b);_0xe087b9[_0x31ce('0xad')]=moment()[_0x31ce('0x5c')](_0x31ce('0x8f'));var _0x49ff36=_0x316545[_0x31ce('0x14')][_0x5bb93b[_0x31ce('0x71')]];if(ut[_0x31ce('0x12b')](_0xa31001[_0x31ce('0x12c')])){if(_0x5bb93b[_0x31ce('0xd3')]){rpcDb[_0x31ce('0xd7')](_0x5bb93b[_0x31ce('0xd9')]);}if(_0x5bb93b[_0x31ce('0xc8')]){rpcDb[_0x31ce('0xd8')](_0x5bb93b[_0x31ce('0xd9')]);}ami[_0x31ce('0x28')](_0x31ce('0x12d'),ut[_0x31ce('0xb2')](_0x5bb93b,_0x31ce('0x12e')));this[_0x31ce('0xe5')](_0xe087b9,_0x49ff36,_0xa31001);}else{_0x5bb93b['starttime']=moment()[_0x31ce('0x5c')](_0x31ce('0x8f'));ut['logAgent'](_0xe087b9,0x4,'Answer');rpcDb[_0x31ce('0xea')](_0xe087b9,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x31ce('0xf')][_0x31ce('0x1d')]=function(_0x2782bc){var _0x185982=this;var _0x1c0d05=this[_0x31ce('0x17')][_0x2782bc['linkedid']];var _0x3b0cde;if(_0x1c0d05){_0x3b0cde=this['campaignsPreview'][_0x1c0d05[_0x31ce('0x71')]];logger[_0x31ce('0x6e')](_0x31ce('0x12f'),_0x2782bc[_0x31ce('0xab')],_0x31ce('0xb0'),_0x3b0cde['name'],_0x31ce('0x72'),_0x3b0cde['pTalking']);}if(this[_0x31ce('0x17')][_0x2782bc[_0x31ce('0xab')]]&&_0x2782bc[_0x31ce('0xab')]!==_0x2782bc[_0x31ce('0xe2')]){if(_0x2782bc['cause']==='16'&&this[_0x31ce('0x17')][_0x2782bc[_0x31ce('0xab')]]['dialAnswer']){this[_0x31ce('0xa3')](_0x2782bc,_0x2782bc[_0x31ce('0xab')],_0x2782bc[_0x31ce('0x130')]);}else if(this[_0x31ce('0x17')][_0x2782bc[_0x31ce('0xab')]][_0x31ce('0x73')]){logger['info'](_0x31ce('0x131'),_0x2782bc[_0x31ce('0xab')],_0x2782bc['cause'],_0x31ce('0xb0'),_0x3b0cde[_0x31ce('0x2a')],'pTalking:\x20',_0x3b0cde[_0x31ce('0x2d')]);this[_0x31ce('0xa3')](_0x2782bc,_0x2782bc[_0x31ce('0xab')],_0x2782bc[_0x31ce('0x130')]);}}else if(_0x1c0d05&&_[_0x31ce('0x87')](_0x1c0d05[_0x31ce('0x132')])&&_0x3b0cde[_0x31ce('0x133')]&&_0x2782bc[_0x31ce('0xab')]===_0x2782bc[_0x31ce('0xe2')]&&_[_0x31ce('0x87')](_0x2782bc['reason'])&&_0x2782bc[_0x31ce('0x130')]==='16'&&_0x2782bc[_0x31ce('0x134')]==='6'&&_[_0x31ce('0xe6')](_0x1c0d05[_0x31ce('0x135')])){if(_0x1c0d05[_0x31ce('0xd3')]){rpcDb[_0x31ce('0xd7')](_0x1c0d05['idContact']);}if(_0x1c0d05[_0x31ce('0xc8')]){rpcDb['disableContact'](_0x1c0d05[_0x31ce('0xd9')]);}_0x2782bc[_0x31ce('0xe8')]='22';this[_0x31ce('0xe5')](_0x1c0d05,_0x3b0cde,_0x2782bc);}else if(_0x1c0d05&&_0x1c0d05[_0x31ce('0x135')]){if(_0x2782bc[_0x31ce('0x130')]==='16'&&this[_0x31ce('0x17')][_0x2782bc[_0x31ce('0xab')]]['dialAnswer']){logger[_0x31ce('0x6e')](_0x31ce('0x136'),_0x2782bc[_0x31ce('0xab')],_0x2782bc[_0x31ce('0x130')],'\x20Queue',_0x3b0cde[_0x31ce('0x2a')],_0x31ce('0x72'),_0x3b0cde[_0x31ce('0x2d')]);this[_0x31ce('0xa3')](_0x2782bc,_0x2782bc[_0x31ce('0xab')],_0x2782bc['cause']);}else if(this[_0x31ce('0x17')][_0x2782bc[_0x31ce('0xab')]]['dialAnswer']){logger[_0x31ce('0x6e')](_0x31ce('0x131'),_0x2782bc[_0x31ce('0xab')],_0x2782bc[_0x31ce('0x130')],_0x31ce('0xb0'),_0x3b0cde['name'],_0x31ce('0x72'),_0x3b0cde[_0x31ce('0x2d')]);this[_0x31ce('0xa3')](_0x2782bc,_0x2782bc[_0x31ce('0xab')],_0x2782bc[_0x31ce('0x130')]);}}};Preview[_0x31ce('0xf')][_0x31ce('0x20')]=function(_0x531e99){if(this['actions'][_0x531e99[_0x31ce('0xe4')]]&&_0x531e99[_0x31ce('0xe4')]!==_0x531e99['destuniqueid']){this['callProgressDetectingCustomer'](_0x531e99,_0x531e99[_0x31ce('0xe4')],_0x531e99[_0x31ce('0xdd')]);}};Preview[_0x31ce('0xf')][_0x31ce('0x137')]=function(_0xfed064){if(this[_0x31ce('0x17')][_0xfed064[_0x31ce('0xab')]]&&_0xfed064[_0x31ce('0xab')]!==_0xfed064[_0x31ce('0xe2')]&&!this[_0x31ce('0x17')][_0xfed064[_0x31ce('0xab')]][_0x31ce('0x73')]){if(_0xfed064[_0x31ce('0x130')]==='1'){this[_0x31ce('0xa3')](_0xfed064,_0xfed064['linkedid'],_0xfed064['cause']);}}};Preview[_0x31ce('0xf')][_0x31ce('0x138')]=function(_0x46ad78,_0x236a5d,_0x4f804c){if(this[_0x31ce('0x17')][_0x46ad78]){if(_[_0x31ce('0x87')](this[_0x31ce('0x17')][_0x46ad78][_0x31ce('0x139')])){this['actions'][_0x46ad78]['variables']={};}this['actions'][_0x46ad78][_0x31ce('0x139')][_0x236a5d]=_0x4f804c;}};Preview[_0x31ce('0xf')]['syncVarSet']=function(_0x4f07c6){try{if(!_[_0x31ce('0x87')](_0x4f07c6)){if(ut[_0x31ce('0x13a')](_[_0x31ce('0x13b')](_0x4f07c6['variable'])[0x0])){this[_0x31ce('0x138')](_0x4f07c6[_0x31ce('0xe2')],_[_0x31ce('0x13b')](_0x4f07c6[_0x31ce('0x13c')])[0x0],_0x4f07c6[_0x31ce('0x13d')]);}}}catch(_0x52dcd0){logger[_0x31ce('0x13e')]('[syncVarSet][Preview]',util[_0x31ce('0x13f')](_0x52dcd0,{'showHidden':![],'depth':null}));}};Preview[_0x31ce('0xf')]['syncAttendedTransfer']=function(_0x24b79f){if(_0x24b79f){if(this['actions'][_0x24b79f[_0x31ce('0x140')]]){this['actions'][_0x24b79f[_0x31ce('0x140')]][_0x31ce('0x135')]=!![];}}};Preview[_0x31ce('0xf')][_0x31ce('0x27')]=function(_0x2858ef){if(_0x2858ef){if(this[_0x31ce('0x17')][_0x2858ef[_0x31ce('0x141')]]){this[_0x31ce('0x17')][_0x2858ef['transfererlinkedid']][_0x31ce('0x135')]=!![];}}};module[_0x31ce('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 272d563..6bf7f8f 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 _0x7c25=['queuecallercomplete','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0x42dee5,_0x431698){var _0x400bfa=function(_0x27eaf4){while(--_0x27eaf4){_0x42dee5['push'](_0x42dee5['shift']());}};_0x400bfa(++_0x431698);}(_0x7c25,0x70));var _0x57c2=function(_0x1164ed,_0x564dc7){_0x1164ed=_0x1164ed-0x0;var _0x504a87=_0x7c25[_0x1164ed];return _0x504a87;};'use strict';var util=require(_0x57c2('0x0'));var BPromise=require(_0x57c2('0x1'));var logger=require(_0x57c2('0x2'))(_0x57c2('0x3'));var _=require(_0x57c2('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x57c2('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x57c2('0x6'));var agentReportPreview=require(_0x57c2('0x7'));var voiceQueueReport=require(_0x57c2('0x8'));function loggerCatch(_0x5793e3){return function(_0x5d77fb){logger[_0x57c2('0x9')](_0x5793e3,util[_0x57c2('0xa')](_0x5d77fb,{'showHidden':![],'depth':null}));};}function create(_0x8a3286){return BPromise['resolve']()[_0x57c2('0xb')](cmHopperHistory[_0x57c2('0xc')](_0x8a3286))[_0x57c2('0xd')](loggerCatch(_0x57c2('0xe')));}function createAgent(_0x3a070a){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](agentReportPreview[_0x57c2('0xc')](_0x3a070a))[_0x57c2('0xd')](loggerCatch(_0x57c2('0xe')));}function moveContact(_0x2976f3){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x2976f3,!![]))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x10')));}exports[_0x57c2('0x11')]=function(_0x4e2cdf){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopperBlack[_0x57c2('0x11')](_0x4e2cdf))[_0x57c2('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x57c2('0x12')]=function(_0x192485){return BPromise['resolve']()[_0x57c2('0xb')](cmHopper[_0x57c2('0x12')](_0x192485))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x13')));};exports['createHistory']=function(_0x112501,_0x3ed778){create(_0x112501)[_0x57c2('0xd')](loggerCatch(_0x3ed778));moveContact(_0x112501)[_0x57c2('0xd')](loggerCatch(_0x3ed778));};exports[_0x57c2('0x14')]=function(_0x329a39,_0x3d424f){createAgent(_0x329a39)[_0x57c2('0xd')](loggerCatch(_0x3d424f));};exports['createCustomerHistory']=function(_0xccdebf,_0x4b3861){create(_0xccdebf)[_0x57c2('0xd')](loggerCatch(_0x4b3861));};exports['createCustomerFinal']=function(_0x163618,_0x2cdf0d){moveContact(_0x163618)[_0x57c2('0xd')](loggerCatch(_0x2cdf0d));};exports[_0x57c2('0x15')]=function(_0x139f51,_0x441684,_0x3070af){if(_0x441684){_0x139f51['UserId']=null;}if(_0x3070af){_0x139f51[_0x57c2('0x16')]=![];}return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopper['rescheduleContact'](_0x139f51))[_0x57c2('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x1dd0de){return BPromise[_0x57c2('0xf')]()['then'](cmHopper['countReScheduled'](_0x1dd0de))[_0x57c2('0xd')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x4c815){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopper['unlockContact']({'UserId':null},_0x4c815,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x57c2('0x17')]=function(_0x8fc65f){return BPromise['resolve']()[_0x57c2('0xb')](cmHopper[_0x57c2('0x18')]({'active':![]},_0x8fc65f,0x1))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x19')));};exports[_0x57c2('0x1a')]=function(_0x2cf5fd){var _0x46f5f7={};_0x46f5f7[_0x57c2('0x1b')]=_0x2cf5fd[_0x57c2('0x1b')];_0x46f5f7['uniqueid']=_0x2cf5fd['uniqueid'];_0x46f5f7['calleridnum']=_0x2cf5fd['calleridnum'];_0x46f5f7['calleridname']=_0x2cf5fd[_0x57c2('0x1c')];_0x46f5f7['queue']=_0x2cf5fd[_0x57c2('0x1d')];_0x46f5f7[_0x57c2('0x1e')]=_0x2cf5fd['answertime'];_0x46f5f7['queuecallerleaveAt']=_0x2cf5fd[_0x57c2('0x1f')];_0x46f5f7[_0x57c2('0x20')]=0x1;_0x46f5f7['queuecallercompleteAt']=_0x2cf5fd[_0x57c2('0x21')];_0x46f5f7[_0x57c2('0x22')]=_0x2cf5fd[_0x57c2('0x23')];_0x46f5f7['context']=_0x57c2('0x24');_0x46f5f7['exten']=_0x57c2('0x25');_0x46f5f7['holdtime']=0x0;_0x46f5f7[_0x57c2('0x26')]=0x1;_0x46f5f7[_0x57c2('0x27')]=_0x2cf5fd[_0x57c2('0x23')];_0x46f5f7[_0x57c2('0x28')]=_0x57c2('0x29');return BPromise['resolve']()[_0x57c2('0xb')](voiceQueueReport[_0x57c2('0x2a')](_0x46f5f7))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x2b')));};exports[_0x57c2('0x2c')]=function(_0x484d53,_0x346db6){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopper[_0x57c2('0x2c')](_0x484d53,_0x346db6))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x2d')));};exports[_0x57c2('0x2e')]=function(_0x1e7ae5){return BPromise['resolve']()[_0x57c2('0xb')](cmHopper[_0x57c2('0x15')](_0x1e7ae5,!![],!![]))['catch'](loggerCatch(_0x57c2('0x2f')));}; \ No newline at end of file +var _0xc95b=['create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','resolve','then','createHistory','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED'];(function(_0x2723b1,_0x592c60){var _0x4248e8=function(_0x1e95b7){while(--_0x1e95b7){_0x2723b1['push'](_0x2723b1['shift']());}};_0x4248e8(++_0x592c60);}(_0xc95b,0x103));var _0xbc95=function(_0x47cee1,_0x1a6e87){_0x47cee1=_0x47cee1-0x0;var _0xc843c3=_0xc95b[_0x47cee1];return _0xc843c3;};'use strict';var util=require(_0xbc95('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xbc95('0x1'));var _=require(_0xbc95('0x2'));var cmHopper=require(_0xbc95('0x3'));var cmHopperFinal=require(_0xbc95('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xbc95('0x5'));var voiceQueueRt=require(_0xbc95('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x45e950){return function(_0x61caad){logger[_0xbc95('0x7')](_0x45e950,util[_0xbc95('0x8')](_0x61caad,{'showHidden':![],'depth':null}));};}function create(_0x2016a7){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopperHistory[_0xbc95('0xb')](_0x2016a7))[_0xbc95('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x24dd9d){return BPromise['resolve']()[_0xbc95('0xa')](agentReportPreview[_0xbc95('0xb')](_0x24dd9d))[_0xbc95('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x14f1c3){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper['moveContactManagedDialer'](_0x14f1c3,!![]))['catch'](loggerCatch(_0xbc95('0xd')));}exports[_0xbc95('0xe')]=function(_0x272aba){return BPromise['resolve']()[_0xbc95('0xa')](cmHopperBlack['checkIsBlackList'](_0x272aba))[_0xbc95('0xc')](loggerCatch(_0xbc95('0xf')));};exports[_0xbc95('0x10')]=function(_0x4e8599){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper['getContactPreview'](_0x4e8599))[_0xbc95('0xc')](loggerCatch(_0xbc95('0x11')));};exports[_0xbc95('0xb')]=function(_0x5711a1,_0x36db98){create(_0x5711a1)[_0xbc95('0xc')](loggerCatch(_0x36db98));moveContact(_0x5711a1)[_0xbc95('0xc')](loggerCatch(_0x36db98));};exports[_0xbc95('0x12')]=function(_0xf8481a,_0x219e9a){createAgent(_0xf8481a)[_0xbc95('0xc')](loggerCatch(_0x219e9a));};exports[_0xbc95('0x13')]=function(_0x37ef2d,_0x2ce0ef){create(_0x37ef2d)['catch'](loggerCatch(_0x2ce0ef));};exports[_0xbc95('0x14')]=function(_0x4d7032,_0x1c0021){moveContact(_0x4d7032)['catch'](loggerCatch(_0x1c0021));};exports['rescheduleContact']=function(_0x1c6a3a,_0x403bdd,_0x5be3b0){if(_0x403bdd){_0x1c6a3a['UserId']=null;}if(_0x5be3b0){_0x1c6a3a[_0xbc95('0x15')]=![];}return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper[_0xbc95('0x16')](_0x1c6a3a))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xbc95('0x17')]=function(_0x1fee7f){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper[_0xbc95('0x17')](_0x1fee7f))[_0xbc95('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0xbc95('0x18')]=function(_0x413f41){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper[_0xbc95('0x18')]({'UserId':null},_0x413f41,0x1))['catch'](loggerCatch(_0xbc95('0x19')));};exports[_0xbc95('0x1a')]=function(_0x19f861){return BPromise[_0xbc95('0x9')]()['then'](cmHopper['unlockContact']({'active':![]},_0x19f861,0x1))[_0xbc95('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xbc95('0x1b')]=function(_0xbe623b){var _0x569d4e={};_0x569d4e['type']=_0xbe623b[_0xbc95('0x1c')];_0x569d4e['uniqueid']=_0xbe623b['uniqueid'];_0x569d4e[_0xbc95('0x1d')]=_0xbe623b[_0xbc95('0x1d')];_0x569d4e['calleridname']=_0xbe623b[_0xbc95('0x1e')];_0x569d4e[_0xbc95('0x1f')]=_0xbe623b['queue'];_0x569d4e[_0xbc95('0x20')]=_0xbe623b[_0xbc95('0x21')];_0x569d4e['queuecallerleaveAt']=_0xbe623b['answertime'];_0x569d4e[_0xbc95('0x22')]=0x1;_0x569d4e[_0xbc95('0x23')]=_0xbe623b[_0xbc95('0x24')];_0x569d4e[_0xbc95('0x25')]=_0xbe623b[_0xbc95('0x26')];_0x569d4e[_0xbc95('0x27')]=_0xbc95('0x28');_0x569d4e[_0xbc95('0x29')]=_0xbc95('0x2a');_0x569d4e['holdtime']=0x0;_0x569d4e[_0xbc95('0x2b')]=0x1;_0x569d4e[_0xbc95('0x2c')]=_0xbe623b[_0xbc95('0x26')];_0x569d4e[_0xbc95('0x2d')]=_0xbc95('0x2e');return BPromise[_0xbc95('0x9')]()['then'](voiceQueueReport[_0xbc95('0x2f')](_0x569d4e))[_0xbc95('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xbc95('0x30')]=function(_0x33117c,_0x57a562){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper[_0xbc95('0x30')](_0x33117c,_0x57a562))[_0xbc95('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xbc95('0x31')]=function(_0x330733){return BPromise[_0xbc95('0x9')]()[_0xbc95('0xa')](cmHopper[_0xbc95('0x16')](_0x330733,!![],!![]))[_0xbc95('0xc')](loggerCatch(_0xbc95('0x32')));}; \ 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 fbbe50c..ebe960f 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 _0x2a33=['xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','logger','info','inspect','loggerError','logger2','isUndefined','string','\x22%s\x22\x20<%s>','format','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','logCustomer','endtime','answertime','isFailure','Failure','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','buildAcw','interface','agentReadyId','not_inuse','reachable','push','getDiff','CampaignId','idContact','type','campaigntype','dialAnswer','calleridname','callback','callbackat','recallme','UserId','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel'];(function(_0x2f9fc8,_0x332559){var _0x3659da=function(_0x5bcf2d){while(--_0x5bcf2d){_0x2f9fc8['push'](_0x2f9fc8['shift']());}};_0x3659da(++_0x332559);}(_0x2a33,0x9d));var _0x32a3=function(_0x18f6a9,_0x466be4){_0x18f6a9=_0x18f6a9-0x0;var _0x3a7eba=_0x2a33[_0x18f6a9];return _0x3a7eba;};'use strict';var util=require(_0x32a3('0x0'));var _=require('lodash');var moment=require(_0x32a3('0x1'));var logger=require(_0x32a3('0x2'))(_0x32a3('0x3'));var ipAgi=process[_0x32a3('0x4')][_0x32a3('0x5')]||_0x32a3('0x6');function getSeconds(_0x511223,_0x256c3c){var _0x4200bc=moment(_0x511223)[_0x32a3('0x7')](0x0);var _0xcc322a=moment(_0x256c3c)[_0x32a3('0x7')](0x0);return _0x4200bc[_0x32a3('0x8')](_0xcc322a,'seconds');}exports[_0x32a3('0x9')]=function(_0x47c6d9){return function(_0x5b2833){logger[_0x32a3('0xa')](_0x47c6d9,util['inspect'](_0x5b2833,{'showHidden':![],'depth':null}));};};exports[_0x32a3('0xb')]=function(_0x1599f6,_0x329904){logger[_0x32a3('0xc')](_0x1599f6,util[_0x32a3('0xd')](_0x329904,{'showHidden':![],'depth':null}));};exports[_0x32a3('0xe')]=function(_0x570469,_0x52b0a5){logger[_0x32a3('0xa')](_0x570469,util['inspect'](_0x52b0a5,{'showHidden':![],'depth':null}));};exports[_0x32a3('0xf')]=function(_0x1db464){return function(_0x312d66){logger[_0x32a3('0xc')](_0x1db464,util['inspect'](_0x312d66,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1db27c,_0x3a38b8,_0x46051c){return{'message':_0x1db27c,'unlock':_0x3a38b8,'active':_0x46051c};};exports['getCallerId']=function(_0x52aa7d,_0xd893e,_0x32a2fc){if(!_[_0x32a3('0x10')](_0x32a2fc)&&_0x32a3('0x11')===typeof _0x32a2fc&&!_['isEmpty'](_0x32a2fc)){if(!_[_0x32a3('0x10')](_0xd893e)&&_0x32a3('0x11')===typeof _0xd893e&&!_['isEmpty'](_0xd893e)){return util['format'](_0x32a3('0x12'),_0xd893e,_0x32a2fc);}return util[_0x32a3('0x13')](_0x32a3('0x12'),_0x32a2fc,_0x32a2fc);}if(!_[_0x32a3('0x10')](_0x52aa7d)&&'string'===typeof _0x52aa7d&&!_[_0x32a3('0x14')](_0x52aa7d)){return _0x52aa7d;}return _0x32a3('0x15');};exports[_0x32a3('0x16')]=function(_0x273766){if(_[_0x32a3('0x17')](_0x273766)){return![];}return _0x273766;};exports[_0x32a3('0x18')]=function(_0x244ea7,_0x4921c7,_0x23a371,_0xea9fd3,_0x1e9b61,_0x47c4d9){var _0x8a1a09={'XMD-QUEUE':_0x4921c7[_0x32a3('0x19')]?_0x4921c7[_0x32a3('0x19')][_0x32a3('0x1a')]:'','XMD-CALLERID':_0xea9fd3,'XMD-CALLERID-PREVIEW':_0x47c4d9?util[_0x32a3('0x13')](_0x32a3('0x12'),_0x47c4d9['calleridname'],_0x47c4d9[_0x32a3('0x1b')]):_0xea9fd3,'XMD-DIALID':_0x1e9b61,'XMD-CONTACTID':_0x4921c7[_0x32a3('0x1c')],'XMD-CDRTYPE':_0x32a3('0x1d'),'CALLERID(all)':_0xea9fd3,'XMD-VOICEQUEUEID':_0x4921c7['VoiceQueueId'],'XMD-DIALCHANNEL':_0x23a371,'XMD-DIALTIMEOUT':_0x244ea7[_0x32a3('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x32a3('0x13')](_0x32a3('0x1f'),_0x244ea7[_0x32a3('0x20')]?'g':'',_['isEmpty'](_0x244ea7[_0x32a3('0x21')])?'':_0x32a3('0x22')),'XMD-DIALURL':_0x244ea7[_0x32a3('0x23')]||'','XMD-AGI':_0x244ea7[_0x32a3('0x24')]?util[_0x32a3('0x13')](_0x32a3('0x25'),ipAgi,_0x244ea7[_0x32a3('0x24')]):'NONE','XMD-AGIAFTER':_0x244ea7[_0x32a3('0x20')]?util['format'](_0x32a3('0x25'),ipAgi,_0x244ea7[_0x32a3('0x20')]):_0x32a3('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x47c4d9?_0x47c4d9[_0x32a3('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x47c4d9?_0x47c4d9['originatecalleridname']:'','XMD-DESTINATION':_0x32a3('0x28')};if(!_[_0x32a3('0x14')](_0x244ea7[_0x32a3('0x21')])){_0x8a1a09[util[_0x32a3('0x13')]('%s',_0x32a3('0x29'))]=_0x244ea7[_0x32a3('0x21')];_0x8a1a09[util['format']('%s',_0x32a3('0x2a'))]=_0x1e9b61;}if(_0x4921c7&&_0x4921c7[_0x32a3('0x2b')]){for(var _0x6c8464 in _0x4921c7[_0x32a3('0x2b')]){if(_0x4921c7[_0x32a3('0x2b')]['hasOwnProperty'](_0x6c8464)){if(!_[_0x32a3('0x17')](_0x4921c7[_0x32a3('0x2b')][_0x6c8464])&&_0x6c8464!=='id'&&_0x6c8464!==_0x32a3('0x2c')&&_0x6c8464!==_0x32a3('0x2d')&&_0x6c8464!==_0x32a3('0x2e')){_0x8a1a09[util[_0x32a3('0x13')](_0x32a3('0x2f'),'XMD-',_[_0x32a3('0x30')](_0x6c8464))]=_0x4921c7[_0x32a3('0x2b')][_0x6c8464];}}}}return _0x8a1a09;};exports[_0x32a3('0x31')]=function(_0x4ff113){var _0x2671a4={};for(var _0x2bd302 in _0x4ff113){if(_0x4ff113[_0x32a3('0x32')](_0x2bd302)){_0x2671a4[util[_0x32a3('0x13')]('%s',_[_0x32a3('0x33')](_0x2bd302))]=_0x4ff113[_0x2bd302];}}return{'variables':_0x2671a4};};exports['updateOriginated']=function(_0x5edfb9,_0x36f4a0){if(!_[_0x32a3('0x17')](_0x5edfb9)){if(_0x5edfb9['hasOwnProperty']('originated')){if(_0x5edfb9['originated']>0x0){_0x5edfb9['originated']-=0x1;}else{logger[_0x32a3('0xa')](_0x32a3('0x34'),_0x36f4a0);}}}else{logger[_0x32a3('0xa')](_0x32a3('0x35'),_0x36f4a0);}};exports[_0x32a3('0x36')]=function(_0x3bc02a){var _0x1dab24=moment()[_0x32a3('0x13')](_0x32a3('0x37'));_0x3bc02a[_0x32a3('0x38')]=0xd;_0x3bc02a[_0x32a3('0x39')]=_0x32a3('0x3a');_0x3bc02a[_0x32a3('0x3b')]=_0x1dab24;_0x3bc02a[_0x32a3('0x3c')]=_0x1dab24;_0x3bc02a['endtime']=_0x1dab24;};exports[_0x32a3('0x3d')]=function(_0x3c5ad4,_0x98815f,_0x524c32){var _0x3721eb=moment()[_0x32a3('0x13')](_0x32a3('0x37'));_0x3c5ad4[_0x32a3('0x38')]=_0x98815f;_0x3c5ad4[_0x32a3('0x39')]=_0x524c32;_0x3c5ad4[_0x32a3('0x3c')]=_0x3721eb;_0x3c5ad4[_0x32a3('0x3e')]=getSeconds(_0x3c5ad4[_0x32a3('0x3c')],_0x3c5ad4[_0x32a3('0x3b')]);};exports[_0x32a3('0x3f')]=function(_0x40e8d2,_0x51957f,_0x16f8f0){_0x40e8d2[_0x32a3('0x40')]=_0x51957f;_0x40e8d2['UserId']=_0x16f8f0;};exports[_0x32a3('0x41')]=function(_0x3253e2,_0x2f8402,_0x410464){var _0x44a36d=moment()[_0x32a3('0x13')](_0x32a3('0x37'));_0x3253e2[_0x32a3('0x38')]=_0x2f8402;_0x3253e2[_0x32a3('0x39')]=_0x410464;_0x3253e2[_0x32a3('0x3c')]=_0x3253e2[_0x32a3('0x3c')]?_0x3253e2['responsetime']:_0x44a36d;_0x3253e2[_0x32a3('0x42')]=_0x3253e2[_0x32a3('0x42')]?_0x3253e2[_0x32a3('0x42')]:_0x44a36d;_0x3253e2['ringtime']=getSeconds(_0x3253e2[_0x32a3('0x3c')]||0x0,_0x3253e2[_0x32a3('0x3b')]||0x0);_0x3253e2['talktime']=_0x3253e2['answertime']?getSeconds(_0x3253e2[_0x32a3('0x42')],_0x3253e2[_0x32a3('0x43')]):0x0;};exports[_0x32a3('0x44')]=function(_0x4fe1f6){return _0x4fe1f6===_0x32a3('0x45');};exports['variablesAction']=function(_0x218cc0,_0x12f1d1,_0x57a45d,_0x477b89,_0x13d026){var _0x1f1a83=_0x477b89?'RECALL':_0x218cc0['calleridname'];_0x1f1a83=_0x13d026?_0x32a3('0x46'):_0x1f1a83;return{'actionid':_0x218cc0[_0x32a3('0x47')],'action':_0x32a3('0x48'),'channel':_0x218cc0[_0x32a3('0x49')],'callerid':util['format'](_0x32a3('0x12'),_0x1f1a83,_0x218cc0['calleridnum']),'Exten':_0x32a3('0x28'),'Context':_0x32a3('0x4a'),'Priority':'1','variable':_0x57a45d,'timeout':(_0x12f1d1[_0x32a3('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x218cc0[_0x32a3('0x47')]};};exports[_0x32a3('0x4c')]=function(_0x8d7d30){return _0x8d7d30[_0x32a3('0x4d')]+_0x8d7d30[_0x32a3('0x4e')]+_0x8d7d30[_0x32a3('0x4f')];};exports[_0x32a3('0x50')]=function(_0x68b439){var _0x57ccca=_[_0x32a3('0x51')](_0x68b439);_0x57ccca[_0x32a3('0x38')]=0xf;_0x57ccca[_0x32a3('0x39')]=_0x32a3('0x52');return _0x57ccca;};exports[_0x32a3('0x53')]=function(_0x55ba3c,_0xb8280b,_0xbffe55){var _0x29f89a={};_0x29f89a[_0xb8280b]=_0x55ba3c[_0xb8280b];_0x29f89a[_0x32a3('0x54')]=![];_0x29f89a[_0x32a3('0x55')]=moment()['add'](_0xbffe55,_0x32a3('0x56'))['format'](_0x32a3('0x37'));_0x29f89a['ContactId']=_0x55ba3c[_0x32a3('0x1c')];_0x29f89a[_0x32a3('0x57')]=_0x55ba3c['ListId'];_0x29f89a['VoiceQueueId']=_0x55ba3c[_0x32a3('0x58')]||undefined;return _0x29f89a;};exports[_0x32a3('0x59')]=function(_0x125e4d,_0x2fda37){if(!_[_0x32a3('0x17')](_0x125e4d)){if(_0x125e4d['pTalking']>0x0){_0x125e4d[_0x32a3('0x5a')]-=0x1;}else{logger[_0x32a3('0xa')](_0x2fda37,_0x32a3('0x5b'));}}else{logger[_0x32a3('0xa')](_0x2fda37,_0x32a3('0x5c'));}};exports[_0x32a3('0x5d')]=function(_0x2e01cb){if(_0x2e01cb<=0x0){return!![];}return![];};exports['buildObj']=function(_0x8b15b4,_0x1c26e2){_0x8b15b4[_0x32a3('0x5e')]=_0x1c26e2;_0x8b15b4[_0x32a3('0x1a')]=_0x8b15b4[_0x32a3('0x5f')];_0x8b15b4['interface']=_0x8b15b4[_0x32a3('0x49')];return _0x8b15b4;};exports[_0x32a3('0x60')]=function(_0x3e8ec3){var _0x1289f9={};_0x1289f9[_0x32a3('0x5f')]=_0x3e8ec3[_0x32a3('0x5f')];_0x1289f9[_0x32a3('0x61')]=_0x3e8ec3[_0x32a3('0x49')];_0x1289f9[_0x32a3('0x47')]=_0x3e8ec3[_0x32a3('0x47')];return _0x1289f9;};exports[_0x32a3('0x62')]=function(_0x332656){var _0x42fc86=[];for(var _0x5d06d7 in _0x332656){if(_0x332656[_0x32a3('0x32')](_0x5d06d7)){if(!_[_0x32a3('0x17')](_0x332656[_0x5d06d7])&&_0x332656[_0x5d06d7][_0x32a3('0x38')]===_0x32a3('0x63')&&_0x332656[_0x5d06d7]['status']===_0x32a3('0x64')){_0x42fc86[_0x32a3('0x65')](_0x332656[_0x5d06d7]['id']);}}}return _0x42fc86;};exports[_0x32a3('0x66')]=function(_0x3f8f35){var _0x5b6ccc=moment()[_0x32a3('0x7')](0x0);var _0x3b1e41=moment(_0x3f8f35)[_0x32a3('0x7')](0x0);return _0x5b6ccc[_0x32a3('0x8')](_0x3b1e41,'seconds');};exports['createBody']=function(_0x17d8fc){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x17d8fc[_0x32a3('0x1c')],'ListId':_0x17d8fc['ListId'],'VoiceQueueId':_0x17d8fc[_0x32a3('0x58')]||undefined,'CampaignId':_0x17d8fc[_0x32a3('0x67')]||undefined};};exports['filterKey']=function(_0x1ba4a7){if(_0x1ba4a7===_0x32a3('0x47')||_0x1ba4a7===_0x32a3('0x68')||_0x1ba4a7==='queue'||_0x1ba4a7===_0x32a3('0x69')||_0x1ba4a7===_0x32a3('0x6a')||_0x1ba4a7===_0x32a3('0x6b')||_0x1ba4a7===_0x32a3('0x40')||_0x1ba4a7==='channelAgent'||_0x1ba4a7===_0x32a3('0x6c')||_0x1ba4a7===_0x32a3('0x54')||_0x1ba4a7==='calleridnum'||_0x1ba4a7===_0x32a3('0x55')||_0x1ba4a7===_0x32a3('0x4d')||_0x1ba4a7===_0x32a3('0x4e')||_0x1ba4a7==='countnoanswerretry'||_0x1ba4a7==='countglobal'||_0x1ba4a7===_0x32a3('0x6d')||_0x1ba4a7==='callbackuniqueid'||_0x1ba4a7===_0x32a3('0x6e')||_0x1ba4a7===_0x32a3('0x6f')||_0x1ba4a7===_0x32a3('0x1c')||_0x1ba4a7===_0x32a3('0x57')||_0x1ba4a7===_0x32a3('0x70')||_0x1ba4a7==='VoiceQueueId'||_0x1ba4a7==='sipcallid'||_0x1ba4a7==='xmd-voicequeueid'||_0x1ba4a7===_0x32a3('0x71')||_0x1ba4a7==='xmd-phone'||_0x1ba4a7===_0x32a3('0x72')||_0x1ba4a7===_0x32a3('0x73')||_0x1ba4a7==='xmd-dialtimeout'||_0x1ba4a7===_0x32a3('0x74')||_0x1ba4a7===_0x32a3('0x75')||_0x1ba4a7===_0x32a3('0x76')||_0x1ba4a7==='xmd-contactid'||_0x1ba4a7==='xmd-cdrtype'||_0x1ba4a7===_0x32a3('0x77')||_0x1ba4a7===_0x32a3('0x78')||_0x1ba4a7===_0x32a3('0x79')||_0x1ba4a7==='rtpaudioqos'||_0x1ba4a7===_0x32a3('0x7a')||_0x1ba4a7==='rtpaudioqosjitter'||_0x1ba4a7==='rtpaudioqosjitterbridged'||_0x1ba4a7===_0x32a3('0x7b')||_0x1ba4a7===_0x32a3('0x7c')||_0x1ba4a7==='rtpaudioqosrtt'||_0x1ba4a7==='rtpaudioqosrttbridged'||_0x1ba4a7==='rtpaudioqos'||_0x1ba4a7===_0x32a3('0x7a')||_0x1ba4a7===_0x32a3('0x7d')||_0x1ba4a7===_0x32a3('0x7e')||_0x1ba4a7===_0x32a3('0x7b')||_0x1ba4a7===_0x32a3('0x7c')||_0x1ba4a7==='rtpaudioqosrtt'||_0x1ba4a7===_0x32a3('0x7f')||_0x1ba4a7===_0x32a3('0x80')||_0x1ba4a7===_0x32a3('0x81')||_0x1ba4a7===_0x32a3('0x38')||_0x1ba4a7===_0x32a3('0x39')){return![];}return!![];};exports[_0x32a3('0x82')]=function(_0x3ffd70,_0x321dff){var _0x3bb6d5,_0x3e107b,_0x27b47a;if(_0x321dff<=0x0){_0x321dff=0x1;}_0x3bb6d5=new RegExp(_0x32a3('0x83')+_0x321dff+'}$');_0x3e107b=Math[_0x32a3('0x84')](0xa,_0x321dff-0x1);_0x27b47a=Math[_0x32a3('0x84')](0xa,_0x321dff)-0x1;return util[_0x32a3('0x13')]('%s',_[_0x32a3('0x85')](_0x3ffd70,_0x3bb6d5,_[_0x32a3('0x86')](_0x3e107b,_0x27b47a)));};exports[_0x32a3('0x87')]=function(_0x23c879){var _0x278cbb=_0x23c879['match'](/"(.*?)"/);return _0x278cbb?_0x278cbb[0x1]:_0x23c879;};exports[_0x32a3('0x88')]=function(_0x438be5){var _0x3f312d=_0x438be5[_0x32a3('0x89')](/<(.*?)>/);return _0x3f312d?_0x3f312d[0x1]:_0x438be5;}; \ No newline at end of file +var _0xaef0=['toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ContactId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','buildAcw','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','pow','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','diff','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-'];(function(_0x27f574,_0x3ef4da){var _0x14e3ab=function(_0x13e374){while(--_0x13e374){_0x27f574['push'](_0x27f574['shift']());}};_0x14e3ab(++_0x3ef4da);}(_0xaef0,0x172));var _0x0aef=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xaef0[_0x57add2];return _0x4e3670;};'use strict';var util=require('util');var _=require(_0x0aef('0x0'));var moment=require(_0x0aef('0x1'));var logger=require(_0x0aef('0x2'))(_0x0aef('0x3'));var ipAgi=process['env'][_0x0aef('0x4')]||_0x0aef('0x5');function getSeconds(_0x4cd232,_0x5e9e6e){var _0x2c11ab=moment(_0x4cd232)['milliseconds'](0x0);var _0x3cbd65=moment(_0x5e9e6e)['milliseconds'](0x0);return _0x2c11ab[_0x0aef('0x6')](_0x3cbd65,'seconds');}exports[_0x0aef('0x7')]=function(_0x17cac7){return function(_0x1f7526){logger[_0x0aef('0x8')](_0x17cac7,util[_0x0aef('0x9')](_0x1f7526,{'showHidden':![],'depth':null}));};};exports[_0x0aef('0xa')]=function(_0x313284,_0x320e5b){logger['info'](_0x313284,util[_0x0aef('0x9')](_0x320e5b,{'showHidden':![],'depth':null}));};exports[_0x0aef('0xb')]=function(_0x346a48,_0x574eab){logger['error'](_0x346a48,util[_0x0aef('0x9')](_0x574eab,{'showHidden':![],'depth':null}));};exports[_0x0aef('0xc')]=function(_0x1efacb){return function(_0x42511b){logger[_0x0aef('0xd')](_0x1efacb,util['inspect'](_0x42511b,{'showHidden':![],'depth':null}));};};exports[_0x0aef('0xe')]=function(_0x2fabae,_0x44ab54,_0x1ef7a7){return{'message':_0x2fabae,'unlock':_0x44ab54,'active':_0x1ef7a7};};exports['getCallerId']=function(_0xfa3ab,_0x2d12b7,_0x591a89){if(!_['isUndefined'](_0x591a89)&&_0x0aef('0xf')===typeof _0x591a89&&!_['isEmpty'](_0x591a89)){if(!_['isUndefined'](_0x2d12b7)&&_0x0aef('0xf')===typeof _0x2d12b7&&!_[_0x0aef('0x10')](_0x2d12b7)){return util[_0x0aef('0x11')](_0x0aef('0x12'),_0x2d12b7,_0x591a89);}return util[_0x0aef('0x11')](_0x0aef('0x12'),_0x591a89,_0x591a89);}if(!_[_0x0aef('0x13')](_0xfa3ab)&&_0x0aef('0xf')===typeof _0xfa3ab&&!_[_0x0aef('0x10')](_0xfa3ab)){return _0xfa3ab;}return _0x0aef('0x14');};exports[_0x0aef('0x15')]=function(_0x50501f){if(_[_0x0aef('0x16')](_0x50501f)){return![];}return _0x50501f;};exports['addVariables']=function(_0x2a2249,_0x5da05e,_0x4d7e83,_0x1844a3,_0x10f625,_0x59357a){var _0x2cd78b={'XMD-QUEUE':_0x5da05e[_0x0aef('0x17')]?_0x5da05e[_0x0aef('0x17')][_0x0aef('0x18')]:'','XMD-CALLERID':_0x1844a3,'XMD-CALLERID-PREVIEW':_0x59357a?util[_0x0aef('0x11')](_0x0aef('0x12'),_0x59357a[_0x0aef('0x19')],_0x59357a[_0x0aef('0x1a')]):_0x1844a3,'XMD-DIALID':_0x10f625,'XMD-CONTACTID':_0x5da05e['ContactId'],'XMD-CDRTYPE':_0x0aef('0x1b'),'CALLERID(all)':_0x1844a3,'XMD-VOICEQUEUEID':_0x5da05e[_0x0aef('0x1c')],'XMD-DIALCHANNEL':_0x4d7e83,'XMD-DIALTIMEOUT':_0x2a2249['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x0aef('0x11')]('\x22rtTxX%s%s\x22',_0x2a2249[_0x0aef('0x1d')]?'g':'',_[_0x0aef('0x10')](_0x2a2249[_0x0aef('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2a2249[_0x0aef('0x1f')]||'','XMD-AGI':_0x2a2249[_0x0aef('0x20')]?util['format'](_0x0aef('0x21'),ipAgi,_0x2a2249[_0x0aef('0x20')]):_0x0aef('0x22'),'XMD-AGIAFTER':_0x2a2249[_0x0aef('0x1d')]?util[_0x0aef('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2a2249[_0x0aef('0x1d')]):_0x0aef('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x59357a?_0x59357a[_0x0aef('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x59357a?_0x59357a[_0x0aef('0x24')]:'','XMD-DESTINATION':_0x0aef('0x25')};if(!_[_0x0aef('0x10')](_0x2a2249[_0x0aef('0x1e')])){_0x2cd78b[util[_0x0aef('0x11')]('%s',_0x0aef('0x26'))]=_0x2a2249[_0x0aef('0x1e')];_0x2cd78b[util[_0x0aef('0x11')]('%s',_0x0aef('0x27'))]=_0x10f625;}if(_0x5da05e&&_0x5da05e[_0x0aef('0x28')]){for(var _0x58b708 in _0x5da05e[_0x0aef('0x28')]){if(_0x5da05e['Contact'][_0x0aef('0x29')](_0x58b708)){if(!_[_0x0aef('0x16')](_0x5da05e[_0x0aef('0x28')][_0x58b708])&&_0x58b708!=='id'&&_0x58b708!==_0x0aef('0x2a')&&_0x58b708!==_0x0aef('0x2b')&&_0x58b708!==_0x0aef('0x2c')){_0x2cd78b[util[_0x0aef('0x11')](_0x0aef('0x2d'),_0x0aef('0x2e'),_[_0x0aef('0x2f')](_0x58b708))]=_0x5da05e[_0x0aef('0x28')][_0x58b708];}}}}return _0x2cd78b;};exports[_0x0aef('0x30')]=function(_0x12ec0c){var _0x7f1b81={};for(var _0x15daea in _0x12ec0c){if(_0x12ec0c[_0x0aef('0x29')](_0x15daea)){_0x7f1b81[util[_0x0aef('0x11')]('%s',_[_0x0aef('0x31')](_0x15daea))]=_0x12ec0c[_0x15daea];}}return{'variables':_0x7f1b81};};exports[_0x0aef('0x32')]=function(_0x167a48,_0x3c3c6e){if(!_[_0x0aef('0x16')](_0x167a48)){if(_0x167a48['hasOwnProperty'](_0x0aef('0x33'))){if(_0x167a48['originated']>0x0){_0x167a48[_0x0aef('0x33')]-=0x1;}else{logger[_0x0aef('0x8')](_0x0aef('0x34'),_0x3c3c6e);}}}else{logger[_0x0aef('0x8')](_0x0aef('0x35'),_0x3c3c6e);}};exports['logBlacklist']=function(_0x568fce){var _0x33b845=moment()[_0x0aef('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x568fce[_0x0aef('0x36')]=0xd;_0x568fce[_0x0aef('0x37')]='Blacklist';_0x568fce[_0x0aef('0x38')]=_0x33b845;_0x568fce[_0x0aef('0x39')]=_0x33b845;_0x568fce['endtime']=_0x33b845;};exports['logAgent']=function(_0xdcdb3f,_0x5e879a,_0x1adc12){var _0xa9bad6=moment()[_0x0aef('0x11')](_0x0aef('0x3a'));_0xdcdb3f['state']=_0x5e879a;_0xdcdb3f[_0x0aef('0x37')]=_0x1adc12;_0xdcdb3f[_0x0aef('0x39')]=_0xa9bad6;_0xdcdb3f[_0x0aef('0x3b')]=getSeconds(_0xdcdb3f[_0x0aef('0x39')],_0xdcdb3f[_0x0aef('0x38')]);};exports[_0x0aef('0x3c')]=function(_0x11bcd7,_0x4ba25d,_0x27d0bf){_0x11bcd7[_0x0aef('0x3d')]=_0x4ba25d;_0x11bcd7[_0x0aef('0x3e')]=_0x27d0bf;};exports[_0x0aef('0x3f')]=function(_0x314706,_0x50d8bf,_0x5c4e22){var _0x3f9693=moment()[_0x0aef('0x11')](_0x0aef('0x3a'));_0x314706[_0x0aef('0x36')]=_0x50d8bf;_0x314706[_0x0aef('0x37')]=_0x5c4e22;_0x314706[_0x0aef('0x39')]=_0x314706[_0x0aef('0x39')]?_0x314706[_0x0aef('0x39')]:_0x3f9693;_0x314706['endtime']=_0x314706[_0x0aef('0x40')]?_0x314706[_0x0aef('0x40')]:_0x3f9693;_0x314706[_0x0aef('0x3b')]=getSeconds(_0x314706[_0x0aef('0x39')]||0x0,_0x314706[_0x0aef('0x38')]||0x0);_0x314706[_0x0aef('0x41')]=_0x314706[_0x0aef('0x42')]?getSeconds(_0x314706['endtime'],_0x314706[_0x0aef('0x42')]):0x0;};exports[_0x0aef('0x43')]=function(_0x10fcca){return _0x10fcca===_0x0aef('0x44');};exports['variablesAction']=function(_0x2011fb,_0x4c3429,_0x3c902f,_0x2f4b86,_0x415d54){var _0x46ec8b=_0x2f4b86?'RECALL':_0x2011fb[_0x0aef('0x19')];_0x46ec8b=_0x415d54?_0x0aef('0x45'):_0x46ec8b;return{'actionid':_0x2011fb[_0x0aef('0x46')],'action':_0x0aef('0x47'),'channel':_0x2011fb[_0x0aef('0x48')],'callerid':util[_0x0aef('0x11')](_0x0aef('0x12'),_0x46ec8b,_0x2011fb[_0x0aef('0x1a')]),'Exten':'xcally-motion-preview','Context':_0x0aef('0x49'),'Priority':'1','variable':_0x3c902f,'timeout':(_0x4c3429['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2011fb[_0x0aef('0x46')]};};exports['totalGlobal']=function(_0x16ded7){return _0x16ded7[_0x0aef('0x4a')]+_0x16ded7[_0x0aef('0x4b')]+_0x16ded7[_0x0aef('0x4c')];};exports[_0x0aef('0x4d')]=function(_0x1613c7){var _0x3cc986=_['clone'](_0x1613c7);_0x3cc986[_0x0aef('0x36')]=0xf;_0x3cc986['statedesc']=_0x0aef('0x4e');return _0x3cc986;};exports[_0x0aef('0x4f')]=function(_0x214b4e,_0x735218,_0x48a577){var _0x296dac={};_0x296dac[_0x735218]=_0x214b4e[_0x735218];_0x296dac[_0x0aef('0x50')]=![];_0x296dac[_0x0aef('0x51')]=moment()[_0x0aef('0x52')](_0x48a577,'minutes')['format'](_0x0aef('0x3a'));_0x296dac[_0x0aef('0x53')]=_0x214b4e[_0x0aef('0x53')];_0x296dac['ListId']=_0x214b4e['ListId'];_0x296dac[_0x0aef('0x1c')]=_0x214b4e[_0x0aef('0x1c')]||undefined;return _0x296dac;};exports[_0x0aef('0x54')]=function(_0x23f739,_0x3465eb){if(!_['isNil'](_0x23f739)){if(_0x23f739['pTalking']>0x0){_0x23f739[_0x0aef('0x55')]-=0x1;}else{logger[_0x0aef('0x8')](_0x3465eb,_0x0aef('0x56'));}}else{logger['error'](_0x3465eb,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x0aef('0x57')]=function(_0x33d2f6){if(_0x33d2f6<=0x0){return!![];}return![];};exports[_0x0aef('0x58')]=function(_0x31c2f9,_0x38c4ea){_0x31c2f9[_0x0aef('0x59')]=_0x38c4ea;_0x31c2f9['name']=_0x31c2f9[_0x0aef('0x5a')];_0x31c2f9[_0x0aef('0x5b')]=_0x31c2f9[_0x0aef('0x48')];return _0x31c2f9;};exports[_0x0aef('0x5c')]=function(_0x18fc40){var _0x14e137={};_0x14e137[_0x0aef('0x5a')]=_0x18fc40['queue'];_0x14e137[_0x0aef('0x5b')]=_0x18fc40[_0x0aef('0x48')];_0x14e137[_0x0aef('0x46')]=_0x18fc40[_0x0aef('0x46')];return _0x14e137;};exports['agentReadyId']=function(_0x2bf6fe){var _0x4dd4c0=[];for(var _0x54a60b in _0x2bf6fe){if(_0x2bf6fe[_0x0aef('0x29')](_0x54a60b)){if(!_[_0x0aef('0x16')](_0x2bf6fe[_0x54a60b])&&_0x2bf6fe[_0x54a60b][_0x0aef('0x36')]===_0x0aef('0x5d')&&_0x2bf6fe[_0x54a60b][_0x0aef('0x5e')]===_0x0aef('0x5f')){_0x4dd4c0[_0x0aef('0x60')](_0x2bf6fe[_0x54a60b]['id']);}}}return _0x4dd4c0;};exports[_0x0aef('0x61')]=function(_0x2bad03){var _0x1f0ad8=moment()[_0x0aef('0x62')](0x0);var _0x38acec=moment(_0x2bad03)[_0x0aef('0x62')](0x0);return _0x1f0ad8[_0x0aef('0x6')](_0x38acec,_0x0aef('0x63'));};exports[_0x0aef('0x64')]=function(_0x1b4996){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b4996[_0x0aef('0x53')],'ListId':_0x1b4996['ListId'],'VoiceQueueId':_0x1b4996[_0x0aef('0x1c')]||undefined,'CampaignId':_0x1b4996[_0x0aef('0x65')]||undefined};};exports[_0x0aef('0x66')]=function(_0x54feb6){if(_0x54feb6===_0x0aef('0x46')||_0x54feb6===_0x0aef('0x67')||_0x54feb6==='queue'||_0x54feb6==='type'||_0x54feb6===_0x0aef('0x68')||_0x54feb6===_0x0aef('0x69')||_0x54feb6===_0x0aef('0x3d')||_0x54feb6==='channelAgent'||_0x54feb6===_0x0aef('0x19')||_0x54feb6==='active'||_0x54feb6==='calleridnum'||_0x54feb6===_0x0aef('0x51')||_0x54feb6===_0x0aef('0x4a')||_0x54feb6===_0x0aef('0x4b')||_0x54feb6==='countnoanswerretry'||_0x54feb6===_0x0aef('0x6a')||_0x54feb6===_0x0aef('0x6b')||_0x54feb6===_0x0aef('0x6c')||_0x54feb6===_0x0aef('0x6d')||_0x54feb6===_0x0aef('0x6e')||_0x54feb6===_0x0aef('0x53')||_0x54feb6==='ListId'||_0x54feb6===_0x0aef('0x3e')||_0x54feb6==='VoiceQueueId'||_0x54feb6===_0x0aef('0x6f')||_0x54feb6===_0x0aef('0x70')||_0x54feb6===_0x0aef('0x71')||_0x54feb6===_0x0aef('0x72')||_0x54feb6===_0x0aef('0x73')||_0x54feb6===_0x0aef('0x74')||_0x54feb6===_0x0aef('0x75')||_0x54feb6===_0x0aef('0x76')||_0x54feb6===_0x0aef('0x77')||_0x54feb6===_0x0aef('0x78')||_0x54feb6==='xmd-contactid'||_0x54feb6===_0x0aef('0x79')||_0x54feb6===_0x0aef('0x7a')||_0x54feb6===_0x0aef('0x7b')||_0x54feb6==='xmd-agi'||_0x54feb6===_0x0aef('0x7c')||_0x54feb6===_0x0aef('0x7d')||_0x54feb6===_0x0aef('0x7e')||_0x54feb6==='rtpaudioqosjitterbridged'||_0x54feb6===_0x0aef('0x7f')||_0x54feb6===_0x0aef('0x80')||_0x54feb6===_0x0aef('0x81')||_0x54feb6===_0x0aef('0x82')||_0x54feb6===_0x0aef('0x7c')||_0x54feb6===_0x0aef('0x7d')||_0x54feb6===_0x0aef('0x7e')||_0x54feb6===_0x0aef('0x83')||_0x54feb6===_0x0aef('0x7f')||_0x54feb6==='rtpaudioqoslossbridged'||_0x54feb6===_0x0aef('0x81')||_0x54feb6===_0x0aef('0x82')||_0x54feb6===_0x0aef('0x84')||_0x54feb6==='bridgepvtcallid'||_0x54feb6===_0x0aef('0x36')||_0x54feb6===_0x0aef('0x37')){return![];}return!![];};exports[_0x0aef('0x85')]=function(_0x17b137,_0x4b787c){var _0x4a9190,_0x75c286,_0x7f8e97;if(_0x4b787c<=0x0){_0x4b787c=0x1;}_0x4a9190=new RegExp('\x5cw{0,'+_0x4b787c+'}$');_0x75c286=Math[_0x0aef('0x86')](0xa,_0x4b787c-0x1);_0x7f8e97=Math[_0x0aef('0x86')](0xa,_0x4b787c)-0x1;return util[_0x0aef('0x11')]('%s',_['replace'](_0x17b137,_0x4a9190,_[_0x0aef('0x87')](_0x75c286,_0x7f8e97)));};exports[_0x0aef('0x88')]=function(_0x1b57cd){var _0x2390f3=_0x1b57cd[_0x0aef('0x89')](/"(.*?)"/);return _0x2390f3?_0x2390f3[0x1]:_0x1b57cd;};exports[_0x0aef('0x8a')]=function(_0x16a4c3){var _0x44261d=_0x16a4c3[_0x0aef('0x89')](/<(.*?)>/);return _0x44261d?_0x44261d[0x1]:_0x16a4c3;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index df1b66d..ab4be9b 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 _0xb138=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0xb138,0x1dd));var _0x8b13=function(_0x1e1e30,_0x3705c3){_0x1e1e30=_0x1e1e30-0x0;var _0x4889ff=_0xb138[_0x1e1e30];return _0x4889ff;};'use strict';exports[_0x8b13('0x0')]={'queue':{'type':_0x8b13('0x1'),'required':!![]},'interface':{'type':_0x8b13('0x1'),'required':!![]},'membername':{'type':_0x8b13('0x1'),'required':!![]},'penalty':{'type':_0x8b13('0x2'),'required':![]},'paused':{'type':_0x8b13('0x3'),'required':![]}};exports[_0x8b13('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8b13('0x1'),'required':!![]}};exports[_0x8b13('0x5')]={'interface':{'type':_0x8b13('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x8b13('0x1'),'required':![]}};exports[_0x8b13('0x6')]={'module':{'type':'string','required':![]}};exports[_0x8b13('0x7')]={'uniqueid':{'type':_0x8b13('0x1'),'required':!![]}};exports[_0x8b13('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x8b13('0x1')},'format':{'type':_0x8b13('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x8b13('0x1'),'required':!![]}};exports[_0x8b13('0x9')]={'uniqueid':{'type':_0x8b13('0x1'),'required':!![]},'exten':{'type':_0x8b13('0x1'),'required':!![]},'context':{'type':_0x8b13('0x1')}}; \ No newline at end of file +var _0x12c9=['voicechannel','queueadd','string','number','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x4e9e44,_0x216df1){var _0x3579cb=function(_0xff4459){while(--_0xff4459){_0x4e9e44['push'](_0x4e9e44['shift']());}};_0x3579cb(++_0x216df1);}(_0x12c9,0x1c9));var _0x912c=function(_0x562cb8,_0x15633a){_0x562cb8=_0x562cb8-0x0;var _0x193ab0=_0x12c9[_0x562cb8];return _0x193ab0;};'use strict';exports[_0x912c('0x0')]={'queue':{'type':_0x912c('0x1'),'required':!![]},'interface':{'type':_0x912c('0x1'),'required':!![]},'membername':{'type':_0x912c('0x1'),'required':!![]},'penalty':{'type':_0x912c('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x912c('0x3')]={'queue':{'type':_0x912c('0x1'),'required':!![]},'interface':{'type':_0x912c('0x1'),'required':!![]}};exports[_0x912c('0x4')]={'interface':{'type':_0x912c('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x912c('0x5')]={'module':{'type':_0x912c('0x1'),'required':![]}};exports[_0x912c('0x6')]={'uniqueid':{'type':_0x912c('0x1'),'required':!![]}};exports[_0x912c('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x912c('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x912c('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x912c('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x912c('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x912c('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index bba4444..62af626 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 _0x9dc3=['mapKeys','hasOwnProperty','format','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','SIP/%s','isUndefined','initTrunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','outbound','ANSWERED','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts'];(function(_0x3698bb,_0x2fbe68){var _0x15aabc=function(_0xe395f8){while(--_0xe395f8){_0x3698bb['push'](_0x3698bb['shift']());}};_0x15aabc(++_0x2fbe68);}(_0x9dc3,0xa5));var _0x39dc=function(_0x4b8340,_0x19c2dd){_0x4b8340=_0x4b8340-0x0;var _0x3caa28=_0x9dc3[_0x4b8340];return _0x3caa28;};'use strict';var BPromise=require(_0x39dc('0x0'));var util=require(_0x39dc('0x1'));var _=require(_0x39dc('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x39dc('0x3'));var Trunk=require(_0x39dc('0x4'));var VoiceQueue=require(_0x39dc('0x5'));var Trigger=require(_0x39dc('0x6'));var Template=require(_0x39dc('0x7'));var Campaign=require(_0x39dc('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x39dc('0x9'));var SalesforceAccount=require(_0x39dc('0xa'));var FreshdeskAccount=require(_0x39dc('0xb'));var SugarcrmAccount=require(_0x39dc('0xc'));var ZohoAccount=require(_0x39dc('0xd'));var DeskAccount=require(_0x39dc('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FaxAccount=require(_0x39dc('0xf'));var Realtime=function(){this[_0x39dc('0x10')]={};this[_0x39dc('0x11')]={};this[_0x39dc('0x12')]={};this[_0x39dc('0x13')]={};this[_0x39dc('0x14')]={};this[_0x39dc('0x15')]={};this[_0x39dc('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x39dc('0x17')]={};this[_0x39dc('0x18')]={};this[_0x39dc('0x19')]={};this[_0x39dc('0x1a')]={};this['timers']={};this[_0x39dc('0x1b')]={};this[_0x39dc('0x1c')]={};this[_0x39dc('0x1d')]={};this['freshdeskAccounts']={};this[_0x39dc('0x1e')]={};this[_0x39dc('0x1f')]={};this[_0x39dc('0x20')]={};this[_0x39dc('0x21')]={};this[_0x39dc('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x3f2265,_0x286350,_0x258601){var _0xc60a99=_[_0x39dc('0x23')](_0x3f2265,function(_0x1ecb04,_0x14ede6){return _0x1ecb04[_0x258601];});for(var _0x489b4d in _0x286350){if(_0x286350[_0x39dc('0x24')](_0x489b4d)){if(!_0xc60a99[_0x489b4d]){delete _0x286350[_0x489b4d];}}}}function freeIsNotKeySip(_0x41e960,_0x5690a8){var _0x4ef125=_[_0x39dc('0x23')](_0x41e960,function(_0x11fb9b,_0x364e97){return util[_0x39dc('0x25')]('SIP/%s',_0x11fb9b[_0x39dc('0x26')]);});for(var _0x4bee78 in _0x5690a8){if(_0x5690a8['hasOwnProperty'](_0x4bee78)){if(!_0x4ef125[_0x4bee78]){delete _0x5690a8[_0x4bee78];}}}}function freeIsNotKeyAgent(_0x25c951,_0x1acf94){var _0x371bea=_[_0x39dc('0x23')](_0x25c951,function(_0x40ec77,_0xaebd68){var _0x43920e=_[_0x39dc('0x27')](_0x40ec77['interface'])?util[_0x39dc('0x25')]('SIP/%s',_0x40ec77[_0x39dc('0x26')]):_0x40ec77[_0x39dc('0x28')];return _0x43920e;});for(var _0x5c124c in _0x1acf94){if(_0x1acf94[_0x39dc('0x24')](_0x5c124c)){if(!_0x371bea[_0x5c124c]){delete _0x1acf94[_0x5c124c];}}}}function clearVoiceCallReports(_0x1509a3){_0x1509a3[_0x39dc('0x29')]=0x0;_0x1509a3[_0x39dc('0x2a')]=0x0;_0x1509a3[_0x39dc('0x2b')]=0x0;_0x1509a3[_0x39dc('0x2c')]=0x0;_0x1509a3[_0x39dc('0x2d')]=0x0;}function clearCampaigns(_0xaeb89){if(!_['isEmpty'](_0xaeb89)){for(var _0x485e9f in _0xaeb89){if(_0xaeb89['hasOwnProperty'](_0x485e9f)){_0xaeb89[_0x485e9f]['ivrTotalCallsDays']=0x0;_0xaeb89[_0x485e9f][_0x39dc('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x51adc9){if(!_[_0x39dc('0x2f')](_0x51adc9)){for(var _0x1fb03b in _0x51adc9){if(_0x51adc9[_0x39dc('0x24')](_0x1fb03b)){_0x51adc9[_0x1fb03b][_0x39dc('0x29')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x2a')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x30')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x31')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x2b')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x2c')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x2d')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x32')]=0x0;_0x51adc9[_0x1fb03b]['outboundNoAnswerCallsDay']=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x33')]=0x0;_0x51adc9[_0x1fb03b]['outboundCongestionCallsDay']=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x34')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x35')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x36')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x37')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x38')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x39')]=0x0;_0x51adc9[_0x1fb03b]['outboundRejectCallsDay']=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x3a')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x32')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x3b')]=0x0;_0x51adc9[_0x1fb03b][_0x39dc('0x3c')]=!![];}}}}Realtime[_0x39dc('0x3d')][_0x39dc('0x3e')]=function(_0x2e8902,_0x354483){for(var _0x1e9727 in _0x354483){if(_0x2e8902['hasOwnProperty'](_0x1e9727)){_0x2e8902[_0x1e9727]=_0x354483[_0x1e9727];}}};Realtime[_0x39dc('0x3d')][_0x39dc('0x3f')]=function(){var _0x15493f=this;return function(_0x4f0aff){if(_0x4f0aff){freeIsNotKeyAgent(_0x4f0aff,_0x15493f[_0x39dc('0x10')]);for(var _0x3ac518=0x0,_0x48d0e0={},_0x2cbf18={};_0x3ac518<_0x4f0aff[_0x39dc('0x40')];_0x3ac518+=0x1){_0x48d0e0=_0x4f0aff[_0x3ac518];var _0xa7ec9e=_[_0x39dc('0x27')](_0x48d0e0[_0x39dc('0x28')])?util['format'](_0x39dc('0x41'),_0x48d0e0['name']):_0x48d0e0[_0x39dc('0x28')];if(_[_0x39dc('0x42')](_0x15493f[_0x39dc('0x10')][_0xa7ec9e])){_0x15493f['agents'][_0xa7ec9e]=new Agent(_0x48d0e0);}else{_0x15493f[_0x39dc('0x3e')](_0x15493f[_0x39dc('0x10')][_0xa7ec9e],_0x48d0e0);}}}return _0x15493f['agents'];};};Realtime[_0x39dc('0x3d')]['initTelephones']=function(){var _0x3bcac8=this;return function(_0x9950e8){if(_0x9950e8){freeIsNotKeySip(_0x9950e8,_0x3bcac8['telephones']);for(var _0x100f0d=0x0,_0x4103c5={},_0xc52d97={};_0x100f0d<_0x9950e8[_0x39dc('0x40')];_0x100f0d+=0x1){_0x4103c5=_0x9950e8[_0x100f0d];if(_['isUndefined'](_0x3bcac8[_0x39dc('0x11')][util[_0x39dc('0x25')](_0x39dc('0x41'),_0x4103c5['name'])])){_0x3bcac8[_0x39dc('0x11')][util['format']('SIP/%s',_0x4103c5['name'])]=new Telephone(_0x4103c5);}else{_0x3bcac8[_0x39dc('0x3e')](_0x3bcac8[_0x39dc('0x11')][util[_0x39dc('0x25')]('SIP/%s',_0x4103c5[_0x39dc('0x26')])],_0x4103c5);}}}return _0x3bcac8[_0x39dc('0x11')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x43')]=function(){var _0x1dd1a7=this;return function(_0x35266c){if(_0x35266c){freeIsNotKeySip(_0x35266c,_0x1dd1a7['trunks']);for(var _0x5b1af5=0x0,_0x3cec18={},_0x4bfb58={};_0x5b1af5<_0x35266c['length'];_0x5b1af5+=0x1){_0x3cec18=_0x35266c[_0x5b1af5];if(_['isUndefined'](_0x1dd1a7[_0x39dc('0x12')][util[_0x39dc('0x25')](_0x39dc('0x41'),_0x3cec18[_0x39dc('0x26')])])){_0x1dd1a7[_0x39dc('0x12')][util[_0x39dc('0x25')](_0x39dc('0x41'),_0x3cec18[_0x39dc('0x26')])]=new Trunk(_0x3cec18);}else{_0x1dd1a7[_0x39dc('0x3e')](_0x1dd1a7[_0x39dc('0x12')][util[_0x39dc('0x25')](_0x39dc('0x41'),_0x3cec18['name'])],_0x3cec18);}}}return _0x1dd1a7[_0x39dc('0x12')];};};Realtime[_0x39dc('0x3d')]['initVoiceQueues']=function(){var _0x4da028=this;return function(_0x56eb91){if(_0x56eb91){freeIsNotKey(_0x56eb91,_0x4da028[_0x39dc('0x13')],'name');for(var _0x5d377c=0x0,_0x14c4f2={},_0x2ff114={};_0x5d377c<_0x56eb91[_0x39dc('0x40')];_0x5d377c+=0x1){_0x14c4f2=_0x56eb91[_0x5d377c];if(_['isUndefined'](_0x4da028[_0x39dc('0x13')][_0x14c4f2[_0x39dc('0x26')]])){_0x4da028[_0x39dc('0x13')][_0x14c4f2['name']]=new VoiceQueue(_0x14c4f2);}else{_0x4da028[_0x39dc('0x3e')](_0x4da028[_0x39dc('0x13')][_0x14c4f2[_0x39dc('0x26')]],_0x14c4f2);}}}return _0x4da028[_0x39dc('0x13')];};};Realtime[_0x39dc('0x3d')]['initTriggers']=function(){var _0x7fa1b0=this;return function(_0x1d0e6f){if(_0x1d0e6f){freeIsNotKey(_0x1d0e6f,_0x7fa1b0['triggers'],'id');for(var _0x2221b6=0x0,_0x31e53b={},_0x2b9d75={};_0x2221b6<_0x1d0e6f[_0x39dc('0x40')];_0x2221b6+=0x1){_0x31e53b=_0x1d0e6f[_0x2221b6];if(_[_0x39dc('0x42')](_0x7fa1b0['triggers'][_0x31e53b['id']])){_0x7fa1b0['triggers'][_0x31e53b['id']]=new Trigger(_0x31e53b);}else{_0x7fa1b0[_0x39dc('0x3e')](_0x7fa1b0[_0x39dc('0x14')][_0x31e53b['id']],_0x31e53b);}}}return _0x7fa1b0[_0x39dc('0x14')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x44')]=function(){var _0x5a711f=this;return function(_0x50f89c){if(_0x50f89c){freeIsNotKey(_0x50f89c,_0x5a711f[_0x39dc('0x16')],'id');for(var _0x166b42=0x0,_0x1ef31d={},_0xfd29b={};_0x166b42<_0x50f89c[_0x39dc('0x40')];_0x166b42+=0x1){_0x1ef31d=_0x50f89c[_0x166b42];if(_[_0x39dc('0x42')](_0x5a711f[_0x39dc('0x16')][_0x1ef31d['id']])){_0x5a711f[_0x39dc('0x16')][_0x1ef31d['id']]=new Template(_0x1ef31d);}else{_0x5a711f['mergeFromDatabase'](_0x5a711f[_0x39dc('0x16')][_0x1ef31d['id']],_0x1ef31d);}}}return _0x5a711f[_0x39dc('0x16')];};};Realtime['prototype'][_0x39dc('0x45')]=function(){var _0x25bb0f=this;return function(_0x2738fd){if(_0x2738fd){freeIsNotKey(_0x2738fd,_0x25bb0f[_0x39dc('0x1b')],'id');for(var _0x4a6751=0x0,_0x1a3b75={},_0x4f10b3={};_0x4a6751<_0x2738fd['length'];_0x4a6751+=0x1){_0x1a3b75=_0x2738fd[_0x4a6751];if(_[_0x39dc('0x42')](_0x25bb0f['zendeskAccounts'][_0x1a3b75['id']])){_0x25bb0f['zendeskAccounts'][_0x1a3b75['id']]=new ZendeskAccount(_0x1a3b75);}else{_0x25bb0f['mergeFromDatabase'](_0x25bb0f[_0x39dc('0x1b')][_0x1a3b75['id']],_0x1a3b75);}}}return _0x25bb0f[_0x39dc('0x1b')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x46')]=function(){var _0x472bcb=this;return function(_0x2f7af4){if(_0x2f7af4){freeIsNotKey(_0x2f7af4,_0x472bcb['salesforceAccounts'],'id');for(var _0x292893=0x0,_0x585971={},_0x66e08d={};_0x292893<_0x2f7af4[_0x39dc('0x40')];_0x292893+=0x1){_0x585971=_0x2f7af4[_0x292893];if(_[_0x39dc('0x42')](_0x472bcb[_0x39dc('0x1c')][_0x585971['id']])){_0x472bcb[_0x39dc('0x1c')][_0x585971['id']]=new SalesforceAccount(_0x585971);}else{_0x472bcb[_0x39dc('0x3e')](_0x472bcb['salesforceAccounts'][_0x585971['id']],_0x585971);}}}return _0x472bcb[_0x39dc('0x1c')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x47')]=function(){var _0x47569a=this;return function(_0x390c22){if(_0x390c22){freeIsNotKey(_0x390c22,_0x47569a[_0x39dc('0x48')],'id');for(var _0x4a49aa=0x0,_0x67a39f={},_0x52dc54={};_0x4a49aa<_0x390c22['length'];_0x4a49aa+=0x1){_0x67a39f=_0x390c22[_0x4a49aa];if(_[_0x39dc('0x42')](_0x47569a[_0x39dc('0x48')][_0x67a39f['id']])){_0x47569a[_0x39dc('0x48')][_0x67a39f['id']]=new FreshdeskAccount(_0x67a39f);}else{_0x47569a['mergeFromDatabase'](_0x47569a[_0x39dc('0x48')][_0x67a39f['id']],_0x67a39f);}}}return _0x47569a[_0x39dc('0x48')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x49')]=function(){var _0x567c7b=this;return function(_0x45fea2){if(_0x45fea2){freeIsNotKey(_0x45fea2,_0x567c7b[_0x39dc('0x1e')],'id');for(var _0x16c863=0x0,_0x208bd0={},_0xaec218={};_0x16c863<_0x45fea2['length'];_0x16c863+=0x1){_0x208bd0=_0x45fea2[_0x16c863];if(_[_0x39dc('0x42')](_0x567c7b['zohoAccounts'][_0x208bd0['id']])){_0x567c7b[_0x39dc('0x1e')][_0x208bd0['id']]=new ZohoAccount(_0x208bd0);}else{_0x567c7b[_0x39dc('0x3e')](_0x567c7b[_0x39dc('0x1e')][_0x208bd0['id']],_0x208bd0);}}}return _0x567c7b[_0x39dc('0x1e')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x52a215=this;return function(_0x4ea9e4){if(_0x4ea9e4){freeIsNotKey(_0x4ea9e4,_0x52a215['deskAccounts'],'id');for(var _0x4eedae=0x0,_0x5b2a22={},_0x5a9e9e={};_0x4eedae<_0x4ea9e4['length'];_0x4eedae+=0x1){_0x5b2a22=_0x4ea9e4[_0x4eedae];if(_[_0x39dc('0x42')](_0x52a215['deskAccounts'][_0x5b2a22['id']])){_0x52a215[_0x39dc('0x1f')][_0x5b2a22['id']]=new DeskAccount(_0x5b2a22);}else{_0x52a215[_0x39dc('0x3e')](_0x52a215[_0x39dc('0x1f')][_0x5b2a22['id']],_0x5b2a22);}}}return _0x52a215['deskAccounts'];};};Realtime[_0x39dc('0x3d')]['initSugarcrmAccounts']=function(){var _0xa20cbc=this;return function(_0x4cba79){if(_0x4cba79){freeIsNotKey(_0x4cba79,_0xa20cbc[_0x39dc('0x1d')],'id');for(var _0x54d0d8=0x0,_0x51d99b={},_0x16bf67={};_0x54d0d8<_0x4cba79[_0x39dc('0x40')];_0x54d0d8+=0x1){_0x51d99b=_0x4cba79[_0x54d0d8];if(_[_0x39dc('0x42')](_0xa20cbc['sugarcrmAccounts'][_0x51d99b['id']])){_0xa20cbc[_0x39dc('0x1d')][_0x51d99b['id']]=new SugarcrmAccount(_0x51d99b);}else{_0xa20cbc['mergeFromDatabase'](_0xa20cbc[_0x39dc('0x1d')][_0x51d99b['id']],_0x51d99b);}}}return _0xa20cbc[_0x39dc('0x1d')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x4a')]=function(){var _0x52a8fc=this;return function(_0x445e73){if(_0x445e73){freeIsNotKey(_0x445e73,_0x52a8fc[_0x39dc('0x20')],'id');for(var _0x41183f=0x0,_0x3247d0={},_0x1b317b={};_0x41183f<_0x445e73['length'];_0x41183f+=0x1){_0x3247d0=_0x445e73[_0x41183f];if(_[_0x39dc('0x42')](_0x52a8fc[_0x39dc('0x20')][_0x3247d0['id']])){_0x52a8fc[_0x39dc('0x20')][_0x3247d0['id']]=new VtigerAccount(_0x3247d0);}else{_0x52a8fc[_0x39dc('0x3e')](_0x52a8fc['vtigerAccounts'][_0x3247d0['id']],_0x3247d0);}}}return _0x52a8fc[_0x39dc('0x20')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x4b')]=function(){var _0x3f79a4=this;return function(_0x3da62d){if(_0x3da62d){freeIsNotKey(_0x3da62d,_0x3f79a4[_0x39dc('0x21')],'id');for(var _0x46bc38=0x0,_0x12dbcd={},_0x34dd8d={};_0x46bc38<_0x3da62d[_0x39dc('0x40')];_0x46bc38+=0x1){_0x12dbcd=_0x3da62d[_0x46bc38];if(_[_0x39dc('0x42')](_0x3f79a4[_0x39dc('0x21')][_0x12dbcd['id']])){_0x3f79a4['servicenowAccounts'][_0x12dbcd['id']]=new ServicenowAccount(_0x12dbcd);}else{_0x3f79a4[_0x39dc('0x3e')](_0x3f79a4[_0x39dc('0x21')][_0x12dbcd['id']],_0x12dbcd);}}}return _0x3f79a4['servicenowAccounts'];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x4c')]=function(){var _0x3266d2=this;return function(_0x1f674d){if(_0x1f674d){freeIsNotKey(_0x1f674d,_0x3266d2[_0x39dc('0x22')],'id');for(var _0x3656db=0x0,_0x5c6d7d={},_0x1f22b0={};_0x3656db<_0x1f674d['length'];_0x3656db+=0x1){_0x5c6d7d=_0x1f674d[_0x3656db];if(_[_0x39dc('0x42')](_0x3266d2[_0x39dc('0x22')][_0x5c6d7d['id']])){_0x3266d2[_0x39dc('0x22')][_0x5c6d7d['id']]=new Dynamics365Account(_0x5c6d7d);}else{_0x3266d2[_0x39dc('0x3e')](_0x3266d2['dynamics365Accounts'][_0x5c6d7d['id']],_0x5c6d7d);}}}return _0x3266d2[_0x39dc('0x22')];};};Realtime['prototype'][_0x39dc('0x4d')]=function(){var _0x1eb38d=this;return function(_0xb0b8ff){for(var _0x536740=0x0;_0x536740<_0xb0b8ff['length'];_0x536740+=0x1){_[_0x39dc('0x4e')](_0x1eb38d[_0x39dc('0x13')][_0xb0b8ff[_0x536740][_0x39dc('0x26')]],_0xb0b8ff[_0x536740]);}return _0x1eb38d[_0x39dc('0x13')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x4f')]=function(){var _0x1703d0=this;return function(_0x47129e){clearVoiceQueues(_0x1703d0[_0x39dc('0x13')]);if(_0x47129e){_0x47129e=_['groupBy'](_0x47129e,'uniqueid');for(var _0x258bf2 in _0x47129e){if(_0x47129e[_0x39dc('0x24')](_0x258bf2)){var _0x104484={};for(var _0x5cdcb1=0x0;_0x5cdcb1<_0x47129e[_0x258bf2]['length'];_0x5cdcb1+=0x1){var _0x5d8b25=_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x50')];if(_0x1703d0[_0x39dc('0x13')][_0x5d8b25]){if(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x51')]){_0x1703d0[_0x39dc('0x13')][_0x5d8b25][_0x39dc('0x30')]+=0x1;}if(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x52')]){_0x1703d0['voiceQueues'][_0x5d8b25][_0x39dc('0x31')]+=0x1;}_0x1703d0[_0x39dc('0x13')][_0x5d8b25]['sumHoldTime']+=moment(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x53')])[_0x39dc('0x54')](moment(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x55')]),_0x39dc('0x56'))||0x0;if(_0x5cdcb1===_0x47129e[_0x258bf2][_0x39dc('0x40')]-0x1){_0x1703d0[_0x39dc('0x13')][_0x5d8b25][_0x39dc('0x2c')]+=moment(_0x47129e[_0x258bf2][_0x5cdcb1]['queuecallercompleteAt']||_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x57')]||_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x58')])[_0x39dc('0x54')](moment(_0x47129e[_0x258bf2][_0x5cdcb1]['queuecallerjoinAt']),_0x39dc('0x56'))||0x0;_0x1703d0[_0x39dc('0x13')][_0x5d8b25][_0x39dc('0x29')]+=0x1;if(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x59')]){_0x1703d0['voiceQueues'][_0x5d8b25][_0x39dc('0x2a')]+=0x1;_0x1703d0['voiceQueues'][_0x5d8b25][_0x39dc('0x2d')]+=moment(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x5a')])[_0x39dc('0x54')](moment(_0x47129e[_0x258bf2][_0x5cdcb1][_0x39dc('0x53')]),_0x39dc('0x56'))||0x0;}}else{_0x1703d0['voiceQueues'][_0x5d8b25][_0x39dc('0x2c')]+=_0x1703d0[_0x39dc('0x13')][_0x5d8b25][_0x39dc('0x2b')]||0x0;}}}}}}return _0x1703d0[_0x39dc('0x13')];};};Realtime[_0x39dc('0x3d')]['initVoiceCallReports']=function(){var _0x5df48a=this;return function(_0x1dc47b){clearVoiceCallReports(_0x5df48a[_0x39dc('0x5b')]);if(_0x1dc47b){for(var _0x3b424d=0x0;_0x3b424d<_0x1dc47b['length'];_0x3b424d+=0x1){_0x5df48a[_0x39dc('0x5b')][_0x39dc('0x29')]+=0x1;_0x5df48a[_0x39dc('0x5b')][_0x39dc('0x2c')]+=_0x1dc47b[_0x3b424d]['duration'];if(_0x1dc47b[_0x3b424d]['disposition']===_0x39dc('0x5c')){_0x5df48a['outbound']['answered']+=0x1;_0x5df48a[_0x39dc('0x5b')][_0x39dc('0x2b')]+=_0x1dc47b[_0x3b424d]['duration']-_0x1dc47b[_0x3b424d][_0x39dc('0x5d')]||0x0;_0x5df48a[_0x39dc('0x5b')][_0x39dc('0x2d')]+=_0x1dc47b[_0x3b424d][_0x39dc('0x5d')];}}}return _0x5df48a[_0x39dc('0x5b')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x5e')]=function(){var _0xd26bba=this;return function(_0x4bfb25){if(_0x4bfb25){freeIsNotKey(_0x4bfb25,_0xd26bba[_0x39dc('0x15')],_0x39dc('0x26'));for(var _0x497973=0x0,_0x36d09e={};_0x497973<_0x4bfb25['length'];_0x497973+=0x1){_0x36d09e=_0x4bfb25[_0x497973];if(_[_0x39dc('0x42')](_0xd26bba[_0x39dc('0x15')][_0x36d09e[_0x39dc('0x26')]])){_0xd26bba[_0x39dc('0x15')][_0x36d09e[_0x39dc('0x26')]]=new Campaign(_0x36d09e);}else{_0xd26bba[_0x39dc('0x3e')](_0xd26bba['campaigns'][_0x36d09e['name']],_0x36d09e);}}}return _0xd26bba[_0x39dc('0x15')];};};Realtime['prototype'][_0x39dc('0x5f')]=function(){var _0x32b0a0=this;return function(_0x40e87a){if(_0x40e87a){freeIsNotKey(_0x40e87a,_0x32b0a0[_0x39dc('0x17')],'id');for(var _0x4c1b11=0x0,_0x3c92d6={};_0x4c1b11<_0x40e87a[_0x39dc('0x40')];_0x4c1b11+=0x1){_0x3c92d6=_0x40e87a[_0x4c1b11];if(_[_0x39dc('0x42')](_0x32b0a0[_0x39dc('0x17')][_0x3c92d6['id']])){_0x32b0a0[_0x39dc('0x17')][_0x3c92d6['id']]=new VoiceExtension(_0x3c92d6);}else{_0x32b0a0['mergeFromDatabase'](_0x32b0a0[_0x39dc('0x17')][_0x3c92d6['id']],_0x3c92d6);}}}return _0x32b0a0[_0x39dc('0x17')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x60')]=function(){var _0x422ad4=this;return function(_0xda6e2c){clearCampaigns(_0x422ad4[_0x39dc('0x15')]);for(var _0x1950bd=0x0;_0x1950bd<_0xda6e2c[_0x39dc('0x40')];_0x1950bd+=0x1){_[_0x39dc('0x4e')](_0x422ad4[_0x39dc('0x15')][_0xda6e2c[_0x1950bd][_0x39dc('0x26')]],_0xda6e2c[_0x1950bd]);}return _0x422ad4[_0x39dc('0x15')];};};Realtime[_0x39dc('0x3d')][_0x39dc('0x61')]=function(){var _0x35fa25=this;return function(_0x273ce0){if(_0x273ce0){freeIsNotKey(_0x273ce0,_0x35fa25['faxAccounts'],'id');for(var _0x463406=0x0,_0x3b7b72={},_0x38df63={};_0x463406<_0x273ce0['length'];_0x463406+=0x1){_0x3b7b72=_0x273ce0[_0x463406];if(_['isUndefined'](_0x35fa25['faxAccounts'][_0x3b7b72['id']])){_0x35fa25[_0x39dc('0x62')][_0x3b7b72['id']]=new FaxAccount(_0x3b7b72);}else{_0x35fa25[_0x39dc('0x3e')](_0x35fa25[_0x39dc('0x62')][_0x3b7b72['id']],_0x3b7b72);}}}return _0x35fa25[_0x39dc('0x62')];};};module[_0x39dc('0x63')]=Realtime; \ No newline at end of file +var _0x0b13=['initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','trunks','voiceQueues','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','initTelephones','telephones','isUndefined','initVoiceQueues','length','initTriggers','triggers','initTemplates','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x0b13,0x150));var _0x30b1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0b13[_0x3bf83f];return _0x22c4a9;};'use strict';var BPromise=require(_0x30b1('0x0'));var util=require(_0x30b1('0x1'));var _=require(_0x30b1('0x2'));var moment=require(_0x30b1('0x3'));var Agent=require(_0x30b1('0x4'));var Telephone=require(_0x30b1('0x5'));var Trunk=require(_0x30b1('0x6'));var VoiceQueue=require(_0x30b1('0x7'));var Trigger=require(_0x30b1('0x8'));var Template=require(_0x30b1('0x9'));var Campaign=require(_0x30b1('0xa'));var VoiceExtension=require(_0x30b1('0xb'));var ZendeskAccount=require(_0x30b1('0xc'));var SalesforceAccount=require(_0x30b1('0xd'));var FreshdeskAccount=require(_0x30b1('0xe'));var SugarcrmAccount=require(_0x30b1('0xf'));var ZohoAccount=require(_0x30b1('0x10'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x30b1('0x11'));var ServicenowAccount=require(_0x30b1('0x12'));var Dynamics365Account=require(_0x30b1('0x13'));var FaxAccount=require(_0x30b1('0x14'));var Realtime=function(){this[_0x30b1('0x15')]={};this['telephones']={};this[_0x30b1('0x16')]={};this[_0x30b1('0x17')]={};this['triggers']={};this['campaigns']={};this[_0x30b1('0x18')]={};this[_0x30b1('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x30b1('0x1a')]={};this[_0x30b1('0x1b')]={};this[_0x30b1('0x1c')]={};this[_0x30b1('0x1d')]={};this[_0x30b1('0x1e')]={};this[_0x30b1('0x1f')]={};this[_0x30b1('0x20')]={};this[_0x30b1('0x21')]={};this[_0x30b1('0x22')]={};this[_0x30b1('0x23')]={};this[_0x30b1('0x24')]={};this['vtigerAccounts']={};this[_0x30b1('0x25')]={};this['dynamics365Accounts']={};this[_0x30b1('0x26')]={};};function freeIsNotKey(_0xdb8da4,_0x290c89,_0x1bc890){var _0x1ab642=_[_0x30b1('0x27')](_0xdb8da4,function(_0x9c46a6,_0x3a2295){return _0x9c46a6[_0x1bc890];});for(var _0x417f3b in _0x290c89){if(_0x290c89[_0x30b1('0x28')](_0x417f3b)){if(!_0x1ab642[_0x417f3b]){delete _0x290c89[_0x417f3b];}}}}function freeIsNotKeySip(_0x1666cb,_0x47078d){var _0x1ef404=_[_0x30b1('0x27')](_0x1666cb,function(_0x2aa391,_0x4d5fb1){return util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x2aa391['name']);});for(var _0x52753a in _0x47078d){if(_0x47078d['hasOwnProperty'](_0x52753a)){if(!_0x1ef404[_0x52753a]){delete _0x47078d[_0x52753a];}}}}function freeIsNotKeyAgent(_0x771cbd,_0xbeae78){var _0x2b4238=_[_0x30b1('0x27')](_0x771cbd,function(_0x5134a8,_0x15d5cb){var _0xe36387=_[_0x30b1('0x2b')](_0x5134a8['interface'])?util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x5134a8[_0x30b1('0x2c')]):_0x5134a8[_0x30b1('0x2d')];return _0xe36387;});for(var _0xee69ea in _0xbeae78){if(_0xbeae78[_0x30b1('0x28')](_0xee69ea)){if(!_0x2b4238[_0xee69ea]){delete _0xbeae78[_0xee69ea];}}}}function clearVoiceCallReports(_0x10f254){_0x10f254[_0x30b1('0x2e')]=0x0;_0x10f254[_0x30b1('0x2f')]=0x0;_0x10f254[_0x30b1('0x30')]=0x0;_0x10f254[_0x30b1('0x31')]=0x0;_0x10f254[_0x30b1('0x32')]=0x0;}function clearCampaigns(_0x34126d){if(!_['isEmpty'](_0x34126d)){for(var _0x2c125d in _0x34126d){if(_0x34126d[_0x30b1('0x28')](_0x2c125d)){_0x34126d[_0x2c125d][_0x30b1('0x33')]=0x0;_0x34126d[_0x2c125d][_0x30b1('0x34')]=0x0;}}}}function clearVoiceQueues(_0xb70927){if(!_[_0x30b1('0x35')](_0xb70927)){for(var _0x1e3b28 in _0xb70927){if(_0xb70927['hasOwnProperty'](_0x1e3b28)){_0xb70927[_0x1e3b28][_0x30b1('0x2e')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x2f')]=0x0;_0xb70927[_0x1e3b28]['unmanaged']=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x36')]=0x0;_0xb70927[_0x1e3b28]['sumHoldTime']=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x31')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x32')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x37')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x38')]=0x0;_0xb70927[_0x1e3b28]['outboundBusyCallsDay']=0x0;_0xb70927[_0x1e3b28]['outboundCongestionCallsDay']=0x0;_0xb70927[_0x1e3b28]['outboundNoSuchCallsDay']=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x39')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x3a')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x3b')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x3c')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x3d')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x3e')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x3f')]=0x0;_0xb70927[_0x1e3b28]['outboundAnswerAgiCallsDay']=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x40')]=0x0;_0xb70927[_0x1e3b28][_0x30b1('0x41')]=!![];}}}}Realtime[_0x30b1('0x42')][_0x30b1('0x43')]=function(_0x1e1c0a,_0x100147){for(var _0x494064 in _0x100147){if(_0x1e1c0a[_0x30b1('0x28')](_0x494064)){_0x1e1c0a[_0x494064]=_0x100147[_0x494064];}}};Realtime[_0x30b1('0x42')][_0x30b1('0x44')]=function(){var _0x454094=this;return function(_0x2dbe55){if(_0x2dbe55){freeIsNotKeyAgent(_0x2dbe55,_0x454094[_0x30b1('0x15')]);for(var _0x47fb0a=0x0,_0x46705e={},_0x226726={};_0x47fb0a<_0x2dbe55['length'];_0x47fb0a+=0x1){_0x46705e=_0x2dbe55[_0x47fb0a];var _0x4f946b=_[_0x30b1('0x2b')](_0x46705e[_0x30b1('0x2d')])?util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x46705e['name']):_0x46705e[_0x30b1('0x2d')];if(_['isUndefined'](_0x454094['agents'][_0x4f946b])){_0x454094['agents'][_0x4f946b]=new Agent(_0x46705e);}else{_0x454094['mergeFromDatabase'](_0x454094[_0x30b1('0x15')][_0x4f946b],_0x46705e);}}}return _0x454094[_0x30b1('0x15')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x45')]=function(){var _0x27d695=this;return function(_0x25b132){if(_0x25b132){freeIsNotKeySip(_0x25b132,_0x27d695['telephones']);for(var _0x5acc1f=0x0,_0x56c825={},_0x40b4cc={};_0x5acc1f<_0x25b132['length'];_0x5acc1f+=0x1){_0x56c825=_0x25b132[_0x5acc1f];if(_['isUndefined'](_0x27d695[_0x30b1('0x46')][util[_0x30b1('0x29')]('SIP/%s',_0x56c825[_0x30b1('0x2c')])])){_0x27d695[_0x30b1('0x46')][util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x56c825[_0x30b1('0x2c')])]=new Telephone(_0x56c825);}else{_0x27d695['mergeFromDatabase'](_0x27d695[_0x30b1('0x46')][util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x56c825['name'])],_0x56c825);}}}return _0x27d695['telephones'];};};Realtime[_0x30b1('0x42')]['initTrunks']=function(){var _0x41d141=this;return function(_0x2f0749){if(_0x2f0749){freeIsNotKeySip(_0x2f0749,_0x41d141[_0x30b1('0x16')]);for(var _0x58d7bf=0x0,_0x16faeb={},_0x2816f3={};_0x58d7bf<_0x2f0749['length'];_0x58d7bf+=0x1){_0x16faeb=_0x2f0749[_0x58d7bf];if(_[_0x30b1('0x47')](_0x41d141[_0x30b1('0x16')][util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x16faeb[_0x30b1('0x2c')])])){_0x41d141[_0x30b1('0x16')][util[_0x30b1('0x29')](_0x30b1('0x2a'),_0x16faeb[_0x30b1('0x2c')])]=new Trunk(_0x16faeb);}else{_0x41d141[_0x30b1('0x43')](_0x41d141[_0x30b1('0x16')][util[_0x30b1('0x29')]('SIP/%s',_0x16faeb[_0x30b1('0x2c')])],_0x16faeb);}}}return _0x41d141[_0x30b1('0x16')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x48')]=function(){var _0x2b61b5=this;return function(_0x18f9f6){if(_0x18f9f6){freeIsNotKey(_0x18f9f6,_0x2b61b5['voiceQueues'],'name');for(var _0x5cc26d=0x0,_0x30cd38={},_0x57abdf={};_0x5cc26d<_0x18f9f6[_0x30b1('0x49')];_0x5cc26d+=0x1){_0x30cd38=_0x18f9f6[_0x5cc26d];if(_[_0x30b1('0x47')](_0x2b61b5['voiceQueues'][_0x30cd38[_0x30b1('0x2c')]])){_0x2b61b5[_0x30b1('0x17')][_0x30cd38['name']]=new VoiceQueue(_0x30cd38);}else{_0x2b61b5[_0x30b1('0x43')](_0x2b61b5['voiceQueues'][_0x30cd38['name']],_0x30cd38);}}}return _0x2b61b5['voiceQueues'];};};Realtime[_0x30b1('0x42')][_0x30b1('0x4a')]=function(){var _0x3aa505=this;return function(_0x356f17){if(_0x356f17){freeIsNotKey(_0x356f17,_0x3aa505[_0x30b1('0x4b')],'id');for(var _0x4bfa27=0x0,_0x1685b5={},_0xd1e751={};_0x4bfa27<_0x356f17[_0x30b1('0x49')];_0x4bfa27+=0x1){_0x1685b5=_0x356f17[_0x4bfa27];if(_[_0x30b1('0x47')](_0x3aa505[_0x30b1('0x4b')][_0x1685b5['id']])){_0x3aa505[_0x30b1('0x4b')][_0x1685b5['id']]=new Trigger(_0x1685b5);}else{_0x3aa505[_0x30b1('0x43')](_0x3aa505[_0x30b1('0x4b')][_0x1685b5['id']],_0x1685b5);}}}return _0x3aa505[_0x30b1('0x4b')];};};Realtime['prototype'][_0x30b1('0x4c')]=function(){var _0x3c9d43=this;return function(_0x4fb232){if(_0x4fb232){freeIsNotKey(_0x4fb232,_0x3c9d43[_0x30b1('0x18')],'id');for(var _0x4240ab=0x0,_0x2565c4={},_0x17ff02={};_0x4240ab<_0x4fb232[_0x30b1('0x49')];_0x4240ab+=0x1){_0x2565c4=_0x4fb232[_0x4240ab];if(_['isUndefined'](_0x3c9d43[_0x30b1('0x18')][_0x2565c4['id']])){_0x3c9d43['templates'][_0x2565c4['id']]=new Template(_0x2565c4);}else{_0x3c9d43[_0x30b1('0x43')](_0x3c9d43[_0x30b1('0x18')][_0x2565c4['id']],_0x2565c4);}}}return _0x3c9d43['templates'];};};Realtime[_0x30b1('0x42')]['initZendeskAccounts']=function(){var _0x30fffe=this;return function(_0x115f2f){if(_0x115f2f){freeIsNotKey(_0x115f2f,_0x30fffe[_0x30b1('0x1f')],'id');for(var _0x327505=0x0,_0x5be16e={},_0xacf7f1={};_0x327505<_0x115f2f[_0x30b1('0x49')];_0x327505+=0x1){_0x5be16e=_0x115f2f[_0x327505];if(_['isUndefined'](_0x30fffe[_0x30b1('0x1f')][_0x5be16e['id']])){_0x30fffe[_0x30b1('0x1f')][_0x5be16e['id']]=new ZendeskAccount(_0x5be16e);}else{_0x30fffe[_0x30b1('0x43')](_0x30fffe[_0x30b1('0x1f')][_0x5be16e['id']],_0x5be16e);}}}return _0x30fffe['zendeskAccounts'];};};Realtime[_0x30b1('0x42')]['initSalesforceAccounts']=function(){var _0x3e15dd=this;return function(_0x271017){if(_0x271017){freeIsNotKey(_0x271017,_0x3e15dd[_0x30b1('0x20')],'id');for(var _0x46fc25=0x0,_0x482345={},_0x37e793={};_0x46fc25<_0x271017[_0x30b1('0x49')];_0x46fc25+=0x1){_0x482345=_0x271017[_0x46fc25];if(_[_0x30b1('0x47')](_0x3e15dd[_0x30b1('0x20')][_0x482345['id']])){_0x3e15dd[_0x30b1('0x20')][_0x482345['id']]=new SalesforceAccount(_0x482345);}else{_0x3e15dd[_0x30b1('0x43')](_0x3e15dd[_0x30b1('0x20')][_0x482345['id']],_0x482345);}}}return _0x3e15dd[_0x30b1('0x20')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x4d')]=function(){var _0x314271=this;return function(_0x2aca10){if(_0x2aca10){freeIsNotKey(_0x2aca10,_0x314271['freshdeskAccounts'],'id');for(var _0x3d20a2=0x0,_0x53dafc={},_0x4ab00f={};_0x3d20a2<_0x2aca10[_0x30b1('0x49')];_0x3d20a2+=0x1){_0x53dafc=_0x2aca10[_0x3d20a2];if(_[_0x30b1('0x47')](_0x314271[_0x30b1('0x22')][_0x53dafc['id']])){_0x314271[_0x30b1('0x22')][_0x53dafc['id']]=new FreshdeskAccount(_0x53dafc);}else{_0x314271[_0x30b1('0x43')](_0x314271[_0x30b1('0x22')][_0x53dafc['id']],_0x53dafc);}}}return _0x314271['freshdeskAccounts'];};};Realtime[_0x30b1('0x42')][_0x30b1('0x4e')]=function(){var _0x153bf4=this;return function(_0x38fb1f){if(_0x38fb1f){freeIsNotKey(_0x38fb1f,_0x153bf4['zohoAccounts'],'id');for(var _0x71cedd=0x0,_0x5c5841={},_0x379a30={};_0x71cedd<_0x38fb1f[_0x30b1('0x49')];_0x71cedd+=0x1){_0x5c5841=_0x38fb1f[_0x71cedd];if(_['isUndefined'](_0x153bf4['zohoAccounts'][_0x5c5841['id']])){_0x153bf4[_0x30b1('0x23')][_0x5c5841['id']]=new ZohoAccount(_0x5c5841);}else{_0x153bf4[_0x30b1('0x43')](_0x153bf4['zohoAccounts'][_0x5c5841['id']],_0x5c5841);}}}return _0x153bf4[_0x30b1('0x23')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x4f')]=function(){var _0x37a340=this;return function(_0x586bf5){if(_0x586bf5){freeIsNotKey(_0x586bf5,_0x37a340[_0x30b1('0x24')],'id');for(var _0x3584af=0x0,_0x595058={},_0x90f5b4={};_0x3584af<_0x586bf5[_0x30b1('0x49')];_0x3584af+=0x1){_0x595058=_0x586bf5[_0x3584af];if(_[_0x30b1('0x47')](_0x37a340[_0x30b1('0x24')][_0x595058['id']])){_0x37a340[_0x30b1('0x24')][_0x595058['id']]=new DeskAccount(_0x595058);}else{_0x37a340[_0x30b1('0x43')](_0x37a340['deskAccounts'][_0x595058['id']],_0x595058);}}}return _0x37a340['deskAccounts'];};};Realtime['prototype'][_0x30b1('0x50')]=function(){var _0xec6ef9=this;return function(_0x327bb9){if(_0x327bb9){freeIsNotKey(_0x327bb9,_0xec6ef9[_0x30b1('0x21')],'id');for(var _0x5919e1=0x0,_0x39a422={},_0x341d4a={};_0x5919e1<_0x327bb9[_0x30b1('0x49')];_0x5919e1+=0x1){_0x39a422=_0x327bb9[_0x5919e1];if(_[_0x30b1('0x47')](_0xec6ef9['sugarcrmAccounts'][_0x39a422['id']])){_0xec6ef9[_0x30b1('0x21')][_0x39a422['id']]=new SugarcrmAccount(_0x39a422);}else{_0xec6ef9[_0x30b1('0x43')](_0xec6ef9[_0x30b1('0x21')][_0x39a422['id']],_0x39a422);}}}return _0xec6ef9[_0x30b1('0x21')];};};Realtime[_0x30b1('0x42')]['initVtigerAccounts']=function(){var _0x312a68=this;return function(_0x2ba672){if(_0x2ba672){freeIsNotKey(_0x2ba672,_0x312a68['vtigerAccounts'],'id');for(var _0x1f5177=0x0,_0x133a7c={},_0x4073da={};_0x1f5177<_0x2ba672[_0x30b1('0x49')];_0x1f5177+=0x1){_0x133a7c=_0x2ba672[_0x1f5177];if(_[_0x30b1('0x47')](_0x312a68[_0x30b1('0x51')][_0x133a7c['id']])){_0x312a68[_0x30b1('0x51')][_0x133a7c['id']]=new VtigerAccount(_0x133a7c);}else{_0x312a68[_0x30b1('0x43')](_0x312a68['vtigerAccounts'][_0x133a7c['id']],_0x133a7c);}}}return _0x312a68[_0x30b1('0x51')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x52')]=function(){var _0x2f9e26=this;return function(_0x4e4f57){if(_0x4e4f57){freeIsNotKey(_0x4e4f57,_0x2f9e26[_0x30b1('0x25')],'id');for(var _0x4c3a2e=0x0,_0x118b08={},_0x1a451a={};_0x4c3a2e<_0x4e4f57[_0x30b1('0x49')];_0x4c3a2e+=0x1){_0x118b08=_0x4e4f57[_0x4c3a2e];if(_[_0x30b1('0x47')](_0x2f9e26[_0x30b1('0x25')][_0x118b08['id']])){_0x2f9e26['servicenowAccounts'][_0x118b08['id']]=new ServicenowAccount(_0x118b08);}else{_0x2f9e26['mergeFromDatabase'](_0x2f9e26[_0x30b1('0x25')][_0x118b08['id']],_0x118b08);}}}return _0x2f9e26[_0x30b1('0x25')];};};Realtime[_0x30b1('0x42')]['initDynamics365Accounts']=function(){var _0x57f668=this;return function(_0x1a7695){if(_0x1a7695){freeIsNotKey(_0x1a7695,_0x57f668['dynamics365Accounts'],'id');for(var _0x331438=0x0,_0x53b497={},_0x290322={};_0x331438<_0x1a7695[_0x30b1('0x49')];_0x331438+=0x1){_0x53b497=_0x1a7695[_0x331438];if(_[_0x30b1('0x47')](_0x57f668[_0x30b1('0x53')][_0x53b497['id']])){_0x57f668[_0x30b1('0x53')][_0x53b497['id']]=new Dynamics365Account(_0x53b497);}else{_0x57f668['mergeFromDatabase'](_0x57f668[_0x30b1('0x53')][_0x53b497['id']],_0x53b497);}}}return _0x57f668[_0x30b1('0x53')];};};Realtime['prototype'][_0x30b1('0x54')]=function(){var _0x191a2a=this;return function(_0x41f685){for(var _0x4617db=0x0;_0x4617db<_0x41f685[_0x30b1('0x49')];_0x4617db+=0x1){_[_0x30b1('0x55')](_0x191a2a[_0x30b1('0x17')][_0x41f685[_0x4617db]['name']],_0x41f685[_0x4617db]);}return _0x191a2a['voiceQueues'];};};Realtime[_0x30b1('0x42')]['initVoiceQueueReports']=function(){var _0x54df3f=this;return function(_0x2052d3){clearVoiceQueues(_0x54df3f[_0x30b1('0x17')]);if(_0x2052d3){_0x2052d3=_[_0x30b1('0x56')](_0x2052d3,_0x30b1('0x57'));for(var _0x172e53 in _0x2052d3){if(_0x2052d3[_0x30b1('0x28')](_0x172e53)){var _0xdb01bb={};for(var _0x483d84=0x0;_0x483d84<_0x2052d3[_0x172e53][_0x30b1('0x49')];_0x483d84+=0x1){var _0x4b71c0=_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x58')];if(_0x54df3f[_0x30b1('0x17')][_0x4b71c0]){if(_0x2052d3[_0x172e53][_0x483d84]['queuecallerexit']){_0x54df3f[_0x30b1('0x17')][_0x4b71c0][_0x30b1('0x59')]+=0x1;}if(_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x5a')]){_0x54df3f[_0x30b1('0x17')][_0x4b71c0]['abandoned']+=0x1;}_0x54df3f[_0x30b1('0x17')][_0x4b71c0][_0x30b1('0x30')]+=moment(_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x5b')])[_0x30b1('0x5c')](moment(_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x5d')]),'seconds')||0x0;if(_0x483d84===_0x2052d3[_0x172e53]['length']-0x1){_0x54df3f['voiceQueues'][_0x4b71c0][_0x30b1('0x31')]+=moment(_0x2052d3[_0x172e53][_0x483d84]['queuecallercompleteAt']||_0x2052d3[_0x172e53][_0x483d84]['queuecallerabandonAt']||_0x2052d3[_0x172e53][_0x483d84]['queuecallerexitAt'])[_0x30b1('0x5c')](moment(_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x5d')]),_0x30b1('0x5e'))||0x0;_0x54df3f[_0x30b1('0x17')][_0x4b71c0][_0x30b1('0x2e')]+=0x1;if(_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x5f')]){_0x54df3f[_0x30b1('0x17')][_0x4b71c0][_0x30b1('0x2f')]+=0x1;_0x54df3f[_0x30b1('0x17')][_0x4b71c0][_0x30b1('0x32')]+=moment(_0x2052d3[_0x172e53][_0x483d84]['queuecallercompleteAt'])[_0x30b1('0x5c')](moment(_0x2052d3[_0x172e53][_0x483d84][_0x30b1('0x5b')]),'seconds')||0x0;}}else{_0x54df3f[_0x30b1('0x17')][_0x4b71c0]['sumDuration']+=_0x54df3f['voiceQueues'][_0x4b71c0]['sumHoldTime']||0x0;}}}}}}return _0x54df3f[_0x30b1('0x17')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x60')]=function(){var _0x53d1c8=this;return function(_0x221864){clearVoiceCallReports(_0x53d1c8[_0x30b1('0x19')]);if(_0x221864){for(var _0x3da990=0x0;_0x3da990<_0x221864[_0x30b1('0x49')];_0x3da990+=0x1){_0x53d1c8[_0x30b1('0x19')][_0x30b1('0x2e')]+=0x1;_0x53d1c8[_0x30b1('0x19')][_0x30b1('0x31')]+=_0x221864[_0x3da990][_0x30b1('0x61')];if(_0x221864[_0x3da990][_0x30b1('0x62')]===_0x30b1('0x63')){_0x53d1c8['outbound'][_0x30b1('0x2f')]+=0x1;_0x53d1c8['outbound']['sumHoldTime']+=_0x221864[_0x3da990][_0x30b1('0x61')]-_0x221864[_0x3da990][_0x30b1('0x64')]||0x0;_0x53d1c8[_0x30b1('0x19')]['sumBillable']+=_0x221864[_0x3da990][_0x30b1('0x64')];}}}return _0x53d1c8[_0x30b1('0x19')];};};Realtime['prototype']['initCampaigns']=function(){var _0x550c77=this;return function(_0x3de0e8){if(_0x3de0e8){freeIsNotKey(_0x3de0e8,_0x550c77[_0x30b1('0x65')],_0x30b1('0x2c'));for(var _0x321d74=0x0,_0x50e0c4={};_0x321d74<_0x3de0e8[_0x30b1('0x49')];_0x321d74+=0x1){_0x50e0c4=_0x3de0e8[_0x321d74];if(_[_0x30b1('0x47')](_0x550c77['campaigns'][_0x50e0c4[_0x30b1('0x2c')]])){_0x550c77['campaigns'][_0x50e0c4[_0x30b1('0x2c')]]=new Campaign(_0x50e0c4);}else{_0x550c77[_0x30b1('0x43')](_0x550c77[_0x30b1('0x65')][_0x50e0c4[_0x30b1('0x2c')]],_0x50e0c4);}}}return _0x550c77[_0x30b1('0x65')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x115b7f=this;return function(_0xcda689){if(_0xcda689){freeIsNotKey(_0xcda689,_0x115b7f[_0x30b1('0x1a')],'id');for(var _0x5d9d42=0x0,_0xd468f0={};_0x5d9d42<_0xcda689[_0x30b1('0x49')];_0x5d9d42+=0x1){_0xd468f0=_0xcda689[_0x5d9d42];if(_[_0x30b1('0x47')](_0x115b7f[_0x30b1('0x1a')][_0xd468f0['id']])){_0x115b7f[_0x30b1('0x1a')][_0xd468f0['id']]=new VoiceExtension(_0xd468f0);}else{_0x115b7f['mergeFromDatabase'](_0x115b7f[_0x30b1('0x1a')][_0xd468f0['id']],_0xd468f0);}}}return _0x115b7f[_0x30b1('0x1a')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x66')]=function(){var _0x4aec1f=this;return function(_0x347949){clearCampaigns(_0x4aec1f[_0x30b1('0x65')]);for(var _0x2a6b09=0x0;_0x2a6b09<_0x347949[_0x30b1('0x49')];_0x2a6b09+=0x1){_[_0x30b1('0x55')](_0x4aec1f[_0x30b1('0x65')][_0x347949[_0x2a6b09][_0x30b1('0x2c')]],_0x347949[_0x2a6b09]);}return _0x4aec1f[_0x30b1('0x65')];};};Realtime[_0x30b1('0x42')][_0x30b1('0x67')]=function(){var _0x1d116d=this;return function(_0x31ceb0){if(_0x31ceb0){freeIsNotKey(_0x31ceb0,_0x1d116d[_0x30b1('0x26')],'id');for(var _0x19548d=0x0,_0x519fc2={},_0x523bc5={};_0x19548d<_0x31ceb0[_0x30b1('0x49')];_0x19548d+=0x1){_0x519fc2=_0x31ceb0[_0x19548d];if(_[_0x30b1('0x47')](_0x1d116d[_0x30b1('0x26')][_0x519fc2['id']])){_0x1d116d[_0x30b1('0x26')][_0x519fc2['id']]=new FaxAccount(_0x519fc2);}else{_0x1d116d['mergeFromDatabase'](_0x1d116d[_0x30b1('0x26')][_0x519fc2['id']],_0x519fc2);}}}return _0x1d116d[_0x30b1('0x26')];};};module[_0x30b1('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 58027e9..ce1a610 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 _0x4f91=['dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','monitor','monitors','filename','createdAt','calleridname','xcally-motion-dialer','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','exports','bluebird','lodash','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten'];(function(_0x40ba71,_0x148779){var _0x3501f4=function(_0x399615){while(--_0x399615){_0x40ba71['push'](_0x40ba71['shift']());}};_0x3501f4(++_0x148779);}(_0x4f91,0x11b));var _0x14f9=function(_0x49f8c1,_0x347eb4){_0x49f8c1=_0x49f8c1-0x0;var _0x4d5469=_0x4f91[_0x49f8c1];return _0x4d5469;};'use strict';var BPromise=require(_0x14f9('0x0'));var _=require(_0x14f9('0x1'));var moment=require(_0x14f9('0x2'));var util=require(_0x14f9('0x3'));var config=require('../../../config/environment');var logger=require(_0x14f9('0x4'))(_0x14f9('0x5'));var ami=require(_0x14f9('0x6'));var RpcVoiceAgentReport=require(_0x14f9('0x7'));var RpcVoiceCallReport=require(_0x14f9('0x8'));var RpcVoiceDialReport=require(_0x14f9('0x9'));var RpcMemberReport=require(_0x14f9('0xa'));var RpcVoiceQueueReport=require(_0x14f9('0xb'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x14f9('0xc'));var VoiceAgentReport=require(_0x14f9('0xd'));var VoiceDialReport=require(_0x14f9('0xe'));var UserReport=require('./userReport');function Report(_0x188b1e){this['realtime']=_0x188b1e;this[_0x14f9('0xf')]=_0x188b1e[_0x14f9('0xf')];this[_0x14f9('0x10')]=_0x188b1e['telephones'];}Report[_0x14f9('0x11')][_0x14f9('0x12')]=function(_0x258990){var _0x57d1b6=new VoiceQueueReport(this['realtime']);var _0x450afa=new VoiceAgentReport(this[_0x14f9('0x13')]);var _0x220117=new VoiceDialReport(this[_0x14f9('0x13')]);var _0xa7f41a=new VoiceCallReport(this[_0x14f9('0x13')]);var _0x587e0b=new UserReport(this['realtime']);if(config['xdr']&&config[_0x14f9('0x14')][_0x14f9('0x15')]){ami['on'](_0x14f9('0x16'),this[_0x14f9('0x17')]['bind'](this));ami['on'](_0x14f9('0x18'),this[_0x14f9('0x19')]['bind'](this));ami['on'](_0x14f9('0x1a'),this[_0x14f9('0x1b')][_0x14f9('0x1c')](this));ami['on'](_0x14f9('0x1d'),this[_0x14f9('0x1e')][_0x14f9('0x1c')](this));ami['on'](_0x14f9('0x1f'),this[_0x14f9('0x20')][_0x14f9('0x1c')](this));ami['on'](_0x14f9('0x21'),this[_0x14f9('0x22')][_0x14f9('0x1c')](this));}};Report[_0x14f9('0x11')][_0x14f9('0x23')]=function(_0x584d0b){var _0x5a3e1c=undefined;_0x5a3e1c=_[_0x14f9('0x24')](this[_0x14f9('0xf')],function(_0x508be7){return _0x508be7[_0x14f9('0x25')]==_0x584d0b||_0x508be7[_0x14f9('0x26')]==_0x584d0b;});if(_[_0x14f9('0x27')](_0x5a3e1c)){var _0x3d3a79=_[_0x14f9('0x24')](this[_0x14f9('0x10')],function(_0x3f342e){return _0x3f342e[_0x14f9('0x25')]==_0x584d0b||_0x3f342e['name']==_0x584d0b;});if(_0x3d3a79){_0x5a3e1c=_[_0x14f9('0x24')](this[_0x14f9('0xf')],function(_0xaa1629){return _0xaa1629[_0x14f9('0x28')]==util[_0x14f9('0x29')](_0x14f9('0x2a'),_0x3d3a79[_0x14f9('0x26')]);});}}return _0x5a3e1c;};Report[_0x14f9('0x11')]['voiceQueueReport']=function(_0x2a630c){for(var _0x1e80e6=0x0;_0x1e80e6<_0x2a630c[_0x14f9('0x2b')];_0x1e80e6+=0x1){var _0xb4b8c3=this[_0x14f9('0x23')](_0x2a630c[_0x1e80e6]['connectedlinenum']);if(_0xb4b8c3){_0x2a630c[_0x1e80e6][_0x14f9('0x25')]=_0xb4b8c3[_0x14f9('0x25')];_0x2a630c[_0x1e80e6]['assigned']=!![];_0x2a630c[_0x1e80e6][_0x14f9('0x2c')]=_0xb4b8c3[_0x14f9('0x26')];_0x2a630c[_0x1e80e6][_0x14f9('0x28')]=_[_0x14f9('0x27')](_0xb4b8c3[_0x14f9('0x28')])?util[_0x14f9('0x29')](_0x14f9('0x2a'),_0xb4b8c3[_0x14f9('0x26')]):_0xb4b8c3[_0x14f9('0x28')];if(_0x2a630c[_0x1e80e6][_0x14f9('0x2d')]){_0x2a630c[_0x1e80e6][_0x14f9('0x2e')]=moment()['format'](_0x14f9('0x2f'));}if(_0x2a630c[_0x1e80e6]['queuecallerexit']){_0x2a630c[_0x1e80e6][_0x14f9('0x30')]=moment()[_0x14f9('0x29')](_0x14f9('0x2f'));}RpcMemberReport[_0x14f9('0x17')](_0x2a630c[_0x1e80e6]);}RpcVoiceQueueReport[_0x14f9('0x31')](_0x2a630c[_0x1e80e6]);}};function extractCalleridNumber(_0x20ae6b){var _0x54205c=_0x20ae6b[_0x14f9('0x32')](/<(.*?)>/);return _0x54205c?_0x54205c[0x1]:_0x20ae6b;}Report['prototype'][_0x14f9('0x19')]=function(_0x1cf41d){_0x1cf41d[_0x14f9('0x33')]=_0x1cf41d[_0x14f9('0x33')]||_0x1cf41d[_0x14f9('0x34')];if(_0x1cf41d['type']==_0x14f9('0x35')){_0x1cf41d[_0x14f9('0x36')]='queue';_0x1cf41d['lastdata']=_0x1cf41d[_0x14f9('0x37')];if(_0x1cf41d[_0x14f9('0x38')]==_0x14f9('0x39')){_0x1cf41d[_0x14f9('0x25')]='';_0x1cf41d['destination']=extractCalleridNumber(_0x1cf41d[_0x14f9('0x3a')]);}else if(_0x1cf41d[_0x14f9('0x38')]==_0x14f9('0x3b')){if(_0x1cf41d[_0x14f9('0x33')]==_0x14f9('0x3c')){_0x1cf41d[_0x14f9('0x33')]=extractCalleridNumber(_0x1cf41d['calleridpreview']);_0x1cf41d[_0x14f9('0x3d')]=_0x1cf41d[_0x14f9('0x3e')];_0x1cf41d['destinationchannel']=[_0x1cf41d[_0x14f9('0x3f')],_0x1cf41d[_0x14f9('0x3f')]=_0x1cf41d[_0x14f9('0x40')]][0x0];_0x1cf41d[_0x14f9('0x3a')]=_0x1cf41d['calleridpreview'];}else{_0x1cf41d[_0x14f9('0x33')]=_0x1cf41d[_0x14f9('0x3d')];_0x1cf41d[_0x14f9('0x3d')]=_0x1cf41d[_0x14f9('0x3e')];if(_0x1cf41d[_0x14f9('0x41')]==_0x14f9('0x42')){_0x1cf41d['accountcode']=_0x1cf41d[_0x14f9('0x43')];}else{_0x1cf41d['accountcode']='';}}}}else{_0x1cf41d[_0x14f9('0x3a')]=util[_0x14f9('0x29')](_0x14f9('0x44'),_0x1cf41d['calleridname'],_0x1cf41d[_0x14f9('0x3d')]);}RpcVoiceCallReport['create'](_0x1cf41d);if(_0x1cf41d[_0x14f9('0x45')]){for(var _0x17e768=0x0;_0x17e768<_0x1cf41d[_0x14f9('0x46')][_0x14f9('0x2b')];_0x17e768+=0x1){_0x1cf41d['monitorFilename']=_0x1cf41d['monitors'][_0x17e768][_0x14f9('0x47')];_0x1cf41d[_0x14f9('0x48')]=_0x1cf41d['monitors'][_0x17e768][_0x14f9('0x48')];if(_0x1cf41d['exten']=='xcally-motion-preview'){_0x1cf41d[_0x14f9('0x3d')]=_0x1cf41d[_0x14f9('0x43')];_0x1cf41d[_0x14f9('0x49')]=_0x1cf41d['connectedlinename'];_0x1cf41d['connectedlinenum']=_0x1cf41d[_0x14f9('0x25')];_0x1cf41d['connectedlinename']=_0x1cf41d['membername'];_0x1cf41d[_0x14f9('0x34')]=_0x1cf41d[_0x14f9('0x3e')];}else if(_0x1cf41d[_0x14f9('0x34')]==_0x14f9('0x4a')){_0x1cf41d[_0x14f9('0x3d')]=_0x1cf41d[_0x14f9('0x33')];_0x1cf41d[_0x14f9('0x34')]=_0x1cf41d[_0x14f9('0x3e')];}RpcVoiceRecording[_0x14f9('0x31')](_0x1cf41d);}}};Report[_0x14f9('0x11')][_0x14f9('0x1b')]=function(_0xa05eed){if(_['isArray'](_0xa05eed)){_0xa05eed['forEach'](function(_0x521675){RpcVoiceAgentReport[_0x14f9('0x31')](_0x521675);});}else{RpcVoiceAgentReport[_0x14f9('0x31')](_0xa05eed);}};Report['prototype']['voiceDialReport']=function(_0x3f4b08){RpcVoiceDialReport[_0x14f9('0x31')](_0x3f4b08);var _0x185b72=undefined;var _0x2ce2ed=_0x3f4b08[_0x14f9('0x3f')];if(_[_0x14f9('0x4b')](_0x2ce2ed,_0x14f9('0x4c'))){var _0xd577b8=_0x2ce2ed[_0x14f9('0x4d')](_0x2ce2ed[_0x14f9('0x4e')]('/')+0x1,_0x2ce2ed[_0x14f9('0x4e')]('@'));_0x185b72=_[_0x14f9('0x24')](this[_0x14f9('0xf')],function(_0x4d16f8){return _0x4d16f8[_0x14f9('0x4f')]==_0xd577b8||_0x4d16f8[_0x14f9('0x50')]==_0xd577b8||_0x4d16f8['accountcode']==_0xd577b8;});}else{var _0xd577b8=_0x2ce2ed[_0x14f9('0x4d')](_0x2ce2ed[_0x14f9('0x4e')]('/')+0x1,_0x2ce2ed[_0x14f9('0x51')]('-'));_0x185b72=this[_0x14f9('0x23')](_0xd577b8);}if(_0x185b72){_0x3f4b08[_0x14f9('0x28')]=_[_0x14f9('0x27')](_0x185b72[_0x14f9('0x28')])?util[_0x14f9('0x29')]('SIP/%s',_0x185b72[_0x14f9('0x26')]):_0x185b72[_0x14f9('0x28')];_0x3f4b08[_0x14f9('0x52')]=_0x185b72[_0x14f9('0x26')];_0x3f4b08[_0x14f9('0x25')]=_0x185b72[_0x14f9('0x25')];RpcMemberReport[_0x14f9('0x1e')](_0x3f4b08);}};Report['prototype'][_0x14f9('0x20')]=function(_0x5ad87e){RpcVoiceTransferReport[_0x14f9('0x20')](_0x5ad87e);};Report['prototype']['attendedTransfer']=function(_0x3a7732){RpcVoiceTransferReport[_0x14f9('0x22')](_0x3a7732);};module[_0x14f9('0x53')]=Report; \ No newline at end of file +var _0xa20c=['lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','calleridnum','ANSWERED','create','monitor','monitors','length','monitorFilename','filename','createdAt','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','isNil','find','name','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','destination','exten','type'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa20c,0x72));var _0xca20=function(_0x1c4691,_0x158a43){_0x1c4691=_0x1c4691-0x0;var _0xc5f19f=_0xa20c[_0x1c4691];return _0xc5f19f;};'use strict';var BPromise=require(_0xca20('0x0'));var _=require(_0xca20('0x1'));var moment=require(_0xca20('0x2'));var util=require(_0xca20('0x3'));var config=require(_0xca20('0x4'));var logger=require(_0xca20('0x5'))('ami');var ami=require(_0xca20('0x6'));var RpcVoiceAgentReport=require(_0xca20('0x7'));var RpcVoiceCallReport=require(_0xca20('0x8'));var RpcVoiceDialReport=require(_0xca20('0x9'));var RpcMemberReport=require(_0xca20('0xa'));var RpcVoiceQueueReport=require(_0xca20('0xb'));var RpcVoiceRecording=require(_0xca20('0xc'));var RpcVoiceTransferReport=require(_0xca20('0xd'));var VoiceQueueReport=require(_0xca20('0xe'));var VoiceCallReport=require(_0xca20('0xf'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x406524){this[_0xca20('0x10')]=_0x406524;this['agents']=_0x406524[_0xca20('0x11')];this[_0xca20('0x12')]=_0x406524[_0xca20('0x12')];}Report[_0xca20('0x13')][_0xca20('0x14')]=function(_0xf39df1){var _0x534369=new VoiceQueueReport(this['realtime']);var _0x25870a=new VoiceAgentReport(this[_0xca20('0x10')]);var _0xc52cae=new VoiceDialReport(this[_0xca20('0x10')]);var _0x220e02=new VoiceCallReport(this[_0xca20('0x10')]);var _0x1dfbc5=new UserReport(this['realtime']);if(config['xdr']&&config[_0xca20('0x15')][_0xca20('0x16')]){ami['on']('custom:voiceQueueReport',this[_0xca20('0x17')][_0xca20('0x18')](this));ami['on'](_0xca20('0x19'),this[_0xca20('0x1a')][_0xca20('0x18')](this));ami['on'](_0xca20('0x1b'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this[_0xca20('0x1c')][_0xca20('0x18')](this));ami['on'](_0xca20('0x1d'),this[_0xca20('0x1e')][_0xca20('0x18')](this));ami['on'](_0xca20('0x1f'),this[_0xca20('0x20')]['bind'](this));}};Report[_0xca20('0x13')][_0xca20('0x21')]=function(_0x5c2449){var _0x32a8d8=undefined;_0x32a8d8=_['find'](this[_0xca20('0x11')],function(_0x4c8de9){return _0x4c8de9[_0xca20('0x22')]==_0x5c2449||_0x4c8de9['name']==_0x5c2449;});if(_[_0xca20('0x23')](_0x32a8d8)){var _0x714f7f=_[_0xca20('0x24')](this[_0xca20('0x12')],function(_0x31339b){return _0x31339b['accountcode']==_0x5c2449||_0x31339b[_0xca20('0x25')]==_0x5c2449;});if(_0x714f7f){_0x32a8d8=_[_0xca20('0x24')](this['agents'],function(_0x2c1aa4){return _0x2c1aa4[_0xca20('0x26')]==util[_0xca20('0x27')](_0xca20('0x28'),_0x714f7f[_0xca20('0x25')]);});}}return _0x32a8d8;};Report['prototype'][_0xca20('0x17')]=function(_0x5b4d4a){for(var _0x7dca08=0x0;_0x7dca08<_0x5b4d4a['length'];_0x7dca08+=0x1){var _0x3944=this['findAgent'](_0x5b4d4a[_0x7dca08][_0xca20('0x29')]);if(_0x3944){_0x5b4d4a[_0x7dca08]['accountcode']=_0x3944[_0xca20('0x22')];_0x5b4d4a[_0x7dca08][_0xca20('0x2a')]=!![];_0x5b4d4a[_0x7dca08][_0xca20('0x2b')]=_0x3944[_0xca20('0x25')];_0x5b4d4a[_0x7dca08][_0xca20('0x26')]=_['isNil'](_0x3944[_0xca20('0x26')])?util[_0xca20('0x27')]('SIP/%s',_0x3944[_0xca20('0x25')]):_0x3944['interface'];if(_0x5b4d4a[_0x7dca08][_0xca20('0x2c')]){_0x5b4d4a[_0x7dca08][_0xca20('0x2d')]=moment()[_0xca20('0x27')](_0xca20('0x2e'));}if(_0x5b4d4a[_0x7dca08]['queuecallerexit']){_0x5b4d4a[_0x7dca08]['queuecallerexitAt']=moment()[_0xca20('0x27')](_0xca20('0x2e'));}RpcMemberReport[_0xca20('0x17')](_0x5b4d4a[_0x7dca08]);}RpcVoiceQueueReport['create'](_0x5b4d4a[_0x7dca08]);}};function extractCalleridNumber(_0x20ca3f){var _0x256762=_0x20ca3f['match'](/<(.*?)>/);return _0x256762?_0x256762[0x1]:_0x20ca3f;}Report['prototype'][_0xca20('0x1a')]=function(_0x37783f){_0x37783f[_0xca20('0x2f')]=_0x37783f[_0xca20('0x2f')]||_0x37783f[_0xca20('0x30')];if(_0x37783f[_0xca20('0x31')]=='dialer'){_0x37783f[_0xca20('0x32')]=_0xca20('0x33');_0x37783f[_0xca20('0x34')]=_0x37783f[_0xca20('0x33')];if(_0x37783f[_0xca20('0x35')]==_0xca20('0x36')){_0x37783f['accountcode']='';_0x37783f[_0xca20('0x2f')]=extractCalleridNumber(_0x37783f[_0xca20('0x37')]);}else if(_0x37783f['context']==_0xca20('0x38')){if(_0x37783f[_0xca20('0x2f')]==_0xca20('0x39')){_0x37783f[_0xca20('0x2f')]=extractCalleridNumber(_0x37783f['calleridpreview']);_0x37783f['calleridnum']=_0x37783f[_0xca20('0x3a')];_0x37783f[_0xca20('0x3b')]=[_0x37783f[_0xca20('0x3c')],_0x37783f[_0xca20('0x3c')]=_0x37783f['destinationchannel']][0x0];_0x37783f[_0xca20('0x37')]=_0x37783f[_0xca20('0x3d')];}else{_0x37783f['destination']=_0x37783f['calleridnum'];_0x37783f[_0xca20('0x3e')]=_0x37783f[_0xca20('0x3a')];if(_0x37783f['disposition']==_0xca20('0x3f')){_0x37783f[_0xca20('0x22')]=_0x37783f[_0xca20('0x29')];}else{_0x37783f[_0xca20('0x22')]='';}}}}else{_0x37783f[_0xca20('0x37')]=util['format']('\x22%s\x22\x20<%s>',_0x37783f['calleridname'],_0x37783f[_0xca20('0x3e')]);}RpcVoiceCallReport[_0xca20('0x40')](_0x37783f);if(_0x37783f[_0xca20('0x41')]){for(var _0x9ac729=0x0;_0x9ac729<_0x37783f[_0xca20('0x42')][_0xca20('0x43')];_0x9ac729+=0x1){_0x37783f[_0xca20('0x44')]=_0x37783f[_0xca20('0x42')][_0x9ac729][_0xca20('0x45')];_0x37783f[_0xca20('0x46')]=_0x37783f['monitors'][_0x9ac729]['createdAt'];if(_0x37783f[_0xca20('0x30')]==_0xca20('0x39')){_0x37783f[_0xca20('0x3e')]=_0x37783f[_0xca20('0x29')];_0x37783f['calleridname']=_0x37783f['connectedlinename'];_0x37783f[_0xca20('0x29')]=_0x37783f['accountcode'];_0x37783f['connectedlinename']=_0x37783f[_0xca20('0x47')];_0x37783f[_0xca20('0x30')]=_0x37783f[_0xca20('0x3a')];}else if(_0x37783f[_0xca20('0x30')]==_0xca20('0x48')){_0x37783f[_0xca20('0x3e')]=_0x37783f[_0xca20('0x2f')];_0x37783f[_0xca20('0x30')]=_0x37783f[_0xca20('0x3a')];}RpcVoiceRecording[_0xca20('0x40')](_0x37783f);}}};Report[_0xca20('0x13')][_0xca20('0x49')]=function(_0x1f6b62){if(_[_0xca20('0x4a')](_0x1f6b62)){_0x1f6b62[_0xca20('0x4b')](function(_0x3a5960){RpcVoiceAgentReport[_0xca20('0x40')](_0x3a5960);});}else{RpcVoiceAgentReport[_0xca20('0x40')](_0x1f6b62);}};Report[_0xca20('0x13')][_0xca20('0x1c')]=function(_0x3e5a52){RpcVoiceDialReport[_0xca20('0x40')](_0x3e5a52);var _0x1baed6=undefined;var _0x56ec59=_0x3e5a52[_0xca20('0x3c')];if(_[_0xca20('0x4c')](_0x56ec59,'Local')){var _0xe71294=_0x56ec59[_0xca20('0x4d')](_0x56ec59[_0xca20('0x4e')]('/')+0x1,_0x56ec59['indexOf']('@'));_0x1baed6=_[_0xca20('0x24')](this[_0xca20('0x11')],function(_0x20e689){return _0x20e689[_0xca20('0x4f')]==_0xe71294||_0x20e689[_0xca20('0x50')]==_0xe71294||_0x20e689[_0xca20('0x22')]==_0xe71294;});}else{var _0xe71294=_0x56ec59[_0xca20('0x4d')](_0x56ec59[_0xca20('0x4e')]('/')+0x1,_0x56ec59[_0xca20('0x51')]('-'));_0x1baed6=this[_0xca20('0x21')](_0xe71294);}if(_0x1baed6){_0x3e5a52['interface']=_[_0xca20('0x23')](_0x1baed6[_0xca20('0x26')])?util['format']('SIP/%s',_0x1baed6[_0xca20('0x25')]):_0x1baed6[_0xca20('0x26')];_0x3e5a52[_0xca20('0x47')]=_0x1baed6['name'];_0x3e5a52[_0xca20('0x22')]=_0x1baed6[_0xca20('0x22')];RpcMemberReport[_0xca20('0x1c')](_0x3e5a52);}};Report[_0xca20('0x13')][_0xca20('0x1e')]=function(_0x2fd119){RpcVoiceTransferReport[_0xca20('0x1e')](_0x2fd119);};Report['prototype'][_0xca20('0x20')]=function(_0x45d9bc){RpcVoiceTransferReport[_0xca20('0x20')](_0x45d9bc);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index e671bbf..b4f1273 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 _0xc6ff=['mobile','phone','accountcode','syncPeerStatus','peer','registered','status','address','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','peerstatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','isNotNull','isUndefined','emit','find','actionid','username','trunk:%s','name','[syncRegistry][UserReport]','syncDeviceState','device','local','state','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','telephone:save','trunk:save','startsWith','Queue','Local','substring','indexOf'];(function(_0x78776e,_0x47feb5){var _0x3bccb2=function(_0x16cfe0){while(--_0x16cfe0){_0x78776e['push'](_0x78776e['shift']());}};_0x3bccb2(++_0x47feb5);}(_0xc6ff,0x1de));var _0xfc6f=function(_0x17ab73,_0x2231ba){_0x17ab73=_0x17ab73-0x0;var _0x372a20=_0xc6ff[_0x17ab73];return _0x372a20;};'use strict';var _=require(_0xfc6f('0x0'));var moment=require(_0xfc6f('0x1'));var BPromise=require(_0xfc6f('0x2'));var util=require(_0xfc6f('0x3'));var Redis=require(_0xfc6f('0x4'));var config=require(_0xfc6f('0x5'));var logger=require(_0xfc6f('0x6'))(_0xfc6f('0x7'));var ami=require(_0xfc6f('0x8'));config[_0xfc6f('0x9')]=_[_0xfc6f('0xa')](config[_0xfc6f('0x9')],{'host':_0xfc6f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc6f('0x9')]));function UserReport(_0x1d39d3){this[_0xfc6f('0xc')]=_0x1d39d3[_0xfc6f('0xc')];this[_0xfc6f('0xd')]=_0x1d39d3[_0xfc6f('0xd')];this['telephones']=_0x1d39d3[_0xfc6f('0xe')];ami['on'](_0xfc6f('0xf'),this['syncRegistry'][_0xfc6f('0x10')](this));ami['on'](_0xfc6f('0x11'),this[_0xfc6f('0x12')][_0xfc6f('0x10')](this));ami['on'](_0xfc6f('0x13'),this['syncDeviceState'][_0xfc6f('0x10')](this));ami['on'](_0xfc6f('0x14'),this['syncPeerStatus'][_0xfc6f('0x10')](this));this[_0xfc6f('0x15')]();return BPromise[_0xfc6f('0x16')]()[_0xfc6f('0x17')](ami['actionSipShowRegistry']())[_0xfc6f('0x17')](ami[_0xfc6f('0x18')]())[_0xfc6f('0x17')](ami[_0xfc6f('0x19')]())[_0xfc6f('0x1a')](loggerCatch(_0xfc6f('0x1b')));}function loggerCatch(_0x57a322){return function(_0x3daccb){logger[_0xfc6f('0x1c')](_0x57a322,util[_0xfc6f('0x1d')](_0x3daccb,{'showHidden':![],'depth':null}));};}UserReport[_0xfc6f('0x1e')][_0xfc6f('0x15')]=function(){setInterval(function(){BPromise['resolve']()[_0xfc6f('0x17')](ami['actionSipShowRegistry']())['then'](ami[_0xfc6f('0x18')]())[_0xfc6f('0x17')](ami['actionSipPeerStatus']())[_0xfc6f('0x1a')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0xfc6f('0x1f')]=function(_0x17acf5){return _0x17acf5!==null&&!_[_0xfc6f('0x20')](_0x17acf5);};UserReport['prototype'][_0xfc6f('0x21')]=function(_0x341b4d,_0x1e37e9,_0x555f4f){io['to'](_0x341b4d)[_0xfc6f('0x21')](_0x1e37e9,_0x555f4f);};UserReport['prototype'][_0xfc6f('0x12')]=function(_0x5549dc){try{if(this['isNotNull'](_0x5549dc)){var _0x28b7b3=_[_0xfc6f('0x22')](this[_0xfc6f('0xc')],{'registry':_0x5549dc['username']});if(_0x28b7b3){_0x5549dc['stateRegistry']=_0x5549dc['state'];_['merge'](_0x28b7b3,_['omit'](_0x5549dc,['event',_0xfc6f('0x23'),_0xfc6f('0x24'),'state']));this[_0xfc6f('0x21')](util['format'](_0xfc6f('0x25'),_0x28b7b3[_0xfc6f('0x26')]),'trunk:save',_0x28b7b3);}}}catch(_0x2dff64){logger['error'](_0xfc6f('0x27'),util[_0xfc6f('0x1d')](_0x2dff64,{'showHidden':![],'depth':null}));}};UserReport[_0xfc6f('0x1e')][_0xfc6f('0x28')]=function(_0x36570d){try{if(this['isNotNull'](_0x36570d)){if(this[_0xfc6f('0xd')][_0x36570d[_0xfc6f('0x29')]]){if(!this['agents'][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2a')]||_0x36570d[_0xfc6f('0x2b')][_0xfc6f('0x2c')]()==_0xfc6f('0x2d')){this[_0xfc6f('0xd')][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2a')]=![];if(this['agents'][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2b')]!==_0x36570d['state'][_0xfc6f('0x2c')]()){this[_0xfc6f('0xd')][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2e')]=_[_0xfc6f('0x2f')](moment()[_0xfc6f('0x30')]('x'));}this[_0xfc6f('0xd')][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2b')]=_0x36570d[_0xfc6f('0x2b')][_0xfc6f('0x2c')]();this[_0xfc6f('0xd')][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x31')](_0x36570d);}}else if(this[_0xfc6f('0xe')][_0x36570d[_0xfc6f('0x29')]]){if(this[_0xfc6f('0xe')][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2b')]!==_0x36570d[_0xfc6f('0x2b')][_0xfc6f('0x2c')]()){this[_0xfc6f('0xe')][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2e')]=_[_0xfc6f('0x2f')](moment()[_0xfc6f('0x30')]('x'));}this[_0xfc6f('0xe')][_0x36570d['device']][_0xfc6f('0x2b')]=_0x36570d['state'][_0xfc6f('0x2c')]();this[_0xfc6f('0x21')](util[_0xfc6f('0x30')](_0xfc6f('0x32'),this['telephones'][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x26')]),_0xfc6f('0x33'),this['telephones'][_0x36570d['device']]);}else if(this[_0xfc6f('0xc')][_0x36570d[_0xfc6f('0x29')]]){if(this['trunks'][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2b')]!==_0x36570d[_0xfc6f('0x2b')][_0xfc6f('0x2c')]()){this['trunks'][_0x36570d['device']]['stateTime']=_[_0xfc6f('0x2f')](moment()[_0xfc6f('0x30')]('x'));}this['trunks'][_0x36570d[_0xfc6f('0x29')]][_0xfc6f('0x2b')]=_0x36570d['state']['toLowerCase']();this[_0xfc6f('0x21')](util[_0xfc6f('0x30')]('trunk:%s',this[_0xfc6f('0xc')][_0x36570d[_0xfc6f('0x29')]]['name']),_0xfc6f('0x34'),this[_0xfc6f('0xc')][_0x36570d[_0xfc6f('0x29')]]);}else if(_[_0xfc6f('0x35')](_0x36570d[_0xfc6f('0x29')],_0xfc6f('0x36'))){}else if(_[_0xfc6f('0x35')](_0x36570d[_0xfc6f('0x29')],_0xfc6f('0x37'))){var _0xb6811e=_0x36570d['device'];var _0x21ee8c=_0xb6811e[_0xfc6f('0x38')](_0xb6811e[_0xfc6f('0x39')]('/')+0x1,_0xb6811e['indexOf']('@'));var _0x489b79=_[_0xfc6f('0x22')](this[_0xfc6f('0xd')],function(_0xc9b15b){return _0xc9b15b[_0xfc6f('0x3a')]==_0x21ee8c||_0xc9b15b[_0xfc6f('0x3b')]==_0x21ee8c||_0xc9b15b[_0xfc6f('0x3c')]==_0x21ee8c;});if(_0x489b79){if(_0x489b79['state']!==_0x36570d[_0xfc6f('0x2b')][_0xfc6f('0x2c')]()){_0x489b79[_0xfc6f('0x2e')]=_[_0xfc6f('0x2f')](moment()[_0xfc6f('0x30')]('x'));}_0x489b79[_0xfc6f('0x2b')]=_0x36570d['state'][_0xfc6f('0x2c')]();_0x489b79[_0xfc6f('0x2a')]=!![];_0x489b79['updateStatusRealtime'](_0x36570d);}}else{}}}catch(_0xd44b12){logger[_0xfc6f('0x1c')]('[syncDeviceState][UserReport]',util[_0xfc6f('0x1d')](_0xd44b12,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xfc6f('0x3d')]=function(_0xfebf2d){try{if(this['isNotNull'](_0xfebf2d)&&this['isNotNull'](_0xfebf2d[_0xfc6f('0x14')])){if(this[_0xfc6f('0xd')][_0xfebf2d[_0xfc6f('0x3e')]]){if(!this[_0xfc6f('0xd')][_0xfebf2d[_0xfc6f('0x3e')]]['local']||_0xfebf2d[_0xfc6f('0x14')][_0xfc6f('0x2c')]()==_0xfc6f('0x3f')){this[_0xfc6f('0xd')][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x2a')]=![];this[_0xfc6f('0xd')][_0xfebf2d['peer']][_0xfc6f('0x40')]=_0xfebf2d[_0xfc6f('0x14')][_0xfc6f('0x2c')]();this['agents'][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x41')]=_0xfebf2d[_0xfc6f('0x41')];this['agents'][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x31')](_0xfebf2d);}}else if(this['telephones'][_0xfebf2d['peer']]){this[_0xfc6f('0xe')][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x40')]=_0xfebf2d['peerstatus'][_0xfc6f('0x2c')]();this[_0xfc6f('0xe')][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x41')]=_0xfebf2d['address'];this['emit'](util[_0xfc6f('0x30')](_0xfc6f('0x32'),this[_0xfc6f('0xe')][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x26')]),_0xfc6f('0x33'),this[_0xfc6f('0xe')][_0xfebf2d['peer']]);}else if(this['trunks'][_0xfebf2d[_0xfc6f('0x3e')]]){this[_0xfc6f('0xc')][_0xfebf2d[_0xfc6f('0x3e')]]['status']=_0xfebf2d['peerstatus'][_0xfc6f('0x2c')]();this[_0xfc6f('0xc')][_0xfebf2d['peer']][_0xfc6f('0x41')]=_0xfebf2d['address'];this['emit'](util[_0xfc6f('0x30')](_0xfc6f('0x25'),this[_0xfc6f('0xc')][_0xfebf2d[_0xfc6f('0x3e')]][_0xfc6f('0x26')]),'trunk:save',this[_0xfc6f('0xc')][_0xfebf2d[_0xfc6f('0x3e')]]);}else{}}}catch(_0xfecb61){logger[_0xfc6f('0x1c')](_0xfc6f('0x42'),util[_0xfc6f('0x1d')](_0xfecb61,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xaf34=['updateStatusRealtime','telephone:%s','trunk:%s','startsWith','Queue','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','telephone:save','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionSipShowRegistry','isUndefined','emit','isNotNull','find','stateRegistry','state','merge','omit','event','actionid','format','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber'];(function(_0x3577cf,_0x1113e0){var _0x3fa5af=function(_0x33cb6b){while(--_0x33cb6b){_0x3577cf['push'](_0x3577cf['shift']());}};_0x3fa5af(++_0x1113e0);}(_0xaf34,0x9b));var _0x4af3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaf34[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4af3('0x0'));var moment=require(_0x4af3('0x1'));var BPromise=require(_0x4af3('0x2'));var util=require(_0x4af3('0x3'));var Redis=require('ioredis');var config=require(_0x4af3('0x4'));var logger=require(_0x4af3('0x5'))(_0x4af3('0x6'));var ami=require(_0x4af3('0x7'));config[_0x4af3('0x8')]=_[_0x4af3('0x9')](config[_0x4af3('0x8')],{'host':_0x4af3('0xa'),'port':0x18eb});var io=require(_0x4af3('0xb'))(new Redis(config['redis']));function UserReport(_0x1cae96){this[_0x4af3('0xc')]=_0x1cae96[_0x4af3('0xc')];this[_0x4af3('0xd')]=_0x1cae96[_0x4af3('0xd')];this[_0x4af3('0xe')]=_0x1cae96[_0x4af3('0xe')];ami['on']('registryentry',this[_0x4af3('0xf')]['bind'](this));ami['on']('registry',this['syncRegistry'][_0x4af3('0x10')](this));ami['on'](_0x4af3('0x11'),this[_0x4af3('0x12')][_0x4af3('0x10')](this));ami['on'](_0x4af3('0x13'),this[_0x4af3('0x14')][_0x4af3('0x10')](this));this[_0x4af3('0x15')]();return BPromise[_0x4af3('0x16')]()[_0x4af3('0x17')](ami['actionSipShowRegistry']())['then'](ami[_0x4af3('0x18')]())[_0x4af3('0x17')](ami[_0x4af3('0x19')]())[_0x4af3('0x1a')](loggerCatch(_0x4af3('0x1b')));}function loggerCatch(_0x98e1d2){return function(_0x76355e){logger[_0x4af3('0x1c')](_0x98e1d2,util[_0x4af3('0x1d')](_0x76355e,{'showHidden':![],'depth':null}));};}UserReport[_0x4af3('0x1e')][_0x4af3('0x15')]=function(){setInterval(function(){BPromise[_0x4af3('0x16')]()[_0x4af3('0x17')](ami[_0x4af3('0x1f')]())[_0x4af3('0x17')](ami[_0x4af3('0x18')]())['then'](ami[_0x4af3('0x19')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0xdcaf9d){return _0xdcaf9d!==null&&!_[_0x4af3('0x20')](_0xdcaf9d);};UserReport[_0x4af3('0x1e')]['emit']=function(_0x224385,_0x5e8d69,_0x245b47){io['to'](_0x224385)[_0x4af3('0x21')](_0x5e8d69,_0x245b47);};UserReport['prototype'][_0x4af3('0xf')]=function(_0xaa8aa6){try{if(this[_0x4af3('0x22')](_0xaa8aa6)){var _0x8a9066=_[_0x4af3('0x23')](this[_0x4af3('0xc')],{'registry':_0xaa8aa6['username']});if(_0x8a9066){_0xaa8aa6[_0x4af3('0x24')]=_0xaa8aa6[_0x4af3('0x25')];_[_0x4af3('0x26')](_0x8a9066,_[_0x4af3('0x27')](_0xaa8aa6,[_0x4af3('0x28'),_0x4af3('0x29'),'username',_0x4af3('0x25')]));this['emit'](util[_0x4af3('0x2a')]('trunk:%s',_0x8a9066[_0x4af3('0x2b')]),_0x4af3('0x2c'),_0x8a9066);}}}catch(_0xa1e2b){logger[_0x4af3('0x1c')](_0x4af3('0x2d'),util['inspect'](_0xa1e2b,{'showHidden':![],'depth':null}));}};UserReport[_0x4af3('0x1e')][_0x4af3('0x12')]=function(_0x259ca7){try{if(this['isNotNull'](_0x259ca7)){if(this[_0x4af3('0xd')][_0x259ca7['device']]){if(!this['agents'][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x2f')]||_0x259ca7[_0x4af3('0x25')][_0x4af3('0x30')]()==_0x4af3('0x31')){this[_0x4af3('0xd')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x2f')]=![];if(this[_0x4af3('0xd')][_0x259ca7[_0x4af3('0x2e')]]['state']!==_0x259ca7[_0x4af3('0x25')][_0x4af3('0x30')]()){this[_0x4af3('0xd')][_0x259ca7['device']][_0x4af3('0x32')]=_[_0x4af3('0x33')](moment()['format']('x'));}this[_0x4af3('0xd')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x25')]=_0x259ca7[_0x4af3('0x25')]['toLowerCase']();this[_0x4af3('0xd')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x34')](_0x259ca7);}}else if(this['telephones'][_0x259ca7['device']]){if(this[_0x4af3('0xe')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x25')]!==_0x259ca7[_0x4af3('0x25')]['toLowerCase']()){this[_0x4af3('0xe')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x32')]=_[_0x4af3('0x33')](moment()[_0x4af3('0x2a')]('x'));}this[_0x4af3('0xe')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x25')]=_0x259ca7[_0x4af3('0x25')][_0x4af3('0x30')]();this[_0x4af3('0x21')](util[_0x4af3('0x2a')](_0x4af3('0x35'),this[_0x4af3('0xe')][_0x259ca7['device']][_0x4af3('0x2b')]),'telephone:save',this[_0x4af3('0xe')][_0x259ca7[_0x4af3('0x2e')]]);}else if(this[_0x4af3('0xc')][_0x259ca7[_0x4af3('0x2e')]]){if(this[_0x4af3('0xc')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x25')]!==_0x259ca7['state'][_0x4af3('0x30')]()){this[_0x4af3('0xc')][_0x259ca7[_0x4af3('0x2e')]]['stateTime']=_[_0x4af3('0x33')](moment()[_0x4af3('0x2a')]('x'));}this[_0x4af3('0xc')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x25')]=_0x259ca7[_0x4af3('0x25')][_0x4af3('0x30')]();this['emit'](util['format'](_0x4af3('0x36'),this[_0x4af3('0xc')][_0x259ca7[_0x4af3('0x2e')]][_0x4af3('0x2b')]),_0x4af3('0x2c'),this[_0x4af3('0xc')][_0x259ca7['device']]);}else if(_[_0x4af3('0x37')](_0x259ca7[_0x4af3('0x2e')],_0x4af3('0x38'))){}else if(_[_0x4af3('0x37')](_0x259ca7['device'],'Local')){var _0x204890=_0x259ca7[_0x4af3('0x2e')];var _0x3a8ab8=_0x204890[_0x4af3('0x39')](_0x204890[_0x4af3('0x3a')]('/')+0x1,_0x204890['indexOf']('@'));var _0x4e347c=_[_0x4af3('0x23')](this[_0x4af3('0xd')],function(_0x2af920){return _0x2af920[_0x4af3('0x3b')]==_0x3a8ab8||_0x2af920[_0x4af3('0x3c')]==_0x3a8ab8||_0x2af920[_0x4af3('0x3d')]==_0x3a8ab8;});if(_0x4e347c){if(_0x4e347c[_0x4af3('0x25')]!==_0x259ca7[_0x4af3('0x25')][_0x4af3('0x30')]()){_0x4e347c['stateTime']=_[_0x4af3('0x33')](moment()[_0x4af3('0x2a')]('x'));}_0x4e347c[_0x4af3('0x25')]=_0x259ca7[_0x4af3('0x25')][_0x4af3('0x30')]();_0x4e347c[_0x4af3('0x2f')]=!![];_0x4e347c[_0x4af3('0x34')](_0x259ca7);}}else{}}}catch(_0x8aa5ed){logger[_0x4af3('0x1c')](_0x4af3('0x3e'),util[_0x4af3('0x1d')](_0x8aa5ed,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x4af3('0x14')]=function(_0xb690e0){try{if(this['isNotNull'](_0xb690e0)&&this['isNotNull'](_0xb690e0[_0x4af3('0x13')])){if(this[_0x4af3('0xd')][_0xb690e0['peer']]){if(!this['agents'][_0xb690e0[_0x4af3('0x3f')]][_0x4af3('0x2f')]||_0xb690e0[_0x4af3('0x13')][_0x4af3('0x30')]()==_0x4af3('0x40')){this['agents'][_0xb690e0[_0x4af3('0x3f')]][_0x4af3('0x2f')]=![];this['agents'][_0xb690e0[_0x4af3('0x3f')]][_0x4af3('0x41')]=_0xb690e0['peerstatus']['toLowerCase']();this[_0x4af3('0xd')][_0xb690e0['peer']]['address']=_0xb690e0[_0x4af3('0x42')];this[_0x4af3('0xd')][_0xb690e0['peer']][_0x4af3('0x34')](_0xb690e0);}}else if(this[_0x4af3('0xe')][_0xb690e0[_0x4af3('0x3f')]]){this[_0x4af3('0xe')][_0xb690e0[_0x4af3('0x3f')]][_0x4af3('0x41')]=_0xb690e0['peerstatus']['toLowerCase']();this[_0x4af3('0xe')][_0xb690e0[_0x4af3('0x3f')]][_0x4af3('0x42')]=_0xb690e0[_0x4af3('0x42')];this[_0x4af3('0x21')](util['format']('telephone:%s',this[_0x4af3('0xe')][_0xb690e0['peer']][_0x4af3('0x2b')]),_0x4af3('0x43'),this[_0x4af3('0xe')][_0xb690e0[_0x4af3('0x3f')]]);}else if(this[_0x4af3('0xc')][_0xb690e0[_0x4af3('0x3f')]]){this[_0x4af3('0xc')][_0xb690e0[_0x4af3('0x3f')]][_0x4af3('0x41')]=_0xb690e0[_0x4af3('0x13')][_0x4af3('0x30')]();this[_0x4af3('0xc')][_0xb690e0[_0x4af3('0x3f')]]['address']=_0xb690e0[_0x4af3('0x42')];this[_0x4af3('0x21')](util[_0x4af3('0x2a')](_0x4af3('0x36'),this[_0x4af3('0xc')][_0xb690e0['peer']]['name']),_0x4af3('0x2c'),this[_0x4af3('0xc')][_0xb690e0[_0x4af3('0x3f')]]);}else{}}}catch(_0x390201){logger['error'](_0x4af3('0x44'),util['inspect'](_0x390201,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index f27db8a..445d15a 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 _0xbe60=['blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','custom:agentcalled','membername','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','syncAgentRingNoAnswer','rejected','lastevent','custom:agentringnoanswer','error','abandoned','custom:agentqueuecallerabandon','hasOwnProperty','agentconnectAt','complete','talktime','transfer','agent','acw','agentacw','acwtime','acwTimeout','interface','destconnectedlinenum','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','keys','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xbe60,0x1df));var _0x0be6=function(_0x533c9b,_0x54d530){_0x533c9b=_0x533c9b-0x0;var _0x300ab9=_0xbe60[_0x533c9b];return _0x300ab9;};'use strict';var _=require(_0x0be6('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x0be6('0x1'));var config=require(_0x0be6('0x2'));var logger=require(_0x0be6('0x3'))(_0x0be6('0x4'));var ami=require(_0x0be6('0x5'));config[_0x0be6('0x6')]=_[_0x0be6('0x7')](config['redis'],{'host':_0x0be6('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0be6('0x6')]));function VoiceAgentReport(_0x11f5d4){this[_0x0be6('0x9')]={};this[_0x0be6('0xa')]=_0x11f5d4[_0x0be6('0xa')];this['agents']=_0x11f5d4[_0x0be6('0xb')];this[_0x0be6('0xc')]={};ami['on'](_0x0be6('0xd'),this[_0x0be6('0xe')][_0x0be6('0xf')](this));ami['on']('agentconnect',this[_0x0be6('0x10')][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x11'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x0be6('0x12'),this[_0x0be6('0x13')][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x14'),this[_0x0be6('0x15')][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x16'),this['syncVarSet'][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x17'),this['syncHangup'][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x18'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x0be6('0x19'),this[_0x0be6('0x1a')][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x1b'),this[_0x0be6('0x1c')][_0x0be6('0xf')](this));ami['on'](_0x0be6('0x1d'),this[_0x0be6('0x1e')][_0x0be6('0xf')](this));}VoiceAgentReport['prototype'][_0x0be6('0x1f')]=function(_0x3ad2fb,_0x573474,_0x5bf342){io['to'](_0x3ad2fb)[_0x0be6('0x1f')](_0x573474,_0x5bf342);};VoiceAgentReport[_0x0be6('0x20')][_0x0be6('0x21')]=function(_0x337204){return _0x337204!==null&&!_['isUndefined'](_0x337204);};VoiceAgentReport['prototype'][_0x0be6('0xe')]=function(_0x5dcf7c){try{if(this[_0x0be6('0x21')](_0x5dcf7c)){if(_[_0x0be6('0x22')](this[_0x0be6('0x9')][_0x5dcf7c[_0x0be6('0x23')]])){this[_0x0be6('0x9')][_0x5dcf7c['uniqueid']]={};}if(_[_0x0be6('0x22')](this[_0x0be6('0x9')][_0x5dcf7c['uniqueid']][_0x5dcf7c[_0x0be6('0x24')]])){this[_0x0be6('0x9')][_0x5dcf7c[_0x0be6('0x23')]][_0x5dcf7c[_0x0be6('0x24')]]={'agentcalledAt':moment()[_0x0be6('0x25')](_0x0be6('0x26')),'lastevent':_0x0be6('0x27'),'variables':this[_0x0be6('0xc')][_0x5dcf7c[_0x0be6('0x23')]],'type':this['voiceQueues'][_0x5dcf7c['queue']]?this[_0x0be6('0xa')][_0x5dcf7c[_0x0be6('0x28')]][_0x0be6('0x29')]||_0x0be6('0x2a'):_0x0be6('0x2a')};}_[_0x0be6('0x2b')](this[_0x0be6('0x9')][_0x5dcf7c[_0x0be6('0x23')]][_0x5dcf7c[_0x0be6('0x24')]],_[_0x0be6('0x2c')](_0x5dcf7c,[_0x0be6('0x2d'),'privilege']));ami[_0x0be6('0x1f')](_0x0be6('0x2e'),this[_0x0be6('0x9')][_0x5dcf7c[_0x0be6('0x23')]][_0x5dcf7c['destuniqueid']]);this[_0x0be6('0x1f')](util[_0x0be6('0x25')]('user:%s',_0x5dcf7c[_0x0be6('0x2f')]),'user:called',this['channels'][_0x5dcf7c[_0x0be6('0x23')]][_0x5dcf7c[_0x0be6('0x24')]]);}}catch(_0x2dbd9d){logger['error']('[syncAgentCalled][VoiceAgentReport]',util['inspect'](_0x2dbd9d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0be6('0x10')]=function(_0xe5164b){try{if(this[_0x0be6('0x21')](_0xe5164b)){if(this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]]){for(var _0x50947b in this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]]){if(this[_0x0be6('0x9')][_0xe5164b['uniqueid']]['hasOwnProperty'](_0x50947b)){if(_0xe5164b[_0x0be6('0x24')]===_0x50947b){this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b]['agentconnectAt']=moment()[_0x0be6('0x25')](_0x0be6('0x26'));this[_0x0be6('0x9')][_0xe5164b['uniqueid']][_0x50947b]['lastevent']=_0x0be6('0x30');this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x31')]=_0xe5164b[_0x0be6('0x31')];this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x32')]=_0xe5164b[_0x0be6('0x32')];this[_0x0be6('0x9')][_0xe5164b['uniqueid']][_0x50947b][_0x0be6('0x33')]=_0xe5164b[_0x0be6('0x33')];this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x34')]=_0xe5164b[_0x0be6('0x34')];this[_0x0be6('0x9')][_0xe5164b['uniqueid']][_0x50947b][_0x0be6('0x35')]=_0xe5164b[_0x0be6('0x35')];_[_0x0be6('0x2b')](this[_0x0be6('0xb')][_0xe5164b['interface']],_[_0x0be6('0x36')](_0xe5164b,[_0x0be6('0x28'),'destconnectedlinenum']));this[_0x0be6('0x1f')](util['format'](_0x0be6('0x37'),_0xe5164b[_0x0be6('0x2f')]),_0x0be6('0x38'),this[_0x0be6('0x9')][_0xe5164b['uniqueid']][_0xe5164b['destuniqueid']]);ami['emit']('custom:agentconnect',this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b]);}else if(!this['channels'][_0xe5164b[_0x0be6('0x23')]][_0x50947b]['agentringnoanswer']&&!this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b]['agentcomplete']){this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x11')]=!![];this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x39')]=moment()[_0x0be6('0x25')](_0x0be6('0x26'));this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x3a')]=_0x0be6('0x3b');this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b]['lastevent']='answered_elsewhere';this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x3c')]=_0xe5164b[_0x0be6('0x24')];this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b][_0x0be6('0x3d')]=_0xe5164b[_0x0be6('0x2f')];ami[_0x0be6('0x1f')](_0x0be6('0x3e'),this[_0x0be6('0x9')][_0xe5164b[_0x0be6('0x23')]][_0x50947b]);}}}}}}catch(_0x2bece4){logger['error'](_0x0be6('0x3f'),util[_0x0be6('0x40')](_0x2bece4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0be6('0x20')][_0x0be6('0x41')]=function(_0x54e738){try{if(this[_0x0be6('0x21')](_0x54e738)){if(this[_0x0be6('0x9')][_0x54e738[_0x0be6('0x23')]]&&this[_0x0be6('0x9')][_0x54e738[_0x0be6('0x23')]][_0x54e738[_0x0be6('0x24')]]){this[_0x0be6('0x9')][_0x54e738[_0x0be6('0x23')]][_0x54e738[_0x0be6('0x24')]][_0x0be6('0x11')]=!![];this[_0x0be6('0x9')][_0x54e738[_0x0be6('0x23')]][_0x54e738[_0x0be6('0x24')]]['agentringnoanswerAt']=moment()[_0x0be6('0x25')](_0x0be6('0x26'));this['channels'][_0x54e738['uniqueid']][_0x54e738[_0x0be6('0x24')]]['reason']=_0x0be6('0x42');this[_0x0be6('0x9')][_0x54e738['uniqueid']][_0x54e738['destuniqueid']][_0x0be6('0x43')]=_0x0be6('0x42');ami['emit'](_0x0be6('0x44'),this[_0x0be6('0x9')][_0x54e738['uniqueid']][_0x54e738[_0x0be6('0x24')]]);}}}catch(_0x264df){logger[_0x0be6('0x45')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x0be6('0x40')](_0x264df,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0be6('0x20')][_0x0be6('0x13')]=function(_0x3eeee8){try{if(this[_0x0be6('0x21')](_0x3eeee8)){if(this[_0x0be6('0x9')][_0x3eeee8['uniqueid']]){for(var _0x2477b6 in this['channels'][_0x3eeee8[_0x0be6('0x23')]]){if(this[_0x0be6('0x9')][_0x3eeee8[_0x0be6('0x23')]]['hasOwnProperty'](_0x2477b6)&&!this[_0x0be6('0x9')][_0x3eeee8[_0x0be6('0x23')]][_0x2477b6][_0x0be6('0x11')]&&!this[_0x0be6('0x9')][_0x3eeee8['uniqueid']][_0x2477b6]['agentcomplete']){this[_0x0be6('0x9')][_0x3eeee8[_0x0be6('0x23')]][_0x2477b6][_0x0be6('0x11')]=!![];this[_0x0be6('0x9')][_0x3eeee8['uniqueid']][_0x2477b6][_0x0be6('0x39')]=moment()['format'](_0x0be6('0x26'));this[_0x0be6('0x9')][_0x3eeee8['uniqueid']][_0x2477b6][_0x0be6('0x3a')]='abandoned';this[_0x0be6('0x9')][_0x3eeee8[_0x0be6('0x23')]][_0x2477b6][_0x0be6('0x43')]=_0x0be6('0x46');ami['emit'](_0x0be6('0x47'),this[_0x0be6('0x9')][_0x3eeee8[_0x0be6('0x23')]][_0x2477b6]);}}}}}catch(_0x5337db){logger['error']('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x0be6('0x40')](_0x5337db,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0be6('0x20')][_0x0be6('0x15')]=function(_0x5b87bd){try{if(this[_0x0be6('0x21')](_0x5b87bd)){if(this[_0x0be6('0x9')][_0x5b87bd[_0x0be6('0x23')]]){for(var _0x130fd2 in this['channels'][_0x5b87bd['uniqueid']]){if(this[_0x0be6('0x9')][_0x5b87bd['uniqueid']][_0x0be6('0x48')](_0x130fd2)){if(this[_0x0be6('0x9')][_0x5b87bd['uniqueid']][_0x130fd2][_0x0be6('0x49')]&&!this[_0x0be6('0x9')][_0x5b87bd['uniqueid']][_0x130fd2][_0x0be6('0x14')]){this[_0x0be6('0x9')][_0x5b87bd['uniqueid']][_0x130fd2][_0x0be6('0x14')]=!![];this[_0x0be6('0x9')][_0x5b87bd[_0x0be6('0x23')]][_0x130fd2]['agentcompleteAt']=moment()['format'](_0x0be6('0x26'));this[_0x0be6('0x9')][_0x5b87bd[_0x0be6('0x23')]][_0x130fd2][_0x0be6('0x43')]=_0x0be6('0x4a');this[_0x0be6('0x9')][_0x5b87bd[_0x0be6('0x23')]][_0x130fd2][_0x0be6('0x4b')]=_0x5b87bd[_0x0be6('0x4b')];this['channels'][_0x5b87bd['uniqueid']][_0x130fd2]['reason']=_0x5b87bd[_0x0be6('0x3a')]==_0x0be6('0x4c')?_0x0be6('0x4d'):_0x5b87bd[_0x0be6('0x3a')];if(this[_0x0be6('0xa')][_0x5b87bd[_0x0be6('0x28')]]&&this[_0x0be6('0xa')][_0x5b87bd['queue']][_0x0be6('0x4e')]){this[_0x0be6('0x9')][_0x5b87bd[_0x0be6('0x23')]][_0x130fd2][_0x0be6('0x4f')]=!![];this[_0x0be6('0x9')][_0x5b87bd['uniqueid']][_0x130fd2][_0x0be6('0x50')]=this[_0x0be6('0xa')][_0x5b87bd[_0x0be6('0x28')]][_0x0be6('0x51')];}this[_0x0be6('0xb')][_0x5b87bd[_0x0be6('0x52')]]=_[_0x0be6('0x2c')](this['agents'][_0x5b87bd[_0x0be6('0x52')]],[_0x0be6('0x28'),_0x0be6('0x53')]);this['emit'](util[_0x0be6('0x25')]('user:%s',_0x5b87bd[_0x0be6('0x2f')]),_0x0be6('0x54'),this[_0x0be6('0x9')][_0x5b87bd[_0x0be6('0x23')]][_0x130fd2]);ami['emit'](_0x0be6('0x55'),this[_0x0be6('0x9')][_0x5b87bd['uniqueid']][_0x130fd2]);}}}}}}catch(_0x13a209){logger[_0x0be6('0x45')](_0x0be6('0x56'),util['inspect'](_0x13a209,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0be6('0x57')]=function(_0x332855){try{if(this['isNotNull'](_0x332855)){this['addVariable'](_0x332855[_0x0be6('0x23')],_[_0x0be6('0x58')](_0x332855['variable'])[0x0],_0x332855[_0x0be6('0x59')]);if(this[_0x0be6('0x9')][_0x332855[_0x0be6('0x23')]]){for(var _0x5c4d06 in this[_0x0be6('0x9')][_0x332855[_0x0be6('0x23')]]){if(this[_0x0be6('0x9')][_0x332855[_0x0be6('0x23')]]['hasOwnProperty'](_0x5c4d06)){if(_[_0x0be6('0x22')](this[_0x0be6('0x9')][_0x332855[_0x0be6('0x23')]][_0x5c4d06]['variables'])){this['channels'][_0x332855[_0x0be6('0x23')]][_0x5c4d06][_0x0be6('0xc')]={};}this[_0x0be6('0x9')][_0x332855['uniqueid']][_0x5c4d06]['variables']=this['variables'][_0x332855['uniqueid']];}}}}}catch(_0x23d253){logger[_0x0be6('0x45')](_0x0be6('0x5a'),util[_0x0be6('0x40')](_0x23d253,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0be6('0x5b')]=function(_0x408508,_0x8ff69c,_0x272edf){var _0x1bdc81=[_0x0be6('0x5c'),_0x0be6('0x5d'),_0x0be6('0x5e'),_0x0be6('0x5f'),_0x0be6('0x60'),_0x0be6('0x61'),_0x0be6('0x62'),_0x0be6('0x63'),'sipcallid',_0x0be6('0x64'),_0x0be6('0x65'),_0x0be6('0x66'),_0x0be6('0x67'),'memberdynamic',_0x0be6('0x68'),_0x0be6('0x69'),'membername',_0x0be6('0x6a'),_0x0be6('0x6b')];if(!_[_0x0be6('0x6c')](_0x8ff69c)&&!_['includes'](_0x1bdc81,_0x8ff69c)){if(_[_0x0be6('0x22')](this[_0x0be6('0xc')][_0x408508])){this[_0x0be6('0xc')][_0x408508]={};}this[_0x0be6('0xc')][_0x408508][_0x8ff69c]=_0x272edf;}};VoiceAgentReport[_0x0be6('0x20')][_0x0be6('0x6d')]=function(_0x33d4e2){try{if(this['isNotNull'](_0x33d4e2)){if(this[_0x0be6('0x9')][_0x33d4e2['uniqueid']]){for(var _0x415cb0 in this[_0x0be6('0x9')][_0x33d4e2[_0x0be6('0x23')]]){if(this[_0x0be6('0x9')][_0x33d4e2['uniqueid']][_0x0be6('0x48')](_0x415cb0)){if(this['channels'][_0x33d4e2[_0x0be6('0x23')]][_0x415cb0]['reason']==_0x0be6('0x4c')&&this[_0x0be6('0x9')][_0x33d4e2['uniqueid']][_0x415cb0][_0x0be6('0x14')]){this[_0x0be6('0x9')][_0x33d4e2['uniqueid']][_0x415cb0][_0x0be6('0x6e')]=moment()['format'](_0x0be6('0x26'));}}}ami[_0x0be6('0x1f')](_0x0be6('0x6f'),_[_0x0be6('0x70')](this[_0x0be6('0x9')][_0x33d4e2[_0x0be6('0x23')]]));delete this[_0x0be6('0x9')][_0x33d4e2['uniqueid']];}if(this[_0x0be6('0xc')][_0x33d4e2['uniqueid']]){delete this['variables'][_0x33d4e2['uniqueid']];}}}catch(_0x36f1f9){logger[_0x0be6('0x45')](_0x0be6('0x71'),util[_0x0be6('0x40')](_0x36f1f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0be6('0x20')]['syncAttendedTransfer']=function(_0x2af714){try{if(this['isNotNull'](_0x2af714)){if(this[_0x0be6('0x9')][_0x2af714['transfereeuniqueid']]){for(var _0x34e138 in this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x72')]]){if(this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x72')]]['hasOwnProperty'](_0x34e138)){if(_0x2af714[_0x0be6('0x73')]===_0x34e138){var _0x328d5d=moment();this['channels'][_0x2af714[_0x0be6('0x72')]][_0x34e138][_0x0be6('0x14')]=!![];this['channels'][_0x2af714[_0x0be6('0x72')]][_0x34e138][_0x0be6('0x6e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x72')]][_0x34e138][_0x0be6('0x3a')]=_0x0be6('0x4c');this['channels'][_0x2af714[_0x0be6('0x72')]][_0x34e138][_0x0be6('0x43')]='complete';this['channels'][_0x2af714['transfereeuniqueid']][_0x34e138][_0x0be6('0x4b')]=_0x328d5d[_0x0be6('0x74')](this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x72')]][_0x34e138][_0x0be6('0x49')],_0x0be6('0x75'));}}}}if(this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x76')]]){var _0x3b75da=this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x76')]];this['channels'][_0x2af714[_0x0be6('0x76')]]=this[_0x0be6('0x9')][_0x2af714[_0x0be6('0x72')]];this['channels'][_0x2af714['transfereeuniqueid']]=_0x3b75da;}}}catch(_0x486405){logger[_0x0be6('0x45')]('[syncAttendedTransfer][VoiceAgentReport]',util['inspect'](_0x486405,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0be6('0x1e')]=function(_0x2e96b5){try{if(this[_0x0be6('0x21')](_0x2e96b5)){if(this['channels'][_0x2e96b5['transfereeuniqueid']]){for(var _0x4ece70 in this[_0x0be6('0x9')][_0x2e96b5[_0x0be6('0x72')]]){if(this[_0x0be6('0x9')][_0x2e96b5[_0x0be6('0x72')]][_0x0be6('0x48')](_0x4ece70)){if(_0x2e96b5['transfereruniqueid']===_0x4ece70){var _0x491e3f=moment();this[_0x0be6('0x9')][_0x2e96b5[_0x0be6('0x72')]][_0x4ece70][_0x0be6('0x14')]=!![];this[_0x0be6('0x9')][_0x2e96b5[_0x0be6('0x72')]][_0x4ece70][_0x0be6('0x6e')]=_0x491e3f;this[_0x0be6('0x9')][_0x2e96b5[_0x0be6('0x72')]][_0x4ece70][_0x0be6('0x3a')]=_0x0be6('0x4c');this[_0x0be6('0x9')][_0x2e96b5['transfereeuniqueid']][_0x4ece70][_0x0be6('0x43')]=_0x0be6('0x4a');this['channels'][_0x2e96b5[_0x0be6('0x72')]][_0x4ece70][_0x0be6('0x4b')]=_0x491e3f[_0x0be6('0x74')](this[_0x0be6('0x9')][_0x2e96b5[_0x0be6('0x72')]][_0x4ece70][_0x0be6('0x49')],_0x0be6('0x75'));}}}}}}catch(_0x7dc5c){logger['error'](_0x0be6('0x77'),util[_0x0be6('0x40')](_0x7dc5c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0be6('0x20')][_0x0be6('0x78')]=function(_0x46be1e){var _0x4f213d='';try{if(this[_0x0be6('0x21')](_0x46be1e)){if(_0x46be1e[_0x0be6('0x79')]){_0x4f213d=_0x46be1e[_0x0be6('0x79')][_0x0be6('0x7a')](0x0,_0x46be1e[_0x0be6('0x79')]['lastIndexOf']('-'));if(this['agents'][_0x4f213d]){this['agents'][_0x4f213d][_0x0be6('0x7b')]=!![];}}}}catch(_0x29abc0){logger[_0x0be6('0x45')](_0x0be6('0x7c'),util['inspect'](_0x29abc0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0be6('0x1a')]=function(_0x2cfb0c){var _0x4b7af0='';try{if(this[_0x0be6('0x21')](_0x2cfb0c)){if(_0x2cfb0c[_0x0be6('0x79')]){_0x4b7af0=_0x2cfb0c[_0x0be6('0x79')][_0x0be6('0x7a')](0x0,_0x2cfb0c['channel'][_0x0be6('0x7d')]('-'));if(this[_0x0be6('0xb')][_0x4b7af0]){this[_0x0be6('0xb')][_0x4b7af0][_0x0be6('0x7b')]=![];}}}}catch(_0x7e4205){logger[_0x0be6('0x45')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x0be6('0x40')](_0x7e4205,{'showHidden':![],'depth':null}));}};module[_0x0be6('0x7e')]=VoiceAgentReport; \ No newline at end of file +var _0x6d46=['includes','transfer','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','ioredis','../../../config/environment','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','user:agentconnect','custom:agentconnect','agentringnoanswer','agentringnoanswerAt','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','rejected','reason','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','complete','talktime','agent','agentacw','acwtime','destconnectedlinenum','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil'];(function(_0x14d770,_0x41b389){var _0x4283a5=function(_0x1bc6e7){while(--_0x1bc6e7){_0x14d770['push'](_0x14d770['shift']());}};_0x4283a5(++_0x41b389);}(_0x6d46,0xfc));var _0x66d4=function(_0x32f78b,_0x178f58){_0x32f78b=_0x32f78b-0x0;var _0x51d847=_0x6d46[_0x32f78b];return _0x51d847;};'use strict';var _=require(_0x66d4('0x0'));var moment=require(_0x66d4('0x1'));var util=require('util');var Redis=require(_0x66d4('0x2'));var config=require(_0x66d4('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x66d4('0x4'));config[_0x66d4('0x5')]=_[_0x66d4('0x6')](config[_0x66d4('0x5')],{'host':_0x66d4('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x66d4('0x5')]));function VoiceAgentReport(_0x4215d8){this[_0x66d4('0x8')]={};this[_0x66d4('0x9')]=_0x4215d8[_0x66d4('0x9')];this[_0x66d4('0xa')]=_0x4215d8[_0x66d4('0xa')];this[_0x66d4('0xb')]={};ami['on'](_0x66d4('0xc'),this[_0x66d4('0xd')][_0x66d4('0xe')](this));ami['on']('agentconnect',this[_0x66d4('0xf')][_0x66d4('0xe')](this));ami['on']('agentringnoanswer',this[_0x66d4('0x10')]['bind'](this));ami['on'](_0x66d4('0x11'),this['syncQueueCallerAbandon'][_0x66d4('0xe')](this));ami['on'](_0x66d4('0x12'),this[_0x66d4('0x13')][_0x66d4('0xe')](this));ami['on']('varset',this[_0x66d4('0x14')][_0x66d4('0xe')](this));ami['on']('hangup',this[_0x66d4('0x15')]['bind'](this));ami['on'](_0x66d4('0x16'),this[_0x66d4('0x17')][_0x66d4('0xe')](this));ami['on'](_0x66d4('0x18'),this['syncMusicOnHoldStop']['bind'](this));ami['on']('attendedtransfer',this[_0x66d4('0x19')]['bind'](this));ami['on']('blindtransfer',this[_0x66d4('0x1a')][_0x66d4('0xe')](this));}VoiceAgentReport[_0x66d4('0x1b')][_0x66d4('0x1c')]=function(_0x2f768a,_0xabe74a,_0xf684ea){io['to'](_0x2f768a)['emit'](_0xabe74a,_0xf684ea);};VoiceAgentReport[_0x66d4('0x1b')][_0x66d4('0x1d')]=function(_0x4d91b1){return _0x4d91b1!==null&&!_[_0x66d4('0x1e')](_0x4d91b1);};VoiceAgentReport[_0x66d4('0x1b')][_0x66d4('0xd')]=function(_0x29fd99){try{if(this[_0x66d4('0x1d')](_0x29fd99)){if(_[_0x66d4('0x1e')](this['channels'][_0x29fd99[_0x66d4('0x1f')]])){this[_0x66d4('0x8')][_0x29fd99[_0x66d4('0x1f')]]={};}if(_[_0x66d4('0x1e')](this[_0x66d4('0x8')][_0x29fd99['uniqueid']][_0x29fd99[_0x66d4('0x20')]])){this[_0x66d4('0x8')][_0x29fd99['uniqueid']][_0x29fd99[_0x66d4('0x20')]]={'agentcalledAt':moment()[_0x66d4('0x21')](_0x66d4('0x22')),'lastevent':_0x66d4('0x23'),'variables':this[_0x66d4('0xb')][_0x29fd99['uniqueid']],'type':this[_0x66d4('0x9')][_0x29fd99[_0x66d4('0x24')]]?this[_0x66d4('0x9')][_0x29fd99[_0x66d4('0x24')]]['type']||_0x66d4('0x25'):'inbound'};}_[_0x66d4('0x26')](this[_0x66d4('0x8')][_0x29fd99[_0x66d4('0x1f')]][_0x29fd99[_0x66d4('0x20')]],_[_0x66d4('0x27')](_0x29fd99,['event','privilege']));ami[_0x66d4('0x1c')](_0x66d4('0x28'),this[_0x66d4('0x8')][_0x29fd99[_0x66d4('0x1f')]][_0x29fd99[_0x66d4('0x20')]]);this[_0x66d4('0x1c')](util[_0x66d4('0x21')](_0x66d4('0x29'),_0x29fd99[_0x66d4('0x2a')]),_0x66d4('0x2b'),this[_0x66d4('0x8')][_0x29fd99[_0x66d4('0x1f')]][_0x29fd99[_0x66d4('0x20')]]);}}catch(_0x46c307){logger[_0x66d4('0x2c')](_0x66d4('0x2d'),util[_0x66d4('0x2e')](_0x46c307,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x66d4('0x1b')][_0x66d4('0xf')]=function(_0x43097b){try{if(this[_0x66d4('0x1d')](_0x43097b)){if(this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]]){for(var _0x4fa3bc in this['channels'][_0x43097b[_0x66d4('0x1f')]]){if(this[_0x66d4('0x8')][_0x43097b['uniqueid']][_0x66d4('0x2f')](_0x4fa3bc)){if(_0x43097b[_0x66d4('0x20')]===_0x4fa3bc){this['channels'][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc][_0x66d4('0x30')]=moment()[_0x66d4('0x21')](_0x66d4('0x22'));this['channels'][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]['lastevent']=_0x66d4('0x31');this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc][_0x66d4('0x32')]=_0x43097b[_0x66d4('0x32')];this['channels'][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]['connectedlinenum']=_0x43097b[_0x66d4('0x33')];this['channels'][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]['connectedlinename']=_0x43097b[_0x66d4('0x34')];this[_0x66d4('0x8')][_0x43097b['uniqueid']][_0x4fa3bc][_0x66d4('0x35')]=_0x43097b[_0x66d4('0x35')];this[_0x66d4('0x8')][_0x43097b['uniqueid']][_0x4fa3bc][_0x66d4('0x36')]=_0x43097b[_0x66d4('0x36')];_['merge'](this[_0x66d4('0xa')][_0x43097b[_0x66d4('0x37')]],_[_0x66d4('0x38')](_0x43097b,[_0x66d4('0x24'),'destconnectedlinenum']));this[_0x66d4('0x1c')](util[_0x66d4('0x21')]('user:%s',_0x43097b[_0x66d4('0x2a')]),_0x66d4('0x39'),this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x43097b['destuniqueid']]);ami[_0x66d4('0x1c')](_0x66d4('0x3a'),this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]);}else if(!this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc][_0x66d4('0x3b')]&&!this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]['agentcomplete']){this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc][_0x66d4('0x3b')]=!![];this[_0x66d4('0x8')][_0x43097b['uniqueid']][_0x4fa3bc][_0x66d4('0x3c')]=moment()[_0x66d4('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]['reason']='answered_elsewhere';this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc][_0x66d4('0x3d')]=_0x66d4('0x3e');this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc][_0x66d4('0x3f')]=_0x43097b[_0x66d4('0x20')];this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]['answeredelsewheremembername']=_0x43097b['membername'];ami['emit'](_0x66d4('0x40'),this[_0x66d4('0x8')][_0x43097b[_0x66d4('0x1f')]][_0x4fa3bc]);}}}}}}catch(_0x3ba2c9){logger[_0x66d4('0x2c')]('[syncAgentConnect][VoiceAgentReport]',util[_0x66d4('0x2e')](_0x3ba2c9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x66d4('0x10')]=function(_0x175f7d){try{if(this[_0x66d4('0x1d')](_0x175f7d)){if(this['channels'][_0x175f7d[_0x66d4('0x1f')]]&&this['channels'][_0x175f7d[_0x66d4('0x1f')]][_0x175f7d[_0x66d4('0x20')]]){this[_0x66d4('0x8')][_0x175f7d[_0x66d4('0x1f')]][_0x175f7d['destuniqueid']][_0x66d4('0x3b')]=!![];this[_0x66d4('0x8')][_0x175f7d[_0x66d4('0x1f')]][_0x175f7d[_0x66d4('0x20')]][_0x66d4('0x3c')]=moment()[_0x66d4('0x21')](_0x66d4('0x22'));this['channels'][_0x175f7d[_0x66d4('0x1f')]][_0x175f7d[_0x66d4('0x20')]]['reason']=_0x66d4('0x41');this[_0x66d4('0x8')][_0x175f7d[_0x66d4('0x1f')]][_0x175f7d['destuniqueid']][_0x66d4('0x3d')]=_0x66d4('0x41');ami[_0x66d4('0x1c')]('custom:agentringnoanswer',this[_0x66d4('0x8')][_0x175f7d[_0x66d4('0x1f')]][_0x175f7d['destuniqueid']]);}}}catch(_0xb85ab5){logger[_0x66d4('0x2c')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x66d4('0x2e')](_0xb85ab5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x66d4('0x1b')]['syncQueueCallerAbandon']=function(_0x54c457){try{if(this['isNotNull'](_0x54c457)){if(this['channels'][_0x54c457[_0x66d4('0x1f')]]){for(var _0x3875b8 in this[_0x66d4('0x8')][_0x54c457['uniqueid']]){if(this['channels'][_0x54c457[_0x66d4('0x1f')]][_0x66d4('0x2f')](_0x3875b8)&&!this[_0x66d4('0x8')][_0x54c457['uniqueid']][_0x3875b8][_0x66d4('0x3b')]&&!this[_0x66d4('0x8')][_0x54c457[_0x66d4('0x1f')]][_0x3875b8][_0x66d4('0x12')]){this[_0x66d4('0x8')][_0x54c457[_0x66d4('0x1f')]][_0x3875b8][_0x66d4('0x3b')]=!![];this[_0x66d4('0x8')][_0x54c457[_0x66d4('0x1f')]][_0x3875b8][_0x66d4('0x3c')]=moment()[_0x66d4('0x21')](_0x66d4('0x22'));this[_0x66d4('0x8')][_0x54c457[_0x66d4('0x1f')]][_0x3875b8][_0x66d4('0x42')]=_0x66d4('0x43');this[_0x66d4('0x8')][_0x54c457[_0x66d4('0x1f')]][_0x3875b8][_0x66d4('0x3d')]=_0x66d4('0x43');ami[_0x66d4('0x1c')]('custom:agentqueuecallerabandon',this[_0x66d4('0x8')][_0x54c457[_0x66d4('0x1f')]][_0x3875b8]);}}}}}catch(_0xd1ce7d){logger[_0x66d4('0x2c')](_0x66d4('0x44'),util[_0x66d4('0x2e')](_0xd1ce7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x66d4('0x13')]=function(_0x17e3f0){try{if(this['isNotNull'](_0x17e3f0)){if(this['channels'][_0x17e3f0[_0x66d4('0x1f')]]){for(var _0x131bec in this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]]){if(this[_0x66d4('0x8')][_0x17e3f0['uniqueid']]['hasOwnProperty'](_0x131bec)){if(this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x30')]&&!this['channels'][_0x17e3f0['uniqueid']][_0x131bec]['agentcomplete']){this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x12')]=!![];this['channels'][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec]['agentcompleteAt']=moment()[_0x66d4('0x21')](_0x66d4('0x22'));this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x3d')]=_0x66d4('0x45');this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x46')]=_0x17e3f0['talktime'];this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x42')]=_0x17e3f0[_0x66d4('0x42')]=='transfer'?_0x66d4('0x47'):_0x17e3f0['reason'];if(this[_0x66d4('0x9')][_0x17e3f0[_0x66d4('0x24')]]&&this['voiceQueues'][_0x17e3f0[_0x66d4('0x24')]]['acw']){this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x48')]=!![];this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec][_0x66d4('0x49')]=this[_0x66d4('0x9')][_0x17e3f0[_0x66d4('0x24')]]['acwTimeout'];}this[_0x66d4('0xa')][_0x17e3f0[_0x66d4('0x37')]]=_[_0x66d4('0x27')](this[_0x66d4('0xa')][_0x17e3f0[_0x66d4('0x37')]],[_0x66d4('0x24'),_0x66d4('0x4a')]);this[_0x66d4('0x1c')](util[_0x66d4('0x21')](_0x66d4('0x29'),_0x17e3f0[_0x66d4('0x2a')]),'user:agentcomplete',this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec]);ami['emit'](_0x66d4('0x4b'),this[_0x66d4('0x8')][_0x17e3f0[_0x66d4('0x1f')]][_0x131bec]);}}}}}}catch(_0x5a0856){logger[_0x66d4('0x2c')](_0x66d4('0x4c'),util[_0x66d4('0x2e')](_0x5a0856,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x66d4('0x14')]=function(_0x3567a5){try{if(this[_0x66d4('0x1d')](_0x3567a5)){this[_0x66d4('0x4d')](_0x3567a5[_0x66d4('0x1f')],_[_0x66d4('0x4e')](_0x3567a5[_0x66d4('0x4f')])[0x0],_0x3567a5['value']);if(this[_0x66d4('0x8')][_0x3567a5['uniqueid']]){for(var _0x56426a in this['channels'][_0x3567a5[_0x66d4('0x1f')]]){if(this[_0x66d4('0x8')][_0x3567a5['uniqueid']][_0x66d4('0x2f')](_0x56426a)){if(_[_0x66d4('0x1e')](this[_0x66d4('0x8')][_0x3567a5[_0x66d4('0x1f')]][_0x56426a]['variables'])){this[_0x66d4('0x8')][_0x3567a5[_0x66d4('0x1f')]][_0x56426a][_0x66d4('0xb')]={};}this[_0x66d4('0x8')][_0x3567a5['uniqueid']][_0x56426a][_0x66d4('0xb')]=this[_0x66d4('0xb')][_0x3567a5[_0x66d4('0x1f')]];}}}}}catch(_0x5499c5){logger['error'](_0x66d4('0x50'),util[_0x66d4('0x2e')](_0x5499c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x66d4('0x4d')]=function(_0x3a018b,_0x5c4719,_0x46c476){var _0x488af3=[_0x66d4('0x51'),'rtpaudioqosbridged',_0x66d4('0x52'),'rtpaudioqosjitterbridged',_0x66d4('0x53'),_0x66d4('0x54'),_0x66d4('0x55'),'rtpaudioqosrttbridged','sipcallid',_0x66d4('0x56'),_0x66d4('0x57'),_0x66d4('0x58'),_0x66d4('0x59'),_0x66d4('0x5a'),_0x66d4('0x5b'),_0x66d4('0x5c'),_0x66d4('0x2a'),_0x66d4('0x5d'),_0x66d4('0x5e')];if(!_[_0x66d4('0x5f')](_0x5c4719)&&!_[_0x66d4('0x60')](_0x488af3,_0x5c4719)){if(_['isUndefined'](this[_0x66d4('0xb')][_0x3a018b])){this['variables'][_0x3a018b]={};}this[_0x66d4('0xb')][_0x3a018b][_0x5c4719]=_0x46c476;}};VoiceAgentReport['prototype'][_0x66d4('0x15')]=function(_0x434fb7){try{if(this[_0x66d4('0x1d')](_0x434fb7)){if(this[_0x66d4('0x8')][_0x434fb7[_0x66d4('0x1f')]]){for(var _0x34c33f in this[_0x66d4('0x8')][_0x434fb7[_0x66d4('0x1f')]]){if(this[_0x66d4('0x8')][_0x434fb7[_0x66d4('0x1f')]][_0x66d4('0x2f')](_0x34c33f)){if(this[_0x66d4('0x8')][_0x434fb7['uniqueid']][_0x34c33f]['reason']==_0x66d4('0x61')&&this[_0x66d4('0x8')][_0x434fb7[_0x66d4('0x1f')]][_0x34c33f][_0x66d4('0x12')]){this[_0x66d4('0x8')][_0x434fb7[_0x66d4('0x1f')]][_0x34c33f]['agentcompleteAt']=moment()['format'](_0x66d4('0x22'));}}}ami[_0x66d4('0x1c')](_0x66d4('0x62'),_[_0x66d4('0x63')](this[_0x66d4('0x8')][_0x434fb7[_0x66d4('0x1f')]]));delete this[_0x66d4('0x8')][_0x434fb7['uniqueid']];}if(this[_0x66d4('0xb')][_0x434fb7[_0x66d4('0x1f')]]){delete this[_0x66d4('0xb')][_0x434fb7[_0x66d4('0x1f')]];}}}catch(_0x17039){logger[_0x66d4('0x2c')](_0x66d4('0x64'),util['inspect'](_0x17039,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x66d4('0x19')]=function(_0x501ad4){try{if(this[_0x66d4('0x1d')](_0x501ad4)){if(this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]]){for(var _0x484741 in this['channels'][_0x501ad4[_0x66d4('0x65')]]){if(this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]][_0x66d4('0x2f')](_0x484741)){if(_0x501ad4[_0x66d4('0x66')]===_0x484741){var _0x49a8f8=moment();this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]][_0x484741][_0x66d4('0x12')]=!![];this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]][_0x484741][_0x66d4('0x67')]=moment()[_0x66d4('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]][_0x484741][_0x66d4('0x42')]='transfer';this['channels'][_0x501ad4[_0x66d4('0x65')]][_0x484741][_0x66d4('0x3d')]=_0x66d4('0x45');this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]][_0x484741][_0x66d4('0x46')]=_0x49a8f8[_0x66d4('0x68')](this['channels'][_0x501ad4[_0x66d4('0x65')]][_0x484741][_0x66d4('0x30')],_0x66d4('0x69'));}}}}if(this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x6a')]]){var _0x2ff64c=this['channels'][_0x501ad4[_0x66d4('0x6a')]];this['channels'][_0x501ad4[_0x66d4('0x6a')]]=this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]];this[_0x66d4('0x8')][_0x501ad4[_0x66d4('0x65')]]=_0x2ff64c;}}}catch(_0x4403a7){logger['error']('[syncAttendedTransfer][VoiceAgentReport]',util[_0x66d4('0x2e')](_0x4403a7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x66d4('0x1b')]['syncBlindTransfer']=function(_0x4567fb){try{if(this['isNotNull'](_0x4567fb)){if(this[_0x66d4('0x8')][_0x4567fb['transfereeuniqueid']]){for(var _0x271e0b in this['channels'][_0x4567fb[_0x66d4('0x65')]]){if(this['channels'][_0x4567fb['transfereeuniqueid']][_0x66d4('0x2f')](_0x271e0b)){if(_0x4567fb['transfereruniqueid']===_0x271e0b){var _0x1cc2c7=moment();this[_0x66d4('0x8')][_0x4567fb[_0x66d4('0x65')]][_0x271e0b]['agentcomplete']=!![];this['channels'][_0x4567fb[_0x66d4('0x65')]][_0x271e0b][_0x66d4('0x67')]=_0x1cc2c7;this['channels'][_0x4567fb[_0x66d4('0x65')]][_0x271e0b][_0x66d4('0x42')]=_0x66d4('0x61');this[_0x66d4('0x8')][_0x4567fb[_0x66d4('0x65')]][_0x271e0b]['lastevent']=_0x66d4('0x45');this[_0x66d4('0x8')][_0x4567fb[_0x66d4('0x65')]][_0x271e0b][_0x66d4('0x46')]=_0x1cc2c7[_0x66d4('0x68')](this[_0x66d4('0x8')][_0x4567fb[_0x66d4('0x65')]][_0x271e0b][_0x66d4('0x30')],_0x66d4('0x69'));}}}}}}catch(_0x2d8ed6){logger[_0x66d4('0x2c')](_0x66d4('0x6b'),util[_0x66d4('0x2e')](_0x2d8ed6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x66d4('0x1b')]['syncMusicOnHoldStart']=function(_0x37bcb1){var _0xb24333='';try{if(this[_0x66d4('0x1d')](_0x37bcb1)){if(_0x37bcb1[_0x66d4('0x6c')]){_0xb24333=_0x37bcb1[_0x66d4('0x6c')][_0x66d4('0x6d')](0x0,_0x37bcb1[_0x66d4('0x6c')][_0x66d4('0x6e')]('-'));if(this[_0x66d4('0xa')][_0xb24333]){this[_0x66d4('0xa')][_0xb24333][_0x66d4('0x6f')]=!![];}}}}catch(_0x234a41){logger['error'](_0x66d4('0x70'),util[_0x66d4('0x2e')](_0x234a41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x66d4('0x1b')][_0x66d4('0x71')]=function(_0xabff04){var _0x5e885d='';try{if(this[_0x66d4('0x1d')](_0xabff04)){if(_0xabff04[_0x66d4('0x6c')]){_0x5e885d=_0xabff04[_0x66d4('0x6c')][_0x66d4('0x6d')](0x0,_0xabff04[_0x66d4('0x6c')][_0x66d4('0x6e')]('-'));if(this[_0x66d4('0xa')][_0x5e885d]){this[_0x66d4('0xa')][_0x5e885d][_0x66d4('0x6f')]=![];}}}}catch(_0x4081fa){logger[_0x66d4('0x2c')](_0x66d4('0x72'),util[_0x66d4('0x2e')](_0x4081fa,{'showHidden':![],'depth':null}));}};module[_0x66d4('0x73')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 4715abe..d59cb0d 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 _0xc0f5=['replace','.wav49','.WAV','monitorFilename','find','monitors','OutgoingSpoolFailed','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','sipcallid','parse','sipcalllinkedid','endtime','billableseconds','answertime','omit','user:agentcomplete','accountcode','[syncHangup][VoiceCallReport]','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','moment','util','path','ioredis','../model/channel','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newexten','bind','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','catch','log','prototype','isNotNull','emit','linkedid','isUndefined','uniqueid','pick','[syncNewCallerId][VoiceCallReport]','channel','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','merge','context','from-sip','destconnectedlinenum','format','split','name','user:agentconnect','exten','error','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','starttime','duration','seconds','keys','includes','lastdata','cdr(','match','[syncNewExten][VoiceCallReport]','inspect','syncNewState','channelstate','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith'];(function(_0x2b68fc,_0x10362e){var _0x2e3490=function(_0x13052e){while(--_0x13052e){_0x2b68fc['push'](_0x2b68fc['shift']());}};_0x2e3490(++_0x10362e);}(_0xc0f5,0xbf));var _0x5c0f=function(_0x229c05,_0x5d9901){_0x229c05=_0x229c05-0x0;var _0x5d1587=_0xc0f5[_0x229c05];return _0x5d1587;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x5c0f('0x0'));var util=require(_0x5c0f('0x1'));var path=require(_0x5c0f('0x2'));var Redis=require(_0x5c0f('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');var Channel=require(_0x5c0f('0x4'));var statusDesc=[_0x5c0f('0x5'),_0x5c0f('0x6'),_0x5c0f('0x7'),'busy',_0x5c0f('0x8'),_0x5c0f('0x9'),_0x5c0f('0xa'),_0x5c0f('0xb'),_0x5c0f('0xc')];var applications=[_0x5c0f('0xd'),_0x5c0f('0xe'),_0x5c0f('0xf'),_0x5c0f('0x10'),'playback',_0x5c0f('0x11')];var dispositions=['NO\x20ANSWER',_0x5c0f('0x12'),_0x5c0f('0x12'),'NO\x20ANSWER',_0x5c0f('0x13'),'NO\x20ANSWER',_0x5c0f('0x14'),_0x5c0f('0x15'),'FAILED',_0x5c0f('0x12'),'FAILED'];var actions={};config[_0x5c0f('0x16')]=_['defaults'](config[_0x5c0f('0x16')],{'host':_0x5c0f('0x17'),'port':0x18eb});var io=require(_0x5c0f('0x18'))(new Redis(config[_0x5c0f('0x16')]));function VoiceCallReport(_0x21facc){this[_0x5c0f('0x19')]=_0x21facc[_0x5c0f('0x19')];this['agents']=_0x21facc[_0x5c0f('0x1a')];ami['on'](_0x5c0f('0x1b'),this[_0x5c0f('0x1c')]['bind'](this));ami['on'](_0x5c0f('0x1d'),this[_0x5c0f('0x1c')][_0x5c0f('0x1e')](this));ami['on']('newchannel',this[_0x5c0f('0x1f')][_0x5c0f('0x1e')](this));ami['on'](_0x5c0f('0x20'),this['syncNewState']['bind'](this));ami['on']('varset',this[_0x5c0f('0x21')][_0x5c0f('0x1e')](this));ami['on'](_0x5c0f('0x22'),this[_0x5c0f('0x23')][_0x5c0f('0x1e')](this));ami['on']('newcallerid',this[_0x5c0f('0x24')][_0x5c0f('0x1e')](this));ami['on']('attendedtransfer',this[_0x5c0f('0x25')][_0x5c0f('0x1e')](this));ami['on'](_0x5c0f('0x26'),this['syncBlindTransfer'][_0x5c0f('0x1e')](this));ami['on']('musiconholdstart',this[_0x5c0f('0x27')][_0x5c0f('0x1e')](this));ami['on']('musiconholdstop',this[_0x5c0f('0x28')][_0x5c0f('0x1e')](this));return BPromise[_0x5c0f('0x29')]()[_0x5c0f('0x2a')](ami['actionCoreShowChannels']())[_0x5c0f('0x2b')](function(_0x4fe874){console[_0x5c0f('0x2c')](_0x4fe874);});}VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x2e')]=function(_0x1bbd5c){return _0x1bbd5c!==null&&!_['isUndefined'](_0x1bbd5c);};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x2f')]=function(_0x5222fc,_0xd34574,_0x2d18f7){io['to'](_0x5222fc)[_0x5c0f('0x2f')](_0xd34574,_0x2d18f7);};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x24')]=function(_0x233a01){try{if(this[_0x5c0f('0x2e')](_0x233a01)){if(_0x233a01['uniqueid']===_0x233a01[_0x5c0f('0x30')]){if(!_[_0x5c0f('0x31')](this['channels'][_0x233a01[_0x5c0f('0x32')]])){_['merge'](this['channels'][_0x233a01[_0x5c0f('0x32')]],_[_0x5c0f('0x33')](_0x233a01,_['keys'](this[_0x5c0f('0x19')][_0x233a01[_0x5c0f('0x32')]])));}}}}catch(_0xfda21b){logger['error'](_0x5c0f('0x34'),util['inspect'](_0xfda21b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')]['syncNewChannel']=function(_0x43ddf8){try{if(this[_0x5c0f('0x2e')](_0x43ddf8)){if(_0x43ddf8[_0x5c0f('0x32')]===_0x43ddf8[_0x5c0f('0x30')]&&_0x43ddf8[_0x5c0f('0x35')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this['channels'][_0x43ddf8['uniqueid']])){this[_0x5c0f('0x19')][_0x43ddf8[_0x5c0f('0x32')]]=new Channel();this[_0x5c0f('0x19')][_0x43ddf8['uniqueid']]['starttime']=moment()['format'](_0x5c0f('0x36'));this[_0x5c0f('0x19')][_0x43ddf8['uniqueid']][_0x5c0f('0x37')]=dispositions[_[_0x5c0f('0x38')](_0x43ddf8['channelstate'])];_[_0x5c0f('0x39')](this[_0x5c0f('0x19')][_0x43ddf8[_0x5c0f('0x32')]],_[_0x5c0f('0x33')](_0x43ddf8,_['keys'](this[_0x5c0f('0x19')][_0x43ddf8[_0x5c0f('0x32')]])));if(_0x43ddf8[_0x5c0f('0x3a')]===_0x5c0f('0x3b')){if(this[_0x5c0f('0x1a')][_0x43ddf8[_0x5c0f('0x35')]['split']('-')[0x0]]){this[_0x5c0f('0x1a')][_0x43ddf8[_0x5c0f('0x35')]['split']('-')[0x0]][_0x5c0f('0x3c')]=_0x43ddf8['exten'];this['emit'](util[_0x5c0f('0x3d')]('user:%s',this[_0x5c0f('0x1a')][_0x43ddf8[_0x5c0f('0x35')][_0x5c0f('0x3e')]('-')[0x0]][_0x5c0f('0x3f')]),_0x5c0f('0x40'),{'destaccountcode':this['agents'][_0x43ddf8[_0x5c0f('0x35')][_0x5c0f('0x3e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x43ddf8[_0x5c0f('0x41')]});}}}}}}catch(_0x25009a){logger[_0x5c0f('0x42')](_0x5c0f('0x43'),util['inspect'](_0x25009a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5c0f('0x1c')]=function(_0x20ba93){try{if(this['isNotNull'](_0x20ba93)){if(_0x20ba93[_0x5c0f('0x32')]===_0x20ba93[_0x5c0f('0x30')]&&_0x20ba93[_0x5c0f('0x41')]!='h'&&_0x20ba93[_0x5c0f('0x35')]!='OutgoingSpoolFailed'){_0x20ba93[_0x5c0f('0x44')]=_0x20ba93['application'][_0x5c0f('0x45')]();_0x20ba93['applicationdata']=(_0x20ba93[_0x5c0f('0x46')]||_0x20ba93[_0x5c0f('0x47')])['toLowerCase']();if(_[_0x5c0f('0x31')](this[_0x5c0f('0x19')][_0x20ba93[_0x5c0f('0x32')]])){this[_0x5c0f('0x19')][_0x20ba93[_0x5c0f('0x32')]]=new Channel();this[_0x5c0f('0x19')][_0x20ba93['uniqueid']][_0x5c0f('0x48')]=_0x20ba93[_0x5c0f('0x49')]?moment()['subtract'](moment[_0x5c0f('0x49')](_0x20ba93[_0x5c0f('0x49')])['seconds'](),_0x5c0f('0x4a'))[_0x5c0f('0x3d')](_0x5c0f('0x36')):moment()['format'](_0x5c0f('0x36'));this['channels'][_0x20ba93[_0x5c0f('0x32')]][_0x5c0f('0x37')]=_0x5c0f('0x13');}_[_0x5c0f('0x39')](this[_0x5c0f('0x19')][_0x20ba93['uniqueid']],_['pick'](_0x20ba93,_[_0x5c0f('0x4b')](this[_0x5c0f('0x19')][_0x20ba93[_0x5c0f('0x32')]])));if(_[_0x5c0f('0x4c')](applications,_0x20ba93[_0x5c0f('0x44')])){this[_0x5c0f('0x19')][_0x20ba93['uniqueid']]['lastapplication']=_0x20ba93[_0x5c0f('0x44')];this[_0x5c0f('0x19')][_0x20ba93[_0x5c0f('0x32')]][_0x5c0f('0x4d')]=_0x20ba93[_0x5c0f('0x47')];if(_0x20ba93[_0x5c0f('0x44')]===_0x5c0f('0xd')&&_['startsWith'](_0x20ba93[_0x5c0f('0x47')],_0x5c0f('0x4e'))){var _0x39d01c=_0x20ba93[_0x5c0f('0x47')]['split']('=');var _0x5edee6=_0x39d01c[0x0][_0x5c0f('0x4f')](/cdr\((.*)\)/);if(_0x5edee6){this[_0x5c0f('0x19')][_0x20ba93[_0x5c0f('0x32')]][_0x5edee6[0x1]]=_0x39d01c[0x1];}}else if(_0x20ba93[_0x5c0f('0x44')]==='queue'){this['channels'][_0x20ba93[_0x5c0f('0x32')]][_0x5c0f('0xe')]=_0x20ba93[_0x5c0f('0x47')]['split'](',')[0x0];}}}}}catch(_0x57b574){logger['error'](_0x5c0f('0x50'),util[_0x5c0f('0x51')](_0x57b574,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x52')]=function(_0x56984b){try{if(this[_0x5c0f('0x2e')](_0x56984b)){if(_0x56984b[_0x5c0f('0x32')]!==_0x56984b[_0x5c0f('0x30')]){if(this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]]){if(_0x56984b[_0x5c0f('0x53')]==='6'){if(!this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x54')]){var _0x3b58e5=moment();this['channels'][_0x56984b['linkedid']][_0x5c0f('0x54')]=!![];this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]]['answertime']=_0x3b58e5[_0x5c0f('0x3d')](_0x5c0f('0x36'));if(this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x48')]){this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x55')]=_0x3b58e5[_0x5c0f('0x56')](this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x48')],_0x5c0f('0x4a'));}}this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]]['linkedid']=_0x56984b[_0x5c0f('0x32')];if(_0x56984b[_0x5c0f('0x57')]!==_0x5c0f('0x58')){this['channels'][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x59')]=_0x56984b[_0x5c0f('0x57')];}this[_0x5c0f('0x19')][_0x56984b['linkedid']][_0x5c0f('0x5a')]=_0x56984b[_0x5c0f('0x5b')];this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x5c')]=_0x56984b[_0x5c0f('0x35')];this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]]['disposition']=dispositions[_[_0x5c0f('0x38')](_0x56984b[_0x5c0f('0x53')])];if(this[_0x5c0f('0x1a')][_0x56984b['channel'][_0x5c0f('0x3e')]('-')[0x0]]){this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x5d')]=this[_0x5c0f('0x1a')][_0x56984b['channel']['split']('-')[0x0]]['id'];this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x30')]][_0x5c0f('0x5e')]=this[_0x5c0f('0x1a')][_0x56984b[_0x5c0f('0x35')][_0x5c0f('0x3e')]('-')[0x0]][_0x5c0f('0x3f')];}}}}else{if(this['channels'][_0x56984b[_0x5c0f('0x32')]]){if(_0x56984b[_0x5c0f('0x53')]==='6'){if(this[_0x5c0f('0x1a')][_0x56984b[_0x5c0f('0x35')][_0x5c0f('0x3e')]('-')[0x0]]){this[_0x5c0f('0x19')][_0x56984b[_0x5c0f('0x32')]][_0x5c0f('0x5d')]=this[_0x5c0f('0x1a')][_0x56984b[_0x5c0f('0x35')][_0x5c0f('0x3e')]('-')[0x0]]['id'];this[_0x5c0f('0x19')][_0x56984b['uniqueid']][_0x5c0f('0x5e')]=this['agents'][_0x56984b['channel'][_0x5c0f('0x3e')]('-')[0x0]][_0x5c0f('0x3f')];}}}}}}catch(_0x2f7564){logger['error'](_0x5c0f('0x5f'),util[_0x5c0f('0x51')](_0x2f7564,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x60')]=function(_0x159116,_0x77e0e1){if(this[_0x5c0f('0x19')][_0x159116]){this[_0x5c0f('0x19')][_0x159116][_0x5c0f('0x61')]=!![];if(_[_0x5c0f('0x62')](_0x77e0e1,'.wav49')){_0x77e0e1=_0x77e0e1[_0x5c0f('0x63')](_0x5c0f('0x64'),_0x5c0f('0x65'));}this[_0x5c0f('0x19')][_0x159116][_0x5c0f('0x66')]=_0x77e0e1;var _0x15994d=_[_0x5c0f('0x67')](this['channels'][_0x159116][_0x5c0f('0x68')],{'filename':_0x77e0e1});if(_['isNil'](_0x15994d)){this[_0x5c0f('0x19')][_0x159116]['monitors']['push']({'filename':_0x77e0e1,'createdAt':moment()[_0x5c0f('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x21')]=function(_0x5c79e4){try{if(this[_0x5c0f('0x2e')](_0x5c79e4)){if(this['channels'][_0x5c79e4[_0x5c0f('0x32')]]&&_0x5c79e4[_0x5c0f('0x35')]!=_0x5c0f('0x69')){if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')])){if(this['isNotNull'](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x6b')])){this[_0x5c0f('0x60')](_0x5c79e4[_0x5c0f('0x32')],_0x5c79e4[_0x5c0f('0x6c')]);}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x6d')])){this['channels'][_0x5c79e4['uniqueid']]['calleridnum']=_0x5c79e4['value'];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x6e')])){this['channels'][_0x5c79e4[_0x5c0f('0x32')]]['callerid']=_0x5c79e4[_0x5c0f('0x6c')];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x6f')])){this['channels'][_0x5c79e4[_0x5c0f('0x32')]]['type']=_0x5c79e4[_0x5c0f('0x6c')];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x70')])){this[_0x5c0f('0x19')][_0x5c79e4['uniqueid']][_0x5c0f('0xe')]=_0x5c79e4[_0x5c0f('0x6c')]['split'](',')[0x0];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x71')])){this['channels'][_0x5c79e4['uniqueid']][_0x5c0f('0x72')]=_0x5c79e4[_0x5c0f('0x6c')];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x73')])){this[_0x5c0f('0x19')][_0x5c79e4[_0x5c0f('0x32')]][_0x5c0f('0x74')]=_0x5c79e4[_0x5c0f('0x6c')];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')]['xmd-callerid-preview'])){this['channels'][_0x5c79e4[_0x5c0f('0x32')]][_0x5c0f('0x75')]=_0x5c79e4[_0x5c0f('0x6c')];}else if(this[_0x5c0f('0x2e')](_0x5c79e4[_0x5c0f('0x6a')]['xmcs-queue'])){this[_0x5c0f('0x19')][_0x5c79e4['uniqueid']][_0x5c0f('0xe')]=_0x5c79e4[_0x5c0f('0x6c')];}else if(this['isNotNull'](_0x5c79e4[_0x5c0f('0x6a')][_0x5c0f('0x76')])){this[_0x5c0f('0x19')][_0x5c79e4[_0x5c0f('0x32')]]['sipcalluniqueid']=_0x5c79e4[_0x5c0f('0x6c')];}}}else if(this[_0x5c0f('0x2e')](_0x5c79e4['variable'][_0x5c0f('0x6b')])){if(_0x5c79e4[_0x5c0f('0x6c')]){var _0x3f4c29=path[_0x5c0f('0x77')](_0x5c79e4['value'])[_0x5c0f('0x3f')];this['syncMixMonitorFilename'](_0x3f4c29,_0x5c79e4[_0x5c0f('0x6c')]);}}else if(this[_0x5c0f('0x19')][_0x5c79e4[_0x5c0f('0x30')]]){if(this['isNotNull'](_0x5c79e4['variable'])){if(this['isNotNull'](_0x5c79e4['variable']['sipcallid'])){this['channels'][_0x5c79e4[_0x5c0f('0x30')]][_0x5c0f('0x78')]=_0x5c79e4[_0x5c0f('0x6c')];}}}}}catch(_0x53d533){logger[_0x5c0f('0x42')]('[syncVarSet][VoiceCallReport]',util[_0x5c0f('0x51')](_0x53d533,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x23')]=function(_0x43be4f){try{if(this[_0x5c0f('0x2e')](_0x43be4f)){if(this['channels'][_0x43be4f[_0x5c0f('0x32')]]){var _0x19dc93=moment();this['channels'][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x79')]=_0x19dc93[_0x5c0f('0x3d')](_0x5c0f('0x36'));this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x49')]=_0x19dc93['diff'](this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x48')],_0x5c0f('0x4a'));if(this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x54')]){this[_0x5c0f('0x19')][_0x43be4f['uniqueid']][_0x5c0f('0x7a')]=_0x19dc93[_0x5c0f('0x56')](this['channels'][_0x43be4f['uniqueid']][_0x5c0f('0x7b')],'seconds');this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x55')]=this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x49')]-this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]][_0x5c0f('0x7a')];}if(_0x43be4f[_0x5c0f('0x3a')]===_0x5c0f('0x3b')){if(this[_0x5c0f('0x1a')][_0x43be4f['channel'][_0x5c0f('0x3e')]('-')[0x0]]){this[_0x5c0f('0x1a')][_0x43be4f['channel'][_0x5c0f('0x3e')]('-')[0x0]]=_[_0x5c0f('0x7c')](this['agents'][_0x43be4f[_0x5c0f('0x35')]['split']('-')[0x0]],[_0x5c0f('0x3c')]);this[_0x5c0f('0x2f')](util['format']('user:%s',this[_0x5c0f('0x1a')][_0x43be4f[_0x5c0f('0x35')][_0x5c0f('0x3e')]('-')[0x0]][_0x5c0f('0x3f')]),_0x5c0f('0x7d'),{'destaccountcode':this[_0x5c0f('0x1a')][_0x43be4f['channel'][_0x5c0f('0x3e')]('-')[0x0]][_0x5c0f('0x7e')]});}}ami[_0x5c0f('0x2f')]('custom:voiceCallReport',this[_0x5c0f('0x19')][_0x43be4f[_0x5c0f('0x32')]]);delete this['channels'][_0x43be4f['uniqueid']];}}}catch(_0x509a9e){logger[_0x5c0f('0x42')](_0x5c0f('0x7f'),util[_0x5c0f('0x51')](_0x509a9e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x25')]=function(_0xcc01d9){try{if(this['isNotNull'](_0xcc01d9)){if(this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x80')]]){this[_0x5c0f('0x19')][_0xcc01d9['transfereeuniqueid']]['transfercalleridnum']=_0xcc01d9['origtransferercalleridnum'];this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x80')]][_0x5c0f('0x81')]=_0xcc01d9['transfertargetcalleridnum'];if(this['channels'][_0xcc01d9['secondtransfereruniqueid']]){var _0x38463d=this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x82')]];this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x82')]]=this['channels'][_0xcc01d9[_0x5c0f('0x80')]];this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x80')]]=_0x38463d;}}else if(this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x83')]]){this['channels'][_0xcc01d9['transfertargetuniqueid']][_0x5c0f('0x84')]=_0xcc01d9['origtransferercalleridnum'];this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x83')]]['transferconnectedlinenum']=_0xcc01d9[_0x5c0f('0x85')];if(this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x86')]]){var _0x38463d=this['channels'][_0xcc01d9[_0x5c0f('0x86')]];this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x86')]]=this[_0x5c0f('0x19')][_0xcc01d9['transfertargetuniqueid']];this[_0x5c0f('0x19')][_0xcc01d9[_0x5c0f('0x83')]]=_0x38463d;}}}}catch(_0xe71eff){logger[_0x5c0f('0x42')](_0x5c0f('0x87'),util[_0x5c0f('0x51')](_0xe71eff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')]['syncBlindTransfer']=function(_0x462f05){try{if(this[_0x5c0f('0x2e')](_0x462f05)){if(this['channels'][_0x462f05[_0x5c0f('0x80')]]){this[_0x5c0f('0x19')][_0x462f05[_0x5c0f('0x80')]][_0x5c0f('0x84')]=_0x462f05[_0x5c0f('0x88')];this[_0x5c0f('0x19')][_0x462f05['transfereeuniqueid']][_0x5c0f('0x81')]=_0x462f05[_0x5c0f('0x89')];this[_0x5c0f('0x23')]({'event':_0x5c0f('0x8a'),'uniqueid':_0x462f05[_0x5c0f('0x80')],'context':_0x462f05['context'],'channel':_0x462f05['transfererchannel']});}}}catch(_0x1ccba9){logger[_0x5c0f('0x42')](_0x5c0f('0x8b'),util['inspect'](_0x1ccba9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')][_0x5c0f('0x27')]=function(_0x48b2df){try{if(this[_0x5c0f('0x2e')](_0x48b2df)){if(this[_0x5c0f('0x19')][_0x48b2df[_0x5c0f('0x32')]]){if(!_[_0x5c0f('0x8c')](this[_0x5c0f('0x19')][_0x48b2df['uniqueid']][_0x5c0f('0x7b')])){this[_0x5c0f('0x19')][_0x48b2df[_0x5c0f('0x32')]][_0x5c0f('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x4e1c28){logger[_0x5c0f('0x42')]('[syncMusicOnHoldStart][VoiceCallReport]',util['inspect'](_0x4e1c28,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5c0f('0x2d')]['syncMusicOnHoldStop']=function(_0x2f569e){try{if(this['isNotNull'](_0x2f569e)){if(this['channels'][_0x2f569e[_0x5c0f('0x32')]]){if(!_[_0x5c0f('0x8c')](this[_0x5c0f('0x19')][_0x2f569e[_0x5c0f('0x32')]]['mohstarttime'])){this['channels'][_0x2f569e[_0x5c0f('0x32')]]['mohtime']+=moment()[_0x5c0f('0x8e')](0x0)[_0x5c0f('0x56')](this[_0x5c0f('0x19')][_0x2f569e['uniqueid']][_0x5c0f('0x8d')],_0x5c0f('0x4a'));delete this['channels'][_0x2f569e[_0x5c0f('0x32')]]['mohstarttime'];}}}}catch(_0xb62b3e){logger['error'](_0x5c0f('0x8f'),util[_0x5c0f('0x51')](_0xb62b3e,{'showHidden':![],'depth':null}));}};module[_0x5c0f('0x90')]=VoiceCallReport; \ No newline at end of file +var _0x510c=['omit','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','isNil','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','prototype','isUndefined','linkedid','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','isNotNull','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','from-sip','split','destconnectedlinenum','exten','emit','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','inspect','answered','answertime','xcally-motion-preview','connectedlinenum','calleridname','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','monitorFilename','monitors','push','value','xmd-phone','calleridnum','variable','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','mixmonitor_filename','parse','sipcalllinkedid','diff','billableseconds','holdtime','context'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x510c,0x152));var _0xc510=function(_0x73a86,_0x42e676){_0x73a86=_0x73a86-0x0;var _0x5910ab=_0x510c[_0x73a86];return _0x5910ab;};'use strict';var BPromise=require(_0xc510('0x0'));var _=require('lodash');var moment=require(_0xc510('0x1'));var util=require(_0xc510('0x2'));var path=require(_0xc510('0x3'));var Redis=require(_0xc510('0x4'));var config=require(_0xc510('0x5'));var logger=require(_0xc510('0x6'))(_0xc510('0x7'));var ami=require(_0xc510('0x8'));var Channel=require('../model/channel');var statusDesc=[_0xc510('0x9'),_0xc510('0xa'),_0xc510('0xb'),_0xc510('0xc'),'invalid',_0xc510('0xd'),_0xc510('0xe'),_0xc510('0xf'),'onhold'];var applications=['set',_0xc510('0x10'),_0xc510('0x11'),'dial',_0xc510('0x12'),_0xc510('0x13')];var dispositions=[_0xc510('0x14'),_0xc510('0x15'),_0xc510('0x15'),'NO\x20ANSWER',_0xc510('0x14'),_0xc510('0x14'),_0xc510('0x16'),_0xc510('0x17'),'FAILED','FAILED',_0xc510('0x15')];var actions={};config['redis']=_[_0xc510('0x18')](config[_0xc510('0x19')],{'host':_0xc510('0x1a'),'port':0x18eb});var io=require(_0xc510('0x1b'))(new Redis(config['redis']));function VoiceCallReport(_0x563f51){this[_0xc510('0x1c')]=_0x563f51['channels'];this[_0xc510('0x1d')]=_0x563f51[_0xc510('0x1d')];ami['on'](_0xc510('0x1e'),this[_0xc510('0x1f')][_0xc510('0x20')](this));ami['on'](_0xc510('0x21'),this[_0xc510('0x1f')][_0xc510('0x20')](this));ami['on'](_0xc510('0x22'),this[_0xc510('0x23')][_0xc510('0x20')](this));ami['on']('newstate',this[_0xc510('0x24')]['bind'](this));ami['on'](_0xc510('0x25'),this[_0xc510('0x26')][_0xc510('0x20')](this));ami['on'](_0xc510('0x27'),this[_0xc510('0x28')][_0xc510('0x20')](this));ami['on'](_0xc510('0x29'),this[_0xc510('0x2a')][_0xc510('0x20')](this));ami['on'](_0xc510('0x2b'),this['syncAttendedTransfer'][_0xc510('0x20')](this));ami['on']('blindtransfer',this[_0xc510('0x2c')][_0xc510('0x20')](this));ami['on'](_0xc510('0x2d'),this['syncMusicOnHoldStart'][_0xc510('0x20')](this));ami['on'](_0xc510('0x2e'),this[_0xc510('0x2f')]['bind'](this));return BPromise[_0xc510('0x30')]()[_0xc510('0x31')](ami[_0xc510('0x32')]())[_0xc510('0x33')](function(_0x48bf8a){console['log'](_0x48bf8a);});}VoiceCallReport[_0xc510('0x34')]['isNotNull']=function(_0x36d23a){return _0x36d23a!==null&&!_[_0xc510('0x35')](_0x36d23a);};VoiceCallReport[_0xc510('0x34')]['emit']=function(_0x59b2ce,_0x1227e3,_0x2e5bd0){io['to'](_0x59b2ce)['emit'](_0x1227e3,_0x2e5bd0);};VoiceCallReport[_0xc510('0x34')][_0xc510('0x2a')]=function(_0x2ea220){try{if(this['isNotNull'](_0x2ea220)){if(_0x2ea220['uniqueid']===_0x2ea220[_0xc510('0x36')]){if(!_[_0xc510('0x35')](this[_0xc510('0x1c')][_0x2ea220[_0xc510('0x37')]])){_[_0xc510('0x38')](this[_0xc510('0x1c')][_0x2ea220[_0xc510('0x37')]],_[_0xc510('0x39')](_0x2ea220,_[_0xc510('0x3a')](this['channels'][_0x2ea220['uniqueid']])));}}}}catch(_0xb85072){logger[_0xc510('0x3b')](_0xc510('0x3c'),util['inspect'](_0xb85072,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')]['syncNewChannel']=function(_0x187feb){try{if(this[_0xc510('0x3d')](_0x187feb)){if(_0x187feb[_0xc510('0x37')]===_0x187feb[_0xc510('0x36')]&&_0x187feb[_0xc510('0x3e')]!=_0xc510('0x3f')){if(_[_0xc510('0x35')](this[_0xc510('0x1c')][_0x187feb['uniqueid']])){this['channels'][_0x187feb[_0xc510('0x37')]]=new Channel();this[_0xc510('0x1c')][_0x187feb[_0xc510('0x37')]]['starttime']=moment()[_0xc510('0x40')](_0xc510('0x41'));this[_0xc510('0x1c')][_0x187feb[_0xc510('0x37')]]['disposition']=dispositions[_[_0xc510('0x42')](_0x187feb[_0xc510('0x43')])];_[_0xc510('0x38')](this[_0xc510('0x1c')][_0x187feb[_0xc510('0x37')]],_[_0xc510('0x39')](_0x187feb,_[_0xc510('0x3a')](this[_0xc510('0x1c')][_0x187feb[_0xc510('0x37')]])));if(_0x187feb['context']===_0xc510('0x44')){if(this[_0xc510('0x1d')][_0x187feb['channel'][_0xc510('0x45')]('-')[0x0]]){this['agents'][_0x187feb['channel'][_0xc510('0x45')]('-')[0x0]][_0xc510('0x46')]=_0x187feb[_0xc510('0x47')];this[_0xc510('0x48')](util['format']('user:%s',this[_0xc510('0x1d')][_0x187feb[_0xc510('0x3e')]['split']('-')[0x0]][_0xc510('0x49')]),_0xc510('0x4a'),{'destaccountcode':this[_0xc510('0x1d')][_0x187feb[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]][_0xc510('0x4b')],'destconnectedlinenum':_0x187feb[_0xc510('0x47')]});}}}}}}catch(_0x536133){logger[_0xc510('0x3b')](_0xc510('0x4c'),util['inspect'](_0x536133,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')]['syncNewExten']=function(_0x30e8f4){try{if(this[_0xc510('0x3d')](_0x30e8f4)){if(_0x30e8f4['uniqueid']===_0x30e8f4['linkedid']&&_0x30e8f4[_0xc510('0x47')]!='h'&&_0x30e8f4[_0xc510('0x3e')]!=_0xc510('0x3f')){_0x30e8f4[_0xc510('0x4d')]=_0x30e8f4['application'][_0xc510('0x4e')]();_0x30e8f4[_0xc510('0x4f')]=(_0x30e8f4[_0xc510('0x50')]||_0x30e8f4[_0xc510('0x4f')])['toLowerCase']();if(_['isUndefined'](this[_0xc510('0x1c')][_0x30e8f4['uniqueid']])){this[_0xc510('0x1c')][_0x30e8f4[_0xc510('0x37')]]=new Channel();this[_0xc510('0x1c')][_0x30e8f4[_0xc510('0x37')]][_0xc510('0x51')]=_0x30e8f4[_0xc510('0x52')]?moment()[_0xc510('0x53')](moment[_0xc510('0x52')](_0x30e8f4[_0xc510('0x52')])[_0xc510('0x54')](),_0xc510('0x54'))[_0xc510('0x40')](_0xc510('0x41')):moment()[_0xc510('0x40')](_0xc510('0x41'));this['channels'][_0x30e8f4[_0xc510('0x37')]][_0xc510('0x55')]=_0xc510('0x14');}_[_0xc510('0x38')](this[_0xc510('0x1c')][_0x30e8f4['uniqueid']],_[_0xc510('0x39')](_0x30e8f4,_[_0xc510('0x3a')](this['channels'][_0x30e8f4[_0xc510('0x37')]])));if(_[_0xc510('0x56')](applications,_0x30e8f4['application'])){this[_0xc510('0x1c')][_0x30e8f4[_0xc510('0x37')]][_0xc510('0x57')]=_0x30e8f4[_0xc510('0x4d')];this[_0xc510('0x1c')][_0x30e8f4[_0xc510('0x37')]][_0xc510('0x58')]=_0x30e8f4[_0xc510('0x4f')];if(_0x30e8f4[_0xc510('0x4d')]===_0xc510('0x59')&&_[_0xc510('0x5a')](_0x30e8f4[_0xc510('0x4f')],_0xc510('0x5b'))){var _0x11e48c=_0x30e8f4[_0xc510('0x4f')][_0xc510('0x45')]('=');var _0x5e1b4e=_0x11e48c[0x0][_0xc510('0x5c')](/cdr\((.*)\)/);if(_0x5e1b4e){this['channels'][_0x30e8f4[_0xc510('0x37')]][_0x5e1b4e[0x1]]=_0x11e48c[0x1];}}else if(_0x30e8f4[_0xc510('0x4d')]===_0xc510('0x10')){this[_0xc510('0x1c')][_0x30e8f4[_0xc510('0x37')]][_0xc510('0x10')]=_0x30e8f4['applicationdata']['split'](',')[0x0];}}}}}catch(_0x34c912){logger[_0xc510('0x3b')](_0xc510('0x5d'),util[_0xc510('0x5e')](_0x34c912,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')][_0xc510('0x24')]=function(_0x56f55f){try{if(this['isNotNull'](_0x56f55f)){if(_0x56f55f[_0xc510('0x37')]!==_0x56f55f[_0xc510('0x36')]){if(this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]]){if(_0x56f55f[_0xc510('0x43')]==='6'){if(!this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x5f')]){var _0x273d8d=moment();this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x5f')]=!![];this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x60')]=_0x273d8d[_0xc510('0x40')](_0xc510('0x41'));if(this['channels'][_0x56f55f[_0xc510('0x36')]]['starttime']){this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]]['holdtime']=_0x273d8d['diff'](this['channels'][_0x56f55f[_0xc510('0x36')]]['starttime'],'seconds');}}this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x36')]=_0x56f55f[_0xc510('0x37')];if(_0x56f55f['calleridnum']!==_0xc510('0x61')){this[_0xc510('0x1c')][_0x56f55f['linkedid']][_0xc510('0x62')]=_0x56f55f['calleridnum'];}this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]]['connectedlinename']=_0x56f55f[_0xc510('0x63')];this['channels'][_0x56f55f[_0xc510('0x36')]]['destinationchannel']=_0x56f55f[_0xc510('0x3e')];this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x55')]=dispositions[_[_0xc510('0x42')](_0x56f55f['channelstate'])];if(this[_0xc510('0x1d')][_0x56f55f['channel']['split']('-')[0x0]]){this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x64')]=this[_0xc510('0x1d')][_0x56f55f[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]]['id'];this[_0xc510('0x1c')][_0x56f55f[_0xc510('0x36')]][_0xc510('0x65')]=this['agents'][_0x56f55f[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x56f55f[_0xc510('0x37')]]){if(_0x56f55f[_0xc510('0x43')]==='6'){if(this[_0xc510('0x1d')][_0x56f55f[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]]){this[_0xc510('0x1c')][_0x56f55f['uniqueid']][_0xc510('0x64')]=this['agents'][_0x56f55f[_0xc510('0x3e')]['split']('-')[0x0]]['id'];this['channels'][_0x56f55f[_0xc510('0x37')]][_0xc510('0x65')]=this[_0xc510('0x1d')][_0x56f55f[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]][_0xc510('0x49')];}}}}}}catch(_0x2919e5){logger[_0xc510('0x3b')](_0xc510('0x66'),util[_0xc510('0x5e')](_0x2919e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')][_0xc510('0x67')]=function(_0x3a898a,_0x1b1af5){if(this[_0xc510('0x1c')][_0x3a898a]){this[_0xc510('0x1c')][_0x3a898a][_0xc510('0x68')]=!![];if(_[_0xc510('0x69')](_0x1b1af5,_0xc510('0x6a'))){_0x1b1af5=_0x1b1af5['replace']('.wav49','.WAV');}this[_0xc510('0x1c')][_0x3a898a][_0xc510('0x6b')]=_0x1b1af5;var _0x509d34=_['find'](this[_0xc510('0x1c')][_0x3a898a][_0xc510('0x6c')],{'filename':_0x1b1af5});if(_['isNil'](_0x509d34)){this[_0xc510('0x1c')][_0x3a898a][_0xc510('0x6c')][_0xc510('0x6d')]({'filename':_0x1b1af5,'createdAt':moment()[_0xc510('0x40')](_0xc510('0x41')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xc510('0x34')][_0xc510('0x26')]=function(_0x2cbb83){try{if(this[_0xc510('0x3d')](_0x2cbb83)){if(this[_0xc510('0x1c')][_0x2cbb83[_0xc510('0x37')]]&&_0x2cbb83[_0xc510('0x3e')]!='OutgoingSpoolFailed'){if(this[_0xc510('0x3d')](_0x2cbb83['variable'])){if(this[_0xc510('0x3d')](_0x2cbb83['variable']['mixmonitor_filename'])){this[_0xc510('0x67')](_0x2cbb83[_0xc510('0x37')],_0x2cbb83[_0xc510('0x6e')]);}else if(this['isNotNull'](_0x2cbb83['variable'][_0xc510('0x6f')])){this['channels'][_0x2cbb83[_0xc510('0x37')]][_0xc510('0x70')]=_0x2cbb83['value'];}else if(this['isNotNull'](_0x2cbb83[_0xc510('0x71')][_0xc510('0x72')])){this[_0xc510('0x1c')][_0x2cbb83[_0xc510('0x37')]][_0xc510('0x73')]=_0x2cbb83[_0xc510('0x6e')];}else if(this[_0xc510('0x3d')](_0x2cbb83[_0xc510('0x71')][_0xc510('0x74')])){this[_0xc510('0x1c')][_0x2cbb83[_0xc510('0x37')]][_0xc510('0x75')]=_0x2cbb83[_0xc510('0x6e')];}else if(this[_0xc510('0x3d')](_0x2cbb83[_0xc510('0x71')][_0xc510('0x76')])){this['channels'][_0x2cbb83[_0xc510('0x37')]]['queue']=_0x2cbb83['value'][_0xc510('0x45')](',')[0x0];}else if(this['isNotNull'](_0x2cbb83[_0xc510('0x71')][_0xc510('0x77')])){this['channels'][_0x2cbb83[_0xc510('0x37')]][_0xc510('0x78')]=_0x2cbb83[_0xc510('0x6e')];}else if(this['isNotNull'](_0x2cbb83['variable']['xmd-destination'])){this[_0xc510('0x1c')][_0x2cbb83['uniqueid']][_0xc510('0x79')]=_0x2cbb83['value'];}else if(this['isNotNull'](_0x2cbb83[_0xc510('0x71')][_0xc510('0x7a')])){this['channels'][_0x2cbb83[_0xc510('0x37')]][_0xc510('0x7b')]=_0x2cbb83['value'];}else if(this[_0xc510('0x3d')](_0x2cbb83[_0xc510('0x71')][_0xc510('0x7c')])){this[_0xc510('0x1c')][_0x2cbb83['uniqueid']][_0xc510('0x10')]=_0x2cbb83[_0xc510('0x6e')];}else if(this[_0xc510('0x3d')](_0x2cbb83[_0xc510('0x71')][_0xc510('0x7d')])){this[_0xc510('0x1c')][_0x2cbb83[_0xc510('0x37')]]['sipcalluniqueid']=_0x2cbb83[_0xc510('0x6e')];}}}else if(this[_0xc510('0x3d')](_0x2cbb83[_0xc510('0x71')][_0xc510('0x7e')])){if(_0x2cbb83[_0xc510('0x6e')]){var _0x4bcf08=path[_0xc510('0x7f')](_0x2cbb83[_0xc510('0x6e')])[_0xc510('0x49')];this[_0xc510('0x67')](_0x4bcf08,_0x2cbb83[_0xc510('0x6e')]);}}else if(this[_0xc510('0x1c')][_0x2cbb83['linkedid']]){if(this['isNotNull'](_0x2cbb83[_0xc510('0x71')])){if(this[_0xc510('0x3d')](_0x2cbb83['variable']['sipcallid'])){this[_0xc510('0x1c')][_0x2cbb83[_0xc510('0x36')]][_0xc510('0x80')]=_0x2cbb83[_0xc510('0x6e')];}}}}}catch(_0x211bb1){logger['error']('[syncVarSet][VoiceCallReport]',util[_0xc510('0x5e')](_0x211bb1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')]['syncHangup']=function(_0x3128c6){try{if(this[_0xc510('0x3d')](_0x3128c6)){if(this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]]){var _0x23ee2c=moment();this[_0xc510('0x1c')][_0x3128c6['uniqueid']]['endtime']=_0x23ee2c[_0xc510('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3128c6[_0xc510('0x37')]][_0xc510('0x52')]=_0x23ee2c[_0xc510('0x81')](this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]][_0xc510('0x51')],_0xc510('0x54'));if(this['channels'][_0x3128c6[_0xc510('0x37')]]['answered']){this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]][_0xc510('0x82')]=_0x23ee2c[_0xc510('0x81')](this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]][_0xc510('0x60')],_0xc510('0x54'));this['channels'][_0x3128c6[_0xc510('0x37')]][_0xc510('0x83')]=this['channels'][_0x3128c6[_0xc510('0x37')]][_0xc510('0x52')]-this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]]['billableseconds'];}if(_0x3128c6[_0xc510('0x84')]===_0xc510('0x44')){if(this['agents'][_0x3128c6[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]]){this[_0xc510('0x1d')][_0x3128c6[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]]=_[_0xc510('0x85')](this[_0xc510('0x1d')][_0x3128c6['channel'][_0xc510('0x45')]('-')[0x0]],[_0xc510('0x46')]);this['emit'](util[_0xc510('0x40')]('user:%s',this[_0xc510('0x1d')][_0x3128c6['channel'][_0xc510('0x45')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xc510('0x1d')][_0x3128c6[_0xc510('0x3e')][_0xc510('0x45')]('-')[0x0]][_0xc510('0x4b')]});}}ami[_0xc510('0x48')](_0xc510('0x86'),this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]]);delete this[_0xc510('0x1c')][_0x3128c6[_0xc510('0x37')]];}}}catch(_0x3c3a9c){logger['error'](_0xc510('0x87'),util['inspect'](_0x3c3a9c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc510('0x88')]=function(_0x162671){try{if(this[_0xc510('0x3d')](_0x162671)){if(this['channels'][_0x162671[_0xc510('0x89')]]){this[_0xc510('0x1c')][_0x162671[_0xc510('0x89')]][_0xc510('0x8a')]=_0x162671[_0xc510('0x8b')];this[_0xc510('0x1c')][_0x162671[_0xc510('0x89')]][_0xc510('0x8c')]=_0x162671[_0xc510('0x8d')];if(this[_0xc510('0x1c')][_0x162671[_0xc510('0x8e')]]){var _0x5895fe=this['channels'][_0x162671[_0xc510('0x8e')]];this[_0xc510('0x1c')][_0x162671[_0xc510('0x8e')]]=this[_0xc510('0x1c')][_0x162671[_0xc510('0x89')]];this['channels'][_0x162671[_0xc510('0x89')]]=_0x5895fe;}}else if(this[_0xc510('0x1c')][_0x162671['transfertargetuniqueid']]){this[_0xc510('0x1c')][_0x162671[_0xc510('0x8f')]]['transfercalleridnum']=_0x162671['origtransferercalleridnum'];this[_0xc510('0x1c')][_0x162671[_0xc510('0x8f')]][_0xc510('0x8c')]=_0x162671[_0xc510('0x8d')];if(this[_0xc510('0x1c')][_0x162671[_0xc510('0x90')]]){var _0x5895fe=this[_0xc510('0x1c')][_0x162671[_0xc510('0x90')]];this[_0xc510('0x1c')][_0x162671[_0xc510('0x90')]]=this[_0xc510('0x1c')][_0x162671[_0xc510('0x8f')]];this['channels'][_0x162671[_0xc510('0x8f')]]=_0x5895fe;}}}}catch(_0x38d7e7){logger[_0xc510('0x3b')](_0xc510('0x91'),util[_0xc510('0x5e')](_0x38d7e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')]['syncBlindTransfer']=function(_0x225bd4){try{if(this[_0xc510('0x3d')](_0x225bd4)){if(this['channels'][_0x225bd4['transfereeuniqueid']]){this[_0xc510('0x1c')][_0x225bd4['transfereeuniqueid']][_0xc510('0x8a')]=_0x225bd4['transfereecalleridnum'];this['channels'][_0x225bd4[_0xc510('0x89')]][_0xc510('0x8c')]=_0x225bd4[_0xc510('0x92')];this[_0xc510('0x28')]({'event':_0xc510('0x93'),'uniqueid':_0x225bd4[_0xc510('0x89')],'context':_0x225bd4[_0xc510('0x84')],'channel':_0x225bd4[_0xc510('0x94')]});}}}catch(_0x37168d){logger['error'](_0xc510('0x95'),util[_0xc510('0x5e')](_0x37168d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xc510('0x96')]=function(_0x21ccaf){try{if(this[_0xc510('0x3d')](_0x21ccaf)){if(this[_0xc510('0x1c')][_0x21ccaf[_0xc510('0x37')]]){if(!_[_0xc510('0x97')](this[_0xc510('0x1c')][_0x21ccaf[_0xc510('0x37')]][_0xc510('0x60')])){this[_0xc510('0x1c')][_0x21ccaf[_0xc510('0x37')]]['mohstarttime']=moment()[_0xc510('0x40')](_0xc510('0x41'));}}}}catch(_0x377f13){logger['error'](_0xc510('0x98'),util[_0xc510('0x5e')](_0x377f13,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc510('0x34')]['syncMusicOnHoldStop']=function(_0x4faaa4){try{if(this[_0xc510('0x3d')](_0x4faaa4)){if(this[_0xc510('0x1c')][_0x4faaa4[_0xc510('0x37')]]){if(!_[_0xc510('0x97')](this[_0xc510('0x1c')][_0x4faaa4[_0xc510('0x37')]][_0xc510('0x99')])){this[_0xc510('0x1c')][_0x4faaa4[_0xc510('0x37')]][_0xc510('0x9a')]+=moment()['milliseconds'](0x0)['diff'](this[_0xc510('0x1c')][_0x4faaa4[_0xc510('0x37')]][_0xc510('0x99')],_0xc510('0x54'));delete this['channels'][_0x4faaa4[_0xc510('0x37')]][_0xc510('0x99')];}}}}catch(_0xd4b064){logger['error'](_0xc510('0x9b'),util[_0xc510('0x5e')](_0xd4b064,{'showHidden':![],'depth':null}));}};module[_0xc510('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 51700be..8d28f68 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 _0xfa89=['memberrealtime','isNil','includes','syncHangup','endtime','duration','diff','complete','holdtime','answertime','starttime','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','emit','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty'];(function(_0x4956d4,_0x345e38){var _0x5ba119=function(_0x4ad730){while(--_0x4ad730){_0x4956d4['push'](_0x4956d4['shift']());}};_0x5ba119(++_0x345e38);}(_0xfa89,0x70));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9fa8('0x0'));var moment=require('moment');var util=require(_0x9fa8('0x1'));var Redis=require(_0x9fa8('0x2'));var config=require(_0x9fa8('0x3'));var logger=require(_0x9fa8('0x4'))(_0x9fa8('0x5'));var ami=require(_0x9fa8('0x6'));config[_0x9fa8('0x7')]=_[_0x9fa8('0x8')](config[_0x9fa8('0x7')],{'host':_0x9fa8('0x9'),'port':0x18eb});var io=require(_0x9fa8('0xa'))(new Redis(config[_0x9fa8('0x7')]));function VoiceDialReport(_0x51662f){this[_0x9fa8('0xb')]=_0x51662f[_0x9fa8('0xc')];this[_0x9fa8('0xd')]=_0x51662f['outbound'];this[_0x9fa8('0xe')]={};ami['on'](_0x9fa8('0xf'),this[_0x9fa8('0x10')][_0x9fa8('0x11')](this));ami['on'](_0x9fa8('0x12'),this[_0x9fa8('0x13')][_0x9fa8('0x11')](this));ami['on'](_0x9fa8('0x14'),this[_0x9fa8('0x15')][_0x9fa8('0x11')](this));ami['on'](_0x9fa8('0x16'),this['syncHangup'][_0x9fa8('0x11')](this));}VoiceDialReport[_0x9fa8('0x17')][_0x9fa8('0x18')]=function(_0x566e23){return _0x566e23!==null&&!_['isUndefined'](_0x566e23);};VoiceDialReport['prototype'][_0x9fa8('0x19')]=function(_0x4d15f7,_0x23ca75,_0xaab5a1){io['to'](_0x4d15f7)[_0x9fa8('0x19')](_0x23ca75,_0xaab5a1);};VoiceDialReport[_0x9fa8('0x17')][_0x9fa8('0x10')]=function(_0xfebbf7){try{if(this[_0x9fa8('0x18')](_0xfebbf7)){if(this[_0x9fa8('0xb')][_0xfebbf7['uniqueid']]){_[_0x9fa8('0x1a')](this[_0x9fa8('0xb')][_0xfebbf7[_0x9fa8('0x1b')]],{'starttime':moment()[_0x9fa8('0x1c')](_0x9fa8('0x1d')),'lastevent':_0x9fa8('0x1e'),'interface':_0xfebbf7[_0x9fa8('0x1f')][_0x9fa8('0x20')](0x0,_0xfebbf7[_0x9fa8('0x1f')]['lastIndexOf']('-')),'membername':_0xfebbf7['channel']['substring'](_0xfebbf7[_0x9fa8('0x1f')]['lastIndexOf']('/')+0x1,_0xfebbf7[_0x9fa8('0x1f')]['lastIndexOf']('-'))},_[_0x9fa8('0x21')](_0xfebbf7,[_0x9fa8('0x22'),_0x9fa8('0x23')]));this['emit'](_0x9fa8('0x24'),_0x9fa8('0x25'),this['channels'][_0xfebbf7[_0x9fa8('0x1b')]]);ami[_0x9fa8('0x19')](_0x9fa8('0x26'),this[_0x9fa8('0xb')][_0xfebbf7[_0x9fa8('0x1b')]]);}}}catch(_0x21b522){logger[_0x9fa8('0x27')](_0x9fa8('0x28'),util[_0x9fa8('0x29')](_0x21b522,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9fa8('0x17')][_0x9fa8('0x13')]=function(_0x4bb007){try{if(this[_0x9fa8('0x18')](_0x4bb007)){if(this['channels'][_0x4bb007[_0x9fa8('0x1b')]]){this['channels'][_0x4bb007[_0x9fa8('0x1b')]][_0x9fa8('0x2a')]=_0x4bb007['dialstatus'];if(_0x4bb007[_0x9fa8('0x2a')]===_0x9fa8('0x2b')){this[_0x9fa8('0xb')][_0x4bb007['uniqueid']]['connectedlinenum']=_0x4bb007[_0x9fa8('0x2c')];this[_0x9fa8('0xb')][_0x4bb007[_0x9fa8('0x1b')]][_0x9fa8('0x2d')]=_0x4bb007[_0x9fa8('0x2d')];this[_0x9fa8('0xb')][_0x4bb007[_0x9fa8('0x1b')]]['answertime']=moment()[_0x9fa8('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9fa8('0xb')][_0x4bb007[_0x9fa8('0x1b')]][_0x9fa8('0x2e')]=_0x9fa8('0x2f');ami[_0x9fa8('0x19')](_0x9fa8('0x30'),this[_0x9fa8('0xb')][_0x4bb007[_0x9fa8('0x1b')]]);}this[_0x9fa8('0x19')](_0x9fa8('0x24'),_0x9fa8('0x25'),this['channels'][_0x4bb007[_0x9fa8('0x1b')]]);}}}catch(_0x1fc569){logger[_0x9fa8('0x27')](_0x9fa8('0x31'),util['inspect'](_0x1fc569,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9fa8('0x17')][_0x9fa8('0x15')]=function(_0x4b67b3){try{if(this[_0x9fa8('0x18')](_0x4b67b3)){this[_0x9fa8('0x32')](_0x4b67b3['uniqueid'],_[_0x9fa8('0x33')](_0x4b67b3[_0x9fa8('0x34')])[0x0],_0x4b67b3[_0x9fa8('0x35')]);if(this[_0x9fa8('0x18')](_0x4b67b3[_0x9fa8('0x34')])&&this['isNotNull'](_0x4b67b3['variable'][_0x9fa8('0x36')])){if(_[_0x9fa8('0x37')](this['channels'][_0x4b67b3[_0x9fa8('0x1b')]])){this[_0x9fa8('0xb')][_0x4b67b3[_0x9fa8('0x1b')]]={'routeId':_0x4b67b3['value'],'variables':this[_0x9fa8('0xe')][_0x4b67b3[_0x9fa8('0x1b')]]};this['emit'](_0x9fa8('0x24'),_0x9fa8('0x25'),this['channels'][_0x4b67b3['uniqueid']]);}}}}catch(_0x9cd58b){logger[_0x9fa8('0x27')](_0x9fa8('0x38'),util[_0x9fa8('0x29')](_0x9cd58b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9fa8('0x17')][_0x9fa8('0x32')]=function(_0x10a3f5,_0x3a5c21,_0x2a023c){var _0x27e747=[_0x9fa8('0x39'),_0x9fa8('0x3a'),_0x9fa8('0x3b'),_0x9fa8('0x3c'),_0x9fa8('0x3d'),_0x9fa8('0x3e'),'rtpaudioqosrtt',_0x9fa8('0x3f'),_0x9fa8('0x40'),_0x9fa8('0x41'),_0x9fa8('0x42'),'bridgepvtcallid',_0x9fa8('0x43'),_0x9fa8('0x44'),_0x9fa8('0x45'),_0x9fa8('0x46'),'membername',_0x9fa8('0x47'),_0x9fa8('0x48')];if(!_[_0x9fa8('0x49')](_0x3a5c21)&&!_[_0x9fa8('0x4a')](_0x27e747,_0x3a5c21)){if(_[_0x9fa8('0x37')](this[_0x9fa8('0xe')][_0x10a3f5])){this['variables'][_0x10a3f5]={};}this[_0x9fa8('0xe')][_0x10a3f5][_0x3a5c21]=_0x2a023c;}};VoiceDialReport[_0x9fa8('0x17')][_0x9fa8('0x4b')]=function(_0x442a26){try{if(this['isNotNull'](_0x442a26)){if(this[_0x9fa8('0xb')][_0x442a26['uniqueid']]){this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x4c')]=moment()[_0x9fa8('0x1c')](_0x9fa8('0x1d'));this['channels'][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x4d')]=moment(this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x4c')])[_0x9fa8('0x4e')](this['channels'][_0x442a26[_0x9fa8('0x1b')]]['starttime'],'seconds');this['channels'][_0x442a26['uniqueid']][_0x9fa8('0x2e')]=_0x9fa8('0x4f');this[_0x9fa8('0xd')]['total']+=0x1;if(this[_0x9fa8('0xb')][_0x442a26['uniqueid']]['answertime']){this[_0x9fa8('0xd')]['answered']+=0x1;this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x50')]=moment(this['channels'][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x51')])[_0x9fa8('0x4e')](this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x52')],_0x9fa8('0x53'));this[_0x9fa8('0xb')][_0x442a26['uniqueid']][_0x9fa8('0x54')]=moment(this[_0x9fa8('0xb')][_0x442a26['uniqueid']][_0x9fa8('0x4c')])[_0x9fa8('0x4e')](this['channels'][_0x442a26[_0x9fa8('0x1b')]]['answertime'],'seconds');this[_0x9fa8('0xd')][_0x9fa8('0x55')]+=this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x50')]||0x0;this['outbound'][_0x9fa8('0x56')]+=this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]][_0x9fa8('0x54')];}this[_0x9fa8('0xd')][_0x9fa8('0x57')]+=this[_0x9fa8('0xb')][_0x442a26['uniqueid']][_0x9fa8('0x4d')];ami[_0x9fa8('0x19')](_0x9fa8('0x58'),this[_0x9fa8('0xb')][_0x442a26['uniqueid']]);ami[_0x9fa8('0x19')]('custom:dialend',this['channels'][_0x442a26['uniqueid']]);this[_0x9fa8('0x19')](_0x9fa8('0x24'),_0x9fa8('0x59'),this[_0x9fa8('0xd')]);this[_0x9fa8('0x19')](_0x9fa8('0x24'),_0x9fa8('0x5a'),this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]]);delete this[_0x9fa8('0xb')][_0x442a26[_0x9fa8('0x1b')]];}if(this[_0x9fa8('0xe')][_0x442a26[_0x9fa8('0x1b')]]){delete this['variables'][_0x442a26[_0x9fa8('0x1b')]];}}}catch(_0x3d6729){logger[_0x9fa8('0x27')](_0x9fa8('0x5b'),util['inspect'](_0x3d6729,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x9959=['lastevent','connect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','outboundrouteid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','endtime','duration','starttime','total','answered','holdtime','diff','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','voice_outbound:save','exports','lodash','moment','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','channel','lastIndexOf','substring','omit','event','privilege','voice:outbound','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x191f8d,_0x367b8e){var _0x15a591=function(_0x4e1abb){while(--_0x4e1abb){_0x191f8d['push'](_0x191f8d['shift']());}};_0x15a591(++_0x367b8e);}(_0x9959,0x1c2));var _0x9995=function(_0xf952bf,_0x374b07){_0xf952bf=_0xf952bf-0x0;var _0x269159=_0x9959[_0xf952bf];return _0x269159;};'use strict';var _=require(_0x9995('0x0'));var moment=require(_0x9995('0x1'));var util=require(_0x9995('0x2'));var Redis=require(_0x9995('0x3'));var config=require(_0x9995('0x4'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config['redis']=_[_0x9995('0x5')](config[_0x9995('0x6')],{'host':_0x9995('0x7'),'port':0x18eb});var io=require(_0x9995('0x8'))(new Redis(config[_0x9995('0x6')]));function VoiceDialReport(_0x52782b){this[_0x9995('0x9')]=_0x52782b[_0x9995('0xa')];this[_0x9995('0xb')]=_0x52782b[_0x9995('0xb')];this[_0x9995('0xc')]={};ami['on'](_0x9995('0xd'),this[_0x9995('0xe')][_0x9995('0xf')](this));ami['on'](_0x9995('0x10'),this[_0x9995('0x11')][_0x9995('0xf')](this));ami['on']('varset',this['syncVarSet'][_0x9995('0xf')](this));ami['on'](_0x9995('0x12'),this[_0x9995('0x13')]['bind'](this));}VoiceDialReport[_0x9995('0x14')][_0x9995('0x15')]=function(_0x40e7d4){return _0x40e7d4!==null&&!_[_0x9995('0x16')](_0x40e7d4);};VoiceDialReport[_0x9995('0x14')][_0x9995('0x17')]=function(_0x53034c,_0x3a4359,_0x5425c1){io['to'](_0x53034c)['emit'](_0x3a4359,_0x5425c1);};VoiceDialReport['prototype'][_0x9995('0xe')]=function(_0x224cc5){try{if(this[_0x9995('0x15')](_0x224cc5)){if(this[_0x9995('0x9')][_0x224cc5[_0x9995('0x18')]]){_[_0x9995('0x19')](this['channels'][_0x224cc5['uniqueid']],{'starttime':moment()[_0x9995('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x224cc5[_0x9995('0x1b')]['substring'](0x0,_0x224cc5[_0x9995('0x1b')][_0x9995('0x1c')]('-')),'membername':_0x224cc5[_0x9995('0x1b')][_0x9995('0x1d')](_0x224cc5[_0x9995('0x1b')][_0x9995('0x1c')]('/')+0x1,_0x224cc5[_0x9995('0x1b')][_0x9995('0x1c')]('-'))},_[_0x9995('0x1e')](_0x224cc5,[_0x9995('0x1f'),_0x9995('0x20')]));this[_0x9995('0x17')](_0x9995('0x21'),'voice_outbound_channel:save',this[_0x9995('0x9')][_0x224cc5['uniqueid']]);ami[_0x9995('0x17')]('custom:dialbegin',this[_0x9995('0x9')][_0x224cc5[_0x9995('0x18')]]);}}}catch(_0x33b8e3){logger[_0x9995('0x22')](_0x9995('0x23'),util[_0x9995('0x24')](_0x33b8e3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9995('0x14')][_0x9995('0x11')]=function(_0x50d6d9){try{if(this[_0x9995('0x15')](_0x50d6d9)){if(this[_0x9995('0x9')][_0x50d6d9[_0x9995('0x18')]]){this[_0x9995('0x9')][_0x50d6d9[_0x9995('0x18')]]['dialstatus']=_0x50d6d9['dialstatus'];if(_0x50d6d9[_0x9995('0x25')]==='ANSWER'){this[_0x9995('0x9')][_0x50d6d9[_0x9995('0x18')]][_0x9995('0x26')]=_0x50d6d9[_0x9995('0x26')];this[_0x9995('0x9')][_0x50d6d9['uniqueid']][_0x9995('0x27')]=_0x50d6d9[_0x9995('0x27')];this[_0x9995('0x9')][_0x50d6d9[_0x9995('0x18')]][_0x9995('0x28')]=moment()['format'](_0x9995('0x29'));this[_0x9995('0x9')][_0x50d6d9['uniqueid']][_0x9995('0x2a')]=_0x9995('0x2b');ami[_0x9995('0x17')]('custom:dialconnect',this[_0x9995('0x9')][_0x50d6d9[_0x9995('0x18')]]);}this[_0x9995('0x17')]('voice:outbound',_0x9995('0x2c'),this[_0x9995('0x9')][_0x50d6d9[_0x9995('0x18')]]);}}}catch(_0xed33d2){logger[_0x9995('0x22')](_0x9995('0x2d'),util[_0x9995('0x24')](_0xed33d2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9995('0x14')][_0x9995('0x2e')]=function(_0x4c0fef){try{if(this[_0x9995('0x15')](_0x4c0fef)){this[_0x9995('0x2f')](_0x4c0fef[_0x9995('0x18')],_[_0x9995('0x30')](_0x4c0fef[_0x9995('0x31')])[0x0],_0x4c0fef[_0x9995('0x32')]);if(this[_0x9995('0x15')](_0x4c0fef[_0x9995('0x31')])&&this[_0x9995('0x15')](_0x4c0fef[_0x9995('0x31')][_0x9995('0x33')])){if(_[_0x9995('0x16')](this[_0x9995('0x9')][_0x4c0fef[_0x9995('0x18')]])){this[_0x9995('0x9')][_0x4c0fef[_0x9995('0x18')]]={'routeId':_0x4c0fef[_0x9995('0x32')],'variables':this['variables'][_0x4c0fef['uniqueid']]};this[_0x9995('0x17')](_0x9995('0x21'),'voice_outbound_channel:save',this['channels'][_0x4c0fef[_0x9995('0x18')]]);}}}}catch(_0x109121){logger['error']('[syncVarSet][VoiceDialReport]',util[_0x9995('0x24')](_0x109121,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9995('0x2f')]=function(_0x843b3c,_0x5196d3,_0x58f6f6){var _0x397788=['rtpaudioqos',_0x9995('0x34'),_0x9995('0x35'),'rtpaudioqosjitterbridged',_0x9995('0x36'),_0x9995('0x37'),_0x9995('0x38'),_0x9995('0x39'),_0x9995('0x3a'),'sipuri','bridgepeer',_0x9995('0x3b'),_0x9995('0x3c'),_0x9995('0x3d'),_0x9995('0x3e'),'memberlastcall','membername',_0x9995('0x3f'),_0x9995('0x40')];if(!_[_0x9995('0x41')](_0x5196d3)&&!_[_0x9995('0x42')](_0x397788,_0x5196d3)){if(_['isUndefined'](this['variables'][_0x843b3c])){this[_0x9995('0xc')][_0x843b3c]={};}this['variables'][_0x843b3c][_0x5196d3]=_0x58f6f6;}};VoiceDialReport['prototype'][_0x9995('0x13')]=function(_0xeaa43b){try{if(this[_0x9995('0x15')](_0xeaa43b)){if(this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]]){this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x43')]=moment()[_0x9995('0x1a')](_0x9995('0x29'));this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x44')]=moment(this['channels'][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x43')])['diff'](this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x45')],'seconds');this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x2a')]='complete';this[_0x9995('0xb')][_0x9995('0x46')]+=0x1;if(this['channels'][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x28')]){this[_0x9995('0xb')][_0x9995('0x47')]+=0x1;this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x48')]=moment(this[_0x9995('0x9')][_0xeaa43b['uniqueid']][_0x9995('0x28')])[_0x9995('0x49')](this['channels'][_0xeaa43b['uniqueid']][_0x9995('0x45')],_0x9995('0x4a'));this[_0x9995('0x9')][_0xeaa43b['uniqueid']][_0x9995('0x4b')]=moment(this['channels'][_0xeaa43b['uniqueid']][_0x9995('0x43')])[_0x9995('0x49')](this['channels'][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x28')],_0x9995('0x4a'));this[_0x9995('0xb')][_0x9995('0x4c')]+=this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x48')]||0x0;this[_0x9995('0xb')][_0x9995('0x4d')]+=this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]][_0x9995('0x4b')];}this[_0x9995('0xb')][_0x9995('0x4e')]+=this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]]['duration'];ami[_0x9995('0x17')](_0x9995('0x4f'),this['channels'][_0xeaa43b[_0x9995('0x18')]]);ami[_0x9995('0x17')]('custom:dialend',this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]]);this[_0x9995('0x17')]('voice:outbound',_0x9995('0x50'),this[_0x9995('0xb')]);this[_0x9995('0x17')](_0x9995('0x21'),'voice_outbound_channel:remove',this['channels'][_0xeaa43b[_0x9995('0x18')]]);delete this[_0x9995('0x9')][_0xeaa43b[_0x9995('0x18')]];}if(this[_0x9995('0xc')][_0xeaa43b['uniqueid']]){delete this[_0x9995('0xc')][_0xeaa43b['uniqueid']];}}}catch(_0x2fcaa1){logger[_0x9995('0x22')]('[syncHangup][VoiceDialReport]',util[_0x9995('0x24')](_0x2fcaa1,{'showHidden':![],'depth':null}));}};module[_0x9995('0x51')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 580f5ee..d5227f1 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 _0xd62b=['mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','bluebird','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','queueStatusComplete','clearZombieChannels','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_channel:remove','type','inbound','strategy','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','isNotNull','[queues]','flagQueueSummary','queuesummary','then','[queuesummary]','queue','waiting','toNumber','loggedin','available','callers','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','last','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','syncAgentComplete','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','reason','transfer','startsWith','channel','toLowerCase','local/','linkedid','queuecallerjoinAt','add','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','value','variable','queuestatus','queuecallerleaveAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','diff','length','milliseconds','answered','seconds','lastevent','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]'];(function(_0x575354,_0x4bf098){var _0x3357f7=function(_0x1dbfdd){while(--_0x1dbfdd){_0x575354['push'](_0x575354['shift']());}};_0x3357f7(++_0x4bf098);}(_0xd62b,0x195));var _0xbd62=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0xd62b[_0x326e79];return _0x37eb89;};'use strict';var _=require(_0xbd62('0x0'));var moment=require(_0xbd62('0x1'));var BPromise=require(_0xbd62('0x2'));var util=require('util');var md5=require(_0xbd62('0x3'));var Redis=require(_0xbd62('0x4'));var config=require(_0xbd62('0x5'));var logger=require('../../../config/logger')(_0xbd62('0x6'));var ami=require(_0xbd62('0x7'));var QueueReport=require(_0xbd62('0x8'));config[_0xbd62('0x9')]=_[_0xbd62('0xa')](config[_0xbd62('0x9')],{'host':_0xbd62('0xb'),'port':0x18eb});var io=require(_0xbd62('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xbd62('0xd')][_0xbd62('0xe')]=function(_0x4c2948){this[_0xbd62('0xf')]=this[_0xbd62('0xf')]?this['tail'][_0xbd62('0x10')](_0x4c2948):_0x4c2948();};function VoiceQueueReport(_0x34c81d){this[_0xbd62('0x11')]=new Sequence();this[_0xbd62('0x12')]={};this[_0xbd62('0x13')]=_0x34c81d['agents'];this[_0xbd62('0x14')]=_0x34c81d[_0xbd62('0x15')];this[_0xbd62('0x16')]=_0x34c81d[_0xbd62('0x16')];this['flagQueueSummary']=!![];this[_0xbd62('0x17')]=_0x34c81d[_0xbd62('0x17')];this[_0xbd62('0x18')]={};ami['on']('queuesummary',this[_0xbd62('0x19')][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x1b'),this[_0xbd62('0x1c')][_0xbd62('0x1a')](this));ami['on']('queuecallerjoin',this[_0xbd62('0x1d')][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x1e'),this[_0xbd62('0x1f')][_0xbd62('0x1a')](this));ami['on']('queuecallerleave',this[_0xbd62('0x20')][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x21'),this['syncAgentComplete'][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x22'),this[_0xbd62('0x23')][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x24'),this['syncVarSet'][_0xbd62('0x1a')](this));ami['on']('hangup',this['syncHangup'][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x25'),this['syncFullyBooted'][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x26'),this[_0xbd62('0x27')]['bind'](this));ami['on'](_0xbd62('0x28'),this[_0xbd62('0x29')][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x2a'),this[_0xbd62('0x2b')][_0xbd62('0x1a')](this));ami['on'](_0xbd62('0x2c'),this[_0xbd62('0x2d')][_0xbd62('0x1a')](this));this[_0xbd62('0x2e')]();this[_0xbd62('0x2f')]();}function isNotNull(_0x5cdbf6){return _0x5cdbf6!==null&&!_[_0xbd62('0x30')](_0x5cdbf6);}function clearChannels(_0x14900a){if(!_[_0xbd62('0x31')](_0x14900a)){for(var _0x3827d3 in _0x14900a){if(_0x14900a[_0xbd62('0x32')](_0x3827d3)){delete _0x14900a[_0x3827d3];}}}}function clearCampaigns(_0x51aeec){if(!_['isEmpty'](_0x51aeec)){for(var _0x173c62 in _0x51aeec){if(_0x51aeec['hasOwnProperty'](_0x173c62)){_0x51aeec[_0x173c62][_0xbd62('0x33')]=0x0;}}}}function clearVoiceQueues(_0x292131){if(!_['isEmpty'](_0x292131)){for(var _0x43bc89 in _0x292131){if(_0x292131[_0xbd62('0x32')](_0x43bc89)){_0x292131[_0x43bc89][_0xbd62('0x33')]=0x0;_0x292131[_0x43bc89][_0xbd62('0x34')]=0x0;_0x292131[_0x43bc89]['pTalking']=0x0;_0x292131[_0x43bc89]['waiting']=0x0;_0x292131[_0x43bc89][_0xbd62('0x35')]=!![];}}}}function clearAgentBooked(_0x33217b){if(!_[_0xbd62('0x31')](_0x33217b)){for(var _0x4b31b7 in _0x33217b){if(_0x33217b[_0xbd62('0x32')](_0x4b31b7)){_0x33217b[_0x4b31b7]['unlockRR']=!![];}}}}VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x36')]=function(){var _0x2ddc52=this;for(var _0x42341c in this[_0xbd62('0x14')]){if(this[_0xbd62('0x14')][_0xbd62('0x32')](_0x42341c)&&!this['channels'][_0x42341c][_0xbd62('0x37')]){this['sequence']['enqueue'](function(){if(!_[_0xbd62('0x38')](_0x2ddc52[_0xbd62('0x14')][_0x42341c])){return ami[_0xbd62('0x39')]({'action':_0xbd62('0x3a'),'channel':_0x2ddc52['channels'][_0x42341c]['channel']})[_0xbd62('0x3b')](function(_0x17fcc6){if(_0x17fcc6[_0xbd62('0x3c')]===_0xbd62('0x3d')){setTimeout(function(){if(_0x2ddc52[_0xbd62('0x14')][_0x42341c]){delete _0x2ddc52['channels'][_0x42341c];logger[_0xbd62('0x3e')]('[voiceQueueReport][checkChannel]',_0x42341c);}if(_0x2ddc52[_0xbd62('0x12')][_0x42341c]){delete _0x2ddc52[_0xbd62('0x12')][_0x42341c];logger['error'](_0xbd62('0x3f'),_0x42341c);}if(_0x2ddc52[_0xbd62('0x18')][_0x42341c]){delete _0x2ddc52[_0xbd62('0x18')][_0x42341c];logger[_0xbd62('0x3e')](_0xbd62('0x40'),_0x42341c);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xbd62('0x41')]=function(){logger[_0xbd62('0x3e')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xbd62('0x14')]);this[_0xbd62('0x42')](this[_0xbd62('0x12')]);clearAgentBooked(this[_0xbd62('0x13')]);clearVoiceQueues(this[_0xbd62('0x16')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x42')]=function(_0x35e20f){var _0x163481=this;if(!_[_0xbd62('0x31')](_0x35e20f)){for(var _0x164980 in _0x35e20f){if(_0x35e20f[_0xbd62('0x32')](_0x164980)){_0x163481[_0xbd62('0x43')](_0x35e20f[_0x164980]);delete _0x35e20f[_0x164980];}}}};function loggerCatch(_0x3bfae6){return function(_0x1f66b6){logger[_0xbd62('0x3e')](_0x3bfae6,util[_0xbd62('0x44')](_0x1f66b6,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0xbd62('0x45')]=function(_0x2139d8,_0x5e471e,_0x1a9128){io['to'](_0x2139d8)[_0xbd62('0x45')](_0x5e471e,_0x1a9128);};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x46')]=function(_0x35675a){this['emit'](util[_0xbd62('0x47')](_0xbd62('0x48'),_0x35675a[_0xbd62('0x49')]),_0xbd62('0x4a'),_0x35675a);};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x43')]=function(_0x2bbcc0){this[_0xbd62('0x45')](util[_0xbd62('0x47')](_0xbd62('0x48'),_0x2bbcc0[_0xbd62('0x49')]),_0xbd62('0x4b'),_0x2bbcc0);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x5303b3){if(_0x5303b3[_0xbd62('0x4c')]===_0xbd62('0x4d')){var _0x4ea4ad={'id':_0x5303b3['id'],'name':_0x5303b3[_0xbd62('0x49')],'strategy':_0x5303b3[_0xbd62('0x4e')],'answered':_0x5303b3['answered'],'available':_0x5303b3['available'],'loggedIn':_0x5303b3[_0xbd62('0x4f')],'pTalking':_0x5303b3['pTalking'],'sumBillable':_0x5303b3[_0xbd62('0x50')],'sumDuration':_0x5303b3[_0xbd62('0x51')],'sumHoldTime':_0x5303b3[_0xbd62('0x52')]||0x0,'talking':_0x5303b3['talking'],'total':_0x5303b3[_0xbd62('0x53')],'type':_0x5303b3['type'],'unmanaged':_0x5303b3[_0xbd62('0x54')],'abandoned':_0x5303b3[_0xbd62('0x55')],'waiting':_0x5303b3['waiting']};if(_0x5303b3['Trunk']){_0x4ea4ad[_0xbd62('0x56')]={'id':_0x5303b3[_0xbd62('0x56')]['id'],'name':_0x5303b3[_0xbd62('0x56')][_0xbd62('0x49')],'active':_0x5303b3[_0xbd62('0x56')][_0xbd62('0x57')],'callerid':_0x5303b3['Trunk'][_0xbd62('0x58')]};}if(_0x5303b3[_0xbd62('0x59')]){_0x4ea4ad[_0xbd62('0x59')]={'id':_0x5303b3[_0xbd62('0x59')]['id'],'name':_0x5303b3['Interval'][_0xbd62('0x49')]};}var _0x409ab6=md5(JSON[_0xbd62('0x5a')](_0x4ea4ad));if(_0x5303b3['md5']!==_0x409ab6){_0x5303b3[_0xbd62('0x3')]=_0x409ab6;this[_0xbd62('0x45')](util[_0xbd62('0x47')]('voice:queue:%s',_0x4ea4ad[_0xbd62('0x49')]),'voice_queue:save',_0x4ea4ad);}}};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x5b')]=function(_0x291408){return _0x291408!==null&&!_[_0xbd62('0x30')](_0x291408);};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x2f')]=function(){var _0xf5df43=this;setInterval(function(){_0xf5df43[_0xbd62('0x36')]();ami['Action']({'action':'queues'})[_0xbd62('0x3b')](loggerCatch(_0xbd62('0x5c')));},0x2710);};VoiceQueueReport['prototype'][_0xbd62('0x2e')]=function(){var _0x1a6ca4=this;setInterval(function(){if(_0x1a6ca4[_0xbd62('0x5d')]){return ami['Action']({'action':_0xbd62('0x5e')})[_0xbd62('0x5f')](function(_0x4a837f){_0x1a6ca4[_0xbd62('0x5d')]=![];})[_0xbd62('0x3b')](loggerCatch(_0xbd62('0x60')));}},0x3e8);};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x19')]=function(_0xac4d6b){try{if(this['isNotNull'](_0xac4d6b)&&this[_0xbd62('0x5b')](_0xac4d6b[_0xbd62('0x61')])){if(this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]]){var _0x32af85=_['countBy'](this['channels'],_0xbd62('0x61'))[_0xac4d6b['queue']]||0x0;var _0xa29cf9=_0x32af85-_0xac4d6b['callers'];if(this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]][_0xbd62('0x62')]!==_[_0xbd62('0x63')](_0xac4d6b['callers'])||this[_0xbd62('0x16')][_0xac4d6b['queue']][_0xbd62('0x4f')]!==_['toNumber'](_0xac4d6b[_0xbd62('0x64')])||this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]][_0xbd62('0x65')]!==_['toNumber'](_0xac4d6b[_0xbd62('0x65')])||this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]]['talking']!==_0xa29cf9){this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]][_0xbd62('0x62')]=_[_0xbd62('0x63')](_0xac4d6b[_0xbd62('0x66')]);this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]][_0xbd62('0x4f')]=_[_0xbd62('0x63')](_0xac4d6b[_0xbd62('0x64')]);this['voiceQueues'][_0xac4d6b['queue']][_0xbd62('0x65')]=_[_0xbd62('0x63')](_0xac4d6b[_0xbd62('0x65')]);this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]][_0xbd62('0x34')]=_0xa29cf9>0x0?_0xa29cf9:0x0;this[_0xbd62('0x16')][_0xac4d6b['queue']][_0xbd62('0x34')]=this[_0xbd62('0x16')][_0xac4d6b['queue']][_0xbd62('0x34')]>_[_0xbd62('0x63')](_0xac4d6b[_0xbd62('0x64')])?_[_0xbd62('0x63')](_0xac4d6b[_0xbd62('0x64')]):this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]][_0xbd62('0x34')];this[_0xbd62('0x67')](this[_0xbd62('0x16')][_0xac4d6b[_0xbd62('0x61')]]);}ami[_0xbd62('0x45')](_0xbd62('0x68'),this[_0xbd62('0x16')][_0xac4d6b['queue']]);}}}catch(_0x466de9){logger['error'](_0xbd62('0x69'),util[_0xbd62('0x44')](_0x466de9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd62('0xd')]['syncQueueSummaryComplete']=function(_0x20bf55){this[_0xbd62('0x5d')]=!![];};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x6a')]=function(_0x30fdec){};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x1d')]=function(_0x3ea651){try{if(this['isNotNull'](_0x3ea651)){if(_['isUndefined'](this[_0xbd62('0x12')][_0x3ea651[_0xbd62('0x6b')]])){this[_0xbd62('0x12')][_0x3ea651[_0xbd62('0x6b')]]=[];this[_0xbd62('0x14')][_0x3ea651[_0xbd62('0x6b')]]={};}var _0x2d96be=new QueueReport();_0x2d96be[_0xbd62('0x49')]=_0x3ea651['queue'];_0x2d96be[_0xbd62('0x4c')]=this[_0xbd62('0x16')][_0x2d96be[_0xbd62('0x49')]]&&this[_0xbd62('0x16')][_0x2d96be[_0xbd62('0x49')]][_0xbd62('0x4c')]?this['voiceQueues'][_0x2d96be['name']]['type']||'inbound':'inbound';_0x2d96be[_0xbd62('0x61')]=_0x3ea651[_0xbd62('0x61')];_0x2d96be['queuecallerjoinAt']=moment()[_0xbd62('0x47')](_0xbd62('0x6c'));_0x2d96be[_0xbd62('0x6d')]=_0x3ea651[_0xbd62('0x6d')];_0x2d96be['count']=_0x3ea651[_0xbd62('0x6e')];_[_0xbd62('0x6f')](_0x2d96be,_[_0xbd62('0x70')](_0x3ea651,_[_0xbd62('0x71')](_0x2d96be)));this[_0xbd62('0x12')][_0x3ea651[_0xbd62('0x6b')]][_0xbd62('0x72')](_0x2d96be);this[_0xbd62('0x14')][_0x3ea651[_0xbd62('0x6b')]]=_0x2d96be;this[_0xbd62('0x46')](_0x2d96be);}}catch(_0x24b426){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xbd62('0x44')](_0x24b426,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x1f')]=function(_0x27ff86){try{if(this[_0xbd62('0x5b')](_0x27ff86)){if(this['queueReports'][_0x27ff86['uniqueid']]){var _0x28a559=_['last'](this['queueReports'][_0x27ff86[_0xbd62('0x6b')]]);_0x28a559[_0xbd62('0x73')]=![];_0x28a559[_0xbd62('0x74')]=null;_0x28a559['holdtime']=_0x27ff86[_0xbd62('0x75')];_0x28a559[_0xbd62('0x76')]=_0x27ff86['originalposition'];_0x28a559[_0xbd62('0x1e')]=!![];_0x28a559[_0xbd62('0x77')]=moment()[_0xbd62('0x47')](_0xbd62('0x6c'));_0x28a559[_0xbd62('0x78')]=_0xbd62('0x79');_0x28a559['lastAssignedTo']=null;this['channels'][_0x27ff86[_0xbd62('0x6b')]]=_0x28a559;this[_0xbd62('0x43')](_0x28a559);}}}catch(_0x2773f1){logger[_0xbd62('0x3e')](_0xbd62('0x7a'),util[_0xbd62('0x44')](_0x2773f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x20')]=function(_0x48e993){try{if(this['isNotNull'](_0x48e993)){if(this[_0xbd62('0x12')][_0x48e993[_0xbd62('0x6b')]]){var _0xcbc60d=_[_0xbd62('0x7b')](this[_0xbd62('0x12')][_0x48e993[_0xbd62('0x6b')]]);_0xcbc60d['queuecallerleaveAt']=moment()[_0xbd62('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0xcbc60d[_0xbd62('0x7c')]=_0x48e993[_0xbd62('0x7c')];_0xcbc60d[_0xbd62('0x7d')]=_0x48e993['connectedlinename'];this[_0xbd62('0x14')][_0x48e993['uniqueid']]=_0xcbc60d;this[_0xbd62('0x46')](_0xcbc60d);}}}catch(_0xdcbe18){logger['error'](_0xbd62('0x7e'),util[_0xbd62('0x44')](_0xdcbe18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x23')]=function(_0x19534b){try{if(this[_0xbd62('0x5b')](_0x19534b)){if(this[_0xbd62('0x12')][_0x19534b['uniqueid']]){var _0x5d3726=_[_0xbd62('0x7b')](this[_0xbd62('0x12')][_0x19534b[_0xbd62('0x6b')]]);_0x5d3726[_0xbd62('0x73')]=!![];_0x5d3726[_0xbd62('0x78')]=_0xbd62('0x7f');}}}catch(_0x55842c){logger[_0xbd62('0x3e')]('[syncAgentConnect][VoiceQueueReport]',util['inspect'](_0x55842c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x80')]=function(_0x3dc304){try{if(this[_0xbd62('0x5b')](_0x3dc304)){if(this[_0xbd62('0x12')][_0x3dc304[_0xbd62('0x6b')]]){var _0x5c66ce=_['last'](this[_0xbd62('0x12')][_0x3dc304[_0xbd62('0x6b')]]);_0x5c66ce['queuecallerabandon']=![];_0x5c66ce[_0xbd62('0x77')]=null;_0x5c66ce['assigned']=!![];_0x5c66ce[_0xbd62('0x81')]=_0x3dc304[_0xbd62('0x82')];_0x5c66ce[_0xbd62('0x75')]=_0x3dc304['holdtime'];_0x5c66ce['queuecallercomplete']=!![];_0x5c66ce[_0xbd62('0x83')]=![];_0x5c66ce[_0xbd62('0x84')]=null;if(!_0x5c66ce['transfer']){if(_0x3dc304[_0xbd62('0x85')]==_0xbd62('0x86')){_0x5c66ce[_0xbd62('0x78')]='COMPLETED';}else{if(_[_0xbd62('0x87')](_0x3dc304[_0xbd62('0x88')][_0xbd62('0x89')](),_0xbd62('0x8a'))){if(this[_0xbd62('0x12')][_0x3dc304[_0xbd62('0x8b')]]){var _0x190395=_['last'](this['queueReports'][_0x3dc304[_0xbd62('0x8b')]]);_0x190395[_0xbd62('0x73')]=![];_0x190395['queuecallerexit']=!![];_0x190395[_0xbd62('0x84')]=moment(_0x5c66ce[_0xbd62('0x8c')])[_0xbd62('0x8d')](_0x3dc304[_0xbd62('0x75')],'seconds')[_0xbd62('0x47')](_0xbd62('0x6c'));_0x190395[_0xbd62('0x78')]='FORWARDTRANSFER';_0x190395['transfer']=!![];_0x190395[_0xbd62('0x8e')]='FORWARD';_0x190395[_0xbd62('0x8f')]=_0x3dc304[_0xbd62('0x90')];_0x190395[_0xbd62('0x91')]=_0x3dc304[_0xbd62('0x6b')];var _0x48a37f=this[_0xbd62('0x12')][_0x3dc304[_0xbd62('0x8b')]];this[_0xbd62('0x12')][_0x3dc304[_0xbd62('0x8b')]]=this[_0xbd62('0x12')][_0x3dc304['uniqueid']];this[_0xbd62('0x12')][_0x3dc304['uniqueid']]=_0x48a37f;}}else{_0x5c66ce[_0xbd62('0x78')]=_0xbd62('0x92')+_0x3dc304[_0xbd62('0x85')][_0xbd62('0x93')]();}}}this[_0xbd62('0x14')][_0x3dc304[_0xbd62('0x6b')]]=_0x5c66ce;this[_0xbd62('0x43')](_0x5c66ce);}}}catch(_0x2a8f8d){logger[_0xbd62('0x3e')](_0xbd62('0x94'),util[_0xbd62('0x44')](_0x2a8f8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x1cbe13){try{if(this[_0xbd62('0x5b')](_0x1cbe13)){this['addVariable'](_0x1cbe13[_0xbd62('0x6b')],_[_0xbd62('0x71')](_0x1cbe13['variable'])[0x0],_0x1cbe13[_0xbd62('0x95')]);if(this[_0xbd62('0x12')][_0x1cbe13[_0xbd62('0x6b')]]){var _0x4f62fd=_[_0xbd62('0x7b')](this[_0xbd62('0x12')][_0x1cbe13[_0xbd62('0x6b')]]);if(_0x4f62fd){if(this['isNotNull'](_0x1cbe13[_0xbd62('0x96')])&&this[_0xbd62('0x5b')](_0x1cbe13[_0xbd62('0x96')][_0xbd62('0x97')])){switch(_0x1cbe13[_0xbd62('0x95')]){case'CONTINUE':_0x4f62fd[_0xbd62('0x83')]=![];_0x4f62fd[_0xbd62('0x84')]=null;break;default:_0x4f62fd[_0xbd62('0x83')]=!![];_0x4f62fd[_0xbd62('0x84')]=moment()[_0xbd62('0x47')](_0xbd62('0x6c'));_0x4f62fd[_0xbd62('0x98')]=moment()[_0xbd62('0x47')](_0xbd62('0x6c'));}_0x4f62fd[_0xbd62('0x1e')]=![];_0x4f62fd[_0xbd62('0x77')]=null;_0x4f62fd[_0xbd62('0x78')]=_0x1cbe13[_0xbd62('0x95')];this[_0xbd62('0x14')][_0x1cbe13[_0xbd62('0x6b')]]=_0x4f62fd;this['emitVoiceQueueChannelRemove'](_0x4f62fd);}else if(this[_0xbd62('0x5b')](_0x1cbe13[_0xbd62('0x96')])&&this[_0xbd62('0x5b')](_0x1cbe13[_0xbd62('0x96')][_0xbd62('0x99')])){if(!_0x4f62fd[_0xbd62('0x1e')]){_0x4f62fd[_0xbd62('0x83')]=!![];_0x4f62fd['queuecallerexitAt']=moment()[_0xbd62('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f62fd['queuecallerexitreason']=_0xbd62('0x9a');_0x4f62fd[_0xbd62('0x98')]=moment()[_0xbd62('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbd62('0x14')][_0x1cbe13[_0xbd62('0x6b')]]=_0x4f62fd;}}_0x4f62fd[_0xbd62('0x18')]=this[_0xbd62('0x18')][_0x1cbe13[_0xbd62('0x6b')]];}}}}catch(_0x1bf3c2){logger[_0xbd62('0x3e')](_0xbd62('0x9b'),util[_0xbd62('0x44')](_0x1bf3c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbd62('0xd')][_0xbd62('0x9c')]=function(_0x21eb83,_0x2e10e0,_0x264172){var _0x3e3ab9=['rtpaudioqos',_0xbd62('0x9d'),_0xbd62('0x9e'),_0xbd62('0x9f'),_0xbd62('0xa0'),_0xbd62('0xa1'),'rtpaudioqosrtt',_0xbd62('0xa2'),_0xbd62('0xa3'),_0xbd62('0xa4'),_0xbd62('0xa5'),_0xbd62('0xa6'),_0xbd62('0xa7'),_0xbd62('0xa8'),_0xbd62('0xa9'),_0xbd62('0xaa'),_0xbd62('0x82'),_0xbd62('0xab'),_0xbd62('0xac')];if(!_['isNil'](_0x2e10e0)&&!_[_0xbd62('0xad')](_0x3e3ab9,_0x2e10e0)){if(_['isUndefined'](this[_0xbd62('0x18')][_0x21eb83])){this[_0xbd62('0x18')][_0x21eb83]={};}this[_0xbd62('0x18')][_0x21eb83][_0x2e10e0]=_0x264172;}};VoiceQueueReport['prototype'][_0xbd62('0xae')]=function(_0x3a0287){try{if(this[_0xbd62('0x5b')](_0x3a0287)){if(this[_0xbd62('0x12')][_0x3a0287[_0xbd62('0x6b')]]){for(var _0x4626dc=0x0,_0xb97d89={};_0x4626dc0x0?_0x5a29b5:0x0;this[_0x26d4('0x13')][_0x212eb5[_0x26d4('0x67')]][_0x26d4('0x37')]=this['voiceQueues'][_0x212eb5[_0x26d4('0x67')]][_0x26d4('0x37')]>_[_0x26d4('0x69')](_0x212eb5['loggedin'])?_[_0x26d4('0x69')](_0x212eb5['loggedin']):this[_0x26d4('0x13')][_0x212eb5[_0x26d4('0x67')]]['talking'];this[_0x26d4('0x6b')](this[_0x26d4('0x13')][_0x212eb5[_0x26d4('0x67')]]);}ami[_0x26d4('0x4c')](_0x26d4('0x6c'),this[_0x26d4('0x13')][_0x212eb5[_0x26d4('0x67')]]);}}}catch(_0x1abb47){logger['error']('[syncQueueSummary][VoiceQueueReport]',util[_0x26d4('0x4b')](_0x1abb47,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x26d4('0xc')]['syncQueueSummaryComplete']=function(_0x26180c){this[_0x26d4('0x14')]=!![];};VoiceQueueReport[_0x26d4('0xc')][_0x26d4('0x6d')]=function(_0x145af1){};VoiceQueueReport[_0x26d4('0xc')][_0x26d4('0x1c')]=function(_0x26ac09){try{if(this[_0x26d4('0x62')](_0x26ac09)){if(_['isUndefined'](this['queueReports'][_0x26ac09[_0x26d4('0x6e')]])){this[_0x26d4('0xf')][_0x26ac09[_0x26d4('0x6e')]]=[];this[_0x26d4('0x11')][_0x26ac09[_0x26d4('0x6e')]]={};}var _0x44ff47=new QueueReport();_0x44ff47['name']=_0x26ac09['queue'];_0x44ff47[_0x26d4('0x53')]=this['voiceQueues'][_0x44ff47[_0x26d4('0x4f')]]&&this[_0x26d4('0x13')][_0x44ff47[_0x26d4('0x4f')]][_0x26d4('0x53')]?this[_0x26d4('0x13')][_0x44ff47[_0x26d4('0x4f')]][_0x26d4('0x53')]||_0x26d4('0x54'):'inbound';_0x44ff47['queue']=_0x26ac09[_0x26d4('0x67')];_0x44ff47['queuecallerjoinAt']=moment()[_0x26d4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x44ff47['position']=_0x26ac09['position'];_0x44ff47['count']=_0x26ac09[_0x26d4('0x6f')];_[_0x26d4('0x70')](_0x44ff47,_[_0x26d4('0x71')](_0x26ac09,_[_0x26d4('0x72')](_0x44ff47)));this[_0x26d4('0xf')][_0x26ac09[_0x26d4('0x6e')]][_0x26d4('0x73')](_0x44ff47);this[_0x26d4('0x11')][_0x26ac09[_0x26d4('0x6e')]]=_0x44ff47;this[_0x26d4('0x4d')](_0x44ff47);}}catch(_0x3a15c8){logger[_0x26d4('0x46')](_0x26d4('0x74'),util['inspect'](_0x3a15c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x26d4('0xc')][_0x26d4('0x1e')]=function(_0xefaa90){try{if(this[_0x26d4('0x62')](_0xefaa90)){if(this[_0x26d4('0xf')][_0xefaa90[_0x26d4('0x6e')]]){var _0x28e839=_[_0x26d4('0x75')](this[_0x26d4('0xf')][_0xefaa90[_0x26d4('0x6e')]]);_0x28e839[_0x26d4('0x76')]=![];_0x28e839['queuecallercompleteAt']=null;_0x28e839[_0x26d4('0x77')]=_0xefaa90[_0x26d4('0x77')];_0x28e839[_0x26d4('0x78')]=_0xefaa90[_0x26d4('0x78')];_0x28e839[_0x26d4('0x1d')]=!![];_0x28e839['queuecallerabandonAt']=moment()['format'](_0x26d4('0x79'));_0x28e839[_0x26d4('0x7a')]='ABANDONED';_0x28e839['lastAssignedTo']=null;this[_0x26d4('0x11')][_0xefaa90[_0x26d4('0x6e')]]=_0x28e839;this[_0x26d4('0x4a')](_0x28e839);}}}catch(_0x4bad4b){logger[_0x26d4('0x46')](_0x26d4('0x7b'),util['inspect'](_0x4bad4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x26d4('0xc')]['syncQueueCallerLeave']=function(_0x1bbd91){try{if(this[_0x26d4('0x62')](_0x1bbd91)){if(this[_0x26d4('0xf')][_0x1bbd91['uniqueid']]){var _0x3eb73b=_['last'](this[_0x26d4('0xf')][_0x1bbd91[_0x26d4('0x6e')]]);_0x3eb73b[_0x26d4('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3eb73b[_0x26d4('0x7d')]=_0x1bbd91['connectedlinenum'];_0x3eb73b[_0x26d4('0x7e')]=_0x1bbd91['connectedlinename'];this[_0x26d4('0x11')][_0x1bbd91[_0x26d4('0x6e')]]=_0x3eb73b;this[_0x26d4('0x4d')](_0x3eb73b);}}}catch(_0x1506c2){logger[_0x26d4('0x46')]('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0x1506c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x26d4('0xc')][_0x26d4('0x24')]=function(_0x553495){try{if(this[_0x26d4('0x62')](_0x553495)){if(this['queueReports'][_0x553495[_0x26d4('0x6e')]]){var _0x327b34=_[_0x26d4('0x75')](this[_0x26d4('0xf')][_0x553495[_0x26d4('0x6e')]]);_0x327b34[_0x26d4('0x76')]=!![];_0x327b34[_0x26d4('0x7a')]=_0x26d4('0x7f');}}}catch(_0x2d01c4){logger['error'](_0x26d4('0x80'),util[_0x26d4('0x4b')](_0x2d01c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x26d4('0x22')]=function(_0x419a52){try{if(this[_0x26d4('0x62')](_0x419a52)){if(this[_0x26d4('0xf')][_0x419a52[_0x26d4('0x6e')]]){var _0x3e5fce=_[_0x26d4('0x75')](this['queueReports'][_0x419a52['uniqueid']]);_0x3e5fce[_0x26d4('0x1d')]=![];_0x3e5fce[_0x26d4('0x81')]=null;_0x3e5fce[_0x26d4('0x82')]=!![];_0x3e5fce[_0x26d4('0x83')]=_0x419a52[_0x26d4('0x84')];_0x3e5fce[_0x26d4('0x77')]=_0x419a52[_0x26d4('0x77')];_0x3e5fce['queuecallercomplete']=!![];_0x3e5fce[_0x26d4('0x85')]=![];_0x3e5fce[_0x26d4('0x86')]=null;if(!_0x3e5fce[_0x26d4('0x87')]){if(_0x419a52[_0x26d4('0x88')]==_0x26d4('0x87')){_0x3e5fce[_0x26d4('0x7a')]=_0x26d4('0x89');}else{if(_[_0x26d4('0x8a')](_0x419a52[_0x26d4('0x42')]['toLowerCase'](),_0x26d4('0x8b'))){if(this[_0x26d4('0xf')][_0x419a52[_0x26d4('0x8c')]]){var _0x184804=_[_0x26d4('0x75')](this[_0x26d4('0xf')][_0x419a52[_0x26d4('0x8c')]]);_0x184804[_0x26d4('0x76')]=![];_0x184804['queuecallerexit']=!![];_0x184804['queuecallerexitAt']=moment(_0x3e5fce[_0x26d4('0x8d')])['add'](_0x419a52['holdtime'],_0x26d4('0x8e'))[_0x26d4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x184804[_0x26d4('0x7a')]=_0x26d4('0x8f');_0x184804['transfer']=!![];_0x184804[_0x26d4('0x90')]=_0x26d4('0x91');_0x184804[_0x26d4('0x92')]=_0x419a52[_0x26d4('0x93')];_0x184804['transferuniqueid']=_0x419a52[_0x26d4('0x6e')];var _0x2b123e=this['queueReports'][_0x419a52[_0x26d4('0x8c')]];this['queueReports'][_0x419a52['linkedid']]=this[_0x26d4('0xf')][_0x419a52[_0x26d4('0x6e')]];this[_0x26d4('0xf')][_0x419a52[_0x26d4('0x6e')]]=_0x2b123e;}}else{_0x3e5fce[_0x26d4('0x7a')]=_0x26d4('0x94')+_0x419a52[_0x26d4('0x88')][_0x26d4('0x95')]();}}}this['channels'][_0x419a52[_0x26d4('0x6e')]]=_0x3e5fce;this[_0x26d4('0x4a')](_0x3e5fce);}}}catch(_0x94fc12){logger['error'](_0x26d4('0x96'),util[_0x26d4('0x4b')](_0x94fc12,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x26d4('0xc')][_0x26d4('0x26')]=function(_0x20fe21){try{if(this[_0x26d4('0x62')](_0x20fe21)){this[_0x26d4('0x97')](_0x20fe21[_0x26d4('0x6e')],_[_0x26d4('0x72')](_0x20fe21[_0x26d4('0x98')])[0x0],_0x20fe21['value']);if(this[_0x26d4('0xf')][_0x20fe21[_0x26d4('0x6e')]]){var _0x32f9c2=_[_0x26d4('0x75')](this['queueReports'][_0x20fe21[_0x26d4('0x6e')]]);if(_0x32f9c2){if(this['isNotNull'](_0x20fe21['variable'])&&this[_0x26d4('0x62')](_0x20fe21['variable'][_0x26d4('0x99')])){switch(_0x20fe21[_0x26d4('0x9a')]){case _0x26d4('0x9b'):_0x32f9c2['queuecallerexit']=![];_0x32f9c2['queuecallerexitAt']=null;break;default:_0x32f9c2['queuecallerexit']=!![];_0x32f9c2[_0x26d4('0x86')]=moment()[_0x26d4('0x51')](_0x26d4('0x79'));_0x32f9c2[_0x26d4('0x7c')]=moment()[_0x26d4('0x51')]('YYYY-MM-DD\x20HH:mm:ss');}_0x32f9c2['queuecallerabandon']=![];_0x32f9c2[_0x26d4('0x81')]=null;_0x32f9c2[_0x26d4('0x7a')]=_0x20fe21['value'];this[_0x26d4('0x11')][_0x20fe21[_0x26d4('0x6e')]]=_0x32f9c2;this[_0x26d4('0x4a')](_0x32f9c2);}else if(this[_0x26d4('0x62')](_0x20fe21['variable'])&&this[_0x26d4('0x62')](_0x20fe21[_0x26d4('0x98')]['queueposition'])){if(!_0x32f9c2[_0x26d4('0x1d')]){_0x32f9c2[_0x26d4('0x85')]=!![];_0x32f9c2[_0x26d4('0x86')]=moment()[_0x26d4('0x51')](_0x26d4('0x79'));_0x32f9c2[_0x26d4('0x7a')]=_0x26d4('0x9c');_0x32f9c2[_0x26d4('0x7c')]=moment()['format'](_0x26d4('0x79'));this['channels'][_0x20fe21[_0x26d4('0x6e')]]=_0x32f9c2;}}_0x32f9c2[_0x26d4('0x47')]=this[_0x26d4('0x47')][_0x20fe21[_0x26d4('0x6e')]];}}}}catch(_0x629281){logger[_0x26d4('0x46')](_0x26d4('0x9d'),util[_0x26d4('0x4b')](_0x629281,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x26d4('0xc')]['addVariable']=function(_0x37903d,_0x47b799,_0xef8a23){var _0x55603a=[_0x26d4('0x9e'),_0x26d4('0x9f'),_0x26d4('0xa0'),_0x26d4('0xa1'),'rtpaudioqosloss',_0x26d4('0xa2'),_0x26d4('0xa3'),_0x26d4('0xa4'),'sipcallid',_0x26d4('0xa5'),_0x26d4('0xa6'),_0x26d4('0xa7'),'membercalls',_0x26d4('0xa8'),_0x26d4('0xa9'),_0x26d4('0xaa'),_0x26d4('0x84'),'memberpenalty',_0x26d4('0xab')];if(!_[_0x26d4('0x3f')](_0x47b799)&&!_[_0x26d4('0xac')](_0x55603a,_0x47b799)){if(_[_0x26d4('0x63')](this['variables'][_0x37903d])){this[_0x26d4('0x47')][_0x37903d]={};}this['variables'][_0x37903d][_0x47b799]=_0xef8a23;}};VoiceQueueReport['prototype'][_0x26d4('0x28')]=function(_0x4b2f84){try{if(this[_0x26d4('0x62')](_0x4b2f84)){if(this[_0x26d4('0xf')][_0x4b2f84[_0x26d4('0x6e')]]){for(var _0x321b32=0x0,_0x2868d8={};_0x321b32=0x0?moment(_0x365f1e[_0x871e('0x18')])[_0x871e('0xc')](_0x365f1e[_0x871e('0x17')],_0x871e('0xd')):null,'data1':_0x871e('0x19'),'data2':_0x365f1e[_0x871e('0x12')],'data3':_0x365f1e['exten'],'data4':_0x365f1e['dialstring']||null,'role':_0x871e('0x1a'),'internal':_0x365f1e[_0x871e('0x12')]?_[_0x871e('0x1b')](_0x365f1e[_0x871e('0x12')]):undefined,'uniqueid':_0x365f1e['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xaec7=['voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','accountcode','voiceDialReport','membername','starttime','endtime','agent','uniqueid','moment','lodash','util','../client'];(function(_0x2fa4be,_0x517a1d){var _0x106c70=function(_0x2abce4){while(--_0x2abce4){_0x2fa4be['push'](_0x2fa4be['shift']());}};_0x106c70(++_0x517a1d);}(_0xaec7,0x168));var _0x7aec=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xaec7[_0x5948dd];return _0xb1f8be;};'use strict';var moment=require(_0x7aec('0x0'));var _=require(_0x7aec('0x1'));var util=require(_0x7aec('0x2'));var client=require(_0x7aec('0x3'));exports[_0x7aec('0x4')]=function(_0x19bbf1){var _0x36d85c=_0x19bbf1[_0x7aec('0x5')]||_0x19bbf1['queuecallerexitAt'];return client[_0x7aec('0x6')](_0x7aec('0x7'),{'body':{'channel':_0x7aec('0x8'),'membername':_0x19bbf1[_0x7aec('0x9')],'interface':_[_0x7aec('0xa')](_0x19bbf1[_0x7aec('0xb')])?util[_0x7aec('0xc')](_0x7aec('0xd'),_0x19bbf1['lastAssignedTo']):_0x19bbf1['interface'],'type':_0x7aec('0xe'),'enterAt':_0x19bbf1[_0x7aec('0xf')],'exitAt':_0x36d85c,'duration':moment(_0x36d85c)[_0x7aec('0x10')](_0x19bbf1[_0x7aec('0xf')],_0x7aec('0x11')),'data1':_0x7aec('0x12'),'data2':_0x19bbf1[_0x7aec('0x13')],'data3':_0x19bbf1['exten'],'data4':null,'data5':_0x19bbf1[_0x7aec('0x14')],'role':'agent','internal':_0x19bbf1['accountcode']?_['toNumber'](_0x19bbf1[_0x7aec('0x15')]):undefined,'uniqueid':_0x19bbf1['uniqueid']},'log':'CreateMemberReport'});};exports[_0x7aec('0x16')]=function(_0x3cb8f8){return client['Request'](_0x7aec('0x7'),{'body':{'channel':_0x7aec('0x8'),'membername':_0x3cb8f8[_0x7aec('0x17')],'interface':_0x3cb8f8[_0x7aec('0xb')],'type':_0x7aec('0xe'),'enterAt':_0x3cb8f8[_0x7aec('0x18')],'exitAt':_0x3cb8f8[_0x7aec('0x19')],'duration':moment(_0x3cb8f8['endtime'])['diff'](_0x3cb8f8[_0x7aec('0x18')],_0x7aec('0x11'))>=0x0?moment(_0x3cb8f8[_0x7aec('0x19')])[_0x7aec('0x10')](_0x3cb8f8[_0x7aec('0x18')],_0x7aec('0x11')):null,'data1':'outbound','data2':_0x3cb8f8[_0x7aec('0x15')],'data3':_0x3cb8f8['exten'],'data4':_0x3cb8f8['dialstring']||null,'role':_0x7aec('0x1a'),'internal':_0x3cb8f8['accountcode']?_['toNumber'](_0x3cb8f8[_0x7aec('0x15')]):undefined,'uniqueid':_0x3cb8f8[_0x7aec('0x1b')]},'log':_0x7aec('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b202044..d567a0c 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 _0x858e=['Request','name','GetTemplate','getTemplates'];(function(_0x46eded,_0x5a4354){var _0x1300d7=function(_0x243e58){while(--_0x243e58){_0x46eded['push'](_0x46eded['shift']());}};_0x1300d7(++_0x5a4354);}(_0x858e,0x11f));var _0xe858=function(_0x8212b9,_0x4b8686){_0x8212b9=_0x8212b9-0x0;var _0x10184c=_0x858e[_0x8212b9];return _0x10184c;};'use strict';var client=require('../client');exports[_0xe858('0x0')]=function(_0x3d5f19){return function(_0x3c0269){return client[_0xe858('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xe858('0x2'),'html']},'log':_0xe858('0x3')});};}; \ No newline at end of file +var _0x6c02=['html','Request','name'];(function(_0x52a2a0,_0x14e8eb){var _0x3a8cc2=function(_0x164e80){while(--_0x164e80){_0x52a2a0['push'](_0x52a2a0['shift']());}};_0x3a8cc2(++_0x14e8eb);}(_0x6c02,0x1e4));var _0x26c0=function(_0x5b6429,_0x286353){_0x5b6429=_0x5b6429-0x0;var _0x5a0fac=_0x6c02[_0x5b6429];return _0x5a0fac;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x2c3450){return function(_0x3957e8){return client[_0x26c0('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x26c0('0x1'),_0x26c0('0x2')]},'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 d82c6c6..7c9841d 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 _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x3b106e,_0x1605a5){var _0x39edde=function(_0x1db83e){while(--_0x1db83e){_0x3b106e['push'](_0x3b106e['shift']());}};_0x39edde(++_0x1605a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x328a5c,_0x329855){var _0x36f0a9=function(_0x4e66a2){while(--_0x4e66a2){_0x328a5c['push'](_0x328a5c['shift']());}};_0x36f0a9(++_0x329855);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'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 608f61f..0985d86 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 _0x7c3b=['../client','getTrunks','GetTrunk','name','registry'];(function(_0x584095,_0x375735){var _0x451193=function(_0x4dbef8){while(--_0x4dbef8){_0x584095['push'](_0x584095['shift']());}};_0x451193(++_0x375735);}(_0x7c3b,0x17c));var _0xb7c3=function(_0x219f4c,_0x3202af){_0x219f4c=_0x219f4c-0x0;var _0x303695=_0x7c3b[_0x219f4c];return _0x303695;};'use strict';var client=require(_0xb7c3('0x0'));exports[_0xb7c3('0x1')]=function(_0x1e79a3){return function(_0x386c01){return client['Request'](_0xb7c3('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb7c3('0x3'),_0xb7c3('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xd271=['Request','GetTrunk','name','registry','../client','getTrunks'];(function(_0x1e8a7c,_0x36f81d){var _0x2ee21f=function(_0x59e3cc){while(--_0x59e3cc){_0x1e8a7c['push'](_0x1e8a7c['shift']());}};_0x2ee21f(++_0x36f81d);}(_0xd271,0x1ba));var _0x1d27=function(_0x3e639a,_0x34419b){_0x3e639a=_0x3e639a-0x0;var _0x11f4bd=_0xd271[_0x3e639a];return _0x11f4bd;};'use strict';var client=require(_0x1d27('0x0'));exports[_0x1d27('0x1')]=function(_0x5b5d61){return function(_0x5ea1fa){return client[_0x1d27('0x2')](_0x1d27('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1d27('0x4'),_0x1d27('0x5')]},'log':_0x1d27('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 227e045..a8c8de3 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 _0x354d=['PauseUser','savePause','saveUnpause','getAgent','email','accountcode','fullname','online','lastPauseAt','../client','getAgents','Request','agent','name','lastLoginAt','pauseType','phone','interface','GetUser','telephone','internal','getTelephones'];(function(_0x2e5cc7,_0x2b5aa9){var _0xb1a610=function(_0x17bd7b){while(--_0x17bd7b){_0x2e5cc7['push'](_0x2e5cc7['shift']());}};_0xb1a610(++_0x2b5aa9);}(_0x354d,0x77));var _0xd354=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x354d[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0xd354('0x0'));exports[_0xd354('0x1')]=function(){return function(){return client[_0xd354('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0xd354('0x3')},'attributes':['id',_0xd354('0x4'),'email','accountcode','fullname','online',_0xd354('0x5'),_0xd354('0x6'),'lastPauseAt','voicePause',_0xd354('0x7'),'mobile',_0xd354('0x8')]},'log':_0xd354('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0xd354('0x2')](_0xd354('0x9'),{'options':{'raw':!![],'where':{'role':_0xd354('0xa')},'attributes':['id',_0xd354('0x4'),'accountcode',_0xd354('0xb')]},'log':_0xd354('0xc')});};};exports['savePause']=function(_0x3f7782,_0x39cede,_0x271877){return client[_0xd354('0x2')](_0xd354('0xd'),{'body':{'type':_0x39cede,'uniqueid':_0x271877},'options':{'where':{'id':_0x3f7782['id']}},'log':_0xd354('0xe')});};exports[_0xd354('0xf')]=function(_0x665562){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x665562['id']}},'log':_0xd354('0xe')});};exports[_0xd354('0x10')]=function(_0x4b13b5){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0xd354('0x3'),'id':_0x4b13b5},'attributes':['id','name',_0xd354('0x11'),_0xd354('0x12'),_0xd354('0x13'),_0xd354('0x14'),'lastLoginAt','pauseType',_0xd354('0x15'),'voicePause','interface']},'log':_0xd354('0x10')});}; \ No newline at end of file +var _0x29c9=['getTelephones','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt','voicePause','../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','pauseType','phone','mobile','interface'];(function(_0xc8c4d0,_0x5b6bc9){var _0x273772=function(_0x383976){while(--_0x383976){_0xc8c4d0['push'](_0xc8c4d0['shift']());}};_0x273772(++_0x5b6bc9);}(_0x29c9,0x113));var _0x929c=function(_0x16b0c0,_0x4c19b0){_0x16b0c0=_0x16b0c0-0x0;var _0x4f3bbf=_0x29c9[_0x16b0c0];return _0x4f3bbf;};'use strict';var client=require(_0x929c('0x0'));exports[_0x929c('0x1')]=function(){return function(){return client[_0x929c('0x2')](_0x929c('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x929c('0x4'),_0x929c('0x5'),_0x929c('0x6'),_0x929c('0x7'),_0x929c('0x8'),'lastLoginAt',_0x929c('0x9'),'lastPauseAt','voicePause',_0x929c('0xa'),_0x929c('0xb'),_0x929c('0xc')]},'log':_0x929c('0x1')});};};exports[_0x929c('0xd')]=function(){return function(){return client[_0x929c('0x2')](_0x929c('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x929c('0x4'),_0x929c('0x6'),_0x929c('0xe')]},'log':_0x929c('0xd')});};};exports[_0x929c('0xf')]=function(_0x3cd4e3,_0xe14b2a,_0x120ab7){return client['Request'](_0x929c('0x10'),{'body':{'type':_0xe14b2a,'uniqueid':_0x120ab7},'options':{'where':{'id':_0x3cd4e3['id']}},'log':_0x929c('0xf')});};exports[_0x929c('0x11')]=function(_0x554a55){return client[_0x929c('0x2')](_0x929c('0x12'),{'body':{},'options':{'where':{'id':_0x554a55['id']}},'log':_0x929c('0xf')});};exports[_0x929c('0x13')]=function(_0x28f13f){return client[_0x929c('0x2')](_0x929c('0x14'),{'options':{'raw':![],'where':{'role':_0x929c('0x15'),'id':_0x28f13f},'attributes':['id','name',_0x929c('0x5'),_0x929c('0x6'),_0x929c('0x7'),_0x929c('0x8'),'lastLoginAt',_0x929c('0x9'),_0x929c('0x16'),_0x929c('0x17'),_0x929c('0xc')]},'log':_0x929c('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b3cce71..922c9e5 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 _0xbee3=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x20e945,_0x18116b){var _0x1ea152=function(_0x193ed4){while(--_0x193ed4){_0x20e945['push'](_0x20e945['shift']());}};_0x1ea152(++_0x18116b);}(_0xbee3,0x16a));var _0x3bee=function(_0x174833,_0x4f5b0a){_0x174833=_0x174833-0x0;var _0x2b2f9c=_0xbee3[_0x174833];return _0x2b2f9c;};'use strict';var client=require(_0x3bee('0x0'));exports[_0x3bee('0x1')]=function(_0x1f25ad){return client[_0x3bee('0x2')](_0x3bee('0x3'),{'body':_0x1f25ad,'log':_0x3bee('0x3')});};exports[_0x3bee('0x4')]=function(_0x206128,_0x3e5f6f,_0x2e9c5a){return client[_0x3bee('0x2')](_0x3bee('0x5'),{'body':_0x206128,'options':{'where':{'uniqueid':_0x3e5f6f,'interface':_0x2e9c5a}},'log':_0x3bee('0x5')});}; \ No newline at end of file +var _0xb499=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0xb499,0x13d));var _0x9b49=function(_0x1d26af,_0x5edac5){_0x1d26af=_0x1d26af-0x0;var _0x58c86b=_0xb499[_0x1d26af];return _0x58c86b;};'use strict';var client=require(_0x9b49('0x0'));exports[_0x9b49('0x1')]=function(_0x2fdd6d){return client[_0x9b49('0x2')](_0x9b49('0x3'),{'body':_0x2fdd6d,'log':_0x9b49('0x3')});};exports['update']=function(_0x4c8682,_0x8fefb3,_0x260714){return client[_0x9b49('0x2')](_0x9b49('0x4'),{'body':_0x4c8682,'options':{'where':{'uniqueid':_0x8fefb3,'interface':_0x260714}},'log':_0x9b49('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index aa16a09..5cdb5da 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 _0xe951=['Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','util','lodash','../client'];(function(_0x29ae7f,_0x12da1a){var _0x3a1eb5=function(_0x29e2f8){while(--_0x29e2f8){_0x29ae7f['push'](_0x29ae7f['shift']());}};_0x3a1eb5(++_0x12da1a);}(_0xe951,0x1a1));var _0x1e95=function(_0x3f4d55,_0x21aca6){_0x3f4d55=_0x3f4d55-0x0;var _0x3e9d17=_0xe951[_0x3f4d55];return _0x3e9d17;};'use strict';var moment=require('moment');var util=require(_0x1e95('0x0'));var _=require(_0x1e95('0x1'));var client=require(_0x1e95('0x2'));exports['create']=function(_0x3ecbf4){return client[_0x1e95('0x3')](_0x1e95('0x4'),{'body':_['merge'](_0x3ecbf4,{'source':_0x3ecbf4[_0x1e95('0x5')],'destinationcontext':_0x3ecbf4[_0x1e95('0x6')],'callerid':_0x3ecbf4['callerid'],'amaflags':_0x1e95('0x7')}),'log':_0x1e95('0x4')});};exports[_0x1e95('0x8')]=function(){return function(){return client[_0x1e95('0x3')](_0x1e95('0x9'),{'options':{'where':{'type':[_0x1e95('0xa')],'createdAt':{'$between':[moment()[_0x1e95('0xb')](_0x1e95('0xc'))[_0x1e95('0xd')](_0x1e95('0xe')),moment()[_0x1e95('0xf')](_0x1e95('0xc'))['format'](_0x1e95('0xe'))]}},'attributes':[_0x1e95('0x10'),_0x1e95('0x11'),'duration',_0x1e95('0x12')]},'log':_0x1e95('0x13')});};}; \ No newline at end of file +var _0x4576=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf'];(function(_0x2a78d9,_0x271b92){var _0x293145=function(_0x164b12){while(--_0x164b12){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x293145(++_0x271b92);}(_0x4576,0x7f));var _0x6457=function(_0xece516,_0x8e1db6){_0xece516=_0xece516-0x0;var _0x41b360=_0x4576[_0xece516];return _0x41b360;};'use strict';var moment=require(_0x6457('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x6457('0x1'));exports[_0x6457('0x2')]=function(_0x53ce8d){return client[_0x6457('0x3')]('CreateVoiceCallReport',{'body':_[_0x6457('0x4')](_0x53ce8d,{'source':_0x53ce8d[_0x6457('0x5')],'destinationcontext':_0x53ce8d[_0x6457('0x6')],'callerid':_0x53ce8d[_0x6457('0x7')],'amaflags':_0x6457('0x8')}),'log':_0x6457('0x9')});};exports[_0x6457('0xa')]=function(){return function(){return client[_0x6457('0x3')](_0x6457('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x6457('0xc')](_0x6457('0xd'))[_0x6457('0xe')](_0x6457('0xf')),moment()['endOf'](_0x6457('0xd'))[_0x6457('0xe')](_0x6457('0xf'))]}},'attributes':[_0x6457('0x10'),_0x6457('0x11'),'duration',_0x6457('0x12')]},'log':_0x6457('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index def0713..e34605e 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 _0xea03=['../client','create','CreateVoiceDialReport'];(function(_0x3dfa21,_0x3f7357){var _0x3367e4=function(_0x1c8977){while(--_0x1c8977){_0x3dfa21['push'](_0x3dfa21['shift']());}};_0x3367e4(++_0x3f7357);}(_0xea03,0xf3));var _0x3ea0=function(_0x49282b,_0x4e2125){_0x49282b=_0x49282b-0x0;var _0xcb542e=_0xea03[_0x49282b];return _0xcb542e;};'use strict';var client=require(_0x3ea0('0x0'));exports[_0x3ea0('0x1')]=function(_0x32bb9e){return client['Request'](_0x3ea0('0x2'),{'body':_0x32bb9e,'log':_0x3ea0('0x2')});}; \ No newline at end of file +var _0x8c81=['CreateVoiceDialReport'];(function(_0x37b346,_0xd56c2f){var _0x5bc24e=function(_0x323cf5){while(--_0x323cf5){_0x37b346['push'](_0x37b346['shift']());}};_0x5bc24e(++_0xd56c2f);}(_0x8c81,0x165));var _0x18c8=function(_0x52a0f5,_0x5fd44f){_0x52a0f5=_0x52a0f5-0x0;var _0x36a15f=_0x8c81[_0x52a0f5];return _0x36a15f;};'use strict';var client=require('../client');exports['create']=function(_0x1b5bcf){return client['Request'](_0x18c8('0x0'),{'body':_0x1b5bcf,'log':_0x18c8('0x0')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 956852a..34ed5f2 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 _0xaec9=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x4c207b,_0x59f530){var _0x560c4f=function(_0x289669){while(--_0x289669){_0x4c207b['push'](_0x4c207b['shift']());}};_0x560c4f(++_0x59f530);}(_0xaec9,0x112));var _0x9aec=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xaec9[_0x29b609];return _0x54c952;};'use strict';var client=require('../client');exports[_0x9aec('0x0')]=function(){return function(){return client[_0x9aec('0x1')](_0x9aec('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9aec('0x3'),_0x9aec('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9aec('0x0')});};}; \ No newline at end of file +var _0xa870=['GetVoiceExtension','getVoiceExtensions'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xa870,0x101));var _0x0a87=function(_0x6033fe,_0x5338af){_0x6033fe=_0x6033fe-0x0;var _0x36b3db=_0xa870[_0x6033fe];return _0x36b3db;};'use strict';var client=require('../client');exports[_0x0a87('0x0')]=function(){return function(){return client['Request'](_0x0a87('0x1'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c5e5e75..4cff524 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 _0x640e=['type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw'];(function(_0x46f4f5,_0x5dc62f){var _0x39458d=function(_0x30fd49){while(--_0x30fd49){_0x46f4f5['push'](_0x46f4f5['shift']());}};_0x39458d(++_0x5dc62f);}(_0x640e,0x65));var _0xe640=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x640e[_0x199c03];return _0x11a7d4;};'use strict';var client=require(_0xe640('0x0'));exports[_0xe640('0x1')]=function(){return function(){return client['Request'](_0xe640('0x2'),{'options':{'raw':![],'attributes':['id',_0xe640('0x3'),_0xe640('0x4'),'acwTimeout','autopause','monitor_format',_0xe640('0x5'),'dialActive',_0xe640('0x6'),_0xe640('0x7'),_0xe640('0x8'),_0xe640('0x9'),_0xe640('0xa'),_0xe640('0xb'),_0xe640('0xc'),_0xe640('0xd'),_0xe640('0xe'),'dialOriginateTimeout',_0xe640('0xf'),_0xe640('0x10'),_0xe640('0x11'),_0xe640('0x12'),_0xe640('0x13'),_0xe640('0x14'),'dialBusyRetryFrequency',_0xe640('0x15'),_0xe640('0x16'),_0xe640('0x17'),_0xe640('0x18'),_0xe640('0x19'),'dialPrefix','dialCheckDuplicateType',_0xe640('0x1a'),'dialAMDInitialSilence',_0xe640('0x1b'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0xe640('0x1c'),_0xe640('0x1d'),_0xe640('0x1e'),_0xe640('0x1f'),_0xe640('0x20'),_0xe640('0x21'),_0xe640('0x22'),_0xe640('0x23'),_0xe640('0x24'),_0xe640('0x25'),_0xe640('0x26'),_0xe640('0x27'),_0xe640('0x28'),_0xe640('0x29'),_0xe640('0x2a'),_0xe640('0x2b'),'mandatoryDisposition',_0xe640('0x2c'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xe640('0x2d'),'as':_0xe640('0x2d'),'attributes':['id','name',_0xe640('0x2e'),_0xe640('0x2f')]},{'model':_0xe640('0x30'),'as':_0xe640('0x31'),'attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xe640('0x3'),'callerid','active']},{'model':'Interval','as':_0xe640('0x32'),'attributes':['id',_0xe640('0x3')],'include':[{'model':_0xe640('0x32'),'as':_0xe640('0x33'),'attributes':['id',_0xe640('0x3'),_0xe640('0x34')]}]}]},'log':_0xe640('0x1')});};}; \ No newline at end of file +var _0x9095=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x3f2ddf,_0x4c940c){var _0x2a0b77=function(_0x2ad483){while(--_0x2ad483){_0x3f2ddf['push'](_0x3f2ddf['shift']());}};_0x2a0b77(++_0x4c940c);}(_0x9095,0x10b));var _0x5909=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x9095[_0xf79bae];return _0x5d2cb7;};'use strict';var client=require(_0x5909('0x0'));exports[_0x5909('0x1')]=function(){return function(){return client['Request'](_0x5909('0x2'),{'options':{'raw':![],'attributes':['id',_0x5909('0x3'),'acw',_0x5909('0x4'),_0x5909('0x5'),_0x5909('0x6'),_0x5909('0x7'),'dialActive',_0x5909('0x8'),'dialLimitChannel','dialLimitQueue',_0x5909('0x9'),_0x5909('0xa'),_0x5909('0xb'),_0x5909('0xc'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x5909('0xd'),_0x5909('0xe'),_0x5909('0xf'),'dialQueueProject',_0x5909('0x10'),'dialCongestionRetryFrequency',_0x5909('0x11'),'dialBusyRetryFrequency',_0x5909('0x12'),'dialNoAnswerRetryFrequency',_0x5909('0x13'),'dialTimezone',_0x5909('0x14'),'dialPrefix',_0x5909('0x15'),_0x5909('0x16'),_0x5909('0x17'),_0x5909('0x18'),_0x5909('0x19'),_0x5909('0x1a'),_0x5909('0x1b'),_0x5909('0x1c'),_0x5909('0x1d'),'dialAMDSilenceThreshold',_0x5909('0x1e'),_0x5909('0x1f'),'dialRecallMeTimeout',_0x5909('0x20'),_0x5909('0x21'),_0x5909('0x22'),_0x5909('0x23'),_0x5909('0x24'),_0x5909('0x6'),_0x5909('0x25'),_0x5909('0x26'),_0x5909('0x27'),_0x5909('0x28'),_0x5909('0x29'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x5909('0x2a'),'as':_0x5909('0x2a'),'attributes':['id',_0x5909('0x3'),'callerid',_0x5909('0x2b')]},{'model':_0x5909('0x2c'),'as':'mandatoryDispositionPause','attributes':['id',_0x5909('0x3')]},{'model':_0x5909('0x2a'),'as':_0x5909('0x2d'),'attributes':['id',_0x5909('0x3'),'callerid','active']},{'model':_0x5909('0x2e'),'as':_0x5909('0x2e'),'attributes':['id',_0x5909('0x3')],'include':[{'model':_0x5909('0x2e'),'as':_0x5909('0x2f'),'attributes':['id',_0x5909('0x3'),_0x5909('0x30')]}]}]},'log':_0x5909('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7dde18e..5357e9f 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 _0xbf2e=['queuecallerabandon','queuecallerabandonAt','lodash','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt'];(function(_0x4744c5,_0x3c81d0){var _0x1db178=function(_0xd5b876){while(--_0xd5b876){_0x4744c5['push'](_0x4744c5['shift']());}};_0x1db178(++_0x3c81d0);}(_0xbf2e,0xc0));var _0xebf2=function(_0x3adb9e,_0x4d82e7){_0x3adb9e=_0x3adb9e-0x0;var _0xf32369=_0xbf2e[_0x3adb9e];return _0xf32369;};'use strict';var moment=require('moment');var _=require(_0xebf2('0x0'));var client=require(_0xebf2('0x1'));exports[_0xebf2('0x2')]=function(_0x2e6a34){return client[_0xebf2('0x3')](_0xebf2('0x4'),{'body':_0x2e6a34,'log':_0xebf2('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xebf2('0x3')](_0xebf2('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xebf2('0x6')](_0xebf2('0x7'))[_0xebf2('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xebf2('0x7'))[_0xebf2('0x8')](_0xebf2('0x9'))]}},'attributes':[_0xebf2('0xa'),_0xebf2('0xb'),_0xebf2('0xc'),_0xebf2('0xd'),_0xebf2('0xe'),'queuecallercompleteAt',_0xebf2('0xf'),_0xebf2('0x10'),_0xebf2('0x11'),_0xebf2('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xb8bd=['lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','GetVoiceQueueReports','moment'];(function(_0x4a920e,_0x41a654){var _0x5f3322=function(_0x40c9ec){while(--_0x40c9ec){_0x4a920e['push'](_0x4a920e['shift']());}};_0x5f3322(++_0x41a654);}(_0xb8bd,0xb3));var _0xdb8b=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xb8bd[_0x2261ce];return _0x524640;};'use strict';var moment=require(_0xdb8b('0x0'));var _=require(_0xdb8b('0x1'));var client=require(_0xdb8b('0x2'));exports[_0xdb8b('0x3')]=function(_0x4e98f1){return client[_0xdb8b('0x4')](_0xdb8b('0x5'),{'body':_0x4e98f1,'log':'CreateVoiceQueueReport'});};exports[_0xdb8b('0x6')]=function(){return function(){return client[_0xdb8b('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xdb8b('0x7')](_0xdb8b('0x8'))['format'](_0xdb8b('0x9')),moment()[_0xdb8b('0xa')](_0xdb8b('0x8'))[_0xdb8b('0xb')](_0xdb8b('0x9'))]}},'attributes':['uniqueid','queue','queuecallerjoinAt',_0xdb8b('0xc'),_0xdb8b('0xd'),_0xdb8b('0xe'),_0xdb8b('0xf'),'queuecallerexitAt',_0xdb8b('0x10'),'queuecallerabandonAt']},'log':_0xdb8b('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 0d4e552..d983b75 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 _0xef3b=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x533c43,_0x20428e){var _0x1944df=function(_0x1e1ce8){while(--_0x1e1ce8){_0x533c43['push'](_0x533c43['shift']());}};_0x1944df(++_0x20428e);}(_0xef3b,0x1e7));var _0xbef3=function(_0x13ab94,_0x3b2dfd){_0x13ab94=_0x13ab94-0x0;var _0x1a1d7c=_0xef3b[_0x13ab94];return _0x1a1d7c;};'use strict';var client=require(_0xbef3('0x0'));exports[_0xbef3('0x1')]=function(_0x5f2bb4){return function(){return client[_0xbef3('0x2')](_0xbef3('0x3'),{'options':{'where':{'VoiceQueueId':_0x5f2bb4,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xe89c=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x44297c,_0x199f90){var _0x2a9fff=function(_0x199c2a){while(--_0x199c2a){_0x44297c['push'](_0x44297c['shift']());}};_0x2a9fff(++_0x199f90);}(_0xe89c,0x93));var _0xce89=function(_0x1c599d,_0x34ac8c){_0x1c599d=_0x1c599d-0x0;var _0x2ae32e=_0xe89c[_0x1c599d];return _0x2ae32e;};'use strict';var client=require(_0xce89('0x0'));exports[_0xce89('0x1')]=function(_0x336f14){return function(){return client[_0xce89('0x2')](_0xce89('0x3'),{'options':{'where':{'VoiceQueueId':_0x336f14,'paused':!![]},'raw':!![]},'log':_0xce89('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e61c476..0d62fd4 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 _0xbf8f=['create','Request','CreateVoiceRecording','monitorFilename','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbf8f,0x1df));var _0xfbf8=function(_0x492e9e,_0x2487bb){_0x492e9e=_0x492e9e-0x0;var _0xac47=_0xbf8f[_0x492e9e];return _0xac47;};'use strict';var _=require(_0xfbf8('0x0'));var client=require('../client');exports[_0xfbf8('0x1')]=function(_0x5e8dd5){return client[_0xfbf8('0x2')](_0xfbf8('0x3'),{'body':_['merge'](_0x5e8dd5,{'value':_0x5e8dd5[_0xfbf8('0x4')]}),'log':_0xfbf8('0x3')});}; \ No newline at end of file +var _0xf7a6=['merge','CreateVoiceRecording','lodash','../client','create','Request'];(function(_0x419eea,_0x323938){var _0x6b5bd2=function(_0x2617dd){while(--_0x2617dd){_0x419eea['push'](_0x419eea['shift']());}};_0x6b5bd2(++_0x323938);}(_0xf7a6,0x152));var _0x6f7a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf7a6[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6f7a('0x0'));var client=require(_0x6f7a('0x1'));exports[_0x6f7a('0x2')]=function(_0x423341){return client[_0x6f7a('0x3')]('CreateVoiceRecording',{'body':_[_0x6f7a('0x4')](_0x423341,{'value':_0x423341['monitorFilename']}),'log':_0x6f7a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c4303c4..607c669 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 _0xd9d5=['origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','isexternal','context','extension','blind','attendedTransfer'];(function(_0x2c0974,_0x498841){var _0x4caa01=function(_0x2620ea){while(--_0x2620ea){_0x2c0974['push'](_0x2c0974['shift']());}};_0x4caa01(++_0x498841);}(_0xd9d5,0x11b));var _0x5d9d=function(_0x1c42de,_0x4345ab){_0x1c42de=_0x1c42de-0x0;var _0x149ec6=_0xd9d5[_0x1c42de];return _0x149ec6;};'use strict';var client=require('../client');exports['blindTransfer']=function(_0x180739){return client[_0x5d9d('0x0')](_0x5d9d('0x1'),{'body':{'result':_0x180739[_0x5d9d('0x2')],'transfererchannel':_0x180739[_0x5d9d('0x3')],'transferercalleridnum':_0x180739[_0x5d9d('0x4')],'transferercalleridname':_0x180739[_0x5d9d('0x5')],'transfererconnectedlinenum':_0x180739['transfererconnectedlinenum'],'transfererconnectedlinename':_0x180739[_0x5d9d('0x6')],'transfereraccountcode':_0x180739[_0x5d9d('0x7')],'transferercontext':_0x180739['transferercontext'],'transfererexten':_0x180739[_0x5d9d('0x8')],'transfererlinkedid':_0x180739[_0x5d9d('0x9')],'transfereechannel':_0x180739[_0x5d9d('0xa')],'transfereecalleridnum':_0x180739[_0x5d9d('0xb')],'transfereecalleridname':_0x180739[_0x5d9d('0xc')],'transfereeconnectedlinenum':_0x180739[_0x5d9d('0xd')],'transfereeconnectedlinename':_0x180739[_0x5d9d('0xe')],'transfereeaccountcode':_0x180739['transfereeaccountcode'],'transfereecontext':_0x180739[_0x5d9d('0xf')],'transfereeexten':_0x180739['transfereeexten'],'transfereelinkedid':_0x180739['transfereelinkedid'],'isexternal':_0x180739[_0x5d9d('0x10')],'context':_0x180739[_0x5d9d('0x11')],'extension':_0x180739[_0x5d9d('0x12')],'type':_0x5d9d('0x13')},'log':_0x5d9d('0x1')});};exports[_0x5d9d('0x14')]=function(_0xc4649f){return client[_0x5d9d('0x0')](_0x5d9d('0x1'),{'body':{'result':_0xc4649f['result'],'transfererchannel':_0xc4649f[_0x5d9d('0x15')],'transferercalleridnum':_0xc4649f['origtransferercalleridnum'],'transferercalleridname':_0xc4649f[_0x5d9d('0x16')],'transfererconnectedlinenum':_0xc4649f[_0x5d9d('0x17')],'transfererconnectedlinename':_0xc4649f[_0x5d9d('0x18')],'transfereraccountcode':_0xc4649f[_0x5d9d('0x19')],'transferercontext':_0xc4649f['secondtransferercontext'],'transfererexten':_0xc4649f[_0x5d9d('0x1a')],'transfererlinkedid':_0xc4649f[_0x5d9d('0x1b')],'transfereechannel':_0xc4649f[_0x5d9d('0x1c')],'transfereecalleridnum':_0xc4649f[_0x5d9d('0x1d')],'transfereecalleridname':_0xc4649f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xc4649f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xc4649f[_0x5d9d('0x1e')],'transfereeaccountcode':_0xc4649f[_0x5d9d('0x1f')],'transfereecontext':_0xc4649f[_0x5d9d('0x20')],'transfereeexten':_0xc4649f[_0x5d9d('0x21')],'transfereelinkedid':_0xc4649f[_0x5d9d('0x22')],'isexternal':_0xc4649f[_0x5d9d('0x10')],'context':_0xc4649f[_0x5d9d('0x23')],'extension':_0xc4649f[_0x5d9d('0x24')],'type':_0x5d9d('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x9197=['transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x9197,0x1e4));var _0x7919=function(_0x24f330,_0x379f98){_0x24f330=_0x24f330-0x0;var _0x2e2367=_0x9197[_0x24f330];return _0x2e2367;};'use strict';var client=require(_0x7919('0x0'));exports[_0x7919('0x1')]=function(_0x121673){return client['Request'](_0x7919('0x2'),{'body':{'result':_0x121673[_0x7919('0x3')],'transfererchannel':_0x121673['transfererchannel'],'transferercalleridnum':_0x121673[_0x7919('0x4')],'transferercalleridname':_0x121673['transferercalleridname'],'transfererconnectedlinenum':_0x121673[_0x7919('0x5')],'transfererconnectedlinename':_0x121673[_0x7919('0x6')],'transfereraccountcode':_0x121673[_0x7919('0x7')],'transferercontext':_0x121673[_0x7919('0x8')],'transfererexten':_0x121673[_0x7919('0x9')],'transfererlinkedid':_0x121673['transfererlinkedid'],'transfereechannel':_0x121673[_0x7919('0xa')],'transfereecalleridnum':_0x121673[_0x7919('0xb')],'transfereecalleridname':_0x121673['transfereecalleridname'],'transfereeconnectedlinenum':_0x121673['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x121673[_0x7919('0xc')],'transfereeaccountcode':_0x121673['transfereeaccountcode'],'transfereecontext':_0x121673['transfereecontext'],'transfereeexten':_0x121673[_0x7919('0xd')],'transfereelinkedid':_0x121673[_0x7919('0xe')],'isexternal':_0x121673[_0x7919('0xf')],'context':_0x121673[_0x7919('0x10')],'extension':_0x121673[_0x7919('0x11')],'type':'blind'},'log':_0x7919('0x2')});};exports['attendedTransfer']=function(_0xefad17){return client[_0x7919('0x12')](_0x7919('0x2'),{'body':{'result':_0xefad17[_0x7919('0x3')],'transfererchannel':_0xefad17[_0x7919('0x13')],'transferercalleridnum':_0xefad17['origtransferercalleridnum'],'transferercalleridname':_0xefad17[_0x7919('0x14')],'transfererconnectedlinenum':_0xefad17[_0x7919('0x15')],'transfererconnectedlinename':_0xefad17[_0x7919('0x16')],'transfereraccountcode':_0xefad17[_0x7919('0x17')],'transferercontext':_0xefad17[_0x7919('0x18')],'transfererexten':_0xefad17[_0x7919('0x19')],'transfererlinkedid':_0xefad17[_0x7919('0x1a')],'transfereechannel':_0xefad17['transfertargetchannel'],'transfereecalleridnum':_0xefad17[_0x7919('0x1b')],'transfereecalleridname':_0xefad17[_0x7919('0x1c')],'transfereeconnectedlinenum':_0xefad17['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xefad17['transfertargetconnectedlinename'],'transfereeaccountcode':_0xefad17[_0x7919('0x1d')],'transfereecontext':_0xefad17['transfertargetcontext'],'transfereeexten':_0xefad17[_0x7919('0x1e')],'transfereelinkedid':_0xefad17[_0x7919('0x1f')],'isexternal':_0xefad17[_0x7919('0xf')],'context':_0xefad17[_0x7919('0x20')],'extension':_0xefad17[_0x7919('0x21')],'type':_0x7919('0x22')},'log':_0x7919('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0d400ca..bb230a9 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 _0xa7c7=['asterisk','username','ami\x20disconnected','join','pick','Reload','command','action','Action','then','content','catch','message','voiceQueues','hasOwnProperty','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','voicechannel','map','find','channels','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','push','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','format','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','voicequeuechannelredirect','Redirect','context','trunks','outboundChannels','outbound','campaigns','run','event','emit','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','%s/%s','SIP','timers','updateAcw','agents','QueuePause','isConnected','error'];(function(_0xb58923,_0x35baf7){var _0x5b72f9=function(_0x14ebca){while(--_0x14ebca){_0xb58923['push'](_0xb58923['shift']());}};_0x5b72f9(++_0x35baf7);}(_0xa7c7,0x75));var _0x7a7c=function(_0x384351,_0x26e927){_0x384351=_0x384351-0x0;var _0x49d069=_0xa7c7[_0x384351];return _0x49d069;};'use strict';var _=require(_0x7a7c('0x0'));var util=require(_0x7a7c('0x1'));var jayson=require(_0x7a7c('0x2'));var schema=require(_0x7a7c('0x3'));var BPromise=require(_0x7a7c('0x4'));var moment=require(_0x7a7c('0x5'));var config=require('../../../config/environment');var properties=require(_0x7a7c('0x6'));var ami=require(_0x7a7c('0x7'));exports[_0x7a7c('0x8')]=function(_0x5f0798,_0x4b79fb,_0x45957){return new BPromise(function(_0x73ebcb,_0x1652cc){var _0x5ca4b9={'QueuePause':function(_0x23c491){return new Promise(function(_0x4c56d4,_0x317bfe){var _0x3354c8=util['format'](_0x7a7c('0x9'),_0x7a7c('0xa'),_0x23c491['name']);if(_0x5f0798[_0x7a7c('0xb')]&&_0x5f0798[_0x7a7c('0xb')][_0x3354c8]&&_0x5f0798[_0x7a7c('0xb')][_0x3354c8]['timer']){_0x5f0798['timers'][_0x3354c8][_0x7a7c('0xc')]();}if(_0x5f0798[_0x7a7c('0xd')][_0x3354c8]){_0x5f0798[_0x7a7c('0xd')][_0x3354c8]['updateStatusRealtime']({'statePause':_0x23c491['pause']?!![]:![]});}_0x4c56d4({'code':0xc8,'message':_0x7a7c('0xe')});});},'Reload':function(_0x3a179f){var _0x4ab710=this;return new Promise(function(_0xe3e0e3,_0x31a69a){if(ami[_0x7a7c('0xf')]()==![]){return _0x31a69a(_0x4ab710[_0x7a7c('0x10')](0x1f4,[config[_0x7a7c('0x11')]['ip'],config['asterisk'][_0x7a7c('0x12')],_0x7a7c('0x13')][_0x7a7c('0x14')]('\x20')));}_0x3a179f=_[_0x7a7c('0x15')](_0x3a179f,_['keys'](properties['module']));_0x3a179f['action']=_0x7a7c('0x16');return ami['Action'](_0x3a179f)['then'](function(_0x42ed15){_0xe3e0e3({'code':0xc8,'message':_0x42ed15['message']});})['catch'](function(_0x1ad993){_0x31a69a(_0x4ab710[_0x7a7c('0x10')](0x1f5,_0x1ad993['message']));});});},'Command':function(_0xd6d73c){var _0x575a10=this;return new Promise(function(_0x58faeb,_0x2ab24){if(ami['isConnected']()==![]){return _0x2ab24(_0x575a10[_0x7a7c('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x7a7c('0x11')][_0x7a7c('0x12')],_0x7a7c('0x13')][_0x7a7c('0x14')]('\x20')));}_0xd6d73c=_['pick'](_0xd6d73c,_0x7a7c('0x17'));_0xd6d73c[_0x7a7c('0x18')]='Command';return ami[_0x7a7c('0x19')](_0xd6d73c)[_0x7a7c('0x1a')](function(_0x16633b){_0x58faeb({'code':0xc8,'message':_0x16633b[_0x7a7c('0x1b')]});})[_0x7a7c('0x1c')](function(_0x108e06){_0x2ab24(_0x575a10[_0x7a7c('0x10')](0x1f5,_0x108e06[_0x7a7c('0x1d')]));});});},'VoiceQueues':function(_0x55c08a){return new Promise(function(_0x1f6dce,_0x1689a0){var _0x43f3f9=[];for(var _0x412041 in _0x5f0798['voiceQueues']){if(_0x5f0798[_0x7a7c('0x1e')][_0x7a7c('0x1f')](_0x412041)){var _0x461054=_0x5f0798['voiceQueues'][_0x412041];var _0x193c55={'id':_0x461054['id'],'name':_0x461054[_0x7a7c('0x20')],'strategy':_0x461054[_0x7a7c('0x21')],'answered':_0x461054[_0x7a7c('0x22')],'available':_0x461054[_0x7a7c('0x23')],'loggedIn':_0x461054['loggedIn'],'pTalking':_0x461054[_0x7a7c('0x24')],'sumBillable':_0x461054[_0x7a7c('0x25')],'sumDuration':_0x461054[_0x7a7c('0x26')],'sumHoldTime':_0x461054[_0x7a7c('0x27')]||0x0,'talking':_0x461054[_0x7a7c('0x28')],'total':_0x461054['total'],'type':_0x461054[_0x7a7c('0x29')],'unmanaged':_0x461054[_0x7a7c('0x2a')],'abandoned':_0x461054[_0x7a7c('0x2b')],'waiting':_0x461054[_0x7a7c('0x2c')],'loggedInDb':_0x461054[_0x7a7c('0x2d')]};if(_0x461054[_0x7a7c('0x29')]==='outbound'){_0x193c55['dialActive']=_0x461054[_0x7a7c('0x2e')];_0x193c55[_0x7a7c('0x2f')]=_0x461054[_0x7a7c('0x2f')];_0x193c55[_0x7a7c('0x30')]=_0x461054[_0x7a7c('0x30')];_0x193c55[_0x7a7c('0x31')]=_0x461054['dialOriginateCallerIdNumber'];_0x193c55[_0x7a7c('0x32')]=_0x461054[_0x7a7c('0x32')];_0x193c55[_0x7a7c('0x33')]=_0x461054[_0x7a7c('0x33')];_0x193c55['outboundAnswerAgiCallsDay']=_0x461054['outboundAnswerAgiCallsDay'];_0x193c55[_0x7a7c('0x34')]=_0x461054[_0x7a7c('0x34')];_0x193c55['outboundBlacklistCallsDay']=_0x461054[_0x7a7c('0x35')];_0x193c55[_0x7a7c('0x36')]=_0x461054[_0x7a7c('0x36')];_0x193c55['outboundCongestionCallsDay']=_0x461054[_0x7a7c('0x37')];_0x193c55[_0x7a7c('0x38')]=_0x461054['outboundDropCallsDayACS'];_0x193c55[_0x7a7c('0x39')]=_0x461054['outboundDropCallsDayCallersExit'];_0x193c55[_0x7a7c('0x3a')]=_0x461054[_0x7a7c('0x3a')];_0x193c55[_0x7a7c('0x3b')]=_0x461054[_0x7a7c('0x3b')];_0x193c55['outboundNoSuchCallsDay']=_0x461054['outboundNoSuchCallsDay'];_0x193c55['outboundOriginateFailureCallsDay']=_0x461054['outboundOriginateFailureCallsDay'];_0x193c55[_0x7a7c('0x3c')]=_0x461054[_0x7a7c('0x3c')];_0x193c55[_0x7a7c('0x3d')]=_0x461054[_0x7a7c('0x3d')];_0x193c55[_0x7a7c('0x3e')]=_0x461054['outboundUnknownCallsDay'];_0x193c55[_0x7a7c('0x3f')]=_0x461054[_0x7a7c('0x3f')];_0x193c55['predictiveIntervalAvgHoldtime']=_0x461054[_0x7a7c('0x40')];_0x193c55[_0x7a7c('0x41')]=_0x461054['predictiveIntervalAvgTalktime'];_0x193c55[_0x7a7c('0x42')]=_0x461054[_0x7a7c('0x42')];_0x193c55[_0x7a7c('0x43')]=_0x461054[_0x7a7c('0x43')];_0x193c55[_0x7a7c('0x44')]=_0x461054['predictiveIntervalErlangCalls'];_0x193c55['predictiveIntervalErlangCallsDroppedCalls']=_0x461054[_0x7a7c('0x45')];_0x193c55[_0x7a7c('0x46')]=_0x461054[_0x7a7c('0x46')];_0x193c55[_0x7a7c('0x47')]=_0x461054[_0x7a7c('0x47')];_0x193c55[_0x7a7c('0x48')]=_0x461054['predictiveIntervalPauses'];_0x193c55[_0x7a7c('0x49')]=_0x461054['predictiveIntervalAvailable'];_0x193c55[_0x7a7c('0x4a')]=_0x461054['predictiveIntervalTotalCalls'];_0x193c55[_0x7a7c('0x1d')]=_0x461054['message'];_0x193c55[_0x7a7c('0x4b')]=_0x461054[_0x7a7c('0x4b')];_0x193c55[_0x7a7c('0x4c')]=_0x461054[_0x7a7c('0x4c')];_0x193c55['erlangCallToSecond']=_0x461054['erlangCallToSecond'];_0x193c55[_0x7a7c('0x4d')]=_0x461054[_0x7a7c('0x4d')];_0x193c55[_0x7a7c('0x4e')]=_0x461054['erlangBusyFactor'];_0x193c55[_0x7a7c('0x4f')]=_0x461054[_0x7a7c('0x4f')];_0x193c55[_0x7a7c('0x50')]=_0x461054[_0x7a7c('0x50')];}if(_0x461054[_0x7a7c('0x51')]){_0x193c55['Trunk']={'id':_0x461054[_0x7a7c('0x51')]['id'],'name':_0x461054[_0x7a7c('0x51')][_0x7a7c('0x20')],'active':_0x461054[_0x7a7c('0x51')][_0x7a7c('0x52')],'callerid':_0x461054[_0x7a7c('0x51')][_0x7a7c('0x53')]};}if(_0x461054['Interval']){_0x193c55[_0x7a7c('0x54')]={'id':_0x461054[_0x7a7c('0x54')]['id'],'name':_0x461054[_0x7a7c('0x54')]['name']};}_0x43f3f9['push'](_0x193c55);}}_0x1f6dce({'count':_0x43f3f9[_0x7a7c('0x55')],'rows':_0x43f3f9});});},'VoiceChannels':function(_0x1da163){return new Promise(function(_0x244053,_0x59b069){var _0x543e66=_[_0x7a7c('0x56')](_0x5f0798['channels']);_0x244053({'count':_0x543e66[_0x7a7c('0x55')],'rows':_0x543e66});});},'VoiceChannelMixMonitor':function(_0x5831b8){var _0x3d1b8d=this;return new Promise(function(_0x5d7eb8,_0x16fef8){if(ami[_0x7a7c('0xf')]()==![]){return _0x16fef8(_0x3d1b8d['error'](0x1f4,[config[_0x7a7c('0x11')]['ip'],config[_0x7a7c('0x11')][_0x7a7c('0x12')],'ami\x20disconnected'][_0x7a7c('0x14')]('\x20')));}var _0x379e2e=schema(properties[_0x7a7c('0x57')])[_0x7a7c('0x3')](_0x5831b8);if(_0x379e2e[_0x7a7c('0x55')]>0x0){return _0x16fef8(_0x3d1b8d[_0x7a7c('0x10')](0x1f4,_[_0x7a7c('0x58')](_0x379e2e,_0x7a7c('0x1d'))[_0x7a7c('0x14')](',\x20')));}var _0x30f6ed=_[_0x7a7c('0x59')](_0x5f0798[_0x7a7c('0x5a')],{'uniqueid':_0x5831b8[_0x7a7c('0x5b')]});if(_0x30f6ed&&_0x30f6ed[_0x7a7c('0x5c')]){var _0x1c3193=util['format']('%s.%s',_0x5831b8['filename']||_0x5831b8[_0x7a7c('0x5b')],_0x5831b8['format']||_0x7a7c('0x5d'));return ami[_0x7a7c('0x19')]({'action':_0x7a7c('0x5e'),'channel':_0x30f6ed[_0x7a7c('0x5c')],'file':_0x1c3193,'options':_0x7a7c('0x5f')})['then'](function(_0x529a50){var _0x2f8eea=_['find'](_0x30f6ed[_0x7a7c('0x60')],{'filename':_0x7a7c('0x61')+_0x1c3193['toLowerCase']()});if(_[_0x7a7c('0x62')](_0x2f8eea)){_0x30f6ed[_0x7a7c('0x60')][_0x7a7c('0x63')]({'filename':_0x7a7c('0x61')+_0x1c3193[_0x7a7c('0x64')](),'createdAt':moment()['format'](_0x7a7c('0x65')),'mixmonitorid':_0x529a50[_0x7a7c('0x66')],'status':_0x7a7c('0x67')});}else{_0x2f8eea[_0x7a7c('0x66')]=_0x529a50[_0x7a7c('0x66')];_0x2f8eea[_0x7a7c('0x68')]=_0x7a7c('0x67');}_0x5d7eb8({'code':0xc8,'message':[_0x5831b8[_0x7a7c('0x5b')],_0x7a7c('0x69'),_0x529a50[_0x7a7c('0x66')]][_0x7a7c('0x14')]('\x20'),'mixmonitorid':_0x529a50[_0x7a7c('0x66')]});})[_0x7a7c('0x1c')](function(_0x477bea){_0x16fef8(_0x3d1b8d[_0x7a7c('0x10')](0x1f5,[_0x5831b8['uniqueid'],_0x477bea['message'][_0x7a7c('0x64')]()]['join']('\x20')));});}else{return _0x16fef8(_0x3d1b8d[_0x7a7c('0x10')](0x1f5,_0x7a7c('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x595d0b){var _0x6103b7=this;return new Promise(function(_0x547b14,_0x366c9a){if(ami[_0x7a7c('0xf')]()==![]){return _0x366c9a(_0x6103b7['error'](0x1f4,[config[_0x7a7c('0x11')]['ip'],config[_0x7a7c('0x11')][_0x7a7c('0x12')],_0x7a7c('0x13')][_0x7a7c('0x14')]('\x20')));}var _0x2b655b=schema(properties[_0x7a7c('0x57')])[_0x7a7c('0x3')](_0x595d0b);if(_0x2b655b[_0x7a7c('0x55')]>0x0){return _0x366c9a(_0x6103b7['error'](0x1f4,_['map'](_0x2b655b,'message')[_0x7a7c('0x14')](',\x20')));}var _0x36293e=_[_0x7a7c('0x59')](_0x5f0798[_0x7a7c('0x5a')],{'uniqueid':_0x595d0b['uniqueid']});if(_0x36293e){return BPromise[_0x7a7c('0x6b')]()[_0x7a7c('0x1a')](function(){if(_0x36293e[_0x7a7c('0x5c')]){return ami['Action']({'action':_0x7a7c('0x6c'),'channel':_0x36293e[_0x7a7c('0x5c')],'mixmonitorid':_0x595d0b['mixmonitorid']})[_0x7a7c('0x1c')](function(_0x3128c0){});}})[_0x7a7c('0x1a')](function(){if(_0x36293e[_0x7a7c('0x6d')]){return ami[_0x7a7c('0x19')]({'action':_0x7a7c('0x6c'),'channel':_0x36293e[_0x7a7c('0x6d')],'mixmonitorid':_0x595d0b[_0x7a7c('0x66')]})[_0x7a7c('0x1c')](function(_0x56a985){});}})[_0x7a7c('0x1a')](function(_0x392990){var _0x220989=_['find'](_0x36293e[_0x7a7c('0x60')],{'mixmonitorid':_0x595d0b[_0x7a7c('0x66')]});if(_0x220989){_0x220989['status']=_0x7a7c('0x6e');}})['then'](function(){var _0x58c163=util['format']('%s.%s',_0x595d0b[_0x7a7c('0x6f')]||_0x595d0b[_0x7a7c('0x5b')],_0x595d0b[_0x7a7c('0x70')]||_0x7a7c('0x5d'));var _0xb1abc3=_[_0x7a7c('0x59')](_0x36293e[_0x7a7c('0x60')],{'filename':_0x7a7c('0x61')+_0x58c163[_0x7a7c('0x64')]()});if(_0xb1abc3){_0xb1abc3[_0x7a7c('0x68')]='stop';}})[_0x7a7c('0x1a')](function(){_0x547b14({'code':0xc8,'message':[_0x595d0b[_0x7a7c('0x5b')],_0x7a7c('0x71')][_0x7a7c('0x14')]('\x20')});})[_0x7a7c('0x1c')](function(_0x3eda6f){_0x366c9a(_0x6103b7[_0x7a7c('0x10')](0x1f5,[_0x595d0b[_0x7a7c('0x5b')],_0x3eda6f[_0x7a7c('0x1d')][_0x7a7c('0x64')]()][_0x7a7c('0x14')]('\x20')));});}else{return _0x366c9a(_0x6103b7[_0x7a7c('0x10')](0x1f5,_0x7a7c('0x6a')));}});},'VoiceQueuesChannels':function(_0x364799){return new Promise(function(_0x12aedc,_0x5babdc){var _0x2c89e2=_[_0x7a7c('0x56')](_0x5f0798['queueChannels']);_0x12aedc({'count':_0x2c89e2[_0x7a7c('0x55')],'rows':_0x2c89e2});});},'VoiceQueuesChannel':function(_0x38e93e){var _0x3f2274=this;return new Promise(function(_0x3ca5c5,_0x441729){var _0x19bb1c=schema(properties[_0x7a7c('0x72')])[_0x7a7c('0x3')](_0x38e93e);if(_0x19bb1c[_0x7a7c('0x55')]>0x0){return _0x441729(_0x3f2274[_0x7a7c('0x10')](0x1f4,_[_0x7a7c('0x58')](_0x19bb1c,_0x7a7c('0x1d'))[_0x7a7c('0x14')](',\x20')));}var _0x27d75c=_[_0x7a7c('0x59')](_0x5f0798['queueChannels'],{'uniqueid':_0x38e93e[_0x7a7c('0x5b')]});if(_0x27d75c){_0x3ca5c5(_0x27d75c);}else{return _0x441729(_0x3f2274[_0x7a7c('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x1a4836){var _0x433112=this;return new Promise(function(_0x4cd884,_0x52c55a){if(ami[_0x7a7c('0xf')]()==![]){return _0x52c55a(_0x433112[_0x7a7c('0x10')](0x1f4,[config[_0x7a7c('0x11')]['ip'],config[_0x7a7c('0x11')][_0x7a7c('0x12')],_0x7a7c('0x13')][_0x7a7c('0x14')]('\x20')));}var _0x459a8c=schema(properties[_0x7a7c('0x73')])[_0x7a7c('0x3')](_0x1a4836);if(_0x459a8c[_0x7a7c('0x55')]>0x0){return _0x52c55a(_0x433112[_0x7a7c('0x10')](0x1f4,_[_0x7a7c('0x58')](_0x459a8c,'message')[_0x7a7c('0x14')](',\x20')));}var _0x39786b=_[_0x7a7c('0x59')](_0x5f0798[_0x7a7c('0x74')],{'uniqueid':_0x1a4836[_0x7a7c('0x5b')]});if(_0x39786b&&_0x39786b['channel']){return ami[_0x7a7c('0x19')]({'action':'Hangup','channel':_0x39786b['channel']})[_0x7a7c('0x1a')](function(_0x3d87e6){_0x4cd884({'code':0xc8,'message':[_0x1a4836['uniqueid'],_0x3d87e6[_0x7a7c('0x1d')][_0x7a7c('0x64')]()][_0x7a7c('0x14')]('\x20')});})['catch'](function(_0x3f6d5f){_0x52c55a(_0x433112[_0x7a7c('0x10')](0x1f5,[_0x1a4836[_0x7a7c('0x5b')],_0x3f6d5f[_0x7a7c('0x1d')][_0x7a7c('0x64')]()][_0x7a7c('0x14')]('\x20')));});}else{return _0x52c55a(_0x433112[_0x7a7c('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5d6a97){var _0x22fb47=this;return new Promise(function(_0x1e17f3,_0x175e7b){if(ami['isConnected']()==![]){return _0x175e7b(_0x22fb47[_0x7a7c('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x7a7c('0x11')][_0x7a7c('0x12')],_0x7a7c('0x13')][_0x7a7c('0x14')]('\x20')));}var _0x508a0b=schema(properties[_0x7a7c('0x75')])[_0x7a7c('0x3')](_0x5d6a97);if(_0x508a0b[_0x7a7c('0x55')]>0x0){return _0x175e7b(_0x22fb47['error'](0x1f4,_['map'](_0x508a0b,_0x7a7c('0x1d'))['join'](',\x20')));}var _0x2d08ab=_[_0x7a7c('0x59')](_0x5f0798['queueChannels'],{'uniqueid':_0x5d6a97[_0x7a7c('0x5b')]});if(_0x2d08ab&&_0x2d08ab[_0x7a7c('0x5c')]){return ami[_0x7a7c('0x19')]({'action':_0x7a7c('0x76'),'channel':_0x2d08ab[_0x7a7c('0x5c')],'exten':_0x5d6a97['exten'],'context':_0x5d6a97[_0x7a7c('0x77')]||_0x2d08ab[_0x7a7c('0x77')],'priority':0x1})[_0x7a7c('0x1a')](function(_0x181f67){_0x1e17f3({'code':0xc8,'message':[_0x5d6a97['uniqueid'],_0x181f67[_0x7a7c('0x1d')][_0x7a7c('0x64')]()][_0x7a7c('0x14')]('\x20')});})[_0x7a7c('0x1c')](function(_0x441e58){_0x175e7b(_0x22fb47[_0x7a7c('0x10')](0x1f5,[_0x5d6a97[_0x7a7c('0x5b')],_0x441e58[_0x7a7c('0x1d')][_0x7a7c('0x64')]()][_0x7a7c('0x14')]('\x20')));});}else{return _0x175e7b(_0x22fb47[_0x7a7c('0x10')](0x1f5,_0x7a7c('0x6a')));}});},'Agents':function(_0x566398){return new Promise(function(_0x36aab6,_0xf635a1){var _0x4fbb2c=_[_0x7a7c('0x56')](_0x5f0798[_0x7a7c('0xd')]);_0x36aab6({'count':_0x4fbb2c['length'],'rows':_0x4fbb2c});});},'Telephones':function(_0x394b01){return new Promise(function(_0x63e830,_0x1f1cb9){var _0x20eb1d=_['values'](_0x5f0798['telephones']);_0x63e830({'count':_0x20eb1d[_0x7a7c('0x55')],'rows':_0x20eb1d});});},'Trunks':function(_0x310232){return new Promise(function(_0xe799c1,_0xe9499c){var _0x270a61=_['values'](_0x5f0798[_0x7a7c('0x78')]);_0xe799c1({'count':_0x270a61['length'],'rows':_0x270a61});});},'OutboundChannels':function(_0x2a96ac){return new Promise(function(_0x49143c,_0x17211f){var _0x2fa69d=_['values'](_0x5f0798[_0x7a7c('0x79')]);_0x49143c({'count':_0x2fa69d[_0x7a7c('0x55')],'rows':_0x2fa69d});});},'Outbound':function(_0x4b6176){return new Promise(function(_0x2f7c41,_0x1cd4cb){_0x2f7c41(_0x5f0798[_0x7a7c('0x7a')]);});},'Campaigns':function(_0x3ccf98){return new Promise(function(_0x42d21f,_0x44f2f8){var _0x53a4cd=_[_0x7a7c('0x56')](_0x5f0798[_0x7a7c('0x7b')]);_0x42d21f({'count':_0x53a4cd[_0x7a7c('0x55')],'rows':_0x53a4cd});});},'VoiceQueuesPreview':function(_0x268144){var _0x4fd6a1=this;return new Promise(function(_0x7718e1,_0x4caecd){_0x4b79fb[_0x7a7c('0x7c')](_0x268144['id'])['then'](function(_0x32caf1){_0x7718e1({'code':0xc8,'message':_0x32caf1[_0x7a7c('0x1d')]});})[_0x7a7c('0x1c')](function(_0x4fb89d){_0x4caecd(_0x4fd6a1[_0x7a7c('0x10')](0x1f4,_0x4fb89d[_0x7a7c('0x1d')]));});});},'EventManager':function(_0x2b6ead){var _0x15927d=this;return new Promise(function(_0x2d65a3,_0x15311c){if(!_0x2b6ead[_0x7a7c('0x7d')]){return _0x15311c(_0x15927d['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x7a7c('0x7e')]('custom:'+_0x2b6ead['event'],_0x2b6ead['message']);_0x2d65a3({'code':0xc8,'message':_0x2b6ead});});},'FaxAccounts':function(_0x3a27c1){return new Promise(function(_0x4a0ccf,_0x4cdc81){var _0x5d696a=_['values'](_0x5f0798[_0x7a7c('0x7f')]);_0x4a0ccf({'count':_0x5d696a['length'],'rows':_0x5d696a});});},'SendFax':function(_0x5902a9){var _0x5edf78=this;return new Promise(function(_0x1b474b,_0x5a556e){_0x45957[_0x7a7c('0x80')](_0x5902a9)[_0x7a7c('0x1a')](function(_0xef43e7){_0x1b474b({'code':0xc8,'message':_0xef43e7[_0x7a7c('0x1d')]});})[_0x7a7c('0x1c')](function(_0x3c88f9){_0x5a556e(_0x5edf78[_0x7a7c('0x10')](0x1f4,_0x3c88f9[_0x7a7c('0x1d')]));});});},'CheckAfterSend':function(_0x248345){var _0x30f299=this;return new Promise(function(_0x4d8a68,_0x21db6c){_0x45957[_0x7a7c('0x81')](_0x248345)['then'](function(_0x38a213){_0x4d8a68({'code':0xc8,'message':_0x38a213['message']});})[_0x7a7c('0x1c')](function(_0x28f2f1){_0x21db6c(_0x30f299[_0x7a7c('0x10')](0x1f4,_0x28f2f1[_0x7a7c('0x1d')]));});});}};var _0x3b03d3=jayson[_0x7a7c('0x82')](_0x5ca4b9)['http']();_0x3b03d3['on'](_0x7a7c('0x10'),function(_0x3588ca){return _0x1652cc(_0x3588ca);});_0x3b03d3[_0x7a7c('0x8')](0x232a,_0x7a7c('0x83'),function(){console[_0x7a7c('0x84')](_0x7a7c('0x85'),0x232a);return _0x73ebcb('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xec4e=['active','callerid','Interval','values','channels','length','map','uniqueid','channel','format','%s.%s','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','run','event','emit','custom:','faxAccounts','send','checkAfterSend','http','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','module','Reload','Action','then','message','catch','ami\x20disconnected','action','Command','content','hasOwnProperty','voiceQueues','strategy','sumBillable','sumHoldTime','talking','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk'];(function(_0xb5d53e,_0x4b3c89){var _0x530a6e=function(_0x13bbd7){while(--_0x13bbd7){_0xb5d53e['push'](_0xb5d53e['shift']());}};_0x530a6e(++_0x4b3c89);}(_0xec4e,0xbd));var _0xeec4=function(_0x2fef2c,_0x358d13){_0x2fef2c=_0x2fef2c-0x0;var _0x37c7eb=_0xec4e[_0x2fef2c];return _0x37c7eb;};'use strict';var _=require(_0xeec4('0x0'));var util=require(_0xeec4('0x1'));var jayson=require(_0xeec4('0x2'));var schema=require(_0xeec4('0x3'));var BPromise=require(_0xeec4('0x4'));var moment=require(_0xeec4('0x5'));var config=require(_0xeec4('0x6'));var properties=require('../properties');var ami=require('../ami');exports['listen']=function(_0x5477cf,_0x130215,_0x475baf){return new BPromise(function(_0x24cbd1,_0x5ad8ff){var _0x2b810b={'QueuePause':function(_0x595828){return new Promise(function(_0x48a011,_0x373a7a){var _0x65535e=util['format'](_0xeec4('0x7'),_0xeec4('0x8'),_0x595828[_0xeec4('0x9')]);if(_0x5477cf[_0xeec4('0xa')]&&_0x5477cf[_0xeec4('0xa')][_0x65535e]&&_0x5477cf[_0xeec4('0xa')][_0x65535e]['timer']){_0x5477cf[_0xeec4('0xa')][_0x65535e][_0xeec4('0xb')]();}if(_0x5477cf[_0xeec4('0xc')][_0x65535e]){_0x5477cf[_0xeec4('0xc')][_0x65535e][_0xeec4('0xd')]({'statePause':_0x595828[_0xeec4('0xe')]?!![]:![]});}_0x48a011({'code':0xc8,'message':_0xeec4('0xf')});});},'Reload':function(_0xa8a6b6){var _0x3ffd2d=this;return new Promise(function(_0x2707df,_0x3359e6){if(ami[_0xeec4('0x10')]()==![]){return _0x3359e6(_0x3ffd2d[_0xeec4('0x11')](0x1f4,[config[_0xeec4('0x12')]['ip'],config[_0xeec4('0x12')][_0xeec4('0x13')],'ami\x20disconnected'][_0xeec4('0x14')]('\x20')));}_0xa8a6b6=_[_0xeec4('0x15')](_0xa8a6b6,_['keys'](properties[_0xeec4('0x16')]));_0xa8a6b6['action']=_0xeec4('0x17');return ami[_0xeec4('0x18')](_0xa8a6b6)[_0xeec4('0x19')](function(_0x1ce7b4){_0x2707df({'code':0xc8,'message':_0x1ce7b4[_0xeec4('0x1a')]});})[_0xeec4('0x1b')](function(_0x26dbf6){_0x3359e6(_0x3ffd2d[_0xeec4('0x11')](0x1f5,_0x26dbf6['message']));});});},'Command':function(_0x324398){var _0x4e59b6=this;return new Promise(function(_0x140f2b,_0x285d07){if(ami['isConnected']()==![]){return _0x285d07(_0x4e59b6[_0xeec4('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xeec4('0x13')],_0xeec4('0x1c')]['join']('\x20')));}_0x324398=_[_0xeec4('0x15')](_0x324398,'command');_0x324398[_0xeec4('0x1d')]=_0xeec4('0x1e');return ami[_0xeec4('0x18')](_0x324398)[_0xeec4('0x19')](function(_0x265d84){_0x140f2b({'code':0xc8,'message':_0x265d84[_0xeec4('0x1f')]});})[_0xeec4('0x1b')](function(_0x3d54eb){_0x285d07(_0x4e59b6['error'](0x1f5,_0x3d54eb[_0xeec4('0x1a')]));});});},'VoiceQueues':function(_0x2cc2a5){return new Promise(function(_0x24f86d,_0x1eb5d4){var _0x30d8a7=[];for(var _0x290aed in _0x5477cf['voiceQueues']){if(_0x5477cf['voiceQueues'][_0xeec4('0x20')](_0x290aed)){var _0x428b26=_0x5477cf[_0xeec4('0x21')][_0x290aed];var _0x4c5e24={'id':_0x428b26['id'],'name':_0x428b26[_0xeec4('0x9')],'strategy':_0x428b26[_0xeec4('0x22')],'answered':_0x428b26['answered'],'available':_0x428b26['available'],'loggedIn':_0x428b26['loggedIn'],'pTalking':_0x428b26['pTalking'],'sumBillable':_0x428b26[_0xeec4('0x23')],'sumDuration':_0x428b26['sumDuration'],'sumHoldTime':_0x428b26[_0xeec4('0x24')]||0x0,'talking':_0x428b26[_0xeec4('0x25')],'total':_0x428b26['total'],'type':_0x428b26['type'],'unmanaged':_0x428b26['unmanaged'],'abandoned':_0x428b26['abandoned'],'waiting':_0x428b26[_0xeec4('0x26')],'loggedInDb':_0x428b26[_0xeec4('0x27')]};if(_0x428b26[_0xeec4('0x28')]==='outbound'){_0x4c5e24['dialActive']=_0x428b26[_0xeec4('0x29')];_0x4c5e24['dialMethod']=_0x428b26[_0xeec4('0x2a')];_0x4c5e24[_0xeec4('0x2b')]=_0x428b26['dialOriginateCallerIdName'];_0x4c5e24[_0xeec4('0x2c')]=_0x428b26['dialOriginateCallerIdNumber'];_0x4c5e24['dialOriginateTimeout']=_0x428b26[_0xeec4('0x2d')];_0x4c5e24['dialPrefix']=_0x428b26['dialPrefix'];_0x4c5e24[_0xeec4('0x2e')]=_0x428b26[_0xeec4('0x2e')];_0x4c5e24[_0xeec4('0x2f')]=_0x428b26[_0xeec4('0x2f')];_0x4c5e24['outboundBlacklistCallsDay']=_0x428b26[_0xeec4('0x30')];_0x4c5e24[_0xeec4('0x31')]=_0x428b26[_0xeec4('0x31')];_0x4c5e24[_0xeec4('0x32')]=_0x428b26[_0xeec4('0x32')];_0x4c5e24['outboundDropCallsDayACS']=_0x428b26[_0xeec4('0x33')];_0x4c5e24[_0xeec4('0x34')]=_0x428b26[_0xeec4('0x34')];_0x4c5e24['outboundDropCallsDayTimeout']=_0x428b26[_0xeec4('0x35')];_0x4c5e24[_0xeec4('0x36')]=_0x428b26['outboundNoAnswerCallsDay'];_0x4c5e24[_0xeec4('0x37')]=_0x428b26[_0xeec4('0x37')];_0x4c5e24[_0xeec4('0x38')]=_0x428b26[_0xeec4('0x38')];_0x4c5e24[_0xeec4('0x39')]=_0x428b26[_0xeec4('0x39')];_0x4c5e24[_0xeec4('0x3a')]=_0x428b26['outboundRejectCallsDay'];_0x4c5e24[_0xeec4('0x3b')]=_0x428b26['outboundUnknownCallsDay'];_0x4c5e24[_0xeec4('0x3c')]=_0x428b26[_0xeec4('0x3c')];_0x4c5e24[_0xeec4('0x3d')]=_0x428b26[_0xeec4('0x3d')];_0x4c5e24['predictiveIntervalAvgTalktime']=_0x428b26['predictiveIntervalAvgTalktime'];_0x4c5e24[_0xeec4('0x3e')]=_0x428b26[_0xeec4('0x3e')];_0x4c5e24[_0xeec4('0x3f')]=_0x428b26['predictiveIntervalDroppedCallsTimeout'];_0x4c5e24['predictiveIntervalErlangCalls']=_0x428b26[_0xeec4('0x40')];_0x4c5e24[_0xeec4('0x41')]=_0x428b26[_0xeec4('0x41')];_0x4c5e24[_0xeec4('0x42')]=_0x428b26[_0xeec4('0x42')];_0x4c5e24[_0xeec4('0x43')]=_0x428b26[_0xeec4('0x43')];_0x4c5e24[_0xeec4('0x44')]=_0x428b26[_0xeec4('0x44')];_0x4c5e24[_0xeec4('0x45')]=_0x428b26[_0xeec4('0x45')];_0x4c5e24[_0xeec4('0x46')]=_0x428b26[_0xeec4('0x46')];_0x4c5e24[_0xeec4('0x1a')]=_0x428b26[_0xeec4('0x1a')];_0x4c5e24[_0xeec4('0x47')]=_0x428b26[_0xeec4('0x47')];_0x4c5e24[_0xeec4('0x48')]=_0x428b26[_0xeec4('0x48')];_0x4c5e24[_0xeec4('0x49')]=_0x428b26[_0xeec4('0x49')];_0x4c5e24['erlangAbandonmentRate']=_0x428b26[_0xeec4('0x4a')];_0x4c5e24[_0xeec4('0x4b')]=_0x428b26['erlangBusyFactor'];_0x4c5e24[_0xeec4('0x4c')]=_0x428b26[_0xeec4('0x4c')];_0x4c5e24[_0xeec4('0x4d')]=_0x428b26[_0xeec4('0x4d')];}if(_0x428b26[_0xeec4('0x4e')]){_0x4c5e24['Trunk']={'id':_0x428b26[_0xeec4('0x4e')]['id'],'name':_0x428b26[_0xeec4('0x4e')][_0xeec4('0x9')],'active':_0x428b26[_0xeec4('0x4e')][_0xeec4('0x4f')],'callerid':_0x428b26[_0xeec4('0x4e')][_0xeec4('0x50')]};}if(_0x428b26[_0xeec4('0x51')]){_0x4c5e24['Interval']={'id':_0x428b26[_0xeec4('0x51')]['id'],'name':_0x428b26[_0xeec4('0x51')][_0xeec4('0x9')]};}_0x30d8a7['push'](_0x4c5e24);}}_0x24f86d({'count':_0x30d8a7['length'],'rows':_0x30d8a7});});},'VoiceChannels':function(_0x2ea5c5){return new Promise(function(_0x5da73f,_0x491738){var _0x598580=_[_0xeec4('0x52')](_0x5477cf[_0xeec4('0x53')]);_0x5da73f({'count':_0x598580['length'],'rows':_0x598580});});},'VoiceChannelMixMonitor':function(_0x5ba291){var _0x572a56=this;return new Promise(function(_0x3ccc44,_0x1db540){if(ami[_0xeec4('0x10')]()==![]){return _0x1db540(_0x572a56[_0xeec4('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xeec4('0x13')],_0xeec4('0x1c')]['join']('\x20')));}var _0x4ef474=schema(properties['voicechannel'])[_0xeec4('0x3')](_0x5ba291);if(_0x4ef474[_0xeec4('0x54')]>0x0){return _0x1db540(_0x572a56[_0xeec4('0x11')](0x1f4,_[_0xeec4('0x55')](_0x4ef474,_0xeec4('0x1a'))['join'](',\x20')));}var _0x5b16a0=_['find'](_0x5477cf['channels'],{'uniqueid':_0x5ba291[_0xeec4('0x56')]});if(_0x5b16a0&&_0x5b16a0[_0xeec4('0x57')]){var _0x4d8a61=util[_0xeec4('0x58')](_0xeec4('0x59'),_0x5ba291['filename']||_0x5ba291['uniqueid'],_0x5ba291[_0xeec4('0x58')]||_0xeec4('0x5a'));return ami[_0xeec4('0x18')]({'action':_0xeec4('0x5b'),'channel':_0x5b16a0['channel'],'file':_0x4d8a61,'options':_0xeec4('0x5c')})[_0xeec4('0x19')](function(_0x1df093){var _0xb4c1b0=_[_0xeec4('0x5d')](_0x5b16a0[_0xeec4('0x5e')],{'filename':_0xeec4('0x5f')+_0x4d8a61['toLowerCase']()});if(_[_0xeec4('0x60')](_0xb4c1b0)){_0x5b16a0[_0xeec4('0x5e')]['push']({'filename':_0xeec4('0x5f')+_0x4d8a61[_0xeec4('0x61')](),'createdAt':moment()['format'](_0xeec4('0x62')),'mixmonitorid':_0x1df093[_0xeec4('0x63')],'status':_0xeec4('0x64')});}else{_0xb4c1b0['mixmonitorid']=_0x1df093[_0xeec4('0x63')];_0xb4c1b0[_0xeec4('0x65')]=_0xeec4('0x64');}_0x3ccc44({'code':0xc8,'message':[_0x5ba291[_0xeec4('0x56')],'MixMonitor\x20Success',_0x1df093['mixmonitorid']][_0xeec4('0x14')]('\x20'),'mixmonitorid':_0x1df093[_0xeec4('0x63')]});})['catch'](function(_0x2f88be){_0x1db540(_0x572a56[_0xeec4('0x11')](0x1f5,[_0x5ba291[_0xeec4('0x56')],_0x2f88be[_0xeec4('0x1a')][_0xeec4('0x61')]()][_0xeec4('0x14')]('\x20')));});}else{return _0x1db540(_0x572a56[_0xeec4('0x11')](0x1f5,_0xeec4('0x66')));}});},'VoiceChannelStopMixMonitor':function(_0x1aa124){var _0x5761ca=this;return new Promise(function(_0x1287f3,_0x41f8fa){if(ami[_0xeec4('0x10')]()==![]){return _0x41f8fa(_0x5761ca[_0xeec4('0x11')](0x1f4,[config[_0xeec4('0x12')]['ip'],config['asterisk'][_0xeec4('0x13')],_0xeec4('0x1c')]['join']('\x20')));}var _0x5debc1=schema(properties[_0xeec4('0x67')])[_0xeec4('0x3')](_0x1aa124);if(_0x5debc1[_0xeec4('0x54')]>0x0){return _0x41f8fa(_0x5761ca[_0xeec4('0x11')](0x1f4,_[_0xeec4('0x55')](_0x5debc1,_0xeec4('0x1a'))[_0xeec4('0x14')](',\x20')));}var _0x48e083=_[_0xeec4('0x5d')](_0x5477cf[_0xeec4('0x53')],{'uniqueid':_0x1aa124[_0xeec4('0x56')]});if(_0x48e083){return BPromise[_0xeec4('0x68')]()['then'](function(){if(_0x48e083[_0xeec4('0x57')]){return ami[_0xeec4('0x18')]({'action':_0xeec4('0x69'),'channel':_0x48e083[_0xeec4('0x57')],'mixmonitorid':_0x1aa124[_0xeec4('0x63')]})['catch'](function(_0xb781a){});}})[_0xeec4('0x19')](function(){if(_0x48e083[_0xeec4('0x6a')]){return ami['Action']({'action':_0xeec4('0x69'),'channel':_0x48e083[_0xeec4('0x6a')],'mixmonitorid':_0x1aa124['mixmonitorid']})[_0xeec4('0x1b')](function(_0x1a3b6e){});}})[_0xeec4('0x19')](function(_0x54380c){var _0x2afaa8=_[_0xeec4('0x5d')](_0x48e083['monitors'],{'mixmonitorid':_0x1aa124['mixmonitorid']});if(_0x2afaa8){_0x2afaa8[_0xeec4('0x65')]=_0xeec4('0x6b');}})[_0xeec4('0x19')](function(){var _0x51790d=util[_0xeec4('0x58')](_0xeec4('0x59'),_0x1aa124[_0xeec4('0x6c')]||_0x1aa124['uniqueid'],_0x1aa124[_0xeec4('0x58')]||_0xeec4('0x5a'));var _0x12292b=_[_0xeec4('0x5d')](_0x48e083[_0xeec4('0x5e')],{'filename':_0xeec4('0x5f')+_0x51790d[_0xeec4('0x61')]()});if(_0x12292b){_0x12292b[_0xeec4('0x65')]=_0xeec4('0x6b');}})['then'](function(){_0x1287f3({'code':0xc8,'message':[_0x1aa124[_0xeec4('0x56')],_0xeec4('0x6d')]['join']('\x20')});})[_0xeec4('0x1b')](function(_0x28a0cf){_0x41f8fa(_0x5761ca[_0xeec4('0x11')](0x1f5,[_0x1aa124['uniqueid'],_0x28a0cf[_0xeec4('0x1a')][_0xeec4('0x61')]()][_0xeec4('0x14')]('\x20')));});}else{return _0x41f8fa(_0x5761ca[_0xeec4('0x11')](0x1f5,_0xeec4('0x66')));}});},'VoiceQueuesChannels':function(_0x2ee91d){return new Promise(function(_0x3f3595,_0x45c3a2){var _0x4cdabf=_[_0xeec4('0x52')](_0x5477cf[_0xeec4('0x6e')]);_0x3f3595({'count':_0x4cdabf[_0xeec4('0x54')],'rows':_0x4cdabf});});},'VoiceQueuesChannel':function(_0x580680){var _0x5f465d=this;return new Promise(function(_0x1f89a7,_0x2e89f4){var _0x2e4b49=schema(properties[_0xeec4('0x6f')])[_0xeec4('0x3')](_0x580680);if(_0x2e4b49[_0xeec4('0x54')]>0x0){return _0x2e89f4(_0x5f465d['error'](0x1f4,_[_0xeec4('0x55')](_0x2e4b49,_0xeec4('0x1a'))[_0xeec4('0x14')](',\x20')));}var _0x96a063=_[_0xeec4('0x5d')](_0x5477cf[_0xeec4('0x6e')],{'uniqueid':_0x580680[_0xeec4('0x56')]});if(_0x96a063){_0x1f89a7(_0x96a063);}else{return _0x2e89f4(_0x5f465d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x3f2936){var _0x490a2f=this;return new Promise(function(_0x2080a3,_0x54fe50){if(ami[_0xeec4('0x10')]()==![]){return _0x54fe50(_0x490a2f[_0xeec4('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xeec4('0x1c')][_0xeec4('0x14')]('\x20')));}var _0x19b915=schema(properties[_0xeec4('0x70')])[_0xeec4('0x3')](_0x3f2936);if(_0x19b915[_0xeec4('0x54')]>0x0){return _0x54fe50(_0x490a2f[_0xeec4('0x11')](0x1f4,_[_0xeec4('0x55')](_0x19b915,_0xeec4('0x1a'))[_0xeec4('0x14')](',\x20')));}var _0x2dced8=_['find'](_0x5477cf[_0xeec4('0x6e')],{'uniqueid':_0x3f2936[_0xeec4('0x56')]});if(_0x2dced8&&_0x2dced8['channel']){return ami[_0xeec4('0x18')]({'action':_0xeec4('0x71'),'channel':_0x2dced8[_0xeec4('0x57')]})['then'](function(_0x4589f8){_0x2080a3({'code':0xc8,'message':[_0x3f2936[_0xeec4('0x56')],_0x4589f8[_0xeec4('0x1a')][_0xeec4('0x61')]()]['join']('\x20')});})[_0xeec4('0x1b')](function(_0xbdee4f){_0x54fe50(_0x490a2f[_0xeec4('0x11')](0x1f5,[_0x3f2936[_0xeec4('0x56')],_0xbdee4f['message'][_0xeec4('0x61')]()][_0xeec4('0x14')]('\x20')));});}else{return _0x54fe50(_0x490a2f['error'](0x1f5,_0xeec4('0x66')));}});},'VoiceQueuesChannelRedirect':function(_0x8296e4){var _0x16aba5=this;return new Promise(function(_0x3ce5d7,_0x2d09f5){if(ami['isConnected']()==![]){return _0x2d09f5(_0x16aba5['error'](0x1f4,[config['asterisk']['ip'],config[_0xeec4('0x12')]['username'],'ami\x20disconnected'][_0xeec4('0x14')]('\x20')));}var _0x33d03a=schema(properties[_0xeec4('0x72')])['validate'](_0x8296e4);if(_0x33d03a[_0xeec4('0x54')]>0x0){return _0x2d09f5(_0x16aba5[_0xeec4('0x11')](0x1f4,_[_0xeec4('0x55')](_0x33d03a,_0xeec4('0x1a'))['join'](',\x20')));}var _0x104332=_[_0xeec4('0x5d')](_0x5477cf[_0xeec4('0x6e')],{'uniqueid':_0x8296e4[_0xeec4('0x56')]});if(_0x104332&&_0x104332[_0xeec4('0x57')]){return ami[_0xeec4('0x18')]({'action':_0xeec4('0x73'),'channel':_0x104332['channel'],'exten':_0x8296e4[_0xeec4('0x74')],'context':_0x8296e4[_0xeec4('0x75')]||_0x104332[_0xeec4('0x75')],'priority':0x1})[_0xeec4('0x19')](function(_0x57a84c){_0x3ce5d7({'code':0xc8,'message':[_0x8296e4[_0xeec4('0x56')],_0x57a84c[_0xeec4('0x1a')][_0xeec4('0x61')]()][_0xeec4('0x14')]('\x20')});})['catch'](function(_0x34256e){_0x2d09f5(_0x16aba5[_0xeec4('0x11')](0x1f5,[_0x8296e4[_0xeec4('0x56')],_0x34256e[_0xeec4('0x1a')][_0xeec4('0x61')]()][_0xeec4('0x14')]('\x20')));});}else{return _0x2d09f5(_0x16aba5[_0xeec4('0x11')](0x1f5,_0xeec4('0x66')));}});},'Agents':function(_0x6e2b80){return new Promise(function(_0x217073,_0x92a235){var _0x5164ea=_[_0xeec4('0x52')](_0x5477cf['agents']);_0x217073({'count':_0x5164ea['length'],'rows':_0x5164ea});});},'Telephones':function(_0x313dfa){return new Promise(function(_0x437603,_0x2ec54d){var _0xd21c9b=_[_0xeec4('0x52')](_0x5477cf[_0xeec4('0x76')]);_0x437603({'count':_0xd21c9b[_0xeec4('0x54')],'rows':_0xd21c9b});});},'Trunks':function(_0x3b4ef0){return new Promise(function(_0x1753ed,_0x5ab0ee){var _0x14a0c5=_['values'](_0x5477cf[_0xeec4('0x77')]);_0x1753ed({'count':_0x14a0c5[_0xeec4('0x54')],'rows':_0x14a0c5});});},'OutboundChannels':function(_0x486f40){return new Promise(function(_0x246b89,_0x50fca1){var _0x1b6142=_['values'](_0x5477cf[_0xeec4('0x78')]);_0x246b89({'count':_0x1b6142[_0xeec4('0x54')],'rows':_0x1b6142});});},'Outbound':function(_0x3633f1){return new Promise(function(_0x1ed71a,_0x3d89b5){_0x1ed71a(_0x5477cf[_0xeec4('0x79')]);});},'Campaigns':function(_0x12e3b2){return new Promise(function(_0x28f2bd,_0x35dd97){var _0x61178=_[_0xeec4('0x52')](_0x5477cf['campaigns']);_0x28f2bd({'count':_0x61178['length'],'rows':_0x61178});});},'VoiceQueuesPreview':function(_0x123167){var _0x1c4c84=this;return new Promise(function(_0x42c2f8,_0x5ad487){_0x130215[_0xeec4('0x7a')](_0x123167['id'])['then'](function(_0x4877c7){_0x42c2f8({'code':0xc8,'message':_0x4877c7['message']});})[_0xeec4('0x1b')](function(_0xbb995c){_0x5ad487(_0x1c4c84[_0xeec4('0x11')](0x1f4,_0xbb995c['message']));});});},'EventManager':function(_0xb43c60){var _0x2d02f2=this;return new Promise(function(_0x4146cf,_0xb7b463){if(!_0xb43c60[_0xeec4('0x7b')]){return _0xb7b463(_0x2d02f2[_0xeec4('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xeec4('0x7c')](_0xeec4('0x7d')+_0xb43c60[_0xeec4('0x7b')],_0xb43c60[_0xeec4('0x1a')]);_0x4146cf({'code':0xc8,'message':_0xb43c60});});},'FaxAccounts':function(_0x3faa49){return new Promise(function(_0x3d919a,_0x5653f6){var _0x412131=_[_0xeec4('0x52')](_0x5477cf[_0xeec4('0x7e')]);_0x3d919a({'count':_0x412131[_0xeec4('0x54')],'rows':_0x412131});});},'SendFax':function(_0x4b307e){var _0x50be1a=this;return new Promise(function(_0x254c93,_0xe13025){_0x475baf[_0xeec4('0x7f')](_0x4b307e)[_0xeec4('0x19')](function(_0x378436){_0x254c93({'code':0xc8,'message':_0x378436['message']});})[_0xeec4('0x1b')](function(_0x3b964b){_0xe13025(_0x50be1a[_0xeec4('0x11')](0x1f4,_0x3b964b['message']));});});},'CheckAfterSend':function(_0x3f1fa9){var _0x3222a2=this;return new Promise(function(_0x5a0361,_0x40a228){_0x475baf[_0xeec4('0x80')](_0x3f1fa9)[_0xeec4('0x19')](function(_0x13f82c){_0x5a0361({'code':0xc8,'message':_0x13f82c[_0xeec4('0x1a')]});})[_0xeec4('0x1b')](function(_0x575137){_0x40a228(_0x3222a2[_0xeec4('0x11')](0x1f4,_0x575137[_0xeec4('0x1a')]));});});}};var _0xcdedf7=jayson['server'](_0x2b810b)[_0xeec4('0x81')]();_0xcdedf7['on']('error',function(_0x371baa){return _0x5ad8ff(_0x371baa);});_0xcdedf7[_0xeec4('0x82')](0x232a,'127.0.0.1',function(){console[_0xeec4('0x83')](_0xeec4('0x84'),0x232a);return _0x24cbd1(_0xeec4('0x85')+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 19f2dd4..54ed8a6 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 _0xbb2f=['stringify','bluebird','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','exec','autoCreate','data2','data1','calleridnum','isNil','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','action','toLowerCase','merge','createContact','name','trigger:%s','error','Error\x20creating\x20contact'];(function(_0x33de83,_0x5cd14a){var _0x2dc227=function(_0x7a3560){while(--_0x7a3560){_0x33de83['push'](_0x33de83['shift']());}};_0x2dc227(++_0x5cd14a);}(_0xbb2f,0x10b));var _0xfbb2=function(_0x34ee04,_0x187e43){_0x34ee04=_0x34ee04-0x0;var _0x2a7e5b=_0xbb2f[_0x34ee04];return _0x2a7e5b;};'use strict';var BPromise=require(_0xfbb2('0x0'));var util=require('util');var _=require(_0xfbb2('0x1'));var Redis=require(_0xfbb2('0x2'));var config=require(_0xfbb2('0x3'));var logger=require(_0xfbb2('0x4'))(_0xfbb2('0x5'));var cmContactRpc=require(_0xfbb2('0x6'));config[_0xfbb2('0x7')]=_[_0xfbb2('0x8')](config[_0xfbb2('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfbb2('0x9'))(new Redis(config[_0xfbb2('0x7')]));function emit(_0x1dc957,_0x56f5a6,_0x1ba7c4){logger['info'](_0x1dc957,_0x56f5a6,JSON['stringify'](_0x1ba7c4));io['to'](_0x1dc957)['emit'](_0x56f5a6,_0x1ba7c4);}exports[_0xfbb2('0xa')]=function(_0x158e39,_0x1ac3ad,_0x2e2cca){_0x2e2cca[_0xfbb2('0xb')]=0x0;if(_0x1ac3ad[_0xfbb2('0xc')]&&parseInt(_0x1ac3ad['data2'],0xa)){var _0x3fe0b8={'ListId':parseInt(_0x1ac3ad[_0xfbb2('0xd')],0xa),'phone':_0x2e2cca[_0xfbb2('0xe')]};if(_[_0xfbb2('0xf')](_0x2e2cca['routeId'])){_0x3fe0b8[_0xfbb2('0x10')]=_0x2e2cca[_0xfbb2('0x11')]&&_0x2e2cca[_0xfbb2('0x11')]!==_0xfbb2('0x12')?_0x2e2cca['calleridname']:_0x2e2cca[_0xfbb2('0xe')]||_0x2e2cca[_0xfbb2('0x13')];}else{_0x3fe0b8[_0xfbb2('0x10')]=_0x2e2cca[_0xfbb2('0x14')]&&_0x2e2cca[_0xfbb2('0x14')]!==_0xfbb2('0x12')?_0x2e2cca[_0xfbb2('0x14')]:_0x2e2cca[_0xfbb2('0x15')]||_0x2e2cca[_0xfbb2('0x13')];_0x3fe0b8['phone']=_0x2e2cca['destcalleridname']&&_0x2e2cca[_0xfbb2('0x14')]!==_0xfbb2('0x12')?_0x2e2cca[_0xfbb2('0x14')]:_0x2e2cca[_0xfbb2('0x15')]||_0x2e2cca[_0xfbb2('0x13')];}BPromise[_0xfbb2('0x16')]()[_0xfbb2('0x17')](cmContactRpc[_0xfbb2('0x18')]({'where':_[_0xfbb2('0x19')](_0x3fe0b8,[_0xfbb2('0x10')])}))[_0xfbb2('0x17')](function(_0x1fd131){if(_0x1fd131){_0x2e2cca[_0xfbb2('0x1a')]=_0x1fd131['id'];emit(util[_0xfbb2('0x1b')](_0xfbb2('0x1c'),_0x158e39['name']),util[_0xfbb2('0x1b')]('trigger:%s',_0x1ac3ad[_0xfbb2('0x1d')][_0xfbb2('0x1e')]()),_[_0xfbb2('0x1f')](_0x2e2cca,{'ListId':parseInt(_0x1ac3ad[_0xfbb2('0xd')],0xa)}));return;}else{return BPromise[_0xfbb2('0x16')]()[_0xfbb2('0x17')](cmContactRpc[_0xfbb2('0x20')](_0x3fe0b8));}})[_0xfbb2('0x17')](function(_0xd5b6af){if(_0xd5b6af){_0x2e2cca[_0xfbb2('0x1a')]=_0xd5b6af['id'];emit(util[_0xfbb2('0x1b')](_0xfbb2('0x1c'),_0x158e39[_0xfbb2('0x21')]),util[_0xfbb2('0x1b')](_0xfbb2('0x22'),_0x1ac3ad['action'][_0xfbb2('0x1e')]()),_[_0xfbb2('0x1f')](_0x2e2cca,{'ListId':parseInt(_0x1ac3ad[_0xfbb2('0xd')],0xa)}));}})['catch'](function(_0x532f84){logger[_0xfbb2('0x23')](_0xfbb2('0x24'),JSON[_0xfbb2('0x25')](_0x532f84));});}else{if(_0x158e39){emit(util[_0xfbb2('0x1b')](_0xfbb2('0x1c'),_0x158e39[_0xfbb2('0x21')]),util[_0xfbb2('0x1b')](_0xfbb2('0x22'),_0x1ac3ad[_0xfbb2('0x1d')][_0xfbb2('0x1e')]()),_[_0xfbb2('0x1f')]({'ListId':parseInt(_0x1ac3ad['data1'],0xa)},_0x2e2cca));}}}; \ No newline at end of file +var _0x4f4d=['util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','autoCreate','data2','data1','isNil','firstName','calleridname','','calleridnum','destcalleridname','destcalleridnum','uniqueid','resolve','then','showContact','xmd-contactid2','user:%s','name','format','trigger:%s','action','toLowerCase','merge','createContact','catch','error','Error\x20creating\x20contact','bluebird'];(function(_0x5cbfc1,_0xaaeb94){var _0x8c6301=function(_0x5cd13e){while(--_0x5cd13e){_0x5cbfc1['push'](_0x5cbfc1['shift']());}};_0x8c6301(++_0xaaeb94);}(_0x4f4d,0xe3));var _0xd4f4=function(_0x4f7fc6,_0x554d2f){_0x4f7fc6=_0x4f7fc6-0x0;var _0x235170=_0x4f4d[_0x4f7fc6];return _0x235170;};'use strict';var BPromise=require(_0xd4f4('0x0'));var util=require(_0xd4f4('0x1'));var _=require('lodash');var Redis=require('ioredis');var config=require(_0xd4f4('0x2'));var logger=require(_0xd4f4('0x3'))(_0xd4f4('0x4'));var cmContactRpc=require(_0xd4f4('0x5'));config[_0xd4f4('0x6')]=_[_0xd4f4('0x7')](config[_0xd4f4('0x6')],{'host':_0xd4f4('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4f4('0x6')]));function emit(_0x3a3563,_0x2ff61d,_0x135b38){logger[_0xd4f4('0x9')](_0x3a3563,_0x2ff61d,JSON[_0xd4f4('0xa')](_0x135b38));io['to'](_0x3a3563)[_0xd4f4('0xb')](_0x2ff61d,_0x135b38);}exports['exec']=function(_0x525b84,_0x4d7877,_0x4fa4af){_0x4fa4af[_0xd4f4('0xc')]=0x0;if(_0x4d7877['data2']&&parseInt(_0x4d7877[_0xd4f4('0xd')],0xa)){var _0x30eeb3={'ListId':parseInt(_0x4d7877[_0xd4f4('0xe')],0xa),'phone':_0x4fa4af['calleridnum']};if(_[_0xd4f4('0xf')](_0x4fa4af['routeId'])){_0x30eeb3[_0xd4f4('0x10')]=_0x4fa4af[_0xd4f4('0x11')]&&_0x4fa4af[_0xd4f4('0x11')]!==_0xd4f4('0x12')?_0x4fa4af[_0xd4f4('0x11')]:_0x4fa4af[_0xd4f4('0x13')]||_0x4fa4af['uniqueid'];}else{_0x30eeb3[_0xd4f4('0x10')]=_0x4fa4af[_0xd4f4('0x14')]&&_0x4fa4af[_0xd4f4('0x14')]!==_0xd4f4('0x12')?_0x4fa4af[_0xd4f4('0x14')]:_0x4fa4af[_0xd4f4('0x15')]||_0x4fa4af['uniqueid'];_0x30eeb3['phone']=_0x4fa4af['destcalleridname']&&_0x4fa4af['destcalleridname']!==_0xd4f4('0x12')?_0x4fa4af[_0xd4f4('0x14')]:_0x4fa4af[_0xd4f4('0x15')]||_0x4fa4af[_0xd4f4('0x16')];}BPromise[_0xd4f4('0x17')]()[_0xd4f4('0x18')](cmContactRpc[_0xd4f4('0x19')]({'where':_['omit'](_0x30eeb3,[_0xd4f4('0x10')])}))['then'](function(_0x1f7c63){if(_0x1f7c63){_0x4fa4af[_0xd4f4('0x1a')]=_0x1f7c63['id'];emit(util['format'](_0xd4f4('0x1b'),_0x525b84[_0xd4f4('0x1c')]),util[_0xd4f4('0x1d')](_0xd4f4('0x1e'),_0x4d7877[_0xd4f4('0x1f')][_0xd4f4('0x20')]()),_[_0xd4f4('0x21')](_0x4fa4af,{'ListId':parseInt(_0x4d7877[_0xd4f4('0xe')],0xa)}));return;}else{return BPromise[_0xd4f4('0x17')]()[_0xd4f4('0x18')](cmContactRpc[_0xd4f4('0x22')](_0x30eeb3));}})['then'](function(_0xf9c40f){if(_0xf9c40f){_0x4fa4af[_0xd4f4('0x1a')]=_0xf9c40f['id'];emit(util[_0xd4f4('0x1d')](_0xd4f4('0x1b'),_0x525b84[_0xd4f4('0x1c')]),util[_0xd4f4('0x1d')](_0xd4f4('0x1e'),_0x4d7877['action'][_0xd4f4('0x20')]()),_['merge'](_0x4fa4af,{'ListId':parseInt(_0x4d7877[_0xd4f4('0xe')],0xa)}));}})[_0xd4f4('0x23')](function(_0x5cc725){logger[_0xd4f4('0x24')](_0xd4f4('0x25'),JSON[_0xd4f4('0xa')](_0x5cc725));});}else{if(_0x525b84){emit(util[_0xd4f4('0x1d')]('user:%s',_0x525b84[_0xd4f4('0x1c')]),util['format'](_0xd4f4('0x1e'),_0x4d7877['action'][_0xd4f4('0x20')]()),_['merge']({'ListId':parseInt(_0x4d7877[_0xd4f4('0xe')],0xa)},_0x4fa4af));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e1c9961..df65035 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 _0x95b9=['location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','name','jscripty','user:%s','format','trigger:%s','integration','exec','queue','routeId','urlforward','script','buildUri','parse','query','search','AllConditions','every','checkConditions','AnyConditions','some','channel','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','message','value','agent','membername','lastevent','exports','util','lodash','mustache','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:queuecallerabandon','syncAgentDial','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','html','data2','render','template\x20not\x20found','url','uri','data3','isNil','data4'];(function(_0x4b29ab,_0x3239a6){var _0x3656c4=function(_0x174599){while(--_0x174599){_0x4b29ab['push'](_0x4b29ab['shift']());}};_0x3656c4(++_0x3239a6);}(_0x95b9,0x10c));var _0x995b=function(_0x12de90,_0x90a77f){_0x12de90=_0x12de90-0x0;var _0x1b725d=_0x95b9[_0x12de90];return _0x1b725d;};'use strict';var util=require(_0x995b('0x0'));var _=require(_0x995b('0x1'));var url=require('url');var Mustache=require(_0x995b('0x2'));var Redis=require('ioredis');var urlforward=require(_0x995b('0x3'));var integration=require(_0x995b('0x4'));var cmContact=require(_0x995b('0x5'));var script=require(_0x995b('0x6'));var cmContactRpc=require(_0x995b('0x7'));var config=require('../../../config/environment');var logger=require(_0x995b('0x8'))(_0x995b('0x9'));var ami=require(_0x995b('0xa'));config[_0x995b('0xb')]=_[_0x995b('0xc')](config[_0x995b('0xb')],{'host':_0x995b('0xd'),'port':0x18eb});var io=require(_0x995b('0xe'))(new Redis(config[_0x995b('0xb')]));var operators={'equals':function(_0x140822,_0x6893b0){return _0x140822==_0x6893b0;},'not_equals':function(_0x2a38eb,_0xd5f3df){return _0x2a38eb!=_0xd5f3df;}};var barAndWebActions=[_0x995b('0xf'),'url',_0x995b('0x10')];function Trigger(_0x2f540d){this[_0x995b('0x11')]=_0x2f540d[_0x995b('0x11')];this[_0x995b('0x12')]=_0x2f540d['agents'];this[_0x995b('0x13')]=_0x2f540d['voiceQueues'];this[_0x995b('0x14')]=_0x2f540d[_0x995b('0x14')];this[_0x995b('0x15')]=_0x2f540d[_0x995b('0x15')];this[_0x995b('0x16')]=_0x2f540d[_0x995b('0x16')];this[_0x995b('0x17')]=_0x2f540d[_0x995b('0x17')];this[_0x995b('0x18')]=_0x2f540d[_0x995b('0x18')];this['sugarcrmAccounts']=_0x2f540d[_0x995b('0x19')];this['zohoAccounts']=_0x2f540d[_0x995b('0x1a')];this[_0x995b('0x1b')]=_0x2f540d['deskAccounts'];this['vtigerAccounts']=_0x2f540d[_0x995b('0x1c')];this['servicenowAccounts']=_0x2f540d[_0x995b('0x1d')];this[_0x995b('0x1e')]=_0x2f540d[_0x995b('0x1e')];this[_0x995b('0x1f')]={'zendesk':this[_0x995b('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x995b('0x17')],'sugarcrm':this[_0x995b('0x19')],'zoho':this[_0x995b('0x1a')],'desk':this['deskAccounts'],'vtiger':this[_0x995b('0x1c')],'servicenow':this['servicenowAccounts'],'dynamics365':this[_0x995b('0x1e')]};ami['on']('custom:agentcalled',this[_0x995b('0x20')][_0x995b('0x21')](this));ami['on'](_0x995b('0x22'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentringnoanswer',this[_0x995b('0x20')][_0x995b('0x21')](this));ami['on'](_0x995b('0x23'),this[_0x995b('0x20')]['bind'](this));ami['on'](_0x995b('0x24'),this[_0x995b('0x20')][_0x995b('0x21')](this));ami['on']('custom:dialbegin',this[_0x995b('0x25')][_0x995b('0x21')](this));ami['on']('custom:dialconnect',this[_0x995b('0x25')][_0x995b('0x21')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0x995b('0x21')](this));ami['on']('custom:newinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0x995b('0x26'),this[_0x995b('0x20')][_0x995b('0x21')](this));ami['on'](_0x995b('0x27'),this[_0x995b('0x20')]['bind'](this));ami['on'](_0x995b('0x28'),this[_0x995b('0x20')][_0x995b('0x21')](this));ami['on'](_0x995b('0x29'),this[_0x995b('0x20')][_0x995b('0x21')](this));ami['on'](_0x995b('0x2a'),this[_0x995b('0x20')]['bind'](this));}Trigger[_0x995b('0x2b')]['emit']=function(_0x999048,_0xeec122,_0x1816d3){logger[_0x995b('0x2c')](_0x999048,_0xeec122,JSON[_0x995b('0x2d')](_0x1816d3));io['to'](_0x999048)[_0x995b('0x2e')](_0xeec122,_0x1816d3);};Trigger['prototype'][_0x995b('0x20')]=function(_0x54df29){var _0x52dc40=_[_0x995b('0x2f')](_0x54df29);this[_0x995b('0x30')](_0x52dc40);};Trigger[_0x995b('0x2b')][_0x995b('0x25')]=function(_0x45c7c0){if(this[_0x995b('0x12')][_0x45c7c0[_0x995b('0x31')]]){this[_0x995b('0x20')](_0x45c7c0);}};Trigger[_0x995b('0x2b')][_0x995b('0x30')]=function(_0x318bf4){var _0x11f12c;for(var _0x5240da in this['triggers']){if(this[_0x995b('0x11')][_0x995b('0x32')](_0x5240da)){if(this[_0x995b('0x11')][_0x5240da]['status']){_0x11f12c=this[_0x995b('0x33')](this[_0x995b('0x11')][_0x5240da],_0x318bf4);if(_0x11f12c){_[_0x995b('0x34')](_0x318bf4,_0x318bf4['variables']);for(var _0x3fa24b=0x0,_0x27e8b3,_0x46ab27,_0xf7dab8;_0x3fa24b0x0){_0x7b47c4=_['map'](_0x17e62d,_0x160746);}return _0x7b47c4;}function getCustomFields(_0x318f67,_0x2c2133){var _0x6afb76=[];var _0x1d9873={'custom_fields':{}};if(_0x318f67[_0xe0ab('0x2b')]>0x0){_[_0xe0ab('0x2c')](_0x318f67,function(_0x4df830){if(_0x4df830[_0xe0ab('0x2d')]===_0xe0ab('0x2e')&&_0x4df830['nameField']&&!_0x4df830['customField']){_0x1d9873[_0x4df830[_0xe0ab('0x2f')][_0xe0ab('0x30')]()]=_0x4df830[_0xe0ab('0x31')]['toString']();}else if(_0x4df830[_0xe0ab('0x2d')]===_0xe0ab('0x2e')&&_0x4df830['idField']&&_0x4df830[_0xe0ab('0x32')]){_0x1d9873[_0xe0ab('0x33')][_0x4df830[_0xe0ab('0x34')]]=_0x4df830[_0xe0ab('0x31')][_0xe0ab('0x20')]();}else if(_0x4df830[_0xe0ab('0x2d')]===_0xe0ab('0x35')&&_0x4df830[_0xe0ab('0x36')]&&_0x4df830[_0xe0ab('0x34')]&&_0x4df830['customField']){_0x2c2133[_0x4df830[_0xe0ab('0x36')]]&&(_0x1d9873[_0xe0ab('0x33')][_0x4df830['idField']]=_0x2c2133[_0x4df830[_0xe0ab('0x36')]][_0xe0ab('0x20')]());}else if(_0x4df830[_0xe0ab('0x2d')]===_0xe0ab('0x37')&&_0x4df830['Variable']&&_0x4df830[_0xe0ab('0x38')]['name']&&_0x4df830[_0xe0ab('0x34')]&&_0x4df830['customField']){_0x2c2133[_0x4df830[_0xe0ab('0x38')]['name']['toLowerCase']()]&&(_0x1d9873['custom_fields'][_0x4df830[_0xe0ab('0x34')]]=_0x2c2133[_0x4df830['Variable'][_0xe0ab('0x39')][_0xe0ab('0x30')]()][_0xe0ab('0x20')]());}});}if(_0x1d9873[_0xe0ab('0x3a')]){_0x1d9873[_0xe0ab('0x3a')]=Number(_0x1d9873[_0xe0ab('0x3a')]);}return _0x1d9873;}function getTicket(_0x11a62b,_0x431772,_0x3baa35,_0x36761a,_0x10fce4){logger['info']('Creating\x20new\x20ticket...');var _0x1a2782=_[_0xe0ab('0x3b')]({'subject':intUtil[_0xe0ab('0x3c')](_0x36761a[_0xe0ab('0x3d')],_0x10fce4,'\x20'),'type':_0xe0ab('0x3e'),'status':'new','labels':[_0xe0ab('0x3f'),_0xe0ab('0x40'),_0xe0ab('0x41')][_0xe0ab('0x42')](getTags(_0x36761a[_0xe0ab('0x43')],_0xe0ab('0x39'))),'description':intUtil[_0xe0ab('0x3c')](_0x36761a['Descriptions'],_0x10fce4,'\x0a'),'_links':{'assigned_user':{'href':util[_0xe0ab('0xf')]('/api/v2/users/%d',_0x431772['id']),'class':_0xe0ab('0x44')}},'message':{'direction':'in','body':intUtil[_0xe0ab('0x3c')](_0x36761a[_0xe0ab('0x45')],_0x10fce4,'\x0a')}},getCustomFields(_0x36761a[_0xe0ab('0x46')],_0x10fce4));return request({'uri':util[_0xe0ab('0xf')](_0xe0ab('0x47'),_0x11a62b['remoteUri'],_0x3baa35['id']),'method':_0xe0ab('0x29'),'body':_0x1a2782});}exports['queue']=function(_0x386b5f,_0x3f08ca,_0x2523a3,_0x2495f8,_0x31af67,_0x4f43fd){var _0x335180,_0x5c51f5;_0x4f43fd[_0xe0ab('0x16')]=intUtil['stripTrailingSlash'](_0x4f43fd[_0xe0ab('0x16')]);_0x4f43fd[_0xe0ab('0x48')]=intUtil['stripTrailingSlash'](_0x4f43fd['serverUrl']);if(_0x31af67&&_0x31af67[_0xe0ab('0x49')]){logger[_0xe0ab('0xd')](_0xe0ab('0x4a'),'Recording\x20is\x20enabled!');_0x3f08ca[_0xe0ab('0x4b')]=util[_0xe0ab('0xf')](_0xe0ab('0x4c'),_0x4f43fd[_0xe0ab('0x48')],_0x3f08ca[_0xe0ab('0x4d')],md5(_0x3f08ca[_0xe0ab('0x4d')]));}else{_0x3f08ca[_0xe0ab('0x4b')]='';}headers[_0xe0ab('0x4e')]=getAuth(_0x4f43fd);return getUser(_0x4f43fd,_0x2495f8[_0xe0ab('0x4f')])['then'](function(_0x4dd2f9){_0x335180=_0x4dd2f9;logger['info'](_0xe0ab('0x50'),_0x335180['id']);return getEndUser(_0x4f43fd,_0x3f08ca[_0xe0ab('0x51')],_0x3f08ca['calleridnum']);})[_0xe0ab('0x11')](function(_0x586988){_0x5c51f5=_0x586988;logger[_0xe0ab('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5c51f5['id']);return getTicket(_0x4f43fd,_0x335180,_0x5c51f5,_0x2523a3,_0x3f08ca);})[_0xe0ab('0x11')](function(_0x38f12f){if(_0x38f12f){logger[_0xe0ab('0xd')](_0xe0ab('0x52'));logger[_0xe0ab('0xd')](_0xe0ab('0x53'),_0x38f12f['id']);switch(_0x4f43fd[_0xe0ab('0x2d')]){case _0xe0ab('0x54'):logger['info'](_0xe0ab('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xe0ab('0xf')](_0xe0ab('0x55'),_0x2495f8[_0xe0ab('0x39')]),'trigger:desk:display',{'recordId':_0x38f12f['id']});break;case _0xe0ab('0x56'):logger[_0xe0ab('0xd')](_0xe0ab('0x4a'),_0xe0ab('0x57'));emit(util[_0xe0ab('0xf')]('user:%s',_0x2495f8[_0xe0ab('0x39')]),_0xe0ab('0x58'),{'uri':util[_0xe0ab('0xf')](_0xe0ab('0x59'),_0x38f12f['id'])});break;default:logger[_0xe0ab('0x5a')](_0xe0ab('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xe0ab('0x5b')](function(_0x5c29c7){console[_0xe0ab('0x5a')](_0x5c29c7);logger['error']('[QUEUE]',JSON['stringify'](_0x5c29c7));});};exports[_0xe0ab('0x5c')]=function(_0x3d8da6,_0x257745,_0x374c83,_0x2f3b30,_0x38bac5,_0x3061a4,_0x163b39){var _0x240039,_0x2c0517;_0x3061a4[_0xe0ab('0x16')]=intUtil[_0xe0ab('0x5d')](_0x3061a4[_0xe0ab('0x16')]);_0x3061a4[_0xe0ab('0x48')]=intUtil['stripTrailingSlash'](_0x3061a4['serverUrl']);if(_0x163b39&&_0x163b39[_0xe0ab('0x5e')]&&_0x163b39[_0xe0ab('0x5e')]!==_0xe0ab('0x5f')){logger[_0xe0ab('0xd')](_0xe0ab('0x60'),'Recording\x20is\x20enabled!');_0x257745[_0xe0ab('0x4b')]=util[_0xe0ab('0xf')](_0xe0ab('0x4c'),_0x3061a4['serverUrl'],_0x257745['uniqueid'],md5(_0x257745[_0xe0ab('0x4d')]));}headers[_0xe0ab('0x4e')]=getAuth(_0x3061a4);return getUser(_0x3061a4,_0x2f3b30['email'])[_0xe0ab('0x11')](function(_0x3840a3){_0x240039=_0x3840a3;logger[_0xe0ab('0xd')]('The\x20User\x20ID\x20is:',_0x240039['id']);return getEndUser(_0x3061a4,_0x257745[_0xe0ab('0x61')],_0x257745[_0xe0ab('0x62')]);})['then'](function(_0x3ebee9){_0x2c0517=_0x3ebee9;logger[_0xe0ab('0xd')](_0xe0ab('0x63'),_0x2c0517['id']);return getTicket(_0x3061a4,_0x240039,_0x2c0517,_0x374c83,_0x257745);})[_0xe0ab('0x11')](function(_0x438fc3){if(_0x438fc3){logger['info'](_0xe0ab('0x52'));logger[_0xe0ab('0xd')](_0xe0ab('0x53'),_0x438fc3['id']);switch(_0x3061a4[_0xe0ab('0x2d')]){case _0xe0ab('0x54'):logger[_0xe0ab('0xd')]('[QUEUE]',_0xe0ab('0x64'));emit(util[_0xe0ab('0xf')](_0xe0ab('0x55'),_0x2f3b30['name']),_0xe0ab('0x65'),{'recordId':_0x438fc3['id']});break;case _0xe0ab('0x56'):logger[_0xe0ab('0xd')]('[QUEUE]',_0xe0ab('0x57'));emit(util[_0xe0ab('0xf')]('user:%s',_0x2f3b30[_0xe0ab('0x39')]),_0xe0ab('0x58'),{'uri':util['format'](_0xe0ab('0x66'),_0x3061a4[_0xe0ab('0x16')],_0x438fc3['id'])});break;default:logger[_0xe0ab('0x5a')]('[OUTBOUND]',_0xe0ab('0x67'));}}})['catch'](function(_0x410e58){logger[_0xe0ab('0x5a')](_0xe0ab('0x60'),JSON[_0xe0ab('0x18')](_0x410e58));});};exports[_0xe0ab('0x68')]=function(_0x5c6944,_0x1c0b00,_0x274c82,_0x28d115,_0x590dfb,_0x493557){var _0x3ec0ab,_0x5d347e;_0x493557[_0xe0ab('0x16')]=intUtil[_0xe0ab('0x5d')](_0x493557[_0xe0ab('0x16')]);_0x493557[_0xe0ab('0x48')]=intUtil[_0xe0ab('0x5d')](_0x493557[_0xe0ab('0x48')]);if(_0x590dfb&&_0x590dfb[_0xe0ab('0x49')]){logger[_0xe0ab('0xd')](_0xe0ab('0x69'),_0xe0ab('0x6a'));_0x1c0b00[_0xe0ab('0x4b')]=util[_0xe0ab('0xf')](_0xe0ab('0x4c'),_0x493557[_0xe0ab('0x48')],_0x1c0b00[_0xe0ab('0x4d')],md5(_0x1c0b00[_0xe0ab('0x4d')]));}else{_0x1c0b00[_0xe0ab('0x4b')]='';}headers['Authorization']=getAuth(_0x493557);return getUser(_0x493557)['then'](function(_0xe07959){_0x3ec0ab=_0xe07959;logger[_0xe0ab('0xd')](_0xe0ab('0x50'),_0x3ec0ab['id']);return getEndUser(_0x493557,_0x1c0b00[_0xe0ab('0x51')],_0x1c0b00[_0xe0ab('0x6b')]);})[_0xe0ab('0x11')](function(_0x340fff){_0x5d347e=_0x340fff;logger[_0xe0ab('0xd')](_0xe0ab('0x63'),_0x5d347e['id']);return getTicket(_0x493557,_0x3ec0ab,_0x5d347e,_0x274c82,_0x1c0b00);})[_0xe0ab('0x11')](function(_0x5d8271){if(_0x5d8271){logger[_0xe0ab('0xd')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5d8271['id']);}})[_0xe0ab('0x5b')](function(_0x554a6d){logger[_0xe0ab('0x5a')](_0xe0ab('0x69'),JSON[_0xe0ab('0x18')](_0x554a6d));});}; \ No newline at end of file +var _0xbcb6=['recordingFormat','none','[OUTBOUND]','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','newTab','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','calleridname','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','application/json','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','stringify','GET','basic','%s:%s','username','password','authType','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','variable','variableName','idField','customVariable','Variable','name','priority','merge','getString','Subjects','phone','new','xCALLY','Motion','CTI','concat','/api/v2/users/%d','user','Descriptions','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcb6,0xe2));var _0x6bcb=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0xbcb6[_0x12c66e];return _0x19481a;};'use strict';var _=require('lodash');var rp=require(_0x6bcb('0x0'));var md5=require(_0x6bcb('0x1'));var util=require(_0x6bcb('0x2'));var Redis=require(_0x6bcb('0x3'));var intUtil=require('./util');var config=require(_0x6bcb('0x4'));var logger=require(_0x6bcb('0x5'))(_0x6bcb('0x6'));config[_0x6bcb('0x7')]=_[_0x6bcb('0x8')](config['redis'],{'host':_0x6bcb('0x9'),'port':0x18eb});var io=require(_0x6bcb('0xa'))(new Redis(config[_0x6bcb('0x7')]));function emit(_0x1d46d9,_0x380e5c,_0x5938d2){io['to'](_0x1d46d9)['emit'](_0x380e5c,_0x5938d2);}var headers={'Content-Type':_0x6bcb('0xb'),'Accept':_0x6bcb('0xb')};function getUser(_0x940423,_0x309984){if(intUtil['validateEmail'](_0x309984)===!![]){logger[_0x6bcb('0xc')](_0x6bcb('0xd'),_0x309984);return request({'uri':util[_0x6bcb('0xe')](_0x6bcb('0xf'),_0x940423['remoteUri'])})[_0x6bcb('0x10')](function(_0x3eeeab){if(_0x3eeeab[_0x6bcb('0x11')]){return _[_0x6bcb('0x12')](_0x3eeeab[_0x6bcb('0x13')][_0x6bcb('0x14')],{'email':_0x309984});}})['then'](function(_0x2513c9){if(_0x2513c9){logger[_0x6bcb('0xc')](_0x6bcb('0x15'));return _0x2513c9;}else{logger['info'](_0x6bcb('0x16'));return request({'uri':util['format'](_0x6bcb('0x17'),_0x940423[_0x6bcb('0x18')])});}});}else{logger[_0x6bcb('0xc')](_0x6bcb('0x19'));return request({'uri':util['format'](_0x6bcb('0x17'),_0x940423[_0x6bcb('0x18')])});}}function request(_0x4feb04){logger[_0x6bcb('0x1a')](_0x6bcb('0x1b'),JSON[_0x6bcb('0x1c')](_0x4feb04));return rp(_[_0x6bcb('0x8')](_0x4feb04,{'method':_0x6bcb('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x4b3500){var _0x1dcdb8;if(_0x4b3500['authType']===_0x6bcb('0x1e')){_0x1dcdb8=util[_0x6bcb('0xe')](_0x6bcb('0x1f'),_0x4b3500[_0x6bcb('0x20')],_0x4b3500[_0x6bcb('0x21')]);}else if(_0x4b3500[_0x6bcb('0x22')]==='token'){_0x1dcdb8=util[_0x6bcb('0xe')]('%s/token:%s',_0x4b3500[_0x6bcb('0x20')],_0x4b3500['token']);}return util[_0x6bcb('0xe')]('Basic\x20%s',new Buffer(_0x1dcdb8)['toString'](_0x6bcb('0x23')));}function getEndUser(_0x4ba2a7,_0x308332,_0x2ca251){logger[_0x6bcb('0xc')](_0x6bcb('0x24'),_0x2ca251);return request({'uri':util[_0x6bcb('0xe')]('%s/customers/search',_0x4ba2a7[_0x6bcb('0x18')]),'qs':{'phone':_0x2ca251}})[_0x6bcb('0x10')](function(_0x284e69){if(_0x284e69['total_entries']){logger[_0x6bcb('0xc')]('Enduser\x20found!');return _0x284e69[_0x6bcb('0x13')]['entries'][0x0];}else{logger['info'](_0x6bcb('0x25'));return request({'uri':util[_0x6bcb('0xe')](_0x6bcb('0x26'),_0x4ba2a7[_0x6bcb('0x18')]),'method':_0x6bcb('0x27'),'body':{'first_name':_0x308332,'title':_0x308332,'phone_numbers':[{'type':'work','value':_0x2ca251}]}});}});}function getTags(_0x259f6c,_0x9add0a){var _0x2e7833=[];if(_0x259f6c&&_0x259f6c['length']>0x0){_0x2e7833=_['map'](_0x259f6c,_0x9add0a);}return _0x2e7833;}function getCustomFields(_0x3a3e82,_0x271a05){var _0x3d2bd9=[];var _0x50714f={'custom_fields':{}};if(_0x3a3e82[_0x6bcb('0x28')]>0x0){_[_0x6bcb('0x29')](_0x3a3e82,function(_0x13afba){if(_0x13afba[_0x6bcb('0x2a')]===_0x6bcb('0x2b')&&_0x13afba[_0x6bcb('0x2c')]&&!_0x13afba[_0x6bcb('0x2d')]){_0x50714f[_0x13afba[_0x6bcb('0x2c')][_0x6bcb('0x2e')]()]=_0x13afba[_0x6bcb('0x2f')][_0x6bcb('0x30')]();}else if(_0x13afba[_0x6bcb('0x2a')]==='string'&&_0x13afba['idField']&&_0x13afba['customField']){_0x50714f[_0x6bcb('0x31')][_0x13afba['idField']]=_0x13afba['content'][_0x6bcb('0x30')]();}else if(_0x13afba['type']===_0x6bcb('0x32')&&_0x13afba[_0x6bcb('0x33')]&&_0x13afba['idField']&&_0x13afba[_0x6bcb('0x2d')]){_0x271a05[_0x13afba[_0x6bcb('0x33')]]&&(_0x50714f['custom_fields'][_0x13afba[_0x6bcb('0x34')]]=_0x271a05[_0x13afba[_0x6bcb('0x33')]]['toString']());}else if(_0x13afba[_0x6bcb('0x2a')]===_0x6bcb('0x35')&&_0x13afba[_0x6bcb('0x36')]&&_0x13afba['Variable'][_0x6bcb('0x37')]&&_0x13afba[_0x6bcb('0x34')]&&_0x13afba[_0x6bcb('0x2d')]){_0x271a05[_0x13afba[_0x6bcb('0x36')][_0x6bcb('0x37')]['toLowerCase']()]&&(_0x50714f[_0x6bcb('0x31')][_0x13afba['idField']]=_0x271a05[_0x13afba['Variable'][_0x6bcb('0x37')]['toLowerCase']()][_0x6bcb('0x30')]());}});}if(_0x50714f[_0x6bcb('0x38')]){_0x50714f['priority']=Number(_0x50714f[_0x6bcb('0x38')]);}return _0x50714f;}function getTicket(_0xcbf061,_0x1ca8ef,_0x572c8e,_0x5691d4,_0x273156){logger[_0x6bcb('0xc')]('Creating\x20new\x20ticket...');var _0x403bf3=_[_0x6bcb('0x39')]({'subject':intUtil[_0x6bcb('0x3a')](_0x5691d4[_0x6bcb('0x3b')],_0x273156,'\x20'),'type':_0x6bcb('0x3c'),'status':_0x6bcb('0x3d'),'labels':[_0x6bcb('0x3e'),_0x6bcb('0x3f'),_0x6bcb('0x40')][_0x6bcb('0x41')](getTags(_0x5691d4['Tags'],_0x6bcb('0x37'))),'description':intUtil[_0x6bcb('0x3a')](_0x5691d4['Descriptions'],_0x273156,'\x0a'),'_links':{'assigned_user':{'href':util[_0x6bcb('0xe')](_0x6bcb('0x42'),_0x1ca8ef['id']),'class':_0x6bcb('0x43')}},'message':{'direction':'in','body':intUtil[_0x6bcb('0x3a')](_0x5691d4[_0x6bcb('0x44')],_0x273156,'\x0a')}},getCustomFields(_0x5691d4[_0x6bcb('0x45')],_0x273156));return request({'uri':util[_0x6bcb('0xe')](_0x6bcb('0x46'),_0xcbf061[_0x6bcb('0x18')],_0x572c8e['id']),'method':'POST','body':_0x403bf3});}exports[_0x6bcb('0x47')]=function(_0x376f36,_0x5a4afa,_0xb4c177,_0x1327da,_0x585bd5,_0x32f14a){var _0x593048,_0x15e0d3;_0x32f14a[_0x6bcb('0x18')]=intUtil[_0x6bcb('0x48')](_0x32f14a[_0x6bcb('0x18')]);_0x32f14a[_0x6bcb('0x49')]=intUtil[_0x6bcb('0x48')](_0x32f14a['serverUrl']);if(_0x585bd5&&_0x585bd5[_0x6bcb('0x4a')]){logger[_0x6bcb('0xc')]('[QUEUE]',_0x6bcb('0x4b'));_0x5a4afa[_0x6bcb('0x4c')]=util[_0x6bcb('0xe')](_0x6bcb('0x4d'),_0x32f14a[_0x6bcb('0x49')],_0x5a4afa[_0x6bcb('0x4e')],md5(_0x5a4afa[_0x6bcb('0x4e')]));}else{_0x5a4afa[_0x6bcb('0x4c')]='';}headers[_0x6bcb('0x4f')]=getAuth(_0x32f14a);return getUser(_0x32f14a,_0x1327da[_0x6bcb('0x50')])[_0x6bcb('0x10')](function(_0x4de438){_0x593048=_0x4de438;logger[_0x6bcb('0xc')](_0x6bcb('0x51'),_0x593048['id']);return getEndUser(_0x32f14a,_0x5a4afa['calleridname'],_0x5a4afa[_0x6bcb('0x52')]);})['then'](function(_0x75b9c5){_0x15e0d3=_0x75b9c5;logger[_0x6bcb('0xc')](_0x6bcb('0x53'),_0x15e0d3['id']);return getTicket(_0x32f14a,_0x593048,_0x15e0d3,_0xb4c177,_0x5a4afa);})[_0x6bcb('0x10')](function(_0x588228){if(_0x588228){logger[_0x6bcb('0xc')]('Ticket\x20created!');logger[_0x6bcb('0xc')]('The\x20Ticket\x20ID\x20is:',_0x588228['id']);switch(_0x32f14a[_0x6bcb('0x2a')]){case _0x6bcb('0x54'):logger[_0x6bcb('0xc')]('[QUEUE]',_0x6bcb('0x55'));emit(util[_0x6bcb('0xe')]('user:%s',_0x1327da['name']),_0x6bcb('0x56'),{'recordId':_0x588228['id']});break;case'newTab':logger[_0x6bcb('0xc')](_0x6bcb('0x57'),_0x6bcb('0x58'));emit(util[_0x6bcb('0xe')](_0x6bcb('0x59'),_0x1327da[_0x6bcb('0x37')]),_0x6bcb('0x5a'),{'uri':util[_0x6bcb('0xe')](_0x6bcb('0x5b'),_0x588228['id'])});break;default:logger[_0x6bcb('0x5c')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x6bcb('0x5d')](function(_0x4cd08a){console['error'](_0x4cd08a);logger['error'](_0x6bcb('0x57'),JSON['stringify'](_0x4cd08a));});};exports[_0x6bcb('0x5e')]=function(_0x3a2d76,_0x5a07a9,_0x2b94b8,_0x5155a6,_0x4a51f,_0x358228,_0x4d4eaa){var _0xe4f772,_0x34c886;_0x358228[_0x6bcb('0x18')]=intUtil[_0x6bcb('0x48')](_0x358228[_0x6bcb('0x18')]);_0x358228['serverUrl']=intUtil[_0x6bcb('0x48')](_0x358228['serverUrl']);if(_0x4d4eaa&&_0x4d4eaa['recordingFormat']&&_0x4d4eaa[_0x6bcb('0x5f')]!==_0x6bcb('0x60')){logger[_0x6bcb('0xc')](_0x6bcb('0x61'),_0x6bcb('0x4b'));_0x5a07a9[_0x6bcb('0x4c')]=util[_0x6bcb('0xe')](_0x6bcb('0x4d'),_0x358228[_0x6bcb('0x49')],_0x5a07a9[_0x6bcb('0x4e')],md5(_0x5a07a9[_0x6bcb('0x4e')]));}headers[_0x6bcb('0x4f')]=getAuth(_0x358228);return getUser(_0x358228,_0x5155a6['email'])[_0x6bcb('0x10')](function(_0x460c54){_0xe4f772=_0x460c54;logger['info'](_0x6bcb('0x51'),_0xe4f772['id']);return getEndUser(_0x358228,_0x5a07a9['destcalleridname'],_0x5a07a9[_0x6bcb('0x62')]);})[_0x6bcb('0x10')](function(_0x373742){_0x34c886=_0x373742;logger[_0x6bcb('0xc')](_0x6bcb('0x53'),_0x34c886['id']);return getTicket(_0x358228,_0xe4f772,_0x34c886,_0x2b94b8,_0x5a07a9);})['then'](function(_0x391926){if(_0x391926){logger[_0x6bcb('0xc')](_0x6bcb('0x63'));logger['info'](_0x6bcb('0x64'),_0x391926['id']);switch(_0x358228[_0x6bcb('0x2a')]){case'integrationTab':logger[_0x6bcb('0xc')](_0x6bcb('0x57'),_0x6bcb('0x55'));emit(util[_0x6bcb('0xe')](_0x6bcb('0x59'),_0x5155a6[_0x6bcb('0x37')]),_0x6bcb('0x56'),{'recordId':_0x391926['id']});break;case _0x6bcb('0x65'):logger['info'](_0x6bcb('0x57'),_0x6bcb('0x58'));emit(util[_0x6bcb('0xe')](_0x6bcb('0x59'),_0x5155a6[_0x6bcb('0x37')]),_0x6bcb('0x5a'),{'uri':util[_0x6bcb('0xe')](_0x6bcb('0x66'),_0x358228[_0x6bcb('0x18')],_0x391926['id'])});break;default:logger[_0x6bcb('0x5c')](_0x6bcb('0x61'),_0x6bcb('0x67'));}}})[_0x6bcb('0x5d')](function(_0x85d82c){logger[_0x6bcb('0x5c')]('[OUTBOUND]',JSON[_0x6bcb('0x1c')](_0x85d82c));});};exports[_0x6bcb('0x68')]=function(_0x54cd52,_0x459848,_0xb3409b,_0x2d28b5,_0x4812b6,_0x73f0a5){var _0x504fca,_0x17c734;_0x73f0a5[_0x6bcb('0x18')]=intUtil[_0x6bcb('0x48')](_0x73f0a5[_0x6bcb('0x18')]);_0x73f0a5[_0x6bcb('0x49')]=intUtil[_0x6bcb('0x48')](_0x73f0a5['serverUrl']);if(_0x4812b6&&_0x4812b6['monitor_format']){logger[_0x6bcb('0xc')](_0x6bcb('0x69'),_0x6bcb('0x4b'));_0x459848['recordingURL']=util[_0x6bcb('0xe')](_0x6bcb('0x4d'),_0x73f0a5[_0x6bcb('0x49')],_0x459848[_0x6bcb('0x4e')],md5(_0x459848[_0x6bcb('0x4e')]));}else{_0x459848['recordingURL']='';}headers[_0x6bcb('0x4f')]=getAuth(_0x73f0a5);return getUser(_0x73f0a5)['then'](function(_0x24e176){_0x504fca=_0x24e176;logger[_0x6bcb('0xc')](_0x6bcb('0x51'),_0x504fca['id']);return getEndUser(_0x73f0a5,_0x459848[_0x6bcb('0x6a')],_0x459848[_0x6bcb('0x52')]);})['then'](function(_0x55d2e2){_0x17c734=_0x55d2e2;logger[_0x6bcb('0xc')](_0x6bcb('0x53'),_0x17c734['id']);return getTicket(_0x73f0a5,_0x504fca,_0x17c734,_0xb3409b,_0x459848);})[_0x6bcb('0x10')](function(_0x1f8a99){if(_0x1f8a99){logger[_0x6bcb('0xc')](_0x6bcb('0x63'));logger[_0x6bcb('0xc')](_0x6bcb('0x64'),_0x1f8a99['id']);}})[_0x6bcb('0x5d')](function(_0x1da325){logger['error'](_0x6bcb('0x69'),JSON[_0x6bcb('0x1c')](_0x1da325));});}; \ 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 28d96c7..d41d296 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 _0xb97d=[']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','catch','outbound','destcalleridnum','calleridnum','POST','/systemusers(','userId','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase','contactid',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','phonecall','phonecalls','queue','callDirection','Fields','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','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\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','username','password','then','access_token','error','toUpperCase'];(function(_0x4b72c4,_0x35f065){var _0x8023b=function(_0x2edff6){while(--_0x2edff6){_0x4b72c4['push'](_0x4b72c4['shift']());}};_0x8023b(++_0x35f065);}(_0xb97d,0xb3));var _0xdb97=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xb97d[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var BPromise=require(_0xdb97('0x0'));var rp=require(_0xdb97('0x1'));var util=require(_0xdb97('0x2'));var intUtil=require(_0xdb97('0x3'));var md5=require(_0xdb97('0x4'));var Redis=require(_0xdb97('0x5'));var logger=require(_0xdb97('0x6'))(_0xdb97('0x7'));var config=require(_0xdb97('0x8'));config[_0xdb97('0x9')]=_[_0xdb97('0xa')](config['redis'],{'host':_0xdb97('0xb'),'port':0x18eb});var io=require(_0xdb97('0xc'))(new Redis(config[_0xdb97('0x9')]));function getAuthToken(_0xd41c6,_0x5172d7,_0x4c5d07){var _0x14e938={'method':'POST','uri':_0x5172d7,'form':{'client_id':_0xd41c6[_0xdb97('0xd')],'resource':_0xd41c6[_0xdb97('0xe')],'username':_0xd41c6[_0xdb97('0xf')],'password':_0xd41c6[_0xdb97('0x10')],'grant_type':_0xdb97('0x10'),'client_secret':_0xd41c6['clientSecret']},'json':!![]};return rp(_0x14e938)[_0xdb97('0x11')](function(_0x32140b){return _0x32140b[_0xdb97('0x12')];})['catch'](function(_0x4eb290){logger[_0xdb97('0x13')]('['+[_0x4c5d07[_0xdb97('0x14')]()]+_0xdb97('0x15'));return _0x4eb290[_0xdb97('0x16')];});}function getUser(_0x635607,_0x3a96d,_0x3917b7,_0x1364ed,_0x92084d,_0x4fb46f){return new BPromise(function(_0x24402e,_0x20121a){return getAuthToken(_0x3a96d,_0x1364ed,_0x4fb46f)[_0xdb97('0x11')](function(_0x10bd01){var _0x14f089={'method':_0xdb97('0x17'),'uri':_0x92084d+_0xdb97('0x18'),'headers':{'Authorization':_0xdb97('0x19')+_0x10bd01,'OData-Version':_0xdb97('0x1a')},'json':!![]};return rp(_0x14f089);})[_0xdb97('0x11')](function(_0x38edec){var _0xb05ad2=_0x38edec[_0xdb97('0x1b')];var _0x2ddd28=![];var _0x45ebad=null;if(!_[_0xdb97('0x1c')](_0x3917b7)){if(intUtil[_0xdb97('0x1d')](_0x3917b7[_0xdb97('0x1e')])){_0x635607['userEmail']=_0x3917b7['email'];for(_0x45ebad=0x0;_0x45ebad<_0xb05ad2[_0xdb97('0x1f')];_0x45ebad++){if(_0xb05ad2[_0x45ebad]['internalemailaddress']===_0x3917b7[_0xdb97('0x1e')]&&!_0xb05ad2[_0x45ebad][_0xdb97('0x20')]){_0x2ddd28=!![];logger[_0xdb97('0x21')]('['+[_0x4fb46f[_0xdb97('0x14')]()]+']\x20Agent\x20found\x20'+_0xb05ad2[_0x45ebad][_0xdb97('0x22')]+'!');_0x635607['userId']=_0xb05ad2[_0x45ebad][_0xdb97('0x22')];}}}}if(!_0x2ddd28){logger[_0xdb97('0x21')]('['+[_0x4fb46f['toUpperCase']()]+_0xdb97('0x23'));_0x635607[_0xdb97('0x24')]=_0x3a96d[_0xdb97('0xf')];for(_0x45ebad=0x0;_0x45ebad<_0xb05ad2['length'];_0x45ebad++){if(_0xb05ad2[_0x45ebad][_0xdb97('0x25')]===_0x3a96d[_0xdb97('0xf')]){_0x635607['userId']=_0xb05ad2[_0x45ebad][_0xdb97('0x22')];}}}_0x24402e(_0x635607);})[_0xdb97('0x26')](function(_0x4bfab4){_0x20121a(_0x4bfab4[_0xdb97('0x16')]);});});}function createEndUser(_0x4072b1,_0x4142ff,_0x4e0683,_0x331339,_0x2ec467,_0x5a9e21){return new BPromise(function(_0x1f8a41,_0x54b7c4){return getAuthToken(_0x4142ff,_0x4e0683,_0x5a9e21)[_0xdb97('0x11')](function(_0xbeb147){var _0x186fdc=_0x5a9e21['toLowerCase']()===_0xdb97('0x27')?_0x2ec467[_0xdb97('0x28')]:_0x2ec467[_0xdb97('0x29')];var _0x22d581={'method':_0xdb97('0x2a'),'uri':_0x331339+'contacts','body':{'telephone1':_0x186fdc,'fullname':_0x186fdc,'firstname':_0x186fdc,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xdb97('0x2b')+_0x4072b1[_0xdb97('0x2c')]+')'},'headers':{'Authorization':_0xdb97('0x19')+_0xbeb147,'OData-Version':_0xdb97('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x22d581);})[_0xdb97('0x11')](function(_0x320eff){var _0x52e43f=_0x320eff[_0xdb97('0x2d')][_0xdb97('0x2e')];var _0x19e40b=_0x52e43f[_0xdb97('0x2f')](_0x52e43f[_0xdb97('0x30')]('(')+0x1,_0x52e43f[_0xdb97('0x30')](')'));_0x4072b1[_0xdb97('0x31')]=_0x19e40b;_0x1f8a41(_0x4072b1);})[_0xdb97('0x26')](function(_0x59c131){_0x54b7c4(_0x59c131[_0xdb97('0x16')]);});});}function getEndUser(_0xb4a808,_0x386601,_0x249f6d,_0x2debb8,_0x422ed6,_0x4e4c29){return new BPromise(function(_0x35478d,_0x25d64d){return getAuthToken(_0x386601,_0x249f6d,_0x4e4c29)[_0xdb97('0x11')](function(_0x336a64){var _0x127a4b={'method':_0xdb97('0x17'),'uri':_0x2debb8+_0xdb97('0x32'),'headers':{'Authorization':_0xdb97('0x19')+_0x336a64,'If-None-Match':null,'OData-Version':_0xdb97('0x1a')},'json':!![]};return rp(_0x127a4b);})['then'](function(_0x481aab){var _0x5116cf=null;if(_0x481aab){var _0x5cc7ad=_0x481aab['value'];var _0x38fbde=![];for(_0x5116cf=0x0;_0x5116cf<_0x5cc7ad['length'];_0x5116cf++){var _0x473cb4=_0x4e4c29[_0xdb97('0x33')]()===_0xdb97('0x27')?_0x422ed6[_0xdb97('0x28')]:_0x422ed6[_0xdb97('0x29')];if(_0x5cc7ad[_0x5116cf]['telephone1']===_0x473cb4){_0x38fbde=!![];_0xb4a808[_0xdb97('0x31')]=_0x5cc7ad[_0x5116cf][_0xdb97('0x34')];}}if(_0x38fbde){_0x35478d(_0xb4a808);}else{return createEndUser(_0xb4a808,_0x386601,_0x249f6d,_0x2debb8,_0x422ed6,_0x4e4c29)[_0xdb97('0x11')](function(_0x596e58){logger[_0xdb97('0x21')]('['+[_0x4e4c29['toUpperCase']()]+']\x20Enduser\x20created!',_0x596e58[_0xdb97('0x31')]);_0x35478d(_0x596e58);});}}else{return createEndUser(_0xb4a808,_0x386601,_0x249f6d,_0x2debb8,_0x422ed6,_0x4e4c29)['then'](function(_0x506656){logger['info']('['+[_0x4e4c29['toUpperCase']()]+_0xdb97('0x35'),_0x506656[_0xdb97('0x31')]);_0x35478d(_0x506656);});}});});}function getCustomFields(_0x19ed62,_0x756c74,_0x38a0d6){var _0x4c5780={};if(_0x19ed62[_0xdb97('0x1f')]>0x0){_[_0xdb97('0x36')](_0x19ed62,function(_0x2cc2b7){if(_0x2cc2b7[_0xdb97('0x37')]===_0xdb97('0x38')&&_0x2cc2b7[_0xdb97('0x39')]&&!_0x2cc2b7[_0xdb97('0x3a')]){var _0x4b5113=_0x2cc2b7[_0xdb97('0x3b')]['toLowerCase']();var _0x1a4738=_0x4b5113[_0xdb97('0x2f')](0x0,_0x4b5113[_0xdb97('0x3c')]('_'));var _0x245f3a=_0x4b5113['substring'](_0x4b5113['indexOf']('_')+0x1);if(_0x1a4738===_0x38a0d6){_0x4c5780[_0x245f3a]=_0x2cc2b7[_0xdb97('0x3d')];}}});}return _0x4c5780;}function getTicket(_0x2531cf,_0x5a426c,_0x5f12e1,_0x5790a6,_0x4b1e02,_0x5123c7,_0x428999){return new BPromise(function(_0x1f2851,_0x49e407){var _0x159cbd;return getAuthToken(_0x5a426c,_0x5f12e1,_0x428999)['then'](function(_0x122750){if(_0x5123c7[_0xdb97('0x3e')]==='incident'){_0x159cbd={'method':'POST','uri':_0x5790a6+_0xdb97('0x3f'),'body':Object[_0xdb97('0x40')]({},{'title':intUtil[_0xdb97('0x41')](_0x5123c7[_0xdb97('0x42')],_0x4b1e02,'\x20'),'description':intUtil[_0xdb97('0x41')](_0x5123c7[_0xdb97('0x43')],_0x4b1e02,'\x0a'),'customerid_contact@odata.bind':_0xdb97('0x44')+_0x2531cf['enduserId']+')','ownerid@odata.bind':_0xdb97('0x2b')+_0x2531cf['userId']+')','caseorigincode':'1'},getCustomFields(_0x5123c7['Fields'],_0x4b1e02,_0x5123c7[_0xdb97('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x122750,'OData-Version':_0xdb97('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5123c7['ticketType']===_0xdb97('0x45')){_0x159cbd={'method':_0xdb97('0x2a'),'uri':_0x5790a6+_0xdb97('0x46'),'body':Object[_0xdb97('0x40')]({},{'subject':intUtil['getString'](_0x5123c7['Subjects'],_0x4b1e02,'\x20'),'phonenumber':String(_0x4b1e02[_0xdb97('0x29')]),'description':intUtil[_0xdb97('0x41')](_0x5123c7[_0xdb97('0x43')],_0x4b1e02,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x2531cf['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x2531cf[_0xdb97('0x2c')]+')','directioncode':_0x2531cf['callDirection']===_0xdb97('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2531cf[_0xdb97('0x2c')]+')','participationtypemask':_0x2531cf['callDirection']===_0xdb97('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0xdb97('0x44')+_0x2531cf['enduserId']+')','participationtypemask':_0x2531cf[_0xdb97('0x48')]==='queue'?0x1:0x2}]},getCustomFields(_0x5123c7[_0xdb97('0x49')],_0x4b1e02,_0x5123c7[_0xdb97('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x122750,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x159cbd);})[_0xdb97('0x11')](function(_0x343f4e){var _0x16f52d=_0x343f4e[_0xdb97('0x2d')][_0xdb97('0x2e')];var _0x2c19a2=_0x16f52d[_0xdb97('0x2f')](_0x16f52d[_0xdb97('0x30')]('(')+0x1,_0x16f52d[_0xdb97('0x30')](')'));_0x2531cf[_0xdb97('0x4a')]=_0x2c19a2;_0x1f2851(_0x2531cf);})[_0xdb97('0x26')](function(_0x1fca3f){_0x49e407(_0x1fca3f[_0xdb97('0x16')]);});});}function emit(_0x33d15c,_0x538b6c,_0x380abd,_0x4ab1e6){var _0x13b6e3={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x33d15c,_0x380abd,_0x4ab1e6)};io['to'](util[_0xdb97('0x4b')](_0xdb97('0x4c'),_0x538b6c))[_0xdb97('0x4d')](_0xdb97('0x4e'),_0x13b6e3);}exports['cs']=function(_0x304e49,_0x47c872,_0x52613e,_0x1a16f0,_0x93c064,_0x51f7da,_0x3408ce,_0x13863f){var _0x22535b={};_0x51f7da[_0xdb97('0xe')]=intUtil[_0xdb97('0x4f')](_0x51f7da[_0xdb97('0xe')]);_0x51f7da[_0xdb97('0x50')]=intUtil[_0xdb97('0x4f')](_0x51f7da['serverUrl']);_0x22535b['callDirection']=_0x13863f==='queue'||_0x13863f===_0xdb97('0x51')?_0xdb97('0x47'):_0xdb97('0x27');var _0x2efb2f=util[_0xdb97('0x4b')](_0xdb97('0x52'),_0x51f7da[_0xdb97('0xe')]);var _0x549ea5=util[_0xdb97('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x51f7da[_0xdb97('0x53')]);var _0x13082a=util[_0xdb97('0x4b')](_0xdb97('0x54'),_0x51f7da[_0xdb97('0x50')],_0x47c872[_0xdb97('0x55')],md5(_0x47c872[_0xdb97('0x55')]));if(_0x93c064&&_0x93c064[_0xdb97('0x56')]){logger[_0xdb97('0x21')](_0xdb97('0x57'),_0xdb97('0x58'));_0x47c872[_0xdb97('0x59')]=_0x13082a;}else if(_0x3408ce&&_0x3408ce[_0xdb97('0x5a')]&&_0x3408ce['recordingFormat']!==_0xdb97('0x5b')){logger[_0xdb97('0x21')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x47c872[_0xdb97('0x59')]=_0x13082a;}else{_0x47c872[_0xdb97('0x59')]='';}return getUser(_0x22535b,_0x51f7da,_0x1a16f0,_0x549ea5,_0x2efb2f,_0x13863f)[_0xdb97('0x11')](function(_0x406147){logger[_0xdb97('0x21')]('['+_0x13863f['toUpperCase']()+_0xdb97('0x5c'),_0x406147[_0xdb97('0x2c')]);logger[_0xdb97('0x21')]('['+_0x13863f[_0xdb97('0x14')]()+_0xdb97('0x5d'),_0x406147['userEmail']);return getEndUser(_0x406147,_0x51f7da,_0x549ea5,_0x2efb2f,_0x47c872,_0x13863f);})[_0xdb97('0x11')](function(_0xd765f3){logger[_0xdb97('0x21')]('['+_0x13863f['toUpperCase']()+_0xdb97('0x5e'),_0xd765f3[_0xdb97('0x31')]);logger[_0xdb97('0x21')]('['+_0x13863f['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x47c872[_0xdb97('0x29')]);return getTicket(_0xd765f3,_0x51f7da,_0x549ea5,_0x2efb2f,_0x47c872,_0x52613e,_0x13863f);})[_0xdb97('0x11')](function(_0x4406a7){logger['info'](util['format']('['+_0x13863f[_0xdb97('0x14')]()+_0xdb97('0x5f'),_0x52613e[_0xdb97('0x3e')],_0x4406a7[_0xdb97('0x4a')]));logger['info'](util[_0xdb97('0x4b')]('['+_0x13863f[_0xdb97('0x14')]()+']\x20Call\x20direction:\x20%s',_0x13863f));if(_0x13863f!==_0xdb97('0x51')){logger[_0xdb97('0x21')]('['+_0x13863f[_0xdb97('0x14')]()+']',_0xdb97('0x60'));emit(_0x51f7da[_0xdb97('0xe')],_0x1a16f0[_0xdb97('0x61')],_0x52613e['ticketType'],_0x4406a7[_0xdb97('0x4a')]);}})[_0xdb97('0x26')](function(_0xfef092){logger['error']('['+_0x13863f[_0xdb97('0x14')]()+_0xdb97('0x62'),util[_0xdb97('0x63')](_0xfef092,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2a4e=['toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','userEmail','email','length','internalemailaddress','isdisabled','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','message','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','Bearer\x20','4.0','headers','lastIndexOf','enduserId','contacts?$select=telephone1','calleridnum','telephone1',']\x20Enduser\x20created!','forEach','type','string','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','phonecall','phonecalls','callDirection','queue','Fields','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','password','clientSecret','then','access_token','catch','error'];(function(_0x4018c3,_0x120ff6){var _0x2b8e19=function(_0x400fea){while(--_0x400fea){_0x4018c3['push'](_0x4018c3['shift']());}};_0x2b8e19(++_0x120ff6);}(_0x2a4e,0x1df));var _0xe2a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a4e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe2a4('0x0'));var BPromise=require('bluebird');var rp=require(_0xe2a4('0x1'));var util=require(_0xe2a4('0x2'));var intUtil=require(_0xe2a4('0x3'));var md5=require(_0xe2a4('0x4'));var Redis=require(_0xe2a4('0x5'));var logger=require(_0xe2a4('0x6'))(_0xe2a4('0x7'));var config=require(_0xe2a4('0x8'));config[_0xe2a4('0x9')]=_[_0xe2a4('0xa')](config[_0xe2a4('0x9')],{'host':_0xe2a4('0xb'),'port':0x18eb});var io=require(_0xe2a4('0xc'))(new Redis(config[_0xe2a4('0x9')]));function getAuthToken(_0x185b0e,_0x10773f,_0x306f07){var _0x1b9ee5={'method':_0xe2a4('0xd'),'uri':_0x10773f,'form':{'client_id':_0x185b0e['clientId'],'resource':_0x185b0e[_0xe2a4('0xe')],'username':_0x185b0e['username'],'password':_0x185b0e[_0xe2a4('0xf')],'grant_type':'password','client_secret':_0x185b0e[_0xe2a4('0x10')]},'json':!![]};return rp(_0x1b9ee5)[_0xe2a4('0x11')](function(_0x245db7){return _0x245db7[_0xe2a4('0x12')];})[_0xe2a4('0x13')](function(_0xcbd876){logger[_0xe2a4('0x14')]('['+[_0x306f07[_0xe2a4('0x15')]()]+_0xe2a4('0x16'));return _0xcbd876['message'];});}function getUser(_0x3f4c67,_0xc591fa,_0x39cd1a,_0x366b50,_0x264079,_0x464986){return new BPromise(function(_0x48dae4,_0x45a5d8){return getAuthToken(_0xc591fa,_0x366b50,_0x464986)[_0xe2a4('0x11')](function(_0x2a700d){var _0x1dd64e={'method':_0xe2a4('0x17'),'uri':_0x264079+_0xe2a4('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x2a700d,'OData-Version':'4.0'},'json':!![]};return rp(_0x1dd64e);})['then'](function(_0x491c9e){var _0x3b8087=_0x491c9e[_0xe2a4('0x19')];var _0x5517b1=![];var _0x5579b8=null;if(!_[_0xe2a4('0x1a')](_0x39cd1a)){if(intUtil['validateEmail'](_0x39cd1a['email'])){_0x3f4c67[_0xe2a4('0x1b')]=_0x39cd1a[_0xe2a4('0x1c')];for(_0x5579b8=0x0;_0x5579b8<_0x3b8087[_0xe2a4('0x1d')];_0x5579b8++){if(_0x3b8087[_0x5579b8][_0xe2a4('0x1e')]===_0x39cd1a[_0xe2a4('0x1c')]&&!_0x3b8087[_0x5579b8][_0xe2a4('0x1f')]){_0x5517b1=!![];logger['info']('['+[_0x464986['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x3b8087[_0x5579b8]['systemuserid']+'!');_0x3f4c67[_0xe2a4('0x20')]=_0x3b8087[_0x5579b8][_0xe2a4('0x21')];}}}}if(!_0x5517b1){logger[_0xe2a4('0x22')]('['+[_0x464986[_0xe2a4('0x15')]()]+_0xe2a4('0x23'));_0x3f4c67['userEmail']=_0xc591fa[_0xe2a4('0x24')];for(_0x5579b8=0x0;_0x5579b8<_0x3b8087[_0xe2a4('0x1d')];_0x5579b8++){if(_0x3b8087[_0x5579b8][_0xe2a4('0x1e')]===_0xc591fa[_0xe2a4('0x24')]){_0x3f4c67[_0xe2a4('0x20')]=_0x3b8087[_0x5579b8][_0xe2a4('0x21')];}}}_0x48dae4(_0x3f4c67);})['catch'](function(_0x58f3bc){_0x45a5d8(_0x58f3bc[_0xe2a4('0x25')]);});});}function createEndUser(_0x2898ff,_0x4f5603,_0x518c26,_0x4cc88d,_0x1b8848,_0xc733cc){return new BPromise(function(_0x3d7272,_0x32681b){return getAuthToken(_0x4f5603,_0x518c26,_0xc733cc)[_0xe2a4('0x11')](function(_0x5b921b){var _0x327871=_0xc733cc[_0xe2a4('0x26')]()===_0xe2a4('0x27')?_0x1b8848[_0xe2a4('0x28')]:_0x1b8848['calleridnum'];var _0x44bc3d={'method':_0xe2a4('0xd'),'uri':_0x4cc88d+_0xe2a4('0x29'),'body':{'telephone1':_0x327871,'fullname':_0x327871,'firstname':_0x327871,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe2a4('0x2a')+_0x2898ff['userId']+')'},'headers':{'Authorization':_0xe2a4('0x2b')+_0x5b921b,'OData-Version':_0xe2a4('0x2c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x44bc3d);})['then'](function(_0x403309){var _0x1853e0=_0x403309[_0xe2a4('0x2d')]['odata-entityid'];var _0x40dc72=_0x1853e0['substring'](_0x1853e0[_0xe2a4('0x2e')]('(')+0x1,_0x1853e0['lastIndexOf'](')'));_0x2898ff[_0xe2a4('0x2f')]=_0x40dc72;_0x3d7272(_0x2898ff);})[_0xe2a4('0x13')](function(_0x27c96d){_0x32681b(_0x27c96d[_0xe2a4('0x25')]);});});}function getEndUser(_0x584975,_0x94e4e4,_0x594a71,_0xe3ba0,_0x4f397e,_0x1fca6a){return new BPromise(function(_0x2e0202,_0x64235){return getAuthToken(_0x94e4e4,_0x594a71,_0x1fca6a)[_0xe2a4('0x11')](function(_0x5788bc){var _0x13ddb3={'method':'GET','uri':_0xe3ba0+_0xe2a4('0x30'),'headers':{'Authorization':_0xe2a4('0x2b')+_0x5788bc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x13ddb3);})[_0xe2a4('0x11')](function(_0x19353c){var _0x27163a=null;if(_0x19353c){var _0x521b7f=_0x19353c['value'];var _0x3cb56a=![];for(_0x27163a=0x0;_0x27163a<_0x521b7f['length'];_0x27163a++){var _0x13d677=_0x1fca6a['toLowerCase']()===_0xe2a4('0x27')?_0x4f397e[_0xe2a4('0x28')]:_0x4f397e[_0xe2a4('0x31')];if(_0x521b7f[_0x27163a][_0xe2a4('0x32')]===_0x13d677){_0x3cb56a=!![];_0x584975[_0xe2a4('0x2f')]=_0x521b7f[_0x27163a]['contactid'];}}if(_0x3cb56a){_0x2e0202(_0x584975);}else{return createEndUser(_0x584975,_0x94e4e4,_0x594a71,_0xe3ba0,_0x4f397e,_0x1fca6a)[_0xe2a4('0x11')](function(_0x152e9e){logger['info']('['+[_0x1fca6a[_0xe2a4('0x15')]()]+_0xe2a4('0x33'),_0x152e9e[_0xe2a4('0x2f')]);_0x2e0202(_0x152e9e);});}}else{return createEndUser(_0x584975,_0x94e4e4,_0x594a71,_0xe3ba0,_0x4f397e,_0x1fca6a)[_0xe2a4('0x11')](function(_0xba8bde){logger[_0xe2a4('0x22')]('['+[_0x1fca6a[_0xe2a4('0x15')]()]+']\x20Enduser\x20Created!',_0xba8bde[_0xe2a4('0x2f')]);_0x2e0202(_0xba8bde);});}});});}function getCustomFields(_0x1009e7,_0x59ac94,_0x45ab5a){var _0x877921={};if(_0x1009e7[_0xe2a4('0x1d')]>0x0){_[_0xe2a4('0x34')](_0x1009e7,function(_0x4c232e){if(_0x4c232e[_0xe2a4('0x35')]===_0xe2a4('0x36')&&_0x4c232e['nameField']&&!_0x4c232e[_0xe2a4('0x37')]){var _0x176914=_0x4c232e[_0xe2a4('0x38')][_0xe2a4('0x26')]();var _0x35fcb3=_0x176914[_0xe2a4('0x39')](0x0,_0x176914['indexOf']('_'));var _0x241693=_0x176914['substring'](_0x176914[_0xe2a4('0x3a')]('_')+0x1);if(_0x35fcb3===_0x45ab5a){_0x877921[_0x241693]=_0x4c232e[_0xe2a4('0x3b')];}}});}return _0x877921;}function getTicket(_0x83e34,_0x3f49ed,_0x117da8,_0x5bdc8e,_0x104542,_0x28c6ba,_0x305d18){return new BPromise(function(_0x194940,_0x4b37d4){var _0x130e76;return getAuthToken(_0x3f49ed,_0x117da8,_0x305d18)['then'](function(_0x2ea991){if(_0x28c6ba[_0xe2a4('0x3c')]===_0xe2a4('0x3d')){_0x130e76={'method':'POST','uri':_0x5bdc8e+_0xe2a4('0x3e'),'body':Object[_0xe2a4('0x3f')]({},{'title':intUtil[_0xe2a4('0x40')](_0x28c6ba[_0xe2a4('0x41')],_0x104542,'\x20'),'description':intUtil[_0xe2a4('0x40')](_0x28c6ba['Descriptions'],_0x104542,'\x0a'),'customerid_contact@odata.bind':_0xe2a4('0x42')+_0x83e34[_0xe2a4('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x83e34[_0xe2a4('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x28c6ba['Fields'],_0x104542,_0x28c6ba[_0xe2a4('0x3c')])),'headers':{'Authorization':_0xe2a4('0x2b')+_0x2ea991,'OData-Version':_0xe2a4('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x28c6ba['ticketType']===_0xe2a4('0x43')){_0x130e76={'method':'POST','uri':_0x5bdc8e+_0xe2a4('0x44'),'body':Object[_0xe2a4('0x3f')]({},{'subject':intUtil[_0xe2a4('0x40')](_0x28c6ba['Subjects'],_0x104542,'\x20'),'phonenumber':String(_0x104542['calleridnum']),'description':intUtil['getString'](_0x28c6ba['Descriptions'],_0x104542,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe2a4('0x42')+_0x83e34[_0xe2a4('0x2f')]+')','ownerid@odata.bind':_0xe2a4('0x2a')+_0x83e34[_0xe2a4('0x20')]+')','directioncode':_0x83e34[_0xe2a4('0x45')]===_0xe2a4('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe2a4('0x2a')+_0x83e34[_0xe2a4('0x20')]+')','participationtypemask':_0x83e34[_0xe2a4('0x45')]===_0xe2a4('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xe2a4('0x42')+_0x83e34[_0xe2a4('0x2f')]+')','participationtypemask':_0x83e34['callDirection']===_0xe2a4('0x46')?0x1:0x2}]},getCustomFields(_0x28c6ba[_0xe2a4('0x47')],_0x104542,_0x28c6ba[_0xe2a4('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x2ea991,'OData-Version':_0xe2a4('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x130e76);})['then'](function(_0x4a0454){var _0x459973=_0x4a0454[_0xe2a4('0x2d')][_0xe2a4('0x48')];var _0x2991f7=_0x459973['substring'](_0x459973[_0xe2a4('0x2e')]('(')+0x1,_0x459973[_0xe2a4('0x2e')](')'));_0x83e34['ticketId']=_0x2991f7;_0x194940(_0x83e34);})['catch'](function(_0x313c93){_0x4b37d4(_0x313c93['message']);});});}function emit(_0x12ce35,_0x316c15,_0x655043,_0x174ea1){var _0x25baca={'uri':util[_0xe2a4('0x49')](_0xe2a4('0x4a'),_0x12ce35,_0x655043,_0x174ea1)};io['to'](util[_0xe2a4('0x49')](_0xe2a4('0x4b'),_0x316c15))[_0xe2a4('0x4c')](_0xe2a4('0x4d'),_0x25baca);}exports['cs']=function(_0x2f0eca,_0x1d0f53,_0x27be77,_0x1fbf8f,_0x4d99ac,_0x157b95,_0x33747b,_0x4c9e3e){var _0x37164d={};_0x157b95['remoteUri']=intUtil[_0xe2a4('0x4e')](_0x157b95[_0xe2a4('0xe')]);_0x157b95[_0xe2a4('0x4f')]=intUtil['stripTrailingSlash'](_0x157b95['serverUrl']);_0x37164d[_0xe2a4('0x45')]=_0x4c9e3e===_0xe2a4('0x46')||_0x4c9e3e===_0xe2a4('0x50')?'queue':_0xe2a4('0x27');var _0xac162a=util['format'](_0xe2a4('0x51'),_0x157b95[_0xe2a4('0xe')]);var _0x54f29=util[_0xe2a4('0x49')](_0xe2a4('0x52'),_0x157b95['tenantId']);var _0x53c9b0=util[_0xe2a4('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x157b95['serverUrl'],_0x1d0f53[_0xe2a4('0x53')],md5(_0x1d0f53[_0xe2a4('0x53')]));if(_0x4d99ac&&_0x4d99ac['monitor_format']){logger['info'](_0xe2a4('0x54'),'Recording\x20is\x20enabled!');_0x1d0f53[_0xe2a4('0x55')]=_0x53c9b0;}else if(_0x33747b&&_0x33747b[_0xe2a4('0x56')]&&_0x33747b[_0xe2a4('0x56')]!=='none'){logger[_0xe2a4('0x22')](_0xe2a4('0x57'),_0xe2a4('0x58'));_0x1d0f53[_0xe2a4('0x55')]=_0x53c9b0;}else{_0x1d0f53[_0xe2a4('0x55')]='';}return getUser(_0x37164d,_0x157b95,_0x1fbf8f,_0x54f29,_0xac162a,_0x4c9e3e)[_0xe2a4('0x11')](function(_0x3da907){logger['info']('['+_0x4c9e3e[_0xe2a4('0x15')]()+_0xe2a4('0x59'),_0x3da907[_0xe2a4('0x20')]);logger[_0xe2a4('0x22')]('['+_0x4c9e3e[_0xe2a4('0x15')]()+_0xe2a4('0x5a'),_0x3da907['userEmail']);return getEndUser(_0x3da907,_0x157b95,_0x54f29,_0xac162a,_0x1d0f53,_0x4c9e3e);})[_0xe2a4('0x11')](function(_0x18095d){logger[_0xe2a4('0x22')]('['+_0x4c9e3e[_0xe2a4('0x15')]()+_0xe2a4('0x5b'),_0x18095d[_0xe2a4('0x2f')]);logger[_0xe2a4('0x22')]('['+_0x4c9e3e['toUpperCase']()+_0xe2a4('0x5c'),_0x1d0f53['calleridnum']);return getTicket(_0x18095d,_0x157b95,_0x54f29,_0xac162a,_0x1d0f53,_0x27be77,_0x4c9e3e);})[_0xe2a4('0x11')](function(_0x26d9ec){logger[_0xe2a4('0x22')](util['format']('['+_0x4c9e3e[_0xe2a4('0x15')]()+_0xe2a4('0x5d'),_0x27be77['ticketType'],_0x26d9ec[_0xe2a4('0x5e')]));logger[_0xe2a4('0x22')](util[_0xe2a4('0x49')]('['+_0x4c9e3e[_0xe2a4('0x15')]()+_0xe2a4('0x5f'),_0x4c9e3e));if(_0x4c9e3e!==_0xe2a4('0x50')){logger[_0xe2a4('0x22')]('['+_0x4c9e3e[_0xe2a4('0x15')]()+']',_0xe2a4('0x60'));emit(_0x157b95[_0xe2a4('0xe')],_0x1fbf8f[_0xe2a4('0x61')],_0x27be77['ticketType'],_0x26d9ec['ticketId']);}})['catch'](function(_0x44a4a5){logger[_0xe2a4('0x14')]('['+_0x4c9e3e['toUpperCase']()+_0xe2a4('0x62'),util[_0xe2a4('0x63')](_0x44a4a5,{'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 7851b42..9d07b9a 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 _0x6867=['defaults','GET','map','forEach','string','nameField','customField','toLowerCase','content','type','push','idField','variable','variableName','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','trigger:browser:url','catch','abandoned','[ABANDONED]','The\x20User\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','Fields','custom_fields','mapValues','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','debug','stringify'];(function(_0x31485b,_0xb96e3b){var _0x5f4c31=function(_0x26208f){while(--_0x26208f){_0x31485b['push'](_0x31485b['shift']());}};_0x5f4c31(++_0xb96e3b);}(_0x6867,0x1d9));var _0x7686=function(_0x408010,_0x5230b9){_0x408010=_0x408010-0x0;var _0x1aab78=_0x6867[_0x408010];return _0x1aab78;};'use strict';var _=require(_0x7686('0x0'));var rp=require(_0x7686('0x1'));var md5=require('md5');var util=require(_0x7686('0x2'));var Redis=require(_0x7686('0x3'));var intUtil=require(_0x7686('0x4'));var config=require(_0x7686('0x5'));var logger=require('../../../../config/logger')(_0x7686('0x6'));config[_0x7686('0x7')]=_['defaults'](config[_0x7686('0x7')],{'host':_0x7686('0x8'),'port':0x18eb});var io=require(_0x7686('0x9'))(new Redis(config[_0x7686('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x3aeb5f,_0x394883,_0xbc8ecd){io['to'](_0x3aeb5f)[_0x7686('0xa')](_0x394883,_0xbc8ecd);}function getTicket(_0x5703a6,_0x4afc24,_0x2885b7,_0x432c0b,_0x1ef1a8){logger[_0x7686('0xb')]('Creating\x20new\x20ticket...');var _0x40e175=_[_0x7686('0xc')]({'responder_id':_0x4afc24['id'],'requester_id':_0x2885b7['id'],'name':util[_0x7686('0xd')](_0x7686('0xe'),_0x1ef1a8[_0x7686('0xf')]),'phone':_0x1ef1a8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7686('0x10')](_0x432c0b['Subjects'],_0x1ef1a8,'\x20'),'description':intUtil['getString'](_0x432c0b[_0x7686('0x11')],_0x1ef1a8,_0x7686('0x12')),'tags':getTags(_0x432c0b[_0x7686('0x13')],'name')},getCustomFields(_0x432c0b[_0x7686('0x14')],_0x1ef1a8));_0x40e175[_0x7686('0x15')]=_[_0x7686('0x16')](_['keyBy'](_0x40e175['custom_fields'],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x5703a6[_0x7686('0x17')]),'method':_0x7686('0x18'),'body':_0x40e175})[_0x7686('0x19')](function(_0x591a95){logger['info']('Ticket\x20created!');return _0x591a95;});}function getUser(_0x2286d5,_0x5c7338){if(intUtil[_0x7686('0x1a')](_0x5c7338)){return request({'uri':util[_0x7686('0xd')](_0x7686('0x1b'),_0x2286d5[_0x7686('0x17')]),'qs':{'email':_0x5c7338}})[_0x7686('0x19')](function(_0x2653e3){if(_0x2653e3[_0x7686('0x1c')]){logger['info']('Agent\x20found!');return _[_0x7686('0x1d')](_0x2653e3,function(_0x3e6e1f){return _0x3e6e1f['contact'][_0x7686('0x1e')]===_0x5c7338;});}else{logger[_0x7686('0xb')](_0x7686('0x1f'));return request({'uri':util[_0x7686('0xd')](_0x7686('0x20'),_0x2286d5[_0x7686('0x17')])})[_0x7686('0x19')](function(_0x2d266e){logger[_0x7686('0xb')](_0x7686('0x21'));return _0x2d266e;});}});}else{logger[_0x7686('0xb')](_0x7686('0x22'));return request({'uri':util[_0x7686('0xd')]('%s/api/v2/agents/me',_0x2286d5['remoteUri'])})[_0x7686('0x19')](function(_0x3b1f41){logger[_0x7686('0xb')]('Admin\x20account\x20selected.');return _0x3b1f41;});}}function getEndUser(_0x2dcdb9,_0x246f50,_0x4870c9){logger[_0x7686('0xb')](_0x7686('0x23'),_0x4870c9);return request({'uri':util[_0x7686('0xd')]('%s/api/v2/contacts',_0x2dcdb9[_0x7686('0x17')]),'qs':{'phone':_0x4870c9}})['then'](function(_0x312d7a){if(_0x312d7a['length']){logger[_0x7686('0xb')]('Enduser\x20found!');return _[_0x7686('0x1d')](_0x312d7a,{'phone':_0x4870c9});}else{logger[_0x7686('0xb')](_0x7686('0x24'));return request({'uri':util['format'](_0x7686('0x25'),_0x2dcdb9[_0x7686('0x17')]),'method':_0x7686('0x18'),'body':{'name':_0x246f50,'phone':_0x4870c9}})[_0x7686('0x19')](function(_0x1204c1){logger[_0x7686('0xb')](_0x7686('0x26'));return _0x1204c1;});}});}function getAuth(_0x455998){return util['format']('Basic\x20%s',new Buffer(_0x455998[_0x7686('0x27')]+':X')[_0x7686('0x28')]('base64'));}function request(_0x55ff6c){logger[_0x7686('0x29')]('[HTTP]',JSON[_0x7686('0x2a')](_0x55ff6c));return rp(_[_0x7686('0x2b')](_0x55ff6c,{'method':_0x7686('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0xd535ad,_0x2964d3){var _0x58964b=[];if(_0xd535ad&&_0xd535ad[_0x7686('0x1c')]>0x0){_0x58964b=_[_0x7686('0x2d')](_0xd535ad,_0x2964d3);}return _0x58964b;}function getCustomFields(_0x228c0e,_0x114d5b){var _0x35f51a=[];var _0x313c1c={'custom_fields':[]};if(_0x228c0e[_0x7686('0x1c')]>0x0){_[_0x7686('0x2e')](_0x228c0e,function(_0x5355e9){if(_0x5355e9['type']===_0x7686('0x2f')&&_0x5355e9[_0x7686('0x30')]&&!_0x5355e9[_0x7686('0x31')]){_0x313c1c[_0x5355e9[_0x7686('0x30')][_0x7686('0x32')]()]=_0x5355e9[_0x7686('0x33')][_0x7686('0x28')]();}else if(_0x5355e9[_0x7686('0x34')]===_0x7686('0x2f')&&_0x5355e9['idField']&&_0x5355e9[_0x7686('0x31')]){_0x313c1c[_0x7686('0x15')][_0x7686('0x35')]({'id':_0x5355e9[_0x7686('0x36')],'value':_0x5355e9['content'][_0x7686('0x28')]()});}else if(_0x5355e9[_0x7686('0x34')]===_0x7686('0x37')&&_0x5355e9[_0x7686('0x38')]&&_0x5355e9['idField']&&_0x5355e9['customField']){_0x114d5b[_0x5355e9[_0x7686('0x38')]]&&_0x313c1c['custom_fields']['push']({'id':_0x5355e9[_0x7686('0x36')],'value':_0x114d5b[_0x5355e9['variableName']][_0x7686('0x28')]()});}else if(_0x5355e9[_0x7686('0x34')]==='customVariable'&&_0x5355e9['Variable']&&_0x5355e9['Variable'][_0x7686('0x39')]&&_0x5355e9['idField']&&_0x5355e9['customField']){_0x114d5b[_0x5355e9['Variable'][_0x7686('0x39')][_0x7686('0x32')]()]&&_0x313c1c[_0x7686('0x15')][_0x7686('0x35')]({'id':_0x5355e9['idField'],'value':_0x114d5b[_0x5355e9['Variable'][_0x7686('0x39')][_0x7686('0x32')]()][_0x7686('0x28')]()});}});}return _0x313c1c;}exports[_0x7686('0x3a')]=function(_0xe5510c,_0x30866,_0x4ce836,_0x343297,_0x43289a,_0x5e19ca){var _0x1082ba,_0x2c7506;_0x5e19ca[_0x7686('0x17')]=intUtil[_0x7686('0x3b')](_0x5e19ca[_0x7686('0x17')]);_0x5e19ca[_0x7686('0x3c')]=intUtil[_0x7686('0x3b')](_0x5e19ca[_0x7686('0x3c')]);if(_0x43289a&&_0x43289a[_0x7686('0x3d')]){logger[_0x7686('0xb')](_0x7686('0x3e'),'Recording\x20is\x20enabled!');_0x30866['recordingURL']=util[_0x7686('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e19ca[_0x7686('0x3c')],_0x30866['uniqueid'],md5(_0x30866[_0x7686('0x3f')]));}else{_0x30866[_0x7686('0x40')]='';}headers[_0x7686('0x41')]=getAuth(_0x5e19ca);return getUser(_0x5e19ca,_0x343297[_0x7686('0x1e')])[_0x7686('0x19')](function(_0x55a942){_0x1082ba=_0x55a942;logger[_0x7686('0xb')]('The\x20User\x20ID\x20is:',_0x1082ba['id']);return getEndUser(_0x5e19ca,_0x30866[_0x7686('0xf')],_0x30866[_0x7686('0x42')]);})['then'](function(_0x4a845a){_0x2c7506=_0x4a845a;logger[_0x7686('0xb')](_0x7686('0x43'),_0x2c7506['id']);return getTicket(_0x5e19ca,_0x1082ba,_0x2c7506,_0x4ce836,_0x30866);})['then'](function(_0x4fd007){if(_0x4fd007&&_0x4fd007['id']){logger[_0x7686('0xb')](_0x7686('0x44'));logger[_0x7686('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4fd007['id']);logger[_0x7686('0xb')](_0x7686('0x3e'),_0x7686('0x45'));emit(util[_0x7686('0xd')]('user:%s',_0x343297[_0x7686('0x39')]),'trigger:browser:url',{'uri':util[_0x7686('0xd')](_0x7686('0x46'),_0x5e19ca['remoteUri'],_0x4fd007['id'])});}})['catch'](function(_0x18a9bc){logger[_0x7686('0x47')](_0x7686('0x3e'),JSON[_0x7686('0x2a')](_0x18a9bc));});};exports[_0x7686('0x48')]=function(_0x3e443f,_0x429d1a,_0x28d528,_0x55522d,_0x22f187,_0x8f9e19,_0x4448ff){var _0x518009,_0x1e76c2;_0x8f9e19[_0x7686('0x17')]=intUtil[_0x7686('0x3b')](_0x8f9e19[_0x7686('0x17')]);_0x8f9e19[_0x7686('0x3c')]=intUtil['stripTrailingSlash'](_0x8f9e19['serverUrl']);if(_0x4448ff&&_0x4448ff[_0x7686('0x49')]&&_0x4448ff[_0x7686('0x49')]!=='none'){logger[_0x7686('0xb')]('[OUTBOUND]',_0x7686('0x4a'));_0x429d1a[_0x7686('0x40')]=util[_0x7686('0xd')](_0x7686('0x4b'),_0x8f9e19[_0x7686('0x3c')],_0x429d1a['uniqueid'],md5(_0x429d1a[_0x7686('0x3f')]));}headers['Authorization']=getAuth(_0x8f9e19);return getUser(_0x8f9e19,_0x55522d[_0x7686('0x1e')])['then'](function(_0x530cc8){_0x518009=_0x530cc8;logger[_0x7686('0xb')]('The\x20User\x20ID\x20is:',_0x518009['id']);return getEndUser(_0x8f9e19,_0x429d1a[_0x7686('0x4c')],_0x429d1a[_0x7686('0x4d')]);})[_0x7686('0x19')](function(_0x56f640){_0x1e76c2=_0x56f640;logger[_0x7686('0xb')](_0x7686('0x43'),_0x1e76c2['id']);return getTicket(_0x8f9e19,_0x518009,_0x1e76c2,_0x28d528,_0x429d1a);})[_0x7686('0x19')](function(_0x526b4a){if(_0x526b4a&&_0x526b4a['id']){logger[_0x7686('0xb')](_0x7686('0x44'));logger[_0x7686('0xb')](_0x7686('0x4e'),_0x526b4a['id']);logger[_0x7686('0xb')](_0x7686('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7686('0xd')](_0x7686('0x50'),_0x55522d[_0x7686('0x39')]),_0x7686('0x51'),{'uri':util['format'](_0x7686('0x46'),_0x8f9e19[_0x7686('0x17')],_0x526b4a['id'])});}})[_0x7686('0x52')](function(_0x13b851){logger[_0x7686('0x47')](_0x7686('0x4f'),JSON[_0x7686('0x2a')](_0x13b851));});};exports[_0x7686('0x53')]=function(_0x1f027a,_0x52e7e9,_0x22b1fd,_0x187f68,_0x1d7526,_0x596f17){var _0x42710a,_0x4484a8;_0x596f17[_0x7686('0x17')]=intUtil[_0x7686('0x3b')](_0x596f17[_0x7686('0x17')]);_0x596f17[_0x7686('0x3c')]=intUtil[_0x7686('0x3b')](_0x596f17[_0x7686('0x3c')]);if(_0x1d7526&&_0x1d7526[_0x7686('0x3d')]){logger[_0x7686('0xb')](_0x7686('0x54'),'Recording\x20is\x20enabled!');_0x52e7e9['recordingURL']=util[_0x7686('0xd')](_0x7686('0x4b'),_0x596f17[_0x7686('0x3c')],_0x52e7e9[_0x7686('0x3f')],md5(_0x52e7e9[_0x7686('0x3f')]));}else{_0x52e7e9['recordingURL']='';}headers['Authorization']=getAuth(_0x596f17);return getUser(_0x596f17,'')[_0x7686('0x19')](function(_0xc2440b){_0x42710a=_0xc2440b;logger[_0x7686('0xb')](_0x7686('0x55'),_0x42710a['id']);return getEndUser(_0x596f17,_0x52e7e9[_0x7686('0xf')],_0x52e7e9[_0x7686('0x42')]);})[_0x7686('0x19')](function(_0x481d69){_0x4484a8=_0x481d69;logger[_0x7686('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4484a8['id']);return getTicket(_0x596f17,_0x42710a,_0x4484a8,_0x22b1fd,_0x52e7e9);})[_0x7686('0x19')](function(_0xf9ed41){if(_0xf9ed41){logger[_0x7686('0xb')](_0x7686('0x44'));logger[_0x7686('0xb')]('The\x20Ticket\x20ID\x20is:',_0xf9ed41['id']);}})['catch'](function(_0x1d4a77){logger['error']('[ABANDONED]',JSON['stringify'](_0x1d4a77));});}; \ No newline at end of file +var _0x8c74=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%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.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','nameField','customField','toLowerCase','content','type','idField','push','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[ABANDONED]','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','then','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x8c74,0x149));var _0x48c7=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x8c74[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0x48c7('0x0'));var rp=require(_0x48c7('0x1'));var md5=require(_0x48c7('0x2'));var util=require(_0x48c7('0x3'));var Redis=require('ioredis');var intUtil=require(_0x48c7('0x4'));var config=require(_0x48c7('0x5'));var logger=require(_0x48c7('0x6'))('freshdesk');config[_0x48c7('0x7')]=_['defaults'](config[_0x48c7('0x7')],{'host':_0x48c7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x48c7('0x7')]));var headers={'Content-Type':_0x48c7('0x9'),'Accept':'application/json'};function emit(_0x10ec1e,_0x11ff78,_0x40c016){io['to'](_0x10ec1e)[_0x48c7('0xa')](_0x11ff78,_0x40c016);}function getTicket(_0x16b385,_0x2c4a1d,_0x509aa6,_0x49c5d0,_0x232cd8){logger[_0x48c7('0xb')](_0x48c7('0xc'));var _0x3328be=_['merge']({'responder_id':_0x2c4a1d['id'],'requester_id':_0x509aa6['id'],'name':util[_0x48c7('0xd')](_0x48c7('0xe'),_0x232cd8[_0x48c7('0xf')]),'phone':_0x232cd8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x48c7('0x10')](_0x49c5d0[_0x48c7('0x11')],_0x232cd8,'\x20'),'description':intUtil[_0x48c7('0x10')](_0x49c5d0[_0x48c7('0x12')],_0x232cd8,_0x48c7('0x13')),'tags':getTags(_0x49c5d0[_0x48c7('0x14')],_0x48c7('0x15'))},getCustomFields(_0x49c5d0[_0x48c7('0x16')],_0x232cd8));_0x3328be[_0x48c7('0x17')]=_[_0x48c7('0x18')](_[_0x48c7('0x19')](_0x3328be['custom_fields'],'id'),'value');return request({'uri':util[_0x48c7('0xd')](_0x48c7('0x1a'),_0x16b385['remoteUri']),'method':'POST','body':_0x3328be})[_0x48c7('0x1b')](function(_0x36ba2e){logger[_0x48c7('0xb')]('Ticket\x20created!');return _0x36ba2e;});}function getUser(_0x3d29b9,_0x22d8c8){if(intUtil[_0x48c7('0x1c')](_0x22d8c8)){return request({'uri':util[_0x48c7('0xd')](_0x48c7('0x1d'),_0x3d29b9[_0x48c7('0x1e')]),'qs':{'email':_0x22d8c8}})[_0x48c7('0x1b')](function(_0x1da3f7){if(_0x1da3f7[_0x48c7('0x1f')]){logger[_0x48c7('0xb')](_0x48c7('0x20'));return _[_0x48c7('0x21')](_0x1da3f7,function(_0x545f57){return _0x545f57[_0x48c7('0x22')]['email']===_0x22d8c8;});}else{logger[_0x48c7('0xb')](_0x48c7('0x23'));return request({'uri':util[_0x48c7('0xd')](_0x48c7('0x24'),_0x3d29b9[_0x48c7('0x1e')])})[_0x48c7('0x1b')](function(_0x1613e1){logger[_0x48c7('0xb')]('Admin\x20account\x20selected.');return _0x1613e1;});}});}else{logger[_0x48c7('0xb')](_0x48c7('0x25'));return request({'uri':util[_0x48c7('0xd')](_0x48c7('0x24'),_0x3d29b9[_0x48c7('0x1e')])})[_0x48c7('0x1b')](function(_0x4d677e){logger['info'](_0x48c7('0x26'));return _0x4d677e;});}}function getEndUser(_0x273576,_0x3d594c,_0xd1b957){logger[_0x48c7('0xb')](_0x48c7('0x27'),_0xd1b957);return request({'uri':util[_0x48c7('0xd')](_0x48c7('0x28'),_0x273576[_0x48c7('0x1e')]),'qs':{'phone':_0xd1b957}})[_0x48c7('0x1b')](function(_0x171b6f){if(_0x171b6f['length']){logger[_0x48c7('0xb')](_0x48c7('0x29'));return _[_0x48c7('0x21')](_0x171b6f,{'phone':_0xd1b957});}else{logger[_0x48c7('0xb')](_0x48c7('0x2a'));return request({'uri':util[_0x48c7('0xd')]('%s/api/v2/contacts',_0x273576[_0x48c7('0x1e')]),'method':'POST','body':{'name':_0x3d594c,'phone':_0xd1b957}})[_0x48c7('0x1b')](function(_0x51def0){logger[_0x48c7('0xb')](_0x48c7('0x2b'));return _0x51def0;});}});}function getAuth(_0x25b9a9){return util[_0x48c7('0xd')](_0x48c7('0x2c'),new Buffer(_0x25b9a9['apiKey']+':X')[_0x48c7('0x2d')](_0x48c7('0x2e')));}function request(_0x4ffea5){logger[_0x48c7('0x2f')](_0x48c7('0x30'),JSON[_0x48c7('0x31')](_0x4ffea5));return rp(_[_0x48c7('0x32')](_0x4ffea5,{'method':_0x48c7('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x454e17,_0x391ae9){var _0x447c48=[];if(_0x454e17&&_0x454e17[_0x48c7('0x1f')]>0x0){_0x447c48=_[_0x48c7('0x34')](_0x454e17,_0x391ae9);}return _0x447c48;}function getCustomFields(_0x5780e3,_0x4f2797){var _0x462215=[];var _0x485308={'custom_fields':[]};if(_0x5780e3[_0x48c7('0x1f')]>0x0){_[_0x48c7('0x35')](_0x5780e3,function(_0x5eff23){if(_0x5eff23['type']==='string'&&_0x5eff23[_0x48c7('0x36')]&&!_0x5eff23[_0x48c7('0x37')]){_0x485308[_0x5eff23['nameField'][_0x48c7('0x38')]()]=_0x5eff23[_0x48c7('0x39')]['toString']();}else if(_0x5eff23[_0x48c7('0x3a')]==='string'&&_0x5eff23[_0x48c7('0x3b')]&&_0x5eff23[_0x48c7('0x37')]){_0x485308[_0x48c7('0x17')][_0x48c7('0x3c')]({'id':_0x5eff23[_0x48c7('0x3b')],'value':_0x5eff23[_0x48c7('0x39')][_0x48c7('0x2d')]()});}else if(_0x5eff23[_0x48c7('0x3a')]==='variable'&&_0x5eff23[_0x48c7('0x3d')]&&_0x5eff23[_0x48c7('0x3b')]&&_0x5eff23['customField']){_0x4f2797[_0x5eff23[_0x48c7('0x3d')]]&&_0x485308[_0x48c7('0x17')][_0x48c7('0x3c')]({'id':_0x5eff23[_0x48c7('0x3b')],'value':_0x4f2797[_0x5eff23[_0x48c7('0x3d')]][_0x48c7('0x2d')]()});}else if(_0x5eff23[_0x48c7('0x3a')]===_0x48c7('0x3e')&&_0x5eff23[_0x48c7('0x3f')]&&_0x5eff23[_0x48c7('0x3f')][_0x48c7('0x15')]&&_0x5eff23[_0x48c7('0x3b')]&&_0x5eff23[_0x48c7('0x37')]){_0x4f2797[_0x5eff23[_0x48c7('0x3f')][_0x48c7('0x15')][_0x48c7('0x38')]()]&&_0x485308[_0x48c7('0x17')][_0x48c7('0x3c')]({'id':_0x5eff23[_0x48c7('0x3b')],'value':_0x4f2797[_0x5eff23[_0x48c7('0x3f')][_0x48c7('0x15')][_0x48c7('0x38')]()][_0x48c7('0x2d')]()});}});}return _0x485308;}exports['queue']=function(_0x264f70,_0x2eec7e,_0x11bd34,_0xe6ed7c,_0x5e4b37,_0x4c1654){var _0x21f04b,_0x3b38f7;_0x4c1654[_0x48c7('0x1e')]=intUtil[_0x48c7('0x40')](_0x4c1654[_0x48c7('0x1e')]);_0x4c1654['serverUrl']=intUtil[_0x48c7('0x40')](_0x4c1654[_0x48c7('0x41')]);if(_0x5e4b37&&_0x5e4b37[_0x48c7('0x42')]){logger[_0x48c7('0xb')](_0x48c7('0x43'),_0x48c7('0x44'));_0x2eec7e[_0x48c7('0x45')]=util[_0x48c7('0xd')](_0x48c7('0x46'),_0x4c1654['serverUrl'],_0x2eec7e[_0x48c7('0x47')],md5(_0x2eec7e[_0x48c7('0x47')]));}else{_0x2eec7e[_0x48c7('0x45')]='';}headers[_0x48c7('0x48')]=getAuth(_0x4c1654);return getUser(_0x4c1654,_0xe6ed7c['email'])[_0x48c7('0x1b')](function(_0x27a3bd){_0x21f04b=_0x27a3bd;logger[_0x48c7('0xb')](_0x48c7('0x49'),_0x21f04b['id']);return getEndUser(_0x4c1654,_0x2eec7e['calleridname'],_0x2eec7e[_0x48c7('0x4a')]);})[_0x48c7('0x1b')](function(_0x3c0399){_0x3b38f7=_0x3c0399;logger[_0x48c7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3b38f7['id']);return getTicket(_0x4c1654,_0x21f04b,_0x3b38f7,_0x11bd34,_0x2eec7e);})[_0x48c7('0x1b')](function(_0x3d2d75){if(_0x3d2d75&&_0x3d2d75['id']){logger['info'](_0x48c7('0x4b'));logger[_0x48c7('0xb')](_0x48c7('0x4c'),_0x3d2d75['id']);logger[_0x48c7('0xb')]('[QUEUE]',_0x48c7('0x4d'));emit(util['format'](_0x48c7('0x4e'),_0xe6ed7c[_0x48c7('0x15')]),_0x48c7('0x4f'),{'uri':util['format'](_0x48c7('0x50'),_0x4c1654['remoteUri'],_0x3d2d75['id'])});}})[_0x48c7('0x51')](function(_0x2b6154){logger[_0x48c7('0x52')](_0x48c7('0x43'),JSON['stringify'](_0x2b6154));});};exports[_0x48c7('0x53')]=function(_0x252675,_0x5e6000,_0x399a9f,_0x317274,_0x4cc10b,_0x371ae1,_0x1f8912){var _0x2977c1,_0x34b03c;_0x371ae1[_0x48c7('0x1e')]=intUtil['stripTrailingSlash'](_0x371ae1[_0x48c7('0x1e')]);_0x371ae1[_0x48c7('0x41')]=intUtil[_0x48c7('0x40')](_0x371ae1[_0x48c7('0x41')]);if(_0x1f8912&&_0x1f8912['recordingFormat']&&_0x1f8912[_0x48c7('0x54')]!==_0x48c7('0x55')){logger[_0x48c7('0xb')](_0x48c7('0x56'),_0x48c7('0x44'));_0x5e6000['recordingURL']=util[_0x48c7('0xd')](_0x48c7('0x46'),_0x371ae1['serverUrl'],_0x5e6000[_0x48c7('0x47')],md5(_0x5e6000['uniqueid']));}headers[_0x48c7('0x48')]=getAuth(_0x371ae1);return getUser(_0x371ae1,_0x317274['email'])[_0x48c7('0x1b')](function(_0x53d948){_0x2977c1=_0x53d948;logger['info'](_0x48c7('0x49'),_0x2977c1['id']);return getEndUser(_0x371ae1,_0x5e6000[_0x48c7('0x57')],_0x5e6000[_0x48c7('0x58')]);})['then'](function(_0x21f7dc){_0x34b03c=_0x21f7dc;logger['info'](_0x48c7('0x59'),_0x34b03c['id']);return getTicket(_0x371ae1,_0x2977c1,_0x34b03c,_0x399a9f,_0x5e6000);})[_0x48c7('0x1b')](function(_0x186a89){if(_0x186a89&&_0x186a89['id']){logger[_0x48c7('0xb')](_0x48c7('0x4b'));logger[_0x48c7('0xb')](_0x48c7('0x4c'),_0x186a89['id']);logger[_0x48c7('0xb')](_0x48c7('0x56'),_0x48c7('0x4d'));emit(util[_0x48c7('0xd')](_0x48c7('0x4e'),_0x317274[_0x48c7('0x15')]),'trigger:browser:url',{'uri':util[_0x48c7('0xd')](_0x48c7('0x50'),_0x371ae1[_0x48c7('0x1e')],_0x186a89['id'])});}})[_0x48c7('0x51')](function(_0x4cb36a){logger[_0x48c7('0x52')](_0x48c7('0x56'),JSON[_0x48c7('0x31')](_0x4cb36a));});};exports['abandoned']=function(_0x597244,_0x1919fd,_0xc5bde9,_0x207591,_0x571bc1,_0x46f197){var _0x1ea805,_0x2922d2;_0x46f197['remoteUri']=intUtil['stripTrailingSlash'](_0x46f197[_0x48c7('0x1e')]);_0x46f197[_0x48c7('0x41')]=intUtil[_0x48c7('0x40')](_0x46f197[_0x48c7('0x41')]);if(_0x571bc1&&_0x571bc1['monitor_format']){logger[_0x48c7('0xb')]('[ABANDONED]',_0x48c7('0x44'));_0x1919fd[_0x48c7('0x45')]=util[_0x48c7('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46f197[_0x48c7('0x41')],_0x1919fd[_0x48c7('0x47')],md5(_0x1919fd[_0x48c7('0x47')]));}else{_0x1919fd[_0x48c7('0x45')]='';}headers[_0x48c7('0x48')]=getAuth(_0x46f197);return getUser(_0x46f197,'')[_0x48c7('0x1b')](function(_0x3bc114){_0x1ea805=_0x3bc114;logger[_0x48c7('0xb')](_0x48c7('0x49'),_0x1ea805['id']);return getEndUser(_0x46f197,_0x1919fd[_0x48c7('0xf')],_0x1919fd['calleridnum']);})[_0x48c7('0x1b')](function(_0x53da99){_0x2922d2=_0x53da99;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2922d2['id']);return getTicket(_0x46f197,_0x1ea805,_0x2922d2,_0xc5bde9,_0x1919fd);})['then'](function(_0x540e05){if(_0x540e05){logger[_0x48c7('0xb')](_0x48c7('0x4b'));logger[_0x48c7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x540e05['id']);}})[_0x48c7('0x51')](function(_0x507c74){logger['error'](_0x48c7('0x5a'),JSON['stringify'](_0x507c74));});}; \ 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 ed0fae9..664c110 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 _0x58bb=['toLowerCase','data1','data2','find','data3','queue','EVENT\x20UNKNOWN','abandoned','desk','log','unknown\x20integration','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','zoho','vtiger','servicenow','dynamics365','includes'];(function(_0x28993c,_0x141c86){var _0x1ec3c3=function(_0x43fb7b){while(--_0x43fb7b){_0x28993c['push'](_0x28993c['shift']());}};_0x1ec3c3(++_0x141c86);}(_0x58bb,0xff));var _0xb58b=function(_0x3bad4f,_0xb1c5b1){_0x3bad4f=_0x3bad4f-0x0;var _0x31fa56=_0x58bb[_0x3bad4f];return _0x31fa56;};'use strict';var _=require(_0xb58b('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xb58b('0x1'));var sugarcrm=require(_0xb58b('0x2'));var freshdesk=require(_0xb58b('0x3'));var zoho=require(_0xb58b('0x4'));var desk=require(_0xb58b('0x5'));var vtiger=require(_0xb58b('0x6'));var servicenow=require(_0xb58b('0x7'));var dynamics365=require(_0xb58b('0x8'));var integrations=[_0xb58b('0x9'),'salesforce',_0xb58b('0xa'),_0xb58b('0xb'),_0xb58b('0xc'),'desk',_0xb58b('0xd'),_0xb58b('0xe'),_0xb58b('0xf')];exports['exec']=function(_0x212119,_0x1c0fc2,_0x53d078,_0xcc02b,_0x6e754e,_0x40abae){if(_0x53d078){if(_[_0xb58b('0x10')](integrations,_0x212119['data1'][_0xb58b('0x11')]())){try{var _0x305a99=null;var _0x534e1f='';var _0x332996=_0x53d078[_0x212119[_0xb58b('0x12')][_0xb58b('0x11')]()];if(_0x332996){var _0x171806=_0x332996[_0x212119[_0xb58b('0x13')]];if(_0x171806){var _0x1709cb=_[_0xb58b('0x14')](_0x171806['Configurations'],{'id':parseInt(_0x212119[_0xb58b('0x15')],0xa)});if(_0x1709cb){if(_0xcc02b){if(_0x6e754e&&_0x1c0fc2['queue']){_0x534e1f=_0xb58b('0x16');}else if(_0x1c0fc2['routeId']){_0x534e1f='outbound';}else{console['log'](_0xb58b('0x17'),_0x1c0fc2);}}else{_0x534e1f=_0xb58b('0x18');}switch(_0x212119[_0xb58b('0x12')][_0xb58b('0x11')]()){case _0xb58b('0x9'):zendesk[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case'salesforce':salesforce[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case'sugarcrm':sugarcrm[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case _0xb58b('0xb'):freshdesk[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case'zoho':zoho[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case _0xb58b('0x19'):desk[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case _0xb58b('0xd'):vtiger[_0x534e1f](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae);break;case _0xb58b('0xe'):servicenow['cs'](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae,_0x534e1f);break;case _0xb58b('0xf'):dynamics365['cs'](_0x212119,_0x1c0fc2,_0x1709cb,_0xcc02b,_0x6e754e,_0x171806,_0x40abae,_0x534e1f);break;default:console[_0xb58b('0x1a')](_0xb58b('0x1b'));}}else{_0x305a99=require('../../../../config/logger')(_0x212119['data1'][_0xb58b('0x11')]());_0x305a99['error'](_0xb58b('0x1c'),util[_0xb58b('0x1d')](_0xb58b('0x1e'),_0x212119[_0xb58b('0x12')][_0xb58b('0x11')](),_0x212119[_0xb58b('0x15')]));}}else{_0x305a99=require(_0xb58b('0x1f'))(_0x212119[_0xb58b('0x12')][_0xb58b('0x11')]());_0x305a99[_0xb58b('0x20')](_0xb58b('0x1c'),util[_0xb58b('0x1d')](_0xb58b('0x21'),_0x212119[_0xb58b('0x12')][_0xb58b('0x11')](),_0x212119[_0xb58b('0x13')]));}}else{}}catch(_0x5f0972){console[_0xb58b('0x20')](_0x5f0972);}}}}; \ No newline at end of file +var _0x27d4=['./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','zoho','vtiger','servicenow','dynamics365','exec','includes','data1','toLowerCase','data2','find','data3','routeId','outbound','log','desk','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce'];(function(_0x5bac50,_0x540d00){var _0x28afd5=function(_0x25b25d){while(--_0x25b25d){_0x5bac50['push'](_0x5bac50['shift']());}};_0x28afd5(++_0x540d00);}(_0x27d4,0x1bd));var _0x427d=function(_0xd6314a,_0x683bf1){_0xd6314a=_0xd6314a-0x0;var _0xc76b30=_0x27d4[_0xd6314a];return _0xc76b30;};'use strict';var _=require(_0x427d('0x0'));var util=require(_0x427d('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x427d('0x2'));var sugarcrm=require(_0x427d('0x3'));var freshdesk=require(_0x427d('0x4'));var zoho=require(_0x427d('0x5'));var desk=require(_0x427d('0x6'));var vtiger=require(_0x427d('0x7'));var servicenow=require(_0x427d('0x8'));var dynamics365=require('./dynamics365');var integrations=[_0x427d('0x9'),_0x427d('0xa'),'sugarcrm','freshdesk',_0x427d('0xb'),'desk',_0x427d('0xc'),_0x427d('0xd'),_0x427d('0xe')];exports[_0x427d('0xf')]=function(_0x5b4e20,_0x4ae194,_0x27e8ac,_0x2b6e9c,_0x3f97af,_0x22a21e){if(_0x27e8ac){if(_[_0x427d('0x10')](integrations,_0x5b4e20[_0x427d('0x11')]['toLowerCase']())){try{var _0xe81326=null;var _0x4d019f='';var _0x2230a3=_0x27e8ac[_0x5b4e20['data1'][_0x427d('0x12')]()];if(_0x2230a3){var _0x3f0efc=_0x2230a3[_0x5b4e20[_0x427d('0x13')]];if(_0x3f0efc){var _0x15322e=_[_0x427d('0x14')](_0x3f0efc['Configurations'],{'id':parseInt(_0x5b4e20[_0x427d('0x15')],0xa)});if(_0x15322e){if(_0x2b6e9c){if(_0x3f97af&&_0x4ae194['queue']){_0x4d019f='queue';}else if(_0x4ae194[_0x427d('0x16')]){_0x4d019f=_0x427d('0x17');}else{console[_0x427d('0x18')]('EVENT\x20UNKNOWN',_0x4ae194);}}else{_0x4d019f='abandoned';}switch(_0x5b4e20['data1'][_0x427d('0x12')]()){case _0x427d('0x9'):zendesk[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case'salesforce':salesforce[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case'sugarcrm':sugarcrm[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case'freshdesk':freshdesk[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case _0x427d('0xb'):zoho[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case _0x427d('0x19'):desk[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case'vtiger':vtiger[_0x4d019f](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e);break;case _0x427d('0xd'):servicenow['cs'](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e,_0x4d019f);break;case _0x427d('0xe'):dynamics365['cs'](_0x5b4e20,_0x4ae194,_0x15322e,_0x2b6e9c,_0x3f97af,_0x3f0efc,_0x22a21e,_0x4d019f);break;default:console[_0x427d('0x18')]('unknown\x20integration');}}else{_0xe81326=require(_0x427d('0x1a'))(_0x5b4e20[_0x427d('0x11')][_0x427d('0x12')]());_0xe81326[_0x427d('0x1b')](_0x427d('0x1c'),util['format'](_0x427d('0x1d'),_0x5b4e20[_0x427d('0x11')][_0x427d('0x12')](),_0x5b4e20[_0x427d('0x15')]));}}else{_0xe81326=require(_0x427d('0x1a'))(_0x5b4e20[_0x427d('0x11')][_0x427d('0x12')]());_0xe81326[_0x427d('0x1b')](_0x427d('0x1c'),util[_0x427d('0x1e')](_0x427d('0x1f'),_0x5b4e20['data1'][_0x427d('0x12')](),_0x5b4e20[_0x427d('0x13')]));}}else{}}catch(_0x5cfeda){console[_0x427d('0x1b')](_0x5cfeda);}}}}; \ 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 aef20bb..44ae578 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 _0xa9e0=['identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','lead','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','error','catch','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','stringify','abandoned','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.'];(function(_0x3f0a6c,_0x39efa2){var _0x4e5acc=function(_0x11b7ba){while(--_0x11b7ba){_0x3f0a6c['push'](_0x3f0a6c['shift']());}};_0x4e5acc(++_0x39efa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x0a9e('0x3'));var util=require('util');var Redis=require(_0x0a9e('0x4'));var intUtil=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));config['redis']=_[_0x0a9e('0x9')](config[_0x0a9e('0xa')],{'host':_0x0a9e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xe42b77,_0x56465b,_0x52cace){io['to'](_0xe42b77)[_0x0a9e('0xc')](_0x56465b,_0x52cace);}function getTicket(_0xf81284,_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2,_0x527cdd){var _0x4cfe67={};if(_0xfeb75b[_0x0a9e('0xd')]===_0x0a9e('0xe')){_0x4cfe67=Object[_0x0a9e('0xf')]({},{'OwnerId':_0x307b3e['id'],'ActivityDate':moment[_0x0a9e('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0a9e('0x11')](_0xfeb75b[_0x0a9e('0x12')],_0xbd1168,'\x20'),'Description':intUtil['getString'](_0xfeb75b[_0x0a9e('0x13')],_0xbd1168,'\x0a')},getCustomFields(_0x4a4c56,_0xbd1168));if(_0x3ab53f){_0x4cfe67[_0x0a9e('0x14')]=_0x3ab53f['id'];}}else if(_0xfeb75b[_0x0a9e('0xd')]===_0x0a9e('0x15')){_0x4cfe67=Object[_0x0a9e('0xf')]({},{'OwnerId':_0x307b3e['id'],'Subject':intUtil[_0x0a9e('0x11')](_0xfeb75b['Subjects'],_0xbd1168,'\x20'),'Description':intUtil[_0x0a9e('0x11')](_0xfeb75b['Descriptions'],_0xbd1168,'\x0a')},getCustomFields(_0x4a4c56,_0xbd1168));if(_0x3ab53f){_0x4cfe67[_0x0a9e('0x16')]=_0x3ab53f['id'];}}return _0x50dfb2['sobject'](_0xfeb75b[_0x0a9e('0xd')])[_0x0a9e('0x17')](_0x4cfe67);}function getUser(_0x48f32d,_0x225616,_0x5a0a06){if(!_[_0x0a9e('0x18')](_0x225616)&&intUtil[_0x0a9e('0x19')](_0x225616)){var _0x106033={'Email':_0x225616};var _0x205fd6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a0a06[_0x0a9e('0x1a')](_0x0a9e('0x1b'))[_0x0a9e('0x1c')](_0x106033,_0x205fd6)[_0x0a9e('0x1d')]()[_0x0a9e('0x1e')](function(_0x112016){if(_0x112016[_0x0a9e('0x1f')]){var _0x105080=_['find'](_0x112016,function(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')]===_0x225616;});if(_0x105080){logger['info'](_0x0a9e('0x21'),_0x225616);return BPromise['resolve']({'id':_0x105080['Id'],'name':_0x105080['Name']});}}else{logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x225616);return _0x5a0a06[_0x0a9e('0x24')]()[_0x0a9e('0x1e')](function(_0x4abc77){return BPromise[_0x0a9e('0x25')]({'id':_0x4abc77[_0x0a9e('0x26')],'name':_0x4abc77[_0x0a9e('0x27')]});});}});}else{logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x225616);return _0x5a0a06[_0x0a9e('0x24')]()[_0x0a9e('0x1e')](function(_0x5ea472){return BPromise['resolve']({'id':_0x5ea472[_0x0a9e('0x26')],'name':_0x5ea472[_0x0a9e('0x27')]});});}}function getEndUser(_0x40c424,_0x33161b,_0x526cf3,_0x384319,_0x479bc4){var _0x45a1e7={'Phone':_0x384319};var _0x5bfb33={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0a9e('0x25')]()[_0x0a9e('0x1e')](function(){if(_0x33161b[_0x0a9e('0xd')]===_0x0a9e('0xe')){logger[_0x0a9e('0x22')](_0x0a9e('0x28'),_0x384319,_0x33161b[_0x0a9e('0x29')]);switch(_0x33161b[_0x0a9e('0x29')]){case'contact_lead':return _0x479bc4[_0x0a9e('0x1a')](_0x0a9e('0x2a'))[_0x0a9e('0x1c')](_0x45a1e7,_0x5bfb33)[_0x0a9e('0x1d')]()['then'](function(_0x15b200){if(_0x15b200&&_0x15b200[_0x0a9e('0x1f')]){return _0x15b200;}else{return _0x479bc4[_0x0a9e('0x1a')](_0x0a9e('0x2b'))[_0x0a9e('0x1c')](_0x45a1e7,_0x5bfb33);}});case _0x0a9e('0x2c'):return _0x479bc4[_0x0a9e('0x1a')](_0x0a9e('0x2a'))[_0x0a9e('0x1c')](_0x45a1e7,_0x5bfb33)['execute']();case _0x0a9e('0x2d'):return _0x479bc4['sobject'](_0x0a9e('0x2b'))[_0x0a9e('0x1c')](_0x45a1e7,_0x5bfb33);default:return null;}}else if(_0x33161b[_0x0a9e('0xd')]===_0x0a9e('0x15')){logger[_0x0a9e('0x22')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x384319,_0x0a9e('0x2c'));return _0x479bc4[_0x0a9e('0x1a')](_0x0a9e('0x2a'))[_0x0a9e('0x1c')](_0x45a1e7,_0x5bfb33)[_0x0a9e('0x1d')]();}})[_0x0a9e('0x1e')](function(_0x332d35){if(_0x332d35&&_0x332d35[_0x0a9e('0x1f')]){var _0x5583a4=_[_0x0a9e('0x1c')](_0x332d35,function(_0x5e7238){return _0x5e7238[_0x0a9e('0x2e')]===_0x384319;});if(_0x5583a4){return BPromise[_0x0a9e('0x25')]({'id':_0x5583a4['Id'],'name':_0x5583a4[_0x0a9e('0x2f')],'phone':_0x5583a4[_0x0a9e('0x2e')]});}}})['then'](function(_0x191e91){if(_0x191e91){logger[_0x0a9e('0x22')](_0x0a9e('0x30'),_0x384319);return BPromise[_0x0a9e('0x25')](_0x191e91);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x384319);var _0x1e8694={'LastName':_0x526cf3!==''?_0x526cf3:util[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x384319),'Phone':_0x384319};if(_0x33161b[_0x0a9e('0x33')]){if(_0x33161b[_0x0a9e('0x33')]==='contact'){logger[_0x0a9e('0x22')](_0x0a9e('0x34'),_0x384319,_0x33161b[_0x0a9e('0x33')]);}else if(_0x33161b['moduleCreate']===_0x0a9e('0x2d')&&_0x33161b[_0x0a9e('0xd')]===_0x0a9e('0xe')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x384319,_0x33161b[_0x0a9e('0x33')]);_0x1e8694[_0x0a9e('0x35')]='No\x20Company';}else{return null;}}return _0x479bc4[_0x0a9e('0x1a')](_[_0x0a9e('0x36')](_0x33161b[_0x0a9e('0x33')]))[_0x0a9e('0x17')](_0x1e8694);}});}function getCustomFields(_0x4b38d9,_0x5a594b){var _0x15e37d={};if(_0x4b38d9[_0x0a9e('0x1f')]>0x0){_['forEach'](_0x4b38d9,function(_0x183991){if(_0x183991[_0x0a9e('0x37')]===_0x0a9e('0x38')&&_0x183991['idField']){_0x15e37d[_0x183991[_0x0a9e('0x39')]]=_0x183991[_0x0a9e('0x3a')][_0x0a9e('0x3b')]();}else if(_0x183991[_0x0a9e('0x37')]===_0x0a9e('0x3c')&&_0x183991[_0x0a9e('0x3d')]&&_0x183991[_0x0a9e('0x39')]){_0x5a594b[_0x183991[_0x0a9e('0x3d')]]&&(_0x15e37d[_0x183991[_0x0a9e('0x39')]]=_0x5a594b[_0x183991[_0x0a9e('0x3d')]][_0x0a9e('0x3b')]());}else if(_0x183991[_0x0a9e('0x37')]===_0x0a9e('0x3e')&&_0x183991[_0x0a9e('0x3f')]&&_0x183991[_0x0a9e('0x3f')]['name']&&_0x183991['idField']){_0x5a594b[_0x183991[_0x0a9e('0x3f')][_0x0a9e('0x40')][_0x0a9e('0x41')]()]&&(_0x15e37d[_0x183991[_0x0a9e('0x39')]]=_0x5a594b[_0x183991[_0x0a9e('0x3f')][_0x0a9e('0x40')][_0x0a9e('0x41')]()][_0x0a9e('0x3b')]());}});}return _0x15e37d;}function getConnection(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x42')][_0x0a9e('0x43')](_0x432fcc['securityToken']);var _0x117c99=new jsforce[(_0x0a9e('0x44'))]({'oauth2':{'loginUrl':_0x432fcc[_0x0a9e('0x45')]||_0x0a9e('0x46'),'clientId':_0x432fcc[_0x0a9e('0x47')],'clientSecret':_0x432fcc[_0x0a9e('0x48')]}});return _0x117c99[_0x0a9e('0x49')](_0x432fcc[_0x0a9e('0x4a')],_0x25c6e6)['then'](function(){logger[_0x0a9e('0x22')]('Connection\x20established.');return _0x117c99;});}exports[_0x0a9e('0x4b')]=function(_0x476688,_0x8d6dd1,_0x562fb4,_0x14bec2,_0x7f6eb1,_0x4774f4){var _0x34aa5a,_0x45c845,_0x37be73,_0x45bf7f;_0x4774f4['serverUrl']=intUtil[_0x0a9e('0x4c')](_0x4774f4[_0x0a9e('0x4d')]);_0x4774f4[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x4c')](_0x4774f4[_0x0a9e('0x45')]);if(_0x7f6eb1&&_0x7f6eb1[_0x0a9e('0x4e')]){logger[_0x0a9e('0x22')](_0x0a9e('0x4f'),_0x0a9e('0x50'));_0x8d6dd1['recordingURL']=util[_0x0a9e('0x31')](_0x0a9e('0x51'),_0x4774f4['serverUrl'],_0x8d6dd1['uniqueid'],md5(_0x8d6dd1['uniqueid']));}else{_0x8d6dd1[_0x0a9e('0x52')]='';}return getConnection(_0x4774f4)[_0x0a9e('0x1e')](function(_0x37edaa){_0x45bf7f=_0x37edaa;return getUser(_0x4774f4,_0x14bec2[_0x0a9e('0x53')],_0x45bf7f);})[_0x0a9e('0x1e')](function(_0x30decb){_0x34aa5a=_0x30decb;return getEndUser(_0x4774f4,_0x562fb4,_0x8d6dd1[_0x0a9e('0x54')],_0x8d6dd1[_0x0a9e('0x55')],_0x45bf7f);})['then'](function(_0x4b1b9f){_0x45c845=_0x4b1b9f;return getTicket(_0x4774f4,_0x34aa5a,_0x45c845,_0x562fb4,_0x8d6dd1,_0x562fb4['Fields'],_0x45bf7f,_0x0a9e('0x4b'));})[_0x0a9e('0x1e')](function(_0x14d602){_0x37be73=_0x14d602;logger['info'](_0x0a9e('0x56'),_0x37be73['id']);logger[_0x0a9e('0x22')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x37be73['id'],_0x14bec2['name'],_0x4774f4[_0x0a9e('0x37')]);switch(_0x4774f4['type']){case _0x0a9e('0x57'):emit(util['format'](_0x0a9e('0x58'),_0x14bec2[_0x0a9e('0x40')]),_0x0a9e('0x59'),{'recordId':_0x37be73['id']});break;case'newTab':emit(util[_0x0a9e('0x31')](_0x0a9e('0x58'),_0x14bec2['name']),'trigger:browser:url',{'uri':util[_0x0a9e('0x31')](_0x0a9e('0x5a'),_0x45bf7f['instanceUrl'],_0x37be73['id'])});break;default:logger[_0x0a9e('0x5b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x0a9e('0x5c')](function(_0x523cd2){logger[_0x0a9e('0x5b')]('[QUEUE]',JSON['stringify'](_0x523cd2));});};exports['outbound']=function(_0x2da03c,_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df,_0x232830){var _0x272738,_0xd10662,_0x28d814,_0x4e67ab;_0x19b4df[_0x0a9e('0x4d')]=intUtil[_0x0a9e('0x4c')](_0x19b4df[_0x0a9e('0x4d')]);_0x19b4df[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x4c')](_0x19b4df[_0x0a9e('0x45')]);if(_0x232830&&_0x232830['recordingFormat']&&_0x232830[_0x0a9e('0x5d')]!==_0x0a9e('0x5e')){logger['info'](_0x0a9e('0x5f'),'Recording\x20is\x20enabled!');_0x47de4c[_0x0a9e('0x52')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19b4df['serverUrl'],_0x47de4c[_0x0a9e('0x60')],md5(_0x47de4c['uniqueid']));}return getConnection(_0x19b4df)[_0x0a9e('0x1e')](function(_0x1fc70e){_0x4e67ab=_0x1fc70e;return getUser(_0x19b4df,_0x65432[_0x0a9e('0x53')],_0x4e67ab);})[_0x0a9e('0x1e')](function(_0x1cca9f){_0x272738=_0x1cca9f;return getEndUser(_0x19b4df,_0x2f7092,_0x47de4c[_0x0a9e('0x61')],_0x47de4c['destcalleridnum'],_0x4e67ab);})[_0x0a9e('0x1e')](function(_0x5854cc){_0xd10662=_0x5854cc;return getTicket(_0x19b4df,_0x272738,_0xd10662,_0x2f7092,_0x47de4c,_0x2f7092[_0x0a9e('0x62')],_0x4e67ab,_0x0a9e('0x63'));})[_0x0a9e('0x1e')](function(_0x5adf8f){_0x28d814=_0x5adf8f;logger[_0x0a9e('0x22')](_0x0a9e('0x64'),_0x28d814['id']);logger[_0x0a9e('0x22')](_0x0a9e('0x65'),_0x28d814['id'],_0x65432['name'],_0x19b4df[_0x0a9e('0x37')]);switch(_0x19b4df[_0x0a9e('0x37')]){case'integrationTab':emit(util[_0x0a9e('0x31')](_0x0a9e('0x58'),_0x65432[_0x0a9e('0x40')]),_0x0a9e('0x59'),{'recordId':_0x28d814['id']});break;case _0x0a9e('0x66'):emit(util['format'](_0x0a9e('0x58'),_0x65432[_0x0a9e('0x40')]),_0x0a9e('0x67'),{'uri':util['format'](_0x0a9e('0x5a'),_0x4e67ab['instanceUrl'],_0x28d814['id'])});break;default:logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x68'));}})[_0x0a9e('0x5c')](function(_0x19c995){logger[_0x0a9e('0x5b')](_0x0a9e('0x5f'),JSON[_0x0a9e('0x69')](_0x19c995));});};exports[_0x0a9e('0x6a')]=function(_0x2d7205,_0x1cc4f3,_0x2e89b7,_0x19012b,_0x2bbb86,_0x2b8192){var _0x320898,_0x412a72,_0x2a28c0,_0x4257c9;_0x2b8192['serverUrl']=intUtil[_0x0a9e('0x4c')](_0x2b8192[_0x0a9e('0x4d')]);_0x2b8192[_0x0a9e('0x45')]=intUtil['stripTrailingSlash'](_0x2b8192[_0x0a9e('0x45')]);if(_0x2bbb86&&_0x2bbb86[_0x0a9e('0x4e')]){logger['info'](_0x0a9e('0x6b'),_0x0a9e('0x50'));_0x1cc4f3[_0x0a9e('0x52')]=util[_0x0a9e('0x31')](_0x0a9e('0x51'),_0x2b8192['serverUrl'],_0x1cc4f3['uniqueid'],md5(_0x1cc4f3['uniqueid']));}else{_0x1cc4f3[_0x0a9e('0x52')]='';}return getConnection(_0x2b8192)[_0x0a9e('0x1e')](function(_0x1104ad){_0x4257c9=_0x1104ad;if(!_[_0x0a9e('0x18')](_0x19012b)){return getUser(_0x2b8192,_0x19012b[_0x0a9e('0x40')],_0x4257c9);}else{return getUser(_0x2b8192,null,_0x4257c9);}})[_0x0a9e('0x1e')](function(_0xeef20){_0x320898=_0xeef20;return getEndUser(_0x2b8192,_0x2e89b7,_0x1cc4f3[_0x0a9e('0x54')],_0x1cc4f3['calleridnum'],_0x4257c9);})[_0x0a9e('0x1e')](function(_0xcbc8b2){_0x412a72=_0xcbc8b2;return getTicket(_0x2b8192,_0x320898,_0x412a72,_0x2e89b7,_0x1cc4f3,_0x2e89b7[_0x0a9e('0x62')],_0x4257c9);})['then'](function(_0x2bdc44){_0x2a28c0=_0x2bdc44;logger['info'](_0x0a9e('0x6c'),_0x2a28c0['id']);logger[_0x0a9e('0x22')]('[ABANDONED]\x20Integration\x20account\x20type\x20%s.',_0x2b8192[_0x0a9e('0x37')]);})[_0x0a9e('0x5c')](function(_0x2cc7a7){logger[_0x0a9e('0x5b')]('[ABANDONED]',JSON[_0x0a9e('0x69')](_0x2cc7a7));});}; \ No newline at end of file +var _0x9c44=['username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[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.','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','abandoned','isNil','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','utc','getString','Descriptions','WhoId','Case','assign','Subjects','ContactId','sobject','create','find','then','length','Email','info','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','lead','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','type','string','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login'];(function(_0x50bca4,_0x24341d){var _0x1112b0=function(_0x371121){while(--_0x371121){_0x50bca4['push'](_0x50bca4['shift']());}};_0x1112b0(++_0x24341d);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var md5=require(_0x49c4('0x2'));var jsforce=require(_0x49c4('0x3'));var util=require(_0x49c4('0x4'));var Redis=require(_0x49c4('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x49c4('0x6'))('salesforce');config[_0x49c4('0x7')]=_[_0x49c4('0x8')](config[_0x49c4('0x7')],{'host':_0x49c4('0x9'),'port':0x18eb});var io=require(_0x49c4('0xa'))(new Redis(config['redis']));function emit(_0x11c586,_0x42e4f8,_0x1d13fb){io['to'](_0x11c586)[_0x49c4('0xb')](_0x42e4f8,_0x1d13fb);}function getTicket(_0x4c7d3a,_0x5ab4a3,_0x451ea6,_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c){var _0x536d42={};if(_0x313e73[_0x49c4('0xc')]===_0x49c4('0xd')){_0x536d42=Object['assign']({},{'OwnerId':_0x5ab4a3['id'],'ActivityDate':moment[_0x49c4('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x49c4('0xf')](_0x313e73['Subjects'],_0x58cad7,'\x20'),'Description':intUtil[_0x49c4('0xf')](_0x313e73[_0x49c4('0x10')],_0x58cad7,'\x0a')},getCustomFields(_0xb611a1,_0x58cad7));if(_0x451ea6){_0x536d42[_0x49c4('0x11')]=_0x451ea6['id'];}}else if(_0x313e73[_0x49c4('0xc')]===_0x49c4('0x12')){_0x536d42=Object[_0x49c4('0x13')]({},{'OwnerId':_0x5ab4a3['id'],'Subject':intUtil[_0x49c4('0xf')](_0x313e73[_0x49c4('0x14')],_0x58cad7,'\x20'),'Description':intUtil['getString'](_0x313e73[_0x49c4('0x10')],_0x58cad7,'\x0a')},getCustomFields(_0xb611a1,_0x58cad7));if(_0x451ea6){_0x536d42[_0x49c4('0x15')]=_0x451ea6['id'];}}return _0x459d09[_0x49c4('0x16')](_0x313e73[_0x49c4('0xc')])[_0x49c4('0x17')](_0x536d42);}function getUser(_0x53e3a2,_0x44e607,_0x2891f4){if(!_['isNil'](_0x44e607)&&intUtil['validateEmail'](_0x44e607)){var _0x3c782d={'Email':_0x44e607};var _0x2f82d5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2891f4[_0x49c4('0x16')]('User')[_0x49c4('0x18')](_0x3c782d,_0x2f82d5)['execute']()[_0x49c4('0x19')](function(_0x1806c2){if(_0x1806c2[_0x49c4('0x1a')]){var _0x291526=_[_0x49c4('0x18')](_0x1806c2,function(_0x41078c){return _0x41078c[_0x49c4('0x1b')]===_0x44e607;});if(_0x291526){logger[_0x49c4('0x1c')](_0x49c4('0x1d'),_0x44e607);return BPromise['resolve']({'id':_0x291526['Id'],'name':_0x291526['Name']});}}else{logger['info'](_0x49c4('0x1e'),_0x44e607);return _0x2891f4['identity']()['then'](function(_0x2263ae){return BPromise[_0x49c4('0x1f')]({'id':_0x2263ae[_0x49c4('0x20')],'name':_0x2263ae[_0x49c4('0x21')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x44e607);return _0x2891f4[_0x49c4('0x22')]()[_0x49c4('0x19')](function(_0x565423){return BPromise[_0x49c4('0x1f')]({'id':_0x565423[_0x49c4('0x20')],'name':_0x565423[_0x49c4('0x21')]});});}}function getEndUser(_0xa7a826,_0x531d92,_0x543ea2,_0x449960,_0x53c199){var _0x3800b7={'Phone':_0x449960};var _0x3852b2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x49c4('0x1f')]()[_0x49c4('0x19')](function(){if(_0x531d92['ticketType']===_0x49c4('0xd')){logger[_0x49c4('0x1c')](_0x49c4('0x23'),_0x449960,_0x531d92[_0x49c4('0x24')]);switch(_0x531d92[_0x49c4('0x24')]){case _0x49c4('0x25'):return _0x53c199[_0x49c4('0x16')](_0x49c4('0x26'))[_0x49c4('0x18')](_0x3800b7,_0x3852b2)[_0x49c4('0x27')]()[_0x49c4('0x19')](function(_0x4ea6ea){if(_0x4ea6ea&&_0x4ea6ea['length']){return _0x4ea6ea;}else{return _0x53c199['sobject'](_0x49c4('0x28'))[_0x49c4('0x18')](_0x3800b7,_0x3852b2);}});case _0x49c4('0x29'):return _0x53c199[_0x49c4('0x16')](_0x49c4('0x26'))['find'](_0x3800b7,_0x3852b2)[_0x49c4('0x27')]();case _0x49c4('0x2a'):return _0x53c199[_0x49c4('0x16')](_0x49c4('0x28'))['find'](_0x3800b7,_0x3852b2);default:return null;}}else if(_0x531d92['ticketType']===_0x49c4('0x12')){logger[_0x49c4('0x1c')](_0x49c4('0x23'),_0x449960,_0x49c4('0x29'));return _0x53c199[_0x49c4('0x16')]('Contact')[_0x49c4('0x18')](_0x3800b7,_0x3852b2)[_0x49c4('0x27')]();}})[_0x49c4('0x19')](function(_0x512d02){if(_0x512d02&&_0x512d02['length']){var _0x85dce2=_[_0x49c4('0x18')](_0x512d02,function(_0x3bec0a){return _0x3bec0a[_0x49c4('0x2b')]===_0x449960;});if(_0x85dce2){return BPromise[_0x49c4('0x1f')]({'id':_0x85dce2['Id'],'name':_0x85dce2[_0x49c4('0x2c')],'phone':_0x85dce2[_0x49c4('0x2b')]});}}})[_0x49c4('0x19')](function(_0x3209cd){if(_0x3209cd){logger['info'](_0x49c4('0x2d'),_0x449960);return BPromise['resolve'](_0x3209cd);}else{logger[_0x49c4('0x1c')](_0x49c4('0x2e'),_0x449960);var _0x2625a6={'LastName':_0x543ea2!==_0x49c4('0x2f')?_0x543ea2:util['format'](_0x49c4('0x30'),_0x449960),'Phone':_0x449960};if(_0x531d92[_0x49c4('0x31')]){if(_0x531d92[_0x49c4('0x31')]==='contact'){logger[_0x49c4('0x1c')](_0x49c4('0x32'),_0x449960,_0x531d92[_0x49c4('0x31')]);}else if(_0x531d92[_0x49c4('0x31')]===_0x49c4('0x2a')&&_0x531d92[_0x49c4('0xc')]===_0x49c4('0xd')){logger[_0x49c4('0x1c')](_0x49c4('0x32'),_0x449960,_0x531d92[_0x49c4('0x31')]);_0x2625a6[_0x49c4('0x33')]='No\x20Company';}else{return null;}}return _0x53c199[_0x49c4('0x16')](_[_0x49c4('0x34')](_0x531d92[_0x49c4('0x31')]))[_0x49c4('0x17')](_0x2625a6);}});}function getCustomFields(_0x41ad28,_0x29dd5d){var _0x1be62d={};if(_0x41ad28[_0x49c4('0x1a')]>0x0){_[_0x49c4('0x35')](_0x41ad28,function(_0x2668ed){if(_0x2668ed[_0x49c4('0x36')]===_0x49c4('0x37')&&_0x2668ed[_0x49c4('0x38')]){_0x1be62d[_0x2668ed['idField']]=_0x2668ed[_0x49c4('0x39')]['toString']();}else if(_0x2668ed[_0x49c4('0x36')]===_0x49c4('0x3a')&&_0x2668ed[_0x49c4('0x3b')]&&_0x2668ed[_0x49c4('0x38')]){_0x29dd5d[_0x2668ed[_0x49c4('0x3b')]]&&(_0x1be62d[_0x2668ed[_0x49c4('0x38')]]=_0x29dd5d[_0x2668ed['variableName']]['toString']());}else if(_0x2668ed[_0x49c4('0x36')]===_0x49c4('0x3c')&&_0x2668ed[_0x49c4('0x3d')]&&_0x2668ed[_0x49c4('0x3d')]['name']&&_0x2668ed[_0x49c4('0x38')]){_0x29dd5d[_0x2668ed[_0x49c4('0x3d')][_0x49c4('0x3e')][_0x49c4('0x3f')]()]&&(_0x1be62d[_0x2668ed[_0x49c4('0x38')]]=_0x29dd5d[_0x2668ed[_0x49c4('0x3d')][_0x49c4('0x3e')][_0x49c4('0x3f')]()][_0x49c4('0x40')]());}});}return _0x1be62d;}function getConnection(_0x5640d3){var _0x2ad771=_0x5640d3['password'][_0x49c4('0x41')](_0x5640d3[_0x49c4('0x42')]);var _0x301def=new jsforce[(_0x49c4('0x43'))]({'oauth2':{'loginUrl':_0x5640d3[_0x49c4('0x44')]||'https://login.salesforce.com','clientId':_0x5640d3[_0x49c4('0x45')],'clientSecret':_0x5640d3[_0x49c4('0x46')]}});return _0x301def[_0x49c4('0x47')](_0x5640d3[_0x49c4('0x48')],_0x2ad771)[_0x49c4('0x19')](function(){logger[_0x49c4('0x1c')](_0x49c4('0x49'));return _0x301def;});}exports['queue']=function(_0x3bac1b,_0x5cfff9,_0x3f7379,_0x906d3,_0x29fe65,_0x27adfe){var _0x2d8087,_0x30bea5,_0x2c6be1,_0x506c71;_0x27adfe[_0x49c4('0x4a')]=intUtil[_0x49c4('0x4b')](_0x27adfe['serverUrl']);_0x27adfe[_0x49c4('0x44')]=intUtil[_0x49c4('0x4b')](_0x27adfe[_0x49c4('0x44')]);if(_0x29fe65&&_0x29fe65[_0x49c4('0x4c')]){logger['info']('[QUEUE]',_0x49c4('0x4d'));_0x5cfff9['recordingURL']=util[_0x49c4('0x4e')](_0x49c4('0x4f'),_0x27adfe[_0x49c4('0x4a')],_0x5cfff9[_0x49c4('0x50')],md5(_0x5cfff9[_0x49c4('0x50')]));}else{_0x5cfff9[_0x49c4('0x51')]='';}return getConnection(_0x27adfe)[_0x49c4('0x19')](function(_0x563f0b){_0x506c71=_0x563f0b;return getUser(_0x27adfe,_0x906d3[_0x49c4('0x52')],_0x506c71);})[_0x49c4('0x19')](function(_0x3936d3){_0x2d8087=_0x3936d3;return getEndUser(_0x27adfe,_0x3f7379,_0x5cfff9[_0x49c4('0x53')],_0x5cfff9[_0x49c4('0x54')],_0x506c71);})[_0x49c4('0x19')](function(_0x156748){_0x30bea5=_0x156748;return getTicket(_0x27adfe,_0x2d8087,_0x30bea5,_0x3f7379,_0x5cfff9,_0x3f7379[_0x49c4('0x55')],_0x506c71,_0x49c4('0x56'));})[_0x49c4('0x19')](function(_0x5b822f){_0x2c6be1=_0x5b822f;logger['info'](_0x49c4('0x57'),_0x2c6be1['id']);logger[_0x49c4('0x1c')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2c6be1['id'],_0x906d3['name'],_0x27adfe[_0x49c4('0x36')]);switch(_0x27adfe['type']){case'integrationTab':emit(util[_0x49c4('0x4e')](_0x49c4('0x58'),_0x906d3[_0x49c4('0x3e')]),_0x49c4('0x59'),{'recordId':_0x2c6be1['id']});break;case _0x49c4('0x5a'):emit(util[_0x49c4('0x4e')](_0x49c4('0x58'),_0x906d3['name']),_0x49c4('0x5b'),{'uri':util[_0x49c4('0x4e')](_0x49c4('0x5c'),_0x506c71[_0x49c4('0x5d')],_0x2c6be1['id'])});break;default:logger[_0x49c4('0x5e')](_0x49c4('0x5f'));}})['catch'](function(_0x5c7ddd){logger[_0x49c4('0x5e')](_0x49c4('0x60'),JSON[_0x49c4('0x61')](_0x5c7ddd));});};exports[_0x49c4('0x62')]=function(_0x23288e,_0x6b2592,_0xc2033f,_0x58dc5f,_0x45d715,_0x33c9a6,_0x4ba4eb){var _0x42928c,_0x53690f,_0x2f966c,_0x147ebd;_0x33c9a6[_0x49c4('0x4a')]=intUtil[_0x49c4('0x4b')](_0x33c9a6[_0x49c4('0x4a')]);_0x33c9a6[_0x49c4('0x44')]=intUtil[_0x49c4('0x4b')](_0x33c9a6[_0x49c4('0x44')]);if(_0x4ba4eb&&_0x4ba4eb['recordingFormat']&&_0x4ba4eb[_0x49c4('0x63')]!==_0x49c4('0x64')){logger['info'](_0x49c4('0x65'),_0x49c4('0x4d'));_0x6b2592['recordingURL']=util[_0x49c4('0x4e')](_0x49c4('0x4f'),_0x33c9a6['serverUrl'],_0x6b2592['uniqueid'],md5(_0x6b2592['uniqueid']));}return getConnection(_0x33c9a6)['then'](function(_0xc43386){_0x147ebd=_0xc43386;return getUser(_0x33c9a6,_0x58dc5f['email'],_0x147ebd);})[_0x49c4('0x19')](function(_0x32f344){_0x42928c=_0x32f344;return getEndUser(_0x33c9a6,_0xc2033f,_0x6b2592['destcalleridname'],_0x6b2592[_0x49c4('0x66')],_0x147ebd);})[_0x49c4('0x19')](function(_0x5ac9f0){_0x53690f=_0x5ac9f0;return getTicket(_0x33c9a6,_0x42928c,_0x53690f,_0xc2033f,_0x6b2592,_0xc2033f[_0x49c4('0x55')],_0x147ebd,_0x49c4('0x62'));})[_0x49c4('0x19')](function(_0x35f46f){_0x2f966c=_0x35f46f;logger['info'](_0x49c4('0x67'),_0x2f966c['id']);logger[_0x49c4('0x1c')](_0x49c4('0x68'),_0x2f966c['id'],_0x58dc5f[_0x49c4('0x3e')],_0x33c9a6['type']);switch(_0x33c9a6[_0x49c4('0x36')]){case'integrationTab':emit(util['format']('user:%s',_0x58dc5f['name']),_0x49c4('0x59'),{'recordId':_0x2f966c['id']});break;case _0x49c4('0x5a'):emit(util[_0x49c4('0x4e')](_0x49c4('0x58'),_0x58dc5f['name']),'trigger:browser:url',{'uri':util[_0x49c4('0x4e')](_0x49c4('0x5c'),_0x147ebd[_0x49c4('0x5d')],_0x2f966c['id'])});break;default:logger[_0x49c4('0x5e')](_0x49c4('0x65'),_0x49c4('0x69'));}})[_0x49c4('0x6a')](function(_0x3b949d){logger['error'](_0x49c4('0x65'),JSON['stringify'](_0x3b949d));});};exports[_0x49c4('0x6b')]=function(_0x264902,_0x1a5d4c,_0x1ea1b4,_0x3a1c81,_0x2e062f,_0x13d657){var _0x3feb0b,_0x13d951,_0x1743d0,_0x1e3911;_0x13d657[_0x49c4('0x4a')]=intUtil[_0x49c4('0x4b')](_0x13d657[_0x49c4('0x4a')]);_0x13d657[_0x49c4('0x44')]=intUtil[_0x49c4('0x4b')](_0x13d657[_0x49c4('0x44')]);if(_0x2e062f&&_0x2e062f[_0x49c4('0x4c')]){logger['info']('[ABANDONED]',_0x49c4('0x4d'));_0x1a5d4c[_0x49c4('0x51')]=util['format'](_0x49c4('0x4f'),_0x13d657[_0x49c4('0x4a')],_0x1a5d4c[_0x49c4('0x50')],md5(_0x1a5d4c[_0x49c4('0x50')]));}else{_0x1a5d4c['recordingURL']='';}return getConnection(_0x13d657)['then'](function(_0x4a85d4){_0x1e3911=_0x4a85d4;if(!_[_0x49c4('0x6c')](_0x3a1c81)){return getUser(_0x13d657,_0x3a1c81[_0x49c4('0x3e')],_0x1e3911);}else{return getUser(_0x13d657,null,_0x1e3911);}})[_0x49c4('0x19')](function(_0x2f4289){_0x3feb0b=_0x2f4289;return getEndUser(_0x13d657,_0x1ea1b4,_0x1a5d4c[_0x49c4('0x53')],_0x1a5d4c[_0x49c4('0x54')],_0x1e3911);})[_0x49c4('0x19')](function(_0x3692a4){_0x13d951=_0x3692a4;return getTicket(_0x13d657,_0x3feb0b,_0x13d951,_0x1ea1b4,_0x1a5d4c,_0x1ea1b4[_0x49c4('0x55')],_0x1e3911);})['then'](function(_0x363b2e){_0x1743d0=_0x363b2e;logger[_0x49c4('0x1c')](_0x49c4('0x6d'),_0x1743d0['id']);logger['info'](_0x49c4('0x6e'),_0x13d657[_0x49c4('0x36')]);})[_0x49c4('0x6a')](function(_0xb6031b){logger[_0x49c4('0x5e')](_0x49c4('0x6f'),JSON[_0x49c4('0x61')](_0xb6031b));});}; \ 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 d3a7316..099387e 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 _0x8c25=['string','variable','variableName','customVariable','Variable','name','toString','outbound','incident','assign','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','Recording\x20is\x20enabled!','call\x20direction:\x20%s','abandoned','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','sys_user?sysparm_query=phone%3D','forEach','type','nameField','customField','idField','toLowerCase','content'];(function(_0x54e48e,_0x2c51e4){var _0x508aa4=function(_0x5aa466){while(--_0x5aa466){_0x54e48e['push'](_0x54e48e['shift']());}};_0x508aa4(++_0x2c51e4);}(_0x8c25,0x15e));var _0x58c2=function(_0x12ef41,_0x33b7e0){_0x12ef41=_0x12ef41-0x0;var _0x4059b4=_0x8c25[_0x12ef41];return _0x4059b4;};'use strict';var _=require(_0x58c2('0x0'));var Promise=require(_0x58c2('0x1'));var rp=require(_0x58c2('0x2'));var util=require(_0x58c2('0x3'));var md5=require(_0x58c2('0x4'));var Redis=require(_0x58c2('0x5'));var intUtil=require('./util');var config=require(_0x58c2('0x6'));var logger=require('../../../../config/logger')('servicenow');config['redis']=_[_0x58c2('0x7')](config['redis'],{'host':_0x58c2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x331863,_0xddbb7e,_0x52cfa7,_0x3fa02e,_0x13f737,_0xf9aef5){return new Promise(function(_0x333435,_0x208e78){var _0x269465={'method':_0x58c2('0x9'),'uri':_0x3fa02e+_0x58c2('0xa')+'&'+_0x13f737+'&'+_0xf9aef5,'auth':_0xddbb7e,'json':!![]};return rp(_0x269465)['then'](function(_0x1727f3){if(_0x1727f3[_0x58c2('0xb')][_0x58c2('0xc')]>0x0){_0x52cfa7['adminId']=_0x1727f3[_0x58c2('0xb')][0x0][_0x58c2('0xd')];}logger[_0x58c2('0xe')]('['+[_0x331863[_0x58c2('0xf')]()]+_0x58c2('0x10'),_0x52cfa7);_0x333435(_0x52cfa7);})[_0x58c2('0x11')](function(_0x317830){logger[_0x58c2('0x12')]('['+[_0x331863[_0x58c2('0xf')]()]+']',_0x317830[_0x58c2('0x13')]);_0x208e78(_0x317830['message']);});});}function getUser(_0x5e5bff,_0x428dd7,_0x752290,_0x346efe,_0x20d6d6){return function(_0x3e6589){logger['info']('['+[_0x5e5bff[_0x58c2('0xf')]()]+_0x58c2('0x14'),_0x3e6589);return new Promise(function(_0x4a94c6,_0x50e4fa){if(intUtil['validateEmail'](_0x3e6589[_0x58c2('0x15')])){var _0x4924c6={'method':'GET','uri':_0x752290+'sys_user?sysparm_query=email%3D'+_0x3e6589['userEmail']+'&'+_0x346efe+'&'+_0x20d6d6,'auth':_0x428dd7,'json':!![]};logger[_0x58c2('0xe')]('['+[_0x5e5bff[_0x58c2('0xf')]()]+_0x58c2('0x16'),_0x4924c6);return rp(_0x4924c6)[_0x58c2('0x17')](function(_0x27037a){logger[_0x58c2('0xe')]('['+[_0x5e5bff['toUpperCase']()]+_0x58c2('0x18'),_0x27037a);if(_0x27037a[_0x58c2('0xb')][_0x58c2('0xc')]>0x0&&String(_0x27037a[_0x58c2('0xb')][0x0]['active'])===_0x58c2('0x19')){_0x3e6589[_0x58c2('0x1a')]=_0x27037a[_0x58c2('0xb')][0x0][_0x58c2('0xd')];}else{_0x3e6589[_0x58c2('0x1a')]=_0x3e6589[_0x58c2('0x1b')];_0x3e6589[_0x58c2('0x15')]=_0x3e6589[_0x58c2('0x1c')];}logger[_0x58c2('0xe')]('['+[_0x5e5bff[_0x58c2('0xf')]()]+_0x58c2('0x1d'),_0x3e6589);_0x4a94c6(_0x3e6589);})['catch'](function(_0x4dc27e){logger[_0x58c2('0x12')]('['+[_0x5e5bff[_0x58c2('0xf')]()]+']',_0x4dc27e[_0x58c2('0x13')]);_0x50e4fa(_0x4dc27e[_0x58c2('0x13')]);});}else{logger[_0x58c2('0xe')]('['+[_0x5e5bff[_0x58c2('0xf')]()]+_0x58c2('0x1e'));_0x3e6589[_0x58c2('0x1a')]=_0x3e6589[_0x58c2('0x1b')];_0x3e6589[_0x58c2('0x15')]=_0x3e6589[_0x58c2('0x1c')];_0x4a94c6(_0x3e6589);}});};}function createEndUser(_0x2344a5,_0x3ce842,_0xda8f66,_0x1487da,_0x2e4546){logger['info']('['+[_0x2344a5[_0x58c2('0xf')]()]+_0x58c2('0x1f'),_0xda8f66);return new Promise(function(_0x1bd3a5,_0x3a388c){var _0x291b4b={'method':_0x58c2('0x20'),'uri':_0x1487da+_0x58c2('0x21')+_0x2e4546,'body':{'user_name':_0xda8f66[_0x58c2('0x22')],'roles':_0x58c2('0x23'),'first_name':_0xda8f66[_0x58c2('0x22')],'active':_0x58c2('0x19'),'date_format':_0x58c2('0x24'),'phone':_0xda8f66[_0x58c2('0x22')]},'auth':_0x3ce842,'json':!![]};return rp(_0x291b4b)[_0x58c2('0x17')](function(_0x3584f4){logger[_0x58c2('0xe')]('['+[_0x2344a5[_0x58c2('0xf')]()]+'],\x20EndUser\x20schema',_0x3584f4['result']);_0xda8f66[_0x58c2('0x25')]=_0x3584f4[_0x58c2('0xb')]['sys_id'];_0x1bd3a5(_0xda8f66);})[_0x58c2('0x11')](function(_0x5d33d1){logger['error']('['+[_0x2344a5['toUpperCase']()]+']',_0x5d33d1[_0x58c2('0x13')]);_0x3a388c(_0x5d33d1[_0x58c2('0x13')]);});});}function getEndUser(_0x4f395e,_0x2e1970,_0x149f05,_0x1f02ce,_0x1f4f13){return function(_0x4a74eb){logger[_0x58c2('0xe')]('['+[_0x4f395e[_0x58c2('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x4a74eb);return new Promise(function(_0x3b490c,_0x159c91){var _0x113367={'method':_0x58c2('0x9'),'uri':_0x149f05+_0x58c2('0x26')+_0x4a74eb[_0x58c2('0x22')]+'&'+_0x1f02ce+'&'+_0x1f4f13,'auth':_0x2e1970,'json':!![]};return rp(_0x113367)[_0x58c2('0x17')](function(_0x36c9b1){if(_0x36c9b1['result']['length']>0x0){_0x4a74eb['endUserId']=_0x36c9b1[_0x58c2('0xb')][0x0][_0x58c2('0xd')];logger[_0x58c2('0xe')]('['+[_0x4f395e['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x4a74eb);_0x3b490c(_0x4a74eb);}else{return createEndUser(_0x4f395e,_0x2e1970,_0x4a74eb,_0x149f05,_0x1f02ce)[_0x58c2('0x17')](function(_0x177eda){logger['info']('['+[_0x4f395e[_0x58c2('0xf')]()]+'],\x20createEndUser\x20crm',_0x177eda);_0x3b490c(_0x177eda);});}})[_0x58c2('0x11')](function(_0xc8292c){logger[_0x58c2('0x12')]('['+[_0x4f395e[_0x58c2('0xf')]()]+']',_0xc8292c[_0x58c2('0x13')]);_0x159c91(_0xc8292c[_0x58c2('0x13')]);});});};}function getCustomFields(_0x1e0783,_0x59b808){var _0x39edd1={};if(_0x1e0783[_0x58c2('0xc')]>0x0){_[_0x58c2('0x27')](_0x1e0783,function(_0x121061){if(_0x121061[_0x58c2('0x28')]==='string'&&_0x121061[_0x58c2('0x29')]&&!_0x121061[_0x58c2('0x2a')]){_0x39edd1[_0x121061[_0x58c2('0x2b')][_0x58c2('0x2c')]()]=_0x121061[_0x58c2('0x2d')]['toString']();}else if(_0x121061[_0x58c2('0x28')]===_0x58c2('0x2e')&&_0x121061[_0x58c2('0x2b')]&&_0x121061[_0x58c2('0x2a')]){_0x39edd1[_0x121061['idField']['toLowerCase']()]=_0x121061[_0x58c2('0x2d')]['toString']();}else if(_0x121061[_0x58c2('0x28')]===_0x58c2('0x2f')&&_0x121061['variableName']&&_0x121061[_0x58c2('0x2b')]&&_0x121061[_0x58c2('0x2a')]){_0x39edd1[_0x121061[_0x58c2('0x2b')][_0x58c2('0x2c')]()]=_0x59b808[_0x121061[_0x58c2('0x30')]]['toString']();}else if(_0x121061[_0x58c2('0x28')]===_0x58c2('0x31')&&_0x121061[_0x58c2('0x32')]&&_0x121061['Variable']['name']&&_0x121061[_0x58c2('0x2b')]&&_0x121061['customField']){_0x39edd1[_0x121061[_0x58c2('0x2b')][_0x58c2('0x2c')]()]=_0x59b808[_0x121061['Variable'][_0x58c2('0x33')]['toLowerCase']()][_0x58c2('0x34')]();}});}return _0x39edd1;}function getTicket(_0x4a7f19,_0x382f60,_0x1aec37,_0x24c3c9,_0x25db32,_0x1cf177){return function(_0xfe8ec2){logger[_0x58c2('0xe')]('['+[_0x4a7f19['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0xfe8ec2);return new Promise(function(_0x2ef88a,_0x4775c9){var _0x112fde=_0x4a7f19[_0x58c2('0x2c')]()===_0x58c2('0x35')?_0xfe8ec2['userId']:_0xfe8ec2[_0x58c2('0x25')];var _0x471b5f={'method':_0x58c2('0x20'),'uri':_0x1aec37+_0x58c2('0x36')+'?'+_0x1cf177,'body':Object[_0x58c2('0x37')]({},{'active':_0x58c2('0x19'),'caller_id':_0x112fde,'assigned_to':_0xfe8ec2['userId'],'short_description':intUtil['getString'](_0x24c3c9['Subjects'],_0x25db32,'\x20'),'description':intUtil['getString'](_0x24c3c9[_0x58c2('0x38')],_0x25db32,'\x0a')},getCustomFields(_0x24c3c9[_0x58c2('0x39')],_0x25db32)),'auth':_0x382f60,'json':!![]};return rp(_0x471b5f)[_0x58c2('0x17')](function(_0x17d086){logger[_0x58c2('0xe')]('['+[_0x4a7f19['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x17d086[_0x58c2('0xb')]);_0xfe8ec2[_0x58c2('0x3a')]=_0x17d086[_0x58c2('0xb')][_0x58c2('0xd')];_0xfe8ec2[_0x58c2('0x3b')]=_0x17d086['result'][_0x58c2('0x3c')];logger['info']('['+[_0x4a7f19[_0x58c2('0xf')]()]+_0x58c2('0x3d'),_0xfe8ec2);_0x2ef88a(_0xfe8ec2);})[_0x58c2('0x11')](function(_0x1778c5){logger[_0x58c2('0x12')]('['+[_0x4a7f19['toUpperCase']()]+']',_0x1778c5[_0x58c2('0x13')]);_0x4775c9(_0x1778c5[_0x58c2('0x13')]);});});};}function createRemoteTag(_0xc9939d,_0xb332cc,_0x6632e8,_0x37d59a){return new Promise(function(_0x2c660,_0x12e20a){var _0xeddae5={'method':_0x58c2('0x20'),'uri':_0x6632e8+_0x58c2('0x3e')+'?'+_0x37d59a,'body':{'short_description':_0xc9939d,'global':!![],'active':!![],'name':_0xc9939d},'auth':_0xb332cc,'json':!![]};return rp(_0xeddae5)['then'](function(_0x2aa7e0){var _0x340cf8=_0x2aa7e0[_0x58c2('0xb')][_0x58c2('0xd')];_0x2c660(_0x340cf8);});});}function getRemoteTag(_0x32b36c,_0x100917,_0x43b6ef,_0x3a169a,_0x2e6c83){return new Promise(function(_0x30fd7a,_0x3644f0){var _0x4e1ba6={'method':_0x58c2('0x9'),'uri':_0x43b6ef+_0x58c2('0x3e')+_0x58c2('0x3f')+_0x32b36c+'&'+_0x3a169a,'auth':_0x100917,'json':!![]};return rp(_0x4e1ba6)[_0x58c2('0x17')](function(_0x5b240c){if(_0x5b240c[_0x58c2('0xb')]['length']>0x0){var _0x2fbde9=_0x5b240c[_0x58c2('0xb')][0x0]['sys_id'];_0x30fd7a(_0x2fbde9);}else{return createRemoteTag(_0x32b36c,_0x100917,_0x43b6ef,_0x3a169a)['then'](function(_0x45b1b5){_0x30fd7a(_0x45b1b5);});}});});}function assignTagToIncident(_0x5b94ba,_0x59a3ef,_0x24bca8,_0x3f8e7c,_0x1a39bb){return new Promise(function(_0x128c2c,_0x46b4fb){var _0x421f7d={'method':_0x58c2('0x20'),'uri':_0x24bca8+'label_entry'+'?'+_0x1a39bb,'body':{'label':_0x5b94ba,'table':_0x58c2('0x36'),'id_type':'Incident','table_key':_0x3f8e7c['ticketId'],'title':'Incident\x20-\x20'+_0x3f8e7c[_0x58c2('0x3b')],'id_display':_0x3f8e7c[_0x58c2('0x3b')]},'auth':_0x59a3ef,'json':!![]};return rp(_0x421f7d)[_0x58c2('0x17')](function(_0x2459de){_0x128c2c();})[_0x58c2('0x11')](function(){_0x128c2c();});});}function manageTags(_0x238e6e,_0x4a5dc1,_0x2b25d9,_0x43e2ec,_0x1aa535,_0xeae295,_0x394bc0){return new Promise(function(_0x5438a0,_0x254440){var _0x271f06=[];_0x4a5dc1['forEach'](function(_0x2d38ac){_0x271f06[_0x58c2('0x40')](getRemoteTag(_0x2d38ac,_0x2b25d9,_0x43e2ec,_0xeae295,_0x394bc0));});return Promise['all'](_0x271f06)[_0x58c2('0x17')](function(_0xf2e9ad){if(_0xf2e9ad[_0x58c2('0xc')]){logger[_0x58c2('0xe')]('['+[_0x238e6e[_0x58c2('0xf')]()]+_0x58c2('0x41'),_0xf2e9ad);var _0x60898c=[];_0xf2e9ad[_0x58c2('0x27')](function(_0x370979){_0x60898c[_0x58c2('0x40')](assignTagToIncident(_0x370979,_0x2b25d9,_0x43e2ec,_0x1aa535,_0xeae295));});return Promise[_0x58c2('0x42')](_0x60898c)[_0x58c2('0x17')](function(){_0x5438a0();})[_0x58c2('0x11')](function(){_0x5438a0();});}else{_0x5438a0();}});});}function getTags(_0x42c835,_0x653ec4,_0x32475e,_0x1b2d47,_0x8ab2d3,_0x5d5325){return function(_0x2cfaaa){return new Promise(function(_0x445ec3,_0x1fc133){var _0x42516c=[];var _0x50e780=_0x1b2d47['Tags'];if(_0x50e780&&_0x50e780[_0x58c2('0xc')]>0x0){_0x42516c=_['map'](_0x50e780,_0x58c2('0x33'));}if(_0x42516c[_0x58c2('0xc')]>0x0){return manageTags(_0x42c835,_0x42516c,_0x653ec4,_0x32475e,_0x2cfaaa,_0x8ab2d3,_0x5d5325)[_0x58c2('0x17')](function(){_0x445ec3(_0x2cfaaa);});}else{_0x445ec3(_0x2cfaaa);}});};}function emit(_0x5d13b5,_0x18f1e3,_0x31f8f5){var _0x4c565a=_0x58c2('0x43')+_0x58c2('0x44')+_0x58c2('0x45')+_0x58c2('0x46');var _0x5bb0b5={'uri':_0x5d13b5+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x31f8f5+_0x4c565a};io['to'](util[_0x58c2('0x47')](_0x58c2('0x48'),_0x18f1e3))[_0x58c2('0x49')](_0x58c2('0x4a'),_0x5bb0b5);}exports['cs']=function(_0x1581e5,_0x10bcf4,_0x23d2b8,_0x2bcc83,_0x5edc20,_0x3c6919,_0x5a7e5c,_0x5794de){var _0x20cd72={};var _0x2393a1={'user':_0x3c6919[_0x58c2('0x4b')],'pass':_0x3c6919[_0x58c2('0x4c')]};var _0xbeeb16='sysparm_limit=1';var _0x35687d=_0x58c2('0x4d');_0x3c6919[_0x58c2('0x4e')]=intUtil[_0x58c2('0x4f')](_0x3c6919['remoteUri']);_0x3c6919[_0x58c2('0x50')]=intUtil[_0x58c2('0x4f')](_0x3c6919['serverUrl']);var _0x102d5d=util[_0x58c2('0x47')](_0x58c2('0x51'),_0x3c6919[_0x58c2('0x4e')]);_0x20cd72['userEmail']=!_[_0x58c2('0x52')](_0x2bcc83)?_0x2bcc83['email']:null;_0x20cd72['adminEmail']=_0x3c6919['email'];_0x20cd72[_0x58c2('0x22')]=_0x5794de[_0x58c2('0x2c')]()===_0x58c2('0x35')?_0x10bcf4[_0x58c2('0x53')]:_0x10bcf4[_0x58c2('0x54')];_0x20cd72[_0x58c2('0x55')]=_0x5794de==='queue'||_0x5794de==='abandoned'?_0x58c2('0x56'):'outbound';var _0x3d06d4=util['format'](_0x58c2('0x57'),_0x3c6919[_0x58c2('0x50')],_0x10bcf4[_0x58c2('0x58')],md5(_0x10bcf4[_0x58c2('0x58')]));if(_0x5edc20&&_0x5edc20[_0x58c2('0x59')]){logger['info'](_0x58c2('0x5a'),'Recording\x20is\x20enabled!');_0x10bcf4[_0x58c2('0x5b')]=_0x3d06d4;}else if(_0x5a7e5c&&_0x5a7e5c['recordingFormat']&&_0x5a7e5c[_0x58c2('0x5c')]!=='none'){logger[_0x58c2('0xe')]('[OUTBOUND]',_0x58c2('0x5d'));_0x10bcf4['recordingURL']=_0x3d06d4;}else{_0x10bcf4['recordingURL']='';}return getAdminUser(_0x5794de,_0x2393a1,_0x20cd72,_0x102d5d,_0x35687d,_0xbeeb16)[_0x58c2('0x17')](getUser(_0x5794de,_0x2393a1,_0x102d5d,_0x35687d,_0xbeeb16))[_0x58c2('0x17')](getEndUser(_0x5794de,_0x2393a1,_0x102d5d,_0x35687d,_0xbeeb16))[_0x58c2('0x17')](getTicket(_0x5794de,_0x2393a1,_0x102d5d,_0x23d2b8,_0x10bcf4,_0x35687d))[_0x58c2('0x17')](function(_0x28710e){logger[_0x58c2('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x28710e[_0x58c2('0x3a')]));logger[_0x58c2('0xe')](util[_0x58c2('0x47')](_0x58c2('0x5e'),_0x5794de));if(_0x5794de!==_0x58c2('0x5f')){logger[_0x58c2('0xe')]('['+[_0x5794de['toUpperCase']()]+']',_0x58c2('0x60'));emit(_0x3c6919[_0x58c2('0x4e')],_0x2bcc83[_0x58c2('0x33')],_0x28710e[_0x58c2('0x3a')]);}})[_0x58c2('0x11')](function(_0x40c735){logger['error']('['+[_0x5794de['toUpperCase']()]+_0x58c2('0x61'),util[_0x58c2('0x62')](_0x40c735,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa3e6=['GET','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','type','string','idField','toLowerCase','content','toString','customField','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','POST','assign','Subjects','getString',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','name','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','abandoned','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x3ff0c0,_0x2c8dc1){_0x3ff0c0=_0x3ff0c0-0x0;var _0x23ae45=_0xa3e6[_0x3ff0c0];return _0x23ae45;};'use strict';var _=require(_0x6a3e('0x0'));var Promise=require('bluebird');var rp=require(_0x6a3e('0x1'));var util=require('util');var md5=require(_0x6a3e('0x2'));var Redis=require(_0x6a3e('0x3'));var intUtil=require(_0x6a3e('0x4'));var config=require('../../../../config/environment');var logger=require(_0x6a3e('0x5'))('servicenow');config[_0x6a3e('0x6')]=_[_0x6a3e('0x7')](config[_0x6a3e('0x6')],{'host':_0x6a3e('0x8'),'port':0x18eb});var io=require(_0x6a3e('0x9'))(new Redis(config['redis']));function getAdminUser(_0x3d7fbe,_0x3d2a86,_0x5c3b9f,_0x4891ba,_0x2d2477,_0x5707de){return new Promise(function(_0x54a40c,_0xef2185){var _0x4f5a4a={'method':_0x6a3e('0xa'),'uri':_0x4891ba+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2d2477+'&'+_0x5707de,'auth':_0x3d2a86,'json':!![]};return rp(_0x4f5a4a)[_0x6a3e('0xb')](function(_0x3159db){if(_0x3159db[_0x6a3e('0xc')][_0x6a3e('0xd')]>0x0){_0x5c3b9f[_0x6a3e('0xe')]=_0x3159db[_0x6a3e('0xc')][0x0]['sys_id'];}logger[_0x6a3e('0xf')]('['+[_0x3d7fbe[_0x6a3e('0x10')]()]+_0x6a3e('0x11'),_0x5c3b9f);_0x54a40c(_0x5c3b9f);})[_0x6a3e('0x12')](function(_0x1364be){logger[_0x6a3e('0x13')]('['+[_0x3d7fbe[_0x6a3e('0x10')]()]+']',_0x1364be['message']);_0xef2185(_0x1364be[_0x6a3e('0x14')]);});});}function getUser(_0x13b172,_0x8ed74b,_0x2a62a8,_0x500ccd,_0x462b8d){return function(_0x24666d){logger['info']('['+[_0x13b172['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x24666d);return new Promise(function(_0x58b221,_0x48adf6){if(intUtil[_0x6a3e('0x15')](_0x24666d[_0x6a3e('0x16')])){var _0x31a190={'method':_0x6a3e('0xa'),'uri':_0x2a62a8+_0x6a3e('0x17')+_0x24666d[_0x6a3e('0x16')]+'&'+_0x500ccd+'&'+_0x462b8d,'auth':_0x8ed74b,'json':!![]};logger[_0x6a3e('0xf')]('['+[_0x13b172[_0x6a3e('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x31a190);return rp(_0x31a190)[_0x6a3e('0xb')](function(_0x58b7b9){logger[_0x6a3e('0xf')]('['+[_0x13b172['toUpperCase']()]+_0x6a3e('0x18'),_0x58b7b9);if(_0x58b7b9[_0x6a3e('0xc')][_0x6a3e('0xd')]>0x0&&String(_0x58b7b9[_0x6a3e('0xc')][0x0]['active'])==='true'){_0x24666d[_0x6a3e('0x19')]=_0x58b7b9[_0x6a3e('0xc')][0x0][_0x6a3e('0x1a')];}else{_0x24666d[_0x6a3e('0x19')]=_0x24666d[_0x6a3e('0xe')];_0x24666d[_0x6a3e('0x16')]=_0x24666d[_0x6a3e('0x1b')];}logger[_0x6a3e('0xf')]('['+[_0x13b172[_0x6a3e('0x10')]()]+_0x6a3e('0x1c'),_0x24666d);_0x58b221(_0x24666d);})[_0x6a3e('0x12')](function(_0x359460){logger[_0x6a3e('0x13')]('['+[_0x13b172[_0x6a3e('0x10')]()]+']',_0x359460[_0x6a3e('0x14')]);_0x48adf6(_0x359460['message']);});}else{logger['info']('['+[_0x13b172[_0x6a3e('0x10')]()]+_0x6a3e('0x1d'));_0x24666d[_0x6a3e('0x19')]=_0x24666d[_0x6a3e('0xe')];_0x24666d[_0x6a3e('0x16')]=_0x24666d[_0x6a3e('0x1b')];_0x58b221(_0x24666d);}});};}function createEndUser(_0x411eb9,_0x302205,_0xd87198,_0x436169,_0x3a831b){logger['info']('['+[_0x411eb9['toUpperCase']()]+_0x6a3e('0x1e'),_0xd87198);return new Promise(function(_0x4cda7d,_0x46b13a){var _0x5db820={'method':'POST','uri':_0x436169+_0x6a3e('0x1f')+_0x3a831b,'body':{'user_name':_0xd87198[_0x6a3e('0x20')],'roles':'user','first_name':_0xd87198['endUserNumber'],'active':_0x6a3e('0x21'),'date_format':_0x6a3e('0x22'),'phone':_0xd87198[_0x6a3e('0x20')]},'auth':_0x302205,'json':!![]};return rp(_0x5db820)[_0x6a3e('0xb')](function(_0x584d44){logger['info']('['+[_0x411eb9[_0x6a3e('0x10')]()]+_0x6a3e('0x23'),_0x584d44[_0x6a3e('0xc')]);_0xd87198[_0x6a3e('0x24')]=_0x584d44['result'][_0x6a3e('0x1a')];_0x4cda7d(_0xd87198);})[_0x6a3e('0x12')](function(_0x5022e2){logger['error']('['+[_0x411eb9['toUpperCase']()]+']',_0x5022e2[_0x6a3e('0x14')]);_0x46b13a(_0x5022e2[_0x6a3e('0x14')]);});});}function getEndUser(_0xec468e,_0x257513,_0x432aaa,_0x3691d8,_0x325160){return function(_0x1e497c){logger[_0x6a3e('0xf')]('['+[_0xec468e[_0x6a3e('0x10')]()]+_0x6a3e('0x25'),_0x1e497c);return new Promise(function(_0x23dc3f,_0x2d8ae3){var _0x12469a={'method':_0x6a3e('0xa'),'uri':_0x432aaa+'sys_user?sysparm_query=phone%3D'+_0x1e497c[_0x6a3e('0x20')]+'&'+_0x3691d8+'&'+_0x325160,'auth':_0x257513,'json':!![]};return rp(_0x12469a)[_0x6a3e('0xb')](function(_0xda602f){if(_0xda602f['result'][_0x6a3e('0xd')]>0x0){_0x1e497c[_0x6a3e('0x24')]=_0xda602f['result'][0x0][_0x6a3e('0x1a')];logger[_0x6a3e('0xf')]('['+[_0xec468e[_0x6a3e('0x10')]()]+'],\x20getEndUser\x20crm',_0x1e497c);_0x23dc3f(_0x1e497c);}else{return createEndUser(_0xec468e,_0x257513,_0x1e497c,_0x432aaa,_0x3691d8)[_0x6a3e('0xb')](function(_0x19fa39){logger[_0x6a3e('0xf')]('['+[_0xec468e[_0x6a3e('0x10')]()]+_0x6a3e('0x26'),_0x19fa39);_0x23dc3f(_0x19fa39);});}})[_0x6a3e('0x12')](function(_0x5f4ff5){logger[_0x6a3e('0x13')]('['+[_0xec468e['toUpperCase']()]+']',_0x5f4ff5['message']);_0x2d8ae3(_0x5f4ff5['message']);});});};}function getCustomFields(_0xfbbb78,_0x4bb1ba){var _0x1a6b68={};if(_0xfbbb78[_0x6a3e('0xd')]>0x0){_[_0x6a3e('0x27')](_0xfbbb78,function(_0x16aed9){if(_0x16aed9[_0x6a3e('0x28')]===_0x6a3e('0x29')&&_0x16aed9['nameField']&&!_0x16aed9['customField']){_0x1a6b68[_0x16aed9[_0x6a3e('0x2a')][_0x6a3e('0x2b')]()]=_0x16aed9[_0x6a3e('0x2c')][_0x6a3e('0x2d')]();}else if(_0x16aed9[_0x6a3e('0x28')]==='string'&&_0x16aed9[_0x6a3e('0x2a')]&&_0x16aed9[_0x6a3e('0x2e')]){_0x1a6b68[_0x16aed9['idField'][_0x6a3e('0x2b')]()]=_0x16aed9[_0x6a3e('0x2c')][_0x6a3e('0x2d')]();}else if(_0x16aed9['type']===_0x6a3e('0x2f')&&_0x16aed9[_0x6a3e('0x30')]&&_0x16aed9[_0x6a3e('0x2a')]&&_0x16aed9[_0x6a3e('0x2e')]){_0x1a6b68[_0x16aed9[_0x6a3e('0x2a')][_0x6a3e('0x2b')]()]=_0x4bb1ba[_0x16aed9['variableName']][_0x6a3e('0x2d')]();}else if(_0x16aed9[_0x6a3e('0x28')]===_0x6a3e('0x31')&&_0x16aed9['Variable']&&_0x16aed9[_0x6a3e('0x32')]['name']&&_0x16aed9['idField']&&_0x16aed9[_0x6a3e('0x2e')]){_0x1a6b68[_0x16aed9[_0x6a3e('0x2a')][_0x6a3e('0x2b')]()]=_0x4bb1ba[_0x16aed9['Variable']['name'][_0x6a3e('0x2b')]()][_0x6a3e('0x2d')]();}});}return _0x1a6b68;}function getTicket(_0x42ece3,_0x320530,_0x1c9f75,_0xb084a0,_0x4d8c70,_0x17ffbb){return function(_0x24348c){logger[_0x6a3e('0xf')]('['+[_0x42ece3[_0x6a3e('0x10')]()]+_0x6a3e('0x33'),_0x24348c);return new Promise(function(_0x3dbe12,_0x7bf98f){var _0xb409f8=_0x42ece3[_0x6a3e('0x2b')]()==='outbound'?_0x24348c[_0x6a3e('0x19')]:_0x24348c[_0x6a3e('0x24')];var _0x4f0211={'method':_0x6a3e('0x34'),'uri':_0x1c9f75+'incident'+'?'+_0x17ffbb,'body':Object[_0x6a3e('0x35')]({},{'active':_0x6a3e('0x21'),'caller_id':_0xb409f8,'assigned_to':_0x24348c[_0x6a3e('0x19')],'short_description':intUtil['getString'](_0xb084a0[_0x6a3e('0x36')],_0x4d8c70,'\x20'),'description':intUtil[_0x6a3e('0x37')](_0xb084a0['Descriptions'],_0x4d8c70,'\x0a')},getCustomFields(_0xb084a0['Fields'],_0x4d8c70)),'auth':_0x320530,'json':!![]};return rp(_0x4f0211)['then'](function(_0x2537b6){logger[_0x6a3e('0xf')]('['+[_0x42ece3[_0x6a3e('0x10')]()]+_0x6a3e('0x38'),_0x2537b6[_0x6a3e('0xc')]);_0x24348c[_0x6a3e('0x39')]=_0x2537b6[_0x6a3e('0xc')][_0x6a3e('0x1a')];_0x24348c[_0x6a3e('0x3a')]=_0x2537b6[_0x6a3e('0xc')][_0x6a3e('0x3b')];logger['info']('['+[_0x42ece3[_0x6a3e('0x10')]()]+_0x6a3e('0x3c'),_0x24348c);_0x3dbe12(_0x24348c);})[_0x6a3e('0x12')](function(_0x21ba7b){logger[_0x6a3e('0x13')]('['+[_0x42ece3['toUpperCase']()]+']',_0x21ba7b[_0x6a3e('0x14')]);_0x7bf98f(_0x21ba7b['message']);});});};}function createRemoteTag(_0x1afa0a,_0x37b0c8,_0x4643b9,_0x2cc1ca){return new Promise(function(_0x1a72d1,_0x4be989){var _0x498f2d={'method':'POST','uri':_0x4643b9+_0x6a3e('0x3d')+'?'+_0x2cc1ca,'body':{'short_description':_0x1afa0a,'global':!![],'active':!![],'name':_0x1afa0a},'auth':_0x37b0c8,'json':!![]};return rp(_0x498f2d)[_0x6a3e('0xb')](function(_0x28043a){var _0x1f2858=_0x28043a[_0x6a3e('0xc')][_0x6a3e('0x1a')];_0x1a72d1(_0x1f2858);});});}function getRemoteTag(_0x504d86,_0x1d94e8,_0x5c928d,_0x47b23c,_0x54f666){return new Promise(function(_0xd00794,_0xa1e944){var _0x521003={'method':_0x6a3e('0xa'),'uri':_0x5c928d+_0x6a3e('0x3d')+'?sysparm_query=name%3D'+_0x504d86+'&'+_0x47b23c,'auth':_0x1d94e8,'json':!![]};return rp(_0x521003)[_0x6a3e('0xb')](function(_0x1faf88){if(_0x1faf88[_0x6a3e('0xc')][_0x6a3e('0xd')]>0x0){var _0x93790a=_0x1faf88['result'][0x0][_0x6a3e('0x1a')];_0xd00794(_0x93790a);}else{return createRemoteTag(_0x504d86,_0x1d94e8,_0x5c928d,_0x47b23c)[_0x6a3e('0xb')](function(_0x51d5fb){_0xd00794(_0x51d5fb);});}});});}function assignTagToIncident(_0x132fd9,_0x30fe3b,_0xbfecf4,_0x2603e9,_0x6d143d){return new Promise(function(_0x1028cf,_0x14fd86){var _0x15799b={'method':_0x6a3e('0x34'),'uri':_0xbfecf4+_0x6a3e('0x3e')+'?'+_0x6d143d,'body':{'label':_0x132fd9,'table':_0x6a3e('0x3f'),'id_type':'Incident','table_key':_0x2603e9[_0x6a3e('0x39')],'title':_0x6a3e('0x40')+_0x2603e9[_0x6a3e('0x3a')],'id_display':_0x2603e9['ticketNumber']},'auth':_0x30fe3b,'json':!![]};return rp(_0x15799b)[_0x6a3e('0xb')](function(_0xfbc991){_0x1028cf();})[_0x6a3e('0x12')](function(){_0x1028cf();});});}function manageTags(_0x33e6de,_0x582ad9,_0x3e29a8,_0x5ed33d,_0x4294d7,_0x4f68eb,_0x3a4181){return new Promise(function(_0x486d4a,_0x471e73){var _0x2d5cfe=[];_0x582ad9[_0x6a3e('0x27')](function(_0x1abfd4){_0x2d5cfe[_0x6a3e('0x41')](getRemoteTag(_0x1abfd4,_0x3e29a8,_0x5ed33d,_0x4f68eb,_0x3a4181));});return Promise[_0x6a3e('0x42')](_0x2d5cfe)[_0x6a3e('0xb')](function(_0x54ae99){if(_0x54ae99[_0x6a3e('0xd')]){logger[_0x6a3e('0xf')]('['+[_0x33e6de[_0x6a3e('0x10')]()]+_0x6a3e('0x43'),_0x54ae99);var _0x145655=[];_0x54ae99[_0x6a3e('0x27')](function(_0x1da682){_0x145655[_0x6a3e('0x41')](assignTagToIncident(_0x1da682,_0x3e29a8,_0x5ed33d,_0x4294d7,_0x4f68eb));});return Promise[_0x6a3e('0x42')](_0x145655)[_0x6a3e('0xb')](function(){_0x486d4a();})[_0x6a3e('0x12')](function(){_0x486d4a();});}else{_0x486d4a();}});});}function getTags(_0x318fd9,_0x4b3db4,_0x24c444,_0x40213e,_0x17ed75,_0x5d11f9){return function(_0x4420b9){return new Promise(function(_0x5c349f,_0x3fe425){var _0xf8a75f=[];var _0x4a3924=_0x40213e[_0x6a3e('0x44')];if(_0x4a3924&&_0x4a3924[_0x6a3e('0xd')]>0x0){_0xf8a75f=_['map'](_0x4a3924,_0x6a3e('0x45'));}if(_0xf8a75f[_0x6a3e('0xd')]>0x0){return manageTags(_0x318fd9,_0xf8a75f,_0x4b3db4,_0x24c444,_0x4420b9,_0x17ed75,_0x5d11f9)[_0x6a3e('0xb')](function(){_0x5c349f(_0x4420b9);});}else{_0x5c349f(_0x4420b9);}});};}function emit(_0x177432,_0x12fbb7,_0x52f396){var _0x3f4b95='%26sysparm_record_target%3Dincident'+_0x6a3e('0x46')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x6a3e('0x47');var _0x156bd3={'uri':_0x177432+_0x6a3e('0x48')+_0x52f396+_0x3f4b95};io['to'](util[_0x6a3e('0x49')]('user:%s',_0x12fbb7))['emit'](_0x6a3e('0x4a'),_0x156bd3);}exports['cs']=function(_0x309e1c,_0x48edbf,_0x2704f0,_0x1e11dd,_0x3e5f88,_0x7b8d96,_0x2aec4a,_0x5273d2){var _0x49edcd={};var _0x4429f1={'user':_0x7b8d96[_0x6a3e('0x4b')],'pass':_0x7b8d96[_0x6a3e('0x4c')]};var _0x924f01=_0x6a3e('0x4d');var _0xb5afbb='sysparm_display_value=true';_0x7b8d96[_0x6a3e('0x4e')]=intUtil[_0x6a3e('0x4f')](_0x7b8d96[_0x6a3e('0x4e')]);_0x7b8d96[_0x6a3e('0x50')]=intUtil[_0x6a3e('0x4f')](_0x7b8d96[_0x6a3e('0x50')]);var _0x4916a5=util['format'](_0x6a3e('0x51'),_0x7b8d96[_0x6a3e('0x4e')]);_0x49edcd[_0x6a3e('0x16')]=!_[_0x6a3e('0x52')](_0x1e11dd)?_0x1e11dd[_0x6a3e('0x53')]:null;_0x49edcd[_0x6a3e('0x1b')]=_0x7b8d96[_0x6a3e('0x53')];_0x49edcd[_0x6a3e('0x20')]=_0x5273d2[_0x6a3e('0x2b')]()==='outbound'?_0x48edbf[_0x6a3e('0x54')]:_0x48edbf[_0x6a3e('0x55')];_0x49edcd[_0x6a3e('0x56')]=_0x5273d2===_0x6a3e('0x57')||_0x5273d2===_0x6a3e('0x58')?_0x6a3e('0x57'):_0x6a3e('0x59');var _0x687f86=util['format'](_0x6a3e('0x5a'),_0x7b8d96['serverUrl'],_0x48edbf['uniqueid'],md5(_0x48edbf[_0x6a3e('0x5b')]));if(_0x3e5f88&&_0x3e5f88[_0x6a3e('0x5c')]){logger[_0x6a3e('0xf')]('[QUEUE]',_0x6a3e('0x5d'));_0x48edbf[_0x6a3e('0x5e')]=_0x687f86;}else if(_0x2aec4a&&_0x2aec4a[_0x6a3e('0x5f')]&&_0x2aec4a[_0x6a3e('0x5f')]!==_0x6a3e('0x60')){logger[_0x6a3e('0xf')](_0x6a3e('0x61'),_0x6a3e('0x5d'));_0x48edbf[_0x6a3e('0x5e')]=_0x687f86;}else{_0x48edbf['recordingURL']='';}return getAdminUser(_0x5273d2,_0x4429f1,_0x49edcd,_0x4916a5,_0xb5afbb,_0x924f01)[_0x6a3e('0xb')](getUser(_0x5273d2,_0x4429f1,_0x4916a5,_0xb5afbb,_0x924f01))[_0x6a3e('0xb')](getEndUser(_0x5273d2,_0x4429f1,_0x4916a5,_0xb5afbb,_0x924f01))[_0x6a3e('0xb')](getTicket(_0x5273d2,_0x4429f1,_0x4916a5,_0x2704f0,_0x48edbf,_0xb5afbb))[_0x6a3e('0xb')](function(_0x427b8e){logger[_0x6a3e('0xf')](util[_0x6a3e('0x49')](_0x6a3e('0x62'),_0x427b8e[_0x6a3e('0x39')]));logger[_0x6a3e('0xf')](util[_0x6a3e('0x49')]('call\x20direction:\x20%s',_0x5273d2));if(_0x5273d2!=='abandoned'){logger[_0x6a3e('0xf')]('['+[_0x5273d2[_0x6a3e('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x7b8d96['remoteUri'],_0x1e11dd[_0x6a3e('0x45')],_0x427b8e['ticketId']);}})[_0x6a3e('0x12')](function(_0x7bf1b2){logger[_0x6a3e('0x13')]('['+[_0x5273d2[_0x6a3e('0x10')]()]+_0x6a3e('0x63'),util['inspect'](_0x7bf1b2,{'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 5bcc0a8..ed690fb 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 _0x8857=['calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','abandoned','[ABANDONED]','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_type','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','first_name','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','variable','customVariable','Variable','custom_fields','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x3b2bc5,_0x3b5374){var _0x1fc7f5=function(_0x1d7546){while(--_0x1d7546){_0x3b2bc5['push'](_0x3b2bc5['shift']());}};_0x1fc7f5(++_0x3b5374);}(_0x8857,0x90));var _0x7885=function(_0x44f369,_0x2ee517){_0x44f369=_0x44f369-0x0;var _0x221d6b=_0x8857[_0x44f369];return _0x221d6b;};'use strict';var _=require(_0x7885('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x7885('0x1'));var util=require(_0x7885('0x2'));var Redis=require(_0x7885('0x3'));var intUtil=require(_0x7885('0x4'));var config=require(_0x7885('0x5'));var logger=require(_0x7885('0x6'))('sugarcrm');config['redis']=_[_0x7885('0x7')](config[_0x7885('0x8')],{'host':_0x7885('0x9'),'port':0x18eb});var io=require(_0x7885('0xa'))(new Redis(config[_0x7885('0x8')]));var def={'method':_0x7885('0xb'),'json':!![]};function emit(_0x3f5117,_0x4344ee,_0x33c24c){io['to'](_0x3f5117)['emit'](_0x4344ee,_0x33c24c);}function getTicket(_0x388309,_0xfffd22,_0xeab67f,_0x3a8b5d,_0x11286f,_0x5f55f7,_0x5772a0,_0x3c7c24){logger[_0x7885('0xc')](_0x7885('0xd'));var _0x2dcf01=new Date();var _0x4b1375=[{'name':_0x7885('0xe'),'value':intUtil['getString'](_0x3a8b5d[_0x7885('0xf')],_0x11286f,'\x20')},{'name':_0x7885('0x10'),'value':_0xfffd22['id']},{'name':'created_by','value':_0xfffd22['id']},{'name':'description','value':intUtil[_0x7885('0x11')](_0x3a8b5d[_0x7885('0x12')],_0x11286f,'\x0a')},{'name':_0x7885('0x13'),'value':_0x2dcf01[_0x7885('0x14')]()[_0x7885('0x15')](0x0,0x13)[_0x7885('0x16')]('T','\x20')},{'name':_0x7885('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0xeab67f['id']},{'name':_0x7885('0x18'),'value':'Contacts'},{'name':_0x7885('0x19'),'value':_0xeab67f[_0x7885('0xe')]},{'name':_0x7885('0x1a'),'value':_0x3c7c24}];if(_0x5f55f7[_0x7885('0x1b')]){_[_0x7885('0x1c')](_0x5f55f7,function(_0x1f30b4){if(_0x11286f[_0x1f30b4[_0x7885('0x1d')]]){_0x4b1375[_0x7885('0x1e')]({'name':_0x1f30b4[_0x7885('0x1f')],'value':_0x11286f[_0x1f30b4[_0x7885('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x7885('0x20'),'response_type':_0x7885('0x20'),'rest_data':JSON[_0x7885('0x21')]({'session':_0x5772a0['id'],'module_name':'Calls','name_value_list':_0x4b1375})}});}function getAuth(_0x19b786){return util[_0x7885('0x22')](_0x7885('0x23'),new Buffer(_0x19b786['apiKey']+':X')[_0x7885('0x24')](_0x7885('0x25')));}function getServerInfo(_0x894a6){return request({'form':{'method':_0x7885('0x26'),'input_type':_0x7885('0x20'),'response_type':'JSON','rest_data':JSON[_0x7885('0x21')]({'session':_0x894a6['id']})}});}function getUser(_0x33e7cd,_0x4c371d,_0x556943){if(!_[_0x7885('0x27')](_0x4c371d)){logger['info'](_0x7885('0x28'),_0x4c371d);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x7885('0x20'),'rest_data':JSON[_0x7885('0x21')]({'session':_0x556943['id'],'module_name':'Employees','query':util[_0x7885('0x22')](_0x7885('0x29'),_0x4c371d),'order_by':'','offset':'0','select_fields':['id',_0x7885('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7885('0x2a')](function(_0x351cf1){if(_0x351cf1['entry_list'][_0x7885('0x1b')]){var _0xc67cf9=_['find'](_0x351cf1[_0x7885('0x2b')],function(_0x129a62){return _0x129a62[_0x7885('0x2c')][_0x7885('0x2d')][_0x7885('0x2e')]===_0x4c371d;});if(_0xc67cf9){logger[_0x7885('0xc')](_0x7885('0x2f'));return BPromise[_0x7885('0x30')]({'id':_0xc67cf9[_0x7885('0x2c')]['id'][_0x7885('0x2e')],'name':_0xc67cf9[_0x7885('0x2c')]['name'][_0x7885('0x2e')]});}}logger[_0x7885('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7885('0x30')]({'id':_0x556943[_0x7885('0x2c')][_0x7885('0x31')][_0x7885('0x2e')],'name':_0x556943[_0x7885('0x2c')][_0x7885('0x2d')][_0x7885('0x2e')]});});}else{logger[_0x7885('0xc')](_0x7885('0x32'));return BPromise[_0x7885('0x30')]({'id':_0x556943[_0x7885('0x2c')]['user_id'][_0x7885('0x2e')],'name':_0x556943[_0x7885('0x2c')]['user_name'][_0x7885('0x2e')]});}}function getEndUser(_0x53a45b,_0x24cc09,_0x2fada1,_0x1564f3){logger[_0x7885('0xc')]('Searching\x20enduser\x20with\x20phone',_0x2fada1);return request({'form':{'method':_0x7885('0x33'),'input_type':'JSON','response_type':_0x7885('0x20'),'rest_data':JSON['stringify']({'session':_0x1564f3['id'],'module_name':_0x7885('0x34'),'query':util[_0x7885('0x22')](_0x7885('0x35'),_0x2fada1),'order_by':'','offset':'0','select_fields':['id',_0x7885('0xe'),_0x7885('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7885('0x2a')](function(_0x29cd3a){if(_0x29cd3a['entry_list'][_0x7885('0x1b')]){var _0x23aecc=_[_0x7885('0x37')](_0x29cd3a['entry_list'],function(_0x28a553){return _0x28a553['name_value_list']['phone_home']['value']===_0x2fada1;});if(_0x23aecc){logger[_0x7885('0xc')](_0x7885('0x38'));return BPromise[_0x7885('0x30')]({'id':_0x23aecc[_0x7885('0x2c')]['id'][_0x7885('0x2e')],'name':_0x23aecc[_0x7885('0x2c')]['name'][_0x7885('0x2e')],'phone':_0x23aecc['name_value_list'][_0x7885('0x36')][_0x7885('0x2e')]});}}else{logger['info'](_0x7885('0x39'));return request({'form':{'method':_0x7885('0x3a'),'input_type':_0x7885('0x20'),'response_type':_0x7885('0x20'),'rest_data':JSON[_0x7885('0x21')]({'session':_0x1564f3['id'],'module_name':_0x7885('0x34'),'name_value_list':[{'name':'first_name','value':_0x24cc09!==_0x7885('0x3b')?_0x24cc09:util['format']('Caller\x20-\x20%s',_0x2fada1)},{'name':_0x7885('0x36'),'value':_0x2fada1}]})}})[_0x7885('0x2a')](function(_0x5a128f){logger[_0x7885('0xc')]('Enduser\x20created.');return BPromise[_0x7885('0x30')]({'id':_0x5a128f['id'],'name':_0x5a128f[_0x7885('0x2b')][_0x7885('0x3c')][_0x7885('0x2e')],'phone':_0x5a128f['entry_list']['phone_home'][_0x7885('0x2e')]});});}});}function request(_0x59b775){logger[_0x7885('0x3d')](_0x7885('0x3e'),JSON['stringify'](_0x59b775));return rp(_[_0x7885('0x3f')](def,_0x59b775));}function getTags(_0x3d217e,_0x21bc34){var _0x3ef661=[];if(_0x3d217e&&_0x3d217e[_0x7885('0x1b')]>0x0){_0x3ef661=_['map'](_0x3d217e,_0x21bc34);}return _0x3ef661;}function getCustomFields(_0x409fec,_0x1a5417){var _0x4a1bf9=[];var _0x2b0918={'custom_fields':[]};if(_0x409fec[_0x7885('0x1b')]>0x0){_[_0x7885('0x1c')](_0x409fec,function(_0x4f81bd){if(_0x4f81bd[_0x7885('0x40')]===_0x7885('0x41')&&_0x4f81bd[_0x7885('0x42')]&&!_0x4f81bd[_0x7885('0x43')]){_0x2b0918[_0x4f81bd[_0x7885('0x42')][_0x7885('0x44')]()]=_0x4f81bd[_0x7885('0x45')][_0x7885('0x24')]();}else if(_0x4f81bd[_0x7885('0x40')]===_0x7885('0x41')&&_0x4f81bd['idField']&&_0x4f81bd['customField']){_0x2b0918['custom_fields'][_0x7885('0x1e')]({'id':_0x4f81bd['idField'],'value':_0x4f81bd[_0x7885('0x45')]['toString']()});}else if(_0x4f81bd[_0x7885('0x40')]===_0x7885('0x46')&&_0x4f81bd[_0x7885('0x1d')]&&_0x4f81bd[_0x7885('0x1f')]&&_0x4f81bd[_0x7885('0x43')]){_0x1a5417[_0x4f81bd[_0x7885('0x1d')]]&&_0x2b0918['custom_fields']['push']({'id':_0x4f81bd[_0x7885('0x1f')],'value':_0x1a5417[_0x4f81bd['variableName']][_0x7885('0x24')]()});}else if(_0x4f81bd[_0x7885('0x40')]===_0x7885('0x47')&&_0x4f81bd[_0x7885('0x48')]&&_0x4f81bd[_0x7885('0x48')][_0x7885('0xe')]&&_0x4f81bd[_0x7885('0x1f')]&&_0x4f81bd[_0x7885('0x43')]){_0x1a5417[_0x4f81bd[_0x7885('0x48')][_0x7885('0xe')][_0x7885('0x44')]()]&&_0x2b0918[_0x7885('0x49')][_0x7885('0x1e')]({'id':_0x4f81bd['idField'],'value':_0x1a5417[_0x4f81bd['Variable']['name'][_0x7885('0x44')]()][_0x7885('0x24')]()});}});}return _0x2b0918;}function getConnection(_0xa034a4){return request({'method':_0x7885('0xb'),'form':{'method':_0x7885('0x4a'),'input_type':_0x7885('0x20'),'response_type':_0x7885('0x20'),'rest_data':JSON[_0x7885('0x21')]({'user_auth':{'user_name':_0xa034a4['username'],'password':_0xa034a4['password'],'encryption':_0x7885('0x4b')},'application':_0x7885('0x4c')})}})[_0x7885('0x2a')](function(_0x1af010){var _0x44a8ea=_0x1af010;if(_0x44a8ea['id']){def[_0x7885('0x4d')]=_0x44a8ea['id'];return BPromise['resolve'](_0x44a8ea);}else{throw new Error(util['format'](_0x7885('0x4e'),_0xa034a4['id']));}});}function setRelationship(_0x32feec,_0x3dc938,_0x331f57,_0x1e2999){return request({'form':{'method':_0x7885('0x4f'),'input_type':_0x7885('0x20'),'response_type':'JSON','rest_data':JSON[_0x7885('0x21')]({'session':_0x32feec['id'],'module_name':'Calls','module_id':_0x331f57['id'],'link_field_name':_0x1e2999,'related_ids':[_0x3dc938['id']]})}});}exports['queue']=function(_0x5a0a4c,_0x379ece,_0x2b5131,_0x5264ea,_0x22a745,_0x43fc6b){var _0x875ffd,_0x421587,_0x34eb44,_0x467aa7;_0x43fc6b[_0x7885('0x50')]=intUtil[_0x7885('0x51')](_0x43fc6b[_0x7885('0x50')]);_0x43fc6b['serverUrl']=intUtil[_0x7885('0x51')](_0x43fc6b[_0x7885('0x52')]);def[_0x7885('0x53')]=util[_0x7885('0x22')](_0x7885('0x54'),_0x43fc6b[_0x7885('0x50')]);if(_0x22a745&&_0x22a745[_0x7885('0x55')]){logger[_0x7885('0xc')](_0x7885('0x56'),_0x7885('0x57'));_0x379ece[_0x7885('0x58')]=util[_0x7885('0x22')](_0x7885('0x59'),_0x43fc6b['serverUrl'],_0x379ece[_0x7885('0x5a')],md5(_0x379ece[_0x7885('0x5a')]));}else{_0x379ece[_0x7885('0x58')]='';}return getConnection(_0x43fc6b)[_0x7885('0x2a')](function(_0x490b2b){_0x467aa7=_0x490b2b;return getUser(_0x43fc6b,_0x5264ea[_0x7885('0xe')],_0x467aa7);})[_0x7885('0x2a')](function(_0x388507){_0x875ffd=_0x388507;logger[_0x7885('0xc')](_0x7885('0x5b'),_0x875ffd['id']);return getEndUser(_0x43fc6b,_0x379ece[_0x7885('0x5c')],_0x379ece[_0x7885('0x5d')],_0x467aa7);})[_0x7885('0x2a')](function(_0x8f2105){_0x421587=_0x8f2105;logger[_0x7885('0xc')]('The\x20Enduser\x20ID\x20is:',_0x421587['id']);return getTicket(_0x43fc6b,_0x875ffd,_0x421587,_0x2b5131,_0x379ece,_0x2b5131[_0x7885('0x5e')],_0x467aa7,_0x7885('0x5f'));})[_0x7885('0x2a')](function(_0x30b987){_0x34eb44=_0x30b987;logger[_0x7885('0xc')](_0x7885('0x60'));logger[_0x7885('0xc')](_0x7885('0x61'),_0x34eb44['id']);return setRelationship(_0x467aa7,_0x875ffd,_0x34eb44,_0x7885('0x62'));})[_0x7885('0x2a')](function(){return setRelationship(_0x467aa7,_0x421587,_0x34eb44,_0x7885('0x63'));})[_0x7885('0x2a')](function(){return getServerInfo(_0x467aa7);})[_0x7885('0x2a')](function(_0x3b0c96){var _0x18e695=parseInt(_0x3b0c96[_0x7885('0x64')]['charAt'](0x0));var _0x45bc8e=util[_0x7885('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x43fc6b['remoteUri'],_0x34eb44['id']);if(_0x18e695>0x6){_0x45bc8e=util['format'](_0x7885('0x65'),_0x43fc6b['remoteUri'],_0x34eb44['id']);}logger['info']('[QUEUE]',_0x7885('0x66'));emit(util[_0x7885('0x22')](_0x7885('0x67'),_0x5264ea[_0x7885('0xe')]),'trigger:browser:url',{'uri':_0x45bc8e});})[_0x7885('0x68')](function(_0x46e2e7){logger[_0x7885('0x69')](_0x7885('0x56'),JSON['stringify'](_0x46e2e7));});};exports[_0x7885('0x6a')]=function(_0x22a2bf,_0xf1b456,_0x2ce35e,_0x41d713,_0x3881fa,_0x552ef0,_0x9534a3){var _0xf7e84b,_0x46ba97,_0x9ab18b,_0x2d4b61;_0x552ef0[_0x7885('0x50')]=intUtil[_0x7885('0x51')](_0x552ef0[_0x7885('0x50')]);_0x552ef0[_0x7885('0x52')]=intUtil[_0x7885('0x51')](_0x552ef0[_0x7885('0x52')]);def['uri']=util[_0x7885('0x22')](_0x7885('0x54'),_0x552ef0[_0x7885('0x50')]);if(_0x9534a3&&_0x9534a3[_0x7885('0x6b')]&&_0x9534a3[_0x7885('0x6b')]!=='none'){logger['info'](_0x7885('0x6c'),_0x7885('0x57'));_0xf1b456[_0x7885('0x58')]=util[_0x7885('0x22')](_0x7885('0x59'),_0x552ef0[_0x7885('0x52')],_0xf1b456[_0x7885('0x5a')],md5(_0xf1b456['uniqueid']));}return getConnection(_0x552ef0)[_0x7885('0x2a')](function(_0x42c493){_0x2d4b61=_0x42c493;return getUser(_0x552ef0,_0x41d713[_0x7885('0xe')],_0x2d4b61);})[_0x7885('0x2a')](function(_0x584654){_0xf7e84b=_0x584654;logger['info'](_0x7885('0x5b'),_0xf7e84b['id']);return getEndUser(_0x552ef0,_0xf1b456[_0x7885('0x6d')],_0xf1b456[_0x7885('0x6e')],_0x2d4b61);})[_0x7885('0x2a')](function(_0x49c63a){_0x46ba97=_0x49c63a;logger[_0x7885('0xc')](_0x7885('0x6f'),_0x46ba97['id']);return getTicket(_0x552ef0,_0xf7e84b,_0x46ba97,_0x2ce35e,_0xf1b456,_0x2ce35e[_0x7885('0x5e')],_0x2d4b61,_0x7885('0x70'));})[_0x7885('0x2a')](function(_0x4eae1d){_0x9ab18b=_0x4eae1d;logger['info'](_0x7885('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x9ab18b['id']);return setRelationship(_0x2d4b61,_0xf7e84b,_0x9ab18b,_0x7885('0x62'));})['then'](function(){return setRelationship(_0x2d4b61,_0x46ba97,_0x9ab18b,_0x7885('0x63'));})[_0x7885('0x2a')](function(){return getServerInfo(_0x2d4b61);})[_0x7885('0x2a')](function(_0x31e6fd){var _0x440011=parseInt(_0x31e6fd[_0x7885('0x64')][_0x7885('0x71')](0x0));var _0x199256=util['format'](_0x7885('0x72'),_0x552ef0[_0x7885('0x50')],_0x9ab18b['id']);if(_0x440011>0x6){_0x199256=util['format'](_0x7885('0x65'),_0x552ef0['remoteUri'],_0x9ab18b['id']);}logger[_0x7885('0xc')](_0x7885('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7885('0x22')](_0x7885('0x67'),_0x41d713['name']),_0x7885('0x73'),{'uri':_0x199256});})['catch'](function(_0x448a98){logger[_0x7885('0x69')]('[OUTBOUND]',JSON['stringify'](_0x448a98));});};exports[_0x7885('0x74')]=function(_0x4d3a0c,_0x6a38e9,_0x3d89a7,_0xb894b5,_0x51e236,_0x49415b){var _0x57f3af,_0x4b743a,_0x380a0d,_0x5d7f3d;_0x49415b[_0x7885('0x50')]=intUtil['stripTrailingSlash'](_0x49415b[_0x7885('0x50')]);_0x49415b['serverUrl']=intUtil[_0x7885('0x51')](_0x49415b[_0x7885('0x52')]);def[_0x7885('0x53')]=util['format']('%s/service/v4_1/rest.php',_0x49415b[_0x7885('0x50')]);if(_0x51e236&&_0x51e236[_0x7885('0x55')]){logger[_0x7885('0xc')]('[ABANDONED]',_0x7885('0x57'));_0x6a38e9['recordingURL']=util[_0x7885('0x22')](_0x7885('0x59'),_0x49415b['serverUrl'],_0x6a38e9['uniqueid'],md5(_0x6a38e9['uniqueid']));}else{_0x6a38e9[_0x7885('0x58')]='';}return getConnection(_0x49415b)[_0x7885('0x2a')](function(_0x5a5c11){_0x5d7f3d=_0x5a5c11;if(!_[_0x7885('0x27')](_0xb894b5)){return getUser(_0x49415b,_0xb894b5[_0x7885('0xe')],_0x5d7f3d);}else{return getUser(_0x49415b,null,_0x5d7f3d);}})['then'](function(_0x300fc4){_0x57f3af=_0x300fc4;logger['info'](_0x7885('0x5b'),_0x57f3af['id']);return getEndUser(_0x49415b,_0x6a38e9[_0x7885('0x5c')],_0x6a38e9[_0x7885('0x5d')],_0x5d7f3d);})[_0x7885('0x2a')](function(_0x12b1f4){_0x4b743a=_0x12b1f4;logger[_0x7885('0xc')](_0x7885('0x6f'),_0x4b743a['id']);return getTicket(_0x49415b,_0x57f3af,_0x4b743a,_0x3d89a7,_0x6a38e9,_0x3d89a7[_0x7885('0x5e')],_0x5d7f3d,_0x7885('0x5f'));})[_0x7885('0x2a')](function(_0x46f300){_0x380a0d=_0x46f300;logger[_0x7885('0xc')](_0x7885('0x60'));logger['info'](_0x7885('0x61'),_0x380a0d['id']);return setRelationship(_0x5d7f3d,_0x57f3af,_0x380a0d,_0x7885('0x62'));})[_0x7885('0x2a')](function(){return setRelationship(_0x5d7f3d,_0x4b743a,_0x380a0d,'contacts');})['then'](function(){return getServerInfo(_0x5d7f3d);})[_0x7885('0x68')](function(_0x22f85e){logger[_0x7885('0x69')](_0x7885('0x75'),JSON[_0x7885('0x21')](_0x22f85e));});}; \ No newline at end of file +var _0xb757=['user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','[ABANDONED]','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','name','getString','Subjects','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','Contacts','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','type','nameField','string','push','customField','customVariable','Variable','toLowerCase','login','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0xb757,0x85));var _0x7b75=function(_0x4af0ed,_0x735b6f){_0x4af0ed=_0x4af0ed-0x0;var _0x63e4d3=_0xb757[_0x4af0ed];return _0x63e4d3;};'use strict';var _=require(_0x7b75('0x0'));var rp=require(_0x7b75('0x1'));var BPromise=require(_0x7b75('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x7b75('0x3'));var intUtil=require(_0x7b75('0x4'));var config=require(_0x7b75('0x5'));var logger=require(_0x7b75('0x6'))(_0x7b75('0x7'));config['redis']=_[_0x7b75('0x8')](config[_0x7b75('0x9')],{'host':_0x7b75('0xa'),'port':0x18eb});var io=require(_0x7b75('0xb'))(new Redis(config[_0x7b75('0x9')]));var def={'method':_0x7b75('0xc'),'json':!![]};function emit(_0x48a5cb,_0x46fad4,_0x1e7151){io['to'](_0x48a5cb)[_0x7b75('0xd')](_0x46fad4,_0x1e7151);}function getTicket(_0x476a23,_0x40d6c2,_0x8a8960,_0x23d62f,_0x1bb252,_0x147417,_0x9520b2,_0x4b508a){logger['info']('Creating\x20new\x20ticket...');var _0x1be15c=new Date();var _0xc598e0=[{'name':_0x7b75('0xe'),'value':intUtil[_0x7b75('0xf')](_0x23d62f[_0x7b75('0x10')],_0x1bb252,'\x20')},{'name':'assigned_user_id','value':_0x40d6c2['id']},{'name':'created_by','value':_0x40d6c2['id']},{'name':_0x7b75('0x11'),'value':intUtil[_0x7b75('0xf')](_0x23d62f[_0x7b75('0x12')],_0x1bb252,'\x0a')},{'name':_0x7b75('0x13'),'value':_0x1be15c[_0x7b75('0x14')]()[_0x7b75('0x15')](0x0,0x13)[_0x7b75('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x7b75('0x17'),'value':'15'},{'name':_0x7b75('0x18'),'value':_0x8a8960['id']},{'name':'parent_type','value':_0x7b75('0x19')},{'name':'parent_name','value':_0x8a8960[_0x7b75('0xe')]},{'name':'direction','value':_0x4b508a}];if(_0x147417['length']){_[_0x7b75('0x1a')](_0x147417,function(_0x2f832c){if(_0x1bb252[_0x2f832c[_0x7b75('0x1b')]]){_0xc598e0['push']({'name':_0x2f832c[_0x7b75('0x1c')],'value':_0x1bb252[_0x2f832c['variableName']]});}});}return request({'form':{'method':_0x7b75('0x1d'),'input_type':'JSON','response_type':_0x7b75('0x1e'),'rest_data':JSON[_0x7b75('0x1f')]({'session':_0x9520b2['id'],'module_name':_0x7b75('0x20'),'name_value_list':_0xc598e0})}});}function getAuth(_0x988b56){return util[_0x7b75('0x21')](_0x7b75('0x22'),new Buffer(_0x988b56[_0x7b75('0x23')]+':X')[_0x7b75('0x24')](_0x7b75('0x25')));}function getServerInfo(_0x4ef24f){return request({'form':{'method':_0x7b75('0x26'),'input_type':'JSON','response_type':_0x7b75('0x1e'),'rest_data':JSON[_0x7b75('0x1f')]({'session':_0x4ef24f['id']})}});}function getUser(_0x401d7b,_0x3e9b24,_0x1e14f5){if(!_[_0x7b75('0x27')](_0x3e9b24)){logger[_0x7b75('0x28')](_0x7b75('0x29'),_0x3e9b24);return request({'form':{'method':_0x7b75('0x2a'),'input_type':_0x7b75('0x1e'),'response_type':_0x7b75('0x1e'),'rest_data':JSON['stringify']({'session':_0x1e14f5['id'],'module_name':_0x7b75('0x2b'),'query':util[_0x7b75('0x21')](_0x7b75('0x2c'),_0x3e9b24),'order_by':'','offset':'0','select_fields':['id',_0x7b75('0xe'),_0x7b75('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7b75('0x2e')](function(_0x4d1c53){if(_0x4d1c53[_0x7b75('0x2f')]['length']){var _0x2b0357=_[_0x7b75('0x30')](_0x4d1c53[_0x7b75('0x2f')],function(_0x2e9a61){return _0x2e9a61[_0x7b75('0x31')]['user_name'][_0x7b75('0x32')]===_0x3e9b24;});if(_0x2b0357){logger[_0x7b75('0x28')]('Agent\x20found!');return BPromise['resolve']({'id':_0x2b0357[_0x7b75('0x31')]['id'][_0x7b75('0x32')],'name':_0x2b0357[_0x7b75('0x31')][_0x7b75('0xe')]['value']});}}logger[_0x7b75('0x28')](_0x7b75('0x33'));return BPromise[_0x7b75('0x34')]({'id':_0x1e14f5['name_value_list'][_0x7b75('0x35')][_0x7b75('0x32')],'name':_0x1e14f5['name_value_list']['user_name'][_0x7b75('0x32')]});});}else{logger[_0x7b75('0x28')](_0x7b75('0x36'));return BPromise[_0x7b75('0x34')]({'id':_0x1e14f5[_0x7b75('0x31')][_0x7b75('0x35')][_0x7b75('0x32')],'name':_0x1e14f5[_0x7b75('0x31')][_0x7b75('0x2d')][_0x7b75('0x32')]});}}function getEndUser(_0x2ba762,_0x56a7f4,_0x33b843,_0xf1ac6b){logger[_0x7b75('0x28')](_0x7b75('0x37'),_0x33b843);return request({'form':{'method':'get_entry_list','input_type':_0x7b75('0x1e'),'response_type':_0x7b75('0x1e'),'rest_data':JSON['stringify']({'session':_0xf1ac6b['id'],'module_name':_0x7b75('0x19'),'query':util['format'](_0x7b75('0x38'),_0x33b843),'order_by':'','offset':'0','select_fields':['id',_0x7b75('0xe'),_0x7b75('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x36af1c){if(_0x36af1c[_0x7b75('0x2f')][_0x7b75('0x3a')]){var _0x36cf36=_[_0x7b75('0x30')](_0x36af1c['entry_list'],function(_0x238e86){return _0x238e86[_0x7b75('0x31')]['phone_home'][_0x7b75('0x32')]===_0x33b843;});if(_0x36cf36){logger[_0x7b75('0x28')](_0x7b75('0x3b'));return BPromise[_0x7b75('0x34')]({'id':_0x36cf36[_0x7b75('0x31')]['id']['value'],'name':_0x36cf36[_0x7b75('0x31')][_0x7b75('0xe')][_0x7b75('0x32')],'phone':_0x36cf36[_0x7b75('0x31')][_0x7b75('0x39')][_0x7b75('0x32')]});}}else{logger[_0x7b75('0x28')](_0x7b75('0x3c'));return request({'form':{'method':_0x7b75('0x1d'),'input_type':'JSON','response_type':_0x7b75('0x1e'),'rest_data':JSON[_0x7b75('0x1f')]({'session':_0xf1ac6b['id'],'module_name':'Contacts','name_value_list':[{'name':_0x7b75('0x3d'),'value':_0x56a7f4!==_0x7b75('0x3e')?_0x56a7f4:util[_0x7b75('0x21')](_0x7b75('0x3f'),_0x33b843)},{'name':_0x7b75('0x39'),'value':_0x33b843}]})}})[_0x7b75('0x2e')](function(_0x252c8a){logger[_0x7b75('0x28')](_0x7b75('0x40'));return BPromise['resolve']({'id':_0x252c8a['id'],'name':_0x252c8a[_0x7b75('0x2f')]['first_name'][_0x7b75('0x32')],'phone':_0x252c8a[_0x7b75('0x2f')][_0x7b75('0x39')][_0x7b75('0x32')]});});}});}function request(_0x5dbc80){logger[_0x7b75('0x41')](_0x7b75('0x42'),JSON['stringify'](_0x5dbc80));return rp(_['merge'](def,_0x5dbc80));}function getTags(_0x53dd37,_0x4bcf44){var _0x753f77=[];if(_0x53dd37&&_0x53dd37[_0x7b75('0x3a')]>0x0){_0x753f77=_['map'](_0x53dd37,_0x4bcf44);}return _0x753f77;}function getCustomFields(_0x3e7c58,_0x45bc29){var _0x57293d=[];var _0x477e5a={'custom_fields':[]};if(_0x3e7c58[_0x7b75('0x3a')]>0x0){_[_0x7b75('0x1a')](_0x3e7c58,function(_0x112833){if(_0x112833[_0x7b75('0x43')]==='string'&&_0x112833['nameField']&&!_0x112833['customField']){_0x477e5a[_0x112833[_0x7b75('0x44')]['toLowerCase']()]=_0x112833['content']['toString']();}else if(_0x112833[_0x7b75('0x43')]===_0x7b75('0x45')&&_0x112833[_0x7b75('0x1c')]&&_0x112833['customField']){_0x477e5a['custom_fields'][_0x7b75('0x46')]({'id':_0x112833['idField'],'value':_0x112833['content'][_0x7b75('0x24')]()});}else if(_0x112833[_0x7b75('0x43')]==='variable'&&_0x112833['variableName']&&_0x112833['idField']&&_0x112833[_0x7b75('0x47')]){_0x45bc29[_0x112833['variableName']]&&_0x477e5a['custom_fields']['push']({'id':_0x112833[_0x7b75('0x1c')],'value':_0x45bc29[_0x112833['variableName']][_0x7b75('0x24')]()});}else if(_0x112833['type']===_0x7b75('0x48')&&_0x112833[_0x7b75('0x49')]&&_0x112833[_0x7b75('0x49')][_0x7b75('0xe')]&&_0x112833[_0x7b75('0x1c')]&&_0x112833['customField']){_0x45bc29[_0x112833[_0x7b75('0x49')]['name'][_0x7b75('0x4a')]()]&&_0x477e5a['custom_fields'][_0x7b75('0x46')]({'id':_0x112833['idField'],'value':_0x45bc29[_0x112833[_0x7b75('0x49')][_0x7b75('0xe')][_0x7b75('0x4a')]()][_0x7b75('0x24')]()});}});}return _0x477e5a;}function getConnection(_0x411bca){return request({'method':_0x7b75('0xc'),'form':{'method':_0x7b75('0x4b'),'input_type':_0x7b75('0x1e'),'response_type':_0x7b75('0x1e'),'rest_data':JSON[_0x7b75('0x1f')]({'user_auth':{'user_name':_0x411bca['username'],'password':_0x411bca[_0x7b75('0x4c')],'encryption':_0x7b75('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x4b4551){var _0x12c99c=_0x4b4551;if(_0x12c99c['id']){def['sessionID']=_0x12c99c['id'];return BPromise['resolve'](_0x12c99c);}else{throw new Error(util[_0x7b75('0x21')](_0x7b75('0x4e'),_0x411bca['id']));}});}function setRelationship(_0x456158,_0xbc5db,_0x3e4f71,_0x266daf){return request({'form':{'method':'set_relationship','input_type':_0x7b75('0x1e'),'response_type':_0x7b75('0x1e'),'rest_data':JSON[_0x7b75('0x1f')]({'session':_0x456158['id'],'module_name':_0x7b75('0x20'),'module_id':_0x3e4f71['id'],'link_field_name':_0x266daf,'related_ids':[_0xbc5db['id']]})}});}exports[_0x7b75('0x4f')]=function(_0x50b708,_0x2cfd1e,_0x26ee91,_0x119cb5,_0x32cee9,_0x1da134){var _0x24ba1c,_0xee18d,_0x2ce524,_0x3f8070;_0x1da134[_0x7b75('0x50')]=intUtil[_0x7b75('0x51')](_0x1da134[_0x7b75('0x50')]);_0x1da134['serverUrl']=intUtil[_0x7b75('0x51')](_0x1da134[_0x7b75('0x52')]);def[_0x7b75('0x53')]=util[_0x7b75('0x21')](_0x7b75('0x54'),_0x1da134['remoteUri']);if(_0x32cee9&&_0x32cee9[_0x7b75('0x55')]){logger[_0x7b75('0x28')](_0x7b75('0x56'),_0x7b75('0x57'));_0x2cfd1e[_0x7b75('0x58')]=util[_0x7b75('0x21')](_0x7b75('0x59'),_0x1da134[_0x7b75('0x52')],_0x2cfd1e[_0x7b75('0x5a')],md5(_0x2cfd1e[_0x7b75('0x5a')]));}else{_0x2cfd1e[_0x7b75('0x58')]='';}return getConnection(_0x1da134)['then'](function(_0x3c0fc9){_0x3f8070=_0x3c0fc9;return getUser(_0x1da134,_0x119cb5[_0x7b75('0xe')],_0x3f8070);})[_0x7b75('0x2e')](function(_0x1df872){_0x24ba1c=_0x1df872;logger['info'](_0x7b75('0x5b'),_0x24ba1c['id']);return getEndUser(_0x1da134,_0x2cfd1e[_0x7b75('0x5c')],_0x2cfd1e['calleridnum'],_0x3f8070);})[_0x7b75('0x2e')](function(_0x16e7b4){_0xee18d=_0x16e7b4;logger[_0x7b75('0x28')]('The\x20Enduser\x20ID\x20is:',_0xee18d['id']);return getTicket(_0x1da134,_0x24ba1c,_0xee18d,_0x26ee91,_0x2cfd1e,_0x26ee91[_0x7b75('0x5d')],_0x3f8070,_0x7b75('0x5e'));})[_0x7b75('0x2e')](function(_0x2553f3){_0x2ce524=_0x2553f3;logger['info'](_0x7b75('0x5f'));logger[_0x7b75('0x28')]('The\x20Ticket\x20ID\x20is:',_0x2ce524['id']);return setRelationship(_0x3f8070,_0x24ba1c,_0x2ce524,_0x7b75('0x60'));})['then'](function(){return setRelationship(_0x3f8070,_0xee18d,_0x2ce524,_0x7b75('0x61'));})[_0x7b75('0x2e')](function(){return getServerInfo(_0x3f8070);})[_0x7b75('0x2e')](function(_0x521412){var _0x3c9447=parseInt(_0x521412['version'][_0x7b75('0x62')](0x0));var _0x6bff69=util[_0x7b75('0x21')](_0x7b75('0x63'),_0x1da134[_0x7b75('0x50')],_0x2ce524['id']);if(_0x3c9447>0x6){_0x6bff69=util[_0x7b75('0x21')](_0x7b75('0x64'),_0x1da134[_0x7b75('0x50')],_0x2ce524['id']);}logger[_0x7b75('0x28')](_0x7b75('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7b75('0x21')](_0x7b75('0x65'),_0x119cb5['name']),_0x7b75('0x66'),{'uri':_0x6bff69});})[_0x7b75('0x67')](function(_0x420dbe){logger[_0x7b75('0x68')](_0x7b75('0x56'),JSON[_0x7b75('0x1f')](_0x420dbe));});};exports[_0x7b75('0x69')]=function(_0x3df1ef,_0x113d85,_0x235563,_0x423993,_0x16b161,_0x318cfc,_0x261464){var _0x50a620,_0x4a128b,_0x380ef1,_0x5da914;_0x318cfc['remoteUri']=intUtil[_0x7b75('0x51')](_0x318cfc[_0x7b75('0x50')]);_0x318cfc['serverUrl']=intUtil[_0x7b75('0x51')](_0x318cfc[_0x7b75('0x52')]);def[_0x7b75('0x53')]=util['format'](_0x7b75('0x54'),_0x318cfc[_0x7b75('0x50')]);if(_0x261464&&_0x261464[_0x7b75('0x6a')]&&_0x261464[_0x7b75('0x6a')]!==_0x7b75('0x6b')){logger['info']('[OUTBOUND]',_0x7b75('0x57'));_0x113d85['recordingURL']=util[_0x7b75('0x21')](_0x7b75('0x59'),_0x318cfc['serverUrl'],_0x113d85[_0x7b75('0x5a')],md5(_0x113d85[_0x7b75('0x5a')]));}return getConnection(_0x318cfc)[_0x7b75('0x2e')](function(_0x5cdc0f){_0x5da914=_0x5cdc0f;return getUser(_0x318cfc,_0x423993[_0x7b75('0xe')],_0x5da914);})['then'](function(_0x240f76){_0x50a620=_0x240f76;logger['info'](_0x7b75('0x5b'),_0x50a620['id']);return getEndUser(_0x318cfc,_0x113d85[_0x7b75('0x6c')],_0x113d85[_0x7b75('0x6d')],_0x5da914);})[_0x7b75('0x2e')](function(_0x2f961e){_0x4a128b=_0x2f961e;logger[_0x7b75('0x28')]('The\x20Enduser\x20ID\x20is:',_0x4a128b['id']);return getTicket(_0x318cfc,_0x50a620,_0x4a128b,_0x235563,_0x113d85,_0x235563[_0x7b75('0x5d')],_0x5da914,_0x7b75('0x6e'));})[_0x7b75('0x2e')](function(_0x4d76d1){_0x380ef1=_0x4d76d1;logger['info'](_0x7b75('0x5f'));logger[_0x7b75('0x28')](_0x7b75('0x6f'),_0x380ef1['id']);return setRelationship(_0x5da914,_0x50a620,_0x380ef1,_0x7b75('0x60'));})[_0x7b75('0x2e')](function(){return setRelationship(_0x5da914,_0x4a128b,_0x380ef1,_0x7b75('0x61'));})[_0x7b75('0x2e')](function(){return getServerInfo(_0x5da914);})[_0x7b75('0x2e')](function(_0x5ef5ce){var _0x3a253b=parseInt(_0x5ef5ce[_0x7b75('0x70')]['charAt'](0x0));var _0x2d68df=util[_0x7b75('0x21')](_0x7b75('0x63'),_0x318cfc[_0x7b75('0x50')],_0x380ef1['id']);if(_0x3a253b>0x6){_0x2d68df=util[_0x7b75('0x21')](_0x7b75('0x64'),_0x318cfc[_0x7b75('0x50')],_0x380ef1['id']);}logger['info']('[OUTBOUND]',_0x7b75('0x71'));emit(util[_0x7b75('0x21')](_0x7b75('0x65'),_0x423993[_0x7b75('0xe')]),_0x7b75('0x66'),{'uri':_0x2d68df});})[_0x7b75('0x67')](function(_0x585b74){logger[_0x7b75('0x68')](_0x7b75('0x72'),JSON[_0x7b75('0x1f')](_0x585b74));});};exports['abandoned']=function(_0x594d19,_0x5eef3c,_0x2354f8,_0x1df17c,_0x472a9b,_0x4cf0a0){var _0x6b8159,_0x323c55,_0x4c4910,_0x5a3571;_0x4cf0a0[_0x7b75('0x50')]=intUtil[_0x7b75('0x51')](_0x4cf0a0[_0x7b75('0x50')]);_0x4cf0a0[_0x7b75('0x52')]=intUtil[_0x7b75('0x51')](_0x4cf0a0['serverUrl']);def[_0x7b75('0x53')]=util[_0x7b75('0x21')](_0x7b75('0x54'),_0x4cf0a0[_0x7b75('0x50')]);if(_0x472a9b&&_0x472a9b['monitor_format']){logger[_0x7b75('0x28')]('[ABANDONED]',_0x7b75('0x57'));_0x5eef3c[_0x7b75('0x58')]=util[_0x7b75('0x21')](_0x7b75('0x59'),_0x4cf0a0[_0x7b75('0x52')],_0x5eef3c['uniqueid'],md5(_0x5eef3c['uniqueid']));}else{_0x5eef3c[_0x7b75('0x58')]='';}return getConnection(_0x4cf0a0)['then'](function(_0x364a1b){_0x5a3571=_0x364a1b;if(!_['isNil'](_0x1df17c)){return getUser(_0x4cf0a0,_0x1df17c[_0x7b75('0xe')],_0x5a3571);}else{return getUser(_0x4cf0a0,null,_0x5a3571);}})[_0x7b75('0x2e')](function(_0x5d7d75){_0x6b8159=_0x5d7d75;logger[_0x7b75('0x28')]('The\x20User\x20ID\x20is:',_0x6b8159['id']);return getEndUser(_0x4cf0a0,_0x5eef3c[_0x7b75('0x5c')],_0x5eef3c['calleridnum'],_0x5a3571);})[_0x7b75('0x2e')](function(_0x4e3cf5){_0x323c55=_0x4e3cf5;logger['info'](_0x7b75('0x73'),_0x323c55['id']);return getTicket(_0x4cf0a0,_0x6b8159,_0x323c55,_0x2354f8,_0x5eef3c,_0x2354f8[_0x7b75('0x5d')],_0x5a3571,_0x7b75('0x5e'));})[_0x7b75('0x2e')](function(_0x3ac2e3){_0x4c4910=_0x3ac2e3;logger['info'](_0x7b75('0x5f'));logger['info'](_0x7b75('0x6f'),_0x4c4910['id']);return setRelationship(_0x5a3571,_0x6b8159,_0x4c4910,_0x7b75('0x60'));})[_0x7b75('0x2e')](function(){return setRelationship(_0x5a3571,_0x323c55,_0x4c4910,'contacts');})['then'](function(){return getServerInfo(_0x5a3571);})[_0x7b75('0x67')](function(_0x39ba47){logger[_0x7b75('0x68')](_0x7b75('0x74'),JSON[_0x7b75('0x1f')](_0x39ba47));});}; \ 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 ba23b66..cb12a07 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 _0x25a4=['name','toLowerCase','format','%s:\x20%s','key','keyContent','keyType','slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x25a4,0xa2));var _0x425a=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x25a4[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0x425a('0x0'));var util=require('util');exports[_0x425a('0x1')]=function(_0x244473,_0x473f26,_0x445d9c){var _0x525b98=[];if(_0x244473[_0x425a('0x2')]>0x0){var _0x430023=_[_0x425a('0x3')](_0x244473,['id']);for(var _0x3889ac=0x0;_0x3889ac<_0x430023[_0x425a('0x2')];_0x3889ac++){var _0x1fdb3c=_0x430023[_0x3889ac];if(_0x1fdb3c[_0x425a('0x4')]===_0x425a('0x5')){_0x525b98[_0x425a('0x6')](_0x1fdb3c[_0x425a('0x7')]);}else if(_0x1fdb3c['type']===_0x425a('0x8')&&_0x1fdb3c[_0x425a('0x9')]){_0x473f26[_0x1fdb3c[_0x425a('0x9')]]&&_0x525b98[_0x425a('0x6')](_0x473f26[_0x1fdb3c[_0x425a('0x9')]][_0x425a('0xa')]());}else if(_0x1fdb3c[_0x425a('0x4')]===_0x425a('0xb')&&_0x1fdb3c[_0x425a('0xc')]&&_0x1fdb3c[_0x425a('0xc')][_0x425a('0xd')]){_0x473f26[_0x1fdb3c[_0x425a('0xc')][_0x425a('0xd')][_0x425a('0xe')]()]&&_0x525b98['push'](_0x473f26[_0x1fdb3c['Variable'][_0x425a('0xd')][_0x425a('0xe')]()]['toString']());}else if(_0x1fdb3c[_0x425a('0x4')]==='keyValue'){if(_0x1fdb3c['keyType']==='string'&&_0x1fdb3c['key']){_0x525b98['push'](util[_0x425a('0xf')](_0x425a('0x10'),_0x1fdb3c[_0x425a('0x11')],_0x1fdb3c[_0x425a('0x12')]));}else if(_0x1fdb3c[_0x425a('0x13')]===_0x425a('0x8')&&_0x1fdb3c[_0x425a('0x9')]&&_0x1fdb3c[_0x425a('0x11')]){_0x473f26[_0x1fdb3c[_0x425a('0x9')]]&&_0x525b98[_0x425a('0x6')](util[_0x425a('0xf')](_0x425a('0x10'),_0x1fdb3c[_0x425a('0x11')],_0x473f26[_0x1fdb3c[_0x425a('0x9')]]));}else if(_0x1fdb3c['keyType']===_0x425a('0xb')&&_0x1fdb3c[_0x425a('0xc')]&&_0x1fdb3c[_0x425a('0xc')][_0x425a('0xd')]&&_0x1fdb3c['key']){_0x473f26[_0x1fdb3c['Variable'][_0x425a('0xd')][_0x425a('0xe')]()]&&_0x525b98['push'](util[_0x425a('0xf')]('%s:\x20%s',_0x1fdb3c['key'],_0x473f26[_0x1fdb3c[_0x425a('0xc')]['name'][_0x425a('0xe')]()]));}}}}return _0x525b98['join'](_0x445d9c);};exports['stripTrailingSlash']=function(_0x3daf39){var _0x44c807=_0x3daf39[_0x425a('0x14')](-0x1);if(_0x44c807==='/'){_0x3daf39=_0x3daf39['substring'](0x0,_0x3daf39[_0x425a('0x15')](_0x44c807));}return _0x3daf39;};exports[_0x425a('0x16')]=function(_0x587382){if(!_[_0x425a('0x17')](_0x587382)&&_0x587382!==''){var _0x3f385c=/^(([^<>()\[\]\\.,;:\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 _0x3f385c[_0x425a('0x18')](String(_0x587382)[_0x425a('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xe0c5=['toString','Variable','name','keyValue','keyType','format','key','keyContent','%s:\x20%s','customVariable','toLowerCase','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','sortBy','length','type','string','push','content','variableName'];(function(_0x54ed92,_0x56a6b5){var _0x36b4cc=function(_0x75d492){while(--_0x75d492){_0x54ed92['push'](_0x54ed92['shift']());}};_0x36b4cc(++_0x56a6b5);}(_0xe0c5,0x14a));var _0x5e0c=function(_0x46bcd8,_0x3c8506){_0x46bcd8=_0x46bcd8-0x0;var _0x204c9e=_0xe0c5[_0x46bcd8];return _0x204c9e;};'use strict';var _=require(_0x5e0c('0x0'));var util=require('util');exports['getString']=function(_0x4e29c4,_0x39da3d,_0xac814a){var _0x18b81b=[];if(_0x4e29c4['length']>0x0){var _0x203ed6=_[_0x5e0c('0x1')](_0x4e29c4,['id']);for(var _0x502f7d=0x0;_0x502f7d<_0x203ed6[_0x5e0c('0x2')];_0x502f7d++){var _0x520538=_0x203ed6[_0x502f7d];if(_0x520538[_0x5e0c('0x3')]===_0x5e0c('0x4')){_0x18b81b[_0x5e0c('0x5')](_0x520538[_0x5e0c('0x6')]);}else if(_0x520538[_0x5e0c('0x3')]==='variable'&&_0x520538['variableName']){_0x39da3d[_0x520538['variableName']]&&_0x18b81b['push'](_0x39da3d[_0x520538[_0x5e0c('0x7')]][_0x5e0c('0x8')]());}else if(_0x520538['type']==='customVariable'&&_0x520538[_0x5e0c('0x9')]&&_0x520538['Variable']['name']){_0x39da3d[_0x520538[_0x5e0c('0x9')][_0x5e0c('0xa')]['toLowerCase']()]&&_0x18b81b[_0x5e0c('0x5')](_0x39da3d[_0x520538[_0x5e0c('0x9')][_0x5e0c('0xa')]['toLowerCase']()][_0x5e0c('0x8')]());}else if(_0x520538[_0x5e0c('0x3')]===_0x5e0c('0xb')){if(_0x520538[_0x5e0c('0xc')]===_0x5e0c('0x4')&&_0x520538['key']){_0x18b81b[_0x5e0c('0x5')](util[_0x5e0c('0xd')]('%s:\x20%s',_0x520538[_0x5e0c('0xe')],_0x520538[_0x5e0c('0xf')]));}else if(_0x520538[_0x5e0c('0xc')]==='variable'&&_0x520538[_0x5e0c('0x7')]&&_0x520538[_0x5e0c('0xe')]){_0x39da3d[_0x520538[_0x5e0c('0x7')]]&&_0x18b81b[_0x5e0c('0x5')](util[_0x5e0c('0xd')](_0x5e0c('0x10'),_0x520538[_0x5e0c('0xe')],_0x39da3d[_0x520538[_0x5e0c('0x7')]]));}else if(_0x520538[_0x5e0c('0xc')]===_0x5e0c('0x11')&&_0x520538['Variable']&&_0x520538[_0x5e0c('0x9')][_0x5e0c('0xa')]&&_0x520538[_0x5e0c('0xe')]){_0x39da3d[_0x520538[_0x5e0c('0x9')][_0x5e0c('0xa')][_0x5e0c('0x12')]()]&&_0x18b81b['push'](util['format'](_0x5e0c('0x10'),_0x520538[_0x5e0c('0xe')],_0x39da3d[_0x520538[_0x5e0c('0x9')][_0x5e0c('0xa')]['toLowerCase']()]));}}}}return _0x18b81b[_0x5e0c('0x13')](_0xac814a);};exports['stripTrailingSlash']=function(_0x2c158d){var _0x38dbf7=_0x2c158d[_0x5e0c('0x14')](-0x1);if(_0x38dbf7==='/'){_0x2c158d=_0x2c158d[_0x5e0c('0x15')](0x0,_0x2c158d[_0x5e0c('0x16')](_0x38dbf7));}return _0x2c158d;};exports[_0x5e0c('0x17')]=function(_0x3a8823){if(!_[_0x5e0c('0x18')](_0x3a8823)&&_0x3a8823!==''){var _0x31ce85=/^(([^<>()\[\]\\.,;:\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 _0x31ce85[_0x5e0c('0x19')](String(_0x3a8823)[_0x5e0c('0x12')]());}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 7d1541a..b09225f 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 _0x6b20=['abandoned','monitor_format','[ABANDONED]','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','POST','remoteUri','create','sessionName','stringify','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','%s/webservice.php','query','admin','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','getUser','Searching\x20end\x20user\x20with\x20phone','GET','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','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','getEndUser','accessKey','getchallenge','login','token','getConnection','[HTTP]','queue','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','destcalleridname','Fields','split','[OUTBOUND]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b20,0xd1));var _0x06b2=function(_0x30fa45,_0x5179c1){_0x30fa45=_0x30fa45-0x0;var _0x5df5ee=_0x6b20[_0x30fa45];return _0x5df5ee;};'use strict';var _=require(_0x06b2('0x0'));var rp=require(_0x06b2('0x1'));var BPromise=require('bluebird');var md5=require(_0x06b2('0x2'));var util=require('util');var Redis=require(_0x06b2('0x3'));var intUtil=require(_0x06b2('0x4'));var config=require(_0x06b2('0x5'));var logger=require('../../../../config/logger')(_0x06b2('0x6'));config[_0x06b2('0x7')]=_[_0x06b2('0x8')](config[_0x06b2('0x7')],{'host':_0x06b2('0x9'),'port':0x18eb});var io=require(_0x06b2('0xa'))(new Redis(config[_0x06b2('0x7')]));function emit(_0x4e6d3b,_0x21cd31,_0x1828e4){io['to'](_0x4e6d3b)[_0x06b2('0xb')](_0x21cd31,_0x1828e4);}function getCustomFields(_0x58538a,_0x37ace0){var _0x57f854={};if(_0x58538a[_0x06b2('0xc')]>0x0){_['forEach'](_0x58538a,function(_0x552cd8){if(_0x552cd8[_0x06b2('0xd')]===_0x06b2('0xe')&&_0x552cd8['idField']){_0x57f854[_0x552cd8[_0x06b2('0xf')]]=_0x552cd8[_0x06b2('0x10')][_0x06b2('0x11')]();}else if(_0x552cd8[_0x06b2('0xd')]===_0x06b2('0x12')&&_0x552cd8[_0x06b2('0x13')]&&_0x552cd8[_0x06b2('0xf')]&&_0x37ace0[_0x552cd8[_0x06b2('0x13')]]){_0x57f854[_0x552cd8[_0x06b2('0xf')]]=_0x37ace0[_0x552cd8[_0x06b2('0x13')]][_0x06b2('0x11')]();}else if(_0x552cd8[_0x06b2('0xd')]===_0x06b2('0x14')&&_0x552cd8['Variable']&&_0x552cd8[_0x06b2('0x15')][_0x06b2('0x16')]&&_0x552cd8[_0x06b2('0xf')]&&_0x37ace0[_0x552cd8[_0x06b2('0x15')][_0x06b2('0x16')][_0x06b2('0x17')]()]){_0x57f854[_0x552cd8['idField']]=_0x37ace0[_0x552cd8[_0x06b2('0x15')][_0x06b2('0x16')]['toLowerCase']()][_0x06b2('0x11')]();}});}return _0x57f854;}function createTicket(_0x594b48,_0x4c9cae,_0x192270,_0x1b4ab0,_0x27852e,_0x2182f3,_0x4c4e21){logger[_0x06b2('0x18')](_0x06b2('0x19'));var _0x18f55b=_[_0x06b2('0x1a')]({'parent_id':'','assigned_user_id':_0x4c9cae['id'],'ticketpriorities':_0x06b2('0x1b'),'ticketstatus':_0x06b2('0x1c'),'ticket_title':intUtil[_0x06b2('0x1d')](_0x1b4ab0['Subjects'],_0x27852e,'\x20'),'description':intUtil[_0x06b2('0x1d')](_0x1b4ab0[_0x06b2('0x1e')],_0x27852e,'\x0a'),'contact_id':_0x192270['id']},getCustomFields(_0x2182f3,_0x27852e));var _0xb05f65={'method':_0x06b2('0x1f'),'uri':util['format']('%s/webservice.php',_0x594b48[_0x06b2('0x20')]),'form':{'operation':_0x06b2('0x21'),'username':'admin','sessionName':_0x4c4e21[_0x06b2('0x22')],'elementType':'HelpDesk','element':JSON[_0x06b2('0x23')](_0x18f55b)},'json':!![]};return request(_0xb05f65)[_0x06b2('0x24')](function(_0x2a0645){if(_0x2a0645['success']){return BPromise[_0x06b2('0x25')]({'id':_0x2a0645[_0x06b2('0x26')]['id']});}else{throw new Error(util[_0x06b2('0x27')](_0x06b2('0x28'),JSON[_0x06b2('0x23')](_0x2a0645['error'])));}})[_0x06b2('0x29')](function(_0x34370b){var _0x40a73f=_0x34370b[_0x06b2('0x2a')]||0x1f4;logger[_0x06b2('0x2b')](_0x06b2('0x2c'),'createTicket',_0x40a73f,JSON[_0x06b2('0x23')](_0x34370b));});}function getUser(_0x2a3228,_0x2720fa,_0x13c0eb){if(intUtil[_0x06b2('0x2d')](_0x2720fa)){logger[_0x06b2('0x18')](_0x06b2('0x2e'),_0x2720fa);return request({'method':'GET','uri':util[_0x06b2('0x27')](_0x06b2('0x2f'),_0x2a3228[_0x06b2('0x20')]),'qs':{'operation':_0x06b2('0x30'),'username':_0x06b2('0x31'),'sessionName':_0x13c0eb[_0x06b2('0x22')],'query':util[_0x06b2('0x27')](_0x06b2('0x32'),_0x2720fa)},'json':!![]})['then'](function(_0x2682e0){if(_0x2682e0[_0x06b2('0x33')]&&_0x2682e0[_0x06b2('0x26')][_0x06b2('0xc')]){logger[_0x06b2('0x18')](_0x06b2('0x34'));return BPromise[_0x06b2('0x25')]({'id':_0x2682e0['result'][0x0]['id'],'email':_0x2682e0['result'][0x0][_0x06b2('0x35')],'name':_0x2682e0[_0x06b2('0x26')][0x0][_0x06b2('0x36')]+'\x20'+_0x2682e0['result'][_0x06b2('0x37')]});}else{logger[_0x06b2('0x18')](_0x06b2('0x38'));return BPromise[_0x06b2('0x25')]({'id':_0x13c0eb[_0x06b2('0x39')],'email':_0x2a3228[_0x06b2('0x3a')],'name':'admin'});}})[_0x06b2('0x29')](function(_0x1e66f1){var _0x457708=_0x1e66f1['statusCode']||0x1f4;logger[_0x06b2('0x2b')](_0x06b2('0x2c'),'getUser',_0x457708,JSON[_0x06b2('0x23')](_0x1e66f1));});}else{logger[_0x06b2('0x18')](_0x06b2('0x38'));return BPromise[_0x06b2('0x25')]({'id':_0x13c0eb[_0x06b2('0x39')],'email':_0x2a3228[_0x06b2('0x3a')],'name':_0x06b2('0x31')})[_0x06b2('0x29')](function(_0x22e77a){var _0x3c5b68=_0x22e77a[_0x06b2('0x2a')]||0x1f4;logger[_0x06b2('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x06b2('0x3b'),_0x3c5b68,JSON['stringify'](_0x22e77a));});}}function getEndUser(_0x4a4146,_0x44b967,_0x4e92e0,_0x26ab14){logger['info'](_0x06b2('0x3c'),_0x4e92e0);return request({'method':_0x06b2('0x3d'),'uri':util[_0x06b2('0x27')](_0x06b2('0x2f'),_0x4a4146[_0x06b2('0x20')]),'qs':{'operation':'query','username':_0x06b2('0x31'),'sessionName':_0x26ab14[_0x06b2('0x22')],'query':util[_0x06b2('0x27')](_0x06b2('0x3e'),_0x4e92e0,_0x4e92e0,_0x4e92e0,_0x4e92e0,_0x4e92e0)},'json':!![]})[_0x06b2('0x24')](function(_0x39fd60){if(_0x39fd60['success']&&_0x39fd60[_0x06b2('0x26')][_0x06b2('0xc')]){logger['info']('Enduser\x20found!');return BPromise[_0x06b2('0x25')]({'id':_0x39fd60[_0x06b2('0x26')][0x0]['id'],'name':_0x39fd60[_0x06b2('0x26')][0x0][_0x06b2('0x3f')]+'\x20'+_0x39fd60[_0x06b2('0x26')][0x0][_0x06b2('0x40')],'phone':_0x4e92e0});}else{logger[_0x06b2('0x18')](_0x06b2('0x41'));return request({'method':_0x06b2('0x1f'),'uri':util[_0x06b2('0x27')](_0x06b2('0x2f'),_0x4a4146[_0x06b2('0x20')]),'form':{'operation':_0x06b2('0x21'),'sessionName':_0x26ab14[_0x06b2('0x22')],'elementType':_0x06b2('0x42'),'element':JSON[_0x06b2('0x23')]({'lastname':_0x44b967,'phone':_0x4e92e0,'assigned_user_id':'\x20'})},'json':!![]})[_0x06b2('0x24')](function(_0xc68724){logger[_0x06b2('0x18')]('Enduser\x20created.');return BPromise[_0x06b2('0x25')]({'id':_0xc68724[_0x06b2('0x26')]['id'],'name':_0xc68724[_0x06b2('0x26')][_0x06b2('0x40')],'phone':_0xc68724['result'][_0x06b2('0x43')]});})[_0x06b2('0x29')](function(_0x58a898){var _0x3d1f46=_0x58a898[_0x06b2('0x2a')]||0x1f4;logger['error'](_0x06b2('0x2c'),_0x06b2('0x44'),_0x3d1f46,JSON['stringify'](_0x58a898));});}});}function getConnection(_0x576f6e){var _0x5db943=_0x576f6e[_0x06b2('0x3a')];var _0xae136a=_0x576f6e[_0x06b2('0x45')];return request({'method':_0x06b2('0x3d'),'uri':util[_0x06b2('0x27')]('%s/webservice.php',_0x576f6e['remoteUri']),'qs':{'operation':_0x06b2('0x46'),'username':_0x5db943},'json':!![]})[_0x06b2('0x24')](function(_0x979759){if(_0x979759[_0x06b2('0x33')]){return request({'method':_0x06b2('0x1f'),'uri':util[_0x06b2('0x27')]('%s/webservice.php',_0x576f6e[_0x06b2('0x20')]),'form':{'operation':_0x06b2('0x47'),'username':_0x06b2('0x31'),'accessKey':md5(_0x979759[_0x06b2('0x26')][_0x06b2('0x48')]+_0xae136a)},'json':!![]});}})[_0x06b2('0x24')](function(_0x52206a){if(_0x52206a[_0x06b2('0x33')]){return BPromise[_0x06b2('0x25')](_0x52206a[_0x06b2('0x26')]);}else{throw new Error(util[_0x06b2('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x576f6e['id']));}})[_0x06b2('0x29')](function(_0x17d138){var _0x463745=_0x17d138[_0x06b2('0x2a')]||0x1f4;logger['error'](_0x06b2('0x2c'),_0x06b2('0x49'),_0x463745,JSON[_0x06b2('0x23')](_0x17d138));});}function request(_0x26478c){logger[_0x06b2('0x18')](_0x06b2('0x4a'),JSON[_0x06b2('0x23')](_0x26478c));return rp(_0x26478c);}exports[_0x06b2('0x4b')]=function(_0x568091,_0x33bc8e,_0x8288ae,_0x318a3b,_0x5c328c,_0x2857d5){var _0x2f75a0,_0x4fba4c,_0x5db1cc,_0x1bf9e7;_0x2857d5['remoteUri']=intUtil['stripTrailingSlash'](_0x2857d5[_0x06b2('0x20')]);if(_0x5c328c&&_0x5c328c['monitor_format']){logger[_0x06b2('0x18')](_0x06b2('0x4c'),_0x06b2('0x4d'));_0x33bc8e[_0x06b2('0x4e')]=util[_0x06b2('0x27')](_0x06b2('0x4f'),_0x2857d5[_0x06b2('0x50')],_0x33bc8e[_0x06b2('0x51')],md5(_0x33bc8e[_0x06b2('0x51')]));}else{_0x33bc8e[_0x06b2('0x4e')]='';}return getConnection(_0x2857d5)['then'](function(_0x588d92){_0x1bf9e7=_0x588d92;return getUser(_0x2857d5,_0x318a3b[_0x06b2('0x52')],_0x1bf9e7);})[_0x06b2('0x24')](function(_0x4ec38d){_0x2f75a0=_0x4ec38d;logger[_0x06b2('0x18')](_0x06b2('0x53'),_0x2f75a0['id']);return getEndUser(_0x2857d5,_0x33bc8e[_0x06b2('0x54')],_0x33bc8e[_0x06b2('0x55')],_0x1bf9e7);})['then'](function(_0x4df2ba){_0x4fba4c=_0x4df2ba;logger['info'](_0x06b2('0x56'),_0x4fba4c['id']);return createTicket(_0x2857d5,_0x2f75a0,_0x4fba4c,_0x8288ae,_0x33bc8e,_0x8288ae['Fields'],_0x1bf9e7);})['then'](function(_0x31f910){_0x5db1cc=_0x31f910;logger[_0x06b2('0x18')](_0x06b2('0x57'));logger[_0x06b2('0x18')](_0x06b2('0x58'),_0x5db1cc['id']);var _0x388d8b=util['format'](_0x06b2('0x59'),_0x2857d5[_0x06b2('0x20')],_['split'](_0x5db1cc['id'],'x')[0x1]);logger[_0x06b2('0x18')](_0x06b2('0x4c'),_0x06b2('0x5a'));emit(util[_0x06b2('0x27')](_0x06b2('0x5b'),_0x318a3b[_0x06b2('0x16')]),_0x06b2('0x5c'),{'uri':_0x388d8b});})[_0x06b2('0x29')](function(_0x12d425){logger[_0x06b2('0x2b')](_0x06b2('0x4c'),JSON[_0x06b2('0x23')](_0x12d425));});};exports['outbound']=function(_0x3bde5d,_0x188dcc,_0x514472,_0x1273e3,_0x3bdbd6,_0x2daf0a,_0x27c3a5){var _0x497ccf,_0x94c047,_0x3ae0dd,_0x1e38ce;_0x2daf0a['remoteUri']=intUtil[_0x06b2('0x5d')](_0x2daf0a[_0x06b2('0x20')]);_0x2daf0a[_0x06b2('0x50')]=intUtil[_0x06b2('0x5d')](_0x2daf0a[_0x06b2('0x50')]);if(_0x27c3a5&&_0x27c3a5[_0x06b2('0x5e')]&&_0x27c3a5[_0x06b2('0x5e')]!==_0x06b2('0x5f')){logger[_0x06b2('0x18')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x188dcc['recordingURL']=util['format'](_0x06b2('0x4f'),_0x2daf0a['serverUrl'],_0x188dcc[_0x06b2('0x51')],md5(_0x188dcc[_0x06b2('0x51')]));}return getConnection(_0x2daf0a)[_0x06b2('0x24')](function(_0x552ca4){_0x1e38ce=_0x552ca4;return getUser(_0x2daf0a,_0x1273e3[_0x06b2('0x52')],_0x1e38ce);})[_0x06b2('0x24')](function(_0x5cd18d){_0x497ccf=_0x5cd18d;logger['info'](_0x06b2('0x53'),_0x497ccf['id']);return getEndUser(_0x2daf0a,_0x188dcc[_0x06b2('0x60')],_0x188dcc['destcalleridnum'],_0x1e38ce);})[_0x06b2('0x24')](function(_0xd826e9){_0x94c047=_0xd826e9;logger[_0x06b2('0x18')](_0x06b2('0x56'),_0x94c047['id']);return createTicket(_0x2daf0a,_0x497ccf,_0x94c047,_0x514472,_0x188dcc,_0x514472[_0x06b2('0x61')],_0x1e38ce);})[_0x06b2('0x24')](function(_0x49026e){_0x3ae0dd=_0x49026e;logger[_0x06b2('0x18')]('Ticket\x20created!');logger[_0x06b2('0x18')](_0x06b2('0x58'),_0x3ae0dd['id']);var _0xf7e763=util['format'](_0x06b2('0x59'),_0x2daf0a[_0x06b2('0x20')],_[_0x06b2('0x62')](_0x3ae0dd['id'],'x')[0x1]);logger['info'](_0x06b2('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x06b2('0x27')](_0x06b2('0x5b'),_0x1273e3[_0x06b2('0x16')]),_0x06b2('0x5c'),{'uri':_0xf7e763});})[_0x06b2('0x29')](function(_0xfde8cc){logger['error'](_0x06b2('0x63'),JSON[_0x06b2('0x23')](_0xfde8cc));});};exports[_0x06b2('0x64')]=function(_0x1857e8,_0x5f3db5,_0x10f7ff,_0x39464c,_0x37edaf,_0x4901a6){var _0x58d3a0,_0x3ef003,_0x4a6ec0,_0x6a994e;_0x4901a6['remoteUri']=intUtil['stripTrailingSlash'](_0x4901a6[_0x06b2('0x20')]);_0x4901a6[_0x06b2('0x50')]=intUtil['stripTrailingSlash'](_0x4901a6[_0x06b2('0x50')]);if(_0x37edaf&&_0x37edaf[_0x06b2('0x65')]){logger[_0x06b2('0x18')](_0x06b2('0x66'),_0x06b2('0x4d'));_0x5f3db5[_0x06b2('0x4e')]=util[_0x06b2('0x27')](_0x06b2('0x4f'),_0x4901a6[_0x06b2('0x50')],_0x5f3db5[_0x06b2('0x51')],md5(_0x5f3db5[_0x06b2('0x51')]));}else{_0x5f3db5['recordingURL']='';}return getConnection(_0x4901a6)[_0x06b2('0x24')](function(_0x4be314){_0x6a994e=_0x4be314;return getUser(_0x4901a6,'',_0x6a994e);})['then'](function(_0x3257b9){_0x58d3a0=_0x3257b9;logger[_0x06b2('0x18')]('The\x20User\x20ID\x20is:',_0x58d3a0['id']);return getEndUser(_0x4901a6,_0x5f3db5[_0x06b2('0x54')],_0x5f3db5[_0x06b2('0x55')],_0x6a994e);})[_0x06b2('0x24')](function(_0x5355c0){_0x3ef003=_0x5355c0;logger[_0x06b2('0x18')](_0x06b2('0x56'),_0x3ef003['id']);return createTicket(_0x4901a6,_0x58d3a0,_0x3ef003,_0x10f7ff,_0x5f3db5,_0x10f7ff['Fields'],_0x6a994e);})['then'](function(_0x4c53db){_0x4a6ec0=_0x4c53db;logger['info'](_0x06b2('0x57'));logger['info'](_0x06b2('0x58'),_0x4a6ec0['id']);})[_0x06b2('0x29')](function(_0x1b1e6c){logger[_0x06b2('0x2b')](_0x06b2('0x66'),JSON[_0x06b2('0x23')](_0x1b1e6c));});}; \ No newline at end of file +var _0x4065=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','abandoned','monitor_format','[ABANDONED]','md5','ioredis','./util','../../../../config/environment','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','getString','Subjects','Descriptions','POST','format','%s/webservice.php','create','sessionName','HelpDesk','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','remoteUri','query','admin','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','username','Searching\x20end\x20user\x20with\x20phone','Enduser\x20found!','firstname','lastname','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue'];(function(_0x431fe1,_0x5c9bdb){var _0x22dd18=function(_0xaa6d57){while(--_0xaa6d57){_0x431fe1['push'](_0x431fe1['shift']());}};_0x22dd18(++_0x5c9bdb);}(_0x4065,0xdc));var _0x5406=function(_0x265a2e,_0x301dca){_0x265a2e=_0x265a2e-0x0;var _0x38bb0a=_0x4065[_0x265a2e];return _0x38bb0a;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x5406('0x0'));var util=require('util');var Redis=require(_0x5406('0x1'));var intUtil=require(_0x5406('0x2'));var config=require(_0x5406('0x3'));var logger=require('../../../../config/logger')(_0x5406('0x4'));config[_0x5406('0x5')]=_['defaults'](config[_0x5406('0x5')],{'host':_0x5406('0x6'),'port':0x18eb});var io=require(_0x5406('0x7'))(new Redis(config[_0x5406('0x5')]));function emit(_0x44f868,_0x3acd44,_0x4aae49){io['to'](_0x44f868)[_0x5406('0x8')](_0x3acd44,_0x4aae49);}function getCustomFields(_0x2aadf4,_0xd9e9d7){var _0x266399={};if(_0x2aadf4[_0x5406('0x9')]>0x0){_[_0x5406('0xa')](_0x2aadf4,function(_0x49398f){if(_0x49398f[_0x5406('0xb')]===_0x5406('0xc')&&_0x49398f[_0x5406('0xd')]){_0x266399[_0x49398f[_0x5406('0xd')]]=_0x49398f[_0x5406('0xe')][_0x5406('0xf')]();}else if(_0x49398f['type']===_0x5406('0x10')&&_0x49398f[_0x5406('0x11')]&&_0x49398f['idField']&&_0xd9e9d7[_0x49398f[_0x5406('0x11')]]){_0x266399[_0x49398f[_0x5406('0xd')]]=_0xd9e9d7[_0x49398f[_0x5406('0x11')]][_0x5406('0xf')]();}else if(_0x49398f[_0x5406('0xb')]===_0x5406('0x12')&&_0x49398f[_0x5406('0x13')]&&_0x49398f[_0x5406('0x13')][_0x5406('0x14')]&&_0x49398f['idField']&&_0xd9e9d7[_0x49398f[_0x5406('0x13')][_0x5406('0x14')][_0x5406('0x15')]()]){_0x266399[_0x49398f[_0x5406('0xd')]]=_0xd9e9d7[_0x49398f['Variable'][_0x5406('0x14')][_0x5406('0x15')]()][_0x5406('0xf')]();}});}return _0x266399;}function createTicket(_0x22f6ba,_0x5cb4c3,_0x1fee92,_0x233eb0,_0x1355a1,_0x5119ae,_0x453ee5){logger[_0x5406('0x16')]('Creating\x20new\x20ticket...');var _0x12abf3=_[_0x5406('0x17')]({'parent_id':'','assigned_user_id':_0x5cb4c3['id'],'ticketpriorities':_0x5406('0x18'),'ticketstatus':'Open','ticket_title':intUtil[_0x5406('0x19')](_0x233eb0[_0x5406('0x1a')],_0x1355a1,'\x20'),'description':intUtil[_0x5406('0x19')](_0x233eb0[_0x5406('0x1b')],_0x1355a1,'\x0a'),'contact_id':_0x1fee92['id']},getCustomFields(_0x5119ae,_0x1355a1));var _0x41f681={'method':_0x5406('0x1c'),'uri':util[_0x5406('0x1d')](_0x5406('0x1e'),_0x22f6ba['remoteUri']),'form':{'operation':_0x5406('0x1f'),'username':'admin','sessionName':_0x453ee5[_0x5406('0x20')],'elementType':_0x5406('0x21'),'element':JSON['stringify'](_0x12abf3)},'json':!![]};return request(_0x41f681)[_0x5406('0x22')](function(_0x371438){if(_0x371438[_0x5406('0x23')]){return BPromise[_0x5406('0x24')]({'id':_0x371438[_0x5406('0x25')]['id']});}else{throw new Error(util[_0x5406('0x1d')](_0x5406('0x26'),JSON[_0x5406('0x27')](_0x371438['error'])));}})[_0x5406('0x28')](function(_0x13796c){var _0xfba3e7=_0x13796c[_0x5406('0x29')]||0x1f4;logger[_0x5406('0x2a')](_0x5406('0x2b'),_0x5406('0x2c'),_0xfba3e7,JSON[_0x5406('0x27')](_0x13796c));});}function getUser(_0x52822a,_0x3088a1,_0x49a7a5){if(intUtil[_0x5406('0x2d')](_0x3088a1)){logger['info'](_0x5406('0x2e'),_0x3088a1);return request({'method':_0x5406('0x2f'),'uri':util[_0x5406('0x1d')](_0x5406('0x1e'),_0x52822a[_0x5406('0x30')]),'qs':{'operation':_0x5406('0x31'),'username':_0x5406('0x32'),'sessionName':_0x49a7a5[_0x5406('0x20')],'query':util['format'](_0x5406('0x33'),_0x3088a1)},'json':!![]})[_0x5406('0x22')](function(_0x2e9ab9){if(_0x2e9ab9['success']&&_0x2e9ab9[_0x5406('0x25')][_0x5406('0x9')]){logger['info']('Agent\x20found!');return BPromise[_0x5406('0x24')]({'id':_0x2e9ab9[_0x5406('0x25')][0x0]['id'],'email':_0x2e9ab9[_0x5406('0x25')][0x0][_0x5406('0x34')],'name':_0x2e9ab9[_0x5406('0x25')][0x0]['first_name']+'\x20'+_0x2e9ab9['result']['last_name']});}else{logger[_0x5406('0x16')](_0x5406('0x35'));return BPromise[_0x5406('0x24')]({'id':_0x49a7a5[_0x5406('0x36')],'email':_0x52822a['username'],'name':_0x5406('0x32')});}})[_0x5406('0x28')](function(_0x547123){var _0x3714ab=_0x547123[_0x5406('0x29')]||0x1f4;logger[_0x5406('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x5406('0x37'),_0x3714ab,JSON[_0x5406('0x27')](_0x547123));});}else{logger[_0x5406('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x49a7a5['userId'],'email':_0x52822a[_0x5406('0x38')],'name':'admin'})['catch'](function(_0x15f571){var _0x34f2da=_0x15f571[_0x5406('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x34f2da,JSON[_0x5406('0x27')](_0x15f571));});}}function getEndUser(_0x134284,_0xb5d049,_0x3ac9ae,_0x568602){logger['info'](_0x5406('0x39'),_0x3ac9ae);return request({'method':_0x5406('0x2f'),'uri':util[_0x5406('0x1d')]('%s/webservice.php',_0x134284['remoteUri']),'qs':{'operation':_0x5406('0x31'),'username':'admin','sessionName':_0x568602[_0x5406('0x20')],'query':util[_0x5406('0x1d')]('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;',_0x3ac9ae,_0x3ac9ae,_0x3ac9ae,_0x3ac9ae,_0x3ac9ae)},'json':!![]})[_0x5406('0x22')](function(_0x395bbc){if(_0x395bbc[_0x5406('0x23')]&&_0x395bbc[_0x5406('0x25')][_0x5406('0x9')]){logger['info'](_0x5406('0x3a'));return BPromise[_0x5406('0x24')]({'id':_0x395bbc[_0x5406('0x25')][0x0]['id'],'name':_0x395bbc[_0x5406('0x25')][0x0][_0x5406('0x3b')]+'\x20'+_0x395bbc[_0x5406('0x25')][0x0][_0x5406('0x3c')],'phone':_0x3ac9ae});}else{logger[_0x5406('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x5406('0x1c'),'uri':util[_0x5406('0x1d')](_0x5406('0x1e'),_0x134284[_0x5406('0x30')]),'form':{'operation':_0x5406('0x1f'),'sessionName':_0x568602['sessionName'],'elementType':_0x5406('0x3d'),'element':JSON['stringify']({'lastname':_0xb5d049,'phone':_0x3ac9ae,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x56852c){logger['info'](_0x5406('0x3e'));return BPromise[_0x5406('0x24')]({'id':_0x56852c[_0x5406('0x25')]['id'],'name':_0x56852c['result']['lastname'],'phone':_0x56852c[_0x5406('0x25')][_0x5406('0x3f')]});})[_0x5406('0x28')](function(_0x241421){var _0x3e9c04=_0x241421[_0x5406('0x29')]||0x1f4;logger[_0x5406('0x2a')](_0x5406('0x2b'),_0x5406('0x40'),_0x3e9c04,JSON[_0x5406('0x27')](_0x241421));});}});}function getConnection(_0x18dfea){var _0x2dfff2=_0x18dfea[_0x5406('0x38')];var _0x24bcf0=_0x18dfea[_0x5406('0x41')];return request({'method':'GET','uri':util[_0x5406('0x1d')]('%s/webservice.php',_0x18dfea[_0x5406('0x30')]),'qs':{'operation':_0x5406('0x42'),'username':_0x2dfff2},'json':!![]})['then'](function(_0x554e2e){if(_0x554e2e[_0x5406('0x23')]){return request({'method':_0x5406('0x1c'),'uri':util[_0x5406('0x1d')](_0x5406('0x1e'),_0x18dfea[_0x5406('0x30')]),'form':{'operation':'login','username':_0x5406('0x32'),'accessKey':md5(_0x554e2e[_0x5406('0x25')][_0x5406('0x43')]+_0x24bcf0)},'json':!![]});}})['then'](function(_0x3725e8){if(_0x3725e8[_0x5406('0x23')]){return BPromise[_0x5406('0x24')](_0x3725e8[_0x5406('0x25')]);}else{throw new Error(util['format'](_0x5406('0x44'),_0x18dfea['id']));}})[_0x5406('0x28')](function(_0x4009a2){var _0x54f6d3=_0x4009a2[_0x5406('0x29')]||0x1f4;logger['error'](_0x5406('0x2b'),'getConnection',_0x54f6d3,JSON[_0x5406('0x27')](_0x4009a2));});}function request(_0x525aeb){logger[_0x5406('0x16')](_0x5406('0x45'),JSON[_0x5406('0x27')](_0x525aeb));return rp(_0x525aeb);}exports[_0x5406('0x46')]=function(_0x463070,_0x2220b0,_0x15e955,_0x27d029,_0x2559c1,_0x457eee){var _0x26da2d,_0x227510,_0x882386,_0x45a1ce;_0x457eee[_0x5406('0x30')]=intUtil['stripTrailingSlash'](_0x457eee[_0x5406('0x30')]);if(_0x2559c1&&_0x2559c1['monitor_format']){logger[_0x5406('0x16')](_0x5406('0x47'),_0x5406('0x48'));_0x2220b0[_0x5406('0x49')]=util['format'](_0x5406('0x4a'),_0x457eee[_0x5406('0x4b')],_0x2220b0[_0x5406('0x4c')],md5(_0x2220b0[_0x5406('0x4c')]));}else{_0x2220b0[_0x5406('0x49')]='';}return getConnection(_0x457eee)[_0x5406('0x22')](function(_0x484750){_0x45a1ce=_0x484750;return getUser(_0x457eee,_0x27d029[_0x5406('0x4d')],_0x45a1ce);})[_0x5406('0x22')](function(_0x638d5f){_0x26da2d=_0x638d5f;logger[_0x5406('0x16')](_0x5406('0x4e'),_0x26da2d['id']);return getEndUser(_0x457eee,_0x2220b0[_0x5406('0x4f')],_0x2220b0[_0x5406('0x50')],_0x45a1ce);})['then'](function(_0x4702f4){_0x227510=_0x4702f4;logger[_0x5406('0x16')](_0x5406('0x51'),_0x227510['id']);return createTicket(_0x457eee,_0x26da2d,_0x227510,_0x15e955,_0x2220b0,_0x15e955[_0x5406('0x52')],_0x45a1ce);})[_0x5406('0x22')](function(_0x31f0cd){_0x882386=_0x31f0cd;logger[_0x5406('0x16')]('Ticket\x20created!');logger[_0x5406('0x16')]('The\x20Ticket\x20ID\x20is:',_0x882386['id']);var _0x41b191=util[_0x5406('0x1d')](_0x5406('0x53'),_0x457eee['remoteUri'],_[_0x5406('0x54')](_0x882386['id'],'x')[0x1]);logger[_0x5406('0x16')](_0x5406('0x47'),_0x5406('0x55'));emit(util[_0x5406('0x1d')](_0x5406('0x56'),_0x27d029['name']),_0x5406('0x57'),{'uri':_0x41b191});})[_0x5406('0x28')](function(_0x22191d){logger[_0x5406('0x2a')](_0x5406('0x47'),JSON['stringify'](_0x22191d));});};exports['outbound']=function(_0x31dc95,_0x2f16f3,_0x520b13,_0x4f6136,_0x7c05f3,_0x3940df,_0x30dc4c){var _0x2cf008,_0x1b4ce8,_0xbc89e2,_0x3069b7;_0x3940df['remoteUri']=intUtil[_0x5406('0x58')](_0x3940df[_0x5406('0x30')]);_0x3940df[_0x5406('0x4b')]=intUtil['stripTrailingSlash'](_0x3940df['serverUrl']);if(_0x30dc4c&&_0x30dc4c[_0x5406('0x59')]&&_0x30dc4c[_0x5406('0x59')]!==_0x5406('0x5a')){logger['info'](_0x5406('0x5b'),'Recording\x20is\x20enabled!');_0x2f16f3[_0x5406('0x49')]=util['format'](_0x5406('0x4a'),_0x3940df[_0x5406('0x4b')],_0x2f16f3['uniqueid'],md5(_0x2f16f3[_0x5406('0x4c')]));}return getConnection(_0x3940df)['then'](function(_0x4999a0){_0x3069b7=_0x4999a0;return getUser(_0x3940df,_0x4f6136[_0x5406('0x4d')],_0x3069b7);})[_0x5406('0x22')](function(_0x4d8553){_0x2cf008=_0x4d8553;logger[_0x5406('0x16')]('The\x20User\x20ID\x20is:',_0x2cf008['id']);return getEndUser(_0x3940df,_0x2f16f3['destcalleridname'],_0x2f16f3['destcalleridnum'],_0x3069b7);})['then'](function(_0x2dd3f1){_0x1b4ce8=_0x2dd3f1;logger[_0x5406('0x16')](_0x5406('0x51'),_0x1b4ce8['id']);return createTicket(_0x3940df,_0x2cf008,_0x1b4ce8,_0x520b13,_0x2f16f3,_0x520b13[_0x5406('0x52')],_0x3069b7);})[_0x5406('0x22')](function(_0x30d0ea){_0xbc89e2=_0x30d0ea;logger['info'](_0x5406('0x5c'));logger[_0x5406('0x16')](_0x5406('0x5d'),_0xbc89e2['id']);var _0x40bbbb=util[_0x5406('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3940df[_0x5406('0x30')],_['split'](_0xbc89e2['id'],'x')[0x1]);logger['info'](_0x5406('0x5b'),_0x5406('0x55'));emit(util[_0x5406('0x1d')]('user:%s',_0x4f6136[_0x5406('0x14')]),_0x5406('0x57'),{'uri':_0x40bbbb});})[_0x5406('0x28')](function(_0x4267db){logger['error']('[OUTBOUND]',JSON[_0x5406('0x27')](_0x4267db));});};exports[_0x5406('0x5e')]=function(_0x379581,_0x39e206,_0x751cf4,_0x3a85f5,_0x41755f,_0x479777){var _0x1c52ef,_0x39b99c,_0x1bd021,_0x1929c5;_0x479777[_0x5406('0x30')]=intUtil['stripTrailingSlash'](_0x479777[_0x5406('0x30')]);_0x479777[_0x5406('0x4b')]=intUtil[_0x5406('0x58')](_0x479777[_0x5406('0x4b')]);if(_0x41755f&&_0x41755f[_0x5406('0x5f')]){logger['info']('[ABANDONED]',_0x5406('0x48'));_0x39e206[_0x5406('0x49')]=util['format'](_0x5406('0x4a'),_0x479777[_0x5406('0x4b')],_0x39e206[_0x5406('0x4c')],md5(_0x39e206[_0x5406('0x4c')]));}else{_0x39e206[_0x5406('0x49')]='';}return getConnection(_0x479777)[_0x5406('0x22')](function(_0x275fa8){_0x1929c5=_0x275fa8;return getUser(_0x479777,'',_0x1929c5);})[_0x5406('0x22')](function(_0x146b7e){_0x1c52ef=_0x146b7e;logger[_0x5406('0x16')](_0x5406('0x4e'),_0x1c52ef['id']);return getEndUser(_0x479777,_0x39e206[_0x5406('0x4f')],_0x39e206[_0x5406('0x50')],_0x1929c5);})[_0x5406('0x22')](function(_0x15717e){_0x39b99c=_0x15717e;logger[_0x5406('0x16')](_0x5406('0x51'),_0x39b99c['id']);return createTicket(_0x479777,_0x1c52ef,_0x39b99c,_0x751cf4,_0x39e206,_0x751cf4[_0x5406('0x52')],_0x1929c5);})[_0x5406('0x22')](function(_0x246709){_0x1bd021=_0x246709;logger['info'](_0x5406('0x5c'));logger['info'](_0x5406('0x5d'),_0x1bd021['id']);})[_0x5406('0x28')](function(_0x31a2c8){logger['error'](_0x5406('0x60'),JSON['stringify'](_0x31a2c8));});}; \ 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 01d63b6..602a192 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 _0xac9b=['recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','catch','error','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','The\x20Ticket\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','idField','customField','push','content','variable','variableName','customVariable','Variable','toLowerCase','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0xac9b,0x8a));var _0xbac9=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0xac9b[_0x5cc51f];return _0x315a2f;};'use strict';var _=require('lodash');var rp=require(_0xbac9('0x0'));var md5=require(_0xbac9('0x1'));var util=require('util');var Redis=require(_0xbac9('0x2'));var intUtil=require('./util');var config=require(_0xbac9('0x3'));var logger=require(_0xbac9('0x4'))(_0xbac9('0x5'));config[_0xbac9('0x6')]=_[_0xbac9('0x7')](config[_0xbac9('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xbac9('0x8'))(new Redis(config[_0xbac9('0x6')]));function emit(_0x1aa9ca,_0x22f017,_0x16b6a5){io['to'](_0x1aa9ca)[_0xbac9('0x9')](_0x22f017,_0x16b6a5);}var headers={'Content-Type':_0xbac9('0xa'),'Accept':_0xbac9('0xa')};function getTicket(_0xc9b423,_0x58c6b7,_0x3b4c79,_0x1c772a,_0x2b2728){logger[_0xbac9('0xb')](_0xbac9('0xc'));return request({'uri':util['format'](_0xbac9('0xd'),_0xc9b423[_0xbac9('0xe')]),'method':_0xbac9('0xf'),'body':{'ticket':_[_0xbac9('0x10')]({'requester_id':_0x3b4c79['id'],'submitter_id':_0x58c6b7?_0x58c6b7['id']:undefined,'assignee_id':_0x58c6b7?_0x58c6b7['id']:undefined,'tags':getTags(_0x1c772a[_0xbac9('0x11')],_0xbac9('0x12')),'subject':intUtil['getString'](_0x1c772a[_0xbac9('0x13')],_0x2b2728,'\x20'),'description':intUtil[_0xbac9('0x14')](_0x1c772a[_0xbac9('0x15')],_0x2b2728,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1c772a[_0xbac9('0x15')],_0x2b2728,'\x0a')}},getCustomFields(_0x1c772a['Fields'],_0x2b2728))}})[_0xbac9('0x16')](function(_0x2b1e0e){logger[_0xbac9('0xb')](_0xbac9('0x17'));return _0x2b1e0e[_0xbac9('0x18')];});}function getUser(_0x51eb13,_0x2f75df){if(intUtil['validateEmail'](_0x2f75df)){logger[_0xbac9('0xb')](_0xbac9('0x19'),_0x2f75df);return request({'uri':util[_0xbac9('0x1a')]('%s/search.json',_0x51eb13[_0xbac9('0xe')]),'qs':{'query':util[_0xbac9('0x1a')](_0xbac9('0x1b'),_0x2f75df)}})[_0xbac9('0x16')](function(_0x35115f){if(_0x35115f[_0xbac9('0x1c')]){logger[_0xbac9('0xb')](_0xbac9('0x1d'));return _[_0xbac9('0x1e')](_0x35115f[_0xbac9('0x1f')],{'email':_0x2f75df,'role':'agent'});}else{logger[_0xbac9('0xb')](_0xbac9('0x20'));return request({'uri':util[_0xbac9('0x1a')](_0xbac9('0x21'),_0x51eb13[_0xbac9('0xe')])})['then'](function(_0x4a22e3){logger[_0xbac9('0xb')](_0xbac9('0x22'));return _0x4a22e3[_0xbac9('0x23')];});}});}else{logger['info'](_0xbac9('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x51eb13[_0xbac9('0xe')])})[_0xbac9('0x16')](function(_0x563c94){logger['info'](_0xbac9('0x22'));return _0x563c94[_0xbac9('0x23')];});}}function getEndUser(_0x3d8f22,_0x404a16,_0x384fcd){logger[_0xbac9('0xb')]('Searching\x20enduser\x20with\x20phone',_0x384fcd);return request({'uri':util[_0xbac9('0x1a')](_0xbac9('0x24'),_0x3d8f22[_0xbac9('0xe')]),'qs':{'query':util['format'](_0xbac9('0x25'),_0x384fcd)}})[_0xbac9('0x16')](function(_0x3eee89){var _0x1e4ca6;if(_0x3eee89[_0xbac9('0x1f')]['length']){_0x3eee89[_0xbac9('0x1f')]=_[_0xbac9('0x26')](_0x3eee89['results'],{'suspended':![],'role':_0xbac9('0x27')});if(_0x3eee89[_0xbac9('0x1f')][_0xbac9('0x28')]){_0x1e4ca6=_['first'](_0x3eee89[_0xbac9('0x1f')]);}}if(_0x1e4ca6){logger[_0xbac9('0xb')](_0xbac9('0x29'));return _0x1e4ca6;}else{logger[_0xbac9('0xb')](_0xbac9('0x2a'));return request({'uri':util[_0xbac9('0x1a')](_0xbac9('0x2b'),_0x3d8f22[_0xbac9('0xe')]),'method':'POST','body':{'user':{'role':_0xbac9('0x27'),'name':util[_0xbac9('0x1a')](_0xbac9('0x2c'),_0x404a16||_0x384fcd),'phone':_0x384fcd}}})[_0xbac9('0x16')](function(_0x2abb6d){logger[_0xbac9('0xb')](_0xbac9('0x2d'));return _0x2abb6d[_0xbac9('0x23')];});}});}function getAuth(_0x3f907f){var _0x2bf0fe;if(_0x3f907f['authType']===_0xbac9('0x2e')){_0x2bf0fe=util['format'](_0xbac9('0x2f'),_0x3f907f[_0xbac9('0x30')],_0x3f907f['password']);}else if(_0x3f907f[_0xbac9('0x31')]===_0xbac9('0x32')){_0x2bf0fe=util[_0xbac9('0x1a')]('%s/token:%s',_0x3f907f[_0xbac9('0x30')],_0x3f907f[_0xbac9('0x32')]);}return util[_0xbac9('0x1a')](_0xbac9('0x33'),new Buffer(_0x2bf0fe)[_0xbac9('0x34')](_0xbac9('0x35')));}function request(_0x5399a3){logger['debug'](_0xbac9('0x36'),JSON[_0xbac9('0x37')](_0x5399a3));return rp(_[_0xbac9('0x7')](_0x5399a3,{'method':_0xbac9('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x543306,_0x49bbd3){var _0x444cc5=[];if(_0x543306&&_0x543306[_0xbac9('0x28')]>0x0){_0x444cc5=_[_0xbac9('0x39')](_0x543306,_0x49bbd3);}return _0x444cc5;}function getCustomFields(_0x3e41be,_0x45b054){var _0x2ed5d3=[];var _0x4f8fa8={'custom_fields':[]};if(_0x3e41be[_0xbac9('0x28')]>0x0){_[_0xbac9('0x3a')](_0x3e41be,function(_0x3b5098){if(_0x3b5098[_0xbac9('0x3b')]===_0xbac9('0x3c')&&_0x3b5098['nameField']&&!_0x3b5098['customField']){_0x4f8fa8[_0x3b5098[_0xbac9('0x3d')]['toLowerCase']()]=_0x3b5098['content'][_0xbac9('0x34')]();}else if(_0x3b5098[_0xbac9('0x3b')]===_0xbac9('0x3c')&&_0x3b5098[_0xbac9('0x3e')]&&_0x3b5098[_0xbac9('0x3f')]){_0x4f8fa8['custom_fields'][_0xbac9('0x40')]({'id':_0x3b5098[_0xbac9('0x3e')],'value':_0x3b5098[_0xbac9('0x41')][_0xbac9('0x34')]()});}else if(_0x3b5098[_0xbac9('0x3b')]===_0xbac9('0x42')&&_0x3b5098[_0xbac9('0x43')]&&_0x3b5098[_0xbac9('0x3e')]&&_0x3b5098['customField']){_0x45b054[_0x3b5098['variableName']]&&_0x4f8fa8['custom_fields']['push']({'id':_0x3b5098[_0xbac9('0x3e')],'value':_0x45b054[_0x3b5098[_0xbac9('0x43')]][_0xbac9('0x34')]()});}else if(_0x3b5098[_0xbac9('0x3b')]===_0xbac9('0x44')&&_0x3b5098['Variable']&&_0x3b5098[_0xbac9('0x45')]['name']&&_0x3b5098[_0xbac9('0x3e')]&&_0x3b5098[_0xbac9('0x3f')]){_0x45b054[_0x3b5098[_0xbac9('0x45')]['name'][_0xbac9('0x46')]()]&&_0x4f8fa8[_0xbac9('0x47')][_0xbac9('0x40')]({'id':_0x3b5098[_0xbac9('0x3e')],'value':_0x45b054[_0x3b5098[_0xbac9('0x45')][_0xbac9('0x12')][_0xbac9('0x46')]()][_0xbac9('0x34')]()});}});}return _0x4f8fa8;}exports[_0xbac9('0x48')]=function(_0x24e26a,_0x13dfee,_0x116a68,_0x2211dd,_0x3fe8a8,_0x2a1951){var _0x1fe7cc,_0x524147;_0x2a1951[_0xbac9('0xe')]=intUtil[_0xbac9('0x49')](_0x2a1951[_0xbac9('0xe')]);_0x2a1951[_0xbac9('0x4a')]=intUtil[_0xbac9('0x49')](_0x2a1951[_0xbac9('0x4a')]);if(_0x3fe8a8&&_0x3fe8a8[_0xbac9('0x4b')]){logger[_0xbac9('0xb')](_0xbac9('0x4c'),_0xbac9('0x4d'));_0x13dfee['recordingURL']=util[_0xbac9('0x1a')](_0xbac9('0x4e'),_0x2a1951[_0xbac9('0x4a')],_0x13dfee[_0xbac9('0x4f')],md5(_0x13dfee[_0xbac9('0x4f')]));}else{_0x13dfee[_0xbac9('0x50')]='';}headers[_0xbac9('0x51')]=getAuth(_0x2a1951);return getUser(_0x2a1951,_0x2211dd[_0xbac9('0x52')])[_0xbac9('0x16')](function(_0x16cf12){_0x1fe7cc=_0x16cf12;logger[_0xbac9('0xb')](_0xbac9('0x53'),_0x1fe7cc['id']);return getEndUser(_0x2a1951,_0x13dfee[_0xbac9('0x54')],_0x13dfee[_0xbac9('0x55')]);})['then'](function(_0x2938a4){_0x524147=_0x2938a4;logger[_0xbac9('0xb')]('The\x20Enduser\x20ID\x20is:',_0x524147['id']);return getTicket(_0x2a1951,_0x1fe7cc,_0x524147,_0x116a68,_0x13dfee);})[_0xbac9('0x16')](function(_0x20d0d6){if(_0x20d0d6){logger[_0xbac9('0xb')]('The\x20Ticket\x20ID\x20is:',_0x20d0d6['id']);switch(_0x2a1951['type']){case _0xbac9('0x56'):logger[_0xbac9('0xb')](_0xbac9('0x4c'),_0xbac9('0x57'));return request({'uri':util['format'](_0xbac9('0x58'),_0x2a1951[_0xbac9('0xe')],_0x1fe7cc['id'],_0x20d0d6['id']),'method':_0xbac9('0xf')});case _0xbac9('0x59'):logger[_0xbac9('0xb')](_0xbac9('0x4c'),_0xbac9('0x5a'));emit(util['format'](_0xbac9('0x5b'),_0x2211dd[_0xbac9('0x12')]),_0xbac9('0x5c'),{'uri':util[_0xbac9('0x1a')](_0xbac9('0x5d'),_0x2a1951[_0xbac9('0xe')],_0x20d0d6['id'])});break;default:logger['error'](_0xbac9('0x4c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xbac9('0x5e')](function(_0x51b02c){logger[_0xbac9('0x5f')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xbac9('0x60')](_0x51b02c,{'showHidden':!![],'depth':null}));});};exports[_0xbac9('0x61')]=function(_0xab72d7,_0x52e78b,_0x54bd4b,_0x3adbd3,_0x2ab713,_0x439821,_0x1c46e0){var _0x18dd3c,_0x3bd08d;_0x439821[_0xbac9('0xe')]=intUtil[_0xbac9('0x49')](_0x439821[_0xbac9('0xe')]);_0x439821[_0xbac9('0x4a')]=intUtil[_0xbac9('0x49')](_0x439821[_0xbac9('0x4a')]);if(_0x1c46e0&&_0x1c46e0[_0xbac9('0x62')]&&_0x1c46e0[_0xbac9('0x62')]!==_0xbac9('0x63')){logger[_0xbac9('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x52e78b[_0xbac9('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x439821['serverUrl'],_0x52e78b[_0xbac9('0x4f')],md5(_0x52e78b[_0xbac9('0x4f')]));}headers[_0xbac9('0x51')]=getAuth(_0x439821);return getUser(_0x439821,_0x3adbd3[_0xbac9('0x52')])[_0xbac9('0x16')](function(_0x1642ca){_0x18dd3c=_0x1642ca;logger['info'](_0xbac9('0x53'),_0x18dd3c['id']);return getEndUser(_0x439821,_0x52e78b[_0xbac9('0x64')],_0x52e78b[_0xbac9('0x65')]);})['then'](function(_0xa3d7a8){_0x3bd08d=_0xa3d7a8;logger[_0xbac9('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3bd08d['id']);return getTicket(_0x439821,_0x18dd3c,_0x3bd08d,_0x54bd4b,_0x52e78b);})[_0xbac9('0x16')](function(_0x1a1f4d){if(_0x1a1f4d){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1a1f4d['id']);switch(_0x439821[_0xbac9('0x3b')]){case _0xbac9('0x56'):logger[_0xbac9('0xb')](_0xbac9('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xbac9('0x1a')](_0xbac9('0x58'),_0x439821[_0xbac9('0xe')],_0x18dd3c['id'],_0x1a1f4d['id']),'method':'POST'});case _0xbac9('0x59'):logger[_0xbac9('0xb')](_0xbac9('0x66'),_0xbac9('0x5a'));emit(util[_0xbac9('0x1a')](_0xbac9('0x5b'),_0x3adbd3[_0xbac9('0x12')]),_0xbac9('0x5c'),{'uri':util['format'](_0xbac9('0x5d'),_0x439821[_0xbac9('0xe')],_0x1a1f4d['id'])});break;default:logger[_0xbac9('0x5f')](_0xbac9('0x66'),_0xbac9('0x67'));}}})[_0xbac9('0x5e')](function(_0x49cf94){logger[_0xbac9('0x5f')](_0xbac9('0x68'),util[_0xbac9('0x60')](_0x49cf94,{'showHidden':!![],'depth':null}));});};exports[_0xbac9('0x69')]=function(_0x31dfb1,_0xa45f64,_0x3f78e1,_0x149b77,_0x316c94,_0x5e41e8){var _0x12358d,_0x2b1149;_0x5e41e8[_0xbac9('0xe')]=intUtil[_0xbac9('0x49')](_0x5e41e8[_0xbac9('0xe')]);_0x5e41e8['serverUrl']=intUtil[_0xbac9('0x49')](_0x5e41e8[_0xbac9('0x4a')]);if(_0x316c94&&_0x316c94[_0xbac9('0x4b')]){logger['info'](_0xbac9('0x6a'),_0xbac9('0x4d'));_0xa45f64['recordingURL']=util[_0xbac9('0x1a')](_0xbac9('0x4e'),_0x5e41e8[_0xbac9('0x4a')],_0xa45f64[_0xbac9('0x4f')],md5(_0xa45f64[_0xbac9('0x4f')]));}else{_0xa45f64[_0xbac9('0x50')]='';}headers[_0xbac9('0x51')]=getAuth(_0x5e41e8);return getUser(_0x5e41e8)[_0xbac9('0x16')](function(_0x56dba3){_0x12358d=_0x56dba3;logger[_0xbac9('0xb')](_0xbac9('0x53'),_0x12358d['id']);return getEndUser(_0x5e41e8,_0xa45f64[_0xbac9('0x54')],_0xa45f64[_0xbac9('0x55')]);})[_0xbac9('0x16')](function(_0x5e8480){_0x2b1149=_0x5e8480;logger[_0xbac9('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2b1149['id']);return getTicket(_0x5e41e8,_0x12358d,_0x2b1149,_0x3f78e1,_0xa45f64);})[_0xbac9('0x16')](function(_0x31dc5c){if(_0x31dc5c){logger[_0xbac9('0xb')](_0xbac9('0x6b'),_0x31dc5c['id']);}})[_0xbac9('0x5e')](function(_0x29ea21){logger['error'](_0xbac9('0x6c'),util[_0xbac9('0x60')](_0x29ea21,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9bb7=['variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','destcalleridname','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','format','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable'];(function(_0xf911e5,_0x2909ee){var _0x26e8f4=function(_0x331ede){while(--_0x331ede){_0xf911e5['push'](_0xf911e5['shift']());}};_0x26e8f4(++_0x2909ee);}(_0x9bb7,0x1c2));var _0x79bb=function(_0x1b00d0,_0x265b67){_0x1b00d0=_0x1b00d0-0x0;var _0x31446c=_0x9bb7[_0x1b00d0];return _0x31446c;};'use strict';var _=require(_0x79bb('0x0'));var rp=require(_0x79bb('0x1'));var md5=require(_0x79bb('0x2'));var util=require(_0x79bb('0x3'));var Redis=require(_0x79bb('0x4'));var intUtil=require(_0x79bb('0x5'));var config=require(_0x79bb('0x6'));var logger=require('../../../../config/logger')('zendesk');config[_0x79bb('0x7')]=_[_0x79bb('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x79bb('0x9'))(new Redis(config[_0x79bb('0x7')]));function emit(_0x3b71fc,_0x528f26,_0x47a5c){io['to'](_0x3b71fc)[_0x79bb('0xa')](_0x528f26,_0x47a5c);}var headers={'Content-Type':'application/json','Accept':_0x79bb('0xb')};function getTicket(_0x149470,_0x530eba,_0x1692b0,_0x5878ce,_0x44b259){logger[_0x79bb('0xc')](_0x79bb('0xd'));return request({'uri':util['format'](_0x79bb('0xe'),_0x149470[_0x79bb('0xf')]),'method':_0x79bb('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x1692b0['id'],'submitter_id':_0x530eba?_0x530eba['id']:undefined,'assignee_id':_0x530eba?_0x530eba['id']:undefined,'tags':getTags(_0x5878ce[_0x79bb('0x11')],_0x79bb('0x12')),'subject':intUtil[_0x79bb('0x13')](_0x5878ce['Subjects'],_0x44b259,'\x20'),'description':intUtil[_0x79bb('0x13')](_0x5878ce[_0x79bb('0x14')],_0x44b259,'\x0a'),'comment':{'public':![],'body':intUtil[_0x79bb('0x13')](_0x5878ce[_0x79bb('0x14')],_0x44b259,'\x0a')}},getCustomFields(_0x5878ce[_0x79bb('0x15')],_0x44b259))}})[_0x79bb('0x16')](function(_0x4bca38){logger[_0x79bb('0xc')](_0x79bb('0x17'));return _0x4bca38['ticket'];});}function getUser(_0x5f5802,_0x15a7c2){if(intUtil['validateEmail'](_0x15a7c2)){logger[_0x79bb('0xc')](_0x79bb('0x18'),_0x15a7c2);return request({'uri':util['format']('%s/search.json',_0x5f5802['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x15a7c2)}})[_0x79bb('0x16')](function(_0x128d47){if(_0x128d47[_0x79bb('0x19')]){logger['info']('Agent\x20found!');return _[_0x79bb('0x1a')](_0x128d47[_0x79bb('0x1b')],{'email':_0x15a7c2,'role':_0x79bb('0x1c')});}else{logger[_0x79bb('0xc')](_0x79bb('0x1d'));return request({'uri':util['format'](_0x79bb('0x1e'),_0x5f5802['remoteUri'])})[_0x79bb('0x16')](function(_0x462d6a){logger[_0x79bb('0xc')]('Admin\x20account\x20selected.');return _0x462d6a[_0x79bb('0x1f')];});}});}else{logger['info'](_0x79bb('0x1d'));return request({'uri':util['format'](_0x79bb('0x1e'),_0x5f5802['remoteUri'])})[_0x79bb('0x16')](function(_0x2cb96d){logger[_0x79bb('0xc')]('Admin\x20account\x20selected.');return _0x2cb96d['user'];});}}function getEndUser(_0x257adc,_0x26b086,_0x271096){logger['info']('Searching\x20enduser\x20with\x20phone',_0x271096);return request({'uri':util[_0x79bb('0x20')]('%s/search.json',_0x257adc[_0x79bb('0xf')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x271096)}})[_0x79bb('0x16')](function(_0x2a67a7){var _0x34b8a0;if(_0x2a67a7[_0x79bb('0x1b')][_0x79bb('0x21')]){_0x2a67a7[_0x79bb('0x1b')]=_[_0x79bb('0x22')](_0x2a67a7[_0x79bb('0x1b')],{'suspended':![],'role':'end-user'});if(_0x2a67a7[_0x79bb('0x1b')]['length']){_0x34b8a0=_[_0x79bb('0x23')](_0x2a67a7[_0x79bb('0x1b')]);}}if(_0x34b8a0){logger[_0x79bb('0xc')](_0x79bb('0x24'));return _0x34b8a0;}else{logger[_0x79bb('0xc')](_0x79bb('0x25'));return request({'uri':util[_0x79bb('0x20')](_0x79bb('0x26'),_0x257adc[_0x79bb('0xf')]),'method':_0x79bb('0x10'),'body':{'user':{'role':_0x79bb('0x27'),'name':util[_0x79bb('0x20')](_0x79bb('0x28'),_0x26b086||_0x271096),'phone':_0x271096}}})['then'](function(_0x202934){logger[_0x79bb('0xc')](_0x79bb('0x29'));return _0x202934[_0x79bb('0x1f')];});}});}function getAuth(_0x7faaba){var _0x4b417c;if(_0x7faaba[_0x79bb('0x2a')]==='password'){_0x4b417c=util['format'](_0x79bb('0x2b'),_0x7faaba[_0x79bb('0x2c')],_0x7faaba[_0x79bb('0x2d')]);}else if(_0x7faaba[_0x79bb('0x2a')]===_0x79bb('0x2e')){_0x4b417c=util[_0x79bb('0x20')](_0x79bb('0x2f'),_0x7faaba[_0x79bb('0x2c')],_0x7faaba[_0x79bb('0x2e')]);}return util[_0x79bb('0x20')]('Basic\x20%s',new Buffer(_0x4b417c)[_0x79bb('0x30')](_0x79bb('0x31')));}function request(_0x15afd0){logger[_0x79bb('0x32')](_0x79bb('0x33'),JSON[_0x79bb('0x34')](_0x15afd0));return rp(_[_0x79bb('0x8')](_0x15afd0,{'method':_0x79bb('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x556e89,_0x1cbddb){var _0x307e85=[];if(_0x556e89&&_0x556e89[_0x79bb('0x21')]>0x0){_0x307e85=_[_0x79bb('0x36')](_0x556e89,_0x1cbddb);}return _0x307e85;}function getCustomFields(_0x296693,_0x34884c){var _0x1c5f99=[];var _0x39acd1={'custom_fields':[]};if(_0x296693[_0x79bb('0x21')]>0x0){_['forEach'](_0x296693,function(_0x11ef49){if(_0x11ef49[_0x79bb('0x37')]===_0x79bb('0x38')&&_0x11ef49[_0x79bb('0x39')]&&!_0x11ef49[_0x79bb('0x3a')]){_0x39acd1[_0x11ef49['nameField'][_0x79bb('0x3b')]()]=_0x11ef49[_0x79bb('0x3c')][_0x79bb('0x30')]();}else if(_0x11ef49['type']==='string'&&_0x11ef49['idField']&&_0x11ef49[_0x79bb('0x3a')]){_0x39acd1[_0x79bb('0x3d')][_0x79bb('0x3e')]({'id':_0x11ef49[_0x79bb('0x3f')],'value':_0x11ef49[_0x79bb('0x3c')]['toString']()});}else if(_0x11ef49[_0x79bb('0x37')]===_0x79bb('0x40')&&_0x11ef49['variableName']&&_0x11ef49['idField']&&_0x11ef49[_0x79bb('0x3a')]){_0x34884c[_0x11ef49[_0x79bb('0x41')]]&&_0x39acd1['custom_fields']['push']({'id':_0x11ef49[_0x79bb('0x3f')],'value':_0x34884c[_0x11ef49[_0x79bb('0x41')]][_0x79bb('0x30')]()});}else if(_0x11ef49[_0x79bb('0x37')]===_0x79bb('0x42')&&_0x11ef49['Variable']&&_0x11ef49[_0x79bb('0x43')]['name']&&_0x11ef49['idField']&&_0x11ef49[_0x79bb('0x3a')]){_0x34884c[_0x11ef49[_0x79bb('0x43')][_0x79bb('0x12')][_0x79bb('0x3b')]()]&&_0x39acd1[_0x79bb('0x3d')][_0x79bb('0x3e')]({'id':_0x11ef49[_0x79bb('0x3f')],'value':_0x34884c[_0x11ef49[_0x79bb('0x43')][_0x79bb('0x12')][_0x79bb('0x3b')]()][_0x79bb('0x30')]()});}});}return _0x39acd1;}exports[_0x79bb('0x44')]=function(_0x16f14e,_0x3b6054,_0x2f59b3,_0x390e44,_0x8ed9e5,_0x40ac75){var _0x1e0b0a,_0x24296a;_0x40ac75[_0x79bb('0xf')]=intUtil[_0x79bb('0x45')](_0x40ac75[_0x79bb('0xf')]);_0x40ac75[_0x79bb('0x46')]=intUtil['stripTrailingSlash'](_0x40ac75[_0x79bb('0x46')]);if(_0x8ed9e5&&_0x8ed9e5[_0x79bb('0x47')]){logger[_0x79bb('0xc')](_0x79bb('0x48'),'Recording\x20is\x20enabled!');_0x3b6054['recordingURL']=util[_0x79bb('0x20')](_0x79bb('0x49'),_0x40ac75[_0x79bb('0x46')],_0x3b6054[_0x79bb('0x4a')],md5(_0x3b6054['uniqueid']));}else{_0x3b6054[_0x79bb('0x4b')]='';}headers[_0x79bb('0x4c')]=getAuth(_0x40ac75);return getUser(_0x40ac75,_0x390e44[_0x79bb('0x4d')])[_0x79bb('0x16')](function(_0x157e10){_0x1e0b0a=_0x157e10;logger[_0x79bb('0xc')](_0x79bb('0x4e'),_0x1e0b0a['id']);return getEndUser(_0x40ac75,_0x3b6054['calleridname'],_0x3b6054[_0x79bb('0x4f')]);})[_0x79bb('0x16')](function(_0x835831){_0x24296a=_0x835831;logger[_0x79bb('0xc')](_0x79bb('0x50'),_0x24296a['id']);return getTicket(_0x40ac75,_0x1e0b0a,_0x24296a,_0x2f59b3,_0x3b6054);})['then'](function(_0x161390){if(_0x161390){logger[_0x79bb('0xc')](_0x79bb('0x51'),_0x161390['id']);switch(_0x40ac75[_0x79bb('0x37')]){case _0x79bb('0x52'):logger[_0x79bb('0xc')](_0x79bb('0x48'),_0x79bb('0x53'));return request({'uri':util['format'](_0x79bb('0x54'),_0x40ac75[_0x79bb('0xf')],_0x1e0b0a['id'],_0x161390['id']),'method':'POST'});case'newTab':logger['info'](_0x79bb('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x79bb('0x20')](_0x79bb('0x55'),_0x390e44[_0x79bb('0x12')]),_0x79bb('0x56'),{'uri':util['format'](_0x79bb('0x57'),_0x40ac75[_0x79bb('0xf')],_0x161390['id'])});break;default:logger[_0x79bb('0x58')]('[QUEUE]',_0x79bb('0x59'));}}})[_0x79bb('0x5a')](function(_0x19fe07){logger[_0x79bb('0x58')](_0x79bb('0x5b'),util[_0x79bb('0x5c')](_0x19fe07,{'showHidden':!![],'depth':null}));});};exports[_0x79bb('0x5d')]=function(_0x46062e,_0x283e21,_0x44bdd7,_0x31af6a,_0x10c57f,_0x34be2e,_0x34c28f){var _0x826538,_0x5a7d1b;_0x34be2e[_0x79bb('0xf')]=intUtil[_0x79bb('0x45')](_0x34be2e[_0x79bb('0xf')]);_0x34be2e['serverUrl']=intUtil[_0x79bb('0x45')](_0x34be2e[_0x79bb('0x46')]);if(_0x34c28f&&_0x34c28f['recordingFormat']&&_0x34c28f['recordingFormat']!==_0x79bb('0x5e')){logger[_0x79bb('0xc')](_0x79bb('0x5f'),'Recording\x20is\x20enabled!');_0x283e21[_0x79bb('0x4b')]=util[_0x79bb('0x20')](_0x79bb('0x49'),_0x34be2e['serverUrl'],_0x283e21[_0x79bb('0x4a')],md5(_0x283e21['uniqueid']));}headers[_0x79bb('0x4c')]=getAuth(_0x34be2e);return getUser(_0x34be2e,_0x31af6a['email'])['then'](function(_0x1c8abf){_0x826538=_0x1c8abf;logger['info'](_0x79bb('0x4e'),_0x826538['id']);return getEndUser(_0x34be2e,_0x283e21[_0x79bb('0x60')],_0x283e21['destcalleridnum']);})[_0x79bb('0x16')](function(_0x569d12){_0x5a7d1b=_0x569d12;logger['info'](_0x79bb('0x50'),_0x5a7d1b['id']);return getTicket(_0x34be2e,_0x826538,_0x5a7d1b,_0x44bdd7,_0x283e21);})['then'](function(_0x2e37d3){if(_0x2e37d3){logger['info'](_0x79bb('0x51'),_0x2e37d3['id']);switch(_0x34be2e[_0x79bb('0x37')]){case _0x79bb('0x52'):logger[_0x79bb('0xc')]('[OUTBOUND]',_0x79bb('0x53'));return request({'uri':util['format'](_0x79bb('0x54'),_0x34be2e['remoteUri'],_0x826538['id'],_0x2e37d3['id']),'method':_0x79bb('0x10')});case _0x79bb('0x61'):logger[_0x79bb('0xc')](_0x79bb('0x5f'),_0x79bb('0x62'));emit(util[_0x79bb('0x20')](_0x79bb('0x55'),_0x31af6a[_0x79bb('0x12')]),_0x79bb('0x56'),{'uri':util[_0x79bb('0x20')](_0x79bb('0x57'),_0x34be2e['remoteUri'],_0x2e37d3['id'])});break;default:logger[_0x79bb('0x58')]('[OUTBOUND]',_0x79bb('0x59'));}}})[_0x79bb('0x5a')](function(_0x4ababe){logger['error'](_0x79bb('0x63'),util[_0x79bb('0x5c')](_0x4ababe,{'showHidden':!![],'depth':null}));});};exports[_0x79bb('0x64')]=function(_0x29073e,_0x24b031,_0x483932,_0x589a00,_0x2c2578,_0x632ae3){var _0x1d496c,_0x138495;_0x632ae3[_0x79bb('0xf')]=intUtil[_0x79bb('0x45')](_0x632ae3['remoteUri']);_0x632ae3[_0x79bb('0x46')]=intUtil[_0x79bb('0x45')](_0x632ae3[_0x79bb('0x46')]);if(_0x2c2578&&_0x2c2578[_0x79bb('0x47')]){logger[_0x79bb('0xc')](_0x79bb('0x65'),'Recording\x20is\x20enabled!');_0x24b031[_0x79bb('0x4b')]=util[_0x79bb('0x20')](_0x79bb('0x49'),_0x632ae3[_0x79bb('0x46')],_0x24b031[_0x79bb('0x4a')],md5(_0x24b031[_0x79bb('0x4a')]));}else{_0x24b031[_0x79bb('0x4b')]='';}headers[_0x79bb('0x4c')]=getAuth(_0x632ae3);return getUser(_0x632ae3)[_0x79bb('0x16')](function(_0x4b892a){_0x1d496c=_0x4b892a;logger[_0x79bb('0xc')]('The\x20User\x20ID\x20is:',_0x1d496c['id']);return getEndUser(_0x632ae3,_0x24b031['calleridname'],_0x24b031[_0x79bb('0x4f')]);})[_0x79bb('0x16')](function(_0x425aba){_0x138495=_0x425aba;logger[_0x79bb('0xc')](_0x79bb('0x50'),_0x138495['id']);return getTicket(_0x632ae3,_0x1d496c,_0x138495,_0x483932,_0x24b031);})['then'](function(_0x54b5ad){if(_0x54b5ad){logger['info'](_0x79bb('0x51'),_0x54b5ad['id']);}})['catch'](function(_0x4a2e4b){logger[_0x79bb('0x58')](_0x79bb('0x66'),util[_0x79bb('0x5c')](_0x4a2e4b,{'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 5f3e288..962ada1 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 _0x9375=['Contacts','row','length','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','((Phone:%s))','%s%s%s','encodeXML','recorddetail','Enduser\x20created.','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','debug','[HTTP]','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[ABANDONED]','request-promise','md5','./util','xml2json','entities','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20call...','merge','inbound','outbound','starttime','agentcalledAt','YYYY-MM-DD\x20HH:mm:ss','getString','Descriptions','Fields','lastevent','Called','complete','connect','Call\x20Result','Answered','rejected','Rejected','abandoned','Call\x20Duration','utc','talktime','mm:ss','answertime','endtime','diff','CONTACTID','LEADID','SEMODULE','Leads','SEID','hasOwnProperty','%s','POST','host','authToken','crmapi','parse','toJson','response','result','info','Call\x20created!','Error\x20on\x20call\x20creation:\x20','stringify','GET','format','https://crm.%s/crm/private/json/Users/getUsers','AllUsers','then','users','user','zoho\x20data\x20users','isNil','find','Standard','active','log','zoho\x20user','Using\x20the\x20admin\x20account!','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9375,0xbb));var _0x5937=function(_0x4a3656,_0x49e27f){_0x4a3656=_0x4a3656-0x0;var _0x2dce0d=_0x9375[_0x4a3656];return _0x2dce0d;};'use strict';var _=require('lodash');var rp=require(_0x5937('0x0'));var md5=require(_0x5937('0x1'));var util=require('util');var intUtil=require(_0x5937('0x2'));var parser=require(_0x5937('0x3'));var entities=require(_0x5937('0x4'));var moment=require(_0x5937('0x5'));var Redis=require(_0x5937('0x6'));var config=require(_0x5937('0x7'));var logger=require(_0x5937('0x8'))(_0x5937('0x9'));config['redis']=_[_0x5937('0xa')](config[_0x5937('0xb')],{'host':_0x5937('0xc'),'port':0x18eb});var io=require(_0x5937('0xd'))(new Redis(config[_0x5937('0xb')]));function emit(_0x458b56,_0x585117,_0x10dbd9){io['to'](_0x458b56)['emit'](_0x585117,_0x10dbd9);}var headers={'Content-Type':_0x5937('0xe'),'Accept':_0x5937('0xe')};function getCall(_0x50d4c1,_0x2003dc,_0x4fd3b0,_0x27547c,_0x237eec,_0x3578da){logger['info'](_0x5937('0xf'));var _0x3117e2=_[_0x5937('0x10')]({'SMOWNERID':_0x2003dc['id'],'Call Type':_0x3578da||_0x5937('0x11'),'Call Start Time':(_0x3578da===_0x5937('0x12')?_0x237eec[_0x5937('0x13')]:_0x237eec[_0x5937('0x14')])||moment()['format'](_0x5937('0x15')),'Subject':intUtil[_0x5937('0x16')](_0x27547c['Subjects'],_0x237eec,'\x20'),'Description':intUtil[_0x5937('0x16')](_0x27547c[_0x5937('0x17')],_0x237eec,'\x0a')},getCustomFields(_0x27547c[_0x5937('0x18')],_0x237eec));switch(_0x237eec[_0x5937('0x19')]){case'called':_0x3117e2['Call\x20Result']=_0x5937('0x1a');break;case _0x5937('0x1b'):case _0x5937('0x1c'):_0x3117e2[_0x5937('0x1d')]=_0x5937('0x1e');break;case _0x5937('0x1f'):_0x3117e2[_0x5937('0x1d')]=_0x5937('0x20');break;case _0x5937('0x21'):_0x3117e2[_0x5937('0x1d')]='Abandoned';break;default:}if(_0x237eec['talktime']){_0x3117e2[_0x5937('0x22')]=moment[_0x5937('0x23')](parseInt(_0x237eec[_0x5937('0x24')])*0x3e8)['format'](_0x5937('0x25'));}else if(_0x237eec[_0x5937('0x26')]&&_0x237eec[_0x5937('0x27')]){_0x3117e2['Call\x20Duration']=moment[_0x5937('0x23')](moment(_0x237eec[_0x5937('0x27')],_0x5937('0x15'))[_0x5937('0x28')](moment(_0x237eec[_0x5937('0x13')],_0x5937('0x15'))))['format'](_0x5937('0x25'));}if(_0x4fd3b0[_0x5937('0x29')]){_0x3117e2['CONTACTID']=_0x4fd3b0[_0x5937('0x29')];}else if(_0x4fd3b0[_0x5937('0x2a')]){_0x3117e2[_0x5937('0x2b')]=_0x5937('0x2c');_0x3117e2[_0x5937('0x2d')]=_0x4fd3b0['LEADID'];}var _0x99d320='';for(var _0xd7993b in _0x3117e2){if(_0x3117e2[_0x5937('0x2e')](_0xd7993b)){_0x99d320+=util['format'](_0x5937('0x2f'),entities['encodeXML'](_0xd7993b),entities['encodeXML'](_0x3117e2[_0xd7993b]));}}_0x99d320+='';return request({'method':_0x5937('0x30'),'uri':util['format']('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x50d4c1[_0x5937('0x31')]),'qs':{'authtoken':_0x50d4c1[_0x5937('0x32')],'scope':_0x5937('0x33'),'xmlData':_0x99d320},'json':!![]})['then'](function(_0x3ea7e9){_0x3ea7e9=JSON[_0x5937('0x34')](parser[_0x5937('0x35')](_0x3ea7e9));if(_0x3ea7e9[_0x5937('0x36')]){if(_0x3ea7e9[_0x5937('0x36')][_0x5937('0x37')]&&_0x3ea7e9[_0x5937('0x36')][_0x5937('0x37')]['recorddetail']){logger[_0x5937('0x38')](_0x5937('0x39'));return{'id':_0x3ea7e9[_0x5937('0x36')][_0x5937('0x37')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error(_0x5937('0x3a')+JSON[_0x5937('0x3b')](_0x3ea7e9));});}function getUser(_0x5b2260,_0x41e103){return request({'method':_0x5937('0x3c'),'uri':util[_0x5937('0x3d')](_0x5937('0x3e'),_0x5b2260['host']),'qs':{'type':_0x5937('0x3f'),'authtoken':_0x5b2260['authToken'],'scope':'crmapi'},'json':!![]})[_0x5937('0x40')](function(_0x35a879){if(_0x35a879[_0x5937('0x41')]&&_0x35a879[_0x5937('0x41')][_0x5937('0x42')]){var _0x5af15a;console['log'](_0x5937('0x43'),_0x35a879[_0x5937('0x41')]['user']);if(_['isArrayLikeObject'](_0x35a879[_0x5937('0x41')][_0x5937('0x42')])){console['log'](_0x5937('0x43'),_0x35a879[_0x5937('0x41')][_0x5937('0x42')]);if(!_[_0x5937('0x44')](_0x41e103)){_0x5af15a=_[_0x5937('0x45')](_0x35a879['users'][_0x5937('0x42')],{'email':_0x41e103,'profile':_0x5937('0x46'),'status':_0x5937('0x47')});}if(!_[_0x5937('0x44')](_0x5af15a)){logger['info']('Agent\x20found!');}else{logger[_0x5937('0x38')]('Using\x20the\x20admin\x20account!');_0x5af15a=_[_0x5937('0x45')](_0x35a879[_0x5937('0x41')][_0x5937('0x42')],{'profile':'Administrator'});}console[_0x5937('0x48')](_0x5937('0x49'),_0x5af15a);return _0x5af15a;}else{if(_0x35a879[_0x5937('0x41')][_0x5937('0x42')]['profile']==='Administrator'){logger[_0x5937('0x38')](_0x5937('0x4a'));_0x5af15a=_0x35a879[_0x5937('0x41')]['user'];return _0x5af15a;}else{logger[_0x5937('0x4b')]('The\x20failing\x20result\x20is',JSON[_0x5937('0x3b')](_0x35a879));throw new Error(_0x5937('0x4c')+JSON['stringify'](_0x35a879));}}}else{logger[_0x5937('0x4b')]('The\x20failing\x20result\x20is',JSON[_0x5937('0x3b')](_0x35a879));throw new Error(_0x5937('0x4c')+JSON[_0x5937('0x3b')](_0x35a879));}});}function getEndUser(_0x56b0e0,_0x2b7345,_0x19e985){logger[_0x5937('0x38')](_0x5937('0x4d'),_0x19e985);return request({'method':'GET','uri':util[_0x5937('0x3d')](_0x5937('0x4e'),_0x56b0e0[_0x5937('0x31')]),'qs':{'authtoken':_0x56b0e0[_0x5937('0x32')],'scope':_0x5937('0x33'),'criteria':util['format']('((Phone:%s))',_0x19e985)},'json':!![]})[_0x5937('0x40')](function(_0x2089e7){if(_0x2089e7[_0x5937('0x36')]&&_0x2089e7[_0x5937('0x36')][_0x5937('0x37')]){logger[_0x5937('0x38')]('Enduser\x20found\x20in\x20Contacts!');var _0x3e128b={};var _0x201abb=_0x2089e7[_0x5937('0x36')][_0x5937('0x37')][_0x5937('0x4f')][_0x5937('0x50')]['no']?_0x2089e7[_0x5937('0x36')][_0x5937('0x37')][_0x5937('0x4f')][_0x5937('0x50')]['FL']:_0x2089e7[_0x5937('0x36')][_0x5937('0x37')][_0x5937('0x4f')]['row'][0x0]['FL'];for(var _0x4ad415=0x0,_0x1858d5=_0x201abb[_0x5937('0x51')];_0x4ad415<_0x1858d5;_0x4ad415++){_0x3e128b[_0x201abb[_0x4ad415][_0x5937('0x52')]]=_0x201abb[_0x4ad415][_0x5937('0x53')];}return _0x3e128b;}else{return request({'method':_0x5937('0x3c'),'uri':util['format'](_0x5937('0x54'),_0x56b0e0[_0x5937('0x31')]),'qs':{'authtoken':_0x56b0e0[_0x5937('0x32')],'scope':'crmapi','criteria':util[_0x5937('0x3d')](_0x5937('0x55'),_0x19e985)},'json':!![]})[_0x5937('0x40')](function(_0x2f4c3b){if(_0x2f4c3b['response']&&_0x2f4c3b[_0x5937('0x36')]['result']){logger[_0x5937('0x38')]('Enduser\x20found\x20in\x20Leads!');var _0x4f2fa4={};var _0x5bc74c=_0x2f4c3b['response'][_0x5937('0x37')][_0x5937('0x2c')][_0x5937('0x50')]['no']?_0x2f4c3b[_0x5937('0x36')][_0x5937('0x37')][_0x5937('0x2c')][_0x5937('0x50')]['FL']:_0x2f4c3b['response']['result'][_0x5937('0x2c')][_0x5937('0x50')][0x0]['FL'];for(var _0x40d20e=0x0,_0x4c3f75=_0x5bc74c[_0x5937('0x51')];_0x40d20e<_0x4c3f75;_0x40d20e++){_0x4f2fa4[_0x5bc74c[_0x40d20e][_0x5937('0x52')]]=_0x5bc74c[_0x40d20e]['content'];}return _0x4f2fa4;}else{logger[_0x5937('0x38')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x2b7345=getName(_0x2b7345);return request({'method':_0x5937('0x30'),'uri':util['format']('https://crm.%s/crm/private/xml/Leads/insertRecords',_0x56b0e0[_0x5937('0x31')]),'qs':{'authtoken':_0x56b0e0['authToken'],'scope':'crmapi','xmlData':util[_0x5937('0x3d')](_0x5937('0x56'),entities[_0x5937('0x57')](_0x2b7345[0x0]),entities['encodeXML'](_0x2b7345[0x1]),_0x19e985)},'json':!![]})[_0x5937('0x40')](function(_0x209e65){_0x209e65=JSON['parse'](parser[_0x5937('0x35')](_0x209e65));if(_0x209e65[_0x5937('0x36')]){if(_0x209e65['response'][_0x5937('0x37')]&&_0x209e65[_0x5937('0x36')][_0x5937('0x37')][_0x5937('0x58')]){logger['info'](_0x5937('0x59'));return request({'method':'GET','uri':util[_0x5937('0x3d')]('https://crm.%s/crm/private/json/Leads/getRecordById',_0x56b0e0[_0x5937('0x31')]),'qs':{'authtoken':_0x56b0e0[_0x5937('0x32')],'scope':_0x5937('0x33'),'id':_0x209e65[_0x5937('0x36')]['result'][_0x5937('0x58')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x5937('0x5a')+JSON[_0x5937('0x3b')](_0x209e65));})[_0x5937('0x40')](function(_0x42031d){if(_0x42031d[_0x5937('0x36')]){if(_0x42031d['response'][_0x5937('0x37')]){var _0x4e7e4a={};for(var _0x5ea537=0x0,_0x991530=_0x42031d[_0x5937('0x36')]['result'][_0x5937('0x2c')][_0x5937('0x50')]['FL'][_0x5937('0x51')];_0x5ea537<_0x991530;_0x5ea537++){_0x4e7e4a[_0x42031d[_0x5937('0x36')][_0x5937('0x37')][_0x5937('0x2c')]['row']['FL'][_0x5ea537]['val']]=_0x42031d[_0x5937('0x36')]['result'][_0x5937('0x2c')][_0x5937('0x50')]['FL'][_0x5ea537][_0x5937('0x53')];}return _0x4e7e4a;}}throw new Error(_0x5937('0x5b')+JSON[_0x5937('0x3b')](_0x42031d));});}});}});}function request(_0x1a54a5){logger[_0x5937('0x5c')](_0x5937('0x5d'),JSON[_0x5937('0x3b')](_0x1a54a5));return rp(_0x1a54a5);}function getCustomFields(_0x32671a,_0xa404bd){var _0x2b5a36={};if(_0x32671a[_0x5937('0x51')]>0x0){_[_0x5937('0x5e')](_0x32671a,function(_0x4848de){if(_0x4848de[_0x5937('0x5f')]===_0x5937('0x60')&&_0x4848de['idField']){_0x2b5a36[_0x4848de[_0x5937('0x61')]]=_0x4848de['content'][_0x5937('0x62')]();}else if(_0x4848de[_0x5937('0x5f')]===_0x5937('0x63')&&_0x4848de[_0x5937('0x64')]&&_0x4848de[_0x5937('0x61')]&&_0xa404bd[_0x4848de[_0x5937('0x64')]]){_0x2b5a36[_0x4848de['idField']]=_0xa404bd[_0x4848de[_0x5937('0x64')]][_0x5937('0x62')]();}else if(_0x4848de[_0x5937('0x5f')]===_0x5937('0x65')&&_0x4848de[_0x5937('0x66')]&&_0x4848de[_0x5937('0x66')][_0x5937('0x67')]&&_0x4848de[_0x5937('0x61')]&&_0xa404bd[_0x4848de[_0x5937('0x66')]['name']['toLowerCase']()]){_0x2b5a36[_0x4848de[_0x5937('0x61')]]=_0xa404bd[_0x4848de[_0x5937('0x66')][_0x5937('0x67')][_0x5937('0x68')]()][_0x5937('0x62')]();}});}return _0x2b5a36;}function getName(_0x3f342b){if(_0x3f342b[_0x5937('0x69')]('\x20')>0x0){var _0x38bcba=_0x3f342b['split'](/ (.+)/);if(_0x38bcba[0x1]){return _0x38bcba;}}return[_0x3f342b,_0x3f342b];}exports[_0x5937('0x6a')]=function(_0x1176ac,_0x3da529,_0x409332,_0x31bc6a,_0x4fe4ba,_0x35c81a){var _0x49b34c,_0x214208;_0x35c81a['host']=intUtil[_0x5937('0x6b')](_0x35c81a[_0x5937('0x31')]);_0x35c81a[_0x5937('0x6c')]=intUtil[_0x5937('0x6b')](_0x35c81a[_0x5937('0x6c')]);if(_0x4fe4ba&&_0x4fe4ba[_0x5937('0x6d')]){logger['info'](_0x5937('0x6e'),_0x5937('0x6f'));_0x3da529[_0x5937('0x70')]=util[_0x5937('0x3d')](_0x5937('0x71'),_0x35c81a['serverUrl'],_0x3da529[_0x5937('0x72')],md5(_0x3da529[_0x5937('0x72')]));}else{_0x3da529['recordingURL']='';}return getUser(_0x35c81a,_0x31bc6a[_0x5937('0x73')])[_0x5937('0x40')](function(_0x4087bc){_0x49b34c=_0x4087bc;logger[_0x5937('0x38')](_0x5937('0x74'),_0x49b34c['id']);return getEndUser(_0x35c81a,_0x3da529[_0x5937('0x75')],_0x3da529[_0x5937('0x76')]);})[_0x5937('0x40')](function(_0x45d47e){_0x214208=_0x45d47e;logger[_0x5937('0x38')](_0x5937('0x77'),_0x214208[_0x5937('0x29')]||_0x214208[_0x5937('0x2a')]);return getCall(_0x35c81a,_0x49b34c,_0x214208,_0x409332,_0x3da529,_0x5937('0x78'));})['then'](function(_0xe4b51a){if(_0xe4b51a){logger['info'](_0x5937('0x79'),_0xe4b51a['id']);logger[_0x5937('0x38')]('[QUEUE]',_0x5937('0x7a'));emit(util[_0x5937('0x3d')](_0x5937('0x7b'),_0x31bc6a[_0x5937('0x67')]),_0x5937('0x7c'),{'uri':util[_0x5937('0x3d')](_0x5937('0x7d'),_0x35c81a[_0x5937('0x31')],_0xe4b51a['id'])});}})[_0x5937('0x7e')](function(_0x357e2d){logger[_0x5937('0x4b')](_0x5937('0x6e'),JSON[_0x5937('0x3b')](_0x357e2d));});};exports[_0x5937('0x12')]=function(_0x14cc9f,_0x38b6bb,_0x5dfbc4,_0x38a26f,_0x4bdbe9,_0x1def2b,_0x1692ed){var _0x21a92b,_0x125e82;_0x1def2b[_0x5937('0x31')]=intUtil[_0x5937('0x6b')](_0x1def2b[_0x5937('0x31')]);_0x1def2b[_0x5937('0x6c')]=intUtil[_0x5937('0x6b')](_0x1def2b[_0x5937('0x6c')]);if(_0x1692ed&&_0x1692ed[_0x5937('0x7f')]&&_0x1692ed[_0x5937('0x7f')]!==_0x5937('0x80')){logger[_0x5937('0x38')](_0x5937('0x81'),'Recording\x20is\x20enabled!');_0x38b6bb[_0x5937('0x70')]=util['format'](_0x5937('0x71'),_0x1def2b[_0x5937('0x6c')],_0x38b6bb[_0x5937('0x72')],md5(_0x38b6bb[_0x5937('0x72')]));}return getUser(_0x1def2b,_0x38a26f[_0x5937('0x73')])[_0x5937('0x40')](function(_0xf1e49e){_0x21a92b=_0xf1e49e;logger['info'](_0x5937('0x74'),_0x21a92b['id']);return getEndUser(_0x1def2b,_0x38b6bb[_0x5937('0x82')],_0x38b6bb[_0x5937('0x83')]);})[_0x5937('0x40')](function(_0x12b7e9){_0x125e82=_0x12b7e9;logger[_0x5937('0x38')](_0x5937('0x77'),_0x125e82[_0x5937('0x29')]||_0x125e82['LEADID']);return getCall(_0x1def2b,_0x21a92b,_0x125e82,_0x5dfbc4,_0x38b6bb,'Outbound');})[_0x5937('0x40')](function(_0x45fda6){if(_0x45fda6){logger[_0x5937('0x38')](_0x5937('0x79'),_0x45fda6['id']);logger[_0x5937('0x38')]('[OUTBOUND]',_0x5937('0x7a'));emit(util[_0x5937('0x3d')]('user:%s',_0x38a26f[_0x5937('0x67')]),_0x5937('0x7c'),{'uri':util[_0x5937('0x3d')](_0x5937('0x7d'),_0x1def2b['host'],_0x45fda6['id'])});}})[_0x5937('0x7e')](function(_0x775f69){logger['error'](_0x5937('0x81'),JSON[_0x5937('0x3b')](_0x775f69));});};exports[_0x5937('0x21')]=function(_0x404ac9,_0x342ac3,_0x33a3e3,_0x380687,_0x41e9d6,_0x41cbb6){var _0x37591b,_0x49c944;_0x41cbb6[_0x5937('0x31')]=intUtil['stripTrailingSlash'](_0x41cbb6[_0x5937('0x31')]);_0x41cbb6[_0x5937('0x6c')]=intUtil[_0x5937('0x6b')](_0x41cbb6['serverUrl']);if(_0x41e9d6&&_0x41e9d6[_0x5937('0x6d')]){logger['info'](_0x5937('0x84'),_0x5937('0x6f'));_0x342ac3[_0x5937('0x70')]=util['format'](_0x5937('0x71'),_0x41cbb6[_0x5937('0x6c')],_0x342ac3[_0x5937('0x72')],md5(_0x342ac3[_0x5937('0x72')]));}else{_0x342ac3[_0x5937('0x70')]='';}return getUser(_0x41cbb6)[_0x5937('0x40')](function(_0x35d6ee){_0x37591b=_0x35d6ee;logger[_0x5937('0x38')](_0x5937('0x74'),_0x37591b['id']);return getEndUser(_0x41cbb6,_0x342ac3['calleridname'],_0x342ac3['calleridnum']);})[_0x5937('0x40')](function(_0x2b097d){_0x49c944=_0x2b097d;logger[_0x5937('0x38')](_0x5937('0x77'),_0x49c944[_0x5937('0x29')]||_0x49c944['LEADID']);return getCall(_0x41cbb6,_0x37591b,_0x49c944,_0x33a3e3,_0x342ac3,_0x5937('0x78'));})['then'](function(_0x329dab){if(_0x329dab){logger[_0x5937('0x38')]('The\x20Call\x20ID\x20is:',_0x329dab['id']);}})[_0x5937('0x7e')](function(_0x5e0b63){logger['error'](_0x5937('0x84'),JSON['stringify'](_0x5e0b63));});}; \ No newline at end of file +var _0x8335=['string','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','calleridname','[ABANDONED]','md5','util','./util','entities','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','application/json','merge','outbound','starttime','format','YYYY-MM-DD\x20HH:mm:ss','Subjects','Descriptions','Fields','lastevent','Call\x20Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','talktime','utc','mm:ss','answertime','endtime','diff','CONTACTID','LEADID','SEMODULE','SEID','','%s','encodeXML','','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','host','authToken','crmapi','then','parse','toJson','response','result','recorddetail','info','Error\x20on\x20call\x20creation:\x20','stringify','GET','https://crm.%s/crm/private/json/Users/getUsers','users','user','zoho\x20data\x20users','find','Standard','active','isNil','Agent\x20found!','Using\x20the\x20admin\x20account!','log','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords','Contacts','row','val','((Phone:%s))','Leads','length','content','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20retrieve:\x20','[HTTP]','forEach','type'];(function(_0x39cad6,_0x1edf41){var _0x5a82f2=function(_0x416563){while(--_0x416563){_0x39cad6['push'](_0x39cad6['shift']());}};_0x5a82f2(++_0x1edf41);}(_0x8335,0xaa));var _0x5833=function(_0x1ad19a,_0x33de96){_0x1ad19a=_0x1ad19a-0x0;var _0x4a04bc=_0x8335[_0x1ad19a];return _0x4a04bc;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x5833('0x0'));var util=require(_0x5833('0x1'));var intUtil=require(_0x5833('0x2'));var parser=require('xml2json');var entities=require(_0x5833('0x3'));var moment=require(_0x5833('0x4'));var Redis=require(_0x5833('0x5'));var config=require(_0x5833('0x6'));var logger=require(_0x5833('0x7'))(_0x5833('0x8'));config['redis']=_[_0x5833('0x9')](config[_0x5833('0xa')],{'host':_0x5833('0xb'),'port':0x18eb});var io=require(_0x5833('0xc'))(new Redis(config['redis']));function emit(_0x496177,_0x2a6e22,_0x14fbe6){io['to'](_0x496177)[_0x5833('0xd')](_0x2a6e22,_0x14fbe6);}var headers={'Content-Type':_0x5833('0xe'),'Accept':'application/json'};function getCall(_0xbf162,_0x381bc3,_0x3bb51b,_0x242a52,_0x190231,_0x3ee7f9){logger['info']('Creating\x20new\x20call...');var _0x4e9589=_[_0x5833('0xf')]({'SMOWNERID':_0x381bc3['id'],'Call Type':_0x3ee7f9||'inbound','Call Start Time':(_0x3ee7f9===_0x5833('0x10')?_0x190231[_0x5833('0x11')]:_0x190231['agentcalledAt'])||moment()[_0x5833('0x12')](_0x5833('0x13')),'Subject':intUtil['getString'](_0x242a52[_0x5833('0x14')],_0x190231,'\x20'),'Description':intUtil['getString'](_0x242a52[_0x5833('0x15')],_0x190231,'\x0a')},getCustomFields(_0x242a52[_0x5833('0x16')],_0x190231));switch(_0x190231[_0x5833('0x17')]){case'called':_0x4e9589[_0x5833('0x18')]=_0x5833('0x19');break;case _0x5833('0x1a'):case _0x5833('0x1b'):_0x4e9589[_0x5833('0x18')]=_0x5833('0x1c');break;case _0x5833('0x1d'):_0x4e9589[_0x5833('0x18')]=_0x5833('0x1e');break;case _0x5833('0x1f'):_0x4e9589[_0x5833('0x18')]=_0x5833('0x20');break;default:}if(_0x190231[_0x5833('0x21')]){_0x4e9589['Call\x20Duration']=moment[_0x5833('0x22')](parseInt(_0x190231[_0x5833('0x21')])*0x3e8)[_0x5833('0x12')](_0x5833('0x23'));}else if(_0x190231[_0x5833('0x24')]&&_0x190231[_0x5833('0x25')]){_0x4e9589['Call\x20Duration']=moment[_0x5833('0x22')](moment(_0x190231['endtime'],_0x5833('0x13'))[_0x5833('0x26')](moment(_0x190231[_0x5833('0x11')],_0x5833('0x13'))))[_0x5833('0x12')]('mm:ss');}if(_0x3bb51b['CONTACTID']){_0x4e9589[_0x5833('0x27')]=_0x3bb51b[_0x5833('0x27')];}else if(_0x3bb51b[_0x5833('0x28')]){_0x4e9589[_0x5833('0x29')]='Leads';_0x4e9589[_0x5833('0x2a')]=_0x3bb51b[_0x5833('0x28')];}var _0x4d36ad=_0x5833('0x2b');for(var _0xdb7767 in _0x4e9589){if(_0x4e9589['hasOwnProperty'](_0xdb7767)){_0x4d36ad+=util[_0x5833('0x12')](_0x5833('0x2c'),entities[_0x5833('0x2d')](_0xdb7767),entities['encodeXML'](_0x4e9589[_0xdb7767]));}}_0x4d36ad+=_0x5833('0x2e');return request({'method':_0x5833('0x2f'),'uri':util[_0x5833('0x12')](_0x5833('0x30'),_0xbf162[_0x5833('0x31')]),'qs':{'authtoken':_0xbf162[_0x5833('0x32')],'scope':_0x5833('0x33'),'xmlData':_0x4d36ad},'json':!![]})[_0x5833('0x34')](function(_0x3dd01b){_0x3dd01b=JSON[_0x5833('0x35')](parser[_0x5833('0x36')](_0x3dd01b));if(_0x3dd01b[_0x5833('0x37')]){if(_0x3dd01b[_0x5833('0x37')]['result']&&_0x3dd01b['response'][_0x5833('0x38')][_0x5833('0x39')]){logger[_0x5833('0x3a')]('Call\x20created!');return{'id':_0x3dd01b[_0x5833('0x37')][_0x5833('0x38')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error(_0x5833('0x3b')+JSON[_0x5833('0x3c')](_0x3dd01b));});}function getUser(_0x4db800,_0x322c30){return request({'method':_0x5833('0x3d'),'uri':util[_0x5833('0x12')](_0x5833('0x3e'),_0x4db800[_0x5833('0x31')]),'qs':{'type':'AllUsers','authtoken':_0x4db800['authToken'],'scope':_0x5833('0x33')},'json':!![]})[_0x5833('0x34')](function(_0x108ec4){if(_0x108ec4[_0x5833('0x3f')]&&_0x108ec4['users'][_0x5833('0x40')]){var _0x37a873;console['log'](_0x5833('0x41'),_0x108ec4[_0x5833('0x3f')][_0x5833('0x40')]);if(_['isArrayLikeObject'](_0x108ec4[_0x5833('0x3f')][_0x5833('0x40')])){console['log'](_0x5833('0x41'),_0x108ec4['users'][_0x5833('0x40')]);if(!_['isNil'](_0x322c30)){_0x37a873=_[_0x5833('0x42')](_0x108ec4[_0x5833('0x3f')][_0x5833('0x40')],{'email':_0x322c30,'profile':_0x5833('0x43'),'status':_0x5833('0x44')});}if(!_[_0x5833('0x45')](_0x37a873)){logger['info'](_0x5833('0x46'));}else{logger[_0x5833('0x3a')](_0x5833('0x47'));_0x37a873=_[_0x5833('0x42')](_0x108ec4[_0x5833('0x3f')][_0x5833('0x40')],{'profile':'Administrator'});}console[_0x5833('0x48')]('zoho\x20user',_0x37a873);return _0x37a873;}else{if(_0x108ec4[_0x5833('0x3f')][_0x5833('0x40')][_0x5833('0x49')]===_0x5833('0x4a')){logger[_0x5833('0x3a')](_0x5833('0x47'));_0x37a873=_0x108ec4['users'][_0x5833('0x40')];return _0x37a873;}else{logger[_0x5833('0x4b')](_0x5833('0x4c'),JSON['stringify'](_0x108ec4));throw new Error(_0x5833('0x4d')+JSON[_0x5833('0x3c')](_0x108ec4));}}}else{logger['error'](_0x5833('0x4c'),JSON[_0x5833('0x3c')](_0x108ec4));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x108ec4));}});}function getEndUser(_0x29f70c,_0x3ececc,_0x352364){logger[_0x5833('0x3a')](_0x5833('0x4e'),_0x352364);return request({'method':_0x5833('0x3d'),'uri':util[_0x5833('0x12')](_0x5833('0x4f'),_0x29f70c[_0x5833('0x31')]),'qs':{'authtoken':_0x29f70c[_0x5833('0x32')],'scope':_0x5833('0x33'),'criteria':util[_0x5833('0x12')]('((Phone:%s))',_0x352364)},'json':!![]})[_0x5833('0x34')](function(_0x596b93){if(_0x596b93['response']&&_0x596b93['response'][_0x5833('0x38')]){logger['info']('Enduser\x20found\x20in\x20Contacts!');var _0x5cd1f1={};var _0x3a3c6f=_0x596b93[_0x5833('0x37')][_0x5833('0x38')]['Contacts']['row']['no']?_0x596b93['response'][_0x5833('0x38')][_0x5833('0x50')]['row']['FL']:_0x596b93[_0x5833('0x37')]['result'][_0x5833('0x50')][_0x5833('0x51')][0x0]['FL'];for(var _0x560a92=0x0,_0x227f47=_0x3a3c6f['length'];_0x560a92<_0x227f47;_0x560a92++){_0x5cd1f1[_0x3a3c6f[_0x560a92][_0x5833('0x52')]]=_0x3a3c6f[_0x560a92]['content'];}return _0x5cd1f1;}else{return request({'method':_0x5833('0x3d'),'uri':util['format']('https://crm.%s/crm/private/json/Leads/searchRecords',_0x29f70c[_0x5833('0x31')]),'qs':{'authtoken':_0x29f70c[_0x5833('0x32')],'scope':_0x5833('0x33'),'criteria':util[_0x5833('0x12')](_0x5833('0x53'),_0x352364)},'json':!![]})[_0x5833('0x34')](function(_0xad8256){if(_0xad8256[_0x5833('0x37')]&&_0xad8256[_0x5833('0x37')][_0x5833('0x38')]){logger[_0x5833('0x3a')]('Enduser\x20found\x20in\x20Leads!');var _0x48cc1c={};var _0x3d16bf=_0xad8256[_0x5833('0x37')]['result'][_0x5833('0x54')][_0x5833('0x51')]['no']?_0xad8256['response'][_0x5833('0x38')][_0x5833('0x54')][_0x5833('0x51')]['FL']:_0xad8256[_0x5833('0x37')][_0x5833('0x38')]['Leads']['row'][0x0]['FL'];for(var _0x24a60a=0x0,_0x8177e=_0x3d16bf[_0x5833('0x55')];_0x24a60a<_0x8177e;_0x24a60a++){_0x48cc1c[_0x3d16bf[_0x24a60a][_0x5833('0x52')]]=_0x3d16bf[_0x24a60a][_0x5833('0x56')];}return _0x48cc1c;}else{logger[_0x5833('0x3a')](_0x5833('0x57'));_0x3ececc=getName(_0x3ececc);return request({'method':_0x5833('0x2f'),'uri':util[_0x5833('0x12')](_0x5833('0x58'),_0x29f70c[_0x5833('0x31')]),'qs':{'authtoken':_0x29f70c[_0x5833('0x32')],'scope':'crmapi','xmlData':util[_0x5833('0x12')]('%s%s%s',entities[_0x5833('0x2d')](_0x3ececc[0x0]),entities[_0x5833('0x2d')](_0x3ececc[0x1]),_0x352364)},'json':!![]})[_0x5833('0x34')](function(_0x16e795){_0x16e795=JSON[_0x5833('0x35')](parser[_0x5833('0x36')](_0x16e795));if(_0x16e795[_0x5833('0x37')]){if(_0x16e795[_0x5833('0x37')][_0x5833('0x38')]&&_0x16e795[_0x5833('0x37')][_0x5833('0x38')]['recorddetail']){logger[_0x5833('0x3a')]('Enduser\x20created.');return request({'method':_0x5833('0x3d'),'uri':util[_0x5833('0x12')](_0x5833('0x59'),_0x29f70c['host']),'qs':{'authtoken':_0x29f70c[_0x5833('0x32')],'scope':_0x5833('0x33'),'id':_0x16e795[_0x5833('0x37')][_0x5833('0x38')][_0x5833('0x39')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error('Error\x20on\x20Lead\x20creation:\x20'+JSON[_0x5833('0x3c')](_0x16e795));})[_0x5833('0x34')](function(_0x4b604b){if(_0x4b604b[_0x5833('0x37')]){if(_0x4b604b[_0x5833('0x37')]['result']){var _0x3b5034={};for(var _0x578c7=0x0,_0x14c9d0=_0x4b604b[_0x5833('0x37')]['result']['Leads'][_0x5833('0x51')]['FL'][_0x5833('0x55')];_0x578c7<_0x14c9d0;_0x578c7++){_0x3b5034[_0x4b604b['response'][_0x5833('0x38')][_0x5833('0x54')][_0x5833('0x51')]['FL'][_0x578c7]['val']]=_0x4b604b[_0x5833('0x37')][_0x5833('0x38')]['Leads'][_0x5833('0x51')]['FL'][_0x578c7][_0x5833('0x56')];}return _0x3b5034;}}throw new Error(_0x5833('0x5a')+JSON[_0x5833('0x3c')](_0x4b604b));});}});}});}function request(_0x47ce80){logger['debug'](_0x5833('0x5b'),JSON['stringify'](_0x47ce80));return rp(_0x47ce80);}function getCustomFields(_0x5705e8,_0x42cc58){var _0x56b9f5={};if(_0x5705e8[_0x5833('0x55')]>0x0){_[_0x5833('0x5c')](_0x5705e8,function(_0x2cdbd6){if(_0x2cdbd6[_0x5833('0x5d')]===_0x5833('0x5e')&&_0x2cdbd6['idField']){_0x56b9f5[_0x2cdbd6['idField']]=_0x2cdbd6[_0x5833('0x56')][_0x5833('0x5f')]();}else if(_0x2cdbd6[_0x5833('0x5d')]===_0x5833('0x60')&&_0x2cdbd6[_0x5833('0x61')]&&_0x2cdbd6[_0x5833('0x62')]&&_0x42cc58[_0x2cdbd6[_0x5833('0x61')]]){_0x56b9f5[_0x2cdbd6['idField']]=_0x42cc58[_0x2cdbd6[_0x5833('0x61')]]['toString']();}else if(_0x2cdbd6[_0x5833('0x5d')]===_0x5833('0x63')&&_0x2cdbd6[_0x5833('0x64')]&&_0x2cdbd6[_0x5833('0x64')][_0x5833('0x65')]&&_0x2cdbd6[_0x5833('0x62')]&&_0x42cc58[_0x2cdbd6[_0x5833('0x64')][_0x5833('0x65')][_0x5833('0x66')]()]){_0x56b9f5[_0x2cdbd6[_0x5833('0x62')]]=_0x42cc58[_0x2cdbd6['Variable'][_0x5833('0x65')]['toLowerCase']()]['toString']();}});}return _0x56b9f5;}function getName(_0x5b4018){if(_0x5b4018[_0x5833('0x67')]('\x20')>0x0){var _0x2b1d8b=_0x5b4018[_0x5833('0x68')](/ (.+)/);if(_0x2b1d8b[0x1]){return _0x2b1d8b;}}return[_0x5b4018,_0x5b4018];}exports['queue']=function(_0x316776,_0x3a143e,_0x211209,_0x456529,_0x1daa25,_0x1180f7){var _0x3d4a93,_0x32dcc3;_0x1180f7[_0x5833('0x31')]=intUtil[_0x5833('0x69')](_0x1180f7[_0x5833('0x31')]);_0x1180f7[_0x5833('0x6a')]=intUtil[_0x5833('0x69')](_0x1180f7[_0x5833('0x6a')]);if(_0x1daa25&&_0x1daa25[_0x5833('0x6b')]){logger[_0x5833('0x3a')](_0x5833('0x6c'),_0x5833('0x6d'));_0x3a143e[_0x5833('0x6e')]=util[_0x5833('0x12')](_0x5833('0x6f'),_0x1180f7[_0x5833('0x6a')],_0x3a143e[_0x5833('0x70')],md5(_0x3a143e[_0x5833('0x70')]));}else{_0x3a143e['recordingURL']='';}return getUser(_0x1180f7,_0x456529[_0x5833('0x71')])['then'](function(_0x4455c5){_0x3d4a93=_0x4455c5;logger[_0x5833('0x3a')](_0x5833('0x72'),_0x3d4a93['id']);return getEndUser(_0x1180f7,_0x3a143e['calleridname'],_0x3a143e[_0x5833('0x73')]);})['then'](function(_0x242c9c){_0x32dcc3=_0x242c9c;logger[_0x5833('0x3a')]('The\x20Enduser\x20ID\x20is:',_0x32dcc3[_0x5833('0x27')]||_0x32dcc3[_0x5833('0x28')]);return getCall(_0x1180f7,_0x3d4a93,_0x32dcc3,_0x211209,_0x3a143e,_0x5833('0x74'));})[_0x5833('0x34')](function(_0x573df7){if(_0x573df7){logger[_0x5833('0x3a')](_0x5833('0x75'),_0x573df7['id']);logger[_0x5833('0x3a')]('[QUEUE]',_0x5833('0x76'));emit(util['format'](_0x5833('0x77'),_0x456529[_0x5833('0x65')]),_0x5833('0x78'),{'uri':util[_0x5833('0x12')]('https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s',_0x1180f7['host'],_0x573df7['id'])});}})[_0x5833('0x79')](function(_0x589eb7){logger['error'](_0x5833('0x6c'),JSON['stringify'](_0x589eb7));});};exports[_0x5833('0x10')]=function(_0x4e33b7,_0x4021e3,_0x192be9,_0x5e528f,_0x5513b7,_0x457318,_0x128a7){var _0xf6ad7b,_0x473c7b;_0x457318[_0x5833('0x31')]=intUtil[_0x5833('0x69')](_0x457318['host']);_0x457318[_0x5833('0x6a')]=intUtil['stripTrailingSlash'](_0x457318[_0x5833('0x6a')]);if(_0x128a7&&_0x128a7[_0x5833('0x7a')]&&_0x128a7[_0x5833('0x7a')]!==_0x5833('0x7b')){logger['info'](_0x5833('0x7c'),_0x5833('0x6d'));_0x4021e3[_0x5833('0x6e')]=util[_0x5833('0x12')](_0x5833('0x6f'),_0x457318[_0x5833('0x6a')],_0x4021e3[_0x5833('0x70')],md5(_0x4021e3['uniqueid']));}return getUser(_0x457318,_0x5e528f['email'])[_0x5833('0x34')](function(_0x21058f){_0xf6ad7b=_0x21058f;logger[_0x5833('0x3a')](_0x5833('0x72'),_0xf6ad7b['id']);return getEndUser(_0x457318,_0x4021e3[_0x5833('0x7d')],_0x4021e3[_0x5833('0x7e')]);})[_0x5833('0x34')](function(_0x353804){_0x473c7b=_0x353804;logger[_0x5833('0x3a')](_0x5833('0x7f'),_0x473c7b[_0x5833('0x27')]||_0x473c7b[_0x5833('0x28')]);return getCall(_0x457318,_0xf6ad7b,_0x473c7b,_0x192be9,_0x4021e3,_0x5833('0x80'));})[_0x5833('0x34')](function(_0x3a765f){if(_0x3a765f){logger['info'](_0x5833('0x75'),_0x3a765f['id']);logger[_0x5833('0x3a')](_0x5833('0x7c'),_0x5833('0x76'));emit(util['format'](_0x5833('0x77'),_0x5e528f[_0x5833('0x65')]),_0x5833('0x78'),{'uri':util[_0x5833('0x12')](_0x5833('0x81'),_0x457318[_0x5833('0x31')],_0x3a765f['id'])});}})[_0x5833('0x79')](function(_0x642c1e){logger[_0x5833('0x4b')](_0x5833('0x7c'),JSON[_0x5833('0x3c')](_0x642c1e));});};exports[_0x5833('0x1f')]=function(_0x15b869,_0x22e3d1,_0xb97196,_0x45860e,_0x199b45,_0x372a84){var _0x5e77fe,_0x52ed7a;_0x372a84[_0x5833('0x31')]=intUtil[_0x5833('0x69')](_0x372a84[_0x5833('0x31')]);_0x372a84[_0x5833('0x6a')]=intUtil['stripTrailingSlash'](_0x372a84[_0x5833('0x6a')]);if(_0x199b45&&_0x199b45['monitor_format']){logger[_0x5833('0x3a')]('[ABANDONED]',_0x5833('0x6d'));_0x22e3d1['recordingURL']=util[_0x5833('0x12')](_0x5833('0x6f'),_0x372a84[_0x5833('0x6a')],_0x22e3d1[_0x5833('0x70')],md5(_0x22e3d1[_0x5833('0x70')]));}else{_0x22e3d1['recordingURL']='';}return getUser(_0x372a84)['then'](function(_0x153f67){_0x5e77fe=_0x153f67;logger[_0x5833('0x3a')](_0x5833('0x72'),_0x5e77fe['id']);return getEndUser(_0x372a84,_0x22e3d1[_0x5833('0x82')],_0x22e3d1[_0x5833('0x73')]);})[_0x5833('0x34')](function(_0x3d7594){_0x52ed7a=_0x3d7594;logger['info'](_0x5833('0x7f'),_0x52ed7a[_0x5833('0x27')]||_0x52ed7a['LEADID']);return getCall(_0x372a84,_0x5e77fe,_0x52ed7a,_0xb97196,_0x22e3d1,'Inbound');})['then'](function(_0x4abdab){if(_0x4abdab){logger[_0x5833('0x3a')](_0x5833('0x75'),_0x4abdab['id']);}})['catch'](function(_0x389a6e){logger['error'](_0x5833('0x83'),JSON['stringify'](_0x389a6e));});}; \ 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 ca9c39f..f86e7e2 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(_0x699f74,_0x1085b4){var _0x5a4f7f=function(_0x5d1af9){while(--_0x5d1af9){_0x699f74['push'](_0x699f74['shift']());}};_0x5a4f7f(++_0x1085b4);}(_0x7a54,0x106));var _0x47a5=function(_0x346364,_0x58907e){_0x346364=_0x346364-0x0;var _0x352e97=_0x7a54[_0x346364];return _0x352e97;};'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(_0x50d72f,_0x3ef17f){var _0x58ceac=function(_0x4c8f75){while(--_0x4c8f75){_0x50d72f['push'](_0x50d72f['shift']());}};_0x58ceac(++_0x3ef17f);}(_0x7a54,0x106));var _0x47a5=function(_0x2b12b3,_0x353481){_0x2b12b3=_0x2b12b3-0x0;var _0x3e1bee=_0x7a54[_0x2b12b3];return _0x3e1bee;};'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 f2a813b..705f345 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 _0x3c66=['toUpperCase','render','headers','parse','error','stack','GET','PUT','data7','data2','stringify','then',',\x20request\x20body:\x20','body','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format','mustache','../../../../config/logger','trigger','exec','data1'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c66,0x8b));var _0x63c6=function(_0x3f4990,_0x5db1e5){_0x3f4990=_0x3f4990-0x0;var _0x3f3963=_0x3c66[_0x3f4990];return _0x3f3963;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require(_0x63c6('0x0'));var logger=require(_0x63c6('0x1'))(_0x63c6('0x2'));exports[_0x63c6('0x3')]=function(_0x471706,_0x136133){var _0x104c0b,_0x192ce0;var _0x1b2c63={'method':_0x471706[_0x63c6('0x4')][_0x63c6('0x5')](),'uri':encodeURI(Mustache[_0x63c6('0x6')](_0x471706['data2'],_0x136133)),'json':!![],'resolveWithFullResponse':!![]};try{_0x1b2c63[_0x63c6('0x7')]=_0x471706['data6']?JSON[_0x63c6('0x8')](Mustache[_0x63c6('0x6')](_0x471706['data6'],_0x136133)):{};}catch(_0x386110){logger[_0x63c6('0x9')](_0x386110[_0x63c6('0xa')]);}switch(_0x471706[_0x63c6('0x4')][_0x63c6('0x5')]()){case _0x63c6('0xb'):_0x1b2c63['qs']=_0x136133;break;case'POST':case _0x63c6('0xc'):_0x104c0b={};if(_0x471706[_0x63c6('0xd')]){_0x104c0b=Mustache[_0x63c6('0x6')](_0x471706['data7'],_0x136133);}else{_0x104c0b=_0x136133;}_0x1b2c63['body']=JSON['parse'](_0x104c0b);break;}logger['info'](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x471706[_0x63c6('0x4')],_0x471706[_0x63c6('0xe')],JSON[_0x63c6('0xf')](_0x1b2c63)));rp(_0x1b2c63)[_0x63c6('0x10')](function(_0x1721dc){_0x104c0b=!_['isNil'](_0x104c0b)?_0x63c6('0x11')+_0x104c0b:'';_0x192ce0=typeof _0x1721dc[_0x63c6('0x12')]==='object'?JSON[_0x63c6('0xf')](_0x1721dc['body']):_0x1721dc['body'];logger[_0x63c6('0x13')](util['format'](_0x63c6('0x14'),_0x471706[_0x63c6('0x4')],_0x471706['data2'],_0x1721dc[_0x63c6('0x15')],_0x192ce0));})[_0x63c6('0x16')](function(_0x377f6e){logger[_0x63c6('0x9')](util[_0x63c6('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x471706['data1'],_0x471706['data2'],_0x377f6e[_0x63c6('0x15')],_0x377f6e['name'],_0x377f6e['message']));});}; \ No newline at end of file +var _0xb9e7=['statusCode','error','name','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','headers','data6','stack','GET','data7','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','then','isNil',',\x20request\x20body:\x20','body','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x5cf1a1,_0x1ab924){var _0x52cbcc=function(_0xdc1230){while(--_0xdc1230){_0x5cf1a1['push'](_0x5cf1a1['shift']());}};_0x52cbcc(++_0x1ab924);}(_0xb9e7,0x1df));var _0x7b9e=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xb9e7[_0xdc37a1];return _0x99b4fe;};'use strict';var rp=require('request-promise');var util=require(_0x7b9e('0x0'));var _=require(_0x7b9e('0x1'));var Mustache=require(_0x7b9e('0x2'));var logger=require(_0x7b9e('0x3'))(_0x7b9e('0x4'));exports[_0x7b9e('0x5')]=function(_0x4fbecd,_0x2580f9){var _0x5f2554,_0x4c697c;var _0x2372ee={'method':_0x4fbecd['data1'][_0x7b9e('0x6')](),'uri':encodeURI(Mustache[_0x7b9e('0x7')](_0x4fbecd[_0x7b9e('0x8')],_0x2580f9)),'json':!![],'resolveWithFullResponse':!![]};try{_0x2372ee[_0x7b9e('0x9')]=_0x4fbecd[_0x7b9e('0xa')]?JSON['parse'](Mustache[_0x7b9e('0x7')](_0x4fbecd[_0x7b9e('0xa')],_0x2580f9)):{};}catch(_0xb35b20){logger['error'](_0xb35b20[_0x7b9e('0xb')]);}switch(_0x4fbecd['data1'][_0x7b9e('0x6')]()){case _0x7b9e('0xc'):_0x2372ee['qs']=_0x2580f9;break;case'POST':case'PUT':_0x5f2554={};if(_0x4fbecd[_0x7b9e('0xd')]){_0x5f2554=Mustache['render'](_0x4fbecd[_0x7b9e('0xd')],_0x2580f9);}else{_0x5f2554=_0x2580f9;}_0x2372ee['body']=JSON['parse'](_0x5f2554);break;}logger['info'](util[_0x7b9e('0xe')](_0x7b9e('0xf'),_0x4fbecd[_0x7b9e('0x10')],_0x4fbecd[_0x7b9e('0x8')],JSON['stringify'](_0x2372ee)));rp(_0x2372ee)[_0x7b9e('0x11')](function(_0x1fa0e8){_0x5f2554=!_[_0x7b9e('0x12')](_0x5f2554)?_0x7b9e('0x13')+_0x5f2554:'';_0x4c697c=typeof _0x1fa0e8[_0x7b9e('0x14')]===_0x7b9e('0x15')?JSON[_0x7b9e('0x16')](_0x1fa0e8[_0x7b9e('0x14')]):_0x1fa0e8[_0x7b9e('0x14')];logger[_0x7b9e('0x17')](util['format'](_0x7b9e('0x18'),_0x4fbecd['data1'],_0x4fbecd[_0x7b9e('0x8')],_0x1fa0e8[_0x7b9e('0x19')],_0x4c697c));})['catch'](function(_0x447269){logger[_0x7b9e('0x1a')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4fbecd[_0x7b9e('0x10')],_0x4fbecd[_0x7b9e('0x8')],_0x447269[_0x7b9e('0x19')],_0x447269[_0x7b9e('0x1b')],_0x447269['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4e1f37d..ab879c9 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 _0x6726=['client','http','request','then','debug','rpc','routing','error','message','result','exports','bluebird','../../config/logger'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6726,0xdb));var _0x6672=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x6726[_0x2c1aa8];return _0x4019f5;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6672('0x0'));var logger=require(_0x6672('0x1'))('routing');var client=jayson[_0x6672('0x2')][_0x6672('0x3')]({'port':0x2329});client['Request']=function(_0x122ae0,_0x5bf86c){return new BPromise(function(_0x32e5c6,_0x9a70f7){return client[_0x6672('0x4')](_0x122ae0,_0x5bf86c)[_0x6672('0x5')](function(_0x5701b9){logger[_0x6672('0x6')](_0x6672('0x7'),_0x6672('0x8'),_0x122ae0,_0x5bf86c,_0x5701b9);if(_0x5701b9[_0x6672('0x9')]){logger[_0x6672('0x9')](_0x6672('0x7'),_0x6672('0x8'),_0x122ae0,_0x5701b9[_0x6672('0x9')][_0x6672('0xa')],_0x5bf86c);return _0x9a70f7(_0x5701b9['error'][_0x6672('0xa')]);}else{return _0x32e5c6(_0x5701b9[_0x6672('0xb')]);}})['catch'](function(_0xe4d6b4){logger[_0x6672('0x9')](_0x6672('0x7'),_0x6672('0x8'),_0x122ae0,_0xe4d6b4,_0x5bf86c);return _0x9a70f7(_0xe4d6b4);});});};module[_0x6672('0xc')]=client; \ No newline at end of file +var _0x562d=['exports','jayson/promise','bluebird','../../config/logger','http','Request','then','debug','rpc','routing','error','message','result','catch'];(function(_0x49fd4c,_0x23f15e){var _0x34a89b=function(_0x22df17){while(--_0x22df17){_0x49fd4c['push'](_0x49fd4c['shift']());}};_0x34a89b(++_0x23f15e);}(_0x562d,0xe1));var _0xd562=function(_0x25ffc1,_0x2fd13e){_0x25ffc1=_0x25ffc1-0x0;var _0x161e0e=_0x562d[_0x25ffc1];return _0x161e0e;};'use strict';var jayson=require(_0xd562('0x0'));var BPromise=require(_0xd562('0x1'));var logger=require(_0xd562('0x2'))('routing');var client=jayson['client'][_0xd562('0x3')]({'port':0x2329});client[_0xd562('0x4')]=function(_0x73c3fa,_0x4c6430){return new BPromise(function(_0xf71ee1,_0x5a8157){return client['request'](_0x73c3fa,_0x4c6430)[_0xd562('0x5')](function(_0x46bf9b){logger[_0xd562('0x6')](_0xd562('0x7'),_0xd562('0x8'),_0x73c3fa,_0x4c6430,_0x46bf9b);if(_0x46bf9b[_0xd562('0x9')]){logger['error'](_0xd562('0x7'),'routing',_0x73c3fa,_0x46bf9b[_0xd562('0x9')][_0xd562('0xa')],_0x4c6430);return _0x5a8157(_0x46bf9b[_0xd562('0x9')][_0xd562('0xa')]);}else{return _0xf71ee1(_0x46bf9b[_0xd562('0xb')]);}})[_0xd562('0xc')](function(_0x381265){logger[_0xd562('0x9')](_0xd562('0x7'),_0xd562('0x8'),_0x73c3fa,_0x381265,_0x4c6430);return _0x5a8157(_0x381265);});});};module[_0xd562('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index bd32cea..377390c 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 _0xa967=['./lib/email','./rpc/mailAccount','then','initMailAccounts','refresh','mailAccounts','log','./server','./realtime'];(function(_0x2bb758,_0x12e25f){var _0x472b93=function(_0x238075){while(--_0x238075){_0x2bb758['push'](_0x2bb758['shift']());}};_0x472b93(++_0x12e25f);}(_0xa967,0x1c0));var _0x7a96=function(_0x527322,_0x38e72e){_0x527322=_0x527322-0x0;var _0x3f96e2=_0xa967[_0x527322];return _0x3f96e2;};'use strict';var BPromise=require('bluebird');var server=require(_0x7a96('0x0'));var Realtime=require(_0x7a96('0x1'));var EmailChannel=require(_0x7a96('0x2'));var mailAccount=require(_0x7a96('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x7a96('0x4')](mailAccount['getMailAccounts']())[_0x7a96('0x4')](realtime[_0x7a96('0x5')]())[_0x7a96('0x4')](function(){email[_0x7a96('0x6')](realtime[_0x7a96('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x3e1525){return initRealtime();})[_0x7a96('0x4')](function(_0x3d48e3){return setInterval(initRealtime,0x2710);})['catch'](function(_0x24b155){console[_0x7a96('0x8')](_0x24b155);});}main(); \ No newline at end of file +var _0x6356=['resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','catch','./server','./lib/email','./rpc/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6356,0x189));var _0x6635=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0x6356[_0x253d2b];return _0x3ce8bd;};'use strict';var BPromise=require('bluebird');var server=require(_0x6635('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x6635('0x1'));var mailAccount=require(_0x6635('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x6635('0x3')]()['then'](mailAccount[_0x6635('0x4')]())[_0x6635('0x5')](realtime[_0x6635('0x6')]())[_0x6635('0x5')](function(){email[_0x6635('0x7')](realtime[_0x6635('0x8')]);return realtime;});}function main(){return server[_0x6635('0x9')](realtime,email)['then'](function(_0x25c5fb){return initRealtime();})['then'](function(_0xd8df2f){return setInterval(initRealtime,0x2710);})[_0x6635('0xa')](function(_0x4baecc){console['log'](_0x4baecc);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 81defc2..df45b7a 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 _0xa456=['Smtp','lastSync','verify','then','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','status','Imap','messageStatus','total','stringify','mailAccount:update','refresh','active','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','isNil','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','send','verifySmtp'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa456,0x142));var _0x6a45=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa456[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x6a45('0x0'));var moment=require(_0x6a45('0x1'));var BPromise=require(_0x6a45('0x2'));var md5=require(_0x6a45('0x3'));var Redis=require('ioredis');var config=require(_0x6a45('0x4'));var logger=require(_0x6a45('0x5'))(_0x6a45('0x6'));config['redis']=_[_0x6a45('0x7')](config[_0x6a45('0x8')],{'host':_0x6a45('0x9'),'port':0x18eb});var io=require(_0x6a45('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x6a45('0xb'));var EmailSmtp=require(_0x6a45('0xc'));var mailAccount=require(_0x6a45('0xd'));var md5Accounts={};function EmailChannel(_0x19e67c){logger[_0x6a45('0xe')]('start\x20email\x20channel');this[_0x6a45('0xf')]=_0x19e67c['mailAccounts'];this[_0x6a45('0x10')]={};this[_0x6a45('0x11')]=new EmailSmtp();}EmailChannel[_0x6a45('0x12')][_0x6a45('0x13')]=function(_0x1249e4){var _0x4ff9ae=this['mailAccounts'][_0x1249e4];var _0xe62823={'id':_0x4ff9ae['id'],'name':_0x4ff9ae[_0x6a45('0x14')],'key':_0x4ff9ae['key'],'active':_0x4ff9ae['active'],'Imap':{'status':_0x4ff9ae['Imap'][_0x6a45('0x15')],'messageStatus':_0x4ff9ae[_0x6a45('0x16')][_0x6a45('0x17')],'total':_0x4ff9ae[_0x6a45('0x16')][_0x6a45('0x18')]}};if(_['isNil'](md5Accounts[_0x1249e4])){md5Accounts[_0x1249e4]={};}var _0x563c3b=md5(JSON[_0x6a45('0x19')](_0xe62823));if(md5Accounts[_0x1249e4][_0x6a45('0x3')]!==_0x563c3b){md5Accounts[_0x1249e4]['md5']=_0x563c3b;io[_0x6a45('0x13')](_0x6a45('0x1a'),_0xe62823);}};EmailChannel[_0x6a45('0x12')][_0x6a45('0x1b')]=function(_0x548634){for(var _0x54507b in _0x548634){if(_0x548634['hasOwnProperty'](_0x54507b)){if(_0x548634[_0x54507b][_0x6a45('0x16')]&&_0x548634[_0x54507b][_0x6a45('0x1c')]){var _0x360b7f=_0x548634[_0x54507b]['Imap'];if(!this[_0x6a45('0x10')][_0x6a45('0x1d')](_0x360b7f['id'])){this[_0x6a45('0x10')][_0x360b7f['id']]=new EmailImap(_0x360b7f,_0x548634[_0x54507b]['email']);this['imapAccounts'][_0x360b7f['id']]['on']('box',this[_0x6a45('0x1e')][_0x6a45('0x1f')](this,_0x54507b));this['imapAccounts'][_0x360b7f['id']]['on'](_0x6a45('0x6'),this[_0x6a45('0x20')]['bind'](this,_0x54507b));this[_0x6a45('0x10')][_0x360b7f['id']]['on'](_0x6a45('0x21'),this[_0x6a45('0x22')][_0x6a45('0x1f')](this,_0x54507b));this[_0x6a45('0x10')][_0x360b7f['id']]['on']('error',this['handleImapError'][_0x6a45('0x1f')](this,_0x54507b));}}else{if(_[_0x6a45('0x23')](this[_0x6a45('0xf')][_0x54507b][_0x6a45('0x16')])){this[_0x6a45('0xf')][_0x54507b][_0x6a45('0x16')]={};}this[_0x6a45('0xf')][_0x54507b][_0x6a45('0x16')][_0x6a45('0x15')]=_0x6a45('0x24');this[_0x6a45('0xf')][_0x54507b][_0x6a45('0x16')]['messageStatus']='';this[_0x6a45('0x13')](_0x54507b);}}}};EmailChannel['prototype'][_0x6a45('0x1e')]=function(_0x25467d,_0x28bdf0){if(this[_0x6a45('0xf')][_0x25467d]){this[_0x6a45('0xf')][_0x25467d]['Imap'][_0x6a45('0x15')]=_0x6a45('0x25');this[_0x6a45('0xf')][_0x25467d][_0x6a45('0x16')][_0x6a45('0x17')]=_0x28bdf0[_0x6a45('0x14')];if(_0x28bdf0[_0x6a45('0x26')]){this[_0x6a45('0xf')][_0x25467d]['Imap'][_0x6a45('0x18')]=_0x28bdf0[_0x6a45('0x26')][_0x6a45('0x18')];}return this[_0x6a45('0x13')](_0x25467d);}};EmailChannel[_0x6a45('0x12')]['handleImapEmail']=function(_0x1f95d4,_0x1f96bf){logger[_0x6a45('0xe')](_0x6a45('0x27'),_0x1f96bf['firstName'],_0x1f96bf['lastName'],_0x1f96bf[_0x6a45('0x28')],_0x1f95d4);if(this['mailAccounts'][_0x1f95d4]){return mailAccount[_0x6a45('0x29')](_0x1f95d4,_0x1f96bf)['then'](function(_0x3dcddf){if(_0x3dcddf){logger[_0x6a45('0xe')](_0x6a45('0x2a'));}})[_0x6a45('0x2b')](function(_0x30ba74){logger[_0x6a45('0x2c')](_0x6a45('0x2d'),JSON[_0x6a45('0x19')](_0x30ba74));});}};EmailChannel[_0x6a45('0x12')][_0x6a45('0x22')]=function(_0x421fe2){if(this[_0x6a45('0xf')][_0x421fe2]&&this[_0x6a45('0xf')][_0x421fe2]['Imap']){if(this[_0x6a45('0x10')][this['mailAccounts'][_0x421fe2][_0x6a45('0x16')]['id']]){delete this[_0x6a45('0x10')][this[_0x6a45('0xf')][_0x421fe2][_0x6a45('0x16')]['id']];}this[_0x6a45('0xf')][_0x421fe2][_0x6a45('0x16')]['lastSync']=moment();this[_0x6a45('0x13')](_0x421fe2);}};EmailChannel[_0x6a45('0x12')][_0x6a45('0x2e')]=function(_0xc6a7,_0x9e6869){if(this[_0x6a45('0xf')][_0xc6a7]){this['mailAccounts'][_0xc6a7][_0x6a45('0x16')][_0x6a45('0x15')]='error';this[_0x6a45('0xf')][_0xc6a7][_0x6a45('0x16')][_0x6a45('0x17')]=_0x9e6869;return this[_0x6a45('0x13')](_0xc6a7);}};EmailChannel[_0x6a45('0x12')]['sendMail']=function(_0x3f2d09,_0xca32dd){return this[_0x6a45('0x11')][_0x6a45('0x2f')](_0x3f2d09,_0xca32dd);};EmailChannel[_0x6a45('0x12')][_0x6a45('0x30')]=function(_0xa81abe){var _0x59ce5a=this;if(this[_0x6a45('0xf')][_0xa81abe['id']]){if(_['isNil'](this[_0x6a45('0xf')][_0xa81abe['id']][_0x6a45('0x31')])){this[_0x6a45('0xf')][_0xa81abe['id']][_0x6a45('0x31')]={};}this['mailAccounts'][_0xa81abe['id']]['Smtp'][_0x6a45('0x32')]=moment();return new BPromise(function(_0x21d951,_0x51bc51){return _0x59ce5a[_0x6a45('0x11')][_0x6a45('0x33')](_0xa81abe)[_0x6a45('0x34')](function(_0x33347b){_0x59ce5a['mailAccounts'][_0xa81abe['id']]['Smtp']['status']='verified';_0x59ce5a[_0x6a45('0xf')][_0xa81abe['id']][_0x6a45('0x31')][_0x6a45('0x17')]='';_0x59ce5a[_0x6a45('0x13')](_0xa81abe['id']);_0x21d951(_0x33347b);})[_0x6a45('0x2b')](function(_0x26d9b7){_0x59ce5a[_0x6a45('0xf')][_0xa81abe['id']][_0x6a45('0x31')]['status']=_0x6a45('0x2c');_0x59ce5a['mailAccounts'][_0xa81abe['id']]['Smtp'][_0x6a45('0x17')]=_0x26d9b7;_0x59ce5a[_0x6a45('0x13')](_0xa81abe['id']);_0x51bc51(_0x26d9b7);});});}return this['smtp'][_0x6a45('0x33')](_0xa81abe);};module['exports']=EmailChannel; \ No newline at end of file +var _0xf0f4=['sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','moment','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','isNil','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','lastSync','handleImapError'];(function(_0x50a8b5,_0x396584){var _0x2628da=function(_0x4dbb58){while(--_0x4dbb58){_0x50a8b5['push'](_0x50a8b5['shift']());}};_0x2628da(++_0x396584);}(_0xf0f4,0x182));var _0x4f0f=function(_0x1391f5,_0x4c5d26){_0x1391f5=_0x1391f5-0x0;var _0x21cd7b=_0xf0f4[_0x1391f5];return _0x21cd7b;};'use strict';var _=require('lodash');var moment=require(_0x4f0f('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x4f0f('0x1'));var config=require(_0x4f0f('0x2'));var logger=require('../../../config/logger')(_0x4f0f('0x3'));config[_0x4f0f('0x4')]=_[_0x4f0f('0x5')](config[_0x4f0f('0x4')],{'host':_0x4f0f('0x6'),'port':0x18eb});var io=require(_0x4f0f('0x7'))(new Redis(config[_0x4f0f('0x4')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x4f0f('0x8'));var mailAccount=require(_0x4f0f('0x9'));var md5Accounts={};function EmailChannel(_0x95b1cf){logger['info'](_0x4f0f('0xa'));this[_0x4f0f('0xb')]=_0x95b1cf[_0x4f0f('0xb')];this[_0x4f0f('0xc')]={};this[_0x4f0f('0xd')]=new EmailSmtp();}EmailChannel[_0x4f0f('0xe')][_0x4f0f('0xf')]=function(_0x2b2e49){var _0x4bf11d=this[_0x4f0f('0xb')][_0x2b2e49];var _0x315d01={'id':_0x4bf11d['id'],'name':_0x4bf11d[_0x4f0f('0x10')],'key':_0x4bf11d[_0x4f0f('0x11')],'active':_0x4bf11d[_0x4f0f('0x12')],'Imap':{'status':_0x4bf11d[_0x4f0f('0x13')][_0x4f0f('0x14')],'messageStatus':_0x4bf11d[_0x4f0f('0x13')][_0x4f0f('0x15')],'total':_0x4bf11d[_0x4f0f('0x13')][_0x4f0f('0x16')]}};if(_['isNil'](md5Accounts[_0x2b2e49])){md5Accounts[_0x2b2e49]={};}var _0xebecc0=md5(JSON[_0x4f0f('0x17')](_0x315d01));if(md5Accounts[_0x2b2e49][_0x4f0f('0x18')]!==_0xebecc0){md5Accounts[_0x2b2e49][_0x4f0f('0x18')]=_0xebecc0;io['emit'](_0x4f0f('0x19'),_0x315d01);}};EmailChannel[_0x4f0f('0xe')][_0x4f0f('0x1a')]=function(_0x1c0aa1){for(var _0x4038fd in _0x1c0aa1){if(_0x1c0aa1['hasOwnProperty'](_0x4038fd)){if(_0x1c0aa1[_0x4038fd][_0x4f0f('0x13')]&&_0x1c0aa1[_0x4038fd][_0x4f0f('0x12')]){var _0x20423e=_0x1c0aa1[_0x4038fd]['Imap'];if(!this[_0x4f0f('0xc')][_0x4f0f('0x1b')](_0x20423e['id'])){this[_0x4f0f('0xc')][_0x20423e['id']]=new EmailImap(_0x20423e,_0x1c0aa1[_0x4038fd]['email']);this[_0x4f0f('0xc')][_0x20423e['id']]['on'](_0x4f0f('0x1c'),this[_0x4f0f('0x1d')][_0x4f0f('0x1e')](this,_0x4038fd));this[_0x4f0f('0xc')][_0x20423e['id']]['on'](_0x4f0f('0x3'),this['handleImapEmail'][_0x4f0f('0x1e')](this,_0x4038fd));this['imapAccounts'][_0x20423e['id']]['on'](_0x4f0f('0x1f'),this[_0x4f0f('0x20')]['bind'](this,_0x4038fd));this['imapAccounts'][_0x20423e['id']]['on'](_0x4f0f('0x21'),this['handleImapError'][_0x4f0f('0x1e')](this,_0x4038fd));}}else{if(_[_0x4f0f('0x22')](this[_0x4f0f('0xb')][_0x4038fd][_0x4f0f('0x13')])){this[_0x4f0f('0xb')][_0x4038fd][_0x4f0f('0x13')]={};}this['mailAccounts'][_0x4038fd][_0x4f0f('0x13')][_0x4f0f('0x14')]=_0x4f0f('0x23');this[_0x4f0f('0xb')][_0x4038fd][_0x4f0f('0x13')][_0x4f0f('0x15')]='';this[_0x4f0f('0xf')](_0x4038fd);}}}};EmailChannel[_0x4f0f('0xe')][_0x4f0f('0x1d')]=function(_0xb20be9,_0x37ae8f){if(this[_0x4f0f('0xb')][_0xb20be9]){this[_0x4f0f('0xb')][_0xb20be9]['Imap'][_0x4f0f('0x14')]=_0x4f0f('0x24');this[_0x4f0f('0xb')][_0xb20be9]['Imap'][_0x4f0f('0x15')]=_0x37ae8f['name'];if(_0x37ae8f[_0x4f0f('0x25')]){this[_0x4f0f('0xb')][_0xb20be9]['Imap']['total']=_0x37ae8f[_0x4f0f('0x25')]['total'];}return this[_0x4f0f('0xf')](_0xb20be9);}};EmailChannel[_0x4f0f('0xe')]['handleImapEmail']=function(_0x3d3762,_0xf7acac){logger[_0x4f0f('0x26')](_0x4f0f('0x27'),_0xf7acac['firstName'],_0xf7acac[_0x4f0f('0x28')],_0xf7acac[_0x4f0f('0x29')],_0x3d3762);if(this[_0x4f0f('0xb')][_0x3d3762]){return mailAccount[_0x4f0f('0x2a')](_0x3d3762,_0xf7acac)['then'](function(_0xd987c4){if(_0xd987c4){logger[_0x4f0f('0x26')](_0x4f0f('0x2b'));}})['catch'](function(_0x3724fc){logger[_0x4f0f('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4f0f('0x17')](_0x3724fc));});}};EmailChannel[_0x4f0f('0xe')][_0x4f0f('0x20')]=function(_0x341c6c){if(this['mailAccounts'][_0x341c6c]&&this[_0x4f0f('0xb')][_0x341c6c][_0x4f0f('0x13')]){if(this[_0x4f0f('0xc')][this[_0x4f0f('0xb')][_0x341c6c][_0x4f0f('0x13')]['id']]){delete this[_0x4f0f('0xc')][this[_0x4f0f('0xb')][_0x341c6c][_0x4f0f('0x13')]['id']];}this['mailAccounts'][_0x341c6c][_0x4f0f('0x13')][_0x4f0f('0x2c')]=moment();this[_0x4f0f('0xf')](_0x341c6c);}};EmailChannel[_0x4f0f('0xe')][_0x4f0f('0x2d')]=function(_0x3e2cb6,_0x1849ca){if(this['mailAccounts'][_0x3e2cb6]){this[_0x4f0f('0xb')][_0x3e2cb6][_0x4f0f('0x13')][_0x4f0f('0x14')]='error';this[_0x4f0f('0xb')][_0x3e2cb6]['Imap'][_0x4f0f('0x15')]=_0x1849ca;return this['emit'](_0x3e2cb6);}};EmailChannel[_0x4f0f('0xe')][_0x4f0f('0x2e')]=function(_0x516152,_0x76277b){return this[_0x4f0f('0xd')][_0x4f0f('0x2f')](_0x516152,_0x76277b);};EmailChannel['prototype'][_0x4f0f('0x30')]=function(_0xda7adc){var _0x3484ce=this;if(this[_0x4f0f('0xb')][_0xda7adc['id']]){if(_[_0x4f0f('0x22')](this[_0x4f0f('0xb')][_0xda7adc['id']][_0x4f0f('0x31')])){this[_0x4f0f('0xb')][_0xda7adc['id']][_0x4f0f('0x31')]={};}this[_0x4f0f('0xb')][_0xda7adc['id']][_0x4f0f('0x31')]['lastSync']=moment();return new BPromise(function(_0x3cf571,_0x2bae21){return _0x3484ce[_0x4f0f('0xd')][_0x4f0f('0x32')](_0xda7adc)[_0x4f0f('0x33')](function(_0x178d74){_0x3484ce[_0x4f0f('0xb')][_0xda7adc['id']]['Smtp'][_0x4f0f('0x14')]=_0x4f0f('0x34');_0x3484ce[_0x4f0f('0xb')][_0xda7adc['id']][_0x4f0f('0x31')][_0x4f0f('0x15')]='';_0x3484ce[_0x4f0f('0xf')](_0xda7adc['id']);_0x3cf571(_0x178d74);})['catch'](function(_0x225f84){_0x3484ce[_0x4f0f('0xb')][_0xda7adc['id']]['Smtp']['status']=_0x4f0f('0x21');_0x3484ce[_0x4f0f('0xb')][_0xda7adc['id']][_0x4f0f('0x31')]['messageStatus']=_0x225f84;_0x3484ce[_0x4f0f('0xf')](_0xda7adc['id']);_0x2bae21(_0x225f84);});});}return this['smtp']['verify'](_0xda7adc);};module[_0x4f0f('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ccd3b99..d7b900b 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 _0x1bd1=['events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','connTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','email','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','path','util','imap','randomstring'];(function(_0xed75a1,_0x5da9d1){var _0x206e0e=function(_0x566904){while(--_0x566904){_0xed75a1['push'](_0xed75a1['shift']());}};_0x206e0e(++_0x5da9d1);}(_0x1bd1,0x123));var _0x11bd=function(_0x1d2c4a,_0x54c283){_0x1d2c4a=_0x1d2c4a-0x0;var _0x23e15d=_0x1bd1[_0x1d2c4a];return _0x23e15d;};'use strict';var fs=require('fs');var path=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var Imap=require(_0x11bd('0x2'));var _=require('lodash');var rs=require(_0x11bd('0x3'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x11bd('0x4'))[_0x11bd('0x5')];var utils=require(_0x11bd('0x6'));var logger=require(_0x11bd('0x7'))('email');function EmailImap(_0x336255,_0x1f813c){this[_0x11bd('0x8')]=_0x11bd('0x9');this[_0x11bd('0xa')]=this['getAccount'](_0x336255,_0x1f813c);this[_0x11bd('0x2')]=new Imap(this['account']);this['imap'][_0x11bd('0xb')](_0x11bd('0xc'),this[_0x11bd('0xd')][_0x11bd('0xe')](this));this[_0x11bd('0x2')][_0x11bd('0xb')](_0x11bd('0xf'),this[_0x11bd('0x10')]['bind'](this));this[_0x11bd('0x2')]['on'](_0x11bd('0x11'),this[_0x11bd('0x12')][_0x11bd('0xe')](this));this[_0x11bd('0x2')][_0x11bd('0x13')]();}util[_0x11bd('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x1c832b,_0x2b86a0){var _0x1c9f26={'connTimeout':_0x1c832b['connTimeout']?_0x1c832b[_0x11bd('0x15')]*0x3e8:0x2710,'authTimeout':_0x1c832b['authTimeout']?_0x1c832b['authTimeout']*0x3e8:0x1388};if(_[_0x11bd('0x16')](_0x1c832b[_0x11bd('0x17')])){if(_0x1c832b[_0x11bd('0x18')]){_0x1c9f26[_0x11bd('0x19')]=_0x1c832b[_0x11bd('0x19')];_0x1c9f26['password']=_0x1c832b[_0x11bd('0x1a')];}_0x1c9f26[_0x11bd('0x1b')]=_0x1c832b[_0x11bd('0x1b')];_0x1c9f26[_0x11bd('0x1c')]=_0x1c832b[_0x11bd('0x1c')]||0x3e1;if(_0x1c832b[_0x11bd('0x1d')]){_0x1c9f26[_0x11bd('0x1d')]=!![];}else{_0x1c9f26[_0x11bd('0x1d')]=![];_0x1c9f26['autotls']='required';}}else{_0x1c9f26[_0x11bd('0x19')]=_0x1c832b[_0x11bd('0x19')];_0x1c9f26[_0x11bd('0x1a')]=_0x1c832b[_0x11bd('0x1a')];_0x1c9f26['host']=utils[_0x11bd('0x1e')](_0x1c832b['service']);_0x1c9f26[_0x11bd('0x1c')]=0x3e1;_0x1c9f26[_0x11bd('0x1d')]=!![];}_0x1c9f26[_0x11bd('0x1f')]=_0x2b86a0||_0x1c832b['user']||_0x11bd('0x20');return _0x1c9f26;};EmailImap[_0x11bd('0x21')][_0x11bd('0xd')]=function(){this[_0x11bd('0x2')][_0x11bd('0x22')](this[_0x11bd('0x8')],![],this[_0x11bd('0x23')][_0x11bd('0xe')](this));};EmailImap[_0x11bd('0x21')][_0x11bd('0x23')]=function(_0x344826,_0x3c6dab){if(_0x344826){this['handleError'](_0x344826,!![]);}else{this[_0x11bd('0x24')](_0x11bd('0x25'),_0x3c6dab);this[_0x11bd('0x26')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x522a26){if(_0x522a26){this[_0x11bd('0x12')](_0x522a26,!![]);}else{this[_0x11bd('0x2')][_0x11bd('0xf')]();}};EmailImap[_0x11bd('0x21')][_0x11bd('0x26')]=function(){this[_0x11bd('0x2')][_0x11bd('0x27')](['UNSEEN'],this[_0x11bd('0x28')]['bind'](this));};EmailImap[_0x11bd('0x21')][_0x11bd('0x28')]=function(_0x48bf2b,_0x20f762){if(_0x48bf2b){this[_0x11bd('0x12')](_0x48bf2b,!![]);}else{if(_0x20f762[_0x11bd('0x29')]){try{var _0x2cd9c4=this[_0x11bd('0x2')][_0x11bd('0x2a')](_0x20f762,{'bodies':'','markSeen':!![]});_0x2cd9c4['on'](_0x11bd('0x2b'),this[_0x11bd('0x2c')]['bind'](this));_0x2cd9c4[_0x11bd('0xb')](_0x11bd('0x11'),this[_0x11bd('0x2d')][_0x11bd('0xe')](this));_0x2cd9c4[_0x11bd('0xb')](_0x11bd('0xf'),this[_0x11bd('0x2e')][_0x11bd('0xe')](this));}catch(_0x318e67){logger[_0x11bd('0x11')](_0x318e67);}}else{this['imap'][_0x11bd('0x2f')](!![],this[_0x11bd('0x30')]['bind'](this));}}};EmailImap[_0x11bd('0x21')][_0x11bd('0x2c')]=function(_0x4768fc,_0x2b2397){_0x4768fc['on']('body',this[_0x11bd('0x31')]['bind'](this));_0x4768fc[_0x11bd('0xb')](_0x11bd('0x32'),this[_0x11bd('0x33')][_0x11bd('0xe')](this));_0x4768fc[_0x11bd('0xb')](_0x11bd('0xf'),this[_0x11bd('0x34')][_0x11bd('0xe')](this));};EmailImap[_0x11bd('0x21')][_0x11bd('0x31')]=function(_0xbec55e,_0x1c4b40){simpleParser(_0xbec55e,{'Iconv':Iconv},this[_0x11bd('0x35')][_0x11bd('0xe')](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x4951ba){};EmailImap[_0x11bd('0x21')][_0x11bd('0x34')]=function(){};EmailImap['prototype'][_0x11bd('0x35')]=function(_0x3bfb23,_0x2bbcc1){if(_0x3bfb23){logger['error'](_0x3bfb23);}else{var _0x2b25a3=this;utils[_0x11bd('0x36')](this[_0x11bd('0xa')],_0x2bbcc1,function(_0x2bfbd8){_0x2b25a3[_0x11bd('0x24')](_0x11bd('0x1f'),_0x2bfbd8);});}};EmailImap['prototype'][_0x11bd('0x2e')]=function(){this['imap'][_0x11bd('0x2f')](!![],this['handleCloseBox'][_0x11bd('0xe')](this));};EmailImap[_0x11bd('0x21')][_0x11bd('0x2d')]=function(_0x1b6f54){this[_0x11bd('0x12')](_0x1b6f54);this[_0x11bd('0x2')][_0x11bd('0x2f')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x11bd('0x21')][_0x11bd('0x10')]=function(){this['emit'](_0x11bd('0xf'));};EmailImap['prototype'][_0x11bd('0x12')]=function(_0x11e2f4,_0x30d46d){logger[_0x11bd('0x11')](_0x11bd('0x12'),this[_0x11bd('0xa')]['email'],JSON[_0x11bd('0x37')](_0x11e2f4));var _0x2754c6='';if(_0x11e2f4){if(_0x11e2f4[_0x11bd('0x38')]){_0x2754c6=_0x11e2f4[_0x11bd('0x38')];}else{for(var _0x38f07e in _0x11e2f4){if(_0x11e2f4['hasOwnProperty'](_0x38f07e)){_0x2754c6+=_[_0x11bd('0x39')](_0x38f07e)+':\x20'+_0x11e2f4[_0x38f07e]+'\x0a';}}}}if(_0x30d46d){this['imap'][_0x11bd('0xf')]();}else{this[_0x11bd('0x24')](_0x11bd('0x11'),_0x2754c6);this['emit'](_0x11bd('0xf'));}};module[_0x11bd('0x3a')]=EmailImap; \ No newline at end of file +var _0xd403=['lodash','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','bind','once','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','isNil','user','password','host','port','tls','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','error','handleFetchError','end','handleFetchEnd','body','handleMessageBody','handleMessageEnd','handleSimpleParser','parser','closeBox','handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap'];(function(_0x1656d4,_0x482dda){var _0x349f51=function(_0x139fd4){while(--_0x139fd4){_0x1656d4['push'](_0x1656d4['shift']());}};_0x349f51(++_0x482dda);}(_0xd403,0x1d5));var _0x3d40=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xd403[_0x39096d];return _0x13da4f;};'use strict';var fs=require('fs');var path=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var Imap=require(_0x3d40('0x2'));var _=require(_0x3d40('0x3'));var rs=require('randomstring');var simpleParser=require(_0x3d40('0x4'))['simpleParser'];var Iconv=require(_0x3d40('0x5'))[_0x3d40('0x6')];var EventEmitter=require(_0x3d40('0x7'))[_0x3d40('0x8')];var utils=require(_0x3d40('0x9'));var logger=require(_0x3d40('0xa'))(_0x3d40('0xb'));function EmailImap(_0xfd5569,_0x14dc5b){this[_0x3d40('0xc')]=_0x3d40('0xd');this[_0x3d40('0xe')]=this[_0x3d40('0xf')](_0xfd5569,_0x14dc5b);this[_0x3d40('0x2')]=new Imap(this[_0x3d40('0xe')]);this[_0x3d40('0x2')]['once'](_0x3d40('0x10'),this['handleReady'][_0x3d40('0x11')](this));this[_0x3d40('0x2')][_0x3d40('0x12')]('end',this[_0x3d40('0x13')][_0x3d40('0x11')](this));this[_0x3d40('0x2')]['on']('error',this[_0x3d40('0x14')][_0x3d40('0x11')](this));this['imap']['connect']();}util[_0x3d40('0x15')](EmailImap,EventEmitter);EmailImap[_0x3d40('0x16')][_0x3d40('0xf')]=function(_0x5062ec,_0x2fc2cb){var _0x1e6400={'connTimeout':_0x5062ec[_0x3d40('0x17')]?_0x5062ec[_0x3d40('0x17')]*0x3e8:0x2710,'authTimeout':_0x5062ec[_0x3d40('0x18')]?_0x5062ec[_0x3d40('0x18')]*0x3e8:0x1388};if(_[_0x3d40('0x19')](_0x5062ec['service'])){if(_0x5062ec['authentication']){_0x1e6400[_0x3d40('0x1a')]=_0x5062ec[_0x3d40('0x1a')];_0x1e6400[_0x3d40('0x1b')]=_0x5062ec[_0x3d40('0x1b')];}_0x1e6400[_0x3d40('0x1c')]=_0x5062ec[_0x3d40('0x1c')];_0x1e6400[_0x3d40('0x1d')]=_0x5062ec[_0x3d40('0x1d')]||0x3e1;if(_0x5062ec[_0x3d40('0x1e')]){_0x1e6400[_0x3d40('0x1e')]=!![];}else{_0x1e6400[_0x3d40('0x1e')]=![];_0x1e6400['autotls']='required';}}else{_0x1e6400[_0x3d40('0x1a')]=_0x5062ec[_0x3d40('0x1a')];_0x1e6400[_0x3d40('0x1b')]=_0x5062ec[_0x3d40('0x1b')];_0x1e6400[_0x3d40('0x1c')]=utils[_0x3d40('0x1f')](_0x5062ec[_0x3d40('0x20')]);_0x1e6400[_0x3d40('0x1d')]=0x3e1;_0x1e6400[_0x3d40('0x1e')]=!![];}_0x1e6400[_0x3d40('0xb')]=_0x2fc2cb||_0x5062ec[_0x3d40('0x1a')]||_0x3d40('0x21');return _0x1e6400;};EmailImap[_0x3d40('0x16')]['handleReady']=function(){this[_0x3d40('0x2')][_0x3d40('0x22')](this[_0x3d40('0xc')],![],this[_0x3d40('0x23')][_0x3d40('0x11')](this));};EmailImap['prototype'][_0x3d40('0x23')]=function(_0x28c438,_0x3cc4df){if(_0x28c438){this[_0x3d40('0x14')](_0x28c438,!![]);}else{this[_0x3d40('0x24')]('box',_0x3cc4df);this[_0x3d40('0x25')]();}};EmailImap[_0x3d40('0x16')]['handleCloseBox']=function(_0x412d46){if(_0x412d46){this[_0x3d40('0x14')](_0x412d46,!![]);}else{this[_0x3d40('0x2')]['end']();}};EmailImap[_0x3d40('0x16')][_0x3d40('0x25')]=function(){this[_0x3d40('0x2')][_0x3d40('0x26')]([_0x3d40('0x27')],this[_0x3d40('0x28')][_0x3d40('0x11')](this));};EmailImap[_0x3d40('0x16')]['handleReadUnseen']=function(_0x4e536f,_0x394fab){if(_0x4e536f){this[_0x3d40('0x14')](_0x4e536f,!![]);}else{if(_0x394fab['length']){try{var _0x2c1ce6=this['imap'][_0x3d40('0x29')](_0x394fab,{'bodies':'','markSeen':!![]});_0x2c1ce6['on']('message',this[_0x3d40('0x2a')][_0x3d40('0x11')](this));_0x2c1ce6[_0x3d40('0x12')](_0x3d40('0x2b'),this[_0x3d40('0x2c')]['bind'](this));_0x2c1ce6['once'](_0x3d40('0x2d'),this[_0x3d40('0x2e')][_0x3d40('0x11')](this));}catch(_0x5b4f2b){logger[_0x3d40('0x2b')](_0x5b4f2b);}}else{this['imap']['closeBox'](!![],this['handleCloseBox'][_0x3d40('0x11')](this));}}};EmailImap[_0x3d40('0x16')][_0x3d40('0x2a')]=function(_0x2d523b,_0x30b4a4){_0x2d523b['on'](_0x3d40('0x2f'),this[_0x3d40('0x30')][_0x3d40('0x11')](this));_0x2d523b[_0x3d40('0x12')]('attributes',this['handleMessageAttributes'][_0x3d40('0x11')](this));_0x2d523b[_0x3d40('0x12')](_0x3d40('0x2d'),this[_0x3d40('0x31')][_0x3d40('0x11')](this));};EmailImap[_0x3d40('0x16')]['handleMessageBody']=function(_0x416fe8,_0x250bb7){simpleParser(_0x416fe8,{'Iconv':Iconv},this[_0x3d40('0x32')]['bind'](this));};EmailImap[_0x3d40('0x16')]['handleMessageAttributes']=function(_0x34c619){};EmailImap[_0x3d40('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x3d40('0x16')]['handleSimpleParser']=function(_0x4cf4cf,_0x184dcd){if(_0x4cf4cf){logger[_0x3d40('0x2b')](_0x4cf4cf);}else{var _0x583d6b=this;utils[_0x3d40('0x33')](this[_0x3d40('0xe')],_0x184dcd,function(_0x15b31e){_0x583d6b['emit'](_0x3d40('0xb'),_0x15b31e);});}};EmailImap[_0x3d40('0x16')][_0x3d40('0x2e')]=function(){this[_0x3d40('0x2')][_0x3d40('0x34')](!![],this[_0x3d40('0x35')][_0x3d40('0x11')](this));};EmailImap[_0x3d40('0x16')][_0x3d40('0x2c')]=function(_0x322030){this[_0x3d40('0x14')](_0x322030);this['imap'][_0x3d40('0x34')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype'][_0x3d40('0x13')]=function(){this[_0x3d40('0x24')](_0x3d40('0x2d'));};EmailImap['prototype'][_0x3d40('0x14')]=function(_0x46527d,_0x46e59d){logger[_0x3d40('0x2b')]('handleError',this[_0x3d40('0xe')][_0x3d40('0xb')],JSON[_0x3d40('0x36')](_0x46527d));var _0x1be4a9='';if(_0x46527d){if(_0x46527d[_0x3d40('0x37')]){_0x1be4a9=_0x46527d[_0x3d40('0x37')];}else{for(var _0x3c4651 in _0x46527d){if(_0x46527d[_0x3d40('0x38')](_0x3c4651)){_0x1be4a9+=_[_0x3d40('0x39')](_0x3c4651)+':\x20'+_0x46527d[_0x3c4651]+'\x0a';}}}}if(_0x46e59d){this[_0x3d40('0x2')]['end']();}else{this['emit'](_0x3d40('0x2b'),_0x1be4a9);this[_0x3d40('0x24')](_0x3d40('0x2d'));}};module[_0x3d40('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c13cac7..1bbc03d 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 _0xf229=['nodemailer-plugin-inline-base64','send','createTransport','use','toString','prototype','verify'];(function(_0x56f745,_0x9cf373){var _0x530451=function(_0x4de3a0){while(--_0x4de3a0){_0x56f745['push'](_0x56f745['shift']());}};_0x530451(++_0x9cf373);}(_0xf229,0x77));var _0x9f22=function(_0x1935b8,_0x5d2c40){_0x1935b8=_0x1935b8-0x0;var _0x370f25=_0xf229[_0x1935b8];return _0x370f25;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x9f22('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9f22('0x1')]=function(_0xf8f96b,_0x3a3f36){return new BPromise(function(_0x462bb1,_0x4cc972){var _0x5d1267=nodemailer[_0x9f22('0x2')](_0xf8f96b);_0x5d1267[_0x9f22('0x3')]('compile',inlineBase64());_0x5d1267['sendMail'](_0x3a3f36,function(_0x347ebb,_0x38c4d7){if(_0x347ebb){_0x4cc972(_0x347ebb[_0x9f22('0x4')]());}else{_0x462bb1(_0x38c4d7);}});});};EmailSmtp[_0x9f22('0x5')][_0x9f22('0x6')]=function(_0x496dbc){return new BPromise(function(_0x148f81,_0x20ab93){var _0x5bfacb=nodemailer[_0x9f22('0x2')](_0x496dbc);_0x5bfacb[_0x9f22('0x6')](function(_0x3aaba0,_0x2f4686){if(_0x3aaba0){_0x20ab93(_0x3aaba0[_0x9f22('0x4')]());}else{if(_0x2f4686){_0x148f81(_0x2f4686);}else{_0x20ab93('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xdfee=['exports','nodemailer','bluebird','prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x45c1ec,_0x18f4cd){var _0xf1440b=function(_0x2033f0){while(--_0x2033f0){_0x45c1ec['push'](_0x45c1ec['shift']());}};_0xf1440b(++_0x18f4cd);}(_0xdfee,0xdd));var _0xedfe=function(_0x233e21,_0x1f1c79){_0x233e21=_0x233e21-0x0;var _0x53016f=_0xdfee[_0x233e21];return _0x53016f;};'use strict';var nodemailer=require(_0xedfe('0x0'));var BPromise=require(_0xedfe('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xedfe('0x2')]['send']=function(_0x351f2a,_0x1684aa){return new BPromise(function(_0x2e4bf7,_0xe67cf8){var _0x1d16a9=nodemailer[_0xedfe('0x3')](_0x351f2a);_0x1d16a9[_0xedfe('0x4')](_0xedfe('0x5'),inlineBase64());_0x1d16a9[_0xedfe('0x6')](_0x1684aa,function(_0x56b7b6,_0x1dae13){if(_0x56b7b6){_0xe67cf8(_0x56b7b6[_0xedfe('0x7')]());}else{_0x2e4bf7(_0x1dae13);}});});};EmailSmtp[_0xedfe('0x2')][_0xedfe('0x8')]=function(_0x373510){return new BPromise(function(_0x45a943,_0xacc5c7){var _0x40213e=nodemailer[_0xedfe('0x3')](_0x373510);_0x40213e[_0xedfe('0x8')](function(_0x234bda,_0x4b2021){if(_0x234bda){_0xacc5c7(_0x234bda[_0xedfe('0x7')]());}else{if(_0x4b2021){_0x45a943(_0x4b2021);}else{_0xacc5c7(_0xedfe('0x9'));}}});});};module[_0xedfe('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index bf4d053..c882a93 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 _0x18b8=['messageId','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','Attachments','Title','Data','

Empty\x20message

','getHost','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','util','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','pop','isEmpty','html','replace','body','textAsHtml','0x1?_0x5eba0a[_0x818b('0xf')]():'';}return'';}function getMails(_0x14b4d7,_0x3f72f0){var _0x1dcdcd='';for(var _0x259ee4=0x0;_0x259ee4<_0x3f72f0['value'][_0x818b('0xe')];_0x259ee4+=0x1){if(_0x3f72f0[_0x818b('0x7')][_0x259ee4][_0x818b('0x8')]!==_0x14b4d7){if(!_[_0x818b('0x10')](_0x1dcdcd)){_0x1dcdcd+=',';}_0x1dcdcd+=_0x3f72f0['value'][_0x259ee4]['name']||_0x3f72f0['value'][_0x259ee4][_0x818b('0x8')]||'';_0x1dcdcd+='\x20<';_0x1dcdcd+=_0x3f72f0['value'][_0x259ee4][_0x818b('0x8')]?_0x3f72f0[_0x818b('0x7')][_0x259ee4][_0x818b('0x8')]:_0x818b('0x9')+random['generate'](0x6)+_0x818b('0xb');_0x1dcdcd+='>';}}return _0x1dcdcd;}function parseEmail(_0x52cea2,_0x5d82c3,_0x2bf6fe){if(_0x5d82c3[_0x818b('0x11')]){var _0x526b44=/)<[^<]*)*<\/script>/gi;while(_0x526b44['test'](_0x5d82c3[_0x818b('0x11')])){_0x5d82c3[_0x818b('0x11')]=_0x5d82c3['html'][_0x818b('0x12')](_0x526b44,'');}_0x2bf6fe[_0x818b('0x13')]=_0x5d82c3[_0x818b('0x11')];}else{_0x2bf6fe[_0x818b('0x13')]=_0x5d82c3[_0x818b('0x14')];}if(_0x2bf6fe[_0x818b('0x13')]){_0x2bf6fe[_0x818b('0x13')]=_0x2bf6fe[_0x818b('0x13')][_0x818b('0x12')](/Empty\x20message

';if(_0x233616[_0x818b('0x32')]){for(var _0x124579=0x0;_0x124579<_0x233616[_0x818b('0x32')][_0x818b('0xe')];_0x124579++){var _0x4473f0=_0x233616[_0x818b('0x32')][_0x124579];_0x4aa00d['message'][_0x818b('0x19')]['push']({'filename':_0x4473f0[_0x818b('0x33')],'content':new Buffer(_0x4473f0[_0x818b('0x34')])});}}}_0x381d8e(parseEmail(_0xf34f5e,_0x2da4ce,_0x4aa00d));});}else{_0x2da4ce['html']=_0x818b('0x35');_0x381d8e(parseEmail(_0xf34f5e,_0x2da4ce,_0x4aa00d));}}else{_0x381d8e(parseEmail(_0xf34f5e,_0x2da4ce,_0x4aa00d));}};exports[_0x818b('0x36')]=function(_0xfed6e6){switch(_0xfed6e6){case'gmail':return _0x818b('0x37');case'yahoo':return _0x818b('0x38');case'hotmail':return _0x818b('0x39');case _0x818b('0x3a'):return _0x818b('0x3b');}return _0x818b('0x3c');}; \ No newline at end of file +var _0xbd22=['Attachments','Data','getHost','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','name','split','length','join','Anonymous','pop','isEmpty','@xcally.com','html','body','textAsHtml','replace','message','includes','originTo','originCc','bcc','attachments','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','from','subject','date','filter','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

'];(function(_0x20d27b,_0x28d27a){var _0x24a0de=function(_0x3b290b){while(--_0x3b290b){_0x20d27b['push'](_0x20d27b['shift']());}};_0x24a0de(++_0x28d27a);}(_0xbd22,0xf7));var _0x2bd2=function(_0x5715af,_0x49af7b){_0x5715af=_0x5715af-0x0;var _0x302b98=_0xbd22[_0x5715af];return _0x302b98;};'use strict';var _=require(_0x2bd2('0x0'));var moment=require(_0x2bd2('0x1'));var random=require(_0x2bd2('0x2'));var fs=require('fs');var path=require(_0x2bd2('0x3'));var util=require(_0x2bd2('0x4'));var tnef=require(_0x2bd2('0x5'));var logger=require(_0x2bd2('0x6'))(_0x2bd2('0x7'));var config=require(_0x2bd2('0x8'));function getAddress(_0x3e16b8){var _0x5f427b=_[_0x2bd2('0x9')](_0x3e16b8[_0x2bd2('0xa')]);return _0x5f427b&&_0x5f427b[_0x2bd2('0xb')]?_0x5f427b['address']:_0x2bd2('0xc')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x36f3b0){var _0x1fb5aa=_['head'](_0x36f3b0[_0x2bd2('0xa')]);if(_0x1fb5aa&&_0x1fb5aa[_0x2bd2('0xd')]){var _0x206f25=_0x1fb5aa[_0x2bd2('0xd')][_0x2bd2('0xe')](/\s+/);return _0x206f25[_0x2bd2('0xf')]?_0x206f25['slice'](0x0,-0x1)[_0x2bd2('0x10')]('\x20'):_0x1fb5aa['name'];}return _0x2bd2('0x11');}function getLastName(_0x317a31){var _0x53c9b8=_['head'](_0x317a31['value']);if(_0x53c9b8&&_0x53c9b8[_0x2bd2('0xd')]){var _0x1914f4=_0x53c9b8[_0x2bd2('0xd')][_0x2bd2('0xe')](/\s+/);return _0x1914f4[_0x2bd2('0xf')]>0x1?_0x1914f4[_0x2bd2('0x12')]():'';}return'';}function getMails(_0x1b7cb3,_0x104a9c){var _0x460805='';for(var _0x2c7647=0x0;_0x2c7647<_0x104a9c['value'][_0x2bd2('0xf')];_0x2c7647+=0x1){if(_0x104a9c[_0x2bd2('0xa')][_0x2c7647][_0x2bd2('0xb')]!==_0x1b7cb3){if(!_[_0x2bd2('0x13')](_0x460805)){_0x460805+=',';}_0x460805+=_0x104a9c['value'][_0x2c7647][_0x2bd2('0xd')]||_0x104a9c[_0x2bd2('0xa')][_0x2c7647]['address']||'';_0x460805+='\x20<';_0x460805+=_0x104a9c['value'][_0x2c7647][_0x2bd2('0xb')]?_0x104a9c[_0x2bd2('0xa')][_0x2c7647][_0x2bd2('0xb')]:_0x2bd2('0xc')+random['generate'](0x6)+_0x2bd2('0x14');_0x460805+='>';}}return _0x460805;}function parseEmail(_0x1885be,_0x3b9ede,_0x1b7852){if(_0x3b9ede[_0x2bd2('0x15')]){var _0x5dfbe5=/)<[^<]*)*<\/script>/gi;while(_0x5dfbe5['test'](_0x3b9ede[_0x2bd2('0x15')])){_0x3b9ede['html']=_0x3b9ede['html']['replace'](_0x5dfbe5,'');}_0x1b7852[_0x2bd2('0x16')]=_0x3b9ede[_0x2bd2('0x15')];}else{_0x1b7852[_0x2bd2('0x16')]=_0x3b9ede[_0x2bd2('0x17')];}if(_0x1b7852[_0x2bd2('0x16')]){_0x1b7852[_0x2bd2('0x16')]=_0x1b7852[_0x2bd2('0x16')][_0x2bd2('0x18')](/0x0){if(this[_0x180274+_0x4f12('0x26')]>0x0&&this[_0x180274+_0x4f12('0x25')]>=this[_0x180274+'Capacity']){return'maxcapacity';}else{return _0x4f12('0x27');}}else{return _0x4f12('0x28');}};Agent[_0x4f12('0x23')][_0x4f12('0x29')]=function(){var _0x315d5f=[_0x4f12('0x2a'),_0x4f12('0x2b'),_0x4f12('0x2c'),_0x4f12('0x2d'),_0x4f12('0x2e')];for(var _0x121045=0x0;_0x121045<_0x315d5f[_0x4f12('0x2f')];_0x121045+=0x1){var _0x32732f=this['getChannelStatus'](_0x315d5f[_0x121045]);if(this[_0x315d5f[_0x121045]+_0x4f12('0x30')]!==_0x32732f){this[_0x315d5f[_0x121045]+_0x4f12('0x31')]=_['toNumber'](moment()[_0x4f12('0x32')]('x'));}this[_0x315d5f[_0x121045]+_0x4f12('0x30')]=_0x32732f;}var _0x3657a0={'id':this['id'],'name':this[_0x4f12('0x7')],'online':this['online'],'voicePause':this[_0x4f12('0x9')],'chatPause':this[_0x4f12('0xa')],'mailPause':this[_0x4f12('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x4f12('0xc')],'openchannelPause':this[_0x4f12('0xe')],'chatStatus':this[_0x4f12('0x33')],'chatStatusTime':this[_0x4f12('0xf')],'chatCapacity':this[_0x4f12('0x10')],'chatCurrentCapacity':this[_0x4f12('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4f12('0x13')],'mailCapacity':this[_0x4f12('0x14')],'mailCurrentCapacity':this[_0x4f12('0x34')],'faxStatus':this[_0x4f12('0x15')],'faxStatusTime':this[_0x4f12('0x17')],'faxCapacity':this[_0x4f12('0x18')],'faxCurrentCapacity':this[_0x4f12('0x19')],'smsStatus':this[_0x4f12('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x4f12('0x1c')],'smsCurrentCapacity':this[_0x4f12('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x4f12('0x21')],'busy':this[_0x4f12('0x35')],'busyQueue':this[_0x4f12('0x22')]};var _0x4502d1=md5(JSON[_0x4f12('0x36')](_0x3657a0));if(this[_0x4f12('0x1')]!==_0x4502d1){this[_0x4f12('0x1')]=_0x4502d1;io[_0x4f12('0x37')](_0x4f12('0x38'),_0x3657a0);}};module['exports']=Agent; \ No newline at end of file +var _0xbf18=['getChannelStatus','CurrentCapacity','working','mail','chat','openchannel','fax','sms','length','Status','StatusTime','format','chatStatus','chatStatusTime','mailCurrentCapacity','smsCurrentCapacity','stringify','md5','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','prototype'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xbf18,0x12d));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8bf1('0x0'));var moment=require(_0x8bf1('0x1'));var md5=require('md5');var Redis=require(_0x8bf1('0x2'));var config=require(_0x8bf1('0x3'));config[_0x8bf1('0x4')]=_[_0x8bf1('0x5')](config[_0x8bf1('0x4')],{'host':_0x8bf1('0x6'),'port':0x18eb});var io=require(_0x8bf1('0x7'))(new Redis(config[_0x8bf1('0x4')]));function Agent(_0x4d74c0){this['id']=_0x4d74c0['id']||0x0;this[_0x8bf1('0x8')]=_0x4d74c0[_0x8bf1('0x8')]||'';this[_0x8bf1('0x9')]=_0x4d74c0[_0x8bf1('0x9')]||!![];this[_0x8bf1('0xa')]=_0x4d74c0['voicePause']||![];this[_0x8bf1('0xb')]=_0x4d74c0[_0x8bf1('0xb')]||![];this['mailPause']=_0x4d74c0[_0x8bf1('0xc')]||![];this[_0x8bf1('0xd')]=_0x4d74c0['faxPause']||![];this[_0x8bf1('0xe')]=_0x4d74c0[_0x8bf1('0xe')]||![];this['openchannelPause']=_0x4d74c0[_0x8bf1('0xf')]||![];this['chatStatus']=_0x8bf1('0x10');this['chatStatusTime']=0x0;this['chatCapacity']=_0x4d74c0[_0x8bf1('0x11')]||0x0;this[_0x8bf1('0x12')]=0x0;this[_0x8bf1('0x13')]=_0x8bf1('0x10');this[_0x8bf1('0x14')]=0x0;this[_0x8bf1('0x15')]=_0x4d74c0[_0x8bf1('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x8bf1('0x16')]=_0x8bf1('0x10');this[_0x8bf1('0x17')]=0x0;this[_0x8bf1('0x18')]=_0x4d74c0[_0x8bf1('0x18')]||0x0;this[_0x8bf1('0x19')]=0x0;this[_0x8bf1('0x1a')]=_0x8bf1('0x10');this[_0x8bf1('0x1b')]=0x0;this[_0x8bf1('0x1c')]=_0x4d74c0[_0x8bf1('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x8bf1('0x1d')]=_0x8bf1('0x10');this[_0x8bf1('0x1e')]=0x0;this[_0x8bf1('0x1f')]=_0x4d74c0[_0x8bf1('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8bf1('0x20')]=![];this[_0x8bf1('0x21')]=undefined;this['md5']='';this['updateRealtime']();}Agent[_0x8bf1('0x22')][_0x8bf1('0x23')]=function(_0x3193ad){if(this[_0x3193ad+_0x8bf1('0x24')]>0x0){if(this[_0x3193ad+'Capacity']>0x0&&this[_0x3193ad+_0x8bf1('0x24')]>=this[_0x3193ad+'Capacity']){return'maxcapacity';}else{return _0x8bf1('0x25');}}else{return'idle';}};Agent[_0x8bf1('0x22')]['updateRealtime']=function(){var _0x4d2fc1=[_0x8bf1('0x26'),_0x8bf1('0x27'),_0x8bf1('0x28'),_0x8bf1('0x29'),_0x8bf1('0x2a')];for(var _0x1c5f44=0x0;_0x1c5f44<_0x4d2fc1[_0x8bf1('0x2b')];_0x1c5f44+=0x1){var _0x15ccf3=this['getChannelStatus'](_0x4d2fc1[_0x1c5f44]);if(this[_0x4d2fc1[_0x1c5f44]+_0x8bf1('0x2c')]!==_0x15ccf3){this[_0x4d2fc1[_0x1c5f44]+_0x8bf1('0x2d')]=_['toNumber'](moment()[_0x8bf1('0x2e')]('x'));}this[_0x4d2fc1[_0x1c5f44]+_0x8bf1('0x2c')]=_0x15ccf3;}var _0x52c715={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x8bf1('0xa')],'chatPause':this[_0x8bf1('0xb')],'mailPause':this[_0x8bf1('0xc')],'smsPause':this[_0x8bf1('0xe')],'faxPause':this[_0x8bf1('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x8bf1('0x2f')],'chatStatusTime':this[_0x8bf1('0x30')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8bf1('0x12')],'mailStatus':this[_0x8bf1('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x8bf1('0x15')],'mailCurrentCapacity':this[_0x8bf1('0x31')],'faxStatus':this[_0x8bf1('0x16')],'faxStatusTime':this[_0x8bf1('0x17')],'faxCapacity':this[_0x8bf1('0x18')],'faxCurrentCapacity':this[_0x8bf1('0x19')],'smsStatus':this[_0x8bf1('0x1a')],'smsStatusTime':this[_0x8bf1('0x1b')],'smsCapacity':this[_0x8bf1('0x1c')],'smsCurrentCapacity':this[_0x8bf1('0x32')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x8bf1('0x1e')],'openchannelCapacity':this[_0x8bf1('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x8bf1('0x21')]};var _0x376f43=md5(JSON[_0x8bf1('0x33')](_0x52c715));if(this[_0x8bf1('0x34')]!==_0x376f43){this[_0x8bf1('0x34')]=_0x376f43;io[_0x8bf1('0x35')](_0x8bf1('0x36'),_0x52c715);}};module[_0x8bf1('0x37')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c138855..f83842a 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 _0x9c53=['online','chatPause','available','waiting','stringify','format','chat:queue:%s','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused'];(function(_0x4715b7,_0x4dedec){var _0x11d72a=function(_0x393699){while(--_0x393699){_0x4715b7['push'](_0x4715b7['shift']());}};_0x11d72a(++_0x4dedec);}(_0x9c53,0xb0));var _0x39c5=function(_0x55bb2d,_0x83292a){_0x55bb2d=_0x55bb2d-0x0;var _0x251c90=_0x9c53[_0x55bb2d];return _0x251c90;};'use strict';var _=require(_0x39c5('0x0'));var md5=require(_0x39c5('0x1'));var util=require(_0x39c5('0x2'));var Redis=require(_0x39c5('0x3'));var config=require('../../../config/environment');config[_0x39c5('0x4')]=_[_0x39c5('0x5')](config['redis'],{'host':_0x39c5('0x6'),'port':0x18eb});var io=require(_0x39c5('0x7'))(new Redis(config['redis']));function ChatQueue(_0x20f4a0){this['id']=_0x20f4a0['id']||0x0;this[_0x39c5('0x8')]=_0x20f4a0['name']||'';this[_0x39c5('0x9')]=_0x20f4a0[_0x39c5('0x9')]||0xa;this[_0x39c5('0xa')]=_0x20f4a0[_0x39c5('0xa')]||'beepall';this['Agents']=_0x20f4a0['Agents'];this[_0x39c5('0xb')]={};this['waiting']=0x0;this[_0x39c5('0x1')]='';this[_0x39c5('0xc')]();this[_0x39c5('0xd')]();}ChatQueue[_0x39c5('0xe')][_0x39c5('0xc')]=function(){var _0x49a250=this[_0x39c5('0xb')][_0x39c5('0xf')];this['mapAgentsId']=_[_0x39c5('0x10')](this[_0x39c5('0x11')],'id');this[_0x39c5('0xb')]['_rr']=_0x49a250;};ChatQueue['prototype'][_0x39c5('0xd')]=function(){this[_0x39c5('0x12')]=0x0;this[_0x39c5('0x13')]=0x0;for(var _0x48287e=0x0;_0x48287e=0x0?this['available']:0x0;var _0x4b0a2d={'id':this['id'],'available':this[_0x39c5('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x39c5('0x8')],'paused':this[_0x39c5('0x13')],'waiting':this[_0x39c5('0x17')]};var _0x410386=md5(JSON[_0x39c5('0x18')](_0x4b0a2d));if(this['md5']!==_0x410386){this[_0x39c5('0x1')]=_0x410386;io['to'](util[_0x39c5('0x19')](_0x39c5('0x1a'),_0x4b0a2d[_0x39c5('0x8')]))['emit']('chat_queue:save',_0x4b0a2d);}};module[_0x39c5('0x1b')]=ChatQueue; \ No newline at end of file +var _0x3a97=['loggedIn','stringify','format','emit','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','paused','length','online','chatPause','available'];(function(_0x563d50,_0x165800){var _0x9a38d4=function(_0x207829){while(--_0x207829){_0x563d50['push'](_0x563d50['shift']());}};_0x9a38d4(++_0x165800);}(_0x3a97,0x17e));var _0x73a9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3a97[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x73a9('0x0'));var md5=require(_0x73a9('0x1'));var util=require('util');var Redis=require(_0x73a9('0x2'));var config=require(_0x73a9('0x3'));config['redis']=_[_0x73a9('0x4')](config[_0x73a9('0x5')],{'host':_0x73a9('0x6'),'port':0x18eb});var io=require(_0x73a9('0x7'))(new Redis(config[_0x73a9('0x5')]));function ChatQueue(_0x3850db){this['id']=_0x3850db['id']||0x0;this[_0x73a9('0x8')]=_0x3850db['name']||'';this['timeout']=_0x3850db[_0x73a9('0x9')]||0xa;this[_0x73a9('0xa')]=_0x3850db[_0x73a9('0xa')]||_0x73a9('0xb');this['Agents']=_0x3850db[_0x73a9('0xc')];this[_0x73a9('0xd')]={};this[_0x73a9('0xe')]=0x0;this['md5']='';this[_0x73a9('0xf')]();this[_0x73a9('0x10')]();}ChatQueue['prototype'][_0x73a9('0xf')]=function(){var _0x58807b=this[_0x73a9('0xd')][_0x73a9('0x11')];this['mapAgentsId']=_[_0x73a9('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x73a9('0x11')]=_0x58807b;};ChatQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x73a9('0x13')]=0x0;for(var _0x26010b=0x0;_0x26010b=0x0?this[_0x73a9('0x17')]:0x0;var _0x2af7db={'id':this['id'],'available':this[_0x73a9('0x17')],'loggedIn':this[_0x73a9('0x18')],'name':this[_0x73a9('0x8')],'paused':this[_0x73a9('0x13')],'waiting':this[_0x73a9('0xe')]};var _0x1a23a3=md5(JSON[_0x73a9('0x19')](_0x2af7db));if(this['md5']!==_0x1a23a3){this['md5']=_0x1a23a3;io['to'](util[_0x73a9('0x1a')]('chat:queue:%s',_0x2af7db['name']))[_0x73a9('0x1b')]('chat_queue:save',_0x2af7db);}};module[_0x73a9('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 7d79aaa..24c6039 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 _0xa0c0=['_rr','paused','length','online','loggedIn','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype'];(function(_0x345ac6,_0x43a5de){var _0x4c6fe6=function(_0x433e61){while(--_0x433e61){_0x345ac6['push'](_0x345ac6['shift']());}};_0x4c6fe6(++_0x43a5de);}(_0xa0c0,0x12f));var _0x0a0c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa0c0[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0a0c('0x0'));var md5=require(_0x0a0c('0x1'));var util=require(_0x0a0c('0x2'));var Redis=require(_0x0a0c('0x3'));var config=require(_0x0a0c('0x4'));config['redis']=_[_0x0a0c('0x5')](config[_0x0a0c('0x6')],{'host':_0x0a0c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x409883){this['id']=_0x409883['id']||0x0;this[_0x0a0c('0x8')]=_0x409883[_0x0a0c('0x8')]||'';this[_0x0a0c('0x9')]=_0x409883[_0x0a0c('0x9')]||0xa;this[_0x0a0c('0xa')]=_0x409883[_0x0a0c('0xa')]||'beepall';this[_0x0a0c('0xb')]=_0x409883['Agents'];this[_0x0a0c('0xc')]={};this[_0x0a0c('0xd')]=0x0;this[_0x0a0c('0x1')]='';this[_0x0a0c('0xe')]();this['updateRealtime']();}FaxQueue[_0x0a0c('0xf')][_0x0a0c('0xe')]=function(){var _0x38c531=this['mapAgentsId']['_rr'];this[_0x0a0c('0xc')]=_['map'](this[_0x0a0c('0xb')],'id');this[_0x0a0c('0xc')][_0x0a0c('0x10')]=_0x38c531;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x0a0c('0x11')]=0x0;for(var _0x1a0a5e=0x0;_0x1a0a5e=0x0?this['available']:0x0;var _0x467822={'id':this['id'],'available':this[_0x0a0c('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x0a0c('0x8')],'paused':this['paused'],'waiting':this[_0x0a0c('0xd')]};var _0x3d1738=md5(JSON[_0x0a0c('0x17')](_0x467822));if(this[_0x0a0c('0x1')]!==_0x3d1738){this[_0x0a0c('0x1')]=_0x3d1738;io['to'](util[_0x0a0c('0x18')](_0x0a0c('0x19'),_0x467822[_0x0a0c('0x8')]))[_0x0a0c('0x1a')](_0x0a0c('0x1b'),_0x467822);}};module[_0x0a0c('0x1c')]=FaxQueue; \ No newline at end of file +var _0xa062=['map','paused','online','loggedIn','faxPause','available','stringify','format','emit','fax_queue:save','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0xa062,0x82));var _0x2a06=function(_0x592722,_0x14fe23){_0x592722=_0x592722-0x0;var _0x5d31a1=_0xa062[_0x592722];return _0x5d31a1;};'use strict';var _=require('lodash');var md5=require(_0x2a06('0x0'));var util=require(_0x2a06('0x1'));var Redis=require(_0x2a06('0x2'));var config=require('../../../config/environment');config[_0x2a06('0x3')]=_['defaults'](config['redis'],{'host':_0x2a06('0x4'),'port':0x18eb});var io=require(_0x2a06('0x5'))(new Redis(config[_0x2a06('0x3')]));function FaxQueue(_0x4685e1){this['id']=_0x4685e1['id']||0x0;this[_0x2a06('0x6')]=_0x4685e1[_0x2a06('0x6')]||'';this[_0x2a06('0x7')]=_0x4685e1[_0x2a06('0x7')]||0xa;this[_0x2a06('0x8')]=_0x4685e1[_0x2a06('0x8')]||'beepall';this[_0x2a06('0x9')]=_0x4685e1[_0x2a06('0x9')];this[_0x2a06('0xa')]={};this[_0x2a06('0xb')]=0x0;this[_0x2a06('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x2a06('0xc')][_0x2a06('0xd')]=function(){var _0x1c4d84=this[_0x2a06('0xa')]['_rr'];this[_0x2a06('0xa')]=_[_0x2a06('0xe')](this[_0x2a06('0x9')],'id');this['mapAgentsId']['_rr']=_0x1c4d84;};FaxQueue[_0x2a06('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x2a06('0xf')]=0x0;for(var _0x32ba43=0x0;_0x32ba43=0x0?this['available']:0x0;var _0x324b8b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2a06('0x11')],'name':this[_0x2a06('0x6')],'paused':this[_0x2a06('0xf')],'waiting':this[_0x2a06('0xb')]};var _0x12eda8=md5(JSON[_0x2a06('0x14')](_0x324b8b));if(this['md5']!==_0x12eda8){this[_0x2a06('0x0')]=_0x12eda8;io['to'](util[_0x2a06('0x15')]('fax:queue:%s',_0x324b8b['name']))[_0x2a06('0x16')](_0x2a06('0x17'),_0x324b8b);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index fffbd83..d87ca19 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 _0xcd9f=['name','Intervals','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcd9f,0xa2));var _0xfcd9=function(_0x375009,_0x21c8ad){_0x375009=_0x375009-0x0;var _0x15d93c=_0xcd9f[_0x375009];return _0x15d93c;};'use strict';function Interval(_0x11a97e){this['id']=_0x11a97e['id']||0x0;this['name']=_0x11a97e[_0xfcd9('0x0')]||'';this[_0xfcd9('0x1')]=_0x11a97e[_0xfcd9('0x1')]||{};}module[_0xfcd9('0x2')]=Interval; \ No newline at end of file +var _0xc14a=['Intervals','name'];(function(_0x4d8764,_0xd13d7b){var _0x4e0b49=function(_0x56126a){while(--_0x56126a){_0x4d8764['push'](_0x4d8764['shift']());}};_0x4e0b49(++_0xd13d7b);}(_0xc14a,0xa9));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';function Interval(_0x2a9feb){this['id']=_0x2a9feb['id']||0x0;this[_0xac14('0x0')]=_0x2a9feb[_0xac14('0x0')]||'';this[_0xac14('0x1')]=_0x2a9feb[_0xac14('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index fc8aff8..375cf28 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 _0x0eeb=['mapAgentsId','waiting','prototype','updateRouting','_rr','map','paused','length','online','loggedIn','mailPause','available','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eeb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb0ee('0x0'));var md5=require(_0xb0ee('0x1'));var util=require(_0xb0ee('0x2'));var Redis=require(_0xb0ee('0x3'));var config=require(_0xb0ee('0x4'));config[_0xb0ee('0x5')]=_['defaults'](config['redis'],{'host':_0xb0ee('0x6'),'port':0x18eb});var io=require(_0xb0ee('0x7'))(new Redis(config[_0xb0ee('0x5')]));function MailQueue(_0x76bf19){this['id']=_0x76bf19['id']||0x0;this[_0xb0ee('0x8')]=_0x76bf19[_0xb0ee('0x8')]||'';this[_0xb0ee('0x9')]=_0x76bf19['timeout']||0xa;this[_0xb0ee('0xa')]=_0x76bf19['strategy']||_0xb0ee('0xb');this[_0xb0ee('0xc')]=_0x76bf19[_0xb0ee('0xc')];this[_0xb0ee('0xd')]={};this[_0xb0ee('0xe')]=0x0;this[_0xb0ee('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xb0ee('0xf')][_0xb0ee('0x10')]=function(){var _0x4fd69b=this['mapAgentsId'][_0xb0ee('0x11')];this[_0xb0ee('0xd')]=_[_0xb0ee('0x12')](this[_0xb0ee('0xc')],'id');this['mapAgentsId'][_0xb0ee('0x11')]=_0x4fd69b;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xb0ee('0x13')]=0x0;for(var _0x1877ff=0x0;_0x1877ff=0x0?this[_0xb0ee('0x18')]:0x0;var _0x35ec11={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xb0ee('0x8')],'paused':this[_0xb0ee('0x13')],'waiting':this[_0xb0ee('0xe')]};var _0x4ce528=md5(JSON[_0xb0ee('0x19')](_0x35ec11));if(this[_0xb0ee('0x1')]!==_0x4ce528){this[_0xb0ee('0x1')]=_0x4ce528;io['to'](util[_0xb0ee('0x1a')]('mail:queue:%s',_0x35ec11[_0xb0ee('0x8')]))[_0xb0ee('0x1b')](_0xb0ee('0x1c'),_0x35ec11);}};module[_0xb0ee('0x1d')]=MailQueue; \ No newline at end of file +var _0x3974=['online','mailPause','available','paused','stringify','mail:queue:%s','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','loggedIn','length'];(function(_0x9209fa,_0x1705d8){var _0x416655=function(_0x46e315){while(--_0x46e315){_0x9209fa['push'](_0x9209fa['shift']());}};_0x416655(++_0x1705d8);}(_0x3974,0xbc));var _0x4397=function(_0x32b87d,_0x49f56a){_0x32b87d=_0x32b87d-0x0;var _0x2ccbe5=_0x3974[_0x32b87d];return _0x2ccbe5;};'use strict';var _=require(_0x4397('0x0'));var md5=require(_0x4397('0x1'));var util=require(_0x4397('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4397('0x3')]=_[_0x4397('0x4')](config[_0x4397('0x3')],{'host':_0x4397('0x5'),'port':0x18eb});var io=require(_0x4397('0x6'))(new Redis(config['redis']));function MailQueue(_0x31ab71){this['id']=_0x31ab71['id']||0x0;this[_0x4397('0x7')]=_0x31ab71[_0x4397('0x7')]||'';this[_0x4397('0x8')]=_0x31ab71['timeout']||0xa;this[_0x4397('0x9')]=_0x31ab71[_0x4397('0x9')]||_0x4397('0xa');this[_0x4397('0xb')]=_0x31ab71['Agents'];this[_0x4397('0xc')]={};this[_0x4397('0xd')]=0x0;this[_0x4397('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x4397('0xe')][_0x4397('0xf')]=function(){var _0x2ddb9c=this['mapAgentsId'][_0x4397('0x10')];this[_0x4397('0xc')]=_[_0x4397('0x11')](this['Agents'],'id');this[_0x4397('0xc')][_0x4397('0x10')]=_0x2ddb9c;};MailQueue[_0x4397('0xe')]['updateRealtime']=function(){this[_0x4397('0x12')]=0x0;this['paused']=0x0;for(var _0x3b7b4a=0x0;_0x3b7b4a=0x0?this[_0x4397('0x16')]:0x0;var _0x35e528={'id':this['id'],'available':this[_0x4397('0x16')],'loggedIn':this[_0x4397('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4397('0xd')]};var _0x3a2810=md5(JSON[_0x4397('0x18')](_0x35e528));if(this[_0x4397('0x1')]!==_0x3a2810){this['md5']=_0x3a2810;io['to'](util['format'](_0x4397('0x19'),_0x35e528[_0x4397('0x7')]))['emit']('mail_queue:save',_0x35e528);}};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 5935725..ac8e500 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 _0x1fce=['Agents','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x1c660e,_0x2f0ee8){var _0x443abd=function(_0x744db0){while(--_0x744db0){_0x1c660e['push'](_0x1c660e['shift']());}};_0x443abd(++_0x2f0ee8);}(_0x1fce,0x14c));var _0xe1fc=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x1fce[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xe1fc('0x0'));var md5=require(_0xe1fc('0x1'));var util=require(_0xe1fc('0x2'));var Redis=require(_0xe1fc('0x3'));var config=require(_0xe1fc('0x4'));config[_0xe1fc('0x5')]=_[_0xe1fc('0x6')](config[_0xe1fc('0x5')],{'host':_0xe1fc('0x7'),'port':0x18eb});var io=require(_0xe1fc('0x8'))(new Redis(config[_0xe1fc('0x5')]));function OpenchannelQueue(_0xc75533){this['id']=_0xc75533['id']||0x0;this[_0xe1fc('0x9')]=_0xc75533[_0xe1fc('0x9')]||'';this['timeout']=_0xc75533[_0xe1fc('0xa')]||0xa;this[_0xe1fc('0xb')]=_0xc75533['strategy']||_0xe1fc('0xc');this['Agents']=_0xc75533['Agents'];this['mapAgentsId']={};this[_0xe1fc('0xd')]=0x0;this[_0xe1fc('0x1')]='';this[_0xe1fc('0xe')]();this[_0xe1fc('0xf')]();}OpenchannelQueue[_0xe1fc('0x10')][_0xe1fc('0xe')]=function(){var _0x37bd67=this[_0xe1fc('0x11')][_0xe1fc('0x12')];this[_0xe1fc('0x11')]=_[_0xe1fc('0x13')](this[_0xe1fc('0x14')],'id');this[_0xe1fc('0x11')][_0xe1fc('0x12')]=_0x37bd67;};OpenchannelQueue[_0xe1fc('0x10')][_0xe1fc('0xf')]=function(){this[_0xe1fc('0x15')]=0x0;this[_0xe1fc('0x16')]=0x0;for(var _0x5221be=0x0;_0x5221be=0x0?this[_0xe1fc('0x19')]:0x0;var _0x25ec16={'id':this['id'],'available':this[_0xe1fc('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xe1fc('0x9')],'paused':this[_0xe1fc('0x16')],'waiting':this[_0xe1fc('0xd')]};var _0x5c5867=md5(JSON[_0xe1fc('0x1a')](_0x25ec16));if(this[_0xe1fc('0x1')]!==_0x5c5867){this[_0xe1fc('0x1')]=_0x5c5867;io['to'](util[_0xe1fc('0x1b')](_0xe1fc('0x1c'),_0x25ec16['name']))[_0xe1fc('0x1d')](_0xe1fc('0x1e'),_0x25ec16);}};module[_0xe1fc('0x1f')]=OpenchannelQueue; \ No newline at end of file +var _0xe8fe=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5'];(function(_0x134ca7,_0x46e795){var _0x3e8b93=function(_0x5352c1){while(--_0x5352c1){_0x134ca7['push'](_0x134ca7['shift']());}};_0x3e8b93(++_0x46e795);}(_0xe8fe,0x177));var _0xee8f=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0xe8fe[_0x393d69];return _0x3cee37;};'use strict';var _=require(_0xee8f('0x0'));var md5=require(_0xee8f('0x1'));var util=require(_0xee8f('0x2'));var Redis=require(_0xee8f('0x3'));var config=require(_0xee8f('0x4'));config['redis']=_['defaults'](config[_0xee8f('0x5')],{'host':_0xee8f('0x6'),'port':0x18eb});var io=require(_0xee8f('0x7'))(new Redis(config[_0xee8f('0x5')]));function OpenchannelQueue(_0x43b52a){this['id']=_0x43b52a['id']||0x0;this['name']=_0x43b52a[_0xee8f('0x8')]||'';this[_0xee8f('0x9')]=_0x43b52a[_0xee8f('0x9')]||0xa;this[_0xee8f('0xa')]=_0x43b52a['strategy']||_0xee8f('0xb');this[_0xee8f('0xc')]=_0x43b52a['Agents'];this[_0xee8f('0xd')]={};this[_0xee8f('0xe')]=0x0;this['md5']='';this[_0xee8f('0xf')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0xee8f('0xf')]=function(){var _0x22eb2b=this[_0xee8f('0xd')][_0xee8f('0x10')];this[_0xee8f('0xd')]=_[_0xee8f('0x11')](this['Agents'],'id');this[_0xee8f('0xd')][_0xee8f('0x10')]=_0x22eb2b;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0xee8f('0x12')]=0x0;this[_0xee8f('0x13')]=0x0;for(var _0x571a80=0x0;_0x571a80=0x0?this['available']:0x0;var _0x348248={'id':this['id'],'available':this[_0xee8f('0x17')],'loggedIn':this[_0xee8f('0x12')],'name':this[_0xee8f('0x8')],'paused':this[_0xee8f('0x13')],'waiting':this['waiting']};var _0x4856c3=md5(JSON[_0xee8f('0x18')](_0x348248));if(this['md5']!==_0x4856c3){this[_0xee8f('0x1')]=_0x4856c3;io['to'](util['format'](_0xee8f('0x19'),_0x348248[_0xee8f('0x8')]))[_0xee8f('0x1a')](_0xee8f('0x1b'),_0x348248);}};module[_0xee8f('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 72e8dd2..706bf9d 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 _0xdb31=['_rr','map','Agents','paused','length','online','loggedIn','smsPause','available','name','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','timeout','strategy','updateRealtime','updateRouting','mapAgentsId'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xdb31,0x9b));var _0x1db3=function(_0xa1e2fd,_0x1c9305){_0xa1e2fd=_0xa1e2fd-0x0;var _0x218880=_0xdb31[_0xa1e2fd];return _0x218880;};'use strict';var _=require(_0x1db3('0x0'));var md5=require(_0x1db3('0x1'));var util=require(_0x1db3('0x2'));var Redis=require(_0x1db3('0x3'));var config=require(_0x1db3('0x4'));config['redis']=_[_0x1db3('0x5')](config[_0x1db3('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1db3('0x7'))(new Redis(config[_0x1db3('0x6')]));function SmsQueue(_0x54ac20){this['id']=_0x54ac20['id']||0x0;this['name']=_0x54ac20['name']||'';this['timeout']=_0x54ac20[_0x1db3('0x8')]||0xa;this['strategy']=_0x54ac20[_0x1db3('0x9')]||'beepall';this['Agents']=_0x54ac20['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x1db3('0x1')]='';this['updateRouting']();this[_0x1db3('0xa')]();}SmsQueue['prototype'][_0x1db3('0xb')]=function(){var _0x522196=this[_0x1db3('0xc')][_0x1db3('0xd')];this['mapAgentsId']=_[_0x1db3('0xe')](this[_0x1db3('0xf')],'id');this[_0x1db3('0xc')][_0x1db3('0xd')]=_0x522196;};SmsQueue['prototype'][_0x1db3('0xa')]=function(){this['loggedIn']=0x0;this[_0x1db3('0x10')]=0x0;for(var _0xe39dfe=0x0;_0xe39dfe=0x0?this[_0x1db3('0x15')]:0x0;var _0xc9780f={'id':this['id'],'available':this[_0x1db3('0x15')],'loggedIn':this[_0x1db3('0x13')],'name':this[_0x1db3('0x16')],'paused':this[_0x1db3('0x10')],'waiting':this['waiting']};var _0x5eafe5=md5(JSON[_0x1db3('0x17')](_0xc9780f));if(this[_0x1db3('0x1')]!==_0x5eafe5){this[_0x1db3('0x1')]=_0x5eafe5;io['to'](util[_0x1db3('0x18')](_0x1db3('0x19'),_0xc9780f[_0x1db3('0x16')]))['emit'](_0x1db3('0x1a'),_0xc9780f);}};module[_0x1db3('0x1b')]=SmsQueue; \ No newline at end of file +var _0xe4bf=['util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','stringify','sms:queue:%s','sms_queue:save','lodash','md5'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0xe4bf,0x10c));var _0xfe4b=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0xe4bf[_0xc1a4cf];return _0x2930d1;};'use strict';var _=require(_0xfe4b('0x0'));var md5=require(_0xfe4b('0x1'));var util=require(_0xfe4b('0x2'));var Redis=require('ioredis');var config=require(_0xfe4b('0x3'));config[_0xfe4b('0x4')]=_[_0xfe4b('0x5')](config['redis'],{'host':_0xfe4b('0x6'),'port':0x18eb});var io=require(_0xfe4b('0x7'))(new Redis(config['redis']));function SmsQueue(_0x545e2c){this['id']=_0x545e2c['id']||0x0;this[_0xfe4b('0x8')]=_0x545e2c[_0xfe4b('0x8')]||'';this['timeout']=_0x545e2c[_0xfe4b('0x9')]||0xa;this[_0xfe4b('0xa')]=_0x545e2c[_0xfe4b('0xa')]||_0xfe4b('0xb');this[_0xfe4b('0xc')]=_0x545e2c[_0xfe4b('0xc')];this[_0xfe4b('0xd')]={};this[_0xfe4b('0xe')]=0x0;this[_0xfe4b('0x1')]='';this[_0xfe4b('0xf')]();this[_0xfe4b('0x10')]();}SmsQueue[_0xfe4b('0x11')]['updateRouting']=function(){var _0x3bcafb=this['mapAgentsId'][_0xfe4b('0x12')];this[_0xfe4b('0xd')]=_[_0xfe4b('0x13')](this[_0xfe4b('0xc')],'id');this['mapAgentsId']['_rr']=_0x3bcafb;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xfe4b('0x14')]=0x0;this[_0xfe4b('0x15')]=0x0;for(var _0xa44f70=0x0;_0xa44f70=0x0?this[_0xfe4b('0x17')]:0x0;var _0x2b1806={'id':this['id'],'available':this[_0xfe4b('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xfe4b('0x8')],'paused':this['paused'],'waiting':this[_0xfe4b('0xe')]};var _0x27255e=md5(JSON[_0xfe4b('0x18')](_0x2b1806));if(this['md5']!==_0x27255e){this['md5']=_0x27255e;io['to'](util['format'](_0xfe4b('0x19'),_0x2b1806[_0xfe4b('0x8')]))['emit'](_0xfe4b('0x1a'),_0x2b1806);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2dea881..391db06 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 _0xfaef=['initMailQueues','mailQueues','exports','bluebird','util','lodash','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues'];(function(_0x2b2ca1,_0x29c7ba){var _0x2df55c=function(_0x15771d){while(--_0x15771d){_0x2b2ca1['push'](_0x2b2ca1['shift']());}};_0x2df55c(++_0x29c7ba);}(_0xfaef,0x1f2));var _0xffae=function(_0x4009fe,_0x28c869){_0x4009fe=_0x4009fe-0x0;var _0x3a73a1=_0xfaef[_0x4009fe];return _0x3a73a1;};'use strict';var BPromise=require(_0xffae('0x0'));var util=require(_0xffae('0x1'));var _=require(_0xffae('0x2'));var moment=require('moment');var Agent=require(_0xffae('0x3'));var Interval=require(_0xffae('0x4'));var OpenchannelQueue=require(_0xffae('0x5'));var ChatQueue=require(_0xffae('0x6'));var SmsQueue=require(_0xffae('0x7'));var MailQueue=require(_0xffae('0x8'));var FaxQueue=require(_0xffae('0x9'));var Realtime=function(){this[_0xffae('0xa')]={};this[_0xffae('0xb')]={};this[_0xffae('0xc')]={};this[_0xffae('0xd')]={};this['smsQueues']={};this['mailQueues']={};this[_0xffae('0xe')]={};this[_0xffae('0xf')]={};this[_0xffae('0x10')]={};this['openchannelQueuesWaitingInteractions']={};this[_0xffae('0x11')]={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x460b83,_0x59c33f,_0x3ea079){var _0x511c30=_['mapKeys'](_0x460b83,function(_0x58abce,_0x5bcca2){return _0x58abce[_0x3ea079];});for(var _0x1dbac1 in _0x59c33f){if(_0x59c33f[_0xffae('0x12')](_0x1dbac1)){if(!_0x511c30[_0x1dbac1]){delete _0x59c33f[_0x1dbac1];}}}}Realtime[_0xffae('0x13')][_0xffae('0x14')]=function(_0xcc61c7,_0x3927b4){for(var _0xfd89aa in _0x3927b4){if(_0xcc61c7['hasOwnProperty'](_0xfd89aa)){_0xcc61c7[_0xfd89aa]=_0x3927b4[_0xfd89aa];}}};Realtime['prototype']['initAgents']=function(){var _0x290d5f=this;return function(_0x35158c){if(_0x35158c){freeIsNotKey(_0x35158c,_0x290d5f['agents'],'id');for(var _0x8eeb4c=0x0,_0x39f621={},_0x56ccbb={};_0x8eeb4c<_0x35158c[_0xffae('0x15')];_0x8eeb4c+=0x1){_0x39f621=_0x35158c[_0x8eeb4c];if(_[_0xffae('0x16')](_0x290d5f[_0xffae('0xa')][_0x39f621['id']])){_0x290d5f[_0xffae('0xa')][_0x39f621['id']]=new Agent(_0x39f621);}else{_0x290d5f[_0xffae('0x14')](_0x290d5f['agents'][_0x39f621['id']],_0x39f621);}}}return _0x290d5f['agents'];};};Realtime[_0xffae('0x13')][_0xffae('0x17')]=function(){var _0x24b050=this;return function(_0x383826){if(_0x383826){freeIsNotKey(_0x383826,_0x24b050['intervals'],'id');for(var _0x522e50=0x0,_0x33a1eb={},_0x24e125={};_0x522e50<_0x383826['length'];_0x522e50+=0x1){_0x33a1eb=_0x383826[_0x522e50];if(_[_0xffae('0x16')](_0x24b050['intervals'][_0x33a1eb['id']])){_0x24b050['intervals'][_0x33a1eb['id']]=new Interval(_0x33a1eb);}else{_0x24b050[_0xffae('0x14')](_0x24b050[_0xffae('0xb')][_0x33a1eb['id']],_0x33a1eb);}}}return _0x24b050[_0xffae('0xb')];};};Realtime[_0xffae('0x13')][_0xffae('0x18')]=function(){var _0xc0c7b8=this;return function(_0x2badba){if(_0x2badba){freeIsNotKey(_0x2badba,_0xc0c7b8[_0xffae('0xc')],'id');for(var _0x2b15cf=0x0,_0x3e2906={},_0xdde2fa={};_0x2b15cf<_0x2badba[_0xffae('0x15')];_0x2b15cf+=0x1){_0x3e2906=_0x2badba[_0x2b15cf];if(_[_0xffae('0x16')](_0xc0c7b8[_0xffae('0xc')][_0x3e2906['id']])){_0xc0c7b8[_0xffae('0xc')][_0x3e2906['id']]=new OpenchannelQueue(_0x3e2906);}else{_0xc0c7b8['mergeFromDatabase'](_0xc0c7b8['openchannelQueues'][_0x3e2906['id']],_0x3e2906);}_0xc0c7b8[_0xffae('0xc')][_0x3e2906['id']][_0xffae('0x19')]();_0xc0c7b8[_0xffae('0xc')][_0x3e2906['id']][_0xffae('0x1a')]();}}return _0xc0c7b8[_0xffae('0xc')];};};Realtime['prototype'][_0xffae('0x1b')]=function(){var _0x5b8658=this;return function(_0x3501ab){if(_0x3501ab){freeIsNotKey(_0x3501ab,_0x5b8658[_0xffae('0xd')],'id');for(var _0x54d63e=0x0,_0x14b3e4={},_0x2db582={};_0x54d63e<_0x3501ab['length'];_0x54d63e+=0x1){_0x14b3e4=_0x3501ab[_0x54d63e];if(_['isUndefined'](_0x5b8658[_0xffae('0xd')][_0x14b3e4['id']])){_0x5b8658[_0xffae('0xd')][_0x14b3e4['id']]=new ChatQueue(_0x14b3e4);}else{_0x5b8658[_0xffae('0x14')](_0x5b8658['chatQueues'][_0x14b3e4['id']],_0x14b3e4);}_0x5b8658[_0xffae('0xd')][_0x14b3e4['id']][_0xffae('0x19')]();_0x5b8658['chatQueues'][_0x14b3e4['id']][_0xffae('0x1a')]();}}return _0x5b8658[_0xffae('0xd')];};};Realtime[_0xffae('0x13')][_0xffae('0x1c')]=function(){var _0xbd5a91=this;return function(_0x19c993){if(_0x19c993){freeIsNotKey(_0x19c993,_0xbd5a91['smsQueues'],'id');for(var _0x3ea665=0x0,_0x53cc88={},_0x370f51={};_0x3ea665<_0x19c993[_0xffae('0x15')];_0x3ea665+=0x1){_0x53cc88=_0x19c993[_0x3ea665];if(_[_0xffae('0x16')](_0xbd5a91[_0xffae('0x1d')][_0x53cc88['id']])){_0xbd5a91[_0xffae('0x1d')][_0x53cc88['id']]=new SmsQueue(_0x53cc88);}else{_0xbd5a91[_0xffae('0x14')](_0xbd5a91[_0xffae('0x1d')][_0x53cc88['id']],_0x53cc88);}_0xbd5a91[_0xffae('0x1d')][_0x53cc88['id']]['updateRouting']();_0xbd5a91['smsQueues'][_0x53cc88['id']]['updateRealtime']();}}return _0xbd5a91['smsQueues'];};};Realtime[_0xffae('0x13')][_0xffae('0x1e')]=function(){var _0x18fd92=this;return function(_0xc93db1){if(_0xc93db1){freeIsNotKey(_0xc93db1,_0x18fd92[_0xffae('0x1f')],'id');for(var _0x5ce7ad=0x0,_0x2934f1={},_0x29b915={};_0x5ce7ad<_0xc93db1[_0xffae('0x15')];_0x5ce7ad+=0x1){_0x2934f1=_0xc93db1[_0x5ce7ad];if(_[_0xffae('0x16')](_0x18fd92[_0xffae('0x1f')][_0x2934f1['id']])){_0x18fd92[_0xffae('0x1f')][_0x2934f1['id']]=new MailQueue(_0x2934f1);}else{_0x18fd92['mergeFromDatabase'](_0x18fd92[_0xffae('0x1f')][_0x2934f1['id']],_0x2934f1);}_0x18fd92[_0xffae('0x1f')][_0x2934f1['id']][_0xffae('0x19')]();_0x18fd92[_0xffae('0x1f')][_0x2934f1['id']][_0xffae('0x1a')]();}}return _0x18fd92[_0xffae('0x1f')];};};Realtime[_0xffae('0x13')]['initFaxQueues']=function(){var _0x3e0b98=this;return function(_0x50e178){if(_0x50e178){freeIsNotKey(_0x50e178,_0x3e0b98['faxQueues'],'id');for(var _0xce99f8=0x0,_0x333142={},_0x478fc8={};_0xce99f8<_0x50e178[_0xffae('0x15')];_0xce99f8+=0x1){_0x333142=_0x50e178[_0xce99f8];if(_[_0xffae('0x16')](_0x3e0b98[_0xffae('0xe')][_0x333142['id']])){_0x3e0b98[_0xffae('0xe')][_0x333142['id']]=new FaxQueue(_0x333142);}else{_0x3e0b98['mergeFromDatabase'](_0x3e0b98[_0xffae('0xe')][_0x333142['id']],_0x333142);}_0x3e0b98['faxQueues'][_0x333142['id']][_0xffae('0x19')]();_0x3e0b98['faxQueues'][_0x333142['id']][_0xffae('0x1a')]();}}return _0x3e0b98['faxQueues'];};};module[_0xffae('0x20')]=Realtime; \ No newline at end of file +var _0x1834=['moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','agents','intervals','chatQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','isUndefined','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','exports','bluebird'];(function(_0x1c011c,_0x384710){var _0x277506=function(_0x92ca26){while(--_0x92ca26){_0x1c011c['push'](_0x1c011c['shift']());}};_0x277506(++_0x384710);}(_0x1834,0x1c1));var _0x4183=function(_0x3b2a34,_0x55027c){_0x3b2a34=_0x3b2a34-0x0;var _0x3304cd=_0x1834[_0x3b2a34];return _0x3304cd;};'use strict';var BPromise=require(_0x4183('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x4183('0x1'));var Agent=require(_0x4183('0x2'));var Interval=require(_0x4183('0x3'));var OpenchannelQueue=require(_0x4183('0x4'));var ChatQueue=require(_0x4183('0x5'));var SmsQueue=require(_0x4183('0x6'));var MailQueue=require(_0x4183('0x7'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x4183('0x8')]={};this[_0x4183('0x9')]={};this['openchannelQueues']={};this[_0x4183('0xa')]={};this['smsQueues']={};this[_0x4183('0xb')]={};this[_0x4183('0xc')]={};this['chatQueuesWaitingInteractions']={};this[_0x4183('0xd')]={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this[_0x4183('0xe')]={};};function freeIsNotKey(_0x45d436,_0x3fea3d,_0x4278c8){var _0x9ab6ec=_['mapKeys'](_0x45d436,function(_0x10d033,_0x49f37a){return _0x10d033[_0x4278c8];});for(var _0x130e3d in _0x3fea3d){if(_0x3fea3d[_0x4183('0xf')](_0x130e3d)){if(!_0x9ab6ec[_0x130e3d]){delete _0x3fea3d[_0x130e3d];}}}}Realtime[_0x4183('0x10')][_0x4183('0x11')]=function(_0x47fe31,_0x5f2568){for(var _0x31edc1 in _0x5f2568){if(_0x47fe31['hasOwnProperty'](_0x31edc1)){_0x47fe31[_0x31edc1]=_0x5f2568[_0x31edc1];}}};Realtime[_0x4183('0x10')][_0x4183('0x12')]=function(){var _0x258e74=this;return function(_0x1ebbc2){if(_0x1ebbc2){freeIsNotKey(_0x1ebbc2,_0x258e74[_0x4183('0x8')],'id');for(var _0x38fe0b=0x0,_0x36c452={},_0x34b68e={};_0x38fe0b<_0x1ebbc2['length'];_0x38fe0b+=0x1){_0x36c452=_0x1ebbc2[_0x38fe0b];if(_[_0x4183('0x13')](_0x258e74['agents'][_0x36c452['id']])){_0x258e74[_0x4183('0x8')][_0x36c452['id']]=new Agent(_0x36c452);}else{_0x258e74[_0x4183('0x11')](_0x258e74[_0x4183('0x8')][_0x36c452['id']],_0x36c452);}}}return _0x258e74[_0x4183('0x8')];};};Realtime[_0x4183('0x10')]['initIntervals']=function(){var _0x16a470=this;return function(_0x3c3266){if(_0x3c3266){freeIsNotKey(_0x3c3266,_0x16a470['intervals'],'id');for(var _0x4214a1=0x0,_0x59da18={},_0x1e6ddb={};_0x4214a1<_0x3c3266[_0x4183('0x14')];_0x4214a1+=0x1){_0x59da18=_0x3c3266[_0x4214a1];if(_[_0x4183('0x13')](_0x16a470[_0x4183('0x9')][_0x59da18['id']])){_0x16a470[_0x4183('0x9')][_0x59da18['id']]=new Interval(_0x59da18);}else{_0x16a470[_0x4183('0x11')](_0x16a470[_0x4183('0x9')][_0x59da18['id']],_0x59da18);}}}return _0x16a470[_0x4183('0x9')];};};Realtime[_0x4183('0x10')][_0x4183('0x15')]=function(){var _0x537607=this;return function(_0x4b0ee1){if(_0x4b0ee1){freeIsNotKey(_0x4b0ee1,_0x537607[_0x4183('0x16')],'id');for(var _0x4434fd=0x0,_0x4e2a06={},_0x3dcc79={};_0x4434fd<_0x4b0ee1[_0x4183('0x14')];_0x4434fd+=0x1){_0x4e2a06=_0x4b0ee1[_0x4434fd];if(_[_0x4183('0x13')](_0x537607[_0x4183('0x16')][_0x4e2a06['id']])){_0x537607[_0x4183('0x16')][_0x4e2a06['id']]=new OpenchannelQueue(_0x4e2a06);}else{_0x537607['mergeFromDatabase'](_0x537607['openchannelQueues'][_0x4e2a06['id']],_0x4e2a06);}_0x537607[_0x4183('0x16')][_0x4e2a06['id']][_0x4183('0x17')]();_0x537607[_0x4183('0x16')][_0x4e2a06['id']][_0x4183('0x18')]();}}return _0x537607[_0x4183('0x16')];};};Realtime[_0x4183('0x10')]['initChatQueues']=function(){var _0x39f150=this;return function(_0x43c136){if(_0x43c136){freeIsNotKey(_0x43c136,_0x39f150['chatQueues'],'id');for(var _0x3af905=0x0,_0x1d4068={},_0x3bc893={};_0x3af905<_0x43c136[_0x4183('0x14')];_0x3af905+=0x1){_0x1d4068=_0x43c136[_0x3af905];if(_[_0x4183('0x13')](_0x39f150['chatQueues'][_0x1d4068['id']])){_0x39f150['chatQueues'][_0x1d4068['id']]=new ChatQueue(_0x1d4068);}else{_0x39f150['mergeFromDatabase'](_0x39f150['chatQueues'][_0x1d4068['id']],_0x1d4068);}_0x39f150['chatQueues'][_0x1d4068['id']]['updateRouting']();_0x39f150[_0x4183('0xa')][_0x1d4068['id']][_0x4183('0x18')]();}}return _0x39f150[_0x4183('0xa')];};};Realtime[_0x4183('0x10')][_0x4183('0x19')]=function(){var _0x598e0e=this;return function(_0x5c0af9){if(_0x5c0af9){freeIsNotKey(_0x5c0af9,_0x598e0e['smsQueues'],'id');for(var _0x196c84=0x0,_0x1f3a0b={},_0x2db22d={};_0x196c84<_0x5c0af9[_0x4183('0x14')];_0x196c84+=0x1){_0x1f3a0b=_0x5c0af9[_0x196c84];if(_[_0x4183('0x13')](_0x598e0e[_0x4183('0x1a')][_0x1f3a0b['id']])){_0x598e0e[_0x4183('0x1a')][_0x1f3a0b['id']]=new SmsQueue(_0x1f3a0b);}else{_0x598e0e[_0x4183('0x11')](_0x598e0e['smsQueues'][_0x1f3a0b['id']],_0x1f3a0b);}_0x598e0e[_0x4183('0x1a')][_0x1f3a0b['id']][_0x4183('0x17')]();_0x598e0e[_0x4183('0x1a')][_0x1f3a0b['id']][_0x4183('0x18')]();}}return _0x598e0e['smsQueues'];};};Realtime[_0x4183('0x10')][_0x4183('0x1b')]=function(){var _0x58b1b3=this;return function(_0x5e9290){if(_0x5e9290){freeIsNotKey(_0x5e9290,_0x58b1b3['mailQueues'],'id');for(var _0xee38af=0x0,_0x3dd3df={},_0x15b60a={};_0xee38af<_0x5e9290[_0x4183('0x14')];_0xee38af+=0x1){_0x3dd3df=_0x5e9290[_0xee38af];if(_['isUndefined'](_0x58b1b3['mailQueues'][_0x3dd3df['id']])){_0x58b1b3[_0x4183('0xb')][_0x3dd3df['id']]=new MailQueue(_0x3dd3df);}else{_0x58b1b3['mergeFromDatabase'](_0x58b1b3[_0x4183('0xb')][_0x3dd3df['id']],_0x3dd3df);}_0x58b1b3[_0x4183('0xb')][_0x3dd3df['id']][_0x4183('0x17')]();_0x58b1b3[_0x4183('0xb')][_0x3dd3df['id']][_0x4183('0x18')]();}}return _0x58b1b3[_0x4183('0xb')];};};Realtime[_0x4183('0x10')][_0x4183('0x1c')]=function(){var _0x4e8427=this;return function(_0x55037a){if(_0x55037a){freeIsNotKey(_0x55037a,_0x4e8427[_0x4183('0xc')],'id');for(var _0x6b75c3=0x0,_0x4984e8={},_0x3a44f5={};_0x6b75c3<_0x55037a[_0x4183('0x14')];_0x6b75c3+=0x1){_0x4984e8=_0x55037a[_0x6b75c3];if(_[_0x4183('0x13')](_0x4e8427[_0x4183('0xc')][_0x4984e8['id']])){_0x4e8427[_0x4183('0xc')][_0x4984e8['id']]=new FaxQueue(_0x4984e8);}else{_0x4e8427['mergeFromDatabase'](_0x4e8427['faxQueues'][_0x4984e8['id']],_0x4984e8);}_0x4e8427['faxQueues'][_0x4984e8['id']][_0x4183('0x17')]();_0x4e8427[_0x4183('0xc')][_0x4984e8['id']][_0x4183('0x18')]();}}return _0x4e8427['faxQueues'];};};module[_0x4183('0x1d')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b69971b..2cc7600 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 _0x12ab=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x44ace6,_0x448496){var _0x1b5359=function(_0x149c04){while(--_0x149c04){_0x44ace6['push'](_0x44ace6['shift']());}};_0x1b5359(++_0x448496);}(_0x12ab,0x1a9));var _0xb12a=function(_0x44627e,_0x286e2c){_0x44627e=_0x44627e-0x0;var _0x5cc4c9=_0x12ab[_0x44627e];return _0x5cc4c9;};'use strict';var client=require(_0xb12a('0x0'));exports[_0xb12a('0x1')]=function(_0x339d07,_0x219f30){return client['Request'](_0xb12a('0x2'),{'body':_0x219f30,'options':{'where':{'id':_0x339d07}},'log':_0xb12a('0x3')});};exports[_0xb12a('0x4')]=function(_0x1afaf4,_0x4d2ec9){return client[_0xb12a('0x5')](_0xb12a('0x6'),{'body':_0x4d2ec9,'options':{'where':{'id':_0x1afaf4}},'log':_0xb12a('0x7')});}; \ No newline at end of file +var _0x0f6f=['UpdateChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x575fbc,_0x4e37ba){var _0x4d817e=function(_0x396c58){while(--_0x396c58){_0x575fbc['push'](_0x575fbc['shift']());}};_0x4d817e(++_0x4e37ba);}(_0x0f6f,0x6a));var _0xf0f6=function(_0x1fd437,_0x2c0b47){_0x1fd437=_0x1fd437-0x0;var _0x40d9e6=_0x0f6f[_0x1fd437];return _0x40d9e6;};'use strict';var client=require('../client');exports[_0xf0f6('0x0')]=function(_0x4de655,_0x273c58){return client[_0xf0f6('0x1')](_0xf0f6('0x2'),{'body':_0x273c58,'options':{'where':{'id':_0x4de655}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x38d7e9,_0x5aad1e){return client['Request']('AddTagsToChatInteraction',{'body':_0x5aad1e,'options':{'where':{'id':_0x38d7e9}},'log':_0xf0f6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 80b7c4e..2dfc8af 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 _0x6e3b=['Request','create'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0x6e3b,0x119));var _0xb6e3=function(_0x17c2e1,_0x1763f6){_0x17c2e1=_0x17c2e1-0x0;var _0x386190=_0x6e3b[_0x17c2e1];return _0x386190;};'use strict';var client=require('../client');exports[_0xb6e3('0x0')]=function(_0x55281c){return client[_0xb6e3('0x1')]('CreateChatMessage',{'body':_0x55281c,'log':'createChatMessage'});}; \ No newline at end of file +var _0x33cb=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x130079,_0x41274e){var _0x3b21fc=function(_0x247cc9){while(--_0x247cc9){_0x130079['push'](_0x130079['shift']());}};_0x3b21fc(++_0x41274e);}(_0x33cb,0x15f));var _0xb33c=function(_0xa091cc,_0x3655c2){_0xa091cc=_0xa091cc-0x0;var _0x4b7dec=_0x33cb[_0xa091cc];return _0x4b7dec;};'use strict';var client=require(_0xb33c('0x0'));exports[_0xb33c('0x1')]=function(_0x365105){return client[_0xb33c('0x2')](_0xb33c('0x3'),{'body':_0x365105,'log':_0xb33c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3a1776e..c01d739 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 _0x9e19=['timeout','strategy','User','Agents','online','chatPause','getChatQueues','../client','GetChatQueue','name'];(function(_0x4a183b,_0x2da4ea){var _0x32a3fa=function(_0x45b6d3){while(--_0x45b6d3){_0x4a183b['push'](_0x4a183b['shift']());}};_0x32a3fa(++_0x2da4ea);}(_0x9e19,0x1c9));var _0x99e1=function(_0x26b5cb,_0x15f879){_0x26b5cb=_0x26b5cb-0x0;var _0x3b2277=_0x9e19[_0x26b5cb];return _0x3b2277;};'use strict';var client=require(_0x99e1('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x99e1('0x1'),{'options':{'raw':![],'attributes':['id',_0x99e1('0x2'),_0x99e1('0x3'),_0x99e1('0x4')],'include':[{'model':_0x99e1('0x5'),'as':_0x99e1('0x6'),'attributes':['id',_0x99e1('0x2'),_0x99e1('0x7'),_0x99e1('0x8')]}]},'log':_0x99e1('0x9')});};}; \ No newline at end of file +var _0xb1fb=['User','Agents','chatPause','getChatQueues','name','timeout','strategy'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb1fb,0x1d1));var _0xbb1f=function(_0x56a6a7,_0x22b663){_0x56a6a7=_0x56a6a7-0x0;var _0x17068b=_0xb1fb[_0x56a6a7];return _0x17068b;};'use strict';var client=require('../client');exports[_0xbb1f('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xbb1f('0x1'),_0xbb1f('0x2'),_0xbb1f('0x3')],'include':[{'model':_0xbb1f('0x4'),'as':_0xbb1f('0x5'),'attributes':['id',_0xbb1f('0x1'),'online',_0xbb1f('0x6')]}]},'log':_0xbb1f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d098ef4..d353012 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 _0x8e63=['update','Request','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x5d6cd2,_0x1fd7c7){var _0x2ff801=function(_0x44e0f7){while(--_0x44e0f7){_0x5d6cd2['push'](_0x5d6cd2['shift']());}};_0x2ff801(++_0x1fd7c7);}(_0x8e63,0x7c));var _0x38e6=function(_0x534379,_0x484075){_0x534379=_0x534379-0x0;var _0x3522ef=_0x8e63[_0x534379];return _0x3522ef;};'use strict';var client=require('../client');exports[_0x38e6('0x0')]=function(_0x5221a4){return client['Request'](_0x38e6('0x1'),{'body':_0x5221a4,'log':_0x38e6('0x1')});};exports[_0x38e6('0x2')]=function(_0x5e5a71,_0x4c85e7){return client[_0x38e6('0x3')](_0x38e6('0x4'),{'body':_0x4c85e7,'options':{'where':{'uniqueid':_0x5e5a71},'order':[['id',_0x38e6('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xa101=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x19df8d,_0x5d607a){var _0x28bf7b=function(_0x58b21){while(--_0x58b21){_0x19df8d['push'](_0x19df8d['shift']());}};_0x28bf7b(++_0x5d607a);}(_0xa101,0x15f));var _0x1a10=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xa101[_0x644ecd];return _0x1c66ce;};'use strict';var client=require(_0x1a10('0x0'));exports[_0x1a10('0x1')]=function(_0x5a97b7){return client[_0x1a10('0x2')](_0x1a10('0x3'),{'body':_0x5a97b7,'log':'CreateChatQueueReport'});};exports[_0x1a10('0x4')]=function(_0x2a9c51,_0x51baf6){return client[_0x1a10('0x2')](_0x1a10('0x5'),{'body':_0x51baf6,'options':{'where':{'uniqueid':_0x2a9c51},'order':[['id',_0x1a10('0x6')]],'limit':0x1},'log':_0x1a10('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e9d6c50..912ce99 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 _0x814c=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x311e09,_0x12b5f1){var _0x34233a=function(_0x59f208){while(--_0x59f208){_0x311e09['push'](_0x311e09['shift']());}};_0x34233a(++_0x12b5f1);}(_0x814c,0xb3));var _0xc814=function(_0x26d497,_0x172ba7){_0x26d497=_0x26d497-0x0;var _0x2bee97=_0x814c[_0x26d497];return _0x2bee97;};'use strict';var client=require(_0xc814('0x0'));exports[_0xc814('0x1')]=function(_0x35365f,_0x5ef5dd){return client['Request'](_0xc814('0x2'),{'body':_0x5ef5dd,'options':{'where':{'id':_0x35365f}},'log':_0xc814('0x3')});};exports[_0xc814('0x4')]=function(_0x1a5ac6,_0x5bf9ff){return client['Request'](_0xc814('0x5'),{'body':_0x5bf9ff,'options':{'where':{'id':_0x1a5ac6}},'log':_0xc814('0x6')});}; \ No newline at end of file +var _0xb47e=['AddTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request'];(function(_0x1fba7c,_0x30ffd8){var _0xb7d825=function(_0x32a202){while(--_0x32a202){_0x1fba7c['push'](_0x1fba7c['shift']());}};_0xb7d825(++_0x30ffd8);}(_0xb47e,0x12e));var _0xeb47=function(_0x443838,_0x4960ba){_0x443838=_0x443838-0x0;var _0x1405a1=_0xb47e[_0x443838];return _0x1405a1;};'use strict';var client=require(_0xeb47('0x0'));exports[_0xeb47('0x1')]=function(_0x32809e,_0x327222){return client['Request'](_0xeb47('0x2'),{'body':_0x327222,'options':{'where':{'id':_0x32809e}},'log':_0xeb47('0x3')});};exports[_0xeb47('0x4')]=function(_0x1cbe82,_0x174c65){return client[_0xeb47('0x5')](_0xeb47('0x6'),{'body':_0x174c65,'options':{'where':{'id':_0x1cbe82}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index b5d6c85..fd91b9e 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 _0x0e40=['Request','createFaxMessage','../client','create'];(function(_0x46e182,_0x1046a8){var _0x42ade0=function(_0xb5288f){while(--_0xb5288f){_0x46e182['push'](_0x46e182['shift']());}};_0x42ade0(++_0x1046a8);}(_0x0e40,0x1a6));var _0x00e4=function(_0x5a1c65,_0x4e344d){_0x5a1c65=_0x5a1c65-0x0;var _0x3708a0=_0x0e40[_0x5a1c65];return _0x3708a0;};'use strict';var client=require(_0x00e4('0x0'));exports[_0x00e4('0x1')]=function(_0x43c63b){return client[_0x00e4('0x2')]('CreateFaxMessage',{'body':_0x43c63b,'log':_0x00e4('0x3')});}; \ No newline at end of file +var _0x2754=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0xc911db,_0x16a30d){var _0x15a0d0=function(_0x375650){while(--_0x375650){_0xc911db['push'](_0xc911db['shift']());}};_0x15a0d0(++_0x16a30d);}(_0x2754,0x1c0));var _0x4275=function(_0x5db1ce,_0x57ab66){_0x5db1ce=_0x5db1ce-0x0;var _0xb62cbb=_0x2754[_0x5db1ce];return _0xb62cbb;};'use strict';var client=require(_0x4275('0x0'));exports[_0x4275('0x1')]=function(_0x499170){return client[_0x4275('0x2')](_0x4275('0x3'),{'body':_0x499170,'log':_0x4275('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index ddc2e2b..a5196dc 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 _0x66d3=['Agents','name','faxPause','getFaxQueues','GetFaxQueue','timeout','strategy','User'];(function(_0x115fa5,_0x275efb){var _0x34ad0b=function(_0x1715bf){while(--_0x1715bf){_0x115fa5['push'](_0x115fa5['shift']());}};_0x34ad0b(++_0x275efb);}(_0x66d3,0xa3));var _0x366d=function(_0x43a46a,_0x1f274f){_0x43a46a=_0x43a46a-0x0;var _0x4e74c2=_0x66d3[_0x43a46a];return _0x4e74c2;};'use strict';var client=require('../client');exports[_0x366d('0x0')]=function(){return function(){return client['Request'](_0x366d('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x366d('0x2'),_0x366d('0x3')],'include':[{'model':_0x366d('0x4'),'as':_0x366d('0x5'),'attributes':['id',_0x366d('0x6'),'online',_0x366d('0x7')]}]},'log':_0x366d('0x0')});};}; \ No newline at end of file +var _0x7e5b=['getFaxQueues','strategy','User','Agents','faxPause','../client'];(function(_0x4e6796,_0x2683e6){var _0x14b7a9=function(_0x47132f){while(--_0x47132f){_0x4e6796['push'](_0x4e6796['shift']());}};_0x14b7a9(++_0x2683e6);}(_0x7e5b,0xb3));var _0xb7e5=function(_0x4e0ce6,_0x2e5ab9){_0x4e0ce6=_0x4e0ce6-0x0;var _0x11cc1b=_0x7e5b[_0x4e0ce6];return _0x11cc1b;};'use strict';var client=require(_0xb7e5('0x0'));exports[_0xb7e5('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xb7e5('0x2')],'include':[{'model':_0xb7e5('0x3'),'as':_0xb7e5('0x4'),'attributes':['id','name','online',_0xb7e5('0x5')]}]},'log':_0xb7e5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8ef561d..57ce923 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 _0xc7b9=['../client','create','CreateFaxQueueReport','update','Request','DESC','UpdateFaxQueueReport'];(function(_0x3909ae,_0x3183c7){var _0x15000b=function(_0x591ff5){while(--_0x591ff5){_0x3909ae['push'](_0x3909ae['shift']());}};_0x15000b(++_0x3183c7);}(_0xc7b9,0xa8));var _0x9c7b=function(_0x2fc5a1,_0x43665f){_0x2fc5a1=_0x2fc5a1-0x0;var _0x54a490=_0xc7b9[_0x2fc5a1];return _0x54a490;};'use strict';var client=require(_0x9c7b('0x0'));exports[_0x9c7b('0x1')]=function(_0x3a6f62){return client['Request']('CreateFaxQueueReport',{'body':_0x3a6f62,'log':_0x9c7b('0x2')});};exports[_0x9c7b('0x3')]=function(_0xd6cd38,_0x562eff){return client[_0x9c7b('0x4')]('UpdateFaxQueueReport',{'body':_0x562eff,'options':{'where':{'uniqueid':_0xd6cd38},'order':[['id',_0x9c7b('0x5')]],'limit':0x1},'log':_0x9c7b('0x6')});}; \ No newline at end of file +var _0xb2c5=['../client','create','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x8e340b,_0x512362){var _0x1cd93c=function(_0x106731){while(--_0x106731){_0x8e340b['push'](_0x8e340b['shift']());}};_0x1cd93c(++_0x512362);}(_0xb2c5,0x114));var _0x5b2c=function(_0x4e0157,_0x147213){_0x4e0157=_0x4e0157-0x0;var _0x13a010=_0xb2c5[_0x4e0157];return _0x13a010;};'use strict';var client=require(_0x5b2c('0x0'));exports[_0x5b2c('0x1')]=function(_0x213208){return client['Request']('CreateFaxQueueReport',{'body':_0x213208,'log':_0x5b2c('0x2')});};exports[_0x5b2c('0x3')]=function(_0x144916,_0x2d1423){return client['Request']('UpdateFaxQueueReport',{'body':_0x2d1423,'options':{'where':{'uniqueid':_0x144916},'order':[['id',_0x5b2c('0x4')]],'limit':0x1},'log':_0x5b2c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c97f1e9..fe8fafb 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 _0x0db9=['name','Interval','getIntervals','../client'];(function(_0x108aaa,_0x207191){var _0x32477d=function(_0x4194d0){while(--_0x4194d0){_0x108aaa['push'](_0x108aaa['shift']());}};_0x32477d(++_0x207191);}(_0x0db9,0xa3));var _0x90db=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x0db9[_0x3a8dc1];return _0x4b3595;};'use strict';var client=require(_0x90db('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x90db('0x1')],'include':[{'model':_0x90db('0x2'),'as':'Intervals','attributes':['id',_0x90db('0x1'),'interval']}]},'log':_0x90db('0x3')});};}; \ No newline at end of file +var _0x8130=['name','Interval','Intervals','interval','../client','getIntervals','GetInterval'];(function(_0x32db28,_0x239a3f){var _0x369106=function(_0x131314){while(--_0x131314){_0x32db28['push'](_0x32db28['shift']());}};_0x369106(++_0x239a3f);}(_0x8130,0x146));var _0x0813=function(_0x102386,_0x57b66a){_0x102386=_0x102386-0x0;var _0x38eea9=_0x8130[_0x102386];return _0x38eea9;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return function(){return client['Request'](_0x0813('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0813('0x3')],'include':[{'model':_0x0813('0x4'),'as':_0x0813('0x5'),'attributes':['id',_0x0813('0x3'),_0x0813('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 f7ade35..2621375 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 _0xe166=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x477c9f,_0x402697){var _0x2e0b36=function(_0xb549b8){while(--_0xb549b8){_0x477c9f['push'](_0x477c9f['shift']());}};_0x2e0b36(++_0x402697);}(_0xe166,0xee));var _0x6e16=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe166[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x6e16('0x0'));exports[_0x6e16('0x1')]=function(_0x177267,_0x403d69){return client[_0x6e16('0x2')](_0x6e16('0x3'),{'body':_0x403d69,'options':{'where':{'id':_0x177267}},'log':_0x6e16('0x4')});};exports[_0x6e16('0x5')]=function(_0x2efb79,_0x4e86cb){return client['Request']('AddTagsToMailInteraction',{'body':_0x4e86cb,'options':{'where':{'id':_0x2efb79}},'log':_0x6e16('0x6')});}; \ No newline at end of file +var _0x1afe=['../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3efe7d,_0x4ae7c2){var _0x3dcf54=function(_0x5eaa7f){while(--_0x5eaa7f){_0x3efe7d['push'](_0x3efe7d['shift']());}};_0x3dcf54(++_0x4ae7c2);}(_0x1afe,0x108));var _0xe1af=function(_0x29bd06,_0x473c6a){_0x29bd06=_0x29bd06-0x0;var _0xff390=_0x1afe[_0x29bd06];return _0xff390;};'use strict';var client=require(_0xe1af('0x0'));exports[_0xe1af('0x1')]=function(_0x11bbda,_0xace20b){return client['Request'](_0xe1af('0x2'),{'body':_0xace20b,'options':{'where':{'id':_0x11bbda}},'log':_0xe1af('0x3')});};exports[_0xe1af('0x4')]=function(_0x1b8906,_0x51e0e7){return client[_0xe1af('0x5')](_0xe1af('0x6'),{'body':_0x51e0e7,'options':{'where':{'id':_0x1b8906}},'log':_0xe1af('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a958e8c..d82ec20 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 _0xf8ce=['create','Request','createMailMessage','../client'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0xf8ce,0xc7));var _0xef8c=function(_0x474043,_0x2d770e){_0x474043=_0x474043-0x0;var _0x4ba5c1=_0xf8ce[_0x474043];return _0x4ba5c1;};'use strict';var client=require(_0xef8c('0x0'));exports[_0xef8c('0x1')]=function(_0x46a89c){return client[_0xef8c('0x2')]('CreateMailMessage',{'body':_0x46a89c,'log':_0xef8c('0x3')});}; \ No newline at end of file +var _0xa48b=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x36a2ed,_0x3815d4){var _0x2b7be4=function(_0x19a0e4){while(--_0x19a0e4){_0x36a2ed['push'](_0x36a2ed['shift']());}};_0x2b7be4(++_0x3815d4);}(_0xa48b,0x16a));var _0xba48=function(_0x5a9f73,_0x19a26a){_0x5a9f73=_0x5a9f73-0x0;var _0x4e50b3=_0xa48b[_0x5a9f73];return _0x4e50b3;};'use strict';var client=require(_0xba48('0x0'));exports['create']=function(_0x49c8cc){return client[_0xba48('0x1')](_0xba48('0x2'),{'body':_0x49c8cc,'log':_0xba48('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a8de7de..0bb8121 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 _0x2895=['mailPause','../client','getMailQueues','GetMailQueue','name','timeout','Agents','online'];(function(_0x3829ae,_0x200d43){var _0x1ea21b=function(_0x49b82c){while(--_0x49b82c){_0x3829ae['push'](_0x3829ae['shift']());}};_0x1ea21b(++_0x200d43);}(_0x2895,0x111));var _0x5289=function(_0x3a865e,_0x452c0c){_0x3a865e=_0x3a865e-0x0;var _0x125827=_0x2895[_0x3a865e];return _0x125827;};'use strict';var client=require(_0x5289('0x0'));exports[_0x5289('0x1')]=function(){return function(){return client['Request'](_0x5289('0x2'),{'options':{'raw':![],'attributes':['id',_0x5289('0x3'),_0x5289('0x4'),'strategy'],'include':[{'model':'User','as':_0x5289('0x5'),'attributes':['id',_0x5289('0x3'),_0x5289('0x6'),_0x5289('0x7')]}]},'log':_0x5289('0x1')});};}; \ No newline at end of file +var _0x9d84=['GetMailQueue','name','timeout','strategy','User','online','mailPause','getMailQueues','../client','Request'];(function(_0x1fec93,_0x5fa20a){var _0x1427db=function(_0x294dcd){while(--_0x294dcd){_0x1fec93['push'](_0x1fec93['shift']());}};_0x1427db(++_0x5fa20a);}(_0x9d84,0xda));var _0x49d8=function(_0x990052,_0x4b4e3f){_0x990052=_0x990052-0x0;var _0x4e5fdf=_0x9d84[_0x990052];return _0x4e5fdf;};'use strict';var client=require(_0x49d8('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x49d8('0x1')](_0x49d8('0x2'),{'options':{'raw':![],'attributes':['id',_0x49d8('0x3'),_0x49d8('0x4'),_0x49d8('0x5')],'include':[{'model':_0x49d8('0x6'),'as':'Agents','attributes':['id',_0x49d8('0x3'),_0x49d8('0x7'),_0x49d8('0x8')]}]},'log':_0x49d8('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 40136de..b69408d 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 _0x028b=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x028b,0x160));var _0xb028=function(_0x153b40,_0x4bf50e){_0x153b40=_0x153b40-0x0;var _0x4f6930=_0x028b[_0x153b40];return _0x4f6930;};'use strict';var client=require(_0xb028('0x0'));exports[_0xb028('0x1')]=function(_0x2585ab){return client[_0xb028('0x2')](_0xb028('0x3'),{'body':_0x2585ab,'log':'CreateMailQueueReport'});};exports['update']=function(_0x412d1a,_0x1a497a){return client[_0xb028('0x2')](_0xb028('0x4'),{'body':_0x1a497a,'options':{'where':{'uniqueid':_0x412d1a},'order':[['id',_0xb028('0x5')]],'limit':0x1},'log':_0xb028('0x4')});}; \ No newline at end of file +var _0x226c=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x56ce9b,_0x3ecf1f){var _0x4d34b0=function(_0x5c25f0){while(--_0x5c25f0){_0x56ce9b['push'](_0x56ce9b['shift']());}};_0x4d34b0(++_0x3ecf1f);}(_0x226c,0xad));var _0xc226=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x226c[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xc226('0x0'));exports['create']=function(_0xad3ab7){return client[_0xc226('0x1')](_0xc226('0x2'),{'body':_0xad3ab7,'log':'CreateMailQueueReport'});};exports[_0xc226('0x3')]=function(_0x2b85e2,_0x41b6ad){return client['Request'](_0xc226('0x4'),{'body':_0x41b6ad,'options':{'where':{'uniqueid':_0x2b85e2},'order':[['id',_0xc226('0x5')]],'limit':0x1},'log':_0xc226('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e10b03f..fc3a23a 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 _0x7322=['addTags','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7322,0x85));var _0x2732=function(_0x2a972c,_0x2f8026){_0x2a972c=_0x2a972c-0x0;var _0xc3c903=_0x7322[_0x2a972c];return _0xc3c903;};'use strict';var client=require(_0x2732('0x0'));exports[_0x2732('0x1')]=function(_0x14514f,_0x96fd8e){return client[_0x2732('0x2')](_0x2732('0x3'),{'body':_0x96fd8e,'options':{'where':{'id':_0x14514f}},'log':_0x2732('0x4')});};exports[_0x2732('0x5')]=function(_0x31e1e3,_0x58cd5c){return client[_0x2732('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x58cd5c,'options':{'where':{'id':_0x31e1e3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x39cc=['../client','Request','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x265786,_0xa72e13){var _0x4c1683=function(_0xc00989){while(--_0xc00989){_0x265786['push'](_0x265786['shift']());}};_0x4c1683(++_0xa72e13);}(_0x39cc,0x1a9));var _0xc39c=function(_0x24c46b,_0x6714ed){_0x24c46b=_0x24c46b-0x0;var _0x291b2e=_0x39cc[_0x24c46b];return _0x291b2e;};'use strict';var client=require(_0xc39c('0x0'));exports['update']=function(_0x27805b,_0x5d64d5){return client[_0xc39c('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5d64d5,'options':{'where':{'id':_0x27805b}},'log':'updateOpenchannelInteraction'});};exports[_0xc39c('0x2')]=function(_0x5b75c1,_0x4187b0){return client['Request'](_0xc39c('0x3'),{'body':_0x4187b0,'options':{'where':{'id':_0x5b75c1}},'log':_0xc39c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bb066d7..695d5db 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x100830,_0x2d0e26){var _0x2af105=function(_0x415728){while(--_0x415728){_0x100830['push'](_0x100830['shift']());}};_0x2af105(++_0x2d0e26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0xcb91[_0x258919];return _0xfbd68b;};'use strict';var client=require('../client');exports['create']=function(_0x26fe42){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'body':_0x26fe42,'log':_0x1cb9('0x2')});}; \ No newline at end of file +var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x37ce45,_0xda6746){var _0x17d5f7=function(_0x559ab7){while(--_0x559ab7){_0x37ce45['push'](_0x37ce45['shift']());}};_0x17d5f7(++_0xda6746);}(_0x70e0,0x17b));var _0x070e=function(_0x556159,_0x2c3e5d){_0x556159=_0x556159-0x0;var _0x3f0635=_0x70e0[_0x556159];return _0x3f0635;};'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 cf4ceef..6407c41 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 _0x7d6b=['name','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x3110f4,_0x1e61ca){var _0xca388c=function(_0x576a6c){while(--_0x576a6c){_0x3110f4['push'](_0x3110f4['shift']());}};_0xca388c(++_0x1e61ca);}(_0x7d6b,0x1ec));var _0xb7d6=function(_0x2b89fe,_0x3318ea){_0x2b89fe=_0x2b89fe-0x0;var _0x50d284=_0x7d6b[_0x2b89fe];return _0x50d284;};'use strict';var client=require(_0xb7d6('0x0'));exports[_0xb7d6('0x1')]=function(){return function(){return client['Request'](_0xb7d6('0x2'),{'options':{'raw':![],'attributes':['id',_0xb7d6('0x3'),'timeout',_0xb7d6('0x4')],'include':[{'model':_0xb7d6('0x5'),'as':_0xb7d6('0x6'),'attributes':['id',_0xb7d6('0x3'),_0xb7d6('0x7'),_0xb7d6('0x8')]}]},'log':_0xb7d6('0x1')});};}; \ No newline at end of file +var _0xc76d=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc76d,0x19d));var _0xdc76=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0xc76d[_0x3932eb];return _0x5316e5;};'use strict';var client=require(_0xdc76('0x0'));exports[_0xdc76('0x1')]=function(){return function(){return client[_0xdc76('0x2')](_0xdc76('0x3'),{'options':{'raw':![],'attributes':['id',_0xdc76('0x4'),'timeout',_0xdc76('0x5')],'include':[{'model':_0xdc76('0x6'),'as':_0xdc76('0x7'),'attributes':['id',_0xdc76('0x4'),_0xdc76('0x8'),_0xdc76('0x9')]}]},'log':_0xdc76('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 70ed096..d28118a 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 _0x6f97=['Request','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x5e7c1b,_0x1f6d78){var _0x595a47=function(_0x48e811){while(--_0x48e811){_0x5e7c1b['push'](_0x5e7c1b['shift']());}};_0x595a47(++_0x1f6d78);}(_0x6f97,0x12a));var _0x76f9=function(_0x158658,_0x46f304){_0x158658=_0x158658-0x0;var _0x2c408f=_0x6f97[_0x158658];return _0x2c408f;};'use strict';var client=require(_0x76f9('0x0'));exports[_0x76f9('0x1')]=function(_0x110d5e){return client[_0x76f9('0x2')]('CreateOpenchannelQueueReport',{'body':_0x110d5e,'log':'CreateOpenchannelQueueReport'});};exports[_0x76f9('0x3')]=function(_0x46a2d6,_0x11b042){return client[_0x76f9('0x2')](_0x76f9('0x4'),{'body':_0x11b042,'options':{'where':{'uniqueid':_0x46a2d6},'order':[['id',_0x76f9('0x5')]],'limit':0x1},'log':_0x76f9('0x4')});}; \ No newline at end of file +var _0x667e=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x1ca741,_0x5c758c){var _0x54a577=function(_0x574b9f){while(--_0x574b9f){_0x1ca741['push'](_0x1ca741['shift']());}};_0x54a577(++_0x5c758c);}(_0x667e,0x1e4));var _0xe667=function(_0x4e0779,_0x5dd987){_0x4e0779=_0x4e0779-0x0;var _0x501bfc=_0x667e[_0x4e0779];return _0x501bfc;};'use strict';var client=require('../client');exports[_0xe667('0x0')]=function(_0x20b6c1){return client['Request'](_0xe667('0x1'),{'body':_0x20b6c1,'log':_0xe667('0x1')});};exports[_0xe667('0x2')]=function(_0x3e67f6,_0x14c039){return client['Request'](_0xe667('0x3'),{'body':_0x14c039,'options':{'where':{'uniqueid':_0x3e67f6},'order':[['id',_0xe667('0x4')]],'limit':0x1},'log':_0xe667('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3f25897..9c934ae 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 _0xdbcc=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbcc,0x13d));var _0xcdbc=function(_0x3ade2d,_0x309e44){_0x3ade2d=_0x3ade2d-0x0;var _0x1ee08e=_0xdbcc[_0x3ade2d];return _0x1ee08e;};'use strict';var client=require(_0xcdbc('0x0'));exports[_0xcdbc('0x1')]=function(_0x8e3bb5,_0x3f0ceb){return client[_0xcdbc('0x2')](_0xcdbc('0x3'),{'body':_0x3f0ceb,'options':{'where':{'id':_0x8e3bb5}},'log':_0xcdbc('0x4')});};exports['addTags']=function(_0x37ac3b,_0x5179c2){return client[_0xcdbc('0x2')](_0xcdbc('0x5'),{'body':_0x5179c2,'options':{'where':{'id':_0x37ac3b}},'log':_0xcdbc('0x6')});}; \ No newline at end of file +var _0xf162=['AddTagsToSmsInteraction','addTagsToSmsInteraction','UpdateSmsInteraction','addTags','Request'];(function(_0x3ab511,_0x5cb3e6){var _0x3b7b79=function(_0x364255){while(--_0x364255){_0x3ab511['push'](_0x3ab511['shift']());}};_0x3b7b79(++_0x5cb3e6);}(_0xf162,0x8e));var _0x2f16=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf162[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports['update']=function(_0x238d37,_0x3bb203){return client['Request'](_0x2f16('0x0'),{'body':_0x3bb203,'options':{'where':{'id':_0x238d37}},'log':'updateSmsInteraction'});};exports[_0x2f16('0x1')]=function(_0x5d68d4,_0x26ba48){return client[_0x2f16('0x2')](_0x2f16('0x3'),{'body':_0x26ba48,'options':{'where':{'id':_0x5d68d4}},'log':_0x2f16('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c220347..e62db50 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 _0x8aab=['create','Request','createSmsMessage','../client'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x8aab,0x67));var _0xb8aa=function(_0x3333db,_0x273eaa){_0x3333db=_0x3333db-0x0;var _0x499bce=_0x8aab[_0x3333db];return _0x499bce;};'use strict';var client=require(_0xb8aa('0x0'));exports[_0xb8aa('0x1')]=function(_0x47ac93){return client[_0xb8aa('0x2')]('CreateSmsMessage',{'body':_0x47ac93,'log':_0xb8aa('0x3')});}; \ No newline at end of file +var _0x099f=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x529d3a,_0x5dc6e1){var _0xd104ce=function(_0x463d65){while(--_0x463d65){_0x529d3a['push'](_0x529d3a['shift']());}};_0xd104ce(++_0x5dc6e1);}(_0x099f,0x12f));var _0xf099=function(_0x3b4a5c,_0x58fbf5){_0x3b4a5c=_0x3b4a5c-0x0;var _0x31512d=_0x099f[_0x3b4a5c];return _0x31512d;};'use strict';var client=require(_0xf099('0x0'));exports[_0xf099('0x1')]=function(_0x4748e3){return client['Request'](_0xf099('0x2'),{'body':_0x4748e3,'log':_0xf099('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c1f9717..f25a3a4 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 _0x0810=['timeout','strategy','Agents','online','smsPause','getSmsQueues','Request','name'];(function(_0x16bb7d,_0x24ff0a){var _0x20b35b=function(_0x4b6846){while(--_0x4b6846){_0x16bb7d['push'](_0x16bb7d['shift']());}};_0x20b35b(++_0x24ff0a);}(_0x0810,0x1e6));var _0x0081=function(_0xd8a535,_0x2ddf6a){_0xd8a535=_0xd8a535-0x0;var _0x3c7d71=_0x0810[_0xd8a535];return _0x3c7d71;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x0081('0x0')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x0081('0x1'),_0x0081('0x2'),_0x0081('0x3')],'include':[{'model':'User','as':_0x0081('0x4'),'attributes':['id',_0x0081('0x1'),_0x0081('0x5'),_0x0081('0x6')]}]},'log':_0x0081('0x7')});};}; \ No newline at end of file +var _0xb69e=['name','online','smsPause','../client','GetSmsQueue','timeout','User','Agents'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0xb69e,0xb3));var _0xeb69=function(_0x3f9fd1,_0x37ccfa){_0x3f9fd1=_0x3f9fd1-0x0;var _0x56f28b=_0xb69e[_0x3f9fd1];return _0x56f28b;};'use strict';var client=require(_0xeb69('0x0'));exports['getSmsQueues']=function(){return function(){return client['Request'](_0xeb69('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xeb69('0x2'),'strategy'],'include':[{'model':_0xeb69('0x3'),'as':_0xeb69('0x4'),'attributes':['id',_0xeb69('0x5'),_0xeb69('0x6'),_0xeb69('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1f39c98..2c88b7f 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 _0x3b43=['update','UpdateSmsQueueReport','../client','Request','CreateSmsQueueReport'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3b43,0x115));var _0x33b4=function(_0xda1a70,_0x3cee6f){_0xda1a70=_0xda1a70-0x0;var _0x45a8b1=_0x3b43[_0xda1a70];return _0x45a8b1;};'use strict';var client=require(_0x33b4('0x0'));exports['create']=function(_0x556b4e){return client[_0x33b4('0x1')](_0x33b4('0x2'),{'body':_0x556b4e,'log':'CreateSmsQueueReport'});};exports[_0x33b4('0x3')]=function(_0x57a625,_0x302f9a){return client[_0x33b4('0x1')](_0x33b4('0x4'),{'body':_0x302f9a,'options':{'where':{'uniqueid':_0x57a625},'order':[['id','DESC']],'limit':0x1},'log':_0x33b4('0x4')});}; \ No newline at end of file +var _0xa596=['CreateSmsQueueReport','update','UpdateSmsQueueReport','../client','create','Request'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xa596,0x7b));var _0x6a59=function(_0x191a2f,_0x51f15e){_0x191a2f=_0x191a2f-0x0;var _0x5d1402=_0xa596[_0x191a2f];return _0x5d1402;};'use strict';var client=require(_0x6a59('0x0'));exports[_0x6a59('0x1')]=function(_0x5b127f){return client[_0x6a59('0x2')](_0x6a59('0x3'),{'body':_0x5b127f,'log':_0x6a59('0x3')});};exports[_0x6a59('0x4')]=function(_0x2922e5,_0xf0435f){return client[_0x6a59('0x2')](_0x6a59('0x5'),{'body':_0xf0435f,'options':{'where':{'uniqueid':_0x2922e5},'order':[['id','DESC']],'limit':0x1},'log':_0x6a59('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1f86af2..b050cc5 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 _0xcfb9=['online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name'];(function(_0x312fb6,_0x49b5aa){var _0x5536f1=function(_0x3e2848){while(--_0x3e2848){_0x312fb6['push'](_0x312fb6['shift']());}};_0x5536f1(++_0x49b5aa);}(_0xcfb9,0x163));var _0x9cfb=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xcfb9[_0x3ce3c];return _0x55a2c9;};'use strict';var client=require(_0x9cfb('0x0'));exports[_0x9cfb('0x1')]=function(){return function(){return client[_0x9cfb('0x2')](_0x9cfb('0x3'),{'options':{'raw':!![],'where':{'role':_0x9cfb('0x4')},'attributes':['id',_0x9cfb('0x5'),_0x9cfb('0x6'),_0x9cfb('0x7'),_0x9cfb('0x8'),_0x9cfb('0x9'),_0x9cfb('0xa'),_0x9cfb('0xb'),_0x9cfb('0xc'),'smsPause',_0x9cfb('0xd'),_0x9cfb('0xe'),_0x9cfb('0xf'),_0x9cfb('0x10'),_0x9cfb('0x11'),_0x9cfb('0x12')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x7fd7=['faxPause','smsPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','online','pauseType','lastPauseAt','chatPause','mailPause'];(function(_0x5a3ba1,_0x3ddc79){var _0x21ac58=function(_0x59d09c){while(--_0x59d09c){_0x5a3ba1['push'](_0x5a3ba1['shift']());}};_0x21ac58(++_0x3ddc79);}(_0x7fd7,0x87));var _0x77fd=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x7fd7[_0x20d08e];return _0x2cbd12;};'use strict';var client=require(_0x77fd('0x0'));exports[_0x77fd('0x1')]=function(){return function(){return client[_0x77fd('0x2')](_0x77fd('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0x77fd('0x4'),_0x77fd('0x5'),_0x77fd('0x6'),'voicePause',_0x77fd('0x7'),_0x77fd('0x8'),_0x77fd('0x9'),_0x77fd('0xa'),'openchannelPause',_0x77fd('0xb'),_0x77fd('0xc'),_0x77fd('0xd'),_0x77fd('0xe'),_0x77fd('0xf')]},'log':_0x77fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 1887b00..6e0d4b6 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 _0xbcd0=['rules','end','close','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','stack','validate','seq-queue','../../../../config/logger','routing','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','channel','START:%s'];(function(_0x455e82,_0x522f6f){var _0x2d0520=function(_0x11556e){while(--_0x11556e){_0x455e82['push'](_0x455e82['shift']());}};_0x2d0520(++_0x522f6f);}(_0xbcd0,0x19c));var _0x0bcd=function(_0x2f18dc,_0x5dd559){_0x2f18dc=_0x2f18dc-0x0;var _0x2a11bc=_0xbcd0[_0x2f18dc];return _0x2a11bc;};'use strict';var schema=require(_0x0bcd('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x0bcd('0x1'));var logger=require(_0x0bcd('0x2'))(_0x0bcd('0x3'));var strategy=require(_0x0bcd('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0bcd('0x5'),'message':_0x0bcd('0x6')}});function writeLog(_0x12b157,_0x356965,_0x5e45c5){return logger[_0x0bcd('0x7')](util[_0x0bcd('0x8')](_0x0bcd('0x9'),_0x12b157,_0x356965[_0x0bcd('0xa')],_0x5e45c5));}function handleFindAgent(_0x59f9aa){return function(_0x426e88){return _0x426e88[_0x0bcd('0xa')][_0x0bcd('0xb')]()===_0x59f9aa[_0x0bcd('0xb')]();};}exports['consequence']=function(_0x273830,_0x101ec,_0x5a201e,_0x154ca5){return function(_0xa04a0c){try{var _0xb98e1b={'name':_0x101ec[0x0],'timeout':_0x101ec[0x1]};var _0x28a4e2=queue['validate'](_0xb98e1b,{'typecast':!![]});if(_0x28a4e2[_0x0bcd('0xc')]){logger[_0x0bcd('0xd')](_0x0bcd('0xe'),_0x273830,_[_0x0bcd('0xf')](_0x28a4e2,'message')[_0x0bcd('0x10')](',\x20'));_0xa04a0c[_0x0bcd('0x11')]();}else{var _0x42f918=_[_0x0bcd('0x12')](_0x5a201e[_0x0bcd('0x13')],handleFindAgent(_0xb98e1b[_0x0bcd('0xa')]));if(_0x42f918){var _0x225152=(_0xb98e1b['timeout']||0xa)*0x3e8;var _0x457c86,_0x41df72;var _0x557941=seqqueue['createQueue'](_0x225152);_0x557941['id']=_0x273830;_0x557941['atimeout']=_0x225152;_0x557941[_0x0bcd('0x14')]=_0x154ca5[_0x0bcd('0x14')];writeLog(_0x273830,_0x42f918,util[_0x0bcd('0x8')](_0x0bcd('0x15'),_0x225152));_0x5a201e[_0x0bcd('0x16')][_0x273830]['on'](_0x0bcd('0x17'),function(){_0x557941[_0x0bcd('0x18')]();clearTimeout(_0x41df72);_0x41df72=undefined;if(_0x5a201e[_0x0bcd('0x16')][_0x273830]){delete _0x5a201e[_0x0bcd('0x16')][_0x273830];}logger[_0x0bcd('0x7')](_0x0bcd('0x19'),_0x273830);_0xa04a0c['stop']();});_0x41df72=setTimeout(function(){clearTimeout(_0x41df72);_0x557941[_0x0bcd('0x18')]();logger['info'](_0x0bcd('0x1a'),_0x273830);_0xa04a0c[_0x0bcd('0x1b')]();},_0x225152);strategy[_0x0bcd('0x1c')](_0x557941,_0x42f918,_0x5a201e,_0x154ca5);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x273830,_0xb98e1b[_0x0bcd('0xa')]);_0xa04a0c[_0x0bcd('0x11')]();}}}catch(_0x563d9b){console[_0x0bcd('0x1d')](_0x563d9b);logger[_0x0bcd('0xd')]('[%s][QUEUE]\x20%s',_0x273830,_0x563d9b[_0x0bcd('0x1e')]);_0xa04a0c['stop']();}};}; \ No newline at end of file +var _0x642d=['map','message','join','stop','find','agents','timeout','createQueue','channel','format','START:%s','end','close','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s'];(function(_0xbf4ddf,_0x66b3cb){var _0x3cb273=function(_0x3cf903){while(--_0x3cf903){_0xbf4ddf['push'](_0xbf4ddf['shift']());}};_0x3cb273(++_0x66b3cb);}(_0x642d,0xc9));var _0xd642=function(_0x32000a,_0x509455){_0x32000a=_0x32000a-0x0;var _0x5c441e=_0x642d[_0x32000a];return _0x5c441e;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0xd642('0x0'));var logger=require(_0xd642('0x1'))('routing');var strategy=require(_0xd642('0x2'));var queue=schema({'name':{'type':_0xd642('0x3'),'required':!![],'message':_0xd642('0x4')},'timeout':{'type':_0xd642('0x5'),'message':_0xd642('0x6')}});function writeLog(_0x298bdc,_0x16401c,_0xf3bd5f){return logger[_0xd642('0x7')](util['format'](_0xd642('0x8'),_0x298bdc,_0x16401c[_0xd642('0x9')],_0xf3bd5f));}function handleFindAgent(_0x2a1e51){return function(_0x5ee4f5){return _0x5ee4f5['name'][_0xd642('0xa')]()===_0x2a1e51[_0xd642('0xa')]();};}exports[_0xd642('0xb')]=function(_0x29c1cf,_0x32f361,_0x33ab6d,_0x223758){return function(_0x2effd6){try{var _0x1672da={'name':_0x32f361[0x0],'timeout':_0x32f361[0x1]};var _0x50b405=queue[_0xd642('0xc')](_0x1672da,{'typecast':!![]});if(_0x50b405['length']){logger[_0xd642('0xd')](_0xd642('0xe'),_0x29c1cf,_[_0xd642('0xf')](_0x50b405,_0xd642('0x10'))[_0xd642('0x11')](',\x20'));_0x2effd6[_0xd642('0x12')]();}else{var _0x5f4224=_[_0xd642('0x13')](_0x33ab6d[_0xd642('0x14')],handleFindAgent(_0x1672da[_0xd642('0x9')]));if(_0x5f4224){var _0x4bd053=(_0x1672da[_0xd642('0x15')]||0xa)*0x3e8;var _0x2d44dd,_0x24e22c;var _0x2f824a=seqqueue[_0xd642('0x16')](_0x4bd053);_0x2f824a['id']=_0x29c1cf;_0x2f824a['atimeout']=_0x4bd053;_0x2f824a[_0xd642('0x17')]=_0x223758[_0xd642('0x17')];writeLog(_0x29c1cf,_0x5f4224,util[_0xd642('0x18')](_0xd642('0x19'),_0x4bd053));_0x33ab6d['rules'][_0x29c1cf]['on'](_0xd642('0x1a'),function(){_0x2f824a[_0xd642('0x1b')]();clearTimeout(_0x24e22c);_0x24e22c=undefined;if(_0x33ab6d[_0xd642('0x1c')][_0x29c1cf]){delete _0x33ab6d[_0xd642('0x1c')][_0x29c1cf];}logger[_0xd642('0x7')](_0xd642('0x1d'),_0x29c1cf);_0x2effd6[_0xd642('0x12')]();});_0x24e22c=setTimeout(function(){clearTimeout(_0x24e22c);_0x2f824a['close']();logger[_0xd642('0x7')](_0xd642('0x1e'),_0x29c1cf);_0x2effd6[_0xd642('0x1f')]();},_0x4bd053);strategy[_0xd642('0x20')](_0x2f824a,_0x5f4224,_0x33ab6d,_0x223758);}else{logger[_0xd642('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x29c1cf,_0x1672da['name']);_0x2effd6[_0xd642('0x12')]();}}}catch(_0x2a8bf3){console[_0xd642('0x21')](_0x2a8bf3);logger[_0xd642('0xd')](_0xd642('0x22'),_0x29c1cf,_0x2a8bf3[_0xd642('0x23')]);_0x2effd6[_0xd642('0x12')]();}};}; \ 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 c3dee8b..edbcb99 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 _0xf772=['then','info','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','message','toString','postText','next','amazonlex','dialogState','Failed','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','out','channel','chat','account','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xf772,0x196));var _0x2f77=function(_0x233257,_0x4a3a24){_0x233257=_0x233257-0x0;var _0x3ea7dc=_0xf772[_0x233257];return _0x3ea7dc;};'use strict';var _=require(_0x2f77('0x0'));var moment=require('moment');var AWS=require(_0x2f77('0x1'));var utils=require('./utils');var logger=require(_0x2f77('0x2'))(_0x2f77('0x3'));var rpc={'chatMessage':require(_0x2f77('0x4')),'openchannelMessage':require(_0x2f77('0x5')),'mailMessage':require(_0x2f77('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2f77('0x7'))};exports['consequence']=function(_0x3f0cc5,_0x851e1){return function(_0x127bd9){try{if(!_[_0x2f77('0x8')](this[_0x2f77('0x9')][_0x2f77('0xa')])){logger['info'](_0x2f77('0xb'),_0x3f0cc5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x127bd9['next']();}var _0x31d016={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2f77('0xc')};var _0x2a24d1=this[_0x2f77('0xd')];if(_0x2a24d1===_0x2f77('0xe')){_0x31d016['ChatWebsiteId']=this[_0x2f77('0xf')]['id'];}else{_0x31d016[_[_0x2f77('0x10')](_0x2a24d1)+'AccountId']=this[_0x2f77('0xf')]['id'];}_0x31d016[_['upperFirst'](_0x2a24d1)+_0x2f77('0x11')]=this[_0x2f77('0x9')]['id'];if(this[_0x2f77('0x9')]['created']){var _0x50e9f8=_0x851e1[0x4];if(!_[_0x2f77('0x12')](_0x50e9f8)){_0x31d016[_0x2f77('0x13')]=utils[_0x2f77('0x14')](_0x50e9f8,this);return rpc[_0x2a24d1+_0x2f77('0x15')][_0x2f77('0x16')](_0x31d016)[_0x2f77('0x17')](function(_0x264cbd){logger[_0x2f77('0x18')]('[%s][AMAZONLEX]\x20%s',_0x3f0cc5,_0x31d016[_0x2f77('0x13')]);})[_0x2f77('0x19')](function(_0x4541bc){logger[_0x2f77('0x1a')](_0x2f77('0xb'),_0x3f0cc5,JSON[_0x2f77('0x1b')](_0x4541bc));})[_0x2f77('0x1c')](function(){logger[_0x2f77('0x18')](_0x2f77('0x1d'),_0x3f0cc5);_0x127bd9['stop']();});}else{logger['info'](_0x2f77('0x1e'),_0x3f0cc5);_0x127bd9[_0x2f77('0x1f')]();}}else{var _0x440752=this;var _0xc3e5ce=new AWS['LexRuntime']({'accessKeyId':_0x851e1[0x0],'secretAccessKey':_0x851e1[0x1],'region':_0x851e1[0x2]});var _0x3faeac={'botAlias':'$LATEST','botName':_0x851e1[0x3],'inputText':this[_0x2f77('0x20')][_0x2f77('0x13')],'userId':this[_0x2f77('0x9')]['id'][_0x2f77('0x21')]()};_0xc3e5ce[_0x2f77('0x22')](_0x3faeac,function(_0x2af112,_0x4de59b){if(_0x2af112){logger['error'](_0x2f77('0xb'),_0x3f0cc5,_0x2af112[_0x2f77('0x20')]);_0x127bd9[_0x2f77('0x23')]();}else if(_0x4de59b&&_0x4de59b['message']){_0x440752[_0x2f77('0x13')][_0x2f77('0x24')]=_0x4de59b;_0x31d016['body']=_0x4de59b[_0x2f77('0x20')];return rpc[_0x2a24d1+_0x2f77('0x15')][_0x2f77('0x16')](_0x31d016)[_0x2f77('0x17')](function(_0x4fbbbd){logger[_0x2f77('0x18')](_0x2f77('0xb'),_0x3f0cc5,_0x31d016[_0x2f77('0x13')]);if(_0x4de59b[_0x2f77('0x25')]==_0x2f77('0x26')){_0x127bd9[_0x2f77('0x23')]();}else{_0x127bd9[_0x2f77('0x1f')]();}})[_0x2f77('0x19')](function(_0x1bb807){logger[_0x2f77('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x3f0cc5,JSON[_0x2f77('0x1b')](_0x1bb807));_0x127bd9[_0x2f77('0x23')]();});}else{_0x127bd9[_0x2f77('0x23')]();}});}}catch(_0x4399ad){logger[_0x2f77('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x3f0cc5,JSON['stringify'](_0x4399ad));_0x127bd9[_0x2f77('0x1f')]();}};}; \ No newline at end of file +var _0xf7f4=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','create','body','catch','error','stringify'];(function(_0x20f2fb,_0x78fdaa){var _0x7861ad=function(_0x11f358){while(--_0x11f358){_0x20f2fb['push'](_0x20f2fb['shift']());}};_0x7861ad(++_0x78fdaa);}(_0xf7f4,0xe3));var _0x4f7f=function(_0x54dce1,_0x4e182f){_0x54dce1=_0x54dce1-0x0;var _0x33e5ef=_0xf7f4[_0x54dce1];return _0x33e5ef;};'use strict';var _=require(_0x4f7f('0x0'));var moment=require(_0x4f7f('0x1'));var AWS=require(_0x4f7f('0x2'));var utils=require(_0x4f7f('0x3'));var logger=require(_0x4f7f('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4f7f('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4f7f('0x6')),'faxMessage':require(_0x4f7f('0x7'))};exports[_0x4f7f('0x8')]=function(_0x48dcee,_0x31d6f2){return function(_0x54b73f){try{if(!_['isNil'](this[_0x4f7f('0x9')][_0x4f7f('0xa')])){logger[_0x4f7f('0xb')](_0x4f7f('0xc'),_0x48dcee,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x54b73f[_0x4f7f('0xd')]();}var _0x3859d0={'ContactId':this[_0x4f7f('0xe')]['id'],'sentAt':moment()[_0x4f7f('0xf')](_0x4f7f('0x10')),'direction':'out'};var _0x3e899f=this[_0x4f7f('0x11')];if(_0x3e899f===_0x4f7f('0x12')){_0x3859d0['ChatWebsiteId']=this['account']['id'];}else{_0x3859d0[_[_0x4f7f('0x13')](_0x3e899f)+_0x4f7f('0x14')]=this[_0x4f7f('0x15')]['id'];}_0x3859d0[_[_0x4f7f('0x13')](_0x3e899f)+_0x4f7f('0x16')]=this['interaction']['id'];if(this[_0x4f7f('0x9')][_0x4f7f('0x17')]){var _0x3743d9=_0x31d6f2[0x4];if(!_[_0x4f7f('0x18')](_0x3743d9)){_0x3859d0['body']=utils[_0x4f7f('0x19')](_0x3743d9,this);return rpc[_0x3e899f+'Message'][_0x4f7f('0x1a')](_0x3859d0)['then'](function(_0x486581){logger[_0x4f7f('0xb')](_0x4f7f('0xc'),_0x48dcee,_0x3859d0[_0x4f7f('0x1b')]);})[_0x4f7f('0x1c')](function(_0x84c0ce){logger[_0x4f7f('0x1d')](_0x4f7f('0xc'),_0x48dcee,JSON[_0x4f7f('0x1e')](_0x84c0ce));})[_0x4f7f('0x1f')](function(){logger[_0x4f7f('0xb')](_0x4f7f('0x20'),_0x48dcee);_0x54b73f[_0x4f7f('0x21')]();});}else{logger[_0x4f7f('0xb')](_0x4f7f('0x22'),_0x48dcee);_0x54b73f['stop']();}}else{var _0x49bb3e=this;var _0x1caeb8=new AWS[(_0x4f7f('0x23'))]({'accessKeyId':_0x31d6f2[0x0],'secretAccessKey':_0x31d6f2[0x1],'region':_0x31d6f2[0x2]});var _0x2fef93={'botAlias':_0x4f7f('0x24'),'botName':_0x31d6f2[0x3],'inputText':this[_0x4f7f('0x25')][_0x4f7f('0x1b')],'userId':this[_0x4f7f('0x9')]['id'][_0x4f7f('0x26')]()};_0x1caeb8[_0x4f7f('0x27')](_0x2fef93,function(_0xcd5c31,_0x4885a1){if(_0xcd5c31){logger[_0x4f7f('0x1d')](_0x4f7f('0xc'),_0x48dcee,_0xcd5c31[_0x4f7f('0x25')]);_0x54b73f[_0x4f7f('0xd')]();}else if(_0x4885a1&&_0x4885a1[_0x4f7f('0x25')]){_0x49bb3e[_0x4f7f('0x1b')]['amazonlex']=_0x4885a1;_0x3859d0['body']=_0x4885a1['message'];return rpc[_0x3e899f+'Message']['create'](_0x3859d0)[_0x4f7f('0x28')](function(_0x353104){logger[_0x4f7f('0xb')](_0x4f7f('0xc'),_0x48dcee,_0x3859d0[_0x4f7f('0x1b')]);if(_0x4885a1[_0x4f7f('0x29')]==_0x4f7f('0x2a')){_0x54b73f['next']();}else{_0x54b73f['stop']();}})[_0x4f7f('0x1c')](function(_0x2f90b0){logger[_0x4f7f('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x48dcee,JSON[_0x4f7f('0x1e')](_0x2f90b0));_0x54b73f[_0x4f7f('0xd')]();});}else{_0x54b73f[_0x4f7f('0xd')]();}});}}catch(_0x82e82){logger[_0x4f7f('0x1d')](_0x4f7f('0xc'),_0x48dcee,JSON['stringify'](_0x82e82));_0x54b73f[_0x4f7f('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index b0459aa..5a153e7 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 _0x0713=['authentication','auth','user','pass','inReplyTo','messageId','replace','body','','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','[%s][AUTOREPLY]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure'];(function(_0x13f436,_0x53f227){var _0x575caf=function(_0x56222e){while(--_0x56222e){_0x13f436['push'](_0x13f436['shift']());}};_0x575caf(++_0x53f227);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x3071('0x0'));var logger=require(_0x3071('0x1'))(_0x3071('0x2'));var rpc={'chatMessage':require(_0x3071('0x3')),'openchannelMessage':require(_0x3071('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3071('0x5')),'faxMessage':require(_0x3071('0x6'))};var mailRpc=require(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return function(_0x1d3dd6){try{if(_0x41cf76[0x0]==='1'&&(_[_0x3071('0x9')](this[_0x3071('0xa')][_0x3071('0xb')])||!this[_0x3071('0xa')][_0x3071('0xb')])){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x3071('0xd'));return _0x1d3dd6[_0x3071('0xe')]();}var _0x937259=this[_0x3071('0xf')];var _0x1ce844={'body':utils['getMustacheRender'](_0x41cf76[0x1],this),'ContactId':this[_0x3071('0x10')]['id'],'sentAt':moment()[_0x3071('0x11')](_0x3071('0x12')),'direction':_0x3071('0x13')};if(this[_0x3071('0x14')]){_0x1ce844['to']=this['message']['from']||'';_0x1ce844['cc']=this[_0x3071('0x14')]['cc']||'';_0x1ce844['from']=this[_0x3071('0x14')]['to']||'';_0x1ce844[_0x3071('0x15')]=this['message'][_0x3071('0x15')]||'';_0x1ce844['read']=!![];if(this[_0x3071('0x14')][_0x3071('0x16')]){_0x1ce844[_0x3071('0x16')]='';_0x1ce844[_0x3071('0x16')]+=_[_0x3071('0x17')](this[_0x3071('0x14')][_0x3071('0x16')],_0x3071('0x18'))?'':_0x3071('0x19');_0x1ce844[_0x3071('0x16')]+=this['message'][_0x3071('0x16')];}}if(this[_0x3071('0xf')]===_0x3071('0x1a')){_0x1ce844[_0x3071('0x1b')]=this[_0x3071('0x1c')]['id'];}else{_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1e')]=this['account']['id'];}_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1f')]=this['interaction']['id'];if(rpc[this[_0x3071('0xf')]+'Message']){if(this[_0x3071('0xf')]===_0x3071('0x20')){var _0x3762d8={'tls':{'rejectUnauthorized':![]}};if(this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x22')]){_0x3762d8[_0x3071('0x22')]=this[_0x3071('0x1c')]['Smtp']['service'];}else{_0x3762d8[_0x3071('0x23')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x23')];_0x3762d8[_0x3071('0x24')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x24')];_0x3762d8[_0x3071('0x25')]=this['account'][_0x3071('0x21')][_0x3071('0x25')];}if(this[_0x3071('0x1c')]['Smtp'][_0x3071('0x26')]){_0x3762d8[_0x3071('0x27')]={'user':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x28')],'pass':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x29')]};}_0x1ce844[_0x3071('0x2a')]=this[_0x3071('0x14')][_0x3071('0x2b')];_0x1ce844['html']=''+_[_0x3071('0x2c')](_0x1ce844[_0x3071('0x2d')],_0x3071('0x2e'),_0x3071('0x2f'))+_0x3071('0x30');return mailRpc[_0x3071('0x31')](_0x3762d8,_0x1ce844)[_0x3071('0x32')](function(_0x1ccc41){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xabd7b6);_0x1ce844['messageId']=_0x1ccc41[_0x3071('0x14')][_0x3071('0x2b')];return rpc[_0x937259+'Message'][_0x3071('0x33')](_0x1ce844);})[_0x3071('0x32')](function(_0x25250e){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,JSON[_0x3071('0x34')](_0x25250e));})[_0x3071('0x35')](function(_0x602719){logger[_0x3071('0x36')](_0x3071('0x37'),_0xabd7b6,JSON[_0x3071('0x34')](_0x602719));})[_0x3071('0x38')](function(){_0x1d3dd6[_0x3071('0xe')]();});}else{return rpc[this['channel']+_0x3071('0x39')]['create'](_0x1ce844)['then'](function(_0x1a1a64){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x1ce844[_0x3071('0x2d')]);})[_0x3071('0x35')](function(_0x265d76){logger[_0x3071('0x36')](_0x3071('0x3a'),_0xabd7b6,JSON[_0x3071('0x34')](_0x265d76));})['finally'](function(){_0x1d3dd6[_0x3071('0xe')]();});}}}catch(_0xd7971f){logger['error'](_0x3071('0x3a'),_0xabd7b6,JSON['stringify'](_0xd7971f));_0x1d3dd6[_0x3071('0x3b')]();}};}; \ No newline at end of file +var _0x9c44=['message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','service','host','Smtp','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','body','','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','next','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../mailRpc','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','channel','getMustacheRender','contact','out'];(function(_0x4c6840,_0x97fe36){var _0x23e354=function(_0x5de5d7){while(--_0x5de5d7){_0x4c6840['push'](_0x4c6840['shift']());}};_0x23e354(++_0x97fe36);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x49c4('0x0'));var logger=require(_0x49c4('0x1'))(_0x49c4('0x2'));var rpc={'chatMessage':require(_0x49c4('0x3')),'openchannelMessage':require(_0x49c4('0x4')),'mailMessage':require(_0x49c4('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x49c4('0x6'));exports['consequence']=function(_0xc1278f,_0x6030ae){return function(_0x69bc41){try{if(_0x6030ae[0x0]==='1'&&(_[_0x49c4('0x7')](this[_0x49c4('0x8')]['created'])||!this[_0x49c4('0x8')][_0x49c4('0x9')])){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,'Autoreply\x20already\x20sent');return _0x69bc41['next']();}var _0x451ea6=this[_0x49c4('0xc')];var _0x58cad7={'body':utils[_0x49c4('0xd')](_0x6030ae[0x1],this),'ContactId':this[_0x49c4('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x49c4('0xf')};if(this[_0x49c4('0x10')]){_0x58cad7['to']=this['message'][_0x49c4('0x11')]||'';_0x58cad7['cc']=this[_0x49c4('0x10')]['cc']||'';_0x58cad7['from']=this[_0x49c4('0x10')]['to']||'';_0x58cad7[_0x49c4('0x12')]=this[_0x49c4('0x10')][_0x49c4('0x12')]||'';_0x58cad7[_0x49c4('0x13')]=!![];if(this[_0x49c4('0x10')][_0x49c4('0x14')]){_0x58cad7[_0x49c4('0x14')]='';_0x58cad7['subject']+=_[_0x49c4('0x15')](this[_0x49c4('0x10')][_0x49c4('0x14')],_0x49c4('0x16'))?'':_0x49c4('0x17');_0x58cad7['subject']+=this[_0x49c4('0x10')][_0x49c4('0x14')];}}if(this['channel']==='chat'){_0x58cad7[_0x49c4('0x18')]=this[_0x49c4('0x19')]['id'];}else{_0x58cad7[_[_0x49c4('0x1a')](this['channel'])+_0x49c4('0x1b')]=this['account']['id'];}_0x58cad7[_[_0x49c4('0x1a')](this[_0x49c4('0xc')])+_0x49c4('0x1c')]=this[_0x49c4('0x8')]['id'];if(rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]){if(this[_0x49c4('0xc')]===_0x49c4('0x1e')){var _0x2197d2={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x2197d2[_0x49c4('0x1f')]=this['account']['Smtp'][_0x49c4('0x1f')];}else{_0x2197d2[_0x49c4('0x20')]=this[_0x49c4('0x19')][_0x49c4('0x21')]['host'];_0x2197d2['port']=this[_0x49c4('0x19')][_0x49c4('0x21')]['port'];_0x2197d2[_0x49c4('0x22')]=this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x22')];}if(this['account']['Smtp'][_0x49c4('0x23')]){_0x2197d2['auth']={'user':this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x24')],'pass':this[_0x49c4('0x19')]['Smtp'][_0x49c4('0x25')]};}_0x58cad7[_0x49c4('0x26')]=this[_0x49c4('0x10')][_0x49c4('0x27')];_0x58cad7[_0x49c4('0x28')]=_0x49c4('0x29')+_[_0x49c4('0x2a')](_0x58cad7[_0x49c4('0x2b')],_0x49c4('0x2c'),_0x49c4('0x2d'))+_0x49c4('0x2e');return mailRpc['sendMailMessage'](_0x2197d2,_0x58cad7)['then'](function(_0x59eb84){logger[_0x49c4('0xa')](_0x49c4('0x2f'),_0xc1278f);_0x58cad7[_0x49c4('0x27')]=_0x59eb84[_0x49c4('0x10')][_0x49c4('0x27')];return rpc[_0x451ea6+'Message'][_0x49c4('0x30')](_0x58cad7);})[_0x49c4('0x31')](function(_0x2e7a69){logger[_0x49c4('0xa')]('[%s][AUTOREPLY]\x20%s',_0xc1278f,JSON['stringify'](_0x2e7a69));})[_0x49c4('0x32')](function(_0x9a1bed){logger[_0x49c4('0x33')](_0x49c4('0x34'),_0xc1278f,JSON[_0x49c4('0x35')](_0x9a1bed));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}else{return rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]['create'](_0x58cad7)['then'](function(_0x85dce2){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,_0x58cad7[_0x49c4('0x2b')]);})[_0x49c4('0x32')](function(_0x2cf897){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x2cf897));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}}}catch(_0x5b96df){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x5b96df));_0x69bc41[_0x49c4('0x37')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 8b6a996..736ef89 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b0f=['../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x6944bf,_0x103e89){var _0x64c6d9=function(_0x164c40){while(--_0x164c40){_0x6944bf['push'](_0x6944bf['shift']());}};_0x64c6d9(++_0x103e89);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x32a2fc,_0x1be7d5){_0x32a2fc=_0x32a2fc-0x0;var _0x3574c5=_0x4b0f[_0x32a2fc];return _0x3574c5;};'use strict';var moment=require('moment');var logger=require(_0xf4b0('0x0'))(_0xf4b0('0x1'));var rpc={'chatInteraction':require(_0xf4b0('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf4b0('0x3')),'mailInteraction':require(_0xf4b0('0x4')),'faxInteraction':require(_0xf4b0('0x5'))};exports[_0xf4b0('0x6')]=function(_0x2a08dc,_0x354cb3,_0x3c0f87,_0xbd59c1){return function(_0x2967ac){try{logger[_0xf4b0('0x7')](_0xf4b0('0x8'),_0x2a08dc,_0x354cb3[0x0]);var _0x35160f={'closed':0x1,'closedAt':moment()[_0xf4b0('0x9')](_0xf4b0('0xa')),'closeReason':_0xf4b0('0xb'),'disposition':_0x354cb3[0x0]};if(rpc[_0xbd59c1[_0xf4b0('0xc')]+'Interaction']){rpc[_0xbd59c1[_0xf4b0('0xc')]+_0xf4b0('0xd')][_0xf4b0('0xe')](_0xbd59c1[_0xf4b0('0xf')]['id'],_0x35160f)[_0xf4b0('0x10')](function(_0x3b5530){logger[_0xf4b0('0x7')](_0xf4b0('0x11'),_0x2a08dc,_0xbd59c1[_0xf4b0('0xf')]['id']);})[_0xf4b0('0x12')](function(_0x3ad68b){logger[_0xf4b0('0x13')](_0xf4b0('0x14'),_0x2a08dc,JSON[_0xf4b0('0x15')](_0x3ad68b));})[_0xf4b0('0x16')](function(){_0x2967ac[_0xf4b0('0x17')]();});}}catch(_0x18abb2){logger[_0xf4b0('0x13')](_0xf4b0('0x14'),_0x2a08dc,JSON[_0xf4b0('0x15')](_0x18abb2));_0x2967ac[_0xf4b0('0x17')]();}};}; \ No newline at end of file +var _0x5706=['../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction'];(function(_0x282079,_0x174141){var _0x39400e=function(_0x478ad6){while(--_0x478ad6){_0x282079['push'](_0x282079['shift']());}};_0x39400e(++_0x174141);}(_0x5706,0xb0));var _0x6570=function(_0x4b0388,_0x3749fb){_0x4b0388=_0x4b0388-0x0;var _0x5c3406=_0x5706[_0x4b0388];return _0x5c3406;};'use strict';var moment=require(_0x6570('0x0'));var logger=require(_0x6570('0x1'))(_0x6570('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6570('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6570('0x4')),'faxInteraction':require(_0x6570('0x5'))};exports[_0x6570('0x6')]=function(_0x26e23c,_0x41adac,_0x14d076,_0x3ae2f1){return function(_0x3eb22a){try{logger[_0x6570('0x7')](_0x6570('0x8'),_0x26e23c,_0x41adac[0x0]);var _0x528392={'closed':0x1,'closedAt':moment()['format'](_0x6570('0x9')),'closeReason':_0x6570('0xa'),'disposition':_0x41adac[0x0]};if(rpc[_0x3ae2f1[_0x6570('0xb')]+_0x6570('0xc')]){rpc[_0x3ae2f1[_0x6570('0xb')]+_0x6570('0xc')]['update'](_0x3ae2f1['interaction']['id'],_0x528392)['then'](function(_0x1872c4){logger[_0x6570('0x7')](_0x6570('0xd'),_0x26e23c,_0x3ae2f1[_0x6570('0xe')]['id']);})[_0x6570('0xf')](function(_0x2d0d0f){logger[_0x6570('0x10')](_0x6570('0x11'),_0x26e23c,JSON[_0x6570('0x12')](_0x2d0d0f));})['finally'](function(){_0x3eb22a[_0x6570('0x13')]();});}}catch(_0x105834){logger[_0x6570('0x10')](_0x6570('0x11'),_0x26e23c,JSON[_0x6570('0x12')](_0x105834));_0x3eb22a[_0x6570('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index b23ede0..b7ff901 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80aa=['finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','fulfillment','speech','Message','result','metadata','catch','stringify','lodash','moment','apiai-promise','md5','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','error'];(function(_0x5ae93d,_0x48a929){var _0x3bc344=function(_0x37d1e8){while(--_0x37d1e8){_0x5ae93d['push'](_0x5ae93d['shift']());}};_0x3bc344(++_0x48a929);}(_0x80aa,0x97));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa80a('0x0'));var moment=require(_0xa80a('0x1'));var apiai=require(_0xa80a('0x2'));var md5=require(_0xa80a('0x3'));var utils=require(_0xa80a('0x4'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xa80a('0x5')),'openchannelMessage':require(_0xa80a('0x6')),'mailMessage':require(_0xa80a('0x7')),'smsMessage':require(_0xa80a('0x8')),'faxMessage':require('../../rpc/faxMessage')};exports[_0xa80a('0x9')]=function(_0x5627b5,_0x25d2ed){return function(_0x5b6700){try{if(!_[_0xa80a('0xa')](this[_0xa80a('0xb')][_0xa80a('0xc')])){logger[_0xa80a('0xd')](_0xa80a('0xe'),_0x5627b5,_0xa80a('0xf'));return _0x5b6700[_0xa80a('0x10')]();}var _0x22e722={'ContactId':this[_0xa80a('0x11')]['id'],'sentAt':moment()[_0xa80a('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa80a('0x13')};var _0x1b1135=this[_0xa80a('0x14')];if(_0x1b1135===_0xa80a('0x15')){_0x22e722[_0xa80a('0x16')]=this[_0xa80a('0x17')]['id'];}else{_0x22e722[_[_0xa80a('0x18')](_0x1b1135)+_0xa80a('0x19')]=this[_0xa80a('0x17')]['id'];}_0x22e722[_[_0xa80a('0x18')](_0x1b1135)+_0xa80a('0x1a')]=this[_0xa80a('0xb')]['id'];if(this[_0xa80a('0xb')][_0xa80a('0x1b')]){var _0x4082cf=_0x25d2ed[0x2];if(!_[_0xa80a('0x1c')](_0x4082cf)){_0x22e722[_0xa80a('0x1d')]=utils[_0xa80a('0x1e')](_0x4082cf,this);return rpc[_0x1b1135+'Message'][_0xa80a('0x1f')](_0x22e722)['then'](function(_0x5c7e96){logger[_0xa80a('0xd')](_0xa80a('0xe'),_0x5627b5,_0x22e722[_0xa80a('0x1d')]);})['catch'](function(_0x33f773){logger[_0xa80a('0x20')](_0xa80a('0xe'),_0x5627b5,JSON['stringify'](_0x33f773));})[_0xa80a('0x21')](function(){logger['info'](_0xa80a('0x22'),_0x5627b5);_0x5b6700[_0xa80a('0x23')]();});}else{logger['info'](_0xa80a('0x24'),_0x5627b5);_0x5b6700[_0xa80a('0x23')]();}}else{var _0xa31b33=this;var _0x1c0553=apiai(_0x25d2ed[0x0],{'language':_0x25d2ed[0x1]||'en'});return _0x1c0553['textRequest'](this[_0xa80a('0x25')][_0xa80a('0x1d')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x2aaf50){_0xa31b33[_0xa80a('0x1d')][_0xa80a('0x26')]=_0x2aaf50;_0x22e722[_0xa80a('0x1d')]=_0x2aaf50['result'][_0xa80a('0x27')][_0xa80a('0x28')];return rpc[_0x1b1135+_0xa80a('0x29')]['create'](_0x22e722)['then'](function(_0x5d4bd6){logger[_0xa80a('0xd')](_0xa80a('0xe'),_0x5627b5,_0x22e722[_0xa80a('0x1d')]);if(_0x2aaf50[_0xa80a('0x2a')][_0xa80a('0x2b')]['endConversation']){_0x5b6700[_0xa80a('0x10')]();}else{_0x5b6700['stop']();}})[_0xa80a('0x2c')](function(_0x2523bd){logger[_0xa80a('0x20')](_0xa80a('0xe'),_0x5627b5,JSON[_0xa80a('0x2d')](_0x2523bd));_0x5b6700[_0xa80a('0x10')]();});})[_0xa80a('0x2c')](function(_0x3b07de){logger[_0xa80a('0x20')](_0xa80a('0xe'),_0x5627b5,_0x3b07de['message']);_0x5b6700['next']();});}}catch(_0x17e41a){logger['error'](_0xa80a('0xe'),_0x5627b5,JSON['stringify'](_0x17e41a));_0x5b6700[_0xa80a('0x23')]();}};}; \ No newline at end of file +var _0xc8f8=['moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','message','dialogflow','result','speech','endConversation','stop','lodash'];(function(_0x4146e8,_0x28c1a6){var _0x38e4ab=function(_0x3ad47d){while(--_0x3ad47d){_0x4146e8['push'](_0x4146e8['shift']());}};_0x38e4ab(++_0x28c1a6);}(_0xc8f8,0x125));var _0x8c8f=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xc8f8[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x8c8f('0x0'));var moment=require(_0x8c8f('0x1'));var apiai=require('apiai-promise');var md5=require(_0x8c8f('0x2'));var utils=require(_0x8c8f('0x3'));var logger=require(_0x8c8f('0x4'))(_0x8c8f('0x5'));var rpc={'chatMessage':require(_0x8c8f('0x6')),'openchannelMessage':require(_0x8c8f('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};exports[_0x8c8f('0x8')]=function(_0x4ab24f,_0x447a1e){return function(_0x1e9aaa){try{if(!_[_0x8c8f('0x9')](this[_0x8c8f('0xa')][_0x8c8f('0xb')])){logger[_0x8c8f('0xc')](_0x8c8f('0xd'),_0x4ab24f,_0x8c8f('0xe'));return _0x1e9aaa[_0x8c8f('0xf')]();}var _0x15f7b0={'ContactId':this[_0x8c8f('0x10')]['id'],'sentAt':moment()[_0x8c8f('0x11')](_0x8c8f('0x12')),'direction':_0x8c8f('0x13')};var _0x4e3444=this[_0x8c8f('0x14')];if(_0x4e3444==='chat'){_0x15f7b0[_0x8c8f('0x15')]=this[_0x8c8f('0x16')]['id'];}else{_0x15f7b0[_['upperFirst'](_0x4e3444)+'AccountId']=this[_0x8c8f('0x16')]['id'];}_0x15f7b0[_[_0x8c8f('0x17')](_0x4e3444)+_0x8c8f('0x18')]=this[_0x8c8f('0xa')]['id'];if(this[_0x8c8f('0xa')][_0x8c8f('0x19')]){var _0x364cf3=_0x447a1e[0x2];if(!_[_0x8c8f('0x1a')](_0x364cf3)){_0x15f7b0[_0x8c8f('0x1b')]=utils[_0x8c8f('0x1c')](_0x364cf3,this);return rpc[_0x4e3444+_0x8c8f('0x1d')][_0x8c8f('0x1e')](_0x15f7b0)[_0x8c8f('0x1f')](function(_0x6efe50){logger[_0x8c8f('0xc')](_0x8c8f('0xd'),_0x4ab24f,_0x15f7b0['body']);})[_0x8c8f('0x20')](function(_0xb40bcf){logger[_0x8c8f('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x4ab24f,JSON[_0x8c8f('0x22')](_0xb40bcf));})[_0x8c8f('0x23')](function(){logger[_0x8c8f('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4ab24f);_0x1e9aaa['stop']();});}else{logger[_0x8c8f('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4ab24f);_0x1e9aaa['stop']();}}else{var _0x122fae=this;var _0x40fbfc=apiai(_0x447a1e[0x0],{'language':_0x447a1e[0x1]||'en'});return _0x40fbfc['textRequest'](this[_0x8c8f('0x24')][_0x8c8f('0x1b')],{'sessionId':md5(this['interaction']['id'])})[_0x8c8f('0x1f')](function(_0x610efd){_0x122fae[_0x8c8f('0x1b')][_0x8c8f('0x25')]=_0x610efd;_0x15f7b0[_0x8c8f('0x1b')]=_0x610efd[_0x8c8f('0x26')]['fulfillment'][_0x8c8f('0x27')];return rpc[_0x4e3444+_0x8c8f('0x1d')][_0x8c8f('0x1e')](_0x15f7b0)[_0x8c8f('0x1f')](function(_0x5e88e2){logger[_0x8c8f('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x4ab24f,_0x15f7b0['body']);if(_0x610efd[_0x8c8f('0x26')]['metadata'][_0x8c8f('0x28')]){_0x1e9aaa[_0x8c8f('0xf')]();}else{_0x1e9aaa[_0x8c8f('0x29')]();}})[_0x8c8f('0x20')](function(_0x1fffab){logger[_0x8c8f('0x21')](_0x8c8f('0xd'),_0x4ab24f,JSON[_0x8c8f('0x22')](_0x1fffab));_0x1e9aaa[_0x8c8f('0xf')]();});})['catch'](function(_0x11d662){logger[_0x8c8f('0x21')](_0x8c8f('0xd'),_0x4ab24f,_0x11d662[_0x8c8f('0x24')]);_0x1e9aaa[_0x8c8f('0xf')]();});}}catch(_0x251b35){logger[_0x8c8f('0x21')](_0x8c8f('0xd'),_0x4ab24f,JSON[_0x8c8f('0x22')](_0x251b35));_0x1e9aaa['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index fc3b1c4..ad4936c 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2af4=['../../../../config/logger','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils'];(function(_0x50db63,_0x36696a){var _0x1143c4=function(_0x9a4f79){while(--_0x9a4f79){_0x50db63['push'](_0x50db63['shift']());}};_0x1143c4(++_0x36696a);}(_0x2af4,0xd4));var _0x42af=function(_0x15a438,_0x3f2d1e){_0x15a438=_0x15a438-0x0;var _0x55a266=_0x2af4[_0x15a438];return _0x55a266;};'use strict';var schema=require(_0x42af('0x0'));var _=require(_0x42af('0x1'));var htmlToText=require(_0x42af('0x2'));var utils=require(_0x42af('0x3'));var logger=require(_0x42af('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x42af('0x5'),'message':_0x42af('0x6')}});exports[_0x42af('0x7')]=function(_0x9f12ac,_0x3afcf0){return function(_0x5d86f0){try{var _0x12b386={'condition':htmlToText[_0x42af('0x8')](utils[_0x42af('0x9')](_0x3afcf0[0x0],this),{'wordwrap':![]})[_0x42af('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3afcf0[0x1],'priorityFalse':_0x3afcf0[0x2]};var _0x26843d=gotoif['validate'](_0x12b386,{'typecast':!![]});if(_0x26843d[_0x42af('0xb')]){logger[_0x42af('0xc')](_0x42af('0xd'),_0x9f12ac,_[_0x42af('0xe')](_0x26843d,_0x42af('0xf'))[_0x42af('0x10')](',\x20'));_0x5d86f0[_0x42af('0x11')]();}else{try{var _0x3d368a=eval('('+_0x12b386['condition']+')');var _0x336861=_0x3d368a?_0x12b386[_0x42af('0x12')]:_0x12b386[_0x42af('0x13')];logger[_0x42af('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x9f12ac,_0x12b386[_0x42af('0x15')],_0x3d368a,_0x336861||_0x42af('0x16'));if(_0x336861){var _0xeff2e6=_['findIndex'](_0x5d86f0[_0x42af('0x17')](),{'p':_0x336861});if(_0xeff2e6>=0x0){logger[_0x42af('0x14')](_0x42af('0x18'),_0x9f12ac,_0x336861||_0x42af('0x16'),_0xeff2e6);_0x5d86f0[_0x42af('0x16')](_0xeff2e6);}else{logger[_0x42af('0x14')](_0x42af('0x19'),_0x9f12ac,_0x336861||_0x42af('0x16'));_0x5d86f0[_0x42af('0x11')]();}}else{_0x5d86f0['next']();}}catch(_0x3d1d5b){logger['error'](_0x42af('0x1a'),_0x9f12ac,_0x3d1d5b[_0x42af('0xf')]);_0x5d86f0[_0x42af('0x11')]();}}}catch(_0x25f407){logger['error'](_0x42af('0xd'),_0x9f12ac,JSON['stringify'](_0x25f407));_0x5d86f0[_0x42af('0x11')]();}};}; \ No newline at end of file +var _0x5c38=['stringify','validate','lodash','html-to-text','./utils','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x5a001d,_0x591f45){var _0x3d0a81=function(_0x13ad2a){while(--_0x13ad2a){_0x5a001d['push'](_0x5a001d['shift']());}};_0x3d0a81(++_0x591f45);}(_0x5c38,0x1cc));var _0x85c3=function(_0x55d1b3,_0x3da77e){_0x55d1b3=_0x55d1b3-0x0;var _0x2dd33a=_0x5c38[_0x55d1b3];return _0x2dd33a;};'use strict';var schema=require(_0x85c3('0x0'));var _=require(_0x85c3('0x1'));var htmlToText=require(_0x85c3('0x2'));var utils=require(_0x85c3('0x3'));var logger=require('../../../../config/logger')(_0x85c3('0x4'));var gotoif=schema({'condition':{'type':_0x85c3('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x85c3('0x6')},'priorityFalse':{'type':_0x85c3('0x7'),'message':_0x85c3('0x8')}});exports[_0x85c3('0x9')]=function(_0x587be5,_0x5a6506){return function(_0x3c359e){try{var _0x5ea8e8={'condition':htmlToText[_0x85c3('0xa')](utils[_0x85c3('0xb')](_0x5a6506[0x0],this),{'wordwrap':![]})[_0x85c3('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5a6506[0x1],'priorityFalse':_0x5a6506[0x2]};var _0x4b577b=gotoif['validate'](_0x5ea8e8,{'typecast':!![]});if(_0x4b577b[_0x85c3('0xd')]){logger[_0x85c3('0xe')](_0x85c3('0xf'),_0x587be5,_[_0x85c3('0x10')](_0x4b577b,_0x85c3('0x11'))[_0x85c3('0x12')](',\x20'));_0x3c359e[_0x85c3('0x13')]();}else{try{var _0x3c0328=eval('('+_0x5ea8e8['condition']+')');var _0x2dd74b=_0x3c0328?_0x5ea8e8[_0x85c3('0x14')]:_0x5ea8e8['priorityFalse'];logger[_0x85c3('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x587be5,_0x5ea8e8['condition'],_0x3c0328,_0x2dd74b||_0x85c3('0x16'));if(_0x2dd74b){var _0x3ee042=_['findIndex'](_0x3c359e[_0x85c3('0x17')](),{'p':_0x2dd74b});if(_0x3ee042>=0x0){logger[_0x85c3('0x15')](_0x85c3('0x18'),_0x587be5,_0x2dd74b||_0x85c3('0x16'),_0x3ee042);_0x3c359e[_0x85c3('0x16')](_0x3ee042);}else{logger[_0x85c3('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x587be5,_0x2dd74b||_0x85c3('0x16'));_0x3c359e[_0x85c3('0x13')]();}}else{_0x3c359e['next']();}}catch(_0x46a595){logger['error'](_0x85c3('0x19'),_0x587be5,_0x46a595[_0x85c3('0x11')]);_0x3c359e[_0x85c3('0x13')]();}}}catch(_0x242d3b){logger['error']('[%s][GOTOIF]\x20%s',_0x587be5,JSON[_0x85c3('0x1a')](_0x242d3b));_0x3c359e['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 507b736..2075d67 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 _0x012a=['[%s][GOTOP]\x20%s','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length'];(function(_0x2224ca,_0x512720){var _0x366932=function(_0x1b4560){while(--_0x1b4560){_0x2224ca['push'](_0x2224ca['shift']());}};_0x366932(++_0x512720);}(_0x012a,0x89));var _0xa012=function(_0x527d09,_0x378a3a){_0x527d09=_0x527d09-0x0;var _0x53a69f=_0x012a[_0x527d09];return _0x53a69f;};'use strict';var schema=require('validate');var _=require(_0xa012('0x0'));var logger=require(_0xa012('0x1'))(_0xa012('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xa012('0x3')}});exports[_0xa012('0x4')]=function(_0x34da3c,_0x45320c){return function(_0x534875){try{var _0x29c8f1={'priority':_0x45320c[0x0]};var _0x5603b4=gotop[_0xa012('0x5')](_0x29c8f1,{'typecast':!![]});if(_0x5603b4[_0xa012('0x6')]){logger['error'](_0xa012('0x7'),_0x34da3c,_['map'](_0x5603b4,_0xa012('0x8'))[_0xa012('0x9')](',\x20'));_0x534875[_0xa012('0xa')]();}else{logger[_0xa012('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x34da3c,_0x29c8f1[_0xa012('0xc')]);if(_0x29c8f1[_0xa012('0xc')]){var _0x4c1599=_[_0xa012('0xd')](_0x534875[_0xa012('0xe')](),{'p':_0x29c8f1[_0xa012('0xc')]});if(_0x4c1599>=0x0){logger[_0xa012('0xb')](_0xa012('0xf'),_0x34da3c,_0x29c8f1['priority']||_0xa012('0x10'),_0x4c1599);_0x534875[_0xa012('0x10')](_0x4c1599);}else{logger[_0xa012('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x34da3c,_0x29c8f1['priority']||'next');_0x534875['stop']();}}else{_0x534875['next']();}}}catch(_0x1f7301){logger[_0xa012('0x11')](_0xa012('0x7'),_0x34da3c,JSON['stringify'](_0x1f7301));_0x534875['stop']();}};}; \ No newline at end of file +var _0xc19b=['stop','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','routing','number','consequence','length','error','map','message','join'];(function(_0x3d46e5,_0x565392){var _0x5b9e42=function(_0x1ea63e){while(--_0x1ea63e){_0x3d46e5['push'](_0x3d46e5['shift']());}};_0x5b9e42(++_0x565392);}(_0xc19b,0x75));var _0xbc19=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc19b[_0x46aff0];return _0x9d78cf;};'use strict';var schema=require(_0xbc19('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xbc19('0x1'));var gotop=schema({'priority':{'type':_0xbc19('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xbc19('0x3')]=function(_0x22b807,_0x202391){return function(_0x5eb41b){try{var _0x5f5601={'priority':_0x202391[0x0]};var _0x2f1433=gotop['validate'](_0x5f5601,{'typecast':!![]});if(_0x2f1433[_0xbc19('0x4')]){logger[_0xbc19('0x5')]('[%s][GOTOP]\x20%s',_0x22b807,_[_0xbc19('0x6')](_0x2f1433,_0xbc19('0x7'))[_0xbc19('0x8')](',\x20'));_0x5eb41b[_0xbc19('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x22b807,_0x5f5601[_0xbc19('0xa')]);if(_0x5f5601[_0xbc19('0xa')]){var _0xca06b9=_[_0xbc19('0xb')](_0x5eb41b['rules'](),{'p':_0x5f5601[_0xbc19('0xa')]});if(_0xca06b9>=0x0){logger[_0xbc19('0xc')](_0xbc19('0xd'),_0x22b807,_0x5f5601[_0xbc19('0xa')]||_0xbc19('0xe'),_0xca06b9);_0x5eb41b[_0xbc19('0xe')](_0xca06b9);}else{logger[_0xbc19('0xc')](_0xbc19('0xf'),_0x22b807,_0x5f5601['priority']||_0xbc19('0xe'));_0x5eb41b[_0xbc19('0x9')]();}}else{_0x5eb41b[_0xbc19('0xe')]();}}}catch(_0x564104){logger[_0xbc19('0x5')](_0xbc19('0x10'),_0x22b807,JSON[_0xbc19('0x11')](_0x564104));_0x5eb41b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 0a8ec8f..c8b28be 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 _0x7851=['channel','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x7851,0x1f0));var _0x1785=function(_0x3e68b9,_0x29d245){_0x3e68b9=_0x3e68b9-0x0;var _0x5d969d=_0x7851[_0x3e68b9];return _0x5d969d;};'use strict';var _=require(_0x1785('0x0'));var utils=require('./utils');var logger=require(_0x1785('0x1'))('routing');var rpc={'chatMessage':require(_0x1785('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1785('0x3')),'smsMessage':require(_0x1785('0x4')),'faxMessage':require(_0x1785('0x5'))};exports[_0x1785('0x6')]=function(_0x14ca86,_0x20d8f5){return function(_0x980698){try{var _0x5aea00={'body':utils[_0x1785('0x7')](_0x20d8f5[0x0],this),'ContactId':this['contact']['id']};if(this[_0x1785('0x8')]===_0x1785('0x9')){_0x5aea00[_0x1785('0xa')]=this['account']['id'];}else{_0x5aea00[_['upperFirst'](this[_0x1785('0x8')])+_0x1785('0xb')]=this[_0x1785('0xc')]['id'];}_0x5aea00[_[_0x1785('0xd')](this[_0x1785('0x8')])+_0x1785('0xe')]=this[_0x1785('0xf')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x1785('0x8')]+_0x1785('0x10')][_0x1785('0x11')](_0x5aea00)['then'](function(_0x1ad02e){logger['info'](_0x1785('0x12'),_0x14ca86,_0x5aea00[_0x1785('0x13')]);_0x980698[_0x1785('0x14')]();})[_0x1785('0x15')](function(_0x2c2f52){logger['error'](_0x1785('0x12'),_0x14ca86,JSON[_0x1785('0x16')](_0x2c2f52));_0x980698[_0x1785('0x17')]();});}}catch(_0x7881e){logger['error'](_0x1785('0x12'),_0x14ca86,JSON[_0x1785('0x16')](_0x7881e));_0x980698[_0x1785('0x17')]();}};}; \ No newline at end of file +var _0xd423=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','AccountId','account','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils'];(function(_0x4855dd,_0x53e55e){var _0x59604a=function(_0x30bad7){while(--_0x30bad7){_0x4855dd['push'](_0x4855dd['shift']());}};_0x59604a(++_0x53e55e);}(_0xd423,0xe9));var _0x3d42=function(_0x126a52,_0x260dd4){_0x126a52=_0x126a52-0x0;var _0x3ae233=_0xd423[_0x126a52];return _0x3ae233;};'use strict';var _=require('lodash');var utils=require(_0x3d42('0x0'));var logger=require(_0x3d42('0x1'))(_0x3d42('0x2'));var rpc={'chatMessage':require(_0x3d42('0x3')),'openchannelMessage':require(_0x3d42('0x4')),'mailMessage':require(_0x3d42('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3d42('0x6'))};exports[_0x3d42('0x7')]=function(_0xe65cc5,_0x22f36a){return function(_0x23b968){try{var _0x42da89={'body':utils[_0x3d42('0x8')](_0x22f36a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x3d42('0x9')]===_0x3d42('0xa')){_0x42da89[_0x3d42('0xb')]=this['account']['id'];}else{_0x42da89[_['upperFirst'](this['channel'])+_0x3d42('0xc')]=this[_0x3d42('0xd')]['id'];}_0x42da89[_['upperFirst'](this['channel'])+_0x3d42('0xe')]=this[_0x3d42('0xf')]['id'];if(rpc[this[_0x3d42('0x9')]+_0x3d42('0x10')]){return rpc[this[_0x3d42('0x9')]+_0x3d42('0x10')]['create'](_0x42da89)[_0x3d42('0x11')](function(_0x5708a2){logger[_0x3d42('0x12')](_0x3d42('0x13'),_0xe65cc5,_0x42da89[_0x3d42('0x14')]);_0x23b968[_0x3d42('0x15')]();})[_0x3d42('0x16')](function(_0x300e84){logger[_0x3d42('0x17')](_0x3d42('0x13'),_0xe65cc5,JSON[_0x3d42('0x18')](_0x300e84));_0x23b968[_0x3d42('0x19')]();});}}catch(_0x74767d){logger[_0x3d42('0x17')]('[%s][MESSAGE]\x20%s',_0xe65cc5,JSON[_0x3d42('0x18')](_0x74767d));_0x23b968['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b34ff7e..bd31a45 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 _0x3659=['consequence','next','error','stringify','./utils','../../../../config/logger','routing'];(function(_0x40183f,_0x344487){var _0x503921=function(_0x36594d){while(--_0x36594d){_0x40183f['push'](_0x40183f['shift']());}};_0x503921(++_0x344487);}(_0x3659,0x97));var _0x9365=function(_0x475aa9,_0x439aab){_0x475aa9=_0x475aa9-0x0;var _0x360bbc=_0x3659[_0x475aa9];return _0x360bbc;};'use strict';var utils=require(_0x9365('0x0'));var logger=require(_0x9365('0x1'))(_0x9365('0x2'));exports[_0x9365('0x3')]=function(_0x51718d,_0x66c5bc){return function(_0x36ebd0){try{logger['info']('[%s][NOOP]\x20%s',_0x51718d,utils['getMustacheRender'](_0x66c5bc[0x0],this));_0x36ebd0[_0x9365('0x4')]();}catch(_0x17cd67){logger[_0x9365('0x5')]('[%s][NOOP]\x20%s',_0x51718d,JSON[_0x9365('0x6')](_0x17cd67));_0x36ebd0['stop']();}};}; \ No newline at end of file +var _0x1d28=['next','stringify','./utils','routing','consequence','info','getMustacheRender'];(function(_0x596a5b,_0x51af41){var _0x1b7e71=function(_0x37cb7d){while(--_0x37cb7d){_0x596a5b['push'](_0x596a5b['shift']());}};_0x1b7e71(++_0x51af41);}(_0x1d28,0x16e));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x81d2('0x0'));var logger=require('../../../../config/logger')(_0x81d2('0x1'));exports[_0x81d2('0x2')]=function(_0x375b30,_0x3c7558){return function(_0xc0eb10){try{logger[_0x81d2('0x3')]('[%s][NOOP]\x20%s',_0x375b30,utils[_0x81d2('0x4')](_0x3c7558[0x0],this));_0xc0eb10[_0x81d2('0x5')]();}catch(_0x1141e5){logger['error']('[%s][NOOP]\x20%s',_0x375b30,JSON[_0x81d2('0x6')](_0x1141e5));_0xc0eb10['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index fa3a64b..486227f 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 _0x3913=['%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','InteractionId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','timeout','update\x20queue\x20report','validate','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0x3913,0x106));var _0x3391=function(_0x527fac,_0x17253b){_0x527fac=_0x527fac-0x0;var _0x5c4318=_0x3913[_0x527fac];return _0x5c4318;};'use strict';var schema=require('validate');var _=require(_0x3391('0x0'));var util=require(_0x3391('0x1'));var seqqueue=require(_0x3391('0x2'));var moment=require('moment');var Redis=require(_0x3391('0x3'));var config=require(_0x3391('0x4'));var logger=require(_0x3391('0x5'))(_0x3391('0x6'));var strategy=require(_0x3391('0x7'));config[_0x3391('0x8')]=_[_0x3391('0x9')](config[_0x3391('0x8')],{'host':_0x3391('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3391('0x8')]));var attributes=['id',_0x3391('0xb'),_0x3391('0xc'),_0x3391('0xd'),'from','joinAt'];function emit(_0x49958e,_0x2ba8ab,_0x4df1d5){io['to'](_0x49958e)['emit'](_0x2ba8ab,_0x4df1d5);}function emitChannelQueueInteraction(_0x1b81ec,_0x368f3f,_0x4aa1ca,_0x4c4c23,_0x2e01ec,_0x175662,_0x2d6140,_0x68db1e){_0x4aa1ca[_0x3391('0xb')]=_0x68db1e;_0x4aa1ca['queue']=_0x368f3f;_0x4aa1ca[_0x3391('0xc')]=_0x4c4c23;_0x4aa1ca['id']=_0x2e01ec;if(_0x175662){_0x2d6140[util[_0x3391('0xe')](_0x3391('0xf'),_0x1b81ec)][_0x2e01ec]=_[_0x3391('0x10')](_0x4aa1ca,attributes);}else{delete _0x2d6140[util[_0x3391('0xe')](_0x3391('0xf'),_0x1b81ec)][_0x2e01ec];}emit(util['format'](_0x3391('0x11'),_0x1b81ec,_0x368f3f),util[_0x3391('0xe')](_0x3391('0x12'),_0x1b81ec,_0x175662?_0x3391('0x13'):'remove'),_[_0x3391('0x10')](_0x4aa1ca,attributes));}var rpc={'openchannelQueueReport':require(_0x3391('0x14')),'mailQueueReport':require(_0x3391('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x3391('0x16')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x3391('0x17')},'timeout':{'type':_0x3391('0x18'),'message':_0x3391('0x19')}});function startRouting(_0x3875bb,_0x30ed1c,_0x144c96,_0x4bc523){if(_0x3875bb&&_0x30ed1c&&_0x144c96){_0x30ed1c[_0x3391('0x1a')]+=0x1;var _0x31d79c={'uniqueid':_0x3875bb,'from':_0x144c96['body']?_0x144c96[_0x3391('0x1b')]['from']:'','joinAt':moment()[_0x3391('0xe')](_0x3391('0x1c')),'ContactId':_0x144c96[_0x3391('0x1d')]?_0x144c96[_0x3391('0x1d')]['id']:null,'ListId':_0x144c96[_0x3391('0x1e')]?_0x144c96['list']['id']:null};_0x31d79c[_['upperFirst'](_0x144c96[_0x3391('0x1f')])+'QueueId']=_0x30ed1c['id']||null;_0x31d79c[_['upperFirst'](_0x144c96[_0x3391('0x1f')])+_0x3391('0x20')]=_0x144c96[_0x3391('0x21')]?_0x144c96[_0x3391('0x21')]['id']:null;_0x31d79c[_[_0x3391('0x22')](_0x144c96[_0x3391('0x1f')])+_0x3391('0x23')]=_0x144c96[_0x3391('0x24')]?_0x144c96[_0x3391('0x24')]['id']:null;_0x31d79c[_[_0x3391('0x22')](_0x144c96[_0x3391('0x1f')])+(_0x144c96[_0x3391('0x1f')]!==_0x3391('0x25')?_0x3391('0x26'):_0x3391('0x27'))]=_0x144c96[_0x3391('0xc')]?_0x144c96['account']['id']:null;logger[_0x3391('0x28')](util[_0x3391('0xe')]('[%s][START:QUEUE][NAME:%s]',_0x3875bb,_0x30ed1c[_0x3391('0x29')]));emitChannelQueueInteraction(_0x144c96[_0x3391('0x1f')],_0x30ed1c[_0x3391('0x29')],_0x31d79c,_0x144c96['account'][_0x3391('0x29')],_0x144c96[_0x3391('0x24')]['id'],!![],_0x4bc523,_0x30ed1c['id']);if(rpc[_0x144c96['channel']+'QueueReport']){return rpc[_0x144c96['channel']+_0x3391('0x2a')]['create'](_0x31d79c)['catch'](function(_0x76a38d){logger[_0x3391('0x2b')](_0x3391('0x2c'));});}}}function stopRouting(_0x49f0f6,_0x1a9e26,_0x14c249,_0x58d4b8){if(_0x49f0f6&&_0x1a9e26){_0x1a9e26['waiting']-=0x1;var _0x277117={'leaveAt':moment()[_0x3391('0xe')](_0x3391('0x1c')),'acceptAt':moment()[_0x3391('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x3391('0x2d')};logger[_0x3391('0x28')](util[_0x3391('0xe')](_0x3391('0x2e'),_0x49f0f6,_0x1a9e26[_0x3391('0x29')]));emitChannelQueueInteraction(_0x14c249[_0x3391('0x1f')],_0x1a9e26[_0x3391('0x29')],_0x14c249['body'],_0x14c249['account'][_0x3391('0x29')],_0x14c249[_0x3391('0x24')]['id'],![],_0x58d4b8,_0x1a9e26['id']);if(rpc[_0x14c249[_0x3391('0x1f')]+_0x3391('0x2a')]){return rpc[_0x14c249[_0x3391('0x1f')]+_0x3391('0x2a')][_0x3391('0x2f')](_0x49f0f6,_0x277117)[_0x3391('0x30')](function(_0x20e1f9){logger[_0x3391('0x2b')]('update\x20queue\x20report');});}}}function endRouting(_0x375454,_0x156987,_0x293d3a,_0x3f7913){if(_0x375454&&_0x156987){_0x156987[_0x3391('0x1a')]-=0x1;var _0x211c9f={'leaveAt':moment()[_0x3391('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x3391('0xe')](_0x3391('0x1c')),'reason':_0x3391('0x31')};logger[_0x3391('0x28')](util[_0x3391('0xe')]('[%s][END:QUEUE][NAME:%s]',_0x375454,_0x156987[_0x3391('0x29')]));emitChannelQueueInteraction(_0x293d3a[_0x3391('0x1f')],_0x156987[_0x3391('0x29')],_0x293d3a[_0x3391('0x1b')],_0x293d3a[_0x3391('0xc')]['name'],_0x293d3a['message']['id'],![],_0x3f7913);if(rpc[_0x293d3a[_0x3391('0x1f')]+'QueueReport']){return rpc[_0x293d3a['channel']+_0x3391('0x2a')][_0x3391('0x2f')](_0x375454,_0x211c9f)['catch'](function(_0x2c6f0b){logger['error'](_0x3391('0x32'));});}}}function handleFindQueue(_0x45f624){return function(_0x5951b1){return _0x5951b1[_0x3391('0x29')]['toLowerCase']()===_0x45f624['toLowerCase']();};}exports['consequence']=function(_0x52db59,_0x15f488,_0x574255,_0x3fd3e7){return function(_0x23ab7b){try{var _0x94d991={'name':_0x15f488[0x0],'timeout':_0x15f488[0x1]};var _0x120c95=queue[_0x3391('0x33')](_0x94d991,{'typecast':!![]});if(_0x120c95['length']){logger[_0x3391('0x2b')](_0x3391('0x34'),_0x52db59,_[_0x3391('0x35')](_0x120c95,_0x3391('0x24'))[_0x3391('0x36')](',\x20'));_0x23ab7b[_0x3391('0x37')]();}else{var _0x26121c=_[_0x3391('0x38')](_0x574255[_0x3fd3e7[_0x3391('0x1f')]+_0x3391('0x39')],handleFindQueue(_0x94d991[_0x3391('0x29')]));if(_0x26121c){startRouting(_0x52db59,_0x26121c,_0x3fd3e7,_0x574255);var _0x46b1c2=(_0x26121c[_0x3391('0x31')]||0xa)*0x3e8;var _0x72e3b6=(_0x94d991[_0x3391('0x31')]||0x14)*0x3e8;var _0x56463d,_0x55f569;if(_0x46b1c2>_0x72e3b6){_0x72e3b6=_0x46b1c2;}var _0x35f2f7=seqqueue[_0x3391('0x3a')](_0x46b1c2);_0x35f2f7['id']=_0x52db59;_0x35f2f7[_0x3391('0x3b')]=_0x46b1c2;_0x35f2f7[_0x3391('0x3c')]=_0x72e3b6;_0x35f2f7[_0x3391('0x1f')]=_0x3fd3e7[_0x3391('0x1f')];_0x574255[_0x3391('0x3d')][_0x52db59]['on'](_0x3391('0x3e'),function(){stopRouting(_0x52db59,_0x26121c,_0x3fd3e7,_0x574255);_0x35f2f7['close'](!![]);clearTimeout(_0x56463d);_0x56463d=undefined;if(_0x574255[_0x3391('0x3d')][_0x52db59]){delete _0x574255[_0x3391('0x3d')][_0x52db59];}logger[_0x3391('0x28')](_0x3391('0x3f'),_0x52db59);_0x23ab7b[_0x3391('0x37')]();});_0x56463d=setTimeout(function(){endRouting(_0x52db59,_0x26121c,_0x3fd3e7,_0x574255);clearTimeout(_0x56463d);_0x35f2f7[_0x3391('0x40')](!![]);logger[_0x3391('0x28')](_0x3391('0x41'),_0x52db59);_0x23ab7b[_0x3391('0x42')]();},_0x72e3b6);switch(_0x26121c[_0x3391('0x43')]){case _0x3391('0x44'):strategy[_0x3391('0x44')](_0x35f2f7,_0x26121c,_0x574255,_0x3fd3e7);break;default:strategy['beepall'](_0x35f2f7,_0x26121c,_0x574255,_0x3fd3e7);}}else{logger['error'](_0x3391('0x45'),_0x52db59,_0x94d991['name']);_0x23ab7b['stop']();}}}catch(_0x47030f){console['log'](_0x47030f);logger[_0x3391('0x2b')]('[%s][QUEUE]\x20%s',_0x52db59,_0x47030f['stack']);_0x23ab7b['stop']();}};}; \ No newline at end of file +var _0xd22e=['upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','atimeout','qtimeout','rules','end','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','emit','account','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xd22e,0xbe));var _0xed22=function(_0x2969cb,_0x33be03){_0x2969cb=_0x2969cb-0x0;var _0x1ba64e=_0xd22e[_0x2969cb];return _0x1ba64e;};'use strict';var schema=require(_0xed22('0x0'));var _=require('lodash');var util=require(_0xed22('0x1'));var seqqueue=require(_0xed22('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xed22('0x3'));var logger=require(_0xed22('0x4'))(_0xed22('0x5'));var strategy=require(_0xed22('0x6'));config[_0xed22('0x7')]=_[_0xed22('0x8')](config[_0xed22('0x7')],{'host':_0xed22('0x9'),'port':0x18eb});var io=require(_0xed22('0xa'))(new Redis(config[_0xed22('0x7')]));var attributes=['id',_0xed22('0xb'),'account',_0xed22('0xc'),'from','joinAt'];function emit(_0x379d9d,_0x2171ad,_0x28047a){io['to'](_0x379d9d)[_0xed22('0xd')](_0x2171ad,_0x28047a);}function emitChannelQueueInteraction(_0x4f3e5a,_0x2b7a39,_0xc2faaf,_0x373231,_0x11ee70,_0x545aa2,_0xbbe8bf,_0x2d8700){_0xc2faaf[_0xed22('0xb')]=_0x2d8700;_0xc2faaf[_0xed22('0xc')]=_0x2b7a39;_0xc2faaf[_0xed22('0xe')]=_0x373231;_0xc2faaf['id']=_0x11ee70;if(_0x545aa2){_0xbbe8bf[util[_0xed22('0xf')]('%sQueuesWaitingInteractions',_0x4f3e5a)][_0x11ee70]=_['pick'](_0xc2faaf,attributes);}else{delete _0xbbe8bf[util[_0xed22('0xf')](_0xed22('0x10'),_0x4f3e5a)][_0x11ee70];}emit(util[_0xed22('0xf')](_0xed22('0x11'),_0x4f3e5a,_0x2b7a39),util[_0xed22('0xf')](_0xed22('0x12'),_0x4f3e5a,_0x545aa2?_0xed22('0x13'):_0xed22('0x14')),_['pick'](_0xc2faaf,attributes));}var rpc={'openchannelQueueReport':require(_0xed22('0x15')),'mailQueueReport':require(_0xed22('0x16')),'chatQueueReport':require(_0xed22('0x17')),'smsQueueReport':require(_0xed22('0x18')),'faxQueueReport':require(_0xed22('0x19'))};var queue=schema({'name':{'type':_0xed22('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xed22('0x1b'),'message':_0xed22('0x1c')}});function startRouting(_0x2ea77e,_0x597775,_0x5815fa,_0x52c53c){if(_0x2ea77e&&_0x597775&&_0x5815fa){_0x597775[_0xed22('0x1d')]+=0x1;var _0x28b1a5={'uniqueid':_0x2ea77e,'from':_0x5815fa['body']?_0x5815fa[_0xed22('0x1e')][_0xed22('0x1f')]:'','joinAt':moment()['format'](_0xed22('0x20')),'ContactId':_0x5815fa[_0xed22('0x21')]?_0x5815fa[_0xed22('0x21')]['id']:null,'ListId':_0x5815fa['list']?_0x5815fa[_0xed22('0x22')]['id']:null};_0x28b1a5[_[_0xed22('0x23')](_0x5815fa[_0xed22('0x24')])+_0xed22('0x25')]=_0x597775['id']||null;_0x28b1a5[_[_0xed22('0x23')](_0x5815fa[_0xed22('0x24')])+_0xed22('0x26')]=_0x5815fa[_0xed22('0x27')]?_0x5815fa[_0xed22('0x27')]['id']:null;_0x28b1a5[_[_0xed22('0x23')](_0x5815fa[_0xed22('0x24')])+_0xed22('0x28')]=_0x5815fa[_0xed22('0x29')]?_0x5815fa[_0xed22('0x29')]['id']:null;_0x28b1a5[_[_0xed22('0x23')](_0x5815fa[_0xed22('0x24')])+(_0x5815fa[_0xed22('0x24')]!==_0xed22('0x2a')?_0xed22('0x2b'):'WebsiteId')]=_0x5815fa['account']?_0x5815fa[_0xed22('0xe')]['id']:null;logger[_0xed22('0x2c')](util[_0xed22('0xf')](_0xed22('0x2d'),_0x2ea77e,_0x597775['name']));emitChannelQueueInteraction(_0x5815fa[_0xed22('0x24')],_0x597775[_0xed22('0x2e')],_0x28b1a5,_0x5815fa[_0xed22('0xe')][_0xed22('0x2e')],_0x5815fa['message']['id'],!![],_0x52c53c,_0x597775['id']);if(rpc[_0x5815fa['channel']+_0xed22('0x2f')]){return rpc[_0x5815fa['channel']+_0xed22('0x2f')][_0xed22('0x30')](_0x28b1a5)[_0xed22('0x31')](function(_0x3e00db){logger[_0xed22('0x32')](_0xed22('0x33'));});}}}function stopRouting(_0x3c29a2,_0x266439,_0x505802,_0x321f3b){if(_0x3c29a2&&_0x266439){_0x266439[_0xed22('0x1d')]-=0x1;var _0x124325={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xed22('0xf')](_0xed22('0x20')),'reason':_0xed22('0x34')};logger['info'](util[_0xed22('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x3c29a2,_0x266439[_0xed22('0x2e')]));emitChannelQueueInteraction(_0x505802[_0xed22('0x24')],_0x266439[_0xed22('0x2e')],_0x505802['body'],_0x505802[_0xed22('0xe')][_0xed22('0x2e')],_0x505802[_0xed22('0x29')]['id'],![],_0x321f3b,_0x266439['id']);if(rpc[_0x505802[_0xed22('0x24')]+'QueueReport']){return rpc[_0x505802[_0xed22('0x24')]+'QueueReport']['update'](_0x3c29a2,_0x124325)[_0xed22('0x31')](function(_0x5813c0){logger[_0xed22('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x18a40d,_0x73136d,_0x27e136,_0x353615){if(_0x18a40d&&_0x73136d){_0x73136d['waiting']-=0x1;var _0x2ee080={'leaveAt':moment()['format'](_0xed22('0x20')),'exitAt':moment()[_0xed22('0xf')](_0xed22('0x20')),'reason':'timeout'};logger[_0xed22('0x2c')](util[_0xed22('0xf')]('[%s][END:QUEUE][NAME:%s]',_0x18a40d,_0x73136d[_0xed22('0x2e')]));emitChannelQueueInteraction(_0x27e136['channel'],_0x73136d['name'],_0x27e136['body'],_0x27e136[_0xed22('0xe')][_0xed22('0x2e')],_0x27e136[_0xed22('0x29')]['id'],![],_0x353615);if(rpc[_0x27e136[_0xed22('0x24')]+'QueueReport']){return rpc[_0x27e136[_0xed22('0x24')]+'QueueReport'][_0xed22('0x35')](_0x18a40d,_0x2ee080)[_0xed22('0x31')](function(_0x395a96){logger['error'](_0xed22('0x36'));});}}}function handleFindQueue(_0x2b0608){return function(_0x3858f8){return _0x3858f8['name'][_0xed22('0x37')]()===_0x2b0608[_0xed22('0x37')]();};}exports[_0xed22('0x38')]=function(_0x2c34b8,_0x58638e,_0x5a08f4,_0x3aaf85){return function(_0x292008){try{var _0x5c5b1b={'name':_0x58638e[0x0],'timeout':_0x58638e[0x1]};var _0x39d6e5=queue[_0xed22('0x0')](_0x5c5b1b,{'typecast':!![]});if(_0x39d6e5['length']){logger[_0xed22('0x32')](_0xed22('0x39'),_0x2c34b8,_[_0xed22('0x3a')](_0x39d6e5,_0xed22('0x29'))[_0xed22('0x3b')](',\x20'));_0x292008[_0xed22('0x3c')]();}else{var _0x52e352=_[_0xed22('0x3d')](_0x5a08f4[_0x3aaf85[_0xed22('0x24')]+_0xed22('0x3e')],handleFindQueue(_0x5c5b1b[_0xed22('0x2e')]));if(_0x52e352){startRouting(_0x2c34b8,_0x52e352,_0x3aaf85,_0x5a08f4);var _0x2493ce=(_0x52e352[_0xed22('0x3f')]||0xa)*0x3e8;var _0x25f343=(_0x5c5b1b[_0xed22('0x3f')]||0x14)*0x3e8;var _0x3cde6d,_0x85ca13;if(_0x2493ce>_0x25f343){_0x25f343=_0x2493ce;}var _0x1b9ed7=seqqueue['createQueue'](_0x2493ce);_0x1b9ed7['id']=_0x2c34b8;_0x1b9ed7[_0xed22('0x40')]=_0x2493ce;_0x1b9ed7[_0xed22('0x41')]=_0x25f343;_0x1b9ed7[_0xed22('0x24')]=_0x3aaf85[_0xed22('0x24')];_0x5a08f4[_0xed22('0x42')][_0x2c34b8]['on'](_0xed22('0x43'),function(){stopRouting(_0x2c34b8,_0x52e352,_0x3aaf85,_0x5a08f4);_0x1b9ed7[_0xed22('0x44')](!![]);clearTimeout(_0x3cde6d);_0x3cde6d=undefined;if(_0x5a08f4['rules'][_0x2c34b8]){delete _0x5a08f4[_0xed22('0x42')][_0x2c34b8];}logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2c34b8);_0x292008[_0xed22('0x3c')]();});_0x3cde6d=setTimeout(function(){endRouting(_0x2c34b8,_0x52e352,_0x3aaf85,_0x5a08f4);clearTimeout(_0x3cde6d);_0x1b9ed7[_0xed22('0x44')](!![]);logger[_0xed22('0x2c')]('[%s][QUEUE]\x20ROUTING\x20END',_0x2c34b8);_0x292008[_0xed22('0x45')]();},_0x25f343);switch(_0x52e352[_0xed22('0x46')]){case _0xed22('0x47'):strategy[_0xed22('0x47')](_0x1b9ed7,_0x52e352,_0x5a08f4,_0x3aaf85);break;default:strategy[_0xed22('0x48')](_0x1b9ed7,_0x52e352,_0x5a08f4,_0x3aaf85);}}else{logger[_0xed22('0x32')](_0xed22('0x49'),_0x2c34b8,_0x5c5b1b[_0xed22('0x2e')]);_0x292008[_0xed22('0x3c')]();}}}catch(_0x3baa01){console[_0xed22('0x4a')](_0x3baa01);logger[_0xed22('0x32')]('[%s][QUEUE]\x20%s',_0x2c34b8,_0x3baa01['stack']);_0x292008[_0xed22('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 2483388..7a89eb1 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 _0xe58a=['hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','forcedOwnership','channel','busyQueue','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x2df47d,_0xbf3107){var _0x3caeda=function(_0x4067b6){while(--_0x4067b6){_0x2df47d['push'](_0x2df47d['shift']());}};_0x3caeda(++_0xbf3107);}(_0xe58a,0x9f));var _0xae58=function(_0x3c0646,_0x12a1c2){_0x3c0646=_0x3c0646-0x0;var _0x1cc334=_0xe58a[_0x3c0646];return _0x1cc334;};'use strict';var _=require(_0xae58('0x0'));var uuid=require(_0xae58('0x1'));var util=require(_0xae58('0x2'));var logger=require('../../../../../config/logger')(_0xae58('0x3'));var Agent=function(_0x508cff,_0x5e74b5,_0x32a020,_0x4a8df4){this['notificationId']=uuid['v4']();this[_0xae58('0x4')]=_0x508cff;this['agent']=_0x5e74b5;this[_0xae58('0x5')]=_0x32a020;this[_0xae58('0x3')]=_0x4a8df4;this[_0xae58('0x4')][_0xae58('0x6')](this[_0xae58('0x7')][_0xae58('0x8')](this),this[_0xae58('0x9')][_0xae58('0x8')](this));this[_0xae58('0x4')]['on'](_0xae58('0xa'),this['handleTimeout'][_0xae58('0x8')](this));this[_0xae58('0x4')]['on'](_0xae58('0xb'),this[_0xae58('0xc')][_0xae58('0x8')](this));};Agent['prototype'][_0xae58('0x6')]=function(){this[_0xae58('0x4')]['push'](this[_0xae58('0x7')]['bind'](this),this[_0xae58('0x9')][_0xae58('0x8')](this));};Agent[_0xae58('0xd')][_0xae58('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xae58('0xd')]['handleRun']=function(_0x54f59c){logger[_0xae58('0xe')](_0xae58('0xf'),this[_0xae58('0x4')]['id'],this[_0xae58('0x10')]['id']);if(_['isNil'](this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']])){logger[_0xae58('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xae58('0x10')]['id']);setTimeout(this[_0xae58('0x6')][_0xae58('0x8')](this),0x3e8);}else{if(this[_0xae58('0x3')][_0xae58('0x12')]||util['isAgentAvailable'](this[_0xae58('0x4')]['id'],this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']],this[_0xae58('0x4')][_0xae58('0x13')],![])){this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']]['busy']=!![];this['realtime'][_0xae58('0x11')][this['agent']['id']][_0xae58('0x14')]=undefined;util['showNotification'](this[_0xae58('0x15')],this[_0xae58('0x4')]['id'],this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']],null,this['routing']);util[_0xae58('0x16')](this[_0xae58('0x4')]['id'],this[_0xae58('0x5')][_0xae58('0x11')][this['agent']['id']],_0xae58('0x17')+(this['routing']['forcedOwnership']?_0xae58('0x18'):''));}else{logger['info'](_0xae58('0x19'),this['squeue']['id'],this[_0xae58('0x10')]['id']);setTimeout(this[_0xae58('0x6')][_0xae58('0x8')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x4c5340){if(_['isNil'](this[_0xae58('0x5')]['agents'][this['agent']['id']])){return logger[_0xae58('0xe')](_0xae58('0x1a'),this[_0xae58('0x4')]['id'],this[_0xae58('0x10')]['id']);}else{logger[_0xae58('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xae58('0x4')]['id'],this[_0xae58('0x10')]['id']);util[_0xae58('0x1b')](this[_0xae58('0x15')],this[_0xae58('0x4')]['id'],this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']],null,this[_0xae58('0x3')]);this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']]['busy']=![];this[_0xae58('0x5')][_0xae58('0x11')][this[_0xae58('0x10')]['id']][_0xae58('0x14')]=undefined;util[_0xae58('0x16')](this['squeue']['id'],this[_0xae58('0x5')][_0xae58('0x11')][this['agent']['id']],_0x4c5340?_0xae58('0x1c'):_0xae58('0x1d'));}if(!_0x4c5340){setTimeout(this[_0xae58('0x6')][_0xae58('0x8')](this),0x3e8);}};function agent(_0x5efc74,_0x267d8,_0x49a3b9,_0xd5332b){return new Agent(_0x5efc74,_0x267d8,_0x49a3b9,_0xd5332b);}module[_0xae58('0x1e')]=agent; \ No newline at end of file +var _0x48fd=['busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy'];(function(_0x2222a1,_0x333e4b){var _0xaa57ab=function(_0x15c213){while(--_0x15c213){_0x2222a1['push'](_0x2222a1['shift']());}};_0xaa57ab(++_0x333e4b);}(_0x48fd,0x92));var _0xd48f=function(_0x2b5e05,_0x22449c){_0x2b5e05=_0x2b5e05-0x0;var _0x14c2db=_0x48fd[_0x2b5e05];return _0x14c2db;};'use strict';var _=require(_0xd48f('0x0'));var uuid=require('uuid');var util=require(_0xd48f('0x1'));var logger=require(_0xd48f('0x2'))(_0xd48f('0x3'));var Agent=function(_0x1af912,_0x8734e5,_0x31149e,_0x586bc8){this[_0xd48f('0x4')]=uuid['v4']();this[_0xd48f('0x5')]=_0x1af912;this['agent']=_0x8734e5;this[_0xd48f('0x6')]=_0x31149e;this['routing']=_0x586bc8;this[_0xd48f('0x5')][_0xd48f('0x7')](this[_0xd48f('0x8')][_0xd48f('0x9')](this),this[_0xd48f('0xa')][_0xd48f('0x9')](this));this['squeue']['on'](_0xd48f('0xb'),this[_0xd48f('0xa')]['bind'](this));this[_0xd48f('0x5')]['on'](_0xd48f('0xc'),this[_0xd48f('0xd')][_0xd48f('0x9')](this));};Agent[_0xd48f('0xe')][_0xd48f('0x7')]=function(){this[_0xd48f('0x5')]['push'](this[_0xd48f('0x8')][_0xd48f('0x9')](this),this[_0xd48f('0xa')][_0xd48f('0x9')](this));};Agent[_0xd48f('0xe')][_0xd48f('0xd')]=function(){this[_0xd48f('0xa')](!![]);};Agent[_0xd48f('0xe')][_0xd48f('0x8')]=function(_0x2c22d0){logger[_0xd48f('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xd48f('0x5')]['id'],this[_0xd48f('0x10')]['id']);if(_[_0xd48f('0x11')](this['realtime'][_0xd48f('0x12')][this['agent']['id']])){logger[_0xd48f('0xf')](_0xd48f('0x13'),this[_0xd48f('0x5')]['id'],this[_0xd48f('0x10')]['id']);setTimeout(this[_0xd48f('0x7')][_0xd48f('0x9')](this),0x3e8);}else{if(this['routing'][_0xd48f('0x14')]||util[_0xd48f('0x15')](this[_0xd48f('0x5')]['id'],this['realtime']['agents'][this[_0xd48f('0x10')]['id']],this['squeue'][_0xd48f('0x16')],![])){this[_0xd48f('0x6')][_0xd48f('0x12')][this['agent']['id']][_0xd48f('0x17')]=!![];this[_0xd48f('0x6')]['agents'][this[_0xd48f('0x10')]['id']][_0xd48f('0x18')]=undefined;util[_0xd48f('0x19')](this[_0xd48f('0x4')],this[_0xd48f('0x5')]['id'],this['realtime'][_0xd48f('0x12')][this[_0xd48f('0x10')]['id']],null,this[_0xd48f('0x3')]);util[_0xd48f('0x1a')](this[_0xd48f('0x5')]['id'],this[_0xd48f('0x6')][_0xd48f('0x12')][this[_0xd48f('0x10')]['id']],'RINGING'+(this[_0xd48f('0x3')][_0xd48f('0x14')]?_0xd48f('0x1b'):''));}else{logger[_0xd48f('0xf')](_0xd48f('0x1c'),this[_0xd48f('0x5')]['id'],this[_0xd48f('0x10')]['id']);setTimeout(this[_0xd48f('0x7')][_0xd48f('0x9')](this),0x3e8);}}};Agent['prototype'][_0xd48f('0xa')]=function(_0x1a2f75){if(_[_0xd48f('0x11')](this['realtime'][_0xd48f('0x12')][this['agent']['id']])){return logger['info'](_0xd48f('0x13'),this['squeue']['id'],this[_0xd48f('0x10')]['id']);}else{logger[_0xd48f('0xf')](_0xd48f('0x1d'),this[_0xd48f('0x5')]['id'],this[_0xd48f('0x10')]['id']);util[_0xd48f('0x1e')](this[_0xd48f('0x4')],this['squeue']['id'],this[_0xd48f('0x6')][_0xd48f('0x12')][this[_0xd48f('0x10')]['id']],null,this['routing']);this[_0xd48f('0x6')][_0xd48f('0x12')][this[_0xd48f('0x10')]['id']]['busy']=![];this[_0xd48f('0x6')][_0xd48f('0x12')][this[_0xd48f('0x10')]['id']][_0xd48f('0x18')]=undefined;util[_0xd48f('0x1a')](this[_0xd48f('0x5')]['id'],this[_0xd48f('0x6')][_0xd48f('0x12')][this[_0xd48f('0x10')]['id']],_0x1a2f75?_0xd48f('0x1f'):_0xd48f('0x20'));}if(!_0x1a2f75){setTimeout(this[_0xd48f('0x7')][_0xd48f('0x9')](this),0x3e8);}};function agent(_0x232331,_0xca7a80,_0x283d00,_0x5d4a02){return new Agent(_0x232331,_0xca7a80,_0x283d00,_0x5d4a02);}module[_0xd48f('0x21')]=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 b5bb1b0..9958d4c 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 _0x241d=['showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','bind','timeout','handleTimeout','drained','prototype','handleRun','handleDrained','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','RINGING','busy','busyQueue','name'];(function(_0x3cda7e,_0x5ef763){var _0x4889a6=function(_0x562a99){while(--_0x562a99){_0x3cda7e['push'](_0x3cda7e['shift']());}};_0x4889a6(++_0x5ef763);}(_0x241d,0xdf));var _0xd241=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x241d[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xd241('0x0'));var uuid=require('uuid');var util=require(_0xd241('0x1'));var logger=require(_0xd241('0x2'))(_0xd241('0x3'));var Beepall=function(_0x226bec,_0x27b04b,_0x67b04a,_0x1cb38d){this[_0xd241('0x4')]=uuid['v4']();this[_0xd241('0x5')]=_0x226bec;this[_0xd241('0x6')]=_0x27b04b;this[_0xd241('0x7')]=_0x67b04a;this[_0xd241('0x3')]=_0x1cb38d;this[_0xd241('0x5')][_0xd241('0x8')](this['handleRun']['bind'](this),this['handleTimeout'][_0xd241('0x9')](this));this[_0xd241('0x5')]['on'](_0xd241('0xa'),this[_0xd241('0xb')]['bind'](this));this[_0xd241('0x5')]['on'](_0xd241('0xc'),this['handleDrained']['bind'](this));};Beepall[_0xd241('0xd')][_0xd241('0x8')]=function(){this[_0xd241('0x5')][_0xd241('0x8')](this[_0xd241('0xe')][_0xd241('0x9')](this),this['handleTimeout'][_0xd241('0x9')](this));};Beepall[_0xd241('0xd')][_0xd241('0xf')]=function(_0x23aa83){this[_0xd241('0xb')](!![]);};Beepall['prototype'][_0xd241('0xe')]=function(_0x33568c){var _0x5572b0=!![];if(!_[_0xd241('0x10')](this['queue'])&&!_['isNil'](this[_0xd241('0x6')][_0xd241('0x11')])&&this['queue'][_0xd241('0x11')][_0xd241('0x12')]>0x0){for(var _0xab106b=0x0,_0x1dfeab;_0xab106b0x0){for(var _0x53fa09=0x0,_0x240170;_0x53fa090x0&&_0x454a8f[_0x11c468+'CurrentCapacity']>=_0x454a8f[_0x11c468+_0x35cb('0x22')]){writeLog(_0x5bb428,_0x454a8f,_0x11c468['toUpperCase']()+_0x35cb('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x4a12b9,_0x57a654,_0x20cc8b,_0x197747,_0x5d2755){return sendNotification(!![],_0x4a12b9,_0x57a654,_0x20cc8b,_0x197747,_0x5d2755);};exports[_0x35cb('0x24')]=function(_0x25bd7b,_0xe9600b,_0x2509e1,_0x3f7b84,_0x2ad15){return sendNotification(![],_0x25bd7b,_0xe9600b,_0x2509e1,_0x3f7b84,_0x2ad15);};exports[_0x35cb('0x25')]=writeLog; \ No newline at end of file +var _0x4094=['[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','writeLog','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','format','user:save','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','emit','notification:%s','save','remove'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x4094,0x173));var _0x4409=function(_0x323327,_0x438868){_0x323327=_0x323327-0x0;var _0x21a873=_0x4094[_0x323327];return _0x21a873;};'use strict';var _=require(_0x4409('0x0'));var util=require(_0x4409('0x1'));var utils=require(_0x4409('0x2'));var Mustache=require(_0x4409('0x3'));var Redis=require('ioredis');var config=require(_0x4409('0x4'));var logger=require(_0x4409('0x5'))(_0x4409('0x6'));config[_0x4409('0x7')]=_[_0x4409('0x8')](config[_0x4409('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3881a9,_0x56afa1,_0x2a3947){io['to'](_0x3881a9)['emit'](_0x56afa1,_0x2a3947);}function sendNotification(_0x395a50,_0x21303d,_0x192ffd,_0x3caab3,_0x139492,_0x476272){io['to'](util[_0x4409('0x9')]('user:%s',_0x3caab3['name']))['emit'](_0x4409('0xa'),_0x3caab3);var _0x254fbc=_0x476272||{};var _0x1da1e1=_0x192ffd[_0x4409('0xb')]('.');var _0x2a34ed={'uniqueid':_0x21303d,'channel':_0x1da1e1[0x0],'id':_0x1da1e1[0x1],'title':_0x1da1e1[0x0]+_0x4409('0xc'),'interactionId':_0x1da1e1[0x2],'queue':_0x139492?_0x139492[_0x4409('0xd')]:null,'sound':_0x254fbc[_0x4409('0xe')][_0x4409('0xf')],'shake':_0x254fbc[_0x4409('0xe')][_0x4409('0x10')]};try{if(!_0x254fbc['body']){_0x254fbc[_0x4409('0x11')]={};}if(_0x139492){_0x254fbc[_0x4409('0x11')][_0x4409('0x12')]=_0x139492;}else if(_0x254fbc[_0x4409('0x11')][_0x4409('0x12')]){delete _0x254fbc[_0x4409('0x11')]['queue'];}_0x2a34ed[_0x4409('0x13')]=utils['getMustacheRender'](_0x254fbc[_0x4409('0xe')]['notificationTemplate'],_0x254fbc);}catch(_0x21b33c){_0x2a34ed[_0x4409('0x13')]=_0x4409('0x14');logger['error'](util[_0x4409('0x9')]('[%s][QUEUE]\x20%s',_0x21303d,_0x21b33c['message']));}io['to'](util['format']('user:%s',_0x3caab3[_0x4409('0xd')]))[_0x4409('0x15')](util[_0x4409('0x9')](_0x4409('0x16'),_0x395a50?_0x4409('0x17'):_0x4409('0x18')),_0x2a34ed);}function writeLog(_0x85abe2,_0x5c36cf,_0x2ff983){return logger['info'](util['format'](_0x4409('0x19'),_0x85abe2,_0x5c36cf[_0x4409('0xd')],_0x2ff983));}exports[_0x4409('0x1a')]=function(_0x15dbf0,_0x4c37aa,_0x1e1ec4,_0x547853){if(_0x4c37aa[_0x4409('0x1b')]){writeLog(_0x15dbf0,_0x4c37aa,_0x4409('0x1c'));return![];}if(!_0x4c37aa['online']){writeLog(_0x15dbf0,_0x4c37aa,_0x4409('0x1d'));return![];}if(_0x4c37aa[_0x1e1ec4+'Pause']){writeLog(_0x15dbf0,_0x4c37aa,_0x4409('0x1e'));return![];}if(_0x547853&&_0x4c37aa[_0x4409('0x1f')](_0x1e1ec4+_0x4409('0x20'))&&_0x4c37aa[_0x4409('0x1f')](_0x1e1ec4+_0x4409('0x21'))){if(_0x4c37aa[_0x1e1ec4+_0x4409('0x20')]>0x0&&_0x4c37aa[_0x1e1ec4+_0x4409('0x21')]>=_0x4c37aa[_0x1e1ec4+'Capacity']){writeLog(_0x15dbf0,_0x4c37aa,_0x1e1ec4['toUpperCase']()+_0x4409('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x3875da,_0x826f55,_0x419850,_0x353667,_0x29fe1d){return sendNotification(!![],_0x3875da,_0x826f55,_0x419850,_0x353667,_0x29fe1d);};exports['hideNotification']=function(_0x52d8c1,_0x56c31a,_0x1b61f2,_0xc90688,_0x502cea){return sendNotification(![],_0x52d8c1,_0x56c31a,_0x1b61f2,_0xc90688,_0x502cea);};exports[_0x4409('0x23')]=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 922e5a3..43372b6 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 _0xf699=['body','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x19a90c,_0x2e2825){var _0x3e1601=function(_0x3b612f){while(--_0x3b612f){_0x19a90c['push'](_0x19a90c['shift']());}};_0x3e1601(++_0x2e2825);}(_0xf699,0x9d));var _0x9f69=function(_0x76bf85,_0x364f12){_0x76bf85=_0x76bf85-0x0;var _0x1bd668=_0xf699[_0x76bf85];return _0x1bd668;};'use strict';var schema=require(_0x9f69('0x0'));var sh=require(_0x9f69('0x1'));var _=require(_0x9f69('0x2'));var utils=require(_0x9f69('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9f69('0x4')]=function(_0xaf89a5,_0x1d069d){return function(_0x5312d3){try{var _0x3d0729={'command':_0x1d069d[0x0]};var _0x2ed04e=system['validate'](_0x3d0729,{'typecast':!![]});if(_0x2ed04e[_0x9f69('0x5')]){logger[_0x9f69('0x6')](_0x9f69('0x7'),_0xaf89a5,_['map'](_0x2ed04e,_0x9f69('0x8'))[_0x9f69('0x9')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xaf89a5);_0x5312d3[_0x9f69('0xa')]();}else{var _0x24fc3c=this;var _0x255a2b=utils['getMustacheRender'](_0x1d069d[0x0],this);logger[_0x9f69('0xb')](_0x9f69('0xc'),_0xaf89a5,_0x255a2b);sh[_0x9f69('0xd')](_[_0x9f69('0xe')](_0x255a2b),function(_0x3327c4,_0x23be36){logger[_0x9f69('0xb')](_0x9f69('0xf'),_0xaf89a5,_0x3327c4);if(_0x3327c4==0x0){var _0x51f684=_0x23be36[_0x9f69('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1d069d[0x1])||_[_0x9f69('0x11')](_0x1d069d[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0xaf89a5);_0x24fc3c['body'][_0x1d069d[0x1]]=_0x51f684;}else{logger[_0x9f69('0xb')](_0x9f69('0x12'),_0xaf89a5,_0x1d069d[0x1],_0x51f684);_0x24fc3c[_0x9f69('0x13')][_0x1d069d[0x1]]=_0x51f684;}}_0x5312d3[_0x9f69('0xa')]();});}}catch(_0x1be8f2){logger['error'](_0x9f69('0x7'),_0xaf89a5,_[_0x9f69('0x14')](_0x1be8f2)?JSON['stringify'](_0x1be8f2):_0x1be8f2);logger[_0x9f69('0xb')](_0x9f69('0x15'),_0xaf89a5);_0x5312d3[_0x9f69('0xa')]();}};}; \ No newline at end of file +var _0x215c=['consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','isObject','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x215c,0xc1));var _0xc215=function(_0x4d3cf0,_0x3635ed){_0x4d3cf0=_0x4d3cf0-0x0;var _0x322c85=_0x215c[_0x4d3cf0];return _0x322c85;};'use strict';var schema=require(_0xc215('0x0'));var sh=require(_0xc215('0x1'));var _=require(_0xc215('0x2'));var utils=require('./utils');var logger=require(_0xc215('0x3'))(_0xc215('0x4'));var system=schema({'command':{'type':_0xc215('0x5'),'required':!![],'message':_0xc215('0x6')}});exports[_0xc215('0x7')]=function(_0x240f95,_0x5455c4){return function(_0x4aa1ae){try{var _0x1d36a8={'command':_0x5455c4[0x0]};var _0x582899=system['validate'](_0x1d36a8,{'typecast':!![]});if(_0x582899[_0xc215('0x8')]){logger[_0xc215('0x9')](_0xc215('0xa'),_0x240f95,_[_0xc215('0xb')](_0x582899,'message')[_0xc215('0xc')](',\x20'));logger[_0xc215('0xd')](_0xc215('0xe'),_0x240f95);_0x4aa1ae[_0xc215('0xf')]();}else{var _0x52fd85=this;var _0x140190=utils[_0xc215('0x10')](_0x5455c4[0x0],this);logger[_0xc215('0xd')](_0xc215('0x11'),_0x240f95,_0x140190);sh['exec'](_[_0xc215('0x12')](_0x140190),function(_0x290d4c,_0x52146e){logger[_0xc215('0xd')](_0xc215('0x13'),_0x240f95,_0x290d4c);if(_0x290d4c==0x0){var _0x142e9b=_0x52146e[_0xc215('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xc215('0x15')](_0x5455c4[0x1])||_[_0xc215('0x16')](_0x5455c4[0x1])){logger[_0xc215('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x240f95);_0x52fd85[_0xc215('0x17')][_0x5455c4[0x1]]=_0x142e9b;}else{logger[_0xc215('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x240f95,_0x5455c4[0x1],_0x142e9b);_0x52fd85[_0xc215('0x17')][_0x5455c4[0x1]]=_0x142e9b;}}_0x4aa1ae['next']();});}}catch(_0xe35427){logger[_0xc215('0x9')](_0xc215('0xa'),_0x240f95,_[_0xc215('0x18')](_0xe35427)?JSON['stringify'](_0xe35427):_0xe35427);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x240f95);_0x4aa1ae['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index d93451b..10ccfc1 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(_0x53217c,_0x1755e7){var _0x56e1be=function(_0x20528d){while(--_0x20528d){_0x53217c['push'](_0x53217c['shift']());}};_0x56e1be(++_0x1755e7);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _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(_0x569476,_0x543227){var _0x160f09=function(_0x52c49a){while(--_0x52c49a){_0x569476['push'](_0x569476['shift']());}};_0x160f09(++_0x543227);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 089e46e..7d0a032 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 _0xa25c=['merge','body','contact','account','lodash','exports','render'];(function(_0x344c8b,_0x362a62){var _0x43b7ed=function(_0x433f32){while(--_0x433f32){_0x344c8b['push'](_0x344c8b['shift']());}};_0x43b7ed(++_0x362a62);}(_0xa25c,0x13f));var _0xca25=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xa25c[_0x1d558c];return _0x15767d;};'use strict';var Mustache=require('mustache');var _=require(_0xca25('0x0'));module[_0xca25('0x1')]={'getMustacheRender':function(_0x2a8b77,_0x1dd0d4){return Mustache[_0xca25('0x2')](_0x2a8b77,_[_0xca25('0x3')](_0x1dd0d4[_0xca25('0x4')],{'contact':_0x1dd0d4[_0xca25('0x5')],'message':_0x1dd0d4['message'],'account':_0x1dd0d4[_0xca25('0x6')],'interaction':_0x1dd0d4['interaction'],'list':_0x1dd0d4['list']}))||'';}}; \ No newline at end of file +var _0xf874=['exports','render','merge','body','contact','account','interaction','mustache'];(function(_0x1194be,_0x5f1150){var _0x32af47=function(_0x164a37){while(--_0x164a37){_0x1194be['push'](_0x1194be['shift']());}};_0x32af47(++_0x5f1150);}(_0xf874,0x177));var _0x4f87=function(_0x27a912,_0x94c8d6){_0x27a912=_0x27a912-0x0;var _0x3f0e00=_0xf874[_0x27a912];return _0x3f0e00;};'use strict';var Mustache=require(_0x4f87('0x0'));var _=require('lodash');module[_0x4f87('0x1')]={'getMustacheRender':function(_0x2d2603,_0xbfff85){return Mustache[_0x4f87('0x2')](_0x2d2603,_[_0x4f87('0x3')](_0xbfff85[_0x4f87('0x4')],{'contact':_0xbfff85[_0x4f87('0x5')],'message':_0xbfff85['message'],'account':_0xbfff85[_0x4f87('0x6')],'interaction':_0xbfff85[_0x4f87('0x7')],'list':_0xbfff85['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f8446c2..d724b47 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 _0x7aa6=['../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','amazonlex','appdata','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','error','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport'];(function(_0x45f656,_0x1b681f){var _0x4b1f50=function(_0xc9b5e6){while(--_0xc9b5e6){_0x45f656['push'](_0x45f656['shift']());}};_0x4b1f50(++_0x1b681f);}(_0x7aa6,0x104));var _0x67aa=function(_0x182295,_0x5377ac){_0x182295=_0x182295-0x0;var _0x19f008=_0x7aa6[_0x182295];return _0x19f008;};'use strict';var _=require(_0x67aa('0x0'));var util=require(_0x67aa('0x1'));var path=require(_0x67aa('0x2'));var fs=require('fs');var jayson=require(_0x67aa('0x3'));var BPromise=require(_0x67aa('0x4'));var uuid=require(_0x67aa('0x5'));var config=require(_0x67aa('0x6'));var logger=require(_0x67aa('0x7'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0x67aa('0x8')),'mailQueueReport':require(_0x67aa('0x9')),'chatQueueReport':require(_0x67aa('0xa')),'smsQueueReport':require(_0x67aa('0xb')),'faxQueueReport':require(_0x67aa('0xc'))};var RuleEngine=require(_0x67aa('0xd'));function getId(_0xb8dfb5,_0x57a6bb,_0x28bfa9){return util[_0x67aa('0xe')](_0x67aa('0xf'),_0xb8dfb5,_0x57a6bb||0x0,_0x28bfa9||0x0);}function getIntervals(_0x164007,_0x90bac0){var _0x4ef97c=[];if(!_['isNil'](_0x90bac0[_0x67aa('0x10')])&&!_[_0x67aa('0x11')](_0x164007[_0x90bac0[_0x67aa('0x10')]])&&!_['isNil'](_0x164007[_0x90bac0['IntervalId']][_0x67aa('0x12')])){_0x4ef97c=_[_0x67aa('0x13')](_0x164007[_0x90bac0[_0x67aa('0x10')]]['Intervals'],_0x67aa('0x14'));}else if(!_[_0x67aa('0x11')](_0x90bac0[_0x67aa('0x14')])){_0x4ef97c=[_0x90bac0[_0x67aa('0x14')]];}return _0x4ef97c;}exports[_0x67aa('0x15')]=function(_0x2fe964){_0x2fe964[_0x67aa('0x16')]={};return new BPromise(function(_0x55b4a4,_0x103203){var _0xe89676={'Start':function(_0x907a95){var _0x105d7b=this;return new Promise(function(_0xd468c3,_0x1683a1){if(_0x907a95){try{var _0x7c89ac=[];var _0xd76adc=getId(_0x907a95[_0x67aa('0x17')],_0x907a95[_0x67aa('0x18')]?_0x907a95[_0x67aa('0x18')]['id']:0x0,_0x907a95[_0x67aa('0x19')]?_0x907a95['interaction']['id']:0x0);if(_0x907a95[_0x67aa('0x1a')]&&_[_0x67aa('0x1b')](_0x907a95['applications'])&&_0x907a95[_0x67aa('0x1a')][_0x67aa('0x1c')]){for(var _0x6c9649=0x0;_0x6c9649<_0x907a95[_0x67aa('0x1a')][_0x67aa('0x1c')];_0x6c9649+=0x1){var _0x3d8a11=_0x907a95[_0x67aa('0x1a')][_0x6c9649];if(fs[_0x67aa('0x1d')](path[_0x67aa('0x1e')](__dirname,_0x67aa('0x1a'),_0x3d8a11[_0x67aa('0x1f')]+_0x67aa('0x20')))){var _0x39511c=[];switch(_0x3d8a11['app'][_0x67aa('0x21')]()){case _0x67aa('0x22'):var _0x3bfd98=_0x3d8a11['appdata'][_0x67aa('0x23')](',');_0x39511c[_0x67aa('0x24')](_0x3bfd98[0x0]);_0x39511c['push'](_0x3bfd98[_0x67aa('0x25')](0x1,_0x3bfd98[_0x67aa('0x1c')])[_0x67aa('0x1e')](','));break;case _0x67aa('0x26'):var _0x3bfd98=_0x3d8a11['appdata'][_0x67aa('0x23')](',');_0x39511c[_0x67aa('0x24')](_0x3bfd98[0x0]);_0x39511c[_0x67aa('0x24')](_0x3bfd98[0x1]);_0x39511c['push'](_0x3bfd98['slice'](0x2,_0x3bfd98[_0x67aa('0x1c')])[_0x67aa('0x1e')](','));break;case _0x67aa('0x27'):var _0x3bfd98=_0x3d8a11[_0x67aa('0x28')]['split'](',');_0x39511c[_0x67aa('0x24')](_0x3bfd98[0x0]);_0x39511c[_0x67aa('0x24')](_0x3bfd98[0x1]);_0x39511c['push'](_0x3bfd98[0x2]);_0x39511c[_0x67aa('0x24')](_0x3bfd98[0x3]);_0x39511c[_0x67aa('0x24')](_0x3bfd98[_0x67aa('0x25')](0x4,_0x3bfd98['length'])[_0x67aa('0x1e')](','));break;case _0x67aa('0x18'):_0x39511c['push'](_0x3d8a11[_0x67aa('0x28')]);break;case'tag':_0x39511c[_0x67aa('0x24')](_0x3d8a11[_0x67aa('0x29')]);_0x39511c[_0x67aa('0x24')](_0x3d8a11[_0x67aa('0x28')]);break;default:_0x39511c=_[_0x67aa('0x11')](_0x3d8a11[_0x67aa('0x28')])?[]:_0x3d8a11[_0x67aa('0x28')]['split'](',');}var _0x105016={'id':util['format'](_0x67aa('0x2a'),_0xd76adc,_0x3d8a11['id'],_0x3d8a11[_0x67aa('0x1f')]),'condition':require(_0x67aa('0x2b'))[_0x67aa('0x2c')](_0xd76adc,getIntervals(_0x2fe964[_0x67aa('0x2d')],_0x3d8a11),_0x2fe964),'consequence':require(_0x67aa('0x2e')+_0x3d8a11['app'])['consequence'](_0xd76adc,_0x39511c,_0x2fe964,_0x907a95),'p':_0x3d8a11[_0x67aa('0x2f')]||0x0};logger[_0x67aa('0x30')]('Push\x20new\x20rule',_0x105016['id'],_0x67aa('0x31'),getIntervals(_0x2fe964[_0x67aa('0x2d')],_0x3d8a11)[_0x67aa('0x1e')](_0x67aa('0x32')));_0x7c89ac['push'](_0x105016);}else{logger['error'](_0x67aa('0x33'),path[_0x67aa('0x1e')](__dirname,_0x67aa('0x1a'),_0x3d8a11[_0x67aa('0x1f')]+_0x67aa('0x20')));}}_0x2fe964[_0x67aa('0x16')][_0xd76adc]=new RuleEngine(_0x7c89ac);_0x2fe964[_0x67aa('0x16')][_0xd76adc][_0x67aa('0x34')](_0x907a95,function(_0x539e6c){logger[_0x67aa('0x30')](_0x67aa('0x35'),JSON[_0x67aa('0x36')](_0x539e6c[_0x67aa('0x37')]));if(_0x2fe964['rules'][_0xd76adc]){_0x2fe964['rules'][_0xd76adc][_0x67aa('0x38')]('end');}});return _0xd468c3({'code':0xc8,'message':_0x907a95});}else{logger[_0x67aa('0x30')]('No\x20applications\x20to\x20execute');return _0xd468c3({'code':0xc8,'message':_0x907a95});}}catch(_0x57c702){logger[_0x67aa('0x39')](_0x57c702[_0x67aa('0x3a')]);return _0x1683a1(_0x105d7b[_0x67aa('0x39')](0x1f4,_0x57c702));}}return _0x1683a1(_0x67aa('0x3b'));});},'AcceptMessage':function(_0x49c035){var _0x53531e=this;return new Promise(function(_0x1d0ae0,_0x2262cd){if(_0x49c035[_0x67aa('0x18')]&&_0x49c035[_0x67aa('0x18')]['id']){try{var _0x13f959=getId(_0x49c035['channel'],_0x49c035[_0x67aa('0x18')]?_0x49c035[_0x67aa('0x18')]['id']:0x0,_0x49c035['interaction']?_0x49c035[_0x67aa('0x19')]['id']:0x0);if(_0x2fe964[_0x67aa('0x16')][_0x13f959]){_0x2fe964[_0x67aa('0x16')][_0x13f959]['emit']('end');if(rpc[_0x49c035['channel']+'QueueReport']){rpc[_0x49c035[_0x67aa('0x17')]+_0x67aa('0x3c')][_0x67aa('0x3d')](_0x13f959,{'UserId':_0x49c035[_0x67aa('0x18')][_0x67aa('0x3e')]})[_0x67aa('0x3f')](function(_0x56d385){logger[_0x67aa('0x39')]('error\x20update\x20queue\x20report');});}}return _0x1d0ae0({'code':0xc8,'message':_0x49c035});}catch(_0x2b709b){logger[_0x67aa('0x39')](_0x2b709b['stack']);return _0x2262cd(_0x53531e['error'](0x1f4,_0x2b709b));}}logger[_0x67aa('0x39')]('message\x20is\x20empty');return _0x2262cd(_0x53531e[_0x67aa('0x39')](0x1f4,_0x67aa('0x40')));});},'RejectMessage':function(_0x26937e){var _0x455a71=this;return new Promise(function(_0x555054,_0xe6b2b1){if(_0x26937e[_0x67aa('0x41')]&&_0x26937e[_0x67aa('0x41')]['id']){try{if(_0x2fe964['agents'][_0x26937e[_0x67aa('0x41')]['id']]){_0x2fe964[_0x67aa('0x42')][_0x26937e['agent']['id']][_0x67aa('0x43')]=![];_0x2fe964[_0x67aa('0x42')][_0x26937e['agent']['id']][_0x67aa('0x44')]=undefined;}return _0x555054({'code':0xc8,'message':_0x26937e});}catch(_0x18a0b9){logger[_0x67aa('0x39')](_0x18a0b9[_0x67aa('0x3a')]);return _0xe6b2b1(_0x455a71[_0x67aa('0x39')](0x1f4,_0x18a0b9));}}logger[_0x67aa('0x39')]('message\x20is\x20empty');return _0xe6b2b1(_0x455a71[_0x67aa('0x39')](0x1f4,_0x67aa('0x40')));});},'AbandonInteraction':function(_0x24c2de){var _0x456666=this;return new Promise(function(_0x5ed317,_0x388e62){if(_0x24c2de['channel']&&_0x24c2de[_0x67aa('0x19')]&&_0x24c2de[_0x67aa('0x19')]['id']){try{var _0x5717a3=getId(_0x24c2de[_0x67aa('0x17')],_0x24c2de[_0x67aa('0x18')]?_0x24c2de[_0x67aa('0x18')]['id']:0x0,_0x24c2de[_0x67aa('0x19')]?_0x24c2de['interaction']['id']:0x0);if(_0x2fe964[_0x67aa('0x16')][_0x5717a3]){_0x2fe964[_0x67aa('0x16')][_0x5717a3][_0x67aa('0x38')]('end');}return _0x5ed317({'code':0xc8,'message':_0x24c2de});}catch(_0x4be3cf){logger[_0x67aa('0x39')](_0x4be3cf[_0x67aa('0x3a')]);return _0x388e62(_0x456666[_0x67aa('0x39')](0x1f4,_0x4be3cf));}}logger[_0x67aa('0x39')](_0x67aa('0x40'));return _0x388e62(_0x456666[_0x67aa('0x39')](0x1f4,_0x67aa('0x40')));});},'AgentCapacity':function(_0x37034d){var _0x5757f7=this;return new Promise(function(_0xe7cf97,_0x409a09){if(_0x2fe964[_0x67aa('0x42')][_0x67aa('0x45')](_0x37034d['id'])){for(var _0x28908e in _0x37034d[_0x67aa('0x46')]){if(_0x37034d[_0x67aa('0x46')]['hasOwnProperty'](_0x28908e)){if(_0x2fe964[_0x67aa('0x42')][_0x37034d['id']][_0x67aa('0x45')](_0x28908e+_0x67aa('0x47'))){_0x2fe964[_0x67aa('0x42')][_0x37034d['id']][_0x28908e+_0x67aa('0x47')]=parseInt(_0x37034d[_0x67aa('0x46')][_0x28908e],0xa);}}}_0x2fe964[_0x67aa('0x42')][_0x37034d['id']][_0x67aa('0x48')]();return _0xe7cf97({'code':0xc8,'message':_0x2fe964['agents'][_0x37034d['id']]});}else{return _0x409a09(_0x5757f7[_0x67aa('0x39')](0x1f4,_0x67aa('0x49')));}});},'Agents':function(_0xbae4a5){return new Promise(function(_0x547936,_0x1b6868){var _0x1a4f1b=_[_0x67aa('0x4a')](_0x2fe964[_0x67aa('0x42')]);_0x547936({'count':_0x1a4f1b[_0x67aa('0x1c')],'rows':_0x1a4f1b});});},'ChatQueues':function(_0x26374a){return new Promise(function(_0x220f0b,_0x4a7148){var _0x1711f5=[];for(var _0x54eea4 in _0x2fe964[_0x67aa('0x4b')]){if(_0x2fe964[_0x67aa('0x4b')][_0x67aa('0x45')](_0x54eea4)){var _0x349ba8=_0x2fe964[_0x67aa('0x4b')][_0x54eea4];var _0x16c498={'id':_0x349ba8['id'],'available':_0x349ba8[_0x67aa('0x4c')],'loggedIn':_0x349ba8[_0x67aa('0x4d')],'name':_0x349ba8[_0x67aa('0x4e')],'paused':_0x349ba8[_0x67aa('0x4f')],'waiting':_0x349ba8[_0x67aa('0x50')]};_0x1711f5['push'](_0x16c498);}}_0x220f0b({'count':_0x1711f5[_0x67aa('0x1c')],'rows':_0x1711f5});});},'MailQueues':function(_0x582be4){return new Promise(function(_0x15d307,_0x5ec485){var _0x3c8f58=[];for(var _0x333083 in _0x2fe964[_0x67aa('0x51')]){if(_0x2fe964[_0x67aa('0x51')][_0x67aa('0x45')](_0x333083)){var _0x1ba74f=_0x2fe964[_0x67aa('0x51')][_0x333083];var _0x2f9263={'id':_0x1ba74f['id'],'available':_0x1ba74f[_0x67aa('0x4c')],'loggedIn':_0x1ba74f[_0x67aa('0x4d')],'name':_0x1ba74f['name'],'paused':_0x1ba74f[_0x67aa('0x4f')],'waiting':_0x1ba74f[_0x67aa('0x50')]};_0x3c8f58[_0x67aa('0x24')](_0x2f9263);}}_0x15d307({'count':_0x3c8f58[_0x67aa('0x1c')],'rows':_0x3c8f58});});},'OpenchannelQueues':function(_0x20ebfa){return new Promise(function(_0xa37639,_0x47edee){var _0x233ecc=[];for(var _0x4d9455 in _0x2fe964[_0x67aa('0x52')]){if(_0x2fe964['openchannelQueues'][_0x67aa('0x45')](_0x4d9455)){var _0x1d0574=_0x2fe964[_0x67aa('0x52')][_0x4d9455];var _0x47d5bb={'id':_0x1d0574['id'],'available':_0x1d0574[_0x67aa('0x4c')],'loggedIn':_0x1d0574[_0x67aa('0x4d')],'name':_0x1d0574[_0x67aa('0x4e')],'paused':_0x1d0574[_0x67aa('0x4f')],'waiting':_0x1d0574[_0x67aa('0x50')]};_0x233ecc[_0x67aa('0x24')](_0x47d5bb);}}_0xa37639({'count':_0x233ecc[_0x67aa('0x1c')],'rows':_0x233ecc});});},'SmsQueues':function(_0x4e7cee){return new Promise(function(_0x16c3a8,_0x11452e){var _0x25fdc5=[];for(var _0x19b6a0 in _0x2fe964['smsQueues']){if(_0x2fe964[_0x67aa('0x53')][_0x67aa('0x45')](_0x19b6a0)){var _0x4e5505=_0x2fe964[_0x67aa('0x53')][_0x19b6a0];var _0x354d43={'id':_0x4e5505['id'],'available':_0x4e5505['available'],'loggedIn':_0x4e5505[_0x67aa('0x4d')],'name':_0x4e5505['name'],'paused':_0x4e5505[_0x67aa('0x4f')],'waiting':_0x4e5505['waiting']};_0x25fdc5[_0x67aa('0x24')](_0x354d43);}}_0x16c3a8({'count':_0x25fdc5[_0x67aa('0x1c')],'rows':_0x25fdc5});});},'FaxQueues':function(_0x295e76){return new Promise(function(_0xfd0c82,_0x174123){var _0x460d34=[];for(var _0x31ec66 in _0x2fe964[_0x67aa('0x54')]){if(_0x2fe964[_0x67aa('0x54')][_0x67aa('0x45')](_0x31ec66)){var _0x3fd1cb=_0x2fe964[_0x67aa('0x54')][_0x31ec66];var _0x5d7454={'id':_0x3fd1cb['id'],'available':_0x3fd1cb[_0x67aa('0x4c')],'loggedIn':_0x3fd1cb[_0x67aa('0x4d')],'name':_0x3fd1cb[_0x67aa('0x4e')],'paused':_0x3fd1cb[_0x67aa('0x4f')],'waiting':_0x3fd1cb[_0x67aa('0x50')]};_0x460d34[_0x67aa('0x24')](_0x5d7454);}}_0xfd0c82({'count':_0x460d34[_0x67aa('0x1c')],'rows':_0x460d34});});},'ChatQueuesWaitingInteractions':function(_0x119d55){return new Promise(function(_0x3c62fc,_0x1caabe){var _0x48dcc2=_['values'](_0x2fe964[_0x67aa('0x55')]);_0x3c62fc({'count':_0x48dcc2['length'],'rows':_0x48dcc2});});},'MailQueuesWaitingInteractions':function(_0x563f7c){return new Promise(function(_0x35a21b,_0x3a127e){var _0x28f081=_[_0x67aa('0x4a')](_0x2fe964['mailQueuesWaitingInteractions']);_0x35a21b({'count':_0x28f081[_0x67aa('0x1c')],'rows':_0x28f081});});},'OpenchannelQueuesWaitingInteractions':function(_0xa1345f){return new Promise(function(_0x49fa7b,_0x1c9e22){var _0xb4ece7=_['values'](_0x2fe964['openchannelQueuesWaitingInteractions']);_0x49fa7b({'count':_0xb4ece7[_0x67aa('0x1c')],'rows':_0xb4ece7});});},'SmsQueuesWaitingInteractions':function(_0x5be0d8){return new Promise(function(_0x2829b9,_0x58b378){var _0x4a2689=_[_0x67aa('0x4a')](_0x2fe964[_0x67aa('0x56')]);_0x2829b9({'count':_0x4a2689[_0x67aa('0x1c')],'rows':_0x4a2689});});},'FaxQueuesWaitingInteractions':function(_0xd22e01){return new Promise(function(_0x584244,_0x3306c4){var _0xe54455=_['values'](_0x2fe964['faxQueuesWaitingInteractions']);_0x584244({'count':_0xe54455[_0x67aa('0x1c')],'rows':_0xe54455});});}};var _0x66b6cd=jayson[_0x67aa('0x57')](_0xe89676)['http']();_0x66b6cd['on'](_0x67aa('0x39'),function(_0x7f132c){logger[_0x67aa('0x39')](JSON[_0x67aa('0x36')](_0x7f132c));return _0x103203(_0x7f132c);});_0x66b6cd[_0x67aa('0x15')](0x232c,'127.0.0.1',function(){console['log'](_0x67aa('0x58'),0x232c);return _0x55b4a4(_0x67aa('0x59')+0x232c);});});}; \ No newline at end of file +var _0xc94f=['TagId','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','end','stack','routing\x20is\x20empty','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','emit','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/logger','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','amazonlex','appdata','tag'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xc94f,0x18f));var _0xfc94=function(_0x162530,_0x3ad958){_0x162530=_0x162530-0x0;var _0x110514=_0xc94f[_0x162530];return _0x110514;};'use strict';var _=require(_0xfc94('0x0'));var util=require(_0xfc94('0x1'));var path=require(_0xfc94('0x2'));var fs=require('fs');var jayson=require(_0xfc94('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0xfc94('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0xfc94('0x5'))};var rpc={'openchannelQueueReport':require(_0xfc94('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xfc94('0x6')),'faxQueueReport':require(_0xfc94('0x7'))};var RuleEngine=require(_0xfc94('0x8'));function getId(_0x40d071,_0x42bfde,_0x336743){return util[_0xfc94('0x9')](_0xfc94('0xa'),_0x40d071,_0x42bfde||0x0,_0x336743||0x0);}function getIntervals(_0x1bf55a,_0x4e5b38){var _0x2e1154=[];if(!_[_0xfc94('0xb')](_0x4e5b38['IntervalId'])&&!_[_0xfc94('0xb')](_0x1bf55a[_0x4e5b38['IntervalId']])&&!_[_0xfc94('0xb')](_0x1bf55a[_0x4e5b38[_0xfc94('0xc')]]['Intervals'])){_0x2e1154=_[_0xfc94('0xd')](_0x1bf55a[_0x4e5b38['IntervalId']][_0xfc94('0xe')],_0xfc94('0xf'));}else if(!_[_0xfc94('0xb')](_0x4e5b38[_0xfc94('0xf')])){_0x2e1154=[_0x4e5b38[_0xfc94('0xf')]];}return _0x2e1154;}exports[_0xfc94('0x10')]=function(_0x1da124){_0x1da124[_0xfc94('0x11')]={};return new BPromise(function(_0x431cb7,_0x4bab3a){var _0x3eae2f={'Start':function(_0x1d5615){var _0x225b1f=this;return new Promise(function(_0x1d3c12,_0x4809a8){if(_0x1d5615){try{var _0x2f03f0=[];var _0x319337=getId(_0x1d5615[_0xfc94('0x12')],_0x1d5615[_0xfc94('0x13')]?_0x1d5615[_0xfc94('0x13')]['id']:0x0,_0x1d5615['interaction']?_0x1d5615[_0xfc94('0x14')]['id']:0x0);if(_0x1d5615[_0xfc94('0x15')]&&_[_0xfc94('0x16')](_0x1d5615[_0xfc94('0x15')])&&_0x1d5615[_0xfc94('0x15')][_0xfc94('0x17')]){for(var _0x10246b=0x0;_0x10246b<_0x1d5615[_0xfc94('0x15')][_0xfc94('0x17')];_0x10246b+=0x1){var _0x3ebfc1=_0x1d5615[_0xfc94('0x15')][_0x10246b];if(fs['existsSync'](path[_0xfc94('0x18')](__dirname,_0xfc94('0x15'),_0x3ebfc1[_0xfc94('0x19')]+_0xfc94('0x1a')))){var _0xccff2c=[];switch(_0x3ebfc1['app'][_0xfc94('0x1b')]()){case _0xfc94('0x1c'):var _0x496d21=_0x3ebfc1['appdata'][_0xfc94('0x1d')](',');_0xccff2c[_0xfc94('0x1e')](_0x496d21[0x0]);_0xccff2c['push'](_0x496d21[_0xfc94('0x1f')](0x1,_0x496d21[_0xfc94('0x17')])[_0xfc94('0x18')](','));break;case _0xfc94('0x20'):var _0x496d21=_0x3ebfc1['appdata'][_0xfc94('0x1d')](',');_0xccff2c[_0xfc94('0x1e')](_0x496d21[0x0]);_0xccff2c[_0xfc94('0x1e')](_0x496d21[0x1]);_0xccff2c['push'](_0x496d21[_0xfc94('0x1f')](0x2,_0x496d21[_0xfc94('0x17')])[_0xfc94('0x18')](','));break;case _0xfc94('0x21'):var _0x496d21=_0x3ebfc1[_0xfc94('0x22')][_0xfc94('0x1d')](',');_0xccff2c[_0xfc94('0x1e')](_0x496d21[0x0]);_0xccff2c[_0xfc94('0x1e')](_0x496d21[0x1]);_0xccff2c['push'](_0x496d21[0x2]);_0xccff2c['push'](_0x496d21[0x3]);_0xccff2c[_0xfc94('0x1e')](_0x496d21[_0xfc94('0x1f')](0x4,_0x496d21[_0xfc94('0x17')])[_0xfc94('0x18')](','));break;case _0xfc94('0x13'):_0xccff2c[_0xfc94('0x1e')](_0x3ebfc1[_0xfc94('0x22')]);break;case _0xfc94('0x23'):_0xccff2c[_0xfc94('0x1e')](_0x3ebfc1[_0xfc94('0x24')]);_0xccff2c['push'](_0x3ebfc1[_0xfc94('0x22')]);break;default:_0xccff2c=_['isNil'](_0x3ebfc1[_0xfc94('0x22')])?[]:_0x3ebfc1['appdata'][_0xfc94('0x1d')](',');}var _0x209852={'id':util[_0xfc94('0x9')]('%s:%s:%s',_0x319337,_0x3ebfc1['id'],_0x3ebfc1[_0xfc94('0x19')]),'condition':require(_0xfc94('0x25'))[_0xfc94('0x26')](_0x319337,getIntervals(_0x1da124[_0xfc94('0x27')],_0x3ebfc1),_0x1da124),'consequence':require(_0xfc94('0x28')+_0x3ebfc1[_0xfc94('0x19')])[_0xfc94('0x29')](_0x319337,_0xccff2c,_0x1da124,_0x1d5615),'p':_0x3ebfc1[_0xfc94('0x2a')]||0x0};logger[_0xfc94('0x2b')](_0xfc94('0x2c'),_0x209852['id'],_0xfc94('0x2d'),getIntervals(_0x1da124[_0xfc94('0x27')],_0x3ebfc1)[_0xfc94('0x18')](_0xfc94('0x2e')));_0x2f03f0[_0xfc94('0x1e')](_0x209852);}else{logger[_0xfc94('0x2f')](_0xfc94('0x30'),path[_0xfc94('0x18')](__dirname,'applications',_0x3ebfc1[_0xfc94('0x19')]+_0xfc94('0x1a')));}}_0x1da124[_0xfc94('0x11')][_0x319337]=new RuleEngine(_0x2f03f0);_0x1da124[_0xfc94('0x11')][_0x319337][_0xfc94('0x31')](_0x1d5615,function(_0x41e535){logger[_0xfc94('0x2b')]('Applications\x20executed',JSON[_0xfc94('0x32')](_0x41e535[_0xfc94('0x33')]));if(_0x1da124[_0xfc94('0x11')][_0x319337]){_0x1da124[_0xfc94('0x11')][_0x319337]['emit'](_0xfc94('0x34'));}});return _0x1d3c12({'code':0xc8,'message':_0x1d5615});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x1d3c12({'code':0xc8,'message':_0x1d5615});}}catch(_0x4b7355){logger[_0xfc94('0x2f')](_0x4b7355[_0xfc94('0x35')]);return _0x4809a8(_0x225b1f['error'](0x1f4,_0x4b7355));}}return _0x4809a8(_0xfc94('0x36'));});},'AcceptMessage':function(_0x115610){var _0x58d4f8=this;return new Promise(function(_0xa6068d,_0x559f5b){if(_0x115610[_0xfc94('0x13')]&&_0x115610[_0xfc94('0x13')]['id']){try{var _0xdf543a=getId(_0x115610[_0xfc94('0x12')],_0x115610[_0xfc94('0x13')]?_0x115610[_0xfc94('0x13')]['id']:0x0,_0x115610[_0xfc94('0x14')]?_0x115610[_0xfc94('0x14')]['id']:0x0);if(_0x1da124[_0xfc94('0x11')][_0xdf543a]){_0x1da124['rules'][_0xdf543a]['emit'](_0xfc94('0x34'));if(rpc[_0x115610[_0xfc94('0x12')]+'QueueReport']){rpc[_0x115610['channel']+_0xfc94('0x37')]['update'](_0xdf543a,{'UserId':_0x115610[_0xfc94('0x13')][_0xfc94('0x38')]})[_0xfc94('0x39')](function(_0x5e8f6e){logger['error'](_0xfc94('0x3a'));});}}return _0xa6068d({'code':0xc8,'message':_0x115610});}catch(_0x3e6328){logger['error'](_0x3e6328[_0xfc94('0x35')]);return _0x559f5b(_0x58d4f8[_0xfc94('0x2f')](0x1f4,_0x3e6328));}}logger[_0xfc94('0x2f')](_0xfc94('0x3b'));return _0x559f5b(_0x58d4f8['error'](0x1f4,_0xfc94('0x3b')));});},'RejectMessage':function(_0x5c245b){var _0x23ea16=this;return new Promise(function(_0xadf8c,_0x5c9e12){if(_0x5c245b['agent']&&_0x5c245b[_0xfc94('0x3c')]['id']){try{if(_0x1da124['agents'][_0x5c245b[_0xfc94('0x3c')]['id']]){_0x1da124['agents'][_0x5c245b[_0xfc94('0x3c')]['id']]['busy']=![];_0x1da124[_0xfc94('0x3d')][_0x5c245b[_0xfc94('0x3c')]['id']][_0xfc94('0x3e')]=undefined;}return _0xadf8c({'code':0xc8,'message':_0x5c245b});}catch(_0x767790){logger[_0xfc94('0x2f')](_0x767790[_0xfc94('0x35')]);return _0x5c9e12(_0x23ea16[_0xfc94('0x2f')](0x1f4,_0x767790));}}logger[_0xfc94('0x2f')]('message\x20is\x20empty');return _0x5c9e12(_0x23ea16['error'](0x1f4,_0xfc94('0x3b')));});},'AbandonInteraction':function(_0x1ed1fe){var _0x261ab5=this;return new Promise(function(_0x5e2cc9,_0x195061){if(_0x1ed1fe[_0xfc94('0x12')]&&_0x1ed1fe[_0xfc94('0x14')]&&_0x1ed1fe[_0xfc94('0x14')]['id']){try{var _0x50dac8=getId(_0x1ed1fe['channel'],_0x1ed1fe['message']?_0x1ed1fe[_0xfc94('0x13')]['id']:0x0,_0x1ed1fe[_0xfc94('0x14')]?_0x1ed1fe[_0xfc94('0x14')]['id']:0x0);if(_0x1da124[_0xfc94('0x11')][_0x50dac8]){_0x1da124[_0xfc94('0x11')][_0x50dac8][_0xfc94('0x3f')](_0xfc94('0x34'));}return _0x5e2cc9({'code':0xc8,'message':_0x1ed1fe});}catch(_0x3ce087){logger[_0xfc94('0x2f')](_0x3ce087[_0xfc94('0x35')]);return _0x195061(_0x261ab5[_0xfc94('0x2f')](0x1f4,_0x3ce087));}}logger['error'](_0xfc94('0x3b'));return _0x195061(_0x261ab5[_0xfc94('0x2f')](0x1f4,_0xfc94('0x3b')));});},'AgentCapacity':function(_0x484e11){var _0x573c33=this;return new Promise(function(_0x2a8dce,_0x2d1fc2){if(_0x1da124[_0xfc94('0x3d')][_0xfc94('0x40')](_0x484e11['id'])){for(var _0x491dd1 in _0x484e11[_0xfc94('0x41')]){if(_0x484e11[_0xfc94('0x41')]['hasOwnProperty'](_0x491dd1)){if(_0x1da124['agents'][_0x484e11['id']][_0xfc94('0x40')](_0x491dd1+_0xfc94('0x42'))){_0x1da124[_0xfc94('0x3d')][_0x484e11['id']][_0x491dd1+_0xfc94('0x42')]=parseInt(_0x484e11[_0xfc94('0x41')][_0x491dd1],0xa);}}}_0x1da124['agents'][_0x484e11['id']]['updateRealtime']();return _0x2a8dce({'code':0xc8,'message':_0x1da124['agents'][_0x484e11['id']]});}else{return _0x2d1fc2(_0x573c33[_0xfc94('0x2f')](0x1f4,_0xfc94('0x43')));}});},'Agents':function(_0x44acee){return new Promise(function(_0x3d602a,_0x1484d2){var _0x163f0a=_[_0xfc94('0x44')](_0x1da124[_0xfc94('0x3d')]);_0x3d602a({'count':_0x163f0a[_0xfc94('0x17')],'rows':_0x163f0a});});},'ChatQueues':function(_0x276759){return new Promise(function(_0x602ad9,_0x276ca4){var _0x4abb6c=[];for(var _0x520e6a in _0x1da124[_0xfc94('0x45')]){if(_0x1da124[_0xfc94('0x45')][_0xfc94('0x40')](_0x520e6a)){var _0x33007d=_0x1da124[_0xfc94('0x45')][_0x520e6a];var _0x382005={'id':_0x33007d['id'],'available':_0x33007d[_0xfc94('0x46')],'loggedIn':_0x33007d[_0xfc94('0x47')],'name':_0x33007d['name'],'paused':_0x33007d[_0xfc94('0x48')],'waiting':_0x33007d[_0xfc94('0x49')]};_0x4abb6c['push'](_0x382005);}}_0x602ad9({'count':_0x4abb6c[_0xfc94('0x17')],'rows':_0x4abb6c});});},'MailQueues':function(_0xbff0b8){return new Promise(function(_0x2eb28e,_0xf0281c){var _0x4dcda8=[];for(var _0x428b46 in _0x1da124[_0xfc94('0x4a')]){if(_0x1da124[_0xfc94('0x4a')][_0xfc94('0x40')](_0x428b46)){var _0x531c73=_0x1da124[_0xfc94('0x4a')][_0x428b46];var _0x226e57={'id':_0x531c73['id'],'available':_0x531c73[_0xfc94('0x46')],'loggedIn':_0x531c73['loggedIn'],'name':_0x531c73['name'],'paused':_0x531c73[_0xfc94('0x48')],'waiting':_0x531c73['waiting']};_0x4dcda8[_0xfc94('0x1e')](_0x226e57);}}_0x2eb28e({'count':_0x4dcda8[_0xfc94('0x17')],'rows':_0x4dcda8});});},'OpenchannelQueues':function(_0x361a79){return new Promise(function(_0x4b26ca,_0x5833eb){var _0x5063ac=[];for(var _0x4cdefc in _0x1da124['openchannelQueues']){if(_0x1da124[_0xfc94('0x4b')][_0xfc94('0x40')](_0x4cdefc)){var _0x43ee61=_0x1da124[_0xfc94('0x4b')][_0x4cdefc];var _0x1337dd={'id':_0x43ee61['id'],'available':_0x43ee61['available'],'loggedIn':_0x43ee61[_0xfc94('0x47')],'name':_0x43ee61[_0xfc94('0x4c')],'paused':_0x43ee61[_0xfc94('0x48')],'waiting':_0x43ee61[_0xfc94('0x49')]};_0x5063ac[_0xfc94('0x1e')](_0x1337dd);}}_0x4b26ca({'count':_0x5063ac[_0xfc94('0x17')],'rows':_0x5063ac});});},'SmsQueues':function(_0x194fe5){return new Promise(function(_0x52227b,_0x1448de){var _0x5f3b47=[];for(var _0x3e0ea3 in _0x1da124[_0xfc94('0x4d')]){if(_0x1da124['smsQueues'][_0xfc94('0x40')](_0x3e0ea3)){var _0x5a544d=_0x1da124['smsQueues'][_0x3e0ea3];var _0x52eba1={'id':_0x5a544d['id'],'available':_0x5a544d[_0xfc94('0x46')],'loggedIn':_0x5a544d['loggedIn'],'name':_0x5a544d['name'],'paused':_0x5a544d['paused'],'waiting':_0x5a544d[_0xfc94('0x49')]};_0x5f3b47[_0xfc94('0x1e')](_0x52eba1);}}_0x52227b({'count':_0x5f3b47['length'],'rows':_0x5f3b47});});},'FaxQueues':function(_0x29d440){return new Promise(function(_0xbd9e5d,_0x19cca9){var _0x209ed7=[];for(var _0x4ee43f in _0x1da124[_0xfc94('0x4e')]){if(_0x1da124[_0xfc94('0x4e')][_0xfc94('0x40')](_0x4ee43f)){var _0x56848d=_0x1da124[_0xfc94('0x4e')][_0x4ee43f];var _0x318048={'id':_0x56848d['id'],'available':_0x56848d[_0xfc94('0x46')],'loggedIn':_0x56848d[_0xfc94('0x47')],'name':_0x56848d[_0xfc94('0x4c')],'paused':_0x56848d[_0xfc94('0x48')],'waiting':_0x56848d[_0xfc94('0x49')]};_0x209ed7['push'](_0x318048);}}_0xbd9e5d({'count':_0x209ed7[_0xfc94('0x17')],'rows':_0x209ed7});});},'ChatQueuesWaitingInteractions':function(_0x264ad1){return new Promise(function(_0x17ef3a,_0x2906bd){var _0x290ae4=_[_0xfc94('0x44')](_0x1da124[_0xfc94('0x4f')]);_0x17ef3a({'count':_0x290ae4['length'],'rows':_0x290ae4});});},'MailQueuesWaitingInteractions':function(_0x334bd0){return new Promise(function(_0x2f83ef,_0x515f15){var _0x249e53=_[_0xfc94('0x44')](_0x1da124['mailQueuesWaitingInteractions']);_0x2f83ef({'count':_0x249e53[_0xfc94('0x17')],'rows':_0x249e53});});},'OpenchannelQueuesWaitingInteractions':function(_0x1d6a05){return new Promise(function(_0xa307ae,_0x2579e1){var _0x36fe9a=_[_0xfc94('0x44')](_0x1da124[_0xfc94('0x50')]);_0xa307ae({'count':_0x36fe9a[_0xfc94('0x17')],'rows':_0x36fe9a});});},'SmsQueuesWaitingInteractions':function(_0x176a27){return new Promise(function(_0x28e923,_0xf637c0){var _0x5e0472=_[_0xfc94('0x44')](_0x1da124[_0xfc94('0x51')]);_0x28e923({'count':_0x5e0472[_0xfc94('0x17')],'rows':_0x5e0472});});},'FaxQueuesWaitingInteractions':function(_0x368626){return new Promise(function(_0xdb029f,_0x3746e3){var _0x3910b6=_[_0xfc94('0x44')](_0x1da124[_0xfc94('0x52')]);_0xdb029f({'count':_0x3910b6[_0xfc94('0x17')],'rows':_0x3910b6});});}};var _0x451569=jayson['server'](_0x3eae2f)[_0xfc94('0x53')]();_0x451569['on'](_0xfc94('0x2f'),function(_0x42f2b4){logger[_0xfc94('0x2f')](JSON[_0xfc94('0x32')](_0x42f2b4));return _0x4bab3a(_0x42f2b4);});_0x451569[_0xfc94('0x10')](0x232c,_0xfc94('0x54'),function(){console['log'](_0xfc94('0x55'),0x232c);return _0x431cb7(_0xfc94('0x56')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index b29924a..ad8f4c8 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 _0x0133=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','indexOf'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x0133,0x1ad));var _0x3013=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x0133[_0xf71120];return _0xbe2fd3;};'use strict';var util=require(_0x3013('0x0'));var BPromise=require(_0x3013('0x1'));var jayson=require(_0x3013('0x2'));var _=require(_0x3013('0x3'));var logger=require(_0x3013('0x4'))(_0x3013('0x5'));var client=jayson[_0x3013('0x6')][_0x3013('0x7')]({'port':0x232a});function request(_0x5e9ebc,_0x2c9061){return new BPromise(function(_0x3ca5a0,_0x5765f6){return client[_0x3013('0x8')](_0x5e9ebc,_0x2c9061)[_0x3013('0x9')](function(_0x462e06){if(_0x462e06[_0x3013('0xa')]){return _0x5765f6(_0x462e06[_0x3013('0xa')][_0x3013('0xb')]);}else{return _0x3ca5a0(_0x462e06['result']);}})[_0x3013('0xc')](function(_0x5904b9){return _0x5765f6(_0x5904b9);});});}exports[_0x3013('0xd')]=function(_0x1fc9ee,_0x3dd8c0,_0xf3c7a){return function(_0x17fcb7){if(_0xf3c7a[_0x3013('0xe')]&&!_0xf3c7a[_0x3013('0xe')][_0x1fc9ee]){logger[_0x3013('0xf')](_0x3013('0x10'),_0x1fc9ee);return _0x17fcb7['stop']();}var _0x371823=[];for(var _0x5183ed=0x0;_0x5183ed<_0x3dd8c0[_0x3013('0x11')];_0x5183ed+=0x1){_0x371823[_0x3013('0x12')](request(_0x3013('0x13'),{'command':util['format']('iftime\x20%s',_0x3dd8c0[_0x5183ed])})['then'](function(_0x309310){return _0x309310&&_0x309310[_0x3013('0xb')]&&_0x309310['message'][_0x3013('0x14')](_0x3013('0x15'))>=0x0?!![]:![];})[_0x3013('0xc')](function(_0x2537cd){logger[_0x3013('0xa')](_0x3013('0x16'),_0x1fc9ee,_0x3dd8c0[_0x5183ed]);}));}BPromise[_0x3013('0x17')](_0x371823)[_0x3013('0x9')](function(_0x558c10){var _0x5ec922=_[_0x3013('0x18')](_0x558c10);logger[_0x3013('0xf')](_0x3013('0x19'),_0x1fc9ee,_0x3dd8c0[_0x3013('0x1a')](_0x3013('0x1b')),_0x5ec922);_0x17fcb7['when'](_0x5ec922);})[_0x3013('0xc')](function(_0x1af426){console[_0x3013('0x1c')](_0x1af426);logger['error'](_0x3013('0x19'),_0x1fc9ee,_0x3dd8c0[_0x3013('0x1a')](_0x3013('0x1b')),_0x1af426['stack']);_0x17fcb7[_0x3013('0x1d')]();});};}; \ No newline at end of file +var _0x8fc8=['iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','routing','client','http','request','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command'];(function(_0x271e26,_0xeaa798){var _0x4c3771=function(_0x594c71){while(--_0x594c71){_0x271e26['push'](_0x271e26['shift']());}};_0x4c3771(++_0xeaa798);}(_0x8fc8,0x12d));var _0x88fc=function(_0x3ea9bf,_0x42909d){_0x3ea9bf=_0x3ea9bf-0x0;var _0x976b8c=_0x8fc8[_0x3ea9bf];return _0x976b8c;};'use strict';var util=require(_0x88fc('0x0'));var BPromise=require(_0x88fc('0x1'));var jayson=require(_0x88fc('0x2'));var _=require(_0x88fc('0x3'));var logger=require('../../../config/logger')(_0x88fc('0x4'));var client=jayson[_0x88fc('0x5')][_0x88fc('0x6')]({'port':0x232a});function request(_0x2dccff,_0x27376c){return new BPromise(function(_0x251a45,_0x48e798){return client[_0x88fc('0x7')](_0x2dccff,_0x27376c)['then'](function(_0x326f92){if(_0x326f92[_0x88fc('0x8')]){return _0x48e798(_0x326f92[_0x88fc('0x8')][_0x88fc('0x9')]);}else{return _0x251a45(_0x326f92[_0x88fc('0xa')]);}})[_0x88fc('0xb')](function(_0x3ec0ff){return _0x48e798(_0x3ec0ff);});});}exports[_0x88fc('0xc')]=function(_0x31a852,_0x168bf3,_0x54f7b3){return function(_0x41fef7){if(_0x54f7b3[_0x88fc('0xd')]&&!_0x54f7b3[_0x88fc('0xd')][_0x31a852]){logger['info'](_0x88fc('0xe'),_0x31a852);return _0x41fef7[_0x88fc('0xf')]();}var _0x497810=[];for(var _0xf87271=0x0;_0xf87271<_0x168bf3[_0x88fc('0x10')];_0xf87271+=0x1){_0x497810[_0x88fc('0x11')](request(_0x88fc('0x12'),{'command':util['format'](_0x88fc('0x13'),_0x168bf3[_0xf87271])})[_0x88fc('0x14')](function(_0x1c1d69){return _0x1c1d69&&_0x1c1d69[_0x88fc('0x9')]&&_0x1c1d69['message'][_0x88fc('0x15')](_0x88fc('0x16'))>=0x0?!![]:![];})['catch'](function(_0x550342){logger[_0x88fc('0x8')](_0x88fc('0x17'),_0x31a852,_0x168bf3[_0xf87271]);}));}BPromise[_0x88fc('0x18')](_0x497810)[_0x88fc('0x14')](function(_0x5ebd85){var _0x3d7ab4=_[_0x88fc('0x19')](_0x5ebd85);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x31a852,_0x168bf3[_0x88fc('0x1a')](_0x88fc('0x1b')),_0x3d7ab4);_0x41fef7[_0x88fc('0x1c')](_0x3d7ab4);})['catch'](function(_0x5bc78f){console[_0x88fc('0x1d')](_0x5bc78f);logger[_0x88fc('0x8')](_0x88fc('0x1e'),_0x31a852,_0x168bf3[_0x88fc('0x1a')](_0x88fc('0x1b')),_0x5bc78f[_0x88fc('0x1f')]);_0x41fef7['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 0666910..ad190af 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 _0x5a97=['AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','now','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','isNil','rejected','reason','holdtime','ringtime','talktime','forIn','agentringnoanswerAt','abandoned','agentconnect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','blind','extension','transferuniqueid','attendedtransfer','origtransfererlinkedid','transfer','secondtransfereruniqueid','ATTENDED','transferexten','origtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertype','transfertargetuniqueid','hangup','agent','util','./utils','info','format'];(function(_0x2b31d0,_0x268765){var _0x290bad=function(_0x28d95b){while(--_0x28d95b){_0x2b31d0['push'](_0x2b31d0['shift']());}};_0x290bad(++_0x268765);}(_0x5a97,0x1d8));var _0x75a9=function(_0x2a1035,_0x149d5f){_0x2a1035=_0x2a1035-0x0;var _0x519257=_0x5a97[_0x2a1035];return _0x519257;};'use strict';var _=require('lodash');var util=require(_0x75a9('0x0'));var utils=require(_0x75a9('0x1'));var agents={};var transfers={};function writeDB(_0x4cae2d,_0x4e2cc4){utils[_0x75a9('0x2')](util[_0x75a9('0x3')](_0x75a9('0x4'),_0x4cae2d['uniqueid'],_0x4cae2d[_0x75a9('0x5')],_0x4cae2d[_0x75a9('0x6')],_0x4cae2d[_0x75a9('0x7')],_0x4cae2d[_0x75a9('0x8')],_0x4cae2d[_0x75a9('0x9')],_0x4cae2d['connectedlinenum'],_0x4cae2d[_0x75a9('0xa')]));if(_0x4cae2d[_0x75a9('0x6')]){utils[_0x75a9('0xb')](_0x4cae2d[_0x75a9('0x6')])[_0x75a9('0xc')](function(_0x38a750){if(_0x38a750){_0x4cae2d[_0x75a9('0xd')]=_0x38a750[_0x75a9('0xd')];_0x4cae2d[_0x75a9('0xe')]=_0x4cae2d[_0x75a9('0xf')]?_0x38a750[_0x75a9('0x10')]:![];_0x4cae2d[_0x75a9('0x11')]=_0x4cae2d['agentacw']?_0x38a750[_0x75a9('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x4cae2d);});}else{utils[_0x75a9('0x13')](_0x75a9('0x14'),_0x4cae2d);}if(_0x4e2cc4){delete transfers[_0x4cae2d[_0x75a9('0x15')]];}else{delete agents[_0x4cae2d[_0x75a9('0x16')]];}}exports[_0x75a9('0x17')]=function(_0x1f83e7){try{agents[_0x1f83e7[_0x75a9('0x16')]]=_0x1f83e7;agents[_0x1f83e7[_0x75a9('0x16')]]['agentcalledAt']=utils[_0x75a9('0x18')]();agents[_0x1f83e7['destuniqueid']]['lastevent']='called';agents[_0x1f83e7[_0x75a9('0x16')]][_0x75a9('0x19')]=null;agents[_0x1f83e7[_0x75a9('0x16')]][_0x75a9('0x1a')]=null;}catch(_0x353103){utils[_0x75a9('0x1b')](_0x353103[_0x75a9('0x1c')]);}};exports[_0x75a9('0x1d')]=function(_0x24c5f7){try{if(!_[_0x75a9('0x1e')](agents[_0x24c5f7[_0x75a9('0x16')]])){agents[_0x24c5f7[_0x75a9('0x16')]][_0x75a9('0x1d')]=!![];agents[_0x24c5f7[_0x75a9('0x16')]]['agentringnoanswerAt']=utils['now']();agents[_0x24c5f7[_0x75a9('0x16')]]['lastevent']=_0x75a9('0x1f');agents[_0x24c5f7['destuniqueid']][_0x75a9('0x20')]='rejected';agents[_0x24c5f7[_0x75a9('0x16')]][_0x75a9('0x21')]=_0x24c5f7['ringtime']?parseInt(_0x24c5f7[_0x75a9('0x22')])/0x3e8:0x0;agents[_0x24c5f7[_0x75a9('0x16')]][_0x75a9('0x23')]=0x0;writeDB(agents[_0x24c5f7[_0x75a9('0x16')]]);}}catch(_0x3afc7c){utils[_0x75a9('0x1b')](_0x3afc7c[_0x75a9('0x1c')]);}};exports['queuecallerabandon']=function(_0x2e05d7){try{_[_0x75a9('0x24')](agents,function(_0x4e308f,_0x555ab1){if(_0x4e308f[_0x75a9('0x15')]==_0x2e05d7[_0x75a9('0x15')]){_0x4e308f['agentringnoanswer']=!![];_0x4e308f[_0x75a9('0x25')]=utils[_0x75a9('0x18')]();_0x4e308f['lastevent']=_0x75a9('0x26');_0x4e308f[_0x75a9('0x20')]=_0x75a9('0x26');_0x4e308f[_0x75a9('0x21')]=_0x2e05d7[_0x75a9('0x21')];_0x4e308f[_0x75a9('0x23')]=0x0;writeDB(_0x4e308f);}});}catch(_0x2f9d8d){utils[_0x75a9('0x1b')](_0x2f9d8d['stack']);}};exports[_0x75a9('0x27')]=function(_0x5077f7){try{if(agents[_0x5077f7['destuniqueid']]){agents[_0x5077f7[_0x75a9('0x16')]][_0x75a9('0x28')]=utils[_0x75a9('0x18')]();agents[_0x5077f7['destuniqueid']][_0x75a9('0x19')]=_0x5077f7['connectedlinenum'];agents[_0x5077f7[_0x75a9('0x16')]][_0x75a9('0x1a')]=_0x5077f7['connectedlinename'];agents[_0x5077f7[_0x75a9('0x16')]][_0x75a9('0x21')]=_0x5077f7[_0x75a9('0x22')];agents[_0x5077f7[_0x75a9('0x16')]][_0x75a9('0xa')]='connect';_[_0x75a9('0x24')](agents,function(_0xfed1e4,_0x27f15a){if(_0xfed1e4['destuniqueid']!=_0x5077f7[_0x75a9('0x16')]&&_0xfed1e4[_0x75a9('0x15')]==_0x5077f7[_0x75a9('0x15')]){_0xfed1e4[_0x75a9('0x23')]=0x0;_0xfed1e4['holdtime']=_0x5077f7[_0x75a9('0x22')];_0xfed1e4[_0x75a9('0x1d')]=!![];_0xfed1e4[_0x75a9('0x25')]=utils[_0x75a9('0x18')]();_0xfed1e4['lastevent']='answered_elsewhere';_0xfed1e4[_0x75a9('0x20')]=_0x75a9('0x29');_0xfed1e4[_0x75a9('0x2a')]=_0x5077f7['destuniqueid'];_0xfed1e4[_0x75a9('0x2b')]=_0x5077f7[_0x75a9('0x7')];writeDB(_0xfed1e4);}});}}catch(_0x3c2367){utils[_0x75a9('0x1b')](_0x3c2367[_0x75a9('0x1c')]);}};exports['agentcomplete']=function(_0x49f27b){try{if(!_[_0x75a9('0x1e')](agents[_0x49f27b[_0x75a9('0x16')]])){agents[_0x49f27b['destuniqueid']][_0x75a9('0xf')]=!![];agents[_0x49f27b[_0x75a9('0x16')]]['agentcompleteAt']=utils[_0x75a9('0x18')]();agents[_0x49f27b[_0x75a9('0x16')]][_0x75a9('0x23')]=utils[_0x75a9('0x2c')](agents[_0x49f27b[_0x75a9('0x16')]][_0x75a9('0x2d')],agents[_0x49f27b[_0x75a9('0x16')]]['agentconnectAt']);agents[_0x49f27b[_0x75a9('0x16')]][_0x75a9('0x20')]=_0x49f27b[_0x75a9('0x20')];agents[_0x49f27b[_0x75a9('0x16')]]['lastevent']=_0x75a9('0x2e');writeDB(agents[_0x49f27b[_0x75a9('0x16')]]);}}catch(_0x16c244){utils[_0x75a9('0x1b')](_0x16c244[_0x75a9('0x1c')]);}};exports[_0x75a9('0x2f')]=function(_0x4d10e0){try{if(!_[_0x75a9('0x1e')](agents[_0x4d10e0[_0x75a9('0x30')]])){agents[_0x4d10e0[_0x75a9('0x30')]]['transfer']=!![];agents[_0x4d10e0['transfereruniqueid']]['transfertype']=_0x75a9('0x31');agents[_0x4d10e0[_0x75a9('0x30')]]['transferexten']=_0x4d10e0[_0x75a9('0x32')];agents[_0x4d10e0[_0x75a9('0x30')]][_0x75a9('0x33')]=agents[_0x4d10e0['transfereruniqueid']]['uniqueid'];}}catch(_0x37eed7){utils['error'](_0x37eed7['stack']);}};exports[_0x75a9('0x34')]=function(_0x178529){try{if(_0x178529['origtransfereruniqueid']==_0x178529[_0x75a9('0x35')]){if(!_[_0x75a9('0x1e')](agents[_0x178529['secondtransfereruniqueid']])){agents[_0x178529['secondtransfereruniqueid']][_0x75a9('0x36')]=!![];agents[_0x178529[_0x75a9('0x37')]]['transfertype']=_0x75a9('0x38');agents[_0x178529[_0x75a9('0x37')]][_0x75a9('0x39')]=_0x178529['origtransfererexten'];agents[_0x178529[_0x75a9('0x37')]]['transferuniqueid']=_0x178529[_0x75a9('0x3a')];}if(_0x178529[_0x75a9('0x3b')]&&agents[_0x178529[_0x75a9('0x3b')]]){agents[_0x178529[_0x75a9('0x3b')]][_0x75a9('0x3c')]=0x1;transfers[_0x178529[_0x75a9('0x3b')]]=_[_0x75a9('0x3d')](agents[_0x178529[_0x75a9('0x3b')]]);transfers[_0x178529['transfereeuniqueid']][_0x75a9('0x9')]=agents[_0x178529[_0x75a9('0x37')]][_0x75a9('0x9')];transfers[_0x178529[_0x75a9('0x3b')]][_0x75a9('0x3e')]=agents[_0x178529[_0x75a9('0x37')]][_0x75a9('0x3e')];transfers[_0x178529[_0x75a9('0x3b')]][_0x75a9('0x3f')]=utils[_0x75a9('0x18')]();transfers[_0x178529[_0x75a9('0x3b')]][_0x75a9('0x28')]=utils[_0x75a9('0x18')]();transfers[_0x178529[_0x75a9('0x3b')]][_0x75a9('0x21')]=0x0;transfers[_0x178529[_0x75a9('0x3b')]][_0x75a9('0x3c')]=0x2;}}else if(_0x178529[_0x75a9('0x37')]==_0x178529['secondtransfererlinkedid']){if(!_[_0x75a9('0x1e')](agents[_0x178529['origtransfereruniqueid']])){agents[_0x178529[_0x75a9('0x3a')]][_0x75a9('0x36')]=!![];agents[_0x178529['origtransfereruniqueid']][_0x75a9('0x40')]='ATTENDED';agents[_0x178529[_0x75a9('0x3a')]][_0x75a9('0x39')]=_0x178529['secondtransfererexten'];agents[_0x178529[_0x75a9('0x3a')]][_0x75a9('0x33')]=_0x178529[_0x75a9('0x37')];}if(_0x178529['transfertargetuniqueid']&&agents[_0x178529['transfertargetuniqueid']]){agents[_0x178529['transfertargetuniqueid']][_0x75a9('0x3c')]=0x1;transfers[_0x178529[_0x75a9('0x41')]]=_[_0x75a9('0x3d')](agents[_0x178529['transfertargetuniqueid']]);transfers[_0x178529[_0x75a9('0x41')]][_0x75a9('0x9')]=agents[_0x178529[_0x75a9('0x3a')]]['calleridnum'];transfers[_0x178529[_0x75a9('0x41')]]['calleridname']=agents[_0x178529[_0x75a9('0x3a')]]['calleridname'];transfers[_0x178529['transfertargetuniqueid']][_0x75a9('0x3f')]=utils[_0x75a9('0x18')]();transfers[_0x178529[_0x75a9('0x41')]][_0x75a9('0x28')]=utils[_0x75a9('0x18')]();transfers[_0x178529['transfertargetuniqueid']][_0x75a9('0x21')]=0x0;transfers[_0x178529['transfertargetuniqueid']][_0x75a9('0x3c')]=0x2;}}}catch(_0x4b7cad){utils[_0x75a9('0x1b')](_0x4b7cad[_0x75a9('0x1c')]);}};exports[_0x75a9('0x42')]=function(_0x336b0d){try{if(transfers[_0x336b0d[_0x75a9('0x15')]]){transfers[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0xf')]=!![];transfers[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x2d')]=utils[_0x75a9('0x18')]();transfers[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x23')]=utils[_0x75a9('0x2c')](transfers[_0x336b0d['uniqueid']][_0x75a9('0x2d')],transfers[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x28')]);transfers[_0x336b0d['uniqueid']][_0x75a9('0x20')]=_0x75a9('0x43');transfers[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0xa')]=_0x75a9('0x2e');writeDB(transfers[_0x336b0d[_0x75a9('0x15')]],!![]);}if(agents[_0x336b0d['uniqueid']]&&agents[_0x336b0d['uniqueid']][_0x75a9('0x28')]){agents[_0x336b0d['uniqueid']][_0x75a9('0xf')]=!![];agents[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x2d')]=utils[_0x75a9('0x18')]();agents[_0x336b0d[_0x75a9('0x15')]]['talktime']=utils[_0x75a9('0x2c')](agents[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x2d')],agents[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x28')]);agents[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x20')]=agents[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0x36')]?'transfer':_0x75a9('0x43');agents[_0x336b0d[_0x75a9('0x15')]][_0x75a9('0xa')]=_0x75a9('0x2e');writeDB(agents[_0x336b0d[_0x75a9('0x15')]]);}}catch(_0x3ee7d5){utils[_0x75a9('0x1b')](_0x3ee7d5['stack']);}}; \ No newline at end of file +var _0x3ba6=['channel','queue','membername','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','rejected','holdtime','ringtime','talktime','queuecallerabandon','forIn','abandoned','reason','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','origtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','agent','transfer','complete','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid'];(function(_0x4a509f,_0xe14c8d){var _0x15d990=function(_0x424bd1){while(--_0x424bd1){_0x4a509f['push'](_0x4a509f['shift']());}};_0x15d990(++_0xe14c8d);}(_0x3ba6,0xcf));var _0x63ba=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x3ba6[_0x7b173];return _0x1c598c;};'use strict';var _=require(_0x63ba('0x0'));var util=require(_0x63ba('0x1'));var utils=require(_0x63ba('0x2'));var agents={};var transfers={};function writeDB(_0x559686,_0x32a426){utils[_0x63ba('0x3')](util['format'](_0x63ba('0x4'),_0x559686[_0x63ba('0x5')],_0x559686[_0x63ba('0x6')],_0x559686[_0x63ba('0x7')],_0x559686[_0x63ba('0x8')],_0x559686['interface'],_0x559686[_0x63ba('0x9')],_0x559686['connectedlinenum'],_0x559686[_0x63ba('0xa')]));if(_0x559686[_0x63ba('0x7')]){utils[_0x63ba('0xb')](_0x559686['queue'])[_0x63ba('0xc')](function(_0x4326d6){if(_0x4326d6){_0x559686[_0x63ba('0xd')]=_0x4326d6[_0x63ba('0xd')];_0x559686[_0x63ba('0xe')]=_0x559686['agentcomplete']?_0x4326d6[_0x63ba('0xf')]:![];_0x559686[_0x63ba('0x10')]=_0x559686['agentacw']?_0x4326d6[_0x63ba('0x11')]:0x0;}utils[_0x63ba('0x12')](_0x63ba('0x13'),_0x559686);});}else{utils[_0x63ba('0x12')](_0x63ba('0x13'),_0x559686);}if(_0x32a426){delete transfers[_0x559686[_0x63ba('0x5')]];}else{delete agents[_0x559686[_0x63ba('0x14')]];}}exports[_0x63ba('0x15')]=function(_0x5a447a){try{agents[_0x5a447a[_0x63ba('0x14')]]=_0x5a447a;agents[_0x5a447a[_0x63ba('0x14')]][_0x63ba('0x16')]=utils[_0x63ba('0x17')]();agents[_0x5a447a[_0x63ba('0x14')]][_0x63ba('0xa')]='called';agents[_0x5a447a['destuniqueid']][_0x63ba('0x18')]=null;agents[_0x5a447a[_0x63ba('0x14')]][_0x63ba('0x19')]=null;}catch(_0x40a81b){utils[_0x63ba('0x1a')](_0x40a81b[_0x63ba('0x1b')]);}};exports[_0x63ba('0x1c')]=function(_0x4e42a0){try{if(!_[_0x63ba('0x1d')](agents[_0x4e42a0[_0x63ba('0x14')]])){agents[_0x4e42a0[_0x63ba('0x14')]]['agentringnoanswer']=!![];agents[_0x4e42a0[_0x63ba('0x14')]][_0x63ba('0x1e')]=utils[_0x63ba('0x17')]();agents[_0x4e42a0[_0x63ba('0x14')]][_0x63ba('0xa')]=_0x63ba('0x1f');agents[_0x4e42a0[_0x63ba('0x14')]]['reason']=_0x63ba('0x1f');agents[_0x4e42a0[_0x63ba('0x14')]][_0x63ba('0x20')]=_0x4e42a0[_0x63ba('0x21')]?parseInt(_0x4e42a0['ringtime'])/0x3e8:0x0;agents[_0x4e42a0[_0x63ba('0x14')]][_0x63ba('0x22')]=0x0;writeDB(agents[_0x4e42a0['destuniqueid']]);}}catch(_0x5be400){utils[_0x63ba('0x1a')](_0x5be400['stack']);}};exports[_0x63ba('0x23')]=function(_0x191e23){try{_[_0x63ba('0x24')](agents,function(_0x589bce,_0x5d9be5){if(_0x589bce[_0x63ba('0x5')]==_0x191e23[_0x63ba('0x5')]){_0x589bce[_0x63ba('0x1c')]=!![];_0x589bce[_0x63ba('0x1e')]=utils[_0x63ba('0x17')]();_0x589bce[_0x63ba('0xa')]=_0x63ba('0x25');_0x589bce[_0x63ba('0x26')]=_0x63ba('0x25');_0x589bce[_0x63ba('0x20')]=_0x191e23[_0x63ba('0x20')];_0x589bce['talktime']=0x0;writeDB(_0x589bce);}});}catch(_0x4e5936){utils[_0x63ba('0x1a')](_0x4e5936[_0x63ba('0x1b')]);}};exports[_0x63ba('0x27')]=function(_0x18e613){try{if(agents[_0x18e613[_0x63ba('0x14')]]){agents[_0x18e613[_0x63ba('0x14')]][_0x63ba('0x28')]=utils[_0x63ba('0x17')]();agents[_0x18e613['destuniqueid']][_0x63ba('0x18')]=_0x18e613['connectedlinenum'];agents[_0x18e613[_0x63ba('0x14')]][_0x63ba('0x19')]=_0x18e613[_0x63ba('0x19')];agents[_0x18e613[_0x63ba('0x14')]][_0x63ba('0x20')]=_0x18e613['ringtime'];agents[_0x18e613[_0x63ba('0x14')]][_0x63ba('0xa')]=_0x63ba('0x29');_['forIn'](agents,function(_0x46e1de,_0x513321){if(_0x46e1de['destuniqueid']!=_0x18e613[_0x63ba('0x14')]&&_0x46e1de[_0x63ba('0x5')]==_0x18e613['uniqueid']){_0x46e1de['talktime']=0x0;_0x46e1de['holdtime']=_0x18e613[_0x63ba('0x21')];_0x46e1de[_0x63ba('0x1c')]=!![];_0x46e1de[_0x63ba('0x1e')]=utils[_0x63ba('0x17')]();_0x46e1de[_0x63ba('0xa')]=_0x63ba('0x2a');_0x46e1de[_0x63ba('0x26')]=_0x63ba('0x2a');_0x46e1de[_0x63ba('0x2b')]=_0x18e613[_0x63ba('0x14')];_0x46e1de[_0x63ba('0x2c')]=_0x18e613[_0x63ba('0x8')];writeDB(_0x46e1de);}});}}catch(_0x1e7302){utils[_0x63ba('0x1a')](_0x1e7302['stack']);}};exports[_0x63ba('0x2d')]=function(_0x27e07d){try{if(!_[_0x63ba('0x1d')](agents[_0x27e07d['destuniqueid']])){agents[_0x27e07d['destuniqueid']][_0x63ba('0x2d')]=!![];agents[_0x27e07d[_0x63ba('0x14')]][_0x63ba('0x2e')]=utils[_0x63ba('0x17')]();agents[_0x27e07d[_0x63ba('0x14')]][_0x63ba('0x22')]=utils[_0x63ba('0x2f')](agents[_0x27e07d['destuniqueid']][_0x63ba('0x2e')],agents[_0x27e07d['destuniqueid']][_0x63ba('0x28')]);agents[_0x27e07d[_0x63ba('0x14')]][_0x63ba('0x26')]=_0x27e07d[_0x63ba('0x26')];agents[_0x27e07d[_0x63ba('0x14')]][_0x63ba('0xa')]='complete';writeDB(agents[_0x27e07d['destuniqueid']]);}}catch(_0x35f757){utils[_0x63ba('0x1a')](_0x35f757[_0x63ba('0x1b')]);}};exports[_0x63ba('0x30')]=function(_0x14e5b4){try{if(!_[_0x63ba('0x1d')](agents[_0x14e5b4[_0x63ba('0x31')]])){agents[_0x14e5b4[_0x63ba('0x31')]]['transfer']=!![];agents[_0x14e5b4[_0x63ba('0x31')]][_0x63ba('0x32')]=_0x63ba('0x33');agents[_0x14e5b4[_0x63ba('0x31')]][_0x63ba('0x34')]=_0x14e5b4[_0x63ba('0x35')];agents[_0x14e5b4['transfereruniqueid']][_0x63ba('0x36')]=agents[_0x14e5b4[_0x63ba('0x31')]]['uniqueid'];}}catch(_0x2f98f8){utils[_0x63ba('0x1a')](_0x2f98f8[_0x63ba('0x1b')]);}};exports['attendedtransfer']=function(_0x1de3fe){try{if(_0x1de3fe['origtransfereruniqueid']==_0x1de3fe[_0x63ba('0x37')]){if(!_['isNil'](agents[_0x1de3fe[_0x63ba('0x38')]])){agents[_0x1de3fe[_0x63ba('0x38')]]['transfer']=!![];agents[_0x1de3fe[_0x63ba('0x38')]]['transfertype']=_0x63ba('0x39');agents[_0x1de3fe[_0x63ba('0x38')]][_0x63ba('0x34')]=_0x1de3fe[_0x63ba('0x3a')];agents[_0x1de3fe[_0x63ba('0x38')]]['transferuniqueid']=_0x1de3fe[_0x63ba('0x3b')];}if(_0x1de3fe[_0x63ba('0x3c')]&&agents[_0x1de3fe['transfereeuniqueid']]){agents[_0x1de3fe[_0x63ba('0x3c')]][_0x63ba('0x3d')]=0x1;transfers[_0x1de3fe['transfereeuniqueid']]=_[_0x63ba('0x3e')](agents[_0x1de3fe['transfereeuniqueid']]);transfers[_0x1de3fe[_0x63ba('0x3c')]][_0x63ba('0x9')]=agents[_0x1de3fe['secondtransfereruniqueid']]['calleridnum'];transfers[_0x1de3fe[_0x63ba('0x3c')]][_0x63ba('0x3f')]=agents[_0x1de3fe['secondtransfereruniqueid']][_0x63ba('0x3f')];transfers[_0x1de3fe[_0x63ba('0x3c')]][_0x63ba('0x16')]=utils[_0x63ba('0x17')]();transfers[_0x1de3fe[_0x63ba('0x3c')]][_0x63ba('0x28')]=utils['now']();transfers[_0x1de3fe['transfereeuniqueid']][_0x63ba('0x20')]=0x0;transfers[_0x1de3fe[_0x63ba('0x3c')]][_0x63ba('0x3d')]=0x2;}}else if(_0x1de3fe[_0x63ba('0x38')]==_0x1de3fe[_0x63ba('0x40')]){if(!_[_0x63ba('0x1d')](agents[_0x1de3fe[_0x63ba('0x3b')]])){agents[_0x1de3fe[_0x63ba('0x3b')]]['transfer']=!![];agents[_0x1de3fe[_0x63ba('0x3b')]][_0x63ba('0x32')]=_0x63ba('0x39');agents[_0x1de3fe[_0x63ba('0x3b')]][_0x63ba('0x34')]=_0x1de3fe[_0x63ba('0x41')];agents[_0x1de3fe[_0x63ba('0x3b')]][_0x63ba('0x36')]=_0x1de3fe[_0x63ba('0x38')];}if(_0x1de3fe[_0x63ba('0x42')]&&agents[_0x1de3fe[_0x63ba('0x42')]]){agents[_0x1de3fe[_0x63ba('0x42')]][_0x63ba('0x3d')]=0x1;transfers[_0x1de3fe[_0x63ba('0x42')]]=_[_0x63ba('0x3e')](agents[_0x1de3fe[_0x63ba('0x42')]]);transfers[_0x1de3fe['transfertargetuniqueid']][_0x63ba('0x9')]=agents[_0x1de3fe['origtransfereruniqueid']][_0x63ba('0x9')];transfers[_0x1de3fe['transfertargetuniqueid']][_0x63ba('0x3f')]=agents[_0x1de3fe['origtransfereruniqueid']]['calleridname'];transfers[_0x1de3fe[_0x63ba('0x42')]][_0x63ba('0x16')]=utils[_0x63ba('0x17')]();transfers[_0x1de3fe[_0x63ba('0x42')]][_0x63ba('0x28')]=utils[_0x63ba('0x17')]();transfers[_0x1de3fe[_0x63ba('0x42')]][_0x63ba('0x20')]=0x0;transfers[_0x1de3fe[_0x63ba('0x42')]][_0x63ba('0x3d')]=0x2;}}}catch(_0x284697){utils[_0x63ba('0x1a')](_0x284697[_0x63ba('0x1b')]);}};exports[_0x63ba('0x43')]=function(_0x23e3a2){try{if(transfers[_0x23e3a2[_0x63ba('0x5')]]){transfers[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x2d')]=!![];transfers[_0x23e3a2[_0x63ba('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x23e3a2['uniqueid']]['talktime']=utils[_0x63ba('0x2f')](transfers[_0x23e3a2['uniqueid']][_0x63ba('0x2e')],transfers[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x28')]);transfers[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x26')]=_0x63ba('0x44');transfers[_0x23e3a2[_0x63ba('0x5')]]['lastevent']='complete';writeDB(transfers[_0x23e3a2[_0x63ba('0x5')]],!![]);}if(agents[_0x23e3a2[_0x63ba('0x5')]]&&agents[_0x23e3a2['uniqueid']][_0x63ba('0x28')]){agents[_0x23e3a2['uniqueid']][_0x63ba('0x2d')]=!![];agents[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x2e')]=utils[_0x63ba('0x17')]();agents[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x22')]=utils[_0x63ba('0x2f')](agents[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x2e')],agents[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x28')]);agents[_0x23e3a2[_0x63ba('0x5')]][_0x63ba('0x26')]=agents[_0x23e3a2[_0x63ba('0x5')]]['transfer']?_0x63ba('0x45'):_0x63ba('0x44');agents[_0x23e3a2['uniqueid']]['lastevent']=_0x63ba('0x46');writeDB(agents[_0x23e3a2['uniqueid']]);}}catch(_0xa369b3){utils[_0x63ba('0x1a')](_0xa369b3[_0x63ba('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a35f561..0e6b3c5 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 _0x32c0=['substring','lastIndexOf','includes','execif','gotoif','lastdata','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','source','destination','callerid','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','channel','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','stack','isNil','channelstate','systemanswertime','linkedid','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstop','musiconholdstartAt','mohtime','variable','xmd-originatecalleridnum','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','application','toLowerCase','startsWith','appdata','split'];(function(_0x12170a,_0x17bc58){var _0x4f69b9=function(_0x165749){while(--_0x165749){_0x12170a['push'](_0x12170a['shift']());}};_0x4f69b9(++_0x17bc58);}(_0x32c0,0x1e0));var _0x032c=function(_0x159825,_0x328b80){_0x159825=_0x159825-0x0;var _0x28e47a=_0x32c0[_0x159825];return _0x28e47a;};'use strict';var _=require(_0x032c('0x0'));var util=require('util');var utils=require(_0x032c('0x1'));var dispositions=[_0x032c('0x2'),_0x032c('0x3'),'FAILED','NO\x20ANSWER',_0x032c('0x2'),_0x032c('0x2'),_0x032c('0x4'),_0x032c('0x5'),_0x032c('0x3'),_0x032c('0x3'),_0x032c('0x3')];var channels={};function writeDB(_0x206d34){utils['info'](util[_0x032c('0x6')](_0x032c('0x7'),_0x206d34[_0x032c('0x8')],_0x206d34['channel'],_0x206d34['type'],_0x206d34['accountcode'],_0x206d34[_0x032c('0x9')],_0x206d34[_0x032c('0xa')],_0x206d34[_0x032c('0xb')],_0x206d34['disposition']));if(_0x206d34['accountcode']){utils[_0x032c('0xc')](_0x206d34[_0x032c('0xd')])[_0x032c('0xe')](function(_0x524791){if(_0x524791){_0x206d34[_0x032c('0xf')]=_0x524791['id'];}utils['request']('CreateVoiceCallReport',_0x206d34);});}else{utils[_0x032c('0x10')](_0x032c('0x11'),_0x206d34);}if(channels[_0x206d34[_0x032c('0x8')]]){delete channels[_0x206d34[_0x032c('0x8')]];}}exports[_0x032c('0x12')]=function(_0x52d0f0){try{if(_0x52d0f0[_0x032c('0x8')]==_0x52d0f0['linkedid']&&_0x52d0f0[_0x032c('0x13')]!=_0x032c('0x14')){channels[_0x52d0f0[_0x032c('0x8')]]={'uniqueid':_0x52d0f0[_0x032c('0x8')],'accountcode':_0x52d0f0['accountcode'],'source':_0x52d0f0[_0x032c('0x15')],'destination':_0x52d0f0[_0x032c('0x16')],'destinationcontext':_0x52d0f0[_0x032c('0x17')],'channel':_0x52d0f0[_0x032c('0x13')],'starttime':utils[_0x032c('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x032c('0x2'),'amaflags':_0x032c('0x19')};}}catch(_0x33852d){utils[_0x032c('0x1a')](_0x33852d[_0x032c('0x1b')]);}};exports['newstate']=function(_0x5f3295){try{if(!_[_0x032c('0x1c')](channels[_0x5f3295[_0x032c('0x8')]])&&_0x5f3295[_0x032c('0x1d')]==0x6){if(_[_0x032c('0x1c')](channels[_0x5f3295[_0x032c('0x8')]][_0x032c('0x1e')])){channels[_0x5f3295[_0x032c('0x8')]][_0x032c('0x1e')]=utils[_0x032c('0x18')]();}}else if(!_[_0x032c('0x1c')](channels[_0x5f3295[_0x032c('0x1f')]])&&_0x5f3295[_0x032c('0x1d')]==0x6&&_0x5f3295['context']!=_0x032c('0x20')){channels[_0x5f3295['linkedid']][_0x032c('0xd')]=_0x5f3295[_0x032c('0xd')];channels[_0x5f3295[_0x032c('0x1f')]][_0x032c('0x21')]=_0x5f3295[_0x032c('0x13')];if(_[_0x032c('0x1c')](channels[_0x5f3295[_0x032c('0x1f')]][_0x032c('0x22')])){channels[_0x5f3295[_0x032c('0x1f')]][_0x032c('0x22')]=utils['now']();}channels[_0x5f3295[_0x032c('0x1f')]]['disposition']=dispositions[_[_0x032c('0x23')](_0x5f3295[_0x032c('0x1d')])]||_0x032c('0x4');}}catch(_0x1704ca){utils[_0x032c('0x1a')](_0x1704ca[_0x032c('0x1b')]);}};exports[_0x032c('0x24')]=function(_0x5b54df){try{if(!_[_0x032c('0x1c')](channels[_0x5b54df[_0x032c('0x8')]])){if(_[_0x032c('0x1c')](channels[_0x5b54df[_0x032c('0x8')]]['callerid'])){channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0xb')]=_0x5b54df[_0x032c('0x25')]+'\x20<'+_0x5b54df[_0x032c('0x15')]+'>';}channels[_0x5b54df['uniqueid']][_0x032c('0x26')]=utils['now']();channels[_0x5b54df[_0x032c('0x8')]]['duration']=utils[_0x032c('0x27')](channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0x26')],channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0x28')]);channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0x29')]=channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0x22')]?utils[_0x032c('0x27')](channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0x26')],channels[_0x5b54df[_0x032c('0x8')]][_0x032c('0x22')]):0x0;writeDB(channels[_0x5b54df[_0x032c('0x8')]]);}}catch(_0x2c8c41){utils[_0x032c('0x1a')](_0x2c8c41['stack']);}};exports[_0x032c('0x2a')]=function(_0x24fed8){try{if(!_[_0x032c('0x1c')](channels[_0x24fed8['localtwolinkedid']])){if(channels[_0x24fed8[_0x032c('0x2b')]][_0x032c('0x13')]==_0x24fed8[_0x032c('0x2c')]){channels[_0x24fed8['localtwolinkedid']][_0x032c('0x21')]=_0x24fed8[_0x032c('0x2d')];channels[_0x24fed8[_0x032c('0x2b')]][_0x032c('0x2e')]=_0x032c('0x2f');}else if(channels[_0x24fed8['localtwolinkedid']]['channel']=_0x24fed8[_0x032c('0x30')]){channels[_0x24fed8['localtwolinkedid']][_0x032c('0x21')]=_0x24fed8['origtransfererchannel'];channels[_0x24fed8[_0x032c('0x2b')]]['userfield']=_0x032c('0x2f');}}}catch(_0x3f7880){utils[_0x032c('0x1a')](_0x3f7880[_0x032c('0x1b')]);}};exports['musiconholdstart']=function(_0x1c0064){try{if(!_[_0x032c('0x1c')](channels[_0x1c0064[_0x032c('0x8')]])){channels[_0x1c0064[_0x032c('0x8')]]['musiconholdstartAt']=utils[_0x032c('0x18')]();}}catch(_0x475736){utils[_0x032c('0x1a')](_0x475736[_0x032c('0x1b')]);}};exports[_0x032c('0x31')]=function(_0x1bcea9){try{if(!_[_0x032c('0x1c')](channels[_0x1bcea9[_0x032c('0x8')]])){if(!_[_0x032c('0x1c')](channels[_0x1bcea9['uniqueid']][_0x032c('0x32')])){channels[_0x1bcea9[_0x032c('0x8')]][_0x032c('0x33')]+=utils['diffTime'](utils[_0x032c('0x18')](),channels[_0x1bcea9['uniqueid']][_0x032c('0x32')]);delete channels[_0x1bcea9[_0x032c('0x8')]][_0x032c('0x32')];}}}catch(_0x44fbb2){utils[_0x032c('0x1a')](_0x44fbb2[_0x032c('0x1b')]);}};exports['varset']=function(_0x599991){try{if(!_[_0x032c('0x1c')](channels[_0x599991['uniqueid']])){if(!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')][_0x032c('0x35')])){channels[_0x599991[_0x032c('0x8')]]['source']=_0x599991[_0x032c('0x36')];}if(!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')]['xmd-phone'])){channels[_0x599991[_0x032c('0x8')]][_0x032c('0xa')]=_0x599991[_0x032c('0x36')];channels[_0x599991[_0x032c('0x8')]][_0x032c('0xb')]='\x22'+_0x599991['value']+_0x032c('0x37')+_0x599991[_0x032c('0x36')]+'>';}if(!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')][_0x032c('0x38')])||!_['isNil'](_0x599991['variable'][_0x032c('0x39')])){channels[_0x599991['uniqueid']][_0x032c('0xb')]=_0x599991[_0x032c('0x36')];}if(!_['isNil'](_0x599991['variable'][_0x032c('0x3a')])||!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')][_0x032c('0x3b')])){channels[_0x599991['uniqueid']][_0x032c('0x3c')]=_0x032c('0x3d');channels[_0x599991[_0x032c('0x8')]]['lastdata']=_0x599991[_0x032c('0x36')];channels[_0x599991[_0x032c('0x8')]][_0x032c('0x3e')]=!![];}if(!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')][_0x032c('0x3f')])){channels[_0x599991[_0x032c('0x8')]][_0x032c('0x40')]=_0x599991[_0x032c('0x36')];}if(!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')][_0x032c('0x41')])){channels[_0x599991[_0x032c('0x8')]][_0x032c('0x42')]=_0x599991[_0x032c('0x36')];}if(!_[_0x032c('0x1c')](_0x599991[_0x032c('0x34')][_0x032c('0x43')])){channels[_0x599991[_0x032c('0x8')]]['routeid']=_0x599991[_0x032c('0x36')];}if(!_[_0x032c('0x1c')](_0x599991['variable']['sipcallid'])){channels[_0x599991[_0x032c('0x8')]]['sipcallid']=_0x599991[_0x032c('0x36')];}}}catch(_0x221918){utils['error'](_0x221918['stack']);}};exports['newexten']=function(_0x15b5c9){try{if(!_[_0x032c('0x1c')](channels[_0x15b5c9['uniqueid']])){if(_0x15b5c9[_0x032c('0x44')][_0x032c('0x45')]()=='set'&&_[_0x032c('0x46')](_0x15b5c9[_0x032c('0x47')][_0x032c('0x45')](),'cdr')){var _0x55913c=_0x15b5c9[_0x032c('0x47')][_0x032c('0x48')]('=');var _0x5170f0=_0x55913c[0x0][_0x032c('0x49')](_0x55913c[0x0][_0x032c('0x4a')]('(')+0x1,_0x55913c[0x0][_0x032c('0x4a')](')'));var _0x2918c0=_0x55913c[0x1];channels[_0x15b5c9[_0x032c('0x8')]][_0x5170f0]=_0x2918c0;}if(!_[_0x032c('0x4b')]([_0x032c('0x24'),'noop',_0x032c('0x4c'),'set',_0x032c('0x4d')],_0x15b5c9[_0x032c('0x44')][_0x032c('0x45')]())){channels[_0x15b5c9['uniqueid']][_0x032c('0x3c')]=_0x15b5c9['application'];channels[_0x15b5c9[_0x032c('0x8')]][_0x032c('0x4e')]=_0x15b5c9['appdata'];}}}catch(_0x3bbba3){utils[_0x032c('0x1a')](_0x3bbba3[_0x032c('0x1b')]);}}; \ No newline at end of file +var _0x834b=['xmd-callerid','xmd-queue','lastapplication','Queue','queue','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','source','destination','callerid','disposition','accountcode','then','request','CreateVoiceCallReport','OutgoingSpoolFailed','calleridnum','context','error','stack','isNil','systemanswertime','now','linkedid','transfer','destinationchannel','answertime','toNumber','hangup','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','varset','variable','value','xmd-phone','\x22\x20<','xmd-callerid-preview'];(function(_0x482490,_0x1783f1){var _0xe33c42=function(_0x48a83a){while(--_0x48a83a){_0x482490['push'](_0x482490['shift']());}};_0xe33c42(++_0x1783f1);}(_0x834b,0x1d3));var _0xb834=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x834b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb834('0x0'));var util=require(_0xb834('0x1'));var utils=require(_0xb834('0x2'));var dispositions=['NO\x20ANSWER',_0xb834('0x3'),'FAILED','NO\x20ANSWER',_0xb834('0x4'),_0xb834('0x4'),'ANSWERED',_0xb834('0x5'),_0xb834('0x3'),_0xb834('0x3'),_0xb834('0x3')];var channels={};function writeDB(_0xd4a4c9){utils[_0xb834('0x6')](util[_0xb834('0x7')](_0xb834('0x8'),_0xd4a4c9[_0xb834('0x9')],_0xd4a4c9[_0xb834('0xa')],_0xd4a4c9[_0xb834('0xb')],_0xd4a4c9['accountcode'],_0xd4a4c9[_0xb834('0xc')],_0xd4a4c9[_0xb834('0xd')],_0xd4a4c9[_0xb834('0xe')],_0xd4a4c9[_0xb834('0xf')]));if(_0xd4a4c9['accountcode']){utils['getUserByInternal'](_0xd4a4c9[_0xb834('0x10')])[_0xb834('0x11')](function(_0x8f36a0){if(_0x8f36a0){_0xd4a4c9['UserId']=_0x8f36a0['id'];}utils[_0xb834('0x12')](_0xb834('0x13'),_0xd4a4c9);});}else{utils[_0xb834('0x12')](_0xb834('0x13'),_0xd4a4c9);}if(channels[_0xd4a4c9['uniqueid']]){delete channels[_0xd4a4c9[_0xb834('0x9')]];}}exports['newchannel']=function(_0x4be620){try{if(_0x4be620[_0xb834('0x9')]==_0x4be620['linkedid']&&_0x4be620[_0xb834('0xa')]!=_0xb834('0x14')){channels[_0x4be620[_0xb834('0x9')]]={'uniqueid':_0x4be620[_0xb834('0x9')],'accountcode':_0x4be620[_0xb834('0x10')],'source':_0x4be620[_0xb834('0x15')],'destination':_0x4be620['exten'],'destinationcontext':_0x4be620[_0xb834('0x16')],'channel':_0x4be620[_0xb834('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x448ae5){utils[_0xb834('0x17')](_0x448ae5[_0xb834('0x18')]);}};exports['newstate']=function(_0x267635){try{if(!_[_0xb834('0x19')](channels[_0x267635[_0xb834('0x9')]])&&_0x267635['channelstate']==0x6){if(_[_0xb834('0x19')](channels[_0x267635[_0xb834('0x9')]]['systemanswertime'])){channels[_0x267635[_0xb834('0x9')]][_0xb834('0x1a')]=utils[_0xb834('0x1b')]();}}else if(!_['isNil'](channels[_0x267635[_0xb834('0x1c')]])&&_0x267635['channelstate']==0x6&&_0x267635[_0xb834('0x16')]!=_0xb834('0x1d')){channels[_0x267635[_0xb834('0x1c')]][_0xb834('0x10')]=_0x267635[_0xb834('0x10')];channels[_0x267635[_0xb834('0x1c')]][_0xb834('0x1e')]=_0x267635[_0xb834('0xa')];if(_['isNil'](channels[_0x267635[_0xb834('0x1c')]][_0xb834('0x1f')])){channels[_0x267635[_0xb834('0x1c')]][_0xb834('0x1f')]=utils['now']();}channels[_0x267635[_0xb834('0x1c')]][_0xb834('0xf')]=dispositions[_[_0xb834('0x20')](_0x267635['channelstate'])]||'ANSWERED';}}catch(_0x1c5175){utils[_0xb834('0x17')](_0x1c5175[_0xb834('0x18')]);}};exports[_0xb834('0x21')]=function(_0x3325a3){try{if(!_[_0xb834('0x19')](channels[_0x3325a3[_0xb834('0x9')]])){if(_[_0xb834('0x19')](channels[_0x3325a3[_0xb834('0x9')]][_0xb834('0xe')])){channels[_0x3325a3[_0xb834('0x9')]][_0xb834('0xe')]=_0x3325a3['calleridname']+'\x20<'+_0x3325a3[_0xb834('0x15')]+'>';}channels[_0x3325a3[_0xb834('0x9')]]['endtime']=utils[_0xb834('0x1b')]();channels[_0x3325a3['uniqueid']]['duration']=utils['diffTime'](channels[_0x3325a3['uniqueid']]['endtime'],channels[_0x3325a3[_0xb834('0x9')]]['starttime']);channels[_0x3325a3['uniqueid']][_0xb834('0x22')]=channels[_0x3325a3[_0xb834('0x9')]][_0xb834('0x1f')]?utils[_0xb834('0x23')](channels[_0x3325a3[_0xb834('0x9')]]['endtime'],channels[_0x3325a3[_0xb834('0x9')]][_0xb834('0x1f')]):0x0;writeDB(channels[_0x3325a3['uniqueid']]);}}catch(_0x532921){utils[_0xb834('0x17')](_0x532921[_0xb834('0x18')]);}};exports[_0xb834('0x24')]=function(_0x1451e3){try{if(!_[_0xb834('0x19')](channels[_0x1451e3[_0xb834('0x25')]])){if(channels[_0x1451e3[_0xb834('0x25')]][_0xb834('0xa')]==_0x1451e3[_0xb834('0x26')]){channels[_0x1451e3['localtwolinkedid']]['destinationchannel']=_0x1451e3[_0xb834('0x27')];channels[_0x1451e3['localtwolinkedid']][_0xb834('0x28')]=_0xb834('0x29');}else if(channels[_0x1451e3[_0xb834('0x25')]][_0xb834('0xa')]=_0x1451e3[_0xb834('0x2a')]){channels[_0x1451e3[_0xb834('0x25')]][_0xb834('0x1e')]=_0x1451e3['origtransfererchannel'];channels[_0x1451e3[_0xb834('0x25')]]['userfield']=_0xb834('0x29');}}}catch(_0x82a734){utils[_0xb834('0x17')](_0x82a734['stack']);}};exports[_0xb834('0x2b')]=function(_0x46c3ca){try{if(!_['isNil'](channels[_0x46c3ca[_0xb834('0x9')]])){channels[_0x46c3ca[_0xb834('0x9')]][_0xb834('0x2c')]=utils[_0xb834('0x1b')]();}}catch(_0x14faa4){utils['error'](_0x14faa4['stack']);}};exports['musiconholdstop']=function(_0xeec435){try{if(!_['isNil'](channels[_0xeec435['uniqueid']])){if(!_[_0xb834('0x19')](channels[_0xeec435[_0xb834('0x9')]]['musiconholdstartAt'])){channels[_0xeec435[_0xb834('0x9')]]['mohtime']+=utils[_0xb834('0x23')](utils[_0xb834('0x1b')](),channels[_0xeec435[_0xb834('0x9')]]['musiconholdstartAt']);delete channels[_0xeec435['uniqueid']][_0xb834('0x2c')];}}}catch(_0x424232){utils[_0xb834('0x17')](_0x424232[_0xb834('0x18')]);}};exports[_0xb834('0x2d')]=function(_0x5a2780){try{if(!_['isNil'](channels[_0x5a2780[_0xb834('0x9')]])){if(!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')]['xmd-originatecalleridnum'])){channels[_0x5a2780['uniqueid']][_0xb834('0xc')]=_0x5a2780[_0xb834('0x2f')];}if(!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')][_0xb834('0x30')])){channels[_0x5a2780[_0xb834('0x9')]][_0xb834('0xd')]=_0x5a2780[_0xb834('0x2f')];channels[_0x5a2780[_0xb834('0x9')]][_0xb834('0xe')]='\x22'+_0x5a2780[_0xb834('0x2f')]+_0xb834('0x31')+_0x5a2780[_0xb834('0x2f')]+'>';}if(!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')][_0xb834('0x32')])||!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')][_0xb834('0x33')])){channels[_0x5a2780[_0xb834('0x9')]][_0xb834('0xe')]=_0x5a2780[_0xb834('0x2f')];}if(!_[_0xb834('0x19')](_0x5a2780['variable'][_0xb834('0x34')])||!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')]['xmcs-queue'])){channels[_0x5a2780[_0xb834('0x9')]][_0xb834('0x35')]=_0xb834('0x36');channels[_0x5a2780[_0xb834('0x9')]]['lastdata']=_0x5a2780[_0xb834('0x2f')];channels[_0x5a2780[_0xb834('0x9')]][_0xb834('0x37')]=!![];}if(!_[_0xb834('0x19')](_0x5a2780['variable']['xmd-contactid'])){channels[_0x5a2780[_0xb834('0x9')]]['ContactId']=_0x5a2780[_0xb834('0x2f')];}if(!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')][_0xb834('0x38')])){channels[_0x5a2780['uniqueid']][_0xb834('0xb')]=_0x5a2780[_0xb834('0x2f')];}if(!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')][_0xb834('0x39')])){channels[_0x5a2780[_0xb834('0x9')]][_0xb834('0x3a')]=_0x5a2780[_0xb834('0x2f')];}if(!_[_0xb834('0x19')](_0x5a2780[_0xb834('0x2e')][_0xb834('0x3b')])){channels[_0x5a2780['uniqueid']][_0xb834('0x3b')]=_0x5a2780[_0xb834('0x2f')];}}}catch(_0x36b43e){utils[_0xb834('0x17')](_0x36b43e['stack']);}};exports[_0xb834('0x3c')]=function(_0x5660d3){try{if(!_[_0xb834('0x19')](channels[_0x5660d3[_0xb834('0x9')]])){if(_0x5660d3[_0xb834('0x3d')][_0xb834('0x3e')]()==_0xb834('0x3f')&&_[_0xb834('0x40')](_0x5660d3[_0xb834('0x41')]['toLowerCase'](),_0xb834('0x42'))){var _0x5121ce=_0x5660d3[_0xb834('0x41')][_0xb834('0x43')]('=');var _0x596d14=_0x5121ce[0x0][_0xb834('0x44')](_0x5121ce[0x0][_0xb834('0x45')]('(')+0x1,_0x5121ce[0x0][_0xb834('0x45')](')'));var _0xda71c2=_0x5121ce[0x1];channels[_0x5660d3[_0xb834('0x9')]][_0x596d14]=_0xda71c2;}if(!_['includes'](['hangup',_0xb834('0x46'),_0xb834('0x47'),'set',_0xb834('0x48')],_0x5660d3[_0xb834('0x3d')][_0xb834('0x3e')]())){channels[_0x5660d3[_0xb834('0x9')]][_0xb834('0x35')]=_0x5660d3[_0xb834('0x3d')];channels[_0x5660d3[_0xb834('0x9')]][_0xb834('0x49')]=_0x5660d3[_0xb834('0x41')];}}}catch(_0x3ebfc1){utils[_0xb834('0x17')](_0x3ebfc1[_0xb834('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 347db40..dbbe98b 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 _0xdbf5=['SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','lodash','CONNECTED','shutdown','info'];(function(_0x2a7ae9,_0x317027){var _0x169dff=function(_0x525e29){while(--_0x525e29){_0x2a7ae9['push'](_0x2a7ae9['shift']());}};_0x169dff(++_0x317027);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x340010,_0x39c02a){_0x340010=_0x340010-0x0;var _0x278bac=_0xdbf5[_0x340010];return _0x278bac;};'use strict';var utils=require('./utils');var _=require(_0x5dbf('0x0'));exports['connect']=function(){utils['info'](_0x5dbf('0x1'));};exports[_0x5dbf('0x2')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x4'));};exports[_0x5dbf('0x5')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x6'));};exports[_0x5dbf('0x7')]=function(_0x3f8628){utils[_0x5dbf('0x7')](_0x3f8628);};exports[_0x5dbf('0x8')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x9'));};exports['managerevent']=function(_0x134810){}; \ No newline at end of file +var _0x8ef6=['./utils','lodash','connect','info','CONNECTED','shutdown','fullybooted','FULLYBOOTED','error','close','CLOSE'];(function(_0x4d0bd3,_0x23c18f){var _0x180bd0=function(_0x11981e){while(--_0x11981e){_0x4d0bd3['push'](_0x4d0bd3['shift']());}};_0x180bd0(++_0x23c18f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2d4988,_0x150f55){_0x2d4988=_0x2d4988-0x0;var _0x5c7b18=_0x8ef6[_0x2d4988];return _0x5c7b18;};'use strict';var utils=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));exports[_0x68ef('0x2')]=function(){utils[_0x68ef('0x3')](_0x68ef('0x4'));};exports[_0x68ef('0x5')]=function(){utils[_0x68ef('0x3')]('SHUTDOWN');};exports[_0x68ef('0x6')]=function(){utils[_0x68ef('0x3')](_0x68ef('0x7'));};exports[_0x68ef('0x8')]=function(_0x4d26e3){utils['error'](_0x4d26e3);};exports[_0x68ef('0x9')]=function(){utils[_0x68ef('0x3')](_0x68ef('0xa'));};exports['managerevent']=function(_0x228967){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index becf37c..5e8a56c 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 _0x6e58=['holdtime','billableseconds','answertime','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','isNil','variable','outboundrouteid','value','stack','starttime','now','dialend','ANSWER','assign','hangup','duration','diffTime','endtime'];(function(_0x315d41,_0x373449){var _0x21e50e=function(_0x11ef8d){while(--_0x11ef8d){_0x315d41['push'](_0x315d41['shift']());}};_0x21e50e(++_0x373449);}(_0x6e58,0xe1));var _0x86e5=function(_0x15dafa,_0x3bd9b2){_0x15dafa=_0x15dafa-0x0;var _0x390812=_0x6e58[_0x15dafa];return _0x390812;};'use strict';var _=require(_0x86e5('0x0'));var util=require(_0x86e5('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3e99cd){utils[_0x86e5('0x2')](util[_0x86e5('0x3')](_0x86e5('0x4'),_0x3e99cd[_0x86e5('0x5')],_0x3e99cd[_0x86e5('0x6')],_0x3e99cd[_0x86e5('0x7')],_0x3e99cd['calleridnum'],_0x3e99cd[_0x86e5('0x8')],_0x3e99cd[_0x86e5('0x9')]));utils[_0x86e5('0xa')](_0x86e5('0xb'),_0x3e99cd);delete dials[_0x3e99cd[_0x86e5('0x5')]];}exports[_0x86e5('0xc')]=function(_0x3a1903){try{if(_0x3a1903['application'][_0x86e5('0xd')]()==_0x86e5('0xe')&&_[_0x86e5('0xf')](_0x3a1903[_0x86e5('0x10')][_0x86e5('0xd')](),_0x86e5('0x11'))){var _0x4f961e=_0x3a1903[_0x86e5('0x10')][_0x86e5('0x12')]('=');dials[_0x3a1903[_0x86e5('0x5')]]={'routeId':_0x4f961e[0x1]};}}catch(_0x5c30e1){utils[_0x86e5('0x13')](_0x5c30e1['stack']);}};exports['varset']=function(_0x28c407){try{if(!_[_0x86e5('0x14')](_0x28c407[_0x86e5('0x15')][_0x86e5('0x16')])){dials[_0x28c407[_0x86e5('0x5')]]={'routeId':_0x28c407[_0x86e5('0x17')]};}}catch(_0x5acffa){utils['error'](_0x5acffa[_0x86e5('0x18')]);}};exports['dialbegin']=function(_0x5cb30a){try{if(!_[_0x86e5('0x14')](dials[_0x5cb30a[_0x86e5('0x5')]])){dials[_0x5cb30a['uniqueid']]=_['assign'](dials[_0x5cb30a[_0x86e5('0x5')]],_0x5cb30a);dials[_0x5cb30a['uniqueid']][_0x86e5('0x19')]=utils[_0x86e5('0x1a')]();dials[_0x5cb30a[_0x86e5('0x5')]]['lastevent']='called';}}catch(_0x1913d1){utils[_0x86e5('0x13')](_0x1913d1[_0x86e5('0x18')]);}};exports[_0x86e5('0x1b')]=function(_0x52da32){try{if(!_['isNil'](dials[_0x52da32[_0x86e5('0x5')]])){dials[_0x52da32[_0x86e5('0x5')]][_0x86e5('0x9')]=_0x52da32[_0x86e5('0x9')];if(_0x52da32['dialstatus']==_0x86e5('0x1c')){dials[_0x52da32[_0x86e5('0x5')]]=_[_0x86e5('0x1d')](dials[_0x52da32['uniqueid']],_0x52da32);dials[_0x52da32['uniqueid']]['answertime']=utils[_0x86e5('0x1a')]();dials[_0x52da32[_0x86e5('0x5')]]['lastevent']='connect';}}}catch(_0x279b8a){utils['error'](_0x279b8a[_0x86e5('0x18')]);}};exports[_0x86e5('0x1e')]=function(_0x10564b){try{if(!_[_0x86e5('0x14')](dials[_0x10564b[_0x86e5('0x5')]])){dials[_0x10564b[_0x86e5('0x5')]]=_['assign'](dials[_0x10564b['uniqueid']],{'endtime':utils[_0x86e5('0x1a')](),'lastevent':'complete'});dials[_0x10564b[_0x86e5('0x5')]][_0x86e5('0x1f')]=utils[_0x86e5('0x20')](dials[_0x10564b[_0x86e5('0x5')]][_0x86e5('0x21')],dials[_0x10564b[_0x86e5('0x5')]]['starttime']);dials[_0x10564b[_0x86e5('0x5')]][_0x86e5('0x22')]=utils[_0x86e5('0x20')](dials[_0x10564b[_0x86e5('0x5')]]['answertime']||dials[_0x10564b[_0x86e5('0x5')]][_0x86e5('0x21')],dials[_0x10564b[_0x86e5('0x5')]][_0x86e5('0x19')]);dials[_0x10564b['uniqueid']][_0x86e5('0x23')]=dials[_0x10564b[_0x86e5('0x5')]]['answertime']?utils[_0x86e5('0x20')](dials[_0x10564b[_0x86e5('0x5')]]['endtime'],dials[_0x10564b['uniqueid']][_0x86e5('0x24')]):0x0;writeDB(dials[_0x10564b['uniqueid']]);}}catch(_0x9ce71f){utils[_0x86e5('0x13')](_0x9ce71f[_0x86e5('0x18')]);}}; \ No newline at end of file +var _0x07ee=['calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','stack','varset','variable','value','starttime','now','lastevent','called','ANSWER','answertime','connect','isNil','assign','complete','duration','diffTime','endtime','billableseconds','util','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring'];(function(_0x1e6af0,_0x4570a8){var _0x5343f7=function(_0x35829f){while(--_0x35829f){_0x1e6af0['push'](_0x1e6af0['shift']());}};_0x5343f7(++_0x4570a8);}(_0x07ee,0x1f2));var _0xe07e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x07ee[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0xe07e('0x0'));var utils=require(_0xe07e('0x1'));var dials={};function writeDB(_0x4390a7){utils['info'](util[_0xe07e('0x2')](_0xe07e('0x3'),_0x4390a7[_0xe07e('0x4')],_0x4390a7['channel'],_0x4390a7[_0xe07e('0x5')],_0x4390a7[_0xe07e('0x6')],_0x4390a7[_0xe07e('0x7')],_0x4390a7[_0xe07e('0x8')]));utils['request'](_0xe07e('0x9'),_0x4390a7);delete dials[_0x4390a7[_0xe07e('0x4')]];}exports[_0xe07e('0xa')]=function(_0xc6fc08){try{if(_0xc6fc08[_0xe07e('0xb')][_0xe07e('0xc')]()==_0xe07e('0xd')&&_[_0xe07e('0xe')](_0xc6fc08[_0xe07e('0xf')]['toLowerCase'](),_0xe07e('0x10'))){var _0x2ed09d=_0xc6fc08[_0xe07e('0xf')]['split']('=');dials[_0xc6fc08['uniqueid']]={'routeId':_0x2ed09d[0x1]};}}catch(_0x3d1511){utils[_0xe07e('0x11')](_0x3d1511[_0xe07e('0x12')]);}};exports[_0xe07e('0x13')]=function(_0x3c9d09){try{if(!_['isNil'](_0x3c9d09[_0xe07e('0x14')]['outboundrouteid'])){dials[_0x3c9d09[_0xe07e('0x4')]]={'routeId':_0x3c9d09[_0xe07e('0x15')]};}}catch(_0x3ef370){utils[_0xe07e('0x11')](_0x3ef370[_0xe07e('0x12')]);}};exports['dialbegin']=function(_0xffd0e3){try{if(!_['isNil'](dials[_0xffd0e3['uniqueid']])){dials[_0xffd0e3[_0xe07e('0x4')]]=_['assign'](dials[_0xffd0e3['uniqueid']],_0xffd0e3);dials[_0xffd0e3[_0xe07e('0x4')]][_0xe07e('0x16')]=utils[_0xe07e('0x17')]();dials[_0xffd0e3[_0xe07e('0x4')]][_0xe07e('0x18')]=_0xe07e('0x19');}}catch(_0x5e916c){utils[_0xe07e('0x11')](_0x5e916c['stack']);}};exports['dialend']=function(_0x59d827){try{if(!_['isNil'](dials[_0x59d827[_0xe07e('0x4')]])){dials[_0x59d827[_0xe07e('0x4')]][_0xe07e('0x8')]=_0x59d827[_0xe07e('0x8')];if(_0x59d827[_0xe07e('0x8')]==_0xe07e('0x1a')){dials[_0x59d827[_0xe07e('0x4')]]=_['assign'](dials[_0x59d827['uniqueid']],_0x59d827);dials[_0x59d827['uniqueid']][_0xe07e('0x1b')]=utils['now']();dials[_0x59d827[_0xe07e('0x4')]][_0xe07e('0x18')]=_0xe07e('0x1c');}}}catch(_0x160e62){utils['error'](_0x160e62[_0xe07e('0x12')]);}};exports['hangup']=function(_0x6db3){try{if(!_[_0xe07e('0x1d')](dials[_0x6db3[_0xe07e('0x4')]])){dials[_0x6db3['uniqueid']]=_[_0xe07e('0x1e')](dials[_0x6db3['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xe07e('0x1f')});dials[_0x6db3[_0xe07e('0x4')]][_0xe07e('0x20')]=utils[_0xe07e('0x21')](dials[_0x6db3[_0xe07e('0x4')]][_0xe07e('0x22')],dials[_0x6db3[_0xe07e('0x4')]][_0xe07e('0x16')]);dials[_0x6db3[_0xe07e('0x4')]]['holdtime']=utils['diffTime'](dials[_0x6db3['uniqueid']][_0xe07e('0x1b')]||dials[_0x6db3['uniqueid']][_0xe07e('0x22')],dials[_0x6db3['uniqueid']]['starttime']);dials[_0x6db3[_0xe07e('0x4')]][_0xe07e('0x23')]=dials[_0x6db3[_0xe07e('0x4')]]['answertime']?utils[_0xe07e('0x21')](dials[_0x6db3[_0xe07e('0x4')]][_0xe07e('0x22')],dials[_0x6db3[_0xe07e('0x4')]]['answertime']):0x0;writeDB(dials[_0x6db3[_0xe07e('0x4')]]);}}catch(_0x8f5853){utils[_0xe07e('0x11')](_0x8f5853[_0xe07e('0x12')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f1fbd59..00e0d30 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 _0x2509=['info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','port','asterisk','username','password','keepConnected','xdr','disabled'];(function(_0x5cc556,_0x158710){var _0x12103b=function(_0x13ff4a){while(--_0x13ff4a){_0x5cc556['push'](_0x5cc556['shift']());}};_0x12103b(++_0x158710);}(_0x2509,0xa6));var _0x9250=function(_0x4d584f,_0x385fcd){_0x4d584f=_0x4d584f-0x0;var _0x383793=_0x2509[_0x4d584f];return _0x383793;};var AsteriskManager=require(_0x9250('0x0'));var config=require(_0x9250('0x1'));var utils=require(_0x9250('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x9250('0x3')],config[_0x9250('0x4')]['ip'],config[_0x9250('0x4')][_0x9250('0x5')],config[_0x9250('0x4')][_0x9250('0x6')],!![]);ami[_0x9250('0x7')]();if(config[_0x9250('0x8')]&&config[_0x9250('0x8')][_0x9250('0x9')]){utils[_0x9250('0xa')](_0x9250('0xb'));}else{var agents=require(_0x9250('0xc'));var calls=require(_0x9250('0xd'));var queues=require(_0x9250('0xe'));var recordings=require(_0x9250('0xf'));var members=require('./members.controller');var dials=require(_0x9250('0x10'));var transfers=require(_0x9250('0x11'));var core=require(_0x9250('0x12'));ami['on'](_0x9250('0x13'),core[_0x9250('0x13')]);ami['on'](_0x9250('0x14'),core[_0x9250('0x14')]);ami['on'](_0x9250('0x15'),core[_0x9250('0x15')]);ami['on'](_0x9250('0x16'),core[_0x9250('0x16')]);ami['on'](_0x9250('0x17'),core[_0x9250('0x17')]);ami['on'](_0x9250('0x18'),core['managerevent']);ami['on'](_0x9250('0x19'),function(_0x2c616b){try{members['devicestatechange'](_0x2c616b);}catch(_0x8246be){utils[_0x9250('0x16')](_0x8246be);}});ami['on']('agentcalled',function(_0x3110f2){try{agents['agentcalled'](_0x3110f2);}catch(_0x1be983){utils[_0x9250('0x16')](_0x1be983);}});ami['on']('agentringnoanswer',function(_0x2448f9){try{agents[_0x9250('0x1a')](_0x2448f9);}catch(_0x2e273d){utils[_0x9250('0x16')](_0x2e273d);}});ami['on']('agentconnect',function(_0x27f6f7){try{agents['agentconnect'](_0x27f6f7);queues[_0x9250('0x1b')](_0x27f6f7);}catch(_0x28ca5c){utils[_0x9250('0x16')](_0x28ca5c);}});ami['on'](_0x9250('0x1c'),function(_0x596e9a){try{agents[_0x9250('0x1c')](_0x596e9a);queues[_0x9250('0x1c')](_0x596e9a);members[_0x9250('0x1c')](_0x596e9a);}catch(_0x460463){utils[_0x9250('0x16')](_0x460463);}});ami['on'](_0x9250('0x1d'),function(_0x456bd8){try{agents[_0x9250('0x1d')](_0x456bd8);queues[_0x9250('0x1d')](_0x456bd8);}catch(_0x12104c){utils[_0x9250('0x16')](_0x12104c);}});ami['on'](_0x9250('0x1e'),function(_0x5ce674){try{queues[_0x9250('0x1e')](_0x5ce674);recordings[_0x9250('0x1e')](_0x5ce674);}catch(_0x14c644){utils[_0x9250('0x16')](_0x14c644);}});ami['on'](_0x9250('0x1f'),function(_0x4c4388){try{queues['queuecallerleave'](_0x4c4388);}catch(_0x36e3df){utils['error'](_0x36e3df);}});ami['on'](_0x9250('0x20'),function(_0x4c3495){try{queues[_0x9250('0x20')](_0x4c3495);calls[_0x9250('0x20')](_0x4c3495);}catch(_0x4cb8be){utils[_0x9250('0x16')](_0x4cb8be);}});ami['on'](_0x9250('0x21'),function(_0x1d3563){try{queues[_0x9250('0x21')](_0x1d3563);calls['musiconholdstop'](_0x1d3563);}catch(_0x116e23){utils['error'](_0x116e23);}});ami['on'](_0x9250('0x22'),function(_0x11118a){try{calls['newstate'](_0x11118a);recordings[_0x9250('0x22')](_0x11118a);}catch(_0x4604c7){utils['error'](_0x4604c7);}});ami['on']('hangup',function(_0x4ade0f){try{calls['hangup'](_0x4ade0f);recordings[_0x9250('0x23')](_0x4ade0f);dials[_0x9250('0x23')](_0x4ade0f);agents[_0x9250('0x23')](_0x4ade0f);queues[_0x9250('0x23')](_0x4ade0f);}catch(_0xc08ce2){utils[_0x9250('0x16')](_0xc08ce2);}});ami['on'](_0x9250('0x24'),function(_0x1b2018){try{members['cdr'](_0x1b2018);}catch(_0x13ea47){utils[_0x9250('0x16')](_0x13ea47);}});ami['on'](_0x9250('0x25'),function(_0x5920b8){try{queues[_0x9250('0x25')](_0x5920b8);agents[_0x9250('0x25')](_0x5920b8);transfers[_0x9250('0x25')](_0x5920b8);}catch(_0x38cba2){utils['error'](_0x38cba2);}});ami['on'](_0x9250('0x26'),function(_0x37f8ef){try{queues[_0x9250('0x26')](_0x37f8ef);transfers[_0x9250('0x26')](_0x37f8ef);agents[_0x9250('0x26')](_0x37f8ef);calls[_0x9250('0x26')](_0x37f8ef);}catch(_0x17827d){utils[_0x9250('0x16')](_0x17827d);}});ami['on'](_0x9250('0x27'),function(_0x56258c){try{queues['varset'](_0x56258c);recordings['varset'](_0x56258c);calls[_0x9250('0x27')](_0x56258c);dials['varset'](_0x56258c);}catch(_0x1a212f){utils[_0x9250('0x16')](_0x1a212f);}});ami['on'](_0x9250('0x28'),function(_0x5a8fbf){try{calls[_0x9250('0x28')](_0x5a8fbf);recordings[_0x9250('0x28')](_0x5a8fbf);dials[_0x9250('0x28')](_0x5a8fbf);}catch(_0x2aa300){utils[_0x9250('0x16')](_0x2aa300);}});ami['on'](_0x9250('0x29'),function(_0x36a7ba){try{calls[_0x9250('0x29')](_0x36a7ba);recordings[_0x9250('0x29')](_0x36a7ba);}catch(_0x2712b9){utils[_0x9250('0x16')](_0x2712b9);}});ami['on'](_0x9250('0x2a'),function(_0x180d60){try{dials[_0x9250('0x2a')](_0x180d60);}catch(_0x2fdf48){utils[_0x9250('0x16')](_0x2fdf48);}});ami['on'](_0x9250('0x2b'),function(_0x15e5f3){try{dials[_0x9250('0x2b')](_0x15e5f3);}catch(_0x3c4ead){utils['error'](_0x3c4ead);}});} \ No newline at end of file +var _0xbb99=['keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialend','../../config/environment','./utils','asterisk','username'];(function(_0x219883,_0xa4186a){var _0x349510=function(_0xb56191){while(--_0xb56191){_0x219883['push'](_0x219883['shift']());}};_0x349510(++_0xa4186a);}(_0xbb99,0x18c));var _0x9bb9=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0xbb99[_0x4eec9b];return _0x2e3849;};var AsteriskManager=require('asterisk-manager');var config=require(_0x9bb9('0x0'));var utils=require(_0x9bb9('0x1'));var ami=new AsteriskManager(config[_0x9bb9('0x2')]['port'],config[_0x9bb9('0x2')]['ip'],config[_0x9bb9('0x2')][_0x9bb9('0x3')],config[_0x9bb9('0x2')]['password'],!![]);ami[_0x9bb9('0x4')]();if(config[_0x9bb9('0x5')]&&config[_0x9bb9('0x5')][_0x9bb9('0x6')]){utils[_0x9bb9('0x7')](_0x9bb9('0x8'));}else{var agents=require(_0x9bb9('0x9'));var calls=require(_0x9bb9('0xa'));var queues=require(_0x9bb9('0xb'));var recordings=require(_0x9bb9('0xc'));var members=require(_0x9bb9('0xd'));var dials=require(_0x9bb9('0xe'));var transfers=require(_0x9bb9('0xf'));var core=require('./core.controller');ami['on'](_0x9bb9('0x10'),core[_0x9bb9('0x10')]);ami['on'](_0x9bb9('0x11'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x9bb9('0x12'),core[_0x9bb9('0x12')]);ami['on'](_0x9bb9('0x13'),core[_0x9bb9('0x13')]);ami['on'](_0x9bb9('0x14'),core[_0x9bb9('0x14')]);ami['on'](_0x9bb9('0x15'),function(_0x30d856){try{members[_0x9bb9('0x15')](_0x30d856);}catch(_0x49362c){utils[_0x9bb9('0x12')](_0x49362c);}});ami['on'](_0x9bb9('0x16'),function(_0x860554){try{agents[_0x9bb9('0x16')](_0x860554);}catch(_0x303840){utils[_0x9bb9('0x12')](_0x303840);}});ami['on'](_0x9bb9('0x17'),function(_0x5b080e){try{agents[_0x9bb9('0x17')](_0x5b080e);}catch(_0x432f25){utils['error'](_0x432f25);}});ami['on'](_0x9bb9('0x18'),function(_0x26306b){try{agents[_0x9bb9('0x18')](_0x26306b);queues[_0x9bb9('0x18')](_0x26306b);}catch(_0x488e9a){utils[_0x9bb9('0x12')](_0x488e9a);}});ami['on'](_0x9bb9('0x19'),function(_0x5bdcba){try{agents['agentcomplete'](_0x5bdcba);queues[_0x9bb9('0x19')](_0x5bdcba);members[_0x9bb9('0x19')](_0x5bdcba);}catch(_0x3ca25f){utils[_0x9bb9('0x12')](_0x3ca25f);}});ami['on'](_0x9bb9('0x1a'),function(_0x45a49b){try{agents[_0x9bb9('0x1a')](_0x45a49b);queues['queuecallerabandon'](_0x45a49b);}catch(_0x5c0e4e){utils['error'](_0x5c0e4e);}});ami['on'](_0x9bb9('0x1b'),function(_0x2218d5){try{queues[_0x9bb9('0x1b')](_0x2218d5);recordings[_0x9bb9('0x1b')](_0x2218d5);}catch(_0x3bfdf9){utils['error'](_0x3bfdf9);}});ami['on'](_0x9bb9('0x1c'),function(_0xc7c58b){try{queues['queuecallerleave'](_0xc7c58b);}catch(_0x3a9425){utils[_0x9bb9('0x12')](_0x3a9425);}});ami['on'](_0x9bb9('0x1d'),function(_0x39e509){try{queues['musiconholdstart'](_0x39e509);calls[_0x9bb9('0x1d')](_0x39e509);}catch(_0x25e54d){utils['error'](_0x25e54d);}});ami['on'](_0x9bb9('0x1e'),function(_0x1d0202){try{queues['musiconholdstop'](_0x1d0202);calls[_0x9bb9('0x1e')](_0x1d0202);}catch(_0x4210ec){utils['error'](_0x4210ec);}});ami['on'](_0x9bb9('0x1f'),function(_0x424b50){try{calls[_0x9bb9('0x1f')](_0x424b50);recordings[_0x9bb9('0x1f')](_0x424b50);}catch(_0xaa203){utils[_0x9bb9('0x12')](_0xaa203);}});ami['on'](_0x9bb9('0x20'),function(_0x188ad0){try{calls[_0x9bb9('0x20')](_0x188ad0);recordings[_0x9bb9('0x20')](_0x188ad0);dials['hangup'](_0x188ad0);agents[_0x9bb9('0x20')](_0x188ad0);queues[_0x9bb9('0x20')](_0x188ad0);}catch(_0x4fad0b){utils['error'](_0x4fad0b);}});ami['on'](_0x9bb9('0x21'),function(_0x3cc305){try{members[_0x9bb9('0x21')](_0x3cc305);}catch(_0x39b107){utils[_0x9bb9('0x12')](_0x39b107);}});ami['on']('blindtransfer',function(_0x27a8df){try{queues[_0x9bb9('0x22')](_0x27a8df);agents[_0x9bb9('0x22')](_0x27a8df);transfers[_0x9bb9('0x22')](_0x27a8df);}catch(_0x471d45){utils[_0x9bb9('0x12')](_0x471d45);}});ami['on'](_0x9bb9('0x23'),function(_0x4a04de){try{queues[_0x9bb9('0x23')](_0x4a04de);transfers[_0x9bb9('0x23')](_0x4a04de);agents[_0x9bb9('0x23')](_0x4a04de);calls[_0x9bb9('0x23')](_0x4a04de);}catch(_0x166f0b){utils[_0x9bb9('0x12')](_0x166f0b);}});ami['on'](_0x9bb9('0x24'),function(_0x967fdf){try{queues[_0x9bb9('0x24')](_0x967fdf);recordings[_0x9bb9('0x24')](_0x967fdf);calls[_0x9bb9('0x24')](_0x967fdf);dials[_0x9bb9('0x24')](_0x967fdf);}catch(_0x51e990){utils[_0x9bb9('0x12')](_0x51e990);}});ami['on']('newexten',function(_0x200829){try{calls[_0x9bb9('0x25')](_0x200829);recordings[_0x9bb9('0x25')](_0x200829);dials[_0x9bb9('0x25')](_0x200829);}catch(_0x498acf){utils['error'](_0x498acf);}});ami['on'](_0x9bb9('0x26'),function(_0x3e5063){try{calls[_0x9bb9('0x26')](_0x3e5063);recordings[_0x9bb9('0x26')](_0x3e5063);}catch(_0x1cc9d5){utils[_0x9bb9('0x12')](_0x1cc9d5);}});ami['on']('dialbegin',function(_0x247b26){try{dials['dialbegin'](_0x247b26);}catch(_0x305eb7){utils[_0x9bb9('0x12')](_0x305eb7);}});ami['on'](_0x9bb9('0x27'),function(_0x4ecddd){try{dials[_0x9bb9('0x27')](_0x4ecddd);}catch(_0x271fbb){utils[_0x9bb9('0x12')](_0x271fbb);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ae0064b..d99adb8 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 _0x4a5f=['MEMBER|%s|%s|%s|%s|%s|%s','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','some','startsWith','devicestatechange','BUSY','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','enterAt','agentcomplete','assign','queue','uniqueid','cdr','split','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format'];(function(_0x5ec76b,_0x4ff94d){var _0x329ac7=function(_0x469ab9){while(--_0x469ab9){_0x5ec76b['push'](_0x5ec76b['shift']());}};_0x329ac7(++_0x4ff94d);}(_0x4a5f,0x74));var _0xf4a5=function(_0x200477,_0xa3d497){_0x200477=_0x200477-0x0;var _0x51a521=_0x4a5f[_0x200477];return _0x51a521;};'use strict';var _=require(_0xf4a5('0x0'));var util=require(_0xf4a5('0x1'));var utils=require(_0xf4a5('0x2'));var members={};var exclude=[_0xf4a5('0x3'),_0xf4a5('0x4')];function writeDB(_0x272779){utils[_0xf4a5('0x5')](util[_0xf4a5('0x6')](_0xf4a5('0x7'),_0x272779['uniqueid'],_0x272779['interface'],_0x272779[_0xf4a5('0x8')],_0x272779[_0xf4a5('0x9')],_0x272779[_0xf4a5('0xa')],_0x272779[_0xf4a5('0xb')]));if(_0x272779[_0xf4a5('0xc')]){utils[_0xf4a5('0xd')](_0x272779[_0xf4a5('0xc')])[_0xf4a5('0xe')](function(_0x517543){if(_0x517543){_0x272779[_0xf4a5('0xa')]=_0x517543[_0xf4a5('0xf')];_0x272779[_0xf4a5('0x10')]=_0x517543[_0xf4a5('0x10')];utils[_0xf4a5('0x11')](_0xf4a5('0x12'),_0x272779);}else{utils[_0xf4a5('0x13')](_0x272779[_0xf4a5('0xc')]['split']('/')[0x1])[_0xf4a5('0xe')](function(_0x13ae4f){if(_0x13ae4f){_0x272779['membername']=_0x13ae4f[_0xf4a5('0xf')];_0x272779['internal']=_0x13ae4f['internal'];utils['request']('CreateMemberReport',_0x272779);}});}})['catch'](function(_0x474152){utils['error'](_0x474152);});}delete members[_0x272779[_0xf4a5('0xc')]];}function startsWith(_0x8150f2,_0x2faa05){return _[_0xf4a5('0x14')](_0x8150f2,function(_0x516098){return _[_0xf4a5('0x15')](_0x2faa05,_0x516098);});}exports[_0xf4a5('0x16')]=function(_0x50eb39){switch(_0x50eb39['state']){case'INUSE':case _0xf4a5('0x17'):if(!startsWith(exclude,_0x50eb39[_0xf4a5('0x18')])){members[_0x50eb39[_0xf4a5('0x18')]]={'channel':'voice','interface':_0x50eb39[_0xf4a5('0x18')],'type':_0xf4a5('0x19'),'enterAt':utils[_0xf4a5('0x1a')](),'role':_0xf4a5('0x1b')};}break;case _0xf4a5('0x1c'):if(!_[_0xf4a5('0x1d')](members[_0x50eb39['device']])){members[_0x50eb39[_0xf4a5('0x18')]][_0xf4a5('0x1e')]=utils['now']();members[_0x50eb39[_0xf4a5('0x18')]]['duration']=utils['diffTime'](members[_0x50eb39['device']]['exitAt'],members[_0x50eb39[_0xf4a5('0x18')]][_0xf4a5('0x1f')]);if(members[_0x50eb39[_0xf4a5('0x18')]]['uniqueid']){writeDB(members[_0x50eb39['device']]);}}default:break;}};exports[_0xf4a5('0x20')]=function(_0x1bc862){if(!_[_0xf4a5('0x1d')](members[_0x1bc862[_0xf4a5('0xc')]])){members[_0x1bc862[_0xf4a5('0xc')]]=_[_0xf4a5('0x21')](members[_0x1bc862['interface']],{'data4':_0x1bc862[_0xf4a5('0x22')],'uniqueid':_0x1bc862[_0xf4a5('0x23')]});}};exports[_0xf4a5('0x24')]=function(_0x1fce71){if(_0x1fce71[_0xf4a5('0x8')]){var _0x403e99=_0x1fce71[_0xf4a5('0x8')][_0xf4a5('0x25')]('-')[0x0];if(!_[_0xf4a5('0x1d')](members[_0x403e99])){members[_0x403e99]=_[_0xf4a5('0x21')](members[_0x403e99],{'data1':members[_0x403e99]['data1']||_0x1fce71[_0xf4a5('0xb')],'data2':members[_0x403e99]['data2']||_0x1fce71['source'],'data3':members[_0x403e99][_0xf4a5('0x26')]||_0x1fce71[_0xf4a5('0x27')],'uniqueid':members[_0x403e99][_0xf4a5('0x23')]||_0x1fce71[_0xf4a5('0x23')]});if(members[_0x403e99][_0xf4a5('0x1e')]){writeDB(members[_0x403e99]);}}}if(_0x1fce71[_0xf4a5('0x28')]){var _0x308b5f=_0x1fce71[_0xf4a5('0x28')][_0xf4a5('0x25')]('-')[0x0];if(!_[_0xf4a5('0x1d')](members[_0x308b5f])){members[_0x308b5f]=_[_0xf4a5('0x21')](members[_0x308b5f],{'data1':members[_0x308b5f]['data1']||_0x1fce71[_0xf4a5('0xb')],'data2':members[_0x308b5f]['data2']||_0x1fce71['source'],'data3':members[_0x308b5f][_0xf4a5('0x26')]||_0x1fce71[_0xf4a5('0x27')],'uniqueid':members[_0x308b5f][_0xf4a5('0x23')]||_0x1fce71[_0xf4a5('0x23')]});if(members[_0x308b5f][_0xf4a5('0x1e')]){writeDB(members[_0x308b5f]);}}}}; \ No newline at end of file +var _0x914a=['MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','device','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','assign','queue','cdr','channel','data1','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format'];(function(_0x5ad67c,_0x144860){var _0xccce2e=function(_0x2dd95c){while(--_0x2dd95c){_0x5ad67c['push'](_0x5ad67c['shift']());}};_0xccce2e(++_0x144860);}(_0x914a,0xdf));var _0xa914=function(_0x4cd685,_0x472697){_0x4cd685=_0x4cd685-0x0;var _0x37743e=_0x914a[_0x4cd685];return _0x37743e;};'use strict';var _=require(_0xa914('0x0'));var util=require(_0xa914('0x1'));var utils=require(_0xa914('0x2'));var members={};var exclude=[_0xa914('0x3'),_0xa914('0x4')];function writeDB(_0x319fc3){utils[_0xa914('0x5')](util[_0xa914('0x6')](_0xa914('0x7'),_0x319fc3[_0xa914('0x8')],_0x319fc3[_0xa914('0x9')],_0x319fc3['channel'],_0x319fc3[_0xa914('0xa')],_0x319fc3[_0xa914('0xb')],_0x319fc3[_0xa914('0xc')]));if(_0x319fc3['interface']){utils[_0xa914('0xd')](_0x319fc3[_0xa914('0x9')])[_0xa914('0xe')](function(_0x713b5d){if(_0x713b5d){_0x319fc3[_0xa914('0xb')]=_0x713b5d['name'];_0x319fc3[_0xa914('0xf')]=_0x713b5d[_0xa914('0xf')];utils[_0xa914('0x10')](_0xa914('0x11'),_0x319fc3);}else{utils[_0xa914('0x12')](_0x319fc3[_0xa914('0x9')][_0xa914('0x13')]('/')[0x1])[_0xa914('0xe')](function(_0x1b5bf8){if(_0x1b5bf8){_0x319fc3['membername']=_0x1b5bf8['name'];_0x319fc3[_0xa914('0xf')]=_0x1b5bf8[_0xa914('0xf')];utils[_0xa914('0x10')]('CreateMemberReport',_0x319fc3);}});}})[_0xa914('0x14')](function(_0x171dbf){utils[_0xa914('0x15')](_0x171dbf);});}delete members[_0x319fc3[_0xa914('0x9')]];}function startsWith(_0x19a35e,_0x5bae2d){return _[_0xa914('0x16')](_0x19a35e,function(_0x43400f){return _[_0xa914('0x17')](_0x5bae2d,_0x43400f);});}exports[_0xa914('0x18')]=function(_0x51ef89){switch(_0x51ef89['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x51ef89[_0xa914('0x19')])){members[_0x51ef89[_0xa914('0x19')]]={'channel':_0xa914('0x1a'),'interface':_0x51ef89[_0xa914('0x19')],'type':_0xa914('0x1b'),'enterAt':utils[_0xa914('0x1c')](),'role':_0xa914('0x1d')};}break;case _0xa914('0x1e'):if(!_[_0xa914('0x1f')](members[_0x51ef89['device']])){members[_0x51ef89[_0xa914('0x19')]]['exitAt']=utils['now']();members[_0x51ef89[_0xa914('0x19')]][_0xa914('0x20')]=utils[_0xa914('0x21')](members[_0x51ef89[_0xa914('0x19')]][_0xa914('0x22')],members[_0x51ef89['device']][_0xa914('0x23')]);if(members[_0x51ef89['device']]['uniqueid']){writeDB(members[_0x51ef89[_0xa914('0x19')]]);}}default:break;}};exports[_0xa914('0x24')]=function(_0x4a2fb6){if(!_[_0xa914('0x1f')](members[_0x4a2fb6['interface']])){members[_0x4a2fb6[_0xa914('0x9')]]=_[_0xa914('0x25')](members[_0x4a2fb6[_0xa914('0x9')]],{'data4':_0x4a2fb6[_0xa914('0x26')],'uniqueid':_0x4a2fb6[_0xa914('0x8')]});}};exports[_0xa914('0x27')]=function(_0x5be73e){if(_0x5be73e['channel']){var _0x33adbc=_0x5be73e[_0xa914('0x28')][_0xa914('0x13')]('-')[0x0];if(!_[_0xa914('0x1f')](members[_0x33adbc])){members[_0x33adbc]=_[_0xa914('0x25')](members[_0x33adbc],{'data1':members[_0x33adbc][_0xa914('0x29')]||_0x5be73e[_0xa914('0xc')],'data2':members[_0x33adbc]['data2']||_0x5be73e[_0xa914('0x2a')],'data3':members[_0x33adbc][_0xa914('0x2b')]||_0x5be73e[_0xa914('0x2c')],'uniqueid':members[_0x33adbc]['uniqueid']||_0x5be73e[_0xa914('0x8')]});if(members[_0x33adbc][_0xa914('0x22')]){writeDB(members[_0x33adbc]);}}}if(_0x5be73e['destinationchannel']){var _0x3580c6=_0x5be73e[_0xa914('0x2d')][_0xa914('0x13')]('-')[0x0];if(!_['isNil'](members[_0x3580c6])){members[_0x3580c6]=_['assign'](members[_0x3580c6],{'data1':members[_0x3580c6][_0xa914('0x29')]||_0x5be73e['type'],'data2':members[_0x3580c6][_0xa914('0xa')]||_0x5be73e[_0xa914('0x2a')],'data3':members[_0x3580c6][_0xa914('0x2b')]||_0x5be73e[_0xa914('0x2c')],'uniqueid':members[_0x3580c6][_0xa914('0x8')]||_0x5be73e[_0xa914('0x8')]});if(members[_0x3580c6][_0xa914('0x22')]){writeDB(members[_0x3580c6]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2ca0782..797d33e 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 _0x7aa3=['now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','varset','variable','queuestatus','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','queuecallerexit','ABANDONED','queuecallerleave','holdtime','diffTime','count','connectedlinename','agentconnect','destaccountcode','membername','assigned','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','secondtransfereruniqueid','transfertargetlinkedid','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','lodash','info','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position'];(function(_0x327c18,_0x1292b2){var _0x36a36c=function(_0x45a769){while(--_0x45a769){_0x327c18['push'](_0x327c18['shift']());}};_0x36a36c(++_0x1292b2);}(_0x7aa3,0x153));var _0x37aa=function(_0xf2f722,_0x447efb){_0xf2f722=_0xf2f722-0x0;var _0x264274=_0x7aa3[_0xf2f722];return _0x264274;};'use strict';var _=require(_0x37aa('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x566e61){utils[_0x37aa('0x1')](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x566e61[_0x37aa('0x2')],_0x566e61[_0x37aa('0x3')],_0x566e61[_0x37aa('0x4')],_0x566e61[_0x37aa('0x5')],_0x566e61[_0x37aa('0x6')],_0x566e61[_0x37aa('0x7')],_0x566e61[_0x37aa('0x8')]));if(_0x566e61['queue']){utils[_0x37aa('0x9')](_0x566e61[_0x37aa('0x4')])['then'](function(_0x169923){if(_0x169923){_0x566e61['type']=_0x169923[_0x37aa('0xa')];}utils[_0x37aa('0xb')](_0x37aa('0xc'),_0x566e61);});}else{utils[_0x37aa('0xb')](_0x37aa('0xc'),_0x566e61);}if(_0x566e61['transfereduniqueid']){delete queues[_0x566e61[_0x37aa('0xd')]];}else{delete queues[_0x566e61[_0x37aa('0x2')]];}}exports[_0x37aa('0xe')]=function(_0x4f8274){queues[_0x4f8274[_0x37aa('0x2')]]=_['assign'](_0x4f8274,{'originalposition':_0x4f8274[_0x37aa('0xf')],'queuecallerjoinAt':utils[_0x37aa('0x10')](),'mohtime':0x0});};exports[_0x37aa('0x11')]=function(_0x550aed){if(!_[_0x37aa('0x12')](queues[_0x550aed['uniqueid']])){if(queues[_0x550aed['uniqueid']][_0x37aa('0x13')]){if(!queues[_0x550aed['uniqueid']][_0x37aa('0x14')]&&!queues[_0x550aed[_0x37aa('0x2')]]['queuecallerexit']){queues[_0x550aed['uniqueid']][_0x37aa('0x15')]=!![];queues[_0x550aed[_0x37aa('0x2')]]['queuecallercompleteAt']=utils[_0x37aa('0x10')]();queues[_0x550aed[_0x37aa('0x2')]][_0x37aa('0x8')]=_0x37aa('0x16');}writeDB(queues[_0x550aed[_0x37aa('0x2')]]);}else{if(queues[_0x550aed['uniqueid']][_0x37aa('0xd')]){queues[queues[_0x550aed[_0x37aa('0x2')]][_0x37aa('0xd')]]=queues[_0x550aed['uniqueid']];queues[queues[_0x550aed[_0x37aa('0x2')]][_0x37aa('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x550aed[_0x37aa('0x2')]];}}}};exports[_0x37aa('0x17')]=function(_0x521599){if(!_['isNil'](_0x521599[_0x37aa('0x18')][_0x37aa('0x19')])){if(!_[_0x37aa('0x12')](queues[_0x521599[_0x37aa('0x2')]])){queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x14')]=![];queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x1a')]=null;queues[_0x521599[_0x37aa('0x2')]]['queuecallerexit']=!![];queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x1b')]=utils[_0x37aa('0x10')]();queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x8')]=_0x521599[_0x37aa('0x1c')][_0x37aa('0x1d')]();writeDB(queues[_0x521599[_0x37aa('0x2')]]);}}else if(!_[_0x37aa('0x12')](_0x521599[_0x37aa('0x18')]['queueposition'])){if(!_['isNil'](queues[_0x521599['uniqueid']])&&!queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x14')]){queues[_0x521599[_0x37aa('0x2')]]['queuecallerabandon']=![];queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x1a')]=null;queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x1e')]=!![];queues[_0x521599[_0x37aa('0x2')]][_0x37aa('0x1b')]=utils[_0x37aa('0x10')]();queues[_0x521599['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';}}};exports[_0x37aa('0x14')]=function(_0x5f7233){if(!_['isNil'](queues[_0x5f7233[_0x37aa('0x2')]])){queues[_0x5f7233[_0x37aa('0x2')]][_0x37aa('0x1e')]=![];queues[_0x5f7233[_0x37aa('0x2')]][_0x37aa('0x1b')]=null;queues[_0x5f7233[_0x37aa('0x2')]][_0x37aa('0x14')]=!![];queues[_0x5f7233['uniqueid']][_0x37aa('0x1a')]=utils[_0x37aa('0x10')]();queues[_0x5f7233[_0x37aa('0x2')]][_0x37aa('0x8')]=_0x37aa('0x1f');}};exports[_0x37aa('0x20')]=function(_0x1dbbe2){if(!_[_0x37aa('0x12')](queues[_0x1dbbe2['uniqueid']])){queues[_0x1dbbe2[_0x37aa('0x2')]]['queuecallerleave']=!![];queues[_0x1dbbe2['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x1dbbe2[_0x37aa('0x2')]][_0x37aa('0x21')]=utils[_0x37aa('0x22')](queues[_0x1dbbe2[_0x37aa('0x2')]]['queuecallerleaveAt'],queues[_0x1dbbe2[_0x37aa('0x2')]]['queuecallerjoinAt']);queues[_0x1dbbe2[_0x37aa('0x2')]][_0x37aa('0xf')]=_0x1dbbe2[_0x37aa('0xf')];queues[_0x1dbbe2[_0x37aa('0x2')]][_0x37aa('0x23')]=_0x1dbbe2[_0x37aa('0x23')];queues[_0x1dbbe2['uniqueid']]['connectedlinenum']=_0x1dbbe2['connectedlinenum'];queues[_0x1dbbe2[_0x37aa('0x2')]][_0x37aa('0x24')]=_0x1dbbe2['connectedlinename'];}};exports[_0x37aa('0x25')]=function(_0x3ab380){if(!_[_0x37aa('0x12')](queues[_0x3ab380['uniqueid']])){queues[_0x3ab380[_0x37aa('0x2')]]['queuecallerabandon']=![];queues[_0x3ab380[_0x37aa('0x2')]]['queuecallerabandon']=![];queues[_0x3ab380[_0x37aa('0x2')]][_0x37aa('0x1a')]=null;queues[_0x3ab380['uniqueid']]['queuecallerexit']=![];queues[_0x3ab380['uniqueid']][_0x37aa('0x1b')]=null;queues[_0x3ab380[_0x37aa('0x2')]]['assigned']=!![];queues[_0x3ab380[_0x37aa('0x2')]]['accountcode']=_0x3ab380[_0x37aa('0x26')];queues[_0x3ab380[_0x37aa('0x2')]][_0x37aa('0x5')]=_0x3ab380[_0x37aa('0x27')];}};exports['agentcomplete']=function(_0x2ca4a6){if(!_[_0x37aa('0x12')](queues[_0x2ca4a6['uniqueid']])){if(queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x13')]){queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x14')]=![];queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x14')]=![];queues[_0x2ca4a6['uniqueid']][_0x37aa('0x1a')]=null;queues[_0x2ca4a6[_0x37aa('0x2')]]['queuecallerexit']=![];queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x1b')]=null;queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x28')]=!![];queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x5')]=_0x2ca4a6['membername'];queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x15')]=!![];queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x29')]=utils[_0x37aa('0x10')]();if(_0x2ca4a6[_0x37aa('0x2a')]=='transfer'){if(!queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x2b')]){queues[_0x2ca4a6[_0x37aa('0x2')]][_0x37aa('0x8')]=_0x37aa('0x2c');}}else{queues[_0x2ca4a6[_0x37aa('0x2')]]['queuecallerexitreason']=_0x37aa('0x2d')+_0x2ca4a6[_0x37aa('0x2a')]['toUpperCase']();}writeDB(queues[_0x2ca4a6[_0x37aa('0x2')]]);}}};exports[_0x37aa('0x2e')]=function(_0x21cb13){if(!_[_0x37aa('0x12')](queues[_0x21cb13['transfereeuniqueid']])){queues[_0x21cb13[_0x37aa('0x2f')]][_0x37aa('0x2b')]=!![];queues[_0x21cb13[_0x37aa('0x2f')]][_0x37aa('0x30')]='BLIND';queues[_0x21cb13[_0x37aa('0x2f')]][_0x37aa('0x31')]=_0x21cb13['extension'];queues[_0x21cb13[_0x37aa('0x2f')]][_0x37aa('0x32')]=_0x21cb13[_0x37aa('0x2f')];queues[_0x21cb13[_0x37aa('0x2f')]][_0x37aa('0x8')]='BLINDTRANSFER';}};exports[_0x37aa('0x33')]=function(_0x2c8a6f){try{if(_0x2c8a6f[_0x37aa('0x34')]==_0x2c8a6f['origtransfererlinkedid']){if(!_[_0x37aa('0x12')](queues[_0x2c8a6f['secondtransfererlinkedid']])){queues[_0x2c8a6f[_0x37aa('0x35')]][_0x37aa('0x2b')]=!![];queues[_0x2c8a6f[_0x37aa('0x35')]][_0x37aa('0x30')]=_0x37aa('0x36');queues[_0x2c8a6f[_0x37aa('0x35')]]['transferexten']=_0x2c8a6f[_0x37aa('0x37')];queues[_0x2c8a6f[_0x37aa('0x35')]][_0x37aa('0x32')]=_0x2c8a6f[_0x37aa('0x34')];queues[_0x2c8a6f[_0x37aa('0x35')]][_0x37aa('0x8')]=_0x37aa('0x38');}if(!_['isNil'](queues[_0x2c8a6f[_0x37aa('0x39')]])){if(_0x2c8a6f[_0x37aa('0x3a')]&&queues[_0x2c8a6f[_0x37aa('0x3a')]]){queues[_0x2c8a6f[_0x37aa('0x3a')]][_0x37aa('0x3b')]=0x1;queues[_0x2c8a6f['transfereeuniqueid']]=_[_0x37aa('0x3c')](queues[_0x2c8a6f['transfereelinkedid']]);queues[_0x2c8a6f['transfereeuniqueid']][_0x37aa('0xd')]=_0x2c8a6f[_0x37aa('0x3d')];queues[_0x2c8a6f[_0x37aa('0x2f')]][_0x37aa('0x3b')]=0x2;queues[_0x2c8a6f[_0x37aa('0x2f')]][_0x37aa('0x6')]=queues[_0x2c8a6f[_0x37aa('0x35')]][_0x37aa('0x6')];queues[_0x2c8a6f[_0x37aa('0x2f')]][_0x37aa('0x3e')]=queues[_0x2c8a6f[_0x37aa('0x35')]][_0x37aa('0x3e')];queues[_0x2c8a6f[_0x37aa('0x2f')]][_0x37aa('0x3f')]=utils[_0x37aa('0x10')]();queues[_0x2c8a6f[_0x37aa('0x2f')]]['queuecallerleaveAt']=utils[_0x37aa('0x10')]();queues[_0x2c8a6f[_0x37aa('0x2f')]][_0x37aa('0x21')]=0x0;queues[_0x2c8a6f['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x2c8a6f['origtransfererlinkedid']][_0x37aa('0xd')]=_0x2c8a6f[_0x37aa('0x35')];}}}else if(_0x2c8a6f['secondtransfereruniqueid']==_0x2c8a6f['secondtransfererlinkedid']){if(!_[_0x37aa('0x12')](queues[_0x2c8a6f[_0x37aa('0x39')]])){queues[_0x2c8a6f['origtransfererlinkedid']][_0x37aa('0x2b')]=!![];queues[_0x2c8a6f['origtransfererlinkedid']][_0x37aa('0x30')]=_0x37aa('0x36');queues[_0x2c8a6f[_0x37aa('0x39')]]['transferexten']=_0x2c8a6f['secondtransfererexten'];queues[_0x2c8a6f[_0x37aa('0x39')]]['transferuniqueid']=_0x2c8a6f[_0x37aa('0x40')];queues[_0x2c8a6f['origtransfererlinkedid']][_0x37aa('0x8')]=_0x37aa('0x38');}if(!_[_0x37aa('0x12')](queues[_0x2c8a6f[_0x37aa('0x35')]])){if(_0x2c8a6f[_0x37aa('0x41')]&&queues[_0x2c8a6f['transfertargetlinkedid']]){queues[_0x2c8a6f['transfertargetlinkedid']][_0x37aa('0x3b')]=0x1;queues[_0x2c8a6f[_0x37aa('0x3d')]]=_['clone'](queues[_0x2c8a6f[_0x37aa('0x41')]]);queues[_0x2c8a6f[_0x37aa('0x3d')]][_0x37aa('0xd')]=_0x2c8a6f[_0x37aa('0x3d')];queues[_0x2c8a6f[_0x37aa('0x3d')]][_0x37aa('0x3b')]=0x2;queues[_0x2c8a6f[_0x37aa('0x3d')]]['calleridnum']=queues[_0x2c8a6f[_0x37aa('0x39')]]['calleridnum'];queues[_0x2c8a6f[_0x37aa('0x3d')]][_0x37aa('0x3e')]=queues[_0x2c8a6f[_0x37aa('0x39')]]['calleridname'];queues[_0x2c8a6f[_0x37aa('0x3d')]][_0x37aa('0x3f')]=utils[_0x37aa('0x10')]();queues[_0x2c8a6f['transfertargetuniqueid']][_0x37aa('0x13')]=utils['now']();queues[_0x2c8a6f[_0x37aa('0x3d')]]['holdtime']=0x0;queues[_0x2c8a6f[_0x37aa('0x3d')]]['mohtime']=0x0;}else{queues[_0x2c8a6f[_0x37aa('0x35')]]['transfereduniqueid']=_0x2c8a6f[_0x37aa('0x39')];}}}}catch(_0x25572f){utils['error'](_0x25572f[_0x37aa('0x42')]);}};exports[_0x37aa('0x43')]=function(_0x4963ec){if(!_[_0x37aa('0x12')](queues[_0x4963ec[_0x37aa('0x2')]])){queues[_0x4963ec['uniqueid']][_0x37aa('0x44')]=utils[_0x37aa('0x10')]();}};exports[_0x37aa('0x45')]=function(_0x19bcb0){if(!_[_0x37aa('0x12')](queues[_0x19bcb0[_0x37aa('0x2')]])){if(!_['isNil'](queues[_0x19bcb0['uniqueid']]['musiconholdstartAt'])){queues[_0x19bcb0[_0x37aa('0x2')]][_0x37aa('0x46')]+=utils[_0x37aa('0x22')](utils['now'](),queues[_0x19bcb0['uniqueid']][_0x37aa('0x44')]);delete queues[_0x19bcb0[_0x37aa('0x2')]][_0x37aa('0x44')];}}}; \ No newline at end of file +var _0xbfbb=['clone','calleridname','secondtransfereruniqueid','ATTENDED','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','mohtime','error','stack','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','variable','queuestatus','queuecallerexitAt','value','toUpperCase','queueposition','queuecallerabandonAt','ABANDONED','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','membername','queuecallercompleteAt','TRANSFER','COMPLETEDBY','reason','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfer','transfertype','origtransfererexten','transfereelinkedid','queuecallerenterreason'];(function(_0x15733d,_0x5a6fb1){var _0x165f71=function(_0x1a7d8f){while(--_0x1a7d8f){_0x15733d['push'](_0x15733d['shift']());}};_0x165f71(++_0x5a6fb1);}(_0xbfbb,0xf7));var _0xbbfb=function(_0x3ac5de,_0x294003){_0x3ac5de=_0x3ac5de-0x0;var _0x1a96cd=_0xbfbb[_0x3ac5de];return _0x1a96cd;};'use strict';var _=require(_0xbbfb('0x0'));var util=require(_0xbbfb('0x1'));var utils=require(_0xbbfb('0x2'));var queues={};function writeDB(_0x58851c){utils[_0xbbfb('0x3')](util[_0xbbfb('0x4')](_0xbbfb('0x5'),_0x58851c[_0xbbfb('0x6')],_0x58851c[_0xbbfb('0x7')],_0x58851c['queue'],_0x58851c[_0xbbfb('0x8')],_0x58851c[_0xbbfb('0x9')],_0x58851c[_0xbbfb('0xa')],_0x58851c[_0xbbfb('0xb')]));if(_0x58851c[_0xbbfb('0xc')]){utils[_0xbbfb('0xd')](_0x58851c[_0xbbfb('0xc')])[_0xbbfb('0xe')](function(_0xc575a3){if(_0xc575a3){_0x58851c[_0xbbfb('0xf')]=_0xc575a3[_0xbbfb('0xf')];}utils[_0xbbfb('0x10')](_0xbbfb('0x11'),_0x58851c);});}else{utils['request'](_0xbbfb('0x11'),_0x58851c);}if(_0x58851c[_0xbbfb('0x12')]){delete queues[_0x58851c[_0xbbfb('0x12')]];}else{delete queues[_0x58851c[_0xbbfb('0x6')]];}}exports[_0xbbfb('0x13')]=function(_0x4470b6){queues[_0x4470b6[_0xbbfb('0x6')]]=_[_0xbbfb('0x14')](_0x4470b6,{'originalposition':_0x4470b6[_0xbbfb('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports['hangup']=function(_0x3e60c3){if(!_[_0xbbfb('0x16')](queues[_0x3e60c3[_0xbbfb('0x6')]])){if(queues[_0x3e60c3[_0xbbfb('0x6')]][_0xbbfb('0x17')]){if(!queues[_0x3e60c3['uniqueid']][_0xbbfb('0x18')]&&!queues[_0x3e60c3[_0xbbfb('0x6')]][_0xbbfb('0x19')]){queues[_0x3e60c3[_0xbbfb('0x6')]][_0xbbfb('0x1a')]=!![];queues[_0x3e60c3[_0xbbfb('0x6')]]['queuecallercompleteAt']=utils[_0xbbfb('0x1b')]();queues[_0x3e60c3[_0xbbfb('0x6')]][_0xbbfb('0xb')]=_0xbbfb('0x1c');}writeDB(queues[_0x3e60c3['uniqueid']]);}else{if(queues[_0x3e60c3[_0xbbfb('0x6')]][_0xbbfb('0x12')]){queues[queues[_0x3e60c3[_0xbbfb('0x6')]][_0xbbfb('0x12')]]=queues[_0x3e60c3[_0xbbfb('0x6')]];queues[queues[_0x3e60c3[_0xbbfb('0x6')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x3e60c3[_0xbbfb('0x6')]];}}}};exports['varset']=function(_0x3f119b){if(!_[_0xbbfb('0x16')](_0x3f119b[_0xbbfb('0x1d')][_0xbbfb('0x1e')])){if(!_['isNil'](queues[_0x3f119b[_0xbbfb('0x6')]])){queues[_0x3f119b['uniqueid']][_0xbbfb('0x18')]=![];queues[_0x3f119b[_0xbbfb('0x6')]]['queuecallerabandonAt']=null;queues[_0x3f119b['uniqueid']][_0xbbfb('0x19')]=!![];queues[_0x3f119b['uniqueid']][_0xbbfb('0x1f')]=utils['now']();queues[_0x3f119b['uniqueid']][_0xbbfb('0xb')]=_0x3f119b[_0xbbfb('0x20')][_0xbbfb('0x21')]();writeDB(queues[_0x3f119b[_0xbbfb('0x6')]]);}}else if(!_[_0xbbfb('0x16')](_0x3f119b[_0xbbfb('0x1d')][_0xbbfb('0x22')])){if(!_['isNil'](queues[_0x3f119b[_0xbbfb('0x6')]])&&!queues[_0x3f119b[_0xbbfb('0x6')]][_0xbbfb('0x18')]){queues[_0x3f119b['uniqueid']]['queuecallerabandon']=![];queues[_0x3f119b[_0xbbfb('0x6')]][_0xbbfb('0x23')]=null;queues[_0x3f119b[_0xbbfb('0x6')]][_0xbbfb('0x19')]=!![];queues[_0x3f119b[_0xbbfb('0x6')]][_0xbbfb('0x1f')]=utils['now']();queues[_0x3f119b[_0xbbfb('0x6')]][_0xbbfb('0xb')]='EXITWITHKEY';}}};exports[_0xbbfb('0x18')]=function(_0x220fdc){if(!_[_0xbbfb('0x16')](queues[_0x220fdc['uniqueid']])){queues[_0x220fdc['uniqueid']][_0xbbfb('0x19')]=![];queues[_0x220fdc['uniqueid']][_0xbbfb('0x1f')]=null;queues[_0x220fdc[_0xbbfb('0x6')]][_0xbbfb('0x18')]=!![];queues[_0x220fdc[_0xbbfb('0x6')]][_0xbbfb('0x23')]=utils[_0xbbfb('0x1b')]();queues[_0x220fdc[_0xbbfb('0x6')]]['queuecallerexitreason']=_0xbbfb('0x24');}};exports['queuecallerleave']=function(_0x11f009){if(!_[_0xbbfb('0x16')](queues[_0x11f009['uniqueid']])){queues[_0x11f009[_0xbbfb('0x6')]]['queuecallerleave']=!![];queues[_0x11f009[_0xbbfb('0x6')]][_0xbbfb('0x17')]=utils['now']();queues[_0x11f009[_0xbbfb('0x6')]][_0xbbfb('0x25')]=utils[_0xbbfb('0x26')](queues[_0x11f009[_0xbbfb('0x6')]]['queuecallerleaveAt'],queues[_0x11f009[_0xbbfb('0x6')]][_0xbbfb('0x27')]);queues[_0x11f009[_0xbbfb('0x6')]][_0xbbfb('0x15')]=_0x11f009['position'];queues[_0x11f009['uniqueid']][_0xbbfb('0x28')]=_0x11f009[_0xbbfb('0x28')];queues[_0x11f009[_0xbbfb('0x6')]]['connectedlinenum']=_0x11f009[_0xbbfb('0x29')];queues[_0x11f009['uniqueid']][_0xbbfb('0x2a')]=_0x11f009[_0xbbfb('0x2a')];}};exports[_0xbbfb('0x2b')]=function(_0x1241a4){if(!_[_0xbbfb('0x16')](queues[_0x1241a4[_0xbbfb('0x6')]])){queues[_0x1241a4[_0xbbfb('0x6')]][_0xbbfb('0x18')]=![];queues[_0x1241a4[_0xbbfb('0x6')]][_0xbbfb('0x18')]=![];queues[_0x1241a4[_0xbbfb('0x6')]][_0xbbfb('0x23')]=null;queues[_0x1241a4[_0xbbfb('0x6')]][_0xbbfb('0x19')]=![];queues[_0x1241a4[_0xbbfb('0x6')]][_0xbbfb('0x1f')]=null;queues[_0x1241a4[_0xbbfb('0x6')]][_0xbbfb('0x2c')]=!![];queues[_0x1241a4[_0xbbfb('0x6')]]['accountcode']=_0x1241a4['destaccountcode'];queues[_0x1241a4[_0xbbfb('0x6')]]['lastAssignedTo']=_0x1241a4[_0xbbfb('0x2d')];}};exports['agentcomplete']=function(_0x111b16){if(!_[_0xbbfb('0x16')](queues[_0x111b16['uniqueid']])){if(queues[_0x111b16[_0xbbfb('0x6')]]['queuecallerleaveAt']){queues[_0x111b16[_0xbbfb('0x6')]][_0xbbfb('0x18')]=![];queues[_0x111b16[_0xbbfb('0x6')]][_0xbbfb('0x18')]=![];queues[_0x111b16[_0xbbfb('0x6')]][_0xbbfb('0x23')]=null;queues[_0x111b16[_0xbbfb('0x6')]][_0xbbfb('0x19')]=![];queues[_0x111b16[_0xbbfb('0x6')]]['queuecallerexitAt']=null;queues[_0x111b16[_0xbbfb('0x6')]][_0xbbfb('0x2c')]=!![];queues[_0x111b16[_0xbbfb('0x6')]]['lastAssignedTo']=_0x111b16[_0xbbfb('0x2d')];queues[_0x111b16[_0xbbfb('0x6')]]['queuecallercomplete']=!![];queues[_0x111b16['uniqueid']][_0xbbfb('0x2e')]=utils[_0xbbfb('0x1b')]();if(_0x111b16['reason']=='transfer'){if(!queues[_0x111b16[_0xbbfb('0x6')]]['transfer']){queues[_0x111b16[_0xbbfb('0x6')]][_0xbbfb('0xb')]=_0xbbfb('0x2f');}}else{queues[_0x111b16['uniqueid']][_0xbbfb('0xb')]=_0xbbfb('0x30')+_0x111b16[_0xbbfb('0x31')][_0xbbfb('0x21')]();}writeDB(queues[_0x111b16['uniqueid']]);}}};exports['blindtransfer']=function(_0x37f61a){if(!_[_0xbbfb('0x16')](queues[_0x37f61a[_0xbbfb('0x32')]])){queues[_0x37f61a[_0xbbfb('0x32')]]['transfer']=!![];queues[_0x37f61a[_0xbbfb('0x32')]]['transfertype']=_0xbbfb('0x33');queues[_0x37f61a[_0xbbfb('0x32')]][_0xbbfb('0x34')]=_0x37f61a[_0xbbfb('0x35')];queues[_0x37f61a['transfereeuniqueid']][_0xbbfb('0x36')]=_0x37f61a[_0xbbfb('0x32')];queues[_0x37f61a[_0xbbfb('0x32')]][_0xbbfb('0xb')]=_0xbbfb('0x37');}};exports[_0xbbfb('0x38')]=function(_0x523b18){try{if(_0x523b18[_0xbbfb('0x39')]==_0x523b18[_0xbbfb('0x3a')]){if(!_[_0xbbfb('0x16')](queues[_0x523b18[_0xbbfb('0x3b')]])){queues[_0x523b18['secondtransfererlinkedid']][_0xbbfb('0x3c')]=!![];queues[_0x523b18['secondtransfererlinkedid']][_0xbbfb('0x3d')]='ATTENDED';queues[_0x523b18['secondtransfererlinkedid']]['transferexten']=_0x523b18[_0xbbfb('0x3e')];queues[_0x523b18[_0xbbfb('0x3b')]][_0xbbfb('0x36')]=_0x523b18['origtransfereruniqueid'];queues[_0x523b18[_0xbbfb('0x3b')]][_0xbbfb('0xb')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x523b18[_0xbbfb('0x3a')]])){if(_0x523b18['transfereelinkedid']&&queues[_0x523b18[_0xbbfb('0x3f')]]){queues[_0x523b18[_0xbbfb('0x3f')]][_0xbbfb('0x40')]=0x1;queues[_0x523b18[_0xbbfb('0x32')]]=_[_0xbbfb('0x41')](queues[_0x523b18['transfereelinkedid']]);queues[_0x523b18[_0xbbfb('0x32')]]['transfereduniqueid']=_0x523b18['transfertargetuniqueid'];queues[_0x523b18[_0xbbfb('0x32')]]['queuecallerenterreason']=0x2;queues[_0x523b18[_0xbbfb('0x32')]]['calleridnum']=queues[_0x523b18['secondtransfererlinkedid']][_0xbbfb('0x9')];queues[_0x523b18[_0xbbfb('0x32')]][_0xbbfb('0x42')]=queues[_0x523b18[_0xbbfb('0x3b')]][_0xbbfb('0x42')];queues[_0x523b18['transfereeuniqueid']][_0xbbfb('0x27')]=utils[_0xbbfb('0x1b')]();queues[_0x523b18['transfereeuniqueid']][_0xbbfb('0x17')]=utils[_0xbbfb('0x1b')]();queues[_0x523b18[_0xbbfb('0x32')]][_0xbbfb('0x25')]=0x0;queues[_0x523b18['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x523b18[_0xbbfb('0x3a')]]['transfereduniqueid']=_0x523b18[_0xbbfb('0x3b')];}}}else if(_0x523b18[_0xbbfb('0x43')]==_0x523b18[_0xbbfb('0x3b')]){if(!_[_0xbbfb('0x16')](queues[_0x523b18[_0xbbfb('0x3a')]])){queues[_0x523b18[_0xbbfb('0x3a')]][_0xbbfb('0x3c')]=!![];queues[_0x523b18[_0xbbfb('0x3a')]][_0xbbfb('0x3d')]=_0xbbfb('0x44');queues[_0x523b18[_0xbbfb('0x3a')]][_0xbbfb('0x34')]=_0x523b18[_0xbbfb('0x45')];queues[_0x523b18[_0xbbfb('0x3a')]][_0xbbfb('0x36')]=_0x523b18['secondtransfereruniqueid'];queues[_0x523b18[_0xbbfb('0x3a')]]['queuecallerexitreason']=_0xbbfb('0x46');}if(!_['isNil'](queues[_0x523b18['secondtransfererlinkedid']])){if(_0x523b18[_0xbbfb('0x47')]&&queues[_0x523b18[_0xbbfb('0x47')]]){queues[_0x523b18['transfertargetlinkedid']][_0xbbfb('0x40')]=0x1;queues[_0x523b18[_0xbbfb('0x48')]]=_[_0xbbfb('0x41')](queues[_0x523b18['transfertargetlinkedid']]);queues[_0x523b18[_0xbbfb('0x48')]][_0xbbfb('0x12')]=_0x523b18[_0xbbfb('0x48')];queues[_0x523b18['transfertargetuniqueid']][_0xbbfb('0x40')]=0x2;queues[_0x523b18[_0xbbfb('0x48')]][_0xbbfb('0x9')]=queues[_0x523b18[_0xbbfb('0x3a')]]['calleridnum'];queues[_0x523b18[_0xbbfb('0x48')]][_0xbbfb('0x42')]=queues[_0x523b18[_0xbbfb('0x3a')]][_0xbbfb('0x42')];queues[_0x523b18['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0xbbfb('0x1b')]();queues[_0x523b18['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xbbfb('0x1b')]();queues[_0x523b18[_0xbbfb('0x48')]][_0xbbfb('0x25')]=0x0;queues[_0x523b18[_0xbbfb('0x48')]][_0xbbfb('0x49')]=0x0;}else{queues[_0x523b18['secondtransfererlinkedid']]['transfereduniqueid']=_0x523b18[_0xbbfb('0x3a')];}}}}catch(_0x5c3429){utils[_0xbbfb('0x4a')](_0x5c3429[_0xbbfb('0x4b')]);}};exports['musiconholdstart']=function(_0x50ade8){if(!_['isNil'](queues[_0x50ade8['uniqueid']])){queues[_0x50ade8['uniqueid']][_0xbbfb('0x4c')]=utils['now']();}};exports[_0xbbfb('0x4d')]=function(_0x32bed7){if(!_[_0xbbfb('0x16')](queues[_0x32bed7['uniqueid']])){if(!_[_0xbbfb('0x16')](queues[_0x32bed7[_0xbbfb('0x6')]]['musiconholdstartAt'])){queues[_0x32bed7[_0xbbfb('0x6')]][_0xbbfb('0x49')]+=utils[_0xbbfb('0x26')](utils[_0xbbfb('0x1b')](),queues[_0x32bed7[_0xbbfb('0x6')]][_0xbbfb('0x4c')]);delete queues[_0x32bed7[_0xbbfb('0x6')]]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 025f699..d75d635 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 _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file +var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x5ce91c,_0x329114){var _0x1c4b84=function(_0x1de8dd){while(--_0x1de8dd){_0x5ce91c['push'](_0x5ce91c['shift']());}};_0x1c4b84(++_0x329114);}(_0xe706,0xa3));var _0x6e70=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0xe706[_0x53f608];return _0x495b7d;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 6835b92..a60a9a3 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 _0x8ea4=['stack','attendedtransfer','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','format','TRANSFER|%s','request','CreateVoiceTransferReport','blindtransfer','blind','error'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x8ea4,0x117));var _0x48ea=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x8ea4[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x23e15d){utils['info'](util[_0x48ea('0x0')](_0x48ea('0x1'),_0x23e15d['type']));utils[_0x48ea('0x2')](_0x48ea('0x3'),_0x23e15d);}exports[_0x48ea('0x4')]=function(_0x15bd1e){try{_0x15bd1e['type']=_0x48ea('0x5');writeDB(_0x15bd1e);}catch(_0x5264de){utils[_0x48ea('0x6')](_0x5264de[_0x48ea('0x7')]);}};exports[_0x48ea('0x8')]=function(_0x5cef0e){try{_0x5cef0e=_[_0x48ea('0x9')](_0x5cef0e,{'transfererchannel':_0x5cef0e[_0x48ea('0xa')],'transferercalleridnum':_0x5cef0e['origtransferercalleridnum'],'transferercalleridname':_0x5cef0e['origtransferercalleridname'],'transfererconnectedlinenum':_0x5cef0e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5cef0e[_0x48ea('0xb')],'transfereraccountcode':_0x5cef0e[_0x48ea('0xc')],'transferercontext':_0x5cef0e[_0x48ea('0xd')],'transfererexten':_0x5cef0e[_0x48ea('0xe')],'transfererlinkedid':_0x5cef0e[_0x48ea('0xf')],'context':_0x5cef0e[_0x48ea('0x10')],'extension':_0x5cef0e[_0x48ea('0x11')],'type':'attended'});if(_[_0x48ea('0x12')](_0x5cef0e[_0x48ea('0x13')])){_0x5cef0e=_[_0x48ea('0x9')](_0x5cef0e,{'transfereechannel':_0x5cef0e[_0x48ea('0x14')],'transfereecalleridnum':_0x5cef0e[_0x48ea('0x15')],'transfereecalleridname':_0x5cef0e[_0x48ea('0x16')],'transfereeconnectedlinenum':_0x5cef0e['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5cef0e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5cef0e[_0x48ea('0x17')],'transfereecontext':_0x5cef0e['transfertargetcontext'],'transfereeexten':_0x5cef0e[_0x48ea('0x18')],'transfereelinkedid':_0x5cef0e[_0x48ea('0x19')]});}writeDB(_0x5cef0e);}catch(_0x247316){utils[_0x48ea('0x6')](_0x247316[_0x48ea('0x7')]);}}; \ No newline at end of file +var _0xadb1=['error','stack','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','type','request','CreateVoiceTransferReport','blindtransfer','blind'];(function(_0x2cf648,_0x595257){var _0x49ec5f=function(_0xbb0bf3){while(--_0xbb0bf3){_0x2cf648['push'](_0x2cf648['shift']());}};_0x49ec5f(++_0x595257);}(_0xadb1,0x7a));var _0x1adb=function(_0x101bfb,_0x1adf6f){_0x101bfb=_0x101bfb-0x0;var _0x9f990=_0xadb1[_0x101bfb];return _0x9f990;};'use strict';var _=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var utils=require(_0x1adb('0x2'));function writeDB(_0x511a3e){utils[_0x1adb('0x3')](util[_0x1adb('0x4')]('TRANSFER|%s',_0x511a3e[_0x1adb('0x5')]));utils[_0x1adb('0x6')](_0x1adb('0x7'),_0x511a3e);}exports[_0x1adb('0x8')]=function(_0x120969){try{_0x120969['type']=_0x1adb('0x9');writeDB(_0x120969);}catch(_0x46b16f){utils[_0x1adb('0xa')](_0x46b16f[_0x1adb('0xb')]);}};exports['attendedtransfer']=function(_0x230081){try{_0x230081=_[_0x1adb('0xc')](_0x230081,{'transfererchannel':_0x230081[_0x1adb('0xd')],'transferercalleridnum':_0x230081['origtransferercalleridnum'],'transferercalleridname':_0x230081['origtransferercalleridname'],'transfererconnectedlinenum':_0x230081[_0x1adb('0xe')],'transfererconnectedlinename':_0x230081[_0x1adb('0xf')],'transfereraccountcode':_0x230081[_0x1adb('0x10')],'transferercontext':_0x230081[_0x1adb('0x11')],'transfererexten':_0x230081[_0x1adb('0x12')],'transfererlinkedid':_0x230081[_0x1adb('0x13')],'context':_0x230081[_0x1adb('0x14')],'extension':_0x230081[_0x1adb('0x15')],'type':_0x1adb('0x16')});if(_[_0x1adb('0x17')](_0x230081[_0x1adb('0x18')])){_0x230081=_[_0x1adb('0xc')](_0x230081,{'transfereechannel':_0x230081[_0x1adb('0x19')],'transfereecalleridnum':_0x230081[_0x1adb('0x1a')],'transfereecalleridname':_0x230081[_0x1adb('0x1b')],'transfereeconnectedlinenum':_0x230081[_0x1adb('0x1c')],'transfereeconnectedlinename':_0x230081['transfertargetconnectedlinename'],'transfereeaccountcode':_0x230081[_0x1adb('0x1d')],'transfereecontext':_0x230081[_0x1adb('0x1e')],'transfereeexten':_0x230081[_0x1adb('0x1f')],'transfereelinkedid':_0x230081[_0x1adb('0x20')]});}writeDB(_0x230081);}catch(_0xdc1165){utils['error'](_0xdc1165[_0x1adb('0xb')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 62422cb..3a83c8b 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 _0xcec3=['debug','stringify','error','stack','request','catch','GetUser','internal','name','interface','then','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','moment','client','xdr','info'];(function(_0xc39cd,_0xe5acdc){var _0x1d5aec=function(_0x134edd){while(--_0x134edd){_0xc39cd['push'](_0xc39cd['shift']());}};_0x1d5aec(++_0xe5acdc);}(_0xcec3,0xff));var _0x3cec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcec3[_0x40a045];return _0x1a687c;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x3cec('0x0'));var BPromise=require('bluebird');var client=jayson[_0x3cec('0x1')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x3cec('0x2'));exports[_0x3cec('0x3')]=function(_0x4aadbe){logger[_0x3cec('0x3')](_0x4aadbe);};exports[_0x3cec('0x4')]=function(_0x5329e7){logger['debug'](JSON[_0x3cec('0x5')](_0x5329e7));};exports[_0x3cec('0x6')]=function(_0x24eb84){logger[_0x3cec('0x6')](_0x24eb84[_0x3cec('0x7')]);};exports[_0x3cec('0x8')]=function(_0x2a8792,_0x58891e){return client[_0x3cec('0x8')](_0x2a8792,{'body':_0x58891e})['then'](function(_0x237108){logger[_0x3cec('0x4')](JSON[_0x3cec('0x5')](_0x237108));})[_0x3cec('0x9')](function(_0x58656a){logger['error'](_0x58656a[_0x3cec('0x7')]);});};function getUser(_0x1d0a5e){return client[_0x3cec('0x8')](_0x3cec('0xa'),{'options':{'raw':!![],'attributes':['id',_0x3cec('0xb'),_0x3cec('0xc'),_0x3cec('0xd')],'where':_0x1d0a5e,'limit':0x1}})[_0x3cec('0xe')](function(_0x2e68eb){logger[_0x3cec('0x3')]('GETUSER|'+JSON[_0x3cec('0x5')](_0x1d0a5e)+'|'+(_0x2e68eb[_0x3cec('0xf')][_0x3cec('0x10')]?_0x3cec('0x11'):_0x3cec('0x12')));return _0x2e68eb[_0x3cec('0xf')][_0x3cec('0x10')]?_0x2e68eb['result'][0x0]:null;});}exports[_0x3cec('0x13')]=function(_0x463aaa){return new BPromise(function(_0x3ad21d,_0x11e138){if(_0x463aaa){return getUser({'internal':_0x463aaa})[_0x3cec('0xe')](function(_0x587697){return _0x3ad21d(_0x587697);})[_0x3cec('0x9')](function(_0x337f40){logger[_0x3cec('0x6')](_0x337f40[_0x3cec('0x7')]);return _0x3ad21d(null);});}else{return _0x3ad21d(null);}});};exports[_0x3cec('0x14')]=function(_0x186ad2){return new BPromise(function(_0x29c69f,_0x323ba8){if(_0x186ad2){return getUser({'interface':_0x186ad2})['then'](function(_0x18ea77){return _0x29c69f(_0x18ea77);})[_0x3cec('0x9')](function(_0x2d07d7){logger[_0x3cec('0x6')](_0x2d07d7[_0x3cec('0x7')]);return _0x29c69f(null);});}else{return _0x29c69f(null);}});};exports[_0x3cec('0x15')]=function(_0x4f53c0){return new BPromise(function(_0x43307b,_0x520334){if(_0x4f53c0){return getUser({'name':_0x4f53c0})[_0x3cec('0xe')](function(_0x50b246){return _0x43307b(_0x50b246);})[_0x3cec('0x9')](function(_0x426c96){logger[_0x3cec('0x6')](_0x426c96['stack']);return _0x43307b(null);});}else{return _0x43307b(null);}});};exports[_0x3cec('0x16')]=function(_0x51d62c){return new BPromise(function(_0x29699e,_0x5d7bab){if(_0x51d62c){return client['request'](_0x3cec('0x17'),{'options':{'raw':!![],'attributes':['id',_0x3cec('0xc'),_0x3cec('0x18'),_0x3cec('0x19'),_0x3cec('0x1a')],'where':{'name':_0x51d62c},'limit':0x1}})[_0x3cec('0xe')](function(_0x33a338){logger[_0x3cec('0x3')]('GETVOICEQUEUEBYNAME|'+_0x51d62c+'|'+(_0x33a338[_0x3cec('0xf')]['length']?'FOUND':_0x3cec('0x12')));return _0x29699e(_0x33a338[_0x3cec('0xf')][_0x3cec('0x10')]?_0x33a338[_0x3cec('0xf')][0x0]:null);})['catch'](function(_0x3b1c02){logger[_0x3cec('0x6')](_0x3b1c02[_0x3cec('0x7')]);return _0x29699e(null);});}else{return _0x29699e(null);}});};exports['addTime']=function(_0x121d67,_0x4347bb){return moment(_0x121d67)[_0x3cec('0x1b')](_0x4347bb,_0x3cec('0x1c'))[_0x3cec('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3cec('0x1e')]=function(_0x4296e7,_0x91c813){return moment(_0x4296e7)['subtract'](_0x91c813,_0x3cec('0x1c'))[_0x3cec('0x1d')](_0x3cec('0x1f'));};exports[_0x3cec('0x20')]=function(_0x3618c8,_0x78e7a3){return moment(_0x3618c8)[_0x3cec('0x21')](moment(_0x78e7a3),_0x3cec('0x1c'));};exports['sumTime']=function(_0x2d4706,_0x36accc){return parseInt(_0x2d4706,0xa)+parseInt(_0x36accc,0xa);};exports[_0x3cec('0x22')]=function(){return moment()[_0x3cec('0x1d')](_0x3cec('0x1f'));};exports[_0x3cec('0x23')]=function(_0x83d5ff,_0x3faf35){if(_0x3faf35){return moment(_0x83d5ff)[_0x3cec('0x23')](_0x3faf35);}else{return!![];}};exports[_0x3cec('0x24')]=function(_0x51e494,_0x56e538){if(_0x56e538){return moment(_0x51e494)[_0x3cec('0x24')](_0x56e538);}else if(_0x51e494){return!![];}else{return![];}}; \ No newline at end of file +var _0xb0fc=['getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isBefore','jayson/promise','moment','bluebird','client','http','xdr','debug','stringify','error','stack','request','then','catch','GetUser','internal','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal'];(function(_0x34da86,_0x33235f){var _0x422427=function(_0x484d50){while(--_0x484d50){_0x34da86['push'](_0x34da86['shift']());}};_0x422427(++_0x33235f);}(_0xb0fc,0x8a));var _0xcb0f=function(_0xf96ff1,_0x1db6e7){_0xf96ff1=_0xf96ff1-0x0;var _0x1f4042=_0xb0fc[_0xf96ff1];return _0x1f4042;};'use strict';var jayson=require(_0xcb0f('0x0'));var moment=require(_0xcb0f('0x1'));var BPromise=require(_0xcb0f('0x2'));var client=jayson[_0xcb0f('0x3')][_0xcb0f('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xcb0f('0x5'));exports['info']=function(_0x1eac20){logger['info'](_0x1eac20);};exports[_0xcb0f('0x6')]=function(_0xe31b2b){logger[_0xcb0f('0x6')](JSON[_0xcb0f('0x7')](_0xe31b2b));};exports[_0xcb0f('0x8')]=function(_0xfb9995){logger[_0xcb0f('0x8')](_0xfb9995[_0xcb0f('0x9')]);};exports['request']=function(_0x5d3a6c,_0x296183){return client[_0xcb0f('0xa')](_0x5d3a6c,{'body':_0x296183})[_0xcb0f('0xb')](function(_0x5b48ca){logger[_0xcb0f('0x6')](JSON['stringify'](_0x5b48ca));})[_0xcb0f('0xc')](function(_0x2db565){logger['error'](_0x2db565['stack']);});};function getUser(_0x48b57b){return client[_0xcb0f('0xa')](_0xcb0f('0xd'),{'options':{'raw':!![],'attributes':['id',_0xcb0f('0xe'),'name',_0xcb0f('0xf')],'where':_0x48b57b,'limit':0x1}})[_0xcb0f('0xb')](function(_0x44e0fc){logger['info'](_0xcb0f('0x10')+JSON[_0xcb0f('0x7')](_0x48b57b)+'|'+(_0x44e0fc[_0xcb0f('0x11')][_0xcb0f('0x12')]?_0xcb0f('0x13'):_0xcb0f('0x14')));return _0x44e0fc['result'][_0xcb0f('0x12')]?_0x44e0fc['result'][0x0]:null;});}exports[_0xcb0f('0x15')]=function(_0x5733f5){return new BPromise(function(_0x299280,_0x193702){if(_0x5733f5){return getUser({'internal':_0x5733f5})[_0xcb0f('0xb')](function(_0x7d3fdf){return _0x299280(_0x7d3fdf);})[_0xcb0f('0xc')](function(_0x3d2157){logger['error'](_0x3d2157[_0xcb0f('0x9')]);return _0x299280(null);});}else{return _0x299280(null);}});};exports[_0xcb0f('0x16')]=function(_0x24c597){return new BPromise(function(_0x1a27db,_0xbd7e59){if(_0x24c597){return getUser({'interface':_0x24c597})[_0xcb0f('0xb')](function(_0x8b5bf5){return _0x1a27db(_0x8b5bf5);})['catch'](function(_0x74ddee){logger[_0xcb0f('0x8')](_0x74ddee[_0xcb0f('0x9')]);return _0x1a27db(null);});}else{return _0x1a27db(null);}});};exports[_0xcb0f('0x17')]=function(_0xeb8689){return new BPromise(function(_0x1f1cdd,_0x2d8447){if(_0xeb8689){return getUser({'name':_0xeb8689})[_0xcb0f('0xb')](function(_0x56d64b){return _0x1f1cdd(_0x56d64b);})[_0xcb0f('0xc')](function(_0x3a7785){logger[_0xcb0f('0x8')](_0x3a7785['stack']);return _0x1f1cdd(null);});}else{return _0x1f1cdd(null);}});};exports[_0xcb0f('0x18')]=function(_0x5084bd){return new BPromise(function(_0x1fd39d,_0xbdffea){if(_0x5084bd){return client[_0xcb0f('0xa')](_0xcb0f('0x19'),{'options':{'raw':!![],'attributes':['id',_0xcb0f('0x1a'),_0xcb0f('0x1b'),_0xcb0f('0x1c'),_0xcb0f('0x1d')],'where':{'name':_0x5084bd},'limit':0x1}})['then'](function(_0x4607d7){logger['info'](_0xcb0f('0x1e')+_0x5084bd+'|'+(_0x4607d7[_0xcb0f('0x11')][_0xcb0f('0x12')]?_0xcb0f('0x13'):_0xcb0f('0x14')));return _0x1fd39d(_0x4607d7[_0xcb0f('0x11')]['length']?_0x4607d7[_0xcb0f('0x11')][0x0]:null);})[_0xcb0f('0xc')](function(_0x2de321){logger['error'](_0x2de321[_0xcb0f('0x9')]);return _0x1fd39d(null);});}else{return _0x1fd39d(null);}});};exports['addTime']=function(_0x125400,_0x106581){return moment(_0x125400)['add'](_0x106581,'seconds')[_0xcb0f('0x1f')](_0xcb0f('0x20'));};exports[_0xcb0f('0x21')]=function(_0x59d9c8,_0x33d591){return moment(_0x59d9c8)[_0xcb0f('0x22')](_0x33d591,'seconds')[_0xcb0f('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xcb0f('0x23')]=function(_0x368f8b,_0x5ec728){return moment(_0x368f8b)[_0xcb0f('0x24')](moment(_0x5ec728),'seconds');};exports[_0xcb0f('0x25')]=function(_0x215c61,_0x4d43ca){return parseInt(_0x215c61,0xa)+parseInt(_0x4d43ca,0xa);};exports[_0xcb0f('0x26')]=function(){return moment()[_0xcb0f('0x1f')](_0xcb0f('0x20'));};exports['isAfter']=function(_0x1d967e,_0x35d93b){if(_0x35d93b){return moment(_0x1d967e)['isAfter'](_0x35d93b);}else{return!![];}};exports[_0xcb0f('0x27')]=function(_0x414b0d,_0x200e98){if(_0x200e98){return moment(_0x414b0d)['isBefore'](_0x200e98);}else if(_0x414b0d){return!![];}else{return![];}}; \ No newline at end of file